@jbpark/live-editor 4.5.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 +5 -1
- package/dist/{boundary-DnjGgsK6.js → boundary-BLB80tyw.js} +2 -2
- 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-DsEXJl4h.js → context-B8MzP7_p.js} +3 -3
- 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-DGNp20Nk.js → dnd-UoJILA75.js} +431 -408
- package/dist/dnd-UoJILA75.js.map +1 -0
- package/dist/{document-DGHTfrda.js → document-CGbe6bSV.js} +2 -2
- package/dist/{document-DGHTfrda.js.map → document-CGbe6bSV.js.map} +1 -1
- 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-DwqwjJ2C.js → error-CN_GCnXB.js} +3 -3
- package/dist/{error-DwqwjJ2C.js.map → error-CN_GCnXB.js.map} +1 -1
- package/dist/{index-P9Aifaui.d.ts → index-C69Lv-jR.d.ts} +71 -69
- package/dist/{index-vtyggWy0.d.ts → index-CRwEhJ7w.d.ts} +2 -2
- package/dist/{index-CHknA6k1.d.ts → index-DKYUxi-E.d.ts} +10 -4
- package/dist/{index-WQgFy510.d.ts → index-DrWtSKXu.d.ts} +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -6
- package/dist/{items-DdrwGxJw.js → items-B6OXxcLG.js} +178 -259
- package/dist/items-B6OXxcLG.js.map +1 -0
- package/dist/{messages-CzUPVnzH.js → messages-CSrMI4Rm.js} +2 -1
- package/dist/messages-CSrMI4Rm.js.map +1 -0
- package/dist/{messages-Cp3g1mn1.d.ts → messages-IBPs4TkZ.d.ts} +2 -1
- package/dist/preview/index.js +2 -2
- package/dist/{preview-BKFgq_5u.js → preview-CtyG5UbH.js} +4 -4
- package/dist/{preview-BKFgq_5u.js.map → preview-CtyG5UbH.js.map} +1 -1
- package/dist/provider/index.d.ts +2 -2
- package/dist/provider/index.js +2 -2
- package/dist/{sections-BRH3KHYc.js → sections-BYWOBISr.js} +3 -3
- package/dist/sections-BYWOBISr.js.map +1 -0
- package/dist/states-Ci1AvoQ9.js.map +1 -1
- package/dist/{use-dynamic-tailwind-T9r9ExbR.js → use-dynamic-tailwind-BP1toJkW.js} +59 -39
- package/dist/use-dynamic-tailwind-BP1toJkW.js.map +1 -0
- package/dist/utils/ast/index.d.ts +1 -1
- package/dist/utils/ast/index.js +86 -2
- package/dist/utils/ast/index.js.map +1 -1
- package/dist/utils/index.js +4 -4
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/tailwind/index.js.map +1 -1
- package/dist/validate-iLo8IONY.js.map +1 -1
- package/package.json +1 -1
- package/dist/boundary-DnjGgsK6.js.map +0 -1
- package/dist/compile-DDfk5P25.js.map +0 -1
- package/dist/constants-h1JAgOeW.js.map +0 -1
- package/dist/context-DsEXJl4h.js.map +0 -1
- package/dist/core-CRsAGpei.js.map +0 -1
- package/dist/detect-typescript-CCj9ALXc.js.map +0 -1
- package/dist/dnd-DGNp20Nk.js.map +0 -1
- package/dist/editor-DQ8Q--qR.js.map +0 -1
- package/dist/items-DdrwGxJw.js.map +0 -1
- package/dist/messages-CzUPVnzH.js.map +0 -1
- package/dist/sections-BRH3KHYc.js.map +0 -1
- package/dist/use-dynamic-tailwind-T9r9ExbR.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,6 +1,6 @@
|
|
|
1
|
-
import { i as useLiveMessages } from "./messages-
|
|
1
|
+
import { i as useLiveMessages } from "./messages-CSrMI4Rm.js";
|
|
2
2
|
import { r as useError } from "./states-Ci1AvoQ9.js";
|
|
3
|
-
import { n as Error$1, t as ErrorBoundary } from "./boundary-
|
|
3
|
+
import { n as Error$1, t as ErrorBoundary } from "./boundary-BLB80tyw.js";
|
|
4
4
|
import { useEffect, useRef, useState } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { useEventListener } from "@jbpark/use-hooks";
|
|
@@ -86,4 +86,4 @@ Error.Guard = Guard;
|
|
|
86
86
|
//#endregion
|
|
87
87
|
export { Runtime as n, Guard as r, Error as t };
|
|
88
88
|
|
|
89
|
-
//# sourceMappingURL=error-
|
|
89
|
+
//# sourceMappingURL=error-CN_GCnXB.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-
|
|
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,8 +1,61 @@
|
|
|
1
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-
|
|
3
|
+
import { B as UpdateFailure } from "./index-DKYUxi-E.js";
|
|
4
4
|
import { t as FrameProps } from "./index-DpDU1IAw.js";
|
|
5
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
|
|
6
59
|
//#region src/components/dnd/panel/field.d.ts
|
|
7
60
|
interface FieldProps {
|
|
8
61
|
binding: PanelBinding;
|
|
@@ -61,60 +114,7 @@ interface DndInspector {
|
|
|
61
114
|
}
|
|
62
115
|
declare const useDndInspector: () => DndInspector;
|
|
63
116
|
//#endregion
|
|
64
|
-
//#region src/components/dnd/
|
|
65
|
-
interface PanelNodeChange {
|
|
66
|
-
(params: {
|
|
67
|
-
id: string;
|
|
68
|
-
label: string;
|
|
69
|
-
property: string;
|
|
70
|
-
value: unknown;
|
|
71
|
-
}): void;
|
|
72
|
-
}
|
|
73
|
-
interface PanelNodesChange {
|
|
74
|
-
(changes: Parameters<PanelNodeChange>[0][]): void;
|
|
75
|
-
}
|
|
76
|
-
interface PanelBinding {
|
|
77
|
-
id: string;
|
|
78
|
-
label: string;
|
|
79
|
-
property: string;
|
|
80
|
-
type?: BindingType;
|
|
81
|
-
widget?: BindingWidget;
|
|
82
|
-
options?: BindingOption[];
|
|
83
|
-
render?: BindingRenderMap;
|
|
84
|
-
min?: number;
|
|
85
|
-
max?: number;
|
|
86
|
-
pattern?: string;
|
|
87
|
-
required?: boolean;
|
|
88
|
-
meta?: Record<string, unknown>;
|
|
89
|
-
value: unknown;
|
|
90
|
-
rawValue: string;
|
|
91
|
-
canEditValue?: boolean;
|
|
92
|
-
present?: boolean;
|
|
93
|
-
element?: PanelBindingElement;
|
|
94
|
-
onChange: (value: unknown) => void;
|
|
95
|
-
}
|
|
96
|
-
interface PanelBindingElement {
|
|
97
|
-
tagName: string;
|
|
98
|
-
text: string;
|
|
99
|
-
}
|
|
100
|
-
type PanelBindingData = Omit<PanelBinding, 'onChange'>;
|
|
101
|
-
interface PanelBindingSource {
|
|
102
|
-
id: string;
|
|
103
|
-
tagName: string;
|
|
104
|
-
bindings: PanelBindingData[];
|
|
105
|
-
}
|
|
106
|
-
declare const resolvePanelBindings: (node: DataAttrNode) => PanelBindingSource | null;
|
|
107
|
-
declare const withPanelCommit: (bindings: PanelBindingData[], commit: PanelNodeChange | undefined) => PanelBinding[];
|
|
108
|
-
//#endregion
|
|
109
|
-
//#region src/components/dnd/section-fallback-context.d.ts
|
|
110
|
-
interface DndSectionFallbackArgs {
|
|
111
|
-
section: Section;
|
|
112
|
-
reason: 'compile' | 'runtime' | 'forced';
|
|
113
|
-
message?: string;
|
|
114
|
-
}
|
|
115
|
-
type DndRenderSectionFallback = (args: DndSectionFallbackArgs) => React.ReactNode | undefined;
|
|
116
|
-
//#endregion
|
|
117
|
-
//#region src/components/dnd/dnd.d.ts
|
|
117
|
+
//#region src/components/dnd/types.d.ts
|
|
118
118
|
interface DndPalette {
|
|
119
119
|
items: Section[];
|
|
120
120
|
onAdd: (item: Section) => void;
|
|
@@ -154,19 +154,9 @@ interface Props extends Omit<React.ComponentPropsWithRef<'div'>, 'onChange'> {
|
|
|
154
154
|
onNodePick?: (pick: DndNodePick) => void;
|
|
155
155
|
children?: React.ReactNode;
|
|
156
156
|
}
|
|
157
|
-
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;
|
|
158
157
|
//#endregion
|
|
159
|
-
//#region src/components/dnd/
|
|
160
|
-
|
|
161
|
-
ref: (node: HTMLElement | null) => void;
|
|
162
|
-
dragProps: React.HTMLAttributes<HTMLElement>;
|
|
163
|
-
isDragging: boolean;
|
|
164
|
-
}
|
|
165
|
-
interface DraggableItemProps {
|
|
166
|
-
item: Section;
|
|
167
|
-
children: (drag: DraggableItemDragState) => React.ReactNode;
|
|
168
|
-
}
|
|
169
|
-
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;
|
|
170
160
|
//#endregion
|
|
171
161
|
//#region src/components/dnd/layout.d.ts
|
|
172
162
|
type DndRegionProps = Omit<React.ComponentPropsWithRef<'div'>, 'children'>;
|
|
@@ -192,6 +182,18 @@ declare const useDndPalette: () => DndPalette;
|
|
|
192
182
|
declare const useDndPanel: () => DndPanel;
|
|
193
183
|
declare const useDndLayout: () => DndLayout;
|
|
194
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
|
|
195
197
|
//#region src/components/dnd/panel/use-dnd-children.d.ts
|
|
196
198
|
interface DndChildrenOptions {
|
|
197
199
|
onChange?: (value: string) => void;
|
|
@@ -319,5 +321,5 @@ type ChildrenEditor = DndChildren;
|
|
|
319
321
|
/** @deprecated Renamed to `DndChildrenOptions`. */
|
|
320
322
|
type ChildrenEditorOptions = DndChildrenOptions;
|
|
321
323
|
//#endregion
|
|
322
|
-
export {
|
|
323
|
-
//# 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,4 +1,4 @@
|
|
|
1
|
-
import { t as LiveMessages } from "./messages-
|
|
1
|
+
import { t as LiveMessages } from "./messages-IBPs4TkZ.js";
|
|
2
2
|
import React$1 from "react";
|
|
3
3
|
//#region src/components/error/boundary.d.ts
|
|
4
4
|
interface Props$3 {
|
|
@@ -54,4 +54,4 @@ type ErrorComponent = typeof Error$2 & {
|
|
|
54
54
|
declare const Error$1: ErrorComponent;
|
|
55
55
|
//#endregion
|
|
56
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 };
|
|
57
|
-
//# sourceMappingURL=index-
|
|
57
|
+
//# sourceMappingURL=index-CRwEhJ7w.d.ts.map
|
|
@@ -41,8 +41,7 @@ interface ArrayItem$1 {
|
|
|
41
41
|
//#region src/utils/ast/binding.d.ts
|
|
42
42
|
declare const findEditableChildren: (node: DataAttrNode) => DataAttrNode[];
|
|
43
43
|
//#endregion
|
|
44
|
-
//#region src/utils/ast/value.d.ts
|
|
45
|
-
declare const parseValue: (value: unknown) => unknown;
|
|
44
|
+
//#region src/utils/ast/editable-value.d.ts
|
|
46
45
|
type EditablePathSegment = string | number;
|
|
47
46
|
type EditablePrimitive = string | number | boolean;
|
|
48
47
|
interface EditableValueEntry {
|
|
@@ -52,6 +51,9 @@ interface EditableValueEntry {
|
|
|
52
51
|
declare const flattenEditableValue: (value: string) => EditableValueEntry[] | null;
|
|
53
52
|
declare const setEditableValue: (value: string, path: EditablePathSegment[], next: EditablePrimitive) => string;
|
|
54
53
|
//#endregion
|
|
54
|
+
//#region src/utils/ast/value.d.ts
|
|
55
|
+
declare const parseValue: (value: unknown) => unknown;
|
|
56
|
+
//#endregion
|
|
55
57
|
//#region src/utils/ast/update.d.ts
|
|
56
58
|
type UpdateFailure = {
|
|
57
59
|
reason: 'element-not-found';
|
|
@@ -82,6 +84,10 @@ type UpdateFailure = {
|
|
|
82
84
|
reason: 'attribute-not-found';
|
|
83
85
|
dataId: string;
|
|
84
86
|
property: string;
|
|
87
|
+
} | {
|
|
88
|
+
reason: 'self-closing';
|
|
89
|
+
dataId: string;
|
|
90
|
+
property: string;
|
|
85
91
|
} | {
|
|
86
92
|
reason: 'unsupported-syntax';
|
|
87
93
|
dataId: string;
|
|
@@ -217,5 +223,5 @@ declare const generateCode: (node: Node) => string;
|
|
|
217
223
|
/** @deprecated Internal. Use `clearEditorCaches` from `./utils`. Removed in the next major. */
|
|
218
224
|
declare const clearExtractCache: typeof clearExtractCache$1;
|
|
219
225
|
//#endregion
|
|
220
|
-
export { removeArrayItems as A, UpdateFailure as B, moveArrayItem as C, parseBindingExpression as D, parseBinding as E, ChildrenAction as F,
|
|
221
|
-
//# sourceMappingURL=index-
|
|
226
|
+
export { removeArrayItems as A, UpdateFailure as B, moveArrayItem as C, parseBindingExpression as D, parseBinding as E, ChildrenAction as F, parseValue as G, bulkUpdate as H, ChildrenEdit as I, EditableValueEntry as J, EditablePathSegment as K, getChildrenSignatures as L, resolveBindings as M, updateArrayItemProperty as N, parseItems as O, updateArrayItemValue as P, extract as Q, UpdateAllResult as R, isComponentTagName as S, parseArrayExpression as T, update as U, UpdateResult as V, updateAll as W, setEditableValue as X, flattenEditableValue as Y, findEditableChildren as Z, generateCode as _, NodeValueType as a, getRegistryBindings as b, canLosslesslyEvaluateSource as c, clone as d, createNodeFromValue as f, fillIds as g, extractObjectProperties as h, ItemKind as i, replaceIds as j, readNodeBindings as k, canStructurallyEditArray as l, extractNodeValue as m, EditableNodeValueType as n, appendArrayItem as o, duplicateArrayItems as p, EditablePrimitive as q, ExtractedNodeValue as r, arrayExpressionToCode as s, ArrayItem as t, clearExtractCache as u, getCurrentValue as v, moveArrayItems as w, getStructuredValue as x, getKeyBindings as y, UpdateEntry as z };
|
|
227
|
+
//# sourceMappingURL=index-DKYUxi-E.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as LiveMessagesInput } from "./messages-
|
|
1
|
+
import { n as LiveMessagesInput } from "./messages-IBPs4TkZ.js";
|
|
2
2
|
import React from "react";
|
|
3
3
|
//#region src/components/context/context.d.ts
|
|
4
4
|
interface Props {
|
|
@@ -8,4 +8,4 @@ interface Props {
|
|
|
8
8
|
declare const ContextProvider: ({ children, messages }: Props) => React.JSX.Element;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { Props as n, ContextProvider as t };
|
|
11
|
-
//# sourceMappingURL=index-
|
|
11
|
+
//# sourceMappingURL=index-DrWtSKXu.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { d as BindingOptions, f as BindingRegistry, h as BindingSchema, l as BindingKeyMap } from "./validate-DB59Z_Nx.js";
|
|
2
|
-
import { i as useLiveMessages, n as LiveMessagesInput, r as defaultMessages, t as LiveMessages } from "./messages-
|
|
3
|
-
import { n as Props } from "./index-
|
|
2
|
+
import { i as useLiveMessages, n as LiveMessagesInput, r as defaultMessages, t as LiveMessages } from "./messages-IBPs4TkZ.js";
|
|
3
|
+
import { n as Props } from "./index-DrWtSKXu.js";
|
|
4
4
|
import { v as Section } from "./document-Ct4jW78J.js";
|
|
5
|
+
import { A as DndLayout, B as DndPalette, H as Props$1, K as DndEditError, L as Layout, P as Canvas, R as Palette, S as DndItemsOptions, U as DndInspector, V as DndPanel, W as DndNodePick, X as PanelBinding, Y as FieldProps, at as DndSectionFallbackArgs, et as PanelNodeChange, g as DndItems, i as ItemsEditor, it as DndRenderSectionFallback, k as DraggableItemProps, l as ItemsEditorOptions, o as ItemsEditorItem, q as DndRenderField, r as Dnd, tt as PanelNodesChange, y as DndItemsItem, z as Panel } from "./index-C69Lv-jR.js";
|
|
5
6
|
import { t as FrameProps } from "./index-DpDU1IAw.js";
|
|
6
|
-
import { $ as DndInspector, B as DndPalette, D as DndLayout, F as Palette, G as PanelBinding, H as Props$1, I as Panel, P as Layout, S as DndItemsOptions, U as DndRenderSectionFallback, V as DndPanel, W as DndSectionFallbackArgs, X as PanelNodesChange, Y as PanelNodeChange, at as FieldProps, et as DndNodePick, g as DndItems, i as ItemsEditor, j as Canvas, l as ItemsEditorOptions, nt as DndEditError, o as ItemsEditorItem, r as Dnd, rt as DndRenderField, y as DndItemsItem, z as DraggableItemProps } from "./index-P9Aifaui.js";
|
|
7
7
|
import { a as Props$3, n as EditorRenderData, r as Props$2, t as Editor } from "./index-13BDSrQc.js";
|
|
8
|
-
import { a as Props$6, n as Props$5, o as Props$4, s as ErrorBoundary, t as Error } from "./index-
|
|
8
|
+
import { a as Props$6, n as Props$5, o as Props$4, s as ErrorBoundary, t as Error } from "./index-CRwEhJ7w.js";
|
|
9
9
|
import { n as Preview, r as Props$7 } from "./index-DQkL37eL.js";
|
|
10
10
|
//#region src/index.d.ts
|
|
11
11
|
declare const App: {
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { i as useLiveMessages, n as defaultMessages } from "./messages-
|
|
2
|
-
import { t as ContextProvider } from "./context-
|
|
3
|
-
import { t as Dnd } from "./dnd-
|
|
4
|
-
import { t as Editor } from "./editor-
|
|
5
|
-
import { t as Error } from "./error-
|
|
6
|
-
import { t as Preview } from "./preview-
|
|
1
|
+
import { i as useLiveMessages, n as defaultMessages } from "./messages-CSrMI4Rm.js";
|
|
2
|
+
import { t as ContextProvider } from "./context-B8MzP7_p.js";
|
|
3
|
+
import { t as Dnd } from "./dnd-UoJILA75.js";
|
|
4
|
+
import { t as Editor } from "./editor-CMElfHer.js";
|
|
5
|
+
import { t as Error } from "./error-CN_GCnXB.js";
|
|
6
|
+
import { t as Preview } from "./preview-CtyG5UbH.js";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
//#region src/index.tsx
|
|
9
9
|
const App = ({ children, messages }) => {
|