@formicoidea/labre-core 0.53.0 → 0.54.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 (85) 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 +47 -0
  66. package/dist/_pkgs/data-view/translations.js +124 -0
  67. package/dist/_pkgs/data-view/view-presets/table/mobile/column-header.d.ts +3 -1
  68. package/dist/_pkgs/data-view/view-presets/table/mobile/column-header.js +102 -124
  69. package/dist/_pkgs/data-view/view-presets/table/mobile/group.js +4 -2
  70. package/dist/_pkgs/data-view/view-presets/table/mobile/header.js +17 -9
  71. package/dist/_pkgs/data-view/view-presets/table/mobile/row.js +20 -11
  72. package/dist/_pkgs/data-view/view-presets/table/mobile/table-view-style.d.ts +17 -0
  73. package/dist/_pkgs/data-view/view-presets/table/mobile/table-view-style.js +31 -6
  74. package/dist/_pkgs/data-view/view-presets/table/mobile/table-view-ui-logic.js +2 -2
  75. package/dist/_pkgs/data-view/view-presets/table/pc/group.js +4 -2
  76. package/dist/_pkgs/data-view/widget-presets/quick-setting-bar/filter/list-view.d.ts +3 -1
  77. package/dist/_pkgs/data-view/widget-presets/quick-setting-bar/filter/list-view.js +23 -3
  78. package/dist/_pkgs/data-view/widget-presets/tools/presets/search/search.d.ts +3 -0
  79. package/dist/_pkgs/data-view/widget-presets/tools/presets/search/search.js +37 -5
  80. package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.d.ts +3 -0
  81. package/dist/_pkgs/data-view/widget-presets/tools/presets/table-add-row/add-row.js +99 -35
  82. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.js +30 -22
  83. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.js +8 -6
  84. package/dist/_pkgs/data-view/widget-presets/views-bar/views-view.js +15 -0
  85. package/package.json +1 -1
@@ -48,7 +48,7 @@ import { createDndContext } from '../../../core/utils/wc-dnd/dnd-context.js';
48
48
  import { defaultActivators } from '../../../core/utils/wc-dnd/sensors/index.js';
49
49
  import { linearMove } from '../../../core/utils/wc-dnd/utils/linear-move.js';
50
50
  import { wordingOf } from '../../../core/utils/wording.js';
51
- import { DATA_VIEW_GROUP_COLLAPSE, DATA_VIEW_GROUP_EXPAND, } from '../../../translations.js';
51
+ import { DATA_VIEW_GROUP_COLLAPSE, DATA_VIEW_GROUP_EXPAND, DATA_VIEW_NEW_RECORD, } from '../../../translations.js';
52
52
  import { getCollapsedState, setCollapsedState } from '../collapsed-state.js';
53
53
  import { LEFT_TOOL_BAR_WIDTH } from '../consts.js';
54
54
  import { TableViewAreaSelection } from '../selection.js';
@@ -193,7 +193,9 @@ let TableGroup = (() => {
193
193
  data-test-id="affine-database-add-row-button"
194
194
  role="button"
195
195
  >
196
- ${PlusIcon()}<span style="font-size: 12px">New Record</span>
196
+ ${PlusIcon()}<span style="font-size: 12px"
197
+ >${wordingOf(this.std)(DATA_VIEW_NEW_RECORD)}</span
198
+ >
197
199
  </div>
198
200
  </div>`}
199
201
  <affine-database-column-stats
@@ -1,4 +1,4 @@
1
- import { ShadowlessElement } from '../../../../std/index.js';
1
+ import { type BlockStdScope, ShadowlessElement } from '../../../../std/index.js';
2
2
  import { type ReadonlySignal } from '@preact/signals-core';
3
3
  import type { Variable } from '../../../core/expression/types.js';
4
4
  import type { Filter, FilterGroup } from '../../../core/filter/types.js';
@@ -22,6 +22,8 @@ export declare class FilterBar extends FilterBar_base {
22
22
  accessor onChange: (filter: FilterGroup) => void;
23
23
  accessor vars: ReadonlySignal<Variable[]>;
24
24
  accessor dataViewLogic: DataViewUILogicBase;
25
+ /** Absent outside an editor host: the wordings read English. */
26
+ accessor std: BlockStdScope;
25
27
  }
26
28
  declare global {
27
29
  interface HTMLElementTagNameMap {
@@ -35,11 +35,14 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
35
35
  import { popupTargetFromElement, } from '../../../../affine-components/context-menu/index.js';
36
36
  import { SignalWatcher } from '../../../../global/lit/index.js';
37
37
  import { ArrowDownSmallIcon, FilterIcon, PlusIcon, } from '@blocksuite/icons/lit';
38
- import { ShadowlessElement } from '../../../../std/index.js';
38
+ import { ShadowlessElement, stdContext } from '../../../../std/index.js';
39
+ import { consume } from '@lit/context';
39
40
  import { computed } from '@preact/signals-core';
40
41
  import { css, html } from 'lit';
41
42
  import { property } from 'lit/decorators.js';
42
43
  import { popCreateFilter } from '../../../core/index.js';
44
+ import { wordingOf } from '../../../core/utils/wording.js';
45
+ import { DATA_VIEW_ADD_FILTER } from '../../../translations.js';
43
46
  import { popFilterGroup } from './group-panel-view.js';
44
47
  let FilterBar = (() => {
45
48
  let _classSuper = SignalWatcher(ShadowlessElement);
@@ -55,6 +58,9 @@ let FilterBar = (() => {
55
58
  let _dataViewLogic_decorators;
56
59
  let _dataViewLogic_initializers = [];
57
60
  let _dataViewLogic_extraInitializers = [];
61
+ let _std_decorators;
62
+ let _std_initializers = [];
63
+ let _std_extraInitializers = [];
58
64
  return class FilterBar extends _classSuper {
59
65
  static {
60
66
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
@@ -62,10 +68,12 @@ let FilterBar = (() => {
62
68
  _onChange_decorators = [property({ attribute: false })];
63
69
  _vars_decorators = [property({ attribute: false })];
64
70
  _dataViewLogic_decorators = [property({ attribute: false })];
71
+ _std_decorators = [consume({ context: stdContext })];
65
72
  __esDecorate(this, null, _filterGroup_decorators, { kind: "accessor", name: "filterGroup", static: false, private: false, access: { has: obj => "filterGroup" in obj, get: obj => obj.filterGroup, set: (obj, value) => { obj.filterGroup = value; } }, metadata: _metadata }, _filterGroup_initializers, _filterGroup_extraInitializers);
66
73
  __esDecorate(this, null, _onChange_decorators, { kind: "accessor", name: "onChange", static: false, private: false, access: { has: obj => "onChange" in obj, get: obj => obj.onChange, set: (obj, value) => { obj.onChange = value; } }, metadata: _metadata }, _onChange_initializers, _onChange_extraInitializers);
67
74
  __esDecorate(this, null, _vars_decorators, { kind: "accessor", name: "vars", static: false, private: false, access: { has: obj => "vars" in obj, get: obj => obj.vars, set: (obj, value) => { obj.vars = value; } }, metadata: _metadata }, _vars_initializers, _vars_extraInitializers);
68
75
  __esDecorate(this, null, _dataViewLogic_decorators, { kind: "accessor", name: "dataViewLogic", static: false, private: false, access: { has: obj => "dataViewLogic" in obj, get: obj => obj.dataViewLogic, set: (obj, value) => { obj.dataViewLogic = value; } }, metadata: _metadata }, _dataViewLogic_initializers, _dataViewLogic_extraInitializers);
76
+ __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);
69
77
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
70
78
  }
71
79
  static { this.styles = css `
@@ -102,6 +110,13 @@ let FilterBar = (() => {
102
110
  line-height: 22px;
103
111
  }
104
112
 
113
+ /* A finger needs 44px: the host's touch-target floor (P7). */
114
+ @media (pointer: coarse) {
115
+ .filter-bar-add-filter {
116
+ min-height: 44px;
117
+ }
118
+ }
119
+
105
120
  filter-bar::-webkit-scrollbar {
106
121
  -webkit-appearance: none;
107
122
  display: block;
@@ -178,6 +193,10 @@ let FilterBar = (() => {
178
193
  #dataViewLogic_accessor_storage;
179
194
  get dataViewLogic() { return this.#dataViewLogic_accessor_storage; }
180
195
  set dataViewLogic(value) { this.#dataViewLogic_accessor_storage = value; }
196
+ #std_accessor_storage;
197
+ /** Absent outside an editor host: the wordings read English. */
198
+ get std() { return this.#std_accessor_storage; }
199
+ set std(value) { this.#std_accessor_storage = value; }
181
200
  constructor() {
182
201
  super(...arguments);
183
202
  this._setFilter = (index, filter) => {
@@ -232,7 +251,7 @@ let FilterBar = (() => {
232
251
  class="filter-bar-add-filter dv-icon-16 dv-round-4 dv-hover"
233
252
  @click="${this.addFilter}"
234
253
  >
235
- ${PlusIcon()} Add filter
254
+ ${PlusIcon()} ${wordingOf(this.std)(DATA_VIEW_ADD_FILTER)}
236
255
  </div>`;
237
256
  };
238
257
  this.setConditions = (conditions) => {
@@ -244,7 +263,8 @@ let FilterBar = (() => {
244
263
  this.#onChange_accessor_storage = __runInitializers(this, _onChange_initializers, void 0);
245
264
  this.#vars_accessor_storage = (__runInitializers(this, _onChange_extraInitializers), __runInitializers(this, _vars_initializers, void 0));
246
265
  this.#dataViewLogic_accessor_storage = (__runInitializers(this, _vars_extraInitializers), __runInitializers(this, _dataViewLogic_initializers, void 0));
247
- __runInitializers(this, _dataViewLogic_extraInitializers);
266
+ this.#std_accessor_storage = (__runInitializers(this, _dataViewLogic_extraInitializers), __runInitializers(this, _std_initializers, void 0));
267
+ __runInitializers(this, _std_extraInitializers);
248
268
  }
249
269
  };
250
270
  })();
@@ -1,3 +1,4 @@
1
+ import { type BlockStdScope } from '../../../../../std/index.js';
1
2
  import { WidgetBase } from '../../../../core/widget/widget-base.js';
2
3
  import type { KanbanViewUILogic } from '../../../../view-presets/kanban/pc/kanban-view-ui-logic.js';
3
4
  import type { VirtualTableViewUILogic } from '../../../../view-presets/table/pc-virtual/table-view-ui-logic.js';
@@ -9,6 +10,8 @@ export declare class DataViewHeaderToolsSearch extends WidgetBase<VirtualTableVi
9
10
  private readonly _onSearchBlur;
10
11
  private readonly _onSearchKeydown;
11
12
  preventBlur: boolean;
13
+ /** Absent outside an editor host: the wordings read English. */
14
+ accessor std: BlockStdScope;
12
15
  connectedCallback(): void;
13
16
  render(): import("lit-html").TemplateResult<1>;
14
17
  private accessor _searchInput;
@@ -33,15 +33,18 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
33
33
  return useValue ? value : void 0;
34
34
  };
35
35
  import { unsafeCSSVarV2 } from '../../../../../affine-shared/theme/index.js';
36
- import { IS_MOBILE } from '../../../../../global/env/index.js';
37
36
  import { CloseIcon, SearchIcon } from '@blocksuite/icons/lit';
37
+ import { stdContext } from '../../../../../std/index.js';
38
+ import { consume } from '@lit/context';
38
39
  import { baseTheme } from '@toeverything/theme';
39
40
  import { css, html, unsafeCSS } from 'lit';
40
41
  import { query, state } from 'lit/decorators.js';
41
42
  import { classMap } from 'lit/directives/class-map.js';
42
43
  import { styleMap } from 'lit/directives/style-map.js';
43
44
  import { stopPropagation } from '../../../../core/utils/event.js';
45
+ import { wordingOf } from '../../../../core/utils/wording.js';
44
46
  import { WidgetBase } from '../../../../core/widget/widget-base.js';
47
+ import { DATA_VIEW_SEARCH_CLEAR_HINT, DATA_VIEW_SEARCH_PLACEHOLDER, } from '../../../../translations.js';
45
48
  const styles = css `
46
49
  .affine-database-search-container {
47
50
  position: relative;
@@ -114,9 +117,29 @@ const styles = css `
114
117
  color: var(--affine-placeholder-color);
115
118
  font-size: var(--affine-font-sm);
116
119
  }
120
+
121
+ /* A finger needs 44px: the host's touch-target floor (P7). */
122
+ @media (pointer: coarse) {
123
+ .affine-database-search-container {
124
+ width: 44px;
125
+ height: 44px;
126
+ }
127
+ .search-container-expand {
128
+ width: 160px;
129
+ }
130
+ .affine-database-search-container .affine-database-search-input-icon {
131
+ left: 10px;
132
+ }
133
+ .affine-database-search-input {
134
+ padding-left: 40px;
135
+ }
136
+ }
117
137
  `;
118
138
  let DataViewHeaderToolsSearch = (() => {
119
139
  let _classSuper = WidgetBase;
140
+ let _std_decorators;
141
+ let _std_initializers = [];
142
+ let _std_extraInitializers = [];
120
143
  let __searchInput_decorators;
121
144
  let __searchInput_initializers = [];
122
145
  let __searchInput_extraInitializers = [];
@@ -126,16 +149,24 @@ let DataViewHeaderToolsSearch = (() => {
126
149
  return class DataViewHeaderToolsSearch extends _classSuper {
127
150
  static {
128
151
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
152
+ _std_decorators = [consume({ context: stdContext })];
129
153
  __searchInput_decorators = [query('.affine-database-search-input')];
130
154
  _showSearch_decorators = [state()];
155
+ __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
156
  __esDecorate(this, null, __searchInput_decorators, { kind: "accessor", name: "_searchInput", static: false, private: false, access: { has: obj => "_searchInput" in obj, get: obj => obj._searchInput, set: (obj, value) => { obj._searchInput = value; } }, metadata: _metadata }, __searchInput_initializers, __searchInput_extraInitializers);
132
157
  __esDecorate(this, null, _showSearch_decorators, { kind: "accessor", name: "showSearch", static: false, private: false, access: { has: obj => "showSearch" in obj, get: obj => obj.showSearch, set: (obj, value) => { obj.showSearch = value; } }, metadata: _metadata }, _showSearch_initializers, _showSearch_extraInitializers);
133
158
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
134
159
  }
135
160
  static { this.styles = styles; }
161
+ #std_accessor_storage;
162
+ /** Absent outside an editor host: the wordings read English. */
163
+ get std() { return this.#std_accessor_storage; }
164
+ set std(value) { this.#std_accessor_storage = value; }
136
165
  connectedCallback() {
137
166
  super.connectedCallback();
138
- this.style.display = IS_MOBILE ? 'none' : 'flex';
167
+ // Filter and sort reach a phone through the view menu; search has no
168
+ // other door, so it stays in the toolbar there too.
169
+ this.style.display = 'flex';
139
170
  }
140
171
  render() {
141
172
  const searchToolClassMap = classMap({
@@ -147,7 +178,7 @@ let DataViewHeaderToolsSearch = (() => {
147
178
  <label class="${searchToolClassMap}" @click="${this._clickSearch}">
148
179
  <div class="affine-database-search-input-icon">${SearchIcon()}</div>
149
180
  <input
150
- placeholder="Search..."
181
+ placeholder="${wordingOf(this.std)(DATA_VIEW_SEARCH_PLACEHOLDER)}"
151
182
  class="affine-database-search-input"
152
183
  @input="${this._onSearch}"
153
184
  @click="${(event) => event.stopPropagation()}"
@@ -169,7 +200,7 @@ let DataViewHeaderToolsSearch = (() => {
169
200
  })}
170
201
  >Esc</span
171
202
  >
172
- to clear all
203
+ ${wordingOf(this.std)(DATA_VIEW_SEARCH_CLEAR_HINT)}
173
204
  </affine-tooltip>
174
205
  </div>
175
206
  </label>
@@ -218,7 +249,8 @@ let DataViewHeaderToolsSearch = (() => {
218
249
  }
219
250
  };
220
251
  this.preventBlur = false;
221
- this.#_searchInput_accessor_storage = __runInitializers(this, __searchInput_initializers, void 0);
252
+ this.#std_accessor_storage = __runInitializers(this, _std_initializers, void 0);
253
+ this.#_searchInput_accessor_storage = (__runInitializers(this, _std_extraInitializers), __runInitializers(this, __searchInput_initializers, void 0));
222
254
  this.#showSearch_accessor_storage = (__runInitializers(this, __searchInput_extraInitializers), __runInitializers(this, _showSearch_initializers, false));
223
255
  __runInitializers(this, _showSearch_extraInitializers);
224
256
  }
@@ -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,59 @@
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_RECORD, DATA_VIEW_NEW_RECORD_SHORT, } 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
+
12
57
  .new-record svg {
13
58
  font-size: 20px;
14
59
  color: ${unsafeCSSVarV2('icon/primary')};
@@ -45,45 +90,44 @@ const styles = css `
45
90
  }
46
91
  }
47
92
  `;
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;
93
+ let DataViewHeaderToolsAddRow = (() => {
94
+ let _classSuper = WidgetBase;
95
+ let _std_decorators;
96
+ let _std_initializers = [];
97
+ let _std_extraInitializers = [];
98
+ return class DataViewHeaderToolsAddRow extends _classSuper {
99
+ static {
100
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
101
+ _std_decorators = [consume({ context: stdContext })];
102
+ __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);
103
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
104
+ }
105
+ static { this.styles = styles; }
106
+ #std_accessor_storage;
107
+ /** Absent outside an editor host: the wordings read English. */
108
+ get std() { return this.#std_accessor_storage; }
109
+ set std(value) { this.#std_accessor_storage = value; }
110
+ get readonly$() {
111
+ return this.view.readonly$;
72
112
  }
73
- const button = html ` <data-view-component-button
113
+ render() {
114
+ if (this.readonly$.value) {
115
+ return;
116
+ }
117
+ const button = html ` <data-view-component-button
74
118
  class="affine-database-toolbar-item new-record"
75
119
  .onClick="${this.onAddNewRecord}"
76
120
  .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>`}"
121
+ .text="${html `<span style="font-weight: 500"
122
+ >${wordingOf(this.std)(IS_MOBILE ? DATA_VIEW_NEW_RECORD_SHORT : DATA_VIEW_NEW_RECORD)}</span
123
+ >`}"
80
124
  >
81
125
  </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">
126
+ const opener = this.view.serviceGet(NewRowMenuOpenerKey);
127
+ if (!opener || opener.canOpen?.(this.view.id) === false)
128
+ return button;
129
+ const label = opener.label();
130
+ return html `<div class="new-record-split">
87
131
  ${button}
88
132
  <data-view-component-button
89
133
  class="affine-database-toolbar-item new-record-more"
@@ -97,5 +141,25 @@ export class DataViewHeaderToolsAddRow extends WidgetBase {
97
141
  >
98
142
  </data-view-component-button>
99
143
  </div>`;
100
- }
101
- }
144
+ }
145
+ constructor() {
146
+ super(...arguments);
147
+ this.onAddNewRecord = () => {
148
+ if (this.readonly$.value)
149
+ return;
150
+ this.dataViewLogic.addRow?.('start');
151
+ };
152
+ this.onOpenMenu = (event) => {
153
+ event.stopPropagation();
154
+ if (this.readonly$.value)
155
+ return;
156
+ this.view
157
+ .serviceGet(NewRowMenuOpenerKey)
158
+ ?.open(event.currentTarget, this.view.id);
159
+ };
160
+ this.#std_accessor_storage = __runInitializers(this, _std_initializers, void 0);
161
+ __runInitializers(this, _std_extraInitializers);
162
+ }
163
+ };
164
+ })();
165
+ 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);
@@ -96,11 +96,26 @@ let DataViewHeaderViews = (() => {
96
96
  min-height: ${VIEWS_BAR_TOUCH_TARGET}px;
97
97
  min-width: ${VIEWS_BAR_TOUCH_TARGET}px;
98
98
  }
99
+ data-view-header-views component-overflow {
100
+ flex-wrap: nowrap;
101
+ }
102
+ /* The current view's tab is drawn even when it is wider than the room
103
+ (fitOverflow): it gives way, clipped, instead of wrapping "N more" and
104
+ "+" onto the filter bar below a bar of fixed height (P7, 390px). */
99
105
  data-view-header-views .component-overflow-item {
100
106
  padding-right: 4px;
107
+ min-width: ${VIEWS_BAR_TOUCH_TARGET}px;
108
+ overflow: hidden;
109
+ }
110
+ /* The tab keeps its own width inside a narrowed item: the overflow
111
+ measures scrollWidth, and a tab that shrank with its item would
112
+ report room that is not there. */
113
+ data-view-header-views .component-overflow-item > * {
114
+ width: max-content;
101
115
  }
102
116
  data-view-header-views .component-overflow-more {
103
117
  gap: 4px;
118
+ flex-shrink: 0;
104
119
  }
105
120
  data-view-header-views::-webkit-scrollbar-thumb {
106
121
  width: 1px;