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
@@ -1,8 +1,120 @@
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 __commonJS = (cb, mod) => function __require() {
3
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
4
+ };
5
+
6
+ // packages/domain/runtime-css/dist/batched.cjs
7
+ var require_batched = __commonJS({
8
+ "packages/domain/runtime-css/dist/batched.cjs"(exports, module) {
9
+ "use strict";
10
+ "use client";
11
+ var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
14
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
15
+ var __export = (target, all) => {
16
+ for (var name in all)
17
+ __defProp(target, name, { get: all[name], enumerable: true });
18
+ };
19
+ var __copyProps = (to, from, except, desc) => {
20
+ if (from && typeof from === "object" || typeof from === "function") {
21
+ for (let key of __getOwnPropNames2(from))
22
+ if (!__hasOwnProp.call(to, key) && key !== except)
23
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
+ }
25
+ return to;
26
+ };
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var batchedInjector_exports = {};
29
+ __export(batchedInjector_exports, {
30
+ batchedInject: () => batchedInject,
31
+ flushBatchedCss: () => flushBatchedCss,
32
+ getBatchedCssStats: () => getBatchedCssStats,
33
+ isInjected: () => isInjected,
34
+ resetBatchedCss: () => resetBatchedCss,
35
+ syncInject: () => syncInject
36
+ });
37
+ module.exports = __toCommonJS(batchedInjector_exports);
38
+ var injected = /* @__PURE__ */ new Set();
39
+ var pending = [];
40
+ var _state = {
41
+ rafHandle: null,
42
+ styleEl: null
43
+ };
44
+ function getStyleElement() {
45
+ if (_state.styleEl && document.head.contains(_state.styleEl)) return _state.styleEl;
46
+ _state.styleEl = document.createElement("style");
47
+ _state.styleEl.id = "__tw-runtime-css";
48
+ _state.styleEl.setAttribute("data-tw-batched", "true");
49
+ document.head.appendChild(_state.styleEl);
50
+ return _state.styleEl;
51
+ }
52
+ function insertRuleToSheet(cssRule) {
53
+ const trimmed = cssRule.trim();
54
+ if (!trimmed) return;
55
+ const el = getStyleElement();
56
+ const sheet = el.sheet;
57
+ if (sheet) {
58
+ try {
59
+ sheet.insertRule(trimmed, sheet.cssRules.length);
60
+ return;
61
+ } catch {
62
+ if (true) {
63
+ console.warn("[tw] insertRule failed, falling back to textContent append for rule:", trimmed.slice(0, 80));
64
+ }
65
+ }
66
+ }
67
+ el.textContent = (el.textContent ?? "") + `
68
+ ${trimmed}`;
69
+ }
70
+ function batchedInject(cssRule) {
71
+ if (typeof window === "undefined") return;
72
+ if (!cssRule || injected.has(cssRule)) return;
73
+ injected.add(cssRule);
74
+ pending.push(cssRule);
75
+ if (_state.rafHandle === null) {
76
+ _state.rafHandle = requestAnimationFrame(flushBatchedCss);
77
+ }
78
+ }
79
+ function flushBatchedCss() {
80
+ _state.rafHandle = null;
81
+ if (pending.length === 0 || typeof document === "undefined") return;
82
+ const rules = pending.splice(0);
83
+ for (const rule of rules) {
84
+ insertRuleToSheet(rule);
85
+ }
86
+ }
87
+ function syncInject(cssRule) {
88
+ if (typeof document === "undefined") return;
89
+ if (!cssRule || injected.has(cssRule)) return;
90
+ injected.add(cssRule);
91
+ insertRuleToSheet(cssRule);
92
+ }
93
+ function isInjected(cssRule) {
94
+ return injected.has(cssRule);
95
+ }
96
+ function resetBatchedCss() {
97
+ injected.clear();
98
+ pending.length = 0;
99
+ if (_state.rafHandle !== null) {
100
+ cancelAnimationFrame(_state.rafHandle);
101
+ _state.rafHandle = null;
102
+ }
103
+ if (typeof document !== "undefined" && _state.styleEl && document.head.contains(_state.styleEl)) {
104
+ document.head.removeChild(_state.styleEl);
105
+ _state.styleEl = null;
106
+ } else {
107
+ _state.styleEl = null;
108
+ }
109
+ }
110
+ function getBatchedCssStats() {
111
+ return {
112
+ totalInjected: injected.size,
113
+ pendingCount: pending.length,
114
+ hasBatchScheduled: _state.rafHandle !== null
115
+ };
116
+ }
117
+ }
6
118
  });
7
119
 
8
120
  // packages/domain/core/src/twProxy.ts
@@ -65,7 +177,7 @@ function buildContainerRules(id, container, containerName) {
65
177
  }
66
178
  var _cqBatchedInjectFn = null;
67
179
  try {
68
- const mod = __require("@tailwind-styled/runtime-css/batched");
180
+ const mod = require_batched();
69
181
  if (typeof mod?.batchedInject === "function") _cqBatchedInjectFn = mod.batchedInject;
70
182
  } catch {
71
183
  }
@@ -517,7 +629,7 @@ function generateStateRules(id, state) {
517
629
  var _staticCssDetected = /* @__PURE__ */ new Set();
518
630
  var _batchedInjectFn = null;
519
631
  try {
520
- const mod = __require("@tailwind-styled/runtime-css/batched");
632
+ const mod = require_batched();
521
633
  if (typeof mod?.batchedInject === "function") _batchedInjectFn = mod.batchedInject;
522
634
  } catch {
523
635
  }
@@ -714,15 +826,21 @@ function registerSubComponents(component, template, configSub) {
714
826
  value.trim().replace(/\s+/g, " "),
715
827
  tag
716
828
  );
829
+ } else if ("base" in value || "variants" in value) {
830
+ map[key] = createComponent("div", value);
717
831
  } else {
718
832
  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
- );
833
+ for (const [componentName, classesOrConfig] of Object.entries(value)) {
834
+ if (typeof classesOrConfig === "string") {
835
+ map[componentName] = createSubComponentAccessor(
836
+ displayName,
837
+ componentName,
838
+ classesOrConfig.trim().replace(/\s+/g, " "),
839
+ tag
840
+ );
841
+ } else {
842
+ map[componentName] = createComponent(tag, classesOrConfig);
843
+ }
726
844
  }
727
845
  }
728
846
  }
@@ -965,6 +1083,10 @@ var SKIP_PROXY_KEYS = /* @__PURE__ */ new Set([
965
1083
  ]);
966
1084
  function wrapWithSubProxy(component, tagLabel) {
967
1085
  return new Proxy(component, {
1086
+ // Forward function calls to target component
1087
+ apply(target, thisArg, args) {
1088
+ return Reflect.apply(target, thisArg, args);
1089
+ },
968
1090
  get(target, prop) {
969
1091
  const value = target[prop];
970
1092
  if (value !== void 0) return value;