@kritzel/editor 0.4.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +50 -0
- package/README.md +5 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/index-B92VHWr4.js +1834 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/kritzel-active-users_46.cjs.entry.js +75271 -0
- package/dist/cjs/kritzel-brush-style.cjs.entry.js +31 -0
- package/dist/cjs/kritzel-editor.cjs.js +25 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/collection/collection-manifest.json +65 -0
- package/dist/collection/components/kritzel-active-users/kritzel-active-users.css +65 -0
- package/dist/collection/components/kritzel-active-users/kritzel-active-users.js +134 -0
- package/dist/collection/components/kritzel-avatar/kritzel-avatar.css +58 -0
- package/dist/collection/components/kritzel-avatar/kritzel-avatar.js +207 -0
- package/dist/collection/components/kritzel-back-to-content/kritzel-back-to-content.css +42 -0
- package/dist/collection/components/kritzel-back-to-content/kritzel-back-to-content.js +95 -0
- package/dist/collection/components/kritzel-brush-style/kritzel-brush-style.css +43 -0
- package/dist/collection/components/kritzel-brush-style/kritzel-brush-style.js +97 -0
- package/dist/collection/components/kritzel-button/kritzel-button.css +73 -0
- package/dist/collection/components/kritzel-button/kritzel-button.js +118 -0
- package/dist/collection/components/kritzel-color/kritzel-color.css +25 -0
- package/dist/collection/components/kritzel-color/kritzel-color.js +149 -0
- package/dist/collection/components/kritzel-color-palette/kritzel-color-palette.css +46 -0
- package/dist/collection/components/kritzel-color-palette/kritzel-color-palette.js +225 -0
- package/dist/collection/components/kritzel-context-menu/kritzel-context-menu.css +112 -0
- package/dist/collection/components/kritzel-context-menu/kritzel-context-menu.js +368 -0
- package/dist/collection/components/kritzel-current-user/kritzel-current-user.css +11 -0
- package/dist/collection/components/kritzel-current-user/kritzel-current-user.js +109 -0
- package/dist/collection/components/kritzel-current-user-dialog/kritzel-current-user-dialog.css +39 -0
- package/dist/collection/components/kritzel-current-user-dialog/kritzel-current-user-dialog.js +169 -0
- package/dist/collection/components/kritzel-dialog/kritzel-dialog.css +209 -0
- package/dist/collection/components/kritzel-dialog/kritzel-dialog.js +787 -0
- package/dist/collection/components/kritzel-dropdown/kritzel-dropdown.css +190 -0
- package/dist/collection/components/kritzel-dropdown/kritzel-dropdown.js +418 -0
- package/dist/collection/components/kritzel-editor/kritzel-editor.css +161 -0
- package/dist/collection/components/kritzel-editor/kritzel-editor.js +4678 -0
- package/dist/collection/components/kritzel-export/kritzel-export.css +89 -0
- package/dist/collection/components/kritzel-export/kritzel-export.js +246 -0
- package/dist/collection/components/kritzel-font/kritzel-font.css +10 -0
- package/dist/collection/components/kritzel-font/kritzel-font.js +89 -0
- package/dist/collection/components/kritzel-font-family/kritzel-font-family.css +48 -0
- package/dist/collection/components/kritzel-font-family/kritzel-font-family.js +122 -0
- package/dist/collection/components/kritzel-font-size/kritzel-font-size.css +30 -0
- package/dist/collection/components/kritzel-font-size/kritzel-font-size.js +117 -0
- package/dist/collection/components/kritzel-input/kritzel-input.css +69 -0
- package/dist/collection/components/kritzel-input/kritzel-input.js +198 -0
- package/dist/collection/components/kritzel-line-endings/kritzel-line-endings.css +60 -0
- package/dist/collection/components/kritzel-line-endings/kritzel-line-endings.js +165 -0
- package/dist/collection/components/kritzel-loading-overlay/kritzel-loading-overlay.css +54 -0
- package/dist/collection/components/kritzel-loading-overlay/kritzel-loading-overlay.js +70 -0
- package/dist/collection/components/kritzel-login-dialog/kritzel-login-dialog.css +98 -0
- package/dist/collection/components/kritzel-login-dialog/kritzel-login-dialog.js +239 -0
- package/dist/collection/components/kritzel-master-detail/kritzel-master-detail.css +190 -0
- package/dist/collection/components/kritzel-master-detail/kritzel-master-detail.js +201 -0
- package/dist/collection/components/kritzel-menu/kritzel-menu.css +34 -0
- package/dist/collection/components/kritzel-menu/kritzel-menu.js +297 -0
- package/dist/collection/components/kritzel-menu-item/kritzel-menu-item.css +167 -0
- package/dist/collection/components/kritzel-menu-item/kritzel-menu-item.js +298 -0
- package/dist/collection/components/kritzel-more-menu/kritzel-more-menu.css +58 -0
- package/dist/collection/components/kritzel-more-menu/kritzel-more-menu.js +381 -0
- package/dist/collection/components/kritzel-notification-card/kritzel-notification-card.css +101 -0
- package/dist/collection/components/kritzel-notification-card/kritzel-notification-card.js +173 -0
- package/dist/collection/components/kritzel-numeric-input/kritzel-numeric-input.css +102 -0
- package/dist/collection/components/kritzel-numeric-input/kritzel-numeric-input.js +255 -0
- package/dist/collection/components/kritzel-opacity-slider/kritzel-opacity-slider.css +85 -0
- package/dist/collection/components/kritzel-opacity-slider/kritzel-opacity-slider.js +164 -0
- package/dist/collection/components/kritzel-pill-tabs/kritzel-pill-tabs.css +68 -0
- package/dist/collection/components/kritzel-pill-tabs/kritzel-pill-tabs.js +135 -0
- package/dist/collection/components/kritzel-portal/kritzel-portal.js +432 -0
- package/dist/collection/components/kritzel-settings/kritzel-settings.css +137 -0
- package/dist/collection/components/kritzel-settings/kritzel-settings.js +448 -0
- package/dist/collection/components/kritzel-shape-fill/kritzel-shape-fill.css +47 -0
- package/dist/collection/components/kritzel-shape-fill/kritzel-shape-fill.js +93 -0
- package/dist/collection/components/kritzel-share-dialog/kritzel-share-dialog.css +150 -0
- package/dist/collection/components/kritzel-share-dialog/kritzel-share-dialog.js +308 -0
- package/dist/collection/components/kritzel-slide-toggle/kritzel-slide-toggle.css +48 -0
- package/dist/collection/components/kritzel-slide-toggle/kritzel-slide-toggle.js +119 -0
- package/dist/collection/components/kritzel-split-button/kritzel-split-button.css +78 -0
- package/dist/collection/components/kritzel-split-button/kritzel-split-button.js +433 -0
- package/dist/collection/components/kritzel-stroke-size/kritzel-stroke-size.css +37 -0
- package/dist/collection/components/kritzel-stroke-size/kritzel-stroke-size.js +89 -0
- package/dist/collection/components/kritzel-tool-config/kritzel-tool-config.css +38 -0
- package/dist/collection/components/kritzel-tool-config/kritzel-tool-config.js +467 -0
- package/dist/collection/components/kritzel-toolbar/kritzel-toolbar.css +348 -0
- package/dist/collection/components/kritzel-toolbar/kritzel-toolbar.js +588 -0
- package/dist/collection/components/kritzel-tooltip/kritzel-tooltip.css +18 -0
- package/dist/collection/components/kritzel-tooltip/kritzel-tooltip.js +388 -0
- package/dist/collection/components/kritzel-utility-panel/kritzel-utility-panel.css +46 -0
- package/dist/collection/components/kritzel-utility-panel/kritzel-utility-panel.js +146 -0
- package/dist/collection/components/kritzel-workspace-manager/kritzel-workspace-manager.css +16 -0
- package/dist/collection/components/kritzel-workspace-manager/kritzel-workspace-manager.js +365 -0
- package/dist/collection/components/kritzel-zoom-panel/kritzel-zoom-panel.css +72 -0
- package/dist/collection/components/kritzel-zoom-panel/kritzel-zoom-panel.js +173 -0
- package/dist/collection/index.js +1 -0
- package/dist/components/index.d.ts +121 -0
- package/dist/components/index.js +48 -0
- package/dist/components/kritzel-active-users.d.ts +11 -0
- package/dist/components/kritzel-active-users.js +6 -0
- package/dist/components/kritzel-avatar.d.ts +11 -0
- package/dist/components/kritzel-avatar.js +6 -0
- package/dist/components/kritzel-awareness-cursors.js +6 -0
- package/dist/components/kritzel-back-to-content.d.ts +11 -0
- package/dist/components/kritzel-back-to-content.js +6 -0
- package/dist/components/kritzel-brush-style.d.ts +11 -0
- package/dist/components/kritzel-brush-style.js +64 -0
- package/dist/components/kritzel-button.d.ts +11 -0
- package/dist/components/kritzel-button.js +6 -0
- package/dist/components/kritzel-color-palette.d.ts +11 -0
- package/dist/components/kritzel-color-palette.js +6 -0
- package/dist/components/kritzel-color.d.ts +11 -0
- package/dist/components/kritzel-color.js +6 -0
- package/dist/components/kritzel-context-menu.d.ts +11 -0
- package/dist/components/kritzel-context-menu.js +6 -0
- package/dist/components/kritzel-current-user-dialog.d.ts +11 -0
- package/dist/components/kritzel-current-user-dialog.js +6 -0
- package/dist/components/kritzel-current-user.d.ts +11 -0
- package/dist/components/kritzel-current-user.js +6 -0
- package/dist/components/kritzel-cursor-trail.js +6 -0
- package/dist/components/kritzel-dialog.d.ts +11 -0
- package/dist/components/kritzel-dialog.js +6 -0
- package/dist/components/kritzel-dropdown.d.ts +11 -0
- package/dist/components/kritzel-dropdown.js +6 -0
- package/dist/components/kritzel-editor.d.ts +11 -0
- package/dist/components/kritzel-editor.js +1792 -0
- package/dist/components/kritzel-engine.js +6 -0
- package/dist/components/kritzel-export.d.ts +11 -0
- package/dist/components/kritzel-export.js +6 -0
- package/dist/components/kritzel-font-family.d.ts +11 -0
- package/dist/components/kritzel-font-family.js +6 -0
- package/dist/components/kritzel-font-size.d.ts +11 -0
- package/dist/components/kritzel-font-size.js +6 -0
- package/dist/components/kritzel-font.d.ts +11 -0
- package/dist/components/kritzel-font.js +6 -0
- package/dist/components/kritzel-icon.js +6 -0
- package/dist/components/kritzel-input.d.ts +11 -0
- package/dist/components/kritzel-input.js +6 -0
- package/dist/components/kritzel-line-endings.d.ts +11 -0
- package/dist/components/kritzel-line-endings.js +6 -0
- package/dist/components/kritzel-loading-overlay.d.ts +11 -0
- package/dist/components/kritzel-loading-overlay.js +6 -0
- package/dist/components/kritzel-login-dialog.d.ts +11 -0
- package/dist/components/kritzel-login-dialog.js +6 -0
- package/dist/components/kritzel-master-detail.d.ts +11 -0
- package/dist/components/kritzel-master-detail.js +6 -0
- package/dist/components/kritzel-menu-item.d.ts +11 -0
- package/dist/components/kritzel-menu-item.js +6 -0
- package/dist/components/kritzel-menu.d.ts +11 -0
- package/dist/components/kritzel-menu.js +6 -0
- package/dist/components/kritzel-more-menu.d.ts +11 -0
- package/dist/components/kritzel-more-menu.js +6 -0
- package/dist/components/kritzel-notification-card.d.ts +11 -0
- package/dist/components/kritzel-notification-card.js +6 -0
- package/dist/components/kritzel-numeric-input.d.ts +11 -0
- package/dist/components/kritzel-numeric-input.js +6 -0
- package/dist/components/kritzel-opacity-slider.d.ts +11 -0
- package/dist/components/kritzel-opacity-slider.js +6 -0
- package/dist/components/kritzel-pill-tabs.d.ts +11 -0
- package/dist/components/kritzel-pill-tabs.js +6 -0
- package/dist/components/kritzel-portal.d.ts +11 -0
- package/dist/components/kritzel-portal.js +6 -0
- package/dist/components/kritzel-settings.d.ts +11 -0
- package/dist/components/kritzel-settings.js +6 -0
- package/dist/components/kritzel-shape-fill.d.ts +11 -0
- package/dist/components/kritzel-shape-fill.js +6 -0
- package/dist/components/kritzel-share-dialog.d.ts +11 -0
- package/dist/components/kritzel-share-dialog.js +6 -0
- package/dist/components/kritzel-slide-toggle.d.ts +11 -0
- package/dist/components/kritzel-slide-toggle.js +6 -0
- package/dist/components/kritzel-split-button.d.ts +11 -0
- package/dist/components/kritzel-split-button.js +6 -0
- package/dist/components/kritzel-stroke-size.d.ts +11 -0
- package/dist/components/kritzel-stroke-size.js +6 -0
- package/dist/components/kritzel-tool-config.d.ts +11 -0
- package/dist/components/kritzel-tool-config.js +6 -0
- package/dist/components/kritzel-toolbar.d.ts +11 -0
- package/dist/components/kritzel-toolbar.js +6 -0
- package/dist/components/kritzel-tooltip.d.ts +11 -0
- package/dist/components/kritzel-tooltip.js +6 -0
- package/dist/components/kritzel-utility-panel.d.ts +11 -0
- package/dist/components/kritzel-utility-panel.js +6 -0
- package/dist/components/kritzel-watermark.js +6 -0
- package/dist/components/kritzel-workspace-manager.d.ts +11 -0
- package/dist/components/kritzel-workspace-manager.js +6 -0
- package/dist/components/kritzel-zoom-panel.d.ts +11 -0
- package/dist/components/kritzel-zoom-panel.js +6 -0
- package/dist/components/p-4-qLegHb.js +142 -0
- package/dist/components/p-5qkOM1RJ.js +1557 -0
- package/dist/components/p-B3Tqoyl9.js +43 -0
- package/dist/components/p-B5xYV1o3.js +77 -0
- package/dist/components/p-B6UJztrf.js +290 -0
- package/dist/components/p-BDjRSoAc.js +43 -0
- package/dist/components/p-BFTU3MAI.js +7 -0
- package/dist/components/p-BGmTmdLe.js +167 -0
- package/dist/components/p-BN8VWPlq.js +164 -0
- package/dist/components/p-BZ_KnHdR.js +222 -0
- package/dist/components/p-B_gT0lCn.js +94 -0
- package/dist/components/p-BfMlwIcG.js +62 -0
- package/dist/components/p-BjFrt1q0.js +62 -0
- package/dist/components/p-Blq9a1ni.js +3267 -0
- package/dist/components/p-BrGJIoGK.js +52 -0
- package/dist/components/p-BvG3JO85.js +56 -0
- package/dist/components/p-CS3YZVYE.js +319 -0
- package/dist/components/p-CVxGF4bJ.js +150 -0
- package/dist/components/p-Ckqh1tqY.js +468 -0
- package/dist/components/p-ClfOtiNp.js +84 -0
- package/dist/components/p-CmjXRLdr.js +220 -0
- package/dist/components/p-CoNexfpB.js +106 -0
- package/dist/components/p-Cp4e4oTE.js +122 -0
- package/dist/components/p-CrIEmItB.js +85 -0
- package/dist/components/p-CvaxFYS0.js +304 -0
- package/dist/components/p-CwBxnzYu.js +57 -0
- package/dist/components/p-Cy_cLtOP.js +3456 -0
- package/dist/components/p-CzUeIini.js +381 -0
- package/dist/components/p-D0tPTPkR.js +99 -0
- package/dist/components/p-DJxgPPfs.js +194 -0
- package/dist/components/p-DOJCDPVD.js +55 -0
- package/dist/components/p-DVv8ChhE.js +91 -0
- package/dist/components/p-DXZBWJBt.js +70 -0
- package/dist/components/p-DXuf225S.js +53 -0
- package/dist/components/p-DZsSiMnA.js +63037 -0
- package/dist/components/p-DqOC_Yck.js +112 -0
- package/dist/components/p-Ds0uNtwQ.js +97 -0
- package/dist/components/p-DyRJFg4w.js +57 -0
- package/dist/components/p-GbCxpbQ6.js +88 -0
- package/dist/components/p-McY5wZ0h.js +135 -0
- package/dist/components/p-QEue33R5.js +70 -0
- package/dist/components/p-R1D8Sr0l.js +299 -0
- package/dist/components/p-SLnqczCS.js +49 -0
- package/dist/components/p-hQwVRh0t.js +147 -0
- package/dist/components/p-h_uh_Njf.js +63 -0
- package/dist/components/p-kOINnzaR.js +161 -0
- package/dist/components/p-peZjvnkK.js +486 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/index-OjbYJz-P.js +1807 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/kritzel-active-users_46.entry.js +75224 -0
- package/dist/esm/kritzel-brush-style.entry.js +29 -0
- package/dist/esm/kritzel-editor.js +21 -0
- package/dist/esm/loader.js +11 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/kritzel-editor/index.esm.js +1 -0
- package/dist/kritzel-editor/kritzel-editor.esm.js +21 -0
- package/dist/kritzel-editor/p-501047d8.entry.js +29 -0
- package/dist/kritzel-editor/p-60319edb.entry.js +75224 -0
- package/dist/kritzel-editor/p-DQuL1Twl.js +3 -0
- package/dist/kritzel-editor/p-OjbYJz-P.js +1790 -0
- package/dist/types/components/kritzel-active-users/kritzel-active-users.d.ts +21 -0
- package/dist/types/components/kritzel-avatar/kritzel-avatar.d.ts +27 -0
- package/dist/types/components/kritzel-back-to-content/kritzel-back-to-content.d.ts +17 -0
- package/dist/types/components/kritzel-brush-style/kritzel-brush-style.d.ts +11 -0
- package/dist/types/components/kritzel-button/kritzel-button.d.ts +13 -0
- package/dist/types/components/kritzel-color/kritzel-color.d.ts +10 -0
- package/dist/types/components/kritzel-color-palette/kritzel-color-palette.d.ts +17 -0
- package/dist/types/components/kritzel-context-menu/kritzel-context-menu.d.ts +40 -0
- package/dist/types/components/kritzel-current-user/kritzel-current-user.d.ts +15 -0
- package/dist/types/components/kritzel-current-user-dialog/kritzel-current-user-dialog.d.ts +18 -0
- package/dist/types/components/kritzel-dialog/kritzel-dialog.d.ts +85 -0
- package/dist/types/components/kritzel-dropdown/kritzel-dropdown.d.ts +48 -0
- package/dist/types/components/kritzel-editor/kritzel-editor.d.ts +356 -0
- package/dist/types/components/kritzel-export/kritzel-export.d.ts +35 -0
- package/dist/types/components/kritzel-font/kritzel-font.d.ts +6 -0
- package/dist/types/components/kritzel-font-family/kritzel-font-family.d.ts +17 -0
- package/dist/types/components/kritzel-font-size/kritzel-font-size.d.ts +10 -0
- package/dist/types/components/kritzel-input/kritzel-input.d.ts +22 -0
- package/dist/types/components/kritzel-line-endings/kritzel-line-endings.d.ts +21 -0
- package/dist/types/components/kritzel-loading-overlay/kritzel-loading-overlay.d.ts +11 -0
- package/dist/types/components/kritzel-login-dialog/kritzel-login-dialog.d.ts +32 -0
- package/dist/types/components/kritzel-master-detail/kritzel-master-detail.d.ts +25 -0
- package/dist/types/components/kritzel-menu/kritzel-menu.d.ts +25 -0
- package/dist/types/components/kritzel-menu-item/kritzel-menu-item.d.ts +28 -0
- package/dist/types/components/kritzel-more-menu/kritzel-more-menu.d.ts +55 -0
- package/dist/types/components/kritzel-notification-card/kritzel-notification-card.d.ts +22 -0
- package/dist/types/components/kritzel-numeric-input/kritzel-numeric-input.d.ts +32 -0
- package/dist/types/components/kritzel-opacity-slider/kritzel-opacity-slider.d.ts +17 -0
- package/dist/types/components/kritzel-pill-tabs/kritzel-pill-tabs.d.ts +26 -0
- package/dist/types/components/kritzel-portal/kritzel-portal.d.ts +33 -0
- package/dist/types/components/kritzel-settings/kritzel-settings.d.ts +64 -0
- package/dist/types/components/kritzel-shape-fill/kritzel-shape-fill.d.ts +10 -0
- package/dist/types/components/kritzel-share-dialog/kritzel-share-dialog.d.ts +49 -0
- package/dist/types/components/kritzel-slide-toggle/kritzel-slide-toggle.d.ts +14 -0
- package/dist/types/components/kritzel-split-button/kritzel-split-button.d.ts +38 -0
- package/dist/types/components/kritzel-stroke-size/kritzel-stroke-size.d.ts +8 -0
- package/dist/types/components/kritzel-tool-config/kritzel-tool-config.d.ts +39 -0
- package/dist/types/components/kritzel-toolbar/kritzel-toolbar.d.ts +76 -0
- package/dist/types/components/kritzel-tooltip/kritzel-tooltip.d.ts +30 -0
- package/dist/types/components/kritzel-utility-panel/kritzel-utility-panel.d.ts +14 -0
- package/dist/types/components/kritzel-workspace-manager/kritzel-workspace-manager.d.ts +40 -0
- package/dist/types/components/kritzel-zoom-panel/kritzel-zoom-panel.d.ts +20 -0
- package/dist/types/components.d.ts +3166 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/stencil-public-runtime.d.ts +1873 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +83 -0
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h, d as Host, t as transformTag } from './p-5qkOM1RJ.js';
|
|
2
|
+
import { KritzelToolConfigHelper, resolveTextToolAvailableFonts, KritzelFontRegistry, KritzelColorHelper } from '@kritzel/engine';
|
|
3
|
+
import { d as defineCustomElement$b } from './p-DVv8ChhE.js';
|
|
4
|
+
import { d as defineCustomElement$a } from './p-GbCxpbQ6.js';
|
|
5
|
+
import { d as defineCustomElement$9 } from './p-R1D8Sr0l.js';
|
|
6
|
+
import { d as defineCustomElement$8 } from './p-BDjRSoAc.js';
|
|
7
|
+
import { d as defineCustomElement$7 } from './p-ClfOtiNp.js';
|
|
8
|
+
import { d as defineCustomElement$6 } from './p-BfMlwIcG.js';
|
|
9
|
+
import { d as defineCustomElement$5 } from './p-BGmTmdLe.js';
|
|
10
|
+
import { d as defineCustomElement$4 } from './p-CoNexfpB.js';
|
|
11
|
+
import { d as defineCustomElement$3 } from './p-h_uh_Njf.js';
|
|
12
|
+
import { d as defineCustomElement$2 } from './p-BvG3JO85.js';
|
|
13
|
+
import { d as defineCustomElement$1 } from './p-DXuf225S.js';
|
|
14
|
+
|
|
15
|
+
const kritzelToolConfigCss = () => `.expand-toggle{background:none;border:none;cursor:var(--kritzel-global-pointer-cursor, pointer);padding:0;margin:0;display:flex;align-items:center;justify-content:center;width:32px;height:32px;color:var(--kritzel-icon-color, currentColor);transition:transform 0.2s ease}.expand-toggle:hover{opacity:0.7}.expand-toggle:focus{outline:none}.expand-toggle:focus-visible{outline:2px solid var(--kritzel-focus-color, #007acc);outline-offset:2px}.expand-toggle:active{transform:scale(0.95)}.divider{height:1px;background-color:var(--kritzel-divider-color, #e0e0e0);margin:4px 0;width:100%}`;
|
|
16
|
+
|
|
17
|
+
const KritzelToolConfig = /*@__PURE__*/ proxyCustomElement(class KritzelToolConfig extends H {
|
|
18
|
+
constructor(registerHost) {
|
|
19
|
+
super();
|
|
20
|
+
if (registerHost !== false) {
|
|
21
|
+
this.__registerHost();
|
|
22
|
+
}
|
|
23
|
+
this.__attachShadow();
|
|
24
|
+
this.toolChange = createEvent(this, "toolChange");
|
|
25
|
+
this.displayValuesChange = createEvent(this, "displayValuesChange");
|
|
26
|
+
}
|
|
27
|
+
tool;
|
|
28
|
+
handleToolChange(newTool, oldTool) {
|
|
29
|
+
const newConfig = KritzelToolConfigHelper.getToolConfig(newTool);
|
|
30
|
+
// Maintain settings when switching between shape tools
|
|
31
|
+
if (oldTool && newTool && newConfig?.type === 'shape') {
|
|
32
|
+
const oldConfig = KritzelToolConfigHelper.getToolConfig(oldTool);
|
|
33
|
+
if (oldConfig?.type === 'shape') {
|
|
34
|
+
// Copy properties that should persist
|
|
35
|
+
const propsToCopy = [
|
|
36
|
+
newConfig.colorProperty, // strokeColor
|
|
37
|
+
newConfig.sizeProperty, // strokeWidth
|
|
38
|
+
newConfig.opacityProperty, // opacity
|
|
39
|
+
'fillColor' // shape specific
|
|
40
|
+
];
|
|
41
|
+
propsToCopy.forEach(prop => {
|
|
42
|
+
if (prop && oldTool[prop] !== undefined) {
|
|
43
|
+
newTool[prop] = oldTool[prop];
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
this.config = newConfig;
|
|
49
|
+
if (this.config) {
|
|
50
|
+
this.updatePalette();
|
|
51
|
+
this.updateSizes();
|
|
52
|
+
this.currentOpacity = newTool[this.config.opacityProperty] ?? 1;
|
|
53
|
+
// Emit the values since they might have been updated from the old tool
|
|
54
|
+
this.emitDisplayValues();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
isExpanded = false;
|
|
58
|
+
theme;
|
|
59
|
+
engine;
|
|
60
|
+
/** Resolved localized strings keyed by term key, supplied by the editor. */
|
|
61
|
+
terms = {};
|
|
62
|
+
handleSelectionChangeBound = this.handleSelectionChange.bind(this);
|
|
63
|
+
onThemeChange() {
|
|
64
|
+
this.emitDisplayValues();
|
|
65
|
+
}
|
|
66
|
+
handleEngineChange(newEngine, oldEngine) {
|
|
67
|
+
if (oldEngine) {
|
|
68
|
+
oldEngine.removeEventListener('objectsSelectionChange', this.handleSelectionChangeBound);
|
|
69
|
+
}
|
|
70
|
+
if (newEngine) {
|
|
71
|
+
newEngine.addEventListener('objectsSelectionChange', this.handleSelectionChangeBound);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
toolChange;
|
|
75
|
+
displayValuesChange;
|
|
76
|
+
config;
|
|
77
|
+
palette = [];
|
|
78
|
+
sizes = [];
|
|
79
|
+
currentOpacity = 1;
|
|
80
|
+
updateTrigger = 0;
|
|
81
|
+
getFontOptionsFromTool() {
|
|
82
|
+
const configuredFonts = resolveTextToolAvailableFonts(this.tool.availableFonts).map(font => {
|
|
83
|
+
const registeredFont = typeof font === 'string'
|
|
84
|
+
? {
|
|
85
|
+
family: font,
|
|
86
|
+
label: font,
|
|
87
|
+
cssFontFamily: font,
|
|
88
|
+
}
|
|
89
|
+
: {
|
|
90
|
+
family: font.family,
|
|
91
|
+
label: font.label ?? font.family,
|
|
92
|
+
cssFontFamily: font.cssFontFamily ?? font.family,
|
|
93
|
+
};
|
|
94
|
+
return {
|
|
95
|
+
value: registeredFont.family,
|
|
96
|
+
label: registeredFont.label,
|
|
97
|
+
cssFontFamily: registeredFont.cssFontFamily,
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
const mergedFonts = [...configuredFonts];
|
|
101
|
+
const seenFonts = new Set(mergedFonts.map(font => font.value.trim().toLocaleLowerCase()));
|
|
102
|
+
for (const font of KritzelFontRegistry.list()) {
|
|
103
|
+
const normalizedValue = font.family.trim().toLocaleLowerCase();
|
|
104
|
+
if (seenFonts.has(normalizedValue)) {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
seenFonts.add(normalizedValue);
|
|
108
|
+
mergedFonts.push({
|
|
109
|
+
value: font.family,
|
|
110
|
+
label: font.label,
|
|
111
|
+
cssFontFamily: font.cssFontFamily,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return mergedFonts;
|
|
115
|
+
}
|
|
116
|
+
handleSelectionChange() {
|
|
117
|
+
if (this.tool?.toolType === 'selection') {
|
|
118
|
+
this.config = KritzelToolConfigHelper.getToolConfig(this.tool);
|
|
119
|
+
if (this.config) {
|
|
120
|
+
this.updatePalette();
|
|
121
|
+
this.updateSizes();
|
|
122
|
+
this.currentOpacity = this.tool[this.config.opacityProperty] ?? 1;
|
|
123
|
+
this.emitDisplayValues();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
disconnectedCallback() {
|
|
128
|
+
if (this.engine) {
|
|
129
|
+
this.engine.removeEventListener('objectsSelectionChange', this.handleSelectionChangeBound);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
componentWillLoad() {
|
|
133
|
+
this.config = KritzelToolConfigHelper.getToolConfig(this.tool);
|
|
134
|
+
if (this.config) {
|
|
135
|
+
this.updatePalette();
|
|
136
|
+
this.updateSizes();
|
|
137
|
+
this.currentOpacity = this.tool[this.config.opacityProperty] ?? 1;
|
|
138
|
+
this.emitDisplayValues();
|
|
139
|
+
}
|
|
140
|
+
if (this.engine) {
|
|
141
|
+
this.engine.addEventListener('objectsSelectionChange', this.handleSelectionChangeBound);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
emitDisplayValues() {
|
|
145
|
+
if (!this.config)
|
|
146
|
+
return;
|
|
147
|
+
const color = this.tool[this.config.colorProperty];
|
|
148
|
+
const opacity = this.currentOpacity;
|
|
149
|
+
const size = this.tool[this.config.sizeProperty];
|
|
150
|
+
const displayValues = {
|
|
151
|
+
color: KritzelColorHelper.applyOpacity(color, opacity, this.theme),
|
|
152
|
+
size,
|
|
153
|
+
};
|
|
154
|
+
if (this.tool.toolType === 'text') {
|
|
155
|
+
displayValues.fontFamily = this.tool.fontFamily;
|
|
156
|
+
}
|
|
157
|
+
this.displayValuesChange.emit(displayValues);
|
|
158
|
+
}
|
|
159
|
+
updatePalette() {
|
|
160
|
+
if (!this.config)
|
|
161
|
+
return;
|
|
162
|
+
if (this.config.paletteSource === 'none') {
|
|
163
|
+
this.palette = [];
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
this.palette = this.tool.palette || [];
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
updateSizes() {
|
|
170
|
+
if (!this.config)
|
|
171
|
+
return;
|
|
172
|
+
if (this.config.sizesSource === 'none') {
|
|
173
|
+
this.sizes = [];
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
this.sizes = this.tool.sizes || [];
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
handleToggleExpand = () => {
|
|
180
|
+
this.isExpanded = !this.isExpanded;
|
|
181
|
+
};
|
|
182
|
+
handleColorChange = (event) => {
|
|
183
|
+
this.tool[this.config.colorProperty] = event.detail;
|
|
184
|
+
// Special handling for shape fill: when color (stroke) changes, update fill color if it's currently filled
|
|
185
|
+
if (this.config.type === 'shape' || this.config.type === 'selection') {
|
|
186
|
+
const tool = this.tool;
|
|
187
|
+
const isTransparent = typeof tool.fillColor === 'string' ? tool.fillColor === 'transparent' :
|
|
188
|
+
(tool.fillColor.light === 'transparent' && tool.fillColor.dark === 'transparent');
|
|
189
|
+
if (!isTransparent) {
|
|
190
|
+
tool.fillColor = event.detail;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
this.emitDisplayValues();
|
|
194
|
+
this.toolChange.emit(this.tool);
|
|
195
|
+
this.updateTrigger++;
|
|
196
|
+
};
|
|
197
|
+
handleSizeChange = (event) => {
|
|
198
|
+
this.tool[this.config.sizeProperty] = event.detail;
|
|
199
|
+
this.emitDisplayValues();
|
|
200
|
+
this.toolChange.emit(this.tool);
|
|
201
|
+
this.updateTrigger++;
|
|
202
|
+
};
|
|
203
|
+
handleOpacityChange = (event) => {
|
|
204
|
+
this.tool[this.config.opacityProperty] = event.detail;
|
|
205
|
+
this.currentOpacity = event.detail;
|
|
206
|
+
this.emitDisplayValues();
|
|
207
|
+
this.toolChange.emit(this.tool);
|
|
208
|
+
};
|
|
209
|
+
handlePropertyChange = (propertyName, value) => {
|
|
210
|
+
// Special handling for shape fill
|
|
211
|
+
if ((this.config.type === 'shape' || this.config.type === 'selection') && propertyName === 'fillColor') {
|
|
212
|
+
const newFillColor = value === 'filled' ? this.tool[this.config.colorProperty] : { light: 'transparent', dark: 'transparent' };
|
|
213
|
+
this.tool.fillColor = newFillColor;
|
|
214
|
+
// When switching to fill mode, also update stroke color to match
|
|
215
|
+
if (value === 'filled') {
|
|
216
|
+
this.tool[this.config.colorProperty] = newFillColor;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
this.tool[propertyName] = value;
|
|
221
|
+
// Emit display values for font family changes
|
|
222
|
+
if (propertyName === 'fontFamily') {
|
|
223
|
+
this.emitDisplayValues();
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
this.toolChange.emit(this.tool);
|
|
227
|
+
this.updateTrigger++;
|
|
228
|
+
};
|
|
229
|
+
getShapeFillValue() {
|
|
230
|
+
const fillColor = this.tool.fillColor;
|
|
231
|
+
const isTransparent = typeof fillColor === 'string' ? fillColor === 'transparent' :
|
|
232
|
+
(fillColor.light === 'transparent' && fillColor.dark === 'transparent');
|
|
233
|
+
return isTransparent ? 'transparent' : 'filled';
|
|
234
|
+
}
|
|
235
|
+
renderControl(control) {
|
|
236
|
+
const value = this.tool[control.propertyName];
|
|
237
|
+
switch (control.type) {
|
|
238
|
+
case 'stroke-size':
|
|
239
|
+
return (h("kritzel-stroke-size", { key: control.type, sizes: this.sizes, selectedSize: value, onSizeChange: this.handleSizeChange }));
|
|
240
|
+
case 'font-size':
|
|
241
|
+
return (h("kritzel-font-size", { key: control.type, sizes: this.sizes, selectedSize: value, fontFamily: this.tool.fontFamily, onSizeChange: this.handleSizeChange }));
|
|
242
|
+
case 'line-endings':
|
|
243
|
+
return (h("kritzel-line-endings", { key: control.type, value: value, onValueChange: (event) => this.handlePropertyChange(control.propertyName, event.detail) }));
|
|
244
|
+
case 'shape-fill':
|
|
245
|
+
return (h("kritzel-shape-fill", { key: control.type, value: this.getShapeFillValue(), onValueChange: (event) => this.handlePropertyChange(control.propertyName, event.detail) }));
|
|
246
|
+
case 'font-family':
|
|
247
|
+
return (h("kritzel-font-family", { key: control.type, fontOptions: this.getFontOptionsFromTool(), selectedFontFamily: value, onFontFamilyChange: (event) => this.handlePropertyChange(control.propertyName, event.detail) }));
|
|
248
|
+
default:
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
render() {
|
|
253
|
+
if (!this.config)
|
|
254
|
+
return null;
|
|
255
|
+
const shouldShowExpandButton = this.palette.length > 6 || this.config.type === 'text';
|
|
256
|
+
const shouldShowColorPalette = this.palette.length > 0;
|
|
257
|
+
// Separate size control from other controls
|
|
258
|
+
const sizeControl = this.config.controls.find(c => c.type === 'stroke-size' || c.type === 'font-size');
|
|
259
|
+
const otherControls = this.config.controls.filter(c => c.type !== 'stroke-size' && c.type !== 'font-size');
|
|
260
|
+
return (h(Host, null, h("div", { style: {
|
|
261
|
+
display: 'flex',
|
|
262
|
+
flexDirection: 'row',
|
|
263
|
+
gap: '8px',
|
|
264
|
+
width: '100%',
|
|
265
|
+
} }, h("div", { style: {
|
|
266
|
+
display: 'flex',
|
|
267
|
+
flexDirection: 'column',
|
|
268
|
+
gap: '12px',
|
|
269
|
+
flex: '1',
|
|
270
|
+
} }, shouldShowColorPalette && (h("kritzel-color-palette", { colors: this.palette, selectedColor: this.tool[this.config.colorProperty], isExpanded: this.isExpanded, isOpaque: true, opacity: this.currentOpacity, theme: this.theme, onColorChange: this.handleColorChange })), sizeControl && this.renderControl(sizeControl), h("kritzel-opacity-slider", { value: this.tool[this.config.opacityProperty], previewColor: this.tool[this.config.colorProperty], onValueChange: this.handleOpacityChange }), otherControls.map((control) => [
|
|
271
|
+
h("div", { class: "divider" }),
|
|
272
|
+
this.renderControl(control),
|
|
273
|
+
])), shouldShowExpandButton && (h("div", { style: {
|
|
274
|
+
display: 'flex',
|
|
275
|
+
alignItems: 'flex-start',
|
|
276
|
+
} }, h("button", { class: "expand-toggle", onClick: this.handleToggleExpand, title: this.isExpanded ? (this.terms['toolConfig.collapse'] ?? 'Collapse') : (this.terms['toolConfig.expand'] ?? 'Expand') }, h("kritzel-icon", { name: this.isExpanded ? 'chevron-up' : 'chevron-down' })))))));
|
|
277
|
+
}
|
|
278
|
+
static get watchers() { return {
|
|
279
|
+
"tool": [{
|
|
280
|
+
"handleToolChange": 0
|
|
281
|
+
}],
|
|
282
|
+
"theme": [{
|
|
283
|
+
"onThemeChange": 0
|
|
284
|
+
}],
|
|
285
|
+
"engine": [{
|
|
286
|
+
"handleEngineChange": 0
|
|
287
|
+
}]
|
|
288
|
+
}; }
|
|
289
|
+
static get style() { return kritzelToolConfigCss(); }
|
|
290
|
+
}, [513, "kritzel-tool-config", {
|
|
291
|
+
"tool": [1040],
|
|
292
|
+
"isExpanded": [1028, "is-expanded"],
|
|
293
|
+
"theme": [1],
|
|
294
|
+
"engine": [16],
|
|
295
|
+
"terms": [16],
|
|
296
|
+
"config": [32],
|
|
297
|
+
"palette": [32],
|
|
298
|
+
"sizes": [32],
|
|
299
|
+
"currentOpacity": [32],
|
|
300
|
+
"updateTrigger": [32]
|
|
301
|
+
}, undefined, {
|
|
302
|
+
"tool": [{
|
|
303
|
+
"handleToolChange": 0
|
|
304
|
+
}],
|
|
305
|
+
"theme": [{
|
|
306
|
+
"onThemeChange": 0
|
|
307
|
+
}],
|
|
308
|
+
"engine": [{
|
|
309
|
+
"handleEngineChange": 0
|
|
310
|
+
}]
|
|
311
|
+
}]);
|
|
312
|
+
function defineCustomElement() {
|
|
313
|
+
if (typeof customElements === "undefined") {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
const components = ["kritzel-tool-config", "kritzel-color", "kritzel-color-palette", "kritzel-dropdown", "kritzel-font", "kritzel-font-family", "kritzel-font-size", "kritzel-icon", "kritzel-line-endings", "kritzel-opacity-slider", "kritzel-shape-fill", "kritzel-stroke-size"];
|
|
317
|
+
components.forEach(tagName => { switch (tagName) {
|
|
318
|
+
case "kritzel-tool-config":
|
|
319
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
320
|
+
customElements.define(transformTag(tagName), KritzelToolConfig);
|
|
321
|
+
}
|
|
322
|
+
break;
|
|
323
|
+
case "kritzel-color":
|
|
324
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
325
|
+
defineCustomElement$b();
|
|
326
|
+
}
|
|
327
|
+
break;
|
|
328
|
+
case "kritzel-color-palette":
|
|
329
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
330
|
+
defineCustomElement$a();
|
|
331
|
+
}
|
|
332
|
+
break;
|
|
333
|
+
case "kritzel-dropdown":
|
|
334
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
335
|
+
defineCustomElement$9();
|
|
336
|
+
}
|
|
337
|
+
break;
|
|
338
|
+
case "kritzel-font":
|
|
339
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
340
|
+
defineCustomElement$8();
|
|
341
|
+
}
|
|
342
|
+
break;
|
|
343
|
+
case "kritzel-font-family":
|
|
344
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
345
|
+
defineCustomElement$7();
|
|
346
|
+
}
|
|
347
|
+
break;
|
|
348
|
+
case "kritzel-font-size":
|
|
349
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
350
|
+
defineCustomElement$6();
|
|
351
|
+
}
|
|
352
|
+
break;
|
|
353
|
+
case "kritzel-icon":
|
|
354
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
355
|
+
defineCustomElement$5();
|
|
356
|
+
}
|
|
357
|
+
break;
|
|
358
|
+
case "kritzel-line-endings":
|
|
359
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
360
|
+
defineCustomElement$4();
|
|
361
|
+
}
|
|
362
|
+
break;
|
|
363
|
+
case "kritzel-opacity-slider":
|
|
364
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
365
|
+
defineCustomElement$3();
|
|
366
|
+
}
|
|
367
|
+
break;
|
|
368
|
+
case "kritzel-shape-fill":
|
|
369
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
370
|
+
defineCustomElement$2();
|
|
371
|
+
}
|
|
372
|
+
break;
|
|
373
|
+
case "kritzel-stroke-size":
|
|
374
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
375
|
+
defineCustomElement$1();
|
|
376
|
+
}
|
|
377
|
+
break;
|
|
378
|
+
} });
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export { KritzelToolConfig as K, defineCustomElement as d };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h, d as Host, t as transformTag } from './p-5qkOM1RJ.js';
|
|
2
|
+
import { d as defineCustomElement$1 } from './p-BGmTmdLe.js';
|
|
3
|
+
|
|
4
|
+
const kritzelNotificationCardCss = () => `:host{display:block}.card{box-sizing:border-box;width:100%;max-width:var(--kritzel-notification-card-max-width, 360px);margin-inline:auto;font-family:var(--kritzel-font-family, sans-serif);padding:var(--kritzel-notification-card-padding, 12px 14px);border:var(--kritzel-notification-card-border, 1px solid #e5e7eb);border-radius:var(--kritzel-notification-card-border-radius, 12px);background-color:var(--kritzel-notification-card-background-color, #ffffff);color:var(--kritzel-notification-card-color, #111827);box-shadow:var(--kritzel-notification-card-box-shadow, 0 8px 20px rgba(15, 23, 42, 0.08))}.card-header{display:flex;align-items:center;justify-content:space-between;gap:var(--kritzel-notification-card-header-gap, 8px);margin-bottom:var(--kritzel-notification-card-header-margin-bottom, 8px)}.header-right{display:inline-flex;align-items:center;gap:var(--kritzel-notification-card-header-right-gap, 6px)}.type-pill{display:inline-flex;align-items:center;justify-content:center;min-height:var(--kritzel-notification-card-pill-height, 22px);padding:var(--kritzel-notification-card-pill-padding, 0 8px);border-radius:var(--kritzel-notification-card-pill-border-radius, 999px);background-color:var(--kritzel-notification-card-pill-background-color, #eff6ff);color:var(--kritzel-notification-card-pill-color, #1d4ed8);font-size:var(--kritzel-notification-card-pill-font-size, 12px);font-weight:var(--kritzel-notification-card-pill-font-weight, 600);line-height:1}.card.type-info .type-pill{background-color:var(--kritzel-notification-card-info-pill-background-color, #eff6ff);color:var(--kritzel-notification-card-info-pill-color, #1d4ed8)}.card.type-warning .type-pill{background-color:var(--kritzel-notification-card-warning-pill-background-color, #fff7ed);color:var(--kritzel-notification-card-warning-pill-color, #b45309)}.card.type-error .type-pill{background-color:var(--kritzel-notification-card-error-pill-background-color, #fef2f2);color:var(--kritzel-notification-card-error-pill-color, #b91c1c)}.timestamp{color:var(--kritzel-notification-card-timestamp-color, #6b7280);font-size:var(--kritzel-notification-card-timestamp-font-size, 12px);white-space:nowrap}.dismiss-button{display:inline-flex;align-items:center;justify-content:center;width:var(--kritzel-notification-card-dismiss-button-size, 24px);height:var(--kritzel-notification-card-dismiss-button-size, 24px);padding:0;border:none;border-radius:var(--kritzel-notification-card-dismiss-button-border-radius, 6px);background:var(--kritzel-notification-card-dismiss-button-background-color, transparent);color:var(--kritzel-notification-card-dismiss-button-color, #4b5563);cursor:var(--kritzel-global-pointer-cursor, pointer);-webkit-tap-highlight-color:transparent}.dismiss-button:hover{background:var(--kritzel-notification-card-dismiss-button-hover-background-color, #f3f4f6)}.dismiss-button:active{background:var(--kritzel-notification-card-dismiss-button-active-background-color, #e5e7eb)}.dismiss-button:focus-visible{outline:revert}.message{margin:0;color:var(--kritzel-notification-card-message-color, inherit);font-size:var(--kritzel-notification-card-message-font-size, 14px);line-height:var(--kritzel-notification-card-message-line-height, 1.45);word-break:break-word}`;
|
|
5
|
+
|
|
6
|
+
const KritzelNotificationCard = /*@__PURE__*/ proxyCustomElement(class KritzelNotificationCard extends H {
|
|
7
|
+
constructor(registerHost) {
|
|
8
|
+
super();
|
|
9
|
+
if (registerHost !== false) {
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
}
|
|
12
|
+
this.__attachShadow();
|
|
13
|
+
this.dismiss = createEvent(this, "dismiss");
|
|
14
|
+
this.hoverChange = createEvent(this, "hoverChange");
|
|
15
|
+
}
|
|
16
|
+
/** Notification data rendered by this card. */
|
|
17
|
+
notification;
|
|
18
|
+
/** Whether a formatted timestamp should be displayed when available. */
|
|
19
|
+
showTimestamp = true;
|
|
20
|
+
/** Locale used for formatting the timestamp. */
|
|
21
|
+
locale;
|
|
22
|
+
/** Emitted when the notification should be dismissed manually. */
|
|
23
|
+
dismiss;
|
|
24
|
+
/** Emitted when pointer hover state changes. */
|
|
25
|
+
hoverChange;
|
|
26
|
+
handleDismissClick = (event) => {
|
|
27
|
+
event.stopPropagation();
|
|
28
|
+
this.dismiss.emit();
|
|
29
|
+
};
|
|
30
|
+
handleMouseEnter = () => {
|
|
31
|
+
this.hoverChange.emit(true);
|
|
32
|
+
};
|
|
33
|
+
handleMouseLeave = () => {
|
|
34
|
+
this.hoverChange.emit(false);
|
|
35
|
+
};
|
|
36
|
+
get type() {
|
|
37
|
+
return this.notification?.type ?? 'info';
|
|
38
|
+
}
|
|
39
|
+
get role() {
|
|
40
|
+
return this.type === 'error' ? 'alert' : 'status';
|
|
41
|
+
}
|
|
42
|
+
getTypeLabel(type) {
|
|
43
|
+
switch (type) {
|
|
44
|
+
case 'warning':
|
|
45
|
+
return 'Warning';
|
|
46
|
+
case 'error':
|
|
47
|
+
return 'Error';
|
|
48
|
+
default:
|
|
49
|
+
return 'Info';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
formatTimestamp(timestamp) {
|
|
53
|
+
if (!timestamp || !this.showTimestamp) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const date = timestamp instanceof Date ? timestamp : new Date(timestamp);
|
|
57
|
+
if (Number.isNaN(date.getTime())) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
return new Intl.DateTimeFormat(this.locale, {
|
|
61
|
+
dateStyle: 'medium',
|
|
62
|
+
timeStyle: 'short',
|
|
63
|
+
}).format(date);
|
|
64
|
+
}
|
|
65
|
+
render() {
|
|
66
|
+
const notification = this.notification;
|
|
67
|
+
if (!notification) {
|
|
68
|
+
return h(Host, null);
|
|
69
|
+
}
|
|
70
|
+
const type = this.type;
|
|
71
|
+
const timestamp = this.formatTimestamp(notification.timestamp);
|
|
72
|
+
return (h(Host, null, h("article", { class: { card: true, [`type-${type}`]: true }, role: this.role, "aria-live": "polite", onMouseEnter: this.handleMouseEnter, onMouseLeave: this.handleMouseLeave }, h("header", { class: "card-header" }, h("span", { class: "type-pill" }, this.getTypeLabel(type)), h("div", { class: "header-right" }, timestamp && (h("time", { class: "timestamp", dateTime: notification.timestamp?.toISOString() }, timestamp)), h("button", { class: "dismiss-button", type: "button", "aria-label": "Dismiss notification", onClick: this.handleDismissClick }, h("kritzel-icon", { name: "x", size: 16 })))), h("p", { class: "message" }, notification.message))));
|
|
73
|
+
}
|
|
74
|
+
static get style() { return kritzelNotificationCardCss(); }
|
|
75
|
+
}, [513, "kritzel-notification-card", {
|
|
76
|
+
"notification": [16],
|
|
77
|
+
"showTimestamp": [4, "show-timestamp"],
|
|
78
|
+
"locale": [1]
|
|
79
|
+
}]);
|
|
80
|
+
function defineCustomElement() {
|
|
81
|
+
if (typeof customElements === "undefined") {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const components = ["kritzel-notification-card", "kritzel-icon"];
|
|
85
|
+
components.forEach(tagName => { switch (tagName) {
|
|
86
|
+
case "kritzel-notification-card":
|
|
87
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
88
|
+
customElements.define(transformTag(tagName), KritzelNotificationCard);
|
|
89
|
+
}
|
|
90
|
+
break;
|
|
91
|
+
case "kritzel-icon":
|
|
92
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
93
|
+
defineCustomElement$1();
|
|
94
|
+
}
|
|
95
|
+
break;
|
|
96
|
+
} });
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export { KritzelNotificationCard as K, defineCustomElement as d };
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h, d as Host, t as transformTag } from './p-5qkOM1RJ.js';
|
|
2
|
+
import { KritzelHTMLHelper } from '@kritzel/engine';
|
|
3
|
+
|
|
4
|
+
const kritzelTooltipCss = () => `:host{width:auto}.tooltip-content{position:relative;padding:8px 12px;border-radius:4px;width:fit-content;background-color:var(--kritzel-tooltip-background-color, #ffffff);color:var(--kritzel-tooltip-color, #000000);padding:var(--kritzel-tooltip-padding, 12px);border:var(--kritzel-tooltip-border, 1px solid #ebebeb);border-radius:var(--kritzel-tooltip-border-radius, 16px);white-space:nowrap;box-shadow:var(--kritzel-tooltip-box-shadow, 0 1px 6px rgba(0, 0, 0, 0.12))}`;
|
|
5
|
+
|
|
6
|
+
const KritzelTooltip = /*@__PURE__*/ proxyCustomElement(class KritzelTooltip extends H {
|
|
7
|
+
constructor(registerHost) {
|
|
8
|
+
super();
|
|
9
|
+
if (registerHost !== false) {
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
}
|
|
12
|
+
this.__attachShadow();
|
|
13
|
+
this.tooltipClosed = createEvent(this, "tooltipClosed");
|
|
14
|
+
this.tooltipOpened = createEvent(this, "tooltipOpened");
|
|
15
|
+
}
|
|
16
|
+
get host() { return this; }
|
|
17
|
+
isVisible = false;
|
|
18
|
+
anchorElement;
|
|
19
|
+
triggerElement;
|
|
20
|
+
offsetY = 24;
|
|
21
|
+
tooltipClosed;
|
|
22
|
+
tooltipOpened;
|
|
23
|
+
positionX = 0;
|
|
24
|
+
positionY = 0;
|
|
25
|
+
handleOutsideClick(event) {
|
|
26
|
+
if (!this.isVisible)
|
|
27
|
+
return;
|
|
28
|
+
const path = event.composedPath();
|
|
29
|
+
const isInsideTooltip = path.some(el => el === this.host);
|
|
30
|
+
const isOnTrigger = this.triggerElement && path.some(el => el === this.triggerElement);
|
|
31
|
+
if (!isInsideTooltip && !isOnTrigger) {
|
|
32
|
+
this.close();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
handleOutsidePointerDown(event) {
|
|
36
|
+
if (!this.isVisible)
|
|
37
|
+
return;
|
|
38
|
+
const path = event.composedPath();
|
|
39
|
+
const isInsideTooltip = path.some(el => el === this.host);
|
|
40
|
+
const isOnTrigger = this.triggerElement && path.some(el => el === this.triggerElement);
|
|
41
|
+
if (!isInsideTooltip && !isOnTrigger) {
|
|
42
|
+
event.stopPropagation();
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
this.close();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
handleCloseAll(event) {
|
|
48
|
+
if (event.detail !== this.host) {
|
|
49
|
+
this.close();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
handleWindowResize() {
|
|
53
|
+
this.calculateAdjustedPosition();
|
|
54
|
+
}
|
|
55
|
+
handleTriggerElementChange(newTrigger, oldTrigger) {
|
|
56
|
+
if (oldTrigger) {
|
|
57
|
+
oldTrigger.removeEventListener('click', this.handleTriggerClick);
|
|
58
|
+
}
|
|
59
|
+
if (newTrigger) {
|
|
60
|
+
newTrigger.addEventListener('click', this.handleTriggerClick);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
handleVisibilityChange(newValue) {
|
|
64
|
+
if (newValue) {
|
|
65
|
+
this.calculateAdjustedPosition();
|
|
66
|
+
requestAnimationFrame(() => {
|
|
67
|
+
this.focusContent();
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async open() {
|
|
72
|
+
if (this.isVisible)
|
|
73
|
+
return;
|
|
74
|
+
document.dispatchEvent(new CustomEvent('kritzelTooltipCloseAll', { detail: this.host }));
|
|
75
|
+
this.isVisible = true;
|
|
76
|
+
this.tooltipOpened.emit();
|
|
77
|
+
}
|
|
78
|
+
async close() {
|
|
79
|
+
if (!this.isVisible)
|
|
80
|
+
return;
|
|
81
|
+
this.isVisible = false;
|
|
82
|
+
this.tooltipClosed.emit();
|
|
83
|
+
}
|
|
84
|
+
async toggle() {
|
|
85
|
+
if (this.isVisible) {
|
|
86
|
+
this.close();
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
this.open();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async focusContent() {
|
|
93
|
+
const focusableElements = KritzelHTMLHelper.getFocusableElements(this.host);
|
|
94
|
+
if (focusableElements.length > 0) {
|
|
95
|
+
focusableElements[0].focus();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
connectedCallback() {
|
|
99
|
+
if (this.triggerElement) {
|
|
100
|
+
this.triggerElement.addEventListener('click', this.handleTriggerClick);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
componentDidLoad() {
|
|
104
|
+
if (this.triggerElement) {
|
|
105
|
+
this.triggerElement.addEventListener('click', this.handleTriggerClick);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
componentWillLoad() {
|
|
109
|
+
this.calculateAdjustedPosition();
|
|
110
|
+
}
|
|
111
|
+
componentWillUpdate() {
|
|
112
|
+
this.calculateAdjustedPosition();
|
|
113
|
+
}
|
|
114
|
+
disconnectedCallback() {
|
|
115
|
+
if (this.triggerElement) {
|
|
116
|
+
this.triggerElement.removeEventListener('click', this.handleTriggerClick);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
handleTriggerClick = (event) => {
|
|
120
|
+
event.stopPropagation();
|
|
121
|
+
this.toggle();
|
|
122
|
+
};
|
|
123
|
+
calculateAdjustedPosition() {
|
|
124
|
+
if (this.isVisible && this.anchorElement) {
|
|
125
|
+
const anchorRect = this.anchorElement.getBoundingClientRect();
|
|
126
|
+
const tooltipContent = this.host.shadowRoot?.querySelector('.tooltip-content');
|
|
127
|
+
const tooltipRect = tooltipContent?.getBoundingClientRect();
|
|
128
|
+
const tooltipWidth = tooltipRect?.width || 0;
|
|
129
|
+
const viewportPadding = 12; // Minimum distance from viewport edges
|
|
130
|
+
const anchorCenterX = anchorRect.left + anchorRect.width / 2;
|
|
131
|
+
// Step 1: Try to center the tooltip above the anchor
|
|
132
|
+
let idealLeft = anchorCenterX - tooltipWidth / 2;
|
|
133
|
+
// Step 2: Clamp to viewport bounds
|
|
134
|
+
const minLeft = viewportPadding;
|
|
135
|
+
const maxLeft = window.innerWidth - tooltipWidth - viewportPadding;
|
|
136
|
+
// Apply clamping - adjust if tooltip would overflow
|
|
137
|
+
this.positionX = Math.max(minLeft, Math.min(idealLeft, maxLeft));
|
|
138
|
+
// Step 3: Calculate bottom position (distance from viewport bottom to top of anchor + offset)
|
|
139
|
+
this.positionY = window.innerHeight - anchorRect.top + this.offsetY;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
render() {
|
|
143
|
+
return (h(Host, { key: 'aa1367fd2af71357855814087a3d3c69e77e326f', style: {
|
|
144
|
+
position: 'fixed',
|
|
145
|
+
zIndex: '9999',
|
|
146
|
+
transition: 'opacity 0.3s ease-in-out, transform 0.3s ease-in-out',
|
|
147
|
+
visibility: this.isVisible ? 'visible' : 'hidden',
|
|
148
|
+
left: `${this.positionX}px`,
|
|
149
|
+
bottom: `${this.positionY}px`,
|
|
150
|
+
} }, h("div", { key: 'da84f59a18173fa4c93b4c2b8ace6102b0067e17', class: "tooltip-content", onClick: event => event.stopPropagation(), onPointerDown: event => event.stopPropagation(), onMouseDown: event => event.stopPropagation() }, h("slot", { key: 'a68910ec2f7c2243043aea21489e3c68b6b09966' }))));
|
|
151
|
+
}
|
|
152
|
+
static get watchers() { return {
|
|
153
|
+
"triggerElement": [{
|
|
154
|
+
"handleTriggerElementChange": 0
|
|
155
|
+
}],
|
|
156
|
+
"isVisible": [{
|
|
157
|
+
"handleVisibilityChange": 0
|
|
158
|
+
}]
|
|
159
|
+
}; }
|
|
160
|
+
static get style() { return kritzelTooltipCss(); }
|
|
161
|
+
}, [769, "kritzel-tooltip", {
|
|
162
|
+
"isVisible": [1028, "is-visible"],
|
|
163
|
+
"anchorElement": [16],
|
|
164
|
+
"triggerElement": [16],
|
|
165
|
+
"offsetY": [2, "offset-y"],
|
|
166
|
+
"positionX": [32],
|
|
167
|
+
"positionY": [32],
|
|
168
|
+
"open": [64],
|
|
169
|
+
"close": [64],
|
|
170
|
+
"toggle": [64],
|
|
171
|
+
"focusContent": [64]
|
|
172
|
+
}, [[4, "click", "handleOutsideClick"], [6, "pointerdown", "handleOutsidePointerDown"], [4, "kritzelTooltipCloseAll", "handleCloseAll"], [9, "resize", "handleWindowResize"]], {
|
|
173
|
+
"triggerElement": [{
|
|
174
|
+
"handleTriggerElementChange": 0
|
|
175
|
+
}],
|
|
176
|
+
"isVisible": [{
|
|
177
|
+
"handleVisibilityChange": 0
|
|
178
|
+
}]
|
|
179
|
+
}]);
|
|
180
|
+
function defineCustomElement() {
|
|
181
|
+
if (typeof customElements === "undefined") {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const components = ["kritzel-tooltip"];
|
|
185
|
+
components.forEach(tagName => { switch (tagName) {
|
|
186
|
+
case "kritzel-tooltip":
|
|
187
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
188
|
+
customElements.define(transformTag(tagName), KritzelTooltip);
|
|
189
|
+
}
|
|
190
|
+
break;
|
|
191
|
+
} });
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export { KritzelTooltip as K, defineCustomElement as d };
|