kritzel-stencil 0.4.3 → 0.4.5
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 +1 -1
- 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 +4396 -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--Oazz-BP.js +51657 -2
- 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-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-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-U6uE85Qx.js +320 -0
- 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 +1 -1
- package/dist/stencil/index.esm.js +1172 -1
- package/dist/stencil/p-4463dade.entry.js +36043 -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/constants/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/p-DPhYXJsM.js +0 -1
- package/dist/stencil/p-43a8dcf8.entry.js +0 -9
|
@@ -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 };
|
|
@@ -31717,7 +31717,7 @@ const KritzelPortal = class {
|
|
|
31717
31717
|
* This file is auto-generated by the version bump scripts.
|
|
31718
31718
|
* Do not modify manually.
|
|
31719
31719
|
*/
|
|
31720
|
-
const KRITZEL_VERSION = '0.4.
|
|
31720
|
+
const KRITZEL_VERSION = '0.4.5';
|
|
31721
31721
|
|
|
31722
31722
|
const kritzelSettingsCss = () => `:host{display:contents}kritzel-dialog{--kritzel-dialog-body-padding:0;--kritzel-dialog-width-large:800px;--kritzel-dialog-height-large:500px}.footer-button{padding:8px 16px;border-radius:6px;cursor:pointer;font-size:14px}.cancel-button{border:1px solid #ebebeb;background:#fff;color:inherit}.cancel-button:hover{background:#f5f5f5}.settings-content{padding:0}.settings-content h3{margin:0 0 16px 0;font-size:18px;font-weight:600;color:var(--kritzel-settings-content-heading-color, #333333)}.settings-content p{margin:0;font-size:14px;color:var(--kritzel-settings-content-text-color, #666666);line-height:1.5}.settings-group{display:flex;flex-direction:column;gap:24px}.settings-item{display:flex;flex-direction:column;gap:8px}.settings-row{display:flex;align-items:center;justify-content:space-between;gap:16px}.settings-label{font-size:14px;font-weight:600;color:var(--kritzel-settings-label-color, #333333);margin:0 0 4px 0}.settings-description{font-size:12px;color:var(--kritzel-settings-description-color, #888888);margin:0;line-height:1.4}.shortcuts-list{display:flex;flex-direction:column;gap:24px}.shortcuts-category{display:flex;flex-direction:column;gap:8px}.shortcuts-category-title{font-size:14px;font-weight:600;color:var(--kritzel-settings-label-color, #333333);margin:0 0 4px 0}.shortcuts-group{display:flex;flex-direction:column;gap:4px}.shortcut-item{display:flex;justify-content:space-between;align-items:center;padding:6px 8px;border-radius:4px;background:var(--kritzel-settings-shortcut-item-bg, rgba(0, 0, 0, 0.02))}.shortcut-label{font-size:14px;color:var(--kritzel-settings-content-text-color, #666666)}.shortcut-key{font-family:monospace;font-size:12px;padding:2px 8px;border-radius:4px;background:var(--kritzel-settings-shortcut-key-bg, #f0f0f0);color:var(--kritzel-settings-shortcut-key-color, #333333);border:1px solid var(--kritzel-settings-shortcut-key-border, #ddd)}`;
|
|
31723
31723
|
|