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.
Files changed (128) hide show
  1. package/dist/cjs/kritzel-active-users_47.cjs.entry.js +79 -13
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/stencil.cjs.js +1 -1
  4. package/dist/collection/classes/core/viewport.class.js +14 -1
  5. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +48 -8
  6. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +84 -3
  7. package/dist/collection/constants/version.js +1 -1
  8. package/dist/components/index.js +1226 -1
  9. package/dist/components/kritzel-active-users.js +6 -1
  10. package/dist/components/kritzel-avatar.js +6 -1
  11. package/dist/components/kritzel-awareness-cursors.js +6 -1
  12. package/dist/components/kritzel-back-to-content.js +6 -1
  13. package/dist/components/kritzel-brush-style.js +64 -1
  14. package/dist/components/kritzel-button.js +6 -1
  15. package/dist/components/kritzel-color-palette.js +6 -1
  16. package/dist/components/kritzel-color.js +6 -1
  17. package/dist/components/kritzel-context-menu.js +6 -1
  18. package/dist/components/kritzel-controls.js +6 -1
  19. package/dist/components/kritzel-current-user-dialog.js +6 -1
  20. package/dist/components/kritzel-current-user.js +6 -1
  21. package/dist/components/kritzel-cursor-trail.js +6 -1
  22. package/dist/components/kritzel-dialog.js +6 -1
  23. package/dist/components/kritzel-dropdown.js +6 -1
  24. package/dist/components/kritzel-editor.js +4404 -1
  25. package/dist/components/kritzel-engine.js +6 -1
  26. package/dist/components/kritzel-export.js +6 -1
  27. package/dist/components/kritzel-font-family.js +6 -1
  28. package/dist/components/kritzel-font-size.js +6 -1
  29. package/dist/components/kritzel-font.js +6 -1
  30. package/dist/components/kritzel-icon.js +6 -1
  31. package/dist/components/kritzel-input.js +6 -1
  32. package/dist/components/kritzel-line-endings.js +6 -1
  33. package/dist/components/kritzel-loading-overlay.js +6 -1
  34. package/dist/components/kritzel-login-dialog.js +6 -1
  35. package/dist/components/kritzel-master-detail.js +6 -1
  36. package/dist/components/kritzel-menu-item.js +6 -1
  37. package/dist/components/kritzel-menu.js +6 -1
  38. package/dist/components/kritzel-more-menu.js +6 -1
  39. package/dist/components/kritzel-notification-card.js +6 -1
  40. package/dist/components/kritzel-numeric-input.js +6 -1
  41. package/dist/components/kritzel-opacity-slider.js +6 -1
  42. package/dist/components/kritzel-pill-tabs.js +6 -1
  43. package/dist/components/kritzel-portal.js +6 -1
  44. package/dist/components/kritzel-settings.js +6 -1
  45. package/dist/components/kritzel-shape-fill.js +6 -1
  46. package/dist/components/kritzel-share-dialog.js +6 -1
  47. package/dist/components/kritzel-slide-toggle.js +6 -1
  48. package/dist/components/kritzel-split-button.js +6 -1
  49. package/dist/components/kritzel-stroke-size.js +6 -1
  50. package/dist/components/kritzel-sync-indicator.js +6 -1
  51. package/dist/components/kritzel-tool-config.js +6 -1
  52. package/dist/components/kritzel-tooltip.js +6 -1
  53. package/dist/components/kritzel-utility-panel.js +6 -1
  54. package/dist/components/kritzel-watermark.js +6 -1
  55. package/dist/components/kritzel-workspace-manager.js +6 -1
  56. package/dist/components/kritzel-zoom-panel.js +6 -1
  57. package/dist/components/p-894OnDQV.js +39 -1
  58. package/dist/components/p-B43upypT.js +1500 -1
  59. package/dist/components/p-B5oHmPJb.js +97 -1
  60. package/dist/components/p-B6t5q-V4.js +63 -1
  61. package/dist/components/p-B8Xi4Clg.js +43 -1
  62. package/dist/components/p-BBmP8lVY.js +51726 -0
  63. package/dist/components/p-BDzlx2hB.js +135 -1
  64. package/dist/components/p-BFTU3MAI.js +7 -1
  65. package/dist/components/p-BFYtCsZu.js +56 -1
  66. package/dist/components/p-BI2ng9I_.js +62 -1
  67. package/dist/components/p-BTzlrIxe.js +194 -1
  68. package/dist/components/p-BmyTdQGy.js +1090 -1
  69. package/dist/components/p-BsANVili.js +150 -1
  70. package/dist/components/p-BxpKq94F.js +290 -1
  71. package/dist/components/p-C38P-Vd0.js +446 -1
  72. package/dist/components/p-C4NrrUfN.js +77 -1
  73. package/dist/components/p-CW-VyJgK.js +6 -1
  74. package/dist/components/p-CWRSGYOE.js +57 -1
  75. package/dist/components/p-CXpv9Rxe.js +106 -1
  76. package/dist/components/p-Ca-igU1f.js +320 -1
  77. package/dist/components/p-CdR76C4L.js +165 -1
  78. package/dist/components/p-Ch42cOeY.js +320 -0
  79. package/dist/components/p-ClFprFvz.js +209 -1
  80. package/dist/components/p-Cm33td2O.js +122 -1
  81. package/dist/components/p-CqLgB8JK.js +91 -1
  82. package/dist/components/p-Cr682JI_.js +156 -1
  83. package/dist/components/p-CsvMgk_f.js +62 -1
  84. package/dist/components/p-CwJwsRR3.js +277 -1
  85. package/dist/components/p-Cymum41a.js +88 -1
  86. package/dist/components/p-D09kgc5Q.js +94 -1
  87. package/dist/components/p-D30zs0kA.js +121 -1
  88. package/dist/components/p-D3y_Hauo.js +85 -1
  89. package/dist/components/p-D5jf8wAu.js +142 -1
  90. package/dist/components/p-D82VaHce.js +53 -1
  91. package/dist/components/p-DAwPPDMS.js +101 -1
  92. package/dist/components/p-DEBwmRTC.js +55 -1
  93. package/dist/components/p-DIazmg6w.js +52 -1
  94. package/dist/components/p-DJ88BrIW.js +70 -1
  95. package/dist/components/p-DJkKlUyZ.js +182 -1
  96. package/dist/components/p-DUYmwrWV.js +3267 -1
  97. package/dist/components/p-DX2nriaq.js +486 -1
  98. package/dist/components/p-Dd-pMvlr.js +20 -1
  99. package/dist/components/p-Df3BwVGy.js +299 -1
  100. package/dist/components/p-DgJ0ufzr.js +43 -1
  101. package/dist/components/p-DkUb2czk.js +70 -1
  102. package/dist/components/p-Dlp84thc.js +57 -1
  103. package/dist/components/p-JYj3Facr.js +431 -1
  104. package/dist/components/p-Ka7OWbnk.js +2304 -1
  105. package/dist/components/p-PSFAfAyd.js +49 -1
  106. package/dist/components/p-WUdQqYnu.js +118 -1
  107. package/dist/components/p-djJSnjAX.js +84 -1
  108. package/dist/components/p-e6Zpc9Vp.js +143 -1
  109. package/dist/components/p-jGOpkGDl.js +30 -1
  110. package/dist/components/p-pagW8YF7.js +99 -1
  111. package/dist/esm/kritzel-active-users_47.entry.js +79 -13
  112. package/dist/esm/loader.js +1 -1
  113. package/dist/esm/stencil.js +1 -1
  114. package/dist/stencil/index.esm.js +1172 -1
  115. package/dist/stencil/p-5b969a42.entry.js +36109 -0
  116. package/dist/stencil/p-DQuL1Twl.js +3 -1
  117. package/dist/stencil/p-Dhio9uis.js +1717 -2
  118. package/dist/stencil/p-fb32cd8f.entry.js +29 -1
  119. package/dist/stencil/p-uC7_X6yr.js +30737 -1
  120. package/dist/stencil/stencil.esm.js +21 -1
  121. package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +2 -0
  122. package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +7 -0
  123. package/dist/types/components.d.ts +10 -0
  124. package/dist/types/constants/version.d.ts +1 -1
  125. package/package.json +1 -1
  126. package/dist/components/p--Oazz-BP.js +0 -9
  127. package/dist/components/p-Xsiz1D5Q.js +0 -1
  128. package/dist/stencil/p-9abc21b9.entry.js +0 -9
@@ -1 +1,85 @@
1
- import{p as t,H as e,c as r,h as o,d as i,t as s}from"./p-B43upypT.js";import{d as a}from"./p-D5jf8wAu.js";import{d as l}from"./p-DEBwmRTC.js";import{d as c}from"./p-DX2nriaq.js";const n=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.logoutRequest=r(this,"logoutRequest")}get host(){return this}user;terms={};isDialogOpen=!1;logoutRequest;async open(){this.isDialogOpen=!0}async close(){this.isDialogOpen=!1}closeDialog=()=>{this.isDialogOpen=!1};handleLogout=()=>{this.logoutRequest.emit(),this.closeDialog()};getDisplayName(){if(this.user)return this.user.displayName??([this.user.firstName,this.user.lastName].filter(Boolean).join(" ")||void 0)}render(){const t=this.getDisplayName();return o(i,{key:"46fa9107dd133e2896a80bf337874b69943156c6"},o("kritzel-dialog",{key:"9270ec727f41b73fb37eaec2ee601689d3c26292",dialogTitle:this.terms["currentUser.dialogTitle"]??"Account",isOpen:this.isDialogOpen,onDialogClose:this.closeDialog,size:"small",contained:!0},o("div",{key:"3c877db40a63bef3624f252ab39842cbc0b9bdc8",class:"user-info"},o("kritzel-avatar",{key:"821130a92f385de1fa4e796b99830c4c3b317c15",user:this.user,size:80}),t&&o("div",{key:"e9c44284d50c97aed00523541360dbbaf6e37566",class:"user-name"},t),this.user?.email&&o("div",{key:"46f24e37629e6bd1c1dd5c52cfd7281c1d2e2308",class:"user-email"},this.user.email),o("kritzel-button",{key:"929483c1bb270eb8dcf8e9d9e0d087b8476cd23f",class:"logout-button",variant:"primary",onButtonClick:this.handleLogout},this.terms["menu.logout"]??"Logout"))))}static get style(){return":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)}"}},[513,"kritzel-current-user-dialog",{user:[16],terms:[16],isDialogOpen:[32],open:[64],close:[64]}]);function u(){"undefined"!=typeof customElements&&["kritzel-current-user-dialog","kritzel-avatar","kritzel-button","kritzel-dialog"].forEach((t=>{switch(t){case"kritzel-current-user-dialog":customElements.get(s(t))||customElements.define(s(t),n);break;case"kritzel-avatar":customElements.get(s(t))||a();break;case"kritzel-button":customElements.get(s(t))||l();break;case"kritzel-dialog":customElements.get(s(t))||c()}}))}export{n as K,u as d}
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 e,H as t,h as a,d as r,t as i}from"./p-B43upypT.js";const s=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow()}user;name;size=32;color;imageError=!1;retryCount=0;maxRetries=3;retryTimer;userChanged(){this.resetImageState()}profileImageUrlChanged(){this.resetImageState()}resetImageState(){this.imageError=!1,this.retryCount=0,clearTimeout(this.retryTimer)}disconnectedCallback(){clearTimeout(this.retryTimer)}getImageUrl(){return this.user?.profileImageUrl}getDisplayName(){return this.user?this.user.displayName??([this.user.firstName,this.user.lastName].filter(Boolean).join(" ")||this.user.email):this.name}getInitials(){const e=this.getDisplayName();if(!e)return;const t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():t[0][0]?.toUpperCase()}getBackgroundColor(){return this.user?.color??this.color??this.generateColorFromName()}generateColorFromName(){const e=this.getDisplayName()||"";let t=0;for(let a=0;a<e.length;a++)t=e.charCodeAt(a)+((t<<5)-t);return`hsl(${Math.abs(t%360)}, 45%, 55%)`}handleImageError=()=>{if(this.retryCount<this.maxRetries){this.retryCount++;const e=1e3*Math.pow(2,this.retryCount-1);this.retryTimer=setTimeout((()=>{this.imageError=!1}),e)}this.imageError=!0};render(){const e=this.getImageUrl(),t=this.getInitials(),i=e&&!this.imageError,s=!i&&t,o=!i&&!s,l={width:`${this.size}px`,height:`${this.size}px`,fontSize:`${Math.round(.4*this.size)}px`};return a(r,{key:"a25cae3d0597e53606a00855e3175c89ff90d58e",style:l,class:{"has-image":!!i,"has-initials":!!s,"has-default":!!o},role:"img","aria-label":this.getDisplayName()||"User avatar"},i&&a("img",{key:"c3288f0ba9e0d8876403244fe3942dd91e685a79",src:e,alt:"",class:"avatar-image",ref:e=>{e&&(e.referrerPolicy="no-referrer",e.crossOrigin="anonymous")},onError:this.handleImageError}),s&&a("span",{key:"ae0ca459b87e90a1f67abe747b75d8dd61247ead",class:"avatar-initials",style:{backgroundColor:this.getBackgroundColor()}},t),o&&a("span",{key:"2a60a0347ae21732828920339f53803330c9c6c6",class:"avatar-default"},a("svg",{key:"ee057dc02ae61206164775b35ad1408fe04dfed9",viewBox:"0 0 24 24",fill:"currentColor"},a("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"}))))}static get watchers(){return{user:[{userChanged:0}],profileImageUrl:[{profileImageUrlChanged:0}]}}static get style(){return":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)}"}},[513,"kritzel-avatar",{user:[16],name:[1],size:[2],color:[1],imageError:[32]},void 0,{user:[{userChanged:0}],profileImageUrl:[{profileImageUrlChanged:0}]}]);function o(){"undefined"!=typeof customElements&&["kritzel-avatar"].forEach((e=>{"kritzel-avatar"===e&&(customElements.get(i(e))||customElements.define(i(e),s))}))}export{s as K,o as d}
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 e,H as s,c as t,h as r,d as i,t as o}from"./p-B43upypT.js";import{d as l}from"./p-CqLgB8JK.js";const a=e(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.sizeChange=t(this,"sizeChange")}sizes=[4,6,8,12,16,24];selectedSize=null;sizeChange;handleSizeClick(e){this.selectedSize=e,this.sizeChange.emit(e)}render(){return r(i,{key:"a097daf527501b07874b449ac75ecb765cdd81b2"},r("div",{key:"0e2b3ade9bae7d4f97d5de8ecd44424fe914f3e7",class:"size-grid"},(this.sizes??[]).map((e=>r("div",{tabIndex:0,class:{"size-container":!0,selected:this.selectedSize===e},onClick:()=>this.handleSizeClick(e)},r("kritzel-color",{value:"var(--kritzel-global-text-primary)",size:e}))))))}static get style(){return":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)}"}},[513,"kritzel-stroke-size",{sizes:[16],selectedSize:[1026,"selected-size"]}]);function c(){"undefined"!=typeof customElements&&["kritzel-stroke-size","kritzel-color"].forEach((e=>{switch(e){case"kritzel-stroke-size":customElements.get(o(e))||customElements.define(o(e),a);break;case"kritzel-color":customElements.get(o(e))||l()}}))}export{a as K,c as d}
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
- const t="1.3.0";class e{__class__="KritzelWorkspace";id;name;createdAt;updatedAt;viewport;isPublic;_core;constructor(t,e,s={centerWorldX:0,centerWorldY:0,scale:1}){this.id=t,this.name=e,this.createdAt=new Date,this.updatedAt=new Date,this.viewport=s,this.isPublic=!1}static create(t,s){const i=new e(s.id,s.name,s.viewport);return i._core=t,i}addObject(t){this._core.engine.addObject(t)}serialize(e){const s={__class__:this.__class__,version:t,id:this.id,name:this.name,createdAt:this.createdAt.toISOString(),updatedAt:this.updatedAt.toISOString(),viewport:this.viewport,isPublic:this.isPublic};return e?.includeObjects&&this._core&&(s.objects=this._core.store.allNonSelectionObjects.map((t=>t.serialize()))),s}clone(){return Object.assign(Object.create(Object.getPrototypeOf(this)),this)}deserialize(t){return Object.assign(this,t),this.createdAt=new Date(t.createdAt),this.updatedAt=new Date(t.updatedAt),this}}export{e as K,t as W}
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 t,H as o,c as r,h as e,d as n,t as a}from"./p-B43upypT.js";const i=t(class extends o{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.buttonClick=r(this,"buttonClick")}variant="primary";disabled=!1;type="button";buttonClick;handleClick=t=>{this.disabled||(t.stopPropagation(),this.buttonClick.emit())};render(){return e(n,{key:"ee7da1d8d86cdd6f920d15642203265cc93cda4e"},e("button",{key:"15b1f11be5157c70ef5a4b3cd917bacb8f90ee4a",type:this.type,class:{"kritzel-button":!0,[this.variant]:!0,disabled:this.disabled},disabled:this.disabled,onClick:this.handleClick},e("slot",{key:"8500172bd4540f4fa9c5e629d1ceb1816dcf556a"})))}static get style(){return":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}"}},[769,"kritzel-button",{variant:[1],disabled:[4],type:[1]}]);function c(){"undefined"!=typeof customElements&&["kritzel-button"].forEach((t=>{"kritzel-button"===t&&(customElements.get(a(t))||customElements.define(a(t),i))}))}export{i as K,c as d}
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 e,H as t,h as r,d as s,t as a}from"./p-B43upypT.js";import{d as i}from"./p-D5jf8wAu.js";const n=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow()}user;avatarSize=40;terms={};render(){return r(s,{key:"606ff4d621467d24c30d06a2cf9191a883497f1b"},r("kritzel-avatar",{key:"a215f36bcfa55e2d649e79ef2e4ae4503ebb325d",user:this.user,size:this.avatarSize}))}static get style(){return":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%}"}},[513,"kritzel-current-user",{user:[16],avatarSize:[2,"avatar-size"],terms:[16]}]);function c(){"undefined"!=typeof customElements&&["kritzel-current-user","kritzel-avatar"].forEach((e=>{switch(e){case"kritzel-current-user":customElements.get(a(e))||customElements.define(a(e),n);break;case"kritzel-avatar":customElements.get(a(e))||i()}}))}export{n as K,c as d}
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 a,t,H as e,h as r,d as s}from"./p-B43upypT.js";import{d as i}from"./p-D5jf8wAu.js";const o=a(class extends e{constructor(a){super(),!1!==a&&this.__registerHost(),this.__attachShadow()}users=[];avatarSize=40;maxVisible=3;overlap=20;getDisplayName(a){return a.displayName??([a.firstName,a.lastName].filter(Boolean).join(" ")||a.email||"User")}render(){if(!this.users||0===this.users.length)return r(s,{style:{display:"none"}});const a=this.users.slice(0,this.maxVisible),t=this.users.length-this.maxVisible;return r(s,{style:{"--avatar-overlap":`-${this.overlap}px`}},r("div",{class:"avatars"},a.map(((t,e)=>r("div",{class:"avatar-wrapper",style:{marginLeft:e>0?"var(--avatar-overlap)":"0px",zIndex:""+(a.length-e)}},r("kritzel-avatar",{user:t,size:this.avatarSize}),r("span",{class:"avatar-tooltip"},this.getDisplayName(t)))))),t>0&&r("span",{class:"overflow-count"},"+",t,r("span",{class:"avatar-tooltip"},this.users.slice(this.maxVisible).map((a=>r("div",null,this.getDisplayName(a)))))))}static get style(){return":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}"}},[513,"kritzel-active-users",{users:[16],avatarSize:[2,"avatar-size"],maxVisible:[2,"max-visible"],overlap:[2]}]);function l(){"undefined"!=typeof customElements&&["kritzel-active-users","kritzel-avatar"].forEach((a=>{switch(a){case"kritzel-active-users":customElements.get(t(a))||customElements.define(t(a),o);break;case"kritzel-avatar":customElements.get(t(a))||i()}}))}export{o as K,l as d}
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 };