jenosize-ui 0.2.1 → 0.3.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 +183 -63
- package/THIRD-PARTY-NOTICES.md +15 -0
- package/dist/GradientPicker-CQm3GT7F.d.ts +144 -0
- package/dist/{PaymentInput-Dn5WVQVy.d.ts → PaymentInput-Cz5jFB3p.d.ts} +1 -1
- package/dist/{Select-Dt5ARIH8.d.ts → Select-CXOAMlk7.d.ts} +15 -1
- package/dist/{TagInput-BaBeve6L.d.ts → TagInput-CzIrONr-.d.ts} +1 -1
- package/dist/area-chart.d.ts +2 -2
- package/dist/area-chart.js +7 -6
- package/dist/at-least-one-BZ2dsck-.d.ts +18 -0
- package/dist/avatar.d.ts +1 -1
- package/dist/avatar.js +12 -11
- package/dist/badge.d.ts +1 -1
- package/dist/badge.js +6 -6
- package/dist/bar-chart.d.ts +2 -2
- package/dist/bar-chart.js +7 -6
- package/dist/breadcrumb.d.ts +1 -1
- package/dist/breadcrumb.js +4 -4
- package/dist/button.d.ts +1 -1
- package/dist/button.js +11 -10
- package/dist/calendar.d.ts +1 -1
- package/dist/calendar.js +16 -15
- package/dist/callout.d.ts +4 -2
- package/dist/callout.js +12 -11
- package/dist/card.d.ts +59 -3
- package/dist/card.js +4 -4
- package/dist/carousel.d.ts +169 -0
- package/dist/carousel.js +9 -0
- package/dist/catalog.json +11180 -0
- package/dist/checkbox.js +8 -7
- package/dist/{chunk-MVG5MABV.js → chunk-26XQU3TC.js} +8 -8
- package/dist/{chunk-X2X7Q7NW.js → chunk-2R3QWWOT.js} +3 -3
- package/dist/{chunk-AIARANKE.js → chunk-3JQKVC2K.js} +4 -4
- package/dist/chunk-3P3QZPHV.js +109 -0
- package/dist/{chunk-GLKFFA7N.js → chunk-44AWXIQK.js} +5 -5
- package/dist/{chunk-FWRHBMWT.js → chunk-4Y32RIC7.js} +5 -19
- package/dist/{chunk-5XPMY2LF.js → chunk-5ECTNYKU.js} +5 -5
- package/dist/{chunk-6B6BWTXC.js → chunk-5GBA6X6A.js} +5 -5
- package/dist/{chunk-UGKELBNC.js → chunk-5SGF47TZ.js} +9 -9
- package/dist/{chunk-POQTE7JI.js → chunk-5XSR757T.js} +7 -7
- package/dist/{chunk-GZMDZF2V.js → chunk-6FGLABYH.js} +3 -3
- package/dist/{chunk-MCQG4H6T.js → chunk-6T3QAO5K.js} +12 -4
- package/dist/{chunk-SKRR3ZMP.js → chunk-737A4YNC.js} +3 -3
- package/dist/{chunk-AFYXSZGW.js → chunk-7LSUUEAF.js} +7 -5
- package/dist/{chunk-7VLYQR4D.js → chunk-7OFGPDYJ.js} +3 -3
- package/dist/{chunk-54SIZR63.js → chunk-7UCKFULR.js} +7 -7
- package/dist/{chunk-LQURV7HQ.js → chunk-7ZA3QZRP.js} +4 -4
- package/dist/{chunk-X2VMIBK5.js → chunk-A4YPUS6C.js} +4 -4
- package/dist/{chunk-5ZEUTSCV.js → chunk-B4OVIE2X.js} +6 -6
- package/dist/{chunk-P6CON2R2.js → chunk-BH32X25C.js} +3 -3
- package/dist/{chunk-667ZHY3T.js → chunk-BJHLW25G.js} +85 -538
- package/dist/{chunk-ULGCGKOE.js → chunk-BKBINQJZ.js} +4 -4
- package/dist/{chunk-CFFWYXDW.js → chunk-BXQFBFT7.js} +5 -5
- package/dist/{chunk-I6WMNXC7.js → chunk-CQGMOPLG.js} +6 -6
- package/dist/{chunk-FNQJJO63.js → chunk-CUONE6LA.js} +4 -4
- package/dist/{chunk-FFMTYQXE.js → chunk-CVCS5G3E.js} +43 -21
- package/dist/{chunk-33TOK7ES.js → chunk-DCKVNHV5.js} +5 -5
- package/dist/{chunk-A323V6AI.js → chunk-DYRGHXT5.js} +3 -3
- package/dist/{chunk-T4ZFZTY6.js → chunk-EHML2DLR.js} +4 -4
- package/dist/{chunk-N3RVMBPX.js → chunk-EJKQGUUM.js} +4 -4
- package/dist/{chunk-E2YZ7IMT.js → chunk-ESDSTS5N.js} +6 -6
- package/dist/{chunk-LCG34A5T.js → chunk-EVINS473.js} +5 -3
- package/dist/chunk-EXRVOGJ5.js +325 -0
- package/dist/{chunk-YHBI52P2.js → chunk-GDW6NFYN.js} +3 -3
- package/dist/chunk-GOCO45FF.js +619 -0
- package/dist/{chunk-7ZM7SNCZ.js → chunk-GPHGPY6T.js} +3 -3
- package/dist/{chunk-PO2TYK3C.js → chunk-GWYDOZGQ.js} +3 -3
- package/dist/{chunk-LO22VQL5.js → chunk-HNNNJP3A.js} +4 -4
- package/dist/{chunk-ZZSNTCCL.js → chunk-IESEBPYA.js} +4 -4
- package/dist/{chunk-3H444OJA.js → chunk-JZ4HGFWK.js} +3 -3
- package/dist/chunk-KBQJIVUB.js +33 -0
- package/dist/{chunk-CKMWBVRR.js → chunk-KCM4KEZ2.js} +4 -4
- package/dist/{chunk-3QXLIZIX.js → chunk-KNGJ3CSB.js} +3 -3
- package/dist/{chunk-FH7Z7SGQ.js → chunk-KNW3IUWX.js} +12 -11
- package/dist/{chunk-KZP6B6B3.js → chunk-KTWTYK5U.js} +16 -5
- package/dist/{chunk-LYXPJERB.js → chunk-L7Z6XGBU.js} +5 -5
- package/dist/{chunk-ZHAT2XZ4.js → chunk-LLUWBQK6.js} +10 -10
- package/dist/{chunk-QHH6AUR3.js → chunk-MDKVYC6R.js} +7 -7
- package/dist/{chunk-22M75A3N.js → chunk-MS6DY4CE.js} +14 -11
- package/dist/{chunk-LLPWQDF7.js → chunk-MTOTPAYZ.js} +3 -3
- package/dist/{chunk-AZ7DKRBY.js → chunk-MVF7FA4D.js} +5 -5
- package/dist/{chunk-AIGYMTCU.js → chunk-MVUNB43J.js} +3 -3
- package/dist/{chunk-ZMFY7WAY.js → chunk-O24HHIQG.js} +41 -39
- package/dist/{chunk-NKG4N6HA.js → chunk-O5EHNNPS.js} +4 -4
- package/dist/{chunk-5DP7W5HX.js → chunk-OIPFTJS6.js} +3 -3
- package/dist/{chunk-U4WSJAYK.js → chunk-OXNIEIOY.js} +20 -20
- package/dist/chunk-P2BGR77C.js +344 -0
- package/dist/{chunk-CGHYXWTT.js → chunk-PFAFTLN3.js} +4 -4
- package/dist/{chunk-4RBIWI2Q.js → chunk-Q2KR7PSX.js} +3 -3
- package/dist/{chunk-7GUPNTAH.js → chunk-QSOLK2I2.js} +7 -7
- package/dist/chunk-QTWRR7IS.js +1129 -0
- package/dist/{chunk-OLLD2BZN.js → chunk-QZHAL4BL.js} +3 -3
- package/dist/{chunk-OACWA4TC.js → chunk-R25NHHYT.js} +6 -6
- package/dist/{chunk-QDKETK7D.js → chunk-S55JKMG7.js} +5 -5
- package/dist/{chunk-S5TEWPWW.js → chunk-S5LLA36K.js} +10 -10
- package/dist/{chunk-QDYE5LVT.js → chunk-SF3HCW4G.js} +45 -4
- package/dist/{chunk-KHGW72BM.js → chunk-SGMVB7HD.js} +3 -3
- package/dist/{chunk-FKVPAEJ6.js → chunk-SKJC2KYD.js} +4 -3
- package/dist/chunk-SKPKL47Y.js +5671 -0
- package/dist/{chunk-6MMBQVRO.js → chunk-TCTTZHUS.js} +9 -9
- package/dist/chunk-U5X3MLM5.js +67 -0
- package/dist/chunk-UHSGD4CD.js +364 -0
- package/dist/chunk-UJ4WEQHR.js +525 -0
- package/dist/{chunk-6H4LNWQ7.js → chunk-VDFWWWLL.js} +9 -4
- package/dist/{chunk-5KSD4WKN.js → chunk-VIKV25VP.js} +5 -5
- package/dist/chunk-WJB5GWAZ.js +20 -0
- package/dist/{chunk-HHYEAFCL.js → chunk-XAQQ4LYL.js} +11 -11
- package/dist/{chunk-4VGEJG4M.js → chunk-XCFFM2C7.js} +9 -9
- package/dist/chunk-XKTD3X6Z.js +183 -0
- package/dist/{chunk-GQRSABRN.js → chunk-XWXXKEG6.js} +4 -4
- package/dist/chunk-YGFTNICV.js +110 -0
- package/dist/{chunk-T5574MXM.js → chunk-YGJL7QS7.js} +8 -8
- package/dist/{chunk-SB3DG572.js → chunk-YKPTUANT.js} +6 -6
- package/dist/{chunk-YQYVGWIC.js → chunk-YQAYAJ2T.js} +33 -11
- package/dist/chunk-YXYZW6WU.js +998 -0
- package/dist/{chunk-IQNVSQRK.js → chunk-Z6NSOC6T.js} +5 -5
- package/dist/{chunk-BBKE4W3B.js → chunk-ZAWGG4H2.js} +7 -7
- package/dist/{chunk-BFVJHH7S.js → chunk-ZF362B2X.js} +5 -5
- package/dist/{chunk-RJTVCA62.js → chunk-ZJIY642R.js} +3 -3
- package/dist/color-input.d.ts +93 -0
- package/dist/color-input.js +35 -0
- package/dist/color-picker.d.ts +268 -0
- package/dist/color-picker.js +28 -0
- package/dist/color-value-DYzChVOW.d.ts +129 -0
- package/dist/combobox.d.ts +1 -1
- package/dist/combobox.js +13 -12
- package/dist/date-calendar.d.ts +49 -0
- package/dist/date-calendar.js +12 -0
- package/dist/date-input.d.ts +1 -1
- package/dist/date-input.js +11 -10
- package/dist/date-picker.d.ts +15 -131
- package/dist/date-picker.js +26 -22
- package/dist/date-types-DrDdF6WJ.d.ts +100 -0
- package/dist/dialog.d.ts +1 -1
- package/dist/dialog.js +10 -10
- package/dist/drawer.d.ts +1 -1
- package/dist/drawer.js +9 -9
- package/dist/dropdown-menu.d.ts +1 -1
- package/dist/dropdown-menu.js +6 -6
- package/dist/dropzone.d.ts +3 -3
- package/dist/dropzone.js +17 -16
- package/dist/form.d.ts +15 -5
- package/dist/form.js +75 -36
- package/dist/header-navigation.d.ts +2 -2
- package/dist/header-navigation.js +21 -20
- package/dist/helper.d.ts +1 -1
- package/dist/index.d.ts +25 -11
- package/dist/index.js +92 -79
- package/dist/indicator.js +4 -4
- package/dist/inline-banner.d.ts +68 -0
- package/dist/inline-banner.js +20 -0
- package/dist/input.d.ts +1 -1
- package/dist/input.js +10 -9
- package/dist/kanban-board.d.ts +2 -2
- package/dist/kanban-board.js +16 -15
- package/dist/labels-C992bt7G.d.ts +1160 -0
- package/dist/line-chart.d.ts +2 -2
- package/dist/line-chart.js +7 -6
- package/dist/mcp.js +231 -0
- package/dist/number-input.d.ts +1 -1
- package/dist/number-input.js +10 -9
- package/dist/pagination.d.ts +1 -1
- package/dist/pagination.js +14 -13
- package/dist/{card-D56VxyAe.d.ts → panel-CUGm_Mxy.d.ts} +9 -57
- package/dist/payment-input.d.ts +3 -3
- package/dist/payment-input.js +10 -9
- package/dist/picker-draft-BPV3MUPY.d.ts +9 -0
- package/dist/pie-chart.d.ts +2 -2
- package/dist/pie-chart.js +7 -6
- package/dist/popover.d.ts +65 -4
- package/dist/popover.js +9 -9
- package/dist/progress-steps.js +4 -4
- package/dist/progress.js +3 -3
- package/dist/provider.d.ts +1 -1
- package/dist/provider.js +3 -3
- package/dist/qr-code.d.ts +227 -0
- package/dist/qr-code.js +19 -0
- package/dist/radar-chart.d.ts +2 -2
- package/dist/radar-chart.js +7 -6
- package/dist/radial-chart.d.ts +2 -2
- package/dist/radial-chart.js +7 -6
- package/dist/radio.js +8 -7
- package/dist/rich-text-editor.d.ts +624 -0
- package/dist/rich-text-editor.js +51 -0
- package/dist/rich-text-highlight.d.ts +11 -0
- package/dist/rich-text-highlight.js +65 -0
- package/dist/rich-text-sanitize.d.ts +17 -0
- package/dist/rich-text-sanitize.js +176 -0
- package/dist/scroll-area.js +2 -2
- package/dist/select.d.ts +2 -2
- package/dist/select.js +17 -16
- package/dist/separator.js +2 -2
- package/dist/shared-CGf2D8ZX.d.ts +20 -0
- package/dist/sidebar-navigation.d.ts +76 -27
- package/dist/sidebar-navigation.js +16 -15
- package/dist/sidebar-state.d.ts +76 -0
- package/dist/sidebar-state.js +27 -0
- package/dist/skeleton.js +2 -2
- package/dist/slider.d.ts +321 -0
- package/dist/slider.js +13 -0
- package/dist/styles.css +1 -1
- package/dist/switch.d.ts +1 -1
- package/dist/switch.js +2 -2
- package/dist/table.d.ts +3 -19
- package/dist/table.js +34 -33
- package/dist/tabs.js +2 -2
- package/dist/tag-input.d.ts +3 -3
- package/dist/tag-input.js +13 -12
- package/dist/tag.d.ts +1 -1
- package/dist/tag.js +4 -4
- package/dist/textarea.js +8 -7
- package/dist/theme.css +965 -0
- package/dist/theme.js +12 -11
- package/dist/toast.d.ts +1 -1
- package/dist/toast.js +12 -11
- package/dist/tooltip.js +4 -3
- package/dist/tree.d.ts +1 -1
- package/dist/tree.js +6 -6
- package/dist/{types-DR9rAEy1.d.ts → types-DYFl0CEB.d.ts} +1 -1
- package/dist/{use-uploads-KaPqDklo.d.ts → use-uploads-2E7n0PWT.d.ts} +1 -1
- package/dist/verification-code-input.js +10 -9
- package/package.json +92 -8
- package/dist/chunk-BLIZ3CL3.js +0 -49
- package/dist/labels-DPrh0se9.d.ts +0 -627
- package/dist/panel-El4oI68p.d.ts +0 -9
- package/dist/shared-BYXJPnsN.d.ts +0 -11
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Input } from './chunk-
|
|
4
|
-
import { TooltipExport } from './chunk-
|
|
5
|
-
import { ChevronsLeftIcon, ChevronLeftIcon, ChevronRightIcon, ChevronsRightIcon } from './chunk-
|
|
1
|
+
import { Separator } from './chunk-7OFGPDYJ.js';
|
|
2
|
+
import { NativeSelect } from './chunk-CQGMOPLG.js';
|
|
3
|
+
import { Input } from './chunk-QSOLK2I2.js';
|
|
4
|
+
import { TooltipExport } from './chunk-KTWTYK5U.js';
|
|
5
|
+
import { ChevronsLeftIcon, ChevronLeftIcon, ChevronRightIcon, ChevronsRightIcon } from './chunk-YGFTNICV.js';
|
|
6
6
|
import { cn } from './chunk-ZSNJ6UA3.js';
|
|
7
|
-
import { useLabels } from './chunk-
|
|
8
|
-
import { warnPositiveInt, warnNonNegativeInt } from './chunk-
|
|
7
|
+
import { useLabels } from './chunk-ZJIY642R.js';
|
|
8
|
+
import { warnPositiveInt, warnNonNegativeInt } from './chunk-SF3HCW4G.js';
|
|
9
9
|
import * as React from 'react';
|
|
10
10
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
11
11
|
|
|
@@ -285,5 +285,5 @@ function Pagination({
|
|
|
285
285
|
Pagination.displayName = "Pagination";
|
|
286
286
|
|
|
287
287
|
export { Pagination, pageWindow };
|
|
288
|
-
//# sourceMappingURL=chunk-
|
|
289
|
-
//# sourceMappingURL=chunk-
|
|
288
|
+
//# sourceMappingURL=chunk-TCTTZHUS.js.map
|
|
289
|
+
//# sourceMappingURL=chunk-TCTTZHUS.js.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { SURFACE_BASE } from './chunk-45Y2ZGNK.js';
|
|
2
|
+
import { useLinkResolver } from './chunk-5AZKP4KZ.js';
|
|
3
|
+
import { Button } from './chunk-R25NHHYT.js';
|
|
4
|
+
import { WASH, WASH_RING } from './chunk-6T3QAO5K.js';
|
|
5
|
+
import { InfoIcon, CircleXIcon, TriangleAlertIcon, CircleCheckIcon, MegaphoneIcon, BellIcon } from './chunk-YGFTNICV.js';
|
|
6
|
+
import { cn } from './chunk-ZSNJ6UA3.js';
|
|
7
|
+
import 'react';
|
|
8
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
9
|
+
|
|
10
|
+
var ROOT = cn("flex gap-3 p-4", SURFACE_BASE);
|
|
11
|
+
var GLYPH = "mt-0.5 shrink-0 [&>svg]:size-5";
|
|
12
|
+
var TEXT = "flex min-w-0 flex-1 flex-col gap-0.5 break-words";
|
|
13
|
+
var TITLE = "text-sm font-semibold text-primary";
|
|
14
|
+
var DESC = "text-sm font-normal text-tertiary";
|
|
15
|
+
var ACTIONS = "mt-2.5 flex flex-wrap items-center gap-3";
|
|
16
|
+
var TONE_ICON = {
|
|
17
|
+
neutral: BellIcon,
|
|
18
|
+
brand: MegaphoneIcon,
|
|
19
|
+
success: CircleCheckIcon,
|
|
20
|
+
warning: TriangleAlertIcon,
|
|
21
|
+
error: CircleXIcon,
|
|
22
|
+
info: InfoIcon
|
|
23
|
+
};
|
|
24
|
+
var ROLE = {
|
|
25
|
+
neutral: "polite",
|
|
26
|
+
brand: "polite",
|
|
27
|
+
success: "polite",
|
|
28
|
+
warning: "polite",
|
|
29
|
+
error: "assertive",
|
|
30
|
+
info: "polite"
|
|
31
|
+
};
|
|
32
|
+
function InlineBanner({ title, description, icon, tone = "info", announce, bordered = false, actions, className }) {
|
|
33
|
+
const resolveLink = useLinkResolver();
|
|
34
|
+
const politeness = announce ?? ROLE[tone];
|
|
35
|
+
const Glyph = TONE_ICON[tone];
|
|
36
|
+
return /* @__PURE__ */ jsxs(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
...politeness === "off" ? null : { role: politeness === "assertive" ? "alert" : "status" },
|
|
40
|
+
className: cn(ROOT, WASH[tone], bordered && WASH_RING[tone], className),
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: GLYPH, children: icon ?? /* @__PURE__ */ jsx(Glyph, {}) }),
|
|
43
|
+
/* @__PURE__ */ jsxs("div", { className: TEXT, children: [
|
|
44
|
+
/* @__PURE__ */ jsx("p", { className: TITLE, children: title }),
|
|
45
|
+
description ? /* @__PURE__ */ jsx("p", { className: DESC, children: description }) : null,
|
|
46
|
+
actions && actions.length > 0 ? /* @__PURE__ */ jsx("div", { className: ACTIONS, children: actions.map((action) => /* @__PURE__ */ jsx(
|
|
47
|
+
Button,
|
|
48
|
+
{
|
|
49
|
+
size: "sm",
|
|
50
|
+
variant: action.variant ?? "secondary",
|
|
51
|
+
leading: action.leading,
|
|
52
|
+
onClick: action.onClick,
|
|
53
|
+
...action.href ? { render: resolveLink(action.href) } : null,
|
|
54
|
+
children: action.label
|
|
55
|
+
},
|
|
56
|
+
action.label
|
|
57
|
+
)) }) : null
|
|
58
|
+
] })
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
InlineBanner.displayName = "InlineBanner";
|
|
64
|
+
|
|
65
|
+
export { InlineBanner };
|
|
66
|
+
//# sourceMappingURL=chunk-U5X3MLM5.js.map
|
|
67
|
+
//# sourceMappingURL=chunk-U5X3MLM5.js.map
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import { devWarn } from './chunk-SF3HCW4G.js';
|
|
2
|
+
|
|
3
|
+
// src/lib/color-value.ts
|
|
4
|
+
var COLOR_FORMATS = ["hex", "rgb", "css", "hsl", "hsb"];
|
|
5
|
+
var BLACK = { r: 0, g: 0, b: 0, a: 1 };
|
|
6
|
+
var clamp = (n, lo, hi) => n < lo ? lo : Math.min(n, hi);
|
|
7
|
+
var ALPHA_STEPS = 100;
|
|
8
|
+
var clampAlpha = (a) => Number.isFinite(a) ? Math.round(clamp(a, 0, 1) * ALPHA_STEPS) / ALPHA_STEPS : 1;
|
|
9
|
+
var byte = (n) => clamp(Math.round(n), 0, 255);
|
|
10
|
+
var wrapHue = (h) => Number.isFinite(h) ? (h % 360 + 360) % 360 : 0;
|
|
11
|
+
var HEX_RE = /^#([0-9a-f]+)$/i;
|
|
12
|
+
var FN_RE = /^([a-z]+)\(([^()]*)\)$/i;
|
|
13
|
+
var POLAR_FNS = /* @__PURE__ */ new Set(["hsl", "hsla", "hsb", "hsba", "hsv", "hsva"]);
|
|
14
|
+
var expand = (digits) => digits.length <= 4 ? [...digits].map((d) => d + d).join("") : digits;
|
|
15
|
+
function parseHex(digits) {
|
|
16
|
+
if (digits.length !== 3 && digits.length !== 4 && digits.length !== 6 && digits.length !== 8) return null;
|
|
17
|
+
const full = expand(digits);
|
|
18
|
+
const at = (i) => Number.parseInt(full.slice(i, i + 2), 16);
|
|
19
|
+
return {
|
|
20
|
+
r: at(0),
|
|
21
|
+
g: at(2),
|
|
22
|
+
b: at(4),
|
|
23
|
+
a: full.length === 8 ? clampAlpha(at(6) / 255) : 1
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function splitArgs(body) {
|
|
27
|
+
const slash = body.split("/");
|
|
28
|
+
if (slash.length > 2) return null;
|
|
29
|
+
const head = (slash[0] ?? "").trim();
|
|
30
|
+
const parts = head === "" ? [] : head.split(/[\s,]+/);
|
|
31
|
+
if (slash.length === 2) {
|
|
32
|
+
const tail = (slash[1] ?? "").trim();
|
|
33
|
+
if (tail === "") return null;
|
|
34
|
+
parts.push(tail);
|
|
35
|
+
}
|
|
36
|
+
return parts;
|
|
37
|
+
}
|
|
38
|
+
function arg(token, scale) {
|
|
39
|
+
if (token === void 0) return null;
|
|
40
|
+
const t = token.trim();
|
|
41
|
+
if (t === "none") return 0;
|
|
42
|
+
const pct = t.endsWith("%");
|
|
43
|
+
const body = pct ? t.slice(0, -1) : t.replace(/deg$/i, "");
|
|
44
|
+
const raw = body.trim() === "" ? NaN : Number(body);
|
|
45
|
+
if (!Number.isFinite(raw)) return null;
|
|
46
|
+
return pct ? raw / 100 * scale : raw;
|
|
47
|
+
}
|
|
48
|
+
function parseColor(css, opts) {
|
|
49
|
+
const warn = (message) => {
|
|
50
|
+
if (opts?.quiet !== true) devWarn(message);
|
|
51
|
+
};
|
|
52
|
+
const s = css.trim().toLowerCase();
|
|
53
|
+
if (s === "") return null;
|
|
54
|
+
if (s === "transparent") return { r: 0, g: 0, b: 0, a: 0 };
|
|
55
|
+
const hex = HEX_RE.exec(s);
|
|
56
|
+
if (hex) {
|
|
57
|
+
const parsed = parseHex(hex[1] ?? "");
|
|
58
|
+
if (parsed === null) warn(`parseColor: "${css}" is not a 3-, 4-, 6- or 8-digit hex colour.`);
|
|
59
|
+
return parsed;
|
|
60
|
+
}
|
|
61
|
+
const fn = FN_RE.exec(s);
|
|
62
|
+
if (fn) {
|
|
63
|
+
const name = fn[1] ?? "";
|
|
64
|
+
const parts = splitArgs(fn[2] ?? "");
|
|
65
|
+
if (parts !== null && (parts.length === 3 || parts.length === 4)) {
|
|
66
|
+
const alpha = parts.length === 4 ? arg(parts[3], 1) : 1;
|
|
67
|
+
if (alpha !== null) {
|
|
68
|
+
const a = clampAlpha(alpha);
|
|
69
|
+
if (name === "rgb" || name === "rgba") {
|
|
70
|
+
const r = arg(parts[0], 255);
|
|
71
|
+
const g = arg(parts[1], 255);
|
|
72
|
+
const b = arg(parts[2], 255);
|
|
73
|
+
if (r !== null && g !== null && b !== null) return { r: byte(r), g: byte(g), b: byte(b), a };
|
|
74
|
+
} else if (POLAR_FNS.has(name)) {
|
|
75
|
+
const h = arg(parts[0], 360);
|
|
76
|
+
const x = arg(parts[1], 1);
|
|
77
|
+
const y = arg(parts[2], 1);
|
|
78
|
+
if (h !== null && x !== null && y !== null) {
|
|
79
|
+
const hue = wrapHue(h);
|
|
80
|
+
const sat = clamp(x, 0, 1);
|
|
81
|
+
const third = clamp(y, 0, 1);
|
|
82
|
+
return name.startsWith("hsl") ? hslaToRgba(hue, sat, third, a) : hsvaToRgba({ h: hue, s: sat, v: third, a });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
warn(
|
|
89
|
+
`parseColor: cannot parse "${css}". Supported: #hex, rgb()/rgba(), hsl()/hsla(), hsb()/hsv(), transparent. Named colours are not supported \u2014 pass a hex value.`
|
|
90
|
+
);
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
function rawRgbaToHsva({ r, g, b, a }) {
|
|
94
|
+
const max = Math.max(r, g, b);
|
|
95
|
+
const min = Math.min(r, g, b);
|
|
96
|
+
const d = max - min;
|
|
97
|
+
let h = 0;
|
|
98
|
+
if (d !== 0) {
|
|
99
|
+
if (max === r) h = 60 * ((g - b) / d % 6);
|
|
100
|
+
else if (max === g) h = 60 * ((b - r) / d + 2);
|
|
101
|
+
else h = 60 * ((r - g) / d + 4);
|
|
102
|
+
}
|
|
103
|
+
return { h: wrapHue(h), s: max === 0 ? 0 : d / max, v: max / 255, a };
|
|
104
|
+
}
|
|
105
|
+
function rgbaToHsva(rgba, prev) {
|
|
106
|
+
const hsva = rawRgbaToHsva(rgba);
|
|
107
|
+
if (prev === void 0) return hsva;
|
|
108
|
+
if (hsva.s === 0) hsva.h = prev.h;
|
|
109
|
+
if (hsva.v === 0) {
|
|
110
|
+
hsva.h = prev.h;
|
|
111
|
+
hsva.s = prev.s;
|
|
112
|
+
}
|
|
113
|
+
return hsva;
|
|
114
|
+
}
|
|
115
|
+
function hsvaToRgba({ h, s, v, a }) {
|
|
116
|
+
const hue = wrapHue(h) / 60;
|
|
117
|
+
const c = clamp(v, 0, 1) * clamp(s, 0, 1);
|
|
118
|
+
const x = c * (1 - Math.abs(hue % 2 - 1));
|
|
119
|
+
const m = clamp(v, 0, 1) - c;
|
|
120
|
+
const i = Math.floor(hue) % 6;
|
|
121
|
+
const rgb = i === 0 ? [c, x, 0] : i === 1 ? [x, c, 0] : i === 2 ? [0, c, x] : i === 3 ? [0, x, c] : i === 4 ? [x, 0, c] : [c, 0, x];
|
|
122
|
+
return { r: byte((rgb[0] + m) * 255), g: byte((rgb[1] + m) * 255), b: byte((rgb[2] + m) * 255), a: clampAlpha(a) };
|
|
123
|
+
}
|
|
124
|
+
function hslaToRgba(h, s, l, a) {
|
|
125
|
+
const c = (1 - Math.abs(2 * l - 1)) * s;
|
|
126
|
+
const hue = wrapHue(h) / 60;
|
|
127
|
+
const x = c * (1 - Math.abs(hue % 2 - 1));
|
|
128
|
+
const m = l - c / 2;
|
|
129
|
+
const i = Math.floor(hue) % 6;
|
|
130
|
+
const rgb = i === 0 ? [c, x, 0] : i === 1 ? [x, c, 0] : i === 2 ? [0, c, x] : i === 3 ? [0, x, c] : i === 4 ? [x, 0, c] : [c, 0, x];
|
|
131
|
+
return { r: byte((rgb[0] + m) * 255), g: byte((rgb[1] + m) * 255), b: byte((rgb[2] + m) * 255), a: clampAlpha(a) };
|
|
132
|
+
}
|
|
133
|
+
function rgbaToHsl({ r, g, b }) {
|
|
134
|
+
const { h, v, s: sv } = rawRgbaToHsva({ r, g, b, a: 1 });
|
|
135
|
+
const l = v * (1 - sv / 2);
|
|
136
|
+
const s = l === 0 || l === 1 ? 0 : (v - l) / Math.min(l, 1 - l);
|
|
137
|
+
return { h, s, l };
|
|
138
|
+
}
|
|
139
|
+
var hex2 = (n) => byte(n).toString(16).padStart(2, "0");
|
|
140
|
+
function toHex({ r, g, b, a }) {
|
|
141
|
+
const rgb = `#${hex2(r)}${hex2(g)}${hex2(b)}`;
|
|
142
|
+
return a < 1 ? `${rgb}${hex2(clampAlpha(a) * 255)}` : rgb;
|
|
143
|
+
}
|
|
144
|
+
var trim = (n) => String(Number(n.toFixed(2)));
|
|
145
|
+
function formatColor(rgba, format) {
|
|
146
|
+
const { r, g, b, a } = rgba;
|
|
147
|
+
const alpha = clampAlpha(a);
|
|
148
|
+
switch (format) {
|
|
149
|
+
case "hex": {
|
|
150
|
+
return toHex(rgba);
|
|
151
|
+
}
|
|
152
|
+
case "rgb": {
|
|
153
|
+
return alpha < 1 ? `rgba(${r}, ${g}, ${b}, ${trim(alpha)})` : `rgb(${r}, ${g}, ${b})`;
|
|
154
|
+
}
|
|
155
|
+
case "css": {
|
|
156
|
+
return alpha < 1 ? `rgb(${r} ${g} ${b} / ${trim(alpha)})` : `rgb(${r} ${g} ${b})`;
|
|
157
|
+
}
|
|
158
|
+
case "hsl": {
|
|
159
|
+
const { h, s, l } = rgbaToHsl(rgba);
|
|
160
|
+
const head = `${Math.round(h)}, ${Math.round(s * 100)}%, ${Math.round(l * 100)}%`;
|
|
161
|
+
return alpha < 1 ? `hsla(${head}, ${trim(alpha)})` : `hsl(${head})`;
|
|
162
|
+
}
|
|
163
|
+
case "hsb": {
|
|
164
|
+
const { h, s, v } = rawRgbaToHsva(rgba);
|
|
165
|
+
const head = `${Math.round(h)}, ${Math.round(s * 100)}%, ${Math.round(v * 100)}%`;
|
|
166
|
+
return alpha < 1 ? `hsb(${head}, ${trim(alpha)})` : `hsb(${head})`;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function sameColor(a, b) {
|
|
171
|
+
const x = parseColor(a);
|
|
172
|
+
const y = parseColor(b);
|
|
173
|
+
if (x === null || y === null) return false;
|
|
174
|
+
return x.r === y.r && x.g === y.g && x.b === y.b && x.a === y.a;
|
|
175
|
+
}
|
|
176
|
+
function hueColor(h) {
|
|
177
|
+
return toHex(hsvaToRgba({ h, s: 1, v: 1, a: 1 }));
|
|
178
|
+
}
|
|
179
|
+
function toLinear(v) {
|
|
180
|
+
const s = v / 255;
|
|
181
|
+
return s <= 0.04045 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4);
|
|
182
|
+
}
|
|
183
|
+
function relativeLuminance({ r, g, b }) {
|
|
184
|
+
return 0.2126 * toLinear(r) + 0.7152 * toLinear(g) + 0.0722 * toLinear(b);
|
|
185
|
+
}
|
|
186
|
+
function readableOn(rgba) {
|
|
187
|
+
return relativeLuminance(rgba) > 0.1791 ? "dark" : "light";
|
|
188
|
+
}
|
|
189
|
+
function sortStops(stops) {
|
|
190
|
+
return [...stops].sort((a, b) => a.offset - b.offset);
|
|
191
|
+
}
|
|
192
|
+
function sampleStops(stops, offset) {
|
|
193
|
+
const sorted = sortStops(stops);
|
|
194
|
+
const first = sorted[0];
|
|
195
|
+
const last = sorted.at(-1);
|
|
196
|
+
if (first === void 0 || last === void 0) return "#000000";
|
|
197
|
+
const at = clamp(offset, 0, 1);
|
|
198
|
+
if (at <= first.offset) return first.color;
|
|
199
|
+
if (at >= last.offset) return last.color;
|
|
200
|
+
let lo = first;
|
|
201
|
+
let hi = last;
|
|
202
|
+
for (let i = 0; i < sorted.length - 1; i++) {
|
|
203
|
+
const a = sorted[i];
|
|
204
|
+
const b = sorted[i + 1];
|
|
205
|
+
if (at >= a.offset && at <= b.offset) {
|
|
206
|
+
lo = a;
|
|
207
|
+
hi = b;
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const span = hi.offset - lo.offset;
|
|
212
|
+
const t = span === 0 ? 0 : (at - lo.offset) / span;
|
|
213
|
+
const A = parseColor(lo.color, { quiet: true }) ?? BLACK;
|
|
214
|
+
const B = parseColor(hi.color, { quiet: true }) ?? BLACK;
|
|
215
|
+
return toHex({
|
|
216
|
+
r: byte(A.r + (B.r - A.r) * t),
|
|
217
|
+
g: byte(A.g + (B.g - A.g) * t),
|
|
218
|
+
b: byte(A.b + (B.b - A.b) * t),
|
|
219
|
+
a: clampAlpha(A.a + (B.a - A.a) * t)
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
function reverseStops(stops) {
|
|
223
|
+
return sortStops(stops.map((s) => ({ color: s.color, offset: clamp(1 - s.offset, 0, 1) })));
|
|
224
|
+
}
|
|
225
|
+
var GRADIENT_FN = {
|
|
226
|
+
linear: "linear-gradient",
|
|
227
|
+
radial: "radial-gradient",
|
|
228
|
+
angular: "conic-gradient",
|
|
229
|
+
// `diamond` has NO CSS primitive. A `closest-side` radial is the standard approximation and the
|
|
230
|
+
// shape a design tool exports it as; record it rather than pretend the mapping is exact.
|
|
231
|
+
diamond: "radial-gradient"
|
|
232
|
+
};
|
|
233
|
+
var SEED_HUE_TURN = 60;
|
|
234
|
+
var SEED_VALUE_STEP = 0.42;
|
|
235
|
+
function seedSecondStop(color) {
|
|
236
|
+
const hsva = rgbaToHsva(parseColor(color, { quiet: true }) ?? BLACK);
|
|
237
|
+
const flat = hsva.s < 0.08 || hsva.v < 0.2;
|
|
238
|
+
const v = flat ? hsva.v <= 0.5 ? hsva.v + SEED_VALUE_STEP : hsva.v - SEED_VALUE_STEP : hsva.v;
|
|
239
|
+
return toHex(hsvaToRgba({ ...hsva, h: hsva.h + SEED_HUE_TURN, v }));
|
|
240
|
+
}
|
|
241
|
+
function convertKind(value, to) {
|
|
242
|
+
if (value.kind === to) return value;
|
|
243
|
+
if (to === "solid") {
|
|
244
|
+
return { kind: "solid", color: value.kind === "gradient" ? value.stops[0]?.color ?? "#000000" : "#000000" };
|
|
245
|
+
}
|
|
246
|
+
const color = value.kind === "solid" ? value.color : "#000000";
|
|
247
|
+
return {
|
|
248
|
+
kind: "gradient",
|
|
249
|
+
type: "linear",
|
|
250
|
+
angle: 90,
|
|
251
|
+
stops: [
|
|
252
|
+
{ color, offset: 0 },
|
|
253
|
+
// The far stop is the SAME colour one hue step round, so the first paint reads as a gradient
|
|
254
|
+
// OF the colour the user had — two ends, both opaque, neither one they have to go and fix.
|
|
255
|
+
{ color: seedSecondStop(color), offset: 1 }
|
|
256
|
+
]
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
function toCss(value) {
|
|
260
|
+
if (value.kind === "solid") return value.color;
|
|
261
|
+
const stops = value.stops.map((s) => `${s.color} ${Math.round(clamp(s.offset, 0, 1) * 100)}%`).join(", ");
|
|
262
|
+
const deg = Math.round(wrapHue(value.angle));
|
|
263
|
+
if (value.type === "linear") return `linear-gradient(${deg}deg, ${stops})`;
|
|
264
|
+
if (value.type === "angular") return `conic-gradient(from ${deg}deg, ${stops})`;
|
|
265
|
+
return `${GRADIENT_FN[value.type]}(${value.type === "diamond" ? "closest-side, " : ""}${stops})`;
|
|
266
|
+
}
|
|
267
|
+
function splitTopLevel(body) {
|
|
268
|
+
const out = [];
|
|
269
|
+
let depth = 0;
|
|
270
|
+
let start = 0;
|
|
271
|
+
for (let i = 0; i < body.length; i++) {
|
|
272
|
+
const ch = body[i];
|
|
273
|
+
if (ch === "(") depth++;
|
|
274
|
+
else if (ch === ")") depth--;
|
|
275
|
+
else if (ch === "," && depth === 0) {
|
|
276
|
+
out.push(body.slice(start, i));
|
|
277
|
+
start = i + 1;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
out.push(body.slice(start));
|
|
281
|
+
return out.map((x) => x.trim()).filter((x) => x !== "");
|
|
282
|
+
}
|
|
283
|
+
function parseStop(token, fallback) {
|
|
284
|
+
const m = /^(.*?)\s+(-?[\d.]+)%$/.exec(token);
|
|
285
|
+
const colorText = (m ? m[1] : token) ?? "";
|
|
286
|
+
const rgba = parseColor(colorText, { quiet: true });
|
|
287
|
+
if (rgba === null) return null;
|
|
288
|
+
const pct = m ? Number(m[2]) : fallback * 100;
|
|
289
|
+
if (!Number.isFinite(pct)) return null;
|
|
290
|
+
return { color: toHex(rgba), offset: clamp(pct / 100, 0, 1) };
|
|
291
|
+
}
|
|
292
|
+
function unsupportedGradient(fn, head) {
|
|
293
|
+
if (/^(to|at)\b/i.test(head)) return "a keyword direction (`to bottom right`) \u2014 pass an angle in degrees";
|
|
294
|
+
if (/\bin\s+(oklab|oklch|lab|lch|srgb|hsl)\b/i.test(head)) return "an interpolation hint (`in oklab`) \u2014 the colour space is not part of the value";
|
|
295
|
+
if (fn === "radial-gradient" && /\b(circle|ellipse|farthest|closest-corner)\b|\bat\b/i.test(head)) {
|
|
296
|
+
return "a radial shape or position (`circle at 30% 40%`) \u2014 only the bare form and `closest-side` are held";
|
|
297
|
+
}
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
function parseCss(css) {
|
|
301
|
+
const s = css.trim();
|
|
302
|
+
const grad = /^([a-z-]*gradient)\s*\((.*)\)$/is.exec(s);
|
|
303
|
+
if (grad) {
|
|
304
|
+
const fn = (grad[1] ?? "").toLowerCase();
|
|
305
|
+
const parts = splitTopLevel(grad[2] ?? "");
|
|
306
|
+
const warn = (why) => {
|
|
307
|
+
devWarn(`parseCss: cannot parse "${s.slice(0, 48)}\u2026" \u2014 it carries ${why}.`);
|
|
308
|
+
return null;
|
|
309
|
+
};
|
|
310
|
+
const head = parts[0] ?? "";
|
|
311
|
+
const refused = unsupportedGradient(fn, head);
|
|
312
|
+
if (refused !== null) return warn(refused);
|
|
313
|
+
let type = null;
|
|
314
|
+
let angle = 0;
|
|
315
|
+
let rest = parts;
|
|
316
|
+
switch (fn) {
|
|
317
|
+
case "linear-gradient": {
|
|
318
|
+
type = "linear";
|
|
319
|
+
const deg = /^(-?[\d.]+)deg$/i.exec(head);
|
|
320
|
+
if (deg) {
|
|
321
|
+
angle = Number(deg[1]);
|
|
322
|
+
rest = parts.slice(1);
|
|
323
|
+
}
|
|
324
|
+
break;
|
|
325
|
+
}
|
|
326
|
+
case "conic-gradient": {
|
|
327
|
+
type = "angular";
|
|
328
|
+
const from = /^from\s+(-?[\d.]+)deg$/i.exec(head);
|
|
329
|
+
if (from) {
|
|
330
|
+
angle = Number(from[1]);
|
|
331
|
+
rest = parts.slice(1);
|
|
332
|
+
}
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
case "radial-gradient": {
|
|
336
|
+
if (/^closest-side$/i.test(head)) {
|
|
337
|
+
type = "diamond";
|
|
338
|
+
rest = parts.slice(1);
|
|
339
|
+
} else {
|
|
340
|
+
type = "radial";
|
|
341
|
+
}
|
|
342
|
+
break;
|
|
343
|
+
}
|
|
344
|
+
default: {
|
|
345
|
+
return warn(`an unsupported gradient function (\`${fn}\`)`);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
const stops = [];
|
|
349
|
+
for (const [i, token] of rest.entries()) {
|
|
350
|
+
if (/^-?[\d.]+%$/.test(token)) return warn("a bare-percentage interpolation hint between two stops");
|
|
351
|
+
const stop = parseStop(token, rest.length === 1 ? 0 : i / (rest.length - 1));
|
|
352
|
+
if (stop === null) return warn(`a stop this parser cannot read (\`${token.slice(0, 24)}\`)`);
|
|
353
|
+
stops.push(stop);
|
|
354
|
+
}
|
|
355
|
+
if (stops.length < 2) return warn("fewer than two stops");
|
|
356
|
+
return { kind: "gradient", type: type ?? "linear", angle: wrapHue(angle), stops };
|
|
357
|
+
}
|
|
358
|
+
const rgba = parseColor(s);
|
|
359
|
+
return rgba === null ? null : { kind: "solid", color: toHex(rgba) };
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export { BLACK, COLOR_FORMATS, clampAlpha, convertKind, formatColor, hsvaToRgba, hueColor, parseColor, parseCss, readableOn, relativeLuminance, reverseStops, rgbaToHsva, sameColor, sampleStops, sortStops, toCss, toHex };
|
|
363
|
+
//# sourceMappingURL=chunk-UHSGD4CD.js.map
|
|
364
|
+
//# sourceMappingURL=chunk-UHSGD4CD.js.map
|