@formicoidea/labre-core-database 0.61.0 → 1.1.0

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.
@@ -0,0 +1,27 @@
1
+ import { type DatabaseCreationMenu } from '@formicoidea/labre-core/blocks/database';
2
+ import { type MenuConfig } from '@formicoidea/labre-core/components/context-menu';
3
+ import { type DataSourcePickerService } from '@formicoidea/labre-core/shared/services';
4
+ import type { BlockStdScope } from '@formicoidea/labre-core/std';
5
+ /**
6
+ * The popover's items, from the picker alone (held by
7
+ * `creation-popover.unit.spec.ts`): "New empty source" when the host creates
8
+ * a database, "Link an existing source" when it lists one, each connecting
9
+ * the block it was opened over: `connectDatabaseToSource` for a block with
10
+ * no source, `reconnectDatabaseView` on `viewId` (else the first view) for
11
+ * a hosted block whose source the host no longer resolves (ADR 0035
12
+ * amendment of 2026-10-29). A cancelled creation (`null`, or a database
13
+ * with no source) writes nothing.
14
+ */
15
+ export declare function databaseCreationItems(std: BlockStdScope, picker: DataSourcePickerService, blockId: string, viewId?: string): MenuConfig[];
16
+ /**
17
+ * The creation menu of the `core-database` bundle (ADR 0035 §5, amendment of
18
+ * 2026-10-28): "Table View" and "Kanban View" insert a native database at
19
+ * once and open this popover over it, so a host's database is created or
20
+ * linked only when the reader says which. Escape or a click outside closes
21
+ * it and leaves the native database, which renders and stays editable; a
22
+ * host that sets `requireSource` gets it drawn as an empty view whose
23
+ * "Connect a source" reopens this popover (ADR 0035 amendment of
24
+ * 2026-10-29). Closing writes nothing either way. Without a host picker the
25
+ * entries never call it.
26
+ */
27
+ export declare function databaseCreationMenu(): DatabaseCreationMenu;
@@ -0,0 +1,101 @@
1
+ import { connectDatabaseToSource, DATABASE_CREATION_TITLE, reconnectDatabaseView, } from '@formicoidea/labre-core/blocks/database';
2
+ import { menu, popMenu, popupTargetFromElement, } from '@formicoidea/labre-core/components/context-menu';
3
+ import { DataSourcePickerProvider, translateKey, } from '@formicoidea/labre-core/shared/services';
4
+ import { LinkIcon, PlusIcon } from '@blocksuite/icons/lit';
5
+ import { dataSourcePickerItems } from './data-source-picker.js';
6
+ import { DATABASE_CREATION_LINK_EXISTING, DATABASE_CREATION_NEW_SOURCE, } from './translations.js';
7
+ /** The block the entry inserted, while it is still a database. */
8
+ function databaseModel(std, blockId) {
9
+ const model = std.store.getModelById(blockId);
10
+ return model?.flavour === 'affine:database'
11
+ ? model
12
+ : null;
13
+ }
14
+ /**
15
+ * The popover's items, from the picker alone (held by
16
+ * `creation-popover.unit.spec.ts`): "New empty source" when the host creates
17
+ * a database, "Link an existing source" when it lists one, each connecting
18
+ * the block it was opened over: `connectDatabaseToSource` for a block with
19
+ * no source, `reconnectDatabaseView` on `viewId` (else the first view) for
20
+ * a hosted block whose source the host no longer resolves (ADR 0035
21
+ * amendment of 2026-10-29). A cancelled creation (`null`, or a database
22
+ * with no source) writes nothing.
23
+ */
24
+ export function databaseCreationItems(std, picker, blockId, viewId) {
25
+ const t = (wording) => translateKey(std, wording[0], wording[1]);
26
+ const connect = (database, sourceId) => {
27
+ const model = databaseModel(std, blockId);
28
+ if (!model)
29
+ return;
30
+ if (model.props.externalSourceId === undefined) {
31
+ connectDatabaseToSource(std, model, { database, sourceId });
32
+ return;
33
+ }
34
+ const view = viewId ?? model.props.views[0]?.id;
35
+ if (view) {
36
+ reconnectDatabaseView(std, model, { database, sourceId, viewId: view });
37
+ }
38
+ };
39
+ const createDatabase = picker.createDatabase;
40
+ const list = picker.list();
41
+ return [
42
+ menu.action({
43
+ name: t(DATABASE_CREATION_NEW_SOURCE),
44
+ prefix: PlusIcon(),
45
+ testId: 'database-creation-new-source',
46
+ hide: () => !createDatabase || std.store.readonly,
47
+ select: () => {
48
+ createDatabase
49
+ ?.call(picker)
50
+ .then(database => {
51
+ const source = database?.sources[0];
52
+ if (database && source)
53
+ connect(database, source.id);
54
+ })
55
+ .catch(console.error);
56
+ },
57
+ }),
58
+ menu.subMenu({
59
+ name: t(DATABASE_CREATION_LINK_EXISTING),
60
+ prefix: LinkIcon(),
61
+ // The entry's test id names the entry, the options' the menu it opens.
62
+ class: 'database-creation-link-existing',
63
+ testId: 'database-creation-link-existing-entry',
64
+ hide: () => list.value.length === 0,
65
+ options: {
66
+ testId: 'database-creation-link-existing',
67
+ items: dataSourcePickerItems(std, picker, {
68
+ offerCreate: false,
69
+ onPick: ({ database, sourceId }) => connect(database, sourceId),
70
+ }),
71
+ },
72
+ }),
73
+ ];
74
+ }
75
+ /**
76
+ * The creation menu of the `core-database` bundle (ADR 0035 §5, amendment of
77
+ * 2026-10-28): "Table View" and "Kanban View" insert a native database at
78
+ * once and open this popover over it, so a host's database is created or
79
+ * linked only when the reader says which. Escape or a click outside closes
80
+ * it and leaves the native database, which renders and stays editable; a
81
+ * host that sets `requireSource` gets it drawn as an empty view whose
82
+ * "Connect a source" reopens this popover (ADR 0035 amendment of
83
+ * 2026-10-29). Closing writes nothing either way. Without a host picker the
84
+ * entries never call it.
85
+ */
86
+ export function databaseCreationMenu() {
87
+ return {
88
+ open: ({ std, blockId, anchor, viewId }) => {
89
+ const picker = std.getOptional(DataSourcePickerProvider);
90
+ if (!picker)
91
+ return;
92
+ popMenu(popupTargetFromElement(anchor), {
93
+ options: {
94
+ title: { text: translateKey(std, ...DATABASE_CREATION_TITLE) },
95
+ testId: 'database-creation-popover',
96
+ items: databaseCreationItems(std, picker, blockId, viewId),
97
+ },
98
+ });
99
+ },
100
+ };
101
+ }
@@ -16,6 +16,13 @@ export interface DataSourcePickerOptions {
16
16
  */
17
17
  databaseId?: string;
18
18
  onPick: (choice: DataSourceChoice) => void;
19
+ /**
20
+ * Offer "New database" and "New source" where the host creates them;
21
+ * `true` when absent. The creation popover passes `false`: its own "New
22
+ * empty source" is the way to create, its "Link an existing source" only
23
+ * links (ADR 0035 amendment of 2026-10-28).
24
+ */
25
+ offerCreate?: boolean;
19
26
  }
20
27
  /**
21
28
  * The menu items of the picker, read from `picker.list()` each time the menu
@@ -2,7 +2,7 @@ import { menu, popMenu, } from '@formicoidea/labre-core/components/context-menu'
2
2
  import { DOC_UNTITLED, translateKey, } from '@formicoidea/labre-core/shared/services';
3
3
  import { DatabaseTableViewIcon, PlusIcon } from '@blocksuite/icons/lit';
4
4
  import { PICKER_EMPTY, PICKER_NEW_DATABASE, PICKER_NEW_SOURCE, PICKER_TITLE, } from './translations.js';
5
- function sourceItems(std, picker, database, onPick) {
5
+ function sourceItems(std, picker, database, onPick, offerCreate) {
6
6
  const t = (wording) => translateKey(std, wording[0], wording[1]);
7
7
  const items = database.sources.map(source => menu.action({
8
8
  name: source.title || t(DOC_UNTITLED),
@@ -11,7 +11,7 @@ function sourceItems(std, picker, database, onPick) {
11
11
  select: () => onPick({ database, sourceId: source.id, source: 'existing' }),
12
12
  }));
13
13
  const createSource = picker.createSource;
14
- if (createSource && !std.store.readonly) {
14
+ if (createSource && offerCreate && !std.store.readonly) {
15
15
  items.push(menu.action({
16
16
  name: t(PICKER_NEW_SOURCE),
17
17
  prefix: PlusIcon(),
@@ -43,20 +43,22 @@ function sourceItems(std, picker, database, onPick) {
43
43
  */
44
44
  export function dataSourcePickerItems(std, picker, options) {
45
45
  const t = (wording) => translateKey(std, wording[0], wording[1]);
46
- const { onPick, databaseId } = options;
46
+ const { onPick, databaseId, offerCreate = true } = options;
47
47
  const list = picker.list();
48
48
  if (databaseId !== undefined) {
49
49
  return [
50
50
  menu.dynamic(() => {
51
51
  const database = list.value.find(d => d.id === databaseId);
52
- return database ? sourceItems(std, picker, database, onPick) : [];
52
+ return database
53
+ ? sourceItems(std, picker, database, onPick, offerCreate)
54
+ : [];
53
55
  }),
54
56
  ];
55
57
  }
56
58
  const items = [
57
59
  menu.dynamic(() => {
58
60
  const databases = list.value;
59
- if (databases.length === 0 && !picker.createDatabase) {
61
+ if (databases.length === 0 && !(offerCreate && picker.createDatabase)) {
60
62
  return [
61
63
  menu.action({
62
64
  name: t(PICKER_EMPTY),
@@ -69,12 +71,12 @@ export function dataSourcePickerItems(std, picker, options) {
69
71
  name: database.title || t(DOC_UNTITLED),
70
72
  prefix: DatabaseTableViewIcon(),
71
73
  options: {
72
- items: sourceItems(std, picker, database, onPick),
74
+ items: sourceItems(std, picker, database, onPick, offerCreate),
73
75
  },
74
76
  }));
75
77
  }),
76
78
  ];
77
- const createDatabase = picker.createDatabase;
79
+ const createDatabase = offerCreate ? picker.createDatabase : undefined;
78
80
  if (createDatabase && !std.store.readonly) {
79
81
  items.push(menu.group({
80
82
  items: [
@@ -48,6 +48,14 @@ export declare function selectionStaysInHost(store: StoreLike, hostBlockId: stri
48
48
  * last block that appends a paragraph): nothing on this page can select,
49
49
  * move or delete what it does not draw, and nothing inserts into the note.
50
50
  *
51
+ * The page's look is not this root's: the block derives it from where it is
52
+ * drawn (ADR 0035 amendment of 2026-10-28). Rendered directly by this root,
53
+ * under a `<doc-title>` that names it as its body, it hides its own title
54
+ * row, drops its top margin and keeps its view bar in view sideways
55
+ * (`data-standalone`), and its table sticks its column header to the page
56
+ * (`data-page-layout`). Mounted without that heading, the block renders as
57
+ * inline, its title shown. This root only widens with such a table.
58
+ *
51
59
  * It writes nothing, on mount or later. A document with no database block by
52
60
  * that id draws a notice; the block may arrive through sync, so the notice
53
61
  * follows additions and deletions.
@@ -63,6 +63,14 @@ export function selectionStaysInHost(store, hostBlockId, selection) {
63
63
  * last block that appends a paragraph): nothing on this page can select,
64
64
  * move or delete what it does not draw, and nothing inserts into the note.
65
65
  *
66
+ * The page's look is not this root's: the block derives it from where it is
67
+ * drawn (ADR 0035 amendment of 2026-10-28). Rendered directly by this root,
68
+ * under a `<doc-title>` that names it as its body, it hides its own title
69
+ * row, drops its top margin and keeps its view bar in view sideways
70
+ * (`data-standalone`), and its table sticks its column header to the page
71
+ * (`data-page-layout`). Mounted without that heading, the block renders as
72
+ * inline, its title shown. This root only widens with such a table.
73
+ *
66
74
  * It writes nothing, on mount or later. A document with no database block by
67
75
  * that id draws a notice; the block may arrive through sync, so the notice
68
76
  * follows additions and deletions.
@@ -76,39 +84,13 @@ export class DatabasePageRoot extends BlockComponent {
76
84
  margin: 0 auto;
77
85
  padding: 0 var(--affine-editor-side-padding, 24px);
78
86
  }
79
- /* The page title above is the database's name. !important: the row is
80
- an emotion class (display: flex), which outweighs this selector. */
81
- affine-database-page-root div:has(> affine-database-title) {
82
- display: none !important;
83
- }
84
- /* The view bar sits under the page heading: no top margin or padding
85
- of the inline block. The attribute outweighs the block's emotion class
86
- (one class); its sides and bottom stay the inline block's. */
87
- affine-database-page-root affine-database[data-block-id] {
88
- margin-top: 0;
89
- padding-top: 0;
90
- }
91
- /* A table is as wide as its columns: the page scrolls sideways, so the
92
- column header sticks natively to the page's top (data-view's column
93
- header then leaves it alone). The table's own wrappers stop being
94
- scrollers, the view bar stays in view, a viewport wide. */
95
- affine-database-page-root:has(dv-table-view-ui) {
87
+ /* A table laid out as the page is as wide as its columns
88
+ (data-view's data-page-layout): the root grows with it, so the page
89
+ scrolls sideways. A board keeps its own sideways scroller. */
90
+ affine-database-page-root:has(dv-table-view-ui[data-page-layout]) {
96
91
  width: max-content;
97
92
  min-width: 100%;
98
93
  }
99
- affine-database-page-root .dv-table-wrapper,
100
- affine-database-page-root .dv-table-scroll-container {
101
- overflow: visible;
102
- }
103
- affine-database-page-root affine-database-column-header {
104
- position: sticky;
105
- top: 0;
106
- }
107
- affine-database-page-root div:has(> div > affine-database-title) {
108
- position: sticky;
109
- left: var(--affine-editor-side-padding, 24px);
110
- width: calc(100cqw - 2 * var(--affine-editor-side-padding, 24px));
111
- }
112
94
  /* A phone keeps the page root's narrow padding (page-root-block.ts). */
113
95
  @container viewport (width <= 640px) {
114
96
  affine-database-page-root {
@@ -1,5 +1,8 @@
1
+ import { popupTargetFromElement, } from '@formicoidea/labre-core/components/context-menu';
1
2
  import { DataSourcePickerProvider, } from '@formicoidea/labre-core/shared/services';
2
- import { PROPERTIES_PANEL_TITLE, VIEW_MENU_COLOR_RULES, VIEW_MENU_GROUP, VIEW_MENU_IMPORT, VIEW_MENU_LAYOUT, VIEW_MENU_OPEN_IN, VIEW_MENU_SAVE_TEMPLATE, } from '../translations.js';
3
+ import { ViewSettingsMenuIdentifier, } from '@formicoidea/labre-core/data-view';
4
+ import { PROPERTIES_PANEL_TITLE, VIEW_MENU_COLOR_RULES, VIEW_MENU_GROUP, VIEW_MENU_IMPORT, VIEW_MENU_LAYOUT, VIEW_MENU_OPEN_IN, VIEW_MENU_SAVE_TEMPLATE, VIEW_SETTINGS_SOURCE, } from '../translations.js';
5
+ import { changeSourceTarget, popChangeSourcePicker, } from '../view-settings/source-entry.js';
3
6
  import { canImportView, currentViewTemplate, requestViewImport, } from '../view-transfer/import-view.js';
4
7
  /** The current view's options button on the page: what knows the view. */
5
8
  function viewOptions(std, hostBlockId) {
@@ -9,6 +12,21 @@ function viewOptions(std, hostBlockId) {
9
12
  function dataSourceOf(std, hostBlockId) {
10
13
  return viewOptions(std, hostBlockId)?.dataViewLogic.view.manager.dataSource;
11
14
  }
15
+ /**
16
+ * The current view's "Source", where the view settings offer it: the same
17
+ * predicate (`changeSourceTarget`), and only with the tooling extension's
18
+ * entry registered, so `{ database: false }` drops both.
19
+ */
20
+ function sourceChange(std, hostBlockId) {
21
+ if (!std.getOptional(ViewSettingsMenuIdentifier))
22
+ return;
23
+ const options = viewOptions(std, hostBlockId);
24
+ if (!options)
25
+ return;
26
+ const view = options.dataViewLogic.view;
27
+ const change = changeSourceTarget(std, view.manager.dataSource, view);
28
+ return change && { options, change };
29
+ }
12
30
  function setting(hostBlockId, key, wording, order) {
13
31
  return {
14
32
  id: `database.view.${key}`,
@@ -33,10 +51,32 @@ export function databasePageViewCommands(hostBlockId) {
33
51
  const picker = (std) => std.getOptional(DataSourcePickerProvider);
34
52
  return [
35
53
  setting(hostBlockId, 'layout', VIEW_MENU_LAYOUT, 0),
36
- setting(hostBlockId, 'group', VIEW_MENU_GROUP, 1),
37
- setting(hostBlockId, 'open-in', VIEW_MENU_OPEN_IN, 2),
38
- setting(hostBlockId, 'properties', PROPERTIES_PANEL_TITLE, 3),
39
- setting(hostBlockId, 'color-rules', VIEW_MENU_COLOR_RULES, 4),
54
+ {
55
+ id: 'database.view.source',
56
+ owner: 'core',
57
+ kind: 'action',
58
+ labelKey: VIEW_SETTINGS_SOURCE[0],
59
+ labelFallback: VIEW_SETTINGS_SOURCE[1],
60
+ category: 'view',
61
+ surfaces: ['view-menu'],
62
+ order: 1,
63
+ scope: 'page',
64
+ defaultKeys: { mac: [], other: [] },
65
+ when: std => !!sourceChange(std, hostBlockId),
66
+ // The picker the entry opens, anchored on the options button, its
67
+ // "back" opening the view settings there.
68
+ run: std => {
69
+ const found = sourceChange(std, hostBlockId);
70
+ if (!found)
71
+ return;
72
+ const target = popupTargetFromElement(found.options);
73
+ popChangeSourcePicker(std, target, found.change, () => found.options.openMoreAction(target));
74
+ },
75
+ },
76
+ setting(hostBlockId, 'group', VIEW_MENU_GROUP, 2),
77
+ setting(hostBlockId, 'open-in', VIEW_MENU_OPEN_IN, 3),
78
+ setting(hostBlockId, 'properties', PROPERTIES_PANEL_TITLE, 4),
79
+ setting(hostBlockId, 'color-rules', VIEW_MENU_COLOR_RULES, 5),
40
80
  {
41
81
  id: 'database.view.save-template',
42
82
  owner: 'core',
@@ -45,7 +85,7 @@ export function databasePageViewCommands(hostBlockId) {
45
85
  labelFallback: VIEW_MENU_SAVE_TEMPLATE[1],
46
86
  category: 'view',
47
87
  surfaces: ['view-menu'],
48
- order: 5,
88
+ order: 6,
49
89
  scope: 'page',
50
90
  defaultKeys: { mac: [], other: [] },
51
91
  when: std => {
@@ -72,7 +112,7 @@ export function databasePageViewCommands(hostBlockId) {
72
112
  labelFallback: VIEW_MENU_IMPORT[1],
73
113
  category: 'transfer',
74
114
  surfaces: ['view-menu'],
75
- order: 6,
115
+ order: 7,
76
116
  scope: 'page',
77
117
  defaultKeys: { mac: [], other: [] },
78
118
  when: std => {
package/dist/index.d.ts CHANGED
@@ -2,3 +2,5 @@ export * from './translations.js';
2
2
  export { addImportedView, currentViewTemplate, requestViewImport, sourceProperties, } from './view-transfer/import-view.js';
3
3
  export { defaultMapping, type RemapDropped, type RemappedView, remapView, viewTemplateData, } from './view-transfer/remap-view.js';
4
4
  export { databasePageViewCommands } from './database-page/view-menu-commands.js';
5
+ export { databaseViewSettingsMenu } from './view-settings/source-entry.js';
6
+ export { changeViewSource, schemaProperties, } from './view-transfer/change-source.js';
package/dist/index.js CHANGED
@@ -2,3 +2,5 @@ export * from './translations.js';
2
2
  export { addImportedView, currentViewTemplate, requestViewImport, sourceProperties, } from './view-transfer/import-view.js';
3
3
  export { defaultMapping, remapView, viewTemplateData, } from './view-transfer/remap-view.js';
4
4
  export { databasePageViewCommands } from './database-page/view-menu-commands.js';
5
+ export { databaseViewSettingsMenu } from './view-settings/source-entry.js';
6
+ export { changeViewSource, schemaProperties, } from './view-transfer/change-source.js';
@@ -35,7 +35,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
35
35
  import { DatabaseBlockComponent } from '@formicoidea/labre-core/blocks/database';
36
36
  import { PropertiesPanelProvider, translateKey, } from '@formicoidea/labre-core/shared/services';
37
37
  import { panelHeaderStyles } from '@formicoidea/labre-core/shared/styles';
38
- import { dataViewCssVariable } from '@formicoidea/labre-core/data-view';
38
+ import { dataViewCssVariable, } from '@formicoidea/labre-core/data-view';
39
39
  import { SignalWatcher, WithDisposable } from '@formicoidea/labre-core/global/lit';
40
40
  import { CloseIcon } from '@blocksuite/icons/lit';
41
41
  import { ShadowlessElement } from '@formicoidea/labre-core/std';
@@ -8,32 +8,43 @@ export declare const DATABASE_ADD_VIEW_NEW_SOURCE: ChromeWording;
8
8
  export declare const DATABASE_ADD_VIEW_UNTITLED_SOURCE: ChromeWording;
9
9
  /** The third entry: copy a view of another database (labre REQ-DB-2). */
10
10
  export declare const DATABASE_ADD_VIEW_IMPORT: ChromeWording;
11
+ /** Asks the host for a new database and connects the block to its source. */
12
+ export declare const DATABASE_CREATION_NEW_SOURCE: ChromeWording;
13
+ /** The sources of the databases the host lists, without "New database". */
14
+ export declare const DATABASE_CREATION_LINK_EXISTING: ChromeWording;
11
15
  /** The document has no block by the id the host named as the views' host. */
12
16
  export declare const DATABASE_PAGE_HOST_MISSING: ChromeWording;
13
17
  /**
14
18
  * "Layout" and "Group" are the view settings' own entries too: declared once
15
- * by `@labre/data-view` (`DATA_VIEW_LAYOUT`, `DATA_VIEW_GROUP`), restated
19
+ * by `@labre/affine-database-engine` (`DATA_VIEW_LAYOUT`, `DATA_VIEW_GROUP`), restated
16
20
  * here, so not listed below.
17
21
  */
18
22
  export declare const VIEW_MENU_LAYOUT: ChromeWording;
19
23
  export declare const VIEW_MENU_GROUP: ChromeWording;
20
24
  /**
21
25
  * The view settings' own entry (`DATA_VIEW_OPEN_IN`): one chrome word, one
22
- * key, declared once by `@labre/data-view`, so not listed below. "Properties"
26
+ * key, declared once by `@labre/affine-database-engine`, so not listed below. "Properties"
23
27
  * is the panel title for the same reason (`PROPERTIES_PANEL_TITLE`).
24
28
  */
25
29
  export declare const VIEW_MENU_OPEN_IN: ChromeWording;
26
30
  /**
27
31
  * "Conditional colors" (ADR 0036): the view settings' own entry
28
32
  * (`DATA_VIEW_COLOR_RULES`), one chrome word, one key, declared once by
29
- * `@labre/data-view`, so not listed below.
33
+ * `@labre/affine-database-engine`, so not listed below.
30
34
  */
31
35
  export declare const VIEW_MENU_COLOR_RULES: ChromeWording;
32
36
  /** Shared with the frame toolbar: one chrome word, one key (`SAVE_AS_TEMPLATE`). */
33
37
  export declare const VIEW_MENU_SAVE_TEMPLATE: ChromeWording;
34
38
  export declare const VIEW_MENU_IMPORT: ChromeWording;
35
39
  /**
36
- * Declared once by `@labre/data-view` (`DATA_VIEW_PROPERTIES`, the list's own
40
+ * The view settings' "Source" and the full page's `database.view.source`:
41
+ * one chrome word, one key. Its menu reuses the picker's words
42
+ * (`PICKER_TITLE`, `PICKER_NEW_SOURCE`) and an untitled source reads
43
+ * `DATABASE_ADD_VIEW_UNTITLED_SOURCE`.
44
+ */
45
+ export declare const VIEW_SETTINGS_SOURCE: ChromeWording;
46
+ /**
47
+ * Declared once by `@labre/affine-database-engine` (`DATA_VIEW_PROPERTIES`, the list's own
37
48
  * title, in its view options popover too), so not listed below. Restated, not
38
49
  * imported: this bundle imports core alone (`core-database-boundary`).
39
50
  */
@@ -20,6 +20,17 @@ export const DATABASE_ADD_VIEW_IMPORT = [
20
20
  'com.labre.database.add-view.import',
21
21
  'Import a view from another database',
22
22
  ];
23
+ /* ── The creation popover (ADR 0035 §5, amendment of 2026-10-28) ──────── */
24
+ /** Asks the host for a new database and connects the block to its source. */
25
+ export const DATABASE_CREATION_NEW_SOURCE = [
26
+ 'com.labre.database.creation.new-source',
27
+ 'New empty source',
28
+ ];
29
+ /** The sources of the databases the host lists, without "New database". */
30
+ export const DATABASE_CREATION_LINK_EXISTING = [
31
+ 'com.labre.database.creation.link-existing',
32
+ 'Link an existing source',
33
+ ];
23
34
  /* ── The full-page database host (ADR 0035 §1, B13) ───────────────────── */
24
35
  /** The document has no block by the id the host named as the views' host. */
25
36
  export const DATABASE_PAGE_HOST_MISSING = [
@@ -29,7 +40,7 @@ export const DATABASE_PAGE_HOST_MISSING = [
29
40
  /* ── The full page's view-menu commands (labre REQ-DB-10) ───────────── */
30
41
  /**
31
42
  * "Layout" and "Group" are the view settings' own entries too: declared once
32
- * by `@labre/data-view` (`DATA_VIEW_LAYOUT`, `DATA_VIEW_GROUP`), restated
43
+ * by `@labre/affine-database-engine` (`DATA_VIEW_LAYOUT`, `DATA_VIEW_GROUP`), restated
33
44
  * here, so not listed below.
34
45
  */
35
46
  export const VIEW_MENU_LAYOUT = [
@@ -42,7 +53,7 @@ export const VIEW_MENU_GROUP = [
42
53
  ];
43
54
  /**
44
55
  * The view settings' own entry (`DATA_VIEW_OPEN_IN`): one chrome word, one
45
- * key, declared once by `@labre/data-view`, so not listed below. "Properties"
56
+ * key, declared once by `@labre/affine-database-engine`, so not listed below. "Properties"
46
57
  * is the panel title for the same reason (`PROPERTIES_PANEL_TITLE`).
47
58
  */
48
59
  export const VIEW_MENU_OPEN_IN = [
@@ -52,7 +63,7 @@ export const VIEW_MENU_OPEN_IN = [
52
63
  /**
53
64
  * "Conditional colors" (ADR 0036): the view settings' own entry
54
65
  * (`DATA_VIEW_COLOR_RULES`), one chrome word, one key, declared once by
55
- * `@labre/data-view`, so not listed below.
66
+ * `@labre/affine-database-engine`, so not listed below.
56
67
  */
57
68
  export const VIEW_MENU_COLOR_RULES = [
58
69
  'com.labre.data-view.color-rules',
@@ -64,9 +75,20 @@ export const VIEW_MENU_IMPORT = [
64
75
  'com.labre.database.view-menu.import',
65
76
  'Import a view…',
66
77
  ];
78
+ /* ── A view's source (ADR 0035 amendment of 2026-10-28) ───────────────── */
79
+ /**
80
+ * The view settings' "Source" and the full page's `database.view.source`:
81
+ * one chrome word, one key. Its menu reuses the picker's words
82
+ * (`PICKER_TITLE`, `PICKER_NEW_SOURCE`) and an untitled source reads
83
+ * `DATABASE_ADD_VIEW_UNTITLED_SOURCE`.
84
+ */
85
+ export const VIEW_SETTINGS_SOURCE = [
86
+ 'com.labre.database.view-settings.source',
87
+ 'Source',
88
+ ];
67
89
  /* ── The properties panel (ADR 0035 §9b, issue B10) ────────────────────── */
68
90
  /**
69
- * Declared once by `@labre/data-view` (`DATA_VIEW_PROPERTIES`, the list's own
91
+ * Declared once by `@labre/affine-database-engine` (`DATA_VIEW_PROPERTIES`, the list's own
70
92
  * title, in its view options popover too), so not listed below. Restated, not
71
93
  * imported: this bundle imports core alone (`core-database-boundary`).
72
94
  */
@@ -128,6 +150,8 @@ const DATABASE_EDITOR_WORDINGS = [
128
150
  DATABASE_ADD_VIEW_IMPORT,
129
151
  DATABASE_ADD_VIEW_NEW_SOURCE,
130
152
  DATABASE_ADD_VIEW_UNTITLED_SOURCE,
153
+ DATABASE_CREATION_LINK_EXISTING,
154
+ DATABASE_CREATION_NEW_SOURCE,
131
155
  DATABASE_PAGE_HOST_MISSING,
132
156
  PICKER_EMPTY,
133
157
  PICKER_NEW_DATABASE,
@@ -139,6 +163,7 @@ const DATABASE_EDITOR_WORDINGS = [
139
163
  SLASH_LINKED_VIEW,
140
164
  SLASH_LINKED_VIEW_DESCRIPTION,
141
165
  VIEW_MENU_IMPORT,
166
+ VIEW_SETTINGS_SOURCE,
142
167
  ];
143
168
  /**
144
169
  * This package's `com.labre.database.*` wordings, exported from the package
@@ -0,0 +1,52 @@
1
+ import { HostedDataSourceBase } from '@formicoidea/labre-core/blocks/database';
2
+ import { type MenuHandler, type PopupTarget } from '@formicoidea/labre-core/components/context-menu';
3
+ import { type DataSourcePickerService } from '@formicoidea/labre-core/shared/services';
4
+ import type { DataSource, ViewSettingsMenu } from '@formicoidea/labre-core/data-view';
5
+ import type { BlockStdScope } from '@formicoidea/labre-core/std';
6
+ import type { ReadonlySignal } from '@preact/signals-core';
7
+ /**
8
+ * "Source" in a view's settings (ADR 0035 amendment of 2026-10-28): which
9
+ * source of its database the view reads, and the picker to point it at
10
+ * another, "New source" included when the host gives `createSource`. One
11
+ * predicate and one opener for the two places that offer it, the view
12
+ * settings menu (`databaseViewSettingsMenu`) and the full page's
13
+ * `database.view.source` command, so they cannot disagree.
14
+ */
15
+ /** The view as the predicate reads it: `SingleView` of `@labre/affine-database-engine`, by shape. */
16
+ interface SourceView {
17
+ id: string;
18
+ readonly$: ReadonlySignal<boolean>;
19
+ shownAsFallback$: ReadonlySignal<boolean>;
20
+ }
21
+ /** Everything the entry needs, or nothing when the view offers no source choice. */
22
+ export interface ChangeSourceTarget {
23
+ dataSource: HostedDataSourceBase;
24
+ databaseId: string;
25
+ picker: DataSourcePickerService;
26
+ viewId: string;
27
+ }
28
+ /**
29
+ * Whether `view` offers "Source" now: a database whose views name their
30
+ * source (`resolvesSources`), the picker naming it (`databaseIdOf`, the
31
+ * block's `externalSourceId`), the host's picker registered, and a view that
32
+ * takes settings (not read-only, not drawn through a fallback preset). An
33
+ * inline database has one implicit source and nothing to choose.
34
+ */
35
+ export declare function changeSourceTarget(std: BlockStdScope, dataSource: DataSource, view: SourceView): ChangeSourceTarget | undefined;
36
+ /** The current source's title, or "Untitled source". */
37
+ export declare function currentSourceTitle(std: BlockStdScope, dataSource: HostedDataSourceBase): string;
38
+ /**
39
+ * Pop the picker on this database's sources at `target`, its "back" reopening
40
+ * the view settings (`reopen`); a pick points the view at it. The picker's
41
+ * own items (`dataSourcePickerItems`, "New source" through `createSource`)
42
+ * under its own title, so it reads as the "+ view" picker does.
43
+ */
44
+ export declare function popChangeSourcePicker(std: BlockStdScope, target: PopupTarget, change: ChangeSourceTarget, reopen: () => void): MenuHandler;
45
+ /**
46
+ * The view settings' "Source" (`ViewSettingsMenuIdentifier`, registered by
47
+ * the tooling extension): one entry after "Layout", its postfix the current
48
+ * source's title. `undefined` where {@link changeSourceTarget} says no, so an
49
+ * inline database's settings stay the 0.61 menu.
50
+ */
51
+ export declare function databaseViewSettingsMenu(): ViewSettingsMenu;
52
+ export {};
@@ -0,0 +1,87 @@
1
+ import { HostedDataSourceBase } from '@formicoidea/labre-core/blocks/database';
2
+ import { menu, popMenu, } from '@formicoidea/labre-core/components/context-menu';
3
+ import { DataSourcePickerProvider, translateKey, } from '@formicoidea/labre-core/shared/services';
4
+ import { ArrowRightSmallIcon, DatabaseTableViewIcon, } from '@blocksuite/icons/lit';
5
+ import { html } from 'lit';
6
+ import { dataSourcePickerItems } from '../data-source-picker.js';
7
+ import { DATABASE_ADD_VIEW_UNTITLED_SOURCE, PICKER_TITLE, VIEW_SETTINGS_SOURCE, } from '../translations.js';
8
+ import { changeViewSource } from '../view-transfer/change-source.js';
9
+ import { databaseIdOf } from '../view-transfer/import-view.js';
10
+ /**
11
+ * Whether `view` offers "Source" now: a database whose views name their
12
+ * source (`resolvesSources`), the picker naming it (`databaseIdOf`, the
13
+ * block's `externalSourceId`), the host's picker registered, and a view that
14
+ * takes settings (not read-only, not drawn through a fallback preset). An
15
+ * inline database has one implicit source and nothing to choose.
16
+ */
17
+ export function changeSourceTarget(std, dataSource, view) {
18
+ if (!(dataSource instanceof HostedDataSourceBase))
19
+ return;
20
+ if (!dataSource.resolvesSources)
21
+ return;
22
+ if (view.readonly$.value || view.shownAsFallback$.value)
23
+ return;
24
+ const picker = std.getOptional(DataSourcePickerProvider);
25
+ if (!picker)
26
+ return;
27
+ const databaseId = databaseIdOf(dataSource);
28
+ if (databaseId === undefined)
29
+ return;
30
+ return { dataSource, databaseId, picker, viewId: view.id };
31
+ }
32
+ /** The current source's title, or "Untitled source". */
33
+ export function currentSourceTitle(std, dataSource) {
34
+ return (dataSource.schema$.value?.props.title.toString() ||
35
+ translateKey(std, ...DATABASE_ADD_VIEW_UNTITLED_SOURCE));
36
+ }
37
+ /**
38
+ * Pop the picker on this database's sources at `target`, its "back" reopening
39
+ * the view settings (`reopen`); a pick points the view at it. The picker's
40
+ * own items (`dataSourcePickerItems`, "New source" through `createSource`)
41
+ * under its own title, so it reads as the "+ view" picker does.
42
+ */
43
+ export function popChangeSourcePicker(std, target, change, reopen) {
44
+ const { dataSource, databaseId, picker, viewId } = change;
45
+ return popMenu(target, {
46
+ options: {
47
+ title: { text: translateKey(std, ...PICKER_TITLE), onBack: reopen },
48
+ testId: 'data-source-picker',
49
+ items: dataSourcePickerItems(std, picker, {
50
+ databaseId,
51
+ onPick: ({ sourceId, source }) => {
52
+ changeViewSource(dataSource, viewId, sourceId, source);
53
+ },
54
+ }),
55
+ },
56
+ });
57
+ }
58
+ /**
59
+ * The view settings' "Source" (`ViewSettingsMenuIdentifier`, registered by
60
+ * the tooling extension): one entry after "Layout", its postfix the current
61
+ * source's title. `undefined` where {@link changeSourceTarget} says no, so an
62
+ * inline database's settings stay the 0.61 menu.
63
+ */
64
+ export function databaseViewSettingsMenu() {
65
+ return {
66
+ items: ({ std, dataViewLogic, target, reopen, wording }) => {
67
+ const view = dataViewLogic.view;
68
+ const change = changeSourceTarget(std, view.manager.dataSource, view);
69
+ if (!change)
70
+ return;
71
+ return [
72
+ menu.action({
73
+ name: wording(VIEW_SETTINGS_SOURCE),
74
+ prefix: DatabaseTableViewIcon(),
75
+ postfix: html ` <div style="font-size: 14px;">
76
+ ${currentSourceTitle(std, change.dataSource)}
77
+ </div>
78
+ ${ArrowRightSmallIcon()}`,
79
+ testId: 'dv-view-setting-source',
80
+ select: () => {
81
+ popChangeSourcePicker(std, target, change, reopen);
82
+ },
83
+ }),
84
+ ];
85
+ },
86
+ };
87
+ }
@@ -0,0 +1,24 @@
1
+ import type { HostedDataSourceBase, HostedSource } from '@formicoidea/labre-core/blocks/database';
2
+ import type { DataSourcePickerProperty } from '@formicoidea/labre-core/shared/services';
3
+ /**
4
+ * Pointing a view at another source of its database (ADR 0035 amendment of
5
+ * 2026-10-28; Notion's "Source" in a view's settings): the view keeps its id,
6
+ * its name, its layout and every setting that still means something on the
7
+ * other source. What it reads is remapped with `remapView` through the
8
+ * correspondence a dialog would start from (`defaultMapping`: the same id,
9
+ * else the same name and type), so a property both sources share keeps its
10
+ * column, filter, sort and grouping under its new id, and one the target
11
+ * lacks leaves them. `openIn`, `colorRules` and any other key are carried
12
+ * as `remapView` carries them.
13
+ */
14
+ /** A source's schema block as a correspondence reads it (`props.columns`). */
15
+ export declare function schemaProperties(schema: HostedSource['schema']): DataSourcePickerProperty[];
16
+ /**
17
+ * Point view `viewId` of `dataSource` at `sourceId`, as one undo step, and
18
+ * report `DatabaseViewSourceChanged { source: added }` once. `false`, with
19
+ * nothing written, when the view already reads that source, the page is
20
+ * read-only (re-read here: a source created by the host took a round trip),
21
+ * the view is drawn through a fallback preset (its stored data belongs to a
22
+ * preset this client does not have) or `resolveSource` knows no such source.
23
+ */
24
+ export declare function changeViewSource(dataSource: HostedDataSourceBase, viewId: string, sourceId: string, added: 'existing' | 'new'): boolean;
@@ -0,0 +1,80 @@
1
+ import { DataViewEventTraceKey, } from '@formicoidea/labre-core/data-view';
2
+ import { propertyOptions, sourceProperties } from './import-view.js';
3
+ import { defaultMapping, remapView } from './remap-view.js';
4
+ /**
5
+ * Pointing a view at another source of its database (ADR 0035 amendment of
6
+ * 2026-10-28; Notion's "Source" in a view's settings): the view keeps its id,
7
+ * its name, its layout and every setting that still means something on the
8
+ * other source. What it reads is remapped with `remapView` through the
9
+ * correspondence a dialog would start from (`defaultMapping`: the same id,
10
+ * else the same name and type), so a property both sources share keeps its
11
+ * column, filter, sort and grouping under its new id, and one the target
12
+ * lacks leaves them. `openIn`, `colorRules` and any other key are carried
13
+ * as `remapView` carries them.
14
+ */
15
+ /** A source's schema block as a correspondence reads it (`props.columns`). */
16
+ export function schemaProperties(schema) {
17
+ return schema.props.columns.map(column => ({
18
+ id: column.id,
19
+ name: column.name,
20
+ type: column.type,
21
+ ...propertyOptions(column.data?.options),
22
+ }));
23
+ }
24
+ /** The keys `remapView` leaves to the caller: never cleared here. */
25
+ const CALLER_KEYS = new Set(['id', 'name', 'sourceId']);
26
+ /**
27
+ * Point view `viewId` of `dataSource` at `sourceId`, as one undo step, and
28
+ * report `DatabaseViewSourceChanged { source: added }` once. `false`, with
29
+ * nothing written, when the view already reads that source, the page is
30
+ * read-only (re-read here: a source created by the host took a round trip),
31
+ * the view is drawn through a fallback preset (its stored data belongs to a
32
+ * preset this client does not have) or `resolveSource` knows no such source.
33
+ */
34
+ export function changeViewSource(dataSource, viewId, sourceId, added) {
35
+ const view = dataSource.viewDataGet(viewId);
36
+ if (!view || view.sourceId === sourceId)
37
+ return false;
38
+ if (dataSource.readonly$.peek())
39
+ return false;
40
+ if (dataSource.viewManager.viewGet(viewId)?.shownAsFallback$.peek()) {
41
+ return false;
42
+ }
43
+ const target = dataSource.sourceOf(sourceId);
44
+ if (!target)
45
+ return false;
46
+ // The data source answers for the current view's source; another view's
47
+ // properties are its stored source's columns.
48
+ const storedSource = typeof view.sourceId === 'string' ? view.sourceId : undefined;
49
+ const fromSchema = viewId === dataSource.viewManager.currentViewId$.peek()
50
+ ? null
51
+ : dataSource.sourceOf(storedSource)?.schema;
52
+ const from = fromSchema
53
+ ? schemaProperties(fromSchema)
54
+ : sourceProperties(dataSource);
55
+ const to = schemaProperties(target.schema);
56
+ // A stored view is the block's reactive proxy, which `structuredClone`
57
+ // (inside `remapView`) refuses; its plain JSON is what the view stores.
58
+ const plain = JSON.parse(JSON.stringify(view));
59
+ const { data } = remapView(plain, from, to, defaultMapping(from, to));
60
+ // The block's `updateView` merges over the stored view: a key the remap
61
+ // removed (a grouping by a property the target lacks) is cleared with an
62
+ // own `undefined`, as the group trait's `groupBySet(undefined)` clears it.
63
+ const cleared = {};
64
+ for (const key of Object.keys(view)) {
65
+ if (!CALLER_KEYS.has(key) && !(key in data))
66
+ cleared[key] = undefined;
67
+ }
68
+ dataSource.hostModel.store.captureSync();
69
+ dataSource.viewDataUpdate(viewId, () => ({
70
+ ...cleared,
71
+ ...data,
72
+ sourceId,
73
+ }));
74
+ dataSource.serviceGet(DataViewEventTraceKey)?.('DatabaseViewSourceChanged', {
75
+ source: added,
76
+ viewId,
77
+ viewType: view.mode,
78
+ });
79
+ return true;
80
+ }
@@ -9,8 +9,12 @@ import { type DataSource } from '@formicoidea/labre-core/data-view';
9
9
  * reads and writes the views: the copy is a new view of this database, on
10
10
  * the current view's source, never a link.
11
11
  */
12
+ /** A property's select options as a correspondence reads them; none when it has no list. */
13
+ export declare function propertyOptions(options: unknown): Pick<DataSourcePickerProperty, 'options'>;
12
14
  /** The properties of the current view's source, as a correspondence reads them. */
13
15
  export declare function sourceProperties(dataSource: DataSource): DataSourcePickerProperty[];
16
+ /** The database a block shows, as the picker names it; none for an inline one. */
17
+ export declare function databaseIdOf(dataSource: DataSource): string | undefined;
14
18
  /** Whether the picker can import a view into this data source now. */
15
19
  export declare function canImportView(picker: DataSourcePickerService | null | undefined, dataSource: DataSource): boolean;
16
20
  /**
@@ -11,26 +11,27 @@ import { remapView, viewTemplateData } from './remap-view.js';
11
11
  * reads and writes the views: the copy is a new view of this database, on
12
12
  * the current view's source, never a link.
13
13
  */
14
+ /** A property's select options as a correspondence reads them; none when it has no list. */
15
+ export function propertyOptions(options) {
16
+ if (!Array.isArray(options))
17
+ return {};
18
+ return {
19
+ options: options.flatMap(option => typeof option?.id === 'string'
20
+ ? [{ id: option.id, value: String(option.value ?? '') }]
21
+ : []),
22
+ };
23
+ }
14
24
  /** The properties of the current view's source, as a correspondence reads them. */
15
25
  export function sourceProperties(dataSource) {
16
- return dataSource.properties$.peek().map(id => {
17
- const options = dataSource.propertyDataGet(id)?.options;
18
- return {
19
- id,
20
- name: dataSource.propertyNameGet(id),
21
- type: dataSource.propertyTypeGet(id) ?? '',
22
- ...(Array.isArray(options)
23
- ? {
24
- options: options.flatMap(option => typeof option?.id === 'string'
25
- ? [{ id: option.id, value: String(option.value ?? '') }]
26
- : []),
27
- }
28
- : {}),
29
- };
30
- });
26
+ return dataSource.properties$.peek().map(id => ({
27
+ id,
28
+ name: dataSource.propertyNameGet(id),
29
+ type: dataSource.propertyTypeGet(id) ?? '',
30
+ ...propertyOptions(dataSource.propertyDataGet(id)?.options),
31
+ }));
31
32
  }
32
33
  /** The database a block shows, as the picker names it; none for an inline one. */
33
- function databaseIdOf(dataSource) {
34
+ export function databaseIdOf(dataSource) {
34
35
  if (!(dataSource instanceof HostedDataSourceBase))
35
36
  return undefined;
36
37
  if (!dataSource.resolvesSources)
package/dist/view.d.ts CHANGED
@@ -15,8 +15,12 @@ export declare class DatabaseEditorViewExtension extends ViewExtensionProvider {
15
15
  /**
16
16
  * The database creation entries, under core's own `database` flag (ADR 0035
17
17
  * §4, §5): "+ view" with its source choice (B11), fed by the host's
18
- * data-source picker when there is one, and "Linked view of a database"
19
- * (B12), drawn only when the host fills the picker. No new flag key:
18
+ * data-source picker when there is one, "Linked view of a database"
19
+ * (B12), drawn only when the host fills the picker, the popover that
20
+ * core's "Table View" / "Kanban View" open over the database they insert
21
+ * when the host fills it, and the view settings' "Source", drawn only on a
22
+ * database whose views name their source, with the picker (ADR 0035
23
+ * amendment of 2026-10-28). No new flag key:
20
24
  * `{ database: false }` removes these with core's own creation tooling and
21
25
  * leaves every stored database rendering.
22
26
  */
@@ -24,6 +28,7 @@ export declare class DatabaseEditorToolingViewExtension extends ViewExtensionPro
24
28
  name: string;
25
29
  setup(context: ViewExtensionContext): void;
26
30
  }
31
+ export { databaseCreationMenu } from './creation-popover.js';
27
32
  export { type DataSourceChoice, dataSourcePickerItems, type DataSourcePickerOptions, popDataSourcePicker, } from './data-source-picker.js';
28
33
  export { DatabasePageHost } from './database-page/database-page.js';
29
34
  export { linkedViewSlashMenuConfig } from './linked-view-slash-menu.js';
package/dist/view.js CHANGED
@@ -1,10 +1,13 @@
1
1
  import { ViewExtensionProvider, } from '@formicoidea/labre-core/ext-loader';
2
+ import { DatabaseCreationMenuExtension } from '@formicoidea/labre-core/blocks/database';
2
3
  import { DataSourcePickerProvider } from '@formicoidea/labre-core/shared/services';
3
4
  import { SlashMenuConfigExtension } from '@formicoidea/labre-core/widgets/slash-menu';
4
- import { AddViewMenuExtension } from '@formicoidea/labre-core/data-view';
5
+ import { AddViewMenuExtension, ViewSettingsMenuExtension, } from '@formicoidea/labre-core/data-view';
6
+ import { databaseCreationMenu } from './creation-popover.js';
5
7
  import { effects } from './effects.js';
6
8
  import { linkedViewSlashMenuConfig } from './linked-view-slash-menu.js';
7
9
  import { addViewSourcePicker, databaseAddViewMenu, } from './view-bar/add-view-menu.js';
10
+ import { databaseViewSettingsMenu } from './view-settings/source-entry.js';
8
11
  /**
9
12
  * The database editing chrome a stored database shows whatever the flags say
10
13
  * (ADR 0035 §1, §4): the full-page database host (`<affine-database-page>`,
@@ -27,8 +30,12 @@ export class DatabaseEditorViewExtension extends ViewExtensionProvider {
27
30
  /**
28
31
  * The database creation entries, under core's own `database` flag (ADR 0035
29
32
  * §4, §5): "+ view" with its source choice (B11), fed by the host's
30
- * data-source picker when there is one, and "Linked view of a database"
31
- * (B12), drawn only when the host fills the picker. No new flag key:
33
+ * data-source picker when there is one, "Linked view of a database"
34
+ * (B12), drawn only when the host fills the picker, the popover that
35
+ * core's "Table View" / "Kanban View" open over the database they insert
36
+ * when the host fills it, and the view settings' "Source", drawn only on a
37
+ * database whose views name their source, with the picker (ADR 0035
38
+ * amendment of 2026-10-28). No new flag key:
32
39
  * `{ database: false }` removes these with core's own creation tooling and
33
40
  * leaves every stored database rendering.
34
41
  */
@@ -44,10 +51,13 @@ export class DatabaseEditorToolingViewExtension extends ViewExtensionProvider {
44
51
  const picker = std?.getOptional(DataSourcePickerProvider);
45
52
  return picker ? addViewSourcePicker(picker) : null;
46
53
  })),
54
+ ViewSettingsMenuExtension(databaseViewSettingsMenu()),
47
55
  SlashMenuConfigExtension('affine:database-linked-view', linkedViewSlashMenuConfig),
56
+ DatabaseCreationMenuExtension(databaseCreationMenu()),
48
57
  ]);
49
58
  }
50
59
  }
60
+ export { databaseCreationMenu } from './creation-popover.js';
51
61
  export { dataSourcePickerItems, popDataSourcePicker, } from './data-source-picker.js';
52
62
  export { DatabasePageHost } from './database-page/database-page.js';
53
63
  export { linkedViewSlashMenuConfig } from './linked-view-slash-menu.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formicoidea/labre-core-database",
3
3
  "description": "Labre core-database editing chrome for @formicoidea/labre-core.",
4
- "version": "0.61.0",
4
+ "version": "1.1.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "author": "lajola",
@@ -27,7 +27,7 @@
27
27
  "dist"
28
28
  ],
29
29
  "dependencies": {
30
- "@formicoidea/labre-core": "0.61.0",
30
+ "@formicoidea/labre-core": "1.1.0",
31
31
  "@blocksuite/icons": "^2.2.12",
32
32
  "@preact/signals-core": "^1.8.0",
33
33
  "lit": "^3.2.0"