tailwind-styled-v4 5.1.21 → 5.1.23

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.
Files changed (62) hide show
  1. package/README.md +216 -0
  2. package/dist/atomic.js +34 -4
  3. package/dist/atomic.js.map +1 -1
  4. package/dist/atomic.mjs +31 -2
  5. package/dist/atomic.mjs.map +1 -1
  6. package/dist/cli.d.mts +28 -16
  7. package/dist/cli.d.ts +28 -16
  8. package/dist/cli.js +392 -77
  9. package/dist/cli.js.map +1 -1
  10. package/dist/cli.mjs +388 -75
  11. package/dist/cli.mjs.map +1 -1
  12. package/dist/compiler.d.mts +195 -1
  13. package/dist/compiler.d.ts +195 -1
  14. package/dist/compiler.js +356 -12
  15. package/dist/compiler.js.map +1 -1
  16. package/dist/compiler.mjs +340 -10
  17. package/dist/compiler.mjs.map +1 -1
  18. package/dist/engine.js +194 -164
  19. package/dist/engine.js.map +1 -1
  20. package/dist/engine.mjs +184 -155
  21. package/dist/engine.mjs.map +1 -1
  22. package/dist/index.browser.mjs +144 -14
  23. package/dist/index.browser.mjs.map +1 -1
  24. package/dist/index.d.mts +45 -4
  25. package/dist/index.d.ts +45 -4
  26. package/dist/index.js +174 -9
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +185 -21
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/next.js +489 -158
  31. package/dist/next.js.map +1 -1
  32. package/dist/next.mjs +483 -153
  33. package/dist/next.mjs.map +1 -1
  34. package/dist/runtime-css.js +1 -1
  35. package/dist/runtime-css.js.map +1 -1
  36. package/dist/runtime-css.mjs +1 -1
  37. package/dist/runtime-css.mjs.map +1 -1
  38. package/dist/runtime.js +17 -0
  39. package/dist/runtime.js.map +1 -1
  40. package/dist/runtime.mjs +23 -0
  41. package/dist/runtime.mjs.map +1 -1
  42. package/dist/shared.js +91 -61
  43. package/dist/shared.js.map +1 -1
  44. package/dist/shared.mjs +85 -56
  45. package/dist/shared.mjs.map +1 -1
  46. package/dist/turbopackLoader.js +79 -49
  47. package/dist/turbopackLoader.js.map +1 -1
  48. package/dist/turbopackLoader.mjs +76 -47
  49. package/dist/turbopackLoader.mjs.map +1 -1
  50. package/dist/tw.js +390 -77
  51. package/dist/tw.js.map +1 -1
  52. package/dist/tw.mjs +387 -75
  53. package/dist/tw.mjs.map +1 -1
  54. package/dist/vite.js +157 -127
  55. package/dist/vite.js.map +1 -1
  56. package/dist/vite.mjs +150 -121
  57. package/dist/vite.mjs.map +1 -1
  58. package/dist/webpackLoader.js +39 -9
  59. package/dist/webpackLoader.js.map +1 -1
  60. package/dist/webpackLoader.mjs +36 -7
  61. package/dist/webpackLoader.mjs.map +1 -1
  62. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,17 +1,151 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
1
+ var __getOwnPropNames = Object.getOwnPropertyNames;
2
+ var __esm = (fn, res) => function __init() {
3
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
4
+ };
5
+ var __commonJS = (cb, mod) => function __require() {
6
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
7
+ };
8
+
9
+ // node_modules/tsup/assets/esm_shims.js
10
+ import path from "path";
11
+ import { fileURLToPath } from "url";
12
+ var init_esm_shims = __esm({
13
+ "node_modules/tsup/assets/esm_shims.js"() {
14
+ "use strict";
15
+ }
6
16
  });
7
17
 
18
+ // packages/domain/runtime-css/dist/batched.cjs
19
+ var require_batched = __commonJS({
20
+ "packages/domain/runtime-css/dist/batched.cjs"(exports, module) {
21
+ "use strict";
22
+ "use client";
23
+ init_esm_shims();
24
+ var __defProp = Object.defineProperty;
25
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
26
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
27
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
28
+ var __export = (target, all) => {
29
+ for (var name in all)
30
+ __defProp(target, name, { get: all[name], enumerable: true });
31
+ };
32
+ var __copyProps = (to, from, except, desc) => {
33
+ if (from && typeof from === "object" || typeof from === "function") {
34
+ for (let key of __getOwnPropNames2(from))
35
+ if (!__hasOwnProp.call(to, key) && key !== except)
36
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
37
+ }
38
+ return to;
39
+ };
40
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
41
+ var batchedInjector_exports = {};
42
+ __export(batchedInjector_exports, {
43
+ batchedInject: () => batchedInject,
44
+ flushBatchedCss: () => flushBatchedCss,
45
+ getBatchedCssStats: () => getBatchedCssStats,
46
+ isInjected: () => isInjected,
47
+ resetBatchedCss: () => resetBatchedCss,
48
+ syncInject: () => syncInject
49
+ });
50
+ module.exports = __toCommonJS(batchedInjector_exports);
51
+ var injected = /* @__PURE__ */ new Set();
52
+ var pending = [];
53
+ var _state = {
54
+ rafHandle: null,
55
+ styleEl: null
56
+ };
57
+ function getStyleElement() {
58
+ if (_state.styleEl && document.head.contains(_state.styleEl)) return _state.styleEl;
59
+ _state.styleEl = document.createElement("style");
60
+ _state.styleEl.id = "__tw-runtime-css";
61
+ _state.styleEl.setAttribute("data-tw-batched", "true");
62
+ document.head.appendChild(_state.styleEl);
63
+ return _state.styleEl;
64
+ }
65
+ function insertRuleToSheet(cssRule) {
66
+ const trimmed = cssRule.trim();
67
+ if (!trimmed) return;
68
+ const el = getStyleElement();
69
+ const sheet = el.sheet;
70
+ if (sheet) {
71
+ try {
72
+ sheet.insertRule(trimmed, sheet.cssRules.length);
73
+ return;
74
+ } catch {
75
+ if (process.env.NODE_ENV === "development") {
76
+ console.warn("[tw] insertRule failed, falling back to textContent append for rule:", trimmed.slice(0, 80));
77
+ }
78
+ }
79
+ }
80
+ el.textContent = (el.textContent ?? "") + `
81
+ ${trimmed}`;
82
+ }
83
+ function batchedInject(cssRule) {
84
+ if (typeof window === "undefined") return;
85
+ if (!cssRule || injected.has(cssRule)) return;
86
+ injected.add(cssRule);
87
+ pending.push(cssRule);
88
+ if (_state.rafHandle === null) {
89
+ _state.rafHandle = requestAnimationFrame(flushBatchedCss);
90
+ }
91
+ }
92
+ function flushBatchedCss() {
93
+ _state.rafHandle = null;
94
+ if (pending.length === 0 || typeof document === "undefined") return;
95
+ const rules = pending.splice(0);
96
+ for (const rule of rules) {
97
+ insertRuleToSheet(rule);
98
+ }
99
+ }
100
+ function syncInject(cssRule) {
101
+ if (typeof document === "undefined") return;
102
+ if (!cssRule || injected.has(cssRule)) return;
103
+ injected.add(cssRule);
104
+ insertRuleToSheet(cssRule);
105
+ }
106
+ function isInjected(cssRule) {
107
+ return injected.has(cssRule);
108
+ }
109
+ function resetBatchedCss() {
110
+ injected.clear();
111
+ pending.length = 0;
112
+ if (_state.rafHandle !== null) {
113
+ cancelAnimationFrame(_state.rafHandle);
114
+ _state.rafHandle = null;
115
+ }
116
+ if (typeof document !== "undefined" && _state.styleEl && document.head.contains(_state.styleEl)) {
117
+ document.head.removeChild(_state.styleEl);
118
+ _state.styleEl = null;
119
+ } else {
120
+ _state.styleEl = null;
121
+ }
122
+ }
123
+ function getBatchedCssStats() {
124
+ return {
125
+ totalInjected: injected.size,
126
+ pendingCount: pending.length,
127
+ hasBatchScheduled: _state.rafHandle !== null
128
+ };
129
+ }
130
+ }
131
+ });
132
+
133
+ // src/umbrella/index.ts
134
+ init_esm_shims();
135
+
8
136
  // packages/domain/core/src/twProxy.ts
137
+ init_esm_shims();
9
138
  import React2 from "react";
10
139
 
11
140
  // packages/domain/core/src/createComponent.ts
141
+ init_esm_shims();
12
142
  import React from "react";
13
143
 
144
+ // packages/domain/core/src/containerQuery.ts
145
+ init_esm_shims();
146
+
14
147
  // packages/domain/core/src/native.browser.ts
148
+ init_esm_shims();
15
149
  var getNativeBinding = () => null;
16
150
 
17
151
  // packages/domain/core/src/containerQuery.ts
@@ -65,7 +199,7 @@ function buildContainerRules(id, container, containerName) {
65
199
  }
66
200
  var _cqBatchedInjectFn = null;
67
201
  try {
68
- const mod = __require("@tailwind-styled/runtime-css/batched");
202
+ const mod = require_batched();
69
203
  if (typeof mod?.batchedInject === "function") _cqBatchedInjectFn = mod.batchedInject;
70
204
  } catch {
71
205
  }
@@ -139,7 +273,11 @@ function getContainerRegistry() {
139
273
  return containerRegistry;
140
274
  }
141
275
 
276
+ // packages/domain/core/src/merge.ts
277
+ init_esm_shims();
278
+
142
279
  // packages/domain/core/src/mergeFallback.ts
280
+ init_esm_shims();
143
281
  var TEXT_SIZE_SUFFIXES = /* @__PURE__ */ new Set([
144
282
  "xs",
145
283
  "sm",
@@ -455,6 +593,7 @@ function mergeWithRules(rules, ...classLists) {
455
593
  }
456
594
 
457
595
  // packages/domain/core/src/parseTemplateFallback.ts
596
+ init_esm_shims();
458
597
  var SUB_RE = /(?:\[([a-zA-Z][a-zA-Z0-9_-]*)\]|([a-zA-Z][a-zA-Z0-9_-]*))\s*\{([^}]*)\}/g;
459
598
  var COMMENT_RE = /\/\/[^\n]*/g;
460
599
  function collapseSpaces(s) {
@@ -485,6 +624,7 @@ function parseTemplateJs(raw) {
485
624
  }
486
625
 
487
626
  // packages/domain/core/src/stateEngine.ts
627
+ init_esm_shims();
488
628
  var stateRegistry = /* @__PURE__ */ new Map();
489
629
  if (typeof window !== "undefined") {
490
630
  window.__TW_STATE_REGISTRY__ = stateRegistry;
@@ -517,7 +657,7 @@ function generateStateRules(id, state) {
517
657
  var _staticCssDetected = /* @__PURE__ */ new Set();
518
658
  var _batchedInjectFn = null;
519
659
  try {
520
- const mod = __require("@tailwind-styled/runtime-css/batched");
660
+ const mod = require_batched();
521
661
  if (typeof mod?.batchedInject === "function") _batchedInjectFn = mod.batchedInject;
522
662
  } catch {
523
663
  }
@@ -714,15 +854,33 @@ function registerSubComponents(component, template, configSub) {
714
854
  value.trim().replace(/\s+/g, " "),
715
855
  tag
716
856
  );
857
+ } else if ("base" in value || "variants" in value) {
858
+ const tag = key;
859
+ for (const [componentName, subConfig] of Object.entries(value)) {
860
+ if (typeof subConfig === "string") {
861
+ map[componentName] = createSubComponentAccessor(
862
+ displayName,
863
+ componentName,
864
+ subConfig.trim().replace(/\s+/g, " "),
865
+ tag
866
+ );
867
+ } else {
868
+ map[componentName] = createComponent(tag, subConfig);
869
+ }
870
+ }
717
871
  } else {
718
872
  const tag = key;
719
- for (const [componentName, classes] of Object.entries(value)) {
720
- map[componentName] = createSubComponentAccessor(
721
- displayName,
722
- componentName,
723
- classes.trim().replace(/\s+/g, " "),
724
- tag
725
- );
873
+ for (const [componentName, classesOrConfig] of Object.entries(value)) {
874
+ if (typeof classesOrConfig === "string") {
875
+ map[componentName] = createSubComponentAccessor(
876
+ displayName,
877
+ componentName,
878
+ classesOrConfig.trim().replace(/\s+/g, " "),
879
+ tag
880
+ );
881
+ } else {
882
+ map[componentName] = createComponent(tag, classesOrConfig);
883
+ }
726
884
  }
727
885
  }
728
886
  }
@@ -1163,6 +1321,7 @@ var tw = Object.assign(twCallable, tagFactories, {
1163
1321
  });
1164
1322
 
1165
1323
  // packages/domain/core/src/cv.ts
1324
+ init_esm_shims();
1166
1325
  var __generatedRegistry = {};
1167
1326
  function registerVariantTable(componentId, table) {
1168
1327
  __generatedRegistry[componentId] = table;
@@ -1298,6 +1457,7 @@ function cv(config, componentId) {
1298
1457
  }
1299
1458
 
1300
1459
  // packages/domain/core/src/cx.ts
1460
+ init_esm_shims();
1301
1461
  function cn(...inputs) {
1302
1462
  const strings = [];
1303
1463
  for (const item of inputs) {
@@ -1334,6 +1494,7 @@ function cx(...inputs) {
1334
1494
  var cxm = cx;
1335
1495
 
1336
1496
  // packages/domain/core/src/styledSystem.ts
1497
+ init_esm_shims();
1337
1498
  function tokenVarName(prefix, group, name) {
1338
1499
  return `--${prefix}-${group}-${name}`;
1339
1500
  }
@@ -1342,8 +1503,8 @@ function tokenVarRef(prefix, group, name) {
1342
1503
  }
1343
1504
  function resolveTokenRef(tokens, prefix, value) {
1344
1505
  if (value.startsWith("token:")) {
1345
- const path = value.slice(6);
1346
- const [group, name] = path.split(".");
1506
+ const path2 = value.slice(6);
1507
+ const [group, name] = path2.split(".");
1347
1508
  if (group && name && tokens[group]?.[name] !== void 0) {
1348
1509
  return tokenVarRef(prefix, group, name);
1349
1510
  }
@@ -1458,13 +1619,13 @@ function createStyledSystem(config) {
1458
1619
  return createComponent(runtimeTag, merged);
1459
1620
  };
1460
1621
  }
1461
- function token(path) {
1462
- const [group, name] = path.split(".");
1463
- if (!group || !name) return path;
1622
+ function token(path2) {
1623
+ const [group, name] = path2.split(".");
1624
+ if (!group || !name) return path2;
1464
1625
  return tokenVarRef(prefix, group, name);
1465
1626
  }
1466
- function rawToken(path) {
1467
- const [group, name] = path.split(".");
1627
+ function rawToken(path2) {
1628
+ const [group, name] = path2.split(".");
1468
1629
  if (!group || !name) return void 0;
1469
1630
  return tokens[group]?.[name];
1470
1631
  }
@@ -1499,6 +1660,7 @@ function createStyledSystem(config) {
1499
1660
  }
1500
1661
 
1501
1662
  // packages/domain/core/src/styled.ts
1663
+ init_esm_shims();
1502
1664
  function resolveVariantClass(options, props) {
1503
1665
  const out = [];
1504
1666
  const variants = options.variants ?? {};
@@ -1530,6 +1692,7 @@ function styled(options) {
1530
1692
  }
1531
1693
 
1532
1694
  // packages/domain/core/src/twTheme.ts
1695
+ init_esm_shims();
1533
1696
  function cssVar(varName, fallback) {
1534
1697
  const name = varName.startsWith("--") ? varName : `--${varName}`;
1535
1698
  return fallback ? `var(${name}, ${fallback})` : `var(${name})`;
@@ -1595,6 +1758,7 @@ var v4Tokens = {
1595
1758
  };
1596
1759
 
1597
1760
  // packages/domain/core/src/registry.ts
1761
+ init_esm_shims();
1598
1762
  import React3 from "react";
1599
1763
  var subComponentRegistry = /* @__PURE__ */ new Map();
1600
1764
  function registerSubComponent(entry) {