@lmzhen/dsh-evolution-client-kit 0.32.3 → 0.32.4

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 CHANGED
@@ -10,7 +10,7 @@ function interpolate(text, values) {
10
10
  }
11
11
  function injectStyles(doc, css, tagId) {
12
12
  if (doc === void 0) return () => {};
13
- if (doc.querySelector("style[data-plugin-css=\"" + tagId + "\"]") !== null) return () => {};
13
+ doc.querySelector("style[data-plugin-css=\"" + tagId + "\"]")?.remove();
14
14
  const tag = doc.createElement("style");
15
15
  tag.setAttribute("data-plugin-css", tagId);
16
16
  tag.textContent = css;
@@ -1,5 +1,5 @@
1
1
  /** Shared browser seams and panel lifecycle for the evolution family. */
2
- export type { ClientSeam, ConfigFormLike, ConfigFormSnapshotLike, ConfigFormsSeat, LocaleSeat, PanelBodyOptions, PanelRowOptions, SettingsFace, SlotsSeat } from './seam.ts';
2
+ export type { ClientSeam, ConfigFormLike, ConfigFormSnapshotLike, ConfigFormsSeat, ConfigPathOpLike, LocaleSeat, PanelBodyOptions, PanelRowOptions, SettingsFace, SlotsSeat } from './seam.ts';
3
3
  export { registerSidebarPanel, type SidebarPanelSpec, type Translate } from './panel.ts';
4
4
  export { panelWorkspaceId } from './workspace.ts';
5
5
  export { ROUTES } from './generated/routes.generated.ts';
@@ -6,8 +6,10 @@ function interpolate(text, values) {
6
6
  function injectStyles(doc, css, tagId) {
7
7
  if (doc === undefined)
8
8
  return () => { };
9
- if (doc.querySelector('style[data-plugin-css="' + tagId + '"]') !== null)
10
- return () => { };
9
+ const previous = doc.querySelector('style[data-plugin-css="' + tagId + '"]');
10
+ // P2-29: a new owner must OUTLIVE the old owner's disposer. Replace the tag
11
+ // instead of reusing it: the old disposer then removes a detached node.
12
+ previous?.remove();
11
13
  const tag = doc.createElement('style');
12
14
  tag.setAttribute('data-plugin-css', tagId);
13
15
  tag.textContent = css;
@@ -40,18 +40,30 @@ export interface ClientSeam {
40
40
  slots: SlotsSeat;
41
41
  locale: LocaleSeat;
42
42
  }
43
+ /** One atomic path operation on a config form (the platform's mutate vocabulary). */
44
+ export interface ConfigPathOpLike {
45
+ readonly op: 'set' | 'unset';
46
+ readonly path: readonly string[];
47
+ readonly value?: unknown;
48
+ }
43
49
  /** One client settings row's readable/writable face (platform configForms). */
44
- export interface ConfigFormSnapshotLike {
50
+ export interface ConfigFormSnapshotLike<T = Record<string, unknown>> {
45
51
  status: 'loading' | 'ready' | 'unavailable';
46
- value: Record<string, unknown> | undefined;
52
+ value: T | undefined;
53
+ /** Composition layer the Host resolved `value` over; what a cleared field reverts to. */
54
+ base: unknown;
55
+ /** Raw user layer: a key's PRESENCE marks the override. */
56
+ user: unknown;
47
57
  writable: boolean;
48
- revision?: number;
58
+ revision: number | undefined;
49
59
  }
50
- export interface ConfigFormLike {
51
- getSnapshot(): ConfigFormSnapshotLike;
60
+ export interface ConfigFormLike<T = Record<string, unknown>> {
61
+ getSnapshot(): ConfigFormSnapshotLike<T>;
52
62
  subscribe(listener: () => void): () => void;
53
63
  set(field: string, value: unknown): Promise<boolean>;
54
64
  unset(field: string): Promise<boolean>;
65
+ /** Atomic multi-field save; `expectedRevision` is the read the caller is replacing. */
66
+ mutate(ops: readonly ConfigPathOpLike[], expectedRevision?: number): Promise<boolean>;
55
67
  }
56
68
  export interface ConfigFormsSeat {
57
69
  get(entryId: string): ConfigFormLike;
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.32.3",
4
+ "version": "0.32.4",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public"