@chaibuilder/sdk 2.0.8 → 2.0.10
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-DC7cFoyJ.js} +69 -54
- package/dist/chai-theme-helpers-DKMzVh0t.cjs +21 -0
- package/dist/core.cjs +5 -5
- package/dist/core.js +50 -86
- package/dist/fonts/GeistMonoVF.woff +0 -0
- package/dist/fonts/GeistVF.woff +0 -0
- package/dist/plugin-3oYvWHBg.cjs +1 -0
- package/dist/{plugin-kUMxtQR5.js → plugin-jViUnwnQ.js} +1 -1
- 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,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getAllRegisteredFonts as y } from "@chaibuilder/runtime";
|
|
2
|
+
import { keys as _, flatten as b, get as v } from "lodash-es";
|
|
2
3
|
function P(e) {
|
|
3
4
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4
5
|
}
|
|
5
|
-
const
|
|
6
|
+
const R = {
|
|
6
7
|
fontFamily: {
|
|
7
8
|
"font-heading": "Inter",
|
|
8
9
|
"font-body": "Inter"
|
|
@@ -75,69 +76,69 @@ const k = {
|
|
|
75
76
|
}
|
|
76
77
|
]
|
|
77
78
|
};
|
|
78
|
-
var l = {}, c = {},
|
|
79
|
-
function
|
|
80
|
-
return
|
|
79
|
+
var l = {}, c = {}, g;
|
|
80
|
+
function h() {
|
|
81
|
+
return g || (g = 1, function(e) {
|
|
81
82
|
Object.defineProperty(e, "__esModule", {
|
|
82
83
|
value: !0
|
|
83
84
|
}), Object.defineProperty(e, "default", {
|
|
84
85
|
enumerable: !0,
|
|
85
86
|
get: function() {
|
|
86
|
-
return
|
|
87
|
+
return t;
|
|
87
88
|
}
|
|
88
89
|
});
|
|
89
|
-
function n
|
|
90
|
+
function r(n, o) {
|
|
90
91
|
return {
|
|
91
|
-
handler:
|
|
92
|
+
handler: n,
|
|
92
93
|
config: o
|
|
93
94
|
};
|
|
94
95
|
}
|
|
95
|
-
|
|
96
|
+
r.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
|
|
106
|
+
const t = r;
|
|
106
107
|
}(c)), c;
|
|
107
108
|
}
|
|
108
|
-
var
|
|
109
|
-
function
|
|
110
|
-
return
|
|
109
|
+
var p;
|
|
110
|
+
function j() {
|
|
111
|
+
return p || (p = 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
|
-
function
|
|
120
|
+
const r = /* @__PURE__ */ t(h());
|
|
121
|
+
function t(o) {
|
|
121
122
|
return o && o.__esModule ? o : {
|
|
122
123
|
default: o
|
|
123
124
|
};
|
|
124
125
|
}
|
|
125
|
-
const
|
|
126
|
+
const n = r.default;
|
|
126
127
|
}(l)), l;
|
|
127
128
|
}
|
|
128
129
|
var d, m;
|
|
129
|
-
function
|
|
130
|
+
function C() {
|
|
130
131
|
if (m) return d;
|
|
131
132
|
m = 1;
|
|
132
|
-
let e =
|
|
133
|
+
let e = j();
|
|
133
134
|
return d = (e.__esModule ? e : { default: e }).default, d;
|
|
134
135
|
}
|
|
135
|
-
var M =
|
|
136
|
-
const
|
|
136
|
+
var M = C();
|
|
137
|
+
const S = /* @__PURE__ */ P(M), k = (e) => ({
|
|
137
138
|
fontFamily: e.fontFamily ? _(e.fontFamily).reduce(
|
|
138
|
-
(
|
|
139
|
-
...
|
|
140
|
-
[
|
|
139
|
+
(t, n) => ({
|
|
140
|
+
...t,
|
|
141
|
+
[n.replace("font-", "")]: `var(--${n})`
|
|
141
142
|
}),
|
|
142
143
|
{}
|
|
143
144
|
) : {},
|
|
@@ -146,56 +147,70 @@ const B = /* @__PURE__ */ P(M), R = (e) => ({
|
|
|
146
147
|
md: "calc(var(--radius) - 2px)",
|
|
147
148
|
sm: "calc(var(--radius) - 4px)"
|
|
148
149
|
} : {},
|
|
149
|
-
colors: e.colors ?
|
|
150
|
-
(
|
|
150
|
+
colors: e.colors ? b(e.colors.map((t) => Object.entries(t.items))).reduce(
|
|
151
|
+
(t, [n]) => ({ ...t, [n]: `hsl(var(--${n}))` }),
|
|
151
152
|
{}
|
|
152
153
|
) : {}
|
|
153
154
|
});
|
|
154
|
-
function
|
|
155
|
-
const
|
|
156
|
-
let
|
|
157
|
-
|
|
158
|
-
const u = Math.max(
|
|
159
|
-
let
|
|
155
|
+
function $(e) {
|
|
156
|
+
const r = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
|
|
157
|
+
let t = parseInt(r[1], 16), n = parseInt(r[2], 16), o = parseInt(r[3], 16);
|
|
158
|
+
t /= 255, n /= 255, o /= 255;
|
|
159
|
+
const u = Math.max(t, n, o), a = Math.min(t, n, o);
|
|
160
|
+
let i, s;
|
|
160
161
|
const f = (u + a) / 2;
|
|
161
162
|
if (u == a)
|
|
162
|
-
|
|
163
|
+
i = s = 0;
|
|
163
164
|
else {
|
|
164
|
-
const
|
|
165
|
-
switch (
|
|
166
|
-
case r:
|
|
167
|
-
s = (t - o) / i + (t < o ? 6 : 0);
|
|
168
|
-
break;
|
|
165
|
+
const F = u - a;
|
|
166
|
+
switch (s = f > 0.5 ? F / (2 - u - a) : F / (u + a), u) {
|
|
169
167
|
case t:
|
|
170
|
-
|
|
168
|
+
i = (n - o) / F + (n < o ? 6 : 0);
|
|
169
|
+
break;
|
|
170
|
+
case n:
|
|
171
|
+
i = (o - t) / F + 2;
|
|
171
172
|
break;
|
|
172
173
|
case o:
|
|
173
|
-
|
|
174
|
+
i = (t - 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(s * 100)}% ${Math.round(f * 100)}%`;
|
|
179
180
|
}
|
|
180
|
-
const
|
|
181
|
-
|
|
181
|
+
const E = (e) => {
|
|
182
|
+
const t = y().find((n) => n.name === e);
|
|
183
|
+
return v(t, "family", e);
|
|
184
|
+
}, q = (e) => `:root {
|
|
185
|
+
${e.fontFamily && Object.entries(e.fontFamily).map(([r, t]) => `--font-${r}: ${E(t)};`).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(([r, t]) => `--${r}: ${$(t[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(([r, t]) => `--${r}: ${$(t[1])};`).join(`
|
|
189
193
|
`)}
|
|
190
|
-
}`, I = (e) =>
|
|
191
|
-
`),
|
|
194
|
+
}`, I = (e) => !e || e.length === 0 ? "" : e.map((r) => `<link rel="stylesheet" href="${r.url}" />`).join(`
|
|
195
|
+
`), A = (e) => !e || e.length === 0 ? "" : e.map((r) => `@import url("${r.url}");`).join(`
|
|
196
|
+
`), D = (e) => !e || e.length === 0 ? "" : e.map(
|
|
197
|
+
(r) => `@font-face {
|
|
198
|
+
font-family: "${r.family}";
|
|
199
|
+
src: ${r.src.map((t) => `url("${t.url}") format("${t.format}")`).join(", ")};
|
|
200
|
+
${r.fontWeight ? `font-weight: ${r.fontWeight};` : ""}
|
|
201
|
+
${r.fontStyle ? `font-style: ${r.fontStyle};` : ""}
|
|
202
|
+
${r.fontDisplay ? `font-display: ${r.fontDisplay};` : ""}
|
|
203
|
+
${r.fontStretch ? `font-stretch: ${r.fontStretch};` : ""}
|
|
204
|
+
}`
|
|
205
|
+
).join(`
|
|
192
206
|
`);
|
|
193
207
|
export {
|
|
194
208
|
q as a,
|
|
195
|
-
|
|
209
|
+
A as b,
|
|
196
210
|
I as c,
|
|
197
|
-
|
|
211
|
+
R as d,
|
|
198
212
|
P as e,
|
|
199
|
-
|
|
200
|
-
|
|
213
|
+
D as f,
|
|
214
|
+
k as g,
|
|
215
|
+
S as p
|
|
201
216
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
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 l={},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 m;function C(){return m||(m=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}(l)),l}var d,$;function P(){if($)return d;$=1;let e=C();return d=(e.__esModule?e:{default:e}).default,d}var j=P();const E=h(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 y(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 F=u-i;switch(s=g>.5?F/(2-u-i):F/(u+i),u){case t:a=(n-o)/F+(n<o?6:0);break;case n:a=(o-t)/F+2;break;case o:a=(t-n)/F+4;break}a/=6}return`${Math.round(a*360)} ${Math.round(s*100)}% ${Math.round(g*100)}%`}const O=e=>{const t=_.getAllRegisteredFonts().find(n=>n.name===e);return f.get(t,"family",e)},B=e=>`:root {
|
|
2
|
+
${e.fontFamily&&Object.entries(e.fontFamily).map(([r,t])=>`--font-${r}: ${O(t)};`).join(`
|
|
3
|
+
`)}
|
|
4
|
+
${e.borderRadius&&`--radius: ${e.borderRadius};`}
|
|
5
|
+
${e.colors&&Object.entries(e.colors).map(([r,t])=>`--${r}: ${y(t[0])};`).join(`
|
|
6
|
+
`)}
|
|
7
|
+
}
|
|
8
|
+
.dark {
|
|
9
|
+
${e.colors&&Object.entries(e.colors).map(([r,t])=>`--${r}: ${y(t[1])};`).join(`
|
|
10
|
+
`)}
|
|
11
|
+
}`,R=e=>!e||e.length===0?"":e.map(r=>`<link rel="stylesheet" href="${r.url}" />`).join(`
|
|
12
|
+
`),S=e=>!e||e.length===0?"":e.map(r=>`@import url("${r.url}");`).join(`
|
|
13
|
+
`),k=e=>!e||e.length===0?"":e.map(r=>`@font-face {
|
|
14
|
+
font-family: "${r.family}";
|
|
15
|
+
src: ${r.src.map(t=>`url("${t.url}") format("${t.format}")`).join(", ")};
|
|
16
|
+
${r.fontWeight?`font-weight: ${r.fontWeight};`:""}
|
|
17
|
+
${r.fontStyle?`font-style: ${r.fontStyle};`:""}
|
|
18
|
+
${r.fontDisplay?`font-display: ${r.fontDisplay};`:""}
|
|
19
|
+
${r.fontStretch?`font-stretch: ${r.fontStretch};`:""}
|
|
20
|
+
}`).join(`
|
|
21
|
+
`);exports.defaultThemeOptions=b;exports.getChaiThemeCssVariables=B;exports.getChaiThemeOptions=M;exports.getDefaultExportFromCjs=h;exports.getThemeCustomFontFace=k;exports.getThemeFontsCSSImport=S;exports.getThemeFontsLinkMarkup=R;exports.plugin=E;
|