@jbpark/live-editor 0.1.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.
@@ -0,0 +1,3 @@
1
+ import { _ as getCurrentValue, a as update, d as extractNodeValue, f as extractObjectProperties, g as findEditableChildren, h as generateCode, i as bulkUpdate, l as arrayExpressionToCode, m as parseValue, n as fillIds, o as clearExtractCache, p as parseArrayExpression, r as replaceIds, s as extract, t as clone, u as createNodeFromValue, v as parseBinding } from "../../ast-6PhUZ232.mjs";
2
+
3
+ export { arrayExpressionToCode, bulkUpdate, clearExtractCache, clone, createNodeFromValue, extract, extractNodeValue, extractObjectProperties, fillIds, findEditableChildren, generateCode, getCurrentValue, parseArrayExpression, parseBinding, parseValue, replaceIds, update };
@@ -0,0 +1,27 @@
1
+ import { n as Section, t as Module } from "../index-DdSjzvA3.mjs";
2
+ import * as ui from "@jbpark/ui-kit";
3
+ import * as utils from "@jbpark/ui-kit/utils";
4
+
5
+ //#region node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.d.mts
6
+ type ClassValue = ClassArray | ClassDictionary | string | number | bigint | null | boolean | undefined;
7
+ type ClassDictionary = Record<string, any>;
8
+ type ClassArray = ClassValue[];
9
+ //#endregion
10
+ //#region src/utils/index.d.ts
11
+ declare function cn(...inputs: ClassValue[]): string;
12
+ declare const baseModules: {
13
+ 'ui-kit': typeof ui;
14
+ 'ui-kit/utils': typeof utils;
15
+ };
16
+ declare const compile: (code: string, modules: Record<string, unknown>) => Module;
17
+ declare const clearCompilationCache: () => void;
18
+ declare const transformCode: (code: string) => string;
19
+ declare const detectTypeScript: (code: string) => boolean;
20
+ declare const extractSections: (code: string) => Section[];
21
+ declare const replaceSections: (code: string, sections: string[]) => string;
22
+ declare const generateSection: (code: string, fullCode: string) => string;
23
+ declare const getCachedScriptBlob: (src: string) => Promise<string>;
24
+ declare const preloadScripts: (scripts: string[]) => void;
25
+ //#endregion
26
+ export { baseModules, clearCompilationCache, cn, compile, detectTypeScript, extractSections, generateSection, getCachedScriptBlob, preloadScripts, replaceSections, transformCode };
27
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1,3 @@
1
+ import { a as detectTypeScript, c as getCachedScriptBlob, d as transformCode, i as compile, l as preloadScripts, n as clearCompilationCache, o as extractSections, r as cn, s as generateSection, t as baseModules, u as replaceSections } from "../utils-INSWI9h0.mjs";
2
+
3
+ export { baseModules, clearCompilationCache, cn, compile, detectTypeScript, extractSections, generateSection, getCachedScriptBlob, preloadScripts, replaceSections, transformCode };
@@ -0,0 +1,5 @@
1
+ //#region src/utils/tailwind/index.d.ts
2
+ declare const generateTailwindCSS: (code: string) => Promise<string>;
3
+ //#endregion
4
+ export { generateTailwindCSS };
5
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1,37 @@
1
+ import { compile } from "tailwindcss";
2
+
3
+ //#region src/utils/tailwind/index.ts
4
+ const extractClasses = (code) => {
5
+ const classes = /* @__PURE__ */ new Set();
6
+ const cnPattern = /cn\(([^)]*(?:\([^)]*\)[^)]*)*)\)/gs;
7
+ let cnMatch;
8
+ while ((cnMatch = cnPattern.exec(code)) !== null) {
9
+ const cnContent = cnMatch[1];
10
+ const stringPattern = /['"`]([^'"`]+)['"`]/g;
11
+ let strMatch;
12
+ while ((strMatch = stringPattern.exec(cnContent)) !== null) strMatch[1].split(/\s+/).forEach((cls) => {
13
+ if (cls.trim()) classes.add(cls.trim());
14
+ });
15
+ }
16
+ for (const pattern of [/className=["']([^"']+)["']/g, /className=\{["'`]([^"'`]+)["'`]\}/g]) {
17
+ let match;
18
+ while ((match = pattern.exec(code)) !== null) match[1].split(/\s+/).forEach((cls) => {
19
+ if (cls.trim()) classes.add(cls.trim());
20
+ });
21
+ }
22
+ const conditionalPattern = /&&\s*['"`]([^'"`]+)['"`]/g;
23
+ let condMatch;
24
+ while ((condMatch = conditionalPattern.exec(code)) !== null) condMatch[1].split(/\s+/).forEach((cls) => {
25
+ if (cls.trim()) classes.add(cls.trim());
26
+ });
27
+ return Array.from(classes);
28
+ };
29
+ const generateTailwindCSS = async (code) => {
30
+ const classes = extractClasses(code);
31
+ if (classes.length === 0) return "";
32
+ return (await compile(`@tailwind utilities;`)).build(classes);
33
+ };
34
+
35
+ //#endregion
36
+ export { generateTailwindCSS };
37
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/utils/tailwind/index.ts"],"sourcesContent":["import { compile } from 'tailwindcss';\n\nconst extractClasses = (code: string): string[] => {\n const classes = new Set<string>();\n\n const cnPattern = /cn\\(([^)]*(?:\\([^)]*\\)[^)]*)*)\\)/gs;\n let cnMatch;\n\n while ((cnMatch = cnPattern.exec(code)) !== null) {\n const cnContent = cnMatch[1];\n\n const stringPattern = /['\"`]([^'\"`]+)['\"`]/g;\n let strMatch;\n\n while ((strMatch = stringPattern.exec(cnContent!)) !== null) {\n strMatch[1]!.split(/\\s+/).forEach(cls => {\n if (cls.trim()) classes.add(cls.trim());\n });\n }\n }\n\n const classNamePatterns = [\n /className=[\"']([^\"']+)[\"']/g,\n /className=\\{[\"'`]([^\"'`]+)[\"'`]\\}/g,\n ];\n\n for (const pattern of classNamePatterns) {\n let match;\n while ((match = pattern.exec(code)) !== null) {\n match[1]!.split(/\\s+/).forEach(cls => {\n if (cls.trim()) classes.add(cls.trim());\n });\n }\n }\n\n const conditionalPattern = /&&\\s*['\"`]([^'\"`]+)['\"`]/g;\n let condMatch;\n\n while ((condMatch = conditionalPattern.exec(code)) !== null) {\n condMatch[1]!.split(/\\s+/).forEach(cls => {\n if (cls.trim()) classes.add(cls.trim());\n });\n }\n\n return Array.from(classes);\n};\n\nexport const generateTailwindCSS = async (code: string): Promise<string> => {\n const classes = extractClasses(code);\n\n if (classes.length === 0) {\n return '';\n }\n\n const compiler = await compile(`@tailwind utilities;`);\n const css = compiler.build(classes);\n\n return css;\n};\n"],"mappings":";;;AAEA,MAAM,kBAAkB,SAA2B;CACjD,MAAM,0BAAU,IAAI,KAAa;CAEjC,MAAM,YAAY;CAClB,IAAI;AAEJ,SAAQ,UAAU,UAAU,KAAK,KAAK,MAAM,MAAM;EAChD,MAAM,YAAY,QAAQ;EAE1B,MAAM,gBAAgB;EACtB,IAAI;AAEJ,UAAQ,WAAW,cAAc,KAAK,UAAW,MAAM,KACrD,UAAS,GAAI,MAAM,MAAM,CAAC,SAAQ,QAAO;AACvC,OAAI,IAAI,MAAM,CAAE,SAAQ,IAAI,IAAI,MAAM,CAAC;IACvC;;AASN,MAAK,MAAM,WALe,CACxB,+BACA,qCACD,EAEwC;EACvC,IAAI;AACJ,UAAQ,QAAQ,QAAQ,KAAK,KAAK,MAAM,KACtC,OAAM,GAAI,MAAM,MAAM,CAAC,SAAQ,QAAO;AACpC,OAAI,IAAI,MAAM,CAAE,SAAQ,IAAI,IAAI,MAAM,CAAC;IACvC;;CAIN,MAAM,qBAAqB;CAC3B,IAAI;AAEJ,SAAQ,YAAY,mBAAmB,KAAK,KAAK,MAAM,KACrD,WAAU,GAAI,MAAM,MAAM,CAAC,SAAQ,QAAO;AACxC,MAAI,IAAI,MAAM,CAAE,SAAQ,IAAI,IAAI,MAAM,CAAC;GACvC;AAGJ,QAAO,MAAM,KAAK,QAAQ;;AAG5B,MAAa,sBAAsB,OAAO,SAAkC;CAC1E,MAAM,UAAU,eAAe,KAAK;AAEpC,KAAI,QAAQ,WAAW,EACrB,QAAO;AAMT,SAHiB,MAAM,QAAQ,uBAAuB,EACjC,MAAM,QAAQ"}