@formicoidea/labre-framework-cynefin 0.23.0 → 0.23.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/cynefin/consts.d.ts +80 -0
- package/dist/cynefin/consts.js +142 -0
- package/dist/cynefin/element-renderer.d.ts +15 -0
- package/dist/cynefin/element-renderer.js +115 -0
- package/dist/cynefin/element-view.d.ts +15 -0
- package/dist/cynefin/element-view.js +24 -0
- package/dist/cynefin/toolbar/config.d.ts +32 -0
- package/dist/cynefin/toolbar/config.js +44 -0
- package/dist/descriptor.d.ts +7 -0
- package/{src/descriptor.ts → dist/descriptor.js} +1 -1
- package/dist/effects.d.ts +10 -0
- package/dist/effects.js +7 -0
- package/dist/estuarine/consts.d.ts +85 -0
- package/dist/estuarine/consts.js +55 -0
- package/dist/estuarine/element-renderer.d.ts +14 -0
- package/dist/estuarine/element-renderer.js +84 -0
- package/dist/estuarine/element-view.d.ts +15 -0
- package/dist/estuarine/element-view.js +24 -0
- package/dist/estuarine/toolbar/config.d.ts +38 -0
- package/dist/estuarine/toolbar/config.js +48 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/templates/index.d.ts +4 -0
- package/dist/templates/index.js +95 -0
- package/dist/toolbar/cynefin-menu.d.ts +12 -0
- package/dist/toolbar/cynefin-menu.js +66 -0
- package/dist/toolbar/cynefin-senior-button.d.ts +13 -0
- package/dist/toolbar/cynefin-senior-button.js +90 -0
- package/dist/toolbar/estuarine-menu.d.ts +14 -0
- package/dist/toolbar/estuarine-menu.js +113 -0
- package/dist/toolbar/estuarine-senior-button.d.ts +13 -0
- package/dist/toolbar/estuarine-senior-button.js +90 -0
- package/dist/toolbar/icons.d.ts +9 -0
- package/{src/toolbar/icons.ts → dist/toolbar/icons.js} +14 -17
- package/dist/toolbar/menu.d.ts +18 -0
- package/{src/toolbar/menu.ts → dist/toolbar/menu.js} +68 -91
- package/dist/toolbar/senior-button.d.ts +13 -0
- package/{src/toolbar/senior-button.ts → dist/toolbar/senior-button.js} +33 -38
- package/dist/toolbar/senior-tool.d.ts +3 -0
- package/{src/toolbar/senior-tool.ts → dist/toolbar/senior-tool.js} +5 -8
- package/dist/utils.d.ts +12 -0
- package/{src/utils.ts → dist/utils.js} +11 -11
- package/dist/view.d.ts +7 -0
- package/dist/view.js +38 -0
- package/package.json +15 -6
- package/src/cynefin/consts.ts +0 -188
- package/src/cynefin/element-renderer.ts +0 -156
- package/src/cynefin/element-view.ts +0 -32
- package/src/cynefin/toolbar/config.ts +0 -60
- package/src/effects.ts +0 -20
- package/src/estuarine/consts.ts +0 -69
- package/src/estuarine/element-renderer.ts +0 -122
- package/src/estuarine/element-view.ts +0 -32
- package/src/estuarine/toolbar/config.ts +0 -65
- package/src/index.ts +0 -1
- package/src/templates/index.ts +0 -130
- package/src/view.ts +0 -44
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { DefaultTool } from '@blocksuite/affine-block-surface';
|
|
2
|
+
import { EmptyTool } from '@blocksuite/affine-gfx-pointer';
|
|
3
|
+
import { EdgelessToolbarToolMixin } from '@blocksuite/affine-widget-edgeless-toolbar';
|
|
4
|
+
import { SignalWatcher } from '@blocksuite/global/lit';
|
|
5
|
+
import { css, html, LitElement } from 'lit';
|
|
6
|
+
import { estuarineToolbarIcon } from './icons';
|
|
7
|
+
/** Main toolbar button that opens the Estuarine toolbox sub-menu. */
|
|
8
|
+
export class EdgelessEstuarineSeniorButton extends EdgelessToolbarToolMixin(SignalWatcher(LitElement)) {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.enableActiveBackground = true;
|
|
12
|
+
this.type = EmptyTool;
|
|
13
|
+
}
|
|
14
|
+
static { this.styles = css `
|
|
15
|
+
:host,
|
|
16
|
+
.estuarine-button {
|
|
17
|
+
display: block;
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
}
|
|
21
|
+
:host {
|
|
22
|
+
position: relative;
|
|
23
|
+
}
|
|
24
|
+
.estuarine-root {
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 64px;
|
|
27
|
+
position: relative;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: flex-end;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
}
|
|
34
|
+
.estuarine-card {
|
|
35
|
+
--y: 6px;
|
|
36
|
+
--s: 1;
|
|
37
|
+
position: absolute;
|
|
38
|
+
bottom: 0;
|
|
39
|
+
width: 54px;
|
|
40
|
+
height: 54px;
|
|
41
|
+
transform: translateY(var(--y)) scale(var(--s));
|
|
42
|
+
transition: transform 0.3s ease;
|
|
43
|
+
}
|
|
44
|
+
.estuarine-card svg {
|
|
45
|
+
display: block;
|
|
46
|
+
width: 100%;
|
|
47
|
+
height: 100%;
|
|
48
|
+
}
|
|
49
|
+
.estuarine-root:hover .estuarine-card {
|
|
50
|
+
--y: -2px;
|
|
51
|
+
--s: 1.07;
|
|
52
|
+
}
|
|
53
|
+
`; }
|
|
54
|
+
_toggleMenu() {
|
|
55
|
+
if (this.popper) {
|
|
56
|
+
this.popper.dispose();
|
|
57
|
+
this.popper = null;
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
this.setEdgelessTool(DefaultTool);
|
|
61
|
+
const menu = this.createPopper('edgeless-estuarine-menu', this);
|
|
62
|
+
menu.element.edgeless = this.edgeless;
|
|
63
|
+
const el = menu.element;
|
|
64
|
+
const wrap = el.parentElement;
|
|
65
|
+
if (wrap) {
|
|
66
|
+
wrap.style.overflow = 'visible';
|
|
67
|
+
wrap.style.justifyContent = 'flex-end';
|
|
68
|
+
}
|
|
69
|
+
Object.assign(el.style, {
|
|
70
|
+
position: 'static',
|
|
71
|
+
width: 'max-content',
|
|
72
|
+
maxWidth: 'calc(100vw - 16px)',
|
|
73
|
+
marginLeft: '0',
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
render() {
|
|
77
|
+
return html `<edgeless-toolbar-button
|
|
78
|
+
class="estuarine-button"
|
|
79
|
+
.tooltip=${this.popper ? '' : 'Estuarine'}
|
|
80
|
+
.tooltipOffset=${4}
|
|
81
|
+
.active=${!!this.popper}
|
|
82
|
+
@click=${this._toggleMenu}
|
|
83
|
+
>
|
|
84
|
+
<div class="estuarine-root">
|
|
85
|
+
<div class="estuarine-card">${estuarineToolbarIcon}</div>
|
|
86
|
+
</div>
|
|
87
|
+
</edgeless-toolbar-button>`;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=estuarine-senior-button.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Colored Cynefin glyph for the main toolbar button. */
|
|
2
|
+
export declare const cynefinToolbarIcon: import("lit-html").TemplateResult<2>;
|
|
3
|
+
/** Menu icon — create the Cynefin diagram. */
|
|
4
|
+
export declare const cynefinMenuIcon: import("lit-html").TemplateResult<2>;
|
|
5
|
+
/** Menu icon — create the Estuarine map. */
|
|
6
|
+
export declare const estuarineMenuIcon: import("lit-html").TemplateResult<2>;
|
|
7
|
+
/** Menu icon — hexagon constraint node. */
|
|
8
|
+
export declare const hexagonMenuIcon: import("lit-html").TemplateResult<2>;
|
|
9
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -1,30 +1,27 @@
|
|
|
1
|
-
import { svg } from 'lit';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export const cynefinToolbarIcon = svg`<svg width="100%" height="100%" viewBox="0 0 56 56" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1
|
+
import { svg } from 'lit';
|
|
2
|
+
/** Colored Cynefin glyph for the main toolbar button. */
|
|
3
|
+
export const cynefinToolbarIcon = svg `<svg width="100%" height="100%" viewBox="0 0 56 56" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
5
4
|
<g stroke="#3f444a" stroke-width="3" stroke-linecap="round">
|
|
6
5
|
<path d="M30 8 C28 18 33 24 26 30 C20 35 14 33 9 33"/>
|
|
7
6
|
<path d="M26 30 C28 40 28 46 28 50"/>
|
|
8
7
|
<path d="M34 22 C40 23 46 24 50 25" stroke-dasharray="3 3"/>
|
|
9
8
|
</g>
|
|
10
9
|
<g stroke="#3f444a" stroke-width="1.4"><path d="M22 33 l-2 4M24 38 l-2 5M26 43 l-2 5"/></g>
|
|
11
|
-
</svg>`;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export const cynefinMenuIcon = svg`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
10
|
+
</svg>`;
|
|
11
|
+
/** Menu icon — create the Cynefin diagram. */
|
|
12
|
+
export const cynefinMenuIcon = svg `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
15
13
|
<path d="M13 3 C12 8 14 11 11 13 C8 15 5 14 3 14" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>
|
|
16
14
|
<path d="M11 13 C12 18 12 20 12 22" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>
|
|
17
15
|
<path d="M15 10 C18 10.5 20 11 22 11.5" stroke="currentColor" stroke-width="1.6" stroke-dasharray="2.5 2.5" stroke-linecap="round"/>
|
|
18
|
-
</svg>`;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export const estuarineMenuIcon = svg`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
16
|
+
</svg>`;
|
|
17
|
+
/** Menu icon — create the Estuarine map. */
|
|
18
|
+
export const estuarineMenuIcon = svg `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
22
19
|
<path d="M5 3 V20 M5 17 H21" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>
|
|
23
20
|
<path d="M3 6 l2-2 2 2 M3 17 l2 2 2 -2 M18 15 l3 2 -3 2" stroke="currentColor" stroke-width="1.4" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
|
|
24
21
|
<path d="M6 10 C11 6 14 13 21 9" stroke="currentColor" stroke-width="1.4" fill="none" stroke-linecap="round"/>
|
|
25
|
-
</svg>`;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export const hexagonMenuIcon = svg`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
22
|
+
</svg>`;
|
|
23
|
+
/** Menu icon — hexagon constraint node. */
|
|
24
|
+
export const hexagonMenuIcon = svg `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
29
25
|
<polygon points="21,12 16.5,19.8 7.5,19.8 3,12 7.5,4.2 16.5,4.2" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/>
|
|
30
|
-
</svg>`;
|
|
26
|
+
</svg>`;
|
|
27
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EmptyTool } from '@formicoidea/labre-core/gfx/pointer';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
declare const EdgelessCynefinEstuarineMenu_base: typeof LitElement & import("@formicoidea/labre-core/global/utils").Constructor<import("@formicoidea/labre-core/widgets/edgeless-toolbar").EdgelessToolbarToolClass>;
|
|
4
|
+
/**
|
|
5
|
+
* The popover above the toolbar hosting both frameworks: create the Cynefin
|
|
6
|
+
* diagram, the Estuarine map, or a hexagon constraint node.
|
|
7
|
+
*/
|
|
8
|
+
export declare class EdgelessCynefinEstuarineMenu extends EdgelessCynefinEstuarineMenu_base {
|
|
9
|
+
static styles: import("lit").CSSResult;
|
|
10
|
+
type: typeof EmptyTool;
|
|
11
|
+
private _finish;
|
|
12
|
+
private _createCynefin;
|
|
13
|
+
private _createMap;
|
|
14
|
+
private _createHexagon;
|
|
15
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=menu.d.ts.map
|
|
@@ -4,38 +4,33 @@ import { ShapeStyle } from '@formicoidea/labre-core/model';
|
|
|
4
4
|
import { EdgelessToolbarToolMixin } from '@formicoidea/labre-core/widgets/edgeless-toolbar';
|
|
5
5
|
import { Bound } from '@formicoidea/labre-core/global/gfx';
|
|
6
6
|
import { css, html, LitElement } from 'lit';
|
|
7
|
-
|
|
8
7
|
import { REF_H as CYN_H, REF_W as CYN_W } from '../cynefin/consts';
|
|
9
8
|
import { REF_H as EST_H, REF_W as EST_W } from '../estuarine/consts';
|
|
10
|
-
import {
|
|
11
|
-
cynefinMenuIcon,
|
|
12
|
-
estuarineMenuIcon,
|
|
13
|
-
hexagonMenuIcon,
|
|
14
|
-
} from './icons';
|
|
15
|
-
|
|
9
|
+
import { cynefinMenuIcon, estuarineMenuIcon, hexagonMenuIcon, } from './icons';
|
|
16
10
|
/** Estuarine map default size (REF aspect, scaled up so it reads on canvas). */
|
|
17
11
|
const MAP_SCALE = 1.2;
|
|
18
12
|
const HEX_SIZE = 60;
|
|
19
13
|
const HEX_FILL = '#34c724';
|
|
20
14
|
const HEX_STROKE = '#1f1f1f';
|
|
21
15
|
/** Flat-top regular hexagon, normalized vertices. */
|
|
22
|
-
const HEX_VERTICES
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
const HEX_VERTICES = [
|
|
17
|
+
[1, 0.5],
|
|
18
|
+
[0.75, 0.933],
|
|
19
|
+
[0.25, 0.933],
|
|
20
|
+
[0, 0.5],
|
|
21
|
+
[0.25, 0.067],
|
|
22
|
+
[0.75, 0.067],
|
|
29
23
|
];
|
|
30
|
-
|
|
31
24
|
/**
|
|
32
25
|
* The popover above the toolbar hosting both frameworks: create the Cynefin
|
|
33
26
|
* diagram, the Estuarine map, or a hexagon constraint node.
|
|
34
27
|
*/
|
|
35
|
-
export class EdgelessCynefinEstuarineMenu extends EdgelessToolbarToolMixin(
|
|
36
|
-
|
|
37
|
-
)
|
|
38
|
-
|
|
28
|
+
export class EdgelessCynefinEstuarineMenu extends EdgelessToolbarToolMixin(LitElement) {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
this.type = EmptyTool;
|
|
32
|
+
}
|
|
33
|
+
static { this.styles = css `
|
|
39
34
|
:host {
|
|
40
35
|
position: absolute;
|
|
41
36
|
display: flex;
|
|
@@ -56,77 +51,58 @@ export class EdgelessCynefinEstuarineMenu extends EdgelessToolbarToolMixin(
|
|
|
56
51
|
width: 24px;
|
|
57
52
|
height: 24px;
|
|
58
53
|
}
|
|
59
|
-
`;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
vertices: HEX_VERTICES,
|
|
112
|
-
filled: true,
|
|
113
|
-
fillColor: HEX_FILL,
|
|
114
|
-
strokeColor: HEX_STROKE,
|
|
115
|
-
strokeWidth: 2,
|
|
116
|
-
shapeStyle: ShapeStyle.General,
|
|
117
|
-
roughness: 0,
|
|
118
|
-
xywh: new Bound(
|
|
119
|
-
cx - HEX_SIZE / 2,
|
|
120
|
-
cy - HEX_SIZE / 2,
|
|
121
|
-
HEX_SIZE,
|
|
122
|
-
HEX_SIZE
|
|
123
|
-
).serialize(),
|
|
124
|
-
});
|
|
125
|
-
this._finish(id);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
override render() {
|
|
129
|
-
return html`
|
|
54
|
+
`; }
|
|
55
|
+
_finish(id) {
|
|
56
|
+
const { gfx } = this;
|
|
57
|
+
gfx.doc.captureSync();
|
|
58
|
+
gfx.tool.setTool(DefaultTool);
|
|
59
|
+
gfx.selection.set({ elements: [id], editing: false });
|
|
60
|
+
}
|
|
61
|
+
_createCynefin() {
|
|
62
|
+
const { gfx } = this;
|
|
63
|
+
if (!gfx.surface)
|
|
64
|
+
return;
|
|
65
|
+
const { centerX, centerY } = gfx.viewport;
|
|
66
|
+
const id = gfx.surface.addElement({
|
|
67
|
+
type: 'cynefin',
|
|
68
|
+
xywh: new Bound(centerX - CYN_W / 2, centerY - CYN_H / 2, CYN_W, CYN_H).serialize(),
|
|
69
|
+
});
|
|
70
|
+
this._finish(id);
|
|
71
|
+
}
|
|
72
|
+
_createMap() {
|
|
73
|
+
const { gfx } = this;
|
|
74
|
+
if (!gfx.surface)
|
|
75
|
+
return;
|
|
76
|
+
const width = EST_W * MAP_SCALE;
|
|
77
|
+
const height = EST_H * MAP_SCALE;
|
|
78
|
+
const { centerX, centerY } = gfx.viewport;
|
|
79
|
+
const id = gfx.surface.addElement({
|
|
80
|
+
type: 'estuarine',
|
|
81
|
+
xywh: new Bound(centerX - width / 2, centerY - height / 2, width, height).serialize(),
|
|
82
|
+
});
|
|
83
|
+
this._finish(id);
|
|
84
|
+
}
|
|
85
|
+
_createHexagon() {
|
|
86
|
+
const { gfx } = this;
|
|
87
|
+
if (!gfx.surface)
|
|
88
|
+
return;
|
|
89
|
+
const { centerX: cx, centerY: cy } = gfx.viewport;
|
|
90
|
+
const id = gfx.surface.addElement({
|
|
91
|
+
type: 'shape',
|
|
92
|
+
shapeType: 'polygon',
|
|
93
|
+
vertices: HEX_VERTICES,
|
|
94
|
+
filled: true,
|
|
95
|
+
fillColor: HEX_FILL,
|
|
96
|
+
strokeColor: HEX_STROKE,
|
|
97
|
+
strokeWidth: 2,
|
|
98
|
+
shapeStyle: ShapeStyle.General,
|
|
99
|
+
roughness: 0,
|
|
100
|
+
xywh: new Bound(cx - HEX_SIZE / 2, cy - HEX_SIZE / 2, HEX_SIZE, HEX_SIZE).serialize(),
|
|
101
|
+
});
|
|
102
|
+
this._finish(id);
|
|
103
|
+
}
|
|
104
|
+
render() {
|
|
105
|
+
return html `
|
|
130
106
|
<edgeless-slide-menu>
|
|
131
107
|
<div class="menu-content">
|
|
132
108
|
<div class="button-group-container">
|
|
@@ -152,5 +128,6 @@ export class EdgelessCynefinEstuarineMenu extends EdgelessToolbarToolMixin(
|
|
|
152
128
|
</div>
|
|
153
129
|
</edgeless-slide-menu>
|
|
154
130
|
`;
|
|
155
|
-
|
|
131
|
+
}
|
|
156
132
|
}
|
|
133
|
+
//# sourceMappingURL=menu.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EmptyTool } from '@formicoidea/labre-core/gfx/pointer';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
declare const EdgelessCynefinEstuarineSeniorButton_base: typeof LitElement & import("@formicoidea/labre-core/global/utils").Constructor<import("@formicoidea/labre-core/widgets/edgeless-toolbar").EdgelessToolbarToolClass>;
|
|
4
|
+
/** Main toolbar button that opens the combined Cynefin / Estuarine sub-menu. */
|
|
5
|
+
export declare class EdgelessCynefinEstuarineSeniorButton extends EdgelessCynefinEstuarineSeniorButton_base {
|
|
6
|
+
static styles: import("lit").CSSResult;
|
|
7
|
+
enableActiveBackground: boolean;
|
|
8
|
+
type: typeof EmptyTool;
|
|
9
|
+
private _toggleMenu;
|
|
10
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=senior-button.d.ts.map
|
|
@@ -3,14 +3,15 @@ import { EmptyTool } from '@formicoidea/labre-core/gfx/pointer';
|
|
|
3
3
|
import { EdgelessToolbarToolMixin } from '@formicoidea/labre-core/widgets/edgeless-toolbar';
|
|
4
4
|
import { SignalWatcher } from '@formicoidea/labre-core/global/lit';
|
|
5
5
|
import { css, html, LitElement } from 'lit';
|
|
6
|
-
|
|
7
6
|
import { cynefinToolbarIcon } from './icons';
|
|
8
|
-
|
|
9
7
|
/** Main toolbar button that opens the combined Cynefin / Estuarine sub-menu. */
|
|
10
|
-
export class EdgelessCynefinEstuarineSeniorButton extends EdgelessToolbarToolMixin(
|
|
11
|
-
|
|
12
|
-
)
|
|
13
|
-
|
|
8
|
+
export class EdgelessCynefinEstuarineSeniorButton extends EdgelessToolbarToolMixin(SignalWatcher(LitElement)) {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.enableActiveBackground = true;
|
|
12
|
+
this.type = EmptyTool;
|
|
13
|
+
}
|
|
14
|
+
static { this.styles = css `
|
|
14
15
|
:host,
|
|
15
16
|
.ce-button {
|
|
16
17
|
display: block;
|
|
@@ -49,38 +50,31 @@ export class EdgelessCynefinEstuarineSeniorButton extends EdgelessToolbarToolMix
|
|
|
49
50
|
--y: -10px;
|
|
50
51
|
--s: 1.07;
|
|
51
52
|
}
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
53
|
+
`; }
|
|
54
|
+
_toggleMenu() {
|
|
55
|
+
if (this.popper) {
|
|
56
|
+
this.popper.dispose();
|
|
57
|
+
this.popper = null;
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
this.setEdgelessTool(DefaultTool);
|
|
61
|
+
const menu = this.createPopper('edgeless-cynefin-estuarine-menu', this);
|
|
62
|
+
menu.element.edgeless = this.edgeless;
|
|
63
|
+
const el = menu.element;
|
|
64
|
+
const wrap = el.parentElement;
|
|
65
|
+
if (wrap) {
|
|
66
|
+
wrap.style.overflow = 'visible';
|
|
67
|
+
wrap.style.justifyContent = 'flex-end';
|
|
68
|
+
}
|
|
69
|
+
Object.assign(el.style, {
|
|
70
|
+
position: 'static',
|
|
71
|
+
width: 'max-content',
|
|
72
|
+
maxWidth: 'calc(100vw - 16px)',
|
|
73
|
+
marginLeft: '0',
|
|
74
|
+
});
|
|
73
75
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
width: 'max-content',
|
|
77
|
-
maxWidth: 'calc(100vw - 16px)',
|
|
78
|
-
marginLeft: '0',
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
override render() {
|
|
83
|
-
return html`<edgeless-toolbar-button
|
|
76
|
+
render() {
|
|
77
|
+
return html `<edgeless-toolbar-button
|
|
84
78
|
class="ce-button"
|
|
85
79
|
.tooltip=${this.popper ? '' : 'Cynefin / Estuarine'}
|
|
86
80
|
.tooltipOffset=${4}
|
|
@@ -91,5 +85,6 @@ export class EdgelessCynefinEstuarineSeniorButton extends EdgelessToolbarToolMix
|
|
|
91
85
|
<div class="ce-card">${cynefinToolbarIcon}</div>
|
|
92
86
|
</div>
|
|
93
87
|
</edgeless-toolbar-button>`;
|
|
94
|
-
|
|
88
|
+
}
|
|
95
89
|
}
|
|
90
|
+
//# sourceMappingURL=senior-button.js.map
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { SeniorToolExtension } from '@formicoidea/labre-core/widgets/edgeless-toolbar';
|
|
2
2
|
import { html } from 'lit';
|
|
3
|
-
|
|
4
3
|
/** A single senior tool hosting both the Cynefin and Estuarine frameworks. */
|
|
5
|
-
export const cynefinEstuarineSeniorTool = SeniorToolExtension(
|
|
6
|
-
'cynefin-estuarine',
|
|
7
|
-
({ block }) => {
|
|
4
|
+
export const cynefinEstuarineSeniorTool = SeniorToolExtension('cynefin-estuarine', ({ block }) => {
|
|
8
5
|
return {
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
name: 'Cynefin / Estuarine',
|
|
7
|
+
content: html `<edgeless-cynefin-estuarine-senior-button
|
|
11
8
|
.edgeless=${block}
|
|
12
9
|
></edgeless-cynefin-estuarine-senior-button>`,
|
|
13
10
|
};
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=senior-tool.js.map
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Uniform fit of a fixed reference design (`refW × refH`) into an element of
|
|
3
|
+
* size `w × h`: the scale factor plus the centering offsets (letterboxed).
|
|
4
|
+
* Keeps the artwork undistorted at any element size.
|
|
5
|
+
*/
|
|
6
|
+
export declare function refScale(w: number, h: number, refW: number, refH: number): {
|
|
7
|
+
s: number;
|
|
8
|
+
ox: number;
|
|
9
|
+
oy: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const FONT_FAMILY = "Inter, sans-serif";
|
|
12
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Uniform fit of a fixed reference design (`refW × refH`) into an element of
|
|
3
|
-
* size `w × h`: the scale factor plus the centering offsets (letterboxed).
|
|
4
|
-
* Keeps the artwork undistorted at any element size.
|
|
5
|
-
*/
|
|
6
|
-
export function refScale(w
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Uniform fit of a fixed reference design (`refW × refH`) into an element of
|
|
3
|
+
* size `w × h`: the scale factor plus the centering offsets (letterboxed).
|
|
4
|
+
* Keeps the artwork undistorted at any element size.
|
|
5
|
+
*/
|
|
6
|
+
export function refScale(w, h, refW, refH) {
|
|
7
|
+
const s = Math.min(w / refW, h / refH);
|
|
8
|
+
return { s, ox: (w - refW * s) / 2, oy: (h - refH * s) / 2 };
|
|
9
|
+
}
|
|
10
|
+
export const FONT_FAMILY = 'Inter, sans-serif';
|
|
11
|
+
//# sourceMappingURL=utils.js.map
|
package/dist/view.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ViewExtensionContext, ViewExtensionProvider } from '@formicoidea/labre-core/ext-loader';
|
|
2
|
+
export declare class CynefinEstuarineViewExtension extends ViewExtensionProvider {
|
|
3
|
+
name: string;
|
|
4
|
+
effect(): void;
|
|
5
|
+
setup(context: ViewExtensionContext): void;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=view.d.ts.map
|
package/dist/view.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ViewExtensionProvider, } from '@formicoidea/labre-core/ext-loader';
|
|
2
|
+
import { extendTemplateCategory } from '@formicoidea/labre-core/gfx/template';
|
|
3
|
+
import { CynefinRendererExtension } from './cynefin/element-renderer';
|
|
4
|
+
import { CynefinInteraction, CynefinView } from './cynefin/element-view';
|
|
5
|
+
import { cynefinToolbarExtension } from './cynefin/toolbar/config';
|
|
6
|
+
import { effects } from './effects';
|
|
7
|
+
import { EstuarineRendererExtension } from './estuarine/element-renderer';
|
|
8
|
+
import { EstuarineInteraction, EstuarineView } from './estuarine/element-view';
|
|
9
|
+
import { estuarineToolbarExtension } from './estuarine/toolbar/config';
|
|
10
|
+
import { cynefinTemplateCategory, estuarineTemplateCategory, } from './templates';
|
|
11
|
+
import { cynefinEstuarineSeniorTool } from './toolbar/senior-tool';
|
|
12
|
+
export class CynefinEstuarineViewExtension extends ViewExtensionProvider {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.name = 'affine-cynefin-estuarine-gfx';
|
|
16
|
+
}
|
|
17
|
+
effect() {
|
|
18
|
+
super.effect();
|
|
19
|
+
effects();
|
|
20
|
+
extendTemplateCategory(cynefinTemplateCategory);
|
|
21
|
+
extendTemplateCategory(estuarineTemplateCategory);
|
|
22
|
+
}
|
|
23
|
+
setup(context) {
|
|
24
|
+
super.setup(context);
|
|
25
|
+
context.register(CynefinView);
|
|
26
|
+
context.register(CynefinRendererExtension);
|
|
27
|
+
context.register(EstuarineView);
|
|
28
|
+
context.register(EstuarineRendererExtension);
|
|
29
|
+
if (this.isEdgeless(context.scope)) {
|
|
30
|
+
context.register(CynefinInteraction);
|
|
31
|
+
context.register(EstuarineInteraction);
|
|
32
|
+
context.register(cynefinEstuarineSeniorTool);
|
|
33
|
+
context.register(cynefinToolbarExtension);
|
|
34
|
+
context.register(estuarineToolbarExtension);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=view.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formicoidea/labre-framework-cynefin",
|
|
3
3
|
"description": "Labre cynefin-estuarine framework for @formicoidea/labre-core.",
|
|
4
|
-
"version": "0.23.
|
|
4
|
+
"version": "0.23.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"author": "lajola",
|
|
@@ -10,15 +10,24 @@
|
|
|
10
10
|
],
|
|
11
11
|
"license": "MPL-2.0",
|
|
12
12
|
"exports": {
|
|
13
|
-
".":
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./view": {
|
|
18
|
+
"types": "./dist/view.d.ts",
|
|
19
|
+
"import": "./dist/view.js"
|
|
20
|
+
},
|
|
21
|
+
"./descriptor": {
|
|
22
|
+
"types": "./dist/descriptor.d.ts",
|
|
23
|
+
"import": "./dist/descriptor.js"
|
|
24
|
+
}
|
|
16
25
|
},
|
|
17
26
|
"files": [
|
|
18
|
-
"
|
|
27
|
+
"dist"
|
|
19
28
|
],
|
|
20
29
|
"dependencies": {
|
|
21
|
-
"@formicoidea/labre-core": "0.23.
|
|
30
|
+
"@formicoidea/labre-core": "0.23.1",
|
|
22
31
|
"lit": "^3.2.0"
|
|
23
32
|
}
|
|
24
33
|
}
|