@formicoidea/labre-core 0.47.1 → 0.49.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.
- package/dist/_pkgs/affine-block-data-view/configs/slash-menu.js +3 -1
- package/dist/_pkgs/affine-block-data-view/view.d.ts +17 -1
- package/dist/_pkgs/affine-block-data-view/view.js +21 -2
- package/dist/_pkgs/affine-block-database/commands.d.ts +2 -2
- package/dist/_pkgs/affine-block-database/commands.js +3 -3
- package/dist/_pkgs/affine-block-database/components/values-banner.d.ts +28 -0
- package/dist/_pkgs/affine-block-database/components/values-banner.js +199 -0
- package/dist/_pkgs/affine-block-database/configs/slash-menu.d.ts +6 -1
- package/dist/_pkgs/affine-block-database/configs/slash-menu.js +57 -70
- package/dist/_pkgs/affine-block-database/data-source.d.ts +9 -5
- package/dist/_pkgs/affine-block-database/data-source.js +11 -7
- package/dist/_pkgs/affine-block-database/database-block-styles.d.ts +2 -0
- package/dist/_pkgs/affine-block-database/database-block-styles.js +15 -0
- package/dist/_pkgs/affine-block-database/database-block.d.ts +23 -0
- package/dist/_pkgs/affine-block-database/database-block.js +141 -19
- package/dist/_pkgs/affine-block-database/effects.js +2 -0
- package/dist/_pkgs/affine-block-database/external-data-source.d.ts +69 -2
- package/dist/_pkgs/affine-block-database/external-data-source.js +88 -16
- package/dist/_pkgs/affine-block-database/index.d.ts +2 -0
- package/dist/_pkgs/affine-block-database/index.js +2 -0
- package/dist/_pkgs/affine-block-database/linked-view.d.ts +38 -0
- package/dist/_pkgs/affine-block-database/linked-view.js +109 -0
- package/dist/_pkgs/affine-block-database/properties/index.d.ts +2 -0
- package/dist/_pkgs/affine-block-database/properties/index.js +2 -0
- package/dist/_pkgs/affine-block-database/properties/text/hosted.d.ts +15 -0
- package/dist/_pkgs/affine-block-database/properties/text/hosted.js +24 -0
- package/dist/_pkgs/affine-block-database/properties/title/hosted.d.ts +16 -0
- package/dist/_pkgs/affine-block-database/properties/title/hosted.js +42 -0
- package/dist/_pkgs/affine-block-database/service/index.d.ts +3 -0
- package/dist/_pkgs/affine-block-database/service/index.js +3 -0
- package/dist/_pkgs/affine-block-database/service/new-row-menu.d.ts +49 -0
- package/dist/_pkgs/affine-block-database/service/new-row-menu.js +21 -0
- package/dist/_pkgs/affine-block-database/service/open-row.d.ts +77 -0
- package/dist/_pkgs/affine-block-database/service/open-row.js +62 -0
- package/dist/_pkgs/affine-block-database/service/properties-panel.d.ts +23 -0
- package/dist/_pkgs/affine-block-database/service/properties-panel.js +33 -0
- package/dist/_pkgs/affine-block-database/translations.d.ts +10 -0
- package/dist/_pkgs/affine-block-database/translations.js +35 -0
- package/dist/_pkgs/affine-block-database/view-creation.d.ts +10 -0
- package/dist/_pkgs/affine-block-database/view-creation.js +14 -0
- package/dist/_pkgs/affine-block-database/view.d.ts +31 -1
- package/dist/_pkgs/affine-block-database/view.js +48 -4
- package/dist/_pkgs/affine-block-database/views/index.d.ts +30 -3
- package/dist/_pkgs/affine-block-database/views/index.js +44 -3
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/new-doc.d.ts +25 -0
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/new-doc.js +71 -0
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/slash-menu.js +3 -11
- package/dist/_pkgs/affine-components/date-picker/date-picker.d.ts +20 -0
- package/dist/_pkgs/affine-components/date-picker/date-picker.js +60 -26
- package/dist/_pkgs/affine-components/date-picker/style.js +1 -0
- package/dist/_pkgs/affine-components/translations.d.ts +4 -0
- package/dist/_pkgs/affine-components/translations.js +26 -0
- package/dist/_pkgs/affine-fragment-doc-title/doc-title.d.ts +18 -0
- package/dist/_pkgs/affine-fragment-doc-title/doc-title.js +41 -2
- package/dist/_pkgs/affine-fragment-doc-title/index.d.ts +1 -1
- package/dist/_pkgs/affine-fragment-doc-title/index.js +1 -1
- package/dist/_pkgs/affine-fragment-doc-title/title-band/band-cell.d.ts +30 -0
- package/dist/_pkgs/affine-fragment-doc-title/title-band/band-cell.js +137 -0
- package/dist/_pkgs/affine-fragment-doc-title/title-band/format.d.ts +7 -19
- package/dist/_pkgs/affine-fragment-doc-title/title-band/format.js +0 -38
- package/dist/_pkgs/affine-fragment-doc-title/title-band/show-here.d.ts +19 -0
- package/dist/_pkgs/affine-fragment-doc-title/title-band/show-here.js +61 -0
- package/dist/_pkgs/affine-fragment-doc-title/title-band/title-band.d.ts +33 -18
- package/dist/_pkgs/affine-fragment-doc-title/title-band/title-band.js +263 -205
- package/dist/_pkgs/affine-fragment-doc-title/translations.d.ts +7 -4
- package/dist/_pkgs/affine-fragment-doc-title/translations.js +12 -9
- package/dist/_pkgs/affine-model/blocks/database/types.d.ts +16 -0
- package/dist/_pkgs/affine-model/blocks/database/types.js +5 -1
- package/dist/_pkgs/affine-shared/services/data-source-picker-service.d.ts +139 -0
- package/dist/_pkgs/affine-shared/services/data-source-picker-service.js +22 -0
- package/dist/_pkgs/affine-shared/services/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/services/index.js +1 -0
- package/dist/_pkgs/affine-shared/services/linked-doc-creation-service.d.ts +15 -6
- package/dist/_pkgs/affine-shared/services/telemetry-service/database.d.ts +59 -0
- package/dist/_pkgs/affine-shared/services/title-band-service.d.ts +34 -7
- package/dist/_pkgs/affine-shared/utils/model/doc.d.ts +10 -2
- package/dist/_pkgs/affine-shared/utils/model/doc.js +17 -7
- package/dist/_pkgs/data-view/core/component/cell-status/cell-status-css.d.ts +2 -0
- package/dist/_pkgs/data-view/core/component/cell-status/cell-status-css.js +16 -0
- package/dist/_pkgs/data-view/core/component/cell-status/cell-status.d.ts +10 -0
- package/dist/_pkgs/data-view/core/component/cell-status/cell-status.js +23 -0
- package/dist/_pkgs/data-view/core/component/index.d.ts +1 -0
- package/dist/_pkgs/data-view/core/component/index.js +1 -0
- package/dist/_pkgs/data-view/core/component/overflow/fit.d.ts +26 -0
- package/dist/_pkgs/data-view/core/component/overflow/fit.js +48 -0
- package/dist/_pkgs/data-view/core/component/overflow/overflow.d.ts +26 -3
- package/dist/_pkgs/data-view/core/component/overflow/overflow.js +84 -31
- package/dist/_pkgs/data-view/core/component/tags/colors.d.ts +7 -0
- package/dist/_pkgs/data-view/core/component/tags/colors.js +22 -10
- package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.d.ts +25 -2
- package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.js +81 -32
- package/dist/_pkgs/data-view/core/data-source/base.d.ts +5 -1
- package/dist/_pkgs/data-view/core/data-source/base.js +7 -1
- package/dist/_pkgs/data-view/core/data-source/hydration.d.ts +44 -0
- package/dist/_pkgs/data-view/core/data-source/hydration.js +31 -0
- package/dist/_pkgs/data-view/core/data-source/index.d.ts +1 -0
- package/dist/_pkgs/data-view/core/data-source/index.js +1 -0
- package/dist/_pkgs/data-view/core/data-view.d.ts +22 -2
- package/dist/_pkgs/data-view/core/data-view.js +14 -0
- package/dist/_pkgs/data-view/core/effect.js +4 -0
- package/dist/_pkgs/data-view/core/group-by/collapsed-state.d.ts +3 -0
- package/dist/_pkgs/data-view/core/group-by/collapsed-state.js +59 -0
- package/dist/_pkgs/data-view/core/group-by/group-properties.d.ts +21 -0
- package/dist/_pkgs/data-view/core/group-by/group-properties.js +38 -0
- package/dist/_pkgs/data-view/core/group-by/group-title.js +4 -0
- package/dist/_pkgs/data-view/core/group-by/group-visibility.d.ts +40 -0
- package/dist/_pkgs/data-view/core/group-by/group-visibility.js +291 -0
- package/dist/_pkgs/data-view/core/group-by/setting.d.ts +11 -3
- package/dist/_pkgs/data-view/core/group-by/setting.js +81 -8
- package/dist/_pkgs/data-view/core/group-by/trait.d.ts +22 -0
- package/dist/_pkgs/data-view/core/group-by/trait.js +62 -1
- package/dist/_pkgs/data-view/core/index.d.ts +3 -0
- package/dist/_pkgs/data-view/core/index.js +3 -0
- package/dist/_pkgs/data-view/core/property/base-cell.d.ts +15 -1
- package/dist/_pkgs/data-view/core/property/base-cell.js +28 -3
- package/dist/_pkgs/data-view/core/property/index.d.ts +1 -0
- package/dist/_pkgs/data-view/core/property/index.js +1 -0
- package/dist/_pkgs/data-view/core/property/standalone-cell.d.ts +109 -0
- package/dist/_pkgs/data-view/core/property/standalone-cell.js +324 -0
- package/dist/_pkgs/data-view/core/telemetry.d.ts +16 -0
- package/dist/_pkgs/data-view/core/telemetry.js +22 -0
- package/dist/_pkgs/data-view/core/utils/new-tab-click.d.ts +2 -0
- package/dist/_pkgs/data-view/core/utils/new-tab-click.js +4 -0
- package/dist/_pkgs/data-view/core/utils/wording.d.ts +11 -0
- package/dist/_pkgs/data-view/core/utils/wording.js +9 -0
- package/dist/_pkgs/data-view/core/view/data-view.d.ts +7 -0
- package/dist/_pkgs/data-view/core/view/default-name.d.ts +10 -0
- package/dist/_pkgs/data-view/core/view/default-name.js +14 -0
- package/dist/_pkgs/data-view/core/view/index.d.ts +2 -0
- package/dist/_pkgs/data-view/core/view/index.js +2 -0
- package/dist/_pkgs/data-view/core/view/open-in.d.ts +27 -0
- package/dist/_pkgs/data-view/core/view/open-in.js +39 -0
- package/dist/_pkgs/data-view/core/view-manager/cell.d.ts +5 -0
- package/dist/_pkgs/data-view/core/view-manager/cell.js +11 -0
- package/dist/_pkgs/data-view/core/view-manager/index.d.ts +3 -0
- package/dist/_pkgs/data-view/core/view-manager/index.js +3 -0
- package/dist/_pkgs/data-view/core/view-manager/new-row-menu-opener.d.ts +18 -0
- package/dist/_pkgs/data-view/core/view-manager/new-row-menu-opener.js +2 -0
- package/dist/_pkgs/data-view/core/view-manager/properties-panel-opener.d.ts +8 -0
- package/dist/_pkgs/data-view/core/view-manager/properties-panel-opener.js +9 -0
- package/dist/_pkgs/data-view/core/view-manager/property.d.ts +14 -0
- package/dist/_pkgs/data-view/core/view-manager/single-view.d.ts +28 -1
- package/dist/_pkgs/data-view/core/view-manager/single-view.js +45 -1
- package/dist/_pkgs/data-view/core/view-manager/view-creation.d.ts +49 -0
- package/dist/_pkgs/data-view/core/view-manager/view-creation.js +40 -0
- package/dist/_pkgs/data-view/core/view-manager/view-manager.d.ts +6 -2
- package/dist/_pkgs/data-view/core/view-manager/view-manager.js +2 -2
- package/dist/_pkgs/data-view/property-presets/date/cell-renderer.d.ts +2 -0
- package/dist/_pkgs/data-view/property-presets/date/cell-renderer.js +11 -2
- package/dist/_pkgs/data-view/property-presets/multi-select/cell-renderer.js +3 -1
- package/dist/_pkgs/data-view/property-presets/select/cell-renderer.js +3 -1
- package/dist/_pkgs/data-view/property-presets/text/cell-renderer.js +3 -1
- package/dist/_pkgs/data-view/translations.d.ts +55 -0
- package/dist/_pkgs/data-view/translations.js +181 -0
- package/dist/_pkgs/data-view/view-presets/calendar/define.js +3 -1
- package/dist/_pkgs/data-view/view-presets/convert.js +2 -0
- package/dist/_pkgs/data-view/view-presets/effect.js +4 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-converts.d.ts +2 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-converts.js +35 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-view-manager.d.ts +79 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-view-manager.js +194 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-view-ui.d.ts +56 -0
- package/dist/_pkgs/data-view/view-presets/flat/flat-view-ui.js +266 -0
- package/dist/_pkgs/data-view/view-presets/gallery/define.d.ts +14 -0
- package/dist/_pkgs/data-view/view-presets/gallery/define.js +15 -0
- package/dist/_pkgs/data-view/view-presets/gallery/effect.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/gallery/effect.js +4 -0
- package/dist/_pkgs/data-view/view-presets/gallery/gallery-view.d.ts +27 -0
- package/dist/_pkgs/data-view/view-presets/gallery/gallery-view.js +179 -0
- package/dist/_pkgs/data-view/view-presets/gallery/index.d.ts +2 -0
- package/dist/_pkgs/data-view/view-presets/gallery/index.js +2 -0
- package/dist/_pkgs/data-view/view-presets/gallery/renderer.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/gallery/renderer.js +11 -0
- package/dist/_pkgs/data-view/view-presets/index.d.ts +5 -0
- package/dist/_pkgs/data-view/view-presets/index.js +7 -0
- package/dist/_pkgs/data-view/view-presets/kanban/define.js +3 -1
- package/dist/_pkgs/data-view/view-presets/kanban/kanban-view-manager.js +5 -53
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/card.js +8 -1
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/cell.js +6 -1
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/group.d.ts +4 -2
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/group.js +52 -6
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/kanban-view-ui-logic.js +5 -1
- package/dist/_pkgs/data-view/view-presets/kanban/pc/card.js +2 -0
- package/dist/_pkgs/data-view/view-presets/kanban/pc/cell.js +4 -0
- package/dist/_pkgs/data-view/view-presets/kanban/pc/group.d.ts +4 -2
- package/dist/_pkgs/data-view/view-presets/kanban/pc/group.js +51 -6
- package/dist/_pkgs/data-view/view-presets/kanban/pc/kanban-view-ui-logic.js +5 -1
- package/dist/_pkgs/data-view/view-presets/list/define.d.ts +14 -0
- package/dist/_pkgs/data-view/view-presets/list/define.js +15 -0
- package/dist/_pkgs/data-view/view-presets/list/effect.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/list/effect.js +4 -0
- package/dist/_pkgs/data-view/view-presets/list/index.d.ts +2 -0
- package/dist/_pkgs/data-view/view-presets/list/index.js +2 -0
- package/dist/_pkgs/data-view/view-presets/list/list-view.d.ts +24 -0
- package/dist/_pkgs/data-view/view-presets/list/list-view.js +194 -0
- package/dist/_pkgs/data-view/view-presets/list/renderer.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/list/renderer.js +11 -0
- package/dist/_pkgs/data-view/view-presets/table/collapsed-state.d.ts +3 -14
- package/dist/_pkgs/data-view/view-presets/table/collapsed-state.js +6 -30
- package/dist/_pkgs/data-view/view-presets/table/consts.d.ts +2 -0
- package/dist/_pkgs/data-view/view-presets/table/consts.js +2 -0
- package/dist/_pkgs/data-view/view-presets/table/define.js +3 -1
- package/dist/_pkgs/data-view/view-presets/table/mobile/cell.js +4 -1
- package/dist/_pkgs/data-view/view-presets/table/mobile/column-header.js +2 -2
- package/dist/_pkgs/data-view/view-presets/table/mobile/group.d.ts +3 -1
- package/dist/_pkgs/data-view/view-presets/table/mobile/group.js +20 -5
- package/dist/_pkgs/data-view/view-presets/table/mobile/row.js +10 -2
- package/dist/_pkgs/data-view/view-presets/table/mobile/table-view-ui-logic.js +4 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/cell.js +4 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/controller/hotkeys.js +1 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/group.d.ts +3 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/group.js +20 -5
- package/dist/_pkgs/data-view/view-presets/table/pc/menu.d.ts +1 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/menu.js +2 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/row/row.js +3 -2
- package/dist/_pkgs/data-view/view-presets/table/pc/table-view-ui-logic.js +4 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/hotkeys.js +1 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/bottom/stats/column-stats-column.js +5 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/group-title.js +22 -19
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/row/cell.js +4 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/table-view-ui-logic.js +7 -2
- package/dist/_pkgs/data-view/view-presets/table/stats/column-stats-column.js +5 -1
- package/dist/_pkgs/data-view/view-presets/table/table-view-manager.js +5 -53
- package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.d.ts +1 -0
- package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.js +60 -2
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.d.ts +18 -1
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.js +121 -124
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.d.ts +43 -0
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.js +187 -0
- package/dist/_pkgs/data-view/widget-presets/views-bar/views-view.d.ts +36 -3
- package/dist/_pkgs/data-view/widget-presets/views-bar/views-view.js +187 -59
- package/dist/extensions/view.d.ts +2 -2
- package/dist/extensions/view.js +10 -3
- package/dist/flags.d.ts +8 -4
- package/dist/flags.js +8 -4
- package/dist/frameworks.d.ts +27 -0
- package/dist/frameworks.js +28 -0
- package/dist/translations.js +13 -1
- package/package.json +5 -1
|
@@ -1,34 +1,78 @@
|
|
|
1
1
|
import { ViewExtensionProvider, } from '../affine-ext-loader/index.js';
|
|
2
2
|
import { DatabaseBlockModel } from '../affine-model/index.js';
|
|
3
3
|
import { SlashMenuConfigExtension } from '../affine-widget-slash-menu/index.js';
|
|
4
|
+
import { StandaloneCellMetaExtension } from '../data-view/index.js';
|
|
4
5
|
import { BlockViewExtension, FlavourExtension } from '../std/index.js';
|
|
5
6
|
import { literal } from 'lit/static-html.js';
|
|
6
7
|
import { z } from 'zod';
|
|
7
8
|
import { DatabaseConfigExtension } from './config.js';
|
|
8
9
|
import { databaseSlashMenuConfig } from './configs/slash-menu.js';
|
|
9
10
|
import { effects } from './effects.js';
|
|
11
|
+
import { linkColumnConfig } from './properties/link/cell-renderer.js';
|
|
12
|
+
import { DatabaseViewCreationExtension } from './view-creation.js';
|
|
10
13
|
const optionsSchema = z.object({
|
|
11
14
|
configure: z
|
|
12
15
|
.function()
|
|
13
16
|
.args(z.instanceof(DatabaseBlockModel), z.custom())
|
|
14
17
|
.returns(z.custom()),
|
|
15
18
|
});
|
|
16
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Database rendering — ALWAYS registered, independent of the `database` and
|
|
21
|
+
* `data-view` flags (ADR 0009, ADR 0035 §5, issue B4). A document that holds a
|
|
22
|
+
* database must show it, let its cells be edited and its rows be opened
|
|
23
|
+
* whatever the flags say: until 0.48 the whole view sat behind `database`, and
|
|
24
|
+
* `{ database: false }` left every stored database rendered as nothing.
|
|
25
|
+
*
|
|
26
|
+
* What lives here is what an EXISTING database needs, the mirror of
|
|
27
|
+
* `CalloutRenderViewExtension`:
|
|
28
|
+
* - `effects()` whole: every element it defines draws a stored database (the
|
|
29
|
+
* block, its title, the cells, the row detail and its peek);
|
|
30
|
+
* - the flavour and the block view, the lookup `lit-host` performs; the block
|
|
31
|
+
* brings the presets, the cells and the row opening with it;
|
|
32
|
+
* - the link cell for the title band (ADR 0035 §11): a `link` value already
|
|
33
|
+
* stored on a page is drawn with it.
|
|
34
|
+
*/
|
|
35
|
+
export class DatabaseRenderViewExtension extends ViewExtensionProvider {
|
|
17
36
|
constructor() {
|
|
18
37
|
super(...arguments);
|
|
19
|
-
this.name = 'affine-database-block';
|
|
20
|
-
this.schema = optionsSchema;
|
|
38
|
+
this.name = 'affine-database-render-block';
|
|
21
39
|
}
|
|
22
40
|
effect() {
|
|
23
41
|
super.effect();
|
|
24
42
|
effects();
|
|
25
43
|
}
|
|
26
|
-
setup(context
|
|
44
|
+
setup(context) {
|
|
27
45
|
super.setup(context);
|
|
28
46
|
context.register([
|
|
29
47
|
FlavourExtension('affine:database'),
|
|
30
48
|
BlockViewExtension('affine:database', literal `affine-database`),
|
|
49
|
+
// The title band draws a `link` / `url` property with the table's link
|
|
50
|
+
// cell; it sits below this package and cannot import it (ADR 0035 §11).
|
|
51
|
+
StandaloneCellMetaExtension(linkColumnConfig),
|
|
52
|
+
]);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Database creation tooling — flag-gated (`database`, ADR 0009, ADR 0035 §5):
|
|
57
|
+
* the slash-menu entries that insert a database, the "+ view" of a rendered
|
|
58
|
+
* one (`DatabaseViewCreationIdentifier`, `./view-creation.ts`), and the host's additions to
|
|
59
|
+
* the block's "⋯" menu (`configure`, kept on this class so a host's
|
|
60
|
+
* `viewManager.configure(DatabaseViewExtension, …)` still compiles and its
|
|
61
|
+
* entries follow the flag). With the flag off no database and no view can be
|
|
62
|
+
* made; the stored ones keep rendering through
|
|
63
|
+
* {@link DatabaseRenderViewExtension}.
|
|
64
|
+
*/
|
|
65
|
+
export class DatabaseViewExtension extends ViewExtensionProvider {
|
|
66
|
+
constructor() {
|
|
67
|
+
super(...arguments);
|
|
68
|
+
this.name = 'affine-database-block';
|
|
69
|
+
this.schema = optionsSchema;
|
|
70
|
+
}
|
|
71
|
+
setup(context, options) {
|
|
72
|
+
super.setup(context);
|
|
73
|
+
context.register([
|
|
31
74
|
SlashMenuConfigExtension('affine:database', databaseSlashMenuConfig),
|
|
75
|
+
DatabaseViewCreationExtension,
|
|
32
76
|
]);
|
|
33
77
|
if (options) {
|
|
34
78
|
context.register(DatabaseConfigExtension({ configure: options.configure }));
|
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
import type { ViewMeta } from '../../data-view/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Every preset a stored `affine:database` view can be drawn with (ADR 0035
|
|
4
|
+
* §6). Calendar stays here: calendar views were creatable until 0.48, so
|
|
5
|
+
* documents hold them, and a stored calendar keeps rendering and editing as a
|
|
6
|
+
* calendar. Never shrink this list: a mode that leaves it falls back to a
|
|
7
|
+
* table on every document that stores it.
|
|
8
|
+
*/
|
|
9
|
+
export declare const databaseBlockRenderableViews: ViewMeta[];
|
|
10
|
+
/**
|
|
11
|
+
* The presets a user can CREATE, a subset of the renderable ones: what the
|
|
12
|
+
* data source answers as `viewMetas`, so the views bar ("+", "Create …") and
|
|
13
|
+
* the Layout switch list only these. Calendar left it after 0.48 (ADR 0035 §6,
|
|
14
|
+
* labre ADR-0046 §8): no new calendar, the stored ones still render.
|
|
15
|
+
*/
|
|
2
16
|
export declare const databaseBlockViews: ViewMeta[];
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
17
|
+
/** The preset a mode with none of its own is drawn with. */
|
|
18
|
+
export declare const databaseBlockFallbackView: ViewMeta;
|
|
19
|
+
export declare const databaseBlockViewMap: Record<string, ViewMeta | undefined>;
|
|
20
|
+
/**
|
|
21
|
+
* The preset that draws a stored `mode`. Never throws: a mode this client has
|
|
22
|
+
* no preset for (a `timeline`, a newer client's view, an import) is drawn as a
|
|
23
|
+
* table over the source's properties, and its stored data stays as it is
|
|
24
|
+
* (`SingleView.shownAsFallback$`). Up to 0.48 it threw `Unknown view type`
|
|
25
|
+
* and the whole database rendered nothing.
|
|
26
|
+
*/
|
|
27
|
+
export declare function databaseBlockViewMetaGet(mode: string): ViewMeta;
|
|
28
|
+
/**
|
|
29
|
+
* Conversions INTO a creatable preset only: switching a view's layout to
|
|
30
|
+
* calendar would create a calendar. The conversions out of calendar stay, so a
|
|
31
|
+
* stored calendar can still become a table or a board.
|
|
32
|
+
*/
|
|
6
33
|
export declare const databaseBlockViewConverts: import("../index.js").ViewConvertConfig[];
|
|
@@ -1,8 +1,49 @@
|
|
|
1
1
|
import { viewConverts, viewPresets } from '../../data-view/view-presets/index.js';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Every preset a stored `affine:database` view can be drawn with (ADR 0035
|
|
4
|
+
* §6). Calendar stays here: calendar views were creatable until 0.48, so
|
|
5
|
+
* documents hold them, and a stored calendar keeps rendering and editing as a
|
|
6
|
+
* calendar. Never shrink this list: a mode that leaves it falls back to a
|
|
7
|
+
* table on every document that stores it.
|
|
8
|
+
*/
|
|
9
|
+
export const databaseBlockRenderableViews = [
|
|
3
10
|
viewPresets.tableViewMeta,
|
|
4
11
|
viewPresets.kanbanViewMeta,
|
|
5
12
|
viewPresets.calendarViewMeta,
|
|
13
|
+
viewPresets.galleryViewMeta,
|
|
14
|
+
viewPresets.listViewMeta,
|
|
15
|
+
];
|
|
16
|
+
/**
|
|
17
|
+
* The presets a user can CREATE, a subset of the renderable ones: what the
|
|
18
|
+
* data source answers as `viewMetas`, so the views bar ("+", "Create …") and
|
|
19
|
+
* the Layout switch list only these. Calendar left it after 0.48 (ADR 0035 §6,
|
|
20
|
+
* labre ADR-0046 §8): no new calendar, the stored ones still render.
|
|
21
|
+
*/
|
|
22
|
+
export const databaseBlockViews = [
|
|
23
|
+
viewPresets.tableViewMeta,
|
|
24
|
+
viewPresets.kanbanViewMeta,
|
|
25
|
+
viewPresets.galleryViewMeta,
|
|
26
|
+
viewPresets.listViewMeta,
|
|
6
27
|
];
|
|
7
|
-
|
|
8
|
-
export const
|
|
28
|
+
/** The preset a mode with none of its own is drawn with. */
|
|
29
|
+
export const databaseBlockFallbackView = viewPresets.tableViewMeta;
|
|
30
|
+
// No prototype: a stored mode is any string, and `'constructor'` or
|
|
31
|
+
// `'__proto__'` must find no preset rather than Object's own members.
|
|
32
|
+
export const databaseBlockViewMap = Object.assign(Object.create(null), Object.fromEntries(databaseBlockRenderableViews.map(v => [v.type, v])));
|
|
33
|
+
/**
|
|
34
|
+
* The preset that draws a stored `mode`. Never throws: a mode this client has
|
|
35
|
+
* no preset for (a `timeline`, a newer client's view, an import) is drawn as a
|
|
36
|
+
* table over the source's properties, and its stored data stays as it is
|
|
37
|
+
* (`SingleView.shownAsFallback$`). Up to 0.48 it threw `Unknown view type`
|
|
38
|
+
* and the whole database rendered nothing.
|
|
39
|
+
*/
|
|
40
|
+
export function databaseBlockViewMetaGet(mode) {
|
|
41
|
+
return databaseBlockViewMap[mode] ?? databaseBlockFallbackView;
|
|
42
|
+
}
|
|
43
|
+
const creatableModes = new Set(databaseBlockViews.map(view => view.type));
|
|
44
|
+
/**
|
|
45
|
+
* Conversions INTO a creatable preset only: switching a view's layout to
|
|
46
|
+
* calendar would create a calendar. The conversions out of calendar stay, so a
|
|
47
|
+
* stored calendar can still become a table or a board.
|
|
48
|
+
*/
|
|
49
|
+
export const databaseBlockViewConverts = viewConverts.filter(convert => creatableModes.has(convert.to));
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { BlockStdScope } from '../../../std/index.js';
|
|
2
|
+
import type { BlockModel } from '../../../store/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Whether the slash menu offers "New Page" here: the card's schema is
|
|
5
|
+
* registered, and the host, if it creates docs, does not refuse it on this
|
|
6
|
+
* editor (`LinkedDocCreationProvider.canCreateLinkedDoc`).
|
|
7
|
+
*/
|
|
8
|
+
export declare function canCreateDocHere(std: BlockStdScope, model: BlockModel): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* The slash menu's "New Page": creates a page and leaves a CARD of it
|
|
11
|
+
* (`affine:embed-linked-doc`) right after the block the gesture was typed in.
|
|
12
|
+
* A paragraph the gesture left empty is replaced by the card, as Notion turns
|
|
13
|
+
* the line into the page. A card shows a child where its parent places it; an
|
|
14
|
+
* inline mention is only a reference (Labre ADR-0045 §9, host side).
|
|
15
|
+
*
|
|
16
|
+
* The page comes from the host's `LinkedDocCreationProvider` when there is
|
|
17
|
+
* one (the host persists it, registers it, decides its parent), else from the
|
|
18
|
+
* workspace (`createDefaultDoc`, the playground and standalone editors).
|
|
19
|
+
*
|
|
20
|
+
* One undo step for the card and the removed line. When no card can go there
|
|
21
|
+
* (a parent whose schema refuses it, an edgeless text for one), the gesture
|
|
22
|
+
* falls back on the inline mention it used to leave, so it always yields a way
|
|
23
|
+
* to the page. Returns the new page's id, or null on a read-only store.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createDocFromSlash(std: BlockStdScope, model: BlockModel): string | null;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { insertContent } from '../../../affine-rich-text/index.js';
|
|
2
|
+
import { REFERENCE_NODE } from '../../../affine-shared/consts/index.js';
|
|
3
|
+
import { LinkedDocCreationProvider, TelemetryProvider, } from '../../../affine-shared/services/index.js';
|
|
4
|
+
import { createDefaultDoc, writeDefaultDocBlocks, } from '../../../affine-shared/utils/index.js';
|
|
5
|
+
const LINKED_DOC = 'affine:embed-linked-doc';
|
|
6
|
+
/**
|
|
7
|
+
* Whether the slash menu offers "New Page" here: the card's schema is
|
|
8
|
+
* registered, and the host, if it creates docs, does not refuse it on this
|
|
9
|
+
* editor (`LinkedDocCreationProvider.canCreateLinkedDoc`).
|
|
10
|
+
*/
|
|
11
|
+
export function canCreateDocHere(std, model) {
|
|
12
|
+
if (!model.store.schema.flavourSchemaMap.has(LINKED_DOC))
|
|
13
|
+
return false;
|
|
14
|
+
const creation = std.getOptional(LinkedDocCreationProvider);
|
|
15
|
+
return creation?.canCreateLinkedDoc?.(std.host) ?? true;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The slash menu's "New Page": creates a page and leaves a CARD of it
|
|
19
|
+
* (`affine:embed-linked-doc`) right after the block the gesture was typed in.
|
|
20
|
+
* A paragraph the gesture left empty is replaced by the card, as Notion turns
|
|
21
|
+
* the line into the page. A card shows a child where its parent places it; an
|
|
22
|
+
* inline mention is only a reference (Labre ADR-0045 §9, host side).
|
|
23
|
+
*
|
|
24
|
+
* The page comes from the host's `LinkedDocCreationProvider` when there is
|
|
25
|
+
* one (the host persists it, registers it, decides its parent), else from the
|
|
26
|
+
* workspace (`createDefaultDoc`, the playground and standalone editors).
|
|
27
|
+
*
|
|
28
|
+
* One undo step for the card and the removed line. When no card can go there
|
|
29
|
+
* (a parent whose schema refuses it, an edgeless text for one), the gesture
|
|
30
|
+
* falls back on the inline mention it used to leave, so it always yields a way
|
|
31
|
+
* to the page. Returns the new page's id, or null on a read-only store.
|
|
32
|
+
*/
|
|
33
|
+
export function createDocFromSlash(std, model) {
|
|
34
|
+
const { store } = std;
|
|
35
|
+
if (store.readonly)
|
|
36
|
+
return null;
|
|
37
|
+
const pageId = createNewDoc(std).id;
|
|
38
|
+
store.captureSync();
|
|
39
|
+
if (insertCard(store, model, pageId)) {
|
|
40
|
+
std.getOptional(TelemetryProvider)?.track('BlockCreated', {
|
|
41
|
+
blockType: LINKED_DOC,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
insertContent(std, model, REFERENCE_NODE, {
|
|
46
|
+
reference: { type: 'LinkedPage', pageId },
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return pageId;
|
|
50
|
+
}
|
|
51
|
+
function createNewDoc(std) {
|
|
52
|
+
const creation = std.getOptional(LinkedDocCreationProvider);
|
|
53
|
+
if (!creation)
|
|
54
|
+
return createDefaultDoc(std.store.workspace);
|
|
55
|
+
const doc = creation.createLinkedDoc(std.host, '');
|
|
56
|
+
doc.load(() => writeDefaultDocBlocks(doc));
|
|
57
|
+
// The new page's first undo must not empty it (as in `createDefaultDoc`).
|
|
58
|
+
doc.resetHistory();
|
|
59
|
+
return doc;
|
|
60
|
+
}
|
|
61
|
+
function insertCard(store, anchor, pageId) {
|
|
62
|
+
const parent = store.getParent(anchor);
|
|
63
|
+
if (!parent || !store.schema.isValid(LINKED_DOC, parent.flavour)) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const cardId = store.addBlock(LINKED_DOC, { pageId }, parent, parent.children.indexOf(anchor) + 1);
|
|
67
|
+
if (anchor.flavour === 'affine:paragraph' && anchor.text?.length === 0) {
|
|
68
|
+
store.deleteBlock(anchor);
|
|
69
|
+
}
|
|
70
|
+
return cardId;
|
|
71
|
+
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { EmbedLinkedDocBlockSchema } from '../../../affine-model/index.js';
|
|
2
|
-
import { insertContent } from '../../../affine-rich-text/index.js';
|
|
3
|
-
import { REFERENCE_NODE } from '../../../affine-shared/consts/index.js';
|
|
4
|
-
import { createDefaultDoc } from '../../../affine-shared/utils/index.js';
|
|
5
2
|
import { SlashMenuConfigIdentifier, } from '../../../affine-widget-slash-menu/index.js';
|
|
6
3
|
import { LinkedPageIcon, PlusIcon } from '@blocksuite/icons/lit';
|
|
7
4
|
import {} from '../../../store/index.js';
|
|
8
5
|
import { EMBED_DOC_SLASH_LINKED_DOC_CAPTION, EMBED_DOC_SLASH_LINKED_DOC_DESCRIPTION, EMBED_DOC_SLASH_LINKED_DOC_NAME, EMBED_DOC_SLASH_NEW_DOC_DESCRIPTION, EMBED_DOC_SLASH_NEW_DOC_NAME, } from '../../translations.js';
|
|
6
|
+
import { canCreateDocHere, createDocFromSlash } from './new-doc.js';
|
|
9
7
|
import { LinkDocTooltip, NewDocTooltip } from './tooltips.js';
|
|
10
8
|
const linkedDocSlashMenuConfig = {
|
|
11
9
|
items: [
|
|
@@ -21,15 +19,9 @@ const linkedDocSlashMenuConfig = {
|
|
|
21
19
|
captionWording: EMBED_DOC_SLASH_NEW_DOC_NAME,
|
|
22
20
|
},
|
|
23
21
|
group: '3_Page@0',
|
|
24
|
-
when: ({ model }) => model
|
|
22
|
+
when: ({ std, model }) => canCreateDocHere(std, model),
|
|
25
23
|
action: ({ std, model }) => {
|
|
26
|
-
|
|
27
|
-
insertContent(std, model, REFERENCE_NODE, {
|
|
28
|
-
reference: {
|
|
29
|
-
type: 'LinkedPage',
|
|
30
|
-
pageId: newDoc.id,
|
|
31
|
-
},
|
|
32
|
-
});
|
|
24
|
+
createDocFromSlash(std, model);
|
|
33
25
|
},
|
|
34
26
|
},
|
|
35
27
|
{
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
import type { ChromeWording } from '../../affine-shared/services/index.js';
|
|
1
2
|
import { LitElement, type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
+
/**
|
|
4
|
+
* The week header, Sunday first, in two letters: `Intl` short weekdays cut to
|
|
5
|
+
* two (`Su Mo…` in `en-US`, `Di Lu…` in `fr`), so the default reads as it
|
|
6
|
+
* did before the names came from `Intl`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function weekdayLabels(locale: string): string[];
|
|
9
|
+
/** The month names of the header and the month grid (`Jan…` in `en-US`). */
|
|
10
|
+
export declare function monthLabels(locale: string): string[];
|
|
2
11
|
export interface DateCell {
|
|
3
12
|
date: Date;
|
|
4
13
|
label: string;
|
|
@@ -95,6 +104,17 @@ export declare class DatePicker extends DatePicker_base {
|
|
|
95
104
|
accessor size: number;
|
|
96
105
|
/** Checked date timestamp */
|
|
97
106
|
accessor value: number | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* The BCP-47 locale of the day and month names (`formatLocale(std)` at the
|
|
109
|
+
* caller). `en-US` by default, which reads as the picker always did.
|
|
110
|
+
*/
|
|
111
|
+
accessor locale: string;
|
|
112
|
+
/**
|
|
113
|
+
* Resolves the picker's own wordings: it renders in a popup, outside the
|
|
114
|
+
* editor, so its caller holds the catalogue. Absent, English.
|
|
115
|
+
*/
|
|
116
|
+
accessor wording: ((wording: ChromeWording) => string) | undefined;
|
|
117
|
+
private say;
|
|
98
118
|
}
|
|
99
119
|
declare global {
|
|
100
120
|
interface HTMLElementTagNameMap {
|
|
@@ -39,24 +39,29 @@ import { html, LitElement, nothing, } from 'lit';
|
|
|
39
39
|
import { property } from 'lit/decorators.js';
|
|
40
40
|
import { classMap } from 'lit/directives/class-map.js';
|
|
41
41
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
42
|
+
import { DATE_PICKER_CLEAR, DATE_PICKER_NEXT, DATE_PICKER_PREVIOUS, DATE_PICKER_TODAY, } from '../translations.js';
|
|
42
43
|
import { arrowLeftIcon } from './icons.js';
|
|
43
44
|
import { datePickerStyle } from './style.js';
|
|
44
45
|
import { getMonthMatrix, toDate } from './utils.js';
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
'
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
/**
|
|
47
|
+
* The week header, Sunday first, in two letters: `Intl` short weekdays cut to
|
|
48
|
+
* two (`Su Mo…` in `en-US`, `Di Lu…` in `fr`), so the default reads as it
|
|
49
|
+
* did before the names came from `Intl`.
|
|
50
|
+
*/
|
|
51
|
+
export function weekdayLabels(locale) {
|
|
52
|
+
const format = new Intl.DateTimeFormat(locale, { weekday: 'short' });
|
|
53
|
+
// 2023-01-01 is a Sunday.
|
|
54
|
+
return Array.from({ length: 7 }, (_, i) => {
|
|
55
|
+
const name = format.format(new Date(2023, 0, 1 + i)).slice(0, 2);
|
|
56
|
+
return name.charAt(0).toLocaleUpperCase(locale) + name.slice(1);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/** The month names of the header and the month grid (`Jan…` in `en-US`). */
|
|
60
|
+
export function monthLabels(locale) {
|
|
61
|
+
const format = new Intl.DateTimeFormat(locale, { month: 'short' });
|
|
62
|
+
return Array.from({ length: 12 }, (_, i) => format.format(new Date(2023, i, 1)));
|
|
63
|
+
}
|
|
64
|
+
const englishWording = (wording) => wording[1];
|
|
60
65
|
/**
|
|
61
66
|
* Date picker
|
|
62
67
|
*/
|
|
@@ -107,6 +112,12 @@ let DatePicker = (() => {
|
|
|
107
112
|
let _value_decorators;
|
|
108
113
|
let _value_initializers = [];
|
|
109
114
|
let _value_extraInitializers = [];
|
|
115
|
+
let _locale_decorators;
|
|
116
|
+
let _locale_initializers = [];
|
|
117
|
+
let _locale_extraInitializers = [];
|
|
118
|
+
let _wording_decorators;
|
|
119
|
+
let _wording_initializers = [];
|
|
120
|
+
let _wording_extraInitializers = [];
|
|
110
121
|
return class DatePicker extends _classSuper {
|
|
111
122
|
static {
|
|
112
123
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
@@ -125,6 +136,8 @@ let DatePicker = (() => {
|
|
|
125
136
|
_popup_decorators = [property({ type: Boolean })];
|
|
126
137
|
_size_decorators = [property({ type: Number })];
|
|
127
138
|
_value_decorators = [property({ type: Number })];
|
|
139
|
+
_locale_decorators = [property({ attribute: false })];
|
|
140
|
+
_wording_decorators = [property({ attribute: false })];
|
|
128
141
|
__esDecorate(this, null, __matrix_decorators, { kind: "accessor", name: "_matrix", static: false, private: false, access: { has: obj => "_matrix" in obj, get: obj => obj._matrix, set: (obj, value) => { obj._matrix = value; } }, metadata: _metadata }, __matrix_initializers, __matrix_extraInitializers);
|
|
129
142
|
__esDecorate(this, null, __mode_decorators, { kind: "accessor", name: "_mode", static: false, private: false, access: { has: obj => "_mode" in obj, get: obj => obj._mode, set: (obj, value) => { obj._mode = value; } }, metadata: _metadata }, __mode_initializers, __mode_extraInitializers);
|
|
130
143
|
__esDecorate(this, null, __monthCursor_decorators, { kind: "accessor", name: "_monthCursor", static: false, private: false, access: { has: obj => "_monthCursor" in obj, get: obj => obj._monthCursor, set: (obj, value) => { obj._monthCursor = value; } }, metadata: _metadata }, __monthCursor_initializers, __monthCursor_extraInitializers);
|
|
@@ -140,6 +153,8 @@ let DatePicker = (() => {
|
|
|
140
153
|
__esDecorate(this, null, _popup_decorators, { kind: "accessor", name: "popup", static: false, private: false, access: { has: obj => "popup" in obj, get: obj => obj.popup, set: (obj, value) => { obj.popup = value; } }, metadata: _metadata }, _popup_initializers, _popup_extraInitializers);
|
|
141
154
|
__esDecorate(this, null, _size_decorators, { kind: "accessor", name: "size", static: false, private: false, access: { has: obj => "size" in obj, get: obj => obj.size, set: (obj, value) => { obj.size = value; } }, metadata: _metadata }, _size_initializers, _size_extraInitializers);
|
|
142
155
|
__esDecorate(this, null, _value_decorators, { kind: "accessor", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
|
|
156
|
+
__esDecorate(this, null, _locale_decorators, { kind: "accessor", name: "locale", static: false, private: false, access: { has: obj => "locale" in obj, get: obj => obj.locale, set: (obj, value) => { obj.locale = value; } }, metadata: _metadata }, _locale_initializers, _locale_extraInitializers);
|
|
157
|
+
__esDecorate(this, null, _wording_decorators, { kind: "accessor", name: "wording", static: false, private: false, access: { has: obj => "wording" in obj, get: obj => obj.wording, set: (obj, value) => { obj.wording = value; } }, metadata: _metadata }, _wording_initializers, _wording_extraInitializers);
|
|
143
158
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
144
159
|
}
|
|
145
160
|
static { this.styles = datePickerStyle; }
|
|
@@ -168,7 +183,7 @@ let DatePicker = (() => {
|
|
|
168
183
|
return this._cursor.getDay();
|
|
169
184
|
}
|
|
170
185
|
get dayLabel() {
|
|
171
|
-
return
|
|
186
|
+
return weekdayLabels(this.locale)[this.day];
|
|
172
187
|
}
|
|
173
188
|
get minHeight() {
|
|
174
189
|
const rowNum = this._matrix.length;
|
|
@@ -178,7 +193,7 @@ let DatePicker = (() => {
|
|
|
178
193
|
return this._cursor.getMonth();
|
|
179
194
|
}
|
|
180
195
|
get monthLabel() {
|
|
181
|
-
return
|
|
196
|
+
return monthLabels(this.locale)[this.month];
|
|
182
197
|
}
|
|
183
198
|
get year() {
|
|
184
199
|
return this._cursor.getFullYear();
|
|
@@ -228,13 +243,13 @@ let DatePicker = (() => {
|
|
|
228
243
|
|
|
229
244
|
${this._navAction(() => this._moveMonth(-1), () => this._moveMonth(1), html `<button
|
|
230
245
|
tabindex="0"
|
|
231
|
-
aria-label
|
|
246
|
+
aria-label=${this.say(DATE_PICKER_TODAY)}
|
|
232
247
|
class="action-label interactive today"
|
|
233
248
|
@click=${() => {
|
|
234
249
|
this._onChange(new Date());
|
|
235
250
|
}}
|
|
236
251
|
>
|
|
237
|
-
<span
|
|
252
|
+
<span>${this.say(DATE_PICKER_TODAY)}</span>
|
|
238
253
|
</button>`)}
|
|
239
254
|
</div>
|
|
240
255
|
${this._dayHeaderRenderer()}
|
|
@@ -247,11 +262,11 @@ let DatePicker = (() => {
|
|
|
247
262
|
? html `<div class="date-picker-footer">
|
|
248
263
|
<button
|
|
249
264
|
tabindex="0"
|
|
250
|
-
aria-label
|
|
265
|
+
aria-label=${this.say(DATE_PICKER_CLEAR)}
|
|
251
266
|
class="footer-button interactive"
|
|
252
267
|
@click=${() => this.onClear?.()}
|
|
253
268
|
>
|
|
254
|
-
|
|
269
|
+
${this.say(DATE_PICKER_CLEAR)}
|
|
255
270
|
</button>
|
|
256
271
|
</div>`
|
|
257
272
|
: nothing}`;
|
|
@@ -259,7 +274,7 @@ let DatePicker = (() => {
|
|
|
259
274
|
/** Week header */
|
|
260
275
|
_dayHeaderRenderer() {
|
|
261
276
|
return html `<div class="days-header">
|
|
262
|
-
${
|
|
277
|
+
${weekdayLabels(this.locale).map(day => html `<div class="date-cell">${day}</div>`)}
|
|
263
278
|
</div>`;
|
|
264
279
|
}
|
|
265
280
|
_getMatrix() {
|
|
@@ -307,7 +322,7 @@ let DatePicker = (() => {
|
|
|
307
322
|
})}
|
|
308
323
|
</div>
|
|
309
324
|
<div class="date-picker-month">
|
|
310
|
-
${
|
|
325
|
+
${monthLabels(this.locale).map((month, index) => {
|
|
311
326
|
const isActive = this.value
|
|
312
327
|
? isSameMonth(this.value, new Date(this._monthPickYearCursor, index, 1))
|
|
313
328
|
: false;
|
|
@@ -348,7 +363,7 @@ let DatePicker = (() => {
|
|
|
348
363
|
});
|
|
349
364
|
return html `<div class=${classes}>
|
|
350
365
|
<button
|
|
351
|
-
aria-label
|
|
366
|
+
aria-label=${this.say(DATE_PICKER_PREVIOUS)}
|
|
352
367
|
class="date-picker-small-action interactive left"
|
|
353
368
|
@click=${onPrev}
|
|
354
369
|
?disabled=${prevDisable}
|
|
@@ -357,7 +372,7 @@ let DatePicker = (() => {
|
|
|
357
372
|
</button>
|
|
358
373
|
${slot ?? nothing}
|
|
359
374
|
<button
|
|
360
|
-
aria-label
|
|
375
|
+
aria-label=${this.say(DATE_PICKER_NEXT)}
|
|
361
376
|
class="date-picker-small-action interactive right"
|
|
362
377
|
@click=${onNext}
|
|
363
378
|
?disabled=${nextDisable}
|
|
@@ -636,6 +651,23 @@ let DatePicker = (() => {
|
|
|
636
651
|
/** Checked date timestamp */
|
|
637
652
|
get value() { return this.#value_accessor_storage; }
|
|
638
653
|
set value(value) { this.#value_accessor_storage = value; }
|
|
654
|
+
#locale_accessor_storage;
|
|
655
|
+
/**
|
|
656
|
+
* The BCP-47 locale of the day and month names (`formatLocale(std)` at the
|
|
657
|
+
* caller). `en-US` by default, which reads as the picker always did.
|
|
658
|
+
*/
|
|
659
|
+
get locale() { return this.#locale_accessor_storage; }
|
|
660
|
+
set locale(value) { this.#locale_accessor_storage = value; }
|
|
661
|
+
#wording_accessor_storage;
|
|
662
|
+
/**
|
|
663
|
+
* Resolves the picker's own wordings: it renders in a popup, outside the
|
|
664
|
+
* editor, so its caller holds the catalogue. Absent, English.
|
|
665
|
+
*/
|
|
666
|
+
get wording() { return this.#wording_accessor_storage; }
|
|
667
|
+
set wording(value) { this.#wording_accessor_storage = value; }
|
|
668
|
+
say(wording) {
|
|
669
|
+
return (this.wording ?? englishWording)(wording);
|
|
670
|
+
}
|
|
639
671
|
constructor() {
|
|
640
672
|
super(...arguments);
|
|
641
673
|
/** current active month */
|
|
@@ -657,7 +689,9 @@ let DatePicker = (() => {
|
|
|
657
689
|
this.#popup_accessor_storage = (__runInitializers(this, _padding_extraInitializers), __runInitializers(this, _popup_initializers, false));
|
|
658
690
|
this.#size_accessor_storage = (__runInitializers(this, _popup_extraInitializers), __runInitializers(this, _size_initializers, 28));
|
|
659
691
|
this.#value_accessor_storage = (__runInitializers(this, _size_extraInitializers), __runInitializers(this, _value_initializers, undefined));
|
|
660
|
-
__runInitializers(this, _value_extraInitializers);
|
|
692
|
+
this.#locale_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _locale_initializers, 'en-US'));
|
|
693
|
+
this.#wording_accessor_storage = (__runInitializers(this, _locale_extraInitializers), __runInitializers(this, _wording_initializers, undefined));
|
|
694
|
+
__runInitializers(this, _wording_extraInitializers);
|
|
661
695
|
}
|
|
662
696
|
};
|
|
663
697
|
})();
|
|
@@ -35,6 +35,10 @@ export { COLOR_LABEL, FILL_COLOR_LABEL };
|
|
|
35
35
|
export declare const BORDER_COLOR_LABEL: ChromeWording;
|
|
36
36
|
export declare const CONTEXT_MENU_NO_RESULTS: ChromeWording;
|
|
37
37
|
export declare const CONTEXT_MENU_DONE: ChromeWording;
|
|
38
|
+
export declare const DATE_PICKER_TODAY: ChromeWording;
|
|
39
|
+
export declare const DATE_PICKER_CLEAR: ChromeWording;
|
|
40
|
+
export declare const DATE_PICKER_PREVIOUS: ChromeWording;
|
|
41
|
+
export declare const DATE_PICKER_NEXT: ChromeWording;
|
|
38
42
|
export declare const LINE_STYLE_SOLID: ChromeWording;
|
|
39
43
|
export declare const LINE_STYLE_DASH: ChromeWording;
|
|
40
44
|
export declare const LINE_STYLE_NONE: ChromeWording;
|
|
@@ -81,6 +81,28 @@ export const CONTEXT_MENU_DONE = [
|
|
|
81
81
|
'com.labre.context-menu.done',
|
|
82
82
|
'Done',
|
|
83
83
|
];
|
|
84
|
+
/* ── Date picker (database date cells, the chips band, date filters) ─── */
|
|
85
|
+
/*
|
|
86
|
+
* Its caller resolves them (the picker renders in a popup, outside the
|
|
87
|
+
* editor) and passes `wording`. Day and month names are not keys: they come
|
|
88
|
+
* from `Intl` in the caller's `locale` (`formatLocale(std)`).
|
|
89
|
+
*/
|
|
90
|
+
export const DATE_PICKER_TODAY = [
|
|
91
|
+
'com.labre.date-picker.today',
|
|
92
|
+
'Today',
|
|
93
|
+
];
|
|
94
|
+
export const DATE_PICKER_CLEAR = [
|
|
95
|
+
'com.labre.date-picker.clear',
|
|
96
|
+
'Clear',
|
|
97
|
+
];
|
|
98
|
+
export const DATE_PICKER_PREVIOUS = [
|
|
99
|
+
'com.labre.date-picker.previous-month',
|
|
100
|
+
'Previous month',
|
|
101
|
+
];
|
|
102
|
+
export const DATE_PICKER_NEXT = [
|
|
103
|
+
'com.labre.date-picker.next-month',
|
|
104
|
+
'Next month',
|
|
105
|
+
];
|
|
84
106
|
/* ── Edgeless line style / width panels ─────────────────────────────── */
|
|
85
107
|
export const LINE_STYLE_SOLID = [
|
|
86
108
|
'com.labre.line-style.solid',
|
|
@@ -415,6 +437,10 @@ export { ICON_BUTTON_COMING_SOON };
|
|
|
415
437
|
* restated there.
|
|
416
438
|
*/
|
|
417
439
|
export const COMPONENTS_WORDINGS = [
|
|
440
|
+
DATE_PICKER_TODAY,
|
|
441
|
+
DATE_PICKER_CLEAR,
|
|
442
|
+
DATE_PICKER_PREVIOUS,
|
|
443
|
+
DATE_PICKER_NEXT,
|
|
418
444
|
CAPTION_PLACEHOLDER,
|
|
419
445
|
CARD_STYLE_LABEL,
|
|
420
446
|
FAVICON_ALT,
|
|
@@ -4,6 +4,14 @@ declare const DocTitle_base: typeof ShadowlessElement & import("../global/utils/
|
|
|
4
4
|
export declare class DocTitle extends DocTitle_base {
|
|
5
5
|
static styles: import("lit").CSSResult;
|
|
6
6
|
private _getOrCreateFirstPageVisibleNote;
|
|
7
|
+
/**
|
|
8
|
+
* Leaves the title for `bodyBlockId`: the title loses the caret (its text
|
|
9
|
+
* is already stored, so that is all "validating" it means), then the block
|
|
10
|
+
* takes the caret where it can, through its `focusFirstCell` (a database
|
|
11
|
+
* block's: the first cell of a table or kanban view). A block without one,
|
|
12
|
+
* or a view without cells, keeps nothing focused. Writes nothing.
|
|
13
|
+
*/
|
|
14
|
+
private _leaveForBodyBlock;
|
|
7
15
|
private readonly _onTitleKeyDown;
|
|
8
16
|
private readonly _updateTitleInMeta;
|
|
9
17
|
private get _std();
|
|
@@ -27,5 +35,15 @@ export declare class DocTitle extends DocTitle_base {
|
|
|
27
35
|
private accessor _richTextElement;
|
|
28
36
|
accessor doc: Store;
|
|
29
37
|
accessor wrapText: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The block that is the page's body, when the document's note is not (a
|
|
40
|
+
* database's full page, ADR 0035 B13: the document holds the database
|
|
41
|
+
* block and its schema blocks in a note the page never draws). Set, the
|
|
42
|
+
* title has no body of its own: Enter and ArrowDown leave the title for
|
|
43
|
+
* this block and never add or focus a paragraph, so nothing is ever
|
|
44
|
+
* written to the note. Unset (the default), Enter splits the title into a
|
|
45
|
+
* first paragraph and ArrowDown focuses or creates one, as in 0.48.
|
|
46
|
+
*/
|
|
47
|
+
accessor bodyBlockId: string | undefined;
|
|
30
48
|
}
|
|
31
49
|
export {};
|