-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: the vanilla constructor is changed from
new JSONEditor(...)
t…
…o `createJSONEditor(...)` BREAKING CHANGE: The vanilla editor needs to be instantiated using `createJSONEditor(...)` instead of `new JSONEditor(...)` in preparation for the upgrade to Svelte 5.
- Loading branch information
Showing
12 changed files
with
76 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import JSONEditorComponent from './components/JSONEditor.svelte' | ||
import type { JSONEditorPropsOptional } from '$lib/types' | ||
|
||
// Note: index.ts exports `JSONEditor`, but we will override this on purpose | ||
// since we cannot use it in the vanilla environment starting in Svelte 5. | ||
export * from './index' | ||
|
||
interface CreateJSONEditorProps { | ||
target: HTMLDivElement | ||
props: JSONEditorPropsOptional | ||
} | ||
|
||
export function createJSONEditor({ target, props }: CreateJSONEditorProps) { | ||
// TODO: in Svelte 5, this needs to be changed to: | ||
// | ||
// export function createJSONEditor({ target, props }: Parameters<typeof mount>[1]) { | ||
// return mount(JSONEditor, { target, props }) | ||
// } | ||
// | ||
return new JSONEditorComponent({ target, props }) | ||
} | ||
|
||
/** | ||
* The constructor "new JSONEditor(...)" is deprecated. Please use "createJSONEditor(...)" instead. | ||
* @constructor | ||
* @deprecated | ||
*/ | ||
export function JSONEditor({ target, props }: CreateJSONEditorProps) { | ||
// TODO: deprecation warning since v1. Remove some day | ||
console.warn( | ||
'WARNING: the constructor "new JSONEditor(...)" is deprecated since v1. ' + | ||
'Please use "createJSONEditor(...)" instead.' | ||
) | ||
|
||
return createJSONEditor({ target, props }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters