@stacksjs/stx 0.2.419 → 0.2.420

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 (60) hide show
  1. package/dist/{chunk-9d5eab03.js → chunk-014gmm8w.js} +1 -1
  2. package/dist/{chunk-xwfjhz0h.js → chunk-0y7x0hvr.js} +1 -1
  3. package/dist/{chunk-68dkgdhq.js → chunk-1336h4sv.js} +1 -1
  4. package/dist/{chunk-p828w2b8.js → chunk-3kmhv1kf.js} +1 -1
  5. package/dist/{chunk-f6z33aa6.js → chunk-3ynkg5dz.js} +1 -1
  6. package/dist/{chunk-3cp46g4f.js → chunk-3zye6eh1.js} +1 -1
  7. package/dist/{chunk-bvae0b17.js → chunk-4488r5j1.js} +1 -1
  8. package/dist/{chunk-mbbx3w32.js → chunk-4e101kjp.js} +1 -1
  9. package/dist/{chunk-wbm2yq5d.js → chunk-4mew0ae3.js} +1 -1
  10. package/dist/{chunk-wgqjjhx5.js → chunk-5akd7qsb.js} +1 -1
  11. package/dist/{chunk-37eyawdr.js → chunk-5eqd40k0.js} +1 -1
  12. package/dist/{chunk-ynkc9t68.js → chunk-6aqcgrhw.js} +1 -1
  13. package/dist/chunk-6r9y4p81.js +2 -0
  14. package/dist/{chunk-ga83rmz6.js → chunk-75zcwcrt.js} +1 -1
  15. package/dist/{chunk-0xpgfvrn.js → chunk-89e1d0rz.js} +1 -1
  16. package/dist/{chunk-qbq6652q.js → chunk-a4r19yxm.js} +1 -1
  17. package/dist/{chunk-60bes9yt.js → chunk-awtrcb5m.js} +2 -2
  18. package/dist/{chunk-ycp9r4qn.js → chunk-b7z2yegr.js} +1 -1
  19. package/dist/{chunk-w7a4mjsm.js → chunk-bh4x090w.js} +1 -1
  20. package/dist/{chunk-9qx66tpp.js → chunk-bmk0s261.js} +1 -1
  21. package/dist/{chunk-g43wvf4g.js → chunk-bvbank3z.js} +1 -1
  22. package/dist/{chunk-rjd08g2t.js → chunk-cvzkbsds.js} +1 -1
  23. package/dist/{chunk-7n8ns8sr.js → chunk-cw6j75ck.js} +2 -2
  24. package/dist/{chunk-3xdqvrxa.js → chunk-debz86rr.js} +1 -1
  25. package/dist/{chunk-gk56fgfz.js → chunk-dscsvkfa.js} +1 -1
  26. package/dist/{chunk-hr7rmyv7.js → chunk-eav0pt6d.js} +1 -1
  27. package/dist/{chunk-dg4q9qw2.js → chunk-hjp990p8.js} +1 -1
  28. package/dist/{chunk-qtz161z6.js → chunk-k1am0dyg.js} +1 -1
  29. package/dist/{chunk-hdx8x2z1.js → chunk-kea18wnc.js} +1 -1
  30. package/dist/{chunk-0bsjrj8s.js → chunk-mk7b3qdz.js} +1 -1
  31. package/dist/{chunk-55yja0xs.js → chunk-ncvfjcr2.js} +1 -1
  32. package/dist/{chunk-zynzw92k.js → chunk-p7b17yr0.js} +1 -1
  33. package/dist/{chunk-zz6ad4p5.js → chunk-pzngjk81.js} +5 -5
  34. package/dist/{chunk-dxb1bbtr.js → chunk-rj3hyqff.js} +169 -168
  35. package/dist/{chunk-yqm74xyg.js → chunk-rj8rdd8n.js} +1 -1
  36. package/dist/{chunk-q0mbgq3n.js → chunk-s0pmn48x.js} +1 -1
  37. package/dist/{chunk-d9yq3tyx.js → chunk-s58yz9q0.js} +1 -1
  38. package/dist/{chunk-j0twxvjf.js → chunk-srdzwtsq.js} +1 -1
  39. package/dist/{chunk-ra1rcn3g.js → chunk-vwxasbtx.js} +1 -1
  40. package/dist/{chunk-61kz487h.js → chunk-wynvh7dc.js} +1 -1
  41. package/dist/{chunk-s3ktxdbd.js → chunk-y4xs4m7p.js} +1 -1
  42. package/dist/{chunk-se1b9b6m.js → chunk-y8rpk1b9.js} +1 -1
  43. package/dist/{chunk-byvbdmb2.js → chunk-y9m93qkk.js} +1 -1
  44. package/dist/{chunk-vcx4bxj3.js → chunk-yvq1f313.js} +1 -1
  45. package/dist/{chunk-c4s2pe49.js → chunk-yy3dgwfm.js} +1 -1
  46. package/dist/{chunk-xbragnsq.js → chunk-z0ck9t6j.js} +1 -1
  47. package/dist/{chunk-963skd21.js → chunk-z521cyfv.js} +2 -2
  48. package/dist/cli.js +7 -7
  49. package/dist/craft-entry.js +1 -1
  50. package/dist/craft.js +1 -1
  51. package/dist/dev-server/ts-css.js +2 -2
  52. package/dist/index.d.ts +1 -1
  53. package/dist/index.js +1 -1
  54. package/dist/native/runtime/craft.d.ts +1 -0
  55. package/dist/pwa.js +1 -1
  56. package/dist/ssg.js +2 -2
  57. package/dist/ts-css-config.d.ts +21 -0
  58. package/dist/ts-css-config.js +12 -4
  59. package/package.json +5 -5
  60. package/dist/chunk-8j3f789a.js +0 -2
@@ -59,7 +59,28 @@ export interface MergedCssConfig {
59
59
  * to the light colour.
60
60
  */
61
61
  tokenCSS: string;
62
+ /**
63
+ * The project's `fonts` (Google families, self-hosted `@font-face` rules),
64
+ * kept out of `config`: render them once with {@link renderFontCSS} and put
65
+ * them first. Every generator reads `fonts` and writes them at the top of
66
+ * its own output, so a sheet built from two generators (shortcuts, then
67
+ * utilities) carried each `@font-face` twice, and the role tokens
68
+ * prepended ahead of it left a Google `@import` behind a rule, where
69
+ * browsers ignore it.
70
+ */
71
+ fonts?: Dict;
62
72
  }
73
+ /** The engine's generator, as far as rendering font rules needs it. */
74
+ type FontRenderer = new (config: any) => {
75
+ toCSS: (includePreflight: boolean, minify: boolean) => string;
76
+ };
77
+ /**
78
+ * The sheet's web-font CSS, rendered by the engine from `merged.fonts`, or
79
+ * `''` when the project declares none. A generator that is asked for no
80
+ * classes, no preflight and no CSS variables writes only its fonts. Callers
81
+ * put this at the very top of the stylesheet, before the role tokens.
82
+ */
83
+ export declare function renderFontCSS(Generator: FontRenderer, merged: MergedCssConfig): string;
63
84
  /**
64
85
  * Merge a project's css config over the package defaults.
65
86
  *
@@ -8,6 +8,13 @@ export function deepMergeThemes(target, source) {
8
8
  out[key] = isPlainObject(value) && isPlainObject(out[key]) ? deepMergeThemes(out[key], value) : value;
9
9
  return out;
10
10
  }
11
+ export function renderFontCSS(Generator, merged) {
12
+ if (!merged.fonts)
13
+ return "";
14
+ const css = new Generator({ ...merged.config, fonts: merged.fonts, cssVariables: !1 }).toCSS(!1, merged.minify);
15
+ return css && !merged.minify ? `${css}
16
+ ` : css;
17
+ }
11
18
  export function mergeCssConfig(base = {}, user = {}) {
12
19
  const baseTheme = base.theme || {}, userTheme = user.theme || {}, { extend: userExtend, ...userThemeKeys } = userTheme, { extend: baseExtend, ...baseThemeKeys } = baseTheme, basePalette = baseThemeKeys.colors || {};
13
20
  baseThemeKeys.colors = { ...basePalette, ...semanticColors(basePalette) };
@@ -25,11 +32,11 @@ export function mergeCssConfig(base = {}, user = {}) {
25
32
  }, preflights = [
26
33
  ...base.preflights || [],
27
34
  ...user.preflights || []
28
- ];
35
+ ], { fonts: baseFonts, ...baseRest } = base, { fonts: userFonts, ...userRest } = user, fonts = userFonts ?? baseFonts;
29
36
  return {
30
37
  config: {
31
- ...base,
32
- ...user,
38
+ ...baseRest,
39
+ ...userRest,
33
40
  theme,
34
41
  safelist,
35
42
  shortcuts,
@@ -41,6 +48,7 @@ export function mergeCssConfig(base = {}, user = {}) {
41
48
  shortcuts,
42
49
  includePreflight: user.preflight !== !1,
43
50
  minify: user.minify === !0,
44
- tokenCSS: semanticTokenCSS(basePalette) + shapeTokenCSS()
51
+ tokenCSS: semanticTokenCSS(basePalette) + shapeTokenCSS(),
52
+ ...fonts ? { fonts } : {}
45
53
  };
46
54
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.419",
4
+ "version": "0.2.420",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -122,12 +122,12 @@
122
122
  "dependencies": {
123
123
  "@stacksjs/ts-css": "^0.3.2",
124
124
  "@stacksjs/clapp": "^0.2.16",
125
- "@stacksjs/desktop": "0.2.419",
126
- "@stacksjs/sanitizer": "0.2.419",
125
+ "@stacksjs/desktop": "0.2.420",
126
+ "@stacksjs/sanitizer": "0.2.420",
127
127
  "@stacksjs/ts-i18n": "^0.1.11",
128
- "bun-plugin-stx": "0.2.419",
128
+ "bun-plugin-stx": "0.2.420",
129
129
  "bunfig": "^0.15.19",
130
- "stx-router": "0.2.419",
130
+ "stx-router": "0.2.420",
131
131
  "ts-broadcasting": "^0.0.11",
132
132
  "ts-images": "^0.2.22",
133
133
  "ts-syntax-highlighter": "^0.2.1"
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{_o,Ro}from"./chunk-zz6ad4p5.js";import"./chunk-8vq0qjq9.js";import"./chunk-h1h6xe1k.js";import"./chunk-3xdqvrxa.js";import"./chunk-aync8qmk.js";import"./chunk-w7a4mjsm.js";import"./chunk-0xpgfvrn.js";import"./chunk-qby6wxat.js";import"./chunk-m16h8ea0.js";import"./chunk-f6z33aa6.js";import"./chunk-9d5eab03.js";import{Js}from"./chunk-7n8ns8sr.js";import"./chunk-qx3js9tk.js";import"./chunk-r8wze9ym.js";import"./chunk-dg4q9qw2.js";import"./chunk-hy9e3ny6.js";import"./chunk-rsxvbnp4.js";import"./chunk-ep5jnqdb.js";import"./chunk-2tfe2g58.js";import"./chunk-10967rws.js";import"./chunk-b1fg9vg7.js";import"./chunk-hdx8x2z1.js";import"./chunk-34gy5zjm.js";import"./chunk-0varh725.js";import"./chunk-ap6fehea.js";import"./chunk-xvzxrt9a.js";import"./chunk-tqnysw0k.js";import"./chunk-k31fwm2w.js";import"./chunk-wbm2yq5d.js";import"./chunk-8j8k27xb.js";import"./chunk-qbq6652q.js";import"./chunk-60bes9yt.js";import"./chunk-2ewa2sg5.js";import"./chunk-ynkc9t68.js";import"./chunk-xbragnsq.js";import{me,Yt,Zt,q,d,r,Vn,A,i,ce}from"./chunk-dxb1bbtr.js";import"./chunk-11ra3sbc.js";import"./chunk-x5ks23vx.js";import"./chunk-g1fxmp9z.js";import"./chunk-mbbx3w32.js";import"./chunk-62r4fa4q.js";import"./chunk-32y3767j.js";import"./chunk-ax58cds3.js";import"./chunk-09hhrjk9.js";import"./chunk-tafebmtg.js";import"./chunk-757ec865.js";import"./chunk-66k7yxnr.js";import"./chunk-4n6c5rp5.js";export{Vn as buildWebComponents,Zt as cacheTemplate,Yt as checkCache,Js as classifyAllScripts,_o as createMiddleware,Ro as createRoute,A as defaultConfig,d as extractVariables,q as injectRouterScript,i as loadStxConfig,me as processClientScript,r as processDirectives,ce as readMarkdownFile};