@formicoidea/labre-framework-uml 3.4.0 → 3.5.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.
- package/LICENSE +384 -384
- package/dist/toolbar/config.js +143 -143
- package/dist/toolbar/icons.js +252 -252
- package/dist/toolbar/senior-tool.js +2 -2
- package/package.json +3 -3
package/dist/toolbar/config.js
CHANGED
|
@@ -5,18 +5,18 @@ import { BlockFlavourIdentifier } from '@formicoidea/labre-core/std';
|
|
|
5
5
|
import { html, nothing } from 'lit';
|
|
6
6
|
import { UML_DIAGRAM_KIND_MENU, UML_FRAGMENT_OPERATOR_MENU, } from '../kinds.js';
|
|
7
7
|
import { umlExportPlantumlIcon, umlExportXmiIcon } from './icons.js';
|
|
8
|
-
const ResizeIcon = html `<svg
|
|
9
|
-
width="24"
|
|
10
|
-
height="24"
|
|
11
|
-
viewBox="0 0 24 24"
|
|
12
|
-
fill="none"
|
|
13
|
-
stroke="currentColor"
|
|
14
|
-
stroke-width="1.6"
|
|
15
|
-
stroke-linecap="round"
|
|
16
|
-
stroke-linejoin="round"
|
|
17
|
-
>
|
|
18
|
-
<path d="M9 5H5v4M15 19h4v-4" />
|
|
19
|
-
<path d="M5 5l6 6M19 19l-6-6" />
|
|
8
|
+
const ResizeIcon = html `<svg
|
|
9
|
+
width="24"
|
|
10
|
+
height="24"
|
|
11
|
+
viewBox="0 0 24 24"
|
|
12
|
+
fill="none"
|
|
13
|
+
stroke="currentColor"
|
|
14
|
+
stroke-width="1.6"
|
|
15
|
+
stroke-linecap="round"
|
|
16
|
+
stroke-linejoin="round"
|
|
17
|
+
>
|
|
18
|
+
<path d="M9 5H5v4M15 19h4v-4" />
|
|
19
|
+
<path d="M5 5l6 6M19 19l-6-6" />
|
|
20
20
|
</svg>`;
|
|
21
21
|
/**
|
|
22
22
|
* The two glyphs the kind picker needs, drawn inline rather than pulled from
|
|
@@ -24,30 +24,30 @@ const ResizeIcon = html `<svg
|
|
|
24
24
|
* is not worth adding for two paths. The same call the C4 board's row makes for
|
|
25
25
|
* its own, and the same call {@link ResizeIcon} above already makes.
|
|
26
26
|
*/
|
|
27
|
-
const ChevronDownIcon = html `<svg
|
|
28
|
-
width="16"
|
|
29
|
-
height="16"
|
|
30
|
-
viewBox="0 0 24 24"
|
|
31
|
-
fill="none"
|
|
32
|
-
stroke="currentColor"
|
|
33
|
-
stroke-width="2"
|
|
34
|
-
stroke-linecap="round"
|
|
35
|
-
stroke-linejoin="round"
|
|
36
|
-
>
|
|
37
|
-
<path d="M6 9l6 6 6-6" />
|
|
27
|
+
const ChevronDownIcon = html `<svg
|
|
28
|
+
width="16"
|
|
29
|
+
height="16"
|
|
30
|
+
viewBox="0 0 24 24"
|
|
31
|
+
fill="none"
|
|
32
|
+
stroke="currentColor"
|
|
33
|
+
stroke-width="2"
|
|
34
|
+
stroke-linecap="round"
|
|
35
|
+
stroke-linejoin="round"
|
|
36
|
+
>
|
|
37
|
+
<path d="M6 9l6 6 6-6" />
|
|
38
38
|
</svg>`;
|
|
39
39
|
/** The tick on the kind in force — rendered at the END of the row. */
|
|
40
|
-
const CheckIcon = html `<svg
|
|
41
|
-
width="20"
|
|
42
|
-
height="20"
|
|
43
|
-
viewBox="0 0 24 24"
|
|
44
|
-
fill="none"
|
|
45
|
-
stroke="currentColor"
|
|
46
|
-
stroke-width="2"
|
|
47
|
-
stroke-linecap="round"
|
|
48
|
-
stroke-linejoin="round"
|
|
49
|
-
>
|
|
50
|
-
<path d="M5 12.5l4.5 4.5L19 7.5" />
|
|
40
|
+
const CheckIcon = html `<svg
|
|
41
|
+
width="20"
|
|
42
|
+
height="20"
|
|
43
|
+
viewBox="0 0 24 24"
|
|
44
|
+
fill="none"
|
|
45
|
+
stroke="currentColor"
|
|
46
|
+
stroke-width="2"
|
|
47
|
+
stroke-linecap="round"
|
|
48
|
+
stroke-linejoin="round"
|
|
49
|
+
>
|
|
50
|
+
<path d="M5 12.5l4.5 4.5L19 7.5" />
|
|
51
51
|
</svg>`;
|
|
52
52
|
/**
|
|
53
53
|
* The selected UML diagram frame's contextual toolbar: the resize toggle, and
|
|
@@ -217,50 +217,50 @@ const kindPickerAction = {
|
|
|
217
217
|
const current = UML_DIAGRAM_KIND_MENU.options.find(option => option.kind === diagram.kind);
|
|
218
218
|
const options = UML_DIAGRAM_KIND_MENU.options.map(option => {
|
|
219
219
|
const selected = option.kind === diagram.kind;
|
|
220
|
-
return html `<editor-menu-action
|
|
221
|
-
data-option
|
|
222
|
-
data-testid="uml-kind-option"
|
|
223
|
-
data-kind=${option.kind}
|
|
224
|
-
data-selected=${selected ? 'true' : nothing}
|
|
225
|
-
aria-label=${wordsFor(option)}
|
|
226
|
-
aria-pressed=${selected}
|
|
227
|
-
@click=${() => pickKind(ctx, option)}
|
|
228
|
-
>
|
|
229
|
-
<span class="label">${wordsFor(option)}</span>
|
|
230
|
-
${selected ? CheckIcon : nothing}
|
|
220
|
+
return html `<editor-menu-action
|
|
221
|
+
data-option
|
|
222
|
+
data-testid="uml-kind-option"
|
|
223
|
+
data-kind=${option.kind}
|
|
224
|
+
data-selected=${selected ? 'true' : nothing}
|
|
225
|
+
aria-label=${wordsFor(option)}
|
|
226
|
+
aria-pressed=${selected}
|
|
227
|
+
@click=${() => pickKind(ctx, option)}
|
|
228
|
+
>
|
|
229
|
+
<span class="label">${wordsFor(option)}</span>
|
|
230
|
+
${selected ? CheckIcon : nothing}
|
|
231
231
|
</editor-menu-action>`;
|
|
232
232
|
});
|
|
233
|
-
return html `<editor-menu-button
|
|
234
|
-
data-testid="uml-kind-entry"
|
|
235
|
-
.contentPadding=${'8px'}
|
|
236
|
-
.button=${html `
|
|
237
|
-
<editor-icon-button
|
|
238
|
-
data-testid="uml-kind-button"
|
|
239
|
-
aria-label=${menuLabel}
|
|
240
|
-
.tooltip=${menuLabel}
|
|
241
|
-
.justify=${'space-between'}
|
|
242
|
-
.labelHeight=${'20px'}
|
|
243
|
-
>
|
|
244
|
-
<span class="label"
|
|
245
|
-
>${current === undefined ? menuLabel : wordsFor(current)}</span
|
|
246
|
-
>
|
|
247
|
-
${ChevronDownIcon}
|
|
248
|
-
</editor-icon-button>
|
|
249
|
-
`}
|
|
250
|
-
>
|
|
251
|
-
<div
|
|
252
|
-
data-testid="uml-kind-menu"
|
|
253
|
-
data-orientation="vertical"
|
|
254
|
-
data-size="large"
|
|
255
|
-
>
|
|
256
|
-
<div
|
|
257
|
-
role="group"
|
|
258
|
-
aria-label=${menuLabel}
|
|
259
|
-
style="display: flex; flex-direction: column;"
|
|
260
|
-
>
|
|
261
|
-
${options}
|
|
262
|
-
</div>
|
|
263
|
-
</div>
|
|
233
|
+
return html `<editor-menu-button
|
|
234
|
+
data-testid="uml-kind-entry"
|
|
235
|
+
.contentPadding=${'8px'}
|
|
236
|
+
.button=${html `
|
|
237
|
+
<editor-icon-button
|
|
238
|
+
data-testid="uml-kind-button"
|
|
239
|
+
aria-label=${menuLabel}
|
|
240
|
+
.tooltip=${menuLabel}
|
|
241
|
+
.justify=${'space-between'}
|
|
242
|
+
.labelHeight=${'20px'}
|
|
243
|
+
>
|
|
244
|
+
<span class="label"
|
|
245
|
+
>${current === undefined ? menuLabel : wordsFor(current)}</span
|
|
246
|
+
>
|
|
247
|
+
${ChevronDownIcon}
|
|
248
|
+
</editor-icon-button>
|
|
249
|
+
`}
|
|
250
|
+
>
|
|
251
|
+
<div
|
|
252
|
+
data-testid="uml-kind-menu"
|
|
253
|
+
data-orientation="vertical"
|
|
254
|
+
data-size="large"
|
|
255
|
+
>
|
|
256
|
+
<div
|
|
257
|
+
role="group"
|
|
258
|
+
aria-label=${menuLabel}
|
|
259
|
+
style="display: flex; flex-direction: column;"
|
|
260
|
+
>
|
|
261
|
+
${options}
|
|
262
|
+
</div>
|
|
263
|
+
</div>
|
|
264
264
|
</editor-menu-button>`;
|
|
265
265
|
},
|
|
266
266
|
};
|
|
@@ -368,18 +368,18 @@ export const umlDiagramToolingToolbarExtension = ToolbarModuleExtension({
|
|
|
368
368
|
* `@labre/affine-components` is not a dependency of this package and two paths
|
|
369
369
|
* are not worth making it one.
|
|
370
370
|
*/
|
|
371
|
-
const OrientationIcon = html `<svg
|
|
372
|
-
width="24"
|
|
373
|
-
height="24"
|
|
374
|
-
viewBox="0 0 24 24"
|
|
375
|
-
fill="none"
|
|
376
|
-
stroke="currentColor"
|
|
377
|
-
stroke-width="1.6"
|
|
378
|
-
stroke-linecap="round"
|
|
379
|
-
stroke-linejoin="round"
|
|
380
|
-
>
|
|
381
|
-
<path d="M4 4h5v16H4zM15 4h5v16h-5z" />
|
|
382
|
-
<path d="M11.5 9.5l1 1 1-1M12.5 10.5v3" />
|
|
371
|
+
const OrientationIcon = html `<svg
|
|
372
|
+
width="24"
|
|
373
|
+
height="24"
|
|
374
|
+
viewBox="0 0 24 24"
|
|
375
|
+
fill="none"
|
|
376
|
+
stroke="currentColor"
|
|
377
|
+
stroke-width="1.6"
|
|
378
|
+
stroke-linecap="round"
|
|
379
|
+
stroke-linejoin="round"
|
|
380
|
+
>
|
|
381
|
+
<path d="M4 4h5v16H4zM15 4h5v16h-5z" />
|
|
382
|
+
<path d="M11.5 9.5l1 1 1-1M12.5 10.5v3" />
|
|
383
383
|
</svg>`;
|
|
384
384
|
/**
|
|
385
385
|
* The resize toggle, for a frame that is neither the diagram nor the subject.
|
|
@@ -627,19 +627,19 @@ function addUmlOperand(ctx) {
|
|
|
627
627
|
* {@link ResizeIcon} and {@link OrientationIcon} give — this package does not
|
|
628
628
|
* depend on `@labre/affine-components`, and one path is not worth making it.
|
|
629
629
|
*/
|
|
630
|
-
const AddOperandIcon = html `<svg
|
|
631
|
-
width="24"
|
|
632
|
-
height="24"
|
|
633
|
-
viewBox="0 0 24 24"
|
|
634
|
-
fill="none"
|
|
635
|
-
stroke="currentColor"
|
|
636
|
-
stroke-width="1.6"
|
|
637
|
-
stroke-linecap="round"
|
|
638
|
-
stroke-linejoin="round"
|
|
639
|
-
>
|
|
640
|
-
<path d="M4 4h16v16H4z" />
|
|
641
|
-
<path d="M4 12h16" stroke-dasharray="2.5 2.5" />
|
|
642
|
-
<path d="M12 14.5v4M10 16.5h4" />
|
|
630
|
+
const AddOperandIcon = html `<svg
|
|
631
|
+
width="24"
|
|
632
|
+
height="24"
|
|
633
|
+
viewBox="0 0 24 24"
|
|
634
|
+
fill="none"
|
|
635
|
+
stroke="currentColor"
|
|
636
|
+
stroke-width="1.6"
|
|
637
|
+
stroke-linecap="round"
|
|
638
|
+
stroke-linejoin="round"
|
|
639
|
+
>
|
|
640
|
+
<path d="M4 4h16v16H4z" />
|
|
641
|
+
<path d="M4 12h16" stroke-dasharray="2.5 2.5" />
|
|
642
|
+
<path d="M12 14.5v4M10 16.5h4" />
|
|
643
643
|
</svg>`;
|
|
644
644
|
/**
|
|
645
645
|
* Which kind of combined fragment this is — the operator picker (§17.6.4).
|
|
@@ -685,50 +685,50 @@ const operatorPickerAction = {
|
|
|
685
685
|
const current = UML_FRAGMENT_OPERATOR_MENU.options.find(option => option.operator === fragment.operator);
|
|
686
686
|
const options = UML_FRAGMENT_OPERATOR_MENU.options.map(option => {
|
|
687
687
|
const selected = option.operator === fragment.operator;
|
|
688
|
-
return html `<editor-menu-action
|
|
689
|
-
data-option
|
|
690
|
-
data-testid="uml-operator-option"
|
|
691
|
-
data-operator=${option.operator}
|
|
692
|
-
data-selected=${selected ? 'true' : nothing}
|
|
693
|
-
aria-label=${wordsFor(option)}
|
|
694
|
-
aria-pressed=${selected}
|
|
695
|
-
@click=${() => pickOperator(ctx, option)}
|
|
696
|
-
>
|
|
697
|
-
<span class="label">${wordsFor(option)}</span>
|
|
698
|
-
${selected ? CheckIcon : nothing}
|
|
688
|
+
return html `<editor-menu-action
|
|
689
|
+
data-option
|
|
690
|
+
data-testid="uml-operator-option"
|
|
691
|
+
data-operator=${option.operator}
|
|
692
|
+
data-selected=${selected ? 'true' : nothing}
|
|
693
|
+
aria-label=${wordsFor(option)}
|
|
694
|
+
aria-pressed=${selected}
|
|
695
|
+
@click=${() => pickOperator(ctx, option)}
|
|
696
|
+
>
|
|
697
|
+
<span class="label">${wordsFor(option)}</span>
|
|
698
|
+
${selected ? CheckIcon : nothing}
|
|
699
699
|
</editor-menu-action>`;
|
|
700
700
|
});
|
|
701
|
-
return html `<editor-menu-button
|
|
702
|
-
data-testid="uml-operator-entry"
|
|
703
|
-
.contentPadding=${'8px'}
|
|
704
|
-
.button=${html `
|
|
705
|
-
<editor-icon-button
|
|
706
|
-
data-testid="uml-operator-button"
|
|
707
|
-
aria-label=${menuLabel}
|
|
708
|
-
.tooltip=${menuLabel}
|
|
709
|
-
.justify=${'space-between'}
|
|
710
|
-
.labelHeight=${'20px'}
|
|
711
|
-
>
|
|
712
|
-
<span class="label"
|
|
713
|
-
>${current === undefined ? menuLabel : wordsFor(current)}</span
|
|
714
|
-
>
|
|
715
|
-
${ChevronDownIcon}
|
|
716
|
-
</editor-icon-button>
|
|
717
|
-
`}
|
|
718
|
-
>
|
|
719
|
-
<div
|
|
720
|
-
data-testid="uml-operator-menu"
|
|
721
|
-
data-orientation="vertical"
|
|
722
|
-
data-size="large"
|
|
723
|
-
>
|
|
724
|
-
<div
|
|
725
|
-
role="group"
|
|
726
|
-
aria-label=${menuLabel}
|
|
727
|
-
style="display: flex; flex-direction: column;"
|
|
728
|
-
>
|
|
729
|
-
${options}
|
|
730
|
-
</div>
|
|
731
|
-
</div>
|
|
701
|
+
return html `<editor-menu-button
|
|
702
|
+
data-testid="uml-operator-entry"
|
|
703
|
+
.contentPadding=${'8px'}
|
|
704
|
+
.button=${html `
|
|
705
|
+
<editor-icon-button
|
|
706
|
+
data-testid="uml-operator-button"
|
|
707
|
+
aria-label=${menuLabel}
|
|
708
|
+
.tooltip=${menuLabel}
|
|
709
|
+
.justify=${'space-between'}
|
|
710
|
+
.labelHeight=${'20px'}
|
|
711
|
+
>
|
|
712
|
+
<span class="label"
|
|
713
|
+
>${current === undefined ? menuLabel : wordsFor(current)}</span
|
|
714
|
+
>
|
|
715
|
+
${ChevronDownIcon}
|
|
716
|
+
</editor-icon-button>
|
|
717
|
+
`}
|
|
718
|
+
>
|
|
719
|
+
<div
|
|
720
|
+
data-testid="uml-operator-menu"
|
|
721
|
+
data-orientation="vertical"
|
|
722
|
+
data-size="large"
|
|
723
|
+
>
|
|
724
|
+
<div
|
|
725
|
+
role="group"
|
|
726
|
+
aria-label=${menuLabel}
|
|
727
|
+
style="display: flex; flex-direction: column;"
|
|
728
|
+
>
|
|
729
|
+
${options}
|
|
730
|
+
</div>
|
|
731
|
+
</div>
|
|
732
732
|
</editor-menu-button>`;
|
|
733
733
|
},
|
|
734
734
|
};
|