@epicbagel/saas-kit 1.3.0 → 1.5.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/README.md +91 -0
- package/dist/chunk-D5EHW3O2.cjs +52 -0
- package/dist/chunk-F3DAFAMD.js +271 -0
- package/dist/{chunk-JZOBIPFC.js → chunk-FGISSYXG.js} +61 -2
- package/dist/chunk-HAP6USTP.cjs +46 -0
- package/dist/chunk-HAQOT2CD.js +46 -0
- package/dist/{chunk-2AU7ZRGX.cjs → chunk-LAN3K2JI.cjs} +61 -2
- package/dist/chunk-TWCJMFST.js +260 -0
- package/dist/chunk-U3YFP6ZV.cjs +273 -0
- package/dist/chunk-X3PRMR5G.js +52 -0
- package/dist/chunk-ZJFYOXSM.cjs +260 -0
- package/dist/lib/neutral-theme.cjs +39 -236
- package/dist/lib/neutral-theme.d.cts +44 -2
- package/dist/lib/neutral-theme.d.ts +44 -2
- package/dist/lib/neutral-theme.js +23 -219
- package/dist/primitives/chat.cjs +65 -12
- package/dist/primitives/chat.d.cts +46 -2
- package/dist/primitives/chat.d.ts +46 -2
- package/dist/primitives/chat.js +55 -2
- package/dist/primitives/field.cjs +12 -239
- package/dist/primitives/field.js +16 -243
- package/dist/primitives/message.cjs +8 -2
- package/dist/primitives/message.d.cts +35 -1
- package/dist/primitives/message.d.ts +35 -1
- package/dist/primitives/message.js +7 -1
- package/dist/primitives/radio-group.cjs +4 -39
- package/dist/primitives/radio-group.js +4 -39
- package/dist/primitives/theme-selector.cjs +188 -0
- package/dist/primitives/theme-selector.d.cts +78 -0
- package/dist/primitives/theme-selector.d.ts +78 -0
- package/dist/primitives/theme-selector.js +188 -0
- package/dist/primitives/toggle-group.cjs +5 -45
- package/dist/primitives/toggle-group.js +5 -45
- package/package.json +11 -1
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkNQK5ZWC7cjs = require('./chunk-NQK5ZWC7.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkIQZLUT2Ycjs = require('./chunk-IQZLUT2Y.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkKWLSBTB2cjs = require('./chunk-KWLSBTB2.cjs');
|
|
11
|
+
|
|
12
|
+
// src/primitives/field.tsx
|
|
13
|
+
var _react = require('react');
|
|
14
|
+
var _classvarianceauthority = require('class-variance-authority');
|
|
15
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
16
|
+
function FieldSet({ className, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
18
|
+
"fieldset",
|
|
19
|
+
{
|
|
20
|
+
"data-slot": "field-set",
|
|
21
|
+
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
22
|
+
"flex flex-col gap-6",
|
|
23
|
+
"has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
|
|
24
|
+
className
|
|
25
|
+
),
|
|
26
|
+
...props
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
function FieldLegend({
|
|
31
|
+
className,
|
|
32
|
+
variant = "legend",
|
|
33
|
+
...props
|
|
34
|
+
}) {
|
|
35
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
36
|
+
"legend",
|
|
37
|
+
{
|
|
38
|
+
"data-slot": "field-legend",
|
|
39
|
+
"data-variant": variant,
|
|
40
|
+
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
41
|
+
"mb-3 font-medium",
|
|
42
|
+
"data-[variant=legend]:text-base",
|
|
43
|
+
"data-[variant=label]:text-sm",
|
|
44
|
+
className
|
|
45
|
+
),
|
|
46
|
+
...props
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
function FieldGroup({ className, ...props }) {
|
|
51
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
"data-slot": "field-group",
|
|
55
|
+
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
56
|
+
"group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",
|
|
57
|
+
className
|
|
58
|
+
),
|
|
59
|
+
...props
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
var fieldVariants = _classvarianceauthority.cva.call(void 0,
|
|
64
|
+
"group/field flex w-full gap-3 data-[invalid=true]:text-destructive",
|
|
65
|
+
{
|
|
66
|
+
variants: {
|
|
67
|
+
orientation: {
|
|
68
|
+
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
|
|
69
|
+
horizontal: [
|
|
70
|
+
"flex-row items-center",
|
|
71
|
+
"[&>[data-slot=field-label]]:flex-auto",
|
|
72
|
+
"has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
73
|
+
],
|
|
74
|
+
responsive: [
|
|
75
|
+
"flex-col @md/field-group:flex-row @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto",
|
|
76
|
+
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
|
77
|
+
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
defaultVariants: { orientation: "vertical" }
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
function Field({
|
|
85
|
+
className,
|
|
86
|
+
orientation = "vertical",
|
|
87
|
+
...props
|
|
88
|
+
}) {
|
|
89
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
role: "group",
|
|
93
|
+
"data-slot": "field",
|
|
94
|
+
"data-orientation": orientation,
|
|
95
|
+
className: _chunkKWLSBTB2cjs.cn.call(void 0, fieldVariants({ orientation }), className),
|
|
96
|
+
...props
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
function FieldContent({ className, ...props }) {
|
|
101
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
102
|
+
"div",
|
|
103
|
+
{
|
|
104
|
+
"data-slot": "field-content",
|
|
105
|
+
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
106
|
+
"group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
|
|
107
|
+
className
|
|
108
|
+
),
|
|
109
|
+
...props
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
function FieldLabel({ className, ...props }) {
|
|
114
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
115
|
+
_chunkIQZLUT2Ycjs.Label,
|
|
116
|
+
{
|
|
117
|
+
"data-slot": "field-label",
|
|
118
|
+
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
119
|
+
"group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50",
|
|
120
|
+
"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4",
|
|
121
|
+
"has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10",
|
|
122
|
+
className
|
|
123
|
+
),
|
|
124
|
+
...props
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
function FieldTitle({ className, ...props }) {
|
|
129
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
"data-slot": "field-label",
|
|
133
|
+
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
134
|
+
"flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",
|
|
135
|
+
className
|
|
136
|
+
),
|
|
137
|
+
...props
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
function FieldDescription({ className, ...props }) {
|
|
142
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
143
|
+
"p",
|
|
144
|
+
{
|
|
145
|
+
"data-slot": "field-description",
|
|
146
|
+
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
147
|
+
"text-sm leading-normal font-normal text-muted-foreground group-has-[[data-orientation=horizontal]]/field:text-balance",
|
|
148
|
+
"last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",
|
|
149
|
+
"[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
|
|
150
|
+
className
|
|
151
|
+
),
|
|
152
|
+
...props
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
function FieldSeparator({
|
|
157
|
+
children,
|
|
158
|
+
className,
|
|
159
|
+
...props
|
|
160
|
+
}) {
|
|
161
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
162
|
+
"div",
|
|
163
|
+
{
|
|
164
|
+
"data-slot": "field-separator",
|
|
165
|
+
"data-content": !!children,
|
|
166
|
+
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
167
|
+
"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
|
|
168
|
+
className
|
|
169
|
+
),
|
|
170
|
+
...props,
|
|
171
|
+
children: [
|
|
172
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNQK5ZWC7cjs.Separator, { className: "absolute inset-0 top-1/2" }),
|
|
173
|
+
children && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
174
|
+
"span",
|
|
175
|
+
{
|
|
176
|
+
className: "relative mx-auto block w-fit bg-background px-2 text-muted-foreground",
|
|
177
|
+
"data-slot": "field-separator-content",
|
|
178
|
+
children
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
function FieldError({
|
|
186
|
+
className,
|
|
187
|
+
children,
|
|
188
|
+
errors,
|
|
189
|
+
...props
|
|
190
|
+
}) {
|
|
191
|
+
const content = _react.useMemo.call(void 0, () => {
|
|
192
|
+
if (children) return children;
|
|
193
|
+
if (!_optionalChain([errors, 'optionalAccess', _ => _.length])) return null;
|
|
194
|
+
const uniqueErrors = [
|
|
195
|
+
...new Map(errors.map((error) => [_optionalChain([error, 'optionalAccess', _2 => _2.message]), error])).values()
|
|
196
|
+
];
|
|
197
|
+
if (uniqueErrors.length === 1) return _optionalChain([uniqueErrors, 'access', _3 => _3[0], 'optionalAccess', _4 => _4.message]);
|
|
198
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { className: "ml-4 flex list-disc flex-col gap-1", children: uniqueErrors.map(
|
|
199
|
+
(error, index) => _optionalChain([error, 'optionalAccess', _5 => _5.message]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { children: error.message }, index)
|
|
200
|
+
) });
|
|
201
|
+
}, [children, errors]);
|
|
202
|
+
if (!content) return null;
|
|
203
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
204
|
+
"div",
|
|
205
|
+
{
|
|
206
|
+
role: "alert",
|
|
207
|
+
"data-slot": "field-error",
|
|
208
|
+
className: _chunkKWLSBTB2cjs.cn.call(void 0, "text-sm font-normal text-destructive", className),
|
|
209
|
+
...props,
|
|
210
|
+
children: content
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
function FormField({
|
|
215
|
+
label,
|
|
216
|
+
htmlFor,
|
|
217
|
+
actions,
|
|
218
|
+
description,
|
|
219
|
+
children,
|
|
220
|
+
className,
|
|
221
|
+
...props
|
|
222
|
+
}) {
|
|
223
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkKWLSBTB2cjs.cn.call(void 0, "space-y-1.5", className), ...props, children: [
|
|
224
|
+
(label || actions) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between gap-2", children: [
|
|
225
|
+
typeof label === "string" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIQZLUT2Ycjs.Label, { htmlFor, children: label }) : label,
|
|
226
|
+
actions && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center gap-1", children: actions })
|
|
227
|
+
] }),
|
|
228
|
+
children,
|
|
229
|
+
description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm leading-relaxed text-muted-foreground", children: description })
|
|
230
|
+
] });
|
|
231
|
+
}
|
|
232
|
+
var columnStyles = {
|
|
233
|
+
1: "grid-cols-1",
|
|
234
|
+
2: "grid-cols-1 sm:grid-cols-2",
|
|
235
|
+
3: "grid-cols-1 sm:grid-cols-3"
|
|
236
|
+
};
|
|
237
|
+
function FieldGrid({ columns = 2, gap = "default", className, ...props }) {
|
|
238
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
239
|
+
"div",
|
|
240
|
+
{
|
|
241
|
+
className: _chunkKWLSBTB2cjs.cn.call(void 0, "grid", gap === "default" ? "gap-4" : "gap-8", columnStyles[columns], className),
|
|
242
|
+
...props
|
|
243
|
+
}
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
exports.FieldSet = FieldSet; exports.FieldLegend = FieldLegend; exports.FieldGroup = FieldGroup; exports.Field = Field; exports.FieldContent = FieldContent; exports.FieldLabel = FieldLabel; exports.FieldTitle = FieldTitle; exports.FieldDescription = FieldDescription; exports.FieldSeparator = FieldSeparator; exports.FieldError = FieldError; exports.FormField = FormField; exports.FieldGrid = FieldGrid;
|
|
@@ -1,238 +1,41 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
throw new Error(`Not a hex colour: ${hex}`);
|
|
43
|
-
}
|
|
44
|
-
return [
|
|
45
|
-
parseInt(full.slice(0, 2), 16),
|
|
46
|
-
parseInt(full.slice(2, 4), 16),
|
|
47
|
-
parseInt(full.slice(4, 6), 16)
|
|
48
|
-
];
|
|
49
|
-
}
|
|
50
|
-
function hexToHsl(hex) {
|
|
51
|
-
const [r255, g255, b255] = hexToRgb(hex);
|
|
52
|
-
const r = r255 / 255;
|
|
53
|
-
const g = g255 / 255;
|
|
54
|
-
const b = b255 / 255;
|
|
55
|
-
const max = Math.max(r, g, b);
|
|
56
|
-
const min = Math.min(r, g, b);
|
|
57
|
-
const l = (max + min) / 2;
|
|
58
|
-
const d = max - min;
|
|
59
|
-
let h = 0;
|
|
60
|
-
let s = 0;
|
|
61
|
-
if (d !== 0) {
|
|
62
|
-
s = d / (1 - Math.abs(2 * l - 1));
|
|
63
|
-
if (max === r) h = (g - b) / d % 6;
|
|
64
|
-
else if (max === g) h = (b - r) / d + 2;
|
|
65
|
-
else h = (r - g) / d + 4;
|
|
66
|
-
h *= 60;
|
|
67
|
-
if (h < 0) h += 360;
|
|
68
|
-
}
|
|
69
|
-
const round = (n) => Math.round(n * 10) / 10;
|
|
70
|
-
return `${round(h)} ${round(s * 100)}% ${round(l * 100)}%`;
|
|
71
|
-
}
|
|
72
|
-
function luminance(hex) {
|
|
73
|
-
const [r, g, b] = hexToRgb(hex).map((v) => {
|
|
74
|
-
const c = v / 255;
|
|
75
|
-
return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
|
76
|
-
});
|
|
77
|
-
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
78
|
-
}
|
|
79
|
-
function contrastRatio(a, b) {
|
|
80
|
-
const la = luminance(a);
|
|
81
|
-
const lb = luminance(b);
|
|
82
|
-
const [hi, lo] = la > lb ? [la, lb] : [lb, la];
|
|
83
|
-
return (hi + 0.05) / (lo + 0.05);
|
|
84
|
-
}
|
|
85
|
-
function bestForeground(bg, candidates) {
|
|
86
|
-
let best = candidates[0];
|
|
87
|
-
let bestRatio = 0;
|
|
88
|
-
for (const c of candidates) {
|
|
89
|
-
const ratio = contrastRatio(bg, c);
|
|
90
|
-
if (ratio > bestRatio) {
|
|
91
|
-
best = c;
|
|
92
|
-
bestRatio = ratio;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return best;
|
|
96
|
-
}
|
|
97
|
-
var NEUTRAL_RADIUS = "0rem";
|
|
98
|
-
function neutral(mode) {
|
|
99
|
-
const light = mode === "light";
|
|
100
|
-
const danger = "#d71921";
|
|
101
|
-
const mono = light ? {
|
|
102
|
-
bg: "#ffffff",
|
|
103
|
-
fg: "#000000",
|
|
104
|
-
surface: "#f5f5f5",
|
|
105
|
-
subtle: "#666666",
|
|
106
|
-
border: "#e5e5e5",
|
|
107
|
-
sidebar: "#fafafa",
|
|
108
|
-
strong: "#333333"
|
|
109
|
-
} : {
|
|
110
|
-
bg: "#000000",
|
|
111
|
-
fg: "#ffffff",
|
|
112
|
-
surface: "#1a1a1a",
|
|
113
|
-
subtle: "#999999",
|
|
114
|
-
border: "#333333",
|
|
115
|
-
sidebar: "#0d0d0d",
|
|
116
|
-
strong: "#cccccc"
|
|
117
|
-
};
|
|
118
|
-
return {
|
|
119
|
-
background: mono.bg,
|
|
120
|
-
foreground: mono.fg,
|
|
121
|
-
card: mono.bg,
|
|
122
|
-
"card-foreground": mono.fg,
|
|
123
|
-
popover: mono.bg,
|
|
124
|
-
"popover-foreground": mono.fg,
|
|
125
|
-
primary: mono.fg,
|
|
126
|
-
"primary-foreground": mono.bg,
|
|
127
|
-
secondary: mono.surface,
|
|
128
|
-
"secondary-foreground": mono.fg,
|
|
129
|
-
muted: mono.surface,
|
|
130
|
-
"muted-foreground": mono.subtle,
|
|
131
|
-
accent: mono.surface,
|
|
132
|
-
"accent-foreground": mono.fg,
|
|
133
|
-
destructive: danger,
|
|
134
|
-
"destructive-foreground": bestForeground(danger, ["#ffffff", "#000000"]),
|
|
135
|
-
border: mono.border,
|
|
136
|
-
input: mono.border,
|
|
137
|
-
ring: mono.fg,
|
|
138
|
-
"chart-1": light ? "#333333" : "#cccccc",
|
|
139
|
-
"chart-2": light ? "#4d4d4d" : "#b3b3b3",
|
|
140
|
-
"chart-3": light ? "#666666" : "#999999",
|
|
141
|
-
"chart-4": light ? "#808080" : "#808080",
|
|
142
|
-
"chart-5": light ? "#999999" : "#666666",
|
|
143
|
-
"sidebar-background": mono.sidebar,
|
|
144
|
-
"sidebar-foreground": mono.fg,
|
|
145
|
-
"sidebar-primary": mono.fg,
|
|
146
|
-
"sidebar-primary-foreground": mono.bg,
|
|
147
|
-
"sidebar-accent": mono.surface,
|
|
148
|
-
"sidebar-accent-foreground": mono.fg,
|
|
149
|
-
"sidebar-border": mono.border,
|
|
150
|
-
"sidebar-ring": mono.border
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
var NEUTRAL = {
|
|
154
|
-
light: neutral("light"),
|
|
155
|
-
dark: neutral("dark")
|
|
156
|
-
};
|
|
157
|
-
function colorAlias(token) {
|
|
158
|
-
if (token.startsWith("chart-")) return null;
|
|
159
|
-
if (token === "sidebar-background") return "--color-sidebar";
|
|
160
|
-
return `--color-${token}`;
|
|
161
|
-
}
|
|
162
|
-
function paletteDeclarations(tokens, names, radius, { indent = " ", aliasSource = "neutral-theme.ts" } = {}) {
|
|
163
|
-
const value = (token) => {
|
|
164
|
-
const hex = tokens[token];
|
|
165
|
-
if (hex === void 0) throw new Error(`Missing token: ${token}`);
|
|
166
|
-
return hexToHsl(hex);
|
|
167
|
-
};
|
|
168
|
-
const lines = [`${indent}--radius: ${radius};`];
|
|
169
|
-
for (const token of names) {
|
|
170
|
-
lines.push(`${indent}--${token}: ${value(token)};`);
|
|
171
|
-
}
|
|
172
|
-
lines.push(`${indent}--sidebar: ${value("sidebar-background")};`);
|
|
173
|
-
lines.push(`${indent}/* Tailwind-facing aliases \u2014 see ${aliasSource} */`);
|
|
174
|
-
for (const token of names) {
|
|
175
|
-
const alias = colorAlias(token);
|
|
176
|
-
if (alias) lines.push(`${indent}${alias}: hsl(var(--${token}));`);
|
|
177
|
-
}
|
|
178
|
-
lines.push(`${indent}--radius-sm: calc(var(--radius) - 4px);`);
|
|
179
|
-
lines.push(`${indent}--radius-md: calc(var(--radius) - 2px);`);
|
|
180
|
-
lines.push(`${indent}--radius-lg: var(--radius);`);
|
|
181
|
-
lines.push(`${indent}--radius-xl: calc(var(--radius) + 4px);`);
|
|
182
|
-
lines.push(`${indent}--radius-2xl: calc(var(--radius) + 8px);`);
|
|
183
|
-
return lines.join("\n");
|
|
184
|
-
}
|
|
185
|
-
function paletteBlock(selector, declarations, indent = "") {
|
|
186
|
-
const head = selector.split("\n").map((line) => indent + line).join("\n");
|
|
187
|
-
return `${head} {
|
|
188
|
-
${declarations}
|
|
189
|
-
${indent}}
|
|
190
|
-
`;
|
|
191
|
-
}
|
|
192
|
-
function layerBlock(name, rules) {
|
|
193
|
-
return `@layer ${name} {
|
|
194
|
-
${rules.join("\n")}}
|
|
195
|
-
`;
|
|
196
|
-
}
|
|
197
|
-
var DARK_ROOT_SELECTOR = ":root:where(.dark)";
|
|
198
|
-
function baseLayerPalette(light, dark, indent = " ") {
|
|
199
|
-
return layerBlock("base", [
|
|
200
|
-
paletteBlock(":root", light, indent),
|
|
201
|
-
paletteBlock(DARK_ROOT_SELECTOR, dark, indent)
|
|
202
|
-
]);
|
|
203
|
-
}
|
|
204
|
-
var PALETTE_GENERATED_HEADER = `/* GENERATED FILE \u2014 do not edit.
|
|
205
|
-
* Source: src/lib/neutral-theme.ts \xB7 Regenerate: pnpm gen:themes
|
|
206
|
-
*
|
|
207
|
-
* The neutral palette: light on :root, dark when the root carries the
|
|
208
|
-
* \`.dark\` class. It sits in \`@layer base\`, so any unlayered palette rule
|
|
209
|
-
* or a host's own :root overrides wins on layer order alone. Imported by
|
|
210
|
-
* tokens.css; every --color-* alias and the radius scale are re-declared
|
|
211
|
-
* alongside the tokens they read.
|
|
212
|
-
*/`;
|
|
213
|
-
function renderPaletteCss() {
|
|
214
|
-
const declarations = (mode) => paletteDeclarations(NEUTRAL[mode], SEMANTIC_TOKENS, NEUTRAL_RADIUS, {
|
|
215
|
-
indent: " "
|
|
216
|
-
});
|
|
217
|
-
return [
|
|
218
|
-
PALETTE_GENERATED_HEADER,
|
|
219
|
-
baseLayerPalette(declarations("light"), declarations("dark"))
|
|
220
|
-
].join("\n");
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
exports.NEUTRAL = NEUTRAL; exports.NEUTRAL_RADIUS = NEUTRAL_RADIUS; exports.PALETTE_GENERATED_HEADER = PALETTE_GENERATED_HEADER; exports.SEMANTIC_TOKENS = SEMANTIC_TOKENS; exports.baseLayerPalette = baseLayerPalette; exports.bestForeground = bestForeground; exports.colorAlias = colorAlias; exports.contrastRatio = contrastRatio; exports.hexToHsl = hexToHsl; exports.hexToRgb = hexToRgb; exports.layerBlock = layerBlock; exports.luminance = luminance; exports.paletteBlock = paletteBlock; exports.paletteDeclarations = paletteDeclarations; exports.renderPaletteCss = renderPaletteCss;
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _chunkU3YFP6ZVcjs = require('../chunk-U3YFP6ZV.cjs');
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
exports.NEUTRAL = _chunkU3YFP6ZVcjs.NEUTRAL; exports.NEUTRAL_PALETTE = _chunkU3YFP6ZVcjs.NEUTRAL_PALETTE; exports.NEUTRAL_RADIUS = _chunkU3YFP6ZVcjs.NEUTRAL_RADIUS; exports.NEUTRAL_THEME_ID = _chunkU3YFP6ZVcjs.NEUTRAL_THEME_ID; exports.PALETTE_GENERATED_HEADER = _chunkU3YFP6ZVcjs.PALETTE_GENERATED_HEADER; exports.SEMANTIC_TOKENS = _chunkU3YFP6ZVcjs.SEMANTIC_TOKENS; exports.baseLayerPalette = _chunkU3YFP6ZVcjs.baseLayerPalette; exports.bestForeground = _chunkU3YFP6ZVcjs.bestForeground; exports.colorAlias = _chunkU3YFP6ZVcjs.colorAlias; exports.contrastRatio = _chunkU3YFP6ZVcjs.contrastRatio; exports.hexToHsl = _chunkU3YFP6ZVcjs.hexToHsl; exports.hexToRgb = _chunkU3YFP6ZVcjs.hexToRgb; exports.layerBlock = _chunkU3YFP6ZVcjs.layerBlock; exports.luminance = _chunkU3YFP6ZVcjs.luminance; exports.paletteBlock = _chunkU3YFP6ZVcjs.paletteBlock; exports.paletteDeclarations = _chunkU3YFP6ZVcjs.paletteDeclarations; exports.paletteStyle = _chunkU3YFP6ZVcjs.paletteStyle; exports.renderPaletteCss = _chunkU3YFP6ZVcjs.renderPaletteCss;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The neutral palette, plus the token contract, colour maths and CSS
|
|
3
|
-
* rendering that every palette shares
|
|
3
|
+
* rendering that every palette shares, and the shape a theme picker offers
|
|
4
|
+
* a palette in (`ThemePalette`).
|
|
4
5
|
*
|
|
5
6
|
* Neutral is plain black and white with square corners. `pnpm gen:themes`
|
|
6
7
|
* renders it to `src/styles/palette.gen.css`, which `styles/tokens.css`
|
|
@@ -47,6 +48,38 @@ declare function bestForeground(bg: string, candidates: string[]): string;
|
|
|
47
48
|
declare const NEUTRAL_RADIUS = "0rem";
|
|
48
49
|
/** The neutral palette's semantic tokens, per mode, as hex. */
|
|
49
50
|
declare const NEUTRAL: Readonly<Record<ThemeMode, SemanticTokenMap>>;
|
|
51
|
+
/**
|
|
52
|
+
* The `data-theme` value the neutral palette answers to. The stylesheet
|
|
53
|
+
* paints the neutral palette wherever no palette is named, so stamping this
|
|
54
|
+
* id changes nothing on screen; a host stores it like any other pick.
|
|
55
|
+
*/
|
|
56
|
+
declare const NEUTRAL_THEME_ID = "minimal";
|
|
57
|
+
/**
|
|
58
|
+
* A palette a theme picker offers (`primitives/theme-selector`).
|
|
59
|
+
*
|
|
60
|
+
* `id` is the palette's `data-theme` value, and what a host stores when
|
|
61
|
+
* someone picks it. The tokens are optional. Given for a mode, a preview of
|
|
62
|
+
* that mode paints from them directly (`paletteStyle`), whatever palette the
|
|
63
|
+
* page around it is in. Without them, the preview carries `data-theme` and
|
|
64
|
+
* `data-mode` instead, and the page's palette CSS has to paint those on any
|
|
65
|
+
* element, not just the root.
|
|
66
|
+
*/
|
|
67
|
+
interface ThemePalette {
|
|
68
|
+
/** The `data-theme` value. Stable: hosts store it. */
|
|
69
|
+
readonly id: string;
|
|
70
|
+
/** Display name. */
|
|
71
|
+
readonly label: string;
|
|
72
|
+
/** One line under the name. */
|
|
73
|
+
readonly description?: string;
|
|
74
|
+
/** `--radius` for the palette's previews. Leave out to keep the page's. */
|
|
75
|
+
readonly radius?: string;
|
|
76
|
+
/** Light mode's semantic tokens, as hex. */
|
|
77
|
+
readonly light?: Readonly<SemanticTokenMap>;
|
|
78
|
+
/** Dark mode's semantic tokens, as hex. */
|
|
79
|
+
readonly dark?: Readonly<SemanticTokenMap>;
|
|
80
|
+
}
|
|
81
|
+
/** The neutral palette as a picker offers it: the kit's default. */
|
|
82
|
+
declare const NEUTRAL_PALETTE: ThemePalette;
|
|
50
83
|
/**
|
|
51
84
|
* The Tailwind colour name each token feeds, or null for tokens with no
|
|
52
85
|
* utility (the chart series are read directly as `var(--chart-1)`).
|
|
@@ -65,6 +98,15 @@ interface PaletteDeclarationOptions {
|
|
|
65
98
|
* aliases and the radius scale.
|
|
66
99
|
*/
|
|
67
100
|
declare function paletteDeclarations(tokens: Readonly<Record<string, string>>, names: readonly string[], radius: string, { indent, aliasSource }?: PaletteDeclarationOptions): string;
|
|
101
|
+
/**
|
|
102
|
+
* `paletteDeclarations` as an inline style: the same custom properties with
|
|
103
|
+
* the same values, for one element (`style={paletteStyle(tokens, radius)}`).
|
|
104
|
+
* The element then paints in that palette whatever palette the page around
|
|
105
|
+
* it is in, because the `--color-*` aliases are declared, and so
|
|
106
|
+
* substituted, on the element itself. Without `radius` it keeps the page's
|
|
107
|
+
* `--radius`. This is how `PalettePreview` paints a palette's tokens.
|
|
108
|
+
*/
|
|
109
|
+
declare function paletteStyle(tokens: Readonly<Record<string, string>>, radius?: string, names?: readonly string[]): Record<string, string>;
|
|
68
110
|
/**
|
|
69
111
|
* One rule: `selector { declarations }`, newline-terminated. `indent`
|
|
70
112
|
* prefixes each selector line and the closing brace, for a rule nested in
|
|
@@ -89,4 +131,4 @@ declare const PALETTE_GENERATED_HEADER = "/* GENERATED FILE \u2014 do not edit.\
|
|
|
89
131
|
/** `src/styles/palette.gen.css`: the neutral palette, light then dark. */
|
|
90
132
|
declare function renderPaletteCss(): string;
|
|
91
133
|
|
|
92
|
-
export { NEUTRAL, NEUTRAL_RADIUS, PALETTE_GENERATED_HEADER, type PaletteDeclarationOptions, SEMANTIC_TOKENS, type SemanticToken, type SemanticTokenMap, type ThemeMode, baseLayerPalette, bestForeground, colorAlias, contrastRatio, hexToHsl, hexToRgb, layerBlock, luminance, paletteBlock, paletteDeclarations, renderPaletteCss };
|
|
134
|
+
export { NEUTRAL, NEUTRAL_PALETTE, NEUTRAL_RADIUS, NEUTRAL_THEME_ID, PALETTE_GENERATED_HEADER, type PaletteDeclarationOptions, SEMANTIC_TOKENS, type SemanticToken, type SemanticTokenMap, type ThemeMode, type ThemePalette, baseLayerPalette, bestForeground, colorAlias, contrastRatio, hexToHsl, hexToRgb, layerBlock, luminance, paletteBlock, paletteDeclarations, paletteStyle, renderPaletteCss };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The neutral palette, plus the token contract, colour maths and CSS
|
|
3
|
-
* rendering that every palette shares
|
|
3
|
+
* rendering that every palette shares, and the shape a theme picker offers
|
|
4
|
+
* a palette in (`ThemePalette`).
|
|
4
5
|
*
|
|
5
6
|
* Neutral is plain black and white with square corners. `pnpm gen:themes`
|
|
6
7
|
* renders it to `src/styles/palette.gen.css`, which `styles/tokens.css`
|
|
@@ -47,6 +48,38 @@ declare function bestForeground(bg: string, candidates: string[]): string;
|
|
|
47
48
|
declare const NEUTRAL_RADIUS = "0rem";
|
|
48
49
|
/** The neutral palette's semantic tokens, per mode, as hex. */
|
|
49
50
|
declare const NEUTRAL: Readonly<Record<ThemeMode, SemanticTokenMap>>;
|
|
51
|
+
/**
|
|
52
|
+
* The `data-theme` value the neutral palette answers to. The stylesheet
|
|
53
|
+
* paints the neutral palette wherever no palette is named, so stamping this
|
|
54
|
+
* id changes nothing on screen; a host stores it like any other pick.
|
|
55
|
+
*/
|
|
56
|
+
declare const NEUTRAL_THEME_ID = "minimal";
|
|
57
|
+
/**
|
|
58
|
+
* A palette a theme picker offers (`primitives/theme-selector`).
|
|
59
|
+
*
|
|
60
|
+
* `id` is the palette's `data-theme` value, and what a host stores when
|
|
61
|
+
* someone picks it. The tokens are optional. Given for a mode, a preview of
|
|
62
|
+
* that mode paints from them directly (`paletteStyle`), whatever palette the
|
|
63
|
+
* page around it is in. Without them, the preview carries `data-theme` and
|
|
64
|
+
* `data-mode` instead, and the page's palette CSS has to paint those on any
|
|
65
|
+
* element, not just the root.
|
|
66
|
+
*/
|
|
67
|
+
interface ThemePalette {
|
|
68
|
+
/** The `data-theme` value. Stable: hosts store it. */
|
|
69
|
+
readonly id: string;
|
|
70
|
+
/** Display name. */
|
|
71
|
+
readonly label: string;
|
|
72
|
+
/** One line under the name. */
|
|
73
|
+
readonly description?: string;
|
|
74
|
+
/** `--radius` for the palette's previews. Leave out to keep the page's. */
|
|
75
|
+
readonly radius?: string;
|
|
76
|
+
/** Light mode's semantic tokens, as hex. */
|
|
77
|
+
readonly light?: Readonly<SemanticTokenMap>;
|
|
78
|
+
/** Dark mode's semantic tokens, as hex. */
|
|
79
|
+
readonly dark?: Readonly<SemanticTokenMap>;
|
|
80
|
+
}
|
|
81
|
+
/** The neutral palette as a picker offers it: the kit's default. */
|
|
82
|
+
declare const NEUTRAL_PALETTE: ThemePalette;
|
|
50
83
|
/**
|
|
51
84
|
* The Tailwind colour name each token feeds, or null for tokens with no
|
|
52
85
|
* utility (the chart series are read directly as `var(--chart-1)`).
|
|
@@ -65,6 +98,15 @@ interface PaletteDeclarationOptions {
|
|
|
65
98
|
* aliases and the radius scale.
|
|
66
99
|
*/
|
|
67
100
|
declare function paletteDeclarations(tokens: Readonly<Record<string, string>>, names: readonly string[], radius: string, { indent, aliasSource }?: PaletteDeclarationOptions): string;
|
|
101
|
+
/**
|
|
102
|
+
* `paletteDeclarations` as an inline style: the same custom properties with
|
|
103
|
+
* the same values, for one element (`style={paletteStyle(tokens, radius)}`).
|
|
104
|
+
* The element then paints in that palette whatever palette the page around
|
|
105
|
+
* it is in, because the `--color-*` aliases are declared, and so
|
|
106
|
+
* substituted, on the element itself. Without `radius` it keeps the page's
|
|
107
|
+
* `--radius`. This is how `PalettePreview` paints a palette's tokens.
|
|
108
|
+
*/
|
|
109
|
+
declare function paletteStyle(tokens: Readonly<Record<string, string>>, radius?: string, names?: readonly string[]): Record<string, string>;
|
|
68
110
|
/**
|
|
69
111
|
* One rule: `selector { declarations }`, newline-terminated. `indent`
|
|
70
112
|
* prefixes each selector line and the closing brace, for a rule nested in
|
|
@@ -89,4 +131,4 @@ declare const PALETTE_GENERATED_HEADER = "/* GENERATED FILE \u2014 do not edit.\
|
|
|
89
131
|
/** `src/styles/palette.gen.css`: the neutral palette, light then dark. */
|
|
90
132
|
declare function renderPaletteCss(): string;
|
|
91
133
|
|
|
92
|
-
export { NEUTRAL, NEUTRAL_RADIUS, PALETTE_GENERATED_HEADER, type PaletteDeclarationOptions, SEMANTIC_TOKENS, type SemanticToken, type SemanticTokenMap, type ThemeMode, baseLayerPalette, bestForeground, colorAlias, contrastRatio, hexToHsl, hexToRgb, layerBlock, luminance, paletteBlock, paletteDeclarations, renderPaletteCss };
|
|
134
|
+
export { NEUTRAL, NEUTRAL_PALETTE, NEUTRAL_RADIUS, NEUTRAL_THEME_ID, PALETTE_GENERATED_HEADER, type PaletteDeclarationOptions, SEMANTIC_TOKENS, type SemanticToken, type SemanticTokenMap, type ThemeMode, type ThemePalette, baseLayerPalette, bestForeground, colorAlias, contrastRatio, hexToHsl, hexToRgb, layerBlock, luminance, paletteBlock, paletteDeclarations, paletteStyle, renderPaletteCss };
|