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,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 };
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h, d as Host, t as transformTag } from './p-B43upypT.js';
|
|
2
|
+
import { a as CURRENT_WORKSPACE_SCHEMA_VERSION, C as CURRENT_APP_STATE_SCHEMA_VERSION } from './p-CW-VyJgK.js';
|
|
3
|
+
import { d as defineCustomElement$6 } from './p-DX2nriaq.js';
|
|
4
|
+
import { d as defineCustomElement$5 } from './p-Df3BwVGy.js';
|
|
5
|
+
import { d as defineCustomElement$4 } from './p-CdR76C4L.js';
|
|
6
|
+
import { d as defineCustomElement$3 } from './p-BsANVili.js';
|
|
7
|
+
import { d as defineCustomElement$2 } from './p-BDzlx2hB.js';
|
|
8
|
+
import { d as defineCustomElement$1 } from './p-CWRSGYOE.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The current version of the Kritzel library.
|
|
12
|
+
* This file is auto-generated by the version bump scripts.
|
|
13
|
+
* Do not modify manually.
|
|
14
|
+
*/
|
|
15
|
+
const KRITZEL_VERSION = '0.4.5';
|
|
16
|
+
|
|
17
|
+
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)}`;
|
|
18
|
+
|
|
19
|
+
const DEFAULT_SCALE_MIN = 0.0001;
|
|
20
|
+
const DEFAULT_SCALE_MAX = 1000;
|
|
21
|
+
const DEFAULT_LOCK_DRAWING_SCALE = true;
|
|
22
|
+
const DEFAULT_VIEWPORT_BOUNDARY_LEFT = -Infinity;
|
|
23
|
+
const DEFAULT_VIEWPORT_BOUNDARY_RIGHT = Infinity;
|
|
24
|
+
const DEFAULT_VIEWPORT_BOUNDARY_TOP = -Infinity;
|
|
25
|
+
const DEFAULT_VIEWPORT_BOUNDARY_BOTTOM = Infinity;
|
|
26
|
+
const DEFAULT_DEBUG_INFO = {
|
|
27
|
+
showViewportInfo: false,
|
|
28
|
+
showObjectInfo: false,
|
|
29
|
+
showSyncProviderInfo: true,
|
|
30
|
+
showMigrationInfo: true,
|
|
31
|
+
showAssetResolverInfo: false,
|
|
32
|
+
};
|
|
33
|
+
const SETTINGS_CATEGORY_IDS = ['general', 'viewport', 'shortcuts', 'developer', 'about'];
|
|
34
|
+
const KritzelSettings = /*@__PURE__*/ proxyCustomElement(class KritzelSettings extends H {
|
|
35
|
+
constructor(registerHost) {
|
|
36
|
+
super();
|
|
37
|
+
if (registerHost !== false) {
|
|
38
|
+
this.__registerHost();
|
|
39
|
+
}
|
|
40
|
+
this.__attachShadow();
|
|
41
|
+
this.settingsChange = createEvent(this, "settingsChange");
|
|
42
|
+
}
|
|
43
|
+
get host() { return this; }
|
|
44
|
+
/** Keyboard shortcuts to display in the settings dialog */
|
|
45
|
+
availableThemes = ['light', 'dark'];
|
|
46
|
+
/** Available locales as `{ code, label }` options for the language selector. */
|
|
47
|
+
availableLocales = [];
|
|
48
|
+
shortcuts = [];
|
|
49
|
+
/** Resolved localized strings keyed by term key, supplied by the editor. */
|
|
50
|
+
terms = {};
|
|
51
|
+
/** Current settings values. Used to initialize and sync the component's internal state. */
|
|
52
|
+
settings;
|
|
53
|
+
onSettingsPropChange(newSettings) {
|
|
54
|
+
if (newSettings) {
|
|
55
|
+
this.applySettings(newSettings);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
isDialogOpen = false;
|
|
59
|
+
selectedCategoryId = SETTINGS_CATEGORY_IDS[0];
|
|
60
|
+
scaleMin = DEFAULT_SCALE_MIN;
|
|
61
|
+
scaleMax = DEFAULT_SCALE_MAX;
|
|
62
|
+
lockDrawingScale = DEFAULT_LOCK_DRAWING_SCALE;
|
|
63
|
+
theme = 'light';
|
|
64
|
+
locale = 'en';
|
|
65
|
+
viewportBoundaryLeft = DEFAULT_VIEWPORT_BOUNDARY_LEFT;
|
|
66
|
+
viewportBoundaryRight = DEFAULT_VIEWPORT_BOUNDARY_RIGHT;
|
|
67
|
+
viewportBoundaryTop = DEFAULT_VIEWPORT_BOUNDARY_TOP;
|
|
68
|
+
viewportBoundaryBottom = DEFAULT_VIEWPORT_BOUNDARY_BOTTOM;
|
|
69
|
+
debugInfo = { ...DEFAULT_DEBUG_INFO };
|
|
70
|
+
/** Emitted when settings change */
|
|
71
|
+
settingsChange;
|
|
72
|
+
componentWillLoad() {
|
|
73
|
+
if (this.settings) {
|
|
74
|
+
this.applySettings(this.settings);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
applySettings(settings) {
|
|
78
|
+
if (typeof settings.scaleMin === 'number') {
|
|
79
|
+
this.scaleMin = settings.scaleMin;
|
|
80
|
+
}
|
|
81
|
+
if (typeof settings.scaleMax === 'number') {
|
|
82
|
+
this.scaleMax = settings.scaleMax;
|
|
83
|
+
}
|
|
84
|
+
if (typeof settings.lockDrawingScale === 'boolean') {
|
|
85
|
+
this.lockDrawingScale = settings.lockDrawingScale;
|
|
86
|
+
}
|
|
87
|
+
if (typeof settings.theme === 'string') {
|
|
88
|
+
this.theme = settings.theme;
|
|
89
|
+
}
|
|
90
|
+
if (typeof settings.locale === 'string') {
|
|
91
|
+
this.locale = settings.locale;
|
|
92
|
+
}
|
|
93
|
+
if (typeof settings.viewportBoundaryLeft === 'number') {
|
|
94
|
+
this.viewportBoundaryLeft = settings.viewportBoundaryLeft;
|
|
95
|
+
}
|
|
96
|
+
if (typeof settings.viewportBoundaryRight === 'number') {
|
|
97
|
+
this.viewportBoundaryRight = settings.viewportBoundaryRight;
|
|
98
|
+
}
|
|
99
|
+
if (typeof settings.viewportBoundaryTop === 'number') {
|
|
100
|
+
this.viewportBoundaryTop = settings.viewportBoundaryTop;
|
|
101
|
+
}
|
|
102
|
+
if (typeof settings.viewportBoundaryBottom === 'number') {
|
|
103
|
+
this.viewportBoundaryBottom = settings.viewportBoundaryBottom;
|
|
104
|
+
}
|
|
105
|
+
if (settings.debugInfo) {
|
|
106
|
+
this.debugInfo = { ...DEFAULT_DEBUG_INFO, ...settings.debugInfo };
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
emitSettings() {
|
|
110
|
+
const settings = {
|
|
111
|
+
scaleMin: this.scaleMin,
|
|
112
|
+
scaleMax: this.scaleMax,
|
|
113
|
+
lockDrawingScale: this.lockDrawingScale,
|
|
114
|
+
theme: this.theme,
|
|
115
|
+
locale: this.locale,
|
|
116
|
+
viewportBoundaryLeft: this.viewportBoundaryLeft,
|
|
117
|
+
viewportBoundaryRight: this.viewportBoundaryRight,
|
|
118
|
+
viewportBoundaryTop: this.viewportBoundaryTop,
|
|
119
|
+
viewportBoundaryBottom: this.viewportBoundaryBottom,
|
|
120
|
+
debugInfo: this.debugInfo,
|
|
121
|
+
};
|
|
122
|
+
this.settingsChange.emit(settings);
|
|
123
|
+
}
|
|
124
|
+
handleScaleMinChange = (event) => {
|
|
125
|
+
this.scaleMin = event.detail;
|
|
126
|
+
this.emitSettings();
|
|
127
|
+
};
|
|
128
|
+
handleScaleMaxChange = (event) => {
|
|
129
|
+
this.scaleMax = event.detail;
|
|
130
|
+
this.emitSettings();
|
|
131
|
+
};
|
|
132
|
+
handleLockDrawingScaleChange = (event) => {
|
|
133
|
+
this.lockDrawingScale = event.detail;
|
|
134
|
+
this.emitSettings();
|
|
135
|
+
};
|
|
136
|
+
handleThemeChange = (event) => {
|
|
137
|
+
this.theme = event.detail;
|
|
138
|
+
this.emitSettings();
|
|
139
|
+
};
|
|
140
|
+
handleLocaleChange = (event) => {
|
|
141
|
+
this.locale = event.detail;
|
|
142
|
+
this.emitSettings();
|
|
143
|
+
};
|
|
144
|
+
handleViewportBoundaryLeftChange = (event) => {
|
|
145
|
+
this.viewportBoundaryLeft = event.detail ?? DEFAULT_VIEWPORT_BOUNDARY_LEFT;
|
|
146
|
+
this.emitSettings();
|
|
147
|
+
};
|
|
148
|
+
handleViewportBoundaryRightChange = (event) => {
|
|
149
|
+
this.viewportBoundaryRight = event.detail ?? DEFAULT_VIEWPORT_BOUNDARY_RIGHT;
|
|
150
|
+
this.emitSettings();
|
|
151
|
+
};
|
|
152
|
+
handleViewportBoundaryTopChange = (event) => {
|
|
153
|
+
this.viewportBoundaryTop = event.detail ?? DEFAULT_VIEWPORT_BOUNDARY_TOP;
|
|
154
|
+
this.emitSettings();
|
|
155
|
+
};
|
|
156
|
+
handleViewportBoundaryBottomChange = (event) => {
|
|
157
|
+
this.viewportBoundaryBottom = event.detail ?? DEFAULT_VIEWPORT_BOUNDARY_BOTTOM;
|
|
158
|
+
this.emitSettings();
|
|
159
|
+
};
|
|
160
|
+
handleDebugInfoChange = (key) => (event) => {
|
|
161
|
+
this.debugInfo = { ...this.debugInfo, [key]: event.detail };
|
|
162
|
+
this.emitSettings();
|
|
163
|
+
};
|
|
164
|
+
async open() {
|
|
165
|
+
this.isDialogOpen = true;
|
|
166
|
+
}
|
|
167
|
+
closeDialog = () => {
|
|
168
|
+
this.isDialogOpen = false;
|
|
169
|
+
};
|
|
170
|
+
handleCategorySelect = (event) => {
|
|
171
|
+
this.selectedCategoryId = event.detail.item.id;
|
|
172
|
+
};
|
|
173
|
+
formatKeyCombo(shortcut) {
|
|
174
|
+
const parts = [];
|
|
175
|
+
if (shortcut.ctrl)
|
|
176
|
+
parts.push('Ctrl');
|
|
177
|
+
if (shortcut.shift)
|
|
178
|
+
parts.push('Shift');
|
|
179
|
+
parts.push(this.formatKey(shortcut.key));
|
|
180
|
+
return parts.join('+');
|
|
181
|
+
}
|
|
182
|
+
formatKey(key) {
|
|
183
|
+
const keyMap = {
|
|
184
|
+
'Escape': 'Esc',
|
|
185
|
+
'Delete': 'Del',
|
|
186
|
+
' ': 'Space',
|
|
187
|
+
};
|
|
188
|
+
return keyMap[key] ?? key.toUpperCase();
|
|
189
|
+
}
|
|
190
|
+
groupShortcutsByCategory() {
|
|
191
|
+
const grouped = new Map();
|
|
192
|
+
for (const shortcut of this.shortcuts) {
|
|
193
|
+
const existing = grouped.get(shortcut.category) || [];
|
|
194
|
+
existing.push(shortcut);
|
|
195
|
+
grouped.set(shortcut.category, existing);
|
|
196
|
+
}
|
|
197
|
+
return grouped;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Resolves a localized string from the supplied {@link terms} map, falling
|
|
201
|
+
* back to the provided English default when the key is missing.
|
|
202
|
+
*/
|
|
203
|
+
t(key, fallback) {
|
|
204
|
+
return this.terms[key] ?? fallback;
|
|
205
|
+
}
|
|
206
|
+
get categories() {
|
|
207
|
+
const icons = {
|
|
208
|
+
general: 'settings',
|
|
209
|
+
viewport: 'viewport',
|
|
210
|
+
shortcuts: 'command',
|
|
211
|
+
developer: 'braces',
|
|
212
|
+
about: 'info',
|
|
213
|
+
};
|
|
214
|
+
const labels = {
|
|
215
|
+
general: { key: 'settings.categories.general', fallback: 'General' },
|
|
216
|
+
viewport: { key: 'settings.categories.viewport', fallback: 'Viewport' },
|
|
217
|
+
shortcuts: { key: 'settings.categories.shortcuts', fallback: 'Keyboard Shortcuts' },
|
|
218
|
+
developer: { key: 'settings.categories.developer', fallback: 'Developer Options' },
|
|
219
|
+
about: { key: 'settings.categories.about', fallback: 'About' },
|
|
220
|
+
};
|
|
221
|
+
return SETTINGS_CATEGORY_IDS.map(id => ({
|
|
222
|
+
id,
|
|
223
|
+
label: this.t(labels[id].key, labels[id].fallback),
|
|
224
|
+
icon: icons[id],
|
|
225
|
+
}));
|
|
226
|
+
}
|
|
227
|
+
renderCategoryContent() {
|
|
228
|
+
switch (this.selectedCategoryId) {
|
|
229
|
+
case 'general':
|
|
230
|
+
return (h("div", { class: "settings-content" }, h("h3", null, this.t('settings.general.title', 'General Settings')), h("div", { class: "settings-group" }, h("div", { class: "settings-item" }, h("label", { class: "settings-label" }, this.t('settings.general.theme.label', 'Theme')), h("p", { class: "settings-description" }, this.t('settings.general.theme.description', 'Select a registered color theme for the editor interface.')), h("kritzel-dropdown", { options: this.availableThemes.map(t => ({ value: t, label: t })), value: this.theme, onValueChanged: this.handleThemeChange })), this.availableLocales.length > 0 && (h("div", { class: "settings-item" }, h("label", { class: "settings-label" }, this.t('settings.general.language.label', 'Language')), h("p", { class: "settings-description" }, this.t('settings.general.language.description', 'Select the display language for the editor interface.')), h("kritzel-dropdown", { options: this.availableLocales.map(l => ({ value: l.code, label: l.label })), value: this.locale, onValueChanged: this.handleLocaleChange }))), h("div", { class: "settings-item" }, h("label", { class: "settings-label" }, this.t('settings.general.lockDrawingScale.label', 'Lock Drawing Scale')), h("p", { class: "settings-description" }, this.t('settings.general.lockDrawingScale.description', 'When enabled, drawn objects maintain a fixed visual size regardless of the current zoom level.')), h("kritzel-slide-toggle", { checked: this.lockDrawingScale, label: this.t('settings.general.lockDrawingScale.label', 'Lock Drawing Scale'), onCheckedChange: this.handleLockDrawingScaleChange })))));
|
|
231
|
+
case 'viewport':
|
|
232
|
+
return (h("div", { class: "settings-content" }, h("h3", null, this.t('settings.viewport.title', 'Viewport Settings')), h("div", { class: "settings-group" }, h("div", { class: "settings-item" }, h("label", { class: "settings-label" }, this.t('settings.viewport.minZoom.label', 'Minimum Zoom Level')), h("p", { class: "settings-description" }, this.t('settings.viewport.minZoom.description', 'Sets the minimum zoom level. Lower values allow zooming out further to see more of the canvas.')), h("kritzel-numeric-input", { value: this.scaleMin, min: 0.0001, max: 1, step: 0.0001, onValueChange: this.handleScaleMinChange })), h("div", { class: "settings-item" }, h("label", { class: "settings-label" }, this.t('settings.viewport.maxZoom.label', 'Maximum Zoom Level')), h("p", { class: "settings-description" }, this.t('settings.viewport.maxZoom.description', 'Sets the maximum zoom level. Higher values allow zooming in closer for detailed work.')), h("kritzel-numeric-input", { value: this.scaleMax, min: 1, max: 1000, step: 1, onValueChange: this.handleScaleMaxChange })), h("div", { class: "settings-item" }, h("label", { class: "settings-label" }, this.t('settings.viewport.boundaryLeft.label', 'Viewport Boundary Left')), h("p", { class: "settings-description" }, this.t('settings.viewport.boundaryLeft.description', 'Left boundary in world coordinates. Set to limit how far left the viewport can pan.')), h("kritzel-numeric-input", { value: this.viewportBoundaryLeft, step: 100, placeholder: this.t('settings.viewport.boundaryPlaceholder', 'Infinite'), onValueChange: this.handleViewportBoundaryLeftChange })), h("div", { class: "settings-item" }, h("label", { class: "settings-label" }, this.t('settings.viewport.boundaryRight.label', 'Viewport Boundary Right')), h("p", { class: "settings-description" }, this.t('settings.viewport.boundaryRight.description', 'Right boundary in world coordinates. Set to limit how far right the viewport can pan.')), h("kritzel-numeric-input", { value: this.viewportBoundaryRight, step: 100, placeholder: this.t('settings.viewport.boundaryPlaceholder', 'Infinite'), onValueChange: this.handleViewportBoundaryRightChange })), h("div", { class: "settings-item" }, h("label", { class: "settings-label" }, this.t('settings.viewport.boundaryTop.label', 'Viewport Boundary Top')), h("p", { class: "settings-description" }, this.t('settings.viewport.boundaryTop.description', 'Top boundary in world coordinates. Set to limit how far up the viewport can pan.')), h("kritzel-numeric-input", { value: this.viewportBoundaryTop, step: 100, placeholder: this.t('settings.viewport.boundaryPlaceholder', 'Infinite'), onValueChange: this.handleViewportBoundaryTopChange })), h("div", { class: "settings-item" }, h("label", { class: "settings-label" }, this.t('settings.viewport.boundaryBottom.label', 'Viewport Boundary Bottom')), h("p", { class: "settings-description" }, this.t('settings.viewport.boundaryBottom.description', 'Bottom boundary in world coordinates. Set to limit how far down the viewport can pan.')), h("kritzel-numeric-input", { value: this.viewportBoundaryBottom, step: 100, placeholder: this.t('settings.viewport.boundaryPlaceholder', 'Infinite'), onValueChange: this.handleViewportBoundaryBottomChange })))));
|
|
233
|
+
case 'shortcuts':
|
|
234
|
+
return (h("div", { class: "settings-content" }, h("h3", null, this.t('settings.shortcuts.title', 'Keyboard Shortcuts')), h("div", { class: "shortcuts-list" }, Array.from(this.groupShortcutsByCategory()).map(([category, shortcuts]) => (h("div", { class: "shortcuts-category", key: category }, h("h4", { class: "shortcuts-category-title" }, category), h("div", { class: "shortcuts-group" }, shortcuts.map(shortcut => (h("div", { class: "shortcut-item", key: shortcut.key + shortcut.label }, h("span", { class: "shortcut-label" }, shortcut.label), h("kbd", { class: "shortcut-key" }, this.formatKeyCombo(shortcut))))))))))));
|
|
235
|
+
case 'developer':
|
|
236
|
+
return (h("div", { class: "settings-content" }, h("h3", null, this.t('settings.developer.title', 'Developer Options')), h("div", { class: "settings-group" }, h("div", { class: "settings-item" }, h("label", { class: "settings-label" }, this.t('settings.developer.showViewportInfo.label', 'Show Viewport Info')), h("p", { class: "settings-description" }, this.t('settings.developer.showViewportInfo.description', 'Display viewport debug information such as position, zoom level, and boundaries.')), h("kritzel-slide-toggle", { checked: this.debugInfo.showViewportInfo, label: this.t('settings.developer.showViewportInfo.label', 'Show Viewport Info'), onCheckedChange: this.handleDebugInfoChange('showViewportInfo') })), h("div", { class: "settings-item" }, h("label", { class: "settings-label" }, this.t('settings.developer.showObjectInfo.label', 'Show Object Info')), h("p", { class: "settings-description" }, this.t('settings.developer.showObjectInfo.description', 'Display debug information about objects on the canvas.')), h("kritzel-slide-toggle", { checked: this.debugInfo.showObjectInfo, label: this.t('settings.developer.showObjectInfo.label', 'Show Object Info'), onCheckedChange: this.handleDebugInfoChange('showObjectInfo') })), h("div", { class: "settings-item" }, h("label", { class: "settings-label" }, this.t('settings.developer.showSyncProviderInfo.label', 'Show Sync Provider Info')), h("p", { class: "settings-description" }, this.t('settings.developer.showSyncProviderInfo.description', 'Display debug information about the sync provider connection status.')), h("kritzel-slide-toggle", { checked: this.debugInfo.showSyncProviderInfo, label: this.t('settings.developer.showSyncProviderInfo.label', 'Show Sync Provider Info'), onCheckedChange: this.handleDebugInfoChange('showSyncProviderInfo') })), h("div", { class: "settings-item" }, h("label", { class: "settings-label" }, this.t('settings.developer.showMigrationInfo.label', 'Show Migration Info')), h("p", { class: "settings-description" }, this.t('settings.developer.showMigrationInfo.description', 'Display debug information about data migrations.')), h("kritzel-slide-toggle", { checked: this.debugInfo.showMigrationInfo, label: this.t('settings.developer.showMigrationInfo.label', 'Show Migration Info'), onCheckedChange: this.handleDebugInfoChange('showMigrationInfo') })))));
|
|
237
|
+
case 'about':
|
|
238
|
+
return (h("div", { class: "settings-content" }, h("h3", null, this.t('settings.about.title', 'About')), h("p", null, this.t('settings.about.description', 'Kritzel - A drawing application')), h("p", { class: "version-info" }, "Version ", KRITZEL_VERSION), h("p", { class: "version-info" }, "App-State Schema v", CURRENT_APP_STATE_SCHEMA_VERSION), h("p", { class: "version-info" }, "Workspace Schema v", CURRENT_WORKSPACE_SCHEMA_VERSION)));
|
|
239
|
+
default:
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
render() {
|
|
244
|
+
return (h(Host, { key: '1fb0bca35cb20633f017a927d39e2a66ebfb403b' }, h("kritzel-dialog", { key: '6366a8d8e7f65ef3f715248db3dc7c7e36dd3f4a', isOpen: this.isDialogOpen, dialogTitle: this.t('settings.dialogTitle', 'Settings'), size: "large", contained: true, onDialogClose: this.closeDialog }, h("kritzel-master-detail", { key: '2f4891d1ef0b3f130c591790b2e53e7264a61145', items: this.categories, selectedItemId: this.selectedCategoryId, onItemSelect: this.handleCategorySelect }, this.renderCategoryContent()))));
|
|
245
|
+
}
|
|
246
|
+
static get watchers() { return {
|
|
247
|
+
"settings": [{
|
|
248
|
+
"onSettingsPropChange": 0
|
|
249
|
+
}]
|
|
250
|
+
}; }
|
|
251
|
+
static get style() { return kritzelSettingsCss(); }
|
|
252
|
+
}, [513, "kritzel-settings", {
|
|
253
|
+
"availableThemes": [16],
|
|
254
|
+
"availableLocales": [16],
|
|
255
|
+
"shortcuts": [16],
|
|
256
|
+
"terms": [16],
|
|
257
|
+
"settings": [16],
|
|
258
|
+
"isDialogOpen": [32],
|
|
259
|
+
"selectedCategoryId": [32],
|
|
260
|
+
"scaleMin": [32],
|
|
261
|
+
"scaleMax": [32],
|
|
262
|
+
"lockDrawingScale": [32],
|
|
263
|
+
"theme": [32],
|
|
264
|
+
"locale": [32],
|
|
265
|
+
"viewportBoundaryLeft": [32],
|
|
266
|
+
"viewportBoundaryRight": [32],
|
|
267
|
+
"viewportBoundaryTop": [32],
|
|
268
|
+
"viewportBoundaryBottom": [32],
|
|
269
|
+
"debugInfo": [32],
|
|
270
|
+
"open": [64]
|
|
271
|
+
}, undefined, {
|
|
272
|
+
"settings": [{
|
|
273
|
+
"onSettingsPropChange": 0
|
|
274
|
+
}]
|
|
275
|
+
}]);
|
|
276
|
+
function defineCustomElement() {
|
|
277
|
+
if (typeof customElements === "undefined") {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
const components = ["kritzel-settings", "kritzel-dialog", "kritzel-dropdown", "kritzel-icon", "kritzel-master-detail", "kritzel-numeric-input", "kritzel-slide-toggle"];
|
|
281
|
+
components.forEach(tagName => { switch (tagName) {
|
|
282
|
+
case "kritzel-settings":
|
|
283
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
284
|
+
customElements.define(transformTag(tagName), KritzelSettings);
|
|
285
|
+
}
|
|
286
|
+
break;
|
|
287
|
+
case "kritzel-dialog":
|
|
288
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
289
|
+
defineCustomElement$6();
|
|
290
|
+
}
|
|
291
|
+
break;
|
|
292
|
+
case "kritzel-dropdown":
|
|
293
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
294
|
+
defineCustomElement$5();
|
|
295
|
+
}
|
|
296
|
+
break;
|
|
297
|
+
case "kritzel-icon":
|
|
298
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
299
|
+
defineCustomElement$4();
|
|
300
|
+
}
|
|
301
|
+
break;
|
|
302
|
+
case "kritzel-master-detail":
|
|
303
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
304
|
+
defineCustomElement$3();
|
|
305
|
+
}
|
|
306
|
+
break;
|
|
307
|
+
case "kritzel-numeric-input":
|
|
308
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
309
|
+
defineCustomElement$2();
|
|
310
|
+
}
|
|
311
|
+
break;
|
|
312
|
+
case "kritzel-slide-toggle":
|
|
313
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
314
|
+
defineCustomElement$1();
|
|
315
|
+
}
|
|
316
|
+
break;
|
|
317
|
+
} });
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export { KritzelSettings as K, 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 };
|