@blockbite/tailwind-css-parser 0.11.2

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 @@
1
+ {"version":3,"file":"tailwindcss_oxide-DbyA_3-d.js","sources":["../browser-wasm/tailwindcss_oxide.js"],"sourcesContent":["/* eslint-disable */\n// External dependencies\n\nlet wasm;\n\nconst cachedTextDecoder =\n typeof TextDecoder !== 'undefined'\n ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true })\n : {\n decode: () => {\n throw Error('TextDecoder not available');\n },\n };\n\nif (typeof TextDecoder !== 'undefined') {\n cachedTextDecoder.decode();\n}\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (\n cachedUint8ArrayMemory0 === null ||\n cachedUint8ArrayMemory0.byteLength === 0\n ) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(\n getUint8ArrayMemory0().subarray(ptr, ptr + len)\n );\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nconst cachedTextEncoder =\n typeof TextEncoder !== 'undefined'\n ? new TextEncoder('utf-8')\n : {\n encode: () => {\n throw Error('TextEncoder not available');\n },\n };\n\nconst encodeString =\n typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n }\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length,\n };\n };\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0()\n .subarray(ptr, ptr + buf.length)\n .set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7f) {\n break;\n }\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, (len = offset + arg.length * 3), 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n if (\n cachedDataViewMemory0 === null ||\n cachedDataViewMemory0.buffer.detached === true ||\n (cachedDataViewMemory0.buffer.detached === undefined &&\n cachedDataViewMemory0.buffer !== wasm.memory.buffer)\n ) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nexport function wasm_init() {\n wasm.wasm_init();\n}\n\nfunction isLikeNone(x) {\n return x === undefined || x === null;\n}\n\nfunction _assertClass(instance, klass) {\n if (!(instance instanceof klass)) {\n throw new Error(`expected instance of ${klass.name}`);\n }\n}\n\nfunction getArrayJsValueFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n const mem = getDataViewMemory0();\n const result = [];\n for (let i = ptr; i < ptr + 4 * len; i += 4) {\n result.push(wasm.__wbindgen_export_3.get(mem.getUint32(i, true)));\n }\n wasm.__externref_drop_slice(ptr, len);\n return result;\n}\n\nconst WasmCandidateWithPositionFinalization =\n typeof FinalizationRegistry === 'undefined'\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry((ptr) =>\n wasm.__wbg_wasmcandidatewithposition_free(ptr >>> 0, 1)\n );\n\nexport class WasmCandidateWithPosition {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(WasmCandidateWithPosition.prototype);\n obj.__wbg_ptr = ptr;\n WasmCandidateWithPositionFinalization.register(obj, obj.__wbg_ptr, obj);\n return obj;\n }\n\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n WasmCandidateWithPositionFinalization.unregister(this);\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_wasmcandidatewithposition_free(ptr, 0);\n }\n /**\n * @returns {string}\n */\n get candidate() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.wasmcandidatewithposition_candidate(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * @returns {number}\n */\n get position() {\n const ret = wasm.wasmcandidatewithposition_position(this.__wbg_ptr);\n return ret >>> 0;\n }\n}\n\nconst WasmChangedContentFinalization =\n typeof FinalizationRegistry === 'undefined'\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry((ptr) =>\n wasm.__wbg_wasmchangedcontent_free(ptr >>> 0, 1)\n );\n\nexport class WasmChangedContent {\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n WasmChangedContentFinalization.unregister(this);\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_wasmchangedcontent_free(ptr, 0);\n }\n /**\n * @param {string | null | undefined} content\n * @param {string} extension\n */\n constructor(content, extension) {\n var ptr0 = isLikeNone(content)\n ? 0\n : passStringToWasm0(\n content,\n wasm.__wbindgen_malloc,\n wasm.__wbindgen_realloc\n );\n var len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(\n extension,\n wasm.__wbindgen_malloc,\n wasm.__wbindgen_realloc\n );\n const len1 = WASM_VECTOR_LEN;\n const ret = wasm.wasmchangedcontent_new(ptr0, len0, ptr1, len1);\n this.__wbg_ptr = ret >>> 0;\n WasmChangedContentFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * @returns {string | undefined}\n */\n get content() {\n const ret = wasm.wasmchangedcontent_content(this.__wbg_ptr);\n let v1;\n if (ret[0] !== 0) {\n v1 = getStringFromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n }\n return v1;\n }\n /**\n * @returns {string}\n */\n get extension() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.wasmchangedcontent_extension(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n}\n\nconst WasmScannerFinalization =\n typeof FinalizationRegistry === 'undefined'\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry((ptr) =>\n wasm.__wbg_wasmscanner_free(ptr >>> 0, 1)\n );\n\nexport class WasmScanner {\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n WasmScannerFinalization.unregister(this);\n return ptr;\n }\n\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_wasmscanner_free(ptr, 0);\n }\n constructor() {\n const ret = wasm.wasmscanner_new();\n this.__wbg_ptr = ret >>> 0;\n WasmScannerFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * @param {WasmChangedContent} content\n * @returns {WasmCandidateWithPosition[]}\n */\n getCandidatesWithPositions(content) {\n _assertClass(content, WasmChangedContent);\n var ptr0 = content.__destroy_into_raw();\n const ret = wasm.wasmscanner_getCandidatesWithPositions(\n this.__wbg_ptr,\n ptr0\n );\n var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v2;\n }\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\n '`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n',\n e\n );\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function (arg0, arg1) {\n let deferred0_0;\n let deferred0_1;\n try {\n deferred0_0 = arg0;\n deferred0_1 = arg1;\n console.error(getStringFromWasm0(arg0, arg1));\n } finally {\n wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);\n }\n };\n imports.wbg.__wbg_new_8a6f238a6ece86ea = function () {\n const ret = new Error();\n return ret;\n };\n imports.wbg.__wbg_stack_0ed75d68575b0f3c = function (arg0, arg1) {\n const ret = arg1.stack;\n const ptr1 = passStringToWasm0(\n ret,\n wasm.__wbindgen_malloc,\n wasm.__wbindgen_realloc\n );\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n };\n imports.wbg.__wbg_wasmcandidatewithposition_new = function (arg0) {\n const ret = WasmCandidateWithPosition.__wrap(arg0);\n return ret;\n };\n imports.wbg.__wbindgen_init_externref_table = function () {\n const table = wasm.__wbindgen_export_3;\n const offset = table.grow(4);\n table.set(0, undefined);\n table.set(offset + 0, undefined);\n table.set(offset + 1, null);\n table.set(offset + 2, true);\n table.set(offset + 3, false);\n };\n imports.wbg.__wbindgen_throw = function (arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n };\n\n return imports;\n}\n\nfunction __wbg_init_memory(imports, memory) {}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n wasm.__wbindgen_start();\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) {\n return wasm;\n }\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({ module } = module);\n } else {\n console.warn(\n 'using deprecated parameters for `initSync()`; pass a single object instead'\n );\n }\n }\n\n const imports = __wbg_get_imports();\n\n __wbg_init_memory(imports);\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) {\n return wasm;\n }\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({ module_or_path } = module_or_path);\n } else {\n console.warn(\n 'using deprecated parameters for the initialization function; pass a single object instead'\n );\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('tailwindcss_oxide_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (\n typeof module_or_path === 'string' ||\n (typeof Request === 'function' && module_or_path instanceof Request) ||\n (typeof URL === 'function' && module_or_path instanceof URL)\n ) {\n module_or_path = fetch(module_or_path);\n }\n\n __wbg_init_memory(imports);\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n"],"names":["wasm","cachedTextDecoder","cachedUint8ArrayMemory0","getUint8ArrayMemory0","getStringFromWasm0","ptr","len","WASM_VECTOR_LEN","cachedTextEncoder","encodeString","arg","view","buf","passStringToWasm0","malloc","realloc","mem","offset","code","ret","cachedDataViewMemory0","getDataViewMemory0","wasm_init","isLikeNone","x","_assertClass","instance","klass","getArrayJsValueFromWasm0","result","i","WasmCandidateWithPositionFinalization","WasmCandidateWithPosition","obj","deferred1_0","deferred1_1","WasmChangedContentFinalization","WasmChangedContent","content","extension","ptr0","len0","ptr1","len1","v1","WasmScannerFinalization","WasmScanner","v2","__wbg_load","module","imports","e","bytes","__wbg_get_imports","arg0","arg1","deferred0_0","deferred0_1","table","__wbg_finalize_init","__wbg_init","initSync","module_or_path"],"mappings":"AAGA,IAAIA;AAEJ,MAAMC,IACJ,OAAO,cAAgB,MACnB,IAAI,YAAY,SAAS,EAAE,WAAW,IAAM,OAAO,GAAI,CAAE,IACzD;AAAA,EACE,QAAQ,MAAM;AACZ,UAAM,MAAM,2BAA2B;AAAA,EACjD;AACA;AAEI,OAAO,cAAgB,OACzBA,EAAkB,OAAM;AAG1B,IAAIC,IAA0B;AAE9B,SAASC,IAAuB;AAC9B,UACED,MAA4B,QAC5BA,EAAwB,eAAe,OAEvCA,IAA0B,IAAI,WAAWF,EAAK,OAAO,MAAM,IAEtDE;AACT;AAEA,SAASE,EAAmBC,GAAKC,GAAK;AACpC,SAAAD,IAAMA,MAAQ,GACPJ,EAAkB;AAAA,IACvBE,IAAuB,SAASE,GAAKA,IAAMC,CAAG;AAAA,EAClD;AACA;AAEA,IAAIC,IAAkB;AAEtB,MAAMC,IACJ,OAAO,cAAgB,MACnB,IAAI,YAAY,OAAO,IACvB;AAAA,EACE,QAAQ,MAAM;AACZ,UAAM,MAAM,2BAA2B;AAAA,EACjD;AACA,GAEMC,IACJ,OAAOD,EAAkB,cAAe,aACpC,SAAUE,GAAKC,GAAM;AACnB,SAAOH,EAAkB,WAAWE,GAAKC,CAAI;AACrD,IACM,SAAUD,GAAKC,GAAM;AACnB,QAAMC,IAAMJ,EAAkB,OAAOE,CAAG;AACxC,SAAAC,EAAK,IAAIC,CAAG,GACL;AAAA,IACL,MAAMF,EAAI;AAAA,IACV,SAASE,EAAI;AAAA,EACvB;AACA;AAEA,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,QAAMvB,IAAW,IAAI,YAAY,SAASuB,GAAQC,CAAO;AAEzD,SAAOS,EAAoBjC,GAAUuB,CAAM;AAC7C;AAEA,eAAeW,EAAWE,GAAgB;AACxC,MAAI9D,MAAS;AACX,WAAOA;AAGT,EAAI,OAAO8D,IAAmB,QACxB,OAAO,eAAeA,CAAc,MAAM,OAAO,YAClD,EAAE,gBAAAA,EAAc,IAAKA,IAEtB,QAAQ;AAAA,IACN;AAAA,EACR,IAIM,OAAOA,IAAmB,QAC5BA,IAAiB,IAAA,IAAA,ih/sEAAA,YAAA,GAAA;AAEnB,QAAMZ,IAAUG,EAAiB;AAEjC,GACE,OAAOS,KAAmB,YACzB,OAAO,WAAY,cAAcA,aAA0B,WAC3D,OAAO,OAAQ,cAAcA,aAA0B,SAExDA,IAAiB,MAAMA,CAAc;AAKvC,QAAM,EAAE,UAAApC,GAAU,QAAAuB,EAAM,IAAK,MAAMD,EAAW,MAAMc,GAAgBZ,CAAO;AAE3E,SAAOS,EAAoBjC,GAAUuB,CAAM;AAC7C;"}
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@blockbite/tailwind-css-parser",
3
+ "title": "fork of Semantic UI Tailwind Plugin",
4
+ "version": "0.11.2",
5
+ "website": "https://github.com/Semantic-Org/Semantic-Next/blob/55f1c6acc1e59e5334d207aa53b39be8c80978bb/packages/tailwind/package.json",
6
+ "author": "Jack Lukic",
7
+ "sideEffects": false,
8
+ "type": "module",
9
+ "main": "./dist/tailwind.cjs.js",
10
+ "module": "./dist/tailwind.es.js",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./types/index.d.ts",
14
+ "import": "./dist/tailwind.es.js",
15
+ "require": "./dist/tailwind.cjs.js"
16
+ }
17
+ },
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "files": [
22
+ "src",
23
+ "dist",
24
+ "types",
25
+ "LICENSE"
26
+ ],
27
+ "dependencies": {
28
+ "@blockbite/tailwind": "3.4.13"
29
+ },
30
+ "peerDependencies": {
31
+ "tailwindcss": "^4.0.0",
32
+ "@semantic-ui/utils": "^0.11.2",
33
+ "vite": "^6.3.5"
34
+ },
35
+ "optionalDependencies": {
36
+ "@tailwindcss/node": "^4.1.9",
37
+ "@tailwindcss/oxide": "^4.1.9"
38
+ },
39
+ "devDependencies": {
40
+ "vitest": "^3.0.8"
41
+ },
42
+ "scripts": {
43
+ "build": "vite build",
44
+ "test": "vite dev"
45
+ }
46
+ }
package/src/browser.js ADDED
@@ -0,0 +1,6 @@
1
+ // @semantic-ui/tailwind - Browser entry point
2
+ // Provides JIT compilation of Tailwind classes for Semantic UI components
3
+
4
+ export { generateTailwindCSS } from './generator-browser.js';
5
+ export { collectContent } from './scanner.js';
6
+ export { default as TailwindPlugin } from './tailwind-plugin-browser.js';
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Generates Tailwind CSS for browser environments using WASM scanner
3
+ */
4
+
5
+ import { compile } from 'tailwindcss';
6
+ import indexCSS from 'tailwindcss/index.css?raw';
7
+ import preflightCSS from 'tailwindcss/preflight.css?raw';
8
+ import themeCSS from 'tailwindcss/theme.css?raw';
9
+ import utilitiesCSS from 'tailwindcss/utilities.css?raw';
10
+
11
+ export async function generateTailwindCSS({ content, css = '', tailwindCSS }) {
12
+ // Load WASM-based scanner for browser environment
13
+ let Scanner, ChangedContent;
14
+ try {
15
+ const wasmModule = await import('../browser-wasm/tailwindcss_oxide.js');
16
+ await wasmModule.default();
17
+ Scanner = wasmModule.WasmScanner;
18
+ ChangedContent = wasmModule.WasmChangedContent;
19
+ } catch (error) {
20
+ throw new Error('Failed to load WASM scanner: ' + error.message);
21
+ }
22
+ // Build source CSS with Tailwind directives + existing component CSS
23
+ if (!tailwindCSS) {
24
+ tailwindCSS = `@import "tailwindcss";`;
25
+ }
26
+
27
+ const sourceCSS = css
28
+ ? `${css}\n${tailwindCSS}` // Add utilities to existing CSS
29
+ : tailwindCSS; // Just utilities if no existing CSS
30
+
31
+ // Compile the CSS using tailwindcss core with browser-specific options
32
+ const compiler = await compile(sourceCSS, {
33
+ base: '/',
34
+ loadStylesheet: async (id, base) => {
35
+ // Handle built-in Tailwind CSS imports using the imported CSS content
36
+ if (id === 'tailwindcss') {
37
+ return {
38
+ path: 'virtual:tailwindcss/index.css',
39
+ base,
40
+ content: indexCSS,
41
+ };
42
+ } else if (
43
+ id === 'tailwindcss/preflight' ||
44
+ id === 'tailwindcss/preflight.css' ||
45
+ id === './preflight.css'
46
+ ) {
47
+ return {
48
+ path: 'virtual:tailwindcss/preflight.css',
49
+ base,
50
+ content: preflightCSS,
51
+ };
52
+ } else if (
53
+ id === 'tailwindcss/theme' ||
54
+ id === 'tailwindcss/theme.css' ||
55
+ id === './theme.css'
56
+ ) {
57
+ return {
58
+ path: 'virtual:tailwindcss/theme.css',
59
+ base,
60
+ content: themeCSS,
61
+ };
62
+ } else if (
63
+ id === 'tailwindcss/utilities' ||
64
+ id === 'tailwindcss/utilities.css' ||
65
+ id === './utilities.css'
66
+ ) {
67
+ return {
68
+ path: 'virtual:tailwindcss/utilities.css',
69
+ base,
70
+ content: utilitiesCSS,
71
+ };
72
+ }
73
+
74
+ throw new Error(
75
+ `External stylesheets not supported in browser build: "${id}"`
76
+ );
77
+ },
78
+ loadModule: async (id, base) => {
79
+ if (id === '@blockbite/tailwind') {
80
+ // Load the plugin from the package
81
+ const module = await import('../../tailwind/dist/index.js');
82
+ return {
83
+ path: id,
84
+ base,
85
+ module: module.default, // Must export default plugin
86
+ };
87
+ }
88
+
89
+ throw new Error(`Unsupported module: ${id}`);
90
+ },
91
+ });
92
+
93
+ // Extract candidates using WASM scanner
94
+ const scanner = new Scanner();
95
+ const changedContent = new ChangedContent(content, 'html');
96
+ const candidatesWithPositions =
97
+ scanner.getCandidatesWithPositions(changedContent);
98
+ const candidates = candidatesWithPositions.map((item) => item.candidate);
99
+ // Build the CSS with the extracted candidates
100
+ const result = compiler.build(candidates);
101
+
102
+ return result; // returns stringified CSS ready to inject
103
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Generates Tailwind CSS for Node.js environments using native scanner
3
+ */
4
+
5
+ import { compile } from '@tailwindcss/node';
6
+ import { Scanner } from '@tailwindcss/oxide';
7
+
8
+ export async function generateTailwindCSS({ content, css = '', tailwindCSS }) {
9
+ // Build source CSS with Tailwind directives + existing component CSS
10
+ if (!tailwindCSS) {
11
+ tailwindCSS = `@import "tailwindcss";`;
12
+ }
13
+
14
+ const sourceCSS = css
15
+ ? `${css}\n${tailwindCSS}` // Add utilities to existing CSS
16
+ : tailwindCSS; // Just utilities if no existing CSS
17
+
18
+ // Compile CSS using @tailwindcss/node with automatic file resolution
19
+ const compiler = await compile(sourceCSS, {
20
+ base: process.cwd(),
21
+ onDependency: () => {}, // No-op dependency tracking for JIT use
22
+ });
23
+
24
+ // Extract candidates using native scanner
25
+ const scanner = new Scanner({ sources: [] });
26
+ const candidatesWithPositions = scanner.getCandidatesWithPositions({
27
+ content,
28
+ extension: 'html',
29
+ });
30
+ const candidates = candidatesWithPositions.map((item) => item.candidate);
31
+
32
+ // Build the CSS with the extracted candidates
33
+ const result = compiler.build(candidates);
34
+
35
+ return result; // returns stringified CSS ready to inject
36
+ }
package/src/scanner.js ADDED
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Scans component definition and collects all content for Tailwind class extraction
3
+ */
4
+
5
+ import { each, isFunction, isObject } from '@semantic-ui/utils';
6
+
7
+ export function collectContent(definition) {
8
+ const htmlContent = [];
9
+ const jsContent = [];
10
+ const cssContent = [];
11
+
12
+ // 1. Template HTML
13
+ if (definition.template) {
14
+ htmlContent.push(definition.template);
15
+ }
16
+
17
+ // 1.5. Main component CSS
18
+ if (definition.css) {
19
+ cssContent.push(definition.css);
20
+ }
21
+
22
+ // 2. createComponent function
23
+ if (isFunction(definition.createComponent)) {
24
+ jsContent.push(definition.createComponent.toString());
25
+ }
26
+
27
+ // 3. Lifecycle functions
28
+ if (isFunction(definition.onCreated)) {
29
+ jsContent.push(definition.onCreated.toString());
30
+ }
31
+ if (isFunction(definition.onRendered)) {
32
+ jsContent.push(definition.onRendered.toString());
33
+ }
34
+ if (isFunction(definition.onDestroyed)) {
35
+ jsContent.push(definition.onDestroyed.toString());
36
+ }
37
+ if (isFunction(definition.onThemeChanged)) {
38
+ jsContent.push(definition.onThemeChanged.toString());
39
+ }
40
+ if (isFunction(definition.onAttributeChanged)) {
41
+ jsContent.push(definition.onAttributeChanged.toString());
42
+ }
43
+
44
+ // 4. Events object - functions as values
45
+ if (isObject(definition.events)) {
46
+ each(definition.events, (eventHandler) => {
47
+ if (isFunction(eventHandler)) {
48
+ jsContent.push(eventHandler.toString());
49
+ }
50
+ });
51
+ }
52
+
53
+ // 5. Keys object - functions as values
54
+ if (isObject(definition.keys)) {
55
+ each(definition.keys, (keyHandler) => {
56
+ if (isFunction(keyHandler)) {
57
+ jsContent.push(keyHandler.toString());
58
+ }
59
+ });
60
+ }
61
+
62
+ // 6. SubTemplates - scan their HTML and CSS
63
+ if (isObject(definition.subTemplates)) {
64
+ each(definition.subTemplates, (subTemplate) => {
65
+ if (subTemplate.template) {
66
+ htmlContent.push(subTemplate.template);
67
+ }
68
+ if (subTemplate.css) {
69
+ cssContent.push(subTemplate.css);
70
+ }
71
+ });
72
+ }
73
+
74
+ const html = htmlContent.join('\n');
75
+ const js = jsContent.join('\n');
76
+ const css = cssContent.join('\n');
77
+ const content = `${html}\n${js}`;
78
+
79
+ return {
80
+ html,
81
+ js,
82
+ css,
83
+ content,
84
+ };
85
+ }
package/src/server.js ADDED
@@ -0,0 +1,6 @@
1
+ // @semantic-ui/tailwind - Server entry point
2
+ // Provides JIT compilation of Tailwind classes for Semantic UI components
3
+
4
+ export { generateTailwindCSS } from './generator-server.js';
5
+ export { collectContent } from './scanner.js';
6
+ export { default as TailwindPlugin } from './tailwind-plugin-server.js';
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Tailwind CSS transformation function for Semantic UI components (Browser)
3
+ * Scans component definition for Tailwind classes and generates JIT CSS
4
+ */
5
+
6
+ import { generateTailwindCSS } from './generator-browser.js';
7
+ import { collectContent } from './scanner.js';
8
+
9
+ export default function TailwindPlugin(config = {}) {
10
+ return async function transformDefinition(definition) {
11
+ // Collect all content and CSS from the component definition
12
+ const { content, css } = collectContent(definition);
13
+
14
+ // Quick check - if no content, return unchanged
15
+ if (!content.trim()) {
16
+ return definition;
17
+ }
18
+
19
+ // Generate CSS using tailwindcss core with WASM scanner
20
+ const tailwindCSS = await generateTailwindCSS({
21
+ content,
22
+ css,
23
+ config,
24
+ });
25
+
26
+ // If no CSS was generated, return unchanged
27
+ if (!tailwindCSS.trim()) {
28
+ return definition;
29
+ }
30
+
31
+ // Replace component CSS with Tailwind-enhanced version
32
+ return {
33
+ ...definition,
34
+ css: tailwindCSS,
35
+ };
36
+ };
37
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Tailwind CSS transformation function for Semantic UI components (Server)
3
+ * Scans component definition for Tailwind classes and generates JIT CSS
4
+ */
5
+
6
+ import { generateTailwindCSS } from './generator-server.js';
7
+ import { collectContent } from './scanner.js';
8
+
9
+ export default function TailwindPlugin() {
10
+ return async function transformDefinition(definition) {
11
+ // Collect all content and CSS from the component definition
12
+ const { content, css } = collectContent(definition);
13
+
14
+ // Quick check - if no content, return unchanged
15
+ if (!content.trim()) {
16
+ return definition;
17
+ }
18
+
19
+ // Generate CSS using @tailwindcss/node with native scanner
20
+ const tailwindCSS = await generateTailwindCSS({
21
+ content,
22
+ css,
23
+ });
24
+
25
+ // If no CSS was generated, return unchanged
26
+ if (!tailwindCSS.trim()) {
27
+ return definition;
28
+ }
29
+
30
+ // Replace component CSS with Tailwind-enhanced version
31
+ return {
32
+ ...definition,
33
+ css: tailwindCSS,
34
+ };
35
+ };
36
+ }
@@ -0,0 +1,63 @@
1
+ import type { Config } from 'tailwindcss';
2
+
3
+ interface ComponentDefinition {
4
+ name?: string;
5
+ template?: string;
6
+ css?: string;
7
+ subTemplates?: Record<string, Omit<ComponentDefinition, 'name'>>;
8
+ [key: string]: any;
9
+ }
10
+
11
+ interface GenerateTailwindCSSOptions {
12
+ /**
13
+ * A string containing the HTML or JavaScript content to be scanned for Tailwind classes.
14
+ */
15
+ content: string;
16
+ /**
17
+ * Optional. Existing CSS string to be prepended to the generated Tailwind CSS.
18
+ */
19
+ css?: string;
20
+ /**
21
+ * Optional. A custom Tailwind CSS configuration object.
22
+ */
23
+ config?: Config;
24
+
25
+ /**
26
+ * Optional. A prefix to be applied to all Tailwind classes in the generated CSS.
27
+ * This is useful for avoiding class name conflicts.
28
+ */
29
+ tailwindCSS?: string;
30
+ }
31
+
32
+ /**
33
+ * Compiles a string of content to generate Tailwind CSS.
34
+ * This is the primary export and works in both Node.js and browser environments.
35
+ *
36
+ * @param options - The options for generating Tailwind CSS.
37
+ * @returns A promise that resolves to the compiled CSS string.
38
+ */
39
+ export function generateTailwindCSS(options: GenerateTailwindCSSOptions): Promise<string>;
40
+
41
+ /**
42
+ * A plugin for integrating Tailwind CSS with Semantic UI component definitions.
43
+ * It scans a component definition for Tailwind classes and injects the generated
44
+ * CSS into the definition.
45
+ *
46
+ * @param config - Optional. A custom Tailwind CSS configuration object.
47
+ * @returns An asynchronous function that transforms a Semantic UI component definition.
48
+ */
49
+ export function TailwindPlugin(config?: Config): (definition: ComponentDefinition) => Promise<ComponentDefinition>;
50
+
51
+ /**
52
+ * A utility function that recursively collects all content and CSS
53
+ * from a Semantic UI component definition into a single object.
54
+ *
55
+ * @param definition - The Semantic UI component definition.
56
+ * @returns An object containing the combined HTML, JS, and CSS content.
57
+ */
58
+ export function collectContent(definition: ComponentDefinition): {
59
+ html: string;
60
+ js: string;
61
+ css: string;
62
+ content: string;
63
+ };