boss-css 0.0.1 → 0.0.3

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