@hezhijie0327/zjdesign 0.1.4-be4bf14 → 0.1.4
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/dist/hooks/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
export { THEME_BOOTSTRAP, THEME_COLOR_BLACK, THEME_COLOR_DARK, THEME_COLOR_LIGHT, ThemeStorage, ThemeStyle, UseThemeOptions, UseThemeResult, applyThemeStyle, cookieThemeStorage, createThemeController, localStorageThemeStorage,
|
|
1
|
+
import { _ as watchSystemTheme, a as THEME_BOOTSTRAP, c as THEME_COLOR_LIGHT, d as applyThemeStyle, f as cookieThemeStorage, g as setThemeStyle, h as readThemeStyle, i as useExitPresence, l as ThemeStorage, m as localStorageThemeStorage, n as UseThemeResult, o as THEME_COLOR_BLACK, p as createThemeController, r as useTheme, s as THEME_COLOR_DARK, t as UseThemeOptions, u as ThemeStyle, v as watchThemeDark, y as reducedMotion } from "../index-UTcA5mi9.mjs";
|
|
2
|
+
export { THEME_BOOTSTRAP, THEME_COLOR_BLACK, THEME_COLOR_DARK, THEME_COLOR_LIGHT, ThemeStorage, ThemeStyle, UseThemeOptions, UseThemeResult, applyThemeStyle, cookieThemeStorage, createThemeController, localStorageThemeStorage, readThemeStyle, reducedMotion, setThemeStyle, useExitPresence, useTheme, watchSystemTheme, watchThemeDark };
|
package/dist/hooks/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as THEME_COLOR_DARK, c as cookieThemeStorage, d as
|
|
1
|
+
import { a as THEME_COLOR_DARK, c as cookieThemeStorage, d as readThemeStyle, f as setThemeStyle, h as reducedMotion, i as THEME_COLOR_BLACK, l as createThemeController, m as watchThemeDark, n as useExitPresence, o as THEME_COLOR_LIGHT, p as watchSystemTheme, r as THEME_BOOTSTRAP, s as applyThemeStyle, t as useTheme, u as localStorageThemeStorage } from "../hooks-5sbEaltY.mjs";
|
|
2
2
|
|
|
3
|
-
export { THEME_BOOTSTRAP, THEME_COLOR_BLACK, THEME_COLOR_DARK, THEME_COLOR_LIGHT, applyThemeStyle, cookieThemeStorage, createThemeController, localStorageThemeStorage,
|
|
3
|
+
export { THEME_BOOTSTRAP, THEME_COLOR_BLACK, THEME_COLOR_DARK, THEME_COLOR_LIGHT, applyThemeStyle, cookieThemeStorage, createThemeController, localStorageThemeStorage, readThemeStyle, reducedMotion, setThemeStyle, useExitPresence, useTheme, watchSystemTheme, watchThemeDark };
|
|
@@ -97,16 +97,6 @@ const defaultController = /* @__PURE__ */ createThemeController();
|
|
|
97
97
|
const readThemeStyle = defaultController.readThemeStyle;
|
|
98
98
|
const applyThemeStyle = defaultController.applyThemeStyle;
|
|
99
99
|
const setThemeStyle = defaultController.setThemeStyle;
|
|
100
|
-
/** Advance a preference along a cycle order (default: the four-state loop
|
|
101
|
-
* including the OLED tier; pass a three-step order for black-less UIs). */
|
|
102
|
-
function nextThemeStyle(style, order = [
|
|
103
|
-
"auto",
|
|
104
|
-
"light",
|
|
105
|
-
"dark",
|
|
106
|
-
"black"
|
|
107
|
-
]) {
|
|
108
|
-
return order[(order.indexOf(style) + 1) % order.length] ?? "auto";
|
|
109
|
-
}
|
|
110
100
|
/** In auto mode, follow the system light/dark switch in real time.
|
|
111
101
|
* Returns an unsubscribe function (call it on teardown). */
|
|
112
102
|
function watchSystemTheme(storage = localStorageThemeStorage()) {
|
|
@@ -231,4 +221,4 @@ function useTheme({ storage = localStorageThemeStorage(), order = [
|
|
|
231
221
|
}
|
|
232
222
|
|
|
233
223
|
//#endregion
|
|
234
|
-
export { THEME_COLOR_DARK as a, cookieThemeStorage as c,
|
|
224
|
+
export { THEME_COLOR_DARK as a, cookieThemeStorage as c, readThemeStyle as d, setThemeStyle as f, reducedMotion as h, THEME_COLOR_BLACK as i, createThemeController as l, watchThemeDark as m, useExitPresence as n, THEME_COLOR_LIGHT as o, watchSystemTheme as p, THEME_BOOTSTRAP as r, applyThemeStyle as s, useTheme as t, localStorageThemeStorage as u };
|
|
@@ -40,9 +40,6 @@ declare function createThemeController(storage?: ThemeStorage): {
|
|
|
40
40
|
declare const readThemeStyle: () => ThemeStyle;
|
|
41
41
|
declare const applyThemeStyle: (style: ThemeStyle) => void;
|
|
42
42
|
declare const setThemeStyle: (style: ThemeStyle) => void;
|
|
43
|
-
/** Advance a preference along a cycle order (default: the four-state loop
|
|
44
|
-
* including the OLED tier; pass a three-step order for black-less UIs). */
|
|
45
|
-
declare function nextThemeStyle(style: ThemeStyle, order?: ThemeStyle[]): ThemeStyle;
|
|
46
43
|
/** In auto mode, follow the system light/dark switch in real time.
|
|
47
44
|
* Returns an unsubscribe function (call it on teardown). */
|
|
48
45
|
declare function watchSystemTheme(storage?: ThemeStorage): () => void;
|
|
@@ -102,4 +99,4 @@ declare function useTheme({
|
|
|
102
99
|
order
|
|
103
100
|
}?: UseThemeOptions): UseThemeResult;
|
|
104
101
|
//#endregion
|
|
105
|
-
export {
|
|
102
|
+
export { watchSystemTheme as _, THEME_BOOTSTRAP as a, THEME_COLOR_LIGHT as c, applyThemeStyle as d, cookieThemeStorage as f, setThemeStyle as g, readThemeStyle as h, useExitPresence as i, ThemeStorage as l, localStorageThemeStorage as m, UseThemeResult as n, THEME_COLOR_BLACK as o, createThemeController as p, useTheme as r, THEME_COLOR_DARK as s, UseThemeOptions as t, ThemeStyle as u, watchThemeDark as v, reducedMotion as y };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
import * as
|
|
1
|
+
import { _ as watchSystemTheme, a as THEME_BOOTSTRAP, c as THEME_COLOR_LIGHT, d as applyThemeStyle, f as cookieThemeStorage, g as setThemeStyle, h as readThemeStyle, i as useExitPresence, l as ThemeStorage, m as localStorageThemeStorage, n as UseThemeResult, o as THEME_COLOR_BLACK, p as createThemeController, r as useTheme, s as THEME_COLOR_DARK, t as UseThemeOptions, u as ThemeStyle, v as watchThemeDark, y as reducedMotion } from "./index-UTcA5mi9.mjs";
|
|
2
|
+
import * as react3 from "react";
|
|
3
3
|
import { ButtonHTMLAttributes, ReactNode, RefObject } from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/components/Button/Button.d.ts
|
|
@@ -9,7 +9,7 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
9
9
|
}
|
|
10
10
|
/** Pill button in the family language (BTN_PRIMARY / BTN_OUTLINE / BTN_GHOST
|
|
11
11
|
* fragments + the danger state). */
|
|
12
|
-
declare const Button:
|
|
12
|
+
declare const Button: react3.ForwardRefExoticComponent<ButtonProps & react3.RefAttributes<HTMLButtonElement>>;
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/components/Collapse/Collapse.d.ts
|
|
15
15
|
/**
|
|
@@ -42,18 +42,16 @@ declare function Collapse({
|
|
|
42
42
|
className?: string;
|
|
43
43
|
id?: string;
|
|
44
44
|
children: ReactNode;
|
|
45
|
-
}):
|
|
45
|
+
}): react3.JSX.Element | null;
|
|
46
46
|
//#endregion
|
|
47
47
|
//#region src/components/IconButton/IconButton.d.ts
|
|
48
48
|
interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
49
49
|
/** accessibility label (aria-label + title) */
|
|
50
50
|
label: string;
|
|
51
51
|
active?: boolean;
|
|
52
|
-
/** aria-expanded passthrough for triggers (popovers / drawers) */
|
|
53
|
-
expanded?: boolean;
|
|
54
52
|
}
|
|
55
53
|
/** Round icon button (ICON_BTN fragment); `active` lights the accent. */
|
|
56
|
-
declare const IconButton:
|
|
54
|
+
declare const IconButton: react3.ForwardRefExoticComponent<IconButtonProps & react3.RefAttributes<HTMLButtonElement>>;
|
|
57
55
|
//#endregion
|
|
58
56
|
//#region src/components/CopyButton/CopyButton.d.ts
|
|
59
57
|
interface CopyButtonProps extends Omit<IconButtonProps, "label" | "children" | "onClick"> {
|
|
@@ -71,7 +69,7 @@ declare function CopyButton({
|
|
|
71
69
|
label,
|
|
72
70
|
feedbackMs,
|
|
73
71
|
...props
|
|
74
|
-
}: CopyButtonProps):
|
|
72
|
+
}: CopyButtonProps): react3.JSX.Element;
|
|
75
73
|
//#endregion
|
|
76
74
|
//#region src/components/Dropdown/Dropdown.d.ts
|
|
77
75
|
interface DropdownOption {
|
|
@@ -105,7 +103,7 @@ declare function Dropdown({
|
|
|
105
103
|
menuClassName,
|
|
106
104
|
disabled,
|
|
107
105
|
id
|
|
108
|
-
}: DropdownProps):
|
|
106
|
+
}: DropdownProps): react3.JSX.Element;
|
|
109
107
|
//#endregion
|
|
110
108
|
//#region src/components/Kbd/Kbd.d.ts
|
|
111
109
|
/** Mono chip for keys / states (MONO_CHIP fragment with tighter padding). */
|
|
@@ -115,7 +113,7 @@ declare function Kbd({
|
|
|
115
113
|
}: {
|
|
116
114
|
children: ReactNode;
|
|
117
115
|
className?: string;
|
|
118
|
-
}):
|
|
116
|
+
}): react3.JSX.Element;
|
|
119
117
|
/** Single-line panel row label (text-sm) — the standard row label inside
|
|
120
118
|
* toolbar panels. Never wraps: narrow rows scale via column layout instead. */
|
|
121
119
|
declare const ROW_LABEL = "shrink-0 whitespace-nowrap text-sm text-ink";
|
|
@@ -140,7 +138,7 @@ declare function Modal({
|
|
|
140
138
|
label,
|
|
141
139
|
className,
|
|
142
140
|
children
|
|
143
|
-
}: ModalProps):
|
|
141
|
+
}: ModalProps): react3.ReactPortal | null;
|
|
144
142
|
//#endregion
|
|
145
143
|
//#region src/components/Popover/Popover.d.ts
|
|
146
144
|
interface PopoverProps {
|
|
@@ -164,7 +162,7 @@ declare function Popover({
|
|
|
164
162
|
className,
|
|
165
163
|
children,
|
|
166
164
|
anchorRef
|
|
167
|
-
}: PopoverProps):
|
|
165
|
+
}: PopoverProps): react3.JSX.Element | null;
|
|
168
166
|
//#endregion
|
|
169
167
|
//#region src/components/ProgressBar/ProgressBar.d.ts
|
|
170
168
|
/** Top-of-page loading bar: 2px accent strip riding the `progress` keyframes
|
|
@@ -174,7 +172,7 @@ declare function ProgressBar({
|
|
|
174
172
|
className
|
|
175
173
|
}: {
|
|
176
174
|
className?: string;
|
|
177
|
-
}):
|
|
175
|
+
}): react3.JSX.Element;
|
|
178
176
|
//#endregion
|
|
179
177
|
//#region src/components/Segmented/Segmented.d.ts
|
|
180
178
|
interface SegmentedProps<T extends string | number> {
|
|
@@ -194,7 +192,7 @@ declare function Segmented<T extends string | number>({
|
|
|
194
192
|
onChange,
|
|
195
193
|
label,
|
|
196
194
|
className
|
|
197
|
-
}: SegmentedProps<T>):
|
|
195
|
+
}: SegmentedProps<T>): react3.JSX.Element;
|
|
198
196
|
//#endregion
|
|
199
197
|
//#region src/components/Slider/Slider.d.ts
|
|
200
198
|
interface SliderProps {
|
|
@@ -219,7 +217,7 @@ declare function Slider({
|
|
|
219
217
|
label,
|
|
220
218
|
display,
|
|
221
219
|
className
|
|
222
|
-
}: SliderProps):
|
|
220
|
+
}: SliderProps): react3.JSX.Element;
|
|
223
221
|
//#endregion
|
|
224
222
|
//#region src/components/Switch/Switch.d.ts
|
|
225
223
|
interface SwitchProps {
|
|
@@ -236,12 +234,12 @@ declare function Switch({
|
|
|
236
234
|
label,
|
|
237
235
|
className,
|
|
238
236
|
disabled
|
|
239
|
-
}: SwitchProps):
|
|
237
|
+
}: SwitchProps): react3.JSX.Element;
|
|
240
238
|
//#endregion
|
|
241
239
|
//#region src/components/Toast/Toaster.d.ts
|
|
242
240
|
/** Toast stack: bottom-center paper cards, fade-up in, auto-removed after 3 s.
|
|
243
241
|
* Mount once near the app root. */
|
|
244
|
-
declare function Toaster():
|
|
242
|
+
declare function Toaster(): react3.JSX.Element | null;
|
|
245
243
|
//#endregion
|
|
246
244
|
//#region src/components/Toast/types.d.ts
|
|
247
245
|
interface ToastItem {
|
|
@@ -256,4 +254,4 @@ declare function toast(text: string, tone?: ToastItem["tone"]): void;
|
|
|
256
254
|
declare function subscribeToasts(listener: Listener): () => void;
|
|
257
255
|
declare function getToasts(): ToastItem[];
|
|
258
256
|
//#endregion
|
|
259
|
-
export { Button, type ButtonProps, Collapse, CopyButton, type CopyButtonProps, Dropdown, type DropdownOption, type DropdownProps, IconButton, type IconButtonProps, Kbd, Modal, type ModalProps, Popover, type PopoverProps, ProgressBar, ROW_LABEL, Segmented, type SegmentedProps, Slider, type SliderProps, Switch, type SwitchProps, THEME_BOOTSTRAP, THEME_COLOR_BLACK, THEME_COLOR_DARK, THEME_COLOR_LIGHT, ThemeStorage, ThemeStyle, type ToastItem, Toaster, UseThemeOptions, UseThemeResult, applyThemeStyle, cookieThemeStorage, createThemeController, getToasts, localStorageThemeStorage,
|
|
257
|
+
export { Button, type ButtonProps, Collapse, CopyButton, type CopyButtonProps, Dropdown, type DropdownOption, type DropdownProps, IconButton, type IconButtonProps, Kbd, Modal, type ModalProps, Popover, type PopoverProps, ProgressBar, ROW_LABEL, Segmented, type SegmentedProps, Slider, type SliderProps, Switch, type SwitchProps, THEME_BOOTSTRAP, THEME_COLOR_BLACK, THEME_COLOR_DARK, THEME_COLOR_LIGHT, ThemeStorage, ThemeStyle, type ToastItem, Toaster, UseThemeOptions, UseThemeResult, applyThemeStyle, cookieThemeStorage, createThemeController, getToasts, localStorageThemeStorage, readThemeStyle, reducedMotion, setThemeStyle, subscribeToasts, toast, useExitPresence, useTheme, watchSystemTheme, watchThemeDark };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { A as SEGMENT, M as SEGMENT_ITEM_OFF, N as SEGMENT_ITEM_ON, V as cn, _ as META, a as BTN_PRIMARY, b as MODAL_SCRIM, h as LIST_ROW, i as BTN_OUTLINE, o as CARD, p as ICON_BTN, r as BTN_GHOST, x as MONO_CHIP } from "./styles-DhIa1Tm9.mjs";
|
|
2
|
-
import { a as THEME_COLOR_DARK, c as cookieThemeStorage, d as
|
|
2
|
+
import { a as THEME_COLOR_DARK, c as cookieThemeStorage, d as readThemeStyle, f as setThemeStyle, h as reducedMotion, i as THEME_COLOR_BLACK, l as createThemeController, m as watchThemeDark, n as useExitPresence, o as THEME_COLOR_LIGHT, p as watchSystemTheme, r as THEME_BOOTSTRAP, s as applyThemeStyle, t as useTheme, u as localStorageThemeStorage } from "./hooks-5sbEaltY.mjs";
|
|
3
3
|
import { forwardRef, useEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { Check, ChevronDown, Copy } from "lucide-react";
|
|
@@ -89,14 +89,13 @@ function Collapse({ open, unmountAfterHide = false, animateOnMount = false, clas
|
|
|
89
89
|
//#endregion
|
|
90
90
|
//#region src/components/IconButton/IconButton.tsx
|
|
91
91
|
/** Round icon button (ICON_BTN fragment); `active` lights the accent. */
|
|
92
|
-
const IconButton = forwardRef(function IconButton$1({ label, active = false,
|
|
92
|
+
const IconButton = forwardRef(function IconButton$1({ label, active = false, className, type = "button", children, ...props }, ref) {
|
|
93
93
|
return /* @__PURE__ */ jsx("button", {
|
|
94
94
|
ref,
|
|
95
95
|
type,
|
|
96
96
|
"aria-label": label,
|
|
97
97
|
title: label,
|
|
98
98
|
"aria-pressed": active || void 0,
|
|
99
|
-
"aria-expanded": expanded,
|
|
100
99
|
className: cn(ICON_BTN, active && "bg-accent-soft text-accent hover:text-accent", className),
|
|
101
100
|
...props,
|
|
102
101
|
children
|
|
@@ -398,7 +397,7 @@ function Switch({ checked, onChange, label, className, disabled }) {
|
|
|
398
397
|
className: cn("relative h-5.5 w-10 shrink-0 rounded-full border transition-colors", checked ? "border-accent-strong bg-accent-strong" : "border-line bg-surface-2", disabled && "cursor-default opacity-50", className),
|
|
399
398
|
children: /* @__PURE__ */ jsx("span", {
|
|
400
399
|
"aria-hidden": "true",
|
|
401
|
-
className: cn("absolute top-1/2 size-4 -translate-y-1/2 rounded-full shadow-card transition-all", checked ? "left-[calc(100%-1.125rem)] bg-
|
|
400
|
+
className: cn("absolute top-1/2 size-4 -translate-y-1/2 rounded-full shadow-card transition-all", checked ? "left-[calc(100%-1.125rem)] bg-accent-contrast" : "left-0.5 bg-ink-3")
|
|
402
401
|
})
|
|
403
402
|
});
|
|
404
403
|
}
|
|
@@ -458,4 +457,4 @@ function Toaster() {
|
|
|
458
457
|
}
|
|
459
458
|
|
|
460
459
|
//#endregion
|
|
461
|
-
export { Button, Collapse, CopyButton, Dropdown, IconButton, Kbd, Modal, Popover, ProgressBar, ROW_LABEL, Segmented, Slider, Switch, THEME_BOOTSTRAP, THEME_COLOR_BLACK, THEME_COLOR_DARK, THEME_COLOR_LIGHT, Toaster, applyThemeStyle, cookieThemeStorage, createThemeController, getToasts, localStorageThemeStorage,
|
|
460
|
+
export { Button, Collapse, CopyButton, Dropdown, IconButton, Kbd, Modal, Popover, ProgressBar, ROW_LABEL, Segmented, Slider, Switch, THEME_BOOTSTRAP, THEME_COLOR_BLACK, THEME_COLOR_DARK, THEME_COLOR_LIGHT, Toaster, applyThemeStyle, cookieThemeStorage, createThemeController, getToasts, localStorageThemeStorage, readThemeStyle, reducedMotion, setThemeStyle, subscribeToasts, toast, useExitPresence, useTheme, watchSystemTheme, watchThemeDark };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hezhijie0327/zjdesign",
|
|
3
|
-
"version": "0.1.4
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "ZJ Design — the shared design system of the ZJ product family (warm paper / ink / amber-gold). Tokens, Tailwind fragments, hooks and React components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design-system",
|
|
@@ -65,8 +65,7 @@
|
|
|
65
65
|
"lint:fix": "biome check --write .",
|
|
66
66
|
"test": "vitest run",
|
|
67
67
|
"dev": "vite serve playground",
|
|
68
|
-
"playground:build": "vite build playground"
|
|
69
|
-
"deploy:playground": "vite build playground --config playground/vite.config.ts && wrangler deploy -c playground/wrangler.jsonc"
|
|
68
|
+
"playground:build": "vite build playground"
|
|
70
69
|
},
|
|
71
70
|
"dependencies": {
|
|
72
71
|
"clsx": "^2.1.1",
|
|
@@ -94,8 +93,7 @@
|
|
|
94
93
|
"tsdown": "^0.16.0",
|
|
95
94
|
"typescript": "^5.9.0",
|
|
96
95
|
"vite": "^8.3.5",
|
|
97
|
-
"vitest": "^4.0.0"
|
|
98
|
-
"wrangler": "^4.156.2"
|
|
96
|
+
"vitest": "^4.0.0"
|
|
99
97
|
},
|
|
100
98
|
"publishConfig": {
|
|
101
99
|
"registry": "https://registry.npmjs.org/"
|