@jbpark/live-editor 4.4.0 → 4.5.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.
Files changed (55) hide show
  1. package/README.md +2 -2
  2. package/dist/{boundary-B17cepvm.js → boundary-DnjGgsK6.js} +8 -5
  3. package/dist/boundary-DnjGgsK6.js.map +1 -0
  4. package/dist/{context-DB5kW3qe.js → context-DsEXJl4h.js} +10 -4
  5. package/dist/context-DsEXJl4h.js.map +1 -0
  6. package/dist/dnd/index.d.ts +1 -1
  7. package/dist/dnd/index.js +1 -1
  8. package/dist/{dnd-BE5ZizqX.js → dnd-DGNp20Nk.js} +370 -305
  9. package/dist/dnd-DGNp20Nk.js.map +1 -0
  10. package/dist/{document-BDn_f08_.js → document-DGHTfrda.js} +7738 -7735
  11. package/dist/document-DGHTfrda.js.map +1 -0
  12. package/dist/error/index.d.ts +1 -1
  13. package/dist/error/index.js +2 -2
  14. package/dist/{error-DWhxQEom.js → error-DwqwjJ2C.js} +13 -6
  15. package/dist/error-DwqwjJ2C.js.map +1 -0
  16. package/dist/{index-f7ijuNTa.d.ts → index-CHknA6k1.d.ts} +108 -154
  17. package/dist/{index-Dgh1JTX3.d.ts → index-P9Aifaui.d.ts} +3 -2
  18. package/dist/index-WQgFy510.d.ts +11 -0
  19. package/dist/{index-C4SGQ3Ci.d.ts → index-vtyggWy0.d.ts} +4 -1
  20. package/dist/index.d.ts +18 -18
  21. package/dist/index.js +11 -7
  22. package/dist/index.js.map +1 -1
  23. package/dist/{ast-dYb78955.js → items-DdrwGxJw.js} +324 -373
  24. package/dist/items-DdrwGxJw.js.map +1 -0
  25. package/dist/messages-Cp3g1mn1.d.ts +129 -0
  26. package/dist/messages-CzUPVnzH.js +132 -0
  27. package/dist/messages-CzUPVnzH.js.map +1 -0
  28. package/dist/preview/index.js +2 -2
  29. package/dist/{preview-BnaCEFsF.js → preview-BKFgq_5u.js} +6 -4
  30. package/dist/preview-BKFgq_5u.js.map +1 -0
  31. package/dist/provider/index.d.ts +3 -8
  32. package/dist/provider/index.js +3 -2
  33. package/dist/{sections-CBVMO8Jl.js → sections-BRH3KHYc.js} +8 -3
  34. package/dist/sections-BRH3KHYc.js.map +1 -0
  35. package/dist/style.css +505 -21
  36. package/dist/{use-dynamic-tailwind-Bcipc1hL.js → use-dynamic-tailwind-T9r9ExbR.js} +9 -3
  37. package/dist/{use-dynamic-tailwind-Bcipc1hL.js.map → use-dynamic-tailwind-T9r9ExbR.js.map} +1 -1
  38. package/dist/utils/ast/index.d.ts +3 -2
  39. package/dist/utils/ast/index.js +66 -3
  40. package/dist/utils/ast/index.js.map +1 -0
  41. package/dist/utils/index.d.ts +30 -13
  42. package/dist/utils/index.js +26 -6
  43. package/dist/utils/index.js.map +1 -0
  44. package/dist/validate-DB59Z_Nx.d.ts +100 -0
  45. package/dist/validate-iLo8IONY.js +64 -0
  46. package/dist/validate-iLo8IONY.js.map +1 -0
  47. package/package.json +3 -3
  48. package/dist/ast-dYb78955.js.map +0 -1
  49. package/dist/boundary-B17cepvm.js.map +0 -1
  50. package/dist/context-DB5kW3qe.js.map +0 -1
  51. package/dist/dnd-BE5ZizqX.js.map +0 -1
  52. package/dist/document-BDn_f08_.js.map +0 -1
  53. package/dist/error-DWhxQEom.js.map +0 -1
  54. package/dist/preview-BnaCEFsF.js.map +0 -1
  55. package/dist/sections-CBVMO8Jl.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import { i as Guard, o as Props, r as Runtime, s as ErrorBoundary, t as Error } from "../index-C4SGQ3Ci.js";
1
+ import { i as Guard, o as Props, r as Runtime, s as ErrorBoundary, t as Error } from "../index-vtyggWy0.js";
2
2
  export { ErrorBoundary, Guard as ErrorGuard, Runtime as ErrorRuntime, type Props, Error as default };
@@ -1,3 +1,3 @@
1
- import { t as ErrorBoundary } from "../boundary-B17cepvm.js";
2
- import { n as Runtime, r as Guard, t as Error } from "../error-DWhxQEom.js";
1
+ import { t as ErrorBoundary } from "../boundary-DnjGgsK6.js";
2
+ import { n as Runtime, r as Guard, t as Error } from "../error-DwqwjJ2C.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-CzUPVnzH.js";
1
2
  import { r as useError } from "./states-Ci1AvoQ9.js";
2
- import { n as Error$1, t as ErrorBoundary } from "./boundary-B17cepvm.js";
3
+ import { n as Error$1, t as ErrorBoundary } from "./boundary-DnjGgsK6.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 || "Unknown error";
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 || "Promise rejection";
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: "Runtime Error",
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: "Runtime Error"
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-DWhxQEom.js.map
89
+ //# sourceMappingURL=error-DwqwjJ2C.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-DwqwjJ2C.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,94 +1,47 @@
1
+ import { b as ExtractedNodeValue$1, c as BindingItem, d as BindingOptions, f as BindingRegistry, g as BindingType, l as BindingKeyMap, m as BindingRenderMap, v as DataAttrNode, x as NodeValueType$1, y as EditableNodeValueType$1 } from "./validate-DB59Z_Nx.js";
1
2
  import { C as ObjectExpression, S as Node, b as Expression, x as File, y as ArrayExpression } from "./document-Ct4jW78J.js";
2
- //#region src/utils/ast/types.d.ts
3
- interface Attribute {
4
- name: string;
5
- value: string | null;
6
- isStringLiteral?: boolean;
7
- }
8
- interface DataAttrNode {
9
- id?: string;
10
- tagName: string;
11
- attributes: Attribute[];
12
- dataAttributes: Attribute[];
13
- textContent: string;
14
- rawChildren?: string;
15
- source?: string;
16
- loc?: {
17
- start: {
18
- line: number;
19
- column: number;
20
- };
21
- end: {
22
- line: number;
23
- column: number;
24
- };
25
- };
26
- children?: DataAttrNode[];
27
- isFragment?: boolean;
28
- bindings?: BindingItem[];
29
- }
30
- interface BindingOption {
31
- label: string;
32
- value: string;
33
- }
34
- declare const BINDING_TYPES: readonly ["array", "object", "string", "number", "boolean", "color", "jsx", "richtext", "date", "url"];
35
- type BindingType = (typeof BINDING_TYPES)[number];
36
- interface BindingWidget {
37
- type: string;
38
- step?: number;
39
- unit?: string;
40
- [key: string]: unknown;
41
- }
42
- interface BindingFieldSpec {
43
- type?: BindingType;
44
- widget?: BindingWidget;
45
- options?: BindingOption[];
46
- render?: BindingRenderMap;
47
- min?: number;
48
- max?: number;
49
- pattern?: string;
50
- required?: boolean;
51
- meta?: Record<string, unknown>;
52
- }
53
- interface BindingRenderLeaf extends BindingFieldSpec {
54
- label?: string;
55
- property?: string;
56
- }
57
- interface BindingRenderMap {
58
- [key: string]: BindingRenderLeaf | BindingRenderMap;
59
- }
60
- interface BindingItem extends BindingFieldSpec {
61
- label: string;
62
- property: string;
3
+ //#region node_modules/.pnpm/@babel+parser@7.29.9/node_modules/@babel/parser/typings/babel-parser.d.ts
4
+ declare class Position {
5
+ line: number;
6
+ column: number;
7
+ index: number;
8
+ constructor(line: number, col: number, index: number);
63
9
  }
64
- type BindingComponentName = `${string}.${string}` | Capitalize<string>;
65
- type BindingRegistry = Partial<Record<BindingComponentName, BindingItem[]>>;
66
- type BindingKeyMap = Record<string, BindingItem[]>;
67
- interface BindingOptions {
68
- bindings?: BindingRegistry;
69
- bindingKeys?: BindingKeyMap;
10
+ type SyntaxPlugin = "flow" | "typescript" | "jsx" | "functionBind" | "pipelineOperator" | "placeholders";
11
+ type ParseErrorCode = "BABEL_PARSER_SYNTAX_ERROR" | "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED";
12
+ interface ParseErrorSpecification<ErrorDetails> {
13
+ code: ParseErrorCode;
14
+ reasonCode: string;
15
+ syntaxPlugin?: SyntaxPlugin;
16
+ missingPlugin?: string | string[];
17
+ loc: Position;
18
+ details: ErrorDetails;
19
+ pos: number;
70
20
  }
71
- type NodeValueType = 'boolean' | 'number' | 'string' | 'null' | 'array' | 'object' | 'unknown';
72
- type EditableNodeValueType = 'boolean' | 'number' | 'string' | 'null';
73
- interface ExtractedNodeValue {
74
- type: NodeValueType;
75
- value: string | number | boolean | null;
21
+ type ParseError$1<ErrorDetails> = SyntaxError & ParseErrorSpecification<ErrorDetails>;
22
+ type ParseError = ParseError$1<object>;
23
+ type ParseResult<Result extends File | Expression = File> = Result & {
24
+ comments: File["comments"];
25
+ errors: null | ParseError[];
26
+ tokens?: File["tokens"];
27
+ };
28
+ //#endregion
29
+ //#region src/utils/ast/extract.d.ts
30
+ declare function extract(raw: string, options?: BindingOptions): DataAttrNode[];
31
+ declare function clearExtractCache$1(): void;
32
+ //#endregion
33
+ //#region src/utils/ast/items.d.ts
34
+ type ItemKind$1 = 'object' | 'primitive';
35
+ interface ArrayItem$1 {
36
+ index: number;
37
+ kind: ItemKind$1;
38
+ node: Expression;
76
39
  }
77
40
  //#endregion
78
41
  //#region src/utils/ast/binding.d.ts
79
- declare const isComponentTagName: (tagName: string) => boolean;
80
- declare const getRegistryBindings: (registry: BindingRegistry | undefined, tagName: string) => BindingItem[] | undefined;
81
- declare const getKeyBindings: (bindingKeys: BindingKeyMap | undefined, key: string) => BindingItem[] | undefined;
82
- declare const resolveBindings: (own: BindingItem[] | undefined, key: string | null | undefined, tagName: string, options?: BindingOptions) => BindingItem[];
83
- declare const parseBinding: (bindingValue: string | null) => BindingItem[];
84
- declare const parseBindingExpression: (expression: ArrayExpression) => BindingItem[];
85
- declare const getCurrentValue: (node: DataAttrNode, property: string) => string;
86
- declare const getStructuredValue: (node: DataAttrNode, property: string, type?: BindingType) => unknown;
87
- declare const readNodeBindings: (node: DataAttrNode) => BindingItem[];
88
42
  declare const findEditableChildren: (node: DataAttrNode) => DataAttrNode[];
89
43
  //#endregion
90
44
  //#region src/utils/ast/value.d.ts
91
- declare const canLosslesslyEvaluateSource: (source: string) => boolean;
92
45
  declare const parseValue: (value: unknown) => unknown;
93
46
  type EditablePathSegment = string | number;
94
47
  type EditablePrimitive = string | number | boolean;
@@ -98,39 +51,6 @@ interface EditableValueEntry {
98
51
  }
99
52
  declare const flattenEditableValue: (value: string) => EditableValueEntry[] | null;
100
53
  declare const setEditableValue: (value: string, path: EditablePathSegment[], next: EditablePrimitive) => string;
101
- declare const extractNodeValue: (node: Node) => ExtractedNodeValue;
102
- declare const createNodeFromValue: (type: NodeValueType, value: unknown) => Expression | null;
103
- declare const parseArrayExpression: (value: string) => ArrayExpression | null;
104
- declare const extractObjectProperties: (element: ObjectExpression) => Record<string, ExtractedNodeValue & {
105
- astNode: Node;
106
- }>;
107
- declare const arrayExpressionToCode: (elements: ObjectExpression[]) => string;
108
- //#endregion
109
- //#region src/utils/ast/helpers.d.ts
110
- declare const generateCode: (node: Node) => string;
111
- //#endregion
112
- //#region src/utils/ast/items.d.ts
113
- type ItemKind = 'object' | 'primitive';
114
- interface ArrayItem {
115
- index: number;
116
- kind: ItemKind;
117
- node: Expression;
118
- }
119
- declare const parseItems: (code: string) => ArrayItem[] | null;
120
- declare const updateArrayItemProperty: (code: string, index: number, key: string, value: unknown, render?: BindingRenderMap) => string | null;
121
- declare const updateArrayItemValue: (code: string, index: number, value: unknown) => string | null;
122
- declare const moveArrayItem: (code: string, from: number, to: number) => string | null;
123
- declare const moveArrayItems: (code: string, indices: Set<number>, direction: "up" | "down") => {
124
- code: string;
125
- indices: Set<number>;
126
- } | null;
127
- declare const removeArrayItems: (code: string, indices: Set<number>, kind?: ItemKind) => string | null;
128
- declare const duplicateArrayItems: (code: string, indices: Set<number>, generateId?: () => string) => string | null;
129
- declare const appendArrayItem: (code: string, kind: ItemKind, generateId?: () => string) => string | null;
130
- //#endregion
131
- //#region src/utils/ast/extract.d.ts
132
- declare function extract(raw: string, options?: BindingOptions): DataAttrNode[];
133
- declare function clearExtractCache(): void;
134
54
  //#endregion
135
55
  //#region src/utils/ast/update.d.ts
136
56
  type UpdateFailure = {
@@ -222,46 +142,80 @@ interface ChildrenEdit {
222
142
  }
223
143
  declare const getChildrenSignatures: (nodes: DataAttrNode[]) => string[];
224
144
  //#endregion
225
- //#region src/utils/ast/array-source.d.ts
145
+ //#region src/utils/ast/index.d.ts
146
+ /** @deprecated Internal. Use `useDndItems` from `./dnd`. Removed in the next major. */
147
+ declare const appendArrayItem: (code: string, kind: ItemKind$1, generateId?: () => string) => string | null;
148
+ /** @deprecated Internal. Use `useDndItems` from `./dnd`. Removed in the next major. */
149
+ declare const duplicateArrayItems: (code: string, indices: Set<number>, generateId?: () => string) => string | null;
150
+ /** @deprecated Internal. Use `useDndItems` from `./dnd`. Removed in the next major. */
151
+ declare const moveArrayItem: (code: string, from: number, to: number) => string | null;
152
+ /** @deprecated Internal. Use `useDndItems` from `./dnd`. Removed in the next major. */
153
+ declare const moveArrayItems: (code: string, indices: Set<number>, direction: "up" | "down") => {
154
+ code: string;
155
+ indices: Set<number>;
156
+ } | null;
157
+ /** @deprecated Internal. Use `useDndItems` from `./dnd`. Removed in the next major. */
158
+ declare const parseItems: (code: string) => ArrayItem$1[] | null;
159
+ /** @deprecated Internal. Use `useDndItems` from `./dnd`. Removed in the next major. */
160
+ declare const removeArrayItems: (code: string, indices: Set<number>, kind?: ItemKind$1) => string | null;
161
+ /** @deprecated Internal. Use `useDndItems` from `./dnd`. Removed in the next major. */
162
+ declare const updateArrayItemProperty: (code: string, index: number, key: string, value: unknown, render?: BindingRenderMap) => string | null;
163
+ /** @deprecated Internal. Use `useDndItems` from `./dnd`. Removed in the next major. */
164
+ declare const updateArrayItemValue: (code: string, index: number, value: unknown) => string | null;
165
+ /** @deprecated Internal. Use `useDndItems` from `./dnd`. Removed in the next major. */
166
+ declare const parseArrayExpression: (value: string) => ArrayExpression | null;
167
+ /** @deprecated Internal. Use `useDndItems` from `./dnd`. Removed in the next major. */
168
+ declare const arrayExpressionToCode: (elements: ObjectExpression[]) => string;
169
+ /** @deprecated Internal. Use `useDndItems` from `./dnd`. Removed in the next major. */
226
170
  declare const canStructurallyEditArray: (source: string) => boolean;
227
- //#endregion
228
- //#region node_modules/.pnpm/@babel+parser@7.29.8/node_modules/@babel/parser/typings/babel-parser.d.ts
229
- declare class Position {
230
- line: number;
231
- column: number;
232
- index: number;
233
- constructor(line: number, col: number, index: number);
234
- }
235
- type SyntaxPlugin = "flow" | "typescript" | "jsx" | "functionBind" | "pipelineOperator" | "placeholders";
236
- type ParseErrorCode = "BABEL_PARSER_SYNTAX_ERROR" | "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED";
237
- interface ParseErrorSpecification<ErrorDetails> {
238
- code: ParseErrorCode;
239
- reasonCode: string;
240
- syntaxPlugin?: SyntaxPlugin;
241
- missingPlugin?: string | string[];
242
- loc: Position;
243
- details: ErrorDetails;
244
- pos: number;
245
- }
246
- type ParseError$1<ErrorDetails> = SyntaxError & ParseErrorSpecification<ErrorDetails>;
247
- type ParseError = ParseError$1<object>;
248
- type ParseResult<Result extends File | Expression = File> = Result & {
249
- comments: File["comments"];
250
- errors: null | ParseError[];
251
- tokens?: File["tokens"];
252
- };
253
- //#endregion
254
- //#region src/utils/ast/tree.d.ts
255
- declare const replaceIds: (code: string, generateId?: () => string) => string;
171
+ /** @deprecated Internal. Use `useDndItems` from `./dnd`. Removed in the next major. */
172
+ type ArrayItem = ArrayItem$1;
173
+ /** @deprecated Internal. Use `useDndItems` from `./dnd`. Removed in the next major. */
174
+ type ItemKind = ItemKind$1;
175
+ /** @deprecated Internal. Read values through `extract` or `PanelBinding.value`. Removed in the next major. */
176
+ declare const extractNodeValue: (node: Node) => ExtractedNodeValue$1;
177
+ /** @deprecated Internal. Read values through `extract` or `PanelBinding.value`. Removed in the next major. */
178
+ declare const extractObjectProperties: (element: ObjectExpression) => Record<string, ExtractedNodeValue$1 & {
179
+ astNode: Node;
180
+ }>;
181
+ /** @deprecated Internal. Write values through `update` or `PanelBinding.onChange`. Removed in the next major. */
182
+ declare const createNodeFromValue: (type: NodeValueType$1, value: unknown) => Expression | null;
183
+ /** @deprecated Internal. Check `PanelBinding.canEditValue` instead. Removed in the next major. */
184
+ declare const canLosslesslyEvaluateSource: (source: string) => boolean;
185
+ /** @deprecated Internal. Read values through `extract` or `PanelBinding.value`. Removed in the next major. */
186
+ declare const getCurrentValue: (node: DataAttrNode, property: string) => string;
187
+ /** @deprecated Internal. Read values through `extract` or `PanelBinding.value`. Removed in the next major. */
188
+ declare const getStructuredValue: (node: DataAttrNode, property: string, type?: BindingType) => unknown;
189
+ /** @deprecated Internal. Removed in the next major. */
190
+ type ExtractedNodeValue = ExtractedNodeValue$1;
191
+ /** @deprecated Internal. Removed in the next major. */
192
+ type NodeValueType = NodeValueType$1;
193
+ /** @deprecated Internal. Removed in the next major. */
194
+ type EditableNodeValueType = EditableNodeValueType$1;
195
+ /** @deprecated Internal. Read bindings through `extract` or `useDndPanel().bindings`. Removed in the next major. */
196
+ declare const parseBinding: (bindingValue: string | null) => BindingItem[];
197
+ /** @deprecated Internal. Read bindings through `extract` or `useDndPanel().bindings`. Removed in the next major. */
198
+ declare const parseBindingExpression: (expression: ArrayExpression) => BindingItem[];
199
+ /** @deprecated Internal. Read bindings through `extract` or `useDndPanel().bindings`. Removed in the next major. */
200
+ declare const readNodeBindings: (node: DataAttrNode) => BindingItem[];
201
+ /** @deprecated Internal. Read bindings through `extract` or `useDndPanel().bindings`. Removed in the next major. */
202
+ declare const resolveBindings: (own: BindingItem[] | undefined, key: string | null | undefined, tagName: string, options?: BindingOptions) => BindingItem[];
203
+ /** @deprecated Internal. Read bindings through `extract` or `useDndPanel().bindings`. Removed in the next major. */
204
+ declare const getKeyBindings: (bindingKeys: BindingKeyMap | undefined, key: string) => BindingItem[] | undefined;
205
+ /** @deprecated Internal. Read bindings through `extract` or `useDndPanel().bindings`. Removed in the next major. */
206
+ declare const getRegistryBindings: (registry: BindingRegistry | undefined, tagName: string) => BindingItem[] | undefined;
207
+ /** @deprecated Internal. Removed in the next major. */
208
+ declare const isComponentTagName: (tagName: string) => boolean;
209
+ /** @deprecated Internal. Removed in the next major. */
256
210
  declare const fillIds: (code: string, generateId?: () => string) => string;
211
+ /** @deprecated Internal. Removed in the next major. */
212
+ declare const replaceIds: (code: string, generateId?: () => string) => string;
213
+ /** @deprecated Internal. Removed in the next major. */
257
214
  declare const clone: (element: Node, generateId?: () => string) => ParseResult<Expression>;
215
+ /** @deprecated Internal. Removed in the next major. */
216
+ declare const generateCode: (node: Node) => string;
217
+ /** @deprecated Internal. Use `clearEditorCaches` from `./utils`. Removed in the next major. */
218
+ declare const clearExtractCache: typeof clearExtractCache$1;
258
219
  //#endregion
259
- //#region src/utils/ast/validate.d.ts
260
- interface ValidationResult {
261
- valid: boolean;
262
- message?: string;
263
- }
264
- declare const validateBindingValue: (binding: BindingItem, value: unknown) => ValidationResult;
265
- //#endregion
266
- export { BindingFieldSpec as $, EditablePathSegment as A, parseValue as B, moveArrayItem as C, updateArrayItemProperty as D, removeArrayItems as E, createNodeFromValue as F, getRegistryBindings as G, findEditableChildren as H, extractNodeValue as I, parseBinding as J, getStructuredValue as K, extractObjectProperties as L, EditableValueEntry as M, arrayExpressionToCode as N, updateArrayItemValue as O, canLosslesslyEvaluateSource as P, BindingComponentName as Q, flattenEditableValue as R, duplicateArrayItems as S, parseItems as T, getCurrentValue as U, setEditableValue as V, getKeyBindings as W, readNodeBindings as X, parseBindingExpression as Y, resolveBindings as Z, clearExtractCache as _, replaceIds as a, BindingRenderLeaf as at, ItemKind as b, ChildrenEdit as c, BindingWidget as ct, UpdateEntry as d, ExtractedNodeValue as dt, BindingItem as et, UpdateFailure as f, NodeValueType as ft, updateAll as g, update as h, fillIds as i, BindingRegistry as it, EditablePrimitive as j, generateCode as k, getChildrenSignatures as l, DataAttrNode as lt, bulkUpdate as m, validateBindingValue as n, BindingOption as nt, canStructurallyEditArray as o, BindingRenderMap as ot, UpdateResult as p, isComponentTagName as q, clone as r, BindingOptions as rt, ChildrenAction as s, BindingType as st, ValidationResult as t, BindingKeyMap as tt, UpdateAllResult as u, EditableNodeValueType as ut, extract as v, moveArrayItems as w, appendArrayItem as x, ArrayItem as y, parseArrayExpression as z };
267
- //# sourceMappingURL=index-f7ijuNTa.d.ts.map
220
+ export { removeArrayItems as A, UpdateFailure as B, moveArrayItem as C, parseBindingExpression as D, parseBinding as E, ChildrenAction as F, EditablePathSegment as G, bulkUpdate as H, ChildrenEdit as I, flattenEditableValue as J, EditablePrimitive 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, parseValue 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, EditableValueEntry 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 };
221
+ //# sourceMappingURL=index-CHknA6k1.d.ts.map
@@ -1,5 +1,6 @@
1
- import { ct as BindingWidget, f as UpdateFailure, it as BindingRegistry, lt as DataAttrNode, nt as BindingOption, ot as BindingRenderMap, rt as BindingOptions, st as BindingType, tt as BindingKeyMap } from "./index-f7ijuNTa.js";
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-CHknA6k1.js";
3
4
  import { t as FrameProps } from "./index-DpDU1IAw.js";
4
5
  import { useMultiSelect } from "@jbpark/use-hooks";
5
6
  //#region src/components/dnd/panel/field.d.ts
@@ -319,4 +320,4 @@ type ChildrenEditor = DndChildren;
319
320
  type ChildrenEditorOptions = DndChildrenOptions;
320
321
  //#endregion
321
322
  export { DndInspector as $, useDndPanel as A, DndPalette as B, useDndItems as C, DndLayout as D, useDndChildren as E, Palette as F, PanelBinding as G, Props as H, Panel as I, PanelBindingSource as J, PanelBindingData as K, DraggableItem as L, DndLayoutProps as M, DndRegionProps as N, useDndLayout as O, Layout as P, withPanelCommit as Q, DraggableItemDragState as R, DndItemsOptions as S, DndChildrenOptions as T, DndRenderSectionFallback as U, DndPanel as V, DndSectionFallbackArgs as W, PanelNodesChange as X, PanelNodeChange as Y, resolvePanelBindings as Z, DndItemsActions as _, ItemsEditorActions as a, FieldProps as at, DndItemsNestedElement as b, ItemsEditorNestedGroup as c, useItemsEditor as d, DndNodePick as et, FieldKind as f, DndItems as g, isStructuralFieldKind as h, ItemsEditor as i, Field as it, Canvas as j, useDndPalette as k, ItemsEditorOptions as l, getFieldKind as m, ChildrenEditorOptions as n, DndEditError as nt, ItemsEditorItem as o, FieldKindBinding as p, PanelBindingElement as q, Dnd as r, DndRenderField as rt, ItemsEditorNestedElement as s, ChildrenEditor as t, useDndInspector as tt, useChildrenEditor as u, DndItemsExpansion as v, DndChildren as w, DndItemsNestedGroup as x, DndItemsItem as y, DraggableItemProps as z };
322
- //# sourceMappingURL=index-Dgh1JTX3.d.ts.map
323
+ //# sourceMappingURL=index-P9Aifaui.d.ts.map
@@ -0,0 +1,11 @@
1
+ import { n as LiveMessagesInput } from "./messages-Cp3g1mn1.js";
2
+ import React from "react";
3
+ //#region src/components/context/context.d.ts
4
+ interface Props {
5
+ children?: React.ReactNode;
6
+ messages?: LiveMessagesInput;
7
+ }
8
+ declare const ContextProvider: ({ children, messages }: Props) => React.JSX.Element;
9
+ //#endregion
10
+ export { Props as n, ContextProvider as t };
11
+ //# sourceMappingURL=index-WQgFy510.d.ts.map
@@ -1,3 +1,4 @@
1
+ import { t as LiveMessages } from "./messages-Cp3g1mn1.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-C4SGQ3Ci.d.ts.map
57
+ //# sourceMappingURL=index-vtyggWy0.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,26 +1,26 @@
1
- import { it as BindingRegistry, rt as BindingOptions, tt as BindingKeyMap } from "./index-f7ijuNTa.js";
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-Cp3g1mn1.js";
3
+ import { n as Props } from "./index-WQgFy510.js";
2
4
  import { v as Section } from "./document-Ct4jW78J.js";
3
5
  import { t as FrameProps } from "./index-DpDU1IAw.js";
4
- import { $ as DndInspector, B as DndPalette, D as DndLayout, F as Palette, G as PanelBinding, H as Props, 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-Dgh1JTX3.js";
5
- import { a as Props$2, n as EditorRenderData, r as Props$1, t as Editor } from "./index-13BDSrQc.js";
6
- import { a as Props$5, n as Props$4, o as Props$3, s as ErrorBoundary, t as Error } from "./index-C4SGQ3Ci.js";
7
- import { n as Preview, r as Props$6 } from "./index-DQkL37eL.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
+ 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-vtyggWy0.js";
9
+ import { n as Preview, r as Props$7 } from "./index-DQkL37eL.js";
8
10
  //#region src/index.d.ts
9
11
  declare const App: {
10
- ({ children }: {
11
- children?: React.ReactNode;
12
- }): import("react").JSX.Element;
13
- Preview: ({ code, props, modules, dynamicTailwind, provider, ...restProps }: Props$6) => import("react").JSX.Element;
14
- Renderer: ({ code, props, modules, dynamicTailwind, provider, ...restProps }: Props$6) => import("react").JSX.Element;
15
- Error: (({ message, title, className, onReset }: Props$3) => import("react").JSX.Element | null) & {
12
+ ({ children, messages }: Props): import("react").JSX.Element;
13
+ Preview: ({ code, props, modules, dynamicTailwind, provider, ...restProps }: Props$7) => import("react").JSX.Element;
14
+ Renderer: ({ code, props, modules, dynamicTailwind, provider, ...restProps }: Props$7) => import("react").JSX.Element;
15
+ Error: (({ message, title, className, onReset }: Props$4) => import("react").JSX.Element | null) & {
16
16
  Boundary: typeof ErrorBoundary;
17
- Runtime: ({ open, reset }: Props$4) => import("react").JSX.Element | null;
18
- Guard: ({ children, onError }: Props$5) => import("react").JSX.Element;
17
+ Runtime: ({ open, reset }: Props$5) => import("react").JSX.Element | null;
18
+ Guard: ({ children, onError }: Props$6) => import("react").JSX.Element;
19
19
  };
20
- Editor: (({ defaultValue, value: _value, debounce, onChange: _onChange, renderEditor, fragment, prettierOptions, ...props }: Props$1) => import("react").JSX.Element) & {
21
- Core: ({ value, theme, height, className, prettierOptions, fragment, raw, onChange, onSave, onError, ...props }: Props$2) => import("react").JSX.Element;
20
+ Editor: (({ defaultValue, value: _value, debounce, onChange: _onChange, renderEditor, fragment, prettierOptions, ...props }: Props$2) => import("react").JSX.Element) & {
21
+ Core: ({ value, theme, height, className, prettierOptions, fragment, raw, onChange, onSave, onError, ...props }: Props$3) => import("react").JSX.Element;
22
22
  };
23
- Dnd: (({ 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) & {
23
+ Dnd: (({ 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$1) => import("react").JSX.Element) & {
24
24
  DraggableItem: ({ item, children }: DraggableItemProps) => import("react").ReactNode;
25
25
  Field: (props: FieldProps) => import("react").JSX.Element;
26
26
  Palette: typeof Palette;
@@ -29,7 +29,7 @@ declare const App: {
29
29
  Layout: typeof Layout;
30
30
  };
31
31
  };
32
- declare const LiveRenderer: ({ code, props, modules, dynamicTailwind, provider, ...restProps }: Props$6) => import("react").JSX.Element;
32
+ declare const LiveRenderer: ({ code, props, modules, dynamicTailwind, provider, ...restProps }: Props$7) => import("react").JSX.Element;
33
33
  //#endregion
34
- export { type BindingKeyMap, type BindingOptions, type BindingRegistry, type DndEditError, type DndInspector, type DndItems, type DndItemsItem, type DndItemsOptions, type DndLayout, type DndNodePick, type DndPalette, type DndPanel, type DndRenderField, type DndRenderSectionFallback, type DndSectionFallbackArgs, type EditorRenderData, type FieldProps, type FrameProps, type ItemsEditor, type ItemsEditorItem, type ItemsEditorOptions, Dnd as LiveDnd, Editor as LiveEditor, Error as LiveError, Preview as LivePreview, App as LiveProvider, App as default, LiveRenderer, type PanelBinding, type PanelNodeChange, type PanelNodesChange, type Section };
34
+ export { type BindingKeyMap, type BindingOptions, type BindingRegistry, type BindingSchema, type DndEditError, type DndInspector, type DndItems, type DndItemsItem, type DndItemsOptions, type DndLayout, type DndNodePick, type DndPalette, type DndPanel, type DndRenderField, type DndRenderSectionFallback, type DndSectionFallbackArgs, type EditorRenderData, type FieldProps, type FrameProps, type ItemsEditor, type ItemsEditorItem, type ItemsEditorOptions, Dnd as LiveDnd, Editor as LiveEditor, Error as LiveError, type LiveMessages, type LiveMessagesInput, Preview as LivePreview, App as LiveProvider, App as default, LiveRenderer, type PanelBinding, type PanelNodeChange, type PanelNodesChange, type Section, defaultMessages, useLiveMessages };
35
35
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,12 +1,16 @@
1
- import { t as ContextProvider } from "./context-DB5kW3qe.js";
2
- import { t as Dnd } from "./dnd-BE5ZizqX.js";
1
+ import { i as useLiveMessages, n as defaultMessages } from "./messages-CzUPVnzH.js";
2
+ import { t as ContextProvider } from "./context-DsEXJl4h.js";
3
+ import { t as Dnd } from "./dnd-DGNp20Nk.js";
3
4
  import { t as Editor } from "./editor-DQ8Q--qR.js";
4
- import { t as Error } from "./error-DWhxQEom.js";
5
- import { t as Preview } from "./preview-BnaCEFsF.js";
5
+ import { t as Error } from "./error-DwqwjJ2C.js";
6
+ import { t as Preview } from "./preview-BKFgq_5u.js";
6
7
  import { jsx } from "react/jsx-runtime";
7
8
  //#region src/index.tsx
8
- const App = ({ children }) => {
9
- return /* @__PURE__ */ jsx(ContextProvider, { children });
9
+ const App = ({ children, messages }) => {
10
+ return /* @__PURE__ */ jsx(ContextProvider, {
11
+ messages,
12
+ children
13
+ });
10
14
  };
11
15
  const LiveRenderer = Preview;
12
16
  App.Preview = Preview;
@@ -15,6 +19,6 @@ App.Error = Error;
15
19
  App.Editor = Editor;
16
20
  App.Dnd = Dnd;
17
21
  //#endregion
18
- export { Dnd as LiveDnd, Editor as LiveEditor, Error as LiveError, Preview as LivePreview, App as LiveProvider, App as default, LiveRenderer };
22
+ export { Dnd as LiveDnd, Editor as LiveEditor, Error as LiveError, Preview as LivePreview, App as LiveProvider, App as default, LiveRenderer, defaultMessages, useLiveMessages };
19
23
 
20
24
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Context","LivePreview","LiveError","LiveEditor","LiveDnd"],"sources":["../src/index.tsx"],"sourcesContent":["import './index.css';\n\nimport Context from './components/context';\nimport LiveDnd, {\n type DndEditError,\n type DndInspector,\n type DndItems,\n type DndItemsItem,\n type DndItemsOptions,\n type DndLayout,\n type DndNodePick,\n type DndPalette,\n type DndPanel,\n type DndRenderField,\n type DndRenderSectionFallback,\n type DndSectionFallbackArgs,\n type FieldProps,\n type ItemsEditor,\n type ItemsEditorItem,\n type ItemsEditorOptions,\n type PanelBinding,\n type PanelNodeChange,\n type PanelNodesChange,\n} from './components/dnd';\nimport LiveEditor, { type EditorRenderData } from './components/editor';\nimport LiveError from './components/error';\nimport { type FrameProps } from './components/frame';\nimport LivePreview from './components/preview';\nimport type { Section } from './types';\nimport type {\n BindingKeyMap,\n BindingOptions,\n BindingRegistry,\n} from './utils/ast';\n\nconst App = ({ children }: { children?: React.ReactNode }) => {\n return <Context>{children}</Context>;\n};\n\nconst LiveRenderer = LivePreview;\n\nexport {\n LivePreview,\n LiveError,\n LiveEditor,\n LiveDnd,\n LiveRenderer,\n App as LiveProvider,\n //\n};\n\nexport type {\n DndEditError,\n DndRenderField,\n DndRenderSectionFallback,\n DndSectionFallbackArgs,\n DndPalette,\n DndPanel,\n DndLayout,\n DndInspector,\n DndNodePick,\n PanelBinding,\n PanelNodeChange,\n PanelNodesChange,\n FieldProps,\n DndItems,\n DndItemsItem,\n DndItemsOptions,\n // Deprecated aliases of the three above, kept until the next major.\n ItemsEditor,\n ItemsEditorItem,\n ItemsEditorOptions,\n EditorRenderData,\n FrameProps,\n Section,\n BindingRegistry,\n BindingKeyMap,\n BindingOptions,\n};\n\nApp.Preview = LivePreview;\nApp.Renderer = LiveRenderer;\nApp.Error = LiveError;\nApp.Editor = LiveEditor;\nApp.Dnd = LiveDnd;\n\nexport default App;\n"],"mappings":";;;;;;;AAmCA,MAAM,OAAO,EAAE,eAA+C;CAC5D,OAAO,oBAACA,iBAAD,EAAU,SAAkB,CAAA;AACrC;AAEA,MAAM,eAAeC;AAyCrB,IAAI,UAAUA;AACd,IAAI,WAAW;AACf,IAAI,QAAQC;AACZ,IAAI,SAASC;AACb,IAAI,MAAMC"}
1
+ {"version":3,"file":"index.js","names":["Context","LivePreview","LiveError","LiveEditor","LiveDnd"],"sources":["../src/index.tsx"],"sourcesContent":["import './index.css';\n\nimport Context, {\n type Props as ContextProps,\n type LiveMessages,\n type LiveMessagesInput,\n} from './components/context';\nimport LiveDnd, {\n type DndEditError,\n type DndInspector,\n type DndItems,\n type DndItemsItem,\n type DndItemsOptions,\n type DndLayout,\n type DndNodePick,\n type DndPalette,\n type DndPanel,\n type DndRenderField,\n type DndRenderSectionFallback,\n type DndSectionFallbackArgs,\n type FieldProps,\n type ItemsEditor,\n type ItemsEditorItem,\n type ItemsEditorOptions,\n type PanelBinding,\n type PanelNodeChange,\n type PanelNodesChange,\n} from './components/dnd';\nimport LiveEditor, { type EditorRenderData } from './components/editor';\nimport LiveError from './components/error';\nimport { type FrameProps } from './components/frame';\nimport LivePreview from './components/preview';\nimport type { Section } from './types';\nimport type {\n BindingKeyMap,\n BindingOptions,\n BindingRegistry,\n BindingSchema,\n} from './utils/ast/types';\n\nconst App = ({ children, messages }: ContextProps) => {\n return <Context messages={messages}>{children}</Context>;\n};\n\nconst LiveRenderer = LivePreview;\n\n// The editor's text, for a host that translates it (#524). This is the\n// package entry, which Fast Refresh never reloads.\n// eslint-disable-next-line react-refresh/only-export-components\nexport { defaultMessages, useLiveMessages } from './components/context';\n\nexport {\n LivePreview,\n LiveError,\n LiveEditor,\n LiveDnd,\n LiveRenderer,\n App as LiveProvider,\n //\n};\n\nexport type {\n DndEditError,\n DndRenderField,\n DndRenderSectionFallback,\n DndSectionFallbackArgs,\n DndPalette,\n DndPanel,\n DndLayout,\n DndInspector,\n DndNodePick,\n PanelBinding,\n PanelNodeChange,\n PanelNodesChange,\n FieldProps,\n DndItems,\n DndItemsItem,\n DndItemsOptions,\n // Deprecated aliases of the three above, kept until the next major.\n ItemsEditor,\n ItemsEditorItem,\n ItemsEditorOptions,\n EditorRenderData,\n FrameProps,\n Section,\n BindingRegistry,\n BindingKeyMap,\n BindingOptions,\n BindingSchema,\n LiveMessages,\n LiveMessagesInput,\n};\n\nApp.Preview = LivePreview;\nApp.Renderer = LiveRenderer;\nApp.Error = LiveError;\nApp.Editor = LiveEditor;\nApp.Dnd = LiveDnd;\n\nexport default App;\n"],"mappings":";;;;;;;;AAwCA,MAAM,OAAO,EAAE,UAAU,eAA6B;CACpD,OAAO,oBAACA,iBAAD;EAAmB;EAAW;CAAkB,CAAA;AACzD;AAEA,MAAM,eAAeC;AAiDrB,IAAI,UAAUA;AACd,IAAI,WAAW;AACf,IAAI,QAAQC;AACZ,IAAI,SAASC;AACb,IAAI,MAAMC"}