@webority/tokens 0.106.0 → 0.108.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{readFileSync as o}from"node:fs";var s=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`}),c=`generated`,l=/\{([a-z0-9-]+(?:\.[a-z0-9-]+)+)\}/g,u=[`palette`,`color`,`effect`,`font`,`radius`],d=[`space`,`text`,`shadow`,`section`,`component`,`email`],f=[`radius`,`padding`],p=[`size`,`lineHeight`,`phoneSize`,`phoneLineHeight`],m=[`narrowSize`,`narrowLineHeight`],h=/^(#[0-9a-fA-F]{6}|\{color\.[a-z0-9-]+\})$/;function g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _(e){return g(e)&&Object.hasOwn(e,`$value`)}function v(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}`;_(a)?n.push({path:o,node:a}):g(a)&&r(a,o)}};return r(e,t),n}function y(e,t){let n=e;for(let e of t.split(`.`)){if(!g(n)||!Object.hasOwn(n,e))return!1;n=n[e]}return _(n)}function b(e){let t=e?.$extensions?.[`com.webority`];return g(t)?t:{}}function x(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)&&!/^[0-9]+$/.test(e)}function S(e){return typeof e==`string`&&h.test(e)}function C(e){return g(e)&&Number.isInteger(e.value)&&e.value>=0&&e.unit===`px`}function w(e,t){return e===`space`?n.has(t):e===`button`&&t===`padding`}function T(e,n,r,i,a){let o=b(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`)S(r.$value)||a(i,`$value is not a colour`,`Write "#RRGGBB" or a reference such as "{color.primary}"`),Object.hasOwn(o,`dark`)&&!S(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=g(e)?Object.keys(e):[],n=t.includes(`narrowSize`)||t.includes(`narrowLineHeight`)?[...p,...m]:p;g(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 w(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`):C(r.$value)||a(i,`$value is not { value, unit }`,`Write it as { "value": 12, "unit": "px" }`)}function E(t,n){let o={color:Object.keys(e),type:Object.keys(a),space:Object.keys(i),shape:Object.keys(r),button:f};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(`, `)}`);continue}if(!g(t[e])){n(`email.${e}`,`is not a group`,`Write it as an object of tokens`);continue}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];if(!_(a)){n(i,`is not a token`,`Give it a $value`);continue}T(e,r,a,i,n)}}}function D(e,t,n){let r;try{r=JSON.parse(o(e,`utf8`))}catch(t){throw Error(`${e}: (file): cannot be read as JSON (${t.message}). Restore the file or fix the JSON`)}if(!g(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)},s=b(r);for(let e of Object.keys(s))e!==`brand`&&e!==`deviation`&&a(`$extensions.com.webority.${e}`,`is not a brand file key`,`Remove it`);let c=Object.hasOwn(s,`deviation`),f=c&&typeof s.deviation==`string`&&Object.hasOwn(n,s.deviation);c&&!f&&a(`$extensions.com.webority.deviation`,`${s.deviation} is not in deviations.json`,`Use a key of deviations.json`),(typeof s.brand!=`string`||!/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(s.brand))&&a(`$extensions.com.webority.brand`,`is missing or not kebab case`,`Name the product in kebab case, such as capnix`);let p=f?n[s.deviation].groups:[],m={},h=null;for(let e of Object.keys(r))if(!e.startsWith(`$`)){if(!u.includes(e)&&!d.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`);continue}if(d.includes(e)&&!p.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`);continue}if(!g(r[e])){a(e,`is not a group`,`Write it as an object of tokens`);continue}if(e===`email`){h=r[e];continue}m[e]=r[e]}for(let[e,t]of Object.entries(m))for(let{path:n,node:r}of v(t,e)){let t=b(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 v(m.palette??{},`palette`))e.split(`.`).slice(1).every(x)||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 S=(e,n,r)=>{let i=`${e}.${n}`,o=b(r),s=y(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?y(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`):(x(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=m[e]??{};for(let n of Object.keys(t))if(!n.startsWith(`$`)){if(!_(t[n])){a(`${e}.${n}`,`is not a token`,`Give it a $value`);continue}S(e,n,t[n])}}let C=Object.keys(t.scale.font??{}).filter(e=>_(t.scale.font[e]));for(let{path:e,node:n}of v(m.font??{},`font`)){y(t.scale,e)||a(e,`is not a fleet font`,`Use one of ${C.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(b(n),`faces`)){let t=b(n).faces,r=[`normal`,`medium`,`semibold`,`bold`];g(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 w=Object.keys(t.scale.radius??{}).filter(e=>_(t.scale.radius[e]));for(let{path:e,node:n}of v(m.radius??{},`radius`)){y(t.scale,e)||a(e,`is not on the radius scale`,`Use one of ${w.join(`, `)}`);let r=n.$value;(!(g(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" }`)}h!==null&&E(h,a);let T=structuredClone(r);delete T.$extensions,delete T.$description,delete T.email;for(let e of[`color`,`effect`])for(let{node:t}of v(T[e]??{},e))Object.hasOwn(b(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 D=e=>y(T,e)||y(t.palette,e)||y(t.scale,e)||y(t.meaning,e);for(let e of Object.keys(m))for(let{path:t,node:n}of v(m[e],e)){let e=[n.$value,b(n).dark].filter(e=>typeof e==`string`);for(let n of e)for(let e of n.matchAll(l))D(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{readFileSync as o}from"node:fs";var s=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`}),c=`generated`,l=/\{([a-z0-9-]+(?:\.[a-z0-9-]+)+)\}/g,u=[`palette`,`color`,`effect`,`font`,`radius`],d=[`space`,`text`,`shadow`,`section`,`component`,`email`],f=[`radius`,`padding`],p=[`size`,`lineHeight`,`phoneSize`,`phoneLineHeight`],m=[`narrowSize`,`narrowLineHeight`],h=/^(#[0-9a-fA-F]{6}|\{color\.[a-z0-9-]+\})$/;function g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _(e){return g(e)&&Object.hasOwn(e,`$value`)}function v(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}`;_(a)?n.push({path:o,node:a}):g(a)&&r(a,o)}};return r(e,t),n}function y(e,t){let n=e;for(let e of t.split(`.`)){if(!g(n)||!Object.hasOwn(n,e))return!1;n=n[e]}return _(n)}function b(e){let t=e?.$extensions?.[`com.webority`];return g(t)?t:{}}function x(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)&&!/^[0-9]+$/.test(e)}function S(e){return typeof e==`string`&&h.test(e)}function C(e){return g(e)&&Number.isInteger(e.value)&&e.value>=0&&e.unit===`px`}function w(e,t){return e===`space`?n.has(t):e===`button`&&t===`padding`}function T(e,n,r,i,a){let o=b(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`)S(r.$value)||a(i,`$value is not a colour`,`Write "#RRGGBB" or a reference such as "{color.primary}"`),Object.hasOwn(o,`dark`)&&!S(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=g(e)?Object.keys(e):[],n=t.includes(`narrowSize`)||t.includes(`narrowLineHeight`)?[...p,...m]:p;g(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 w(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`):C(r.$value)||a(i,`$value is not { value, unit }`,`Write it as { "value": 12, "unit": "px" }`)}function E(t,n){let o={color:Object.keys(e),type:Object.keys(a),space:Object.keys(i),shape:Object.keys(r),button:f};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(`, `)}`);continue}if(!g(t[e])){n(`email.${e}`,`is not a group`,`Write it as an object of tokens`);continue}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];if(!_(a)){n(i,`is not a token`,`Give it a $value`);continue}T(e,r,a,i,n)}}}function D(e,t,n){let r;try{r=JSON.parse(o(e,`utf8`))}catch(t){throw Error(`${e}: (file): cannot be read as JSON (${t.message}). Restore the file or fix the JSON`)}if(!g(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)},s=b(r);for(let e of Object.keys(s))e!==`brand`&&e!==`deviation`&&a(`$extensions.com.webority.${e}`,`is not a brand file key`,`Remove it`);let c=Object.hasOwn(s,`deviation`),f=c&&typeof s.deviation==`string`&&Object.hasOwn(n,s.deviation);c&&!f&&a(`$extensions.com.webority.deviation`,`${s.deviation} is not in deviations.json`,`Use a key of deviations.json`),(typeof s.brand!=`string`||!/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(s.brand))&&a(`$extensions.com.webority.brand`,`is missing or not kebab case`,`Name the product in kebab case, such as acme`);let p=f?n[s.deviation].groups:[],m={},h=null;for(let e of Object.keys(r))if(!e.startsWith(`$`)){if(!u.includes(e)&&!d.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`);continue}if(d.includes(e)&&!p.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`);continue}if(!g(r[e])){a(e,`is not a group`,`Write it as an object of tokens`);continue}if(e===`email`){h=r[e];continue}m[e]=r[e]}for(let[e,t]of Object.entries(m))for(let{path:n,node:r}of v(t,e)){let t=b(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 v(m.palette??{},`palette`))e.split(`.`).slice(1).every(x)||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 S=(e,n,r)=>{let i=`${e}.${n}`,o=b(r),s=y(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?y(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`):(x(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=m[e]??{};for(let n of Object.keys(t))if(!n.startsWith(`$`)){if(!_(t[n])){a(`${e}.${n}`,`is not a token`,`Give it a $value`);continue}S(e,n,t[n])}}let C=Object.keys(t.scale.font??{}).filter(e=>_(t.scale.font[e]));for(let{path:e,node:n}of v(m.font??{},`font`)){y(t.scale,e)||a(e,`is not a fleet font`,`Use one of ${C.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(b(n),`faces`)){let t=b(n).faces,r=[`normal`,`medium`,`semibold`,`bold`];g(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 w=Object.keys(t.scale.radius??{}).filter(e=>_(t.scale.radius[e]));for(let{path:e,node:n}of v(m.radius??{},`radius`)){y(t.scale,e)||a(e,`is not on the radius scale`,`Use one of ${w.join(`, `)}`);let r=n.$value;(!(g(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" }`)}h!==null&&E(h,a);let T=structuredClone(r);delete T.$extensions,delete T.$description,delete T.email;for(let e of[`color`,`effect`])for(let{node:t}of v(T[e]??{},e))Object.hasOwn(b(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 D=e=>y(T,e)||y(t.palette,e)||y(t.scale,e)||y(t.meaning,e);for(let e of Object.keys(m))for(let{path:t,node:n}of v(m[e],e)){let e=[n.$value,b(n).dark].filter(e=>typeof e==`string`);for(let n of e)for(let e of n.matchAll(l))D(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 O={};for(let e of[`color`,`effect`])for(let{path:t,node:n}of v(m[e]??{},e)){let r=b(n).dark;if(typeof r!=`string`)continue;let i=t.slice(e.length+1);O[e]??={},O[e][i]=n.$type===void 0?{$value:r}:{$value:r,$type:n.$type}}return{name:s.brand,base:T,dark:O,email:h}}export{s as BRAND_OUTPUT_FILES,c as HEAD_FOLDER,D as loadBrand};
@@ -2,7 +2,7 @@
2
2
  "format": "webority-theme-tokens/2",
3
3
  "source": {
4
4
  "package": "@webority/tokens",
5
- "version": "0.106.0",
5
+ "version": "0.108.0",
6
6
  "brand": null,
7
7
  "platform": "phone",
8
8
  "width": null
@@ -453,6 +453,7 @@
453
453
  "sizes": {
454
454
  "sm": {
455
455
  "icon": "48px",
456
+ "illustration-size": "96px",
456
457
  "title-text": "17px",
457
458
  "description-text": "13px",
458
459
  "padding-y": "16px",
@@ -461,6 +462,7 @@
461
462
  },
462
463
  "md": {
463
464
  "icon": "64px",
465
+ "illustration-size": "160px",
464
466
  "title-text": "20px",
465
467
  "description-text": "15px",
466
468
  "padding-y": "24px",
@@ -469,6 +471,7 @@
469
471
  },
470
472
  "lg": {
471
473
  "icon": "80px",
474
+ "illustration-size": "240px",
472
475
  "title-text": "24px",
473
476
  "description-text": "17px",
474
477
  "padding-y": "32px",
@@ -2,7 +2,7 @@
2
2
  "format": "webority-theme-tokens/2",
3
3
  "source": {
4
4
  "package": "@webority/tokens",
5
- "version": "0.106.0",
5
+ "version": "0.108.0",
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.106.0",
5
+ "version": "0.108.0",
6
6
  "brand": null,
7
7
  "platform": "web",
8
8
  "width": 1440
@@ -1 +1 @@
1
- var e={"operations/fleet-parity-deviation-register#website":{reason:`The public sites (webority.com, Government, Demo) keep their own fluid size scale by a recorded deviation.`,groups:[`space`,`text`,`shadow`,`section`,`component`]},"decisions/D-016-tray-app-keeps-its-own-design-tokens":{reason:`The governor tray keeps its own token values with no portal stylesheet, written through the generator.`,groups:[`space`,`text`,`shadow`,`section`,`component`]},"operations/fleet-parity-deviation-register#studio":{reason:`Webority Studio keeps its own colours, sizes, radii and fonts, written through the generator.`,groups:[`space`,`text`,`shadow`,`section`,`component`]},"operations/fleet-parity-deviation-register#lumex-email":{reason:`Lumex emails keep the sizes, gaps, corners and colours approved before the shared email theme, written through the generator.`,groups:[`email`]},"operations/fleet-parity-deviation-register#capnix-email":{reason:`Capnix emails keep the colours, gaps and corners approved before the shared email theme, written through the generator.`,groups:[`email`]}};export{e as default};
1
+ var e={"operations/fleet-parity-deviation-register#website":{reason:`The public sites (webority.com, Government, Demo) keep their own fluid size scale by a recorded deviation.`,groups:[`space`,`text`,`shadow`,`section`,`component`]},"decisions/D-016-tray-app-keeps-its-own-design-tokens":{reason:`The governor tray keeps its own token values with no portal stylesheet, written through the generator.`,groups:[`space`,`text`,`shadow`,`section`,`component`]},"operations/fleet-parity-deviation-register#studio":{reason:`Webority Studio keeps its own colours, sizes, radii and fonts, written through the generator.`,groups:[`space`,`text`,`shadow`,`section`,`component`]},"operations/fleet-parity-deviation-register#email-kept-sizes-gaps-corners-colours":{reason:`Emails keep the sizes, gaps, corners and colours approved before the shared email theme, written through the generator.`,groups:[`email`]},"operations/fleet-parity-deviation-register#email-kept-colours-gaps-corners":{reason:`Emails keep the colours, gaps and corners approved before the shared email theme, written through the generator.`,groups:[`email`]}};export{e as default};
@@ -2,7 +2,7 @@
2
2
  "format": "webority-meanings/1",
3
3
  "source": {
4
4
  "package": "@webority/tokens",
5
- "version": "0.106.0"
5
+ "version": "0.108.0"
6
6
  },
7
7
  "color": {
8
8
  "bg": {
@@ -664,6 +664,13 @@
664
664
  "unit": "px"
665
665
  }
666
666
  },
667
+ "illustration-size": {
668
+ "$type": "dimension",
669
+ "$value": {
670
+ "value": 96,
671
+ "unit": "px"
672
+ }
673
+ },
667
674
  "title-text": {
668
675
  "$type": "dimension",
669
676
  "$value": "{text.lg}"
@@ -693,6 +700,13 @@
693
700
  "unit": "px"
694
701
  }
695
702
  },
703
+ "illustration-size": {
704
+ "$type": "dimension",
705
+ "$value": {
706
+ "value": 160,
707
+ "unit": "px"
708
+ }
709
+ },
696
710
  "title-text": {
697
711
  "$type": "dimension",
698
712
  "$value": "{text.xl}"
@@ -722,6 +736,13 @@
722
736
  "unit": "px"
723
737
  }
724
738
  },
739
+ "illustration-size": {
740
+ "$type": "dimension",
741
+ "$value": {
742
+ "value": 240,
743
+ "unit": "px"
744
+ }
745
+ },
725
746
  "title-text": {
726
747
  "$type": "dimension",
727
748
  "$value": "{text.2xl}"
@@ -0,0 +1,2 @@
1
+ var e=new Set([`.css`,`.scss`,`.sass`,`.less`]),t=new Set([`.cshtml`,`.razor`,`.html`]),n=new Set([`.js`,`.jsx`,`.ts`,`.tsx`,`.mjs`,`.cjs`,`.mts`,`.cts`]),r=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),i=e=>{let t=/\.[^./]*$/.exec(e);return t?t[0].toLowerCase():``},a=e=>{let t=[0];for(let n=0;n<e.length;n++)e[n]===`
2
+ `&&t.push(n+1);return t},o=(e,t)=>{let n=0,r=e.length-1;for(;n<r;){let i=n+r+1>>1;e[i]<=t?n=i:r=i-1}return n+1},s=(e,t)=>e<t?-1:+(e>t);function c(c,l,u){let d=i(l),f=e.has(d)?`selector`:t.has(d)?`attribute`:n.has(d)?`literal`:void 0;if(u.length===0||f===void 0)return{text:c,hits:[],findings:[]};let p=new Map(u),m=[...p.keys()].sort((e,t)=>t.length-e.length).map(r).join(`|`),h=RegExp(`(?<![\\w-])(${m})(?![\\w-])`,`g`),g=a(c),_=[],v=(e,t)=>e.replace(h,(e,n,r)=>{let i=p.get(e);return _.push({line:o(g,t+r),from:e,to:i}),i}),y=c;return y=f===`selector`?c.replace(RegExp(`\\.(${m})(?![\\w-])`,`g`),(e,t,n)=>{let r=p.get(t);return _.push({line:o(g,n),from:`.${t}`,to:`.${r}`}),`.${r}`}):f===`attribute`?c.replace(/(?<=\s)class\s*=\s*(["'])([^"'\n]*)\1/g,(e,t,n,r)=>{let i=v(n,r+e.length-1-n.length);return`${e.slice(0,e.length-1-n.length)}${i}${t}`}):c.replace(/(["'`])([^"'`\n]*)\1/g,(e,t,n,r)=>`${t}${v(n,r+1)}${t}`),_.sort((e,t)=>e.line-t.line||s(e.from,t.from)),{text:y,hits:_,findings:[]}}export{c as applyClasses};
@@ -0,0 +1,3 @@
1
+ var e=new Set([`.js`,`.jsx`,`.ts`,`.tsx`]),t=`[A-Za-z_$][\\w$]*`,n=RegExp(`^(type\\s+)?(${t})(?:\\s+as\\s+(${t}))?$`),r=/[A-Za-z_$][\w$:.-]*/y,i=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),a=e=>{let t=/\.[^./]*$/.exec(e);return t?t[0].toLowerCase():``},o=e=>{let t=[0];for(let n=0;n<e.length;n++)e[n]===`
2
+ `&&t.push(n+1);return t},s=(e,t)=>{let n=0,r=e.length-1;for(;n<r;){let i=n+r+1>>1;e[i]<=t?n=i:r=i-1}return n+1},c=(e,t)=>e<t?-1:+(e>t),l=e=>`${e.typeKw}${e.name}${e.alias===void 0?``:` as ${e.alias}`}`;function u(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e!==``).map(e=>{let t=n.exec(e);if(t===null)throw Error(`cannot read the import specifier "${e}"`);return{typeKw:t[1]===void 0?``:`type `,name:t[2],alias:t[3]}})}function d(e,n){let r=RegExp(`\\bimport\\s+(type\\s+)?(?:(${t})\\s*,\\s*)?\\{([^{}]*)\\}\\s*from\\s*(["'])${i(n)}\\4(;?)`,`g`);return[...e.matchAll(r)].map(e=>({start:e.index,end:e.index+e[0].length,typeKw:e[1]===void 0?``:`type `,defaultName:e[2],specs:u(e[3]),quote:e[4],semi:e[5],pkg:n}))}function f(e,t){let n=0,r=``;for(let i=t;i<e.length;i++){let t=e[i];if(r)t===`\\`?i++:t===r&&(r=``);else if(t===`"`||t===`'`||t==="`")r=t;else if(t===`{`)n++;else if(t===`}`)n--;else if(t===`>`&&n===0)return i}return-1}function p(e,t){let n=0,r=``;for(let i=t;i<e.length;i++){let t=e[i];if(r)t===`\\`?i++:t===r&&(r=``);else if(t===`"`||t===`'`||t==="`")r=t;else if(t===`{`)n++;else if(t===`}`&&(n--,n===0))return i+1}throw Error(`unbalanced braces in a JSX attribute`)}function m(e,t,n){let i=[],a=t;for(;a<n;){let t=e[a];if(/\s/.test(t)){a++;continue}if(t===`{`){a=p(e,a);continue}r.lastIndex=a;let n=r.exec(e);if(n===null)break;let o=a,s=a+n[0].length,c=s;for(;/\s/.test(e[c]??``);)c++;if(e[c]!==`=`){i.push({name:n[0],nameStart:o,nameEnd:s,kind:`none`}),a=s;continue}for(c++;/\s/.test(e[c]??``);)c++;let l=e[c];if(l===`"`||l===`'`){let t=e.indexOf(l,c+1);if(t===-1)throw Error(`unterminated value of JSX attribute "${n[0]}"`);i.push({name:n[0],nameStart:o,nameEnd:s,kind:`quoted`,innerStart:c+1,innerEnd:t,inner:e.slice(c+1,t)}),a=t+1}else if(l===`{`){let t=p(e,c);i.push({name:n[0],nameStart:o,nameEnd:s,kind:`braced`,innerStart:c+1,innerEnd:t-1,inner:e.slice(c+1,t-1)}),a=t}else throw Error(`cannot read the value of JSX attribute "${n[0]}"`)}return i}function h(e){if(e.kind===`quoted`)return{start:e.innerStart,end:e.innerEnd,value:e.inner};if(e.kind===`braced`){let t=/^(\s*)(["'])([^"'\n]*)\2\s*$/.exec(e.inner);if(t!==null){let n=e.innerStart+t[1].length+1;return{start:n,end:n+t[3].length,value:t[3]}}}}function g(e,t){let n=[],r=`<${t}`;for(let t=e.indexOf(r);t!==-1;t=e.indexOf(r,t+1)){let i=t+r.length;if(!/[\s/>]/.test(e[i]??``))continue;let a=f(e,i);a!==-1&&n.push({nameEnd:i,end:a})}return n}function _(e,t,n){let r=d(e,n.package),a=r.flatMap(e=>e.specs.filter(e=>e.name===n.from).map(t=>({st:e,spec:t})))[0];if(a===void 0)return{text:e,hits:[],findings:[]};let{st:c,spec:u}=a,f=u.alias??n.from,p=u.alias??n.to,_=p!==f,v=n.from!==n.to&&u.alias===void 0&&r.some(e=>e.specs.some(e=>e!==u&&e.name===n.to&&e.alias===void 0)),y=o(e),b=[],x=[],S=[];if(n.from!==n.to){let t=v?c.specs.filter(e=>e!==u):c.specs.map(e=>e===u?{...e,name:n.to}:e),r=[];if(c.defaultName!==void 0&&r.push(c.defaultName),t.length>0&&r.push(`{ ${t.map(l).join(`, `)} }`),r.length===0){let t=e[c.end]===`
3
+ `?c.end+1:c.end;b.push({start:c.start,end:t,text:``})}else b.push({start:c.start,end:c.end,text:`import ${c.typeKw}${r.join(`, `)} from ${c.quote}${c.pkg}${c.quote}${c.semi}`});x.push({line:s(y,c.start),from:n.from,to:n.to})}let C=e=>Object.hasOwn(n.renameProps,e)?n.renameProps[e]:e;for(let{nameEnd:r,end:i}of g(e,f)){let a=s(y,r),o=m(e,r,i);for(let e of o){let t=C(e.name);t!==e.name&&(b.push({start:e.nameStart,end:e.nameEnd,text:t}),x.push({line:s(y,e.nameStart),from:e.name,to:t}))}let c=o.map(e=>C(e.name));for(let e of o){let t=C(e.name);if(!Object.hasOwn(n.valueMaps,t))continue;let r=h(e);if(r!==void 0&&Object.hasOwn(n.valueMaps[t],r.value)){let e=n.valueMaps[t][r.value];b.push({start:r.start,end:r.end,text:e}),x.push({line:s(y,r.start),from:`${t}="${r.value}"`,to:`${t}="${e}"`})}}let l=Object.entries(n.addProps).filter(([e])=>!c.includes(e)).map(([e,t])=>` ${e}=${typeof t==`string`?`"${t}"`:`{${t}}`}`);l.length>0&&b.push({start:r,end:r,text:l.join(``)}),(_||l.length>0)&&x.push({line:a,from:`<${f}`,to:`<${p}${l.join(``)}`}),_&&b.push({start:r-f.length,end:r,text:p});for(let[e,r]of Object.entries(n.removeProps))o.some(t=>t.name===e)&&S.push({file:t,line:a,path:`<${n.from}> ${e}`,message:r})}if(_)for(let t of e.matchAll(RegExp(`</${i(f)}(?=\\s*>)`,`g`))){let e=t.index+2;b.push({start:e,end:e+f.length,text:p}),x.push({line:s(y,e),from:`</${f}`,to:`</${p}`})}b.sort((e,t)=>t.start-e.start||t.end-e.end);let w=e;for(let e of b)w=w.slice(0,e.start)+e.text+w.slice(e.end);return{text:w,hits:x,findings:S}}function v(t,n,r){if(r.length===0||!e.has(a(n)))return{text:t,hits:[],findings:[]};let i=t,o=[],s=[];for(let e of r){let t=_(i,n,e);i=t.text,o.push(...t.hits),s.push(...t.findings)}return o.sort((e,t)=>e.line-t.line||c(e.from,t.from)),s.sort((e,t)=>e.line-t.line||c(e.path,t.path)),{text:i,hits:o,findings:s}}export{v as applyComponents};
@@ -1,5 +1,5 @@
1
- import{brand as e}from"../build.js";import{applyCssTable as t,isCssTarget as n}from"./css.js";import{applyRazorAttributes as r}from"./razorAttributes.js";import{applySource as i}from"./source.js";import{applyPropSplits as a,applyPropValues as o,applyProps as s,applyThemeReads as c}from"./themeReads.js";import{createRequire as l}from"node:module";import{existsSync as u,readFileSync as d,readdirSync as f,writeFileSync as p}from"node:fs";import{dirname as m,join as h}from"node:path";import{fileURLToPath as g,pathToFileURL as _}from"node:url";import{spawnSync as v}from"node:child_process";var y=/^\d+\.\d+\.\d+$/,b=/^(?:workspace:|file:|link:)/,x=`WEBORITY_UPGRADE_FROM`;function S(e){if(typeof e!=`string`||!y.test(e))throw Error(`invalid version "${e}"`)}function C(e,t){S(e),S(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 w(){let e=m(g(import.meta.url));for(;;){let t=h(e,`package.json`);if(u(t)&&JSON.parse(d(t,`utf8`)).name===`@webority/tokens`)return e;let n=m(e);if(n===e)throw Error(`cannot find the @webority/tokens package folder`);e=n}}function T(e){let t=[];for(let n of f(e)){if(!n.endsWith(`.json`))continue;let r=n.slice(0,-5);y.test(r)&&t.push({version:r,table:JSON.parse(d(h(e,n),`utf8`))})}return t.sort((e,t)=>C(e.version,t.version))}function E(e,t){let n=v(`git`,[`ls-files`,`-z`,`--`,...t],{cwd:e,encoding:`utf8`,windowsHide:!0,maxBuffer:64*1024*1024});if(n.status!==0)throw Error(`not a git repository: ${e}`);let r=n.stdout.split(`\0`).filter(Boolean).map(e=>e.split(`\\`).join(`/`));return[...new Set(r)]}function D(e,t){let n=E(e,t??[`.`]);if(t!==void 0&&n.length===0)throw Error(`no tracked files under ${t.join(`, `)}`);return n}function O(e){return e.split(`/`).includes(`node_modules`)}function k(e,t){return[...new Set([...e,...t])]}function A(e,t,n){return T(e).filter(e=>C(e.version,t)>0&&C(e.version,n)<=0).map(e=>e.table)}function j(e,l,u,f,m){f&&m(`dry run: nothing written`);let g=[],_=[],v=[];for(let y of l){if(!n(y))continue;let l=d(h(e,y),`utf8`),b=l,x=e=>{for(let t of e)g.push({file:y,line:t.line,from:t.from,to:t.to}),m(`${y}:${t.line} ${t.from} -> ${t.to}`)},S=e=>{_.push({file:y,line:e.line,name:e.name,hint:e.hint}),m(`choose ${y}:${e.line} ${e.name}: ${e.hint}`)},C=e=>{for(let t of e)t.message.startsWith(`skipped, it does not parse`)?m(`skipped ${y}: ${t.message}`):S({line:t.line,name:t.path,hint:t.message})};for(let e of u){let n=t(b,y,e);b=n.text,x(n.hits);for(let e of n.choose)S(e);for(let e of n.checkRole)m(`verify ${y}:${e.line} ${e.from} -> ${e.to}`);let l=c(b,y,e.themeReads);b=l.text,x(l.hits),C(l.findings);let u=[t=>s(t,y,e.props),t=>o(t,y,e.propValues),t=>a(t,y,e.propSplits),t=>r(t,y,e.razorAttributes),t=>i(t,y,e.source)];for(let e of u){let t=e(b);b=t.text,x(t.hits),C(t.findings)}}b!==l&&(v.push(y),f||p(h(e,y),b,`utf8`))}return{hits:g,choose:_,changedFiles:v}}function M(e){let t=/^([ \t]+)\S/m.exec(e);return t?t[1]:4}function N(e,t,n,r,i){let a=[];for(let o of E(e,[`package.json`,`:(glob)**/package.json`])){if(O(o))continue;let s=d(h(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];b.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,M(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}from"./css.js";import{applyRazorAttributes as a}from"./razorAttributes.js";import{applyRazorTags as o}from"./razorTags.js";import{applyMarkup as s,applySource as c}from"./source.js";import{applyComponentProps as l,applyPropSplits as u,applyPropValues as d,applyProps as f,applyThemeReads as p}from"./themeReads.js";import{createRequire as m}from"node:module";import{existsSync as h,readFileSync as g,readdirSync as _,writeFileSync as v}from"node:fs";import{dirname as y,join as b}from"node:path";import{fileURLToPath as x,pathToFileURL as S}from"node:url";import{spawnSync as C}from"node:child_process";var w=/^\d+\.\d+\.\d+$/,T=/^(?:workspace:|file:|link:)/,E=`WEBORITY_UPGRADE_FROM`;function D(e){if(typeof e!=`string`||!w.test(e))throw Error(`invalid version "${e}"`)}function O(e,t){D(e),D(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 k(){let e=y(x(import.meta.url));for(;;){let t=b(e,`package.json`);if(h(t)&&JSON.parse(g(t,`utf8`)).name===`@webority/tokens`)return e;let n=y(e);if(n===e)throw Error(`cannot find the @webority/tokens package folder`);e=n}}function A(e){let t=[];for(let n of _(e)){if(!n.endsWith(`.json`))continue;let r=n.slice(0,-5);w.test(r)&&t.push({version:r,table:JSON.parse(g(b(e,n),`utf8`))})}return t.sort((e,t)=>O(e.version,t.version))}function j(e,t){let n=C(`git`,[`ls-files`,`-z`,`--`,...t],{cwd:e,encoding:`utf8`,windowsHide:!0,maxBuffer:64*1024*1024});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=>h(b(e,t)));return[...new Set(r)]}function M(e,t){let n=j(e,t??[`.`]);if(t!==void 0&&n.length===0)throw Error(`no tracked files under ${t.join(`, `)}`);return n}function N(e){return e.split(`/`).includes(`node_modules`)}var P=new Set([`node_modules`,`vendor`,`vendors`,`external`]),F=/\.(?:min|bundle)\.(?:js|css)$/;function I(e){let t=e.split(`/`);return t.some(e=>P.has(e))||t.some((e,n)=>e===`lib`&&t[n-1]===`wwwroot`)?!0:F.test(e)}function L(e,t){return[...new Set([...e,...t])]}function R(e,t,n){return A(e).filter(e=>O(e.version,t)>0&&O(e.version,n)<=0).map(e=>e.table)}function z(e,m,h,_,y){_&&y(`dry run: nothing written`);let x=[],S=[],C=[];for(let w of m){if(!i(w)||I(w))continue;let m=g(b(e,w),`utf8`),T=m,E=e=>{for(let t of e)x.push({file:w,line:t.line,from:t.from,to:t.to}),y(`${w}:${t.line} ${t.from} -> ${t.to}`)},D=e=>{S.push({file:w,line:e.line,name:e.name,hint:e.hint}),y(`choose ${w}:${e.line} ${e.name}: ${e.hint}`)},O=e=>{for(let t of e)t.message.startsWith(`skipped, it does not parse`)?y(`skipped ${w}: ${t.message}`):D({line:t.line,name:t.path,hint:t.message})};for(let e of h){let i=r(T,w,e);T=i.text,E(i.hits);for(let e of i.choose)D(e);for(let e of i.checkRole)y(`verify ${w}:${e.line} ${e.from} -> ${e.to}`);let m=p(T,w,e.themeReads);T=m.text,E(m.hits),O(m.findings);let h=[t=>f(t,w,e.props),t=>l(t,w,e.componentProps),t=>d(t,w,e.propValues),t=>u(t,w,e.propSplits),t=>a(t,w,e.razorAttributes),t=>n(t,w,e.components??[]),t=>o(t,w,e.razorTags??[]),n=>t(n,w,e.classes??[]),t=>s(t,w,e.markup),t=>c(t,w,e.source)];for(let e of h){let t=e(T);T=t.text,E(t.hits),O(t.findings)}}T!==m&&(C.push(w),_||v(b(e,w),T,`utf8`))}return{hits:x,choose:S,changedFiles:C}}function B(e){let t=/^([ \t]+)\S/m.exec(e);return t?t[1]:4}function V(e,t,n,r,i){let a=[];for(let o of j(e,[`package.json`,`:(glob)**/package.json`])){if(N(o))continue;let s=g(b(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];T.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,B(s));s.endsWith(`
2
2
  `)&&(t+=`
3
3
  `),s.includes(`\r
4
4
  `)&&(t=t.replace(/\n/g,`\r
5
- `)),p(h(e,o),t,`utf8`)}}return a}function P(e,t,n,r,i){let a=[];for(let o of E(e,[`Directory.Packages.props`,`:(glob)**/Directory.Packages.props`])){if(O(o))continue;let s=d(h(e,o),`utf8`),c=!1,l=s.replace(/<PackageVersion\b[^>]*>/g,e=>{let r=/\sInclude="([^"]*)"/.exec(e)?.[1],a=/\sVersion="([^"]*)"/.exec(e)?.[1];return r===void 0||a===void 0||!n.nuget.includes(r)||a===t?e:(i(`pin ${o}: ${r} ${a} -> ${t}`),c=!0,e.replace(/(\sVersion=")[^"]*(")/,`$1${t}$2`))});c&&(a.push(o),r&&p(h(e,o),l,`utf8`))}return a}function F(e){let t;try{t=l(h(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(d(t,`utf8`))}function I(e,t,n){return v(e,t,{cwd:n.cwd,env:process.env,stdio:`inherit`,windowsHide:!0,shell:process.platform===`win32`})}async function L({root:e,version:t,from:n}){let r=l(h(e,`package.json`)).resolve(`@webority/tokens`);process.env[x]=n;try{return await(await import(_(r).href)).upgrade({root:e,version:t,dryRun:!1})}finally{delete process.env[x]}}async function R({root:e,version:t,dryRun:n,from:r,dir:i,log:a,brandFn:o}){let s=T(i);if(!n&&!s.some(e=>e.version===t))throw Error(`no rename table for ${t}`);let c=s.filter(e=>C(e.version,r)>0&&C(e.version,t)<=0).map(e=>e.table),l=j(e,D(e),c,n,a);return n||await o({root:e}),l}async function z({root:e,version:t,dryRun:n,deps:r,log:i}){let a=h(e,`node_modules`,`@webority`,`tokens`,`package.json`);if(!u(a))throw Error(`@webority/tokens is not installed; add it at the lockstep version and run again`);let o=JSON.parse(d(a,`utf8`)).version,s=F(e),c=[...N(e,t,s,!n,i),...P(e,t,s,!n,i)];if(n){i(`dry run: install skipped; tables are those of the installed ${o}`);let n=A(r.renamesDir??h(e,`node_modules`,`@webority`,`tokens`,`renames`),o,t),a=j(e,D(e),n,!0,i);return{...a,changedFiles:k(c,a.changedFiles)}}let{status:l}=await(r.run??I)(`corepack`,[`pnpm`,`install`],{cwd:e});if(l!==0)throw Error(`pnpm install failed with exit code ${l}`);let f=await(r.reenter??L)({root:e,version:t,dryRun:!1,from:o});return{...f,changedFiles:k(c,f.changedFiles)}}async function B(t,n={}){let r=t.version;S(r);let i=t.root??process.cwd(),a=t.dryRun??!1,o=n.log??console.log,s=()=>n.renamesDir??h(w(),`renames`);if(Array.isArray(t.paths)&&t.paths.length>0){let e=T(s()).filter(e=>e.version===r).map(e=>e.table);if(e.length===0)throw Error(`no rename table for ${r}`);return j(i,D(i,t.paths),e,a,o)}if(!u(h(i,`.webority`,`design.json`)))throw Error(`write .webority/design.json (design-map.md) and run again`);let c=process.env[x];return c?R({root:i,version:r,dryRun:a,from:c,dir:s(),log:o,brandFn:n.brand??e}):z({root:i,version:r,dryRun:a,deps:n,log:o})}export{B as upgrade};
5
+ `)),v(b(e,o),t,`utf8`)}}return a}function H(e,t,n,r,i){let a=[];for(let o of j(e,[`Directory.Packages.props`,`:(glob)**/Directory.Packages.props`])){if(N(o))continue;let s=g(b(e,o),`utf8`),c=!1,l=s.replace(/<PackageVersion\b[^>]*>/g,e=>{let r=/\sInclude="([^"]*)"/.exec(e)?.[1],a=/\sVersion="([^"]*)"/.exec(e)?.[1];return r===void 0||a===void 0||!n.nuget.includes(r)||a===t?e:(i(`pin ${o}: ${r} ${a} -> ${t}`),c=!0,e.replace(/(\sVersion=")[^"]*(")/,`$1${t}$2`))});c&&(a.push(o),r&&v(b(e,o),l,`utf8`))}return a}function U(e){let t;try{t=m(b(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(g(t,`utf8`))}function W(e,t,n){return C(e,t,{cwd:n.cwd,env:process.env,stdio:`inherit`,windowsHide:!0,shell:process.platform===`win32`})}async function G({root:e,version:t,from:n}){let r=m(b(e,`package.json`)).resolve(`@webority/tokens`);process.env[E]=n;try{return await(await import(S(r).href)).upgrade({root:e,version:t,dryRun:!1})}finally{delete process.env[E]}}async function K({root:e,version:t,dryRun:n,from:r,dir:i,log:a,brandFn:o}){let s=A(i);if(!n&&!s.some(e=>e.version===t))throw Error(`no rename table for ${t}`);let c=s.filter(e=>O(e.version,r)>0&&O(e.version,t)<=0).map(e=>e.table),l=z(e,M(e),c,n,a);return n||await o({root:e}),l}async function q({root:e,version:t,dryRun:n,deps:r,log:i}){let a=b(e,`node_modules`,`@webority`,`tokens`,`package.json`);if(!h(a))throw Error(`@webority/tokens is not installed; add it at the lockstep version and run again`);let o=JSON.parse(g(a,`utf8`)).version,s=U(e),c=[...V(e,t,s,!n,i),...H(e,t,s,!n,i)];if(n){i(`dry run: install skipped; tables are those of the installed ${o}`);let n=R(r.renamesDir??b(e,`node_modules`,`@webority`,`tokens`,`renames`),o,t),a=z(e,M(e),n,!0,i);return{...a,changedFiles:L(c,a.changedFiles)}}let{status:l}=await(r.run??W)(`corepack`,[`pnpm`,`install`],{cwd:e});if(l!==0)throw Error(`pnpm install failed with exit code ${l}`);let u=await(r.reenter??G)({root:e,version:t,dryRun:!1,from:o});return{...u,changedFiles:L(c,u.changedFiles)}}async function J(t,n={}){let r=t.version;D(r);let i=t.root??process.cwd(),a=t.dryRun??!1,o=n.log??console.log,s=()=>n.renamesDir??b(k(),`renames`);if(Array.isArray(t.paths)&&t.paths.length>0){let e=A(s()).filter(e=>e.version===r).map(e=>e.table);if(e.length===0)throw Error(`no rename table for ${r}`);return z(i,M(i,t.paths),e,a,o)}if(!h(b(i,`.webority`,`design.json`)))throw Error(`write .webority/design.json (design-map.md) and run again`);let c=process.env[E];return c?K({root:i,version:r,dryRun:a,from:c,dir:s(),log:o,brandFn:n.brand??e}):q({root:i,version:r,dryRun:a,deps:n,log:o})}export{J as upgrade};
@@ -0,0 +1,2 @@
1
+ var e=new Set([`.cshtml`,`.razor`]),t=/(\s*)([^\s=/>"']+)(?:(\s*=\s*)(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/y,n=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),r=e=>{let t=/\.[^./]*$/.exec(e);return t?t[0].toLowerCase():``},i=e=>{let t=[0];for(let n=0;n<e.length;n++)e[n]===`
2
+ `&&t.push(n+1);return t},a=(e,t)=>{let n=0,r=e.length-1;for(;n<r;){let i=n+r+1>>1;e[i]<=t?n=i:r=i-1}return n+1},o=(e,t)=>e<t?-1:+(e>t);function s(e,t){let n=``;for(let r=t;r<e.length;r++){let t=e[r];if(n)t===n&&(n=``);else if(t===`"`||t===`'`)n=t;else if(t===`>`)return r}return-1}function c(e,t){let n=`<${t}`,r=[];for(let t=e.indexOf(n);t!==-1;t=e.indexOf(n,t+1)){let i=t+n.length;if(!/[\s/>]/.test(e[i]??``))continue;let a=s(e,i);a!==-1&&r.push({nameEnd:i,end:a})}return r}function l(e,n,r){let i=[],a=n;for(;;){t.lastIndex=a;let n=t.exec(e);if(n===null||n.index+n[0].length>r)break;let o=n.index+n[1].length,s={name:n[2],nameStart:o,nameEnd:o+n[2].length,kind:`none`};if(n[4]!==void 0||n[5]!==void 0){let e=n[4]??n[5],t=n.index+n[0].length-1;s.kind=`quoted`,s.value=e,s.valueStart=t-e.length,s.valueEnd=t,s.attrEnd=n.index+n[0].length}else n[6]===void 0?s.attrEnd=s.nameEnd:(s.kind=`bare`,s.attrEnd=n.index+n[0].length);s.wsStart=n.index,i.push(s),a=n.index+n[0].length}return i}function u(e,t,r,i){let o=[],s=[],u=[],d=e=>Object.hasOwn(t.renameAttributes,e)?t.renameAttributes[e]:e,f=t.from!==t.to;for(let{nameEnd:n,end:p}of c(e,t.from)){let c=a(r,n),m=e.slice(n,p).trimEnd().endsWith(`/`),h=l(e,n,p);for(let[e,n]of Object.entries(t.removeAttributes))h.some(t=>t.name===e)&&u.push({file:i,line:c,path:`<${t.from}> ${e}`,message:n});let g=[];for(let e of h){let t=d(e.name);t!==e.name&&(o.push({start:e.nameStart,end:e.nameEnd,text:t}),s.push({line:a(r,e.nameStart),from:e.name,to:t}))}let _=h.map(e=>d(e.name));for(let e of h){let n=d(e.name);if(e.kind!==`quoted`||!Object.hasOwn(t.valueMaps,n)||!Object.hasOwn(t.valueMaps[n],e.value))continue;let i=t.valueMaps[n][e.value];o.push({start:e.valueStart,end:e.valueEnd,text:i}),s.push({line:a(r,e.valueStart),from:`${n}="${e.value}"`,to:`${n}="${i}"`})}for(let[e,n]of Object.entries(t.addAttributes))_.includes(e)||g.push(` ${e}="${n}"`);g.length>0&&o.push({start:n,end:n,text:g.join(``)}),(f||g.length>0)&&s.push({line:c,from:`<${t.from}`,to:`<${t.to}${g.join(``)}`}),f&&o.push({start:n-t.from.length,end:n,text:t.to});let v=t.attributeToContent===void 0?void 0:h.find(e=>e.name===t.attributeToContent);if(v===void 0)continue;if(v.kind!==`quoted`){u.push({file:i,line:c,path:`<${t.from}> ${v.name}`,message:`${v.name} must hold a value that becomes the element content; set it by hand`});continue}if(o.push({start:v.wsStart,end:v.attrEnd,text:``}),s.push({line:c,from:`${v.name}="${v.value}"`,to:`element content`}),m){let n=e.lastIndexOf(`/`,p);for(;/\s/.test(e[n-1]??``);)n--;o.push({start:n,end:p+1,text:`>${v.value}</${t.to}>`});continue}let y=e.indexOf(`</${t.from}`,p+1);if(y===-1)throw Error(`no closing </${t.from}> for the element at ${i}:${c}`);if(e.slice(p+1,y).trim()!==``){u.push({file:i,line:c,path:`<${t.from}> ${v.name}`,message:`the element already has content; move ${v.name} into it by hand`}),o.pop(),s.pop();continue}o.push({start:p+1,end:y,text:v.value})}if(f)for(let i of e.matchAll(RegExp(`</${n(t.from)}(?=\\s*>)`,`g`))){let e=i.index+2;o.push({start:e,end:e+t.from.length,text:t.to}),s.push({line:a(r,e),from:`</${t.from}`,to:`</${t.to}`})}return{edits:o,hits:s,findings:u}}function d(e,t,n){let{edits:r,hits:a,findings:o}=u(e,n,i(e),t);r.sort((e,t)=>t.start-e.start||t.end-e.end);let s=e;for(let e of r)s=s.slice(0,e.start)+e.text+s.slice(e.end);return{text:s,hits:a,findings:o}}function f(t,n,i){if(i.length===0||!e.has(r(n)))return{text:t,hits:[],findings:[]};let a=t,s=[],c=[];for(let e of i){let t=d(a,n,e);a=t.text,s.push(...t.hits),c.push(...t.findings)}return s.sort((e,t)=>e.line-t.line||o(e.from,t.from)),c.sort((e,t)=>e.line-t.line||o(e.path,t.path)),{text:a,hits:s,findings:c}}export{f as applyRazorTags};
@@ -1,3 +1,3 @@
1
- import e from"node:path";var t=new Set([`.js`,`.jsx`,`.mjs`,`.cjs`,`.ts`,`.tsx`,`.mts`,`.cts`]),n=`["'\`]`,r=`[A-Za-z_$][\\w$]*`,i=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),a=e=>[...e].sort((e,t)=>t.length-e.length).map(i).join(`|`),o=e=>{let t=[0];for(let n=0;n<e.length;n++)e[n]===`
2
- `&&t.push(n+1);return t},s=(e,t)=>{let n=0,r=e.length-1;for(;n<r;){let i=n+r+1>>1;e[i]<=t?n=i:r=i-1}return n+1},c=(e,t)=>e<t?-1:+(e>t),l=(e,t,r)=>{if(t.length===0)return e;let i=new Map(t),c=RegExp(`(${n})(${a(i.keys())})\\1`,`g`),l=o(e);return e.replace(c,(e,t,n,a)=>{let o=i.get(n);return r.push({line:s(l,a),from:n,to:o}),`${t}${o}${t}`})},u=(e,t,n)=>{let a=e;for(let e of t){let t=e.receiver===void 0?void 0:RegExp(`^(?:${e.receiver})$`),c=RegExp(`(${r})(\\?\\.|\\.)${i(e.from)}(?![\\w$])`,`g`),l=o(a);a=a.replace(c,(r,i,a,o)=>t!==void 0&&!t.test(i)?r:(n.push({line:s(l,o),from:`${i}${a}${e.from}`,to:`${i}${a}${e.to}`}),`${i}${a}${e.to}`))}return a},d=(e,t)=>{let n=e.split(`
3
- `),r=[];for(let e of t){let t=new RegExp(e.pattern);for(let i=0;i<n.length;i++){let a=t.exec(n[i]);a!==null&&r.push({line:i+1,path:a[0],message:e.hint})}}return r};function f(n,r,i){if(i===void 0||!t.has(e.extname(r).toLowerCase()))return{text:n,hits:[],findings:[]};let a=[],o=u(l(n,i.literals,a),i.members,a),s=d(o,i.flags);return a.sort((e,t)=>e.line-t.line||c(e.from,t.from)),s.sort((e,t)=>e.line-t.line||c(e.path,t.path)),{text:o,hits:a,findings:s}}export{t as SOURCE_EXTENSIONS,f as applySource};
1
+ import e from"node:path";var t=new Set([`.js`,`.jsx`,`.mjs`,`.cjs`,`.ts`,`.tsx`,`.mts`,`.cts`]),n=new Set([`.cshtml`,`.razor`,`.html`]),r=`["'\`]`,i=`[A-Za-z_$][\\w$]*`,a=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),o=e=>[...e].sort((e,t)=>t.length-e.length).map(a).join(`|`),s=e=>{let t=[0];for(let n=0;n<e.length;n++)e[n]===`
2
+ `&&t.push(n+1);return t},c=(e,t)=>{let n=0,r=e.length-1;for(;n<r;){let i=n+r+1>>1;e[i]<=t?n=i:r=i-1}return n+1},l=(e,t)=>e<t?-1:+(e>t),u=(e,t,n)=>{if(t.length===0)return e;let i=new Map(t),a=RegExp(`(${r})(${o(i.keys())})\\1`,`g`),l=s(e);return e.replace(a,(e,t,r,a)=>{let o=i.get(r);return n.push({line:c(l,a),from:r,to:o}),`${t}${o}${t}`})},d=(e,t,n)=>{let r=e;for(let e of t){let t=e.receiver===void 0?void 0:RegExp(`^(?:${e.receiver})$`),o=RegExp(`(${i})(\\?\\.|\\.)${a(e.from)}(?![\\w$])`,`g`),l=s(r);r=r.replace(o,(r,i,a,o)=>t!==void 0&&!t.test(i)?r:(n.push({line:c(l,o),from:`${i}${a}${e.from}`,to:`${i}${a}${e.to}`}),`${i}${a}${e.to}`))}return r},f=(e,t)=>{let n=e.split(`
3
+ `),r=[];for(let e of t){let t=new RegExp(e.pattern);for(let i=0;i<n.length;i++){let a=t.exec(n[i]);a!==null&&r.push({line:i+1,path:a[0],message:e.hint})}}return r};function p(n,r,i){if(i===void 0||!t.has(e.extname(r).toLowerCase()))return{text:n,hits:[],findings:[]};let a=[],o=d(u(n,i.literals,a),i.members,a),s=f(o,i.flags);return a.sort((e,t)=>e.line-t.line||l(e.from,t.from)),s.sort((e,t)=>e.line-t.line||l(e.path,t.path)),{text:o,hits:a,findings:s}}function m(t,r,i){if(i===void 0||!n.has(e.extname(r).toLowerCase()))return{text:t,hits:[],findings:[]};let a=[],o=u(t,i.literals,a),s=f(o,i.flags);return a.sort((e,t)=>e.line-t.line||l(e.from,t.from)),s.sort((e,t)=>e.line-t.line||l(e.path,t.path)),{text:o,hits:a,findings:s}}export{t as SOURCE_EXTENSIONS,m as applyMarkup,p as applySource};
@@ -1,2 +1,2 @@
1
1
  import e from"node:path";import{parse as t}from"@babel/parser";var n=new Set([`FunctionDeclaration`,`FunctionExpression`,`ArrowFunctionExpression`,`ObjectMethod`,`ClassMethod`]),r=new Set([`MemberExpression`,`OptionalMemberExpression`]),i=new Set([`CallExpression`,`OptionalCallExpression`]),a=new Set([`useTheme`,`getTheme`]),o=new Set([`loc`,`start`,`end`,`extra`,`comments`,`leadingComments`,`trailingComments`,`innerComments`]),s=new Map([[`.js`,[`jsx`]],[`.jsx`,[`jsx`]],[`.mjs`,[`jsx`]],[`.cjs`,[`jsx`]],[`.ts`,[`typescript`]],[`.tsx`,[`typescript`,`jsx`]]]),c=/^[A-Za-z_$][\w$]*$/,l=new Set([`lightOverrides`,`darkOverrides`]),u=`move the brand into theme/brand.tokens.json, list the app under tokens.heads.phone, run webority brand, pass brand and settings`,d=e=>typeof e==`object`&&!!e&&typeof e.type==`string`,f=(e,t,n=[])=>{if(Array.isArray(e)){for(let r of e)f(r,t,n);return}if(!d(e))return;t(e,n);let r=[...n,e];for(let[n,i]of Object.entries(e))!o.has(n)&&typeof i==`object`&&i&&f(i,t,r)},p=(n,r)=>{let i=s.get(e.extname(r).toLowerCase());return i===void 0?null:t(n,{sourceType:`module`,plugins:i})},m=(e,t,n)=>({text:e,hits:[],findings:[{file:t,line:1,path:``,message:`skipped, it does not parse (${(n instanceof Error?n.message:String(n)).split(`
2
- `)[0]})`}]}),h=(e,t,n)=>{let r=[...t].sort((e,t)=>e.start-t.start||e.end-t.end),i=0;for(let e of r){if(e.start<i)throw Error(`two edits overlap in ${n}; fix it by hand`);i=e.end}let a=e;for(let e of r.reverse())a=a.slice(0,e.start)+e.text+a.slice(e.end);return a},g=e=>e.replace(/\.$/,``).split(`.`),_=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),v=(e,t)=>e<t?-1:+(e>t),y=(e,t)=>{let n=t.at(-1);return n!==void 0&&r.has(n.type)&&n.object===e},b=(e,t)=>d(e)&&i.has(e.type)&&e.callee.type===`Identifier`&&t.has(e.callee.name),x=e=>{for(let t=e.length-1;t>=0;t--)if(n.has(e[t].type))return e[t];return e.find(e=>e.type===`Program`)},S=(e,t)=>{let n=new Map;return f(e,(e,r)=>{if(e.type!==`VariableDeclarator`||e.id.type!==`Identifier`||!b(e.init,t))return;let i=x(r);n.has(i)||n.set(i,new Set),n.get(i)?.add(e.id.name)}),n},C=(e,t,r)=>t.some(t=>(n.has(t.type)||t.type===`Program`)&&r.get(t)?.has(e)===!0),w=(e,t,n,r)=>e.type===`Identifier`?e.name===`theme`&&r.size>0||C(e.name,t,n):b(e,r),T=e=>{if(e.computed!==!0&&e.property.type===`Identifier`)return e.property.name;if(e.computed===!0&&e.property.type===`StringLiteral`)return e.property.value};function E(e,t,n){if(n.length===0)return{text:e,hits:[],findings:[]};let i;try{i=p(e,t)}catch(n){return m(e,t,n)}if(i===null)return{text:e,hits:[],findings:[]};let o=new Set;f(i,e=>{if(!(e.type!==`ImportDeclaration`||!e.source.value.startsWith(`@webority/`)))for(let t of e.specifiers){if(t.type!==`ImportSpecifier`)continue;let e=t.imported.type===`StringLiteral`?t.imported.value:t.imported.name;a.has(e)&&o.add(t.local.name)}});let s=S(i,o),d=n.filter(e=>e.kind===`path`||e.kind===`prefix`||e.kind===`gone`).sort((e,t)=>g(t.from).length-g(e.from).length),b=n.filter(e=>e.kind===`kebab`),x=[],C=[],E=[],D=new Set,O=(e,n)=>{let r=`${e}:${n}`;D.has(r)||(D.add(r),E.push({file:t,line:e,path:n,message:u}))},k=(e,n)=>{let i=[],a=e;for(;r.has(a.type);)i.unshift(a),a=a.object;if(!w(a,n,s,o))return;let l=[];for(let e of i){let t=T(e);if(t===void 0)break;l.push(t)}let u=l.length;if(u===0)return;let f=[...l];for(let e of d){let n=g(e.from),r=e.kind===`prefix`&&e.from.endsWith(`.`);if(!(u<n.length||r&&u===n.length)&&n.every((e,t)=>l[t]===e)){if(e.kind===`gone`){E.push({file:t,line:i[n.length-1].property.loc.start.line,path:n.join(`.`),message:`no longer exists; ${e.hint}`});return}if(e.kind===`path`||e.kind===`prefix`){f=[...g(e.to),...l.slice(n.length)];break}}}for(let e of b){let t=e.under.split(`.`),n=t.length;if(f.length<=n||!t.every((e,t)=>f[t]===e))continue;let r=f[n];Object.hasOwn(e.names,r)&&(f[n]=e.names[r]);for(let e=n+1;e<f.length;e++)/[A-Z]/.test(f[e])&&(f[e]=f[e].replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase())}if(_(f,l))return;let p=f.map((e,t)=>{let n=i[t]?.optional===!0;return c.test(e)?`${n?`?.`:`.`}${e}`:`${n?`?.`:``}["${e}"]`}).join(``);x.push({start:a.end,end:i[u-1].end,text:p}),C.push({line:i[0].property.loc.start.line,from:l.join(`.`),to:f.join(`.`)})};return f(i,(e,t)=>{r.has(e.type)&&!y(e,t)&&k(e,t),e.type===`JSXAttribute`&&e.name.type===`JSXIdentifier`&&l.has(e.name.name)&&O(e.loc.start.line,e.name.name),e.type===`Identifier`&&e.name===`ThemeOverrides`&&O(e.loc.start.line,e.name)}),C.sort((e,t)=>e.line-t.line||v(e.from,t.from)),E.sort((e,t)=>e.line-t.line||v(e.path,t.path)),{text:h(e,x,t),hits:C,findings:E}}var D=(e,t,n)=>{if(e.type===`JSXIdentifier`)return t.has(e.name);if(e.type===`JSXMemberExpression`){let t=e;for(;t.type===`JSXMemberExpression`;)t=t.object;return t.type===`JSXIdentifier`&&n.has(t.name)}return!1},O=e=>{if(e?.type===`StringLiteral`)return e;if(e?.type===`JSXExpressionContainer`&&e.expression.type===`StringLiteral`)return e.expression};function k(e,t,n){if(n.length===0)return{text:e,hits:[],findings:[]};let r;try{r=p(e,t)}catch(n){return m(e,t,n)}if(r===null)return{text:e,hits:[],findings:[]};let i=[],a=[];for(let t of n){let n=new Set,o=new Set;f(r,e=>{if(!(e.type!==`ImportDeclaration`||e.source.value!==t.package))for(let t of e.specifiers)t.type===`ImportNamespaceSpecifier`?o.add(t.local.name):n.add(t.local.name)});let s=new Set(t.props);f(r,r=>{if(!(r.type!==`JSXOpeningElement`||!D(r.name,n,o)))for(let n of r.attributes){if(n.type!==`JSXAttribute`||n.name.type!==`JSXIdentifier`||!s.has(n.name.name))continue;let r=O(n.value);if(r===void 0||r.value!==t.from)continue;let o=e[r.start];i.push({start:r.start,end:r.end,text:`${o}${t.to}${o}`}),a.push({line:r.loc.start.line,from:`${n.name.name}="${t.from}"`,to:`${n.name.name}="${t.to}"`})}})}return a.sort((e,t)=>e.line-t.line||v(e.from,t.from)),{text:h(e,i,t),hits:a,findings:[]}}var A=(e,t)=>{let n=new Map,r=new Set;return f(e,e=>{if(!(e.type!==`ImportDeclaration`||e.source.value!==t))for(let t of e.specifiers)if(t.type===`ImportSpecifier`){let e=t.imported.type===`StringLiteral`?t.imported.value:t.imported.name;n.set(t.local.name,e)}else t.type===`ImportNamespaceSpecifier`&&r.add(t.local.name)}),{named:n,namespaces:r}},j=(e,t)=>{if(e.type===`JSXIdentifier`)return t.named.get(e.name);if(e.type===`JSXMemberExpression`&&e.object.type===`JSXIdentifier`&&t.namespaces.has(e.object.name))return e.property.name};function M(e,t,n){if(n.length===0)return{text:e,hits:[],findings:[]};let r;try{r=p(e,t)}catch(n){return m(e,t,n)}if(r===null)return{text:e,hits:[],findings:[]};let i=[],a=[],o=[];for(let s of n){let n=A(r,s.package);f(r,r=>{if(r.type!==`JSXOpeningElement`)return;let c=j(r.name,n);if(s.components.includes(c))for(let n of r.attributes){if(n.type!==`JSXAttribute`||n.name.type!==`JSXIdentifier`||n.name.name!==s.prop)continue;let r=n.value,l=n.loc.start.line,u=r?.type===`JSXExpressionContainer`?r.expression:void 0,d=r===null?!0:u?.type===`BooleanLiteral`?u.value:void 0,f;if(d!==void 0)f=`${s.prop}="${d?s.true:s.false}"`;else if(O(r)!==void 0)continue;else{o.push({file:t,line:l,path:`${c}.${s.prop}`,message:`${s.prop} takes a named value such as "${s.true}" or "${s.false}" now, not a boolean; set it by hand`});continue}i.push({start:n.start,end:n.end,text:f}),a.push({line:l,from:e.slice(n.start,n.end),to:f})}})}return a.sort((e,t)=>e.line-t.line||v(e.from,t.from)),o.sort((e,t)=>e.line-t.line||v(e.path,t.path)),{text:h(e,i,t),hits:a,findings:o}}function N(e,t,n){if(n.length===0)return{text:e,hits:[],findings:[]};let r;try{r=p(e,t)}catch(n){return m(e,t,n)}if(r===null)return{text:e,hits:[],findings:[]};let i=t=>e.slice(t.start,t.end),a=new Set([`ObjectExpression`,`Identifier`,`MemberExpression`,`OptionalMemberExpression`]),o=new Set([`SequenceExpression`,`AssignmentExpression`,`ConditionalExpression`,`YieldExpression`]),s=e=>{if(e?.type===`LogicalExpression`&&e.operator===`&&`)return{test:e.left,consequent:e.right};let t=e?.alternate;if(e?.type===`ConditionalExpression`&&(t.type===`NullLiteral`||t.type===`Identifier`&&t.name===`undefined`||t.type===`BooleanLiteral`&&t.value===!1))return{test:e.test,consequent:e.consequent}},c=e=>o.has(e.test.type)?`(${i(e.test)})`:i(e.test),l=[],u=[],d=[];for(let e of n){let n=A(r,e.package);f(r,r=>{if(r.type!==`JSXOpeningElement`)return;let o=j(r.name,n);if(!e.components.includes(o))return;let f=r.attributes.some(t=>t.type===`JSXAttribute`&&t.name.type===`JSXIdentifier`&&t.name.name===e.into);for(let n of r.attributes){if(n.type!==`JSXAttribute`||n.name.type!==`JSXIdentifier`||n.name.name!==e.prop)continue;let r=n.value,p=n.loc.start.line;if(O(r)!==void 0)continue;let m=`${o}.${e.prop}`;if(f){d.push({file:t,line:p,path:m,message:`already sets ${e.into}; set ${e.prop} to "${e.on}" or "${e.off}" by hand`});continue}let h=r?.type===`JSXExpressionContainer`?r.expression:void 0,g=r===null?!0:h?.type===`BooleanLiteral`?h.value:void 0,_=s(h),v;if(g!==void 0)v=`${e.prop}="${g?e.on:e.off}"`;else if(a.has(h?.type))v=`${e.prop}="${e.on}" ${e.into}={${i(h)}}`;else if(_!==void 0&&_.consequent.type===`BooleanLiteral`&&_.consequent.value===!0)v=`${e.prop}={${c(_)} ? "${e.on}" : "${e.off}"}`;else if(_!==void 0&&a.has(_.consequent.type))v=`${e.prop}={${c(_)} ? "${e.on}" : "${e.off}"} ${e.into}={${i(_.consequent)}}`;else{d.push({file:t,line:p,path:m,message:`${e.prop} takes "${e.on}" or "${e.off}" now, and its settings object moves to ${e.into}; set both by hand`});continue}l.push({start:n.start,end:n.end,text:v}),u.push({line:p,from:i(n),to:v})}})}return u.sort((e,t)=>e.line-t.line||v(e.from,t.from)),d.sort((e,t)=>e.line-t.line||v(e.path,t.path)),{text:h(e,l,t),hits:u,findings:d}}export{N as applyPropSplits,M as applyPropValues,k as applyProps,E as applyThemeReads};
2
+ `)[0]})`}]}),h=(e,t,n)=>{let r=[...t].sort((e,t)=>e.start-t.start||e.end-t.end),i=0;for(let e of r){if(e.start<i)throw Error(`two edits overlap in ${n}; fix it by hand`);i=e.end}let a=e;for(let e of r.reverse())a=a.slice(0,e.start)+e.text+a.slice(e.end);return a},g=e=>e.replace(/\.$/,``).split(`.`),_=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),v=(e,t)=>e<t?-1:+(e>t),y=(e,t)=>{let n=t.at(-1);return n!==void 0&&r.has(n.type)&&n.object===e},b=(e,t)=>d(e)&&i.has(e.type)&&e.callee.type===`Identifier`&&t.has(e.callee.name),x=e=>{for(let t=e.length-1;t>=0;t--)if(n.has(e[t].type))return e[t];return e.find(e=>e.type===`Program`)},S=(e,t)=>{let n=new Map;return f(e,(e,r)=>{if(e.type!==`VariableDeclarator`||e.id.type!==`Identifier`||!b(e.init,t))return;let i=x(r);n.has(i)||n.set(i,new Set),n.get(i)?.add(e.id.name)}),n},C=(e,t,r)=>t.some(t=>(n.has(t.type)||t.type===`Program`)&&r.get(t)?.has(e)===!0),w=(e,t,n,r)=>e.type===`Identifier`?e.name===`theme`&&r.size>0||C(e.name,t,n):b(e,r),T=e=>{if(e.computed!==!0&&e.property.type===`Identifier`)return e.property.name;if(e.computed===!0&&e.property.type===`StringLiteral`)return e.property.value};function E(e,t,n){if(n.length===0)return{text:e,hits:[],findings:[]};let i;try{i=p(e,t)}catch(n){return m(e,t,n)}if(i===null)return{text:e,hits:[],findings:[]};let o=new Set;f(i,e=>{if(!(e.type!==`ImportDeclaration`||!e.source.value.startsWith(`@webority/`)))for(let t of e.specifiers){if(t.type!==`ImportSpecifier`)continue;let e=t.imported.type===`StringLiteral`?t.imported.value:t.imported.name;a.has(e)&&o.add(t.local.name)}});let s=S(i,o),d=n.filter(e=>e.kind===`path`||e.kind===`prefix`||e.kind===`gone`).sort((e,t)=>g(t.from).length-g(e.from).length),b=n.filter(e=>e.kind===`kebab`),x=[],C=[],E=[],D=new Set,O=(e,n)=>{let r=`${e}:${n}`;D.has(r)||(D.add(r),E.push({file:t,line:e,path:n,message:u}))},k=(e,n)=>{let i=[],a=e;for(;r.has(a.type);)i.unshift(a),a=a.object;if(!w(a,n,s,o))return;let l=[];for(let e of i){let t=T(e);if(t===void 0)break;l.push(t)}let u=l.length;if(u===0)return;let f=[...l];for(let e of d){let n=g(e.from),r=e.kind===`prefix`&&e.from.endsWith(`.`);if(!(u<n.length||r&&u===n.length)&&n.every((e,t)=>l[t]===e)){if(e.kind===`gone`){E.push({file:t,line:i[n.length-1].property.loc.start.line,path:n.join(`.`),message:`no longer exists; ${e.hint}`});return}if(e.kind===`path`||e.kind===`prefix`){f=[...g(e.to),...l.slice(n.length)];break}}}for(let e of b){let t=e.under.split(`.`),n=t.length;if(f.length<=n||!t.every((e,t)=>f[t]===e))continue;let r=f[n];Object.hasOwn(e.names,r)&&(f[n]=e.names[r]);for(let e=n+1;e<f.length;e++)/[A-Z]/.test(f[e])&&(f[e]=f[e].replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase())}if(_(f,l))return;let p=f.map((e,t)=>{let n=i[t]?.optional===!0;return c.test(e)?`${n?`?.`:`.`}${e}`:`${n?`?.`:``}["${e}"]`}).join(``);x.push({start:a.end,end:i[u-1].end,text:p}),C.push({line:i[0].property.loc.start.line,from:l.join(`.`),to:f.join(`.`)})};return f(i,(e,t)=>{r.has(e.type)&&!y(e,t)&&k(e,t),e.type===`JSXAttribute`&&e.name.type===`JSXIdentifier`&&l.has(e.name.name)&&O(e.loc.start.line,e.name.name),e.type===`Identifier`&&e.name===`ThemeOverrides`&&O(e.loc.start.line,e.name)}),C.sort((e,t)=>e.line-t.line||v(e.from,t.from)),E.sort((e,t)=>e.line-t.line||v(e.path,t.path)),{text:h(e,x,t),hits:C,findings:E}}var D=(e,t,n)=>{if(e.type===`JSXIdentifier`)return t.has(e.name);if(e.type===`JSXMemberExpression`){let t=e;for(;t.type===`JSXMemberExpression`;)t=t.object;return t.type===`JSXIdentifier`&&n.has(t.name)}return!1},O=e=>{if(e?.type===`StringLiteral`)return e;if(e?.type===`JSXExpressionContainer`&&e.expression.type===`StringLiteral`)return e.expression};function k(e,t,n){if(n.length===0)return{text:e,hits:[],findings:[]};let r;try{r=p(e,t)}catch(n){return m(e,t,n)}if(r===null)return{text:e,hits:[],findings:[]};let i=[],a=[];for(let t of n){let n=new Set,o=new Set;f(r,e=>{if(!(e.type!==`ImportDeclaration`||e.source.value!==t.package))for(let t of e.specifiers)t.type===`ImportNamespaceSpecifier`?o.add(t.local.name):n.add(t.local.name)});let s=new Set(t.props);f(r,r=>{if(!(r.type!==`JSXOpeningElement`||!D(r.name,n,o)))for(let n of r.attributes){if(n.type!==`JSXAttribute`||n.name.type!==`JSXIdentifier`||!s.has(n.name.name))continue;let r=O(n.value);if(r===void 0||r.value!==t.from)continue;let o=e[r.start];i.push({start:r.start,end:r.end,text:`${o}${t.to}${o}`}),a.push({line:r.loc.start.line,from:`${n.name.name}="${t.from}"`,to:`${n.name.name}="${t.to}"`})}})}return a.sort((e,t)=>e.line-t.line||v(e.from,t.from)),{text:h(e,i,t),hits:a,findings:[]}}function A(e,t,n){if(n.length===0)return{text:e,hits:[],findings:[]};let r;try{r=p(e,t)}catch(n){return m(e,t,n)}if(r===null)return{text:e,hits:[],findings:[]};let i=[],a=[],o=[],s=new Set;for(let c of n){let n=N(r,c.package);f(r,r=>{if(r.type!==`JSXOpeningElement`)return;let l=P(r.name,n);if(c.components.includes(l))for(let n of r.attributes){if(n.type!==`JSXAttribute`||n.name.type!==`JSXIdentifier`||n.name.name!==c.prop||s.has(n.start))continue;s.add(n.start);let u=n.loc.start.line,d=`${l}.${c.prop}`;if(c.flag){o.push({file:t,line:u,path:d,message:c.flag});continue}if(c.to&&c.to!==c.prop&&r.attributes.some(e=>j(e,c.to))){o.push({file:t,line:u,path:d,message:`${l} already sets ${c.to}; merge ${c.prop} into it by hand`});continue}let f=n.value===null?void 0:O(n.value)?.value??null,p=c.prop,m=f,h=i.length;c.to&&c.to!==c.prop&&(i.push({start:n.name.start,end:n.name.end,text:c.to}),p=c.to);let g=O(n.value);if(c.values&&g!==void 0&&Object.hasOwn(c.values,g.value)){let t=e[g.start];m=c.values[g.value],i.push({start:g.start,end:g.end,text:`${t}${m}${t}`})}i.length!==h&&a.push({line:u,from:M(c.prop,f),to:M(p,m)})}})}return a.sort((e,t)=>e.line-t.line||v(e.from,t.from)),o.sort((e,t)=>e.line-t.line||v(e.path,t.path)),{text:h(e,i,t),hits:a,findings:o}}var j=(e,t)=>e.type===`JSXAttribute`&&e.name.type===`JSXIdentifier`&&e.name.name===t,M=(e,t)=>t===void 0?e:t===null?`${e}={...}`:`${e}="${t}"`,N=(e,t)=>{let n=new Map,r=new Set;return f(e,e=>{if(!(e.type!==`ImportDeclaration`||e.source.value!==t))for(let t of e.specifiers)if(t.type===`ImportSpecifier`){let e=t.imported.type===`StringLiteral`?t.imported.value:t.imported.name;n.set(t.local.name,e)}else t.type===`ImportNamespaceSpecifier`&&r.add(t.local.name)}),{named:n,namespaces:r}},P=(e,t)=>{if(e.type===`JSXIdentifier`)return t.named.get(e.name);if(e.type===`JSXMemberExpression`&&e.object.type===`JSXIdentifier`&&t.namespaces.has(e.object.name))return e.property.name};function F(e,t,n){if(n.length===0)return{text:e,hits:[],findings:[]};let r;try{r=p(e,t)}catch(n){return m(e,t,n)}if(r===null)return{text:e,hits:[],findings:[]};let i=[],a=[],o=[];for(let s of n){let n=N(r,s.package);f(r,r=>{if(r.type!==`JSXOpeningElement`)return;let c=P(r.name,n);if(s.components.includes(c))for(let n of r.attributes){if(n.type!==`JSXAttribute`||n.name.type!==`JSXIdentifier`||n.name.name!==s.prop)continue;let r=n.value,l=n.loc.start.line,u=r?.type===`JSXExpressionContainer`?r.expression:void 0,d=r===null?!0:u?.type===`BooleanLiteral`?u.value:void 0,f;if(d!==void 0)f=`${s.prop}="${d?s.true:s.false}"`;else if(O(r)!==void 0)continue;else{o.push({file:t,line:l,path:`${c}.${s.prop}`,message:`${s.prop} takes a named value such as "${s.true}" or "${s.false}" now, not a boolean; set it by hand`});continue}i.push({start:n.start,end:n.end,text:f}),a.push({line:l,from:e.slice(n.start,n.end),to:f})}})}return a.sort((e,t)=>e.line-t.line||v(e.from,t.from)),o.sort((e,t)=>e.line-t.line||v(e.path,t.path)),{text:h(e,i,t),hits:a,findings:o}}function I(e,t,n){if(n.length===0)return{text:e,hits:[],findings:[]};let r;try{r=p(e,t)}catch(n){return m(e,t,n)}if(r===null)return{text:e,hits:[],findings:[]};let i=t=>e.slice(t.start,t.end),a=new Set([`ObjectExpression`,`Identifier`,`MemberExpression`,`OptionalMemberExpression`]),o=new Set([`SequenceExpression`,`AssignmentExpression`,`ConditionalExpression`,`YieldExpression`]),s=e=>{if(e?.type===`LogicalExpression`&&e.operator===`&&`)return{test:e.left,consequent:e.right};let t=e?.alternate;if(e?.type===`ConditionalExpression`&&(t.type===`NullLiteral`||t.type===`Identifier`&&t.name===`undefined`||t.type===`BooleanLiteral`&&t.value===!1))return{test:e.test,consequent:e.consequent}},c=e=>o.has(e.test.type)?`(${i(e.test)})`:i(e.test),l=[],u=[],d=[];for(let e of n){let n=N(r,e.package);f(r,r=>{if(r.type!==`JSXOpeningElement`)return;let o=P(r.name,n);if(!e.components.includes(o))return;let f=r.attributes.some(t=>t.type===`JSXAttribute`&&t.name.type===`JSXIdentifier`&&t.name.name===e.into);for(let n of r.attributes){if(n.type!==`JSXAttribute`||n.name.type!==`JSXIdentifier`||n.name.name!==e.prop)continue;let r=n.value,p=n.loc.start.line;if(O(r)!==void 0)continue;let m=`${o}.${e.prop}`;if(f){d.push({file:t,line:p,path:m,message:`already sets ${e.into}; set ${e.prop} to "${e.on}" or "${e.off}" by hand`});continue}let h=r?.type===`JSXExpressionContainer`?r.expression:void 0,g=r===null?!0:h?.type===`BooleanLiteral`?h.value:void 0,_=s(h),v;if(g!==void 0)v=`${e.prop}="${g?e.on:e.off}"`;else if(a.has(h?.type))v=`${e.prop}="${e.on}" ${e.into}={${i(h)}}`;else if(_!==void 0&&_.consequent.type===`BooleanLiteral`&&_.consequent.value===!0)v=`${e.prop}={${c(_)} ? "${e.on}" : "${e.off}"}`;else if(_!==void 0&&a.has(_.consequent.type))v=`${e.prop}={${c(_)} ? "${e.on}" : "${e.off}"} ${e.into}={${i(_.consequent)}}`;else{d.push({file:t,line:p,path:m,message:`${e.prop} takes "${e.on}" or "${e.off}" now, and its settings object moves to ${e.into}; set both by hand`});continue}l.push({start:n.start,end:n.end,text:v}),u.push({line:p,from:i(n),to:v})}})}return u.sort((e,t)=>e.line-t.line||v(e.from,t.from)),d.sort((e,t)=>e.line-t.line||v(e.path,t.path)),{text:h(e,l,t),hits:u,findings:d}}export{A as applyComponentProps,I as applyPropSplits,F as applyPropValues,k as applyProps,E as applyThemeReads};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/tokens",
3
- "version": "0.106.0",
3
+ "version": "0.108.0",
4
4
  "description": "The Webority design tokens in one W3C Design Tokens source (palette, scale, meaning and component tiers, with light and dark, web and phone, and 390 and 1440 widths), and the webority command that brands a product, upgrades it between releases and checks it against the token source.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -0,0 +1,224 @@
1
+ {
2
+ "version": "0.108.0",
3
+ "css": {
4
+ "rename": [],
5
+ "reads": [],
6
+ "choose": {},
7
+ "checkRole": []
8
+ },
9
+ "themeReads": [],
10
+ "props": [],
11
+ "componentProps": [
12
+ {
13
+ "package": "@webority/mobile-ui",
14
+ "components": ["Banner", "Toast", "DatePicker", "DateRangePicker", "OptionSheet", "TimePicker"],
15
+ "prop": "onDismiss",
16
+ "to": "onClose"
17
+ },
18
+ { "package": "@webority/mobile-ui", "components": ["Modal"], "prop": "onRequestClose", "to": "onClose" },
19
+ { "package": "@webority/mobile-ui", "components": ["Chip"], "prop": "onClose", "to": "onRemove" },
20
+ { "package": "@webority/mobile-ui", "components": ["OptionSheet", "Menu", "Drawer"], "prop": "open", "to": "visible" },
21
+ {
22
+ "package": "@webority/mobile-ui",
23
+ "components": ["Select", "Menu", "OptionSheet"],
24
+ "prop": "onOpenChange",
25
+ "to": "onVisibleChange"
26
+ },
27
+ { "package": "@webority/mobile-ui", "components": ["FloatingActionButtonGroup"], "prop": "open", "to": "expanded" },
28
+ { "package": "@webority/mobile-ui", "components": ["FloatingActionButtonGroup"], "prop": "onOpenChange", "to": "onExpandedChange" },
29
+ { "package": "@webority/mobile-ui", "components": ["Button"], "prop": "title", "to": "label" },
30
+ { "package": "@webority/mobile-ui", "components": ["Button"], "prop": "children", "to": "label" },
31
+ { "package": "@webority/mobile-ui", "components": ["Badge", "StatusBadge"], "prop": "text", "to": "label" },
32
+ { "package": "@webority/mobile-ui", "components": ["ScannerOverlay"], "prop": "hint", "to": "helperText" },
33
+ { "package": "@webority/mobile-ui", "components": ["FilePicker", "Select"], "prop": "errorText", "to": "error" },
34
+ { "package": "@webority/mobile-ui", "components": ["Dialog", "Composer"], "prop": "busy", "to": "loading" },
35
+ {
36
+ "package": "@webority/mobile-ui",
37
+ "components": ["Dialog", "Banner", "Toast"],
38
+ "prop": "variant",
39
+ "to": "tone",
40
+ "values": { "default": "neutral" }
41
+ },
42
+ {
43
+ "package": "@webority/mobile-ui",
44
+ "components": ["Chip"],
45
+ "prop": "variant",
46
+ "values": { "filled": "solid", "outlined": "outline" }
47
+ },
48
+ {
49
+ "package": "@webority/mobile-ui",
50
+ "components": ["Card", "Input", "Select", "SearchBar", "FieldBase", "PickerTrigger"],
51
+ "prop": "variant",
52
+ "values": { "outlined": "outline" }
53
+ },
54
+ { "package": "@webority/mobile-ui", "components": ["Calendar"], "prop": "mode", "to": "selectionMode" },
55
+ {
56
+ "package": "@webority/mobile-ui",
57
+ "components": ["BottomSheet", "DatePicker"],
58
+ "prop": "mode",
59
+ "flag": "mode is gone: pass the boolean inline prop for mode 'inline', and drop mode for 'modal'"
60
+ },
61
+ {
62
+ "package": "@webority/mobile-ui",
63
+ "components": ["AmountSlider", "DecimalInput"],
64
+ "prop": "onChangeText",
65
+ "flag": "onChangeText is removed here: this component takes onChange(number or null) only, so derive the shown text from the number"
66
+ },
67
+ {
68
+ "package": "@webority/mobile-ui",
69
+ "components": ["FilterChipRow", "OptionSheet"],
70
+ "prop": "onSelect",
71
+ "flag": "a value pick is now value plus onChange: pass the held value as value and update it in onChange; a one-off pick keeps onSelect"
72
+ },
73
+ { "package": "@webority/mobile-ui", "components": ["OptionSheet"], "prop": "labelOf", "to": "getOptionLabel" },
74
+ { "package": "@webority/mobile-ui", "components": ["OptionSheet"], "prop": "getValue", "to": "getOptionValue" },
75
+ { "package": "@webority/mobile-ui", "components": ["OptionSheet"], "prop": "descriptionOf", "to": "getOptionDescription" },
76
+ { "package": "@webority/mobile-ui", "components": ["OptionSheet"], "prop": "disabledOf", "to": "isOptionDisabled" },
77
+ { "package": "@webority/mobile-ui", "components": ["OptionSheet"], "prop": "iconOf", "to": "getOptionIcon" },
78
+ { "package": "@webority/mobile-ui", "components": ["BottomSheet"], "prop": "confirmDismiss", "to": "onBeforeClose" },
79
+ {
80
+ "package": "@webority/mobile-ui",
81
+ "components": ["DatePicker", "DateRangePicker", "TimePicker"],
82
+ "prop": "confirmLabel",
83
+ "flag": "moved into the labels prop: pass labels with this text under the key of the component's Labels type"
84
+ },
85
+ {
86
+ "package": "@webority/mobile-ui",
87
+ "components": ["DatePicker", "DateRangePicker", "TimePicker"],
88
+ "prop": "cancelLabel",
89
+ "flag": "moved into the labels prop: pass labels with this text under the key of the component's Labels type"
90
+ },
91
+ {
92
+ "package": "@webority/mobile-ui",
93
+ "components": ["AsyncBlock"],
94
+ "prop": "retryLabel",
95
+ "flag": "moved into the labels prop: pass labels with this text under the key of the component's Labels type"
96
+ },
97
+ {
98
+ "package": "@webority/mobile-ui",
99
+ "components": ["ForceUpdateDialog"],
100
+ "prop": "updateLabel",
101
+ "flag": "moved into the labels prop: pass labels with this text under the key of the component's Labels type"
102
+ },
103
+ {
104
+ "package": "@webority/mobile-ui",
105
+ "components": ["ForceUpdateDialog"],
106
+ "prop": "laterLabel",
107
+ "flag": "moved into the labels prop: pass labels with this text under the key of the component's Labels type"
108
+ },
109
+ {
110
+ "package": "@webority/mobile-ui",
111
+ "components": ["Composer"],
112
+ "prop": "sendLabel",
113
+ "flag": "moved into the labels prop: pass labels with this text under the key of the component's Labels type"
114
+ },
115
+ {
116
+ "package": "@webority/mobile-ui",
117
+ "components": ["Card"],
118
+ "prop": "removeLabel",
119
+ "flag": "moved into the labels prop: pass labels with this text under the key of the component's Labels type"
120
+ },
121
+ {
122
+ "package": "@webority/mobile-ui",
123
+ "components": ["Toast"],
124
+ "prop": "undoLabel",
125
+ "flag": "moved into the labels prop: pass labels with this text under the key of the component's Labels type"
126
+ },
127
+ {
128
+ "package": "@webority/mobile-ui",
129
+ "components": ["OnboardingPager", "KeyboardToolbar"],
130
+ "prop": "doneLabel",
131
+ "flag": "moved into the labels prop: pass labels with this text under the key of the component's Labels type"
132
+ },
133
+ {
134
+ "package": "@webority/mobile-ui",
135
+ "components": ["Menu", "Tooltip"],
136
+ "prop": "closeLabel",
137
+ "flag": "moved into the labels prop: pass labels with this text under the key of the component's Labels type"
138
+ },
139
+ {
140
+ "package": "@webority/mobile-ui",
141
+ "components": ["Menu", "Tooltip"],
142
+ "prop": "backLabel",
143
+ "flag": "moved into the labels prop: pass labels with this text under the key of the component's Labels type"
144
+ },
145
+ {
146
+ "package": "@webority/mobile-ui",
147
+ "components": ["Autocomplete", "OptionSheet", "Repeater"],
148
+ "prop": "emptyText",
149
+ "flag": "moved into the labels prop: pass labels with this text under the key of the component's Labels type"
150
+ },
151
+ {
152
+ "package": "@webority/mobile-ui",
153
+ "components": ["Repeater"],
154
+ "prop": "addLabel",
155
+ "flag": "moved into the labels prop: pass labels with this text under the key of the component's Labels type"
156
+ },
157
+ {
158
+ "package": "@webority/mobile-ui",
159
+ "components": ["Repeater"],
160
+ "prop": "rowLabel",
161
+ "flag": "moved into the labels prop: pass labels with this text under the key of the component's Labels type"
162
+ },
163
+ {
164
+ "package": "@webority/mobile-ui",
165
+ "components": ["PhoneNumberInput"],
166
+ "prop": "allCountriesTitle",
167
+ "flag": "moved into the labels prop: pass labels with this text under the key of the component's Labels type"
168
+ },
169
+ {
170
+ "package": "@webority/mobile-ui",
171
+ "components": ["PhoneNumberInput"],
172
+ "prop": "countrySheetTitle",
173
+ "flag": "moved into the labels prop: pass labels with this text under the key of the component's Labels type"
174
+ },
175
+ {
176
+ "package": "@webority/mobile-ui",
177
+ "components": ["TimePicker"],
178
+ "prop": "title",
179
+ "flag": "moved into the labels prop: pass labels with this text under the key of the component's Labels type"
180
+ },
181
+ { "package": "@webority/mobile-ui", "components": ["Toast"], "prop": "containerStyle", "to": "style" }
182
+ ],
183
+ "propValues": [],
184
+ "propSplits": [],
185
+ "razorAttributes": [],
186
+ "source": {
187
+ "literals": [["outlined", "outline"]],
188
+ "members": [{ "from": "AppBarRightAction", "to": "AppBarAction" }],
189
+ "flags": [
190
+ {
191
+ "pattern": "<(?:Avatar|Rating|ProfilePicker|ProfileCompletion|Text)\\b[^>]*?\\bsize=(?:\\{\\s*\\d|\"\\d)",
192
+ "hint": "numeric size is removed from @webority/mobile-ui: pass a named size the component lists (xs to xl, or sm, md, lg)"
193
+ },
194
+ {
195
+ "pattern": "<Text\\b[^\\n]*?\\bcolor=\"#",
196
+ "hint": "raw color strings are refused by Text: pass a TextColor name or a tone (primary, success, warning, danger, info, neutral)"
197
+ },
198
+ {
199
+ "pattern": "\\bResponsive\\.",
200
+ "hint": "Responsive is removed from @webority/mobile-ui: size with theme.space and the text scale, never by screen width"
201
+ },
202
+ {
203
+ "pattern": "\\bScreenDimensions\\b",
204
+ "hint": "ScreenDimensions is removed from @webority/mobile-ui: size with theme.space and the text scale, never by screen width"
205
+ },
206
+ {
207
+ "pattern": "\\buseForm\\(",
208
+ "hint": "the deprecated form engine is removed from @webority/mobile-ui: keep form state in the screen or a form library (react-hook-form's useForm is unaffected)"
209
+ },
210
+ {
211
+ "pattern": "\\bBottomSheetRef\\b",
212
+ "hint": "BottomSheet's ref methods expand and collapse are removed: open and close the sheet with the visible prop"
213
+ },
214
+ {
215
+ "pattern": "\\bPaymentResult\\b",
216
+ "hint": "PaymentResult is removed from @webority/mobile-ui: delete the import and build the result screen in the app"
217
+ },
218
+ {
219
+ "pattern": "\\btone=(?:\"secondary\"|\\{\\s*\"secondary\"\\s*\\})",
220
+ "hint": "the secondary tone is removed: use tone 'neutral', which it already drew as"
221
+ }
222
+ ]
223
+ }
224
+ }
@@ -0,0 +1,299 @@
1
+ {
2
+ "version": "0.108.0",
3
+ "css": { "rename": [], "reads": [], "choose": {}, "checkRole": [] },
4
+ "themeReads": [],
5
+ "props": [],
6
+ "componentProps": [],
7
+ "propValues": [],
8
+ "propSplits": [],
9
+ "razorAttributes": [],
10
+ "components": [
11
+ {
12
+ "package": "@webority/ui-react",
13
+ "from": "AppSelectMini",
14
+ "to": "AppSelect",
15
+ "addProps": { "compact": true },
16
+ "renameProps": { "prefix": "valuePrefix", "ariaLabel": "aria-label" },
17
+ "valueMaps": {},
18
+ "removeProps": {}
19
+ },
20
+ {
21
+ "package": "@webority/ui-react",
22
+ "from": "AppInfoList",
23
+ "to": "AppDescriptions",
24
+ "addProps": { "layout": "list", "columns": 1 },
25
+ "renameProps": {},
26
+ "valueMaps": {},
27
+ "removeProps": {}
28
+ },
29
+ {
30
+ "package": "@webority/ui-react",
31
+ "from": "AppLogoPicker",
32
+ "to": "AppImagePicker",
33
+ "addProps": {},
34
+ "renameProps": {},
35
+ "valueMaps": {},
36
+ "removeProps": {}
37
+ },
38
+ {
39
+ "package": "@webority/ui-react",
40
+ "from": "AppAvatarPicker",
41
+ "to": "AppImagePicker",
42
+ "addProps": { "kind": "avatar" },
43
+ "renameProps": { "initials": "fallback" },
44
+ "valueMaps": {},
45
+ "removeProps": {}
46
+ },
47
+ {
48
+ "package": "@webority/ui-react",
49
+ "from": "AppPagination",
50
+ "to": "AppTablePagination",
51
+ "addProps": { "variant": "standalone" },
52
+ "renameProps": { "onChange": "onPageChange" },
53
+ "valueMaps": {},
54
+ "removeProps": {}
55
+ },
56
+ {
57
+ "package": "@webority/ui-react",
58
+ "from": "AppSidebarMenu",
59
+ "to": "AppDrawer",
60
+ "addProps": { "sheet": false, "width": "420px" },
61
+ "renameProps": { "show": "open", "onHide": "onClose", "onEntered": "onOpened", "onExited": "onClosed" },
62
+ "valueMaps": { "side": { "right": "end", "left": "start" } },
63
+ "removeProps": {
64
+ "backdrop": "removed: AppDrawer always draws its backdrop; use staticBackdrop to stop a click closing it",
65
+ "scroll": "removed: the page behind a drawer never scrolls",
66
+ "keyboard": "removed: Escape always closes; set dismissible={false} for a drawer only an action closes",
67
+ "responsive": "removed: no inline mode; render the content in the page at that width instead",
68
+ "closeButton": "removed: set dismissible={false}"
69
+ }
70
+ },
71
+ {
72
+ "package": "@webority/ui-react",
73
+ "from": "AppTableEmptyState",
74
+ "to": "AppEmptyState",
75
+ "addProps": { "variant": "table" },
76
+ "renameProps": {},
77
+ "valueMaps": {},
78
+ "removeProps": {}
79
+ },
80
+ {
81
+ "package": "@webority/ui-react",
82
+ "from": "AppStepper",
83
+ "to": "AppStepper",
84
+ "addProps": {},
85
+ "renameProps": { "activeStep": "active" },
86
+ "valueMaps": {},
87
+ "removeProps": {}
88
+ }
89
+ ],
90
+ "razorTags": [
91
+ {
92
+ "from": "app-select-mini",
93
+ "to": "app-select",
94
+ "addAttributes": { "compact": "true" },
95
+ "renameAttributes": { "prefix": "value-prefix" },
96
+ "valueMaps": {},
97
+ "removeAttributes": {}
98
+ },
99
+ {
100
+ "from": "app-info-list",
101
+ "to": "app-descriptions",
102
+ "addAttributes": { "layout": "list", "columns": "1" },
103
+ "renameAttributes": {},
104
+ "valueMaps": {},
105
+ "removeAttributes": {}
106
+ },
107
+ {
108
+ "from": "app-info-row",
109
+ "to": "app-description",
110
+ "addAttributes": {},
111
+ "renameAttributes": {},
112
+ "valueMaps": {},
113
+ "removeAttributes": {},
114
+ "attributeToContent": "value"
115
+ },
116
+ {
117
+ "from": "app-logo-picker",
118
+ "to": "app-image-picker",
119
+ "addAttributes": {},
120
+ "renameAttributes": {},
121
+ "valueMaps": {},
122
+ "removeAttributes": {}
123
+ },
124
+ {
125
+ "from": "app-avatar-picker",
126
+ "to": "app-image-picker",
127
+ "addAttributes": { "kind": "avatar" },
128
+ "renameAttributes": { "initials": "fallback" },
129
+ "valueMaps": {},
130
+ "removeAttributes": {}
131
+ },
132
+ {
133
+ "from": "app-pagination",
134
+ "to": "app-table-pagination",
135
+ "addAttributes": { "variant": "standalone" },
136
+ "renameAttributes": {},
137
+ "valueMaps": {},
138
+ "removeAttributes": {}
139
+ },
140
+ {
141
+ "from": "app-table-pagination",
142
+ "to": "app-table-pagination",
143
+ "addAttributes": {},
144
+ "renameAttributes": {},
145
+ "valueMaps": {},
146
+ "removeAttributes": {
147
+ "base-href": "removed: pass href-template=\"@Model.Query.PageHrefTemplate(path)\" (it carries {page} and {pageSize})",
148
+ "page-param": "removed: write the parameter name into href-template",
149
+ "page-size-param": "removed: write the parameter name into href-template"
150
+ }
151
+ },
152
+ {
153
+ "from": "app-sidebar-menu",
154
+ "to": "app-drawer",
155
+ "addAttributes": { "sheet": "false", "width": "420px" },
156
+ "renameAttributes": {},
157
+ "valueMaps": { "side": { "right": "end", "left": "start" } },
158
+ "removeAttributes": {
159
+ "backdrop": "removed: use static-backdrop",
160
+ "scroll": "removed",
161
+ "keyboard": "removed: use dismissible=\"false\"",
162
+ "responsive": "removed",
163
+ "close-button": "removed: use dismissible=\"false\""
164
+ }
165
+ },
166
+ {
167
+ "from": "app-sidebar-header",
168
+ "to": "app-drawer-header",
169
+ "addAttributes": {},
170
+ "renameAttributes": {},
171
+ "valueMaps": {},
172
+ "removeAttributes": {}
173
+ },
174
+ {
175
+ "from": "app-sidebar-footer",
176
+ "to": "app-drawer-footer",
177
+ "addAttributes": {},
178
+ "renameAttributes": {},
179
+ "valueMaps": {},
180
+ "removeAttributes": {}
181
+ },
182
+ {
183
+ "from": "app-table-empty-state",
184
+ "to": "app-empty-state",
185
+ "addAttributes": { "variant": "table" },
186
+ "renameAttributes": {},
187
+ "valueMaps": {},
188
+ "removeAttributes": {}
189
+ },
190
+ {
191
+ "from": "app-stepper",
192
+ "to": "app-stepper",
193
+ "addAttributes": {},
194
+ "renameAttributes": { "active-step": "active" },
195
+ "valueMaps": {},
196
+ "removeAttributes": {}
197
+ },
198
+ {
199
+ "from": "app-compare-row",
200
+ "to": "app-compare-row",
201
+ "addAttributes": {},
202
+ "renameAttributes": {},
203
+ "valueMaps": {},
204
+ "removeAttributes": { "values": "removed: write one <app-compare-cell> child per value, in column order" }
205
+ }
206
+ ],
207
+ "classes": [
208
+ ["faq-list", "wui-accordion"],
209
+ ["faq-item", "wui-accordion-item"],
210
+ ["faq-q", "wui-accordion-trigger"],
211
+ ["faq-q-icon", "wui-accordion-icon"],
212
+ ["faq-a-wrap", "wui-accordion-panel"],
213
+ ["faq-a-inner", "wui-accordion-body"],
214
+ ["set-uploader", "wui-image-picker"],
215
+ ["set-uploader-field", "wui-image-picker-field"],
216
+ ["set-uploader-field--inline", "wui-image-picker-field-inline"],
217
+ ["set-uploader-field--profile", "wui-image-picker-field-profile"],
218
+ ["set-uploader--avatar", "wui-image-picker-avatar"],
219
+ ["set-uploader--rounded", "wui-image-picker-rounded"],
220
+ ["set-uploader--square", "wui-image-picker-square"],
221
+ ["set-uploader-ring", "wui-image-picker-ring"],
222
+ ["set-uploader-img", "wui-image-picker-img"],
223
+ ["set-uploader-logo", "wui-image-picker-logo"],
224
+ ["set-uploader-overlay", "wui-image-picker-overlay"],
225
+ ["set-uploader-remove", "wui-image-picker-remove"],
226
+ ["set-uploader-meta", "wui-image-picker-meta"],
227
+ ["set-uploader-hint", "wui-image-picker-hint"],
228
+ ["set-uploader-title", "wui-image-picker-title"],
229
+ ["set-uploader-subtitle", "wui-image-picker-subtitle"],
230
+ ["set-uploader-row", "wui-image-picker-row"],
231
+ ["set-uploader-shell", "wui-image-picker-shell"],
232
+ ["wui-avatar-picker", "wui-image-picker-buttons"],
233
+ ["wui-avatar-picker-actions", "wui-image-picker-buttons-actions"],
234
+ ["wui-avatar-picker-badge", "wui-image-picker-buttons-badge"],
235
+ ["wui-avatar-picker-camera", "wui-image-picker-buttons-camera"],
236
+ ["wui-avatar-picker-face", "wui-image-picker-buttons-face"],
237
+ ["wui-avatar-picker-img", "wui-image-picker-buttons-img"],
238
+ ["wui-avatar-picker-placeholder", "wui-image-picker-buttons-placeholder"],
239
+ ["tbl-empty", "wui-empty-state-table"]
240
+ ],
241
+ "markup": {
242
+ "literals": [
243
+ ["wui:avatar-picker:change", "wui:image-picker:change"],
244
+ ["wui:avatar-picker:remove", "wui:image-picker:remove"],
245
+ ["data-app-logo-remove", "data-wui-image-picker-remove"],
246
+ ["[data-app-logo-remove]", "[data-wui-image-picker-remove]"]
247
+ ],
248
+ "flags": [
249
+ {
250
+ "pattern": "data-bs-toggle=\"offcanvas\"|data-bs-dismiss=\"offcanvas\"",
251
+ "hint": "the side panel is <app-drawer>: open it with data-wui-drawer-open=\"#id\", close with data-wui-drawer-close"
252
+ },
253
+ {
254
+ "pattern": "<app-menubar",
255
+ "hint": "removed in 0.108.0 with no successor: use <app-navigation-menu> for site navigation or <app-dropdown> for a menu"
256
+ },
257
+ {
258
+ "pattern": "class=\"[^\"]*\\b(info-row|info-value|info-list|info-icon|info-key|info-meta)\\b",
259
+ "hint": "the info list is <app-descriptions layout=\"list\">: rows are .descs-item, values .descs-value"
260
+ },
261
+ {
262
+ "pattern": "\\btbl-empty-(icon|title|text|action)\\b",
263
+ "hint": "inside the table empty state use .empty-state-icon, -title, -message, -action under .wui-empty-state-table"
264
+ },
265
+ {
266
+ "pattern": "\\b(pagination-nav|page-ellipsis)\\b",
267
+ "hint": "the standalone pager is .table-pagination.wui-table-pagination-standalone"
268
+ }
269
+ ]
270
+ },
271
+ "source": {
272
+ "literals": [
273
+ ["wui:avatar-picker:change", "wui:image-picker:change"],
274
+ ["wui:avatar-picker:remove", "wui:image-picker:remove"],
275
+ ["data-app-logo-remove", "data-wui-image-picker-remove"],
276
+ ["[data-app-logo-remove]", "[data-wui-image-picker-remove]"]
277
+ ],
278
+ "members": [],
279
+ "flags": [
280
+ {
281
+ "pattern": "\\b(AppSelectMini|AppInfoList|AppLogoPicker|AppAvatarPicker|AppPagination|AppSidebarMenu|AppTableEmptyState|AppMenubar)\\b",
282
+ "hint": "a 0.108.0 removed name outside an import or a JSX tag (a list, a string, a doc): use its successor from the 0.108.0 CHANGELOG Breaking section"
283
+ },
284
+ {
285
+ "pattern": "hidden\\.bs\\.offcanvas|shown\\.bs\\.offcanvas|bootstrap\\.Offcanvas",
286
+ "hint": "the drawer element raises wui-drawer-opened and wui-drawer-closed; it has no Bootstrap Offcanvas API"
287
+ },
288
+ {
289
+ "pattern": "\\.info-(row|value|list|icon|key|meta)\\b",
290
+ "hint": "the info list is AppDescriptions layout=\"list\": rows are .descs-item, values .descs-value"
291
+ },
292
+ {
293
+ "pattern": "\\btbl-empty-(icon|title|text|action)\\b",
294
+ "hint": "inside the table empty state use .empty-state-icon, -title, -message, -action under .wui-empty-state-table"
295
+ },
296
+ { "pattern": "side=\\{?[\"'](top|bottom)[\"']", "hint": "AppDrawer opens from start or end only" }
297
+ ]
298
+ }
299
+ }
@@ -8,6 +8,7 @@
8
8
  },
9
9
  "themeReads": [],
10
10
  "props": [],
11
+ "componentProps": [],
11
12
  "propValues": [],
12
13
  "propSplits": [],
13
14
  "razorAttributes": []
@@ -1389,6 +1389,7 @@
1389
1389
  "to": "danger"
1390
1390
  }
1391
1391
  ],
1392
+ "componentProps": [],
1392
1393
  "propValues": [
1393
1394
  {
1394
1395
  "package": "@webority/ui-react",
@@ -84,6 +84,7 @@
84
84
  }
85
85
  ],
86
86
  "props": [],
87
+ "componentProps": [],
87
88
  "propValues": [],
88
89
  "propSplits": [],
89
90
  "razorAttributes": []
@@ -8,6 +8,7 @@
8
8
  },
9
9
  "themeReads": [],
10
10
  "props": [],
11
+ "componentProps": [],
11
12
  "propValues": [],
12
13
  "propSplits": [],
13
14
  "razorAttributes": [],
@@ -15,6 +15,7 @@
15
15
  "to": "neutral"
16
16
  }
17
17
  ],
18
+ "componentProps": [],
18
19
  "propValues": [],
19
20
  "propSplits": [],
20
21
  "razorAttributes": [],
@@ -41,13 +41,68 @@ export interface SourceRules {
41
41
  flags: { pattern: string; hint: string }[];
42
42
  }
43
43
 
44
+ /**
45
+ * A JSX prop of named components from one package: renamed (`to`), its literal values mapped (`values`),
46
+ * or reported for a person to fix (`flag`, the hint printed with each hit). Applies to the components'
47
+ * local names as imported from `package`, including through a namespace import.
48
+ */
49
+ export interface ComponentPropRule {
50
+ package: string;
51
+ components: string[];
52
+ prop: string;
53
+ to?: string;
54
+ values?: Readonly<Record<string, string>>;
55
+ flag?: string;
56
+ }
57
+
58
+ /** A React component a release merged into another or renamed: an import of `from` from `package` becomes `to` (merged into an existing import of `to` when one is there), and each `<from>` element becomes `<to>`. */
59
+ export interface ComponentRule {
60
+ package: string;
61
+ from: string;
62
+ to: string;
63
+ /** Written on each converted element that does not carry the prop: a string as a quoted attribute, a boolean or number in braces. */
64
+ addProps: Readonly<Record<string, string | number | boolean>>;
65
+ /** Prop names renamed on the converted element. */
66
+ renameProps: Readonly<Record<string, string>>;
67
+ /** Quoted string values rewritten per prop (new prop name), after renameProps. */
68
+ valueMaps: Readonly<Record<string, Readonly<Record<string, string>>>>;
69
+ /** Props the target does not take: left in place and reported with the hint. */
70
+ removeProps: Readonly<Record<string, string>>;
71
+ }
72
+
73
+ /** A Razor tag a release merged or renamed: `<from` and `</from>` become `<to` and `</to>`. `from` equal to `to` changes attributes only. */
74
+ export interface RazorTagRule {
75
+ from: string;
76
+ to: string;
77
+ addAttributes: Readonly<Record<string, string>>;
78
+ renameAttributes: Readonly<Record<string, string>>;
79
+ valueMaps: Readonly<Record<string, Readonly<Record<string, string>>>>;
80
+ removeAttributes: Readonly<Record<string, string>>;
81
+ /** An attribute whose value becomes the element's content; a self-closing element gets a closing tag. */
82
+ attributeToContent?: string;
83
+ }
84
+
85
+ /** A theme class renamed: the whole class token, in style selectors, class and className values, and string literals of script files. */
86
+ export type ClassRename = [from: string, to: string];
87
+
88
+ /** Razor and HTML text a release changed (.cshtml, .razor, .html). */
89
+ export interface MarkupRules {
90
+ literals: [string, string][];
91
+ flags: { pattern: string; hint: string }[];
92
+ }
93
+
44
94
  export interface RenameTable {
45
95
  version: string;
46
96
  css: { rename: [string, string][]; reads: [string, string][]; choose: Record<string, string>; checkRole: string[] };
47
97
  themeReads: RetiredThemeRead[];
48
98
  props: { package: string; props: string[]; from: string; to: string }[];
99
+ componentProps: ComponentPropRule[];
49
100
  propValues: PropValueRule[];
50
101
  propSplits: PropSplitRule[];
51
102
  razorAttributes: RazorAttributeRule[];
52
103
  source?: SourceRules;
104
+ components?: ComponentRule[];
105
+ razorTags?: RazorTagRule[];
106
+ classes?: ClassRename[];
107
+ markup?: MarkupRules;
53
108
  }