courthive-components 3.2.0 → 3.3.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.
@@ -10,6 +10,7 @@ export declare class PolicyCatalogStore {
10
10
  setCatalogGroupBy(mode: CatalogGroupBy): void;
11
11
  selectPolicy(id: string): void;
12
12
  clearSelection(): void;
13
+ renamePolicy(name: string): void;
13
14
  updateEditorDraft(data: Record<string, unknown>): void;
14
15
  markDirty(): void;
15
16
  markClean(): void;
@@ -18,8 +19,18 @@ export declare class PolicyCatalogStore {
18
19
  applyPolicy(): void;
19
20
  addNewPolicy(policyType: string): string;
20
21
  duplicatePolicy(sourceId: string): string | null;
22
+ /**
23
+ * Swap a placeholder id (returned from addNewPolicy/duplicatePolicy) for a
24
+ * canonical id assigned by the persistence backend. Idempotent and a no-op
25
+ * when the placeholder is gone (e.g. user deleted before reconciliation).
26
+ */
27
+ reconcilePolicyId(localId: string, serverId: string): void;
21
28
  deletePolicy(id: string): void;
22
29
  subscribe(listener: PolicyCatalogChangeListener): () => void;
23
30
  private setState;
24
31
  private emit;
32
+ private localIdCounter;
33
+ private nextLocalId;
34
+ private appendAndSelect;
35
+ private runCreateAndReconcile;
25
36
  }
@@ -25,6 +25,12 @@ export interface PolicyCatalogState {
25
25
  groupBy: CatalogGroupBy;
26
26
  selectedId: string | null;
27
27
  editorDraft: Record<string, unknown> | null;
28
+ /**
29
+ * Live name buffer for the selected policy. Populated on selection from the
30
+ * catalog item and mutated by the rename input so renames survive across
31
+ * editor remounts. `savePolicy` writes this back to the catalog item.
32
+ */
33
+ editedName: string | null;
28
34
  dirty: boolean;
29
35
  }
30
36
  export type PolicyCatalogChangeListener = (state: PolicyCatalogState) => void;
@@ -47,7 +53,13 @@ export interface PolicyCatalogConfig {
47
53
  editorPlugins?: PolicyEditorPlugin[];
48
54
  onPolicySaved?: (item: PolicyCatalogItem) => void;
49
55
  onPolicyApplied?: (item: PolicyCatalogItem) => void;
50
- onPolicyCreated?: (item: PolicyCatalogItem) => void;
56
+ /**
57
+ * Fired when "+" creates a new policy. If the host persists the new policy
58
+ * to a backend that mints its own canonical id, return that id (sync or
59
+ * Promise) — the store will reconcile the local placeholder id so subsequent
60
+ * Save calls hit the right backend record. Return void to keep the local id.
61
+ */
62
+ onPolicyCreated?: (item: PolicyCatalogItem) => string | void | Promise<string | void>;
51
63
  onPolicyDeleted?: (id: string) => void;
52
64
  onSelectionChanged?: (item: PolicyCatalogItem | null) => void;
53
65
  }
@@ -4,6 +4,7 @@ export interface EditorShellCallbacks {
4
4
  onReset: () => void;
5
5
  onApply: () => void;
6
6
  onDuplicate: () => void;
7
+ onRename: (name: string) => void;
7
8
  }
8
9
  export interface EditorShellPanel extends UIPanel<PolicyCatalogState> {
9
10
  bodyElement: HTMLElement;