kritzel-stencil 0.3.8 → 0.3.10
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/index.cjs.js +2 -1
- package/dist/cjs/kritzel-active-users_42.cjs.entry.js +301 -126
- package/dist/cjs/kritzel-brush-style.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{schema.constants-rCfWpcBV.js → schema.constants-BNMNpzvA.js} +77 -12
- package/dist/cjs/stencil.cjs.js +1 -1
- package/dist/collection/classes/core/core.class.js +3 -0
- package/dist/collection/classes/handlers/context-menu.handler.js +54 -0
- package/dist/collection/classes/managers/theme.manager.js +47 -5
- package/dist/collection/classes/objects/selection-box.class.js +2 -2
- package/dist/collection/classes/objects/selection-group.class.js +3 -3
- package/dist/collection/classes/objects/text.class.js +8 -0
- package/dist/collection/classes/registries/icon-registry.class.js +2 -1
- package/dist/collection/classes/tools/text-tool.class.js +2 -0
- package/dist/collection/components/core/kritzel-awareness-cursors/kritzel-awareness-cursors.js +1 -1
- package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js +1 -1
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +168 -17
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +83 -1
- package/dist/collection/components/shared/kritzel-avatar/kritzel-avatar.js +3 -3
- package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.js +1 -1
- package/dist/collection/components/shared/kritzel-button/kritzel-button.js +2 -2
- package/dist/collection/components/shared/kritzel-color/kritzel-color.js +8 -8
- package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js +7 -7
- package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.js +7 -7
- package/dist/collection/components/shared/kritzel-font/kritzel-font.js +1 -1
- package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.js +1 -1
- package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js +1 -1
- package/dist/collection/components/shared/kritzel-input/kritzel-input.js +1 -1
- package/dist/collection/components/shared/kritzel-line-endings/kritzel-line-endings.js +2 -2
- package/dist/collection/components/shared/kritzel-master-detail/kritzel-master-detail.js +3 -3
- package/dist/collection/components/shared/kritzel-menu/kritzel-menu.js +1 -1
- package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.js +2 -2
- package/dist/collection/components/shared/kritzel-numeric-input/kritzel-numeric-input.js +1 -1
- package/dist/collection/components/shared/kritzel-opacity-slider/kritzel-opacity-slider.js +2 -1
- package/dist/collection/components/shared/kritzel-pill-tabs/kritzel-pill-tabs.js +1 -1
- package/dist/collection/components/shared/kritzel-portal/kritzel-portal.js +1 -1
- package/dist/collection/components/shared/kritzel-shape-fill/kritzel-shape-fill.js +2 -2
- package/dist/collection/components/shared/kritzel-slide-toggle/kritzel-slide-toggle.js +1 -1
- package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.js +1 -1
- package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js +1 -1
- package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js +2 -2
- package/dist/collection/components/ui/kritzel-back-to-content/kritzel-back-to-content.js +1 -1
- package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.js +94 -48
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.css +1 -1
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +15 -14
- package/dist/collection/components/ui/kritzel-current-user/kritzel-current-user.js +1 -1
- package/dist/collection/components/ui/kritzel-current-user-dialog/kritzel-current-user-dialog.js +1 -1
- package/dist/collection/components/ui/kritzel-export/kritzel-export.js +1 -1
- package/dist/collection/components/ui/kritzel-login-dialog/kritzel-login-dialog.js +1 -1
- package/dist/collection/components/ui/kritzel-more-menu/kritzel-more-menu.js +1 -1
- package/dist/collection/components/ui/kritzel-settings/kritzel-settings.js +28 -9
- package/dist/collection/components/ui/kritzel-share-dialog/kritzel-share-dialog.js +2 -2
- package/dist/collection/components/ui/kritzel-tool-config/kritzel-tool-config.js +6 -6
- package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js +1 -1
- package/dist/collection/constants/color-palette.constants.js +4 -1
- package/dist/collection/constants/version.js +1 -1
- package/dist/collection/index.js +2 -0
- package/dist/collection/themes/dark-theme.js +4 -0
- package/dist/collection/themes/light-theme.js +4 -0
- package/dist/components/index.js +1 -1
- package/dist/components/kritzel-active-users.js +1 -1
- package/dist/components/kritzel-avatar.js +1 -1
- package/dist/components/kritzel-awareness-cursors.js +1 -1
- package/dist/components/kritzel-back-to-content.js +1 -1
- package/dist/components/kritzel-brush-style.js +1 -1
- package/dist/components/kritzel-button.js +1 -1
- package/dist/components/kritzel-color-palette.js +1 -1
- package/dist/components/kritzel-color.js +1 -1
- package/dist/components/kritzel-context-menu.js +1 -1
- package/dist/components/kritzel-controls.js +1 -1
- package/dist/components/kritzel-current-user-dialog.js +1 -1
- package/dist/components/kritzel-current-user.js +1 -1
- package/dist/components/kritzel-cursor-trail.js +1 -1
- package/dist/components/kritzel-dropdown.js +1 -1
- package/dist/components/kritzel-editor.js +1 -1
- package/dist/components/kritzel-engine.js +1 -1
- package/dist/components/kritzel-export.js +1 -1
- package/dist/components/kritzel-font-family.js +1 -1
- package/dist/components/kritzel-font-size.js +1 -1
- package/dist/components/kritzel-font.js +1 -1
- package/dist/components/kritzel-icon.js +1 -1
- package/dist/components/kritzel-input.js +1 -1
- package/dist/components/kritzel-line-endings.js +1 -1
- package/dist/components/kritzel-login-dialog.js +1 -1
- package/dist/components/kritzel-master-detail.js +1 -1
- package/dist/components/kritzel-menu-item.js +1 -1
- package/dist/components/kritzel-menu.js +1 -1
- package/dist/components/kritzel-more-menu.js +1 -1
- package/dist/components/kritzel-numeric-input.js +1 -1
- package/dist/components/kritzel-opacity-slider.js +1 -1
- package/dist/components/kritzel-pill-tabs.js +1 -1
- package/dist/components/kritzel-portal.js +1 -1
- package/dist/components/kritzel-settings.js +1 -1
- package/dist/components/kritzel-shape-fill.js +1 -1
- package/dist/components/kritzel-share-dialog.js +1 -1
- package/dist/components/kritzel-slide-toggle.js +1 -1
- package/dist/components/kritzel-split-button.js +1 -1
- package/dist/components/kritzel-stroke-size.js +1 -1
- package/dist/components/kritzel-tool-config.js +1 -1
- package/dist/components/kritzel-tooltip.js +1 -1
- package/dist/components/kritzel-utility-panel.js +1 -1
- package/dist/components/kritzel-workspace-manager.js +1 -1
- package/dist/components/{p-CJjwjpMH.js → p-BFgWBbpu.js} +1 -1
- package/dist/components/{p-CqAkznU_.js → p-BI_UUiTr.js} +1 -1
- package/dist/components/p-BPEn0_hr.js +1 -0
- package/dist/components/{p-Cz2gQKbL.js → p-B_JH91jB.js} +1 -1
- package/dist/components/{p-BV3EJRtU.js → p-Bp3kdH4l.js} +1 -1
- package/dist/components/p-C0wFAtT_.js +1 -0
- package/dist/components/p-C8ggg-5h.js +1 -0
- package/dist/components/{p-B638ZH7S.js → p-CARNM9pf.js} +1 -1
- package/dist/components/p-CB7ynHtI.js +1 -0
- package/dist/components/{p-DDBaFNFi.js → p-CJ2V42sz.js} +1 -1
- package/dist/components/{p-A7Ult9iv.js → p-CJERvHdy.js} +1 -1
- package/dist/components/{p-CrSLn46K.js → p-CKY7AvGR.js} +1 -1
- package/dist/components/{p-C4vg_-vg.js → p-COIxq81R.js} +1 -1
- package/dist/components/p-CT2IjyIk.js +1 -0
- package/dist/components/{p-B5a3arJg.js → p-CWgI1dA0.js} +1 -1
- package/dist/components/{p-0cs6zQLB.js → p-CYR9wbJg.js} +1 -1
- package/dist/components/{p-CrmWVXea.js → p-Cr7xOsIZ.js} +1 -1
- package/dist/components/{p-qBqQhAmh.js → p-CxtTuKCy.js} +1 -1
- package/dist/components/{p-DEd2L0e3.js → p-D0aom7Yu.js} +1 -1
- package/dist/components/{p-DwHZN643.js → p-D15NO5kE.js} +1 -1
- package/dist/components/p-DH-H7om7.js +1 -0
- package/dist/components/{p-PMiFTdm6.js → p-DJLJfKY2.js} +1 -1
- package/dist/components/{p-W0nK9EQJ.js → p-DLlIaDNn.js} +2 -2
- package/dist/components/{p-DXO_ppUK.js → p-DRB3TZzI.js} +1 -1
- package/dist/components/{p-CaKSDRid.js → p-DXgUuzXW.js} +1 -1
- package/dist/components/{p-ihbmwmHg.js → p-DdmJquQr.js} +1 -1
- package/dist/components/{p-Czaea0WP.js → p-DfH7YY2C.js} +1 -1
- package/dist/components/{p-CTj2UdbS.js → p-DgtrNOWm.js} +1 -1
- package/dist/components/{p-D6KNaj_Y.js → p-DhAM4qeQ.js} +1 -1
- package/dist/components/{p-DMfU0hHe.js → p-DmTG0Y5h.js} +1 -1
- package/dist/components/{p-BMsKd6TF.js → p-Dov3qOAR.js} +1 -1
- package/dist/components/{p-CvCTQQcJ.js → p-Dw9sKOsb.js} +1 -1
- package/dist/components/{p-CSODtZrV.js → p-Dx_xz_El.js} +1 -1
- package/dist/components/{p-BVEYAGm1.js → p-IiG44Unz.js} +1 -1
- package/dist/components/{p-DsxW_miC.js → p-K7ySy791.js} +1 -1
- package/dist/components/{p-Bda1I4pR.js → p-KVG5rztB.js} +1 -1
- package/dist/components/{p-C_OSXZqJ.js → p-KjtNlFTl.js} +1 -1
- package/dist/components/{p-DVEfOb8T.js → p-RnuCSIt-.js} +1 -1
- package/dist/components/{p-Z9_amVdR.js → p-ZgZqbJ58.js} +1 -1
- package/dist/components/{p-C4bAtxyk.js → p-guqEWGgV.js} +1 -1
- package/dist/components/{p-DemKKw9U.js → p-u0b2RJAn.js} +1 -1
- package/dist/components/{p-BLjdzUzs.js → p-x38RbGJA.js} +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/kritzel-active-users_42.entry.js +301 -126
- package/dist/esm/kritzel-brush-style.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{schema.constants-cuIrI5X8.js → schema.constants-CqBoZbmA.js} +77 -13
- package/dist/esm/stencil.js +1 -1
- package/dist/stencil/index.esm.js +1 -1
- package/dist/stencil/p-3372fb1e.entry.js +9 -0
- package/dist/stencil/{p-10c2b77c.entry.js → p-69298b5f.entry.js} +1 -1
- package/dist/stencil/p-CqBoZbmA.js +1 -0
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/types/classes/handlers/context-menu.handler.d.ts +14 -0
- package/dist/types/classes/managers/theme.manager.d.ts +22 -2
- package/dist/types/classes/objects/text.class.d.ts +1 -0
- package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +14 -2
- package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +18 -1
- package/dist/types/components/shared/kritzel-color/kritzel-color.d.ts +3 -2
- package/dist/types/components/shared/kritzel-color-palette/kritzel-color-palette.d.ts +3 -2
- package/dist/types/components/ui/kritzel-context-menu/kritzel-context-menu.d.ts +9 -3
- package/dist/types/components/ui/kritzel-controls/kritzel-controls.d.ts +2 -2
- package/dist/types/components/ui/kritzel-settings/kritzel-settings.d.ts +2 -1
- package/dist/types/components/ui/kritzel-tool-config/kritzel-tool-config.d.ts +3 -2
- package/dist/types/components.d.ts +61 -18
- package/dist/types/constants/color-palette.constants.d.ts +4 -2
- package/dist/types/constants/version.d.ts +1 -1
- package/dist/types/helpers/color.helper.d.ts +4 -3
- package/dist/types/helpers/svg-export.helper.d.ts +3 -3
- package/dist/types/index.d.ts +2 -0
- package/dist/types/interfaces/theme.interface.d.ts +7 -3
- package/package.json +1 -1
- package/dist/components/p-B8wX0-3H.js +0 -1
- package/dist/components/p-BvgGpgKP.js +0 -1
- package/dist/components/p-C-sJ1r3g.js +0 -1
- package/dist/components/p-CBTqCoUx.js +0 -1
- package/dist/components/p-DdlK75Kx.js +0 -1
- package/dist/components/p-DjAiIBXv.js +0 -1
- package/dist/stencil/p-9ce67a14.entry.js +0 -9
- package/dist/stencil/p-cuIrI5X8.js +0 -1
|
@@ -12,8 +12,9 @@ export class KritzelContextMenu {
|
|
|
12
12
|
actionSelected;
|
|
13
13
|
close;
|
|
14
14
|
processedItems = [];
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
/** Current open submenu path (e.g. '0.2.1'). Empty if none. */
|
|
16
|
+
openSubmenuPath = '';
|
|
17
|
+
submenuPositions = {};
|
|
17
18
|
submenuTimer = null;
|
|
18
19
|
submenuRefs = new Map();
|
|
19
20
|
menuItemWrapperRefs = new Map();
|
|
@@ -31,7 +32,8 @@ export class KritzelContextMenu {
|
|
|
31
32
|
}
|
|
32
33
|
componentDidUpdate() {
|
|
33
34
|
this.adjustPositionToViewport();
|
|
34
|
-
this.
|
|
35
|
+
this.adjustSubmenuPositions();
|
|
36
|
+
this.pruneStaleRefs();
|
|
35
37
|
}
|
|
36
38
|
disconnectedCallback() {
|
|
37
39
|
if (this.submenuTimer) {
|
|
@@ -68,60 +70,102 @@ export class KritzelContextMenu {
|
|
|
68
70
|
this.host.style.top = `${newTop}px`;
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
|
-
|
|
72
|
-
if (this.
|
|
73
|
+
adjustSubmenuPositions() {
|
|
74
|
+
if (!this.openSubmenuPath)
|
|
73
75
|
return;
|
|
74
|
-
const submenuEl = this.submenuRefs.get(this.openSubmenuIndex);
|
|
75
|
-
if (!submenuEl)
|
|
76
|
-
return;
|
|
77
|
-
const submenuRect = submenuEl.getBoundingClientRect();
|
|
78
76
|
const viewportHeight = window.innerHeight;
|
|
79
|
-
// Adjust
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
77
|
+
// Adjust every open submenu in the chain (every prefix of openSubmenuPath).
|
|
78
|
+
for (const path of this.getOpenSubmenuPaths()) {
|
|
79
|
+
const submenuEl = this.submenuRefs.get(path);
|
|
80
|
+
const wrapperEl = this.menuItemWrapperRefs.get(path);
|
|
81
|
+
if (!submenuEl || !wrapperEl)
|
|
82
|
+
continue;
|
|
83
|
+
const wrapperRect = wrapperEl.getBoundingClientRect();
|
|
84
|
+
const submenuHeight = submenuEl.offsetHeight; // Constant regardless of current top shift
|
|
85
|
+
const naturalBottom = wrapperRect.top + submenuHeight;
|
|
86
|
+
if (naturalBottom > viewportHeight - VIEWPORT_PADDING) {
|
|
87
|
+
let overflow = naturalBottom - (viewportHeight - VIEWPORT_PADDING);
|
|
88
|
+
// Don't shift up so far that the top goes above the viewport
|
|
89
|
+
if (wrapperRect.top - overflow < VIEWPORT_PADDING) {
|
|
90
|
+
overflow = wrapperRect.top - VIEWPORT_PADDING;
|
|
91
|
+
}
|
|
92
|
+
submenuEl.style.top = `${-overflow}px`;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
submenuEl.style.top = '0px';
|
|
96
|
+
}
|
|
83
97
|
}
|
|
84
|
-
|
|
85
|
-
|
|
98
|
+
}
|
|
99
|
+
getOpenSubmenuPaths() {
|
|
100
|
+
if (!this.openSubmenuPath)
|
|
101
|
+
return [];
|
|
102
|
+
const parts = this.openSubmenuPath.split('.');
|
|
103
|
+
const paths = [];
|
|
104
|
+
for (let i = 1; i <= parts.length; i++) {
|
|
105
|
+
paths.push(parts.slice(0, i).join('.'));
|
|
106
|
+
}
|
|
107
|
+
return paths;
|
|
108
|
+
}
|
|
109
|
+
isSubmenuOpen(path) {
|
|
110
|
+
return this.openSubmenuPath === path || this.openSubmenuPath.startsWith(path + '.');
|
|
111
|
+
}
|
|
112
|
+
getParentPath(path) {
|
|
113
|
+
const idx = path.lastIndexOf('.');
|
|
114
|
+
return idx === -1 ? '' : path.substring(0, idx);
|
|
115
|
+
}
|
|
116
|
+
pruneStaleRefs() {
|
|
117
|
+
const openPaths = new Set(this.getOpenSubmenuPaths());
|
|
118
|
+
for (const key of Array.from(this.submenuRefs.keys())) {
|
|
119
|
+
if (!openPaths.has(key)) {
|
|
120
|
+
this.submenuRefs.delete(key);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// Keep root-level wrapper refs (single-segment paths) always rendered; prune deeper
|
|
124
|
+
// wrappers whose parent submenu is no longer open.
|
|
125
|
+
for (const key of Array.from(this.menuItemWrapperRefs.keys())) {
|
|
126
|
+
const parent = this.getParentPath(key);
|
|
127
|
+
if (parent !== '' && !openPaths.has(parent)) {
|
|
128
|
+
this.menuItemWrapperRefs.delete(key);
|
|
129
|
+
}
|
|
86
130
|
}
|
|
87
131
|
}
|
|
88
132
|
handleItemClick(item, isDisabled, hasChildren) {
|
|
89
133
|
if (isDisabled)
|
|
90
134
|
return;
|
|
91
135
|
if (hasChildren) {
|
|
92
|
-
//
|
|
136
|
+
// Hover handles open/close; click on a parent is a no-op.
|
|
93
137
|
return;
|
|
94
138
|
}
|
|
95
139
|
if (item.action) {
|
|
96
140
|
this.actionSelected.emit(item);
|
|
97
141
|
}
|
|
98
142
|
}
|
|
99
|
-
handleItemMouseEnter(
|
|
143
|
+
handleItemMouseEnter(path, hasChildren) {
|
|
100
144
|
if (this.submenuTimer) {
|
|
101
145
|
clearTimeout(this.submenuTimer);
|
|
102
146
|
this.submenuTimer = null;
|
|
103
147
|
}
|
|
148
|
+
const parentPath = this.getParentPath(path);
|
|
104
149
|
if (hasChildren) {
|
|
105
150
|
this.submenuTimer = setTimeout(() => {
|
|
106
|
-
// Pre-calculate position before opening to avoid flicker
|
|
107
|
-
const wrapperEl = this.menuItemWrapperRefs.get(
|
|
151
|
+
// Pre-calculate horizontal position before opening to avoid flicker.
|
|
152
|
+
const wrapperEl = this.menuItemWrapperRefs.get(path);
|
|
153
|
+
let position = 'right';
|
|
108
154
|
if (wrapperEl) {
|
|
109
155
|
const rect = wrapperEl.getBoundingClientRect();
|
|
110
156
|
const viewportWidth = window.innerWidth;
|
|
111
|
-
// Check if opening to the right would overflow
|
|
112
157
|
const wouldOverflowRight = rect.right + ESTIMATED_SUBMENU_WIDTH > viewportWidth - VIEWPORT_PADDING;
|
|
113
|
-
|
|
158
|
+
position = wouldOverflowRight ? 'left' : 'right';
|
|
114
159
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
this.openSubmenuIndex = index;
|
|
160
|
+
this.submenuPositions = { ...this.submenuPositions, [path]: position };
|
|
161
|
+
this.openSubmenuPath = path;
|
|
119
162
|
}, SUBMENU_DELAY);
|
|
120
163
|
}
|
|
121
164
|
else {
|
|
122
|
-
//
|
|
165
|
+
// Hovering a sibling without children: collapse to the parent chain so any
|
|
166
|
+
// sibling-rooted submenu closes, but the ancestor chain stays open.
|
|
123
167
|
this.submenuTimer = setTimeout(() => {
|
|
124
|
-
this.
|
|
168
|
+
this.openSubmenuPath = parentPath;
|
|
125
169
|
}, SUBMENU_DELAY);
|
|
126
170
|
}
|
|
127
171
|
}
|
|
@@ -131,9 +175,11 @@ export class KritzelContextMenu {
|
|
|
131
175
|
this.submenuTimer = null;
|
|
132
176
|
}
|
|
133
177
|
}
|
|
134
|
-
handleSubmenuMouseLeave() {
|
|
178
|
+
handleSubmenuMouseLeave(path) {
|
|
179
|
+
// Close this submenu (and any deeper levels) but keep the ancestor chain open.
|
|
180
|
+
const parentPath = this.getParentPath(path);
|
|
135
181
|
this.submenuTimer = setTimeout(() => {
|
|
136
|
-
this.
|
|
182
|
+
this.openSubmenuPath = parentPath;
|
|
137
183
|
}, SUBMENU_DELAY);
|
|
138
184
|
}
|
|
139
185
|
async updateMenuItems() {
|
|
@@ -163,28 +209,28 @@ export class KritzelContextMenu {
|
|
|
163
209
|
}
|
|
164
210
|
return defaultValue;
|
|
165
211
|
}
|
|
166
|
-
|
|
167
|
-
return
|
|
168
|
-
const
|
|
212
|
+
renderItems(items, parentPath) {
|
|
213
|
+
return items.map(({ item, isDisabled, processedChildren }, index) => {
|
|
214
|
+
const path = parentPath === '' ? String(index) : `${parentPath}.${index}`;
|
|
215
|
+
const prevItem = index > 0 ? items[index - 1].item : null;
|
|
169
216
|
const showDivider = prevItem && prevItem.group !== item.group;
|
|
170
|
-
const hasChildren =
|
|
217
|
+
const hasChildren = !!processedChildren && processedChildren.length > 0;
|
|
218
|
+
const submenuOpen = hasChildren && this.isSubmenuOpen(path);
|
|
171
219
|
return [
|
|
172
|
-
showDivider && h("div", { class: "menu-divider", key: `
|
|
173
|
-
h("
|
|
220
|
+
showDivider && h("div", { class: "menu-divider", key: `divider-${path}` }),
|
|
221
|
+
h("div", { class: "menu-item-wrapper", key: `wrapper-${path}`, ref: el => el && this.menuItemWrapperRefs.set(path, el), onMouseEnter: () => this.handleItemMouseEnter(path, hasChildren) }, h("button", { key: `${item.label}-${path}`, class: { 'menu-item': true, 'disabled': isDisabled, 'has-children': hasChildren, 'submenu-open': submenuOpen }, onClick: () => this.handleItemClick(item, isDisabled, hasChildren), disabled: isDisabled && !hasChildren }, item.icon && h("kritzel-icon", { name: item.icon, size: 16 }), h("span", { class: "label" }, item.label), hasChildren && h("kritzel-icon", { name: "chevron-right", size: 12, class: "submenu-arrow" })), hasChildren && submenuOpen && this.renderSubmenu(processedChildren, path)),
|
|
174
222
|
];
|
|
175
|
-
})
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
renderSubmenu(processedChildren, path) {
|
|
226
|
+
const position = this.submenuPositions[path] === 'left' ? 'left' : 'right';
|
|
227
|
+
return (h("div", { class: { 'submenu-container': true, 'position-left': position === 'left' }, key: `submenu-${path}`, ref: el => el && this.submenuRefs.set(path, el), onMouseEnter: () => this.handleSubmenuMouseEnter(), onMouseLeave: () => this.handleSubmenuMouseLeave(path) }, this.renderItems(processedChildren, path)));
|
|
176
228
|
}
|
|
177
229
|
render() {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
const isSubmenuOpen = this.openSubmenuIndex === index;
|
|
183
|
-
return [
|
|
184
|
-
showDivider && h("div", { class: "menu-divider", key: `divider-${index}` }),
|
|
185
|
-
h("div", { class: "menu-item-wrapper", ref: el => el && this.menuItemWrapperRefs.set(index, el), onMouseEnter: () => this.handleItemMouseEnter(index, hasChildren) }, h("button", { key: `${item.label}-${index}`, class: { 'menu-item': true, 'disabled': isDisabled, 'has-children': hasChildren, 'submenu-open': isSubmenuOpen }, onClick: () => this.handleItemClick(item, isDisabled, hasChildren), disabled: isDisabled && !hasChildren }, item.icon && h("kritzel-icon", { name: item.icon, size: 16 }), h("span", { class: "label" }, item.label), hasChildren && h("kritzel-icon", { name: "chevron-right", size: 12, class: "submenu-arrow" })), hasChildren && isSubmenuOpen && this.renderSubmenu(processedChildren, index))
|
|
186
|
-
];
|
|
187
|
-
}))));
|
|
230
|
+
if (!this.processedItems || this.processedItems.length === 0) {
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
return (h(Host, null, h("div", { class: "menu-container" }, this.renderItems(this.processedItems, ''))));
|
|
188
234
|
}
|
|
189
235
|
static get is() { return "kritzel-context-menu"; }
|
|
190
236
|
static get encapsulation() { return "shadow"; }
|
|
@@ -253,8 +299,8 @@ export class KritzelContextMenu {
|
|
|
253
299
|
static get states() {
|
|
254
300
|
return {
|
|
255
301
|
"processedItems": {},
|
|
256
|
-
"
|
|
257
|
-
"
|
|
302
|
+
"openSubmenuPath": {},
|
|
303
|
+
"submenuPositions": {}
|
|
258
304
|
};
|
|
259
305
|
}
|
|
260
306
|
static get events() {
|
|
@@ -10,7 +10,7 @@ export class KritzelControls {
|
|
|
10
10
|
activeControl = null;
|
|
11
11
|
isUtilityPanelVisible = true;
|
|
12
12
|
undoState = null;
|
|
13
|
-
theme;
|
|
13
|
+
theme = 'light';
|
|
14
14
|
isControlsReady;
|
|
15
15
|
firstConfig = null;
|
|
16
16
|
isTouchDevice = KritzelDevicesHelper.isTouchDevice();
|
|
@@ -230,13 +230,13 @@ export class KritzelControls {
|
|
|
230
230
|
// Separate tool controls from config control
|
|
231
231
|
const toolControls = this.internalControls.filter(c => c.type === 'tool' || c.type === 'separator');
|
|
232
232
|
const configControl = this.internalControls.find(c => c.type === 'config' && c.name === this.firstConfig?.name);
|
|
233
|
-
return (h(Host, { key: '
|
|
233
|
+
return (h(Host, { key: 'b567aac7bca12cc5ffb0ee1eb9e6978636aa3c31', class: {
|
|
234
234
|
mobile: this.isTouchDevice,
|
|
235
|
-
} }, this.isUtilityPanelVisible && (h("kritzel-utility-panel", { key: '
|
|
235
|
+
} }, this.isUtilityPanelVisible && (h("kritzel-utility-panel", { key: '88e8ae9ae7429987724df70895b02a3f59216364', style: {
|
|
236
236
|
position: 'absolute',
|
|
237
237
|
bottom: '56px',
|
|
238
238
|
left: '12px',
|
|
239
|
-
}, undoState: this.undoState, onUndo: () => this.kritzelEngine?.undo(), onRedo: () => this.kritzelEngine?.redo(), onDelete: () => this.kritzelEngine?.delete() })), h("div", { key: '
|
|
239
|
+
}, undoState: this.undoState, onUndo: () => this.kritzelEngine?.undo(), onRedo: () => this.kritzelEngine?.redo(), onDelete: () => this.kritzelEngine?.delete() })), h("div", { key: '658e3d7b94e49a002d5057c1fb4fc199a371c48d', class: "kritzel-controls" }, h("div", { key: 'b54bb52a43e4a94ae1148cd4e75528bcaad681ef', class: { 'scroll-indicator-left': true, 'visible': this.canScrollLeft } }), h("div", { key: '36ce760357d3228141281a45c0ac7b0024b04795', class: "kritzel-tools-scroll", ref: el => (this.toolsScrollRef = el), onScroll: this.handleToolsScroll }, toolControls.map(control => {
|
|
240
240
|
// Check if this control has sub-options (split-button)
|
|
241
241
|
if (control.subOptions?.length) {
|
|
242
242
|
const selectedSubOption = this.getSelectedSubOption(control);
|
|
@@ -266,10 +266,10 @@ export class KritzelControls {
|
|
|
266
266
|
'kritzel-control': true,
|
|
267
267
|
'selected': this.activeControl?.name === control?.name,
|
|
268
268
|
}, key: control.name, "data-testid": `tool-${control.name}`, onClick: _event => this.handleControlClick?.(control), "aria-label": control.name.charAt(0).toUpperCase() + control.name.slice(1) }, h("kritzel-icon", { name: control.icon })));
|
|
269
|
-
})), h("div", { key: '
|
|
269
|
+
})), h("div", { key: 'f0b1e0f74fe197f4d39e307e7dd8dd4819c4b183', class: { 'scroll-indicator-right': true, 'visible': this.canScrollRight && !(configControl && this.activeControl && hasConfigUI) } }), configControl && this.activeControl && (h("div", { class: {
|
|
270
270
|
'kritzel-config-container': true,
|
|
271
271
|
'visible': hasConfigUI,
|
|
272
|
-
}, key: configControl.name }, h("div", { key: '
|
|
272
|
+
}, key: configControl.name }, h("div", { key: '51cc3ebf13092e710048441ff64856edd4f53dfc', class: { 'config-gradient-left': true, 'visible': this.needsScrolling } }), h("kritzel-tooltip", { key: 'dcace186ae3ece1d7e943f51b48ed5094d847284', anchorElement: this.host.shadowRoot?.querySelector('.kritzel-config-container'), triggerElement: this.configTriggerRef }, h("kritzel-tool-config", { key: '9b16ac90f335fec3c043545fa0c5b363ab99924e', tool: this.activeControl.tool, theme: this.theme, engine: this.kritzelEngine, onToolChange: event => this.handleToolChange?.(event), onDisplayValuesChange: this.handleDisplayValuesChange, style: { width: '100%', height: '100%' } })), h("div", { key: '2425507968e27a01b66c1d7be79a40ebe77cd27d', tabIndex: hasConfigUI ? 0 : -1, class: "kritzel-config", "data-testid": "tool-config", ref: el => {
|
|
273
273
|
if (el)
|
|
274
274
|
this.configTriggerRef = el;
|
|
275
275
|
}, onKeyDown: event => {
|
|
@@ -278,7 +278,7 @@ export class KritzelControls {
|
|
|
278
278
|
}
|
|
279
279
|
}, style: {
|
|
280
280
|
cursor: 'pointer',
|
|
281
|
-
} }, this.displayValues && (h("div", { key: '
|
|
281
|
+
} }, this.displayValues && (h("div", { key: 'd2499df3c0a90c101957f55664452739e0f1692b', class: "color-container" }, h("kritzel-color", { key: 'b7cfcd3a8579c63f508c2786eecace1223e88974', value: this.displayValues.color, theme: this.theme, size: 18, style: {
|
|
282
282
|
borderRadius: '50%',
|
|
283
283
|
border: 'none',
|
|
284
284
|
} })))))))));
|
|
@@ -397,14 +397,14 @@ export class KritzelControls {
|
|
|
397
397
|
"type": "string",
|
|
398
398
|
"mutable": false,
|
|
399
399
|
"complexType": {
|
|
400
|
-
"original": "
|
|
401
|
-
"resolved": "\"dark\" | \"light\"",
|
|
400
|
+
"original": "ThemeName",
|
|
401
|
+
"resolved": "\"dark\" | \"light\" | string & {}",
|
|
402
402
|
"references": {
|
|
403
|
-
"
|
|
403
|
+
"ThemeName": {
|
|
404
404
|
"location": "import",
|
|
405
|
-
"path": "../../../
|
|
406
|
-
"id": "src/
|
|
407
|
-
"referenceLocation": "
|
|
405
|
+
"path": "../../../interfaces/theme.interface",
|
|
406
|
+
"id": "src/interfaces/theme.interface.ts::ThemeName",
|
|
407
|
+
"referenceLocation": "ThemeName"
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
410
|
},
|
|
@@ -417,7 +417,8 @@ export class KritzelControls {
|
|
|
417
417
|
"getter": false,
|
|
418
418
|
"setter": false,
|
|
419
419
|
"reflect": false,
|
|
420
|
-
"attribute": "theme"
|
|
420
|
+
"attribute": "theme",
|
|
421
|
+
"defaultValue": "'light'"
|
|
421
422
|
}
|
|
422
423
|
};
|
|
423
424
|
}
|
|
@@ -15,7 +15,7 @@ export class KritzelCurrentUser {
|
|
|
15
15
|
this.dialogRef?.open();
|
|
16
16
|
};
|
|
17
17
|
render() {
|
|
18
|
-
return (h(Host, { key: '
|
|
18
|
+
return (h(Host, { key: 'a735cb9f16f4898fde0b52573affa2d270a8f1de' }, h("kritzel-avatar", { key: 'd449a515182718ab4ef3b26b2277696bbc7ab46f', user: this.user, size: this.avatarSize, onClick: this.handleAvatarClick }), h("kritzel-current-user-dialog", { key: '3542f6df43c9924218e344f70bdc398c74a8eae6', ref: el => (this.dialogRef = el), user: this.user })));
|
|
19
19
|
}
|
|
20
20
|
static get is() { return "kritzel-current-user"; }
|
|
21
21
|
static get encapsulation() { return "shadow"; }
|
package/dist/collection/components/ui/kritzel-current-user-dialog/kritzel-current-user-dialog.js
CHANGED
|
@@ -21,7 +21,7 @@ export class KritzelCurrentUserDialog {
|
|
|
21
21
|
}
|
|
22
22
|
render() {
|
|
23
23
|
const displayName = this.getDisplayName();
|
|
24
|
-
return (h(Host, { key: '
|
|
24
|
+
return (h(Host, { key: '40c1a1bed0ddf02f9835199b5f7d2363e4d1902b' }, h("kritzel-dialog", { key: 'a83c09eac66ddf51155591a32245e3f15e34943e', dialogTitle: "Account", isOpen: this.isDialogOpen, onDialogClose: this.closeDialog, size: "small", contained: true }, h("div", { key: '14f7100a881ee3c5ba6b672d509bf3a9161ccd62', class: "user-info" }, h("kritzel-avatar", { key: 'e3552a80db81db4c26f81c6cc699363afa6153ea', user: this.user, size: 80 }), displayName && h("div", { key: 'c54164be605ac2bd2fc8bac6bb4481f820119028', class: "user-name" }, displayName), this.user?.email && h("div", { key: 'e6af7c44e45443eb24be0777768de96b0e3d249e', class: "user-email" }, this.user.email)))));
|
|
25
25
|
}
|
|
26
26
|
static get is() { return "kritzel-current-user-dialog"; }
|
|
27
27
|
static get encapsulation() { return "shadow"; }
|
|
@@ -65,7 +65,7 @@ export class KritzelExport {
|
|
|
65
65
|
return (h("div", { class: "export-tab-content" }, h("kritzel-input", { label: "Filename", value: this.exportFilename, placeholder: "Enter filename", suffix: ".json", onValueChange: this.handleFilenameChange })));
|
|
66
66
|
}
|
|
67
67
|
render() {
|
|
68
|
-
return (h(Host, { key: '
|
|
68
|
+
return (h(Host, { key: 'efeea781325e672e3f4c1579a50da1c928dc88b5' }, h("kritzel-dialog", { key: '60e27233f484e70fd12bcc0f8a72b89d2f72d596', isOpen: this.isDialogOpen, dialogTitle: "Export", closable: true, contained: true, onDialogClose: this.closeDialog }, h("div", { key: 'e58e1d9804fdc8cb3d4c053ead641e2301b99ea5', class: "export-content" }, h("kritzel-pill-tabs", { key: '409f4c2d64f5477dc57c72a8e32ae0a12dfb7eda', tabs: this.tabs, value: this.activeTab, onValueChange: this.handleTabChange }), this.activeTab === 'viewport' && this.renderViewportExport(), this.activeTab === 'workspace' && this.renderWorkspaceExport(), h("button", { key: '7166aee26e0dbbdf6e7348428f7a740614948e5e', class: "export-primary-button", onClick: this.handleExport }, "Export")))));
|
|
69
69
|
}
|
|
70
70
|
static get is() { return "kritzel-export"; }
|
|
71
71
|
static get encapsulation() { return "shadow"; }
|
|
@@ -44,7 +44,7 @@ export class KritzelLoginDialog {
|
|
|
44
44
|
this.dialogClosed.emit();
|
|
45
45
|
};
|
|
46
46
|
render() {
|
|
47
|
-
return (h(Host, { key: '
|
|
47
|
+
return (h(Host, { key: '8cac83db48fef2531f1669c3f601526b1e5cdefa' }, h("kritzel-dialog", { key: '34e7208c8c34550292c2b7503759bf103cfb49a6', dialogTitle: this.dialogTitle, isOpen: this.isDialogOpen, onDialogClose: this.closeDialog, size: "small", contained: true }, h("div", { key: 'b0a0d8e0f38adc8d9b9545a02c5fc879f64a24de', class: "login-content" }, this.subtitle && (h("p", { key: 'a51b5f0a8b402aaf979d4bf47c6f9c3ba7e14bfe', class: "login-subtitle" }, this.subtitle)), h("div", { key: 'b6d8f8748eadf1462dd4161f089130b7ded31b59', class: "login-providers" }, this.providers.map(provider => (h("button", { key: provider.name, class: {
|
|
48
48
|
'provider-button': true,
|
|
49
49
|
'is-loading': this.loadingProvider === provider.name,
|
|
50
50
|
'is-disabled': this.loadingProvider !== null && this.loadingProvider !== provider.name,
|
|
@@ -55,7 +55,7 @@ export class KritzelMoreMenu {
|
|
|
55
55
|
this.closeMenu();
|
|
56
56
|
};
|
|
57
57
|
render() {
|
|
58
|
-
return (h(Host, { key: '
|
|
58
|
+
return (h(Host, { key: '93bee9fc14d532a74f1b077098fb0a470655d2fe', class: { mobile: this.isTouchDevice }, style: { display: this.visible ? '' : 'none' } }, h("div", { key: '1783013acb533de9580698f29a7c8ae212b583fc', class: { 'more-menu-wrapper': true, visible: this.visible } }, h("button", { key: '8dc2f098377e78db0bf6efc05daaf02496cef527', class: "more-menu-button", "data-testid": "more-menu-button", onClick: this.toggleMenu, "aria-label": "More options" }, h("kritzel-icon", { key: '876a229226b0f79f1d5ef5d0b7793f362b884923', name: this.icon, size: this.iconSize })), h("kritzel-portal", { key: '57f7a69408b00c1bb9e5a08d22e224c6e6bcdea4', anchor: this.menuAnchor, offsetY: this.offsetY, onClose: this.closeMenu }, h("kritzel-menu", { key: '73a2aacd1b7c0ec79d7fa1695fbc02b1a0bde1b5', items: this.visibleItems, onItemSelect: this.handleMenuItemSelect })))));
|
|
59
59
|
}
|
|
60
60
|
static get is() { return "kritzel-more-menu"; }
|
|
61
61
|
static get encapsulation() { return "shadow"; }
|
|
@@ -24,6 +24,7 @@ const SETTINGS_CATEGORIES = [
|
|
|
24
24
|
export class KritzelSettings {
|
|
25
25
|
host;
|
|
26
26
|
/** Keyboard shortcuts to display in the settings dialog */
|
|
27
|
+
availableThemes = ['light', 'dark'];
|
|
27
28
|
shortcuts = [];
|
|
28
29
|
/** Current settings values. Used to initialize and sync the component's internal state. */
|
|
29
30
|
settings;
|
|
@@ -37,7 +38,7 @@ export class KritzelSettings {
|
|
|
37
38
|
scaleMin = DEFAULT_SCALE_MIN;
|
|
38
39
|
scaleMax = DEFAULT_SCALE_MAX;
|
|
39
40
|
lockDrawingScale = DEFAULT_LOCK_DRAWING_SCALE;
|
|
40
|
-
|
|
41
|
+
theme = 'light';
|
|
41
42
|
viewportBoundaryLeft = DEFAULT_VIEWPORT_BOUNDARY_LEFT;
|
|
42
43
|
viewportBoundaryRight = DEFAULT_VIEWPORT_BOUNDARY_RIGHT;
|
|
43
44
|
viewportBoundaryTop = DEFAULT_VIEWPORT_BOUNDARY_TOP;
|
|
@@ -60,8 +61,8 @@ export class KritzelSettings {
|
|
|
60
61
|
if (typeof settings.lockDrawingScale === 'boolean') {
|
|
61
62
|
this.lockDrawingScale = settings.lockDrawingScale;
|
|
62
63
|
}
|
|
63
|
-
if (
|
|
64
|
-
this.
|
|
64
|
+
if (typeof settings.theme === 'string') {
|
|
65
|
+
this.theme = settings.theme;
|
|
65
66
|
}
|
|
66
67
|
if (typeof settings.viewportBoundaryLeft === 'number') {
|
|
67
68
|
this.viewportBoundaryLeft = settings.viewportBoundaryLeft;
|
|
@@ -84,7 +85,7 @@ export class KritzelSettings {
|
|
|
84
85
|
scaleMin: this.scaleMin,
|
|
85
86
|
scaleMax: this.scaleMax,
|
|
86
87
|
lockDrawingScale: this.lockDrawingScale,
|
|
87
|
-
theme: this.
|
|
88
|
+
theme: this.theme,
|
|
88
89
|
viewportBoundaryLeft: this.viewportBoundaryLeft,
|
|
89
90
|
viewportBoundaryRight: this.viewportBoundaryRight,
|
|
90
91
|
viewportBoundaryTop: this.viewportBoundaryTop,
|
|
@@ -106,7 +107,7 @@ export class KritzelSettings {
|
|
|
106
107
|
this.emitSettings();
|
|
107
108
|
};
|
|
108
109
|
handleThemeChange = (event) => {
|
|
109
|
-
this.
|
|
110
|
+
this.theme = event.detail;
|
|
110
111
|
this.emitSettings();
|
|
111
112
|
};
|
|
112
113
|
handleViewportBoundaryLeftChange = (event) => {
|
|
@@ -167,7 +168,7 @@ export class KritzelSettings {
|
|
|
167
168
|
renderCategoryContent() {
|
|
168
169
|
switch (this.selectedCategoryId) {
|
|
169
170
|
case 'general':
|
|
170
|
-
return (h("div", { class: "settings-content" }, h("h3", null, "General Settings"), h("div", { class: "settings-group" }, h("div", { class: "settings-item" }, h("label", { class: "settings-label" }, "
|
|
171
|
+
return (h("div", { class: "settings-content" }, h("h3", null, "General Settings"), h("div", { class: "settings-group" }, h("div", { class: "settings-item" }, h("label", { class: "settings-label" }, "Theme"), h("p", { class: "settings-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 })), h("div", { class: "settings-item" }, h("label", { class: "settings-label" }, "Lock Drawing Scale"), h("p", { class: "settings-description" }, "When enabled, drawn objects maintain a fixed visual size regardless of the current zoom level."), h("kritzel-slide-toggle", { checked: this.lockDrawingScale, label: "Lock Drawing Scale", onCheckedChange: this.handleLockDrawingScaleChange })))));
|
|
171
172
|
case 'viewport':
|
|
172
173
|
return (h("div", { class: "settings-content" }, h("h3", null, "Viewport Settings"), h("div", { class: "settings-group" }, h("div", { class: "settings-item" }, h("label", { class: "settings-label" }, "Minimum Zoom Level"), h("p", { class: "settings-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" }, "Maximum Zoom Level"), h("p", { class: "settings-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" }, "Viewport Boundary Left"), h("p", { class: "settings-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: "Infinite", onValueChange: this.handleViewportBoundaryLeftChange })), h("div", { class: "settings-item" }, h("label", { class: "settings-label" }, "Viewport Boundary Right"), h("p", { class: "settings-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: "Infinite", onValueChange: this.handleViewportBoundaryRightChange })), h("div", { class: "settings-item" }, h("label", { class: "settings-label" }, "Viewport Boundary Top"), h("p", { class: "settings-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: "Infinite", onValueChange: this.handleViewportBoundaryTopChange })), h("div", { class: "settings-item" }, h("label", { class: "settings-label" }, "Viewport Boundary Bottom"), h("p", { class: "settings-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: "Infinite", onValueChange: this.handleViewportBoundaryBottomChange })))));
|
|
173
174
|
case 'shortcuts':
|
|
@@ -181,7 +182,7 @@ export class KritzelSettings {
|
|
|
181
182
|
}
|
|
182
183
|
}
|
|
183
184
|
render() {
|
|
184
|
-
return (h(Host, { key: '
|
|
185
|
+
return (h(Host, { key: '46c6792ae9cdd932d3dc71526862c9281c0cefc1' }, h("kritzel-dialog", { key: '1cd288cdf8b26bea378665c54bfc14577597fe49', isOpen: this.isDialogOpen, dialogTitle: "Settings", size: "large", contained: true, onDialogClose: this.closeDialog }, h("kritzel-master-detail", { key: '4d07e94ebb09035807356bab4bc7eaca57c36c6c', items: SETTINGS_CATEGORIES, selectedItemId: this.selectedCategoryId, onItemSelect: this.handleCategorySelect }, this.renderCategoryContent()))));
|
|
185
186
|
}
|
|
186
187
|
static get is() { return "kritzel-settings"; }
|
|
187
188
|
static get encapsulation() { return "shadow"; }
|
|
@@ -197,6 +198,24 @@ export class KritzelSettings {
|
|
|
197
198
|
}
|
|
198
199
|
static get properties() {
|
|
199
200
|
return {
|
|
201
|
+
"availableThemes": {
|
|
202
|
+
"type": "unknown",
|
|
203
|
+
"mutable": false,
|
|
204
|
+
"complexType": {
|
|
205
|
+
"original": "string[]",
|
|
206
|
+
"resolved": "string[]",
|
|
207
|
+
"references": {}
|
|
208
|
+
},
|
|
209
|
+
"required": false,
|
|
210
|
+
"optional": false,
|
|
211
|
+
"docs": {
|
|
212
|
+
"tags": [],
|
|
213
|
+
"text": "Keyboard shortcuts to display in the settings dialog"
|
|
214
|
+
},
|
|
215
|
+
"getter": false,
|
|
216
|
+
"setter": false,
|
|
217
|
+
"defaultValue": "['light', 'dark']"
|
|
218
|
+
},
|
|
200
219
|
"shortcuts": {
|
|
201
220
|
"type": "unknown",
|
|
202
221
|
"mutable": false,
|
|
@@ -220,7 +239,7 @@ export class KritzelSettings {
|
|
|
220
239
|
"optional": false,
|
|
221
240
|
"docs": {
|
|
222
241
|
"tags": [],
|
|
223
|
-
"text": "
|
|
242
|
+
"text": ""
|
|
224
243
|
},
|
|
225
244
|
"getter": false,
|
|
226
245
|
"setter": false,
|
|
@@ -263,7 +282,7 @@ export class KritzelSettings {
|
|
|
263
282
|
"scaleMin": {},
|
|
264
283
|
"scaleMax": {},
|
|
265
284
|
"lockDrawingScale": {},
|
|
266
|
-
"
|
|
285
|
+
"theme": {},
|
|
267
286
|
"viewportBoundaryLeft": {},
|
|
268
287
|
"viewportBoundaryRight": {},
|
|
269
288
|
"viewportBoundaryTop": {},
|
|
@@ -84,9 +84,9 @@ export class KritzelShareDialog {
|
|
|
84
84
|
this.dialogClosed.emit();
|
|
85
85
|
};
|
|
86
86
|
render() {
|
|
87
|
-
return (h(Host, { key: '
|
|
87
|
+
return (h(Host, { key: 'a104c14b2492d97f3ada98c9eaaa845d63074063' }, h("kritzel-dialog", { key: '1b12b27504153e54aeb0cb4e6b1030a0d43b9735', dialogTitle: "Share Workspace", size: "small", isOpen: this.isDialogOpen, onDialogClose: this.closeDialog, contained: true }, h("div", { key: '652f23e37876be356beb6f93abf5930e91d82cea', class: "share-content" }, h("div", { key: 'aaf336f2ac86fe23cac79cef920a9d67681046e2', class: "share-section" }, h("div", { key: '8075a7b3fff47c4b924d3b2d92b1377641920939', class: "share-row" }, h("div", { key: '41e98a74a5d4aede50fd75a7de62cbef9b5a5a31', class: "share-label-group" }, h("label", { key: '8a4f53e13d5a81497dd31316a49971c7245d82a2', class: "share-label" }, "Link sharing"), h("p", { key: '907a59d50e595734f03067f70830cf96defdf8d8', class: "share-description" }, this.internalIsPublic
|
|
88
88
|
? 'Anyone with the link can access this workspace.'
|
|
89
|
-
: 'Link sharing is disabled. Only you can access this workspace.')), h("kritzel-slide-toggle", { key: '
|
|
89
|
+
: 'Link sharing is disabled. Only you can access this workspace.')), h("kritzel-slide-toggle", { key: '0d75cfeeb63c33d20380ffe9a7e4c27148548ef9', checked: this.internalIsPublic, onCheckedChange: this.handleToggleChange, label: "Enable link sharing" }))), this.internalIsPublic && (h("div", { key: 'a8a10c74fd326c5097e4a5f0ee165602c3606ade', class: "share-section" }, h("div", { key: '6261a9fc6cb2be2a50856fb8a990b9da3fee84bf', class: "share-url-container" }, h("input", { key: '26ee72eebfee88d06a50c338cccc9af296c8ba4c', type: "text", class: "share-url-input", value: this.getShareUrl(), readOnly: true, onClick: (e) => e.target.select() }), h("button", { key: '4b1ec06fa27c95d9d0bb93f8cbb851a02fdd52cc', class: { 'copy-button': true, 'copy-success': this.copySuccess }, onClick: this.handleCopyUrl, title: this.copySuccess ? 'Copied!' : 'Copy link' }, h("kritzel-icon", { key: 'd9eea56b3523fcc3557d9868f3da7f28449a9447', name: this.copySuccess ? 'check' : 'copy', size: 18 })))))))));
|
|
90
90
|
}
|
|
91
91
|
static get is() { return "kritzel-share-dialog"; }
|
|
92
92
|
static get encapsulation() { return "shadow"; }
|
|
@@ -280,14 +280,14 @@ export class KritzelToolConfig {
|
|
|
280
280
|
"type": "string",
|
|
281
281
|
"mutable": false,
|
|
282
282
|
"complexType": {
|
|
283
|
-
"original": "
|
|
284
|
-
"resolved": "\"dark\" | \"light\"",
|
|
283
|
+
"original": "ThemeName",
|
|
284
|
+
"resolved": "\"dark\" | \"light\" | string & {}",
|
|
285
285
|
"references": {
|
|
286
|
-
"
|
|
286
|
+
"ThemeName": {
|
|
287
287
|
"location": "import",
|
|
288
|
-
"path": "../../../
|
|
289
|
-
"id": "src/
|
|
290
|
-
"referenceLocation": "
|
|
288
|
+
"path": "../../../interfaces/theme.interface",
|
|
289
|
+
"id": "src/interfaces/theme.interface.ts::ThemeName",
|
|
290
|
+
"referenceLocation": "ThemeName"
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
},
|
|
@@ -17,7 +17,7 @@ export class KritzelUtilityPanel {
|
|
|
17
17
|
this.redo.emit();
|
|
18
18
|
}
|
|
19
19
|
render() {
|
|
20
|
-
return (h(Host, { key: '
|
|
20
|
+
return (h(Host, { key: 'b49f6db6c0e574dc8a5a733c749ecda6f24f9d25' }, h("button", { key: 'e6306e54c8f660c3e92d032527fad1ea45ca0cf8', class: "utility-button", "data-testid": "utility-undo", disabled: !this.undoState?.canUndo, onClick: event => this.handleUndo(event), "aria-label": "Undo" }, h("kritzel-icon", { key: '5bb1293049a1e3004504289d92ccc79958786f3f', name: "undo" })), h("button", { key: '8102b0403d7f328ce4bfeb79767d5bd99d879013', class: "utility-button", "data-testid": "utility-redo", disabled: !this.undoState?.canRedo, onClick: event => this.handleRedo(event), "aria-label": "Redo" }, h("kritzel-icon", { key: '5db3047bec5d8ab695a2dc67780a5dbecbae64d2', name: "redo" })), h("div", { key: 'e894d9f2aaa2cad7aa980d3b839eca05a8d9c9df', class: "utility-separator" }), h("button", { key: 'f0a7de5ab91f82a2e5e8df75cc1903ec647abdac', class: "utility-button", "data-testid": "utility-delete", onClick: () => this.delete.emit(), "aria-label": "Delete selected items" }, h("kritzel-icon", { key: '5b146375394299bae946a95545c3c42c2bf36766', name: "delete" }))));
|
|
21
21
|
}
|
|
22
22
|
static get is() { return "kritzel-utility-panel"; }
|
|
23
23
|
static get encapsulation() { return "shadow"; }
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* Helper function to resolve a color value for a specific theme
|
|
3
3
|
*/
|
|
4
4
|
export function resolveColor(color, theme) {
|
|
5
|
-
|
|
5
|
+
if (theme in color && color[theme]) {
|
|
6
|
+
return color[theme];
|
|
7
|
+
}
|
|
8
|
+
return color[theme === 'dark' ? 'dark' : 'light'];
|
|
6
9
|
}
|
|
7
10
|
/**
|
|
8
11
|
* Default color palette shared across all tool configurations.
|
package/dist/collection/index.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* DO NOT use this file to export your components. Instead, use the recommended approaches
|
|
8
8
|
* to consume components of this package as outlined in the `README.md`.
|
|
9
9
|
*/
|
|
10
|
+
export * from './classes/objects/base-object.class';
|
|
10
11
|
export * from './classes/objects/text.class';
|
|
11
12
|
export * from './classes/objects/path.class';
|
|
12
13
|
export * from './classes/objects/image.class';
|
|
@@ -35,6 +36,7 @@ export * from './classes/managers/anchor.manager';
|
|
|
35
36
|
export * from './classes/managers/theme.manager';
|
|
36
37
|
export * from './interfaces/toolbar-control.interface';
|
|
37
38
|
export * from './interfaces/menu-item.interface';
|
|
39
|
+
export * from './interfaces/object-change-event.interface';
|
|
38
40
|
export * from './interfaces/sync-provider.interface';
|
|
39
41
|
export * from './interfaces/sync-config.interface';
|
|
40
42
|
export * from './interfaces/asset.interface';
|
|
@@ -37,7 +37,10 @@ export const darkTheme = {
|
|
|
37
37
|
},
|
|
38
38
|
selection: {
|
|
39
39
|
borderColor: '#0A84FF',
|
|
40
|
+
boxBackgroundColor: 'rgba(10, 132, 255, 0.2)',
|
|
41
|
+
boxBorderColor: 'rgba(10, 132, 255, 0.5)',
|
|
40
42
|
handleColor: '#1a1a1a',
|
|
43
|
+
handleStrokeColor: '#0A84FF'
|
|
41
44
|
},
|
|
42
45
|
checkerboard: {
|
|
43
46
|
colorDark: '#4a4a4a',
|
|
@@ -75,6 +78,7 @@ export const darkTheme = {
|
|
|
75
78
|
controlHoverBackgroundColor: 'hsl(0, 0%, 100%, 8%)',
|
|
76
79
|
controlSelectedBackgroundColor: '#0A84FF',
|
|
77
80
|
controlSelectedColor: '#ffffff',
|
|
81
|
+
separatorColor: '#3a3a3a',
|
|
78
82
|
},
|
|
79
83
|
currentUserDialog: {
|
|
80
84
|
emailColor: '#999999',
|