kritzel-stencil 0.4.4 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/kritzel-active-users_47.cjs.entry.js +79 -13
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/stencil.cjs.js +1 -1
- package/dist/collection/classes/core/viewport.class.js +14 -1
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +48 -8
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +84 -3
- package/dist/collection/constants/version.js +1 -1
- package/dist/components/index.js +1226 -1
- package/dist/components/kritzel-active-users.js +6 -1
- package/dist/components/kritzel-avatar.js +6 -1
- package/dist/components/kritzel-awareness-cursors.js +6 -1
- package/dist/components/kritzel-back-to-content.js +6 -1
- package/dist/components/kritzel-brush-style.js +64 -1
- package/dist/components/kritzel-button.js +6 -1
- package/dist/components/kritzel-color-palette.js +6 -1
- package/dist/components/kritzel-color.js +6 -1
- package/dist/components/kritzel-context-menu.js +6 -1
- package/dist/components/kritzel-controls.js +6 -1
- package/dist/components/kritzel-current-user-dialog.js +6 -1
- package/dist/components/kritzel-current-user.js +6 -1
- package/dist/components/kritzel-cursor-trail.js +6 -1
- package/dist/components/kritzel-dialog.js +6 -1
- package/dist/components/kritzel-dropdown.js +6 -1
- package/dist/components/kritzel-editor.js +4404 -1
- package/dist/components/kritzel-engine.js +6 -1
- package/dist/components/kritzel-export.js +6 -1
- package/dist/components/kritzel-font-family.js +6 -1
- package/dist/components/kritzel-font-size.js +6 -1
- package/dist/components/kritzel-font.js +6 -1
- package/dist/components/kritzel-icon.js +6 -1
- package/dist/components/kritzel-input.js +6 -1
- package/dist/components/kritzel-line-endings.js +6 -1
- package/dist/components/kritzel-loading-overlay.js +6 -1
- package/dist/components/kritzel-login-dialog.js +6 -1
- package/dist/components/kritzel-master-detail.js +6 -1
- package/dist/components/kritzel-menu-item.js +6 -1
- package/dist/components/kritzel-menu.js +6 -1
- package/dist/components/kritzel-more-menu.js +6 -1
- package/dist/components/kritzel-notification-card.js +6 -1
- package/dist/components/kritzel-numeric-input.js +6 -1
- package/dist/components/kritzel-opacity-slider.js +6 -1
- package/dist/components/kritzel-pill-tabs.js +6 -1
- package/dist/components/kritzel-portal.js +6 -1
- package/dist/components/kritzel-settings.js +6 -1
- package/dist/components/kritzel-shape-fill.js +6 -1
- package/dist/components/kritzel-share-dialog.js +6 -1
- package/dist/components/kritzel-slide-toggle.js +6 -1
- package/dist/components/kritzel-split-button.js +6 -1
- package/dist/components/kritzel-stroke-size.js +6 -1
- package/dist/components/kritzel-sync-indicator.js +6 -1
- package/dist/components/kritzel-tool-config.js +6 -1
- package/dist/components/kritzel-tooltip.js +6 -1
- package/dist/components/kritzel-utility-panel.js +6 -1
- package/dist/components/kritzel-watermark.js +6 -1
- package/dist/components/kritzel-workspace-manager.js +6 -1
- package/dist/components/kritzel-zoom-panel.js +6 -1
- package/dist/components/p-894OnDQV.js +39 -1
- package/dist/components/p-B43upypT.js +1500 -1
- package/dist/components/p-B5oHmPJb.js +97 -1
- package/dist/components/p-B6t5q-V4.js +63 -1
- package/dist/components/p-B8Xi4Clg.js +43 -1
- package/dist/components/p-BBmP8lVY.js +51726 -0
- package/dist/components/p-BDzlx2hB.js +135 -1
- package/dist/components/p-BFTU3MAI.js +7 -1
- package/dist/components/p-BFYtCsZu.js +56 -1
- package/dist/components/p-BI2ng9I_.js +62 -1
- package/dist/components/p-BTzlrIxe.js +194 -1
- package/dist/components/p-BmyTdQGy.js +1090 -1
- package/dist/components/p-BsANVili.js +150 -1
- package/dist/components/p-BxpKq94F.js +290 -1
- package/dist/components/p-C38P-Vd0.js +446 -1
- package/dist/components/p-C4NrrUfN.js +77 -1
- package/dist/components/p-CW-VyJgK.js +6 -1
- package/dist/components/p-CWRSGYOE.js +57 -1
- package/dist/components/p-CXpv9Rxe.js +106 -1
- package/dist/components/p-Ca-igU1f.js +320 -1
- package/dist/components/p-CdR76C4L.js +165 -1
- package/dist/components/p-Ch42cOeY.js +320 -0
- package/dist/components/p-ClFprFvz.js +209 -1
- package/dist/components/p-Cm33td2O.js +122 -1
- package/dist/components/p-CqLgB8JK.js +91 -1
- package/dist/components/p-Cr682JI_.js +156 -1
- package/dist/components/p-CsvMgk_f.js +62 -1
- package/dist/components/p-CwJwsRR3.js +277 -1
- package/dist/components/p-Cymum41a.js +88 -1
- package/dist/components/p-D09kgc5Q.js +94 -1
- package/dist/components/p-D30zs0kA.js +121 -1
- package/dist/components/p-D3y_Hauo.js +85 -1
- package/dist/components/p-D5jf8wAu.js +142 -1
- package/dist/components/p-D82VaHce.js +53 -1
- package/dist/components/p-DAwPPDMS.js +101 -1
- package/dist/components/p-DEBwmRTC.js +55 -1
- package/dist/components/p-DIazmg6w.js +52 -1
- package/dist/components/p-DJ88BrIW.js +70 -1
- package/dist/components/p-DJkKlUyZ.js +182 -1
- package/dist/components/p-DUYmwrWV.js +3267 -1
- package/dist/components/p-DX2nriaq.js +486 -1
- package/dist/components/p-Dd-pMvlr.js +20 -1
- package/dist/components/p-Df3BwVGy.js +299 -1
- package/dist/components/p-DgJ0ufzr.js +43 -1
- package/dist/components/p-DkUb2czk.js +70 -1
- package/dist/components/p-Dlp84thc.js +57 -1
- package/dist/components/p-JYj3Facr.js +431 -1
- package/dist/components/p-Ka7OWbnk.js +2304 -1
- package/dist/components/p-PSFAfAyd.js +49 -1
- package/dist/components/p-WUdQqYnu.js +118 -1
- package/dist/components/p-djJSnjAX.js +84 -1
- package/dist/components/p-e6Zpc9Vp.js +143 -1
- package/dist/components/p-jGOpkGDl.js +30 -1
- package/dist/components/p-pagW8YF7.js +99 -1
- package/dist/esm/kritzel-active-users_47.entry.js +79 -13
- package/dist/esm/loader.js +1 -1
- package/dist/esm/stencil.js +1 -1
- package/dist/stencil/index.esm.js +1172 -1
- package/dist/stencil/p-5b969a42.entry.js +36109 -0
- package/dist/stencil/p-DQuL1Twl.js +3 -1
- package/dist/stencil/p-Dhio9uis.js +1717 -2
- package/dist/stencil/p-fb32cd8f.entry.js +29 -1
- package/dist/stencil/p-uC7_X6yr.js +30737 -1
- package/dist/stencil/stencil.esm.js +21 -1
- package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +2 -0
- package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +7 -0
- package/dist/types/components.d.ts +10 -0
- package/dist/types/constants/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/p--Oazz-BP.js +0 -9
- package/dist/components/p-Xsiz1D5Q.js +0 -1
- package/dist/stencil/p-9abc21b9.entry.js +0 -9
|
@@ -1 +1,49 @@
|
|
|
1
|
-
import{p as
|
|
1
|
+
import { p as proxyCustomElement, H, h, d as Host, t as transformTag } from './p-B43upypT.js';
|
|
2
|
+
|
|
3
|
+
const ABSOLUTE_SCALE_MAX = 1000;
|
|
4
|
+
const ABSOLUTE_SCALE_MIN = 0.0001;
|
|
5
|
+
/** Destination opened when the "Powered by Kritzel" watermark is clicked. */
|
|
6
|
+
const KRITZEL_WEBSITE_URL = 'https://kritzel.io';
|
|
7
|
+
|
|
8
|
+
const kritzelWatermarkCss = () => `:host{position:absolute;bottom:var(--kritzel-watermark-offset-bottom, 12px);right:var(--kritzel-watermark-offset-right, 12px);z-index:10000;pointer-events:none}.watermark-link{pointer-events:auto;display:inline-flex;align-items:center;padding:4px 8px;border-radius:var(--kritzel-watermark-border-radius, 6px);font-family:var(--kritzel-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);font-size:var(--kritzel-watermark-font-size, 11px);line-height:1;text-decoration:none;color:var(--kritzel-watermark-color, rgba(60, 60, 60, 0.75));background-color:var(--kritzel-watermark-background, rgba(255, 255, 255, 0.6));box-shadow:var(--kritzel-watermark-box-shadow, 0 1px 2px rgba(0, 0, 0, 0.12));opacity:var(--kritzel-watermark-opacity, 0.85);transition:opacity 150ms ease;user-select:none}.watermark-link:hover{opacity:1}`;
|
|
9
|
+
|
|
10
|
+
const KritzelWatermark = /*@__PURE__*/ proxyCustomElement(class KritzelWatermark extends H {
|
|
11
|
+
constructor(registerHost) {
|
|
12
|
+
super();
|
|
13
|
+
if (registerHost !== false) {
|
|
14
|
+
this.__registerHost();
|
|
15
|
+
}
|
|
16
|
+
this.__attachShadow();
|
|
17
|
+
}
|
|
18
|
+
/** The core instance used to resolve localized terms. */
|
|
19
|
+
core;
|
|
20
|
+
/**
|
|
21
|
+
* Resolved "Powered by Kritzel" label. Passed in by the engine so the badge
|
|
22
|
+
* re-renders when the active locale changes. Falls back to resolving the term
|
|
23
|
+
* from the core when not provided.
|
|
24
|
+
*/
|
|
25
|
+
label;
|
|
26
|
+
render() {
|
|
27
|
+
const label = this.label ?? this.core.localizationManager.translate('watermark.poweredBy');
|
|
28
|
+
return (h(Host, { key: '143ea32342e30351c93751714dfd12b725ddca24' }, h("a", { key: '95fb2dfa0d806367e6a71dad3932b321d7ae5a76', class: "watermark-link", href: KRITZEL_WEBSITE_URL, target: "_blank", rel: "noopener noreferrer", part: "watermark", onPointerDown: (ev) => ev.stopPropagation(), onPointerUp: (ev) => ev.stopPropagation() }, label)));
|
|
29
|
+
}
|
|
30
|
+
static get style() { return kritzelWatermarkCss(); }
|
|
31
|
+
}, [513, "kritzel-watermark", {
|
|
32
|
+
"core": [16],
|
|
33
|
+
"label": [1]
|
|
34
|
+
}]);
|
|
35
|
+
function defineCustomElement() {
|
|
36
|
+
if (typeof customElements === "undefined") {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const components = ["kritzel-watermark"];
|
|
40
|
+
components.forEach(tagName => { switch (tagName) {
|
|
41
|
+
case "kritzel-watermark":
|
|
42
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
43
|
+
customElements.define(transformTag(tagName), KritzelWatermark);
|
|
44
|
+
}
|
|
45
|
+
break;
|
|
46
|
+
} });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { ABSOLUTE_SCALE_MAX as A, KritzelWatermark as K, ABSOLUTE_SCALE_MIN as a, defineCustomElement as d };
|
|
@@ -1 +1,118 @@
|
|
|
1
|
-
class
|
|
1
|
+
class KritzelHTMLHelper {
|
|
2
|
+
static getNumericValueFromStyle(element, property) {
|
|
3
|
+
const value = window.getComputedStyle(element).getPropertyValue(property);
|
|
4
|
+
return parseFloat(value) || 0;
|
|
5
|
+
}
|
|
6
|
+
static isScrollableElement(element) {
|
|
7
|
+
if (!(element instanceof HTMLElement)) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
const style = window.getComputedStyle(element);
|
|
11
|
+
const overflowX = style.overflowX;
|
|
12
|
+
const overflowY = style.overflowY;
|
|
13
|
+
const overflow = style.overflow;
|
|
14
|
+
const canScrollX = (overflowX === 'auto' || overflowX === 'scroll' || overflowX === 'overlay') && element.scrollWidth > element.clientWidth;
|
|
15
|
+
const canScrollY = (overflowY === 'auto' || overflowY === 'scroll' || overflowY === 'overlay') && element.scrollHeight > element.clientHeight;
|
|
16
|
+
const canScroll = overflow === 'auto' || overflow === 'scroll' || overflow === 'overlay';
|
|
17
|
+
return canScrollX || canScrollY || (canScroll && (element.scrollWidth > element.clientWidth || element.scrollHeight > element.clientHeight));
|
|
18
|
+
}
|
|
19
|
+
static findScrollableElement(root) {
|
|
20
|
+
if (!root) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const visited = new Set();
|
|
24
|
+
const walk = (element) => {
|
|
25
|
+
if (visited.has(element)) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
visited.add(element);
|
|
29
|
+
if (this.isScrollableElement(element)) {
|
|
30
|
+
return element;
|
|
31
|
+
}
|
|
32
|
+
if (element.shadowRoot) {
|
|
33
|
+
for (const child of Array.from(element.shadowRoot.children)) {
|
|
34
|
+
const scrollable = walk(child);
|
|
35
|
+
if (scrollable) {
|
|
36
|
+
return scrollable;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (element.tagName === 'SLOT') {
|
|
41
|
+
for (const assignedElement of element.assignedElements({ flatten: true })) {
|
|
42
|
+
const scrollable = walk(assignedElement);
|
|
43
|
+
if (scrollable) {
|
|
44
|
+
return scrollable;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
for (const child of Array.from(element.children)) {
|
|
49
|
+
const scrollable = walk(child);
|
|
50
|
+
if (scrollable) {
|
|
51
|
+
return scrollable;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
};
|
|
56
|
+
return walk(root);
|
|
57
|
+
}
|
|
58
|
+
static getScrollableParent(element) {
|
|
59
|
+
if (!element) {
|
|
60
|
+
return window;
|
|
61
|
+
}
|
|
62
|
+
const parent = element.parentNode?.host ?? element.parentElement;
|
|
63
|
+
if (!parent || parent.tagName === 'BODY') {
|
|
64
|
+
return window;
|
|
65
|
+
}
|
|
66
|
+
const style = window.getComputedStyle(parent);
|
|
67
|
+
if (style.overflow === 'auto' || style.overflowY === 'auto' || style.overflow === 'scroll' || style.overflowY === 'scroll') {
|
|
68
|
+
return parent;
|
|
69
|
+
}
|
|
70
|
+
return this.getScrollableParent(parent);
|
|
71
|
+
}
|
|
72
|
+
static isElementInViewport(element) {
|
|
73
|
+
if (!element) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
const scrollableParent = this.getScrollableParent(element);
|
|
77
|
+
const rect = element.getBoundingClientRect();
|
|
78
|
+
if (scrollableParent === window) {
|
|
79
|
+
const viewportHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
80
|
+
const viewportWidth = window.innerWidth || document.documentElement.clientWidth;
|
|
81
|
+
return rect.top >= 0 && rect.left >= 0 && rect.bottom <= viewportHeight && rect.right <= viewportWidth;
|
|
82
|
+
}
|
|
83
|
+
const parentRect = scrollableParent.getBoundingClientRect();
|
|
84
|
+
return rect.top >= parentRect.top && rect.left >= parentRect.left && rect.bottom <= parentRect.bottom && rect.right <= parentRect.right;
|
|
85
|
+
}
|
|
86
|
+
static getFocusableElements(root) {
|
|
87
|
+
if (!root)
|
|
88
|
+
return [];
|
|
89
|
+
const focusableElements = [];
|
|
90
|
+
const focusableSelector = 'a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), details, [tabindex]:not([tabindex="-1"])';
|
|
91
|
+
const isVisible = (el) => {
|
|
92
|
+
const style = window.getComputedStyle(el);
|
|
93
|
+
return style.display !== 'none' && style.visibility !== 'hidden';
|
|
94
|
+
};
|
|
95
|
+
const find = (element) => {
|
|
96
|
+
// Check if the element itself is focusable
|
|
97
|
+
if (element instanceof HTMLElement && element.matches(focusableSelector) && !element.hasAttribute('disabled') && isVisible(element)) {
|
|
98
|
+
focusableElements.push(element);
|
|
99
|
+
}
|
|
100
|
+
// Traverse shadow DOM
|
|
101
|
+
if (element.shadowRoot) {
|
|
102
|
+
Array.from(element.shadowRoot.children).forEach(find);
|
|
103
|
+
}
|
|
104
|
+
// Traverse slotted content
|
|
105
|
+
if (element.tagName === 'SLOT') {
|
|
106
|
+
element.assignedElements({ flatten: true }).forEach(find);
|
|
107
|
+
}
|
|
108
|
+
// Traverse light DOM children if there is no shadow root
|
|
109
|
+
if (!element.shadowRoot) {
|
|
110
|
+
Array.from(element.children).forEach(find);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
find(root);
|
|
114
|
+
return focusableElements;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { KritzelHTMLHelper as K };
|
|
@@ -1 +1,84 @@
|
|
|
1
|
-
import{p as
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h, d as Host, t as transformTag } from './p-B43upypT.js';
|
|
2
|
+
import { d as defineCustomElement$1 } from './p-Df3BwVGy.js';
|
|
3
|
+
|
|
4
|
+
const kritzelFontFamilyCss = () => `:host{display:flex;align-items:flex-start;gap:8px;padding:0;box-sizing:border-box;width:100%}.font-style-button{display:flex;justify-content:center;align-items:center;width:42px;height:32px;padding:0;border:none;outline:none;background:none;cursor:var(--kritzel-global-pointer-cursor, pointer);border-radius:0;color:var(--control-text-color);font-weight:bold;-webkit-tap-highlight-color:transparent}.font-style-button:not(:last-child){border-right:1px solid #333333}.font-style-button:hover{background-color:var(--control-hover-bg)}.font-style-button:active{background-color:var(--control-active-bg)}.font-style-button.selected,.font-style-button.selected:hover,.font-style-button.selected:active{background-color:var(--control-selected-bg);color:var(--control-selected-color)}.font-style-button.italic-text{font-style:italic}`;
|
|
5
|
+
|
|
6
|
+
const KritzelFontFamily = /*@__PURE__*/ proxyCustomElement(class KritzelFontFamily extends H {
|
|
7
|
+
constructor(registerHost) {
|
|
8
|
+
super();
|
|
9
|
+
if (registerHost !== false) {
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
}
|
|
12
|
+
this.__attachShadow();
|
|
13
|
+
this.fontFamilyChange = createEvent(this, "fontFamilyChange");
|
|
14
|
+
}
|
|
15
|
+
fontOptions = [];
|
|
16
|
+
selectedFontFamily;
|
|
17
|
+
fontFamilyChange;
|
|
18
|
+
handleFontOptionsChange() {
|
|
19
|
+
this.ensureValidSelectedFont(this.resolveFontOptions());
|
|
20
|
+
}
|
|
21
|
+
componentWillLoad() {
|
|
22
|
+
this.ensureValidSelectedFont(this.resolveFontOptions());
|
|
23
|
+
}
|
|
24
|
+
handleDropdownValueChange = (event) => {
|
|
25
|
+
this.fontFamilyChange.emit(event.detail);
|
|
26
|
+
};
|
|
27
|
+
ensureValidSelectedFont(options) {
|
|
28
|
+
if (options.length === 0) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const normalizedSelected = this.selectedFontFamily?.trim().toLocaleLowerCase();
|
|
32
|
+
const isValidCurrentFont = options.some(opt => opt.value.trim().toLocaleLowerCase() === normalizedSelected);
|
|
33
|
+
if (!normalizedSelected || !isValidCurrentFont) {
|
|
34
|
+
this.selectedFontFamily = options[0].value;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
resolveFontOptions() {
|
|
38
|
+
return this.fontOptions;
|
|
39
|
+
}
|
|
40
|
+
render() {
|
|
41
|
+
const fontOptions = this.resolveFontOptions();
|
|
42
|
+
const selectedOption = fontOptions.find(option => option.value === this.selectedFontFamily);
|
|
43
|
+
const selectedFontFamily = selectedOption?.cssFontFamily ?? this.selectedFontFamily;
|
|
44
|
+
const dropdownOptions = fontOptions.map(option => ({
|
|
45
|
+
value: option.value,
|
|
46
|
+
label: option.label,
|
|
47
|
+
style: { fontFamily: option.cssFontFamily ?? option.value },
|
|
48
|
+
}));
|
|
49
|
+
return (h(Host, { key: '059350f34370f7a291f47a42721ca5d9bb82df49' }, h("kritzel-dropdown", { key: 'fbd8cf1ae463c7e9b76d0ac754a41de54397058e', options: dropdownOptions, value: this.selectedFontFamily, onValueChanged: this.handleDropdownValueChange, selectStyles: { fontFamily: selectedFontFamily } })));
|
|
50
|
+
}
|
|
51
|
+
static get watchers() { return {
|
|
52
|
+
"fontOptions": [{
|
|
53
|
+
"handleFontOptionsChange": 0
|
|
54
|
+
}]
|
|
55
|
+
}; }
|
|
56
|
+
static get style() { return kritzelFontFamilyCss(); }
|
|
57
|
+
}, [513, "kritzel-font-family", {
|
|
58
|
+
"fontOptions": [16],
|
|
59
|
+
"selectedFontFamily": [1025, "selected-font-family"]
|
|
60
|
+
}, undefined, {
|
|
61
|
+
"fontOptions": [{
|
|
62
|
+
"handleFontOptionsChange": 0
|
|
63
|
+
}]
|
|
64
|
+
}]);
|
|
65
|
+
function defineCustomElement() {
|
|
66
|
+
if (typeof customElements === "undefined") {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const components = ["kritzel-font-family", "kritzel-dropdown"];
|
|
70
|
+
components.forEach(tagName => { switch (tagName) {
|
|
71
|
+
case "kritzel-font-family":
|
|
72
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
73
|
+
customElements.define(transformTag(tagName), KritzelFontFamily);
|
|
74
|
+
}
|
|
75
|
+
break;
|
|
76
|
+
case "kritzel-dropdown":
|
|
77
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
78
|
+
defineCustomElement$1();
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
} });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export { KritzelFontFamily as K, defineCustomElement as d };
|
|
@@ -1 +1,143 @@
|
|
|
1
|
-
import{p as
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h, d as Host, t as transformTag } from './p-B43upypT.js';
|
|
2
|
+
import { d as defineCustomElement$5 } from './p-DX2nriaq.js';
|
|
3
|
+
import { d as defineCustomElement$4 } from './p-Df3BwVGy.js';
|
|
4
|
+
import { d as defineCustomElement$3 } from './p-CdR76C4L.js';
|
|
5
|
+
import { d as defineCustomElement$2 } from './p-C4NrrUfN.js';
|
|
6
|
+
import { d as defineCustomElement$1 } from './p-D09kgc5Q.js';
|
|
7
|
+
|
|
8
|
+
const kritzelExportCss = () => `:host{display:flex;flex-direction:column;min-height:0}.export-content{display:flex;flex-direction:column;gap:16px;padding:0;flex:1}.export-content kritzel-pill-tabs{align-self:center}.export-tab-content{display:flex;flex-direction:column;gap:16px;min-height:330px}.format-selection{display:flex;flex-direction:column;gap:6px}.format-selection label{font-size:14px;font-weight:500;color:var(--kritzel-global-text-primary, #333)}.export-primary-button{width:100%;padding:12px 24px;background-color:var(--kritzel-global-primary-color, #007AFF);color:var(--kritzel-global-primary-text-color, #fff);border:none;border-radius:var(--kritzel-button-border-radius, 8px);font-size:14px;font-weight:600;cursor:pointer;transition:background-color 0.2s ease;-webkit-tap-highlight-color:transparent}.export-primary-button:hover{background-color:var(--kritzel-global-primary-hover-color, #0066d6)}.export-primary-button:focus-visible{outline:revert;outline-offset:revert}.preview-container{width:100%;display:flex;justify-content:center;align-items:center;box-sizing:border-box;margin-bottom:8px}.preview-container img{max-width:100%;max-height:250px;object-fit:contain;box-shadow:0 4px 8px rgba(0, 0, 0, 0.15);border-radius:4px;border:1px solid var(--kritzel-global-border-color, #dbdbdb)}.export-content p{margin:0;color:var(--kritzel-global-text-secondary, #666)}@media (max-width: 576px){.export-tab-content{flex:1;min-height:0}}`;
|
|
9
|
+
|
|
10
|
+
const KritzelExport = /*@__PURE__*/ proxyCustomElement(class KritzelExport extends H {
|
|
11
|
+
constructor(registerHost) {
|
|
12
|
+
super();
|
|
13
|
+
if (registerHost !== false) {
|
|
14
|
+
this.__registerHost();
|
|
15
|
+
}
|
|
16
|
+
this.__attachShadow();
|
|
17
|
+
this.exportPng = createEvent(this, "exportPng");
|
|
18
|
+
this.exportSvg = createEvent(this, "exportSvg");
|
|
19
|
+
this.exportJson = createEvent(this, "exportJson");
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The name of the current workspace, used as default filename
|
|
23
|
+
*/
|
|
24
|
+
workspaceName = 'workspace';
|
|
25
|
+
/** Resolved localized strings keyed by term key, supplied by the editor. */
|
|
26
|
+
terms = {};
|
|
27
|
+
isDialogOpen = false;
|
|
28
|
+
previewUrl;
|
|
29
|
+
isLoading = false;
|
|
30
|
+
activeTab = 'viewport';
|
|
31
|
+
exportFilename = '';
|
|
32
|
+
viewportExportFormat = 'png';
|
|
33
|
+
exportPng;
|
|
34
|
+
exportSvg;
|
|
35
|
+
exportJson;
|
|
36
|
+
get tabs() {
|
|
37
|
+
return [
|
|
38
|
+
{ id: 'viewport', label: this.terms['export.tabs.viewport'] ?? 'Export Viewport' },
|
|
39
|
+
{ id: 'workspace', label: this.terms['export.tabs.workspace'] ?? 'Export Workspace' },
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
viewportFormatOptions = [
|
|
43
|
+
{ value: 'png', label: 'PNG' },
|
|
44
|
+
{ value: 'svg', label: 'SVG' },
|
|
45
|
+
];
|
|
46
|
+
async open(previewUrl) {
|
|
47
|
+
this.previewUrl = previewUrl;
|
|
48
|
+
this.activeTab = 'viewport';
|
|
49
|
+
this.viewportExportFormat = 'png';
|
|
50
|
+
this.exportFilename = this.generateDefaultFilename();
|
|
51
|
+
this.isDialogOpen = true;
|
|
52
|
+
}
|
|
53
|
+
generateDefaultFilename() {
|
|
54
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, -5);
|
|
55
|
+
return `${this.workspaceName}-${timestamp}`;
|
|
56
|
+
}
|
|
57
|
+
handleFilenameChange = (event) => {
|
|
58
|
+
this.exportFilename = event.detail;
|
|
59
|
+
};
|
|
60
|
+
closeDialog = () => {
|
|
61
|
+
this.isDialogOpen = false;
|
|
62
|
+
};
|
|
63
|
+
handleTabChange = (event) => {
|
|
64
|
+
this.activeTab = event.detail;
|
|
65
|
+
};
|
|
66
|
+
handleViewportFormatChange = (event) => {
|
|
67
|
+
this.viewportExportFormat = event.detail;
|
|
68
|
+
};
|
|
69
|
+
handleExport = () => {
|
|
70
|
+
if (this.activeTab === 'viewport') {
|
|
71
|
+
if (this.viewportExportFormat === 'png') {
|
|
72
|
+
this.exportPng.emit();
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
this.exportSvg.emit();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this.exportJson.emit(this.exportFilename || this.generateDefaultFilename());
|
|
80
|
+
}
|
|
81
|
+
this.closeDialog();
|
|
82
|
+
};
|
|
83
|
+
renderViewportExport() {
|
|
84
|
+
return (h("div", { class: "export-tab-content" }, this.previewUrl && (h("div", { class: "preview-container" }, h("img", { src: this.previewUrl, alt: "Viewport Preview" }))), h("kritzel-input", { label: this.terms['export.filename.label'] ?? 'Filename', value: this.exportFilename, placeholder: this.terms['export.filename.placeholder'] ?? 'Enter filename', suffix: `.${this.viewportExportFormat}`, onValueChange: this.handleFilenameChange }), h("div", { class: "format-selection" }, h("label", null, this.terms['export.format.label'] ?? 'Format'), h("kritzel-dropdown", { options: this.viewportFormatOptions, value: this.viewportExportFormat, forceOpenDirection: "up", onValueChanged: this.handleViewportFormatChange }))));
|
|
85
|
+
}
|
|
86
|
+
renderWorkspaceExport() {
|
|
87
|
+
return (h("div", { class: "export-tab-content" }, h("kritzel-input", { label: this.terms['export.filename.label'] ?? 'Filename', value: this.exportFilename, placeholder: this.terms['export.filename.placeholder'] ?? 'Enter filename', suffix: ".json", onValueChange: this.handleFilenameChange })));
|
|
88
|
+
}
|
|
89
|
+
render() {
|
|
90
|
+
return (h(Host, { key: '2f12ec7f4754e3f2aa0364809bdbde60102d76e4' }, h("kritzel-dialog", { key: '0e5929e175ac41dd7f480aabaef2aa109a15f679', isOpen: this.isDialogOpen, dialogTitle: this.terms['export.dialogTitle'] ?? 'Export', closable: true, contained: true, onDialogClose: this.closeDialog }, h("div", { key: '6afffd8098e414c117582f3485dbaa348747eb4c', class: "export-content" }, h("kritzel-pill-tabs", { key: 'dd901f356e80fb71033311825e4d83af36b9c561', tabs: this.tabs, value: this.activeTab, onValueChange: this.handleTabChange }), this.activeTab === 'viewport' && this.renderViewportExport(), this.activeTab === 'workspace' && this.renderWorkspaceExport(), h("button", { key: '9fab5c1037cc9187c4f14c9534c8f395fde0d7cf', class: "export-primary-button", onClick: this.handleExport }, this.terms['export.exportButton'] ?? 'Export')))));
|
|
91
|
+
}
|
|
92
|
+
static get style() { return kritzelExportCss(); }
|
|
93
|
+
}, [513, "kritzel-export", {
|
|
94
|
+
"workspaceName": [1, "workspace-name"],
|
|
95
|
+
"terms": [16],
|
|
96
|
+
"isDialogOpen": [32],
|
|
97
|
+
"previewUrl": [32],
|
|
98
|
+
"isLoading": [32],
|
|
99
|
+
"activeTab": [32],
|
|
100
|
+
"exportFilename": [32],
|
|
101
|
+
"viewportExportFormat": [32],
|
|
102
|
+
"open": [64]
|
|
103
|
+
}]);
|
|
104
|
+
function defineCustomElement() {
|
|
105
|
+
if (typeof customElements === "undefined") {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const components = ["kritzel-export", "kritzel-dialog", "kritzel-dropdown", "kritzel-icon", "kritzel-input", "kritzel-pill-tabs"];
|
|
109
|
+
components.forEach(tagName => { switch (tagName) {
|
|
110
|
+
case "kritzel-export":
|
|
111
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
112
|
+
customElements.define(transformTag(tagName), KritzelExport);
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
case "kritzel-dialog":
|
|
116
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
117
|
+
defineCustomElement$5();
|
|
118
|
+
}
|
|
119
|
+
break;
|
|
120
|
+
case "kritzel-dropdown":
|
|
121
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
122
|
+
defineCustomElement$4();
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
case "kritzel-icon":
|
|
126
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
127
|
+
defineCustomElement$3();
|
|
128
|
+
}
|
|
129
|
+
break;
|
|
130
|
+
case "kritzel-input":
|
|
131
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
132
|
+
defineCustomElement$2();
|
|
133
|
+
}
|
|
134
|
+
break;
|
|
135
|
+
case "kritzel-pill-tabs":
|
|
136
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
137
|
+
defineCustomElement$1();
|
|
138
|
+
}
|
|
139
|
+
break;
|
|
140
|
+
} });
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export { KritzelExport as K, defineCustomElement as d };
|
|
@@ -1 +1,30 @@
|
|
|
1
|
-
class
|
|
1
|
+
class KritzelDevicesHelper {
|
|
2
|
+
static isTouchDevice() {
|
|
3
|
+
return window.matchMedia('(any-pointer: coarse)').matches;
|
|
4
|
+
}
|
|
5
|
+
static isAndroid() {
|
|
6
|
+
return /android/i.test(navigator.userAgent);
|
|
7
|
+
}
|
|
8
|
+
static isIOS() {
|
|
9
|
+
return /iPad|iPhone|iPod/.test(navigator.userAgent);
|
|
10
|
+
}
|
|
11
|
+
static detectOS() {
|
|
12
|
+
if (this.isIOS()) {
|
|
13
|
+
return 'iOS';
|
|
14
|
+
}
|
|
15
|
+
else if (this.isAndroid()) {
|
|
16
|
+
return 'Android';
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
return 'Other';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
static isMobile() {
|
|
23
|
+
return this.isIOS() || this.isAndroid();
|
|
24
|
+
}
|
|
25
|
+
static isFirefox() {
|
|
26
|
+
return /firefox/i.test(navigator.userAgent);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { KritzelDevicesHelper as K };
|
|
@@ -1 +1,99 @@
|
|
|
1
|
-
import{p as
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h, d as Host, t as transformTag } from './p-B43upypT.js';
|
|
2
|
+
import { d as defineCustomElement$1 } from './p-CdR76C4L.js';
|
|
3
|
+
|
|
4
|
+
const 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 };
|