alinea 2.0.0-preview.0 → 2.0.0-preview.2
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 +134 -80
- 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/with-alinea.js +18 -16
- package/dist/backend/Handler.d.ts +14 -13
- package/dist/backend/Handler.js +70 -36
- package/dist/backend/resolver/ParsePreview.d.ts +8 -4
- package/dist/backend/resolver/ParsePreview.js +40 -43
- package/dist/backend/router/Router.d.ts +1 -0
- package/dist/backend/router/Router.js +21 -15
- package/dist/bundled.d.ts +369 -99
- package/dist/chunks/chunk-6UT4N4CO.js +919 -0
- 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-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-EQ3TDHYD.js → chunk-UVOEM4AH.js} +6 -3
- 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/CompileConfig.js +3 -2
- 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.d.ts +2 -1
- package/dist/cloud/CloudRemote.js +3 -2
- package/dist/components/Breadcrumbs.js +8 -8
- package/dist/components/Button.js +6 -6
- package/dist/components/Calendar.js +11 -11
- package/dist/components/Checkbox.js +7 -7
- 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 +9 -9
- package/dist/components/DatePicker.js +10 -10
- 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 +16 -16
- package/dist/components/Link.js +6 -6
- package/dist/components/List.js +34 -34
- package/dist/components/Menu.js +10 -10
- package/dist/components/Modal.js +8 -8
- package/dist/components/MultipleSelect.js +33 -33
- package/dist/components/NumberField.d.ts +2 -1
- package/dist/components/NumberField.js +21 -11
- package/dist/components/Popover.js +6 -6
- package/dist/components/ProgressCircle.js +10 -10
- package/dist/components/RadioGroup.js +6 -6
- package/dist/components/SearchField.js +11 -11
- package/dist/components/Select.js +13 -13
- package/dist/components/Surface.js +3 -3
- package/dist/components/Switch.js +6 -6
- package/dist/components/Table.js +13 -13
- package/dist/components/Tabs.js +8 -8
- package/dist/components/TagGroup.js +7 -7
- package/dist/components/TextField.js +10 -10
- package/dist/components/TimeField.js +6 -6
- package/dist/components/Toggle.js +6 -6
- package/dist/components/Toolbar.js +7 -7
- package/dist/components/Tooltip.js +10 -10
- package/dist/components/Tree.js +9 -9
- package/dist/core/BlobTransport.d.ts +5 -0
- package/dist/core/BlobTransport.js +79 -0
- package/dist/core/Client.d.ts +2 -1
- package/dist/core/Client.js +17 -12
- package/dist/core/Config.d.ts +4 -0
- package/dist/core/Config.js +6 -0
- package/dist/core/Connection.d.ts +4 -3
- package/dist/core/Connection.js +7 -0
- package/dist/core/Graph.d.ts +3 -4
- 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/Type.d.ts +7 -1
- package/dist/core/db/CommitRequest.d.ts +0 -3
- package/dist/core/db/CommitRequest.js +0 -9
- package/dist/core/db/EntryDB.js +1 -1
- package/dist/core/db/EntryIndex.d.ts +12 -2
- package/dist/core/db/EntryIndex.js +131 -22
- package/dist/core/db/EntryResolver.js +104 -29
- package/dist/core/db/EntryTransaction.d.ts +1 -2
- package/dist/core/db/EntryTransaction.js +29 -22
- package/dist/core/db/LocalDB.d.ts +5 -5
- package/dist/core/db/LocalDB.js +27 -12
- package/dist/core/field/RichTextField.d.ts +30 -3
- package/dist/core/field/RichTextField.js +124 -56
- package/dist/core/media/MediaAltField.d.ts +1 -0
- package/dist/core/media/MediaAltField.js +9 -1
- package/dist/core/media/MediaLocation.d.ts +5 -2
- package/dist/core/media/MediaLocation.js +6 -7
- package/dist/core/media/MediaTypes.js +11 -0
- package/dist/core/source/CombinedSource.d.ts +2 -2
- package/dist/core/source/CombinedSource.js +6 -3
- package/dist/core/source/FSSource.d.ts +4 -3
- package/dist/core/source/FSSource.js +59 -27
- package/dist/core/source/GithubSource.d.ts +2 -2
- package/dist/core/source/GithubSource.js +21 -9
- package/dist/core/source/IndexedDBSource.d.ts +2 -2
- package/dist/core/source/IndexedDBSource.js +3 -1
- package/dist/core/source/MemorySource.d.ts +2 -2
- package/dist/core/source/MemorySource.js +3 -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 +5 -2
- package/dist/core/source/Source.js +3 -3
- package/dist/core/util/Async.d.ts +8 -2
- package/dist/core/util/Async.js +67 -0
- package/dist/core/util/EntryFilenames.d.ts +2 -2
- package/dist/core/util/EntryFilenames.js +3 -3
- package/dist/dashboard/App.css +158 -0
- package/dist/dashboard/App.js +2 -2
- package/dist/dashboard/app/AccessDenied.js +3 -3
- package/dist/dashboard/app/ActivityStatus.js +15 -15
- package/dist/dashboard/app/AppShell.js +1 -1
- package/dist/dashboard/app/AuthView.js +11 -11
- package/dist/dashboard/app/CompactField.js +10 -10
- package/dist/dashboard/app/DashboardErrorBoundary.js +5 -5
- package/dist/dashboard/app/DashboardLayout.js +22 -19
- package/dist/dashboard/app/EntryHeader.js +12 -12
- package/dist/dashboard/app/EntryReferences.js +9 -9
- package/dist/dashboard/app/EntrySidebar.d.ts +1 -1
- package/dist/dashboard/app/EntrySidebar.js +17 -16
- package/dist/dashboard/app/EntrySidebarPreview.d.ts +1 -1
- package/dist/dashboard/app/EntrySidebarPreview.js +19 -14
- package/dist/dashboard/app/EntryTranslationBanner.js +7 -7
- package/dist/dashboard/app/Explorer.js +51 -43
- package/dist/dashboard/app/ExplorerCards.js +34 -34
- package/dist/dashboard/app/ExplorerFileCard.js +18 -18
- package/dist/dashboard/app/ExplorerList.js +13 -13
- package/dist/dashboard/app/ExplorerModal.js +3 -3
- package/dist/dashboard/app/ExplorerTable.js +76 -61
- package/dist/dashboard/app/ExternalLinkPicker.js +15 -4
- package/dist/dashboard/app/LinkPicker.js +8 -8
- package/dist/dashboard/app/LocaleMenu.js +12 -12
- package/dist/dashboard/app/SidebarLayout.d.ts +8 -0
- package/dist/dashboard/app/SidebarLayout.js +1169 -0
- package/dist/dashboard/app/SidebarTree.js +46 -46
- package/dist/dashboard/app/WorkspaceMenu.js +17 -17
- package/dist/dashboard/app/WorkspaceRoots.js +23 -23
- package/dist/dashboard/app/editor/FileEditor.d.ts +2 -1
- package/dist/dashboard/app/editor/FileEditor.js +41 -32
- package/dist/dashboard/app/editor/FilePreview.js +4 -4
- 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 +4 -4
- package/dist/dashboard/app/pages/EntryPage.js +57 -31
- package/dist/dashboard/app/pages/UsersPage.js +33 -33
- 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 +48 -2
- package/dist/dashboard/atoms/entry.js +222 -17
- package/dist/dashboard/atoms/explorer.js +4 -9
- package/dist/dashboard/atoms/preview.d.ts +3 -0
- package/dist/dashboard/atoms/preview.js +18 -1
- package/dist/dashboard/atoms/root.d.ts +4 -1
- package/dist/dashboard/atoms/root.js +96 -157
- 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/check/CheckField.view.js +2 -2
- package/dist/field/code/CodeField.view.js +12 -12
- package/dist/field/date/DateField.view.js +12 -2
- package/dist/field/link/FileLink.d.ts +2 -2
- package/dist/field/link/FileLink.js +5 -3
- package/dist/field/link/ImageLink.d.ts +1 -1
- package/dist/field/link/ImageLink.js +1 -1
- package/dist/field/link/Link.js +2 -2
- package/dist/field/link/LinkField.view.js +155 -128
- package/dist/field/list/ListField.view.js +22 -33
- package/dist/field/metadata/MetadataField.view.js +19 -19
- 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/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 +2704 -7467
- 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 +281 -495
- 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 +227 -16
- package/dist/next.cjs +18 -16
- package/dist/next.d.ts +2 -1
- package/dist/next.edge.d.ts +2 -1
- package/dist/picker/entry/EntryPicker.js +9 -35
- package/dist/preview/PreviewPayload.js +35 -250
- package/dist/ui/RichText.d.ts +1 -0
- package/dist/ui/RichText.js +29 -2
- package/package.json +6 -3
- package/dist/cli/util/ExternalPlugin.d.ts +0 -2
- package/dist/cli/util/ExternalPlugin.js +0 -919
- package/dist/chunks/{chunk-JFROOUG6.js → chunk-NIVGVRDS.js} +17 -17
package/dist/next.cjs
CHANGED
|
@@ -33,12 +33,13 @@ function createCMS() {
|
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
35
|
function withAlinea(config = {}) {
|
|
36
|
-
const
|
|
37
|
-
if (!
|
|
36
|
+
const settings = resolveSettings(config);
|
|
37
|
+
if (!settings) {
|
|
38
38
|
console.warn(
|
|
39
|
-
"Alinea dashboard settings
|
|
39
|
+
"Alinea dashboard settings were not provided; dashboard routing is disabled. Run Next.js through the Alinea CLI."
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
|
+
const adminPath = settings?.adminPath;
|
|
42
43
|
let nextVersion = 15;
|
|
43
44
|
try {
|
|
44
45
|
const require2 = (0, import_node_module.createRequire)((0, import_node_path.resolve)("./index.js"));
|
|
@@ -62,6 +63,10 @@ function withAlinea(config = {}) {
|
|
|
62
63
|
};
|
|
63
64
|
const redirects = adminPath ? createRedirects(config, adminPath) : config.redirects;
|
|
64
65
|
const rewrites = adminPath ? createRewrites(config, adminPath) : config.rewrites;
|
|
66
|
+
const env = settings ? {
|
|
67
|
+
...config.env,
|
|
68
|
+
ALINEA_ADMIN_PATH: settings.adminPath
|
|
69
|
+
} : config.env;
|
|
65
70
|
if (nextVersion < 15)
|
|
66
71
|
return {
|
|
67
72
|
...config,
|
|
@@ -74,7 +79,8 @@ function withAlinea(config = {}) {
|
|
|
74
79
|
},
|
|
75
80
|
images,
|
|
76
81
|
redirects,
|
|
77
|
-
rewrites
|
|
82
|
+
rewrites,
|
|
83
|
+
env
|
|
78
84
|
};
|
|
79
85
|
return {
|
|
80
86
|
...config,
|
|
@@ -84,7 +90,8 @@ function withAlinea(config = {}) {
|
|
|
84
90
|
],
|
|
85
91
|
images,
|
|
86
92
|
redirects,
|
|
87
|
-
rewrites
|
|
93
|
+
rewrites,
|
|
94
|
+
env
|
|
88
95
|
};
|
|
89
96
|
}
|
|
90
97
|
function createRedirects(config, adminPath) {
|
|
@@ -147,17 +154,12 @@ function createRewrites(config, adminPath) {
|
|
|
147
154
|
};
|
|
148
155
|
};
|
|
149
156
|
}
|
|
150
|
-
function
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
);
|
|
157
|
-
if (typeof settings.adminPath === "string" && settings.adminPath)
|
|
158
|
-
return normalizeBasePath(settings.adminPath);
|
|
159
|
-
} catch {
|
|
160
|
-
}
|
|
157
|
+
function resolveSettings(config) {
|
|
158
|
+
const adminPath = config.env?.ALINEA_ADMIN_PATH ?? process.env.ALINEA_ADMIN_PATH;
|
|
159
|
+
if (!adminPath) return;
|
|
160
|
+
return {
|
|
161
|
+
adminPath: normalizeBasePath(adminPath)
|
|
162
|
+
};
|
|
161
163
|
}
|
|
162
164
|
function normalizeBasePath(value) {
|
|
163
165
|
return value.startsWith("/") ? value : `/${value}`;
|
package/dist/next.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { createCMS } from 'alinea/adapter/next/cms';
|
|
2
|
-
export { createHandler } from 'alinea/adapter/next/handler';
|
|
2
|
+
export { createHandler, type NextHandlerOptions } from 'alinea/adapter/next/handler';
|
|
3
|
+
export type { AfterCommitContext, BeforeCommitContext } from 'alinea/backend/Handler';
|
|
3
4
|
export { withAlinea } from 'alinea/adapter/next/with-alinea';
|
package/dist/next.edge.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { createCMS } from 'alinea/adapter/next/cms';
|
|
2
|
-
export { createHandler } from 'alinea/adapter/next/handler';
|
|
2
|
+
export { createHandler, type NextHandlerOptions } from 'alinea/adapter/next/handler';
|
|
3
|
+
export type { AfterCommitContext, BeforeCommitContext } from 'alinea/backend/Handler';
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import "../../chunks/chunk-CQ52GEHY.js";
|
|
2
2
|
|
|
3
3
|
// src/picker/entry/EntryPicker.ts
|
|
4
|
-
import { Entry } from "alinea/core/Entry";
|
|
5
|
-
import { MediaLocation } from "alinea/core/media/MediaLocation";
|
|
6
|
-
import { MediaFile } from "alinea/core/media/MediaTypes";
|
|
7
4
|
import { Reference } from "alinea/core/Reference";
|
|
8
5
|
import { Root } from "alinea/core/Root";
|
|
9
6
|
import { Type, type } from "alinea/core/Type";
|
|
@@ -38,65 +35,42 @@ function entryPicker(options) {
|
|
|
38
35
|
}
|
|
39
36
|
const linkIds = [entryId];
|
|
40
37
|
if (!options.selection) return;
|
|
41
|
-
const
|
|
42
|
-
...options.selection,
|
|
43
|
-
_media: {
|
|
44
|
-
entryUrl: Entry.url,
|
|
45
|
-
extension: MediaFile.extension,
|
|
46
|
-
location: MediaFile.location,
|
|
47
|
-
path: Entry.path,
|
|
48
|
-
root: Entry.root,
|
|
49
|
-
workspace: Entry.workspace
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
const [extra] = await loader.resolveLinks(selection, linkIds);
|
|
38
|
+
const [extra] = await loader.resolveLinks(options.selection, linkIds);
|
|
53
39
|
if (!extra) {
|
|
54
40
|
row[unresolvedEntryMarker] = true;
|
|
55
41
|
return;
|
|
56
42
|
}
|
|
57
|
-
const { _media: media, ...selected } = extra;
|
|
58
43
|
if (type2 === "file") {
|
|
59
|
-
const {
|
|
60
|
-
extension: extension2,
|
|
61
|
-
href: _href,
|
|
62
|
-
root: _root2,
|
|
63
|
-
url,
|
|
64
|
-
workspace: _workspace2,
|
|
65
|
-
...rest2
|
|
66
|
-
} = selected;
|
|
67
|
-
const mediaUrl2 = MediaLocation.publicUrl(loader.resolver.config, media);
|
|
44
|
+
const { extension: extension2, root: _root2, workspace: _workspace2, ...rest2 } = extra;
|
|
68
45
|
assign(row, rest2, { extension: extension2 });
|
|
69
|
-
row.href = mediaUrl2;
|
|
70
|
-
if (typeof url === "string") row.url = mediaUrl2;
|
|
71
46
|
return;
|
|
72
47
|
}
|
|
73
48
|
if (type2 !== "image") {
|
|
74
|
-
assign(row,
|
|
49
|
+
assign(row, extra);
|
|
75
50
|
applyUrlSuffixToRow(row, suffix, anchor);
|
|
76
51
|
return;
|
|
77
52
|
}
|
|
78
53
|
const {
|
|
79
54
|
extension,
|
|
80
|
-
src
|
|
55
|
+
src,
|
|
81
56
|
previewUrl,
|
|
82
57
|
filePath,
|
|
83
58
|
alt,
|
|
84
59
|
root: _root,
|
|
85
60
|
workspace: _workspace,
|
|
86
61
|
...rest
|
|
87
|
-
} =
|
|
88
|
-
const mediaUrl = MediaLocation.publicUrl(loader.resolver.config, media);
|
|
62
|
+
} = extra;
|
|
89
63
|
const selectedAlt = selectImageAlt(alt, loader, {
|
|
90
|
-
root:
|
|
91
|
-
workspace:
|
|
64
|
+
root: _root,
|
|
65
|
+
workspace: _workspace
|
|
92
66
|
});
|
|
93
67
|
if (!previewUrl) {
|
|
94
|
-
assign(row, rest, { extension, src
|
|
68
|
+
assign(row, rest, { extension, src });
|
|
95
69
|
if (typeof selectedAlt === "string") row.alt = selectedAlt;
|
|
96
70
|
return;
|
|
97
71
|
}
|
|
98
72
|
const locationAvailable = loader.includedAtBuild(filePath);
|
|
99
|
-
row.src = locationAvailable ?
|
|
73
|
+
row.src = locationAvailable ? src : previewUrl;
|
|
100
74
|
row.extension = extension;
|
|
101
75
|
if (typeof selectedAlt === "string") row.alt = selectedAlt;
|
|
102
76
|
assign(row, rest);
|
|
@@ -1,260 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
decode,
|
|
3
|
+
encode
|
|
4
|
+
} from "../chunks/chunk-6UT4N4CO.js";
|
|
1
5
|
import "../chunks/chunk-CQ52GEHY.js";
|
|
2
6
|
|
|
3
7
|
// src/preview/PreviewPayload.ts
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var BIT19 = 1 << 18;
|
|
10
|
-
var BIT20 = 1 << 19;
|
|
11
|
-
var BIT21 = 1 << 20;
|
|
12
|
-
var BIT22 = 1 << 21;
|
|
13
|
-
var BIT23 = 1 << 22;
|
|
14
|
-
var BIT24 = 1 << 23;
|
|
15
|
-
var BIT25 = 1 << 24;
|
|
16
|
-
var BIT26 = 1 << 25;
|
|
17
|
-
var BIT27 = 1 << 26;
|
|
18
|
-
var BIT28 = 1 << 27;
|
|
19
|
-
var BIT29 = 1 << 28;
|
|
20
|
-
var BIT30 = 1 << 29;
|
|
21
|
-
var BIT31 = 1 << 30;
|
|
22
|
-
var BIT32 = 1 << 31;
|
|
23
|
-
var BITS7 = 127;
|
|
24
|
-
var BITS17 = BIT18 - 1;
|
|
25
|
-
var BITS18 = BIT19 - 1;
|
|
26
|
-
var BITS19 = BIT20 - 1;
|
|
27
|
-
var BITS20 = BIT21 - 1;
|
|
28
|
-
var BITS21 = BIT22 - 1;
|
|
29
|
-
var BITS22 = BIT23 - 1;
|
|
30
|
-
var BITS23 = BIT24 - 1;
|
|
31
|
-
var BITS24 = BIT25 - 1;
|
|
32
|
-
var BITS25 = BIT26 - 1;
|
|
33
|
-
var BITS26 = BIT27 - 1;
|
|
34
|
-
var BITS27 = BIT28 - 1;
|
|
35
|
-
var BITS28 = BIT29 - 1;
|
|
36
|
-
var BITS29 = BIT30 - 1;
|
|
37
|
-
var BITS30 = BIT31 - 1;
|
|
38
|
-
|
|
39
|
-
// node_modules/lib0/math.js
|
|
40
|
-
var floor = Math.floor;
|
|
41
|
-
var min = (a, b) => a < b ? a : b;
|
|
42
|
-
var max = (a, b) => a > b ? a : b;
|
|
43
|
-
var isNaN = Number.isNaN;
|
|
44
|
-
|
|
45
|
-
// node_modules/lib0/number.js
|
|
46
|
-
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER;
|
|
47
|
-
var MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER;
|
|
48
|
-
var LOWEST_INT32 = 1 << 31;
|
|
49
|
-
var isInteger = Number.isInteger || ((num) => typeof num === "number" && isFinite(num) && floor(num) === num);
|
|
50
|
-
var isNaN2 = Number.isNaN;
|
|
51
|
-
var parseInt = Number.parseInt;
|
|
52
|
-
|
|
53
|
-
// node_modules/lib0/string.js
|
|
54
|
-
var fromCharCode = String.fromCharCode;
|
|
55
|
-
var fromCodePoint = String.fromCodePoint;
|
|
56
|
-
var MAX_UTF16_CHARACTER = fromCharCode(65535);
|
|
57
|
-
var _encodeUtf8Polyfill = (str) => {
|
|
58
|
-
const encodedString = unescape(encodeURIComponent(str));
|
|
59
|
-
const len = encodedString.length;
|
|
60
|
-
const buf = new Uint8Array(len);
|
|
61
|
-
for (let i = 0; i < len; i++) {
|
|
62
|
-
buf[i] = /** @type {number} */
|
|
63
|
-
encodedString.codePointAt(i);
|
|
64
|
-
}
|
|
65
|
-
return buf;
|
|
66
|
-
};
|
|
67
|
-
var utf8TextEncoder = (
|
|
68
|
-
/** @type {TextEncoder} */
|
|
69
|
-
typeof TextEncoder !== "undefined" ? new TextEncoder() : null
|
|
70
|
-
);
|
|
71
|
-
var _encodeUtf8Native = (str) => utf8TextEncoder.encode(str);
|
|
72
|
-
var encodeUtf8 = utf8TextEncoder ? _encodeUtf8Native : _encodeUtf8Polyfill;
|
|
73
|
-
var utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
74
|
-
if (utf8TextDecoder && utf8TextDecoder.decode(new Uint8Array()).length === 1) {
|
|
75
|
-
utf8TextDecoder = null;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// node_modules/lib0/error.js
|
|
79
|
-
var create = (s) => new Error(s);
|
|
80
|
-
|
|
81
|
-
// node_modules/lib0/encoding.js
|
|
82
|
-
var Encoder = class {
|
|
83
|
-
constructor() {
|
|
84
|
-
this.cpos = 0;
|
|
85
|
-
this.cbuf = new Uint8Array(100);
|
|
86
|
-
this.bufs = [];
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
var createEncoder = () => new Encoder();
|
|
90
|
-
var length = (encoder) => {
|
|
91
|
-
let len = encoder.cpos;
|
|
92
|
-
for (let i = 0; i < encoder.bufs.length; i++) {
|
|
93
|
-
len += encoder.bufs[i].length;
|
|
94
|
-
}
|
|
95
|
-
return len;
|
|
96
|
-
};
|
|
97
|
-
var toUint8Array = (encoder) => {
|
|
98
|
-
const uint8arr = new Uint8Array(length(encoder));
|
|
99
|
-
let curPos = 0;
|
|
100
|
-
for (let i = 0; i < encoder.bufs.length; i++) {
|
|
101
|
-
const d = encoder.bufs[i];
|
|
102
|
-
uint8arr.set(d, curPos);
|
|
103
|
-
curPos += d.length;
|
|
104
|
-
}
|
|
105
|
-
uint8arr.set(new Uint8Array(encoder.cbuf.buffer, 0, encoder.cpos), curPos);
|
|
106
|
-
return uint8arr;
|
|
107
|
-
};
|
|
108
|
-
var write = (encoder, num) => {
|
|
109
|
-
const bufferLen = encoder.cbuf.length;
|
|
110
|
-
if (encoder.cpos === bufferLen) {
|
|
111
|
-
encoder.bufs.push(encoder.cbuf);
|
|
112
|
-
encoder.cbuf = new Uint8Array(bufferLen * 2);
|
|
113
|
-
encoder.cpos = 0;
|
|
114
|
-
}
|
|
115
|
-
encoder.cbuf[encoder.cpos++] = num;
|
|
116
|
-
};
|
|
117
|
-
var writeVarUint = (encoder, num) => {
|
|
118
|
-
while (num > BITS7) {
|
|
119
|
-
write(encoder, BIT8 | BITS7 & num);
|
|
120
|
-
num = floor(num / 128);
|
|
121
|
-
}
|
|
122
|
-
write(encoder, BITS7 & num);
|
|
123
|
-
};
|
|
124
|
-
var _strBuffer = new Uint8Array(3e4);
|
|
125
|
-
var _maxStrBSize = _strBuffer.length / 3;
|
|
126
|
-
var _writeVarStringNative = (encoder, str) => {
|
|
127
|
-
if (str.length < _maxStrBSize) {
|
|
128
|
-
const written = utf8TextEncoder.encodeInto(str, _strBuffer).written || 0;
|
|
129
|
-
writeVarUint(encoder, written);
|
|
130
|
-
for (let i = 0; i < written; i++) {
|
|
131
|
-
write(encoder, _strBuffer[i]);
|
|
132
|
-
}
|
|
133
|
-
} else {
|
|
134
|
-
writeVarUint8Array(encoder, encodeUtf8(str));
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
var _writeVarStringPolyfill = (encoder, str) => {
|
|
138
|
-
const encodedString = unescape(encodeURIComponent(str));
|
|
139
|
-
const len = encodedString.length;
|
|
140
|
-
writeVarUint(encoder, len);
|
|
141
|
-
for (let i = 0; i < len; i++) {
|
|
142
|
-
write(
|
|
143
|
-
encoder,
|
|
144
|
-
/** @type {number} */
|
|
145
|
-
encodedString.codePointAt(i)
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
var writeVarString = utf8TextEncoder && /** @type {any} */
|
|
150
|
-
utf8TextEncoder.encodeInto ? _writeVarStringNative : _writeVarStringPolyfill;
|
|
151
|
-
var writeUint8Array = (encoder, uint8Array) => {
|
|
152
|
-
const bufferLen = encoder.cbuf.length;
|
|
153
|
-
const cpos = encoder.cpos;
|
|
154
|
-
const leftCopyLen = min(bufferLen - cpos, uint8Array.length);
|
|
155
|
-
const rightCopyLen = uint8Array.length - leftCopyLen;
|
|
156
|
-
encoder.cbuf.set(uint8Array.subarray(0, leftCopyLen), cpos);
|
|
157
|
-
encoder.cpos += leftCopyLen;
|
|
158
|
-
if (rightCopyLen > 0) {
|
|
159
|
-
encoder.bufs.push(encoder.cbuf);
|
|
160
|
-
encoder.cbuf = new Uint8Array(max(bufferLen * 2, rightCopyLen));
|
|
161
|
-
encoder.cbuf.set(uint8Array.subarray(leftCopyLen));
|
|
162
|
-
encoder.cpos = rightCopyLen;
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
var writeVarUint8Array = (encoder, uint8Array) => {
|
|
166
|
-
writeVarUint(encoder, uint8Array.byteLength);
|
|
167
|
-
writeUint8Array(encoder, uint8Array);
|
|
168
|
-
};
|
|
169
|
-
var floatTestBed = new DataView(new ArrayBuffer(4));
|
|
170
|
-
|
|
171
|
-
// node_modules/lib0/decoding.js
|
|
172
|
-
var errorUnexpectedEndOfArray = create("Unexpected end of array");
|
|
173
|
-
var errorIntegerOutOfRange = create("Integer out of Range");
|
|
174
|
-
var Decoder = class {
|
|
175
|
-
/**
|
|
176
|
-
* @param {Uint8Array} uint8Array Binary data to decode
|
|
177
|
-
*/
|
|
178
|
-
constructor(uint8Array) {
|
|
179
|
-
this.arr = uint8Array;
|
|
180
|
-
this.pos = 0;
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
var createDecoder = (uint8Array) => new Decoder(uint8Array);
|
|
184
|
-
var readUint8Array = (decoder, len) => {
|
|
185
|
-
const view = new Uint8Array(decoder.arr.buffer, decoder.pos + decoder.arr.byteOffset, len);
|
|
186
|
-
decoder.pos += len;
|
|
187
|
-
return view;
|
|
188
|
-
};
|
|
189
|
-
var readVarUint8Array = (decoder) => readUint8Array(decoder, readVarUint(decoder));
|
|
190
|
-
var readUint8 = (decoder) => decoder.arr[decoder.pos++];
|
|
191
|
-
var readVarUint = (decoder) => {
|
|
192
|
-
let num = 0;
|
|
193
|
-
let mult = 1;
|
|
194
|
-
const len = decoder.arr.length;
|
|
195
|
-
while (decoder.pos < len) {
|
|
196
|
-
const r = decoder.arr[decoder.pos++];
|
|
197
|
-
num = num + (r & BITS7) * mult;
|
|
198
|
-
mult *= 128;
|
|
199
|
-
if (r < BIT8) {
|
|
200
|
-
return num;
|
|
201
|
-
}
|
|
202
|
-
if (num > MAX_SAFE_INTEGER) {
|
|
203
|
-
throw errorIntegerOutOfRange;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
throw errorUnexpectedEndOfArray;
|
|
207
|
-
};
|
|
208
|
-
var _readVarStringPolyfill = (decoder) => {
|
|
209
|
-
let remainingLen = readVarUint(decoder);
|
|
210
|
-
if (remainingLen === 0) {
|
|
211
|
-
return "";
|
|
212
|
-
} else {
|
|
213
|
-
let encodedString = String.fromCodePoint(readUint8(decoder));
|
|
214
|
-
if (--remainingLen < 100) {
|
|
215
|
-
while (remainingLen--) {
|
|
216
|
-
encodedString += String.fromCodePoint(readUint8(decoder));
|
|
217
|
-
}
|
|
218
|
-
} else {
|
|
219
|
-
while (remainingLen > 0) {
|
|
220
|
-
const nextLen = remainingLen < 1e4 ? remainingLen : 1e4;
|
|
221
|
-
const bytes = decoder.arr.subarray(decoder.pos, decoder.pos + nextLen);
|
|
222
|
-
decoder.pos += nextLen;
|
|
223
|
-
encodedString += String.fromCodePoint.apply(
|
|
224
|
-
null,
|
|
225
|
-
/** @type {any} */
|
|
226
|
-
bytes
|
|
227
|
-
);
|
|
228
|
-
remainingLen -= nextLen;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
return decodeURIComponent(escape(encodedString));
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
var _readVarStringNative = (decoder) => (
|
|
235
|
-
/** @type any */
|
|
236
|
-
utf8TextDecoder.decode(readVarUint8Array(decoder))
|
|
237
|
-
);
|
|
238
|
-
var readVarString = utf8TextDecoder ? _readVarStringNative : _readVarStringPolyfill;
|
|
239
|
-
|
|
240
|
-
// src/preview/PreviewPayload.ts
|
|
8
|
+
import { assert } from "alinea/core/util/Assert";
|
|
9
|
+
import {
|
|
10
|
+
decode as decodeBase64,
|
|
11
|
+
encode as encodeBase64
|
|
12
|
+
} from "alinea/core/util/BufferToBase64";
|
|
241
13
|
function encodePreviewPayload(update) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
14
|
+
return encodeBase64(
|
|
15
|
+
encode([
|
|
16
|
+
update.locale,
|
|
17
|
+
update.entryId,
|
|
18
|
+
update.contentHash,
|
|
19
|
+
update.status,
|
|
20
|
+
update.patch
|
|
21
|
+
])
|
|
22
|
+
);
|
|
249
23
|
}
|
|
250
24
|
async function decodePreviewPayload(payload) {
|
|
251
|
-
const
|
|
25
|
+
const value = decode(new Uint8Array(await decodeBase64(payload)));
|
|
26
|
+
assert(Array.isArray(value), "Invalid preview payload");
|
|
27
|
+
assert(value.length === 5, "Invalid preview payload");
|
|
28
|
+
const [locale, entryId, contentHash, status, patch] = value;
|
|
29
|
+
assert(
|
|
30
|
+
locale === null || typeof locale === "string",
|
|
31
|
+
"Invalid preview locale"
|
|
32
|
+
);
|
|
33
|
+
assert(typeof entryId === "string", "Invalid preview entry id");
|
|
34
|
+
assert(typeof contentHash === "string", "Invalid preview content hash");
|
|
35
|
+
assert(typeof status === "string", "Invalid preview status");
|
|
36
|
+
assert(patch instanceof Uint8Array, "Invalid preview patch");
|
|
252
37
|
return {
|
|
253
|
-
locale
|
|
254
|
-
entryId
|
|
255
|
-
contentHash
|
|
256
|
-
status
|
|
257
|
-
patch
|
|
38
|
+
locale,
|
|
39
|
+
entryId,
|
|
40
|
+
contentHash,
|
|
41
|
+
status,
|
|
42
|
+
patch
|
|
258
43
|
};
|
|
259
44
|
}
|
|
260
45
|
export {
|
package/dist/ui/RichText.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ interface RichTextElementViews {
|
|
|
26
26
|
li?: ComponentType<JSX.IntrinsicElements['li']> | ReactElement;
|
|
27
27
|
blockquote?: ComponentType<JSX.IntrinsicElements['blockquote']> | ReactElement;
|
|
28
28
|
hr?: ComponentType<JSX.IntrinsicElements['hr']> | ReactElement;
|
|
29
|
+
img?: ComponentType<JSX.IntrinsicElements['img']> | ReactElement;
|
|
29
30
|
br?: ComponentType<JSX.IntrinsicElements['br']> | ReactElement;
|
|
30
31
|
small?: ComponentType<JSX.IntrinsicElements['small']> | ReactElement;
|
|
31
32
|
sub?: ComponentType<JSX.IntrinsicElements['sub']> | ReactElement;
|
package/dist/ui/RichText.js
CHANGED
|
@@ -8,8 +8,10 @@ import {
|
|
|
8
8
|
Node,
|
|
9
9
|
TextNode
|
|
10
10
|
} from "alinea/core/TextDoc";
|
|
11
|
+
import { entries, fromEntries } from "alinea/core/util/Objects";
|
|
11
12
|
import { slugify } from "alinea/core/util/Slugs";
|
|
12
13
|
import {
|
|
14
|
+
cloneElement,
|
|
13
15
|
Fragment,
|
|
14
16
|
isValidElement
|
|
15
17
|
} from "react";
|
|
@@ -22,10 +24,18 @@ function textContent(doc) {
|
|
|
22
24
|
return text;
|
|
23
25
|
}, "");
|
|
24
26
|
}
|
|
25
|
-
function Table({ children }) {
|
|
26
|
-
return /* @__PURE__ */ jsx("table", { children: /* @__PURE__ */ jsx("tbody", { children }) });
|
|
27
|
+
function Table({ children, ...props }) {
|
|
28
|
+
return /* @__PURE__ */ jsx("table", { ...props, children: /* @__PURE__ */ jsx("tbody", { children }) });
|
|
27
29
|
}
|
|
28
30
|
function nodeElement(type, attributes, content) {
|
|
31
|
+
const element = defaultNodeElement(type, attributes, content);
|
|
32
|
+
if (!element || !attributes) return element;
|
|
33
|
+
const dataAttributes = fromEntries(
|
|
34
|
+
entries(attributes).filter(([key]) => key.startsWith("data-"))
|
|
35
|
+
);
|
|
36
|
+
return cloneElement(element, dataAttributes);
|
|
37
|
+
}
|
|
38
|
+
function defaultNodeElement(type, attributes, content) {
|
|
29
39
|
const textAlign = textAlignAttribute(attributes?.textAlign);
|
|
30
40
|
const style = {
|
|
31
41
|
textAlign: textAlign === "left" ? void 0 : textAlign
|
|
@@ -53,6 +63,23 @@ function nodeElement(type, attributes, content) {
|
|
|
53
63
|
return /* @__PURE__ */ jsx("blockquote", { style });
|
|
54
64
|
case "horizontalRule":
|
|
55
65
|
return /* @__PURE__ */ jsx("hr", {});
|
|
66
|
+
case "image": {
|
|
67
|
+
const src = attributes?.src;
|
|
68
|
+
const alt = attributes?.alt;
|
|
69
|
+
const title = attributes?.title;
|
|
70
|
+
const width = attributes?.width;
|
|
71
|
+
const height = attributes?.height;
|
|
72
|
+
return /* @__PURE__ */ jsx(
|
|
73
|
+
"img",
|
|
74
|
+
{
|
|
75
|
+
src: typeof src === "string" ? src : void 0,
|
|
76
|
+
alt: typeof alt === "string" ? alt : "",
|
|
77
|
+
title: typeof title === "string" ? title : void 0,
|
|
78
|
+
width: numberAttribute(width),
|
|
79
|
+
height: numberAttribute(height)
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
56
83
|
case "hardBreak":
|
|
57
84
|
return /* @__PURE__ */ jsx("br", {});
|
|
58
85
|
case "small":
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alinea",
|
|
3
|
-
"version": "2.0.0-preview.
|
|
3
|
+
"version": "2.0.0-preview.2",
|
|
4
4
|
"description": "Headless git-based CMS",
|
|
5
5
|
"repository": "github:alineacms/alinea",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=24.0.0"
|
|
9
|
+
},
|
|
7
10
|
"sideEffects": false,
|
|
8
11
|
"type": "module",
|
|
9
12
|
"imports": {
|
|
@@ -68,7 +71,7 @@
|
|
|
68
71
|
"esbuild": "^0.28.0"
|
|
69
72
|
},
|
|
70
73
|
"peerDependencies": {
|
|
71
|
-
"react": "
|
|
72
|
-
"react-dom": "
|
|
74
|
+
"react": ">=19.0.0",
|
|
75
|
+
"react-dom": ">=19.0.0"
|
|
73
76
|
}
|
|
74
77
|
}
|