@webority/theme 0.87.0 → 0.87.1
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/webority-theme-codemod.mjs +2 -0
- package/dist/webority-theme-export.mjs +1 -1
- package/dist/webority-theme.css +1 -1
- package/package.json +3 -2
- package/scss/_wui-aliases.scss +10 -0
- package/scss/_wui-components.scss +2 -0
- package/scss/_wui-core.scss +2 -0
- package/scss/wui/_chat.scss +2 -1
- package/scss/wui/_consent-banner.scss +7 -0
- package/scss/wui/_controls.scss +0 -11
- package/scss/wui/_field-floor.scss +82 -0
- package/scss/wui/_file-viewer.scss +6 -0
- package/scss/wui/_floating.scss +2 -1
- package/scss/wui/_rich-text.scss +6 -0
- package/scss/wui/_workspace.scss +6 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{readFileSync as e,readdirSync as t,statSync as n,writeFileSync as r}from"node:fs";import{join as i,relative as a}from"node:path";var o={radius:[[/--wui-radius(?![\w-])/g,`--wui-radius-md`]]};function s(e){console.error(`webority-theme-codemod: ${e}`),console.error(`usage: webority-theme-codemod <rename> [--dry-run] [path...]`),process.exit(2)}function c(e){let t,n=!1,r=[];for(let i=0;i<e.length;i++)e[i]===`--dry-run`?n=!0:e[i].startsWith(`--`)?s(`unknown option ${e[i]}`):t?r.push(e[i]):t=e[i];if(t||s(`missing rename name`),!o[t]){let e=Object.keys(o).join(`, `);s(`unknown rename ${t}; known: ${e}`)}return r.length===0&&r.push(`.`),{rename:t,dryRun:n,paths:r}}var l=new Set([`.css`,`.scss`,`.sass`,`.less`,`.js`,`.jsx`,`.mjs`,`.ts`,`.tsx`,`.cshtml`,`.razor`,`.html`,`.vue`,`.json`]),u=new Set([`node_modules`,`dist`,`bin`,`obj`,`.git`,`.next`,`coverage`]);function d(o,s,c,f){let p;try{p=n(o)}catch{return}if(p.isDirectory()){let e=o.split(/[/\\]/).pop()||o,n=o.replace(/\\/g,`/`),r=n.includes(`/wwwroot/lib/`)||n.endsWith(`/wwwroot/lib`)||n.startsWith(`wwwroot/lib/`)||n===`wwwroot/lib`;if(u.has(e)||r)return;let a;try{a=t(o)}catch{return}for(let e of a)d(i(o,e),s,c,f)}else if(p.isFile()){let t=o.match(/\.[^.]+$/),n=t?t[0].toLowerCase():``;if(!l.has(n))return;let i=e(o,`utf8`),u=0;for(let[e,t]of s){let n=0;i=i.replace(e,()=>(n++,t)),u+=n}if(u>0){let e=a(process.cwd(),o).replace(/\\/g,`/`)||o.replace(/\\/g,`/`);console.log(`${e}: ${u} replacement(s)`),c||r(o,i,`utf8`),f.files++,f.replacements+=u}}}var{rename:f,dryRun:p,paths:m}=c(process.argv.slice(2)),h=o[f],g={files:0,replacements:0};for(let e of m)d(e,h,p,g);var _=p?` (dry run, nothing written)`:``;console.log(`webority-theme-codemod ${f}: ${g.replacements} replacement(s) in ${g.files} file(s)${_}`),process.exit(0);export{};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{readFileSync as e,writeFileSync as t}from"node:fs";var n=`webority-theme-tokens/1`,r=[`--wui-primary`,`--bs-primary`,`--bs-primary-rgb`,`--bs-link-color-rgb`,`--bs-body-font-family`];function i(e){console.error(`webority-theme-export: ${e}`),console.error(`usage: webority-theme-export <compiled.css>... --product <name> [--out <tokens.json>] [--widths 1440,390]`),process.exit(2)}function a(e){let t=[],n,r,a=[];for(let o=0;o<e.length;o++)e[o]===`--product`?n=e[++o]:e[o]===`--out`?r=e[++o]:e[o]===`--widths`?a=(e[++o]??``).split(`,`).map(e=>e.trim()):e[o].startsWith(`--`)?i(`unknown option ${e[o]}`):t.push(e[o]);return t.length===0&&i(`no compiled CSS file given`),(!n||!/^[a-z0-9-]+$/.test(n))&&i(`--product must be the product's lowercase name`),a.some(e=>!/^[1-9]\d*$/.test(e))&&i(`--widths takes whole pixel widths, such as 1440,390`),a.length>0&&!r&&i(`--widths needs --out, the file name each width's file is named after`),{files:t,product:n,out:r,widths:a.map(Number)}}var o=16;function s(e,t){let n=e.trim(),r=/^(clamp|calc|min|max)\((.*)\)$/.exec(n);if(r){let e=l(r[2],`,`).map(e=>s(e,t));return e.some(e=>e===null)?null:r[1]===`calc`?e.length===1?e[0]:null:r[1]===`clamp`?e.length===3?Math.min(Math.max(e[1],e[0]),e[2]):null:r[1]===`min`?Math.min(...e):Math.max(...e)}let i=n.split(/\s+/),a=0,c=1;for(let e=0;e<i.length;e++){if(e%2==1){if(i[e]!==`+`&&i[e]!==`-`)return null;c=i[e]===`+`?1:-1;continue}let n=/^(-?\d*\.?\d+)(px|rem|vw)?$/.exec(i[e]);if(!n||!n[2]&&Number(n[1])!==0)return null;let r=Number(n[1]),s=n[2]===`rem`?r*o:n[2]===`vw`?r*t/100:r;a+=c*s}return i.length%2==1?a:null}function c(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>{let r=s(n,t);return[e,r===null?n:`${Math.round(r*100)/100}px`]}))}function l(e,t){let n=[],r=0,i=null,a=0;for(let o=0;o<e.length;o++){let s=e[o];i?s===`\\`?o++:s===i&&(i=null):s===`"`||s===`'`?i=s:s===`(`||s===`[`?r++:s===`)`||s===`]`?r--:s===t&&r===0&&(n.push(e.slice(a,o)),a=o+1)}return n.push(e.slice(a)),n}function u(e){let t=[],n=0,r=null,i=0,a=-1;for(let o=0;o<e.length;o++){let s=e[o];if(r)s===`\\`?o++:s===r&&(r=null);else if(s===`"`||s===`'`)r=s;else if(s===`{`)n===0&&(a=o),n++;else if(s===`}`){if(n--,n===0){let n=e.slice(i,a).trim();n.startsWith(`@`)||t.push({selectors:l(n,`,`).map(
|
|
2
|
+
import{readFileSync as e,writeFileSync as t}from"node:fs";var n=`webority-theme-tokens/1`,r=[`--wui-primary`,`--bs-primary`,`--bs-primary-rgb`,`--bs-link-color-rgb`,`--bs-body-font-family`];function i(e){console.error(`webority-theme-export: ${e}`),console.error(`usage: webority-theme-export <compiled.css>... --product <name> [--out <tokens.json>] [--widths 1440,390]`),process.exit(2)}function a(e){let t=[],n,r,a=[];for(let o=0;o<e.length;o++)e[o]===`--product`?n=e[++o]:e[o]===`--out`?r=e[++o]:e[o]===`--widths`?a=(e[++o]??``).split(`,`).map(e=>e.trim()):e[o].startsWith(`--`)?i(`unknown option ${e[o]}`):t.push(e[o]);return t.length===0&&i(`no compiled CSS file given`),(!n||!/^[a-z0-9-]+$/.test(n))&&i(`--product must be the product's lowercase name`),a.some(e=>!/^[1-9]\d*$/.test(e))&&i(`--widths takes whole pixel widths, such as 1440,390`),a.length>0&&!r&&i(`--widths needs --out, the file name each width's file is named after`),{files:t,product:n,out:r,widths:a.map(Number)}}var o=16;function s(e,t){let n=e.trim(),r=/^(clamp|calc|min|max)\((.*)\)$/.exec(n);if(r){let e=l(r[2],`,`).map(e=>s(e,t));return e.some(e=>e===null)?null:r[1]===`calc`?e.length===1?e[0]:null:r[1]===`clamp`?e.length===3?Math.min(Math.max(e[1],e[0]),e[2]):null:r[1]===`min`?Math.min(...e):Math.max(...e)}let i=n.split(/\s+/),a=0,c=1;for(let e=0;e<i.length;e++){if(e%2==1){if(i[e]!==`+`&&i[e]!==`-`)return null;c=i[e]===`+`?1:-1;continue}let n=/^(-?\d*\.?\d+)(px|rem|vw)?$/.exec(i[e]);if(!n||!n[2]&&Number(n[1])!==0)return null;let r=Number(n[1]),s=n[2]===`rem`?r*o:n[2]===`vw`?r*t/100:r;a+=c*s}return i.length%2==1?a:null}function c(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>{let r=s(n,t);return[e,r===null?n:`${Math.round(r*100)/100}px`]}))}function l(e,t){let n=[],r=0,i=null,a=0;for(let o=0;o<e.length;o++){let s=e[o];i?s===`\\`?o++:s===i&&(i=null):s===`"`||s===`'`?i=s:s===`(`||s===`[`?r++:s===`)`||s===`]`?r--:s===t&&r===0&&(n.push(e.slice(a,o)),a=o+1)}return n.push(e.slice(a)),n}var u=10,d=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,f=/^rgba?\(([\s\S]*)\)$/i,p=/^color-mix\(([\s\S]*)\)$/i,m=/^var\(([\s\S]*)\)$/i;function h(e,t,n=0){if(n>u)return null;let r=e.trim(),i=m.exec(r);if(i){let e=l(i[1],`,`),r=e[0].trim();if(!/^--[a-z0-9-]+$/i.test(r))return null;let a=t(r);if(a!==void 0)return h(a,t,n+1);let o=e.slice(1).join(`,`).trim();return o?h(o,t,n+1):null}let a=d.exec(r);if(a){let e=a[1];e.length<=4&&(e=[...e].map(e=>e+e).join(``)),e.length===6&&(e+=`ff`);let t=t=>Number.parseInt(e.slice(t,t+2),16);return[t(0),t(2),t(4),t(6)/255]}let o=f.exec(r);if(o)return g(o[1]);let s=p.exec(r);if(s)return y(s[1],t,n);let c=r.toLowerCase();return c===`white`?[255,255,255,1]:c===`black`?[0,0,0,1]:c===`transparent`?[0,0,0,0]:null}function g(e){let t=e.trim(),n,r=l(t,`/`);if(r.length>2)return null;r.length===2&&(t=r[0].trim(),n=r[1].trim());let i=l(t,`,`).flatMap(e=>e.trim().split(/\s+/)).filter(Boolean);if(i.length!==3&&i.length!==4)return null;let a=i.slice(0,3).map(e=>/^-?\d*\.?\d+$/.test(e)?Math.min(255,Math.max(0,Number(e))):null);if(a.some(e=>e===null))return null;if(i.length===4){if(n!==void 0)return null;n=i[3]}let o=n===void 0?1:_(n);return o===null?null:[...a,o]}function _(e){let t=e.trim(),n=/^(-?\d*\.?\d+)%$/.exec(t);return n?Math.min(1,Math.max(0,Number(n[1])/100)):/^-?\d*\.?\d+$/.test(t)?Math.min(1,Math.max(0,Number(t))):null}function v(e){let t=e.trim(),n=/\s+(-?\d*\.?\d+)%$/.exec(t);if(!n)return{colour:t};let r=t.slice(0,n.index).trim();return r?{colour:r,percent:Number(n[1])}:null}function y(e,t,n){let r=l(e,`,`);if(r.length!==3||!/^in\s+srgb$/i.test(r[0].trim()))return null;let i=v(r[1]),a=v(r[2]);if(!i||!a)return null;let o=h(i.colour,t,n+1),s=h(a.colour,t,n+1);if(!o||!s)return null;let c=i.percent,u=a.percent,d=1;if(c===void 0&&u===void 0)c=50,u=50;else if(u===void 0)u=100-c;else if(c===void 0)c=100-u;else if(c+u!==100){let e=c+u;e>0?(e<100&&(d=e/100),c=c*100/e,u=u*100/e):(c=0,u=0)}let f=c/100,p=u/100,m=o[3]*f+s[3]*p;return[...[0,1,2].map(e=>m===0?0:(o[e]*o[3]*f+s[e]*s[3]*p)/m),m*d]}function b(e){let t=e.slice(0,3).map(e=>Math.round(Math.min(255,Math.max(0,e))).toString(16).padStart(2,`0`)).join(``),n=Math.round(Math.min(1,Math.max(0,e[3]))*255);return`#${t}${n<255?n.toString(16).padStart(2,`0`):``}`}function x(e){let t=[],n=0,r=null,i=0,a=-1;for(let o=0;o<e.length;o++){let s=e[o];if(r)s===`\\`?o++:s===r&&(r=null);else if(s===`"`||s===`'`)r=s;else if(s===`{`)n===0&&(a=o),n++;else if(s===`}`){if(n--,n===0){let n=e.slice(i,a).trim();n.startsWith(`@`)||t.push({selectors:l(n,`,`).map(S),body:e.slice(a+1,o)}),i=o+1}}else s===`;`&&n===0&&(i=o+1)}return t}function S(e){return e.trim().replace(/\s+/g,` `).replace(/["']/g,``)}var C=new Set([`:root`,`[data-bs-theme=light]`,`:root[data-bs-theme=light]`,`:root[data-theme=light]`]),w=new Set([`:root[data-theme=dark]`,`:root[data-bs-theme=dark]`]),T=new Set([`[data-bs-theme=dark]`]);function E(e){let t=[];for(let n of l(e,`;`)){let e=n.indexOf(`:`);if(e<0)continue;let r=n.slice(0,e).trim();r.startsWith(`--`)&&t.push([r,n.slice(e+1).trim().replace(/\s*!important$/,``)])}return t}function D(e,t,n){for(let[r,i]of Object.entries(e)){if(!i.startsWith(`var(`)&&!i.startsWith(`color-mix(`))continue;let a=h(i,t,0);a?e[r]=b(a):i.startsWith(`color-mix(`)&&console.error(`webority-theme-export: ${r} in ${n} left as written: ${i}`)}}var{files:O,product:k,out:A,widths:j}=a(process.argv.slice(2)),M={},N={},P={};for(let t of O){let n=e(t,`utf8`).replace(/\/\*[\s\S]*?\*\//g,``);for(let e of x(n)){let t=t=>e.selectors.some(e=>t.has(e)),n=t(w)?N:t(T)?P:t(C)?M:null;if(n)for(let[t,r]of E(e.body))n[t]=r}}D(M,e=>M[e],`light`),D(N,e=>e in N?N[e]:M[e],`dark`),D(P,e=>e in P?P[e]:e in N?N[e]:M[e],`bootstrapDark`);var F=r.filter(e=>!(e in M));F.length>0&&(console.error(`webority-theme-export: ${O.join(`, `)} declares no ${F.join(`, `)} on :root.`),console.error(`Pass the compiled stylesheet that carries the full theme, not a page or component bundle.`),process.exit(1));var I=e=>Object.fromEntries(Object.entries(e).sort(([e],[t])=>e.localeCompare(t))),L=`${JSON.stringify({format:n,product:k,light:I(M),dark:I(N),bootstrapDark:I(P)},null,2)}\n`;if(j.length>0){let e=A.replace(/\.json$/i,``);for(let r of j){let i=`${e}-${r}.json`,a={light:c(M,r),dark:c(N,r),bootstrapDark:c(P,r)},o={format:n,product:k,width:r,light:I(a.light),dark:I(a.dark),bootstrapDark:I(a.bootstrapDark)};t(i,`${JSON.stringify(o,null,2)}\n`),process.stderr.write(`webority-theme-export: ${Object.keys(M).length} light values at ${r}px -> ${i}\n`)}}else A?(t(A,L),process.stderr.write(`webority-theme-export: ${Object.keys(M).length} light and ${Object.keys(N).length} dark and ${Object.keys(P).length} Bootstrap dark values -> ${A}\n`)):process.stdout.write(L);export{};
|