@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.
- package/dist/_pkgs/affine-block-attachment/attachment-block.js +2 -2
- package/dist/_pkgs/affine-block-attachment/configs/toolbar.d.ts +2 -2
- package/dist/_pkgs/affine-block-attachment/configs/toolbar.js +9 -7
- package/dist/_pkgs/affine-block-bookmark/configs/toolbar.js +12 -12
- package/dist/_pkgs/affine-block-code/code-block.js +2 -2
- package/dist/_pkgs/affine-block-code/code-toolbar/config.js +6 -0
- package/dist/_pkgs/affine-block-database/database-block.js +2 -2
- package/dist/_pkgs/affine-block-embed/common/render-linked-doc.js +3 -3
- package/dist/_pkgs/affine-block-embed/configs/toolbar.js +11 -11
- package/dist/_pkgs/affine-block-embed/embed-html-block/configs/toolbar.js +5 -5
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.d.ts +7 -7
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.js +12 -12
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.js +2 -2
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/toolbar.js +9 -9
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-linked-doc-block.js +4 -4
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/components/embed-synced-doc-card.js +5 -4
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/configs/toolbar.js +9 -9
- package/dist/_pkgs/affine-block-frame/frame-toolbar.js +2 -2
- package/dist/_pkgs/affine-block-image/configs/toolbar.js +4 -4
- package/dist/_pkgs/affine-block-note/configs/toolbar.js +2 -2
- package/dist/_pkgs/affine-block-root/configs/toolbar.d.ts +6 -4
- package/dist/_pkgs/affine-block-root/configs/toolbar.js +6 -6
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/misc.d.ts +10 -10
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/misc.js +4 -4
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/more.d.ts +7 -7
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/more.js +8 -8
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +3 -1
- package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +15 -4
- package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +17 -0
- package/dist/_pkgs/affine-block-surface/extensions/spotlight.d.ts +21 -0
- package/dist/_pkgs/affine-block-surface/extensions/spotlight.js +17 -3
- package/dist/_pkgs/affine-block-surface/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-surface/index.js +1 -0
- package/dist/_pkgs/affine-block-surface/renderer/element-highlight-overlay.d.ts +17 -0
- package/dist/_pkgs/affine-block-surface/renderer/element-highlight-overlay.js +66 -0
- package/dist/_pkgs/affine-block-surface/view.js +5 -0
- package/dist/_pkgs/affine-block-surface-ref/configs/toolbar.js +4 -4
- package/dist/_pkgs/affine-components/highlight-dropdown-menu/highlight-duotone-icon.js +8 -8
- package/dist/_pkgs/affine-components/highlight-dropdown-menu/text-duotone-icon.js +11 -11
- package/dist/_pkgs/affine-components/icons/text.js +426 -426
- package/dist/_pkgs/affine-components/open-doc-dropdown-menu/dropdown-menu.d.ts +2 -0
- package/dist/_pkgs/affine-components/resource/resource.js +2 -0
- package/dist/_pkgs/affine-components/view-dropdown-menu/dropdown-menu.js +27 -14
- package/dist/_pkgs/affine-inline-link/link-node/configs/toolbar.d.ts +4 -4
- package/dist/_pkgs/affine-inline-link/link-node/configs/toolbar.js +6 -6
- package/dist/_pkgs/affine-inline-reference/reference-node/configs/toolbar.d.ts +4 -4
- package/dist/_pkgs/affine-inline-reference/reference-node/configs/toolbar.js +6 -6
- package/dist/_pkgs/affine-model/elements/bpmn/pool.d.ts +61 -0
- package/dist/_pkgs/affine-model/elements/bpmn/pool.js +93 -0
- package/dist/_pkgs/affine-model/elements/cynefin/cynefin.d.ts +7 -2
- package/dist/_pkgs/affine-model/elements/cynefin/cynefin.js +9 -4
- package/dist/_pkgs/affine-model/elements/edgy/board.d.ts +7 -2
- package/dist/_pkgs/affine-model/elements/edgy/board.js +9 -4
- package/dist/_pkgs/affine-model/elements/edgy/facets.d.ts +20 -3
- package/dist/_pkgs/affine-model/elements/edgy/facets.js +13 -4
- package/dist/_pkgs/affine-model/elements/estuarine/estuarine.d.ts +7 -2
- package/dist/_pkgs/affine-model/elements/estuarine/estuarine.js +9 -4
- package/dist/_pkgs/affine-model/elements/framework-background/background.d.ts +7 -2
- package/dist/_pkgs/affine-model/elements/framework-background/background.js +9 -4
- package/dist/_pkgs/affine-model/elements/framework-background/hit-test.d.ts +48 -0
- package/dist/_pkgs/affine-model/elements/framework-background/hit-test.js +55 -0
- package/dist/_pkgs/affine-model/elements/framework-background/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/framework-background/index.js +1 -0
- package/dist/_pkgs/affine-shared/services/edit-props-store.d.ts +11 -0
- package/dist/_pkgs/affine-shared/services/edit-props-store.js +15 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/action.d.ts +32 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/action.js +16 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/flags.d.ts +10 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/flags.js +32 -1
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +106 -0
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +201 -0
- package/dist/_pkgs/affine-shared/services/translation-service/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/services/translation-service/index.js +1 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/catalogue-groups.d.ts +11 -16
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/catalogue-groups.js +11 -28
- package/dist/_pkgs/affine-widget-keyboard-toolbar/config.js +2 -1
- package/dist/_pkgs/affine-widget-keyboard-toolbar/icons.js +98 -98
- package/dist/_pkgs/affine-widget-slash-menu/config.js +2 -1
- package/dist/_pkgs/affine-widget-toolbar/toolbar.js +5 -0
- package/dist/_pkgs/affine-widget-toolbar/utils.d.ts +19 -2
- package/dist/_pkgs/affine-widget-toolbar/utils.js +22 -7
- package/dist/_pkgs/data-view/core/group-by/renderer/boolean-group.js +11 -11
- package/dist/_pkgs/data-view/core/utils/menu-title.js +17 -17
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/group-title.js +18 -18
- package/dist/_pkgs/std/extension/command-registry.d.ts +36 -0
- package/dist/_pkgs/std/extension/command-registry.js +16 -0
- package/dist/_pkgs/std/extension/translation-manifest.d.ts +46 -1
- package/dist/_pkgs/std/extension/translation-manifest.js +58 -0
- package/dist/_pkgs/std/gfx/highlight.d.ts +84 -0
- package/dist/_pkgs/std/gfx/highlight.js +112 -0
- package/dist/_pkgs/std/gfx/index.d.ts +1 -0
- package/dist/_pkgs/std/gfx/index.js +1 -0
- package/dist/_pkgs/std/gfx/interactivity/gfx-view-event-handler.js +17 -3
- package/dist/_pkgs/std/scope/std-scope.d.ts +2 -1
- package/dist/_pkgs/std/scope/std-scope.js +2 -0
- package/dist/_pkgs/std/utils/gfx.js +2 -0
- package/dist/shortcuts.d.ts +20 -6
- package/dist/shortcuts.js +7 -9
- package/dist/translations.js +25 -18
- package/package.json +13 -1
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The editor's own chrome wordings, as `[key, fallback]` pairs.
|
|
3
|
+
*
|
|
4
|
+
* ## Why they are a table and not forty literals
|
|
5
|
+
*
|
|
6
|
+
* "Copy", "Delete", "Card view" are the SAME word on a dozen toolbars — the
|
|
7
|
+
* bookmark's, the image's, the embed's, the linked doc's — and a literal per
|
|
8
|
+
* call site is a wording a host has to translate a dozen times and can get
|
|
9
|
+
* twelve different answers for. One pair per word, imported where it is
|
|
10
|
+
* rendered, is what makes the manifest's promise ("every key the library can
|
|
11
|
+
* ask for") describe a list a human can actually word.
|
|
12
|
+
*
|
|
13
|
+
* ## The tuple shape is load-bearing
|
|
14
|
+
*
|
|
15
|
+
* `translateKey(std, ...COPY)` spreads into `(std, key, fallback)`, so a call
|
|
16
|
+
* site names the wording once and cannot pair the wrong fallback with the right
|
|
17
|
+
* key. It is also what
|
|
18
|
+
* `packages/affine/all/src/__tests__/translations/manifest.unit.spec.ts` reads:
|
|
19
|
+
* the two adjacent literals below are the pair its drift check confirms the
|
|
20
|
+
* manifest against, which is why the wordings live in literals here rather than
|
|
21
|
+
* being derived from anything.
|
|
22
|
+
*
|
|
23
|
+
* Chrome, so every one of them ships an English default: a standalone
|
|
24
|
+
* playground with no `TranslationProvider` registered must read exactly as it
|
|
25
|
+
* did before these keys existed.
|
|
26
|
+
*/
|
|
27
|
+
/* ── Toasts ───────────────────────────────────────────────────────────── */
|
|
28
|
+
/**
|
|
29
|
+
* The transient messages the editor puts on screen after a gesture.
|
|
30
|
+
*
|
|
31
|
+
* They were the last English strings left in a fully translated host (#182):
|
|
32
|
+
* silent while nobody injected a `NotificationProvider`, and English in the
|
|
33
|
+
* middle of a French UI the moment somebody did.
|
|
34
|
+
*/
|
|
35
|
+
export const TOAST_COPIED_TO_CLIPBOARD = [
|
|
36
|
+
'com.labre.toast.copied-to-clipboard',
|
|
37
|
+
'Copied to clipboard',
|
|
38
|
+
];
|
|
39
|
+
export const TOAST_LINKED_DOC_CREATED = [
|
|
40
|
+
'com.labre.toast.linked-doc-created',
|
|
41
|
+
'Linked doc created',
|
|
42
|
+
];
|
|
43
|
+
export const TOAST_NOTE_REMOVED_FROM_PAGE = [
|
|
44
|
+
'com.labre.toast.note-removed-from-page-mode',
|
|
45
|
+
'Note removed from Page Mode',
|
|
46
|
+
];
|
|
47
|
+
export const TOAST_FRAME_INSERTED_INTO_PAGE = [
|
|
48
|
+
'com.labre.toast.frame-inserted-into-page',
|
|
49
|
+
'Frame inserted into Page.',
|
|
50
|
+
];
|
|
51
|
+
export const TOAST_NO_LINK_FOUND = [
|
|
52
|
+
'com.labre.toast.no-link-found',
|
|
53
|
+
'No link found',
|
|
54
|
+
];
|
|
55
|
+
/* ── Toolbars and menus ───────────────────────────────────────────────── */
|
|
56
|
+
export const TOOLBAR_BRING_TO_FRONT = [
|
|
57
|
+
'com.labre.toolbar.bring-to-front',
|
|
58
|
+
'Bring to Front',
|
|
59
|
+
];
|
|
60
|
+
export const TOOLBAR_SEND_TO_BACK = [
|
|
61
|
+
'com.labre.toolbar.send-to-back',
|
|
62
|
+
'Send to Back',
|
|
63
|
+
];
|
|
64
|
+
export const TOOLBAR_COPY = ['com.labre.toolbar.copy', 'Copy'];
|
|
65
|
+
export const TOOLBAR_DUPLICATE = [
|
|
66
|
+
'com.labre.toolbar.duplicate',
|
|
67
|
+
'Duplicate',
|
|
68
|
+
];
|
|
69
|
+
export const TOOLBAR_DELETE = [
|
|
70
|
+
'com.labre.toolbar.delete',
|
|
71
|
+
'Delete',
|
|
72
|
+
];
|
|
73
|
+
export const TOOLBAR_LOCK = ['com.labre.toolbar.lock', 'Lock'];
|
|
74
|
+
export const TOOLBAR_MORE = ['com.labre.toolbar.more', 'More'];
|
|
75
|
+
export const TOOLBAR_LINK = ['com.labre.toolbar.link', 'Link'];
|
|
76
|
+
export const TOOLBAR_CREATE_LINKED_DOC = [
|
|
77
|
+
'com.labre.toolbar.create-linked-doc',
|
|
78
|
+
'Create linked doc',
|
|
79
|
+
];
|
|
80
|
+
export const TOOLBAR_DRAW_CONNECTOR = [
|
|
81
|
+
'com.labre.toolbar.draw-connector',
|
|
82
|
+
'Draw connector',
|
|
83
|
+
];
|
|
84
|
+
/**
|
|
85
|
+
* The four wordings of the view switcher — the control that decides whether a
|
|
86
|
+
* link is drawn as words, as a card or as the document itself.
|
|
87
|
+
*
|
|
88
|
+
* One set for every block that offers it (bookmark, attachment, embed, linked
|
|
89
|
+
* doc, synced doc, iframe, the inline link and the inline reference): they are
|
|
90
|
+
* one control with one vocabulary, and a host that had to word "Card view"
|
|
91
|
+
* eight times would end up with eight wordings of it.
|
|
92
|
+
*/
|
|
93
|
+
export const TOOLBAR_SWITCH_VIEW = [
|
|
94
|
+
'com.labre.toolbar.switch-view',
|
|
95
|
+
'Switch view',
|
|
96
|
+
];
|
|
97
|
+
export const TOOLBAR_INLINE_VIEW = [
|
|
98
|
+
'com.labre.toolbar.inline-view',
|
|
99
|
+
'Inline view',
|
|
100
|
+
];
|
|
101
|
+
export const TOOLBAR_CARD_VIEW = [
|
|
102
|
+
'com.labre.toolbar.card-view',
|
|
103
|
+
'Card view',
|
|
104
|
+
];
|
|
105
|
+
export const TOOLBAR_EMBED_VIEW = [
|
|
106
|
+
'com.labre.toolbar.embed-view',
|
|
107
|
+
'Embed view',
|
|
108
|
+
];
|
|
109
|
+
/* ── What a linked-doc card says instead of a preview ─────────────────── */
|
|
110
|
+
/**
|
|
111
|
+
* The four states a linked-doc card can be in with nothing to show: deleted,
|
|
112
|
+
* unreadable, empty, and — for the SYNCED card, which frames a page rather
|
|
113
|
+
* than a doc — empty in its own words.
|
|
114
|
+
*
|
|
115
|
+
* All four and not only the two the recette caught (#183): they are one
|
|
116
|
+
* sentence rendered by one ternary, and translating half of it would leave a
|
|
117
|
+
* card that changes language when the document it points at goes missing.
|
|
118
|
+
*/
|
|
119
|
+
export const LINKED_DOC_DELETED = [
|
|
120
|
+
'com.labre.embed.linked-doc.deleted',
|
|
121
|
+
'This linked doc is deleted.',
|
|
122
|
+
];
|
|
123
|
+
export const LINKED_DOC_FAILED = [
|
|
124
|
+
'com.labre.embed.linked-doc.failed',
|
|
125
|
+
'This linked doc failed to load.',
|
|
126
|
+
];
|
|
127
|
+
export const LINKED_DOC_EMPTY_PREVIEW = [
|
|
128
|
+
'com.labre.embed.linked-doc.empty-preview',
|
|
129
|
+
'Preview of the doc will be displayed here.',
|
|
130
|
+
];
|
|
131
|
+
export const SYNCED_DOC_EMPTY_PREVIEW = [
|
|
132
|
+
'com.labre.embed.synced-doc.empty-preview',
|
|
133
|
+
'Preview of the page will be displayed here.',
|
|
134
|
+
];
|
|
135
|
+
/* ── The board toolbars every framework shares ────────────────────────── */
|
|
136
|
+
/**
|
|
137
|
+
* The resize toggle, which is the one entry EVERY framework board carries —
|
|
138
|
+
* Wardley, BPMN, C4, EDGY, Cynefin, Estuarine and the two DDD boards all
|
|
139
|
+
* register the same always-on button (`docs/adr/0009`: a stored board must stay
|
|
140
|
+
* usable with its framework switched off).
|
|
141
|
+
*
|
|
142
|
+
* Declared here rather than once per framework because it is not a framework's
|
|
143
|
+
* own word: it names a behaviour of the generic frame primitive, and eight
|
|
144
|
+
* copies of it in eight manifests would be eight keys for one tooltip.
|
|
145
|
+
*/
|
|
146
|
+
export const BOARD_RESIZE_TOGGLE = [
|
|
147
|
+
'com.labre.board.toolbar.resize-toggle',
|
|
148
|
+
'Enable / lock resizing',
|
|
149
|
+
];
|
|
150
|
+
/**
|
|
151
|
+
* The legend button, in the two wordings the boards actually use: the notation
|
|
152
|
+
* boards say "notation", Wardley says "components".
|
|
153
|
+
*
|
|
154
|
+
* Two keys and not one interpolated sentence, for the reason the interchange
|
|
155
|
+
* counts already ran on — the seam has no interpolation, so the smallest honest
|
|
156
|
+
* unit is the whole sentence.
|
|
157
|
+
*/
|
|
158
|
+
export const BOARD_LEGEND_NOTATION = [
|
|
159
|
+
'com.labre.board.toolbar.legend',
|
|
160
|
+
'Generate the legend (notation present)',
|
|
161
|
+
];
|
|
162
|
+
export const BOARD_LEGEND_COMPONENTS = [
|
|
163
|
+
'com.labre.board.toolbar.legend.components',
|
|
164
|
+
'Generate the legend (components present)',
|
|
165
|
+
];
|
|
166
|
+
/**
|
|
167
|
+
* Every wording declared above, in declaration order.
|
|
168
|
+
*
|
|
169
|
+
* The manifest (`@labre/affine/translations`) walks this instead of restating
|
|
170
|
+
* the pairs, so a wording added here reaches a host's catalogue with no second
|
|
171
|
+
* edit — the same "declared data, not restated data" rule the roles, the rules
|
|
172
|
+
* and the commands already follow.
|
|
173
|
+
*/
|
|
174
|
+
export const CHROME_WORDINGS = [
|
|
175
|
+
TOAST_COPIED_TO_CLIPBOARD,
|
|
176
|
+
TOAST_LINKED_DOC_CREATED,
|
|
177
|
+
TOAST_NOTE_REMOVED_FROM_PAGE,
|
|
178
|
+
TOAST_FRAME_INSERTED_INTO_PAGE,
|
|
179
|
+
TOAST_NO_LINK_FOUND,
|
|
180
|
+
TOOLBAR_BRING_TO_FRONT,
|
|
181
|
+
TOOLBAR_SEND_TO_BACK,
|
|
182
|
+
TOOLBAR_COPY,
|
|
183
|
+
TOOLBAR_DUPLICATE,
|
|
184
|
+
TOOLBAR_DELETE,
|
|
185
|
+
TOOLBAR_LOCK,
|
|
186
|
+
TOOLBAR_MORE,
|
|
187
|
+
TOOLBAR_LINK,
|
|
188
|
+
TOOLBAR_CREATE_LINKED_DOC,
|
|
189
|
+
TOOLBAR_DRAW_CONNECTOR,
|
|
190
|
+
TOOLBAR_SWITCH_VIEW,
|
|
191
|
+
TOOLBAR_INLINE_VIEW,
|
|
192
|
+
TOOLBAR_CARD_VIEW,
|
|
193
|
+
TOOLBAR_EMBED_VIEW,
|
|
194
|
+
LINKED_DOC_DELETED,
|
|
195
|
+
LINKED_DOC_FAILED,
|
|
196
|
+
LINKED_DOC_EMPTY_PREVIEW,
|
|
197
|
+
SYNCED_DOC_EMPTY_PREVIEW,
|
|
198
|
+
BOARD_RESIZE_TOGGLE,
|
|
199
|
+
BOARD_LEGEND_NOTATION,
|
|
200
|
+
BOARD_LEGEND_COMPONENTS,
|
|
201
|
+
];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BlockStdScope } from '../../../std/index.js';
|
|
2
2
|
import type { ExtensionType } from '../../../store/index.js';
|
|
3
|
+
export * from './chrome.js';
|
|
3
4
|
/**
|
|
4
5
|
* The library holds no prose: every human-readable string it produces —
|
|
5
6
|
* shortcut labels, role names, validation messages — is an i18n KEY
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { AnyCommandDescriptor } from '../../std/index.js';
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* The header key prefix and the header fallback, re-exported from `@labre/std`
|
|
4
|
+
* where they are declared.
|
|
5
|
+
*
|
|
6
|
+
* They moved there so a FRAMEWORK can derive its own catalogue-header keys for
|
|
7
|
+
* the translation manifest without depending on this widget (#183): in the
|
|
8
|
+
* bundled distribution core's command registry names no framework category, so
|
|
9
|
+
* every framework has to contribute its own. Re-exported rather than moved
|
|
10
|
+
* away, because the panel below is still the thing that renders them.
|
|
11
|
+
*/
|
|
12
|
+
export { CATALOGUE_CATEGORY_KEY_PREFIX, humanizeCategory } from '../../std/index.js';
|
|
4
13
|
/**
|
|
5
14
|
* One section of the catalogue: a category and the commands declaring it.
|
|
6
15
|
*
|
|
@@ -30,17 +39,3 @@ export interface CatalogueGroup {
|
|
|
30
39
|
* knows nothing about lit, the DOM or the editor.
|
|
31
40
|
*/
|
|
32
41
|
export declare function groupCommandsByCategory(commands: readonly AnyCommandDescriptor[]): CatalogueGroup[];
|
|
33
|
-
/**
|
|
34
|
-
* The English default for a category header, derived from the category id.
|
|
35
|
-
*
|
|
36
|
-
* `'backgrounds'` → `'Backgrounds'`, `'value-flow'` → `'Value flow'`,
|
|
37
|
-
* `'boundedContext'` → `'Bounded context'`. Sentence case, not title case: a
|
|
38
|
-
* header is a phrase, and capitalising every word turns `'change arrows'` into
|
|
39
|
-
* a product name.
|
|
40
|
-
*
|
|
41
|
-
* It is a FALLBACK and nothing more. A host with a catalogue answers
|
|
42
|
-
* `com.labre.catalogue.category.<id>` and this is never seen; a standalone
|
|
43
|
-
* playground reads a word instead of a raw key. The library still invents no
|
|
44
|
-
* framework prose — a category id is the framework's own word, only respelled.
|
|
45
|
-
*/
|
|
46
|
-
export declare function humanizeCategory(category: string): string;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The header key prefix and the header fallback, re-exported from `@labre/std`
|
|
3
|
+
* where they are declared.
|
|
4
|
+
*
|
|
5
|
+
* They moved there so a FRAMEWORK can derive its own catalogue-header keys for
|
|
6
|
+
* the translation manifest without depending on this widget (#183): in the
|
|
7
|
+
* bundled distribution core's command registry names no framework category, so
|
|
8
|
+
* every framework has to contribute its own. Re-exported rather than moved
|
|
9
|
+
* away, because the panel below is still the thing that renders them.
|
|
10
|
+
*/
|
|
11
|
+
export { CATALOGUE_CATEGORY_KEY_PREFIX, humanizeCategory } from '../../std/index.js';
|
|
3
12
|
/**
|
|
4
13
|
* Split a surface's commands into the sections the sidepanel draws.
|
|
5
14
|
*
|
|
@@ -38,29 +47,3 @@ export function groupCommandsByCategory(commands) {
|
|
|
38
47
|
groups.push({ category: null, commands: uncategorised });
|
|
39
48
|
return groups;
|
|
40
49
|
}
|
|
41
|
-
/**
|
|
42
|
-
* The English default for a category header, derived from the category id.
|
|
43
|
-
*
|
|
44
|
-
* `'backgrounds'` → `'Backgrounds'`, `'value-flow'` → `'Value flow'`,
|
|
45
|
-
* `'boundedContext'` → `'Bounded context'`. Sentence case, not title case: a
|
|
46
|
-
* header is a phrase, and capitalising every word turns `'change arrows'` into
|
|
47
|
-
* a product name.
|
|
48
|
-
*
|
|
49
|
-
* It is a FALLBACK and nothing more. A host with a catalogue answers
|
|
50
|
-
* `com.labre.catalogue.category.<id>` and this is never seen; a standalone
|
|
51
|
-
* playground reads a word instead of a raw key. The library still invents no
|
|
52
|
-
* framework prose — a category id is the framework's own word, only respelled.
|
|
53
|
-
*/
|
|
54
|
-
export function humanizeCategory(category) {
|
|
55
|
-
const words = category
|
|
56
|
-
// camelCase and PascalCase boundaries, before the separators are split on:
|
|
57
|
-
// `'boundedContext'` has no separator to find otherwise.
|
|
58
|
-
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
59
|
-
.split(/[-_\s]+/)
|
|
60
|
-
.filter(Boolean)
|
|
61
|
-
.map(word => word.toLowerCase());
|
|
62
|
-
if (!words.length)
|
|
63
|
-
return category;
|
|
64
|
-
const [first, ...rest] = words;
|
|
65
|
-
return [first.charAt(0).toUpperCase() + first.slice(1), ...rest].join(' ');
|
|
66
|
-
}
|
|
@@ -22,6 +22,7 @@ import { assertType } from '../global/utils/index.js';
|
|
|
22
22
|
import { AttachmentIcon, BoldIcon, BulletedListIcon, CheckBoxCheckLinearIcon, CloseIcon, CodeBlockIcon, CodeIcon, CollapseTabIcon, CopyIcon, DatabaseKanbanViewIcon, DatabaseTableViewIcon, DeleteIcon, DividerIcon, DuplicateIcon, EmbedIcon, FontIcon, FrameIcon, GithubIcon, GroupIcon, ImageIcon, ItalicIcon, LinkedPageIcon, LinkIcon, LoomLogoIcon, NewPageIcon, NowIcon, NumberedListIcon, PlusIcon, QuoteIcon, RedoIcon, RightTabIcon, StrikeThroughIcon, TeXIcon, TextIcon, TodayIcon, TomorrowIcon, UnderLineIcon, UndoIcon, YesterdayIcon, YoutubeDuotoneIcon, } from '@blocksuite/icons/lit';
|
|
23
23
|
import { ConfigExtensionFactory, } from '../std/index.js';
|
|
24
24
|
import { GfxControllerIdentifier } from '../std/gfx/index.js';
|
|
25
|
+
import { TOAST_COPIED_TO_CLIPBOARD, translateKey, } from '../affine-shared/services/index.js';
|
|
25
26
|
import { computed } from '@preact/signals-core';
|
|
26
27
|
import { cssVarV2 } from '@toeverything/theme/v2';
|
|
27
28
|
import { FigmaDuotoneIcon, HeadingIcon, HighLightDuotoneIcon, TextBackgroundDuotoneIcon, TextColorIcon, } from './icons.js';
|
|
@@ -859,7 +860,7 @@ export const defaultKeyboardToolbarConfig = {
|
|
|
859
860
|
.pipe(getSelectedModelsCommand)
|
|
860
861
|
.with({
|
|
861
862
|
onCopy: () => {
|
|
862
|
-
toast(std.host,
|
|
863
|
+
toast(std.host, translateKey(std, ...TOAST_COPIED_TO_CLIPBOARD));
|
|
863
864
|
},
|
|
864
865
|
})
|
|
865
866
|
.pipe(draftSelectedModelsCommand)
|
|
@@ -19,105 +19,105 @@ export function HeadingIcon(i) {
|
|
|
19
19
|
return Heading1Icon();
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
export const HighLightDuotoneIcon = (color) => html `<svg
|
|
23
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
24
|
-
width="24"
|
|
25
|
-
height="24"
|
|
26
|
-
viewBox="0 0 24 24"
|
|
27
|
-
fill="none"
|
|
28
|
-
>
|
|
29
|
-
<path
|
|
30
|
-
d="M5.8291 16.441L7.91757 18.5295L6.57811 19.8689C6.53119 19.9158 6.46406 19.9364 6.3989 19.9239L3.37036 19.3412C3.21285 19.3109 3.15331 19.1168 3.26673 19.0034L5.8291 16.441Z"
|
|
31
|
-
fill="${color}"
|
|
32
|
-
/>
|
|
33
|
-
<path
|
|
34
|
-
fill-rule="evenodd"
|
|
35
|
-
clip-rule="evenodd"
|
|
36
|
-
d="M19.0095 3.63759C17.9526 2.58067 16.26 2.516 15.1255 3.48919L7.32135 10.1837C6.35438 11.0132 6.05275 12.3823 6.58163 13.5414L6.73501 13.8775L5.67697 14.9356C5.30169 15.3108 5.30169 15.9193 5.67697 16.2946L8.06379 18.6814C8.43907 19.0567 9.04752 19.0567 9.4228 18.6814L10.4808 17.6234L10.8171 17.7768C11.9761 18.3057 13.3452 18.0041 14.1747 17.0371L20.8692 9.23294C21.8424 8.09846 21.7778 6.40588 20.7208 5.34896L19.0095 3.63759ZM16.1021 4.62769C16.6415 4.16498 17.4463 4.19572 17.9488 4.69825L19.6602 6.40962C20.1627 6.91215 20.1935 7.7169 19.7307 8.25631L14.6424 14.188L10.1704 9.71604L16.1021 4.62769ZM9.02857 10.6955L8.29798 11.3222C7.83822 11.7166 7.6948 12.3676 7.94627 12.9187L8.29785 13.6892C8.4348 13.9893 8.37947 14.3544 8.13372 14.6001L7.11878 15.6151L8.74329 17.2396L9.75812 16.2247C10.004 15.9789 10.3691 15.9236 10.6693 16.0606L11.4398 16.4122C11.9908 16.6636 12.6418 16.5202 13.0362 16.0605L13.6629 15.3299L9.02857 10.6955Z"
|
|
37
|
-
fill="${cssVarV2('icon/primary')}"
|
|
38
|
-
/>
|
|
22
|
+
export const HighLightDuotoneIcon = (color) => html `<svg
|
|
23
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
24
|
+
width="24"
|
|
25
|
+
height="24"
|
|
26
|
+
viewBox="0 0 24 24"
|
|
27
|
+
fill="none"
|
|
28
|
+
>
|
|
29
|
+
<path
|
|
30
|
+
d="M5.8291 16.441L7.91757 18.5295L6.57811 19.8689C6.53119 19.9158 6.46406 19.9364 6.3989 19.9239L3.37036 19.3412C3.21285 19.3109 3.15331 19.1168 3.26673 19.0034L5.8291 16.441Z"
|
|
31
|
+
fill="${color}"
|
|
32
|
+
/>
|
|
33
|
+
<path
|
|
34
|
+
fill-rule="evenodd"
|
|
35
|
+
clip-rule="evenodd"
|
|
36
|
+
d="M19.0095 3.63759C17.9526 2.58067 16.26 2.516 15.1255 3.48919L7.32135 10.1837C6.35438 11.0132 6.05275 12.3823 6.58163 13.5414L6.73501 13.8775L5.67697 14.9356C5.30169 15.3108 5.30169 15.9193 5.67697 16.2946L8.06379 18.6814C8.43907 19.0567 9.04752 19.0567 9.4228 18.6814L10.4808 17.6234L10.8171 17.7768C11.9761 18.3057 13.3452 18.0041 14.1747 17.0371L20.8692 9.23294C21.8424 8.09846 21.7778 6.40588 20.7208 5.34896L19.0095 3.63759ZM16.1021 4.62769C16.6415 4.16498 17.4463 4.19572 17.9488 4.69825L19.6602 6.40962C20.1627 6.91215 20.1935 7.7169 19.7307 8.25631L14.6424 14.188L10.1704 9.71604L16.1021 4.62769ZM9.02857 10.6955L8.29798 11.3222C7.83822 11.7166 7.6948 12.3676 7.94627 12.9187L8.29785 13.6892C8.4348 13.9893 8.37947 14.3544 8.13372 14.6001L7.11878 15.6151L8.74329 17.2396L9.75812 16.2247C10.004 15.9789 10.3691 15.9236 10.6693 16.0606L11.4398 16.4122C11.9908 16.6636 12.6418 16.5202 13.0362 16.0605L13.6629 15.3299L9.02857 10.6955Z"
|
|
37
|
+
fill="${cssVarV2('icon/primary')}"
|
|
38
|
+
/>
|
|
39
39
|
</svg>`;
|
|
40
|
-
export const TextColorIcon = (color) => html `<svg
|
|
41
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
42
|
-
width="32"
|
|
43
|
-
height="32"
|
|
44
|
-
viewBox="0 0 32 32"
|
|
45
|
-
fill="none"
|
|
46
|
-
>
|
|
47
|
-
<path
|
|
48
|
-
fill-rule="evenodd"
|
|
49
|
-
clip-rule="evenodd"
|
|
50
|
-
d="M14.0627 6.16255C14.385 5.30291 15.2068 4.7334 16.1249 4.7334C17.043 4.7334 17.8648 5.30291 18.1872 6.16255L23.7279 20.9378C23.9219 21.455 23.6599 22.0314 23.1427 22.2253C22.6256 22.4192 22.0492 22.1572 21.8553 21.6401L20.2289 17.3031H12.021L10.3946 21.6401C10.2007 22.1572 9.62428 22.4192 9.10716 22.2253C8.59004 22.0314 8.32803 21.455 8.52195 20.9378L14.0627 6.16255ZM12.771 15.3031H19.4789L16.3146 6.8648C16.2849 6.78576 16.2094 6.7334 16.1249 6.7334C16.0405 6.7334 15.965 6.78576 15.9353 6.8648L12.771 15.3031Z"
|
|
51
|
-
fill="${cssVarV2('icon/primary')}"
|
|
52
|
-
/>
|
|
53
|
-
<rect
|
|
54
|
-
x="5.45837"
|
|
55
|
-
y="24"
|
|
56
|
-
width="21.3333"
|
|
57
|
-
height="3.33333"
|
|
58
|
-
rx="1"
|
|
59
|
-
fill=${color}
|
|
60
|
-
/>
|
|
40
|
+
export const TextColorIcon = (color) => html `<svg
|
|
41
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
42
|
+
width="32"
|
|
43
|
+
height="32"
|
|
44
|
+
viewBox="0 0 32 32"
|
|
45
|
+
fill="none"
|
|
46
|
+
>
|
|
47
|
+
<path
|
|
48
|
+
fill-rule="evenodd"
|
|
49
|
+
clip-rule="evenodd"
|
|
50
|
+
d="M14.0627 6.16255C14.385 5.30291 15.2068 4.7334 16.1249 4.7334C17.043 4.7334 17.8648 5.30291 18.1872 6.16255L23.7279 20.9378C23.9219 21.455 23.6599 22.0314 23.1427 22.2253C22.6256 22.4192 22.0492 22.1572 21.8553 21.6401L20.2289 17.3031H12.021L10.3946 21.6401C10.2007 22.1572 9.62428 22.4192 9.10716 22.2253C8.59004 22.0314 8.32803 21.455 8.52195 20.9378L14.0627 6.16255ZM12.771 15.3031H19.4789L16.3146 6.8648C16.2849 6.78576 16.2094 6.7334 16.1249 6.7334C16.0405 6.7334 15.965 6.78576 15.9353 6.8648L12.771 15.3031Z"
|
|
51
|
+
fill="${cssVarV2('icon/primary')}"
|
|
52
|
+
/>
|
|
53
|
+
<rect
|
|
54
|
+
x="5.45837"
|
|
55
|
+
y="24"
|
|
56
|
+
width="21.3333"
|
|
57
|
+
height="3.33333"
|
|
58
|
+
rx="1"
|
|
59
|
+
fill=${color}
|
|
60
|
+
/>
|
|
61
61
|
</svg>`;
|
|
62
|
-
export const TextBackgroundDuotoneIcon = (color) => html `<svg
|
|
63
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
64
|
-
width="32"
|
|
65
|
-
height="32"
|
|
66
|
-
viewBox="0 0 32 32"
|
|
67
|
-
fill="none"
|
|
68
|
-
>
|
|
69
|
-
<path
|
|
70
|
-
fill-rule="evenodd"
|
|
71
|
-
clip-rule="evenodd"
|
|
72
|
-
d="M4.57507 7.33336C4.57507 5.60287 5.97791 4.20003 7.70841 4.20003H25.0417C26.7722 4.20003 28.1751 5.60287 28.1751 7.33336V24.6667C28.1751 26.3972 26.7722 27.8 25.0417 27.8H7.70841C5.97791 27.8 4.57507 26.3972 4.57507 24.6667V7.33336Z"
|
|
73
|
-
fill="${color}"
|
|
74
|
-
/>
|
|
75
|
-
<path
|
|
76
|
-
fill-rule="evenodd"
|
|
77
|
-
clip-rule="evenodd"
|
|
78
|
-
d="M4.57495 7.33333C4.57495 5.60284 5.97779 4.2 7.70828 4.2H25.0416C26.7721 4.2 28.175 5.60284 28.175 7.33333V24.6667C28.175 26.3972 26.7721 27.8 25.0416 27.8H7.70828C5.97779 27.8 4.57495 26.3972 4.57495 24.6667V7.33333ZM7.70828 5.13333C6.49326 5.13333 5.50828 6.1183 5.50828 7.33333V24.6667C5.50828 25.8817 6.49326 26.8667 7.70828 26.8667H25.0416C26.2566 26.8667 27.2416 25.8817 27.2416 24.6667V7.33333C27.2416 6.1183 26.2566 5.13333 25.0416 5.13333H7.70828Z"
|
|
79
|
-
fill="black"
|
|
80
|
-
fill-opacity="0.22"
|
|
81
|
-
/>
|
|
82
|
-
<path
|
|
83
|
-
fill-rule="evenodd"
|
|
84
|
-
clip-rule="evenodd"
|
|
85
|
-
d="M14.5379 10.0064C14.8251 9.24064 15.5571 8.73332 16.375 8.73332C17.1928 8.73332 17.9249 9.24064 18.2121 10.0064L22.6446 21.8266C22.8386 22.3438 22.5766 22.9202 22.0594 23.1141C21.5423 23.308 20.9659 23.046 20.772 22.5289L19.5196 19.1891H13.2304L11.978 22.5289C11.7841 23.046 11.2076 23.308 10.6905 23.1141C10.1734 22.9202 9.9114 22.3438 10.1053 21.8266L14.5379 10.0064ZM13.9804 17.1891H18.7696L16.375 10.8035L13.9804 17.1891Z"
|
|
86
|
-
fill="${cssVarV2('text/primary')}"
|
|
87
|
-
/>
|
|
62
|
+
export const TextBackgroundDuotoneIcon = (color) => html `<svg
|
|
63
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
64
|
+
width="32"
|
|
65
|
+
height="32"
|
|
66
|
+
viewBox="0 0 32 32"
|
|
67
|
+
fill="none"
|
|
68
|
+
>
|
|
69
|
+
<path
|
|
70
|
+
fill-rule="evenodd"
|
|
71
|
+
clip-rule="evenodd"
|
|
72
|
+
d="M4.57507 7.33336C4.57507 5.60287 5.97791 4.20003 7.70841 4.20003H25.0417C26.7722 4.20003 28.1751 5.60287 28.1751 7.33336V24.6667C28.1751 26.3972 26.7722 27.8 25.0417 27.8H7.70841C5.97791 27.8 4.57507 26.3972 4.57507 24.6667V7.33336Z"
|
|
73
|
+
fill="${color}"
|
|
74
|
+
/>
|
|
75
|
+
<path
|
|
76
|
+
fill-rule="evenodd"
|
|
77
|
+
clip-rule="evenodd"
|
|
78
|
+
d="M4.57495 7.33333C4.57495 5.60284 5.97779 4.2 7.70828 4.2H25.0416C26.7721 4.2 28.175 5.60284 28.175 7.33333V24.6667C28.175 26.3972 26.7721 27.8 25.0416 27.8H7.70828C5.97779 27.8 4.57495 26.3972 4.57495 24.6667V7.33333ZM7.70828 5.13333C6.49326 5.13333 5.50828 6.1183 5.50828 7.33333V24.6667C5.50828 25.8817 6.49326 26.8667 7.70828 26.8667H25.0416C26.2566 26.8667 27.2416 25.8817 27.2416 24.6667V7.33333C27.2416 6.1183 26.2566 5.13333 25.0416 5.13333H7.70828Z"
|
|
79
|
+
fill="black"
|
|
80
|
+
fill-opacity="0.22"
|
|
81
|
+
/>
|
|
82
|
+
<path
|
|
83
|
+
fill-rule="evenodd"
|
|
84
|
+
clip-rule="evenodd"
|
|
85
|
+
d="M14.5379 10.0064C14.8251 9.24064 15.5571 8.73332 16.375 8.73332C17.1928 8.73332 17.9249 9.24064 18.2121 10.0064L22.6446 21.8266C22.8386 22.3438 22.5766 22.9202 22.0594 23.1141C21.5423 23.308 20.9659 23.046 20.772 22.5289L19.5196 19.1891H13.2304L11.978 22.5289C11.7841 23.046 11.2076 23.308 10.6905 23.1141C10.1734 22.9202 9.9114 22.3438 10.1053 21.8266L14.5379 10.0064ZM13.9804 17.1891H18.7696L16.375 10.8035L13.9804 17.1891Z"
|
|
86
|
+
fill="${cssVarV2('text/primary')}"
|
|
87
|
+
/>
|
|
88
88
|
</svg>`;
|
|
89
|
-
export const FigmaDuotoneIcon = html `<svg
|
|
90
|
-
width="32"
|
|
91
|
-
height="32"
|
|
92
|
-
viewBox="0 0 24 24"
|
|
93
|
-
fill="none"
|
|
94
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
95
|
-
>
|
|
96
|
-
<g id="Figma_Duotone">
|
|
97
|
-
<path
|
|
98
|
-
id="Vector"
|
|
99
|
-
d="M8.41842 22.5027C10.3047 22.5027 11.8356 20.9719 11.8356 19.0856V15.6685H8.41842C6.53216 15.6685 5.00128 17.1993 5.00128 19.0856C5.00128 20.9719 6.53216 22.5027 8.41842 22.5027Z"
|
|
100
|
-
fill="#0ACF83"
|
|
101
|
-
/>
|
|
102
|
-
<path
|
|
103
|
-
id="Vector_2"
|
|
104
|
-
d="M5.00128 12.2514C5.00128 10.3651 6.53216 8.83423 8.41842 8.83423H11.8356V15.6685H8.41842C6.53216 15.6685 5.00128 14.1376 5.00128 12.2514Z"
|
|
105
|
-
fill="#A259FF"
|
|
106
|
-
/>
|
|
107
|
-
<path
|
|
108
|
-
id="Vector_3"
|
|
109
|
-
d="M5.00146 5.41714C5.00146 3.53088 6.53234 2 8.4186 2H11.8357V8.83428H8.4186C6.53234 8.83428 5.00146 7.3034 5.00146 5.41714Z"
|
|
110
|
-
fill="#F24E1E"
|
|
111
|
-
/>
|
|
112
|
-
<path
|
|
113
|
-
id="Vector_4"
|
|
114
|
-
d="M11.8356 2H15.2527C17.139 2 18.6699 3.53088 18.6699 5.41714C18.6699 7.3034 17.139 8.83428 15.2527 8.83428H11.8356V2Z"
|
|
115
|
-
fill="#FF7262"
|
|
116
|
-
/>
|
|
117
|
-
<path
|
|
118
|
-
id="Vector_5"
|
|
119
|
-
d="M18.6699 12.2514C18.6699 14.1376 17.139 15.6685 15.2527 15.6685C13.3665 15.6685 11.8356 14.1376 11.8356 12.2514C11.8356 10.3651 13.3665 8.83423 15.2527 8.83423C17.139 8.83423 18.6699 10.3651 18.6699 12.2514Z"
|
|
120
|
-
fill="#1ABCFE"
|
|
121
|
-
/>
|
|
122
|
-
</g>
|
|
89
|
+
export const FigmaDuotoneIcon = html `<svg
|
|
90
|
+
width="32"
|
|
91
|
+
height="32"
|
|
92
|
+
viewBox="0 0 24 24"
|
|
93
|
+
fill="none"
|
|
94
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
95
|
+
>
|
|
96
|
+
<g id="Figma_Duotone">
|
|
97
|
+
<path
|
|
98
|
+
id="Vector"
|
|
99
|
+
d="M8.41842 22.5027C10.3047 22.5027 11.8356 20.9719 11.8356 19.0856V15.6685H8.41842C6.53216 15.6685 5.00128 17.1993 5.00128 19.0856C5.00128 20.9719 6.53216 22.5027 8.41842 22.5027Z"
|
|
100
|
+
fill="#0ACF83"
|
|
101
|
+
/>
|
|
102
|
+
<path
|
|
103
|
+
id="Vector_2"
|
|
104
|
+
d="M5.00128 12.2514C5.00128 10.3651 6.53216 8.83423 8.41842 8.83423H11.8356V15.6685H8.41842C6.53216 15.6685 5.00128 14.1376 5.00128 12.2514Z"
|
|
105
|
+
fill="#A259FF"
|
|
106
|
+
/>
|
|
107
|
+
<path
|
|
108
|
+
id="Vector_3"
|
|
109
|
+
d="M5.00146 5.41714C5.00146 3.53088 6.53234 2 8.4186 2H11.8357V8.83428H8.4186C6.53234 8.83428 5.00146 7.3034 5.00146 5.41714Z"
|
|
110
|
+
fill="#F24E1E"
|
|
111
|
+
/>
|
|
112
|
+
<path
|
|
113
|
+
id="Vector_4"
|
|
114
|
+
d="M11.8356 2H15.2527C17.139 2 18.6699 3.53088 18.6699 5.41714C18.6699 7.3034 17.139 8.83428 15.2527 8.83428H11.8356V2Z"
|
|
115
|
+
fill="#FF7262"
|
|
116
|
+
/>
|
|
117
|
+
<path
|
|
118
|
+
id="Vector_5"
|
|
119
|
+
d="M18.6699 12.2514C18.6699 14.1376 17.139 15.6685 15.2527 15.6685C13.3665 15.6685 11.8356 14.1376 11.8356 12.2514C11.8356 10.3651 13.3665 8.83423 15.2527 8.83423C17.139 8.83423 18.6699 10.3651 18.6699 12.2514Z"
|
|
120
|
+
fill="#1ABCFE"
|
|
121
|
+
/>
|
|
122
|
+
</g>
|
|
123
123
|
</svg> `;
|
|
@@ -2,6 +2,7 @@ import { toast } from '../affine-components/toast/index.js';
|
|
|
2
2
|
import { insertContent } from '../affine-rich-text/index.js';
|
|
3
3
|
import { ArrowDownBigIcon, ArrowUpBigIcon, CopyIcon, DeleteIcon, DualLinkIcon, NowIcon, TodayIcon, TomorrowIcon, YesterdayIcon, } from '@blocksuite/icons/lit';
|
|
4
4
|
import { Slice, Text } from '../store/index.js';
|
|
5
|
+
import { TOAST_COPIED_TO_CLIPBOARD, translateKey, } from '../affine-shared/services/index.js';
|
|
5
6
|
import { slashMenuToolTips } from './tooltips/index.js';
|
|
6
7
|
import { formatDate, formatTime } from './utils.js';
|
|
7
8
|
export const defaultSlashMenuConfig = {
|
|
@@ -101,7 +102,7 @@ export const defaultSlashMenuConfig = {
|
|
|
101
102
|
std.clipboard
|
|
102
103
|
.copy(slice)
|
|
103
104
|
.then(() => {
|
|
104
|
-
toast(std.host,
|
|
105
|
+
toast(std.host, translateKey(std, ...TOAST_COPIED_TO_CLIPBOARD));
|
|
105
106
|
})
|
|
106
107
|
.catch(e => {
|
|
107
108
|
console.error(e);
|
|
@@ -491,6 +491,9 @@ export class AffineToolbarWidget extends WidgetComponent {
|
|
|
491
491
|
}));
|
|
492
492
|
disposables.add(effect(() => {
|
|
493
493
|
const value = flags.value$.value;
|
|
494
|
+
// Subscribes to forced refreshes: `flags.refresh()` keeps `value$`
|
|
495
|
+
// untouched, the revision counter is the only thing that changes.
|
|
496
|
+
void flags.revision$.value;
|
|
494
497
|
// Hides toolbar
|
|
495
498
|
if (Flag.None === value || flags.check(Flag.Hiding, value)) {
|
|
496
499
|
this.fitter.reset();
|
|
@@ -526,6 +529,8 @@ export class AffineToolbarWidget extends WidgetComponent {
|
|
|
526
529
|
abortController.abort();
|
|
527
530
|
}
|
|
528
531
|
const value = flags.value$.value;
|
|
532
|
+
// Subscribes to forced refreshes, see above.
|
|
533
|
+
void flags.revision$.value;
|
|
529
534
|
if (!context.activated)
|
|
530
535
|
return;
|
|
531
536
|
if (Flag.None === value || flags.contains(Flag.Hiding, value))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type EditorToolbar } from '../affine-components/toolbar/index.js';
|
|
2
|
-
import { type ToolbarActions, type ToolbarContext, type ToolbarLayoutStep, type ToolbarPlacement } from '../affine-shared/services/index.js';
|
|
2
|
+
import { ActionPlacement, type ToolbarActions, type ToolbarContext, type ToolbarLayoutStep, type ToolbarPlacement } from '../affine-shared/services/index.js';
|
|
3
3
|
import type { AutoUpdateOptions, ReferenceElement, SideObject } from '@floating-ui/dom';
|
|
4
4
|
export declare const sideMap: Map<string, {
|
|
5
5
|
top: number;
|
|
@@ -15,7 +15,24 @@ export declare function autoUpdatePosition(signal: AbortSignal, toolbar: EditorT
|
|
|
15
15
|
* scroll, resize and flip.
|
|
16
16
|
*/
|
|
17
17
|
onAvailableWidth?: () => void): () => void;
|
|
18
|
-
export declare function combine(actions: ToolbarActions, context: ToolbarContext):
|
|
18
|
+
export declare function combine(actions: ToolbarActions, context: ToolbarContext): {
|
|
19
|
+
placement: ActionPlacement;
|
|
20
|
+
id: string;
|
|
21
|
+
score?: number;
|
|
22
|
+
when?: ((cx: ToolbarContext) => boolean) | boolean;
|
|
23
|
+
active?: ((cx: ToolbarContext) => boolean) | boolean;
|
|
24
|
+
priority?: number;
|
|
25
|
+
label?: string;
|
|
26
|
+
labelWording?: import("../affine-shared/services/index.js").ChromeWording;
|
|
27
|
+
showLabel?: boolean;
|
|
28
|
+
icon?: import("lit-html").TemplateResult;
|
|
29
|
+
tooltip?: string | import("lit-html").TemplateResult;
|
|
30
|
+
tooltipWording?: import("../affine-shared/services/index.js").ChromeWording;
|
|
31
|
+
variant?: "destructive";
|
|
32
|
+
disabled?: ((cx: ToolbarContext) => boolean) | boolean;
|
|
33
|
+
content?: ((cx: ToolbarContext) => import("lit-html").TemplateResult | null) | (import("lit-html").TemplateResult | null);
|
|
34
|
+
run?: (cx: ToolbarContext) => void;
|
|
35
|
+
}[];
|
|
19
36
|
/**
|
|
20
37
|
* How much of the row an entry has given up, decided by {@link ToolbarFitter}
|
|
21
38
|
* and re-applied by every render until the room changes again.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { renderToolbarSeparator, } from '../affine-components/toolbar/index.js';
|
|
2
|
-
import { ActionPlacement, planToolbarLayout, TOOLBAR_SETTLE_DELAY, toolbarDegradationSteps, toolbarRoomChanged, } from '../affine-shared/services/index.js';
|
|
2
|
+
import { ActionPlacement, planToolbarLayout, TOOLBAR_MORE, TOOLBAR_SETTLE_DELAY, toolbarDegradationSteps, toolbarRoomChanged, translateKey, } from '../affine-shared/services/index.js';
|
|
3
3
|
import { nextTick } from '../global/utils/index.js';
|
|
4
4
|
import { GfxControllerIdentifier } from '../std/gfx/index.js';
|
|
5
5
|
import { MoreVerticalIcon } from '@blocksuite/icons/lit';
|
|
@@ -144,10 +144,22 @@ export function combine(actions, context) {
|
|
|
144
144
|
};
|
|
145
145
|
if ('generate' in action && typeof action.generate === 'function') {
|
|
146
146
|
// TODO(@fundon): should delete `generate` fn
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
Object.assign(newAction, action.generate(context));
|
|
148
|
+
}
|
|
149
|
+
// The i18n seam, applied HERE and only here: every path that draws an
|
|
150
|
+
// entry — the row, a group's children, the "⋮" — goes through `combine`
|
|
151
|
+
// first, and the row's own signature (`renderToolbar`) reads the resolved
|
|
152
|
+
// `label` a few lines later, so an entry that changes language is a row
|
|
153
|
+
// that is re-planned rather than one drawn at the wrong width.
|
|
154
|
+
//
|
|
155
|
+
// A declared wording WINS over a static `label` / `tooltip` left beside it:
|
|
156
|
+
// the static one is the English default and is already the wording's own
|
|
157
|
+
// fallback, so the two can never disagree.
|
|
158
|
+
if (newAction.labelWording) {
|
|
159
|
+
newAction.label = translateKey(context.std, ...newAction.labelWording);
|
|
160
|
+
}
|
|
161
|
+
if (newAction.tooltipWording) {
|
|
162
|
+
newAction.tooltip = translateKey(context.std, ...newAction.tooltipWording);
|
|
151
163
|
}
|
|
152
164
|
return newAction;
|
|
153
165
|
});
|
|
@@ -434,6 +446,9 @@ export function renderToolbar(toolbar, context, flavour, source = () => emptyToo
|
|
|
434
446
|
if (moreMenuItems.length) {
|
|
435
447
|
const key = `${context.getCurrentModel()?.id}`;
|
|
436
448
|
hasMenu = true;
|
|
449
|
+
// The one word the WIDGET says on its own account, so it is the one
|
|
450
|
+
// wording no entry can declare for it (#183).
|
|
451
|
+
const moreLabel = translateKey(context.std, ...TOOLBAR_MORE);
|
|
437
452
|
primary.push({
|
|
438
453
|
kind: 'template',
|
|
439
454
|
// Not an entry of the row's signature: the "⋮" is DERIVED from the
|
|
@@ -445,8 +460,8 @@ export function renderToolbar(toolbar, context, flavour, source = () => emptyToo
|
|
|
445
460
|
.contentPadding="${'8px'}"
|
|
446
461
|
.button=${html `
|
|
447
462
|
<editor-icon-button
|
|
448
|
-
aria-label
|
|
449
|
-
.tooltip="${
|
|
463
|
+
aria-label=${moreLabel}
|
|
464
|
+
.tooltip="${moreLabel}"
|
|
450
465
|
.iconContainerPadding=${innerToolbar ? 4 : 2}
|
|
451
466
|
.iconSize=${innerToolbar ? '16px' : undefined}
|
|
452
467
|
>
|