alinea 2.0.0-preview.7 → 2.0.0-preview.8
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/dist/.init/content/pages/welcome.json +1 -1
- package/dist/LICENSES.md +120 -120
- package/dist/adapter/next/cms.d.ts +18 -4
- package/dist/adapter/next/cms.js +125 -36
- package/dist/adapter/next/handler.d.ts +5 -1
- package/dist/adapter/next/handler.js +14 -7
- package/dist/adapter/next/node.d.ts +5 -0
- package/dist/adapter/next/node.js +16 -0
- package/dist/adapter/next/previews.d.ts +4 -1
- package/dist/adapter/next/previews.js +13 -1
- package/dist/adapter/next/renderStats.d.ts +24 -0
- package/dist/adapter/next/renderStats.js +74 -0
- package/dist/adapter/next/syncCheck.d.ts +8 -2
- package/dist/adapter/next/syncCheck.js +3 -3
- package/dist/adapter/next/with-alinea.js +0 -18
- package/dist/backend/Handler.d.ts +2 -2
- package/dist/backend/Handler.js +33 -12
- package/dist/backend/api/CreateBackend.js +15 -3
- package/dist/backend/api/DatabaseApi.js +22 -135
- package/dist/backend/api/database.js +15 -3
- package/dist/backend/resolver/ParsePreview.d.ts +2 -2
- package/dist/backend/router/NodeHandler.js +2 -0
- package/dist/backend/store/GeneratedDatabase.d.ts +5 -0
- package/dist/backend/store/GeneratedDatabase.js +31 -0
- package/dist/backend/store/GeneratedDatabaseNode.d.ts +4 -0
- package/dist/backend/store/GeneratedDatabaseNode.js +35 -0
- package/dist/backend/util/ORM.js +4 -2
- package/dist/bundled.d.ts +1470 -442
- package/dist/chunks/bun-sqlite-ZZDB7YQQ.js +18 -0
- package/dist/chunks/chunk-2BJ2IFQM.js +1085 -0
- package/dist/chunks/chunk-2PIFHEYR.js +364 -0
- package/dist/chunks/{chunk-X47OVDF3.js → chunk-2U43BB6P.js} +356 -1000
- package/dist/chunks/chunk-76VMZTLN.js +55 -0
- package/dist/chunks/chunk-A42DP5T7.js +94 -0
- package/dist/chunks/chunk-ATF42T2B.js +35 -0
- package/dist/chunks/{chunk-NWQXN4SB.js → chunk-ETBQTP2S.js} +40 -29
- package/dist/chunks/chunk-IL7FJQAY.js +94 -0
- package/dist/chunks/chunk-K62JP6HR.js +22 -0
- package/dist/chunks/chunk-K7LHQXI4.js +103 -0
- package/dist/chunks/chunk-M7KDJEGH.js +495 -0
- package/dist/chunks/chunk-N47Y62CI.js +396 -0
- package/dist/chunks/chunk-NLZLRQ5U.js +100 -0
- package/dist/chunks/chunk-QBPYWU6C.js +24 -0
- package/dist/chunks/{chunk-6P4UVRPH.js → chunk-RWWYUNVX.js} +2 -1
- package/dist/chunks/chunk-TFMUSWGG.js +605 -0
- package/dist/chunks/{chunk-I4GC3E65.js → chunk-UPY2RUZF.js} +0 -1
- package/dist/chunks/chunk-XCZXR3C2.js +112 -0
- package/dist/chunks/chunk-XTWYBWP2.js +81 -0
- package/dist/chunks/node-sqlite-7CSGL27V.js +18 -0
- package/dist/cli/Generate.js +74 -64
- package/dist/cli/Serve.js +1 -1
- package/dist/cli/bin.js +2 -1
- package/dist/cli/generate/CopyStaticFiles.js +17 -14
- package/dist/cli/generate/DevDB.d.ts +22 -5
- package/dist/cli/generate/DevDB.js +136 -24
- package/dist/cli/serve/CreateLocalServer.js +22 -4
- package/dist/cli/serve/LiveReload.d.ts +1 -1
- package/dist/cli/serve/LiveReload.js +3 -0
- package/dist/cloud/CloudRemote.js +2 -1
- package/dist/components/Calendar.js +6 -6
- package/dist/components/Checkbox.js +3 -3
- package/dist/components/ColorSwatchPicker.js +2 -2
- package/dist/components/ComboBox.js +9 -9
- package/dist/components/DateField.js +1 -1
- package/dist/components/DatePicker.js +6 -6
- package/dist/components/DateRangePicker.js +6 -6
- package/dist/components/Disclosure.js +9 -9
- package/dist/components/Label.js +5 -5
- package/dist/components/List.js +33 -33
- package/dist/components/Menu.js +3 -3
- package/dist/components/Modal.js +3 -3
- package/dist/components/MultipleSelect.js +25 -25
- package/dist/components/NumberField.js +6 -6
- package/dist/components/ProgressCircle.js +3 -3
- package/dist/components/RadioGroup.js +2 -2
- package/dist/components/SearchField.js +5 -5
- package/dist/components/Select.js +7 -7
- package/dist/components/Surface.js +2 -2
- package/dist/components/Table.js +6 -6
- package/dist/components/Tabs.js +2 -2
- package/dist/components/TextField.js +6 -6
- package/dist/components/Toggle.js +2 -2
- package/dist/components/Toolbar.js +2 -2
- package/dist/components/Tooltip.js +4 -4
- package/dist/components/Tree.d.ts +2 -1
- package/dist/components/Tree.js +5 -5
- package/dist/core/Document.js +15 -3
- package/dist/core/Entry.d.ts +3 -0
- package/dist/core/Entry.js +4 -0
- package/dist/core/EntrySeed.d.ts +19 -0
- package/dist/core/EntrySeed.js +136 -0
- package/dist/core/Field.d.ts +7 -0
- package/dist/core/Field.js +4 -0
- package/dist/core/Filter.d.ts +40 -2
- package/dist/core/Filter.js +145 -0
- package/dist/core/Graph.d.ts +9 -0
- package/dist/core/ListRow.d.ts +1 -0
- package/dist/core/ListRow.js +1 -0
- package/dist/core/Reference.d.ts +1 -0
- package/dist/core/Root.js +1 -1
- package/dist/core/Scope.d.ts +2 -0
- package/dist/core/Scope.js +16 -1
- package/dist/core/Type.d.ts +2 -1
- package/dist/core/Type.js +13 -1
- package/dist/core/db/EntryAliases.js +1 -11
- package/dist/core/db/EntryReference.d.ts +0 -6
- package/dist/core/db/IndexEvent.d.ts +2 -1
- package/dist/core/db/IndexEvent.js +11 -3
- package/dist/core/db/LinkResolver.d.ts +6 -6
- package/dist/core/db/LinkResolver.js +0 -52
- package/dist/core/db/LocalStore.d.ts +25 -0
- package/dist/core/field/ListField.js +19 -0
- package/dist/core/field/RecordField.js +8 -0
- package/dist/core/field/RichTextField.js +42 -0
- package/dist/core/field/UnionField.js +8 -0
- package/dist/core/source/FSSource.d.ts +14 -2
- package/dist/core/source/FSSource.js +58 -13
- package/dist/core/source/GitUtils.d.ts +4 -0
- package/dist/core/source/GitUtils.js +9 -10
- package/dist/core/source/GithubSource.js +22 -11
- package/dist/core/source/IndexedDBSource.d.ts +2 -1
- package/dist/core/source/IndexedDBSource.js +67 -53
- package/dist/core/source/MemorySource.js +5 -3
- package/dist/core/source/OverlaySource.d.ts +5 -2
- package/dist/core/source/OverlaySource.js +31 -3
- package/dist/core/source/Source.d.ts +3 -0
- package/dist/core/source/Source.js +15 -2
- package/dist/core/source/Tree.d.ts +10 -7
- package/dist/core/source/Tree.js +118 -70
- package/dist/core/source/Utils.js +6 -3
- package/dist/core/util/Arrays.d.ts +1 -0
- package/dist/core/util/Arrays.js +10 -0
- package/dist/core/util/Async.d.ts +7 -0
- package/dist/core/util/Async.js +15 -0
- package/dist/core/util/Checks.js +1 -1
- package/dist/core/util/EntryFilenames.d.ts +22 -1
- package/dist/core/util/EntryFilenames.js +56 -2
- package/dist/core/util/IndexedDB.d.ts +4 -0
- package/dist/core/util/IndexedDB.js +20 -0
- package/dist/core/util/Paths.js +5 -1
- package/dist/dashboard/App.js +3 -3
- package/dist/dashboard/ViewKeys.d.ts +1 -0
- package/dist/dashboard/ViewKeys.js +1 -0
- package/dist/dashboard/app/AccessDenied.js +4 -4
- package/dist/dashboard/app/ActivityStatus.js +11 -11
- package/dist/dashboard/app/AppShell.js +2 -2
- package/dist/dashboard/app/AuthView.js +9 -9
- package/dist/dashboard/app/Badge.js +2 -2
- package/dist/dashboard/app/CompactField.js +10 -10
- package/dist/dashboard/app/DashboardErrorBoundary.js +6 -6
- package/dist/dashboard/app/EntryFields.js +2 -2
- package/dist/dashboard/app/EntryHeader.js +10 -10
- package/dist/dashboard/app/EntryReferences.js +8 -8
- package/dist/dashboard/app/EntrySidebar.js +8 -8
- package/dist/dashboard/app/EntrySidebarPreview.js +11 -11
- package/dist/dashboard/app/EntryTranslationBanner.js +6 -6
- package/dist/dashboard/app/Explorer.js +44 -44
- package/dist/dashboard/app/ExplorerCards.js +30 -30
- package/dist/dashboard/app/ExplorerFileCard.js +17 -17
- package/dist/dashboard/app/ExplorerList.js +14 -14
- package/dist/dashboard/app/ExplorerModal.js +5 -5
- package/dist/dashboard/app/ExplorerTable.js +47 -47
- package/dist/dashboard/app/LinkPicker.js +2 -2
- package/dist/dashboard/app/LocaleMenu.js +6 -6
- package/dist/dashboard/app/SidebarTree.js +76 -40
- package/dist/dashboard/app/WorkspaceMenu.js +10 -10
- package/dist/dashboard/app/WorkspaceRoots.js +27 -27
- package/dist/dashboard/app/editor/FileEditor.js +24 -24
- package/dist/dashboard/app/editor/FilePreview.js +6 -6
- package/dist/dashboard/app/modals/CreateEntry.js +4 -4
- package/dist/dashboard/app/pages/EntryPage.js +15 -15
- package/dist/dashboard/app/pages/RootPage.js +3 -3
- package/dist/dashboard/app/pages/SplashPage.js +47 -47
- package/dist/dashboard/app/pages/UsersPage.js +36 -36
- package/dist/dashboard/app/ui/DashboardModal.js +17 -17
- package/dist/dashboard/app/ui/Rail.js +4 -4
- package/dist/dashboard/atoms/config.d.ts +4 -4
- package/dist/dashboard/atoms/entry.d.ts +8 -9
- package/dist/dashboard/atoms/entry.js +34 -4
- package/dist/dashboard/atoms/explorer.d.ts +2 -0
- package/dist/dashboard/atoms/explorer.js +7 -2
- package/dist/dashboard/boot/Boot.js +2 -3
- package/dist/dashboard/boot/DashboardWorker.d.ts +3 -3
- package/dist/dashboard/boot/DashboardWorker.js +78 -27
- package/dist/dashboard/boot/LoadWorker.js +2 -3
- package/dist/dashboard/icons.d.ts +2 -0
- package/dist/dashboard/icons.js +40 -0
- package/dist/dashboard/plugins/alineaFixturePlugin.js +14 -3
- package/dist/database/BrowserEntryStore.d.ts +30 -0
- package/dist/database/BrowserEntryStore.js +168 -0
- package/dist/database/DatabaseSource.d.ts +13 -0
- package/dist/database/DatabaseSource.js +25 -0
- package/dist/database/DatabaseTables.d.ts +38 -0
- package/dist/database/DatabaseTables.js +53 -0
- package/dist/database/EntryDatabase.d.ts +21 -0
- package/dist/database/EntryDatabase.js +138 -0
- package/dist/database/EntryLayer.d.ts +93 -0
- package/dist/database/EntryLayer.js +459 -0
- package/dist/database/EntryStore.d.ts +60 -0
- package/dist/database/EntryStore.js +269 -0
- package/dist/database/EntryTransaction.d.ts +33 -0
- package/dist/database/EntryTransaction.js +889 -0
- package/dist/database/EntryUrlAliases.d.ts +2 -0
- package/dist/database/EntryUrlAliases.js +69 -0
- package/dist/database/LocalDB.d.ts +39 -0
- package/dist/database/LocalDB.js +79 -0
- package/dist/database/Version.d.ts +9 -0
- package/dist/database/Version.js +13 -0
- package/dist/database/driver/RuntimeDatabase.d.ts +8 -0
- package/dist/database/driver/RuntimeDatabase.js +33 -0
- package/dist/database/driver/WasmDatabase.d.ts +8 -0
- package/dist/database/driver/WasmDatabase.js +33 -0
- package/dist/database/entry/EntryData.d.ts +13 -0
- package/dist/database/entry/EntryData.js +51 -0
- package/dist/database/entry/EntryTable.d.ts +173 -0
- package/dist/database/entry/EntryTable.js +137 -0
- package/dist/database/entry/EntryView.d.ts +22 -0
- package/dist/database/entry/EntryView.js +106 -0
- package/dist/database/query/Condition.d.ts +8 -0
- package/dist/database/query/Condition.js +117 -0
- package/dist/database/query/EntryQuery.d.ts +43 -0
- package/dist/database/query/EntryQuery.js +414 -0
- package/dist/database/query/EntryReferences.d.ts +6 -0
- package/dist/database/query/EntryReferences.js +68 -0
- package/dist/database/query/Relation.d.ts +11 -0
- package/dist/database/query/Relation.js +113 -0
- package/dist/database/query/ResolveQuery.d.ts +15 -0
- package/dist/database/query/ResolveQuery.js +154 -0
- package/dist/database/query/Search.d.ts +47 -0
- package/dist/database/query/Search.js +169 -0
- package/dist/database/sync/Derive.d.ts +8 -0
- package/dist/database/sync/Derive.js +270 -0
- package/dist/database/sync/EntryParser.d.ts +4 -0
- package/dist/database/sync/EntryParser.js +87 -0
- package/dist/database/sync/EntrySyncer.d.ts +37 -0
- package/dist/database/sync/EntrySyncer.js +117 -0
- package/dist/database/sync/Ingest.d.ts +21 -0
- package/dist/database/sync/Ingest.js +136 -0
- package/dist/database/sync/SyncQueries.d.ts +157 -0
- package/dist/database/sync/SyncQueries.js +192 -0
- package/dist/field/code/CodeField.view.js +12 -12
- package/dist/field/link/LinkField.js +23 -0
- package/dist/field/link/LinkField.view.js +41 -40
- package/dist/field/list/ListField.view.js +177 -155
- package/dist/field/metadata/MetadataField.d.ts +28 -3
- package/dist/field/metadata/MetadataField.js +44 -7
- package/dist/field/metadata/MetadataField.view.d.ts +5 -0
- package/dist/field/metadata/MetadataField.view.js +34 -19
- package/dist/field/richtext/RichTextBlock.js +2 -2
- package/dist/field/richtext/RichTextDocument.js +4 -3
- package/dist/field/richtext/RichTextExtensions.d.ts +1 -1
- package/dist/field/richtext/RichTextExtensions.js +32 -28
- package/dist/field/richtext/RichTextField.view.js +15 -6
- package/dist/field/views.js +2 -0
- package/dist/next.cjs +0 -18
- package/dist/next.d.ts +4 -3
- package/dist/next.edge.d.ts +1 -1
- package/dist/next.js +1 -2
- package/dist/picker/entry/EntryPicker.js +2 -1
- package/dist/picker/url/UrlPicker.js +1 -0
- package/dist/preview/widget.d.ts +16 -0
- package/dist/preview/widget.js +70 -1
- package/dist/query.d.ts +28 -0
- package/package.json +2 -1
- package/dist/backend/store/GeneratedSource.d.ts +0 -2
- package/dist/backend/store/GeneratedSource.js +0 -21
- package/dist/chunks/chunk-G6E35DMJ.js +0 -1997
- package/dist/core/db/EntryDB.d.ts +0 -19
- package/dist/core/db/EntryDB.js +0 -48
- package/dist/core/db/EntryIndex.d.ts +0 -143
- package/dist/core/db/EntryIndex.js +0 -2773
- package/dist/core/db/EntryReferenceIndex.d.ts +0 -21
- package/dist/core/db/EntryReferenceIndex.js +0 -131
- package/dist/core/db/EntryResolver.d.ts +0 -56
- package/dist/core/db/EntryResolver.js +0 -699
- package/dist/core/db/EntryTarget.d.ts +0 -5
- package/dist/core/db/EntryTransaction.d.ts +0 -31
- package/dist/core/db/EntryTransaction.js +0 -956
- package/dist/core/db/LocalDB.d.ts +0 -42
- package/dist/core/db/LocalDB.js +0 -127
- package/dist/core/db/TestDB.d.ts +0 -19
- package/dist/core/db/TestDB.js +0 -50
- /package/dist/core/db/{EntryTarget.js → LocalStore.js} +0 -0
|
@@ -5,6 +5,7 @@ import "../../chunks/chunk-CQ52GEHY.js";
|
|
|
5
5
|
|
|
6
6
|
// src/field/metadata/MetadataField.view.tsx
|
|
7
7
|
import { Button, Label, Surface, SurfaceContent } from "alinea/components";
|
|
8
|
+
import { Section } from "alinea/core/Section";
|
|
8
9
|
import { NodeEditor } from "alinea/dashboard/app/EntryFields";
|
|
9
10
|
import {
|
|
10
11
|
useFieldError,
|
|
@@ -17,34 +18,34 @@ import { IcRoundPublic } from "alinea/dashboard/icons";
|
|
|
17
18
|
|
|
18
19
|
// src/field/metadata/MetadataField.module.css
|
|
19
20
|
var MetadataField_default = {
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"OpenGraphPreview-title": "alinea-OpenGraphPreview-title",
|
|
23
|
-
"OpenGraphPreviewTitle": "alinea-OpenGraphPreview-title",
|
|
21
|
+
"SearchEnginePreview-og-label": "alinea-SearchEnginePreview-og-label",
|
|
22
|
+
"SearchEnginePreviewOgLabel": "alinea-SearchEnginePreview-og-label",
|
|
24
23
|
"SearchEnginePreview-link": "alinea-SearchEnginePreview-link",
|
|
25
24
|
"SearchEnginePreviewLink": "alinea-SearchEnginePreview-link",
|
|
25
|
+
"SearchEnginePreview-og": "alinea-SearchEnginePreview-og",
|
|
26
|
+
"SearchEnginePreviewOg": "alinea-SearchEnginePreview-og",
|
|
27
|
+
"OpenGraphPreview-description": "alinea-OpenGraphPreview-description",
|
|
28
|
+
"OpenGraphPreviewDescription": "alinea-OpenGraphPreview-description",
|
|
29
|
+
"OpenGraphPreview-image": "alinea-OpenGraphPreview-image",
|
|
30
|
+
"OpenGraphPreviewImage": "alinea-OpenGraphPreview-image",
|
|
26
31
|
"MetadataTimestampFieldView": "alinea-MetadataTimestampFieldView",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"SearchEnginePreview-og-label": "alinea-SearchEnginePreview-og-label",
|
|
30
|
-
"SearchEnginePreviewOgLabel": "alinea-SearchEnginePreview-og-label",
|
|
31
|
-
"MetadataUserFieldView": "alinea-MetadataUserFieldView",
|
|
32
|
+
"SearchEnginePreview-og-label-small": "alinea-SearchEnginePreview-og-label-small",
|
|
33
|
+
"SearchEnginePreviewOgLabelSmall": "alinea-SearchEnginePreview-og-label-small",
|
|
32
34
|
"SearchEnginePreview": "alinea-SearchEnginePreview",
|
|
33
|
-
"OpenGraphPreview": "alinea-OpenGraphPreview",
|
|
34
35
|
"MetadataUserFieldView-contact": "alinea-MetadataUserFieldView-contact",
|
|
35
36
|
"MetadataUserFieldViewContact": "alinea-MetadataUserFieldView-contact",
|
|
37
|
+
"OpenGraphPreview-site": "alinea-OpenGraphPreview-site",
|
|
38
|
+
"OpenGraphPreviewSite": "alinea-OpenGraphPreview-site",
|
|
39
|
+
"OpenGraphPreview-content": "alinea-OpenGraphPreview-content",
|
|
40
|
+
"OpenGraphPreviewContent": "alinea-OpenGraphPreview-content",
|
|
36
41
|
"SearchEnginePreview-description": "alinea-SearchEnginePreview-description",
|
|
37
42
|
"SearchEnginePreviewDescription": "alinea-SearchEnginePreview-description",
|
|
38
|
-
"
|
|
39
|
-
"SearchEnginePreviewOg": "alinea-SearchEnginePreview-og",
|
|
40
|
-
"SearchEnginePreview-og-label-small": "alinea-SearchEnginePreview-og-label-small",
|
|
41
|
-
"SearchEnginePreviewOgLabelSmall": "alinea-SearchEnginePreview-og-label-small",
|
|
43
|
+
"MetadataUserFieldView": "alinea-MetadataUserFieldView",
|
|
42
44
|
"MetadataUserFieldView-person": "alinea-MetadataUserFieldView-person",
|
|
43
45
|
"MetadataUserFieldViewPerson": "alinea-MetadataUserFieldView-person",
|
|
44
|
-
"OpenGraphPreview-
|
|
45
|
-
"
|
|
46
|
-
"OpenGraphPreview
|
|
47
|
-
"OpenGraphPreviewImage": "alinea-OpenGraphPreview-image"
|
|
46
|
+
"OpenGraphPreview-title": "alinea-OpenGraphPreview-title",
|
|
47
|
+
"OpenGraphPreviewTitle": "alinea-OpenGraphPreview-title",
|
|
48
|
+
"OpenGraphPreview": "alinea-OpenGraphPreview"
|
|
48
49
|
};
|
|
49
50
|
|
|
50
51
|
// src/field/metadata/MetadataField.view.tsx
|
|
@@ -84,12 +85,25 @@ function MetadataFieldView({ field }) {
|
|
|
84
85
|
{
|
|
85
86
|
node,
|
|
86
87
|
readOnly: options.readOnly,
|
|
87
|
-
type: options.fields
|
|
88
|
+
type: options.detailsSection ? options.seo : options.fields
|
|
88
89
|
}
|
|
89
90
|
),
|
|
90
91
|
/* @__PURE__ */ jsx(MetadataPreview, { metadata, origin })
|
|
91
92
|
] });
|
|
92
93
|
}
|
|
94
|
+
function MetadataDetailsView({ section }) {
|
|
95
|
+
const { field } = section[Section.Data];
|
|
96
|
+
const options = useFieldOptions(field);
|
|
97
|
+
const node = useFieldNode(field);
|
|
98
|
+
return /* @__PURE__ */ jsx(
|
|
99
|
+
NodeEditor,
|
|
100
|
+
{
|
|
101
|
+
node,
|
|
102
|
+
readOnly: options.readOnly,
|
|
103
|
+
type: options.details
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
93
107
|
function formatAuditTimestamp(value) {
|
|
94
108
|
if (value === null) return "";
|
|
95
109
|
const date = new Date(typeof value === "number" ? value * 1e3 : value);
|
|
@@ -149,6 +163,7 @@ function SearchEnginePreview({ metadata, origin: origin2 }) {
|
|
|
149
163
|
);
|
|
150
164
|
}
|
|
151
165
|
export {
|
|
166
|
+
MetadataDetailsView,
|
|
152
167
|
MetadataFieldView,
|
|
153
168
|
MetadataTimestampFieldView,
|
|
154
169
|
MetadataUserFieldView
|
|
@@ -37,9 +37,9 @@ import { memo, useMemo, useState } from "react";
|
|
|
37
37
|
|
|
38
38
|
// src/field/richtext/RichTextBlock.module.css
|
|
39
39
|
var RichTextBlock_default = {
|
|
40
|
-
"RichTextBlock": "alinea-RichTextBlock",
|
|
41
40
|
"RichTextBlock-dragHandle": "alinea-RichTextBlock-dragHandle",
|
|
42
|
-
"RichTextBlockDragHandle": "alinea-RichTextBlock-dragHandle"
|
|
41
|
+
"RichTextBlockDragHandle": "alinea-RichTextBlock-dragHandle",
|
|
42
|
+
"RichTextBlock": "alinea-RichTextBlock"
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
// src/field/richtext/RichTextBlock.tsx
|
|
@@ -18,13 +18,14 @@ import {
|
|
|
18
18
|
} from "./RichTextBlockValue.js";
|
|
19
19
|
import { isRecord } from "alinea/core/util/Objects";
|
|
20
20
|
function editorDocument(editor) {
|
|
21
|
+
const attributes = editor.extensionManager.attributes;
|
|
21
22
|
function serialize(node) {
|
|
22
23
|
const content = node.toJSON();
|
|
23
24
|
if (!node.isText) {
|
|
24
25
|
const dataAttributes = Object.fromEntries(
|
|
25
|
-
Object.entries(
|
|
26
|
-
|
|
27
|
-
)
|
|
26
|
+
Object.entries(getRenderedAttributes(node, attributes)).filter(
|
|
27
|
+
([key, value]) => key.startsWith("data-") && value != null
|
|
28
|
+
)
|
|
28
29
|
);
|
|
29
30
|
if (Object.keys(dataAttributes).length)
|
|
30
31
|
content.attrs = { ...content.attrs, ...dataAttributes };
|
|
@@ -34,7 +34,7 @@ export declare const extensions: {
|
|
|
34
34
|
Highlight: import("@tiptap/core").Mark<import("@tiptap/extension-highlight").HighlightOptions, any>;
|
|
35
35
|
UndoRedo: Extension<import("@tiptap/extensions").UndoRedoOptions, any>;
|
|
36
36
|
};
|
|
37
|
-
export declare function defaultExtensionConfig(getEntryAnchors?: () => Iterable<string>, enableImageResize?: boolean): {
|
|
37
|
+
export declare function defaultExtensionConfig(getEntryAnchors?: () => Iterable<string>, enableImageResize?: boolean, enableTables?: boolean): {
|
|
38
38
|
Document: TipTapNode<any, any>;
|
|
39
39
|
Text: TipTapNode<any, any>;
|
|
40
40
|
Paragraph: TipTapNode<import("@tiptap/extension-paragraph").ParagraphOptions, any>;
|
|
@@ -2970,40 +2970,40 @@ import Small from "./extensions/Small.js";
|
|
|
2970
2970
|
|
|
2971
2971
|
// src/field/richtext/RichTextExtensions.module.css
|
|
2972
2972
|
var RichTextExtensions_default = {
|
|
2973
|
-
"RichTextExtensions-
|
|
2974
|
-
"
|
|
2973
|
+
"RichTextExtensions-tableHeader": "alinea-RichTextExtensions-tableHeader",
|
|
2974
|
+
"RichTextExtensionsTableHeader": "alinea-RichTextExtensions-tableHeader",
|
|
2975
2975
|
"RichTextExtensions-listItem": "alinea-RichTextExtensions-listItem",
|
|
2976
2976
|
"RichTextExtensionsListItem": "alinea-RichTextExtensions-listItem",
|
|
2977
|
-
"RichTextExtensions-table": "alinea-RichTextExtensions-table",
|
|
2978
|
-
"RichTextExtensionsTable": "alinea-RichTextExtensions-table",
|
|
2979
|
-
"RichTextExtensions-bulletList": "alinea-RichTextExtensions-bulletList",
|
|
2980
|
-
"RichTextExtensionsBulletList": "alinea-RichTextExtensions-bulletList",
|
|
2981
2977
|
"RichTextExtensions-heading-level3": "alinea-RichTextExtensions-heading-level3",
|
|
2982
2978
|
"RichTextExtensionsHeadingLevel3": "alinea-RichTextExtensions-heading-level3",
|
|
2979
|
+
"RichTextExtensions-blockquote": "alinea-RichTextExtensions-blockquote",
|
|
2980
|
+
"RichTextExtensionsBlockquote": "alinea-RichTextExtensions-blockquote",
|
|
2981
|
+
"RichTextExtensions-image": "alinea-RichTextExtensions-image",
|
|
2982
|
+
"RichTextExtensionsImage": "alinea-RichTextExtensions-image",
|
|
2983
|
+
"RichTextExtensions-bulletList": "alinea-RichTextExtensions-bulletList",
|
|
2984
|
+
"RichTextExtensionsBulletList": "alinea-RichTextExtensions-bulletList",
|
|
2985
|
+
"RichTextExtensions-table": "alinea-RichTextExtensions-table",
|
|
2986
|
+
"RichTextExtensionsTable": "alinea-RichTextExtensions-table",
|
|
2987
|
+
"RichTextExtensions-heading-level5": "alinea-RichTextExtensions-heading-level5",
|
|
2988
|
+
"RichTextExtensionsHeadingLevel5": "alinea-RichTextExtensions-heading-level5",
|
|
2989
|
+
"RichTextExtensions-link": "alinea-RichTextExtensions-link",
|
|
2990
|
+
"RichTextExtensionsLink": "alinea-RichTextExtensions-link",
|
|
2991
|
+
"RichTextExtensions-anchor": "alinea-RichTextExtensions-anchor",
|
|
2992
|
+
"RichTextExtensionsAnchor": "alinea-RichTextExtensions-anchor",
|
|
2983
2993
|
"RichTextExtensions-heading-level4": "alinea-RichTextExtensions-heading-level4",
|
|
2984
2994
|
"RichTextExtensionsHeadingLevel4": "alinea-RichTextExtensions-heading-level4",
|
|
2995
|
+
"RichTextExtensions-highlight": "alinea-RichTextExtensions-highlight",
|
|
2996
|
+
"RichTextExtensionsHighlight": "alinea-RichTextExtensions-highlight",
|
|
2985
2997
|
"RichTextExtensions-heading-level1": "alinea-RichTextExtensions-heading-level1",
|
|
2986
2998
|
"RichTextExtensionsHeadingLevel1": "alinea-RichTextExtensions-heading-level1",
|
|
2987
|
-
"RichTextExtensions-
|
|
2988
|
-
"
|
|
2989
|
-
"RichTextExtensions-orderedList": "alinea-RichTextExtensions-orderedList",
|
|
2990
|
-
"RichTextExtensionsOrderedList": "alinea-RichTextExtensions-orderedList",
|
|
2991
|
-
"RichTextExtensions-tableHeader": "alinea-RichTextExtensions-tableHeader",
|
|
2992
|
-
"RichTextExtensionsTableHeader": "alinea-RichTextExtensions-tableHeader",
|
|
2999
|
+
"RichTextExtensions-heading": "alinea-RichTextExtensions-heading",
|
|
3000
|
+
"RichTextExtensionsHeading": "alinea-RichTextExtensions-heading",
|
|
2993
3001
|
"RichTextExtensions-heading-level2": "alinea-RichTextExtensions-heading-level2",
|
|
2994
3002
|
"RichTextExtensionsHeadingLevel2": "alinea-RichTextExtensions-heading-level2",
|
|
2995
|
-
"RichTextExtensions-
|
|
2996
|
-
"
|
|
3003
|
+
"RichTextExtensions-orderedList": "alinea-RichTextExtensions-orderedList",
|
|
3004
|
+
"RichTextExtensionsOrderedList": "alinea-RichTextExtensions-orderedList",
|
|
2997
3005
|
"RichTextExtensions-tableCell": "alinea-RichTextExtensions-tableCell",
|
|
2998
|
-
"RichTextExtensionsTableCell": "alinea-RichTextExtensions-tableCell"
|
|
2999
|
-
"RichTextExtensions-heading": "alinea-RichTextExtensions-heading",
|
|
3000
|
-
"RichTextExtensionsHeading": "alinea-RichTextExtensions-heading",
|
|
3001
|
-
"RichTextExtensions-anchor": "alinea-RichTextExtensions-anchor",
|
|
3002
|
-
"RichTextExtensionsAnchor": "alinea-RichTextExtensions-anchor",
|
|
3003
|
-
"RichTextExtensions-highlight": "alinea-RichTextExtensions-highlight",
|
|
3004
|
-
"RichTextExtensionsHighlight": "alinea-RichTextExtensions-highlight",
|
|
3005
|
-
"RichTextExtensions-image": "alinea-RichTextExtensions-image",
|
|
3006
|
-
"RichTextExtensionsImage": "alinea-RichTextExtensions-image"
|
|
3006
|
+
"RichTextExtensionsTableCell": "alinea-RichTextExtensions-tableCell"
|
|
3007
3007
|
};
|
|
3008
3008
|
|
|
3009
3009
|
// src/field/richtext/RichTextExtensions.ts
|
|
@@ -3046,6 +3046,10 @@ var ImageWithReferenceAttributes = src_default9.extend({
|
|
|
3046
3046
|
};
|
|
3047
3047
|
}
|
|
3048
3048
|
});
|
|
3049
|
+
var ImageWithoutNodeView = ImageWithReferenceAttributes.extend({
|
|
3050
|
+
addNodeView: null
|
|
3051
|
+
});
|
|
3052
|
+
var TableWithoutNodeView = Table.extend({ addNodeView: null });
|
|
3049
3053
|
function headingExtension(getEntryAnchors) {
|
|
3050
3054
|
return src_default6.extend({
|
|
3051
3055
|
addAttributes() {
|
|
@@ -3237,8 +3241,8 @@ var richTextBlockClipboard = Extension.create({
|
|
|
3237
3241
|
}
|
|
3238
3242
|
});
|
|
3239
3243
|
var extensions = createExtensions();
|
|
3240
|
-
function defaultExtensionConfig(getEntryAnchors, enableImageResize = false) {
|
|
3241
|
-
return createExtensions(getEntryAnchors, enableImageResize);
|
|
3244
|
+
function defaultExtensionConfig(getEntryAnchors, enableImageResize = false, enableTables = false) {
|
|
3245
|
+
return createExtensions(getEntryAnchors, enableImageResize, enableTables);
|
|
3242
3246
|
}
|
|
3243
3247
|
function defaultExtensions(getEntryAnchors) {
|
|
3244
3248
|
return Object.values(defaultExtensionConfig(getEntryAnchors));
|
|
@@ -3288,7 +3292,7 @@ function richTextBlockExtensions(schema, hosts) {
|
|
|
3288
3292
|
})
|
|
3289
3293
|
);
|
|
3290
3294
|
}
|
|
3291
|
-
function createExtensions(getEntryAnchors, enableImageResize = false) {
|
|
3295
|
+
function createExtensions(getEntryAnchors, enableImageResize = false, enableTables = false) {
|
|
3292
3296
|
return {
|
|
3293
3297
|
Document: src_default4,
|
|
3294
3298
|
Text: src_default15,
|
|
@@ -3313,7 +3317,7 @@ function createExtensions(getEntryAnchors, enableImageResize = false) {
|
|
|
3313
3317
|
HorizontalRule: src_default8.configure({
|
|
3314
3318
|
HTMLAttributes: { class: styles.RichTextExtensions.rule() }
|
|
3315
3319
|
}),
|
|
3316
|
-
Image: ImageWithReferenceAttributes.configure({
|
|
3320
|
+
Image: (enableImageResize ? ImageWithReferenceAttributes : ImageWithoutNodeView).configure({
|
|
3317
3321
|
HTMLAttributes: { class: styles.RichTextExtensions.image() },
|
|
3318
3322
|
resize: enableImageResize ? {
|
|
3319
3323
|
enabled: true,
|
|
@@ -3350,7 +3354,7 @@ function createExtensions(getEntryAnchors, enableImageResize = false) {
|
|
|
3350
3354
|
SubScript: src_default13.configure({
|
|
3351
3355
|
HTMLAttributes: { class: styles.RichTextExtensions.subscript() }
|
|
3352
3356
|
}),
|
|
3353
|
-
Table: Table.configure({
|
|
3357
|
+
Table: (enableTables ? Table : TableWithoutNodeView).configure({
|
|
3354
3358
|
HTMLAttributes: { class: styles.RichTextExtensions.table() }
|
|
3355
3359
|
}),
|
|
3356
3360
|
TableCell: TableCell.configure({
|
|
@@ -130,7 +130,8 @@ function RichTextFieldView({
|
|
|
130
130
|
configureRichTextExtensions(options.extensions, {
|
|
131
131
|
...defaultExtensionConfig(
|
|
132
132
|
getEntryAnchors,
|
|
133
|
-
Boolean(options.enableImages)
|
|
133
|
+
Boolean(options.enableImages),
|
|
134
|
+
Boolean(options.enableTables)
|
|
134
135
|
),
|
|
135
136
|
Placeholder: Placeholder.configure({
|
|
136
137
|
placeholder: options.placeholder ?? (options.inline ? "Description" : ""),
|
|
@@ -149,6 +150,7 @@ function RichTextFieldView({
|
|
|
149
150
|
getEntryAnchors,
|
|
150
151
|
hosts,
|
|
151
152
|
options.enableImages,
|
|
153
|
+
options.enableTables,
|
|
152
154
|
options.extensions,
|
|
153
155
|
options.inline,
|
|
154
156
|
options.placeholder,
|
|
@@ -184,7 +186,7 @@ function RichTextFieldView({
|
|
|
184
186
|
editable: !readOnly,
|
|
185
187
|
onCreate({ editor: editor2 }) {
|
|
186
188
|
setEditorReadOnly(editor2, readOnly);
|
|
187
|
-
lastEditorDocument.current
|
|
189
|
+
lastEditorDocument.current ??= documentStructureKey(
|
|
188
190
|
editorNodes(editorDocument(editor2), resolveBlock)
|
|
189
191
|
);
|
|
190
192
|
},
|
|
@@ -211,9 +213,14 @@ function RichTextFieldView({
|
|
|
211
213
|
if (editor) setEditorReadOnly(editor, readOnly);
|
|
212
214
|
}, [editor, readOnly]);
|
|
213
215
|
useEffect(() => {
|
|
214
|
-
if (!editor) return;
|
|
215
|
-
const current =
|
|
216
|
-
|
|
216
|
+
if (!editor || documentKey === lastEditorDocument.current) return;
|
|
217
|
+
const current = documentStructureKey(
|
|
218
|
+
editorNodes(editorDocument(editor), resolveBlock)
|
|
219
|
+
);
|
|
220
|
+
if (documentKey === current) {
|
|
221
|
+
lastEditorDocument.current = current;
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
217
224
|
const documentValue = store.get(fieldNode.value);
|
|
218
225
|
editor.commands.setContent(editorContent(documentValue, richTextImages), {
|
|
219
226
|
emitUpdate: false
|
|
@@ -332,7 +339,9 @@ function RichTextFieldView({
|
|
|
332
339
|
function setEditorReadOnly(editor, readOnly) {
|
|
333
340
|
if (editor.isDestroyed) return;
|
|
334
341
|
editor.setEditable(!readOnly);
|
|
335
|
-
|
|
342
|
+
const contentEditable = readOnly ? "false" : "plaintext-only";
|
|
343
|
+
if (editor.view.dom.contentEditable !== contentEditable)
|
|
344
|
+
editor.view.dom.contentEditable = contentEditable;
|
|
336
345
|
}
|
|
337
346
|
function RichTextBlockPortals({
|
|
338
347
|
blocksById,
|
package/dist/field/views.js
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
} from "./link/LinkField.view.js";
|
|
17
17
|
import { ListFieldView } from "./list/ListField.view.js";
|
|
18
18
|
import {
|
|
19
|
+
MetadataDetailsView,
|
|
19
20
|
MetadataFieldView,
|
|
20
21
|
MetadataTimestampFieldView,
|
|
21
22
|
MetadataUserFieldView
|
|
@@ -46,6 +47,7 @@ var views = {
|
|
|
46
47
|
[viewKeys.TabsView]: TabsView,
|
|
47
48
|
[viewKeys.NumberInput]: NumberFieldView,
|
|
48
49
|
[viewKeys.MetadataInput]: MetadataFieldView,
|
|
50
|
+
[viewKeys.MetadataDetailsView]: MetadataDetailsView,
|
|
49
51
|
[viewKeys.MetadataTimestampInput]: MetadataTimestampFieldView,
|
|
50
52
|
[viewKeys.MetadataUserInput]: MetadataUserFieldView,
|
|
51
53
|
[viewKeys.PathInput]: PathFieldView,
|
package/dist/next.cjs
CHANGED
|
@@ -103,7 +103,6 @@ function withAlinea(config = {}) {
|
|
|
103
103
|
} catch {
|
|
104
104
|
console.warn("Alinea could not determine Next.js version, assuming 15+");
|
|
105
105
|
}
|
|
106
|
-
const redirects = adminPath ? createRedirects(config, adminPath) : config.redirects;
|
|
107
106
|
const rewrites = adminPath ? createRewrites(config, adminPath, settings.handlerUrl) : config.rewrites;
|
|
108
107
|
const images = adminPath ? createImages(config, adminPath) : config.images;
|
|
109
108
|
const env = settings ? {
|
|
@@ -121,7 +120,6 @@ function withAlinea(config = {}) {
|
|
|
121
120
|
"@alinea/generated"
|
|
122
121
|
]
|
|
123
122
|
},
|
|
124
|
-
redirects,
|
|
125
123
|
rewrites,
|
|
126
124
|
images,
|
|
127
125
|
env
|
|
@@ -132,7 +130,6 @@ function withAlinea(config = {}) {
|
|
|
132
130
|
...config.serverExternalPackages ?? [],
|
|
133
131
|
"@alinea/generated"
|
|
134
132
|
],
|
|
135
|
-
redirects,
|
|
136
133
|
rewrites,
|
|
137
134
|
images,
|
|
138
135
|
env
|
|
@@ -158,21 +155,6 @@ function createImages(config, adminPath) {
|
|
|
158
155
|
]
|
|
159
156
|
};
|
|
160
157
|
}
|
|
161
|
-
function createRedirects(config, adminPath) {
|
|
162
|
-
const dev = process.env.ALINEA_DEV_SERVER;
|
|
163
|
-
if (!dev) return config.redirects;
|
|
164
|
-
return async () => {
|
|
165
|
-
const existing = config.redirects ? await config.redirects() : [];
|
|
166
|
-
return [
|
|
167
|
-
...existing,
|
|
168
|
-
{
|
|
169
|
-
permanent: true,
|
|
170
|
-
source: `${adminPath}/~dev`,
|
|
171
|
-
destination: `${dev}/~dev`
|
|
172
|
-
}
|
|
173
|
-
];
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
158
|
var emptyRewrites = {
|
|
177
159
|
beforeFiles: [],
|
|
178
160
|
afterFiles: [],
|
package/dist/next.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export
|
|
1
|
+
export type { SyncStatus } from 'alinea/adapter/next/cms';
|
|
2
|
+
export type { NextHandlerOptions } from 'alinea/adapter/next/handler';
|
|
3
|
+
export { createCMS, createHandler } from 'alinea/adapter/next/node';
|
|
4
4
|
export { withAlinea } from 'alinea/adapter/next/with-alinea';
|
|
5
|
+
export type { AfterCommitContext, BeforeCommitContext } from 'alinea/backend/Handler';
|
package/dist/next.edge.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { createCMS } from 'alinea/adapter/next/cms';
|
|
1
|
+
export { createCMS, type SyncStatus } from 'alinea/adapter/next/cms';
|
|
2
2
|
export { createHandler, type NextHandlerOptions } from 'alinea/adapter/next/handler';
|
|
3
3
|
export type { AfterCommitContext, BeforeCommitContext } from 'alinea/backend/Handler';
|
package/dist/next.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import "./chunks/chunk-CQ52GEHY.js";
|
|
2
2
|
|
|
3
3
|
// src/next.ts
|
|
4
|
-
import { createCMS } from "alinea/adapter/next/
|
|
5
|
-
import { createHandler } from "alinea/adapter/next/handler";
|
|
4
|
+
import { createCMS, createHandler } from "alinea/adapter/next/node";
|
|
6
5
|
import { withAlinea } from "alinea/adapter/next/with-alinea";
|
|
7
6
|
export {
|
|
8
7
|
createCMS,
|
|
@@ -27,6 +27,7 @@ function entryPicker(options) {
|
|
|
27
27
|
[EntryReference.anchor]: anchor,
|
|
28
28
|
[EntryReference.suffix]: suffix,
|
|
29
29
|
[ListRow.index]: index,
|
|
30
|
+
[ListRow.label]: label,
|
|
30
31
|
...fields
|
|
31
32
|
} = row;
|
|
32
33
|
for (const key of keys(fields)) delete row[key];
|
|
@@ -97,7 +98,7 @@ function selectImageAlt(alt, loader, location) {
|
|
|
97
98
|
}
|
|
98
99
|
function linkedLocalisation(loader, { workspace, root }) {
|
|
99
100
|
if (typeof workspace !== "string" || typeof root !== "string") return;
|
|
100
|
-
const workspaceConfig = loader.
|
|
101
|
+
const workspaceConfig = loader.config.workspaces[workspace];
|
|
101
102
|
const rootConfig = workspaceConfig?.[root];
|
|
102
103
|
if (!rootConfig) return;
|
|
103
104
|
const rootData = Root.data(rootConfig);
|
package/dist/preview/widget.d.ts
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import type { DOMAttributes } from 'react';
|
|
2
|
+
export interface PreviewStat {
|
|
3
|
+
kind: 'query' | 'sync';
|
|
4
|
+
summary: string;
|
|
5
|
+
/** Whether the query was answered by the bundled database or the handler. */
|
|
6
|
+
source?: 'database' | 'handler';
|
|
7
|
+
durationMs: number;
|
|
8
|
+
}
|
|
9
|
+
/** The CMS work of one render, shown in the widget. */
|
|
10
|
+
export interface PreviewStats {
|
|
11
|
+
rows: Array<PreviewStat>;
|
|
12
|
+
/** SQL statements run in this process for the render. */
|
|
13
|
+
statements: number;
|
|
14
|
+
sqlMs: number;
|
|
15
|
+
}
|
|
2
16
|
export declare function registerPreviewWidget(): void;
|
|
3
17
|
declare global {
|
|
4
18
|
namespace JSX {
|
|
@@ -7,6 +21,8 @@ declare global {
|
|
|
7
21
|
adminUrl: string;
|
|
8
22
|
editUrl: string;
|
|
9
23
|
livePreview?: 'connected' | 'warning' | 'loading';
|
|
24
|
+
/** JSON encoded PreviewStats */
|
|
25
|
+
stats?: string;
|
|
10
26
|
};
|
|
11
27
|
}
|
|
12
28
|
}
|
package/dist/preview/widget.js
CHANGED
|
@@ -3,7 +3,7 @@ import "../chunks/chunk-CQ52GEHY.js";
|
|
|
3
3
|
// src/preview/widget.ts
|
|
4
4
|
function registerPreviewWidget() {
|
|
5
5
|
if (customElements.get("alinea-preview")) return;
|
|
6
|
-
const observedAttributes = ["adminurl", "editurl", "livepreview"];
|
|
6
|
+
const observedAttributes = ["adminurl", "editurl", "livepreview", "stats"];
|
|
7
7
|
const template = `
|
|
8
8
|
<div class="previews">
|
|
9
9
|
<div class="inner">
|
|
@@ -23,6 +23,8 @@ function registerPreviewWidget() {
|
|
|
23
23
|
<path fill="#5763E6" d="M3 17.46v3.04c0 .28.22.5.5.5h3.04c.13 0 .26-.05.35-.15L17.81 9.94l-3.75-3.75L3.15 17.1c-.1.1-.15.22-.15.36M20.71 7.04a.996.996 0 0 0 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83l3.75 3.75z"/>
|
|
24
24
|
</svg>
|
|
25
25
|
</a>
|
|
26
|
+
<span class="separator stats"></span>
|
|
27
|
+
<button type="button" class="button stats" title="Click to log the queries of this page to the browser console" id="btn-stats"></button>
|
|
26
28
|
</div>
|
|
27
29
|
</div>
|
|
28
30
|
`;
|
|
@@ -115,6 +117,19 @@ function registerPreviewWidget() {
|
|
|
115
117
|
border-left: 1px solid #E4E4E7;
|
|
116
118
|
height: 16px;
|
|
117
119
|
}
|
|
120
|
+
.stats {
|
|
121
|
+
display: none;
|
|
122
|
+
}
|
|
123
|
+
.has-stats .stats {
|
|
124
|
+
display: flex;
|
|
125
|
+
}
|
|
126
|
+
.button.stats {
|
|
127
|
+
width: auto;
|
|
128
|
+
padding: 0 16px 0 12px;
|
|
129
|
+
font: inherit;
|
|
130
|
+
font-size: 13px;
|
|
131
|
+
font-variant-numeric: tabular-nums;
|
|
132
|
+
}
|
|
118
133
|
@keyframes pulse {
|
|
119
134
|
0%, 100% {
|
|
120
135
|
opacity: 1;
|
|
@@ -138,6 +153,9 @@ function registerPreviewWidget() {
|
|
|
138
153
|
#previews;
|
|
139
154
|
#adminButton;
|
|
140
155
|
#editButton;
|
|
156
|
+
#statsButton;
|
|
157
|
+
#stats;
|
|
158
|
+
#hint;
|
|
141
159
|
#disconnect;
|
|
142
160
|
disconnectedCallback() {
|
|
143
161
|
this.#disconnect();
|
|
@@ -158,8 +176,45 @@ function registerPreviewWidget() {
|
|
|
158
176
|
);
|
|
159
177
|
this.#previews?.classList.toggle("is-warning", value === "warning");
|
|
160
178
|
return;
|
|
179
|
+
case "stats":
|
|
180
|
+
this.#stats = value ? JSON.parse(value) : void 0;
|
|
181
|
+
this.#previews?.classList.toggle("has-stats", Boolean(this.#stats));
|
|
182
|
+
if (this.#statsButton) this.#statsButton.textContent = this.#summary();
|
|
183
|
+
return;
|
|
161
184
|
}
|
|
162
185
|
}
|
|
186
|
+
#summary() {
|
|
187
|
+
if (!this.#stats) return "";
|
|
188
|
+
const { queries, syncs } = split(this.#stats.rows);
|
|
189
|
+
let text = `${queries.length} ${queries.length === 1 ? "query" : "queries"} \xB7 ${total(queries)} ms`;
|
|
190
|
+
if (syncs.length) text += ` \xB7 sync ${total(syncs)} ms`;
|
|
191
|
+
return text;
|
|
192
|
+
}
|
|
193
|
+
#logStats = () => {
|
|
194
|
+
if (!this.#stats) return;
|
|
195
|
+
const { rows, statements, sqlMs } = this.#stats;
|
|
196
|
+
const table = rows.map((row) => ({
|
|
197
|
+
type: row.kind,
|
|
198
|
+
what: row.summary,
|
|
199
|
+
source: row.source ?? "",
|
|
200
|
+
ms: round(row.durationMs)
|
|
201
|
+
}));
|
|
202
|
+
if (statements)
|
|
203
|
+
table.push({
|
|
204
|
+
type: "sql",
|
|
205
|
+
what: `${statements} statements`,
|
|
206
|
+
source: "database",
|
|
207
|
+
ms: round(sqlMs)
|
|
208
|
+
});
|
|
209
|
+
console.table(table);
|
|
210
|
+
const button = this.#statsButton;
|
|
211
|
+
if (!button) return;
|
|
212
|
+
button.textContent = "Logged to console \u2193";
|
|
213
|
+
clearTimeout(this.#hint);
|
|
214
|
+
this.#hint = setTimeout(() => {
|
|
215
|
+
button.textContent = this.#summary();
|
|
216
|
+
}, 1500);
|
|
217
|
+
};
|
|
163
218
|
connectedCallback() {
|
|
164
219
|
const shadow = this.attachShadow({ mode: "open" });
|
|
165
220
|
const style = document.createElement("style");
|
|
@@ -173,6 +228,8 @@ function registerPreviewWidget() {
|
|
|
173
228
|
const inner = wrapper.querySelector(".inner");
|
|
174
229
|
this.#adminButton = previews.querySelector("#btn-admin");
|
|
175
230
|
this.#editButton = previews.querySelector("#btn-edit");
|
|
231
|
+
this.#statsButton = previews.querySelector("#btn-stats");
|
|
232
|
+
this.#statsButton.addEventListener("click", this.#logStats);
|
|
176
233
|
for (const attr of AlineaPreview.observedAttributes)
|
|
177
234
|
this.attributeChangedCallback(attr, null, this.getAttribute(attr));
|
|
178
235
|
let xPosition = 0.5;
|
|
@@ -218,6 +275,18 @@ function registerPreviewWidget() {
|
|
|
218
275
|
};
|
|
219
276
|
}
|
|
220
277
|
}
|
|
278
|
+
function split(rows) {
|
|
279
|
+
return {
|
|
280
|
+
queries: rows.filter((row) => row.kind === "query"),
|
|
281
|
+
syncs: rows.filter((row) => row.kind === "sync")
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
function round(ms) {
|
|
285
|
+
return Math.round(ms * 10) / 10;
|
|
286
|
+
}
|
|
287
|
+
function total(rows) {
|
|
288
|
+
return Math.round(rows.reduce((sum, row) => sum + row.durationMs, 0));
|
|
289
|
+
}
|
|
221
290
|
customElements.define("alinea-preview", AlineaPreview);
|
|
222
291
|
}
|
|
223
292
|
export {
|
package/dist/query.d.ts
CHANGED
|
@@ -22,7 +22,11 @@ export declare function children<Selection extends SelectionGuard = undefined, T
|
|
|
22
22
|
count?: true;
|
|
23
23
|
id?: import("./core/Filter").Condition<string>;
|
|
24
24
|
parentId?: import("./core/Filter").Condition<string | null>;
|
|
25
|
+
versionStatus?: import("./core/Filter").Condition<import("alinea/core/Entry").EntryStatus>;
|
|
26
|
+
main?: import("./core/Filter").Condition<boolean>;
|
|
25
27
|
path?: import("./core/Filter").Condition<string>;
|
|
28
|
+
filePath?: import("./core/Filter").Condition<string>;
|
|
29
|
+
seeded?: import("./core/Filter").Condition<string | null>;
|
|
26
30
|
url?: import("./core/Filter").Condition<string>;
|
|
27
31
|
alias?: import("./core/Filter").Condition<string>;
|
|
28
32
|
createdAt?: import("./core/Filter").Condition<number | null>;
|
|
@@ -57,7 +61,11 @@ export declare function parents<Selection extends SelectionGuard = undefined, Ty
|
|
|
57
61
|
count?: true;
|
|
58
62
|
id?: import("./core/Filter").Condition<string>;
|
|
59
63
|
parentId?: import("./core/Filter").Condition<string | null>;
|
|
64
|
+
versionStatus?: import("./core/Filter").Condition<import("alinea/core/Entry").EntryStatus>;
|
|
65
|
+
main?: import("./core/Filter").Condition<boolean>;
|
|
60
66
|
path?: import("./core/Filter").Condition<string>;
|
|
67
|
+
filePath?: import("./core/Filter").Condition<string>;
|
|
68
|
+
seeded?: import("./core/Filter").Condition<string | null>;
|
|
61
69
|
url?: import("./core/Filter").Condition<string>;
|
|
62
70
|
alias?: import("./core/Filter").Condition<string>;
|
|
63
71
|
createdAt?: import("./core/Filter").Condition<number | null>;
|
|
@@ -92,7 +100,11 @@ export declare function translations<Selection extends SelectionGuard = undefine
|
|
|
92
100
|
count?: true;
|
|
93
101
|
id?: import("./core/Filter").Condition<string>;
|
|
94
102
|
parentId?: import("./core/Filter").Condition<string | null>;
|
|
103
|
+
versionStatus?: import("./core/Filter").Condition<import("alinea/core/Entry").EntryStatus>;
|
|
104
|
+
main?: import("./core/Filter").Condition<boolean>;
|
|
95
105
|
path?: import("./core/Filter").Condition<string>;
|
|
106
|
+
filePath?: import("./core/Filter").Condition<string>;
|
|
107
|
+
seeded?: import("./core/Filter").Condition<string | null>;
|
|
96
108
|
url?: import("./core/Filter").Condition<string>;
|
|
97
109
|
alias?: import("./core/Filter").Condition<string>;
|
|
98
110
|
createdAt?: import("./core/Filter").Condition<number | null>;
|
|
@@ -127,7 +139,11 @@ export declare function siblings<Selection extends SelectionGuard = undefined, T
|
|
|
127
139
|
count?: true;
|
|
128
140
|
id?: import("./core/Filter").Condition<string>;
|
|
129
141
|
parentId?: import("./core/Filter").Condition<string | null>;
|
|
142
|
+
versionStatus?: import("./core/Filter").Condition<import("alinea/core/Entry").EntryStatus>;
|
|
143
|
+
main?: import("./core/Filter").Condition<boolean>;
|
|
130
144
|
path?: import("./core/Filter").Condition<string>;
|
|
145
|
+
filePath?: import("./core/Filter").Condition<string>;
|
|
146
|
+
seeded?: import("./core/Filter").Condition<string | null>;
|
|
131
147
|
url?: import("./core/Filter").Condition<string>;
|
|
132
148
|
alias?: import("./core/Filter").Condition<string>;
|
|
133
149
|
createdAt?: import("./core/Filter").Condition<number | null>;
|
|
@@ -160,7 +176,11 @@ export declare function parent<Selection extends SelectionGuard = undefined, Typ
|
|
|
160
176
|
count?: true;
|
|
161
177
|
id?: import("./core/Filter").Condition<string>;
|
|
162
178
|
parentId?: import("./core/Filter").Condition<string | null>;
|
|
179
|
+
versionStatus?: import("./core/Filter").Condition<import("alinea/core/Entry").EntryStatus>;
|
|
180
|
+
main?: import("./core/Filter").Condition<boolean>;
|
|
163
181
|
path?: import("./core/Filter").Condition<string>;
|
|
182
|
+
filePath?: import("./core/Filter").Condition<string>;
|
|
183
|
+
seeded?: import("./core/Filter").Condition<string | null>;
|
|
164
184
|
url?: import("./core/Filter").Condition<string>;
|
|
165
185
|
alias?: import("./core/Filter").Condition<string>;
|
|
166
186
|
createdAt?: import("./core/Filter").Condition<number | null>;
|
|
@@ -192,7 +212,11 @@ export declare function next<Selection extends SelectionGuard = undefined, Type
|
|
|
192
212
|
count?: true;
|
|
193
213
|
id?: import("./core/Filter").Condition<string>;
|
|
194
214
|
parentId?: import("./core/Filter").Condition<string | null>;
|
|
215
|
+
versionStatus?: import("./core/Filter").Condition<import("alinea/core/Entry").EntryStatus>;
|
|
216
|
+
main?: import("./core/Filter").Condition<boolean>;
|
|
195
217
|
path?: import("./core/Filter").Condition<string>;
|
|
218
|
+
filePath?: import("./core/Filter").Condition<string>;
|
|
219
|
+
seeded?: import("./core/Filter").Condition<string | null>;
|
|
196
220
|
url?: import("./core/Filter").Condition<string>;
|
|
197
221
|
alias?: import("./core/Filter").Condition<string>;
|
|
198
222
|
createdAt?: import("./core/Filter").Condition<number | null>;
|
|
@@ -224,7 +248,11 @@ export declare function previous<Selection extends SelectionGuard = undefined, T
|
|
|
224
248
|
count?: true;
|
|
225
249
|
id?: import("./core/Filter").Condition<string>;
|
|
226
250
|
parentId?: import("./core/Filter").Condition<string | null>;
|
|
251
|
+
versionStatus?: import("./core/Filter").Condition<import("alinea/core/Entry").EntryStatus>;
|
|
252
|
+
main?: import("./core/Filter").Condition<boolean>;
|
|
227
253
|
path?: import("./core/Filter").Condition<string>;
|
|
254
|
+
filePath?: import("./core/Filter").Condition<string>;
|
|
255
|
+
seeded?: import("./core/Filter").Condition<string | null>;
|
|
228
256
|
url?: import("./core/Filter").Condition<string>;
|
|
229
257
|
alias?: import("./core/Filter").Condition<string>;
|
|
230
258
|
createdAt?: import("./core/Filter").Condition<number | null>;
|