@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
@@ -259,7 +259,11 @@ let TableRowView = (() => {
259
259
  ${!column.readonly$.value &&
260
260
  column.view.mainProperties$.value.titleColumn === column.id
261
261
  ? html `<div class="row-ops show-on-hover-row">
262
- <div class="row-op" @click="${clickDetail}">
262
+ <div
263
+ class="row-op"
264
+ data-testid="dv-row-open"
265
+ @click="${clickDetail}"
266
+ >
263
267
  ${CenterPeekIcon()}
264
268
  </div>
265
269
  ${!view.readonly$.value
@@ -1,4 +1,3 @@
1
- import { IS_MOBILE } from '../../../../global/env/index.js';
2
1
  import { html } from 'lit';
3
2
  import { filterTraitKey } from '../../../core/filter/trait.js';
4
3
  export const renderFilterBar = (props) => {
@@ -6,7 +5,7 @@ export const renderFilterBar = (props) => {
6
5
  if (!filterTrait) {
7
6
  return;
8
7
  }
9
- if (!IS_MOBILE && !filterTrait.hasFilter$.value) {
8
+ if (!filterTrait.hasFilter$.value) {
10
9
  return;
11
10
  }
12
11
  return html ` <filter-bar
@@ -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,5 +1,4 @@
1
1
  import { unsafeCSSVarV2 } from '../../../affine-shared/theme/index.js';
2
- import { IS_MOBILE } from '../../../global/env/index.js';
3
2
  import { html, nothing } from 'lit';
4
3
  import { defineUniComponent, } from '../../core/index.js';
5
4
  import { createDefaultShowQuickSettingBar, ShowQuickSettingBarKey, } from './context.js';
@@ -8,13 +7,14 @@ import { renderSortBar } from './sort/index.js';
8
7
  export const widgetQuickSettingBar = defineUniComponent((props) => {
9
8
  const view = props.dataViewLogic.view;
10
9
  const barList = [renderSortBar(props), renderFilterBar(props)].filter(Boolean);
11
- if (!IS_MOBILE) {
12
- if (!view.serviceGetOrCreate(ShowQuickSettingBarKey, createDefaultShowQuickSettingBar).value[view.id]) {
13
- return html ``;
14
- }
15
- if (!barList.length) {
16
- return html ``;
17
- }
10
+ // The same rule on a phone since its toolbar has the filter and sort
11
+ // buttons (P7): up to 0.54 the bar stood there on every phone, empty but
12
+ // for "+ Add filter", as the only way to filter.
13
+ if (!view.serviceGetOrCreate(ShowQuickSettingBarKey, createDefaultShowQuickSettingBar).value[view.id]) {
14
+ return html ``;
15
+ }
16
+ if (!barList.length) {
17
+ return html ``;
18
18
  }
19
19
  return html ` <div
20
20
  style="display: flex;margin-top: 8px;align-items: center;width: 100%;gap:8px"
@@ -1,3 +1,4 @@
1
+ import { type BlockStdScope } from '../../../../../std/index.js';
1
2
  import { nothing } from 'lit';
2
3
  import { WidgetBase } from '../../../../core/widget/widget-base.js';
3
4
  export declare class DataViewHeaderToolsFilter extends WidgetBase {
@@ -8,6 +9,8 @@ export declare class DataViewHeaderToolsFilter extends WidgetBase {
8
9
  get filterTrait(): import("../../../../core/filter/trait.js").FilterTrait | undefined;
9
10
  private get readonly();
10
11
  private clickFilter;
12
+ /** Absent outside an editor host: the wordings read English. */
13
+ accessor std: BlockStdScope;
11
14
  connectedCallback(): void;
12
15
  render(): import("lit-html").TemplateResult<1> | typeof nothing;
13
16
  toggleShowFilter(show?: boolean): void;
@@ -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 { FilterIcon } 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 { popCreateFilter } from '../../../../core/filter/add-filter.js';
9
44
  import { filterTraitKey } from '../../../../core/filter/trait.js';
10
45
  import { emptyFilterGroup } from '../../../../core/filter/utils.js';
46
+ import { wordingOf } from '../../../../core/utils/wording.js';
11
47
  import { WidgetBase } from '../../../../core/widget/widget-base.js';
48
+ import { DATA_VIEW_FILTER } from '../../../../translations.js';
12
49
  import { createDefaultShowQuickSettingBar, ShowQuickSettingBarKey, } from '../../../quick-setting-bar/context.js';
13
50
  const styles = css `
14
51
  .affine-database-filter-button {
@@ -27,72 +64,100 @@ const styles = css `
27
64
  background-color: var(--affine-hover-color);
28
65
  }
29
66
 
30
- .affine-database-filter-button {
67
+ /* Shown on a phone too, its menus as sheets: 44px for a finger (P7). */
68
+ @media (pointer: coarse) {
69
+ .affine-database-filter-button {
70
+ min-width: 44px;
71
+ min-height: 44px;
72
+ justify-content: center;
73
+ }
31
74
  }
32
75
  `;
33
- export class DataViewHeaderToolsFilter extends WidgetBase {
34
- constructor() {
35
- super(...arguments);
36
- this.hasFilter = computed(() => {
37
- return this.filterTrait?.hasFilter$.value ?? false;
38
- });
39
- }
40
- static { this.styles = styles; }
41
- get _filter() {
42
- return this.filterTrait?.filter$.value ?? emptyFilterGroup;
43
- }
44
- set _filter(filter) {
45
- this.filterTrait?.filterSet(filter);
46
- }
47
- get filterTrait() {
48
- return this.view.traitGet(filterTraitKey);
49
- }
50
- get readonly() {
51
- return this.view.readonly$.value;
52
- }
53
- clickFilter(event) {
54
- if (this.hasFilter.value) {
55
- this.toggleShowFilter();
76
+ let DataViewHeaderToolsFilter = (() => {
77
+ let _classSuper = WidgetBase;
78
+ let _std_decorators;
79
+ let _std_initializers = [];
80
+ let _std_extraInitializers = [];
81
+ return class DataViewHeaderToolsFilter extends _classSuper {
82
+ static {
83
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
84
+ _std_decorators = [consume({ context: stdContext })];
85
+ __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);
86
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
87
+ }
88
+ static { this.styles = styles; }
89
+ get _filter() {
90
+ return this.filterTrait?.filter$.value ?? emptyFilterGroup;
91
+ }
92
+ set _filter(filter) {
93
+ this.filterTrait?.filterSet(filter);
94
+ }
95
+ get filterTrait() {
96
+ return this.view.traitGet(filterTraitKey);
97
+ }
98
+ get readonly() {
99
+ return this.view.readonly$.value;
100
+ }
101
+ clickFilter(event) {
102
+ if (this.hasFilter.value) {
103
+ this.toggleShowFilter();
104
+ return;
105
+ }
106
+ popCreateFilter(popupTargetFromElement(event.currentTarget), {
107
+ vars: this.view.vars$,
108
+ onSelect: filter => {
109
+ this._filter = {
110
+ ...this._filter,
111
+ conditions: [filter],
112
+ };
113
+ this.toggleShowFilter(true);
114
+ this.dataViewLogic.eventTrace('CreateDatabaseFilter', {});
115
+ },
116
+ });
56
117
  return;
57
118
  }
58
- popCreateFilter(popupTargetFromElement(event.currentTarget), {
59
- vars: this.view.vars$,
60
- onSelect: filter => {
61
- this._filter = {
62
- ...this._filter,
63
- conditions: [filter],
64
- };
65
- this.toggleShowFilter(true);
66
- this.dataViewLogic.eventTrace('CreateDatabaseFilter', {});
67
- },
68
- });
69
- return;
70
- }
71
- connectedCallback() {
72
- super.connectedCallback();
73
- this.style.display = IS_MOBILE ? 'none' : 'flex';
74
- }
75
- render() {
76
- if (this.readonly)
77
- return nothing;
78
- const style = styleMap({
79
- color: this.hasFilter.value
80
- ? cssVarV2('text/emphasis')
81
- : cssVarV2('icon/primary'),
82
- });
83
- return html ` <div
119
+ #std_accessor_storage;
120
+ /** Absent outside an editor host: the wordings read English. */
121
+ get std() { return this.#std_accessor_storage; }
122
+ set std(value) { this.#std_accessor_storage = value; }
123
+ connectedCallback() {
124
+ super.connectedCallback();
125
+ this.style.display = 'flex';
126
+ }
127
+ render() {
128
+ if (this.readonly)
129
+ return nothing;
130
+ const style = styleMap({
131
+ color: this.hasFilter.value
132
+ ? cssVarV2('text/emphasis')
133
+ : cssVarV2('icon/primary'),
134
+ });
135
+ return html ` <div
84
136
  @click="${this.clickFilter}"
85
137
  style="${style}"
86
138
  class="affine-database-filter-button"
139
+ data-testid="dv-tools-filter"
140
+ role="button"
141
+ aria-label="${wordingOf(this.std)(DATA_VIEW_FILTER)}"
87
142
  >
88
143
  ${FilterIcon()}
89
144
  </div>`;
90
- }
91
- toggleShowFilter(show) {
92
- const map = this.view.serviceGetOrCreate(ShowQuickSettingBarKey, createDefaultShowQuickSettingBar);
93
- map.value = {
94
- ...map.value,
95
- [this.view.id]: show ?? !map.value[this.view.id],
96
- };
97
- }
98
- }
145
+ }
146
+ toggleShowFilter(show) {
147
+ const map = this.view.serviceGetOrCreate(ShowQuickSettingBarKey, createDefaultShowQuickSettingBar);
148
+ map.value = {
149
+ ...map.value,
150
+ [this.view.id]: show ?? !map.value[this.view.id],
151
+ };
152
+ }
153
+ constructor() {
154
+ super(...arguments);
155
+ this.hasFilter = computed(() => {
156
+ return this.filterTrait?.hasFilter$.value ?? false;
157
+ });
158
+ this.#std_accessor_storage = __runInitializers(this, _std_initializers, void 0);
159
+ __runInitializers(this, _std_extraInitializers);
160
+ }
161
+ };
162
+ })();
163
+ export { DataViewHeaderToolsFilter };
@@ -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,3 +1,4 @@
1
+ import { type BlockStdScope } from '../../../../../std/index.js';
1
2
  import { nothing } from 'lit';
2
3
  import { WidgetBase } from '../../../../core/widget/widget-base.js';
3
4
  export declare class DataViewHeaderToolsSort extends WidgetBase {
@@ -6,6 +7,8 @@ export declare class DataViewHeaderToolsSort extends WidgetBase {
6
7
  hasSort: import("@preact/signals-core").ReadonlySignal<boolean>;
7
8
  private get readonly();
8
9
  private clickSort;
10
+ /** Absent outside an editor host: the wordings read English. */
11
+ accessor std: BlockStdScope;
9
12
  connectedCallback(): void;
10
13
  render(): import("lit-html").TemplateResult<1> | typeof nothing;
11
14
  toggleShowQuickSettingBar(show?: boolean): void;