From 455ad55db9a72654ad8c8b6d20c54ddae20136ca Mon Sep 17 00:00:00 2001 From: Jos de Jong Date: Tue, 24 Sep 2024 10:58:26 +0200 Subject: [PATCH] feat: the vanilla constructor is changed from `new JSONEditor(...)` to `createJSONEditor(...)` BREAKING CHANGE: The vanilla editor needs to be instantiated using `createJSONEditor(...)` instead of `new JSONEditor(...)` in preparation for the upgrade to Svelte 5. --- README-VANILLA.md | 20 +++++------ README.md | 22 ++++++------ examples/browser/basic_usage.html | 4 +-- examples/browser/custom_theme_color.html | 4 +-- examples/browser/custom_value_renderer.html | 4 +-- examples/browser/json_schema_validation.html | 4 +-- examples/browser/toggle_options.html | 4 +-- rollup.config.vanilla-library.js | 2 +- src/lib/index-vanilla.ts | 36 ++++++++++++++++++++ src/lib/index.ts | 4 ++- tools/develop-vanilla.html | 6 ++-- tools/test-shadow-dom.html | 4 +-- 12 files changed, 76 insertions(+), 38 deletions(-) create mode 100644 src/lib/index-vanilla.ts diff --git a/README-VANILLA.md b/README-VANILLA.md index a4467d14..83e9cd48 100644 --- a/README-VANILLA.md +++ b/README-VANILLA.md @@ -38,17 +38,17 @@ If you have a setup for your project with a bundler (like Vite, Rollup, or Webpa ```ts // for use in a React, Vue, or Angular project -import { JSONEditor } from 'vanilla-jsoneditor' +import { createJSONEditor } from 'vanilla-jsoneditor' ``` If you want to use the library straight in the browser, use the provided standalone ES bundle: ```ts // for use directly in the browser -import { JSONEditor } from 'vanilla-jsoneditor/standalone.js' +import { createJSONEditor } from 'vanilla-jsoneditor/standalone.js' ``` -The standalone bundle contains all dependencies of `vanilla-jsoneditor`, for example `lodash-es` and `Ajv`. If you use some of these dependencies in your project too, it means that they will be bundled twice in your web application, leading to a needlessly large application size. In general, it is preferable to use the default `import { JSONEditor } from 'vanilla-jsoneditor'` so dependencies can be reused. +The standalone bundle contains all dependencies of `vanilla-jsoneditor`, for example `lodash-es` and `Ajv`. If you use some of these dependencies in your project too, it means that they will be bundled twice in your web application, leading to a needlessly large application size. In general, it is preferable to use the default `import { createJSONEditor } from 'vanilla-jsoneditor'` so dependencies can be reused. ## Use (Browser example loading the ES module) @@ -62,11 +62,11 @@ The standalone bundle contains all dependencies of `vanilla-jsoneditor`, for exa