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
|
@@ -15,7 +15,13 @@ export interface SearchQuery {
|
|
|
15
15
|
export declare function createSearch(db: Database): Promise<void>;
|
|
16
16
|
/** The searchable text of an entry row, read from its search row. */
|
|
17
17
|
export declare function searchableText(entry: EntryIndexTarget): Sql<string>;
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The words of a search, each with the tokens the index splits it in: the
|
|
20
|
+
* index splits `multi-modal` in `multi` and `modal`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function searchWords(input: string | Array<string> | undefined): Array<Array<string>> | undefined;
|
|
23
|
+
/** The tokens of a search, and the joined spelling of split words. */
|
|
24
|
+
export declare function searchTokens(input: string | Array<string> | undefined): string[] | undefined;
|
|
19
25
|
export interface SearchQueryOptions {
|
|
20
26
|
/** Indexed spellings a token may also match, besides its prefix. */
|
|
21
27
|
alternatives?(token: string): ReadonlyArray<string>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
integer,
|
|
3
3
|
text
|
|
4
|
-
} from "../../chunks/chunk-
|
|
4
|
+
} from "../../chunks/chunk-2PP7WJUJ.js";
|
|
5
5
|
import {
|
|
6
6
|
table
|
|
7
7
|
} from "../../chunks/chunk-PYDOMKJZ.js";
|
|
@@ -33,23 +33,47 @@ function searchableText(entry) {
|
|
|
33
33
|
return sql`(select ${search.body} from ${search}
|
|
34
34
|
where ${search.rowid} = ${entry.rowid})`;
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
var tokenPattern = /[\p{L}\p{N}\p{M}]+/gu;
|
|
37
|
+
function searchWords(input) {
|
|
37
38
|
const text2 = Array.isArray(input) ? input.join(" ") : input;
|
|
38
39
|
if (!text2) return void 0;
|
|
39
|
-
return text2.
|
|
40
|
+
return text2.split(/\s+/).map((word) => word.match(tokenPattern) ?? []).filter((tokens) => tokens.length > 0);
|
|
41
|
+
}
|
|
42
|
+
function searchTokens(input) {
|
|
43
|
+
const words = searchWords(input);
|
|
44
|
+
if (!words) return void 0;
|
|
45
|
+
return words.flatMap(
|
|
46
|
+
(tokens) => tokens.length > 1 ? [...tokens, tokens.join("")] : tokens
|
|
47
|
+
);
|
|
40
48
|
}
|
|
41
49
|
function searchQuery(input, entry, options = {}) {
|
|
42
|
-
const
|
|
43
|
-
if (!
|
|
44
|
-
const
|
|
50
|
+
const words = searchWords(input);
|
|
51
|
+
if (!words) return void 0;
|
|
52
|
+
const tokens = words.flat();
|
|
53
|
+
function term(token) {
|
|
45
54
|
const spellings = [
|
|
46
55
|
`"${token}"*`,
|
|
47
56
|
...(options.alternatives?.(token) ?? []).map(
|
|
48
|
-
(
|
|
57
|
+
(term2) => `"${term2.replaceAll('"', "")}"`
|
|
49
58
|
)
|
|
50
59
|
];
|
|
51
60
|
return spellings.length > 1 ? `(${spellings.join(" OR ")})` : spellings[0];
|
|
52
|
-
}
|
|
61
|
+
}
|
|
62
|
+
function wordTerm(word) {
|
|
63
|
+
if (word.length === 1) return term(word[0]);
|
|
64
|
+
return `((${word.map(term).join(" AND ")}) OR ${term(word.join(""))})`;
|
|
65
|
+
}
|
|
66
|
+
function phraseTerm(from) {
|
|
67
|
+
const word = words[from];
|
|
68
|
+
if (from === words.length - 1) return wordTerm(word);
|
|
69
|
+
const rest = phraseTerm(from + 1);
|
|
70
|
+
const separate = `${wordTerm(word)} AND ${rest}`;
|
|
71
|
+
if (words.length > maxJoinedWords) return separate;
|
|
72
|
+
const joined = term([...word, ...words[from + 1]].join(""));
|
|
73
|
+
const after = from + 2 < words.length ? ` AND ${phraseTerm(from + 2)}` : "";
|
|
74
|
+
return `((${separate}) OR (${joined}${after}))`;
|
|
75
|
+
}
|
|
76
|
+
const terms = words.length ? phraseTerm(0) : "";
|
|
53
77
|
const search = sql.identifier(getTable(EntrySearchTable).name);
|
|
54
78
|
const match = sql`${search} match ${terms}`;
|
|
55
79
|
const relevance = sql`bm25(${search}, 20, 1)`;
|
|
@@ -66,10 +90,12 @@ function searchQuery(input, entry, options = {}) {
|
|
|
66
90
|
}
|
|
67
91
|
};
|
|
68
92
|
}
|
|
93
|
+
var maxJoinedWords = 5;
|
|
69
94
|
var fuzzyFactor = 0.1;
|
|
70
95
|
var maxFuzzyDistance = 6;
|
|
71
96
|
var maxAlternatives = 10;
|
|
72
97
|
var maxNumberMatches = 50;
|
|
98
|
+
var minSplitLength = 2;
|
|
73
99
|
var vocabulary = "alinea_entry_search_vocab";
|
|
74
100
|
function fuzzyDistance(token) {
|
|
75
101
|
return Math.min(maxFuzzyDistance, Math.round(token.length * fuzzyFactor));
|
|
@@ -109,6 +135,7 @@ var SearchVocabulary = class {
|
|
|
109
135
|
#loaded;
|
|
110
136
|
#byLength = /* @__PURE__ */ new Map();
|
|
111
137
|
#numbered = [];
|
|
138
|
+
#terms = /* @__PURE__ */ new Set();
|
|
112
139
|
async load(db, revision) {
|
|
113
140
|
if (this.#loaded === revision) return;
|
|
114
141
|
await db.run(
|
|
@@ -131,13 +158,30 @@ var SearchVocabulary = class {
|
|
|
131
158
|
}
|
|
132
159
|
this.#byLength = byLength;
|
|
133
160
|
this.#numbered = numbered;
|
|
161
|
+
this.#terms = new Set(rows.map((row) => row.term));
|
|
134
162
|
this.#loaded = revision;
|
|
135
163
|
}
|
|
136
164
|
/** Indexed terms close to a token, most frequent first; prefixes of the
|
|
137
165
|
* token are left to the prefix match. */
|
|
138
166
|
alternatives(token) {
|
|
139
167
|
const query = normalizeToken(token);
|
|
140
|
-
return [
|
|
168
|
+
return [
|
|
169
|
+
...this.#numberMatches(query),
|
|
170
|
+
...this.#closeSpellings(query),
|
|
171
|
+
...this.#splits(query)
|
|
172
|
+
];
|
|
173
|
+
}
|
|
174
|
+
/** Indexed pairs of terms a token joins, as phrases: multimodal finds
|
|
175
|
+
* multi-modal and multi modal. */
|
|
176
|
+
#splits(query) {
|
|
177
|
+
const splits = [];
|
|
178
|
+
for (let at = minSplitLength; at <= query.length - minSplitLength; at++) {
|
|
179
|
+
const head = query.slice(0, at);
|
|
180
|
+
const tail = query.slice(at);
|
|
181
|
+
if (this.#terms.has(head) && this.#terms.has(tail))
|
|
182
|
+
splits.push(`${head} ${tail}`);
|
|
183
|
+
}
|
|
184
|
+
return splits;
|
|
141
185
|
}
|
|
142
186
|
/** Indexed terms containing a number that starts with the digits of a
|
|
143
187
|
* number token, ignoring leading zeros: 98 finds 098 and img098. */
|
|
@@ -173,5 +217,6 @@ export {
|
|
|
173
217
|
fuzzyDistance,
|
|
174
218
|
searchQuery,
|
|
175
219
|
searchTokens,
|
|
220
|
+
searchWords,
|
|
176
221
|
searchableText
|
|
177
222
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Config } from 'alinea/core/Config';
|
|
2
|
+
import type { SyncProgress } from 'alinea/core/db/LocalStore';
|
|
2
3
|
import type { RemoteSource } from 'alinea/core/source/Source';
|
|
3
4
|
import { ReadonlyTree } from 'alinea/core/source/Tree';
|
|
4
5
|
import type { Database } from 'rado';
|
|
@@ -12,6 +13,7 @@ export interface EntrySyncOptions {
|
|
|
12
13
|
* reopened and synced from it. Defaults to true.
|
|
13
14
|
*/
|
|
14
15
|
recordsTree?: boolean;
|
|
16
|
+
onProgress?(progress: SyncProgress): void;
|
|
15
17
|
}
|
|
16
18
|
/** Prepared, serialized source synchronization for one database connection. */
|
|
17
19
|
export declare class EntrySyncer {
|
|
@@ -34,7 +34,8 @@ var EntrySyncer = class {
|
|
|
34
34
|
previousTree,
|
|
35
35
|
withinTransaction = false,
|
|
36
36
|
validate = true,
|
|
37
|
-
recordsTree = true
|
|
37
|
+
recordsTree = true,
|
|
38
|
+
onProgress
|
|
38
39
|
}) {
|
|
39
40
|
const queries = await this.#prepared();
|
|
40
41
|
const run = async () => {
|
|
@@ -54,7 +55,8 @@ var EntrySyncer = class {
|
|
|
54
55
|
source,
|
|
55
56
|
storedTree ?? ReadonlyTree.EMPTY,
|
|
56
57
|
tree,
|
|
57
|
-
queries
|
|
58
|
+
queries,
|
|
59
|
+
onProgress
|
|
58
60
|
);
|
|
59
61
|
const changed = await deriveEntries(
|
|
60
62
|
this.#config,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Config } from 'alinea/core/Config';
|
|
2
|
+
import type { SyncProgress } from 'alinea/core/db/LocalStore';
|
|
2
3
|
import type { RemoteSource } from 'alinea/core/source/Source';
|
|
3
4
|
import { ReadonlyTree } from 'alinea/core/source/Tree';
|
|
4
5
|
import { type SyncQueries } from './SyncQueries.js';
|
|
@@ -18,4 +19,4 @@ export interface SyncChanges {
|
|
|
18
19
|
/** Whether a directory hash stands for a directory with files. */
|
|
19
20
|
export declare function hasChildren(childrenSha: string | null): boolean;
|
|
20
21
|
/** Write the files that differ between two source trees to the entry table. */
|
|
21
|
-
export declare function mergeTrees(config: Config, source: RemoteSource, previousTree: ReadonlyTree, tree: ReadonlyTree, queries: SyncQueries): Promise<SyncChanges>;
|
|
22
|
+
export declare function mergeTrees(config: Config, source: RemoteSource, previousTree: ReadonlyTree, tree: ReadonlyTree, queries: SyncQueries, onProgress?: (progress: SyncProgress) => void): Promise<SyncChanges>;
|
|
@@ -4,7 +4,6 @@ import "../../chunks/chunk-CQ52GEHY.js";
|
|
|
4
4
|
import { Leaf, ReadonlyTree } from "alinea/core/source/Tree";
|
|
5
5
|
import { chunks } from "alinea/core/util/Arrays";
|
|
6
6
|
import { assert } from "alinea/core/util/Assert";
|
|
7
|
-
import { accumulate } from "alinea/core/util/Async";
|
|
8
7
|
import { entryIndexRow } from "../entry/EntryTable.js";
|
|
9
8
|
import { parseSourceEntry } from "./EntryParser.js";
|
|
10
9
|
import { insertEntryValues } from "./SyncQueries.js";
|
|
@@ -66,7 +65,7 @@ async function updateDirectoryHashes(queries, tree, filePaths, changes) {
|
|
|
66
65
|
for (const [dir, sha] of changed)
|
|
67
66
|
await queries.updateChildrenSha.run({ dir, sha });
|
|
68
67
|
}
|
|
69
|
-
async function mergeTrees(config, source, previousTree, tree, queries) {
|
|
68
|
+
async function mergeTrees(config, source, previousTree, tree, queries, onProgress) {
|
|
70
69
|
const changes = {
|
|
71
70
|
touched: /* @__PURE__ */ new Set(),
|
|
72
71
|
inserted: /* @__PURE__ */ new Set(),
|
|
@@ -87,10 +86,17 @@ async function mergeTrees(config, source, previousTree, tree, queries) {
|
|
|
87
86
|
Math.max(minPartSize, Math.ceil(added.length / parallelParts))
|
|
88
87
|
)
|
|
89
88
|
);
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
const requests = parts.map((files) => [
|
|
90
|
+
...new Set(files.map((file) => file.fileHash))
|
|
91
|
+
]);
|
|
92
|
+
const total = requests.reduce((sum, shas) => sum + shas.length, 0);
|
|
93
|
+
let loaded = 0;
|
|
94
|
+
if (total) onProgress?.({ loaded, total });
|
|
95
|
+
const reads = requests.map((shas) => {
|
|
96
|
+
const blobs = readBlobs(
|
|
97
|
+
source,
|
|
98
|
+
shas,
|
|
99
|
+
() => onProgress?.({ loaded: ++loaded, total })
|
|
94
100
|
);
|
|
95
101
|
blobs.catch(() => {
|
|
96
102
|
});
|
|
@@ -134,6 +140,14 @@ async function mergeTrees(config, source, previousTree, tree, queries) {
|
|
|
134
140
|
);
|
|
135
141
|
return changes;
|
|
136
142
|
}
|
|
143
|
+
async function readBlobs(source, shas, onBlob) {
|
|
144
|
+
const blobs = /* @__PURE__ */ new Map();
|
|
145
|
+
for await (const [sha, blob] of source.getBlobs(shas)) {
|
|
146
|
+
blobs.set(sha, blob);
|
|
147
|
+
onBlob();
|
|
148
|
+
}
|
|
149
|
+
return blobs;
|
|
150
|
+
}
|
|
137
151
|
function sourceDirectorySha(tree, path) {
|
|
138
152
|
const node = tree.get(path);
|
|
139
153
|
if (!node) return ReadonlyTree.EMPTY.sha;
|
|
@@ -66,25 +66,25 @@ import { Fragment, useId } from "react";
|
|
|
66
66
|
var CodeField_default = {
|
|
67
67
|
"CodeEditorInput-textarea": "alinea-CodeEditorInput-textarea",
|
|
68
68
|
"CodeEditorInputTextarea": "alinea-CodeEditorInput-textarea",
|
|
69
|
-
"CodeEditorInput": "alinea-CodeEditorInput",
|
|
70
|
-
"
|
|
71
|
-
"CodeEditorInputPre": "alinea-CodeEditorInput-pre",
|
|
72
|
-
"CodeEditorInput-identifier": "alinea-CodeEditorInput-identifier",
|
|
73
|
-
"CodeEditorInputIdentifier": "alinea-CodeEditorInput-identifier",
|
|
74
|
-
"CodeEditorInput-editor": "alinea-CodeEditorInput-editor",
|
|
75
|
-
"CodeEditorInputEditor": "alinea-CodeEditorInput-editor",
|
|
69
|
+
"CodeEditorInput-string": "alinea-CodeEditorInput-string",
|
|
70
|
+
"CodeEditorInputString": "alinea-CodeEditorInput-string",
|
|
76
71
|
"CodeEditorInput-comment": "alinea-CodeEditorInput-comment",
|
|
77
72
|
"CodeEditorInputComment": "alinea-CodeEditorInput-comment",
|
|
73
|
+
"CodeEditorInput-punctuation": "alinea-CodeEditorInput-punctuation",
|
|
74
|
+
"CodeEditorInputPunctuation": "alinea-CodeEditorInput-punctuation",
|
|
78
75
|
"CodeEditorInput-number": "alinea-CodeEditorInput-number",
|
|
79
76
|
"CodeEditorInputNumber": "alinea-CodeEditorInput-number",
|
|
80
|
-
"CodeEditorInput
|
|
81
|
-
"CodeEditorInputString": "alinea-CodeEditorInput-string",
|
|
77
|
+
"CodeEditorInput": "alinea-CodeEditorInput",
|
|
82
78
|
"CodeEditorInput-keyword": "alinea-CodeEditorInput-keyword",
|
|
83
79
|
"CodeEditorInputKeyword": "alinea-CodeEditorInput-keyword",
|
|
84
|
-
"CodeEditorInput-
|
|
85
|
-
"
|
|
80
|
+
"CodeEditorInput-editor": "alinea-CodeEditorInput-editor",
|
|
81
|
+
"CodeEditorInputEditor": "alinea-CodeEditorInput-editor",
|
|
86
82
|
"CodeEditorInput-regex": "alinea-CodeEditorInput-regex",
|
|
87
|
-
"CodeEditorInputRegex": "alinea-CodeEditorInput-regex"
|
|
83
|
+
"CodeEditorInputRegex": "alinea-CodeEditorInput-regex",
|
|
84
|
+
"CodeEditorInput-pre": "alinea-CodeEditorInput-pre",
|
|
85
|
+
"CodeEditorInputPre": "alinea-CodeEditorInput-pre",
|
|
86
|
+
"CodeEditorInput-identifier": "alinea-CodeEditorInput-identifier",
|
|
87
|
+
"CodeEditorInputIdentifier": "alinea-CodeEditorInput-identifier"
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
// src/field/code/CodeField.view.tsx
|
|
@@ -23,14 +23,13 @@ export declare namespace EntryLink {
|
|
|
23
23
|
const href: import("../../core/Expr").Expr<string>;
|
|
24
24
|
const path: import("../../core/Expr").Expr<string>;
|
|
25
25
|
}
|
|
26
|
-
interface EntryOptions<Fields> extends LinkFieldOptions<EntryReference & InferStoredValue<Fields>>, Omit<EntryPickerOptions<Fields>, 'label' | 'selection'> {
|
|
26
|
+
export interface EntryOptions<Fields> extends LinkFieldOptions<EntryReference & InferStoredValue<Fields>>, Omit<EntryPickerOptions<Fields>, 'label' | 'selection'> {
|
|
27
27
|
}
|
|
28
28
|
export declare function entry<Fields = undefined>(label: Label, options?: WithoutLabel<EntryOptions<Fields>>): import("alinea/field/link/LinkField").LinkField<EntryReference & InferStoredValue<Fields>, EntryLink<LinkFields<{ [K in keyof Fields as Fields[K] extends import("../../core/Expr").Expr<any> ? K : never]: Fields[K] extends import("../../core/Expr").Expr<infer T_1> ? T_1 : never; } extends infer T ? { [K in keyof T]: T[K]; } : never>>>;
|
|
29
|
+
export interface EntriesOptions<Fields> extends LinkFieldOptions<Array<EntryReference & ListRow & InferStoredValue<Fields>>>, Omit<EntryPickerOptions<Fields>, 'label' | 'selection'> {
|
|
30
|
+
}
|
|
29
31
|
export declare namespace entry {
|
|
30
32
|
type EntryRow<Fields> = EntryLink<LinkFields<Type.Infer<Fields>>> & ListRow;
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
export function multiple<Fields = undefined>(label: Label, options?: WithoutLabel<EntryOptions<Fields>>): import("alinea/field/link/LinkField").LinksField<EntryReference & ListRow & InferStoredValue<Fields>, EntryRow<Fields>>;
|
|
33
|
+
export function multiple<Fields = undefined>(label: Label, options?: WithoutLabel<EntriesOptions<Fields>>): import("alinea/field/link/LinkField").LinksField<EntryReference & ListRow & InferStoredValue<Fields>, EntryRow<Fields>>;
|
|
34
34
|
export {};
|
|
35
35
|
}
|
|
36
|
-
export {};
|
|
@@ -26,8 +26,8 @@ export declare function filePicker<Fields>(multiple: boolean, options: Omit<Entr
|
|
|
26
26
|
export interface FileOptions<Fields> extends LinkFieldOptions<EntryReference & InferStoredValue<Fields>>, Omit<EntryPickerOptions<Fields>, 'label' | 'selection'> {
|
|
27
27
|
}
|
|
28
28
|
export declare function file<Fields = undefined>(label: Label, options?: WithoutLabel<FileOptions<Fields>>): import("alinea/field/link/LinkField").LinkField<EntryReference & InferStoredValue<Fields>, FileLink<LinkFields<{ [K in keyof Fields as Fields[K] extends import("../../core/Expr").Expr<any> ? K : never]: Fields[K] extends import("../../core/Expr").Expr<infer T_1> ? T_1 : never; } extends infer T ? { [K in keyof T]: T[K]; } : never>>>;
|
|
29
|
+
export interface FilesOptions<Fields> extends LinkFieldOptions<Array<EntryReference & ListRow & InferStoredValue<Fields>>>, Omit<EntryPickerOptions<Fields>, 'label' | 'selection'> {
|
|
30
|
+
}
|
|
29
31
|
export declare namespace file {
|
|
30
|
-
interface FilesOptions<Fields> extends LinkFieldOptions<Array<EntryReference & ListRow & InferStoredValue<Fields>>>, Omit<EntryPickerOptions<Fields>, 'label' | 'selection'> {
|
|
31
|
-
}
|
|
32
32
|
function multiple<Fields = undefined>(label: Label, options?: WithoutLabel<FilesOptions<Fields>>): import("alinea/field/link/LinkField").LinksField<EntryReference & ListRow & InferStoredValue<Fields>, FileLink<LinkFields<{ [K in keyof Fields as Fields[K] extends import("../../core/Expr").Expr<any> ? K : never]: Fields[K] extends import("../../core/Expr").Expr<infer T_1> ? T_1 : never; } extends infer T ? { [K in keyof T]: T[K]; } : never>>>;
|
|
33
33
|
}
|
|
@@ -11,8 +11,6 @@ export interface ImageLink<InferredFields = {}> extends EntryReference {
|
|
|
11
11
|
alt?: string;
|
|
12
12
|
/** Public url of the image file, versioned by its hash */
|
|
13
13
|
src: string;
|
|
14
|
-
/** Same as src */
|
|
15
|
-
url: string;
|
|
16
14
|
extension: string;
|
|
17
15
|
size: number;
|
|
18
16
|
hash: string;
|
|
@@ -30,7 +28,6 @@ export declare namespace ImageLink {
|
|
|
30
28
|
const title: import("../../core/Expr").Expr<string>;
|
|
31
29
|
const alt: import("../../core/media/MediaAltField").MediaAltField;
|
|
32
30
|
const src: import("../../core/Expr").Expr<string>;
|
|
33
|
-
const url: import("../../core/Expr").Expr<string>;
|
|
34
31
|
const extension: import("../hidden").HiddenField<string>;
|
|
35
32
|
const size: import("../hidden").HiddenField<number>;
|
|
36
33
|
const hash: import("../hidden").HiddenField<string>;
|
|
@@ -50,8 +47,8 @@ export interface ImageOptions<Fields> extends LinkFieldOptions<EntryReference &
|
|
|
50
47
|
export declare function image<Fields = undefined>(label: Label, options?: WithoutLabel<ImageOptions<Fields>>): ImageField<Fields>;
|
|
51
48
|
export interface ImagesField<Fields = undefined> extends LinksField<EntryReference & ListRow & InferStoredValue<Fields>, ImageLink<LinkFields<Type.Infer<Fields>>>> {
|
|
52
49
|
}
|
|
50
|
+
export interface ImagesOptions<Fields> extends LinkFieldOptions<Array<EntryReference & ListRow & InferStoredValue<Fields>>>, Omit<EntryPickerOptions<Fields>, 'label' | 'selection'> {
|
|
51
|
+
}
|
|
53
52
|
export declare namespace image {
|
|
54
|
-
interface ImagesOptions<Fields> extends LinkFieldOptions<Array<EntryReference & ListRow & InferStoredValue<Fields>>>, Omit<EntryPickerOptions<Fields>, 'label' | 'selection'> {
|
|
55
|
-
}
|
|
56
53
|
function multiple<Fields = undefined>(label: Label, options?: WithoutLabel<ImagesOptions<Fields>>): ImagesField<Fields>;
|
|
57
54
|
}
|
|
@@ -14,7 +14,6 @@ var ImageLink;
|
|
|
14
14
|
ImageLink2.title = Entry.title;
|
|
15
15
|
ImageLink2.alt = MediaFile.alt;
|
|
16
16
|
ImageLink2.src = Entry.url;
|
|
17
|
-
ImageLink2.url = Entry.url;
|
|
18
17
|
ImageLink2.extension = MediaFile.extension;
|
|
19
18
|
ImageLink2.size = MediaFile.size;
|
|
20
19
|
ImageLink2.hash = MediaFile.hash;
|
|
@@ -93,32 +93,33 @@ import {
|
|
|
93
93
|
IcRoundOpenInNew,
|
|
94
94
|
IcRoundPanorama
|
|
95
95
|
} from "alinea/dashboard/icons";
|
|
96
|
+
import { assertPickerCondition } from "alinea/picker/entry/EntryPicker";
|
|
96
97
|
import { useId, useMemo, useRef, useState } from "react";
|
|
97
98
|
|
|
98
99
|
// src/field/link/LinkField.module.css
|
|
99
100
|
var LinkField_default = {
|
|
100
|
-
"LinkFieldView-previewImagePlaceholder": "alinea-LinkFieldView-previewImagePlaceholder",
|
|
101
|
-
"LinkFieldViewPreviewImagePlaceholder": "alinea-LinkFieldView-previewImagePlaceholder",
|
|
102
|
-
"LinkFieldView-previewImage": "alinea-LinkFieldView-previewImage",
|
|
103
|
-
"LinkFieldViewPreviewImage": "alinea-LinkFieldView-previewImage",
|
|
104
|
-
"LinkFieldView-anchorOption-label": "alinea-LinkFieldView-anchorOption-label",
|
|
105
|
-
"LinkFieldViewAnchorOptionLabel": "alinea-LinkFieldView-anchorOption-label",
|
|
106
|
-
"LinkFieldView-metaLabel": "alinea-LinkFieldView-metaLabel",
|
|
107
|
-
"LinkFieldViewMetaLabel": "alinea-LinkFieldView-metaLabel",
|
|
108
|
-
"LinkFieldView-anchorOption-location": "alinea-LinkFieldView-anchorOption-location",
|
|
109
|
-
"LinkFieldViewAnchorOptionLocation": "alinea-LinkFieldView-anchorOption-location",
|
|
110
101
|
"LinkFieldView-skeleton-pulse": "alinea-LinkFieldView-skeleton-pulse",
|
|
111
102
|
"LinkFieldViewSkeletonPulse": "alinea-LinkFieldView-skeleton-pulse",
|
|
112
|
-
"LinkFieldView-type": "alinea-LinkFieldView-type",
|
|
113
|
-
"LinkFieldViewType": "alinea-LinkFieldView-type",
|
|
114
|
-
"LinkFieldView-anchorOption": "alinea-LinkFieldView-anchorOption",
|
|
115
|
-
"LinkFieldViewAnchorOption": "alinea-LinkFieldView-anchorOption",
|
|
116
103
|
"LinkFieldView-icon": "alinea-LinkFieldView-icon",
|
|
117
104
|
"LinkFieldViewIcon": "alinea-LinkFieldView-icon",
|
|
118
105
|
"LinkFieldView-create": "alinea-LinkFieldView-create",
|
|
119
106
|
"LinkFieldViewCreate": "alinea-LinkFieldView-create",
|
|
107
|
+
"LinkFieldView-anchorOption-label": "alinea-LinkFieldView-anchorOption-label",
|
|
108
|
+
"LinkFieldViewAnchorOptionLabel": "alinea-LinkFieldView-anchorOption-label",
|
|
109
|
+
"LinkFieldView-previewImagePlaceholder": "alinea-LinkFieldView-previewImagePlaceholder",
|
|
110
|
+
"LinkFieldViewPreviewImagePlaceholder": "alinea-LinkFieldView-previewImagePlaceholder",
|
|
111
|
+
"LinkFieldView-anchorOption-location": "alinea-LinkFieldView-anchorOption-location",
|
|
112
|
+
"LinkFieldViewAnchorOptionLocation": "alinea-LinkFieldView-anchorOption-location",
|
|
120
113
|
"LinkFieldView-createButton": "alinea-LinkFieldView-createButton",
|
|
121
|
-
"LinkFieldViewCreateButton": "alinea-LinkFieldView-createButton"
|
|
114
|
+
"LinkFieldViewCreateButton": "alinea-LinkFieldView-createButton",
|
|
115
|
+
"LinkFieldView-anchorOption": "alinea-LinkFieldView-anchorOption",
|
|
116
|
+
"LinkFieldViewAnchorOption": "alinea-LinkFieldView-anchorOption",
|
|
117
|
+
"LinkFieldView-type": "alinea-LinkFieldView-type",
|
|
118
|
+
"LinkFieldViewType": "alinea-LinkFieldView-type",
|
|
119
|
+
"LinkFieldView-metaLabel": "alinea-LinkFieldView-metaLabel",
|
|
120
|
+
"LinkFieldViewMetaLabel": "alinea-LinkFieldView-metaLabel",
|
|
121
|
+
"LinkFieldView-previewImage": "alinea-LinkFieldView-previewImage",
|
|
122
|
+
"LinkFieldViewPreviewImage": "alinea-LinkFieldView-previewImage"
|
|
122
123
|
};
|
|
123
124
|
|
|
124
125
|
// src/field/link/LinkField.view.tsx
|
|
@@ -429,6 +430,7 @@ function useResolvedEntryPickerOptions(options, type, entry) {
|
|
|
429
430
|
condition,
|
|
430
431
|
location
|
|
431
432
|
]);
|
|
433
|
+
if (nextCondition) assertPickerCondition(nextCondition);
|
|
432
434
|
return { condition: nextCondition, location: nextLocation };
|
|
433
435
|
});
|
|
434
436
|
return unwrap(resolved, (previous) => previous ?? initialValue);
|
|
@@ -662,6 +664,7 @@ function EntryAnchorFieldInner({
|
|
|
662
664
|
return /* @__PURE__ */ jsx(
|
|
663
665
|
Select,
|
|
664
666
|
{
|
|
667
|
+
clearable: true,
|
|
665
668
|
disabled: isDisabled || anchors.length === 0,
|
|
666
669
|
label: "Anchor",
|
|
667
670
|
onValueChange: (next) => onChange(next ?? void 0),
|
|
@@ -59,6 +59,7 @@ import {
|
|
|
59
59
|
BlockSheet,
|
|
60
60
|
useBlockSheet
|
|
61
61
|
} from "alinea/dashboard/app/BlockSheet";
|
|
62
|
+
import { BlockSettings } from "alinea/dashboard/app/BlockSettings";
|
|
62
63
|
import { NodeEditor } from "alinea/dashboard/app/NodeEditor";
|
|
63
64
|
import {
|
|
64
65
|
useEntry,
|
|
@@ -85,6 +86,8 @@ import { memo, useCallback, useMemo, useRef, useState } from "react";
|
|
|
85
86
|
|
|
86
87
|
// src/field/list/ListField.module.css
|
|
87
88
|
var ListField_default = {
|
|
89
|
+
"ListFieldTypePicker-popover": "alinea-ListFieldTypePicker-popover",
|
|
90
|
+
"ListFieldTypePickerPopover": "alinea-ListFieldTypePicker-popover",
|
|
88
91
|
"ListFieldRowSheet-anchor-field": "alinea-ListFieldRowSheet-anchor-field",
|
|
89
92
|
"ListFieldRowSheetAnchorField": "alinea-ListFieldRowSheet-anchor-field",
|
|
90
93
|
"ListFieldRowSheet-anchor": "alinea-ListFieldRowSheet-anchor",
|
|
@@ -93,9 +96,7 @@ var ListField_default = {
|
|
|
93
96
|
"ListFieldTypePickerTrigger": "alinea-ListFieldTypePicker-trigger",
|
|
94
97
|
"ListFieldCreateActions": "alinea-ListFieldCreateActions",
|
|
95
98
|
"ListFieldCreateActions-button": "alinea-ListFieldCreateActions-button",
|
|
96
|
-
"ListFieldCreateActionsButton": "alinea-ListFieldCreateActions-button"
|
|
97
|
-
"ListFieldTypePicker-popover": "alinea-ListFieldTypePicker-popover",
|
|
98
|
-
"ListFieldTypePickerPopover": "alinea-ListFieldTypePicker-popover"
|
|
99
|
+
"ListFieldCreateActionsButton": "alinea-ListFieldCreateActions-button"
|
|
99
100
|
};
|
|
100
101
|
|
|
101
102
|
// src/field/list/ListField.view.tsx
|
|
@@ -126,6 +127,7 @@ function ListFieldView({ field }) {
|
|
|
126
127
|
[schemaEntries]
|
|
127
128
|
);
|
|
128
129
|
const readOnly = Boolean(options.readOnly);
|
|
130
|
+
const labelled = Boolean(options.label);
|
|
129
131
|
const hasRows = nodes.length > 0;
|
|
130
132
|
const canCreate = options.max === void 0 || nodes.length < options.max;
|
|
131
133
|
const rowIdsAtom = useMemo(
|
|
@@ -231,7 +233,8 @@ function ListFieldView({ field }) {
|
|
|
231
233
|
onClick: toggleAll,
|
|
232
234
|
description: options.help,
|
|
233
235
|
shared: options.shared,
|
|
234
|
-
|
|
236
|
+
showFold: labelled,
|
|
237
|
+
inline: options.inline || !labelled,
|
|
235
238
|
children: options.label
|
|
236
239
|
}
|
|
237
240
|
),
|
|
@@ -391,6 +394,14 @@ var ListFieldRow = memo(function ListFieldRow2({
|
|
|
391
394
|
ListFieldRowSheet,
|
|
392
395
|
{
|
|
393
396
|
anchor: anchorValue,
|
|
397
|
+
settings: /* @__PURE__ */ jsx(
|
|
398
|
+
BlockSettings,
|
|
399
|
+
{
|
|
400
|
+
node: row,
|
|
401
|
+
type,
|
|
402
|
+
readOnly
|
|
403
|
+
}
|
|
404
|
+
),
|
|
394
405
|
canInsert: canCreate,
|
|
395
406
|
customLabel,
|
|
396
407
|
isFirstRow: index === 0,
|
|
@@ -528,6 +539,7 @@ function ListFieldRowHeader({
|
|
|
528
539
|
}
|
|
529
540
|
function ListFieldRowSheet({
|
|
530
541
|
anchor,
|
|
542
|
+
settings,
|
|
531
543
|
canInsert,
|
|
532
544
|
customLabel,
|
|
533
545
|
isFirstRow,
|
|
@@ -586,42 +598,45 @@ function ListFieldRowSheet({
|
|
|
586
598
|
onSelect: (item) => insert(insertPosition, createRow(item.id, item.type))
|
|
587
599
|
}
|
|
588
600
|
) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
589
|
-
/* @__PURE__ */
|
|
590
|
-
/* @__PURE__ */
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
label: "Label",
|
|
594
|
-
disabled: readOnly,
|
|
595
|
-
onValueChange: onCustomLabelChange,
|
|
596
|
-
value: customLabel
|
|
597
|
-
}
|
|
598
|
-
),
|
|
599
|
-
/* @__PURE__ */ jsxs("div", { className: styles.ListFieldRowSheet.anchor(), children: [
|
|
600
|
-
/* @__PURE__ */ jsx("div", { className: styles.ListFieldRowSheet.anchor.field(), children: /* @__PURE__ */ jsx(
|
|
601
|
-
SlugField,
|
|
601
|
+
/* @__PURE__ */ jsxs(SheetBody, { children: [
|
|
602
|
+
/* @__PURE__ */ jsxs(SheetSection, { children: [
|
|
603
|
+
/* @__PURE__ */ jsx(
|
|
604
|
+
TextField,
|
|
602
605
|
{
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
source: customLabel
|
|
606
|
+
label: "Label",
|
|
607
|
+
disabled: readOnly,
|
|
608
|
+
onValueChange: onCustomLabelChange,
|
|
609
|
+
value: customLabel
|
|
608
610
|
}
|
|
609
|
-
)
|
|
610
|
-
|
|
611
|
-
/* @__PURE__ */ jsx(
|
|
612
|
-
|
|
611
|
+
),
|
|
612
|
+
/* @__PURE__ */ jsxs("div", { className: styles.ListFieldRowSheet.anchor(), children: [
|
|
613
|
+
/* @__PURE__ */ jsx("div", { className: styles.ListFieldRowSheet.anchor.field(), children: /* @__PURE__ */ jsx(
|
|
614
|
+
SlugField,
|
|
613
615
|
{
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
616
|
+
fieldValue: anchor,
|
|
617
|
+
label: "Anchor",
|
|
618
|
+
isDisabled: readOnly,
|
|
619
|
+
onChange: onAnchorChange,
|
|
620
|
+
source: customLabel
|
|
619
621
|
}
|
|
620
|
-
),
|
|
621
|
-
/* @__PURE__ */
|
|
622
|
+
) }),
|
|
623
|
+
link && /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
624
|
+
/* @__PURE__ */ jsx(
|
|
625
|
+
TooltipTrigger,
|
|
626
|
+
{
|
|
627
|
+
variant: "ghost",
|
|
628
|
+
size: "icon",
|
|
629
|
+
icon: IcRoundLink,
|
|
630
|
+
"aria-label": "Copy link to block",
|
|
631
|
+
onClick: () => navigator.clipboard.writeText(link)
|
|
632
|
+
}
|
|
633
|
+
),
|
|
634
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: "Copy link to block" })
|
|
635
|
+
] })
|
|
622
636
|
] })
|
|
623
|
-
] })
|
|
624
|
-
|
|
637
|
+
] }),
|
|
638
|
+
settings
|
|
639
|
+
] }),
|
|
625
640
|
/* @__PURE__ */ jsxs(SheetFooter, { children: [
|
|
626
641
|
/* @__PURE__ */ jsx(
|
|
627
642
|
Button,
|
|
@@ -18,34 +18,34 @@ import { IcRoundPublic } from "alinea/dashboard/icons";
|
|
|
18
18
|
|
|
19
19
|
// src/field/metadata/MetadataField.module.css
|
|
20
20
|
var MetadataField_default = {
|
|
21
|
-
"
|
|
22
|
-
"OpenGraphPreviewSite": "alinea-OpenGraphPreview-site",
|
|
23
|
-
"OpenGraphPreview-title": "alinea-OpenGraphPreview-title",
|
|
24
|
-
"OpenGraphPreviewTitle": "alinea-OpenGraphPreview-title",
|
|
25
|
-
"OpenGraphPreview-content": "alinea-OpenGraphPreview-content",
|
|
26
|
-
"OpenGraphPreviewContent": "alinea-OpenGraphPreview-content",
|
|
27
|
-
"MetadataUserFieldView-contact": "alinea-MetadataUserFieldView-contact",
|
|
28
|
-
"MetadataUserFieldViewContact": "alinea-MetadataUserFieldView-contact",
|
|
29
|
-
"SearchEnginePreview-og-label-small": "alinea-SearchEnginePreview-og-label-small",
|
|
30
|
-
"SearchEnginePreviewOgLabelSmall": "alinea-SearchEnginePreview-og-label-small",
|
|
21
|
+
"MetadataTimestampFieldView": "alinea-MetadataTimestampFieldView",
|
|
31
22
|
"OpenGraphPreview-description": "alinea-OpenGraphPreview-description",
|
|
32
23
|
"OpenGraphPreviewDescription": "alinea-OpenGraphPreview-description",
|
|
33
24
|
"SearchEnginePreview-link": "alinea-SearchEnginePreview-link",
|
|
34
25
|
"SearchEnginePreviewLink": "alinea-SearchEnginePreview-link",
|
|
35
26
|
"SearchEnginePreview-og": "alinea-SearchEnginePreview-og",
|
|
36
27
|
"SearchEnginePreviewOg": "alinea-SearchEnginePreview-og",
|
|
37
|
-
"MetadataUserFieldView": "alinea-MetadataUserFieldView",
|
|
38
|
-
"SearchEnginePreview": "alinea-SearchEnginePreview",
|
|
39
28
|
"OpenGraphPreview": "alinea-OpenGraphPreview",
|
|
40
|
-
"
|
|
29
|
+
"MetadataUserFieldView-contact": "alinea-MetadataUserFieldView-contact",
|
|
30
|
+
"MetadataUserFieldViewContact": "alinea-MetadataUserFieldView-contact",
|
|
31
|
+
"OpenGraphPreview-title": "alinea-OpenGraphPreview-title",
|
|
32
|
+
"OpenGraphPreviewTitle": "alinea-OpenGraphPreview-title",
|
|
41
33
|
"OpenGraphPreview-image": "alinea-OpenGraphPreview-image",
|
|
42
34
|
"OpenGraphPreviewImage": "alinea-OpenGraphPreview-image",
|
|
35
|
+
"SearchEnginePreview-og-label-small": "alinea-SearchEnginePreview-og-label-small",
|
|
36
|
+
"SearchEnginePreviewOgLabelSmall": "alinea-SearchEnginePreview-og-label-small",
|
|
37
|
+
"SearchEnginePreview": "alinea-SearchEnginePreview",
|
|
43
38
|
"SearchEnginePreview-description": "alinea-SearchEnginePreview-description",
|
|
44
39
|
"SearchEnginePreviewDescription": "alinea-SearchEnginePreview-description",
|
|
40
|
+
"OpenGraphPreview-site": "alinea-OpenGraphPreview-site",
|
|
41
|
+
"OpenGraphPreviewSite": "alinea-OpenGraphPreview-site",
|
|
45
42
|
"MetadataUserFieldView-person": "alinea-MetadataUserFieldView-person",
|
|
46
43
|
"MetadataUserFieldViewPerson": "alinea-MetadataUserFieldView-person",
|
|
44
|
+
"MetadataUserFieldView": "alinea-MetadataUserFieldView",
|
|
47
45
|
"SearchEnginePreview-og-label": "alinea-SearchEnginePreview-og-label",
|
|
48
|
-
"SearchEnginePreviewOgLabel": "alinea-SearchEnginePreview-og-label"
|
|
46
|
+
"SearchEnginePreviewOgLabel": "alinea-SearchEnginePreview-og-label",
|
|
47
|
+
"OpenGraphPreview-content": "alinea-OpenGraphPreview-content",
|
|
48
|
+
"OpenGraphPreviewContent": "alinea-OpenGraphPreview-content"
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
// src/field/metadata/MetadataField.view.tsx
|