@uniweb/build 0.14.27 → 0.14.28

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 (2) hide show
  1. package/package.json +4 -4
  2. package/src/schema.js +24 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/build",
3
- "version": "0.14.27",
3
+ "version": "0.14.28",
4
4
  "description": "Build tooling for the Uniweb Component Web Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -59,12 +59,12 @@
59
59
  "js-yaml": "^4.1.0",
60
60
  "sharp": "^0.33.2",
61
61
  "yaml": "^2.5.0",
62
- "@uniweb/theming": "0.1.7",
62
+ "@uniweb/theming": "0.1.8",
63
63
  "@uniweb/content-writer": "0.2.6"
64
64
  },
65
65
  "optionalDependencies": {
66
+ "@uniweb/runtime": "0.8.26",
66
67
  "@uniweb/content-reader": "1.1.12",
67
- "@uniweb/runtime": "0.8.25",
68
68
  "@uniweb/schemas": "0.2.4"
69
69
  },
70
70
  "peerDependencies": {
@@ -74,7 +74,7 @@
74
74
  "@tailwindcss/vite": "^4.0.0",
75
75
  "@vitejs/plugin-react": "^4.0.0 || ^5.0.0",
76
76
  "vite-plugin-svgr": "^4.0.0",
77
- "@uniweb/core": "0.7.19"
77
+ "@uniweb/core": "0.7.20"
78
78
  },
79
79
  "peerDependenciesMeta": {
80
80
  "vite": {
package/src/schema.js CHANGED
@@ -12,6 +12,7 @@
12
12
 
13
13
  import { readdir, readFile } from 'node:fs/promises'
14
14
  import { existsSync } from 'node:fs'
15
+ import { isFontVar } from '@uniweb/theming'
15
16
  import { join, dirname, extname, basename } from 'node:path'
16
17
  import { pathToFileURL } from 'node:url'
17
18
  import { inferTitle } from './utils/infer-title.js'
@@ -133,7 +134,7 @@ export async function loadFoundationConfig(srcDir) {
133
134
  // Support both default export and named exports
134
135
  return {
135
136
  ...module.default,
136
- vars: module.vars || module.default?.vars,
137
+ vars: inferFontVarTypes(module.vars || module.default?.vars),
137
138
  defaultLayout: module.default?.defaultLayout,
138
139
  }
139
140
  } catch (error) {
@@ -142,6 +143,28 @@ export async function loadFoundationConfig(srcDir) {
142
143
  }
143
144
  }
144
145
 
146
+ /**
147
+ * Infer `type: 'font'` on a `font-*`-named foundation var that doesn't declare a
148
+ * type (and isn't a CSS longhand). The runtime already treats such vars as
149
+ * typefaces; persisting the type here surfaces them as fonts in schema.json — so
150
+ * the editor sees them as fonts too. Explicit types are never overridden; a
151
+ * bare-named font var still needs an explicit `type: 'font'`.
152
+ */
153
+ function inferFontVarTypes(vars) {
154
+ if (!vars || typeof vars !== 'object') return vars
155
+ const out = {}
156
+ for (const [name, config] of Object.entries(vars)) {
157
+ const isObj = config !== null && typeof config === 'object'
158
+ const hasType = isObj && config.type !== undefined
159
+ if (!hasType && isFontVar(name, config)) {
160
+ out[name] = isObj ? { ...config, type: 'font' } : { default: config, type: 'font' }
161
+ } else {
162
+ out[name] = config
163
+ }
164
+ }
165
+ return out
166
+ }
167
+
145
168
  /**
146
169
  * @deprecated Use loadFoundationConfig instead
147
170
  */