@chaibuilder/sdk 2.1.8 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chai-theme-helpers-GQ1UI3nD.cjs → chai-theme-helpers-BjWE6otR.cjs} +6 -6
- package/dist/{chai-theme-helpers-CVkLfKt7.js → chai-theme-helpers-FO9vdd-R.js} +5 -4
- package/dist/core.cjs +12 -4
- package/dist/core.d.ts +0 -1
- package/dist/core.js +943 -867
- package/dist/{plugin-DRtv2KR5.js → plugin-B09c0d5S.js} +1 -1
- package/dist/{plugin-uUPBh-_c.cjs → plugin-BiiuylVf.cjs} +1 -1
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +12 -4
- package/dist/render.js +152 -142
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.js +5 -5
- package/package.json +3 -3
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"use strict";const h=require("@chaibuilder/runtime"),F=require("lodash-es"),_={fontFamily:{"font-heading":"Inter","font-body":"Inter"},borderRadius:"10px",colors:[{group:"Body",items:{background:["#FFFFFF","#121212"],foreground:["#121212","#FFFFFF"]}},{group:"Primary",items:{primary:["#2563EB","#3B82F6"],"primary-foreground":["#FFFFFF","#FFFFFF"]}},{group:"Secondary",items:{secondary:["#F3F4F6","#374151"],"secondary-foreground":["#1F2937","#F9FAFB"]}},{group:"Border, Input & Ring",items:{border:["#E5E7EB","#374151"],input:["#E5E7EB","#374151"],ring:["#2563EB","#3B82F6"]}},{group:"Card",items:{card:["#FFFFFF","#1F2937"],"card-foreground":["#121212","#FFFFFF"]}},{group:"Popover",items:{popover:["#FFFFFF","#1F2937"],"popover-foreground":["#121212","#FFFFFF"]}},{group:"Muted",items:{muted:["#F3F4F6","#374151"],"muted-foreground":["#6B7280","#9CA3AF"]}},{group:"Accent",items:{accent:["#F3F4F6","#374151"],"accent-foreground":["#1F2937","#FFFFFF"]}},{group:"Destructive",items:{destructive:["#DC2626","#EF4444"],"destructive-foreground":["#FFFFFF","#FFFFFF"]}}]};function b(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var d={},c={},
|
|
1
|
+
"use strict";const h=require("@chaibuilder/runtime"),F=require("lodash-es"),_={fontFamily:{"font-heading":"Inter","font-body":"Inter"},borderRadius:"10px",colors:[{group:"Body",items:{background:["#FFFFFF","#121212"],foreground:["#121212","#FFFFFF"]}},{group:"Primary",items:{primary:["#2563EB","#3B82F6"],"primary-foreground":["#FFFFFF","#FFFFFF"]}},{group:"Secondary",items:{secondary:["#F3F4F6","#374151"],"secondary-foreground":["#1F2937","#F9FAFB"]}},{group:"Border, Input & Ring",items:{border:["#E5E7EB","#374151"],input:["#E5E7EB","#374151"],ring:["#2563EB","#3B82F6"]}},{group:"Card",items:{card:["#FFFFFF","#1F2937"],"card-foreground":["#121212","#FFFFFF"]}},{group:"Popover",items:{popover:["#FFFFFF","#1F2937"],"popover-foreground":["#121212","#FFFFFF"]}},{group:"Muted",items:{muted:["#F3F4F6","#374151"],"muted-foreground":["#6B7280","#9CA3AF"]}},{group:"Accent",items:{accent:["#F3F4F6","#374151"],"accent-foreground":["#1F2937","#FFFFFF"]}},{group:"Destructive",items:{destructive:["#DC2626","#EF4444"],"destructive-foreground":["#FFFFFF","#FFFFFF"]}}]};function b(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var d={},c={},p;function v(){return p||(p=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});function r(n,o){return{handler:n,config:o}}r.withOptions=function(n,o=()=>({})){const u=function(i){return{__options:i,handler:n(i),config:o(i)}};return u.__isOptionsFunction=!0,u.__pluginFunction=n,u.__configFunction=o,u};const t=r}(c)),c}var y;function C(){return y||(y=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});const r=t(v());function t(o){return o&&o.__esModule?o:{default:o}}const n=r.default}(d)),d}var f,$;function P(){if($)return f;$=1;let e=C();return f=(e.__esModule?e:{default:e}).default,f}var j=P();const B=b(j),M=e=>({fontFamily:e.fontFamily?F.keys(e.fontFamily).reduce((t,n)=>({...t,[n.replace("font-","")]:`var(--${n})`}),{}):{},borderRadius:e.borderRadius?{lg:"var(--radius)",md:"calc(var(--radius) - 2px)",sm:"calc(var(--radius) - 4px)"}:{},colors:e.colors?F.flatten(e.colors.map(t=>Object.entries(t.items))).reduce((t,[n])=>({...t,[n]:`hsl(var(--${n}))`}),{}):{}});function g(e){const r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);let t=parseInt(r[1],16),n=parseInt(r[2],16),o=parseInt(r[3],16);t/=255,n/=255,o/=255;const u=Math.max(t,n,o),i=Math.min(t,n,o);let a,s;const m=(u+i)/2;if(u==i)a=s=0;else{const l=u-i;switch(s=m>.5?l/(2-u-i):l/(u+i),u){case t:a=(n-o)/l+(n<o?6:0);break;case n:a=(o-t)/l+2;break;case o:a=(t-n)/l+4;break}a/=6}return`${Math.round(a*360)} ${Math.round(s*100)}% ${Math.round(m*100)}%`}const q=e=>{const t=h.getAllRegisteredFonts().find(n=>n.family===e);return`"${e}", ${F.get(t,"fallback","")}`},E=e=>`:root {
|
|
2
2
|
${e.fontFamily&&Object.entries(e.fontFamily).map(([r,t])=>`--font-${r}: ${q(t)};`).join(`
|
|
3
3
|
`)}
|
|
4
4
|
${e.borderRadius&&`--radius: ${e.borderRadius};`}
|
|
5
|
-
${e.colors&&Object.entries(e.colors).map(([r,t])=>`--${r}: ${
|
|
5
|
+
${e.colors&&Object.entries(e.colors).map(([r,t])=>`--${r}: ${g(t[0])};`).join(`
|
|
6
6
|
`)}
|
|
7
7
|
}
|
|
8
8
|
.dark {
|
|
9
|
-
${e.colors&&Object.entries(e.colors).map(([r,t])=>`--${r}: ${
|
|
9
|
+
${e.colors&&Object.entries(e.colors).map(([r,t])=>`--${r}: ${g(t[1])};`).join(`
|
|
10
10
|
`)}
|
|
11
11
|
}`,O=e=>!e||e.length===0?"":F.uniqBy(e,"family").map(r=>`<link rel="stylesheet" href="${r.url}" />`).join(`
|
|
12
|
-
`),
|
|
13
|
-
`),
|
|
12
|
+
`),S=e=>!e||e.length===0?"":F.uniqBy(e,"family").map(r=>`@import url("${r.url}");`).join(`
|
|
13
|
+
`),k=e=>!e||e.length===0?"":F.uniqBy(e,"family").map(r=>r.src.map(t=>`@font-face {
|
|
14
14
|
font-family: "${r.family}";
|
|
15
15
|
src: url("${t.url}") format("${t.format}");
|
|
16
16
|
font-display: swap;
|
|
@@ -19,4 +19,4 @@
|
|
|
19
19
|
${t.fontStretch?`font-stretch: ${t.fontStretch};`:""}
|
|
20
20
|
}`).join(`
|
|
21
21
|
`)).join(`
|
|
22
|
-
`);exports.defaultThemeOptions=_;exports.getChaiThemeCssVariables=E;exports.getChaiThemeOptions=M;exports.getThemeCustomFontFace=
|
|
22
|
+
`);exports.defaultThemeOptions=_;exports.getChaiThemeCssVariables=E;exports.getChaiThemeOptions=M;exports.getThemeCustomFontFace=k;exports.getThemeFontsCSSImport=S;exports.getThemeFontsLinkMarkup=O;exports.hexToHSL=g;exports.plugin=B;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getAllRegisteredFonts as _ } from "@chaibuilder/runtime";
|
|
2
|
-
import { uniqBy as c, keys as b, flatten as v, get as
|
|
2
|
+
import { uniqBy as c, keys as b, flatten as v, get as h } from "lodash-es";
|
|
3
3
|
const k = {
|
|
4
4
|
fontFamily: {
|
|
5
5
|
"font-heading": "Inter",
|
|
@@ -73,7 +73,7 @@ const k = {
|
|
|
73
73
|
}
|
|
74
74
|
]
|
|
75
75
|
};
|
|
76
|
-
function
|
|
76
|
+
function P(e) {
|
|
77
77
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
78
78
|
}
|
|
79
79
|
var s = {}, d = {}, p;
|
|
@@ -134,7 +134,7 @@ function M() {
|
|
|
134
134
|
return f = (e.__esModule ? e : { default: e }).default, f;
|
|
135
135
|
}
|
|
136
136
|
var B = M();
|
|
137
|
-
const q = /* @__PURE__ */
|
|
137
|
+
const q = /* @__PURE__ */ P(B), S = (e) => ({
|
|
138
138
|
fontFamily: e.fontFamily ? b(e.fontFamily).reduce(
|
|
139
139
|
(r, n) => ({
|
|
140
140
|
...r,
|
|
@@ -180,7 +180,7 @@ function y(e) {
|
|
|
180
180
|
}
|
|
181
181
|
const E = (e) => {
|
|
182
182
|
const r = _().find((n) => n.family === e);
|
|
183
|
-
return `"${e}", ${
|
|
183
|
+
return `"${e}", ${h(r, "fallback", "")}`;
|
|
184
184
|
}, I = (e) => `:root {
|
|
185
185
|
${e.fontFamily && Object.entries(e.fontFamily).map(([t, r]) => `--font-${t}: ${E(r)};`).join(`
|
|
186
186
|
`)}
|
|
@@ -214,5 +214,6 @@ export {
|
|
|
214
214
|
k as d,
|
|
215
215
|
x as e,
|
|
216
216
|
S as g,
|
|
217
|
+
y as h,
|
|
217
218
|
q as p
|
|
218
219
|
};
|