@webority/tokens 0.158.0 → 0.160.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.
@@ -2,7 +2,7 @@
2
2
  "format": "webority-theme-tokens/2",
3
3
  "source": {
4
4
  "package": "@webority/tokens",
5
- "version": "0.158.0",
5
+ "version": "0.160.0",
6
6
  "brand": null,
7
7
  "platform": "phone",
8
8
  "width": null
@@ -2,7 +2,7 @@
2
2
  "format": "webority-theme-tokens/2",
3
3
  "source": {
4
4
  "package": "@webority/tokens",
5
- "version": "0.158.0",
5
+ "version": "0.160.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.158.0",
5
+ "version": "0.160.0",
6
6
  "brand": null,
7
7
  "platform": "web",
8
8
  "width": 1440
@@ -2,7 +2,7 @@
2
2
  "format": "webority-meanings/1",
3
3
  "source": {
4
4
  "package": "@webority/tokens",
5
- "version": "0.158.0"
5
+ "version": "0.160.0"
6
6
  },
7
7
  "color": {
8
8
  "bg": {
@@ -1,5 +1,5 @@
1
- import{brand as e}from"../build.js";import{present as t}from"../present.js";import{applyClasses as n}from"./classes.js";import{applyComponents as r}from"./components.js";import{applyCsharpEnumArguments as i}from"./csharpEnumArguments.js";import{applyCssTable as a,isCssTarget as o,ownDeclarations as s}from"./css.js";import{applyRazorAttributes as c}from"./razorAttributes.js";import{applyRazorEnumAttributes as l}from"./razorEnumAttributes.js";import{applyRazorTags as u}from"./razorTags.js";import{applyRazorValueSplits as d}from"./razorValueSplits.js";import{applyMarkup as f,applySource as p}from"./source.js";import{applyComponentProps as m,applyPropSplits as h,applyPropValues as g,applyProps as _,applyThemeReads as v}from"./themeReads.js";import{applyValueSplits as ee}from"./valueSplits.js";import{applyWrapperValues as te,findWrappers as y}from"./wrapperValues.js";import{createRequire as b}from"node:module";import{existsSync as x,readFileSync as S,readdirSync as C,realpathSync as w,writeFileSync as T}from"node:fs";import{dirname as E,isAbsolute as D,join as O,relative as k,resolve as A,sep as j}from"node:path";import{fileURLToPath as M,pathToFileURL as N}from"node:url";import{spawnSync as P}from"node:child_process";var F=/^\d+\.\d+\.\d+$/,I=/^(?:workspace:|file:|link:)/,L=`WEBORITY_UPGRADE_FROM`;function R(e){if(typeof e!=`string`||!F.test(e))throw Error(`invalid version "${e}"`)}function z(e,n){R(e),R(n);let r=e.split(`.`).map(Number),i=n.split(`.`).map(Number);for(let e=0;e<3;e++)if(r[e]!==i[e])return t(r[e],`version part`)-t(i[e],`version part`);return 0}function B(){let e=E(M(import.meta.url));for(;;){let t=O(e,`package.json`);if(x(t)&&JSON.parse(S(t,`utf8`)).name===`@webority/tokens`)return e;let n=E(e);if(n===e)throw Error(`cannot find the @webority/tokens package folder`);e=n}}function ne(){return JSON.parse(S(O(B(),`package.json`),`utf8`)).version}function V(e){let t=[];for(let n of C(e)){if(!n.endsWith(`.json`))continue;let r=n.slice(0,-5);F.test(r)&&t.push({version:r,table:JSON.parse(S(O(e,n),`utf8`))})}return t.sort((e,t)=>z(e.version,t.version))}function H(e,t){let n=P(`git`,[`ls-files`,`-z`,`--`,...t],{cwd:e,encoding:`utf8`,windowsHide:!0,maxBuffer:67108864});if(n.status!==0)throw Error(`not a git repository: ${e}`);let r=n.stdout.split(`\0`).filter(Boolean).map(e=>e.split(`\\`).join(`/`)).filter(t=>x(O(e,t)));return[...new Set(r)]}function U(e,t){let n=H(e,t??[`.`]);if(t!==void 0&&n.length===0)throw Error(`no tracked files under ${t.join(`, `)}`);return n}function W(e){return e.split(`/`).includes(`node_modules`)}var re=new Set([`node_modules`,`vendor`,`vendors`,`external`]),ie=/\.(?:min|bundle)\.(?:js|css)$/,G=new Set([`lib`,`theme`]);function K(e){let t=e.split(`/`);return t.some(e=>re.has(e))||t.some((e,n)=>{let r=t[n+1];return e===`wwwroot`&&r!==void 0&&G.has(r)})?!0:ie.test(e)}var q=new Set([`bin`,`obj`,`node_modules`]);function J(e){let t=e.split(`/`);return e.toLowerCase().endsWith(`.cs`)&&!t.some(e=>q.has(e))}function Y(e,t){return[...new Set([...e,...t])]}function X(e,t,n){return V(e).filter(e=>z(e.version,t)>0&&z(e.version,n)<=0).map(e=>e.table)}function ae(e,t){let n=Object.entries(t);if(n.length===0)return e;let r=(e,t)=>e.flatMap(e=>[e,...n.filter(([,n])=>e[t]===n).map(([n])=>({...e,[t]:n}))]),i={...e};return e.props!==void 0&&(i.props=r(e.props,`package`)),e.componentProps!==void 0&&(i.componentProps=r(e.componentProps,`package`)),e.propValues!==void 0&&(i.propValues=r(e.propValues,`package`)),e.propSplits!==void 0&&(i.propSplits=r(e.propSplits,`package`)),e.valueSplits!==void 0&&(i.valueSplits=r(e.valueSplits,`package`)),e.components!==void 0&&(i.components=r(e.components,`package`)),e.source!==void 0&&(i.source={...e.source,flags:r(e.source.flags,`importedFrom`)}),i}function Z(e,b,x,C,w,E={}){C&&w(`dry run: nothing written`);let D=x.map(e=>ae(e,E)),k=[],A=[],j=[],M=D.some(e=>(e.csharpEnumArguments??[]).length>0),N=b.filter(e=>(o(e)||M&&J(e))&&!K(e)),P=D.map(()=>new Set);if(D.some(e=>(e.css.ownable??[]).length>0))for(let n of N){let r=S(O(e,n),`utf8`);D.forEach((e,i)=>{for(let a of s(r,n,e))t(P[i],`own declarations of a rename table`).add(a)})}let F=H(e,[`package.json`,`:(glob)**/package.json`]).filter(e=>!W(e)),I=new Map,L=D.map(t=>y(e,[...N,...F],t,I));for(let o of N){let s=S(O(e,o),`utf8`),y=s,b=e=>{for(let t of e)t.from!==t.to&&(k.push({file:o,line:t.line,from:t.from,to:t.to}),w(`${o}:${t.line} ${t.from} -> ${t.to}`))},x=e=>{A.push({file:o,line:e.line,name:e.name,hint:e.hint}),w(`choose ${o}:${e.line} ${e.name}: ${e.hint}`)},E=e=>{for(let t of e)t.message.startsWith(`skipped, it does not parse`)?w(`skipped ${o}: ${t.message}`):x({line:t.line,name:t.path,hint:t.message})};for(let[e,s]of D.entries()){let S=a(y,o,s,P[e]);y=S.text,b(S.hits);for(let e of S.choose)x(e);for(let e of S.checkRole)w(`verify ${o}:${e.line} ${e.from} -> ${e.to}`);let C=v(y,o,s.themeReads);y=C.text,b(C.hits),E(C.findings);let T=[n=>te(n,o,t(L[e],`wrapper index of a rename table`)),e=>_(e,o,s.props),e=>m(e,o,s.componentProps),e=>g(e,o,s.propValues),e=>ee(e,o,s.valueSplits??[]),e=>h(e,o,s.propSplits),e=>c(e,o,s.razorAttributes),e=>r(e,o,s.components??[]),e=>u(e,o,s.razorTags??[]),e=>d(e,o,s.razorValueSplits??[]),e=>l(e,o,s.razorEnumAttributes??[]),e=>i(e,o,s.csharpEnumArguments??[]),e=>n(e,o,s.classes??[]),e=>f(e,o,s.markup),e=>p(e,o,s.source)];for(let e of T){let t=e(y);y=t.text,b(t.hits),E(t.findings)}}y!==s&&(j.push(o),C||T(O(e,o),y,`utf8`))}return{hits:k,choose:A,changedFiles:j}}function oe(e){let n=/^([ \t]+)\S/m.exec(e);return n?t(n[1],`indentation of a package.json`):4}function se(e,t,n,r,i){let a=[];for(let o of H(e,[`package.json`,`:(glob)**/package.json`])){if(W(o))continue;let s=S(O(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];I.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,oe(s));s.endsWith(`
1
+ import{brand as e}from"../build.js";import{present as t}from"../present.js";import{applyClasses as n}from"./classes.js";import{applyComponents as r}from"./components.js";import{applyCsharpEnumArguments as i}from"./csharpEnumArguments.js";import{applyCssTable as a,isCssTarget as o,ownDeclarations as s}from"./css.js";import{applyRazorAttributes as c}from"./razorAttributes.js";import{applyRazorEnumAttributes as l}from"./razorEnumAttributes.js";import{applyRazorListAttributes as u}from"./razorListAttributes.js";import{applyRazorTags as d}from"./razorTags.js";import{applyRazorValueSplits as f}from"./razorValueSplits.js";import{applyMarkup as p,applySource as m}from"./source.js";import{applyComponentProps as h,applyPropSplits as g,applyPropValues as _,applyProps as v,applyThemeReads as ee}from"./themeReads.js";import{applyValueSplits as te}from"./valueSplits.js";import{applyWrapperValues as ne,findWrappers as y}from"./wrapperValues.js";import{createRequire as b}from"node:module";import{existsSync as x,readFileSync as S,readdirSync as C,realpathSync as w,writeFileSync as T}from"node:fs";import{dirname as E,isAbsolute as D,join as O,relative as k,resolve as A,sep as j}from"node:path";import{fileURLToPath as M,pathToFileURL as N}from"node:url";import{spawnSync as P}from"node:child_process";var F=/^\d+\.\d+\.\d+$/,I=/^(?:workspace:|file:|link:)/,L=`WEBORITY_UPGRADE_FROM`;function R(e){if(typeof e!=`string`||!F.test(e))throw Error(`invalid version "${e}"`)}function z(e,n){R(e),R(n);let r=e.split(`.`).map(Number),i=n.split(`.`).map(Number);for(let e=0;e<3;e++)if(r[e]!==i[e])return t(r[e],`version part`)-t(i[e],`version part`);return 0}function B(){let e=E(M(import.meta.url));for(;;){let t=O(e,`package.json`);if(x(t)&&JSON.parse(S(t,`utf8`)).name===`@webority/tokens`)return e;let n=E(e);if(n===e)throw Error(`cannot find the @webority/tokens package folder`);e=n}}function re(){return JSON.parse(S(O(B(),`package.json`),`utf8`)).version}function V(e){let t=[];for(let n of C(e)){if(!n.endsWith(`.json`))continue;let r=n.slice(0,-5);F.test(r)&&t.push({version:r,table:JSON.parse(S(O(e,n),`utf8`))})}return t.sort((e,t)=>z(e.version,t.version))}function H(e,t){let n=P(`git`,[`ls-files`,`-z`,`--`,...t],{cwd:e,encoding:`utf8`,windowsHide:!0,maxBuffer:67108864});if(n.status!==0)throw Error(`not a git repository: ${e}`);let r=n.stdout.split(`\0`).filter(Boolean).map(e=>e.split(`\\`).join(`/`)).filter(t=>x(O(e,t)));return[...new Set(r)]}function U(e,t){let n=H(e,t??[`.`]);if(t!==void 0&&n.length===0)throw Error(`no tracked files under ${t.join(`, `)}`);return n}function W(e){return e.split(`/`).includes(`node_modules`)}var G=new Set([`node_modules`,`vendor`,`vendors`,`external`]),K=/\.(?:min|bundle)\.(?:js|css)$/,q=new Set([`lib`,`theme`]);function J(e){let t=e.split(`/`);return t.some(e=>G.has(e))||t.some((e,n)=>{let r=t[n+1];return e===`wwwroot`&&r!==void 0&&q.has(r)})?!0:K.test(e)}var Y=new Set([`bin`,`obj`,`node_modules`]);function ie(e){let t=e.split(`/`);return e.toLowerCase().endsWith(`.cs`)&&!t.some(e=>Y.has(e))}function X(e,t){return[...new Set([...e,...t])]}function Z(e,t,n){return V(e).filter(e=>z(e.version,t)>0&&z(e.version,n)<=0).map(e=>e.table)}function ae(e,t){let n=Object.entries(t);if(n.length===0)return e;let r=(e,t)=>e.flatMap(e=>[e,...n.filter(([,n])=>e[t]===n).map(([n])=>({...e,[t]:n}))]),i={...e};return e.props!==void 0&&(i.props=r(e.props,`package`)),e.componentProps!==void 0&&(i.componentProps=r(e.componentProps,`package`)),e.propValues!==void 0&&(i.propValues=r(e.propValues,`package`)),e.propSplits!==void 0&&(i.propSplits=r(e.propSplits,`package`)),e.valueSplits!==void 0&&(i.valueSplits=r(e.valueSplits,`package`)),e.components!==void 0&&(i.components=r(e.components,`package`)),e.source!==void 0&&(i.source={...e.source,flags:r(e.source.flags,`importedFrom`)}),i}function Q(e,b,x,C,w,E={}){C&&w(`dry run: nothing written`);let D=x.map(e=>ae(e,E)),k=[],A=[],j=[],M=D.some(e=>(e.csharpEnumArguments??[]).length>0),N=b.filter(e=>(o(e)||M&&ie(e))&&!J(e)),P=D.map(()=>new Set);if(D.some(e=>(e.css.ownable??[]).length>0))for(let n of N){let r=S(O(e,n),`utf8`);D.forEach((e,i)=>{for(let a of s(r,n,e))t(P[i],`own declarations of a rename table`).add(a)})}let F=H(e,[`package.json`,`:(glob)**/package.json`]).filter(e=>!W(e)),I=new Map,L=D.map(t=>y(e,[...N,...F],t,I));for(let o of N){let s=S(O(e,o),`utf8`),y=s,b=e=>{for(let t of e)t.from!==t.to&&(k.push({file:o,line:t.line,from:t.from,to:t.to}),w(`${o}:${t.line} ${t.from} -> ${t.to}`))},x=e=>{A.push({file:o,line:e.line,name:e.name,hint:e.hint}),w(`choose ${o}:${e.line} ${e.name}: ${e.hint}`)},E=e=>{for(let t of e)t.message.startsWith(`skipped, it does not parse`)?w(`skipped ${o}: ${t.message}`):x({line:t.line,name:t.path,hint:t.message})};for(let[e,s]of D.entries()){let S=a(y,o,s,P[e]);y=S.text,b(S.hits);for(let e of S.choose)x(e);for(let e of S.checkRole)w(`verify ${o}:${e.line} ${e.from} -> ${e.to}`);let C=ee(y,o,s.themeReads);y=C.text,b(C.hits),E(C.findings);let T=[n=>ne(n,o,t(L[e],`wrapper index of a rename table`)),e=>v(e,o,s.props),e=>h(e,o,s.componentProps),e=>_(e,o,s.propValues),e=>te(e,o,s.valueSplits??[]),e=>g(e,o,s.propSplits),e=>c(e,o,s.razorAttributes),e=>r(e,o,s.components??[]),e=>d(e,o,s.razorTags??[]),e=>f(e,o,s.razorValueSplits??[]),e=>l(e,o,s.razorEnumAttributes??[]),e=>u(e,o,s.razorListAttributes??[]),e=>i(e,o,s.csharpEnumArguments??[]),e=>n(e,o,s.classes??[]),e=>p(e,o,s.markup),e=>m(e,o,s.source)];for(let e of T){let t=e(y);y=t.text,b(t.hits),E(t.findings)}}y!==s&&(j.push(o),C||T(O(e,o),y,`utf8`))}return{hits:k,choose:A,changedFiles:j}}function oe(e){let n=/^([ \t]+)\S/m.exec(e);return n?t(n[1],`indentation of a package.json`):4}function se(e,t,n,r,i){let a=[];for(let o of H(e,[`package.json`,`:(glob)**/package.json`])){if(W(o))continue;let s=S(O(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];I.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,oe(s));s.endsWith(`
2
2
  `)&&(t+=`
3
3
  `),s.includes(`\r
4
4
  `)&&(t=t.replace(/\n/g,`\r
5
- `)),T(O(e,o),t,`utf8`)}}return a}function ce(e,t,n,r,i){let a=[];for(let o of H(e,[`Directory.Packages.props`,`:(glob)**/Directory.Packages.props`])){if(W(o))continue;let s=S(O(e,o),`utf8`),c=!1,l=s.replace(/<PackageVersion\b[^>]*>/g,e=>{let r=/\sInclude="([^"]*)"/.exec(e)?.[1],a=/\sVersion="([^"]*)"/.exec(e)?.[1];if(r===void 0||a===void 0)return e;let s=/^\[([^\]]*)\]$/.exec(a),l=s?s[1]:a,u=s?`[${t}]`:t;return!n.nuget.includes(r)||l===t?e:(i(`pin ${o}: ${r} ${a} -> ${u}`),c=!0,e.replace(/(\sVersion=")[^"]*(")/,`$1${u}$2`))});c&&(a.push(o),r&&T(O(e,o),l,`utf8`))}return a}function le(e){let t;try{t=b(O(e,`package.json`)).resolve(`@webority/repo-checks/lockstep.json`)}catch{throw Error(`add @webority/repo-checks at the lockstep version and run again`)}let n=JSON.parse(S(t,`utf8`));if(!ue(n))throw Error(`${t} must hold { npm: string[], nuget: string[] }`);return n}function Q(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function ue(e){return typeof e!=`object`||!e||!(`npm`in e)||!(`nuget`in e)?!1:Q(e.npm)&&Q(e.nuget)}var de=[{file:`pnpm-lock.yaml`,manager:`pnpm`,command:[`corepack`,`pnpm`,`install`]},{file:`package-lock.json`,manager:`npm`,command:[`npm`,`install`]}];function fe(e){let n=de.filter(t=>x(O(e,t.file)));if(n.length===0)throw Error(`no pnpm-lock.yaml or package-lock.json in ${e}`);if(n.length>1)throw Error(`${e} has both ${t(n[0],`first lockfile entry`).file} and ${t(n[1],`second lockfile entry`).file}; keep one lockfile`);return t(n[0],`lockfile entry`)}function pe(e,t){let n=A(e,t),r=k(e,n);if(r===``||D(r)||r.split(j)[0]===`..`)throw Error(`--app ${t}: give a folder inside the repo root`);if(!x(O(n,`package.json`)))throw Error(`--app ${t}: no package.json in that folder`);return n}function $(e,t,n){return P(e,t,{cwd:n.cwd,env:process.env,stdio:`inherit`,windowsHide:!0,shell:process.platform===`win32`})}async function me({appRoot:e,designRoot:t,app:n,version:r,from:i,aliases:a}){let o=w.native(O(e,`node_modules`,`@webority`,`tokens`)),s=JSON.parse(S(O(o,`package.json`),`utf8`))?.exports?.[`.`],c=typeof s==`string`?s:s?.default;if(typeof c!=`string`)throw Error(`cannot find the installed @webority/tokens entry`);process.env[L]=i;try{return await(await import(N(O(o,c)).href)).upgrade({root:t,app:n,version:r,dryRun:!1,aliases:a})}finally{delete process.env[L]}}async function he({root:e,designRoot:t,version:n,dryRun:r,from:i,dir:a,log:o,brandFn:s,aliases:c}){let l=X(a,i,n),u=Z(e,U(e),l,r,o,c);return r||await s({root:t}),u}async function ge({root:e,designRoot:n,app:r,version:i,dryRun:a,deps:o,log:s,aliases:c}){let l=O(e,`node_modules`,`@webority`,`tokens`,`package.json`);if(!x(l))throw Error(`@webority/tokens is not installed; add it at the lockstep version and run again`);let u=JSON.parse(S(l,`utf8`)).version,d=le(e),f=a?null:fe(e),p=[...se(e,i,d,!a,s),...ce(e,i,d,!a,s)];if(a){s(`dry run: install skipped; tables are those of the installed ${u}`);let t=X(o.renamesDir??O(e,`node_modules`,`@webority`,`tokens`,`renames`),u,i),n=Z(e,U(e),t,!0,s,c);return{...n,changedFiles:Y(p,n.changedFiles)}}if(f===null)throw Error(`webority-tokens: package manager is missing.`);let m=o.run??$,[h,...g]=f.command,{status:_}=await m(t(h,`install command`),g,{cwd:e});if(_!==0)throw Error(`${f.manager} install failed with exit code ${_}`);let v=await(o.reenter??me)({appRoot:e,designRoot:n,app:r,version:i,dryRun:!1,from:u,aliases:c});return{...v,changedFiles:Y(p,v.changedFiles)}}async function _e(t,n={}){let r=t.version;R(r);let i=t.root??process.cwd(),a=t.app===void 0?i:pe(i,t.app),o=t.dryRun??!1,s=t.aliases??{},c=n.log??(e=>process.stdout.write(`${e}\n`)),l=()=>n.renamesDir??O(B(),`renames`);if(Array.isArray(t.paths)&&t.paths.length>0){let e=V(l()).filter(e=>e.version===r).map(e=>e.table);if(e.length===0&&r!==(n.ownVersion??ne)())throw Error(`no rename table for ${r}`);return Z(a,U(a,t.paths),e,o,c,s)}if(!x(O(i,`.webority`,`design.json`)))throw Error(`write .webority/design.json (design-map.md) and run again`);let u=process.env[L];return u?he({root:a,designRoot:i,version:r,dryRun:o,from:u,dir:l(),log:c,brandFn:n.brand??e,aliases:s}):ge({root:a,designRoot:i,app:t.app,version:r,dryRun:o,deps:n,log:c,aliases:s})}export{_e as upgrade};
5
+ `)),T(O(e,o),t,`utf8`)}}return a}function ce(e,t,n,r,i){let a=[];for(let o of H(e,[`Directory.Packages.props`,`:(glob)**/Directory.Packages.props`])){if(W(o))continue;let s=S(O(e,o),`utf8`),c=!1,l=s.replace(/<PackageVersion\b[^>]*>/g,e=>{let r=/\sInclude="([^"]*)"/.exec(e)?.[1],a=/\sVersion="([^"]*)"/.exec(e)?.[1];if(r===void 0||a===void 0)return e;let s=/^\[([^\]]*)\]$/.exec(a),l=s?s[1]:a,u=s?`[${t}]`:t;return!n.nuget.includes(r)||l===t?e:(i(`pin ${o}: ${r} ${a} -> ${u}`),c=!0,e.replace(/(\sVersion=")[^"]*(")/,`$1${u}$2`))});c&&(a.push(o),r&&T(O(e,o),l,`utf8`))}return a}function le(e){let t;try{t=b(O(e,`package.json`)).resolve(`@webority/repo-checks/lockstep.json`)}catch{throw Error(`add @webority/repo-checks at the lockstep version and run again`)}let n=JSON.parse(S(t,`utf8`));if(!ue(n))throw Error(`${t} must hold { npm: string[], nuget: string[] }`);return n}function $(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function ue(e){return typeof e!=`object`||!e||!(`npm`in e)||!(`nuget`in e)?!1:$(e.npm)&&$(e.nuget)}var de=[{file:`pnpm-lock.yaml`,manager:`pnpm`,command:[`corepack`,`pnpm`,`install`]},{file:`package-lock.json`,manager:`npm`,command:[`npm`,`install`]}];function fe(e){let n=de.filter(t=>x(O(e,t.file)));if(n.length===0)throw Error(`no pnpm-lock.yaml or package-lock.json in ${e}`);if(n.length>1)throw Error(`${e} has both ${t(n[0],`first lockfile entry`).file} and ${t(n[1],`second lockfile entry`).file}; keep one lockfile`);return t(n[0],`lockfile entry`)}function pe(e,t){let n=A(e,t),r=k(e,n);if(r===``||D(r)||r.split(j)[0]===`..`)throw Error(`--app ${t}: give a folder inside the repo root`);if(!x(O(n,`package.json`)))throw Error(`--app ${t}: no package.json in that folder`);return n}function me(e,t,n){return P(e,t,{cwd:n.cwd,env:process.env,stdio:`inherit`,windowsHide:!0,shell:process.platform===`win32`})}async function he({appRoot:e,designRoot:t,app:n,version:r,from:i,aliases:a}){let o=w.native(O(e,`node_modules`,`@webority`,`tokens`)),s=JSON.parse(S(O(o,`package.json`),`utf8`))?.exports?.[`.`],c=typeof s==`string`?s:s?.default;if(typeof c!=`string`)throw Error(`cannot find the installed @webority/tokens entry`);process.env[L]=i;try{return await(await import(N(O(o,c)).href)).upgrade({root:t,app:n,version:r,dryRun:!1,aliases:a})}finally{delete process.env[L]}}async function ge({root:e,designRoot:t,version:n,dryRun:r,from:i,dir:a,log:o,brandFn:s,aliases:c}){let l=Z(a,i,n),u=Q(e,U(e),l,r,o,c);return r||await s({root:t}),u}async function _e({root:e,designRoot:n,app:r,version:i,dryRun:a,deps:o,log:s,aliases:c}){let l=O(e,`node_modules`,`@webority`,`tokens`,`package.json`);if(!x(l))throw Error(`@webority/tokens is not installed; add it at the lockstep version and run again`);let u=JSON.parse(S(l,`utf8`)).version,d=le(e),f=a?null:fe(e),p=[...se(e,i,d,!a,s),...ce(e,i,d,!a,s)];if(a){s(`dry run: install skipped; tables are those of the installed ${u}`);let t=Z(o.renamesDir??O(e,`node_modules`,`@webority`,`tokens`,`renames`),u,i),n=Q(e,U(e),t,!0,s,c);return{...n,changedFiles:X(p,n.changedFiles)}}if(f===null)throw Error(`webority-tokens: package manager is missing.`);let m=o.run??me,[h,...g]=f.command,{status:_}=await m(t(h,`install command`),g,{cwd:e});if(_!==0)throw Error(`${f.manager} install failed with exit code ${_}`);let v=await(o.reenter??he)({appRoot:e,designRoot:n,app:r,version:i,dryRun:!1,from:u,aliases:c});return{...v,changedFiles:X(p,v.changedFiles)}}async function ve(t,n={}){let r=t.version;R(r);let i=t.root??process.cwd(),a=t.app===void 0?i:pe(i,t.app),o=t.dryRun??!1,s=t.aliases??{},c=n.log??(e=>process.stdout.write(`${e}\n`)),l=()=>n.renamesDir??O(B(),`renames`);if(Array.isArray(t.paths)&&t.paths.length>0){let e=V(l()).filter(e=>e.version===r).map(e=>e.table);if(e.length===0&&r!==(n.ownVersion??re)())throw Error(`no rename table for ${r}`);return Q(a,U(a,t.paths),e,o,c,s)}if(!x(O(i,`.webority`,`design.json`)))throw Error(`write .webority/design.json (design-map.md) and run again`);let u=process.env[L];return u?ge({root:a,designRoot:i,version:r,dryRun:o,from:u,dir:l(),log:c,brandFn:n.brand??e,aliases:s}):_e({root:a,designRoot:i,app:t.app,version:r,dryRun:o,deps:n,log:c,aliases:s})}export{ve as upgrade};
@@ -1,5 +1,5 @@
1
1
  import{present as e}from"../present.js";import{readRazorAttributes as t,tagOccurrences as n}from"./tagScan.js";import{applyEdits as r}from"./themeReads.js";var i=new Set([`.cshtml`,`.razor`]),a=/^([1-9]\d*)(?:px)?$/i,o=/^([ \t]*)@addTagHelper[ \t]+\*[ \t]*,[ \t]*Webority\.Ui\.Razor[ \t]*\r?$/m,s=/^[ \t]*@using[ \t]+Webority\.Ui\.Razor(?![\w.])/m,c=`@using Webority.Ui.Razor`,l=`()[]{},:`,u=e=>{let t=/\.[^./]*$/.exec(e);return t?t[0].toLowerCase():``},d=(e,t)=>e.slice(0,t).split(`
2
- `).length;function f(e,t){return Object.hasOwn(e.values,t)?e.values[t]:Object.values(e.values).find(e=>e.toLowerCase()===t)}function p(e){return Object.values(e.values).join(`, `)}function m(e,t){return`${t} is not a ${e.enum}. Use one of: ${p(e)}.`}function h(e,t){return`takes a ${e.enum} now; change the type that "${t}" returns from string to ${e.enum}.`}function g(e){let t=[],n=0;for(;n<e.length;){let r=e.charAt(n);if(/\s/.test(r)){n++;continue}let i=n,a=`word`;if(r===`"`){for(i=n+1;i<e.length&&e.charAt(i)!==`"`;)i+=e.charAt(i)===`\\`?2:1;if(i>=e.length)return null;i+=1,a=`str`}else if(r===`?`&&(e.charAt(n+1)===`?`||e.charAt(n+1)===`.`))i=n+2;else if(r===`?`||l.includes(r))i=n+1,a=`punct`;else for(;i<e.length&&!/[\s"?:()[\]{},]/.test(e.charAt(i));)i++;t.push({kind:a,text:e.slice(n,i),start:n,end:i}),n=i}return t}function _(e){let t=e.map(()=>-1),n=[];for(let r=0;r<e.length;r++){let i=e[r];if(i?.kind===`punct`){if(`([{`.includes(i.text))n.push(r);else if(`)]}`.includes(i.text)){let e=n.pop();if(e===void 0)return null;t[e]=r}}}return n.length===0?t:null}var v=e=>e?.kind===`punct`&&`([{`.includes(e.text);function y(e,t,n,r,i){if(r-n>=2&&e[n]?.text===`(`&&t[n]===r-1)return y(e,t,n+1,r-1,i);let a=-1;for(let i=n;i<r&&a===-1;i++){let n=e[i];v(n)?i=t[i]??r:n?.kind===`punct`&&n.text===`?`&&(a=i)}if(a===-1)return i.push({lo:n,hi:r}),!1;let o=0,s=-1;for(let n=a+1;n<r&&s===-1;n++){let i=e[n];v(i)?n=t[n]??r:i?.kind===`punct`&&i.text===`?`?o++:i?.kind===`punct`&&i.text===`:`&&(o===0?s=n:o--)}return s===-1?(i.push({lo:n,hi:r}),!1):(y(e,t,a+1,s,i),y(e,t,s+1,r,i),!0)}function b(e,t,n,r,i){let a=n.hi-n.lo===1?t[n.lo]:void 0;if(a?.kind===`str`&&!a.text.includes(`\\`)&&!a.text.includes(`@`)){let t=f(e,a.text.slice(1,-1).toLowerCase());return t===void 0?{problem:m(e,a.text)}:{replace:{start:r+a.start,end:r+a.end,text:`${e.enum}.${t}`}}}return a?.kind===`word`&&Object.values(e.values).some(t=>a.text===`${e.enum}.${t}`)?{}:{problem:h(e,i)}}function x(e,t){let n=g(t.value.slice(1)),r=n===null?null:_(n);if(n===null||r===null)return{edits:[],message:h(e,t.value)};let i=[];y(n,r,0,n.length,i);let a=[],o;for(let r of i){let i=b(e,n,r,t.valueStart+1,t.value);i.problem===void 0?i.replace!==void 0&&a.push(i.replace):o??=i.problem}return o===void 0?{edits:a}:{edits:[],message:o}}function S(t,n,r,i){if(r.kind!==`quoted`)return{edits:[],message:`write it as ${r.name}="<member>"; one of: ${p(t)}.`};let o=t.numberAttribute===void 0?null:a.exec(r.value);if(t.numberAttribute!==void 0&&o!==null){if(i.has(t.numberAttribute))return{edits:[],message:`<${n}> already sets ${t.numberAttribute}; merge ${t.attribute} into it by hand`};let a=e(o[1],`the pixel count`),s=[{start:r.nameStart,end:r.nameEnd,text:t.numberAttribute}];return a!==r.value&&s.push({start:r.valueStart,end:r.valueEnd,text:a}),{edits:s}}if(r.value.startsWith(`@`))return x(t,r);let s=Object.values(t.values).some(e=>r.value===`${t.enum}.${e}`);if(s&&t.nullable===!0)return{edits:[]};let c=s?r.value.slice(t.enum.length+1):f(t,r.value.toLowerCase());if(c===void 0)return{edits:[],message:m(t,`"${r.value}"`)};let l=t.nullable===!0?`${t.enum}.${c}`:c;return l===r.value?{edits:[]}:{edits:[{start:r.valueStart,end:r.valueEnd,text:l}]}}function C(e,a,l){if(l.length===0||!i.has(u(a)))return{text:e,hits:[],findings:[]};let f=[],p=[],m=[];for(let i of l)for(let o of i.tags)for(let{nameEnd:s,end:c}of n(e,o)){if(c===-1){m.push({file:a,line:d(e,s),path:`<${o}>`,message:`the tag could not be read (a quote in an attribute value does not pair up); set it by hand`});continue}let n=t(e,s,c),l=new Set(n.map(e=>e.name));for(let t of n){if(t.name!==i.attribute)continue;let n=d(e,t.nameStart),s=S(i,o,t,l);if(s.message!==void 0){m.push({file:a,line:n,path:`<${o}> ${i.attribute}`,message:s.message});continue}if(s.edits.length===0)continue;f.push(...s.edits);let c=r(e.slice(t.nameStart,t.attrEnd),s.edits.map(e=>({start:e.start-t.nameStart,end:e.end-t.nameStart,text:e.text})),a);p.push({line:n,from:e.slice(t.nameStart,t.attrEnd),to:c.replace(/\n\s*/g,` `)})}}if((a.split(`/`).pop()??``).toLowerCase()===`_viewimports.cshtml`){let t=o.exec(e);if(t!==null&&!s.test(e)){let n=e.includes(`\r
2
+ `).length;function f(e,t){return Object.hasOwn(e.values,t)?e.values[t]:Object.values(e.values).find(e=>e.toLowerCase()===t)}function p(e){return Object.values(e.values).join(`, `)}function m(e,t){return`${t} is not a ${e.enum}. Use one of: ${p(e)}.`}function h(e,t){return`takes a ${e.enum} now; change the type that "${t}" returns from string to ${e.enum}.`}function g(e){let t=[],n=0;for(;n<e.length;){let r=e.charAt(n);if(/\s/.test(r)){n++;continue}let i=n,a=`word`;if(r===`"`){for(i=n+1;i<e.length&&e.charAt(i)!==`"`;)i+=e.charAt(i)===`\\`?2:1;if(i>=e.length)return null;i+=1,a=`str`}else if(r===`?`&&(e.charAt(n+1)===`?`||e.charAt(n+1)===`.`))i=n+2;else if(r===`?`||l.includes(r))i=n+1,a=`punct`;else for(;i<e.length&&!/[\s"?:()[\]{},]/.test(e.charAt(i));)i++;t.push({kind:a,text:e.slice(n,i),start:n,end:i}),n=i}return t}function _(e){let t=e.map(()=>-1),n=[];for(let r=0;r<e.length;r++){let i=e[r];if(i?.kind===`punct`){if(`([{`.includes(i.text))n.push(r);else if(`)]}`.includes(i.text)){let e=n.pop();if(e===void 0)return null;t[e]=r}}}return n.length===0?t:null}var v=e=>e?.kind===`punct`&&`([{`.includes(e.text);function y(e,t,n,r,i){if(r-n>=2&&e[n]?.text===`(`&&t[n]===r-1)return y(e,t,n+1,r-1,i);let a=-1;for(let i=n;i<r&&a===-1;i++){let n=e[i];v(n)?i=t[i]??r:n?.kind===`punct`&&n.text===`?`&&(a=i)}if(a===-1)return i.push({lo:n,hi:r}),!1;let o=0,s=-1;for(let n=a+1;n<r&&s===-1;n++){let i=e[n];v(i)?n=t[n]??r:i?.kind===`punct`&&i.text===`?`?o++:i?.kind===`punct`&&i.text===`:`&&(o===0?s=n:o--)}return s===-1?(i.push({lo:n,hi:r}),!1):(y(e,t,a+1,s,i),y(e,t,s+1,r,i),!0)}function b(e,t,n,r,i){let a=n.hi-n.lo===1?t[n.lo]:void 0;if(a?.kind===`str`&&!a.text.includes(`\\`)&&!a.text.includes(`@`)){let t=f(e,a.text.slice(1,-1).toLowerCase());return t===void 0?{problem:m(e,a.text)}:{replace:{start:r+a.start,end:r+a.end,text:`${e.enum}.${t}`}}}return a?.kind===`word`&&Object.values(e.values).some(t=>a.text===`${e.enum}.${t}`)?{}:{problem:h(e,i)}}function x(e,t){let n=g(t.value.slice(1)),r=n===null?null:_(n);if(n===null||r===null)return{edits:[],message:h(e,t.value)};let i=[];y(n,r,0,n.length,i);let a=[],o;for(let r of i){let i=b(e,n,r,t.valueStart+1,t.value);i.problem===void 0?i.replace!==void 0&&a.push(i.replace):o??=i.problem}return o===void 0?{edits:a}:{edits:[],message:o}}function S(t,n,r,i){if(r.kind!==`quoted`)return{edits:[],message:`write it as ${r.name}="<member>"; one of: ${p(t)}.`};let o=t.numberAttribute===void 0?null:a.exec(r.value);if(t.numberAttribute!==void 0&&o!==null){if(i.has(t.numberAttribute))return{edits:[],message:`<${n}> already sets ${t.numberAttribute}; merge ${t.attribute} into it by hand`};let a=e(o[1],`the pixel count`),s=[{start:r.nameStart,end:r.nameEnd,text:t.numberAttribute}];return a!==r.value&&s.push({start:r.valueStart,end:r.valueEnd,text:a}),{edits:s}}if(r.value.startsWith(`@`))return t.keepExpressions===!0?{edits:[]}:x(t,r);let s=Object.values(t.values).some(e=>r.value===`${t.enum}.${e}`);if(s&&t.nullable===!0)return{edits:[]};let c=s?r.value.slice(t.enum.length+1):f(t,r.value.toLowerCase());if(c===void 0)return{edits:[],message:m(t,`"${r.value}"`)};let l=t.nullable===!0?`${t.enum}.${c}`:c;return l===r.value?{edits:[]}:{edits:[{start:r.valueStart,end:r.valueEnd,text:l}]}}function C(e,a,l){if(l.length===0||!i.has(u(a)))return{text:e,hits:[],findings:[]};let f=[],p=[],m=[];for(let i of l)for(let o of i.tags)for(let{nameEnd:s,end:c}of n(e,o)){if(c===-1){m.push({file:a,line:d(e,s),path:`<${o}>`,message:`the tag could not be read (a quote in an attribute value does not pair up); set it by hand`});continue}let n=t(e,s,c),l=new Set(n.map(e=>e.name));for(let t of n){if(t.name!==i.attribute)continue;let n=d(e,t.nameStart),s=S(i,o,t,l);if(s.message!==void 0){m.push({file:a,line:n,path:`<${o}> ${i.attribute}`,message:s.message});continue}if(s.edits.length===0)continue;f.push(...s.edits);let c=r(e.slice(t.nameStart,t.attrEnd),s.edits.map(e=>({start:e.start-t.nameStart,end:e.end-t.nameStart,text:e.text})),a);p.push({line:n,from:e.slice(t.nameStart,t.attrEnd),to:c.replace(/\n\s*/g,` `)})}}if((a.split(`/`).pop()??``).toLowerCase()===`_viewimports.cshtml`){let t=o.exec(e);if(t!==null&&!s.test(e)){let n=e.includes(`\r
3
3
  `)?`\r
4
4
  `:`
5
5
  `,r=t.index;f.push({start:r,end:r,text:`${t[1]??``}${c}${n}`}),p.push({line:d(e,r),from:``,to:c})}}return p.sort((e,t)=>e.line-t.line||(e.from<t.from?-1:+(e.from>t.from))),m.sort((e,t)=>e.line-t.line||(e.path<t.path?-1:+(e.path>t.path))),{text:r(e,f,a),hits:p,findings:m}}export{C as applyRazorEnumAttributes};
@@ -0,0 +1,19 @@
1
+ import type { RazorListAttributeRule } from "../../renames/renames.d.ts";
2
+ export type RazorListHit = {
3
+ line: number;
4
+ from: string;
5
+ to: string;
6
+ };
7
+ export type RazorListFinding = {
8
+ file: string;
9
+ line: number;
10
+ path: string;
11
+ message: string;
12
+ };
13
+ export type RazorListResult = {
14
+ text: string;
15
+ hits: RazorListHit[];
16
+ findings: RazorListFinding[];
17
+ };
18
+ /** @param file repo-relative, forward slashes */
19
+ export declare function applyRazorListAttributes(source: string, file: string, rules: RazorListAttributeRule[]): RazorListResult;
@@ -0,0 +1,2 @@
1
+ import{readRazorAttributes as e,tagOccurrences as t}from"./tagScan.js";import{applyEdits as n}from"./themeReads.js";var r=new Set([`.cshtml`,`.razor`]),i=/[\s,]+/,a=e=>{let t=/\.[^./]*$/.exec(e);return t?t[0].toLowerCase():``},o=(e,t)=>e.slice(0,t).split(`
2
+ `).length;function s(e){return Object.values(e.values).join(`, `)}function c(e,t){if(t.value.startsWith(`@`))return{};if(t.kind!==`quoted`)return{message:`write it as ${t.name}="<word>, <word>"; one of: ${s(e)}.`};let n=t.value.split(i).filter(e=>e!==``);if(n.length===0)return{};let r=[];for(let t of n){let n=t.toLowerCase(),i=Object.hasOwn(e.values,n)?e.values[n]:void 0;if(i===void 0)return{message:`"${t}" is not a ${e.enum}. Use one of: ${s(e)}.`};r.push(`${e.enum}.${i}`)}return{edit:{start:t.valueStart,end:t.valueEnd,text:`@(new[] { ${r.join(`, `)} })`}}}function l(i,s,l){if(l.length===0||!r.has(a(s)))return{text:i,hits:[],findings:[]};let u=[],d=[],f=[];for(let r of l)for(let a of r.tags)for(let{nameEnd:l,end:p}of t(i,a))if(p===-1)f.push({file:s,line:o(i,l),path:`<${a}>`,message:`the tag could not be read (a quote in an attribute value does not pair up); set it by hand`});else for(let t of e(i,l,p)){if(t.name!==r.attribute)continue;let e=o(i,t.nameStart),l=c(r,t);if(l.message!==void 0){f.push({file:s,line:e,path:`<${a}> ${r.attribute}`,message:l.message});continue}let p=l.edit;if(p===void 0)continue;u.push(p);let m=n(i.slice(t.nameStart,t.attrEnd),[{start:p.start-t.nameStart,end:p.end-t.nameStart,text:p.text}],s);d.push({line:e,from:i.slice(t.nameStart,t.attrEnd),to:m.replace(/\n\s*/g,` `)})}return d.sort((e,t)=>e.line-t.line||(e.from<t.from?-1:+(e.from>t.from))),f.sort((e,t)=>e.line-t.line||(e.path<t.path?-1:+(e.path>t.path))),{text:n(i,u,s),hits:d,findings:f}}export{l as applyRazorListAttributes};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/tokens",
3
- "version": "0.158.0",
3
+ "version": "0.160.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",
@@ -41,7 +41,7 @@
41
41
  "devDependencies": {
42
42
  "@babel/types": "7.29.8",
43
43
  "@types/node": "25.6.0",
44
- "@webority/biome-config": "0.158.0",
44
+ "@webority/biome-config": "0.160.0",
45
45
  "ajv": "8.20.0",
46
46
  "typescript": "^7.0.2",
47
47
  "vite": "^8.3.6"
@@ -0,0 +1,358 @@
1
+ {
2
+ "version": "0.160.0",
3
+ "css": {
4
+ "rename": [],
5
+ "reads": [],
6
+ "choose": {},
7
+ "checkRole": []
8
+ },
9
+ "classes": [],
10
+ "themeReads": [],
11
+ "props": [],
12
+ "propValues": [],
13
+ "propSplits": [],
14
+ "razorAttributes": [],
15
+ "componentProps": [],
16
+ "valueSplits": [],
17
+ "components": [],
18
+ "razorValueSplits": [],
19
+ "razorTags": [],
20
+ "razorEnumAttributes": [
21
+ {
22
+ "tags": ["app-action-icon", "app-alert", "app-avatar", "app-button", "app-stepper", "app-wizard"],
23
+ "attribute": "icon-variant",
24
+ "enum": "IconVariant",
25
+ "values": {
26
+ "linear": "Linear",
27
+ "outline": "Outline",
28
+ "bold": "Bold",
29
+ "bulk": "Bulk",
30
+ "broken": "Broken",
31
+ "twotone": "Twotone"
32
+ },
33
+ "nullable": true,
34
+ "keepExpressions": true
35
+ },
36
+ {
37
+ "tags": ["app-analytics-head"],
38
+ "attribute": "load-delay",
39
+ "enum": "AppAnalyticsHeadLoadDelay",
40
+ "values": {
41
+ "idle": "Idle"
42
+ },
43
+ "nullable": true,
44
+ "keepExpressions": true
45
+ },
46
+ {
47
+ "tags": ["app-avatar"],
48
+ "attribute": "size",
49
+ "enum": "AppAvatarSize",
50
+ "values": {
51
+ "xs": "Xs",
52
+ "sm": "Sm",
53
+ "md": "Md",
54
+ "lg": "Lg",
55
+ "xl": "Xl",
56
+ "2xl": "TwoXl"
57
+ },
58
+ "numberAttribute": "size-px",
59
+ "nullable": true,
60
+ "keepExpressions": true
61
+ },
62
+ {
63
+ "tags": ["app-button"],
64
+ "attribute": "size",
65
+ "enum": "WideSize",
66
+ "values": {
67
+ "sm": "Sm",
68
+ "md": "Md",
69
+ "lg": "Lg",
70
+ "xl": "Xl"
71
+ },
72
+ "nullable": true,
73
+ "keepExpressions": true
74
+ },
75
+ {
76
+ "tags": ["app-card"],
77
+ "attribute": "max-width",
78
+ "enum": "AppCardMaxWidth",
79
+ "values": {
80
+ "xs": "Xs",
81
+ "sm": "Sm",
82
+ "md": "Md",
83
+ "lg": "Lg"
84
+ },
85
+ "numberAttribute": "max-width-px",
86
+ "nullable": true,
87
+ "keepExpressions": true
88
+ },
89
+ {
90
+ "tags": ["app-chart"],
91
+ "attribute": "type",
92
+ "enum": "AppChartType",
93
+ "values": {
94
+ "line": "Line",
95
+ "area": "Area",
96
+ "column": "Column",
97
+ "bar": "Bar",
98
+ "donut": "Donut",
99
+ "heatmap": "Heatmap",
100
+ "calendar": "Calendar",
101
+ "funnel": "Funnel",
102
+ "gauge": "Gauge",
103
+ "waterfall": "Waterfall",
104
+ "treemap": "Treemap",
105
+ "sankey": "Sankey",
106
+ "scatter": "Scatter",
107
+ "bubble": "Bubble",
108
+ "multiples": "Multiples"
109
+ },
110
+ "nullable": true,
111
+ "keepExpressions": true
112
+ },
113
+ {
114
+ "tags": ["app-checkbox", "app-input", "app-radio", "app-search", "app-select", "app-switch", "app-textarea"],
115
+ "attribute": "size",
116
+ "enum": "ControlSize",
117
+ "values": {
118
+ "sm": "Sm",
119
+ "md": "Md",
120
+ "lg": "Lg"
121
+ },
122
+ "nullable": true,
123
+ "keepExpressions": true
124
+ },
125
+ {
126
+ "tags": ["app-image-picker", "app-splash", "app-timeline"],
127
+ "attribute": "size",
128
+ "enum": "ControlSize",
129
+ "values": {
130
+ "sm": "Sm",
131
+ "md": "Md",
132
+ "lg": "Lg"
133
+ },
134
+ "numberAttribute": "size-px",
135
+ "nullable": true,
136
+ "keepExpressions": true
137
+ },
138
+ {
139
+ "tags": ["app-confirm-dialog"],
140
+ "attribute": "size",
141
+ "enum": "WideSize",
142
+ "values": {
143
+ "sm": "Sm",
144
+ "md": "Md",
145
+ "lg": "Lg",
146
+ "xl": "Xl"
147
+ },
148
+ "numberAttribute": "size-px",
149
+ "nullable": true,
150
+ "keepExpressions": true
151
+ },
152
+ {
153
+ "tags": ["app-context-menu-item", "app-context-menu-submenu", "app-dropdown-item", "app-split-button-item"],
154
+ "attribute": "tone",
155
+ "enum": "Tone",
156
+ "values": {
157
+ "primary": "Primary",
158
+ "success": "Success",
159
+ "warning": "Warning",
160
+ "danger": "Danger",
161
+ "info": "Info",
162
+ "neutral": "Neutral"
163
+ },
164
+ "nullable": true,
165
+ "keepExpressions": true
166
+ },
167
+ {
168
+ "tags": ["app-filter-facet"],
169
+ "attribute": "type",
170
+ "enum": "AppFilterFacetType",
171
+ "values": {
172
+ "enum": "Enum",
173
+ "multienum": "MultiEnum",
174
+ "daterange": "DateRange",
175
+ "text": "Text"
176
+ },
177
+ "nullable": true,
178
+ "keepExpressions": true
179
+ },
180
+ {
181
+ "tags": ["app-modal", "app-modal-content"],
182
+ "attribute": "size",
183
+ "enum": "AppModalSize",
184
+ "values": {
185
+ "sm": "Sm",
186
+ "md": "Md",
187
+ "lg": "Lg",
188
+ "xl": "Xl",
189
+ "fullscreen": "Fullscreen"
190
+ },
191
+ "numberAttribute": "size-px",
192
+ "nullable": true,
193
+ "keepExpressions": true
194
+ },
195
+ {
196
+ "tags": ["app-nav-list-item"],
197
+ "attribute": "dot-tone",
198
+ "enum": "Tone",
199
+ "values": {
200
+ "primary": "Primary",
201
+ "success": "Success",
202
+ "warning": "Warning",
203
+ "danger": "Danger",
204
+ "info": "Info",
205
+ "neutral": "Neutral"
206
+ },
207
+ "nullable": true,
208
+ "keepExpressions": true
209
+ },
210
+ {
211
+ "tags": ["app-onboarding-step"],
212
+ "attribute": "status",
213
+ "enum": "OnboardingStatus",
214
+ "values": {
215
+ "done": "Done",
216
+ "current": "Current",
217
+ "skipped": "Skipped",
218
+ "todo": "Todo"
219
+ },
220
+ "nullable": true,
221
+ "keepExpressions": true
222
+ },
223
+ {
224
+ "tags": ["app-radio-group"],
225
+ "attribute": "variant",
226
+ "enum": "AppRadioGroupVariant",
227
+ "values": {
228
+ "default": "Default",
229
+ "card": "Card"
230
+ },
231
+ "nullable": true,
232
+ "keepExpressions": true
233
+ },
234
+ {
235
+ "tags": ["app-rolling-number"],
236
+ "attribute": "unit",
237
+ "enum": "MoneyUnit",
238
+ "values": {
239
+ "rupees": "Rupees",
240
+ "paise": "Paise"
241
+ },
242
+ "nullable": true,
243
+ "keepExpressions": true
244
+ },
245
+ {
246
+ "tags": ["app-saved-views"],
247
+ "attribute": "mode",
248
+ "enum": "AppSavedViewsMode",
249
+ "values": {
250
+ "browser": "Browser",
251
+ "server": "Server"
252
+ },
253
+ "nullable": true,
254
+ "keepExpressions": true
255
+ },
256
+ {
257
+ "tags": ["app-select"],
258
+ "attribute": "mode",
259
+ "enum": "AppSelectMode",
260
+ "values": {
261
+ "single": "Single",
262
+ "multiple": "Multiple",
263
+ "search": "Search",
264
+ "tag": "Tag",
265
+ "country": "Country"
266
+ },
267
+ "nullable": true,
268
+ "keepExpressions": true
269
+ },
270
+ {
271
+ "tags": ["app-select"],
272
+ "attribute": "density",
273
+ "enum": "Density",
274
+ "values": {
275
+ "comfortable": "Comfortable",
276
+ "compact": "Compact"
277
+ },
278
+ "nullable": true,
279
+ "keepExpressions": true
280
+ },
281
+ {
282
+ "tags": ["app-sortable-list"],
283
+ "attribute": "orientation",
284
+ "enum": "Orientation",
285
+ "values": {
286
+ "horizontal": "Horizontal",
287
+ "vertical": "Vertical"
288
+ },
289
+ "nullable": true,
290
+ "keepExpressions": true
291
+ },
292
+ {
293
+ "tags": ["app-spinner"],
294
+ "attribute": "size",
295
+ "enum": "CompactSize",
296
+ "values": {
297
+ "sm": "Sm",
298
+ "md": "Md"
299
+ },
300
+ "numberAttribute": "size-px",
301
+ "nullable": true,
302
+ "keepExpressions": true
303
+ }
304
+ ],
305
+ "razorListAttributes": [
306
+ {
307
+ "tags": ["app-consent-banner"],
308
+ "attribute": "categories",
309
+ "enum": "ConsentCategory",
310
+ "values": { "analytics": "Analytics", "functional": "Functional", "marketing": "Marketing" }
311
+ },
312
+ {
313
+ "tags": ["app-lead-popup"],
314
+ "attribute": "fields",
315
+ "enum": "LeadPopupField",
316
+ "values": {
317
+ "name": "Name",
318
+ "email": "Email",
319
+ "phone": "Phone",
320
+ "company": "Company",
321
+ "message": "Message",
322
+ "consent": "Consent"
323
+ }
324
+ },
325
+ {
326
+ "tags": ["app-lead-popup"],
327
+ "attribute": "required",
328
+ "enum": "LeadPopupField",
329
+ "values": {
330
+ "name": "Name",
331
+ "email": "Email",
332
+ "phone": "Phone",
333
+ "company": "Company",
334
+ "message": "Message",
335
+ "consent": "Consent"
336
+ }
337
+ },
338
+ {
339
+ "tags": ["app-lead-popup"],
340
+ "attribute": "triggers",
341
+ "enum": "LeadPopupTrigger",
342
+ "values": { "exit": "Exit", "delay": "Delay", "scroll": "Scroll", "pages": "Pages" }
343
+ },
344
+ {
345
+ "tags": ["app-section-lead-capture"],
346
+ "attribute": "fields",
347
+ "enum": "LeadCaptureField",
348
+ "values": { "name": "Name", "email": "Email", "phone": "Phone", "company": "Company", "message": "Message" }
349
+ },
350
+ {
351
+ "tags": ["app-section-lead-capture"],
352
+ "attribute": "required",
353
+ "enum": "LeadCaptureField",
354
+ "values": { "name": "Name", "email": "Email", "phone": "Phone", "company": "Company", "message": "Message" }
355
+ }
356
+ ],
357
+ "csharpEnumArguments": []
358
+ }
@@ -104,6 +104,16 @@ export interface RazorEnumAttributeRule {
104
104
  numberAttribute?: string;
105
105
  /** The property is a nullable enum, where Razor reads the value as C#, so a literal is written as `Enum.Member` instead of the bare member. */
106
106
  nullable?: boolean;
107
+ /** The property took the enum before this version, so an `@expression` already returns it and is left as written, with no finding. */
108
+ keepExpressions?: boolean;
109
+ }
110
+
111
+ /** A Razor tag-helper attribute whose comma or space separated word list became a typed enum array: `values` maps each old word, lower-cased, to its member. */
112
+ export interface RazorListAttributeRule {
113
+ tags: string[];
114
+ attribute: string;
115
+ enum: string;
116
+ values: Readonly<Record<string, string>>;
107
117
  }
108
118
 
109
119
  /** A string argument of a C# call of this library that takes an enum member now. `call` is the text before the opening bracket (`new StatusDisplay`, `.Add`, `ButtonClass.For`); `within`, when given, must appear in the statement the call belongs to (`new StatusDisplayMap<`). `argument` counts from 1. */
@@ -139,6 +149,7 @@ export interface RenameTable {
139
149
  valueSplits?: ValueSplitRule[];
140
150
  razorValueSplits?: RazorValueSplitRule[];
141
151
  razorEnumAttributes?: RazorEnumAttributeRule[];
152
+ razorListAttributes?: RazorListAttributeRule[];
142
153
  csharpEnumArguments?: CsharpEnumArgumentRule[];
143
154
  }
144
155