@downcity/icons 0.0.0 → 0.1.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/LICENSE +21 -0
- package/README.md +129 -0
- package/dist/chunk-23CDBVGX.js +13 -0
- package/dist/chunk-2BUJ7TVT.js +13 -0
- package/dist/chunk-2DWFGABM.js +24 -0
- package/dist/chunk-2TKTX3CU.js +26 -0
- package/dist/chunk-3FPF7LCI.js +13 -0
- package/dist/chunk-4UIJEWGF.js +23 -0
- package/dist/chunk-6GGYGTKE.js +13 -0
- package/dist/chunk-6RDGLI7R.js +13 -0
- package/dist/chunk-76UOULDL.js +27 -0
- package/dist/chunk-7H5NSSU6.js +13 -0
- package/dist/chunk-7UIG6EFZ.js +13 -0
- package/dist/chunk-BGO2END2.js +23 -0
- package/dist/chunk-CNJMWVEG.js +23 -0
- package/dist/chunk-DKPGA424.js +13 -0
- package/dist/chunk-DKZZG6QO.js +28 -0
- package/dist/chunk-HGNHV53V.js +25 -0
- package/dist/chunk-HWU63TFP.js +13 -0
- package/dist/chunk-HXOYIUQQ.js +24 -0
- package/dist/chunk-ILAFNOCW.js +16 -0
- package/dist/chunk-IQTKODNC.js +33 -0
- package/dist/chunk-IXCWDNK2.js +13 -0
- package/dist/chunk-K3DUWMQO.js +13 -0
- package/dist/chunk-KPDMGF4F.js +13 -0
- package/dist/chunk-KU34JGIO.js +31 -0
- package/dist/chunk-NBGN6WVE.js +24 -0
- package/dist/chunk-NDRETNEW.js +27 -0
- package/dist/chunk-NUT4AMSX.js +13 -0
- package/dist/chunk-NVOG4T3W.js +12 -0
- package/dist/chunk-O3KGMKUU.js +27 -0
- package/dist/chunk-OCZC6LVQ.js +29 -0
- package/dist/chunk-OKTJS2IX.js +57 -0
- package/dist/chunk-PDJIQEFH.js +27 -0
- package/dist/chunk-PFCSIXEJ.js +13 -0
- package/dist/chunk-R2IGXQRH.js +33 -0
- package/dist/chunk-R5Q73DLS.js +13 -0
- package/dist/chunk-RPUE7IHD.js +13 -0
- package/dist/chunk-RVFXW6ME.js +13 -0
- package/dist/chunk-RXYMPDOI.js +23 -0
- package/dist/chunk-S6ZGAMKH.js +25 -0
- package/dist/chunk-SGB2OQAT.js +13 -0
- package/dist/chunk-SXQXPUXP.js +97 -0
- package/dist/chunk-T6BSLNMN.js +54 -0
- package/dist/chunk-TMDEAPHD.js +24 -0
- package/dist/chunk-V3E6IXCE.js +24 -0
- package/dist/chunk-VWZK6FRQ.js +29 -0
- package/dist/chunk-WTAG3WKQ.js +13 -0
- package/dist/chunk-WUXNEKAA.js +13 -0
- package/dist/chunk-WWHMK4UP.js +154 -0
- package/dist/chunk-XV63DEGU.js +13 -0
- package/dist/chunk-ZLZMMRSY.js +13 -0
- package/dist/chunk-ZP2ZAJYJ.js +23 -0
- package/dist/chunk-ZY2G74T6.js +13 -0
- package/dist/definition-CueRRK0O.d.ts +111 -0
- package/dist/definitions/check.d.ts +7 -0
- package/dist/definitions/check.js +10 -0
- package/dist/definitions/chevron-down.d.ts +7 -0
- package/dist/definitions/chevron-down.js +10 -0
- package/dist/definitions/close.d.ts +7 -0
- package/dist/definitions/close.js +10 -0
- package/dist/definitions/copy.d.ts +7 -0
- package/dist/definitions/copy.js +10 -0
- package/dist/definitions/file.d.ts +7 -0
- package/dist/definitions/file.js +7 -0
- package/dist/definitions/folder.d.ts +7 -0
- package/dist/definitions/folder.js +7 -0
- package/dist/definitions/inbox.d.ts +7 -0
- package/dist/definitions/inbox.js +7 -0
- package/dist/definitions/loader.d.ts +7 -0
- package/dist/definitions/loader.js +9 -0
- package/dist/definitions/mail.d.ts +7 -0
- package/dist/definitions/mail.js +7 -0
- package/dist/definitions/memory.d.ts +7 -0
- package/dist/definitions/memory.js +7 -0
- package/dist/definitions/message.d.ts +7 -0
- package/dist/definitions/message.js +7 -0
- package/dist/definitions/messenger.d.ts +7 -0
- package/dist/definitions/messenger.js +7 -0
- package/dist/definitions/more.d.ts +7 -0
- package/dist/definitions/more.js +6 -0
- package/dist/definitions/plus.d.ts +7 -0
- package/dist/definitions/plus.js +7 -0
- package/dist/definitions/search.d.ts +7 -0
- package/dist/definitions/search.js +7 -0
- package/dist/definitions/session.d.ts +7 -0
- package/dist/definitions/session.js +8 -0
- package/dist/definitions/settings.d.ts +7 -0
- package/dist/definitions/settings.js +7 -0
- package/dist/definitions/skill.d.ts +7 -0
- package/dist/definitions/skill.js +7 -0
- package/dist/definitions/task-check.d.ts +7 -0
- package/dist/definitions/task-check.js +10 -0
- package/dist/definitions/task.d.ts +7 -0
- package/dist/definitions/task.js +7 -0
- package/dist/definitions/terminal.d.ts +7 -0
- package/dist/definitions/terminal.js +10 -0
- package/dist/definitions/web.d.ts +7 -0
- package/dist/definitions/web.js +7 -0
- package/dist/definitions/workspace.d.ts +7 -0
- package/dist/definitions/workspace.js +7 -0
- package/dist/index.d.ts +84 -0
- package/dist/index.js +51 -0
- package/dist/react/icons/check.d.ts +7 -0
- package/dist/react/icons/check.js +13 -0
- package/dist/react/icons/chevron-down.d.ts +7 -0
- package/dist/react/icons/chevron-down.js +13 -0
- package/dist/react/icons/close.d.ts +7 -0
- package/dist/react/icons/close.js +13 -0
- package/dist/react/icons/copy.d.ts +7 -0
- package/dist/react/icons/copy.js +13 -0
- package/dist/react/icons/file.d.ts +7 -0
- package/dist/react/icons/file.js +11 -0
- package/dist/react/icons/folder.d.ts +7 -0
- package/dist/react/icons/folder.js +11 -0
- package/dist/react/icons/inbox.d.ts +7 -0
- package/dist/react/icons/inbox.js +11 -0
- package/dist/react/icons/loader.d.ts +7 -0
- package/dist/react/icons/loader.js +12 -0
- package/dist/react/icons/mail.d.ts +7 -0
- package/dist/react/icons/mail.js +11 -0
- package/dist/react/icons/memory.d.ts +7 -0
- package/dist/react/icons/memory.js +11 -0
- package/dist/react/icons/message.d.ts +7 -0
- package/dist/react/icons/message.js +11 -0
- package/dist/react/icons/messenger.d.ts +7 -0
- package/dist/react/icons/messenger.js +11 -0
- package/dist/react/icons/more.d.ts +7 -0
- package/dist/react/icons/more.js +11 -0
- package/dist/react/icons/plus.d.ts +7 -0
- package/dist/react/icons/plus.js +11 -0
- package/dist/react/icons/search.d.ts +7 -0
- package/dist/react/icons/search.js +11 -0
- package/dist/react/icons/session.d.ts +7 -0
- package/dist/react/icons/session.js +11 -0
- package/dist/react/icons/settings.d.ts +7 -0
- package/dist/react/icons/settings.js +11 -0
- package/dist/react/icons/skill.d.ts +7 -0
- package/dist/react/icons/skill.js +11 -0
- package/dist/react/icons/task-check.d.ts +7 -0
- package/dist/react/icons/task-check.js +13 -0
- package/dist/react/icons/task.d.ts +7 -0
- package/dist/react/icons/task.js +11 -0
- package/dist/react/icons/terminal.d.ts +7 -0
- package/dist/react/icons/terminal.js +13 -0
- package/dist/react/icons/web.d.ts +7 -0
- package/dist/react/icons/web.js +11 -0
- package/dist/react/icons/workspace.d.ts +7 -0
- package/dist/react/icons/workspace.js +11 -0
- package/dist/react/index.d.ts +26 -0
- package/dist/react/index.js +123 -0
- package/dist/react-D-Ingc4F.d.ts +29 -0
- package/dist/registry.d.ts +7 -0
- package/dist/registry.js +83 -0
- package/dist/static/check-layered.svg +1 -0
- package/dist/static/check.svg +1 -0
- package/dist/static/chevron-down-layered.svg +1 -0
- package/dist/static/chevron-down.svg +1 -0
- package/dist/static/close-layered.svg +1 -0
- package/dist/static/close.svg +1 -0
- package/dist/static/copy-layered.svg +1 -0
- package/dist/static/copy.svg +1 -0
- package/dist/static/file-layered.svg +1 -0
- package/dist/static/file.svg +1 -0
- package/dist/static/folder-layered.svg +1 -0
- package/dist/static/folder.svg +1 -0
- package/dist/static/inbox-layered.svg +1 -0
- package/dist/static/inbox.svg +1 -0
- package/dist/static/loader-layered.svg +1 -0
- package/dist/static/loader.svg +1 -0
- package/dist/static/mail-layered.svg +1 -0
- package/dist/static/mail.svg +1 -0
- package/dist/static/memory-layered.svg +1 -0
- package/dist/static/memory.svg +1 -0
- package/dist/static/message-layered.svg +1 -0
- package/dist/static/message.svg +1 -0
- package/dist/static/messenger-layered.svg +1 -0
- package/dist/static/messenger.svg +1 -0
- package/dist/static/more-layered.svg +1 -0
- package/dist/static/more.svg +1 -0
- package/dist/static/plus-layered.svg +1 -0
- package/dist/static/plus.svg +1 -0
- package/dist/static/search-layered.svg +1 -0
- package/dist/static/search.svg +1 -0
- package/dist/static/session-layered.svg +1 -0
- package/dist/static/session.svg +1 -0
- package/dist/static/settings-layered.svg +1 -0
- package/dist/static/settings.svg +1 -0
- package/dist/static/skill-layered.svg +1 -0
- package/dist/static/skill.svg +1 -0
- package/dist/static/task-check-layered.svg +1 -0
- package/dist/static/task-check.svg +1 -0
- package/dist/static/task-layered.svg +1 -0
- package/dist/static/task.svg +1 -0
- package/dist/static/terminal-layered.svg +1 -0
- package/dist/static/terminal.svg +1 -0
- package/dist/static/web-layered.svg +1 -0
- package/dist/static/web.svg +1 -0
- package/dist/static/workspace-layered.svg +1 -0
- package/dist/static/workspace.svg +1 -0
- package/package.json +59 -2
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import {
|
|
2
|
+
evaluate_icon,
|
|
3
|
+
react_prefix,
|
|
4
|
+
surface_defs,
|
|
5
|
+
surface_fill,
|
|
6
|
+
surface_paint
|
|
7
|
+
} from "./chunk-SXQXPUXP.js";
|
|
8
|
+
import {
|
|
9
|
+
default_motion,
|
|
10
|
+
validate_motion
|
|
11
|
+
} from "./chunk-T6BSLNMN.js";
|
|
12
|
+
import {
|
|
13
|
+
icon_tokens
|
|
14
|
+
} from "./chunk-O3KGMKUU.js";
|
|
15
|
+
|
|
16
|
+
// src/react/create_icon.tsx
|
|
17
|
+
import { forwardRef, useId } from "react";
|
|
18
|
+
|
|
19
|
+
// src/react/use_icon_motion.ts
|
|
20
|
+
import { useEffect, useRef, useState } from "react";
|
|
21
|
+
function use_icon_motion({ motion, active, play_key, base_progress, running, duration, cycle = false }) {
|
|
22
|
+
const target = active ? 1 : base_progress;
|
|
23
|
+
const [progress, set_progress] = useState(target);
|
|
24
|
+
const current = useRef(target);
|
|
25
|
+
const previous_key = useRef(play_key);
|
|
26
|
+
const first_effect = useRef(true);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
let frame;
|
|
29
|
+
let disposed = false;
|
|
30
|
+
let local_progress = current.current;
|
|
31
|
+
const replay = !first_effect.current && previous_key.current !== play_key && active === void 0;
|
|
32
|
+
previous_key.current = play_key;
|
|
33
|
+
first_effect.current = false;
|
|
34
|
+
if (motion === "off") {
|
|
35
|
+
current.current = target;
|
|
36
|
+
set_progress(target);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const query = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
40
|
+
const assign = (value) => {
|
|
41
|
+
if (disposed) return;
|
|
42
|
+
local_progress = value;
|
|
43
|
+
current.current = value;
|
|
44
|
+
set_progress(value);
|
|
45
|
+
};
|
|
46
|
+
const cancel = () => {
|
|
47
|
+
if (frame !== void 0) window.cancelAnimationFrame(frame);
|
|
48
|
+
frame = void 0;
|
|
49
|
+
};
|
|
50
|
+
const start = (allow_replay) => {
|
|
51
|
+
cancel();
|
|
52
|
+
if (motion !== "auto" || query.matches || document.hidden) {
|
|
53
|
+
assign(target);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
let started_at;
|
|
57
|
+
const from = allow_replay && cycle ? 0 : local_progress;
|
|
58
|
+
if (allow_replay && cycle) assign(0);
|
|
59
|
+
const tick = (time) => {
|
|
60
|
+
if (disposed) return;
|
|
61
|
+
started_at ??= time;
|
|
62
|
+
const elapsed = time - started_at;
|
|
63
|
+
if (running) {
|
|
64
|
+
assign((from + elapsed / duration) % 1);
|
|
65
|
+
frame = window.requestAnimationFrame(tick);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (allow_replay && cycle) {
|
|
69
|
+
const t2 = Math.min(1, elapsed / duration);
|
|
70
|
+
assign(t2);
|
|
71
|
+
if (t2 < 1) frame = window.requestAnimationFrame(tick);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (allow_replay) {
|
|
75
|
+
const outward = duration * (1 - from);
|
|
76
|
+
const inward = duration * (1 - target);
|
|
77
|
+
const total = outward + inward;
|
|
78
|
+
assign(elapsed < outward ? from + elapsed / duration : Math.max(target, 1 - (elapsed - outward) / duration));
|
|
79
|
+
if (elapsed < total) frame = window.requestAnimationFrame(tick);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const t = Math.min(1, elapsed / Math.max(1, duration * Math.abs(target - from)));
|
|
83
|
+
assign(from + (target - from) * t);
|
|
84
|
+
if (t < 1) frame = window.requestAnimationFrame(tick);
|
|
85
|
+
};
|
|
86
|
+
if (running || allow_replay || from !== target) frame = window.requestAnimationFrame(tick);
|
|
87
|
+
};
|
|
88
|
+
const on_environment_change = () => start(false);
|
|
89
|
+
query.addEventListener("change", on_environment_change);
|
|
90
|
+
document.addEventListener("visibilitychange", on_environment_change);
|
|
91
|
+
start(replay);
|
|
92
|
+
return () => {
|
|
93
|
+
disposed = true;
|
|
94
|
+
cancel();
|
|
95
|
+
query.removeEventListener("change", on_environment_change);
|
|
96
|
+
document.removeEventListener("visibilitychange", on_environment_change);
|
|
97
|
+
};
|
|
98
|
+
}, [motion, active, play_key, base_progress, running, target, duration, cycle]);
|
|
99
|
+
return motion === "off" ? target : progress;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// src/react/create_icon.tsx
|
|
103
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
104
|
+
function create_icon(definition) {
|
|
105
|
+
const Component = forwardRef((input, ref) => {
|
|
106
|
+
const { title, motion = "off", motion_spec = definition.motion ?? default_motion, active, play_key, ...remaining } = input;
|
|
107
|
+
const { variant = "outline", state = "rest", running = false, ...svg_props } = remaining;
|
|
108
|
+
if (state !== "rest" && !(definition.id === "folder" && state === "open")) throw new TypeError("\u4E0D\u652F\u6301\u7684\u56FE\u6807\u72B6\u6001");
|
|
109
|
+
validate_motion(motion_spec);
|
|
110
|
+
const progress = use_icon_motion({
|
|
111
|
+
duration: motion_spec.duration,
|
|
112
|
+
cycle: definition.motion_cycle,
|
|
113
|
+
motion: definition.motion_enabled === false ? "off" : motion,
|
|
114
|
+
active,
|
|
115
|
+
play_key,
|
|
116
|
+
base_progress: state === "open" ? 1 : 0,
|
|
117
|
+
running: !!definition.continuous && running
|
|
118
|
+
});
|
|
119
|
+
const nodes = evaluate_icon(definition, progress, variant, motion_spec);
|
|
120
|
+
const prefix = react_prefix(useId());
|
|
121
|
+
const resources = nodes.some((node) => node.surface || node.shadow);
|
|
122
|
+
return /* @__PURE__ */ jsxs(
|
|
123
|
+
"svg",
|
|
124
|
+
{
|
|
125
|
+
width: "1em",
|
|
126
|
+
height: "1em",
|
|
127
|
+
viewBox: definition.view_box?.join(" ") ?? "0 0 24 24",
|
|
128
|
+
fill: "none",
|
|
129
|
+
stroke: variant === "outline" ? "currentColor" : surface_paint("edge", definition.materials),
|
|
130
|
+
strokeWidth: icon_tokens.stroke.boundary,
|
|
131
|
+
strokeLinecap: "round",
|
|
132
|
+
strokeLinejoin: "round",
|
|
133
|
+
...svg_props,
|
|
134
|
+
ref,
|
|
135
|
+
focusable: "false",
|
|
136
|
+
tabIndex: void 0,
|
|
137
|
+
role: title ? "img" : svg_props.role,
|
|
138
|
+
"aria-hidden": title ? void 0 : svg_props["aria-label"] || svg_props["aria-labelledby"] ? void 0 : true,
|
|
139
|
+
"aria-label": title || svg_props["aria-label"],
|
|
140
|
+
children: [
|
|
141
|
+
title ? /* @__PURE__ */ jsx("title", { children: title }) : null,
|
|
142
|
+
resources ? /* @__PURE__ */ jsx("defs", { dangerouslySetInnerHTML: { __html: surface_defs(prefix, definition.materials) } }) : null,
|
|
143
|
+
nodes.map((node) => /* @__PURE__ */ jsx("path", { d: node.d, fill: surface_fill(node, prefix, definition.materials), filter: node.shadow ? `url(#${prefix}-contact)` : void 0, opacity: node.opacity, stroke: node.no_stroke ? "none" : surface_paint(node.stroke, definition.materials), strokeWidth: node.stroke_width }, node.key))
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
});
|
|
148
|
+
Component.displayName = `${definition.id}Icon`;
|
|
149
|
+
return Component;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export {
|
|
153
|
+
create_icon
|
|
154
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
static_tokens
|
|
3
|
+
} from "./chunk-O3KGMKUU.js";
|
|
4
|
+
|
|
5
|
+
// src/definitions/memory.ts
|
|
6
|
+
var memory_definition = {
|
|
7
|
+
id: "memory",
|
|
8
|
+
label: "\u8BB0\u5FC6",
|
|
9
|
+
layered: true,
|
|
10
|
+
materials: "core",
|
|
11
|
+
motion_enabled: false,
|
|
12
|
+
draw: ({ variant }) => {
|
|
13
|
+
const outline = variant === "outline";
|
|
14
|
+
return [
|
|
15
|
+
{ key: "front", part: "front", tag: "path", d: "M17 7 Q17 9 12 9 Q7 9 7 7 Q7 5 12 5 Q17 5 17 7 Z", ...outline ? { stroke_width: static_tokens.stroke.detail } : { fill: "front", no_stroke: true } },
|
|
16
|
+
{ key: "contour", part: "back", tag: "path", d: "M5 6 Q5 3.5 12 3.5 Q19 3.5 19 6 V18 Q19 20.5 12 20.5 Q5 20.5 5 18 Z", stroke: "currentColor", stroke_width: outline ? static_tokens.stroke.outline : static_tokens.stroke.color_contour }
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
memory_definition
|
|
23
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/** 有限的时间协议;时钟由调用方拥有,形变由图形定义拥有。 */
|
|
2
|
+
|
|
3
|
+
interface MotionTrack {
|
|
4
|
+
/** 相对线性时间的开始位置,范围 0–1。 */
|
|
5
|
+
start: number;
|
|
6
|
+
/** 相对线性时间的结束位置,必须大于 start 且不超过 1。 */
|
|
7
|
+
end: number;
|
|
8
|
+
}
|
|
9
|
+
interface MotionSpec {
|
|
10
|
+
/** 单程时长(毫秒),80–2000;单次往返使用两程。 */
|
|
11
|
+
duration: number;
|
|
12
|
+
/** CSS cubic-bezier 控制点;四值限定 0–1,避免越界/弹性姿态。 */
|
|
13
|
+
cubic_bezier: readonly [number, number, number, number];
|
|
14
|
+
/** 几何力度 0–1.5;零保持静止,不扩张时间进度。 */
|
|
15
|
+
amplitude: number;
|
|
16
|
+
/** 按视觉部件覆盖时段;缺省部件使用完整时段。 */
|
|
17
|
+
tracks: Readonly<Partial<Record<IconPart, MotionTrack>>>;
|
|
18
|
+
}
|
|
19
|
+
interface IconMotionFrame {
|
|
20
|
+
/** 各部件时段内的线性时间,供因果阶段求值;不重复整体缓动。 */
|
|
21
|
+
times: Readonly<Record<IconPart, number>>;
|
|
22
|
+
/** 已验证曲线,阶段内复用;不允许几何余韵放宽控制点边界。 */
|
|
23
|
+
curve: CubicBezier;
|
|
24
|
+
/** 全程缓动姿态;不等于线性时间。 */
|
|
25
|
+
progress: number;
|
|
26
|
+
/** 各部件在各自时段内的缓动姿态,均为 0–1。 */
|
|
27
|
+
parts: Readonly<Record<IconPart, number>>;
|
|
28
|
+
/** 几何层的运动力度,绝不用于扩张 progress。 */
|
|
29
|
+
amplitude: number;
|
|
30
|
+
}
|
|
31
|
+
/** 调校台复用的有限贝塞尔参数类型。 */
|
|
32
|
+
type CubicBezier = MotionSpec["cubic_bezier"];
|
|
33
|
+
|
|
34
|
+
/** 图标的纯数据协议;不依赖 React、DOM 或业务状态。 */
|
|
35
|
+
|
|
36
|
+
type IconVariant = "outline" | "layered";
|
|
37
|
+
type IconState = "rest" | "open";
|
|
38
|
+
/** 材质角色只从 currentColor 派生;不允许定义注入任意 CSS。 */
|
|
39
|
+
type IconPaint = "currentColor" | "none" | "back" | "front" | "paper" | "edge" | "ink" | "highlight";
|
|
40
|
+
/** 视觉部件,不等于 path 数量;预览按该字段拆解真实图层。 */
|
|
41
|
+
type IconPart = "back" | "content" | "front" | "detail";
|
|
42
|
+
interface IconNode {
|
|
43
|
+
/** 稳定节点标识,用于 React key 与静态输出的一致性。 */
|
|
44
|
+
key: string;
|
|
45
|
+
/** 一期只开放路径,避免任意 SVG/HTML 注入。 */
|
|
46
|
+
tag: "path";
|
|
47
|
+
/** SVG 路径,由原创纯几何函数生成。 */
|
|
48
|
+
d: string;
|
|
49
|
+
/** 视觉角色;缺省为独立线条。 */
|
|
50
|
+
part?: IconPart;
|
|
51
|
+
/** 只允许继承色、无填充或有限的色彩角色。 */
|
|
52
|
+
fill?: IconPaint;
|
|
53
|
+
/** 可选独立描边角色;未指定时继承根。 */
|
|
54
|
+
stroke?: IconPaint;
|
|
55
|
+
/** 语义线重;轮廓1.75/1.5,材质细边/内容/亮边见icon_tokens。 */
|
|
56
|
+
stroke_width?: number;
|
|
57
|
+
/** 有限纵向材质渐变;仅接受三种表面,不能传入任意URL。 */
|
|
58
|
+
surface?: "back" | "front" | "paper";
|
|
59
|
+
/** 本节点使用共享接触软影;不允许任意filter表达式。 */
|
|
60
|
+
shadow?: boolean;
|
|
61
|
+
/** 可选弱面透明度,不承载唯一语义。 */
|
|
62
|
+
opacity?: number;
|
|
63
|
+
/** 是否关闭本节点描边;默认继承根描边。 */
|
|
64
|
+
no_stroke?: boolean;
|
|
65
|
+
}
|
|
66
|
+
interface IconFrame extends IconMotionFrame {
|
|
67
|
+
/** 零到一的动作进度;loader 可使用连续相位。 */
|
|
68
|
+
progress: number;
|
|
69
|
+
/** 外观,只有明确声明的图标支持 layered。 */
|
|
70
|
+
variant: IconVariant;
|
|
71
|
+
}
|
|
72
|
+
interface IconDefinition {
|
|
73
|
+
/** 唯一 kebab-case 标识。 */
|
|
74
|
+
id: string;
|
|
75
|
+
/** 人类可读名称,供独立 registry/预览使用。 */
|
|
76
|
+
label: string;
|
|
77
|
+
/** 是否确实提供第二种绘制。 */
|
|
78
|
+
layered: boolean;
|
|
79
|
+
/** true保留历史研究材质;core使用Downcity哑光框架材质,未指定沿用纯色。 */
|
|
80
|
+
materials?: boolean | "core";
|
|
81
|
+
/** 含运动和阴影padding的视窗[x,y,width,height];缺省24网格。 */
|
|
82
|
+
view_box?: readonly [number, number, number, number];
|
|
83
|
+
/** 是否有持续运行相位;目前只有 loader。 */
|
|
84
|
+
continuous?: boolean;
|
|
85
|
+
/** true表示draw的0→1本身包含交接与归位,事件只前进一次,不再倒放一遍。 */
|
|
86
|
+
motion_cycle?: boolean;
|
|
87
|
+
/** false为明确静态定义:React不分配动画时钟;未指定保留历史图行为。 */
|
|
88
|
+
motion_enabled?: boolean;
|
|
89
|
+
/** 图标建议节奏;缺省使用 default_motion。 */
|
|
90
|
+
motion?: MotionSpec;
|
|
91
|
+
/** 纯函数:同一帧在静态与 React 输出同一几何。 */
|
|
92
|
+
draw: (frame: IconFrame) => readonly IconNode[];
|
|
93
|
+
}
|
|
94
|
+
interface StaticIconOptions {
|
|
95
|
+
/** 默认 24;必须是 1–4096 的有限数。 */
|
|
96
|
+
size?: number;
|
|
97
|
+
/** 缺省 outline。 */
|
|
98
|
+
variant?: IconVariant;
|
|
99
|
+
/** folder 的持续展开姿态;其他图标不接受 open。 */
|
|
100
|
+
state?: IconState;
|
|
101
|
+
/** 显式线性时间 0–1;缺省由 state 决定。 */
|
|
102
|
+
progress?: number;
|
|
103
|
+
/** 完整运动覆盖,与 React 和调校台共用求值。 */
|
|
104
|
+
motion_spec?: MotionSpec;
|
|
105
|
+
/** 材质资源的文档唯一前缀;合并多段静态SVG时必须分别提供。缺省为本模块安全递增前缀。 */
|
|
106
|
+
id_prefix?: string;
|
|
107
|
+
/** 可访问名称;缺省为装饰性 SVG。 */
|
|
108
|
+
title?: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export type { CubicBezier as C, IconDefinition as I, MotionSpec as M, StaticIconOptions as S, IconMotionFrame as a, IconNode as b, IconPaint as c, IconPart as d, IconState as e, IconVariant as f, MotionTrack as g };
|