@snap-rail/ui 0.1.0 → 0.1.1

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/lib/runtime.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { attachBallDrag as attachBallDrag$1 } from "@snap-rail/client-kernel";
2
3
  import { rpcErrorText, subscribeFrame } from "@snap-rail/connection";
3
4
  import { settingsChangedSchema } from "@snap-rail/station-rpc/contract";
4
5
  import { Context } from "@snap-rail/cordis";
5
6
  import { TimerService } from "@snap-rail/cordis-plugin-timer";
6
7
  import { shellContract } from "@snap-rail/shell/contract";
7
- import { Component, createContext, useContext, useEffect, useState, useSyncExternalStore } from "react";
8
+ import { Component, createContext, useContext, useEffect, useRef, useState, useSyncExternalStore } from "react";
8
9
  import { createRoot } from "react-dom/client";
9
10
  import { Slot as Slot$1 } from "@radix-ui/react-slot";
10
11
  import "@radix-ui/react-checkbox";
@@ -14,7 +15,7 @@ import "@radix-ui/react-select";
14
15
  import * as SwitchPrimitive from "@radix-ui/react-switch";
15
16
  import * as TabsPrimitive from "@radix-ui/react-tabs";
16
17
  import * as DialogPrimitive from "@radix-ui/react-dialog";
17
- import "@snap-rail/app-boot/contract";
18
+ import { PLUGINS_FEED_URLS_KEY } from "@snap-rail/app-boot/contract";
18
19
  //#region lib/types/utils.js
19
20
  /**
20
21
  * Small helpers shared by the headless semantic components: class merging and
@@ -135,7 +136,7 @@ function IconButton({ icon, label, active = false, intent = "neutral", emphasis
135
136
  /** The dialog root. */
136
137
  const Dialog = DialogPrimitive.Root;
137
138
  /** The portalled dialog content. */
138
- function DialogContent({ children, className, presentation = "auto", size = "md", showClose = true }) {
139
+ function DialogContent({ children, className, presentation = "auto", size = "md", showClose = true, ...rest }) {
139
140
  const resolved = presentation === "auto" ? "modal" : presentation;
140
141
  return jsxs(DialogPrimitive.Portal, { children: [jsx(DialogPrimitive.Overlay, {
141
142
  ...part("dialog", "overlay"),
@@ -145,6 +146,7 @@ function DialogContent({ children, className, presentation = "auto", size = "md"
145
146
  className: cn("snap-dialog-panel", className),
146
147
  "data-presentation": resolved,
147
148
  "data-size": size,
149
+ ...rest,
148
150
  children: [children, showClose && jsx(DialogPrimitive.Close, {
149
151
  ...part("dialog", "close"),
150
152
  className: "snap-dialog-close",
@@ -153,6 +155,14 @@ function DialogContent({ children, className, presentation = "auto", size = "md"
153
155
  })]
154
156
  })] });
155
157
  }
158
+ /** The dialog header. */
159
+ function DialogHeader({ children, className }) {
160
+ return jsx("div", {
161
+ ...part("dialog", "header"),
162
+ className: cn("snap-dialog-header", className),
163
+ children
164
+ });
165
+ }
156
166
  /** The dialog title. */
157
167
  function DialogTitle({ children, className }) {
158
168
  return jsx(DialogPrimitive.Title, {
@@ -161,6 +171,30 @@ function DialogTitle({ children, className }) {
161
171
  children
162
172
  });
163
173
  }
174
+ /** The dialog description. */
175
+ function DialogDescription({ children, className }) {
176
+ return jsx(DialogPrimitive.Description, {
177
+ ...part("dialog", "description"),
178
+ className: cn("snap-dialog-description", className),
179
+ children
180
+ });
181
+ }
182
+ /** The dialog body. */
183
+ function DialogBody({ children, className }) {
184
+ return jsx("div", {
185
+ ...part("dialog", "body"),
186
+ className: cn("snap-dialog-body", className),
187
+ children
188
+ });
189
+ }
190
+ /** The dialog footer. */
191
+ function DialogFooter({ children, className }) {
192
+ return jsx("div", {
193
+ ...part("dialog", "footer"),
194
+ className: cn("snap-dialog-footer", className),
195
+ children
196
+ });
197
+ }
164
198
  //#endregion
165
199
  //#region lib/types/components/controls.js
166
200
  /** The tabs root. */
@@ -238,6 +272,46 @@ function EmptyState({ title, description, icon, action, className }) {
238
272
  });
239
273
  }
240
274
  //#endregion
275
+ //#region lib/types/components/input.js
276
+ /** A single-line text field with semantic prefix/suffix slots. Layout
277
+ * `style`/`className` dress the wrapper — the visible control; the native
278
+ * field already stretches inside it. */
279
+ function Input({ size = "md", invalid = false, prefix, suffix, onClear, componentName = "input", className, style, disabled, ...props }) {
280
+ return jsxs("div", {
281
+ ...part(componentName, "root"),
282
+ className: cn("snap-input", className),
283
+ style,
284
+ "data-size": size,
285
+ "data-invalid": invalid || void 0,
286
+ "data-disabled": disabled === true || void 0,
287
+ children: [
288
+ prefix !== void 0 && jsx("span", {
289
+ ...part(componentName, "prefix"),
290
+ children: prefix
291
+ }),
292
+ jsx("input", {
293
+ ...part(componentName, "field"),
294
+ className: "snap-input-field",
295
+ disabled,
296
+ "aria-invalid": invalid || void 0,
297
+ ...props
298
+ }),
299
+ onClear !== void 0 && typeof props.value === "string" && props.value !== "" && jsx("button", {
300
+ ...part(componentName, "clear"),
301
+ type: "button",
302
+ className: "snap-input-clear",
303
+ "aria-label": "清除",
304
+ onClick: onClear,
305
+ children: "×"
306
+ }),
307
+ suffix !== void 0 && jsx("span", {
308
+ ...part(componentName, "suffix"),
309
+ children: suffix
310
+ })
311
+ ]
312
+ });
313
+ }
314
+ //#endregion
241
315
  //#region lib/types/components/layout.js
242
316
  /** A vertical flow. */
243
317
  function Stack({ gap = "md", padding, align, className, style, children }) {
@@ -324,7 +398,7 @@ function AppShell({ header, sidebar, footer, className, style, children }) {
324
398
  });
325
399
  }
326
400
  /** A page body with its own header/actions anatomy. */
327
- function Page({ header, actions, title, description, className, style, children }) {
401
+ function Page({ header, actions, title, titleExtra, description, className, style, children }) {
328
402
  return jsxs("div", {
329
403
  ...part("page", "root"),
330
404
  className: cn("snap-page", className),
@@ -350,9 +424,19 @@ function Page({ header, actions, title, description, className, style, children
350
424
  justifyContent: "space-between",
351
425
  gap: space("md")
352
426
  },
353
- children: [title !== void 0 && jsx("div", {
354
- ...part("page", "title"),
355
- children: title
427
+ children: [jsxs("div", {
428
+ style: {
429
+ display: "flex",
430
+ alignItems: "center",
431
+ gap: space("sm")
432
+ },
433
+ children: [title !== void 0 && jsx("div", {
434
+ ...part("page", "title"),
435
+ children: title
436
+ }), titleExtra !== void 0 && jsx("div", {
437
+ ...part("page", "title-extra"),
438
+ children: titleExtra
439
+ })]
356
440
  }), actions !== void 0 && jsx("div", {
357
441
  ...part("page", "actions"),
358
442
  children: actions
@@ -874,7 +958,6 @@ function FallbackShell(props) {
874
958
  },
875
959
  children: jsx(EmptyState, {
876
960
  title: "尚未激活业务套件",
877
- description: "打开设置的「插件管理」页,安装并启用一个业务套件;驱动也在同一处安装。",
878
961
  action: jsx(Button, {
879
962
  intent: "primary",
880
963
  onClick: () => props.ctx.settings.open("plugins"),
@@ -917,6 +1000,255 @@ const fallbackPlugin = {
917
1000
  }
918
1001
  };
919
1002
  //#endregion
1003
+ //#region lib/types/skins.js
1004
+ /** The factory day theme id (cobalt palette, light surfaces). */
1005
+ const DEFAULT_LIGHT_ID = "default-light";
1006
+ /** The factory night theme id (cobalt palette, dark surfaces). */
1007
+ const DEFAULT_DARK_ID = "default-dark";
1008
+ /** The contributor label for the factory themes. */
1009
+ const FACTORY_CALLER = "@snap-rail/ui";
1010
+ const COBALT_DARK_TOKENS = {
1011
+ colorBg: "#0b0f14",
1012
+ colorSurface: "#11161d",
1013
+ colorSurfaceRaised: "#161b22",
1014
+ colorText: "#ced8e3",
1015
+ colorMuted: "#8b949e",
1016
+ colorPrimary: "#4a6cff",
1017
+ colorOnPrimary: "#ffffff",
1018
+ colorDanger: "#f85149",
1019
+ colorSuccess: "#3fb950",
1020
+ colorWarning: "#d29922",
1021
+ colorBorder: "#1f2933",
1022
+ colorFocus: "#4a6cff",
1023
+ chart1: "#4a6cff",
1024
+ chart2: "#3147a1",
1025
+ chart3: "#667fcd",
1026
+ chart4: "#7d8fa5",
1027
+ chart5: "#55677c",
1028
+ chart6: "#33414f",
1029
+ fontSans: "system-ui, \"Segoe UI\", \"Microsoft YaHei\", sans-serif",
1030
+ fontMono: "\"Cascadia Code\", \"Cascadia Mono\", Consolas, ui-monospace, monospace",
1031
+ textXs: "13px",
1032
+ textSm: "15px",
1033
+ textMd: "17px",
1034
+ textLg: "20px",
1035
+ textXl: "24px",
1036
+ weightNormal: "400",
1037
+ weightMedium: "500",
1038
+ weightStrong: "600",
1039
+ leadingTight: "1.2",
1040
+ leadingNormal: "1.55",
1041
+ spaceXs: "4px",
1042
+ spaceSm: "8px",
1043
+ spaceMd: "12px",
1044
+ spaceLg: "20px",
1045
+ spaceXl: "32px",
1046
+ radiusSm: "6px",
1047
+ radiusMd: "8px",
1048
+ radiusLg: "12px",
1049
+ radiusFull: "999px",
1050
+ borderWidth: "1px",
1051
+ shadowSm: "0 1px 2px rgb(0 0 0 / 0.25)",
1052
+ shadowMd: "0 8px 24px rgb(0 0 0 / 0.28)",
1053
+ shadowLg: "0 24px 64px rgb(0 0 0 / 0.36)",
1054
+ durationFast: "120ms",
1055
+ durationNormal: "180ms",
1056
+ durationSlow: "280ms",
1057
+ easeStandard: "cubic-bezier(0.2, 0, 0, 1)",
1058
+ zOverlay: "50",
1059
+ zModal: "60",
1060
+ zToast: "70",
1061
+ controlHeightSm: "40px",
1062
+ controlHeightMd: "48px",
1063
+ controlHeightLg: "56px",
1064
+ density: "comfortable"
1065
+ };
1066
+ /** The factory day theme. Always registered; never the first paint though — the night theme is. */
1067
+ const DEFAULT_LIGHT = {
1068
+ id: DEFAULT_LIGHT_ID,
1069
+ title: "钴蓝·白天",
1070
+ tokens: {
1071
+ colorBg: "#e4e9ef",
1072
+ colorSurface: "#f3f6f9",
1073
+ colorSurfaceRaised: "#ffffff",
1074
+ colorText: "#26323e",
1075
+ colorMuted: "#5d6d7e",
1076
+ colorPrimary: "#3857e8",
1077
+ colorOnPrimary: "#ffffff",
1078
+ colorDanger: "#dc2626",
1079
+ colorSuccess: "#15803d",
1080
+ colorWarning: "#b45309",
1081
+ colorBorder: "#c7d0da",
1082
+ colorFocus: "#3857e8",
1083
+ chart1: "#3857e8",
1084
+ chart2: "#7088ee",
1085
+ chart3: "#667dd0",
1086
+ chart4: "#94a3b8",
1087
+ chart5: "#b3c0cd",
1088
+ chart6: "#ccd6e0",
1089
+ fontSans: "system-ui, \"Segoe UI\", \"Microsoft YaHei\", sans-serif",
1090
+ fontMono: "\"Cascadia Code\", \"Cascadia Mono\", Consolas, ui-monospace, monospace",
1091
+ textXs: "13px",
1092
+ textSm: "15px",
1093
+ textMd: "17px",
1094
+ textLg: "20px",
1095
+ textXl: "24px",
1096
+ weightNormal: "400",
1097
+ weightMedium: "500",
1098
+ weightStrong: "600",
1099
+ leadingTight: "1.2",
1100
+ leadingNormal: "1.55",
1101
+ spaceXs: "4px",
1102
+ spaceSm: "8px",
1103
+ spaceMd: "12px",
1104
+ spaceLg: "20px",
1105
+ spaceXl: "32px",
1106
+ radiusSm: "6px",
1107
+ radiusMd: "8px",
1108
+ radiusLg: "12px",
1109
+ radiusFull: "999px",
1110
+ borderWidth: "1px",
1111
+ shadowSm: "0 1px 2px rgb(0 0 0 / 0.08)",
1112
+ shadowMd: "0 8px 24px rgb(0 0 0 / 0.12)",
1113
+ shadowLg: "0 24px 64px rgb(0 0 0 / 0.18)",
1114
+ durationFast: "120ms",
1115
+ durationNormal: "180ms",
1116
+ durationSlow: "280ms",
1117
+ easeStandard: "cubic-bezier(0.2, 0, 0, 1)",
1118
+ zOverlay: "50",
1119
+ zModal: "60",
1120
+ zToast: "70",
1121
+ controlHeightSm: "40px",
1122
+ controlHeightMd: "48px",
1123
+ controlHeightLg: "56px",
1124
+ density: "comfortable"
1125
+ }
1126
+ };
1127
+ /** The factory night theme and the registry's fallback. */
1128
+ const DEFAULT_DARK = {
1129
+ id: DEFAULT_DARK_ID,
1130
+ title: "钴蓝·黑夜",
1131
+ tokens: COBALT_DARK_TOKENS
1132
+ };
1133
+ /** Turn a token key into its CSS custom property (`chart1` → `--snap-chart-1`). */
1134
+ function skinTokenVar(key) {
1135
+ return `--snap-${key.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`).replace(/(\d+)$/, "-$1")}`;
1136
+ }
1137
+ /** Apply the active theme to the document root. */
1138
+ function applySkin(skin) {
1139
+ if (typeof document === "undefined") return;
1140
+ const root = document.documentElement;
1141
+ root.dataset["snapSkin"] = skin.id;
1142
+ for (const [key, value] of Object.entries(skin.tokens)) root.style.setProperty(skinTokenVar(key), value);
1143
+ }
1144
+ /** Mount the `ctx.skins` registry. */
1145
+ const skinsPlugin = {
1146
+ name: "snap-rail ui skins",
1147
+ apply(ctx) {
1148
+ const skins = /* @__PURE__ */ new Map();
1149
+ const callers = /* @__PURE__ */ new Map();
1150
+ const listeners = /* @__PURE__ */ new Set();
1151
+ const styleTags = /* @__PURE__ */ new Map();
1152
+ let activeId = DEFAULT_DARK_ID;
1153
+ let revision = 0;
1154
+ skins.set(DEFAULT_LIGHT_ID, DEFAULT_LIGHT);
1155
+ callers.set(DEFAULT_LIGHT_ID, FACTORY_CALLER);
1156
+ skins.set(DEFAULT_DARK_ID, DEFAULT_DARK);
1157
+ callers.set(DEFAULT_DARK_ID, FACTORY_CALLER);
1158
+ const notify = () => {
1159
+ revision += 1;
1160
+ for (const listener of listeners) listener();
1161
+ ctx.emit("skins/changed");
1162
+ };
1163
+ const ensureStyleTag = (skin) => {
1164
+ if (typeof document === "undefined" || skin.css === void 0) return;
1165
+ if (styleTags.has(skin.id)) return;
1166
+ const tag = document.createElement("style");
1167
+ tag.dataset["snapSkinStyle"] = skin.id;
1168
+ tag.textContent = skin.css;
1169
+ document.head.append(tag);
1170
+ styleTags.set(skin.id, tag);
1171
+ };
1172
+ const refresh = () => {
1173
+ const skin = skins.get(activeId) ?? DEFAULT_DARK;
1174
+ activeId = skin.id;
1175
+ ensureStyleTag(skin);
1176
+ applySkin(skin);
1177
+ notify();
1178
+ };
1179
+ ctx.provide("skins", {
1180
+ register(caller, skin) {
1181
+ skins.set(skin.id, skin);
1182
+ callers.set(skin.id, caller.fiber.name);
1183
+ refresh();
1184
+ const remove = () => {
1185
+ if (!skins.delete(skin.id)) return;
1186
+ callers.delete(skin.id);
1187
+ const tag = styleTags.get(skin.id);
1188
+ if (tag !== void 0) {
1189
+ tag.remove();
1190
+ styleTags.delete(skin.id);
1191
+ }
1192
+ if (activeId === skin.id) activeId = DEFAULT_DARK_ID;
1193
+ refresh();
1194
+ };
1195
+ caller.effect(() => remove);
1196
+ return remove;
1197
+ },
1198
+ activate(selection) {
1199
+ let next = skins.has(selection) ? selection : void 0;
1200
+ if (next === void 0) {
1201
+ for (const [id, owner] of callers) if (id !== selection && owner === selection && skins.has(id)) {
1202
+ next = id;
1203
+ break;
1204
+ }
1205
+ }
1206
+ if (next === void 0) return false;
1207
+ if (next === activeId) return true;
1208
+ activeId = next;
1209
+ refresh();
1210
+ return true;
1211
+ },
1212
+ list: () => [...skins.values()].map((skin) => ({
1213
+ id: skin.id,
1214
+ title: skin.title,
1215
+ caller: callers.get(skin.id) ?? FACTORY_CALLER
1216
+ })),
1217
+ active: () => skins.get(activeId) ?? DEFAULT_DARK,
1218
+ tokens: () => (skins.get(activeId) ?? DEFAULT_DARK).tokens,
1219
+ subscribe(listener) {
1220
+ listeners.add(listener);
1221
+ return () => {
1222
+ listeners.delete(listener);
1223
+ };
1224
+ },
1225
+ version: () => revision
1226
+ });
1227
+ refresh();
1228
+ }
1229
+ };
1230
+ /** The React context carrying the skin service. */
1231
+ const SkinsContext = createContext(null);
1232
+ /** Provide the skin service to a renderer tree. */
1233
+ function SkinsProvider(props) {
1234
+ return jsx(SkinsContext.Provider, {
1235
+ value: props.service,
1236
+ children: props.children
1237
+ });
1238
+ }
1239
+ /** Read the skin service. */
1240
+ function useSkins() {
1241
+ const service = useContext(SkinsContext);
1242
+ if (service === null) throw new Error("useSkins: no SkinsProvider in the tree");
1243
+ return service;
1244
+ }
1245
+ /** Re-render on theme changes and return the active theme id. */
1246
+ function useSkinId() {
1247
+ const service = useSkins();
1248
+ useSyncExternalStore(service.subscribe, service.version, service.version);
1249
+ return service.active().id;
1250
+ }
1251
+ //#endregion
920
1252
  //#region lib/types/settings-pages/appearance.js
921
1253
  const THEME_KEY = "ui.theme";
922
1254
  const WINDOW_KEY = "ui.window";
@@ -965,24 +1297,21 @@ async function writeSetting(link, key, value) {
965
1297
  /** The appearance/display page. */
966
1298
  function AppearancePage() {
967
1299
  const { link } = useClient();
968
- const [mode, setMode] = useState("dark");
1300
+ const skins = useSkins();
1301
+ const activeId = useSkinId();
1302
+ const [packages, setPackages] = useState([]);
969
1303
  const [windowPreset, setWindowPreset] = useState(void 0);
970
1304
  const [ballSize, setBallSize] = useState(128);
971
1305
  const [ballEnabled, setBallEnabled] = useState(true);
972
- const [ballDockable, setBallDockable] = useState(true);
973
1306
  const [ballCollapse, setBallCollapse] = useState(true);
974
- const [skins, setSkins] = useState([]);
975
1307
  const [error, setError] = useState(void 0);
976
1308
  const [busy, setBusy] = useState(false);
977
1309
  useEffect(() => {
978
1310
  Promise.all([
979
- readSetting(link, THEME_KEY),
980
1311
  readSetting(link, WINDOW_KEY),
981
1312
  readSetting(link, BALL_KEY),
982
1313
  link.call("plugins.list", {})
983
- ]).then(([theme, windowRow, ballRow, plugins]) => {
984
- const themeMode = theme?.mode;
985
- if (themeMode === "system" || themeMode === "light" || themeMode === "dark") setMode(themeMode);
1314
+ ]).then(([windowRow, ballRow, plugins]) => {
986
1315
  const windowProfile = windowRow;
987
1316
  if (windowProfile !== null && windowProfile !== void 0 && typeof windowProfile.width === "number" && typeof windowProfile.height === "number") {
988
1317
  const preset = WINDOW_PRESETS.find((item) => item.width === windowProfile.width && item.height === windowProfile.height);
@@ -991,9 +1320,8 @@ function AppearancePage() {
991
1320
  const ballProfile = ballRow;
992
1321
  if (ballProfile !== null && ballProfile !== void 0 && typeof ballProfile.size === "number") setBallSize(ballProfile.size);
993
1322
  if (ballProfile !== null && ballProfile !== void 0 && typeof ballProfile.enabled === "boolean") setBallEnabled(ballProfile.enabled);
994
- if (ballProfile !== null && ballProfile !== void 0 && typeof ballProfile.dockable === "boolean") setBallDockable(ballProfile.dockable);
995
1323
  if (ballProfile !== null && ballProfile !== void 0 && typeof ballProfile.collapse === "boolean") setBallCollapse(ballProfile.collapse);
996
- if (plugins.ok) setSkins(plugins.value.plugins.filter((plugin) => plugin.kind === "skin" && plugin.source !== "builtin").map((plugin) => ({
1324
+ if (plugins.ok) setPackages(plugins.value.plugins.filter((plugin) => plugin.kind === "skin" && plugin.source !== "builtin").map((plugin) => ({
997
1325
  name: plugin.packageName,
998
1326
  title: plugin.title ?? plugin.packageName,
999
1327
  enabled: plugin.enabled
@@ -1001,19 +1329,7 @@ function AppearancePage() {
1001
1329
  }).catch((cause) => {
1002
1330
  setError(cause instanceof Error ? cause.message : String(cause));
1003
1331
  });
1004
- return subscribeFrame(link, "settings/changed", settingsChangedSchema, (change) => {
1005
- if (change.key === THEME_KEY) {
1006
- const next = change.value?.mode;
1007
- if (next === "system" || next === "light" || next === "dark") setMode(next);
1008
- }
1009
- });
1010
1332
  }, [link]);
1011
- const saveTheme = (next) => {
1012
- setMode(next);
1013
- writeSetting(link, THEME_KEY, { mode: next }).catch((cause) => {
1014
- setError(cause instanceof Error ? cause.message : String(cause));
1015
- });
1016
- };
1017
1333
  const saveWindow = (width, height, label) => {
1018
1334
  setWindowPreset(label);
1019
1335
  writeSetting(link, WINDOW_KEY, {
@@ -1035,31 +1351,45 @@ function AppearancePage() {
1035
1351
  const next = {
1036
1352
  size: patch.size ?? ballSize,
1037
1353
  enabled: patch.enabled ?? ballEnabled,
1038
- dockable: patch.dockable ?? ballDockable,
1039
1354
  collapse: patch.collapse ?? ballCollapse
1040
1355
  };
1041
1356
  if (patch.size !== void 0) setBallSize(patch.size);
1042
1357
  if (patch.enabled !== void 0) setBallEnabled(patch.enabled);
1043
- if (patch.dockable !== void 0) setBallDockable(patch.dockable);
1044
1358
  if (patch.collapse !== void 0) setBallCollapse(patch.collapse);
1045
1359
  writeSetting(link, BALL_KEY, next).catch((cause) => {
1046
1360
  setError(cause instanceof Error ? cause.message : String(cause));
1047
1361
  });
1048
1362
  };
1049
- const toggleSkin = (skin) => {
1363
+ const tabs = [...skins.list().map((row) => ({
1364
+ id: row.id,
1365
+ title: row.title
1366
+ })), ...packages.filter((pkg) => !pkg.enabled).map((pkg) => ({
1367
+ id: pkg.name,
1368
+ title: pkg.title,
1369
+ enable: pkg.name
1370
+ }))];
1371
+ const selectTheme = (tab) => {
1372
+ if (busy) return;
1373
+ if (tab.enable === void 0) {
1374
+ writeSetting(link, THEME_KEY, { id: tab.id }).catch((cause) => {
1375
+ setError(cause instanceof Error ? cause.message : String(cause));
1376
+ });
1377
+ return;
1378
+ }
1050
1379
  setBusy(true);
1051
1380
  link.call("plugins.set-enabled", {
1052
- name: skin.name,
1053
- enabled: !skin.enabled
1381
+ name: tab.enable,
1382
+ enabled: true
1054
1383
  }).then((result) => {
1055
1384
  if (!result.ok) {
1056
1385
  setError(rpcErrorText(result.error));
1057
1386
  return;
1058
1387
  }
1059
- setSkins((current) => current.map((item) => item.name === skin.name ? {
1060
- ...item,
1061
- enabled: !item.enabled
1062
- } : item));
1388
+ setPackages((current) => current.map((pkg) => pkg.name === tab.enable ? {
1389
+ ...pkg,
1390
+ enabled: true
1391
+ } : pkg));
1392
+ return writeSetting(link, THEME_KEY, { id: tab.id });
1063
1393
  }).catch((cause) => {
1064
1394
  setError(cause instanceof Error ? cause.message : String(cause));
1065
1395
  }).finally(() => {
@@ -1068,7 +1398,7 @@ function AppearancePage() {
1068
1398
  };
1069
1399
  return jsx(Page, {
1070
1400
  title: "外观与显示",
1071
- description: "主题、皮肤、主窗口尺寸和悬浮球外观;保存后立即生效。",
1401
+ description: "主题、主窗口尺寸和悬浮球外观。",
1072
1402
  children: jsxs(Stack, {
1073
1403
  gap: "lg",
1074
1404
  children: [
@@ -1078,73 +1408,25 @@ function AppearancePage() {
1078
1408
  children: error
1079
1409
  }),
1080
1410
  jsx(Section, {
1081
- title: "主题模式",
1411
+ title: "主题",
1082
1412
  children: jsx(Tabs, {
1083
- value: mode,
1084
- onValueChange: (value) => saveTheme(value),
1085
- children: jsxs(TabsList, {
1086
- "aria-label": "主题模式",
1087
- children: [
1088
- jsx(TabsTrigger, {
1089
- value: "system",
1090
- children: "跟随系统"
1091
- }),
1092
- jsx(TabsTrigger, {
1093
- value: "light",
1094
- children: "白天"
1095
- }),
1096
- jsx(TabsTrigger, {
1097
- value: "dark",
1098
- children: "黑夜"
1099
- })
1100
- ]
1413
+ value: activeId,
1414
+ onValueChange: (value) => {
1415
+ const tab = tabs.find((item) => item.id === value);
1416
+ if (tab !== void 0) selectTheme(tab);
1417
+ },
1418
+ children: jsx(TabsList, {
1419
+ "aria-label": "主题",
1420
+ children: tabs.map((tab) => jsx(TabsTrigger, {
1421
+ value: tab.id,
1422
+ disabled: busy,
1423
+ children: tab.title
1424
+ }, tab.id))
1101
1425
  })
1102
1426
  })
1103
1427
  }),
1104
- jsx(Section, {
1105
- title: "界面皮肤",
1106
- description: "皮肤由独立插件提供;启用后需要重启终端。",
1107
- children: jsxs(Stack, {
1108
- gap: "sm",
1109
- children: [jsxs(Row, {
1110
- gap: "sm",
1111
- align: "center",
1112
- children: [jsx(Badge, {
1113
- intent: "success",
1114
- children: "默认(内置)"
1115
- }), jsx("span", {
1116
- style: {
1117
- color: "var(--snap-color-muted)",
1118
- fontSize: "var(--snap-text-sm)"
1119
- },
1120
- children: "工业钴蓝,始终可用"
1121
- })]
1122
- }), skins.length === 0 ? jsx("span", {
1123
- style: { color: "var(--snap-color-muted)" },
1124
- children: "尚未安装其他皮肤插件。"
1125
- }) : skins.map((skin) => jsxs(Row, {
1126
- gap: "sm",
1127
- align: "center",
1128
- children: [
1129
- jsx("span", { children: skin.title }),
1130
- jsx(Badge, {
1131
- intent: skin.enabled ? "success" : "neutral",
1132
- children: skin.enabled ? "已启用" : "未启用"
1133
- }),
1134
- jsx(Button, {
1135
- size: "sm",
1136
- emphasis: "outline",
1137
- disabled: busy,
1138
- onClick: () => toggleSkin(skin),
1139
- children: skin.enabled ? "停用" : "启用"
1140
- })
1141
- ]
1142
- }, skin.name))]
1143
- })
1144
- }),
1145
1428
  jsx(Section, {
1146
1429
  title: "主窗口",
1147
- description: "布局/套件会声明推荐尺寸;这里的选择会覆盖布局推荐。",
1148
1430
  children: jsxs(Stack, {
1149
1431
  gap: "sm",
1150
1432
  children: [jsxs(Row, {
@@ -1173,7 +1455,7 @@ function AppearancePage() {
1173
1455
  }),
1174
1456
  jsx(Section, {
1175
1457
  title: "悬浮球",
1176
- description: "球面尺寸与停泊行为;球内显示内容由业务套件决定。",
1458
+ description: "球面尺寸与停泊行为。",
1177
1459
  children: jsxs(Stack, {
1178
1460
  gap: "md",
1179
1461
  children: [jsx(Row, {
@@ -1191,23 +1473,15 @@ function AppearancePage() {
1191
1473
  gap: "lg",
1192
1474
  wrap: true,
1193
1475
  align: "center",
1194
- children: [
1195
- jsx(Switch, {
1196
- label: "启用悬浮球",
1197
- checked: ballEnabled,
1198
- onCheckedChange: (enabled) => saveBall({ enabled })
1199
- }),
1200
- jsx(Switch, {
1201
- label: "允许贴边",
1202
- checked: ballDockable,
1203
- onCheckedChange: (dockable) => saveBall({ dockable })
1204
- }),
1205
- jsx(Switch, {
1206
- label: "贴边后收起",
1207
- checked: ballCollapse,
1208
- onCheckedChange: (collapse) => saveBall({ collapse })
1209
- })
1210
- ]
1476
+ children: [jsx(Switch, {
1477
+ label: "启用悬浮球",
1478
+ checked: ballEnabled,
1479
+ onCheckedChange: (enabled) => saveBall({ enabled })
1480
+ }), jsx(Switch, {
1481
+ label: "允许贴边收起",
1482
+ checked: ballCollapse,
1483
+ onCheckedChange: (collapse) => saveBall({ collapse })
1484
+ })]
1211
1485
  })]
1212
1486
  })
1213
1487
  })
@@ -1216,7 +1490,157 @@ function AppearancePage() {
1216
1490
  });
1217
1491
  }
1218
1492
  //#endregion
1493
+ //#region lib/types/settings-pages/plugin-feed.js
1494
+ /** The feed-source editor dialog; the open state lives with the opener. */
1495
+ function PluginFeedDialog(props) {
1496
+ const { open } = props;
1497
+ const link = props.ctx.client.link;
1498
+ const [urls, setUrls] = useState([]);
1499
+ const [draft, setDraft] = useState("");
1500
+ const [error, setError] = useState(void 0);
1501
+ useEffect(() => {
1502
+ if (!open) return;
1503
+ link.call("settings.get", { key: PLUGINS_FEED_URLS_KEY }).then((result) => {
1504
+ if (result.ok && Array.isArray(result.value.value)) setUrls(result.value.value.filter((entry) => typeof entry === "string"));
1505
+ }).catch(() => void 0);
1506
+ }, [open, link]);
1507
+ const save = () => {
1508
+ for (const url of urls) try {
1509
+ const parsed = new URL(url);
1510
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") throw new Error("protocol");
1511
+ } catch {
1512
+ setError("插件源地址需要以 http(s) 开头");
1513
+ return;
1514
+ }
1515
+ setError(void 0);
1516
+ link.call("settings.set", {
1517
+ key: PLUGINS_FEED_URLS_KEY,
1518
+ value: urls
1519
+ }).then((result) => {
1520
+ if (!result.ok) {
1521
+ setError(rpcErrorText(result.error));
1522
+ return;
1523
+ }
1524
+ props.onOpenChange(false);
1525
+ }).catch((cause) => setError(String(cause)));
1526
+ };
1527
+ const append = () => {
1528
+ const value = draft.trim();
1529
+ if (value === "") return;
1530
+ try {
1531
+ const parsed = new URL(value);
1532
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") throw new Error("protocol");
1533
+ } catch {
1534
+ setError("请填写 http(s) 开头的插件源地址");
1535
+ return;
1536
+ }
1537
+ setError(void 0);
1538
+ setDraft("");
1539
+ setUrls((current) => current.includes(value) ? current : [...current, value]);
1540
+ };
1541
+ return jsx(Dialog, {
1542
+ open,
1543
+ onOpenChange: props.onOpenChange,
1544
+ children: jsxs(DialogContent, {
1545
+ presentation: "modal",
1546
+ "aria-describedby": void 0,
1547
+ children: [
1548
+ jsx(DialogHeader, { children: jsx(DialogTitle, { children: "插件源" }) }),
1549
+ jsx(DialogBody, { children: jsxs(Stack, {
1550
+ gap: "sm",
1551
+ children: [
1552
+ urls.length === 0 && jsx("div", {
1553
+ style: {
1554
+ fontSize: "var(--snap-text-xs)",
1555
+ color: "var(--snap-color-muted)"
1556
+ },
1557
+ children: "尚未添加自定义源(当前使用出厂默认源)。"
1558
+ }),
1559
+ urls.map((url, index) => jsxs("div", {
1560
+ style: {
1561
+ display: "flex",
1562
+ gap: "var(--snap-space-sm)",
1563
+ alignItems: "center"
1564
+ },
1565
+ children: [jsx("span", {
1566
+ style: {
1567
+ flex: 1,
1568
+ minWidth: 0,
1569
+ overflow: "hidden",
1570
+ textOverflow: "ellipsis",
1571
+ whiteSpace: "nowrap",
1572
+ fontSize: "var(--snap-text-xs)"
1573
+ },
1574
+ children: url
1575
+ }), jsx(Button, {
1576
+ intent: "neutral",
1577
+ emphasis: "ghost",
1578
+ size: "sm",
1579
+ "aria-label": `移除 ${url}`,
1580
+ onClick: () => setUrls((current) => current.filter((_, at) => at !== index)),
1581
+ children: "✕"
1582
+ })]
1583
+ }, url)),
1584
+ jsxs("div", {
1585
+ style: {
1586
+ display: "flex",
1587
+ gap: "var(--snap-space-sm)",
1588
+ width: "100%"
1589
+ },
1590
+ children: [jsx(Input, {
1591
+ value: draft,
1592
+ placeholder: "https://…",
1593
+ style: {
1594
+ flex: 1,
1595
+ minWidth: 0
1596
+ },
1597
+ onChange: (event) => setDraft(event.target.value),
1598
+ onKeyDown: (event) => {
1599
+ if (event.key === "Enter") append();
1600
+ }
1601
+ }), jsx(Button, {
1602
+ intent: "neutral",
1603
+ emphasis: "outline",
1604
+ onClick: append,
1605
+ children: "添加源"
1606
+ })]
1607
+ }),
1608
+ error !== void 0 && jsx("div", {
1609
+ role: "alert",
1610
+ style: {
1611
+ color: "var(--snap-color-danger)",
1612
+ fontSize: "var(--snap-text-sm)"
1613
+ },
1614
+ children: error
1615
+ })
1616
+ ]
1617
+ }) }),
1618
+ jsxs(DialogFooter, { children: [jsx(Button, {
1619
+ intent: "neutral",
1620
+ emphasis: "outline",
1621
+ onClick: () => props.onOpenChange(false),
1622
+ children: "取消"
1623
+ }), jsx(Button, {
1624
+ intent: "primary",
1625
+ "data-plugins-feed-save": true,
1626
+ onClick: save,
1627
+ children: "保存"
1628
+ })] })
1629
+ ]
1630
+ })
1631
+ });
1632
+ }
1633
+ //#endregion
1219
1634
  //#region lib/types/settings-pages/plugins.js
1635
+ /** The preload's zip→path bridge (`webUtils.getPathForFile`); null outside
1636
+ * Electron or in tests. Inlined rather than imported from the app-internal
1637
+ * kernel package: it never ships in the installer, and the packaged-app gate
1638
+ * refuses any shipped `@snap-rail/ui` lib that requires it. */
1639
+ function droppedZipPath(file) {
1640
+ const zipPathOf = globalThis.snapRail?.zipPathOf;
1641
+ if (typeof zipPathOf !== "function") return null;
1642
+ return zipPathOf(file);
1643
+ }
1220
1644
  /** Human labels for the package kinds. */
1221
1645
  const KIND_LABELS = {
1222
1646
  skin: "界面风格",
@@ -1229,6 +1653,22 @@ const PROFILE_LABELS = {
1229
1653
  integrated: "图表桥接",
1230
1654
  custom: "自定义界面"
1231
1655
  };
1656
+ /** Search rows shown before the tail is folded into a counter. */
1657
+ const SEARCH_ROW_CAP = 20;
1658
+ /** The plus glyph for the page's install entry. */
1659
+ function PlusIcon() {
1660
+ return jsx("svg", {
1661
+ viewBox: "0 0 24 24",
1662
+ width: "18",
1663
+ height: "18",
1664
+ fill: "none",
1665
+ stroke: "currentColor",
1666
+ strokeWidth: "2.4",
1667
+ strokeLinecap: "round",
1668
+ "aria-hidden": "true",
1669
+ children: jsx("path", { d: "M12 5v14M5 12h14" })
1670
+ });
1671
+ }
1232
1672
  /** Collapse entry rows into package rows (one master switch per package). */
1233
1673
  function packageRows(plugins) {
1234
1674
  const byPackage = /* @__PURE__ */ new Map();
@@ -1254,15 +1694,44 @@ function packageRows(plugins) {
1254
1694
  }
1255
1695
  return [...byPackage.values()].sort((a, b) => a.category.localeCompare(b.category) || a.title.localeCompare(b.title));
1256
1696
  }
1697
+ /** The preview's signature line (one row in the confirm card). */
1698
+ function signatureText(signature, viaUrl) {
1699
+ if (signature.state === "verified") return {
1700
+ text: `✓ 已验证 · ${signature.publisher ?? signature.keyId}`,
1701
+ warning: false
1702
+ };
1703
+ const detail = signature.keyId !== void 0 ? `⚠ 未验证 · keyId ${signature.keyId}(未登记)` : "⚠ 未签名";
1704
+ return {
1705
+ text: viaUrl ? `${detail} · 直链无完整性校验` : detail,
1706
+ warning: true
1707
+ };
1708
+ }
1709
+ /** Does the input name an http(s) address? */
1710
+ const isHttpUrl = (text) => /^https?:\/\//i.test(text);
1711
+ /** Does the input look like a filesystem path (drive letter, UNC, posix
1712
+ * root, or a .zip name with a separator in it)? */
1713
+ const looksLikePath = (text) => /^[a-zA-Z]:[\\/]/.test(text) || text.startsWith("\\\\") || text.startsWith("/") || /\.zip$/i.test(text) && /[/\\]/.test(text);
1257
1714
  /** The plugin management page. */
1258
1715
  function PluginsPage({ ctx }) {
1259
1716
  const [rows, setRows] = useState([]);
1260
1717
  const [error, setError] = useState(void 0);
1261
1718
  const [busy, setBusy] = useState(void 0);
1262
1719
  const [touched, setTouched] = useState(/* @__PURE__ */ new Set());
1720
+ const [restartNeeded, setRestartNeeded] = useState(false);
1721
+ const [installOpen, setInstallOpen] = useState(false);
1722
+ const [phase, setPhase] = useState({ kind: "idle" });
1723
+ const [message, setMessage] = useState(void 0);
1724
+ const [updates, setUpdates] = useState(/* @__PURE__ */ new Map());
1725
+ const [updatingName, setUpdatingName] = useState(void 0);
1726
+ const [keyChange, setKeyChange] = useState(void 0);
1727
+ const [query, setQuery] = useState("");
1728
+ const [searchResults, setSearchResults] = useState(void 0);
1729
+ const [searching, setSearching] = useState(false);
1730
+ const [dragging, setDragging] = useState(false);
1731
+ const link = ctx.client.link;
1263
1732
  const load = () => {
1264
1733
  setError(void 0);
1265
- ctx.client.link.call("plugins.list", {}).then((result) => {
1734
+ link.call("plugins.list", {}).then((result) => {
1266
1735
  if (!result.ok) {
1267
1736
  setError(rpcErrorText(result.error));
1268
1737
  return;
@@ -1271,11 +1740,30 @@ function PluginsPage({ ctx }) {
1271
1740
  }).catch((cause) => {
1272
1741
  setError(cause instanceof Error ? cause.message : String(cause));
1273
1742
  });
1743
+ link.call("plugins.updates-check", {}).then((result) => {
1744
+ if (result.ok) setUpdates(new Map(result.value.updates.map((update) => [update.name, update])));
1745
+ }).catch(() => void 0);
1746
+ };
1747
+ useEffect(() => {
1748
+ load();
1749
+ }, [link]);
1750
+ const openInstall = () => {
1751
+ setQuery("");
1752
+ setSearchResults(void 0);
1753
+ setMessage(void 0);
1754
+ setDragging(false);
1755
+ setInstallOpen(true);
1756
+ };
1757
+ const closeInstall = () => {
1758
+ setInstallOpen(false);
1759
+ setQuery("");
1760
+ setSearchResults(void 0);
1761
+ setMessage(void 0);
1762
+ setDragging(false);
1274
1763
  };
1275
- useEffect(load, []);
1276
1764
  const toggle = (row, enabled) => {
1277
1765
  setBusy(row.packageName);
1278
- ctx.client.link.call("plugins.set-enabled", {
1766
+ link.call("plugins.set-enabled", {
1279
1767
  name: row.packageName,
1280
1768
  enabled
1281
1769
  }).then((result) => {
@@ -1297,12 +1785,13 @@ function PluginsPage({ ctx }) {
1297
1785
  const uninstall = (row) => {
1298
1786
  if (!window.confirm(`卸载 ${row.title}?该包的数据也会一起删除。`)) return;
1299
1787
  setBusy(row.packageName);
1300
- ctx.client.link.call("plugins.uninstall", { name: row.packageName }).then((result) => {
1788
+ link.call("plugins.uninstall", { name: row.packageName }).then((result) => {
1301
1789
  if (!result.ok) {
1302
1790
  setError(rpcErrorText(result.error));
1303
1791
  return;
1304
1792
  }
1305
1793
  setTouched((current) => new Set(current).add(row.packageName));
1794
+ setRestartNeeded(true);
1306
1795
  load();
1307
1796
  }).catch((cause) => {
1308
1797
  setError(cause instanceof Error ? cause.message : String(cause));
@@ -1310,100 +1799,690 @@ function PluginsPage({ ctx }) {
1310
1799
  setBusy(void 0);
1311
1800
  });
1312
1801
  };
1313
- const groups = /* @__PURE__ */ new Map();
1314
- for (const row of rows) {
1315
- const bucket = groups.get(row.category);
1316
- if (bucket === void 0) groups.set(row.category, [row]);
1317
- else bucket.push(row);
1802
+ const inspectPath = (zipPath) => {
1803
+ setMessage(void 0);
1804
+ link.call("plugins.inspect", { zipPath }).then((result) => {
1805
+ if (!result.ok) {
1806
+ setPhase({
1807
+ kind: "error",
1808
+ message: `读取插件包失败:${rpcErrorText(result.error)}`
1809
+ });
1810
+ return;
1811
+ }
1812
+ setPhase({
1813
+ kind: "confirm",
1814
+ zipPath,
1815
+ archive: result.value.archive,
1816
+ viaUrl: false,
1817
+ risk: false
1818
+ });
1819
+ }).catch((cause) => setPhase({
1820
+ kind: "error",
1821
+ message: String(cause)
1822
+ }));
1823
+ };
1824
+ const inspectFromUrl = (url) => {
1825
+ setMessage(void 0);
1826
+ link.call("plugins.inspect-from-url", { url }).then((result) => {
1827
+ if (!result.ok) {
1828
+ setPhase({
1829
+ kind: "error",
1830
+ message: `下载或读取插件包失败:${rpcErrorText(result.error)}`
1831
+ });
1832
+ return;
1833
+ }
1834
+ setPhase({
1835
+ kind: "confirm",
1836
+ zipPath: result.value.zipPath,
1837
+ archive: result.value.archive,
1838
+ viaUrl: true,
1839
+ risk: false
1840
+ });
1841
+ }).catch((cause) => setPhase({
1842
+ kind: "error",
1843
+ message: String(cause)
1844
+ }));
1845
+ };
1846
+ const runInstall = (zipPath, archive) => {
1847
+ setPhase({ kind: "installing" });
1848
+ (archive.kind === "combo" ? link.call("plugins.install-combo", { zipPath }) : link.call("plugins.install", { zipPath })).then((result) => {
1849
+ if (!result.ok) {
1850
+ setPhase({
1851
+ kind: "error",
1852
+ message: `安装失败:${rpcErrorText(result.error)}`
1853
+ });
1854
+ return;
1855
+ }
1856
+ setPhase({ kind: "idle" });
1857
+ closeInstall();
1858
+ setRestartNeeded(true);
1859
+ load();
1860
+ }).catch((cause) => setPhase({
1861
+ kind: "error",
1862
+ message: String(cause)
1863
+ }));
1864
+ };
1865
+ /** The update pill's click: a plain update installs directly; a key
1866
+ * change confirmation intercepts first. */
1867
+ const requestUpdate = (update) => {
1868
+ if (update.keyChanged === true) {
1869
+ setKeyChange(update);
1870
+ return;
1871
+ }
1872
+ updateNow(update.name);
1873
+ };
1874
+ /** The update itself: the feed's entry, no preview. */
1875
+ const updateNow = (name) => {
1876
+ setKeyChange(void 0);
1877
+ setUpdatingName(name);
1878
+ setMessage(void 0);
1879
+ link.call("plugins.remote-install", { name }).then((result) => {
1880
+ setUpdatingName(void 0);
1881
+ if (!result.ok) {
1882
+ setMessage({
1883
+ kind: "error",
1884
+ text: rpcErrorText(result.error)
1885
+ });
1886
+ return;
1887
+ }
1888
+ setRestartNeeded(true);
1889
+ load();
1890
+ }).catch(() => setUpdatingName(void 0));
1891
+ };
1892
+ /** The tri-form input: address/path → inspect, anything else → feed search. */
1893
+ const submitQuery = () => {
1894
+ const text = query.trim();
1895
+ if (text === "") return;
1896
+ setMessage(void 0);
1897
+ if (isHttpUrl(text)) {
1898
+ inspectFromUrl(text);
1899
+ return;
1900
+ }
1901
+ if (looksLikePath(text)) {
1902
+ inspectPath(text);
1903
+ return;
1904
+ }
1905
+ runSearch(text);
1906
+ };
1907
+ const runSearch = (text) => {
1908
+ setSearching(true);
1909
+ setSearchResults(void 0);
1910
+ link.call("plugins.remote-list", {}).then((result) => {
1911
+ setSearching(false);
1912
+ if (!result.ok) {
1913
+ setMessage({
1914
+ kind: "error",
1915
+ text: `搜索失败:${rpcErrorText(result.error)}`
1916
+ });
1917
+ return;
1918
+ }
1919
+ const needle = text.toLowerCase();
1920
+ setSearchResults(result.value.plugins.filter((item) => item.name.toLowerCase().includes(needle) || (item.title ?? "").toLowerCase().includes(needle) || (item.description ?? "").toLowerCase().includes(needle)));
1921
+ }).catch((cause) => {
1922
+ setSearching(false);
1923
+ setMessage({
1924
+ kind: "error",
1925
+ text: String(cause)
1926
+ });
1927
+ });
1928
+ };
1929
+ /** A search-result entry that is not installed yet: preview first. The
1930
+ * entry's own coordinates decide where the zip comes from — a federation
1931
+ * row downloads from the author's release, a same-directory row from its
1932
+ * feed base. */
1933
+ const previewRemote = (item) => {
1934
+ if (item.url !== void 0) {
1935
+ inspectFromUrl(item.url);
1936
+ return;
1937
+ }
1938
+ if (item.feedUrl === void 0 || item.file === void 0) return;
1939
+ const base = item.feedUrl.endsWith("/") ? item.feedUrl : `${item.feedUrl}/`;
1940
+ inspectFromUrl(`${base}${item.file}`);
1941
+ };
1942
+ const onDrop = (event) => {
1943
+ event.preventDefault();
1944
+ setDragging(false);
1945
+ const file = event.dataTransfer.files[0];
1946
+ if (file === void 0) return;
1947
+ if (!file.name.toLowerCase().endsWith(".zip")) {
1948
+ setMessage({
1949
+ kind: "error",
1950
+ text: "只支持 .zip 插件包或组合包"
1951
+ });
1952
+ return;
1953
+ }
1954
+ const zipPath = droppedZipPath(file);
1955
+ if (zipPath === null) {
1956
+ setMessage({
1957
+ kind: "error",
1958
+ text: "当前环境不支持拖拽安装(缺少路径桥)"
1959
+ });
1960
+ return;
1961
+ }
1962
+ inspectPath(zipPath);
1963
+ };
1964
+ const restart = () => {
1965
+ link.call("window.relaunch", {});
1966
+ };
1967
+ const visibleResults = searchResults?.slice(0, SEARCH_ROW_CAP);
1968
+ const spans = /* @__PURE__ */ new Map();
1969
+ for (let index = 0; index < rows.length;) {
1970
+ const category = rows[index].category;
1971
+ let end = index + 1;
1972
+ while (end < rows.length && rows[end].category === category) end += 1;
1973
+ spans.set(index, end - index);
1974
+ index = end;
1318
1975
  }
1319
- return jsx(Page, {
1976
+ return jsxs(Page, {
1320
1977
  title: "插件管理",
1321
- description: "安装驱动、业务页面和界面风格。启用/停用写入 plugins.yml,渲染端在下一次重启后生效。",
1322
- actions: jsx(Button, {
1323
- intent: "neutral",
1324
- emphasis: "outline",
1325
- onClick: load,
1326
- children: "刷新"
1978
+ titleExtra: jsx(IconButton, {
1979
+ icon: jsx(PlusIcon, {}),
1980
+ label: "安装插件",
1981
+ onClick: openInstall
1327
1982
  }),
1328
- children: jsxs(Stack, {
1329
- gap: "lg",
1330
- children: [error !== void 0 && jsx("div", {
1331
- role: "alert",
1332
- style: { color: "var(--snap-color-danger)" },
1333
- children: error
1334
- }), rows.length === 0 ? jsx(EmptyState, {
1335
- title: "还没有安装插件",
1336
- description: "把插件 zip 拖入插件安装入口,或从插件源搜索安装。"
1337
- }) : [...groups.entries()].map(([category, entries]) => jsx(Section, {
1338
- title: category,
1339
- children: jsxs(Table, { children: [jsx(TableHeader, { children: jsxs(TableRow, { children: [
1340
- jsx(TableHead, { children: "名称" }),
1341
- jsx(TableHead, { children: "类型" }),
1342
- jsx(TableHead, { children: "版本" }),
1343
- jsx(TableHead, { children: "状态" }),
1344
- jsx(TableHead, { children: "操作" })
1345
- ] }) }), jsx(TableBody, { children: entries.map((row) => jsxs(TableRow, { children: [
1346
- jsx(TableCell, { children: jsxs("div", {
1347
- style: {
1348
- display: "flex",
1349
- flexDirection: "column"
1350
- },
1351
- children: [jsxs("span", {
1352
- style: {
1353
- display: "flex",
1354
- alignItems: "center",
1355
- gap: "var(--snap-space-sm)"
1356
- },
1357
- children: [row.title, row.builtinDefault && jsx(Badge, {
1983
+ actions: restartNeeded ? jsx(Button, {
1984
+ intent: "primary",
1985
+ onClick: restart,
1986
+ children: "重启生效"
1987
+ }) : void 0,
1988
+ children: [
1989
+ jsxs(Stack, {
1990
+ gap: "lg",
1991
+ children: [error !== void 0 && jsx("div", {
1992
+ role: "alert",
1993
+ style: { color: "var(--snap-color-danger)" },
1994
+ children: error
1995
+ }), rows.length === 0 ? jsx(EmptyState, {
1996
+ title: "还没有安装插件",
1997
+ action: jsx(Button, {
1998
+ intent: "primary",
1999
+ onClick: openInstall,
2000
+ children: "安装插件"
2001
+ })
2002
+ }) : jsxs(Table, {
2003
+ "data-plugins-table": true,
2004
+ children: [jsx(TableHeader, { children: jsxs(TableRow, { children: [
2005
+ jsx(TableHead, {
2006
+ style: { width: "6em" },
2007
+ children: "分类"
2008
+ }),
2009
+ jsx(TableHead, { children: "名称" }),
2010
+ jsx(TableHead, { children: "类型" }),
2011
+ jsx(TableHead, { children: "版本" }),
2012
+ jsx(TableHead, { children: "状态" }),
2013
+ jsx(TableHead, { children: "操作" })
2014
+ ] }) }), jsx(TableBody, { children: rows.map((row, index) => {
2015
+ const update = updates.get(row.packageName);
2016
+ const span = spans.get(index);
2017
+ return jsxs(TableRow, { children: [
2018
+ span !== void 0 && jsx(TableCell, {
2019
+ rowSpan: span,
2020
+ style: {
2021
+ verticalAlign: "middle",
2022
+ color: "var(--snap-color-muted)",
2023
+ fontWeight: 600
2024
+ },
2025
+ children: row.category
2026
+ }),
2027
+ jsx(TableCell, { children: jsxs("div", {
2028
+ style: {
2029
+ display: "flex",
2030
+ flexDirection: "column"
2031
+ },
2032
+ children: [jsxs("span", {
2033
+ style: {
2034
+ display: "flex",
2035
+ alignItems: "center",
2036
+ gap: "var(--snap-space-sm)"
2037
+ },
2038
+ children: [row.title, row.builtinDefault && jsx(Badge, {
2039
+ intent: "neutral",
2040
+ children: "内置默认"
2041
+ })]
2042
+ }), jsx("span", {
2043
+ style: {
2044
+ color: "var(--snap-color-muted)",
2045
+ fontSize: "var(--snap-text-xs)"
2046
+ },
2047
+ children: row.packageName
2048
+ })]
2049
+ }) }),
2050
+ jsxs(TableCell, { children: [KIND_LABELS[row.kind] ?? row.kind, row.uiProfile !== void 0 && jsx(Badge, {
1358
2051
  intent: "neutral",
1359
- children: "内置默认"
1360
- })]
1361
- }), jsx("span", {
1362
- style: {
1363
- color: "var(--snap-color-muted)",
1364
- fontSize: "var(--snap-text-xs)"
1365
- },
1366
- children: row.packageName
1367
- })]
1368
- }) }),
1369
- jsxs(TableCell, { children: [KIND_LABELS[row.kind] ?? row.kind, row.uiProfile !== void 0 && jsx(Badge, {
1370
- intent: "neutral",
1371
- children: PROFILE_LABELS[row.uiProfile] ?? row.uiProfile
1372
- })] }),
1373
- jsx(TableCell, { children: row.version ?? "—" }),
1374
- jsx(TableCell, { children: row.builtinDefault ? jsx(Badge, {
1375
- intent: "success",
1376
- children: "始终随底座"
1377
- }) : jsxs("div", {
1378
- style: {
1379
- display: "flex",
1380
- alignItems: "center",
1381
- gap: "var(--snap-space-sm)"
1382
- },
1383
- children: [jsx(Switch, {
1384
- checked: row.enabled,
1385
- disabled: busy === row.packageName,
1386
- onCheckedChange: (next) => toggle(row, next),
1387
- "aria-label": `启用 ${row.title}`
1388
- }), touched.has(row.packageName) && jsx(Badge, {
1389
- intent: "warning",
1390
- children: "待重启"
1391
- })]
1392
- }) }),
1393
- jsx(TableCell, { children: row.builtinDefault ? jsx("span", {
1394
- style: { color: "var(--snap-color-muted)" },
1395
- children: "内置默认不可卸载"
1396
- }) : jsx(Button, {
1397
- intent: "danger",
1398
- emphasis: "ghost",
1399
- size: "sm",
1400
- disabled: busy === row.packageName,
1401
- onClick: () => uninstall(row),
1402
- children: "卸载"
1403
- }) })
1404
- ] }, row.packageName)) })] })
1405
- }, category))]
1406
- })
2052
+ children: PROFILE_LABELS[row.uiProfile] ?? row.uiProfile
2053
+ })] }),
2054
+ jsx(TableCell, { children: update !== void 0 ? jsx(Button, {
2055
+ intent: "primary",
2056
+ emphasis: "ghost",
2057
+ size: "sm",
2058
+ title: update.keyChanged === true ? `当前 ${update.installedVersion} → ${update.feedVersion} · 发布者密钥已变更` : `当前 ${update.installedVersion} → ${update.feedVersion}`,
2059
+ disabled: updatingName === row.packageName,
2060
+ onClick: () => requestUpdate(update),
2061
+ children: updatingName === row.packageName ? "更新中…" : `⟳ ${update.feedVersion}`
2062
+ }) : row.version ?? "—" }),
2063
+ jsx(TableCell, { children: row.builtinDefault ? jsx(Switch, {
2064
+ checked: true,
2065
+ disabled: true,
2066
+ "aria-label": `启用 ${row.title}`
2067
+ }) : jsxs("div", {
2068
+ style: {
2069
+ display: "flex",
2070
+ alignItems: "center",
2071
+ gap: "var(--snap-space-sm)"
2072
+ },
2073
+ children: [jsx(Switch, {
2074
+ checked: row.enabled,
2075
+ disabled: busy === row.packageName,
2076
+ onCheckedChange: (next) => toggle(row, next),
2077
+ "aria-label": `启用 ${row.title}`
2078
+ }), touched.has(row.packageName) && jsx(Badge, {
2079
+ intent: "warning",
2080
+ children: "待重启"
2081
+ })]
2082
+ }) }),
2083
+ jsx(TableCell, { children: row.builtinDefault ? jsx("span", {
2084
+ style: { color: "var(--snap-color-muted)" },
2085
+ children: "内置默认不可卸载"
2086
+ }) : jsx(Button, {
2087
+ intent: "danger",
2088
+ emphasis: "ghost",
2089
+ size: "sm",
2090
+ disabled: busy === row.packageName,
2091
+ onClick: () => uninstall(row),
2092
+ children: "卸载"
2093
+ }) })
2094
+ ] }, row.packageName);
2095
+ }) })]
2096
+ })]
2097
+ }),
2098
+ jsx(Dialog, {
2099
+ open: installOpen,
2100
+ onOpenChange: (next) => {
2101
+ if (!next) closeInstall();
2102
+ },
2103
+ children: jsxs(DialogContent, {
2104
+ presentation: "modal",
2105
+ size: "lg",
2106
+ "data-plugins-dropzone": true,
2107
+ "aria-describedby": void 0,
2108
+ onDragOver: (event) => {
2109
+ event.preventDefault();
2110
+ setDragging(true);
2111
+ },
2112
+ onDragLeave: (event) => {
2113
+ if (event.relatedTarget === null || !event.currentTarget.contains(event.relatedTarget)) setDragging(false);
2114
+ },
2115
+ onDrop,
2116
+ children: [jsx(DialogHeader, { children: jsx(DialogTitle, { children: "安装插件" }) }), jsx(DialogBody, { children: jsxs(Stack, {
2117
+ gap: "sm",
2118
+ children: [
2119
+ jsx("div", {
2120
+ "data-plugins-drop-hint": true,
2121
+ style: {
2122
+ height: "calc(var(--snap-control-height-md) * 3)",
2123
+ display: "flex",
2124
+ alignItems: "center",
2125
+ justifyContent: "center",
2126
+ border: `1px dashed ${dragging ? "var(--snap-color-accent)" : "var(--snap-color-border)"}`,
2127
+ borderRadius: "var(--snap-radius-md)",
2128
+ background: dragging ? "color-mix(in srgb, var(--snap-color-accent) 10%, transparent)" : "transparent",
2129
+ color: "var(--snap-color-muted)",
2130
+ fontSize: "var(--snap-text-sm)"
2131
+ },
2132
+ children: dragging ? "释放以安装" : "拖入 .zip 安装"
2133
+ }),
2134
+ jsxs("div", {
2135
+ style: {
2136
+ display: "flex",
2137
+ gap: "var(--snap-space-sm)"
2138
+ },
2139
+ children: [jsx(Input, {
2140
+ value: query,
2141
+ placeholder: "本地路径 / https://… / 插件名",
2142
+ style: {
2143
+ flex: 1,
2144
+ minWidth: 0
2145
+ },
2146
+ onChange: (event) => setQuery(event.target.value),
2147
+ onKeyDown: (event) => {
2148
+ if (event.key === "Enter") submitQuery();
2149
+ }
2150
+ }), jsx(Button, {
2151
+ intent: "neutral",
2152
+ emphasis: "outline",
2153
+ disabled: searching,
2154
+ onClick: submitQuery,
2155
+ children: searching ? "搜索中…" : "搜索"
2156
+ })]
2157
+ }),
2158
+ message !== void 0 && jsx("div", {
2159
+ role: message.kind === "error" ? "alert" : "status",
2160
+ style: {
2161
+ fontSize: "var(--snap-text-xs)",
2162
+ color: message.kind === "error" ? "var(--snap-color-danger)" : "var(--snap-color-muted)"
2163
+ },
2164
+ children: message.text
2165
+ }),
2166
+ visibleResults !== void 0 && jsxs(Stack, {
2167
+ gap: "sm",
2168
+ children: [
2169
+ jsxs("div", {
2170
+ style: {
2171
+ display: "flex",
2172
+ justifyContent: "space-between",
2173
+ alignItems: "center"
2174
+ },
2175
+ children: [jsxs("span", {
2176
+ style: {
2177
+ fontSize: "var(--snap-text-sm)",
2178
+ color: "var(--snap-color-muted)"
2179
+ },
2180
+ children: [
2181
+ "搜索“",
2182
+ query.trim(),
2183
+ "”(",
2184
+ searchResults?.length ?? 0,
2185
+ ")"
2186
+ ]
2187
+ }), jsx(Button, {
2188
+ intent: "neutral",
2189
+ emphasis: "ghost",
2190
+ size: "sm",
2191
+ onClick: () => setSearchResults(void 0),
2192
+ children: "✕"
2193
+ })]
2194
+ }),
2195
+ visibleResults.length === 0 && jsx("div", {
2196
+ style: {
2197
+ padding: "12px 0",
2198
+ textAlign: "center",
2199
+ color: "var(--snap-color-muted)",
2200
+ fontSize: "var(--snap-text-sm)"
2201
+ },
2202
+ children: "没有匹配的插件。"
2203
+ }),
2204
+ visibleResults.map((item) => {
2205
+ const installed = item.installed !== void 0;
2206
+ return jsxs("div", {
2207
+ style: {
2208
+ display: "flex",
2209
+ gap: "var(--snap-space-md)",
2210
+ alignItems: "center",
2211
+ justifyContent: "space-between",
2212
+ borderBottom: "1px solid var(--snap-color-border)",
2213
+ paddingBottom: "var(--snap-space-sm)"
2214
+ },
2215
+ children: [jsxs("div", {
2216
+ style: { minWidth: 0 },
2217
+ children: [jsxs("div", {
2218
+ style: {
2219
+ display: "flex",
2220
+ gap: "var(--snap-space-sm)",
2221
+ alignItems: "center"
2222
+ },
2223
+ children: [item.title ?? item.name, item.source !== void 0 && jsx(Badge, {
2224
+ intent: "neutral",
2225
+ children: item.source
2226
+ })]
2227
+ }), jsxs("div", {
2228
+ style: {
2229
+ fontSize: "var(--snap-text-xs)",
2230
+ color: "var(--snap-color-muted)"
2231
+ },
2232
+ children: [
2233
+ item.name,
2234
+ " · ",
2235
+ item.version
2236
+ ]
2237
+ })]
2238
+ }), item.action === "install" ? jsx(Button, {
2239
+ intent: "primary",
2240
+ emphasis: "outline",
2241
+ size: "sm",
2242
+ onClick: () => previewRemote(item),
2243
+ children: "安装"
2244
+ }) : item.action === "update" && installed ? jsx(Button, {
2245
+ intent: "primary",
2246
+ emphasis: "ghost",
2247
+ size: "sm",
2248
+ title: `当前 ${item.installed?.version} → ${item.version}`,
2249
+ disabled: updatingName === item.name,
2250
+ onClick: () => requestUpdate({
2251
+ name: item.name,
2252
+ installedVersion: item.installed?.version ?? "",
2253
+ feedVersion: item.version
2254
+ }),
2255
+ children: updatingName === item.name ? "更新中…" : `⟳ ${item.version}`
2256
+ }) : jsx("span", {
2257
+ style: {
2258
+ fontSize: "var(--snap-text-xs)",
2259
+ color: "var(--snap-color-muted)"
2260
+ },
2261
+ children: item.action === "current" ? "已是最新" : "本地更新"
2262
+ })]
2263
+ }, item.name);
2264
+ }),
2265
+ (searchResults?.length ?? 0) > SEARCH_ROW_CAP && jsxs("div", {
2266
+ style: {
2267
+ fontSize: "var(--snap-text-xs)",
2268
+ color: "var(--snap-color-muted)"
2269
+ },
2270
+ children: [
2271
+ "已显示前 ",
2272
+ SEARCH_ROW_CAP,
2273
+ " 条,共 ",
2274
+ searchResults?.length,
2275
+ " 条。"
2276
+ ]
2277
+ })
2278
+ ]
2279
+ })
2280
+ ]
2281
+ }) })]
2282
+ })
2283
+ }),
2284
+ jsx(Dialog, {
2285
+ open: phase.kind === "confirm" || phase.kind === "installing" || phase.kind === "error",
2286
+ onOpenChange: (next) => {
2287
+ if (!next && phase.kind !== "installing") setPhase({ kind: "idle" });
2288
+ },
2289
+ children: jsxs(DialogContent, {
2290
+ presentation: "modal",
2291
+ "aria-describedby": void 0,
2292
+ children: [
2293
+ jsxs(DialogHeader, { children: [jsx(DialogTitle, { children: phase.kind === "confirm" ? phase.archive.kind === "combo" ? "安装组合套件" : phase.archive.plugin.action === "update" ? "更新插件" : "安装插件" : phase.kind === "error" ? "安装失败" : "正在安装…" }), phase.kind === "confirm" && phase.archive.kind === "combo" && jsx(DialogDescription, { children: `${phase.archive.combo.title} · ${phase.archive.combo.id}` })] }),
2294
+ jsxs(DialogBody, { children: [
2295
+ phase.kind === "error" && jsx("div", {
2296
+ style: {
2297
+ color: "var(--snap-color-danger)",
2298
+ whiteSpace: "pre-wrap",
2299
+ fontSize: "var(--snap-text-sm)"
2300
+ },
2301
+ children: phase.message
2302
+ }),
2303
+ phase.kind === "confirm" && phase.archive.kind === "combo" && jsxs(Stack, {
2304
+ gap: "sm",
2305
+ children: [
2306
+ phase.archive.combo.description !== void 0 && jsx("div", {
2307
+ style: {
2308
+ color: "var(--snap-color-muted)",
2309
+ fontSize: "var(--snap-text-sm)"
2310
+ },
2311
+ children: phase.archive.combo.description
2312
+ }),
2313
+ jsxs("div", {
2314
+ style: {
2315
+ display: "grid",
2316
+ gap: "var(--snap-space-xs)",
2317
+ fontSize: "var(--snap-text-sm)"
2318
+ },
2319
+ children: [jsxs("div", { children: [
2320
+ "插件(",
2321
+ phase.archive.combo.plugins.length,
2322
+ ")"
2323
+ ] }), phase.archive.combo.plugins.map((plugin) => {
2324
+ const line = signatureText(plugin.signature, phase.viaUrl);
2325
+ const action = plugin.action === "install" ? "安装" : plugin.action === "update" ? "更新" : "保留";
2326
+ return jsxs("div", {
2327
+ style: { color: line.warning ? "var(--snap-color-warning)" : void 0 },
2328
+ children: [
2329
+ plugin.title ?? plugin.name,
2330
+ " ",
2331
+ plugin.version,
2332
+ " · ",
2333
+ action,
2334
+ line.warning ? " · ⚠ 未验证" : ""
2335
+ ]
2336
+ }, plugin.name);
2337
+ })]
2338
+ }),
2339
+ phase.archive.combo.missing.length > 0 && jsxs("div", {
2340
+ style: {
2341
+ color: "var(--snap-color-danger)",
2342
+ fontSize: "var(--snap-text-sm)"
2343
+ },
2344
+ children: ["缺少依赖:", phase.archive.combo.missing.join("、")]
2345
+ })
2346
+ ]
2347
+ }),
2348
+ phase.kind === "confirm" && phase.archive.kind === "plugin" && jsxs(Stack, {
2349
+ gap: "sm",
2350
+ children: [
2351
+ phase.risk ? jsx("div", {
2352
+ "data-plugins-risk": true,
2353
+ style: {
2354
+ color: "var(--snap-color-warning)",
2355
+ fontWeight: 600
2356
+ },
2357
+ children: "⚠ 此插件未经发布者验证"
2358
+ }) : void 0,
2359
+ !phase.risk && jsxs(Stack, {
2360
+ gap: "sm",
2361
+ children: [
2362
+ phase.archive.plugin.title !== void 0 && jsxs("div", { children: ["名称:", phase.archive.plugin.title] }),
2363
+ jsxs("div", { children: ["包名:", phase.archive.plugin.name] }),
2364
+ phase.archive.plugin.action === "update" ? jsxs(Fragment, { children: [jsxs("div", { children: ["已安装版本:", phase.archive.plugin.installed?.version] }), jsxs("div", { children: ["将更新至:", phase.archive.plugin.version] })] }) : jsxs("div", { children: ["版本:", phase.archive.plugin.version] })
2365
+ ]
2366
+ }),
2367
+ (() => {
2368
+ const line = signatureText(phase.archive.plugin.signature, phase.viaUrl);
2369
+ return jsxs("div", {
2370
+ "data-plugins-signature": phase.archive.plugin.signature.state,
2371
+ style: { color: line.warning ? "var(--snap-color-warning)" : void 0 },
2372
+ children: ["签名:", line.text]
2373
+ });
2374
+ })(),
2375
+ !phase.risk && jsxs(Stack, {
2376
+ gap: "sm",
2377
+ children: [
2378
+ jsxs("div", { children: ["权限:", phase.archive.plugin.permissions.length === 0 ? "无" : phase.archive.plugin.permissions.join("、")] }),
2379
+ phase.archive.plugin.missing.length > 0 && jsxs("div", {
2380
+ style: {
2381
+ color: "var(--snap-color-danger)",
2382
+ fontSize: "var(--snap-text-sm)"
2383
+ },
2384
+ children: ["缺少依赖:", phase.archive.plugin.missing.join("、")]
2385
+ }),
2386
+ phase.archive.plugin.action === "blocked" && jsxs("div", {
2387
+ style: {
2388
+ color: "var(--snap-color-danger)",
2389
+ fontSize: "var(--snap-text-sm)"
2390
+ },
2391
+ children: [
2392
+ "已安装 v",
2393
+ phase.archive.plugin.installed?.version,
2394
+ ",安装包 v",
2395
+ phase.archive.plugin.version,
2396
+ " 不高于已装版本,无法覆盖。"
2397
+ ]
2398
+ })
2399
+ ]
2400
+ }),
2401
+ phase.risk && jsx("div", {
2402
+ style: {
2403
+ color: "var(--snap-color-muted)",
2404
+ fontSize: "var(--snap-text-sm)"
2405
+ },
2406
+ children: phase.archive.plugin.signature.keyId !== void 0 ? `签名 keyId ${phase.archive.plugin.signature.keyId} 不在本机信任名单中,无法验证发布者。` : "这个包没有携带任何签名,也没有任何完整性校验。"
2407
+ })
2408
+ ]
2409
+ })
2410
+ ] }),
2411
+ jsxs(DialogFooter, { children: [
2412
+ phase.kind === "error" && jsx(Button, {
2413
+ intent: "neutral",
2414
+ emphasis: "outline",
2415
+ onClick: () => setPhase({ kind: "idle" }),
2416
+ children: "返回"
2417
+ }),
2418
+ phase.kind === "confirm" && jsxs(Fragment, { children: [jsx(Button, {
2419
+ intent: "neutral",
2420
+ emphasis: "outline",
2421
+ onClick: () => setPhase({ kind: "idle" }),
2422
+ children: "取消"
2423
+ }), phase.risk ? jsx(Button, {
2424
+ intent: "primary",
2425
+ "data-plugins-risk-confirm": true,
2426
+ onClick: () => runInstall(phase.zipPath, phase.archive),
2427
+ children: "我知晓风险,仍要安装"
2428
+ }) : jsx(Button, {
2429
+ intent: "primary",
2430
+ "data-plugins-install-confirm": true,
2431
+ disabled: phase.archive.kind === "plugin" && phase.archive.plugin.action === "blocked",
2432
+ onClick: () => {
2433
+ if (phase.archive.kind === "plugin" && phase.archive.plugin.signature.state === "unverified") {
2434
+ setPhase({
2435
+ ...phase,
2436
+ risk: true
2437
+ });
2438
+ return;
2439
+ }
2440
+ runInstall(phase.zipPath, phase.archive);
2441
+ },
2442
+ children: phase.archive.kind === "combo" ? "安装组合" : phase.archive.plugin.action === "update" ? "更新" : "安装"
2443
+ })] }),
2444
+ phase.kind === "installing" && jsx("span", {
2445
+ style: { color: "var(--snap-color-muted)" },
2446
+ children: "正在安装…"
2447
+ })
2448
+ ] })
2449
+ ]
2450
+ })
2451
+ }),
2452
+ jsx(Dialog, {
2453
+ open: keyChange !== void 0,
2454
+ onOpenChange: (next) => {
2455
+ if (!next) setKeyChange(void 0);
2456
+ },
2457
+ children: jsxs(DialogContent, {
2458
+ presentation: "modal",
2459
+ children: [
2460
+ jsxs(DialogHeader, { children: [jsx(DialogTitle, { children: "发布者密钥已变更" }), jsxs(DialogDescription, { children: [keyChange?.name, " 的新版本由不同的密钥签名。"] })] }),
2461
+ jsx(DialogBody, { children: keyChange !== void 0 && jsxs("div", {
2462
+ style: { fontSize: "var(--snap-text-sm)" },
2463
+ children: [
2464
+ "已安装 v",
2465
+ keyChange.installedVersion,
2466
+ " → 源上 v",
2467
+ keyChange.feedVersion,
2468
+ "。"
2469
+ ]
2470
+ }) }),
2471
+ jsxs(DialogFooter, { children: [jsx(Button, {
2472
+ intent: "neutral",
2473
+ emphasis: "outline",
2474
+ onClick: () => setKeyChange(void 0),
2475
+ children: "取消"
2476
+ }), jsx(Button, {
2477
+ intent: "primary",
2478
+ "data-plugins-keychange-confirm": true,
2479
+ onClick: () => keyChange !== void 0 && updateNow(keyChange.name),
2480
+ children: "仍要更新"
2481
+ })] })
2482
+ ]
2483
+ })
2484
+ })
2485
+ ]
1407
2486
  });
1408
2487
  }
1409
2488
  //#endregion
@@ -1445,6 +2524,19 @@ function GearIcon() {
1445
2524
  }), jsx("path", { d: "M19.4 15a1.7 1.7 0 0 0 .34 1.87l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.7 1.7 0 0 0-1.87-.34 1.7 1.7 0 0 0-1 1.55V21a2 2 0 1 1-4 0v-.09a1.7 1.7 0 0 0-1-1.55 1.7 1.7 0 0 0-1.87.34l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.7 1.7 0 0 0 .34-1.87 1.7 1.7 0 0 0-1.55-1H3a2 2 0 1 1 0-4h.09a1.7 1.7 0 0 0 1.55-1 1.7 1.7 0 0 0-.34-1.87l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.7 1.7 0 0 0 1.87.34h0a1.7 1.7 0 0 0 1-1.55V3a2 2 0 1 1 4 0v.09a1.7 1.7 0 0 0 1 1.55h0a1.7 1.7 0 0 0 1.87-.34l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.7 1.7 0 0 0-.34 1.87v0a1.7 1.7 0 0 0 1.55 1H21a2 2 0 1 1 0 4h-.09a1.7 1.7 0 0 0-1.55 1Z" })]
1446
2525
  });
1447
2526
  }
2527
+ /** The close glyph used by the surface's dismiss control. */
2528
+ function CloseIcon() {
2529
+ return jsx("svg", {
2530
+ viewBox: "0 0 24 24",
2531
+ width: "18",
2532
+ height: "18",
2533
+ fill: "none",
2534
+ stroke: "currentColor",
2535
+ strokeWidth: "1.8",
2536
+ "aria-hidden": "true",
2537
+ children: jsx("path", { d: "M6 6l12 12M18 6L6 18" })
2538
+ });
2539
+ }
1448
2540
  /** The default settings trigger; the layout decides placement/presentation. */
1449
2541
  function SettingsEntry(props) {
1450
2542
  if (props.presentation === "label") return jsx(Button, {
@@ -1463,12 +2555,13 @@ function SettingsEntry(props) {
1463
2555
  }
1464
2556
  /** The default settings surface. */
1465
2557
  function SettingsSurface(props) {
1466
- const { service } = props;
2558
+ const { service, ctx } = props;
1467
2559
  useSyncExternalStore(service.subscribe, service.version, service.version);
1468
2560
  const open = service.isOpen();
1469
2561
  const pages = service.listPages();
1470
2562
  const activeId = service.activePage();
1471
2563
  const active = pages.find((page) => page.id === activeId);
2564
+ const [feedOpen, setFeedOpen] = useState(false);
1472
2565
  const groups = /* @__PURE__ */ new Map();
1473
2566
  for (const page of pages) {
1474
2567
  const group = page.group ?? "其他";
@@ -1476,7 +2569,7 @@ function SettingsSurface(props) {
1476
2569
  if (bucket === void 0) groups.set(group, [page]);
1477
2570
  else bucket.push(page);
1478
2571
  }
1479
- return jsx(Dialog, {
2572
+ return jsxs(Fragment, { children: [jsx(Dialog, {
1480
2573
  open,
1481
2574
  onOpenChange: (next) => {
1482
2575
  if (!next) service.close();
@@ -1490,11 +2583,21 @@ function SettingsSurface(props) {
1490
2583
  children: [jsxs("header", {
1491
2584
  ...part("settings", "header"),
1492
2585
  className: "snap-settings-header",
1493
- children: [jsx(DialogTitle, { children: "设置" }), jsx(Button, {
1494
- intent: "neutral",
1495
- emphasis: "ghost",
1496
- onClick: () => service.close(),
1497
- children: "关闭"
2586
+ children: [jsx(DialogTitle, { children: "设置" }), jsxs("div", {
2587
+ style: {
2588
+ display: "flex",
2589
+ alignItems: "center",
2590
+ gap: 4
2591
+ },
2592
+ children: [jsx(IconButton, {
2593
+ icon: jsx(GearIcon, {}),
2594
+ label: "配置插件源",
2595
+ onClick: () => setFeedOpen(true)
2596
+ }), jsx(IconButton, {
2597
+ icon: jsx(CloseIcon, {}),
2598
+ label: "关闭",
2599
+ onClick: () => service.close()
2600
+ })]
1498
2601
  })]
1499
2602
  }), jsxs("div", {
1500
2603
  ...part("settings", "body"),
@@ -1527,10 +2630,7 @@ function SettingsSurface(props) {
1527
2630
  ...part("settings", "content"),
1528
2631
  className: "snap-settings-content",
1529
2632
  "data-active-page": activeId,
1530
- children: active === void 0 ? jsx(EmptyState, {
1531
- title: "暂无设置页",
1532
- description: "安装或启用一个带设置页的插件后,它会出现在这里。"
1533
- }) : jsx(SettingsPageBoundary, {
2633
+ children: active === void 0 ? jsx(EmptyState, { title: "暂无设置页" }) : jsx(SettingsPageBoundary, {
1534
2634
  page: active.id,
1535
2635
  children: active.render()
1536
2636
  })
@@ -1538,7 +2638,11 @@ function SettingsSurface(props) {
1538
2638
  })]
1539
2639
  })
1540
2640
  })
1541
- });
2641
+ }), jsx(PluginFeedDialog, {
2642
+ ctx,
2643
+ open: feedOpen,
2644
+ onOpenChange: setFeedOpen
2645
+ })] });
1542
2646
  }
1543
2647
  /** Mount the settings registry and its default slot contributions. */
1544
2648
  const settingsPlugin = {
@@ -1642,242 +2746,24 @@ const settingsPlugin = {
1642
2746
  ctx.ui.contribute(ctx, UI_SLOT_IDS.settingsSurface, {
1643
2747
  id: "settings.default-surface",
1644
2748
  order: 0,
1645
- render: () => jsx(SettingsSurface, { service })
1646
- });
1647
- }
1648
- };
1649
- //#endregion
1650
- //#region lib/types/skins.js
1651
- /** The built-in default skin id. */
1652
- const DEFAULT_SKIN_ID = "default";
1653
- /** The factory cobalt/steel skin. Extra skins override it through the registry. */
1654
- const DEFAULT_SKIN = {
1655
- id: DEFAULT_SKIN_ID,
1656
- title: "工业钴蓝",
1657
- presentations: {
1658
- dialog: "modal",
1659
- select: "popover",
1660
- tabs: "inline",
1661
- toast: "inline"
1662
- },
1663
- tokens: {
1664
- dark: {
1665
- colorBg: "#0b0f14",
1666
- colorSurface: "#11161d",
1667
- colorSurfaceRaised: "#161b22",
1668
- colorText: "#ced8e3",
1669
- colorMuted: "#8b949e",
1670
- colorPrimary: "#4a6cff",
1671
- colorOnPrimary: "#ffffff",
1672
- colorDanger: "#f85149",
1673
- colorSuccess: "#3fb950",
1674
- colorWarning: "#d29922",
1675
- colorBorder: "#1f2933",
1676
- colorFocus: "#4a6cff",
1677
- chart1: "#4a6cff",
1678
- chart2: "#3147a1",
1679
- chart3: "#667fcd",
1680
- chart4: "#7d8fa5",
1681
- chart5: "#55677c",
1682
- chart6: "#33414f",
1683
- fontSans: "system-ui, \"Segoe UI\", \"Microsoft YaHei\", sans-serif",
1684
- fontMono: "\"Cascadia Code\", \"Cascadia Mono\", Consolas, ui-monospace, monospace",
1685
- textXs: "13px",
1686
- textSm: "15px",
1687
- textMd: "17px",
1688
- textLg: "20px",
1689
- textXl: "24px",
1690
- weightNormal: "400",
1691
- weightMedium: "500",
1692
- weightStrong: "600",
1693
- leadingTight: "1.2",
1694
- leadingNormal: "1.55",
1695
- spaceXs: "4px",
1696
- spaceSm: "8px",
1697
- spaceMd: "12px",
1698
- spaceLg: "20px",
1699
- spaceXl: "32px",
1700
- radiusSm: "6px",
1701
- radiusMd: "8px",
1702
- radiusLg: "12px",
1703
- radiusFull: "999px",
1704
- borderWidth: "1px",
1705
- shadowSm: "0 1px 2px rgb(0 0 0 / 0.25)",
1706
- shadowMd: "0 8px 24px rgb(0 0 0 / 0.28)",
1707
- shadowLg: "0 24px 64px rgb(0 0 0 / 0.36)",
1708
- durationFast: "120ms",
1709
- durationNormal: "180ms",
1710
- durationSlow: "280ms",
1711
- easeStandard: "cubic-bezier(0.2, 0, 0, 1)",
1712
- zOverlay: "50",
1713
- zModal: "60",
1714
- zToast: "70",
1715
- controlHeightSm: "40px",
1716
- controlHeightMd: "48px",
1717
- controlHeightLg: "56px",
1718
- density: "comfortable"
1719
- },
1720
- light: {
1721
- colorBg: "#e4e9ef",
1722
- colorSurface: "#f3f6f9",
1723
- colorSurfaceRaised: "#ffffff",
1724
- colorText: "#26323e",
1725
- colorMuted: "#5d6d7e",
1726
- colorPrimary: "#3857e8",
1727
- colorOnPrimary: "#ffffff",
1728
- colorDanger: "#dc2626",
1729
- colorSuccess: "#15803d",
1730
- colorWarning: "#b45309",
1731
- colorBorder: "#c7d0da",
1732
- colorFocus: "#3857e8",
1733
- chart1: "#3857e8",
1734
- chart2: "#7088ee",
1735
- chart3: "#667dd0",
1736
- chart4: "#94a3b8",
1737
- chart5: "#b3c0cd",
1738
- chart6: "#ccd6e0",
1739
- fontSans: "system-ui, \"Segoe UI\", \"Microsoft YaHei\", sans-serif",
1740
- fontMono: "\"Cascadia Code\", \"Cascadia Mono\", Consolas, ui-monospace, monospace",
1741
- textXs: "13px",
1742
- textSm: "15px",
1743
- textMd: "17px",
1744
- textLg: "20px",
1745
- textXl: "24px",
1746
- weightNormal: "400",
1747
- weightMedium: "500",
1748
- weightStrong: "600",
1749
- leadingTight: "1.2",
1750
- leadingNormal: "1.55",
1751
- spaceXs: "4px",
1752
- spaceSm: "8px",
1753
- spaceMd: "12px",
1754
- spaceLg: "20px",
1755
- spaceXl: "32px",
1756
- radiusSm: "6px",
1757
- radiusMd: "8px",
1758
- radiusLg: "12px",
1759
- radiusFull: "999px",
1760
- borderWidth: "1px",
1761
- shadowSm: "0 1px 2px rgb(0 0 0 / 0.08)",
1762
- shadowMd: "0 8px 24px rgb(0 0 0 / 0.12)",
1763
- shadowLg: "0 24px 64px rgb(0 0 0 / 0.18)",
1764
- durationFast: "120ms",
1765
- durationNormal: "180ms",
1766
- durationSlow: "280ms",
1767
- easeStandard: "cubic-bezier(0.2, 0, 0, 1)",
1768
- zOverlay: "50",
1769
- zModal: "60",
1770
- zToast: "70",
1771
- controlHeightSm: "40px",
1772
- controlHeightMd: "48px",
1773
- controlHeightLg: "56px",
1774
- density: "comfortable"
1775
- }
1776
- }
1777
- };
1778
- /** Turn a token key into its CSS custom property (`chart1` → `--snap-chart-1`). */
1779
- function skinTokenVar(key) {
1780
- return `--snap-${key.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`).replace(/(\d+)$/, "-$1")}`;
1781
- }
1782
- /** Apply the active skin to the document root. */
1783
- function applySkin(skin, mode) {
1784
- if (typeof document === "undefined") return;
1785
- const root = document.documentElement;
1786
- root.dataset["snapSkin"] = skin.id;
1787
- root.dataset["snapMode"] = mode;
1788
- const tokens = skin.tokens[mode];
1789
- for (const [key, value] of Object.entries(tokens)) root.style.setProperty(skinTokenVar(key), value);
1790
- }
1791
- /** Mount the `ctx.skins` registry. */
1792
- const skinsPlugin = {
1793
- name: "snap-rail ui skins",
1794
- apply(ctx) {
1795
- const skins = /* @__PURE__ */ new Map();
1796
- const listeners = /* @__PURE__ */ new Set();
1797
- const styleTags = /* @__PURE__ */ new Map();
1798
- let activeId = DEFAULT_SKIN_ID;
1799
- let mode = "dark";
1800
- let revision = 0;
1801
- skins.set(DEFAULT_SKIN_ID, DEFAULT_SKIN);
1802
- const notify = () => {
1803
- revision += 1;
1804
- for (const listener of listeners) listener();
1805
- ctx.emit("skins/changed");
1806
- };
1807
- const ensureStyleTag = (skin) => {
1808
- if (typeof document === "undefined" || skin.css === void 0) return;
1809
- if (styleTags.has(skin.id)) return;
1810
- const tag = document.createElement("style");
1811
- tag.dataset["snapSkinStyle"] = skin.id;
1812
- tag.textContent = skin.css;
1813
- document.head.append(tag);
1814
- styleTags.set(skin.id, tag);
1815
- };
1816
- const refresh = () => {
1817
- const skin = skins.get(activeId) ?? DEFAULT_SKIN;
1818
- activeId = skin.id;
1819
- ensureStyleTag(skin);
1820
- applySkin(skin, mode);
1821
- notify();
1822
- };
1823
- ctx.provide("skins", {
1824
- register(caller, skin) {
1825
- skins.set(skin.id, skin);
1826
- if (skin.id !== "default") activeId = skin.id;
1827
- refresh();
1828
- const remove = () => {
1829
- if (!skins.delete(skin.id)) return;
1830
- const tag = styleTags.get(skin.id);
1831
- if (tag !== void 0) {
1832
- tag.remove();
1833
- styleTags.delete(skin.id);
1834
- }
1835
- if (activeId === skin.id) activeId = DEFAULT_SKIN_ID;
1836
- refresh();
1837
- };
1838
- caller.effect(() => remove);
1839
- return remove;
1840
- },
1841
- activate(skinId) {
1842
- if (!skins.has(skinId)) return false;
1843
- activeId = skinId;
1844
- refresh();
1845
- return true;
1846
- },
1847
- list: () => [skins.get("default") ?? DEFAULT_SKIN, ...[...skins.values()].filter((skin) => skin.id !== DEFAULT_SKIN_ID)],
1848
- active: () => skins.get(activeId) ?? DEFAULT_SKIN,
1849
- setMode(next) {
1850
- if (mode === next) return;
1851
- mode = next;
1852
- refresh();
1853
- },
1854
- mode: () => mode,
1855
- presentation(target) {
1856
- return (skins.get(activeId) ?? DEFAULT_SKIN).presentations?.[target];
1857
- },
1858
- tokens: () => (skins.get(activeId) ?? DEFAULT_SKIN).tokens[mode],
1859
- subscribe(listener) {
1860
- listeners.add(listener);
1861
- return () => {
1862
- listeners.delete(listener);
1863
- };
1864
- },
1865
- version: () => revision
2749
+ render: () => jsx(SettingsSurface, {
2750
+ service,
2751
+ ctx
2752
+ })
1866
2753
  });
1867
- refresh();
1868
2754
  }
1869
2755
  };
1870
- /** The React context carrying the skin service. */
1871
- const SkinsContext = createContext(null);
1872
- /** Provide the skin service to a renderer tree. */
1873
- function SkinsProvider(props) {
1874
- return jsx(SkinsContext.Provider, {
1875
- value: props.service,
1876
- children: props.children
1877
- });
1878
- }
1879
2756
  //#endregion
1880
2757
  //#region lib/types/runtime.js
2758
+ /**
2759
+ * The built-in renderer runtime: it takes over the kernel root, mounts the
2760
+ * core services, the skins, the layout/page plugins, and finally the fallback
2761
+ * layout. There is no framework row and no framework seed: the substrate is
2762
+ * always present, so a fresh install has a usable UI before any plugin is
2763
+ * installed.
2764
+ *
2765
+ * @module @snap-rail/ui/runtime
2766
+ */
1881
2767
  /** The React context carrying the host link/surface into builtin pages. */
1882
2768
  const ClientContext = createContext(null);
1883
2769
  /** Provide the client services to builtin page components. */
@@ -1893,6 +2779,14 @@ function useClient() {
1893
2779
  if (service === null) throw new Error("useClient: no ClientProvider in the tree");
1894
2780
  return service;
1895
2781
  }
2782
+ /**
2783
+ * Wire an element as a ball face's single drag/click surface. Past the travel
2784
+ * threshold the face only signals `shell.ball.move` `begin`/`end`; the host
2785
+ * anchors the grab from the OS cursor and runs the dock settle, so the face
2786
+ * never streams coordinates. A press-release inside the threshold is the
2787
+ * click. Returns the disposer removing every listener.
2788
+ */
2789
+ const attachBallDrag = attachBallDrag$1;
1896
2790
  /** Re-render on settings open/page changes. */
1897
2791
  function useSettingsVersion(ctx) {
1898
2792
  return useSyncExternalStore(ctx.settings.subscribe, ctx.settings.version, ctx.settings.version);
@@ -1963,10 +2857,30 @@ function MainRoot(props) {
1963
2857
  jsx(SettingsFallbackHost, { ctx: props.ctx })
1964
2858
  ] });
1965
2859
  }
1966
- /** The fallback ball face used when no plugin occupies `shell.ball`. */
2860
+ /**
2861
+ * The fallback ball face used when no plugin occupies `shell.ball`: a themed
2862
+ * disc that follows the active skin tokens (visible on any colour mode). The
2863
+ * whole ball is one drag/click surface ({@link attachBallDrag}): press-move
2864
+ * drags the window over `shell.ball.move`, a press-release summons the
2865
+ * operator window — the same anatomy the kernel's crash fallback paints.
2866
+ */
1967
2867
  function BallRoot(props) {
1968
2868
  useUiVersion(props.ctx.ui);
1969
2869
  const occupant = props.ctx.ui.list(UI_SLOT_IDS.ball)[0];
2870
+ const link = props.ctx.client.link;
2871
+ const hasOccupant = occupant !== void 0;
2872
+ const rootRef = useRef(null);
2873
+ useEffect(() => {
2874
+ if (hasOccupant) return void 0;
2875
+ const element = rootRef.current;
2876
+ if (element === null) return void 0;
2877
+ return attachBallDrag(element, {
2878
+ link,
2879
+ onClick: () => {
2880
+ link.call("shell.surface.present", { surface: "main" });
2881
+ }
2882
+ });
2883
+ }, [hasOccupant, link]);
1970
2884
  if (occupant !== void 0) return jsx("div", {
1971
2885
  style: {
1972
2886
  width: "100%",
@@ -1975,17 +2889,45 @@ function BallRoot(props) {
1975
2889
  children: occupant.render({ surface: "ball" })
1976
2890
  });
1977
2891
  return jsx("div", {
2892
+ ref: rootRef,
1978
2893
  "data-snap-part": "ball.root",
1979
2894
  style: {
1980
2895
  display: "flex",
1981
2896
  alignItems: "center",
1982
2897
  justifyContent: "center",
1983
2898
  width: "100%",
1984
- height: "100%",
1985
- color: "var(--snap-color-muted)",
1986
- fontSize: "var(--snap-text-xs)"
2899
+ height: "100%"
1987
2900
  },
1988
- children: "snap-rail"
2901
+ children: jsx("div", {
2902
+ "data-snap-part": "ball.orb",
2903
+ style: {
2904
+ display: "flex",
2905
+ alignItems: "center",
2906
+ justifyContent: "center",
2907
+ width: "calc(100% - 16px)",
2908
+ height: "calc(100% - 16px)",
2909
+ borderRadius: "50%",
2910
+ background: "var(--snap-color-surface-raised)",
2911
+ border: "var(--snap-border-width) solid var(--snap-color-border)"
2912
+ },
2913
+ children: jsx("button", {
2914
+ type: "button",
2915
+ "data-snap-part": "ball.core",
2916
+ title: "打开主窗口",
2917
+ style: {
2918
+ width: "calc(100% - 16px)",
2919
+ height: "calc(100% - 16px)",
2920
+ borderRadius: "50%",
2921
+ border: "none",
2922
+ background: "var(--snap-color-surface)",
2923
+ color: "var(--snap-color-text)",
2924
+ fontSize: "var(--snap-text-xs)",
2925
+ fontWeight: "var(--snap-weight-medium)",
2926
+ cursor: "default"
2927
+ },
2928
+ children: "snap-rail"
2929
+ })
2930
+ })
1989
2931
  });
1990
2932
  }
1991
2933
  /** The root that mounts the layout (or the ball face) and the global overlays. */
@@ -2020,12 +2962,9 @@ async function createClientRuntime(handle, options) {
2020
2962
  await ctx.plugin(skinsPlugin);
2021
2963
  await ctx.plugin(settingsPlugin);
2022
2964
  const applyThemeRow = (value) => {
2023
- const mode = value?.mode;
2024
- const choice = mode === "light" || mode === "dark" || mode === "system" ? mode : "dark";
2025
- const prefersLight = typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-color-scheme: light)").matches;
2026
- const resolved = choice === "system" ? prefersLight ? "light" : "dark" : choice;
2027
- ctx.skins.setMode(resolved);
2028
- if (typeof document !== "undefined") document.documentElement.dataset["mode"] = resolved;
2965
+ const row = value;
2966
+ const selection = typeof row?.id === "string" && row.id !== "" ? row.id : row?.mode === "light" ? DEFAULT_LIGHT_ID : DEFAULT_DARK_ID;
2967
+ if (!ctx.skins.activate(selection)) ctx.skins.activate(DEFAULT_DARK_ID);
2029
2968
  };
2030
2969
  handle.link.call("settings.get", { key: "ui.theme" }).then((result) => {
2031
2970
  if (result.ok) applyThemeRow(result.value.value);
@@ -2061,4 +3000,4 @@ async function createClientRuntime(handle, options) {
2061
3000
  };
2062
3001
  }
2063
3002
  //#endregion
2064
- export { ClientProvider, Slot, createClientRuntime, fallbackPlugin, pagesPlugin, settingsPlugin, skinsPlugin, slotsPlugin, useClient };
3003
+ export { ClientProvider, Slot, attachBallDrag, createClientRuntime, fallbackPlugin, pagesPlugin, settingsPlugin, skinsPlugin, slotsPlugin, useClient };