@formicoidea/labre-core 0.53.0 → 0.55.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.
Files changed (104) hide show
  1. package/dist/_pkgs/affine-block-data-view/data-view-block.js +1 -1
  2. package/dist/_pkgs/affine-block-database/components/title/index.js +7 -2
  3. package/dist/_pkgs/affine-block-database/database-block-styles.js +9 -1
  4. package/dist/_pkgs/affine-block-embed-doc/page-drop/page-drop.d.ts +70 -0
  5. package/dist/_pkgs/affine-block-embed-doc/page-drop/page-drop.js +196 -0
  6. package/dist/_pkgs/affine-block-embed-doc/view.js +3 -0
  7. package/dist/_pkgs/affine-block-frame/frame-template.d.ts +11 -0
  8. package/dist/_pkgs/affine-block-frame/frame-template.js +24 -4
  9. package/dist/_pkgs/affine-block-frame/translations.d.ts +3 -0
  10. package/dist/_pkgs/affine-block-frame/translations.js +7 -0
  11. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +9 -3
  12. package/dist/_pkgs/affine-block-surface/framework-background/renderer.js +9 -5
  13. package/dist/_pkgs/affine-block-surface/index.d.ts +1 -0
  14. package/dist/_pkgs/affine-block-surface/index.js +1 -0
  15. package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.d.ts +55 -3
  16. package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.js +139 -6
  17. package/dist/_pkgs/affine-block-surface/renderer/notation-tint.d.ts +92 -0
  18. package/dist/_pkgs/affine-block-surface/renderer/notation-tint.js +113 -0
  19. package/dist/_pkgs/affine-block-surface/surface-block.js +2 -2
  20. package/dist/_pkgs/affine-components/color-picker/styles.js +1 -1
  21. package/dist/_pkgs/affine-components/context-menu/input.js +2 -1
  22. package/dist/_pkgs/affine-components/context-menu/menu-renderer.d.ts +7 -0
  23. package/dist/_pkgs/affine-components/context-menu/menu-renderer.js +53 -13
  24. package/dist/_pkgs/affine-components/drop-indicator/file-drop-manager.js +15 -0
  25. package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/index.js +4 -2
  26. package/dist/_pkgs/affine-inline-link/link-node/link-popup/styles.js +1 -1
  27. package/dist/_pkgs/affine-inline-reference/reference-node/reference-popup/reference-popup.js +9 -9
  28. package/dist/_pkgs/affine-shared/consts/notation.d.ts +1 -0
  29. package/dist/_pkgs/affine-shared/consts/notation.js +29 -0
  30. package/dist/_pkgs/affine-shared/services/frame-template-service.d.ts +5 -0
  31. package/dist/_pkgs/affine-shared/services/index.d.ts +1 -0
  32. package/dist/_pkgs/affine-shared/services/index.js +1 -0
  33. package/dist/_pkgs/affine-shared/services/page-drop-service.d.ts +61 -0
  34. package/dist/_pkgs/affine-shared/services/page-drop-service.js +30 -0
  35. package/dist/_pkgs/affine-shared/styles/scrollbar-style.js +1 -1
  36. package/dist/_pkgs/affine-widget-edgeless-auto-connect/index.js +5 -5
  37. package/dist/_pkgs/affine-widget-edgeless-selected-rect/edgeless-auto-complete.js +2 -2
  38. package/dist/_pkgs/affine-widget-keyboard-toolbar/config.js +6 -6
  39. package/dist/_pkgs/affine-widget-keyboard-toolbar/styles.js +1 -1
  40. package/dist/_pkgs/affine-widget-linked-doc/config.d.ts +8 -0
  41. package/dist/_pkgs/affine-widget-linked-doc/config.js +8 -1
  42. package/dist/_pkgs/affine-widget-linked-doc/linked-doc-popover.js +40 -32
  43. package/dist/_pkgs/affine-widget-linked-doc/styles.js +1 -1
  44. package/dist/_pkgs/affine-widget-linked-doc/translations.d.ts +2 -0
  45. package/dist/_pkgs/affine-widget-linked-doc/translations.js +6 -0
  46. package/dist/_pkgs/affine-widget-thread-marks/widget.d.ts +3 -1
  47. package/dist/_pkgs/affine-widget-thread-marks/widget.js +6 -1
  48. package/dist/_pkgs/affine-widget-toolbar/utils.d.ts +2 -1
  49. package/dist/_pkgs/affine-widget-toolbar/utils.js +5 -2
  50. package/dist/_pkgs/data-view/core/common/properties.js +2 -2
  51. package/dist/_pkgs/data-view/core/common/property-menu.d.ts +3 -3
  52. package/dist/_pkgs/data-view/core/common/property-menu.js +7 -7
  53. package/dist/_pkgs/data-view/core/component/overflow/overflow.js +4 -1
  54. package/dist/_pkgs/data-view/core/group-by/renderer/base.d.ts +4 -1
  55. package/dist/_pkgs/data-view/core/group-by/renderer/base.js +17 -2
  56. package/dist/_pkgs/data-view/core/group-by/renderer/number-group.js +1 -1
  57. package/dist/_pkgs/data-view/core/group-by/renderer/select-group.d.ts +0 -3
  58. package/dist/_pkgs/data-view/core/group-by/renderer/select-group.js +63 -118
  59. package/dist/_pkgs/data-view/core/group-by/renderer/string-group.js +1 -1
  60. package/dist/_pkgs/data-view/core/group-by/setting.js +2 -2
  61. package/dist/_pkgs/data-view/core/utils/wording.d.ts +6 -2
  62. package/dist/_pkgs/data-view/core/utils/wording.js +5 -3
  63. package/dist/_pkgs/data-view/core/view/default-name.d.ts +6 -0
  64. package/dist/_pkgs/data-view/core/view/default-name.js +8 -0
  65. package/dist/_pkgs/data-view/translations.d.ts +45 -0
  66. package/dist/_pkgs/data-view/translations.js +118 -0
  67. package/dist/_pkgs/data-view/view-presets/flat/flat-view-ui.d.ts +3 -1
  68. package/dist/_pkgs/data-view/view-presets/flat/flat-view-ui.js +5 -1
  69. package/dist/_pkgs/data-view/view-presets/kanban/mobile/card.d.ts +6 -0
  70. package/dist/_pkgs/data-view/view-presets/kanban/mobile/card.js +11 -0
  71. package/dist/_pkgs/data-view/view-presets/kanban/mobile/cell.js +9 -10
  72. package/dist/_pkgs/data-view/view-presets/kanban/mobile/kanban-view-ui-logic.js +3 -0
  73. package/dist/_pkgs/data-view/view-presets/table/mobile/cell.js +7 -4
  74. package/dist/_pkgs/data-view/view-presets/table/mobile/column-header.d.ts +3 -1
  75. package/dist/_pkgs/data-view/view-presets/table/mobile/column-header.js +102 -124
  76. package/dist/_pkgs/data-view/view-presets/table/mobile/group.js +12 -7
  77. package/dist/_pkgs/data-view/view-presets/table/mobile/header.d.ts +8 -2
  78. package/dist/_pkgs/data-view/view-presets/table/mobile/header.js +64 -24
  79. package/dist/_pkgs/data-view/view-presets/table/mobile/menu.d.ts +3 -1
  80. package/dist/_pkgs/data-view/view-presets/table/mobile/menu.js +7 -3
  81. package/dist/_pkgs/data-view/view-presets/table/mobile/row.d.ts +23 -1
  82. package/dist/_pkgs/data-view/view-presets/table/mobile/row.js +138 -55
  83. package/dist/_pkgs/data-view/view-presets/table/mobile/table-view-style.d.ts +17 -0
  84. package/dist/_pkgs/data-view/view-presets/table/mobile/table-view-style.js +31 -6
  85. package/dist/_pkgs/data-view/view-presets/table/mobile/table-view-ui-logic.d.ts +5 -1
  86. package/dist/_pkgs/data-view/view-presets/table/mobile/table-view-ui-logic.js +11 -4
  87. package/dist/_pkgs/data-view/view-presets/table/pc/group.js +4 -2
  88. package/dist/_pkgs/data-view/view-presets/table/pc/row/row.js +5 -1
  89. package/dist/_pkgs/data-view/widget-presets/quick-setting-bar/filter/index.js +1 -2
  90. package/dist/_pkgs/data-view/widget-presets/quick-setting-bar/filter/list-view.d.ts +3 -1
  91. package/dist/_pkgs/data-view/widget-presets/quick-setting-bar/filter/list-view.js +23 -3
  92. package/dist/_pkgs/data-view/widget-presets/quick-setting-bar/index.js +8 -8
  93. package/dist/_pkgs/data-view/widget-presets/tools/presets/filter/filter.d.ts +3 -0
  94. package/dist/_pkgs/data-view/widget-presets/tools/presets/filter/filter.js +125 -60
  95. package/dist/_pkgs/data-view/widget-presets/tools/presets/search/search.d.ts +3 -0
  96. package/dist/_pkgs/data-view/widget-presets/tools/presets/search/search.js +37 -5
  97. package/dist/_pkgs/data-view/widget-presets/tools/presets/sort/sort.d.ts +3 -0
  98. package/dist/_pkgs/data-view/widget-presets/tools/presets/sort/sort.js +131 -66
  99. package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.d.ts +3 -0
  100. package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.js +143 -40
  101. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.js +30 -22
  102. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.js +8 -6
  103. package/dist/_pkgs/data-view/widget-presets/views-bar/views-view.js +15 -0
  104. package/package.json +1 -1
@@ -1,14 +1,51 @@
1
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
4
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
5
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
6
+ var _, done = false;
7
+ for (var i = decorators.length - 1; i >= 0; i--) {
8
+ var context = {};
9
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
10
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
11
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13
+ if (kind === "accessor") {
14
+ if (result === void 0) continue;
15
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
16
+ if (_ = accept(result.get)) descriptor.get = _;
17
+ if (_ = accept(result.set)) descriptor.set = _;
18
+ if (_ = accept(result.init)) initializers.unshift(_);
19
+ }
20
+ else if (_ = accept(result)) {
21
+ if (kind === "field") initializers.unshift(_);
22
+ else descriptor[key] = _;
23
+ }
24
+ }
25
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
+ done = true;
27
+ };
28
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
+ var useValue = arguments.length > 2;
30
+ for (var i = 0; i < initializers.length; i++) {
31
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
+ }
33
+ return useValue ? value : void 0;
34
+ };
1
35
  import { popupTargetFromElement } from '../../../../../affine-components/context-menu/index.js';
2
- import { IS_MOBILE } from '../../../../../global/env/index.js';
3
36
  import { SortIcon } from '@blocksuite/icons/lit';
4
37
  import { computed } from '@preact/signals-core';
5
38
  import { cssVarV2 } from '@toeverything/theme/v2';
39
+ import { stdContext } from '../../../../../std/index.js';
40
+ import { consume } from '@lit/context';
6
41
  import { css, html, nothing } from 'lit';
7
42
  import { styleMap } from 'lit/directives/style-map.js';
8
43
  import { popCreateSort } from '../../../../core/sort/add-sort.js';
9
44
  import { sortTraitKey } from '../../../../core/sort/manager.js';
10
45
  import { createSortUtils } from '../../../../core/sort/utils.js';
46
+ import { wordingOf } from '../../../../core/utils/wording.js';
11
47
  import { WidgetBase } from '../../../../core/widget/widget-base.js';
48
+ import { DATA_VIEW_SORT } from '../../../../translations.js';
12
49
  import { createDefaultShowQuickSettingBar, ShowQuickSettingBarKey, } from '../../../quick-setting-bar/context.js';
13
50
  import { popSortRoot } from '../../../quick-setting-bar/sort/root-panel.js';
14
51
  const styles = css `
@@ -28,80 +65,108 @@ const styles = css `
28
65
  background-color: var(--affine-hover-color);
29
66
  }
30
67
 
31
- .affine-database-sort-button {
68
+ /* Shown on a phone too, its menus as sheets: 44px for a finger (P7). */
69
+ @media (pointer: coarse) {
70
+ .affine-database-sort-button {
71
+ min-width: 44px;
72
+ min-height: 44px;
73
+ justify-content: center;
74
+ }
32
75
  }
33
76
  `;
34
- export class DataViewHeaderToolsSort extends WidgetBase {
35
- constructor() {
36
- super(...arguments);
37
- this.sortUtils$ = computed(() => {
38
- const sortTrait = this.view.traitGet(sortTraitKey);
39
- if (sortTrait) {
40
- return createSortUtils(sortTrait, this.dataViewLogic.eventTrace);
77
+ let DataViewHeaderToolsSort = (() => {
78
+ let _classSuper = WidgetBase;
79
+ let _std_decorators;
80
+ let _std_initializers = [];
81
+ let _std_extraInitializers = [];
82
+ return class DataViewHeaderToolsSort extends _classSuper {
83
+ static {
84
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
85
+ _std_decorators = [consume({ context: stdContext })];
86
+ __esDecorate(this, null, _std_decorators, { kind: "accessor", name: "std", static: false, private: false, access: { has: obj => "std" in obj, get: obj => obj.std, set: (obj, value) => { obj.std = value; } }, metadata: _metadata }, _std_initializers, _std_extraInitializers);
87
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
88
+ }
89
+ static { this.styles = styles; }
90
+ get readonly() {
91
+ return this.view.readonly$.value;
92
+ }
93
+ clickSort(event) {
94
+ const sortUtils = this.sortUtils$.value;
95
+ if (!sortUtils) {
96
+ return;
41
97
  }
42
- return;
43
- });
44
- this.hasSort = computed(() => {
45
- return (this.sortUtils$.value?.sortList$?.value?.length ?? 0) > 0;
46
- });
47
- }
48
- static { this.styles = styles; }
49
- get readonly() {
50
- return this.view.readonly$.value;
51
- }
52
- clickSort(event) {
53
- const sortUtils = this.sortUtils$.value;
54
- if (!sortUtils) {
98
+ if (this.hasSort.value) {
99
+ this.toggleShowQuickSettingBar();
100
+ return;
101
+ }
102
+ popCreateSort(popupTargetFromElement(event.currentTarget), {
103
+ sortUtils: {
104
+ ...sortUtils,
105
+ add: sort => {
106
+ sortUtils.add(sort);
107
+ this.toggleShowQuickSettingBar(true);
108
+ requestAnimationFrame(() => {
109
+ const ele = this.closest('affine-data-view-renderer')?.querySelector('.data-view-sort-button');
110
+ if (ele) {
111
+ popSortRoot(popupTargetFromElement(ele), {
112
+ sortUtils: sortUtils,
113
+ });
114
+ }
115
+ });
116
+ },
117
+ },
118
+ });
55
119
  return;
56
120
  }
57
- if (this.hasSort.value) {
58
- this.toggleShowQuickSettingBar();
59
- return;
121
+ #std_accessor_storage;
122
+ /** Absent outside an editor host: the wordings read English. */
123
+ get std() { return this.#std_accessor_storage; }
124
+ set std(value) { this.#std_accessor_storage = value; }
125
+ connectedCallback() {
126
+ super.connectedCallback();
127
+ this.style.display = 'flex';
60
128
  }
61
- popCreateSort(popupTargetFromElement(event.currentTarget), {
62
- sortUtils: {
63
- ...sortUtils,
64
- add: sort => {
65
- sortUtils.add(sort);
66
- this.toggleShowQuickSettingBar(true);
67
- requestAnimationFrame(() => {
68
- const ele = this.closest('affine-data-view-renderer')?.querySelector('.data-view-sort-button');
69
- if (ele) {
70
- popSortRoot(popupTargetFromElement(ele), {
71
- sortUtils: sortUtils,
72
- });
73
- }
74
- });
75
- },
76
- },
77
- });
78
- return;
79
- }
80
- connectedCallback() {
81
- super.connectedCallback();
82
- this.style.display = IS_MOBILE ? 'none' : 'flex';
83
- }
84
- render() {
85
- if (this.readonly)
86
- return nothing;
87
- const style = styleMap({
88
- color: this.hasSort.value
89
- ? cssVarV2('text/emphasis')
90
- : cssVarV2('icon/primary'),
91
- });
92
- return html ` <div
129
+ render() {
130
+ if (this.readonly)
131
+ return nothing;
132
+ const style = styleMap({
133
+ color: this.hasSort.value
134
+ ? cssVarV2('text/emphasis')
135
+ : cssVarV2('icon/primary'),
136
+ });
137
+ return html ` <div
93
138
  @click="${this.clickSort}"
94
139
  style="${style}"
95
140
  class="affine-database-sort-button"
141
+ data-testid="dv-tools-sort"
142
+ role="button"
143
+ aria-label="${wordingOf(this.std)(DATA_VIEW_SORT)}"
96
144
  >
97
145
  ${SortIcon()}
98
146
  </div>`;
99
- }
100
- toggleShowQuickSettingBar(show) {
101
- const map = this.view.serviceGetOrCreate(ShowQuickSettingBarKey, createDefaultShowQuickSettingBar);
102
- map.value = {
103
- ...map.value,
104
- [this.view.id]: show ?? !map.value[this.view.id],
105
- };
106
- }
107
- }
147
+ }
148
+ toggleShowQuickSettingBar(show) {
149
+ const map = this.view.serviceGetOrCreate(ShowQuickSettingBarKey, createDefaultShowQuickSettingBar);
150
+ map.value = {
151
+ ...map.value,
152
+ [this.view.id]: show ?? !map.value[this.view.id],
153
+ };
154
+ }
155
+ constructor() {
156
+ super(...arguments);
157
+ this.sortUtils$ = computed(() => {
158
+ const sortTrait = this.view.traitGet(sortTraitKey);
159
+ if (sortTrait) {
160
+ return createSortUtils(sortTrait, this.dataViewLogic.eventTrace);
161
+ }
162
+ return;
163
+ });
164
+ this.hasSort = computed(() => {
165
+ return (this.sortUtils$.value?.sortList$?.value?.length ?? 0) > 0;
166
+ });
167
+ this.#std_accessor_storage = __runInitializers(this, _std_initializers, void 0);
168
+ __runInitializers(this, _std_extraInitializers);
169
+ }
170
+ };
171
+ })();
172
+ export { DataViewHeaderToolsSort };
@@ -1,8 +1,11 @@
1
+ import { type BlockStdScope } from '../../../../../std/index.js';
1
2
  import { WidgetBase } from '../../../../core/widget/widget-base.js';
2
3
  export declare class DataViewHeaderToolsAddRow extends WidgetBase {
3
4
  static styles: import("lit").CSSResult;
4
5
  private readonly onAddNewRecord;
5
6
  private readonly onOpenMenu;
7
+ /** Absent outside an editor host: the wordings read English. */
8
+ accessor std: BlockStdScope;
6
9
  private get readonly$();
7
10
  render(): import("lit-html").TemplateResult<1> | undefined;
8
11
  }
@@ -1,14 +1,87 @@
1
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
4
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
5
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
6
+ var _, done = false;
7
+ for (var i = decorators.length - 1; i >= 0; i--) {
8
+ var context = {};
9
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
10
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
11
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13
+ if (kind === "accessor") {
14
+ if (result === void 0) continue;
15
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
16
+ if (_ = accept(result.get)) descriptor.get = _;
17
+ if (_ = accept(result.set)) descriptor.set = _;
18
+ if (_ = accept(result.init)) initializers.unshift(_);
19
+ }
20
+ else if (_ = accept(result)) {
21
+ if (kind === "field") initializers.unshift(_);
22
+ else descriptor[key] = _;
23
+ }
24
+ }
25
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
+ done = true;
27
+ };
28
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
+ var useValue = arguments.length > 2;
30
+ for (var i = 0; i < initializers.length; i++) {
31
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
+ }
33
+ return useValue ? value : void 0;
34
+ };
1
35
  import { unsafeCSSVarV2 } from '../../../../../affine-shared/theme/index.js';
2
36
  import { IS_MOBILE } from '../../../../../global/env/index.js';
3
37
  import { ArrowDownSmallIcon, PlusIcon } from '@blocksuite/icons/lit';
38
+ import { stdContext } from '../../../../../std/index.js';
39
+ import { consume } from '@lit/context';
4
40
  import { css, html } from 'lit';
41
+ import { wordingOf } from '../../../../core/utils/wording.js';
5
42
  import { NewRowMenuOpenerKey } from '../../../../core/view-manager/new-row-menu-opener.js';
6
43
  import { WidgetBase } from '../../../../core/widget/widget-base.js';
44
+ import { DATA_VIEW_NEW_PAGE, DATA_VIEW_NEW_RECORD, } from '../../../../translations.js';
7
45
  const styles = css `
8
46
  .new-record {
9
47
  font-weight: 500;
10
48
  }
11
49
 
50
+ /* A finger needs 44px: the host's touch-target floor (P7). */
51
+ @media (pointer: coarse) {
52
+ .new-record {
53
+ min-height: 44px;
54
+ }
55
+ }
56
+
57
+ /* On a phone, a blue "+" as Notion draws it: 32px drawn, 44px to touch. */
58
+ .new-record-phone {
59
+ position: relative;
60
+ display: flex;
61
+ align-items: center;
62
+ justify-content: center;
63
+ width: 32px;
64
+ height: 32px;
65
+ margin: 6px;
66
+ padding: 0;
67
+ border: none;
68
+ border-radius: 8px;
69
+ background-color: ${unsafeCSSVarV2('button/primary')};
70
+ color: ${unsafeCSSVarV2('button/pureWhiteText')};
71
+ font-size: 20px;
72
+ cursor: pointer;
73
+ }
74
+
75
+ .new-record-phone::after {
76
+ content: '';
77
+ position: absolute;
78
+ inset: -6px;
79
+ }
80
+
81
+ .new-record-phone svg {
82
+ color: inherit;
83
+ }
84
+
12
85
  .new-record svg {
13
86
  font-size: 20px;
14
87
  color: ${unsafeCSSVarV2('icon/primary')};
@@ -45,45 +118,55 @@ const styles = css `
45
118
  }
46
119
  }
47
120
  `;
48
- export class DataViewHeaderToolsAddRow extends WidgetBase {
49
- constructor() {
50
- super(...arguments);
51
- this.onAddNewRecord = () => {
52
- if (this.readonly$.value)
53
- return;
54
- this.dataViewLogic.addRow?.('start');
55
- };
56
- this.onOpenMenu = (event) => {
57
- event.stopPropagation();
58
- if (this.readonly$.value)
59
- return;
60
- this.view
61
- .serviceGet(NewRowMenuOpenerKey)
62
- ?.open(event.currentTarget, this.view.id);
63
- };
64
- }
65
- static { this.styles = styles; }
66
- get readonly$() {
67
- return this.view.readonly$;
68
- }
69
- render() {
70
- if (this.readonly$.value) {
71
- return;
121
+ let DataViewHeaderToolsAddRow = (() => {
122
+ let _classSuper = WidgetBase;
123
+ let _std_decorators;
124
+ let _std_initializers = [];
125
+ let _std_extraInitializers = [];
126
+ return class DataViewHeaderToolsAddRow extends _classSuper {
127
+ static {
128
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
129
+ _std_decorators = [consume({ context: stdContext })];
130
+ __esDecorate(this, null, _std_decorators, { kind: "accessor", name: "std", static: false, private: false, access: { has: obj => "std" in obj, get: obj => obj.std, set: (obj, value) => { obj.std = value; } }, metadata: _metadata }, _std_initializers, _std_extraInitializers);
131
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
132
+ }
133
+ static { this.styles = styles; }
134
+ #std_accessor_storage;
135
+ /** Absent outside an editor host: the wordings read English. */
136
+ get std() { return this.#std_accessor_storage; }
137
+ set std(value) { this.#std_accessor_storage = value; }
138
+ get readonly$() {
139
+ return this.view.readonly$;
72
140
  }
73
- const button = html ` <data-view-component-button
74
- class="affine-database-toolbar-item new-record"
75
- .onClick="${this.onAddNewRecord}"
76
- .icon="${PlusIcon()}"
77
- .text="${IS_MOBILE
78
- ? html `<span style="font-weight: 500">New</span>`
79
- : html `<span style="font-weight: 500">New Record</span>`}"
80
- >
81
- </data-view-component-button>`;
82
- const opener = this.view.serviceGet(NewRowMenuOpenerKey);
83
- if (!opener || opener.canOpen?.(this.view.id) === false)
84
- return button;
85
- const label = opener.label();
86
- return html `<div class="new-record-split">
141
+ render() {
142
+ if (this.readonly$.value) {
143
+ return;
144
+ }
145
+ const wording = wordingOf(this.std);
146
+ const button = IS_MOBILE
147
+ ? html `<button
148
+ class="new-record-phone"
149
+ data-testid="dv-tools-new-row"
150
+ aria-label="${wording(DATA_VIEW_NEW_PAGE)}"
151
+ title="${wording(DATA_VIEW_NEW_PAGE)}"
152
+ @click="${this.onAddNewRecord}"
153
+ >
154
+ ${PlusIcon()}
155
+ </button>`
156
+ : html ` <data-view-component-button
157
+ class="affine-database-toolbar-item new-record"
158
+ .onClick="${this.onAddNewRecord}"
159
+ .icon="${PlusIcon()}"
160
+ .text="${html `<span style="font-weight: 500"
161
+ >${wording(DATA_VIEW_NEW_RECORD)}</span
162
+ >`}"
163
+ >
164
+ </data-view-component-button>`;
165
+ const opener = this.view.serviceGet(NewRowMenuOpenerKey);
166
+ if (!opener || opener.canOpen?.(this.view.id) === false)
167
+ return button;
168
+ const label = opener.label();
169
+ return html `<div class="new-record-split">
87
170
  ${button}
88
171
  <data-view-component-button
89
172
  class="affine-database-toolbar-item new-record-more"
@@ -97,5 +180,25 @@ export class DataViewHeaderToolsAddRow extends WidgetBase {
97
180
  >
98
181
  </data-view-component-button>
99
182
  </div>`;
100
- }
101
- }
183
+ }
184
+ constructor() {
185
+ super(...arguments);
186
+ this.onAddNewRecord = () => {
187
+ if (this.readonly$.value)
188
+ return;
189
+ this.dataViewLogic.addRow?.('start');
190
+ };
191
+ this.onOpenMenu = (event) => {
192
+ event.stopPropagation();
193
+ if (this.readonly$.value)
194
+ return;
195
+ this.view
196
+ .serviceGet(NewRowMenuOpenerKey)
197
+ ?.open(event.currentTarget, this.view.id);
198
+ };
199
+ this.#std_accessor_storage = __runInitializers(this, _std_initializers, void 0);
200
+ __runInitializers(this, _std_extraInitializers);
201
+ }
202
+ };
203
+ })();
204
+ export { DataViewHeaderToolsAddRow };
@@ -33,6 +33,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
33
33
  return useValue ? value : void 0;
34
34
  };
35
35
  import { menu, popMenu, popupTargetFromElement, } from '../../../../../affine-components/context-menu/index.js';
36
+ import { TOOLBAR_DELETE, TOOLBAR_DUPLICATE, } from '../../../../../affine-shared/services/index.js';
36
37
  import { unsafeCSSVarV2 } from '../../../../../affine-shared/theme/index.js';
37
38
  import { ArrowRightSmallIcon, DeleteIcon, DuplicateIcon, FilterIcon, GroupingIcon, InfoIcon, LayoutIcon, MoreHorizontalIcon, OpenInNewIcon, PaletteIcon, SortIcon, } from '@blocksuite/icons/lit';
38
39
  import { stdContext } from '../../../../../std/index.js';
@@ -48,8 +49,9 @@ import { englishWording, wordingOf, } from '../../../../core/utils/wording.js';
48
49
  import { WidgetBase } from '../../../../core/widget/widget-base.js';
49
50
  import { popFilterRoot } from '../../../quick-setting-bar/filter/root-panel-view.js';
50
51
  import { popSortRoot } from '../../../quick-setting-bar/sort/root-panel.js';
51
- import { DATA_VIEW_COLOR_RULES, DATA_VIEW_OPEN_IN, } from '../../../../translations.js';
52
+ import { DATA_VIEW_COLOR_RULES, DATA_VIEW_FILTER, DATA_VIEW_FILTER_COUNT, DATA_VIEW_GROUP, DATA_VIEW_LAYOUT, DATA_VIEW_OPEN_IN, DATA_VIEW_PROPERTIES, DATA_VIEW_PROPERTIES_SHOWN, DATA_VIEW_SORT, DATA_VIEW_SORT_COUNT, DATA_VIEW_VIEW_SETTINGS, VIEWS_BAR_VIEW_NAME, } from '../../../../translations.js';
52
53
  import { viewColorRules } from '../../../../core/view/color-rules.js';
54
+ import { viewPresetName } from '../../../../core/view/default-name.js';
53
55
  import { openInCurrent, openInOptions, openViewSetting, popViewSetting, viewSettingAvailable, } from './view-settings.js';
54
56
  const styles = css `
55
57
  .affine-database-toolbar-item.more-action {
@@ -72,6 +74,15 @@ const styles = css `
72
74
  .more-action.active {
73
75
  background: var(--affine-hover-color);
74
76
  }
77
+
78
+ /* A finger needs 44px: the host's touch-target floor (P7). */
79
+ @media (pointer: coarse) {
80
+ .affine-database-toolbar-item.more-action {
81
+ min-width: 44px;
82
+ min-height: 44px;
83
+ justify-content: center;
84
+ }
85
+ }
75
86
  `;
76
87
  let DataViewHeaderToolsViewOptions = (() => {
77
88
  let _classSuper = WidgetBase;
@@ -153,10 +164,12 @@ const createSettingMenus = (target, dataViewLogic, reopen, wording) => {
153
164
  const view = dataViewLogic.view;
154
165
  const settingItems = [];
155
166
  settingItems.push(menu.action({
156
- name: 'Properties',
167
+ name: wording(DATA_VIEW_PROPERTIES),
157
168
  prefix: InfoIcon(),
158
169
  postfix: html ` <div style="font-size: 14px;">
159
- ${view.properties$.value.length} shown
170
+ ${wording(DATA_VIEW_PROPERTIES_SHOWN, {
171
+ count: view.properties$.value.length,
172
+ })}
160
173
  </div>
161
174
  ${ArrowRightSmallIcon()}`,
162
175
  select: () => {
@@ -167,14 +180,12 @@ const createSettingMenus = (target, dataViewLogic, reopen, wording) => {
167
180
  if (filterTrait) {
168
181
  const filterCount = filterTrait.filter$.value.conditions.length;
169
182
  settingItems.push(menu.action({
170
- name: 'Filter',
183
+ name: wording(DATA_VIEW_FILTER),
171
184
  prefix: FilterIcon(),
172
185
  postfix: html ` <div style="font-size: 14px;">
173
186
  ${filterCount === 0
174
187
  ? ''
175
- : filterCount === 1
176
- ? '1 filter'
177
- : `${filterCount} filters`}
188
+ : wording(DATA_VIEW_FILTER_COUNT, { count: filterCount })}
178
189
  </div>
179
190
  ${ArrowRightSmallIcon()}`,
180
191
  select: () => {
@@ -210,14 +221,12 @@ const createSettingMenus = (target, dataViewLogic, reopen, wording) => {
210
221
  if (sortTrait) {
211
222
  const sortCount = sortTrait.sortList$.value.length;
212
223
  settingItems.push(menu.action({
213
- name: 'Sort',
224
+ name: wording(DATA_VIEW_SORT),
214
225
  prefix: SortIcon(),
215
226
  postfix: html ` <div style="font-size: 14px;">
216
227
  ${sortCount === 0
217
228
  ? ''
218
- : sortCount === 1
219
- ? '1 sort'
220
- : `${sortCount} sorts`}
229
+ : wording(DATA_VIEW_SORT_COUNT, { count: sortCount })}
221
230
  </div>
222
231
  ${ArrowRightSmallIcon()}`,
223
232
  select: () => {
@@ -233,7 +242,7 @@ const createSettingMenus = (target, dataViewLogic, reopen, wording) => {
233
242
  popSortRoot(target, {
234
243
  sortUtils: sortUtils,
235
244
  title: {
236
- text: 'Sort',
245
+ text: wording(DATA_VIEW_SORT),
237
246
  onBack: reopen,
238
247
  },
239
248
  });
@@ -244,7 +253,7 @@ const createSettingMenus = (target, dataViewLogic, reopen, wording) => {
244
253
  const groupTrait = view.traitGet(groupTraitKey);
245
254
  if (groupTrait) {
246
255
  settingItems.push(menu.action({
247
- name: 'Group',
256
+ name: wording(DATA_VIEW_GROUP),
248
257
  prefix: GroupingIcon(),
249
258
  postfix: html ` <div style="font-size: 14px;">
250
259
  ${groupTrait.property$.value?.name$.value ?? ''}
@@ -278,10 +287,11 @@ export const popViewOptions = (target, dataViewLogic, onClose, wording = english
278
287
  const reopen = () => {
279
288
  popViewOptions(target, dataViewLogic, undefined, wording);
280
289
  };
290
+ const currentLayout = view.manager.viewMetas.find(meta => meta.type === view.type);
281
291
  const items = [];
282
292
  items.push(menu.input({
283
293
  initialValue: view.name$.value,
284
- placeholder: 'View name',
294
+ placeholder: wording(VIEWS_BAR_VIEW_NAME),
285
295
  onChange: text => {
286
296
  view.nameSet(text);
287
297
  },
@@ -289,11 +299,9 @@ export const popViewOptions = (target, dataViewLogic, onClose, wording = english
289
299
  items.push(menu.group({
290
300
  items: [
291
301
  menu.action({
292
- name: 'Layout',
293
- postfix: html ` <div
294
- style="font-size: 14px;text-transform: capitalize;"
295
- >
296
- ${view.type}
302
+ name: wording(DATA_VIEW_LAYOUT),
303
+ postfix: html ` <div style="font-size: 14px;">
304
+ ${currentLayout ? viewPresetName(currentLayout, wording) : ''}
297
305
  </div>
298
306
  ${ArrowRightSmallIcon()}`,
299
307
  select: () => {
@@ -309,14 +317,14 @@ export const popViewOptions = (target, dataViewLogic, onClose, wording = english
309
317
  items.push(menu.group({
310
318
  items: [
311
319
  menu.action({
312
- name: 'Duplicate',
320
+ name: wording(TOOLBAR_DUPLICATE),
313
321
  prefix: DuplicateIcon(),
314
322
  select: () => {
315
323
  view.duplicate();
316
324
  },
317
325
  }),
318
326
  menu.action({
319
- name: 'Delete',
327
+ name: wording(TOOLBAR_DELETE),
320
328
  prefix: DeleteIcon(),
321
329
  select: () => {
322
330
  view.delete();
@@ -328,7 +336,7 @@ export const popViewOptions = (target, dataViewLogic, onClose, wording = english
328
336
  popMenu(target, {
329
337
  options: {
330
338
  title: {
331
- text: 'View settings',
339
+ text: wording(DATA_VIEW_VIEW_SETTINGS),
332
340
  },
333
341
  items,
334
342
  onClose: onClose,
@@ -8,8 +8,9 @@ import { popGroupSetting, popSelectGroupByProperty, } from '../../../../core/gro
8
8
  import { groupTraitKey } from '../../../../core/group-by/trait.js';
9
9
  import { renderUniLit, } from '../../../../core/index.js';
10
10
  import { rowsArePages, viewOpenIn, viewOpenInSet, } from '../../../../core/view/open-in.js';
11
+ import { viewPresetName } from '../../../../core/view/default-name.js';
11
12
  import { PropertiesPanelOpenerKey } from '../../../../core/view-manager/properties-panel-opener.js';
12
- import { DATA_VIEW_OPEN_IN, DATA_VIEW_OPEN_IN_CENTER, DATA_VIEW_OPEN_IN_FULL, DATA_VIEW_OPEN_IN_SIDE, } from '../../../../translations.js';
13
+ import { DATA_VIEW_LAYOUT, DATA_VIEW_OPEN_IN, DATA_VIEW_OPEN_IN_CENTER, DATA_VIEW_OPEN_IN_FULL, DATA_VIEW_OPEN_IN_SIDE, } from '../../../../translations.js';
13
14
  import { popColorRules } from './color-rules-menu.js';
14
15
  /** The three places a row's page opens, in the stored order (ADR 0035 §8). */
15
16
  const OPEN_IN_CHOICES = [
@@ -66,11 +67,12 @@ export function openInOptions(dataViewLogic, reopen, wording) {
66
67
  })),
67
68
  };
68
69
  }
69
- function popLayout(target, dataViewLogic, reopen) {
70
+ function popLayout(target, dataViewLogic, reopen, wording) {
70
71
  const view = dataViewLogic.view;
71
72
  const viewTypes = view.manager.viewMetas.map(meta => {
73
+ const name = viewPresetName(meta, wording);
72
74
  return menu => {
73
- if (!menu.search(meta.model.defaultName)) {
75
+ if (!menu.search(name)) {
74
76
  return;
75
77
  }
76
78
  const isSelected = meta.type === view.manager.currentView$.value?.type;
@@ -93,7 +95,7 @@ function popLayout(target, dataViewLogic, reopen) {
93
95
  style="color:var(--affine-text-emphasis-color);width:100%;display: flex;flex-direction: column;align-items: center;justify-content: center;padding: 6px 16px;white-space: nowrap"
94
96
  >
95
97
  <div style="${iconStyle}">${renderUniLit(meta.renderer.icon)}</div>
96
- <div style="${textStyle}">${meta.model.defaultName}</div>
98
+ <div style="${textStyle}">${name}</div>
97
99
  </div>
98
100
  `,
99
101
  select: () => {
@@ -126,7 +128,7 @@ function popLayout(target, dataViewLogic, reopen) {
126
128
  options: {
127
129
  title: {
128
130
  onBack: reopen,
129
- text: 'Layout',
131
+ text: wording(DATA_VIEW_LAYOUT),
130
132
  },
131
133
  items: [
132
134
  menu => {
@@ -158,7 +160,7 @@ export function openViewSetting(target, dataViewLogic, key, reopen, wording) {
158
160
  const view = dataViewLogic.view;
159
161
  switch (key) {
160
162
  case 'layout':
161
- popLayout(target, dataViewLogic, reopen);
163
+ popLayout(target, dataViewLogic, reopen, wording);
162
164
  return;
163
165
  case 'properties': {
164
166
  const openPanel = view.serviceGet(PropertiesPanelOpenerKey);