@hezhijie0327/zjdesign 0.1.3 → 0.1.4-06a4fff
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/AGENTS.md +1 -1
- package/DESIGN.md +24 -1
- package/dist/brand/index.d.mts +35 -1
- package/dist/brand/index.mjs +52 -2
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.mjs +2 -2
- package/dist/{hooks-_Gk75q-U.mjs → hooks-vpLVB3bc.mjs} +18 -4
- package/dist/{index-B-bZqvO6.d.mts → index-BVN0e41g.d.mts} +7 -3
- package/dist/index.d.mts +340 -18
- package/dist/index.mjs +642 -20
- package/dist/markdown/index.d.mts +121 -0
- package/dist/markdown/index.mjs +338 -0
- package/dist/paper/index.d.mts +2 -2
- package/dist/paper/index.mjs +1 -1
- package/dist/styles/index.mjs +1 -1
- package/dist/tokens/base.css +6 -4
- package/dist/tokens/index.css +1 -0
- package/dist/tokens/paper.css +53 -36
- package/dist/tokens/prose.css +182 -0
- package/package.json +49 -12
- /package/dist/{styles-DhIa1Tm9.mjs → styles-DsVothIU.mjs} +0 -0
package/AGENTS.md
CHANGED
|
@@ -150,7 +150,7 @@ pnpm test # vitest run (jsdom)
|
|
|
150
150
|
pnpm dev # vite playground (visual verification, :5199 in docs)
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
-
Release (OIDC trusted publishing — no NPM_TOKEN secret):
|
|
153
|
+
Release (OIDC trusted publishing — no NPM_TOKEN secret): every push to main that touches the package stamps `X.Y.Z-<sha7>` and publishes; `latest` lands on the newest commit (consumers depend on `latest`). The semver baseline moves via `scripts/bump_version.sh` (Windows: `scripts/bump_version.ps1`), which also prints the release commands. The workflow (release.yml) gates on lint + typecheck + tests + build; the one-time "Trusted Publisher" binding on npmjs.com is repo `hezhijie0327/ZJDesign` + workflow `release.yml` (npm CLI ≥ 11.5.1 via Node 24; provenance automatic). Playground changes do NOT trigger a publish (paths filter).
|
|
154
154
|
|
|
155
155
|
## Conventions
|
|
156
156
|
|
package/DESIGN.md
CHANGED
|
@@ -90,7 +90,30 @@ Class strategy: `html.dark` (+ `html.black` OLED tier). `data-theme-mode` drives
|
|
|
90
90
|
- Unmount windows are plain timers sized to the animation (`useExitPresence`), doubling as the timeout fallback (animation contract).
|
|
91
91
|
- Global reduced-motion gate collapses everything to 0.01ms.
|
|
92
92
|
|
|
93
|
-
## 7.
|
|
93
|
+
## 7. Component roadmap
|
|
94
|
+
|
|
95
|
+
Phase 1 — components the family already uses (extract next):
|
|
96
|
+
|
|
97
|
+
| Component family | Entry | Source provenance | Notes |
|
|
98
|
+
| ----------------- | ------------------- | -------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
99
|
+
| Markdown renderer | `zjdesign/markdown` | ZJBlog markdown.tsx + ZJSearch prose + ZJStudio markdown | unified react-markdown preset: GFM, callouts, katex, mermaid, the code-card; streaming-friendly `content` prop (Streamdown API shape) |
|
|
100
|
+
| Layout | `zjdesign/layout` | ZJBlog Shell / ZJStudio AppShell / ZJKVM Navigation | NavBar (glass blur + Wordmark + icon buttons + ThemeToggle), AppShell (ProgressBar + NavBar + main + Footer + BackToTop), page sections |
|
|
101
|
+
| ThemeToggle | main entry | ZJBlog/ZJKVM/ZJSearch | the tri/tetra-state icon button over the package theme hooks |
|
|
102
|
+
| Table | main entry | ZJStudio JobsPage | the family table fragment set (hairline rows, LIST_ROW rhythm) |
|
|
103
|
+
| Camera / media | `zjdesign/media` | ZJKVM media/camera + ZJBlog Lightbox | CameraPreview (getUserMedia + permission flow), Lightbox (dialog + scrim) |
|
|
104
|
+
|
|
105
|
+
Phase 2 — lobe-ecosystem counterparts, adopted when a family app needs them:
|
|
106
|
+
|
|
107
|
+
| lobe package | ZJ counterpart | Trigger |
|
|
108
|
+
| --------------------- | --------------------------------------------------------------------------------------- | ---------------------------- |
|
|
109
|
+
| `@lobehub/streamdown` | streaming Markdown over the Phase-1 renderer | ZJSearch AI-answer streaming |
|
|
110
|
+
| `@lobehub/charts` | lightweight SVG charts (Sparkline, BarList first) | first dashboard need |
|
|
111
|
+
| `@lobehub/editor` | CodeMirror wrapper | first code-editing need |
|
|
112
|
+
| `@lobehub/icons` | `FamilyMark` brand glyphs (blog/kvm/search/studio), lucide-react stays the UI icon peer | brand icon consolidation |
|
|
113
|
+
|
|
114
|
+
Governance per addition: playground demo + three-tier visual check + one consumer migrated before the fragment/component is declared stable.
|
|
115
|
+
|
|
116
|
+
## 8. Governance
|
|
94
117
|
|
|
95
118
|
1. Spec change → DESIGN.md (family) → tokens.css → release.
|
|
96
119
|
2. New fragment → fragments.ts + this doc §3 → release.
|
package/dist/brand/index.d.mts
CHANGED
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
import * as react0 from "react";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
|
|
4
|
+
//#region src/brand/FamilyMark.d.ts
|
|
5
|
+
|
|
6
|
+
/** The family brand-mark frame (ICON-FAMILY.md contract, golden geometry):
|
|
7
|
+
* viewBox `-8 -8 116 116` (≈15% optical margin), the glyph inked at
|
|
8
|
+
* stroke-width 14 with round caps inside the 10..92 optical box, the gold
|
|
9
|
+
* gradient `#f5c84c → #e09f0a` shared across the diagonal (10,10)-(92,92),
|
|
10
|
+
* and the family full stop — a solid circle at (85,85) r=7 — bottom-right.
|
|
11
|
+
* Product glyphs plug in as a `d` path (ZJBlog's single-stroke Z is the
|
|
12
|
+
* reference); `hideDot` renders the glyph alone. */
|
|
13
|
+
interface FamilyMarkProps {
|
|
14
|
+
/** SVG path `d` for the product glyph (stroke, not fill) */
|
|
15
|
+
glyph: string;
|
|
16
|
+
/** Rendered square size in px (viewBox scales proportionally) */
|
|
17
|
+
size?: number;
|
|
18
|
+
/** Accessible label (aria-hidden when omitted — decorative) */
|
|
19
|
+
label?: string;
|
|
20
|
+
/** Hide the family full stop (glyph-only lockup) */
|
|
21
|
+
hideDot?: boolean;
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
declare function FamilyMark({
|
|
25
|
+
glyph,
|
|
26
|
+
size,
|
|
27
|
+
label,
|
|
28
|
+
hideDot,
|
|
29
|
+
className
|
|
30
|
+
}: FamilyMarkProps): react0.JSX.Element;
|
|
31
|
+
/** Product glyphs registered per ICON-FAMILY.md (the family frame inverts:
|
|
32
|
+
* every product draws its letter inside the same optical box). */
|
|
33
|
+
declare const FAMILY_GLYPHS: {
|
|
34
|
+
/** ZJBlog: the single-stroke Z (reference glyph) */
|
|
35
|
+
readonly blog: "M17 17 H72 L17 72 H72";
|
|
36
|
+
};
|
|
37
|
+
//#endregion
|
|
4
38
|
//#region src/brand/Wordmark.d.ts
|
|
5
39
|
/** Family wordmark: serif logotype + the gold full stop (em-relative dot,
|
|
6
40
|
* scales with the wordmark font size — the family signature). */
|
|
@@ -16,4 +50,4 @@ declare function Wordmark({
|
|
|
16
50
|
dotClassName?: string;
|
|
17
51
|
}): react0.JSX.Element;
|
|
18
52
|
//#endregion
|
|
19
|
-
export { Wordmark };
|
|
53
|
+
export { FAMILY_GLYPHS, FamilyMark, type FamilyMarkProps, Wordmark };
|
package/dist/brand/index.mjs
CHANGED
|
@@ -1,6 +1,56 @@
|
|
|
1
|
-
import { V as cn, n as BRAND_DOT } from "../styles-
|
|
1
|
+
import { V as cn, n as BRAND_DOT } from "../styles-DsVothIU.mjs";
|
|
2
|
+
import { useId } from "react";
|
|
2
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
|
|
5
|
+
//#region src/brand/FamilyMark.tsx
|
|
6
|
+
function FamilyMark({ glyph, size = 30, label, hideDot = false, className }) {
|
|
7
|
+
const gradientId = useId();
|
|
8
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
9
|
+
"aria-hidden": label ? void 0 : true,
|
|
10
|
+
"aria-label": label,
|
|
11
|
+
className: cn("shrink-0", className),
|
|
12
|
+
fill: "none",
|
|
13
|
+
height: size,
|
|
14
|
+
role: label ? "img" : void 0,
|
|
15
|
+
viewBox: "-8 -8 116 116",
|
|
16
|
+
width: size,
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", {
|
|
19
|
+
gradientUnits: "userSpaceOnUse",
|
|
20
|
+
id: gradientId,
|
|
21
|
+
x1: "10",
|
|
22
|
+
x2: "92",
|
|
23
|
+
y1: "10",
|
|
24
|
+
y2: "92",
|
|
25
|
+
children: [/* @__PURE__ */ jsx("stop", {
|
|
26
|
+
offset: "0",
|
|
27
|
+
stopColor: "#f5c84c"
|
|
28
|
+
}), /* @__PURE__ */ jsx("stop", {
|
|
29
|
+
offset: "1",
|
|
30
|
+
stopColor: "#e09f0a"
|
|
31
|
+
})]
|
|
32
|
+
}) }),
|
|
33
|
+
/* @__PURE__ */ jsx("path", {
|
|
34
|
+
d: glyph,
|
|
35
|
+
stroke: `url(#${gradientId})`,
|
|
36
|
+
strokeLinecap: "round",
|
|
37
|
+
strokeLinejoin: "round",
|
|
38
|
+
strokeWidth: "14"
|
|
39
|
+
}),
|
|
40
|
+
!hideDot && /* @__PURE__ */ jsx("circle", {
|
|
41
|
+
cx: "85",
|
|
42
|
+
cy: "85",
|
|
43
|
+
fill: `url(#${gradientId})`,
|
|
44
|
+
r: "7"
|
|
45
|
+
})
|
|
46
|
+
]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/** Product glyphs registered per ICON-FAMILY.md (the family frame inverts:
|
|
50
|
+
* every product draws its letter inside the same optical box). */
|
|
51
|
+
const FAMILY_GLYPHS = { blog: "M17 17 H72 L17 72 H72" };
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
4
54
|
//#region src/brand/Wordmark.tsx
|
|
5
55
|
/** Family wordmark: serif logotype + the gold full stop (em-relative dot,
|
|
6
56
|
* scales with the wordmark font size — the family signature). */
|
|
@@ -15,4 +65,4 @@ function Wordmark({ children, className, dotClassName }) {
|
|
|
15
65
|
}
|
|
16
66
|
|
|
17
67
|
//#endregion
|
|
18
|
-
export { Wordmark };
|
|
68
|
+
export { FAMILY_GLYPHS, FamilyMark, Wordmark };
|
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, readThemeStyle, reducedMotion, setThemeStyle, useExitPresence, useTheme, watchSystemTheme, watchThemeDark };
|
|
1
|
+
import { _ as setThemeStyle, a as THEME_BOOTSTRAP, b as reducedMotion, c as THEME_COLOR_LIGHT, d as applyThemeStyle, f as cookieThemeStorage, g as readThemeStyle, h as nextThemeStyle, 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 watchSystemTheme, y as watchThemeDark } from "../index-BVN0e41g.mjs";
|
|
2
|
+
export { THEME_BOOTSTRAP, THEME_COLOR_BLACK, THEME_COLOR_DARK, THEME_COLOR_LIGHT, ThemeStorage, ThemeStyle, UseThemeOptions, UseThemeResult, applyThemeStyle, cookieThemeStorage, createThemeController, localStorageThemeStorage, nextThemeStyle, 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 nextThemeStyle, f as readThemeStyle, g as reducedMotion, h as watchThemeDark, i as THEME_COLOR_BLACK, l as createThemeController, m as watchSystemTheme, n as useExitPresence, o as THEME_COLOR_LIGHT, p as setThemeStyle, r as THEME_BOOTSTRAP, s as applyThemeStyle, t as useTheme, u as localStorageThemeStorage } from "../hooks-vpLVB3bc.mjs";
|
|
2
2
|
|
|
3
|
-
export { THEME_BOOTSTRAP, THEME_COLOR_BLACK, THEME_COLOR_DARK, THEME_COLOR_LIGHT, applyThemeStyle, cookieThemeStorage, createThemeController, localStorageThemeStorage, readThemeStyle, reducedMotion, setThemeStyle, useExitPresence, useTheme, watchSystemTheme, watchThemeDark };
|
|
3
|
+
export { THEME_BOOTSTRAP, THEME_COLOR_BLACK, THEME_COLOR_DARK, THEME_COLOR_LIGHT, applyThemeStyle, cookieThemeStorage, createThemeController, localStorageThemeStorage, nextThemeStyle, readThemeStyle, reducedMotion, setThemeStyle, useExitPresence, useTheme, watchSystemTheme, watchThemeDark };
|
|
@@ -97,12 +97,26 @@ const defaultController = /* @__PURE__ */ createThemeController();
|
|
|
97
97
|
const readThemeStyle = defaultController.readThemeStyle;
|
|
98
98
|
const applyThemeStyle = defaultController.applyThemeStyle;
|
|
99
99
|
const setThemeStyle = defaultController.setThemeStyle;
|
|
100
|
-
/**
|
|
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
|
+
/** In auto mode, follow the system light/dark switch in real time.
|
|
111
|
+
* Returns an unsubscribe function (call it on teardown). */
|
|
101
112
|
function watchSystemTheme(storage = localStorageThemeStorage()) {
|
|
102
|
-
window.matchMedia("(prefers-color-scheme: dark)")
|
|
113
|
+
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
114
|
+
const onChange = () => {
|
|
103
115
|
const controller = createThemeController(storage);
|
|
104
116
|
if (controller.readThemeStyle() === "auto") controller.applyThemeStyle("auto");
|
|
105
|
-
}
|
|
117
|
+
};
|
|
118
|
+
mq.addEventListener("change", onChange);
|
|
119
|
+
return () => mq.removeEventListener("change", onChange);
|
|
106
120
|
}
|
|
107
121
|
/** Subscribe to the dark state (html.dark is the single source of truth; both in-site
|
|
108
122
|
* toggles and system-follow flip it). Returns an unsubscribe function. Heavy theme
|
|
@@ -217,4 +231,4 @@ function useTheme({ storage = localStorageThemeStorage(), order = [
|
|
|
217
231
|
}
|
|
218
232
|
|
|
219
233
|
//#endregion
|
|
220
|
-
export { THEME_COLOR_DARK as a, cookieThemeStorage as c,
|
|
234
|
+
export { THEME_COLOR_DARK as a, cookieThemeStorage as c, nextThemeStyle as d, readThemeStyle as f, reducedMotion as g, watchThemeDark as h, THEME_COLOR_BLACK as i, createThemeController as l, watchSystemTheme as m, useExitPresence as n, THEME_COLOR_LIGHT as o, setThemeStyle as p, THEME_BOOTSTRAP as r, applyThemeStyle as s, useTheme as t, localStorageThemeStorage as u };
|
|
@@ -40,8 +40,12 @@ 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
|
-
/**
|
|
44
|
-
|
|
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
|
+
/** In auto mode, follow the system light/dark switch in real time.
|
|
47
|
+
* Returns an unsubscribe function (call it on teardown). */
|
|
48
|
+
declare function watchSystemTheme(storage?: ThemeStorage): () => void;
|
|
45
49
|
/** Subscribe to the dark state (html.dark is the single source of truth; both in-site
|
|
46
50
|
* toggles and system-follow flip it). Returns an unsubscribe function. Heavy theme
|
|
47
51
|
* dependencies (giscus iframe / mermaid re-render) hook in here — do not attach your own
|
|
@@ -98,4 +102,4 @@ declare function useTheme({
|
|
|
98
102
|
order
|
|
99
103
|
}?: UseThemeOptions): UseThemeResult;
|
|
100
104
|
//#endregion
|
|
101
|
-
export {
|
|
105
|
+
export { setThemeStyle as _, THEME_BOOTSTRAP as a, reducedMotion as b, THEME_COLOR_LIGHT as c, applyThemeStyle as d, cookieThemeStorage as f, readThemeStyle as g, nextThemeStyle 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, watchSystemTheme as v, watchThemeDark as y };
|