@constructive-io/schema-builder 0.2.0 → 0.2.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.
- package/CHANGELOG.md +11 -0
- package/dist/card-widths-CmIxkRfh.cjs +28 -0
- package/dist/card-widths-CmIxkRfh.cjs.map +1 -0
- package/dist/card-widths-pI4Kw4Xz.js +22 -0
- package/dist/card-widths-pI4Kw4Xz.js.map +1 -0
- package/dist/core-WwCS0CKu.cjs +66 -0
- package/dist/core-WwCS0CKu.cjs.map +1 -0
- package/dist/core-kx6KjxE5.js +49 -0
- package/dist/core-kx6KjxE5.js.map +1 -0
- package/dist/core.cjs +14 -212
- package/dist/core.d.cts +3 -54
- package/dist/core.d.ts +3 -54
- package/dist/core.js +3 -200
- package/dist/create-table-card-BzNKfpXO.cjs +7726 -0
- package/dist/create-table-card-BzNKfpXO.cjs.map +1 -0
- package/dist/create-table-card-pZ0Aq6rr.js +7685 -0
- package/dist/create-table-card-pZ0Aq6rr.js.map +1 -0
- package/dist/delete-confirm-dialog-Ch4tWj6B.cjs +42 -0
- package/dist/delete-confirm-dialog-Ch4tWj6B.cjs.map +1 -0
- package/dist/delete-confirm-dialog-K0AWE643.js +37 -0
- package/dist/delete-confirm-dialog-K0AWE643.js.map +1 -0
- package/dist/empty-state-card-DMn8ADRq.cjs +62 -0
- package/dist/empty-state-card-DMn8ADRq.cjs.map +1 -0
- package/dist/empty-state-card-Dnn36JVH.js +57 -0
- package/dist/empty-state-card-Dnn36JVH.js.map +1 -0
- package/dist/fields.cjs +8 -7763
- package/dist/fields.d.cts +39 -39
- package/dist/fields.d.ts +39 -39
- package/dist/fields.js +2 -7735
- package/dist/generated-types-DZMUyNBH.d.cts +27 -0
- package/dist/generated-types-DZMUyNBH.d.ts +27 -0
- package/dist/index-9h0EROdb.d.cts +56 -0
- package/dist/index-CwQ9QpxA.d.ts +7 -0
- package/dist/index-DOWB1UBK.d.cts +56 -0
- package/dist/index-DOWB1UBK.d.ts +56 -0
- package/dist/index-Dgb_e3AP.d.cts +7 -0
- package/dist/index-p_NegPQ5.d.ts +56 -0
- package/dist/index.cjs +736 -13712
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -10
- package/dist/index.d.ts +4 -10
- package/dist/index.js +725 -13680
- package/dist/index.js.map +1 -1
- package/dist/indexes-view-CJ1WQKdp.js +736 -0
- package/dist/indexes-view-CJ1WQKdp.js.map +1 -0
- package/dist/indexes-view-peIv6QUZ.cjs +759 -0
- package/dist/indexes-view-peIv6QUZ.cjs.map +1 -0
- package/dist/indexes.cjs +6 -1041
- package/dist/indexes.d.cts +27 -27
- package/dist/indexes.d.ts +27 -27
- package/dist/indexes.js +2 -1016
- package/dist/invalidate-database-entities-9DsT5NlP.cjs +2862 -0
- package/dist/invalidate-database-entities-9DsT5NlP.cjs.map +1 -0
- package/dist/invalidate-database-entities-CmmOT3S0.js +2559 -0
- package/dist/invalidate-database-entities-CmmOT3S0.js.map +1 -0
- package/dist/keyboard-activation-BQiV0scm.js +13 -0
- package/dist/keyboard-activation-BQiV0scm.js.map +1 -0
- package/dist/keyboard-activation-D-L0IU6Y.cjs +19 -0
- package/dist/keyboard-activation-D-L0IU6Y.cjs.map +1 -0
- package/dist/policies-view-BRbpbyB6.js +1018 -0
- package/dist/policies-view-BRbpbyB6.js.map +1 -0
- package/dist/policies-view-H1HTjpmv.cjs +1023 -0
- package/dist/policies-view-H1HTjpmv.cjs.map +1 -0
- package/dist/policies.cjs +10 -5939
- package/dist/policies.d.cts +55 -50
- package/dist/policies.d.ts +55 -50
- package/dist/policies.js +4 -5911
- package/dist/policy-config-form-BwyK7DGV.js +2502 -0
- package/dist/policy-config-form-BwyK7DGV.js.map +1 -0
- package/dist/policy-config-form-CefFo6Fw.cjs +2629 -0
- package/dist/policy-config-form-CefFo6Fw.cjs.map +1 -0
- package/dist/policy-types-D_sYWb-b.d.cts +81 -0
- package/dist/policy-types-D_sYWb-b.d.ts +81 -0
- package/dist/query-BmN_qO0W.js +171 -0
- package/dist/query-BmN_qO0W.js.map +1 -0
- package/dist/query-DU-KZleN.cjs +212 -0
- package/dist/query-DU-KZleN.cjs.map +1 -0
- package/dist/relationships-view-B5TAcPHU.cjs +2452 -0
- package/dist/relationships-view-B5TAcPHU.cjs.map +1 -0
- package/dist/relationships-view-DbwFh5r-.js +2417 -0
- package/dist/relationships-view-DbwFh5r-.js.map +1 -0
- package/dist/relationships.cjs +9 -4328
- package/dist/relationships.d.cts +93 -92
- package/dist/relationships.d.ts +93 -92
- package/dist/relationships.js +2 -4300
- package/dist/rolldown-runtime-D_qnwXdH.cjs +35 -0
- package/dist/schema-builder-sidebar-Ctu621Vw.cjs +604 -0
- package/dist/schema-builder-sidebar-Ctu621Vw.cjs.map +1 -0
- package/dist/schema-builder-sidebar-VR-Ctidc.js +593 -0
- package/dist/schema-builder-sidebar-VR-Ctidc.js.map +1 -0
- package/dist/table-editor-C-hHz3DJ.cjs +1935 -0
- package/dist/table-editor-C-hHz3DJ.cjs.map +1 -0
- package/dist/table-editor-IVp3B4nG.js +1906 -0
- package/dist/table-editor-IVp3B4nG.js.map +1 -0
- package/dist/tables.cjs +6 -5643
- package/dist/tables.d.cts +22 -21
- package/dist/tables.d.ts +22 -21
- package/dist/tables.js +3 -5618
- package/dist/testing.cjs +63 -62
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +4 -4
- package/dist/testing.d.ts +4 -4
- package/dist/testing.js +62 -61
- package/dist/testing.js.map +1 -1
- package/dist/types-GUrH1Qny.d.cts +200 -0
- package/dist/types-GUrH1Qny.d.ts +200 -0
- package/dist/use-update-table-C7v3gRyG.cjs +291 -0
- package/dist/use-update-table-C7v3gRyG.cjs.map +1 -0
- package/dist/use-update-table-Dz6knGoH.js +244 -0
- package/dist/use-update-table-Dz6knGoH.js.map +1 -0
- package/package.json +6 -6
- package/dist/core.cjs.map +0 -1
- package/dist/core.js.map +0 -1
- package/dist/fields.cjs.map +0 -1
- package/dist/fields.js.map +0 -1
- package/dist/generated-types-CnAlqHU_.d.cts +0 -25
- package/dist/generated-types-CnAlqHU_.d.ts +0 -25
- package/dist/indexes.cjs.map +0 -1
- package/dist/indexes.js.map +0 -1
- package/dist/policies.cjs.map +0 -1
- package/dist/policies.js.map +0 -1
- package/dist/policy-types-CEYAR5TN.d.cts +0 -79
- package/dist/policy-types-CEYAR5TN.d.ts +0 -79
- package/dist/relationships.cjs.map +0 -1
- package/dist/relationships.js.map +0 -1
- package/dist/tables.cjs.map +0 -1
- package/dist/tables.js.map +0 -1
- package/dist/types-Du86atZ8.d.cts +0 -199
- package/dist/types-Du86atZ8.d.ts +0 -199
- package/dist/types-bX2dCrdl.d.cts +0 -52
- package/dist/types-bX2dCrdl.d.ts +0 -52
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/types.d.ts
|
|
3
|
+
interface SchemaBuilderScope {
|
|
4
|
+
orgId: string;
|
|
5
|
+
databaseId: string;
|
|
6
|
+
userId?: string | null;
|
|
7
|
+
}
|
|
8
|
+
type SchemaBuilderColorMode = 'light' | 'dark';
|
|
9
|
+
interface SchemaBuilderSidebarSections {
|
|
10
|
+
app: boolean;
|
|
11
|
+
system: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface SchemaBuilderPreferences {
|
|
14
|
+
sidebarSectionsExpanded: SchemaBuilderSidebarSections;
|
|
15
|
+
showSystemTablesInSidebar: boolean;
|
|
16
|
+
showSystemTablesInVisualizer: boolean;
|
|
17
|
+
sidebarPinned: boolean;
|
|
18
|
+
typesLibraryExpanded: boolean;
|
|
19
|
+
}
|
|
20
|
+
declare const DEFAULT_SCHEMA_BUILDER_PREFERENCES: Readonly<SchemaBuilderPreferences>;
|
|
21
|
+
interface SchemaBuilderField {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
type?: string | null;
|
|
25
|
+
description?: string | null;
|
|
26
|
+
isNullable?: boolean | null;
|
|
27
|
+
isPrimaryKey?: boolean | null;
|
|
28
|
+
isUnique?: boolean | null;
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
}
|
|
31
|
+
interface SchemaBuilderTable {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
label?: string | null;
|
|
35
|
+
description?: string | null;
|
|
36
|
+
category?: string | null;
|
|
37
|
+
schemaId?: string | null;
|
|
38
|
+
fields?: readonly SchemaBuilderField[];
|
|
39
|
+
[key: string]: unknown;
|
|
40
|
+
}
|
|
41
|
+
interface SchemaBuilderSchema {
|
|
42
|
+
id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
label?: string | null;
|
|
45
|
+
tables?: readonly SchemaBuilderTable[];
|
|
46
|
+
[key: string]: unknown;
|
|
47
|
+
}
|
|
48
|
+
interface SchemaBuilderIndex {
|
|
49
|
+
id: string;
|
|
50
|
+
name: string;
|
|
51
|
+
tableId?: string | null;
|
|
52
|
+
fieldIds?: readonly string[];
|
|
53
|
+
isUnique?: boolean | null;
|
|
54
|
+
[key: string]: unknown;
|
|
55
|
+
}
|
|
56
|
+
interface SchemaBuilderPolicy {
|
|
57
|
+
id: string;
|
|
58
|
+
name: string;
|
|
59
|
+
tableId?: string | null;
|
|
60
|
+
command?: string | null;
|
|
61
|
+
[key: string]: unknown;
|
|
62
|
+
}
|
|
63
|
+
interface SchemaBuilderRelationship {
|
|
64
|
+
id: string;
|
|
65
|
+
sourceTableId?: string | null;
|
|
66
|
+
targetTableId?: string | null;
|
|
67
|
+
[key: string]: unknown;
|
|
68
|
+
}
|
|
69
|
+
interface SchemaBuilderOperationContext {
|
|
70
|
+
scope: SchemaBuilderScope;
|
|
71
|
+
signal?: AbortSignal;
|
|
72
|
+
/** Generated-SDK registry adapters forward requested result fields here. */
|
|
73
|
+
selection?: Readonly<Record<string, unknown>>;
|
|
74
|
+
}
|
|
75
|
+
type SchemaBuilderVariables = object;
|
|
76
|
+
type SchemaBuilderOperation<TVariables extends SchemaBuilderVariables = SchemaBuilderVariables, TResult = unknown> = (variables: TVariables, context: SchemaBuilderOperationContext) => Promise<TResult>;
|
|
77
|
+
type SchemaBuilderCollection<T> = readonly T[] | {
|
|
78
|
+
nodes?: readonly T[] | null;
|
|
79
|
+
totalCount?: number | null;
|
|
80
|
+
};
|
|
81
|
+
interface SchemaBuilderCoreCapabilities {
|
|
82
|
+
apiSchemas: SchemaBuilderOperation;
|
|
83
|
+
apis: SchemaBuilderOperation;
|
|
84
|
+
databases: SchemaBuilderOperation;
|
|
85
|
+
fields: SchemaBuilderOperation;
|
|
86
|
+
foreignKeyConstraints: SchemaBuilderOperation;
|
|
87
|
+
indices: SchemaBuilderOperation;
|
|
88
|
+
policies: SchemaBuilderOperation;
|
|
89
|
+
primaryKeyConstraints: SchemaBuilderOperation;
|
|
90
|
+
schemas: SchemaBuilderOperation;
|
|
91
|
+
table: SchemaBuilderOperation;
|
|
92
|
+
tables: SchemaBuilderOperation;
|
|
93
|
+
uniqueConstraints: SchemaBuilderOperation;
|
|
94
|
+
users: SchemaBuilderOperation;
|
|
95
|
+
}
|
|
96
|
+
interface SchemaBuilderFieldsCapabilities {
|
|
97
|
+
createField: SchemaBuilderOperation;
|
|
98
|
+
createPrimaryKeyConstraint: SchemaBuilderOperation;
|
|
99
|
+
createUniqueConstraint: SchemaBuilderOperation;
|
|
100
|
+
deleteField: SchemaBuilderOperation;
|
|
101
|
+
deletePrimaryKeyConstraint: SchemaBuilderOperation;
|
|
102
|
+
deleteUniqueConstraint: SchemaBuilderOperation;
|
|
103
|
+
updateField: SchemaBuilderOperation;
|
|
104
|
+
updatePrimaryKeyConstraint: SchemaBuilderOperation;
|
|
105
|
+
}
|
|
106
|
+
interface SchemaBuilderRelationshipsCapabilities {
|
|
107
|
+
createField: SchemaBuilderOperation;
|
|
108
|
+
createForeignKeyConstraint: SchemaBuilderOperation;
|
|
109
|
+
createPrimaryKeyConstraint: SchemaBuilderOperation;
|
|
110
|
+
createRelationProvision: SchemaBuilderOperation;
|
|
111
|
+
createTable: SchemaBuilderOperation;
|
|
112
|
+
createUniqueConstraint: SchemaBuilderOperation;
|
|
113
|
+
deleteForeignKeyConstraint: SchemaBuilderOperation;
|
|
114
|
+
relationProvisions: SchemaBuilderOperation;
|
|
115
|
+
updateForeignKeyConstraint: SchemaBuilderOperation;
|
|
116
|
+
}
|
|
117
|
+
interface SchemaBuilderIndexesCapabilities {
|
|
118
|
+
createIndex: SchemaBuilderOperation;
|
|
119
|
+
deleteIndex: SchemaBuilderOperation;
|
|
120
|
+
updateIndex: SchemaBuilderOperation;
|
|
121
|
+
}
|
|
122
|
+
interface SchemaBuilderPoliciesCapabilities {
|
|
123
|
+
appPermissions: SchemaBuilderOperation;
|
|
124
|
+
createField: SchemaBuilderOperation;
|
|
125
|
+
createSecureTableProvision: SchemaBuilderOperation;
|
|
126
|
+
createTable: SchemaBuilderOperation;
|
|
127
|
+
createTableGrant: SchemaBuilderOperation;
|
|
128
|
+
deletePolicy: SchemaBuilderOperation;
|
|
129
|
+
fields: SchemaBuilderOperation;
|
|
130
|
+
orgPermissions: SchemaBuilderOperation;
|
|
131
|
+
tables: SchemaBuilderOperation;
|
|
132
|
+
updatePolicy: SchemaBuilderOperation;
|
|
133
|
+
}
|
|
134
|
+
interface SchemaBuilderTablesCapabilities {
|
|
135
|
+
deleteTable: SchemaBuilderOperation;
|
|
136
|
+
updateTable: SchemaBuilderOperation;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Imperative data boundary owned by the host. Each feature is isolated so a
|
|
140
|
+
* partial registry install can provide only the capabilities it consumes.
|
|
141
|
+
*/
|
|
142
|
+
interface SchemaBuilderAdapter {
|
|
143
|
+
core: SchemaBuilderCoreCapabilities;
|
|
144
|
+
fields: SchemaBuilderFieldsCapabilities;
|
|
145
|
+
relationships: SchemaBuilderRelationshipsCapabilities;
|
|
146
|
+
indexes: SchemaBuilderIndexesCapabilities;
|
|
147
|
+
policies: SchemaBuilderPoliciesCapabilities;
|
|
148
|
+
tables: SchemaBuilderTablesCapabilities;
|
|
149
|
+
}
|
|
150
|
+
type SchemaBuilderFeature = keyof SchemaBuilderAdapter;
|
|
151
|
+
type SchemaBuilderCoreTabId = 'editor' | 'relationships' | 'indexes' | 'security';
|
|
152
|
+
interface SchemaBuilderNavigationTarget {
|
|
153
|
+
href: string;
|
|
154
|
+
replace?: boolean;
|
|
155
|
+
}
|
|
156
|
+
interface SchemaBuilderTableSelection {
|
|
157
|
+
tableId: string | null;
|
|
158
|
+
tableName: string | null;
|
|
159
|
+
}
|
|
160
|
+
interface SchemaBuilderTabRenderContext {
|
|
161
|
+
scope: SchemaBuilderScope;
|
|
162
|
+
colorMode: SchemaBuilderColorMode;
|
|
163
|
+
selectedTableId: string | null;
|
|
164
|
+
}
|
|
165
|
+
interface SchemaBuilderTab {
|
|
166
|
+
id: string;
|
|
167
|
+
label: ReactNode;
|
|
168
|
+
render: (context: SchemaBuilderTabRenderContext) => ReactNode;
|
|
169
|
+
preload?: () => void | Promise<void>;
|
|
170
|
+
/** Keeps the tab addressable without showing it in the package-owned tab list. */
|
|
171
|
+
hidden?: boolean;
|
|
172
|
+
}
|
|
173
|
+
interface SchemaBuilderInvalidationEvent {
|
|
174
|
+
scope: SchemaBuilderScope;
|
|
175
|
+
feature: SchemaBuilderFeature;
|
|
176
|
+
operation: string;
|
|
177
|
+
}
|
|
178
|
+
interface SchemaBuilderHostOptions {
|
|
179
|
+
adapter: SchemaBuilderAdapter;
|
|
180
|
+
scope: SchemaBuilderScope;
|
|
181
|
+
colorMode: SchemaBuilderColorMode;
|
|
182
|
+
preferences: SchemaBuilderPreferences;
|
|
183
|
+
onPreferencesChange: (preferences: SchemaBuilderPreferences) => void;
|
|
184
|
+
activeTab: string;
|
|
185
|
+
onActiveTabChange: (tabId: string) => void;
|
|
186
|
+
/** Optional host-controlled table selection, such as a URL-backed table id. */
|
|
187
|
+
selectedTableId?: string | null;
|
|
188
|
+
onSelectedTableChange?: (selection: SchemaBuilderTableSelection) => void;
|
|
189
|
+
onNavigate?: (target: SchemaBuilderNavigationTarget) => void;
|
|
190
|
+
onInvalidate?: (event: SchemaBuilderInvalidationEvent) => void;
|
|
191
|
+
tabs?: readonly SchemaBuilderTab[];
|
|
192
|
+
}
|
|
193
|
+
interface SchemaBuilderProps extends SchemaBuilderHostOptions {
|
|
194
|
+
className?: string;
|
|
195
|
+
emptyState?: ReactNode;
|
|
196
|
+
}
|
|
197
|
+
declare function defineSchemaBuilderAdapter<TAdapter extends SchemaBuilderAdapter>(adapter: TAdapter): TAdapter;
|
|
198
|
+
//#endregion
|
|
199
|
+
export { SchemaBuilderTablesCapabilities as A, SchemaBuilderSchema as C, SchemaBuilderTabRenderContext as D, SchemaBuilderTab as E, defineSchemaBuilderAdapter as M, SchemaBuilderTable as O, SchemaBuilderRelationshipsCapabilities as S, SchemaBuilderSidebarSections as T, SchemaBuilderPoliciesCapabilities as _, SchemaBuilderCoreCapabilities as a, SchemaBuilderProps as b, SchemaBuilderField as c, SchemaBuilderIndex as d, SchemaBuilderIndexesCapabilities as f, SchemaBuilderOperationContext as g, SchemaBuilderOperation as h, SchemaBuilderColorMode as i, SchemaBuilderVariables as j, SchemaBuilderTableSelection as k, SchemaBuilderFieldsCapabilities as l, SchemaBuilderNavigationTarget as m, SchemaBuilderAdapter as n, SchemaBuilderCoreTabId as o, SchemaBuilderInvalidationEvent as p, SchemaBuilderCollection as r, SchemaBuilderFeature as s, DEFAULT_SCHEMA_BUILDER_PREFERENCES as t, SchemaBuilderHostOptions as u, SchemaBuilderPolicy as v, SchemaBuilderScope as w, SchemaBuilderRelationship as x, SchemaBuilderPreferences as y };
|
|
200
|
+
//# sourceMappingURL=types-GUrH1Qny.d.ts.map
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
const require_invalidate_database_entities = require('./invalidate-database-entities-9DsT5NlP.cjs');
|
|
3
|
+
let _tanstack_react_query = require("@tanstack/react-query");
|
|
4
|
+
require("zustand/react/shallow");
|
|
5
|
+
|
|
6
|
+
//#region src/schema/schema-builder-core/lib/motion/motion-config.ts
|
|
7
|
+
/**
|
|
8
|
+
* Shared motion configuration for consistent animations across the app.
|
|
9
|
+
* Based on practical animation tips from https://emilkowal.ski/ui/7-practical-animation-tips
|
|
10
|
+
*
|
|
11
|
+
* Key principles:
|
|
12
|
+
* 1. Keep UI animations under 300ms
|
|
13
|
+
* 2. Never animate from scale(0) - use 0.9+ for natural feel
|
|
14
|
+
* 3. Use custom easing curves for more impactful animations
|
|
15
|
+
* 4. Make animations origin-aware when possible
|
|
16
|
+
* 5. Use blur to smooth transitions when needed
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Standard easing curves for UI animations.
|
|
20
|
+
* Reference: https://easings.co/
|
|
21
|
+
*/
|
|
22
|
+
const easings = {
|
|
23
|
+
/** Smooth deceleration - good for elements entering the screen */
|
|
24
|
+
easeOut: [
|
|
25
|
+
.25,
|
|
26
|
+
.1,
|
|
27
|
+
.25,
|
|
28
|
+
1
|
|
29
|
+
],
|
|
30
|
+
/** Smooth acceleration - good for elements leaving the screen */
|
|
31
|
+
easeIn: [
|
|
32
|
+
.42,
|
|
33
|
+
0,
|
|
34
|
+
1,
|
|
35
|
+
1
|
|
36
|
+
],
|
|
37
|
+
/** Smooth both ways - good for hover states and toggles */
|
|
38
|
+
easeInOut: [
|
|
39
|
+
.42,
|
|
40
|
+
0,
|
|
41
|
+
.58,
|
|
42
|
+
1
|
|
43
|
+
],
|
|
44
|
+
/** Snappy entrance with soft landing - great for modals/dialogs */
|
|
45
|
+
snappy: [
|
|
46
|
+
.2,
|
|
47
|
+
0,
|
|
48
|
+
0,
|
|
49
|
+
1
|
|
50
|
+
],
|
|
51
|
+
/** Bouncy feel - use sparingly for playful interactions */
|
|
52
|
+
bounce: [
|
|
53
|
+
.34,
|
|
54
|
+
1.56,
|
|
55
|
+
.64,
|
|
56
|
+
1
|
|
57
|
+
],
|
|
58
|
+
/** Quick start, gradual stop - good for quick feedback */
|
|
59
|
+
emphasized: [
|
|
60
|
+
.4,
|
|
61
|
+
0,
|
|
62
|
+
.2,
|
|
63
|
+
1
|
|
64
|
+
],
|
|
65
|
+
/** Physical feel for exit animations */
|
|
66
|
+
physicalExit: [
|
|
67
|
+
.4,
|
|
68
|
+
0,
|
|
69
|
+
.6,
|
|
70
|
+
1
|
|
71
|
+
]
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Duration presets in seconds.
|
|
75
|
+
* Rule: UI animations should be under 300ms (0.3s)
|
|
76
|
+
*/
|
|
77
|
+
const durations = {
|
|
78
|
+
/** Instant feedback (button press, toggle) */
|
|
79
|
+
instant: .1,
|
|
80
|
+
/** Quick transitions (tooltips, small elements) */
|
|
81
|
+
fast: .15,
|
|
82
|
+
/** Standard UI transitions (modals, panels) */
|
|
83
|
+
normal: .2,
|
|
84
|
+
/** Deliberate animations (page transitions, complex reveals) */
|
|
85
|
+
slow: .3,
|
|
86
|
+
/** Maximum for UI - use rarely */
|
|
87
|
+
deliberate: .4
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Spring configurations for physics-based animations.
|
|
91
|
+
* These create more natural, organic motion.
|
|
92
|
+
*/
|
|
93
|
+
const springs = {
|
|
94
|
+
/** Snappy spring - good for quick interactions */
|
|
95
|
+
snappy: {
|
|
96
|
+
type: "spring",
|
|
97
|
+
stiffness: 400,
|
|
98
|
+
damping: 30,
|
|
99
|
+
mass: .8
|
|
100
|
+
},
|
|
101
|
+
/** Bouncy spring - good for playful elements */
|
|
102
|
+
bouncy: {
|
|
103
|
+
type: "spring",
|
|
104
|
+
stiffness: 300,
|
|
105
|
+
damping: 20,
|
|
106
|
+
mass: .6
|
|
107
|
+
},
|
|
108
|
+
/** Gentle spring - good for large elements */
|
|
109
|
+
gentle: {
|
|
110
|
+
type: "spring",
|
|
111
|
+
stiffness: 150,
|
|
112
|
+
damping: 25,
|
|
113
|
+
mass: 1
|
|
114
|
+
},
|
|
115
|
+
/** Stiff spring - good for precise movements */
|
|
116
|
+
stiff: {
|
|
117
|
+
type: "spring",
|
|
118
|
+
stiffness: 500,
|
|
119
|
+
damping: 35,
|
|
120
|
+
mass: .5
|
|
121
|
+
},
|
|
122
|
+
/** Panel/sheet animations */
|
|
123
|
+
panel: {
|
|
124
|
+
type: "spring",
|
|
125
|
+
stiffness: 150,
|
|
126
|
+
damping: 25
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Pre-configured transitions for common animation patterns.
|
|
131
|
+
*/
|
|
132
|
+
const transitions = {
|
|
133
|
+
/** Fast fade for overlays and simple elements */
|
|
134
|
+
fade: {
|
|
135
|
+
duration: durations.fast,
|
|
136
|
+
ease: easings.easeOut
|
|
137
|
+
},
|
|
138
|
+
/** Standard enter/exit for UI elements */
|
|
139
|
+
enterExit: {
|
|
140
|
+
duration: durations.normal,
|
|
141
|
+
ease: easings.easeOut
|
|
142
|
+
},
|
|
143
|
+
/** Snappy transition for interactive elements */
|
|
144
|
+
snappy: {
|
|
145
|
+
duration: durations.fast,
|
|
146
|
+
ease: easings.snappy
|
|
147
|
+
},
|
|
148
|
+
/** Panel slide transition */
|
|
149
|
+
panel: {
|
|
150
|
+
type: "spring",
|
|
151
|
+
stiffness: 150,
|
|
152
|
+
damping: 25
|
|
153
|
+
},
|
|
154
|
+
/** Exit transition with physical feel */
|
|
155
|
+
exit: {
|
|
156
|
+
type: "tween",
|
|
157
|
+
duration: durations.normal,
|
|
158
|
+
ease: easings.physicalExit
|
|
159
|
+
},
|
|
160
|
+
/** Layout animations */
|
|
161
|
+
layout: {
|
|
162
|
+
type: "spring",
|
|
163
|
+
stiffness: 300,
|
|
164
|
+
damping: 30
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region src/schema/schema-builder-core/store/app-store.ts
|
|
170
|
+
const useSidebarSections = () => require_invalidate_database_entities.useSchemaBuilderRuntimeStore((state) => state.preferences.sidebarSectionsExpanded);
|
|
171
|
+
const useSidebarSectionActions = () => {
|
|
172
|
+
const { setPreferences } = require_invalidate_database_entities.useSchemaBuilderRuntime();
|
|
173
|
+
return {
|
|
174
|
+
setSidebarSectionExpanded: (section, expanded) => setPreferences((preferences) => ({
|
|
175
|
+
...preferences,
|
|
176
|
+
sidebarSectionsExpanded: {
|
|
177
|
+
...preferences.sidebarSectionsExpanded,
|
|
178
|
+
[section]: expanded
|
|
179
|
+
}
|
|
180
|
+
})),
|
|
181
|
+
toggleSidebarSection: (section) => setPreferences((preferences) => ({
|
|
182
|
+
...preferences,
|
|
183
|
+
sidebarSectionsExpanded: {
|
|
184
|
+
...preferences.sidebarSectionsExpanded,
|
|
185
|
+
[section]: !preferences.sidebarSectionsExpanded[section]
|
|
186
|
+
}
|
|
187
|
+
})),
|
|
188
|
+
resetSidebarSections: () => setPreferences((preferences) => ({
|
|
189
|
+
...preferences,
|
|
190
|
+
sidebarSectionsExpanded: {
|
|
191
|
+
app: true,
|
|
192
|
+
system: false
|
|
193
|
+
}
|
|
194
|
+
}))
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
const useTypesLibraryExpanded = () => require_invalidate_database_entities.useSchemaBuilderRuntimeStore((state) => state.preferences.typesLibraryExpanded);
|
|
198
|
+
const useToggleTypesLibraryExpanded = () => {
|
|
199
|
+
const { setPreferences } = require_invalidate_database_entities.useSchemaBuilderRuntime();
|
|
200
|
+
return () => setPreferences((preferences) => ({
|
|
201
|
+
...preferences,
|
|
202
|
+
typesLibraryExpanded: !preferences.typesLibraryExpanded
|
|
203
|
+
}));
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/schema/schema-builder-tables/lib/gql/hooks/schema-builder/use-update-table.ts
|
|
208
|
+
/**
|
|
209
|
+
* Hook for updating a table
|
|
210
|
+
* Tier 4 wrapper: adds table re-selection after update
|
|
211
|
+
*/
|
|
212
|
+
function useUpdateTable() {
|
|
213
|
+
const queryClient = (0, _tanstack_react_query.useQueryClient)();
|
|
214
|
+
const { selectTable, selectedTableId, currentDatabase } = require_invalidate_database_entities.useSchemaBuilderSelectors();
|
|
215
|
+
const updateTableMutation = require_invalidate_database_entities.useUpdateTableMutation({ selection: { fields: {
|
|
216
|
+
id: true,
|
|
217
|
+
name: true
|
|
218
|
+
} } });
|
|
219
|
+
return (0, _tanstack_react_query.useMutation)({
|
|
220
|
+
mutationFn: async (input) => {
|
|
221
|
+
const { id, ...patchFields } = input;
|
|
222
|
+
const table = (await updateTableMutation.mutateAsync({
|
|
223
|
+
id,
|
|
224
|
+
tablePatch: patchFields
|
|
225
|
+
})).updateTable?.table;
|
|
226
|
+
if (!table?.id || !table?.name) throw new Error("Failed to update table");
|
|
227
|
+
return {
|
|
228
|
+
id: table.id,
|
|
229
|
+
name: table.name
|
|
230
|
+
};
|
|
231
|
+
},
|
|
232
|
+
onSuccess: async (updatedTable) => {
|
|
233
|
+
await require_invalidate_database_entities.invalidateDatabaseEntities(queryClient, currentDatabase?.databaseId);
|
|
234
|
+
if (updatedTable.id && updatedTable.name && selectedTableId === updatedTable.id) selectTable(updatedTable.id, updatedTable.name);
|
|
235
|
+
},
|
|
236
|
+
onError: (error) => {
|
|
237
|
+
console.error("Failed to update table:", error);
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
//#endregion
|
|
243
|
+
Object.defineProperty(exports, 'durations', {
|
|
244
|
+
enumerable: true,
|
|
245
|
+
get: function () {
|
|
246
|
+
return durations;
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
Object.defineProperty(exports, 'easings', {
|
|
250
|
+
enumerable: true,
|
|
251
|
+
get: function () {
|
|
252
|
+
return easings;
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
Object.defineProperty(exports, 'springs', {
|
|
256
|
+
enumerable: true,
|
|
257
|
+
get: function () {
|
|
258
|
+
return springs;
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
Object.defineProperty(exports, 'useSidebarSectionActions', {
|
|
262
|
+
enumerable: true,
|
|
263
|
+
get: function () {
|
|
264
|
+
return useSidebarSectionActions;
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
Object.defineProperty(exports, 'useSidebarSections', {
|
|
268
|
+
enumerable: true,
|
|
269
|
+
get: function () {
|
|
270
|
+
return useSidebarSections;
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
Object.defineProperty(exports, 'useToggleTypesLibraryExpanded', {
|
|
274
|
+
enumerable: true,
|
|
275
|
+
get: function () {
|
|
276
|
+
return useToggleTypesLibraryExpanded;
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
Object.defineProperty(exports, 'useTypesLibraryExpanded', {
|
|
280
|
+
enumerable: true,
|
|
281
|
+
get: function () {
|
|
282
|
+
return useTypesLibraryExpanded;
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
Object.defineProperty(exports, 'useUpdateTable', {
|
|
286
|
+
enumerable: true,
|
|
287
|
+
get: function () {
|
|
288
|
+
return useUpdateTable;
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
//# sourceMappingURL=use-update-table-C7v3gRyG.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-update-table-C7v3gRyG.cjs","names":["useSchemaBuilderRuntimeStore","useSchemaBuilderRuntime","useSchemaBuilderSelectors","useUpdateTableMutation","invalidateDatabaseEntities"],"sources":["../src/schema/schema-builder-core/lib/motion/motion-config.ts","../src/schema/schema-builder-core/store/app-store.ts","../src/schema/schema-builder-tables/lib/gql/hooks/schema-builder/use-update-table.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,UAAU;;CAEtB,SAAS;EAAC;EAAM;EAAK;EAAM;CAAC;;CAG5B,QAAQ;EAAC;EAAM;EAAG;EAAG;CAAC;;CAGtB,WAAW;EAAC;EAAM;EAAG;EAAM;CAAC;;CAG5B,QAAQ;E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