@rinzai/zen 0.6.1 → 0.7.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/LICENSE +27 -0
- package/README.md +3 -3
- package/dist/alert/index.d.ts +21 -0
- package/dist/alert/index.d.ts.map +1 -0
- package/dist/alert/index.js +49 -0
- package/dist/button/index.d.ts +2 -1
- package/dist/button/index.d.ts.map +1 -1
- package/dist/button/index.js +43 -12
- package/dist/calendar/index.d.ts.map +1 -1
- package/dist/calendar/index.js +86 -85
- package/dist/chart/donut.d.ts +4 -1
- package/dist/chart/donut.d.ts.map +1 -1
- package/dist/chart/donut.js +76 -66
- package/dist/chart/index.d.ts +8 -2
- package/dist/chart/index.d.ts.map +1 -1
- package/dist/chart/index.js +192 -182
- package/dist/chart/palette.d.ts +11 -0
- package/dist/chart/palette.d.ts.map +1 -0
- package/dist/chart/palette.js +9 -0
- package/dist/chart/tooltip.d.ts +6 -2
- package/dist/chart/tooltip.d.ts.map +1 -1
- package/dist/chart/tooltip.js +6 -6
- package/dist/checkbox/index.d.ts.map +1 -1
- package/dist/checkbox/index.js +28 -44
- package/dist/chip/index.js +1 -1
- package/dist/code-block/index.js +1 -1
- package/dist/date-picker/index.d.ts.map +1 -1
- package/dist/date-picker/index.js +24 -38
- package/dist/disclosure/index.js +1 -1
- package/dist/editable-cell/index.js +1 -1
- package/dist/field/index.d.ts +1 -1
- package/dist/field/index.d.ts.map +1 -1
- package/dist/field/index.js +33 -32
- package/dist/header/index.d.ts +9 -1
- package/dist/header/index.d.ts.map +1 -1
- package/dist/header/index.js +17 -9
- package/dist/icons/arrow-left.d.ts +3 -0
- package/dist/icons/arrow-left.d.ts.map +1 -0
- package/dist/icons/arrow-right.d.ts +3 -0
- package/dist/icons/arrow-right.d.ts.map +1 -0
- package/dist/icons/bars.d.ts +3 -0
- package/dist/icons/bars.d.ts.map +1 -0
- package/dist/icons/calendar.d.ts +3 -0
- package/dist/icons/calendar.d.ts.map +1 -0
- package/dist/icons/chart-bar.d.ts +3 -0
- package/dist/icons/chart-bar.d.ts.map +1 -0
- package/dist/icons/chevron-down.d.ts.map +1 -1
- package/dist/icons/chevron-down.js +4 -2
- package/dist/icons/chevron-left.d.ts.map +1 -1
- package/dist/icons/chevron-left.js +4 -2
- package/dist/icons/chevron-right.d.ts.map +1 -1
- package/dist/icons/chevron-right.js +4 -2
- package/dist/icons/chevron-up.d.ts.map +1 -1
- package/dist/icons/chevron-up.js +4 -2
- package/dist/icons/ellipsis.d.ts +0 -1
- package/dist/icons/ellipsis.d.ts.map +1 -1
- package/dist/icons/flag.d.ts +3 -0
- package/dist/icons/flag.d.ts.map +1 -0
- package/dist/icons/list-bullet.d.ts +3 -0
- package/dist/icons/list-bullet.d.ts.map +1 -0
- package/dist/icons/lock.d.ts +3 -0
- package/dist/icons/lock.d.ts.map +1 -0
- package/dist/icons/logout.d.ts +3 -0
- package/dist/icons/logout.d.ts.map +1 -0
- package/dist/icons/micro/calendar.d.ts +3 -0
- package/dist/icons/micro/calendar.d.ts.map +1 -0
- package/dist/icons/micro/calendar.js +21 -0
- package/dist/icons/micro/check.d.ts +3 -0
- package/dist/icons/micro/check.d.ts.map +1 -0
- package/dist/icons/micro/check.js +21 -0
- package/dist/icons/micro/chevron-down.d.ts +3 -0
- package/dist/icons/micro/chevron-down.d.ts.map +1 -0
- package/dist/icons/micro/chevron-down.js +21 -0
- package/dist/icons/micro/chevron-right.d.ts +3 -0
- package/dist/icons/micro/chevron-right.d.ts.map +1 -0
- package/dist/icons/micro/chevron-right.js +21 -0
- package/dist/icons/micro/exclamation-triangle.d.ts +3 -0
- package/dist/icons/micro/exclamation-triangle.d.ts.map +1 -0
- package/dist/icons/micro/exclamation-triangle.js +21 -0
- package/dist/icons/micro/information-circle.d.ts +3 -0
- package/dist/icons/micro/information-circle.d.ts.map +1 -0
- package/dist/icons/micro/information-circle.js +21 -0
- package/dist/icons/micro/minus.d.ts +3 -0
- package/dist/icons/micro/minus.d.ts.map +1 -0
- package/dist/icons/micro/minus.js +17 -0
- package/dist/icons/micro/moon.d.ts +3 -0
- package/dist/icons/micro/moon.d.ts.map +1 -0
- package/dist/icons/micro/moon.js +17 -0
- package/dist/icons/micro/sun.d.ts +3 -0
- package/dist/icons/micro/sun.d.ts.map +1 -0
- package/dist/icons/micro/sun.js +17 -0
- package/dist/icons/micro/x-mark.d.ts +3 -0
- package/dist/icons/micro/x-mark.d.ts.map +1 -0
- package/dist/icons/micro/x-mark.js +17 -0
- package/dist/icons/search.d.ts.map +1 -1
- package/dist/icons/search.js +4 -2
- package/dist/icons/settings.d.ts +3 -0
- package/dist/icons/settings.d.ts.map +1 -0
- package/dist/icons/squares.d.ts +3 -0
- package/dist/icons/squares.d.ts.map +1 -0
- package/dist/icons/table.d.ts +3 -0
- package/dist/icons/table.d.ts.map +1 -0
- package/dist/icons/x-mark.d.ts.map +1 -1
- package/dist/icons/x-mark.js +4 -2
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/lib.js +56 -61
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +67 -60
- package/dist/month-picker/index.d.ts.map +1 -1
- package/dist/month-picker/index.js +55 -55
- package/dist/pills/index.d.ts +1 -1
- package/dist/pills/index.d.ts.map +1 -1
- package/dist/pills/index.js +6 -2
- package/dist/popover/index.js +12 -11
- package/dist/select/index.d.ts.map +1 -1
- package/dist/select/index.js +96 -102
- package/dist/slider/index.d.ts.map +1 -1
- package/dist/slider/index.js +1 -1
- package/dist/status-pill/index.d.ts +18 -0
- package/dist/status-pill/index.d.ts.map +1 -0
- package/dist/status-pill/index.js +25 -0
- package/dist/tab-bar/index.js +1 -1
- package/dist/table/index.js +1 -1
- package/dist/tabs/index.d.ts.map +1 -1
- package/dist/tabs/index.js +9 -5
- package/dist/theme-toggle/index.d.ts +2 -1
- package/dist/theme-toggle/index.d.ts.map +1 -1
- package/dist/theme-toggle/index.js +35 -32
- package/dist/theme.css +62 -1
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/index.js +119 -106
- package/dist/tree/index.d.ts +22 -3
- package/dist/tree/index.d.ts.map +1 -1
- package/dist/tree/index.js +76 -56
- package/dist/utils/date.d.ts +6 -4
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/date.js +18 -16
- package/dist/utils/field-chevron.d.ts.map +1 -1
- package/dist/utils/field-chevron.js +5 -14
- package/dist/utils/status-icons.d.ts +1 -1
- package/dist/utils/status-icons.d.ts.map +1 -1
- package/dist/utils/status-icons.js +11 -41
- package/dist/utils/styles.d.ts +9 -3
- package/dist/utils/styles.d.ts.map +1 -1
- package/dist/utils/styles.js +2 -2
- package/dist/utils/theme-wave.d.ts +24 -0
- package/dist/utils/theme-wave.d.ts.map +1 -0
- package/dist/utils/theme-wave.js +219 -0
- package/dist/utils/typeahead.d.ts +12 -0
- package/dist/utils/typeahead.d.ts.map +1 -0
- package/dist/utils/typeahead.js +19 -0
- package/dist/zen.css +1 -1
- package/package.json +2 -1
- package/dist/icons/ellipsis.js +0 -31
- package/dist/icons/index.d.ts +0 -9
- package/dist/icons/index.d.ts.map +0 -1
- package/dist/icons/status.d.ts +0 -2
- package/dist/icons/status.d.ts.map +0 -1
package/dist/utils/date.d.ts
CHANGED
|
@@ -23,15 +23,17 @@ export declare function dayOfWeek(date: DateString): number;
|
|
|
23
23
|
export declare function today(now?: Date): DateString;
|
|
24
24
|
/** Days from `from` to `to` (negative if `to` is earlier). */
|
|
25
25
|
export declare function daysBetween(from: DateString, to: DateString): number;
|
|
26
|
+
/** How much of a date to show; `day` is the day and month without the year ("Sep 3"), for dates within the year. */
|
|
27
|
+
export type DateStyle = 'day' | 'short' | 'medium' | 'long' | 'full';
|
|
26
28
|
/**
|
|
27
|
-
* "Sep 30, 2026" (or the locale's equivalent) by default; `
|
|
28
|
-
* "9/30/26", `long` "September 30, 2026", `full` adds the weekday.
|
|
29
|
+
* "Sep 30, 2026" (or the locale's equivalent) by default; `day` is "Sep 30",
|
|
30
|
+
* `short` "9/30/26", `long` "September 30, 2026", `full` adds the weekday.
|
|
29
31
|
*/
|
|
30
|
-
export declare function formatDate(date: DateString, locale: string, style?:
|
|
32
|
+
export declare function formatDate(date: DateString, locale: string, style?: DateStyle): string;
|
|
31
33
|
/** Short weekday names for a locale, Sunday first. */
|
|
32
34
|
export declare function weekdayNames(locale: string, style?: 'narrow' | 'short' | 'long'): string[];
|
|
33
35
|
/** The first day of the week for a locale: 0 for Sunday, 1 for Monday, 6 for Saturday. */
|
|
34
36
|
export declare function weekStart(locale: string): number;
|
|
35
37
|
/** "Sep 3 – 10, 2026" (or the locale's equivalent), sharing what the two dates have in common. */
|
|
36
|
-
export declare function formatDateRange(start: DateString, end: DateString, locale: string, style?:
|
|
38
|
+
export declare function formatDateRange(start: DateString, end: DateString, locale: string, style?: Exclude<DateStyle, 'full'>): string;
|
|
37
39
|
//# sourceMappingURL=date.d.ts.map
|
package/dist/utils/date.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../packages/utils/date.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC,6EAA6E;AAC7E,MAAM,WAAW,SAAS;IACtB,KAAK,EAAE,UAAU,CAAC;IAClB,GAAG,EAAE,UAAU,GAAG,IAAI,CAAC;CAC1B;AAID,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAI1D;AAED,0EAA0E;AAC1E,wBAAgB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAGjD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAEtD;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,GAAG,UAAU,CAE/D;AAED,6FAA6F;AAC7F,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,GAAG,UAAU,CAKvE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAGhD;AAED,qCAAqC;AACrC,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAElD;AAED,qCAAqC;AACrC,wBAAgB,KAAK,CAAC,GAAG,GAAE,IAAiB,GAAG,UAAU,CAExD;AAED,8DAA8D;AAC9D,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,GAAG,MAAM,CAEpE;AAED;;;GAGG;AACH,wBAAgB,UAAU,
|
|
1
|
+
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../packages/utils/date.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC,6EAA6E;AAC7E,MAAM,WAAW,SAAS;IACtB,KAAK,EAAE,UAAU,CAAC;IAClB,GAAG,EAAE,UAAU,GAAG,IAAI,CAAC;CAC1B;AAID,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAI1D;AAED,0EAA0E;AAC1E,wBAAgB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAGjD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAEtD;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,GAAG,UAAU,CAE/D;AAED,6FAA6F;AAC7F,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,GAAG,UAAU,CAKvE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAGhD;AAED,qCAAqC;AACrC,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAElD;AAED,qCAAqC;AACrC,wBAAgB,KAAK,CAAC,GAAG,GAAE,IAAiB,GAAG,UAAU,CAExD;AAED,8DAA8D;AAC9D,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,GAAG,MAAM,CAEpE;AAED,oHAAoH;AACpH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAQrE;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,SAAoB,GAAG,MAAM,CAEhG;AAED,sDAAsD;AACtD,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,QAAQ,GAAG,OAAO,GAAG,MAAgB,GAAG,MAAM,EAAE,CAGnG;AAUD,0FAA0F;AAC1F,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAahD;AAED,kGAAkG;AAClG,wBAAgB,eAAe,CAC3B,KAAK,EAAE,UAAU,EACjB,GAAG,EAAE,UAAU,EACf,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,OAAO,CAAC,SAAS,EAAE,MAAM,CAAY,GAC7C,MAAM,CAER"}
|
package/dist/utils/date.js
CHANGED
|
@@ -33,36 +33,38 @@ function c(e = /* @__PURE__ */ new Date()) {
|
|
|
33
33
|
function l(e, t) {
|
|
34
34
|
return n(t) - n(e);
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
var u = (e, t) => new Intl.DateTimeFormat(e, t === "day" ? {
|
|
37
|
+
day: "numeric",
|
|
38
|
+
month: "short",
|
|
39
|
+
timeZone: "UTC"
|
|
40
|
+
} : {
|
|
41
|
+
dateStyle: t,
|
|
42
|
+
timeZone: "UTC"
|
|
43
|
+
});
|
|
44
|
+
function d(e, t, r = "medium") {
|
|
45
|
+
return _(u(t, r).format(n(e) * 864e5));
|
|
41
46
|
}
|
|
42
|
-
function
|
|
47
|
+
function f(e, t = "short") {
|
|
43
48
|
let n = new Intl.DateTimeFormat(e, {
|
|
44
49
|
weekday: t,
|
|
45
50
|
timeZone: "UTC"
|
|
46
51
|
});
|
|
47
52
|
return Array.from({ length: 7 }, (e, t) => n.format(Date.UTC(2023, 0, 1 + t)));
|
|
48
53
|
}
|
|
49
|
-
var
|
|
50
|
-
function
|
|
54
|
+
var p = new Set("AG AS BD BR BS BT BW BZ CA CN CO DM DO ET GT GU HK HN ID IL IN JM JP KE KH KR LA MH MM MO MT MX MZ NI NP PA PE PH PK PR PT PY SA SG SV TH TT TW UM US VE VI WS YE ZA ZW".split(" ")), m = new Set("AE AF BH DJ DZ EG IQ IR JO KW LY OM QA SD SY".split(" "));
|
|
55
|
+
function h(e) {
|
|
51
56
|
try {
|
|
52
57
|
let t = new Intl.Locale(e), n = t.getWeekInfo?.() ?? t.weekInfo;
|
|
53
58
|
if (n) return n.firstDay % 7;
|
|
54
59
|
let r = t.maximize().region ?? "";
|
|
55
|
-
return
|
|
60
|
+
return p.has(r) ? 0 : m.has(r) ? 6 : 1;
|
|
56
61
|
} catch {
|
|
57
62
|
return 1;
|
|
58
63
|
}
|
|
59
64
|
}
|
|
60
|
-
function
|
|
61
|
-
return
|
|
62
|
-
dateStyle: i,
|
|
63
|
-
timeZone: "UTC"
|
|
64
|
-
}).formatRange(n(e) * 864e5, n(t) * 864e5));
|
|
65
|
+
function g(e, t, r, i = "medium") {
|
|
66
|
+
return _(u(r, i).formatRange(n(e) * 864e5, n(t) * 864e5));
|
|
65
67
|
}
|
|
66
|
-
var
|
|
68
|
+
var _ = (e) => e.replace(/[\u2009\u202f]/g, " ");
|
|
67
69
|
//#endregion
|
|
68
|
-
export { i as addDays, a as addMonthsToDate, n as dayIndex, s as dayOfWeek, l as daysBetween, o as daysInMonth,
|
|
70
|
+
export { i as addDays, a as addMonthsToDate, n as dayIndex, s as dayOfWeek, l as daysBetween, o as daysInMonth, d as formatDate, g as formatDateRange, r as fromDayIndex, t as isDate, c as today, h as weekStart, f as weekdayNames };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-chevron.d.ts","sourceRoot":"","sources":["../../packages/utils/field-chevron.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"field-chevron.d.ts","sourceRoot":"","sources":["../../packages/utils/field-chevron.tsx"],"names":[],"mappings":"AAIA,2FAA2F;AAC3F,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAUvF"}
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx as e } from "./cx.js";
|
|
3
|
-
import
|
|
3
|
+
import t from "../icons/micro/chevron-down.js";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
5
|
//#region packages/utils/field-chevron.tsx
|
|
5
|
-
function
|
|
6
|
-
return /* @__PURE__ */ t("
|
|
7
|
-
viewBox: "0 0 16 16",
|
|
8
|
-
fill: "none",
|
|
9
|
-
stroke: "currentColor",
|
|
10
|
-
strokeWidth: "1.6",
|
|
11
|
-
strokeLinecap: "round",
|
|
12
|
-
strokeLinejoin: "round",
|
|
13
|
-
"aria-hidden": !0,
|
|
14
|
-
className: e("text-muted-foreground size-4 shrink-0 transition-transform duration-300", n && "rotate-180", r),
|
|
15
|
-
children: /* @__PURE__ */ t("path", { d: "m4 6 4 4 4-4" })
|
|
16
|
-
});
|
|
6
|
+
function r({ open: r, className: i }) {
|
|
7
|
+
return /* @__PURE__ */ n(t, { className: e("text-muted-foreground size-4 shrink-0 transition-transform duration-300", r && "rotate-180", i) });
|
|
17
8
|
}
|
|
18
9
|
//#endregion
|
|
19
|
-
export {
|
|
10
|
+
export { r as FieldChevron };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Small
|
|
1
|
+
/** Small status icons in the current text colour (toasts, field errors): Heroicons' micro set. */
|
|
2
2
|
export declare function CheckIcon({ className }: {
|
|
3
3
|
className?: string;
|
|
4
4
|
}): import('react').JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-icons.d.ts","sourceRoot":"","sources":["../../packages/utils/status-icons.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"status-icons.d.ts","sourceRoot":"","sources":["../../packages/utils/status-icons.tsx"],"names":[],"mappings":"AAMA,kGAAkG;AAClG,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAE9D;AAED,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAE9D;AAED,wBAAgB,QAAQ,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAE7D"}
|
|
@@ -1,48 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx as e } from "./cx.js";
|
|
3
|
-
import
|
|
3
|
+
import t from "../icons/micro/check.js";
|
|
4
|
+
import n from "../icons/micro/exclamation-triangle.js";
|
|
5
|
+
import r from "../icons/micro/information-circle.js";
|
|
6
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
4
7
|
//#region packages/utils/status-icons.tsx
|
|
5
|
-
function
|
|
6
|
-
return /* @__PURE__ */ t("
|
|
7
|
-
viewBox: "0 0 16 16",
|
|
8
|
-
fill: "none",
|
|
9
|
-
stroke: "currentColor",
|
|
10
|
-
strokeWidth: "2",
|
|
11
|
-
strokeLinecap: "round",
|
|
12
|
-
strokeLinejoin: "round",
|
|
13
|
-
className: e("size-3.5", n),
|
|
14
|
-
"aria-hidden": !0,
|
|
15
|
-
children: /* @__PURE__ */ t("path", { d: "m3.5 8.5 3 3 6-7" })
|
|
16
|
-
});
|
|
8
|
+
function a({ className: n }) {
|
|
9
|
+
return /* @__PURE__ */ i(t, { className: e("size-3.5", n) });
|
|
17
10
|
}
|
|
18
|
-
function
|
|
19
|
-
return /* @__PURE__ */ n("
|
|
20
|
-
viewBox: "0 0 16 16",
|
|
21
|
-
fill: "none",
|
|
22
|
-
stroke: "currentColor",
|
|
23
|
-
strokeWidth: "1.8",
|
|
24
|
-
strokeLinecap: "round",
|
|
25
|
-
strokeLinejoin: "round",
|
|
26
|
-
className: e("size-3.5", r),
|
|
27
|
-
"aria-hidden": !0,
|
|
28
|
-
children: [/* @__PURE__ */ t("path", { d: "M8 2.2 1.6 13.3h12.8L8 2.2Z" }), /* @__PURE__ */ t("path", { d: "M8 6.5v3M8 11.6v.1" })]
|
|
29
|
-
});
|
|
11
|
+
function o({ className: t }) {
|
|
12
|
+
return /* @__PURE__ */ i(n, { className: e("size-3.5", t) });
|
|
30
13
|
}
|
|
31
|
-
function
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
viewBox: "0 0 16 16",
|
|
34
|
-
fill: "none",
|
|
35
|
-
stroke: "currentColor",
|
|
36
|
-
strokeWidth: "1.8",
|
|
37
|
-
strokeLinecap: "round",
|
|
38
|
-
className: e("size-3.5", r),
|
|
39
|
-
"aria-hidden": !0,
|
|
40
|
-
children: [/* @__PURE__ */ t("circle", {
|
|
41
|
-
cx: "8",
|
|
42
|
-
cy: "8",
|
|
43
|
-
r: "6.3"
|
|
44
|
-
}), /* @__PURE__ */ t("path", { d: "M8 7.3v3.8M8 4.9v.1" })]
|
|
45
|
-
});
|
|
14
|
+
function s({ className: t }) {
|
|
15
|
+
return /* @__PURE__ */ i(r, { className: e("size-3.5", t) });
|
|
46
16
|
}
|
|
47
17
|
//#endregion
|
|
48
|
-
export {
|
|
18
|
+
export { o as AlertIcon, a as CheckIcon, s as InfoIcon };
|
package/dist/utils/styles.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
/** Shared field look: faint glass, hairline
|
|
1
|
+
/** Shared field look: faint glass, a hairline in the glow colour (white would grey it out) lit by the pointer, violet glow on focus. */
|
|
2
2
|
export declare const FIELD: string;
|
|
3
|
+
/** A picker's previous/next arrows (Calendar, MonthPicker). */
|
|
4
|
+
export declare const PICKER_NAV = "text-muted-foreground cursor-pointer hover:bg-tint/[0.07] hover:text-foreground focus-visible:ring-ring/50 grid size-8 place-items-center rounded-md outline-hidden transition-colors focus-visible:ring-2";
|
|
5
|
+
/** A month in a picker's month grid (Calendar, MonthPicker); add PICKER_MONTH_ON for the chosen one. */
|
|
6
|
+
export declare const PICKER_MONTH = "cursor-pointer rounded-lg py-2 text-sm outline-hidden transition-colors disabled:cursor-not-allowed disabled:opacity-35 focus-visible:ring-ring/50 focus-visible:ring-2 hover:bg-tint/[0.07]";
|
|
7
|
+
export declare const PICKER_MONTH_ON = "bg-primary text-primary-foreground hover:bg-primary";
|
|
3
8
|
/** Glow a trigger carries while its popup is open. */
|
|
4
9
|
export declare const TRIGGER_OPEN = "border-glow/60 [--glow-border-color:transparent] shadow-[0_0_0_3px_oklch(var(--glow)/0.16),0_0_24px_-6px_oklch(var(--glow)/0.6)]";
|
|
5
10
|
/** Trigger for popup fields (dropdown): a field that glows while open. */
|
|
@@ -8,9 +13,10 @@ export declare const TRIGGER: string;
|
|
|
8
13
|
export declare const POPUP = "glass glass-blur rounded-xl text-foreground shadow-[var(--popup-shadow),0_0_40px_-20px_oklch(var(--glow)/0.5)] outline-hidden";
|
|
9
14
|
/** Pills (and TabList variant="pills"): a glass track… */
|
|
10
15
|
export declare const PILL_TRACK = "glow-edge relative flex w-fit items-center gap-1 rounded-full border border-tint/5 bg-tint/[0.03] p-1";
|
|
11
|
-
/** …a glowing pill that slides to the active item… */
|
|
16
|
+
/** …a glowing pill that slides to the active item (its look is repeated in theme.css, for before it's measured)… */
|
|
12
17
|
export declare const PILL_INDICATOR = "absolute top-1 bottom-1 left-0 rounded-full bg-primary/15 shadow-[inset_0_0_0_1px_oklch(var(--glow)/0.35),0_0_24px_-4px_oklch(var(--glow)/0.6)] transition-[translate,width] duration-500 ease-[cubic-bezier(0.2,0.8,0.2,1)]";
|
|
13
|
-
/** …and items that sit above it, lit when current (a link) or selected (a tab).
|
|
18
|
+
/** …and items that sit above it, lit when current (a link) or selected (a tab). Only their text colour
|
|
19
|
+
* transitions: the pill they wear before the indicator is measured (theme.css) must go at once. */
|
|
14
20
|
export declare const PILL: string;
|
|
15
21
|
/**
|
|
16
22
|
* For a wrapper whose child input takes focus (InputGroup): FIELD, lit by
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../packages/utils/styles.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../packages/utils/styles.ts"],"names":[],"mappings":"AAEA,wIAAwI;AACxI,eAAO,MAAM,KAAK,QAKmC,CAAC;AAEtD,+DAA+D;AAC/D,eAAO,MAAM,UAAU,+MACyL,CAAC;AAEjN,wGAAwG;AACxG,eAAO,MAAM,YAAY,iMACyK,CAAC;AACnM,eAAO,MAAM,eAAe,wDAAwD,CAAC;AAErF,sDAAsD;AACtD,eAAO,MAAM,YAAY,qIAC6G,CAAC;AAEvI,0EAA0E;AAC1E,eAAO,MAAM,OAAO,QAA+F,CAAC;AAEpH,oEAAoE;AACpE,eAAO,MAAM,KAAK,kIACiH,CAAC;AAEpI,0DAA0D;AAC1D,eAAO,MAAM,UAAU,0GACoF,CAAC;AAE5G,oHAAoH;AACpH,eAAO,MAAM,cAAc,iOACuM,CAAC;AAEnO;mGACmG;AACnG,eAAO,MAAM,IAAI,QAEkG,CAAC;AAEpH;;;;GAIG;AACH,eAAO,MAAM,YAAY,QAK4B,CAAC"}
|
package/dist/utils/styles.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx as e } from "./cx.js";
|
|
3
3
|
//#region packages/utils/styles.ts
|
|
4
|
-
var t = "glow-border h-10 rounded-lg border [--glow-border-color:oklch(var(--
|
|
4
|
+
var t = "glow-border h-10 rounded-lg border [--glow-border-color:oklch(var(--glow)/0.22)] bg-tint/[0.035] px-3 text-sm text-foreground shadow-[inset_0_1px_0_hsl(0_0%_100%/0.04)] transition-[border-color,background-color,box-shadow,--glow-border-color] duration-200 placeholder:text-muted-foreground hover:[--glow-border-color:oklch(var(--glow)/0.4)] focus-visible:border-glow/60 focus-visible:[--glow-border-color:transparent] focus-visible:bg-tint/[0.05] focus-visible:shadow-[0_0_0_3px_oklch(var(--glow)/0.16),0_0_24px_-6px_oklch(var(--glow)/0.6)] focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50", n = "text-muted-foreground cursor-pointer hover:bg-tint/[0.07] hover:text-foreground focus-visible:ring-ring/50 grid size-8 place-items-center rounded-md outline-hidden transition-colors focus-visible:ring-2", r = "cursor-pointer rounded-lg py-2 text-sm outline-hidden transition-colors disabled:cursor-not-allowed disabled:opacity-35 focus-visible:ring-ring/50 focus-visible:ring-2 hover:bg-tint/[0.07]", i = "bg-primary text-primary-foreground hover:bg-primary", a = "border-glow/60 [--glow-border-color:transparent] shadow-[0_0_0_3px_oklch(var(--glow)/0.16),0_0_24px_-6px_oklch(var(--glow)/0.6)]", o = e(t, "inline-flex cursor-pointer items-center justify-between gap-2 whitespace-nowrap"), s = "glass glass-blur rounded-xl text-foreground shadow-[var(--popup-shadow),0_0_40px_-20px_oklch(var(--glow)/0.5)] outline-hidden", c = "glow-edge relative flex w-fit items-center gap-1 rounded-full border border-tint/5 bg-tint/[0.03] p-1", l = "absolute top-1 bottom-1 left-0 rounded-full bg-primary/15 shadow-[inset_0_0_0_1px_oklch(var(--glow)/0.35),0_0_24px_-4px_oklch(var(--glow)/0.6)] transition-[translate,width] duration-500 ease-[cubic-bezier(0.2,0.8,0.2,1)]", u = "relative z-10 cursor-pointer disabled:cursor-not-allowed rounded-full px-3.5 py-1.5 text-sm whitespace-nowrap outline-hidden transition-[color] duration-300 select-none focus-visible:ring-2 focus-visible:ring-ring/40 text-muted-foreground hover:text-foreground aria-[current=page]:text-foreground aria-selected:text-foreground", d = "glow-border flex w-full items-center gap-1.5 h-10 rounded-lg border [--glow-border-color:oklch(var(--glow)/0.22)] bg-tint/[0.035] px-3 text-sm text-foreground shadow-[inset_0_1px_0_hsl(0_0%_100%/0.04)] transition-[border-color,background-color,box-shadow,--glow-border-color] duration-200 placeholder:text-muted-foreground hover:[--glow-border-color:oklch(var(--glow)/0.4)] focus-within:border-glow/60 focus-within:[--glow-border-color:transparent] focus-within:bg-tint/[0.05] focus-within:shadow-[0_0_0_3px_oklch(var(--glow)/0.16),0_0_24px_-6px_oklch(var(--glow)/0.6)] focus-within:outline-hidden disabled:cursor-not-allowed disabled:opacity-50";
|
|
5
5
|
//#endregion
|
|
6
|
-
export { t as FIELD,
|
|
6
|
+
export { t as FIELD, d as FIELD_WITHIN, r as PICKER_MONTH, i as PICKER_MONTH_ON, n as PICKER_NAV, u as PILL, l as PILL_INDICATOR, c as PILL_TRACK, s as POPUP, o as TRIGGER, a as TRIGGER_OPEN };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the water ready before a switch, e.g. when the pointer or focus reaches
|
|
3
|
+
* the button: its shader is compiled and drawn once, off the page. The GPU
|
|
4
|
+
* driver otherwise finishes that work on the first frame of the first switch,
|
|
5
|
+
* which then hitches.
|
|
6
|
+
*/
|
|
7
|
+
export declare function prepareThemeWave(): void;
|
|
8
|
+
/**
|
|
9
|
+
* Changes the theme (`change` swaps the classes or variables) like a drop
|
|
10
|
+
* falling into water at `from` (an element's centre, or a point; the screen's
|
|
11
|
+
* centre by default). Into a light theme, the new theme spreads in a wavy
|
|
12
|
+
* ring; into a dark one, the old theme is pulled into the point. Ripples trail the ring's edge, glinting in the
|
|
13
|
+
* theme's glow colours, and the edge shimmers like a soap film. The water is
|
|
14
|
+
* drawn on the GPU, over the page, which itself doesn't bend. Without a GPU
|
|
15
|
+
* (lite graphics, or no WebGL), without view transitions, or with reduced
|
|
16
|
+
* motion (the OS setting or html.reduce-motion), the theme just changes: drawn
|
|
17
|
+
* on the CPU, even a plain full-screen circle stutters. Call prepareThemeWave
|
|
18
|
+
* when the pointer or focus reaches the switch, so the first switch is smooth.
|
|
19
|
+
*/
|
|
20
|
+
export declare function themeWave(change: () => void, from?: Element | {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
} | null): void;
|
|
24
|
+
//# sourceMappingURL=theme-wave.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-wave.d.ts","sourceRoot":"","sources":["../../packages/utils/theme-wave.ts"],"names":[],"mappings":"AA+MA;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAIvC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,IAAI,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,IAAI,CA0HpG"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { applyGraphicsMode as e } from "./graphics.js";
|
|
3
|
+
import { oklchToLinearRgb as t } from "./theme.js";
|
|
4
|
+
//#region packages/utils/theme-wave.ts
|
|
5
|
+
var n = 1330, r = [
|
|
6
|
+
.25,
|
|
7
|
+
.55,
|
|
8
|
+
.35,
|
|
9
|
+
1
|
|
10
|
+
], i = 1050, a = [
|
|
11
|
+
.55,
|
|
12
|
+
0,
|
|
13
|
+
.85,
|
|
14
|
+
.35
|
|
15
|
+
], o = .05, s = 36, c = [
|
|
16
|
+
[
|
|
17
|
+
3,
|
|
18
|
+
1.9,
|
|
19
|
+
.5
|
|
20
|
+
],
|
|
21
|
+
[
|
|
22
|
+
5,
|
|
23
|
+
-2.7,
|
|
24
|
+
.3
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
8,
|
|
28
|
+
4.1,
|
|
29
|
+
.2
|
|
30
|
+
]
|
|
31
|
+
], l = 48, u = 72, d = "zen-theme-waving", f = "zen-theme-closing", p = "zen-theme-water", m = 0;
|
|
32
|
+
function h([e, t, n, r], i) {
|
|
33
|
+
let a = (e, t, n) => 3 * e * n * (1 - n) ** 2 + 3 * t * n ** 2 * (1 - n) + n ** 3, o = 0, s = 1;
|
|
34
|
+
for (let t = 0; t < 24; t++) {
|
|
35
|
+
let t = (o + s) / 2;
|
|
36
|
+
a(e, n, t) < i ? o = t : s = t;
|
|
37
|
+
}
|
|
38
|
+
return a(t, r, (o + s) / 2);
|
|
39
|
+
}
|
|
40
|
+
function g(e, t, n, r) {
|
|
41
|
+
return Math.min(s, o * t) * c.reduce((t, [i, a, o], s) => t + o * Math.sin(i * e + a * n + r * (s + 1)), 0);
|
|
42
|
+
}
|
|
43
|
+
var _ = `
|
|
44
|
+
precision highp float;
|
|
45
|
+
uniform vec2 res;
|
|
46
|
+
uniform float dpr;
|
|
47
|
+
uniform vec2 from;
|
|
48
|
+
uniform float time;
|
|
49
|
+
uniform float seed;
|
|
50
|
+
uniform float strength;
|
|
51
|
+
// 1 while the edge spreads out, -1 while it closes in.
|
|
52
|
+
uniform float dir;
|
|
53
|
+
uniform float edge;
|
|
54
|
+
uniform float prism;
|
|
55
|
+
uniform vec3 aurora[3];
|
|
56
|
+
uniform float light;
|
|
57
|
+
|
|
58
|
+
float wobble(float a, float r) {
|
|
59
|
+
float size = min(${s.toFixed(1)}, ${o.toFixed(3)} * r);
|
|
60
|
+
return size * (${c.map(([e, t, n], r) => `${n.toFixed(2)} * sin(${e.toFixed(1)} * a + ${t.toFixed(2)} * time + seed * ${(r + 1).toFixed(1)})`).join(" + ")});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// A train of ripples whose front is x px away (ahead of it when positive, as it moves):
|
|
64
|
+
// a steep front, crests fading out behind it, and running outwards through
|
|
65
|
+
// the train faster than it spreads, as on water.
|
|
66
|
+
float ripples(float x, float wavelength) {
|
|
67
|
+
float k = 6.2832 / wavelength;
|
|
68
|
+
float reach = x < 0.0 ? 2.5 * wavelength : 0.35 * wavelength;
|
|
69
|
+
return exp(-x * x / (2.0 * reach * reach)) * cos(k * x - 7.0 * time) / k;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
float height(vec2 p, float a) {
|
|
73
|
+
return strength * ripples(dir * (distance(p, from) - edge - wobble(a, edge)), 20.0 + 0.02 * edge);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Light from the top left. A glint off a surface of this slope, bent a little
|
|
77
|
+
// more or less for each colour, so glints split into a rainbow at their edges.
|
|
78
|
+
const vec3 LIGHT = vec3(-0.45, -0.55, 0.7);
|
|
79
|
+
float glint(vec2 slope, float bend) {
|
|
80
|
+
vec3 n = normalize(vec3(-slope * bend, 1.0));
|
|
81
|
+
vec3 mid = normalize(normalize(LIGHT) + vec3(0.0, 0.0, 1.0));
|
|
82
|
+
return max(0.0, pow(max(dot(n, mid), 0.0), 40.0) - pow(mid.z, 40.0));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
void main() {
|
|
86
|
+
vec2 p = vec2(gl_FragCoord.x, res.y - gl_FragCoord.y) / dpr;
|
|
87
|
+
vec2 v = p - from;
|
|
88
|
+
float a = atan(v.y, v.x);
|
|
89
|
+
float h = height(p, a);
|
|
90
|
+
vec2 slope = 0.9 * vec2(height(p + vec2(1.0, 0.0), a) - h, height(p + vec2(0.0, 1.0), a) - h);
|
|
91
|
+
|
|
92
|
+
// Aurora: the glow colours, drifting round the circle.
|
|
93
|
+
float hue = fract(a / 6.2832 + 0.15 * time + length(v) * 0.0008) * 3.0;
|
|
94
|
+
vec3 tint = hue < 1.0 ? mix(aurora[0], aurora[1], hue)
|
|
95
|
+
: hue < 2.0 ? mix(aurora[1], aurora[2], hue - 1.0)
|
|
96
|
+
: mix(aurora[2], aurora[0], hue - 2.0);
|
|
97
|
+
|
|
98
|
+
// How far from the edge (outside it when positive).
|
|
99
|
+
float e = length(v) - edge - wobble(a, edge);
|
|
100
|
+
// Iridescence, as on a soap film: the colour turns with the film's thickness,
|
|
101
|
+
// which swells and thins round the ring and over time, slowly, and in soft
|
|
102
|
+
// colours: nothing flickers, or flashes saturated colour (photosensitivity).
|
|
103
|
+
float film = 0.02 * e + 0.35 * sin(2.0 * a + 0.6 * time + seed) + 0.25 * sin(5.0 * a - 0.9 * time) + 0.25 * time;
|
|
104
|
+
vec3 sheen = mix(mix(tint, 0.5 + 0.5 * cos(6.2832 * (film + vec3(0.0, 0.33, 0.67))), 0.5), vec3(1.0), 0.2);
|
|
105
|
+
|
|
106
|
+
vec3 spark = vec3(glint(slope, 0.8), glint(slope, 1.0), glint(slope, 1.2));
|
|
107
|
+
// Slopes facing the light are lit, the others shaded.
|
|
108
|
+
float facing = dot(normalize(vec3(-slope, 1.0)), normalize(LIGHT)) - normalize(LIGHT).z;
|
|
109
|
+
vec3 color = 1.6 * spark * mix(vec3(1.0), mix(tint, sheen, 0.6), mix(0.4, 0.85, light)) + 0.6 * max(facing, 0.0) * tint;
|
|
110
|
+
float shade = mix(0.7, 0.45, light) * max(-facing, 0.0);
|
|
111
|
+
|
|
112
|
+
// The edge: a band of sheen with a bright core, and the aurora trailing behind.
|
|
113
|
+
color += prism * (0.9 * sheen * exp(-e * e / 160.0) + 0.5 * exp(-e * e / 6.0));
|
|
114
|
+
color += prism * 0.45 * tint * exp(-(e + 28.0 * dir) * (e + 28.0 * dir) / 1800.0);
|
|
115
|
+
|
|
116
|
+
color = clamp(color, 0.0, 1.0);
|
|
117
|
+
float cover = max(color.r, max(color.g, color.b));
|
|
118
|
+
gl_FragColor = vec4(color, cover + shade * (1.0 - cover));
|
|
119
|
+
}`, v = "attribute vec2 at; void main() { gl_Position = vec4(at, 0.0, 1.0); }", y;
|
|
120
|
+
function b() {
|
|
121
|
+
if (y !== void 0) return y;
|
|
122
|
+
y = null;
|
|
123
|
+
let e = document.createElement("canvas");
|
|
124
|
+
e.setAttribute("aria-hidden", "true"), e.style.cssText = `position:fixed;inset:0;width:100%;height:100%;pointer-events:none;z-index:2147483647;view-transition-name:${p}`;
|
|
125
|
+
let t = e.getContext("webgl", {
|
|
126
|
+
premultipliedAlpha: !0,
|
|
127
|
+
antialias: !1
|
|
128
|
+
}), n = t?.createProgram();
|
|
129
|
+
if (!t || !n) return null;
|
|
130
|
+
for (let [e, r] of [[t.VERTEX_SHADER, v], [t.FRAGMENT_SHADER, _]]) {
|
|
131
|
+
let i = t.createShader(e);
|
|
132
|
+
if (!i) return null;
|
|
133
|
+
t.shaderSource(i, r), t.compileShader(i), t.attachShader(n, i);
|
|
134
|
+
}
|
|
135
|
+
if (t.bindAttribLocation(n, 0, "at"), t.linkProgram(n), !t.getProgramParameter(n, t.LINK_STATUS)) return null;
|
|
136
|
+
t.useProgram(n), t.bindBuffer(t.ARRAY_BUFFER, t.createBuffer()), t.bufferData(t.ARRAY_BUFFER, new Float32Array([
|
|
137
|
+
-1,
|
|
138
|
+
-1,
|
|
139
|
+
3,
|
|
140
|
+
-1,
|
|
141
|
+
-1,
|
|
142
|
+
3
|
|
143
|
+
]), t.STATIC_DRAW), t.enableVertexAttribArray(0), t.vertexAttribPointer(0, 2, t.FLOAT, !1, 0, 0);
|
|
144
|
+
let r = /* @__PURE__ */ new Map();
|
|
145
|
+
return y = {
|
|
146
|
+
canvas: e,
|
|
147
|
+
gl: t,
|
|
148
|
+
uniform: (e) => (r.has(e) || r.set(e, t.getUniformLocation(n, e)), r.get(e))
|
|
149
|
+
}, y;
|
|
150
|
+
}
|
|
151
|
+
function x(e) {
|
|
152
|
+
e.gl.clear(e.gl.COLOR_BUFFER_BIT), e.canvas.remove();
|
|
153
|
+
}
|
|
154
|
+
function S(e) {
|
|
155
|
+
return t(e).map((e) => e <= .0031308 ? 12.92 * e : 1.055 * e ** (1 / 2.4) - .055);
|
|
156
|
+
}
|
|
157
|
+
function C() {
|
|
158
|
+
return !(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches || document.documentElement.classList.contains("reduce-motion")) && !!document.startViewTransition && e() !== "lite";
|
|
159
|
+
}
|
|
160
|
+
function w() {
|
|
161
|
+
if (y !== void 0 || !C()) return;
|
|
162
|
+
let e = b();
|
|
163
|
+
e?.gl.drawArrays(e.gl.TRIANGLES, 0, 3);
|
|
164
|
+
}
|
|
165
|
+
function T(e, t) {
|
|
166
|
+
let o = document.documentElement, c = C() ? b() : null;
|
|
167
|
+
if (!c) {
|
|
168
|
+
e();
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
let p = window.innerWidth, _ = window.innerHeight, v = p / 2, y = _ / 2;
|
|
172
|
+
if (t instanceof Element) {
|
|
173
|
+
let e = t.getBoundingClientRect();
|
|
174
|
+
v = e.left + e.width / 2, y = e.top + e.height / 2;
|
|
175
|
+
} else t && ({x: v, y} = t);
|
|
176
|
+
let w = Math.hypot(Math.max(v, p - v), Math.max(y, _ - y)), T = Math.random() * 2 * Math.PI, E = w + s + 2, D = ++m;
|
|
177
|
+
x(c), o.classList.add(d);
|
|
178
|
+
let O = [], k = !1, A = document.startViewTransition(() => {
|
|
179
|
+
e();
|
|
180
|
+
let t = getComputedStyle(o);
|
|
181
|
+
k = Number(t.getPropertyValue("--background").trim().split(" ")[0]) <= .5, o.classList.toggle(f, k);
|
|
182
|
+
let n = t.getPropertyValue("--glow").trim(), [r, i, a] = n.split(" ").map(Number);
|
|
183
|
+
O = [
|
|
184
|
+
n,
|
|
185
|
+
t.getPropertyValue("--glow-2").trim(),
|
|
186
|
+
`${r} ${i} ${(a + 240) % 360}`
|
|
187
|
+
].flatMap(S), document.body.append(c.canvas);
|
|
188
|
+
});
|
|
189
|
+
A.ready.then(() => {
|
|
190
|
+
let e = k ? i : n, t = (e) => (k ? 1 - h(a, e) : h(r, e)) * E, s = k ? "::view-transition-old(root)" : "::view-transition-new(root)", d = (n) => {
|
|
191
|
+
let r = t(n), i = n * e / 1e3;
|
|
192
|
+
return `polygon(${Array.from({ length: u }, (e, t) => {
|
|
193
|
+
let n = t / u * 2 * Math.PI, a = Math.max(0, r + g(n, r, i, T));
|
|
194
|
+
return `${(v + a * Math.cos(n)).toFixed(1)}px ${(y + a * Math.sin(n)).toFixed(1)}px`;
|
|
195
|
+
}).join(",")})`;
|
|
196
|
+
}, f = Array.from({ length: 49 }, (e, t) => ({
|
|
197
|
+
clipPath: d(t / l),
|
|
198
|
+
offset: t / l
|
|
199
|
+
})), b = o.animate(f, {
|
|
200
|
+
duration: e,
|
|
201
|
+
pseudoElement: s,
|
|
202
|
+
fill: "forwards"
|
|
203
|
+
});
|
|
204
|
+
A.finished.finally(() => b.cancel());
|
|
205
|
+
let { canvas: S, gl: C, uniform: w } = c, j = Math.min(window.devicePixelRatio || 1, 2);
|
|
206
|
+
S.width = Math.round(p * j), S.height = Math.round(_ * j), C.viewport(0, 0, S.width, S.height), C.uniform2f(w("res"), S.width, S.height), C.uniform1f(w("dpr"), j), C.uniform2f(w("from"), v, y), C.uniform1f(w("seed"), T), C.uniform3fv(w("aurora[0]"), O), C.uniform1f(w("light"), +!k);
|
|
207
|
+
let M = (e) => (1 - Math.exp(-e * 14)) * (1 - e) ** 1.5, N = () => {
|
|
208
|
+
if (D !== m) return;
|
|
209
|
+
if (b.playState === "finished") return x(c);
|
|
210
|
+
let n = Math.min(1, Number(b.currentTime ?? 0) / e), r = t(n), i = Math.min(1, (1 - n) / .12), a, o;
|
|
211
|
+
k ? (a = 1.6 * n * Math.sqrt(1 - n) * i, o = Math.min(1, n * 4) * Math.min(1, r / 24) * i) : (a = M(n) * i, o = Math.min(1, r / 40) * (1 - n ** 3) * i), C.uniform1f(w("time"), n * e / 1e3), C.uniform1f(w("edge"), r), C.uniform1f(w("dir"), k ? -1 : 1), C.uniform1f(w("strength"), a), C.uniform1f(w("prism"), o), C.drawArrays(C.TRIANGLES, 0, 3), requestAnimationFrame(N);
|
|
212
|
+
};
|
|
213
|
+
N();
|
|
214
|
+
}).catch(() => {}), A.finished.finally(() => {
|
|
215
|
+
D === m && (o.classList.remove(d, f), x(c));
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
//#endregion
|
|
219
|
+
export { w as prepareThemeWave, T as themeWave };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type to jump, as in a native list: keys typed quickly in a row search
|
|
3
|
+
* together. Returns what's been typed so far (lower case) when the key is a
|
|
4
|
+
* letter or digit, else null; match it against the start of each item's label.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useTypeahead(): (e: {
|
|
7
|
+
key: string;
|
|
8
|
+
ctrlKey: boolean;
|
|
9
|
+
metaKey: boolean;
|
|
10
|
+
altKey: boolean;
|
|
11
|
+
}) => string | null;
|
|
12
|
+
//# sourceMappingURL=typeahead.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeahead.d.ts","sourceRoot":"","sources":["../../packages/utils/typeahead.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,CAAC,CAAC,EAAE;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACnB,KAAK,MAAM,GAAG,IAAI,CASlB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef as e } from "react";
|
|
3
|
+
//#region packages/utils/typeahead.ts
|
|
4
|
+
function t() {
|
|
5
|
+
let t = e({
|
|
6
|
+
text: "",
|
|
7
|
+
at: 0
|
|
8
|
+
});
|
|
9
|
+
return (e) => {
|
|
10
|
+
if (e.key.length !== 1 || e.ctrlKey || e.metaKey || e.altKey) return null;
|
|
11
|
+
let n = Date.now(), r = (n - t.current.at < 700 ? t.current.text : "") + e.key.toLowerCase();
|
|
12
|
+
return t.current = {
|
|
13
|
+
text: r,
|
|
14
|
+
at: n
|
|
15
|
+
}, r;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { t as useTypeahead };
|