@hezhijie0327/zjdesign 0.1.4-d9fd3f1 → 0.1.4-e9e8a03

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 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): `./bump_version.sh [major|minor|patch|X.Y.Z]` (PowerShell twin: `bump_version.ps1`), then commit, tag `v<version>`, push — `.github/workflows/release.yml` gates on lint + typecheck + tests + build and publishes via the GitHub Actions OIDC token (requires the one-time "Trusted Publisher" binding on npmjs.com: repo `hezhijie0327/ZJDesign` + workflow `release.yml`; npm CLI ≥ 11.5.1, provided by Node 24). Provenance is automatic; the tag must match package.json. npm package names are lowercase — the scope is `@hezhijie0327`, package `zjdesign`.
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
 
@@ -1,6 +1,40 @@
1
- import * as react0 from "react";
1
+ import * as react3 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 `#F6C84C → #E2A318` 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): react3.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). */
@@ -14,6 +48,6 @@ declare function Wordmark({
14
48
  * navigation-bar scale — pass e.g. "text-xl" for compact bars */
15
49
  className?: string;
16
50
  dotClassName?: string;
17
- }): react0.JSX.Element;
51
+ }): react3.JSX.Element;
18
52
  //#endregion
19
- export { Wordmark };
53
+ export { FAMILY_GLYPHS, FamilyMark, type FamilyMarkProps, Wordmark };
@@ -1,6 +1,56 @@
1
- import { V as cn, n as BRAND_DOT } from "../styles-DhIa1Tm9.mjs";
1
+ import { V as cn, n as BRAND_DOT } from "../styles-CHlwZuC0.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: "#F6C84C"
28
+ }), /* @__PURE__ */ jsx("stop", {
29
+ offset: "1",
30
+ stopColor: "#E2A318"
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 };
@@ -0,0 +1,2 @@
1
+ import { n as MarkdownEditorProps, t as MarkdownEditor } from "../index-DZG-30Gw.mjs";
2
+ export { MarkdownEditor, MarkdownEditorProps };
@@ -0,0 +1,5 @@
1
+ import "../styles-CHlwZuC0.mjs";
2
+ import "../markdown-Cf8w0vog.mjs";
3
+ import { t as MarkdownEditor } from "../editor-DsqLcIUB.mjs";
4
+
5
+ export { MarkdownEditor };
@@ -0,0 +1,142 @@
1
+ import { V as cn } from "./styles-CHlwZuC0.mjs";
2
+ import { n as Markdown } from "./markdown-Cf8w0vog.mjs";
3
+ import { useRef } from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+
6
+ //#region src/editor/MarkdownEditor.tsx
7
+ function ToolWrap({ label, before, after, placeholder, onWrap, children }) {
8
+ return /* @__PURE__ */ jsx("button", {
9
+ "aria-label": label,
10
+ className: "grid size-7 place-items-center rounded-md text-ink-2 transition-colors hover:bg-surface-2 hover:text-ink",
11
+ onClick: () => onWrap(before, after, placeholder),
12
+ title: label,
13
+ type: "button",
14
+ children
15
+ });
16
+ }
17
+ function ToolPrefix({ label, onPrefixLines, children }) {
18
+ return /* @__PURE__ */ jsx("button", {
19
+ "aria-label": label,
20
+ className: "grid size-7 place-items-center rounded-md text-ink-2 transition-colors hover:bg-surface-2 hover:text-ink",
21
+ onClick: () => onPrefixLines("- "),
22
+ title: label,
23
+ type: "button",
24
+ children
25
+ });
26
+ }
27
+ /** The family markdown editor: a plain textarea (always reliable input)
28
+ * with a syntax toolbar that wraps/prefixes the selection, and an optional
29
+ * live preview rendered through the package Markdown component. The
30
+ * textarea stays the single source of truth — no contenteditable state. */
31
+ function MarkdownEditor({ value, onChange, placeholder, toolbar = true, preview = false, rows = 10, label, className }) {
32
+ const areaRef = useRef(null);
33
+ const wrap = (before, after, fallback) => {
34
+ const area = areaRef.current;
35
+ if (!area) return;
36
+ const start = area.selectionStart;
37
+ const end = area.selectionEnd;
38
+ const inner = value.slice(start, end) || fallback;
39
+ onChange(value.slice(0, start) + before + inner + after + value.slice(end));
40
+ requestAnimationFrame(() => {
41
+ area.focus();
42
+ area.setSelectionRange(start + before.length + inner.length, start + before.length + inner.length);
43
+ });
44
+ };
45
+ const prefixLines = (prefix) => {
46
+ const area = areaRef.current;
47
+ if (!area) return;
48
+ const lineStart = value.lastIndexOf("\n", area.selectionStart - 1) + 1;
49
+ const prefixed = value.slice(lineStart, area.selectionEnd).split("\n").map((line) => line.startsWith(prefix) ? line : prefix + line).join("\n");
50
+ onChange(value.slice(0, lineStart) + prefixed + value.slice(area.selectionEnd));
51
+ };
52
+ return /* @__PURE__ */ jsxs("div", {
53
+ className: cn("rounded-xl border border-line bg-surface focus-within:border-ink-3/40", className),
54
+ children: [
55
+ toolbar && /* @__PURE__ */ jsxs("div", {
56
+ className: "flex items-center gap-0.5 border-b border-line/70 px-2 py-1.5",
57
+ children: [
58
+ /* @__PURE__ */ jsx(ToolWrap, {
59
+ after: "**",
60
+ before: "**",
61
+ label: "Bold",
62
+ onWrap: wrap,
63
+ placeholder: "bold text",
64
+ children: /* @__PURE__ */ jsx("span", {
65
+ className: "font-bold",
66
+ children: "B"
67
+ })
68
+ }),
69
+ /* @__PURE__ */ jsx(ToolWrap, {
70
+ after: "*",
71
+ before: "*",
72
+ label: "Italic",
73
+ onWrap: wrap,
74
+ placeholder: "italic text",
75
+ children: /* @__PURE__ */ jsx("span", {
76
+ className: "italic",
77
+ children: "I"
78
+ })
79
+ }),
80
+ /* @__PURE__ */ jsx(ToolWrap, {
81
+ after: "~~",
82
+ before: "~~",
83
+ label: "Strikethrough",
84
+ onWrap: wrap,
85
+ placeholder: "strike",
86
+ children: /* @__PURE__ */ jsx("span", {
87
+ className: "line-through",
88
+ children: "S"
89
+ })
90
+ }),
91
+ /* @__PURE__ */ jsx(ToolWrap, {
92
+ after: "`",
93
+ before: "`",
94
+ label: "Inline code",
95
+ onWrap: wrap,
96
+ placeholder: "code",
97
+ children: /* @__PURE__ */ jsx("span", {
98
+ className: "font-mono text-xs",
99
+ children: "</>"
100
+ })
101
+ }),
102
+ /* @__PURE__ */ jsx("span", { className: "mx-0.5 h-5 w-px bg-line" }),
103
+ /* @__PURE__ */ jsx(ToolPrefix, {
104
+ label: "Bullet list",
105
+ onPrefixLines: prefixLines,
106
+ children: /* @__PURE__ */ jsx("span", {
107
+ className: "text-xs",
108
+ children: "•—"
109
+ })
110
+ }),
111
+ /* @__PURE__ */ jsx(ToolPrefix, {
112
+ label: "Quote",
113
+ onPrefixLines: prefixLines,
114
+ children: /* @__PURE__ */ jsx("span", {
115
+ className: "text-xs",
116
+ children: "❝"
117
+ })
118
+ })
119
+ ]
120
+ }),
121
+ /* @__PURE__ */ jsx("textarea", {
122
+ "aria-label": label,
123
+ className: "w-full resize-y bg-transparent p-3 font-mono text-sm leading-relaxed text-ink outline-none placeholder:text-ink-3",
124
+ onChange: (event) => onChange(event.target.value),
125
+ placeholder,
126
+ ref: areaRef,
127
+ rows,
128
+ value
129
+ }),
130
+ preview && /* @__PURE__ */ jsx("div", {
131
+ className: "border-t border-line/70 p-3",
132
+ children: /* @__PURE__ */ jsx(Markdown, {
133
+ className: "text-sm",
134
+ children: value
135
+ })
136
+ })
137
+ ]
138
+ });
139
+ }
140
+
141
+ //#endregion
142
+ export { MarkdownEditor as t };
@@ -0,0 +1,11 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100">
2
+ <title>ZJBlog</title>
3
+ <defs>
4
+ <linearGradient id="zjBlogGrad" x1="0%" y1="0%" x2="100%" y2="100%">
5
+ <stop offset="0%" stop-color="#F6C84C" />
6
+ <stop offset="100%" stop-color="#E2A318" />
7
+ </linearGradient>
8
+ </defs>
9
+ <path d="M 22 22 H 76 L 22 74 H 56" fill="none" stroke="url(#zjBlogGrad)" stroke-width="13" stroke-linecap="round" stroke-linejoin="round" />
10
+ <circle cx="81" cy="81" r="8" fill="#E2A318" />
11
+ </svg>
@@ -0,0 +1,12 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100">
2
+ <title>ZJDesign</title>
3
+ <defs>
4
+ <linearGradient id="zjDesignGrad" x1="0%" y1="0%" x2="100%" y2="100%">
5
+ <stop offset="0%" stop-color="#F6C84C" />
6
+ <stop offset="100%" stop-color="#E2A318" />
7
+ </linearGradient>
8
+ </defs>
9
+ <rect x="18" y="18" width="42" height="64" rx="8" fill="url(#zjDesignGrad)" />
10
+ <rect x="70" y="18" width="14" height="44" rx="7" fill="url(#zjDesignGrad)" />
11
+ <circle cx="81" cy="81" r="8" fill="#E2A318" />
12
+ </svg>
@@ -0,0 +1,12 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100">
2
+ <title>ZJKVM</title>
3
+ <defs>
4
+ <linearGradient id="zjKvmGrad" x1="0%" y1="0%" x2="100%" y2="100%">
5
+ <stop offset="0%" stop-color="#F6C84C" />
6
+ <stop offset="100%" stop-color="#E2A318" />
7
+ </linearGradient>
8
+ </defs>
9
+ <path d="M 78 55 V 27 A 11 11 0 0 0 67 16 H 26 A 11 11 0 0 0 15 27 V 63 A 11 11 0 0 0 26 74 H 60" fill="none" stroke="url(#zjKvmGrad)" stroke-width="10.5" stroke-linecap="round" stroke-linejoin="round" />
10
+ <path d="M 32 37 L 45 45 L 32 53" fill="none" stroke="url(#zjKvmGrad)" stroke-width="10" stroke-linecap="round" stroke-linejoin="round" />
11
+ <circle cx="81" cy="81" r="8" fill="#E2A318" />
12
+ </svg>
@@ -0,0 +1,12 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100">
2
+ <title>ZJSearch</title>
3
+ <defs>
4
+ <linearGradient id="zjSearchGrad" x1="0%" y1="0%" x2="100%" y2="100%">
5
+ <stop offset="0%" stop-color="#F6C84C" />
6
+ <stop offset="100%" stop-color="#E2A318" />
7
+ </linearGradient>
8
+ </defs>
9
+ <circle cx="42" cy="42" r="22" fill="none" stroke="url(#zjSearchGrad)" stroke-width="13" />
10
+ <line x1="58" y1="58" x2="68" y2="68" stroke="url(#zjSearchGrad)" stroke-width="13" stroke-linecap="round" />
11
+ <circle cx="81" cy="81" r="8" fill="#E2A318" />
12
+ </svg>
@@ -0,0 +1,11 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100">
2
+ <title>ZJStudio</title>
3
+ <defs>
4
+ <linearGradient id="zjStudioGrad" x1="0%" y1="0%" x2="100%" y2="100%">
5
+ <stop offset="0%" stop-color="#F6C84C" />
6
+ <stop offset="100%" stop-color="#E2A318" />
7
+ </linearGradient>
8
+ </defs>
9
+ <path d="M 45 14 C 48 34, 58 44, 76 45 C 58 48, 48 58, 45 76 C 42 58, 32 48, 14 45 C 32 44, 42 34, 45 14 Z" fill="url(#zjStudioGrad)" stroke="url(#zjStudioGrad)" stroke-width="4" stroke-linejoin="round" />
10
+ <circle cx="81" cy="81" r="8" fill="#E2A318" />
11
+ </svg>
@@ -1,2 +1,2 @@
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-BOksroiF.mjs";
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-q0kgAj_t.mjs";
2
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 };
@@ -1,3 +1,3 @@
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-Clenmhj0.mjs";
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-CIPeAyTY.mjs";
2
2
 
3
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 };
@@ -0,0 +1,33 @@
1
+ import * as react0 from "react";
2
+ import { ReactNode } from "react";
3
+
4
+ //#region src/editor/MarkdownEditor.d.ts
5
+ interface MarkdownEditorProps {
6
+ value: string;
7
+ onChange: (value: string) => void;
8
+ placeholder?: string;
9
+ /** Show the markdown toolbar (default on) */
10
+ toolbar?: boolean;
11
+ /** Show a live markdown preview under the editor (default off) */
12
+ preview?: boolean;
13
+ rows?: number;
14
+ /** Accessible label for the textarea */
15
+ label: string;
16
+ className?: string;
17
+ }
18
+ /** The family markdown editor: a plain textarea (always reliable input)
19
+ * with a syntax toolbar that wraps/prefixes the selection, and an optional
20
+ * live preview rendered through the package Markdown component. The
21
+ * textarea stays the single source of truth — no contenteditable state. */
22
+ declare function MarkdownEditor({
23
+ value,
24
+ onChange,
25
+ placeholder,
26
+ toolbar,
27
+ preview,
28
+ rows,
29
+ label,
30
+ className
31
+ }: MarkdownEditorProps): react0.JSX.Element;
32
+ //#endregion
33
+ export { MarkdownEditorProps as n, MarkdownEditor as t };