@wavy/react-ui 0.0.68 → 0.0.73
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/main.d.ts +44 -44
- package/dist/main.js +7 -7
- package/package.json +3 -3
- package/scripts/public/buildTheme.js +3 -10
- package/scripts/public/bundleCss.js +5 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wavy/react-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.73",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Wavy",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"publisher": "npm run build && npm version patch && npm publish"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@wavy/util": "
|
|
35
|
+
"@wavy/util": ">=0.0.13",
|
|
36
36
|
"zod": "^4.2.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@types/node": "^24.7.0",
|
|
41
41
|
"@types/react": "^19.2.2",
|
|
42
42
|
"@types/react-dom": "^19.2.3",
|
|
43
|
-
"@wavy/util": "^0.0.
|
|
43
|
+
"@wavy/util": "^0.0.13",
|
|
44
44
|
"react": "^19.2.0",
|
|
45
45
|
"react-dom": "^19.2.0",
|
|
46
46
|
"tsup": "^8.5.0",
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {upperFirst}from'@wavy/fn';import
|
|
3
|
-
const ${e} = Object.freeze({
|
|
4
|
-
${t.join(`,
|
|
5
|
-
`)}
|
|
6
|
-
})
|
|
7
|
-
|
|
8
|
-
export default ${e}
|
|
9
|
-
`}}function R(r,t,e){let o=(s,n)=>{let g=t.light[s]||n,b=t.dark[s]||n;return k(s).map(i=>{let f=_(i),m=parseFloat(i.replace(/[^0\.0-9]/g,"")),d=m?m/j:1,h=w(g,d),l=w(b,d);return `${f}: light-dark(${h}, ${l})`})};return `
|
|
2
|
+
import {upperFirst}from'@wavy/fn';import b from'path';import {fileURLToPath}from'url';var k=fileURLToPath(import.meta.url),j=b.dirname(k),m=j.split(b.sep).filter((o,r,e)=>r<e.length-2).join(b.sep);var F="__",S=1e3;function w(o,r=1){let e=o.startsWith("#")?o.slice(1):o;e.length===3&&(e=e.split("").map(n=>n+n).join(""));let s=parseInt(e.substring(0,2),16),a=parseInt(e.substring(2,4),16),t=parseInt(e.substring(4,6),16);return `rgba(${s}, ${a}, ${t}, ${r})`}function z(o){return [...Array.from(Array(9)).flatMap((r,e)=>{let s=e+1;return [`${s}00`,`${s}50`].map(a=>`${o}${F}${a}`)}),o]}function x(o,r){let s=`--${(a=>a.split("").map(t=>t===t.toUpperCase()&&t!==t.toLowerCase()?`-${t.toLowerCase()}`:t).join(""))(o)}`;return s}function A(o,r,e){let s=Object.entries(r);return s.push(["seed",o]),s}function C(o,r,e){let s=(t,n)=>{let h=r.light[t]||n,i=r.dark[t]||n;return z(t).map(l=>{let u=x(l),f=parseFloat(l.replace(/[^0\.0-9]/g,"")),d=f?f/S:1,c=w(h,d),p=w(i,d);return `${u}: light-dark(${c}, ${p})`})};return `
|
|
10
3
|
@import url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");
|
|
11
4
|
|
|
12
5
|
:root {
|
|
13
6
|
color-scheme: light dark;
|
|
14
7
|
|
|
15
|
-
${
|
|
8
|
+
${A(o,r.light).map(([t,n])=>s(t,n)).flat().join(";")}
|
|
16
9
|
}
|
|
17
10
|
|
|
18
11
|
*,
|
|
@@ -43,4 +36,4 @@ import {upperFirst}from'@wavy/fn';import $ from'path';import {fileURLToPath}from
|
|
|
43
36
|
}
|
|
44
37
|
|
|
45
38
|
${e?.()||""}
|
|
46
|
-
`.replace(/\s+/g," ").trim()}async function
|
|
39
|
+
`.replace(/\s+/g," ").trim()}async function M(o){let r=await import('fs/promises'),e=await import('path'),{styles:s}=JSON.parse((await r.readFile(e.join(m,"package.json"))).toString("utf-8"));try{let a=e.join(m,"./external/themes"),t=await r.readdir(a),n=t.map(g=>"--"+g.match(/.*?(?=\.)/)?.[0]),h=process.argv.splice(2),i=o?.flag||h.find(g=>n.includes(g));if(!i)return console.log(`Please select a theme using one of these flags: [${n.join(", ")}]`);let l=t.find(g=>g.includes(i.replace(/[^a-zA-Z]/g,"")));if(!l)return console.log(`Failed to map ${i} to a filename in [${t.join(", ")}].`);let u=await r.readFile(e.join(a,l)),{schemes:f,seed:d}=JSON.parse(u.toString("utf-8")),{dark:c,light:p}=f;p.themelessSurface="#FFF",p.themelessOnSurface="#000",c.themelessSurface="#000",c.themelessOnSurface="#FFF",await r.writeFile(e.join(m,s),C(d,{light:p,dark:c},o?.injectStyles));let $={green:"\u{1F7E9}",purple:"\u{1F7EA}"},v=i.toLowerCase().replace(/[^a-z]/g,"");console.log(`${$[v]||""} ${upperFirst(v)} theme loaded! \u2728`.trim());}catch(a){console.error(a);}}export{M as buildWavyTheme};
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
const ${e} = Object.freeze({
|
|
4
|
-
${r.join(`,
|
|
5
|
-
`)}
|
|
6
|
-
})
|
|
7
|
-
|
|
8
|
-
export default ${e}
|
|
9
|
-
`}}function H(t,r,e){let o=(s,i)=>{let f=r.light[s]||i,v=r.dark[s]||i;return k(s).map(a=>{let p=_(a),d=parseFloat(a.replace(/[^0\.0-9]/g,"")),m=d?d/F:1,u=j(f,m),c=j(v,m);return `${p}: light-dark(${u}, ${c})`})};return `
|
|
2
|
+
import w from'fs/promises';import u from'path';import {fileURLToPath}from'url';import {upperFirst}from'@wavy/fn';var x=fileURLToPath(import.meta.url),z=u.dirname(x),l=z.split(u.sep).filter((r,o,e)=>o<e.length-2).join(u.sep);var T="__",L=1e3;function $(r,o=1){let e=r.startsWith("#")?r.slice(1):r;e.length===3&&(e=e.split("").map(i=>i+i).join(""));let s=parseInt(e.substring(0,2),16),n=parseInt(e.substring(2,4),16),t=parseInt(e.substring(4,6),16);return `rgba(${s}, ${n}, ${t}, ${o})`}function R(r){return [...Array.from(Array(9)).flatMap((o,e)=>{let s=e+1;return [`${s}00`,`${s}50`].map(n=>`${r}${T}${n}`)}),r]}function O(r,o){let s=`--${(n=>n.split("").map(t=>t===t.toUpperCase()&&t!==t.toLowerCase()?`-${t.toLowerCase()}`:t).join(""))(r)}`;return s}function V(r,o,e){let s=Object.entries(o);return s.push(["seed",r]),s}function D(r,o,e){let s=(t,i)=>{let h=o.light[t]||i,a=o.dark[t]||i;return R(t).map(c=>{let b=O(c),d=parseFloat(c.replace(/[^0\.0-9]/g,"")),m=d?d/L:1,g=$(h,m),f=$(a,m);return `${b}: light-dark(${g}, ${f})`})};return `
|
|
10
3
|
@import url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");
|
|
11
4
|
|
|
12
5
|
:root {
|
|
13
6
|
color-scheme: light dark;
|
|
14
7
|
|
|
15
|
-
${
|
|
8
|
+
${V(r,o.light).map(([t,i])=>s(t,i)).flat().join(";")}
|
|
16
9
|
}
|
|
17
10
|
|
|
18
11
|
*,
|
|
@@ -43,6 +36,6 @@ import $ from'fs/promises';import b from'path';import {fileURLToPath}from'url';i
|
|
|
43
36
|
}
|
|
44
37
|
|
|
45
38
|
${e?.()||""}
|
|
46
|
-
`.replace(/\s+/g," ").trim()}async function
|
|
47
|
-
Aborting bundler...`):(console.log("\u{1F916} Resolving file contents..."),n=await Promise.all(n.map(async
|
|
48
|
-
\u{1F916} Preparing bundler...`),await
|
|
39
|
+
`.replace(/\s+/g," ").trim()}async function j(r){let o=await import('fs/promises'),e=await import('path'),{styles:s}=JSON.parse((await o.readFile(e.join(l,"package.json"))).toString("utf-8"));try{let n=e.join(l,"./external/themes"),t=await o.readdir(n),i=t.map(p=>"--"+p.match(/.*?(?=\.)/)?.[0]),h=process.argv.splice(2),a=r?.flag||h.find(p=>i.includes(p));if(!a)return console.log(`Please select a theme using one of these flags: [${i.join(", ")}]`);let c=t.find(p=>p.includes(a.replace(/[^a-zA-Z]/g,"")));if(!c)return console.log(`Failed to map ${a} to a filename in [${t.join(", ")}].`);let b=await o.readFile(e.join(n,c)),{schemes:d,seed:m}=JSON.parse(b.toString("utf-8")),{dark:g,light:f}=d;f.themelessSurface="#FFF",f.themelessOnSurface="#000",g.themelessSurface="#000",g.themelessOnSurface="#FFF",await o.writeFile(e.join(l,s),D(m,{light:f,dark:g},r?.injectStyles));let _={green:"\u{1F7E9}",purple:"\u{1F7EA}"},y=a.toLowerCase().replace(/[^a-z]/g,"");console.log(`${_[y]||""} ${upperFirst(y)} theme loaded! \u2728`.trim());}catch(n){console.error(n);}}var k=(r,o)=>r.map(e=>u.join(o,e)),S=(r,o)=>{let e=r.filter(s=>!u.extname(s));return o?k(e,o):e},F=(r,o)=>{let e=r.filter(s=>s.includes(".css"));return o?k(e,o):e};async function E(r){console.log("\u{1F916} Preparing CSS file scan...");let e=await w.readdir(r),s=S(e,r),n=F(e,r);try{for(let t of s)e=await w.readdir(t),s.push(...S(e,t)),n.push(...F(e,t));}catch(t){throw console.log("Failed to resolve the items found: ",{folders:s,cssFiles:n,items:e}),t}console.log("\u26A1 CSS file scan complete!"),n.length===0?console.log("0 CSS files found...",`
|
|
40
|
+
Aborting bundler...`):(console.log("\u{1F916} Resolving file contents..."),n=await Promise.all(n.map(async t=>(await w.readFile(t)).toString("utf-8").trim())),console.log("\u26A1 File contents resolved!",`
|
|
41
|
+
\u{1F916} Preparing bundler...`),await j({injectStyles:()=>n.join(" ")}),console.log("\u2728 Successfully bundled css files! \u2728"));}E(u.join(l,"src"));
|