@webority/tokens 0.122.0 → 0.125.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.
Files changed (52) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +1 -1
  2. package/dist/brand.js +1 -1
  3. package/dist/build.js +2 -2
  4. package/dist/canvas/webority-phone.json +1 -1
  5. package/dist/canvas/webority-web-390.json +1 -1
  6. package/dist/canvas/webority-web.json +1 -1
  7. package/dist/check.js +2 -2
  8. package/dist/cli.d.ts +7 -3
  9. package/dist/cli.js +4 -2
  10. package/dist/emit/canvas.js +1 -1
  11. package/dist/emit/email.js +1 -1
  12. package/dist/emit/web.js +10 -10
  13. package/dist/index.js +1 -1
  14. package/dist/meanings.json +1 -1
  15. package/dist/model/index.js +1 -1
  16. package/dist/model/load.js +1 -1
  17. package/dist/model/references.js +1 -1
  18. package/dist/model/resolve.js +1 -1
  19. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/2020.js +1 -1
  20. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/index.js +2 -2
  21. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/index.js +1 -1
  22. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/util.js +1 -1
  23. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js +1 -1
  24. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js +1 -1
  25. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/index.js +1 -1
  26. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/keyword.js +1 -1
  27. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/core.js +1 -1
  28. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +1 -1
  29. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +1 -1
  30. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/index.js +1 -1
  31. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items.js +1 -1
  32. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js +1 -1
  33. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +1 -1
  34. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/properties.js +1 -1
  35. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js +1 -1
  36. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/index.js +1 -1
  37. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +1 -1
  38. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +1 -1
  39. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/pattern.js +1 -1
  40. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js +1 -1
  41. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +1 -1
  42. package/dist/node_modules/.pnpm/fast-uri@3.1.9/node_modules/fast-uri/index.js +1 -1
  43. package/dist/node_modules/.pnpm/fast-uri@3.1.9/node_modules/fast-uri/lib/schemes.js +1 -1
  44. package/dist/node_modules/.pnpm/fast-uri@3.1.9/node_modules/fast-uri/lib/utils.js +1 -1
  45. package/dist/source/mode.dark.tokens.json +65 -0
  46. package/dist/upgrade/components.js +2 -2
  47. package/dist/upgrade/index.js +2 -2
  48. package/dist/upgrade/razorAttributes.js +2 -2
  49. package/dist/upgrade/razorTags.js +2 -2
  50. package/dist/upgrade/tagScan.js +1 -0
  51. package/dist/upgrade/themeReads.js +1 -1
  52. package/package.json +1 -1
@@ -1,3 +1,3 @@
1
- var e=new Set([`.cshtml`,`.razor`]);function t(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function n(e){let t=/\.[^./]*$/.exec(e);return t?t[0].toLowerCase():``}function r(e){let t=[];for(let n=e.indexOf(`
1
+ import{tagOccurrences as e}from"./tagScan.js";var t=new Set([`.cshtml`,`.razor`]);function n(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function r(e){let t=/\.[^./]*$/.exec(e);return t?t[0].toLowerCase():``}function i(e){let t=[];for(let n=e.indexOf(`
2
2
  `);n!==-1;n=e.indexOf(`
3
- `,n+1))t.push(n);return t}function i(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1;e[i]<t?n=i+1:r=i}return n+1}function a(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 o(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 o=a(e,i);o!==-1&&r.push({nameEnd:i,end:o})}return r}function s(e,t){return e<t?-1:+(e>t)}function c(a,c,l){if(l.length===0||!e.has(n(c)))return{text:a,hits:[],findings:[]};let u=r(a),d=[],f=[],p=[];for(let e of l){let n=e.attribute,r=t(n),s=RegExp(`(?<=\\s)${r}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`,`g`),l=RegExp(`(?<=\\s)${r}(?=[\\s/]|$)(?!\\s*=)`,`g`),m=(t,r)=>({file:c,line:r,path:`<${t}> ${n}`,message:`${n} takes a named value such as "${e.values.true}" or "${e.values.false}" now, not a boolean; set it by hand`});for(let t of e.tags)for(let{nameEnd:r,end:c}of o(a,t)){let o=a.slice(r,c);for(let a of o.matchAll(s)){let o=r+a.index,s=i(u,o),c=a[1]??a[2],l=o+a[0].length-1,h=l-c.length,g=c.toLowerCase();if(Object.hasOwn(e.values,g)){let t=e.values[g];d.push({start:h,end:l,text:t}),f.push({line:s,from:`${n}="${c}"`,to:`${n}="${t}"`})}else c.startsWith(`@`)&&p.push(m(t,s))}for(let e of o.matchAll(l))p.push(m(t,i(u,r+e.index)))}}d.sort((e,t)=>t.start-e.start);let m=a;for(let e of d)m=m.slice(0,e.start)+e.text+m.slice(e.end);return f.sort((e,t)=>e.line-t.line||s(e.from,t.from)),p.sort((e,t)=>e.line-t.line||s(e.path,t.path)),{text:m,hits:f,findings:p}}export{c as applyRazorAttributes};
3
+ `,n+1))t.push(n);return t}function a(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1;e[i]<t?n=i+1:r=i}return n+1}function o(e,t){return e<t?-1:+(e>t)}function s(s,c,l){if(l.length===0||!t.has(r(c)))return{text:s,hits:[],findings:[]};let u=i(s),d=[],f=[],p=[];for(let t of l){let r=t.attribute,i=n(r),o=RegExp(`(?<=\\s)${i}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`,`g`),l=RegExp(`(?<=\\s)${i}(?=[\\s/]|$)(?!\\s*=)`,`g`),m=(e,n)=>({file:c,line:n,path:`<${e}> ${r}`,message:`${r} takes a named value such as "${t.values.true}" or "${t.values.false}" now, not a boolean; set it by hand`});for(let n of t.tags)for(let{nameEnd:i,end:h}of e(s,n)){if(h===-1){p.push({file:c,line:a(u,i),path:`<${n}> ${r}`,message:`the tag could not be read (a quote in an attribute value does not pair up); set it by hand`});continue}let e=s.slice(i,h);for(let s of e.matchAll(o)){let e=i+s.index,o=a(u,e),c=s[1]??s[2],l=e+s[0].length-1,h=l-c.length,g=c.toLowerCase();if(Object.hasOwn(t.values,g)){let e=t.values[g];d.push({start:h,end:l,text:e}),f.push({line:o,from:`${r}="${c}"`,to:`${r}="${e}"`})}else c.startsWith(`@`)&&p.push(m(n,o))}for(let t of e.matchAll(l))p.push(m(n,a(u,i+t.index)))}}d.sort((e,t)=>t.start-e.start);let m=s;for(let e of d)m=m.slice(0,e.start)+e.text+m.slice(e.end);return f.sort((e,t)=>e.line-t.line||o(e.from,t.from)),p.sort((e,t)=>e.line-t.line||o(e.path,t.path)),{text:m,hits:f,findings:p}}export{s as applyRazorAttributes};
@@ -1,2 +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
+ import{findQuoteEnd as e,tagOccurrences as t}from"./tagScan.js";var n=new Set([`.cshtml`,`.razor`]),r=/(\s*)([^\s=/>"']+)(\s*=\s*)?/y,i=/[^\s"'>]+/y,a=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),o=e=>{let t=/\.[^./]*$/.exec(e);return t?t[0].toLowerCase():``},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);function u(t,n,a){let o=[],s=n;for(;;){r.lastIndex=s;let n=r.exec(t);if(n===null)break;let c=n.index+n[1].length,l=c+n[2].length,u={name:n[2],nameStart:c,nameEnd:l,wsStart:n.index,kind:`none`,attrEnd:l},d=n.index+n[0].length;if(n[3]!==void 0&&(t[d]===`"`||t[d]===`'`)){let n=e(t,d);if(n===-1)break;u.kind=`quoted`,u.value=t.slice(d+1,n),u.valueStart=d+1,u.valueEnd=n,u.attrEnd=n+1}else if(n[3]!==void 0){i.lastIndex=d;let e=i.exec(t);e!==null&&(u.kind=`bare`,u.attrEnd=d+e[0].length)}if(u.attrEnd>a)break;o.push(u),s=u.attrEnd}return o}function d(e,n,r,i){let o=[],s=[],l=[],d=e=>Object.hasOwn(n.renameAttributes,e)?n.renameAttributes[e]:e,f=n.from!==n.to,p=t(e,n.from),m=p.filter(e=>e.end===-1);if(m.length>0){for(let{nameEnd:e}of m)l.push({file:i,line:c(r,e),path:`<${n.from}>`,message:`the tag could not be read (a quote in an attribute value does not pair up); rename it by hand`});return{edits:[],hits:[],findings:l}}for(let{nameEnd:t,end:a}of p){let p=c(r,t),m=e.slice(t,a).trimEnd().endsWith(`/`),h=u(e,t,a);for(let[e,t]of Object.entries(n.removeAttributes))h.some(t=>t.name===e)&&l.push({file:i,line:p,path:`<${n.from}> ${e}`,message:t});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:c(r,e.nameStart),from:e.name,to:t}))}let _=h.map(e=>d(e.name));for(let e of h){let t=d(e.name);if(e.kind!==`quoted`||!Object.hasOwn(n.valueMaps,t)||!Object.hasOwn(n.valueMaps[t],e.value))continue;let i=n.valueMaps[t][e.value];o.push({start:e.valueStart,end:e.valueEnd,text:i}),s.push({line:c(r,e.valueStart),from:`${t}="${e.value}"`,to:`${t}="${i}"`})}for(let[e,t]of Object.entries(n.addAttributes))_.includes(e)||g.push(` ${e}="${t}"`);g.length>0&&o.push({start:t,end:t,text:g.join(``)}),(f||g.length>0)&&s.push({line:p,from:`<${n.from}`,to:`<${n.to}${g.join(``)}`}),f&&o.push({start:t-n.from.length,end:t,text:n.to});let v=n.attributeToContent===void 0?void 0:h.find(e=>e.name===n.attributeToContent);if(v===void 0)continue;if(v.kind!==`quoted`){l.push({file:i,line:p,path:`<${n.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:p,from:`${v.name}="${v.value}"`,to:`element content`}),m){let t=e.lastIndexOf(`/`,a);for(;/\s/.test(e[t-1]??``);)t--;o.push({start:t,end:a+1,text:`>${v.value}</${n.to}>`});continue}let y=e.indexOf(`</${n.from}`,a+1);if(y===-1)throw Error(`no closing </${n.from}> for the element at ${i}:${p}`);e.slice(a+1,y).trim()===``?o.push({start:a+1,end:y,text:v.value}):(l.push({file:i,line:p,path:`<${n.from}> ${v.name}`,message:`the element already has content; move ${v.name} into it by hand`}),o.pop(),s.pop())}if(f)for(let t of e.matchAll(RegExp(`</${a(n.from)}(?=\\s*>)`,`g`))){let e=t.index+2;o.push({start:e,end:e+n.from.length,text:n.to}),s.push({line:c(r,e),from:`</${n.from}`,to:`</${n.to}`})}return{edits:o,hits:s,findings:l}}function f(e,t,n){let{edits:r,hits:i,findings:a}=d(e,n,s(e),t);r.sort((e,t)=>t.start-e.start||t.end-e.end);let o=e;for(let e of r)o=o.slice(0,e.start)+e.text+o.slice(e.end);return{text:o,hits:i,findings:a}}function p(e,t,r){if(r.length===0||!n.has(o(t)))return{text:e,hits:[],findings:[]};let i=e,a=[],s=[];for(let e of r){let n=f(i,t,e);i=n.text,a.push(...n.hits),s.push(...n.findings)}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:i,hits:a,findings:s}}export{p as applyRazorTags};
@@ -0,0 +1 @@
1
+ var e=e=>/[\p{L}\p{Nd}_.]/u.test(e);function t(e,t,n){for(let r=t+1;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===n)return r+1;return-1}function n(e,t){for(let n=t+2;n<e.length;n++)if(e[n]===`"`){if(e[n+1]===`"`)n++;else return n+1}return-1}function r(e,r){let i=0,a=r;for(;a<e.length;){let r=e[a];if(r===`@`&&e[a+1]===`"`)a=n(e,a);else if(r===`"`||r===`'`)a=t(e,a,r);else{if(a++,r===`(`||r===`[`)i++;else if((r===`)`||r===`]`)&&(i--,i===0))return a;continue}if(a===-1)return-1}return-1}function i(t,n){let i=n+1;for(;;){for(;i<t.length&&e(t[i]);)i++;let n=t[i];if(n!==`(`&&n!==`[`)return i;if(i=r(t,i),i===-1)return-1;let a=t[i];if(a!==`.`&&a!==`(`&&a!==`[`)return i}}function a(e,t){let n=e[t],r=t+1;for(;r<e.length;){let t=e[r];if(t===`@`&&e[r+1]===`@`)r+=2;else if(t===`@`){if(r=i(e,r),r===-1)return-1}else if(t===n)return r;else r++}return-1}function o(e,t){let n=t;for(;n<e.length;){let t=e[n];if(t===`"`||t===`'`){if(n=a(e,n),n===-1)return-1}else if(t===`>`)return n;n++}return-1}function s(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;/[\s/>]/.test(e[i]??``)&&r.push({nameEnd:i,end:o(e,i)})}return r}export{a as findQuoteEnd,o as findTagEnd,s as tagOccurrences};
@@ -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:[]}}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};
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.122.0",
3
+ "version": "0.125.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",