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,861 @@
1
+
2
+ //#region src/prop/bosswind/shared.ts
3
+ const toDashCase = (value) => value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
4
+ const displayKeywords = new Map([
5
+ ["block", "block"],
6
+ ["inline", "inline"],
7
+ ["inlineBlock", "inline-block"],
8
+ ["inlineFlex", "inline-flex"],
9
+ ["inlineGrid", "inline-grid"],
10
+ ["contents", "contents"],
11
+ ["flowRoot", "flow-root"],
12
+ ["table", "table"],
13
+ ["inlineTable", "inline-table"],
14
+ ["tableRow", "table-row"],
15
+ ["tableCell", "table-cell"]
16
+ ]);
17
+ const positionKeywords = new Map([
18
+ ["static", "static"],
19
+ ["relative", "relative"],
20
+ ["absolute", "absolute"],
21
+ ["fixed", "fixed"],
22
+ ["sticky", "sticky"]
23
+ ]);
24
+ const booleanAliases = new Map([
25
+ ["flexRow", {
26
+ prop: "flexDirection",
27
+ value: "row"
28
+ }],
29
+ ["flexCol", {
30
+ prop: "flexDirection",
31
+ value: "column"
32
+ }],
33
+ ["flexWrap", {
34
+ prop: "flexWrap",
35
+ value: "wrap"
36
+ }],
37
+ ["flexNoWrap", {
38
+ prop: "flexWrap",
39
+ value: "nowrap"
40
+ }]
41
+ ]);
42
+ const aliasMap = new Map([
43
+ ["p", ["padding"]],
44
+ ["px", ["paddingLeft", "paddingRight"]],
45
+ ["py", ["paddingTop", "paddingBottom"]],
46
+ ["pt", ["paddingTop"]],
47
+ ["pr", ["paddingRight"]],
48
+ ["pb", ["paddingBottom"]],
49
+ ["pl", ["paddingLeft"]],
50
+ ["m", ["margin"]],
51
+ ["mx", ["marginLeft", "marginRight"]],
52
+ ["my", ["marginTop", "marginBottom"]],
53
+ ["mt", ["marginTop"]],
54
+ ["mr", ["marginRight"]],
55
+ ["mb", ["marginBottom"]],
56
+ ["ml", ["marginLeft"]],
57
+ ["gapX", ["columnGap"]],
58
+ ["gapY", ["rowGap"]],
59
+ ["w", ["width"]],
60
+ ["h", ["height"]],
61
+ ["minW", ["minWidth"]],
62
+ ["minH", ["minHeight"]],
63
+ ["maxW", ["maxWidth"]],
64
+ ["maxH", ["maxHeight"]],
65
+ ["inset", [
66
+ "top",
67
+ "right",
68
+ "bottom",
69
+ "left"
70
+ ]],
71
+ ["insetX", ["left", "right"]],
72
+ ["insetY", ["top", "bottom"]],
73
+ ["basis", ["flexBasis"]],
74
+ ["items", ["alignItems"]],
75
+ ["justify", ["justifyContent"]],
76
+ ["self", ["alignSelf"]],
77
+ ["leading", ["lineHeight"]],
78
+ ["tracking", ["letterSpacing"]],
79
+ ["z", ["zIndex"]],
80
+ ["aspect", ["aspectRatio"]]
81
+ ]);
82
+ const textAlias = "text";
83
+ const bgAlias = "bg";
84
+ const borderAlias = "border";
85
+ const axisPairs = [{
86
+ x: "translateX",
87
+ y: "translateY",
88
+ prop: "translate",
89
+ defaults: {
90
+ x: 0,
91
+ y: 0
92
+ }
93
+ }, {
94
+ x: "scaleX",
95
+ y: "scaleY",
96
+ prop: "scale",
97
+ defaults: {
98
+ x: 1,
99
+ y: 1
100
+ }
101
+ }];
102
+ const borderWidthKeywords = new Set([
103
+ "thin",
104
+ "medium",
105
+ "thick"
106
+ ]);
107
+ const toTokenPath = (value, tokens) => {
108
+ if (!tokens || !value.includes("-")) return value;
109
+ const parts = value.split("-");
110
+ if (parts.length < 2) return value;
111
+ const [prefix, ...restParts] = parts;
112
+ const suffix = restParts.join("-");
113
+ const group = tokens[prefix];
114
+ if (!group || typeof group !== "object") return value;
115
+ if (suffix in group) return `${prefix}.${suffix}`;
116
+ return value;
117
+ };
118
+ const isPlainObject = (value) => {
119
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
120
+ };
121
+ const isNumericString = (value) => /^-?\d+(?:\.\d+)?$/.test(value);
122
+ const isLengthLike = (value) => {
123
+ if (typeof value === "number") return true;
124
+ if (typeof value !== "string") return false;
125
+ if (isNumericString(value)) return true;
126
+ if (value.startsWith("calc(") || value.startsWith("clamp(") || value.startsWith("min(") || value.startsWith("max(")) return true;
127
+ return /^-?\d+(?:\.\d+)?(px|rem|em|vh|vw|vmin|vmax|ch|ex|%|pt|pc|mm|cm|in)$/.test(value);
128
+ };
129
+ const readTokenGroup = (value) => {
130
+ if (typeof value === "function" && value.IS_TOKEN_FN) {
131
+ const [group, ...rest] = String(value()).replace("$$.token.", "").split(".");
132
+ return {
133
+ group,
134
+ path: rest.join(".")
135
+ };
136
+ }
137
+ if (typeof value === "string" && value.startsWith("$$.token.")) {
138
+ const [group, ...rest] = value.replace("$$.token.", "").split(".");
139
+ return {
140
+ group,
141
+ path: rest.join(".")
142
+ };
143
+ }
144
+ return null;
145
+ };
146
+ const resolveTextTarget = (_api, value, config, tokens) => {
147
+ const tokenGroup = readTokenGroup(value);
148
+ if (tokenGroup?.group === "fontSize") return {
149
+ prop: "fontSize",
150
+ value
151
+ };
152
+ if (tokenGroup?.group === "color") return {
153
+ prop: "color",
154
+ value
155
+ };
156
+ if (typeof value === "string" && tokens?.color) {
157
+ const normalized = toTokenPath(value, tokens.color);
158
+ if (normalized !== value) return {
159
+ prop: "color",
160
+ value: normalized
161
+ };
162
+ }
163
+ if (typeof value === "string" && tokens?.fontSize) {
164
+ const normalized = toTokenPath(value, tokens.fontSize);
165
+ if (normalized !== value) return {
166
+ prop: "fontSize",
167
+ value: normalized
168
+ };
169
+ }
170
+ if (isLengthLike(value)) return {
171
+ prop: "fontSize",
172
+ value
173
+ };
174
+ if (typeof value === "string" && config.fontSizeKeys?.includes(value)) return {
175
+ prop: "fontSize",
176
+ value
177
+ };
178
+ return {
179
+ prop: "color",
180
+ value
181
+ };
182
+ };
183
+ const resolveBorderTarget = (value, config, tokens) => {
184
+ if (value === null || value === true) return {
185
+ prop: "borderWidth",
186
+ value: config.defaults?.borderWidth ?? 1
187
+ };
188
+ if (Array.isArray(value)) return null;
189
+ if (typeof value === "string" && tokens?.color) {
190
+ const normalized = toTokenPath(value, tokens.color);
191
+ if (normalized !== value) return {
192
+ prop: "borderColor",
193
+ value: normalized
194
+ };
195
+ }
196
+ if (isLengthLike(value)) return {
197
+ prop: "borderWidth",
198
+ value
199
+ };
200
+ if (typeof value === "string" && borderWidthKeywords.has(value)) return {
201
+ prop: "borderWidth",
202
+ value
203
+ };
204
+ if (typeof value === "string" && (value.includes(" ") || value.includes("_"))) return null;
205
+ return {
206
+ prop: "borderColor",
207
+ value
208
+ };
209
+ };
210
+ const resolveShadowValue = (value, config) => {
211
+ if (value === null || value === true) return config.defaults?.boxShadow ?? value;
212
+ return value;
213
+ };
214
+ const resolveRoundedValue = (value, config) => {
215
+ if (value === null || value === true) return config.defaults?.borderRadius ?? value;
216
+ return value;
217
+ };
218
+ const resolveGrowShrinkValue = (name, value) => {
219
+ if (value === null || value === true) return name === "grow" ? 1 : 1;
220
+ return value;
221
+ };
222
+ const resolveTranslateScaleValue = (value, fallback) => {
223
+ if (value === null || value === true) return fallback;
224
+ return value ?? fallback;
225
+ };
226
+ const resolveSkewAxisValue = (value, fallback) => {
227
+ if (value === null || value === true) return fallback;
228
+ if (typeof value === "number") return `${value}deg`;
229
+ if (typeof value === "string" && isNumericString(value)) return `${value}deg`;
230
+ return value;
231
+ };
232
+ const buildSkewTransform = (xValue, yValue, includeX, includeY) => {
233
+ const parts = [];
234
+ if (includeX) parts.push(`skewX(${xValue})`);
235
+ if (includeY) parts.push(`skewY(${yValue})`);
236
+ return parts.length ? parts.join(" ") : null;
237
+ };
238
+ const resolveSkewTransformValue = (xValue, yValue, includeX, includeY) => {
239
+ if (typeof xValue === "function" || typeof yValue === "function") return () => {
240
+ return buildSkewTransform(includeX ? resolveSkewAxisValue(typeof xValue === "function" ? xValue() : xValue, "0deg") : null, includeY ? resolveSkewAxisValue(typeof yValue === "function" ? yValue() : yValue, "0deg") : null, includeX, includeY);
241
+ };
242
+ return buildSkewTransform(includeX ? resolveSkewAxisValue(xValue, "0deg") : null, includeY ? resolveSkewAxisValue(yValue, "0deg") : null, includeX, includeY);
243
+ };
244
+ const bosswindProps = [
245
+ {
246
+ name: "p",
247
+ description: "Padding (all sides)."
248
+ },
249
+ {
250
+ name: "px",
251
+ description: "Padding on the x-axis (left + right)."
252
+ },
253
+ {
254
+ name: "py",
255
+ description: "Padding on the y-axis (top + bottom)."
256
+ },
257
+ {
258
+ name: "pt",
259
+ description: "Padding top."
260
+ },
261
+ {
262
+ name: "pr",
263
+ description: "Padding right."
264
+ },
265
+ {
266
+ name: "pb",
267
+ description: "Padding bottom."
268
+ },
269
+ {
270
+ name: "pl",
271
+ description: "Padding left."
272
+ },
273
+ {
274
+ name: "m",
275
+ description: "Margin (all sides)."
276
+ },
277
+ {
278
+ name: "mx",
279
+ description: "Margin on the x-axis (left + right)."
280
+ },
281
+ {
282
+ name: "my",
283
+ description: "Margin on the y-axis (top + bottom)."
284
+ },
285
+ {
286
+ name: "mt",
287
+ description: "Margin top."
288
+ },
289
+ {
290
+ name: "mr",
291
+ description: "Margin right."
292
+ },
293
+ {
294
+ name: "mb",
295
+ description: "Margin bottom."
296
+ },
297
+ {
298
+ name: "ml",
299
+ description: "Margin left."
300
+ },
301
+ {
302
+ name: "gapX",
303
+ description: "Column gap."
304
+ },
305
+ {
306
+ name: "gapY",
307
+ description: "Row gap."
308
+ },
309
+ {
310
+ name: "w",
311
+ description: "Width."
312
+ },
313
+ {
314
+ name: "h",
315
+ description: "Height."
316
+ },
317
+ {
318
+ name: "minW",
319
+ description: "Min width."
320
+ },
321
+ {
322
+ name: "minH",
323
+ description: "Min height."
324
+ },
325
+ {
326
+ name: "maxW",
327
+ description: "Max width."
328
+ },
329
+ {
330
+ name: "maxH",
331
+ description: "Max height."
332
+ },
333
+ {
334
+ name: "inset",
335
+ description: "Top, right, bottom, left."
336
+ },
337
+ {
338
+ name: "insetX",
339
+ description: "Left and right."
340
+ },
341
+ {
342
+ name: "insetY",
343
+ description: "Top and bottom."
344
+ },
345
+ {
346
+ name: "grow",
347
+ description: "Flex grow.",
348
+ single: true
349
+ },
350
+ {
351
+ name: "shrink",
352
+ description: "Flex shrink.",
353
+ single: true
354
+ },
355
+ {
356
+ name: "basis",
357
+ description: "Flex basis."
358
+ },
359
+ {
360
+ name: "items",
361
+ description: "Align items."
362
+ },
363
+ {
364
+ name: "justify",
365
+ description: "Justify content."
366
+ },
367
+ {
368
+ name: "self",
369
+ description: "Align self."
370
+ },
371
+ {
372
+ name: "leading",
373
+ description: "Line height."
374
+ },
375
+ {
376
+ name: "tracking",
377
+ description: "Letter spacing."
378
+ },
379
+ {
380
+ name: "rounded",
381
+ description: "Border radius.",
382
+ single: true
383
+ },
384
+ {
385
+ name: "shadow",
386
+ description: "Box shadow.",
387
+ single: true
388
+ },
389
+ {
390
+ name: "z",
391
+ description: "Z index."
392
+ },
393
+ {
394
+ name: "aspect",
395
+ description: "Aspect ratio."
396
+ },
397
+ {
398
+ name: "text",
399
+ description: "Text color or font size."
400
+ },
401
+ {
402
+ name: "bg",
403
+ description: "Background color."
404
+ },
405
+ {
406
+ name: "border",
407
+ description: "Border width or border color.",
408
+ single: true
409
+ },
410
+ {
411
+ name: "block",
412
+ description: "Display block.",
413
+ single: true
414
+ },
415
+ {
416
+ name: "inline",
417
+ description: "Display inline.",
418
+ single: true
419
+ },
420
+ {
421
+ name: "inlineBlock",
422
+ description: "Display inline-block.",
423
+ single: true
424
+ },
425
+ {
426
+ name: "inlineFlex",
427
+ description: "Display inline-flex.",
428
+ single: true
429
+ },
430
+ {
431
+ name: "inlineGrid",
432
+ description: "Display inline-grid.",
433
+ single: true
434
+ },
435
+ {
436
+ name: "contents",
437
+ description: "Display contents.",
438
+ single: true
439
+ },
440
+ {
441
+ name: "flowRoot",
442
+ description: "Display flow-root.",
443
+ single: true
444
+ },
445
+ {
446
+ name: "table",
447
+ description: "Display table.",
448
+ single: true
449
+ },
450
+ {
451
+ name: "inlineTable",
452
+ description: "Display inline-table.",
453
+ single: true
454
+ },
455
+ {
456
+ name: "tableRow",
457
+ description: "Display table-row.",
458
+ single: true
459
+ },
460
+ {
461
+ name: "tableCell",
462
+ description: "Display table-cell.",
463
+ single: true
464
+ },
465
+ {
466
+ name: "static",
467
+ description: "Position static.",
468
+ single: true
469
+ },
470
+ {
471
+ name: "relative",
472
+ description: "Position relative.",
473
+ single: true
474
+ },
475
+ {
476
+ name: "absolute",
477
+ description: "Position absolute.",
478
+ single: true
479
+ },
480
+ {
481
+ name: "fixed",
482
+ description: "Position fixed.",
483
+ single: true
484
+ },
485
+ {
486
+ name: "sticky",
487
+ description: "Position sticky.",
488
+ single: true
489
+ },
490
+ {
491
+ name: "flexRow",
492
+ description: "Flex direction row.",
493
+ single: true
494
+ },
495
+ {
496
+ name: "flexCol",
497
+ description: "Flex direction column.",
498
+ single: true
499
+ },
500
+ {
501
+ name: "flexWrap",
502
+ description: "Flex wrap.",
503
+ single: true
504
+ },
505
+ {
506
+ name: "flexNoWrap",
507
+ description: "Flex nowrap.",
508
+ single: true
509
+ },
510
+ {
511
+ name: "translateX",
512
+ description: "Translate x-axis."
513
+ },
514
+ {
515
+ name: "translateY",
516
+ description: "Translate y-axis."
517
+ },
518
+ {
519
+ name: "scaleX",
520
+ description: "Scale x-axis."
521
+ },
522
+ {
523
+ name: "scaleY",
524
+ description: "Scale y-axis."
525
+ },
526
+ {
527
+ name: "skewX",
528
+ description: "Skew x-axis."
529
+ },
530
+ {
531
+ name: "skewY",
532
+ description: "Skew y-axis."
533
+ }
534
+ ];
535
+ const bosswindDashAliases = new Map(bosswindProps.map((entry) => [toDashCase(entry.name), entry.name]).filter(([dashName, original]) => dashName !== original));
536
+ const normalizeBosswindName = (name) => bosswindDashAliases.get(name) ?? name;
537
+ const registerBosswindDictionary = (api) => {
538
+ for (const entry of bosswindProps) {
539
+ if (entry.name === "flex" || entry.name === "grid") continue;
540
+ const aliases = new Set([entry.name]);
541
+ const dashedAlias = toDashCase(entry.name);
542
+ if (dashedAlias !== entry.name) aliases.add(dashedAlias);
543
+ const prop = {
544
+ property: entry.name,
545
+ aliases: Array.from(aliases),
546
+ description: entry.description,
547
+ values: [],
548
+ initial: "",
549
+ isCSSProp: true,
550
+ single: entry.single === true
551
+ };
552
+ api.dictionary.set(entry.name, prop);
553
+ }
554
+ };
555
+ const cloneProp = (prop, value) => ({
556
+ ...prop,
557
+ value
558
+ });
559
+ const combineAxisValues = (xValue, yValue, defaults) => {
560
+ if (typeof xValue === "function" || typeof yValue === "function") return () => [resolveTranslateScaleValue(typeof xValue === "function" ? xValue() : xValue, defaults.x), resolveTranslateScaleValue(typeof yValue === "function" ? yValue() : yValue, defaults.y)];
561
+ return [resolveTranslateScaleValue(xValue, defaults.x), resolveTranslateScaleValue(yValue, defaults.y)];
562
+ };
563
+ const resolveAxisPairs = (entries, node) => {
564
+ const results = [];
565
+ for (const pair of axisPairs) {
566
+ if (pair.prop in node) continue;
567
+ const xIndex = entries.findIndex(([name]) => name === pair.x);
568
+ const yIndex = entries.findIndex(([name]) => name === pair.y);
569
+ if (xIndex === -1 && yIndex === -1) continue;
570
+ const emitIndex = Math.min(xIndex === -1 ? Number.POSITIVE_INFINITY : xIndex, yIndex === -1 ? Number.POSITIVE_INFINITY : yIndex);
571
+ results.push({
572
+ emitIndex,
573
+ prop: pair.prop,
574
+ x: pair.x,
575
+ y: pair.y,
576
+ defaults: pair.defaults
577
+ });
578
+ }
579
+ return results;
580
+ };
581
+ const applyAxisPairsToTree = (entries, node, output, used) => {
582
+ const pairs = resolveAxisPairs(entries, node);
583
+ if (!pairs.length) return;
584
+ for (const pair of pairs) {
585
+ if (!Number.isFinite(pair.emitIndex)) continue;
586
+ const xValue = node[pair.x]?.value ?? null;
587
+ const yValue = node[pair.y]?.value ?? null;
588
+ output[pair.prop] = cloneProp(node[pair.x] || node[pair.y], combineAxisValues(xValue, yValue, pair.defaults));
589
+ used.set(pair.x, true);
590
+ used.set(pair.y, true);
591
+ used.set(`__emit:${pair.emitIndex}:${pair.prop}`, true);
592
+ }
593
+ };
594
+ const rewriteBosswindTree = (api, tree, config, tokens) => {
595
+ let usedBosswind = false;
596
+ let usedText = false;
597
+ const rewriteNode = (node) => {
598
+ const rawEntries = Object.entries(node);
599
+ const entries = [];
600
+ const normalizedNode = {};
601
+ rawEntries.forEach(([rawName, prop]) => {
602
+ const name = normalizeBosswindName(rawName);
603
+ if (Object.prototype.hasOwnProperty.call(normalizedNode, name)) return;
604
+ normalizedNode[name] = prop;
605
+ entries.push([name, prop]);
606
+ });
607
+ const output = {};
608
+ const used = /* @__PURE__ */ new Map();
609
+ applyAxisPairsToTree(entries, normalizedNode, output, used);
610
+ const hasSkewX = Object.prototype.hasOwnProperty.call(normalizedNode, "skewX");
611
+ const hasSkewY = Object.prototype.hasOwnProperty.call(normalizedNode, "skewY");
612
+ if (!Object.prototype.hasOwnProperty.call(normalizedNode, "transform") && (hasSkewX || hasSkewY)) {
613
+ const transformValue = resolveSkewTransformValue(hasSkewX ? normalizedNode.skewX?.value ?? null : null, hasSkewY ? normalizedNode.skewY?.value ?? null : null, hasSkewX, hasSkewY);
614
+ if (transformValue) {
615
+ const sourceProp = normalizedNode.skewX || normalizedNode.skewY;
616
+ if (sourceProp) output.transform = cloneProp(sourceProp, transformValue);
617
+ used.set("skewX", true);
618
+ used.set("skewY", true);
619
+ }
620
+ }
621
+ entries.forEach(([name, prop], index) => {
622
+ if (used.get(name)) return;
623
+ if (used.get(`__emit:${index}:${name}`)) return;
624
+ if (prop?.value && isPlainObject(prop.value)) {
625
+ const nested = rewriteNode(prop.value);
626
+ if (Object.keys(nested).length) output[name] = {
627
+ ...prop,
628
+ value: nested
629
+ };
630
+ return;
631
+ }
632
+ const value = prop?.value;
633
+ if (name === "flex" || name === "grid") {
634
+ if (value === null || value === true) {
635
+ output.display = cloneProp(prop, name);
636
+ usedBosswind = true;
637
+ return;
638
+ }
639
+ output[name] = prop;
640
+ return;
641
+ }
642
+ if (displayKeywords.has(name)) {
643
+ if (value === null || value === true) {
644
+ const displayValue = displayKeywords.get(name);
645
+ if (displayValue) output.display = cloneProp(prop, displayValue);
646
+ }
647
+ usedBosswind = true;
648
+ return;
649
+ }
650
+ if (positionKeywords.has(name)) {
651
+ if (value === null || value === true) {
652
+ const positionValue = positionKeywords.get(name);
653
+ if (positionValue) output.position = cloneProp(prop, positionValue);
654
+ }
655
+ usedBosswind = true;
656
+ return;
657
+ }
658
+ if (booleanAliases.has(name)) {
659
+ if (value === null || value === true) {
660
+ const entry = booleanAliases.get(name);
661
+ if (entry) output[entry.prop] = cloneProp(prop, entry.value);
662
+ }
663
+ usedBosswind = true;
664
+ return;
665
+ }
666
+ if (name === textAlias) {
667
+ usedBosswind = true;
668
+ usedText = true;
669
+ if (value === null || value === true) return;
670
+ const resolved = resolveTextTarget(api, value, config, tokens);
671
+ output[resolved.prop] = cloneProp(prop, resolved.value);
672
+ return;
673
+ }
674
+ if (name === bgAlias) {
675
+ usedBosswind = true;
676
+ if (value === null || value === true) return;
677
+ output.backgroundColor = cloneProp(prop, typeof value === "string" && tokens?.color ? toTokenPath(value, tokens.color) : value);
678
+ return;
679
+ }
680
+ if (name === borderAlias) {
681
+ usedBosswind = true;
682
+ const resolved = resolveBorderTarget(value, config, tokens);
683
+ if (!resolved) {
684
+ output[name] = prop;
685
+ return;
686
+ }
687
+ output[resolved.prop] = cloneProp(prop, resolved.value);
688
+ return;
689
+ }
690
+ if (name === "shadow") {
691
+ usedBosswind = true;
692
+ if (value === null || value === true) output.boxShadow = cloneProp(prop, resolveShadowValue(value, config));
693
+ else output.boxShadow = prop;
694
+ return;
695
+ }
696
+ if (name === "rounded") {
697
+ usedBosswind = true;
698
+ if (value === null || value === true) output.borderRadius = cloneProp(prop, resolveRoundedValue(value, config));
699
+ else output.borderRadius = prop;
700
+ return;
701
+ }
702
+ if (name === "grow" || name === "shrink") {
703
+ usedBosswind = true;
704
+ const target = name === "grow" ? "flexGrow" : "flexShrink";
705
+ output[target] = cloneProp(prop, resolveGrowShrinkValue(name, value));
706
+ return;
707
+ }
708
+ if (aliasMap.has(name)) {
709
+ usedBosswind = true;
710
+ if (value === null || value === true) return;
711
+ const targets = aliasMap.get(name) || [];
712
+ const resolvedValue = name === "shadow" ? resolveShadowValue(value, config) : value;
713
+ targets.forEach((target) => {
714
+ output[target] = cloneProp(prop, resolvedValue);
715
+ });
716
+ return;
717
+ }
718
+ output[name] = prop;
719
+ });
720
+ return output;
721
+ };
722
+ return {
723
+ tree: rewriteNode(tree),
724
+ usedBosswind,
725
+ usedText
726
+ };
727
+ };
728
+ const applyAxisPairsToInput = (entries, input, output, used) => {
729
+ const pairs = resolveAxisPairs(entries, input);
730
+ if (!pairs.length) return;
731
+ for (const pair of pairs) {
732
+ if (!Number.isFinite(pair.emitIndex)) continue;
733
+ const xValue = input[pair.x];
734
+ const yValue = input[pair.y];
735
+ output[pair.prop] = combineAxisValues(xValue, yValue, pair.defaults);
736
+ used.set(pair.x, true);
737
+ used.set(pair.y, true);
738
+ used.set(`__emit:${pair.emitIndex}:${pair.prop}`, true);
739
+ }
740
+ };
741
+ const rewriteBosswindInput = (api, input, config) => {
742
+ const rawEntries = Object.entries(input);
743
+ const entries = [];
744
+ const normalizedInput = {};
745
+ rawEntries.forEach(([rawName, value]) => {
746
+ const name = normalizeBosswindName(rawName);
747
+ if (Object.prototype.hasOwnProperty.call(normalizedInput, name)) return;
748
+ normalizedInput[name] = value;
749
+ entries.push([name, value]);
750
+ });
751
+ const output = {};
752
+ const used = /* @__PURE__ */ new Map();
753
+ applyAxisPairsToInput(entries, normalizedInput, output, used);
754
+ const hasSkewX = Object.prototype.hasOwnProperty.call(normalizedInput, "skewX");
755
+ const hasSkewY = Object.prototype.hasOwnProperty.call(normalizedInput, "skewY");
756
+ if (!Object.prototype.hasOwnProperty.call(normalizedInput, "transform") && (hasSkewX || hasSkewY)) {
757
+ const transformValue = resolveSkewTransformValue(hasSkewX ? normalizedInput.skewX : null, hasSkewY ? normalizedInput.skewY : null, hasSkewX, hasSkewY);
758
+ if (transformValue) {
759
+ output.transform = transformValue;
760
+ used.set("skewX", true);
761
+ used.set("skewY", true);
762
+ }
763
+ }
764
+ entries.forEach(([name, value], index) => {
765
+ if (used.get(name)) return;
766
+ if (used.get(`__emit:${index}:${name}`)) return;
767
+ if (value && isPlainObject(value)) {
768
+ output[name] = rewriteBosswindInput(api, value, config);
769
+ return;
770
+ }
771
+ if (name === "flex" || name === "grid") {
772
+ if (value === null || value === true) output.display = name;
773
+ else output[name] = value;
774
+ return;
775
+ }
776
+ if (displayKeywords.has(name)) {
777
+ if (value === null || value === true) {
778
+ const displayValue = displayKeywords.get(name);
779
+ if (displayValue) output.display = displayValue;
780
+ }
781
+ return;
782
+ }
783
+ if (positionKeywords.has(name)) {
784
+ if (value === null || value === true) {
785
+ const positionValue = positionKeywords.get(name);
786
+ if (positionValue) output.position = positionValue;
787
+ }
788
+ return;
789
+ }
790
+ if (booleanAliases.has(name)) {
791
+ if (value === null || value === true) {
792
+ const entry = booleanAliases.get(name);
793
+ if (entry) output[entry.prop] = entry.value;
794
+ }
795
+ return;
796
+ }
797
+ if (name === textAlias) {
798
+ if (value === null || value === true) return;
799
+ const resolved = resolveTextTarget(api, value, config, void 0);
800
+ output[resolved.prop] = resolved.value;
801
+ return;
802
+ }
803
+ if (name === bgAlias) {
804
+ if (value === null || value === true) return;
805
+ output.backgroundColor = value;
806
+ return;
807
+ }
808
+ if (name === borderAlias) {
809
+ const resolved = resolveBorderTarget(value, config, void 0);
810
+ if (!resolved) {
811
+ output[name] = value;
812
+ return;
813
+ }
814
+ output[resolved.prop] = resolved.value;
815
+ return;
816
+ }
817
+ if (name === "shadow") {
818
+ output.boxShadow = resolveShadowValue(value, config);
819
+ return;
820
+ }
821
+ if (name === "rounded") {
822
+ output.borderRadius = resolveRoundedValue(value, config);
823
+ return;
824
+ }
825
+ if (name === "grow" || name === "shrink") {
826
+ output[name === "grow" ? "flexGrow" : "flexShrink"] = resolveGrowShrinkValue(name, value);
827
+ return;
828
+ }
829
+ if (aliasMap.has(name)) {
830
+ if (value === null || value === true) return;
831
+ (aliasMap.get(name) || []).forEach((target) => {
832
+ output[target] = value;
833
+ });
834
+ return;
835
+ }
836
+ output[name] = value;
837
+ });
838
+ return output;
839
+ };
840
+ const getBosswindDefaults = (theme) => {
841
+ const borderRadius = theme.borderRadius?.DEFAULT;
842
+ const boxShadow = theme.boxShadow?.DEFAULT;
843
+ const borderWidth = theme.borderWidth?.DEFAULT;
844
+ return {
845
+ borderRadius: borderRadius ?? "0.25rem",
846
+ boxShadow: boxShadow ?? "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
847
+ borderWidth: borderWidth ?? 1
848
+ };
849
+ };
850
+ const getBosswindFontSizeKeys = (theme) => {
851
+ const fontSize = theme.fontSize;
852
+ return fontSize ? Object.keys(fontSize) : [];
853
+ };
854
+
855
+ //#endregion
856
+ exports.bosswindProps = bosswindProps;
857
+ exports.getBosswindDefaults = getBosswindDefaults;
858
+ exports.getBosswindFontSizeKeys = getBosswindFontSizeKeys;
859
+ exports.registerBosswindDictionary = registerBosswindDictionary;
860
+ exports.rewriteBosswindInput = rewriteBosswindInput;
861
+ exports.rewriteBosswindTree = rewriteBosswindTree;