kritzel-stencil 0.4.4 → 0.4.6
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/cjs/kritzel-active-users_47.cjs.entry.js +79 -13
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/stencil.cjs.js +1 -1
- package/dist/collection/classes/core/viewport.class.js +14 -1
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +48 -8
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +84 -3
- package/dist/collection/constants/version.js +1 -1
- package/dist/components/index.js +1226 -1
- package/dist/components/kritzel-active-users.js +6 -1
- package/dist/components/kritzel-avatar.js +6 -1
- package/dist/components/kritzel-awareness-cursors.js +6 -1
- package/dist/components/kritzel-back-to-content.js +6 -1
- package/dist/components/kritzel-brush-style.js +64 -1
- package/dist/components/kritzel-button.js +6 -1
- package/dist/components/kritzel-color-palette.js +6 -1
- package/dist/components/kritzel-color.js +6 -1
- package/dist/components/kritzel-context-menu.js +6 -1
- package/dist/components/kritzel-controls.js +6 -1
- package/dist/components/kritzel-current-user-dialog.js +6 -1
- package/dist/components/kritzel-current-user.js +6 -1
- package/dist/components/kritzel-cursor-trail.js +6 -1
- package/dist/components/kritzel-dialog.js +6 -1
- package/dist/components/kritzel-dropdown.js +6 -1
- package/dist/components/kritzel-editor.js +4404 -1
- package/dist/components/kritzel-engine.js +6 -1
- package/dist/components/kritzel-export.js +6 -1
- package/dist/components/kritzel-font-family.js +6 -1
- package/dist/components/kritzel-font-size.js +6 -1
- package/dist/components/kritzel-font.js +6 -1
- package/dist/components/kritzel-icon.js +6 -1
- package/dist/components/kritzel-input.js +6 -1
- package/dist/components/kritzel-line-endings.js +6 -1
- package/dist/components/kritzel-loading-overlay.js +6 -1
- package/dist/components/kritzel-login-dialog.js +6 -1
- package/dist/components/kritzel-master-detail.js +6 -1
- package/dist/components/kritzel-menu-item.js +6 -1
- package/dist/components/kritzel-menu.js +6 -1
- package/dist/components/kritzel-more-menu.js +6 -1
- package/dist/components/kritzel-notification-card.js +6 -1
- package/dist/components/kritzel-numeric-input.js +6 -1
- package/dist/components/kritzel-opacity-slider.js +6 -1
- package/dist/components/kritzel-pill-tabs.js +6 -1
- package/dist/components/kritzel-portal.js +6 -1
- package/dist/components/kritzel-settings.js +6 -1
- package/dist/components/kritzel-shape-fill.js +6 -1
- package/dist/components/kritzel-share-dialog.js +6 -1
- package/dist/components/kritzel-slide-toggle.js +6 -1
- package/dist/components/kritzel-split-button.js +6 -1
- package/dist/components/kritzel-stroke-size.js +6 -1
- package/dist/components/kritzel-sync-indicator.js +6 -1
- package/dist/components/kritzel-tool-config.js +6 -1
- package/dist/components/kritzel-tooltip.js +6 -1
- package/dist/components/kritzel-utility-panel.js +6 -1
- package/dist/components/kritzel-watermark.js +6 -1
- package/dist/components/kritzel-workspace-manager.js +6 -1
- package/dist/components/kritzel-zoom-panel.js +6 -1
- package/dist/components/p-894OnDQV.js +39 -1
- package/dist/components/p-B43upypT.js +1500 -1
- package/dist/components/p-B5oHmPJb.js +97 -1
- package/dist/components/p-B6t5q-V4.js +63 -1
- package/dist/components/p-B8Xi4Clg.js +43 -1
- package/dist/components/p-BBmP8lVY.js +51726 -0
- package/dist/components/p-BDzlx2hB.js +135 -1
- package/dist/components/p-BFTU3MAI.js +7 -1
- package/dist/components/p-BFYtCsZu.js +56 -1
- package/dist/components/p-BI2ng9I_.js +62 -1
- package/dist/components/p-BTzlrIxe.js +194 -1
- package/dist/components/p-BmyTdQGy.js +1090 -1
- package/dist/components/p-BsANVili.js +150 -1
- package/dist/components/p-BxpKq94F.js +290 -1
- package/dist/components/p-C38P-Vd0.js +446 -1
- package/dist/components/p-C4NrrUfN.js +77 -1
- package/dist/components/p-CW-VyJgK.js +6 -1
- package/dist/components/p-CWRSGYOE.js +57 -1
- package/dist/components/p-CXpv9Rxe.js +106 -1
- package/dist/components/p-Ca-igU1f.js +320 -1
- package/dist/components/p-CdR76C4L.js +165 -1
- package/dist/components/p-Ch42cOeY.js +320 -0
- package/dist/components/p-ClFprFvz.js +209 -1
- package/dist/components/p-Cm33td2O.js +122 -1
- package/dist/components/p-CqLgB8JK.js +91 -1
- package/dist/components/p-Cr682JI_.js +156 -1
- package/dist/components/p-CsvMgk_f.js +62 -1
- package/dist/components/p-CwJwsRR3.js +277 -1
- package/dist/components/p-Cymum41a.js +88 -1
- package/dist/components/p-D09kgc5Q.js +94 -1
- package/dist/components/p-D30zs0kA.js +121 -1
- package/dist/components/p-D3y_Hauo.js +85 -1
- package/dist/components/p-D5jf8wAu.js +142 -1
- package/dist/components/p-D82VaHce.js +53 -1
- package/dist/components/p-DAwPPDMS.js +101 -1
- package/dist/components/p-DEBwmRTC.js +55 -1
- package/dist/components/p-DIazmg6w.js +52 -1
- package/dist/components/p-DJ88BrIW.js +70 -1
- package/dist/components/p-DJkKlUyZ.js +182 -1
- package/dist/components/p-DUYmwrWV.js +3267 -1
- package/dist/components/p-DX2nriaq.js +486 -1
- package/dist/components/p-Dd-pMvlr.js +20 -1
- package/dist/components/p-Df3BwVGy.js +299 -1
- package/dist/components/p-DgJ0ufzr.js +43 -1
- package/dist/components/p-DkUb2czk.js +70 -1
- package/dist/components/p-Dlp84thc.js +57 -1
- package/dist/components/p-JYj3Facr.js +431 -1
- package/dist/components/p-Ka7OWbnk.js +2304 -1
- package/dist/components/p-PSFAfAyd.js +49 -1
- package/dist/components/p-WUdQqYnu.js +118 -1
- package/dist/components/p-djJSnjAX.js +84 -1
- package/dist/components/p-e6Zpc9Vp.js +143 -1
- package/dist/components/p-jGOpkGDl.js +30 -1
- package/dist/components/p-pagW8YF7.js +99 -1
- package/dist/esm/kritzel-active-users_47.entry.js +79 -13
- package/dist/esm/loader.js +1 -1
- package/dist/esm/stencil.js +1 -1
- package/dist/stencil/index.esm.js +1172 -1
- package/dist/stencil/p-5b969a42.entry.js +36109 -0
- package/dist/stencil/p-DQuL1Twl.js +3 -1
- package/dist/stencil/p-Dhio9uis.js +1717 -2
- package/dist/stencil/p-fb32cd8f.entry.js +29 -1
- package/dist/stencil/p-uC7_X6yr.js +30737 -1
- package/dist/stencil/stencil.esm.js +21 -1
- package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +2 -0
- package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +7 -0
- package/dist/types/components.d.ts +10 -0
- package/dist/types/constants/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/p--Oazz-BP.js +0 -9
- package/dist/components/p-Xsiz1D5Q.js +0 -1
- package/dist/stencil/p-9abc21b9.entry.js +0 -9
|
@@ -1 +1,122 @@
|
|
|
1
|
-
import{p as
|
|
1
|
+
import { p as proxyCustomElement, H, h, d as Host, t as transformTag } from './p-B43upypT.js';
|
|
2
|
+
|
|
3
|
+
var KritzelMouseButton;
|
|
4
|
+
(function (KritzelMouseButton) {
|
|
5
|
+
KritzelMouseButton[KritzelMouseButton["Left"] = 0] = "Left";
|
|
6
|
+
KritzelMouseButton[KritzelMouseButton["Middle"] = 1] = "Middle";
|
|
7
|
+
KritzelMouseButton[KritzelMouseButton["Right"] = 2] = "Right";
|
|
8
|
+
})(KritzelMouseButton || (KritzelMouseButton = {}));
|
|
9
|
+
|
|
10
|
+
const kritzelCursorTrailCss = () => `:host{display:block;position:fixed;top:0;left:0;width:100vw;height:100vh;pointer-events:none;z-index:9000}`;
|
|
11
|
+
|
|
12
|
+
const KritzelCursorTrail = /*@__PURE__*/ proxyCustomElement(class KritzelCursorTrail extends H {
|
|
13
|
+
constructor(registerHost) {
|
|
14
|
+
super();
|
|
15
|
+
if (registerHost !== false) {
|
|
16
|
+
this.__registerHost();
|
|
17
|
+
}
|
|
18
|
+
this.__attachShadow();
|
|
19
|
+
}
|
|
20
|
+
core;
|
|
21
|
+
cursorTrailPoints = [];
|
|
22
|
+
isLeftButtonDown = false;
|
|
23
|
+
handleMouseDown(ev) {
|
|
24
|
+
if (ev.pointerType === 'mouse') {
|
|
25
|
+
if (ev.button === KritzelMouseButton.Left) {
|
|
26
|
+
this.isLeftButtonDown = true;
|
|
27
|
+
this.cursorTrailPoints = [];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (ev.pointerType === 'touch') {
|
|
31
|
+
if (this.core.store.state.pointers.size === 1) {
|
|
32
|
+
this.isLeftButtonDown = true;
|
|
33
|
+
this.cursorTrailPoints = [];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
handlePointerMove(ev) {
|
|
38
|
+
if (!this.isLeftButtonDown) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const newPoint = { x: ev.clientX, y: ev.clientY, timestamp: Date.now() };
|
|
42
|
+
const updatedTrail = [newPoint, ...this.cursorTrailPoints];
|
|
43
|
+
if (updatedTrail.length > this.MAX_TRAIL_POINTS) {
|
|
44
|
+
this.cursorTrailPoints = updatedTrail.slice(0, this.MAX_TRAIL_POINTS);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this.cursorTrailPoints = updatedTrail;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
handlePointerUp(ev) {
|
|
51
|
+
if (ev.pointerType === 'mouse') {
|
|
52
|
+
if (ev.button === KritzelMouseButton.Left) {
|
|
53
|
+
this.isLeftButtonDown = false;
|
|
54
|
+
this.cursorTrailPoints = [];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (ev.pointerType === 'touch') {
|
|
58
|
+
if (this.core.store.state.pointers.size === 0) {
|
|
59
|
+
this.isLeftButtonDown = false;
|
|
60
|
+
this.cursorTrailPoints = [];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
trailCleanupIntervalId;
|
|
65
|
+
TRAIL_DURATION_MS = 100;
|
|
66
|
+
MAX_TRAIL_POINTS = 50;
|
|
67
|
+
componentDidLoad() {
|
|
68
|
+
this.trailCleanupIntervalId = window.setInterval(() => {
|
|
69
|
+
const now = Date.now();
|
|
70
|
+
const newTrailPoints = this.cursorTrailPoints.filter(p => now - p.timestamp < this.TRAIL_DURATION_MS);
|
|
71
|
+
if (newTrailPoints.length !== this.cursorTrailPoints.length) {
|
|
72
|
+
this.cursorTrailPoints = newTrailPoints;
|
|
73
|
+
}
|
|
74
|
+
}, 50);
|
|
75
|
+
}
|
|
76
|
+
disconnectedCallback() {
|
|
77
|
+
if (this.trailCleanupIntervalId) {
|
|
78
|
+
window.clearInterval(this.trailCleanupIntervalId);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
render() {
|
|
82
|
+
return (h(Host, { key: 'b427550b19a3e172cb25d05e34635121b82a61c5' }, this.cursorTrailPoints.length > 1 && (h("svg", { key: '9685b563497e110f36c0feffbfde04ebeb38024b', class: "cursor-trail-svg", xmlns: "http://www.w3.org/2000/svg", style: {
|
|
83
|
+
position: 'absolute',
|
|
84
|
+
left: '0',
|
|
85
|
+
top: '0',
|
|
86
|
+
width: '100%',
|
|
87
|
+
height: '100%',
|
|
88
|
+
pointerEvents: 'none',
|
|
89
|
+
opacity: 'var(--kritzel-cursor-trail-opacity, 0.6)',
|
|
90
|
+
zIndex: '9000',
|
|
91
|
+
} }, this.cursorTrailPoints.slice(1).map((point, index) => {
|
|
92
|
+
const prevPoint = this.cursorTrailPoints[index];
|
|
93
|
+
const now = Date.now();
|
|
94
|
+
const age = now - point.timestamp;
|
|
95
|
+
const progress = Math.max(0, Math.min(1, age / this.TRAIL_DURATION_MS));
|
|
96
|
+
if (progress >= 1)
|
|
97
|
+
return null;
|
|
98
|
+
const baseStrokeWidth = Math.max(2, 15 * (1 - progress));
|
|
99
|
+
return (h("line", { key: `trail-segment-${point.timestamp}`, x1: prevPoint.x.toString(), y1: prevPoint.y.toString(), x2: point.x.toString(), y2: point.y.toString(), stroke: "var(--kritzel-cursor-trail-color, rgb(228, 228, 228))", "stroke-width": baseStrokeWidth.toString(), "stroke-linecap": "round" }));
|
|
100
|
+
})))));
|
|
101
|
+
}
|
|
102
|
+
static get style() { return kritzelCursorTrailCss(); }
|
|
103
|
+
}, [513, "kritzel-cursor-trail", {
|
|
104
|
+
"core": [16],
|
|
105
|
+
"cursorTrailPoints": [32],
|
|
106
|
+
"isLeftButtonDown": [32]
|
|
107
|
+
}, [[9, "pointerdown", "handleMouseDown"], [9, "pointermove", "handlePointerMove"], [9, "pointerup", "handlePointerUp"]]]);
|
|
108
|
+
function defineCustomElement() {
|
|
109
|
+
if (typeof customElements === "undefined") {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const components = ["kritzel-cursor-trail"];
|
|
113
|
+
components.forEach(tagName => { switch (tagName) {
|
|
114
|
+
case "kritzel-cursor-trail":
|
|
115
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
116
|
+
customElements.define(transformTag(tagName), KritzelCursorTrail);
|
|
117
|
+
}
|
|
118
|
+
break;
|
|
119
|
+
} });
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export { KritzelCursorTrail as K, KritzelMouseButton as a, defineCustomElement as d };
|
|
@@ -1 +1,91 @@
|
|
|
1
|
-
import{p as
|
|
1
|
+
import { p as proxyCustomElement, H, h, d as Host, t as transformTag } from './p-B43upypT.js';
|
|
2
|
+
import { a as KritzelColorHelper } from './p-BmyTdQGy.js';
|
|
3
|
+
|
|
4
|
+
const kritzelColorCss = () => `:host{display:flex}.checkerboard-bg{background:repeating-conic-gradient( var(--kritzel-checkerboard-color-dark, #ccc) 0% 25%, var(--kritzel-checkerboard-color-light, #fff) 0% 50% ) 50% / 8px 8px;position:relative;overflow:hidden}.color-circle{width:24px;height:24px;border-radius:50%;box-sizing:border-box;display:block}.color-circle.white{border:1px solid var(--kritzel-color-palette-circle-border-color, #dddcdc)}`;
|
|
5
|
+
|
|
6
|
+
const KritzelColorComponent = /*@__PURE__*/ proxyCustomElement(class KritzelColorComponent extends H {
|
|
7
|
+
constructor(registerHost) {
|
|
8
|
+
super();
|
|
9
|
+
if (registerHost !== false) {
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
}
|
|
12
|
+
this.__attachShadow();
|
|
13
|
+
}
|
|
14
|
+
value;
|
|
15
|
+
theme;
|
|
16
|
+
size = 24;
|
|
17
|
+
resolveColor() {
|
|
18
|
+
if (!this.value)
|
|
19
|
+
return '';
|
|
20
|
+
if (typeof this.value === 'string')
|
|
21
|
+
return this.value;
|
|
22
|
+
return KritzelColorHelper.resolveThemeColor(this.value, this.theme);
|
|
23
|
+
}
|
|
24
|
+
isLightColor(hexColor) {
|
|
25
|
+
if (!hexColor)
|
|
26
|
+
return false;
|
|
27
|
+
let r = 0, g = 0, b = 0;
|
|
28
|
+
let sanitizedHex = hexColor.startsWith('#') ? hexColor.slice(1) : hexColor;
|
|
29
|
+
if (sanitizedHex.length === 3) {
|
|
30
|
+
r = parseInt(sanitizedHex[0] + sanitizedHex[0], 16);
|
|
31
|
+
g = parseInt(sanitizedHex[1] + sanitizedHex[1], 16);
|
|
32
|
+
b = parseInt(sanitizedHex[2] + sanitizedHex[2], 16);
|
|
33
|
+
}
|
|
34
|
+
else if (sanitizedHex.length === 6) {
|
|
35
|
+
r = parseInt(sanitizedHex.substring(0, 2), 16);
|
|
36
|
+
g = parseInt(sanitizedHex.substring(2, 4), 16);
|
|
37
|
+
b = parseInt(sanitizedHex.substring(4, 6), 16);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
if (isNaN(r) || isNaN(g) || isNaN(b)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
const luminance = 0.299 * r + 0.587 * g + 0.114 * b;
|
|
46
|
+
return luminance > 220;
|
|
47
|
+
}
|
|
48
|
+
render() {
|
|
49
|
+
const resolvedColor = this.resolveColor();
|
|
50
|
+
const isColorVeryLight = this.isLightColor(resolvedColor);
|
|
51
|
+
return (h(Host, { key: 'a898705a76a25b051b046cb3d5274c1701482a4c' }, h("div", { key: '7d5ce83a17f710a1d808ff7d572b75585caada72', class: "checkerboard-bg", style: {
|
|
52
|
+
width: `${this.size}px`,
|
|
53
|
+
height: `${this.size}px`,
|
|
54
|
+
borderRadius: '50%',
|
|
55
|
+
display: 'inline-block',
|
|
56
|
+
position: 'relative',
|
|
57
|
+
} }, h("div", { key: '8d318c989b7e69bc61dd653688a9e7480c4ee34d', class: {
|
|
58
|
+
'color-circle': true,
|
|
59
|
+
'white': isColorVeryLight,
|
|
60
|
+
}, style: {
|
|
61
|
+
backgroundColor: resolvedColor,
|
|
62
|
+
width: `${this.size}px`,
|
|
63
|
+
height: `${this.size}px`,
|
|
64
|
+
borderRadius: '50%',
|
|
65
|
+
position: 'absolute',
|
|
66
|
+
top: '0',
|
|
67
|
+
left: '0',
|
|
68
|
+
display: 'inline-block',
|
|
69
|
+
} }))));
|
|
70
|
+
}
|
|
71
|
+
static get style() { return kritzelColorCss(); }
|
|
72
|
+
}, [513, "kritzel-color", {
|
|
73
|
+
"value": [1],
|
|
74
|
+
"theme": [1],
|
|
75
|
+
"size": [2]
|
|
76
|
+
}]);
|
|
77
|
+
function defineCustomElement() {
|
|
78
|
+
if (typeof customElements === "undefined") {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const components = ["kritzel-color"];
|
|
82
|
+
components.forEach(tagName => { switch (tagName) {
|
|
83
|
+
case "kritzel-color":
|
|
84
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
85
|
+
customElements.define(transformTag(tagName), KritzelColorComponent);
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
} });
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export { KritzelColorComponent as K, defineCustomElement as d };
|
|
@@ -1 +1,156 @@
|
|
|
1
|
-
import{p as
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h, d as Host, t as transformTag } from './p-B43upypT.js';
|
|
2
|
+
import { K as KritzelDevicesHelper } from './p-jGOpkGDl.js';
|
|
3
|
+
import { d as defineCustomElement$4 } from './p-CdR76C4L.js';
|
|
4
|
+
import { d as defineCustomElement$2, a as defineCustomElement$3 } from './p-CwJwsRR3.js';
|
|
5
|
+
import { d as defineCustomElement$1 } from './p-Ca-igU1f.js';
|
|
6
|
+
|
|
7
|
+
const kritzelSplitButtonCss = () => `:host{position:relative;display:flex;align-items:center;font-family:sans-serif;z-index:1;padding:var(--kritzel-split-button-padding, 4px);background-color:var(--kritzel-split-button-background-color, #ffffff);border-radius:var(--kritzel-split-button-border-radius, 12px);box-shadow:var(--kritzel-split-button-box-shadow, 0 0 3px rgba(0, 0, 0, 0.08));border:var(--kritzel-split-button-border, 1px solid #ebebeb);gap:var(--kritzel-split-button-gap, 4px)}:host(.mobile){--kritzel-split-button-hover-background-color:transparent}button{border:none;background-color:transparent;padding:0;margin:0;font-family:inherit;font-size:inherit;color:var(--kritzel-split-button-color, #000000);-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:var(--kritzel-global-pointer-cursor, pointer);text-align:center;display:flex;align-items:center;justify-content:center;pointer-events:all;-webkit-tap-highlight-color:transparent}.split-main-button,.split-menu-button{height:auto;display:flex;align-items:center;padding:var(--kritzel-split-button-padding, 8px);background-color:var(--kritzel-split-button-background-color, #ffffff);border-radius:var(--kritzel-split-button-border-radius, 12px);font-size:var(--kritzel-split-button-font-size, 14px)}.split-main-button:hover,.split-menu-button:hover{background-color:var(--kritzel-split-button-hover-background-color, hsl(0, 0%, 0%, 4.3%))}.split-main-button:focus,.split-menu-button:focus{background-color:var(--kritzel-split-button-hover-background-color, hsl(0, 0%, 0%, 4.3%))}.split-main-button{gap:var(--kritzel-split-button-gap, 4px)}.split-menu-button{border-left:none;justify-content:center}.split-divider{width:var(--kritzel-split-button-divider-width, 1px);height:24px;background-color:var(--kritzel-split-button-divider-background-color, hsl(0, 0%, 0%, 4.3%))}:disabled{pointer-events:none;opacity:0.5}`;
|
|
8
|
+
|
|
9
|
+
const KritzelSplitButton = /*@__PURE__*/ proxyCustomElement(class KritzelSplitButton extends H {
|
|
10
|
+
constructor(registerHost) {
|
|
11
|
+
super();
|
|
12
|
+
if (registerHost !== false) {
|
|
13
|
+
this.__registerHost();
|
|
14
|
+
}
|
|
15
|
+
this.__attachShadow();
|
|
16
|
+
this.mainButtonClick = createEvent(this, "mainButtonClick");
|
|
17
|
+
this.itemSelect = createEvent(this, "itemSelect");
|
|
18
|
+
this.itemSave = createEvent(this, "itemSave");
|
|
19
|
+
this.itemCancel = createEvent(this, "itemCancel");
|
|
20
|
+
this.itemToggleChildMenu = createEvent(this, "itemToggleChildMenu");
|
|
21
|
+
this.itemCloseChildMenu = createEvent(this, "itemCloseChildMenu");
|
|
22
|
+
this.menuOpen = createEvent(this, "menuOpen");
|
|
23
|
+
this.menuClose = createEvent(this, "menuClose");
|
|
24
|
+
}
|
|
25
|
+
get host() { return this; }
|
|
26
|
+
buttonIcon = 'plus';
|
|
27
|
+
dropdownIcon = 'chevron-down';
|
|
28
|
+
items = [];
|
|
29
|
+
mainButtonDisabled = false;
|
|
30
|
+
menuButtonDisabled = false;
|
|
31
|
+
mainButtonClick;
|
|
32
|
+
itemSelect;
|
|
33
|
+
itemSave;
|
|
34
|
+
itemCancel;
|
|
35
|
+
itemToggleChildMenu;
|
|
36
|
+
itemCloseChildMenu;
|
|
37
|
+
menuOpen;
|
|
38
|
+
menuClose;
|
|
39
|
+
isMenuOpen = false;
|
|
40
|
+
isTouchDevice = KritzelDevicesHelper.isTouchDevice();
|
|
41
|
+
anchorElement;
|
|
42
|
+
menuScrollTop = 0;
|
|
43
|
+
splitMenuButtonRef;
|
|
44
|
+
menuRef;
|
|
45
|
+
async open() {
|
|
46
|
+
if (this.isMenuOpen)
|
|
47
|
+
return;
|
|
48
|
+
window.dispatchEvent(new CustomEvent('kritzel-dismiss-menus'));
|
|
49
|
+
this.isMenuOpen = true;
|
|
50
|
+
this.anchorElement = this.host;
|
|
51
|
+
this.menuOpen.emit();
|
|
52
|
+
}
|
|
53
|
+
async focusMenu() {
|
|
54
|
+
if (this.menuRef) {
|
|
55
|
+
await this.menuRef.setFocus();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
handleButtonClick = (event) => {
|
|
59
|
+
event.stopPropagation();
|
|
60
|
+
this.mainButtonClick.emit();
|
|
61
|
+
};
|
|
62
|
+
toggleMenu = (event) => {
|
|
63
|
+
event.stopPropagation();
|
|
64
|
+
if (this.isMenuOpen) {
|
|
65
|
+
this.closeMenu();
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
this.openMenu(event);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
openMenu = (event) => {
|
|
72
|
+
event.stopPropagation();
|
|
73
|
+
window.dispatchEvent(new CustomEvent('kritzel-dismiss-menus'));
|
|
74
|
+
this.isMenuOpen = true;
|
|
75
|
+
this.anchorElement = this.host;
|
|
76
|
+
this.menuOpen.emit();
|
|
77
|
+
requestAnimationFrame(() => {
|
|
78
|
+
this.menuRef?.setScrollTop(this.menuScrollTop);
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
closeMenu = () => {
|
|
82
|
+
this.isMenuOpen = false;
|
|
83
|
+
this.anchorElement = null;
|
|
84
|
+
this.splitMenuButtonRef?.blur();
|
|
85
|
+
this.menuClose.emit();
|
|
86
|
+
};
|
|
87
|
+
handleItemSelect = event => {
|
|
88
|
+
this.itemSelect.emit(event.detail);
|
|
89
|
+
};
|
|
90
|
+
handleItemSave = event => {
|
|
91
|
+
this.itemSave.emit(event.detail);
|
|
92
|
+
};
|
|
93
|
+
handleItemCancel = event => {
|
|
94
|
+
this.itemCancel.emit(event.detail);
|
|
95
|
+
};
|
|
96
|
+
handleItemToggleChildMenu = event => {
|
|
97
|
+
this.itemToggleChildMenu.emit(event.detail);
|
|
98
|
+
};
|
|
99
|
+
handleItemCloseChildMenu = event => {
|
|
100
|
+
this.itemCloseChildMenu.emit(event.detail);
|
|
101
|
+
};
|
|
102
|
+
handleScroll = event => {
|
|
103
|
+
this.menuScrollTop = event.target.scrollTop;
|
|
104
|
+
};
|
|
105
|
+
render() {
|
|
106
|
+
return (h(Host, { key: 'b3b5b4a63df6e6a4bd2902716a8c26830e31127d', class: { mobile: this.isTouchDevice } }, h("button", { key: 'a25f723f41c1604172fa96d036eab6b80a22add5', class: "split-main-button", tabIndex: 0, onClick: this.handleButtonClick, disabled: this.mainButtonDisabled, "aria-label": "Main action" }, this.buttonIcon && h("kritzel-icon", { key: '6999b1baefa3c940c2a25772b0c03ab0c809cd79', name: this.buttonIcon })), h("div", { key: 'dcbff30cae4a73b5c214c0ae98b16c8d681b8eed', class: "split-divider" }), h("button", { key: 'bdbe0b300b3c5df31df58574ee055f05787acceb', ref: el => (this.splitMenuButtonRef = el), class: "split-menu-button", tabIndex: 0, onClick: this.toggleMenu, disabled: this.menuButtonDisabled, "aria-label": "Open menu" }, h("kritzel-icon", { key: '66969517639c73140a745bc189730dfa09eafa08', name: this.dropdownIcon })), h("kritzel-portal", { key: '197d002ea78ddb535743d6d2f872b9779dfc462b', anchor: this.anchorElement, offsetY: 4, onClose: this.closeMenu }, h("kritzel-menu", { key: '15f1d42042e2368ff04e54f7872480f9f8841900', ref: el => (this.menuRef = el), items: this.items, onItemSelect: this.handleItemSelect, onItemSave: this.handleItemSave, onItemCancel: this.handleItemCancel, onItemToggleChildMenu: this.handleItemToggleChildMenu, onItemCloseChildMenu: this.handleItemCloseChildMenu, onClose: this.closeMenu, onScroll: this.handleScroll }))));
|
|
107
|
+
}
|
|
108
|
+
static get style() { return kritzelSplitButtonCss(); }
|
|
109
|
+
}, [513, "kritzel-split-button", {
|
|
110
|
+
"buttonIcon": [1, "button-icon"],
|
|
111
|
+
"dropdownIcon": [1, "dropdown-icon"],
|
|
112
|
+
"items": [16],
|
|
113
|
+
"mainButtonDisabled": [4, "main-button-disabled"],
|
|
114
|
+
"menuButtonDisabled": [4, "menu-button-disabled"],
|
|
115
|
+
"isMenuOpen": [32],
|
|
116
|
+
"isTouchDevice": [32],
|
|
117
|
+
"anchorElement": [32],
|
|
118
|
+
"menuScrollTop": [32],
|
|
119
|
+
"open": [64],
|
|
120
|
+
"focusMenu": [64]
|
|
121
|
+
}]);
|
|
122
|
+
function defineCustomElement() {
|
|
123
|
+
if (typeof customElements === "undefined") {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const components = ["kritzel-split-button", "kritzel-icon", "kritzel-menu", "kritzel-menu-item", "kritzel-portal"];
|
|
127
|
+
components.forEach(tagName => { switch (tagName) {
|
|
128
|
+
case "kritzel-split-button":
|
|
129
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
130
|
+
customElements.define(transformTag(tagName), KritzelSplitButton);
|
|
131
|
+
}
|
|
132
|
+
break;
|
|
133
|
+
case "kritzel-icon":
|
|
134
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
135
|
+
defineCustomElement$4();
|
|
136
|
+
}
|
|
137
|
+
break;
|
|
138
|
+
case "kritzel-menu":
|
|
139
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
140
|
+
defineCustomElement$3();
|
|
141
|
+
}
|
|
142
|
+
break;
|
|
143
|
+
case "kritzel-menu-item":
|
|
144
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
145
|
+
defineCustomElement$2();
|
|
146
|
+
}
|
|
147
|
+
break;
|
|
148
|
+
case "kritzel-portal":
|
|
149
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
150
|
+
defineCustomElement$1();
|
|
151
|
+
}
|
|
152
|
+
break;
|
|
153
|
+
} });
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export { KritzelSplitButton as K, defineCustomElement as d };
|
|
@@ -1 +1,62 @@
|
|
|
1
|
-
import{p as
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h, d as Host, t as transformTag } from './p-B43upypT.js';
|
|
2
|
+
import { d as defineCustomElement$1 } from './p-CdR76C4L.js';
|
|
3
|
+
|
|
4
|
+
const kritzelUtilityPanelCss = () => `:host{display:flex;flex-direction:row;align-items:center;padding:4px;gap:8px;border-top-left-radius:12px;border-top-right-radius:12px;background-color:var(--kritzel-utility-panel-background-color, #e2e2e2);width:fit-content;user-select:none;z-index:1}.utility-button{display:flex;justify-content:center;align-items:center;width:28px;height:28px;padding:8px 4px;border:none;background:none;cursor:var(--kritzel-global-pointer-cursor, pointer);color:var(--kritzel-utility-panel-button-color, #333333);--kritzel-icon-color:var(--kritzel-utility-panel-button-color, #333333);-webkit-tap-highlight-color:transparent;border-radius:var(--kritzel-utility-panel-button-border-radius, 8px)}.utility-button:hover,.utility-button:focus-visible{background-color:var(--kritzel-utility-panel-button-hover-background-color, hsl(0, 0%, 0%, 4.3%))}.utility-button:disabled{opacity:0.4;cursor:not-allowed;pointer-events:none}.utility-separator{width:1px;height:16px;background-color:var(--kritzel-utility-panel-separator-color, hsl(0, 0%, 0%, 8%))}`;
|
|
5
|
+
|
|
6
|
+
const KritzelUtilityPanel = /*@__PURE__*/ proxyCustomElement(class KritzelUtilityPanel extends H {
|
|
7
|
+
constructor(registerHost) {
|
|
8
|
+
super();
|
|
9
|
+
if (registerHost !== false) {
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
}
|
|
12
|
+
this.__attachShadow();
|
|
13
|
+
this.undo = createEvent(this, "undo");
|
|
14
|
+
this.redo = createEvent(this, "redo");
|
|
15
|
+
this.delete = createEvent(this, "delete");
|
|
16
|
+
}
|
|
17
|
+
undoState = null;
|
|
18
|
+
/** Resolved localized strings keyed by term key, supplied by the editor. */
|
|
19
|
+
terms = {};
|
|
20
|
+
undo;
|
|
21
|
+
redo;
|
|
22
|
+
delete;
|
|
23
|
+
handleUndo(event) {
|
|
24
|
+
if (event.cancelable) {
|
|
25
|
+
event.preventDefault();
|
|
26
|
+
event.stopPropagation();
|
|
27
|
+
this.undo.emit();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
handleRedo(event) {
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
event.stopPropagation();
|
|
33
|
+
this.redo.emit();
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
|
+
return (h(Host, { key: '0ea9faf487a37d04097ee64e080f8f9bd8e6c901' }, h("button", { key: 'dbd4c0972188904b4c3cbbbf46c272fde462df0d', class: "utility-button", "data-testid": "utility-undo", disabled: !this.undoState?.canUndo, onClick: event => this.handleUndo(event), "aria-label": this.terms['utility.undo'] ?? 'Undo' }, h("kritzel-icon", { key: '6d7db899d6dc205d5b8dbf9404d916676e8bb345', name: "undo" })), h("button", { key: '290a4d9e67130b24068c0c9a958b5532492b1c03', class: "utility-button", "data-testid": "utility-redo", disabled: !this.undoState?.canRedo, onClick: event => this.handleRedo(event), "aria-label": this.terms['utility.redo'] ?? 'Redo' }, h("kritzel-icon", { key: 'c88c575084ffe6df27d58d2f17e4b50253143158', name: "redo" })), h("div", { key: '195d4a77c76097c0e5fbe56266a3ad7ce246115f', class: "utility-separator" }), h("button", { key: 'c55b7a8f8e355d8ce046784a2e465ab96d5df5b7', class: "utility-button", "data-testid": "utility-delete", onClick: () => this.delete.emit(), "aria-label": this.terms['utility.delete'] ?? 'Delete selected items' }, h("kritzel-icon", { key: 'b429e334f6117c6a9c7de642e5290fb848576cd4', name: "delete" }))));
|
|
37
|
+
}
|
|
38
|
+
static get style() { return kritzelUtilityPanelCss(); }
|
|
39
|
+
}, [513, "kritzel-utility-panel", {
|
|
40
|
+
"undoState": [16],
|
|
41
|
+
"terms": [16]
|
|
42
|
+
}]);
|
|
43
|
+
function defineCustomElement() {
|
|
44
|
+
if (typeof customElements === "undefined") {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const components = ["kritzel-utility-panel", "kritzel-icon"];
|
|
48
|
+
components.forEach(tagName => { switch (tagName) {
|
|
49
|
+
case "kritzel-utility-panel":
|
|
50
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
51
|
+
customElements.define(transformTag(tagName), KritzelUtilityPanel);
|
|
52
|
+
}
|
|
53
|
+
break;
|
|
54
|
+
case "kritzel-icon":
|
|
55
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
56
|
+
defineCustomElement$1();
|
|
57
|
+
}
|
|
58
|
+
break;
|
|
59
|
+
} });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { KritzelUtilityPanel as K, defineCustomElement as d };
|