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,446 @@
|
|
|
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 { a as KritzelColorHelper } from './p-BmyTdQGy.js';
|
|
3
|
+
import { r as resolveTextToolAvailableFonts, K as KritzelFontRegistry } from './p-DJkKlUyZ.js';
|
|
4
|
+
import { d as defineCustomElement$b } from './p-CqLgB8JK.js';
|
|
5
|
+
import { d as defineCustomElement$a } from './p-Cymum41a.js';
|
|
6
|
+
import { d as defineCustomElement$9 } from './p-Df3BwVGy.js';
|
|
7
|
+
import { d as defineCustomElement$8 } from './p-B8Xi4Clg.js';
|
|
8
|
+
import { d as defineCustomElement$7 } from './p-djJSnjAX.js';
|
|
9
|
+
import { d as defineCustomElement$6 } from './p-BI2ng9I_.js';
|
|
10
|
+
import { d as defineCustomElement$5 } from './p-CdR76C4L.js';
|
|
11
|
+
import { d as defineCustomElement$4 } from './p-CXpv9Rxe.js';
|
|
12
|
+
import { d as defineCustomElement$3 } from './p-B6t5q-V4.js';
|
|
13
|
+
import { d as defineCustomElement$2 } from './p-BFYtCsZu.js';
|
|
14
|
+
import { d as defineCustomElement$1 } from './p-D82VaHce.js';
|
|
15
|
+
|
|
16
|
+
class KritzelToolConfigHelper {
|
|
17
|
+
static getToolConfig(tool) {
|
|
18
|
+
switch (tool?.toolType) {
|
|
19
|
+
case 'selection':
|
|
20
|
+
return 'getToolConfig' in tool && typeof tool.getToolConfig === 'function'
|
|
21
|
+
? tool.getToolConfig()
|
|
22
|
+
: null;
|
|
23
|
+
case 'brush':
|
|
24
|
+
return {
|
|
25
|
+
type: 'brush',
|
|
26
|
+
colorProperty: 'color',
|
|
27
|
+
sizeProperty: 'size',
|
|
28
|
+
opacityProperty: 'opacity',
|
|
29
|
+
paletteSource: 'palette',
|
|
30
|
+
sizesSource: 'sizes',
|
|
31
|
+
controls: [
|
|
32
|
+
{ type: 'stroke-size', propertyName: 'size' },
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
case 'line':
|
|
36
|
+
return {
|
|
37
|
+
type: 'line',
|
|
38
|
+
colorProperty: 'color',
|
|
39
|
+
sizeProperty: 'size',
|
|
40
|
+
opacityProperty: 'opacity',
|
|
41
|
+
paletteSource: 'palette',
|
|
42
|
+
sizesSource: 'sizes',
|
|
43
|
+
controls: [
|
|
44
|
+
{ type: 'stroke-size', propertyName: 'size' },
|
|
45
|
+
{ type: 'line-endings', propertyName: 'arrows', additionalProps: {} },
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
case 'shape':
|
|
49
|
+
return {
|
|
50
|
+
type: 'shape',
|
|
51
|
+
colorProperty: 'strokeColor',
|
|
52
|
+
sizeProperty: 'strokeWidth',
|
|
53
|
+
opacityProperty: 'opacity',
|
|
54
|
+
paletteSource: 'palette',
|
|
55
|
+
sizesSource: 'sizes',
|
|
56
|
+
controls: [
|
|
57
|
+
{ type: 'stroke-size', propertyName: 'strokeWidth' },
|
|
58
|
+
{ type: 'shape-fill', propertyName: 'fillColor', additionalProps: {} },
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
case 'text':
|
|
62
|
+
return {
|
|
63
|
+
type: 'text',
|
|
64
|
+
colorProperty: 'fontColor',
|
|
65
|
+
sizeProperty: 'fontSize',
|
|
66
|
+
opacityProperty: 'opacity',
|
|
67
|
+
paletteSource: 'palette',
|
|
68
|
+
sizesSource: 'sizes',
|
|
69
|
+
controls: [
|
|
70
|
+
{ type: 'font-size', propertyName: 'fontSize', additionalProps: {} },
|
|
71
|
+
{ type: 'font-family', propertyName: 'fontFamily' },
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
default:
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const kritzelToolConfigCss = () => `.expand-toggle{background:none;border:none;cursor:var(--kritzel-global-pointer-cursor, pointer);padding:0;margin:0;display:flex;align-items:center;justify-content:center;width:32px;height:32px;color:var(--kritzel-icon-color, currentColor);transition:transform 0.2s ease}.expand-toggle:hover{opacity:0.7}.expand-toggle:focus{outline:none}.expand-toggle:focus-visible{outline:2px solid var(--kritzel-focus-color, #007acc);outline-offset:2px}.expand-toggle:active{transform:scale(0.95)}.divider{height:1px;background-color:var(--kritzel-divider-color, #e0e0e0);margin:4px 0;width:100%}`;
|
|
81
|
+
|
|
82
|
+
const KritzelToolConfig = /*@__PURE__*/ proxyCustomElement(class KritzelToolConfig extends H {
|
|
83
|
+
constructor(registerHost) {
|
|
84
|
+
super();
|
|
85
|
+
if (registerHost !== false) {
|
|
86
|
+
this.__registerHost();
|
|
87
|
+
}
|
|
88
|
+
this.__attachShadow();
|
|
89
|
+
this.toolChange = createEvent(this, "toolChange");
|
|
90
|
+
this.displayValuesChange = createEvent(this, "displayValuesChange");
|
|
91
|
+
}
|
|
92
|
+
tool;
|
|
93
|
+
handleToolChange(newTool, oldTool) {
|
|
94
|
+
const newConfig = KritzelToolConfigHelper.getToolConfig(newTool);
|
|
95
|
+
// Maintain settings when switching between shape tools
|
|
96
|
+
if (oldTool && newTool && newConfig?.type === 'shape') {
|
|
97
|
+
const oldConfig = KritzelToolConfigHelper.getToolConfig(oldTool);
|
|
98
|
+
if (oldConfig?.type === 'shape') {
|
|
99
|
+
// Copy properties that should persist
|
|
100
|
+
const propsToCopy = [
|
|
101
|
+
newConfig.colorProperty, // strokeColor
|
|
102
|
+
newConfig.sizeProperty, // strokeWidth
|
|
103
|
+
newConfig.opacityProperty, // opacity
|
|
104
|
+
'fillColor' // shape specific
|
|
105
|
+
];
|
|
106
|
+
propsToCopy.forEach(prop => {
|
|
107
|
+
if (prop && oldTool[prop] !== undefined) {
|
|
108
|
+
newTool[prop] = oldTool[prop];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
this.config = newConfig;
|
|
114
|
+
if (this.config) {
|
|
115
|
+
this.updatePalette();
|
|
116
|
+
this.updateSizes();
|
|
117
|
+
this.currentOpacity = newTool[this.config.opacityProperty] ?? 1;
|
|
118
|
+
// Emit the values since they might have been updated from the old tool
|
|
119
|
+
this.emitDisplayValues();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
isExpanded = false;
|
|
123
|
+
theme;
|
|
124
|
+
engine;
|
|
125
|
+
/** Resolved localized strings keyed by term key, supplied by the editor. */
|
|
126
|
+
terms = {};
|
|
127
|
+
handleSelectionChangeBound = this.handleSelectionChange.bind(this);
|
|
128
|
+
onThemeChange() {
|
|
129
|
+
this.emitDisplayValues();
|
|
130
|
+
}
|
|
131
|
+
handleEngineChange(newEngine, oldEngine) {
|
|
132
|
+
if (oldEngine) {
|
|
133
|
+
oldEngine.removeEventListener('objectsSelectionChange', this.handleSelectionChangeBound);
|
|
134
|
+
}
|
|
135
|
+
if (newEngine) {
|
|
136
|
+
newEngine.addEventListener('objectsSelectionChange', this.handleSelectionChangeBound);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
toolChange;
|
|
140
|
+
displayValuesChange;
|
|
141
|
+
config;
|
|
142
|
+
palette = [];
|
|
143
|
+
sizes = [];
|
|
144
|
+
currentOpacity = 1;
|
|
145
|
+
updateTrigger = 0;
|
|
146
|
+
getFontOptionsFromTool() {
|
|
147
|
+
const configuredFonts = resolveTextToolAvailableFonts(this.tool.availableFonts).map(font => {
|
|
148
|
+
const registeredFont = typeof font === 'string'
|
|
149
|
+
? {
|
|
150
|
+
family: font,
|
|
151
|
+
label: font,
|
|
152
|
+
cssFontFamily: font,
|
|
153
|
+
}
|
|
154
|
+
: {
|
|
155
|
+
family: font.family,
|
|
156
|
+
label: font.label ?? font.family,
|
|
157
|
+
cssFontFamily: font.cssFontFamily ?? font.family,
|
|
158
|
+
};
|
|
159
|
+
return {
|
|
160
|
+
value: registeredFont.family,
|
|
161
|
+
label: registeredFont.label,
|
|
162
|
+
cssFontFamily: registeredFont.cssFontFamily,
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
const mergedFonts = [...configuredFonts];
|
|
166
|
+
const seenFonts = new Set(mergedFonts.map(font => font.value.trim().toLocaleLowerCase()));
|
|
167
|
+
for (const font of KritzelFontRegistry.list()) {
|
|
168
|
+
const normalizedValue = font.family.trim().toLocaleLowerCase();
|
|
169
|
+
if (seenFonts.has(normalizedValue)) {
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
seenFonts.add(normalizedValue);
|
|
173
|
+
mergedFonts.push({
|
|
174
|
+
value: font.family,
|
|
175
|
+
label: font.label,
|
|
176
|
+
cssFontFamily: font.cssFontFamily,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
return mergedFonts;
|
|
180
|
+
}
|
|
181
|
+
handleSelectionChange() {
|
|
182
|
+
if (this.tool?.toolType === 'selection') {
|
|
183
|
+
this.config = KritzelToolConfigHelper.getToolConfig(this.tool);
|
|
184
|
+
if (this.config) {
|
|
185
|
+
this.updatePalette();
|
|
186
|
+
this.updateSizes();
|
|
187
|
+
this.currentOpacity = this.tool[this.config.opacityProperty] ?? 1;
|
|
188
|
+
this.emitDisplayValues();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
disconnectedCallback() {
|
|
193
|
+
if (this.engine) {
|
|
194
|
+
this.engine.removeEventListener('objectsSelectionChange', this.handleSelectionChangeBound);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
componentWillLoad() {
|
|
198
|
+
this.config = KritzelToolConfigHelper.getToolConfig(this.tool);
|
|
199
|
+
if (this.config) {
|
|
200
|
+
this.updatePalette();
|
|
201
|
+
this.updateSizes();
|
|
202
|
+
this.currentOpacity = this.tool[this.config.opacityProperty] ?? 1;
|
|
203
|
+
this.emitDisplayValues();
|
|
204
|
+
}
|
|
205
|
+
if (this.engine) {
|
|
206
|
+
this.engine.addEventListener('objectsSelectionChange', this.handleSelectionChangeBound);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
emitDisplayValues() {
|
|
210
|
+
if (!this.config)
|
|
211
|
+
return;
|
|
212
|
+
const color = this.tool[this.config.colorProperty];
|
|
213
|
+
const opacity = this.currentOpacity;
|
|
214
|
+
const size = this.tool[this.config.sizeProperty];
|
|
215
|
+
const displayValues = {
|
|
216
|
+
color: KritzelColorHelper.applyOpacity(color, opacity, this.theme),
|
|
217
|
+
size,
|
|
218
|
+
};
|
|
219
|
+
if (this.tool.toolType === 'text') {
|
|
220
|
+
displayValues.fontFamily = this.tool.fontFamily;
|
|
221
|
+
}
|
|
222
|
+
this.displayValuesChange.emit(displayValues);
|
|
223
|
+
}
|
|
224
|
+
updatePalette() {
|
|
225
|
+
if (!this.config)
|
|
226
|
+
return;
|
|
227
|
+
if (this.config.paletteSource === 'none') {
|
|
228
|
+
this.palette = [];
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
this.palette = this.tool.palette || [];
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
updateSizes() {
|
|
235
|
+
if (!this.config)
|
|
236
|
+
return;
|
|
237
|
+
if (this.config.sizesSource === 'none') {
|
|
238
|
+
this.sizes = [];
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
this.sizes = this.tool.sizes || [];
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
handleToggleExpand = () => {
|
|
245
|
+
this.isExpanded = !this.isExpanded;
|
|
246
|
+
};
|
|
247
|
+
handleColorChange = (event) => {
|
|
248
|
+
this.tool[this.config.colorProperty] = event.detail;
|
|
249
|
+
// Special handling for shape fill: when color (stroke) changes, update fill color if it's currently filled
|
|
250
|
+
if (this.config.type === 'shape' || this.config.type === 'selection') {
|
|
251
|
+
const tool = this.tool;
|
|
252
|
+
const isTransparent = typeof tool.fillColor === 'string' ? tool.fillColor === 'transparent' :
|
|
253
|
+
(tool.fillColor.light === 'transparent' && tool.fillColor.dark === 'transparent');
|
|
254
|
+
if (!isTransparent) {
|
|
255
|
+
tool.fillColor = event.detail;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
this.emitDisplayValues();
|
|
259
|
+
this.toolChange.emit(this.tool);
|
|
260
|
+
this.updateTrigger++;
|
|
261
|
+
};
|
|
262
|
+
handleSizeChange = (event) => {
|
|
263
|
+
this.tool[this.config.sizeProperty] = event.detail;
|
|
264
|
+
this.emitDisplayValues();
|
|
265
|
+
this.toolChange.emit(this.tool);
|
|
266
|
+
this.updateTrigger++;
|
|
267
|
+
};
|
|
268
|
+
handleOpacityChange = (event) => {
|
|
269
|
+
this.tool[this.config.opacityProperty] = event.detail;
|
|
270
|
+
this.currentOpacity = event.detail;
|
|
271
|
+
this.emitDisplayValues();
|
|
272
|
+
this.toolChange.emit(this.tool);
|
|
273
|
+
};
|
|
274
|
+
handlePropertyChange = (propertyName, value) => {
|
|
275
|
+
// Special handling for shape fill
|
|
276
|
+
if ((this.config.type === 'shape' || this.config.type === 'selection') && propertyName === 'fillColor') {
|
|
277
|
+
const newFillColor = value === 'filled' ? this.tool[this.config.colorProperty] : { light: 'transparent', dark: 'transparent' };
|
|
278
|
+
this.tool.fillColor = newFillColor;
|
|
279
|
+
// When switching to fill mode, also update stroke color to match
|
|
280
|
+
if (value === 'filled') {
|
|
281
|
+
this.tool[this.config.colorProperty] = newFillColor;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
this.tool[propertyName] = value;
|
|
286
|
+
// Emit display values for font family changes
|
|
287
|
+
if (propertyName === 'fontFamily') {
|
|
288
|
+
this.emitDisplayValues();
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
this.toolChange.emit(this.tool);
|
|
292
|
+
this.updateTrigger++;
|
|
293
|
+
};
|
|
294
|
+
getShapeFillValue() {
|
|
295
|
+
const fillColor = this.tool.fillColor;
|
|
296
|
+
const isTransparent = typeof fillColor === 'string' ? fillColor === 'transparent' :
|
|
297
|
+
(fillColor.light === 'transparent' && fillColor.dark === 'transparent');
|
|
298
|
+
return isTransparent ? 'transparent' : 'filled';
|
|
299
|
+
}
|
|
300
|
+
renderControl(control) {
|
|
301
|
+
const value = this.tool[control.propertyName];
|
|
302
|
+
switch (control.type) {
|
|
303
|
+
case 'stroke-size':
|
|
304
|
+
return (h("kritzel-stroke-size", { key: control.type, sizes: this.sizes, selectedSize: value, onSizeChange: this.handleSizeChange }));
|
|
305
|
+
case 'font-size':
|
|
306
|
+
return (h("kritzel-font-size", { key: control.type, sizes: this.sizes, selectedSize: value, fontFamily: this.tool.fontFamily, onSizeChange: this.handleSizeChange }));
|
|
307
|
+
case 'line-endings':
|
|
308
|
+
return (h("kritzel-line-endings", { key: control.type, value: value, onValueChange: (event) => this.handlePropertyChange(control.propertyName, event.detail) }));
|
|
309
|
+
case 'shape-fill':
|
|
310
|
+
return (h("kritzel-shape-fill", { key: control.type, value: this.getShapeFillValue(), onValueChange: (event) => this.handlePropertyChange(control.propertyName, event.detail) }));
|
|
311
|
+
case 'font-family':
|
|
312
|
+
return (h("kritzel-font-family", { key: control.type, fontOptions: this.getFontOptionsFromTool(), selectedFontFamily: value, onFontFamilyChange: (event) => this.handlePropertyChange(control.propertyName, event.detail) }));
|
|
313
|
+
default:
|
|
314
|
+
return null;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
render() {
|
|
318
|
+
if (!this.config)
|
|
319
|
+
return null;
|
|
320
|
+
const shouldShowExpandButton = this.palette.length > 6 || this.config.type === 'text';
|
|
321
|
+
const shouldShowColorPalette = this.palette.length > 0;
|
|
322
|
+
// Separate size control from other controls
|
|
323
|
+
const sizeControl = this.config.controls.find(c => c.type === 'stroke-size' || c.type === 'font-size');
|
|
324
|
+
const otherControls = this.config.controls.filter(c => c.type !== 'stroke-size' && c.type !== 'font-size');
|
|
325
|
+
return (h(Host, null, h("div", { style: {
|
|
326
|
+
display: 'flex',
|
|
327
|
+
flexDirection: 'row',
|
|
328
|
+
gap: '8px',
|
|
329
|
+
width: '100%',
|
|
330
|
+
} }, h("div", { style: {
|
|
331
|
+
display: 'flex',
|
|
332
|
+
flexDirection: 'column',
|
|
333
|
+
gap: '12px',
|
|
334
|
+
flex: '1',
|
|
335
|
+
} }, shouldShowColorPalette && (h("kritzel-color-palette", { colors: this.palette, selectedColor: this.tool[this.config.colorProperty], isExpanded: this.isExpanded, isOpaque: true, opacity: this.currentOpacity, theme: this.theme, onColorChange: this.handleColorChange })), sizeControl && this.renderControl(sizeControl), h("kritzel-opacity-slider", { value: this.tool[this.config.opacityProperty], previewColor: this.tool[this.config.colorProperty], onValueChange: this.handleOpacityChange }), otherControls.map((control) => [
|
|
336
|
+
h("div", { class: "divider" }),
|
|
337
|
+
this.renderControl(control),
|
|
338
|
+
])), shouldShowExpandButton && (h("div", { style: {
|
|
339
|
+
display: 'flex',
|
|
340
|
+
alignItems: 'flex-start',
|
|
341
|
+
} }, h("button", { class: "expand-toggle", onClick: this.handleToggleExpand, title: this.isExpanded ? (this.terms['toolConfig.collapse'] ?? 'Collapse') : (this.terms['toolConfig.expand'] ?? 'Expand') }, h("kritzel-icon", { name: this.isExpanded ? 'chevron-up' : 'chevron-down' })))))));
|
|
342
|
+
}
|
|
343
|
+
static get watchers() { return {
|
|
344
|
+
"tool": [{
|
|
345
|
+
"handleToolChange": 0
|
|
346
|
+
}],
|
|
347
|
+
"theme": [{
|
|
348
|
+
"onThemeChange": 0
|
|
349
|
+
}],
|
|
350
|
+
"engine": [{
|
|
351
|
+
"handleEngineChange": 0
|
|
352
|
+
}]
|
|
353
|
+
}; }
|
|
354
|
+
static get style() { return kritzelToolConfigCss(); }
|
|
355
|
+
}, [513, "kritzel-tool-config", {
|
|
356
|
+
"tool": [1040],
|
|
357
|
+
"isExpanded": [1028, "is-expanded"],
|
|
358
|
+
"theme": [1],
|
|
359
|
+
"engine": [16],
|
|
360
|
+
"terms": [16],
|
|
361
|
+
"config": [32],
|
|
362
|
+
"palette": [32],
|
|
363
|
+
"sizes": [32],
|
|
364
|
+
"currentOpacity": [32],
|
|
365
|
+
"updateTrigger": [32]
|
|
366
|
+
}, undefined, {
|
|
367
|
+
"tool": [{
|
|
368
|
+
"handleToolChange": 0
|
|
369
|
+
}],
|
|
370
|
+
"theme": [{
|
|
371
|
+
"onThemeChange": 0
|
|
372
|
+
}],
|
|
373
|
+
"engine": [{
|
|
374
|
+
"handleEngineChange": 0
|
|
375
|
+
}]
|
|
376
|
+
}]);
|
|
377
|
+
function defineCustomElement() {
|
|
378
|
+
if (typeof customElements === "undefined") {
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
const components = ["kritzel-tool-config", "kritzel-color", "kritzel-color-palette", "kritzel-dropdown", "kritzel-font", "kritzel-font-family", "kritzel-font-size", "kritzel-icon", "kritzel-line-endings", "kritzel-opacity-slider", "kritzel-shape-fill", "kritzel-stroke-size"];
|
|
382
|
+
components.forEach(tagName => { switch (tagName) {
|
|
383
|
+
case "kritzel-tool-config":
|
|
384
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
385
|
+
customElements.define(transformTag(tagName), KritzelToolConfig);
|
|
386
|
+
}
|
|
387
|
+
break;
|
|
388
|
+
case "kritzel-color":
|
|
389
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
390
|
+
defineCustomElement$b();
|
|
391
|
+
}
|
|
392
|
+
break;
|
|
393
|
+
case "kritzel-color-palette":
|
|
394
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
395
|
+
defineCustomElement$a();
|
|
396
|
+
}
|
|
397
|
+
break;
|
|
398
|
+
case "kritzel-dropdown":
|
|
399
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
400
|
+
defineCustomElement$9();
|
|
401
|
+
}
|
|
402
|
+
break;
|
|
403
|
+
case "kritzel-font":
|
|
404
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
405
|
+
defineCustomElement$8();
|
|
406
|
+
}
|
|
407
|
+
break;
|
|
408
|
+
case "kritzel-font-family":
|
|
409
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
410
|
+
defineCustomElement$7();
|
|
411
|
+
}
|
|
412
|
+
break;
|
|
413
|
+
case "kritzel-font-size":
|
|
414
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
415
|
+
defineCustomElement$6();
|
|
416
|
+
}
|
|
417
|
+
break;
|
|
418
|
+
case "kritzel-icon":
|
|
419
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
420
|
+
defineCustomElement$5();
|
|
421
|
+
}
|
|
422
|
+
break;
|
|
423
|
+
case "kritzel-line-endings":
|
|
424
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
425
|
+
defineCustomElement$4();
|
|
426
|
+
}
|
|
427
|
+
break;
|
|
428
|
+
case "kritzel-opacity-slider":
|
|
429
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
430
|
+
defineCustomElement$3();
|
|
431
|
+
}
|
|
432
|
+
break;
|
|
433
|
+
case "kritzel-shape-fill":
|
|
434
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
435
|
+
defineCustomElement$2();
|
|
436
|
+
}
|
|
437
|
+
break;
|
|
438
|
+
case "kritzel-stroke-size":
|
|
439
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
440
|
+
defineCustomElement$1();
|
|
441
|
+
}
|
|
442
|
+
break;
|
|
443
|
+
} });
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export { KritzelToolConfigHelper as K, KritzelToolConfig as a, defineCustomElement as d };
|
|
@@ -1 +1,77 @@
|
|
|
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
|
+
|
|
3
|
+
const kritzelInputCss = () => `:host{display:block}.input-container{display:flex;flex-direction:column;gap:6px}.input-label{font-size:14px;font-weight:500;color:var(--kritzel-text-input-label-color, #333333)}.input-wrapper{display:flex;align-items:center;border:1px solid var(--kritzel-text-input-border-color, #ebebeb);border-radius:var(--kritzel-text-input-border-radius, 6px);overflow:hidden;background:var(--kritzel-text-input-background, #ffffff);transition:border-color 150ms ease}.input-wrapper:hover:not(:focus-within){border-color:var(--kritzel-text-input-hover-border-color, #cccccc)}.input-wrapper:focus-within{border-color:var(--kritzel-text-input-focus-border-color, #007AFF);border-width:2px}.text-input{flex:1;padding:10px 12px;border:none;outline:none;font-size:14px;font-family:inherit;background:transparent;color:var(--kritzel-text-input-text-color, #333333);box-sizing:border-box}.text-input::placeholder{color:var(--kritzel-text-input-placeholder-color, #999999)}.text-input::selection{background-color:var(--kritzel-text-input-selection-background, #007AFF);color:var(--kritzel-text-input-selection-color, #ffffff)}.text-input:disabled{cursor:not-allowed;opacity:0.6}.input-suffix{padding:10px 12px;background:var(--kritzel-text-input-suffix-background, #f5f5f5);color:var(--kritzel-text-input-suffix-color, #666666);font-size:14px;border-left:1px solid var(--kritzel-text-input-border-color, #ebebeb);flex-shrink:0}`;
|
|
4
|
+
|
|
5
|
+
const KritzelInput = /*@__PURE__*/ proxyCustomElement(class KritzelInput extends H {
|
|
6
|
+
constructor(registerHost) {
|
|
7
|
+
super();
|
|
8
|
+
if (registerHost !== false) {
|
|
9
|
+
this.__registerHost();
|
|
10
|
+
}
|
|
11
|
+
this.__attachShadow();
|
|
12
|
+
this.valueChange = createEvent(this, "valueChange");
|
|
13
|
+
}
|
|
14
|
+
/** Current text value */
|
|
15
|
+
value = '';
|
|
16
|
+
/** Label text displayed above the input */
|
|
17
|
+
label = '';
|
|
18
|
+
/** Placeholder text shown when input is empty */
|
|
19
|
+
placeholder = '';
|
|
20
|
+
/** Suffix text displayed after the input (e.g., file extension) */
|
|
21
|
+
suffix = '';
|
|
22
|
+
/** Input type */
|
|
23
|
+
type = 'text';
|
|
24
|
+
/** Whether the input is disabled */
|
|
25
|
+
disabled = false;
|
|
26
|
+
/** Emitted when the value changes */
|
|
27
|
+
valueChange;
|
|
28
|
+
inputValue = '';
|
|
29
|
+
onValueChange(newValue) {
|
|
30
|
+
this.inputValue = newValue ?? '';
|
|
31
|
+
}
|
|
32
|
+
componentWillLoad() {
|
|
33
|
+
this.inputValue = this.value ?? '';
|
|
34
|
+
}
|
|
35
|
+
handleInput = (event) => {
|
|
36
|
+
const input = event.target;
|
|
37
|
+
this.inputValue = input.value;
|
|
38
|
+
this.value = input.value;
|
|
39
|
+
this.valueChange.emit(input.value);
|
|
40
|
+
};
|
|
41
|
+
render() {
|
|
42
|
+
return (h(Host, { key: 'a59aa026922a3267ec7e6177973e80edfa97202c' }, h("div", { key: '46b1f191072bfb2a26579a329f8fd6ec86ca3ef9', class: "input-container" }, this.label && h("label", { key: '5409f811792034be56c3269b31ff374d8ed33de2', class: "input-label" }, this.label), h("div", { key: 'f51219b2a6384aeee63a7c8214821abd853a0ea5', class: { 'input-wrapper': true, 'has-suffix': !!this.suffix } }, h("input", { key: '05c93a526aa2f2d757a7c139fa3a47d84a4e2d95', type: this.type, class: "text-input", value: this.inputValue, placeholder: this.placeholder, disabled: this.disabled, onInput: this.handleInput }), this.suffix && h("span", { key: '91b60b25a7ff750720ff1961e224a035a2d86096', class: "input-suffix" }, this.suffix)))));
|
|
43
|
+
}
|
|
44
|
+
static get watchers() { return {
|
|
45
|
+
"value": [{
|
|
46
|
+
"onValueChange": 0
|
|
47
|
+
}]
|
|
48
|
+
}; }
|
|
49
|
+
static get style() { return kritzelInputCss(); }
|
|
50
|
+
}, [513, "kritzel-input", {
|
|
51
|
+
"value": [1025],
|
|
52
|
+
"label": [1],
|
|
53
|
+
"placeholder": [1],
|
|
54
|
+
"suffix": [1],
|
|
55
|
+
"type": [1],
|
|
56
|
+
"disabled": [4],
|
|
57
|
+
"inputValue": [32]
|
|
58
|
+
}, undefined, {
|
|
59
|
+
"value": [{
|
|
60
|
+
"onValueChange": 0
|
|
61
|
+
}]
|
|
62
|
+
}]);
|
|
63
|
+
function defineCustomElement() {
|
|
64
|
+
if (typeof customElements === "undefined") {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const components = ["kritzel-input"];
|
|
68
|
+
components.forEach(tagName => { switch (tagName) {
|
|
69
|
+
case "kritzel-input":
|
|
70
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
71
|
+
customElements.define(transformTag(tagName), KritzelInput);
|
|
72
|
+
}
|
|
73
|
+
break;
|
|
74
|
+
} });
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { KritzelInput as K, defineCustomElement as d };
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/** Current schema version for the app-state Y.Doc (workspace list & settings). */
|
|
2
|
+
const CURRENT_APP_STATE_SCHEMA_VERSION = 2;
|
|
3
|
+
/** Current schema version for workspace Y.Docs (drawable objects). */
|
|
4
|
+
const CURRENT_WORKSPACE_SCHEMA_VERSION = 2;
|
|
5
|
+
|
|
6
|
+
export { CURRENT_APP_STATE_SCHEMA_VERSION as C, CURRENT_WORKSPACE_SCHEMA_VERSION as a };
|
|
@@ -1 +1,57 @@
|
|
|
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
|
+
|
|
3
|
+
const kritzelSlideToggleCss = () => `:host{display:inline-flex;align-items:center;cursor:var(--kritzel-global-pointer-cursor, pointer);outline:none;z-index:1;-webkit-tap-highlight-color:transparent}:host(:focus-visible) .toggle-track{box-shadow:0 0 0 2px var(--kritzel-global-focus-ring-color, rgba(0, 122, 255, 0.3))}:host(.disabled){opacity:0.5;pointer-events:none;cursor:default}.toggle-track{position:relative;width:var(--kritzel-slide-toggle-width, 40px);height:var(--kritzel-slide-toggle-height, 22px);background-color:var(--kritzel-slide-toggle-track-color, #ccc);border-radius:var(--kritzel-slide-toggle-border-radius, 11px);transition:background-color var(--kritzel-slide-toggle-transition-duration, 0.2s) ease}:host(.checked) .toggle-track{background-color:var(--kritzel-slide-toggle-track-checked-color, #007AFF)}.toggle-thumb{position:absolute;top:50%;left:2px;transform:translateY(-50%);width:var(--kritzel-slide-toggle-thumb-size, 18px);height:var(--kritzel-slide-toggle-thumb-size, 18px);background-color:var(--kritzel-slide-toggle-thumb-color, #fff);border-radius:50%;box-shadow:0 1px 3px rgba(0, 0, 0, 0.2);transition:left var(--kritzel-slide-toggle-transition-duration, 0.2s) ease}:host(.checked) .toggle-thumb{left:calc(var(--kritzel-slide-toggle-width, 40px) - var(--kritzel-slide-toggle-thumb-size, 18px) - 2px)}`;
|
|
4
|
+
|
|
5
|
+
const KritzelSlideToggle = /*@__PURE__*/ proxyCustomElement(class KritzelSlideToggle extends H {
|
|
6
|
+
constructor(registerHost) {
|
|
7
|
+
super();
|
|
8
|
+
if (registerHost !== false) {
|
|
9
|
+
this.__registerHost();
|
|
10
|
+
}
|
|
11
|
+
this.__attachShadow();
|
|
12
|
+
this.checkedChange = createEvent(this, "checkedChange");
|
|
13
|
+
}
|
|
14
|
+
/** Whether the toggle is checked/on */
|
|
15
|
+
checked = false;
|
|
16
|
+
/** Whether the toggle is disabled */
|
|
17
|
+
disabled = false;
|
|
18
|
+
/** Label text for accessibility (screen readers) */
|
|
19
|
+
label;
|
|
20
|
+
/** Emitted when the toggle state changes */
|
|
21
|
+
checkedChange;
|
|
22
|
+
handleToggle = () => {
|
|
23
|
+
if (this.disabled)
|
|
24
|
+
return;
|
|
25
|
+
this.checked = !this.checked;
|
|
26
|
+
this.checkedChange.emit(this.checked);
|
|
27
|
+
};
|
|
28
|
+
handleKeyDown = (event) => {
|
|
29
|
+
if (event.key === ' ' || event.key === 'Enter') {
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
this.handleToggle();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
render() {
|
|
35
|
+
return (h(Host, { key: 'e132e2614dcf2c7afc51e8aa064de36ea4a84710', class: { checked: this.checked, disabled: this.disabled }, tabIndex: this.disabled ? -1 : 0, role: "switch", "aria-checked": this.checked ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', "aria-label": this.label, onClick: this.handleToggle, onKeyDown: this.handleKeyDown }, h("div", { key: 'c7857aa2b747aba1851f7df1bde3d0469898d32a', class: "toggle-track" }, h("div", { key: '6beb1821fdc265b4fb5d0a6813a33fb768366984', class: "toggle-thumb" }))));
|
|
36
|
+
}
|
|
37
|
+
static get style() { return kritzelSlideToggleCss(); }
|
|
38
|
+
}, [513, "kritzel-slide-toggle", {
|
|
39
|
+
"checked": [1028],
|
|
40
|
+
"disabled": [4],
|
|
41
|
+
"label": [1]
|
|
42
|
+
}]);
|
|
43
|
+
function defineCustomElement() {
|
|
44
|
+
if (typeof customElements === "undefined") {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const components = ["kritzel-slide-toggle"];
|
|
48
|
+
components.forEach(tagName => { switch (tagName) {
|
|
49
|
+
case "kritzel-slide-toggle":
|
|
50
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
51
|
+
customElements.define(transformTag(tagName), KritzelSlideToggle);
|
|
52
|
+
}
|
|
53
|
+
break;
|
|
54
|
+
} });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { KritzelSlideToggle as K, defineCustomElement as d };
|