haze-ui 1.22.0 → 1.23.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.
@@ -0,0 +1,327 @@
1
+ import { clampChroma as e, formatOklch as t, parseHex as n, parseOklch as r } from "./oklch.js";
2
+ //#region src/lib/tokens/palette.ts
3
+ var i = {
4
+ light: {
5
+ hover: -.045,
6
+ active: -.09,
7
+ borderHover: -.09,
8
+ subtleL: .945,
9
+ subtleC: .2
10
+ },
11
+ dark: {
12
+ hover: .05,
13
+ active: .09,
14
+ borderHover: .08,
15
+ subtleL: .26,
16
+ subtleC: .35
17
+ }
18
+ }, a = .4, o = {
19
+ light: -.008,
20
+ dark: .014
21
+ }, s = {
22
+ light: {
23
+ gray: {
24
+ 1: "#ffffff",
25
+ 2: "#f7f8fa",
26
+ 3: "#eef0f4",
27
+ 4: "#e0e0e0",
28
+ 9: "#8a8a8a",
29
+ 11: "#4a4a4a",
30
+ 12: "#1a1a1a"
31
+ },
32
+ blue: {
33
+ 9: "#0066ff",
34
+ 10: "#2563eb"
35
+ },
36
+ green: { 9: "#15803d" },
37
+ amber: { 9: "#f59e0b" },
38
+ red: { 9: "#dc2626" }
39
+ },
40
+ dark: {
41
+ gray: {
42
+ 1: "#121212",
43
+ 2: "#1e1e1e",
44
+ 3: "#2a2a2a",
45
+ 4: "#333333",
46
+ 9: "#707070",
47
+ 11: "#b0b0b0",
48
+ 12: "#e8e8e8"
49
+ },
50
+ blue: {
51
+ 8: "#3b82f6",
52
+ 9: "#4d94ff"
53
+ },
54
+ green: { 8: "#22c55e" },
55
+ amber: { 8: "#fbbf24" },
56
+ red: { 8: "#ef4444" }
57
+ }
58
+ }, c = {
59
+ light: {
60
+ l1: .982,
61
+ l12: .16,
62
+ c1: .018,
63
+ c12: .045
64
+ },
65
+ dark: {
66
+ l1: .155,
67
+ l12: .982,
68
+ c1: .03,
69
+ c12: .012
70
+ }
71
+ };
72
+ function l(e, t) {
73
+ let n = e[0];
74
+ if (t <= n.x) return n.y;
75
+ for (let n = 1; n < e.length; n++) {
76
+ let r = e[n];
77
+ if (t <= r.x) {
78
+ let i = e[n - 1], a = (t - i.x) / (r.x - i.x);
79
+ return i.y + a * (r.y - i.y);
80
+ }
81
+ }
82
+ return e[e.length - 1].y;
83
+ }
84
+ function u(e, t, r) {
85
+ return Object.entries(e).map(([e, i]) => {
86
+ let a = n(i), s = r && Number(e) === 9 ? a.l + o[t] : a.l;
87
+ return {
88
+ step: Number(e),
89
+ color: r ? {
90
+ l: s,
91
+ c: 0,
92
+ h: 0
93
+ } : a
94
+ };
95
+ }).sort((e, t) => e.step - t.step);
96
+ }
97
+ function d(n, r, i) {
98
+ let a = [];
99
+ for (let o = 1; o <= 12; o++) a.push(t(e({
100
+ l: l(n, o),
101
+ c: r(o),
102
+ h: i(o)
103
+ })));
104
+ return a;
105
+ }
106
+ function f(e, t) {
107
+ return d(u(e, t, !0).map((e) => ({
108
+ x: e.step,
109
+ y: e.color.l
110
+ })), () => 0, () => 0);
111
+ }
112
+ function p(e, t) {
113
+ let n = u(e, t, !1), r = c[t], i = [
114
+ {
115
+ x: 1,
116
+ y: r.l1
117
+ },
118
+ ...n.map((e) => ({
119
+ x: e.step,
120
+ y: e.color.l
121
+ })),
122
+ {
123
+ x: 12,
124
+ y: r.l12
125
+ }
126
+ ], a = [
127
+ {
128
+ x: 1,
129
+ y: r.c1
130
+ },
131
+ ...n.map((e) => ({
132
+ x: e.step,
133
+ y: e.color.c
134
+ })),
135
+ {
136
+ x: 12,
137
+ y: r.c12
138
+ }
139
+ ], o = [
140
+ {
141
+ x: 1,
142
+ y: n[0].color.h
143
+ },
144
+ ...n.map((e) => ({
145
+ x: e.step,
146
+ y: e.color.h
147
+ })),
148
+ {
149
+ x: 12,
150
+ y: n[n.length - 1].color.h
151
+ }
152
+ ];
153
+ return d(i, (e) => l(a, e), (e) => l(o, e));
154
+ }
155
+ var m = {
156
+ light: {
157
+ gray: f(s.light.gray, "light"),
158
+ blue: p(s.light.blue, "light"),
159
+ green: p(s.light.green, "light"),
160
+ amber: p(s.light.amber, "light"),
161
+ red: p(s.light.red, "light")
162
+ },
163
+ dark: {
164
+ gray: f(s.dark.gray, "dark"),
165
+ blue: p(s.dark.blue, "dark"),
166
+ green: p(s.dark.green, "dark"),
167
+ amber: p(s.dark.amber, "dark"),
168
+ red: p(s.dark.red, "dark")
169
+ }
170
+ };
171
+ function h(e, t, n) {
172
+ let r = m[e][t][n - 1];
173
+ if (r === void 0) throw Error(`Missing primitive ${t}-${n} in ${e} mode`);
174
+ return r;
175
+ }
176
+ var g = {
177
+ primary: "blue",
178
+ success: "green",
179
+ warning: "amber",
180
+ danger: "red",
181
+ info: "blue"
182
+ }, _ = {
183
+ light: {
184
+ primary: 9,
185
+ success: 9,
186
+ warning: 9,
187
+ danger: 9,
188
+ info: 10
189
+ },
190
+ dark: {
191
+ primary: 9,
192
+ success: 8,
193
+ warning: 8,
194
+ danger: 8,
195
+ info: 8
196
+ }
197
+ }, v = {
198
+ bg: 1,
199
+ "bg-subtle": 2,
200
+ "bg-muted": 3,
201
+ text: 12,
202
+ "text-secondary": 11,
203
+ "text-muted": 9,
204
+ border: 4
205
+ }, y = (e, t) => `var(--haze-${e}-${t})`, b = (e, t, n) => r(h(e, t, n)), x = (e) => `calc(l ${e < 0 ? "-" : "+"} ${Math.abs(e)})`;
206
+ function S(e, t, n) {
207
+ let r = i[e];
208
+ switch (n) {
209
+ case "hover": return `oklch(from ${t} ${x(r.hover)} c h)`;
210
+ case "active": return `oklch(from ${t} ${x(r.active)} c h)`;
211
+ case "subtle": return `oklch(from ${t} ${r.subtleL} calc(c * ${r.subtleC}) h)`;
212
+ case "border-hover": return `oklch(from ${t} ${x(r.borderHover)} c h)`;
213
+ case "focus-ring": return `oklch(from ${t} l c h / ${a})`;
214
+ }
215
+ }
216
+ function C(t, n, r) {
217
+ let o = i[t];
218
+ switch (r) {
219
+ case "hover": return e({
220
+ l: n.l + o.hover,
221
+ c: n.c,
222
+ h: n.h
223
+ });
224
+ case "active": return e({
225
+ l: n.l + o.active,
226
+ c: n.c,
227
+ h: n.h
228
+ });
229
+ case "subtle": return e({
230
+ l: o.subtleL,
231
+ c: n.c * o.subtleC,
232
+ h: n.h
233
+ });
234
+ case "border-hover": return e({
235
+ l: n.l + o.borderHover,
236
+ c: n.c,
237
+ h: n.h
238
+ });
239
+ case "focus-ring": return {
240
+ l: n.l,
241
+ c: n.c,
242
+ h: n.h,
243
+ alpha: a
244
+ };
245
+ }
246
+ }
247
+ function w(e, t, n, r) {
248
+ return {
249
+ name: e,
250
+ label: t,
251
+ css: {
252
+ light: y(n, r.light),
253
+ dark: y(n, r.dark)
254
+ },
255
+ resolved: {
256
+ light: b("light", n, r.light),
257
+ dark: b("dark", n, r.dark)
258
+ }
259
+ };
260
+ }
261
+ function T(e, t, n, r, i) {
262
+ let a = `var(${n})`;
263
+ return {
264
+ name: e,
265
+ label: t,
266
+ css: {
267
+ light: S("light", a, i),
268
+ dark: S("dark", a, i)
269
+ },
270
+ resolved: {
271
+ light: C("light", r.light, i),
272
+ dark: C("dark", r.dark, i)
273
+ }
274
+ };
275
+ }
276
+ function E(e) {
277
+ let t = w(`--haze-color-${e}`, e[0].toUpperCase() + e.slice(1), g[e], {
278
+ light: _.light[e],
279
+ dark: _.dark[e]
280
+ });
281
+ return [
282
+ t,
283
+ T(`${t.name}-hover`, `${t.label} Hover`, t.name, t.resolved, "hover"),
284
+ T(`${t.name}-active`, `${t.label} Active`, t.name, t.resolved, "active"),
285
+ T(`${t.name}-subtle`, `${t.label} Subtle`, t.name, t.resolved, "subtle")
286
+ ];
287
+ }
288
+ function D(e, t) {
289
+ return w(`--haze-color-${e}`, t, "gray", {
290
+ light: v[e],
291
+ dark: v[e]
292
+ });
293
+ }
294
+ var O = E("primary"), k = O[0], A = {
295
+ name: "--haze-color-text-inverse",
296
+ label: "Text Inverse",
297
+ css: {
298
+ light: "oklch(1 0 0)",
299
+ dark: h("light", "gray", 12)
300
+ },
301
+ resolved: {
302
+ light: {
303
+ l: 1,
304
+ c: 0,
305
+ h: 0
306
+ },
307
+ dark: b("light", "gray", 12)
308
+ }
309
+ }, j = D("border", "Border"), M = [
310
+ ...O,
311
+ D("bg", "Background"),
312
+ D("bg-subtle", "Background Subtle"),
313
+ D("bg-muted", "Background Muted"),
314
+ D("text", "Text"),
315
+ D("text-secondary", "Text Secondary"),
316
+ D("text-muted", "Text Muted"),
317
+ A,
318
+ j,
319
+ T("--haze-color-border-hover", "Border Hover", j.name, j.resolved, "border-hover"),
320
+ ...E("success"),
321
+ ...E("warning"),
322
+ ...E("danger"),
323
+ ...E("info"),
324
+ T("--haze-color-focus-ring", "Focus Ring", k.name, k.resolved, "focus-ring")
325
+ ];
326
+ //#endregion
327
+ export { m as PRIMITIVES, M as SEMANTIC_COLOR_TOKENS };
@@ -1,149 +1,15 @@
1
+ import { formatOklch as e } from "./oklch.js";
2
+ import { SEMANTIC_COLOR_TOKENS as t } from "./palette.js";
1
3
  //#region src/lib/tokens/registry.ts
2
- var e = [
3
- {
4
- name: "--haze-color-primary",
5
- category: "color",
6
- label: "Primary",
7
- type: "color",
8
- light: "#0066ff",
9
- dark: "#4d94ff"
10
- },
11
- {
12
- name: "--haze-color-primary-hover",
13
- category: "color",
14
- label: "Primary Hover",
15
- type: "color",
16
- light: "#0052cc",
17
- dark: "#6aa6ff"
18
- },
19
- {
20
- name: "--haze-color-primary-active",
21
- category: "color",
22
- label: "Primary Active",
23
- type: "color",
24
- light: "#003d99",
25
- dark: "#80b3ff"
26
- },
27
- {
28
- name: "--haze-color-primary-subtle",
29
- category: "color",
30
- label: "Primary Subtle",
31
- type: "color",
32
- light: "#e6f0ff",
33
- dark: "#1a2e4a"
34
- },
35
- {
36
- name: "--haze-color-bg",
37
- category: "color",
38
- label: "Background",
39
- type: "color",
40
- light: "#ffffff",
41
- dark: "#121212"
42
- },
43
- {
44
- name: "--haze-color-bg-subtle",
45
- category: "color",
46
- label: "Background Subtle",
47
- type: "color",
48
- light: "#f7f8fa",
49
- dark: "#1e1e1e"
50
- },
51
- {
52
- name: "--haze-color-bg-muted",
53
- category: "color",
54
- label: "Background Muted",
55
- type: "color",
56
- light: "#eef0f4",
57
- dark: "#2a2a2a"
58
- },
59
- {
60
- name: "--haze-color-text",
61
- category: "color",
62
- label: "Text",
63
- type: "color",
64
- light: "#1a1a1a",
65
- dark: "#e8e8e8"
66
- },
67
- {
68
- name: "--haze-color-text-secondary",
69
- category: "color",
70
- label: "Text Secondary",
71
- type: "color",
72
- light: "#4a4a4a",
73
- dark: "#b0b0b0"
74
- },
75
- {
76
- name: "--haze-color-text-muted",
77
- category: "color",
78
- label: "Text Muted",
79
- type: "color",
80
- light: "#8a8a8a",
81
- dark: "#707070"
82
- },
83
- {
84
- name: "--haze-color-text-inverse",
85
- category: "color",
86
- label: "Text Inverse",
87
- type: "color",
88
- light: "#ffffff",
89
- dark: "#1a1a1a"
90
- },
91
- {
92
- name: "--haze-color-border",
93
- category: "color",
94
- label: "Border",
95
- type: "color",
96
- light: "#e0e0e0",
97
- dark: "#333333"
98
- },
99
- {
100
- name: "--haze-color-border-hover",
101
- category: "color",
102
- label: "Border Hover",
103
- type: "color",
104
- light: "#c0c0c0",
105
- dark: "#4a4a4a"
106
- },
107
- {
108
- name: "--haze-color-success",
109
- category: "color",
110
- label: "Success",
111
- type: "color",
112
- light: "#16a34a",
113
- dark: "#22c55e"
114
- },
115
- {
116
- name: "--haze-color-warning",
117
- category: "color",
118
- label: "Warning",
119
- type: "color",
120
- light: "#f59e0b",
121
- dark: "#fbbf24"
122
- },
123
- {
124
- name: "--haze-color-danger",
125
- category: "color",
126
- label: "Danger",
127
- type: "color",
128
- light: "#dc2626",
129
- dark: "#ef4444"
130
- },
131
- {
132
- name: "--haze-color-info",
133
- category: "color",
134
- label: "Info",
135
- type: "color",
136
- light: "#2563eb",
137
- dark: "#3b82f6"
138
- },
139
- {
140
- name: "--haze-color-focus-ring",
4
+ var n = [
5
+ ...t.map((t) => ({
6
+ name: t.name,
141
7
  category: "color",
142
- label: "Focus Ring",
8
+ label: t.label,
143
9
  type: "color",
144
- light: "rgba(0, 102, 255, 0.4)",
145
- dark: "rgba(77, 148, 255, 0.4)"
146
- },
10
+ light: e(t.resolved.light),
11
+ dark: e(t.resolved.dark)
12
+ })),
147
13
  {
148
14
  name: "--haze-font-sans",
149
15
  category: "typography",
@@ -448,7 +314,7 @@ var e = [
448
314
  light: "0 20px 25px rgba(0, 0, 0, 0.1)",
449
315
  dark: "0 20px 25px rgba(0, 0, 0, 0.1)"
450
316
  }
451
- ], t = {
317
+ ], r = {
452
318
  accordion: [
453
319
  "--haze-color-border",
454
320
  "--haze-color-bg-subtle",
@@ -466,10 +332,14 @@ var e = [
466
332
  ],
467
333
  alert: [
468
334
  "--haze-color-danger",
335
+ "--haze-color-danger-subtle",
469
336
  "--haze-color-focus-ring",
470
337
  "--haze-color-info",
338
+ "--haze-color-info-subtle",
471
339
  "--haze-color-success",
340
+ "--haze-color-success-subtle",
472
341
  "--haze-color-warning",
342
+ "--haze-color-warning-subtle",
473
343
  "--haze-font-sans",
474
344
  "--haze-leading-normal",
475
345
  "--haze-radius-md",
@@ -479,6 +349,43 @@ var e = [
479
349
  "--haze-text-lg",
480
350
  "--haze-text-sm"
481
351
  ],
352
+ approvalcard: [
353
+ "--haze-color-bg",
354
+ "--haze-color-border",
355
+ "--haze-color-primary",
356
+ "--haze-color-text",
357
+ "--haze-color-text-muted",
358
+ "--haze-color-warning",
359
+ "--haze-color-warning-subtle",
360
+ "--haze-font-sans",
361
+ "--haze-radius-md",
362
+ "--haze-space-2",
363
+ "--haze-space-3",
364
+ "--haze-space-4",
365
+ "--haze-text-sm",
366
+ "--haze-weight-medium"
367
+ ],
368
+ asyncsection: [
369
+ "--haze-color-bg-subtle",
370
+ "--haze-color-border",
371
+ "--haze-color-border-hover",
372
+ "--haze-color-danger",
373
+ "--haze-color-danger-subtle",
374
+ "--haze-color-focus-ring",
375
+ "--haze-color-text",
376
+ "--haze-color-text-muted",
377
+ "--haze-font-sans",
378
+ "--haze-leading-normal",
379
+ "--haze-leading-tight",
380
+ "--haze-radius-md",
381
+ "--haze-space-1",
382
+ "--haze-space-2",
383
+ "--haze-space-3",
384
+ "--haze-space-4",
385
+ "--haze-space-8",
386
+ "--haze-text-sm",
387
+ "--haze-weight-medium"
388
+ ],
482
389
  avatar: [
483
390
  "--haze-color-bg-muted",
484
391
  "--haze-color-text-secondary",
@@ -492,10 +399,14 @@ var e = [
492
399
  badge: [
493
400
  "--haze-color-bg-muted",
494
401
  "--haze-color-danger",
402
+ "--haze-color-danger-subtle",
495
403
  "--haze-color-info",
404
+ "--haze-color-info-subtle",
496
405
  "--haze-color-success",
406
+ "--haze-color-success-subtle",
497
407
  "--haze-color-text-secondary",
498
408
  "--haze-color-warning",
409
+ "--haze-color-warning-subtle",
499
410
  "--haze-font-sans",
500
411
  "--haze-leading-tight",
501
412
  "--haze-radius-full",
@@ -507,6 +418,23 @@ var e = [
507
418
  "--haze-text-xs",
508
419
  "--haze-weight-medium"
509
420
  ],
421
+ banner: [
422
+ "--haze-color-danger",
423
+ "--haze-color-danger-subtle",
424
+ "--haze-color-info",
425
+ "--haze-color-info-subtle",
426
+ "--haze-color-success",
427
+ "--haze-color-success-subtle",
428
+ "--haze-color-warning",
429
+ "--haze-color-warning-subtle",
430
+ "--haze-font-sans",
431
+ "--haze-radius-md",
432
+ "--haze-space-2",
433
+ "--haze-space-3",
434
+ "--haze-space-4",
435
+ "--haze-text-lg",
436
+ "--haze-text-sm"
437
+ ],
510
438
  breadcrumb: [
511
439
  "--haze-color-primary",
512
440
  "--haze-color-primary-hover",
@@ -578,6 +506,49 @@ var e = [
578
506
  "--haze-text-sm",
579
507
  "--haze-weight-medium"
580
508
  ],
509
+ chip: [
510
+ "--haze-color-bg-muted",
511
+ "--haze-color-border",
512
+ "--haze-color-danger",
513
+ "--haze-color-danger-subtle",
514
+ "--haze-color-primary",
515
+ "--haze-color-primary-subtle",
516
+ "--haze-color-success",
517
+ "--haze-color-success-subtle",
518
+ "--haze-color-text-secondary",
519
+ "--haze-color-warning",
520
+ "--haze-color-warning-subtle",
521
+ "--haze-font-sans",
522
+ "--haze-radius-full",
523
+ "--haze-space-1",
524
+ "--haze-space-3",
525
+ "--haze-text-xs",
526
+ "--haze-weight-medium"
527
+ ],
528
+ confirmdialog: [
529
+ "--haze-color-bg",
530
+ "--haze-color-border",
531
+ "--haze-color-danger",
532
+ "--haze-color-danger-active",
533
+ "--haze-color-danger-hover",
534
+ "--haze-color-primary",
535
+ "--haze-color-text",
536
+ "--haze-color-text-inverse",
537
+ "--haze-color-text-muted",
538
+ "--haze-font-sans",
539
+ "--haze-leading-relaxed",
540
+ "--haze-radius-md",
541
+ "--haze-radius-xl",
542
+ "--haze-shadow-xl",
543
+ "--haze-space-2",
544
+ "--haze-space-3",
545
+ "--haze-space-4",
546
+ "--haze-space-6",
547
+ "--haze-text-lg",
548
+ "--haze-text-sm",
549
+ "--haze-weight-medium",
550
+ "--haze-weight-semibold"
551
+ ],
581
552
  combobox: [
582
553
  "--haze-color-bg",
583
554
  "--haze-color-border",
@@ -627,6 +598,20 @@ var e = [
627
598
  "--haze-shadow-xl",
628
599
  "--haze-space-6"
629
600
  ],
601
+ diffviewer: [
602
+ "--haze-color-border",
603
+ "--haze-color-danger",
604
+ "--haze-color-danger-subtle",
605
+ "--haze-color-success",
606
+ "--haze-color-success-subtle",
607
+ "--haze-color-text-muted",
608
+ "--haze-font-mono",
609
+ "--haze-leading-relaxed",
610
+ "--haze-radius-md",
611
+ "--haze-space-2",
612
+ "--haze-space-3",
613
+ "--haze-text-xs"
614
+ ],
630
615
  disclosure: [
631
616
  "--haze-color-bg-subtle",
632
617
  "--haze-color-border",
@@ -777,6 +762,24 @@ var e = [
777
762
  "--haze-radius-full",
778
763
  "--haze-shadow-sm"
779
764
  ],
765
+ steptimeline: [
766
+ "--haze-color-bg",
767
+ "--haze-color-border",
768
+ "--haze-color-danger",
769
+ "--haze-color-primary",
770
+ "--haze-color-success",
771
+ "--haze-color-text",
772
+ "--haze-color-text-inverse",
773
+ "--haze-color-text-muted",
774
+ "--haze-font-sans",
775
+ "--haze-radius-full",
776
+ "--haze-space-1",
777
+ "--haze-space-3",
778
+ "--haze-space-4",
779
+ "--haze-text-sm",
780
+ "--haze-text-xs",
781
+ "--haze-weight-medium"
782
+ ],
780
783
  switch: [
781
784
  "--haze-color-bg-muted",
782
785
  "--haze-color-primary",
@@ -813,8 +816,11 @@ var e = [
813
816
  "--haze-color-primary",
814
817
  "--haze-color-primary-subtle",
815
818
  "--haze-color-success",
819
+ "--haze-color-success-subtle",
816
820
  "--haze-color-warning",
821
+ "--haze-color-warning-subtle",
817
822
  "--haze-color-danger",
823
+ "--haze-color-danger-subtle",
818
824
  "--haze-color-focus-ring",
819
825
  "--haze-font-sans",
820
826
  "--haze-radius-md",
@@ -851,8 +857,11 @@ var e = [
851
857
  "--haze-color-border",
852
858
  "--haze-color-text",
853
859
  "--haze-color-success",
860
+ "--haze-color-success-subtle",
854
861
  "--haze-color-warning",
862
+ "--haze-color-warning-subtle",
855
863
  "--haze-color-danger",
864
+ "--haze-color-danger-subtle",
856
865
  "--haze-font-sans",
857
866
  "--haze-leading-normal",
858
867
  "--haze-radius-md",
@@ -875,4 +884,4 @@ var e = [
875
884
  ]
876
885
  };
877
886
  //#endregion
878
- export { t as COMPONENT_TOKENS, e as TOKEN_REGISTRY };
887
+ export { r as COMPONENT_TOKENS, n as TOKEN_REGISTRY };
@@ -1,3 +1,7 @@
1
1
  export { lightTheme, darkTheme } from './colors';
2
2
  export { spacing } from './spacing';
3
3
  export { typography } from './typography';
4
+ export { PRIMITIVES, SEMANTIC_COLOR_TOKENS } from './palette';
5
+ export type { Family, Mode, PrimitiveScales, SemanticColorToken } from './palette';
6
+ export { deltaE, formatOklch, oklchToHex, parseHex, parseOklch, wcagContrast } from './oklch';
7
+ export type { Oklch } from './oklch';