@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
@@ -2,7 +2,7 @@ import { type MenuConfig, type PopupTarget } from '../../../affine-components/co
2
2
  import { type Wording } from '../utils/wording.js';
3
3
  import type { Property } from '../view-manager/property.js';
4
4
  import type { SingleView } from '../view-manager/single-view.js';
5
- export declare const inputConfig: (property: Property) => (menu: import("../../../affine-components/context-menu/menu.js").Menu) => import("lit-html").TemplateResult<1> | undefined;
5
+ export declare const inputConfig: (property: Property, wording?: Wording) => (menu: import("../../../affine-components/context-menu/menu.js").Menu) => import("lit-html").TemplateResult<1> | undefined;
6
6
  export declare const typeConfig: (property: Property, wording?: Wording) => (menu: import("../../../affine-components/context-menu/menu.js").Menu, index: number) => import("lit-html").TemplateResult | undefined;
7
7
  /** What a property menu's opener adds around the shared entries. */
8
8
  export type PropertyMenuSlots = {
@@ -28,8 +28,8 @@ export type PropertyMenuSlots = {
28
28
  * ponytail: "Number Format" stays a table slot (its bar is a table/pc
29
29
  * element, behind `enable_number_formatting`, off in Labre), so the
30
30
  * properties list does not offer it. Move the bar to core and the entry into
31
- * this list when the flag ships. The virtual and mobile table headers still
32
- * spell their own copy of these entries; point them here in a dedicated pass.
31
+ * this list when the flag ships. The virtual table header still spells its
32
+ * own copy of these entries; point it here in a dedicated pass.
33
33
  */
34
34
  export declare const propertyMenuItems: (property: Property, slots?: PropertyMenuSlots) => MenuConfig[];
35
35
  export declare const popPropertyMenu: (target: PopupTarget, property: Property, slots?: PropertyMenuSlots) => import("../../../affine-components/context-menu/menu-renderer.js").MenuHandler;
@@ -2,10 +2,10 @@ import { menu, popMenu, } from '../../../affine-components/context-menu/index.js
2
2
  import { TOOLBAR_DELETE, TOOLBAR_DUPLICATE, } from '../../../affine-shared/services/index.js';
3
3
  import { DeleteIcon, DuplicateIcon, ViewIcon } from '@blocksuite/icons/lit';
4
4
  import { html } from 'lit/static-html.js';
5
- import { DATA_VIEW_PROPERTY_HIDE_IN_VIEW, DATA_VIEW_PROPERTY_TYPE, } from '../../translations.js';
5
+ import { DATA_VIEW_PROPERTY_HIDE_IN_VIEW, DATA_VIEW_PROPERTY_NAME, DATA_VIEW_PROPERTY_TYPE, DATA_VIEW_PROPERTY_TYPE_ENTRY, } from '../../translations.js';
6
6
  import { renderUniLit } from '../utils/uni-component/index.js';
7
7
  import { englishWording } from '../utils/wording.js';
8
- export const inputConfig = (property) => {
8
+ export const inputConfig = (property, wording = englishWording) => {
9
9
  return menu.input({
10
10
  prefix: html `
11
11
  <div class="affine-database-column-type-menu-icon">
@@ -13,7 +13,7 @@ export const inputConfig = (property) => {
13
13
  </div>
14
14
  `,
15
15
  initialValue: property.name$.value,
16
- placeholder: 'Property name',
16
+ placeholder: wording(DATA_VIEW_PROPERTY_NAME),
17
17
  // Persist on blur so the typed name survives the menu being dismissed by
18
18
  // a click outside, which never fires the completion path.
19
19
  onBlur: text => {
@@ -25,7 +25,7 @@ export const typeConfig = (property, wording = englishWording) => {
25
25
  return menu.group({
26
26
  items: [
27
27
  menu.subMenu({
28
- name: 'Type',
28
+ name: wording(DATA_VIEW_PROPERTY_TYPE_ENTRY),
29
29
  hide: () => !property.typeCanSet,
30
30
  postfix: html ` <div
31
31
  class="affine-database-column-type-icon"
@@ -75,13 +75,13 @@ export const typeConfig = (property, wording = englishWording) => {
75
75
  * ponytail: "Number Format" stays a table slot (its bar is a table/pc
76
76
  * element, behind `enable_number_formatting`, off in Labre), so the
77
77
  * properties list does not offer it. Move the bar to core and the entry into
78
- * this list when the flag ships. The virtual and mobile table headers still
79
- * spell their own copy of these entries; point them here in a dedicated pass.
78
+ * this list when the flag ships. The virtual table header still spells its
79
+ * own copy of these entries; point it here in a dedicated pass.
80
80
  */
81
81
  export const propertyMenuItems = (property, slots = {}) => {
82
82
  const wording = slots.wording ?? englishWording;
83
83
  return [
84
- inputConfig(property),
84
+ inputConfig(property, wording),
85
85
  typeConfig(property, wording),
86
86
  ...(slots.afterType ?? []),
87
87
  menu.group({
@@ -136,7 +136,10 @@ let Overflow = (() => {
136
136
  const moreWidth = moreButton?.getBoundingClientRect().width;
137
137
  if (moreWidth !== undefined)
138
138
  this.moreExtraWidth = moreWidth;
139
- const widths = Array.from(this.items, item => item.getBoundingClientRect().width);
139
+ // The natural width: a host may let a drawn item give way (the views
140
+ // bar clips its pinned tab), and a shrunk width fed back here would make
141
+ // room that is not there, then take it back, pass after pass.
142
+ const widths = Array.from(this.items, item => item.scrollWidth);
140
143
  const drawn = fitOverflow({
141
144
  widths,
142
145
  container: this.getBoundingClientRect().width,
@@ -1,10 +1,13 @@
1
- import { ShadowlessElement } from '../../../../std/index.js';
1
+ import { type BlockStdScope, ShadowlessElement } from '../../../../std/index.js';
2
2
  import type { Group } from '../trait.js';
3
3
  import type { GroupRenderProps } from '../types.js';
4
4
  declare const BaseGroup_base: typeof ShadowlessElement & import("../../../../global/utils/types.js").Constructor<import("../../../../global/lit/with-disposable.js").DisposableClass>;
5
5
  export declare class BaseGroup<JsonValue, Data extends Record<string, unknown>> extends BaseGroup_base implements GroupRenderProps<JsonValue, Data> {
6
6
  accessor group: Group<unknown, JsonValue, Data>;
7
7
  accessor readonly: boolean;
8
+ /** Absent outside an editor host: the wordings read English. */
9
+ accessor std: BlockStdScope;
10
+ get ungrouped(): string;
8
11
  updateData(data: Data): void;
9
12
  updateValue(value: JsonValue): void;
10
13
  get value(): JsonValue;
@@ -33,8 +33,11 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
33
33
  return useValue ? value : void 0;
34
34
  };
35
35
  import { SignalWatcher, WithDisposable } from '../../../../global/lit/index.js';
36
- import { ShadowlessElement } from '../../../../std/index.js';
36
+ import { ShadowlessElement, stdContext } from '../../../../std/index.js';
37
+ import { consume } from '@lit/context';
37
38
  import { property } from 'lit/decorators.js';
39
+ import { DATA_VIEW_UNGROUPED } from '../../../translations.js';
40
+ import { wordingOf } from '../../utils/wording.js';
38
41
  let BaseGroup = (() => {
39
42
  let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement));
40
43
  let _group_decorators;
@@ -43,13 +46,18 @@ let BaseGroup = (() => {
43
46
  let _readonly_decorators;
44
47
  let _readonly_initializers = [];
45
48
  let _readonly_extraInitializers = [];
49
+ let _std_decorators;
50
+ let _std_initializers = [];
51
+ let _std_extraInitializers = [];
46
52
  return class BaseGroup extends _classSuper {
47
53
  static {
48
54
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
49
55
  _group_decorators = [property({ attribute: false })];
50
56
  _readonly_decorators = [property({ attribute: false })];
57
+ _std_decorators = [consume({ context: stdContext })];
51
58
  __esDecorate(this, null, _group_decorators, { kind: "accessor", name: "group", static: false, private: false, access: { has: obj => "group" in obj, get: obj => obj.group, set: (obj, value) => { obj.group = value; } }, metadata: _metadata }, _group_initializers, _group_extraInitializers);
52
59
  __esDecorate(this, null, _readonly_decorators, { kind: "accessor", name: "readonly", static: false, private: false, access: { has: obj => "readonly" in obj, get: obj => obj.readonly, set: (obj, value) => { obj.readonly = value; } }, metadata: _metadata }, _readonly_initializers, _readonly_extraInitializers);
60
+ __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);
53
61
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
54
62
  }
55
63
  #group_accessor_storage = __runInitializers(this, _group_initializers, void 0);
@@ -58,6 +66,13 @@ let BaseGroup = (() => {
58
66
  #readonly_accessor_storage = (__runInitializers(this, _group_extraInitializers), __runInitializers(this, _readonly_initializers, void 0));
59
67
  get readonly() { return this.#readonly_accessor_storage; }
60
68
  set readonly(value) { this.#readonly_accessor_storage = value; }
69
+ #std_accessor_storage = (__runInitializers(this, _readonly_extraInitializers), __runInitializers(this, _std_initializers, void 0));
70
+ /** Absent outside an editor host: the wordings read English. */
71
+ get std() { return this.#std_accessor_storage; }
72
+ set std(value) { this.#std_accessor_storage = value; }
73
+ get ungrouped() {
74
+ return wordingOf(this.std)(DATA_VIEW_UNGROUPED);
75
+ }
61
76
  updateData(data) {
62
77
  this.group.manager.updateData(data);
63
78
  }
@@ -75,7 +90,7 @@ let BaseGroup = (() => {
75
90
  }
76
91
  constructor() {
77
92
  super(...arguments);
78
- __runInitializers(this, _readonly_extraInitializers);
93
+ __runInitializers(this, _std_extraInitializers);
79
94
  }
80
95
  };
81
96
  })();
@@ -40,7 +40,7 @@ export class NumberGroupView extends BaseGroup {
40
40
  `; }
41
41
  render() {
42
42
  if (this.value == null) {
43
- return html ` <div>Ungroups</div>`;
43
+ return html ` <div>${this.ungrouped}</div>`;
44
44
  }
45
45
  if (this.value >= 10) {
46
46
  return html ` <div
@@ -1,4 +1,3 @@
1
- import { type BlockStdScope } from '../../../../std/index.js';
2
1
  import type { SelectTag } from '../../logical/index.js';
3
2
  import { BaseGroup } from './base.js';
4
3
  export declare class SelectGroupView extends BaseGroup<string, {
@@ -6,8 +5,6 @@ export declare class SelectGroupView extends BaseGroup<string, {
6
5
  }> {
7
6
  static styles: import("lit").CSSResult;
8
7
  private readonly _click;
9
- /** Absent outside an editor host: the colour names read English. */
10
- accessor std: BlockStdScope;
11
8
  get tag(): {
12
9
  id: string;
13
10
  value: string;
@@ -1,59 +1,41 @@
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
- };
35
1
  import { menu, popMenu, popupTargetFromElement, } from '../../../../affine-components/context-menu/index.js';
36
- import { stdContext } from '../../../../std/index.js';
37
- import { consume } from '@lit/context';
38
2
  import { css, html } from 'lit';
39
3
  import { classMap } from 'lit/directives/class-map.js';
40
4
  import { styleMap } from 'lit/directives/style-map.js';
41
5
  import { selectOptionColorGrid } from '../../component/tags/color-menu.js';
42
6
  import { wordingOf } from '../../utils/wording.js';
43
7
  import { BaseGroup } from './base.js';
44
- let SelectGroupView = (() => {
45
- let _classSuper = BaseGroup;
46
- let _std_decorators;
47
- let _std_initializers = [];
48
- let _std_extraInitializers = [];
49
- return class SelectGroupView extends _classSuper {
50
- static {
51
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
52
- _std_decorators = [consume({ context: stdContext })];
53
- __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);
54
- if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
55
- }
56
- static { this.styles = css `
8
+ export class SelectGroupView extends BaseGroup {
9
+ constructor() {
10
+ super(...arguments);
11
+ this._click = (e) => {
12
+ if (this.readonly) {
13
+ return;
14
+ }
15
+ e.stopPropagation();
16
+ popMenu(popupTargetFromElement(this), {
17
+ options: {
18
+ items: [
19
+ menu.input({
20
+ initialValue: this.tag?.value ?? '',
21
+ onChange: text => {
22
+ this.updateTag({ value: text });
23
+ },
24
+ }),
25
+ ...selectOptionColorGrid({
26
+ current: this.tag?.color,
27
+ say: wordingOf(this.std),
28
+ std: this.std,
29
+ select: color => {
30
+ this.updateTag({ color });
31
+ },
32
+ }),
33
+ ],
34
+ },
35
+ });
36
+ };
37
+ }
38
+ static { this.styles = css `
57
39
  data-view-group-title-select-view {
58
40
  overflow: hidden;
59
41
  }
@@ -77,78 +59,41 @@ let SelectGroupView = (() => {
77
59
  white-space: nowrap;
78
60
  }
79
61
  `; }
80
- #std_accessor_storage;
81
- /** Absent outside an editor host: the colour names read English. */
82
- get std() { return this.#std_accessor_storage; }
83
- set std(value) { this.#std_accessor_storage = value; }
84
- get tag() {
85
- return this.data.options?.find(v => v.id === this.value);
86
- }
87
- render() {
88
- const tag = this.tag;
89
- if (!tag) {
90
- return html ` <div
62
+ get tag() {
63
+ return this.data.options?.find(v => v.id === this.value);
64
+ }
65
+ render() {
66
+ const tag = this.tag;
67
+ if (!tag) {
68
+ return html ` <div
91
69
  style="font-size: 14px;color: var(--affine-text-primary-color);line-height: 22px;"
92
70
  >
93
- Ungroups
71
+ ${this.ungrouped}
94
72
  </div>`;
95
- }
96
- const style = styleMap({
97
- backgroundColor: tag.color,
98
- });
99
- const classList = classMap({
100
- 'data-view-group-title-select-view': true,
101
- readonly: this.readonly,
102
- });
103
- return html ` <div @click="${this._click}" class="${classList}">
73
+ }
74
+ const style = styleMap({
75
+ backgroundColor: tag.color,
76
+ });
77
+ const classList = classMap({
78
+ 'data-view-group-title-select-view': true,
79
+ readonly: this.readonly,
80
+ });
81
+ return html ` <div @click="${this._click}" class="${classList}">
104
82
  <div class="tag" style="${style}">${tag.value}</div>
105
83
  </div>`;
106
- }
107
- updateTag(tag) {
108
- this.updateData?.({
109
- ...this.data,
110
- options: this.data.options.map(v => {
111
- if (v.id === this.value) {
112
- return {
113
- ...v,
114
- ...tag,
115
- };
116
- }
117
- return v;
118
- }),
119
- });
120
- }
121
- constructor() {
122
- super(...arguments);
123
- this._click = (e) => {
124
- if (this.readonly) {
125
- return;
84
+ }
85
+ updateTag(tag) {
86
+ this.updateData?.({
87
+ ...this.data,
88
+ options: this.data.options.map(v => {
89
+ if (v.id === this.value) {
90
+ return {
91
+ ...v,
92
+ ...tag,
93
+ };
126
94
  }
127
- e.stopPropagation();
128
- popMenu(popupTargetFromElement(this), {
129
- options: {
130
- items: [
131
- menu.input({
132
- initialValue: this.tag?.value ?? '',
133
- onChange: text => {
134
- this.updateTag({ value: text });
135
- },
136
- }),
137
- ...selectOptionColorGrid({
138
- current: this.tag?.color,
139
- say: wordingOf(this.std),
140
- std: this.std,
141
- select: color => {
142
- this.updateTag({ color });
143
- },
144
- }),
145
- ],
146
- },
147
- });
148
- };
149
- this.#std_accessor_storage = __runInitializers(this, _std_initializers, void 0);
150
- __runInitializers(this, _std_extraInitializers);
151
- }
152
- };
153
- })();
154
- export { SelectGroupView };
95
+ return v;
96
+ }),
97
+ });
98
+ }
99
+ }
@@ -36,7 +36,7 @@ export class StringGroupView extends BaseGroup {
36
36
  `; }
37
37
  render() {
38
38
  if (!this.value) {
39
- return html ` <div>Ungroups</div>`;
39
+ return html ` <div>${this.ungrouped}</div>`;
40
40
  }
41
41
  return html ` <div
42
42
  @click="${this._click}"
@@ -91,7 +91,7 @@ let GroupSetting = (() => {
91
91
  width: 4px;
92
92
  height: 12px;
93
93
  border-radius: 1px;
94
- background-color: #efeff0;
94
+ background-color: var(--affine-border-color);
95
95
  position: absolute;
96
96
  left: 4px;
97
97
  top: 0;
@@ -100,7 +100,7 @@ let GroupSetting = (() => {
100
100
  }
101
101
 
102
102
  .group-item:hover .group-item-drag-bar {
103
- background-color: #c0bfc1;
103
+ background-color: var(--affine-placeholder-color);
104
104
  }
105
105
 
106
106
  .group-item-visibility {
@@ -1,6 +1,10 @@
1
- import { type ChromeWording } from '../../../affine-shared/services/index.js';
1
+ import { type ChromeWording, type TranslationParams } from '../../../affine-shared/services/index.js';
2
2
  import type { BlockStdScope } from '../../../std/index.js';
3
- export type Wording = (wording: ChromeWording) => string;
3
+ /**
4
+ * `params` fills `{{name}}` placeholders; the host pluralises on `count`, the
5
+ * English fallback stays neutral.
6
+ */
7
+ export type Wording = (wording: ChromeWording, params?: TranslationParams) => string;
4
8
  /**
5
9
  * Resolve the data-view's wordings through the translation seam when an
6
10
  * editor is there (`stdContext`), in English otherwise (a unit test, a
@@ -1,9 +1,11 @@
1
- import { translateKey, } from '../../../affine-shared/services/index.js';
1
+ import { fillPlaceholders, translateKey, } from '../../../affine-shared/services/index.js';
2
2
  /**
3
3
  * Resolve the data-view's wordings through the translation seam when an
4
4
  * editor is there (`stdContext`), in English otherwise (a unit test, a
5
5
  * standalone mount). A popup renders outside the host, so its opener
6
6
  * resolves the words and hands this function down.
7
7
  */
8
- export const wordingOf = (std) => ([key, fallback]) => std ? translateKey(std, key, fallback) : fallback;
9
- export const englishWording = ([, fallback]) => fallback;
8
+ export const wordingOf = (std) => ([key, fallback], params) => std
9
+ ? translateKey(std, key, fallback, params)
10
+ : fillPlaceholders(fallback, params);
11
+ export const englishWording = ([, fallback], params) => fillPlaceholders(fallback, params);
@@ -1,4 +1,5 @@
1
1
  import type { BlockStdScope } from '../../../std/index.js';
2
+ import type { Wording } from '../utils/wording.js';
2
3
  import type { DataViewModel } from './data-view.js';
3
4
  /**
4
5
  * The name a view created now is given: the preset's `defaultNameKey`
@@ -8,3 +9,8 @@ import type { DataViewModel } from './data-view.js';
8
9
  * and the preset's seed never changes (ADR 0023). Never call it on load.
9
10
  */
10
11
  export declare function viewDefaultName(meta: Pick<DataViewModel, 'model'>, std: BlockStdScope | undefined): string;
12
+ /**
13
+ * A preset's name as a menu shows it (the view settings' "Layout"), through
14
+ * the opener's words; the English `defaultName` without a key.
15
+ */
16
+ export declare function viewPresetName(meta: Pick<DataViewModel, 'model'>, wording: Wording): string;
@@ -12,3 +12,11 @@ export function viewDefaultName(meta, std) {
12
12
  return defaultName;
13
13
  return translateKey(std, defaultNameKey, defaultName);
14
14
  }
15
+ /**
16
+ * A preset's name as a menu shows it (the view settings' "Layout"), through
17
+ * the opener's words; the English `defaultName` without a key.
18
+ */
19
+ export function viewPresetName(meta, wording) {
20
+ const { defaultName, defaultNameKey } = meta.model;
21
+ return defaultNameKey ? wording([defaultNameKey, defaultName]) : defaultName;
22
+ }
@@ -85,5 +85,50 @@ export declare const DATA_VIEW_PROPERTY_HIDE_IN_VIEW: ChromeWording;
85
85
  * property's menu.
86
86
  */
87
87
  export declare const DATA_VIEW_PROPERTY_TYPE: ChromeWording;
88
+ /** The toolbar button and a group's footer row that add a row. */
89
+ export declare const DATA_VIEW_NEW_RECORD: ChromeWording;
90
+ /**
91
+ * The title of the group holding the rows with no value. Display only: the
92
+ * stored group key stays `'Ungroups'` (`core/group-by/define.ts`).
93
+ */
94
+ export declare const DATA_VIEW_UNGROUPED: ChromeWording;
95
+ /** The filter bar's button, and the filter group panel's. */
96
+ export declare const DATA_VIEW_ADD_FILTER: ChromeWording;
97
+ export declare const DATA_VIEW_SEARCH_PLACEHOLDER: ChromeWording;
98
+ /** Read after an "Esc" key cap in the search box's clear tooltip. */
99
+ export declare const DATA_VIEW_SEARCH_CLEAR_HINT: ChromeWording;
100
+ /** The title of the view's settings (its "..." button). */
101
+ export declare const DATA_VIEW_VIEW_SETTINGS: ChromeWording;
102
+ /**
103
+ * The view settings' entries. "Layout" and "Group" are the full page's
104
+ * "This view" entries for the same settings (`VIEW_MENU_LAYOUT`,
105
+ * `VIEW_MENU_GROUP` in `@labre/core-database`): one chrome word, one key,
106
+ * declared here because core draws them too.
107
+ */
108
+ export declare const DATA_VIEW_LAYOUT: ChromeWording;
109
+ export declare const DATA_VIEW_GROUP: ChromeWording;
110
+ /**
111
+ * The selection pane's "Filter" (`@labre/affine-widget-edgeless-toolbar`):
112
+ * one chrome word, one key, declared there, so not listed below.
113
+ */
114
+ export declare const DATA_VIEW_FILTER: ChromeWording;
115
+ export declare const DATA_VIEW_SORT: ChromeWording;
116
+ /** Beside "Properties": how many the view shows (`count`). */
117
+ export declare const DATA_VIEW_PROPERTIES_SHOWN: ChromeWording;
118
+ /** Beside "Filter" and "Sort": how many the view has (`count`, 1 or more). */
119
+ export declare const DATA_VIEW_FILTER_COUNT: ChromeWording;
120
+ export declare const DATA_VIEW_SORT_COUNT: ChromeWording;
121
+ /** The title of a property's menu on a phone (its column header). */
122
+ export declare const DATA_VIEW_PROPERTY_SETTINGS: ChromeWording;
123
+ /** A property's menu: the name field's placeholder. */
124
+ export declare const DATA_VIEW_PROPERTY_NAME: ChromeWording;
125
+ /** A property's menu: the entry opening the type picker. */
126
+ export declare const DATA_VIEW_PROPERTY_TYPE_ENTRY: ChromeWording;
127
+ /**
128
+ * The table header's menu: a new property beside this one. Its "Move left"
129
+ * and "Move right" are the views bar's (`VIEWS_BAR_MOVE_LEFT`, `…_RIGHT`).
130
+ */
131
+ export declare const DATA_VIEW_INSERT_LEFT: ChromeWording;
132
+ export declare const DATA_VIEW_INSERT_RIGHT: ChromeWording;
88
133
  /** Walked by `PACKAGE_WORDINGS` in `packages/affine/all/src/translations.ts`. */
89
134
  export declare const DATA_VIEW_WORDINGS: readonly ChromeWording[];
@@ -218,11 +218,117 @@ export const DATA_VIEW_PROPERTY_TYPE = [
218
218
  'com.labre.data-view.property.type',
219
219
  'Property type',
220
220
  ];
221
+ /* ── The table's chrome on every device (P7, mobile base views) ──────── */
222
+ /** The toolbar button and a group's footer row that add a row. */
223
+ export const DATA_VIEW_NEW_RECORD = [
224
+ 'com.labre.data-view.new-record',
225
+ 'New Record',
226
+ ];
227
+ /**
228
+ * The title of the group holding the rows with no value. Display only: the
229
+ * stored group key stays `'Ungroups'` (`core/group-by/define.ts`).
230
+ */
231
+ export const DATA_VIEW_UNGROUPED = [
232
+ 'com.labre.data-view.group.ungrouped',
233
+ 'Ungroups',
234
+ ];
235
+ /** The filter bar's button, and the filter group panel's. */
236
+ export const DATA_VIEW_ADD_FILTER = [
237
+ 'com.labre.data-view.filter.add',
238
+ 'Add filter',
239
+ ];
240
+ export const DATA_VIEW_SEARCH_PLACEHOLDER = [
241
+ 'com.labre.data-view.search.placeholder',
242
+ 'Search...',
243
+ ];
244
+ /** Read after an "Esc" key cap in the search box's clear tooltip. */
245
+ export const DATA_VIEW_SEARCH_CLEAR_HINT = [
246
+ 'com.labre.data-view.search.clear-hint',
247
+ 'to clear all',
248
+ ];
249
+ /* ── The view settings and a property's settings (P7, phone sheets) ──── */
250
+ /** The title of the view's settings (its "..." button). */
251
+ export const DATA_VIEW_VIEW_SETTINGS = [
252
+ 'com.labre.data-view.view-settings',
253
+ 'View settings',
254
+ ];
255
+ /**
256
+ * The view settings' entries. "Layout" and "Group" are the full page's
257
+ * "This view" entries for the same settings (`VIEW_MENU_LAYOUT`,
258
+ * `VIEW_MENU_GROUP` in `@labre/core-database`): one chrome word, one key,
259
+ * declared here because core draws them too.
260
+ */
261
+ export const DATA_VIEW_LAYOUT = [
262
+ 'com.labre.database.view-menu.layout',
263
+ 'Layout',
264
+ ];
265
+ export const DATA_VIEW_GROUP = [
266
+ 'com.labre.database.view-menu.group',
267
+ 'Group',
268
+ ];
269
+ /**
270
+ * The selection pane's "Filter" (`@labre/affine-widget-edgeless-toolbar`):
271
+ * one chrome word, one key, declared there, so not listed below.
272
+ */
273
+ export const DATA_VIEW_FILTER = [
274
+ 'com.labre.selection-pane.filter',
275
+ 'Filter',
276
+ ];
277
+ export const DATA_VIEW_SORT = [
278
+ 'com.labre.data-view.sort',
279
+ 'Sort',
280
+ ];
281
+ /** Beside "Properties": how many the view shows (`count`). */
282
+ export const DATA_VIEW_PROPERTIES_SHOWN = [
283
+ 'com.labre.data-view.properties.shown',
284
+ '{{count}} shown',
285
+ ];
286
+ /** Beside "Filter" and "Sort": how many the view has (`count`, 1 or more). */
287
+ export const DATA_VIEW_FILTER_COUNT = [
288
+ 'com.labre.data-view.filter.count',
289
+ '{{count}} filter(s)',
290
+ ];
291
+ export const DATA_VIEW_SORT_COUNT = [
292
+ 'com.labre.data-view.sort.count',
293
+ '{{count}} sort(s)',
294
+ ];
295
+ /** The title of a property's menu on a phone (its column header). */
296
+ export const DATA_VIEW_PROPERTY_SETTINGS = [
297
+ 'com.labre.data-view.property.settings',
298
+ 'Property settings',
299
+ ];
300
+ /** A property's menu: the name field's placeholder. */
301
+ export const DATA_VIEW_PROPERTY_NAME = [
302
+ 'com.labre.data-view.property.name',
303
+ 'Property name',
304
+ ];
305
+ /** A property's menu: the entry opening the type picker. */
306
+ export const DATA_VIEW_PROPERTY_TYPE_ENTRY = [
307
+ 'com.labre.data-view.property.type-entry',
308
+ 'Type',
309
+ ];
310
+ /**
311
+ * The table header's menu: a new property beside this one. Its "Move left"
312
+ * and "Move right" are the views bar's (`VIEWS_BAR_MOVE_LEFT`, `…_RIGHT`).
313
+ */
314
+ export const DATA_VIEW_INSERT_LEFT = [
315
+ 'com.labre.data-view.property.insert-left',
316
+ 'Insert left column',
317
+ ];
318
+ export const DATA_VIEW_INSERT_RIGHT = [
319
+ 'com.labre.data-view.property.insert-right',
320
+ 'Insert right column',
321
+ ];
221
322
  /** Walked by `PACKAGE_WORDINGS` in `packages/affine/all/src/translations.ts`. */
222
323
  export const DATA_VIEW_WORDINGS = [
223
324
  VIEW_SHOWN_AS_TABLE,
224
325
  VIEW_DUPLICATE_AS_TABLE,
225
326
  DATA_VIEW_NEW_PAGE,
327
+ DATA_VIEW_NEW_RECORD,
328
+ DATA_VIEW_UNGROUPED,
329
+ DATA_VIEW_ADD_FILTER,
330
+ DATA_VIEW_SEARCH_PLACEHOLDER,
331
+ DATA_VIEW_SEARCH_CLEAR_HINT,
226
332
  VIEW_NAME_TABLE,
227
333
  VIEW_NAME_KANBAN,
228
334
  VIEW_NAME_CALENDAR,
@@ -258,4 +364,16 @@ export const DATA_VIEW_WORDINGS = [
258
364
  DATA_VIEW_NEW_PROPERTY,
259
365
  DATA_VIEW_PROPERTY_TYPE,
260
366
  DATA_VIEW_PROPERTY_HIDE_IN_VIEW,
367
+ DATA_VIEW_VIEW_SETTINGS,
368
+ DATA_VIEW_LAYOUT,
369
+ DATA_VIEW_GROUP,
370
+ DATA_VIEW_SORT,
371
+ DATA_VIEW_PROPERTIES_SHOWN,
372
+ DATA_VIEW_FILTER_COUNT,
373
+ DATA_VIEW_SORT_COUNT,
374
+ DATA_VIEW_PROPERTY_SETTINGS,
375
+ DATA_VIEW_PROPERTY_NAME,
376
+ DATA_VIEW_PROPERTY_TYPE_ENTRY,
377
+ DATA_VIEW_INSERT_LEFT,
378
+ DATA_VIEW_INSERT_RIGHT,
261
379
  ];