@webority/tokens 0.90.0 → 0.92.0
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.
- package/dist/canvas/webority-phone.json +16 -28
- package/dist/canvas/webority-web-390.json +16 -26
- package/dist/canvas/webority-web.json +16 -26
- package/dist/emit/canvas.js +1 -1
- package/dist/emit/email.js +1 -1
- package/dist/emit/phone.js +2 -2
- package/dist/emit/web.js +1 -1
- package/dist/meanings.json +1 -1
- package/dist/model/load.js +1 -1
- package/dist/names.js +1 -1
- package/dist/outputs.d.ts +4 -1
- package/dist/source/meaning.tokens.json +15 -0
- package/dist/source/platform.phone.tokens.json +16 -24
- package/dist/source/scale.tokens.json +12 -51
- package/dist/source/width.390.tokens.json +12 -24
- package/package.json +1 -1
- package/renames/0.91.0.json +90 -0
- package/schema/webority-tokens.schema.json +4 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"format": "webority-theme-tokens/2",
|
|
3
3
|
"source": {
|
|
4
4
|
"package": "@webority/tokens",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.92.0",
|
|
6
6
|
"brand": null,
|
|
7
7
|
"platform": "phone",
|
|
8
8
|
"width": null
|
|
@@ -203,52 +203,40 @@
|
|
|
203
203
|
},
|
|
204
204
|
"text": {
|
|
205
205
|
"xs": {
|
|
206
|
-
"size": 11
|
|
207
|
-
"lineHeight": 1.5
|
|
206
|
+
"size": 11
|
|
208
207
|
},
|
|
209
208
|
"sm": {
|
|
210
|
-
"size": 13
|
|
211
|
-
"lineHeight": 1.5
|
|
209
|
+
"size": 13
|
|
212
210
|
},
|
|
213
211
|
"base": {
|
|
214
|
-
"size": 15
|
|
215
|
-
"lineHeight": 1.5
|
|
212
|
+
"size": 15
|
|
216
213
|
},
|
|
217
214
|
"lg": {
|
|
218
|
-
"size": 17
|
|
219
|
-
"lineHeight": 1.4
|
|
215
|
+
"size": 17
|
|
220
216
|
},
|
|
221
217
|
"xl": {
|
|
222
|
-
"size": 20
|
|
223
|
-
"lineHeight": 1.3
|
|
218
|
+
"size": 20
|
|
224
219
|
},
|
|
225
220
|
"2xl": {
|
|
226
|
-
"size": 24
|
|
227
|
-
"lineHeight": 1.25
|
|
221
|
+
"size": 24
|
|
228
222
|
},
|
|
229
223
|
"3xl": {
|
|
230
|
-
"size": 30
|
|
231
|
-
"lineHeight": 1.2
|
|
224
|
+
"size": 30
|
|
232
225
|
},
|
|
233
226
|
"4xl": {
|
|
234
|
-
"size": 36
|
|
235
|
-
"lineHeight": 1.1
|
|
227
|
+
"size": 36
|
|
236
228
|
},
|
|
237
229
|
"5xl": {
|
|
238
|
-
"size": 45
|
|
239
|
-
"lineHeight": 1.05
|
|
230
|
+
"size": 45
|
|
240
231
|
},
|
|
241
232
|
"6xl": {
|
|
242
|
-
"size": 57
|
|
243
|
-
"lineHeight": 1
|
|
233
|
+
"size": 57
|
|
244
234
|
},
|
|
245
235
|
"7xl": {
|
|
246
|
-
"size": 64
|
|
247
|
-
"lineHeight": 1
|
|
236
|
+
"size": 64
|
|
248
237
|
},
|
|
249
238
|
"8xl": {
|
|
250
|
-
"size": 72
|
|
251
|
-
"lineHeight": 1
|
|
239
|
+
"size": 72
|
|
252
240
|
}
|
|
253
241
|
},
|
|
254
242
|
"typography": {
|
|
@@ -259,9 +247,9 @@
|
|
|
259
247
|
"bold": 700
|
|
260
248
|
},
|
|
261
249
|
"leading": {
|
|
262
|
-
"
|
|
263
|
-
"
|
|
264
|
-
"
|
|
250
|
+
"heading": 1.2,
|
|
251
|
+
"body": 1.4,
|
|
252
|
+
"display": 1.2
|
|
265
253
|
}
|
|
266
254
|
},
|
|
267
255
|
"fonts": {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"format": "webority-theme-tokens/2",
|
|
3
3
|
"source": {
|
|
4
4
|
"package": "@webority/tokens",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.92.0",
|
|
6
6
|
"brand": null,
|
|
7
7
|
"platform": "web",
|
|
8
8
|
"width": 390
|
|
@@ -245,52 +245,40 @@
|
|
|
245
245
|
},
|
|
246
246
|
"text": {
|
|
247
247
|
"xs": {
|
|
248
|
-
"size": 12.07
|
|
249
|
-
"lineHeight": 1.5
|
|
248
|
+
"size": 12.07
|
|
250
249
|
},
|
|
251
250
|
"sm": {
|
|
252
|
-
"size": 13.11
|
|
253
|
-
"lineHeight": 1.5
|
|
251
|
+
"size": 13.11
|
|
254
252
|
},
|
|
255
253
|
"base": {
|
|
256
|
-
"size": 15.38
|
|
257
|
-
"lineHeight": 1.5
|
|
254
|
+
"size": 15.38
|
|
258
255
|
},
|
|
259
256
|
"lg": {
|
|
260
|
-
"size": 17.04
|
|
261
|
-
"lineHeight": 1.4
|
|
257
|
+
"size": 17.04
|
|
262
258
|
},
|
|
263
259
|
"xl": {
|
|
264
|
-
"size": 20.35
|
|
265
|
-
"lineHeight": 1.3
|
|
260
|
+
"size": 20.35
|
|
266
261
|
},
|
|
267
262
|
"2xl": {
|
|
268
|
-
"size": 24.7
|
|
269
|
-
"lineHeight": 1.25
|
|
263
|
+
"size": 24.7
|
|
270
264
|
},
|
|
271
265
|
"3xl": {
|
|
272
|
-
"size": 30.83
|
|
273
|
-
"lineHeight": 1.2
|
|
266
|
+
"size": 30.83
|
|
274
267
|
},
|
|
275
268
|
"4xl": {
|
|
276
|
-
"size": 36.95
|
|
277
|
-
"lineHeight": 1.1
|
|
269
|
+
"size": 36.95
|
|
278
270
|
},
|
|
279
271
|
"5xl": {
|
|
280
|
-
"size": 45.03
|
|
281
|
-
"lineHeight": 1.05
|
|
272
|
+
"size": 45.03
|
|
282
273
|
},
|
|
283
274
|
"6xl": {
|
|
284
|
-
"size": 56.65
|
|
285
|
-
"lineHeight": 1
|
|
275
|
+
"size": 56.65
|
|
286
276
|
},
|
|
287
277
|
"7xl": {
|
|
288
|
-
"size": 64
|
|
289
|
-
"lineHeight": 1
|
|
278
|
+
"size": 64
|
|
290
279
|
},
|
|
291
280
|
"8xl": {
|
|
292
|
-
"size": 72.03
|
|
293
|
-
"lineHeight": 1
|
|
281
|
+
"size": 72.03
|
|
294
282
|
}
|
|
295
283
|
},
|
|
296
284
|
"typography": {
|
|
@@ -301,7 +289,9 @@
|
|
|
301
289
|
"bold": 700
|
|
302
290
|
},
|
|
303
291
|
"leading": {
|
|
304
|
-
"
|
|
292
|
+
"heading": 1.2,
|
|
293
|
+
"body": 1.55,
|
|
294
|
+
"display": 1.05
|
|
305
295
|
}
|
|
306
296
|
},
|
|
307
297
|
"fonts": {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"format": "webority-theme-tokens/2",
|
|
3
3
|
"source": {
|
|
4
4
|
"package": "@webority/tokens",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.92.0",
|
|
6
6
|
"brand": null,
|
|
7
7
|
"platform": "web",
|
|
8
8
|
"width": 1440
|
|
@@ -245,52 +245,40 @@
|
|
|
245
245
|
},
|
|
246
246
|
"text": {
|
|
247
247
|
"xs": {
|
|
248
|
-
"size": 13
|
|
249
|
-
"lineHeight": 1.5
|
|
248
|
+
"size": 13
|
|
250
249
|
},
|
|
251
250
|
"sm": {
|
|
252
|
-
"size": 14
|
|
253
|
-
"lineHeight": 1.5
|
|
251
|
+
"size": 14
|
|
254
252
|
},
|
|
255
253
|
"base": {
|
|
256
|
-
"size": 16.8
|
|
257
|
-
"lineHeight": 1.5
|
|
254
|
+
"size": 16.8
|
|
258
255
|
},
|
|
259
256
|
"lg": {
|
|
260
|
-
"size": 20
|
|
261
|
-
"lineHeight": 1.4
|
|
257
|
+
"size": 20
|
|
262
258
|
},
|
|
263
259
|
"xl": {
|
|
264
|
-
"size": 24
|
|
265
|
-
"lineHeight": 1.3
|
|
260
|
+
"size": 24
|
|
266
261
|
},
|
|
267
262
|
"2xl": {
|
|
268
|
-
"size": 32
|
|
269
|
-
"lineHeight": 1.25
|
|
263
|
+
"size": 32
|
|
270
264
|
},
|
|
271
265
|
"3xl": {
|
|
272
|
-
"size": 44
|
|
273
|
-
"lineHeight": 1.2
|
|
266
|
+
"size": 44
|
|
274
267
|
},
|
|
275
268
|
"4xl": {
|
|
276
|
-
"size": 56
|
|
277
|
-
"lineHeight": 1.1
|
|
269
|
+
"size": 56
|
|
278
270
|
},
|
|
279
271
|
"5xl": {
|
|
280
|
-
"size": 72
|
|
281
|
-
"lineHeight": 1.05
|
|
272
|
+
"size": 72
|
|
282
273
|
},
|
|
283
274
|
"6xl": {
|
|
284
|
-
"size": 96
|
|
285
|
-
"lineHeight": 1
|
|
275
|
+
"size": 96
|
|
286
276
|
},
|
|
287
277
|
"7xl": {
|
|
288
|
-
"size": 119.95
|
|
289
|
-
"lineHeight": 1
|
|
278
|
+
"size": 119.95
|
|
290
279
|
},
|
|
291
280
|
"8xl": {
|
|
292
|
-
"size": 144
|
|
293
|
-
"lineHeight": 1
|
|
281
|
+
"size": 144
|
|
294
282
|
}
|
|
295
283
|
},
|
|
296
284
|
"typography": {
|
|
@@ -301,7 +289,9 @@
|
|
|
301
289
|
"bold": 700
|
|
302
290
|
},
|
|
303
291
|
"leading": {
|
|
304
|
-
"
|
|
292
|
+
"heading": 1.2,
|
|
293
|
+
"body": 1.55,
|
|
294
|
+
"display": 1.05
|
|
305
295
|
}
|
|
306
296
|
},
|
|
307
297
|
"fonts": {
|
package/dist/emit/canvas.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){return{web:t(e,`web`,1440),web390:t(e,`web`,390),phone:t(e,`phone`,null)}}function t(e,t,a){let o=n(e,`light`,t,a),s=n(e,`dark`,t,a),c={format:`webority-theme-tokens/2`,source:{package:e.source.package,version:e.source.version,brand:e.source.brand,platform:t,width:a},modes:[`light`,`dark`],colors:{light:{},dark:{}},space:{},radius:{},text:{},typography:{fontWeight:{},leading:{}},fonts:{},shadow:{},components:{}};for(let t of e.tokens.values())t.group===`color`?i(c,e,t,o,s):e.existsIn(t.path,o)&&r(c,e,t,o);return c}function n(e,t,n,r){let i=e.contexts.find(e=>e.mode===t&&e.platform===n&&e.width===r);if(!i){let e=r===null?``:` ${r}`;throw Error(`emitCanvas: the model has no ${t} ${n}${e} context`)}return i}function r(e,t,n,r){let{path:i,name:o}=n;switch(n.group){case`space`:e.space[o]=s(t,i,r);break;case`radius`:e.radius[o]=s(t,i,r);break;case`text`:e.text[o]={size:s(t,i,r)
|
|
1
|
+
function e(e){return{web:t(e,`web`,1440),web390:t(e,`web`,390),phone:t(e,`phone`,null)}}function t(e,t,a){let o=n(e,`light`,t,a),s=n(e,`dark`,t,a),c={format:`webority-theme-tokens/2`,source:{package:e.source.package,version:e.source.version,brand:e.source.brand,platform:t,width:a},modes:[`light`,`dark`],colors:{light:{},dark:{}},space:{},radius:{},text:{},typography:{fontWeight:{},leading:{}},fonts:{},shadow:{},components:{}};for(let t of e.tokens.values())t.group===`color`?i(c,e,t,o,s):e.existsIn(t.path,o)&&r(c,e,t,o);return c}function n(e,t,n,r){let i=e.contexts.find(e=>e.mode===t&&e.platform===n&&e.width===r);if(!i){let e=r===null?``:` ${r}`;throw Error(`emitCanvas: the model has no ${t} ${n}${e} context`)}return i}function r(e,t,n,r){let{path:i,name:o}=n;switch(n.group){case`space`:e.space[o]=s(t,i,r);break;case`radius`:e.radius[o]=s(t,i,r);break;case`text`:e.text[o]={size:s(t,i,r)};break;case`weight`:e.typography.fontWeight[o]=c(t,i,r);break;case`leading`:e.typography.leading[o]=c(t,i,r);break;case`font`:e.fonts[o]=l(t,i,r);break;case`shadow`:e.shadow[o]=u(t,i,r);break;case`component`:a(e,t,i,r);break}}function i(e,t,n,r,i){let a=t.existsIn(n.path,r);if(a!==t.existsIn(n.path,i))throw Error(`emitCanvas: ${n.path} is present in one mode only`);if(a&&(e.colors.light[n.name]=o(t,n.path,r),e.colors.dark[n.name]=o(t,n.path,i),n.brandOwn)){if(typeof n.description!=`string`||n.description===``)throw Error(`emitCanvas: ${n.path} is a brand colour and needs a description`);e.colorMeanings??={},e.colorMeanings[n.name]=n.description}}function a(e,t,n,r){let i=n.split(`.`);if(i.length!==3&&i.length!==4)throw Error(`emitCanvas: ${n} must be component.<name>.<prop> or component.<name>.<size>.<prop>`);let a=i[1],o=i[i.length-1];e.components[a]??={base:{},sizes:{}};let s=i.length===3?e.components[a].base:e.components[a].sizes[i[2]]??={};s[o]=f(t,n,r)}function o(e,t,n){let r=e.resolvedIn(t,n);if(typeof r!=`string`)throw Error(`emitCanvas: ${t} is not a colour string`);return r}function s(e,t,n){let r=e.resolvedIn(t,n);if(typeof r==`number`)return r;if(typeof r==`object`&&r&&r.unit===`px`&&typeof r.value==`number`)return r.value;throw Error(`emitCanvas: ${t} is not a px length`)}function c(e,t,n){let r=e.resolvedIn(t,n);if(typeof r!=`number`)throw Error(`emitCanvas: ${t} is not a number`);return r}function l(e,t,n){let r=e.resolvedIn(t,n);if(!Array.isArray(r)||r.length===0)throw Error(`emitCanvas: ${t} is not a font family list`);return{family:r[0],fallback:r.slice(1).join(`, `)}}function u(e,t,n){let r=e.resolvedIn(t,n);if(r===`none`)return null;if(typeof r!=`object`||!r||typeof r.color!=`string`)throw Error(`emitCanvas: ${t} is not a shadow`);let[i,a,o,s]=[`offsetX`,`offsetY`,`blur`,`spread`].map(e=>d(t,r[e])),c={x:i,y:a,blur:o,spread:s,color:r.color},l=e.tokens.get(t)?.extensions?.elevation;return Number.isFinite(l)&&(c.elevation=l),c}function d(e,t){let n=typeof t==`number`?t:t?.value;if(typeof n!=`number`)throw Error(`emitCanvas: ${e} has a shadow length that is not a number`);return n}function f(e,t,n){let r=e.resolvedIn(t,n);if(typeof r==`string`||typeof r==`number`)return String(r);if(typeof r==`object`&&r&&typeof r.unit==`string`)return`${r.value}${r.unit}`;throw Error(`emitCanvas: ${t} is not a component value`)}export{e as emitCanvas};
|
package/dist/emit/email.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=[`light`,`dark`],t=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`ui-serif`,`ui-sans-serif`,`ui-monospace`]),n=[[`body`,`ui`],[`display`,`display`],[`mono`,`mono`]],r=Object.freeze({page:`bg`,canvas:`bg`,card:`surface`,panel:`bg-subtle`,"panel-alt":`bg-muted`,surface:`surface`,line:`border`,"line-strong":`border-strong`,"accent-tint-line":`primary-wash-strong`,heading:`text`,strong:`text`,text:`text-body`,secondary:`text-muted`,muted:`text-subtle`,accent:`primary`,"on-accent":`on-primary`,link:`link`,success:`success-text`,warning:`warning-text`,danger:`danger-text`,"accent-tint":`primary-wash`,"success-tint":`success-soft`,"warning-tint":`warning-soft`,"danger-tint":`danger-soft`,"figure-panel":`primary-wash`}),i=Object.freeze({eyebrow:`xs`,h1:`2xl`,lede:`lg`,body:`base`,"body-large":`lg`,title:`2xl`,item:`base`,label:`sm`,note:`sm`,"note-small":`xs`,figure:`3xl`,"figure-hero":`4xl`,"figure-sub":`sm`,range:`sm`,sign:`base`,foot:`xs`,num:`base`,"code-otp":`2xl`,"code-id":`base`,button:`base`}),a=Object.freeze({section:`2xl`,"section-phone":`xl`,tight:`md`,item:`sm`,"heading-after":`xl`,"eyebrow-after":`xxs`,"title-after":`md`,"callout-lead-after":`xs`,"paragraph-gap":`sm`,"sign-gap":`2xl`,"sign-gap-phone":`lg`,"signature-gap":`md`,"step-gap":`lg`,"step-gutter":`3xl`,"step-gutter-phone":`2xl`,"step-number-space":`md`,"step-number-space-phone":`sm`,"column-top":`lg`,"column-gap":`lg`,"row-padding":`sm`,"panel-padding":`lg`,"panel-padding-wide":`lg`,"details-padding":`lg`,"details-padding-wide":`lg`,"hero-padding":`xl lg`,"hero-padding-wide":`2xl lg`,"columns-padding":`none lg lg lg`,"columns-padding-wide":`xs lg lg lg`}),o=new Set([`panel-padding`,`panel-padding-wide`,`details-padding`,`details-padding-wide`,`hero-padding`,`hero-padding-wide`,`columns-padding`,`columns-padding-wide`]),s=Object.freeze({"panel-radius":`md`,"tint-radius":`md`,"code-radius":`md`,"details-radius":`md`}),c=Object.freeze({radius:`md`,padding:`md sm`});function l(e){return Math.floor(e+.5)}function u(e){if(typeof e!=`string`)return null;let t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(e);if(t===null)return null;let n=t[1];n.length===3&&(n=[...n].map(e=>e+e).join(``));let r=e=>Number.parseInt(n.slice(e,e+2),16);return{r:r(0),g:r(2),b:r(4),a:n.length===8?r(6)/255:1}}function d(e,t,n){return`#${[e,t,n].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`.toUpperCase()}function f(e,t){if(e.a===1)return d(e.r,e.g,e.b);if(t===null)return null;let n=(t,n)=>l(t*e.a+n*(1-e.a));return d(n(e.r,t.r),n(e.g,t.g),n(e.b,t.b))}function p(t,n){let i={},a={light:{},dark:{}};for(let o of e){let e=t.colors?.[o]?.surface;e===void 0&&n(`email role card needs meaning surface in ${o}`);let s=u(e);s!==null&&s.a<1&&n(`email card colour (meaning surface, ${o}) must be opaque`),i[o]=s;for(let[e,s]of Object.entries(r)){let r=t.colors?.[o]?.[s];if(r===void 0){n(`email role ${e} needs meaning ${s} in ${o}`);continue}let c=u(r);if(c===null){n(`email role ${e} (meaning ${s}, ${o}): cannot read colour ${r}`);continue}a[o][e]=f(c,i[o])}}return Object.fromEntries(Object.keys(r).map(e=>[e,{light:a.light[e],dark:a.dark[e]}]))}function m(e,t,n){let r={};for(let[a,o]of Object.entries(i)){let i=e.text?.[o],
|
|
1
|
+
var e=[`light`,`dark`],t=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`ui-serif`,`ui-sans-serif`,`ui-monospace`]),n=[[`body`,`ui`],[`display`,`display`],[`mono`,`mono`]],r=Object.freeze({page:`bg`,canvas:`bg`,card:`surface`,panel:`bg-subtle`,"panel-alt":`bg-muted`,surface:`surface`,line:`border`,"line-strong":`border-strong`,"accent-tint-line":`primary-wash-strong`,heading:`text`,strong:`text`,text:`text-body`,secondary:`text-muted`,muted:`text-subtle`,accent:`primary`,"on-accent":`on-primary`,link:`link`,success:`success-text`,warning:`warning-text`,danger:`danger-text`,"accent-tint":`primary-wash`,"success-tint":`success-soft`,"warning-tint":`warning-soft`,"danger-tint":`danger-soft`,"figure-panel":`primary-wash`}),i=Object.freeze({eyebrow:{step:`xs`,leading:`body`},h1:{step:`2xl`,leading:`heading`},lede:{step:`lg`,leading:`body`},body:{step:`base`,leading:`body`},"body-large":{step:`lg`,leading:`body`},title:{step:`2xl`,leading:`heading`},item:{step:`base`,leading:`body`},label:{step:`sm`,leading:`body`},note:{step:`sm`,leading:`body`},"note-small":{step:`xs`,leading:`body`},figure:{step:`3xl`,leading:`display`},"figure-hero":{step:`4xl`,leading:`display`},"figure-sub":{step:`sm`,leading:`body`},range:{step:`sm`,leading:`body`},sign:{step:`base`,leading:`body`},foot:{step:`xs`,leading:`body`},num:{step:`base`,leading:`body`},"code-otp":{step:`2xl`,leading:`heading`},"code-id":{step:`base`,leading:`body`},button:{step:`base`,leading:`body`}}),a=Object.freeze({section:`2xl`,"section-phone":`xl`,tight:`md`,item:`sm`,"heading-after":`xl`,"eyebrow-after":`xxs`,"title-after":`md`,"callout-lead-after":`xs`,"paragraph-gap":`sm`,"sign-gap":`2xl`,"sign-gap-phone":`lg`,"signature-gap":`md`,"step-gap":`lg`,"step-gutter":`3xl`,"step-gutter-phone":`2xl`,"step-number-space":`md`,"step-number-space-phone":`sm`,"column-top":`lg`,"column-gap":`lg`,"row-padding":`sm`,"panel-padding":`lg`,"panel-padding-wide":`lg`,"details-padding":`lg`,"details-padding-wide":`lg`,"hero-padding":`xl lg`,"hero-padding-wide":`2xl lg`,"columns-padding":`none lg lg lg`,"columns-padding-wide":`xs lg lg lg`}),o=new Set([`panel-padding`,`panel-padding-wide`,`details-padding`,`details-padding-wide`,`hero-padding`,`hero-padding-wide`,`columns-padding`,`columns-padding-wide`]),s=Object.freeze({"panel-radius":`md`,"tint-radius":`md`,"code-radius":`md`,"details-radius":`md`}),c=Object.freeze({radius:`md`,padding:`md sm`});function l(e){return Math.floor(e+.5)}function u(e){if(typeof e!=`string`)return null;let t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(e);if(t===null)return null;let n=t[1];n.length===3&&(n=[...n].map(e=>e+e).join(``));let r=e=>Number.parseInt(n.slice(e,e+2),16);return{r:r(0),g:r(2),b:r(4),a:n.length===8?r(6)/255:1}}function d(e,t,n){return`#${[e,t,n].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`.toUpperCase()}function f(e,t){if(e.a===1)return d(e.r,e.g,e.b);if(t===null)return null;let n=(t,n)=>l(t*e.a+n*(1-e.a));return d(n(e.r,t.r),n(e.g,t.g),n(e.b,t.b))}function p(t,n){let i={},a={light:{},dark:{}};for(let o of e){let e=t.colors?.[o]?.surface;e===void 0&&n(`email role card needs meaning surface in ${o}`);let s=u(e);s!==null&&s.a<1&&n(`email card colour (meaning surface, ${o}) must be opaque`),i[o]=s;for(let[e,s]of Object.entries(r)){let r=t.colors?.[o]?.[s];if(r===void 0){n(`email role ${e} needs meaning ${s} in ${o}`);continue}let c=u(r);if(c===null){n(`email role ${e} (meaning ${s}, ${o}): cannot read colour ${r}`);continue}a[o][e]=f(c,i[o])}}return Object.fromEntries(Object.keys(r).map(e=>[e,{light:a.light[e],dark:a.dark[e]}]))}function m(e,t,n){let r={};for(let[a,{step:o,leading:s}]of Object.entries(i)){let i=e.text?.[o],c=t.text?.[o],u=e.typography?.leading?.[s],d=t.typography?.leading?.[s];i===void 0&&n(`email type role ${a} needs text step ${o}`),c===void 0&&n(`email type role ${a} needs text step ${o} in the 390 theme`),u===void 0&&n(`email type role ${a} needs leading ${s}`),d===void 0&&n(`email type role ${a} needs leading ${s} in the 390 theme`),!(i===void 0||c===void 0||u===void 0||d===void 0)&&(r[a]={size:l(i.size),lineHeight:l(i.size*u),phoneSize:l(c.size),phoneLineHeight:l(c.size*d)})}return r}function h(e,t,n,r){let i=[],a=!0;for(let o of t.split(/\s+/))typeof e.space?.[o]==`number`?i.push(e.space[o]):(r(n(o)),a=!1);return a?i.map(e=>`${e}px`).join(` `):null}function g(e,t,n,r){return/\s/.test(n)?(r(`email space role ${t} is a gap and takes one space step, not ${n}`),null):typeof e.space?.[n]==`number`?e.space[n]:(r(`email space role ${t} needs space step ${n}`),null)}function _(e,t){let n={};for(let[r,i]of Object.entries(a)){let a=o.has(r)?h(e,i,e=>`email space role ${r} needs space step ${e}`,t):g(e,r,i,t);a!==null&&(n[r]=a)}return n}function v(e,t){let n={};for(let[r,i]of Object.entries(s)){let a=e.radius?.[i];typeof a==`number`?n[r]=a:t(`email shape role ${r} needs radius step ${i}`)}return n}function y(e,t){let n=e.radius?.[c.radius];return typeof n!=`number`&&t(`email button needs radius step ${c.radius}`),{radius:n,padding:h(e,c.padding,e=>`email button needs space step ${e}`,t)}}function b(e){let t=e.trim();return t.length>=2&&t[0]===t.at(-1)&&(t[0]===`"`||t[0]===`'`)?t.slice(1,-1).trim():t}function x(e){return t.has(e.toLowerCase())||e.startsWith(`-`)?e:e.includes(` `)?`'${e}'`:e}function S(e,t,n){let r=[t.family,...t.fallback.split(`,`)].map(b).filter(e=>e.length>0),i=r.find(e=>/["';<>]/.test(e));return i===void 0?r.map(x).join(`, `):(n(`email font ${e} holds an unsafe character: ${i}`),null)}function C(e,t){let r={};for(let[i,a]of n){let n=e.fonts?.[a];if(typeof n?.family!=`string`||typeof n?.fallback!=`string`){t(`email fonts need font ${a}`);continue}r[i]=S(a,n,t)}return r}function w(e,t){if(e?.format!==`webority-theme-tokens/2`||e.source?.platform!==`web`)throw Error(`emitEmail: web must be the web theme tokens at width 1440`);if(e.source.width!==1440)throw Error(`emitEmail: web must be the 1440 theme`);if(t?.format!==`webority-theme-tokens/2`||t.source?.platform!==`web`||t.source?.width!==390)throw Error(`emitEmail: web390 must be the web theme tokens at width 390`);let n=[],r=e=>n.push(`emitEmail: ${e}`),i=p(e,r),a=m(e,t,r),o=_(e,r),s=v(e,r),c=y(e,r),l=C(e,r);if(n.length>0)throw Error(n.join(`
|
|
2
2
|
`));return{format:`webority-email-theme/1`,source:{package:e.source.package,version:e.source.version,brand:e.source.brand},colors:i,fonts:l,type:a,space:o,shape:s,button:c}}export{c as EMAIL_BUTTON,r as EMAIL_COLOR_ROLES,s as EMAIL_SHAPE,a as EMAIL_SPACE,i as EMAIL_TYPE_ROLES,w as emitEmail};
|
package/dist/emit/phone.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var e=/^[A-Za-z_$][A-Za-z0-9_$]*$/,t=/^#([0-9a-fA-F]{6})([0-9a-fA-F]{2})?$/,n=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)$/,r=[`xs`,`sm`,`md`,`lg`,`xl`],i=`must be component.<name>.<prop> or component.<name>.<size>.<prop>`,a=[`light`,`dark`],o={color:`colors`,space:`space`,radius:`radius`,text:`text`,weight:`weight`,leading:`leading`,"letter-spacing":`letter-spacing`,font:`font`,shadow:`shadow`,size:`size`,component:`components`},s=[{key:`colors`,constName:`COLOR_NAMES`,typeName:`ColorName`},{key:`space`,constName:`SPACE_NAMES`,typeName:`SpaceName`},{key:`radius`,constName:`RADIUS_NAMES`,typeName:`RadiusName`},{key:`text`,constName:`TEXT_NAMES`,typeName:`TextName`},{key:`weight`,constName:`WEIGHT_NAMES`,typeName:`WeightName`},{key:`leading`,constName:`LEADING_NAMES`,typeName:`LeadingName`},{key:`letter-spacing`,constName:`LETTER_SPACING_NAMES`,typeName:`LetterSpacingName`},{key:`font`,constName:`FONT_NAMES`,typeName:`FontName`},{key:`shadow`,constName:`SHADOW_NAMES`,typeName:`ShadowName`},{key:`motion.duration`,constName:`DURATION_NAMES`,typeName:`DurationName`},{key:`motion.ease`,constName:`EASE_NAMES`,typeName:`EaseName`},{key:`size`,constName:`SIZE_NAMES`,typeName:`SizeName`}],c={space:`SpaceName`,text:`TextName`,radius:`RadiusName`,px:`number`,number:`number`,ms:`number`},l=[`export type FontWeightValue = "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900";`,`/** Face name per weight; an empty object means the platform system font. */`,`export type FontFaces = Partial<Record<WeightName, string>>;`,`export interface PhoneShadow {`,` shadowColor: string;`,` shadowOffset: { width: number; height: number };`,` shadowOpacity: number;`,` shadowRadius: number;`,` elevation: number;`,`}`,`export type ComponentKind = "space" | "text" | "radius" | "px" | "number" | "ms";`,`type Sized<S extends string, T> = Record<S, T>;`,`type L3 = "sm" | "md" | "lg";`],u=[`export interface TokenSet {`,` mode: "light" | "dark";`,` colors: Record<ColorName, string>;`,` space: Record<SpaceName, number>;`,` radius: Record<RadiusName, number>;`,` text: Record<TextName, { size: number
|
|
1
|
+
var e=/^[A-Za-z_$][A-Za-z0-9_$]*$/,t=/^#([0-9a-fA-F]{6})([0-9a-fA-F]{2})?$/,n=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)$/,r=[`xs`,`sm`,`md`,`lg`,`xl`],i=`must be component.<name>.<prop> or component.<name>.<size>.<prop>`,a=[`light`,`dark`],o={color:`colors`,space:`space`,radius:`radius`,text:`text`,weight:`weight`,leading:`leading`,"letter-spacing":`letter-spacing`,font:`font`,shadow:`shadow`,size:`size`,component:`components`},s=[{key:`colors`,constName:`COLOR_NAMES`,typeName:`ColorName`},{key:`space`,constName:`SPACE_NAMES`,typeName:`SpaceName`},{key:`radius`,constName:`RADIUS_NAMES`,typeName:`RadiusName`},{key:`text`,constName:`TEXT_NAMES`,typeName:`TextName`},{key:`weight`,constName:`WEIGHT_NAMES`,typeName:`WeightName`},{key:`leading`,constName:`LEADING_NAMES`,typeName:`LeadingName`},{key:`letter-spacing`,constName:`LETTER_SPACING_NAMES`,typeName:`LetterSpacingName`},{key:`font`,constName:`FONT_NAMES`,typeName:`FontName`},{key:`shadow`,constName:`SHADOW_NAMES`,typeName:`ShadowName`},{key:`motion.duration`,constName:`DURATION_NAMES`,typeName:`DurationName`},{key:`motion.ease`,constName:`EASE_NAMES`,typeName:`EaseName`},{key:`size`,constName:`SIZE_NAMES`,typeName:`SizeName`}],c={space:`SpaceName`,text:`TextName`,radius:`RadiusName`,px:`number`,number:`number`,ms:`number`},l=[`export type FontWeightValue = "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900";`,`/** Face name per weight; an empty object means the platform system font. */`,`export type FontFaces = Partial<Record<WeightName, string>>;`,`export interface PhoneShadow {`,` shadowColor: string;`,` shadowOffset: { width: number; height: number };`,` shadowOpacity: number;`,` shadowRadius: number;`,` elevation: number;`,`}`,`export type ComponentKind = "space" | "text" | "radius" | "px" | "number" | "ms";`,`type Sized<S extends string, T> = Record<S, T>;`,`type L3 = "sm" | "md" | "lg";`],u=[`export interface TokenSet {`,` mode: "light" | "dark";`,` colors: Record<ColorName, string>;`,` space: Record<SpaceName, number>;`,` radius: Record<RadiusName, number>;`,` text: Record<TextName, { size: number }>;`,` weight: Record<WeightName, FontWeightValue>;`,` leading: Record<LeadingName, number>;`,` "letter-spacing": Record<LetterSpacingName, number>;`,` font: Record<FontName, FontFaces>;`,` shadow: Record<ShadowName, PhoneShadow>;`,` motion: { duration: Record<DurationName, number>; ease: Record<EaseName, readonly [number, number, number, number]> };`,` size: Record<SizeName, number>;`,` components: ComponentTokens;`,`}`];function d(e,t){let n=e.contexts.find(e=>e.platform===`phone`&&e.mode===t);if(!n)throw Error(`phoneSets: the model has no ${t} phone context`);let r=[];for(let t of e.tokens.values()){if(!e.existsIn(t.path,n))continue;let i=e.resolvedIn(t.path,n);r.push({path:t.path.split(`.`),type:t.type,value:t.group===`text`?m(t.path,i):i,reference:e.referenceIn(t.path,n)??null,platforms:t.platforms,extensions:Object.keys(t.extensions).length>0?t.extensions:null})}return r}function f(e){let t=y(e.light),n=y(e.dark);D(t,n);let r=["// Generated by `webority brand --library` from packages/tokens/src/source. Do not edit: run `corepack pnpm --filter @webority/mobile-ui tokens`."];for(let e of s)r.push(...j(e,t.lists.get(e.key)));return r.push(...l),r.push(...I(t.components)),r.push(...L(t.components)),r.push(...u),r.push(...B(`lightTokens`,`light`,t)),r.push(...B(`darkTokens`,`dark`,n)),{name:`tokens.generated.ts`,contents:`${r.join(`
|
|
2
2
|
`)}\n`}}function p(e,t,n){let r={colors:{light:{},dark:{}},radius:{},font:{}};for(let n of a){let i=y(e[n]).values,a=y(t[n]).values;for(let e of new Set([...i.keys(),...a.keys()])){let t=i.get(e),o=a.get(e);if(!t||!o)throw Error(k(e));if(JSON.stringify(t.value)===JSON.stringify(o.value))continue;let s=e.lastIndexOf(`.`),c=e.slice(0,s),l=e.slice(s+1);if(c===`radius`&&(l===`none`||l===`pill`))throw Error(`A brand cannot change radius none or pill`);if(c===`colors`)r.colors[n][l]=o.value;else if(c===`radius`)O(r.radius,l,o.value,e);else if(c===`font`)O(r.font,l,o.value,e);else throw Error(k(e))}}let i=Object.fromEntries(a.filter(e=>Object.keys(r.colors[e]).length>0).map(e=>[e,r.colors[e]])),o={};Object.keys(i).length>0&&(o.colors=i),Object.keys(r.radius).length>0&&(o.radius=r.radius),Object.keys(r.font).length>0&&(o.font=r.font);let s=[`// Generated by \`webority brand\` for ${n.brand} from ${n.package} ${n.version}. Do not edit.`,``,`/** @type {import("@webority/mobile-ui").BrandOverrides} */`];return Object.keys(o).length===0?s.push(`export const brand = {};`):s.push(`export const brand = {`,...Object.entries(o).flatMap(([e,t])=>H(e,t,` `)),`};`),{name:`brand.phone.js`,contents:`${s.join(`
|
|
3
|
-
`)}\n`}}function m(e,t
|
|
3
|
+
`)}\n`}}function m(e,t){return{size:v(t,e)}}function h(e){return e.extensions?.internal===!0?!1:e.platforms===null||e.platforms.includes(`phone`)}function g(e,t){return Error(`Token group ${e} has no phone mapping; mark it web or add one to emit/phone.js (first: ${t})`)}function _(e){let[t,n]=e.path;if(t===`motion`){if(n===`duration`||n===`ease`)return`motion.${n}`;throw g(t,e.path.join(`.`))}if(!Object.hasOwn(o,t))throw g(t,e.path.join(`.`));return o[t]}function v(e,t){let n=typeof e==`object`&&e?e.value:e;if(!Number.isFinite(n))throw Error(`Token ${t} has no numeric value`);return n}function y(e){let t=new Map(s.map(e=>[e.key,[]])),n=new Map,r=new Map;for(let i of e){if(!h(i))continue;let e=i.path.join(`.`),a=_(i);if(i.value===void 0||i.value===null)throw Error(`Token ${e} has no phone value`);if(a===`components`){T(i,e,n,r);continue}let o=i.path.slice(a.startsWith(`motion.`)?2:1).join(`-`);n.set(`${a}.${o}`,{path:e,value:b(a,o,i,e)}),t.get(a).push(o)}return{lists:t,values:n,components:r}}function b(e,t,n,r){let{value:i}=n;switch(e){case`colors`:return i;case`space`:case`radius`:case`letter-spacing`:case`size`:case`leading`:case`motion.duration`:return v(i,r);case`text`:return{size:v(i.size,r)};case`weight`:return String(v(i,r));case`font`:return x(n,t);case`shadow`:return S(n,t,r);case`motion.ease`:return w(i,r)}}function x(e,t){if(Array.isArray(e.value)&&e.value.length===1&&e.value[0]===`System`)return{};if(!e.extensions?.faces)throw Error(`Font ${t} is not the system font and has no faces`);return e.extensions.faces}function S(e,t,n){let{color:r,offsetX:i,offsetY:a,blur:o}=e.value,{hex:s,opacity:c}=C(r,n),l=e.extensions?.elevation;if(!Number.isFinite(l))throw Error(`Shadow ${t} has no elevation`);return{shadowColor:s,shadowOffset:{width:v(i,n),height:v(a,n)},shadowOpacity:c,shadowRadius:v(o,n),elevation:l}}function C(e,r){let i=t.exec(e);if(i){let e=i[2]===void 0?1:Math.round(parseInt(i[2],16)/255*1e3)/1e3;return{hex:`#${i[1].toLowerCase()}`,opacity:e}}let a=n.exec(e);if(a)return{hex:`#${a.slice(1,4).map(e=>Number(e).toString(16).padStart(2,`0`)).join(``)}`,opacity:Number(a[4])};throw Error(`Shadow ${r} colour is not #RRGGBB, #RRGGBBAA or rgba(): ${e}`)}function w(e,t){if(!Array.isArray(e)||e.length!==4||!e.every(e=>Number.isFinite(e)))throw Error(`Token ${t} has no phone value`);return[...e]}function T(e,t,n,a){let o=e.path,s=o.length===4;if(o.length!==3&&!s||s&&!r.includes(o[2]))throw Error(`Component token ${t} ${i}`);let c=o[1],l=o[o.length-1],{kind:u,value:d}=E(e,t);a.has(c)||a.set(c,{props:new Map,sizes:new Map,free:new Map});let f=a.get(c);if(f.props.has(l)&&f.props.get(l)!==u)throw Error(`Component ${c} prop ${l} has two kinds`);if(f.props.set(l,u),s){let e=o[2];f.sizes.has(e)||f.sizes.set(e,new Map),f.sizes.get(e).set(l,d),n.set(`components.${c}.${e}.${l}`,{path:t,value:d})}else f.free.set(l,d),n.set(`components.${c}.${l}`,{path:t,value:d})}function E(e,t){let{reference:n}=e;for(let[e,t]of[[`space.`,`space`],[`text.`,`text`],[`radius.`,`radius`]])if(n?.startsWith(e))return{kind:t,value:n.slice(e.length)};if(!n){if(e.type===`dimension`)return{kind:`px`,value:v(e.value,t)};if(e.type===`number`)return{kind:`number`,value:v(e.value,t)};if(e.type===`duration`)return{kind:`ms`,value:v(e.value,t)}}throw Error(`Component token ${t} has an unsupported value`)}function D(e,t){for(let[n,{path:r}]of e.values)if(!t.values.has(n))throw Error(`Token ${r} exists in one mode only`);for(let[n,{path:r}]of t.values)if(!e.values.has(n))throw Error(`Token ${r} exists in one mode only`)}function O(e,t,n,r){if(Object.hasOwn(e,t)&&JSON.stringify(e[t])!==JSON.stringify(n))throw Error(`A brand sets ${r} differently in light and dark`);e[t]=n}function k(e){return`A brand overrides colours, radius and fonts only; ${e} differs`}function A(t){return e.test(t)?t:JSON.stringify(t)}function j(e,t){let n=`export type ${e.typeName} = (typeof ${e.constName})[number];`;return t.length<=12?[`export const ${e.constName} = [${t.map(e=>JSON.stringify(e)).join(`, `)}] as const;`,n]:[`export const ${e.constName} = [`,...t.map(e=>` ${JSON.stringify(e)},`),`] as const;`,n]}var M=140;function N(e,t){return t.map(t=>`${A(t)}: ${c[e.props.get(t)]}`)}function P(e){return e.split(/[^A-Za-z0-9]+/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}function F(e,t){return[`export interface ${e} {`,...t.map(e=>` ${e};`),`}`]}function I(e){let t=[],n=[];for(let[i,a]of e){let e=N(a,[...a.free.keys()]),o=N(a,[...new Set([...a.sizes.values()].flatMap(e=>[...e.keys()]))]),s=r.filter(e=>a.sizes.has(e)),c=s.join()===`sm,md,lg`?`L3`:s.map(e=>JSON.stringify(e)).join(` | `),l=e=>`{ ${e.join(`; `)} }`,u=(t,n)=>o.length===0?n:`Sized<${c}, ${t}>${e.length>0?` & ${n}`:``}`,d=` ${A(i)}: ${u(l(o),l(e))};`;if(d.length<=M){n.push(d);continue}let f=P(i);o.length>0&&t.push(...F(`${f}SizeTokens`,o)),e.length>0&&t.push(...F(`${f}Tokens`,e)),n.push(` ${A(i)}: ${u(`${f}SizeTokens`,`${f}Tokens`)};`)}let i=[...t,`export interface ComponentTokens {`,...n];return i.push(`}`,`export type ComponentName = keyof ComponentTokens;`,`type SizeKeysOf<C extends ComponentName> = Extract<keyof ComponentTokens[C], "xs" | "sm" | "md" | "lg" | "xl">;`,`export type ComponentSizeTokens<C extends ComponentName> = ComponentTokens[C][SizeKeysOf<C>];`),i}function L(e){let t=[`export const COMPONENT_KINDS = {`];for(let[n,r]of e){let e=[...r.props].map(([e,t])=>`${A(e)}: ${JSON.stringify(t)}`),i=` ${A(n)}: { ${e.join(`, `)} },`;i.length<=M?t.push(i):t.push(` ${A(n)}: {`,...e.map(e=>` ${e},`),` },`)}return t.push(`} as const satisfies { readonly [C in ComponentName]: Readonly<Record<string, ComponentKind>> };`),t}function R(e){let t={};for(let[n,i]of e){let e={};for(let t of r)i.sizes.has(t)&&(e[t]=Object.fromEntries(i.sizes.get(t)));for(let[t,n]of i.free)e[t]=n;t[n]=e}return t}function z(e,t){let{lists:n}=t,r=(e,n)=>Object.fromEntries(n.map(n=>[n,t.values.get(`${e}.${n}`).value]));return{mode:e,colors:r(`colors`,n.get(`colors`)),space:r(`space`,n.get(`space`)),radius:r(`radius`,n.get(`radius`)),text:r(`text`,n.get(`text`)),weight:r(`weight`,n.get(`weight`)),leading:r(`leading`,n.get(`leading`)),"letter-spacing":r(`letter-spacing`,n.get(`letter-spacing`)),font:r(`font`,n.get(`font`)),shadow:r(`shadow`,n.get(`shadow`)),motion:{duration:r(`motion.duration`,n.get(`motion.duration`)),ease:r(`motion.ease`,n.get(`motion.ease`))},size:r(`size`,n.get(`size`)),components:R(t.components)}}function B(e,t,n){let r=z(t,n);return[`export const ${e}: TokenSet = {`,...Object.entries(r).flatMap(([e,t])=>H(e,t,` `)),`};`]}function V(e){return Array.isArray(e)?`[${e.map(e=>V(e)).join(`, `)}]`:JSON.stringify(e)}function H(e,t,n){let r=`${n}${A(e)}`;if(typeof t==`object`&&t&&!Array.isArray(t)){let e=Object.entries(t);return e.length===0?[`${r}: {},`]:[`${r}: {`,...e.flatMap(([e,t])=>H(e,t,`${n} `)),`${n}},`]}return[`${r}: ${V(t)},`]}export{p as emitPhoneBrand,f as emitPhoneTheme,d as phoneSets};
|
package/dist/emit/web.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{BREAKPOINT_PX as e,breakpointRules as t,fluidLength as n}from"../model/length.js";import{cssVarOfPath as r}from"../names.js";var i={mode:`light`,platform:`web`,width:1440},a={mode:`dark`,platform:`web`,width:1440},o={mode:`light`,platform:`web`,width:390},s=/\{([a-z0-9-]+(?:\.[a-z0-9-]+)+)\}/g,c=/^\{([a-z0-9-]+(?:\.[a-z0-9-]+)+)\}$/,l=/^#[0-9a-f]{6}$/i,u=[[`--bs-body-color`,`text`],[`--bs-emphasis-color`,`text`],[`--bs-secondary-color`,`text-muted`],[`--bs-tertiary-color`,`text-subtle`],[`--bs-body-bg`,`bg`],[`--bs-border-color`,`border`],[`--bs-secondary-bg`,`surface`],[`--bs-tertiary-bg`,`bg-muted`]],d=[[`--bs-body-bg-rgb`,`bg`],[`--bs-body-color-rgb`,`text`],[`--bs-emphasis-color-rgb`,`text`],[`--bs-secondary-color-rgb`,`text-muted`],[`--bs-tertiary-color-rgb`,`text-subtle`],[`--bs-secondary-bg-rgb`,`surface`],[`--bs-tertiary-bg-rgb`,`bg-muted`],[`--bs-border-color-rgb`,`border`]],f=[[`$body-color`,`color.text-body`],[`$body-secondary-color`,`color.text-muted`],[`$body-tertiary-color`,`color.text-subtle`],[`$body-secondary-bg`,`color.bg-subtle`],[`$body-tertiary-bg`,`color.bg-muted`],[`$border-color`,`color.border`],[`$border-color-translucent`,`color.border`],[`$border-radius`,`radius.md`],[`$border-radius-sm`,`radius.sm`],[`$border-radius-lg`,`radius.lg`],[`$border-radius-pill`,`radius.pill`],[`$wui-shadow-overlay`,`shadow.popover`],[`$wui-shadow-overlay-lg`,`shadow.modal`],[`$link-color`,`color.link`]],p=`:root[data-theme="dark"],
|
|
1
|
+
import{BREAKPOINT_PX as e,breakpointRules as t,fluidLength as n}from"../model/length.js";import{cssVarOfPath as r}from"../names.js";var i={mode:`light`,platform:`web`,width:1440},a={mode:`dark`,platform:`web`,width:1440},o={mode:`light`,platform:`web`,width:390},s=/\{([a-z0-9-]+(?:\.[a-z0-9-]+)+)\}/g,c=/^\{([a-z0-9-]+(?:\.[a-z0-9-]+)+)\}$/,l=/^#[0-9a-f]{6}$/i,u=[[`--bs-body-color`,`text`],[`--bs-emphasis-color`,`text`],[`--bs-secondary-color`,`text-muted`],[`--bs-tertiary-color`,`text-subtle`],[`--bs-body-bg`,`bg`],[`--bs-border-color`,`border`],[`--bs-secondary-bg`,`surface`],[`--bs-tertiary-bg`,`bg-muted`]],d=[[`--bs-body-bg-rgb`,`bg`],[`--bs-body-color-rgb`,`text`],[`--bs-emphasis-color-rgb`,`text`],[`--bs-secondary-color-rgb`,`text-muted`],[`--bs-tertiary-color-rgb`,`text-subtle`],[`--bs-secondary-bg-rgb`,`surface`],[`--bs-tertiary-bg-rgb`,`bg-muted`],[`--bs-border-color-rgb`,`border`]],f=[[`$body-color`,`color.text-body`],[`$body-secondary-color`,`color.text-muted`],[`$body-tertiary-color`,`color.text-subtle`],[`$body-secondary-bg`,`color.bg-subtle`],[`$body-tertiary-bg`,`color.bg-muted`],[`$border-color`,`color.border`],[`$border-color-translucent`,`color.border`],[`$border-radius`,`radius.md`],[`$border-radius-sm`,`radius.sm`],[`$border-radius-lg`,`radius.lg`],[`$border-radius-pill`,`radius.pill`],[`$wui-shadow-overlay`,`shadow.popover`],[`$wui-shadow-overlay-lg`,`shadow.modal`],[`$link-color`,`color.link`],[`$line-height-base`,`leading.body`],[`$headings-line-height`,`leading.heading`],[`$display-line-height`,`leading.display`]],p=`:root[data-theme="dark"],
|
|
2
2
|
:root[data-bs-theme="dark"]`,m=`[data-theme="dark"]:not(:root),
|
|
3
3
|
[data-bs-theme="dark"]:not(:root)`,h=`:root[data-theme="auto"]`,g=`[data-theme="dark"]:not(:root) [data-theme="light"],
|
|
4
4
|
[data-theme="dark"]:not(:root) [data-bs-theme="light"],
|
package/dist/meanings.json
CHANGED
package/dist/model/load.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__toESM as e}from"../_virtual/_rolldown/runtime.js";import{require__2020 as t}from"../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/2020.js";import{STEPS as n,cssVarOfPath as r}from"../names.js";import{readFile as i}from"node:fs/promises";import{basename as a,dirname as o,resolve as s}from"node:path";var c=e(t(),1),l=new URL(`../../package.json`,import.meta.url),u=new URL(`../../schema/webority-tokens.schema.json`,import.meta.url),d=`Declare each token in one source file.`;function f(e,t,n,r){return`${e}: ${t}: ${n}. ${r}`}function p(e,t){e.includes(t)||e.push(t)}function m(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function h(e){return m(e)&&typeof e.$ref==`string`}function g(e){let t=[],n=(e,r,i)=>{for(let[a,o]of Object.entries(e)){if(a.startsWith(`$`)||!m(o))continue;let e=[...r,a];`$value`in o?t.push({path:e.join(`.`),token:o,type:o.$type??i.type,extensions:{...i.extensions,...o.$extensions?.[`com.webority`]??{}}}):n(o,e,{type:o.$type??i.type,extensions:{...i.extensions,...o.$extensions?.[`com.webority`]??{}}})}};return n(e,[],{type:void 0,extensions:{}}),t}function _(e){let[t,...n]=e.path.split(`.`),r=e.extensions;return{path:e.path,group:t,name:n.join(`-`),type:e.type??``,description:e.token.$description??null,platforms:r.platforms??null,internal:r.internal===!0,extensions:r}}function v(e,t,i,a){let{path:o,group:s,name:c,type:l}=e;l===``&&p(i,f(t,o,`has no $type`,`Add $type to the token or to its group.`));let u;try{u=r(o)}catch{p(i,f(t,o,`its group ${s} has no CSS prefix`,`Add the group to PREFIX in names.js.`))}let d=n[s];if(d&&!d.includes(c)&&p(i,f(t,o,`"${c}" is not a step of ${s}`,`Use one of: ${d.join(`, `)}.`)),u!==void 0){let e=a.get(u);e===void 0?a.set(u,o):e!==o&&p(i,f(t,o,`its CSS name ${u} is also the name of ${e}`,`Rename one of the two tokens.`))}}function y(e,t,n,r){let i={...e.extensions};return(i.platforms!==void 0||i.internal!==void 0)&&(p(r,f(t,e.path,`changes the platforms or internal mark`,`Set marks in the base set only.`)),delete i.platforms,delete i.internal),Object.assign(n.extensions,i),{value:e.token.$value,file:t}}function b(e,t,n){p(e,f(t,n,`overrides a token the base set does not declare`,`Declare ${n} in the base set first.`))}function x(e,t,n){let r=new Map;for(let{ref:i,data:a}of e)if(a)for(let e of g(a)){let a=t.get(e.path);if(!a){b(n,i,e.path);continue}r.set(e.path,y(e,i,a,n))}return r}async function S(e,t){let n=a(e),r=[],S=o(e),C;try{C=JSON.parse(await i(e,`utf8`))}catch(e){throw Error(f(n,`(file)`,`cannot be read as JSON (${e.message})`,`Restore the file or correct its path.`))}if(!Array.isArray(C.sets)||C.sets.length===0||!C.sets.every(e=>Array.isArray(e?.sources)&&e.sources.every(h)))throw Error(f(n,`sets`,`must be a non-empty array of { sources: [{ "$ref": string }] }`,`Match the resolver of the library source.`));if(!Array.isArray(C.modifiers))throw Error(f(n,`modifiers`,`must be an array`,`Match the resolver of the library source.`));let w=[[`mode`,[`light`,`dark`]],[`platform`,[`web`,`phone`]],[`width`,[`1440`,`390`]]];if(C.modifiers.length!==w.length)throw Error(f(n,`modifiers`,`must hold the mode, platform and width modifiers, in that order`,`Match the resolver of the library source.`));w.forEach(([e,t],r)=>{let i=C.modifiers[r],a=m(i?.contexts)?Object.keys(i.contexts).sort().join(`,`):``;if(!(i?.name===e&&a===[...t].sort().join(`,`)&&t.every(e=>Array.isArray(i.contexts[e])&&i.contexts[e].every(h))&&i.contexts[t[0]].length===0))throw Error(f(n,`modifiers.${e}`,`is not the ${e} modifier with the contexts ${t.join(`, `)} and an empty list for ${t[0]}`,`Match the resolver of the library source, whose default context lists no file.`))});let T=(e,t)=>C.modifiers.find(t=>t.name===e).contexts[t],E=C.sets.flatMap(e=>e.sources.map(e=>e.$ref)),D=T(`mode`,`dark`).map(e=>e.$ref),O=T(`platform`,`phone`).map(e=>e.$ref),k=T(`width`,`390`).map(e=>e.$ref),A=JSON.parse(await i(u,`utf8`)),j=new c.default({allErrors:!0,strict:!1});j.addSchema(A);let M=j.compile(A),N=j.getSchema(`${A.$id}#/$defs/sourceMeaning`),P=new Map,F=async e=>{let t=s(S,e);if(P.has(t))return P.get(t);let n=null;try{n=JSON.parse(await i(t,`utf8`))}catch(n){return p(r,f(e,`(file)`,`cannot be read as JSON (${n.message})`,`Restore the file or correct its $ref in the resolver.`)),P.set(t,null),null}let o=[];M(n)||o.push(...M.errors),a(t)===`meaning.tokens.json`&&!N(n)&&o.push(...N.errors);for(let t of o){if(t.keyword===`if`)continue;let n=t.instancePath.slice(1).split(`/`).filter(e=>e!==``),i=n.length===0?`(file)`:n.map(e=>e.replace(/~1/g,`/`).replace(/~0/g,`~`)).join(`.`),a=t.params?.additionalProperty??t.params?.propertyName,o=a===void 0?t.message:`${t.message} "${a}"`;p(r,f(e,i,o,`Correct it against schema/webority-tokens.schema.json.`))}return P.set(t,n),n},I=async e=>Promise.all(e.map(async e=>({ref:e,data:await F(e)}))),L=await I(E),R=await I(D),z=await I(O),B=await I(k),V=new Map,H=new Map,U=new Map;for(let{ref:e,data:t}of L)if(t)for(let n of g(t)){if(V.has(n.path)){p(r,f(e,n.path,`is already declared in ${U.get(n.path).file}`,d));continue}let t=_(n);v(t,e,r,H),V.set(n.path,t),U.set(n.path,{value:n.token.$value,file:e})}let W=x(R,V,r),G=x(z,V,r),K=x(B,V,r),q=new Map,J=new Map;if(t){let e=`brand ${t.name}`;for(let n of g(t.base)){let t=V.get(n.path);if(t){q.set(n.path,y(n,e,t,r));continue}let i=_(n);v(i,e,r,H),V.set(n.path,i),q.set(n.path,{value:n.token.$value,file:e})}for(let n of g(t.dark)){let t=V.get(n.path);if(!t){b(r,e,n.path);continue}J.set(n.path,y(n,e,t,r))}}let Y=JSON.parse(await i(l,`utf8`)),X={package:Y.name,version:Y.version,brand:t?.name??null};return{tokens:V,layers:{base:U,dark:W,phone:G,width390:K,brandBase:q,brandDark:J},cssNames:H,source:X,refusals:r}}export{f as line,S as readSources};
|
|
1
|
+
import{__toESM as e}from"../_virtual/_rolldown/runtime.js";import{require__2020 as t}from"../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/2020.js";import{STEPS as n,cssVarOfPath as r}from"../names.js";import{readFile as i}from"node:fs/promises";import{basename as a,dirname as o,resolve as s}from"node:path";var c=e(t(),1),l=new URL(`../../package.json`,import.meta.url),u=new URL(`../../schema/webority-tokens.schema.json`,import.meta.url),d=`Declare each token in one source file.`;function f(e,t,n,r){return`${e}: ${t}: ${n}. ${r}`}function p(e,t){e.includes(t)||e.push(t)}function m(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function h(e){return m(e)&&typeof e.$ref==`string`}function g(e){let t=[],n=(e,r,i)=>{for(let[a,o]of Object.entries(e)){if(a.startsWith(`$`)||!m(o))continue;let e=[...r,a];`$value`in o?t.push({path:e.join(`.`),token:o,type:o.$type??i.type,extensions:{...i.extensions,...o.$extensions?.[`com.webority`]??{}}}):n(o,e,{type:o.$type??i.type,extensions:{...i.extensions,...o.$extensions?.[`com.webority`]??{}}})}};return n(e,[],{type:void 0,extensions:{}}),t}function _(e){let[t,...n]=e.path.split(`.`),r=e.extensions;return{path:e.path,group:t,name:n.join(`-`),type:e.type??``,description:e.token.$description??null,platforms:r.platforms??null,internal:r.internal===!0,brandOwn:!1,extensions:r}}function v(e,t,i,a){let{path:o,group:s,name:c,type:l}=e;l===``&&p(i,f(t,o,`has no $type`,`Add $type to the token or to its group.`));let u;try{u=r(o)}catch{p(i,f(t,o,`its group ${s} has no CSS prefix`,`Add the group to PREFIX in names.js.`))}let d=n[s];if(d&&!d.includes(c)&&p(i,f(t,o,`"${c}" is not a step of ${s}`,`Use one of: ${d.join(`, `)}.`)),u!==void 0){let e=a.get(u);e===void 0?a.set(u,o):e!==o&&p(i,f(t,o,`its CSS name ${u} is also the name of ${e}`,`Rename one of the two tokens.`))}}function y(e,t,n,r){let i={...e.extensions};return(i.platforms!==void 0||i.internal!==void 0)&&(p(r,f(t,e.path,`changes the platforms or internal mark`,`Set marks in the base set only.`)),delete i.platforms,delete i.internal),Object.assign(n.extensions,i),{value:e.token.$value,file:t}}function b(e,t,n){p(e,f(t,n,`overrides a token the base set does not declare`,`Declare ${n} in the base set first.`))}function x(e,t,n){let r=new Map;for(let{ref:i,data:a}of e)if(a)for(let e of g(a)){let a=t.get(e.path);if(!a){b(n,i,e.path);continue}r.set(e.path,y(e,i,a,n))}return r}async function S(e,t){let n=a(e),r=[],S=o(e),C;try{C=JSON.parse(await i(e,`utf8`))}catch(e){throw Error(f(n,`(file)`,`cannot be read as JSON (${e.message})`,`Restore the file or correct its path.`))}if(!Array.isArray(C.sets)||C.sets.length===0||!C.sets.every(e=>Array.isArray(e?.sources)&&e.sources.every(h)))throw Error(f(n,`sets`,`must be a non-empty array of { sources: [{ "$ref": string }] }`,`Match the resolver of the library source.`));if(!Array.isArray(C.modifiers))throw Error(f(n,`modifiers`,`must be an array`,`Match the resolver of the library source.`));let w=[[`mode`,[`light`,`dark`]],[`platform`,[`web`,`phone`]],[`width`,[`1440`,`390`]]];if(C.modifiers.length!==w.length)throw Error(f(n,`modifiers`,`must hold the mode, platform and width modifiers, in that order`,`Match the resolver of the library source.`));w.forEach(([e,t],r)=>{let i=C.modifiers[r],a=m(i?.contexts)?Object.keys(i.contexts).sort().join(`,`):``;if(!(i?.name===e&&a===[...t].sort().join(`,`)&&t.every(e=>Array.isArray(i.contexts[e])&&i.contexts[e].every(h))&&i.contexts[t[0]].length===0))throw Error(f(n,`modifiers.${e}`,`is not the ${e} modifier with the contexts ${t.join(`, `)} and an empty list for ${t[0]}`,`Match the resolver of the library source, whose default context lists no file.`))});let T=(e,t)=>C.modifiers.find(t=>t.name===e).contexts[t],E=C.sets.flatMap(e=>e.sources.map(e=>e.$ref)),D=T(`mode`,`dark`).map(e=>e.$ref),O=T(`platform`,`phone`).map(e=>e.$ref),k=T(`width`,`390`).map(e=>e.$ref),A=JSON.parse(await i(u,`utf8`)),j=new c.default({allErrors:!0,strict:!1});j.addSchema(A);let M=j.compile(A),N=j.getSchema(`${A.$id}#/$defs/sourceMeaning`),P=new Map,F=async e=>{let t=s(S,e);if(P.has(t))return P.get(t);let n=null;try{n=JSON.parse(await i(t,`utf8`))}catch(n){return p(r,f(e,`(file)`,`cannot be read as JSON (${n.message})`,`Restore the file or correct its $ref in the resolver.`)),P.set(t,null),null}let o=[];M(n)||o.push(...M.errors),a(t)===`meaning.tokens.json`&&!N(n)&&o.push(...N.errors);for(let t of o){if(t.keyword===`if`)continue;let n=t.instancePath.slice(1).split(`/`).filter(e=>e!==``),i=n.length===0?`(file)`:n.map(e=>e.replace(/~1/g,`/`).replace(/~0/g,`~`)).join(`.`),a=t.params?.additionalProperty??t.params?.propertyName,o=a===void 0?t.message:`${t.message} "${a}"`;p(r,f(e,i,o,`Correct it against schema/webority-tokens.schema.json.`))}return P.set(t,n),n},I=async e=>Promise.all(e.map(async e=>({ref:e,data:await F(e)}))),L=await I(E),R=await I(D),z=await I(O),B=await I(k),V=new Map,H=new Map,U=new Map;for(let{ref:e,data:t}of L)if(t)for(let n of g(t)){if(V.has(n.path)){p(r,f(e,n.path,`is already declared in ${U.get(n.path).file}`,d));continue}let t=_(n);v(t,e,r,H),V.set(n.path,t),U.set(n.path,{value:n.token.$value,file:e})}let W=x(R,V,r),G=x(z,V,r),K=x(B,V,r),q=new Map,J=new Map;if(t){let e=`brand ${t.name}`;for(let n of g(t.base)){let t=V.get(n.path);if(t){q.set(n.path,y(n,e,t,r));continue}let i=_(n);v(i,e,r,H),i.brandOwn=!0,V.set(n.path,i),q.set(n.path,{value:n.token.$value,file:e})}for(let n of g(t.dark)){let t=V.get(n.path);if(!t){b(r,e,n.path);continue}J.set(n.path,y(n,e,t,r))}}let Y=JSON.parse(await i(l,`utf8`)),X={package:Y.name,version:Y.version,brand:t?.name??null};return{tokens:V,layers:{base:U,dark:W,phone:G,width390:K,brandBase:q,brandDark:J},cssNames:H,source:X,refusals:r}}export{f as line,S as readSources};
|
package/dist/names.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={palette:`--wui-`,color:`--color-`,effect:`--wui-`,space:`--wui-space-`,radius:`--wui-radius-`,text:`--wui-fs-`,weight:`--wui-fw-`,leading:`--wui-lh-`,"letter-spacing":`--wui-letter-spacing-`,font:`--wui-font-`,shadow:`--wui-shadow-`,motion:`--wui-`,section:`--wui-section-`,size:`--wui-`,z:`--wui-z-`,component:`--wui-`},t={space:[`none`,`xxs`,`xs`,`sm`,`md`,`lg`,`xl`,`2xl`,`3xl`,`4xl`],radius:[`none`,`sm`,`md`,`lg`,`xl`,`pill`],text:[`xs`,`sm`,`base`,`lg`,`xl`,`2xl`,`3xl`,`4xl`,`5xl`,`6xl`,`7xl`,`8xl`],weight:[`normal`,`medium`,`semibold`,`bold`],"letter-spacing":[`tight`,`normal`,`wide`],leading:[`
|
|
1
|
+
var e={palette:`--wui-`,color:`--color-`,effect:`--wui-`,space:`--wui-space-`,radius:`--wui-radius-`,text:`--wui-fs-`,weight:`--wui-fw-`,leading:`--wui-lh-`,"letter-spacing":`--wui-letter-spacing-`,font:`--wui-font-`,shadow:`--wui-shadow-`,motion:`--wui-`,section:`--wui-section-`,size:`--wui-`,z:`--wui-z-`,component:`--wui-`},t={space:[`none`,`xxs`,`xs`,`sm`,`md`,`lg`,`xl`,`2xl`,`3xl`,`4xl`],radius:[`none`,`sm`,`md`,`lg`,`xl`,`pill`],text:[`xs`,`sm`,`base`,`lg`,`xl`,`2xl`,`3xl`,`4xl`,`5xl`,`6xl`,`7xl`,`8xl`],weight:[`normal`,`medium`,`semibold`,`bold`],"letter-spacing":[`tight`,`normal`,`wide`],leading:[`heading`,`body`,`display`]};function n(t,n){let r=e[t];if(r===void 0)throw Error(`webority-tokens: ${t} is not a token group; add it to PREFIX in names.js.`);return`${r}${n}`}function r(e){let[t,...r]=e.split(`.`);return n(t,r.join(`-`))}export{t as STEPS,n as cssVar,r as cssVarOfPath};
|
package/dist/outputs.d.ts
CHANGED
|
@@ -8,8 +8,11 @@ export interface ThemeTokensV2 {
|
|
|
8
8
|
colors: Record<Mode, Record<string, string>>;
|
|
9
9
|
space: Record<string, number>;
|
|
10
10
|
radius: Record<string, number>;
|
|
11
|
-
text: Record<string, { size: number
|
|
11
|
+
text: Record<string, { size: number }>;
|
|
12
|
+
/** `leading` holds the line height of each text role (heading, body, display), unitless. */
|
|
12
13
|
typography: { fontWeight: Record<string, number>; leading: Record<string, number> };
|
|
14
|
+
/** The description of each colour a brand adds, by name; absent when the brand adds none. */
|
|
15
|
+
colorMeanings?: Record<string, string>;
|
|
13
16
|
fonts: Record<string, { family: string; fallback: string }>;
|
|
14
17
|
/** A role the theme declares as no shadow is null; a role the platform lacks is absent. */
|
|
15
18
|
shadow: Record<string, CanvasShadow | null>;
|
|
@@ -1021,5 +1021,20 @@
|
|
|
1021
1021
|
"platforms": ["web"]
|
|
1022
1022
|
}
|
|
1023
1023
|
}
|
|
1024
|
+
},
|
|
1025
|
+
"leading": {
|
|
1026
|
+
"$type": "number",
|
|
1027
|
+
"heading": {
|
|
1028
|
+
"$value": 1.2,
|
|
1029
|
+
"$description": "Line height of headings."
|
|
1030
|
+
},
|
|
1031
|
+
"body": {
|
|
1032
|
+
"$value": 1.55,
|
|
1033
|
+
"$description": "Line height of running text and of any text that is not a heading or display text."
|
|
1034
|
+
},
|
|
1035
|
+
"display": {
|
|
1036
|
+
"$value": 1.05,
|
|
1037
|
+
"$description": "Line height of display-size text such as hero titles."
|
|
1038
|
+
}
|
|
1024
1039
|
}
|
|
1025
1040
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
+
"leading": {
|
|
3
|
+
"body": { "$value": 1.4 },
|
|
4
|
+
"display": { "$value": 1.2 }
|
|
5
|
+
},
|
|
2
6
|
"color": {
|
|
3
7
|
"bg": {
|
|
4
8
|
"$value": "{palette.phone-bg}"
|
|
@@ -248,85 +252,73 @@
|
|
|
248
252
|
"xs": {
|
|
249
253
|
"$value": {
|
|
250
254
|
"value": 11,
|
|
251
|
-
"unit": "px"
|
|
252
|
-
"lineHeight": 1.5
|
|
255
|
+
"unit": "px"
|
|
253
256
|
}
|
|
254
257
|
},
|
|
255
258
|
"sm": {
|
|
256
259
|
"$value": {
|
|
257
260
|
"value": 13,
|
|
258
|
-
"unit": "px"
|
|
259
|
-
"lineHeight": 1.5
|
|
261
|
+
"unit": "px"
|
|
260
262
|
}
|
|
261
263
|
},
|
|
262
264
|
"base": {
|
|
263
265
|
"$value": {
|
|
264
266
|
"value": 15,
|
|
265
|
-
"unit": "px"
|
|
266
|
-
"lineHeight": 1.5
|
|
267
|
+
"unit": "px"
|
|
267
268
|
}
|
|
268
269
|
},
|
|
269
270
|
"lg": {
|
|
270
271
|
"$value": {
|
|
271
272
|
"value": 17,
|
|
272
|
-
"unit": "px"
|
|
273
|
-
"lineHeight": 1.4
|
|
273
|
+
"unit": "px"
|
|
274
274
|
}
|
|
275
275
|
},
|
|
276
276
|
"xl": {
|
|
277
277
|
"$value": {
|
|
278
278
|
"value": 20,
|
|
279
|
-
"unit": "px"
|
|
280
|
-
"lineHeight": 1.3
|
|
279
|
+
"unit": "px"
|
|
281
280
|
}
|
|
282
281
|
},
|
|
283
282
|
"2xl": {
|
|
284
283
|
"$value": {
|
|
285
284
|
"value": 24,
|
|
286
|
-
"unit": "px"
|
|
287
|
-
"lineHeight": 1.25
|
|
285
|
+
"unit": "px"
|
|
288
286
|
}
|
|
289
287
|
},
|
|
290
288
|
"3xl": {
|
|
291
289
|
"$value": {
|
|
292
290
|
"value": 30,
|
|
293
|
-
"unit": "px"
|
|
294
|
-
"lineHeight": 1.2
|
|
291
|
+
"unit": "px"
|
|
295
292
|
}
|
|
296
293
|
},
|
|
297
294
|
"4xl": {
|
|
298
295
|
"$value": {
|
|
299
296
|
"value": 36,
|
|
300
|
-
"unit": "px"
|
|
301
|
-
"lineHeight": 1.1
|
|
297
|
+
"unit": "px"
|
|
302
298
|
}
|
|
303
299
|
},
|
|
304
300
|
"5xl": {
|
|
305
301
|
"$value": {
|
|
306
302
|
"value": 45,
|
|
307
|
-
"unit": "px"
|
|
308
|
-
"lineHeight": 1.05
|
|
303
|
+
"unit": "px"
|
|
309
304
|
}
|
|
310
305
|
},
|
|
311
306
|
"6xl": {
|
|
312
307
|
"$value": {
|
|
313
308
|
"value": 57,
|
|
314
|
-
"unit": "px"
|
|
315
|
-
"lineHeight": 1
|
|
309
|
+
"unit": "px"
|
|
316
310
|
}
|
|
317
311
|
},
|
|
318
312
|
"7xl": {
|
|
319
313
|
"$value": {
|
|
320
314
|
"value": 64,
|
|
321
|
-
"unit": "px"
|
|
322
|
-
"lineHeight": 1
|
|
315
|
+
"unit": "px"
|
|
323
316
|
}
|
|
324
317
|
},
|
|
325
318
|
"8xl": {
|
|
326
319
|
"$value": {
|
|
327
320
|
"value": 72,
|
|
328
|
-
"unit": "px"
|
|
329
|
-
"lineHeight": 1
|
|
321
|
+
"unit": "px"
|
|
330
322
|
}
|
|
331
323
|
}
|
|
332
324
|
},
|
|
@@ -136,8 +136,7 @@
|
|
|
136
136
|
"$type": "dimension",
|
|
137
137
|
"$value": {
|
|
138
138
|
"value": 13,
|
|
139
|
-
"unit": "px"
|
|
140
|
-
"lineHeight": 1.5
|
|
139
|
+
"unit": "px"
|
|
141
140
|
},
|
|
142
141
|
"$description": "Extra-small step of the fluid type scale; a product opts in per element.",
|
|
143
142
|
"$extensions": {
|
|
@@ -150,8 +149,7 @@
|
|
|
150
149
|
"$type": "dimension",
|
|
151
150
|
"$value": {
|
|
152
151
|
"value": 14,
|
|
153
|
-
"unit": "px"
|
|
154
|
-
"lineHeight": 1.5
|
|
152
|
+
"unit": "px"
|
|
155
153
|
},
|
|
156
154
|
"$description": "Small step of the fluid type scale; a product opts in per element.",
|
|
157
155
|
"$extensions": {
|
|
@@ -164,8 +162,7 @@
|
|
|
164
162
|
"$type": "dimension",
|
|
165
163
|
"$value": {
|
|
166
164
|
"value": 16.8,
|
|
167
|
-
"unit": "px"
|
|
168
|
-
"lineHeight": 1.5
|
|
165
|
+
"unit": "px"
|
|
169
166
|
},
|
|
170
167
|
"$description": "Body-size step of the fluid type scale, close to Bootstrap's 1rem.",
|
|
171
168
|
"$extensions": {
|
|
@@ -178,8 +175,7 @@
|
|
|
178
175
|
"$type": "dimension",
|
|
179
176
|
"$value": {
|
|
180
177
|
"value": 20,
|
|
181
|
-
"unit": "px"
|
|
182
|
-
"lineHeight": 1.4
|
|
178
|
+
"unit": "px"
|
|
183
179
|
},
|
|
184
180
|
"$description": "Large step of the fluid type scale; a product opts in per element.",
|
|
185
181
|
"$extensions": {
|
|
@@ -192,8 +188,7 @@
|
|
|
192
188
|
"$type": "dimension",
|
|
193
189
|
"$value": {
|
|
194
190
|
"value": 24,
|
|
195
|
-
"unit": "px"
|
|
196
|
-
"lineHeight": 1.3
|
|
191
|
+
"unit": "px"
|
|
197
192
|
},
|
|
198
193
|
"$description": "Extra-large step of the fluid type scale; a product opts in per element.",
|
|
199
194
|
"$extensions": {
|
|
@@ -206,8 +201,7 @@
|
|
|
206
201
|
"$type": "dimension",
|
|
207
202
|
"$value": {
|
|
208
203
|
"value": 32,
|
|
209
|
-
"unit": "px"
|
|
210
|
-
"lineHeight": 1.25
|
|
204
|
+
"unit": "px"
|
|
211
205
|
},
|
|
212
206
|
"$description": "Double extra-large step of the fluid type scale; a product opts in per element.",
|
|
213
207
|
"$extensions": {
|
|
@@ -220,8 +214,7 @@
|
|
|
220
214
|
"$type": "dimension",
|
|
221
215
|
"$value": {
|
|
222
216
|
"value": 44,
|
|
223
|
-
"unit": "px"
|
|
224
|
-
"lineHeight": 1.2
|
|
217
|
+
"unit": "px"
|
|
225
218
|
},
|
|
226
219
|
"$description": "Triple extra-large step of the fluid type scale; a product opts in per element.",
|
|
227
220
|
"$extensions": {
|
|
@@ -234,8 +227,7 @@
|
|
|
234
227
|
"$type": "dimension",
|
|
235
228
|
"$value": {
|
|
236
229
|
"value": 56,
|
|
237
|
-
"unit": "px"
|
|
238
|
-
"lineHeight": 1.1
|
|
230
|
+
"unit": "px"
|
|
239
231
|
},
|
|
240
232
|
"$description": "Fourth extra-large step of the fluid type scale; a product opts in per element.",
|
|
241
233
|
"$extensions": {
|
|
@@ -248,8 +240,7 @@
|
|
|
248
240
|
"$type": "dimension",
|
|
249
241
|
"$value": {
|
|
250
242
|
"value": 72,
|
|
251
|
-
"unit": "px"
|
|
252
|
-
"lineHeight": 1.05
|
|
243
|
+
"unit": "px"
|
|
253
244
|
},
|
|
254
245
|
"$description": "Fifth extra-large step of the fluid type scale; a product opts in per element.",
|
|
255
246
|
"$extensions": {
|
|
@@ -262,8 +253,7 @@
|
|
|
262
253
|
"$type": "dimension",
|
|
263
254
|
"$value": {
|
|
264
255
|
"value": 96,
|
|
265
|
-
"unit": "px"
|
|
266
|
-
"lineHeight": 1
|
|
256
|
+
"unit": "px"
|
|
267
257
|
},
|
|
268
258
|
"$description": "Sixth extra-large step of the fluid type scale; a product opts in per element.",
|
|
269
259
|
"$extensions": {
|
|
@@ -276,8 +266,7 @@
|
|
|
276
266
|
"$type": "dimension",
|
|
277
267
|
"$value": {
|
|
278
268
|
"value": 119.95,
|
|
279
|
-
"unit": "px"
|
|
280
|
-
"lineHeight": 1
|
|
269
|
+
"unit": "px"
|
|
281
270
|
},
|
|
282
271
|
"$description": "First display step above the fluid type scale, 64px on a phone to 120px on a desktop.",
|
|
283
272
|
"$extensions": {
|
|
@@ -290,8 +279,7 @@
|
|
|
290
279
|
"$type": "dimension",
|
|
291
280
|
"$value": {
|
|
292
281
|
"value": 144,
|
|
293
|
-
"unit": "px"
|
|
294
|
-
"lineHeight": 1
|
|
282
|
+
"unit": "px"
|
|
295
283
|
},
|
|
296
284
|
"$description": "Largest display step of the fluid type scale, 72px on a phone to 144px on a desktop.",
|
|
297
285
|
"$extensions": {
|
|
@@ -323,33 +311,6 @@
|
|
|
323
311
|
"$description": "Bold text weight."
|
|
324
312
|
}
|
|
325
313
|
},
|
|
326
|
-
"leading": {
|
|
327
|
-
"tight": {
|
|
328
|
-
"$type": "number",
|
|
329
|
-
"$value": 1.2,
|
|
330
|
-
"$description": "Tight line height, for headings and single-line labels."
|
|
331
|
-
},
|
|
332
|
-
"normal": {
|
|
333
|
-
"$type": "number",
|
|
334
|
-
"$value": 1.4,
|
|
335
|
-
"$description": "Default line height for running text on a phone.",
|
|
336
|
-
"$extensions": {
|
|
337
|
-
"com.webority": {
|
|
338
|
-
"platforms": ["phone"]
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
},
|
|
342
|
-
"relaxed": {
|
|
343
|
-
"$type": "number",
|
|
344
|
-
"$value": 1.6,
|
|
345
|
-
"$description": "Loose line height for long reading on a phone.",
|
|
346
|
-
"$extensions": {
|
|
347
|
-
"com.webority": {
|
|
348
|
-
"platforms": ["phone"]
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
},
|
|
353
314
|
"letter-spacing": {
|
|
354
315
|
"tight": {
|
|
355
316
|
"$type": "dimension",
|
|
@@ -3,85 +3,73 @@
|
|
|
3
3
|
"xs": {
|
|
4
4
|
"$value": {
|
|
5
5
|
"value": 12.07,
|
|
6
|
-
"unit": "px"
|
|
7
|
-
"lineHeight": 1.5
|
|
6
|
+
"unit": "px"
|
|
8
7
|
}
|
|
9
8
|
},
|
|
10
9
|
"sm": {
|
|
11
10
|
"$value": {
|
|
12
11
|
"value": 13.11,
|
|
13
|
-
"unit": "px"
|
|
14
|
-
"lineHeight": 1.5
|
|
12
|
+
"unit": "px"
|
|
15
13
|
}
|
|
16
14
|
},
|
|
17
15
|
"base": {
|
|
18
16
|
"$value": {
|
|
19
17
|
"value": 15.38,
|
|
20
|
-
"unit": "px"
|
|
21
|
-
"lineHeight": 1.5
|
|
18
|
+
"unit": "px"
|
|
22
19
|
}
|
|
23
20
|
},
|
|
24
21
|
"lg": {
|
|
25
22
|
"$value": {
|
|
26
23
|
"value": 17.04,
|
|
27
|
-
"unit": "px"
|
|
28
|
-
"lineHeight": 1.4
|
|
24
|
+
"unit": "px"
|
|
29
25
|
}
|
|
30
26
|
},
|
|
31
27
|
"xl": {
|
|
32
28
|
"$value": {
|
|
33
29
|
"value": 20.35,
|
|
34
|
-
"unit": "px"
|
|
35
|
-
"lineHeight": 1.3
|
|
30
|
+
"unit": "px"
|
|
36
31
|
}
|
|
37
32
|
},
|
|
38
33
|
"2xl": {
|
|
39
34
|
"$value": {
|
|
40
35
|
"value": 24.7,
|
|
41
|
-
"unit": "px"
|
|
42
|
-
"lineHeight": 1.25
|
|
36
|
+
"unit": "px"
|
|
43
37
|
}
|
|
44
38
|
},
|
|
45
39
|
"3xl": {
|
|
46
40
|
"$value": {
|
|
47
41
|
"value": 30.83,
|
|
48
|
-
"unit": "px"
|
|
49
|
-
"lineHeight": 1.2
|
|
42
|
+
"unit": "px"
|
|
50
43
|
}
|
|
51
44
|
},
|
|
52
45
|
"4xl": {
|
|
53
46
|
"$value": {
|
|
54
47
|
"value": 36.95,
|
|
55
|
-
"unit": "px"
|
|
56
|
-
"lineHeight": 1.1
|
|
48
|
+
"unit": "px"
|
|
57
49
|
}
|
|
58
50
|
},
|
|
59
51
|
"5xl": {
|
|
60
52
|
"$value": {
|
|
61
53
|
"value": 45.03,
|
|
62
|
-
"unit": "px"
|
|
63
|
-
"lineHeight": 1.05
|
|
54
|
+
"unit": "px"
|
|
64
55
|
}
|
|
65
56
|
},
|
|
66
57
|
"6xl": {
|
|
67
58
|
"$value": {
|
|
68
59
|
"value": 56.65,
|
|
69
|
-
"unit": "px"
|
|
70
|
-
"lineHeight": 1
|
|
60
|
+
"unit": "px"
|
|
71
61
|
}
|
|
72
62
|
},
|
|
73
63
|
"7xl": {
|
|
74
64
|
"$value": {
|
|
75
65
|
"value": 64,
|
|
76
|
-
"unit": "px"
|
|
77
|
-
"lineHeight": 1
|
|
66
|
+
"unit": "px"
|
|
78
67
|
}
|
|
79
68
|
},
|
|
80
69
|
"8xl": {
|
|
81
70
|
"$value": {
|
|
82
71
|
"value": 72.03,
|
|
83
|
-
"unit": "px"
|
|
84
|
-
"lineHeight": 1
|
|
72
|
+
"unit": "px"
|
|
85
73
|
}
|
|
86
74
|
}
|
|
87
75
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/tokens",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.92.0",
|
|
4
4
|
"description": "The Webority design tokens in one W3C Design Tokens source (palette, scale, meaning and component tiers, with light and dark, web and phone, and 390 and 1440 widths), and the webority command that brands a product, upgrades it between releases and checks it against the token source.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.91.0",
|
|
3
|
+
"css": {
|
|
4
|
+
"rename": [["--wui-lh-tight", "--wui-lh-heading"]],
|
|
5
|
+
"reads": [],
|
|
6
|
+
"choose": {},
|
|
7
|
+
"checkRole": []
|
|
8
|
+
},
|
|
9
|
+
"themeReads": [
|
|
10
|
+
{
|
|
11
|
+
"kind": "path",
|
|
12
|
+
"from": "leading.tight",
|
|
13
|
+
"to": "leading.heading"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"kind": "path",
|
|
17
|
+
"from": "leading.normal",
|
|
18
|
+
"to": "leading.body"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"kind": "gone",
|
|
22
|
+
"from": "leading.relaxed",
|
|
23
|
+
"hint": "read leading.body, or leading.heading for a heading"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"kind": "gone",
|
|
27
|
+
"from": "text.xs.lineHeight",
|
|
28
|
+
"hint": "multiply the step size by leading.body, or by leading.heading for a heading"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"kind": "gone",
|
|
32
|
+
"from": "text.sm.lineHeight",
|
|
33
|
+
"hint": "multiply the step size by leading.body, or by leading.heading for a heading"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"kind": "gone",
|
|
37
|
+
"from": "text.base.lineHeight",
|
|
38
|
+
"hint": "multiply the step size by leading.body, or by leading.heading for a heading"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"kind": "gone",
|
|
42
|
+
"from": "text.lg.lineHeight",
|
|
43
|
+
"hint": "multiply the step size by leading.body, or by leading.heading for a heading"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"kind": "gone",
|
|
47
|
+
"from": "text.xl.lineHeight",
|
|
48
|
+
"hint": "multiply the step size by leading.body, or by leading.heading for a heading"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"kind": "gone",
|
|
52
|
+
"from": "text.2xl.lineHeight",
|
|
53
|
+
"hint": "multiply the step size by leading.body, or by leading.heading for a heading"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"kind": "gone",
|
|
57
|
+
"from": "text.3xl.lineHeight",
|
|
58
|
+
"hint": "multiply the step size by leading.body, or by leading.heading for a heading"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"kind": "gone",
|
|
62
|
+
"from": "text.4xl.lineHeight",
|
|
63
|
+
"hint": "multiply the step size by leading.body, or by leading.heading for a heading"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"kind": "gone",
|
|
67
|
+
"from": "text.5xl.lineHeight",
|
|
68
|
+
"hint": "multiply the step size by leading.body, or by leading.heading for a heading"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"kind": "gone",
|
|
72
|
+
"from": "text.6xl.lineHeight",
|
|
73
|
+
"hint": "multiply the step size by leading.body, or by leading.heading for a heading"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"kind": "gone",
|
|
77
|
+
"from": "text.7xl.lineHeight",
|
|
78
|
+
"hint": "multiply the step size by leading.body, or by leading.heading for a heading"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"kind": "gone",
|
|
82
|
+
"from": "text.8xl.lineHeight",
|
|
83
|
+
"hint": "multiply the step size by leading.body, or by leading.heading for a heading"
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
"props": [],
|
|
87
|
+
"propValues": [],
|
|
88
|
+
"propSplits": [],
|
|
89
|
+
"razorAttributes": []
|
|
90
|
+
}
|