@kapiuara/ui 0.10.0 → 0.12.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 +10 -5
- package/dist/components/data/KapiBarChart.d.ts +93 -0
- package/dist/components/data/KapiBarChart.js +88 -0
- package/dist/components/data/KapiEventCalendar.d.ts +70 -0
- package/dist/components/data/KapiEventCalendar.js +225 -0
- package/dist/components/data/KapiHeatmap.d.ts +62 -0
- package/dist/components/data/KapiHeatmap.js +120 -0
- package/dist/components/data/KapiLineChart.d.ts +59 -0
- package/dist/components/data/KapiLineChart.js +106 -0
- package/dist/components/data/KapiPaginationFooter.js +1 -0
- package/dist/components/data/KapiSparkline.d.ts +41 -0
- package/dist/components/data/KapiSparkline.js +55 -0
- package/dist/components/data/KapiTable.d.ts +25 -2
- package/dist/components/data/KapiTable.js +371 -359
- package/dist/components/data/barChartLogic.d.ts +59 -0
- package/dist/components/data/barChartLogic.js +53 -0
- package/dist/components/data/chartFrame.d.ts +112 -0
- package/dist/components/data/chartFrame.js +89 -0
- package/dist/components/data/eventCalendarLogic.d.ts +70 -0
- package/dist/components/data/eventCalendarLogic.js +45 -0
- package/dist/components/data/heatmapLogic.d.ts +15 -0
- package/dist/components/data/heatmapLogic.js +15 -0
- package/dist/components/data/index.d.ts +20 -1
- package/dist/components/data/lineChartLogic.d.ts +30 -0
- package/dist/components/data/lineChartLogic.js +21 -0
- package/dist/components/data/sparklineLogic.d.ts +28 -0
- package/dist/components/data/sparklineLogic.js +18 -0
- package/dist/components/display/KapiStat.d.ts +1 -1
- package/dist/components/inputs/KapiDatePicker.d.ts +8 -2
- package/dist/components/inputs/KapiDatePicker.js +120 -106
- package/dist/components/inputs/KapiDateRangePicker.d.ts +26 -5
- package/dist/components/inputs/KapiDateRangePicker.js +146 -111
- package/dist/components/inputs/KapiFacetedSearch.d.ts +9 -2
- package/dist/components/inputs/KapiFacetedSearch.js +3 -3
- package/dist/components/inputs/KapiSearchChip.d.ts +79 -0
- package/dist/components/inputs/KapiSearchChip.js +73 -0
- package/dist/components/inputs/datePickerLogic.d.ts +9 -0
- package/dist/components/inputs/datePickerLogic.js +25 -25
- package/dist/components/inputs/dateRangeLogic.d.ts +23 -4
- package/dist/components/inputs/dateRangeLogic.js +48 -22
- package/dist/components/inputs/facetedSearchLogic.d.ts +1 -1
- package/dist/components/inputs/index.d.ts +2 -0
- package/dist/components/inputs/searchChipLogic.d.ts +33 -0
- package/dist/components/inputs/searchChipLogic.js +13 -0
- package/dist/components/labelsLogic.d.ts +11 -1
- package/dist/components/layout/KapiContextSlot.js +108 -88
- package/dist/components/layout/KapiMasonry.d.ts +30 -0
- package/dist/components/layout/KapiMasonry.js +33 -0
- package/dist/components/layout/KapiPageHeader.js +89 -71
- package/dist/components/layout/KapiRail.d.ts +8 -2
- package/dist/components/layout/KapiRail.js +118 -67
- package/dist/components/layout/KapiShell.js +67 -37
- package/dist/components/layout/index.d.ts +2 -0
- package/dist/components/layout/masonryLogic.d.ts +40 -0
- package/dist/components/layout/masonryLogic.js +8 -0
- package/dist/components/layout/railLogic.d.ts +41 -1
- package/dist/components/layout/railLogic.js +36 -4
- package/dist/components/layout/reopenBus.d.ts +53 -0
- package/dist/components/layout/reopenBus.js +6 -0
- package/dist/components/layout/useMasonrySpans.d.ts +32 -0
- package/dist/components/layout/useMasonrySpans.js +44 -0
- package/dist/components/layout/useRailOverflow.d.ts +17 -0
- package/dist/components/layout/useRailOverflow.js +41 -0
- package/dist/components/locale/labelRegistry.d.ts +12 -1
- package/dist/components/navigation/KapiFilterChips.js +1 -1
- package/dist/components/navigation/filterChipsLogic.d.ts +7 -1
- package/dist/components/navigation/filterChipsLogic.js +3 -3
- package/dist/components/overlays/KapiConfirm.d.ts +14 -2
- package/dist/components/overlays/KapiConfirm.js +2 -2
- package/dist/components/overlays/KapiContextMenu.d.ts +3 -0
- package/dist/components/overlays/KapiContextMenu.js +2 -1
- package/dist/components/overlays/KapiDropdown.d.ts +3 -1
- package/dist/components/overlays/KapiDropdown.js +29 -26
- package/dist/components/overlays/KapiMenuButton.js +1 -0
- package/dist/components/overlays/KapiOffcanvasStack.d.ts +2 -2
- package/dist/hooks/breakpointOpenLogic.d.ts +20 -5
- package/dist/hooks/breakpointOpenLogic.js +2 -2
- package/dist/hooks/dataColorLogic.d.ts +23 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/numberFormatLogic.d.ts +7 -0
- package/dist/hooks/numberFormatLogic.js +5 -2
- package/dist/hooks/seriesPaletteLogic.d.ts +24 -0
- package/dist/hooks/themeContrastLogic.js +1 -0
- package/dist/hooks/themeDeriveLogic.d.ts +8 -0
- package/dist/hooks/themeDeriveLogic.js +4 -2
- package/dist/hooks/useKapiTheme.js +27 -27
- package/dist/hooks/useMediaQuery.d.ts +7 -0
- package/dist/hooks/useMediaQuery.js +4 -4
- package/dist/index.js +149 -137
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/package.json +2 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
//#region src/hooks/breakpointOpenLogic.ts
|
|
2
|
-
var e = (e, t, n) => e === t ? null :
|
|
2
|
+
var e = (e, t) => e ? "mobile" : t ? "narrow" : "wide", t = (e, t, n) => e === t ? null : t === "wide" && n;
|
|
3
3
|
//#endregion
|
|
4
|
-
export { e as
|
|
4
|
+
export { t as openOnZoneCross, e as shellZone };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { KapiRgbColor } from "./colorLogic";
|
|
2
|
+
/** A color in OKLab: `l` 0-1 on the lightness axis, `a`/`b` the opponent axes around 0. */
|
|
3
|
+
export type KapiOklab = {
|
|
4
|
+
/** Perceptual lightness, 0 (black) to 1 (white). */
|
|
5
|
+
l: number;
|
|
6
|
+
/** Green (negative) to red (positive). */
|
|
7
|
+
a: number;
|
|
8
|
+
/** Blue (negative) to yellow (positive). */
|
|
9
|
+
b: number;
|
|
10
|
+
};
|
|
11
|
+
/** The three dichromacies the palette gate simulates. */
|
|
12
|
+
export type KapiCvdKind = "protan" | "deutan" | "tritan";
|
|
13
|
+
/** Converts an sRGB color to OKLab. Alpha is ignored: flatten it over its background first. */
|
|
14
|
+
export declare const toOklab: (color: KapiRgbColor) => KapiOklab;
|
|
15
|
+
/**
|
|
16
|
+
* How a color is seen with one of the three dichromacies, back in sRGB. For a distance use
|
|
17
|
+
* `cvdDeltaE`, which stays in linear space and does not pay the rounding of this round trip.
|
|
18
|
+
*/
|
|
19
|
+
export declare const simulateCvd: (color: KapiRgbColor, kind: KapiCvdKind) => KapiRgbColor;
|
|
20
|
+
/** Euclidean distance in OKLab, ×100: the scale the palette thresholds are written in. */
|
|
21
|
+
export declare const oklabDeltaE: (a: KapiRgbColor, b: KapiRgbColor) => number;
|
|
22
|
+
/** `oklabDeltaE` as seen with one of the three dichromacies. */
|
|
23
|
+
export declare const cvdDeltaE: (a: KapiRgbColor, b: KapiRgbColor, kind: KapiCvdKind) => number;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { useUnsavedGuard, unsavedGuardHandler, DEFAULT_UNSAVED_GUARD_LABELS } fr
|
|
|
10
10
|
export type { BeforeUnloadLike as KapiBeforeUnloadLike, UnsavedGuard as KapiUnsavedGuard, UnsavedGuardDialogProps as KapiUnsavedGuardDialogProps, UnsavedGuardLabels as KapiUnsavedGuardLabels, UnsavedGuardOptions as KapiUnsavedGuardOptions } from "./useUnsavedGuard";
|
|
11
11
|
export { KAPI_ROOT_SELECTOR, resolveKapiRoot, useKapiRoot } from "./kapiRoot";
|
|
12
12
|
export { REDUCED_MOTION_QUERY, prefersReducedMotion } from "./reducedMotion";
|
|
13
|
-
export { SHELL_MOBILE_QUERY, matchesQuery, useMediaQuery } from "./useMediaQuery";
|
|
13
|
+
export { SHELL_MOBILE_QUERY, SHELL_NARROW_QUERY, matchesQuery, useMediaQuery } from "./useMediaQuery";
|
|
14
14
|
export { useWheelZoom } from "./useWheelZoom";
|
|
15
15
|
export type { UseWheelZoomOptions } from "./useWheelZoom";
|
|
16
16
|
export { useHotkey } from "./useHotkey";
|
|
@@ -4,3 +4,10 @@
|
|
|
4
4
|
* decimals into a badge. `NaN` or infinite → "" (the caller renders nothing rather than "NaN").
|
|
5
5
|
*/
|
|
6
6
|
export declare const formatCount: (value: number, locale?: string) => string;
|
|
7
|
+
/**
|
|
8
|
+
* A data value shown in full, for a table cell or a readout: `1240` → "1240" and `1240000` →
|
|
9
|
+
* "1.240.000", keeping up to three decimals. It is NOT the axis formatter: an axis abbreviates
|
|
10
|
+
* (`1,2 k`) because a label competes for room, while a table is where the exact number is read.
|
|
11
|
+
* `NaN` or infinite → "" (the caller renders nothing rather than "NaN").
|
|
12
|
+
*/
|
|
13
|
+
export declare const formatDataValue: (value: number, locale?: string) => string;
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
var e = /* @__PURE__ */ new Map(), t = (t) => {
|
|
3
3
|
let n = e.get(t);
|
|
4
4
|
return n || (n = new Intl.NumberFormat(t, { maximumFractionDigits: 0 }), e.set(t, n)), n;
|
|
5
|
-
}, n = (e, n = "es") => Number.isFinite(e) ? t(n).format(Math.round(e)) : ""
|
|
5
|
+
}, n = (e, n = "es") => Number.isFinite(e) ? t(n).format(Math.round(e)) : "", r = /* @__PURE__ */ new Map(), i = (e) => {
|
|
6
|
+
let t = r.get(e);
|
|
7
|
+
return t || (t = new Intl.NumberFormat(e, { maximumFractionDigits: 3 }), r.set(e, t)), t;
|
|
8
|
+
}, a = (e, t = "es") => Number.isFinite(e) ? i(t).format(e) : "";
|
|
6
9
|
//#endregion
|
|
7
|
-
export { n as formatCount };
|
|
10
|
+
export { n as formatCount, a as formatDataValue };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { KapiRgbColor } from "./colorLogic";
|
|
2
|
+
/** Which theme a palette is being judged in: each one has its own lightness band. */
|
|
3
|
+
export type KapiPaletteTheme = "light" | "dark";
|
|
4
|
+
/** One rule a palette broke, named so the message can point at the slot. */
|
|
5
|
+
export type KapiPaletteIssue = {
|
|
6
|
+
/** The rule that failed. */
|
|
7
|
+
check: "cvd" | "normal" | "band" | "chroma" | "duplicate" | "monotone" | "step" | "hue";
|
|
8
|
+
/** Human-readable detail: which slots, and by how much. */
|
|
9
|
+
detail: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const PALETTE_CVD_FLOOR = 8;
|
|
12
|
+
export declare const PALETTE_NORMAL_FLOOR = 15;
|
|
13
|
+
export declare const PALETTE_CHROMA_FLOOR = 0.1;
|
|
14
|
+
export declare const PALETTE_BAND: Record<KapiPaletteTheme, readonly [number, number]>;
|
|
15
|
+
export declare const RAMP_MIN_DELTA_L = 0.06;
|
|
16
|
+
export declare const RAMP_MAX_HUE_SPREAD = 30;
|
|
17
|
+
/** The worst of protanopia and deutanopia for one pair: the number the floor applies to. */
|
|
18
|
+
export declare const enforcedCvdDeltaE: (a: KapiRgbColor, b: KapiRgbColor) => number;
|
|
19
|
+
/** Smallest tritanopia ΔE over the adjacent pairs. Informational: it does not fail a palette. */
|
|
20
|
+
export declare const tritanFloor: (colors: readonly KapiRgbColor[]) => number;
|
|
21
|
+
/** Every rule a categorical palette breaks, in slot order. Empty means it passes. */
|
|
22
|
+
export declare const checkSeriesPalette: (colors: readonly KapiRgbColor[], theme: KapiPaletteTheme) => KapiPaletteIssue[];
|
|
23
|
+
/** Every rule a sequential ramp breaks, in step order. Empty means it passes. */
|
|
24
|
+
export declare const checkSequentialRamp: (colors: readonly KapiRgbColor[]) => KapiPaletteIssue[];
|
|
@@ -25,6 +25,7 @@ var n = 4.5, r = [
|
|
|
25
25
|
...e === "primary" ? [] : [[`--kapi-${e}`, `--kapi-${e}-bg`]]
|
|
26
26
|
]),
|
|
27
27
|
...[...a, "neutral"].map((e) => [`--kapi-${e}-fg`, `--kapi-${e}`]),
|
|
28
|
+
["--kapi-primary-ink", "--kapi-primary-bg"],
|
|
28
29
|
["--kapi-neutral", "--kapi-card"],
|
|
29
30
|
["--kapi-tip-fg", "--kapi-tip-bg"]
|
|
30
31
|
], s = (r, i = {}) => {
|
|
@@ -41,7 +41,15 @@ export type KapiCustomTheme = {
|
|
|
41
41
|
colors: KapiThemeColors;
|
|
42
42
|
/** The radius knobs; an unset or invalid one leaves its whole tier at the base theme's values. */
|
|
43
43
|
radii?: KapiThemeRadii | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* The categorical data palette, slot by slot, at most `SERIES_SLOTS` entries. Leave it out and
|
|
46
|
+
* slot 1 still follows the brand, because the base theme spells it `var(--kapi-primary)`; this
|
|
47
|
+
* is for taking over the rest. Order is meaning here: series N is always slot N.
|
|
48
|
+
*/
|
|
49
|
+
series?: readonly string[] | undefined;
|
|
44
50
|
};
|
|
51
|
+
/** How many categorical slots the palette has. A ninth series folds into "other", never a new hue. */
|
|
52
|
+
export declare const SERIES_SLOTS = 8;
|
|
45
53
|
/** A px length such as `10px` or `999px`: what the `control`, `box` and `surface` knobs accept. */
|
|
46
54
|
export declare const RADIUS_PX_PATTERN: RegExp;
|
|
47
55
|
/** A px length or a percentage such as `32%`: what the `squircle` knob accepts. */
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { contrastRatio as e, formatHex as t, mixColors as n, parseColor as r, readableForeground as i } from "./colorLogic.js";
|
|
2
|
-
//#region src/hooks/themeDeriveLogic.ts
|
|
3
2
|
var a = /^\d+(\.\d+)?px$/, o = /^\d+(\.\d+)?(px|%)$/, s = {
|
|
4
3
|
"--kapi-radius-xs": .6,
|
|
5
4
|
"--kapi-radius-inner": .7,
|
|
@@ -126,7 +125,10 @@ var a = /^\d+(\.\d+)?px$/, o = /^\d+(\.\d+)?(px|%)$/, s = {
|
|
|
126
125
|
strong: .6,
|
|
127
126
|
edge: .06
|
|
128
127
|
};
|
|
129
|
-
return l.has("ink") && !o && (s["--kapi-scrim"] = S(F, I.base), s["--kapi-scrim-soft"] = S(F, I.soft), s["--kapi-scrim-tour"] = S(F, I.tour), s["--kapi-scrim-drawer"] = S(F, I.drawer), s["--kapi-scrim-cmdk"] = S(F, I.cmdk), s["--kapi-scrim-strong"] = S(F, I.strong), s["--kapi-edge-shade"] = S(F, I.edge)),
|
|
128
|
+
return l.has("ink") && !o && (s["--kapi-scrim"] = S(F, I.base), s["--kapi-scrim-soft"] = S(F, I.soft), s["--kapi-scrim-tour"] = S(F, I.tour), s["--kapi-scrim-drawer"] = S(F, I.drawer), s["--kapi-scrim-cmdk"] = S(F, I.cmdk), s["--kapi-scrim-strong"] = S(F, I.strong), s["--kapi-edge-shade"] = S(F, I.edge)), e.series?.slice(0, 8).forEach((e, n) => {
|
|
129
|
+
let i = r(e);
|
|
130
|
+
i && (s[`--kapi-series-${n + 1}`] = t(i));
|
|
131
|
+
}), s;
|
|
130
132
|
};
|
|
131
133
|
//#endregion
|
|
132
134
|
export { a as RADIUS_PX_PATTERN, o as RADIUS_SHAPE_PATTERN, C as deriveTheme };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { parseColor as e } from "./colorLogic.js";
|
|
3
|
+
import { deriveTheme as t } from "./themeDeriveLogic.js";
|
|
4
|
+
import { defaultStorage as n, readWithLegacy as r, storageKey as i } from "./storageLogic.js";
|
|
5
|
+
import { useMediaQuery as a } from "./useMediaQuery.js";
|
|
6
6
|
import { NO_THEME_COLORS as o, mergeThemeColors as s, parseStoredThemeColors as c, sanitizeThemeColors as l, serializeThemeColors as u } from "./themeColorsLogic.js";
|
|
7
7
|
import { NO_THEME_RADII as d, mergeThemeRadii as f, parseStoredThemeRadii as p, sanitizeThemeRadii as m, serializeThemeRadii as h } from "./themeRadiiLogic.js";
|
|
8
8
|
import { createContext as g, useCallback as _, useContext as v, useEffect as y, useMemo as b, useState as x } from "react";
|
|
9
9
|
//#region src/hooks/useKapiTheme.ts
|
|
10
10
|
var S = "(prefers-color-scheme: dark)", C = (e) => ({
|
|
11
|
-
theme:
|
|
12
|
-
accent:
|
|
13
|
-
font:
|
|
14
|
-
motion:
|
|
15
|
-
customTheme:
|
|
16
|
-
radii:
|
|
11
|
+
theme: i(e, "theme"),
|
|
12
|
+
accent: i(e, "accent"),
|
|
13
|
+
font: i(e, "font"),
|
|
14
|
+
motion: i(e, "motion"),
|
|
15
|
+
customTheme: i(e, "customTheme"),
|
|
16
|
+
radii: i(e, "radii")
|
|
17
17
|
}), w = {
|
|
18
18
|
theme: "v2_theme",
|
|
19
19
|
accent: "v2_accent",
|
|
@@ -25,24 +25,24 @@ var T = {
|
|
|
25
25
|
nunito: "'Nunito Variable', 'Nunito', system-ui, sans-serif",
|
|
26
26
|
roboto: "'Roboto', system-ui, sans-serif",
|
|
27
27
|
system: "system-ui, -apple-system, 'Segoe UI', sans-serif"
|
|
28
|
-
}, E = (
|
|
28
|
+
}, E = (e, t, i) => r(n(), C(e)[t], w[t]) || i, D = (e, t) => {
|
|
29
29
|
try {
|
|
30
30
|
localStorage.setItem(e, t);
|
|
31
31
|
} catch {}
|
|
32
32
|
}, O = (e) => e === "light" || e === "dark", k = (e) => O(e) || e === "system", A = (e, t) => e === "system" ? t ? "dark" : "light" : e, j = (e) => {
|
|
33
33
|
let t = E(e, "theme", "light");
|
|
34
34
|
return k(t) ? t : "light";
|
|
35
|
-
}, M = (e) => e === "dark" ? "light" : "dark", N = (e) => e in T, P = (e) => e === "auto" || e === "reduced", F = (
|
|
36
|
-
let
|
|
37
|
-
...
|
|
35
|
+
}, M = (e) => e === "dark" ? "light" : "dark", N = (e) => e in T, P = (e) => e === "auto" || e === "reduced", F = (n, r) => {
|
|
36
|
+
let i = n.fontChosen && r ? {
|
|
37
|
+
...r,
|
|
38
38
|
font: void 0
|
|
39
|
-
} :
|
|
40
|
-
return o && delete
|
|
41
|
-
"--kapi-font": T[
|
|
42
|
-
...
|
|
43
|
-
base:
|
|
44
|
-
colors:
|
|
45
|
-
radii: f(
|
|
39
|
+
} : r, a = s(i, n.accent ? { primary: n.accent } : null, n.customTheme), o = a.primary && !e(a.primary) ? a.primary : void 0;
|
|
40
|
+
return o && delete a.primary, {
|
|
41
|
+
"--kapi-font": T[n.font] ?? T.nunito,
|
|
42
|
+
...t({
|
|
43
|
+
base: n.theme ?? "light",
|
|
44
|
+
colors: a,
|
|
45
|
+
radii: f(n.radii)
|
|
46
46
|
}),
|
|
47
47
|
...o ? { "--kapi-primary": o } : {}
|
|
48
48
|
};
|
|
@@ -65,7 +65,7 @@ var T = {
|
|
|
65
65
|
setMotion: () => {},
|
|
66
66
|
toggleMotion: () => {}
|
|
67
67
|
}), L = ({ namespace: e } = {}) => {
|
|
68
|
-
let t = b(() => C(e), [e]), [n,
|
|
68
|
+
let t = b(() => C(e), [e]), [n, r] = x(() => j(e)), i = A(n, a(S)), [o, s] = x(() => E(e, "accent", "")), [d, f] = x(() => c(E(e, "customTheme", ""))), [g, v] = x(() => p(E(e, "radii", ""))), [w, T] = x(() => N(E(e, "font", ""))), [O, k] = x(() => {
|
|
69
69
|
let t = E(e, "font", "nunito");
|
|
70
70
|
return N(t) ? t : "nunito";
|
|
71
71
|
}), [F, I] = x(() => {
|
|
@@ -73,7 +73,7 @@ var T = {
|
|
|
73
73
|
return P(t) ? t : "auto";
|
|
74
74
|
}), [L, R] = x(e);
|
|
75
75
|
if (L !== e) {
|
|
76
|
-
R(e),
|
|
76
|
+
R(e), r(j(e)), s(E(e, "accent", "")), f(c(E(e, "customTheme", ""))), v(p(E(e, "radii", "")));
|
|
77
77
|
let t = E(e, "font", "nunito");
|
|
78
78
|
k(N(t) ? t : "nunito"), T(N(E(e, "font", "")));
|
|
79
79
|
let n = E(e, "motion", "auto");
|
|
@@ -86,11 +86,11 @@ var T = {
|
|
|
86
86
|
O,
|
|
87
87
|
w
|
|
88
88
|
]), y(() => D(t.motion, F), [t, F]);
|
|
89
|
-
let z = _(() =>
|
|
89
|
+
let z = _(() => r(M(i)), [i]), B = _((e) => r(e), []), V = _((e) => s(e || ""), []), H = _((e) => f(l(e)), []), U = _((e) => v(m(e)), []), W = _((e) => {
|
|
90
90
|
k(e), T(!0);
|
|
91
91
|
}, []), G = _(() => I((e) => e === "reduced" ? "auto" : "reduced"), []);
|
|
92
92
|
return b(() => ({
|
|
93
|
-
theme:
|
|
93
|
+
theme: i,
|
|
94
94
|
preference: n,
|
|
95
95
|
accent: o,
|
|
96
96
|
customTheme: d,
|
|
@@ -99,7 +99,7 @@ var T = {
|
|
|
99
99
|
fontChosen: w,
|
|
100
100
|
motion: F,
|
|
101
101
|
setTheme: B,
|
|
102
|
-
setPreference:
|
|
102
|
+
setPreference: r,
|
|
103
103
|
toggle: z,
|
|
104
104
|
setAccent: V,
|
|
105
105
|
setCustomTheme: H,
|
|
@@ -108,7 +108,7 @@ var T = {
|
|
|
108
108
|
setMotion: I,
|
|
109
109
|
toggleMotion: G
|
|
110
110
|
}), [
|
|
111
|
-
|
|
111
|
+
i,
|
|
112
112
|
n,
|
|
113
113
|
o,
|
|
114
114
|
d,
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
/** Breakpoint móvil del shell (mantener sincronizado con shell.css). */
|
|
2
2
|
export declare const SHELL_MOBILE_QUERY = "(max-width: 768px)";
|
|
3
|
+
/**
|
|
4
|
+
* Escritorio angosto: el rail sigue vertical pero el panel ya no entra cómodo. 1024 no es un
|
|
5
|
+
* número nuevo, es el breakpoint que la cáscara ya usa para su padding (`shell.css`). Medido con
|
|
6
|
+
* rail y panel abiertos, el contenido queda en 674px a 1024 contra 930 a 1280; plegando el panel
|
|
7
|
+
* a su riel de 44px recupera 214.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SHELL_NARROW_QUERY = "(max-width: 1024px)";
|
|
3
10
|
/** `matchMedia` seguro (SSR / jsdom sin matchMedia → false). */
|
|
4
11
|
export declare const matchesQuery: (query: string) => boolean;
|
|
5
12
|
/** true mientras el viewport cumple la media query. */
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useEffect as e, useState as t } from "react";
|
|
3
3
|
//#region src/hooks/useMediaQuery.ts
|
|
4
|
-
var n = "(max-width: 768px)", r = (e) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(e).matches,
|
|
5
|
-
let [
|
|
4
|
+
var n = "(max-width: 768px)", r = "(max-width: 1024px)", i = (e) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(e).matches, a = (n) => {
|
|
5
|
+
let [r, a] = t(() => i(n));
|
|
6
6
|
return e(() => {
|
|
7
7
|
if (typeof window.matchMedia != "function") return;
|
|
8
8
|
let e = window.matchMedia(n), t = () => a(e.matches);
|
|
9
9
|
return t(), e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
10
|
-
}, [n]),
|
|
10
|
+
}, [n]), r;
|
|
11
11
|
};
|
|
12
12
|
//#endregion
|
|
13
|
-
export { n as SHELL_MOBILE_QUERY, r as
|
|
13
|
+
export { n as SHELL_MOBILE_QUERY, r as SHELL_NARROW_QUERY, i as matchesQuery, a as useMediaQuery };
|