@jbpark/live-editor 1.18.0 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ast-Cyi-jw9Z.js → ast-CBAw3X_T.js} +27 -10
- package/dist/ast-CBAw3X_T.js.map +1 -0
- package/dist/{boundary-DUTt8lXq.js → boundary-b-U70XU_.js} +2 -2
- package/dist/{boundary-DUTt8lXq.js.map → boundary-b-U70XU_.js.map} +1 -1
- package/dist/{context-fLmciLSw.js → context-Yb81ZxnN.js} +3 -3
- package/dist/{context-fLmciLSw.js.map → context-Yb81ZxnN.js.map} +1 -1
- package/dist/{core-ttOtjNaX.js → core-mdFWxqB2.js} +2 -2
- package/dist/{core-ttOtjNaX.js.map → core-mdFWxqB2.js.map} +1 -1
- package/dist/dnd/index.d.ts +1 -1
- package/dist/dnd/index.js +1 -1
- package/dist/{dnd-l2V0EmfS.js → dnd-DFrLeyPd.js} +9 -7
- package/dist/dnd-DFrLeyPd.js.map +1 -0
- package/dist/{document-DhMip8lL.js → document-DEx4WyCn.js} +7 -1
- package/dist/document-DEx4WyCn.js.map +1 -0
- package/dist/editor/index.js +2 -2
- package/dist/{editor-Du55469f.js → editor-jzeeLkwi.js} +3 -3
- package/dist/{editor-Du55469f.js.map → editor-jzeeLkwi.js.map} +1 -1
- package/dist/error/index.js +2 -2
- package/dist/{error-BbOmgZDR.js → error-C47PVZgY.js} +2 -2
- package/dist/{error-BbOmgZDR.js.map → error-C47PVZgY.js.map} +1 -1
- package/dist/{index-Ly0DcdIH.d.ts → index-BDy-pgdA.d.ts} +3 -2
- package/dist/{index-soMhswGI.d.ts → index-DPIpXpfQ.d.ts} +3 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/dist/preview/index.js +1 -1
- package/dist/{preview-CQf0nwE6.js → preview-8OZDsfGT.js} +4 -4
- package/dist/{preview-CQf0nwE6.js.map → preview-8OZDsfGT.js.map} +1 -1
- package/dist/provider/index.js +1 -1
- package/dist/style.css +2944 -2934
- package/dist/{use-dynamic-tailwind-DkK3r-as.js → use-dynamic-tailwind-_3tC-S5j.js} +2 -2
- package/dist/{use-dynamic-tailwind-DkK3r-as.js.map → use-dynamic-tailwind-_3tC-S5j.js.map} +1 -1
- package/dist/utils/ast/index.d.ts +1 -1
- package/dist/utils/ast/index.js +2 -2
- package/dist/utils/index.js +2 -2
- package/dist/{utils-CCrTYGUG.js → utils-CXq1KaM3.js} +2 -2
- package/dist/{utils-CCrTYGUG.js.map → utils-CXq1KaM3.js.map} +1 -1
- package/package.json +1 -1
- package/dist/ast-Cyi-jw9Z.js.map +0 -1
- package/dist/dnd-l2V0EmfS.js.map +0 -1
- package/dist/document-DhMip8lL.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as __toESM, _ as CONFIG, d as createBoundedCache, f as nanoid, g as BINDING_PROP, h as require_lib$1, m as require_lib$2, p as require_lib, u as traverse, v as DATA_ATTR, x as REGEX } from "./document-
|
|
1
|
+
import { C as __toESM, _ as CONFIG, d as createBoundedCache, f as nanoid, g as BINDING_PROP, h as require_lib$1, m as require_lib$2, p as require_lib, u as traverse, v as DATA_ATTR, x as REGEX } from "./document-DEx4WyCn.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/utils/ast/types.ts
|
|
4
4
|
var import_lib$1 = require_lib$1();
|
|
@@ -240,10 +240,7 @@ const bindingOptionSchema = z.object({
|
|
|
240
240
|
label: z.string(),
|
|
241
241
|
value: z.string()
|
|
242
242
|
});
|
|
243
|
-
const bindingRenderLeafSchema = z.object({
|
|
244
|
-
type: bindingTypeSchema,
|
|
245
|
-
property: z.string().optional()
|
|
246
|
-
});
|
|
243
|
+
const bindingRenderLeafSchema = z.object({ property: z.string().optional() });
|
|
247
244
|
const rawBindingItemSchema = z.object({
|
|
248
245
|
label: z.string(),
|
|
249
246
|
property: z.string().optional(),
|
|
@@ -254,7 +251,19 @@ const rawBindingItemSchema = z.object({
|
|
|
254
251
|
max: z.number().optional(),
|
|
255
252
|
pattern: z.string().optional(),
|
|
256
253
|
required: z.boolean().optional()
|
|
257
|
-
});
|
|
254
|
+
}).passthrough();
|
|
255
|
+
const KNOWN_BINDING_KEYS = /* @__PURE__ */ new Set([
|
|
256
|
+
"label",
|
|
257
|
+
"property",
|
|
258
|
+
"type",
|
|
259
|
+
"widget",
|
|
260
|
+
"options",
|
|
261
|
+
"render",
|
|
262
|
+
"min",
|
|
263
|
+
"max",
|
|
264
|
+
"pattern",
|
|
265
|
+
"required"
|
|
266
|
+
]);
|
|
258
267
|
const WIDGET_TYPE_ALIASES = /* @__PURE__ */ new Set(["icon-picker", "asset-picker"]);
|
|
259
268
|
const isPlainObject = (value) => {
|
|
260
269
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -265,13 +274,18 @@ const sanitizeRenderMap = (value) => {
|
|
|
265
274
|
for (const [key, raw] of Object.entries(value)) {
|
|
266
275
|
if (!isPlainObject(raw)) continue;
|
|
267
276
|
if ("type" in raw) {
|
|
277
|
+
const sanitizedType = bindingTypeSchema.safeParse(raw.type);
|
|
268
278
|
const leaf = bindingRenderLeafSchema.safeParse(raw);
|
|
269
279
|
if (leaf.success) {
|
|
270
280
|
const render = sanitizeRenderMap(raw.render);
|
|
271
|
-
|
|
281
|
+
const typedLeaf = {
|
|
272
282
|
...leaf.data,
|
|
283
|
+
type: sanitizedType.success ? sanitizedType.data : void 0
|
|
284
|
+
};
|
|
285
|
+
map[key] = render ? {
|
|
286
|
+
...typedLeaf,
|
|
273
287
|
render
|
|
274
|
-
} :
|
|
288
|
+
} : typedLeaf;
|
|
275
289
|
}
|
|
276
290
|
continue;
|
|
277
291
|
}
|
|
@@ -307,6 +321,8 @@ const parseBinding = (bindingValue) => {
|
|
|
307
321
|
const widget = explicitWidget ?? derivedWidget;
|
|
308
322
|
if (property === void 0 && type !== "richtext") continue;
|
|
309
323
|
const render = sanitizeRenderMap(rawItem.render);
|
|
324
|
+
const metaEntries = Object.entries(parsed.data).filter(([key]) => !KNOWN_BINDING_KEYS.has(key));
|
|
325
|
+
const meta = metaEntries.length > 0 ? Object.fromEntries(metaEntries) : void 0;
|
|
310
326
|
items.push({
|
|
311
327
|
label,
|
|
312
328
|
property: property ?? BINDING_PROP.INNER_HTML,
|
|
@@ -317,7 +333,8 @@ const parseBinding = (bindingValue) => {
|
|
|
317
333
|
...min !== void 0 && { min },
|
|
318
334
|
...max !== void 0 && { max },
|
|
319
335
|
...pattern !== void 0 && { pattern },
|
|
320
|
-
...required !== void 0 && { required }
|
|
336
|
+
...required !== void 0 && { required },
|
|
337
|
+
...meta && { meta }
|
|
321
338
|
});
|
|
322
339
|
}
|
|
323
340
|
return items;
|
|
@@ -812,4 +829,4 @@ const validateBindingValue = (binding, value) => {
|
|
|
812
829
|
//#endregion
|
|
813
830
|
export { parseArrayExpression as _, bulkUpdate as a, generateCode as b, extract as c, parseBinding as d, arrayExpressionToCode as f, flattenEditableValue as g, extractObjectProperties as h, replaceIds as i, findEditableChildren as l, extractNodeValue as m, clone as n, update as o, createNodeFromValue as p, fillIds as r, clearExtractCache as s, validateBindingValue as t, getCurrentValue as u, parseValue as v, setEditableValue as y };
|
|
814
831
|
|
|
815
|
-
//# sourceMappingURL=ast-
|
|
832
|
+
//# sourceMappingURL=ast-CBAw3X_T.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast-CBAw3X_T.js","names":["_generate","t","parseExpression","t","parseExpression","parseExpression","t","t","parse","t","parse","t","parseExpression"],"sources":["../src/utils/ast/types.ts","../src/utils/ast/helpers.ts","../src/utils/ast/value.ts","../src/utils/ast/binding.ts","../src/utils/ast/extract.ts","../src/utils/ast/update.ts","../src/utils/ast/tree.ts","../src/utils/ast/validate.ts"],"sourcesContent":["export interface Attribute {\n name: string;\n value: string | null;\n isStringLiteral?: boolean;\n}\n\nexport interface DataAttrNode {\n id?: string;\n tagName: string;\n attributes: Attribute[];\n dataAttributes: Attribute[];\n textContent: string;\n rawChildren?: string;\n loc?: {\n start: { line: number; column: number };\n end: { line: number; column: number };\n };\n children?: DataAttrNode[];\n isFragment?: boolean;\n bindings?: BindingItem[];\n}\n\nexport interface BindingOption {\n label: string;\n value: string;\n}\n\n// `icon-picker`/`asset-picker` are kept here as deprecated aliases, not\n// removed — see #236. They describe a *control*, not a data kind, and\n// conflating that with the rest of this list (which does describe what a\n// value actually is) left a consumer with nowhere to express their own\n// widget choice. `parseBinding` normalizes an authored `type: 'icon-picker'`\n// into `{ type: 'string', widget: 'icon-picker' }` rather than passing it\n// through as-is, so existing authored content keeps working unchanged while\n// `BindingItem.widget` becomes the real, open-ended home for this axis.\nexport const BINDING_TYPES = [\n 'array',\n 'object',\n 'string',\n 'number',\n 'boolean',\n 'color',\n 'jsx',\n 'richtext',\n 'date',\n 'url',\n 'icon-picker',\n 'asset-picker',\n] as const;\n\nexport type BindingType = (typeof BINDING_TYPES)[number];\n\nexport interface BindingRenderLeaf {\n // Optional, matching the top-level BindingItem.type — an unrecognized\n // leaf type degrades to untyped instead of dropping the entry (see\n // sanitizeRenderMap in binding.ts and #234).\n type?: BindingType;\n property?: string;\n render?: BindingRenderMap;\n}\n\nexport interface BindingRenderMap {\n [key: string]: BindingRenderLeaf | BindingRenderMap;\n}\n\nexport interface BindingItem {\n label: string;\n property: string;\n // Data kind — what the value *is*. Closed, since the library's own\n // validation/coercion (validateBindingValue, parseValue) has to be able\n // to switch on it exhaustively.\n type?: BindingType;\n // Presentation — how to *render* it. Deliberately an open string, not a\n // closed enum: the library cannot enumerate controls it doesn't\n // implement, and a renderPanel consumer owns presentation once they use\n // it (see #234/#236). `'icon-picker'`/`'asset-picker'` are the built-in\n // panel's own two widgets; anything else (e.g. `'slider'`) is free for a\n // custom renderPanel to switch on.\n widget?: string;\n options?: BindingOption[];\n render?: BindingRenderMap;\n min?: number;\n max?: number;\n pattern?: string;\n required?: boolean;\n // Consumer-defined keys that aren't one of the fields above (`step`,\n // `unit`, a widget hint, ...) — namespaced here rather than spread onto\n // the item itself so they can't collide with a future first-class field.\n // Undefined when nothing extra was authored, not an empty object. See\n // #234: `parseBinding` used to silently strip these.\n meta?: Record<string, unknown>;\n}\n\nexport type NodeValueType =\n 'boolean' | 'number' | 'string' | 'null' | 'array' | 'object' | 'unknown';\n\nexport type EditableNodeValueType = 'boolean' | 'number' | 'string' | 'null';\n\nexport interface ExtractedNodeValue {\n type: NodeValueType;\n value: string | number | boolean | null;\n}\n","import _generate from '@babel/generator';\nimport { parseExpression } from '@babel/parser';\nimport * as t from '@babel/types';\n\nimport { REGEX } from '../../constants';\nimport type { Attribute } from './types';\n\n// Same @babel/* CJS/ESM interop issue as document.ts's traverse import:\n// @babel/generator's CJS build re-exports itself as `{ default: generate,\n// generate, CodeGenerator }`, and Vite's browser dependency pre-bundling\n// doesn't unwrap that inner `.default` again — `generate` resolved to the\n// whole exports object, not the function. Every generateCode() call threw,\n// which extract.ts's extractAttributes() silently swallows into a `null`\n// attribute value, and update.ts's callers surface as \"Failed to parse/\n// update this section\" toasts.\nconst generate =\n typeof _generate === 'function'\n ? _generate\n : (_generate as unknown as { default: typeof _generate }).default;\n\nexport const wrap = (code: string) => {\n return `<>${code}</>`;\n};\n\nexport const unwrap = (generated: string) => {\n return generated\n .replace(/^<>\\s*/g, '')\n .replace(/\\s*<\\/>\\s*;?\\s*$/g, '')\n .trim();\n};\n\nexport const attrValue = ({\n value,\n isStringLiteral,\n}: Attribute): t.JSXAttribute['value'] => {\n if (value === null) {\n return null;\n }\n\n if (isStringLiteral) {\n return t.stringLiteral(value);\n }\n\n const trimmed = value.trim();\n\n if (REGEX.NUMBER.test(trimmed)) {\n return t.jsxExpressionContainer(t.numericLiteral(parseFloat(trimmed)));\n }\n\n if (REGEX.BOOLEAN_OR_NULL.test(trimmed)) {\n const expr = parseExpression(trimmed, {\n plugins: ['jsx', 'typescript'],\n });\n return t.jsxExpressionContainer(expr);\n }\n\n try {\n const expr = parseExpression(trimmed, {\n plugins: ['jsx', 'typescript'],\n });\n return t.jsxExpressionContainer(expr);\n } catch {\n return t.stringLiteral(trimmed);\n }\n};\n\nexport const generateCode = (node: t.Node): string => {\n return generate(node, { jsescOption: { minimal: true } }).code;\n};\n","import { parseExpression } from '@babel/parser';\nimport * as t from '@babel/types';\n\nimport { REGEX } from '../../constants';\nimport { generateCode } from './helpers';\nimport type { ExtractedNodeValue, NodeValueType } from './types';\n\nconst dedent = (str: string): string => {\n const lines = str\n .replace(/^\\n/, '')\n .replace(/\\n\\s*$/, '')\n .split('\\n');\n\n const indent = lines.reduce((min, line) => {\n if (!line.trim()) {\n return min;\n }\n const match = line.match(/^(\\s*)/);\n return Math.min(min, match?.[1]?.length ?? 0);\n }, Infinity);\n\n return indent === Infinity\n ? str.trim()\n : lines.map(line => line.slice(indent)).join('\\n');\n};\n\n// AST 노드를 코드 실행(new Function/eval) 없이 순수 리터럴 구조만 재귀적으로\n// 실제 JS 값으로 변환한다. 함수 호출, 변수 참조 등 리터럴이 아닌 표현식은\n// 평가하지 않고 undefined를 반환한다 — 사용자 코드는 iframe 안에서만 실행한다는\n// 이 저장소의 원칙(AGENTS.md)을 이 패널 UI(메인 문서에서 렌더링됨)에서도 지키기 위함.\nexport const evaluateLiteral = (node: t.Node): unknown => {\n if (t.isStringLiteral(node)) {\n return node.value;\n }\n\n if (t.isNumericLiteral(node)) {\n return node.value;\n }\n\n if (t.isBooleanLiteral(node)) {\n return node.value;\n }\n\n if (t.isNullLiteral(node)) {\n return null;\n }\n\n if (t.isIdentifier(node) && node.name === 'undefined') {\n return undefined;\n }\n\n if (\n t.isUnaryExpression(node) &&\n node.operator === '-' &&\n t.isNumericLiteral(node.argument)\n ) {\n return -node.argument.value;\n }\n\n if (t.isTemplateLiteral(node) && node.expressions.length === 0) {\n return node.quasis[0]?.value.cooked ?? node.quasis[0]?.value.raw ?? '';\n }\n\n if (t.isJSXElement(node) || t.isJSXFragment(node)) {\n return generateCode(node);\n }\n\n if (t.isArrayExpression(node)) {\n return node.elements.map(element =>\n element ? evaluateLiteral(element) : null,\n );\n }\n\n if (t.isObjectExpression(node)) {\n const result: Record<string, unknown> = {};\n\n for (const prop of node.properties) {\n if (!t.isObjectProperty(prop)) {\n continue;\n }\n\n let key: string | null = null;\n\n if (t.isIdentifier(prop.key)) {\n key = prop.key.name;\n } else if (t.isStringLiteral(prop.key)) {\n key = prop.key.value;\n } else if (t.isNumericLiteral(prop.key)) {\n key = String(prop.key.value);\n }\n\n if (key === null) {\n continue;\n }\n\n result[key] = evaluateLiteral(prop.value);\n }\n\n return result;\n }\n\n return undefined;\n};\n\nexport const parseValue = (value: unknown): unknown => {\n if (typeof value !== 'string') {\n return value;\n }\n\n const trimmed = value.trim();\n\n if (!trimmed) {\n return value;\n }\n\n if (REGEX.NUMBER.test(trimmed)) {\n return parseFloat(trimmed);\n }\n\n if (REGEX.BOOLEAN_OR_NULL.test(trimmed)) {\n if (trimmed === 'true') {\n return true;\n }\n if (trimmed === 'false') {\n return false;\n }\n if (trimmed === 'null') {\n return null;\n }\n if (trimmed === 'undefined') {\n return undefined;\n }\n }\n\n if (\n (trimmed.startsWith('{') && trimmed.endsWith('}')) ||\n (trimmed.startsWith('[') && trimmed.endsWith(']'))\n ) {\n try {\n const ast = parseExpression(trimmed, {\n plugins: ['jsx', 'typescript'],\n });\n\n if (t.isObjectExpression(ast) || t.isArrayExpression(ast)) {\n return evaluateLiteral(ast);\n }\n } catch {\n /* ignore */\n }\n\n return value;\n }\n\n return value;\n};\n\nexport type EditablePathSegment = string | number;\nexport type EditablePrimitive = string | number | boolean;\n\nexport interface EditableValueEntry {\n path: EditablePathSegment[];\n value: EditablePrimitive;\n}\n\nconst MAX_FLATTEN_DEPTH = 20;\n\nconst isEditablePrimitive = (value: unknown): value is EditablePrimitive =>\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean';\n\n// A binding's data-binding declaration is one way to know a value is\n// structured (`type: 'object'` + a `render` map — see #225), but most\n// existing content declares neither; it's just an object/array-shaped\n// string because that's what the bound prop actually is (e.g. `style`).\n// This recovers editable leaves from the *parsed value's own shape*\n// instead, so it works on content authored without a renderPanel in mind\n// — including an array of objects whose own members embed further JSX\n// (Live Editor's shipped Stats/FAQ sections both look like this: an\n// `items` array of `{ key, children }`, where `children` is itself a\n// nested, separately data-bound element). A JSX-bearing string is never\n// parsed further here — `parseValue` already reduced it to plain text\n// (see `evaluateLiteral`'s JSXElement case), and this function only ever\n// recurses into genuine object/array structure, treating every string,\n// number, and boolean as a leaf regardless of what the string contains.\n// Depth is capped defensively (pathological/deeply-recursive input\n// shouldn't be able to blow the stack); anything past that depth is\n// treated as a leaf-less dead end and simply omitted, not thrown.\nexport const flattenEditableValue = (\n value: string,\n): EditableValueEntry[] | null => {\n const parsed = parseValue(value);\n\n if (\n typeof parsed !== 'object' ||\n parsed === null ||\n Object.keys(parsed).length === 0\n ) {\n return null;\n }\n\n const entries: EditableValueEntry[] = [];\n\n const walk = (node: unknown, path: EditablePathSegment[], depth: number) => {\n if (depth > MAX_FLATTEN_DEPTH) {\n return;\n }\n\n if (isEditablePrimitive(node)) {\n entries.push({ path, value: node });\n return;\n }\n\n if (Array.isArray(node)) {\n node.forEach((item, index) => walk(item, [...path, index], depth + 1));\n return;\n }\n\n if (typeof node === 'object' && node !== null) {\n Object.entries(node).forEach(([key, item]) =>\n walk(item, [...path, key], depth + 1),\n );\n }\n\n // null/undefined/function/symbol values have no editable leaf form —\n // silently omitted rather than represented as, say, an empty string,\n // which would misrepresent what's actually stored there.\n };\n\n walk(parsed, [], 0);\n\n return entries.length ? entries : null;\n};\n\n// Companion to `flattenEditableValue`: replaces the single leaf at `path`\n// and re-serializes the whole structure — the result is a plain string\n// suitable for `PanelBinding.onChange`/`Dnd`'s AST-update pipeline, same\n// as any other committed value. Fails safe: an out-of-range index, a\n// missing key, or a `value` that didn't parse to an object/array in the\n// first place returns `value` unchanged rather than throwing or silently\n// writing to the wrong place.\nexport const setEditableValue = (\n value: string,\n path: EditablePathSegment[],\n next: EditablePrimitive,\n): string => {\n if (!path.length) {\n return value;\n }\n\n const parsed = parseValue(value);\n\n if (typeof parsed !== 'object' || parsed === null) {\n return value;\n }\n\n const root: unknown = Array.isArray(parsed) ? [...parsed] : { ...parsed };\n let cursor: Record<EditablePathSegment, unknown> | unknown[] = root as\n Record<EditablePathSegment, unknown> | unknown[];\n\n for (let i = 0; i < path.length - 1; i++) {\n const key = path[i]!;\n const child = (cursor as Record<EditablePathSegment, unknown>)[key];\n\n if (typeof child !== 'object' || child === null) {\n return value;\n }\n\n const clonedChild = Array.isArray(child) ? [...child] : { ...child };\n (cursor as Record<EditablePathSegment, unknown>)[key] = clonedChild;\n cursor = clonedChild as Record<EditablePathSegment, unknown> | unknown[];\n }\n\n const lastKey = path[path.length - 1]!;\n\n if (!(lastKey in (cursor as object))) {\n return value;\n }\n\n (cursor as Record<EditablePathSegment, unknown>)[lastKey] = next;\n\n return JSON.stringify(root);\n};\n\nexport const extractNodeValue = (node: t.Node): ExtractedNodeValue => {\n if (t.isBooleanLiteral(node)) {\n return { type: 'boolean', value: node.value };\n }\n\n if (t.isNumericLiteral(node)) {\n return { type: 'number', value: node.value };\n }\n\n if (\n t.isUnaryExpression(node) &&\n node.operator === '-' &&\n t.isNumericLiteral(node.argument)\n ) {\n return { type: 'number', value: -node.argument.value };\n }\n\n if (t.isStringLiteral(node)) {\n return { type: 'string', value: node.value };\n }\n\n if (t.isTemplateLiteral(node)) {\n if (node.expressions.length === 0 && node.quasis.length === 1) {\n return {\n type: 'string',\n value: dedent(\n node.quasis[0]!.value.cooked ?? node.quasis[0]!.value.raw,\n ),\n };\n }\n return { type: 'string', value: generateCode(node) };\n }\n\n if (t.isNullLiteral(node)) {\n return { type: 'null', value: null };\n }\n\n if (t.isArrayExpression(node)) {\n return { type: 'array', value: generateCode(node) };\n }\n\n if (t.isObjectExpression(node)) {\n return { type: 'object', value: generateCode(node) };\n }\n\n if (t.isJSXElement(node) || t.isJSXFragment(node)) {\n return { type: 'string', value: generateCode(node) };\n }\n\n return { type: 'unknown', value: null };\n};\n\nexport const createNodeFromValue = (\n type: NodeValueType,\n value: unknown,\n): t.Expression | null => {\n switch (type) {\n case 'boolean': {\n return t.booleanLiteral(value === true);\n }\n case 'number': {\n return t.numericLiteral(Number(value));\n }\n case 'string': {\n return t.stringLiteral(String(value));\n }\n case 'null': {\n return t.nullLiteral();\n }\n case 'array':\n case 'object':\n case 'unknown': {\n return null;\n }\n default: {\n return null;\n }\n }\n};\n\nexport const parseArrayExpression = (value: string) => {\n try {\n const ast = parseExpression(value, {\n plugins: ['jsx', 'typescript'],\n });\n\n if (!t.isArrayExpression(ast)) {\n return null;\n }\n\n return ast;\n } catch (error) {\n console.error('❌ Array parsing error:', error);\n return null;\n }\n};\n\nexport const extractObjectProperties = (\n element: t.ObjectExpression,\n): Record<string, ExtractedNodeValue & { astNode: t.Node }> => {\n const properties: Record<string, ExtractedNodeValue & { astNode: t.Node }> =\n {};\n\n element.properties.forEach(prop => {\n if (t.isObjectProperty(prop) && t.isIdentifier(prop.key)) {\n const key = prop.key.name;\n\n if (key === 'children') {\n return;\n }\n\n const extracted = extractNodeValue(prop.value);\n\n properties[key] = {\n ...extracted,\n astNode: prop.value,\n };\n }\n });\n\n return properties;\n};\n\nexport const arrayExpressionToCode = (\n elements: t.ObjectExpression[],\n): string => {\n const nextAst = t.arrayExpression(elements);\n return generateCode(nextAst);\n};\n","import { parseExpression } from '@babel/parser';\nimport * as t from '@babel/types';\nimport { z } from 'zod';\n\nimport { BINDING_PROP, DATA_ATTR } from '../../constants';\nimport {\n BINDING_TYPES,\n type BindingItem,\n type BindingOption,\n type BindingRenderMap,\n type DataAttrNode,\n} from './types';\nimport { evaluateLiteral, parseArrayExpression } from './value';\n\nconst bindingTypeSchema = z.enum(BINDING_TYPES);\n\nconst bindingOptionSchema = z.object({\n label: z.string(),\n value: z.string(),\n});\n\n// `type` is validated separately in sanitizeRenderMap (like the top-level\n// item's own type) so an unrecognized value degrades the leaf to untyped\n// instead of failing this whole schema — see #234.\nconst bindingRenderLeafSchema = z.object({\n property: z.string().optional(),\n});\n\n// `widget` is deliberately just `z.string()`, not an enum — see #236. An\n// unrecognized widget is expected (a renderPanel consumer's own value, not\n// this library's), so unlike `type` there is no \"drop it\" failure mode to\n// design for.\n//\n// `.passthrough()` (rather than the default `.strip()`) keeps any key this\n// schema doesn't know about instead of silently discarding it — see #234.\n// A consumer's own metadata (`step`, `unit`, a widget hint, ...) survives\n// parsing and is surfaced separately as `meta` below, namespaced instead of\n// spread onto the item, so it can't collide with a future first-class field.\nconst rawBindingItemSchema = z\n .object({\n label: z.string(),\n property: z.string().optional(),\n type: bindingTypeSchema.optional(),\n widget: z.string().optional(),\n options: z.array(bindingOptionSchema).optional(),\n min: z.number().optional(),\n max: z.number().optional(),\n pattern: z.string().optional(),\n required: z.boolean().optional(),\n })\n .passthrough();\n\n// Every key `rawBindingItemSchema` declares, plus `render` (handled by\n// `sanitizeRenderMap` separately, never through this schema) — anything\n// else surviving `.passthrough()` is consumer-defined and belongs in `meta`,\n// not treated as one of this library's own fields.\nconst KNOWN_BINDING_KEYS = new Set([\n 'label',\n 'property',\n 'type',\n 'widget',\n 'options',\n 'render',\n 'min',\n 'max',\n 'pattern',\n 'required',\n]);\n\n// The two BINDING_TYPES entries that describe a control, not a data kind —\n// see the type/widget split in #236. Normalized below into `widget` instead\n// of being passed through as `type` directly.\nconst WIDGET_TYPE_ALIASES = new Set(['icon-picker', 'asset-picker']);\n\nconst isPlainObject = (value: unknown): value is Record<string, unknown> => {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n};\n\n// A render map entry is either a \"leaf\" (has its own `type`) or a nested\n// map of further entries — recurse into whichever it looks like, and drop\n// anything that matches neither instead of failing the whole map.\nconst sanitizeRenderMap = (value: unknown): BindingRenderMap | undefined => {\n if (!isPlainObject(value)) {\n return undefined;\n }\n\n const map: BindingRenderMap = {};\n\n for (const [key, raw] of Object.entries(value)) {\n if (!isPlainObject(raw)) {\n continue;\n }\n\n if ('type' in raw) {\n // Drop an unrecognized `type` down to untyped instead of dropping the\n // whole entry — matches the top-level item's own behavior at\n // `bindingTypeSchema.safeParse(rawItem.type)` above. Keeping the\n // entry (rather than deleting the key) is what #234 asked for: a\n // typo'd/future leaf type still shows up as a plain field instead of\n // vanishing, and `'type' in leaf` stays true either way since `type`\n // is always set below, even to `undefined`.\n const sanitizedType = bindingTypeSchema.safeParse(raw.type);\n const leaf = bindingRenderLeafSchema.safeParse(raw);\n\n if (leaf.success) {\n const render = sanitizeRenderMap(raw.render);\n const typedLeaf = {\n ...leaf.data,\n type: sanitizedType.success ? sanitizedType.data : undefined,\n };\n\n map[key] = render ? { ...typedLeaf, render } : typedLeaf;\n }\n continue;\n }\n\n const nested = sanitizeRenderMap(raw);\n\n if (nested) {\n map[key] = nested;\n }\n }\n\n return Object.keys(map).length > 0 ? map : undefined;\n};\n\nexport const parseBinding = (bindingValue: string | null): BindingItem[] => {\n if (!bindingValue) {\n return [];\n }\n\n const ast = parseArrayExpression(bindingValue);\n\n if (!ast) {\n return [];\n }\n\n const raw = evaluateLiteral(ast);\n\n if (!Array.isArray(raw)) {\n return [];\n }\n\n const items: BindingItem[] = [];\n\n for (const rawItem of raw) {\n if (!isPlainObject(rawItem)) {\n continue;\n }\n\n // Drop an unrecognized `type` instead of rejecting the whole item — an\n // authored binding with a typo'd/future type string still works as an\n // untyped field rather than disappearing entirely.\n const sanitizedType = bindingTypeSchema.safeParse(rawItem.type);\n\n // `icon-picker`/`asset-picker` describe a widget, not a data kind\n // (#236) — normalize them into `widget` instead of passing them\n // through as `type`. An explicitly authored `widget` (checked below,\n // once the schema has validated it) wins if both are somehow present.\n const isWidgetAlias =\n sanitizedType.success && WIDGET_TYPE_ALIASES.has(sanitizedType.data);\n const normalizedType = isWidgetAlias\n ? 'string'\n : sanitizedType.success\n ? sanitizedType.data\n : undefined;\n const derivedWidget = isWidgetAlias ? sanitizedType.data : undefined;\n\n // Drop individually malformed options instead of rejecting the whole\n // item — a select field with 3 valid options and 1 malformed one should\n // still work with the 3 valid ones.\n const sanitizedOptions = Array.isArray(rawItem.options)\n ? rawItem.options\n .map(option => {\n const parsed = bindingOptionSchema.safeParse(option);\n return parsed.success ? parsed.data : null;\n })\n .filter((option): option is BindingOption => option !== null)\n : undefined;\n\n const parsed = rawBindingItemSchema.safeParse({\n ...rawItem,\n type: normalizedType,\n options: sanitizedOptions?.length ? sanitizedOptions : undefined,\n });\n\n if (!parsed.success) {\n continue;\n }\n\n const {\n label,\n property,\n type,\n widget: explicitWidget,\n options,\n min,\n max,\n pattern,\n required,\n } = parsed.data;\n const widget = explicitWidget ?? derivedWidget;\n\n if (property === undefined && type !== 'richtext') {\n continue;\n }\n\n const render = sanitizeRenderMap(rawItem.render);\n\n const metaEntries = Object.entries(parsed.data).filter(\n ([key]) => !KNOWN_BINDING_KEYS.has(key),\n );\n const meta =\n metaEntries.length > 0 ? Object.fromEntries(metaEntries) : undefined;\n\n items.push({\n label,\n property: property ?? BINDING_PROP.INNER_HTML,\n ...(type !== undefined && { type }),\n ...(widget !== undefined && { widget }),\n ...(options?.length && { options }),\n ...(render && { render }),\n ...(min !== undefined && { min }),\n ...(max !== undefined && { max }),\n ...(pattern !== undefined && { pattern }),\n ...(required !== undefined && { required }),\n ...(meta && { meta }),\n });\n }\n\n return items;\n};\n\nexport const getCurrentValue = (\n node: DataAttrNode,\n property: string,\n): string => {\n switch (property) {\n case BINDING_PROP.INNER_TEXT: {\n return node.textContent || '';\n }\n\n case BINDING_PROP.INNER_HTML: {\n // richtext 타입: dangerouslySetInnerHTML={{ __html }} 에서 읽기\n const dsiAttr = node.attributes.find(\n a => a.name === 'dangerouslySetInnerHTML',\n );\n if (dsiAttr?.value) {\n try {\n const expr = parseExpression(dsiAttr.value, {\n plugins: ['jsx', 'typescript'],\n });\n if (t.isObjectExpression(expr)) {\n const htmlProp = expr.properties.find(\n p =>\n t.isObjectProperty(p) &&\n t.isIdentifier(p.key) &&\n p.key.name === '__html',\n ) as t.ObjectProperty | undefined;\n if (htmlProp) {\n if (t.isStringLiteral(htmlProp.value)) {\n return htmlProp.value.value;\n }\n if (\n t.isTemplateLiteral(htmlProp.value) &&\n htmlProp.value.expressions.length === 0\n ) {\n return (\n htmlProp.value.quasis[0]?.value.cooked ??\n htmlProp.value.quasis[0]?.value.raw ??\n ''\n );\n }\n }\n }\n } catch {\n // ignore\n }\n }\n return node.rawChildren || node.textContent || '';\n }\n\n case BINDING_PROP.CHILDREN: {\n return JSON.stringify(node?.children || []);\n }\n\n default: {\n const customAttr = node.attributes.find(attr => attr.name === property);\n const value = customAttr?.value || '';\n\n return value;\n }\n }\n};\n\nconst hasEditableBindings = (node: DataAttrNode): boolean => {\n const bindingAttr = node.dataAttributes.find(\n attr => attr.name === DATA_ATTR.BINDING,\n );\n\n if (!bindingAttr?.value) {\n return false;\n }\n\n const bindings = node.bindings || parseBinding(bindingAttr.value);\n\n return bindings.length > 0;\n};\n\nexport const findEditableChildren = (node: DataAttrNode): DataAttrNode[] => {\n const editableChildren: DataAttrNode[] = [];\n\n const traverse = (children: DataAttrNode[] | undefined) => {\n if (!children) {\n return;\n }\n\n for (const child of children) {\n if (hasEditableBindings(child)) {\n editableChildren.push(child);\n }\n traverse(child.children);\n }\n };\n\n traverse(node.children);\n\n return editableChildren;\n};\n","import { parse } from '@babel/parser';\nimport * as t from '@babel/types';\nimport { nanoid } from 'nanoid';\n\nimport { BINDING_PROP, CONFIG, DATA_ATTR } from '../../constants';\nimport { createBoundedCache } from '../cache';\nimport { parseBinding } from './binding';\nimport { traverse } from './document';\nimport { attrValue, generateCode, wrap } from './helpers';\nimport type { Attribute, BindingItem, DataAttrNode } from './types';\n\nconst collectText = (\n children: (\n | t.JSXText\n | t.JSXExpressionContainer\n | t.JSXElement\n | t.JSXFragment\n | t.JSXSpreadChild\n )[],\n) => {\n return children\n .filter(c => t.isJSXText(c))\n .map(c => (c as t.JSXText).value.trim())\n .filter(v => v.length)\n .join(' ');\n};\n\nconst getTagName = (opening: t.JSXOpeningElement): string => {\n if (t.isJSXIdentifier(opening.name)) {\n return opening.name.name;\n }\n\n if (t.isJSXMemberExpression(opening.name)) {\n return resolveMemberName(opening.name);\n }\n\n return '';\n};\n\nconst resolveMemberName = (expr: t.JSXMemberExpression): string => {\n const parts: string[] = [];\n\n const collectMemberParts = (\n node: t.JSXMemberExpression['object'] | t.JSXMemberExpression['property'],\n ): void => {\n if (t.isJSXIdentifier(node)) {\n parts.push(node.name);\n } else if (t.isJSXMemberExpression(node)) {\n collectMemberParts(node.object);\n\n if (t.isJSXIdentifier(node.property)) {\n parts.push(node.property.name);\n }\n }\n };\n\n collectMemberParts(expr.object);\n\n if (t.isJSXIdentifier(expr.property)) {\n parts.push(expr.property.name);\n }\n\n return parts.join('.');\n};\n\nconst parseJSXName = (\n tagName: string,\n): t.JSXIdentifier | t.JSXMemberExpression => {\n const parts = tagName.split('.');\n\n if (parts.length === 1) {\n return t.jsxIdentifier(parts[0]!);\n }\n\n let expr: t.JSXIdentifier | t.JSXMemberExpression = t.jsxIdentifier(\n parts[0]!,\n );\n\n for (let i = 1; i < parts.length; i++) {\n expr = t.jsxMemberExpression(expr, t.jsxIdentifier(parts[i]!));\n }\n\n return expr;\n};\n\nconst extractCache = createBoundedCache<string, DataAttrNode[]>(\n CONFIG.CACHE_LIMIT,\n);\n\nconst extractAttributes = (\n attributes: (t.JSXAttribute | t.JSXSpreadAttribute)[],\n): { allAttrs: Attribute[]; dataAttrs: Attribute[] } => {\n const allAttrs: Attribute[] = [];\n const dataAttrs: Attribute[] = [];\n\n for (const attr of attributes) {\n if (!t.isJSXAttribute(attr) || !t.isJSXIdentifier(attr.name)) {\n continue;\n }\n\n const name = attr.name.name;\n let value: string | null = null;\n let isStringLiteral = false;\n\n if (attr.value) {\n if (t.isStringLiteral(attr.value)) {\n value = attr.value.value;\n isStringLiteral = true;\n } else if (t.isJSXExpressionContainer(attr.value)) {\n try {\n value = generateCode(attr.value.expression);\n isStringLiteral = false;\n } catch {\n value = null;\n }\n }\n }\n\n const entry = { name, value, isStringLiteral };\n\n allAttrs.push(entry);\n\n if (name.startsWith('data-')) {\n dataAttrs.push(entry);\n }\n }\n\n return { allAttrs, dataAttrs };\n};\n\nconst buildChildElements = (\n node: DataAttrNode,\n): (t.JSXText | t.JSXElement | t.JSXFragment)[] => {\n const childElements: (t.JSXText | t.JSXElement | t.JSXFragment)[] = [];\n\n if (node.textContent) {\n childElements.push(t.jsxText(node.textContent));\n }\n\n node.children?.forEach(child => {\n const childJSX = nodeToJSX(child);\n if (childJSX) {\n childElements.push(childJSX);\n }\n });\n\n return childElements;\n};\n\nexport const nodeToJSX = (\n node: DataAttrNode,\n): t.JSXElement | t.JSXFragment | null => {\n try {\n if (node.isFragment) {\n const childElements = buildChildElements(node);\n\n return t.jsxFragment(\n t.jsxOpeningFragment(),\n t.jsxClosingFragment(),\n childElements,\n );\n }\n\n if (\n node.tagName === 'div' &&\n node.dataAttributes.some(attr => attr.name === 'data-item')\n ) {\n if (node.children) {\n return nodeToJSX(node.children[0]!);\n }\n return null;\n }\n\n const attributes = node.attributes.map(attr => {\n const attrName = t.jsxIdentifier(attr.name);\n\n if (!attr.value) {\n return t.jsxAttribute(attrName, null);\n }\n\n return t.jsxAttribute(attrName, attrValue(attr));\n });\n\n const elementName = parseJSXName(node.tagName);\n\n const openingElement = t.jsxOpeningElement(elementName, attributes);\n\n const closingElement = t.jsxClosingElement(elementName);\n const children = buildChildElements(node);\n\n return t.jsxElement(openingElement, closingElement, children, false);\n } catch (error) {\n console.error('❌ DataAttrNode to JSX conversion error:', error);\n return null;\n }\n};\n\nconst createWrapperNode = (\n textContent: string,\n children: DataAttrNode[],\n): DataAttrNode => ({\n tagName: 'div',\n id: nanoid(6),\n attributes: [{ name: DATA_ATTR.ITEM, value: 'true' }],\n dataAttributes: [{ name: DATA_ATTR.ITEM, value: 'true' }],\n textContent,\n children,\n});\n\nconst createFragmentNode = (\n textContent: string,\n children: DataAttrNode[],\n): DataAttrNode => ({\n tagName: '',\n id: nanoid(6),\n attributes: [],\n dataAttributes: [],\n textContent,\n children,\n isFragment: true,\n});\n\nconst processChildrenBinding = (\n jsxElement: t.JSXElement,\n processedNodes?: WeakSet<t.JSXElement | t.JSXFragment>,\n shouldWrap: boolean = true,\n): DataAttrNode[] | undefined => {\n const jsxChildren = jsxElement.children.filter(\n child => t.isJSXElement(child) || t.isJSXFragment(child),\n );\n\n if (!jsxChildren.length) {\n return undefined;\n }\n\n const childrenNodes: DataAttrNode[] = [];\n\n jsxChildren.forEach(child => {\n if (t.isJSXElement(child)) {\n const childResults = extractFromNode(child, processedNodes);\n\n if (shouldWrap) {\n const wrapperNode = createWrapperNode(\n collectText(child.children),\n childResults,\n );\n childrenNodes.push(wrapperNode);\n } else {\n childrenNodes.push(...childResults);\n }\n } else if (t.isJSXFragment(child)) {\n processedNodes?.add(child);\n\n const fragmentChildren: DataAttrNode[] = [];\n\n child.children.forEach(fragmentChild => {\n if (t.isJSXElement(fragmentChild)) {\n const childResults = extractFromNode(fragmentChild, processedNodes);\n fragmentChildren.push(...childResults);\n }\n });\n\n if (fragmentChildren.length) {\n const fragmentNode = createFragmentNode(\n collectText(child.children),\n fragmentChildren,\n );\n childrenNodes.push(fragmentNode);\n }\n }\n });\n\n return childrenNodes.length ? childrenNodes : undefined;\n};\n\nconst skipItemsChildren = (\n jsxElement: t.JSXElement,\n processedNodes: WeakSet<t.JSXElement | t.JSXFragment>,\n propertyName: string = 'items',\n): void => {\n const opening = jsxElement.openingElement;\n\n const itemsAttr = opening.attributes.find(\n attr =>\n t.isJSXAttribute(attr) &&\n t.isJSXIdentifier(attr.name) &&\n attr.name.name === propertyName,\n );\n\n if (!itemsAttr || !t.isJSXAttribute(itemsAttr)) {\n return;\n }\n\n if (\n itemsAttr.value &&\n t.isJSXExpressionContainer(itemsAttr.value) &&\n t.isArrayExpression(itemsAttr.value.expression)\n ) {\n const arrayExpr = itemsAttr.value.expression;\n\n arrayExpr.elements.forEach(element => {\n if (t.isObjectExpression(element)) {\n element.properties.forEach(prop => {\n if (\n t.isObjectProperty(prop) &&\n t.isIdentifier(prop.key) &&\n t.isJSXElement(prop.value)\n ) {\n markProcessedJSX(prop.value, processedNodes);\n }\n });\n }\n });\n }\n};\n\nconst markProcessedJSX = (\n node: t.Node,\n processedNodes: WeakSet<t.JSXElement | t.JSXFragment>,\n): void => {\n if (t.isJSXElement(node) || t.isJSXFragment(node)) {\n processedNodes.add(node as t.JSXElement | t.JSXFragment);\n node.children.forEach(child => markProcessedJSX(child, processedNodes));\n return;\n }\n\n const expression =\n t.isJSXExpressionContainer(node) || t.isParenthesizedExpression(node);\n\n if (expression) {\n markProcessedJSX(node.expression, processedNodes);\n }\n};\n\ninterface NodeBindingInfo {\n tagName: string;\n allAttrs: Attribute[];\n dataAttrs: Attribute[];\n bindings: BindingItem[];\n childrenBinding: BindingItem | undefined;\n arrayBindings: BindingItem[];\n rawChildren: string | undefined;\n}\n\n// Shared prefix for the top-level traverse() visitor below and the manual\n// recursive descent in extractFromNode: read the tag name, attributes, and\n// parsed bindings off one JSXElement. What differs between the two callers\n// is how childrenNodes gets computed and whether the result is pushed at\n// all — traverse() only records elements with data-* attributes, while\n// extractFromNode always records the children it's asked to (see each call\n// site for details).\nconst readNodeBindingInfo = (node: t.JSXElement): NodeBindingInfo => {\n const opening = node.openingElement;\n const tagName = getTagName(opening);\n const { allAttrs, dataAttrs } = extractAttributes(opening.attributes);\n\n const bindingAttr = dataAttrs.find(attr => attr.name === DATA_ATTR.BINDING);\n const bindings = bindingAttr?.value ? parseBinding(bindingAttr.value) : [];\n\n const childrenBinding = bindings.find(\n b => b.property === BINDING_PROP.CHILDREN,\n );\n const arrayBindings = bindings.filter(\n b => b.property === BINDING_PROP.ITEMS || b.type === 'array',\n );\n\n const innerHtmlBinding = bindings.find(\n b => b.property === BINDING_PROP.INNER_HTML,\n );\n\n let rawChildren: string | undefined;\n if (innerHtmlBinding && node.children.length > 0) {\n rawChildren = node.children\n .map(child => generateCode(child))\n .join('')\n .trim();\n }\n\n return {\n tagName,\n allAttrs,\n dataAttrs,\n bindings,\n childrenBinding,\n arrayBindings,\n rawChildren,\n };\n};\n\nconst parseToNodes = (raw: string): DataAttrNode[] => {\n const wrapped = wrap(raw);\n const ast = parse(wrapped, {\n sourceType: 'module',\n plugins: ['jsx', 'typescript'],\n errorRecovery: true,\n });\n\n const results: DataAttrNode[] = [];\n\n // babel's traverse() below visits every JSXElement in the tree, top to\n // bottom, regardless of structure. But some elements are meant to be\n // recorded as *structural* children of another result — e.g. a node\n // wrapped by processChildrenBinding()/extractFromNode() into a parent's\n // `children` array, or an element sitting inside an `items` binding's\n // array literal (skipped via skipItemsChildren()/markProcessedJSX()) —\n // not as their own top-level entry in `results`. Without this WeakSet,\n // traverse() would independently re-visit those same elements once it\n // reaches them in the tree and add a second, duplicate entry for them.\n // Each helper below adds a node here the moment it pulls that node out\n // of the normal top-level flow, and the JSXElement() visitor skips\n // anything already marked.\n const processedNodes = new WeakSet<t.JSXElement | t.JSXFragment>();\n\n traverse(ast, {\n JSXElement(path) {\n if (processedNodes.has(path.node)) {\n return;\n }\n\n const {\n tagName,\n allAttrs,\n dataAttrs,\n bindings,\n childrenBinding,\n arrayBindings,\n rawChildren,\n } = readNodeBindingInfo(path.node);\n\n if (!tagName || !dataAttrs.length) {\n return;\n }\n\n let childrenNodes: DataAttrNode[] | undefined;\n\n if (childrenBinding) {\n childrenNodes = processChildrenBinding(path.node, processedNodes);\n }\n\n for (const arrayBinding of arrayBindings) {\n skipItemsChildren(path.node, processedNodes, arrayBinding.property);\n }\n\n results.push({\n tagName,\n attributes: allAttrs,\n dataAttributes: dataAttrs,\n textContent: collectText(path.node.children),\n rawChildren,\n children: childrenNodes,\n bindings,\n loc: path.node.loc\n ? {\n start: {\n line: path.node.loc.start.line,\n column: path.node.loc.start.column,\n },\n end: {\n line: path.node.loc.end.line,\n column: path.node.loc.end.column,\n },\n }\n : undefined,\n });\n },\n });\n\n return results;\n};\n\nexport function extract(raw: string): DataAttrNode[] {\n if (extractCache.has(raw)) {\n return extractCache.get(raw)!;\n }\n\n const results = parseToNodes(raw);\n\n extractCache.set(raw, results);\n\n return results;\n}\n\nfunction extractFromNode(\n node: t.JSXElement,\n processedNodes?: WeakSet<t.JSXElement | t.JSXFragment>,\n): DataAttrNode[] {\n processedNodes?.add(node);\n\n const {\n tagName,\n allAttrs,\n dataAttrs,\n bindings,\n childrenBinding,\n rawChildren,\n } = readNodeBindingInfo(node);\n\n let childrenNodes: DataAttrNode[] | undefined;\n\n if (childrenBinding) {\n childrenNodes = processChildrenBinding(node, processedNodes);\n }\n\n if (!childrenNodes) {\n childrenNodes = processChildrenBinding(node, processedNodes, false);\n }\n\n return [\n {\n tagName,\n attributes: allAttrs,\n dataAttributes: dataAttrs,\n textContent: collectText(node.children),\n rawChildren,\n children: childrenNodes,\n bindings,\n },\n ];\n}\n\nexport function clearExtractCache() {\n extractCache.clear();\n}\n","import { parse } from '@babel/parser';\nimport type { NodePath } from '@babel/traverse';\nimport * as t from '@babel/types';\nimport { nanoid } from 'nanoid';\n\nimport { BINDING_PROP, DATA_ATTR, REGEX } from '../../constants';\nimport { parseBinding } from './binding';\nimport { traverse } from './document';\nimport { nodeToJSX } from './extract';\nimport { attrValue, generateCode, unwrap, wrap } from './helpers';\nimport type { DataAttrNode } from './types';\n\nconst updateInnerText = (\n path: NodePath<t.JSXElement>,\n value: string,\n): boolean => {\n const jsxChildren = path.node.children;\n\n for (let i = jsxChildren.length - 1; i >= 0; i--) {\n if (t.isJSXText(jsxChildren[i])) {\n jsxChildren.splice(i, 1);\n }\n }\n\n jsxChildren.push(t.jsxText(value));\n return true;\n};\n\n// Injects a `{__PREFIX_<id>__}` JSX expression container as a placeholder,\n// then records how the placeholder's *generated source text* should be\n// string-replaced with the real value once generateCode() has run — used\n// for values (raw HTML, arbitrary JSX/expressions) that can't be\n// represented as AST literals, so we can't just build the real node here.\n//\n// `asRawContent: true` replaces the placeholder *including* its enclosing\n// braces, so the raw value lands as literal children content instead of a\n// JS expression (used for innerHTML). Leaving it false replaces only the\n// identifier inside the braces, so the value is inserted as the expression\n// itself (used for a `type: 'jsx'` attribute value).\nconst injectPlaceholder = (\n prefix: string,\n value: string,\n placeholders: Map<string, string>,\n { asRawContent = false }: { asRawContent?: boolean } = {},\n): t.JSXExpressionContainer => {\n const name = `__${prefix}_${nanoid(6)}__`;\n const container = t.jsxExpressionContainer(t.identifier(name));\n\n placeholders.set(asRawContent ? `{${name}}` : name, value);\n\n return container;\n};\n\nconst updateInnerHTML = (\n path: NodePath<t.JSXElement>,\n value: string,\n placeholders: Map<string, string>,\n): boolean => {\n path.node.children = [\n injectPlaceholder('HTML', value, placeholders, { asRawContent: true }),\n ];\n\n return true;\n};\n\nconst updateChildren = (\n path: NodePath<t.JSXElement>,\n value: string,\n): boolean => {\n try {\n const childrenData = JSON.parse(value) as DataAttrNode[];\n\n path.node.children.length = 0;\n\n childrenData.forEach(childData => {\n const jsxElement = nodeToJSX(childData);\n if (jsxElement) {\n path.node.children.push(jsxElement);\n }\n });\n\n return true;\n } catch (error) {\n console.error('❌ Children update error:', error);\n return false;\n }\n};\n\nconst updateRichtext = (\n path: NodePath<t.JSXElement>,\n value: string,\n): boolean => {\n path.node.children = [];\n\n const opening = path.node.openingElement;\n const htmlObject = t.objectExpression([\n t.objectProperty(t.identifier('__html'), t.stringLiteral(value)),\n ]);\n\n const existingAttr = opening.attributes.find(\n a =>\n t.isJSXAttribute(a) &&\n t.isJSXIdentifier(a.name) &&\n a.name.name === 'dangerouslySetInnerHTML',\n );\n\n if (existingAttr && t.isJSXAttribute(existingAttr)) {\n existingAttr.value = t.jsxExpressionContainer(htmlObject);\n } else {\n opening.attributes.push(\n t.jsxAttribute(\n t.jsxIdentifier('dangerouslySetInnerHTML'),\n t.jsxExpressionContainer(htmlObject),\n ),\n );\n }\n\n return true;\n};\n\nconst updateAttribute = (\n opening: t.JSXOpeningElement,\n propertyName: string,\n value: string,\n): boolean => {\n const customAttr = opening.attributes.find(\n attr =>\n t.isJSXAttribute(attr) &&\n t.isJSXIdentifier(attr.name) &&\n attr.name.name === propertyName,\n );\n\n if (customAttr && t.isJSXAttribute(customAttr)) {\n const trimmed = value.trim();\n const isExpression =\n trimmed.startsWith('[') ||\n trimmed.startsWith('{') ||\n REGEX.NUMBER.test(trimmed) ||\n REGEX.BOOLEAN_OR_NULL.test(trimmed);\n\n customAttr.value = attrValue({\n name: propertyName,\n value,\n isStringLiteral: !isExpression,\n });\n\n return true;\n }\n\n return false;\n};\n\nexport interface UpdateResult {\n code: string;\n success: boolean;\n}\n\n// `label` is a display string — reworded, duplicated, or translated at\n// authors' whim — so it identifies a binding only as a fallback. `property`\n// (an actual key, unique per element) is the real identity; pass it\n// whenever the caller has it (every internal caller does, via\n// PanelBinding.property). See #240: two bindings sharing a label used to\n// resolve to whichever `.find()` hit first, silently dropping the other's\n// edit while still reporting success.\nexport const update = (\n code: string,\n dataId: string,\n label: string,\n value: string,\n property?: string,\n): UpdateResult => {\n try {\n const wrapped = wrap(code);\n const ast = parse(wrapped, {\n sourceType: 'module',\n plugins: ['jsx', 'typescript'],\n });\n\n let changed = false;\n const jsxPlaceholders = new Map<string, string>();\n\n traverse(ast, {\n JSXElement(path) {\n const opening = path.node.openingElement;\n\n const idAttr = opening.attributes.find(attr => {\n return (\n t.isJSXAttribute(attr) &&\n t.isJSXIdentifier(attr.name) &&\n attr.name.name === DATA_ATTR.ID &&\n attr.value &&\n t.isStringLiteral(attr.value) &&\n attr.value.value === dataId\n );\n });\n\n if (!idAttr) {\n return;\n }\n\n const bindingAttr = opening.attributes.find(\n (attr): attr is t.JSXAttribute =>\n t.isJSXAttribute(attr) &&\n t.isJSXIdentifier(attr.name) &&\n attr.name.name === DATA_ATTR.BINDING,\n );\n\n if (!bindingAttr?.value) {\n return;\n }\n\n let bindingValue = '';\n\n if (t.isStringLiteral(bindingAttr.value)) {\n bindingValue = bindingAttr.value.value;\n } else if (t.isJSXExpressionContainer(bindingAttr.value)) {\n try {\n bindingValue = generateCode(bindingAttr.value.expression);\n } catch {\n return;\n }\n }\n\n const bindings = parseBinding(bindingValue);\n\n // Prefer `property` (an actual key) over `label` (a display\n // string) — see the module-level comment on `update`. Either way,\n // more than one match on this element is an authoring ambiguity\n // (duplicate labels, or a genuine property collision), not a case\n // to silently resolve by picking the first — see #240.\n const matches = bindings.filter(binding =>\n property !== undefined\n ? binding.property === property\n : binding.label === label,\n );\n\n if (matches.length !== 1) {\n return;\n }\n\n const propertyBinding = matches[0]!;\n\n switch (propertyBinding.property) {\n case BINDING_PROP.INNER_TEXT: {\n changed = updateInnerText(path, value);\n break;\n }\n\n case BINDING_PROP.INNER_HTML: {\n if (propertyBinding.type === 'richtext') {\n changed = updateRichtext(path, value);\n } else {\n changed = updateInnerHTML(path, value, jsxPlaceholders);\n }\n break;\n }\n\n case BINDING_PROP.CHILDREN: {\n changed = updateChildren(path, value);\n break;\n }\n\n default: {\n if (propertyBinding.type === 'jsx') {\n const attr = opening.attributes.find(\n a =>\n t.isJSXAttribute(a) &&\n t.isJSXIdentifier(a.name) &&\n a.name.name === propertyBinding.property,\n );\n\n if (attr && t.isJSXAttribute(attr)) {\n attr.value = injectPlaceholder(\n 'JSX',\n value.trim(),\n jsxPlaceholders,\n );\n changed = true;\n }\n } else {\n changed = updateAttribute(\n opening,\n propertyBinding.property,\n value,\n );\n }\n\n break;\n }\n }\n },\n });\n\n if (!changed) {\n return { code, success: false };\n }\n\n let result = unwrap(generateCode(ast));\n\n for (const [placeholder, original] of jsxPlaceholders) {\n // 두 번째 인자가 문자열이면 $&, $$ 같은 특수 치환 패턴으로 해석되어\n // original 안에 그런 문자가 있으면 결과가 깨진다 — 함수형 치환자로 방지.\n result = result.replace(placeholder, () => original);\n }\n\n return { code: result, success: true };\n } catch (error) {\n console.error('❌ Code update error:', error);\n return { code, success: false };\n }\n};\n\nexport const bulkUpdate = (\n raw: string,\n entries: {\n dataId: string;\n label: string;\n value: string;\n property?: string;\n }[],\n): UpdateResult => {\n let current = raw;\n let allSucceeded = true;\n\n for (const entry of entries) {\n const result = update(\n current,\n entry.dataId,\n entry.label,\n entry.value,\n entry.property,\n );\n current = result.code;\n allSucceeded = allSucceeded && result.success;\n }\n\n return { code: current, success: allSucceeded };\n};\n","import { parseExpression } from '@babel/parser';\nimport * as t from '@babel/types';\nimport { nanoid } from 'nanoid';\n\nimport { DATA_ATTR } from '../../constants';\nimport { generateCode } from './helpers';\n\nexport const replaceIds = (\n code: string,\n generateId: () => string = () => nanoid(6),\n): string => {\n return code.replace(new RegExp(`${DATA_ATTR.ID}=\"[^\"]*\"`, 'g'), () => {\n return `${DATA_ATTR.ID}=\"${generateId()}\"`;\n });\n};\n\nexport const fillIds = (\n code: string,\n generateId: () => string = () => nanoid(6),\n): string => {\n return code.replace(new RegExp(`${DATA_ATTR.ID}=\"\"`, 'g'), () => {\n return `${DATA_ATTR.ID}=\"${generateId()}\"`;\n });\n};\n\nexport const clone = (\n element: t.Node,\n generateId: () => string = () => nanoid(6),\n) => {\n const cloned = t.cloneNode(element, true);\n const generatedCode = generateCode(cloned);\n const code = replaceIds(generatedCode, generateId);\n\n return parseExpression(code, {\n plugins: ['jsx', 'typescript'],\n });\n};\n","import type { BindingItem } from './types';\n\nexport interface ValidationResult {\n valid: boolean;\n message?: string;\n}\n\nconst VALID: ValidationResult = { valid: true };\n\nexport const validateBindingValue = (\n binding: BindingItem,\n value: unknown,\n): ValidationResult => {\n const isEmpty = value === '' || value === null || value === undefined;\n\n if (isEmpty) {\n if (binding.required) {\n return { valid: false, message: 'This field is required.' };\n }\n return VALID;\n }\n\n // `PanelBinding.value` (the value a custom renderPanel gets) is always a\n // string, even for `type: 'number'` bindings — coerce a numeric string\n // the same way the built-in field does today (see field.tsx's ad-hoc\n // `Number(next)`), so min/max apply to both callers instead of silently\n // no-op'ing on the string form. A non-numeric string (`NaN`) or\n // whitespace-only string is left alone; `isEmpty` above already handles\n // the plain empty-string case.\n const numericValue =\n typeof value === 'number'\n ? value\n : typeof value === 'string' &&\n value.trim() !== '' &&\n !Number.isNaN(Number(value))\n ? Number(value)\n : undefined;\n\n if (numericValue !== undefined) {\n if (binding.min !== undefined && numericValue < binding.min) {\n return { valid: false, message: `Must be at least ${binding.min}.` };\n }\n if (binding.max !== undefined && numericValue > binding.max) {\n return { valid: false, message: `Must be at most ${binding.max}.` };\n }\n }\n\n if (typeof value === 'string' && binding.pattern) {\n let regex: RegExp;\n\n try {\n regex = new RegExp(binding.pattern);\n } catch {\n // Malformed pattern authored on the binding itself — don't block the\n // user's input for an authoring mistake that isn't theirs to fix.\n return VALID;\n }\n\n if (!regex.test(value)) {\n return {\n valid: false,\n message: 'Value does not match the required format.',\n };\n }\n }\n\n if (typeof value === 'string' && binding.type === 'url') {\n try {\n new URL(value);\n } catch {\n return { valid: false, message: 'Must be a valid URL.' };\n }\n }\n\n if (typeof value === 'string' && binding.type === 'date') {\n if (Number.isNaN(Date.parse(value))) {\n return { valid: false, message: 'Must be a valid date.' };\n }\n }\n\n return VALID;\n};\n"],"mappings":";;;;;AAmCA,MAAa,gBAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;ACjCA,MAAM,WACJ,OAAOA,WAAAA,YAAc,aACjBA,WAAAA,UACCA,WAAAA,QAAuD;AAE9D,MAAa,QAAQ,SAAiB;CACpC,OAAO,KAAK,KAAK;AACnB;AAEA,MAAa,UAAU,cAAsB;CAC3C,OAAO,UACJ,QAAQ,WAAW,EAAE,CAAC,CACtB,QAAQ,qBAAqB,EAAE,CAAC,CAChC,KAAK;AACV;AAEA,MAAa,aAAa,EACxB,OACA,sBACwC;CACxC,IAAI,UAAU,MACZ,OAAO;CAGT,IAAI,iBACF,OAAOC,aAAE,cAAc,KAAK;CAG9B,MAAM,UAAU,MAAM,KAAK;CAE3B,IAAI,MAAM,OAAO,KAAK,OAAO,GAC3B,OAAOA,aAAE,uBAAuBA,aAAE,eAAe,WAAW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AM,MACjB,CAAC,OAAO,MAAM,OAAO,KAAK,CAAC,IAC3B,OAAO,KAAK,IACZ,KAAA;CAER,IAAI,iBAAiB,KAAA,GAAW;EAC9B,IAAI,QAAQ,QAAQ,KAAA,KAAa,eAAe,QAAQ,KACtD,OAAO;GAAE,OAAO;GAAO,SAAS,oBAAoB,QAAQ,IAAI;EAAG;EAErE,IAAI,QAAQ,QAAQ,KAAA,KAAa,eAAe,QAAQ,KACtD,OAAO;GAAE,OAAO;GAAO,SAAS,mBAAmB,QAAQ,IAAI;EAAG;CAEtE;CAEA,IAAI,OAAO,UAAU,YAAY,QAAQ,SAAS;EAChD,IAAI;EAEJ,IAAI;GACF,QAAQ,IAAI,OAAO,QAAQ,OAAO;EACpC,QAAQ;GAGN,OAAO;EACT;EAEA,IAAI,CAAC,MAAM,KAAK,KAAK,GACnB,OAAO;GACL,OAAO;GACP,SAAS;EACX;CAEJ;CAEA,IAAI,OAAO,UAAU,YAAY,QAAQ,SAAS,OAChD,IAAI;EACF,IAAI,IAAI,KAAK;CACf,QAAQ;EACN,OAAO;GAAE,OAAO;GAAO,SAAS;EAAuB;CACzD;CAGF,IAAI,OAAO,UAAU,YAAY,QAAQ,SAAS,QAC5C;MAAA,OAAO,MAAM,KAAK,MAAM,KAAK,CAAC,GAChC,OAAO;GAAE,OAAO;GAAO,SAAS;EAAwB;CAAA;CAI5D,OAAO;AACT"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as cn } from "./utils-
|
|
1
|
+
import { r as cn } from "./utils-CXq1KaM3.js";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/error/error.tsx
|
|
@@ -89,4 +89,4 @@ var ErrorBoundary = class extends React.Component {
|
|
|
89
89
|
//#endregion
|
|
90
90
|
export { Error as n, ErrorBoundary as t };
|
|
91
91
|
|
|
92
|
-
//# sourceMappingURL=boundary-
|
|
92
|
+
//# sourceMappingURL=boundary-b-U70XU_.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundary-
|
|
1
|
+
{"version":3,"file":"boundary-b-U70XU_.js","names":[],"sources":["../src/components/error/error.tsx","../src/components/error/boundary.tsx"],"sourcesContent":["import { cn } from '~/utils';\n\nexport interface Props extends React.ComponentPropsWithRef<'div'> {\n message?: string | null;\n title?: string;\n onReset?: () => void;\n}\n\nconst Error = ({\n message,\n title = 'An error occurred',\n className,\n onReset,\n}: Props) => {\n if (!message) {\n return null;\n }\n\n return (\n <div\n className={cn(className)}\n style={{\n padding: '16px',\n backgroundColor: '#fee2e2',\n border: '1px solid #fca5a5',\n borderRadius: '6px',\n color: '#7f1d1d',\n }}\n >\n <h3 style={{ fontSize: '14px', fontWeight: 'bold', margin: 0 }}>\n {title}\n </h3>\n <pre\n style={{\n marginTop: '8px',\n fontSize: '12px',\n whiteSpace: 'pre-wrap',\n margin: '8px 0 0 0',\n }}\n >\n {message}\n </pre>\n {onReset && (\n <button\n style={{\n marginTop: '8px',\n padding: '4px 12px',\n fontSize: '12px',\n color: 'white',\n backgroundColor: '#dc2626',\n border: 'none',\n borderRadius: '4px',\n cursor: 'pointer',\n }}\n onClick={onReset}\n >\n Try Again\n </button>\n )}\n </div>\n );\n};\n\nexport default Error;\n","import React from 'react';\n\nimport Error from './error';\n\ninterface Props {\n children: React.ReactNode;\n fallback?: (message?: string) => React.ReactNode;\n onError?: (e: Error, info: React.ErrorInfo) => void;\n // Values whose identity changing (typically the code/module that produced\n // `children`) should auto-recover a caught error without needing a\n // remount — compared shallowly, one entry at a time, same idea as\n // react-error-boundary's resetKeys. Without this, once tripped, render()\n // never even attempts `children` again (see below), so a fix to the\n // underlying code has no way to reach the screen until this array changes\n // or something remounts the boundary via `key`.\n resetKeys?: readonly unknown[];\n}\n\ninterface State {\n hasError: boolean;\n error?: Error;\n}\n\nclass ErrorBoundary extends React.Component<Props, State> {\n constructor(props: Props) {\n super(props);\n this.state = { hasError: false };\n }\n\n static getDerivedStateFromError(error: Error): State {\n return { hasError: true, error };\n }\n\n componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {\n console.error('🚨 [Boundary] Rendering error:', error, errorInfo);\n this.props.onError?.(error, errorInfo);\n }\n\n // Safe to reset unconditionally here (no race with a freshly-thrown\n // error): while hasError is true, render() below never attempts\n // `children` at all, so resetting just schedules a follow-up render where\n // `children` gets its first real chance to run with the new resetKeys —\n // if that throws too, getDerivedStateFromError catches it fresh in that\n // later, separate commit.\n componentDidUpdate(prevProps: Props) {\n if (!this.state.hasError) {\n return;\n }\n\n const prevKeys = prevProps.resetKeys ?? [];\n const nextKeys = this.props.resetKeys ?? [];\n const changed =\n prevKeys.length !== nextKeys.length ||\n nextKeys.some((key, i) => key !== prevKeys[i]);\n\n if (changed) {\n this.setState({ hasError: false, error: undefined });\n }\n }\n\n render() {\n if (this.state.hasError) {\n return this.props.fallback ? (\n <>{this.props.fallback(this.state.error?.message)}</>\n ) : (\n <Error\n message={this.state.error?.message}\n onReset={() => this.setState({ hasError: false, error: undefined })}\n title=\"Rendering Error\"\n />\n );\n }\n\n return this.props.children;\n }\n}\n\nexport default ErrorBoundary;\n"],"mappings":";;;;AAQA,MAAM,SAAS,EACb,SACA,QAAQ,qBACR,WACA,cACW;CACX,IAAI,CAAC,SACH,OAAO;CAGT,OACE,qBAAC,OAAD;EACE,WAAW,GAAG,SAAS;EACvB,OAAO;GACL,SAAS;GACT,iBAAiB;GACjB,QAAQ;GACR,cAAc;GACd,OAAO;EACT;EARF,UAAA;GAUE,oBAAC,MAAD;IAAI,OAAO;KAAE,UAAU;KAAQ,YAAY;KAAQ,QAAQ;IAAE;IAC1D,UAAA;GACC,CAAA;GACJ,oBAAC,OAAD;IACE,OAAO;KACL,WAAW;KACX,UAAU;KACV,YAAY;KACZ,QAAQ;IACV;IAEC,UAAA;GACE,CAAA;GACJ,WACC,oBAAC,UAAD;IACE,OAAO;KACL,WAAW;KACX,SAAS;KACT,UAAU;KACV,OAAO;KACP,iBAAiB;KACjB,QAAQ;KACR,cAAc;KACd,QAAQ;IACV;IACA,SAAS;IACV,UAAA;GAEO,CAAA;EAEP;;AAET;;;ACtCA,IAAM,gBAAN,cAA4B,MAAM,UAAwB;CACxD,YAAY,OAAc;EACxB,MAAM,KAAK;EACX,KAAK,QAAQ,EAAE,UAAU,MAAM;CACjC;CAEA,OAAO,yBAAyB,OAAqB;EACnD,OAAO;GAAE,UAAU;GAAM;EAAM;CACjC;CAEA,kBAAkB,OAAc,WAA4B;EAC1D,QAAQ,MAAM,kCAAkC,OAAO,SAAS;EAChE,KAAK,MAAM,UAAU,OAAO,SAAS;CACvC;CAQA,mBAAmB,WAAkB;EACnC,IAAI,CAAC,KAAK,MAAM,UACd;EAGF,MAAM,WAAW,UAAU,aAAa,CAAC;EACzC,MAAM,WAAW,KAAK,MAAM,aAAa,CAAC;EAK1C,IAHE,SAAS,WAAW,SAAS,UAC7B,SAAS,MAAM,KAAK,MAAM,QAAQ,SAAS,EAAE,GAG7C,KAAK,SAAS;GAAE,UAAU;GAAO,OAAO,KAAA;EAAU,CAAC;CAEvD;CAEA,SAAS;EACP,IAAI,KAAK,MAAM,UACb,OAAO,KAAK,MAAM,WAChB,oBAAA,UAAA,EAAA,UAAG,KAAK,MAAM,SAAS,KAAK,MAAM,OAAO,OAAO,EAAI,CAAA,IAEpD,oBAAC,OAAD;GACE,SAAS,KAAK,MAAM,OAAO;GAC3B,eAAe,KAAK,SAAS;IAAE,UAAU;IAAO,OAAO,KAAA;GAAU,CAAC;GAClE,OAAM;EACP,CAAA;EAIL,OAAO,KAAK,MAAM;CACpB;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { y as DEFAULT_TEMPLATE } from "./document-
|
|
2
|
-
import { n as clearCompilationCache } from "./utils-
|
|
1
|
+
import { y as DEFAULT_TEMPLATE } from "./document-DEx4WyCn.js";
|
|
2
|
+
import { n as clearCompilationCache } from "./utils-CXq1KaM3.js";
|
|
3
3
|
import { n as PreviewContext, t as ErrorContext } from "./states-Ci1AvoQ9.js";
|
|
4
4
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -35,4 +35,4 @@ const ContextProvider = ({ children }) => {
|
|
|
35
35
|
//#endregion
|
|
36
36
|
export { ContextProvider as t };
|
|
37
37
|
|
|
38
|
-
//# sourceMappingURL=context-
|
|
38
|
+
//# sourceMappingURL=context-Yb81ZxnN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-
|
|
1
|
+
{"version":3,"file":"context-Yb81ZxnN.js","names":[],"sources":["../src/components/context/context.tsx"],"sourcesContent":["'use client';\n\nimport React, { useCallback, useEffect, useMemo, useState } from 'react';\n\nimport { DEFAULT_TEMPLATE } from '~/constants';\nimport { clearCompilationCache } from '~/utils';\n\nimport type { ErrorContextType, PreviewContextType } from './states';\nimport { ErrorContext, PreviewContext } from './states';\n\nconst ContextProvider = ({ children }: { children?: React.ReactNode }) => {\n const [code, setCodeState] = useState(DEFAULT_TEMPLATE);\n const [error, setError] = useState<ErrorContextType['error']>(null);\n\n // Clears any stale runtime/compile error in the same update batch that\n // changes `code`, rather than in a separate useEffect — a useEffect here\n // would race with componentDidCatch/Guard's onError firing for the *new*\n // code's own errors within the same commit (layout effects run before\n // passive effects, so a passive-effect reset could wipe out an error the\n // new code just threw). Batching setError(null) into the same update as\n // setCode guarantees stale errors are gone by the time the new code even\n // renders, with nothing left afterward that could clobber a fresh one.\n const setCode = useCallback<PreviewContextType['setCode']>(next => {\n setError(null);\n setCodeState(next);\n }, []);\n\n useEffect(() => {\n return () => {\n clearCompilationCache();\n };\n }, []);\n\n // Without this, a new object identity on every ContextProvider render\n // (even ones that don't touch code/error at all, e.g. a parent\n // re-rendering) meant every usePreview()/useError() consumer re-rendered\n // too, regardless of whether the values they care about actually changed.\n const previewValue = useMemo<PreviewContextType>(\n () => ({ code, setCode }),\n [code, setCode],\n );\n\n const errorValue = useMemo<ErrorContextType>(\n () => ({ error, setError }),\n [error, setError],\n );\n\n return (\n <PreviewContext.Provider value={previewValue}>\n <ErrorContext.Provider value={errorValue}>\n {children}\n </ErrorContext.Provider>\n </PreviewContext.Provider>\n );\n};\n\nexport default ContextProvider;\n"],"mappings":";;;;;;AAUA,MAAM,mBAAmB,EAAE,eAA+C;CACxE,MAAM,CAAC,MAAM,gBAAgB,SAAS,gBAAgB;CACtD,MAAM,CAAC,OAAO,YAAY,SAAoC,IAAI;CAUlE,MAAM,UAAU,aAA2C,SAAQ;EACjE,SAAS,IAAI;EACb,aAAa,IAAI;CACnB,GAAG,CAAC,CAAC;CAEL,gBAAgB;EACd,aAAa;GACX,sBAAsB;EACxB;CACF,GAAG,CAAC,CAAC;CAML,MAAM,eAAe,eACZ;EAAE;EAAM;CAAQ,IACvB,CAAC,MAAM,OAAO,CAChB;CAEA,MAAM,aAAa,eACV;EAAE;EAAO;CAAS,IACzB,CAAC,OAAO,QAAQ,CAClB;CAEA,OACE,oBAAC,eAAe,UAAhB;EAAyB,OAAO;EAC9B,UAAA,oBAAC,aAAa,UAAd;GAAuB,OAAO;GAC3B;EACoB,CAAA;CACA,CAAA;AAE7B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as detectTypeScript, r as cn } from "./utils-
|
|
1
|
+
import { a as detectTypeScript, r as cn } from "./utils-CXq1KaM3.js";
|
|
2
2
|
import { useCallback, useMemo, useRef } from "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { javascript } from "@codemirror/lang-javascript";
|
|
@@ -11192,4 +11192,4 @@ const Core = ({ value, theme, height, className, prettierOptions, fragment, raw,
|
|
|
11192
11192
|
//#endregion
|
|
11193
11193
|
export { useFormatCode as n, Core as t };
|
|
11194
11194
|
|
|
11195
|
-
//# sourceMappingURL=core-
|
|
11195
|
+
//# sourceMappingURL=core-mdFWxqB2.js.map
|