@jbpark/live-editor 1.16.2 → 1.16.4
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-DK9INzeu.js → ast-B8j1_KHl.js} +3 -13
- package/dist/ast-B8j1_KHl.js.map +1 -0
- package/dist/{boundary-BWBdNmNi.js → boundary-D4D9lTGj.js} +2 -2
- package/dist/{boundary-BWBdNmNi.js.map → boundary-D4D9lTGj.js.map} +1 -1
- package/dist/{context-DrqO0VVu.js → context-Dp9_x2pr.js} +3 -3
- package/dist/{context-DrqO0VVu.js.map → context-Dp9_x2pr.js.map} +1 -1
- package/dist/{core-B7igZRDs.js → core-J-1gMmiH.js} +2 -2
- package/dist/{core-B7igZRDs.js.map → core-J-1gMmiH.js.map} +1 -1
- package/dist/dnd/index.d.ts +1 -1
- package/dist/dnd/index.js +1 -1
- package/dist/{dnd-CQDivnZZ.js → dnd-BLt8M5Ku.js} +103 -111
- package/dist/dnd-BLt8M5Ku.js.map +1 -0
- package/dist/{document-CSIscFpL.js → document-B5jioCvf.js} +43 -5
- package/dist/document-B5jioCvf.js.map +1 -0
- package/dist/{document-DXOwpvWM.d.ts → document-J9Lo9p81.d.ts} +3 -2
- package/dist/editor/index.js +2 -2
- package/dist/{editor-DmgTeTcG.js → editor-BquxydTJ.js} +3 -3
- package/dist/{editor-DmgTeTcG.js.map → editor-BquxydTJ.js.map} +1 -1
- package/dist/error/index.js +2 -2
- package/dist/{error-ClMPS96R.js → error-qjC08--G.js} +2 -2
- package/dist/{error-ClMPS96R.js.map → error-qjC08--G.js.map} +1 -1
- package/dist/{index-CfuDi3An.d.ts → index-C880EB6c.d.ts} +3 -3
- package/dist/{index-rlgLRNsK.d.ts → index-DB_TAhtd.d.ts} +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/preview/index.js +1 -1
- package/dist/{preview-j-rIHbDN.js → preview-DS80nl6F.js} +4 -4
- package/dist/{preview-j-rIHbDN.js.map → preview-DS80nl6F.js.map} +1 -1
- package/dist/provider/index.js +1 -1
- package/dist/{use-dynamic-tailwind-D-EEKBIy.js → use-dynamic-tailwind-Biw9EHLI.js} +2 -2
- package/dist/{use-dynamic-tailwind-D-EEKBIy.js.map → use-dynamic-tailwind-Biw9EHLI.js.map} +1 -1
- package/dist/utils/ast/index.d.ts +3 -3
- package/dist/utils/ast/index.js +3 -3
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +2 -2
- package/dist/{utils-BzfDKU6y.js → utils-DPdkZJ4i.js} +2 -2
- package/dist/{utils-BzfDKU6y.js.map → utils-DPdkZJ4i.js.map} +1 -1
- package/package.json +1 -1
- package/dist/ast-DK9INzeu.js.map +0 -1
- package/dist/dnd-CQDivnZZ.js.map +0 -1
- package/dist/document-CSIscFpL.js.map +0 -1
|
@@ -39714,10 +39714,20 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
39714
39714
|
traverse.cache = cache;
|
|
39715
39715
|
}));
|
|
39716
39716
|
//#endregion
|
|
39717
|
-
//#region
|
|
39717
|
+
//#region node_modules/.pnpm/nanoid@3.3.18/node_modules/nanoid/index.browser.js
|
|
39718
39718
|
var import_lib = require_lib$7();
|
|
39719
39719
|
var import_lib$2 = /* @__PURE__ */ __toESM(require_lib$4(), 1);
|
|
39720
39720
|
var import_lib$1 = /* @__PURE__ */ __toESM(require_lib(), 1);
|
|
39721
|
+
let nanoid = (size = 21) => crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {
|
|
39722
|
+
byte &= 63;
|
|
39723
|
+
if (byte < 36) id += byte.toString(36);
|
|
39724
|
+
else if (byte < 62) id += (byte - 26).toString(36).toUpperCase();
|
|
39725
|
+
else if (byte > 62) id += "-";
|
|
39726
|
+
else id += "_";
|
|
39727
|
+
return id;
|
|
39728
|
+
}, "");
|
|
39729
|
+
//#endregion
|
|
39730
|
+
//#region src/utils/cache.ts
|
|
39721
39731
|
const createBoundedCache = (limit, onEvict) => {
|
|
39722
39732
|
const store = /* @__PURE__ */ new Map();
|
|
39723
39733
|
const get = (key) => {
|
|
@@ -39774,8 +39784,9 @@ const getTagName = (element) => {
|
|
|
39774
39784
|
const name = element.openingElement.name;
|
|
39775
39785
|
return import_lib$2.isJSXIdentifier(name) ? name.name : "";
|
|
39776
39786
|
};
|
|
39787
|
+
const getAttr = (element, attrName) => element.openingElement.attributes.find((a) => import_lib$2.isJSXAttribute(a) && import_lib$2.isJSXIdentifier(a.name) && a.name.name === attrName);
|
|
39777
39788
|
const getAttrValue = (element, attrName) => {
|
|
39778
|
-
const attr = element
|
|
39789
|
+
const attr = getAttr(element, attrName);
|
|
39779
39790
|
return attr && import_lib$2.isStringLiteral(attr.value) ? attr.value.value : void 0;
|
|
39780
39791
|
};
|
|
39781
39792
|
const isSectionElement = (node) => import_lib$2.isJSXElement(node) && getTagName(node) === SECTION_TAG;
|
|
@@ -39829,10 +39840,37 @@ const clearDocumentParseCache = () => {
|
|
|
39829
39840
|
documentCache.clear();
|
|
39830
39841
|
};
|
|
39831
39842
|
const getSections = (doc) => findOutermostSections(doc.container.children).map((node, index) => ({
|
|
39832
|
-
id: `${index}`,
|
|
39843
|
+
id: getAttrValue(node, DATA_ATTR.ID) || `${index}`,
|
|
39833
39844
|
name: getAttrValue(node, DATA_NAME_ATTR) || `${index + 1}번째 컴포넌트`,
|
|
39834
39845
|
code: doc.code.slice(node.start, node.end)
|
|
39835
39846
|
}));
|
|
39847
|
+
const fillSectionIds = (code, generateId = () => nanoid(6)) => {
|
|
39848
|
+
const doc = parseDocument(code);
|
|
39849
|
+
if (!doc) return code;
|
|
39850
|
+
const seen = /* @__PURE__ */ new Set();
|
|
39851
|
+
const edits = [];
|
|
39852
|
+
findOutermostSections(doc.container.children).forEach((node) => {
|
|
39853
|
+
const attr = getAttr(node, DATA_ATTR.ID);
|
|
39854
|
+
const id = attr && import_lib$2.isStringLiteral(attr.value) ? attr.value.value : void 0;
|
|
39855
|
+
if (id && !seen.has(id)) {
|
|
39856
|
+
seen.add(id);
|
|
39857
|
+
return;
|
|
39858
|
+
}
|
|
39859
|
+
const nextId = generateId();
|
|
39860
|
+
seen.add(nextId);
|
|
39861
|
+
edits.push(attr ? {
|
|
39862
|
+
start: attr.start,
|
|
39863
|
+
end: attr.end,
|
|
39864
|
+
text: `${DATA_ATTR.ID}="${nextId}"`
|
|
39865
|
+
} : {
|
|
39866
|
+
start: node.openingElement.name.end,
|
|
39867
|
+
end: node.openingElement.name.end,
|
|
39868
|
+
text: ` ${DATA_ATTR.ID}="${nextId}"`
|
|
39869
|
+
});
|
|
39870
|
+
});
|
|
39871
|
+
if (!edits.length) return code;
|
|
39872
|
+
return edits.reduceRight((acc, edit) => `${acc.slice(0, edit.start)}${edit.text}${acc.slice(edit.end)}`, code);
|
|
39873
|
+
};
|
|
39836
39874
|
const generateDocumentCode = (doc) => doc.code;
|
|
39837
39875
|
const getContainerInnerSpan = (container) => {
|
|
39838
39876
|
if (!container.closingElement) return;
|
|
@@ -39925,6 +39963,6 @@ const createSectionPreviewCache = () => {
|
|
|
39925
39963
|
return { compute };
|
|
39926
39964
|
};
|
|
39927
39965
|
//#endregion
|
|
39928
|
-
export {
|
|
39966
|
+
export { __toESM as C, TS_PATTERNS as S, CONFIG as _, generateSectionPreview as a, DRAGGABLE_ITEMS as b, parseDocument as c, createBoundedCache as d, nanoid as f, BINDING_PROP as g, require_lib$7 as h, generateDocumentCode as i, replaceDocumentSections as l, require_lib$4 as m, createSectionPreviewCache as n, generateSectionPreviews as o, require_lib$3 as p, fillSectionIds as r, getSections as s, clearDocumentParseCache as t, traverse as u, DATA_ATTR as v, REGEX as x, DEFAULT_TEMPLATE as y };
|
|
39929
39967
|
|
|
39930
|
-
//# sourceMappingURL=document-
|
|
39968
|
+
//# sourceMappingURL=document-B5jioCvf.js.map
|