tailwind-styled-v4 5.1.22 → 5.1.24

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 (61) 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.js +132 -97
  7. package/dist/cli.js.map +1 -1
  8. package/dist/cli.mjs +129 -95
  9. package/dist/cli.mjs.map +1 -1
  10. package/dist/compiler.d.mts +195 -1
  11. package/dist/compiler.d.ts +195 -1
  12. package/dist/compiler.js +356 -12
  13. package/dist/compiler.js.map +1 -1
  14. package/dist/compiler.mjs +340 -10
  15. package/dist/compiler.mjs.map +1 -1
  16. package/dist/engine.js +194 -164
  17. package/dist/engine.js.map +1 -1
  18. package/dist/engine.mjs +184 -155
  19. package/dist/engine.mjs.map +1 -1
  20. package/dist/index.browser.mjs +136 -14
  21. package/dist/index.browser.mjs.map +1 -1
  22. package/dist/index.d.mts +45 -4
  23. package/dist/index.d.ts +45 -4
  24. package/dist/index.js +166 -9
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.mjs +177 -21
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/next.js +489 -158
  29. package/dist/next.js.map +1 -1
  30. package/dist/next.mjs +483 -153
  31. package/dist/next.mjs.map +1 -1
  32. package/dist/runtime-css.js +1 -1
  33. package/dist/runtime-css.js.map +1 -1
  34. package/dist/runtime-css.mjs +1 -1
  35. package/dist/runtime-css.mjs.map +1 -1
  36. package/dist/runtime.js +17 -0
  37. package/dist/runtime.js.map +1 -1
  38. package/dist/runtime.mjs +23 -0
  39. package/dist/runtime.mjs.map +1 -1
  40. package/dist/shared.js +91 -61
  41. package/dist/shared.js.map +1 -1
  42. package/dist/shared.mjs +85 -56
  43. package/dist/shared.mjs.map +1 -1
  44. package/dist/turbopackLoader.js +79 -49
  45. package/dist/turbopackLoader.js.map +1 -1
  46. package/dist/turbopackLoader.mjs +76 -47
  47. package/dist/turbopackLoader.mjs.map +1 -1
  48. package/dist/tw.js +132 -97
  49. package/dist/tw.js.map +1 -1
  50. package/dist/tw.mjs +129 -95
  51. package/dist/tw.mjs.map +1 -1
  52. package/dist/vite.js +157 -127
  53. package/dist/vite.js.map +1 -1
  54. package/dist/vite.mjs +150 -121
  55. package/dist/vite.mjs.map +1 -1
  56. package/dist/webpackLoader.js +39 -9
  57. package/dist/webpackLoader.js.map +1 -1
  58. package/dist/webpackLoader.mjs +36 -7
  59. package/dist/webpackLoader.mjs.map +1 -1
  60. package/package.json +1 -1
  61. package/CHANGELOG.md +0 -182
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,21 @@ 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
+ map[key] = createComponent("div", value);
717
859
  } else {
718
860
  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
- );
861
+ for (const [componentName, classesOrConfig] of Object.entries(value)) {
862
+ if (typeof classesOrConfig === "string") {
863
+ map[componentName] = createSubComponentAccessor(
864
+ displayName,
865
+ componentName,
866
+ classesOrConfig.trim().replace(/\s+/g, " "),
867
+ tag
868
+ );
869
+ } else {
870
+ map[componentName] = createComponent(tag, classesOrConfig);
871
+ }
726
872
  }
727
873
  }
728
874
  }
@@ -965,6 +1111,10 @@ var SKIP_PROXY_KEYS = /* @__PURE__ */ new Set([
965
1111
  ]);
966
1112
  function wrapWithSubProxy(component, tagLabel) {
967
1113
  return new Proxy(component, {
1114
+ // Forward function calls to target component
1115
+ apply(target, thisArg, args) {
1116
+ return Reflect.apply(target, thisArg, args);
1117
+ },
968
1118
  get(target, prop) {
969
1119
  const value = target[prop];
970
1120
  if (value !== void 0) return value;
@@ -1163,6 +1313,7 @@ var tw = Object.assign(twCallable, tagFactories, {
1163
1313
  });
1164
1314
 
1165
1315
  // packages/domain/core/src/cv.ts
1316
+ init_esm_shims();
1166
1317
  var __generatedRegistry = {};
1167
1318
  function registerVariantTable(componentId, table) {
1168
1319
  __generatedRegistry[componentId] = table;
@@ -1298,6 +1449,7 @@ function cv(config, componentId) {
1298
1449
  }
1299
1450
 
1300
1451
  // packages/domain/core/src/cx.ts
1452
+ init_esm_shims();
1301
1453
  function cn(...inputs) {
1302
1454
  const strings = [];
1303
1455
  for (const item of inputs) {
@@ -1334,6 +1486,7 @@ function cx(...inputs) {
1334
1486
  var cxm = cx;
1335
1487
 
1336
1488
  // packages/domain/core/src/styledSystem.ts
1489
+ init_esm_shims();
1337
1490
  function tokenVarName(prefix, group, name) {
1338
1491
  return `--${prefix}-${group}-${name}`;
1339
1492
  }
@@ -1342,8 +1495,8 @@ function tokenVarRef(prefix, group, name) {
1342
1495
  }
1343
1496
  function resolveTokenRef(tokens, prefix, value) {
1344
1497
  if (value.startsWith("token:")) {
1345
- const path = value.slice(6);
1346
- const [group, name] = path.split(".");
1498
+ const path2 = value.slice(6);
1499
+ const [group, name] = path2.split(".");
1347
1500
  if (group && name && tokens[group]?.[name] !== void 0) {
1348
1501
  return tokenVarRef(prefix, group, name);
1349
1502
  }
@@ -1458,13 +1611,13 @@ function createStyledSystem(config) {
1458
1611
  return createComponent(runtimeTag, merged);
1459
1612
  };
1460
1613
  }
1461
- function token(path) {
1462
- const [group, name] = path.split(".");
1463
- if (!group || !name) return path;
1614
+ function token(path2) {
1615
+ const [group, name] = path2.split(".");
1616
+ if (!group || !name) return path2;
1464
1617
  return tokenVarRef(prefix, group, name);
1465
1618
  }
1466
- function rawToken(path) {
1467
- const [group, name] = path.split(".");
1619
+ function rawToken(path2) {
1620
+ const [group, name] = path2.split(".");
1468
1621
  if (!group || !name) return void 0;
1469
1622
  return tokens[group]?.[name];
1470
1623
  }
@@ -1499,6 +1652,7 @@ function createStyledSystem(config) {
1499
1652
  }
1500
1653
 
1501
1654
  // packages/domain/core/src/styled.ts
1655
+ init_esm_shims();
1502
1656
  function resolveVariantClass(options, props) {
1503
1657
  const out = [];
1504
1658
  const variants = options.variants ?? {};
@@ -1530,6 +1684,7 @@ function styled(options) {
1530
1684
  }
1531
1685
 
1532
1686
  // packages/domain/core/src/twTheme.ts
1687
+ init_esm_shims();
1533
1688
  function cssVar(varName, fallback) {
1534
1689
  const name = varName.startsWith("--") ? varName : `--${varName}`;
1535
1690
  return fallback ? `var(${name}, ${fallback})` : `var(${name})`;
@@ -1595,6 +1750,7 @@ var v4Tokens = {
1595
1750
  };
1596
1751
 
1597
1752
  // packages/domain/core/src/registry.ts
1753
+ init_esm_shims();
1598
1754
  import React3 from "react";
1599
1755
  var subComponentRegistry = /* @__PURE__ */ new Map();
1600
1756
  function registerSubComponent(entry) {