alinea 2.0.0-preview.1 → 2.0.0-preview.3
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 +34 -7
- package/dist/adapter/next/DevRemote.d.ts +3 -0
- package/dist/adapter/next/DevRemote.js +37 -0
- package/dist/adapter/next/ForwardCredentials.d.ts +1 -0
- package/dist/adapter/next/ForwardCredentials.js +17 -0
- package/dist/adapter/next/cms.js +86 -38
- package/dist/adapter/next/context.d.ts +1 -1
- package/dist/adapter/next/context.js +11 -3
- package/dist/adapter/next/handler.d.ts +2 -0
- package/dist/adapter/next/handler.js +23 -16
- package/dist/adapter/next/previews.js +3 -1
- package/dist/adapter/next/previews.spec.d.ts +1 -0
- package/dist/adapter/next/with-alinea.js +18 -16
- package/dist/backend/Handler.d.ts +14 -13
- package/dist/backend/Handler.js +53 -22
- package/dist/backend/resolver/ParsePreview.d.ts +8 -4
- package/dist/backend/resolver/ParsePreview.js +40 -43
- package/dist/bundled.d.ts +318 -77
- package/dist/chunks/{chunk-LUBOGJCG.js → chunk-6V4TAD2N.js} +1 -1
- package/dist/chunks/{chunk-TL7ZW6BX.js → chunk-A3XXZBOQ.js} +2535 -2999
- package/dist/chunks/chunk-AC5ATYI3.js +1434 -0
- package/dist/chunks/{chunk-FRYHNUEK.js → chunk-HFBZMKIN.js} +6 -3
- package/dist/chunks/{chunk-7ORQ7BYK.js → chunk-KMLLLZ6X.js} +202 -269
- package/dist/chunks/{chunk-IWN3T3FL.js → chunk-O7XWTMCB.js} +1 -1
- package/dist/chunks/{chunk-53DZYORR.js → chunk-PAYSVIYI.js} +76 -176
- package/dist/chunks/{chunk-YK3OSMDM.js → chunk-S4AU6SRS.js} +188 -158
- package/dist/chunks/{chunk-I7X64JTZ.js → chunk-VXZM6V4P.js} +4 -4
- package/dist/cli/Generate.js +3 -13
- package/dist/cli/Serve.js +7 -3
- package/dist/cli/bin.js +8 -5
- package/dist/cli/generate/CopyStaticFiles.js +2 -3
- package/dist/cli/generate/DevDB.d.ts +1 -1
- package/dist/cli/generate/DevDB.js +3 -5
- package/dist/cli/serve/CreateLocalServer.d.ts +1 -1
- package/dist/cli/serve/CreateLocalServer.js +3 -2
- package/dist/cli/serve/DevServer.d.ts +3 -2
- package/dist/cli/serve/DevServer.js +60 -3
- package/dist/cli/serve/ServeContext.d.ts +1 -0
- package/dist/cli/serve/StartServer.d.ts +1 -0
- package/dist/cli/serve/StartServer.js +6 -1
- package/dist/cli/util/EnsureLibs.js +2 -2
- package/dist/cli/util/EnsureNode.js +2 -2
- package/dist/cloud/CloudRemote.js +1 -1
- package/dist/components/Breadcrumbs.js +6 -6
- package/dist/components/Button.js +6 -6
- package/dist/components/Calendar.js +13 -13
- package/dist/components/Checkbox.js +8 -8
- package/dist/components/CheckboxGroup.js +6 -6
- package/dist/components/ColorSwatch.js +6 -6
- package/dist/components/ColorSwatchPicker.js +6 -6
- package/dist/components/ComboBox.js +17 -17
- package/dist/components/DateField.js +7 -7
- package/dist/components/DatePicker.js +9 -9
- package/dist/components/DateRangePicker.js +14 -14
- package/dist/components/Dialog.js +6 -6
- package/dist/components/Disclosure.js +13 -13
- package/dist/components/DropZone.js +6 -6
- package/dist/components/Label.js +14 -14
- package/dist/components/Link.js +6 -6
- package/dist/components/List.js +34 -34
- package/dist/components/Menu.js +9 -9
- package/dist/components/Modal.js +9 -9
- package/dist/components/MultipleSelect.js +28 -28
- package/dist/components/NumberField.d.ts +2 -1
- package/dist/components/NumberField.js +22 -12
- package/dist/components/Popover.js +6 -6
- package/dist/components/ProgressCircle.js +9 -9
- package/dist/components/RadioGroup.js +6 -6
- package/dist/components/SearchField.js +14 -14
- package/dist/components/Select.js +16 -16
- package/dist/components/Surface.js +2 -2
- package/dist/components/Switch.js +8 -8
- package/dist/components/Table.js +14 -14
- package/dist/components/Tabs.js +9 -9
- package/dist/components/TagGroup.js +6 -6
- package/dist/components/TextField.js +10 -10
- package/dist/components/TimeField.js +8 -8
- package/dist/components/Toggle.js +8 -8
- package/dist/components/Toolbar.js +8 -8
- package/dist/components/Tooltip.js +9 -9
- package/dist/components/Tree.d.ts +4 -2
- package/dist/components/Tree.js +27 -13
- package/dist/core/Client.js +3 -2
- package/dist/core/Config.d.ts +4 -0
- package/dist/core/Config.js +6 -0
- package/dist/core/Connection.d.ts +2 -2
- package/dist/core/Connection.js +7 -0
- package/dist/core/Graph.d.ts +4 -5
- package/dist/core/Infer.d.ts +8 -1
- package/dist/core/ListRow.d.ts +2 -0
- package/dist/core/OrderBy.d.ts +7 -3
- package/dist/core/TextDoc.d.ts +11 -0
- package/dist/core/Trace.d.ts +8 -0
- package/dist/core/Trace.js +32 -0
- package/dist/core/db/CommitRequest.d.ts +0 -3
- package/dist/core/db/CommitRequest.js +0 -9
- package/dist/core/db/EntryAliases.js +1 -4
- package/dist/core/db/EntryDB.js +1 -1
- package/dist/core/db/EntryIndex.d.ts +10 -0
- package/dist/core/db/EntryIndex.js +117 -9
- package/dist/core/db/EntryResolver.js +110 -35
- package/dist/core/db/EntryTransaction.d.ts +1 -2
- package/dist/core/db/EntryTransaction.js +26 -13
- package/dist/core/db/LocalDB.d.ts +2 -3
- package/dist/core/db/LocalDB.js +24 -19
- package/dist/core/db/Operation.d.ts +2 -2
- package/dist/core/db/Operation.js +11 -1
- package/dist/core/field/RichTextField.d.ts +30 -3
- package/dist/core/field/RichTextField.js +125 -41
- package/dist/core/media/MediaAltField.d.ts +1 -0
- package/dist/core/media/MediaAltField.js +9 -1
- package/dist/core/source/OverlaySource.d.ts +12 -0
- package/dist/core/source/OverlaySource.js +50 -0
- package/dist/core/source/Source.d.ts +1 -1
- package/dist/core/source/Source.js +3 -3
- package/dist/dashboard/App.css +158 -0
- package/dist/dashboard/App.js +10 -4
- package/dist/dashboard/app/AccessDenied.d.ts +16 -1
- package/dist/dashboard/app/AccessDenied.js +20 -11
- package/dist/dashboard/app/ActivityStatus.js +15 -15
- package/dist/dashboard/app/AuthView.js +11 -11
- package/dist/dashboard/app/Badge.js +2 -2
- package/dist/dashboard/app/CompactField.js +12 -12
- package/dist/dashboard/app/DashboardErrorBoundary.js +4 -4
- package/dist/dashboard/app/DashboardLayout.js +22 -19
- package/dist/dashboard/app/EntryHeader.js +10 -10
- package/dist/dashboard/app/EntryReferences.js +10 -10
- package/dist/dashboard/app/EntrySidebar.d.ts +1 -1
- package/dist/dashboard/app/EntrySidebar.js +16 -15
- package/dist/dashboard/app/EntrySidebarPreview.d.ts +1 -1
- package/dist/dashboard/app/EntrySidebarPreview.js +60 -29
- package/dist/dashboard/app/EntrySidebarPreview.story.d.ts +6 -1
- package/dist/dashboard/app/EntryTranslationBanner.js +7 -7
- package/dist/dashboard/app/Explorer.d.ts +2 -1
- package/dist/dashboard/app/Explorer.js +63 -51
- package/dist/dashboard/app/ExplorerCards.js +51 -55
- package/dist/dashboard/app/ExplorerFileCard.js +20 -20
- package/dist/dashboard/app/ExplorerList.js +14 -14
- package/dist/dashboard/app/ExplorerModal.js +1 -1
- package/dist/dashboard/app/ExplorerTable.js +59 -59
- package/dist/dashboard/app/ExternalLinkPicker.js +15 -4
- package/dist/dashboard/app/LinkPicker.js +40 -15
- package/dist/dashboard/app/LocaleMenu.js +8 -8
- package/dist/dashboard/app/SidebarLayout.d.ts +8 -0
- package/dist/dashboard/app/SidebarLayout.js +1169 -0
- package/dist/dashboard/app/SidebarTree.js +56 -64
- package/dist/dashboard/app/WorkspaceMenu.js +14 -14
- package/dist/dashboard/app/WorkspaceRoots.js +24 -24
- package/dist/dashboard/app/editor/FileEditor.js +29 -30
- package/dist/dashboard/app/editor/FilePreview.js +6 -6
- package/dist/dashboard/app/editor/MediaAltField.view.d.ts +1 -1
- package/dist/dashboard/app/editor/MediaAltField.view.js +6 -9
- package/dist/dashboard/app/modals/CreateEntry.js +5 -5
- package/dist/dashboard/app/pages/EntryPage.js +49 -25
- package/dist/dashboard/app/pages/UsersPage.js +35 -35
- package/dist/dashboard/app/ui/DashboardModal.js +23 -23
- package/dist/dashboard/app/ui/Rail.js +3 -3
- package/dist/dashboard/app/ui/Sidebar.js +2 -2
- package/dist/dashboard/atoms/auth.js +2 -0
- package/dist/dashboard/atoms/dashboard.d.ts +9 -0
- package/dist/dashboard/atoms/dashboard.js +17 -0
- package/dist/dashboard/atoms/editor.d.ts +7 -1
- package/dist/dashboard/atoms/editor.js +4 -1
- package/dist/dashboard/atoms/entry.d.ts +3 -1
- package/dist/dashboard/atoms/entry.js +55 -15
- package/dist/dashboard/atoms/explorer.js +3 -8
- package/dist/dashboard/atoms/preview.d.ts +3 -0
- package/dist/dashboard/atoms/preview.js +18 -1
- package/dist/dashboard/hooks.d.ts +4 -2
- package/dist/dashboard/hooks.js +9 -5
- package/dist/dashboard/icons.d.ts +1 -0
- package/dist/dashboard/icons.js +10 -0
- package/dist/field/code/CodeField.view.js +13 -13
- package/dist/field/date/DateField.view.js +12 -2
- package/dist/field/link/EntryLink.d.ts +1 -1
- package/dist/field/link/EntryLink.js +1 -0
- package/dist/field/link/Link.js +3 -2
- package/dist/field/link/LinkField.d.ts +5 -0
- package/dist/field/link/LinkField.view.js +115 -87
- package/dist/field/list/ListField.view.js +22 -33
- package/dist/field/metadata/MetadataField.d.ts +2 -0
- package/dist/field/metadata/MetadataField.js +2 -1
- package/dist/field/metadata/MetadataField.view.js +18 -18
- package/dist/field/number/NumberField.d.ts +2 -0
- package/dist/field/number/NumberField.view.js +4 -2
- package/dist/field/richtext/PickTextLink.d.ts +7 -0
- package/dist/field/richtext/PickTextLink.js +104 -2
- package/dist/field/richtext/ReferenceLink.d.ts +4 -1
- package/dist/field/richtext/ReferenceLink.js +18 -4
- package/dist/field/richtext/RichTextBlock.js +2 -2
- package/dist/field/richtext/RichTextDocument.d.ts +7 -2
- package/dist/field/richtext/RichTextDocument.js +34 -5
- package/dist/field/richtext/RichTextExtensions.d.ts +3 -1
- package/dist/field/richtext/RichTextExtensions.js +2701 -7464
- package/dist/field/richtext/RichTextField.d.ts +4 -0
- package/dist/field/richtext/RichTextField.story.d.ts +4 -0
- package/dist/field/richtext/RichTextField.view.js +43 -20
- package/dist/field/richtext/RichTextInsertMenu.js +279 -493
- package/dist/field/richtext/RichTextToolbar.d.ts +5 -2
- package/dist/field/richtext/RichTextToolbar.js +38 -3
- package/dist/field/richtext/Toolbar.d.ts +19 -1
- package/dist/field/richtext/Toolbar.js +18 -13
- package/dist/field/richtext/extensions/Anchor.js +1 -1
- package/dist/field/richtext/extensions/Link.js +1 -1
- package/dist/field/richtext/extensions/Small.js +1 -1
- package/dist/field/select/SelectField.view.js +8 -6
- package/dist/index.css +240 -14
- package/dist/next.cjs +18 -16
- package/dist/next.d.ts +2 -1
- package/dist/next.edge.d.ts +2 -1
- package/dist/preview/PreviewMessage.d.ts +3 -0
- package/dist/preview/PreviewMessage.js +1 -0
- package/dist/preview/RegisterPreview.js +29 -9
- package/dist/preview/widget.js +6 -12
- package/dist/query.d.ts +7 -7
- package/dist/ui/RichText.d.ts +1 -0
- package/dist/ui/RichText.js +29 -2
- package/package.json +6 -3
- package/dist/chunks/{chunk-JFROOUG6.js → chunk-NIVGVRDS.js} +17 -17
|
@@ -31,7 +31,9 @@ import { EntryScope } from "../../hooks.js";
|
|
|
31
31
|
import {
|
|
32
32
|
IcBaselineErrorOutline,
|
|
33
33
|
IcOutlineViewList,
|
|
34
|
-
IcRoundEdit
|
|
34
|
+
IcRoundEdit,
|
|
35
|
+
IcRoundCheck,
|
|
36
|
+
IcRoundSave
|
|
35
37
|
} from "../../icons.js";
|
|
36
38
|
import { FileEditor } from "./../editor/FileEditor.js";
|
|
37
39
|
import { CreateEntryButton } from "./../DashboardLayout.js";
|
|
@@ -43,6 +45,7 @@ import {
|
|
|
43
45
|
} from "./../EntrySidebar.js";
|
|
44
46
|
import { EntryTranslationBanner } from "./../EntryTranslationBanner.js";
|
|
45
47
|
import { Explorer } from "./../Explorer.js";
|
|
48
|
+
import { SidebarLayout } from "../SidebarLayout.js";
|
|
46
49
|
import {
|
|
47
50
|
DashboardModal,
|
|
48
51
|
DashboardModalContent,
|
|
@@ -53,31 +56,31 @@ import { Rail, RailBody, RailContent } from "./../ui/Rail.js";
|
|
|
53
56
|
|
|
54
57
|
// src/dashboard/app/pages/EntryPage.module.css
|
|
55
58
|
var EntryPage_default = {
|
|
56
|
-
"EntryEditor-
|
|
57
|
-
"
|
|
58
|
-
"MissingEntry
|
|
59
|
-
"
|
|
59
|
+
"EntryEditor-body": "alinea-EntryEditor-body",
|
|
60
|
+
"EntryEditorBody": "alinea-EntryEditor-body",
|
|
61
|
+
"MissingEntry": "alinea-MissingEntry",
|
|
62
|
+
"MissingEntry-card": "alinea-MissingEntry-card",
|
|
63
|
+
"MissingEntryCard": "alinea-MissingEntry-card",
|
|
60
64
|
"MissingEntry-message": "alinea-MissingEntry-message",
|
|
61
65
|
"MissingEntryMessage": "alinea-MissingEntry-message",
|
|
66
|
+
"MissingEntry-id": "alinea-MissingEntry-id",
|
|
67
|
+
"MissingEntryId": "alinea-MissingEntry-id",
|
|
62
68
|
"EntryEditor-fields": "alinea-EntryEditor-fields",
|
|
63
69
|
"EntryEditorFields": "alinea-EntryEditor-fields",
|
|
64
70
|
"EntryEditor-banner": "alinea-EntryEditor-banner",
|
|
65
71
|
"EntryEditorBanner": "alinea-EntryEditor-banner",
|
|
66
|
-
"EntryEditor-header": "alinea-EntryEditor-header",
|
|
67
|
-
"EntryEditorHeader": "alinea-EntryEditor-header",
|
|
68
|
-
"EntryOverview-mobileActions": "alinea-EntryOverview-mobileActions",
|
|
69
|
-
"EntryOverviewMobileActions": "alinea-EntryOverview-mobileActions",
|
|
70
|
-
"MissingEntry-card": "alinea-MissingEntry-card",
|
|
71
|
-
"MissingEntryCard": "alinea-MissingEntry-card",
|
|
72
72
|
"EntryEditor-toolbar": "alinea-EntryEditor-toolbar",
|
|
73
73
|
"EntryEditorToolbar": "alinea-EntryEditor-toolbar",
|
|
74
|
-
"MissingEntry": "alinea-MissingEntry",
|
|
75
74
|
"MissingEntry-icon": "alinea-MissingEntry-icon",
|
|
76
75
|
"MissingEntryIcon": "alinea-MissingEntry-icon",
|
|
77
|
-
"EntryEditor-
|
|
78
|
-
"
|
|
79
|
-
"MissingEntry-
|
|
80
|
-
"
|
|
76
|
+
"EntryEditor-title": "alinea-EntryEditor-title",
|
|
77
|
+
"EntryEditorTitle": "alinea-EntryEditor-title",
|
|
78
|
+
"MissingEntry-title": "alinea-MissingEntry-title",
|
|
79
|
+
"MissingEntryTitle": "alinea-MissingEntry-title",
|
|
80
|
+
"EntryOverview-mobileActions": "alinea-EntryOverview-mobileActions",
|
|
81
|
+
"EntryOverviewMobileActions": "alinea-EntryOverview-mobileActions",
|
|
82
|
+
"EntryEditor-header": "alinea-EntryEditor-header",
|
|
83
|
+
"EntryEditorHeader": "alinea-EntryEditor-header"
|
|
81
84
|
};
|
|
82
85
|
|
|
83
86
|
// src/dashboard/app/pages/EntryPage.tsx
|
|
@@ -106,17 +109,21 @@ var entryPage = page(async (page2, get) => {
|
|
|
106
109
|
);
|
|
107
110
|
}
|
|
108
111
|
const selectedNode = await get(localeData.selectedNode);
|
|
112
|
+
const richTextImages = await get(localeData.richTextImages);
|
|
109
113
|
const parentNeedsTranslation = type.customView ? false : await get(localeData.parentNeedsTranslation);
|
|
110
114
|
const sourceLocale = get(localeData.translationSourceLocale);
|
|
111
|
-
const
|
|
115
|
+
const isSidebarOpen = get(entrySidebarOpenAtom);
|
|
116
|
+
const sidebar = await entrySidebar(get, entry, localeData, isSidebarOpen);
|
|
112
117
|
return /* @__PURE__ */ jsx(
|
|
113
118
|
EntryEditorContent,
|
|
114
119
|
{
|
|
115
120
|
entry,
|
|
121
|
+
isSidebarOpen: Boolean(sidebar && isSidebarOpen),
|
|
116
122
|
localeData,
|
|
117
123
|
node: selectedNode,
|
|
118
124
|
page: page2,
|
|
119
125
|
parentNeedsTranslation,
|
|
126
|
+
richTextImages,
|
|
120
127
|
selectedEntry,
|
|
121
128
|
sidebar,
|
|
122
129
|
sourceLocale
|
|
@@ -229,8 +236,10 @@ function EntryOverview({
|
|
|
229
236
|
function EntryEditorContent({
|
|
230
237
|
page: page2,
|
|
231
238
|
entry,
|
|
239
|
+
isSidebarOpen,
|
|
232
240
|
localeData,
|
|
233
241
|
parentNeedsTranslation,
|
|
242
|
+
richTextImages,
|
|
234
243
|
selectedEntry,
|
|
235
244
|
sidebar,
|
|
236
245
|
sourceLocale,
|
|
@@ -252,7 +261,7 @@ function EntryEditorContent({
|
|
|
252
261
|
const reset = useSetAtom(node.reset);
|
|
253
262
|
const [routeBlock, setRouteBlock] = useAtom(routeBlockAtom);
|
|
254
263
|
const setRouteGuard = useSetAtom(routeGuardAtom);
|
|
255
|
-
const
|
|
264
|
+
const setSidebarOpen = useSetAtom(entrySidebarOpenAtom);
|
|
256
265
|
const editorBodyRef = useRef(null);
|
|
257
266
|
const isMediaFile = type.type === MediaFile;
|
|
258
267
|
const isMediaLibrary = type.type === MediaLibrary;
|
|
@@ -299,6 +308,7 @@ function EntryEditorContent({
|
|
|
299
308
|
{
|
|
300
309
|
entry,
|
|
301
310
|
localeData,
|
|
311
|
+
richTextImages,
|
|
302
312
|
selectedEntry,
|
|
303
313
|
children: /* @__PURE__ */ jsx(View, { type: type.type })
|
|
304
314
|
}
|
|
@@ -330,22 +340,36 @@ function EntryEditorContent({
|
|
|
330
340
|
children: routeBlock && /* @__PURE__ */ jsxs(DashboardModalDialog, { label: "Confirm navigation", children: [
|
|
331
341
|
/* @__PURE__ */ jsx(DashboardModalContent, { children: "This entry has unsaved changes" }),
|
|
332
342
|
/* @__PURE__ */ jsxs(DashboardModalFooter, { children: [
|
|
333
|
-
/* @__PURE__ */ jsx(Button, { onPress: discardAndConfirm,
|
|
334
|
-
/* @__PURE__ */ jsx(
|
|
343
|
+
/* @__PURE__ */ jsx(Button, { onPress: discardAndConfirm, appearance: "plain", children: "Discard my changes" }),
|
|
344
|
+
/* @__PURE__ */ jsx(
|
|
345
|
+
Button,
|
|
346
|
+
{
|
|
347
|
+
onPress: saveAndConfirm,
|
|
348
|
+
intent: "primary",
|
|
349
|
+
icon: mediaDraftsDisabled ? IcRoundCheck : IcRoundSave,
|
|
350
|
+
children: mediaDraftsDisabled ? "Publish" : "Save as draft"
|
|
351
|
+
}
|
|
352
|
+
)
|
|
335
353
|
] })
|
|
336
354
|
] })
|
|
337
355
|
}
|
|
338
356
|
),
|
|
339
|
-
/* @__PURE__ */
|
|
357
|
+
/* @__PURE__ */ jsx(
|
|
340
358
|
EntryScope,
|
|
341
359
|
{
|
|
342
360
|
entry,
|
|
343
361
|
localeData,
|
|
362
|
+
richTextImages,
|
|
344
363
|
selectedEntry,
|
|
345
|
-
children:
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
364
|
+
children: /* @__PURE__ */ jsx(
|
|
365
|
+
SidebarLayout,
|
|
366
|
+
{
|
|
367
|
+
side: "right",
|
|
368
|
+
visible: Boolean(sidebar && isSidebarOpen),
|
|
369
|
+
sidebar: sidebar && isSidebarOpen && /* @__PURE__ */ jsx(EntrySidebar, { ...sidebar, onOpenChange: setSidebarOpen }),
|
|
370
|
+
children: mainEditor
|
|
371
|
+
}
|
|
372
|
+
)
|
|
349
373
|
}
|
|
350
374
|
)
|
|
351
375
|
] });
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
} from "../../../chunks/chunk-Y7XOMJOC.js";
|
|
10
10
|
import {
|
|
11
11
|
$232f8dea1b0a4f2f$export$762f73dccccd255d
|
|
12
|
-
} from "../../../chunks/chunk-
|
|
13
|
-
import "../../../chunks/chunk-SJBZFMQ2.js";
|
|
12
|
+
} from "../../../chunks/chunk-NIVGVRDS.js";
|
|
14
13
|
import "../../../chunks/chunk-IYAQC63Y.js";
|
|
14
|
+
import "../../../chunks/chunk-SJBZFMQ2.js";
|
|
15
15
|
import "../../../chunks/chunk-AC4U3IMS.js";
|
|
16
16
|
import {
|
|
17
17
|
dist_default
|
|
@@ -56,54 +56,54 @@ import { SidebarHeader } from "../ui/Sidebar.js";
|
|
|
56
56
|
|
|
57
57
|
// src/dashboard/app/pages/UsersPage.module.css
|
|
58
58
|
var UsersPage_default = {
|
|
59
|
-
"UsersPage-
|
|
60
|
-
"
|
|
61
|
-
"UsersPage-confirmation": "alinea-UsersPage-confirmation",
|
|
62
|
-
"UsersPageConfirmation": "alinea-UsersPage-confirmation",
|
|
63
|
-
"UsersPageSidebar-item": "alinea-UsersPageSidebar-item",
|
|
64
|
-
"UsersPageSidebarItem": "alinea-UsersPageSidebar-item",
|
|
65
|
-
"UsersPage-identity-title": "alinea-UsersPage-identity-title",
|
|
66
|
-
"UsersPageIdentityTitle": "alinea-UsersPage-identity-title",
|
|
59
|
+
"UsersPage-empty": "alinea-UsersPage-empty",
|
|
60
|
+
"UsersPageEmpty": "alinea-UsersPage-empty",
|
|
67
61
|
"UsersPage-identity": "alinea-UsersPage-identity",
|
|
68
62
|
"UsersPageIdentity": "alinea-UsersPage-identity",
|
|
69
63
|
"UsersPage-createButton": "alinea-UsersPage-createButton",
|
|
70
64
|
"UsersPageCreateButton": "alinea-UsersPage-createButton",
|
|
71
|
-
"UsersPage-
|
|
72
|
-
"
|
|
73
|
-
"UsersPage-
|
|
74
|
-
"
|
|
75
|
-
"UsersPage-
|
|
76
|
-
"
|
|
77
|
-
"UsersPage-
|
|
78
|
-
"
|
|
65
|
+
"UsersPage-status": "alinea-UsersPage-status",
|
|
66
|
+
"UsersPageStatus": "alinea-UsersPage-status",
|
|
67
|
+
"UsersPage-header": "alinea-UsersPage-header",
|
|
68
|
+
"UsersPageHeader": "alinea-UsersPage-header",
|
|
69
|
+
"UsersPage-confirmation": "alinea-UsersPage-confirmation",
|
|
70
|
+
"UsersPageConfirmation": "alinea-UsersPage-confirmation",
|
|
71
|
+
"UsersPage-identity-title": "alinea-UsersPage-identity-title",
|
|
72
|
+
"UsersPageIdentityTitle": "alinea-UsersPage-identity-title",
|
|
73
|
+
"UsersPage-status-text": "alinea-UsersPage-status-text",
|
|
74
|
+
"UsersPageStatusText": "alinea-UsersPage-status-text",
|
|
75
|
+
"UsersPage-rolesCell": "alinea-UsersPage-rolesCell",
|
|
76
|
+
"UsersPageRolesCell": "alinea-UsersPage-rolesCell",
|
|
77
|
+
"UsersPage": "alinea-UsersPage",
|
|
78
|
+
"UsersPageSidebar-item": "alinea-UsersPageSidebar-item",
|
|
79
|
+
"UsersPageSidebarItem": "alinea-UsersPageSidebar-item",
|
|
79
80
|
"UsersPage-header-title": "alinea-UsersPage-header-title",
|
|
80
81
|
"UsersPageHeaderTitle": "alinea-UsersPage-header-title",
|
|
82
|
+
"UsersPage-noRoles": "alinea-UsersPage-noRoles",
|
|
83
|
+
"UsersPageNoRoles": "alinea-UsersPage-noRoles",
|
|
81
84
|
"UsersPageSidebar-nav": "alinea-UsersPageSidebar-nav",
|
|
82
85
|
"UsersPageSidebarNav": "alinea-UsersPageSidebar-nav",
|
|
83
|
-
"UsersPage-
|
|
84
|
-
"
|
|
86
|
+
"UsersPage-form-fields": "alinea-UsersPage-form-fields",
|
|
87
|
+
"UsersPageFormFields": "alinea-UsersPage-form-fields",
|
|
88
|
+
"UsersPage-form-error": "alinea-UsersPage-form-error",
|
|
89
|
+
"UsersPageFormError": "alinea-UsersPage-form-error",
|
|
85
90
|
"UsersPageSidebar-icon": "alinea-UsersPageSidebar-icon",
|
|
86
91
|
"UsersPageSidebarIcon": "alinea-UsersPageSidebar-icon",
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
92
|
+
"UsersPageSidebar-footer": "alinea-UsersPageSidebar-footer",
|
|
93
|
+
"UsersPageSidebarFooter": "alinea-UsersPageSidebar-footer",
|
|
94
|
+
"UsersPageSidebar": "alinea-UsersPageSidebar",
|
|
95
|
+
"UsersPage-search": "alinea-UsersPage-search",
|
|
96
|
+
"UsersPageSearch": "alinea-UsersPage-search",
|
|
90
97
|
"UsersPage-content": "alinea-UsersPage-content",
|
|
91
98
|
"UsersPageContent": "alinea-UsersPage-content",
|
|
92
|
-
"UsersPage-
|
|
93
|
-
"
|
|
94
|
-
"UsersPage-
|
|
95
|
-
"
|
|
99
|
+
"UsersPage-table": "alinea-UsersPage-table",
|
|
100
|
+
"UsersPageTable": "alinea-UsersPage-table",
|
|
101
|
+
"UsersPage-identity-text": "alinea-UsersPage-identity-text",
|
|
102
|
+
"UsersPageIdentityText": "alinea-UsersPage-identity-text",
|
|
96
103
|
"UsersPage-identity-email": "alinea-UsersPage-identity-email",
|
|
97
104
|
"UsersPageIdentityEmail": "alinea-UsersPage-identity-email",
|
|
98
105
|
"UsersPage-roles": "alinea-UsersPage-roles",
|
|
99
|
-
"UsersPageRoles": "alinea-UsersPage-roles"
|
|
100
|
-
"UsersPageSidebar-footer": "alinea-UsersPageSidebar-footer",
|
|
101
|
-
"UsersPageSidebarFooter": "alinea-UsersPageSidebar-footer",
|
|
102
|
-
"UsersPage-noRoles": "alinea-UsersPage-noRoles",
|
|
103
|
-
"UsersPageNoRoles": "alinea-UsersPage-noRoles",
|
|
104
|
-
"UsersPage-status": "alinea-UsersPage-status",
|
|
105
|
-
"UsersPageStatus": "alinea-UsersPage-status",
|
|
106
|
-
"UsersPageSidebar": "alinea-UsersPageSidebar"
|
|
106
|
+
"UsersPageRoles": "alinea-UsersPage-roles"
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
// src/dashboard/app/pages/UsersPage.tsx
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
$f2ff30fde7b014be$export$d2f961adcb0afbe
|
|
4
|
-
} from "../../../chunks/chunk-
|
|
5
|
-
import "../../../chunks/chunk-
|
|
4
|
+
} from "../../../chunks/chunk-VXZM6V4P.js";
|
|
5
|
+
import "../../../chunks/chunk-O7XWTMCB.js";
|
|
6
6
|
import "../../../chunks/chunk-RKDPDEF7.js";
|
|
7
|
-
import "../../../chunks/chunk-
|
|
8
|
-
import "../../../chunks/chunk-SJBZFMQ2.js";
|
|
7
|
+
import "../../../chunks/chunk-NIVGVRDS.js";
|
|
9
8
|
import "../../../chunks/chunk-IYAQC63Y.js";
|
|
10
|
-
import "../../../chunks/chunk-
|
|
11
|
-
import "../../../chunks/chunk-
|
|
9
|
+
import "../../../chunks/chunk-SJBZFMQ2.js";
|
|
10
|
+
import "../../../chunks/chunk-6V4TAD2N.js";
|
|
11
|
+
import "../../../chunks/chunk-S4AU6SRS.js";
|
|
12
12
|
import "../../../chunks/chunk-AC4U3IMS.js";
|
|
13
13
|
import {
|
|
14
14
|
dist_default
|
|
@@ -24,32 +24,32 @@ import { IcRoundClose } from "../../icons.js";
|
|
|
24
24
|
|
|
25
25
|
// src/dashboard/app/ui/DashboardModal.module.css
|
|
26
26
|
var DashboardModal_default = {
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"DashboardModal
|
|
30
|
-
"DashboardModalEnter": "alinea-DashboardModal-enter",
|
|
31
|
-
"DashboardModalForm": "alinea-DashboardModalForm",
|
|
27
|
+
"DashboardModalFooter": "alinea-DashboardModalFooter",
|
|
28
|
+
"DashboardModalContent": "alinea-DashboardModalContent",
|
|
29
|
+
"DashboardModal": "alinea-DashboardModal",
|
|
32
30
|
"DashboardModalOverlay": "alinea-DashboardModalOverlay",
|
|
33
|
-
"is-explorer": "alinea-is-explorer",
|
|
34
|
-
"isExplorer": "alinea-is-explorer",
|
|
35
|
-
"DashboardModalCloseButton": "alinea-DashboardModalCloseButton",
|
|
36
31
|
"DashboardModalFormHeader": "alinea-DashboardModalFormHeader",
|
|
37
32
|
"DashboardModalDialog": "alinea-DashboardModalDialog",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
33
|
+
"DashboardModalDialog-header": "alinea-DashboardModalDialog-header",
|
|
34
|
+
"DashboardModalDialogHeader": "alinea-DashboardModalDialog-header",
|
|
40
35
|
"DashboardModalDialog-controls": "alinea-DashboardModalDialog-controls",
|
|
41
36
|
"DashboardModalDialogControls": "alinea-DashboardModalDialog-controls",
|
|
42
|
-
"
|
|
37
|
+
"is-loading": "alinea-is-loading",
|
|
38
|
+
"isLoading": "alinea-is-loading",
|
|
39
|
+
"is-explorer": "alinea-is-explorer",
|
|
40
|
+
"isExplorer": "alinea-is-explorer",
|
|
41
|
+
"DashboardModal-enter": "alinea-DashboardModal-enter",
|
|
42
|
+
"DashboardModalEnter": "alinea-DashboardModal-enter",
|
|
43
43
|
"DashboardModalTitle": "alinea-DashboardModalTitle",
|
|
44
|
-
"
|
|
45
|
-
"DashboardModalFormFooter": "alinea-DashboardModalFormFooter",
|
|
44
|
+
"DashboardModalFormBody": "alinea-DashboardModalFormBody",
|
|
46
45
|
"DashboardModalDialog-loader": "alinea-DashboardModalDialog-loader",
|
|
47
46
|
"DashboardModalDialogLoader": "alinea-DashboardModalDialog-loader",
|
|
48
47
|
"DashboardModalSeparator": "alinea-DashboardModalSeparator",
|
|
49
|
-
"DashboardModal": "alinea-DashboardModal",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
48
|
+
"DashboardModal-surface": "alinea-DashboardModal-surface",
|
|
49
|
+
"DashboardModalSurface": "alinea-DashboardModal-surface",
|
|
50
|
+
"DashboardModalForm": "alinea-DashboardModalForm",
|
|
51
|
+
"DashboardModalCloseButton": "alinea-DashboardModalCloseButton",
|
|
52
|
+
"DashboardModalFormFooter": "alinea-DashboardModalFormFooter"
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
// src/dashboard/app/ui/DashboardModal.tsx
|
|
@@ -5,12 +5,12 @@ import "../../../chunks/chunk-CQ52GEHY.js";
|
|
|
5
5
|
|
|
6
6
|
// src/dashboard/app/ui/Rail.module.css
|
|
7
7
|
var Rail_default = {
|
|
8
|
+
"RailFooter": "alinea-RailFooter",
|
|
9
|
+
"RailHeader": "alinea-RailHeader",
|
|
10
|
+
"RailBody": "alinea-RailBody",
|
|
8
11
|
"is-main": "alinea-is-main",
|
|
9
12
|
"isMain": "alinea-is-main",
|
|
10
13
|
"Rail": "alinea-Rail",
|
|
11
|
-
"RailFooter": "alinea-RailFooter",
|
|
12
|
-
"RailBody": "alinea-RailBody",
|
|
13
|
-
"RailHeader": "alinea-RailHeader",
|
|
14
14
|
"RailContent": "alinea-RailContent"
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -8,9 +8,9 @@ import { Rail, RailHeader } from "./Rail.js";
|
|
|
8
8
|
|
|
9
9
|
// src/dashboard/app/ui/Sidebar.module.css
|
|
10
10
|
var Sidebar_default = {
|
|
11
|
-
"
|
|
11
|
+
"SidebarHeader": "alinea-SidebarHeader",
|
|
12
12
|
"Sidebar": "alinea-Sidebar",
|
|
13
|
-
"
|
|
13
|
+
"SidebarBody": "alinea-SidebarBody"
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
// src/dashboard/app/ui/Sidebar.tsx
|
|
@@ -23,6 +23,8 @@ var authAtom = Object.assign(
|
|
|
23
23
|
atom(
|
|
24
24
|
(get) => {
|
|
25
25
|
if (!get(authRequiredAtom)) {
|
|
26
|
+
const state = get(authState);
|
|
27
|
+
if (state.status === "authenticated") return state;
|
|
26
28
|
const userData = typeof process !== "undefined" && process.env.ALINEA_USER;
|
|
27
29
|
return {
|
|
28
30
|
status: "authenticated",
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import type { SetStateAction } from 'react';
|
|
2
2
|
export type DashboardTheme = 'system' | 'light' | 'dark';
|
|
3
|
+
export declare const dashboardMobileAtom: import("jotai").PrimitiveAtom<boolean> & {
|
|
4
|
+
init: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare const navigationSidebarWidthAtom: import("jotai").PrimitiveAtom<number> & {
|
|
7
|
+
init: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const entrySidebarWidthAtom: import("jotai").PrimitiveAtom<number> & {
|
|
10
|
+
init: number;
|
|
11
|
+
};
|
|
3
12
|
export declare const entrySidebarOpenAtom: import("jotai").PrimitiveAtom<boolean> & {
|
|
4
13
|
init: boolean;
|
|
5
14
|
};
|
|
@@ -15,6 +15,20 @@ var themeStorageAtom = atomWithStorage(
|
|
|
15
15
|
"system",
|
|
16
16
|
void 0
|
|
17
17
|
);
|
|
18
|
+
var mobileMediaQuery = "(max-width: 768px)";
|
|
19
|
+
var dashboardMobileAtom = atom(
|
|
20
|
+
typeof window !== "undefined" && (window.matchMedia?.(mobileMediaQuery).matches ?? false)
|
|
21
|
+
);
|
|
22
|
+
dashboardMobileAtom.onMount = (setMobile) => {
|
|
23
|
+
const media = window.matchMedia?.(mobileMediaQuery);
|
|
24
|
+
if (!media) return;
|
|
25
|
+
const update = () => setMobile(media.matches);
|
|
26
|
+
update();
|
|
27
|
+
media.addEventListener("change", update);
|
|
28
|
+
return () => media.removeEventListener("change", update);
|
|
29
|
+
};
|
|
30
|
+
var navigationSidebarWidthAtom = atom(320);
|
|
31
|
+
var entrySidebarWidthAtom = atom(320);
|
|
18
32
|
var entrySidebarOpenAtom = atom(
|
|
19
33
|
typeof window === "undefined" || !window.matchMedia?.("(max-width: 768px)").matches
|
|
20
34
|
);
|
|
@@ -65,7 +79,10 @@ function applyDashboardTheme(theme) {
|
|
|
65
79
|
}
|
|
66
80
|
export {
|
|
67
81
|
canLogoutAtom,
|
|
82
|
+
dashboardMobileAtom,
|
|
68
83
|
entrySidebarOpenAtom,
|
|
84
|
+
entrySidebarWidthAtom,
|
|
69
85
|
logoutAtom,
|
|
86
|
+
navigationSidebarWidthAtom,
|
|
70
87
|
themeAtom
|
|
71
88
|
};
|
|
@@ -5,6 +5,10 @@ import { Section } from 'alinea/core/Section';
|
|
|
5
5
|
import { Type } from 'alinea/core/Type';
|
|
6
6
|
import type { Atom, WritableAtom } from 'jotai';
|
|
7
7
|
import type { ComponentType, ReactNode } from 'react';
|
|
8
|
+
export interface ResolvedEditorImage {
|
|
9
|
+
src: string;
|
|
10
|
+
alt: string;
|
|
11
|
+
}
|
|
8
12
|
export interface EditorNode {
|
|
9
13
|
readOnly: boolean;
|
|
10
14
|
nodes: WritableAtom<unknown, [unknown], void>;
|
|
@@ -15,6 +19,7 @@ export interface EditorModel {
|
|
|
15
19
|
anchors: Atom<Array<EntryAnchorTarget>>;
|
|
16
20
|
node: EditorNode;
|
|
17
21
|
parent?: EditorModel;
|
|
22
|
+
resolvedImages: ReadonlyMap<string, ResolvedEditorImage>;
|
|
18
23
|
sections: Array<EditorSection>;
|
|
19
24
|
type: Type;
|
|
20
25
|
field(key: string): EditorField | undefined;
|
|
@@ -45,10 +50,11 @@ export declare class EntryEditor implements EditorModel {
|
|
|
45
50
|
parent?: EntryEditor | undefined;
|
|
46
51
|
resource?: Resource | undefined;
|
|
47
52
|
policy?: Policy | undefined;
|
|
53
|
+
resolvedImages: ReadonlyMap<string, ResolvedEditorImage>;
|
|
48
54
|
anchors: Atom<Array<EntryAnchorTarget>>;
|
|
49
55
|
value: Atom<object>;
|
|
50
56
|
sections: Array<EntryEditorSection>;
|
|
51
|
-
constructor(type: Type, node: EditorNode, parent?: EntryEditor | undefined, resource?: Resource | undefined, policy?: Policy | undefined);
|
|
57
|
+
constructor(type: Type, node: EditorNode, parent?: EntryEditor | undefined, resource?: Resource | undefined, policy?: Policy | undefined, resolvedImages?: ReadonlyMap<string, ResolvedEditorImage>);
|
|
52
58
|
field: (key: string) => EntryEditorField | undefined;
|
|
53
59
|
get(field: Field): EntryEditorField | undefined;
|
|
54
60
|
}
|
|
@@ -12,13 +12,15 @@ import { Type } from "alinea/core/Type";
|
|
|
12
12
|
import { assert } from "alinea/core/util/Assert";
|
|
13
13
|
import { configAtom, viewsAtom } from "./core.js";
|
|
14
14
|
import { dispense } from "./utils.js";
|
|
15
|
+
var emptyResolvedImages = /* @__PURE__ */ new Map();
|
|
15
16
|
var EntryEditor = class {
|
|
16
|
-
constructor(type, node, parent, resource, policy) {
|
|
17
|
+
constructor(type, node, parent, resource, policy, resolvedImages = parent?.resolvedImages ?? emptyResolvedImages) {
|
|
17
18
|
this.type = type;
|
|
18
19
|
this.node = node;
|
|
19
20
|
this.parent = parent;
|
|
20
21
|
this.resource = resource;
|
|
21
22
|
this.policy = policy;
|
|
23
|
+
this.resolvedImages = resolvedImages;
|
|
22
24
|
this.resource ??= parent?.resource;
|
|
23
25
|
this.policy ??= parent?.policy;
|
|
24
26
|
this.value = node.value;
|
|
@@ -34,6 +36,7 @@ var EntryEditor = class {
|
|
|
34
36
|
parent;
|
|
35
37
|
resource;
|
|
36
38
|
policy;
|
|
39
|
+
resolvedImages;
|
|
37
40
|
anchors;
|
|
38
41
|
value;
|
|
39
42
|
sections;
|
|
@@ -3,6 +3,7 @@ import { Entry, EntryStatus } from 'alinea/core/Entry';
|
|
|
3
3
|
import type { Order } from 'alinea/core/Graph';
|
|
4
4
|
import { type EntryDefaultView } from 'alinea/core/Type';
|
|
5
5
|
import { Atom, Getter } from 'jotai';
|
|
6
|
+
import type { ResolvedEditorImage } from './editor.js';
|
|
6
7
|
import { ReactiveNode } from './ReactiveNode.js';
|
|
7
8
|
interface EntryData {
|
|
8
9
|
id: string;
|
|
@@ -68,6 +69,7 @@ export declare class EntryLocaleAtoms {
|
|
|
68
69
|
historyReady: Atom<Promise<import("../../core/Connection.js").Revision[]>>;
|
|
69
70
|
history: Atom<import("../../core/Connection.js").Revision[]>;
|
|
70
71
|
selectedNode: Atom<Promise<ReactiveNode<object>>>;
|
|
72
|
+
richTextImages: Atom<Promise<Map<string, ResolvedEditorImage>>>;
|
|
71
73
|
anchors: Atom<Promise<import("alinea/core/Field").EntryAnchorTarget[]>>;
|
|
72
74
|
retryPreviewUrl: import("jotai").WritableAtom<null, [], void> & {
|
|
73
75
|
init: null;
|
|
@@ -123,7 +125,7 @@ export declare class EntryLocaleAtoms {
|
|
|
123
125
|
searchableText: string;
|
|
124
126
|
} | undefined>;
|
|
125
127
|
previewUrlReady: Atom<Promise<string | undefined>>;
|
|
126
|
-
|
|
128
|
+
previewUrlState: Atom<readonly [false, string | undefined] | readonly [true, string | undefined]>;
|
|
127
129
|
previewPayloadSignal: Atom<(object | null | undefined)[]>;
|
|
128
130
|
updatePreviewPayload: import("jotai").WritableAtom<null, [], Promise<string | undefined>> & {
|
|
129
131
|
init: null;
|
|
@@ -13,6 +13,8 @@ import { Entry } from "alinea/core/Entry";
|
|
|
13
13
|
import { createRecord, parseRecord } from "alinea/core/EntryRecord";
|
|
14
14
|
import { getRoot, getType, getWorkspace } from "alinea/core/Internal";
|
|
15
15
|
import { createPreview } from "alinea/core/media/CreatePreview.browser";
|
|
16
|
+
import { mediaAltText } from "alinea/core/media/MediaAltField";
|
|
17
|
+
import { MediaFile } from "alinea/core/media/MediaTypes";
|
|
16
18
|
import { Permission } from "alinea/core/Role";
|
|
17
19
|
import { Root } from "alinea/core/Root";
|
|
18
20
|
import { createFilePatch } from "alinea/core/source/FilePatch";
|
|
@@ -24,9 +26,10 @@ import { encodePreviewPayload } from "alinea/preview/PreviewPayload";
|
|
|
24
26
|
import { parents, translations } from "alinea/query";
|
|
25
27
|
import { clientAtom, configAtom, graphAtom } from "./core.js";
|
|
26
28
|
import { entryRevisionAtom, shaAtom } from "./graph.js";
|
|
29
|
+
import { getPreviewToken, retryPreviewToken } from "./preview.js";
|
|
27
30
|
import { ReactiveNode } from "./ReactiveNode.js";
|
|
28
31
|
import { policyAtom, userAtom } from "./user.js";
|
|
29
|
-
import { dispense, loader } from "./utils.js";
|
|
32
|
+
import { atomWithPending, dispense, loader } from "./utils.js";
|
|
30
33
|
var selection = {
|
|
31
34
|
id: Entry.id,
|
|
32
35
|
type: Entry.type,
|
|
@@ -166,6 +169,46 @@ var EntryLocaleAtoms = class {
|
|
|
166
169
|
});
|
|
167
170
|
return new ReactiveNode(value, readOnly);
|
|
168
171
|
});
|
|
172
|
+
richTextImages = atom(async (get) => {
|
|
173
|
+
const entry = await get(this.selectedEntry);
|
|
174
|
+
const config = get(configAtom);
|
|
175
|
+
const type = config.schema[entry.type];
|
|
176
|
+
assert(type, `Type "${entry.type}" not found in config`);
|
|
177
|
+
const value = Type.withInitialValue(type, {
|
|
178
|
+
...Type.initialValue(type),
|
|
179
|
+
...entry.data
|
|
180
|
+
});
|
|
181
|
+
const imageIds = Array.from(
|
|
182
|
+
new Set(
|
|
183
|
+
Type.references(type, value).filter((reference) => reference.linkType === "image").map((reference) => reference.targetId)
|
|
184
|
+
)
|
|
185
|
+
);
|
|
186
|
+
if (imageIds.length === 0) return /* @__PURE__ */ new Map();
|
|
187
|
+
const graph = get(graphAtom);
|
|
188
|
+
const images = await graph.find({
|
|
189
|
+
id: { in: imageIds },
|
|
190
|
+
preferredLocale: this.requestedLocale ?? entry.locale ?? void 0,
|
|
191
|
+
status: "preferDraft",
|
|
192
|
+
select: {
|
|
193
|
+
id: Entry.id,
|
|
194
|
+
url: Entry.url,
|
|
195
|
+
alt: MediaFile.alt
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
const baseUrl = Config.baseUrl(config) ?? (typeof location === "undefined" ? void 0 : location.href);
|
|
199
|
+
return new Map(
|
|
200
|
+
images.map((image) => [
|
|
201
|
+
image.id,
|
|
202
|
+
{
|
|
203
|
+
src: URL.parse(image.url, baseUrl)?.href ?? "",
|
|
204
|
+
alt: mediaAltText(
|
|
205
|
+
image.alt,
|
|
206
|
+
this.requestedLocale ?? entry.locale ?? void 0
|
|
207
|
+
)
|
|
208
|
+
}
|
|
209
|
+
])
|
|
210
|
+
);
|
|
211
|
+
});
|
|
169
212
|
anchors = atom(async (get) => {
|
|
170
213
|
const entry = await get(this.selectedEntry);
|
|
171
214
|
const node = await get(this.selectedNode);
|
|
@@ -173,9 +216,10 @@ var EntryLocaleAtoms = class {
|
|
|
173
216
|
assert(type, `Type "${entry.type}" not found in config`);
|
|
174
217
|
return Type.anchors(type, get(node.value));
|
|
175
218
|
});
|
|
176
|
-
#
|
|
219
|
+
#previewUrlRetry = atom(0);
|
|
177
220
|
retryPreviewUrl = atom(null, (get, set) => {
|
|
178
|
-
|
|
221
|
+
retryPreviewToken(get(clientAtom));
|
|
222
|
+
set(this.#previewUrlRetry, (current) => current + 1);
|
|
179
223
|
});
|
|
180
224
|
previewEntryReady = atom(async (get) => {
|
|
181
225
|
const activeEntry = await get(this.selectedEntry);
|
|
@@ -189,31 +233,27 @@ var EntryLocaleAtoms = class {
|
|
|
189
233
|
};
|
|
190
234
|
});
|
|
191
235
|
previewEntry = unwrap(this.previewEntryReady, (previous) => previous);
|
|
192
|
-
#previewTargetUrl = atom((get) => {
|
|
193
|
-
const versions = get(this.versions);
|
|
194
|
-
const entry = Array.from(versions.values()).find((version) => version.active) ?? versions.values().next().value;
|
|
195
|
-
return entry?.url;
|
|
196
|
-
});
|
|
197
236
|
previewUrlReady = atom(async (get) => {
|
|
198
|
-
get(this.#
|
|
199
|
-
const
|
|
237
|
+
get(this.#previewUrlRetry);
|
|
238
|
+
const versions = get(this.versions);
|
|
239
|
+
const targetUrl = Array.from(versions.values()).find((version) => version.active)?.url ?? versions.values().next().value?.url;
|
|
200
240
|
if (!targetUrl) return void 0;
|
|
201
241
|
const config = get(configAtom);
|
|
202
|
-
const client = get(clientAtom);
|
|
203
|
-
if (typeof client.previewToken !== "function") return void 0;
|
|
204
242
|
try {
|
|
205
243
|
const base = new URL(
|
|
206
|
-
|
|
244
|
+
Config.handlerUrl(config),
|
|
207
245
|
Config.baseUrl(config) ?? (typeof location === "undefined" ? "http://localhost" : location.href)
|
|
208
246
|
);
|
|
209
|
-
|
|
247
|
+
const previewToken = await getPreviewToken(get(clientAtom));
|
|
248
|
+
if (!previewToken) return void 0;
|
|
249
|
+
base.searchParams.set("preview", previewToken);
|
|
210
250
|
base.searchParams.set("returnTo", targetUrl);
|
|
211
251
|
return base.toString();
|
|
212
252
|
} catch {
|
|
213
253
|
return void 0;
|
|
214
254
|
}
|
|
215
255
|
});
|
|
216
|
-
|
|
256
|
+
previewUrlState = atomWithPending(this.previewUrlReady);
|
|
217
257
|
previewPayloadSignal = atom((get) => {
|
|
218
258
|
const version = get(this.selectedVersion);
|
|
219
259
|
const editing = get(this.currentlyEditing);
|