@jbpark/live-editor 4.4.0 → 4.6.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/README.ko.md +4 -1
- package/README.md +7 -3
- package/dist/{boundary-B17cepvm.js → boundary-BLB80tyw.js} +8 -5
- package/dist/boundary-BLB80tyw.js.map +1 -0
- package/dist/cache-B0-XcIxJ.js.map +1 -1
- package/dist/{compile-DDfk5P25.js → compile-Dxas-D05.js} +3 -3
- package/dist/compile-Dxas-D05.js.map +1 -0
- package/dist/{constants-h1JAgOeW.js → constants-DU17Tdwo.js} +3 -3
- package/dist/constants-DU17Tdwo.js.map +1 -0
- package/dist/{context-DB5kW3qe.js → context-B8MzP7_p.js} +11 -5
- package/dist/context-B8MzP7_p.js.map +1 -0
- package/dist/{core-CRsAGpei.js → core-Bgfek364.js} +2 -2
- package/dist/core-Bgfek364.js.map +1 -0
- package/dist/{detect-typescript-CCj9ALXc.js → detect-typescript-Dr_oLniM.js} +2 -2
- package/dist/detect-typescript-Dr_oLniM.js.map +1 -0
- package/dist/dnd/index.d.ts +1 -1
- package/dist/dnd/index.js +1 -1
- package/dist/{dnd-BE5ZizqX.js → dnd-UoJILA75.js} +973 -885
- package/dist/dnd-UoJILA75.js.map +1 -0
- package/dist/{document-BDn_f08_.js → document-CGbe6bSV.js} +7739 -7736
- package/dist/document-CGbe6bSV.js.map +1 -0
- package/dist/editor/index.js +2 -2
- package/dist/{editor-DQ8Q--qR.js → editor-CMElfHer.js} +2 -2
- package/dist/editor-CMElfHer.js.map +1 -0
- package/dist/editor-caches-ClMvdcQF.js.map +1 -1
- package/dist/error/index.d.ts +1 -1
- package/dist/error/index.js +2 -2
- package/dist/{error-DWhxQEom.js → error-CN_GCnXB.js} +13 -6
- package/dist/error-CN_GCnXB.js.map +1 -0
- package/dist/{index-Dgh1JTX3.d.ts → index-C69Lv-jR.d.ts} +72 -69
- package/dist/{index-C4SGQ3Ci.d.ts → index-CRwEhJ7w.d.ts} +4 -1
- package/dist/{index-f7ijuNTa.d.ts → index-DKYUxi-E.d.ts} +115 -155
- package/dist/index-DrWtSKXu.d.ts +11 -0
- package/dist/index.d.ts +18 -18
- package/dist/index.js +12 -8
- package/dist/index.js.map +1 -1
- package/dist/{ast-dYb78955.js → items-B6OXxcLG.js} +588 -718
- package/dist/items-B6OXxcLG.js.map +1 -0
- package/dist/messages-CSrMI4Rm.js +133 -0
- package/dist/messages-CSrMI4Rm.js.map +1 -0
- package/dist/messages-IBPs4TkZ.d.ts +130 -0
- package/dist/preview/index.js +2 -2
- package/dist/{preview-BnaCEFsF.js → preview-CtyG5UbH.js} +6 -4
- package/dist/preview-CtyG5UbH.js.map +1 -0
- package/dist/provider/index.d.ts +3 -8
- package/dist/provider/index.js +3 -2
- package/dist/{sections-CBVMO8Jl.js → sections-BYWOBISr.js} +9 -4
- package/dist/sections-BYWOBISr.js.map +1 -0
- package/dist/states-Ci1AvoQ9.js.map +1 -1
- package/dist/style.css +505 -21
- package/dist/{use-dynamic-tailwind-Bcipc1hL.js → use-dynamic-tailwind-BP1toJkW.js} +66 -40
- package/dist/use-dynamic-tailwind-BP1toJkW.js.map +1 -0
- package/dist/utils/ast/index.d.ts +3 -2
- package/dist/utils/ast/index.js +150 -3
- package/dist/utils/ast/index.js.map +1 -0
- package/dist/utils/index.d.ts +30 -13
- package/dist/utils/index.js +26 -6
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/tailwind/index.js.map +1 -1
- package/dist/validate-DB59Z_Nx.d.ts +100 -0
- package/dist/validate-iLo8IONY.js +64 -0
- package/dist/validate-iLo8IONY.js.map +1 -0
- package/package.json +3 -3
- package/dist/ast-dYb78955.js.map +0 -1
- package/dist/boundary-B17cepvm.js.map +0 -1
- package/dist/compile-DDfk5P25.js.map +0 -1
- package/dist/constants-h1JAgOeW.js.map +0 -1
- package/dist/context-DB5kW3qe.js.map +0 -1
- package/dist/core-CRsAGpei.js.map +0 -1
- package/dist/detect-typescript-CCj9ALXc.js.map +0 -1
- package/dist/dnd-BE5ZizqX.js.map +0 -1
- package/dist/document-BDn_f08_.js.map +0 -1
- package/dist/editor-DQ8Q--qR.js.map +0 -1
- package/dist/error-DWhxQEom.js.map +0 -1
- package/dist/preview-BnaCEFsF.js.map +0 -1
- package/dist/sections-CBVMO8Jl.js.map +0 -1
- package/dist/use-dynamic-tailwind-Bcipc1hL.js.map +0 -1
package/dist/editor/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as Core } from "../core-
|
|
2
|
-
import { t as Editor } from "../editor-
|
|
1
|
+
import { t as Core } from "../core-Bgfek364.js";
|
|
2
|
+
import { t as Editor } from "../editor-CMElfHer.js";
|
|
3
3
|
export { Core, Editor as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as usePreview, r as useError } from "./states-Ci1AvoQ9.js";
|
|
2
|
-
import { n as useFormatCode, t as Core } from "./core-
|
|
2
|
+
import { n as useFormatCode, t as Core } from "./core-Bgfek364.js";
|
|
3
3
|
import { useCallback, useState } from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { useDebouncedCallback } from "@jbpark/use-hooks";
|
|
@@ -63,4 +63,4 @@ Editor.Core = Core;
|
|
|
63
63
|
//#endregion
|
|
64
64
|
export { Editor as t };
|
|
65
65
|
|
|
66
|
-
//# sourceMappingURL=editor-
|
|
66
|
+
//# sourceMappingURL=editor-CMElfHer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-CMElfHer.js","names":["Editor","EditorImpl"],"sources":["../src/components/editor/editor.tsx","../src/components/editor/index.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\n\nimport { useDebouncedCallback } from '@jbpark/use-hooks';\n\nimport { useError, usePreview } from '~/components/context/states';\n\nimport Core, { type Props as CoreProps } from './core';\nimport { useFormatCode } from './use-format-code';\n\nexport interface EditorRenderData {\n value: string;\n onChange: (value: string) => void;\n // The same Prettier formatting the built-in editor uses on Cmd+S, for a\n // custom editor's own format-on-save.\n formatCode: (code: string) => Promise<string>;\n}\n\nexport interface Props extends Omit<CoreProps, 'value' | 'onSave' | 'onError'> {\n value?: string;\n defaultValue?: string;\n debounce?: number;\n // Replaces the built-in CodeMirror editor. `Live.Editor` still sends the\n // value to the provider, debounced; only the editing surface changes.\n renderEditor?: (data: EditorRenderData) => React.ReactNode;\n}\n\nconst Editor = ({\n defaultValue,\n value: _value,\n debounce = 1000,\n onChange: _onChange,\n renderEditor,\n fragment,\n prettierOptions,\n ...props\n}: Props) => {\n const { code, setCode } = usePreview();\n const { setError } = useError();\n\n // Controlled, the host owns the document; uncontrolled, the provider does\n // (#341). `draft` shows each keystroke at once, while the provider hears\n // about it after `debounce`.\n const controlled = _value !== undefined;\n const [draft, setDraft] = useState(() => defaultValue ?? code);\n\n // The last code this editor pushed, and the provider code it has already\n // seen. A provider change that isn't this editor's own push came from\n // somewhere else sharing the provider — an uncontrolled DnD, say — and the\n // draft follows it. Adjusted during render so no frame shows the old one.\n const [pushed, setPushed] = useState<string | null>(null);\n const [seenCode, setSeenCode] = useState(code);\n\n if (code !== seenCode) {\n setSeenCode(code);\n\n if (!controlled && code !== pushed) {\n setDraft(code);\n }\n }\n\n const value = controlled ? _value : draft;\n\n const pushCode = useCallback(\n (next: string) => {\n setPushed(next);\n setCode(next);\n },\n [setCode],\n );\n\n const onChange = useCallback(\n (next: string) => {\n if (!controlled) {\n setDraft(next);\n }\n\n _onChange?.(next);\n },\n [_onChange, controlled],\n );\n\n // Formatting on save reaches the provider at once, ahead of the debounce.\n const onSave = useCallback(\n (formattedCode: string) => {\n pushCode(formattedCode);\n },\n [pushCode],\n );\n\n const onError = useCallback(\n (error: string | null) => {\n setError(error);\n },\n [setError],\n );\n\n const formatCode = useFormatCode({ fragment, prettierOptions });\n\n // Pushes `value` to the provider `debounce` ms after it stops changing,\n // and at once on mount. A pending push is never dropped: it runs when the\n // editor unmounts, and when focus leaves it — so clicking into another\n // surface right after typing edits a document that includes the typing.\n const push = useDebouncedCallback(\n () => pushCode(value),\n { delay: debounce, flushOnUnmount: true },\n [value],\n );\n\n // `display: contents` so the wrapper adds a blur listener without adding a\n // box: the editor lays out against this element's parent, as before.\n return (\n <div style={{ display: 'contents' }} onBlur={push.flush}>\n {renderEditor ? (\n renderEditor({ value, onChange, formatCode })\n ) : (\n <Core\n value={value}\n onChange={onChange}\n onSave={onSave}\n onError={onError}\n fragment={fragment}\n prettierOptions={prettierOptions}\n {...props}\n />\n )}\n </div>\n );\n};\n\nexport default Editor;\n","import Core, { type Props as CoreProps } from './core';\nimport EditorImpl, { type EditorRenderData, type Props } from './editor';\n\ntype EditorComponent = typeof EditorImpl & { Core: typeof Core };\n\nconst Editor = EditorImpl as EditorComponent;\n\nEditor.Core = Core;\n\nexport { Core };\nexport type { Props, CoreProps, EditorRenderData };\nexport default Editor;\n"],"mappings":";;;;;;AA0BA,MAAMA,YAAU,EACd,cACA,OAAO,QACP,WAAW,KACX,UAAU,WACV,cACA,UACA,iBACA,GAAG,YACQ;CACX,MAAM,EAAE,MAAM,YAAY,WAAW;CACrC,MAAM,EAAE,aAAa,SAAS;CAK9B,MAAM,aAAa,WAAW,KAAA;CAC9B,MAAM,CAAC,OAAO,YAAY,eAAe,gBAAgB,IAAI;CAM7D,MAAM,CAAC,QAAQ,aAAa,SAAwB,IAAI;CACxD,MAAM,CAAC,UAAU,eAAe,SAAS,IAAI;CAE7C,IAAI,SAAS,UAAU;EACrB,YAAY,IAAI;EAEhB,IAAI,CAAC,cAAc,SAAS,QAC1B,SAAS,IAAI;CAEjB;CAEA,MAAM,QAAQ,aAAa,SAAS;CAEpC,MAAM,WAAW,aACd,SAAiB;EAChB,UAAU,IAAI;EACd,QAAQ,IAAI;CACd,GACA,CAAC,OAAO,CACV;CAEA,MAAM,WAAW,aACd,SAAiB;EAChB,IAAI,CAAC,YACH,SAAS,IAAI;EAGf,YAAY,IAAI;CAClB,GACA,CAAC,WAAW,UAAU,CACxB;CAGA,MAAM,SAAS,aACZ,kBAA0B;EACzB,SAAS,aAAa;CACxB,GACA,CAAC,QAAQ,CACX;CAEA,MAAM,UAAU,aACb,UAAyB;EACxB,SAAS,KAAK;CAChB,GACA,CAAC,QAAQ,CACX;CAEA,MAAM,aAAa,cAAc;EAAE;EAAU;CAAgB,CAAC;CAM9D,MAAM,OAAO,2BACL,SAAS,KAAK,GACpB;EAAE,OAAO;EAAU,gBAAgB;CAAK,GACxC,CAAC,KAAK,CACR;CAIA,OACE,oBAAC,OAAD;EAAK,OAAO,EAAE,SAAS,WAAW;EAAG,QAAQ,KAAK;EAC/C,UAAA,eACC,aAAa;GAAE;GAAO;GAAU;EAAW,CAAC,IAE5C,oBAAC,MAAD;GACS;GACG;GACF;GACC;GACC;GACO;GACjB,GAAI;EACL,CAAA;CAEA,CAAA;AAET;;;AC1HA,MAAM,SAASC;AAEf,OAAO,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-caches-ClMvdcQF.js","names":[],"sources":["../src/utils/editor-caches.ts"],"sourcesContent":["//
|
|
1
|
+
{"version":3,"file":"editor-caches-ClMvdcQF.js","names":[],"sources":["../src/utils/editor-caches.ts"],"sourcesContent":["// The page-wide caches the editor owns: compiled modules, script blobs and\n// the AST parse caches. Each registers its own `clear` here when its module\n// loads, so this module imports none of them, and the provider doesn't pull\n// Babel into every bundle that mounts `Live` (#407). A section preview cache\n// belongs to its component and isn't listed here.\nconst editorCaches = new Set<() => void>();\n\nexport const registerEditorCache = (clear: () => void) => {\n editorCaches.add(clear);\n};\n\nexport const clearEditorCaches = () => {\n editorCaches.forEach(clear => clear());\n};\n\n// Shared by every editor on the page, so they're cleared only when the last\n// one unmounts. Clearing earlier could revoke a blob URL another editor is\n// about to load.\nlet activeEditorSessions = 0;\n\n// Returns the release function, so a caller can only release what it\n// acquired. Calling it twice is harmless, as React may in development.\nexport const registerEditorSession = (): (() => void) => {\n activeEditorSessions += 1;\n\n let released = false;\n\n return () => {\n if (released) {\n return;\n }\n\n released = true;\n activeEditorSessions -= 1;\n\n if (activeEditorSessions === 0) {\n clearEditorCaches();\n }\n };\n};\n"],"mappings":";AAKA,MAAM,+BAAe,IAAI,IAAgB;AAEzC,MAAa,uBAAuB,UAAsB;CACxD,aAAa,IAAI,KAAK;AACxB;AAEA,MAAa,0BAA0B;CACrC,aAAa,SAAQ,UAAS,MAAM,CAAC;AACvC;AAKA,IAAI,uBAAuB;AAI3B,MAAa,8BAA4C;CACvD,wBAAwB;CAExB,IAAI,WAAW;CAEf,aAAa;EACX,IAAI,UACF;EAGF,WAAW;EACX,wBAAwB;EAExB,IAAI,yBAAyB,GAC3B,kBAAkB;CAEtB;AACF"}
|
package/dist/error/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as Guard, o as Props, r as Runtime, s as ErrorBoundary, t as Error } from "../index-
|
|
1
|
+
import { i as Guard, o as Props, r as Runtime, s as ErrorBoundary, t as Error } from "../index-CRwEhJ7w.js";
|
|
2
2
|
export { ErrorBoundary, Guard as ErrorGuard, Runtime as ErrorRuntime, type Props, Error as default };
|
package/dist/error/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as ErrorBoundary } from "../boundary-
|
|
2
|
-
import { n as Runtime, r as Guard, t as Error } from "../error-
|
|
1
|
+
import { t as ErrorBoundary } from "../boundary-BLB80tyw.js";
|
|
2
|
+
import { n as Runtime, r as Guard, t as Error } from "../error-CN_GCnXB.js";
|
|
3
3
|
export { ErrorBoundary, Guard as ErrorGuard, Runtime as ErrorRuntime, Error as default };
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
+
import { i as useLiveMessages } from "./messages-CSrMI4Rm.js";
|
|
1
2
|
import { r as useError } from "./states-Ci1AvoQ9.js";
|
|
2
|
-
import { n as Error$1, t as ErrorBoundary } from "./boundary-
|
|
3
|
+
import { n as Error$1, t as ErrorBoundary } from "./boundary-BLB80tyw.js";
|
|
3
4
|
import { useEffect, useRef, useState } from "react";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
import { useEventListener } from "@jbpark/use-hooks";
|
|
6
7
|
//#region src/components/error/guard.tsx
|
|
7
8
|
const Guard = ({ children, onError }) => {
|
|
8
9
|
const [error, setError] = useState(null);
|
|
10
|
+
const messages = useLiveMessages();
|
|
9
11
|
const containerRef = useRef(null);
|
|
10
12
|
const errorHandled = useRef(false);
|
|
13
|
+
const messagesRef = useRef(messages);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
messagesRef.current = messages;
|
|
16
|
+
});
|
|
11
17
|
useEventListener("error", (event) => {
|
|
12
18
|
if (errorHandled.current) return;
|
|
13
19
|
errorHandled.current = true;
|
|
14
|
-
const errorMessage = event.error?.message || event.message ||
|
|
20
|
+
const errorMessage = event.error?.message || event.message || messagesRef.current.errors.unknown;
|
|
15
21
|
console.error("⚡ [Guard] Event handler error:", errorMessage);
|
|
16
22
|
event.preventDefault();
|
|
17
23
|
setError(errorMessage);
|
|
@@ -25,7 +31,7 @@ const Guard = ({ children, onError }) => {
|
|
|
25
31
|
const handleUnhandledRejection = (event) => {
|
|
26
32
|
if (errorHandled.current) return;
|
|
27
33
|
errorHandled.current = true;
|
|
28
|
-
const errorMessage = event.reason?.message ||
|
|
34
|
+
const errorMessage = event.reason?.message || messagesRef.current.errors.unhandledRejection;
|
|
29
35
|
event.preventDefault();
|
|
30
36
|
setError(errorMessage);
|
|
31
37
|
onError?.(event.reason || new window.Error(errorMessage));
|
|
@@ -39,7 +45,7 @@ const Guard = ({ children, onError }) => {
|
|
|
39
45
|
};
|
|
40
46
|
}, [onError]);
|
|
41
47
|
if (error) return /* @__PURE__ */ jsx(Error$1, {
|
|
42
|
-
title:
|
|
48
|
+
title: messages.errors.runtime,
|
|
43
49
|
message: error,
|
|
44
50
|
className: "m-4",
|
|
45
51
|
onReset: () => {
|
|
@@ -56,6 +62,7 @@ const Guard = ({ children, onError }) => {
|
|
|
56
62
|
//#region src/components/error/runtime.tsx
|
|
57
63
|
const Runtime = ({ open = true, reset }) => {
|
|
58
64
|
const { error: message, setError } = useError();
|
|
65
|
+
const messages = useLiveMessages();
|
|
59
66
|
useEventListener("error", (e) => {
|
|
60
67
|
setError(e.message);
|
|
61
68
|
e.preventDefault();
|
|
@@ -67,7 +74,7 @@ const Runtime = ({ open = true, reset }) => {
|
|
|
67
74
|
return /* @__PURE__ */ jsx(Error$1, {
|
|
68
75
|
message,
|
|
69
76
|
onReset: reset,
|
|
70
|
-
title:
|
|
77
|
+
title: messages.errors.runtime
|
|
71
78
|
});
|
|
72
79
|
};
|
|
73
80
|
//#endregion
|
|
@@ -79,4 +86,4 @@ Error.Guard = Guard;
|
|
|
79
86
|
//#endregion
|
|
80
87
|
export { Runtime as n, Guard as r, Error as t };
|
|
81
88
|
|
|
82
|
-
//# sourceMappingURL=error-
|
|
89
|
+
//# sourceMappingURL=error-CN_GCnXB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-CN_GCnXB.js","names":["ErrorComponent","Error","ErrorImpl","ErrorRuntime","ErrorGuard"],"sources":["../src/components/error/guard.tsx","../src/components/error/runtime.tsx","../src/components/error/index.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nimport { useEventListener } from '@jbpark/use-hooks';\n\nimport { useLiveMessages } from '~/components/context/messages';\n\nimport ErrorComponent from './error';\n\nexport interface Props {\n children: React.ReactNode;\n onError?: (error: Error) => void;\n}\n\nconst Guard = ({ children, onError }: Props) => {\n const [error, setError] = useState<string | null>(null);\n const messages = useLiveMessages();\n\n const containerRef = useRef<HTMLDivElement>(null);\n const errorHandled = useRef(false);\n // Read by the listeners, so new messages don't subscribe them again.\n const messagesRef = useRef(messages);\n\n useEffect(() => {\n messagesRef.current = messages;\n });\n\n useEventListener(\n 'error',\n event => {\n if (errorHandled.current) {\n return;\n }\n\n errorHandled.current = true;\n\n const errorMessage =\n event.error?.message ||\n event.message ||\n messagesRef.current.errors.unknown;\n\n console.error('⚡ [Guard] Event handler error:', errorMessage);\n\n event.preventDefault();\n\n setError(errorMessage);\n onError?.(event.error || new window.Error(errorMessage));\n\n setTimeout(() => {\n errorHandled.current = false;\n }, 100);\n },\n { capture: true },\n );\n\n useEffect(() => {\n const container = containerRef.current;\n\n if (!container) {\n return;\n }\n\n const handleUnhandledRejection = (event: PromiseRejectionEvent) => {\n if (errorHandled.current) {\n return;\n }\n\n errorHandled.current = true;\n\n const errorMessage =\n event.reason?.message || messagesRef.current.errors.unhandledRejection;\n\n event.preventDefault();\n setError(errorMessage);\n onError?.(event.reason || new window.Error(errorMessage));\n\n setTimeout(() => {\n errorHandled.current = false;\n }, 100);\n };\n\n window.addEventListener(\n 'unhandledrejection',\n handleUnhandledRejection,\n true,\n );\n\n return () => {\n window.removeEventListener(\n 'unhandledrejection',\n handleUnhandledRejection,\n true,\n );\n };\n }, [onError]);\n\n if (error) {\n return (\n <ErrorComponent\n title={messages.errors.runtime}\n message={error}\n className=\"m-4\"\n onReset={() => {\n setError(null);\n errorHandled.current = false;\n }}\n />\n );\n }\n\n return <div ref={containerRef}>{children}</div>;\n};\n\nexport default Guard;\n","import { useEffect } from 'react';\n\nimport { useEventListener } from '@jbpark/use-hooks';\n\nimport { useLiveMessages } from '~/components/context/messages';\nimport { useError } from '~/components/context/states';\n\nimport Error from './error';\n\nexport interface Props extends React.ComponentPropsWithRef<'div'> {\n open?: boolean;\n reset?: () => void;\n}\n\nconst Runtime = ({ open = true, reset }: Props) => {\n const { error: message, setError } = useError();\n const messages = useLiveMessages();\n\n useEventListener('error', e => {\n setError(e.message);\n e.preventDefault();\n });\n\n useEffect(() => {\n return () => setError(null);\n }, [setError]);\n\n if (!open) {\n return null;\n }\n\n return (\n <Error message={message} onReset={reset} title={messages.errors.runtime} />\n );\n};\n\nexport default Runtime;\n","import ErrorBoundary from './boundary';\nimport ErrorImpl, { type Props } from './error';\nimport ErrorGuard from './guard';\nimport ErrorRuntime from './runtime';\n\ntype ErrorComponent = typeof ErrorImpl & {\n Boundary: typeof ErrorBoundary;\n Runtime: typeof ErrorRuntime;\n Guard: typeof ErrorGuard;\n};\n\nconst Error = ErrorImpl as ErrorComponent;\n\nError.Boundary = ErrorBoundary;\nError.Runtime = ErrorRuntime;\nError.Guard = ErrorGuard;\n\nexport { ErrorBoundary, ErrorRuntime, ErrorGuard };\nexport type { Props };\nexport default Error;\n"],"mappings":";;;;;;;AAaA,MAAM,SAAS,EAAE,UAAU,cAAqB;CAC9C,MAAM,CAAC,OAAO,YAAY,SAAwB,IAAI;CACtD,MAAM,WAAW,gBAAgB;CAEjC,MAAM,eAAe,OAAuB,IAAI;CAChD,MAAM,eAAe,OAAO,KAAK;CAEjC,MAAM,cAAc,OAAO,QAAQ;CAEnC,gBAAgB;EACd,YAAY,UAAU;CACxB,CAAC;CAED,iBACE,UACA,UAAS;EACP,IAAI,aAAa,SACf;EAGF,aAAa,UAAU;EAEvB,MAAM,eACJ,MAAM,OAAO,WACb,MAAM,WACN,YAAY,QAAQ,OAAO;EAE7B,QAAQ,MAAM,kCAAkC,YAAY;EAE5D,MAAM,eAAe;EAErB,SAAS,YAAY;EACrB,UAAU,MAAM,SAAS,IAAI,OAAO,MAAM,YAAY,CAAC;EAEvD,iBAAiB;GACf,aAAa,UAAU;EACzB,GAAG,GAAG;CACR,GACA,EAAE,SAAS,KAAK,CAClB;CAEA,gBAAgB;EAGd,IAAI,CAFc,aAAa,SAG7B;EAGF,MAAM,4BAA4B,UAAiC;GACjE,IAAI,aAAa,SACf;GAGF,aAAa,UAAU;GAEvB,MAAM,eACJ,MAAM,QAAQ,WAAW,YAAY,QAAQ,OAAO;GAEtD,MAAM,eAAe;GACrB,SAAS,YAAY;GACrB,UAAU,MAAM,UAAU,IAAI,OAAO,MAAM,YAAY,CAAC;GAExD,iBAAiB;IACf,aAAa,UAAU;GACzB,GAAG,GAAG;EACR;EAEA,OAAO,iBACL,sBACA,0BACA,IACF;EAEA,aAAa;GACX,OAAO,oBACL,sBACA,0BACA,IACF;EACF;CACF,GAAG,CAAC,OAAO,CAAC;CAEZ,IAAI,OACF,OACE,oBAACA,SAAD;EACE,OAAO,SAAS,OAAO;EACvB,SAAS;EACT,WAAU;EACV,eAAe;GACb,SAAS,IAAI;GACb,aAAa,UAAU;EACzB;CACD,CAAA;CAIL,OAAO,oBAAC,OAAD;EAAK,KAAK;EAAe;CAAc,CAAA;AAChD;;;AChGA,MAAM,WAAW,EAAE,OAAO,MAAM,YAAmB;CACjD,MAAM,EAAE,OAAO,SAAS,aAAa,SAAS;CAC9C,MAAM,WAAW,gBAAgB;CAEjC,iBAAiB,UAAS,MAAK;EAC7B,SAAS,EAAE,OAAO;EAClB,EAAE,eAAe;CACnB,CAAC;CAED,gBAAgB;EACd,aAAa,SAAS,IAAI;CAC5B,GAAG,CAAC,QAAQ,CAAC;CAEb,IAAI,CAAC,MACH,OAAO;CAGT,OACE,oBAACC,SAAD;EAAgB;EAAS,SAAS;EAAO,OAAO,SAAS,OAAO;CAAU,CAAA;AAE9E;;;ACvBA,MAAM,QAAQC;AAEd,MAAM,WAAW;AACjB,MAAM,UAAUC;AAChB,MAAM,QAAQC"}
|
|
@@ -1,7 +1,61 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as BindingWidget, d as BindingOptions, f as BindingRegistry, g as BindingType, l as BindingKeyMap, m as BindingRenderMap, u as BindingOption, v as DataAttrNode } from "./validate-DB59Z_Nx.js";
|
|
2
2
|
import { v as Section } from "./document-Ct4jW78J.js";
|
|
3
|
+
import { B as UpdateFailure } from "./index-DKYUxi-E.js";
|
|
3
4
|
import { t as FrameProps } from "./index-DpDU1IAw.js";
|
|
4
5
|
import { useMultiSelect } from "@jbpark/use-hooks";
|
|
6
|
+
//#region src/components/dnd/canvas/section-fallback-context.d.ts
|
|
7
|
+
interface DndSectionFallbackArgs {
|
|
8
|
+
section: Section;
|
|
9
|
+
reason: 'compile' | 'runtime' | 'forced';
|
|
10
|
+
message?: string;
|
|
11
|
+
}
|
|
12
|
+
type DndRenderSectionFallback = (args: DndSectionFallbackArgs) => React.ReactNode | undefined;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/components/dnd/panel-binding.d.ts
|
|
15
|
+
interface PanelNodeChange {
|
|
16
|
+
(params: {
|
|
17
|
+
id: string;
|
|
18
|
+
label: string;
|
|
19
|
+
property: string;
|
|
20
|
+
value: unknown;
|
|
21
|
+
}): void;
|
|
22
|
+
}
|
|
23
|
+
interface PanelNodesChange {
|
|
24
|
+
(changes: Parameters<PanelNodeChange>[0][]): void;
|
|
25
|
+
}
|
|
26
|
+
interface PanelBinding {
|
|
27
|
+
id: string;
|
|
28
|
+
label: string;
|
|
29
|
+
property: string;
|
|
30
|
+
type?: BindingType;
|
|
31
|
+
widget?: BindingWidget;
|
|
32
|
+
options?: BindingOption[];
|
|
33
|
+
render?: BindingRenderMap;
|
|
34
|
+
min?: number;
|
|
35
|
+
max?: number;
|
|
36
|
+
pattern?: string;
|
|
37
|
+
required?: boolean;
|
|
38
|
+
meta?: Record<string, unknown>;
|
|
39
|
+
value: unknown;
|
|
40
|
+
rawValue: string;
|
|
41
|
+
canEditValue?: boolean;
|
|
42
|
+
present?: boolean;
|
|
43
|
+
element?: PanelBindingElement;
|
|
44
|
+
onChange: (value: unknown) => void;
|
|
45
|
+
}
|
|
46
|
+
interface PanelBindingElement {
|
|
47
|
+
tagName: string;
|
|
48
|
+
text: string;
|
|
49
|
+
}
|
|
50
|
+
type PanelBindingData = Omit<PanelBinding, 'onChange'>;
|
|
51
|
+
interface PanelBindingSource {
|
|
52
|
+
id: string;
|
|
53
|
+
tagName: string;
|
|
54
|
+
bindings: PanelBindingData[];
|
|
55
|
+
}
|
|
56
|
+
declare const resolvePanelBindings: (node: DataAttrNode) => PanelBindingSource | null;
|
|
57
|
+
declare const withPanelCommit: (bindings: PanelBindingData[], commit: PanelNodeChange | undefined) => PanelBinding[];
|
|
58
|
+
//#endregion
|
|
5
59
|
//#region src/components/dnd/panel/field.d.ts
|
|
6
60
|
interface FieldProps {
|
|
7
61
|
binding: PanelBinding;
|
|
@@ -60,60 +114,7 @@ interface DndInspector {
|
|
|
60
114
|
}
|
|
61
115
|
declare const useDndInspector: () => DndInspector;
|
|
62
116
|
//#endregion
|
|
63
|
-
//#region src/components/dnd/
|
|
64
|
-
interface PanelNodeChange {
|
|
65
|
-
(params: {
|
|
66
|
-
id: string;
|
|
67
|
-
label: string;
|
|
68
|
-
property: string;
|
|
69
|
-
value: unknown;
|
|
70
|
-
}): void;
|
|
71
|
-
}
|
|
72
|
-
interface PanelNodesChange {
|
|
73
|
-
(changes: Parameters<PanelNodeChange>[0][]): void;
|
|
74
|
-
}
|
|
75
|
-
interface PanelBinding {
|
|
76
|
-
id: string;
|
|
77
|
-
label: string;
|
|
78
|
-
property: string;
|
|
79
|
-
type?: BindingType;
|
|
80
|
-
widget?: BindingWidget;
|
|
81
|
-
options?: BindingOption[];
|
|
82
|
-
render?: BindingRenderMap;
|
|
83
|
-
min?: number;
|
|
84
|
-
max?: number;
|
|
85
|
-
pattern?: string;
|
|
86
|
-
required?: boolean;
|
|
87
|
-
meta?: Record<string, unknown>;
|
|
88
|
-
value: unknown;
|
|
89
|
-
rawValue: string;
|
|
90
|
-
canEditValue?: boolean;
|
|
91
|
-
present?: boolean;
|
|
92
|
-
element?: PanelBindingElement;
|
|
93
|
-
onChange: (value: unknown) => void;
|
|
94
|
-
}
|
|
95
|
-
interface PanelBindingElement {
|
|
96
|
-
tagName: string;
|
|
97
|
-
text: string;
|
|
98
|
-
}
|
|
99
|
-
type PanelBindingData = Omit<PanelBinding, 'onChange'>;
|
|
100
|
-
interface PanelBindingSource {
|
|
101
|
-
id: string;
|
|
102
|
-
tagName: string;
|
|
103
|
-
bindings: PanelBindingData[];
|
|
104
|
-
}
|
|
105
|
-
declare const resolvePanelBindings: (node: DataAttrNode) => PanelBindingSource | null;
|
|
106
|
-
declare const withPanelCommit: (bindings: PanelBindingData[], commit: PanelNodeChange | undefined) => PanelBinding[];
|
|
107
|
-
//#endregion
|
|
108
|
-
//#region src/components/dnd/section-fallback-context.d.ts
|
|
109
|
-
interface DndSectionFallbackArgs {
|
|
110
|
-
section: Section;
|
|
111
|
-
reason: 'compile' | 'runtime' | 'forced';
|
|
112
|
-
message?: string;
|
|
113
|
-
}
|
|
114
|
-
type DndRenderSectionFallback = (args: DndSectionFallbackArgs) => React.ReactNode | undefined;
|
|
115
|
-
//#endregion
|
|
116
|
-
//#region src/components/dnd/dnd.d.ts
|
|
117
|
+
//#region src/components/dnd/types.d.ts
|
|
117
118
|
interface DndPalette {
|
|
118
119
|
items: Section[];
|
|
119
120
|
onAdd: (item: Section) => void;
|
|
@@ -153,19 +154,9 @@ interface Props extends Omit<React.ComponentPropsWithRef<'div'>, 'onChange'> {
|
|
|
153
154
|
onNodePick?: (pick: DndNodePick) => void;
|
|
154
155
|
children?: React.ReactNode;
|
|
155
156
|
}
|
|
156
|
-
declare const Dnd$1: ({ value: _value, props, modules: _modules, onChange: _onChange, className, items, frame, dynamicTailwind, provider, renderField, onEditError, renderSectionFallback, shouldForceSectionFallback, onBeforeDelete, sectionNameFallback, containerId, bindings: bindingRegistry, bindingKeys, onNodePick, children, ...restProps }: Props) => import("react").JSX.Element;
|
|
157
157
|
//#endregion
|
|
158
|
-
//#region src/components/dnd/
|
|
159
|
-
|
|
160
|
-
ref: (node: HTMLElement | null) => void;
|
|
161
|
-
dragProps: React.HTMLAttributes<HTMLElement>;
|
|
162
|
-
isDragging: boolean;
|
|
163
|
-
}
|
|
164
|
-
interface DraggableItemProps {
|
|
165
|
-
item: Section;
|
|
166
|
-
children: (drag: DraggableItemDragState) => React.ReactNode;
|
|
167
|
-
}
|
|
168
|
-
declare const DraggableItem: ({ item, children }: DraggableItemProps) => import("react").ReactNode;
|
|
158
|
+
//#region src/components/dnd/dnd.d.ts
|
|
159
|
+
declare const Dnd$1: ({ value: _value, props, modules: _modules, onChange: _onChange, className, items, frame, dynamicTailwind, provider, renderField, onEditError, renderSectionFallback, shouldForceSectionFallback, onBeforeDelete, sectionNameFallback, containerId, bindings: bindingRegistry, bindingKeys, onNodePick, children, ...restProps }: Props) => import("react").JSX.Element;
|
|
169
160
|
//#endregion
|
|
170
161
|
//#region src/components/dnd/layout.d.ts
|
|
171
162
|
type DndRegionProps = Omit<React.ComponentPropsWithRef<'div'>, 'children'>;
|
|
@@ -191,6 +182,18 @@ declare const useDndPalette: () => DndPalette;
|
|
|
191
182
|
declare const useDndPanel: () => DndPanel;
|
|
192
183
|
declare const useDndLayout: () => DndLayout;
|
|
193
184
|
//#endregion
|
|
185
|
+
//#region src/components/dnd/palette/draggable.d.ts
|
|
186
|
+
interface DraggableItemDragState {
|
|
187
|
+
ref: (node: HTMLElement | null) => void;
|
|
188
|
+
dragProps: React.HTMLAttributes<HTMLElement>;
|
|
189
|
+
isDragging: boolean;
|
|
190
|
+
}
|
|
191
|
+
interface DraggableItemProps {
|
|
192
|
+
item: Section;
|
|
193
|
+
children: (drag: DraggableItemDragState) => React.ReactNode;
|
|
194
|
+
}
|
|
195
|
+
declare const DraggableItem: ({ item, children }: DraggableItemProps) => import("react").ReactNode;
|
|
196
|
+
//#endregion
|
|
194
197
|
//#region src/components/dnd/panel/use-dnd-children.d.ts
|
|
195
198
|
interface DndChildrenOptions {
|
|
196
199
|
onChange?: (value: string) => void;
|
|
@@ -318,5 +321,5 @@ type ChildrenEditor = DndChildren;
|
|
|
318
321
|
/** @deprecated Renamed to `DndChildrenOptions`. */
|
|
319
322
|
type ChildrenEditorOptions = DndChildrenOptions;
|
|
320
323
|
//#endregion
|
|
321
|
-
export {
|
|
322
|
-
//# sourceMappingURL=index-
|
|
324
|
+
export { PanelBindingSource as $, DndLayout as A, DndPalette as B, useDndItems as C, DraggableItem as D, useDndChildren as E, DndLayoutProps as F, useDndInspector as G, Props as H, DndRegionProps as I, Field as J, DndEditError as K, Layout as L, useDndPalette as M, useDndPanel as N, DraggableItemDragState as O, Canvas as P, PanelBindingElement as Q, Palette as R, DndItemsOptions as S, DndChildrenOptions as T, DndInspector as U, DndPanel as V, DndNodePick as W, PanelBinding as X, FieldProps as Y, PanelBindingData as Z, DndItemsActions as _, ItemsEditorActions as a, DndSectionFallbackArgs as at, DndItemsNestedElement as b, ItemsEditorNestedGroup as c, useItemsEditor as d, PanelNodeChange as et, FieldKind as f, DndItems as g, isStructuralFieldKind as h, ItemsEditor as i, DndRenderSectionFallback as it, useDndLayout as j, DraggableItemProps as k, ItemsEditorOptions as l, getFieldKind as m, ChildrenEditorOptions as n, resolvePanelBindings as nt, ItemsEditorItem as o, FieldKindBinding as p, DndRenderField as q, Dnd as r, withPanelCommit as rt, ItemsEditorNestedElement as s, ChildrenEditor as t, PanelNodesChange as tt, useChildrenEditor as u, DndItemsExpansion as v, DndChildren as w, DndItemsNestedGroup as x, DndItemsItem as y, Panel as z };
|
|
325
|
+
//# sourceMappingURL=index-C69Lv-jR.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as LiveMessages } from "./messages-IBPs4TkZ.js";
|
|
1
2
|
import React$1 from "react";
|
|
2
3
|
//#region src/components/error/boundary.d.ts
|
|
3
4
|
interface Props$3 {
|
|
@@ -12,6 +13,8 @@ interface State {
|
|
|
12
13
|
resetKeys?: readonly unknown[];
|
|
13
14
|
}
|
|
14
15
|
declare class ErrorBoundary extends React$1.Component<Props$3, State> {
|
|
16
|
+
static contextType: React$1.Context<LiveMessages>;
|
|
17
|
+
context: LiveMessages;
|
|
15
18
|
constructor(props: Props$3);
|
|
16
19
|
static getDerivedStateFromError(error: Error): Partial<State>;
|
|
17
20
|
componentDidCatch(error: Error, errorInfo: React$1.ErrorInfo): void;
|
|
@@ -51,4 +54,4 @@ type ErrorComponent = typeof Error$2 & {
|
|
|
51
54
|
declare const Error$1: ErrorComponent;
|
|
52
55
|
//#endregion
|
|
53
56
|
export { Props$1 as a, Guard as i, Props as n, Props$2 as o, Runtime as r, ErrorBoundary as s, Error$1 as t };
|
|
54
|
-
//# sourceMappingURL=index-
|
|
57
|
+
//# sourceMappingURL=index-CRwEhJ7w.d.ts.map
|