@aiti-ai/aiti-float 0.5.11 → 0.5.12
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/README.md +14 -22
- package/README.zh-CN.md +31 -0
- package/client/src/dock.ts +35 -1
- package/client/src/dockstack.ts +18 -3
- package/client/src/float.ts +13 -2
- package/dev-pack.mjs +16 -3
- package/dist/aiti-float-client.mjs +164 -10
- package/index.ts +13 -2
- package/package.json +3 -3
- package/skills/float-dialog-adapter/SKILL.md +3 -1
- package/tools/build-client.mjs +2 -1
package/README.md
CHANGED
|
@@ -1,38 +1,30 @@
|
|
|
1
1
|
# @aiti-ai/aiti-float
|
|
2
2
|
|
|
3
|
-
> data-ext-float
|
|
3
|
+
> data-ext-float contract take-over — drag/edge resize/position persistence/click-to-front/double-click reset/auto maximize button, small-screen auto fullscreen + system back closes the float; the DockStack unified sidebar block-stack service
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
English · [简体中文](./README.zh-CN.md)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## About aiti
|
|
8
8
|
|
|
9
9
|
This package is part of the **aiti** ecosystem — a personal AI development workbench powered by [pi](https://pi.dev): **aiti-agent** (a self-hosted web workbench built on the open-source [pi-web](https://github.com/aiti-ai/pi-web)) plus debug injection into mainstream dev tools (aiti-devtools) and a rich extension system.
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
11
|
+
- Workbench (aiti-agent, built on pi-web): <https://github.com/aiti-ai/pi-web>
|
|
12
|
+
- Ecosystem monorepo: <https://github.com/aiti-ai/aiti-ai>
|
|
13
|
+
- Site: <https://aiti.pw>
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Category: Chat enhancements · Tags: `float` · `dialog` · `drag` · `resize` · `mobile` · `contract`
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
## Install
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Bundled with **aiti-agent** (`@aiti-ai/pi-web`) — enable it from the in-app extension manager (ExtMan / App Center).
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Manual install: place this package at `~/.pi/web/extensions/aiti-float/` and reload pi-web.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
## Documentation
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
# 部署到 ~/.pi/web/extensions/aiti-float/ 后 reload
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## 文档 · Documentation
|
|
32
|
-
|
|
33
|
-
- 中文完整文档(aiti-docs): <https://aiti.pw/extensions/aiti-float.html>
|
|
34
|
-
- English docs: <https://aiti.pw/en/extensions/aiti-float.html>
|
|
35
|
-
- 扩展注册表 / registry: <https://aiti.pw/extensions.html> · machine-readable <https://aiti.pw/extensions.json>
|
|
25
|
+
- Documentation (English): <https://aiti.pw/en/extensions/aiti-float.html>
|
|
26
|
+
- 文档(中文): <https://aiti.pw/extensions/aiti-float.html>
|
|
27
|
+
- Extension registry: <https://aiti.pw/extensions.html> · machine-readable <https://aiti.pw/extensions.json>
|
|
36
28
|
|
|
37
29
|
## License
|
|
38
30
|
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @aiti-ai/aiti-float
|
|
2
|
+
|
|
3
|
+
> data-ext-float 契约接管 —— 拖拽/边缘缩放/位置持久化/点按置前/双击复位/自动最大化按钮,小屏自动全屏 + 系统返回关闭浮窗;DockStack 左栏统一区块栈服务
|
|
4
|
+
|
|
5
|
+
[English](./README.md) · 简体中文
|
|
6
|
+
|
|
7
|
+
## 关于 aiti
|
|
8
|
+
|
|
9
|
+
本包是 **aiti** 生态的组成部分——以 [pi](https://pi.dev) 为引擎的个人 AI 开发工作台与本地调试注入生态:**aiti-agent**(自托管 Web 工作台,基于开源项目 [pi-web](https://github.com/aiti-ai/pi-web) 构建,浏览器为主操作面)+ 各开发工具内的调试注入(aiti-devtools)+ 丰富的扩展体系。
|
|
10
|
+
|
|
11
|
+
- 工作台(aiti-agent,基于 pi-web): <https://github.com/aiti-ai/pi-web>
|
|
12
|
+
- 生态仓库: <https://github.com/aiti-ai/aiti-ai>
|
|
13
|
+
- 官网: <https://aiti.pw>
|
|
14
|
+
|
|
15
|
+
分类: 聊天增强 · tags: `float` · `dialog` · `drag` · `resize` · `mobile` · `contract`
|
|
16
|
+
|
|
17
|
+
## 安装
|
|
18
|
+
|
|
19
|
+
随 **aiti-agent**(`@aiti-ai/pi-web`)捆绑发行——在工作台内的扩展管理器(ExtMan / 应用中心)启用即可。
|
|
20
|
+
|
|
21
|
+
手动安装:把本包放到 `~/.pi/web/extensions/aiti-float/` 后 reload。
|
|
22
|
+
|
|
23
|
+
## 文档
|
|
24
|
+
|
|
25
|
+
- 中文文档: <https://aiti.pw/extensions/aiti-float.html>
|
|
26
|
+
- Documentation (English): <https://aiti.pw/en/extensions/aiti-float.html>
|
|
27
|
+
- 扩展注册表: <https://aiti.pw/extensions.html> · machine-readable <https://aiti.pw/extensions.json>
|
|
28
|
+
|
|
29
|
+
## 许可证
|
|
30
|
+
|
|
31
|
+
MIT
|
package/client/src/dock.ts
CHANGED
|
@@ -30,6 +30,26 @@ const COMMAND_EVENT = "piwe-float-present-command";
|
|
|
30
30
|
export const DOCK_MENU_EVENT = "piwe-float-dock-menu";
|
|
31
31
|
|
|
32
32
|
const DOCKPREF_PREFIX = "pi-web:ext-float:dockpref:v1:";
|
|
33
|
+
/** Dismissed-record key prefix — same-name contract with _shared/ext-float-dock-core.ts
|
|
34
|
+
* (this module keeps a zero-import discipline, so the read/write helpers are inlined;
|
|
35
|
+
* readers are the readBlockDismissed calls at per-extension auto-dock sites).
|
|
36
|
+
* Semantics mirror the core section of the same name: close writes 1, a non-auto
|
|
37
|
+
* landing in the sidebar family clears it. */
|
|
38
|
+
const DISMISS_PREFIX = "pi:sidebar-dock:dismissed:";
|
|
39
|
+
function readDismissed(key: string): boolean {
|
|
40
|
+
try { return localStorage.getItem(DISMISS_PREFIX + key) === "1"; } catch { return false; }
|
|
41
|
+
}
|
|
42
|
+
function writeDismissed(key: string, dismissed: boolean): void {
|
|
43
|
+
try {
|
|
44
|
+
if (dismissed) localStorage.setItem(DISMISS_PREFIX + key, "1");
|
|
45
|
+
else localStorage.removeItem(DISMISS_PREFIX + key);
|
|
46
|
+
} catch { /* ignore */ }
|
|
47
|
+
}
|
|
48
|
+
/** sidebar-family docked-state predicate (same semantics as core isSidebarDockState:
|
|
49
|
+
* canonical sidebar:<key> + legacy sidebar-explorer). */
|
|
50
|
+
function isSidebarDockedState(state: PresentState): boolean {
|
|
51
|
+
return state === "docked:sidebar-explorer" || state.startsWith("docked:sidebar:");
|
|
52
|
+
}
|
|
33
53
|
|
|
34
54
|
const states = new Map<string, PresentState>();
|
|
35
55
|
/** 扩展声明默认落位(float.ts 增强面板时读 data-ext-float-dock-default 注册;内存态不持久化) */
|
|
@@ -70,12 +90,26 @@ export function present(key: string, mode: PresentMode, opts?: { auto?: boolean
|
|
|
70
90
|
}
|
|
71
91
|
}
|
|
72
92
|
else if (mode === "float") { setPref(key, "float"); setState(key, "floating", opts); return; } // v3:选浮窗=记忆偏好(Q1)
|
|
73
|
-
else if (mode === "close") {
|
|
93
|
+
else if (mode === "close") {
|
|
94
|
+
// Dismissed record (2026-11-21 ruling: "a closed block stays closed across
|
|
95
|
+
// refresh"): every close writes it — programmatic closes included, which is
|
|
96
|
+
// harmless since an explicit reopen clears it (below). Restorative auto-dock
|
|
97
|
+
// call sites check the record and skip. dockPref is kept (reopen = last zone).
|
|
98
|
+
writeDismissed(key, true);
|
|
99
|
+
setState(key, "closed", opts);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
74
102
|
else if (mode.startsWith("dock:")) {
|
|
75
103
|
const zone = mode.slice(5);
|
|
76
104
|
try { localStorage.setItem(DOCKPREF_PREFIX + key, zone); } catch { /* ignore */ }
|
|
77
105
|
setState(key, `docked:${zone}`, opts); // auto 必须透传:恢复性同步入栈不拉小屏抽屉
|
|
78
106
|
}
|
|
107
|
+
// Explicit (non-auto) landing in the sidebar family = user actively bringing the
|
|
108
|
+
// block back → clear the dismissed record (degraded localPresent mirrors this).
|
|
109
|
+
// Placed before the same-state activate broadcast: reopening an already-docked
|
|
110
|
+
// block (activation) counts as bringing it back too.
|
|
111
|
+
const afterForDismiss = states.get(key) ?? "closed";
|
|
112
|
+
if (!opts?.auto && isSidebarDockedState(afterForDismiss)) writeDismissed(key, false);
|
|
79
113
|
// 同态 docked 再打开(重复 open / dock:同区 / TabBar 菜单选当前区):无状态迁移可广播,
|
|
80
114
|
// 但用户语义 = 「带到面前」——发激活事件,宿主右栏据此置前对应 tab(floating 幂等不发)。
|
|
81
115
|
// auto 透传:恢复性入栈(autoDock/项目联动同步)的激活不得把宿主小屏抽屉拉起。
|
package/client/src/dockstack.ts
CHANGED
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
moveBlockKey,
|
|
31
31
|
moveBlockTo,
|
|
32
32
|
readBlockCollapsed,
|
|
33
|
+
readBlockDismissed,
|
|
33
34
|
readDockOrder,
|
|
34
35
|
sidebarZoneOf,
|
|
35
36
|
splitBlockAlign,
|
|
@@ -111,7 +112,12 @@ export function createDockStackApi(ctx: Record<string, any>) {
|
|
|
111
112
|
function StaticDockFace(props: { item: Record<string, any>; shell?: any }) {
|
|
112
113
|
const item = props.item;
|
|
113
114
|
const blockKey = String(item.id);
|
|
114
|
-
|
|
115
|
+
// "i18n:<key>" static titles resolve against the declaring extension's manifest
|
|
116
|
+
// table (host ctx.translateItemText); plain titles pass through unchanged.
|
|
117
|
+
const rawTitle = String(item.meta?.title ?? item.meta?.label ?? item.extId ?? item.id);
|
|
118
|
+
const title = typeof (ctx as any).translateItemText === "function"
|
|
119
|
+
? (ctx as any).translateItemText(item.extId, rawTitle) || rawTitle
|
|
120
|
+
: rawTitle;
|
|
115
121
|
const collapsed = useBlockCollapsedCtx(blockKey)[0];
|
|
116
122
|
const [phase, setPhase] = useState<string>("idle");
|
|
117
123
|
const load = () => {
|
|
@@ -129,6 +135,12 @@ export function createDockStackApi(ctx: Record<string, any>) {
|
|
|
129
135
|
itemKey: blockKey,
|
|
130
136
|
blockKey,
|
|
131
137
|
title,
|
|
138
|
+
// Block header icon (five-form contract, dockIconFromDecl on the shell side):
|
|
139
|
+
// meta.iconUrl = host-resolved absolute URL for the ".svg"-relative asset form;
|
|
140
|
+
// meta.icon / item.icon pass through verbatim ({svg} / name / emoji). Third-party
|
|
141
|
+
// extensions carry their own icons ({svg} / {url} / emoji) without the built-in
|
|
142
|
+
// name table; the shell shows the same icon as the real face after materialization.
|
|
143
|
+
icon: item.meta?.iconUrl ? { url: item.meta.iconUrl } : (item.meta?.icon ?? item.icon),
|
|
132
144
|
chrome: "section",
|
|
133
145
|
kind: "dockable",
|
|
134
146
|
zones,
|
|
@@ -142,7 +154,7 @@ export function createDockStackApi(ctx: Record<string, any>) {
|
|
|
142
154
|
h("div",
|
|
143
155
|
{
|
|
144
156
|
onClick: () => writeBlockCollapsed(blockKey, !collapsed),
|
|
145
|
-
style: { display: "flex", alignItems: "center", gap: 6, padding: "8px 10px", cursor: "pointer", userSelect: "none", fontSize: 12, color: "var(--text-muted)"
|
|
157
|
+
style: { display: "flex", alignItems: "center", gap: 6, padding: "8px 10px", cursor: "pointer", userSelect: "none", fontSize: 12, color: "var(--text-muted)" },
|
|
146
158
|
},
|
|
147
159
|
h("span", { style: { transform: collapsed ? "rotate(-90deg)" : "none", transition: "transform 0.12s", fontSize: 10 } }, "▼"),
|
|
148
160
|
h("span", { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, title),
|
|
@@ -191,6 +203,7 @@ export function createDockStackApi(ctx: Record<string, any>) {
|
|
|
191
203
|
const key = String(it.id);
|
|
192
204
|
if (seen.has(key)) continue;
|
|
193
205
|
seen.add(key);
|
|
206
|
+
if (readBlockDismissed(key)) continue; // dismissed: user ⋮-close on record → no refresh resurrection (2026-11-21)
|
|
194
207
|
const pref = dockPref(key);
|
|
195
208
|
if (pref && isSidebarDockState(`docked:${pref}`) && presented(key) === "closed") {
|
|
196
209
|
present(key, "open", { auto: true });
|
|
@@ -273,7 +286,9 @@ export function createDockStackApi(ctx: Record<string, any>) {
|
|
|
273
286
|
...blocks.map((b) => ({ ...b, align: (b.align ?? "top") as BlockAlign })),
|
|
274
287
|
...dockedItems.map((it: any): DockItemDef => ({
|
|
275
288
|
key: String(it.id),
|
|
276
|
-
title: (
|
|
289
|
+
title: ((typeof (ctx as any).translateItemText === "function" && /^i18n:/.test(String(it.meta?.title ?? "")))
|
|
290
|
+
? (ctx as any).translateItemText(it.extId, String(it.meta?.title))
|
|
291
|
+
: (it.meta?.title as string)) ?? String(it.id),
|
|
277
292
|
priority: typeof it.meta?.priority === "number" ? it.meta.priority : DOCK_DEFAULT_PRIORITY,
|
|
278
293
|
// 对齐分组(v4):dockable 默认下对齐(重要性次级);meta.align="top" 显式声明核心区块
|
|
279
294
|
align: (it.meta?.align === "top" ? "top" : "bottom") as BlockAlign,
|
package/client/src/float.ts
CHANGED
|
@@ -924,8 +924,10 @@ export function install(): () => void {
|
|
|
924
924
|
|
|
925
925
|
// ── 全局 API(扩展自备最大化按钮时调用;float 管盒子,扩展只管按钮 UI)──
|
|
926
926
|
// window.__piweFloat.toggleMax(panelEl) → 返回切换后是否最大化
|
|
927
|
-
// window.__piweFloat.setMax(panelEl, v) / .isMax(panelEl)
|
|
928
|
-
|
|
927
|
+
// window.__piweFloat.setMax(panelEl, v) / .isMax(panelEl) / .isFull(panelEl)
|
|
928
|
+
// window.__piweFloat.raise(panelEl) → explicit raise (for an already-open panel that
|
|
929
|
+
// another layer covers; e.g. All Sessions opens a viewer that was already floating)
|
|
930
|
+
type MaxApi = { version: string; toggleMax(p: HTMLElement): boolean; setMax(p: HTMLElement, v: boolean): boolean; isMax(p: HTMLElement): boolean; isFull(p: HTMLElement): boolean; raise(p: HTMLElement): boolean };
|
|
929
931
|
const api: MaxApi = ((window as any).__piweFloat ||= {} as MaxApi);
|
|
930
932
|
api.version = VERSION;
|
|
931
933
|
// dock 展示状态机出口(_shared/ext-float-dock.ts 委托到这里;方案 §5.2)。
|
|
@@ -950,6 +952,15 @@ export function install(): () => void {
|
|
|
950
952
|
api.setMax = (p, v) => { const c = maxControls.get(p); if (c && c.isMax() !== v) c.toggle(); };
|
|
951
953
|
api.isMax = (p) => maxControls.get(p)?.isMax() ?? false;
|
|
952
954
|
api.isFull = (p) => maxControls.get(p)?.isFull?.() ?? false;
|
|
955
|
+
// Explicit raise: enhanced panels only. An un-enhanced panel means float is absent or the
|
|
956
|
+
// panel has not been scanned yet — a freshly mounted panel is raised by scan's "appear-to-front".
|
|
957
|
+
api.raise = (p) => {
|
|
958
|
+
try {
|
|
959
|
+
if (!p || !p.isConnected || !enhancedPanels.has(p)) return false;
|
|
960
|
+
bringToFront(p);
|
|
961
|
+
return true;
|
|
962
|
+
} catch { return false; }
|
|
963
|
+
};
|
|
953
964
|
|
|
954
965
|
// v3:安装完成广播(_shared 的 dock 头 store 探测据此从本地回落切到宿主服务)
|
|
955
966
|
try { window.dispatchEvent(new Event(FLOAT_INSTALLED_EVENT)); } catch { /* ignore */ }
|
package/dev-pack.mjs
CHANGED
|
@@ -77,7 +77,7 @@ export function agentsMdTemplate(extId) {
|
|
|
77
77
|
|
|
78
78
|
/** 默认 tools/build.mjs(esbuild 单包零配置;扩展自带 tools/build.mjs 则不走到这里)。 */
|
|
79
79
|
function buildMjsTemplate(extId, extRoot, clientOut, entryRel) {
|
|
80
|
-
|
|
80
|
+
// No hardcoded checkout path: candidates are resolved at run time (see repoCandidates below).
|
|
81
81
|
return `/**
|
|
82
82
|
* ${extId} · 现场构建入口(dev-pack 默认模板,esbuild 单包零配置)
|
|
83
83
|
* 用法:node tools/build.mjs
|
|
@@ -96,12 +96,25 @@ const entryRel = ${JSON.stringify(entryRel || "")};
|
|
|
96
96
|
|
|
97
97
|
// esbuild 解析:部署目录 node_modules → 源码仓 node_modules(本机开发场景)→ PATH 上的 esbuild → npm exec 现拉。
|
|
98
98
|
// 注意:node_modules/esbuild/bin/esbuild 是原生二进制(ELF/Mach-O),必须直接执行(不能当 JS 跑)。
|
|
99
|
+
// Checkout roots are discovered by walking up from the extension dir (a root has node_modules/),
|
|
100
|
+
// plus AITI_REPO_ROOT when set — no machine-specific absolute paths baked into generated files.
|
|
101
|
+
function repoCandidates() {
|
|
102
|
+
const out = [];
|
|
103
|
+
if (process.env.AITI_REPO_ROOT) out.push(process.env.AITI_REPO_ROOT.split(pathSep).join("/") + "/node_modules/esbuild/bin/esbuild");
|
|
104
|
+
let d = extRoot;
|
|
105
|
+
for (let i = 0; i < 8; i++) {
|
|
106
|
+
out.push(d.split(pathSep).join("/") + "/node_modules/esbuild/bin/esbuild");
|
|
107
|
+
const up = dirname(d);
|
|
108
|
+
if (up === d) break;
|
|
109
|
+
d = up;
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
99
113
|
function findEsbuild() {
|
|
100
114
|
const home = (process.env.HOME || process.env.USERPROFILE || "").split(pathSep).join("/");
|
|
101
115
|
const candidates = [
|
|
102
116
|
extRoot + "/node_modules/esbuild/bin/esbuild",
|
|
103
|
-
|
|
104
|
-
"D:/workspace/pi-work/node_modules/esbuild/bin/esbuild", // 155 win(源码在 D 盘)
|
|
117
|
+
...repoCandidates(),
|
|
105
118
|
];
|
|
106
119
|
for (const c of candidates) {
|
|
107
120
|
if (!existsSync(c)) continue;
|
|
@@ -93,6 +93,17 @@ const ACTIVATE_EVENT$1 = "piwe-float-present-activate";
|
|
|
93
93
|
const COMMAND_EVENT = "piwe-float-present-command";
|
|
94
94
|
const DOCK_MENU_EVENT = "piwe-float-dock-menu";
|
|
95
95
|
const DOCKPREF_PREFIX = "pi-web:ext-float:dockpref:v1:";
|
|
96
|
+
const DISMISS_PREFIX = "pi:sidebar-dock:dismissed:";
|
|
97
|
+
function writeDismissed(key, dismissed) {
|
|
98
|
+
try {
|
|
99
|
+
if (dismissed) localStorage.setItem(DISMISS_PREFIX + key, "1");
|
|
100
|
+
else localStorage.removeItem(DISMISS_PREFIX + key);
|
|
101
|
+
} catch {
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function isSidebarDockedState(state) {
|
|
105
|
+
return state === "docked:sidebar-explorer" || state.startsWith("docked:sidebar:");
|
|
106
|
+
}
|
|
96
107
|
const states = /* @__PURE__ */ new Map();
|
|
97
108
|
const defaultZones = /* @__PURE__ */ new Map();
|
|
98
109
|
const zonesReg = /* @__PURE__ */ new Map();
|
|
@@ -137,6 +148,7 @@ function present$1(key, mode, opts) {
|
|
|
137
148
|
setState(key, "floating", opts);
|
|
138
149
|
return;
|
|
139
150
|
} else if (mode === "close") {
|
|
151
|
+
writeDismissed(key, true);
|
|
140
152
|
setState(key, "closed", opts);
|
|
141
153
|
return;
|
|
142
154
|
} else if (mode.startsWith("dock:")) {
|
|
@@ -147,6 +159,8 @@ function present$1(key, mode, opts) {
|
|
|
147
159
|
}
|
|
148
160
|
setState(key, `docked:${zone}`, opts);
|
|
149
161
|
}
|
|
162
|
+
const afterForDismiss = states.get(key) ?? "closed";
|
|
163
|
+
if (!opts?.auto && isSidebarDockedState(afterForDismiss)) writeDismissed(key, false);
|
|
150
164
|
const after = states.get(key) ?? "closed";
|
|
151
165
|
if (after === cur && after.startsWith("docked:")) {
|
|
152
166
|
try {
|
|
@@ -274,6 +288,7 @@ function createsStackingContext(cs) {
|
|
|
274
288
|
}
|
|
275
289
|
const P = (d) => ({ tag: "path", attrs: { d } });
|
|
276
290
|
const R = (x, y, width, height, rx = 2) => ({ tag: "rect", attrs: { x, y, width, height, rx } });
|
|
291
|
+
const thin = (n) => ({ ...n, attrs: { ...n.attrs, "stroke-width": 1.5 } });
|
|
277
292
|
const DOCK_ICON_NODES = {
|
|
278
293
|
/** 浮窗:圆角框 + 标题栏 + 圆点(app-window;用户 2026-09-15 定稿 C)。 */
|
|
279
294
|
float: [
|
|
@@ -307,6 +322,12 @@ const DOCK_ICON_NODES = {
|
|
|
307
322
|
],
|
|
308
323
|
/** 关闭:×(lucide x;⋮ 区块操作「关闭」)。 */
|
|
309
324
|
x: [P("M18 6 6 18"), P("m6 6 12 12")],
|
|
325
|
+
/** 取消钉住态:图钉 + 斜删除线(lucide pin-off;移动行钉住钮已钉态,与 MiPin 同语义族)。 */
|
|
326
|
+
"pin-off": [
|
|
327
|
+
{ tag: "line", attrs: { x1: 12, y1: 17, x2: 12, y2: 22 } },
|
|
328
|
+
P("M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16h14v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z"),
|
|
329
|
+
{ tag: "line", attrs: { x1: 2, y1: 2, x2: 22, y2: 22 } }
|
|
330
|
+
],
|
|
310
331
|
/** 移除本实例:垃圾桶(lucide trash;多实例区块 ⋮「移除本实例」,与 aiti-folder MiTrash 同形)。 */
|
|
311
332
|
trash: [
|
|
312
333
|
{ tag: "polyline", attrs: { points: "3 6 5 6 21 6" } },
|
|
@@ -319,6 +340,89 @@ const DOCK_ICON_NODES = {
|
|
|
319
340
|
P("M5 11V5h6"),
|
|
320
341
|
P("M19 13v6h-6"),
|
|
321
342
|
P("M5 5l14 14")
|
|
343
|
+
],
|
|
344
|
+
/* ── Block semantic icons (collapsed-header icons; lucide line style) ── */
|
|
345
|
+
/** Projects block (session-manager projects): the aiti-ai logo as line art (chosen by
|
|
346
|
+
* the user 2026-11-26 from the icon candidates preview; prototype = aiti-docs
|
|
347
|
+
* docs/.vuepress/public/logo.svg). Three brand elements: large-rounded square (the
|
|
348
|
+
* gradient tile) + geometric letter a (circle + stem) + top-right spark (from the
|
|
349
|
+
* logo's yellow dot). Visual weight kept on par with the folder/file glyph family:
|
|
350
|
+
* the spark dot is stroked, not filled (a filled node reads much heavier at 13px),
|
|
351
|
+
* and the letter circle stays small so line density matches single-outline glyphs. */
|
|
352
|
+
"aiti-ai-logo": [
|
|
353
|
+
thin(R(3, 3, 18, 18, 4)),
|
|
354
|
+
thin({ tag: "circle", attrs: { cx: 10, cy: 14, r: 2.8 } }),
|
|
355
|
+
thin(P("M12.8 11.2v5.6")),
|
|
356
|
+
thin({ tag: "circle", attrs: { cx: 16.8, cy: 7.2, r: 1.2 } }),
|
|
357
|
+
thin(P("m18.8 5.3 1.5-1.6")),
|
|
358
|
+
thin(P("m19.2 8.2 2.1-.4"))
|
|
359
|
+
],
|
|
360
|
+
/** Folder block (aiti-folder faces): single folder (lucide folder). */
|
|
361
|
+
folder: [
|
|
362
|
+
P("M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z")
|
|
363
|
+
],
|
|
364
|
+
/** Scheduled tasks block (aiti-ai-schedule tasks): clock (lucide clock). */
|
|
365
|
+
clock: [
|
|
366
|
+
{ tag: "circle", attrs: { cx: 12, cy: 12, r: 10 } },
|
|
367
|
+
{ tag: "polyline", attrs: { points: "12 6 12 12 16 14" } }
|
|
368
|
+
],
|
|
369
|
+
/** Subagent fleet block (aiti-subagents fleet): robot (lucide bot). */
|
|
370
|
+
bot: [
|
|
371
|
+
P("M12 8V4H8"),
|
|
372
|
+
R(4, 8, 16, 12),
|
|
373
|
+
P("M2 14h2"),
|
|
374
|
+
P("M20 14h2"),
|
|
375
|
+
P("M15 13v2"),
|
|
376
|
+
P("M9 13v2")
|
|
377
|
+
],
|
|
378
|
+
/** Prompt library block (aiti-prompts panel): bookshelf lines (lucide library). */
|
|
379
|
+
library: [
|
|
380
|
+
P("m16 6 4 14"),
|
|
381
|
+
P("M12 6v14"),
|
|
382
|
+
P("M8 8v12"),
|
|
383
|
+
P("M4 4v16")
|
|
384
|
+
],
|
|
385
|
+
/** Model availability block (aiti-model-check panel): shield + check (lucide shield-check). */
|
|
386
|
+
"shield-check": [
|
|
387
|
+
P("M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"),
|
|
388
|
+
P("m9 12 2 2 4-4")
|
|
389
|
+
],
|
|
390
|
+
/** Watch paths block (aiti-git-trace watch): branch (lucide git-branch). */
|
|
391
|
+
"git-branch": [
|
|
392
|
+
{ tag: "line", attrs: { x1: 6, y1: 3, x2: 6, y2: 15 } },
|
|
393
|
+
{ tag: "circle", attrs: { cx: 18, cy: 6, r: 3 } },
|
|
394
|
+
{ tag: "circle", attrs: { cx: 6, cy: 18, r: 3 } },
|
|
395
|
+
P("M18 9a9 9 0 0 1-9 9")
|
|
396
|
+
],
|
|
397
|
+
/** Timeline block (aiti-git-trace timeline): clock + counterclockwise arrow (lucide history). */
|
|
398
|
+
history: [
|
|
399
|
+
P("M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"),
|
|
400
|
+
P("M3 3v5h5"),
|
|
401
|
+
P("M12 7v5l4 2")
|
|
402
|
+
],
|
|
403
|
+
/** File panel block (aiti-editor file faces): document (lucide file). */
|
|
404
|
+
file: [
|
|
405
|
+
P("M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"),
|
|
406
|
+
P("M14 2v4a2 2 0 0 0 2 2h4")
|
|
407
|
+
],
|
|
408
|
+
/** ACP management block (aiti-acp-agent manage): plug (lucide plug). */
|
|
409
|
+
plug: [
|
|
410
|
+
P("M12 22v-5"),
|
|
411
|
+
P("M9 8V2"),
|
|
412
|
+
P("M15 8V2"),
|
|
413
|
+
P("M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z")
|
|
414
|
+
],
|
|
415
|
+
/** Speech recognition block (aiti-ai-input asr): microphone (lucide mic). */
|
|
416
|
+
mic: [
|
|
417
|
+
P("M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"),
|
|
418
|
+
P("M19 10v2a7 7 0 0 1-14 0v-2"),
|
|
419
|
+
{ tag: "line", attrs: { x1: 12, y1: 19, x2: 12, y2: 22 } }
|
|
420
|
+
],
|
|
421
|
+
/** Dock demo block (demo): 3D box (lucide box). */
|
|
422
|
+
box: [
|
|
423
|
+
P("M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"),
|
|
424
|
+
P("m3.3 7 8.7 5 8.7-5"),
|
|
425
|
+
P("M12 22V12")
|
|
322
426
|
]
|
|
323
427
|
};
|
|
324
428
|
function dockIconOfZone(zone) {
|
|
@@ -394,6 +498,21 @@ function writeBlockCollapsed(blockKey, collapsed) {
|
|
|
394
498
|
} catch {
|
|
395
499
|
}
|
|
396
500
|
}
|
|
501
|
+
const SIDEBAR_DISMISS_PREFIX = "pi:sidebar-dock:dismissed:";
|
|
502
|
+
function readBlockDismissed(blockKey) {
|
|
503
|
+
try {
|
|
504
|
+
return localStorage.getItem(SIDEBAR_DISMISS_PREFIX + blockKey) === "1";
|
|
505
|
+
} catch {
|
|
506
|
+
return false;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
function writeBlockDismissed(blockKey, dismissed) {
|
|
510
|
+
try {
|
|
511
|
+
if (dismissed) localStorage.setItem(SIDEBAR_DISMISS_PREFIX + blockKey, "1");
|
|
512
|
+
else localStorage.removeItem(SIDEBAR_DISMISS_PREFIX + blockKey);
|
|
513
|
+
} catch {
|
|
514
|
+
}
|
|
515
|
+
}
|
|
397
516
|
function readDockOrder() {
|
|
398
517
|
try {
|
|
399
518
|
const raw = JSON.parse(localStorage.getItem(SIDEBAR_ORDER_KEY) ?? "[]");
|
|
@@ -481,7 +600,7 @@ function actionSig(list) {
|
|
|
481
600
|
}
|
|
482
601
|
function menuSig(list) {
|
|
483
602
|
if (!list) return "";
|
|
484
|
-
return list.map((m) => m.kind === "item" ? `i:${m.id ?? m.label}:${m.label}:${m.hint ?? ""}:${m.active ? 1 : 0}:${m.alwaysRun ? 1 : 0}:${m.disabled ? 1 : 0}` : m.kind === "head" ? `h:${m.label}` : "s").join("§");
|
|
603
|
+
return list.map((m) => m.kind === "item" ? `i:${m.id ?? m.label}:${m.label}:${m.hint ?? ""}:${m.active ? 1 : 0}:${m.alwaysRun ? 1 : 0}:${m.disabled ? 1 : 0}` : m.kind === "head" ? `h:${m.label}` : m.kind === "iconsRow" ? `r:${m.label ?? ""}:${m.items.map((i) => i.key).join(",")}` : m.kind === "moveRow" ? "mv-row" : "s").join("§");
|
|
485
604
|
}
|
|
486
605
|
function stateSig(s) {
|
|
487
606
|
try {
|
|
@@ -687,8 +806,10 @@ function localPresent(k, mode, opts) {
|
|
|
687
806
|
next = zone ? `docked:${zone}` : "floating";
|
|
688
807
|
}
|
|
689
808
|
} else if (mode === "float") next = "floating";
|
|
690
|
-
else if (mode === "close")
|
|
691
|
-
|
|
809
|
+
else if (mode === "close") {
|
|
810
|
+
next = "closed";
|
|
811
|
+
writeBlockDismissed(k, true);
|
|
812
|
+
} else if (mode.startsWith("dock:")) {
|
|
692
813
|
const zone = mode.slice(5);
|
|
693
814
|
try {
|
|
694
815
|
localStorage.setItem(DOCKPREF_KEY(k), zone);
|
|
@@ -696,6 +817,7 @@ function localPresent(k, mode, opts) {
|
|
|
696
817
|
}
|
|
697
818
|
next = `docked:${zone}`;
|
|
698
819
|
}
|
|
820
|
+
if (next !== "closed" && isSidebarDockState(next)) writeBlockDismissed(k, false);
|
|
699
821
|
if (next === prev) {
|
|
700
822
|
if (prev.startsWith("docked:")) {
|
|
701
823
|
try {
|
|
@@ -811,9 +933,24 @@ if (typeof window !== "undefined") {
|
|
|
811
933
|
} catch {
|
|
812
934
|
}
|
|
813
935
|
}
|
|
936
|
+
const DOCK_WORDS = {
|
|
937
|
+
newWindow: { "zh-CN": "新窗口打开", en: "Open in new window" },
|
|
938
|
+
float: { "zh-CN": "浮窗", en: "Float" },
|
|
939
|
+
zoneSidebar: { "zh-CN": "左栏 · 区块", en: "Left · blocks" },
|
|
940
|
+
zoneRight: { "zh-CN": "右栏 · 面板", en: "Right · panels" }
|
|
941
|
+
};
|
|
942
|
+
function dockWord(key) {
|
|
943
|
+
let loc = "en";
|
|
944
|
+
try {
|
|
945
|
+
loc = window.localStorage.getItem("pi-locale") || "en";
|
|
946
|
+
} catch {
|
|
947
|
+
}
|
|
948
|
+
const w = DOCK_WORDS[key];
|
|
949
|
+
return w[loc === "zh-CN" ? "zh-CN" : "en"] ?? w.en;
|
|
950
|
+
}
|
|
814
951
|
const DOCK_ZONE_LABELS = {
|
|
815
|
-
"sidebar-explorer": "
|
|
816
|
-
"right-panel": "
|
|
952
|
+
"sidebar-explorer": dockWord("zoneSidebar"),
|
|
953
|
+
"right-panel": dockWord("zoneRight")
|
|
817
954
|
};
|
|
818
955
|
function positionMenuItems(k, zones, defaultZone, cur) {
|
|
819
956
|
const hasSidebar = zones.some((z) => z === "sidebar-explorer" || z.startsWith("sidebar:"));
|
|
@@ -847,8 +984,8 @@ function positionMenuItems(k, zones, defaultZone, cur) {
|
|
|
847
984
|
function positionMenuModel(k, zones, defaultZone, cur, opts) {
|
|
848
985
|
const newWindow = opts?.onNewWindow ?? dockWindowOpenerOf(k);
|
|
849
986
|
return [
|
|
850
|
-
...newWindow ? [{ key: "new-window", icon: "new-window", label: "
|
|
851
|
-
{ key: "float", icon: "float", label: "
|
|
987
|
+
...newWindow ? [{ key: "new-window", icon: "new-window", label: dockWord("newWindow"), run: newWindow }] : [],
|
|
988
|
+
{ key: "float", icon: "float", label: dockWord("float"), active: cur === "floating", run: () => undockToFloat(k) },
|
|
852
989
|
...positionMenuItems(k, zones, defaultZone, cur)
|
|
853
990
|
];
|
|
854
991
|
}
|
|
@@ -1764,6 +1901,15 @@ function install() {
|
|
|
1764
1901
|
};
|
|
1765
1902
|
api.isMax = (p) => maxControls.get(p)?.isMax() ?? false;
|
|
1766
1903
|
api.isFull = (p) => maxControls.get(p)?.isFull?.() ?? false;
|
|
1904
|
+
api.raise = (p) => {
|
|
1905
|
+
try {
|
|
1906
|
+
if (!p || !p.isConnected || !enhancedPanels.has(p)) return false;
|
|
1907
|
+
bringToFront(p);
|
|
1908
|
+
return true;
|
|
1909
|
+
} catch {
|
|
1910
|
+
return false;
|
|
1911
|
+
}
|
|
1912
|
+
};
|
|
1767
1913
|
try {
|
|
1768
1914
|
window.dispatchEvent(new Event(FLOAT_INSTALLED_EVENT));
|
|
1769
1915
|
} catch {
|
|
@@ -1836,7 +1982,8 @@ function createDockStackApi(ctx) {
|
|
|
1836
1982
|
function StaticDockFace(props) {
|
|
1837
1983
|
const item = props.item;
|
|
1838
1984
|
const blockKey = String(item.id);
|
|
1839
|
-
const
|
|
1985
|
+
const rawTitle = String(item.meta?.title ?? item.meta?.label ?? item.extId ?? item.id);
|
|
1986
|
+
const title = typeof ctx.translateItemText === "function" ? ctx.translateItemText(item.extId, rawTitle) || rawTitle : rawTitle;
|
|
1840
1987
|
const collapsed = useBlockCollapsedCtx(blockKey)[0];
|
|
1841
1988
|
const [phase, setPhase] = useState("idle");
|
|
1842
1989
|
const load = () => {
|
|
@@ -1854,6 +2001,12 @@ function createDockStackApi(ctx) {
|
|
|
1854
2001
|
itemKey: blockKey,
|
|
1855
2002
|
blockKey,
|
|
1856
2003
|
title,
|
|
2004
|
+
// Block header icon (five-form contract, dockIconFromDecl on the shell side):
|
|
2005
|
+
// meta.iconUrl = host-resolved absolute URL for the ".svg"-relative asset form;
|
|
2006
|
+
// meta.icon / item.icon pass through verbatim ({svg} / name / emoji). Third-party
|
|
2007
|
+
// extensions carry their own icons ({svg} / {url} / emoji) without the built-in
|
|
2008
|
+
// name table; the shell shows the same icon as the real face after materialization.
|
|
2009
|
+
icon: item.meta?.iconUrl ? { url: item.meta.iconUrl } : item.meta?.icon ?? item.icon,
|
|
1857
2010
|
chrome: "section",
|
|
1858
2011
|
kind: "dockable",
|
|
1859
2012
|
zones,
|
|
@@ -1872,7 +2025,7 @@ function createDockStackApi(ctx) {
|
|
|
1872
2025
|
"div",
|
|
1873
2026
|
{
|
|
1874
2027
|
onClick: () => writeBlockCollapsed(blockKey, !collapsed),
|
|
1875
|
-
style: { display: "flex", alignItems: "center", gap: 6, padding: "8px 10px", cursor: "pointer", userSelect: "none", fontSize: 12, color: "var(--text-muted)"
|
|
2028
|
+
style: { display: "flex", alignItems: "center", gap: 6, padding: "8px 10px", cursor: "pointer", userSelect: "none", fontSize: 12, color: "var(--text-muted)" }
|
|
1876
2029
|
},
|
|
1877
2030
|
h("span", { style: { transform: collapsed ? "rotate(-90deg)" : "none", transition: "transform 0.12s", fontSize: 10 } }, "▼"),
|
|
1878
2031
|
h("span", { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, title),
|
|
@@ -1911,6 +2064,7 @@ function createDockStackApi(ctx) {
|
|
|
1911
2064
|
const key = String(it.id);
|
|
1912
2065
|
if (seen.has(key)) continue;
|
|
1913
2066
|
seen.add(key);
|
|
2067
|
+
if (readBlockDismissed(key)) continue;
|
|
1914
2068
|
const pref = dockPref$1(key);
|
|
1915
2069
|
if (pref && isSidebarDockState(`docked:${pref}`) && presented(key) === "closed") {
|
|
1916
2070
|
present$1(key, "open", { auto: true });
|
|
@@ -1977,7 +2131,7 @@ function createDockStackApi(ctx) {
|
|
|
1977
2131
|
...blocks.map((b) => ({ ...b, align: b.align ?? "top" })),
|
|
1978
2132
|
...dockedItems.map((it) => ({
|
|
1979
2133
|
key: String(it.id),
|
|
1980
|
-
title: it.meta?.title ?? String(it.id),
|
|
2134
|
+
title: (typeof ctx.translateItemText === "function" && /^i18n:/.test(String(it.meta?.title ?? "")) ? ctx.translateItemText(it.extId, String(it.meta?.title)) : it.meta?.title) ?? String(it.id),
|
|
1981
2135
|
priority: typeof it.meta?.priority === "number" ? it.meta.priority : DOCK_DEFAULT_PRIORITY,
|
|
1982
2136
|
// 对齐分组(v4):dockable 默认下对齐(重要性次级);meta.align="top" 显式声明核心区块
|
|
1983
2137
|
align: it.meta?.align === "top" ? "top" : "bottom",
|
package/index.ts
CHANGED
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
* 自动获得:拖拽移动(鼠标/触屏,交互元素上按下不触发)/ 右下左缘+右下角缩放 /
|
|
46
46
|
* 位置尺寸 localStorage 持久化 / 点按置前(连带遮罩层)/ 视口夹紧 / 双击把手复位。
|
|
47
47
|
*
|
|
48
|
-
*
|
|
48
|
+
* Contract: docs/aiti-web-ext-float-dialogs.md.
|
|
49
49
|
* 参考实现:aiti-ui-env 弹窗、demo(双写法)、templates/ext-jsx-client。
|
|
50
50
|
*
|
|
51
51
|
* AI 自管理:skills/float-dialog-adapter —— 帮 AI 把扩展弹窗接入本契约
|
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
export default {
|
|
59
59
|
id: "aiti-float",
|
|
60
60
|
name: "弹窗浮动增强",
|
|
61
|
-
version: "0.5.0",
|
|
62
61
|
icon: "icon.svg",
|
|
63
62
|
client: "dist/aiti-float-client.mjs",
|
|
64
63
|
|
|
@@ -67,6 +66,18 @@ export default {
|
|
|
67
66
|
provides: ["aiti-float.dockstack"],
|
|
68
67
|
|
|
69
68
|
// AI 自管理清单:AI 能帮扩展弹窗接入本契约(属性表/最大化 API/检查清单)
|
|
69
|
+
ui: {
|
|
70
|
+
// English manifest-text overrides (name/description/feature labels); zh source lives in the manifest.
|
|
71
|
+
i18n: {
|
|
72
|
+
"zh-CN": {
|
|
73
|
+
"ext.displayName": "弹窗浮动增强器",
|
|
74
|
+
},
|
|
75
|
+
en: {
|
|
76
|
+
"ext.displayName": "Dialog Float Enhancer",
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
|
|
70
81
|
ai: {
|
|
71
82
|
manage: true,
|
|
72
83
|
intro: "AI 能帮我把扩展弹窗接入浮动契约(拖拽/缩放/小屏全屏/手动最大化)",
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiti-ai/aiti-float",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.12",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "data-ext-float contract take-over — drag/edge resize/position persistence/click-to-front/double-click reset/auto maximize button, small-screen auto fullscreen + system back closes the float; the DockStack unified sidebar block-stack service",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build:client": "vite build --config vite.config.ts",
|
|
8
8
|
"watch": "vite build --watch --config vite.config.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"soul": "面板只管标一个属性,浮起来的一切交给它。",
|
|
15
15
|
"aitiExtProtocol": "1.0",
|
|
16
16
|
"license": "MIT",
|
|
17
|
-
"contentHash": "
|
|
17
|
+
"contentHash": "341a334f7e2bba7c",
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
20
|
"url": "git+https://github.com/aiti-ai/aiti-ai.git",
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: float-dialog-adapter
|
|
3
3
|
title: AI 帮我把弹窗接入浮动契约(拖拽/缩放/小屏全屏/最大化)
|
|
4
|
+
title.en: "AI: wire a dialog into the float contract (drag/resize/mobile fullscreen/maximize)"
|
|
4
5
|
placeholder: 描述你的弹窗(哪个扩展、什么布局、要不要小屏全屏/最大化按钮)…
|
|
6
|
+
placeholder.en: "Describe your dialog (which extension, layout, whether it needs mobile fullscreen/maximize button)…"
|
|
5
7
|
---
|
|
6
8
|
|
|
7
9
|
# float-dialog-adapter · 扩展弹窗接入 aiti-float 浮动契约
|
|
8
10
|
|
|
9
|
-
你要帮用户把一个扩展弹窗(面板)接入 aiti-float 浮动契约。权威文档:`docs/aiti-web-ext-float-dialogs.md`(
|
|
11
|
+
你要帮用户把一个扩展弹窗(面板)接入 aiti-float 浮动契约。权威文档:`docs/aiti-web-ext-float-dialogs.md`(the source repo 仓);参考实现:`pi-web-ext/aiti-ui-env/client/src/ui-env-app.tsx`、`pi-web-ext/demo`、`pi-web-ext/templates/ext-jsx-client`。
|
|
10
12
|
|
|
11
13
|
## 标准接入(最小改动)
|
|
12
14
|
|
package/tools/build-client.mjs
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* 用法:node tools/build-client.mjs (或 npm run watch 自动重建)
|
|
7
7
|
*/
|
|
8
8
|
import { spawnSync } from "node:child_process";
|
|
9
|
+
import { createRequire } from "node:module";
|
|
9
10
|
import { resolve } from "node:path";
|
|
10
11
|
import { fileURLToPath } from "node:url";
|
|
11
12
|
import { existsSync } from "node:fs";
|
|
@@ -13,7 +14,7 @@ import { existsSync } from "node:fs";
|
|
|
13
14
|
const root = resolve(fileURLToPath(new URL("..", import.meta.url)));
|
|
14
15
|
|
|
15
16
|
const viteJs = resolve(root, "node_modules", "vite", "bin", "vite.js");
|
|
16
|
-
const viteBin = existsSync(viteJs) ? viteJs : "vite";
|
|
17
|
+
const viteBin = existsSync(viteJs) ? viteJs : resolve(createRequire(import.meta.url).resolve("vite/package.json"), "..", "bin", "vite.js");
|
|
17
18
|
|
|
18
19
|
const r = spawnSync(process.execPath, [viteBin, "build", "--config", resolve(root, "vite.config.ts")], {
|
|
19
20
|
cwd: root,
|