simetra 0.2.0 → 0.3.0-next.1

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.
Files changed (35) hide show
  1. package/dist/channel-grant-BATD6oQu.js +15 -0
  2. package/dist/compiler/index.d.ts +684 -77
  3. package/dist/compiler/index.js +24598 -13501
  4. package/dist/data/centrifugo/index.d.ts +24 -0
  5. package/dist/data/centrifugo/index.js +173 -0
  6. package/dist/data/index.d.ts +27 -0
  7. package/dist/data/index.js +9779 -0
  8. package/dist/data/react/index.d.ts +103 -0
  9. package/dist/data/react/index.js +214 -0
  10. package/dist/grant-Zg0hmqK7.d.ts +11 -0
  11. package/dist/handle-C6PFsnUX.js +44 -0
  12. package/dist/holder-CkR-qRYU.d.ts +585 -0
  13. package/dist/model/index.d.ts +4118 -476
  14. package/dist/model/index.js +4267 -380
  15. package/dist/schema/index.d.ts +1523 -572
  16. package/dist/schema/index.js +11698 -7402
  17. package/dist/server/index.d.ts +665 -21
  18. package/dist/server/index.js +4279 -426
  19. package/dist/server/signals/index.d.ts +92 -0
  20. package/dist/server/signals/index.js +140 -0
  21. package/dist/shell/index.d.ts +100 -0
  22. package/dist/shell/index.js +148 -0
  23. package/dist/ui/index.d.ts +213 -0
  24. package/dist/ui/index.js +1075 -0
  25. package/package.json +74 -3
  26. package/schemas/accumulation-registers.schema.json +46 -5
  27. package/schemas/catalogs.schema.json +110 -7
  28. package/schemas/constants.schema.json +31 -5
  29. package/schemas/custom-tables.schema.json +24 -0
  30. package/schemas/documents.schema.json +83 -5
  31. package/schemas/functions.schema.json +129 -0
  32. package/schemas/information-registers.schema.json +47 -5
  33. package/schemas/project.schema.json +11 -1
  34. package/schemas/rights-sets.schema.json +3 -1
  35. package/schemas/roles.schema.json +6 -2
@@ -0,0 +1,213 @@
1
+ import { CatalogEntry, CatalogEntryAttribute, CatalogIndex, ClientCatalog, CommandError, OrderBy } from "simetra/model";
2
+ import { ReactElement, ReactNode } from "react";
3
+ import { RowView } from "simetra/data/react";
4
+ interface VirtualListProps {
5
+ /** `rows` of `useRows`. */
6
+ rows: readonly RowView[];
7
+ /** Window only (`useRows`): the edges not reached show a loading slot. */
8
+ atStart?: boolean;
9
+ atEnd?: boolean;
10
+ /** Window only (`useRows`): a new chain remounts the list. */
11
+ chain?: number;
12
+ /** Window only (`useRows`): where a new chain is positioned. */
13
+ target?: "start" | "end" | "keep";
14
+ /** `setVisibleRange` of `useRows`: indices into `rows`, inclusive. */
15
+ setVisibleRange(range: {
16
+ first: number;
17
+ last: number;
18
+ }): void;
19
+ /** The content of a row slot; `removed` and `hidden` rows come too. */
20
+ renderRow(row: RowView, index: number): ReactNode;
21
+ /** The `data-state` of a row slot (P4-D spec §5.5: on the `[data-row-key]` element). */
22
+ rowState?(row: RowView): string;
23
+ /** Loading slot content of an edge not reached; empty by default. */
24
+ renderPlaceholder?(edge: "before" | "after"): ReactNode;
25
+ /** Row slot height in px: exact when `measure` is off, an estimate otherwise. */
26
+ rowHeight: number;
27
+ /** Variable height: slots are measured and the first visible row is anchored. */
28
+ measure?: boolean;
29
+ /** Visible height of the scroll area, px; also the server-side viewport. */
30
+ height: number;
31
+ /** Server-side viewport width, px (the same range on server and client). */
32
+ initialWidth?: number;
33
+ className?: string;
34
+ }
35
+ /**
36
+ * A virtualized list over the rows of `useRows` (P4-B spec §6.4, spike 4 §6).
37
+ * Slots are keyed by the row key and stand under one `translateY`; the
38
+ * virtualizer's own scroll compensation of a grown row is off, the first
39
+ * visible row is anchored in a layout effect instead (one frame, no shift).
40
+ * A new `chain` remounts the list at its `target`.
41
+ */
42
+ export declare function VirtualList(props: VirtualListProps): ReactNode;
43
+ /** A column of a list or a field of a card: the catalog attribute and its title. */
44
+ interface FieldColumn {
45
+ /** Логічне ім'я реквізиту: ключ значень рядка. */
46
+ name: string;
47
+ /** Заголовок — логічне ім'я (спека П4-D §5.1). */
48
+ title: string;
49
+ attribute: CatalogEntryAttribute;
50
+ }
51
+ /** List columns: eager header attributes in catalog order, no service ones. */
52
+ export declare function headerColumns(entry: CatalogEntry): FieldColumn[];
53
+ /** Card fields: like {@link headerColumns}, lazy attributes included. */
54
+ export declare function cardFields(entry: CatalogEntry): FieldColumn[];
55
+ /** Whether the slice can edit the attribute at all; the rest is read-only. */
56
+ export declare function isEditableType(attribute: CatalogEntryAttribute): boolean;
57
+ interface FieldViewProps {
58
+ attribute: CatalogEntryAttribute;
59
+ /** A logical value of the row, as the store holds it. */
60
+ value: unknown;
61
+ /** The target of a `Ref` to an object: its row (from `refs`) and catalog entry. */
62
+ target?: {
63
+ row: RowView | null;
64
+ entry: CatalogEntry;
65
+ };
66
+ }
67
+ /** Shows a value by the logical type of its attribute, without styling. */
68
+ export declare function FieldView({ attribute, value, target }: FieldViewProps): ReactElement;
69
+ interface FieldEditorProps {
70
+ attribute: CatalogEntryAttribute;
71
+ value: unknown;
72
+ /**
73
+ * Called with the logical value read from the input. `error` is the T0 codec
74
+ * refusal (`command.invalid`); the value is then the raw text, so the input
75
+ * keeps what the user typed.
76
+ */
77
+ onChange(value: unknown, error?: CommandError): void;
78
+ disabled?: boolean;
79
+ }
80
+ /**
81
+ * Edits a value by the logical type; types the slice does not edit render
82
+ * {@link FieldView}. Validation is the T0 codec `encodeItemValue`, the same as
83
+ * the core uses.
84
+ */
85
+ export declare function FieldEditor({ attribute, value, onChange, disabled }: FieldEditorProps): ReactNode;
86
+ /**
87
+ * The text of a `Ref` to an object: its main presentation attribute, else the
88
+ * key (P4-D spec §5.3). The attribute is the entry's `presentation`, derived
89
+ * from the kind registry's standard columns and `mainPresentation`; an
90
+ * attribute name is never guessed, since a custom `description` is not it.
91
+ * A removed or missing target shows an empty text.
92
+ */
93
+ export declare function refPresentation(row: RowView | null, target: CatalogEntry): string;
94
+ interface ListHostProps {
95
+ /** Logical object name `"<kind>.<name>"`. */
96
+ object: string;
97
+ /** Sort order; by the key by default. */
98
+ orderBy?: OrderBy;
99
+ /** `Ref` attributes whose targets come with the rows; by default every single-target `Ref` column. */
100
+ include?: readonly string[];
101
+ }
102
+ /**
103
+ * The read of a list: sort order and `include`. One function for the host and
104
+ * the route loader (P4-D spec §6), so the view a loader preloads is the view
105
+ * the host subscribes to.
106
+ */
107
+ export declare function listQuery(entry: CatalogEntry, options?: {
108
+ orderBy?: OrderBy;
109
+ include?: readonly string[];
110
+ }): {
111
+ orderBy: OrderBy;
112
+ include?: readonly string[];
113
+ };
114
+ /**
115
+ * The standard list of an object (P4-D spec §5.1): the eager header columns
116
+ * of the catalog, a state cell per row and the selection panel. A click or
117
+ * `Enter` on a row opens its card; `removed` and `hidden` rows open nothing.
118
+ * Needs `CatalogProvider`, `NavigationProvider` and `DataRuntimeProvider`.
119
+ */
120
+ export declare function ListHost(props: ListHostProps): ReactElement;
121
+ interface CardHostProps {
122
+ /** Logical object name `"<kind>.<name>"`. */
123
+ object: string;
124
+ /** The row key. */
125
+ id: string;
126
+ }
127
+ /**
128
+ * The read of a card: every tabular section of the object. One function for
129
+ * the host and the route loader (P4-D spec §6), so the views a loader
130
+ * preloads are the views the host subscribes to.
131
+ */
132
+ export declare function cardQuery(entry: CatalogEntry): {
133
+ tabularSections: readonly string[];
134
+ };
135
+ /**
136
+ * The standard card of an object (P4-D spec §5.2): the header fields in
137
+ * catalog order with the card draft, and every tabular section
138
+ * read-only. A dirty draft blocks navigation. A `hidden` card shows no value
139
+ * of the row or the draft; a purged or `removed` one drops the draft. Another
140
+ * runtime, object or key is another card with a clean draft. Needs
141
+ * `CatalogProvider`, `NavigationProvider` and `DataRuntimeProvider`.
142
+ */
143
+ export declare function CardHost(props: CardHostProps): ReactElement;
144
+ /** Provides the client catalog (`client-catalog.json`) to T5 hosts. */
145
+ export declare function CatalogProvider(props: {
146
+ catalog: ClientCatalog;
147
+ children?: ReactNode;
148
+ }): import("react").FunctionComponentElement<import("react").ProviderProps<CatalogIndex | null>>;
149
+ /**
150
+ * The catalog entry of `object` (`"<kind>.<name>"`). Throws `Error` without a
151
+ * `CatalogProvider` and `TypeError` for an object outside the catalog.
152
+ */
153
+ export declare function useCatalogEntry(object: string): CatalogEntry;
154
+ /** Тексти — значення ключів локалі; `en` — типова (Дх13). Ключі — `<група>.<назва>`. */
155
+ declare const en: {
156
+ readonly "state.pending": "Saving…";
157
+ readonly "state.unknown": "Checking the result…";
158
+ readonly "state.failed": "Not saved";
159
+ readonly "state.conflict": "Changed by someone else";
160
+ readonly "state.stale": "May be out of date";
161
+ readonly "state.hidden": "Access changed — values hidden, checking";
162
+ readonly "state.removed": "Row unavailable";
163
+ readonly "state.loading": "Loading…";
164
+ readonly "state.refreshing": "Updating…";
165
+ readonly "state.purged": "Access changed — data hidden";
166
+ readonly "action.open": "Open";
167
+ readonly "action.save": "Save";
168
+ readonly "action.dismiss": "Dismiss";
169
+ readonly "action.retry": "Retry";
170
+ readonly "action.cancel": "Cancel";
171
+ readonly "action.takeServer": "Take server version";
172
+ readonly "action.overwrite": "Overwrite";
173
+ readonly "action.remove": "Remove";
174
+ readonly "action.showNew": "New rows — show";
175
+ readonly "action.refreshList": "The list changed — refresh";
176
+ readonly "action.refreshCard": "The card changed — refresh";
177
+ readonly "action.reloadPage": "Reload the page";
178
+ readonly "value.yes": "Yes";
179
+ readonly "value.no": "No";
180
+ readonly "value.notInSlice": "Not shown in this slice";
181
+ readonly "app.updateRequired": "An app update is required";
182
+ };
183
+ type MessageKey = keyof typeof en;
184
+ type Locale = "en" | "uk";
185
+ /** UI texts per locale; `en` is the default. */
186
+ export declare const MESSAGES: Record<Locale, Record<MessageKey, string>>;
187
+ /** Selects the locale for `useMessage` in the subtree. */
188
+ export declare function MessagesProvider(props: {
189
+ locale: Locale;
190
+ children?: ReactNode;
191
+ }): import("react").FunctionComponentElement<import("react").ProviderProps<Locale>>;
192
+ /** Text for `key` in the current locale (`en` without a provider). */
193
+ export declare function useMessage(key: MessageKey): string;
194
+ /**
195
+ * Шов між T5 і маршрутизатором: T5 не знає TanStack Router, адаптер дає T6.
196
+ * `object` — логічне ім'я об'єкта, `key` — ключ рядка.
197
+ */
198
+ interface NavigationAdapter {
199
+ /** Opens the card of the row `key` of `object`. */
200
+ openCard(object: string, key: string): void;
201
+ /** Opens the list of `object`. */
202
+ openList(object: string): void;
203
+ /** Blocks navigation while `dirty` is true (an unsaved draft). */
204
+ useBlockWhile(dirty: boolean): void;
205
+ }
206
+ /** Provides the router adapter to T5 hosts. */
207
+ export declare function NavigationProvider(props: {
208
+ adapter: NavigationAdapter;
209
+ children?: ReactNode;
210
+ }): import("react").FunctionComponentElement<import("react").ProviderProps<NavigationAdapter | null>>;
211
+ /** The current adapter; throws `Error` without a `NavigationProvider`. */
212
+ export declare function useNavigation(): NavigationAdapter;
213
+ export type { CardHostProps, FieldColumn, FieldEditorProps, FieldViewProps, ListHostProps, Locale, MessageKey, NavigationAdapter, VirtualListProps };