@salty-css/core 0.2.1 → 0.2.2-refactor-vite-8.4

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 (304) hide show
  1. package/dist/astro-component-Ov1RH0CO.js +4 -0
  2. package/dist/astro-component-r0qEcF1p.cjs +14 -0
  3. package/{bin → dist/bin}/bin-util.d.ts +1 -0
  4. package/dist/bin/bin-util.d.ts.map +1 -0
  5. package/{bin → dist/bin}/commands/build.d.ts +1 -0
  6. package/dist/bin/commands/build.d.ts.map +1 -0
  7. package/{bin → dist/bin}/commands/generate.d.ts +1 -0
  8. package/dist/bin/commands/generate.d.ts.map +1 -0
  9. package/{bin → dist/bin}/commands/init.d.ts +1 -0
  10. package/dist/bin/commands/init.d.ts.map +1 -0
  11. package/{bin → dist/bin}/commands/update.d.ts +1 -0
  12. package/dist/bin/commands/update.d.ts.map +1 -0
  13. package/{bin → dist/bin}/commands/version.d.ts +1 -0
  14. package/dist/bin/commands/version.d.ts.map +1 -0
  15. package/{bin → dist/bin}/confirm-install.d.ts +1 -0
  16. package/dist/bin/confirm-install.d.ts.map +1 -0
  17. package/{bin → dist/bin}/context.d.ts +1 -0
  18. package/dist/bin/context.d.ts.map +1 -0
  19. package/{bin → dist/bin}/detection/css-file.d.ts +1 -0
  20. package/dist/bin/detection/css-file.d.ts.map +1 -0
  21. package/{bin → dist/bin}/frameworks/astro.d.ts +1 -0
  22. package/dist/bin/frameworks/astro.d.ts.map +1 -0
  23. package/{bin → dist/bin}/frameworks/index.d.ts +1 -0
  24. package/dist/bin/frameworks/index.d.ts.map +1 -0
  25. package/{bin → dist/bin}/frameworks/react.d.ts +1 -0
  26. package/dist/bin/frameworks/react.d.ts.map +1 -0
  27. package/{bin → dist/bin}/frameworks/types.d.ts +1 -0
  28. package/dist/bin/frameworks/types.d.ts.map +1 -0
  29. package/dist/bin/index.cjs +2 -0
  30. package/dist/bin/index.d.ts +3 -0
  31. package/dist/bin/index.d.ts.map +1 -0
  32. package/dist/bin/index.js +5 -0
  33. package/{bin → dist/bin}/integrations/astro.d.ts +1 -0
  34. package/dist/bin/integrations/astro.d.ts.map +1 -0
  35. package/{bin → dist/bin}/integrations/eslint.d.ts +1 -0
  36. package/dist/bin/integrations/eslint.d.ts.map +1 -0
  37. package/{bin → dist/bin}/integrations/index.d.ts +1 -0
  38. package/dist/bin/integrations/index.d.ts.map +1 -0
  39. package/{bin → dist/bin}/integrations/next.d.ts +1 -0
  40. package/dist/bin/integrations/next.d.ts.map +1 -0
  41. package/{bin → dist/bin}/integrations/types.d.ts +1 -0
  42. package/dist/bin/integrations/types.d.ts.map +1 -0
  43. package/{bin → dist/bin}/integrations/vite.d.ts +1 -0
  44. package/dist/bin/integrations/vite.d.ts.map +1 -0
  45. package/{bin → dist/bin}/logger.d.ts +1 -0
  46. package/dist/bin/logger.d.ts.map +1 -0
  47. package/dist/bin/main.cjs +1 -0
  48. package/{bin → dist/bin}/main.d.ts +1 -0
  49. package/dist/bin/main.d.ts.map +1 -0
  50. package/dist/bin/main.js +2 -0
  51. package/{bin → dist/bin}/package-json.d.ts +1 -0
  52. package/dist/bin/package-json.d.ts.map +1 -0
  53. package/{bin → dist/bin}/path-defaults.d.ts +1 -0
  54. package/dist/bin/path-defaults.d.ts.map +1 -0
  55. package/{bin → dist/bin}/prettier.d.ts +1 -0
  56. package/dist/bin/prettier.d.ts.map +1 -0
  57. package/{bin → dist/bin}/saltyrc.d.ts +1 -0
  58. package/dist/bin/saltyrc.d.ts.map +1 -0
  59. package/dist/bin/templates.d.ts +15 -0
  60. package/dist/bin/templates.d.ts.map +1 -0
  61. package/dist/chunk-CMqjfN_6.cjs +1 -0
  62. package/dist/compiler/get-files.cjs +1 -0
  63. package/{compiler → dist/compiler}/get-files.d.ts +1 -0
  64. package/dist/compiler/get-files.d.ts.map +1 -0
  65. package/dist/compiler/get-files.js +15 -0
  66. package/dist/compiler/get-function-range.cjs +1 -0
  67. package/{compiler → dist/compiler}/get-function-range.d.ts +1 -0
  68. package/dist/compiler/get-function-range.d.ts.map +1 -0
  69. package/dist/compiler/get-function-range.js +17 -0
  70. package/dist/compiler/helpers.cjs +1 -0
  71. package/{compiler → dist/compiler}/helpers.d.ts +1 -0
  72. package/dist/compiler/helpers.d.ts.map +1 -0
  73. package/dist/compiler/helpers.js +24 -0
  74. package/{compiler → dist/compiler}/resolve-import.d.ts +1 -0
  75. package/dist/compiler/resolve-import.d.ts.map +1 -0
  76. package/dist/compiler/salty-compiler.cjs +1 -0
  77. package/{compiler → dist/compiler}/salty-compiler.d.ts +1 -0
  78. package/dist/compiler/salty-compiler.d.ts.map +1 -0
  79. package/dist/compiler/salty-compiler.js +2 -0
  80. package/{config → dist/config}/define-config.d.ts +1 -0
  81. package/dist/config/define-config.d.ts.map +1 -0
  82. package/dist/config/index.cjs +1 -0
  83. package/{config → dist/config}/index.d.ts +1 -0
  84. package/dist/config/index.d.ts.map +1 -0
  85. package/dist/config/index.js +5 -0
  86. package/dist/css/index.cjs +1 -0
  87. package/{css → dist/css}/index.d.ts +1 -0
  88. package/dist/css/index.d.ts.map +1 -0
  89. package/dist/css/index.js +5 -0
  90. package/dist/css/keyframes.cjs +1 -0
  91. package/{css → dist/css}/keyframes.d.ts +1 -0
  92. package/dist/css/keyframes.d.ts.map +1 -0
  93. package/dist/css/keyframes.js +30 -0
  94. package/dist/css/media.cjs +1 -0
  95. package/{css → dist/css}/media.d.ts +1 -0
  96. package/dist/css/media.d.ts.map +1 -0
  97. package/dist/css/media.js +84 -0
  98. package/dist/css/merge.cjs +1 -0
  99. package/{css → dist/css}/merge.d.ts +1 -0
  100. package/dist/css/merge.d.ts.map +1 -0
  101. package/dist/css/merge.js +20 -0
  102. package/dist/css/token.cjs +1 -0
  103. package/{css → dist/css}/token.d.ts +1 -0
  104. package/dist/css/token.d.ts.map +1 -0
  105. package/dist/css/token.js +4 -0
  106. package/{factories → dist/factories}/define-font.d.ts +1 -0
  107. package/dist/factories/define-font.d.ts.map +1 -0
  108. package/{factories → dist/factories}/define-global-styles.d.ts +1 -0
  109. package/dist/factories/define-global-styles.d.ts.map +1 -0
  110. package/{factories → dist/factories}/define-import.d.ts +1 -0
  111. package/dist/factories/define-import.d.ts.map +1 -0
  112. package/{factories → dist/factories}/define-media-query.d.ts +1 -0
  113. package/dist/factories/define-media-query.d.ts.map +1 -0
  114. package/{factories → dist/factories}/define-templates.d.ts +1 -0
  115. package/dist/factories/define-templates.d.ts.map +1 -0
  116. package/{factories → dist/factories}/define-variables.d.ts +1 -0
  117. package/dist/factories/define-variables.d.ts.map +1 -0
  118. package/dist/factories/index.cjs +1 -0
  119. package/{factories → dist/factories}/index.d.ts +1 -0
  120. package/dist/factories/index.d.ts.map +1 -0
  121. package/dist/factories/index.js +149 -0
  122. package/{generators → dist/generators}/class-name-generator.d.ts +1 -0
  123. package/dist/generators/class-name-generator.d.ts.map +1 -0
  124. package/dist/generators/index.cjs +1 -0
  125. package/{generators → dist/generators}/index.d.ts +1 -0
  126. package/dist/generators/index.d.ts.map +1 -0
  127. package/dist/generators/index.js +2 -0
  128. package/{generators → dist/generators}/styled-generator.d.ts +1 -0
  129. package/dist/generators/styled-generator.d.ts.map +1 -0
  130. package/{generators → dist/generators}/styles-generator.d.ts +1 -0
  131. package/dist/generators/styles-generator.d.ts.map +1 -0
  132. package/dist/generators-CrK45F8i.js +112 -0
  133. package/dist/generators-eEKEtyAm.cjs +1 -0
  134. package/{helpers → dist/helpers}/color.d.ts +1 -0
  135. package/dist/helpers/color.d.ts.map +1 -0
  136. package/dist/helpers/index.cjs +1 -0
  137. package/{helpers → dist/helpers}/index.d.ts +1 -0
  138. package/dist/helpers/index.d.ts.map +1 -0
  139. package/dist/helpers/index.js +33 -0
  140. package/{helpers → dist/helpers}/viewport-clamp.d.ts +1 -0
  141. package/dist/helpers/viewport-clamp.d.ts.map +1 -0
  142. package/dist/instances/classname-instance.cjs +1 -0
  143. package/{instances → dist/instances}/classname-instance.d.ts +1 -0
  144. package/dist/instances/classname-instance.d.ts.map +1 -0
  145. package/dist/instances/classname-instance.js +18 -0
  146. package/dist/main-DGpSu6zK.js +545 -0
  147. package/dist/main-LnoqOq21.cjs +11 -0
  148. package/dist/maybe.d.ts +2 -0
  149. package/dist/maybe.d.ts.map +1 -0
  150. package/dist/parse-styles-2rwbF9j_.cjs +3 -0
  151. package/dist/parse-styles-Bz0otiZ-.js +336 -0
  152. package/dist/parsers/index.cjs +3 -0
  153. package/{parsers → dist/parsers}/index.d.ts +1 -0
  154. package/dist/parsers/index.d.ts.map +1 -0
  155. package/dist/parsers/index.js +79 -0
  156. package/{parsers → dist/parsers}/parse-modifiers.d.ts +1 -0
  157. package/dist/parsers/parse-modifiers.d.ts.map +1 -0
  158. package/{parsers → dist/parsers}/parse-styles.d.ts +1 -0
  159. package/dist/parsers/parse-styles.d.ts.map +1 -0
  160. package/{parsers → dist/parsers}/parse-templates.d.ts +1 -0
  161. package/dist/parsers/parse-templates.d.ts.map +1 -0
  162. package/{parsers → dist/parsers}/parse-tokens.d.ts +1 -0
  163. package/dist/parsers/parse-tokens.d.ts.map +1 -0
  164. package/{parsers → dist/parsers}/parser-regexes.d.ts +1 -0
  165. package/dist/parsers/parser-regexes.d.ts.map +1 -0
  166. package/{parsers → dist/parsers}/parser-types.d.ts +1 -0
  167. package/dist/parsers/parser-types.d.ts.map +1 -0
  168. package/{parsers → dist/parsers}/property-name-check.d.ts +1 -0
  169. package/dist/parsers/property-name-check.d.ts.map +1 -0
  170. package/{parsers → dist/parsers}/resolve-template-variants.d.ts +1 -0
  171. package/dist/parsers/resolve-template-variants.d.ts.map +1 -0
  172. package/{parsers → dist/parsers}/strict.d.ts +1 -0
  173. package/dist/parsers/strict.d.ts.map +1 -0
  174. package/{parsers → dist/parsers}/unit-check.d.ts +1 -0
  175. package/dist/parsers/unit-check.d.ts.map +1 -0
  176. package/dist/runtime/index.cjs +2 -0
  177. package/{runtime → dist/runtime}/index.d.ts +1 -0
  178. package/dist/runtime/index.d.ts.map +1 -0
  179. package/dist/runtime/index.js +20 -0
  180. package/dist/salty-compiler-Bvd0OKHz.cjs +33 -0
  181. package/dist/salty-compiler-CvQ-rsex.js +484 -0
  182. package/dist/salty.config-B0ZiRpHR.cjs +7 -0
  183. package/dist/salty.config-DWF4i7K0.js +4 -0
  184. package/dist/server/index.cjs +1 -0
  185. package/dist/server/index.d.ts +2 -0
  186. package/dist/server/index.d.ts.map +1 -0
  187. package/dist/server/index.js +12 -0
  188. package/{server → dist/server}/should-restart.d.ts +1 -0
  189. package/dist/server/should-restart.d.ts.map +1 -0
  190. package/{styled-file-Cda3EeR6.js → dist/styled-file-BCbAEzBB.cjs} +2 -5
  191. package/dist/styled-file-C_4eLAdV.js +4 -0
  192. package/dist/styled-file-DQHLzmuL.js +4 -0
  193. package/{styled-file-DLcgYmGN.js → dist/styled-file-DorArlCk.cjs} +2 -5
  194. package/{templates → dist/templates}/salty-reset.d.ts +1 -0
  195. package/dist/templates/salty-reset.d.ts.map +1 -0
  196. package/dist/templates-BGHLaAOm.cjs +1 -0
  197. package/dist/templates-DWWLjEiU.js +4 -0
  198. package/{types → dist/types}/cli-types.d.ts +1 -0
  199. package/dist/types/cli-types.d.ts.map +1 -0
  200. package/{types → dist/types}/config-types.d.ts +1 -0
  201. package/dist/types/config-types.d.ts.map +1 -0
  202. package/{types → dist/types}/font-types.d.ts +1 -0
  203. package/dist/types/font-types.d.ts.map +1 -0
  204. package/dist/types/index.cjs +0 -0
  205. package/{types → dist/types}/index.d.ts +1 -0
  206. package/dist/types/index.d.ts.map +1 -0
  207. package/dist/types/index.js +0 -0
  208. package/{types → dist/types}/util-types.d.ts +1 -0
  209. package/dist/types/util-types.d.ts.map +1 -0
  210. package/{util → dist/util}/camel-case.d.ts +1 -0
  211. package/dist/util/camel-case.d.ts.map +1 -0
  212. package/{util → dist/util}/dash-case.d.ts +1 -0
  213. package/dist/util/dash-case.d.ts.map +1 -0
  214. package/{util → dist/util}/dot-case.d.ts +1 -0
  215. package/dist/util/dot-case.d.ts.map +1 -0
  216. package/{util → dist/util}/glob-match.d.ts +1 -0
  217. package/dist/util/glob-match.d.ts.map +1 -0
  218. package/dist/util/index.cjs +1 -0
  219. package/{util → dist/util}/index.d.ts +1 -0
  220. package/dist/util/index.d.ts.map +1 -0
  221. package/dist/util/index.js +72 -0
  222. package/{util → dist/util}/module-type.d.ts +1 -0
  223. package/dist/util/module-type.d.ts.map +1 -0
  224. package/{util → dist/util}/pascal-case.d.ts +1 -0
  225. package/dist/util/pascal-case.d.ts.map +1 -0
  226. package/{util → dist/util}/to-hash.d.ts +1 -0
  227. package/dist/util/to-hash.d.ts.map +1 -0
  228. package/dist/vanilla-file-BEqMIe-6.js +4 -0
  229. package/{vanilla-file-1kOqbCIM.js → dist/vanilla-file-Z3VsOa_U.cjs} +2 -5
  230. package/dist/viewport-clamp-CHOyzt37.cjs +1 -0
  231. package/dist/viewport-clamp-CRtzRvJ3.js +7 -0
  232. package/package.json +67 -64
  233. package/README.md +0 -535
  234. package/astro-component-5hrNTCJ5.js +0 -4
  235. package/astro-component-Dj3enX6K.cjs +0 -4
  236. package/bin/index.cjs +0 -4
  237. package/bin/index.d.ts +0 -2
  238. package/bin/index.js +0 -3
  239. package/bin/main.cjs +0 -783
  240. package/bin/main.js +0 -782
  241. package/bin/templates.d.ts +0 -14
  242. package/class-name-generator-BcbeZdcV.cjs +0 -88
  243. package/class-name-generator-DJ27JHW_.js +0 -89
  244. package/compiler/get-files.cjs +0 -25
  245. package/compiler/get-files.js +0 -25
  246. package/compiler/get-function-range.cjs +0 -22
  247. package/compiler/get-function-range.js +0 -22
  248. package/compiler/helpers.cjs +0 -34
  249. package/compiler/helpers.js +0 -33
  250. package/compiler/salty-compiler.cjs +0 -845
  251. package/compiler/salty-compiler.js +0 -827
  252. package/config/index.cjs +0 -20
  253. package/config/index.js +0 -20
  254. package/css/index.cjs +0 -12
  255. package/css/index.js +0 -12
  256. package/css/keyframes.cjs +0 -49
  257. package/css/keyframes.js +0 -49
  258. package/css/media.cjs +0 -93
  259. package/css/media.js +0 -93
  260. package/css/merge.cjs +0 -20
  261. package/css/merge.js +0 -20
  262. package/css/token.cjs +0 -4
  263. package/css/token.js +0 -4
  264. package/define-templates-CVhhgPnd.js +0 -60
  265. package/define-templates-Deq1aCbN.cjs +0 -59
  266. package/factories/index.cjs +0 -177
  267. package/factories/index.js +0 -177
  268. package/generators/index.cjs +0 -58
  269. package/generators/index.js +0 -59
  270. package/glob-match-C28iYp1A.js +0 -74
  271. package/glob-match-CT1uFlp-.cjs +0 -73
  272. package/helpers/index.cjs +0 -53
  273. package/helpers/index.js +0 -53
  274. package/index-ByR0nfaf.cjs +0 -4
  275. package/index-DKz1QXqs.js +0 -4
  276. package/instances/classname-instance.cjs +0 -31
  277. package/instances/classname-instance.js +0 -31
  278. package/parse-styles-BlUpavVg.js +0 -521
  279. package/parse-styles-DWT4tDyS.cjs +0 -520
  280. package/parsers/index.cjs +0 -147
  281. package/parsers/index.js +0 -148
  282. package/pascal-case-By_l58S-.cjs +0 -7
  283. package/pascal-case-F3Usi5Wf.js +0 -8
  284. package/runtime/index.cjs +0 -24
  285. package/runtime/index.js +0 -24
  286. package/salty.config-DogY_sSQ.cjs +0 -4
  287. package/salty.config-GV37Q-D2.js +0 -4
  288. package/server/index.cjs +0 -4
  289. package/server/index.d.ts +0 -1
  290. package/server/index.js +0 -4
  291. package/should-restart-CQsyHls3.cjs +0 -17
  292. package/should-restart-CXIO0jxY.js +0 -18
  293. package/styled-file-BzmB9_Ez.cjs +0 -12
  294. package/styled-file-CPd_rTW2.cjs +0 -11
  295. package/to-hash-DSoCPs8D.js +0 -33
  296. package/to-hash-DT2ImSPA.cjs +0 -32
  297. package/types/index.cjs +0 -1
  298. package/types/index.js +0 -1
  299. package/util/index.cjs +0 -18
  300. package/util/index.js +0 -18
  301. package/vanilla-file-r0fp2q_m.cjs +0 -18
  302. package/viewport-clamp-CEmzmcSj.cjs +0 -10
  303. package/viewport-clamp-K553uXu3.js +0 -11
  304. /package/{.saltyrc.schema.json → dist/.saltyrc.schema.json} +0 -0
@@ -1,177 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
6
- const toHash = require("../to-hash-DT2ImSPA.cjs");
7
- const css_media = require("../css/media.cjs");
8
- const defineTemplates = require("../define-templates-Deq1aCbN.cjs");
9
- const FONT_FORMAT_BY_EXTENSION = {
10
- woff2: "woff2",
11
- woff: "woff",
12
- ttf: "truetype",
13
- otf: "opentype",
14
- eot: "embedded-opentype",
15
- svg: "svg",
16
- ttc: "collection"
17
- };
18
- const detectFontFormat = (url) => {
19
- const cleaned = url.split("?")[0].split("#")[0];
20
- const dot = cleaned.lastIndexOf(".");
21
- if (dot === -1) return void 0;
22
- const ext = cleaned.slice(dot + 1).toLowerCase();
23
- return FONT_FORMAT_BY_EXTENSION[ext];
24
- };
25
- const toFontSrc = (entry) => {
26
- if (typeof entry === "string") return { url: entry, format: detectFontFormat(entry) };
27
- return entry;
28
- };
29
- const normalizeSources = (src) => {
30
- if (Array.isArray(src)) return src.map(toFontSrc);
31
- return [toFontSrc(src)];
32
- };
33
- const normalizeVariable = (variable) => {
34
- const trimmed = variable.trim();
35
- const stripped = trimmed.replace(/^--/, "");
36
- if (!stripped) throw new Error(`defineFont: invalid \`variable\` value "${variable}".`);
37
- return `--${toHash.dashCase(stripped)}`;
38
- };
39
- const deriveVariable = (options) => {
40
- const hashSource = [options.name, options.fallback, "variants" in options ? options.variants : void 0, "import" in options ? options.import : void 0];
41
- return `--font-${toHash.dashCase(options.name)}-${toHash.toHash(hashSource, 6)}`;
42
- };
43
- const quoteFamily = (name) => {
44
- if (/^["'].*["']$/.test(name)) return name;
45
- if (/\s/.test(name)) return `"${name}"`;
46
- return name;
47
- };
48
- const buildFontFamilyValue = (name, fallback) => {
49
- const head = quoteFamily(name);
50
- if (!fallback || fallback.length === 0) return head;
51
- return [head, fallback].join(", ");
52
- };
53
- const formatSrc = (src) => {
54
- const parts = [`url("${src.url}")`];
55
- if (src.format) parts.push(`format("${src.format}")`);
56
- if (src.tech) parts.push(`tech(${src.tech})`);
57
- return parts.join(" ");
58
- };
59
- const variantToFontFace = (name, variant, defaultDisplay) => {
60
- const sources = normalizeSources(variant.src);
61
- if (sources.length === 0) {
62
- throw new Error(`defineFont(${name}): variant must declare at least one \`src\`.`);
63
- }
64
- const lines = [`font-family: ${quoteFamily(name)};`, `src: ${sources.map(formatSrc).join(", ")};`, `font-display: ${variant.display ?? defaultDisplay};`];
65
- if (variant.weight !== void 0) lines.push(`font-weight: ${variant.weight};`);
66
- if (variant.style !== void 0) lines.push(`font-style: ${variant.style};`);
67
- if (variant.stretch !== void 0) lines.push(`font-stretch: ${variant.stretch};`);
68
- if (variant.unicodeRange !== void 0) lines.push(`unicode-range: ${variant.unicodeRange};`);
69
- if (variant.ascentOverride !== void 0) lines.push(`ascent-override: ${variant.ascentOverride};`);
70
- if (variant.descentOverride !== void 0) lines.push(`descent-override: ${variant.descentOverride};`);
71
- if (variant.lineGapOverride !== void 0) lines.push(`line-gap-override: ${variant.lineGapOverride};`);
72
- if (variant.sizeAdjust !== void 0) lines.push(`size-adjust: ${variant.sizeAdjust};`);
73
- return `@font-face { ${lines.join(" ")} }`;
74
- };
75
- class FontFactory {
76
- constructor(_options) {
77
- __publicField(this, "variable");
78
- __publicField(this, "fontFamily");
79
- __publicField(this, "className");
80
- this._options = _options;
81
- if (!_options || !_options.name) {
82
- throw new Error("defineFont: `name` is required.");
83
- }
84
- if ("variants" in _options && "import" in _options && _options.import !== void 0 && _options.variants !== void 0) {
85
- throw new Error("defineFont: provide either `variants` or `import`, not both.");
86
- }
87
- if (!("variants" in _options && _options.variants) && !("import" in _options && _options.import)) {
88
- throw new Error("defineFont: must provide either `variants` or `import`.");
89
- }
90
- this.variable = _options.variable ? normalizeVariable(_options.variable) : deriveVariable(_options);
91
- this.fontFamily = buildFontFamilyValue(_options.name, _options.fallback);
92
- this.className = `font-${toHash.dashCase(_options.name)}`;
93
- }
94
- get isDefineFont() {
95
- return true;
96
- }
97
- /** Acts as a string equal to the resolved font-family value. */
98
- toString() {
99
- return this.fontFamily;
100
- }
101
- /** Inline-style helper: spread onto a React `style` prop. */
102
- get style() {
103
- return {
104
- fontFamily: this.fontFamily,
105
- [this.variable]: this.fontFamily
106
- };
107
- }
108
- /** Build the CSS pieces written to `_fonts.css`. */
109
- _toCss() {
110
- const imports = [];
111
- const blocks = [];
112
- if ("import" in this._options && this._options.import) {
113
- imports.push(`@import url("${this._options.import}");`);
114
- } else if ("variants" in this._options && this._options.variants) {
115
- const display = this._options.display ?? "swap";
116
- for (const variant of this._options.variants) {
117
- blocks.push(variantToFontFace(this._options.name, variant, display));
118
- }
119
- }
120
- blocks.push(`:root { ${this.variable}: ${this.fontFamily}; }`, `.${this.className} { font-family: var(${this.variable}); }`);
121
- return { imports, body: blocks.join(" ") };
122
- }
123
- }
124
- const defineFont = (options) => {
125
- return new FontFactory(options);
126
- };
127
- class GlobalStylesFactory {
128
- constructor(_current) {
129
- this._current = _current;
130
- }
131
- get isGlobalDefine() {
132
- return true;
133
- }
134
- }
135
- const defineGlobalStyles = (styles) => {
136
- return new GlobalStylesFactory(styles);
137
- };
138
- class ImportFactory {
139
- constructor(_current) {
140
- __publicField(this, "_path");
141
- this._current = _current;
142
- }
143
- get isDefineImport() {
144
- return true;
145
- }
146
- _setPath(path) {
147
- this._path = path;
148
- return this;
149
- }
150
- }
151
- const defineImport = (...specs) => new ImportFactory(specs);
152
- const defineMediaQuery = (mediaFactory) => {
153
- return mediaFactory(css_media.media);
154
- };
155
- class VariablesFactory {
156
- constructor(_current) {
157
- this._current = _current;
158
- }
159
- get isDefineVariables() {
160
- return true;
161
- }
162
- }
163
- const defineVariables = (variables) => {
164
- return new VariablesFactory(variables);
165
- };
166
- exports.TemplateFactory = defineTemplates.TemplateFactory;
167
- exports.TemplatesFactory = defineTemplates.TemplatesFactory;
168
- exports.defineTemplates = defineTemplates.defineTemplates;
169
- exports.FontFactory = FontFactory;
170
- exports.GlobalStylesFactory = GlobalStylesFactory;
171
- exports.ImportFactory = ImportFactory;
172
- exports.VariablesFactory = VariablesFactory;
173
- exports.defineFont = defineFont;
174
- exports.defineGlobalStyles = defineGlobalStyles;
175
- exports.defineImport = defineImport;
176
- exports.defineMediaQuery = defineMediaQuery;
177
- exports.defineVariables = defineVariables;
@@ -1,177 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { d as dashCase, t as toHash } from "../to-hash-DSoCPs8D.js";
5
- import { media } from "../css/media.js";
6
- import { T, a, d } from "../define-templates-CVhhgPnd.js";
7
- const FONT_FORMAT_BY_EXTENSION = {
8
- woff2: "woff2",
9
- woff: "woff",
10
- ttf: "truetype",
11
- otf: "opentype",
12
- eot: "embedded-opentype",
13
- svg: "svg",
14
- ttc: "collection"
15
- };
16
- const detectFontFormat = (url) => {
17
- const cleaned = url.split("?")[0].split("#")[0];
18
- const dot = cleaned.lastIndexOf(".");
19
- if (dot === -1) return void 0;
20
- const ext = cleaned.slice(dot + 1).toLowerCase();
21
- return FONT_FORMAT_BY_EXTENSION[ext];
22
- };
23
- const toFontSrc = (entry) => {
24
- if (typeof entry === "string") return { url: entry, format: detectFontFormat(entry) };
25
- return entry;
26
- };
27
- const normalizeSources = (src) => {
28
- if (Array.isArray(src)) return src.map(toFontSrc);
29
- return [toFontSrc(src)];
30
- };
31
- const normalizeVariable = (variable) => {
32
- const trimmed = variable.trim();
33
- const stripped = trimmed.replace(/^--/, "");
34
- if (!stripped) throw new Error(`defineFont: invalid \`variable\` value "${variable}".`);
35
- return `--${dashCase(stripped)}`;
36
- };
37
- const deriveVariable = (options) => {
38
- const hashSource = [options.name, options.fallback, "variants" in options ? options.variants : void 0, "import" in options ? options.import : void 0];
39
- return `--font-${dashCase(options.name)}-${toHash(hashSource, 6)}`;
40
- };
41
- const quoteFamily = (name) => {
42
- if (/^["'].*["']$/.test(name)) return name;
43
- if (/\s/.test(name)) return `"${name}"`;
44
- return name;
45
- };
46
- const buildFontFamilyValue = (name, fallback) => {
47
- const head = quoteFamily(name);
48
- if (!fallback || fallback.length === 0) return head;
49
- return [head, fallback].join(", ");
50
- };
51
- const formatSrc = (src) => {
52
- const parts = [`url("${src.url}")`];
53
- if (src.format) parts.push(`format("${src.format}")`);
54
- if (src.tech) parts.push(`tech(${src.tech})`);
55
- return parts.join(" ");
56
- };
57
- const variantToFontFace = (name, variant, defaultDisplay) => {
58
- const sources = normalizeSources(variant.src);
59
- if (sources.length === 0) {
60
- throw new Error(`defineFont(${name}): variant must declare at least one \`src\`.`);
61
- }
62
- const lines = [`font-family: ${quoteFamily(name)};`, `src: ${sources.map(formatSrc).join(", ")};`, `font-display: ${variant.display ?? defaultDisplay};`];
63
- if (variant.weight !== void 0) lines.push(`font-weight: ${variant.weight};`);
64
- if (variant.style !== void 0) lines.push(`font-style: ${variant.style};`);
65
- if (variant.stretch !== void 0) lines.push(`font-stretch: ${variant.stretch};`);
66
- if (variant.unicodeRange !== void 0) lines.push(`unicode-range: ${variant.unicodeRange};`);
67
- if (variant.ascentOverride !== void 0) lines.push(`ascent-override: ${variant.ascentOverride};`);
68
- if (variant.descentOverride !== void 0) lines.push(`descent-override: ${variant.descentOverride};`);
69
- if (variant.lineGapOverride !== void 0) lines.push(`line-gap-override: ${variant.lineGapOverride};`);
70
- if (variant.sizeAdjust !== void 0) lines.push(`size-adjust: ${variant.sizeAdjust};`);
71
- return `@font-face { ${lines.join(" ")} }`;
72
- };
73
- class FontFactory {
74
- constructor(_options) {
75
- __publicField(this, "variable");
76
- __publicField(this, "fontFamily");
77
- __publicField(this, "className");
78
- this._options = _options;
79
- if (!_options || !_options.name) {
80
- throw new Error("defineFont: `name` is required.");
81
- }
82
- if ("variants" in _options && "import" in _options && _options.import !== void 0 && _options.variants !== void 0) {
83
- throw new Error("defineFont: provide either `variants` or `import`, not both.");
84
- }
85
- if (!("variants" in _options && _options.variants) && !("import" in _options && _options.import)) {
86
- throw new Error("defineFont: must provide either `variants` or `import`.");
87
- }
88
- this.variable = _options.variable ? normalizeVariable(_options.variable) : deriveVariable(_options);
89
- this.fontFamily = buildFontFamilyValue(_options.name, _options.fallback);
90
- this.className = `font-${dashCase(_options.name)}`;
91
- }
92
- get isDefineFont() {
93
- return true;
94
- }
95
- /** Acts as a string equal to the resolved font-family value. */
96
- toString() {
97
- return this.fontFamily;
98
- }
99
- /** Inline-style helper: spread onto a React `style` prop. */
100
- get style() {
101
- return {
102
- fontFamily: this.fontFamily,
103
- [this.variable]: this.fontFamily
104
- };
105
- }
106
- /** Build the CSS pieces written to `_fonts.css`. */
107
- _toCss() {
108
- const imports = [];
109
- const blocks = [];
110
- if ("import" in this._options && this._options.import) {
111
- imports.push(`@import url("${this._options.import}");`);
112
- } else if ("variants" in this._options && this._options.variants) {
113
- const display = this._options.display ?? "swap";
114
- for (const variant of this._options.variants) {
115
- blocks.push(variantToFontFace(this._options.name, variant, display));
116
- }
117
- }
118
- blocks.push(`:root { ${this.variable}: ${this.fontFamily}; }`, `.${this.className} { font-family: var(${this.variable}); }`);
119
- return { imports, body: blocks.join(" ") };
120
- }
121
- }
122
- const defineFont = (options) => {
123
- return new FontFactory(options);
124
- };
125
- class GlobalStylesFactory {
126
- constructor(_current) {
127
- this._current = _current;
128
- }
129
- get isGlobalDefine() {
130
- return true;
131
- }
132
- }
133
- const defineGlobalStyles = (styles) => {
134
- return new GlobalStylesFactory(styles);
135
- };
136
- class ImportFactory {
137
- constructor(_current) {
138
- __publicField(this, "_path");
139
- this._current = _current;
140
- }
141
- get isDefineImport() {
142
- return true;
143
- }
144
- _setPath(path) {
145
- this._path = path;
146
- return this;
147
- }
148
- }
149
- const defineImport = (...specs) => new ImportFactory(specs);
150
- const defineMediaQuery = (mediaFactory) => {
151
- return mediaFactory(media);
152
- };
153
- class VariablesFactory {
154
- constructor(_current) {
155
- this._current = _current;
156
- }
157
- get isDefineVariables() {
158
- return true;
159
- }
160
- }
161
- const defineVariables = (variables) => {
162
- return new VariablesFactory(variables);
163
- };
164
- export {
165
- FontFactory,
166
- GlobalStylesFactory,
167
- ImportFactory,
168
- T as TemplateFactory,
169
- a as TemplatesFactory,
170
- VariablesFactory,
171
- defineFont,
172
- defineGlobalStyles,
173
- defineImport,
174
- defineMediaQuery,
175
- d as defineTemplates,
176
- defineVariables
177
- };
@@ -1,58 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const classNameGenerator = require("../class-name-generator-BcbeZdcV.cjs");
4
- const toHash = require("../to-hash-DT2ImSPA.cjs");
5
- class StyledGenerator extends classNameGenerator.StylesGenerator {
6
- constructor(tagName, _params) {
7
- super(_params);
8
- this.tagName = tagName;
9
- this._params = _params;
10
- }
11
- get priority() {
12
- var _a;
13
- if (this.params.priority) return this.params.priority;
14
- if (this.tagName && (typeof this.tagName === "function" || typeof this.tagName === "object")) {
15
- const prev = ((_a = this.tagName.generator) == null ? void 0 : _a.priority) || 0;
16
- return prev + 1;
17
- }
18
- return 0;
19
- }
20
- get clientProps() {
21
- const { element: _element, as: _as, variants = {}, compoundVariants = [], anyOfVariants = [], defaultVariants = {}, defaultProps = {}, passProps } = this.params;
22
- const element = _as ?? _element;
23
- const { callerName, isProduction } = this.buildContext;
24
- const variantKeys = /* @__PURE__ */ new Set([]);
25
- const addVariantKey = (name) => {
26
- const defaultVariant = defaultVariants[name];
27
- if (defaultVariant !== void 0) variantKeys.add(`${name}=${String(defaultVariant)}`);
28
- else variantKeys.add(name);
29
- };
30
- Object.keys(variants).forEach(addVariantKey);
31
- compoundVariants.map((cv) => Object.keys(cv).forEach(addVariantKey));
32
- anyOfVariants.map((cv) => Object.keys(cv).forEach(addVariantKey));
33
- const propValueKeys = /* @__PURE__ */ new Set([]);
34
- if (this.params.base) {
35
- const matches = JSON.stringify(this.params.base).match(/\{-?props\.([^}]+)\}/gi);
36
- if (matches) {
37
- matches.forEach((match) => {
38
- const value = match.replace(/\{(?:-)?props\.([^}]+)\}/gi, "$1");
39
- const dashed = toHash.dashCase(value);
40
- if (value) propValueKeys.add(dashed);
41
- });
42
- }
43
- }
44
- return {
45
- element,
46
- hash: this.hash,
47
- variantKeys: [...variantKeys],
48
- propValueKeys: [...propValueKeys],
49
- passProps,
50
- defaultProps,
51
- attr: {
52
- "data-component-name": !isProduction ? callerName : void 0
53
- }
54
- };
55
- }
56
- }
57
- exports.ClassNameGenerator = classNameGenerator.ClassNameGenerator;
58
- exports.StyledGenerator = StyledGenerator;
@@ -1,59 +0,0 @@
1
- import { S as StylesGenerator } from "../class-name-generator-DJ27JHW_.js";
2
- import { C } from "../class-name-generator-DJ27JHW_.js";
3
- import { d as dashCase } from "../to-hash-DSoCPs8D.js";
4
- class StyledGenerator extends StylesGenerator {
5
- constructor(tagName, _params) {
6
- super(_params);
7
- this.tagName = tagName;
8
- this._params = _params;
9
- }
10
- get priority() {
11
- var _a;
12
- if (this.params.priority) return this.params.priority;
13
- if (this.tagName && (typeof this.tagName === "function" || typeof this.tagName === "object")) {
14
- const prev = ((_a = this.tagName.generator) == null ? void 0 : _a.priority) || 0;
15
- return prev + 1;
16
- }
17
- return 0;
18
- }
19
- get clientProps() {
20
- const { element: _element, as: _as, variants = {}, compoundVariants = [], anyOfVariants = [], defaultVariants = {}, defaultProps = {}, passProps } = this.params;
21
- const element = _as ?? _element;
22
- const { callerName, isProduction } = this.buildContext;
23
- const variantKeys = /* @__PURE__ */ new Set([]);
24
- const addVariantKey = (name) => {
25
- const defaultVariant = defaultVariants[name];
26
- if (defaultVariant !== void 0) variantKeys.add(`${name}=${String(defaultVariant)}`);
27
- else variantKeys.add(name);
28
- };
29
- Object.keys(variants).forEach(addVariantKey);
30
- compoundVariants.map((cv) => Object.keys(cv).forEach(addVariantKey));
31
- anyOfVariants.map((cv) => Object.keys(cv).forEach(addVariantKey));
32
- const propValueKeys = /* @__PURE__ */ new Set([]);
33
- if (this.params.base) {
34
- const matches = JSON.stringify(this.params.base).match(/\{-?props\.([^}]+)\}/gi);
35
- if (matches) {
36
- matches.forEach((match) => {
37
- const value = match.replace(/\{(?:-)?props\.([^}]+)\}/gi, "$1");
38
- const dashed = dashCase(value);
39
- if (value) propValueKeys.add(dashed);
40
- });
41
- }
42
- }
43
- return {
44
- element,
45
- hash: this.hash,
46
- variantKeys: [...variantKeys],
47
- propValueKeys: [...propValueKeys],
48
- passProps,
49
- defaultProps,
50
- attr: {
51
- "data-component-name": !isProduction ? callerName : void 0
52
- }
53
- };
54
- }
55
- }
56
- export {
57
- C as ClassNameGenerator,
58
- StyledGenerator
59
- };
@@ -1,74 +0,0 @@
1
- const normalizePath = (path) => path.replace(/\\/g, "/");
2
- const tokenCache = /* @__PURE__ */ new Map();
3
- const tokenize = (pattern) => {
4
- const cached = tokenCache.get(pattern);
5
- if (cached) return cached;
6
- const normalized = normalizePath(pattern);
7
- const tokens = [];
8
- for (let i = 0; i < normalized.length; i++) {
9
- const char = normalized[i];
10
- if (char === "*") {
11
- let stars = 1;
12
- while (normalized[i + 1] === "*") {
13
- i++;
14
- stars++;
15
- }
16
- tokens.push(stars >= 2 ? { type: "globstar" } : { type: "star" });
17
- } else if (char === "?") {
18
- tokens.push({ type: "single" });
19
- } else {
20
- tokens.push({ type: "lit", char });
21
- }
22
- }
23
- tokenCache.set(pattern, tokens);
24
- return tokens;
25
- };
26
- const matchesGlob = (pattern, path) => {
27
- const tokens = tokenize(pattern);
28
- const normalized = normalizePath(path);
29
- const P = tokens.length;
30
- const S = normalized.length;
31
- const memo = new Uint8Array((P + 1) * (S + 1));
32
- const match = (ti, si) => {
33
- const key = ti * (S + 1) + si;
34
- const seen = memo[key];
35
- if (seen) return seen === 2;
36
- let result;
37
- if (ti === P) {
38
- result = si === S;
39
- } else {
40
- const token = tokens[ti];
41
- switch (token.type) {
42
- case "lit":
43
- result = si < S && normalized[si] === token.char && match(ti + 1, si + 1);
44
- break;
45
- case "single":
46
- result = si < S && normalized[si] !== "/" && match(ti + 1, si + 1);
47
- break;
48
- case "star":
49
- result = match(ti + 1, si) || si < S && normalized[si] !== "/" && match(ti, si + 1);
50
- break;
51
- case "globstar":
52
- result = match(ti + 1, si) || si < S && match(ti, si + 1);
53
- break;
54
- }
55
- }
56
- memo[key] = result ? 2 : 1;
57
- return result;
58
- };
59
- return match(0, 0);
60
- };
61
- const matchesAnyGlob = (relPath, patterns) => {
62
- return patterns.some((pattern) => matchesGlob(pattern, relPath));
63
- };
64
- const isPathAllowed = (relPath, { include, exclude } = {}) => {
65
- if ((exclude == null ? void 0 : exclude.length) && matchesAnyGlob(relPath, exclude)) return false;
66
- if (include == null ? void 0 : include.length) return matchesAnyGlob(relPath, include);
67
- return true;
68
- };
69
- export {
70
- matchesGlob as a,
71
- isPathAllowed as i,
72
- matchesAnyGlob as m,
73
- normalizePath as n
74
- };
@@ -1,73 +0,0 @@
1
- "use strict";
2
- const normalizePath = (path) => path.replace(/\\/g, "/");
3
- const tokenCache = /* @__PURE__ */ new Map();
4
- const tokenize = (pattern) => {
5
- const cached = tokenCache.get(pattern);
6
- if (cached) return cached;
7
- const normalized = normalizePath(pattern);
8
- const tokens = [];
9
- for (let i = 0; i < normalized.length; i++) {
10
- const char = normalized[i];
11
- if (char === "*") {
12
- let stars = 1;
13
- while (normalized[i + 1] === "*") {
14
- i++;
15
- stars++;
16
- }
17
- tokens.push(stars >= 2 ? { type: "globstar" } : { type: "star" });
18
- } else if (char === "?") {
19
- tokens.push({ type: "single" });
20
- } else {
21
- tokens.push({ type: "lit", char });
22
- }
23
- }
24
- tokenCache.set(pattern, tokens);
25
- return tokens;
26
- };
27
- const matchesGlob = (pattern, path) => {
28
- const tokens = tokenize(pattern);
29
- const normalized = normalizePath(path);
30
- const P = tokens.length;
31
- const S = normalized.length;
32
- const memo = new Uint8Array((P + 1) * (S + 1));
33
- const match = (ti, si) => {
34
- const key = ti * (S + 1) + si;
35
- const seen = memo[key];
36
- if (seen) return seen === 2;
37
- let result;
38
- if (ti === P) {
39
- result = si === S;
40
- } else {
41
- const token = tokens[ti];
42
- switch (token.type) {
43
- case "lit":
44
- result = si < S && normalized[si] === token.char && match(ti + 1, si + 1);
45
- break;
46
- case "single":
47
- result = si < S && normalized[si] !== "/" && match(ti + 1, si + 1);
48
- break;
49
- case "star":
50
- result = match(ti + 1, si) || si < S && normalized[si] !== "/" && match(ti, si + 1);
51
- break;
52
- case "globstar":
53
- result = match(ti + 1, si) || si < S && match(ti, si + 1);
54
- break;
55
- }
56
- }
57
- memo[key] = result ? 2 : 1;
58
- return result;
59
- };
60
- return match(0, 0);
61
- };
62
- const matchesAnyGlob = (relPath, patterns) => {
63
- return patterns.some((pattern) => matchesGlob(pattern, relPath));
64
- };
65
- const isPathAllowed = (relPath, { include, exclude } = {}) => {
66
- if ((exclude == null ? void 0 : exclude.length) && matchesAnyGlob(relPath, exclude)) return false;
67
- if (include == null ? void 0 : include.length) return matchesAnyGlob(relPath, include);
68
- return true;
69
- };
70
- exports.isPathAllowed = isPathAllowed;
71
- exports.matchesAnyGlob = matchesAnyGlob;
72
- exports.matchesGlob = matchesGlob;
73
- exports.normalizePath = normalizePath;
package/helpers/index.cjs DELETED
@@ -1,53 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
6
- const colorFunction = require("color");
7
- const viewportClamp = require("../viewport-clamp-CEmzmcSj.cjs");
8
- class Color {
9
- constructor(base) {
10
- __publicField(this, "isColor", true);
11
- __publicField(this, "currentColor");
12
- this.base = base;
13
- const colorValue = this._resolveBaseColor(base);
14
- this.currentColor = colorFunction(colorValue);
15
- return this._createProxy();
16
- }
17
- _createProxy() {
18
- return new Proxy(this, {
19
- get(target, prop) {
20
- if (prop in target) return target[prop];
21
- if (prop in target.currentColor) return target._handleColorMethod(prop);
22
- return target[prop];
23
- }
24
- });
25
- }
26
- _resolveBaseColor(base) {
27
- if (typeof base !== "string") return base;
28
- const isToken = /\{[^{}]+\}/g.test(base);
29
- if (!isToken) return base;
30
- if (typeof saltyConfig === "undefined") return "transparent";
31
- const { staticVariables } = saltyConfig;
32
- if (!staticVariables) return "transparent";
33
- const tokenPath = base.replace(/^\{|\}$/g, "").split(".");
34
- const value = tokenPath.reduce((acc, key) => acc[key], staticVariables);
35
- return value;
36
- }
37
- _handleColorMethod(method) {
38
- const color2 = this.currentColor;
39
- if (typeof color2[method] !== "function") return color2[method];
40
- return (...args) => {
41
- this.currentColor = color2[method](...args);
42
- return this._createProxy();
43
- };
44
- }
45
- toString() {
46
- return this.currentColor.toString();
47
- }
48
- }
49
- const color = (value) => {
50
- return new Color(value);
51
- };
52
- exports.defineViewportClamp = viewportClamp.defineViewportClamp;
53
- exports.color = color;