@webority/tokens 0.128.0 → 0.130.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/brand.js +2 -2
- package/dist/canvas/webority-phone.json +1 -1
- package/dist/canvas/webority-web-390.json +63 -5
- package/dist/canvas/webority-web.json +63 -5
- package/dist/cli.d.ts +6 -1
- package/dist/cli.js +3 -3
- package/dist/emit/web.js +15 -11
- package/dist/meanings.json +31 -1
- package/dist/ramp.js +1 -0
- package/dist/source/component.tokens.json +107 -3
- package/dist/source/meaning.tokens.json +45 -0
- package/dist/source/mode.dark.tokens.json +21 -0
- package/dist/source/platform.phone.tokens.json +21 -0
- package/dist/source/scale.tokens.json +4 -5
- package/dist/upgrade/index.js +2 -2
- package/dist/upgrade/razorValueSplits.js +2 -0
- package/dist/upgrade/source.js +2 -2
- package/dist/upgrade/themeReads.js +1 -1
- package/dist/upgrade/valueSplits.js +3 -0
- package/package.json +1 -1
- package/renames/0.107.0.json +1 -1
- package/renames/0.130.0.json +1677 -0
- package/renames/renames.d.ts +25 -2
package/dist/brand.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{EMAIL_COLOR_ROLES as e,EMAIL_PADDING_PATTERN as t,EMAIL_PADDING_ROLES as n,EMAIL_SHAPE as r,EMAIL_SPACE as i,EMAIL_TYPE_ROLES as a}from"./emit/email.js";import{
|
|
2
|
-
`));let
|
|
1
|
+
import{EMAIL_COLOR_ROLES as e,EMAIL_PADDING_PATTERN as t,EMAIL_PADDING_ROLES as n,EMAIL_SHAPE as r,EMAIL_SPACE as i,EMAIL_TYPE_ROLES as a}from"./emit/email.js";import{RAMP_STEPS as o,deriveRamp as s}from"./ramp.js";import{readFileSync as c}from"node:fs";var l=Object.freeze({css:`brand.css`,bootstrap:`_brand-variables.scss`,web:`webority-web.json`,web390:`webority-web-390.json`,phoneTheme:`webority-phone.json`,phone:`brand.phone.js`,email:`email.json`}),u=`generated`,d=/\{([a-z0-9-]+(?:\.[a-z0-9-]+)+)\}/g,f=[`palette`,`color`,`effect`,`font`,`radius`],p=[`space`,`text`,`shadow`,`section`,`component`,`email`],m=[`radius`,`padding`],h=[`size`,`lineHeight`,`phoneSize`,`phoneLineHeight`],g=[`narrowSize`,`narrowLineHeight`],_=/^(#[0-9a-fA-F]{6}|\{color\.[a-z0-9-]+\})$/;function v(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function y(e){return v(e)&&Object.hasOwn(e,`$value`)}function b(e,t){let n=[],r=(e,t)=>{for(let i of Object.keys(e)){if(i.startsWith(`$`))continue;let a=e[i],o=`${t}.${i}`;y(a)?n.push({path:o,node:a}):v(a)&&r(a,o)}};return r(e,t),n}function x(e,t){let n=e;for(let e of t.split(`.`)){if(!v(n)||!Object.hasOwn(n,e))return!1;n=n[e]}return y(n)}function S(e){let t=e?.$extensions?.[`com.webority`];return v(t)?t:{}}function C(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)&&!/^[0-9]+$/.test(e)}function w(e){return typeof e==`string`&&_.test(e)}function T(e){return v(e)&&Number.isInteger(e.value)&&e.value>=0&&e.unit===`px`}function E(e,t){return e===`space`?n.has(t):e===`button`&&t===`padding`}function D(e,n,r,i,a){let o=S(r);for(let t of Object.keys(o))(e!==`color`||t!==`dark`)&&a(i,`$extensions.com.webority.${t} is not allowed on this token`,`Remove it`);if(e===`color`)w(r.$value)||a(i,`$value is not a colour`,`Write "#RRGGBB" or a reference such as "{color.primary}"`),Object.hasOwn(o,`dark`)&&!w(o.dark)&&a(i,`$extensions.com.webority.dark is not a colour`,`Write "#RRGGBB" or a reference such as "{color.primary}"`);else if(e===`type`){let e=r.$value,t=v(e)?Object.keys(e):[],n=t.includes(`narrowSize`)||t.includes(`narrowLineHeight`)?[...h,...g]:h;v(e)&&t.length===n.length&&n.every(t=>Number.isInteger(e[t])&&e[t]>0)||a(i,`$value is not { size, lineHeight, phoneSize, phoneLineHeight } (optionally narrowSize, narrowLineHeight) in whole px`,`Write it as { "size": 16, "lineHeight": 24, "phoneSize": 15, "phoneLineHeight": 22 }`)}else E(e,n)?typeof r.$value==`string`&&t.test(r.$value)||a(i,`$value is not CSS px padding`,`Write it as "22px 24px", one to four px values or 0`):T(r.$value)||a(i,`$value is not { value, unit }`,`Write it as { "value": 12, "unit": "px" }`)}function O(t,n){let o={color:Object.keys(e),type:Object.keys(a),space:Object.keys(i),shape:Object.keys(r),button:m};for(let e of Object.keys(t))if(!e.startsWith(`$`)){if(!Object.hasOwn(o,e))n(`email.${e}`,`is not an email group`,`Use one of ${Object.keys(o).join(`, `)}`);else if(!v(t[e]))n(`email.${e}`,`is not a group`,`Write it as an object of tokens`);else for(let r of Object.keys(t[e])){if(r.startsWith(`$`))continue;let i=`email.${e}.${r}`;if(!o[e].includes(r)){n(i,`is not an email role`,`Use one of ${o[e].join(`, `)}`);continue}let a=t[e][r];y(a)?D(e,r,a,i,n):n(i,`is not a token`,`Give it a $value`)}}}function k(e,t,n){let r;try{r=JSON.parse(c(e,`utf8`))}catch(t){throw Error(`${e}: (file): cannot be read as JSON (${t.message}). Restore the file or fix the JSON`)}if(!v(r))throw Error(`${e}: (file): is not a JSON object. Write the brand as one object with the groups palette, color, effect, font and radius`);let i=[],a=(t,n,r)=>{let a=`${e}: ${t}: ${n}. ${r}`;i.includes(a)||i.push(a)},l=S(r);for(let e of Object.keys(l))e!==`brand`&&e!==`deviation`&&a(`$extensions.com.webority.${e}`,`is not a brand file key`,`Remove it`);let u=Object.hasOwn(l,`deviation`),m=u&&typeof l.deviation==`string`&&Object.hasOwn(n,l.deviation);u&&!m&&a(`$extensions.com.webority.deviation`,`${l.deviation} is not in deviations.json`,`Use a key of deviations.json`),typeof l.brand==`string`&&/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(l.brand)||a(`$extensions.com.webority.brand`,`is missing or not kebab case`,`Name the product in kebab case, such as acme`);let h=m?n[l.deviation].groups:[],g={},_=null;for(let e of Object.keys(r))e.startsWith(`$`)||(!f.includes(e)&&!p.includes(e)?a(e,`is not a brand group`,`A brand file holds only palette, color, effect, font and radius, plus the groups a recorded deviation allows`):p.includes(e)&&!h.includes(e)?a(e,`this group needs a recorded deviation`,`Add $extensions.com.webority.deviation naming an entry of deviations.json, or remove the group`):v(r[e])?e===`email`?_=r[e]:g[e]=r[e]:a(e,`is not a group`,`Write it as an object of tokens`));for(let[e,t]of Object.entries(g))for(let{path:n,node:r}of b(t,e)){let t=S(r);for(let r of Object.keys(t))r!==`platforms`&&r!==`dark`&&(r!==`faces`||e!==`font`)&&a(n,`$extensions.com.webority.${r} is not allowed on a token`,`Remove it`);if(Object.hasOwn(t,`platforms`)){let e=t.platforms;Array.isArray(e)&&e.length>0&&e.every(e=>e===`web`||e===`phone`)||a(n,`$extensions.com.webority.platforms is not a list of web and phone`,`Write it as ["phone"], ["web"] or both`)}Object.hasOwn(t,`dark`)&&e!==`color`&&e!==`effect`&&a(n,`$extensions.com.webority.dark applies to colour and effect tokens only`,`Remove it`)}for(let{path:e,node:t}of b(g.palette??{},`palette`))e.split(`.`).slice(1).every(C)||a(e,`the step name is not kebab case`,`Name it such as primary-500`),typeof t.$value!=`string`&&a(e,`$value is not a string`,`Write the colour as text such as "#0F766E" or a reference such as "{palette.primary}"`);let w=(e,n,r)=>{let i=`${e}.${n}`,o=S(r),s=x(t.meaning,i);typeof r.$value!=`string`&&a(i,`$value is not a string`,e===`color`?`Write a colour or a reference such as "{palette.primary}"`:`Write the effect as text such as a filter, colour or gradient`),s?x(t.modeDark,i)&&typeof o.dark!=`string`&&a(i,`needs $extensions.com.webority.dark because the meaning has a dark value`,`Add the dark value beside the light one`):(C(n)||a(i,`the name is not kebab case`,`Name it in kebab case`),(typeof r.$description!=`string`||r.$description===``)&&a(i,`is not a fleet meaning and has no $description`,`Add a $description saying what the colour is for, or use a meaning the library defines`)),Object.hasOwn(o,`dark`)&&typeof o.dark!=`string`&&a(i,`$extensions.com.webority.dark is not a string`,`Write a colour or a reference`)};for(let e of[`color`,`effect`]){let t=g[e]??{};for(let n of Object.keys(t))n.startsWith(`$`)||(y(t[n])?w(e,n,t[n]):a(`${e}.${n}`,`is not a token`,`Give it a $value`))}let T=Object.keys(t.scale.font??{}).filter(e=>y(t.scale.font[e]));for(let{path:e,node:n}of b(g.font??{},`font`)){x(t.scale,e)||a(e,`is not a fleet font`,`Use one of ${T.join(`, `)}`);let r=n.$value;if(Array.isArray(r)&&r.length!==0&&r.every(e=>typeof e==`string`)||a(e,`$value is not a list of font family names`,`Write it as ["Webority Sans", "system-ui", "sans-serif"]`),Object.hasOwn(S(n),`faces`)){let t=S(n).faces,r=[`normal`,`medium`,`semibold`,`bold`];v(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>r.includes(e))&&Object.values(t).every(e=>typeof e==`string`&&e!==``)||a(e,`faces is not a map of weight to font file name`,`Write it as { "normal": "AcmeSans-Regular", "semibold": "AcmeSans-SemiBold" }`)}}let E=Object.keys(t.scale.radius??{}).filter(e=>y(t.scale.radius[e]));for(let{path:e,node:n}of b(g.radius??{},`radius`)){x(t.scale,e)||a(e,`is not on the radius scale`,`Use one of ${E.join(`, `)}`);let r=n.$value;v(r)&&typeof r.value==`number`&&Number.isFinite(r.value)&&r.value>=0&&r.unit===`px`||a(e,`$value is not { value, unit }`,`Write it as { "value": 12, "unit": "px" }`)}_!==null&&O(_,a);let D=structuredClone(r);delete D.$extensions,delete D.$description,delete D.email;for(let e of[`color`,`effect`])for(let{node:t}of b(D[e]??{},e))Object.hasOwn(S(t),`dark`)&&(delete t.$extensions[`com.webority`].dark,Object.keys(t.$extensions[`com.webority`]).length===0&&delete t.$extensions[`com.webority`],Object.keys(t.$extensions).length===0&&delete t.$extensions);let k=g.palette?.primary?.$value;if(typeof k==`string`&&/^#[0-9a-fA-F]{6}$/.test(k)){let e=s(k);for(let t of o)x(D,`palette.${t}`)||(D.palette[t]={$type:`color`,$value:e[t]})}let A=e=>x(D,e)||x(t.palette,e)||x(t.scale,e)||x(t.meaning,e);for(let e of Object.keys(g))for(let{path:t,node:n}of b(g[e],e)){let e=[n.$value,S(n).dark].filter(e=>typeof e==`string`);for(let n of e)for(let e of n.matchAll(d))A(e[1])||a(t,`references {${e[1]}}, which no palette step, meaning, scale step or brand token defines`,`Name an existing token or add it to the brand file`)}if(i.length>0)throw Error(i.join(`
|
|
2
|
+
`));let j={};for(let e of[`color`,`effect`])for(let{path:t,node:n}of b(g[e]??{},e)){let r=S(n).dark;if(typeof r!=`string`)continue;let i=t.slice(e.length+1);j[e]??={},j[e][i]=n.$type===void 0?{$value:r}:{$value:r,$type:n.$type}}return{name:l.brand,base:D,dark:j,email:_}}export{l as BRAND_OUTPUT_FILES,u as HEAD_FOLDER,k as loadBrand};
|
|
@@ -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.130.0",
|
|
6
6
|
"brand": null,
|
|
7
7
|
"platform": "web",
|
|
8
8
|
"width": 390
|
|
@@ -20,6 +20,10 @@
|
|
|
20
20
|
"surface-inverse": "#071437",
|
|
21
21
|
"surface-inverse-raised": "#132041",
|
|
22
22
|
"surface-inverse-elevated": "#1d2949",
|
|
23
|
+
"surface-inverse-wash-4": "#ffffff0a",
|
|
24
|
+
"surface-inverse-wash-8": "#ffffff14",
|
|
25
|
+
"surface-inverse-wash-12": "#ffffff1f",
|
|
26
|
+
"surface-inverse-wash-24": "#ffffff3d",
|
|
23
27
|
"surface-dark": "#071437",
|
|
24
28
|
"surface-dark-border": "#2a3553",
|
|
25
29
|
"on-surface-dark": "#ffffff",
|
|
@@ -38,6 +42,7 @@
|
|
|
38
42
|
"field-border-hover": "#c4cada",
|
|
39
43
|
"field-border-focus": "#a5b4fc",
|
|
40
44
|
"focus-ring": "#4f46e5",
|
|
45
|
+
"focus-ring-soft": "#4f46e540",
|
|
41
46
|
"scrim": "#07143773",
|
|
42
47
|
"scrim-strong": "#0714379e",
|
|
43
48
|
"on-scrim": "#ffffff",
|
|
@@ -129,6 +134,10 @@
|
|
|
129
134
|
"surface-inverse": "#e6e8ee",
|
|
130
135
|
"surface-inverse-raised": "#dbdde5",
|
|
131
136
|
"surface-inverse-elevated": "#d2d5de",
|
|
137
|
+
"surface-inverse-wash-4": "#0714370a",
|
|
138
|
+
"surface-inverse-wash-8": "#07143714",
|
|
139
|
+
"surface-inverse-wash-12": "#0714371f",
|
|
140
|
+
"surface-inverse-wash-24": "#0714373d",
|
|
132
141
|
"surface-dark": "#071437",
|
|
133
142
|
"surface-dark-border": "#2a3553",
|
|
134
143
|
"on-surface-dark": "#ffffff",
|
|
@@ -147,6 +156,7 @@
|
|
|
147
156
|
"field-border-hover": "#3a414f",
|
|
148
157
|
"field-border-focus": "#9590ef",
|
|
149
158
|
"focus-ring": "#9590ef",
|
|
159
|
+
"focus-ring-soft": "#9590ef40",
|
|
150
160
|
"scrim": "#00000073",
|
|
151
161
|
"scrim-strong": "#0000009e",
|
|
152
162
|
"on-scrim": "#ffffff",
|
|
@@ -318,6 +328,14 @@
|
|
|
318
328
|
},
|
|
319
329
|
"shadow": {
|
|
320
330
|
"card": null,
|
|
331
|
+
"elevated": {
|
|
332
|
+
"x": 0,
|
|
333
|
+
"y": 2,
|
|
334
|
+
"blur": 8,
|
|
335
|
+
"spread": -2,
|
|
336
|
+
"color": "rgba(7, 20, 55, 0.10)",
|
|
337
|
+
"elevation": 4
|
|
338
|
+
},
|
|
321
339
|
"popover": {
|
|
322
340
|
"x": 0,
|
|
323
341
|
"y": 8,
|
|
@@ -348,13 +366,13 @@
|
|
|
348
366
|
"base": {},
|
|
349
367
|
"sizes": {
|
|
350
368
|
"sm": {
|
|
351
|
-
"radius": "
|
|
369
|
+
"radius": "10px"
|
|
352
370
|
},
|
|
353
371
|
"md": {
|
|
354
|
-
"radius": "
|
|
372
|
+
"radius": "10px"
|
|
355
373
|
},
|
|
356
374
|
"lg": {
|
|
357
|
-
"radius": "
|
|
375
|
+
"radius": "10px"
|
|
358
376
|
}
|
|
359
377
|
}
|
|
360
378
|
},
|
|
@@ -362,7 +380,8 @@
|
|
|
362
380
|
"base": {
|
|
363
381
|
"width": "2px",
|
|
364
382
|
"offset": "2px",
|
|
365
|
-
"shadow": "0 0 0 2px #e0e7ff"
|
|
383
|
+
"shadow": "0 0 0 2px #e0e7ff",
|
|
384
|
+
"soft-shadow": "0 0 0 2px #4f46e540"
|
|
366
385
|
},
|
|
367
386
|
"sizes": {}
|
|
368
387
|
},
|
|
@@ -383,6 +402,9 @@
|
|
|
383
402
|
},
|
|
384
403
|
"card": {
|
|
385
404
|
"base": {
|
|
405
|
+
"pad": "20px",
|
|
406
|
+
"title-fs": "16px",
|
|
407
|
+
"title-lh": "1.3",
|
|
386
408
|
"shadow-lifted": "none",
|
|
387
409
|
"shadow-lifted-hover": "none"
|
|
388
410
|
},
|
|
@@ -396,6 +418,36 @@
|
|
|
396
418
|
}
|
|
397
419
|
}
|
|
398
420
|
},
|
|
421
|
+
"modal": {
|
|
422
|
+
"base": {
|
|
423
|
+
"max-width": "440px"
|
|
424
|
+
},
|
|
425
|
+
"sizes": {}
|
|
426
|
+
},
|
|
427
|
+
"drawer": {
|
|
428
|
+
"base": {
|
|
429
|
+
"max": "90"
|
|
430
|
+
},
|
|
431
|
+
"sizes": {}
|
|
432
|
+
},
|
|
433
|
+
"step-tile": {
|
|
434
|
+
"base": {
|
|
435
|
+
"size": "34px"
|
|
436
|
+
},
|
|
437
|
+
"sizes": {}
|
|
438
|
+
},
|
|
439
|
+
"kpi": {
|
|
440
|
+
"base": {
|
|
441
|
+
"value-size": "24px"
|
|
442
|
+
},
|
|
443
|
+
"sizes": {}
|
|
444
|
+
},
|
|
445
|
+
"nav-menu": {
|
|
446
|
+
"base": {
|
|
447
|
+
"current-bg": "#00000000"
|
|
448
|
+
},
|
|
449
|
+
"sizes": {}
|
|
450
|
+
},
|
|
399
451
|
"container": {
|
|
400
452
|
"base": {},
|
|
401
453
|
"sizes": {
|
|
@@ -409,6 +461,12 @@
|
|
|
409
461
|
"opacity": "0.5"
|
|
410
462
|
},
|
|
411
463
|
"sizes": {}
|
|
464
|
+
},
|
|
465
|
+
"toast": {
|
|
466
|
+
"base": {
|
|
467
|
+
"edge-offset": "16px"
|
|
468
|
+
},
|
|
469
|
+
"sizes": {}
|
|
412
470
|
}
|
|
413
471
|
}
|
|
414
472
|
}
|
|
@@ -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.130.0",
|
|
6
6
|
"brand": null,
|
|
7
7
|
"platform": "web",
|
|
8
8
|
"width": 1440
|
|
@@ -20,6 +20,10 @@
|
|
|
20
20
|
"surface-inverse": "#071437",
|
|
21
21
|
"surface-inverse-raised": "#132041",
|
|
22
22
|
"surface-inverse-elevated": "#1d2949",
|
|
23
|
+
"surface-inverse-wash-4": "#ffffff0a",
|
|
24
|
+
"surface-inverse-wash-8": "#ffffff14",
|
|
25
|
+
"surface-inverse-wash-12": "#ffffff1f",
|
|
26
|
+
"surface-inverse-wash-24": "#ffffff3d",
|
|
23
27
|
"surface-dark": "#071437",
|
|
24
28
|
"surface-dark-border": "#2a3553",
|
|
25
29
|
"on-surface-dark": "#ffffff",
|
|
@@ -38,6 +42,7 @@
|
|
|
38
42
|
"field-border-hover": "#c4cada",
|
|
39
43
|
"field-border-focus": "#a5b4fc",
|
|
40
44
|
"focus-ring": "#4f46e5",
|
|
45
|
+
"focus-ring-soft": "#4f46e540",
|
|
41
46
|
"scrim": "#07143773",
|
|
42
47
|
"scrim-strong": "#0714379e",
|
|
43
48
|
"on-scrim": "#ffffff",
|
|
@@ -129,6 +134,10 @@
|
|
|
129
134
|
"surface-inverse": "#e6e8ee",
|
|
130
135
|
"surface-inverse-raised": "#dbdde5",
|
|
131
136
|
"surface-inverse-elevated": "#d2d5de",
|
|
137
|
+
"surface-inverse-wash-4": "#0714370a",
|
|
138
|
+
"surface-inverse-wash-8": "#07143714",
|
|
139
|
+
"surface-inverse-wash-12": "#0714371f",
|
|
140
|
+
"surface-inverse-wash-24": "#0714373d",
|
|
132
141
|
"surface-dark": "#071437",
|
|
133
142
|
"surface-dark-border": "#2a3553",
|
|
134
143
|
"on-surface-dark": "#ffffff",
|
|
@@ -147,6 +156,7 @@
|
|
|
147
156
|
"field-border-hover": "#3a414f",
|
|
148
157
|
"field-border-focus": "#9590ef",
|
|
149
158
|
"focus-ring": "#9590ef",
|
|
159
|
+
"focus-ring-soft": "#9590ef40",
|
|
150
160
|
"scrim": "#00000073",
|
|
151
161
|
"scrim-strong": "#0000009e",
|
|
152
162
|
"on-scrim": "#ffffff",
|
|
@@ -318,6 +328,14 @@
|
|
|
318
328
|
},
|
|
319
329
|
"shadow": {
|
|
320
330
|
"card": null,
|
|
331
|
+
"elevated": {
|
|
332
|
+
"x": 0,
|
|
333
|
+
"y": 2,
|
|
334
|
+
"blur": 8,
|
|
335
|
+
"spread": -2,
|
|
336
|
+
"color": "rgba(7, 20, 55, 0.10)",
|
|
337
|
+
"elevation": 4
|
|
338
|
+
},
|
|
321
339
|
"popover": {
|
|
322
340
|
"x": 0,
|
|
323
341
|
"y": 8,
|
|
@@ -348,13 +366,13 @@
|
|
|
348
366
|
"base": {},
|
|
349
367
|
"sizes": {
|
|
350
368
|
"sm": {
|
|
351
|
-
"radius": "
|
|
369
|
+
"radius": "10px"
|
|
352
370
|
},
|
|
353
371
|
"md": {
|
|
354
|
-
"radius": "
|
|
372
|
+
"radius": "10px"
|
|
355
373
|
},
|
|
356
374
|
"lg": {
|
|
357
|
-
"radius": "
|
|
375
|
+
"radius": "10px"
|
|
358
376
|
}
|
|
359
377
|
}
|
|
360
378
|
},
|
|
@@ -362,7 +380,8 @@
|
|
|
362
380
|
"base": {
|
|
363
381
|
"width": "2px",
|
|
364
382
|
"offset": "2px",
|
|
365
|
-
"shadow": "0 0 0 2px #e0e7ff"
|
|
383
|
+
"shadow": "0 0 0 2px #e0e7ff",
|
|
384
|
+
"soft-shadow": "0 0 0 2px #4f46e540"
|
|
366
385
|
},
|
|
367
386
|
"sizes": {}
|
|
368
387
|
},
|
|
@@ -383,6 +402,9 @@
|
|
|
383
402
|
},
|
|
384
403
|
"card": {
|
|
385
404
|
"base": {
|
|
405
|
+
"pad": "20px",
|
|
406
|
+
"title-fs": "16px",
|
|
407
|
+
"title-lh": "1.3",
|
|
386
408
|
"shadow-lifted": "none",
|
|
387
409
|
"shadow-lifted-hover": "none"
|
|
388
410
|
},
|
|
@@ -396,6 +418,36 @@
|
|
|
396
418
|
}
|
|
397
419
|
}
|
|
398
420
|
},
|
|
421
|
+
"modal": {
|
|
422
|
+
"base": {
|
|
423
|
+
"max-width": "440px"
|
|
424
|
+
},
|
|
425
|
+
"sizes": {}
|
|
426
|
+
},
|
|
427
|
+
"drawer": {
|
|
428
|
+
"base": {
|
|
429
|
+
"max": "90"
|
|
430
|
+
},
|
|
431
|
+
"sizes": {}
|
|
432
|
+
},
|
|
433
|
+
"step-tile": {
|
|
434
|
+
"base": {
|
|
435
|
+
"size": "34px"
|
|
436
|
+
},
|
|
437
|
+
"sizes": {}
|
|
438
|
+
},
|
|
439
|
+
"kpi": {
|
|
440
|
+
"base": {
|
|
441
|
+
"value-size": "24px"
|
|
442
|
+
},
|
|
443
|
+
"sizes": {}
|
|
444
|
+
},
|
|
445
|
+
"nav-menu": {
|
|
446
|
+
"base": {
|
|
447
|
+
"current-bg": "#00000000"
|
|
448
|
+
},
|
|
449
|
+
"sizes": {}
|
|
450
|
+
},
|
|
399
451
|
"container": {
|
|
400
452
|
"base": {},
|
|
401
453
|
"sizes": {
|
|
@@ -409,6 +461,12 @@
|
|
|
409
461
|
"opacity": "0.5"
|
|
410
462
|
},
|
|
411
463
|
"sizes": {}
|
|
464
|
+
},
|
|
465
|
+
"toast": {
|
|
466
|
+
"base": {
|
|
467
|
+
"edge-offset": "16px"
|
|
468
|
+
},
|
|
469
|
+
"sizes": {}
|
|
412
470
|
}
|
|
413
471
|
}
|
|
414
472
|
}
|
package/dist/cli.d.ts
CHANGED
|
@@ -37,7 +37,8 @@ export interface BrandResult {
|
|
|
37
37
|
* installed version up to <version> in order, then runs brand. With --app, the same run covers one app folder inside
|
|
38
38
|
* the repo: the design map is read from the repo root, and the pins, install (pnpm or npm, by the folder's lockfile)
|
|
39
39
|
* and tables are the app's. With --path (repeatable), applies the tables to those paths only, with no pin move,
|
|
40
|
-
* install or brand run; webority-ui uses it on itself.
|
|
40
|
+
* install or brand run; webority-ui uses it on itself. --alias <pkg>=<library pkg> (repeatable) matches the wrapper
|
|
41
|
+
* package as its library. --report <path> is written by the command line only: it stores the result as JSON.
|
|
41
42
|
*/
|
|
42
43
|
export interface UpgradeOptions {
|
|
43
44
|
version: string;
|
|
@@ -45,6 +46,10 @@ export interface UpgradeOptions {
|
|
|
45
46
|
/** An app folder inside the repo, relative to root. */
|
|
46
47
|
app?: string;
|
|
47
48
|
paths?: string[];
|
|
49
|
+
/** Wrapper package name to the library package its rules name: `{ "@acme/ui": "@webority/ui-react" }`. */
|
|
50
|
+
aliases?: Record<string, string>;
|
|
51
|
+
/** Path of a JSON file for the command line to write the UpgradeResult to; upgrade() ignores it. */
|
|
52
|
+
report?: string;
|
|
48
53
|
/** Defaults to process.cwd(). */
|
|
49
54
|
root?: string;
|
|
50
55
|
}
|
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{brand as e}from"./build.js";import{check as t}from"./check.js";import{upgrade as n}from"./upgrade/index.js";var
|
|
1
|
+
import{brand as e}from"./build.js";import{check as t}from"./check.js";import{upgrade as n}from"./upgrade/index.js";import{writeFileSync as r}from"node:fs";var i=`Usage: webority <command>
|
|
2
2
|
brand [--brand <file>] [--library] [--out <dir>] [--web <scss>] [--phone <ts>] [--check]
|
|
3
|
-
upgrade <version> [--dry-run] [--app <folder>] [--path <p>]...
|
|
4
|
-
check`,
|
|
3
|
+
upgrade <version> [--dry-run] [--app <folder>] [--path <p>]... [--alias <pkg>=<library pkg>]... [--report <path>]
|
|
4
|
+
check`,a=[`brand`,`upgrade`,`check`],o=[`generated`,`design-map`,`repo-checks`],s={"--brand":`brand`,"--out":`out`,"--web":`web`,"--phone":`phone`},c=class extends Error{};function l(e){return console.error(e),console.error(i),2}function u(e){if(!(e instanceof Error))throw e;return console.error(e.message),1}function d(e,t,n){let r=[],i={},a=new Set;for(let o=0;o<e.length;o+=1){let s=e[o];if(t.includes(s)){let t=e[o+1];if(t===void 0||t.startsWith(`--`))throw new c(`${s} needs a value.`);i[s]=[...i[s]??[],t],o+=1}else if(n.includes(s))a.add(s);else if(s.startsWith(`--`))throw new c(`Unknown flag ${s}.`);else r.push(s)}return{positionals:r,values:i,flags:a}}function f(e,t){if(e===`brand`){let{positionals:e,values:n,flags:r}=d(t,Object.keys(s),[`--library`,`--check`]);if(e.length>0)throw new c(`brand takes no argument, got ${e[0]}.`);let i={};for(let[e,t]of Object.entries(s))n[e]!==void 0&&(i[t]=n[e].at(-1));return r.has(`--library`)&&(i.library=!0),r.has(`--check`)&&(i.check=!0),{kind:`brand`,options:i}}if(e===`upgrade`){let{positionals:e,values:n,flags:r}=d(t,[`--path`,`--app`,`--alias`,`--report`],[`--dry-run`]);if(e.length===0)throw new c(`upgrade needs a <version>.`);if(e.length>1)throw new c(`Unexpected argument ${e[1]}.`);let i={version:e[0]};if(r.has(`--dry-run`)&&(i.dryRun=!0),n[`--alias`]!==void 0){i.aliases={};for(let e of n[`--alias`]){let[t,n]=e.split(`=`);if(!t||!n||e.split(`=`).length!==2)throw new c(`--alias takes <pkg>=<library pkg>, got ${e}.`);i.aliases[t]=n}}if(n[`--report`]!==void 0){if(n[`--report`].length>1)throw new c(`--report takes one path.`);i.report=n[`--report`][0]}if(n[`--app`]!==void 0){if(n[`--app`].length>1)throw new c(`--app takes one folder.`);if(n[`--path`]!==void 0)throw new c(`--app and --path cannot be combined.`);i.app=n[`--app`][0]}return n[`--path`]!==void 0&&(i.paths=n[`--path`]),{kind:`upgrade`,options:i}}if(t.length>0)throw new c(`check takes no arguments, got ${t[0]}.`);return{kind:`check`}}async function p(s,d={brand:e,upgrade:n,check:t}){if(s.includes(`--help`)||s.includes(`-h`))return console.log(i),0;if(s.length===0)return console.error(i),2;let[p,...m]=s;if(!a.includes(p))return l(`Unknown command ${p}. Commands: brand, upgrade, check.`);let h;try{h=f(p,m)}catch(e){if(e instanceof c)return l(e.message);throw e}if(h.kind===`brand`){let e;try{e=await d.brand(h.options)}catch(e){return u(e)}for(let t of e.written)console.log(`wrote ${t}`);if(!h.options.check)return 0;for(let t of e.stale)console.log(`stale ${t}`);return+(e.stale.length>0)}if(h.kind===`upgrade`){let{report:e,...t}=h.options,n;try{n=await d.upgrade(t)}catch(e){return u(e)}for(let e of n.hits)console.log(`${e.file}:${e.line} ${e.from} -> ${e.to}`);for(let e of n.choose)console.log(`choose ${e.file}:${e.line} ${e.name}: ${e.hint}`);if(e!==void 0)try{r(e,`${JSON.stringify({hits:n.hits,choose:n.choose,changedFiles:n.changedFiles},null,4)}\n`,`utf8`)}catch(e){return u(e)}return+(n.choose.length>0)}let g;try{g=await d.check()}catch(e){return u(e)}for(let e of o)g.findings.some(t=>t.check===e)||console.log(`ok ${e}`);for(let e of g.findings){let t=e.file?`${e.file}: `:``;console.log(`FAIL ${e.check}: ${t}${e.message}`)}return+(g.findings.length>0)}export{e as brand,t as check,p as run,n as upgrade};
|
package/dist/emit/web.js
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import{BREAKPOINT_PX as e,TOUCH_MEDIA as t,breakpointRules as n,fluidLength as r,touchValue as i}from"../model/length.js";import{cssVarOfPath as a}from"../names.js";var o={mode:`light`,platform:`web`,width:1440},s={mode:`dark`,platform:`web`,width:1440},c={mode:`light`,platform:`web`,width:390},l=/\{([a-z0-9-]+(?:\.[a-z0-9-]+)+)\}/g,u=/^\{([a-z0-9-]+(?:\.[a-z0-9-]+)+)\}$/,d=/^#[0-9a-f]{6}$/i,f=[[`--bs-body-color`,`text`],[`--bs-emphasis-color`,`text`],[`--bs-secondary-color`,`text-muted`],[`--bs-tertiary-color`,`text-subtle`],[`--bs-heading-color`,`text`],[`--bs-body-bg`,`bg`],[`--bs-border-color`,`border`],[`--bs-secondary-bg`,`surface`],[`--bs-tertiary-bg`,`bg-muted`],[`--bs-primary`,`primary`]],p=[[`--bs-body-bg-rgb`,`bg`],[`--bs-primary-rgb`,`primary`],[`--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`]],m=[[`$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`,null],[`$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`]],
|
|
1
|
+
import{BREAKPOINT_PX as e,TOUCH_MEDIA as t,breakpointRules as n,fluidLength as r,touchValue as i}from"../model/length.js";import{cssVarOfPath as a}from"../names.js";var o={mode:`light`,platform:`web`,width:1440},s={mode:`dark`,platform:`web`,width:1440},c={mode:`light`,platform:`web`,width:390},l=/\{([a-z0-9-]+(?:\.[a-z0-9-]+)+)\}/g,u=/^\{([a-z0-9-]+(?:\.[a-z0-9-]+)+)\}$/,d=/^#[0-9a-f]{6}$/i,f=[[`--bs-body-color`,`text`],[`--bs-emphasis-color`,`text`],[`--bs-secondary-color`,`text-muted`],[`--bs-tertiary-color`,`text-subtle`],[`--bs-heading-color`,`text`],[`--bs-body-bg`,`bg`],[`--bs-border-color`,`border`],[`--bs-secondary-bg`,`surface`],[`--bs-tertiary-bg`,`bg-muted`],[`--bs-primary`,`primary`]],p=[[`--bs-body-bg-rgb`,`bg`],[`--bs-primary-rgb`,`primary`],[`--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`]],m=[[`--bs-secondary-rgb`,`text-muted`]],h=[[`$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`,null],[`$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`]],ee=[[`$primary`,`color.primary`]],g={"$border-color-translucent":`rgba(13, 24, 43, 0.08)`},_=[`color.link`,`color.primary-hover`],v=`:root[data-theme="dark"],
|
|
2
2
|
:root[data-bs-theme="dark"]`,y=`[data-theme="dark"]:not(:root),
|
|
3
|
-
[data-bs-theme="dark"]:not(:root)`,b=`:root[data-theme="auto"]`,x
|
|
3
|
+
[data-bs-theme="dark"]:not(:root)`,b=`:root[data-theme="auto"]`,x=`:root[data-theme="dark"] [data-theme="light"],
|
|
4
|
+
:root[data-theme="dark"] [data-bs-theme="light"],
|
|
5
|
+
:root[data-bs-theme="dark"] [data-theme="light"],
|
|
6
|
+
:root[data-bs-theme="dark"] [data-bs-theme="light"]`,S=`:root[data-theme="auto"] [data-theme="light"],
|
|
7
|
+
:root[data-theme="auto"] [data-bs-theme="light"]`,C=`[data-theme="dark"]:not(:root) [data-theme="light"],
|
|
4
8
|
[data-theme="dark"]:not(:root) [data-bs-theme="light"],
|
|
5
9
|
[data-bs-theme="dark"]:not(:root) [data-theme="light"],
|
|
6
|
-
[data-bs-theme="dark"]:not(:root) [data-bs-theme="light"]`,
|
|
10
|
+
[data-bs-theme="dark"]:not(:root) [data-bs-theme="light"]`,te=`// var() resolves where a name is declared, so the html copies keep the light values for a light box.`,w=`/* var() resolves where a name is declared, so the html copies keep the light values for a light box. */`,T=`// Zero specificity, so a component's own class on a themed section or inside it keeps its colour.`,E=`/* Zero specificity, so a component's own class on a themed section or inside it keeps its colour. */`,D=`// A light box under a dark page root takes literal light values: var() would resolve against the dark root.`,ne=`/* A light box under a dark page root takes literal light values: var() would resolve against the dark root. */`;function O(e){return String(Number(e.toFixed(4)))}function k(e,t){if(typeof t==`string`)return t.replace(l,(e,t)=>`var(${a(t)})`);if(typeof t==`number`)return O(t);if(Array.isArray(t)){if(e.type===`cubicBezier`&&t.length===4&&t.every(e=>typeof e==`number`))return`cubic-bezier(${t.map(e=>O(e)).join(`, `)})`;if(e.type===`fontFamily`&&t.every(e=>typeof e==`string`))return t.map(e=>/\s/.test(e)?`"${e}"`:e).join(`, `)}else if(t&&typeof t==`object`){if(`unit`in t&&typeof t.value==`number`)return`${O(t.value)}${t.unit}`;if(`color`in t)return[t.offsetX,t.offsetY,t.blur,t.spread,t.color].map(t=>k(e,t)).join(` `)}throw Error(`emitWeb: ${e.path}: cannot write a ${e.type} value as CSS.`)}function A(e,t,n){return k(e.tokens.get(t),e.valueIn(t,n))}function j(e,t){if(t&&typeof t==`object`&&t.unit===`px`&&typeof t.value==`number`)return t.value;throw Error(`emitWeb: ${e}: a text size must be a px dimension.`)}function M(e,t){let i=e.tokens.get(t),s=a(t);if(i.group===`text`){if(n(i).length>0)throw Error(`emitWeb: ${t}: a text size cannot carry breakpoints.`);let a=j(t,e.valueIn(t,c)),l=j(t,e.valueIn(t,o)),u=i.extensions?.fluidUntil;if(a!==l&&u===void 0)throw Error(`emitWeb: ${t}: the 390 and 1440 sizes differ but no fluidUntil is recorded.`);return{path:t,name:s,root:r(a,l,u??1440),tiers:[]}}let l=n(i);return l.length>0?{path:t,name:s,root:A(e,t,c),tiers:l.map(e=>({tier:e.tier,text:k(i,e.value)}))}:{path:t,name:s,root:A(e,t,o),tiers:[]}}function N(e){let t=[];for(let n of e.tokens.keys())e.existsIn(n,o)&&t.push(M(e,n));return t}function re(e,t){let r=[];for(let[i,c]of e.tokens){if(!e.existsIn(i,s)||!e.existsIn(i,o)||n(c).length>0)continue;let l=A(e,i,s);if(c.group===`text`){if(l!==A(e,i,o))throw Error(`emitWeb: ${i}: a text size cannot change with the mode.`)}else t(i,l)&&r.push({path:i,name:a(i),text:l,light:A(e,i,o)})}return r}function P(e){let t=Number.parseInt(e.slice(1),16);return`${t>>16&255}, ${t>>8&255}, ${t&255}`}function F(e,t){let n=[],r=(r,i)=>{for(let[a,c]of r){let r=`color.${c}`,l=e.resolvedIn(r,s);if(!d.test(l))throw Error(`emitWeb: ${r}: a Bootstrap rgb triplet needs an opaque colour.`);if(t(r,l)){let t=i?P(V(e,r,o)):null;n.push({name:a,text:P(l),light:t})}}};return r(p,!0),r(m,!1),n}function I(e,t,n){return!e.tokens.has(`color.primary`)||!t.tokens.has(`color.primary`)||e.resolvedIn(`color.primary`,n)===t.resolvedIn(`color.primary`,n)?[]:L(e,n)}function L(e,t){let n=V(e,`color.primary`,t);return[{name:`--bs-primary`,text:n},{name:`--bs-primary-rgb`,text:P(n)}]}function R(e,t,n){return!_.every(n=>e.tokens.has(n)&&t.tokens.has(n))||e.resolvedIn(`color.link`,n)===t.resolvedIn(`color.link`,n)?[]:z(e,n)}function z(e,t){let n=V(e,`color.link`,t),r=V(e,`color.primary-hover`,t);return[{name:`--bs-link-color`,text:n},{name:`--bs-link-color-rgb`,text:P(n)},{name:`--bs-link-hover-color`,text:r},{name:`--bs-link-hover-color-rgb`,text:P(r)}]}function B(e){return _.every(t=>e.tokens.has(t))?[{name:`--bs-link-color`,text:`var(--color-link)`,light:`var(--color-link)`},{name:`--bs-link-color-rgb`,text:P(V(e,`color.link`,s)),light:P(V(e,`color.link`,o))},{name:`--bs-link-hover-color`,text:`var(--color-primary-hover)`,light:`var(--color-primary-hover)`},{name:`--bs-link-hover-color-rgb`,text:P(V(e,`color.primary-hover`,s)),light:P(V(e,`color.primary-hover`,o))}]:[]}function V(e,t,n){let r=e.resolvedIn(t,n);if(!d.test(r))throw Error(`emitWeb: ${t}: a Bootstrap rgb triplet needs an opaque colour.`);return r}function H(e,t){let n=re(e,t?(e,n)=>!t.tokens.has(e)||!t.existsIn(e,s)||n!==A(t,e,s):(t,n)=>n!==A(e,t,o)),r=F(e,t?(e,n)=>n!==t.resolvedIn(e,s):()=>!0);if(t){let i=R(e,t,o).length>0?z(e,s):R(e,t,s);return[...n,...r,...i]}let i=f.map(([e,t])=>{let n=`var(${a(`color.${t}`)})`;return{name:e,text:n,light:n}});return[...n,...i,...r,...B(e)]}function U(e,t,n){return e.tokens.has(n)&&t.tokens.has(n)&&e.resolvedIn(n,o)!==t.resolvedIn(n,o)}function W(e,t){let n=f.filter(([n,r])=>n!==`--bs-primary`&&U(e,t,`color.${r}`)).map(([e,t])=>({name:e,text:`var(${a(`color.${t}`)})`})),r=p.filter(([n,r])=>n!==`--bs-primary-rgb`&&U(e,t,`color.${r}`)).map(([t,n])=>({name:t,text:P(V(e,`color.${n}`,o))}));return[...n,...r]}function G(e,t){return`${e} {\n${t.join(`
|
|
7
11
|
`).split(`
|
|
8
12
|
`).map(e=>e===``?e:` ${e}`).join(`
|
|
9
|
-
`)}\n}`}function
|
|
13
|
+
`)}\n}`}function K(e){return e.split(`,
|
|
10
14
|
`).map(e=>`:where(${e})`).join(`,
|
|
11
|
-
`)}function G(e){let t=[];for(let n=0;n<e.length;n+=6)t.push(e.slice(n,n+6).join(`, `));return[`$wui-dark-layer-names: (\n${t.map((e,n)=>` ${e}${n<t.length-1?`,`:``}`).join(`
|
|
12
|
-
`)}\n);`,
|
|
15
|
+
`)}function q(e,t){let n=H(e,null).filter(e=>e.light!=null);if(!t)return n;let r=new Map(H(t,null).filter(e=>e.light!=null).map(e=>[e.name,e.light]));return n.filter(e=>r.get(e.name)!==e.light)}function J(e,t){if(e.length===0)return[];let n=e.map(e=>`${e.name}: ${e.light};`);return[t?ne:D,G(x,n),G(K(x),[`color-scheme: light;`,`color: var(--color-text);`]),G(`@media (prefers-color-scheme: dark)`,[G(S,n),G(K(S),[`color-scheme: light;`,`color: var(--color-text);`])])]}function Y(e){let t=[];for(let n=0;n<e.length;n+=6)t.push(e.slice(n,n+6).join(`, `));return[`$wui-dark-layer-names: (\n${t.map((e,n)=>` ${e}${n<t.length-1?`,`:``}`).join(`
|
|
16
|
+
`)}\n);`,te,G(`html`,[`@each $name in $wui-dark-layer-names {`,` --wui-light-#{$name}: var(--#{$name});`,`}`]),G(C,[`@each $name in $wui-dark-layer-names {`,` --#{$name}: var(--wui-light-#{$name});`,`}`]),G(K(C),[`color-scheme: light;`,`color: var(--color-text);`])].join(`
|
|
13
17
|
|
|
14
|
-
`)}function
|
|
18
|
+
`)}function ie(e){return[w,G(`html`,e.map(e=>`--wui-light-${e}: var(--${e});`)),G(C,e.map(e=>`--${e}: var(--wui-light-${e});`)),G(K(C),[`color-scheme: light;`,`color: var(--color-text);`])].join(`
|
|
15
19
|
|
|
16
|
-
`)}function
|
|
20
|
+
`)}function X(e,t,n=!1){let{package:r,version:i,brand:a}=e.source,o=t?`Generated by ${r} ${i} for the ${a} brand. Do not edit; run webority brand.`:`Generated by ${r} ${i} from its token source. Do not edit; run webority brand --library.`;return n?`/* ${o} */`:`// ${o}`}function Z(n,r){let a=N(n),s=new Map((r?N(r):[]).map(e=>[e.path,e])),c=[],l=a.filter(e=>s.get(e.path)?.root!==e.root).map(e=>`${e.name}: ${e.root};`);r&&(l.push(...I(n,r,o).map(e=>`${e.name}: ${e.text};`)),l.push(...R(n,r,o).map(e=>`${e.name}: ${e.text};`)),l.push(...W(n,r).map(e=>`${e.name}: ${e.text};`))),l.length>0&&c.push(G(`:root`,l));for(let[t,n]of Object.entries(e)){let e=[];for(let n of a)for(let r of n.tiers)r.tier===t&&s.get(n.path)?.tiers.find(e=>e.tier===t)?.text!==r.text&&e.push(`${n.name}: ${r.text};`);e.length>0&&c.push(G(`@media (min-width: ${n}px)`,[G(`:root`,e)]))}let u=[];for(let e of a){let t=n.tokens.get(e.path),a=i(t);if(a===null)continue;let o=k(t,a),s=r?.tokens.get(e.path),c=s?i(s):null;(c===null||k(s,c)!==o)&&u.push(`${e.name}: ${o};`)}u.length>0&&c.push(G(`@media ${t}`,[G(`:root`,u)]));let d=H(n,r);if(d.length>0){let e=d.map(e=>`${e.name}: ${e.text};`),t=r?E:T;c.push(G(v,[...e,`color-scheme: dark;`]),G(y,e),`${t}\n${G(K(y),[`color-scheme: dark;`,`color: var(--color-text);`])}`);let i=d.map(e=>e.name.slice(2));if(r){let e=new Set(H(r,null).map(e=>e.name.slice(2))),t=i.filter(t=>!e.has(t));t.length>0&&c.push(ie(t))}else c.push(Y(i));c.push(G(`@media (prefers-color-scheme: dark)`,[G(b,[...e,`color-scheme: dark;`])])),c.push(...J(q(n,r),r!==null))}return`${[X(n,r!==null,r!==null),...c].join(`
|
|
17
21
|
|
|
18
|
-
`)}\n`}function
|
|
19
|
-
`)}\n`}function
|
|
20
|
-
`)}\n`}function
|
|
22
|
+
`)}\n`}function Q(e,t){let n=e.tokens.get(t);if(n.type===`color`)return e.resolvedIn(t,o);let r=e.valueIn(t,o),i=typeof r==`string`?u.exec(r):null;if(i)return Q(e,i[1]);let a=k(n,r);if(a.includes(`var(`))throw Error(`emitWeb: ${t}: a Bootstrap variable needs a literal.`);return a}function $(e,t,n){return n===null?g[t]:Q(e,n)}function ae(e){let t=h.map(([t,n])=>`${t}: ${$(e,t,n)} !default;`);return`${[X(e,!1),...t].join(`
|
|
23
|
+
`)}\n`}function oe(e,t){let n=[...ee,...h].filter(([n,r])=>$(e,n,r)!==$(t,n,r)).map(([t,n])=>`${t}: ${$(e,t,n)};`);return`${[X(e,!0),...n].join(`
|
|
24
|
+
`)}\n`}function se(e,t){return t===void 0?{tokens:Z(e,null),bootstrap:ae(e)}:{css:Z(e,t.library),variables:oe(e,t.library)}}export{se as emitWeb};
|
package/dist/meanings.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"format": "webority-meanings/1",
|
|
3
3
|
"source": {
|
|
4
4
|
"package": "@webority/tokens",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.130.0"
|
|
6
6
|
},
|
|
7
7
|
"color": {
|
|
8
8
|
"bg": {
|
|
@@ -52,6 +52,30 @@
|
|
|
52
52
|
"web"
|
|
53
53
|
]
|
|
54
54
|
},
|
|
55
|
+
"surface-inverse-wash-4": {
|
|
56
|
+
"description": "Faintest translucent wash over an inverse band, for a resting tile or row.",
|
|
57
|
+
"platforms": [
|
|
58
|
+
"web"
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
"surface-inverse-wash-8": {
|
|
62
|
+
"description": "Light translucent wash over an inverse band, for a hovered tile or row.",
|
|
63
|
+
"platforms": [
|
|
64
|
+
"web"
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
"surface-inverse-wash-12": {
|
|
68
|
+
"description": "Medium translucent wash over an inverse band, for a selected or pressed tile or row.",
|
|
69
|
+
"platforms": [
|
|
70
|
+
"web"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
"surface-inverse-wash-24": {
|
|
74
|
+
"description": "Strong translucent wash over an inverse band, for a divider or a filled chip.",
|
|
75
|
+
"platforms": [
|
|
76
|
+
"web"
|
|
77
|
+
]
|
|
78
|
+
},
|
|
55
79
|
"surface-dark": {
|
|
56
80
|
"description": "Band that stays dark in light and dark mode, such as a site footer or a dark hero.",
|
|
57
81
|
"platforms": [
|
|
@@ -176,6 +200,12 @@
|
|
|
176
200
|
"phone"
|
|
177
201
|
]
|
|
178
202
|
},
|
|
203
|
+
"focus-ring-soft": {
|
|
204
|
+
"description": "Translucent step of the focus ring colour, for a soft halo around a focused field.",
|
|
205
|
+
"platforms": [
|
|
206
|
+
"web"
|
|
207
|
+
]
|
|
208
|
+
},
|
|
179
209
|
"scrim": {
|
|
180
210
|
"description": "Dim behind page-level backdrops such as drawers, modals and the shell.",
|
|
181
211
|
"platforms": [
|
package/dist/ramp.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.freeze([`primary-hover`,`primary-pressed`,`primary-50`,`primary-30`,`primary-20`,`primary-15`,`primary-10`,`primary-5`]),t=Object.freeze({"primary-50":.5,"primary-30":.3,"primary-20":.2,"primary-15":.15,"primary-10":.1,"primary-5":.05}),n=.05,r=/^#([0-9a-f]{6})$/i;function i(i){let l=typeof i==`string`?r.exec(i):null;if(!l)throw Error(`deriveRamp: ${i} is not #RRGGBB.`);let u=parseInt(l[1],16),d=[u>>16&255,u>>8&255,u&255],[f,p,m]=s(d),h={"primary-hover":c(f,p,a(m+n)),"primary-pressed":c(f,p,a(m-n))};for(let[e,n]of Object.entries(t))h[e]=o(d.map(e=>Math.round(e*n+255*(1-n))));return Object.fromEntries(e.map(e=>[e,h[e]]))}function a(e){return Math.min(1,Math.max(0,e))}function o(e){return`#`+e.map(e=>e.toString(16).padStart(2,`0`)).join(``).toUpperCase()}function s([e,t,n]){let r=e/255,i=t/255,a=n/255,o=Math.max(r,i,a),s=Math.min(r,i,a),c=(o+s)/2;if(o===s)return[0,0,c];let l=o-s,u=c>.5?l/(2-o-s):l/(o+s),d;return d=o===r?(i-a)/l+(i<a?6:0):o===i?(a-r)/l+2:(r-i)/l+4,[d*60,u,c]}function c(e,t,n){if(t===0)return o([n,n,n].map(e=>Math.round(e*255)));let r=n<.5?n*(1+t):n+t-n*t,i=2*n-r,a=e/360;return o([a+1/3,a,a-1/3].map(e=>Math.round(l(i,r,e)*255)))}function l(e,t,n){let r=n;return r<0&&(r+=1),r>1&&--r,r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}export{e as RAMP_STEPS,i as deriveRamp};
|