@jbpark/live-editor 4.6.1 → 6.0.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 (91) hide show
  1. package/README.ko.md +37 -35
  2. package/README.md +37 -35
  3. package/dist/{boundary-BLB80tyw.js → boundary-CySnDUs2.js} +5 -4
  4. package/dist/boundary-CySnDUs2.js.map +1 -0
  5. package/dist/{compile-Dxas-D05.js → compile-my0AjsCw.js} +8 -7
  6. package/dist/compile-my0AjsCw.js.map +1 -0
  7. package/dist/constants-st9gnJ5g.js +55 -0
  8. package/dist/constants-st9gnJ5g.js.map +1 -0
  9. package/dist/{context-B8MzP7_p.js → context-Bjq0CvBE.js} +3 -3
  10. package/dist/{context-B8MzP7_p.js.map → context-Bjq0CvBE.js.map} +1 -1
  11. package/dist/{core-Bgfek364.js → core-BNVuH8-l.js} +51 -14
  12. package/dist/core-BNVuH8-l.js.map +1 -0
  13. package/dist/{detect-typescript-Dr_oLniM.js → detect-typescript-CMF0FVKD.js} +2 -2
  14. package/dist/{detect-typescript-Dr_oLniM.js.map → detect-typescript-CMF0FVKD.js.map} +1 -1
  15. package/dist/dnd/index.d.ts +3 -2
  16. package/dist/dnd/index.js +3 -2
  17. package/dist/dnd-BvjEDo-x.js +4197 -0
  18. package/dist/dnd-BvjEDo-x.js.map +1 -0
  19. package/dist/document-BQhb7YR8.d.ts +17 -0
  20. package/dist/{document-CHO215iP.js → document-uHqw0mvr.js} +194 -109
  21. package/dist/document-uHqw0mvr.js.map +1 -0
  22. package/dist/edit-options-C_r9aCz4.d.ts +100 -0
  23. package/dist/editor/index.d.ts +1 -1
  24. package/dist/editor/index.js +2 -2
  25. package/dist/{editor-CMElfHer.js → editor-CvnzrM9J.js} +2 -2
  26. package/dist/{editor-CMElfHer.js.map → editor-CvnzrM9J.js.map} +1 -1
  27. package/dist/error/index.d.ts +1 -1
  28. package/dist/error/index.js +2 -2
  29. package/dist/{error-CN_GCnXB.js → error-CFzvnLCf.js} +18 -32
  30. package/dist/error-CFzvnLCf.js.map +1 -0
  31. package/dist/{index-DpDU1IAw.d.ts → index-92L7F440.d.ts} +2 -2
  32. package/dist/{index-DrWtSKXu.d.ts → index-BZpZwrxT.d.ts} +2 -2
  33. package/dist/index-C8h8TcIl.d.ts +15 -0
  34. package/dist/{index-13BDSrQc.d.ts → index-C93npmTU.d.ts} +4 -6
  35. package/dist/{index-DQkL37eL.d.ts → index-CqsS207F.d.ts} +6 -12
  36. package/dist/{index-CiWB0zFb.d.ts → index-DQcdHg_V.d.ts} +18 -136
  37. package/dist/{index-CRwEhJ7w.d.ts → index-DfIvkht8.d.ts} +3 -3
  38. package/dist/index.d.ts +12 -11
  39. package/dist/index.js +6 -6
  40. package/dist/index.js.map +1 -1
  41. package/dist/{messages-IBPs4TkZ.d.ts → messages-BpN3QIhj.d.ts} +8 -2
  42. package/dist/{messages-CSrMI4Rm.js → messages-DrINcRdG.js} +8 -2
  43. package/dist/messages-DrINcRdG.js.map +1 -0
  44. package/dist/preview/index.d.ts +2 -2
  45. package/dist/preview/index.js +2 -3
  46. package/dist/{preview-CtyG5UbH.js → preview-B05MkVIQ.js} +16 -13
  47. package/dist/preview-B05MkVIQ.js.map +1 -0
  48. package/dist/provider/index.d.ts +2 -2
  49. package/dist/provider/index.js +2 -2
  50. package/dist/{sections-jYuqS4KB.js → sections-DhH_aVf5.js} +4 -7
  51. package/dist/sections-DhH_aVf5.js.map +1 -0
  52. package/dist/style.css +809 -4950
  53. package/dist/{validate-DB59Z_Nx.d.ts → types-Czps1Txy.d.ts} +12 -28
  54. package/dist/ui-kit/index.d.ts +22 -0
  55. package/dist/{constants-DU17Tdwo.js → ui-kit/index.js} +147 -54
  56. package/dist/ui-kit/index.js.map +1 -0
  57. package/dist/ui-kit/style.css +5039 -0
  58. package/dist/update-2PJbwoS8.d.ts +68 -0
  59. package/dist/{items-BXXtMUNI.js → update-BuYQJqjq.js} +143 -392
  60. package/dist/update-BuYQJqjq.js.map +1 -0
  61. package/dist/{use-dynamic-tailwind-BP1toJkW.js → use-dynamic-tailwind-B3l1qZRW.js} +318 -287
  62. package/dist/use-dynamic-tailwind-B3l1qZRW.js.map +1 -0
  63. package/dist/use-field-state-iQGW0vc6.js +131 -0
  64. package/dist/use-field-state-iQGW0vc6.js.map +1 -0
  65. package/dist/utils/ast/index.d.ts +47 -4
  66. package/dist/utils/ast/index.js +4 -64
  67. package/dist/utils/ast/index.js.map +1 -1
  68. package/dist/utils/index.d.ts +13 -32
  69. package/dist/utils/index.js +4 -26
  70. package/dist/validate-CZz30Pnb.js +122 -0
  71. package/dist/validate-CZz30Pnb.js.map +1 -0
  72. package/dist/validate-CiA1LF6S.d.ts +33 -0
  73. package/package.json +20 -10
  74. package/dist/boundary-BLB80tyw.js.map +0 -1
  75. package/dist/compile-Dxas-D05.js.map +0 -1
  76. package/dist/constants-DU17Tdwo.js.map +0 -1
  77. package/dist/core-Bgfek364.js.map +0 -1
  78. package/dist/dnd-V8NAxd_R.js +0 -2755
  79. package/dist/dnd-V8NAxd_R.js.map +0 -1
  80. package/dist/document-CHO215iP.js.map +0 -1
  81. package/dist/document-DqRSCtsx.d.ts +0 -1614
  82. package/dist/error-CN_GCnXB.js.map +0 -1
  83. package/dist/index-C_PfR4X9.d.ts +0 -734
  84. package/dist/items-BXXtMUNI.js.map +0 -1
  85. package/dist/messages-CSrMI4Rm.js.map +0 -1
  86. package/dist/preview-CtyG5UbH.js.map +0 -1
  87. package/dist/sections-jYuqS4KB.js.map +0 -1
  88. package/dist/use-dynamic-tailwind-BP1toJkW.js.map +0 -1
  89. package/dist/utils/index.js.map +0 -1
  90. package/dist/validate-iLo8IONY.js +0 -64
  91. package/dist/validate-iLo8IONY.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
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-V8NAxd_R.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";
1
+ import { t as Dnd } from "./dnd-BvjEDo-x.js";
2
+ import { i as useLiveMessages, n as defaultMessages } from "./messages-DrINcRdG.js";
3
+ import { t as ContextProvider } from "./context-Bjq0CvBE.js";
4
+ import { t as Editor } from "./editor-CvnzrM9J.js";
5
+ import { t as Error } from "./error-CFzvnLCf.js";
6
+ import { t as Preview } from "./preview-B05MkVIQ.js";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
  //#region src/index.tsx
9
9
  const App = ({ children, messages }) => {
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, {\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"}
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 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 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":";;;;;;;;AAqCA,MAAM,OAAO,EAAE,UAAU,eAA6B;CACpD,OAAO,oBAACA,iBAAD;EAAmB;EAAW;CAAkB,CAAA;AACzD;AAEA,MAAM,eAAeC;AA6CrB,IAAI,UAAUA;AACd,IAAI,WAAW;AACf,IAAI,QAAQC;AACZ,IAAI,SAASC;AACb,IAAI,MAAMC"}
@@ -1,4 +1,4 @@
1
- import { t as ValidationMessages } from "./validate-DB59Z_Nx.js";
1
+ import { t as ValidationMessages } from "./validate-CiA1LF6S.js";
2
2
  //#region src/components/context/messages.d.ts
3
3
  interface LiveMessages {
4
4
  section: {
@@ -10,6 +10,9 @@ interface LiveMessages {
10
10
  canvas: {
11
11
  palette: string;
12
12
  properties: string;
13
+ close: string;
14
+ resizePalette: string;
15
+ resizePanel: string;
13
16
  pickElement: string;
14
17
  pickElementActive: string;
15
18
  dropHere: string;
@@ -31,6 +34,8 @@ interface LiveMessages {
31
34
  useCodeEditor: string;
32
35
  invalidValue: string;
33
36
  urlPlaceholder: string;
37
+ emailPlaceholder: string;
38
+ telPlaceholder: string;
34
39
  numberPlaceholder: string;
35
40
  textPlaceholder: string;
36
41
  };
@@ -61,6 +66,7 @@ interface LiveMessages {
61
66
  };
62
67
  selection: {
63
68
  count: (count: number) => string;
69
+ selectAll: string;
64
70
  duplicate: string;
65
71
  moveUp: string;
66
72
  moveDown: string;
@@ -127,4 +133,4 @@ declare const defaultMessages: LiveMessages;
127
133
  declare const useLiveMessages: () => LiveMessages;
128
134
  //#endregion
129
135
  export { useLiveMessages as i, LiveMessagesInput as n, defaultMessages as r, LiveMessages as t };
130
- //# sourceMappingURL=messages-IBPs4TkZ.d.ts.map
136
+ //# sourceMappingURL=messages-BpN3QIhj.d.ts.map
@@ -1,4 +1,4 @@
1
- import { t as defaultValidationMessages } from "./validate-iLo8IONY.js";
1
+ import { t as defaultValidationMessages } from "./validate-CZz30Pnb.js";
2
2
  import { createContext, useContext } from "react";
3
3
  //#region src/components/context/messages.ts
4
4
  const defaultMessages = {
@@ -11,6 +11,9 @@ const defaultMessages = {
11
11
  canvas: {
12
12
  palette: "Components",
13
13
  properties: "Properties",
14
+ close: "Close",
15
+ resizePalette: "Resize the components pane",
16
+ resizePanel: "Resize the properties pane",
14
17
  pickElement: "Pick an element",
15
18
  pickElementActive: "Click an element to edit it. Esc to cancel.",
16
19
  dropHere: "Drop here",
@@ -32,6 +35,8 @@ const defaultMessages = {
32
35
  useCodeEditor: "Use the code editor to change it.",
33
36
  invalidValue: "Invalid value.",
34
37
  urlPlaceholder: "https://example.com",
38
+ emailPlaceholder: "name@example.com",
39
+ telPlaceholder: "+1 555 0100",
35
40
  numberPlaceholder: "Enter a numeric value",
36
41
  textPlaceholder: "Enter a value"
37
42
  },
@@ -62,6 +67,7 @@ const defaultMessages = {
62
67
  },
63
68
  selection: {
64
69
  count: (count) => `${count} selected`,
70
+ selectAll: "Select all",
65
71
  duplicate: "Duplicate selected",
66
72
  moveUp: "Move selected up",
67
73
  moveDown: "Move selected down",
@@ -130,4 +136,4 @@ const useLiveMessages = () => useContext(MessagesContext);
130
136
  //#endregion
131
137
  export { useLiveMessages as i, defaultMessages as n, mergeMessages as r, MessagesContext as t };
132
138
 
133
- //# sourceMappingURL=messages-CSrMI4Rm.js.map
139
+ //# sourceMappingURL=messages-DrINcRdG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages-DrINcRdG.js","names":[],"sources":["../src/components/context/messages.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nimport {\n type ValidationMessages,\n defaultValidationMessages,\n} from '~/utils/ast/validate';\n\n// Every piece of text the editor shows or announces, grouped by where it\n// appears (#524). Text with values in it is a function, so a translation\n// can put them where its grammar needs them. Pass a partial set to `Live`'s\n// `messages` prop to replace any of it; the rest stays English.\nexport interface LiveMessages {\n // The section toolbar on the canvas and the panel header.\n section: {\n moveUp: string;\n moveDown: string;\n duplicate: string;\n delete: string;\n };\n canvas: {\n // The mobile palette button and Drawer title.\n palette: string;\n // The mobile panel Drawer title.\n properties: string;\n // The mobile Drawers' close button.\n close: string;\n // The handles that resize the desktop palette and panel panes.\n resizePalette: string;\n resizePanel: string;\n pickElement: string;\n pickElementActive: string;\n dropHere: string;\n dropAtBottom: string;\n empty: string;\n emptyHintTouch: string;\n emptyHintDrag: string;\n syntaxError: string;\n syntaxErrorDetail: string;\n missingContainer: (containerId: string) => string;\n missingContainerDetail: (containerId: string) => string;\n stale: string;\n };\n panel: {\n selectSection: string;\n noEditableElements: string;\n readOnly: string;\n expressionPreserved: string;\n useCodeEditor: string;\n invalidValue: string;\n urlPlaceholder: string;\n emailPlaceholder: string;\n telPlaceholder: string;\n numberPlaceholder: string;\n textPlaceholder: string;\n };\n // The built-in editor for an array value.\n items: {\n heading: (count: number) => string;\n add: string;\n item: (position: number) => string;\n reorder: (item: string) => string;\n moveUp: string;\n moveDown: string;\n delete: string;\n collapseAll: string;\n expandAll: string;\n unreadable: string;\n empty: string;\n structureLocked: string;\n noNestedBindings: string;\n };\n // The built-in editor for child elements.\n children: {\n heading: (count: number) => string;\n add: string;\n child: (position: number, tagName: string) => string;\n moveUp: string;\n moveDown: string;\n delete: string;\n editableBindings: string;\n childNodes: string;\n };\n // The bar shown while items or children are selected.\n selection: {\n count: (count: number) => string;\n selectAll: string;\n duplicate: string;\n moveUp: string;\n moveDown: string;\n delete: string;\n clear: string;\n };\n // The `title` and `description` of a `DndEditError`, which the default\n // toast shows.\n editErrors: {\n updateFailed: (label: string) => string;\n cannotEdit: (label: string) => string;\n cannotRemove: (label: string) => string;\n attributeNotFound: (property: string) => string;\n // `property` is set when the binding names one, otherwise `label` is the\n // one to show.\n bindingNotDeclared: (target: {\n label: string;\n property?: string;\n }) => string;\n duplicateBinding: (target: {\n count: number;\n label: string;\n property?: string;\n }) => string;\n reservedProperty: (property: string) => string;\n requiredProperty: (property: string) => string;\n noBinding: string;\n elementNotFound: string;\n unsupportedSyntax: (property: string) => string;\n selfClosing: (property: string) => string;\n checkConsole: string;\n syntaxError: string;\n syntaxErrorDetail: string;\n missingContainer: (containerId: string) => string;\n missingContainerDetail: (containerId: string) => string;\n sectionParseFailed: string;\n itemsParseFailed: string;\n itemUpdateFailed: string;\n itemUpdateFailedDetail: string;\n };\n // What a screen reader hears during a drag.\n announcements: {\n instructions: string;\n // Stands in for a section without a name.\n section: string;\n pickedUp: (name: string) => string;\n movedTo: (name: string, position: number, total: number) => string;\n notOver: (name: string) => string;\n droppedAt: (name: string, position: number, total: number) => string;\n dropped: (name: string) => string;\n cancelled: (name: string) => string;\n itemOver: (name: string, over: string) => string;\n itemMoved: (name: string, over: string) => string;\n };\n // The error boxes of `Live.Preview`, `Live.Error` and canvas sections.\n errors: {\n default: string;\n compile: string;\n runtime: string;\n rendering: string;\n sectionUnavailable: string;\n sectionNotRendered: string;\n tryAgain: string;\n // The message of a page error that carries none.\n unknown: string;\n // The message of an unhandled promise rejection that carries none.\n unhandledRejection: string;\n };\n validation: ValidationMessages;\n}\n\n// Every group of `LiveMessages`, each with any of its keys.\nexport type LiveMessagesInput = {\n [Group in keyof LiveMessages]?: Partial<LiveMessages[Group]>;\n};\n\nexport const defaultMessages: LiveMessages = {\n section: {\n moveUp: 'Move section up',\n moveDown: 'Move section down',\n duplicate: 'Duplicate section',\n delete: 'Delete section',\n },\n canvas: {\n palette: 'Components',\n properties: 'Properties',\n close: 'Close',\n resizePalette: 'Resize the components pane',\n resizePanel: 'Resize the properties pane',\n pickElement: 'Pick an element',\n pickElementActive: 'Click an element to edit it. Esc to cancel.',\n dropHere: 'Drop here',\n dropAtBottom: 'Drag here to add at bottom',\n empty: 'No sections available',\n emptyHintTouch: 'Tap a component to add it',\n emptyHintDrag: 'Drag a component from the left to add it',\n syntaxError: 'The document has a syntax error',\n syntaxErrorDetail: 'Fix it in the code to see its sections',\n missingContainer: containerId =>\n `No #${containerId} element in the document`,\n missingContainerDetail: containerId =>\n `Sections go inside the element with id=\"${containerId}\"`,\n stale:\n 'Showing the last version that parsed. Fix the syntax error in the code to edit here again.',\n },\n panel: {\n selectSection: 'Please select a section.',\n noEditableElements: 'No editable elements.',\n readOnly:\n \"The document has a syntax error. These fields are from the last version that parsed, and can't be edited until it parses again.\",\n expressionPreserved:\n 'This expression is preserved but is not editable here.',\n useCodeEditor: 'Use the code editor to change it.',\n invalidValue: 'Invalid value.',\n urlPlaceholder: 'https://example.com',\n emailPlaceholder: 'name@example.com',\n telPlaceholder: '+1 555 0100',\n numberPlaceholder: 'Enter a numeric value',\n textPlaceholder: 'Enter a value',\n },\n items: {\n heading: count => `Items (${count})`,\n add: 'Add Item',\n item: position => `Item ${position}`,\n reorder: item => `Reorder ${item}`,\n moveUp: 'Move item up',\n moveDown: 'Move item down',\n delete: 'Delete item',\n collapseAll: 'Collapse all',\n expandAll: 'Expand all',\n unreadable:\n 'This value could not be read as a list. Edit it in the code editor.',\n empty:\n 'No editable items. The panel copies an existing item rather than guessing the shape of a new one — add the first item in the code editor.',\n structureLocked:\n 'Values remain editable, but moving, copying, adding, and deleting require a dense array without spreads or parenthesized top-level items. Use the code editor for those structural changes.',\n noNestedBindings: 'No JSX bindings found',\n },\n children: {\n heading: count => `Children Items (${count})`,\n add: 'Add Child',\n child: (position, tagName) => `Child ${position} (${tagName})`,\n moveUp: 'Move child up',\n moveDown: 'Move child down',\n delete: 'Delete child',\n editableBindings: 'Editable Bindings:',\n childNodes: 'Child Nodes:',\n },\n selection: {\n count: count => `${count} selected`,\n selectAll: 'Select all',\n duplicate: 'Duplicate selected',\n moveUp: 'Move selected up',\n moveDown: 'Move selected down',\n delete: 'Delete selected',\n clear: 'Clear',\n },\n editErrors: {\n updateFailed: label => `Failed to update \"${label}\"`,\n cannotEdit: label => `Cannot edit \"${label}\" in the panel`,\n cannotRemove: label => `Cannot remove \"${label}\"`,\n attributeNotFound: property =>\n `This element has no \"${property}\" attribute — check the property in its data-binding.`,\n bindingNotDeclared: ({ label, property }) =>\n `No binding for ${\n property ? `property \"${property}\"` : `label \"${label}\"`\n } is declared on this element's data-binding.`,\n duplicateBinding: ({ count, label, property }) =>\n `${count} bindings share ${\n property ? `property \"${property}\"` : `label \"${label}\"`\n } on this element — remove the duplicate in its data-binding.`,\n reservedProperty: property =>\n `\"${property}\" is managed by the editor, so a binding can't change it.`,\n requiredProperty: property =>\n `\"${property}\" is marked required in its data-binding, so it can't be removed.`,\n noBinding: 'This element has no data-binding declaration.',\n elementNotFound: 'The target element could not be found in this section.',\n unsupportedSyntax: property =>\n `The \"${property}\" expression was preserved. Change it in the code editor instead.`,\n selfClosing: property =>\n `This element is self-closing, so it has no content for \"${property}\". Give it a closing tag in the code editor.`,\n checkConsole: 'Check the console for details.',\n syntaxError: 'The document has a syntax error',\n syntaxErrorDetail:\n 'The canvas shows the last version that parsed. Fix the error in the code, then edit here again.',\n missingContainer: containerId =>\n `No #${containerId} element in the document`,\n missingContainerDetail: containerId =>\n `Sections are the <section> elements inside the element with id=\"${containerId}\". Start from createDocument(), or set containerId to match your document.`,\n sectionParseFailed: 'Failed to parse this section',\n itemsParseFailed: 'Failed to parse items',\n itemUpdateFailed: 'Failed to update this item',\n itemUpdateFailedDetail:\n 'The source was preserved. Structural edits require a dense array without spreads; use the code editor for unsupported syntax.',\n },\n announcements: {\n instructions:\n 'On a palette item, press Enter to add it to the canvas. On a canvas section, press Enter to select it, the up and down arrow keys to go to the previous or next section, and Delete to remove it. Press Space to pick a section up, the arrow keys to move it, and Space or Enter to drop it. Press Escape to cancel.',\n section: 'section',\n pickedUp: name => `Picked up ${name}.`,\n movedTo: (name, position, total) =>\n `${name} moved to position ${position} of ${total}.`,\n notOver: name => `${name} is no longer over a position.`,\n droppedAt: (name, position, total) =>\n `${name} dropped at position ${position} of ${total}.`,\n dropped: name => `${name} dropped.`,\n cancelled: name => `Moving ${name} was cancelled.`,\n itemOver: (name, over) => `${name} is over ${over}.`,\n itemMoved: (name, over) => `${name} was moved to the place of ${over}.`,\n },\n errors: {\n default: 'An error occurred',\n compile: 'Compile Error',\n runtime: 'Runtime Error',\n rendering: 'Rendering Error',\n sectionUnavailable: 'Section Unavailable',\n sectionNotRendered: 'This section is not rendered in this editor.',\n tryAgain: 'Try Again',\n unknown: 'Unknown error',\n unhandledRejection: 'Unhandled promise rejection',\n },\n validation: defaultValidationMessages,\n};\n\n// `base` (the defaults, unless given) with each group's given keys on top.\nexport const mergeMessages = (\n input?: LiveMessagesInput,\n base: LiveMessages = defaultMessages,\n): LiveMessages => {\n if (!input) {\n return base;\n }\n\n const merged = { ...base };\n\n for (const group of Object.keys(base) as (keyof LiveMessages)[]) {\n if (input[group]) {\n merged[group] = { ...base[group], ...input[group] } as never;\n }\n }\n\n return merged;\n};\n\n// The English defaults outside a provider, so an error box rendered on its\n// own still has text.\nexport const MessagesContext = createContext<LiveMessages>(defaultMessages);\n\n// The messages in effect: the provider's, merged over the defaults. A custom\n// palette or panel can use it to show the same text as the built-in ones.\nexport const useLiveMessages = () => useContext(MessagesContext);\n"],"mappings":";;;AAkKA,MAAa,kBAAgC;CAC3C,SAAS;EACP,QAAQ;EACR,UAAU;EACV,WAAW;EACX,QAAQ;CACV;CACA,QAAQ;EACN,SAAS;EACT,YAAY;EACZ,OAAO;EACP,eAAe;EACf,aAAa;EACb,aAAa;EACb,mBAAmB;EACnB,UAAU;EACV,cAAc;EACd,OAAO;EACP,gBAAgB;EAChB,eAAe;EACf,aAAa;EACb,mBAAmB;EACnB,mBAAkB,gBAChB,OAAO,YAAY;EACrB,yBAAwB,gBACtB,2CAA2C,YAAY;EACzD,OACE;CACJ;CACA,OAAO;EACL,eAAe;EACf,oBAAoB;EACpB,UACE;EACF,qBACE;EACF,eAAe;EACf,cAAc;EACd,gBAAgB;EAChB,kBAAkB;EAClB,gBAAgB;EAChB,mBAAmB;EACnB,iBAAiB;CACnB;CACA,OAAO;EACL,UAAS,UAAS,UAAU,MAAM;EAClC,KAAK;EACL,OAAM,aAAY,QAAQ;EAC1B,UAAS,SAAQ,WAAW;EAC5B,QAAQ;EACR,UAAU;EACV,QAAQ;EACR,aAAa;EACb,WAAW;EACX,YACE;EACF,OACE;EACF,iBACE;EACF,kBAAkB;CACpB;CACA,UAAU;EACR,UAAS,UAAS,mBAAmB,MAAM;EAC3C,KAAK;EACL,QAAQ,UAAU,YAAY,SAAS,SAAS,IAAI,QAAQ;EAC5D,QAAQ;EACR,UAAU;EACV,QAAQ;EACR,kBAAkB;EAClB,YAAY;CACd;CACA,WAAW;EACT,QAAO,UAAS,GAAG,MAAM;EACzB,WAAW;EACX,WAAW;EACX,QAAQ;EACR,UAAU;EACV,QAAQ;EACR,OAAO;CACT;CACA,YAAY;EACV,eAAc,UAAS,qBAAqB,MAAM;EAClD,aAAY,UAAS,gBAAgB,MAAM;EAC3C,eAAc,UAAS,kBAAkB,MAAM;EAC/C,oBAAmB,aACjB,wBAAwB,SAAS;EACnC,qBAAqB,EAAE,OAAO,eAC5B,kBACE,WAAW,aAAa,SAAS,KAAK,UAAU,MAAM,GACvD;EACH,mBAAmB,EAAE,OAAO,OAAO,eACjC,GAAG,MAAM,kBACP,WAAW,aAAa,SAAS,KAAK,UAAU,MAAM,GACvD;EACH,mBAAkB,aAChB,IAAI,SAAS;EACf,mBAAkB,aAChB,IAAI,SAAS;EACf,WAAW;EACX,iBAAiB;EACjB,oBAAmB,aACjB,QAAQ,SAAS;EACnB,cAAa,aACX,2DAA2D,SAAS;EACtE,cAAc;EACd,aAAa;EACb,mBACE;EACF,mBAAkB,gBAChB,OAAO,YAAY;EACrB,yBAAwB,gBACtB,mEAAmE,YAAY;EACjF,oBAAoB;EACpB,kBAAkB;EAClB,kBAAkB;EAClB,wBACE;CACJ;CACA,eAAe;EACb,cACE;EACF,SAAS;EACT,WAAU,SAAQ,aAAa,KAAK;EACpC,UAAU,MAAM,UAAU,UACxB,GAAG,KAAK,qBAAqB,SAAS,MAAM,MAAM;EACpD,UAAS,SAAQ,GAAG,KAAK;EACzB,YAAY,MAAM,UAAU,UAC1B,GAAG,KAAK,uBAAuB,SAAS,MAAM,MAAM;EACtD,UAAS,SAAQ,GAAG,KAAK;EACzB,YAAW,SAAQ,UAAU,KAAK;EAClC,WAAW,MAAM,SAAS,GAAG,KAAK,WAAW,KAAK;EAClD,YAAY,MAAM,SAAS,GAAG,KAAK,6BAA6B,KAAK;CACvE;CACA,QAAQ;EACN,SAAS;EACT,SAAS;EACT,SAAS;EACT,WAAW;EACX,oBAAoB;EACpB,oBAAoB;EACpB,UAAU;EACV,SAAS;EACT,oBAAoB;CACtB;CACA,YAAY;AACd;AAGA,MAAa,iBACX,OACA,OAAqB,oBACJ;CACjB,IAAI,CAAC,OACH,OAAO;CAGT,MAAM,SAAS,EAAE,GAAG,KAAK;CAEzB,KAAK,MAAM,SAAS,OAAO,KAAK,IAAI,GAClC,IAAI,MAAM,QACR,OAAO,SAAS;EAAE,GAAG,KAAK;EAAQ,GAAG,MAAM;CAAO;CAItD,OAAO;AACT;AAIA,MAAa,kBAAkB,cAA4B,eAAe;AAI1E,MAAa,wBAAwB,WAAW,eAAe"}
@@ -1,2 +1,2 @@
1
- import { n as Preview, r as Props, t as baseModules } from "../index-DQkL37eL.js";
2
- export { type Props, baseModules, Preview as default };
1
+ import { n as Props, t as Preview } from "../index-CqsS207F.js";
2
+ export { type Props, Preview as default };
@@ -1,3 +1,2 @@
1
- import { r as baseModules } from "../use-dynamic-tailwind-BP1toJkW.js";
2
- import { t as Preview } from "../preview-CtyG5UbH.js";
3
- export { baseModules, Preview as default };
1
+ import { t as Preview } from "../preview-B05MkVIQ.js";
2
+ export { Preview as default };
@@ -1,13 +1,16 @@
1
- import { i as useLiveMessages } from "./messages-CSrMI4Rm.js";
1
+ import { i as useLiveMessages } from "./messages-DrINcRdG.js";
2
2
  import { i as usePreview, r as useError } from "./states-Ci1AvoQ9.js";
3
3
  import { t as cn } from "./cn-CAnad2vL.js";
4
- import { i as Frame, n as useCompiledModule, t as useDynamicTailwind } from "./use-dynamic-tailwind-BP1toJkW.js";
5
- import { t as Error } from "./error-CN_GCnXB.js";
4
+ import { a as renderStableComponent, i as NO_PROPS, n as useCompiledModule, o as Frame, r as NO_MODULES, t as useDynamicTailwind } from "./use-dynamic-tailwind-B3l1qZRW.js";
5
+ import { t as Error } from "./error-CFzvnLCf.js";
6
6
  import { useMemo } from "react";
7
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
- //#region src/components/preview/defaults.ts
9
- const NO_PROPS = {};
10
- const NO_MODULES = {};
8
+ //#region src/components/preview/preview.module.css
9
+ var preview_module_default = {
10
+ "fill": "U36FtW_fill",
11
+ "hidden": "U36FtW_hidden",
12
+ "scroll": "U36FtW_scroll"
13
+ };
11
14
  //#endregion
12
15
  //#region src/components/preview/client.tsx
13
16
  const Client = ({ code: _code, className, showError, props = NO_PROPS, modules = NO_MODULES, frame, dynamicTailwind = false, provider }) => {
@@ -15,7 +18,7 @@ const Client = ({ code: _code, className, showError, props = NO_PROPS, modules =
15
18
  const { error, setError } = useError();
16
19
  const messages = useLiveMessages();
17
20
  const isError = !!showError && !!error;
18
- const classNames = cn(isError && "hidden", className);
21
+ const classNames = cn(isError && preview_module_default.hidden, className);
19
22
  const effectiveCode = _code === void 0 ? code : _code;
20
23
  const module = useCompiledModule(effectiveCode, modules);
21
24
  const { ref: contentRef, css: dynamicCSS } = useDynamicTailwind(effectiveCode, dynamicTailwind);
@@ -24,7 +27,7 @@ const Client = ({ code: _code, className, showError, props = NO_PROPS, modules =
24
27
  return provider ? provider(component) : component;
25
28
  };
26
29
  if (module && module.error) return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
27
- className: cn("relative h-full w-full", classNames),
30
+ className: cn(preview_module_default.fill, classNames),
28
31
  children: /* @__PURE__ */ jsx(Error, {
29
32
  message: module.error,
30
33
  title: messages.errors.compile
@@ -33,7 +36,7 @@ const Client = ({ code: _code, className, showError, props = NO_PROPS, modules =
33
36
  const Component = module?.exports?.default;
34
37
  if (!Component) return null;
35
38
  return /* @__PURE__ */ jsxs(Fragment, { children: [frame ? /* @__PURE__ */ jsx("div", {
36
- className: cn("h-full w-full", classNames),
39
+ className: cn(preview_module_default.fill, classNames),
37
40
  children: /* @__PURE__ */ jsx(Frame, {
38
41
  ...frame,
39
42
  children: (container) => /* @__PURE__ */ jsx("div", {
@@ -44,7 +47,7 @@ const Client = ({ code: _code, className, showError, props = NO_PROPS, modules =
44
47
  onError: (e) => setError(e.message),
45
48
  children: renderProvider(/* @__PURE__ */ jsxs(Error.Guard, {
46
49
  onError: (e) => setError(e.message),
47
- children: [/* @__PURE__ */ jsx(Component, {
50
+ children: [renderStableComponent(Component, effectiveCode, {
48
51
  ...componentProps,
49
52
  container
50
53
  }), dynamicTailwind && dynamicCSS && /* @__PURE__ */ jsx("style", { children: dynamicCSS })]
@@ -54,7 +57,7 @@ const Client = ({ code: _code, className, showError, props = NO_PROPS, modules =
54
57
  })
55
58
  }) : /* @__PURE__ */ jsx("div", {
56
59
  ref: contentRef,
57
- className: cn("relative h-full w-full overflow-x-hidden overflow-y-auto", classNames),
60
+ className: cn(preview_module_default.fill, preview_module_default.scroll, classNames),
58
61
  style: {
59
62
  isolation: "isolate",
60
63
  transform: "translateZ(0)",
@@ -65,7 +68,7 @@ const Client = ({ code: _code, className, showError, props = NO_PROPS, modules =
65
68
  onError: (e) => setError(e.message),
66
69
  children: renderProvider(/* @__PURE__ */ jsxs(Error.Guard, {
67
70
  onError: (e) => setError(e.message),
68
- children: [/* @__PURE__ */ jsx(Component, { ...componentProps }), dynamicTailwind && dynamicCSS && /* @__PURE__ */ jsx("style", { children: dynamicCSS })]
71
+ children: [renderStableComponent(Component, effectiveCode, componentProps), dynamicTailwind && dynamicCSS && /* @__PURE__ */ jsx("style", { children: dynamicCSS })]
69
72
  }))
70
73
  })
71
74
  }), /* @__PURE__ */ jsx(Error.Runtime, { open: isError })] });
@@ -85,4 +88,4 @@ const Preview = ({ code, props = NO_PROPS, modules = NO_MODULES, dynamicTailwind
85
88
  //#endregion
86
89
  export { Preview as t };
87
90
 
88
- //# sourceMappingURL=preview-CtyG5UbH.js.map
91
+ //# sourceMappingURL=preview-B05MkVIQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preview-B05MkVIQ.js","names":["styles","LiveError"],"sources":["../src/components/preview/preview.module.css","../src/components/preview/client.tsx","../src/components/preview/preview.tsx"],"sourcesContent":["@layer components {\n .fill {\n position: relative;\n width: 100%;\n height: 100%;\n }\n\n .scroll {\n overflow-x: hidden;\n overflow-y: auto;\n }\n\n /* Hides the preview while the runtime error overlay covers it. */\n .hidden {\n display: none;\n }\n}\n","'use client';\n\nimport { useMemo } from 'react';\n\nimport { useLiveMessages } from '~/components/context/messages';\nimport { useError, usePreview } from '~/components/context/states';\nimport LiveError from '~/components/error';\nimport Frame, { type FrameProps } from '~/components/frame';\nimport { cn } from '~/utils/cn';\n\nimport styles from './preview.module.css';\n\nimport { NO_MODULES, NO_PROPS } from './defaults';\nimport { renderStableComponent } from './stable-component';\nimport type { Props } from './types';\nimport { useCompiledModule } from './use-compiled-module';\nimport { useDynamicTailwind } from './use-dynamic-tailwind';\n\nconst Client = ({\n code: _code,\n className,\n showError,\n props = NO_PROPS,\n modules = NO_MODULES,\n frame,\n dynamicTailwind = false,\n provider,\n}: Props) => {\n const { code } = usePreview();\n const { error, setError } = useError();\n const messages = useLiveMessages();\n const isError = !!showError && !!error;\n\n const classNames = cn(isError && styles.hidden, className);\n\n const effectiveCode = _code === undefined ? code : _code;\n\n const module = useCompiledModule(effectiveCode, modules);\n\n // Attached to the wrapper below; scans the rendered DOM so classes coming\n // from an imported component are picked up too. See the hook for details.\n const { ref: contentRef, css: dynamicCSS } = useDynamicTailwind(\n effectiveCode,\n dynamicTailwind,\n );\n\n const componentProps = useMemo(\n () => ({\n ...props,\n }),\n [props],\n );\n\n const renderProvider = (component: React.ReactNode) => {\n return provider ? provider(component) : component;\n };\n\n if (module && module.error) {\n return (\n <>\n <div className={cn(styles.fill, classNames)}>\n <LiveError message={module.error} title={messages.errors.compile} />\n </div>\n <LiveError.Runtime open={isError} />\n </>\n );\n }\n\n const Component = module?.exports?.default;\n\n if (!Component) {\n return null;\n }\n\n return (\n <>\n {frame ? (\n <div className={cn(styles.fill, classNames)}>\n <Frame {...(frame as FrameProps)}>\n {container => (\n <div ref={contentRef} style={{ display: 'contents' }}>\n <LiveError.Boundary\n resetKeys={[effectiveCode]}\n onError={(e: Error) => setError(e.message)}\n >\n {renderProvider(\n <LiveError.Guard onError={e => setError(e.message)}>\n {/* Keeps the DOM when an edit leaves the hooks alone. */}\n {renderStableComponent(Component, effectiveCode, {\n ...componentProps,\n container,\n })}\n {dynamicTailwind && dynamicCSS && (\n <style>{dynamicCSS}</style>\n )}\n </LiveError.Guard>,\n )}\n </LiveError.Boundary>\n </div>\n )}\n </Frame>\n </div>\n ) : (\n <div\n ref={contentRef}\n className={cn(styles.fill, styles.scroll, classNames)}\n style={{\n isolation: 'isolate',\n transform: 'translateZ(0)',\n containerType: 'inline-size',\n }}\n >\n <LiveError.Boundary\n resetKeys={[effectiveCode]}\n onError={e => setError(e.message)}\n >\n {renderProvider(\n <LiveError.Guard onError={e => setError(e.message)}>\n {renderStableComponent(\n Component,\n effectiveCode,\n componentProps,\n )}\n {dynamicTailwind && dynamicCSS && <style>{dynamicCSS}</style>}\n </LiveError.Guard>,\n )}\n </LiveError.Boundary>\n </div>\n )}\n <LiveError.Runtime open={isError} />\n </>\n );\n};\n\nexport default Client;\n","import Client from './client';\nimport { NO_MODULES, NO_PROPS } from './defaults';\nimport type { Props } from './types';\n\n// `Live.Preview`: a thin wrapper around `Client`, which compiles, handles\n// errors and wraps the frame. One render path for both `code` and the\n// provider's code (#187).\nconst Preview = ({\n code,\n props = NO_PROPS,\n modules = NO_MODULES,\n dynamicTailwind = false,\n provider,\n ...restProps\n}: Props) => {\n return (\n <Client\n code={code}\n props={props}\n modules={modules}\n dynamicTailwind={dynamicTailwind}\n provider={provider}\n {...restProps}\n />\n );\n};\n\nexport default Preview;\n"],"mappings":";;;;;;;;;;;;;;;ACkBA,MAAM,UAAU,EACd,MAAM,OACN,WACA,WACA,QAAQ,UACR,UAAU,YACV,OACA,kBAAkB,OAClB,eACW;CACX,MAAM,EAAE,SAAS,WAAW;CAC5B,MAAM,EAAE,OAAO,aAAa,SAAS;CACrC,MAAM,WAAW,gBAAgB;CACjC,MAAM,UAAU,CAAC,CAAC,aAAa,CAAC,CAAC;CAEjC,MAAM,aAAa,GAAG,WAAWA,uBAAO,QAAQ,SAAS;CAEzD,MAAM,gBAAgB,UAAU,KAAA,IAAY,OAAO;CAEnD,MAAM,SAAS,kBAAkB,eAAe,OAAO;CAIvD,MAAM,EAAE,KAAK,YAAY,KAAK,eAAe,mBAC3C,eACA,eACF;CAEA,MAAM,iBAAiB,eACd,EACL,GAAG,MACL,IACA,CAAC,KAAK,CACR;CAEA,MAAM,kBAAkB,cAA+B;EACrD,OAAO,WAAW,SAAS,SAAS,IAAI;CAC1C;CAEA,IAAI,UAAU,OAAO,OACnB,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,OAAD;EAAK,WAAW,GAAGA,uBAAO,MAAM,UAAU;EACxC,UAAA,oBAACC,OAAD;GAAW,SAAS,OAAO;GAAO,OAAO,SAAS,OAAO;EAAU,CAAA;CAChE,CAAA,GACL,oBAACA,MAAU,SAAX,EAAmB,MAAM,QAAU,CAAA,CACnC,EAAA,CAAA;CAIN,MAAM,YAAY,QAAQ,SAAS;CAEnC,IAAI,CAAC,WACH,OAAO;CAGT,OACE,qBAAA,UAAA,EAAA,UAAA,CACG,QACC,oBAAC,OAAD;EAAK,WAAW,GAAGD,uBAAO,MAAM,UAAU;EACxC,UAAA,oBAAC,OAAD;GAAO,GAAK;GACT,WAAA,cACC,oBAAC,OAAD;IAAK,KAAK;IAAY,OAAO,EAAE,SAAS,WAAW;IACjD,UAAA,oBAACC,MAAU,UAAX;KACE,WAAW,CAAC,aAAa;KACzB,UAAU,MAAa,SAAS,EAAE,OAAO;KAExC,UAAA,eACC,qBAACA,MAAU,OAAX;MAAiB,UAAS,MAAK,SAAS,EAAE,OAAO;MAAjD,UAAA,CAEG,sBAAsB,WAAW,eAAe;OAC/C,GAAG;OACH;MACF,CAAC,GACA,mBAAmB,cAClB,oBAAC,SAAD,EAAA,UAAQ,WAAkB,CAAA,CAEb;KACnB,CAAA,CAAA;IACkB,CAAA;GACjB,CAAA;EAEF,CAAA;CACJ,CAAA,IAEL,oBAAC,OAAD;EACE,KAAK;EACL,WAAW,GAAGD,uBAAO,MAAMA,uBAAO,QAAQ,UAAU;EACpD,OAAO;GACL,WAAW;GACX,WAAW;GACX,eAAe;EACjB;EAEA,UAAA,oBAACC,MAAU,UAAX;GACE,WAAW,CAAC,aAAa;GACzB,UAAS,MAAK,SAAS,EAAE,OAAO;GAE/B,UAAA,eACC,qBAACA,MAAU,OAAX;IAAiB,UAAS,MAAK,SAAS,EAAE,OAAO;IAAjD,UAAA,CACG,sBACC,WACA,eACA,cACF,GACC,mBAAmB,cAAc,oBAAC,SAAD,EAAA,UAAQ,WAAkB,CAAA,CAC7C;GACnB,CAAA,CAAA;EACkB,CAAA;CACjB,CAAA,GAEP,oBAACA,MAAU,SAAX,EAAmB,MAAM,QAAU,CAAA,CACnC,EAAA,CAAA;AAEN;;;AC7HA,MAAM,WAAW,EACf,MACA,QAAQ,UACR,UAAU,YACV,kBAAkB,OAClB,UACA,GAAG,gBACQ;CACX,OACE,oBAAC,QAAD;EACQ;EACC;EACE;EACQ;EACP;EACV,GAAI;CACL,CAAA;AAEL"}
@@ -1,3 +1,3 @@
1
- import { i as useLiveMessages, n as LiveMessagesInput, r as defaultMessages, t as LiveMessages } from "../messages-IBPs4TkZ.js";
2
- import { n as Props, t as ContextProvider } from "../index-DrWtSKXu.js";
1
+ import { i as useLiveMessages, n as LiveMessagesInput, r as defaultMessages, t as LiveMessages } from "../messages-BpN3QIhj.js";
2
+ import { n as Props, t as ContextProvider } from "../index-BZpZwrxT.js";
3
3
  export { type LiveMessages, type LiveMessagesInput, type Props, ContextProvider as default, defaultMessages, useLiveMessages };
@@ -1,3 +1,3 @@
1
- import { i as useLiveMessages, n as defaultMessages } from "../messages-CSrMI4Rm.js";
2
- import { t as ContextProvider } from "../context-B8MzP7_p.js";
1
+ import { i as useLiveMessages, n as defaultMessages } from "../messages-DrINcRdG.js";
2
+ import { t as ContextProvider } from "../context-Bjq0CvBE.js";
3
3
  export { ContextProvider as default, defaultMessages, useLiveMessages };
@@ -1,5 +1,5 @@
1
- import { a as generateSectionPreview, c as inspectDocument, l as parseDocument, o as generateSectionPreviews, s as getSections, u as replaceDocumentSections } from "./document-CHO215iP.js";
2
- import { i as DEFAULT_CONTAINER_ID, u as documentTemplate } from "./constants-DU17Tdwo.js";
1
+ import { a as inspectDocument, i as getSections, o as parseDocument, r as generateSectionPreview, s as replaceDocumentSections } from "./document-uHqw0mvr.js";
2
+ import { i as DEFAULT_CONTAINER_ID, l as documentTemplate } from "./constants-st9gnJ5g.js";
3
3
  //#region src/utils/sections.ts
4
4
  const extractSections = (code, options) => {
5
5
  const doc = parseDocument(code, options);
@@ -11,9 +11,6 @@ const replaceSections = (code, sections, options) => {
11
11
  const generateSection = (code, fullCode, options) => {
12
12
  return generateSectionPreview(fullCode, code, options);
13
13
  };
14
- const generateSections = (codes, fullCode, options) => {
15
- return generateSectionPreviews(fullCode, codes, options);
16
- };
17
14
  const createDocument = ({ containerId = DEFAULT_CONTAINER_ID } = {}) => {
18
15
  if (!/^[^\s"'<>{}]+$/.test(containerId)) throw new Error(`createDocument: containerId must be a plain element id, got ${JSON.stringify(containerId)}`);
19
16
  return documentTemplate(containerId);
@@ -24,6 +21,6 @@ const checkDocument = (code, options) => {
24
21
  return { ...inspection };
25
22
  };
26
23
  //#endregion
27
- export { generateSections as a, generateSection as i, createDocument as n, replaceSections as o, extractSections as r, checkDocument as t };
24
+ export { replaceSections as a, generateSection as i, createDocument as n, extractSections as r, checkDocument as t };
28
25
 
29
- //# sourceMappingURL=sections-jYuqS4KB.js.map
26
+ //# sourceMappingURL=sections-DhH_aVf5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sections-DhH_aVf5.js","names":[],"sources":["../src/utils/sections.ts"],"sourcesContent":["import { DEFAULT_CONTAINER_ID, documentTemplate } from '~/constants';\nimport type { Section } from '~/types';\n\nimport {\n type DocumentOptions,\n type DocumentProblem,\n type SectionOptions,\n createSectionPreviewCache,\n generateSectionPreview,\n getSections,\n inspectDocument,\n parseDocument,\n replaceDocumentSections,\n} from './ast/document';\n\nexport const extractSections = (\n code: string,\n options?: SectionOptions,\n): Section[] => {\n const doc = parseDocument(code, options);\n\n return doc ? getSections(doc, options) : [];\n};\n\nexport const replaceSections = (\n code: string,\n sections: string[],\n options?: DocumentOptions,\n): string => {\n return replaceDocumentSections(code, sections, options);\n};\n\nexport const generateSection = (\n code: string,\n fullCode: string,\n options?: DocumentOptions,\n) => {\n return generateSectionPreview(fullCode, code, options);\n};\n\n// A new, empty document `Live.Dnd` can add sections to: an `App` component\n// rendering the container element and nothing else. Start a controlled\n// `Live.Dnd` from this rather than an empty string, which has no container,\n// so nothing dropped on the canvas would land anywhere (#449). Pass the same\n// `containerId` you give `Live.Dnd`.\nexport const createDocument = ({\n containerId = DEFAULT_CONTAINER_ID,\n}: DocumentOptions = {}): string => {\n // The id is written into a JSX attribute as-is, so anything that could end\n // the attribute or the tag is refused rather than producing broken source.\n if (!/^[^\\s\"'<>{}]+$/.test(containerId)) {\n throw new Error(\n `createDocument: containerId must be a plain element id, got ${JSON.stringify(containerId)}`,\n );\n }\n\n return documentTemplate(containerId);\n};\n\n// Whether `Live.Dnd` can edit a document: it parses, and it has the\n// container. A host can check one before saving or loading it, and gets the\n// same reasons `Live.Dnd` reports through `onEditError` (#522).\nexport type DocumentCheck = { ok: true } | ({ ok: false } & DocumentProblem);\n\nexport const checkDocument = (\n code: string,\n options?: DocumentOptions,\n): DocumentCheck => {\n const inspection = inspectDocument(code, options);\n\n if (inspection.ok) {\n return { ok: true };\n }\n\n // A copy: the inspection is cached and shared with `Live.Dnd`.\n return { ...inspection };\n};\n\n// Generates every section's preview from one parse and reuses an unchanged\n// preview between calls (#131). Keep one instance per editor, as `Live.Dnd`\n// does.\nexport { createSectionPreviewCache };\nexport type {\n DocumentOptions,\n DocumentProblem,\n SectionOptions,\n} from './ast/document';\n"],"mappings":";;;AAeA,MAAa,mBACX,MACA,YACc;CACd,MAAM,MAAM,cAAc,MAAM,OAAO;CAEvC,OAAO,MAAM,YAAY,KAAK,OAAO,IAAI,CAAC;AAC5C;AAEA,MAAa,mBACX,MACA,UACA,YACW;CACX,OAAO,wBAAwB,MAAM,UAAU,OAAO;AACxD;AAEA,MAAa,mBACX,MACA,UACA,YACG;CACH,OAAO,uBAAuB,UAAU,MAAM,OAAO;AACvD;AAOA,MAAa,kBAAkB,EAC7B,cAAc,yBACK,CAAC,MAAc;CAGlC,IAAI,CAAC,iBAAiB,KAAK,WAAW,GACpC,MAAM,IAAI,MACR,+DAA+D,KAAK,UAAU,WAAW,GAC3F;CAGF,OAAO,iBAAiB,WAAW;AACrC;AAOA,MAAa,iBACX,MACA,YACkB;CAClB,MAAM,aAAa,gBAAgB,MAAM,OAAO;CAEhD,IAAI,WAAW,IACb,OAAO,EAAE,IAAI,KAAK;CAIpB,OAAO,EAAE,GAAG,WAAW;AACzB"}