@webority/tokens 0.102.0 → 0.102.2

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.
@@ -2,7 +2,7 @@
2
2
  "format": "webority-theme-tokens/2",
3
3
  "source": {
4
4
  "package": "@webority/tokens",
5
- "version": "0.102.0",
5
+ "version": "0.102.2",
6
6
  "brand": null,
7
7
  "platform": "phone",
8
8
  "width": null
@@ -2,7 +2,7 @@
2
2
  "format": "webority-theme-tokens/2",
3
3
  "source": {
4
4
  "package": "@webority/tokens",
5
- "version": "0.102.0",
5
+ "version": "0.102.2",
6
6
  "brand": null,
7
7
  "platform": "web",
8
8
  "width": 390
@@ -2,7 +2,7 @@
2
2
  "format": "webority-theme-tokens/2",
3
3
  "source": {
4
4
  "package": "@webority/tokens",
5
- "version": "0.102.0",
5
+ "version": "0.102.2",
6
6
  "brand": null,
7
7
  "platform": "web",
8
8
  "width": 1440
package/dist/emit/web.js CHANGED
@@ -3,18 +3,18 @@ import{BREAKPOINT_PX as e,TOUCH_MEDIA as t,breakpointRules as n,fluidLength as r
3
3
  [data-bs-theme="dark"]:not(:root)`,v=`:root[data-theme="auto"]`,y=`[data-theme="dark"]:not(:root) [data-theme="light"],
4
4
  [data-theme="dark"]:not(:root) [data-bs-theme="light"],
5
5
  [data-bs-theme="dark"]:not(:root) [data-theme="light"],
6
- [data-bs-theme="dark"]:not(:root) [data-bs-theme="light"]`,b=`// var() resolves where a name is declared, so the html copies keep the light values for a light box.`,x=`/* var() resolves where a name is declared, so the html copies keep the light values for a light box. */`,S=`// Zero specificity, so a component's own class on a themed section or inside it keeps its colour.`,C=`/* Zero specificity, so a component's own class on a themed section or inside it keeps its colour. */`;function w(e){return String(Number(e.toFixed(4)))}function T(e,t){if(typeof t==`string`)return t.replace(l,(e,t)=>`var(${a(t)})`);if(typeof t==`number`)return w(t);if(Array.isArray(t)){if(e.type===`cubicBezier`&&t.length===4&&t.every(e=>typeof e==`number`))return`cubic-bezier(${t.map(e=>w(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`${w(t.value)}${t.unit}`;if(`color`in t)return[t.offsetX,t.offsetY,t.blur,t.spread,t.color].map(t=>T(e,t)).join(` `)}throw Error(`emitWeb: ${e.path}: cannot write a ${e.type} value as CSS.`)}function E(e,t,n){return T(e.tokens.get(t),e.valueIn(t,n))}function D(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 O(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=D(t,e.valueIn(t,c)),l=D(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:E(e,t,c),tiers:l.map(e=>({tier:e.tier,text:T(i,e.value)}))}:{path:t,name:s,root:E(e,t,o),tiers:[]}}function k(e){let t=[];for(let n of e.tokens.keys())e.existsIn(n,o)&&t.push(O(e,n));return t}function A(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=E(e,i,s);if(c.group===`text`){if(l!==E(e,i,o))throw Error(`emitWeb: ${i}: a text size cannot change with the mode.`);continue}t(i,l)&&r.push({path:i,name:a(i),text:l})}return r}function j(e){let t=Number.parseInt(e.slice(1),16);return`${t>>16&255}, ${t>>8&255}, ${t&255}`}function M(e,t){let n=[];for(let[r,i]of p){let a=`color.${i}`,o=e.resolvedIn(a,s);if(!d.test(o))throw Error(`emitWeb: ${a}: a Bootstrap rgb triplet needs an opaque colour.`);t(a,o)&&n.push({name:r,text:j(o)})}return n}function N(e,t){let n=A(e,t?(e,n)=>!t.tokens.has(e)||!t.existsIn(e,s)||n!==E(t,e,s):(t,n)=>n!==E(e,t,o)),r=M(e,t?(e,n)=>n!==t.resolvedIn(e,s):()=>!0);if(t)return[...n,...r];let i=f.map(([e,t])=>({name:e,text:`var(${a(`color.${t}`)})`}));return[...n,...i,...r]}function P(e,t){return`${e} {\n${t.join(`
6
+ [data-bs-theme="dark"]:not(:root) [data-bs-theme="light"]`,b=`// var() resolves where a name is declared, so the html copies keep the light values for a light box.`,x=`/* var() resolves where a name is declared, so the html copies keep the light values for a light box. */`,S=`// Zero specificity, so a component's own class on a themed section or inside it keeps its colour.`,C=`/* Zero specificity, so a component's own class on a themed section or inside it keeps its colour. */`;function w(e){return String(Number(e.toFixed(4)))}function T(e,t){if(typeof t==`string`)return t.replace(l,(e,t)=>`var(${a(t)})`);if(typeof t==`number`)return w(t);if(Array.isArray(t)){if(e.type===`cubicBezier`&&t.length===4&&t.every(e=>typeof e==`number`))return`cubic-bezier(${t.map(e=>w(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`${w(t.value)}${t.unit}`;if(`color`in t)return[t.offsetX,t.offsetY,t.blur,t.spread,t.color].map(t=>T(e,t)).join(` `)}throw Error(`emitWeb: ${e.path}: cannot write a ${e.type} value as CSS.`)}function E(e,t,n){return T(e.tokens.get(t),e.valueIn(t,n))}function D(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 O(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=D(t,e.valueIn(t,c)),l=D(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:E(e,t,c),tiers:l.map(e=>({tier:e.tier,text:T(i,e.value)}))}:{path:t,name:s,root:E(e,t,o),tiers:[]}}function k(e){let t=[];for(let n of e.tokens.keys())e.existsIn(n,o)&&t.push(O(e,n));return t}function A(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=E(e,i,s);if(c.group===`text`){if(l!==E(e,i,o))throw Error(`emitWeb: ${i}: a text size cannot change with the mode.`);continue}t(i,l)&&r.push({path:i,name:a(i),text:l})}return r}function j(e){let t=Number.parseInt(e.slice(1),16);return`${t>>16&255}, ${t>>8&255}, ${t&255}`}function M(e,t){let n=[];for(let[r,i]of p){let a=`color.${i}`,o=e.resolvedIn(a,s);if(!d.test(o))throw Error(`emitWeb: ${a}: a Bootstrap rgb triplet needs an opaque colour.`);t(a,o)&&n.push({name:r,text:j(o)})}return n}function N(e,t,n){return!e.tokens.has(`color.primary`)||!t.tokens.has(`color.primary`)||e.resolvedIn(`color.primary`,n)===t.resolvedIn(`color.primary`,n)?[]:P(e,n)}function P(e,t){let n=e.resolvedIn(`color.primary`,t);if(!d.test(n))throw Error(`emitWeb: color.primary: a Bootstrap rgb triplet needs an opaque colour.`);return[{name:`--bs-primary`,text:n},{name:`--bs-primary-rgb`,text:j(n)}]}function F(e,t){let n=A(e,t?(e,n)=>!t.tokens.has(e)||!t.existsIn(e,s)||n!==E(t,e,s):(t,n)=>n!==E(e,t,o)),r=M(e,t?(e,n)=>n!==t.resolvedIn(e,s):()=>!0);if(t){let i=N(e,t,o).length>0?P(e,s):N(e,t,s);return[...n,...r,...i]}let i=f.map(([e,t])=>({name:e,text:`var(${a(`color.${t}`)})`}));return[...n,...i,...r]}function I(e,t){return`${e} {\n${t.join(`
7
7
  `).split(`
8
8
  `).map(e=>e===``?e:` ${e}`).join(`
9
- `)}\n}`}function F(e){return e.split(`,
9
+ `)}\n}`}function L(e){return e.split(`,
10
10
  `).map(e=>`:where(${e})`).join(`,
11
- `)}function I(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);`,b,P(`html`,[`@each $name in $wui-dark-layer-names {`,` --wui-light-#{$name}: var(--#{$name});`,`}`]),P(y,[`@each $name in $wui-dark-layer-names {`,` --#{$name}: var(--wui-light-#{$name});`,`}`]),P(F(y),[`color-scheme: light;`,`color: var(--color-text);`])].join(`
11
+ `)}function R(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);`,b,I(`html`,[`@each $name in $wui-dark-layer-names {`,` --wui-light-#{$name}: var(--#{$name});`,`}`]),I(y,[`@each $name in $wui-dark-layer-names {`,` --#{$name}: var(--wui-light-#{$name});`,`}`]),I(L(y),[`color-scheme: light;`,`color: var(--color-text);`])].join(`
13
13
 
14
- `)}function L(e){return[x,P(`html`,e.map(e=>`--wui-light-${e}: var(--${e});`)),P(y,e.map(e=>`--${e}: var(--wui-light-${e});`)),P(F(y),[`color-scheme: light;`,`color: var(--color-text);`])].join(`
14
+ `)}function z(e){return[x,I(`html`,e.map(e=>`--wui-light-${e}: var(--${e});`)),I(y,e.map(e=>`--${e}: var(--wui-light-${e});`)),I(L(y),[`color-scheme: light;`,`color: var(--color-text);`])].join(`
15
15
 
16
- `)}function R(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=k(n),o=new Map((r?k(r):[]).map(e=>[e.path,e])),s=[],c=a.filter(e=>o.get(e.path)?.root!==e.root).map(e=>`${e.name}: ${e.root};`);c.length>0&&s.push(P(`:root`,c));for(let[t,n]of Object.entries(e)){let e=[];for(let n of a)for(let r of n.tiers)r.tier===t&&o.get(n.path)?.tiers.find(e=>e.tier===t)?.text!==r.text&&e.push(`${n.name}: ${r.text};`);e.length>0&&s.push(P(`@media (min-width: ${n}px)`,[P(`:root`,e)]))}let l=[];for(let e of a){let t=n.tokens.get(e.path),a=i(t);if(a===null)continue;let o=T(t,a),s=r?.tokens.get(e.path),c=s?i(s):null;c!==null&&T(s,c)===o||l.push(`${e.name}: ${o};`)}l.length>0&&s.push(P(`@media ${t}`,[P(`:root`,l)]));let u=N(n,r);if(u.length>0){let e=u.map(e=>`${e.name}: ${e.text};`),t=r?C:S;s.push(P(g,[...e,`color-scheme: dark;`]),P(_,e),`${t}\n${P(F(_),[`color-scheme: dark;`,`color: var(--color-text);`])}`);let n=u.map(e=>e.name.slice(2));if(r){let e=new Set(N(r,null).map(e=>e.name.slice(2))),t=n.filter(t=>!e.has(t));t.length>0&&s.push(L(t))}else s.push(I(n));s.push(P(`@media (prefers-color-scheme: dark)`,[P(v,[...e,`color-scheme: dark;`])]))}return`${[R(n,r!==null,r!==null),...s].join(`
16
+ `)}function B(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 V(n,r){let a=k(n),s=new Map((r?k(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(...N(n,r,o).map(e=>`${e.name}: ${e.text};`)),l.length>0&&c.push(I(`: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(I(`@media (min-width: ${n}px)`,[I(`: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=T(t,a),s=r?.tokens.get(e.path),c=s?i(s):null;c!==null&&T(s,c)===o||u.push(`${e.name}: ${o};`)}u.length>0&&c.push(I(`@media ${t}`,[I(`:root`,u)]));let d=F(n,r);if(d.length>0){let e=d.map(e=>`${e.name}: ${e.text};`),t=r?C:S;c.push(I(g,[...e,`color-scheme: dark;`]),I(_,e),`${t}\n${I(L(_),[`color-scheme: dark;`,`color: var(--color-text);`])}`);let n=d.map(e=>e.name.slice(2));if(r){let e=new Set(F(r,null).map(e=>e.name.slice(2))),t=n.filter(t=>!e.has(t));t.length>0&&c.push(z(t))}else c.push(R(n));c.push(I(`@media (prefers-color-scheme: dark)`,[I(v,[...e,`color-scheme: dark;`])]))}return`${[B(n,r!==null,r!==null),...c].join(`
17
17
 
18
- `)}\n`}function B(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 B(e,i[1]);let a=T(n,r);if(a.includes(`var(`))throw Error(`emitWeb: ${t}: a Bootstrap variable needs a literal.`);return a}function V(e,t,n){return n===null?h[t]:B(e,n)}function H(e){let t=m.map(([t,n])=>`${t}: ${V(e,t,n)} !default;`);return`${[R(e,!1),...t].join(`
19
- `)}\n`}function U(e,t){let n=m.filter(([n,r])=>V(e,n,r)!==V(t,n,r)).map(([t,n])=>`${t}: ${V(e,t,n)};`);return`${[R(e,!0),...n].join(`
20
- `)}\n`}function W(e,t){return t===void 0?{tokens:z(e,null),bootstrap:H(e)}:{css:z(e,t.library),variables:U(e,t.library)}}export{W as emitWeb};
18
+ `)}\n`}function H(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 H(e,i[1]);let a=T(n,r);if(a.includes(`var(`))throw Error(`emitWeb: ${t}: a Bootstrap variable needs a literal.`);return a}function U(e,t,n){return n===null?h[t]:H(e,n)}function W(e){let t=m.map(([t,n])=>`${t}: ${U(e,t,n)} !default;`);return`${[B(e,!1),...t].join(`
19
+ `)}\n`}function G(e,t){let n=m.filter(([n,r])=>U(e,n,r)!==U(t,n,r)).map(([t,n])=>`${t}: ${U(e,t,n)};`);return`${[B(e,!0),...n].join(`
20
+ `)}\n`}function K(e,t){return t===void 0?{tokens:V(e,null),bootstrap:W(e)}:{css:V(e,t.library),variables:G(e,t.library)}}export{K as emitWeb};
@@ -2,7 +2,7 @@
2
2
  "format": "webority-meanings/1",
3
3
  "source": {
4
4
  "package": "@webority/tokens",
5
- "version": "0.102.0"
5
+ "version": "0.102.2"
6
6
  },
7
7
  "color": {
8
8
  "bg": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/tokens",
3
- "version": "0.102.0",
3
+ "version": "0.102.2",
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",