@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,14 +0,0 @@
1
- declare const templateLoaders: {
2
- readonly 'salty.config.ts': () => Promise<any>;
3
- readonly 'saltygen/index.css': () => Promise<any>;
4
- readonly 'react/styled-file.ts': () => Promise<any>;
5
- readonly 'react/vanilla-file.ts': () => Promise<any>;
6
- readonly 'astro/styled-file.ts': () => Promise<any>;
7
- readonly 'astro/component.astro': () => Promise<any>;
8
- };
9
- export type TemplateKey = keyof typeof templateLoaders;
10
- export declare const readTemplate: <T extends object>(key: TemplateKey, options?: T) => Promise<{
11
- fileName: "salty.config.ts" | "saltygen/index.css" | "react/styled-file.ts" | "react/vanilla-file.ts" | "astro/styled-file.ts" | "astro/component.astro";
12
- content: string;
13
- }>;
14
- export {};
@@ -1,88 +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
- const parseStyles = require("./parse-styles-DWT4tDyS.cjs");
6
- const toHash = require("./to-hash-DT2ImSPA.cjs");
7
- class StylesGenerator {
8
- constructor(params) {
9
- __publicField(this, "buildContext", {});
10
- this.params = params;
11
- }
12
- get priority() {
13
- return 0;
14
- }
15
- get isRoot() {
16
- return this.priority === 0;
17
- }
18
- get hash() {
19
- const { base, variants, compoundVariants, anyOfVariants } = this.params;
20
- return toHash.toHash({ base, variants, compoundVariants, anyOfVariants });
21
- }
22
- get cssClassName() {
23
- return this.hash;
24
- }
25
- get classNames() {
26
- const classNames = /* @__PURE__ */ new Set([this.cssClassName]);
27
- const { className } = this.params;
28
- if (typeof className == "string") classNames.add(className);
29
- if (typeof className == "object") className.forEach((c) => classNames.add(c));
30
- this.getTemplateClasses().forEach((c) => classNames.add(c));
31
- if (this.buildContext.classNames) this.buildContext.classNames.forEach((c) => classNames.add(c));
32
- return [...classNames].join(" ");
33
- }
34
- get cssFileName() {
35
- const { callerName } = this.buildContext;
36
- if (callerName) {
37
- const dasherized = toHash.dashCase(callerName);
38
- return `cl_${dasherized}-${this.hash}.css`;
39
- }
40
- return `${this.hash}.css`;
41
- }
42
- get css() {
43
- const { base = {}, variants = {}, compoundVariants = [], anyOfVariants = [] } = this.params;
44
- const { config } = this.buildContext;
45
- const combinedStyles = { ...base, variants, compoundVariants, anyOfVariants };
46
- const css = parseStyles.parseAndJoinStyles(combinedStyles, `.${this.cssClassName}`, config, this.isRoot);
47
- return css;
48
- }
49
- getTemplateClasses(config = this.buildContext.config) {
50
- if (!(config == null ? void 0 : config.templates) || !this.params.base || this.priority > 0) return [];
51
- const templateKeys = Object.keys(config.templates);
52
- return Object.entries(this.params.base).reduce((acc, [key, value]) => {
53
- if (!templateKeys.includes(key)) return acc;
54
- const callSite = parseStyles.parseTemplateCallSite(value);
55
- if (!callSite || callSite.path.length === 0) return acc;
56
- const { path, variants } = callSite;
57
- const cumulative = [];
58
- for (const part of path) {
59
- cumulative.push(part);
60
- const baseClassName = toHash.dashCase(`${key}-${cumulative.join(".")}`);
61
- acc.push("t_" + toHash.toHash(baseClassName, 4));
62
- for (const [axis, axisValue] of Object.entries(variants)) {
63
- if (axisValue === false || axisValue === void 0) continue;
64
- const valueSuffix = axisValue === true ? "" : `-${toHash.dashCase(String(axisValue))}`;
65
- const variantClassName = `${baseClassName}-${toHash.dashCase(axis)}${valueSuffix}`;
66
- acc.push("tv_" + toHash.toHash(variantClassName, 4));
67
- }
68
- }
69
- return acc;
70
- }, []);
71
- }
72
- _withBuildContext(context) {
73
- this.buildContext = context;
74
- return this;
75
- }
76
- }
77
- class ClassNameGenerator extends StylesGenerator {
78
- constructor(_params) {
79
- super(_params);
80
- this._params = _params;
81
- }
82
- get priority() {
83
- if (this.params.priority) return this.params.priority;
84
- return 0;
85
- }
86
- }
87
- exports.ClassNameGenerator = ClassNameGenerator;
88
- exports.StylesGenerator = StylesGenerator;
@@ -1,89 +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 { p as parseAndJoinStyles, b as parseTemplateCallSite } from "./parse-styles-BlUpavVg.js";
5
- import { t as toHash, d as dashCase } from "./to-hash-DSoCPs8D.js";
6
- class StylesGenerator {
7
- constructor(params) {
8
- __publicField(this, "buildContext", {});
9
- this.params = params;
10
- }
11
- get priority() {
12
- return 0;
13
- }
14
- get isRoot() {
15
- return this.priority === 0;
16
- }
17
- get hash() {
18
- const { base, variants, compoundVariants, anyOfVariants } = this.params;
19
- return toHash({ base, variants, compoundVariants, anyOfVariants });
20
- }
21
- get cssClassName() {
22
- return this.hash;
23
- }
24
- get classNames() {
25
- const classNames = /* @__PURE__ */ new Set([this.cssClassName]);
26
- const { className } = this.params;
27
- if (typeof className == "string") classNames.add(className);
28
- if (typeof className == "object") className.forEach((c) => classNames.add(c));
29
- this.getTemplateClasses().forEach((c) => classNames.add(c));
30
- if (this.buildContext.classNames) this.buildContext.classNames.forEach((c) => classNames.add(c));
31
- return [...classNames].join(" ");
32
- }
33
- get cssFileName() {
34
- const { callerName } = this.buildContext;
35
- if (callerName) {
36
- const dasherized = dashCase(callerName);
37
- return `cl_${dasherized}-${this.hash}.css`;
38
- }
39
- return `${this.hash}.css`;
40
- }
41
- get css() {
42
- const { base = {}, variants = {}, compoundVariants = [], anyOfVariants = [] } = this.params;
43
- const { config } = this.buildContext;
44
- const combinedStyles = { ...base, variants, compoundVariants, anyOfVariants };
45
- const css = parseAndJoinStyles(combinedStyles, `.${this.cssClassName}`, config, this.isRoot);
46
- return css;
47
- }
48
- getTemplateClasses(config = this.buildContext.config) {
49
- if (!(config == null ? void 0 : config.templates) || !this.params.base || this.priority > 0) return [];
50
- const templateKeys = Object.keys(config.templates);
51
- return Object.entries(this.params.base).reduce((acc, [key, value]) => {
52
- if (!templateKeys.includes(key)) return acc;
53
- const callSite = parseTemplateCallSite(value);
54
- if (!callSite || callSite.path.length === 0) return acc;
55
- const { path, variants } = callSite;
56
- const cumulative = [];
57
- for (const part of path) {
58
- cumulative.push(part);
59
- const baseClassName = dashCase(`${key}-${cumulative.join(".")}`);
60
- acc.push("t_" + toHash(baseClassName, 4));
61
- for (const [axis, axisValue] of Object.entries(variants)) {
62
- if (axisValue === false || axisValue === void 0) continue;
63
- const valueSuffix = axisValue === true ? "" : `-${dashCase(String(axisValue))}`;
64
- const variantClassName = `${baseClassName}-${dashCase(axis)}${valueSuffix}`;
65
- acc.push("tv_" + toHash(variantClassName, 4));
66
- }
67
- }
68
- return acc;
69
- }, []);
70
- }
71
- _withBuildContext(context) {
72
- this.buildContext = context;
73
- return this;
74
- }
75
- }
76
- class ClassNameGenerator extends StylesGenerator {
77
- constructor(_params) {
78
- super(_params);
79
- this._params = _params;
80
- }
81
- get priority() {
82
- if (this.params.priority) return this.params.priority;
83
- return 0;
84
- }
85
- }
86
- export {
87
- ClassNameGenerator as C,
88
- StylesGenerator as S
89
- };
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const fs = require("fs");
4
- const promises = require("fs/promises");
5
- const path = require("path");
6
- const getSaltyRcPath = (dirname) => {
7
- if (!dirname || dirname === "/") throw new Error("Could not find .saltyrc.json file");
8
- const rcPath = path.join(dirname, ".saltyrc.json");
9
- if (!fs.existsSync(rcPath)) return getSaltyRcPath(path.join(dirname, ".."));
10
- return rcPath;
11
- };
12
- const getPackageJsonPath = (dirname) => {
13
- if (!dirname || dirname === "/") throw new Error("Could not find package.json file");
14
- const packageJsonPath = path.join(dirname, "package.json");
15
- if (!fs.existsSync(packageJsonPath)) return getPackageJsonPath(path.join(dirname, ".."));
16
- return packageJsonPath;
17
- };
18
- const getPackageJson = async (dirname) => {
19
- const packageJsonPath = getPackageJsonPath(dirname);
20
- const packageJsonContent = await promises.readFile(packageJsonPath, "utf-8").then(JSON.parse).catch(() => void 0);
21
- return packageJsonContent;
22
- };
23
- exports.getPackageJson = getPackageJson;
24
- exports.getPackageJsonPath = getPackageJsonPath;
25
- exports.getSaltyRcPath = getSaltyRcPath;
@@ -1,25 +0,0 @@
1
- import { existsSync } from "fs";
2
- import { readFile } from "fs/promises";
3
- import { join } from "path";
4
- const getSaltyRcPath = (dirname) => {
5
- if (!dirname || dirname === "/") throw new Error("Could not find .saltyrc.json file");
6
- const rcPath = join(dirname, ".saltyrc.json");
7
- if (!existsSync(rcPath)) return getSaltyRcPath(join(dirname, ".."));
8
- return rcPath;
9
- };
10
- const getPackageJsonPath = (dirname) => {
11
- if (!dirname || dirname === "/") throw new Error("Could not find package.json file");
12
- const packageJsonPath = join(dirname, "package.json");
13
- if (!existsSync(packageJsonPath)) return getPackageJsonPath(join(dirname, ".."));
14
- return packageJsonPath;
15
- };
16
- const getPackageJson = async (dirname) => {
17
- const packageJsonPath = getPackageJsonPath(dirname);
18
- const packageJsonContent = await readFile(packageJsonPath, "utf-8").then(JSON.parse).catch(() => void 0);
19
- return packageJsonContent;
20
- };
21
- export {
22
- getPackageJson,
23
- getPackageJsonPath,
24
- getSaltyRcPath
25
- };
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const ts = require("typescript");
4
- const getFunctionRange = (contents, name) => {
5
- return new Promise((resolve, reject) => {
6
- const timeout = setTimeout(() => {
7
- reject(new Error("Timeout"));
8
- }, 100);
9
- const sourceFile = ts.createSourceFile("temp.ts", contents, ts.ScriptTarget.Latest, true);
10
- function visit(node) {
11
- if (ts.isVariableDeclaration(node) && node.name.getText() === name) {
12
- const start = node.getStart();
13
- const end = node.getEnd();
14
- clearTimeout(timeout);
15
- resolve([start, end]);
16
- }
17
- node.forEachChild(visit);
18
- }
19
- visit(sourceFile);
20
- });
21
- };
22
- exports.getFunctionRange = getFunctionRange;
@@ -1,22 +0,0 @@
1
- import ts from "typescript";
2
- const getFunctionRange = (contents, name) => {
3
- return new Promise((resolve, reject) => {
4
- const timeout = setTimeout(() => {
5
- reject(new Error("Timeout"));
6
- }, 100);
7
- const sourceFile = ts.createSourceFile("temp.ts", contents, ts.ScriptTarget.Latest, true);
8
- function visit(node) {
9
- if (ts.isVariableDeclaration(node) && node.name.getText() === name) {
10
- const start = node.getStart();
11
- const end = node.getEnd();
12
- clearTimeout(timeout);
13
- resolve([start, end]);
14
- }
15
- node.forEachChild(visit);
16
- }
17
- visit(sourceFile);
18
- });
19
- };
20
- export {
21
- getFunctionRange
22
- };
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const path = require("path");
4
- var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
5
- const getCorePackageRoot = () => {
6
- let { pathname } = new URL(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("compiler/helpers.cjs", document.baseURI).href);
7
- while (/core\/?(src\/)?$/.test(pathname) === false) {
8
- pathname = path.join(pathname, "../");
9
- }
10
- return pathname;
11
- };
12
- const resolveExportValue = async (value, maxLevel = 10, _level = 0) => {
13
- if (_level >= maxLevel) return value;
14
- if (value instanceof Promise) return await resolveExportValue(await value, _level + 1, maxLevel);
15
- if (typeof value === "function" && "_shouldResolve" in value) return await resolveExportValue(await value(), _level + 1, maxLevel);
16
- return value;
17
- };
18
- const saltyFileExtensions = ["salty", "css", "styles", "styled"];
19
- const tsFileExtensions = ["ts", "tsx", "js", "jsx", "mjs", "cjs"];
20
- const escapeRegExp = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
21
- const saltyFileRegExp = (additional = [], testExtension = true) => {
22
- const extensions = [...saltyFileExtensions, ...additional].map(escapeRegExp).join("|");
23
- if (testExtension) {
24
- return new RegExp(`\\.(${extensions})\\.(${tsFileExtensions.map(escapeRegExp).join("|")})$`);
25
- }
26
- return new RegExp(`\\.(${extensions})\\.`);
27
- };
28
- const isSaltyFile = (file, additional = [], testExtension = true) => saltyFileRegExp(additional, testExtension).test(file);
29
- exports.getCorePackageRoot = getCorePackageRoot;
30
- exports.isSaltyFile = isSaltyFile;
31
- exports.resolveExportValue = resolveExportValue;
32
- exports.saltyFileExtensions = saltyFileExtensions;
33
- exports.saltyFileRegExp = saltyFileRegExp;
34
- exports.tsFileExtensions = tsFileExtensions;
@@ -1,33 +0,0 @@
1
- import { join } from "path";
2
- const getCorePackageRoot = () => {
3
- let { pathname } = new URL(import.meta.url);
4
- while (/core\/?(src\/)?$/.test(pathname) === false) {
5
- pathname = join(pathname, "../");
6
- }
7
- return pathname;
8
- };
9
- const resolveExportValue = async (value, maxLevel = 10, _level = 0) => {
10
- if (_level >= maxLevel) return value;
11
- if (value instanceof Promise) return await resolveExportValue(await value, _level + 1, maxLevel);
12
- if (typeof value === "function" && "_shouldResolve" in value) return await resolveExportValue(await value(), _level + 1, maxLevel);
13
- return value;
14
- };
15
- const saltyFileExtensions = ["salty", "css", "styles", "styled"];
16
- const tsFileExtensions = ["ts", "tsx", "js", "jsx", "mjs", "cjs"];
17
- const escapeRegExp = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
18
- const saltyFileRegExp = (additional = [], testExtension = true) => {
19
- const extensions = [...saltyFileExtensions, ...additional].map(escapeRegExp).join("|");
20
- if (testExtension) {
21
- return new RegExp(`\\.(${extensions})\\.(${tsFileExtensions.map(escapeRegExp).join("|")})$`);
22
- }
23
- return new RegExp(`\\.(${extensions})\\.`);
24
- };
25
- const isSaltyFile = (file, additional = [], testExtension = true) => saltyFileRegExp(additional, testExtension).test(file);
26
- export {
27
- getCorePackageRoot,
28
- isSaltyFile,
29
- resolveExportValue,
30
- saltyFileExtensions,
31
- saltyFileRegExp,
32
- tsFileExtensions
33
- };