@dineug/erd-editor 3.9.2 → 3.10.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.
Files changed (86) hide show
  1. package/README.md +28 -9
  2. package/dist/components/erd/Erd.d.ts +1 -0
  3. package/dist/components/erd/canvas/relationship-group/relationship/Relationship.d.ts +2 -0
  4. package/dist/components/erd/canvas/relationship-group/relationship/RelationshipActionLabel.d.ts +32 -0
  5. package/dist/components/erd/canvas/table/cellLayout.d.ts +11 -0
  6. package/dist/components/erd/canvas/table/column/Column.d.ts +7 -0
  7. package/dist/components/erd/canvas/table/goToErd.d.ts +3 -10
  8. package/dist/components/erd/erd-context-menu/menus/relationshipMenus.d.ts +11 -0
  9. package/dist/components/erd/goToErdTarget.d.ts +85 -0
  10. package/dist/components/erd/table-properties/TableProperties.d.ts +2 -0
  11. package/dist/components/erd/table-properties/TableProperties.styles.d.ts +24 -2
  12. package/dist/components/erd/table-properties/table-properties-indexes/TablePropertiesIndexes.d.ts +2 -0
  13. package/dist/components/erd/table-properties/table-properties-indexes/TablePropertiesIndexes.styles.d.ts +32 -0
  14. package/dist/components/erd/table-properties/table-properties-indexes/indexes-checkbox-column/IndexesCheckboxColumn.d.ts +7 -0
  15. package/dist/components/erd/table-properties/table-properties-indexes/indexes-checkbox-column/IndexesCheckboxColumn.styles.d.ts +5 -0
  16. package/dist/components/erd/table-properties/table-properties-indexes/indexes-column/IndexesColumn.d.ts +7 -0
  17. package/dist/components/erd/table-properties/table-properties-indexes/indexes-column/IndexesColumn.styles.d.ts +3 -0
  18. package/dist/components/erd/table-properties/table-properties-indexes/indexes-index/IndexesIndex.d.ts +7 -0
  19. package/dist/components/erd/table-properties/table-properties-indexes/indexes-index/IndexesIndex.styles.d.ts +6 -0
  20. package/dist/components/erd/table-properties/table-properties-indexes/indexes-key/IndexesKey.d.ts +15 -0
  21. package/dist/components/erd/table-properties/table-properties-indexes/indexes-key/IndexesKey.styles.d.ts +13 -0
  22. package/dist/components/erd-editor/ErdEditor.d.ts +1 -1
  23. package/dist/components/find-replace/FindReplace.d.ts +13 -0
  24. package/dist/components/find-replace/FindReplace.styles.d.ts +27 -0
  25. package/dist/components/find-replace/fieldIcon.d.ts +5 -0
  26. package/dist/components/find-replace/matchTarget.d.ts +26 -0
  27. package/dist/components/find-replace/panelLayout.d.ts +17 -0
  28. package/dist/components/primitives/icon/icons.d.ts +10 -1
  29. package/dist/components/quick-search/QuickSearch.styles.d.ts +6 -0
  30. package/dist/components/quick-search/actions.d.ts +23 -0
  31. package/dist/components/quick-search/hangul.d.ts +73 -0
  32. package/dist/components/quick-search/paletteQuery.d.ts +37 -0
  33. package/dist/components/quick-search/scopedActions.d.ts +41 -0
  34. package/dist/components/visualization/table/column/Column.d.ts +4 -0
  35. package/dist/constants/layout.d.ts +13 -0
  36. package/dist/constants/open.d.ts +1 -0
  37. package/dist/constants/schema.d.ts +13 -0
  38. package/dist/engine/index.d.ts +1 -1
  39. package/dist/engine/index.js +20 -14
  40. package/dist/engine/modules/relationship/actions.d.ts +13 -0
  41. package/dist/engine/modules/relationship/atom.actions.d.ts +54 -0
  42. package/dist/engine/modules/relationship/fkColumns.d.ts +20 -3
  43. package/dist/engine/modules/relationship/generator.actions.d.ts +5 -2
  44. package/dist/engine/modules/relationship/history.d.ts +2 -0
  45. package/dist/engine/modules/relationship/hooks.d.ts +11 -0
  46. package/dist/engine/modules/table-column/hooks.d.ts +6 -0
  47. package/dist/engine/replication-store.d.ts +15 -1
  48. package/dist/engine/store-hooks.d.ts +8 -0
  49. package/dist/erd-editor.umd.js +1038 -481
  50. package/dist/index.js +7088 -5245
  51. package/dist/konva/scene/metrics.d.ts +5 -0
  52. package/dist/{store-hooks-DuzDVhPy.js → loadValue-Mdc5K4qO.js} +4001 -3425
  53. package/dist/peer/index.d.ts +1 -1
  54. package/dist/peer/index.js +64 -67
  55. package/dist/schemaGCService-CZtGFh2z.js +42 -0
  56. package/dist/services/schema-gc/schemaGCService.d.ts +5 -0
  57. package/dist/shared-store-D82WVL5a.js +1129 -0
  58. package/dist/utils/calcTable.d.ts +9 -1
  59. package/dist/utils/emitter.d.ts +13 -0
  60. package/dist/utils/find-replace/findMatches.d.ts +90 -0
  61. package/dist/utils/find-replace/index.d.ts +5 -0
  62. package/dist/utils/find-replace/matcher.d.ts +53 -0
  63. package/dist/utils/find-replace/present.d.ts +22 -0
  64. package/dist/utils/find-replace/replaceActions.d.ts +20 -0
  65. package/dist/utils/generator-code/utils.d.ts +12 -1
  66. package/dist/utils/keyboard-shortcut/index.d.ts +8 -1
  67. package/dist/utils/loadValue.d.ts +7 -0
  68. package/dist/utils/referentialAction.d.ts +21 -0
  69. package/dist/utils/schema-aml-parser/types.d.ts +6 -0
  70. package/dist/utils/schema-dbml-parser/types.d.ts +3 -0
  71. package/dist/utils/schema-sql/Databricks.d.ts +5 -0
  72. package/dist/utils/schema-sql/MSSQL.d.ts +5 -0
  73. package/dist/utils/schema-sql/MariaDB.d.ts +5 -0
  74. package/dist/utils/schema-sql/MySQL.d.ts +5 -0
  75. package/dist/utils/schema-sql/Oracle.d.ts +5 -0
  76. package/dist/utils/schema-sql/index.d.ts +5 -0
  77. package/dist/utils/schema-sql/utils.d.ts +19 -0
  78. package/dist/utils/schema-sql-parser/index.d.ts +5 -1
  79. package/dist/utils/table-clipboard/payload.d.ts +3 -0
  80. package/dist/utils/tableKeys.d.ts +46 -0
  81. package/dist/workers/elkLayout.shared-worker.js +1 -1
  82. package/dist/workers/exportPng.shared-worker.js +29 -27
  83. package/dist/workers/schemaGC.shared-worker.js +1 -1
  84. package/package.json +7 -6
  85. package/dist/schemaGCService-BagQ1wfF.js +0 -38
  86. package/dist/shared-store-BqPSXAEf.js +0 -1072
package/README.md CHANGED
@@ -9,8 +9,10 @@ framework dependency and renders into a closed shadow root, so it drops into any
9
9
  React, Vue, Svelte, or plain HTML — without leaking styles either way.
10
10
 
11
11
  This is the same editor that powers [erd-editor.io](https://erd-editor.io), the
12
- [VS Code extension](https://marketplace.visualstudio.com/items?itemName=dineug.vuerd-vscode)
13
- and the [IntelliJ plugin](https://plugins.jetbrains.com/plugin/23594-erd-editor).
12
+ [Google Drive app](https://workspace.google.com/marketplace/app/erd_editor/428467403360), the
13
+ [VS Code extension](https://marketplace.visualstudio.com/items?itemName=dineug.vuerd-vscode),
14
+ the [IntelliJ plugin](https://plugins.jetbrains.com/plugin/23594-erd-editor) and the
15
+ [Obsidian plugin](https://community.obsidian.md/plugins/erd-editor).
14
16
 
15
17
  ## Features
16
18
 
@@ -23,7 +25,8 @@ and the [IntelliJ plugin](https://plugins.jetbrains.com/plugin/23594-erd-editor)
23
25
  SQLAlchemy, TypeORM, Sequelize, Drizzle, DBML, AML
24
26
  - Export — `.erd.json`, `.sql`, `.png`
25
27
  - Force-directed visualization of table relationships
26
- - Quick search, undo / redo, remappable keyboard shortcuts, and a built-in theme builder
28
+ - Quick search over commands, and over tables, columns, comments and memos after `#`, `@` or `:`,
29
+ find and replace, undo / redo, remappable keyboard shortcuts, and a built-in theme builder
27
30
  - Collaboration hooks — the editor emits and applies actions; you supply the transport
28
31
 
29
32
  ## Install
@@ -57,7 +60,10 @@ editor.addEventListener('change', () => {
57
60
  });
58
61
  ```
59
62
 
60
- `setInitialValue('')` starts an empty document.
63
+ `setInitialValue('')` starts a new document, as an element given no value shows: it saves neither
64
+ the scroll nor the zoom (Save Scroll Information and Save Zoom Information off), so looking around
65
+ leaves `value` as it was. A document loaded from text keeps the switches it names, and one that
66
+ names none saves both.
61
67
 
62
68
  ### Server-side rendering
63
69
 
@@ -132,7 +138,7 @@ erd-editor {
132
138
 
133
139
  | Property | Description |
134
140
  | --- | --- |
135
- | `value: string` | The document as JSON — an `.erd.json` document ([schema](https://github.com/dineug/erd-editor/blob/main/json-schema/schema.json)). Assigning it loads the document as an edit, so it lands in the undo history; use `setInitialValue` to load without one. |
141
+ | `value: string` | The document as JSON — an `.erd.json` document ([schema](https://github.com/dineug/erd-editor/blob/main/json-schema/schema.json)). Assigning it loads the document as an edit, so it lands in the undo history; use `setInitialValue` to load without one. Assigning an empty string loads a new document, as `setInitialValue('')` does. |
136
142
 
137
143
  ### Methods
138
144
 
@@ -147,17 +153,17 @@ erd-editor {
147
153
  | `setDiffValue(value: string)` | Open the diff viewer against another document. |
148
154
  | `setPresetTheme(options)` | Set `appearance`, `grayColor` and `accentColor`. |
149
155
  | `setTheme(theme)` | Override individual theme tokens. |
150
- | `setKeyBindingMap(map)` | Remap shortcuts. `edit`, `stop`, `search`, `undo`, `redo`, `zoomIn`, `zoomOut` and `zoomReset` are reserved. |
156
+ | `setKeyBindingMap(map)` | Remap shortcuts, `search` and `findReplace` among them. `edit`, `stop`, `undo`, `redo`, `zoomIn`, `zoomOut` and `zoomReset` are reserved. |
151
157
  | `getSharedStore(config?)` | Returns `{ subscribe, dispatch, dispatchSync, connection, disconnect, destroy }`. `subscribe` gives you this editor's actions to relay; `dispatch` applies a peer's. You supply the transport. `config` is `{ getNickname?, mouseTracker?, focusTracker? }`; both trackers default to `true` and broadcast this editor's cursor and table focus to peers. |
152
158
  | `focus()` / `blur()` | Move focus in and out of the editor. |
153
- | `clear()` | Empty the document. |
159
+ | `clear()` | Empty the document. Its settings stay, the save switches included, so a cleared file keeps saving what it saved. |
154
160
  | `destroy()` | Tear the editor down and release its listeners, subscriptions and shared stores. |
155
161
 
156
162
  ### Events
157
163
 
158
164
  | Event | Description |
159
165
  | --- | --- |
160
- | `change` | The document changed. Debounced, and never fired while `readonly`. Read `editor.value`. |
166
+ | `change` | The document changed. Debounced, and never fired while `readonly`. Read `editor.value`. A scroll or a zoom fires it too. A scroll leaves `value` as it was with Save Scroll Information off; a zoom moves the scroll position too, so it leaves `value` as it was only with Save Zoom Information and Save Scroll Information both off. `value` differs from a file another release or machine wrote from the load on, so a host that writes files tells an edit from such a change by a [headless replica](#headless-replica)'s `changed`, not by comparing bytes with the file. |
161
167
  | `changePresetTheme` | The theme was changed from inside the editor. `event.detail` carries the new options. |
162
168
 
163
169
  ## Key bindings
@@ -178,6 +184,12 @@ The editor listens on its own element, so a host that takes keys before the page
178
184
  global hotkeys or a capture-phase `keydown` listener, has to let these through while the editor
179
185
  is focused. The `KeyBindingMap`, `KeyBindingName` and `ShortcutOption` types come with it.
180
186
 
187
+ The page's own find is among them: while the editor is focused, on any of its tabs, `$mod+KeyF`
188
+ opens its Find and Replace, bringing the ERD tab up, and is prevented, so the browser opens no find
189
+ bar; while the diff viewer, time travel or the automatic placement preview covers the ERD tab, the
190
+ press goes on to the page. `setKeyBindingMap({ findReplace: [] })` leaves it to the page on every
191
+ tab, and the toolbar button, the quick search and the context menu still open Find and Replace.
192
+
181
193
  ## Syntax highlighting
182
194
 
183
195
  The SQL and code-generation panels are highlighted by [Shiki](https://shiki.style), in a shared
@@ -247,10 +259,17 @@ import { createReplicationStore } from '@dineug/erd-editor/engine.js';
247
259
  const store = createReplicationStore({ toWidth });
248
260
 
249
261
  store.setInitialValue(savedJson);
250
- store.on({ change: () => persist(store.value) });
262
+ store.on({ change: ({ value, changed }) => changed && persist(value) });
251
263
  store.dispatch(actions); // actions relayed from a live editor's shared store
252
264
  ```
253
265
 
266
+ `change` comes 200 ms after the last action that can change the document. `changed` is false
267
+ when those actions left `value` as it was, such as a scroll with Save Scroll Information off, or a
268
+ zoom with Save Zoom Information and Save Scroll Information both off: a zoom moves the scroll
269
+ position too, so with only the scroll saved it changes `value`. It compares with the value the
270
+ store last reported, or loaded, never with your file: a file another release or machine wrote
271
+ serializes differently from the start.
272
+
254
273
  ## Development
255
274
 
256
275
  This package is the editor core of the [erd-editor monorepo](https://github.com/dineug/erd-editor);
@@ -2,6 +2,7 @@ import { FC } from '@dineug/r-html';
2
2
  export type ErdProps = {
3
3
  isDarkMode: boolean;
4
4
  mouseTracking: boolean;
5
+ readonly: boolean;
5
6
  };
6
7
  declare const Erd: FC<ErdProps>;
7
8
  export default Erd;
@@ -5,6 +5,8 @@ export type RelationshipProps = {
5
5
  strokeWidth: number;
6
6
  /** Whether the view lights this connector, decided by the scene it is drawn in. */
7
7
  lit?: boolean;
8
+ /** Told as the pointer comes onto the connector and leaves it, for its label to light along. */
9
+ onHover?: (id: string, hover: boolean) => void;
8
10
  };
9
11
  declare const Relationship: FC<RelationshipProps>;
10
12
  export default Relationship;
@@ -0,0 +1,32 @@
1
+ import { FC } from '@dineug/r-html';
2
+ import { Relationship } from '../../../../../internal-types';
3
+ import { Anchor } from '../../../../../utils/draw-relationship';
4
+ /** The size the referential action label is drawn at, in scene units. */
5
+ export declare const ACTION_LABEL_FONT_SIZE = 10;
6
+ type LabelBox = {
7
+ x: number;
8
+ y: number;
9
+ width: number;
10
+ height: number;
11
+ };
12
+ /**
13
+ * The box the label fills beside the child end: over a route leaving sideways,
14
+ * reaching away from the table, and right of one leaving up or down. Across, it
15
+ * clears the widest marker, so no stroke of a crow's foot runs under it.
16
+ */
17
+ export declare function actionLabelBox(end: Anchor, text: string): LabelBox;
18
+ export type RelationshipActionLabelProps = {
19
+ relationship: Relationship;
20
+ /** The connector the pointer rests on, whose label lights with it. */
21
+ hovered?: {
22
+ id: string;
23
+ };
24
+ };
25
+ /**
26
+ * The ON DELETE and ON UPDATE a connector sets, at its child end, on a box of
27
+ * the canvas colour. The group draws every label after every route, so another
28
+ * connector crossing one runs under the box rather than through the text.
29
+ */
30
+ declare const RelationshipActionLabel: FC<RelationshipActionLabelProps>;
31
+ export default RelationshipActionLabel;
32
+ //# sourceMappingURL=RelationshipActionLabel.d.ts.map
@@ -77,6 +77,17 @@ export declare function getCellTextBaseline(fontFamily?: string): number;
77
77
  export declare function getCellTextHeight(fontFamily?: string): number;
78
78
  /** Where a column row's cells start, past the key badge its own source sizes. */
79
79
  export declare function getColumnCellsX(source?: GeometrySource): number;
80
+ /**
81
+ * Where a document row's alternate key mark starts: one margin past the last
82
+ * of the cells given, whatever order the settings put them in. The mark is
83
+ * derived, so it is no cell of that order and nothing focuses, edits or moves it.
84
+ */
85
+ export declare function getAlternateKeyMarkX(slots: ColumnCellSlot[]): number;
86
+ /**
87
+ * The box the mark's code face line is centred in, so it stands on the text
88
+ * face's baseline, the one the cell before it is drawn on, and not on its own.
89
+ */
90
+ export declare function getAlternateKeyMarkHeight(): number;
80
91
  /** The comment width a table draws at, clamped by the setting when it is set. */
81
92
  export declare function getWidthComment(state: RootState, table: Table): number;
82
93
  /**
@@ -45,6 +45,13 @@ export type ColumnProps = {
45
45
  widthDataType: number;
46
46
  widthDefault: number;
47
47
  widthComment: number;
48
+ /**
49
+ * The room the table keeps for alternate key marks after the last cell, 0
50
+ * while it draws none; the same for every row, so the marks stay in line.
51
+ */
52
+ widthAlternateKey?: number;
53
+ /** The mark this row carries in that room, AK1.2 or several comma joined. */
54
+ alternateKey?: string;
48
55
  focusName: boolean;
49
56
  focusDataType: boolean;
50
57
  focusNotNull: boolean;
@@ -1,15 +1,8 @@
1
- import { GeneratorAction } from '../../../../engine/generator.actions';
2
1
  import { RxStore } from '../../../../engine/rx-store';
3
2
  /**
4
- * Stands the reader on one table in the document, selected, scrolled to the
5
- * middle of the screen at the document's own zoom unless it is already on
6
- * screen whole, since that scroll is the one change the host hears of. One that is gone is passed over.
7
- */
8
- export declare const showErdTableAction$: (tableId: string) => GeneratorAction;
9
- /**
10
- * The Go to ERD button's whole errand: the tab in one dispatch, the scroll and
11
- * the selection in a second. A batch is classified by the state before it, so
12
- * a scroll travelling with the tab change would be redirected into the view it leaves.
3
+ * The Go to ERD button's whole errand, a jump from outside the canvas like any
4
+ * other: the tab in one dispatch, then the scroll and the selection, which
5
+ * never starts or finishes a relationship being drawn.
13
6
  *
14
7
  * @example
15
8
  * goToErdTable(store, 'orders');
@@ -5,4 +5,15 @@ export declare function createRelationshipMenus({ store }: AppContext, relations
5
5
  name: string;
6
6
  onClick: () => void;
7
7
  }[];
8
+ export type ReferentialActionField = 'onDelete' | 'onUpdate';
9
+ /**
10
+ * The ON DELETE or ON UPDATE choices of a relationship, its own one checked.
11
+ * One the current database's DDL would drop stays choosable, with a note.
12
+ */
13
+ export declare function createReferentialActionMenus({ store }: AppContext, field: ReferentialActionField, relationshipId?: string): {
14
+ checked: boolean;
15
+ name: string;
16
+ note: string | null;
17
+ onClick: () => void;
18
+ }[];
8
19
  //# sourceMappingURL=relationshipMenus.d.ts.map
@@ -0,0 +1,85 @@
1
+ import { GeneratorAction } from '../../engine/generator.actions';
2
+ import { FocusType } from '../../engine/modules/editor/state';
3
+ import { RxStore } from '../../engine/rx-store';
4
+ import { RootState } from '../../engine/state';
5
+ import { Table } from '../../internal-types';
6
+ import { Rect } from '../../konva/scene/metrics';
7
+ /** The part of a cell's text a jump is for, a search's match say: text from start to end. */
8
+ export type TextRange = {
9
+ text: string;
10
+ start: number;
11
+ end: number;
12
+ };
13
+ /** What a jump to the ERD lands on: a table, one cell of a column, or a memo. */
14
+ export type ErdTarget = {
15
+ kind: 'table';
16
+ tableId: string;
17
+ focusType?: FocusType;
18
+ range?: TextRange;
19
+ } | {
20
+ kind: 'column';
21
+ tableId: string;
22
+ columnId: string;
23
+ focusType: FocusType;
24
+ range?: TextRange;
25
+ } | {
26
+ kind: 'memo';
27
+ memoId: string;
28
+ };
29
+ type Span = {
30
+ start: number;
31
+ end: number;
32
+ };
33
+ /**
34
+ * The scroll that puts the rect in the middle of what the screen shows at the
35
+ * document's own zoom, unless it is shown whole already, since that scroll is
36
+ * the one change of a jump the host hears of.
37
+ *
38
+ * @param focus The part of a rect too big for the screen that has to show.
39
+ */
40
+ export declare function scrollIntoView(state: RootState, rect: Rect, covered?: number, focus?: Rect): Generator<import('@dineug/r-html').AnyAction<{
41
+ originX: number;
42
+ originY: number;
43
+ }>, void, unknown>;
44
+ /**
45
+ * Brings a table on screen whole, or one too big for the screen by the header
46
+ * cell a jump rings, its name unless it asks for the comment, rather than by
47
+ * a middle.
48
+ *
49
+ * @param range Where the text a jump is for stands in that cell, in from its left edge.
50
+ */
51
+ export declare function scrollTableIntoView(state: RootState, table: Table, covered?: number, focusType?: FocusType, range?: Span): Generator<import('@dineug/r-html').AnyAction<{
52
+ originX: number;
53
+ originY: number;
54
+ }>, void, unknown>;
55
+ /**
56
+ * Selects the table alone and brings it to the front, as a press on it does,
57
+ * bar the press's part in a relationship being drawn: a jump only shows, so it
58
+ * never starts or finishes one, which would add a relationship and a column.
59
+ */
60
+ export declare const selectTableAloneAction$: (tableId: string) => GeneratorAction;
61
+ /**
62
+ * Stands the reader on a table, a column cell or a memo the way the Go to ERD
63
+ * button stands them on a table, with the focus ring on the cell asked for. A
64
+ * row too wide goes by the ringed cell, a cell too wide by the range found.
65
+ *
66
+ * @param covered How far in from the left edge a panel over the canvas hides it.
67
+ */
68
+ export declare const showErdTargetAction$: (target: ErdTarget, covered?: number) => GeneratorAction;
69
+ /**
70
+ * Takes the ERD tab when another is up, in a dispatch of its own: a batch is
71
+ * classified by the state before it, so a scroll travelling with the tab
72
+ * change would be redirected into the view it leaves.
73
+ */
74
+ export declare function showErdTab(store: RxStore): void;
75
+ /**
76
+ * A jump from outside the canvas, a search result say, to anything it holds,
77
+ * from whichever tab is up. It lands clear of the Find and Replace panel, read
78
+ * once the ERD tab is up, so a panel that tab draws again counts too.
79
+ *
80
+ * @example
81
+ * goToErdTarget(store, { kind: 'memo', memoId: 'note' });
82
+ */
83
+ export declare function goToErdTarget(store: RxStore, target: ErdTarget): void;
84
+ export {};
85
+ //# sourceMappingURL=goToErdTarget.d.ts.map
@@ -1,6 +1,8 @@
1
1
  import { FC } from '@dineug/r-html';
2
2
  export type TablePropertiesProps = {
3
3
  isDarkMode: boolean;
4
+ /** The editor's readonly mode, which the dialog shows and its controls follow; the store refuses the edits anyway. */
5
+ readonly?: boolean;
4
6
  tableId: string;
5
7
  tableIds: string[];
6
8
  onChange: (tableId: string) => void;
@@ -1,7 +1,29 @@
1
+ /**
2
+ * Dims the canvas and hangs the dialog from the palette's line, so switching
3
+ * tabs never moves its top edge.
4
+ */
1
5
  export declare const root: import('@dineug/r-html').CSSTemplateLiterals;
6
+ /**
7
+ * One fixed box for all three tabs, so the frame never jumps; a short host
8
+ * gets the height it has. It sets no font size, or the tabs would shrink too.
9
+ */
2
10
  export declare const container: import('@dineug/r-html').CSSTemplateLiterals;
3
- export declare const scrollbarArea: import('@dineug/r-html').CSSTemplateLiterals;
4
11
  export declare const header: import('@dineug/r-html').CSSTemplateLiterals;
5
- export declare const tab: import('@dineug/r-html').CSSTemplateLiterals;
12
+ export declare const title: import('@dineug/r-html').CSSTemplateLiterals;
13
+ export declare const readonlyBadge: import('@dineug/r-html').CSSTemplateLiterals;
14
+ /**
15
+ * Shades a sideways scroller's edge only where more lies past it: two covers
16
+ * in the panel colour, solid as wide as a shade, ride with the content over
17
+ * two edge shades, the cue an overlay scrollbar leaves out.
18
+ */
19
+ export declare const edgeShade: import('@dineug/r-html').CSSTemplateLiterals;
20
+ export declare const tables: import('@dineug/r-html').CSSTemplateLiterals;
21
+ export declare const tableChip: import('@dineug/r-html').CSSTemplateLiterals;
22
+ export declare const close: import('@dineug/r-html').CSSTemplateLiterals;
23
+ export declare const scrollbarArea: import('@dineug/r-html').CSSTemplateLiterals;
24
+ /**
25
+ * The Indexes panes side by side, stacked once the dialog is too narrow for
26
+ * both; a code tab instead fills the body as a well that scrolls on its own.
27
+ */
6
28
  export declare const scope: import('@dineug/r-html').CSSTemplateLiterals;
7
29
  //# sourceMappingURL=TableProperties.styles.d.ts.map
@@ -1,6 +1,8 @@
1
1
  import { FC } from '@dineug/r-html';
2
2
  export type TablePropertiesIndexesProps = {
3
3
  tableId: string;
4
+ /** The editor's readonly mode: nothing here offers an edit, and picking a row only shows it. */
5
+ readonly?: boolean;
4
6
  };
5
7
  declare const TablePropertiesIndexes: FC<TablePropertiesIndexesProps>;
6
8
  export default TablePropertiesIndexes;
@@ -1,4 +1,36 @@
1
+ /**
2
+ * The room the keys and indexes stick in, which keeps their width. Side by
3
+ * side it stretches as tall as the columns, so they stay in sight while a
4
+ * long list scrolls; stacked above the columns it is only as tall as its rows.
5
+ */
6
+ export declare const leftTrack: import('@dineug/r-html').CSSTemplateLiterals;
1
7
  export declare const leftArea: import('@dineug/r-html').CSSTemplateLiterals;
8
+ /**
9
+ * The columns, which take what the keys leave and scroll sideways past that.
10
+ * A box the keyboard reaches scrolls clear of the stuck heading and order,
11
+ * which the browser would otherwise count as showing it.
12
+ */
2
13
  export declare const rightArea: import('@dineug/r-html').CSSTemplateLiterals;
14
+ /**
15
+ * The Columns heading, stuck to the top of the body while the rows scroll
16
+ * under it. It reaches back over the body padding, as the order does at the
17
+ * bottom, so no row shows above it.
18
+ */
19
+ export declare const columnsHead: import('@dineug/r-html').CSSTemplateLiterals;
20
+ export declare const sectionLabel: import('@dineug/r-html').CSSTemplateLiterals;
21
+ /**
22
+ * Read, not hinted at: the placeholder colour is too faint for a sentence. A
23
+ * flex box draws no ellipsis, so its text span cuts itself short.
24
+ */
25
+ export declare const sectionStatus: import('@dineug/r-html').CSSTemplateLiterals;
26
+ export declare const columns: import('@dineug/r-html').CSSTemplateLiterals;
27
+ export declare const hint: import('@dineug/r-html').CSSTemplateLiterals;
3
28
  export declare const addIndexButtonArea: import('@dineug/r-html').CSSTemplateLiterals;
29
+ export declare const addIcon: import('@dineug/r-html').CSSTemplateLiterals;
30
+ /**
31
+ * The selected index's column order, ruled off under the columns. It sticks
32
+ * to the bottom of the body while a long list scrolls, and sits in place
33
+ * under a short one.
34
+ */
35
+ export declare const order: import('@dineug/r-html').CSSTemplateLiterals;
4
36
  //# sourceMappingURL=TablePropertiesIndexes.styles.d.ts.map
@@ -3,6 +3,13 @@ import { Index } from '../../../../../internal-types';
3
3
  export type IndexesCheckboxColumnProps = {
4
4
  tableId: string;
5
5
  index: Index | null;
6
+ /**
7
+ * The columns of a key the columns declare, picked instead of an index: they
8
+ * show checked, and every box stays disabled, since no index owns them.
9
+ */
10
+ keyColumnIds?: string[] | null;
11
+ /** The editor's readonly mode, which disables every box as a picked key does. */
12
+ readonly?: boolean;
6
13
  };
7
14
  declare const IndexesCheckboxColumn: FC<IndexesCheckboxColumnProps>;
8
15
  export default IndexesCheckboxColumn;
@@ -1,2 +1,7 @@
1
+ /**
2
+ * The column rows at their own width, the tint running to the end of each
3
+ * row however far the list scrolls sideways. A column of the picked index
4
+ * or key wears the picked row's tint and bar; an idle list hovers no row.
5
+ */
1
6
  export declare const root: import('@dineug/r-html').CSSTemplateLiterals;
2
7
  //# sourceMappingURL=IndexesCheckboxColumn.styles.d.ts.map
@@ -2,6 +2,13 @@ import { FC } from '@dineug/r-html';
2
2
  import { Index } from '../../../../../internal-types';
3
3
  export type IndexesColumnProps = {
4
4
  index: Index;
5
+ /**
6
+ * The alternate key the index is, 1 for AK1, whose marks each row then
7
+ * carries as the diagram draws them; 0 or left out while it is none.
8
+ */
9
+ alternateKey?: number;
10
+ /** The editor's readonly mode: the rows neither drag nor flip their sort order. */
11
+ readonly?: boolean;
5
12
  };
6
13
  declare const IndexesColumn: FC<IndexesColumnProps>;
7
14
  export default IndexesColumn;
@@ -1,4 +1,7 @@
1
1
  export declare const root: import('@dineug/r-html').CSSTemplateLiterals;
2
2
  export declare const row: import('@dineug/r-html').CSSTemplateLiterals;
3
+ export declare const grip: import('@dineug/r-html').CSSTemplateLiterals;
4
+ export declare const gripSlot: import('@dineug/r-html').CSSTemplateLiterals;
3
5
  export declare const orderType: import('@dineug/r-html').CSSTemplateLiterals;
6
+ export declare const mark: import('@dineug/r-html').CSSTemplateLiterals;
4
7
  //# sourceMappingURL=IndexesColumn.styles.d.ts.map
@@ -2,7 +2,14 @@ import { FC } from '@dineug/r-html';
2
2
  import { Index } from '../../../../../internal-types';
3
3
  export type IndexesIndexProps = {
4
4
  index: Index;
5
+ /**
6
+ * The alternate key this index is, 1 for AK1, which the diagram can mark its
7
+ * columns with; 0 while it is no unique index over two columns or more.
8
+ */
9
+ alternateKey?: number;
5
10
  selected: boolean;
11
+ /** The editor's readonly mode: the row only selects, with no remove button and a name it cannot type in. */
12
+ readonly?: boolean;
6
13
  onSelect: (index: Index | null) => void;
7
14
  };
8
15
  declare const IndexesIndex: FC<IndexesIndexProps>;
@@ -1,5 +1,11 @@
1
+ /**
2
+ * A row of the canvas table's height. Its remove button stays in sight, in
3
+ * the lock's place on a key row, and a hovered row lines its name field.
4
+ */
1
5
  export declare const row: import('@dineug/r-html').CSSTemplateLiterals;
6
+ export declare const nameCell: import('@dineug/r-html').CSSTemplateLiterals;
2
7
  export declare const input: import('@dineug/r-html').CSSTemplateLiterals;
3
8
  export declare const unique: import('@dineug/r-html').CSSTemplateLiterals;
9
+ export declare const alternateKey: import('@dineug/r-html').CSSTemplateLiterals;
4
10
  export declare const iconButton: import('@dineug/r-html').CSSTemplateLiterals;
5
11
  //# sourceMappingURL=IndexesIndex.styles.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { FC } from '@dineug/r-html';
2
+ import { ColumnKey } from '../../../../../utils/tableKeys';
3
+ export type IndexesKeyProps = {
4
+ columnKey: ColumnKey;
5
+ selected: boolean;
6
+ onSelect: (columnKey: ColumnKey) => void;
7
+ };
8
+ /**
9
+ * A key the table's columns declare, listed beside the indexes so every key
10
+ * shows in one place. A lock stands where an index has its remove button:
11
+ * selecting it only shows its columns, and the columns are where it changes.
12
+ */
13
+ declare const IndexesKey: FC<IndexesKeyProps>;
14
+ export default IndexesKey;
15
+ //# sourceMappingURL=IndexesKey.d.ts.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * An index row's box, picked as an index is: a bar along its left edge
3
+ * carries the selection where the light theme's tint is too faint alone.
4
+ */
5
+ export declare const row: import('@dineug/r-html').CSSTemplateLiterals;
6
+ /**
7
+ * A filled tag, where an index row has its UQ toggle and as wide, so the
8
+ * names start in one line; filled, it reads as a label and never as a toggle.
9
+ */
10
+ export declare const tag: import('@dineug/r-html').CSSTemplateLiterals;
11
+ export declare const name: import('@dineug/r-html').CSSTemplateLiterals;
12
+ export declare const lock: import('@dineug/r-html').CSSTemplateLiterals;
13
+ //# sourceMappingURL=IndexesKey.styles.d.ts.map
@@ -22,7 +22,7 @@ export interface ErdEditorElement extends ErdEditorProps, HTMLElement {
22
22
  setInitialValue: (value: string) => void;
23
23
  setPresetTheme: (themeOptions: Partial<ThemeOptions>) => void;
24
24
  setTheme: (theme: Partial<ThemeType>) => void;
25
- setKeyBindingMap: (keyBindingMap: Partial<Omit<KeyBindingMap, typeof KeyBindingName.edit | typeof KeyBindingName.stop | typeof KeyBindingName.search | typeof KeyBindingName.undo | typeof KeyBindingName.redo | typeof KeyBindingName.zoomIn | typeof KeyBindingName.zoomOut | typeof KeyBindingName.zoomReset>>) => void;
25
+ setKeyBindingMap: (keyBindingMap: Partial<Omit<KeyBindingMap, typeof KeyBindingName.edit | typeof KeyBindingName.stop | typeof KeyBindingName.undo | typeof KeyBindingName.redo | typeof KeyBindingName.zoomIn | typeof KeyBindingName.zoomOut | typeof KeyBindingName.zoomReset>>) => void;
26
26
  setSchemaSQL: (value: string) => void;
27
27
  setSchemaGraphQL: (value: string) => void;
28
28
  setSchemaDBML: (value: string) => void;
@@ -0,0 +1,13 @@
1
+ import { FC } from '@dineug/r-html';
2
+ export type FindReplaceProps = {
3
+ readonly: boolean;
4
+ };
5
+ /** How many result rows the list draws at once; the rest are reached by moving through them. */
6
+ export declare const MATCH_ROW_LIMIT = 200;
7
+ /** The rows drawn for a list longer than the limit: a window kept around the current match. */
8
+ export declare function rowWindow(current: number, total: number, limit?: number): [number, number];
9
+ /** How long the panel waits for typing to pause before it searches a regular expression. */
10
+ export declare const REGEX_INPUT_DELAY = 150;
11
+ declare const FindReplace: FC<FindReplaceProps>;
12
+ export default FindReplace;
13
+ //# sourceMappingURL=FindReplace.d.ts.map
@@ -0,0 +1,27 @@
1
+ /** What the panel's box adds to the height of its controls: its padding and border, above and below. */
2
+ export declare const PANEL_CHROME_HEIGHT: number;
3
+ /**
4
+ * A panel over the top left of the canvas, clear of the minimap in the other
5
+ * corner. Its top and height are set inline, since zen mode takes the toolbar
6
+ * above it away; on a short canvas the list gives up its height first.
7
+ */
8
+ export declare const root: import('@dineug/r-html').CSSTemplateLiterals;
9
+ export declare const controls: import('@dineug/r-html').CSSTemplateLiterals;
10
+ export declare const header: import('@dineug/r-html').CSSTemplateLiterals;
11
+ export declare const row: import('@dineug/r-html').CSSTemplateLiterals;
12
+ export declare const actions: import('@dineug/r-html').CSSTemplateLiterals;
13
+ export declare const input: import('@dineug/r-html').CSSTemplateLiterals;
14
+ export declare const toggle: import('@dineug/r-html').CSSTemplateLiterals;
15
+ export declare const scopes: import('@dineug/r-html').CSSTemplateLiterals;
16
+ export declare const scope: import('@dineug/r-html').CSSTemplateLiterals;
17
+ export declare const status: import('@dineug/r-html').CSSTemplateLiterals;
18
+ export declare const count: import('@dineug/r-html').CSSTemplateLiterals;
19
+ export declare const list: import('@dineug/r-html').CSSTemplateLiterals;
20
+ export declare const match: import('@dineug/r-html').CSSTemplateLiterals;
21
+ export declare const icon: import('@dineug/r-html').CSSTemplateLiterals;
22
+ export declare const body: import('@dineug/r-html').CSSTemplateLiterals;
23
+ export declare const text: import('@dineug/r-html').CSSTemplateLiterals;
24
+ export declare const mark: import('@dineug/r-html').CSSTemplateLiterals;
25
+ export declare const location: import('@dineug/r-html').CSSTemplateLiterals;
26
+ export declare const more: import('@dineug/r-html').CSSTemplateLiterals;
27
+ //# sourceMappingURL=FindReplace.styles.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { DOMTemplateLiterals } from '@dineug/r-html';
2
+ import { FindField } from '../../utils/find-replace';
3
+ /** The icon a result row carries for the kind of text it was found in. */
4
+ export declare function fieldIcon(field: FindField, size?: number): DOMTemplateLiterals;
5
+ //# sourceMappingURL=fieldIcon.d.ts.map
@@ -0,0 +1,26 @@
1
+ import { ErdTarget } from '../erd/goToErdTarget';
2
+ import { EngineContext } from '../../engine/context';
3
+ import { GeneratorAction } from '../../engine/generator.actions';
4
+ import { RootState } from '../../engine/state';
5
+ import { FindMatch } from '../../utils/find-replace';
6
+ /**
7
+ * Where on the ERD canvas the text of a match is edited: its table, its column
8
+ * cell or its memo, with the match itself, which a cell too wide for the
9
+ * canvas is scrolled to by.
10
+ */
11
+ export declare function toErdTarget(match: FindMatch): ErdTarget;
12
+ /**
13
+ * The state as a jump measures it once a replacement is in: the field holding
14
+ * the new text at the width its reducer gives it. A memo's text sizes nothing,
15
+ * and a table or column the document no longer holds is left as it is.
16
+ */
17
+ export declare function withReplacement(state: RootState, { toWidth }: EngineContext, { field, id, tableId }: FindMatch, value: string): RootState;
18
+ /**
19
+ * The jump Replace makes to the next match, in the replacement's own dispatch.
20
+ * A batch is read against the state before it, so the jump measures the table
21
+ * the replacement widens or narrows from what the replacement writes.
22
+ *
23
+ * @param covered How far in from the left edge the panel hides the canvas.
24
+ */
25
+ export declare const showNextMatchAction$: (next: FindMatch, replaced: FindMatch, value: string, covered: number) => GeneratorAction;
26
+ //# sourceMappingURL=matchTarget.d.ts.map
@@ -0,0 +1,17 @@
1
+ import { RootState } from '../../engine/state';
2
+ /** The overlays that take the whole canvas over, under which the panel stands down and opens on nothing. */
3
+ export declare const TAKEOVERS: ("automaticTablePlacement" | "diffViewer" | "timeTravel")[];
4
+ /** Whether an overlay that takes the canvas over is up, which keeps Find and Replace shut. */
5
+ export declare const isTakenOver: ({ editor }: RootState) => boolean;
6
+ /** Whether the panel is drawn: it stands aside, still open, while a dialog it would paint over is up. */
7
+ export declare const isPanelShown: (state: RootState) => boolean;
8
+ /** How far in from the left of the canvas the panel stands, and how wide it is at most, as FindReplace.styles draws it. */
9
+ export declare const PANEL_LEFT = 16;
10
+ export declare const PANEL_WIDTH = 380;
11
+ /**
12
+ * How far in from the left edge of the canvas the panel hides it, read from
13
+ * the state rather than the panel's box, so a jump that brings the panel back
14
+ * with the ERD tab lands clear of it too. None while the panel is not drawn.
15
+ */
16
+ export declare function coveredWidth(state: RootState): number;
17
+ //# sourceMappingURL=panelLayout.d.ts.map