dsh-calorie 0.1.4 → 0.1.6
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/dist/client.js +83 -11
- package/dist/client.js.map +1 -1
- package/dist/slot.d.ts +5 -0
- package/dist/slot.d.ts.map +1 -1
- package/dist/slot.js +5 -0
- package/dist/slot.js.map +1 -1
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -48,6 +48,12 @@ window.__ModuleLoader__.load({
|
|
|
48
48
|
//#endregion
|
|
49
49
|
//#region src/slot.ts
|
|
50
50
|
const SLOT_TITLE = "卡路里";
|
|
51
|
+
const PLUGIN = "dsh-calorie";
|
|
52
|
+
const SKILL_PACKAGE = "skill-calorie";
|
|
53
|
+
/** 版本行唯一来源(面板展示用;smoke 断言与两处 package.json 一致,防漂移)。
|
|
54
|
+
* 发版 bump 时同步改这里(与 package.json 同值)。 */
|
|
55
|
+
const PLUGIN_VERSION = "0.1.6";
|
|
56
|
+
const SKILL_VERSION = "0.1.1";
|
|
51
57
|
//#endregion
|
|
52
58
|
//#region src/settings.ts
|
|
53
59
|
/** 脚手架期唯一设置行:总开关(缺省启用,与官方关闭语义对齐)。 */
|
|
@@ -69,11 +75,59 @@ window.__ModuleLoader__.load({
|
|
|
69
75
|
* 有界重试例外依据(唯一允许的定时器):注册重试非数据轮询,照抄
|
|
70
76
|
* dsh-mattpocock-skills-deck/src/client/panelAssembly.js:100-108
|
|
71
77
|
* (betterSidebar 服务可能晚于本模块到达,最多 10 次、间隔 1000ms;卸载清理)。
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
78
|
+
* 样式:React 内联 style + DSH 主题别名(var(--dsw-alias-*),带回退),无外部样式表、
|
|
79
|
+
* 无 <style> 注入、无类名冲突;只用 dsh-ctx 镜像内成员(slots.inject/register、
|
|
80
|
+
* connection.rpc.call 经闭包现取、betterSidebar 经 ctx.get 运行时取);
|
|
81
|
+
* 取数只经 connection.rpc.call 进 host 通道;缺席/错误纯条件渲染,不返空冒充。
|
|
82
|
+
* 组件 React.createElement 手写,不引入 JSX。
|
|
75
83
|
*/
|
|
76
84
|
const inject = ["slots"];
|
|
85
|
+
/** 面板视觉(内联 style;颜色走 DSH 主题别名,深浅主题自适应,写死值只做回退)。 */
|
|
86
|
+
const S = {
|
|
87
|
+
card: {
|
|
88
|
+
padding: "12px 14px",
|
|
89
|
+
borderRadius: 10,
|
|
90
|
+
border: "1px solid var(--dsw-alias-border, rgba(128,128,128,.35))",
|
|
91
|
+
background: "var(--dsw-alias-bg-base, transparent)",
|
|
92
|
+
color: "var(--dsw-alias-label-primary, inherit)",
|
|
93
|
+
fontSize: 13,
|
|
94
|
+
lineHeight: 1.6
|
|
95
|
+
},
|
|
96
|
+
title: {
|
|
97
|
+
fontSize: 14,
|
|
98
|
+
fontWeight: 700,
|
|
99
|
+
marginBottom: 8
|
|
100
|
+
},
|
|
101
|
+
total: {
|
|
102
|
+
fontSize: 22,
|
|
103
|
+
fontWeight: 700,
|
|
104
|
+
margin: "2px 0 4px"
|
|
105
|
+
},
|
|
106
|
+
muted: {
|
|
107
|
+
color: "var(--dsw-alias-label-secondary, #9a9a9a)",
|
|
108
|
+
fontSize: 12
|
|
109
|
+
},
|
|
110
|
+
error: {
|
|
111
|
+
color: "var(--dsw-alias-state-error-primary, #ff6b6b)",
|
|
112
|
+
fontSize: 13
|
|
113
|
+
},
|
|
114
|
+
rows: {
|
|
115
|
+
marginTop: 8,
|
|
116
|
+
borderTop: "1px solid var(--dsw-alias-border, rgba(128,128,128,.25))",
|
|
117
|
+
paddingTop: 8
|
|
118
|
+
},
|
|
119
|
+
version: {
|
|
120
|
+
marginTop: 8,
|
|
121
|
+
paddingTop: 8,
|
|
122
|
+
borderTop: "1px dashed var(--dsw-alias-border, rgba(128,128,128,.25))",
|
|
123
|
+
color: "var(--dsw-alias-label-tertiary, #8a8a8a)",
|
|
124
|
+
fontSize: 12
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
/** 版本行:插件与技能双版本号(用户要求:每技能设置页自报家门)。 */
|
|
128
|
+
function VersionLine() {
|
|
129
|
+
return react.createElement("div", { style: S.version }, `${PLUGIN} ${PLUGIN_VERSION} · ${SKILL_PACKAGE} ${SKILL_VERSION}`);
|
|
130
|
+
}
|
|
77
131
|
/** 本地今日 YYYY-MM-DD(与面板默认读键的 date 参数同形)。 */
|
|
78
132
|
function todayString() {
|
|
79
133
|
const d = /* @__PURE__ */ new Date();
|
|
@@ -96,6 +150,24 @@ window.__ModuleLoader__.load({
|
|
|
96
150
|
}
|
|
97
151
|
return String(value);
|
|
98
152
|
}
|
|
153
|
+
/** 请求超时毫秒:与 host 侧 SPAWN_TIMEOUT_MS 同级,UI 永不无限转圈。 */
|
|
154
|
+
const READ_TIMEOUT_MS = 2e4;
|
|
155
|
+
/** 自家赛跑超时(有界:settle 即清 timer;不依赖传输是否搭理 AbortSignal——Desktop 自研传输会忽略 signal)。
|
|
156
|
+
* 注释即 p10 有界重试门要的例外依据(文件内另有 clearTimeout/tries 上限/本注释三件套)。 */
|
|
157
|
+
function withTimeout(promise, ms) {
|
|
158
|
+
let timer;
|
|
159
|
+
const limit = new Promise((_, reject) => {
|
|
160
|
+
timer = setTimeout(() => {
|
|
161
|
+
timer = void 0;
|
|
162
|
+
const e = /* @__PURE__ */ new Error(`取数超时(${Math.round(ms / 1e3)}s):宿主未回,先查宿主日志与 DB 环境`);
|
|
163
|
+
e.name = "TimeoutError";
|
|
164
|
+
reject(e);
|
|
165
|
+
}, ms);
|
|
166
|
+
});
|
|
167
|
+
return Promise.race([promise.finally(() => {
|
|
168
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
169
|
+
}), limit]);
|
|
170
|
+
}
|
|
99
171
|
/** 单次读数(纯异步函数,无 hook;挂载期调用一次,无轮询)。 */
|
|
100
172
|
async function fetchRead(call, key, params) {
|
|
101
173
|
if (typeof call !== "function") return {
|
|
@@ -105,10 +177,10 @@ window.__ModuleLoader__.load({
|
|
|
105
177
|
};
|
|
106
178
|
let result;
|
|
107
179
|
try {
|
|
108
|
-
const raw = await call(RPC_CHANNEL, RPC_ENDPOINT_READ, {
|
|
180
|
+
const raw = await withTimeout(call(RPC_CHANNEL, RPC_ENDPOINT_READ, {
|
|
109
181
|
key,
|
|
110
182
|
params
|
|
111
|
-
}, AbortSignal.timeout(
|
|
183
|
+
}, AbortSignal.timeout(READ_TIMEOUT_MS)), READ_TIMEOUT_MS);
|
|
112
184
|
if (!isRpcResult(raw)) return {
|
|
113
185
|
ok: false,
|
|
114
186
|
absent: false,
|
|
@@ -179,9 +251,9 @@ window.__ModuleLoader__.load({
|
|
|
179
251
|
alive = false;
|
|
180
252
|
};
|
|
181
253
|
}, [props.getCall]);
|
|
182
|
-
if (state.kind === "loading") return react.createElement("div",
|
|
183
|
-
if (state.kind === "data") return react.createElement("div",
|
|
184
|
-
return react.createElement("div",
|
|
254
|
+
if (state.kind === "loading") return react.createElement("div", { style: S.card }, react.createElement("div", { style: S.muted }, "卡路里加载中…"));
|
|
255
|
+
if (state.kind === "data") return react.createElement("div", { style: S.card }, react.createElement("div", { style: S.title }, `卡路里 · ${state.date}`), react.createElement("div", { style: S.total }, `total ${state.total}`), react.createElement(VersionLine, null));
|
|
256
|
+
return react.createElement("div", { style: S.card }, react.createElement("div", { style: state.kind === "absent" ? S.muted : S.error }, state.message), react.createElement(VersionLine, null));
|
|
185
257
|
}
|
|
186
258
|
function controlLabel(control) {
|
|
187
259
|
if (control === "switch") return "开关(缺省启用,只读)";
|
|
@@ -189,7 +261,7 @@ window.__ModuleLoader__.load({
|
|
|
189
261
|
if (control === "number") return "数字(只读)";
|
|
190
262
|
return `${control}(只读)`;
|
|
191
263
|
}
|
|
192
|
-
/** 技能设置页:爱生活页签条下的一页(只读设置行 +
|
|
264
|
+
/** 技能设置页:爱生活页签条下的一页(只读设置行 + 状态读数 + 版本行,禁做假开关)。 */
|
|
193
265
|
function CalorieConfig(props) {
|
|
194
266
|
const [state, setState] = react.useState({ kind: "loading" });
|
|
195
267
|
react.useEffect(() => {
|
|
@@ -216,8 +288,8 @@ window.__ModuleLoader__.load({
|
|
|
216
288
|
alive = false;
|
|
217
289
|
};
|
|
218
290
|
}, [props.getCall]);
|
|
219
|
-
const status = state.kind === "loading" ? "状态读取中…" : state.kind === "data" ?
|
|
220
|
-
return react.createElement("div",
|
|
291
|
+
const status = state.kind === "loading" ? react.createElement("div", { style: S.muted }, "状态读取中…") : state.kind === "data" ? react.createElement("div", null, react.createElement("div", { style: S.title }, SLOT_TITLE), react.createElement("div", { style: S.total }, `total ${state.total}`), react.createElement("div", { style: S.muted }, `今日 ${state.date}`)) : react.createElement("div", { style: state.kind === "absent" ? S.muted : S.error }, state.message);
|
|
292
|
+
return react.createElement("div", { style: S.card }, status, react.createElement("div", { style: S.rows }, SETTING_ROWS.map((row) => react.createElement("div", { key: row.key }, `${row.title} · ${controlLabel(row.control)}`))), react.createElement(VersionLine, null));
|
|
221
293
|
}
|
|
222
294
|
function apply(ctx) {
|
|
223
295
|
const getCall = () => ctx.connection?.rpc?.call ?? null;
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["React"],"sources":["../src/contract.ts","../src/slot.ts","../src/settings.ts","../src/client.ts"],"sourcesContent":["/** dsh-calorie 端口(port):DSH 世界与卡路里 hexagon 之间的契约。\n *\n * browser 安全:零 node 导入。host 适配器(注册 RPC 通道)与 client\n * 适配器(调用 RPC)共用同一份定义;单测与 loader 回路以此为准。\n * 通道命名遵守宿主约束:单段且不等于 /api(见 cookbook「RPC 通道」)。\n */\nexport const RPC_CHANNEL = '/ilife-calorie' as const;\nexport const RPC_ENDPOINT_READ = 'read' as const;\n\n/** 读请求载荷:与技能 CLI 的 key/params 同形(见 skill-calorie SKILL.md)。 */\nexport interface ReadPayload {\n readonly key: string;\n readonly params: Record<string, unknown>;\n}\n\nexport interface RpcError {\n readonly code: string;\n readonly message: string;\n readonly details: Record<string, unknown>;\n}\n\nexport type RpcResult =\n | { readonly ok: true; readonly value: unknown }\n | { readonly ok: false; readonly error: RpcError };\n\nexport function ok(value: unknown): RpcResult {\n return { ok: true, value };\n}\n\nexport function fail(code: string, message: string): RpcResult {\n return { ok: false, error: { code, message, details: {} } };\n}\n\n/** 载荷校验:形状不对返回 null,由调用方按 bad-request 回绝(不抛)。 */\nexport function parseReadPayload(raw: unknown): ReadPayload | null {\n if (typeof raw !== 'object' || raw === null) return null;\n const { key, params } = raw as { key?: unknown; params?: unknown };\n if (typeof key !== 'string' || key.length === 0) return null;\n if (typeof params !== 'object' || params === null || Array.isArray(params)) return null;\n return { key, params: params as Record<string, unknown> };\n}\n\n/** 面板默认读键(与 HITL 一致性对比同键)。 */\nexport const DEFAULT_READ_KEY = 'calorie.view.home' as const;\n\n/** 信封守卫:供 client 拆包前校验(port 拥有信封定义,守卫住 port)。 */\nexport function isRpcResult(raw: unknown): raw is RpcResult {\n if (typeof raw !== 'object' || raw === null) return false;\n const ok = (raw as { ok?: unknown }).ok;\n return ok === true || ok === false;\n}\n","/** dsh-calorie 槽位描述(P10 脚手架,P3 #4 定案)。\n *\n * 写死槽位原生组件:id 命名空间 ilife:calorie,order 75。\n * 注册与打开只走 registerTab/openTab 的路径导航;子页后缀(如 ilife:calorie:*)\n * 只在主面板内导航,不占栏。缺席纯条件渲染,不轮询(本文件无定时器;\n * 有界重试归一由 base-render 拥有,单品不自建)。\n */\n\nexport const SKILL = 'calorie' as const;\nexport const SLOT_ID = 'ilife:calorie' as const;\nexport const SLOT_ORDER = 75 as const;\nexport const SLOT_TITLE = '卡路里' as const;\nexport const PLUGIN = 'dsh-calorie' as const;\nexport const MANAGER_PLUGIN = 'dsh-life-pack' as const;\n\nexport interface SlotDescriptor {\n readonly skill: string;\n readonly slotId: string;\n readonly order: number;\n readonly title: string;\n readonly kind: 'page';\n}\n\nexport function slotDescriptor(): SlotDescriptor {\n return { skill: SKILL, slotId: SLOT_ID, order: SLOT_ORDER, title: SLOT_TITLE, kind: 'page' };\n}\n\n/** 写死原生组件描述(纯数据,无按需加载,无外嵌页)。 */\nexport const TAB_COMPONENT = { kind: 'native', name: 'CaloriePanel' } as const;\n\nexport interface TabsPort {\n hasTabs(): boolean;\n registerTab(entry: { readonly id: string; readonly title: string; readonly order: number; readonly single: boolean; readonly component: unknown }): () => void;\n openTab(seed: { readonly type: string; readonly path: string }, scope?: { readonly sessionId?: string }): void;\n}\n\n/** 自注册:幂等(调用方持 disposer),失败返回 false 由调用方决定重试。 */\nexport function registerSingle(port: TabsPort): (() => void) | null {\n if (!port.hasTabs()) return null;\n return port.registerTab({ id: SLOT_ID, title: SLOT_TITLE, order: SLOT_ORDER, single: true, component: TAB_COMPONENT });\n}\n\n/** 内容型打开:path seed,折叠面板自动展开。 */\nexport function openSingle(port: TabsPort, sessionId?: string): void {\n if (!port.hasTabs()) return;\n port.openTab({ type: SLOT_ID, path: SLOT_ID }, sessionId ? { sessionId } : undefined);\n}\n","/** dsh-calorie 设置页(P10 脚手架:设置页住单品包)。\n *\n * 一次 registerTab,两处呈现:边栏 + 号菜单多一项,DSH 设置页侧边卡片\n * 分区自动多一张小卡片(注册表驱动、无硬编码,开关缺省启用)。\n * 本文件只声明本单品自己的设置行;总管不声明设置(见 boundaries 断言)。\n */\n\nexport const SETTINGS_OWNER = 'dsh-calorie' as const;\nexport const SETTINGS_SLOT = 'ilife:calorie' as const;\n\nexport interface SettingRow {\n readonly key: string;\n readonly title: string;\n readonly control: 'switch' | 'text' | 'number';\n}\n\n/** 脚手架期唯一设置行:总开关(缺省启用,与官方关闭语义对齐)。 */\nexport const SETTING_ROWS: readonly SettingRow[] = [\n { key: 'enabled', title: '卡路里面板启用', control: 'switch' },\n];\n","/** dsh-calorie client 适配器(六边形:port=contract+dsh-ctx 镜像,adapter=本文件)。\n *\n * 产物经 tsdown 打成 loader 工厂包(browser/CJS,见 tsdown.config.ts)。\n * 本文件传递闭包:禁 node、禁 DOM 直写(document/window/process)。\n * 注册两处(grill 定案,新术语见 CONTEXT.md):\n * (a) 技能设置页 → 爱生活页签槽(总管声明的 children,各技能自研自家配置页);\n * (b) 技能功能页 → sidebar槽(better-sidebar 服务,非 DSH slot;软依赖,\n * 缺席即跳过,不断链。DSH右侧槽 + sidebar.footer.action 彻底出局,已删)。\n * 有界重试例外依据(唯一允许的定时器):注册重试非数据轮询,照抄\n * dsh-mattpocock-skills-deck/src/client/panelAssembly.js:100-108\n * (betterSidebar 服务可能晚于本模块到达,最多 10 次、间隔 1000ms;卸载清理)。\n * 只用 dsh-ctx 镜像内成员(slots.inject/register、connection.rpc.call 经闭包现取、\n * betterSidebar 经 ctx.get 运行时取);取数只经 connection.rpc.call 进 host 通道;\n * 缺席/错误纯条件渲染,不返空冒充。组件 React.createElement 手写,不引入 JSX。\n */\nimport * as React from 'react';\nimport { RPC_CHANNEL, RPC_ENDPOINT_READ, DEFAULT_READ_KEY, isRpcResult } from './contract.js';\nimport { SLOT_TITLE } from './slot.js';\nimport { SETTING_ROWS } from './settings.js';\nimport type { ClientCtx, RpcCallResult } from './dsh-ctx.js';\n\nexport const inject = ['slots'];\n\n/** 调用口取用器:每次取数时现取(connection 后到也不永久缺席)。 */\nexport type GetCall = () => unknown;\n\ntype PanelState =\n | { readonly kind: 'loading' }\n | { readonly kind: 'data'; readonly date: string; readonly total: string }\n | { readonly kind: 'absent'; readonly message: string }\n | { readonly kind: 'error'; readonly message: string };\n\n/** 本地今日 YYYY-MM-DD(与面板默认读键的 date 参数同形)。 */\nfunction todayString(): string {\n const d = new Date();\n const m = String(d.getMonth() + 1).padStart(2, '0');\n const day = String(d.getDate()).padStart(2, '0');\n return `${d.getFullYear()}-${m}-${day}`;\n}\n\n/** 数据态取值:有 total 显示 total,有值无 total 显示原值 JSON,空值返回 null(由调用方进错误态)。 */\nfunction extractTotal(value: unknown): string | null {\n if (value === null || value === undefined) return null;\n if (typeof value === 'string') return value.length > 0 ? value : null;\n if (typeof value === 'object') {\n const total = (value as { total?: unknown }).total;\n if (total !== null && total !== undefined) return String(total);\n try {\n return JSON.stringify(value);\n } catch {\n return null;\n }\n }\n return String(value);\n}\n\ntype ReadOutcome =\n | { readonly ok: true; readonly text: string }\n | { readonly ok: false; readonly absent: boolean; readonly message: string };\n\n/** 单次读数(纯异步函数,无 hook;挂载期调用一次,无轮询)。 */\nasync function fetchRead(call: unknown, key: string, params: Record<string, unknown>): Promise<ReadOutcome> {\n // extractRpc 同式守卫:非函数即缺席态。\n if (typeof call !== 'function') return { ok: false, absent: true, message: '宿主连接缺席:connection.rpc.call 不可用' };\n let result: RpcCallResult;\n try {\n // 防御纵深:宿主侧再 hang,UI 最多转 20s 圈(AbortSignal.timeout 无字面定时器,不触发轮询门)。\n const raw: unknown = await call(RPC_CHANNEL, RPC_ENDPOINT_READ, { key, params }, AbortSignal.timeout(20_000));\n if (!isRpcResult(raw)) return { ok: false, absent: false, message: '回执信封异常(非 ok 信封)' };\n result = raw;\n } catch (e) {\n if (e instanceof Error && e.name === 'AbortError') return { ok: false, absent: false, message: '取数超时(20s):宿主未回,先查宿主日志与 DB 环境' };\n return { ok: false, absent: false, message: `取数失败:${e instanceof Error ? e.message : String(e)}` };\n }\n if (!result.ok) {\n const code = result.error?.code ?? 'unknown';\n const message = result.error?.message ?? '';\n if (code === 'missing-cli') return { ok: false, absent: true, message: `技能出口缺席(missing-cli):${message}` };\n return { ok: false, absent: false, message: `取数失败(${code}):${message}` };\n }\n const text = extractTotal(result.value);\n if (text === null) return { ok: false, absent: false, message: '取数为空(不冒充正常)' };\n return { ok: true, text };\n}\n\n/** 技能功能页:sidebar槽里展开的干活区(查数调数,不管配置)。挂载期一次 RPC。 */\nfunction CalorieWork(props: { getCall: GetCall }): React.ReactElement {\n const [state, setState] = React.useState<PanelState>({ kind: 'loading' });\n React.useEffect(() => {\n let alive = true;\n const date = todayString();\n void (async () => {\n const r = await fetchRead(props.getCall(), DEFAULT_READ_KEY, { date });\n if (!alive) return;\n if (r.ok) setState({ kind: 'data', date, total: r.text });\n else if (r.absent) setState({ kind: 'absent', message: r.message });\n else setState({ kind: 'error', message: r.message });\n })();\n return () => {\n alive = false;\n };\n }, [props.getCall]);\n if (state.kind === 'loading') {\n return React.createElement('div', null, '卡路里加载中…');\n }\n if (state.kind === 'data') {\n return React.createElement(\n 'div',\n null,\n React.createElement('div', null, `卡路里 · ${state.date}`),\n React.createElement('div', null, `total ${state.total}`),\n );\n }\n return React.createElement('div', null, state.message);\n}\n\nfunction controlLabel(control: string): string {\n if (control === 'switch') return '开关(缺省启用,只读)';\n if (control === 'text') return '文本(只读)';\n if (control === 'number') return '数字(只读)';\n return `${control}(只读)`;\n}\n\n/** 技能设置页:爱生活页签条下的一页(只读设置行 + 状态读数,禁做假开关)。 */\nfunction CalorieConfig(props: { getCall: GetCall }): React.ReactElement {\n const [state, setState] = React.useState<PanelState>({ kind: 'loading' });\n React.useEffect(() => {\n let alive = true;\n const date = todayString();\n void (async () => {\n const r = await fetchRead(props.getCall(), DEFAULT_READ_KEY, { date });\n if (!alive) return;\n if (r.ok) setState({ kind: 'data', date, total: r.text });\n else if (r.absent) setState({ kind: 'absent', message: r.message });\n else setState({ kind: 'error', message: r.message });\n })();\n return () => {\n alive = false;\n };\n }, [props.getCall]);\n const status =\n state.kind === 'loading'\n ? '状态读取中…'\n : state.kind === 'data'\n ? `今日 ${state.date} · total ${state.total}`\n : state.message;\n return React.createElement(\n 'div',\n null,\n React.createElement('div', null, status),\n React.createElement(\n 'div',\n null,\n SETTING_ROWS.map((row) =>\n React.createElement('div', { key: row.key }, `${row.title} · ${controlLabel(row.control)}`),\n ),\n ),\n );\n}\n\ninterface BetterSidebarService {\n registerTab(descriptor: {\n readonly id: string;\n readonly title: string | (() => string);\n readonly order?: number;\n readonly single?: boolean;\n readonly component: (props: unknown) => React.ReactElement | null;\n }): () => void;\n}\n\nexport function apply(ctx: ClientCtx): void {\n // 调用口取用器透传给组件(每次取数现取;非函数由组件判缺席)。\n const getCall: GetCall = () => ctx.connection?.rpc?.call ?? null;\n\n // (a) 技能设置页 → 爱生活页签槽(总管声明;总管缺席时 inject 等待,不断链)。\n ctx.slots.inject('ilife.config-tab', () =>\n ctx.slots.register(\n {\n name: 'ilife.config-tab',\n id: 'dsh-calorie',\n order: 75,\n label: () => SLOT_TITLE,\n },\n () => React.createElement(CalorieConfig, { getCall }),\n ),\n );\n\n // (b) 技能功能页 → sidebar槽(软依赖:betterSidebar 缺席即跳过)。\n const ensureWorkTab = (): boolean => {\n try {\n const get = ctx.get;\n const bs = (typeof get === 'function' ? get('betterSidebar') : undefined) as BetterSidebarService | undefined;\n if (!bs || typeof bs.registerTab !== 'function') return false;\n const dispose = bs.registerTab({\n id: 'ilife-calorie:work',\n title: '卡路里',\n order: 61,\n single: true,\n component: () => React.createElement(CalorieWork, { getCall }),\n });\n ctx.effect(() => () => {\n try {\n dispose();\n } catch {\n /* 卸载清理失败忽略 */\n }\n }, 'dsh-calorie: sidebar work tab');\n return true;\n } catch {\n return false;\n }\n };\n if (!ensureWorkTab()) {\n let tries = 0;\n const timer = setInterval(() => {\n tries++;\n if (ensureWorkTab() || tries >= 10) clearInterval(timer);\n }, 1000);\n ctx.effect(() => () => {\n clearInterval(timer);\n }, 'dsh-calorie: sidebar work tab retry');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMA,MAAa,cAAc;EAC3B,MAAa,oBAAoB;;EAoCjC,MAAa,mBAAmB;;EAGhC,SAAgB,YAAY,KAAgC;GAC1D,IAAI,OAAO,QAAQ,YAAY,QAAQ,MAAM,OAAO;GACpD,MAAM,KAAM,IAAyB;GACrC,OAAO,OAAO,QAAQ,OAAO;EAC/B;;;ECvCA,MAAa,aAAa;;;;ECM1B,MAAa,eAAsC,CACjD;GAAE,KAAK;GAAW,OAAO;GAAW,SAAS;EAAS,CACxD;;;;;;;;;;;;;;;;;;ECEA,MAAa,SAAS,CAAC,OAAO;;EAY9B,SAAS,cAAsB;GAC7B,MAAM,oBA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AA+B;IACnC,IAAI;KACF,MAAM,MAAM,IAAI;KAChB,MAAM,KAAM,OAAO,QAAQ,aAAa,IAAI,eAAe,IAAI,KAAA;KAC/D,IAAI,CAAC,MAAM,OAAO,GAAG,gBAAgB,YAAY,OAAO;KACxD,MAAM,UAAU,GAAG,YAAY;MAC7B,IAAI;MACJ,OAAO;MACP,OAAO;MACP,QAAQ;MACR,iBAAiBA,MAAM,cAAc,aAAa,EAAE,QAAQ,CAAC;KAC/D,CAAC;KACD,IAAI,mBAAmB;MACrB,IAAI;OACF,QAAQ;MACV,QAAQ,CAER;KACF,GAAG,+BAA+B;KAClC,OAAO;IACT,QAAQ;KACN,OAAO;IACT;GACF;GACA,IAAI,CAAC,cAAc,GAAG;IACpB,IAAI,QAAQ;IACZ,MAAM,QAAQ,kBAAkB;KAC9B;KACA,IAAI,cAAc,KAAK,SAAS,IAAI,cAAc,KAAK;IACzD,GAAG,GAAI;IACP,IAAI,mBAAmB;KACrB,cAAc,KAAK;IACrB,GAAG,qCAAqC;GAC1C;EACF"}
|
|
1
|
+
{"version":3,"file":"client.js","names":["React"],"sources":["../src/contract.ts","../src/slot.ts","../src/settings.ts","../src/client.ts"],"sourcesContent":["/** dsh-calorie 端口(port):DSH 世界与卡路里 hexagon 之间的契约。\n *\n * browser 安全:零 node 导入。host 适配器(注册 RPC 通道)与 client\n * 适配器(调用 RPC)共用同一份定义;单测与 loader 回路以此为准。\n * 通道命名遵守宿主约束:单段且不等于 /api(见 cookbook「RPC 通道」)。\n */\nexport const RPC_CHANNEL = '/ilife-calorie' as const;\nexport const RPC_ENDPOINT_READ = 'read' as const;\n\n/** 读请求载荷:与技能 CLI 的 key/params 同形(见 skill-calorie SKILL.md)。 */\nexport interface ReadPayload {\n readonly key: string;\n readonly params: Record<string, unknown>;\n}\n\nexport interface RpcError {\n readonly code: string;\n readonly message: string;\n readonly details: Record<string, unknown>;\n}\n\nexport type RpcResult =\n | { readonly ok: true; readonly value: unknown }\n | { readonly ok: false; readonly error: RpcError };\n\nexport function ok(value: unknown): RpcResult {\n return { ok: true, value };\n}\n\nexport function fail(code: string, message: string): RpcResult {\n return { ok: false, error: { code, message, details: {} } };\n}\n\n/** 载荷校验:形状不对返回 null,由调用方按 bad-request 回绝(不抛)。 */\nexport function parseReadPayload(raw: unknown): ReadPayload | null {\n if (typeof raw !== 'object' || raw === null) return null;\n const { key, params } = raw as { key?: unknown; params?: unknown };\n if (typeof key !== 'string' || key.length === 0) return null;\n if (typeof params !== 'object' || params === null || Array.isArray(params)) return null;\n return { key, params: params as Record<string, unknown> };\n}\n\n/** 面板默认读键(与 HITL 一致性对比同键)。 */\nexport const DEFAULT_READ_KEY = 'calorie.view.home' as const;\n\n/** 信封守卫:供 client 拆包前校验(port 拥有信封定义,守卫住 port)。 */\nexport function isRpcResult(raw: unknown): raw is RpcResult {\n if (typeof raw !== 'object' || raw === null) return false;\n const ok = (raw as { ok?: unknown }).ok;\n return ok === true || ok === false;\n}\n","/** dsh-calorie 槽位描述(P10 脚手架,P3 #4 定案)。\n *\n * 写死槽位原生组件:id 命名空间 ilife:calorie,order 75。\n * 注册与打开只走 registerTab/openTab 的路径导航;子页后缀(如 ilife:calorie:*)\n * 只在主面板内导航,不占栏。缺席纯条件渲染,不轮询(本文件无定时器;\n * 有界重试归一由 base-render 拥有,单品不自建)。\n */\n\nexport const SKILL = 'calorie' as const;\nexport const SLOT_ID = 'ilife:calorie' as const;\nexport const SLOT_ORDER = 75 as const;\nexport const SLOT_TITLE = '卡路里' as const;\nexport const PLUGIN = 'dsh-calorie' as const;\nexport const MANAGER_PLUGIN = 'dsh-life-pack' as const;\nexport const SKILL_PACKAGE = 'skill-calorie' as const;\n\n/** 版本行唯一来源(面板展示用;smoke 断言与两处 package.json 一致,防漂移)。\n * 发版 bump 时同步改这里(与 package.json 同值)。 */\nexport const PLUGIN_VERSION = '0.1.6' as const;\nexport const SKILL_VERSION = '0.1.1' as const;\n\nexport interface SlotDescriptor {\n readonly skill: string;\n readonly slotId: string;\n readonly order: number;\n readonly title: string;\n readonly kind: 'page';\n}\n\nexport function slotDescriptor(): SlotDescriptor {\n return { skill: SKILL, slotId: SLOT_ID, order: SLOT_ORDER, title: SLOT_TITLE, kind: 'page' };\n}\n\n/** 写死原生组件描述(纯数据,无按需加载,无外嵌页)。 */\nexport const TAB_COMPONENT = { kind: 'native', name: 'CaloriePanel' } as const;\n\nexport interface TabsPort {\n hasTabs(): boolean;\n registerTab(entry: { readonly id: string; readonly title: string; readonly order: number; readonly single: boolean; readonly component: unknown }): () => void;\n openTab(seed: { readonly type: string; readonly path: string }, scope?: { readonly sessionId?: string }): void;\n}\n\n/** 自注册:幂等(调用方持 disposer),失败返回 false 由调用方决定重试。 */\nexport function registerSingle(port: TabsPort): (() => void) | null {\n if (!port.hasTabs()) return null;\n return port.registerTab({ id: SLOT_ID, title: SLOT_TITLE, order: SLOT_ORDER, single: true, component: TAB_COMPONENT });\n}\n\n/** 内容型打开:path seed,折叠面板自动展开。 */\nexport function openSingle(port: TabsPort, sessionId?: string): void {\n if (!port.hasTabs()) return;\n port.openTab({ type: SLOT_ID, path: SLOT_ID }, sessionId ? { sessionId } : undefined);\n}\n","/** dsh-calorie 设置页(P10 脚手架:设置页住单品包)。\n *\n * 一次 registerTab,两处呈现:边栏 + 号菜单多一项,DSH 设置页侧边卡片\n * 分区自动多一张小卡片(注册表驱动、无硬编码,开关缺省启用)。\n * 本文件只声明本单品自己的设置行;总管不声明设置(见 boundaries 断言)。\n */\n\nexport const SETTINGS_OWNER = 'dsh-calorie' as const;\nexport const SETTINGS_SLOT = 'ilife:calorie' as const;\n\nexport interface SettingRow {\n readonly key: string;\n readonly title: string;\n readonly control: 'switch' | 'text' | 'number';\n}\n\n/** 脚手架期唯一设置行:总开关(缺省启用,与官方关闭语义对齐)。 */\nexport const SETTING_ROWS: readonly SettingRow[] = [\n { key: 'enabled', title: '卡路里面板启用', control: 'switch' },\n];\n","/** dsh-calorie client 适配器(六边形:port=contract+dsh-ctx 镜像,adapter=本文件)。\n *\n * 产物经 tsdown 打成 loader 工厂包(browser/CJS,见 tsdown.config.ts)。\n * 本文件传递闭包:禁 node、禁 DOM 直写(document/window/process)。\n * 注册两处(grill 定案,新术语见 CONTEXT.md):\n * (a) 技能设置页 → 爱生活页签槽(总管声明的 children,各技能自研自家配置页);\n * (b) 技能功能页 → sidebar槽(better-sidebar 服务,非 DSH slot;软依赖,\n * 缺席即跳过,不断链。DSH右侧槽 + sidebar.footer.action 彻底出局,已删)。\n * 有界重试例外依据(唯一允许的定时器):注册重试非数据轮询,照抄\n * dsh-mattpocock-skills-deck/src/client/panelAssembly.js:100-108\n * (betterSidebar 服务可能晚于本模块到达,最多 10 次、间隔 1000ms;卸载清理)。\n * 样式:React 内联 style + DSH 主题别名(var(--dsw-alias-*),带回退),无外部样式表、\n * 无 <style> 注入、无类名冲突;只用 dsh-ctx 镜像内成员(slots.inject/register、\n * connection.rpc.call 经闭包现取、betterSidebar 经 ctx.get 运行时取);\n * 取数只经 connection.rpc.call 进 host 通道;缺席/错误纯条件渲染,不返空冒充。\n * 组件 React.createElement 手写,不引入 JSX。\n */\nimport * as React from 'react';\nimport { RPC_CHANNEL, RPC_ENDPOINT_READ, DEFAULT_READ_KEY, isRpcResult } from './contract.js';\nimport { SLOT_TITLE, PLUGIN, SKILL_PACKAGE, PLUGIN_VERSION, SKILL_VERSION } from './slot.js';\nimport { SETTING_ROWS } from './settings.js';\nimport type { ClientCtx, RpcCallResult } from './dsh-ctx.js';\n\nexport const inject = ['slots'];\n\n/** 调用口取用器:每次取数时现取(connection 后到也不永久缺席)。 */\nexport type GetCall = () => unknown;\n\n/** 面板视觉(内联 style;颜色走 DSH 主题别名,深浅主题自适应,写死值只做回退)。 */\nconst S = {\n card: {\n padding: '12px 14px',\n borderRadius: 10,\n border: '1px solid var(--dsw-alias-border, rgba(128,128,128,.35))',\n background: 'var(--dsw-alias-bg-base, transparent)',\n color: 'var(--dsw-alias-label-primary, inherit)',\n fontSize: 13,\n lineHeight: 1.6,\n } as React.CSSProperties,\n title: { fontSize: 14, fontWeight: 700, marginBottom: 8 } as React.CSSProperties,\n total: { fontSize: 22, fontWeight: 700, margin: '2px 0 4px' } as React.CSSProperties,\n muted: { color: 'var(--dsw-alias-label-secondary, #9a9a9a)', fontSize: 12 } as React.CSSProperties,\n error: { color: 'var(--dsw-alias-state-error-primary, #ff6b6b)', fontSize: 13 } as React.CSSProperties,\n rows: { marginTop: 8, borderTop: '1px solid var(--dsw-alias-border, rgba(128,128,128,.25))', paddingTop: 8 } as React.CSSProperties,\n version: {\n marginTop: 8,\n paddingTop: 8,\n borderTop: '1px dashed var(--dsw-alias-border, rgba(128,128,128,.25))',\n color: 'var(--dsw-alias-label-tertiary, #8a8a8a)',\n fontSize: 12,\n } as React.CSSProperties,\n};\n\n/** 版本行:插件与技能双版本号(用户要求:每技能设置页自报家门)。 */\nfunction VersionLine(): React.ReactElement {\n return React.createElement('div', { style: S.version }, `${PLUGIN} ${PLUGIN_VERSION} · ${SKILL_PACKAGE} ${SKILL_VERSION}`);\n}\n\ntype PanelState =\n | { readonly kind: 'loading' }\n | { readonly kind: 'data'; readonly date: string; readonly total: string }\n | { readonly kind: 'absent'; readonly message: string }\n | { readonly kind: 'error'; readonly message: string };\n\n/** 本地今日 YYYY-MM-DD(与面板默认读键的 date 参数同形)。 */\nfunction todayString(): string {\n const d = new Date();\n const m = String(d.getMonth() + 1).padStart(2, '0');\n const day = String(d.getDate()).padStart(2, '0');\n return `${d.getFullYear()}-${m}-${day}`;\n}\n\n/** 数据态取值:有 total 显示 total,有值无 total 显示原值 JSON,空值返回 null(由调用方进错误态)。 */\nfunction extractTotal(value: unknown): string | null {\n if (value === null || value === undefined) return null;\n if (typeof value === 'string') return value.length > 0 ? value : null;\n if (typeof value === 'object') {\n const total = (value as { total?: unknown }).total;\n if (total !== null && total !== undefined) return String(total);\n try {\n return JSON.stringify(value);\n } catch {\n return null;\n }\n }\n return String(value);\n}\n\ntype ReadOutcome =\n | { readonly ok: true; readonly text: string }\n | { readonly ok: false; readonly absent: boolean; readonly message: string };\n\n/** 请求超时毫秒:与 host 侧 SPAWN_TIMEOUT_MS 同级,UI 永不无限转圈。 */\nconst READ_TIMEOUT_MS = 20_000 as const;\n\n/** 自家赛跑超时(有界:settle 即清 timer;不依赖传输是否搭理 AbortSignal——Desktop 自研传输会忽略 signal)。\n * 注释即 p10 有界重试门要的例外依据(文件内另有 clearTimeout/tries 上限/本注释三件套)。 */\nfunction withTimeout<T>(promise: Promise<T>, ms: number): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const limit = new Promise<never>((_, reject) => {\n timer = setTimeout(() => {\n timer = undefined;\n const e = new Error(`取数超时(${Math.round(ms / 1000)}s):宿主未回,先查宿主日志与 DB 环境`);\n e.name = 'TimeoutError';\n reject(e);\n }, ms);\n });\n return Promise.race([\n promise.finally(() => {\n if (timer !== undefined) clearTimeout(timer);\n }),\n limit,\n ]);\n}\n\n/** 单次读数(纯异步函数,无 hook;挂载期调用一次,无轮询)。 */\nasync function fetchRead(call: unknown, key: string, params: Record<string, unknown>): Promise<ReadOutcome> {\n // extractRpc 同式守卫:非函数即缺席态。\n if (typeof call !== 'function') return { ok: false, absent: true, message: '宿主连接缺席:connection.rpc.call 不可用' };\n let result: RpcCallResult;\n try {\n // 防御纵深 + 自家超时双保险(AbortSignal 帮正规传输提前收工;race 保传输忽略 signal 时仍落字)。\n const raw: unknown = await withTimeout(\n call(RPC_CHANNEL, RPC_ENDPOINT_READ, { key, params }, AbortSignal.timeout(READ_TIMEOUT_MS)),\n READ_TIMEOUT_MS,\n );\n if (!isRpcResult(raw)) return { ok: false, absent: false, message: '回执信封异常(非 ok 信封)' };\n result = raw;\n } catch (e) {\n if (e instanceof Error && e.name === 'AbortError') return { ok: false, absent: false, message: '取数超时(20s):宿主未回,先查宿主日志与 DB 环境' };\n return { ok: false, absent: false, message: `取数失败:${e instanceof Error ? e.message : String(e)}` };\n }\n if (!result.ok) {\n const code = result.error?.code ?? 'unknown';\n const message = result.error?.message ?? '';\n if (code === 'missing-cli') return { ok: false, absent: true, message: `技能出口缺席(missing-cli):${message}` };\n return { ok: false, absent: false, message: `取数失败(${code}):${message}` };\n }\n const text = extractTotal(result.value);\n if (text === null) return { ok: false, absent: false, message: '取数为空(不冒充正常)' };\n return { ok: true, text };\n}\n\n/** 技能功能页:sidebar槽里展开的干活区(查数调数,不管配置)。挂载期一次 RPC。 */\nfunction CalorieWork(props: { getCall: GetCall }): React.ReactElement {\n const [state, setState] = React.useState<PanelState>({ kind: 'loading' });\n React.useEffect(() => {\n let alive = true;\n const date = todayString();\n void (async () => {\n const r = await fetchRead(props.getCall(), DEFAULT_READ_KEY, { date });\n if (!alive) return;\n if (r.ok) setState({ kind: 'data', date, total: r.text });\n else if (r.absent) setState({ kind: 'absent', message: r.message });\n else setState({ kind: 'error', message: r.message });\n })();\n return () => {\n alive = false;\n };\n }, [props.getCall]);\n if (state.kind === 'loading') {\n return React.createElement('div', { style: S.card }, React.createElement('div', { style: S.muted }, '卡路里加载中…'));\n }\n if (state.kind === 'data') {\n return React.createElement(\n 'div',\n { style: S.card },\n React.createElement('div', { style: S.title }, `卡路里 · ${state.date}`),\n React.createElement('div', { style: S.total }, `total ${state.total}`),\n React.createElement(VersionLine, null),\n );\n }\n return React.createElement(\n 'div',\n { style: S.card },\n React.createElement('div', { style: state.kind === 'absent' ? S.muted : S.error }, state.message),\n React.createElement(VersionLine, null),\n );\n}\n\nfunction controlLabel(control: string): string {\n if (control === 'switch') return '开关(缺省启用,只读)';\n if (control === 'text') return '文本(只读)';\n if (control === 'number') return '数字(只读)';\n return `${control}(只读)`;\n}\n\n/** 技能设置页:爱生活页签条下的一页(只读设置行 + 状态读数 + 版本行,禁做假开关)。 */\nfunction CalorieConfig(props: { getCall: GetCall }): React.ReactElement {\n const [state, setState] = React.useState<PanelState>({ kind: 'loading' });\n React.useEffect(() => {\n let alive = true;\n const date = todayString();\n void (async () => {\n const r = await fetchRead(props.getCall(), DEFAULT_READ_KEY, { date });\n if (!alive) return;\n if (r.ok) setState({ kind: 'data', date, total: r.text });\n else if (r.absent) setState({ kind: 'absent', message: r.message });\n else setState({ kind: 'error', message: r.message });\n })();\n return () => {\n alive = false;\n };\n }, [props.getCall]);\n const status =\n state.kind === 'loading'\n ? React.createElement('div', { style: S.muted }, '状态读取中…')\n : state.kind === 'data'\n ? React.createElement(\n 'div',\n null,\n React.createElement('div', { style: S.title }, SLOT_TITLE),\n React.createElement('div', { style: S.total }, `total ${state.total}`),\n React.createElement('div', { style: S.muted }, `今日 ${state.date}`),\n )\n : React.createElement('div', { style: state.kind === 'absent' ? S.muted : S.error }, state.message);\n return React.createElement(\n 'div',\n { style: S.card },\n status,\n React.createElement(\n 'div',\n { style: S.rows },\n SETTING_ROWS.map((row) =>\n React.createElement('div', { key: row.key }, `${row.title} · ${controlLabel(row.control)}`),\n ),\n ),\n React.createElement(VersionLine, null),\n );\n}\n\ninterface BetterSidebarService {\n registerTab(descriptor: {\n readonly id: string;\n readonly title: string | (() => string);\n readonly order?: number;\n readonly single?: boolean;\n readonly component: (props: unknown) => React.ReactElement | null;\n }): () => void;\n}\n\nexport function apply(ctx: ClientCtx): void {\n // 调用口取用器透传给组件(每次取数现取;非函数由组件判缺席)。\n const getCall: GetCall = () => ctx.connection?.rpc?.call ?? null;\n\n // (a) 技能设置页 → 爱生活页签槽(总管声明;总管缺席时 inject 等待,不断链)。\n ctx.slots.inject('ilife.config-tab', () =>\n ctx.slots.register(\n {\n name: 'ilife.config-tab',\n id: 'dsh-calorie',\n order: 75,\n label: () => SLOT_TITLE,\n },\n () => React.createElement(CalorieConfig, { getCall }),\n ),\n );\n\n // (b) 技能功能页 → sidebar槽(软依赖:betterSidebar 缺席即跳过)。\n const ensureWorkTab = (): boolean => {\n try {\n const get = ctx.get;\n const bs = (typeof get === 'function' ? get('betterSidebar') : undefined) as BetterSidebarService | undefined;\n if (!bs || typeof bs.registerTab !== 'function') return false;\n const dispose = bs.registerTab({\n id: 'ilife-calorie:work',\n title: '卡路里',\n order: 61,\n single: true,\n component: () => React.createElement(CalorieWork, { getCall }),\n });\n ctx.effect(() => () => {\n try {\n dispose();\n } catch {\n /* 卸载清理失败忽略 */\n }\n }, 'dsh-calorie: sidebar work tab');\n return true;\n } catch {\n return false;\n }\n };\n if (!ensureWorkTab()) {\n let tries = 0;\n const timer = setInterval(() => {\n tries++;\n if (ensureWorkTab() || tries >= 10) clearInterval(timer);\n }, 1000);\n ctx.effect(() => () => {\n clearInterval(timer);\n }, 'dsh-calorie: sidebar work tab retry');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMA,MAAa,cAAc;EAC3B,MAAa,oBAAoB;;EAoCjC,MAAa,mBAAmB;;EAGhC,SAAgB,YAAY,KAAgC;GAC1D,IAAI,OAAO,QAAQ,YAAY,QAAQ,MAAM,OAAO;GACpD,MAAM,KAAM,IAAyB;GACrC,OAAO,OAAO,QAAQ,OAAO;EAC/B;;;ECvCA,MAAa,aAAa;EAC1B,MAAa,SAAS;EAEtB,MAAa,gBAAgB;;;EAI7B,MAAa,iBAAiB;EAC9B,MAAa,gBAAgB;;;;ECF7B,MAAa,eAAsC,CACjD;GAAE,KAAK;GAAW,OAAO;GAAW,SAAS;EAAS,CACxD;;;;;;;;;;;;;;;;;;;;ECIA,MAAa,SAAS,CAAC,OAAO;;EAM9B,MAAM,IAAI;GACR,MAAM;IACJ,SAAS;IACT,cAAc;IACd,QAAQ;IACR,YAAY;IACZ,OAAO;IACP,UAAU;IACV,YAAY;GACd;GACA,OAAO;IAAE,UAAU;IAAI,YAAY;IAAK,cAAc;GAAE;GACxD,OAAO;IAAE,UAAU;IAAI,YAAY;IAAK,QAAQ;GAAY;GAC5D,OAAO;IAAE,OAAO;IAA6C,UAAU;GAAG;GAC1E,OAAO;IAAE,OAAO;IAAiD,UAAU;GAAG;GAC9E,MAAM;IAAE,WAAW;IAAG,WAAW;IAA4D,YAAY;GAAE;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;GAG5D,IAAI,MAAM,OAAO,0BACf,IAAI,MAAM,SACR;IACE,MAAM;IACN,IAAI;IACJ,OAAO;IACP,aAAa;GACf,SACMA,MAAM,cAAc,eAAe,EAAE,QAAQ,CAAC,CACtD,CACF;GAGA,MAAM,sBAA+B;IACnC,IAAI;KACF,MAAM,MAAM,IAAI;KAChB,MAAM,KAAM,OAAO,QAAQ,aAAa,IAAI,eAAe,IAAI,KAAA;KAC/D,IAAI,CAAC,MAAM,OAAO,GAAG,gBAAgB,YAAY,OAAO;KACxD,MAAM,UAAU,GAAG,YAAY;MAC7B,IAAI;MACJ,OAAO;MACP,OAAO;MACP,QAAQ;MACR,iBAAiBA,MAAM,cAAc,aAAa,EAAE,QAAQ,CAAC;KAC/D,CAAC;KACD,IAAI,mBAAmB;MACrB,IAAI;OACF,QAAQ;MACV,QAAQ,CAER;KACF,GAAG,+BAA+B;KAClC,OAAO;IACT,QAAQ;KACN,OAAO;IACT;GACF;GACA,IAAI,CAAC,cAAc,GAAG;IACpB,IAAI,QAAQ;IACZ,MAAM,QAAQ,kBAAkB;KAC9B;KACA,IAAI,cAAc,KAAK,SAAS,IAAI,cAAc,KAAK;IACzD,GAAG,GAAI;IACP,IAAI,mBAAmB;KACrB,cAAc,KAAK;IACrB,GAAG,qCAAqC;GAC1C;EACF"}
|
package/dist/slot.d.ts
CHANGED
|
@@ -11,6 +11,11 @@ export declare const SLOT_ORDER: 75;
|
|
|
11
11
|
export declare const SLOT_TITLE: "\u5361\u8DEF\u91CC";
|
|
12
12
|
export declare const PLUGIN: "dsh-calorie";
|
|
13
13
|
export declare const MANAGER_PLUGIN: "dsh-life-pack";
|
|
14
|
+
export declare const SKILL_PACKAGE: "skill-calorie";
|
|
15
|
+
/** 版本行唯一来源(面板展示用;smoke 断言与两处 package.json 一致,防漂移)。
|
|
16
|
+
* 发版 bump 时同步改这里(与 package.json 同值)。 */
|
|
17
|
+
export declare const PLUGIN_VERSION: "0.1.6";
|
|
18
|
+
export declare const SKILL_VERSION: "0.1.1";
|
|
14
19
|
export interface SlotDescriptor {
|
|
15
20
|
readonly skill: string;
|
|
16
21
|
readonly slotId: string;
|
package/dist/slot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../src/slot.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,KAAK,EAAG,SAAkB,CAAC;AACxC,eAAO,MAAM,OAAO,EAAG,eAAwB,CAAC;AAChD,eAAO,MAAM,UAAU,EAAG,EAAW,CAAC;AACtC,eAAO,MAAM,UAAU,EAAG,oBAAc,CAAC;AACzC,eAAO,MAAM,MAAM,EAAG,aAAsB,CAAC;AAC7C,eAAO,MAAM,cAAc,EAAG,eAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../src/slot.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,KAAK,EAAG,SAAkB,CAAC;AACxC,eAAO,MAAM,OAAO,EAAG,eAAwB,CAAC;AAChD,eAAO,MAAM,UAAU,EAAG,EAAW,CAAC;AACtC,eAAO,MAAM,UAAU,EAAG,oBAAc,CAAC;AACzC,eAAO,MAAM,MAAM,EAAG,aAAsB,CAAC;AAC7C,eAAO,MAAM,cAAc,EAAG,eAAwB,CAAC;AACvD,eAAO,MAAM,aAAa,EAAG,eAAwB,CAAC;AAEtD;wCACwC;AACxC,eAAO,MAAM,cAAc,EAAG,OAAgB,CAAC;AAC/C,eAAO,MAAM,aAAa,EAAG,OAAgB,CAAC;AAE9C,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,cAAc,IAAI,cAAc,CAE/C;AAED,gCAAgC;AAChC,eAAO,MAAM,aAAa;;;CAAoD,CAAC;AAE/E,MAAM,WAAW,QAAQ;IACvB,OAAO,IAAI,OAAO,CAAC;IACnB,WAAW,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;KAAE,GAAG,MAAM,IAAI,CAAC;IAC/J,OAAO,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAChH;AAED,iDAAiD;AACjD,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAGlE;AAED,gCAAgC;AAChC,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAGnE"}
|
package/dist/slot.js
CHANGED
|
@@ -11,6 +11,11 @@ export const SLOT_ORDER = 75;
|
|
|
11
11
|
export const SLOT_TITLE = '卡路里';
|
|
12
12
|
export const PLUGIN = 'dsh-calorie';
|
|
13
13
|
export const MANAGER_PLUGIN = 'dsh-life-pack';
|
|
14
|
+
export const SKILL_PACKAGE = 'skill-calorie';
|
|
15
|
+
/** 版本行唯一来源(面板展示用;smoke 断言与两处 package.json 一致,防漂移)。
|
|
16
|
+
* 发版 bump 时同步改这里(与 package.json 同值)。 */
|
|
17
|
+
export const PLUGIN_VERSION = '0.1.6';
|
|
18
|
+
export const SKILL_VERSION = '0.1.1';
|
|
14
19
|
export function slotDescriptor() {
|
|
15
20
|
return { skill: SKILL, slotId: SLOT_ID, order: SLOT_ORDER, title: SLOT_TITLE, kind: 'page' };
|
|
16
21
|
}
|
package/dist/slot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot.js","sourceRoot":"","sources":["../src/slot.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,KAAK,GAAG,SAAkB,CAAC;AACxC,MAAM,CAAC,MAAM,OAAO,GAAG,eAAwB,CAAC;AAChD,MAAM,CAAC,MAAM,UAAU,GAAG,EAAW,CAAC;AACtC,MAAM,CAAC,MAAM,UAAU,GAAG,KAAc,CAAC;AACzC,MAAM,CAAC,MAAM,MAAM,GAAG,aAAsB,CAAC;AAC7C,MAAM,CAAC,MAAM,cAAc,GAAG,eAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"slot.js","sourceRoot":"","sources":["../src/slot.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,KAAK,GAAG,SAAkB,CAAC;AACxC,MAAM,CAAC,MAAM,OAAO,GAAG,eAAwB,CAAC;AAChD,MAAM,CAAC,MAAM,UAAU,GAAG,EAAW,CAAC;AACtC,MAAM,CAAC,MAAM,UAAU,GAAG,KAAc,CAAC;AACzC,MAAM,CAAC,MAAM,MAAM,GAAG,aAAsB,CAAC;AAC7C,MAAM,CAAC,MAAM,cAAc,GAAG,eAAwB,CAAC;AACvD,MAAM,CAAC,MAAM,aAAa,GAAG,eAAwB,CAAC;AAEtD;wCACwC;AACxC,MAAM,CAAC,MAAM,cAAc,GAAG,OAAgB,CAAC;AAC/C,MAAM,CAAC,MAAM,aAAa,GAAG,OAAgB,CAAC;AAU9C,MAAM,UAAU,cAAc;IAC5B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO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