boss-css 0.0.1 → 0.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.
Files changed (268) hide show
  1. package/README.md +1 -0
  2. package/dist/_virtual/rolldown_runtime.cjs +43 -0
  3. package/dist/_virtual/rolldown_runtime.mjs +20 -0
  4. package/dist/api/browser.cjs +54 -0
  5. package/dist/api/browser.mjs +48 -0
  6. package/dist/api/config.cjs +94 -0
  7. package/dist/api/config.mjs +91 -0
  8. package/dist/api/css.cjs +304 -0
  9. package/dist/api/css.mjs +303 -0
  10. package/dist/api/dictionary.cjs +218 -0
  11. package/dist/api/dictionary.mjs +215 -0
  12. package/dist/api/file/dts.cjs +21 -0
  13. package/dist/api/file/dts.mjs +21 -0
  14. package/dist/api/file/file.cjs +123 -0
  15. package/dist/api/file/file.mjs +120 -0
  16. package/dist/api/file/js.cjs +118 -0
  17. package/dist/api/file/js.mjs +116 -0
  18. package/dist/api/names.cjs +52 -0
  19. package/dist/api/names.mjs +46 -0
  20. package/dist/api/noopCss.cjs +37 -0
  21. package/dist/api/noopCss.mjs +36 -0
  22. package/dist/api/propTree.cjs +54 -0
  23. package/dist/api/propTree.mjs +48 -0
  24. package/dist/api/server.cjs +112 -0
  25. package/dist/api/server.mjs +106 -0
  26. package/dist/cli/build.cjs +1 -0
  27. package/dist/cli/build.mjs +3 -0
  28. package/dist/cli/index.cjs +30 -0
  29. package/dist/cli/index.mjs +29 -0
  30. package/dist/cli/tasks/build.cjs +24 -0
  31. package/dist/cli/tasks/build.mjs +23 -0
  32. package/dist/cli/tasks/choose.cjs +47 -0
  33. package/dist/cli/tasks/choose.mjs +46 -0
  34. package/dist/cli/tasks/compile.cjs +68 -0
  35. package/dist/cli/tasks/compile.mjs +67 -0
  36. package/dist/cli/tasks/dev.cjs +51 -0
  37. package/dist/cli/tasks/dev.mjs +48 -0
  38. package/dist/cli/tasks/init.cjs +1835 -0
  39. package/dist/cli/tasks/init.mjs +1831 -0
  40. package/dist/cli/tasks/watch.cjs +38 -0
  41. package/dist/cli/tasks/watch.mjs +37 -0
  42. package/dist/cli/templates/init.cjs +82 -0
  43. package/dist/cli/templates/init.mjs +78 -0
  44. package/dist/cli/types.cjs +13 -0
  45. package/dist/cli/types.mjs +13 -0
  46. package/dist/cli/utils.cjs +43 -0
  47. package/dist/cli/utils.mjs +41 -0
  48. package/dist/compile/classname-strategy.cjs +79 -0
  49. package/dist/compile/classname-strategy.mjs +77 -0
  50. package/dist/compile/classname.cjs +366 -0
  51. package/dist/compile/classname.mjs +360 -0
  52. package/dist/compile/index.cjs +238 -0
  53. package/dist/compile/index.mjs +235 -0
  54. package/dist/compile/jsx.cjs +803 -0
  55. package/dist/compile/jsx.mjs +800 -0
  56. package/dist/compile/prepared.cjs +88 -0
  57. package/dist/compile/prepared.mjs +87 -0
  58. package/dist/compile/runtime.cjs +33 -0
  59. package/dist/compile/runtime.mjs +32 -0
  60. package/dist/compile/transform.cjs +371 -0
  61. package/dist/compile/transform.mjs +369 -0
  62. package/dist/cx/index.cjs +93 -0
  63. package/dist/cx/index.mjs +85 -0
  64. package/dist/detect-fw/index.cjs +384 -0
  65. package/dist/detect-fw/index.mjs +379 -0
  66. package/dist/dev/client.cjs +39 -0
  67. package/dist/dev/client.mjs +38 -0
  68. package/dist/dev/plugin/browser.cjs +11 -0
  69. package/dist/dev/plugin/browser.mjs +9 -0
  70. package/dist/dev/plugin/server.cjs +86 -0
  71. package/dist/dev/plugin/server.mjs +78 -0
  72. package/dist/dev/port.cjs +46 -0
  73. package/dist/dev/port.mjs +43 -0
  74. package/dist/dev/runtime.cjs +28 -0
  75. package/dist/dev/runtime.mjs +29 -0
  76. package/dist/dev/server.cjs +808 -0
  77. package/dist/dev/server.mjs +805 -0
  78. package/dist/dev/shared.cjs +6 -0
  79. package/dist/dev/shared.mjs +5 -0
  80. package/dist/eslint-plugin/index.cjs +66 -0
  81. package/dist/eslint-plugin/index.mjs +66 -0
  82. package/dist/eslint-plugin/rules/classnames-only.cjs +68 -0
  83. package/dist/eslint-plugin/rules/classnames-only.mjs +68 -0
  84. package/dist/eslint-plugin/rules/format-classnames.cjs +137 -0
  85. package/dist/eslint-plugin/rules/format-classnames.mjs +136 -0
  86. package/dist/eslint-plugin/rules/no-unknown-classes.cjs +119 -0
  87. package/dist/eslint-plugin/rules/no-unknown-classes.mjs +119 -0
  88. package/dist/eslint-plugin/rules/prefer-classnames.cjs +69 -0
  89. package/dist/eslint-plugin/rules/prefer-classnames.mjs +69 -0
  90. package/dist/eslint-plugin/rules/prefer-token-values.cjs +197 -0
  91. package/dist/eslint-plugin/rules/prefer-token-values.mjs +197 -0
  92. package/dist/eslint-plugin/rules/props-only.cjs +115 -0
  93. package/dist/eslint-plugin/rules/props-only.mjs +115 -0
  94. package/dist/eslint-plugin/rules/redundant-cx.cjs +66 -0
  95. package/dist/eslint-plugin/rules/redundant-cx.mjs +66 -0
  96. package/dist/eslint-plugin/rules/require-prop-functions.cjs +130 -0
  97. package/dist/eslint-plugin/rules/require-prop-functions.mjs +130 -0
  98. package/dist/eslint-plugin/utils/api.cjs +30 -0
  99. package/dist/eslint-plugin/utils/api.mjs +29 -0
  100. package/dist/eslint-plugin/utils/ast.cjs +119 -0
  101. package/dist/eslint-plugin/utils/ast.mjs +112 -0
  102. package/dist/eslint-plugin/utils/boss-classes.cjs +185 -0
  103. package/dist/eslint-plugin/utils/boss-classes.mjs +175 -0
  104. package/dist/eslint-plugin/utils/defaults.cjs +99 -0
  105. package/dist/eslint-plugin/utils/defaults.mjs +93 -0
  106. package/dist/eslint-plugin/utils/format.cjs +20 -0
  107. package/dist/eslint-plugin/utils/format.mjs +19 -0
  108. package/dist/eslint-plugin/utils/order.cjs +76 -0
  109. package/dist/eslint-plugin/utils/order.mjs +76 -0
  110. package/dist/eslint-plugin/utils/property-order.cjs +449 -0
  111. package/dist/eslint-plugin/utils/property-order.mjs +448 -0
  112. package/dist/eslint-plugin/utils/static.cjs +36 -0
  113. package/dist/eslint-plugin/utils/static.mjs +35 -0
  114. package/dist/fontsource/directory.cjs +39588 -0
  115. package/dist/fontsource/directory.mjs +39587 -0
  116. package/dist/fontsource/server.cjs +291 -0
  117. package/dist/fontsource/server.mjs +282 -0
  118. package/dist/index.cjs +10 -0
  119. package/dist/index.mjs +6 -0
  120. package/dist/log/browser.cjs +28 -0
  121. package/dist/log/browser.mjs +28 -0
  122. package/dist/log/server.cjs +32 -0
  123. package/dist/log/server.mjs +30 -0
  124. package/dist/merge/index.cjs +590 -0
  125. package/dist/merge/index.mjs +586 -0
  126. package/dist/native/browser.cjs +78 -0
  127. package/dist/native/browser.mjs +77 -0
  128. package/dist/native/server.cjs +180 -0
  129. package/dist/native/server.mjs +176 -0
  130. package/dist/native/styleTypes.cjs +168 -0
  131. package/dist/native/styleTypes.mjs +164 -0
  132. package/dist/parser/classname/server.cjs +239 -0
  133. package/dist/parser/classname/server.mjs +232 -0
  134. package/dist/parser/jsx/browser.cjs +66 -0
  135. package/dist/parser/jsx/browser.mjs +63 -0
  136. package/dist/parser/jsx/extractCode.cjs +99 -0
  137. package/dist/parser/jsx/extractCode.mjs +98 -0
  138. package/dist/parser/jsx/extractPrepared.cjs +123 -0
  139. package/dist/parser/jsx/extractPrepared.mjs +122 -0
  140. package/dist/parser/jsx/extractProps.cjs +234 -0
  141. package/dist/parser/jsx/extractProps.mjs +232 -0
  142. package/dist/parser/jsx/isDOMProp.cjs +17 -0
  143. package/dist/parser/jsx/isDOMProp.mjs +15 -0
  144. package/dist/parser/jsx/native.cjs +110 -0
  145. package/dist/parser/jsx/native.mjs +108 -0
  146. package/dist/parser/jsx/runtime.cjs +4 -0
  147. package/dist/parser/jsx/runtime.mjs +3 -0
  148. package/dist/parser/jsx/server.cjs +278 -0
  149. package/dist/parser/jsx/server.mjs +268 -0
  150. package/dist/postcss/index.cjs +16 -0
  151. package/dist/postcss/index.mjs +16 -0
  152. package/dist/prop/at/runtime-only.cjs +90 -0
  153. package/dist/prop/at/runtime-only.mjs +88 -0
  154. package/dist/prop/at/server.cjs +282 -0
  155. package/dist/prop/at/server.mjs +268 -0
  156. package/dist/prop/at/shared.cjs +153 -0
  157. package/dist/prop/at/shared.mjs +144 -0
  158. package/dist/prop/bosswind/browser.cjs +18 -0
  159. package/dist/prop/bosswind/browser.mjs +16 -0
  160. package/dist/prop/bosswind/runtime-only.cjs +18 -0
  161. package/dist/prop/bosswind/runtime-only.mjs +16 -0
  162. package/dist/prop/bosswind/server.cjs +81 -0
  163. package/dist/prop/bosswind/server.mjs +72 -0
  164. package/dist/prop/bosswind/shared.cjs +861 -0
  165. package/dist/prop/bosswind/shared.mjs +855 -0
  166. package/dist/prop/bosswind/tailwind-theme.cjs +703 -0
  167. package/dist/prop/bosswind/tailwind-theme.mjs +702 -0
  168. package/dist/prop/child/runtime-only.cjs +18 -0
  169. package/dist/prop/child/runtime-only.mjs +15 -0
  170. package/dist/prop/child/server.cjs +81 -0
  171. package/dist/prop/child/server.mjs +72 -0
  172. package/dist/prop/css/getDtsTemplate.cjs +65 -0
  173. package/dist/prop/css/getDtsTemplate.mjs +63 -0
  174. package/dist/prop/css/runtime-only.cjs +14 -0
  175. package/dist/prop/css/runtime-only.mjs +13 -0
  176. package/dist/prop/css/server.cjs +99 -0
  177. package/dist/prop/css/server.mjs +90 -0
  178. package/dist/prop/pseudo/runtime-only.cjs +23 -0
  179. package/dist/prop/pseudo/runtime-only.mjs +21 -0
  180. package/dist/prop/pseudo/server.cjs +91 -0
  181. package/dist/prop/pseudo/server.mjs +82 -0
  182. package/dist/prop/pseudo/shared.cjs +61 -0
  183. package/dist/prop/pseudo/shared.mjs +60 -0
  184. package/dist/reset/server.cjs +34 -0
  185. package/dist/reset/server.mjs +26 -0
  186. package/dist/runtime/index.cjs +119 -0
  187. package/dist/runtime/index.mjs +118 -0
  188. package/dist/runtime/preact.cjs +4 -0
  189. package/dist/runtime/preact.mjs +3 -0
  190. package/dist/runtime/qwik.cjs +21 -0
  191. package/dist/runtime/qwik.mjs +18 -0
  192. package/dist/runtime/react.cjs +4 -0
  193. package/dist/runtime/react.mjs +3 -0
  194. package/dist/runtime/solid.cjs +15 -0
  195. package/dist/runtime/solid.mjs +14 -0
  196. package/dist/runtime/stencil.cjs +25 -0
  197. package/dist/runtime/stencil.mjs +21 -0
  198. package/dist/runtime/style.cjs +14 -0
  199. package/dist/runtime/style.mjs +13 -0
  200. package/dist/shared/boundaries.cjs +288 -0
  201. package/dist/shared/boundaries.mjs +285 -0
  202. package/dist/shared/customCss.cjs +212 -0
  203. package/dist/shared/customCss.mjs +211 -0
  204. package/dist/shared/debug.cjs +76 -0
  205. package/dist/shared/debug.mjs +74 -0
  206. package/dist/shared/file.cjs +21 -0
  207. package/dist/shared/file.mjs +19 -0
  208. package/dist/shared/framework.cjs +10 -0
  209. package/dist/shared/framework.mjs +9 -0
  210. package/dist/shared/json.cjs +58 -0
  211. package/dist/shared/json.mjs +57 -0
  212. package/dist/shared/types.cjs +11 -0
  213. package/dist/shared/types.mjs +10 -0
  214. package/dist/strategy/classic/runtime-only.cjs +190 -0
  215. package/dist/strategy/classic/runtime-only.mjs +186 -0
  216. package/dist/strategy/classname-first/runtime-only.cjs +138 -0
  217. package/dist/strategy/classname-first/runtime-only.mjs +134 -0
  218. package/dist/strategy/classname-first/server.cjs +139 -0
  219. package/dist/strategy/classname-first/server.mjs +133 -0
  220. package/dist/strategy/classname-only/server.cjs +43 -0
  221. package/dist/strategy/classname-only/server.mjs +35 -0
  222. package/dist/strategy/inline-first/browser.cjs +61 -0
  223. package/dist/strategy/inline-first/browser.mjs +58 -0
  224. package/dist/strategy/inline-first/runtime-only.cjs +159 -0
  225. package/dist/strategy/inline-first/runtime-only.mjs +155 -0
  226. package/dist/strategy/inline-first/server.cjs +92 -0
  227. package/dist/strategy/inline-first/server.mjs +83 -0
  228. package/dist/strategy/runtime/runtime-only.cjs +24 -0
  229. package/dist/strategy/runtime/runtime-only.mjs +22 -0
  230. package/dist/strategy/runtime/server.cjs +72 -0
  231. package/dist/strategy/runtime/server.mjs +63 -0
  232. package/dist/strategy/runtime-only/css.cjs +183 -0
  233. package/dist/strategy/runtime-only/css.mjs +181 -0
  234. package/dist/tasks/build.cjs +88 -0
  235. package/dist/tasks/build.mjs +84 -0
  236. package/dist/tasks/compile.cjs +12 -0
  237. package/dist/tasks/compile.mjs +12 -0
  238. package/dist/tasks/postcss.cjs +116 -0
  239. package/dist/tasks/postcss.mjs +113 -0
  240. package/dist/tasks/session.cjs +46 -0
  241. package/dist/tasks/session.mjs +42 -0
  242. package/dist/tasks/watch.cjs +102 -0
  243. package/dist/tasks/watch.mjs +99 -0
  244. package/dist/transform/cache.cjs +24 -0
  245. package/dist/transform/cache.mjs +21 -0
  246. package/dist/transform/processFile.cjs +26 -0
  247. package/dist/transform/processFile.mjs +24 -0
  248. package/dist/use/token/browser.cjs +65 -0
  249. package/dist/use/token/browser.mjs +61 -0
  250. package/dist/use/token/runtime-only.cjs +245 -0
  251. package/dist/use/token/runtime-only.mjs +239 -0
  252. package/dist/use/token/server.cjs +325 -0
  253. package/dist/use/token/server.mjs +313 -0
  254. package/dist/use/token/vars.cjs +47 -0
  255. package/dist/use/token/vars.mjs +46 -0
  256. package/package.json +300 -4
  257. package/src/api/config.d.ts +1 -0
  258. package/src/fontsource/types.d.ts +50 -0
  259. package/src/packages/document-create-element/createElement.browser.js +3 -0
  260. package/src/packages/document-create-element/createElement.js +7 -0
  261. package/src/packages/document-create-element/package.json +17 -0
  262. package/src/packages/is-css-prop/browser.js +13 -0
  263. package/src/packages/is-css-prop/index.js +13 -0
  264. package/src/packages/is-css-prop/package-lock.json +52 -0
  265. package/src/packages/is-css-prop/package.json +17 -0
  266. package/src/prop/css/csstype.json +4387 -0
  267. package/src/prop/css/package.json +3 -0
  268. package/src/reset/reset.css +259 -0
@@ -0,0 +1,586 @@
1
+ import isCSSProp from "@boss-css/is-css-prop";
2
+ import { merge as merge$1 } from "ts-deepmerge";
3
+
4
+ //#region src/merge/index.ts
5
+ const cssPropCache = /* @__PURE__ */ new Map();
6
+ const whitespaceRegexp = /\s/;
7
+ const borderSideVariants = [
8
+ "width",
9
+ "style",
10
+ "color"
11
+ ];
12
+ const physicalSides = [
13
+ "top",
14
+ "right",
15
+ "bottom",
16
+ "left"
17
+ ];
18
+ const logicalAxes = ["block", "inline"];
19
+ const logicalSides = logicalAxes.flatMap((axis) => [`${axis}-start`, `${axis}-end`]);
20
+ const defaultConfig = {
21
+ cacheSize: 500,
22
+ sortContexts: true,
23
+ orderSensitiveContexts: ["before", "after"],
24
+ compoundContexts: ["at", "container"],
25
+ conflictMap: createDefaultConflictMap()
26
+ };
27
+ const createBossMerge = (config = {}) => {
28
+ const resolved = resolveConfig(config);
29
+ return (...classLists) => {
30
+ const classList = join(...classLists);
31
+ if (!classList) return "";
32
+ const cached = resolved.cache.get(classList);
33
+ if (cached) return cached;
34
+ const result = mergeClassList(classList, resolved);
35
+ resolved.cache.set(classList, result);
36
+ return result;
37
+ };
38
+ };
39
+ const join = (...classLists) => {
40
+ let index = 0;
41
+ let argument;
42
+ let resolvedValue;
43
+ let string = "";
44
+ while (index < classLists.length) if (argument = classLists[index++]) {
45
+ if (resolvedValue = toValue(argument)) {
46
+ string && (string += " ");
47
+ string += resolvedValue;
48
+ }
49
+ }
50
+ return string;
51
+ };
52
+ const defaultMerge = createBossMerge();
53
+ const merge = (...inputs) => {
54
+ const objects = inputs.filter(isPlainObject);
55
+ const nonObjects = inputs.filter((input) => input != null && !isPlainObject(input));
56
+ if (objects.length && nonObjects.length) throw new Error("boss-css/merge: cannot mix object inputs with className values");
57
+ if (objects.length) return merge$1(...objects);
58
+ return defaultMerge(...inputs);
59
+ };
60
+ function resolveConfig(config) {
61
+ const cacheSize = config.cacheSize ?? defaultConfig.cacheSize;
62
+ const sortContexts = config.sortContexts ?? defaultConfig.sortContexts;
63
+ const orderSensitiveContexts = config.orderSensitiveContexts ?? defaultConfig.orderSensitiveContexts;
64
+ const compoundContexts = config.compoundContexts ?? defaultConfig.compoundContexts;
65
+ const conflictMap = normalizeConflictMap(config.conflictMap ? {
66
+ ...defaultConfig.conflictMap,
67
+ ...config.conflictMap
68
+ } : defaultConfig.conflictMap);
69
+ return {
70
+ cacheSize,
71
+ sortContexts,
72
+ orderSensitiveContexts,
73
+ orderSensitiveSet: new Set(orderSensitiveContexts),
74
+ compoundContexts,
75
+ compoundContextSet: new Set(compoundContexts),
76
+ conflictMap,
77
+ cache: createLruCache(cacheSize)
78
+ };
79
+ }
80
+ const mergeClassList = (classList, config) => {
81
+ const tokens = splitSelectors(classList);
82
+ const parsedTokens = [];
83
+ const lastIndexByKey = /* @__PURE__ */ new Map();
84
+ for (const token of tokens.flatMap(expandGroupedSelector)) {
85
+ const conflictKeys = getConflictKeys(token, config);
86
+ if (conflictKeys) {
87
+ for (const key of conflictKeys) {
88
+ const previousIndex = lastIndexByKey.get(key);
89
+ if (previousIndex !== void 0) parsedTokens[previousIndex] = { value: "" };
90
+ }
91
+ for (const key of conflictKeys) lastIndexByKey.set(key, parsedTokens.length);
92
+ }
93
+ parsedTokens.push({ value: token });
94
+ }
95
+ return parsedTokens.filter((entry) => entry.value).map((entry) => entry.value).join(" ");
96
+ };
97
+ const toValue = (mix) => {
98
+ if (!mix) return "";
99
+ if (typeof mix === "string") return mix;
100
+ if (typeof mix === "object" && Array.isArray(mix)) {
101
+ let resolvedValue;
102
+ let string = "";
103
+ for (let k = 0; k < mix.length; k++) if (mix[k]) {
104
+ if (resolvedValue = toValue(mix[k])) {
105
+ string && (string += " ");
106
+ string += resolvedValue;
107
+ }
108
+ }
109
+ return string;
110
+ }
111
+ return "";
112
+ };
113
+ const splitSelectors = (input) => {
114
+ const results = [];
115
+ let current = "";
116
+ let braceDepth = 0;
117
+ let bracketDepth = 0;
118
+ for (const char of input) {
119
+ if (char === "{") braceDepth += 1;
120
+ if (char === "}") braceDepth = Math.max(0, braceDepth - 1);
121
+ if (char === "[") bracketDepth += 1;
122
+ if (char === "]") bracketDepth = Math.max(0, bracketDepth - 1);
123
+ if (braceDepth === 0 && bracketDepth === 0 && whitespaceRegexp.test(char)) {
124
+ if (current) results.push(current);
125
+ current = "";
126
+ continue;
127
+ }
128
+ current += char;
129
+ }
130
+ if (current) results.push(current);
131
+ return results;
132
+ };
133
+ const expandGroupedSelector = (selector) => {
134
+ const grouped = parseGroupedSelector(selector);
135
+ if (!grouped) return [selector];
136
+ const nextEntries = grouped.entries.map((entry$1) => ({
137
+ name: entry$1.name,
138
+ rawValue: entry$1.rawValue
139
+ }));
140
+ if (nextEntries.length > 1) return [...nextEntries].sort((a, b) => a.name.localeCompare(b.name)).map((entry$1) => `${grouped.prefix}:${entry$1.name}:${entry$1.rawValue}`);
141
+ const [entry] = nextEntries;
142
+ return [`${grouped.prefix}:{${entry.name}:${entry.rawValue}}`];
143
+ };
144
+ const parseGroupedSelector = (selector) => {
145
+ if (!selector.endsWith("}")) return null;
146
+ const groupStart = findGroupStart(selector);
147
+ if (groupStart === -1) return null;
148
+ const prefix = selector.slice(0, groupStart);
149
+ const entries = splitOutside(selector.slice(groupStart + 2, -1), ";").map((entry) => entry.trim()).filter(Boolean).map((entry) => {
150
+ const parts = splitOnceOutside(entry, ":");
151
+ if (!parts) return null;
152
+ const [name, rawValue] = parts;
153
+ return {
154
+ name: name.trim(),
155
+ rawValue: rawValue.trim()
156
+ };
157
+ }).filter((entry) => Boolean(entry));
158
+ if (!entries.length) return null;
159
+ return {
160
+ prefix,
161
+ entries
162
+ };
163
+ };
164
+ const splitFragments = (selector) => splitOutside(selector, ":");
165
+ const splitOutside = (input, delimiter) => {
166
+ const results = [];
167
+ let current = "";
168
+ let braceDepth = 0;
169
+ let bracketDepth = 0;
170
+ for (const char of input) {
171
+ if (char === "{") braceDepth += 1;
172
+ if (char === "}") braceDepth = Math.max(0, braceDepth - 1);
173
+ if (char === "[") bracketDepth += 1;
174
+ if (char === "]") bracketDepth = Math.max(0, bracketDepth - 1);
175
+ if (char === delimiter && braceDepth === 0 && bracketDepth === 0) {
176
+ if (current) results.push(current);
177
+ current = "";
178
+ continue;
179
+ }
180
+ current += char;
181
+ }
182
+ if (current) results.push(current);
183
+ return results;
184
+ };
185
+ const splitOnceOutside = (input, delimiter) => {
186
+ let braceDepth = 0;
187
+ let bracketDepth = 0;
188
+ for (let i = 0; i < input.length; i += 1) {
189
+ const char = input[i];
190
+ if (char === "{") braceDepth += 1;
191
+ if (char === "}") braceDepth = Math.max(0, braceDepth - 1);
192
+ if (char === "[") bracketDepth += 1;
193
+ if (char === "]") bracketDepth = Math.max(0, bracketDepth - 1);
194
+ if (char === delimiter && braceDepth === 0 && bracketDepth === 0) return [input.slice(0, i), input.slice(i + 1)];
195
+ }
196
+ return null;
197
+ };
198
+ const findGroupStart = (selector) => {
199
+ let bracketDepth = 0;
200
+ for (let i = 0; i < selector.length - 1; i += 1) {
201
+ const char = selector[i];
202
+ if (char === "[") bracketDepth += 1;
203
+ if (char === "]") bracketDepth = Math.max(0, bracketDepth - 1);
204
+ if (bracketDepth === 0 && selector[i] === ":" && selector[i + 1] === "{") return i;
205
+ }
206
+ return -1;
207
+ };
208
+ const getConflictKeys = (token, config) => {
209
+ const parsed = parseToken(token);
210
+ if (!parsed) return null;
211
+ const { contexts, prop } = parsed;
212
+ const contextKey = normalizeContexts(contexts, config).join(":");
213
+ const keys = [buildKey(contextKey, prop)];
214
+ const longhands = config.conflictMap.get(prop);
215
+ if (longhands?.length) for (const longhand of longhands) keys.push(buildKey(contextKey, longhand));
216
+ return keys;
217
+ };
218
+ const parseToken = (token) => {
219
+ const grouped = parseGroupedSelector(token);
220
+ if (grouped) {
221
+ if (grouped.entries.length !== 1) return null;
222
+ const [entry] = grouped.entries;
223
+ if (!isCssPropName(entry.name)) return null;
224
+ return {
225
+ contexts: splitFragments(grouped.prefix),
226
+ prop: entry.name
227
+ };
228
+ }
229
+ const fragments = splitFragments(token);
230
+ if (fragments.length < 2) return null;
231
+ const propIndex = findFirstCssPropIndex(fragments);
232
+ if (propIndex === -1) return null;
233
+ return {
234
+ contexts: fragments.slice(0, propIndex),
235
+ prop: fragments[propIndex]
236
+ };
237
+ };
238
+ const normalizeContexts = (contexts, config) => {
239
+ const compound = combineCompoundContexts(contexts, config.compoundContextSet);
240
+ if (!config.sortContexts) return compound;
241
+ return sortContexts(compound, config.orderSensitiveSet);
242
+ };
243
+ const combineCompoundContexts = (contexts, compoundSet) => {
244
+ const combined = [];
245
+ for (let i = 0; i < contexts.length; i += 1) {
246
+ const current = contexts[i];
247
+ if (compoundSet.has(current) && contexts[i + 1]) {
248
+ combined.push(`${current}:${contexts[i + 1]}`);
249
+ i += 1;
250
+ continue;
251
+ }
252
+ combined.push(current);
253
+ }
254
+ return combined;
255
+ };
256
+ const sortContexts = (contexts, orderSensitiveSet) => {
257
+ const result = [];
258
+ let currentSegment = [];
259
+ const isOrderSensitive = (context) => {
260
+ if (orderSensitiveSet.has(context)) return true;
261
+ const base = splitFragments(context)[0];
262
+ return orderSensitiveSet.has(base);
263
+ };
264
+ for (const context of contexts) if (isOrderSensitive(context)) {
265
+ if (currentSegment.length) {
266
+ currentSegment.sort();
267
+ result.push(...currentSegment);
268
+ currentSegment = [];
269
+ }
270
+ result.push(context);
271
+ } else currentSegment.push(context);
272
+ if (currentSegment.length) {
273
+ currentSegment.sort();
274
+ result.push(...currentSegment);
275
+ }
276
+ return result;
277
+ };
278
+ const buildKey = (contexts, prop) => {
279
+ return contexts ? `${contexts}|${prop}` : `|${prop}`;
280
+ };
281
+ const findFirstCssPropIndex = (fragments) => {
282
+ for (let i = 0; i < fragments.length; i += 1) if (isCssPropName(fragments[i])) return i;
283
+ return -1;
284
+ };
285
+ const isCssPropName = (name) => {
286
+ const cached = cssPropCache.get(name);
287
+ if (cached !== void 0) return cached;
288
+ const camelName = dashToCamelCase(name);
289
+ const result = isCSSProp("div", name) || isCSSProp("div", camelName);
290
+ cssPropCache.set(name, result);
291
+ return result;
292
+ };
293
+ const dashToCamelCase = (str) => {
294
+ return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
295
+ };
296
+ function createLruCache(maxCacheSize) {
297
+ if (maxCacheSize < 1) return {
298
+ get: () => void 0,
299
+ set: () => {}
300
+ };
301
+ let cacheSize = 0;
302
+ let cache = Object.create(null);
303
+ let previousCache = Object.create(null);
304
+ const update = (key, value) => {
305
+ cache[key] = value;
306
+ cacheSize += 1;
307
+ if (cacheSize > maxCacheSize) {
308
+ cacheSize = 0;
309
+ previousCache = cache;
310
+ cache = Object.create(null);
311
+ }
312
+ };
313
+ return {
314
+ get(key) {
315
+ let value = cache[key];
316
+ if (value !== void 0) return value;
317
+ if ((value = previousCache[key]) !== void 0) {
318
+ update(key, value);
319
+ return value;
320
+ }
321
+ },
322
+ set(key, value) {
323
+ if (key in cache) cache[key] = value;
324
+ else update(key, value);
325
+ }
326
+ };
327
+ }
328
+ function createDefaultConflictMap() {
329
+ const map = {};
330
+ map.margin = unique([
331
+ ...physicalSides.map((side) => `margin-${side}`),
332
+ ...logicalAxes.map((axis) => `margin-${axis}`),
333
+ ...logicalSides.map((side) => `margin-${side}`)
334
+ ]);
335
+ map["margin-block"] = ["margin-block-start", "margin-block-end"];
336
+ map["margin-inline"] = ["margin-inline-start", "margin-inline-end"];
337
+ map.padding = unique([
338
+ ...physicalSides.map((side) => `padding-${side}`),
339
+ ...logicalAxes.map((axis) => `padding-${axis}`),
340
+ ...logicalSides.map((side) => `padding-${side}`)
341
+ ]);
342
+ map["padding-block"] = ["padding-block-start", "padding-block-end"];
343
+ map["padding-inline"] = ["padding-inline-start", "padding-inline-end"];
344
+ map.inset = unique([
345
+ "top",
346
+ "right",
347
+ "bottom",
348
+ "left",
349
+ ...logicalAxes.map((axis) => `inset-${axis}`),
350
+ ...logicalSides.map((side) => `inset-${side}`)
351
+ ]);
352
+ map["inset-block"] = ["inset-block-start", "inset-block-end"];
353
+ map["inset-inline"] = ["inset-inline-start", "inset-inline-end"];
354
+ const borderSideLonghands = (side) => borderSideVariants.map((variant) => `border-${side}-${variant}`);
355
+ const borderPhysicalSideLonghands = physicalSides.flatMap((side) => borderSideLonghands(side));
356
+ const borderLogicalSideLonghands = logicalSides.flatMap((side) => borderSideLonghands(side));
357
+ const borderAxisVariants = (axis) => borderSideVariants.map((variant) => `border-${axis}-${variant}`);
358
+ const borderAxisSides = (axis) => [`${axis}-start`, `${axis}-end`];
359
+ const borderAxisSideLonghands = (axis) => borderAxisSides(axis).flatMap((side) => borderSideLonghands(side));
360
+ const borderWidthLonghands = unique([
361
+ ...physicalSides.map((side) => `border-${side}-width`),
362
+ ...logicalSides.map((side) => `border-${side}-width`),
363
+ ...logicalAxes.map((axis) => `border-${axis}-width`),
364
+ ...logicalAxes.flatMap((axis) => borderAxisSides(axis).map((side) => `border-${side}-width`))
365
+ ]);
366
+ const borderStyleLonghands = unique([
367
+ ...physicalSides.map((side) => `border-${side}-style`),
368
+ ...logicalSides.map((side) => `border-${side}-style`),
369
+ ...logicalAxes.map((axis) => `border-${axis}-style`),
370
+ ...logicalAxes.flatMap((axis) => borderAxisSides(axis).map((side) => `border-${side}-style`))
371
+ ]);
372
+ const borderColorLonghands = unique([
373
+ ...physicalSides.map((side) => `border-${side}-color`),
374
+ ...logicalSides.map((side) => `border-${side}-color`),
375
+ ...logicalAxes.map((axis) => `border-${axis}-color`),
376
+ ...logicalAxes.flatMap((axis) => borderAxisSides(axis).map((side) => `border-${side}-color`))
377
+ ]);
378
+ map.border = unique([
379
+ ...physicalSides.map((side) => `border-${side}`),
380
+ ...logicalSides.map((side) => `border-${side}`),
381
+ ...logicalAxes.map((axis) => `border-${axis}`),
382
+ ...borderPhysicalSideLonghands,
383
+ ...borderLogicalSideLonghands,
384
+ ...borderAxisVariants("block"),
385
+ ...borderAxisVariants("inline"),
386
+ ...borderAxisSideLonghands("block"),
387
+ ...borderAxisSideLonghands("inline"),
388
+ "border-width",
389
+ "border-style",
390
+ "border-color"
391
+ ]);
392
+ map["border-top"] = borderSideLonghands("top");
393
+ map["border-right"] = borderSideLonghands("right");
394
+ map["border-bottom"] = borderSideLonghands("bottom");
395
+ map["border-left"] = borderSideLonghands("left");
396
+ map["border-block"] = unique([
397
+ "border-block-start",
398
+ "border-block-end",
399
+ ...borderAxisVariants("block"),
400
+ ...borderAxisSideLonghands("block")
401
+ ]);
402
+ map["border-inline"] = unique([
403
+ "border-inline-start",
404
+ "border-inline-end",
405
+ ...borderAxisVariants("inline"),
406
+ ...borderAxisSideLonghands("inline")
407
+ ]);
408
+ map["border-block-start"] = borderSideLonghands("block-start");
409
+ map["border-block-end"] = borderSideLonghands("block-end");
410
+ map["border-inline-start"] = borderSideLonghands("inline-start");
411
+ map["border-inline-end"] = borderSideLonghands("inline-end");
412
+ map["border-width"] = borderWidthLonghands;
413
+ map["border-style"] = borderStyleLonghands;
414
+ map["border-color"] = borderColorLonghands;
415
+ map["border-block-width"] = ["border-block-start-width", "border-block-end-width"];
416
+ map["border-inline-width"] = ["border-inline-start-width", "border-inline-end-width"];
417
+ map["border-block-style"] = ["border-block-start-style", "border-block-end-style"];
418
+ map["border-inline-style"] = ["border-inline-start-style", "border-inline-end-style"];
419
+ map["border-block-color"] = ["border-block-start-color", "border-block-end-color"];
420
+ map["border-inline-color"] = ["border-inline-start-color", "border-inline-end-color"];
421
+ map["border-radius"] = [
422
+ "border-top-left-radius",
423
+ "border-top-right-radius",
424
+ "border-bottom-right-radius",
425
+ "border-bottom-left-radius",
426
+ "border-start-start-radius",
427
+ "border-start-end-radius",
428
+ "border-end-start-radius",
429
+ "border-end-end-radius"
430
+ ];
431
+ map["border-image"] = [
432
+ "border-image-source",
433
+ "border-image-slice",
434
+ "border-image-width",
435
+ "border-image-outset",
436
+ "border-image-repeat"
437
+ ];
438
+ map["background"] = [
439
+ "background-color",
440
+ "background-image",
441
+ "background-position",
442
+ "background-size",
443
+ "background-repeat",
444
+ "background-origin",
445
+ "background-clip",
446
+ "background-attachment"
447
+ ];
448
+ map["background-position"] = ["background-position-x", "background-position-y"];
449
+ map["font"] = [
450
+ "font-style",
451
+ "font-variant",
452
+ "font-variant-ligatures",
453
+ "font-variant-caps",
454
+ "font-variant-numeric",
455
+ "font-variant-east-asian",
456
+ "font-weight",
457
+ "font-stretch",
458
+ "font-size",
459
+ "line-height",
460
+ "font-family"
461
+ ];
462
+ map["font-variant"] = [
463
+ "font-variant-ligatures",
464
+ "font-variant-caps",
465
+ "font-variant-numeric",
466
+ "font-variant-east-asian"
467
+ ];
468
+ map["list-style"] = [
469
+ "list-style-position",
470
+ "list-style-image",
471
+ "list-style-type"
472
+ ];
473
+ map["grid"] = [
474
+ "grid-template",
475
+ "grid-template-rows",
476
+ "grid-template-columns",
477
+ "grid-template-areas",
478
+ "grid-auto-rows",
479
+ "grid-auto-columns",
480
+ "grid-auto-flow",
481
+ "grid-row",
482
+ "grid-row-start",
483
+ "grid-row-end",
484
+ "grid-column",
485
+ "grid-column-start",
486
+ "grid-column-end",
487
+ "grid-area"
488
+ ];
489
+ map["grid-template"] = [
490
+ "grid-template-rows",
491
+ "grid-template-columns",
492
+ "grid-template-areas"
493
+ ];
494
+ map["grid-row"] = ["grid-row-start", "grid-row-end"];
495
+ map["grid-column"] = ["grid-column-start", "grid-column-end"];
496
+ map["grid-area"] = [
497
+ "grid-row-start",
498
+ "grid-row-end",
499
+ "grid-column-start",
500
+ "grid-column-end"
501
+ ];
502
+ map["flex"] = [
503
+ "flex-grow",
504
+ "flex-shrink",
505
+ "flex-basis"
506
+ ];
507
+ map["flex-flow"] = ["flex-direction", "flex-wrap"];
508
+ map["gap"] = ["row-gap", "column-gap"];
509
+ map["overflow"] = ["overflow-x", "overflow-y"];
510
+ map["overscroll-behavior"] = ["overscroll-behavior-x", "overscroll-behavior-y"];
511
+ map["scroll-margin"] = unique([
512
+ ...physicalSides.map((side) => `scroll-margin-${side}`),
513
+ ...logicalAxes.map((axis) => `scroll-margin-${axis}`),
514
+ ...logicalSides.map((side) => `scroll-margin-${side}`)
515
+ ]);
516
+ map["scroll-margin-block"] = ["scroll-margin-block-start", "scroll-margin-block-end"];
517
+ map["scroll-margin-inline"] = ["scroll-margin-inline-start", "scroll-margin-inline-end"];
518
+ map["scroll-padding"] = unique([
519
+ ...physicalSides.map((side) => `scroll-padding-${side}`),
520
+ ...logicalAxes.map((axis) => `scroll-padding-${axis}`),
521
+ ...logicalSides.map((side) => `scroll-padding-${side}`)
522
+ ]);
523
+ map["scroll-padding-block"] = ["scroll-padding-block-start", "scroll-padding-block-end"];
524
+ map["scroll-padding-inline"] = ["scroll-padding-inline-start", "scroll-padding-inline-end"];
525
+ map["place-content"] = ["align-content", "justify-content"];
526
+ map["place-items"] = ["align-items", "justify-items"];
527
+ map["place-self"] = ["align-self", "justify-self"];
528
+ map["column-rule"] = [
529
+ "column-rule-width",
530
+ "column-rule-style",
531
+ "column-rule-color"
532
+ ];
533
+ map["columns"] = ["column-width", "column-count"];
534
+ map["text-decoration"] = [
535
+ "text-decoration-line",
536
+ "text-decoration-style",
537
+ "text-decoration-color",
538
+ "text-decoration-thickness",
539
+ "text-decoration-skip-ink"
540
+ ];
541
+ map["text-emphasis"] = [
542
+ "text-emphasis-style",
543
+ "text-emphasis-color",
544
+ "text-emphasis-position"
545
+ ];
546
+ map["transition"] = [
547
+ "transition-property",
548
+ "transition-duration",
549
+ "transition-timing-function",
550
+ "transition-delay",
551
+ "transition-behavior"
552
+ ];
553
+ map["animation"] = [
554
+ "animation-name",
555
+ "animation-duration",
556
+ "animation-timing-function",
557
+ "animation-delay",
558
+ "animation-iteration-count",
559
+ "animation-direction",
560
+ "animation-fill-mode",
561
+ "animation-play-state",
562
+ "animation-composition",
563
+ "animation-timeline",
564
+ "animation-range"
565
+ ];
566
+ map["outline"] = [
567
+ "outline-color",
568
+ "outline-style",
569
+ "outline-width"
570
+ ];
571
+ return map;
572
+ }
573
+ function normalizeConflictMap(conflictMap) {
574
+ const normalized = /* @__PURE__ */ new Map();
575
+ for (const [key, values] of Object.entries(conflictMap)) normalized.set(key, unique(values));
576
+ return normalized;
577
+ }
578
+ function unique(items) {
579
+ return Array.from(new Set(items));
580
+ }
581
+ const isPlainObject = (value) => {
582
+ return !!value && typeof value === "object" && !Array.isArray(value);
583
+ };
584
+
585
+ //#endregion
586
+ export { createBossMerge, join, merge };
@@ -0,0 +1,78 @@
1
+ const require_use_token_runtime_only = require('../use/token/runtime-only.cjs');
2
+
3
+ //#region src/native/browser.ts
4
+ const ignoredProps = new Set([
5
+ "ref",
6
+ "children",
7
+ "as",
8
+ "className",
9
+ "css",
10
+ "child",
11
+ "at",
12
+ "pseudo"
13
+ ]);
14
+ const isNumericValue = (value) => {
15
+ if (typeof value === "number") return true;
16
+ if (typeof value !== "string") return false;
17
+ return /^-?\d+(?:\.\d+)?$/.test(value);
18
+ };
19
+ const normalizeValue = (value) => {
20
+ if (Array.isArray(value)) return value.map((entry) => normalizeValue(entry));
21
+ if (isNumericValue(value)) return typeof value === "string" ? Number(value) : value;
22
+ return value;
23
+ };
24
+ const getStyleProps = (api) => {
25
+ if (!api.nativeStyleProps) return /* @__PURE__ */ new Set();
26
+ api.nativeStylePropSet ??= new Set(api.nativeStyleProps);
27
+ return api.nativeStylePropSet;
28
+ };
29
+ const name = "native";
30
+ const onBrowserObjectStart = (api, { input, output = {} }) => {
31
+ const styleProps = getStyleProps(api);
32
+ const bossStyle = {};
33
+ let hasBossStyle = false;
34
+ for (const prop in input) {
35
+ if (ignoredProps.has(prop)) {
36
+ delete input[prop];
37
+ continue;
38
+ }
39
+ if (prop === "style") {
40
+ output.style = input[prop];
41
+ delete input[prop];
42
+ continue;
43
+ }
44
+ if (!styleProps.has(prop)) {
45
+ output[prop] = input[prop];
46
+ delete input[prop];
47
+ continue;
48
+ }
49
+ let value = input[prop];
50
+ if (typeof value === "function") value = value();
51
+ const token = require_use_token_runtime_only.resolveRuntimeToken(api, prop, value);
52
+ if (token) value = token.value;
53
+ bossStyle[prop] = normalizeValue(value);
54
+ hasBossStyle = true;
55
+ delete input[prop];
56
+ }
57
+ if (!hasBossStyle) return;
58
+ if (!output.style) {
59
+ output.style = bossStyle;
60
+ return;
61
+ }
62
+ if (Array.isArray(output.style)) {
63
+ output.style = [...output.style, bossStyle];
64
+ return;
65
+ }
66
+ if (typeof output.style === "object") {
67
+ output.style = {
68
+ ...output.style,
69
+ ...bossStyle
70
+ };
71
+ return;
72
+ }
73
+ output.style = [output.style, bossStyle];
74
+ };
75
+
76
+ //#endregion
77
+ exports.name = name;
78
+ exports.onBrowserObjectStart = onBrowserObjectStart;