@jbpark/live-editor 1.6.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ast-CXRFs1hO.mjs → ast-DiVN0l7x.mjs} +6 -2
- package/dist/ast-DiVN0l7x.mjs.map +1 -0
- package/dist/{document-BkOqiV4R.mjs → document-DJDRM79h.mjs} +58 -15
- package/dist/document-DJDRM79h.mjs.map +1 -0
- package/dist/index.mjs +14 -12
- package/dist/index.mjs.map +1 -1
- package/dist/utils/ast/index.mjs +2 -2
- package/dist/utils/index.mjs +2 -2
- package/dist/{utils-YMe7_mya.mjs → utils-D1tlgtgj.mjs} +4 -14
- package/dist/{utils-YMe7_mya.mjs.map → utils-D1tlgtgj.mjs.map} +1 -1
- package/package.json +3 -3
- package/dist/ast-CXRFs1hO.mjs.map +0 -1
- package/dist/document-BkOqiV4R.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as DRAGGABLE_ITEMS, b as __toESM, d as require_lib$1, f as require_lib, g as DEFAULT_TEMPLATE, p as BINDING_PROP } from "./document-
|
|
2
|
-
import { a as detectTypeScript, c as generateSections, d as replaceSections, i as compile, l as getCachedScriptBlob, n as clearCompilationCache, o as extractSections, r as cn, s as generateSection, t as baseModules, u as preloadScripts } from "./utils-
|
|
3
|
-
import { _ as parseArrayExpression, c as extract, d as getCurrentValue, f as parseBinding, g as extractObjectProperties, h as extractNodeValue, i as replaceIds, l as nanoid, m as createNodeFromValue, n as clone, o as update, p as arrayExpressionToCode, r as fillIds, t as validateBindingValue, u as findEditableChildren, v as parseValue, y as generateCode } from "./ast-
|
|
1
|
+
import { _ as DRAGGABLE_ITEMS, b as __toESM, d as require_lib$1, f as require_lib, g as DEFAULT_TEMPLATE, p as BINDING_PROP } from "./document-DJDRM79h.mjs";
|
|
2
|
+
import { a as detectTypeScript, c as generateSections, d as replaceSections, i as compile, l as getCachedScriptBlob, n as clearCompilationCache, o as extractSections, r as cn, s as generateSection, t as baseModules, u as preloadScripts } from "./utils-D1tlgtgj.mjs";
|
|
3
|
+
import { _ as parseArrayExpression, c as extract, d as getCurrentValue, f as parseBinding, g as extractObjectProperties, h as extractNodeValue, i as replaceIds, l as nanoid, m as createNodeFromValue, n as clone, o as update, p as arrayExpressionToCode, r as fillIds, t as validateBindingValue, u as findEditableChildren, v as parseValue, y as generateCode } from "./ast-DiVN0l7x.mjs";
|
|
4
4
|
import { generateTailwindCSS } from "./utils/tailwind/index.mjs";
|
|
5
5
|
import "@jbpark/ui-kit/style.css";
|
|
6
6
|
import React, { createContext, memo, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
@@ -11722,6 +11722,7 @@ const Items = ({ value, render, onChange, onChildChange }) => {
|
|
|
11722
11722
|
};
|
|
11723
11723
|
const addItem = () => {
|
|
11724
11724
|
const firstItem = objectItems[0];
|
|
11725
|
+
if (!firstItem) return;
|
|
11725
11726
|
const clonedElement = cloneObjectItemElement(firstItem);
|
|
11726
11727
|
const editableProperties = extractObjectProperties(clonedElement);
|
|
11727
11728
|
const nextItems = [...objectItems];
|
|
@@ -11845,6 +11846,7 @@ const Items = ({ value, render, onChange, onChildChange }) => {
|
|
|
11845
11846
|
icon: /* @__PURE__ */ jsx(Plus, {}),
|
|
11846
11847
|
variant: "solid",
|
|
11847
11848
|
color: "green",
|
|
11849
|
+
disabled: objectItems.length === 0,
|
|
11848
11850
|
onClick: addItem,
|
|
11849
11851
|
children: "Add Item"
|
|
11850
11852
|
})]
|
|
@@ -12382,7 +12384,7 @@ const Field = ({ binding, id, value, onChange }) => {
|
|
|
12382
12384
|
return;
|
|
12383
12385
|
}
|
|
12384
12386
|
setValidationError(null);
|
|
12385
|
-
if (next
|
|
12387
|
+
if (next !== value) onChange?.({
|
|
12386
12388
|
id,
|
|
12387
12389
|
label: binding.label,
|
|
12388
12390
|
value: next
|
|
@@ -12472,7 +12474,7 @@ const Field = ({ binding, id, value, onChange }) => {
|
|
|
12472
12474
|
return;
|
|
12473
12475
|
}
|
|
12474
12476
|
setValidationError(null);
|
|
12475
|
-
if (next
|
|
12477
|
+
if (next !== value) onChange?.({
|
|
12476
12478
|
id,
|
|
12477
12479
|
label: binding.label,
|
|
12478
12480
|
value: next
|
|
@@ -12493,7 +12495,7 @@ const Field = ({ binding, id, value, onChange }) => {
|
|
|
12493
12495
|
return;
|
|
12494
12496
|
}
|
|
12495
12497
|
setValidationError(null);
|
|
12496
|
-
if (next
|
|
12498
|
+
if (next !== value) onChange?.({
|
|
12497
12499
|
id,
|
|
12498
12500
|
label: binding.label,
|
|
12499
12501
|
value: next
|
|
@@ -12954,7 +12956,7 @@ const Guard = ({ children, onError }) => {
|
|
|
12954
12956
|
const errorHandled = useRef(false);
|
|
12955
12957
|
useEffect(() => {
|
|
12956
12958
|
if (!containerRef.current) return;
|
|
12957
|
-
const
|
|
12959
|
+
const handleWindowError = (event) => {
|
|
12958
12960
|
if (errorHandled.current) return;
|
|
12959
12961
|
errorHandled.current = true;
|
|
12960
12962
|
const errorMessage = event.error?.message || event.message || "Unknown error";
|
|
@@ -12967,7 +12969,7 @@ const Guard = ({ children, onError }) => {
|
|
|
12967
12969
|
}, 100);
|
|
12968
12970
|
return true;
|
|
12969
12971
|
};
|
|
12970
|
-
const
|
|
12972
|
+
const handleUnhandledRejection = (event) => {
|
|
12971
12973
|
if (errorHandled.current) return;
|
|
12972
12974
|
errorHandled.current = true;
|
|
12973
12975
|
const errorMessage = event.reason?.message || "Promise rejection";
|
|
@@ -12978,11 +12980,11 @@ const Guard = ({ children, onError }) => {
|
|
|
12978
12980
|
errorHandled.current = false;
|
|
12979
12981
|
}, 100);
|
|
12980
12982
|
};
|
|
12981
|
-
window.addEventListener("error",
|
|
12982
|
-
window.addEventListener("unhandledrejection",
|
|
12983
|
+
window.addEventListener("error", handleWindowError, true);
|
|
12984
|
+
window.addEventListener("unhandledrejection", handleUnhandledRejection, true);
|
|
12983
12985
|
return () => {
|
|
12984
|
-
window.removeEventListener("error",
|
|
12985
|
-
window.removeEventListener("unhandledrejection",
|
|
12986
|
+
window.removeEventListener("error", handleWindowError, true);
|
|
12987
|
+
window.removeEventListener("unhandledrejection", handleUnhandledRejection, true);
|
|
12986
12988
|
};
|
|
12987
12989
|
}, [onError]);
|
|
12988
12990
|
if (error) return /* @__PURE__ */ jsx(Error$2, {
|