@septkit/ui 0.0.29 → 0.0.30

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.
@@ -1,4 +1,4 @@
1
- //#region node_modules/.pnpm/@dialecte+core@0.2.12/node_modules/@dialecte/core/dist/index-BgyMtFE-.js
1
+ //#region node_modules/.pnpm/@dialecte+core@0.2.15/node_modules/@dialecte/core/dist/utils-B_-lXlpE.js
2
2
  var e = {
3
3
  UNKNOWN: {
4
4
  code: "D0001",
@@ -36,6 +36,10 @@ var e = {
36
36
  code: "D1007",
37
37
  message: "Store is not writable"
38
38
  },
39
+ STORE_BLOB_NOT_FOUND: {
40
+ code: "D1008",
41
+ message: "Blob not found"
42
+ },
39
43
  ELEMENT_NOT_FOUND: {
40
44
  code: "D2001",
41
45
  message: "Element not found"
@@ -68,6 +72,10 @@ var e = {
68
72
  code: "D3004",
69
73
  message: "Required attribute is missing"
70
74
  },
75
+ UNIQUE_CONSTRAINT_VIOLATION: {
76
+ code: "D3005",
77
+ message: "Value is already used within its scope"
78
+ },
71
79
  ALREADY_COMMITTED: {
72
80
  code: "D4001",
73
81
  message: "Transaction already committed"
@@ -107,6 +115,10 @@ var e = {
107
115
  PROJECT_NOT_OPENED: {
108
116
  code: "D7003",
109
117
  message: "Project not opened"
118
+ },
119
+ BLOB_NOT_FOUND: {
120
+ code: "D7004",
121
+ message: "Blob not found in store"
110
122
  }
111
123
  };
112
124
  function t(t, r) {
@@ -139,4 +151,4 @@ function r(e, n) {
139
151
  });
140
152
  }
141
153
  //#endregion
142
- export { r as D };
154
+ export { e, r, t };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { AcceptableValue } from 'reka-ui';
2
2
  import { AnyDialecteConfig } from '@dialecte/core';
3
+ import { BoundExtensionMap } from '@dialecte/core';
3
4
  import { Component } from 'vue';
4
5
  import { ComponentOptionsMixin } from 'vue';
5
6
  import { ComponentProvideOptions } from 'vue';
@@ -7,6 +8,7 @@ import { ComputedRef } from 'vue';
7
8
  import { DefineComponent } from 'vue';
8
9
  import { Document as Document_2 } from '@dialecte/core';
9
10
  import { DocumentState } from '@dialecte/core';
11
+ import { ExtensionModule } from '@dialecte/core';
10
12
  import { Project } from '@dialecte/core';
11
13
  import { ProjectState } from '@dialecte/core';
12
14
  import { PublicProps } from 'vue';
@@ -21,11 +23,11 @@ close: typeof closeDropdown;
21
23
  isOpen: Ref<boolean, boolean>;
22
24
  id: string | undefined;
23
25
  }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
24
- open: (...args: any[]) => void;
25
26
  close: (...args: any[]) => void;
27
+ open: (...args: any[]) => void;
26
28
  }, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{
27
- onOpen?: ((...args: any[]) => any) | undefined;
28
29
  onClose?: ((...args: any[]) => any) | undefined;
30
+ onOpen?: ((...args: any[]) => any) | undefined;
29
31
  }>, {
30
32
  size: "xs" | "sm" | "md" | "lg" | "xl";
31
33
  color: "neutral" | "primary" | "secondary" | "accent" | "info" | "success" | "warning" | "error";
@@ -162,28 +164,26 @@ export declare const Combobox: __VLS_WithTemplateSlots_3<typeof __VLS_component_
162
164
  * Each call returns an isolated singleton (closure-scoped state). Extensions
163
165
  * should invoke this once at module level and re-export the returned bindings.
164
166
  *
165
- * The store has no knowledge of the shell. The extension is responsible for
166
- * calling `hydrate(doc)` whenever the active document changes, and `clear()`
167
- * when no document is selected.
168
- *
169
- * `document.value` throws if accessed before hydration. Use `isHydrated` to
170
- * guard render paths that depend on a real document.
171
- *
172
167
  * @example
173
- * // per-extension: src/document-store.ts
174
- * import type { Scl } from '@dialecte/scl/v2019C1'
168
+ * // Without extensions (basic):
175
169
  * export const { document, isHydrated, hydrate, clear } =
176
170
  * createDocumentStore<Scl.Document>()
177
171
  *
178
- * // bootstrap (e.g. set-editor.ts), wired before app.mount:
179
- * api.activeDocumentId.subscribe((id) => {
180
- * id ? hydrate(api.project.openDocument(id)) : clear()
181
- * })
172
+ * // With local extensions (typed augmentation):
173
+ * import { behaviorDescription } from './dialecte/behavior-description'
174
+ * type LocalDoc = ExtendedDocument<Scl.Document, Scl.Query, Scl.Transaction,
175
+ * { behaviorDescription: typeof behaviorDescription }>
176
+ * export const { document, isHydrated, hydrate, clear } =
177
+ * createDocumentStore<Scl.Document, LocalDoc>({
178
+ * extensions: { behaviorDescription },
179
+ * })
182
180
  */
183
- export declare function createDocumentStore<GenericDocument>(): {
184
- document: ComputedRef<GenericDocument>;
181
+ export declare function createDocumentStore<GenericBaseDocument, GenericAugmentedDocument = GenericBaseDocument>(options?: {
182
+ extensions?: ExtensionsConfig;
183
+ }): {
184
+ document: ComputedRef<GenericAugmentedDocument>;
185
185
  isHydrated: ComputedRef<boolean>;
186
- hydrate: (doc: GenericDocument) => void;
186
+ hydrate: (doc: GenericBaseDocument) => void;
187
187
  clear: () => void;
188
188
  };
189
189
 
@@ -206,6 +206,32 @@ export declare type ExplorerNode = {
206
206
  children?: ExplorerNode[];
207
207
  };
208
208
 
209
+ /**
210
+ * Compose an augmented Document type from a base Document, its Query/Transaction
211
+ * types, and an ExtensionsConfig. Strips first arg of every extension function.
212
+ *
213
+ * @example
214
+ * export type Document = ExtendedDocument<
215
+ * Scl.Document, Scl.Query, Scl.Transaction, { behaviorDescription: typeof behaviorDescription }
216
+ * >
217
+ */
218
+ export declare type ExtendedDocument<GenericDocument, GenericQuery, GenericTransaction, GenericExtensions extends ExtensionsConfig> = Omit<GenericDocument, 'query' | 'transaction'> & {
219
+ query: GenericQuery & BoundExtensionMap<QueryMapOf<GenericExtensions>>;
220
+ transaction: <GenericResult>(fn: (tx: GenericTransaction & BoundExtensionMap<TransactionMapOf<GenericExtensions>>) => GenericResult | Promise<GenericResult>) => Promise<Awaited<GenericResult>>;
221
+ };
222
+
223
+ /** Map of named extension modules. */
224
+ export declare type ExtensionsConfig = Record<string, ExtensionModule>;
225
+
226
+ /**
227
+ * Minimal slice of `Document` consumed by {@link useLiveData}.
228
+ */
229
+ declare type LiveDataDocument = Pick<Document_2<AnyDialecteConfig>, 'documentId' | 'state'>;
230
+
231
+ declare type QueryMapOf<GenericExtensions extends ExtensionsConfig> = {
232
+ [ExtensionName in keyof GenericExtensions as GenericExtensions[ExtensionName]['query'] extends object ? ExtensionName : never]: NonNullable<GenericExtensions[ExtensionName]['query']>;
233
+ };
234
+
209
235
  export declare const SclExplorer: DefineComponent<__VLS_Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
210
236
  select: (node: ExplorerNode) => any;
211
237
  }, string, PublicProps, Readonly<__VLS_Props_4> & Readonly<{
@@ -215,12 +241,16 @@ defaultExpandedItems: string[];
215
241
  ariaLabel: string;
216
242
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
217
243
 
244
+ declare type TransactionMapOf<GenericExtensions extends ExtensionsConfig> = {
245
+ [ExtensionName in keyof GenericExtensions as GenericExtensions[ExtensionName]['transaction'] extends object ? ExtensionName : never]: NonNullable<GenericExtensions[ExtensionName]['transaction']>;
246
+ };
247
+
218
248
  export declare function useDocumentState<GenericConfig extends AnyDialecteConfig>(document: ComputedRef<Document_2<GenericConfig>>): ComputedRef<DocumentState>;
219
249
 
220
250
  export declare function useDocumentState<GenericConfig extends AnyDialecteConfig>(document: Document_2<GenericConfig>): DocumentState;
221
251
 
222
- export declare function useLiveData<GenericConfig extends AnyDialecteConfig, T>(params: {
223
- document: Document_2<GenericConfig> | ComputedRef<Document_2<GenericConfig>>;
252
+ export declare function useLiveData<T>(params: {
253
+ document: LiveDataDocument | ComputedRef<LiveDataDocument>;
224
254
  fetcher: () => Promise<T>;
225
255
  initial: T;
226
256
  }): {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@septkit/ui",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "type": "module",
5
5
  "source": "lib/index.ts",
6
6
  "files": [
@@ -16,7 +16,7 @@
16
16
  "./uicss": "./dist/ui.css"
17
17
  },
18
18
  "dependencies": {
19
- "@dialecte/core": "0.2.12",
19
+ "@dialecte/core": "0.2.15",
20
20
  "@lucide/vue": "^1.16.0",
21
21
  "@tailwindcss/vite": "4.2.2",
22
22
  "@vueuse/components": "^13.9.0",