@lmzhen/dsh-evolution-client-kit 0.49.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +32 -6
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.js +2 -0
- package/lib/types/platform-ui.d.ts +11 -0
- package/lib/types/platform-ui.js +23 -0
- package/lib/types/presentation/action-menu.js +3 -2
- package/lib/types/register-surface.d.ts +17 -0
- package/lib/types/register-surface.js +9 -0
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -3,10 +3,7 @@ import { FALLBACKS } from "./generated/fallbacks.generated.js";
|
|
|
3
3
|
import "./generated/contracts.generated.js";
|
|
4
4
|
import { Block, FailureBlock, failureText, loadStateOf } from "./generated/states.generated.js";
|
|
5
5
|
import { TOKENS, TOKEN_CSS, tokenVars } from "./tokens.js";
|
|
6
|
-
import { createRequire } from "node:module";
|
|
7
6
|
import { createElement } from "react";
|
|
8
|
-
//#region \0rolldown/runtime.js
|
|
9
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
10
7
|
function interpolate(text, values) {
|
|
11
8
|
if (values === void 0) return text;
|
|
12
9
|
return text.replace(/\{(\w+)\}/g, (_match, key) => String(values[key] ?? ""));
|
|
@@ -121,6 +118,12 @@ function registerWorkbenchView(ctx, spec) {
|
|
|
121
118
|
});
|
|
122
119
|
}
|
|
123
120
|
//#endregion
|
|
121
|
+
//#region lib/types/register-surface.js
|
|
122
|
+
function registerSurface(ctx, spec) {
|
|
123
|
+
if (spec.surface === "sidebar") registerSidebarPanel(ctx, spec);
|
|
124
|
+
else registerWorkbenchView(ctx, spec);
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
124
127
|
//#region lib/types/workspace.js
|
|
125
128
|
/**
|
|
126
129
|
* Best-effort workspace id; a seat that is absent or refuses leaves the panel in local scope.
|
|
@@ -137,6 +140,29 @@ function panelWorkspaceId(ctx) {
|
|
|
137
140
|
} catch {}
|
|
138
141
|
}
|
|
139
142
|
//#endregion
|
|
143
|
+
//#region lib/types/platform-ui.js
|
|
144
|
+
/**
|
|
145
|
+
* The ONE door to the platform's client primitive module row.
|
|
146
|
+
*
|
|
147
|
+
* Browser bundles keep `@deepseek-ai/dsh-client-ui-primitives` external and the
|
|
148
|
+
* loader's `require` is the only way to reach it. Every family panel asks this
|
|
149
|
+
* module, so a platform row rename is one change instead of one per panel.
|
|
150
|
+
*/
|
|
151
|
+
const PLATFORM_UI_MODULE = "@deepseek-ai/dsh-client-ui-primitives";
|
|
152
|
+
/** The loader injects its synchronous require onto the page before factory bodies run. */
|
|
153
|
+
function clientRequire() {
|
|
154
|
+
return globalThis.__dshClientRequire;
|
|
155
|
+
}
|
|
156
|
+
/** The module row, or undefined in a deployment that does not compose it. */
|
|
157
|
+
function platformUiModule() {
|
|
158
|
+
try {
|
|
159
|
+
const row = clientRequire()?.(PLATFORM_UI_MODULE);
|
|
160
|
+
return typeof row === "object" && row !== null ? row : void 0;
|
|
161
|
+
} catch {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
140
166
|
//#region lib/types/format.js
|
|
141
167
|
/** Parse an ISO string, epoch ms, or null into a valid Date; null when absent/invalid. */
|
|
142
168
|
function toLocalDate(value) {
|
|
@@ -290,7 +316,6 @@ const RESPONSIVE_TABLE_CSS = [
|
|
|
290
316
|
* The one seam onto the platform's menu material, plus a small fallback for deployments
|
|
291
317
|
* without the primitive row. No page owns a second menu implementation.
|
|
292
318
|
*/
|
|
293
|
-
const PLATFORM_UI_MODULE = "@deepseek-ai/dsh-client-ui-primitives";
|
|
294
319
|
/**
|
|
295
320
|
* Render the platform menu directly. Kept exported for callers that already own the primitive row.
|
|
296
321
|
* @param primitives - platform MenuSurface/MenuItemButton pair.
|
|
@@ -334,7 +359,8 @@ function menuPrimitivesFrom(row) {
|
|
|
334
359
|
/** The module-table row, when this deployment carries it. */
|
|
335
360
|
const PLATFORM_MENU = (() => {
|
|
336
361
|
try {
|
|
337
|
-
|
|
362
|
+
const row = platformUiModule();
|
|
363
|
+
return row === void 0 ? void 0 : menuPrimitivesFrom(row);
|
|
338
364
|
} catch {
|
|
339
365
|
return;
|
|
340
366
|
}
|
|
@@ -351,4 +377,4 @@ const PAGE_SURFACE_CLASS = "evolution-page-surface";
|
|
|
351
377
|
/** Stylesheet for {@link PAGE_SURFACE_CLASS}; consumers append it to their own CSS. */
|
|
352
378
|
const PAGE_SURFACE_CSS = ".evolution-page-surface{min-height:100%;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary)}";
|
|
353
379
|
//#endregion
|
|
354
|
-
export { Block, DecisionFrame, EmptyState, FALLBACKS, FailureBlock, PAGE_SURFACE_CLASS, PAGE_SURFACE_CSS, PLATFORM_MENU, RESPONSIVE_TABLE_CSS, ROUTES, TOKENS, TOKEN_CSS, TaskBanner, bindLocale, failureText, fillTemplate, formatLocalClock, formatLocalDateTime, injectPluginStyles, isSameLocalDay, loadStateOf, menuPrimitivesFrom, panelWorkspaceId, registerSidebarPanel, registerWorkbenchView, renderPlatformMenu, requireClientSeats, tokenVars };
|
|
380
|
+
export { Block, DecisionFrame, EmptyState, FALLBACKS, FailureBlock, PAGE_SURFACE_CLASS, PAGE_SURFACE_CSS, PLATFORM_MENU, PLATFORM_UI_MODULE, RESPONSIVE_TABLE_CSS, ROUTES, TOKENS, TOKEN_CSS, TaskBanner, bindLocale, failureText, fillTemplate, formatLocalClock, formatLocalDateTime, injectPluginStyles, isSameLocalDay, loadStateOf, menuPrimitivesFrom, panelWorkspaceId, platformUiModule, registerSidebarPanel, registerSurface, registerWorkbenchView, renderPlatformMenu, requireClientSeats, tokenVars };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/** Shared browser seams and panel lifecycle for the evolution family. */
|
|
2
2
|
export type { ClientSeam, ConfigFormLike, ConfigFormSnapshotLike, ConfigFormsSeat, ConfigPathOpLike, ConfigWriteKind, ConfigWriteOutcome, LocaleSeat, PanelBodyOptions, PanelRowOptions, SettingsFace, SlotsSeat } from './seam.ts';
|
|
3
3
|
export { registerSidebarPanel, requireClientSeats, type SidebarPanelSpec, type Translate } from './panel.ts';
|
|
4
|
+
export { registerSurface, type SurfaceSpec } from './register-surface.ts';
|
|
4
5
|
export { registerWorkbenchView } from './workbench-view.ts';
|
|
5
6
|
export type { WorkbenchViewSpec } from './workbench-view.ts';
|
|
6
7
|
export { panelWorkspaceId } from './workspace.ts';
|
|
8
|
+
export { PLATFORM_UI_MODULE, platformUiModule } from './platform-ui.ts';
|
|
7
9
|
export { formatLocalClock, formatLocalDateTime, isSameLocalDay, type LocalDateTimeOptions } from './format.ts';
|
|
8
10
|
export { DecisionFrame, type DecisionFrameProps } from './presentation/decision-frame.ts';
|
|
9
11
|
export { TaskBanner, type TaskBannerProps } from './presentation/task-banner.ts';
|
package/lib/types/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { registerSidebarPanel, requireClientSeats } from "./panel.js";
|
|
2
|
+
export { registerSurface } from "./register-surface.js";
|
|
2
3
|
export { registerWorkbenchView } from "./workbench-view.js";
|
|
3
4
|
export { panelWorkspaceId } from "./workspace.js";
|
|
5
|
+
export { PLATFORM_UI_MODULE, platformUiModule } from "./platform-ui.js";
|
|
4
6
|
export { formatLocalClock, formatLocalDateTime, isSameLocalDay } from "./format.js";
|
|
5
7
|
export { DecisionFrame } from "./presentation/decision-frame.js";
|
|
6
8
|
export { TaskBanner } from "./presentation/task-banner.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE door to the platform's client primitive module row.
|
|
3
|
+
*
|
|
4
|
+
* Browser bundles keep `@deepseek-ai/dsh-client-ui-primitives` external and the
|
|
5
|
+
* loader's `require` is the only way to reach it. Every family panel asks this
|
|
6
|
+
* module, so a platform row rename is one change instead of one per panel.
|
|
7
|
+
*/
|
|
8
|
+
export declare const PLATFORM_UI_MODULE = "@deepseek-ai/dsh-client-ui-primitives";
|
|
9
|
+
/** The module row, or undefined in a deployment that does not compose it. */
|
|
10
|
+
export declare function platformUiModule(): Record<string, unknown> | undefined;
|
|
11
|
+
//# sourceMappingURL=platform-ui.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE door to the platform's client primitive module row.
|
|
3
|
+
*
|
|
4
|
+
* Browser bundles keep `@deepseek-ai/dsh-client-ui-primitives` external and the
|
|
5
|
+
* loader's `require` is the only way to reach it. Every family panel asks this
|
|
6
|
+
* module, so a platform row rename is one change instead of one per panel.
|
|
7
|
+
*/
|
|
8
|
+
export const PLATFORM_UI_MODULE = '@deepseek-ai/dsh-client-ui-primitives';
|
|
9
|
+
/** The loader injects its synchronous require onto the page before factory bodies run. */
|
|
10
|
+
function clientRequire() {
|
|
11
|
+
return globalThis.__dshClientRequire;
|
|
12
|
+
}
|
|
13
|
+
/** The module row, or undefined in a deployment that does not compose it. */
|
|
14
|
+
export function platformUiModule() {
|
|
15
|
+
try {
|
|
16
|
+
const row = clientRequire()?.(PLATFORM_UI_MODULE);
|
|
17
|
+
return typeof row === 'object' && row !== null ? row : undefined;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=platform-ui.js.map
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* without the primitive row. No page owns a second menu implementation.
|
|
4
4
|
*/
|
|
5
5
|
import { createElement } from 'react';
|
|
6
|
-
|
|
6
|
+
import { platformUiModule } from "../platform-ui.js";
|
|
7
7
|
/**
|
|
8
8
|
* Render the platform menu directly. Kept exported for callers that already own the primitive row.
|
|
9
9
|
* @param primitives - platform MenuSurface/MenuItemButton pair.
|
|
@@ -43,7 +43,8 @@ export function menuPrimitivesFrom(row) {
|
|
|
43
43
|
export const PLATFORM_MENU = (() => {
|
|
44
44
|
try {
|
|
45
45
|
// oxlint-disable-next-line typescript/no-require-imports -- the client module table is reachable only through the loader's require
|
|
46
|
-
|
|
46
|
+
const row = platformUiModule();
|
|
47
|
+
return row === undefined ? undefined : menuPrimitivesFrom(row);
|
|
47
48
|
}
|
|
48
49
|
catch {
|
|
49
50
|
return undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One registration verb for the family's client surfaces.
|
|
3
|
+
*
|
|
4
|
+
* Sidebar panels and workbench views keep their own seat implementations, but
|
|
5
|
+
* feature packages call this single verb so a new surface kind cannot grow a
|
|
6
|
+
* second registration style.
|
|
7
|
+
*/
|
|
8
|
+
import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
9
|
+
import { type SidebarPanelSpec } from './panel.ts';
|
|
10
|
+
import { type WorkbenchViewSpec } from './workbench-view.ts';
|
|
11
|
+
export type SurfaceSpec<Face> = ({
|
|
12
|
+
readonly surface: 'sidebar';
|
|
13
|
+
} & SidebarPanelSpec<Face>) | ({
|
|
14
|
+
readonly surface: 'workbench';
|
|
15
|
+
} & WorkbenchViewSpec<Face>);
|
|
16
|
+
export declare function registerSurface<Face>(ctx: ClientContext, spec: SurfaceSpec<Face>): void;
|
|
17
|
+
//# sourceMappingURL=register-surface.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { registerSidebarPanel } from "./panel.js";
|
|
2
|
+
import { registerWorkbenchView } from "./workbench-view.js";
|
|
3
|
+
export function registerSurface(ctx, spec) {
|
|
4
|
+
if (spec.surface === 'sidebar')
|
|
5
|
+
registerSidebarPanel(ctx, spec);
|
|
6
|
+
else
|
|
7
|
+
registerWorkbenchView(ctx, spec);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=register-surface.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-client-kit",
|
|
3
3
|
"description": "Shared browser seams and lifecycle for the evolution family sidebar panels (community build)",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.50.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -83,6 +83,6 @@
|
|
|
83
83
|
"react": "^18.2.0"
|
|
84
84
|
},
|
|
85
85
|
"engines": {
|
|
86
|
-
"dsh": ">=0.2.2-rc.
|
|
86
|
+
"dsh": ">=0.2.2-rc.3 <0.2.3-0"
|
|
87
87
|
}
|
|
88
88
|
}
|