alinea 2.0.0-preview.13 → 2.0.0-preview.14
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/.mcp/later/dev.json +1 -1
- package/dist/.mcp/online/dev.json +1 -1
- package/dist/adapter/next/cms.js +6 -2
- package/dist/adapter/next/context.js +1 -4
- package/dist/adapter/next/handler.js +12 -1
- package/dist/backend/CommitEntries.d.ts +17 -0
- package/dist/backend/CommitEntries.js +39 -0
- package/dist/backend/Handler.d.ts +9 -0
- package/dist/backend/Handler.js +80 -20
- package/dist/backend/api/BasicAuth.js +5 -1
- package/dist/backend/api/CreateBackend.js +2 -2
- package/dist/backend/api/DatabaseApi.js +18 -5
- package/dist/backend/api/GithubApi.d.ts +13 -0
- package/dist/backend/api/GithubApi.js +170 -30
- package/dist/backend/api/database.js +2 -2
- package/dist/backend/util/Syncable.d.ts +6 -0
- package/dist/backend/util/Syncable.js +3 -1
- package/dist/bundled.d.ts +911 -151
- package/dist/chunks/{chunk-5H4D5JQL.js → chunk-2PP7WJUJ.js} +1 -11
- package/dist/chunks/{chunk-QHHMKJUO.js → chunk-7DDPSWRY.js} +465 -2
- package/dist/chunks/{chunk-HOETF6HN.js → chunk-PMGIIYDD.js} +1 -0
- package/dist/chunks/{chunk-3QFSGTGF.js → chunk-SCV3TEXM.js} +1 -1
- package/dist/chunks/{chunk-UPY2RUZF.js → chunk-TWBREZWC.js} +30 -0
- package/dist/cli/Generate.js +20 -7
- package/dist/cli/Mcp.js +1 -1
- package/dist/cli/Serve.js +1 -1
- package/dist/cli/bin.js +1 -1
- package/dist/cli/build/BuildEmitter.d.ts +5 -1
- package/dist/cli/build/BuildEmitter.js +8 -3
- package/dist/cli/generate/CompileConfig.js +10 -6
- package/dist/cli/generate/DevDB.d.ts +4 -1
- package/dist/cli/generate/DevDB.js +15 -7
- package/dist/cli/generate/GenerateDashboard.js +1 -0
- package/dist/cli/generate/MediaLocations.d.ts +18 -0
- package/dist/cli/generate/MediaLocations.js +69 -0
- package/dist/cli/serve/CreateLocalServer.js +1 -0
- package/dist/cli/serve/mcp/DevMcp.js +1 -1
- package/dist/cloud/CloudRemote.js +21 -7
- package/dist/cms.d.ts +4 -2
- package/dist/components/Alert.js +2 -2
- package/dist/components/AppShell.js +2 -2
- package/dist/components/AsyncList.d.ts +52 -0
- package/dist/components/AsyncList.js +69 -0
- package/dist/components/Breadcrumbs.js +6 -6
- package/dist/components/Button.js +4 -4
- package/dist/components/Calendar.js +18 -18
- package/dist/components/Checkbox.js +10 -10
- package/dist/components/CheckboxGroup.js +2 -2
- package/dist/components/Collapsible.js +5 -5
- package/dist/components/ColorSwatch.js +2 -2
- package/dist/components/ColorSwatchPicker.js +4 -4
- package/dist/components/ComboBox.d.ts +27 -9
- package/dist/components/ComboBox.js +40 -9
- package/dist/components/Command.js +13 -13
- package/dist/components/ContentCard.js +28 -28
- package/dist/components/ContentGrid.js +11 -11
- package/dist/components/DataList.js +1 -1
- package/dist/components/DateField.d.ts +4 -0
- package/dist/components/DateField.js +2 -2
- package/dist/components/DatePicker.js +2 -2
- package/dist/components/DateRangePicker.js +2 -2
- package/dist/components/Dialog.d.ts +14 -3
- package/dist/components/Dialog.js +38 -11
- package/dist/components/DropZone.js +6 -6
- package/dist/components/DropdownMenu.js +8 -8
- package/dist/components/Empty.js +4 -4
- package/dist/components/Field.d.ts +1 -1
- package/dist/components/Field.js +18 -12
- package/dist/components/Form.d.ts +23 -0
- package/dist/components/Form.js +64 -0
- package/dist/components/Link.d.ts +8 -1
- package/dist/components/List.js +27 -27
- package/dist/components/MediaPreview.js +5 -5
- package/dist/components/MultipleSelect.d.ts +13 -8
- package/dist/components/MultipleSelect.js +25 -25
- package/dist/components/NavRail.js +7 -7
- package/dist/components/NumberField.d.ts +5 -1
- package/dist/components/NumberField.js +6 -4
- package/dist/components/Page.js +6 -6
- package/dist/components/Popover.js +2 -2
- package/dist/components/PreviewFrame.js +8 -8
- package/dist/components/RadioGroup.js +10 -10
- package/dist/components/Resizable.js +1 -1
- package/dist/components/SearchField.js +8 -8
- package/dist/components/Select.d.ts +13 -10
- package/dist/components/Select.js +18 -32
- package/dist/components/Sheet.js +6 -6
- package/dist/components/Sidebar.js +5 -5
- package/dist/components/SortableList.js +12 -12
- package/dist/components/Spinner.js +4 -4
- package/dist/components/Stack.d.ts +20 -0
- package/dist/components/Stack.js +45 -0
- package/dist/components/Surface.js +1 -1
- package/dist/components/Switch.js +5 -5
- package/dist/components/Table.d.ts +11 -1
- package/dist/components/Table.js +81 -53
- package/dist/components/Tabs.js +6 -6
- package/dist/components/TagGroup.js +10 -10
- package/dist/components/TextField.d.ts +7 -1
- package/dist/components/TextField.js +20 -11
- package/dist/components/TimeField.d.ts +6 -1
- package/dist/components/TimeField.js +51 -26
- package/dist/components/Timestamp.js +1 -1
- package/dist/components/ToggleGroup.js +2 -2
- package/dist/components/Toolbar.js +3 -3
- package/dist/components/Tooltip.js +5 -4
- package/dist/components/Tree.js +27 -27
- package/dist/components/internal/DateControl.js +11 -11
- package/dist/components/internal/FormScope.d.ts +2 -0
- package/dist/components/internal/FormScope.js +8 -0
- package/dist/components/internal/ListBoxGroup.d.ts +12 -0
- package/dist/components/internal/ListBoxGroup.js +46 -0
- package/dist/components/internal/ListBoxOption.d.ts +2 -2
- package/dist/components/internal/ListBoxOption.js +5 -5
- package/dist/components/internal/Locale.js +2 -2
- package/dist/components/internal/PopoverSurface.js +5 -4
- package/dist/components/internal/SelectionCheckbox.js +5 -5
- package/dist/components/internal/Slot.js +1 -1
- package/dist/components/internal/ToggleButton.js +4 -4
- package/dist/components/internal/Trigger.js +2 -2
- package/dist/components/internal/useDragDrop.js +2 -2
- package/dist/components/types.d.ts +4 -0
- package/dist/components.d.ts +3 -0
- package/dist/components.js +3 -0
- package/dist/core/Client.js +12 -1
- package/dist/core/Config.d.ts +6 -0
- package/dist/core/Config.js +12 -0
- package/dist/core/DashboardEntry.d.ts +19 -0
- package/dist/core/DashboardEntry.js +0 -0
- package/dist/core/Document.d.ts +2 -2
- package/dist/core/Document.js +10 -3
- package/dist/core/EntryFields.d.ts +8 -2
- package/dist/core/Field.d.ts +5 -0
- package/dist/core/Filter.d.ts +19 -2
- package/dist/core/Filter.js +5 -0
- package/dist/core/Graph.d.ts +10 -2
- package/dist/core/Overview.d.ts +74 -5
- package/dist/core/Overview.js +1 -0
- package/dist/core/Root.js +1 -1
- package/dist/core/Scope.d.ts +5 -0
- package/dist/core/Scope.js +22 -5
- package/dist/core/Type.d.ts +25 -6
- package/dist/core/Type.js +25 -7
- package/dist/core/db/LocalStore.d.ts +7 -0
- package/dist/core/field/CreateField.d.ts +1 -2
- package/dist/core/source/Source.d.ts +2 -0
- package/dist/core/source/Source.js +11 -0
- package/dist/core/util/Async.d.ts +2 -0
- package/dist/core/util/Async.js +12 -1
- package/dist/core/util/Checks.js +1 -1
- package/dist/core/util/Slugs.js +4 -3
- package/dist/dashboard/App.css +13 -11
- package/dist/dashboard/App.d.ts +1 -0
- package/dist/dashboard/App.js +22 -6
- package/dist/dashboard/Href.d.ts +37 -0
- package/dist/dashboard/Href.js +46 -0
- package/dist/dashboard/app/ActivityStatus.js +34 -12
- package/dist/dashboard/app/AuthView.js +2 -2
- package/dist/dashboard/app/BlockSettings.d.ts +9 -0
- package/dist/dashboard/app/BlockSettings.js +16 -0
- package/dist/dashboard/app/BlockSheet.js +3 -3
- package/dist/dashboard/app/BlockSheetStoryFrame.js +2 -2
- package/dist/dashboard/app/CompactField.js +15 -15
- package/dist/dashboard/app/CroppedImage.js +2 -2
- package/dist/dashboard/app/DashboardLayout.d.ts +1 -1
- package/dist/dashboard/app/DashboardLayout.js +12 -0
- package/dist/dashboard/app/EntryActions.d.ts +11 -0
- package/dist/dashboard/app/EntryActions.js +30 -0
- package/dist/dashboard/app/EntryFields.d.ts +15 -2
- package/dist/dashboard/app/EntryFields.js +26 -5
- package/dist/dashboard/app/EntryHeader.js +17 -7
- package/dist/dashboard/app/EntryReferences.js +2 -2
- package/dist/dashboard/app/EntrySidebar.js +25 -23
- package/dist/dashboard/app/EntrySidebarPreview.js +2 -2
- package/dist/dashboard/app/EntryValidationModal.js +3 -3
- package/dist/dashboard/app/Explorer.js +84 -45
- package/dist/dashboard/app/ExplorerBatchActions.js +4 -4
- package/dist/dashboard/app/ExplorerControls.js +5 -5
- package/dist/dashboard/app/ExplorerList.js +2 -2
- package/dist/dashboard/app/ExplorerModal.js +3 -3
- package/dist/dashboard/app/ExplorerOverviewHeader.d.ts +6 -0
- package/dist/dashboard/app/ExplorerOverviewHeader.js +28 -0
- package/dist/dashboard/app/ExplorerTable.js +7 -7
- package/dist/dashboard/app/ExplorerTabs.d.ts +12 -0
- package/dist/dashboard/app/ExplorerTabs.js +42 -0
- package/dist/dashboard/app/ImageEditor.js +31 -31
- package/dist/dashboard/app/LinkPicker.js +3 -3
- package/dist/dashboard/app/LocaleMenu.js +9 -9
- package/dist/dashboard/app/MediaPreviewCell.js +5 -5
- package/dist/dashboard/app/OverviewCell.js +12 -10
- package/dist/dashboard/app/RemoveDialog.js +5 -0
- package/dist/dashboard/app/SearchBar.js +4 -4
- package/dist/dashboard/app/SettingsTab.d.ts +6 -0
- package/dist/dashboard/app/SettingsTab.js +27 -0
- package/dist/dashboard/app/SidebarTree.js +19 -19
- package/dist/dashboard/app/WorkspaceMenu.js +6 -6
- package/dist/dashboard/app/WorkspaceRoots.js +102 -98
- package/dist/dashboard/app/editor/FileEditor.js +18 -18
- package/dist/dashboard/app/pages/EntryPage.js +42 -39
- package/dist/dashboard/app/pages/RootPage.js +3 -3
- package/dist/dashboard/app/pages/SplashPage.js +94 -79
- package/dist/dashboard/app/pages/UsersPage.js +9 -9
- package/dist/dashboard/app/ui/DashboardModal.js +14 -14
- package/dist/dashboard/atoms/activity.d.ts +1 -0
- package/dist/dashboard/atoms/activity.js +8 -5
- package/dist/dashboard/atoms/config.d.ts +2 -0
- package/dist/dashboard/atoms/dashboard.d.ts +11 -0
- package/dist/dashboard/atoms/dashboard.js +8 -0
- package/dist/dashboard/atoms/editor.d.ts +7 -1
- package/dist/dashboard/atoms/editor.js +14 -2
- package/dist/dashboard/atoms/explorer.d.ts +15 -0
- package/dist/dashboard/atoms/explorer.js +43 -14
- package/dist/dashboard/atoms/graph.d.ts +5 -0
- package/dist/dashboard/atoms/graph.js +26 -1
- package/dist/dashboard/atoms/nav.d.ts +16 -10
- package/dist/dashboard/atoms/nav.js +96 -36
- package/dist/dashboard/atoms/overview.d.ts +26 -4
- package/dist/dashboard/atoms/overview.js +41 -12
- package/dist/dashboard/atoms/root.js +7 -1
- package/dist/dashboard/boot/ActivityEvent.d.ts +1 -1
- package/dist/dashboard/boot/Boot.js +6 -0
- package/dist/dashboard/boot/DashboardWorker.d.ts +6 -0
- package/dist/dashboard/boot/DashboardWorker.js +89 -8
- package/dist/dashboard/boot/LoadWorker.js +3 -0
- package/dist/dashboard/boot/SyncEvent.d.ts +7 -0
- package/dist/dashboard/boot/SyncEvent.js +14 -0
- package/dist/dashboard/boot/WorkerDB.d.ts +1 -0
- package/dist/dashboard/boot/WorkerDB.js +3 -0
- package/dist/dashboard/cms/EntryTable.d.ts +4 -3
- package/dist/dashboard/cms/EntryTable.js +2 -2
- package/dist/dashboard/cms/ViewProps.d.ts +3 -2
- package/dist/dashboard/cms/hooks.d.ts +34 -18
- package/dist/dashboard/cms/hooks.js +43 -18
- package/dist/dashboard/contexts.d.ts +3 -2
- package/dist/dashboard/contexts.js +3 -2
- package/dist/dashboard/hook/UseEntryEditor.d.ts +1 -1
- package/dist/dashboard/hook/UseEntryEditor.js +7 -3
- package/dist/dashboard/icons.d.ts +1 -0
- package/dist/dashboard/icons.js +15 -0
- package/dist/database/BrowserEntryStore.js +35 -13
- package/dist/database/DatabaseTables.js +1 -1
- package/dist/database/EntryDatabase.d.ts +10 -1
- package/dist/database/EntryDatabase.js +31 -10
- package/dist/database/EntryStore.js +1 -11
- package/dist/database/entry/EntryTable.d.ts +5 -3
- package/dist/database/entry/EntryTable.js +25 -8
- package/dist/database/query/Condition.d.ts +4 -1
- package/dist/database/query/Condition.js +16 -5
- package/dist/database/query/EntryQuery.js +59 -7
- package/dist/database/query/Relation.d.ts +13 -1
- package/dist/database/query/Relation.js +19 -1
- package/dist/database/query/Search.d.ts +7 -1
- package/dist/database/query/Search.js +54 -9
- package/dist/database/sync/EntrySyncer.d.ts +2 -0
- package/dist/database/sync/EntrySyncer.js +4 -2
- package/dist/database/sync/Ingest.d.ts +2 -1
- package/dist/database/sync/Ingest.js +20 -6
- package/dist/field/code/CodeField.view.js +12 -12
- package/dist/field/link/EntryLink.d.ts +4 -5
- package/dist/field/link/FileLink.d.ts +2 -2
- package/dist/field/link/ImageLink.d.ts +2 -5
- package/dist/field/link/ImageLink.js +0 -1
- package/dist/field/link/LinkField.view.js +18 -15
- package/dist/field/list/ListField.view.js +50 -35
- package/dist/field/metadata/MetadataField.view.js +14 -14
- package/dist/field/richtext/RichTextBlock.js +39 -35
- package/dist/field/richtext/RichTextExtensions.js +23 -23
- package/dist/field/richtext/RichTextField.view.js +6 -6
- package/dist/field/richtext/RichTextInsertMenu.js +5 -5
- package/dist/field/richtext/RichTextToolbar.js +26 -1
- package/dist/field/richtext/Toolbar.d.ts +9 -1
- package/dist/field/richtext/Toolbar.js +12 -2
- package/dist/field/select/SelectField.view.js +1 -0
- package/dist/index.css +174 -23
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/next.d.ts +2 -0
- package/dist/next.edge.d.ts +2 -0
- package/dist/picker/entry/EntryPicker.d.ts +3 -1
- package/dist/picker/entry/EntryPicker.js +15 -1
- package/dist/preview/react.js +3 -0
- package/dist/query.d.ts +26 -14
- package/dist/query.js +4 -0
- package/dist/types.d.ts +8 -5
- package/dist/ui/Stack.d.ts +4 -2
- package/docs/ai-setup.md +3 -3
- package/docs/cli.md +4 -2
- package/docs/components/combo-box.md +105 -16
- package/docs/components/date-field.md +1 -1
- package/docs/components/dialog.md +51 -0
- package/docs/components/form.md +67 -0
- package/docs/components/link.md +10 -0
- package/docs/components/multiple-select.md +9 -17
- package/docs/components/number-field.md +5 -1
- package/docs/components/select.md +9 -20
- package/docs/components/stack.md +42 -0
- package/docs/components/table.md +83 -0
- package/docs/components/text-field.md +9 -1
- package/docs/components/time-field.md +5 -1
- package/docs/components.md +39 -1
- package/docs/configuration.md +3 -1
- package/docs/custom-fields.md +135 -7
- package/docs/deploy/self-host.md +2 -0
- package/docs/deploy.md +7 -4
- package/docs/fields/image.md +0 -1
- package/docs/fields/list.md +19 -0
- package/docs/fields/object.md +5 -3
- package/docs/fields/rich-text.md +31 -0
- package/docs/index.md +8 -6
- package/docs/instant-publishing.md +23 -2
- package/docs/overviews.md +128 -4
- package/docs/query/filtering.md +2 -0
- package/docs/query/related.md +58 -9
- package/docs/query.md +52 -1
- package/docs/quickstart.md +5 -5
- package/docs/schema/document.md +2 -0
- package/docs/schema/type.md +3 -1
- package/docs/upgrading.md +100 -19
- package/llms-full.txt +1022 -125
- package/package.json +1 -1
- package/readme.md +2 -2
- package/dist/chunks/{chunk-4ZA6KZHS.js → chunk-6FQ5IMNA.js} +3 -3
package/dist/dashboard/App.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import "../chunks/chunk-CQ52GEHY.js";
|
|
14
14
|
|
|
15
15
|
// src/dashboard/App.tsx
|
|
16
|
-
import { Page as PageLayout, Spinner } from "alinea/components";
|
|
16
|
+
import { Page as PageLayout, Spinner, Text } from "alinea/components";
|
|
17
17
|
import {
|
|
18
18
|
useDeferredValue,
|
|
19
19
|
useEffect,
|
|
@@ -22,10 +22,12 @@ import {
|
|
|
22
22
|
|
|
23
23
|
// src/dashboard/App.module.css
|
|
24
24
|
var App_default = {
|
|
25
|
-
"AppLoading-
|
|
26
|
-
"
|
|
25
|
+
"AppLoading-status": "alinea-AppLoading-status",
|
|
26
|
+
"AppLoadingStatus": "alinea-AppLoading-status",
|
|
27
27
|
"AppLoading-progress-fade-in": "alinea-AppLoading-progress-fade-in",
|
|
28
28
|
"AppLoadingProgressFadeIn": "alinea-AppLoading-progress-fade-in",
|
|
29
|
+
"AppLoading-progress": "alinea-AppLoading-progress",
|
|
30
|
+
"AppLoadingProgress": "alinea-AppLoading-progress",
|
|
29
31
|
"AppLoading": "alinea-AppLoading"
|
|
30
32
|
};
|
|
31
33
|
|
|
@@ -45,7 +47,7 @@ import { themeAtom } from "./atoms/dashboard.js";
|
|
|
45
47
|
import { workspaceAtom, workspacesAtom } from "./atoms/config.js";
|
|
46
48
|
import { useDashboardStore } from "./atoms/core.js";
|
|
47
49
|
import { entryAtoms, MissingEntryError } from "./atoms/entry.js";
|
|
48
|
-
import { graphReadyAtom } from "./atoms/graph.js";
|
|
50
|
+
import { graphReadyAtom, syncProgressAtom } from "./atoms/graph.js";
|
|
49
51
|
import { pageAtom } from "./atoms/nav.js";
|
|
50
52
|
import { rootAtoms } from "./atoms/root.js";
|
|
51
53
|
import { canManageMembersAtom, userPolicyReadyAtom } from "./atoms/user.js";
|
|
@@ -200,16 +202,29 @@ function DashboardApp(props) {
|
|
|
200
202
|
const [appPending, app] = useAtomValueRawSync(appAtom);
|
|
201
203
|
const shown = useDeferredValue(app);
|
|
202
204
|
const activity = useAtomValueRaw(activityAtom);
|
|
205
|
+
const sync = useAtomValueRaw(syncProgressAtom);
|
|
203
206
|
const [, setActivityPending] = useAtom(activityPendingAtom);
|
|
204
207
|
useAtomValueRaw(themeAtom);
|
|
205
|
-
const pending = appPending || shown !== app || activity.isMutating;
|
|
208
|
+
const pending = appPending || shown !== app || activity.isMutating || activity.isSyncing || Boolean(sync);
|
|
206
209
|
useEffect(() => {
|
|
207
210
|
setActivityPending(pending);
|
|
208
211
|
}, [pending, setActivityPending]);
|
|
209
212
|
return shown ?? /* @__PURE__ */ jsx(AppLoading, {});
|
|
210
213
|
}
|
|
214
|
+
var fileCount = new Intl.NumberFormat();
|
|
211
215
|
function AppLoading() {
|
|
212
|
-
|
|
216
|
+
const sync = useAtomValueRaw(syncProgressAtom);
|
|
217
|
+
const fetching = sync && sync.loaded < sync.total;
|
|
218
|
+
return /* @__PURE__ */ jsx(PageLayout, { className: styles.AppLoading(), children: /* @__PURE__ */ jsxs("div", { className: styles.AppLoading.progress(), children: [
|
|
219
|
+
/* @__PURE__ */ jsx(
|
|
220
|
+
Spinner,
|
|
221
|
+
{
|
|
222
|
+
"aria-label": "Loading dashboard",
|
|
223
|
+
value: fetching ? Math.round(sync.loaded / sync.total * 100) : void 0
|
|
224
|
+
}
|
|
225
|
+
),
|
|
226
|
+
sync && /* @__PURE__ */ jsx(Text, { size: "sm", color: "muted", className: styles.AppLoading.status(), children: fetching ? `Syncing content \xB7 ${fileCount.format(sync.loaded)} of ${fileCount.format(sync.total)} files` : "Indexing content" })
|
|
227
|
+
] }) });
|
|
213
228
|
}
|
|
214
229
|
async function entryTitle(page, entryId, get) {
|
|
215
230
|
try {
|
|
@@ -225,5 +240,6 @@ function dashboardTitle(workspace, view) {
|
|
|
225
240
|
}
|
|
226
241
|
export {
|
|
227
242
|
App,
|
|
243
|
+
AppLoading,
|
|
228
244
|
appAtom
|
|
229
245
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { EntryDefaultView } from 'alinea/core/Type';
|
|
2
|
+
/** A place in the dashboard to navigate to */
|
|
3
|
+
export interface DashboardLocation {
|
|
4
|
+
/** Name of the workspace, leave out with `root` to open an entry by id */
|
|
5
|
+
workspace?: string;
|
|
6
|
+
/** Name of the root, leave out with `workspace` to open an entry by id */
|
|
7
|
+
root?: string;
|
|
8
|
+
/** Id of the entry to open, leave out to open the root */
|
|
9
|
+
entryId?: string;
|
|
10
|
+
/** Locale to open, for roots with translations */
|
|
11
|
+
locale?: string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Open the entry's form (`edit`) or the list of its children (`overview`),
|
|
14
|
+
* for entries with both
|
|
15
|
+
*/
|
|
16
|
+
view?: EntryDefaultView;
|
|
17
|
+
}
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare const nav: {
|
|
20
|
+
splash(): string;
|
|
21
|
+
users(): string;
|
|
22
|
+
/** The editor of the entry at `url`, as linked from a page of the site */
|
|
23
|
+
edit(url: string, workspace?: string, root?: string): string;
|
|
24
|
+
/** The editor of an entry by id, its workspace and root are looked up */
|
|
25
|
+
link(entryId: string, locale?: string | null, view?: EntryDefaultView): string;
|
|
26
|
+
entry(workspace?: string, root?: string, entryId?: string, locale?: string | null, view?: EntryDefaultView, sort?: string, tab?: string): string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The href of a place in the dashboard, relative to the dashboard's page. An
|
|
30
|
+
* entry can be linked by its id alone, its workspace and root are looked up
|
|
31
|
+
* when the link opens. Outside the dashboard, prefix the dashboard's url.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* <a href={href({entryId: post.id})}>{post.title}</a>
|
|
35
|
+
* const url = `${baseUrl}/admin${href({entryId: post.id})}`
|
|
36
|
+
*/
|
|
37
|
+
export declare function href(location: DashboardLocation): string;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import "../chunks/chunk-CQ52GEHY.js";
|
|
2
|
+
|
|
3
|
+
// src/dashboard/Href.ts
|
|
4
|
+
var nav = {
|
|
5
|
+
splash() {
|
|
6
|
+
return "/";
|
|
7
|
+
},
|
|
8
|
+
users() {
|
|
9
|
+
return "/users";
|
|
10
|
+
},
|
|
11
|
+
/** The editor of the entry at `url`, as linked from a page of the site */
|
|
12
|
+
edit(url, workspace, root) {
|
|
13
|
+
const params = new URLSearchParams({ url });
|
|
14
|
+
if (workspace) params.set("workspace", workspace);
|
|
15
|
+
if (root) params.set("root", root);
|
|
16
|
+
return `/edit?${params}`;
|
|
17
|
+
},
|
|
18
|
+
/** The editor of an entry by id, its workspace and root are looked up */
|
|
19
|
+
link(entryId, locale, view) {
|
|
20
|
+
const params = new URLSearchParams({ id: entryId });
|
|
21
|
+
if (locale) params.set("locale", locale);
|
|
22
|
+
if (view) params.set("view", view);
|
|
23
|
+
return `/edit?${params}`;
|
|
24
|
+
},
|
|
25
|
+
entry(workspace, root, entryId, locale, view, sort, tab) {
|
|
26
|
+
const rootPart = root ? `${root}${locale ? `:${locale}` : ""}` : "";
|
|
27
|
+
const path = `/entry/${[workspace, rootPart, entryId].filter(Boolean).join("/")}`;
|
|
28
|
+
const params = new URLSearchParams();
|
|
29
|
+
if (view) params.set("view", view);
|
|
30
|
+
if (sort) params.set("sort", sort);
|
|
31
|
+
if (tab) params.set("tab", tab);
|
|
32
|
+
const search = params.toString();
|
|
33
|
+
return search ? `${path}?${search}` : path;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
function href(location) {
|
|
37
|
+
const { workspace, root, entryId, view } = location;
|
|
38
|
+
const locale = location.locale ?? void 0;
|
|
39
|
+
if (entryId && !workspace && !root)
|
|
40
|
+
return `#${nav.link(entryId, locale, view)}`;
|
|
41
|
+
return `#${nav.entry(workspace, root, entryId, locale, view)}`;
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
href,
|
|
45
|
+
nav
|
|
46
|
+
};
|
|
@@ -44,30 +44,31 @@ import {
|
|
|
44
44
|
discardActivityAtom,
|
|
45
45
|
retryActivityAtom
|
|
46
46
|
} from "../atoms/activity.js";
|
|
47
|
+
import { syncProgressAtom } from "../atoms/graph.js";
|
|
47
48
|
import { routeAtom } from "../atoms/nav.js";
|
|
48
49
|
import { IcRoundCheck, IcRoundHistory, IcRoundWarning } from "../icons.js";
|
|
49
50
|
|
|
50
51
|
// src/dashboard/app/ActivityStatus.module.css
|
|
51
52
|
var ActivityStatus_default = {
|
|
52
|
-
"ActivityStatus": "alinea-ActivityStatus",
|
|
53
|
+
"ActivityStatus-popover-list": "alinea-ActivityStatus-popover-list",
|
|
54
|
+
"ActivityStatusPopoverList": "alinea-ActivityStatus-popover-list",
|
|
53
55
|
"is-syncing": "alinea-is-syncing",
|
|
54
56
|
"isSyncing": "alinea-is-syncing",
|
|
57
|
+
"ActivityStatus-label": "alinea-ActivityStatus-label",
|
|
58
|
+
"ActivityStatusLabel": "alinea-ActivityStatus-label",
|
|
55
59
|
"ActivityStatus-popover-actions": "alinea-ActivityStatus-popover-actions",
|
|
56
60
|
"ActivityStatusPopoverActions": "alinea-ActivityStatus-popover-actions",
|
|
57
61
|
"ActivityStatus-icon": "alinea-ActivityStatus-icon",
|
|
58
62
|
"ActivityStatusIcon": "alinea-ActivityStatus-icon",
|
|
59
|
-
"ActivityStatus-popover-list": "alinea-ActivityStatus-popover-list",
|
|
60
|
-
"ActivityStatusPopoverList": "alinea-ActivityStatus-popover-list",
|
|
61
|
-
"ActivityStatus-label": "alinea-ActivityStatus-label",
|
|
62
|
-
"ActivityStatusLabel": "alinea-ActivityStatus-label",
|
|
63
63
|
"ActivityStatus-popover-header": "alinea-ActivityStatus-popover-header",
|
|
64
64
|
"ActivityStatusPopoverHeader": "alinea-ActivityStatus-popover-header",
|
|
65
|
-
"ActivityStatus-popover-surface": "alinea-ActivityStatus-popover-surface",
|
|
66
|
-
"ActivityStatusPopoverSurface": "alinea-ActivityStatus-popover-surface",
|
|
67
65
|
"ActivityStatus-popover": "alinea-ActivityStatus-popover",
|
|
68
66
|
"ActivityStatusPopover": "alinea-ActivityStatus-popover",
|
|
67
|
+
"ActivityStatus-popover-surface": "alinea-ActivityStatus-popover-surface",
|
|
68
|
+
"ActivityStatusPopoverSurface": "alinea-ActivityStatus-popover-surface",
|
|
69
69
|
"is-failed": "alinea-is-failed",
|
|
70
|
-
"isFailed": "alinea-is-failed"
|
|
70
|
+
"isFailed": "alinea-is-failed",
|
|
71
|
+
"ActivityStatus": "alinea-ActivityStatus"
|
|
71
72
|
};
|
|
72
73
|
|
|
73
74
|
// src/dashboard/app/ActivityStatus.tsx
|
|
@@ -101,6 +102,7 @@ function ActivityStatus({
|
|
|
101
102
|
}) {
|
|
102
103
|
const [appPending] = useAtomValueRawSync(appAtom);
|
|
103
104
|
const activity = useAtomValueRaw(activityAtom);
|
|
105
|
+
const sync = useAtomValueRaw(syncProgressAtom);
|
|
104
106
|
const retry = useSetAtom(retryActivityAtom);
|
|
105
107
|
const discard = useSetAtom(discardActivityAtom);
|
|
106
108
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -111,7 +113,11 @@ function ActivityStatus({
|
|
|
111
113
|
);
|
|
112
114
|
const wasFailed = useRef(false);
|
|
113
115
|
const lastActivityLabel = useRef("Finishing up");
|
|
114
|
-
const activityLabel = getActivityLabel(
|
|
116
|
+
const activityLabel = getActivityLabel(
|
|
117
|
+
appPending,
|
|
118
|
+
activity.isMutating,
|
|
119
|
+
activity.isSyncing || Boolean(sync)
|
|
120
|
+
);
|
|
115
121
|
const showSpinner = useAtomValueRaw(activityPendingAtom);
|
|
116
122
|
if (activityLabel !== void 0) lastActivityLabel.current = activityLabel;
|
|
117
123
|
const visibleActivityLabel = activityLabel ?? (showSpinner ? lastActivityLabel.current : void 0);
|
|
@@ -122,7 +128,14 @@ function ActivityStatus({
|
|
|
122
128
|
activity.hasFailed,
|
|
123
129
|
activity.hasBlocked
|
|
124
130
|
);
|
|
125
|
-
const icon = showSpinner ? /* @__PURE__ */ jsx(
|
|
131
|
+
const icon = showSpinner ? /* @__PURE__ */ jsx(
|
|
132
|
+
Spinner,
|
|
133
|
+
{
|
|
134
|
+
"aria-label": label,
|
|
135
|
+
value: sync && sync.loaded < sync.total ? Math.round(sync.loaded / sync.total * 100) : void 0,
|
|
136
|
+
className: styles.ActivityStatus.icon()
|
|
137
|
+
}
|
|
138
|
+
) : activity.hasFailed ? /* @__PURE__ */ jsx(
|
|
126
139
|
IcRoundWarning,
|
|
127
140
|
{
|
|
128
141
|
"aria-hidden": "true",
|
|
@@ -246,9 +259,10 @@ function ActivityItem({ activity }) {
|
|
|
246
259
|
}
|
|
247
260
|
);
|
|
248
261
|
}
|
|
249
|
-
function getActivityLabel(isNavigating, isMutating) {
|
|
262
|
+
function getActivityLabel(isNavigating, isMutating, isSyncing) {
|
|
250
263
|
if (isNavigating) return "Loading page";
|
|
251
264
|
if (isMutating) return "Syncing changes";
|
|
265
|
+
if (isSyncing) return "Syncing content";
|
|
252
266
|
}
|
|
253
267
|
function getStatusLabel(activity, hasFailed, hasBlocked) {
|
|
254
268
|
if (activity) {
|
|
@@ -306,6 +320,7 @@ function activityStatusColor(status) {
|
|
|
306
320
|
}
|
|
307
321
|
}
|
|
308
322
|
function formatActivityTitle(activity) {
|
|
323
|
+
if (activity.type === "sync") return "Content updates";
|
|
309
324
|
const uploadTitle = formatUploadTitle(activity);
|
|
310
325
|
if (uploadTitle) return uploadTitle;
|
|
311
326
|
const titles = [
|
|
@@ -319,7 +334,9 @@ function formatActivityTitle(activity) {
|
|
|
319
334
|
return "Content changes";
|
|
320
335
|
}
|
|
321
336
|
function formatActivityDescription(activity) {
|
|
322
|
-
const details = activity.type === "mutation" && isFileActivity(activity) ? fileMutationDescription(activity.status) : activity.operations.map(
|
|
337
|
+
const details = activity.type === "sync" ? syncDescription(activity.status) : activity.type === "mutation" && isFileActivity(activity) ? fileMutationDescription(activity.status) : activity.operations.map(
|
|
338
|
+
(operation) => formatActivityOperation(operation, activity.status)
|
|
339
|
+
).join(" \xB7 ");
|
|
323
340
|
const time = /* @__PURE__ */ jsx(Timestamp, { date: activity.finishedAt ?? activity.startedAt, format: "time" });
|
|
324
341
|
if (!details) return time;
|
|
325
342
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -344,6 +361,11 @@ function formatUploadTitle(activity) {
|
|
|
344
361
|
const extension = dot < 0 ? "" : upload.title.slice(dot);
|
|
345
362
|
return created.title.endsWith(extension) ? created.title : `${created.title}${extension}`;
|
|
346
363
|
}
|
|
364
|
+
function syncDescription(status) {
|
|
365
|
+
if (status === "failed") return "Could not fetch updates";
|
|
366
|
+
if (status === "succeeded") return "Up to date";
|
|
367
|
+
return "Fetching updates";
|
|
368
|
+
}
|
|
347
369
|
function fileMutationDescription(status) {
|
|
348
370
|
if (status === "pending" || status === "running")
|
|
349
371
|
return "Saving uploaded file.";
|
|
@@ -28,12 +28,12 @@ import { IcRoundArrowForward, IcRoundPublish } from "../icons.js";
|
|
|
28
28
|
// src/dashboard/app/AuthView.module.css
|
|
29
29
|
var AuthView_default = {
|
|
30
30
|
"AuthView": "alinea-AuthView",
|
|
31
|
-
"AuthView-mark": "alinea-AuthView-mark",
|
|
32
|
-
"AuthViewMark": "alinea-AuthView-mark",
|
|
33
31
|
"AuthView-link": "alinea-AuthView-link",
|
|
34
32
|
"AuthViewLink": "alinea-AuthView-link",
|
|
35
33
|
"AuthView-loader": "alinea-AuthView-loader",
|
|
36
34
|
"AuthViewLoader": "alinea-AuthView-loader",
|
|
35
|
+
"AuthView-mark": "alinea-AuthView-mark",
|
|
36
|
+
"AuthViewMark": "alinea-AuthView-mark",
|
|
37
37
|
"AuthView-panel": "alinea-AuthView-panel",
|
|
38
38
|
"AuthViewPanel": "alinea-AuthView-panel"
|
|
39
39
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Type } from 'alinea/core/Type';
|
|
2
|
+
import type { EditorNode } from '../atoms/editor.js';
|
|
3
|
+
export interface BlockSettingsProps {
|
|
4
|
+
node: EditorNode;
|
|
5
|
+
type: Type;
|
|
6
|
+
readOnly?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** The settings fields of a block's type, for its settings sheet */
|
|
9
|
+
export declare function BlockSettings({ node, type, readOnly }: BlockSettingsProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "../../chunks/chunk-CQ52GEHY.js";
|
|
2
|
+
|
|
3
|
+
// src/dashboard/app/BlockSettings.tsx
|
|
4
|
+
import { SheetSection } from "alinea/components";
|
|
5
|
+
import { Type } from "alinea/core/Type";
|
|
6
|
+
import { EditFields } from "./EntryFields.js";
|
|
7
|
+
import { NodeEditor } from "./NodeEditor.js";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
function BlockSettings({ node, type, readOnly }) {
|
|
10
|
+
const settings = Type.settings(type);
|
|
11
|
+
if (!settings) return null;
|
|
12
|
+
return /* @__PURE__ */ jsx(SheetSection, { title: "Settings", children: /* @__PURE__ */ jsx(NodeEditor, { node, type, readOnly, children: /* @__PURE__ */ jsx(EditFields, { fields: settings }) }) });
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
BlockSettings
|
|
16
|
+
};
|
|
@@ -24,13 +24,13 @@ import { createPortal } from "react-dom";
|
|
|
24
24
|
|
|
25
25
|
// src/dashboard/app/BlockSheet.module.css
|
|
26
26
|
var BlockSheet_default = {
|
|
27
|
-
"BlockSheet": "alinea-BlockSheet",
|
|
28
|
-
"BlockSheet-exit": "alinea-BlockSheet-exit",
|
|
29
|
-
"BlockSheetExit": "alinea-BlockSheet-exit",
|
|
30
27
|
"BlockSheetSlot-host": "alinea-BlockSheetSlot-host",
|
|
31
28
|
"BlockSheetSlotHost": "alinea-BlockSheetSlot-host",
|
|
32
29
|
"BlockSheet-enter": "alinea-BlockSheet-enter",
|
|
33
30
|
"BlockSheetEnter": "alinea-BlockSheet-enter",
|
|
31
|
+
"BlockSheet-exit": "alinea-BlockSheet-exit",
|
|
32
|
+
"BlockSheetExit": "alinea-BlockSheet-exit",
|
|
33
|
+
"BlockSheet": "alinea-BlockSheet",
|
|
34
34
|
"BlockSheetSlot": "alinea-BlockSheetSlot"
|
|
35
35
|
};
|
|
36
36
|
|
|
@@ -10,9 +10,9 @@ import { BlockSheetProvider, BlockSheetSlot } from "./BlockSheet.js";
|
|
|
10
10
|
var BlockSheetStoryFrame_default = {
|
|
11
11
|
"BlockSheetStoryFrame-content": "alinea-BlockSheetStoryFrame-content",
|
|
12
12
|
"BlockSheetStoryFrameContent": "alinea-BlockSheetStoryFrame-content",
|
|
13
|
+
"BlockSheetStoryFrame": "alinea-BlockSheetStoryFrame",
|
|
13
14
|
"BlockSheetStoryFrame-panel": "alinea-BlockSheetStoryFrame-panel",
|
|
14
|
-
"BlockSheetStoryFramePanel": "alinea-BlockSheetStoryFrame-panel"
|
|
15
|
-
"BlockSheetStoryFrame": "alinea-BlockSheetStoryFrame"
|
|
15
|
+
"BlockSheetStoryFramePanel": "alinea-BlockSheetStoryFrame-panel"
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
// src/dashboard/app/BlockSheetStoryFrame.tsx
|
|
@@ -22,31 +22,31 @@ import { viewsAtom } from "../atoms/core.js";
|
|
|
22
22
|
|
|
23
23
|
// src/dashboard/app/CompactField.module.css
|
|
24
24
|
var CompactField_default = {
|
|
25
|
-
"CompactField-link": "alinea-CompactField-link",
|
|
26
|
-
"CompactFieldLink": "alinea-CompactField-link",
|
|
27
|
-
"CompactField-muted": "alinea-CompactField-muted",
|
|
28
|
-
"CompactFieldMuted": "alinea-CompactField-muted",
|
|
29
25
|
"CompactField-items": "alinea-CompactField-items",
|
|
30
26
|
"CompactFieldItems": "alinea-CompactField-items",
|
|
31
|
-
"CompactField-link
|
|
32
|
-
"
|
|
33
|
-
"CompactField-json": "alinea-CompactField-json",
|
|
34
|
-
"CompactFieldJson": "alinea-CompactField-json",
|
|
27
|
+
"CompactField-link": "alinea-CompactField-link",
|
|
28
|
+
"CompactFieldLink": "alinea-CompactField-link",
|
|
35
29
|
"CompactField-list-count": "alinea-CompactField-list-count",
|
|
36
30
|
"CompactFieldListCount": "alinea-CompactField-list-count",
|
|
37
|
-
"CompactField": "alinea-CompactField",
|
|
38
|
-
"CompactField-text": "alinea-CompactField-text",
|
|
39
|
-
"CompactFieldText": "alinea-CompactField-text",
|
|
40
|
-
"CompactField-record": "alinea-CompactField-record",
|
|
41
|
-
"CompactFieldRecord": "alinea-CompactField-record",
|
|
42
31
|
"CompactField-record-field": "alinea-CompactField-record-field",
|
|
43
32
|
"CompactFieldRecordField": "alinea-CompactField-record-field",
|
|
33
|
+
"CompactField-json": "alinea-CompactField-json",
|
|
34
|
+
"CompactFieldJson": "alinea-CompactField-json",
|
|
35
|
+
"CompactField-record-label": "alinea-CompactField-record-label",
|
|
36
|
+
"CompactFieldRecordLabel": "alinea-CompactField-record-label",
|
|
37
|
+
"CompactField-link-label": "alinea-CompactField-link-label",
|
|
38
|
+
"CompactFieldLinkLabel": "alinea-CompactField-link-label",
|
|
39
|
+
"CompactField-muted": "alinea-CompactField-muted",
|
|
40
|
+
"CompactFieldMuted": "alinea-CompactField-muted",
|
|
41
|
+
"CompactField-record": "alinea-CompactField-record",
|
|
42
|
+
"CompactFieldRecord": "alinea-CompactField-record",
|
|
44
43
|
"CompactField-record-value": "alinea-CompactField-record-value",
|
|
45
44
|
"CompactFieldRecordValue": "alinea-CompactField-record-value",
|
|
45
|
+
"CompactField": "alinea-CompactField",
|
|
46
46
|
"CompactField-link-preview": "alinea-CompactField-link-preview",
|
|
47
47
|
"CompactFieldLinkPreview": "alinea-CompactField-link-preview",
|
|
48
|
-
"CompactField-
|
|
49
|
-
"
|
|
48
|
+
"CompactField-text": "alinea-CompactField-text",
|
|
49
|
+
"CompactFieldText": "alinea-CompactField-text"
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
// src/dashboard/app/CompactField.tsx
|
|
@@ -10,9 +10,9 @@ import { rotatedSize } from "alinea/core/media/ImageTransform";
|
|
|
10
10
|
var CroppedImage_default = {
|
|
11
11
|
"CroppedImage-image": "alinea-CroppedImage-image",
|
|
12
12
|
"CroppedImageImage": "alinea-CroppedImage-image",
|
|
13
|
+
"CroppedImage": "alinea-CroppedImage",
|
|
13
14
|
"CroppedImage-frame": "alinea-CroppedImage-frame",
|
|
14
|
-
"CroppedImageFrame": "alinea-CroppedImage-frame"
|
|
15
|
-
"CroppedImage": "alinea-CroppedImage"
|
|
15
|
+
"CroppedImageFrame": "alinea-CroppedImage-frame"
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
// src/dashboard/app/CroppedImage.tsx
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { WorkspaceInternal } from 'alinea/core/Workspace';
|
|
2
2
|
import type { Page } from 'alinea/dashboard/atoms/nav';
|
|
3
3
|
import type { RootAtoms, TreeView } from 'alinea/dashboard/atoms/root';
|
|
4
|
-
import type
|
|
4
|
+
import { type PropsWithChildren } from 'react';
|
|
5
5
|
export interface DashboardLayoutProps extends PropsWithChildren {
|
|
6
6
|
canManageMembers: boolean;
|
|
7
7
|
page: Page;
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
SidebarHeader,
|
|
19
19
|
SidebarInset
|
|
20
20
|
} from "alinea/components";
|
|
21
|
+
import { useLayoutEffect } from "react";
|
|
21
22
|
import { DashboardScope, useDashboardContext } from "../hooks.js";
|
|
22
23
|
import { IcRoundAdd } from "../icons.js";
|
|
23
24
|
import { SidebarTree } from "./SidebarTree.js";
|
|
@@ -49,6 +50,7 @@ function DashboardLayout({
|
|
|
49
50
|
workspace
|
|
50
51
|
}) {
|
|
51
52
|
return /* @__PURE__ */ jsxs(DashboardScope, { value: { page, root, workspace }, children: [
|
|
53
|
+
/* @__PURE__ */ jsx(WorkspaceColor, { color: workspace.color }),
|
|
52
54
|
/* @__PURE__ */ jsxs(AppShell, { children: [
|
|
53
55
|
/* @__PURE__ */ jsx(WorkspaceRoots, { canManageMembers, page }),
|
|
54
56
|
/* @__PURE__ */ jsx(AppShellContent, { children: /* @__PURE__ */ jsx(
|
|
@@ -76,6 +78,16 @@ function DashboardLayout({
|
|
|
76
78
|
/* @__PURE__ */ jsx(MoveConfirmDialog, {})
|
|
77
79
|
] });
|
|
78
80
|
}
|
|
81
|
+
function WorkspaceColor({ color }) {
|
|
82
|
+
useLayoutEffect(() => {
|
|
83
|
+
const { style } = document.documentElement;
|
|
84
|
+
style.setProperty("--alinea-workspace-color", color);
|
|
85
|
+
return () => {
|
|
86
|
+
style.removeProperty("--alinea-workspace-color");
|
|
87
|
+
};
|
|
88
|
+
}, [color]);
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
79
91
|
function SidebarCreateEntryButton({ root }) {
|
|
80
92
|
const { page } = useDashboardContext();
|
|
81
93
|
const canCreate = useAtomValueRaw(root.tree(page.locale).canCreate);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Entry } from 'alinea/core/Entry';
|
|
2
|
+
import type { Type } from 'alinea/core/Type';
|
|
3
|
+
import type { EditorNode } from '../atoms/editor.js';
|
|
4
|
+
export interface EntryActionsProps {
|
|
5
|
+
type: Type;
|
|
6
|
+
node: EditorNode;
|
|
7
|
+
entry: Entry;
|
|
8
|
+
locale: string | null;
|
|
9
|
+
}
|
|
10
|
+
/** The actions configured with the `actions` option of a type */
|
|
11
|
+
export declare function EntryActions({ type, node, entry, locale }: EntryActionsProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useAtomValueRaw
|
|
3
|
+
} from "../../chunks/chunk-D6UJHBJJ.js";
|
|
4
|
+
import "../../chunks/chunk-CFNRVI3Y.js";
|
|
5
|
+
import "../../chunks/chunk-CQ52GEHY.js";
|
|
6
|
+
|
|
7
|
+
// src/dashboard/app/EntryActions.tsx
|
|
8
|
+
import { getType } from "alinea/core/Internal";
|
|
9
|
+
import { resolveView } from "alinea/core/View";
|
|
10
|
+
import { useMemo } from "react";
|
|
11
|
+
import { viewsAtom } from "../atoms/core.js";
|
|
12
|
+
import { dashboardEntry } from "../cms/hooks.js";
|
|
13
|
+
import { NodeEditor } from "./NodeEditor.js";
|
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
|
15
|
+
function EntryActions({ type, node, entry, locale }) {
|
|
16
|
+
const views = useAtomValueRaw(viewsAtom);
|
|
17
|
+
const actions = getType(type).actions ?? [];
|
|
18
|
+
const props = useMemo(
|
|
19
|
+
() => ({ entry: dashboardEntry(entry), locale }),
|
|
20
|
+
[entry, locale]
|
|
21
|
+
);
|
|
22
|
+
if (actions.length === 0) return null;
|
|
23
|
+
return /* @__PURE__ */ jsx(NodeEditor, { node, type, children: actions.map((view, index) => {
|
|
24
|
+
const Action = resolveView(views, view);
|
|
25
|
+
return Action ? /* @__PURE__ */ jsx(Action, { ...props }, index) : null;
|
|
26
|
+
}) });
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
EntryActions
|
|
30
|
+
};
|
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
import { Field } from 'alinea/core/Field';
|
|
2
2
|
import { Section } from 'alinea/core/Section';
|
|
3
|
+
import type { ObjectField } from 'alinea/field/object';
|
|
3
4
|
export declare function FieldsEditor(): import("react").JSX.Element[];
|
|
4
5
|
export declare function EntryFields(): import("react").JSX.Element[];
|
|
5
6
|
export interface EditFieldsProps {
|
|
7
|
+
/**
|
|
8
|
+
* An object field to render the fields of, in the scope of its value.
|
|
9
|
+
* Without `fields` all its fields are rendered.
|
|
10
|
+
*/
|
|
11
|
+
field?: ObjectField<object>;
|
|
6
12
|
/** The fields and sections to render, keyed by name */
|
|
7
|
-
fields
|
|
13
|
+
fields?: Record<string, Field | Section>;
|
|
8
14
|
}
|
|
9
15
|
/**
|
|
10
16
|
* Renders a set of fields and sections with their configured views, laid out
|
|
11
17
|
* like the default entry form (including each field's `width`).
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // Some fields of an object field, in a custom view of that object
|
|
21
|
+
* <EditFields
|
|
22
|
+
* field={Product.dimensions}
|
|
23
|
+
* fields={{width: Product.dimensions.width}}
|
|
24
|
+
* />
|
|
12
25
|
*/
|
|
13
|
-
export declare const EditFields: import("react").MemoExoticComponent<({ fields }: EditFieldsProps) => import("react").JSX.Element>;
|
|
26
|
+
export declare const EditFields: import("react").MemoExoticComponent<({ field, fields }: EditFieldsProps) => import("react").JSX.Element | null>;
|
|
14
27
|
export interface EditFieldProps {
|
|
15
28
|
/** The field to render, it must belong to the entry, row or object being edited */
|
|
16
29
|
field: Field;
|
|
@@ -14,13 +14,20 @@ import { Section } from "alinea/core/Section";
|
|
|
14
14
|
import { HiddenField } from "alinea/field/hidden";
|
|
15
15
|
import { memo } from "react";
|
|
16
16
|
import { EntryEditorSection } from "../atoms/editor.js";
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
EditorScope,
|
|
19
|
+
useEditor,
|
|
20
|
+
useFieldNode,
|
|
21
|
+
useFieldOptions,
|
|
22
|
+
useFieldView,
|
|
23
|
+
useNodeEditor
|
|
24
|
+
} from "../hooks.js";
|
|
18
25
|
|
|
19
26
|
// src/dashboard/app/EntryFields.module.css
|
|
20
27
|
var EntryFields_default = {
|
|
21
|
-
"EditFields": "alinea-EditFields",
|
|
22
28
|
"EditField-slot": "alinea-EditField-slot",
|
|
23
|
-
"EditFieldSlot": "alinea-EditField-slot"
|
|
29
|
+
"EditFieldSlot": "alinea-EditField-slot",
|
|
30
|
+
"EditFields": "alinea-EditFields"
|
|
24
31
|
};
|
|
25
32
|
|
|
26
33
|
// src/dashboard/app/EntryFields.tsx
|
|
@@ -42,11 +49,19 @@ var FormSection = memo(function FormSection2({ section }) {
|
|
|
42
49
|
var EntryFormSection = memo(function EntryFormSection2({
|
|
43
50
|
section
|
|
44
51
|
}) {
|
|
52
|
+
const visible = useAtomValueRaw(section.visible);
|
|
45
53
|
const fields = /* @__PURE__ */ jsx(FormSection, { section });
|
|
46
54
|
if (Section.view(section.section)) return fields;
|
|
55
|
+
if (!visible) return null;
|
|
47
56
|
return /* @__PURE__ */ jsx(Surface, { children: /* @__PURE__ */ jsx(SurfaceContent, { children: fields }) });
|
|
48
57
|
});
|
|
49
|
-
var EditFields = memo(function EditFields2({
|
|
58
|
+
var EditFields = memo(function EditFields2({
|
|
59
|
+
field,
|
|
60
|
+
fields
|
|
61
|
+
}) {
|
|
62
|
+
const editor = useEditor();
|
|
63
|
+
if (field) return /* @__PURE__ */ jsx(ObjectFields, { field, fields });
|
|
64
|
+
if (!fields) return null;
|
|
50
65
|
return /* @__PURE__ */ jsx("div", { className: styles.EditFields(), children: Object.entries(fields).map(([name, value]) => {
|
|
51
66
|
if (Field.isField(value)) return /* @__PURE__ */ jsx(EditField, { field: value }, name);
|
|
52
67
|
if (!Section.isSection(value)) return null;
|
|
@@ -55,12 +70,18 @@ var EditFields = memo(function EditFields2({ fields }) {
|
|
|
55
70
|
{
|
|
56
71
|
className: styles.EditField.slot(),
|
|
57
72
|
style: { flexBasis: fieldWidth() },
|
|
58
|
-
children: /* @__PURE__ */ jsx(FormSection, { section: new EntryEditorSection(value) })
|
|
73
|
+
children: /* @__PURE__ */ jsx(FormSection, { section: new EntryEditorSection(editor, value) })
|
|
59
74
|
},
|
|
60
75
|
name
|
|
61
76
|
);
|
|
62
77
|
}) });
|
|
63
78
|
});
|
|
79
|
+
function ObjectFields({ field, fields }) {
|
|
80
|
+
const type = useFieldOptions(field).fields;
|
|
81
|
+
const node = useFieldNode(field);
|
|
82
|
+
const editor = useNodeEditor(node, type);
|
|
83
|
+
return /* @__PURE__ */ jsx(EditorScope, { editor, children: fields ? /* @__PURE__ */ jsx(EditFields, { fields }) : /* @__PURE__ */ jsx(FieldsEditor, {}) });
|
|
84
|
+
}
|
|
64
85
|
var EditField = memo(function EditField2({ field }) {
|
|
65
86
|
const options = useFieldOptions(field);
|
|
66
87
|
const View = useFieldView(field);
|
|
@@ -33,6 +33,7 @@ import { assert } from "alinea/core/util/Assert";
|
|
|
33
33
|
import { isRecord } from "alinea/core/util/Objects";
|
|
34
34
|
import { activityAtom } from "../atoms/activity.js";
|
|
35
35
|
import { configAtom } from "../atoms/core.js";
|
|
36
|
+
import { EntryActions } from "./EntryActions.js";
|
|
36
37
|
import { loadMoveTargetsAtom } from "../atoms/move.js";
|
|
37
38
|
import { routeAtom } from "../atoms/nav.js";
|
|
38
39
|
import {
|
|
@@ -65,17 +66,17 @@ import {
|
|
|
65
66
|
|
|
66
67
|
// src/dashboard/app/EntryHeader.module.css
|
|
67
68
|
var EntryHeader_default = {
|
|
69
|
+
"EntryHeader-type": "alinea-EntryHeader-type",
|
|
70
|
+
"EntryHeaderType": "alinea-EntryHeader-type",
|
|
71
|
+
"EntryHeader-status": "alinea-EntryHeader-status",
|
|
72
|
+
"EntryHeaderStatus": "alinea-EntryHeader-status",
|
|
73
|
+
"EntryHeader-actions": "alinea-EntryHeader-actions",
|
|
74
|
+
"EntryHeaderActions": "alinea-EntryHeader-actions",
|
|
68
75
|
"EntryHeader": "alinea-EntryHeader",
|
|
69
76
|
"is-dirty": "alinea-is-dirty",
|
|
70
77
|
"isDirty": "alinea-is-dirty",
|
|
71
|
-
"EntryHeader-actions": "alinea-EntryHeader-actions",
|
|
72
|
-
"EntryHeaderActions": "alinea-EntryHeader-actions",
|
|
73
|
-
"EntryHeader-type": "alinea-EntryHeader-type",
|
|
74
|
-
"EntryHeaderType": "alinea-EntryHeader-type",
|
|
75
78
|
"EntryHeader-sidebarToggle": "alinea-EntryHeader-sidebarToggle",
|
|
76
|
-
"EntryHeaderSidebarToggle": "alinea-EntryHeader-sidebarToggle"
|
|
77
|
-
"EntryHeader-status": "alinea-EntryHeader-status",
|
|
78
|
-
"EntryHeaderStatus": "alinea-EntryHeader-status"
|
|
79
|
+
"EntryHeaderSidebarToggle": "alinea-EntryHeader-sidebarToggle"
|
|
79
80
|
};
|
|
80
81
|
|
|
81
82
|
// src/dashboard/app/EntryHeader.tsx
|
|
@@ -513,6 +514,15 @@ function EntryHeader({
|
|
|
513
514
|
)
|
|
514
515
|
] }),
|
|
515
516
|
/* @__PURE__ */ jsxs(PageActions, { className: styles.EntryHeader.actions(), children: [
|
|
517
|
+
/* @__PURE__ */ jsx(
|
|
518
|
+
EntryActions,
|
|
519
|
+
{
|
|
520
|
+
type,
|
|
521
|
+
node,
|
|
522
|
+
entry: selectedEntry,
|
|
523
|
+
locale: localeData.requestedLocale
|
|
524
|
+
}
|
|
525
|
+
),
|
|
516
526
|
primaryAction,
|
|
517
527
|
onSidebarOpenChange && !isSidebarOpen && /* @__PURE__ */ jsx(
|
|
518
528
|
EntrySidebarToggle,
|