@formicoidea/labre-core 0.33.0 → 0.34.1

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 (100) hide show
  1. package/dist/_pkgs/affine-block-attachment/attachment-block.js +2 -2
  2. package/dist/_pkgs/affine-block-attachment/configs/toolbar.d.ts +2 -2
  3. package/dist/_pkgs/affine-block-attachment/configs/toolbar.js +9 -7
  4. package/dist/_pkgs/affine-block-bookmark/configs/toolbar.js +12 -12
  5. package/dist/_pkgs/affine-block-code/code-block.js +2 -2
  6. package/dist/_pkgs/affine-block-code/code-toolbar/config.js +6 -0
  7. package/dist/_pkgs/affine-block-database/database-block.js +2 -2
  8. package/dist/_pkgs/affine-block-embed/common/render-linked-doc.js +3 -3
  9. package/dist/_pkgs/affine-block-embed/configs/toolbar.js +11 -11
  10. package/dist/_pkgs/affine-block-embed/embed-html-block/configs/toolbar.js +5 -5
  11. package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.d.ts +7 -7
  12. package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.js +12 -12
  13. package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.js +2 -2
  14. package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/toolbar.js +9 -9
  15. package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-linked-doc-block.js +4 -4
  16. package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/components/embed-synced-doc-card.js +5 -4
  17. package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/configs/toolbar.js +9 -9
  18. package/dist/_pkgs/affine-block-frame/frame-toolbar.js +2 -2
  19. package/dist/_pkgs/affine-block-image/configs/toolbar.js +4 -4
  20. package/dist/_pkgs/affine-block-note/configs/toolbar.js +2 -2
  21. package/dist/_pkgs/affine-block-root/configs/toolbar.d.ts +6 -4
  22. package/dist/_pkgs/affine-block-root/configs/toolbar.js +6 -6
  23. package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/misc.d.ts +10 -10
  24. package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/misc.js +4 -4
  25. package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/more.d.ts +7 -7
  26. package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/more.js +8 -8
  27. package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +3 -1
  28. package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +15 -4
  29. package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +17 -0
  30. package/dist/_pkgs/affine-block-surface/extensions/spotlight.d.ts +21 -0
  31. package/dist/_pkgs/affine-block-surface/extensions/spotlight.js +17 -3
  32. package/dist/_pkgs/affine-block-surface/index.d.ts +1 -0
  33. package/dist/_pkgs/affine-block-surface/index.js +1 -0
  34. package/dist/_pkgs/affine-block-surface/renderer/element-highlight-overlay.d.ts +17 -0
  35. package/dist/_pkgs/affine-block-surface/renderer/element-highlight-overlay.js +66 -0
  36. package/dist/_pkgs/affine-block-surface/view.js +5 -0
  37. package/dist/_pkgs/affine-block-surface-ref/configs/toolbar.js +4 -4
  38. package/dist/_pkgs/affine-components/highlight-dropdown-menu/highlight-duotone-icon.js +8 -8
  39. package/dist/_pkgs/affine-components/highlight-dropdown-menu/text-duotone-icon.js +11 -11
  40. package/dist/_pkgs/affine-components/icons/text.js +426 -426
  41. package/dist/_pkgs/affine-components/open-doc-dropdown-menu/dropdown-menu.d.ts +2 -0
  42. package/dist/_pkgs/affine-components/resource/resource.js +2 -0
  43. package/dist/_pkgs/affine-components/view-dropdown-menu/dropdown-menu.js +27 -14
  44. package/dist/_pkgs/affine-inline-link/link-node/configs/toolbar.d.ts +4 -4
  45. package/dist/_pkgs/affine-inline-link/link-node/configs/toolbar.js +6 -6
  46. package/dist/_pkgs/affine-inline-reference/reference-node/configs/toolbar.d.ts +4 -4
  47. package/dist/_pkgs/affine-inline-reference/reference-node/configs/toolbar.js +6 -6
  48. package/dist/_pkgs/affine-model/elements/bpmn/pool.d.ts +61 -0
  49. package/dist/_pkgs/affine-model/elements/bpmn/pool.js +93 -0
  50. package/dist/_pkgs/affine-model/elements/cynefin/cynefin.d.ts +7 -2
  51. package/dist/_pkgs/affine-model/elements/cynefin/cynefin.js +9 -4
  52. package/dist/_pkgs/affine-model/elements/edgy/board.d.ts +7 -2
  53. package/dist/_pkgs/affine-model/elements/edgy/board.js +9 -4
  54. package/dist/_pkgs/affine-model/elements/edgy/facets.d.ts +20 -3
  55. package/dist/_pkgs/affine-model/elements/edgy/facets.js +13 -4
  56. package/dist/_pkgs/affine-model/elements/estuarine/estuarine.d.ts +7 -2
  57. package/dist/_pkgs/affine-model/elements/estuarine/estuarine.js +9 -4
  58. package/dist/_pkgs/affine-model/elements/framework-background/background.d.ts +7 -2
  59. package/dist/_pkgs/affine-model/elements/framework-background/background.js +9 -4
  60. package/dist/_pkgs/affine-model/elements/framework-background/hit-test.d.ts +48 -0
  61. package/dist/_pkgs/affine-model/elements/framework-background/hit-test.js +55 -0
  62. package/dist/_pkgs/affine-model/elements/framework-background/index.d.ts +1 -0
  63. package/dist/_pkgs/affine-model/elements/framework-background/index.js +1 -0
  64. package/dist/_pkgs/affine-shared/services/edit-props-store.d.ts +11 -0
  65. package/dist/_pkgs/affine-shared/services/edit-props-store.js +15 -0
  66. package/dist/_pkgs/affine-shared/services/toolbar-service/action.d.ts +32 -0
  67. package/dist/_pkgs/affine-shared/services/toolbar-service/action.js +16 -0
  68. package/dist/_pkgs/affine-shared/services/toolbar-service/flags.d.ts +10 -0
  69. package/dist/_pkgs/affine-shared/services/toolbar-service/flags.js +32 -1
  70. package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +106 -0
  71. package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +201 -0
  72. package/dist/_pkgs/affine-shared/services/translation-service/index.d.ts +1 -0
  73. package/dist/_pkgs/affine-shared/services/translation-service/index.js +1 -0
  74. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/catalogue-groups.d.ts +11 -16
  75. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/catalogue-groups.js +11 -28
  76. package/dist/_pkgs/affine-widget-keyboard-toolbar/config.js +2 -1
  77. package/dist/_pkgs/affine-widget-keyboard-toolbar/icons.js +98 -98
  78. package/dist/_pkgs/affine-widget-slash-menu/config.js +2 -1
  79. package/dist/_pkgs/affine-widget-toolbar/toolbar.js +5 -0
  80. package/dist/_pkgs/affine-widget-toolbar/utils.d.ts +19 -2
  81. package/dist/_pkgs/affine-widget-toolbar/utils.js +22 -7
  82. package/dist/_pkgs/data-view/core/group-by/renderer/boolean-group.js +11 -11
  83. package/dist/_pkgs/data-view/core/utils/menu-title.js +17 -17
  84. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/group-title.js +18 -18
  85. package/dist/_pkgs/std/extension/command-registry.d.ts +36 -0
  86. package/dist/_pkgs/std/extension/command-registry.js +16 -0
  87. package/dist/_pkgs/std/extension/translation-manifest.d.ts +46 -1
  88. package/dist/_pkgs/std/extension/translation-manifest.js +58 -0
  89. package/dist/_pkgs/std/gfx/highlight.d.ts +84 -0
  90. package/dist/_pkgs/std/gfx/highlight.js +112 -0
  91. package/dist/_pkgs/std/gfx/index.d.ts +1 -0
  92. package/dist/_pkgs/std/gfx/index.js +1 -0
  93. package/dist/_pkgs/std/gfx/interactivity/gfx-view-event-handler.js +17 -3
  94. package/dist/_pkgs/std/scope/std-scope.d.ts +2 -1
  95. package/dist/_pkgs/std/scope/std-scope.js +2 -0
  96. package/dist/_pkgs/std/utils/gfx.js +2 -0
  97. package/dist/shortcuts.d.ts +20 -6
  98. package/dist/shortcuts.js +7 -9
  99. package/dist/translations.js +25 -18
  100. package/package.json +13 -1
@@ -38,7 +38,7 @@ import { Peekable } from '../affine-components/peek/index.js';
38
38
  import { ResourceController, } from '../affine-components/resource/index.js';
39
39
  import { toast } from '../affine-components/toast/index.js';
40
40
  import { AttachmentBlockStyles, } from '../affine-model/index.js';
41
- import { BlockCommentManager, CitationProvider, DocModeProvider, FileSizeLimitProvider, TelemetryProvider, } from '../affine-shared/services/index.js';
41
+ import { BlockCommentManager, CitationProvider, DocModeProvider, FileSizeLimitProvider, TelemetryProvider, TOAST_COPIED_TO_CLIPBOARD, translateKey, } from '../affine-shared/services/index.js';
42
42
  import { formatSize, openSingleFileWith } from '../affine-shared/utils/index.js';
43
43
  import { AttachmentIcon, ResetIcon, UpgradeIcon, WarningIcon, } from '@blocksuite/icons/lit';
44
44
  import { BlockSelection } from '../std/index.js';
@@ -83,7 +83,7 @@ let AttachmentBlockComponent = (() => {
83
83
  this.copy = () => {
84
84
  const slice = Slice.fromModels(this.store, [this.model]);
85
85
  this.std.clipboard.copySlice(slice).catch(console.error);
86
- toast(this.host, 'Copied to clipboard');
86
+ toast(this.host, translateKey(this.std, ...TOAST_COPIED_TO_CLIPBOARD));
87
87
  };
88
88
  this.download = () => {
89
89
  downloadAttachmentBlob(this);
@@ -3,11 +3,11 @@ export declare const attachmentViewDropdownMenu: {
3
3
  readonly id: "b.conversions";
4
4
  readonly actions: [{
5
5
  readonly id: "card";
6
- readonly label: "Card view";
6
+ readonly labelWording: import("../../affine-shared/services/index.js").ChromeWording;
7
7
  readonly run: (ctx: import("../../affine-shared/services/index.js").ToolbarContext) => void;
8
8
  }, {
9
9
  readonly id: "embed";
10
- readonly label: "Embed view";
10
+ readonly labelWording: import("../../affine-shared/services/index.js").ChromeWording;
11
11
  readonly disabled: (ctx: import("../../affine-shared/services/index.js").ToolbarContext) => boolean;
12
12
  readonly run: (ctx: import("../../affine-shared/services/index.js").ToolbarContext) => void;
13
13
  }];
@@ -1,7 +1,7 @@
1
1
  import { createLitPortal } from '../../affine-components/portal/index.js';
2
2
  import { AttachmentBlockModel, defaultAttachmentProps, } from '../../affine-model/index.js';
3
3
  import { EMBED_CARD_HEIGHT, EMBED_CARD_WIDTH, } from '../../affine-shared/consts/index.js';
4
- import { ActionPlacement, blockCommentToolbarButton, ToolbarModuleExtension, } from '../../affine-shared/services/index.js';
4
+ import { ActionPlacement, blockCommentToolbarButton, TOOLBAR_CARD_VIEW, TOOLBAR_COPY, TOOLBAR_DELETE, TOOLBAR_DUPLICATE, TOOLBAR_EMBED_VIEW, toolbarActionLabel, ToolbarModuleExtension, } from '../../affine-shared/services/index.js';
5
5
  import { getBlockProps } from '../../affine-shared/utils/index.js';
6
6
  import { Bound } from '../../global/gfx/index.js';
7
7
  import { CaptionIcon, CopyIcon, DeleteIcon, DownloadIcon, DuplicateIcon, EditIcon, ReplaceIcon, ResetIcon, } from '@blocksuite/icons/lit';
@@ -22,7 +22,7 @@ export const attachmentViewDropdownMenu = {
22
22
  actions: [
23
23
  {
24
24
  id: 'card',
25
- label: 'Card view',
25
+ labelWording: TOOLBAR_CARD_VIEW,
26
26
  run(ctx) {
27
27
  const model = ctx.getCurrentModelByType(AttachmentBlockModel);
28
28
  if (!model)
@@ -42,7 +42,7 @@ export const attachmentViewDropdownMenu = {
42
42
  },
43
43
  {
44
44
  id: 'embed',
45
- label: 'Embed view',
45
+ labelWording: TOOLBAR_EMBED_VIEW,
46
46
  disabled: ctx => {
47
47
  const block = ctx.getCurrentBlockByType(AttachmentBlockComponent);
48
48
  return block ? !block.embedded() : true;
@@ -92,7 +92,9 @@ export const attachmentViewDropdownMenu = {
92
92
  const viewType$ = computed(() => {
93
93
  const [cardAction, embedAction] = actions.value;
94
94
  const embed = model.props.embed$.value ?? false;
95
- return embed ? embedAction.label : cardAction.label;
95
+ // Through the seam, like the entries themselves: the dropdown compares
96
+ // this word with the label of each entry to mark the current one.
97
+ return toolbarActionLabel(ctx.std, embed ? embedAction : cardAction);
96
98
  });
97
99
  const onToggle = (e) => {
98
100
  e.stopPropagation();
@@ -207,7 +209,7 @@ const builtinToolbarConfig = {
207
209
  actions: [
208
210
  {
209
211
  id: 'copy',
210
- label: 'Copy',
212
+ labelWording: TOOLBAR_COPY,
211
213
  icon: CopyIcon(),
212
214
  run(ctx) {
213
215
  // TODO(@fundon): unify `clone` method
@@ -217,7 +219,7 @@ const builtinToolbarConfig = {
217
219
  },
218
220
  {
219
221
  id: 'duplicate',
220
- label: 'Duplicate',
222
+ labelWording: TOOLBAR_DUPLICATE,
221
223
  icon: DuplicateIcon(),
222
224
  run(ctx) {
223
225
  const model = ctx.getCurrentModelByType(AttachmentBlockModel);
@@ -252,7 +254,7 @@ const builtinToolbarConfig = {
252
254
  {
253
255
  placement: ActionPlacement.More,
254
256
  id: 'c.delete',
255
- label: 'Delete',
257
+ labelWording: TOOLBAR_DELETE,
256
258
  icon: DeleteIcon(),
257
259
  variant: 'destructive',
258
260
  run(ctx) {
@@ -3,7 +3,7 @@ import { reassociateConnectorsCommand } from '../../affine-block-surface/index.j
3
3
  import { toast } from '../../affine-components/toast/index.js';
4
4
  import { BookmarkBlockModel, BookmarkStyles, } from '../../affine-model/index.js';
5
5
  import { EMBED_CARD_HEIGHT, EMBED_CARD_WIDTH, } from '../../affine-shared/consts/index.js';
6
- import { ActionPlacement, blockCommentToolbarButton, EmbedIframeService, EmbedOptionProvider, ToolbarModuleExtension, } from '../../affine-shared/services/index.js';
6
+ import { ActionPlacement, blockCommentToolbarButton, EmbedIframeService, EmbedOptionProvider, TOAST_COPIED_TO_CLIPBOARD, TOOLBAR_CARD_VIEW, TOOLBAR_COPY, TOOLBAR_DELETE, TOOLBAR_DUPLICATE, TOOLBAR_EMBED_VIEW, TOOLBAR_INLINE_VIEW, toolbarActionLabel, ToolbarModuleExtension, translateKey, } from '../../affine-shared/services/index.js';
7
7
  import { getBlockProps } from '../../affine-shared/utils/index.js';
8
8
  import { Bound } from '../../global/gfx/index.js';
9
9
  import { CaptionIcon, CopyIcon, DeleteIcon, DuplicateIcon, ResetIcon, } from '@blocksuite/icons/lit';
@@ -59,7 +59,7 @@ const builtinToolbarConfig = {
59
59
  actions: [
60
60
  {
61
61
  id: 'inline',
62
- label: 'Inline view',
62
+ labelWording: TOOLBAR_INLINE_VIEW,
63
63
  run(ctx) {
64
64
  const model = ctx.getCurrentModelByType(BookmarkBlockModel);
65
65
  if (!model)
@@ -86,12 +86,12 @@ const builtinToolbarConfig = {
86
86
  },
87
87
  {
88
88
  id: 'card',
89
- label: 'Card view',
89
+ labelWording: TOOLBAR_CARD_VIEW,
90
90
  disabled: true,
91
91
  },
92
92
  {
93
93
  id: 'embed',
94
- label: 'Embed view',
94
+ labelWording: TOOLBAR_EMBED_VIEW,
95
95
  disabled(ctx) {
96
96
  const model = ctx.getCurrentModelByType(BookmarkBlockModel);
97
97
  if (!model)
@@ -153,7 +153,7 @@ const builtinToolbarConfig = {
153
153
  if (!model)
154
154
  return null;
155
155
  const actions = this.actions.map(action => ({ ...action }));
156
- const viewType$ = signal(actions[1].label);
156
+ const viewType$ = signal(toolbarActionLabel(ctx.std, actions[1]));
157
157
  const onToggle = createOnToggleFn(ctx, 'OpenedViewSelector', 'switch view');
158
158
  return html `${keyed(model, html `<affine-view-dropdown-menu
159
159
  @toggle=${onToggle}
@@ -210,7 +210,7 @@ const builtinToolbarConfig = {
210
210
  actions: [
211
211
  {
212
212
  id: 'copy',
213
- label: 'Copy',
213
+ labelWording: TOOLBAR_COPY,
214
214
  icon: CopyIcon(),
215
215
  run(ctx) {
216
216
  const model = ctx.getCurrentModelByType(BookmarkBlockModel);
@@ -219,13 +219,13 @@ const builtinToolbarConfig = {
219
219
  const slice = Slice.fromModels(ctx.store, [model]);
220
220
  ctx.clipboard
221
221
  .copySlice(slice)
222
- .then(() => toast(ctx.host, 'Copied to clipboard'))
222
+ .then(() => toast(ctx.host, translateKey(ctx.std, ...TOAST_COPIED_TO_CLIPBOARD)))
223
223
  .catch(console.error);
224
224
  },
225
225
  },
226
226
  {
227
227
  id: 'duplicate',
228
- label: 'Duplicate',
228
+ labelWording: TOOLBAR_DUPLICATE,
229
229
  icon: DuplicateIcon(),
230
230
  run(ctx) {
231
231
  const model = ctx.getCurrentModelByType(BookmarkBlockModel);
@@ -252,7 +252,7 @@ const builtinToolbarConfig = {
252
252
  {
253
253
  placement: ActionPlacement.More,
254
254
  id: 'c.delete',
255
- label: 'Delete',
255
+ labelWording: TOOLBAR_DELETE,
256
256
  icon: DeleteIcon(),
257
257
  variant: 'destructive',
258
258
  run(ctx) {
@@ -275,12 +275,12 @@ const builtinSurfaceToolbarConfig = {
275
275
  actions: [
276
276
  {
277
277
  id: 'card',
278
- label: 'Card view',
278
+ labelWording: TOOLBAR_CARD_VIEW,
279
279
  disabled: true,
280
280
  },
281
281
  {
282
282
  id: 'embed',
283
- label: 'Embed view',
283
+ labelWording: TOOLBAR_EMBED_VIEW,
284
284
  run(ctx) {
285
285
  const model = ctx.getCurrentModelByType(BookmarkBlockModel);
286
286
  if (!model)
@@ -352,7 +352,7 @@ const builtinSurfaceToolbarConfig = {
352
352
  if (!model)
353
353
  return null;
354
354
  const actions = this.actions.map(action => ({ ...action }));
355
- const viewType$ = signal('Card view');
355
+ const viewType$ = signal(translateKey(ctx.std, ...TOOLBAR_CARD_VIEW));
356
356
  const onToggle = createOnToggleFn(ctx, 'OpenedViewSelector', 'switch view');
357
357
  return html `${keyed(model, html `<affine-view-dropdown-menu
358
358
  @toggle=${onToggle}
@@ -35,7 +35,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
35
35
  import { CaptionedBlockComponent } from '../affine-components/caption/index.js';
36
36
  import { focusTextModel } from '../affine-rich-text/index.js';
37
37
  import { BRACKET_PAIRS, EDGELESS_TOP_CONTENTEDITABLE_SELECTOR, } from '../affine-shared/consts/index.js';
38
- import { BlockCommentManager, DocModeProvider, EditorSettingProvider, NotificationProvider, } from '../affine-shared/services/index.js';
38
+ import { BlockCommentManager, DocModeProvider, EditorSettingProvider, NotificationProvider, TOAST_COPIED_TO_CLIPBOARD, translateKey, } from '../affine-shared/services/index.js';
39
39
  import { getViewportElement } from '../affine-shared/utils/index.js';
40
40
  import { IS_MAC, IS_MOBILE } from '../global/env/index.js';
41
41
  import { noop } from '../global/utils/index.js';
@@ -386,7 +386,7 @@ let CodeBlockComponent = (() => {
386
386
  this.std.clipboard
387
387
  .copySlice(slice)
388
388
  .then(() => {
389
- this.notificationService?.toast('Copied to clipboard');
389
+ this.notificationService?.toast(translateKey(this.std, ...TOAST_COPIED_TO_CLIPBOARD));
390
390
  })
391
391
  .catch(e => {
392
392
  this.notificationService?.toast('Copied failed, something went wrong');
@@ -263,6 +263,11 @@ export const clipboardGroup = {
263
263
  items: [
264
264
  {
265
265
  type: 'duplicate',
266
+ // NOT a `ToolbarAction`: the code block's "⋮" is a `MenuItemGroup`,
267
+ // rendered by `renderGroups` over a context that is generic and carries
268
+ // no `std`, so the wording seam cannot reach it. Left English with the
269
+ // rest of that menu's vocabulary rather than keying two of its five
270
+ // entries — see the changeset.
266
271
  label: 'Duplicate',
267
272
  icon: DuplicateIcon,
268
273
  when: ({ doc }) => !doc.readonly,
@@ -294,6 +299,7 @@ export const deleteGroup = {
294
299
  items: [
295
300
  {
296
301
  type: 'delete',
302
+ // See the note on `duplicate` above.
297
303
  label: 'Delete',
298
304
  icon: DeleteIcon,
299
305
  when: ({ doc }) => !doc.readonly,
@@ -4,7 +4,7 @@ import { DropIndicator } from '../affine-components/drop-indicator/index.js';
4
4
  import { PeekViewProvider } from '../affine-components/peek/index.js';
5
5
  import { toast } from '../affine-components/toast/index.js';
6
6
  import { EDGELESS_TOP_CONTENTEDITABLE_SELECTOR } from '../affine-shared/consts/index.js';
7
- import { BlockCommentManager, CommentProviderIdentifier, DocModeProvider, NotificationProvider, TelemetryProvider, } from '../affine-shared/services/index.js';
7
+ import { BlockCommentManager, CommentProviderIdentifier, DocModeProvider, NotificationProvider, TelemetryProvider, TOAST_COPIED_TO_CLIPBOARD, translateKey, } from '../affine-shared/services/index.js';
8
8
  import { getDropResult } from '../affine-widget-drag-handle/index.js';
9
9
  import { createRecordDetail, createUniComponentFromWebComponent, DataViewRootUILogic, defineUniComponent, ExternalGroupByConfigProvider, renderUniLit, uniMap, } from '../data-view/index.js';
10
10
  import { CalendarExternalSourceProvider } from '../data-view/view-presets/index.js';
@@ -62,7 +62,7 @@ export class DatabaseBlockComponent extends CaptionedBlockComponent {
62
62
  this.std.clipboard
63
63
  .copySlice(slice)
64
64
  .then(() => {
65
- toast(this.host, 'Copied to clipboard');
65
+ toast(this.host, translateKey(this.std, ...TOAST_COPIED_TO_CLIPBOARD));
66
66
  })
67
67
  .catch(console.error);
68
68
  },
@@ -1,6 +1,6 @@
1
1
  import { getSurfaceBlock } from '../../affine-block-surface/index.js';
2
2
  import { ListBlockModel, NoteBlockModel, NoteDisplayMode, ParagraphBlockModel, } from '../../affine-model/index.js';
3
- import { NotificationProvider } from '../../affine-shared/services/index.js';
3
+ import { NotificationProvider, TOAST_LINKED_DOC_CREATED, TOOLBAR_CREATE_LINKED_DOC, translateKey, } from '../../affine-shared/services/index.js';
4
4
  import { matchModels } from '../../affine-shared/utils/index.js';
5
5
  import { Slice, Text, } from '../../store/index.js';
6
6
  // Throttle delay for block updates to reduce unnecessary re-renders
@@ -90,7 +90,7 @@ export function promptDocTitle(std, autofill) {
90
90
  if (!notification)
91
91
  return Promise.resolve(undefined);
92
92
  return notification.prompt({
93
- title: 'Create linked doc',
93
+ title: translateKey(std, ...TOOLBAR_CREATE_LINKED_DOC),
94
94
  message: 'Enter a title for the new doc.',
95
95
  placeholder: 'Untitled',
96
96
  autofill,
@@ -100,7 +100,7 @@ export function promptDocTitle(std, autofill) {
100
100
  }
101
101
  export function notifyDocCreated(std) {
102
102
  std.getOptional(NotificationProvider)?.notifyWithUndoAction({
103
- title: 'Linked doc created',
103
+ title: translateKey(std, ...TOAST_LINKED_DOC_CREATED),
104
104
  message: 'You can click undo to recovery block content',
105
105
  accent: 'info',
106
106
  duration: 10 * 1000,
@@ -2,7 +2,7 @@ import { reassociateConnectorsCommand } from '../../affine-block-surface/index.j
2
2
  import { toast } from '../../affine-components/toast/index.js';
3
3
  import { BookmarkStyles, EmbedGithubModel, EmbedGithubStyles, isExternalEmbedModel, } from '../../affine-model/index.js';
4
4
  import { EMBED_CARD_HEIGHT, EMBED_CARD_WIDTH, } from '../../affine-shared/consts/index.js';
5
- import { ActionPlacement, blockCommentToolbarButton, EmbedOptionProvider, ToolbarModuleExtension, } from '../../affine-shared/services/index.js';
5
+ import { ActionPlacement, blockCommentToolbarButton, EmbedOptionProvider, TOAST_COPIED_TO_CLIPBOARD, TOOLBAR_CARD_VIEW, TOOLBAR_COPY, TOOLBAR_DELETE, TOOLBAR_DUPLICATE, TOOLBAR_EMBED_VIEW, TOOLBAR_INLINE_VIEW, ToolbarModuleExtension, translateKey, } from '../../affine-shared/services/index.js';
6
6
  import { getBlockProps } from '../../affine-shared/utils/index.js';
7
7
  import { Bound } from '../../global/gfx/index.js';
8
8
  import { CaptionIcon, CopyIcon, DeleteIcon, DuplicateIcon, ResetIcon, } from '@blocksuite/icons/lit';
@@ -46,7 +46,7 @@ function createBuiltinToolbarConfigForExternal(klass) {
46
46
  actions: [
47
47
  {
48
48
  id: 'inline',
49
- label: 'Inline view',
49
+ labelWording: TOOLBAR_INLINE_VIEW,
50
50
  run(ctx) {
51
51
  const model = ctx.getCurrentModel();
52
52
  if (!model || !isExternalEmbedModel(model))
@@ -73,7 +73,7 @@ function createBuiltinToolbarConfigForExternal(klass) {
73
73
  },
74
74
  {
75
75
  id: 'card',
76
- label: 'Card view',
76
+ labelWording: TOOLBAR_CARD_VIEW,
77
77
  disabled(ctx) {
78
78
  const model = ctx.getCurrentModel();
79
79
  if (!model || !isExternalEmbedModel(model))
@@ -122,7 +122,7 @@ function createBuiltinToolbarConfigForExternal(klass) {
122
122
  },
123
123
  {
124
124
  id: 'embed',
125
- label: 'Embed view',
125
+ labelWording: TOOLBAR_EMBED_VIEW,
126
126
  disabled(ctx) {
127
127
  const model = ctx.getCurrentModel();
128
128
  if (!model || !isExternalEmbedModel(model))
@@ -184,7 +184,7 @@ function createBuiltinToolbarConfigForExternal(klass) {
184
184
  const viewType = ctx.std.get(EmbedOptionProvider).getEmbedBlockOptions(url)
185
185
  ?.viewType ?? 'card';
186
186
  const actions = this.actions.map(action => ({ ...action }));
187
- const viewType$ = signal(`${viewType === 'card' ? 'Card' : 'Embed'} view`);
187
+ const viewType$ = signal(translateKey(ctx.std, ...(viewType === 'card' ? TOOLBAR_CARD_VIEW : TOOLBAR_EMBED_VIEW)));
188
188
  const onToggle = createOnToggleFn(ctx, 'OpenedViewSelector', 'switch view');
189
189
  return html `${keyed(model, html `<affine-view-dropdown-menu
190
190
  @toggle=${onToggle}
@@ -256,7 +256,7 @@ function createBuiltinToolbarConfigForExternal(klass) {
256
256
  actions: [
257
257
  {
258
258
  id: 'copy',
259
- label: 'Copy',
259
+ labelWording: TOOLBAR_COPY,
260
260
  icon: CopyIcon(),
261
261
  run(ctx) {
262
262
  const model = ctx.getCurrentBlockByType(klass)?.model;
@@ -265,13 +265,13 @@ function createBuiltinToolbarConfigForExternal(klass) {
265
265
  const slice = Slice.fromModels(ctx.store, [model]);
266
266
  ctx.clipboard
267
267
  .copySlice(slice)
268
- .then(() => toast(ctx.host, 'Copied to clipboard'))
268
+ .then(() => toast(ctx.host, translateKey(ctx.std, ...TOAST_COPIED_TO_CLIPBOARD)))
269
269
  .catch(console.error);
270
270
  },
271
271
  },
272
272
  {
273
273
  id: 'duplicate',
274
- label: 'Duplicate',
274
+ labelWording: TOOLBAR_DUPLICATE,
275
275
  icon: DuplicateIcon(),
276
276
  run(ctx) {
277
277
  const model = ctx.getCurrentBlockByType(klass)?.model;
@@ -298,7 +298,7 @@ function createBuiltinToolbarConfigForExternal(klass) {
298
298
  {
299
299
  placement: ActionPlacement.More,
300
300
  id: 'c.delete',
301
- label: 'Delete',
301
+ labelWording: TOOLBAR_DELETE,
302
302
  icon: DeleteIcon(),
303
303
  variant: 'destructive',
304
304
  run(ctx) {
@@ -323,7 +323,7 @@ const createBuiltinSurfaceToolbarConfigForExternal = (klass) => {
323
323
  actions: [
324
324
  {
325
325
  id: 'card',
326
- label: 'Card view',
326
+ labelWording: TOOLBAR_CARD_VIEW,
327
327
  run(ctx) {
328
328
  const model = ctx.getCurrentBlockByType(klass)?.model;
329
329
  if (!model || !isExternalEmbedModel(model))
@@ -352,7 +352,7 @@ const createBuiltinSurfaceToolbarConfigForExternal = (klass) => {
352
352
  },
353
353
  {
354
354
  id: 'embed',
355
- label: 'Embed view',
355
+ labelWording: TOOLBAR_EMBED_VIEW,
356
356
  disabled: true,
357
357
  },
358
358
  ],
@@ -1,6 +1,6 @@
1
1
  import { toast } from '../../../affine-components/toast/index.js';
2
2
  import { EmbedHtmlModel } from '../../../affine-model/index.js';
3
- import { ActionPlacement, ToolbarModuleExtension, } from '../../../affine-shared/services/index.js';
3
+ import { ActionPlacement, TOAST_COPIED_TO_CLIPBOARD, TOOLBAR_COPY, TOOLBAR_DELETE, TOOLBAR_DUPLICATE, ToolbarModuleExtension, translateKey, } from '../../../affine-shared/services/index.js';
4
4
  import { getBlockProps } from '../../../affine-shared/utils/index.js';
5
5
  import { CaptionIcon, CopyIcon, DeleteIcon, DuplicateIcon, ExpandFullIcon, } from '@blocksuite/icons/lit';
6
6
  import { BlockFlavourIdentifier } from '../../../std/index.js';
@@ -89,7 +89,7 @@ const builtinToolbarConfig = {
89
89
  actions: [
90
90
  {
91
91
  id: 'copy',
92
- label: 'Copy',
92
+ labelWording: TOOLBAR_COPY,
93
93
  icon: CopyIcon(),
94
94
  run(ctx) {
95
95
  const model = ctx.getCurrentModelByType(EmbedHtmlModel);
@@ -98,13 +98,13 @@ const builtinToolbarConfig = {
98
98
  const slice = Slice.fromModels(ctx.store, [model]);
99
99
  ctx.clipboard
100
100
  .copySlice(slice)
101
- .then(() => toast(ctx.host, 'Copied to clipboard'))
101
+ .then(() => toast(ctx.host, translateKey(ctx.std, ...TOAST_COPIED_TO_CLIPBOARD)))
102
102
  .catch(console.error);
103
103
  },
104
104
  },
105
105
  {
106
106
  id: 'duplicate',
107
- label: 'Duplicate',
107
+ labelWording: TOOLBAR_DUPLICATE,
108
108
  icon: DuplicateIcon(),
109
109
  run(ctx) {
110
110
  const model = ctx.getCurrentModelByType(EmbedHtmlModel);
@@ -121,7 +121,7 @@ const builtinToolbarConfig = {
121
121
  {
122
122
  placement: ActionPlacement.More,
123
123
  id: 'c.delete',
124
- label: 'Delete',
124
+ labelWording: TOOLBAR_DELETE,
125
125
  icon: DeleteIcon(),
126
126
  variant: 'destructive',
127
127
  run(ctx) {
@@ -6,12 +6,12 @@ export declare const builtinToolbarConfig: {
6
6
  when: (ctx: ToolbarContext) => boolean;
7
7
  actions: ({
8
8
  id: string;
9
- label: string;
9
+ labelWording: import("../../../affine-shared/services/index.js").ChromeWording;
10
10
  run(ctx: ToolbarContext): void;
11
11
  disabled?: undefined;
12
12
  } | {
13
13
  id: string;
14
- label: string;
14
+ labelWording: import("../../../affine-shared/services/index.js").ChromeWording;
15
15
  disabled: true;
16
16
  run?: undefined;
17
17
  })[];
@@ -26,12 +26,12 @@ export declare const builtinToolbarConfig: {
26
26
  readonly id: "a.clipboard";
27
27
  readonly actions: [{
28
28
  readonly id: "copy";
29
- readonly label: "Copy";
29
+ readonly labelWording: import("../../../affine-shared/services/index.js").ChromeWording;
30
30
  readonly icon: import("lit-html").TemplateResult<1>;
31
31
  readonly run: (ctx: ToolbarContext) => void;
32
32
  }, {
33
33
  readonly id: "duplicate";
34
- readonly label: "Duplicate";
34
+ readonly labelWording: import("../../../affine-shared/services/index.js").ChromeWording;
35
35
  readonly icon: import("lit-html").TemplateResult<1>;
36
36
  readonly run: (ctx: ToolbarContext) => void;
37
37
  }];
@@ -44,7 +44,7 @@ export declare const builtinToolbarConfig: {
44
44
  }, {
45
45
  readonly placement: ActionPlacement.More;
46
46
  readonly id: "c.delete";
47
- readonly label: "Delete";
47
+ readonly labelWording: import("../../../affine-shared/services/index.js").ChromeWording;
48
48
  readonly icon: import("lit-html").TemplateResult<1>;
49
49
  readonly variant: "destructive";
50
50
  readonly run: (ctx: ToolbarContext) => void;
@@ -56,12 +56,12 @@ export declare const builtinSurfaceToolbarConfig: {
56
56
  when: (ctx: ToolbarContext) => boolean;
57
57
  actions: ({
58
58
  id: string;
59
- label: string;
59
+ labelWording: import("../../../affine-shared/services/index.js").ChromeWording;
60
60
  run(ctx: ToolbarContext): void;
61
61
  disabled?: undefined;
62
62
  } | {
63
63
  id: string;
64
- label: string;
64
+ labelWording: import("../../../affine-shared/services/index.js").ChromeWording;
65
65
  disabled: true;
66
66
  run?: undefined;
67
67
  })[];
@@ -2,7 +2,7 @@ import { reassociateConnectorsCommand } from '../../../affine-block-surface/inde
2
2
  import { toast } from '../../../affine-components/toast/index.js';
3
3
  import { BookmarkStyles, EmbedIframeBlockModel } from '../../../affine-model/index.js';
4
4
  import { EMBED_CARD_HEIGHT, EMBED_CARD_WIDTH, } from '../../../affine-shared/consts/index.js';
5
- import { ActionPlacement, ToolbarModuleExtension, } from '../../../affine-shared/services/index.js';
5
+ import { ActionPlacement, TOAST_COPIED_TO_CLIPBOARD, TOOLBAR_CARD_VIEW, TOOLBAR_COPY, TOOLBAR_DELETE, TOOLBAR_DUPLICATE, TOOLBAR_EMBED_VIEW, TOOLBAR_INLINE_VIEW, toolbarActionLabel, ToolbarModuleExtension, translateKey, } from '../../../affine-shared/services/index.js';
6
6
  import { getBlockProps } from '../../../affine-shared/utils/index.js';
7
7
  import { Bound } from '../../../global/gfx/index.js';
8
8
  import { CaptionIcon, CopyIcon, DeleteIcon, DuplicateIcon, LinkedPageIcon, OpenInNewIcon, ResetIcon, } from '@blocksuite/icons/lit';
@@ -64,7 +64,7 @@ export const builtinToolbarConfig = {
64
64
  actions: [
65
65
  {
66
66
  id: 'inline',
67
- label: 'Inline view',
67
+ labelWording: TOOLBAR_INLINE_VIEW,
68
68
  run(ctx) {
69
69
  const model = ctx.getCurrentModelByType(EmbedIframeBlockModel);
70
70
  if (!model)
@@ -93,7 +93,7 @@ export const builtinToolbarConfig = {
93
93
  },
94
94
  {
95
95
  id: 'card',
96
- label: 'Card view',
96
+ labelWording: TOOLBAR_CARD_VIEW,
97
97
  run(ctx) {
98
98
  const model = ctx.getCurrentModelByType(EmbedIframeBlockModel);
99
99
  if (!model)
@@ -121,7 +121,7 @@ export const builtinToolbarConfig = {
121
121
  },
122
122
  {
123
123
  id: 'embed',
124
- label: 'Embed view',
124
+ labelWording: TOOLBAR_EMBED_VIEW,
125
125
  disabled: true,
126
126
  },
127
127
  ],
@@ -143,7 +143,7 @@ export const builtinToolbarConfig = {
143
143
  .actions=${actions}
144
144
  .context=${ctx}
145
145
  .toggle=${toggle}
146
- .viewType$=${signal(actions[2].label)}
146
+ .viewType$=${signal(toolbarActionLabel(ctx.std, actions[2]))}
147
147
  ></affine-view-dropdown-menu>`)}`;
148
148
  },
149
149
  },
@@ -190,7 +190,7 @@ export const builtinToolbarConfig = {
190
190
  actions: [
191
191
  {
192
192
  id: 'copy',
193
- label: 'Copy',
193
+ labelWording: TOOLBAR_COPY,
194
194
  icon: CopyIcon(),
195
195
  run(ctx) {
196
196
  const model = ctx.getCurrentModelByType(EmbedIframeBlockModel);
@@ -199,7 +199,7 @@ export const builtinToolbarConfig = {
199
199
  const slice = Slice.fromModels(ctx.store, [model]);
200
200
  ctx.clipboard
201
201
  .copySlice(slice)
202
- .then(() => toast(ctx.host, 'Copied to clipboard'))
202
+ .then(() => toast(ctx.host, translateKey(ctx.std, ...TOAST_COPIED_TO_CLIPBOARD)))
203
203
  .catch(console.error);
204
204
  ctx.track('CopiedLink', {
205
205
  ...trackBaseProps,
@@ -209,7 +209,7 @@ export const builtinToolbarConfig = {
209
209
  },
210
210
  {
211
211
  id: 'duplicate',
212
- label: 'Duplicate',
212
+ labelWording: TOOLBAR_DUPLICATE,
213
213
  icon: DuplicateIcon(),
214
214
  run(ctx) {
215
215
  const model = ctx.getCurrentModelByType(EmbedIframeBlockModel);
@@ -248,7 +248,7 @@ export const builtinToolbarConfig = {
248
248
  {
249
249
  placement: ActionPlacement.More,
250
250
  id: 'c.delete',
251
- label: 'Delete',
251
+ labelWording: TOOLBAR_DELETE,
252
252
  icon: DeleteIcon(),
253
253
  variant: 'destructive',
254
254
  run(ctx) {
@@ -272,7 +272,7 @@ export const builtinSurfaceToolbarConfig = {
272
272
  actions: [
273
273
  {
274
274
  id: 'card',
275
- label: 'Card view',
275
+ labelWording: TOOLBAR_CARD_VIEW,
276
276
  run(ctx) {
277
277
  const model = ctx.getCurrentModelByType(EmbedIframeBlockModel);
278
278
  if (!model)
@@ -301,7 +301,7 @@ export const builtinSurfaceToolbarConfig = {
301
301
  },
302
302
  {
303
303
  id: 'embed',
304
- label: 'Embed view',
304
+ labelWording: TOOLBAR_EMBED_VIEW,
305
305
  disabled: true,
306
306
  },
307
307
  ],
@@ -322,7 +322,7 @@ export const builtinSurfaceToolbarConfig = {
322
322
  @toggle=${onToggle}
323
323
  .actions=${actions}
324
324
  .context=${ctx}
325
- .viewType$=${signal(actions[1].label)}
325
+ .viewType$=${signal(toolbarActionLabel(ctx.std, actions[1]))}
326
326
  ></affine-view-dropdown-menu>`)}`;
327
327
  },
328
328
  },
@@ -35,7 +35,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
35
35
  import { SurfaceBlockModel } from '../../affine-block-surface/index.js';
36
36
  import { CaptionedBlockComponent, SelectedStyle, } from '../../affine-components/caption/index.js';
37
37
  import { createLitPortal } from '../../affine-components/portal/index.js';
38
- import { EmbedIframeService, LinkPreviewServiceIdentifier, NotificationProvider, } from '../../affine-shared/services/index.js';
38
+ import { EmbedIframeService, LinkPreviewServiceIdentifier, NotificationProvider, TOAST_NO_LINK_FOUND, translateKey, } from '../../affine-shared/services/index.js';
39
39
  import { matchModels } from '../../affine-shared/utils/index.js';
40
40
  import { BlockSuiteError, ErrorCode } from '../../global/exceptions/index.js';
41
41
  import { BlockSelection } from '../../std/index.js';
@@ -222,7 +222,7 @@ let EmbedIframeBlockComponent = (() => {
222
222
  const link = this.model.props.url;
223
223
  if (!link) {
224
224
  this.notificationService?.notify({
225
- title: 'No link found',
225
+ title: translateKey(this.std, ...TOAST_NO_LINK_FOUND),
226
226
  message: 'Please set a link to the block',
227
227
  accent: 'warning',
228
228
  onClose: function () { },