tailwind-styled-v4 5.0.0 → 5.0.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.
- package/CHANGELOG.md +398 -0
- package/LICENSE +21 -0
- package/README.md +532 -0
- package/dist/analyzer.d.mts +114 -0
- package/dist/analyzer.d.ts +114 -0
- package/dist/analyzer.js +6808 -0
- package/dist/analyzer.js.map +1 -0
- package/dist/analyzer.mjs +6798 -0
- package/dist/analyzer.mjs.map +1 -0
- package/dist/{animate.d.cts → animate.d.mts} +3 -30
- package/dist/animate.d.ts +3 -30
- package/dist/animate.js +7096 -352
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +7482 -0
- package/dist/animate.mjs.map +1 -0
- package/dist/atomic.d.mts +18 -0
- package/dist/atomic.d.ts +18 -0
- package/dist/atomic.js +191 -0
- package/dist/atomic.js.map +1 -0
- package/dist/atomic.mjs +185 -0
- package/dist/atomic.mjs.map +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +45008 -0
- package/dist/cli.js.map +1 -0
- package/dist/cli.mjs +44980 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/compiler.d.mts +1009 -0
- package/dist/compiler.d.ts +1009 -0
- package/dist/compiler.js +4937 -0
- package/dist/compiler.js.map +1 -0
- package/dist/compiler.mjs +4862 -0
- package/dist/compiler.mjs.map +1 -0
- package/dist/dashboard.d.mts +272 -0
- package/dist/dashboard.d.ts +272 -0
- package/dist/dashboard.js +249 -0
- package/dist/dashboard.js.map +1 -0
- package/dist/dashboard.mjs +239 -0
- package/dist/dashboard.mjs.map +1 -0
- package/dist/devtools.js +171 -158
- package/dist/devtools.js.map +1 -1
- package/dist/{devtools.cjs → devtools.mjs} +166 -167
- package/dist/devtools.mjs.map +1 -0
- package/dist/engine.d.mts +398 -0
- package/dist/engine.d.ts +398 -0
- package/dist/engine.js +19264 -0
- package/dist/engine.js.map +1 -0
- package/dist/engine.mjs +19227 -0
- package/dist/engine.mjs.map +1 -0
- package/dist/{index.d.cts → index.d.mts} +12 -5
- package/dist/index.d.ts +12 -5
- package/dist/index.js +7178 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8408 -0
- package/dist/index.mjs.map +1 -0
- package/dist/liveTokenEngine-DYN3Zale.d.mts +34 -0
- package/dist/liveTokenEngine-DYN3Zale.d.ts +34 -0
- package/dist/{next.d.cts → next.d.mts} +2 -1
- package/dist/next.d.ts +2 -1
- package/dist/next.js +24027 -28
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +24232 -0
- package/dist/next.mjs.map +1 -0
- package/dist/plugin.d.mts +90 -0
- package/dist/plugin.d.ts +90 -0
- package/dist/plugin.js +185 -0
- package/dist/plugin.js.map +1 -0
- package/dist/plugin.mjs +174 -0
- package/dist/plugin.mjs.map +1 -0
- package/dist/pluginRegistry.d.mts +83 -0
- package/dist/pluginRegistry.d.ts +83 -0
- package/dist/pluginRegistry.js +303 -0
- package/dist/pluginRegistry.js.map +1 -0
- package/dist/pluginRegistry.mjs +298 -0
- package/dist/pluginRegistry.mjs.map +1 -0
- package/dist/preset.js +9 -4
- package/dist/preset.js.map +1 -1
- package/dist/{preset.cjs → preset.mjs} +5 -14
- package/dist/preset.mjs.map +1 -0
- package/dist/rspack.d.mts +33 -0
- package/dist/rspack.d.ts +33 -0
- package/dist/rspack.js +66 -0
- package/dist/rspack.js.map +1 -0
- package/dist/rspack.mjs +55 -0
- package/dist/rspack.mjs.map +1 -0
- package/dist/runtime.d.mts +62 -0
- package/dist/runtime.d.ts +62 -0
- package/dist/runtime.js +455 -0
- package/dist/runtime.js.map +1 -0
- package/dist/runtime.mjs +436 -0
- package/dist/runtime.mjs.map +1 -0
- package/dist/runtimeCss.d.mts +65 -0
- package/dist/runtimeCss.d.ts +65 -0
- package/dist/{css.cjs → runtimeCss.js} +71 -4
- package/dist/runtimeCss.js.map +1 -0
- package/dist/{css.js → runtimeCss.mjs} +66 -5
- package/dist/runtimeCss.mjs.map +1 -0
- package/dist/scanner.d.mts +25 -0
- package/dist/scanner.d.ts +25 -0
- package/dist/scanner.js +5774 -0
- package/dist/scanner.js.map +1 -0
- package/dist/scanner.mjs +5760 -0
- package/dist/scanner.mjs.map +1 -0
- package/dist/shared.d.mts +85 -0
- package/dist/shared.d.ts +85 -0
- package/dist/shared.js +255 -0
- package/dist/shared.js.map +1 -0
- package/dist/shared.mjs +233 -0
- package/dist/shared.mjs.map +1 -0
- package/dist/storybookAddon.d.mts +108 -0
- package/dist/storybookAddon.d.ts +108 -0
- package/dist/storybookAddon.js +95 -0
- package/dist/storybookAddon.js.map +1 -0
- package/dist/storybookAddon.mjs +88 -0
- package/dist/storybookAddon.mjs.map +1 -0
- package/dist/svelte.d.mts +114 -0
- package/dist/svelte.d.ts +114 -0
- package/dist/svelte.js +67 -0
- package/dist/svelte.js.map +1 -0
- package/dist/svelte.mjs +59 -0
- package/dist/svelte.mjs.map +1 -0
- package/dist/testing.d.mts +185 -0
- package/dist/testing.d.ts +185 -0
- package/dist/testing.js +173 -0
- package/dist/testing.js.map +1 -0
- package/dist/testing.mjs +158 -0
- package/dist/testing.mjs.map +1 -0
- package/dist/theme.d.mts +188 -0
- package/dist/theme.d.ts +188 -0
- package/dist/theme.js +334 -0
- package/dist/theme.js.map +1 -0
- package/dist/theme.mjs +311 -0
- package/dist/theme.mjs.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types-DXr2PmGP.d.mts +31 -0
- package/dist/types-DXr2PmGP.d.ts +31 -0
- package/dist/vite.js +29611 -17
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +29712 -0
- package/dist/vite.mjs.map +1 -0
- package/dist/vue.d.mts +89 -0
- package/dist/vue.d.ts +89 -0
- package/dist/vue.js +104 -0
- package/dist/vue.js.map +1 -0
- package/dist/vue.mjs +96 -0
- package/dist/vue.mjs.map +1 -0
- package/package.json +170 -64
- package/dist/animate.cjs +0 -771
- package/dist/animate.cjs.map +0 -1
- package/dist/chunk-VZEJV27B.js +0 -11
- package/dist/chunk-VZEJV27B.js.map +0 -1
- package/dist/chunk-Y5D3E72P.cjs +0 -13
- package/dist/chunk-Y5D3E72P.cjs.map +0 -1
- package/dist/css.cjs.map +0 -1
- package/dist/css.d.cts +0 -30
- package/dist/css.d.ts +0 -30
- package/dist/css.js.map +0 -1
- package/dist/devtools.cjs.map +0 -1
- package/dist/index.cjs +0 -1353
- package/dist/index.cjs.map +0 -1
- package/dist/next.cjs +0 -248
- package/dist/next.cjs.map +0 -1
- package/dist/preset.cjs.map +0 -1
- package/dist/turbopackLoader.cjs +0 -37
- package/dist/turbopackLoader.cjs.map +0 -1
- package/dist/turbopackLoader.d.cts +0 -12
- package/dist/turbopackLoader.d.ts +0 -12
- package/dist/turbopackLoader.js +0 -35
- package/dist/turbopackLoader.js.map +0 -1
- package/dist/vite.cjs +0 -138
- package/dist/vite.cjs.map +0 -1
- package/dist/webpackLoader.cjs +0 -51
- package/dist/webpackLoader.cjs.map +0 -1
- package/dist/webpackLoader.d.cts +0 -17
- package/dist/webpackLoader.d.ts +0 -17
- package/dist/webpackLoader.js +0 -49
- package/dist/webpackLoader.js.map +0 -1
- /package/dist/{devtools.d.cts → devtools.d.mts} +0 -0
- /package/dist/{preset.d.cts → preset.d.mts} +0 -0
- /package/dist/{vite.d.cts → vite.d.mts} +0 -0
package/dist/rspack.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var path = require('path');
|
|
6
|
+
var url = require('url');
|
|
7
|
+
|
|
8
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
|
|
11
|
+
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
12
|
+
|
|
13
|
+
/* tailwind-styled-v4 v5.0.1 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
14
|
+
|
|
15
|
+
function getDirname() {
|
|
16
|
+
if (typeof __dirname !== "undefined") {
|
|
17
|
+
return __dirname;
|
|
18
|
+
}
|
|
19
|
+
if (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('rspack.js', document.baseURI).href)) }) !== "undefined" && (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('rspack.js', document.baseURI).href))) {
|
|
20
|
+
return path__default.default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('rspack.js', document.baseURI).href))));
|
|
21
|
+
}
|
|
22
|
+
return process.cwd();
|
|
23
|
+
}
|
|
24
|
+
var LOADER_PATH = path__default.default.resolve(getDirname(), "loader.js");
|
|
25
|
+
var TailwindStyledRspackPlugin = class {
|
|
26
|
+
constructor(opts = {}) {
|
|
27
|
+
this.opts = opts;
|
|
28
|
+
}
|
|
29
|
+
apply(compiler) {
|
|
30
|
+
const isDev = compiler.options.mode !== "production";
|
|
31
|
+
const loaderOpts = {
|
|
32
|
+
// v5: Always zero-runtime
|
|
33
|
+
mode: "zero-runtime",
|
|
34
|
+
addDataAttr: this.opts.addDataAttr ?? isDev,
|
|
35
|
+
// Preserve cv, cx, cn, etc — only tw.* is transformed
|
|
36
|
+
preserveImports: true
|
|
37
|
+
};
|
|
38
|
+
const include = this.opts.include ?? /\.[jt]sx?$/;
|
|
39
|
+
const exclude = this.opts.exclude ?? /node_modules/;
|
|
40
|
+
const existing = compiler.options.module?.rules ?? [];
|
|
41
|
+
const alreadyRegistered = existing.some((r) => r._tailwindStyledRspackMarker === true);
|
|
42
|
+
if (alreadyRegistered) return;
|
|
43
|
+
const rule = {
|
|
44
|
+
_tailwindStyledRspackMarker: true,
|
|
45
|
+
test: include,
|
|
46
|
+
exclude,
|
|
47
|
+
use: [
|
|
48
|
+
{
|
|
49
|
+
loader: LOADER_PATH,
|
|
50
|
+
options: loaderOpts
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
};
|
|
54
|
+
compiler.options.module.rules = [rule, ...existing];
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
function tailwindStyledRspackPlugin(opts = {}) {
|
|
58
|
+
return new TailwindStyledRspackPlugin(opts);
|
|
59
|
+
}
|
|
60
|
+
var src_default = tailwindStyledRspackPlugin;
|
|
61
|
+
|
|
62
|
+
exports.TailwindStyledRspackPlugin = TailwindStyledRspackPlugin;
|
|
63
|
+
exports.default = src_default;
|
|
64
|
+
exports.tailwindStyledRspackPlugin = tailwindStyledRspackPlugin;
|
|
65
|
+
//# sourceMappingURL=rspack.js.map
|
|
66
|
+
//# sourceMappingURL=rspack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../packages/rspack/src/index.ts"],"names":["path","fileURLToPath"],"mappings":";;;;;;;;;;;;;;AAoBA,SAAS,UAAA,GAAqB;AAC5B,EAAA,IAAI,OAAO,cAAc,WAAA,EAAa;AACpC,IAAA,OAAO,SAAA;AAAA,EACT;AACA,EAAA,IAAI,OAAO,sQAAA,KAAgB,WAAA,IAAe,2PAAY,EAAK;AACzD,IAAA,OAAOA,qBAAA,CAAK,OAAA,CAAQC,iBAAA,CAAc,2PAAe,CAAC,CAAA;AAAA,EACpD;AACA,EAAA,OAAO,QAAQ,GAAA,EAAI;AACrB;AAaA,IAAM,WAAA,GAAcD,qBAAA,CAAK,OAAA,CAAQ,UAAA,IAAc,WAAW,CAAA;AAEnD,IAAM,6BAAN,MAAiC;AAAA,EAGtC,WAAA,CAAY,IAAA,GAA4B,EAAC,EAAG;AAC1C,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AAAA,EACd;AAAA,EAEA,MAAM,QAAA,EAAqB;AACzB,IAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,OAAA,CAAQ,IAAA,KAAS,YAAA;AAExC,IAAA,MAAM,UAAA,GAAa;AAAA;AAAA,MAEjB,IAAA,EAAM,cAAA;AAAA,MACN,WAAA,EAAa,IAAA,CAAK,IAAA,CAAK,WAAA,IAAe,KAAA;AAAA;AAAA,MAEtC,eAAA,EAAiB;AAAA,KACnB;AAEA,IAAA,MAAM,OAAA,GAAU,IAAA,CAAK,IAAA,CAAK,OAAA,IAAW,YAAA;AACrC,IAAA,MAAM,OAAA,GAAU,IAAA,CAAK,IAAA,CAAK,OAAA,IAAW,cAAA;AAGrC,IAAA,MAAM,QAAA,GAAW,QAAA,CAAS,OAAA,CAAQ,MAAA,EAAQ,SAAS,EAAC;AACpD,IAAA,MAAM,oBAAoB,QAAA,CAAS,IAAA,CAAK,CAAC,CAAA,KAAW,CAAA,CAAE,gCAAgC,IAAI,CAAA;AAC1F,IAAA,IAAI,iBAAA,EAAmB;AAEvB,IAAA,MAAM,IAAA,GAAO;AAAA,MACX,2BAAA,EAA6B,IAAA;AAAA,MAC7B,IAAA,EAAM,OAAA;AAAA,MACN,OAAA;AAAA,MACA,GAAA,EAAK;AAAA,QACH;AAAA,UACE,MAAA,EAAQ,WAAA;AAAA,UACR,OAAA,EAAS;AAAA;AACX;AACF,KACF;AAEA,IAAA,QAAA,CAAS,QAAQ,MAAA,CAAO,KAAA,GAAQ,CAAC,IAAA,EAAM,GAAG,QAAQ,CAAA;AAAA,EACpD;AACF;AAEO,SAAS,0BAAA,CACd,IAAA,GAA4B,EAAC,EACD;AAC5B,EAAA,OAAO,IAAI,2BAA2B,IAAI,CAAA;AAC5C;AAEA,IAAO,WAAA,GAAQ","file":"rspack.js","sourcesContent":["/**\n * tailwind-styled-v4 — Rspack Plugin v5 (stable)\n *\n * Usage:\n * import { tailwindStyledRspackPlugin } from \"@tailwind-styled/rspack\"\n *\n * export default defineConfig({\n * plugins: [tailwindStyledRspackPlugin()],\n * })\n *\n * v5:\n * - Simplified API\n * - Uses @tailwind-styled/engine for build\n * - Mode always zero-runtime\n */\n\nimport path from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\n\n// ESM-compatible __dirname equivalent\nfunction getDirname(): string {\n if (typeof __dirname !== \"undefined\") {\n return __dirname\n }\n if (typeof import.meta !== \"undefined\" && import.meta.url) {\n return path.dirname(fileURLToPath(import.meta.url))\n }\n return process.cwd()\n}\n\nexport interface RspackPluginOptions {\n /** File patterns to include. Default: /\\.[jt]sx?$/ */\n include?: RegExp\n /** File patterns to exclude. Default: /node_modules/ */\n exclude?: RegExp\n /** Add data-tw debug attributes in dev. Default: true in dev */\n addDataAttr?: boolean\n /** Enable analyzer. Default: false */\n analyze?: boolean\n}\n\nconst LOADER_PATH = path.resolve(getDirname(), \"loader.js\")\n\nexport class TailwindStyledRspackPlugin {\n private opts: RspackPluginOptions\n\n constructor(opts: RspackPluginOptions = {}) {\n this.opts = opts\n }\n\n apply(compiler: any): void {\n const isDev = compiler.options.mode !== \"production\"\n\n const loaderOpts = {\n // v5: Always zero-runtime\n mode: \"zero-runtime\" as const,\n addDataAttr: this.opts.addDataAttr ?? isDev,\n // Preserve cv, cx, cn, etc — only tw.* is transformed\n preserveImports: true,\n }\n\n const include = this.opts.include ?? /\\.[jt]sx?$/\n const exclude = this.opts.exclude ?? /node_modules/\n\n // Check idempotency\n const existing = compiler.options.module?.rules ?? []\n const alreadyRegistered = existing.some((r: any) => r._tailwindStyledRspackMarker === true)\n if (alreadyRegistered) return\n\n const rule = {\n _tailwindStyledRspackMarker: true,\n test: include,\n exclude: exclude,\n use: [\n {\n loader: LOADER_PATH,\n options: loaderOpts,\n },\n ],\n }\n\n compiler.options.module.rules = [rule, ...existing]\n }\n}\n\nexport function tailwindStyledRspackPlugin(\n opts: RspackPluginOptions = {}\n): TailwindStyledRspackPlugin {\n return new TailwindStyledRspackPlugin(opts)\n}\n\nexport default tailwindStyledRspackPlugin\n"]}
|
package/dist/rspack.mjs
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
|
|
4
|
+
/* tailwind-styled-v4 v5.0.1 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
5
|
+
|
|
6
|
+
function getDirname() {
|
|
7
|
+
if (typeof __dirname !== "undefined") {
|
|
8
|
+
return __dirname;
|
|
9
|
+
}
|
|
10
|
+
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
11
|
+
return path.dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
}
|
|
13
|
+
return process.cwd();
|
|
14
|
+
}
|
|
15
|
+
var LOADER_PATH = path.resolve(getDirname(), "loader.js");
|
|
16
|
+
var TailwindStyledRspackPlugin = class {
|
|
17
|
+
constructor(opts = {}) {
|
|
18
|
+
this.opts = opts;
|
|
19
|
+
}
|
|
20
|
+
apply(compiler) {
|
|
21
|
+
const isDev = compiler.options.mode !== "production";
|
|
22
|
+
const loaderOpts = {
|
|
23
|
+
// v5: Always zero-runtime
|
|
24
|
+
mode: "zero-runtime",
|
|
25
|
+
addDataAttr: this.opts.addDataAttr ?? isDev,
|
|
26
|
+
// Preserve cv, cx, cn, etc — only tw.* is transformed
|
|
27
|
+
preserveImports: true
|
|
28
|
+
};
|
|
29
|
+
const include = this.opts.include ?? /\.[jt]sx?$/;
|
|
30
|
+
const exclude = this.opts.exclude ?? /node_modules/;
|
|
31
|
+
const existing = compiler.options.module?.rules ?? [];
|
|
32
|
+
const alreadyRegistered = existing.some((r) => r._tailwindStyledRspackMarker === true);
|
|
33
|
+
if (alreadyRegistered) return;
|
|
34
|
+
const rule = {
|
|
35
|
+
_tailwindStyledRspackMarker: true,
|
|
36
|
+
test: include,
|
|
37
|
+
exclude,
|
|
38
|
+
use: [
|
|
39
|
+
{
|
|
40
|
+
loader: LOADER_PATH,
|
|
41
|
+
options: loaderOpts
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
};
|
|
45
|
+
compiler.options.module.rules = [rule, ...existing];
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
function tailwindStyledRspackPlugin(opts = {}) {
|
|
49
|
+
return new TailwindStyledRspackPlugin(opts);
|
|
50
|
+
}
|
|
51
|
+
var src_default = tailwindStyledRspackPlugin;
|
|
52
|
+
|
|
53
|
+
export { TailwindStyledRspackPlugin, src_default as default, tailwindStyledRspackPlugin };
|
|
54
|
+
//# sourceMappingURL=rspack.mjs.map
|
|
55
|
+
//# sourceMappingURL=rspack.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../packages/rspack/src/index.ts"],"names":[],"mappings":";;;;;AAoBA,SAAS,UAAA,GAAqB;AAC5B,EAAA,IAAI,OAAO,cAAc,WAAA,EAAa;AACpC,IAAA,OAAO,SAAA;AAAA,EACT;AACA,EAAA,IAAI,OAAO,MAAA,CAAA,IAAA,KAAgB,WAAA,IAAe,MAAA,CAAA,IAAA,CAAY,GAAA,EAAK;AACzD,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAC,CAAA;AAAA,EACpD;AACA,EAAA,OAAO,QAAQ,GAAA,EAAI;AACrB;AAaA,IAAM,WAAA,GAAc,IAAA,CAAK,OAAA,CAAQ,UAAA,IAAc,WAAW,CAAA;AAEnD,IAAM,6BAAN,MAAiC;AAAA,EAGtC,WAAA,CAAY,IAAA,GAA4B,EAAC,EAAG;AAC1C,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AAAA,EACd;AAAA,EAEA,MAAM,QAAA,EAAqB;AACzB,IAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,OAAA,CAAQ,IAAA,KAAS,YAAA;AAExC,IAAA,MAAM,UAAA,GAAa;AAAA;AAAA,MAEjB,IAAA,EAAM,cAAA;AAAA,MACN,WAAA,EAAa,IAAA,CAAK,IAAA,CAAK,WAAA,IAAe,KAAA;AAAA;AAAA,MAEtC,eAAA,EAAiB;AAAA,KACnB;AAEA,IAAA,MAAM,OAAA,GAAU,IAAA,CAAK,IAAA,CAAK,OAAA,IAAW,YAAA;AACrC,IAAA,MAAM,OAAA,GAAU,IAAA,CAAK,IAAA,CAAK,OAAA,IAAW,cAAA;AAGrC,IAAA,MAAM,QAAA,GAAW,QAAA,CAAS,OAAA,CAAQ,MAAA,EAAQ,SAAS,EAAC;AACpD,IAAA,MAAM,oBAAoB,QAAA,CAAS,IAAA,CAAK,CAAC,CAAA,KAAW,CAAA,CAAE,gCAAgC,IAAI,CAAA;AAC1F,IAAA,IAAI,iBAAA,EAAmB;AAEvB,IAAA,MAAM,IAAA,GAAO;AAAA,MACX,2BAAA,EAA6B,IAAA;AAAA,MAC7B,IAAA,EAAM,OAAA;AAAA,MACN,OAAA;AAAA,MACA,GAAA,EAAK;AAAA,QACH;AAAA,UACE,MAAA,EAAQ,WAAA;AAAA,UACR,OAAA,EAAS;AAAA;AACX;AACF,KACF;AAEA,IAAA,QAAA,CAAS,QAAQ,MAAA,CAAO,KAAA,GAAQ,CAAC,IAAA,EAAM,GAAG,QAAQ,CAAA;AAAA,EACpD;AACF;AAEO,SAAS,0BAAA,CACd,IAAA,GAA4B,EAAC,EACD;AAC5B,EAAA,OAAO,IAAI,2BAA2B,IAAI,CAAA;AAC5C;AAEA,IAAO,WAAA,GAAQ","file":"rspack.mjs","sourcesContent":["/**\n * tailwind-styled-v4 — Rspack Plugin v5 (stable)\n *\n * Usage:\n * import { tailwindStyledRspackPlugin } from \"@tailwind-styled/rspack\"\n *\n * export default defineConfig({\n * plugins: [tailwindStyledRspackPlugin()],\n * })\n *\n * v5:\n * - Simplified API\n * - Uses @tailwind-styled/engine for build\n * - Mode always zero-runtime\n */\n\nimport path from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\n\n// ESM-compatible __dirname equivalent\nfunction getDirname(): string {\n if (typeof __dirname !== \"undefined\") {\n return __dirname\n }\n if (typeof import.meta !== \"undefined\" && import.meta.url) {\n return path.dirname(fileURLToPath(import.meta.url))\n }\n return process.cwd()\n}\n\nexport interface RspackPluginOptions {\n /** File patterns to include. Default: /\\.[jt]sx?$/ */\n include?: RegExp\n /** File patterns to exclude. Default: /node_modules/ */\n exclude?: RegExp\n /** Add data-tw debug attributes in dev. Default: true in dev */\n addDataAttr?: boolean\n /** Enable analyzer. Default: false */\n analyze?: boolean\n}\n\nconst LOADER_PATH = path.resolve(getDirname(), \"loader.js\")\n\nexport class TailwindStyledRspackPlugin {\n private opts: RspackPluginOptions\n\n constructor(opts: RspackPluginOptions = {}) {\n this.opts = opts\n }\n\n apply(compiler: any): void {\n const isDev = compiler.options.mode !== \"production\"\n\n const loaderOpts = {\n // v5: Always zero-runtime\n mode: \"zero-runtime\" as const,\n addDataAttr: this.opts.addDataAttr ?? isDev,\n // Preserve cv, cx, cn, etc — only tw.* is transformed\n preserveImports: true,\n }\n\n const include = this.opts.include ?? /\\.[jt]sx?$/\n const exclude = this.opts.exclude ?? /node_modules/\n\n // Check idempotency\n const existing = compiler.options.module?.rules ?? []\n const alreadyRegistered = existing.some((r: any) => r._tailwindStyledRspackMarker === true)\n if (alreadyRegistered) return\n\n const rule = {\n _tailwindStyledRspackMarker: true,\n test: include,\n exclude: exclude,\n use: [\n {\n loader: LOADER_PATH,\n options: loaderOpts,\n },\n ],\n }\n\n compiler.options.module.rules = [rule, ...existing]\n }\n}\n\nexport function tailwindStyledRspackPlugin(\n opts: RspackPluginOptions = {}\n): TailwindStyledRspackPlugin {\n return new TailwindStyledRspackPlugin(opts)\n}\n\nexport default tailwindStyledRspackPlugin\n"]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export { L as LiveTokenEngineBridge, a as LiveTokenSet, T as TokenMap, b as TokenSubscriber, c as applyTokenSet, d as createUseTokens, g as generateTokenCssString, e as getToken, f as getTokens, l as liveToken, h as liveTokenEngine, s as setToken, i as setTokens, j as subscribeTokens, t as tokenRef, k as tokenVar } from './liveTokenEngine-DYN3Zale.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @tailwind-styled/runtime v5
|
|
6
|
+
*
|
|
7
|
+
* Lightweight runtime helpers for compiled tailwind-styled-v5 components.
|
|
8
|
+
* Live token engine has been moved to @tailwind-styled/theme package.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
interface SubComponentDef {
|
|
12
|
+
/** HTML tag to render (default: "span") */
|
|
13
|
+
tag?: string;
|
|
14
|
+
/** Scoped CSS class generated by Rust, e.g. "Button_icon_abc123" */
|
|
15
|
+
class: string;
|
|
16
|
+
}
|
|
17
|
+
type SubComponentMap = Record<string, SubComponentDef>;
|
|
18
|
+
/**
|
|
19
|
+
* Map of prop name → CSS class appended when the prop is truthy.
|
|
20
|
+
* e.g. { fullWidth: "w-full", large: "text-lg px-6 py-3" }
|
|
21
|
+
*/
|
|
22
|
+
type ConditionalProps = Record<string, string>;
|
|
23
|
+
/**
|
|
24
|
+
* A compound styled component: base ForwardRef + attached .SubName properties.
|
|
25
|
+
* The generic params are intentionally loose so callers don't need to repeat them.
|
|
26
|
+
*/
|
|
27
|
+
type StyledComponent<S extends SubComponentMap = SubComponentMap> = React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & React.RefAttributes<HTMLElement>> & {
|
|
28
|
+
[K in keyof S]: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & React.RefAttributes<HTMLElement>>;
|
|
29
|
+
};
|
|
30
|
+
/** Metadata for one compound component produced by Rust. */
|
|
31
|
+
interface ComponentMetadata {
|
|
32
|
+
component: string;
|
|
33
|
+
tag: string;
|
|
34
|
+
baseClass: string;
|
|
35
|
+
subComponents: SubComponentMap;
|
|
36
|
+
}
|
|
37
|
+
type ClassInput = string | number | false | null | undefined | ClassInput[];
|
|
38
|
+
declare function cx(...inputs: ClassInput[]): string;
|
|
39
|
+
/**
|
|
40
|
+
* Build a compound styled React component from Rust-generated metadata.
|
|
41
|
+
*
|
|
42
|
+
* @param tag HTML element tag, e.g. "button" | "div"
|
|
43
|
+
* @param baseClass Scoped base class from Rust, e.g. "Button_abc123"
|
|
44
|
+
* @param subComponents Map of subcomponent definitions (optional)
|
|
45
|
+
* @param conditionals Map of prop name → CSS class (optional)
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* // Injected automatically by the compiler — do not call manually
|
|
49
|
+
* const Button = createComponent("button", "Button_abc123", {
|
|
50
|
+
* icon: { tag: "span", class: "Button_icon_abc123" },
|
|
51
|
+
* text: { tag: "span", class: "Button_text_abc123" },
|
|
52
|
+
* }, { fullWidth: "w-full" })
|
|
53
|
+
*
|
|
54
|
+
* // Usage in JSX:
|
|
55
|
+
* <Button fullWidth>
|
|
56
|
+
* <Button.icon>🔍</Button.icon>
|
|
57
|
+
* <Button.text>Search</Button.text>
|
|
58
|
+
* </Button>
|
|
59
|
+
*/
|
|
60
|
+
declare function createComponent<S extends SubComponentMap = SubComponentMap>(tag: string, baseClass: string, subComponents?: S, conditionals?: ConditionalProps): StyledComponent<S>;
|
|
61
|
+
|
|
62
|
+
export { type ComponentMetadata, type ConditionalProps, type StyledComponent, type SubComponentDef, type SubComponentMap, createComponent, cx };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export { L as LiveTokenEngineBridge, a as LiveTokenSet, T as TokenMap, b as TokenSubscriber, c as applyTokenSet, d as createUseTokens, g as generateTokenCssString, e as getToken, f as getTokens, l as liveToken, h as liveTokenEngine, s as setToken, i as setTokens, j as subscribeTokens, t as tokenRef, k as tokenVar } from './liveTokenEngine-DYN3Zale.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @tailwind-styled/runtime v5
|
|
6
|
+
*
|
|
7
|
+
* Lightweight runtime helpers for compiled tailwind-styled-v5 components.
|
|
8
|
+
* Live token engine has been moved to @tailwind-styled/theme package.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
interface SubComponentDef {
|
|
12
|
+
/** HTML tag to render (default: "span") */
|
|
13
|
+
tag?: string;
|
|
14
|
+
/** Scoped CSS class generated by Rust, e.g. "Button_icon_abc123" */
|
|
15
|
+
class: string;
|
|
16
|
+
}
|
|
17
|
+
type SubComponentMap = Record<string, SubComponentDef>;
|
|
18
|
+
/**
|
|
19
|
+
* Map of prop name → CSS class appended when the prop is truthy.
|
|
20
|
+
* e.g. { fullWidth: "w-full", large: "text-lg px-6 py-3" }
|
|
21
|
+
*/
|
|
22
|
+
type ConditionalProps = Record<string, string>;
|
|
23
|
+
/**
|
|
24
|
+
* A compound styled component: base ForwardRef + attached .SubName properties.
|
|
25
|
+
* The generic params are intentionally loose so callers don't need to repeat them.
|
|
26
|
+
*/
|
|
27
|
+
type StyledComponent<S extends SubComponentMap = SubComponentMap> = React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & React.RefAttributes<HTMLElement>> & {
|
|
28
|
+
[K in keyof S]: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & React.RefAttributes<HTMLElement>>;
|
|
29
|
+
};
|
|
30
|
+
/** Metadata for one compound component produced by Rust. */
|
|
31
|
+
interface ComponentMetadata {
|
|
32
|
+
component: string;
|
|
33
|
+
tag: string;
|
|
34
|
+
baseClass: string;
|
|
35
|
+
subComponents: SubComponentMap;
|
|
36
|
+
}
|
|
37
|
+
type ClassInput = string | number | false | null | undefined | ClassInput[];
|
|
38
|
+
declare function cx(...inputs: ClassInput[]): string;
|
|
39
|
+
/**
|
|
40
|
+
* Build a compound styled React component from Rust-generated metadata.
|
|
41
|
+
*
|
|
42
|
+
* @param tag HTML element tag, e.g. "button" | "div"
|
|
43
|
+
* @param baseClass Scoped base class from Rust, e.g. "Button_abc123"
|
|
44
|
+
* @param subComponents Map of subcomponent definitions (optional)
|
|
45
|
+
* @param conditionals Map of prop name → CSS class (optional)
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* // Injected automatically by the compiler — do not call manually
|
|
49
|
+
* const Button = createComponent("button", "Button_abc123", {
|
|
50
|
+
* icon: { tag: "span", class: "Button_icon_abc123" },
|
|
51
|
+
* text: { tag: "span", class: "Button_text_abc123" },
|
|
52
|
+
* }, { fullWidth: "w-full" })
|
|
53
|
+
*
|
|
54
|
+
* // Usage in JSX:
|
|
55
|
+
* <Button fullWidth>
|
|
56
|
+
* <Button.icon>🔍</Button.icon>
|
|
57
|
+
* <Button.text>Search</Button.text>
|
|
58
|
+
* </Button>
|
|
59
|
+
*/
|
|
60
|
+
declare function createComponent<S extends SubComponentMap = SubComponentMap>(tag: string, baseClass: string, subComponents?: S, conditionals?: ConditionalProps): StyledComponent<S>;
|
|
61
|
+
|
|
62
|
+
export { type ComponentMetadata, type ConditionalProps, type StyledComponent, type SubComponentDef, type SubComponentMap, createComponent, cx };
|