@webority/tokens 0.146.2 → 0.148.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 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{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(`
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 one of: ${Object.keys(n).join(`, `)}`),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
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.146.2",
5
+ "version": "0.148.0",
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.146.2",
5
+ "version": "0.148.0",
6
6
  "brand": null,
7
7
  "platform": "web",
8
8
  "width": 390
@@ -151,16 +151,16 @@
151
151
  "text-muted": "#b4b9c6",
152
152
  "text-subtle": "#8a90a0",
153
153
  "text-inverse": "#071437",
154
- "link": "#9590ef",
155
- "border": "#2a2f3a",
156
- "border-subtle": "#2a2f3a80",
157
- "border-strong": "#3a414f",
154
+ "link": "#aeaaf5",
155
+ "border": "#3d4554",
156
+ "border-subtle": "#3d455480",
157
+ "border-strong": "#515b6e",
158
158
  "field-bg": "#232733",
159
- "field-border": "#2a2f3a",
160
- "field-border-hover": "#3a414f",
161
- "field-border-focus": "#9590ef",
162
- "focus-ring": "#9590ef",
163
- "focus-ring-soft": "#9590ef40",
159
+ "field-border": "#3d4554",
160
+ "field-border-hover": "#515b6e",
161
+ "field-border-focus": "#aeaaf5",
162
+ "focus-ring": "#aeaaf5",
163
+ "focus-ring-soft": "#aeaaf540",
164
164
  "scrim": "#00000073",
165
165
  "scrim-strong": "#0000009e",
166
166
  "on-scrim": "#ffffff",
@@ -170,13 +170,13 @@
170
170
  "scrollbar": "#ffffff2e",
171
171
  "scrollbar-hover": "#ffffff47",
172
172
  "scrollbar-active": "#ffffff66",
173
- "primary": "#9590ef",
174
- "primary-hover": "#a29df1",
173
+ "primary": "#aeaaf5",
174
+ "primary-hover": "#c3c0f8",
175
175
  "primary-soft": "#4f46e533",
176
- "primary-text": "#9590ef",
176
+ "primary-text": "#aeaaf5",
177
177
  "on-primary": "#0f0f0f",
178
- "primary-wash": "#9590ef14",
179
- "primary-wash-strong": "#9590ef33",
178
+ "primary-wash": "#aeaaf514",
179
+ "primary-wash-strong": "#aeaaf533",
180
180
  "neutral": "#e6e8ee14",
181
181
  "neutral-hover": "#e6e8ee1f",
182
182
  "neutral-pressed": "#e6e8ee29",
@@ -223,7 +223,7 @@
223
223
  "info-strong": "#4492ef",
224
224
  "on-info": "#0f0f1a",
225
225
  "on-info-strong": "#0f0f0f",
226
- "chart-1": "#9590ef",
226
+ "chart-1": "#aeaaf5",
227
227
  "chart-2": "#d95926",
228
228
  "chart-3": "#199e70",
229
229
  "chart-4": "#c98500",
@@ -242,8 +242,8 @@
242
242
  "chart-diverging-mid": "#3a414f",
243
243
  "chart-diverging-high": "#3987e5",
244
244
  "chart-neutral": "#5d6475",
245
- "chart-grid": "#2a2f3a",
246
- "chart-axis": "#3a414f",
245
+ "chart-grid": "#3d4554",
246
+ "chart-axis": "#515b6e",
247
247
  "chart-label": "#8a90a0"
248
248
  }
249
249
  },
@@ -374,16 +374,22 @@
374
374
  "base": {},
375
375
  "sizes": {
376
376
  "sm": {
377
- "radius": "10px"
377
+ "radius": "8px"
378
378
  },
379
379
  "md": {
380
- "radius": "10px"
380
+ "radius": "8px"
381
381
  },
382
382
  "lg": {
383
- "radius": "10px"
383
+ "radius": "8px"
384
384
  }
385
385
  }
386
386
  },
387
+ "label": {
388
+ "base": {
389
+ "fs": "11px"
390
+ },
391
+ "sizes": {}
392
+ },
387
393
  "focus-ring": {
388
394
  "base": {
389
395
  "width": "2px",
@@ -414,12 +420,18 @@
414
420
  "title-fs": "16px",
415
421
  "title-lh": "1.3",
416
422
  "shadow-lifted": "none",
417
- "shadow-lifted-hover": "none"
423
+ "shadow-lifted-hover": "none",
424
+ "radius": "8px",
425
+ "border-width": "1px"
418
426
  },
419
427
  "sizes": {}
420
428
  },
421
429
  "table": {
422
- "base": {},
430
+ "base": {
431
+ "row-height": "72px",
432
+ "row-pad-y": "18px",
433
+ "row-divider-width": "0px"
434
+ },
423
435
  "sizes": {
424
436
  "md": {
425
437
  "padding-x": "20px"
@@ -446,7 +458,7 @@
446
458
  },
447
459
  "kpi": {
448
460
  "base": {
449
- "value-size": "24px"
461
+ "value-size": "20px"
450
462
  },
451
463
  "sizes": {}
452
464
  },
@@ -470,11 +482,31 @@
470
482
  },
471
483
  "sizes": {}
472
484
  },
485
+ "button": {
486
+ "base": {},
487
+ "sizes": {
488
+ "sm": {
489
+ "radius": "8px"
490
+ },
491
+ "md": {
492
+ "radius": "8px"
493
+ },
494
+ "lg": {
495
+ "radius": "8px"
496
+ }
497
+ }
498
+ },
473
499
  "toast": {
474
500
  "base": {
475
501
  "edge-offset": "16px"
476
502
  },
477
503
  "sizes": {}
504
+ },
505
+ "page-header": {
506
+ "base": {
507
+ "title-fs": "20px"
508
+ },
509
+ "sizes": {}
478
510
  }
479
511
  }
480
512
  }
@@ -2,7 +2,7 @@
2
2
  "format": "webority-theme-tokens/2",
3
3
  "source": {
4
4
  "package": "@webority/tokens",
5
- "version": "0.146.2",
5
+ "version": "0.148.0",
6
6
  "brand": null,
7
7
  "platform": "web",
8
8
  "width": 1440
@@ -151,16 +151,16 @@
151
151
  "text-muted": "#b4b9c6",
152
152
  "text-subtle": "#8a90a0",
153
153
  "text-inverse": "#071437",
154
- "link": "#9590ef",
155
- "border": "#2a2f3a",
156
- "border-subtle": "#2a2f3a80",
157
- "border-strong": "#3a414f",
154
+ "link": "#aeaaf5",
155
+ "border": "#3d4554",
156
+ "border-subtle": "#3d455480",
157
+ "border-strong": "#515b6e",
158
158
  "field-bg": "#232733",
159
- "field-border": "#2a2f3a",
160
- "field-border-hover": "#3a414f",
161
- "field-border-focus": "#9590ef",
162
- "focus-ring": "#9590ef",
163
- "focus-ring-soft": "#9590ef40",
159
+ "field-border": "#3d4554",
160
+ "field-border-hover": "#515b6e",
161
+ "field-border-focus": "#aeaaf5",
162
+ "focus-ring": "#aeaaf5",
163
+ "focus-ring-soft": "#aeaaf540",
164
164
  "scrim": "#00000073",
165
165
  "scrim-strong": "#0000009e",
166
166
  "on-scrim": "#ffffff",
@@ -170,13 +170,13 @@
170
170
  "scrollbar": "#ffffff2e",
171
171
  "scrollbar-hover": "#ffffff47",
172
172
  "scrollbar-active": "#ffffff66",
173
- "primary": "#9590ef",
174
- "primary-hover": "#a29df1",
173
+ "primary": "#aeaaf5",
174
+ "primary-hover": "#c3c0f8",
175
175
  "primary-soft": "#4f46e533",
176
- "primary-text": "#9590ef",
176
+ "primary-text": "#aeaaf5",
177
177
  "on-primary": "#0f0f0f",
178
- "primary-wash": "#9590ef14",
179
- "primary-wash-strong": "#9590ef33",
178
+ "primary-wash": "#aeaaf514",
179
+ "primary-wash-strong": "#aeaaf533",
180
180
  "neutral": "#e6e8ee14",
181
181
  "neutral-hover": "#e6e8ee1f",
182
182
  "neutral-pressed": "#e6e8ee29",
@@ -223,7 +223,7 @@
223
223
  "info-strong": "#4492ef",
224
224
  "on-info": "#0f0f1a",
225
225
  "on-info-strong": "#0f0f0f",
226
- "chart-1": "#9590ef",
226
+ "chart-1": "#aeaaf5",
227
227
  "chart-2": "#d95926",
228
228
  "chart-3": "#199e70",
229
229
  "chart-4": "#c98500",
@@ -242,8 +242,8 @@
242
242
  "chart-diverging-mid": "#3a414f",
243
243
  "chart-diverging-high": "#3987e5",
244
244
  "chart-neutral": "#5d6475",
245
- "chart-grid": "#2a2f3a",
246
- "chart-axis": "#3a414f",
245
+ "chart-grid": "#3d4554",
246
+ "chart-axis": "#515b6e",
247
247
  "chart-label": "#8a90a0"
248
248
  }
249
249
  },
@@ -374,16 +374,22 @@
374
374
  "base": {},
375
375
  "sizes": {
376
376
  "sm": {
377
- "radius": "10px"
377
+ "radius": "8px"
378
378
  },
379
379
  "md": {
380
- "radius": "10px"
380
+ "radius": "8px"
381
381
  },
382
382
  "lg": {
383
- "radius": "10px"
383
+ "radius": "8px"
384
384
  }
385
385
  }
386
386
  },
387
+ "label": {
388
+ "base": {
389
+ "fs": "11px"
390
+ },
391
+ "sizes": {}
392
+ },
387
393
  "focus-ring": {
388
394
  "base": {
389
395
  "width": "2px",
@@ -414,12 +420,18 @@
414
420
  "title-fs": "16px",
415
421
  "title-lh": "1.3",
416
422
  "shadow-lifted": "none",
417
- "shadow-lifted-hover": "none"
423
+ "shadow-lifted-hover": "none",
424
+ "radius": "8px",
425
+ "border-width": "1px"
418
426
  },
419
427
  "sizes": {}
420
428
  },
421
429
  "table": {
422
- "base": {},
430
+ "base": {
431
+ "row-height": "72px",
432
+ "row-pad-y": "18px",
433
+ "row-divider-width": "0px"
434
+ },
423
435
  "sizes": {
424
436
  "md": {
425
437
  "padding-x": "20px"
@@ -446,7 +458,7 @@
446
458
  },
447
459
  "kpi": {
448
460
  "base": {
449
- "value-size": "24px"
461
+ "value-size": "20px"
450
462
  },
451
463
  "sizes": {}
452
464
  },
@@ -470,11 +482,31 @@
470
482
  },
471
483
  "sizes": {}
472
484
  },
485
+ "button": {
486
+ "base": {},
487
+ "sizes": {
488
+ "sm": {
489
+ "radius": "8px"
490
+ },
491
+ "md": {
492
+ "radius": "8px"
493
+ },
494
+ "lg": {
495
+ "radius": "8px"
496
+ }
497
+ }
498
+ },
473
499
  "toast": {
474
500
  "base": {
475
501
  "edge-offset": "16px"
476
502
  },
477
503
  "sizes": {}
504
+ },
505
+ "page-header": {
506
+ "base": {
507
+ "title-fs": "20px"
508
+ },
509
+ "sizes": {}
478
510
  }
479
511
  }
480
512
  }
@@ -2,7 +2,7 @@
2
2
  "format": "webority-meanings/1",
3
3
  "source": {
4
4
  "package": "@webority/tokens",
5
- "version": "0.146.2"
5
+ "version": "0.148.0"
6
6
  },
7
7
  "color": {
8
8
  "bg": {
@@ -4,7 +4,7 @@
4
4
  "sm": {
5
5
  "radius": {
6
6
  "$type": "dimension",
7
- "$value": "{radius.md}"
7
+ "$value": "{radius.sm}"
8
8
  },
9
9
  "padding-x": {
10
10
  "$type": "dimension",
@@ -97,7 +97,7 @@
97
97
  "md": {
98
98
  "radius": {
99
99
  "$type": "dimension",
100
- "$value": "{radius.md}"
100
+ "$value": "{radius.sm}"
101
101
  },
102
102
  "padding-x": {
103
103
  "$type": "dimension",
@@ -190,7 +190,7 @@
190
190
  "lg": {
191
191
  "radius": {
192
192
  "$type": "dimension",
193
- "$value": "{radius.md}"
193
+ "$value": "{radius.sm}"
194
194
  },
195
195
  "padding-x": {
196
196
  "$type": "dimension",
@@ -281,6 +281,21 @@
281
281
  }
282
282
  }
283
283
  },
284
+ "label": {
285
+ "$extensions": {
286
+ "com.webority": {
287
+ "platforms": ["web"]
288
+ }
289
+ },
290
+ "fs": {
291
+ "$type": "dimension",
292
+ "$value": {
293
+ "value": 11,
294
+ "unit": "px"
295
+ },
296
+ "$description": "Font size of a small label on the web: a form label, a KPI label, a detail label."
297
+ }
298
+ },
284
299
  "focus-ring": {
285
300
  "$extensions": {
286
301
  "com.webority": {
@@ -381,6 +396,19 @@
381
396
  "shadow-lifted-hover": {
382
397
  "$type": "shadow",
383
398
  "$value": "none"
399
+ },
400
+ "radius": {
401
+ "$type": "dimension",
402
+ "$value": "{radius.sm}",
403
+ "$description": "Corner radius of a card."
404
+ },
405
+ "border-width": {
406
+ "$type": "dimension",
407
+ "$value": {
408
+ "value": 1,
409
+ "unit": "px"
410
+ },
411
+ "$description": "Width of a card outline; 1px draws a hairline, 0px a borderless surface."
384
412
  }
385
413
  },
386
414
  "table": {
@@ -394,6 +422,30 @@
394
422
  "$type": "dimension",
395
423
  "$value": "{size.table-pad}"
396
424
  }
425
+ },
426
+ "row-height": {
427
+ "$type": "dimension",
428
+ "$value": {
429
+ "value": 72,
430
+ "unit": "px"
431
+ },
432
+ "$description": "Height of a ledger table body row."
433
+ },
434
+ "row-pad-y": {
435
+ "$type": "dimension",
436
+ "$value": {
437
+ "value": 18,
438
+ "unit": "px"
439
+ },
440
+ "$description": "Vertical padding of a ledger table body cell."
441
+ },
442
+ "row-divider-width": {
443
+ "$type": "dimension",
444
+ "$value": {
445
+ "value": 0,
446
+ "unit": "px"
447
+ },
448
+ "$description": "Width of the line between table body rows; 0px draws none."
397
449
  }
398
450
  },
399
451
  "modal": {
@@ -447,7 +499,7 @@
447
499
  "value-size": {
448
500
  "$type": "dimension",
449
501
  "$value": {
450
- "value": 24,
502
+ "value": 20,
451
503
  "unit": "px"
452
504
  },
453
505
  "$description": "Font size of the main figure in a KPI tile."
@@ -551,7 +603,12 @@
551
603
  },
552
604
  "radius": {
553
605
  "$type": "dimension",
554
- "$value": "{radius.md}"
606
+ "$value": "{radius.sm}",
607
+ "$extensions": {
608
+ "com.webority": {
609
+ "platforms": ["web", "phone"]
610
+ }
611
+ }
555
612
  },
556
613
  "icon": {
557
614
  "$type": "dimension",
@@ -590,7 +647,12 @@
590
647
  },
591
648
  "radius": {
592
649
  "$type": "dimension",
593
- "$value": "{radius.md}"
650
+ "$value": "{radius.sm}",
651
+ "$extensions": {
652
+ "com.webority": {
653
+ "platforms": ["web", "phone"]
654
+ }
655
+ }
594
656
  },
595
657
  "icon": {
596
658
  "$type": "dimension",
@@ -629,7 +691,12 @@
629
691
  },
630
692
  "radius": {
631
693
  "$type": "dimension",
632
- "$value": "{radius.lg}"
694
+ "$value": "{radius.sm}",
695
+ "$extensions": {
696
+ "com.webority": {
697
+ "platforms": ["web", "phone"]
698
+ }
699
+ }
633
700
  },
634
701
  "icon": {
635
702
  "$type": "dimension",
@@ -1804,6 +1871,21 @@
1804
1871
  "$value": "{space.lg}",
1805
1872
  "$description": "Side margin of a page's content and footer."
1806
1873
  }
1874
+ },
1875
+ "page-header": {
1876
+ "$extensions": {
1877
+ "com.webority": {
1878
+ "platforms": ["web"]
1879
+ }
1880
+ },
1881
+ "title-fs": {
1882
+ "$type": "dimension",
1883
+ "$value": {
1884
+ "value": 20,
1885
+ "unit": "px"
1886
+ },
1887
+ "$description": "Font size of a page title."
1888
+ }
1807
1889
  }
1808
1890
  }
1809
1891
  }
@@ -533,22 +533,22 @@
533
533
  },
534
534
  "dark-border": {
535
535
  "$type": "color",
536
- "$value": "#2a2f3a",
536
+ "$value": "#3d4554",
537
537
  "$description": "Dark hairline border of cards, tables and dividers."
538
538
  },
539
539
  "dark-border-strong": {
540
540
  "$type": "color",
541
- "$value": "#3a414f",
541
+ "$value": "#515b6e",
542
542
  "$description": "Stronger dark border for emphasised separators."
543
543
  },
544
544
  "dark-field-border": {
545
545
  "$type": "color",
546
- "$value": "#2a2f3a",
546
+ "$value": "#3d4554",
547
547
  "$description": "Resting border of input-like controls in dark mode."
548
548
  },
549
549
  "dark-field-border-hover": {
550
550
  "$type": "color",
551
- "$value": "#3a414f",
551
+ "$value": "#515b6e",
552
552
  "$description": "Hover border of input-like controls in dark mode."
553
553
  },
554
554
  "dark-progress-track": {
@@ -573,12 +573,12 @@
573
573
  },
574
574
  "dark-primary": {
575
575
  "$type": "color",
576
- "$value": "#9590ef",
576
+ "$value": "#aeaaf5",
577
577
  "$description": "Primary as text, rings, focus borders and the fill under dark ink in dark mode."
578
578
  },
579
579
  "dark-primary-hover": {
580
580
  "$type": "color",
581
- "$value": "#a29df1",
581
+ "$value": "#c3c0f8",
582
582
  "$description": "Primary fill while it is hovered in dark mode."
583
583
  },
584
584
  "dark-ai-violet": {
@@ -374,6 +374,23 @@
374
374
  }
375
375
  },
376
376
  "component": {
377
+ "button": {
378
+ "sm": {
379
+ "radius": {
380
+ "$value": "{radius.md}"
381
+ }
382
+ },
383
+ "md": {
384
+ "radius": {
385
+ "$value": "{radius.md}"
386
+ }
387
+ },
388
+ "lg": {
389
+ "radius": {
390
+ "$value": "{radius.lg}"
391
+ }
392
+ }
393
+ },
377
394
  "field": {
378
395
  "sm": {
379
396
  "radius": {
@@ -335,11 +335,6 @@
335
335
  "unit": "px"
336
336
  },
337
337
  "$description": "Wider letter spacing for small caps labels."
338
- },
339
- "$extensions": {
340
- "com.webority": {
341
- "platforms": ["phone"]
342
- }
343
338
  }
344
339
  },
345
340
  "font": {
@@ -1,5 +1,5 @@
1
- import{brand as e}from"../build.js";import{applyClasses as t}from"./classes.js";import{applyComponents as n}from"./components.js";import{applyCssTable as r,isCssTarget as i,ownDeclarations as a}from"./css.js";import{applyRazorAttributes as o}from"./razorAttributes.js";import{applyRazorTags as s}from"./razorTags.js";import{applyRazorValueSplits as c}from"./razorValueSplits.js";import{applyMarkup as l,applySource as u}from"./source.js";import{applyComponentProps as d,applyPropSplits as f,applyPropValues as p,applyProps as m,applyThemeReads as h}from"./themeReads.js";import{applyValueSplits as g}from"./valueSplits.js";import{applyWrapperValues as _,findWrappers as v}from"./wrapperValues.js";import{createRequire as y}from"node:module";import{existsSync as b,readFileSync as x,readdirSync as S,realpathSync as C,writeFileSync as w}from"node:fs";import{dirname as T,isAbsolute as E,join as D,relative as O,resolve as k,sep as A}from"node:path";import{fileURLToPath as j,pathToFileURL as M}from"node:url";import{spawnSync as N}from"node:child_process";var P=/^\d+\.\d+\.\d+$/,F=/^(?:workspace:|file:|link:)/,I=`WEBORITY_UPGRADE_FROM`;function L(e){if(typeof e!=`string`||!P.test(e))throw Error(`invalid version "${e}"`)}function R(e,t){L(e),L(t);let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<3;e++)if(n[e]!==r[e])return n[e]-r[e];return 0}function z(){let e=T(j(import.meta.url));for(;;){let t=D(e,`package.json`);if(b(t)&&JSON.parse(x(t,`utf8`)).name===`@webority/tokens`)return e;let n=T(e);if(n===e)throw Error(`cannot find the @webority/tokens package folder`);e=n}}function B(){return JSON.parse(x(D(z(),`package.json`),`utf8`)).version}function V(e){let t=[];for(let n of S(e)){if(!n.endsWith(`.json`))continue;let r=n.slice(0,-5);P.test(r)&&t.push({version:r,table:JSON.parse(x(D(e,n),`utf8`))})}return t.sort((e,t)=>R(e.version,t.version))}function H(e,t){let n=N(`git`,[`ls-files`,`-z`,`--`,...t],{cwd:e,encoding:`utf8`,windowsHide:!0,maxBuffer:67108864});if(n.status!==0)throw Error(`not a git repository: ${e}`);let r=n.stdout.split(`\0`).filter(Boolean).map(e=>e.split(`\\`).join(`/`)).filter(t=>b(D(e,t)));return[...new Set(r)]}function U(e,t){let n=H(e,t??[`.`]);if(t!==void 0&&n.length===0)throw Error(`no tracked files under ${t.join(`, `)}`);return n}function W(e){return e.split(`/`).includes(`node_modules`)}var G=new Set([`node_modules`,`vendor`,`vendors`,`external`]),K=/\.(?:min|bundle)\.(?:js|css)$/;function q(e){let t=e.split(`/`);return t.some(e=>G.has(e))||t.some((e,n)=>e===`lib`&&t[n-1]===`wwwroot`)?!0:K.test(e)}function J(e,t){return[...new Set([...e,...t])]}function Y(e,t,n){return V(e).filter(e=>R(e.version,t)>0&&R(e.version,n)<=0).map(e=>e.table)}function X(e,t){let n=Object.entries(t);if(n.length===0)return e;let r=(e,t)=>e.flatMap(e=>[e,...n.filter(([,n])=>e[t]===n).map(([n])=>({...e,[t]:n}))]),i={...e};for(let t of[`props`,`componentProps`,`propValues`,`propSplits`,`valueSplits`,`components`])e[t]!==void 0&&(i[t]=r(e[t],`package`));return e.source!==void 0&&(i.source={...e.source,flags:r(e.source.flags,`importedFrom`)}),i}function Z(e,y,b,S,C,T={}){S&&C(`dry run: nothing written`);let E=b.map(e=>X(e,T)),O=[],k=[],A=[],j=y.filter(e=>i(e)&&!q(e)),M=E.map(()=>new Set);if(E.some(e=>(e.css.ownable??[]).length>0))for(let t of j){let n=x(D(e,t),`utf8`);E.forEach((e,r)=>{for(let i of a(n,t,e))M[r].add(i)})}let N=H(e,[`package.json`,`:(glob)**/package.json`]).filter(e=>!W(e)),P=new Map,F=E.map(t=>v(e,[...j,...N],t,P));for(let i of j){let a=x(D(e,i),`utf8`),v=a,y=e=>{for(let t of e)t.from!==t.to&&(O.push({file:i,line:t.line,from:t.from,to:t.to}),C(`${i}:${t.line} ${t.from} -> ${t.to}`))},b=e=>{k.push({file:i,line:e.line,name:e.name,hint:e.hint}),C(`choose ${i}:${e.line} ${e.name}: ${e.hint}`)},T=e=>{for(let t of e)t.message.startsWith(`skipped, it does not parse`)?C(`skipped ${i}: ${t.message}`):b({line:t.line,name:t.path,hint:t.message})};for(let[e,a]of E.entries()){let x=r(v,i,a,M[e]);v=x.text,y(x.hits);for(let e of x.choose)b(e);for(let e of x.checkRole)C(`verify ${i}:${e.line} ${e.from} -> ${e.to}`);let S=h(v,i,a.themeReads);v=S.text,y(S.hits),T(S.findings);let w=[t=>_(t,i,F[e]),e=>m(e,i,a.props),e=>d(e,i,a.componentProps),e=>p(e,i,a.propValues),e=>g(e,i,a.valueSplits??[]),e=>f(e,i,a.propSplits),e=>o(e,i,a.razorAttributes),e=>n(e,i,a.components??[]),e=>s(e,i,a.razorTags??[]),e=>c(e,i,a.razorValueSplits??[]),e=>t(e,i,a.classes??[]),e=>l(e,i,a.markup),e=>u(e,i,a.source)];for(let e of w){let t=e(v);v=t.text,y(t.hits),T(t.findings)}}v!==a&&(A.push(i),S||w(D(e,i),v,`utf8`))}return{hits:O,choose:k,changedFiles:A}}function Q(e){let t=/^([ \t]+)\S/m.exec(e);return t?t[1]:4}function $(e,t,n,r,i){let a=[];for(let o of H(e,[`package.json`,`:(glob)**/package.json`])){if(W(o))continue;let s=x(D(e,o),`utf8`),c=JSON.parse(s),l=!1;for(let e of[`dependencies`,`devDependencies`]){let r=c[e];if(r)for(let e of n.npm){if(!Object.hasOwn(r,e))continue;let n=r[e];F.test(n)||n===t||(r[e]=t,l=!0,i(`pin ${o}: ${e} ${n} -> ${t}`))}}if(l&&(a.push(o),r)){let t=JSON.stringify(c,null,Q(s));s.endsWith(`
1
+ import{brand as e}from"../build.js";import{applyClasses as t}from"./classes.js";import{applyComponents as n}from"./components.js";import{applyCssTable as r,isCssTarget as i,ownDeclarations as a}from"./css.js";import{applyRazorAttributes as o}from"./razorAttributes.js";import{applyRazorTags as s}from"./razorTags.js";import{applyRazorValueSplits as c}from"./razorValueSplits.js";import{applyMarkup as l,applySource as u}from"./source.js";import{applyComponentProps as d,applyPropSplits as f,applyPropValues as p,applyProps as m,applyThemeReads as h}from"./themeReads.js";import{applyValueSplits as g}from"./valueSplits.js";import{applyWrapperValues as _,findWrappers as v}from"./wrapperValues.js";import{createRequire as y}from"node:module";import{existsSync as b,readFileSync as x,readdirSync as S,realpathSync as C,writeFileSync as w}from"node:fs";import{dirname as T,isAbsolute as E,join as D,relative as O,resolve as k,sep as A}from"node:path";import{fileURLToPath as j,pathToFileURL as M}from"node:url";import{spawnSync as N}from"node:child_process";var P=/^\d+\.\d+\.\d+$/,F=/^(?:workspace:|file:|link:)/,I=`WEBORITY_UPGRADE_FROM`;function L(e){if(typeof e!=`string`||!P.test(e))throw Error(`invalid version "${e}"`)}function R(e,t){L(e),L(t);let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<3;e++)if(n[e]!==r[e])return n[e]-r[e];return 0}function z(){let e=T(j(import.meta.url));for(;;){let t=D(e,`package.json`);if(b(t)&&JSON.parse(x(t,`utf8`)).name===`@webority/tokens`)return e;let n=T(e);if(n===e)throw Error(`cannot find the @webority/tokens package folder`);e=n}}function B(){return JSON.parse(x(D(z(),`package.json`),`utf8`)).version}function V(e){let t=[];for(let n of S(e)){if(!n.endsWith(`.json`))continue;let r=n.slice(0,-5);P.test(r)&&t.push({version:r,table:JSON.parse(x(D(e,n),`utf8`))})}return t.sort((e,t)=>R(e.version,t.version))}function H(e,t){let n=N(`git`,[`ls-files`,`-z`,`--`,...t],{cwd:e,encoding:`utf8`,windowsHide:!0,maxBuffer:67108864});if(n.status!==0)throw Error(`not a git repository: ${e}`);let r=n.stdout.split(`\0`).filter(Boolean).map(e=>e.split(`\\`).join(`/`)).filter(t=>b(D(e,t)));return[...new Set(r)]}function U(e,t){let n=H(e,t??[`.`]);if(t!==void 0&&n.length===0)throw Error(`no tracked files under ${t.join(`, `)}`);return n}function W(e){return e.split(`/`).includes(`node_modules`)}var G=new Set([`node_modules`,`vendor`,`vendors`,`external`]),K=/\.(?:min|bundle)\.(?:js|css)$/,q=new Set([`lib`,`theme`]);function J(e){let t=e.split(`/`);return t.some(e=>G.has(e))||t.some((e,n)=>e===`wwwroot`&&q.has(t[n+1]))?!0:K.test(e)}function Y(e,t){return[...new Set([...e,...t])]}function X(e,t,n){return V(e).filter(e=>R(e.version,t)>0&&R(e.version,n)<=0).map(e=>e.table)}function Z(e,t){let n=Object.entries(t);if(n.length===0)return e;let r=(e,t)=>e.flatMap(e=>[e,...n.filter(([,n])=>e[t]===n).map(([n])=>({...e,[t]:n}))]),i={...e};for(let t of[`props`,`componentProps`,`propValues`,`propSplits`,`valueSplits`,`components`])e[t]!==void 0&&(i[t]=r(e[t],`package`));return e.source!==void 0&&(i.source={...e.source,flags:r(e.source.flags,`importedFrom`)}),i}function Q(e,y,b,S,C,T={}){S&&C(`dry run: nothing written`);let E=b.map(e=>Z(e,T)),O=[],k=[],A=[],j=y.filter(e=>i(e)&&!J(e)),M=E.map(()=>new Set);if(E.some(e=>(e.css.ownable??[]).length>0))for(let t of j){let n=x(D(e,t),`utf8`);E.forEach((e,r)=>{for(let i of a(n,t,e))M[r].add(i)})}let N=H(e,[`package.json`,`:(glob)**/package.json`]).filter(e=>!W(e)),P=new Map,F=E.map(t=>v(e,[...j,...N],t,P));for(let i of j){let a=x(D(e,i),`utf8`),v=a,y=e=>{for(let t of e)t.from!==t.to&&(O.push({file:i,line:t.line,from:t.from,to:t.to}),C(`${i}:${t.line} ${t.from} -> ${t.to}`))},b=e=>{k.push({file:i,line:e.line,name:e.name,hint:e.hint}),C(`choose ${i}:${e.line} ${e.name}: ${e.hint}`)},T=e=>{for(let t of e)t.message.startsWith(`skipped, it does not parse`)?C(`skipped ${i}: ${t.message}`):b({line:t.line,name:t.path,hint:t.message})};for(let[e,a]of E.entries()){let x=r(v,i,a,M[e]);v=x.text,y(x.hits);for(let e of x.choose)b(e);for(let e of x.checkRole)C(`verify ${i}:${e.line} ${e.from} -> ${e.to}`);let S=h(v,i,a.themeReads);v=S.text,y(S.hits),T(S.findings);let w=[t=>_(t,i,F[e]),e=>m(e,i,a.props),e=>d(e,i,a.componentProps),e=>p(e,i,a.propValues),e=>g(e,i,a.valueSplits??[]),e=>f(e,i,a.propSplits),e=>o(e,i,a.razorAttributes),e=>n(e,i,a.components??[]),e=>s(e,i,a.razorTags??[]),e=>c(e,i,a.razorValueSplits??[]),e=>t(e,i,a.classes??[]),e=>l(e,i,a.markup),e=>u(e,i,a.source)];for(let e of w){let t=e(v);v=t.text,y(t.hits),T(t.findings)}}v!==a&&(A.push(i),S||w(D(e,i),v,`utf8`))}return{hits:O,choose:k,changedFiles:A}}function $(e){let t=/^([ \t]+)\S/m.exec(e);return t?t[1]:4}function ee(e,t,n,r,i){let a=[];for(let o of H(e,[`package.json`,`:(glob)**/package.json`])){if(W(o))continue;let s=x(D(e,o),`utf8`),c=JSON.parse(s),l=!1;for(let e of[`dependencies`,`devDependencies`]){let r=c[e];if(r)for(let e of n.npm){if(!Object.hasOwn(r,e))continue;let n=r[e];F.test(n)||n===t||(r[e]=t,l=!0,i(`pin ${o}: ${e} ${n} -> ${t}`))}}if(l&&(a.push(o),r)){let t=JSON.stringify(c,null,$(s));s.endsWith(`
2
2
  `)&&(t+=`
3
3
  `),s.includes(`\r
4
4
  `)&&(t=t.replace(/\n/g,`\r
5
- `)),w(D(e,o),t,`utf8`)}}return a}function ee(e,t,n,r,i){let a=[];for(let o of H(e,[`Directory.Packages.props`,`:(glob)**/Directory.Packages.props`])){if(W(o))continue;let s=x(D(e,o),`utf8`),c=!1,l=s.replace(/<PackageVersion\b[^>]*>/g,e=>{let r=/\sInclude="([^"]*)"/.exec(e)?.[1],a=/\sVersion="([^"]*)"/.exec(e)?.[1];if(r===void 0||a===void 0)return e;let s=/^\[([^\]]*)\]$/.exec(a),l=s?s[1]:a,u=s?`[${t}]`:t;return!n.nuget.includes(r)||l===t?e:(i(`pin ${o}: ${r} ${a} -> ${u}`),c=!0,e.replace(/(\sVersion=")[^"]*(")/,`$1${u}$2`))});c&&(a.push(o),r&&w(D(e,o),l,`utf8`))}return a}function te(e){let t;try{t=y(D(e,`package.json`)).resolve(`@webority/repo-checks/lockstep.json`)}catch{throw Error(`add @webority/repo-checks at the lockstep version and run again`)}return JSON.parse(x(t,`utf8`))}var ne=[{file:`pnpm-lock.yaml`,manager:`pnpm`,command:[`corepack`,`pnpm`,`install`]},{file:`package-lock.json`,manager:`npm`,command:[`npm`,`install`]}];function re(e){let t=ne.filter(t=>b(D(e,t.file)));if(t.length===0)throw Error(`no pnpm-lock.yaml or package-lock.json in ${e}`);if(t.length>1)throw Error(`${e} has both ${t[0].file} and ${t[1].file}; keep one lockfile`);return t[0]}function ie(e,t){let n=k(e,t),r=O(e,n);if(r===``||E(r)||r.split(A)[0]===`..`)throw Error(`--app ${t}: give a folder inside the repo root`);if(!b(D(n,`package.json`)))throw Error(`--app ${t}: no package.json in that folder`);return n}function ae(e,t,n){return N(e,t,{cwd:n.cwd,env:process.env,stdio:`inherit`,windowsHide:!0,shell:process.platform===`win32`})}async function oe({appRoot:e,designRoot:t,app:n,version:r,from:i,aliases:a}){let o=C.native(D(e,`node_modules`,`@webority`,`tokens`)),s=JSON.parse(x(D(o,`package.json`),`utf8`))?.exports?.[`.`],c=typeof s==`string`?s:s?.default;if(typeof c!=`string`)throw Error(`cannot find the installed @webority/tokens entry`);process.env[I]=i;try{return await(await import(M(D(o,c)).href)).upgrade({root:t,app:n,version:r,dryRun:!1,aliases:a})}finally{delete process.env[I]}}async function se({root:e,designRoot:t,version:n,dryRun:r,from:i,dir:a,log:o,brandFn:s,aliases:c}){let l=Y(a,i,n),u=Z(e,U(e),l,r,o,c);return r||await s({root:t}),u}async function ce({root:e,designRoot:t,app:n,version:r,dryRun:i,deps:a,log:o,aliases:s}){let c=D(e,`node_modules`,`@webority`,`tokens`,`package.json`);if(!b(c))throw Error(`@webority/tokens is not installed; add it at the lockstep version and run again`);let l=JSON.parse(x(c,`utf8`)).version,u=te(e),d=i?null:re(e),f=[...$(e,r,u,!i,o),...ee(e,r,u,!i,o)];if(i){o(`dry run: install skipped; tables are those of the installed ${l}`);let t=Y(a.renamesDir??D(e,`node_modules`,`@webority`,`tokens`,`renames`),l,r),n=Z(e,U(e),t,!0,o,s);return{...n,changedFiles:J(f,n.changedFiles)}}let p=a.run??ae,[m,...h]=d.command,{status:g}=await p(m,h,{cwd:e});if(g!==0)throw Error(`${d.manager} install failed with exit code ${g}`);let _=await(a.reenter??oe)({appRoot:e,designRoot:t,app:n,version:r,dryRun:!1,from:l,aliases:s});return{..._,changedFiles:J(f,_.changedFiles)}}async function le(t,n={}){let r=t.version;L(r);let i=t.root??process.cwd(),a=t.app===void 0?i:ie(i,t.app),o=t.dryRun??!1,s=t.aliases??{},c=n.log??console.log,l=()=>n.renamesDir??D(z(),`renames`);if(Array.isArray(t.paths)&&t.paths.length>0){let e=V(l()).filter(e=>e.version===r).map(e=>e.table);if(e.length===0&&r!==(n.ownVersion??B)())throw Error(`no rename table for ${r}`);return Z(a,U(a,t.paths),e,o,c,s)}if(!b(D(i,`.webority`,`design.json`)))throw Error(`write .webority/design.json (design-map.md) and run again`);let u=process.env[I];return u?se({root:a,designRoot:i,version:r,dryRun:o,from:u,dir:l(),log:c,brandFn:n.brand??e,aliases:s}):ce({root:a,designRoot:i,app:t.app,version:r,dryRun:o,deps:n,log:c,aliases:s})}export{le as upgrade};
5
+ `)),w(D(e,o),t,`utf8`)}}return a}function te(e,t,n,r,i){let a=[];for(let o of H(e,[`Directory.Packages.props`,`:(glob)**/Directory.Packages.props`])){if(W(o))continue;let s=x(D(e,o),`utf8`),c=!1,l=s.replace(/<PackageVersion\b[^>]*>/g,e=>{let r=/\sInclude="([^"]*)"/.exec(e)?.[1],a=/\sVersion="([^"]*)"/.exec(e)?.[1];if(r===void 0||a===void 0)return e;let s=/^\[([^\]]*)\]$/.exec(a),l=s?s[1]:a,u=s?`[${t}]`:t;return!n.nuget.includes(r)||l===t?e:(i(`pin ${o}: ${r} ${a} -> ${u}`),c=!0,e.replace(/(\sVersion=")[^"]*(")/,`$1${u}$2`))});c&&(a.push(o),r&&w(D(e,o),l,`utf8`))}return a}function ne(e){let t;try{t=y(D(e,`package.json`)).resolve(`@webority/repo-checks/lockstep.json`)}catch{throw Error(`add @webority/repo-checks at the lockstep version and run again`)}return JSON.parse(x(t,`utf8`))}var re=[{file:`pnpm-lock.yaml`,manager:`pnpm`,command:[`corepack`,`pnpm`,`install`]},{file:`package-lock.json`,manager:`npm`,command:[`npm`,`install`]}];function ie(e){let t=re.filter(t=>b(D(e,t.file)));if(t.length===0)throw Error(`no pnpm-lock.yaml or package-lock.json in ${e}`);if(t.length>1)throw Error(`${e} has both ${t[0].file} and ${t[1].file}; keep one lockfile`);return t[0]}function ae(e,t){let n=k(e,t),r=O(e,n);if(r===``||E(r)||r.split(A)[0]===`..`)throw Error(`--app ${t}: give a folder inside the repo root`);if(!b(D(n,`package.json`)))throw Error(`--app ${t}: no package.json in that folder`);return n}function oe(e,t,n){return N(e,t,{cwd:n.cwd,env:process.env,stdio:`inherit`,windowsHide:!0,shell:process.platform===`win32`})}async function se({appRoot:e,designRoot:t,app:n,version:r,from:i,aliases:a}){let o=C.native(D(e,`node_modules`,`@webority`,`tokens`)),s=JSON.parse(x(D(o,`package.json`),`utf8`))?.exports?.[`.`],c=typeof s==`string`?s:s?.default;if(typeof c!=`string`)throw Error(`cannot find the installed @webority/tokens entry`);process.env[I]=i;try{return await(await import(M(D(o,c)).href)).upgrade({root:t,app:n,version:r,dryRun:!1,aliases:a})}finally{delete process.env[I]}}async function ce({root:e,designRoot:t,version:n,dryRun:r,from:i,dir:a,log:o,brandFn:s,aliases:c}){let l=X(a,i,n),u=Q(e,U(e),l,r,o,c);return r||await s({root:t}),u}async function le({root:e,designRoot:t,app:n,version:r,dryRun:i,deps:a,log:o,aliases:s}){let c=D(e,`node_modules`,`@webority`,`tokens`,`package.json`);if(!b(c))throw Error(`@webority/tokens is not installed; add it at the lockstep version and run again`);let l=JSON.parse(x(c,`utf8`)).version,u=ne(e),d=i?null:ie(e),f=[...ee(e,r,u,!i,o),...te(e,r,u,!i,o)];if(i){o(`dry run: install skipped; tables are those of the installed ${l}`);let t=X(a.renamesDir??D(e,`node_modules`,`@webority`,`tokens`,`renames`),l,r),n=Q(e,U(e),t,!0,o,s);return{...n,changedFiles:Y(f,n.changedFiles)}}let p=a.run??oe,[m,...h]=d.command,{status:g}=await p(m,h,{cwd:e});if(g!==0)throw Error(`${d.manager} install failed with exit code ${g}`);let _=await(a.reenter??se)({appRoot:e,designRoot:t,app:n,version:r,dryRun:!1,from:l,aliases:s});return{..._,changedFiles:Y(f,_.changedFiles)}}async function ue(t,n={}){let r=t.version;L(r);let i=t.root??process.cwd(),a=t.app===void 0?i:ae(i,t.app),o=t.dryRun??!1,s=t.aliases??{},c=n.log??console.log,l=()=>n.renamesDir??D(z(),`renames`);if(Array.isArray(t.paths)&&t.paths.length>0){let e=V(l()).filter(e=>e.version===r).map(e=>e.table);if(e.length===0&&r!==(n.ownVersion??B)())throw Error(`no rename table for ${r}`);return Q(a,U(a,t.paths),e,o,c,s)}if(!b(D(i,`.webority`,`design.json`)))throw Error(`write .webority/design.json (design-map.md) and run again`);let u=process.env[I];return u?ce({root:a,designRoot:i,version:r,dryRun:o,from:u,dir:l(),log:c,brandFn:n.brand??e,aliases:s}):le({root:a,designRoot:i,app:t.app,version:r,dryRun:o,deps:n,log:c,aliases:s})}export{ue as upgrade};
@@ -1,2 +1,2 @@
1
1
  import{findQuoteEnd as e,tagOccurrences as t}from"./tagScan.js";import{applyEdits as n}from"./themeReads.js";import{separatorAt as r}from"./valueSplits.js";var i=new Set([`.cshtml`,`.razor`]),a=/(\s*)([^\s=/>"']+)(\s*=\s*)?/y,o=e=>{let t=/\.[^./]*$/.exec(e);return t?t[0].toLowerCase():``},s=(e,t)=>e.slice(0,t).split(`
2
- `).length;function c(t,n,r){let i=[],o=n;for(;;){a.lastIndex=o;let n=a.exec(t);if(n===null)break;let s=n.index+n[1].length,c={name:n[2],nameStart:s,nameEnd:s+n[2].length,wsStart:n.index,kind:`none`,attrEnd:s+n[2].length},l=n.index+n[0].length;if(n[3]!==void 0&&(t[l]===`"`||t[l]===`'`)){let n=e(t,l);if(n===-1)break;c.kind=`quoted`,c.value=t.slice(l+1,n),c.attrEnd=n+1}else n[3]!==void 0&&(c.kind=`bare`,c.attrEnd=l+/[^\s"'>]*/y.exec(t.slice(l))[0].length);if(c.attrEnd>r)break;i.push(c),o=c.attrEnd}return i}function l(e,a,l){if(l.length===0||!i.has(o(a)))return{text:e,hits:[],findings:[]};let u=[],d=[],f=[];for(let n of l)for(let i of n.tags)for(let{nameEnd:o,end:l}of t(e,i)){if(l===-1){f.push({file:a,line:s(e,o),path:`<${i}>`,message:`the tag could not be read (a quote in an attribute value does not pair up); set it by hand`});continue}let t=c(e,o,l),p=new Set(t.map(e=>e.name));for(let o of t){if(o.name!==n.attribute)continue;let t=s(e,o.nameStart),c=`<${i}> ${n.attribute}`,l=o.kind===`none`?`true`:o.kind===`quoted`?o.value.toLowerCase():void 0;if(l!==void 0&&!Object.hasOwn(n.values,l)&&n.keep?.includes(l))continue;if(l===void 0||!Object.hasOwn(n.values,l)){f.push({file:a,line:t,path:c,message:n.flag});continue}let m=Object.entries(n.values[l]).filter(([,e])=>e!==null),h=m.map(([e])=>e).filter(e=>e!==n.attribute&&p.has(e));if(h.length>0){f.push({file:a,line:t,path:c,message:`<${i}> already sets ${h.join(` and `)}; merge ${n.attribute} into it by hand`});continue}let g=m.map(([e,t])=>`${e}="${t}"`).join(r(e,o.nameStart)),_=m.length===0?o.wsStart:o.nameStart;u.push({start:_,end:o.attrEnd,text:g}),d.push({line:t,from:e.slice(o.nameStart,o.attrEnd),to:g.replace(/\n\s*/g,` `)})}}return d.sort((e,t)=>e.line-t.line||(e.from<t.from?-1:+(e.from>t.from))),f.sort((e,t)=>e.line-t.line||(e.path<t.path?-1:+(e.path>t.path))),{text:n(e,u,a),hits:d,findings:f}}export{l as applyRazorValueSplits};
2
+ `).length;function c(t,n,r){let i=[],o=n;for(;;){a.lastIndex=o;let n=a.exec(t);if(n===null)break;let s=n.index+n[1].length,c={name:n[2],nameStart:s,nameEnd:s+n[2].length,wsStart:n.index,kind:`none`,attrEnd:s+n[2].length},l=n.index+n[0].length;if(n[3]!==void 0&&(t[l]===`"`||t[l]===`'`)){let n=e(t,l);if(n===-1)break;c.kind=`quoted`,c.value=t.slice(l+1,n),c.attrEnd=n+1}else n[3]!==void 0&&(c.kind=`bare`,c.attrEnd=l+/[^\s"'>]*/y.exec(t.slice(l))[0].length);if(c.attrEnd>r)break;i.push(c),o=c.attrEnd}return i}function l(e,a,l){if(l.length===0||!i.has(o(a)))return{text:e,hits:[],findings:[]};let u=[],d=[],f=[];for(let n of l)for(let i of n.tags)for(let{nameEnd:o,end:l}of t(e,i)){if(l===-1){f.push({file:a,line:s(e,o),path:`<${i}>`,message:`the tag could not be read (a quote in an attribute value does not pair up); set it by hand`});continue}let t=c(e,o,l),p=new Set(t.map(e=>e.name));for(let o of t){if(o.name!==n.attribute)continue;let t=s(e,o.nameStart),c=`<${i}> ${n.attribute}`,l=o.kind===`none`?`true`:o.kind===`quoted`?o.value.toLowerCase():void 0;if(l!==void 0&&!Object.hasOwn(n.values,l)&&n.keep?.includes(l))continue;if(l===void 0||!Object.hasOwn(n.values,l)){f.push({file:a,line:t,path:c,message:n.flag});continue}let m=Object.entries(n.values[l]).filter(([,e])=>e!==null),h=m.map(([e])=>e).filter(e=>e!==n.attribute&&p.has(e));if(h.length>0){f.push({file:a,line:t,path:c,message:`<${i}> already sets ${h.join(` and `)}; merge ${n.attribute} into it by hand`});continue}let g=m.map(([e,t])=>`${e}="${t}"`).join(r(e,o.nameStart));if(n.skipWritten&&g===e.slice(o.nameStart,o.attrEnd))continue;let _=m.length===0?o.wsStart:o.nameStart;u.push({start:_,end:o.attrEnd,text:g}),d.push({line:t,from:e.slice(o.nameStart,o.attrEnd),to:g.replace(/\n\s*/g,` `)})}}return d.sort((e,t)=>e.line-t.line||(e.from<t.from?-1:+(e.from>t.from))),f.sort((e,t)=>e.line-t.line||(e.path<t.path?-1:+(e.path>t.path))),{text:n(e,u,a),hits:d,findings:f}}export{l as applyRazorValueSplits};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/tokens",
3
- "version": "0.146.2",
3
+ "version": "0.148.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",
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "ajv": "8.20.0",
43
- "vite": "^8.0.12"
43
+ "vite": "^8.3.6"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "vite build && node dist/webority.js brand --library --out dist",
@@ -114,6 +114,14 @@
114
114
  "false": {}
115
115
  },
116
116
  "flag": "compact is no longer a value: density=\"compact\" with size=\"sm\" replaces it; set the new attributes by hand"
117
+ },
118
+ {
119
+ "tags": ["app-select"],
120
+ "attribute": "searchable",
121
+ "values": { "true": { "searchable": "true" } },
122
+ "keep": ["false"],
123
+ "skipWritten": true,
124
+ "flag": "searchable is a true-or-false value now, so a bare searchable is written searchable=\"true\"; this value is left as written, check it by hand"
117
125
  }
118
126
  ],
119
127
  "razorTags": [
@@ -137,4 +137,6 @@ export interface RazorValueSplitRule {
137
137
  values: Readonly<Record<string, Readonly<Record<string, string | null>>>>;
138
138
  flag: string;
139
139
  keep?: readonly string[];
140
+ /** An attribute already written exactly as its value maps (a quoted searchable="true") gets no edit and no hit. */
141
+ skipWritten?: boolean;
140
142
  }