@chaibuilder/sdk 2.0.9 → 2.0.11
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/{ChaiThemeFn-Cort9tch.js → chai-theme-helpers-BpnwYsLZ.js} +72 -54
- package/dist/chai-theme-helpers-D2bHv81c.cjs +22 -0
- package/dist/core.cjs +5 -5
- package/dist/core.js +79 -113
- package/dist/fonts/GeistMonoVF.woff +0 -0
- package/dist/fonts/GeistVF.woff +0 -0
- package/dist/{plugin-kUMxtQR5.js → plugin-D56-CF7U.js} +1 -1
- package/dist/plugin-PDQQ8m4D.cjs +1 -0
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +4 -4
- package/dist/render.js +46 -43
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.d.ts +4 -4
- package/dist/tailwind.js +1 -1
- package/package.json +3 -3
- package/dist/ChaiThemeFn-DQu-2Eh9.cjs +0 -13
- package/dist/plugin-2xcljWGM.cjs +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { getAllRegisteredFonts as _ } from "@chaibuilder/runtime";
|
|
2
|
+
import { uniqBy as c, keys as b, flatten as v, get as P } from "lodash-es";
|
|
3
|
+
function h(e) {
|
|
3
4
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4
5
|
}
|
|
5
6
|
const k = {
|
|
@@ -75,7 +76,7 @@ const k = {
|
|
|
75
76
|
}
|
|
76
77
|
]
|
|
77
78
|
};
|
|
78
|
-
var
|
|
79
|
+
var s = {}, d = {}, p;
|
|
79
80
|
function j() {
|
|
80
81
|
return p || (p = 1, function(e) {
|
|
81
82
|
Object.defineProperty(e, "__esModule", {
|
|
@@ -86,58 +87,58 @@ function j() {
|
|
|
86
87
|
return r;
|
|
87
88
|
}
|
|
88
89
|
});
|
|
89
|
-
function n
|
|
90
|
+
function t(n, o) {
|
|
90
91
|
return {
|
|
91
|
-
handler:
|
|
92
|
+
handler: n,
|
|
92
93
|
config: o
|
|
93
94
|
};
|
|
94
95
|
}
|
|
95
|
-
|
|
96
|
+
t.withOptions = function(n, o = () => ({})) {
|
|
96
97
|
const u = function(a) {
|
|
97
98
|
return {
|
|
98
99
|
__options: a,
|
|
99
|
-
handler:
|
|
100
|
+
handler: n(a),
|
|
100
101
|
config: o(a)
|
|
101
102
|
};
|
|
102
103
|
};
|
|
103
|
-
return u.__isOptionsFunction = !0, u.__pluginFunction =
|
|
104
|
+
return u.__isOptionsFunction = !0, u.__pluginFunction = n, u.__configFunction = o, u;
|
|
104
105
|
};
|
|
105
|
-
const r =
|
|
106
|
-
}(
|
|
106
|
+
const r = t;
|
|
107
|
+
}(d)), d;
|
|
107
108
|
}
|
|
108
|
-
var
|
|
109
|
+
var m;
|
|
109
110
|
function C() {
|
|
110
|
-
return
|
|
111
|
+
return m || (m = 1, function(e) {
|
|
111
112
|
Object.defineProperty(e, "__esModule", {
|
|
112
113
|
value: !0
|
|
113
114
|
}), Object.defineProperty(e, "default", {
|
|
114
115
|
enumerable: !0,
|
|
115
116
|
get: function() {
|
|
116
|
-
return
|
|
117
|
+
return n;
|
|
117
118
|
}
|
|
118
119
|
});
|
|
119
|
-
const
|
|
120
|
+
const t = /* @__PURE__ */ r(j());
|
|
120
121
|
function r(o) {
|
|
121
122
|
return o && o.__esModule ? o : {
|
|
122
123
|
default: o
|
|
123
124
|
};
|
|
124
125
|
}
|
|
125
|
-
const
|
|
126
|
-
}(
|
|
126
|
+
const n = t.default;
|
|
127
|
+
}(s)), s;
|
|
127
128
|
}
|
|
128
|
-
var
|
|
129
|
-
function
|
|
130
|
-
if (
|
|
131
|
-
|
|
129
|
+
var f, $;
|
|
130
|
+
function M() {
|
|
131
|
+
if ($) return f;
|
|
132
|
+
$ = 1;
|
|
132
133
|
let e = C();
|
|
133
|
-
return
|
|
134
|
+
return f = (e.__esModule ? e : { default: e }).default, f;
|
|
134
135
|
}
|
|
135
|
-
var
|
|
136
|
-
const
|
|
137
|
-
fontFamily: e.fontFamily ?
|
|
138
|
-
(r,
|
|
136
|
+
var B = M();
|
|
137
|
+
const q = /* @__PURE__ */ h(B), S = (e) => ({
|
|
138
|
+
fontFamily: e.fontFamily ? b(e.fontFamily).reduce(
|
|
139
|
+
(r, n) => ({
|
|
139
140
|
...r,
|
|
140
|
-
[
|
|
141
|
+
[n.replace("font-", "")]: `var(--${n})`
|
|
141
142
|
}),
|
|
142
143
|
{}
|
|
143
144
|
) : {},
|
|
@@ -147,55 +148,72 @@ const B = /* @__PURE__ */ P(M), R = (e) => ({
|
|
|
147
148
|
sm: "calc(var(--radius) - 4px)"
|
|
148
149
|
} : {},
|
|
149
150
|
colors: e.colors ? v(e.colors.map((r) => Object.entries(r.items))).reduce(
|
|
150
|
-
(r, [
|
|
151
|
+
(r, [n]) => ({ ...r, [n]: `hsl(var(--${n}))` }),
|
|
151
152
|
{}
|
|
152
153
|
) : {}
|
|
153
154
|
});
|
|
154
155
|
function y(e) {
|
|
155
|
-
const
|
|
156
|
-
let r = parseInt(
|
|
157
|
-
r /= 255,
|
|
158
|
-
const u = Math.max(r,
|
|
159
|
-
let
|
|
160
|
-
const
|
|
156
|
+
const t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
|
|
157
|
+
let r = parseInt(t[1], 16), n = parseInt(t[2], 16), o = parseInt(t[3], 16);
|
|
158
|
+
r /= 255, n /= 255, o /= 255;
|
|
159
|
+
const u = Math.max(r, n, o), a = Math.min(r, n, o);
|
|
160
|
+
let i, l;
|
|
161
|
+
const g = (u + a) / 2;
|
|
161
162
|
if (u == a)
|
|
162
|
-
|
|
163
|
+
i = l = 0;
|
|
163
164
|
else {
|
|
164
|
-
const
|
|
165
|
-
switch (
|
|
165
|
+
const F = u - a;
|
|
166
|
+
switch (l = g > 0.5 ? F / (2 - u - a) : F / (u + a), u) {
|
|
166
167
|
case r:
|
|
167
|
-
|
|
168
|
+
i = (n - o) / F + (n < o ? 6 : 0);
|
|
168
169
|
break;
|
|
169
|
-
case
|
|
170
|
-
|
|
170
|
+
case n:
|
|
171
|
+
i = (o - r) / F + 2;
|
|
171
172
|
break;
|
|
172
173
|
case o:
|
|
173
|
-
|
|
174
|
+
i = (r - n) / F + 4;
|
|
174
175
|
break;
|
|
175
176
|
}
|
|
176
|
-
|
|
177
|
+
i /= 6;
|
|
177
178
|
}
|
|
178
|
-
return `${Math.round(
|
|
179
|
+
return `${Math.round(i * 360)} ${Math.round(l * 100)}% ${Math.round(g * 100)}%`;
|
|
179
180
|
}
|
|
180
|
-
const
|
|
181
|
-
|
|
181
|
+
const E = (e) => {
|
|
182
|
+
const r = _().find((n) => n.family === e);
|
|
183
|
+
return `"${e}", ${P(r, "fallback", "")}`;
|
|
184
|
+
}, I = (e) => `:root {
|
|
185
|
+
${e.fontFamily && Object.entries(e.fontFamily).map(([t, r]) => `--font-${t}: ${E(r)};`).join(`
|
|
182
186
|
`)}
|
|
183
187
|
${e.borderRadius && `--radius: ${e.borderRadius};`}
|
|
184
|
-
${e.colors && Object.entries(e.colors).map(([
|
|
188
|
+
${e.colors && Object.entries(e.colors).map(([t, r]) => `--${t}: ${y(r[0])};`).join(`
|
|
185
189
|
`)}
|
|
186
190
|
}
|
|
187
191
|
.dark {
|
|
188
|
-
${e.colors && Object.entries(e.colors).map(([
|
|
192
|
+
${e.colors && Object.entries(e.colors).map(([t, r]) => `--${t}: ${y(r[1])};`).join(`
|
|
189
193
|
`)}
|
|
190
|
-
}`,
|
|
191
|
-
`),
|
|
194
|
+
}`, w = (e) => !e || e.length === 0 ? "" : c(e, "family").map((t) => `<link rel="stylesheet" href="${t.url}" />`).join(`
|
|
195
|
+
`), A = (e) => !e || e.length === 0 ? "" : c(e, "family").map((t) => `@import url("${t.url}");`).join(`
|
|
196
|
+
`), x = (e) => !e || e.length === 0 ? "" : c(e, "family").map(
|
|
197
|
+
(t) => t.src.map(
|
|
198
|
+
(r) => `@font-face {
|
|
199
|
+
font-family: "${t.family}";
|
|
200
|
+
src: url("${r.url}") format("${r.format}");
|
|
201
|
+
font-display: swap;
|
|
202
|
+
${r.fontWeight ? `font-weight: ${r.fontWeight};` : ""}
|
|
203
|
+
${r.fontStyle ? `font-style: ${r.fontStyle};` : ""}
|
|
204
|
+
${r.fontStretch ? `font-stretch: ${r.fontStretch};` : ""}
|
|
205
|
+
}`
|
|
206
|
+
).join(`
|
|
207
|
+
`)
|
|
208
|
+
).join(`
|
|
192
209
|
`);
|
|
193
210
|
export {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
211
|
+
I as a,
|
|
212
|
+
A as b,
|
|
213
|
+
w as c,
|
|
197
214
|
k as d,
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
215
|
+
h as e,
|
|
216
|
+
x as f,
|
|
217
|
+
S as g,
|
|
218
|
+
q as p
|
|
201
219
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";const _=require("@chaibuilder/runtime"),F=require("lodash-es");function h(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const b={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"]}}]};var d={},c={},m;function v(){return m||(m=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 p;function C(){return p||(p=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,y;function P(){if(y)return f;y=1;let e=C();return f=(e.__esModule?e:{default:e}).default,f}var j=P();const B=h(j),E=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 $(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 g=(u+i)/2;if(u==i)a=s=0;else{const l=u-i;switch(s=g>.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(g*100)}%`}const M=e=>{const t=_.getAllRegisteredFonts().find(n=>n.family===e);return`"${e}", ${F.get(t,"fallback","")}`},q=e=>`:root {
|
|
2
|
+
${e.fontFamily&&Object.entries(e.fontFamily).map(([r,t])=>`--font-${r}: ${M(t)};`).join(`
|
|
3
|
+
`)}
|
|
4
|
+
${e.borderRadius&&`--radius: ${e.borderRadius};`}
|
|
5
|
+
${e.colors&&Object.entries(e.colors).map(([r,t])=>`--${r}: ${$(t[0])};`).join(`
|
|
6
|
+
`)}
|
|
7
|
+
}
|
|
8
|
+
.dark {
|
|
9
|
+
${e.colors&&Object.entries(e.colors).map(([r,t])=>`--${r}: ${$(t[1])};`).join(`
|
|
10
|
+
`)}
|
|
11
|
+
}`,O=e=>!e||e.length===0?"":F.uniqBy(e,"family").map(r=>`<link rel="stylesheet" href="${r.url}" />`).join(`
|
|
12
|
+
`),k=e=>!e||e.length===0?"":F.uniqBy(e,"family").map(r=>`@import url("${r.url}");`).join(`
|
|
13
|
+
`),R=e=>!e||e.length===0?"":F.uniqBy(e,"family").map(r=>r.src.map(t=>`@font-face {
|
|
14
|
+
font-family: "${r.family}";
|
|
15
|
+
src: url("${t.url}") format("${t.format}");
|
|
16
|
+
font-display: swap;
|
|
17
|
+
${t.fontWeight?`font-weight: ${t.fontWeight};`:""}
|
|
18
|
+
${t.fontStyle?`font-style: ${t.fontStyle};`:""}
|
|
19
|
+
${t.fontStretch?`font-stretch: ${t.fontStretch};`:""}
|
|
20
|
+
}`).join(`
|
|
21
|
+
`)).join(`
|
|
22
|
+
`);exports.defaultThemeOptions=b;exports.getChaiThemeCssVariables=q;exports.getChaiThemeOptions=E;exports.getDefaultExportFromCjs=h;exports.getThemeCustomFontFace=R;exports.getThemeFontsCSSImport=k;exports.getThemeFontsLinkMarkup=O;exports.plugin=B;
|