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,85 @@
|
|
|
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$3 } from './p-D5jf8wAu.js';
|
|
3
|
+
import { d as defineCustomElement$2 } from './p-DEBwmRTC.js';
|
|
4
|
+
import { d as defineCustomElement$1 } from './p-DX2nriaq.js';
|
|
5
|
+
|
|
6
|
+
const kritzelCurrentUserDialogCss = () => `:host{display:contents}kritzel-dialog{--kritzel-dialog-width-small:380px}.user-info{display:flex;flex-direction:column;align-items:center;gap:8px;padding:8px 0}.user-name{font-size:18px;font-weight:600;color:var(--kritzel-current-user-dialog-name-color, #333333);text-align:center;margin-top:8px}.user-email{font-size:14px;color:var(--kritzel-current-user-dialog-email-color, #666666);text-align:center}.logout-button{margin-top:16px;width:100%;--kritzel-button-width:100%;--kritzel-button-primary-background-color:var(--kritzel-current-user-dialog-logout-button-background-color, #007AFF);--kritzel-button-primary-hover-background-color:var(--kritzel-current-user-dialog-logout-button-hover-background-color, #006ae6);--kritzel-button-primary-active-background-color:var(--kritzel-current-user-dialog-logout-button-active-background-color, #005bbf);--kritzel-button-primary-color:var(--kritzel-current-user-dialog-logout-button-color, #ffffff)}`;
|
|
7
|
+
|
|
8
|
+
const KritzelCurrentUserDialog = /*@__PURE__*/ proxyCustomElement(class KritzelCurrentUserDialog extends H {
|
|
9
|
+
constructor(registerHost) {
|
|
10
|
+
super();
|
|
11
|
+
if (registerHost !== false) {
|
|
12
|
+
this.__registerHost();
|
|
13
|
+
}
|
|
14
|
+
this.__attachShadow();
|
|
15
|
+
this.logoutRequest = createEvent(this, "logoutRequest");
|
|
16
|
+
}
|
|
17
|
+
get host() { return this; }
|
|
18
|
+
user;
|
|
19
|
+
/** Resolved localized strings keyed by term key, supplied by the editor. */
|
|
20
|
+
terms = {};
|
|
21
|
+
isDialogOpen = false;
|
|
22
|
+
/** Emitted when the user clicks the logout action. */
|
|
23
|
+
logoutRequest;
|
|
24
|
+
async open() {
|
|
25
|
+
this.isDialogOpen = true;
|
|
26
|
+
}
|
|
27
|
+
async close() {
|
|
28
|
+
this.isDialogOpen = false;
|
|
29
|
+
}
|
|
30
|
+
closeDialog = () => {
|
|
31
|
+
this.isDialogOpen = false;
|
|
32
|
+
};
|
|
33
|
+
handleLogout = () => {
|
|
34
|
+
this.logoutRequest.emit();
|
|
35
|
+
this.closeDialog();
|
|
36
|
+
};
|
|
37
|
+
getDisplayName() {
|
|
38
|
+
if (!this.user)
|
|
39
|
+
return undefined;
|
|
40
|
+
return (this.user.displayName ??
|
|
41
|
+
([this.user.firstName, this.user.lastName].filter(Boolean).join(' ') ||
|
|
42
|
+
undefined));
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
const displayName = this.getDisplayName();
|
|
46
|
+
return (h(Host, { key: '46fa9107dd133e2896a80bf337874b69943156c6' }, h("kritzel-dialog", { key: '9270ec727f41b73fb37eaec2ee601689d3c26292', dialogTitle: this.terms['currentUser.dialogTitle'] ?? 'Account', isOpen: this.isDialogOpen, onDialogClose: this.closeDialog, size: "small", contained: true }, h("div", { key: '3c877db40a63bef3624f252ab39842cbc0b9bdc8', class: "user-info" }, h("kritzel-avatar", { key: '821130a92f385de1fa4e796b99830c4c3b317c15', user: this.user, size: 80 }), displayName && h("div", { key: 'e9c44284d50c97aed00523541360dbbaf6e37566', class: "user-name" }, displayName), this.user?.email && h("div", { key: '46f24e37629e6bd1c1dd5c52cfd7281c1d2e2308', class: "user-email" }, this.user.email), h("kritzel-button", { key: '929483c1bb270eb8dcf8e9d9e0d087b8476cd23f', class: "logout-button", variant: "primary", onButtonClick: this.handleLogout }, this.terms['menu.logout'] ?? 'Logout')))));
|
|
47
|
+
}
|
|
48
|
+
static get style() { return kritzelCurrentUserDialogCss(); }
|
|
49
|
+
}, [513, "kritzel-current-user-dialog", {
|
|
50
|
+
"user": [16],
|
|
51
|
+
"terms": [16],
|
|
52
|
+
"isDialogOpen": [32],
|
|
53
|
+
"open": [64],
|
|
54
|
+
"close": [64]
|
|
55
|
+
}]);
|
|
56
|
+
function defineCustomElement() {
|
|
57
|
+
if (typeof customElements === "undefined") {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const components = ["kritzel-current-user-dialog", "kritzel-avatar", "kritzel-button", "kritzel-dialog"];
|
|
61
|
+
components.forEach(tagName => { switch (tagName) {
|
|
62
|
+
case "kritzel-current-user-dialog":
|
|
63
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
64
|
+
customElements.define(transformTag(tagName), KritzelCurrentUserDialog);
|
|
65
|
+
}
|
|
66
|
+
break;
|
|
67
|
+
case "kritzel-avatar":
|
|
68
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
69
|
+
defineCustomElement$3();
|
|
70
|
+
}
|
|
71
|
+
break;
|
|
72
|
+
case "kritzel-button":
|
|
73
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
74
|
+
defineCustomElement$2();
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
case "kritzel-dialog":
|
|
78
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
79
|
+
defineCustomElement$1();
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
} });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { KritzelCurrentUserDialog as K, defineCustomElement as d };
|
|
@@ -1 +1,142 @@
|
|
|
1
|
-
import{p as
|
|
1
|
+
import { p as proxyCustomElement, H, h, d as Host, t as transformTag } from './p-B43upypT.js';
|
|
2
|
+
|
|
3
|
+
const kritzelAvatarCss = () => `:host{display:inline-flex;justify-content:center;align-items:center;border-radius:50%;overflow:hidden;user-select:none;flex-shrink:0}.avatar-image{display:block;width:100%;height:100%;object-fit:cover;border-radius:50%}.avatar-initials{display:flex;justify-content:center;align-items:center;width:100%;height:100%;border-radius:50%;color:var(--kritzel-avatar-initials-color, #ffffff);font-weight:var(--kritzel-avatar-initials-font-weight, 500);font-family:var(--kritzel-avatar-initials-font-family, sans-serif);line-height:1}.avatar-default{display:flex;justify-content:center;align-items:center;width:100%;height:100%;border-radius:50%;background-color:var(--kritzel-avatar-default-background, #e0e0e0);color:var(--kritzel-avatar-default-color, #9e9e9e)}.avatar-default svg{width:60%;height:60%}:host(.has-image){border:var(--kritzel-avatar-border, none)}:host(.has-initials){border:var(--kritzel-avatar-border, none)}:host(.has-default){border:var(--kritzel-avatar-border, none)}`;
|
|
4
|
+
|
|
5
|
+
const KritzelAvatar = /*@__PURE__*/ proxyCustomElement(class KritzelAvatar extends H {
|
|
6
|
+
constructor(registerHost) {
|
|
7
|
+
super();
|
|
8
|
+
if (registerHost !== false) {
|
|
9
|
+
this.__registerHost();
|
|
10
|
+
}
|
|
11
|
+
this.__attachShadow();
|
|
12
|
+
}
|
|
13
|
+
/** Full user object. If provided, individual props are ignored. */
|
|
14
|
+
user;
|
|
15
|
+
/** Direct prop: user's display name (used for initials fallback) */
|
|
16
|
+
name;
|
|
17
|
+
/** Avatar diameter in pixels */
|
|
18
|
+
size = 32;
|
|
19
|
+
/** Background color for initials fallback */
|
|
20
|
+
color;
|
|
21
|
+
/** Tracks whether the image failed to load */
|
|
22
|
+
imageError = false;
|
|
23
|
+
retryCount = 0;
|
|
24
|
+
maxRetries = 3;
|
|
25
|
+
retryTimer;
|
|
26
|
+
userChanged() {
|
|
27
|
+
this.resetImageState();
|
|
28
|
+
}
|
|
29
|
+
profileImageUrlChanged() {
|
|
30
|
+
this.resetImageState();
|
|
31
|
+
}
|
|
32
|
+
resetImageState() {
|
|
33
|
+
this.imageError = false;
|
|
34
|
+
this.retryCount = 0;
|
|
35
|
+
clearTimeout(this.retryTimer);
|
|
36
|
+
}
|
|
37
|
+
disconnectedCallback() {
|
|
38
|
+
clearTimeout(this.retryTimer);
|
|
39
|
+
}
|
|
40
|
+
getImageUrl() {
|
|
41
|
+
return this.user?.profileImageUrl;
|
|
42
|
+
}
|
|
43
|
+
getDisplayName() {
|
|
44
|
+
if (this.user) {
|
|
45
|
+
return (this.user.displayName ??
|
|
46
|
+
([this.user.firstName, this.user.lastName].filter(Boolean).join(' ') ||
|
|
47
|
+
this.user.email));
|
|
48
|
+
}
|
|
49
|
+
return this.name;
|
|
50
|
+
}
|
|
51
|
+
getInitials() {
|
|
52
|
+
const displayName = this.getDisplayName();
|
|
53
|
+
if (!displayName)
|
|
54
|
+
return undefined;
|
|
55
|
+
const parts = displayName.trim().split(/\s+/);
|
|
56
|
+
if (parts.length >= 2) {
|
|
57
|
+
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
|
|
58
|
+
}
|
|
59
|
+
return parts[0][0]?.toUpperCase();
|
|
60
|
+
}
|
|
61
|
+
getBackgroundColor() {
|
|
62
|
+
return this.user?.color ?? this.color ?? this.generateColorFromName();
|
|
63
|
+
}
|
|
64
|
+
generateColorFromName() {
|
|
65
|
+
const name = this.getDisplayName() || '';
|
|
66
|
+
let hash = 0;
|
|
67
|
+
for (let i = 0; i < name.length; i++) {
|
|
68
|
+
hash = name.charCodeAt(i) + ((hash << 5) - hash);
|
|
69
|
+
}
|
|
70
|
+
const hue = Math.abs(hash % 360);
|
|
71
|
+
return `hsl(${hue}, 45%, 55%)`;
|
|
72
|
+
}
|
|
73
|
+
handleImageError = () => {
|
|
74
|
+
if (this.retryCount < this.maxRetries) {
|
|
75
|
+
this.retryCount++;
|
|
76
|
+
const delay = 1000 * Math.pow(2, this.retryCount - 1);
|
|
77
|
+
this.retryTimer = setTimeout(() => {
|
|
78
|
+
this.imageError = false;
|
|
79
|
+
}, delay);
|
|
80
|
+
}
|
|
81
|
+
this.imageError = true;
|
|
82
|
+
};
|
|
83
|
+
render() {
|
|
84
|
+
const imageUrl = this.getImageUrl();
|
|
85
|
+
const initials = this.getInitials();
|
|
86
|
+
const showImage = imageUrl && !this.imageError;
|
|
87
|
+
const showInitials = !showImage && initials;
|
|
88
|
+
const showDefaultIcon = !showImage && !showInitials;
|
|
89
|
+
const containerStyles = {
|
|
90
|
+
width: `${this.size}px`,
|
|
91
|
+
height: `${this.size}px`,
|
|
92
|
+
fontSize: `${Math.round(this.size * 0.4)}px`,
|
|
93
|
+
};
|
|
94
|
+
return (h(Host, { key: 'a25cae3d0597e53606a00855e3175c89ff90d58e', style: containerStyles, class: {
|
|
95
|
+
'has-image': !!showImage,
|
|
96
|
+
'has-initials': !!showInitials,
|
|
97
|
+
'has-default': !!showDefaultIcon,
|
|
98
|
+
}, role: "img", "aria-label": this.getDisplayName() || 'User avatar' }, showImage && (h("img", { key: 'c3288f0ba9e0d8876403244fe3942dd91e685a79', src: imageUrl, alt: "", class: "avatar-image", ref: (el) => {
|
|
99
|
+
if (el) {
|
|
100
|
+
el.referrerPolicy = 'no-referrer';
|
|
101
|
+
el.crossOrigin = 'anonymous';
|
|
102
|
+
}
|
|
103
|
+
}, onError: this.handleImageError })), showInitials && (h("span", { key: 'ae0ca459b87e90a1f67abe747b75d8dd61247ead', class: "avatar-initials", style: { backgroundColor: this.getBackgroundColor() } }, initials)), showDefaultIcon && (h("span", { key: '2a60a0347ae21732828920339f53803330c9c6c6', class: "avatar-default" }, h("svg", { key: 'ee057dc02ae61206164775b35ad1408fe04dfed9', viewBox: "0 0 24 24", fill: "currentColor" }, h("path", { key: '2190046ba2e2c659d47f8a7f4a12bb10ae626f07', d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" }))))));
|
|
104
|
+
}
|
|
105
|
+
static get watchers() { return {
|
|
106
|
+
"user": [{
|
|
107
|
+
"userChanged": 0
|
|
108
|
+
}],
|
|
109
|
+
"profileImageUrl": [{
|
|
110
|
+
"profileImageUrlChanged": 0
|
|
111
|
+
}]
|
|
112
|
+
}; }
|
|
113
|
+
static get style() { return kritzelAvatarCss(); }
|
|
114
|
+
}, [513, "kritzel-avatar", {
|
|
115
|
+
"user": [16],
|
|
116
|
+
"name": [1],
|
|
117
|
+
"size": [2],
|
|
118
|
+
"color": [1],
|
|
119
|
+
"imageError": [32]
|
|
120
|
+
}, undefined, {
|
|
121
|
+
"user": [{
|
|
122
|
+
"userChanged": 0
|
|
123
|
+
}],
|
|
124
|
+
"profileImageUrl": [{
|
|
125
|
+
"profileImageUrlChanged": 0
|
|
126
|
+
}]
|
|
127
|
+
}]);
|
|
128
|
+
function defineCustomElement() {
|
|
129
|
+
if (typeof customElements === "undefined") {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const components = ["kritzel-avatar"];
|
|
133
|
+
components.forEach(tagName => { switch (tagName) {
|
|
134
|
+
case "kritzel-avatar":
|
|
135
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
136
|
+
customElements.define(transformTag(tagName), KritzelAvatar);
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
139
|
+
} });
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export { KritzelAvatar as K, defineCustomElement as d };
|
|
@@ -1 +1,53 @@
|
|
|
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-CqLgB8JK.js';
|
|
3
|
+
|
|
4
|
+
const kritzelStrokeSizeCss = () => `:host{display:flex;align-items:flex-start;gap:0;padding:0;width:100%;box-sizing:border-box}.size-grid{width:100%;display:grid;grid-template-columns:repeat(auto-fill, 32px);gap:8px;justify-items:center}.size-container{display:flex;justify-content:center;align-items:center;width:32px;height:32px;border-radius:50%;cursor:var(--kritzel-global-pointer-cursor, pointer);border:2px solid transparent;box-sizing:border-box}.size-container:hover{background-color:var(--kritzel-stroke-size-hover-background-color, #ebebeb)}.size-container.selected{border-color:var(--kritzel-selection-border-color, #007AFF);background-color:var(--kritzel-stroke-size-selected-background-color, #ebebeb)}`;
|
|
5
|
+
|
|
6
|
+
const KritzelStrokeSize = /*@__PURE__*/ proxyCustomElement(class KritzelStrokeSize extends H {
|
|
7
|
+
constructor(registerHost) {
|
|
8
|
+
super();
|
|
9
|
+
if (registerHost !== false) {
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
}
|
|
12
|
+
this.__attachShadow();
|
|
13
|
+
this.sizeChange = createEvent(this, "sizeChange");
|
|
14
|
+
}
|
|
15
|
+
sizes = [4, 6, 8, 12, 16, 24];
|
|
16
|
+
selectedSize = null;
|
|
17
|
+
sizeChange;
|
|
18
|
+
handleSizeClick(size) {
|
|
19
|
+
this.selectedSize = size;
|
|
20
|
+
this.sizeChange.emit(size);
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
const sizes = this.sizes ?? [];
|
|
24
|
+
return (h(Host, { key: 'a097daf527501b07874b449ac75ecb765cdd81b2' }, h("div", { key: '0e2b3ade9bae7d4f97d5de8ecd44424fe914f3e7', class: "size-grid" }, sizes.map(size => (h("div", { tabIndex: 0, class: {
|
|
25
|
+
'size-container': true,
|
|
26
|
+
'selected': this.selectedSize === size,
|
|
27
|
+
}, onClick: () => this.handleSizeClick(size) }, h("kritzel-color", { value: 'var(--kritzel-global-text-primary)', size: size })))))));
|
|
28
|
+
}
|
|
29
|
+
static get style() { return kritzelStrokeSizeCss(); }
|
|
30
|
+
}, [513, "kritzel-stroke-size", {
|
|
31
|
+
"sizes": [16],
|
|
32
|
+
"selectedSize": [1026, "selected-size"]
|
|
33
|
+
}]);
|
|
34
|
+
function defineCustomElement() {
|
|
35
|
+
if (typeof customElements === "undefined") {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const components = ["kritzel-stroke-size", "kritzel-color"];
|
|
39
|
+
components.forEach(tagName => { switch (tagName) {
|
|
40
|
+
case "kritzel-stroke-size":
|
|
41
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
42
|
+
customElements.define(transformTag(tagName), KritzelStrokeSize);
|
|
43
|
+
}
|
|
44
|
+
break;
|
|
45
|
+
case "kritzel-color":
|
|
46
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
47
|
+
defineCustomElement$1();
|
|
48
|
+
}
|
|
49
|
+
break;
|
|
50
|
+
} });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { KritzelStrokeSize as K, defineCustomElement as d };
|
|
@@ -1 +1,101 @@
|
|
|
1
|
-
|
|
1
|
+
/** Current version of the workspace export format */
|
|
2
|
+
const WORKSPACE_EXPORT_VERSION = '1.3.0';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a workspace in the Kritzel canvas.
|
|
5
|
+
* A workspace is an isolated canvas area with its own set of objects and viewport state.
|
|
6
|
+
* It can be serialized and deserialized for persistence and collaborative editing.
|
|
7
|
+
*/
|
|
8
|
+
class KritzelWorkspace {
|
|
9
|
+
__class__ = 'KritzelWorkspace';
|
|
10
|
+
/** Unique identifier for the workspace */
|
|
11
|
+
id;
|
|
12
|
+
/** Display name of the workspace */
|
|
13
|
+
name;
|
|
14
|
+
/** Timestamp when the workspace was created */
|
|
15
|
+
createdAt;
|
|
16
|
+
/** Timestamp when the workspace was last updated */
|
|
17
|
+
updatedAt;
|
|
18
|
+
/** Viewport state containing the world-space center point and zoom level */
|
|
19
|
+
viewport;
|
|
20
|
+
/** Whether the workspace is publicly accessible via a share link */
|
|
21
|
+
isPublic;
|
|
22
|
+
/** Reference to the KritzelCore instance managing this workspace */
|
|
23
|
+
_core;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new KritzelWorkspace instance.
|
|
26
|
+
* @param id - Unique identifier for the workspace
|
|
27
|
+
* @param name - Display name of the workspace
|
|
28
|
+
* @param viewport - Initial viewport state with centerWorldX, centerWorldY, and scale values
|
|
29
|
+
*/
|
|
30
|
+
constructor(id, name, viewport = { centerWorldX: 0, centerWorldY: 0, scale: 1 }) {
|
|
31
|
+
this.id = id;
|
|
32
|
+
this.name = name;
|
|
33
|
+
this.createdAt = new Date();
|
|
34
|
+
this.updatedAt = new Date();
|
|
35
|
+
this.viewport = viewport;
|
|
36
|
+
this.isPublic = false;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Factory method to create a workspace with a core reference.
|
|
40
|
+
* @param core - The KritzelCore instance to associate with this workspace
|
|
41
|
+
* @param obj - Object containing workspace properties (id, name, viewport)
|
|
42
|
+
* @returns A new KritzelWorkspace instance with the core reference set
|
|
43
|
+
*/
|
|
44
|
+
static create(core, obj) {
|
|
45
|
+
const workspace = new KritzelWorkspace(obj.id, obj.name, obj.viewport);
|
|
46
|
+
workspace._core = core;
|
|
47
|
+
return workspace;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Adds an object to this workspace via the core engine.
|
|
51
|
+
* @param obj - The object to add to the workspace
|
|
52
|
+
*/
|
|
53
|
+
addObject(obj) {
|
|
54
|
+
this._core.engine.addObject(obj);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Serializes the workspace to a plain object for storage or transmission.
|
|
58
|
+
* Converts dates to ISO strings and includes the class identifier.
|
|
59
|
+
* @param options - Optional settings for serialization
|
|
60
|
+
* @param options.includeObjects - If true, includes all canvas objects in the serialized output
|
|
61
|
+
* @returns A plain object representation of the workspace
|
|
62
|
+
*/
|
|
63
|
+
serialize(options) {
|
|
64
|
+
const serialized = {
|
|
65
|
+
__class__: this.__class__,
|
|
66
|
+
version: WORKSPACE_EXPORT_VERSION,
|
|
67
|
+
id: this.id,
|
|
68
|
+
name: this.name,
|
|
69
|
+
createdAt: this.createdAt.toISOString(),
|
|
70
|
+
updatedAt: this.updatedAt.toISOString(),
|
|
71
|
+
viewport: this.viewport,
|
|
72
|
+
isPublic: this.isPublic,
|
|
73
|
+
};
|
|
74
|
+
if (options?.includeObjects && this._core) {
|
|
75
|
+
const allObjects = this._core.store.allNonSelectionObjects;
|
|
76
|
+
serialized.objects = allObjects.map(obj => obj.serialize());
|
|
77
|
+
}
|
|
78
|
+
return serialized;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Creates a shallow clone of this workspace, preserving the prototype chain.
|
|
82
|
+
* Useful when Stencil needs a new object reference to detect property changes.
|
|
83
|
+
*/
|
|
84
|
+
clone() {
|
|
85
|
+
return Object.assign(Object.create(Object.getPrototypeOf(this)), this);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Deserializes a plain object into this workspace instance.
|
|
89
|
+
* Converts ISO string dates back to Date objects.
|
|
90
|
+
* @param object - The plain object to deserialize from
|
|
91
|
+
* @returns This workspace instance with updated properties
|
|
92
|
+
*/
|
|
93
|
+
deserialize(object) {
|
|
94
|
+
Object.assign(this, object);
|
|
95
|
+
this.createdAt = new Date(object.createdAt);
|
|
96
|
+
this.updatedAt = new Date(object.updatedAt);
|
|
97
|
+
return this;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export { KritzelWorkspace as K, WORKSPACE_EXPORT_VERSION as W };
|
|
@@ -1 +1,55 @@
|
|
|
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
|
+
|
|
3
|
+
const kritzelButtonCss = () => `:host{display:inline-block;font-family:sans-serif}button{border:none;background-color:transparent;padding:0;margin:0;font-family:inherit;font-size:inherit;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:var(--kritzel-global-pointer-cursor, pointer);display:inline-flex;width:var(--kritzel-button-width, auto);align-items:center;justify-content:center;gap:6px;border-radius:var(--kritzel-button-border-radius, 8px);padding:var(--kritzel-button-padding, 12px 20px);font-size:var(--kritzel-button-font-size, 14px);font-weight:var(--kritzel-button-font-weight, 500);transition:background-color 0.15s ease, opacity 0.15s ease;-webkit-tap-highlight-color:transparent}button.primary{background-color:var(--kritzel-button-primary-background-color, #007AFF);color:var(--kritzel-button-primary-color, #ffffff)}button.primary:hover{background-color:var(--kritzel-button-primary-hover-background-color, #006ae6)}button.primary:active{background-color:var(--kritzel-button-primary-active-background-color, #005bbf)}button.secondary{background-color:var(--kritzel-button-secondary-background-color, #f0f0f0);color:var(--kritzel-button-secondary-color, #333333)}button.secondary:hover{background-color:var(--kritzel-button-secondary-hover-background-color, #e0e0e0)}button.secondary:active{background-color:var(--kritzel-button-secondary-active-background-color, #d0d0d0)}button.text{background-color:transparent;color:var(--kritzel-button-text-color, #007AFF)}button.text:hover{background-color:var(--kritzel-button-text-hover-background-color, rgba(0, 122, 255, 0.08))}button.text:active{background-color:var(--kritzel-button-text-active-background-color, rgba(0, 122, 255, 0.15))}button.disabled{opacity:0.4;cursor:not-allowed;pointer-events:none}`;
|
|
4
|
+
|
|
5
|
+
const KritzelButton = /*@__PURE__*/ proxyCustomElement(class KritzelButton extends H {
|
|
6
|
+
constructor(registerHost) {
|
|
7
|
+
super();
|
|
8
|
+
if (registerHost !== false) {
|
|
9
|
+
this.__registerHost();
|
|
10
|
+
}
|
|
11
|
+
this.__attachShadow();
|
|
12
|
+
this.buttonClick = createEvent(this, "buttonClick");
|
|
13
|
+
}
|
|
14
|
+
/** The visual variant of the button */
|
|
15
|
+
variant = 'primary';
|
|
16
|
+
/** Whether the button is disabled */
|
|
17
|
+
disabled = false;
|
|
18
|
+
/** The type attribute for the native button element */
|
|
19
|
+
type = 'button';
|
|
20
|
+
/** Emitted when the button is clicked */
|
|
21
|
+
buttonClick;
|
|
22
|
+
handleClick = (event) => {
|
|
23
|
+
if (this.disabled)
|
|
24
|
+
return;
|
|
25
|
+
event.stopPropagation();
|
|
26
|
+
this.buttonClick.emit();
|
|
27
|
+
};
|
|
28
|
+
render() {
|
|
29
|
+
return (h(Host, { key: 'ee7da1d8d86cdd6f920d15642203265cc93cda4e' }, h("button", { key: '15b1f11be5157c70ef5a4b3cd917bacb8f90ee4a', type: this.type, class: {
|
|
30
|
+
'kritzel-button': true,
|
|
31
|
+
[this.variant]: true,
|
|
32
|
+
'disabled': this.disabled,
|
|
33
|
+
}, disabled: this.disabled, onClick: this.handleClick }, h("slot", { key: '8500172bd4540f4fa9c5e629d1ceb1816dcf556a' }))));
|
|
34
|
+
}
|
|
35
|
+
static get style() { return kritzelButtonCss(); }
|
|
36
|
+
}, [769, "kritzel-button", {
|
|
37
|
+
"variant": [1],
|
|
38
|
+
"disabled": [4],
|
|
39
|
+
"type": [1]
|
|
40
|
+
}]);
|
|
41
|
+
function defineCustomElement() {
|
|
42
|
+
if (typeof customElements === "undefined") {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const components = ["kritzel-button"];
|
|
46
|
+
components.forEach(tagName => { switch (tagName) {
|
|
47
|
+
case "kritzel-button":
|
|
48
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
49
|
+
customElements.define(transformTag(tagName), KritzelButton);
|
|
50
|
+
}
|
|
51
|
+
break;
|
|
52
|
+
} });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { KritzelButton as K, defineCustomElement as d };
|
|
@@ -1 +1,52 @@
|
|
|
1
|
-
import{p as
|
|
1
|
+
import { p as proxyCustomElement, H, h, d as Host, t as transformTag } from './p-B43upypT.js';
|
|
2
|
+
import { d as defineCustomElement$1 } from './p-D5jf8wAu.js';
|
|
3
|
+
|
|
4
|
+
const kritzelCurrentUserCss = () => `:host{display:inline-flex;align-items:center;justify-content:center;-webkit-tap-highlight-color:transparent}kritzel-avatar{cursor:var(--kritzel-global-pointer-cursor, pointer);border-radius:50%}`;
|
|
5
|
+
|
|
6
|
+
const KritzelCurrentUser = /*@__PURE__*/ proxyCustomElement(class KritzelCurrentUser extends H {
|
|
7
|
+
constructor(registerHost) {
|
|
8
|
+
super();
|
|
9
|
+
if (registerHost !== false) {
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
}
|
|
12
|
+
this.__attachShadow();
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The current user to display
|
|
16
|
+
*/
|
|
17
|
+
user;
|
|
18
|
+
/**
|
|
19
|
+
* Avatar size in pixels
|
|
20
|
+
*/
|
|
21
|
+
avatarSize = 40;
|
|
22
|
+
/** Resolved localized strings keyed by term key, supplied by the editor. */
|
|
23
|
+
terms = {};
|
|
24
|
+
render() {
|
|
25
|
+
return (h(Host, { key: '606ff4d621467d24c30d06a2cf9191a883497f1b' }, h("kritzel-avatar", { key: 'a215f36bcfa55e2d649e79ef2e4ae4503ebb325d', user: this.user, size: this.avatarSize })));
|
|
26
|
+
}
|
|
27
|
+
static get style() { return kritzelCurrentUserCss(); }
|
|
28
|
+
}, [513, "kritzel-current-user", {
|
|
29
|
+
"user": [16],
|
|
30
|
+
"avatarSize": [2, "avatar-size"],
|
|
31
|
+
"terms": [16]
|
|
32
|
+
}]);
|
|
33
|
+
function defineCustomElement() {
|
|
34
|
+
if (typeof customElements === "undefined") {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const components = ["kritzel-current-user", "kritzel-avatar"];
|
|
38
|
+
components.forEach(tagName => { switch (tagName) {
|
|
39
|
+
case "kritzel-current-user":
|
|
40
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
41
|
+
customElements.define(transformTag(tagName), KritzelCurrentUser);
|
|
42
|
+
}
|
|
43
|
+
break;
|
|
44
|
+
case "kritzel-avatar":
|
|
45
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
46
|
+
defineCustomElement$1();
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
} });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { KritzelCurrentUser as K, defineCustomElement as d };
|
|
@@ -1 +1,70 @@
|
|
|
1
|
-
import{p as
|
|
1
|
+
import { p as proxyCustomElement, t as transformTag, H, h, d as Host } from './p-B43upypT.js';
|
|
2
|
+
import { d as defineCustomElement$1 } from './p-D5jf8wAu.js';
|
|
3
|
+
|
|
4
|
+
const kritzelActiveUsersCss = () => `:host{display:inline-flex;align-items:center}.avatars{display:flex;align-items:center}.avatar-wrapper{position:relative;transition:margin-left 200ms ease}.avatar-wrapper kritzel-avatar{border-radius:50%;box-shadow:0 0 0 2px var(--kritzel-active-users-avatar-border-color, #ffffff)}.avatars:hover .avatar-wrapper{margin-left:-6px !important}.avatar-tooltip{position:absolute;top:100%;left:50%;transform:translateX(-50%);margin-top:12px;padding:4px 8px;background-color:var(--kritzel-active-users-tooltip-background, #333333);color:var(--kritzel-active-users-tooltip-color, #ffffff);font-family:sans-serif;font-size:12px;font-weight:500;border-radius:4px;white-space:nowrap;width:max-content;pointer-events:none;opacity:0;transition:opacity 150ms ease}.avatar-wrapper:hover .avatar-tooltip,.overflow-count:hover .avatar-tooltip{opacity:1}.overflow-count{position:relative;margin-left:8px;font-family:sans-serif;font-size:var(--kritzel-active-users-overflow-font-size, 14px);font-weight:500;color:var(--kritzel-active-users-overflow-color, #666666);white-space:nowrap;cursor:default}.overflow-count .avatar-tooltip{white-space:nowrap;text-align:left;margin-top:20px}`;
|
|
5
|
+
|
|
6
|
+
const KritzelActiveUsers = /*@__PURE__*/ proxyCustomElement(class KritzelActiveUsers extends H {
|
|
7
|
+
constructor(registerHost) {
|
|
8
|
+
super();
|
|
9
|
+
if (registerHost !== false) {
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
}
|
|
12
|
+
this.__attachShadow();
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Array of active users to display
|
|
16
|
+
*/
|
|
17
|
+
users = [];
|
|
18
|
+
/**
|
|
19
|
+
* Avatar size in pixels
|
|
20
|
+
*/
|
|
21
|
+
avatarSize = 40;
|
|
22
|
+
/**
|
|
23
|
+
* Maximum number of avatars to show before overflow text
|
|
24
|
+
*/
|
|
25
|
+
maxVisible = 3;
|
|
26
|
+
/**
|
|
27
|
+
* Overlap offset in pixels (negative margin between avatars)
|
|
28
|
+
*/
|
|
29
|
+
overlap = 20;
|
|
30
|
+
getDisplayName(user) {
|
|
31
|
+
return (user.displayName ??
|
|
32
|
+
([user.firstName, user.lastName].filter(Boolean).join(' ') ||
|
|
33
|
+
user.email ||
|
|
34
|
+
'User'));
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
if (!this.users || this.users.length === 0) {
|
|
38
|
+
return h(Host, { style: { display: 'none' } });
|
|
39
|
+
}
|
|
40
|
+
const visibleUsers = this.users.slice(0, this.maxVisible);
|
|
41
|
+
const overflowCount = this.users.length - this.maxVisible;
|
|
42
|
+
return (h(Host, { style: { '--avatar-overlap': `-${this.overlap}px` } }, h("div", { class: "avatars" }, visibleUsers.map((user, index) => (h("div", { class: "avatar-wrapper", style: { marginLeft: index > 0 ? `var(--avatar-overlap)` : '0px', zIndex: `${visibleUsers.length - index}` } }, h("kritzel-avatar", { user: user, size: this.avatarSize }), h("span", { class: "avatar-tooltip" }, this.getDisplayName(user)))))), overflowCount > 0 && (h("span", { class: "overflow-count" }, "+", overflowCount, h("span", { class: "avatar-tooltip" }, this.users.slice(this.maxVisible).map(user => (h("div", null, this.getDisplayName(user)))))))));
|
|
43
|
+
}
|
|
44
|
+
static get style() { return kritzelActiveUsersCss(); }
|
|
45
|
+
}, [513, "kritzel-active-users", {
|
|
46
|
+
"users": [16],
|
|
47
|
+
"avatarSize": [2, "avatar-size"],
|
|
48
|
+
"maxVisible": [2, "max-visible"],
|
|
49
|
+
"overlap": [2]
|
|
50
|
+
}]);
|
|
51
|
+
function defineCustomElement() {
|
|
52
|
+
if (typeof customElements === "undefined") {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const components = ["kritzel-active-users", "kritzel-avatar"];
|
|
56
|
+
components.forEach(tagName => { switch (tagName) {
|
|
57
|
+
case "kritzel-active-users":
|
|
58
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
59
|
+
customElements.define(transformTag(tagName), KritzelActiveUsers);
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
case "kritzel-avatar":
|
|
63
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
64
|
+
defineCustomElement$1();
|
|
65
|
+
}
|
|
66
|
+
break;
|
|
67
|
+
} });
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { KritzelActiveUsers as K, defineCustomElement as d };
|