@sidekickdb/components 0.0.0-stage → 2.0.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.
- package/.turbo/turbo-build.log +20 -0
- package/LICENSE.md +202 -0
- package/NOTICE +27 -0
- package/README.md +93 -2
- package/app/App.css +38 -0
- package/app/App.tsx +63 -0
- package/app/index.css +18 -0
- package/app/main.tsx +10 -0
- package/dist/components/DialogContentPrimitive.d.ts +1 -0
- package/dist/components/DialogContentPrimitive.d.ts.map +1 -0
- package/dist/components/StyleMe.d.ts +15 -0
- package/dist/components/StyleMe.d.ts.map +1 -0
- package/dist/components/error-boundary.d.ts +17 -0
- package/dist/components/error-boundary.d.ts.map +1 -0
- package/dist/components/explorer/__tests__/edit-row-dialog.test.d.ts +2 -0
- package/dist/components/explorer/__tests__/edit-row-dialog.test.d.ts.map +1 -0
- package/dist/components/explorer/__tests__/format-value.test.d.ts +2 -0
- package/dist/components/explorer/__tests__/format-value.test.d.ts.map +1 -0
- package/dist/components/explorer/edit-namespace-dialog.d.ts +17 -0
- package/dist/components/explorer/edit-namespace-dialog.d.ts.map +1 -0
- package/dist/components/explorer/edit-row-dialog.d.ts +15 -0
- package/dist/components/explorer/edit-row-dialog.d.ts.map +1 -0
- package/dist/components/explorer/expandable-deleted-attr.d.ts +15 -0
- package/dist/components/explorer/expandable-deleted-attr.d.ts.map +1 -0
- package/dist/components/explorer/explorer-layout.d.ts +9 -0
- package/dist/components/explorer/explorer-layout.d.ts.map +1 -0
- package/dist/components/explorer/format-value.d.ts +2 -0
- package/dist/components/explorer/format-value.d.ts.map +1 -0
- package/dist/components/explorer/index.d.ts +128 -0
- package/dist/components/explorer/index.d.ts.map +1 -0
- package/dist/components/explorer/inner-explorer.d.ts +17 -0
- package/dist/components/explorer/inner-explorer.d.ts.map +1 -0
- package/dist/components/explorer/new-namespace-dialog.d.ts +10 -0
- package/dist/components/explorer/new-namespace-dialog.d.ts.map +1 -0
- package/dist/components/explorer/query-inspector.d.ts +11 -0
- package/dist/components/explorer/query-inspector.d.ts.map +1 -0
- package/dist/components/explorer/recently-deleted.d.ts +36 -0
- package/dist/components/explorer/recently-deleted.d.ts.map +1 -0
- package/dist/components/explorer/search-input.d.ts +9 -0
- package/dist/components/explorer/search-input.d.ts.map +1 -0
- package/dist/components/explorer/table-components.d.ts +16 -0
- package/dist/components/explorer/table-components.d.ts.map +1 -0
- package/dist/components/explorer/view-settings.d.ts +10 -0
- package/dist/components/explorer/view-settings.d.ts.map +1 -0
- package/dist/components/rosePineDawnTheme.d.ts +13 -0
- package/dist/components/rosePineDawnTheme.d.ts.map +1 -0
- package/dist/components/select.d.ts +16 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/toast.d.ts +4 -0
- package/dist/components/toast.d.ts.map +1 -0
- package/dist/components/ui.d.ts +349 -0
- package/dist/components/ui.d.ts.map +1 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/hooks/__tests__/explorer.test.d.ts +2 -0
- package/dist/hooks/__tests__/explorer.test.d.ts.map +1 -0
- package/dist/hooks/explorer.d.ts +33 -0
- package/dist/hooks/explorer.d.ts.map +1 -0
- package/dist/hooks/useAttrNotes.d.ts +10 -0
- package/dist/hooks/useAttrNotes.d.ts.map +1 -0
- package/dist/hooks/useClickOutside.d.ts +3 -0
- package/dist/hooks/useClickOutside.d.ts.map +1 -0
- package/dist/hooks/useColumnVisibility.d.ts +12 -0
- package/dist/hooks/useColumnVisibility.d.ts.map +1 -0
- package/dist/hooks/useEditBlobConstraints.d.ts +32 -0
- package/dist/hooks/useEditBlobConstraints.d.ts.map +1 -0
- package/dist/hooks/useExplorerHistory.d.ts +1 -0
- package/dist/hooks/useExplorerHistory.d.ts.map +1 -0
- package/dist/hooks/useIsOverflow.d.ts +6 -0
- package/dist/hooks/useIsOverflow.d.ts.map +1 -0
- package/dist/hooks/useLocalStorage.d.ts +2 -0
- package/dist/hooks/useLocalStorage.d.ts.map +1 -0
- package/dist/hooks/useMonacoJSONSchema.d.ts +3 -0
- package/dist/hooks/useMonacoJSONSchema.d.ts.map +1 -0
- package/dist/hooks/useStableDB.d.ts +7 -0
- package/dist/hooks/useStableDB.d.ts.map +1 -0
- package/dist/index.cjs +15 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9751 -0
- package/dist/schema.d.ts +5 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +241 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/format.d.ts +2 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/indexingJobs.d.ts +24 -0
- package/dist/utils/indexingJobs.d.ts.map +1 -0
- package/dist/utils/parsePermsJSON.d.ts +11 -0
- package/dist/utils/parsePermsJSON.d.ts.map +1 -0
- package/dist/utils/renames.d.ts +3 -0
- package/dist/utils/renames.d.ts.map +1 -0
- package/dist/utils/tableWidthSize.d.ts +9 -0
- package/dist/utils/tableWidthSize.d.ts.map +1 -0
- package/index.html +13 -0
- package/package.json +111 -3
- package/src/components/DialogContentPrimitive.tsx +0 -0
- package/src/components/StyleMe.tsx +97 -0
- package/src/components/error-boundary.tsx +76 -0
- package/src/components/explorer/__tests__/edit-row-dialog.test.ts +31 -0
- package/src/components/explorer/__tests__/format-value.test.ts +9 -0
- package/src/components/explorer/edit-namespace-dialog.tsx +1890 -0
- package/src/components/explorer/edit-row-dialog.tsx +1367 -0
- package/src/components/explorer/expandable-deleted-attr.tsx +170 -0
- package/src/components/explorer/explorer-layout.tsx +196 -0
- package/src/components/explorer/format-value.ts +9 -0
- package/src/components/explorer/index.tsx +280 -0
- package/src/components/explorer/inner-explorer.tsx +1524 -0
- package/src/components/explorer/new-namespace-dialog.tsx +55 -0
- package/src/components/explorer/query-inspector.tsx +395 -0
- package/src/components/explorer/recently-deleted.tsx +349 -0
- package/src/components/explorer/search-input.tsx +358 -0
- package/src/components/explorer/table-components.tsx +416 -0
- package/src/components/explorer/view-settings.tsx +76 -0
- package/src/components/rosePineDawnTheme.ts +45 -0
- package/src/components/select.tsx +198 -0
- package/src/components/toast.tsx +18 -0
- package/src/components/ui.tsx +1740 -0
- package/src/config.ts +57 -0
- package/src/hooks/__tests__/explorer.test.ts +109 -0
- package/src/hooks/explorer.tsx +137 -0
- package/src/hooks/useAttrNotes.ts +27 -0
- package/src/hooks/useClickOutside.ts +23 -0
- package/src/hooks/useColumnVisibility.ts +39 -0
- package/src/hooks/useEditBlobConstraints.ts +185 -0
- package/src/hooks/useExplorerHistory.ts +0 -0
- package/src/hooks/useIsOverflow.ts +24 -0
- package/src/hooks/useLocalStorage.ts +51 -0
- package/src/hooks/useMonacoJSONSchema.ts +41 -0
- package/src/hooks/useStableDB.ts +31 -0
- package/src/index.tsx +12 -0
- package/src/schema.ts +286 -0
- package/src/style.css +84 -0
- package/src/types.ts +359 -0
- package/src/utils/format.ts +13 -0
- package/src/utils/indexingJobs.ts +126 -0
- package/src/utils/parsePermsJSON.ts +35 -0
- package/src/utils/renames.ts +42 -0
- package/src/utils/tableWidthSize.ts +62 -0
- package/tailwind.config.cjs +48 -0
- package/tsconfig.json +22 -0
- package/vite-env.d.ts +1 -0
- package/vite.config.ts +50 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { init } from '@sidekickdb/react';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
|
|
4
|
+
type InstantReactClient = ReturnType<typeof init>;
|
|
5
|
+
export const useStableDB = ({
|
|
6
|
+
appId,
|
|
7
|
+
apiURI,
|
|
8
|
+
websocketURI,
|
|
9
|
+
adminToken,
|
|
10
|
+
}: {
|
|
11
|
+
appId: string;
|
|
12
|
+
apiURI: string;
|
|
13
|
+
websocketURI: string;
|
|
14
|
+
adminToken?: string;
|
|
15
|
+
}) => {
|
|
16
|
+
const connection = useMemo<InstantReactClient>(
|
|
17
|
+
() =>
|
|
18
|
+
init({
|
|
19
|
+
appId,
|
|
20
|
+
apiURI,
|
|
21
|
+
websocketURI,
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
__adminToken: adminToken,
|
|
24
|
+
disableValidation: true,
|
|
25
|
+
devtool: false,
|
|
26
|
+
}),
|
|
27
|
+
[appId, apiURI, websocketURI, adminToken],
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
return connection;
|
|
31
|
+
};
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as ui from './components/ui';
|
|
2
|
+
|
|
3
|
+
export { Explorer } from './components/explorer/index';
|
|
4
|
+
export type {
|
|
5
|
+
EditSchemaScreen,
|
|
6
|
+
ExplorerDialog,
|
|
7
|
+
ExplorerNav,
|
|
8
|
+
} from './components/explorer/index';
|
|
9
|
+
export { StyleMe } from './components/StyleMe';
|
|
10
|
+
|
|
11
|
+
export { ui };
|
|
12
|
+
export * from './components/ui';
|
package/src/schema.ts
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { DBAttr, SchemaAttr, SchemaNamespace } from '@lib/types';
|
|
2
|
+
import { InstantDBAttr } from '@sidekickdb/core';
|
|
3
|
+
import { InstantAPIPlatformSchema } from '@sidekickdb/platform';
|
|
4
|
+
|
|
5
|
+
// We show most attrs in the explorer except for some system attrs
|
|
6
|
+
function isVisibleAttr(attr: DBAttr) {
|
|
7
|
+
const [, namespace, label] = attr['forward-identity'];
|
|
8
|
+
return (
|
|
9
|
+
attr.catalog !== 'system' ||
|
|
10
|
+
namespace === '$users' ||
|
|
11
|
+
namespace === '$files' ||
|
|
12
|
+
namespace === '$streams'
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function dbAttrsToExplorerSchema(
|
|
17
|
+
rawAttrs: Record<string, DBAttr>,
|
|
18
|
+
): SchemaNamespace[] {
|
|
19
|
+
const nsMap: Record<
|
|
20
|
+
string,
|
|
21
|
+
{ id: string; name: string; attrs: Record<string, SchemaAttr> }
|
|
22
|
+
> = {};
|
|
23
|
+
|
|
24
|
+
const oAttrs: Record<string, DBAttr> = {};
|
|
25
|
+
for (const [id, attrDesc] of Object.entries(rawAttrs)) {
|
|
26
|
+
if (!isVisibleAttr(attrDesc)) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
oAttrs[id] = attrDesc;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
for (const attrDesc of Object.values(oAttrs)) {
|
|
33
|
+
const [, namespace] = attrDesc['forward-identity'];
|
|
34
|
+
|
|
35
|
+
if (nsMap[namespace]) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
nsMap[namespace] = { id: namespace, name: namespace, attrs: {} };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
for (const attrDesc of Object.values(oAttrs)) {
|
|
43
|
+
const linkConfig = {
|
|
44
|
+
forward: {
|
|
45
|
+
id: attrDesc['forward-identity'][0],
|
|
46
|
+
namespace: attrDesc['forward-identity'][1],
|
|
47
|
+
attr: attrDesc['forward-identity'][2],
|
|
48
|
+
nsMap: nsMap[attrDesc['forward-identity'][1]],
|
|
49
|
+
},
|
|
50
|
+
reverse: attrDesc['reverse-identity']
|
|
51
|
+
? {
|
|
52
|
+
id: attrDesc['reverse-identity'][0],
|
|
53
|
+
namespace: attrDesc['reverse-identity'][1],
|
|
54
|
+
attr: attrDesc['reverse-identity'][2],
|
|
55
|
+
nsMap: nsMap[attrDesc['reverse-identity'][1]],
|
|
56
|
+
}
|
|
57
|
+
: undefined,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
if (attrDesc['forward-identity']) {
|
|
61
|
+
const [fwdId, ns, attr, fwdIndexed] = attrDesc['forward-identity'];
|
|
62
|
+
const id = attrDesc.id + '-forward';
|
|
63
|
+
|
|
64
|
+
if (fwdIndexed !== false) {
|
|
65
|
+
nsMap[ns].attrs[id] = {
|
|
66
|
+
id: attrDesc.id,
|
|
67
|
+
isForward: true,
|
|
68
|
+
namespace: ns,
|
|
69
|
+
name: attr,
|
|
70
|
+
type: attrDesc['value-type'],
|
|
71
|
+
isIndex: attrDesc['index?'],
|
|
72
|
+
isUniq: attrDesc['unique?'],
|
|
73
|
+
isRequired: attrDesc['required?'],
|
|
74
|
+
isPrimary: attrDesc['primary?'],
|
|
75
|
+
cardinality: attrDesc.cardinality,
|
|
76
|
+
linkConfig,
|
|
77
|
+
inferredTypes: attrDesc['inferred-types'],
|
|
78
|
+
catalog: attrDesc.catalog,
|
|
79
|
+
checkedDataType: attrDesc['checked-data-type'],
|
|
80
|
+
sortable: attrDesc['index?'] && !!attrDesc['checked-data-type'],
|
|
81
|
+
onDelete: attrDesc['on-delete'],
|
|
82
|
+
onDeleteReverse: attrDesc['on-delete-reverse'],
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (!attrDesc['reverse-identity']) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const [revId, revNs, revAttr, revIndexed] = attrDesc['reverse-identity'];
|
|
92
|
+
|
|
93
|
+
// TODO: sometimes reverse-identity doesn't correspond to a real namespace
|
|
94
|
+
if (nsMap[revNs] && revIndexed !== false) {
|
|
95
|
+
const idr = attrDesc.id + '-reverse';
|
|
96
|
+
nsMap[revNs].attrs[idr] = {
|
|
97
|
+
id: attrDesc.id,
|
|
98
|
+
isForward: false,
|
|
99
|
+
namespace: revNs,
|
|
100
|
+
name: revAttr,
|
|
101
|
+
type: attrDesc['value-type'],
|
|
102
|
+
isIndex: attrDesc['index?'],
|
|
103
|
+
isUniq: attrDesc['unique?'],
|
|
104
|
+
isRequired: attrDesc['required?'],
|
|
105
|
+
cardinality: attrDesc.cardinality,
|
|
106
|
+
linkConfig,
|
|
107
|
+
sortable: attrDesc['index?'] && !!attrDesc['checked-data-type'],
|
|
108
|
+
onDelete: attrDesc['on-delete'],
|
|
109
|
+
onDeleteReverse: attrDesc['on-delete-reverse'],
|
|
110
|
+
catalog: attrDesc.catalog,
|
|
111
|
+
checkedDataType: attrDesc['checked-data-type'],
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const namespaces = Object.values(nsMap)
|
|
117
|
+
.map((ns) => ({
|
|
118
|
+
...ns,
|
|
119
|
+
attrs: Object.values(ns.attrs).sort(nameComparator),
|
|
120
|
+
}))
|
|
121
|
+
.sort(nameComparator);
|
|
122
|
+
|
|
123
|
+
return namespaces;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function nameComparator(a: { name: string }, b: { name: string }) {
|
|
127
|
+
if (a.name === 'id') return -1;
|
|
128
|
+
if (b.name === 'id') return 1;
|
|
129
|
+
|
|
130
|
+
if (a.name < b.name) {
|
|
131
|
+
return -1;
|
|
132
|
+
}
|
|
133
|
+
if (a.name > b.name) {
|
|
134
|
+
return 1;
|
|
135
|
+
}
|
|
136
|
+
return 0;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// attrsToSchema
|
|
140
|
+
// Converts attrs to the instant API schema format
|
|
141
|
+
// Make sure any changes here match changes to instant.model.schema in Clojure
|
|
142
|
+
|
|
143
|
+
// Helpers
|
|
144
|
+
|
|
145
|
+
const FILES_URL_AID = '96653230-13ff-ffff-2a35-48afffffffff';
|
|
146
|
+
|
|
147
|
+
function dbAttrToInstantDBAttr(attr: DBAttr): InstantDBAttr {
|
|
148
|
+
return {
|
|
149
|
+
...attr,
|
|
150
|
+
'required?': attr['required?'] ?? false,
|
|
151
|
+
'inferred-types': attr['inferred-types'] ?? null,
|
|
152
|
+
catalog: attr['catalog'] ?? 'user',
|
|
153
|
+
'forward-identity': [
|
|
154
|
+
attr['forward-identity'][0],
|
|
155
|
+
attr['forward-identity'][1],
|
|
156
|
+
attr['forward-identity'][2],
|
|
157
|
+
],
|
|
158
|
+
'reverse-identity': attr['reverse-identity']
|
|
159
|
+
? [
|
|
160
|
+
attr['reverse-identity'][0],
|
|
161
|
+
attr['reverse-identity'][1],
|
|
162
|
+
attr['reverse-identity'][2],
|
|
163
|
+
]
|
|
164
|
+
: undefined,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Transform $files.url attribute to mark it as required
|
|
169
|
+
function transformFilesUrlAttr(attr: DBAttr) {
|
|
170
|
+
// $files.url is a derived attribute that we always return from queries.
|
|
171
|
+
// It does not exist inside our database, so it's marked as optional.
|
|
172
|
+
// However, to our users, it's seen as a required attribute, since we always
|
|
173
|
+
// provide it.
|
|
174
|
+
if (attr.id === FILES_URL_AID) {
|
|
175
|
+
return { ...attr, required: true };
|
|
176
|
+
}
|
|
177
|
+
return attr;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Remove hidden system attributes
|
|
181
|
+
function removeHidden(attrs: DBAttr[]) {
|
|
182
|
+
return attrs.filter((attr) => {
|
|
183
|
+
const catalog = attr.catalog;
|
|
184
|
+
const fwdEtype = getFwdEtype(attr);
|
|
185
|
+
const fwdLabel = getFwdLabel(attr);
|
|
186
|
+
|
|
187
|
+
// Remove system attrs except $users and $files
|
|
188
|
+
if (catalog === 'system' && !['$users', '$files'].includes(fwdEtype)) {
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Remove specific $files attributes
|
|
193
|
+
if (
|
|
194
|
+
fwdEtype === '$files' &&
|
|
195
|
+
[
|
|
196
|
+
'content-type',
|
|
197
|
+
'content-disposition',
|
|
198
|
+
'size',
|
|
199
|
+
'location-id',
|
|
200
|
+
'key-version',
|
|
201
|
+
].includes(fwdLabel)
|
|
202
|
+
) {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return true;
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function getFwdEtype(attr: DBAttr) {
|
|
211
|
+
return attr['forward-identity'][1];
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function getFwdLabel(attr: DBAttr) {
|
|
215
|
+
return attr['forward-identity'][2];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Make sure any changes here match changes to instant.model.schema in Clojure
|
|
219
|
+
// Converts attrs to the instant API schema format
|
|
220
|
+
export function attrsToSchema(attrs: DBAttr[]): InstantAPIPlatformSchema {
|
|
221
|
+
const filteredAttrs = removeHidden(attrs).map(transformFilesUrlAttr);
|
|
222
|
+
|
|
223
|
+
const grouped = filteredAttrs.reduce(
|
|
224
|
+
(acc: { ref: DBAttr[]; blob: DBAttr[] }, attr) => {
|
|
225
|
+
const valueType = attr['value-type'];
|
|
226
|
+
if (!acc[valueType]) {
|
|
227
|
+
acc[valueType] = [];
|
|
228
|
+
}
|
|
229
|
+
acc[valueType].push(attr);
|
|
230
|
+
return acc;
|
|
231
|
+
},
|
|
232
|
+
{ ref: [], blob: [] },
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
const blobs = grouped.blob || [];
|
|
236
|
+
const refs = grouped.ref || [];
|
|
237
|
+
|
|
238
|
+
const refsIndexed: InstantAPIPlatformSchema['refs'] = refs.reduce(
|
|
239
|
+
(acc: InstantAPIPlatformSchema['refs'], attr) => {
|
|
240
|
+
const {
|
|
241
|
+
'forward-identity': forwardIdentity,
|
|
242
|
+
'reverse-identity': reverseIdentity,
|
|
243
|
+
} = attr;
|
|
244
|
+
const key = JSON.stringify([
|
|
245
|
+
forwardIdentity[1],
|
|
246
|
+
forwardIdentity[2],
|
|
247
|
+
reverseIdentity?.[1],
|
|
248
|
+
reverseIdentity?.[2],
|
|
249
|
+
]);
|
|
250
|
+
acc[key] = dbAttrToInstantDBAttr(attr);
|
|
251
|
+
return acc;
|
|
252
|
+
},
|
|
253
|
+
{},
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
const blobsGrouped: Record<string, DBAttr[]> = blobs.reduce(
|
|
257
|
+
(acc: Record<string, DBAttr[]>, blob) => {
|
|
258
|
+
const entityType = getFwdEtype(blob);
|
|
259
|
+
if (!acc[entityType]) {
|
|
260
|
+
acc[entityType] = [];
|
|
261
|
+
}
|
|
262
|
+
acc[entityType].push(blob);
|
|
263
|
+
return acc;
|
|
264
|
+
},
|
|
265
|
+
{},
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
const blobsIndexed: InstantAPIPlatformSchema['blobs'] = Object.entries(
|
|
269
|
+
blobsGrouped,
|
|
270
|
+
).reduce((acc: InstantAPIPlatformSchema['blobs'], [entityType, attrs]) => {
|
|
271
|
+
acc[entityType] = attrs.reduce(
|
|
272
|
+
(attrMap: Record<string, InstantDBAttr>, attr) => {
|
|
273
|
+
const attrName = attr['forward-identity'][2];
|
|
274
|
+
attrMap[attrName] = dbAttrToInstantDBAttr(attr);
|
|
275
|
+
return attrMap;
|
|
276
|
+
},
|
|
277
|
+
{},
|
|
278
|
+
);
|
|
279
|
+
return acc;
|
|
280
|
+
}, {});
|
|
281
|
+
|
|
282
|
+
return {
|
|
283
|
+
refs: refsIndexed,
|
|
284
|
+
blobs: blobsIndexed,
|
|
285
|
+
};
|
|
286
|
+
}
|
package/src/style.css
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
@import 'tailwindcss';
|
|
2
|
+
|
|
3
|
+
@plugin '@tailwindcss/forms';
|
|
4
|
+
|
|
5
|
+
@layer base {
|
|
6
|
+
@font-face {
|
|
7
|
+
font-family: 'Switzer';
|
|
8
|
+
font-weight: normal;
|
|
9
|
+
font-style: normal;
|
|
10
|
+
font-stretch: normal;
|
|
11
|
+
src: url('/fonts/Switzer-Variable.woff2') format('woff2');
|
|
12
|
+
font-display: swap;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@theme {
|
|
17
|
+
--default-font-family: 'Switzer', var(--font-switzer), 'Georgia';
|
|
18
|
+
--default-mono-font-family:
|
|
19
|
+
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono',
|
|
20
|
+
'Courier New', monospace;
|
|
21
|
+
--font-mono: var(--default-mono-font-family);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
25
|
+
|
|
26
|
+
@layer base {
|
|
27
|
+
*,
|
|
28
|
+
::after,
|
|
29
|
+
::before,
|
|
30
|
+
::backdrop,
|
|
31
|
+
::file-selector-button {
|
|
32
|
+
border-color: oklch(92.8% 0.006 264.531);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
html {
|
|
37
|
+
--default-mono-font-family:
|
|
38
|
+
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono',
|
|
39
|
+
'Courier New', monospace;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Mirrored in www/styles/globals.css for the dashboard's non-shadow-DOM mount. */
|
|
43
|
+
@keyframes filter-shadow-r-fade {
|
|
44
|
+
from {
|
|
45
|
+
opacity: 1;
|
|
46
|
+
}
|
|
47
|
+
to {
|
|
48
|
+
opacity: 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@keyframes filter-shadow-l-fade {
|
|
53
|
+
from {
|
|
54
|
+
opacity: 0;
|
|
55
|
+
}
|
|
56
|
+
to {
|
|
57
|
+
opacity: 1;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@utility filter-shadow-r {
|
|
62
|
+
opacity: 1;
|
|
63
|
+
|
|
64
|
+
@supports (animation-timeline: scroll()) {
|
|
65
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
66
|
+
opacity: 0;
|
|
67
|
+
animation: filter-shadow-r-fade linear backwards;
|
|
68
|
+
animation-timeline: --filter-scroll;
|
|
69
|
+
animation-range: calc(100% - 16px) 100%;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@utility filter-shadow-l {
|
|
75
|
+
opacity: 0;
|
|
76
|
+
|
|
77
|
+
@supports (animation-timeline: scroll()) {
|
|
78
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
79
|
+
animation: filter-shadow-l-fade linear forwards;
|
|
80
|
+
animation-timeline: --filter-scroll;
|
|
81
|
+
animation-range: 0% 16px;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|