aot-ui 0.2.25 → 0.2.27

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;
@@ -56998,37 +57000,36 @@ function YX({ children: e, content: t = "AOT", image: n, width: r = 160, height:
56998
57000
  });
56999
57001
  }
57000
57002
  // 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`
57003
+ function XX(e) {
57004
+ return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`;
57005
+ }
57006
+ var ZX = (e) => XX(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none">${e}</svg>`), QX = {
57007
+ 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>"),
57008
+ minimize: ZX("<path d=\"M3.5 8h9\" stroke=\"#0f172a\" stroke-width=\"1.5\" stroke-linecap=\"round\"/>"),
57009
+ maximize: ZX("<rect x=\"3.25\" y=\"3.25\" width=\"9.5\" height=\"9.5\" rx=\"1.2\" stroke=\"#0f172a\" stroke-width=\"1.5\"/>"),
57010
+ 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\"/>"),
57011
+ 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
57012
  };
57008
- function QX(e) {
57009
- return typeof document > "u" ? "" : getComputedStyle(document.documentElement).getPropertyValue(e).trim();
57010
- }
57011
57013
  function $X(e, t = "--aot-color-text") {
57012
- let n = QX(t);
57013
- return n ? `${e}?color=${encodeURIComponent(n)}` : e;
57014
+ return e;
57014
57015
  }
57015
57016
  // src/modules/window-shell/components/TitleBar.tsx
57016
- function eZ() {
57017
+ function eZ(e) {
57017
57018
  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)
57019
+ logo: e?.trim() || $X(QX.appLogo),
57020
+ minimize: $X(QX.minimize),
57021
+ maximize: $X(QX.maximize),
57022
+ restore: $X(QX.restore),
57023
+ close: $X(QX.close)
57023
57024
  };
57024
57025
  }
57025
- function tZ({ title: e = "AOT", isMaximized: t, onLogoClick: n }) {
57026
- let r = k(), [i, a] = v(eZ);
57026
+ function tZ({ title: e = "AOT", isMaximized: t, logoSrc: n, onLogoClick: r }) {
57027
+ let i = k(), [a, o] = v(() => eZ(n));
57027
57028
  return f(() => {
57028
- let e = () => a(eZ());
57029
+ let e = () => o(eZ(n));
57029
57030
  e();
57030
- let t = document.documentElement, n = new MutationObserver(e);
57031
- n.observe(t, {
57031
+ let t = document.documentElement, r = new MutationObserver(e);
57032
+ r.observe(t, {
57032
57033
  attributes: !0,
57033
57034
  attributeFilter: [
57034
57035
  "data-ll-theme",
@@ -57037,23 +57038,23 @@ function tZ({ title: e = "AOT", isMaximized: t, onLogoClick: n }) {
57037
57038
  "style"
57038
57039
  ]
57039
57040
  });
57040
- let r = window.matchMedia?.("(prefers-color-scheme: dark)");
57041
- return r?.addEventListener?.("change", e), () => {
57042
- n.disconnect(), r?.removeEventListener?.("change", e);
57041
+ let i = window.matchMedia?.("(prefers-color-scheme: dark)");
57042
+ return i?.addEventListener?.("change", e), () => {
57043
+ r.disconnect(), i?.removeEventListener?.("change", e);
57043
57044
  };
57044
- }, []), /* @__PURE__ */ x("header", {
57045
+ }, [n]), /* @__PURE__ */ x("header", {
57045
57046
  className: "titlebar",
57046
57047
  children: [
57047
57048
  /* @__PURE__ */ b("button", {
57048
57049
  type: "button",
57049
57050
  className: "titlebar__logo-btn",
57050
57051
  "aria-label": e,
57051
- tabIndex: n ? 0 : -1,
57052
- onClick: n,
57052
+ tabIndex: r ? 0 : -1,
57053
+ onClick: r,
57053
57054
  onDoubleClick: (e) => e.preventDefault(),
57054
57055
  children: /* @__PURE__ */ b("img", {
57055
57056
  className: "titlebar__logo",
57056
- src: i.logo,
57057
+ src: a.logo,
57057
57058
  alt: "",
57058
57059
  draggable: !1
57059
57060
  })
@@ -57061,7 +57062,7 @@ function tZ({ title: e = "AOT", isMaximized: t, onLogoClick: n }) {
57061
57062
  /* @__PURE__ */ b("div", {
57062
57063
  className: "titlebar__drag",
57063
57064
  "data-tauri-drag-region": !0,
57064
- onDoubleClick: () => void r.toggleMaximize(),
57065
+ onDoubleClick: () => void i.toggleMaximize(),
57065
57066
  children: /* @__PURE__ */ b("span", {
57066
57067
  className: "titlebar__name",
57067
57068
  children: e
@@ -57074,9 +57075,9 @@ function tZ({ title: e = "AOT", isMaximized: t, onLogoClick: n }) {
57074
57075
  type: "button",
57075
57076
  className: "titlebar__btn",
57076
57077
  "aria-label": "最小化",
57077
- onClick: () => void r.minimize(),
57078
+ onClick: () => void i.minimize(),
57078
57079
  children: /* @__PURE__ */ b("img", {
57079
- src: i.minimize,
57080
+ src: a.minimize,
57080
57081
  alt: "",
57081
57082
  draggable: !1
57082
57083
  })
@@ -57085,9 +57086,9 @@ function tZ({ title: e = "AOT", isMaximized: t, onLogoClick: n }) {
57085
57086
  type: "button",
57086
57087
  className: "titlebar__btn",
57087
57088
  "aria-label": t ? "还原" : "最大化",
57088
- onClick: () => void r.toggleMaximize(),
57089
+ onClick: () => void i.toggleMaximize(),
57089
57090
  children: /* @__PURE__ */ b("img", {
57090
- src: t ? i.restore : i.maximize,
57091
+ src: t ? a.restore : a.maximize,
57091
57092
  alt: "",
57092
57093
  draggable: !1
57093
57094
  })
@@ -57096,9 +57097,9 @@ function tZ({ title: e = "AOT", isMaximized: t, onLogoClick: n }) {
57096
57097
  type: "button",
57097
57098
  className: "titlebar__btn titlebar__btn--close",
57098
57099
  "aria-label": "关闭",
57099
- onClick: () => void r.close(),
57100
+ onClick: () => void i.close(),
57100
57101
  children: /* @__PURE__ */ b("img", {
57101
- src: i.close,
57102
+ src: a.close,
57102
57103
  alt: "",
57103
57104
  draggable: !1
57104
57105
  })
@@ -57173,10 +57174,10 @@ function iZ() {
57173
57174
  }, []), e;
57174
57175
  }
57175
57176
  // src/modules/window-shell/AppShell.tsx
57176
- function aZ({ title: e = "AOT", onLogoClick: t, children: n }) {
57177
- let r = iZ();
57177
+ function aZ({ title: e = "AOT", logoSrc: t, onLogoClick: n, children: r }) {
57178
+ let i = iZ();
57178
57179
  return /* @__PURE__ */ x("div", {
57179
- className: `app-shell${r ? " is-maximized" : ""}`,
57180
+ className: `app-shell${i ? " is-maximized" : ""}`,
57180
57181
  children: [
57181
57182
  /* @__PURE__ */ b("div", {
57182
57183
  className: "app-shell__fill",
@@ -57186,11 +57187,12 @@ function aZ({ title: e = "AOT", onLogoClick: t, children: n }) {
57186
57187
  className: "app-shell__body",
57187
57188
  children: [/* @__PURE__ */ b(tZ, {
57188
57189
  title: e,
57189
- isMaximized: r,
57190
- onLogoClick: t
57190
+ logoSrc: t,
57191
+ isMaximized: i,
57192
+ onLogoClick: n
57191
57193
  }), /* @__PURE__ */ b("main", {
57192
57194
  className: "app-content",
57193
- children: n
57195
+ children: r
57194
57196
  })]
57195
57197
  }),
57196
57198
  /* @__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;
@@ -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.27",
4
4
  "description": "AOT React UI component kit",
5
5
  "type": "module",
6
6
  "main": "./dist-lib/aot-ui.js",