aot-ui 0.2.25 → 0.2.29

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.
@@ -5069,14 +5069,16 @@ function hi({ className: e = "", days: t }) {
5069
5069
  }
5070
5070
  // src/modules/code-copy/clipboard.ts
5071
5071
  async function gi(e) {
5072
- if (typeof navigator < "u" && navigator.clipboard?.writeText) {
5073
- await navigator.clipboard.writeText(e);
5072
+ let t = String(e ?? "");
5073
+ if (typeof navigator < "u" && navigator.clipboard?.writeText) try {
5074
+ await navigator.clipboard.writeText(t);
5074
5075
  return;
5075
- }
5076
- let t = document.createElement("textarea");
5077
- t.value = e, t.setAttribute("readonly", ""), t.style.position = "fixed", t.style.left = "-9999px", t.style.top = "0", document.body.appendChild(t), t.select();
5078
- let n = document.execCommand("copy");
5079
- if (document.body.removeChild(t), !n) throw Error("clipboard write failed");
5076
+ } catch {}
5077
+ if (typeof document > "u") throw Error("clipboard write failed");
5078
+ let n = document.createElement("textarea");
5079
+ n.value = t, n.setAttribute("readonly", ""), n.style.position = "fixed", n.style.left = "-9999px", n.style.top = "0", document.body.appendChild(n), n.select();
5080
+ let r = document.execCommand("copy");
5081
+ if (document.body.removeChild(n), !r) throw Error("clipboard write failed");
5080
5082
  }
5081
5083
  // src/modules/code-copy/constants.ts
5082
5084
  var _i = 320, vi = 2e3, yi = 360;
@@ -19185,7 +19187,7 @@ function pf() {
19185
19187
  cx: "92",
19186
19188
  cy: "28",
19187
19189
  r: "14",
19188
- fill: "var(--color-lr-bg)",
19190
+ fill: "var(--color-lr-art-fill, var(--color-lr-panel, var(--color-lr-bg)))",
19189
19191
  stroke: "currentColor",
19190
19192
  strokeWidth: "1.6"
19191
19193
  }),
@@ -20470,11 +20472,13 @@ function Yf({ items: e, mode: t = "vertical", selectedKeys: n, defaultSelectedKe
20470
20472
  e.disabled ? "is-disabled" : ""
20471
20473
  ].filter(Boolean).join(" "),
20472
20474
  title: o,
20475
+ "data-menu-key": e.key,
20473
20476
  children: /* @__PURE__ */ b("button", {
20474
20477
  type: "button",
20475
20478
  className: "aot-menu__label",
20476
20479
  disabled: e.disabled,
20477
20480
  "aria-current": i ? "page" : void 0,
20481
+ "data-route": typeof e.route == "string" ? e.route : e.key,
20478
20482
  onClick: () => B(e.key, e.disabled),
20479
20483
  children: /* @__PURE__ */ x("span", {
20480
20484
  className: "aot-menu__label-main",
@@ -56998,37 +57002,36 @@ function YX({ children: e, content: t = "AOT", image: n, width: r = 160, height:
56998
57002
  });
56999
57003
  }
57000
57004
  // src/theme/icons.ts
57001
- var XX = "https://api.iconify.design", ZX = {
57002
- appLogo: `${XX}/lucide/hexagon.svg`,
57003
- minimize: `${XX}/codicon/chrome-minimize.svg`,
57004
- maximize: `${XX}/codicon/chrome-maximize.svg`,
57005
- restore: `${XX}/codicon/chrome-restore.svg`,
57006
- close: `${XX}/codicon/chrome-close.svg`
57005
+ function XX(e) {
57006
+ return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`;
57007
+ }
57008
+ var ZX = (e) => XX(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none">${e}</svg>`), QX = {
57009
+ appLogo: XX("<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\">\n <path d=\"M12 3.2 20.2 8v8L12 20.8 3.8 16V8L12 3.2Z\" stroke=\"#64748b\" stroke-width=\"1.6\" stroke-linejoin=\"round\"/>\n <path d=\"M12 8.2v7.6M8.4 10.2l7.2 3.6M15.6 10.2l-7.2 3.6\" stroke=\"#64748b\" stroke-width=\"1.4\" stroke-linecap=\"round\"/>\n </svg>"),
57010
+ minimize: ZX("<path d=\"M3.5 8h9\" stroke=\"#0f172a\" stroke-width=\"1.5\" stroke-linecap=\"round\"/>"),
57011
+ maximize: ZX("<rect x=\"3.25\" y=\"3.25\" width=\"9.5\" height=\"9.5\" rx=\"1.2\" stroke=\"#0f172a\" stroke-width=\"1.5\"/>"),
57012
+ restore: ZX("<path d=\"M5.5 5.5h6.5v6.5H5.5z\" stroke=\"#0f172a\" stroke-width=\"1.4\"/>\n <path d=\"M4 10.5V4h6.5\" stroke=\"#0f172a\" stroke-width=\"1.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>"),
57013
+ close: ZX("<path d=\"M4.2 4.2 11.8 11.8M11.8 4.2 4.2 11.8\" stroke=\"#0f172a\" stroke-width=\"1.5\" stroke-linecap=\"round\"/>")
57007
57014
  };
57008
- function QX(e) {
57009
- return typeof document > "u" ? "" : getComputedStyle(document.documentElement).getPropertyValue(e).trim();
57010
- }
57011
57015
  function $X(e, t = "--aot-color-text") {
57012
- let n = QX(t);
57013
- return n ? `${e}?color=${encodeURIComponent(n)}` : e;
57016
+ return e;
57014
57017
  }
57015
57018
  // src/modules/window-shell/components/TitleBar.tsx
57016
- function eZ() {
57019
+ function eZ(e) {
57017
57020
  return {
57018
- logo: $X(ZX.appLogo),
57019
- minimize: $X(ZX.minimize),
57020
- maximize: $X(ZX.maximize),
57021
- restore: $X(ZX.restore),
57022
- close: $X(ZX.close)
57021
+ logo: e?.trim() || $X(QX.appLogo),
57022
+ minimize: $X(QX.minimize),
57023
+ maximize: $X(QX.maximize),
57024
+ restore: $X(QX.restore),
57025
+ close: $X(QX.close)
57023
57026
  };
57024
57027
  }
57025
- function tZ({ title: e = "AOT", isMaximized: t, onLogoClick: n }) {
57026
- let r = k(), [i, a] = v(eZ);
57028
+ function tZ({ title: e = "AOT", isMaximized: t, logoSrc: n, onLogoClick: r }) {
57029
+ let i = k(), [a, o] = v(() => eZ(n));
57027
57030
  return f(() => {
57028
- let e = () => a(eZ());
57031
+ let e = () => o(eZ(n));
57029
57032
  e();
57030
- let t = document.documentElement, n = new MutationObserver(e);
57031
- n.observe(t, {
57033
+ let t = document.documentElement, r = new MutationObserver(e);
57034
+ r.observe(t, {
57032
57035
  attributes: !0,
57033
57036
  attributeFilter: [
57034
57037
  "data-ll-theme",
@@ -57037,23 +57040,23 @@ function tZ({ title: e = "AOT", isMaximized: t, onLogoClick: n }) {
57037
57040
  "style"
57038
57041
  ]
57039
57042
  });
57040
- let r = window.matchMedia?.("(prefers-color-scheme: dark)");
57041
- return r?.addEventListener?.("change", e), () => {
57042
- n.disconnect(), r?.removeEventListener?.("change", e);
57043
+ let i = window.matchMedia?.("(prefers-color-scheme: dark)");
57044
+ return i?.addEventListener?.("change", e), () => {
57045
+ r.disconnect(), i?.removeEventListener?.("change", e);
57043
57046
  };
57044
- }, []), /* @__PURE__ */ x("header", {
57047
+ }, [n]), /* @__PURE__ */ x("header", {
57045
57048
  className: "titlebar",
57046
57049
  children: [
57047
57050
  /* @__PURE__ */ b("button", {
57048
57051
  type: "button",
57049
57052
  className: "titlebar__logo-btn",
57050
57053
  "aria-label": e,
57051
- tabIndex: n ? 0 : -1,
57052
- onClick: n,
57054
+ tabIndex: r ? 0 : -1,
57055
+ onClick: r,
57053
57056
  onDoubleClick: (e) => e.preventDefault(),
57054
57057
  children: /* @__PURE__ */ b("img", {
57055
57058
  className: "titlebar__logo",
57056
- src: i.logo,
57059
+ src: a.logo,
57057
57060
  alt: "",
57058
57061
  draggable: !1
57059
57062
  })
@@ -57061,7 +57064,7 @@ function tZ({ title: e = "AOT", isMaximized: t, onLogoClick: n }) {
57061
57064
  /* @__PURE__ */ b("div", {
57062
57065
  className: "titlebar__drag",
57063
57066
  "data-tauri-drag-region": !0,
57064
- onDoubleClick: () => void r.toggleMaximize(),
57067
+ onDoubleClick: () => void i.toggleMaximize(),
57065
57068
  children: /* @__PURE__ */ b("span", {
57066
57069
  className: "titlebar__name",
57067
57070
  children: e
@@ -57074,9 +57077,9 @@ function tZ({ title: e = "AOT", isMaximized: t, onLogoClick: n }) {
57074
57077
  type: "button",
57075
57078
  className: "titlebar__btn",
57076
57079
  "aria-label": "最小化",
57077
- onClick: () => void r.minimize(),
57080
+ onClick: () => void i.minimize(),
57078
57081
  children: /* @__PURE__ */ b("img", {
57079
- src: i.minimize,
57082
+ src: a.minimize,
57080
57083
  alt: "",
57081
57084
  draggable: !1
57082
57085
  })
@@ -57085,9 +57088,9 @@ function tZ({ title: e = "AOT", isMaximized: t, onLogoClick: n }) {
57085
57088
  type: "button",
57086
57089
  className: "titlebar__btn",
57087
57090
  "aria-label": t ? "还原" : "最大化",
57088
- onClick: () => void r.toggleMaximize(),
57091
+ onClick: () => void i.toggleMaximize(),
57089
57092
  children: /* @__PURE__ */ b("img", {
57090
- src: t ? i.restore : i.maximize,
57093
+ src: t ? a.restore : a.maximize,
57091
57094
  alt: "",
57092
57095
  draggable: !1
57093
57096
  })
@@ -57096,9 +57099,9 @@ function tZ({ title: e = "AOT", isMaximized: t, onLogoClick: n }) {
57096
57099
  type: "button",
57097
57100
  className: "titlebar__btn titlebar__btn--close",
57098
57101
  "aria-label": "关闭",
57099
- onClick: () => void r.close(),
57102
+ onClick: () => void i.close(),
57100
57103
  children: /* @__PURE__ */ b("img", {
57101
- src: i.close,
57104
+ src: a.close,
57102
57105
  alt: "",
57103
57106
  draggable: !1
57104
57107
  })
@@ -57173,10 +57176,10 @@ function iZ() {
57173
57176
  }, []), e;
57174
57177
  }
57175
57178
  // src/modules/window-shell/AppShell.tsx
57176
- function aZ({ title: e = "AOT", onLogoClick: t, children: n }) {
57177
- let r = iZ();
57179
+ function aZ({ title: e = "AOT", logoSrc: t, onLogoClick: n, children: r }) {
57180
+ let i = iZ();
57178
57181
  return /* @__PURE__ */ x("div", {
57179
- className: `app-shell${r ? " is-maximized" : ""}`,
57182
+ className: `app-shell${i ? " is-maximized" : ""}`,
57180
57183
  children: [
57181
57184
  /* @__PURE__ */ b("div", {
57182
57185
  className: "app-shell__fill",
@@ -57186,11 +57189,12 @@ function aZ({ title: e = "AOT", onLogoClick: t, children: n }) {
57186
57189
  className: "app-shell__body",
57187
57190
  children: [/* @__PURE__ */ b(tZ, {
57188
57191
  title: e,
57189
- isMaximized: r,
57190
- onLogoClick: t
57192
+ logoSrc: t,
57193
+ isMaximized: i,
57194
+ onLogoClick: n
57191
57195
  }), /* @__PURE__ */ b("main", {
57192
57196
  className: "app-content",
57193
- children: n
57197
+ children: r
57194
57198
  })]
57195
57199
  }),
57196
57200
  /* @__PURE__ */ b(rZ, {})
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  export type CopyCodeButtonProps = {
3
- /** Text / code to write into the clipboard. */
3
+ /** Text / code to write into the clipboard. Clipboard API 失败时会回退 execCommand。 */
4
4
  text: string;
5
5
  idleLabel?: string;
6
6
  doneLabel?: string;
@@ -6,6 +6,18 @@ export type LoadRetryItem = {
6
6
  tag: string;
7
7
  };
8
8
  export type LoadPhase = "error" | "loading" | "ready";
9
+ /**
10
+ * LoadRetry — 列表 / 目录加载失败重试。
11
+ *
12
+ * **受控模式**(传 `status`):外层 `aot-lr--app`,失败态为圆角面板(`overflow: hidden`
13
+ * 以裁切磨砂),颜色走 `--aot-color-lr-*`(默认映射主题 surface/text/border)。
14
+ * 宿主磨砂时可设:
15
+ * - `--aot-lr-backdrop: blur(28px) saturate(1.35)`
16
+ * - `--aot-color-lr-panel` / `--aot-color-lr-bg` → 半透明玻璃底
17
+ * 宿主勿对 `.aot-lr__error` 强制 `overflow: visible`,否则圆角磨砂会失效。
18
+ *
19
+ * **演示模式**(不传 `status`):带导航/标签的完整 demo 壳。
20
+ */
9
21
  export type LoadRetryProps = {
10
22
  className?: string;
11
23
  items?: LoadRetryItem[];
@@ -1,9 +1,14 @@
1
1
  import { MouseEventHandler, ReactNode } from 'react';
2
2
  type AppShellProps = {
3
3
  title?: string;
4
+ /**
5
+ * Brand logo for the titlebar (local asset URL / data URL).
6
+ * Prefer this over the default mark so packaged apps work offline.
7
+ */
8
+ logoSrc?: string;
4
9
  /** Fired when the titlebar logo is clicked (e.g. secret gestures). */
5
10
  onLogoClick?: MouseEventHandler<HTMLButtonElement>;
6
11
  children: ReactNode;
7
12
  };
8
- export declare function AppShell({ title, onLogoClick, children, }: AppShellProps): import('react').JSX.Element;
13
+ export declare function AppShell({ title, logoSrc, onLogoClick, children, }: AppShellProps): import('react').JSX.Element;
9
14
  export {};
@@ -2,7 +2,9 @@ import { MouseEventHandler } from 'react';
2
2
  type TitleBarProps = {
3
3
  title?: string;
4
4
  isMaximized: boolean;
5
+ /** Host brand logo URL (local asset / data URL). Falls back to built-in mark. */
6
+ logoSrc?: string;
5
7
  onLogoClick?: MouseEventHandler<HTMLButtonElement>;
6
8
  };
7
- export declare function TitleBar({ title, isMaximized, onLogoClick, }: TitleBarProps): import('react').JSX.Element;
9
+ export declare function TitleBar({ title, isMaximized, logoSrc, onLogoClick, }: TitleBarProps): import('react').JSX.Element;
8
10
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aot-ui",
3
- "version": "0.2.25",
3
+ "version": "0.2.29",
4
4
  "description": "AOT React UI component kit",
5
5
  "type": "module",
6
6
  "main": "./dist-lib/aot-ui.js",