kritzel-stencil 0.2.8 → 0.2.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 +1 -1
- package/dist/cjs/kritzel-active-users_42.cjs.entry.js +105 -63
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/stencil.cjs.js +1 -1
- package/dist/cjs/{workspace.migrations-BuN0vRGQ.js → workspace.migrations-D5sPPbQN.js} +47 -33
- package/dist/collection/classes/managers/theme.manager.js +35 -29
- package/dist/collection/classes/tools/text-tool.class.js +12 -4
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +25 -6
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +85 -0
- package/dist/collection/components/ui/kritzel-settings/kritzel-settings.js +72 -64
- package/dist/collection/constants/version.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/kritzel-awareness-cursors.js +1 -1
- package/dist/components/kritzel-color-palette.js +1 -1
- package/dist/components/kritzel-color.js +1 -1
- package/dist/components/kritzel-controls.js +1 -1
- package/dist/components/kritzel-editor.js +1 -1
- package/dist/components/kritzel-engine.js +1 -1
- package/dist/components/kritzel-settings.js +1 -1
- package/dist/components/kritzel-stroke-size.js +1 -1
- package/dist/components/kritzel-tool-config.js +1 -1
- package/dist/components/{p-DeqXAEjq.js → p-B638ZH7S.js} +1 -1
- package/dist/components/{p-BD-U5p22.js → p-BWRjTm0J.js} +1 -1
- package/dist/components/{p-CNa_5hqn.js → p-B_fA1LTU.js} +2 -2
- package/dist/components/{p-DORo_go4.js → p-C-sJ1r3g.js} +1 -1
- package/dist/components/{p-BhMchyAR.js → p-C4bAtxyk.js} +1 -1
- package/dist/components/{p-DDm8Gefw.js → p-CqAkznU_.js} +1 -1
- package/dist/components/{p-DpjrLdtb.js → p-CzYgMB2N.js} +1 -1
- package/dist/components/{p-CitH48cC.js → p-D9-C4GfD.js} +1 -1
- package/dist/components/{p-BK9c3UTv.js → p-DF8X_22i.js} +1 -1
- package/dist/components/{p-D_Tdq4Z0.js → p-DjAiIBXv.js} +1 -1
- package/dist/components/p-DykzXVCs.js +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/kritzel-active-users_42.entry.js +105 -63
- package/dist/esm/loader.js +1 -1
- package/dist/esm/stencil.js +1 -1
- package/dist/esm/{workspace.migrations-DbozNwZA.js → workspace.migrations-BnTvdnKU.js} +47 -33
- package/dist/stencil/index.esm.js +1 -1
- package/dist/stencil/p-BnTvdnKU.js +1 -0
- package/dist/stencil/p-bfff1c18.entry.js +9 -0
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/types/classes/managers/theme.manager.d.ts +9 -15
- package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +1 -0
- package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +11 -0
- package/dist/types/components/ui/kritzel-settings/kritzel-settings.d.ts +5 -5
- package/dist/types/components.d.ts +20 -13
- package/dist/types/constants/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/p-D5KW6xZV.js +0 -1
- package/dist/stencil/p-523f9e45.entry.js +0 -9
- package/dist/stencil/p-DbozNwZA.js +0 -1
|
@@ -15004,18 +15004,19 @@ class ThemeHelper {
|
|
|
15004
15004
|
}
|
|
15005
15005
|
}
|
|
15006
15006
|
|
|
15007
|
-
/** Key used to store the
|
|
15008
|
-
const
|
|
15007
|
+
/** Key used to store the settings object in localStorage. */
|
|
15008
|
+
const SETTINGS_STORAGE_KEY = 'kritzel-settings';
|
|
15009
15009
|
/** Default theme used when no stored preference exists. */
|
|
15010
15010
|
const DEFAULT_THEME = 'light';
|
|
15011
15011
|
/**
|
|
15012
15012
|
* Manages theme state and application across the Kritzel editor.
|
|
15013
|
-
*
|
|
15013
|
+
* Reads the persisted theme from the settings object in localStorage but does not write to it.
|
|
15014
|
+
* Persistence is handled exclusively by the KritzelSettings component.
|
|
15014
15015
|
*
|
|
15015
15016
|
* The theme manager is responsible for:
|
|
15016
|
-
* -
|
|
15017
|
+
* - Reading the stored theme preference from the settings object
|
|
15017
15018
|
* - Applying CSS custom properties to target elements
|
|
15018
|
-
* - Switching between light and dark themes
|
|
15019
|
+
* - Switching between light and dark themes at runtime
|
|
15019
15020
|
*/
|
|
15020
15021
|
class KritzelThemeManager {
|
|
15021
15022
|
_core;
|
|
@@ -15024,13 +15025,13 @@ class KritzelThemeManager {
|
|
|
15024
15025
|
_storageKey;
|
|
15025
15026
|
/**
|
|
15026
15027
|
* Creates a new KritzelThemeManager instance.
|
|
15027
|
-
* Initializes the current theme from localStorage or uses the default theme.
|
|
15028
|
+
* Initializes the current theme from the settings object in localStorage or uses the default theme.
|
|
15028
15029
|
*
|
|
15029
15030
|
* @param core - The KritzelCore instance this manager belongs to
|
|
15030
15031
|
*/
|
|
15031
15032
|
constructor(core) {
|
|
15032
15033
|
this._core = core;
|
|
15033
|
-
this._storageKey = core.editorId ? `${
|
|
15034
|
+
this._storageKey = core.editorId ? `${SETTINGS_STORAGE_KEY}-${core.editorId}` : SETTINGS_STORAGE_KEY;
|
|
15034
15035
|
this._currentTheme = this.getStoredTheme();
|
|
15035
15036
|
}
|
|
15036
15037
|
/**
|
|
@@ -15072,7 +15073,7 @@ class KritzelThemeManager {
|
|
|
15072
15073
|
return themeName === 'dark' ? darkTheme : lightTheme;
|
|
15073
15074
|
}
|
|
15074
15075
|
/**
|
|
15075
|
-
* Gets the stored theme name from localStorage using this instance's namespaced key.
|
|
15076
|
+
* Gets the stored theme name from the settings object in localStorage using this instance's namespaced key.
|
|
15076
15077
|
*
|
|
15077
15078
|
* @returns The stored theme name if valid, or 'light' as the default
|
|
15078
15079
|
*/
|
|
@@ -15081,13 +15082,22 @@ class KritzelThemeManager {
|
|
|
15081
15082
|
return DEFAULT_THEME;
|
|
15082
15083
|
}
|
|
15083
15084
|
const stored = localStorage.getItem(this._storageKey);
|
|
15084
|
-
if (stored
|
|
15085
|
-
return
|
|
15085
|
+
if (!stored) {
|
|
15086
|
+
return DEFAULT_THEME;
|
|
15087
|
+
}
|
|
15088
|
+
try {
|
|
15089
|
+
const parsed = JSON.parse(stored);
|
|
15090
|
+
if (parsed?.theme === 'dark' || parsed?.theme === 'light') {
|
|
15091
|
+
return parsed.theme;
|
|
15092
|
+
}
|
|
15093
|
+
}
|
|
15094
|
+
catch {
|
|
15095
|
+
// Invalid JSON, use default
|
|
15086
15096
|
}
|
|
15087
15097
|
return DEFAULT_THEME;
|
|
15088
15098
|
}
|
|
15089
15099
|
/**
|
|
15090
|
-
* Gets the stored theme from the default (non-namespaced) localStorage
|
|
15100
|
+
* Gets the stored theme from the default (non-namespaced) settings object in localStorage.
|
|
15091
15101
|
* Used by static utility helpers that don't have access to a core instance.
|
|
15092
15102
|
*
|
|
15093
15103
|
* @returns The stored theme name if valid, or 'light' as the default
|
|
@@ -15096,33 +15106,29 @@ class KritzelThemeManager {
|
|
|
15096
15106
|
if (typeof localStorage === 'undefined') {
|
|
15097
15107
|
return DEFAULT_THEME;
|
|
15098
15108
|
}
|
|
15099
|
-
const stored = localStorage.getItem(
|
|
15100
|
-
if (stored
|
|
15101
|
-
return
|
|
15109
|
+
const stored = localStorage.getItem(SETTINGS_STORAGE_KEY);
|
|
15110
|
+
if (!stored) {
|
|
15111
|
+
return DEFAULT_THEME;
|
|
15102
15112
|
}
|
|
15103
|
-
|
|
15104
|
-
|
|
15105
|
-
|
|
15106
|
-
|
|
15107
|
-
|
|
15108
|
-
*
|
|
15109
|
-
* @param themeName - The theme name to save ('light' or 'dark')
|
|
15110
|
-
*/
|
|
15111
|
-
saveTheme(themeName) {
|
|
15112
|
-
if (typeof localStorage === 'undefined') {
|
|
15113
|
-
return;
|
|
15113
|
+
try {
|
|
15114
|
+
const parsed = JSON.parse(stored);
|
|
15115
|
+
if (parsed?.theme === 'dark' || parsed?.theme === 'light') {
|
|
15116
|
+
return parsed.theme;
|
|
15117
|
+
}
|
|
15114
15118
|
}
|
|
15115
|
-
|
|
15119
|
+
catch {
|
|
15120
|
+
// Invalid JSON, use default
|
|
15121
|
+
}
|
|
15122
|
+
return DEFAULT_THEME;
|
|
15116
15123
|
}
|
|
15117
15124
|
/**
|
|
15118
|
-
* Sets the current theme
|
|
15119
|
-
*
|
|
15125
|
+
* Sets the current theme and applies it to the target element.
|
|
15126
|
+
* Does not persist the theme — persistence is handled by the KritzelSettings component.
|
|
15120
15127
|
*
|
|
15121
15128
|
* @param themeName - The theme name to set ('light' or 'dark')
|
|
15122
15129
|
*/
|
|
15123
15130
|
setTheme(themeName) {
|
|
15124
15131
|
this._currentTheme = themeName;
|
|
15125
|
-
this.saveTheme(themeName);
|
|
15126
15132
|
if (this._targetElement) {
|
|
15127
15133
|
this.applyTheme(themeName);
|
|
15128
15134
|
}
|
|
@@ -20954,25 +20960,33 @@ class KritzelTextTool extends KritzelBaseTool {
|
|
|
20954
20960
|
/** Backing field for {@link opacity}. */
|
|
20955
20961
|
_opacity = 1;
|
|
20956
20962
|
/** The font family for new text objects. */
|
|
20957
|
-
get fontFamily() {
|
|
20963
|
+
get fontFamily() {
|
|
20964
|
+
return this._core?.store?.activeText?.fontFamily ?? this._fontFamily;
|
|
20965
|
+
}
|
|
20958
20966
|
set fontFamily(value) {
|
|
20959
20967
|
this._fontFamily = value;
|
|
20960
20968
|
this.applyToActiveText({ fontFamily: value });
|
|
20961
20969
|
}
|
|
20962
20970
|
/** The font size for new text objects in pixels. */
|
|
20963
|
-
get fontSize() {
|
|
20971
|
+
get fontSize() {
|
|
20972
|
+
return this._core?.store?.activeText?.fontSize ?? this._fontSize;
|
|
20973
|
+
}
|
|
20964
20974
|
set fontSize(value) {
|
|
20965
20975
|
this._fontSize = value;
|
|
20966
20976
|
this.applyToActiveText({ fontSize: value });
|
|
20967
20977
|
}
|
|
20968
20978
|
/** The font color for new text objects (supports theme-aware light/dark colors). */
|
|
20969
|
-
get fontColor() {
|
|
20979
|
+
get fontColor() {
|
|
20980
|
+
return this._core?.store?.activeText?.fontColor ?? this._fontColor;
|
|
20981
|
+
}
|
|
20970
20982
|
set fontColor(value) {
|
|
20971
20983
|
this._fontColor = value;
|
|
20972
20984
|
this.applyToActiveText({ fontColor: value });
|
|
20973
20985
|
}
|
|
20974
20986
|
/** The opacity of new text objects (0-1). */
|
|
20975
|
-
get opacity() {
|
|
20987
|
+
get opacity() {
|
|
20988
|
+
return this._core?.store?.activeText?.opacity ?? this._opacity;
|
|
20989
|
+
}
|
|
20976
20990
|
set opacity(value) {
|
|
20977
20991
|
this._opacity = value;
|
|
20978
20992
|
this.applyToActiveText({ opacity: value });
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { lightTheme } from "../../themes/light-theme";
|
|
2
2
|
import { darkTheme } from "../../themes/dark-theme";
|
|
3
3
|
import { ThemeHelper } from "../../helpers/theme.helper";
|
|
4
|
-
/** Key used to store the
|
|
5
|
-
const
|
|
4
|
+
/** Key used to store the settings object in localStorage. */
|
|
5
|
+
const SETTINGS_STORAGE_KEY = 'kritzel-settings';
|
|
6
6
|
/** Default theme used when no stored preference exists. */
|
|
7
7
|
const DEFAULT_THEME = 'light';
|
|
8
8
|
/**
|
|
9
9
|
* Manages theme state and application across the Kritzel editor.
|
|
10
|
-
*
|
|
10
|
+
* Reads the persisted theme from the settings object in localStorage but does not write to it.
|
|
11
|
+
* Persistence is handled exclusively by the KritzelSettings component.
|
|
11
12
|
*
|
|
12
13
|
* The theme manager is responsible for:
|
|
13
|
-
* -
|
|
14
|
+
* - Reading the stored theme preference from the settings object
|
|
14
15
|
* - Applying CSS custom properties to target elements
|
|
15
|
-
* - Switching between light and dark themes
|
|
16
|
+
* - Switching between light and dark themes at runtime
|
|
16
17
|
*/
|
|
17
18
|
export class KritzelThemeManager {
|
|
18
19
|
_core;
|
|
@@ -21,13 +22,13 @@ export class KritzelThemeManager {
|
|
|
21
22
|
_storageKey;
|
|
22
23
|
/**
|
|
23
24
|
* Creates a new KritzelThemeManager instance.
|
|
24
|
-
* Initializes the current theme from localStorage or uses the default theme.
|
|
25
|
+
* Initializes the current theme from the settings object in localStorage or uses the default theme.
|
|
25
26
|
*
|
|
26
27
|
* @param core - The KritzelCore instance this manager belongs to
|
|
27
28
|
*/
|
|
28
29
|
constructor(core) {
|
|
29
30
|
this._core = core;
|
|
30
|
-
this._storageKey = core.editorId ? `${
|
|
31
|
+
this._storageKey = core.editorId ? `${SETTINGS_STORAGE_KEY}-${core.editorId}` : SETTINGS_STORAGE_KEY;
|
|
31
32
|
this._currentTheme = this.getStoredTheme();
|
|
32
33
|
void this._core;
|
|
33
34
|
}
|
|
@@ -70,7 +71,7 @@ export class KritzelThemeManager {
|
|
|
70
71
|
return themeName === 'dark' ? darkTheme : lightTheme;
|
|
71
72
|
}
|
|
72
73
|
/**
|
|
73
|
-
* Gets the stored theme name from localStorage using this instance's namespaced key.
|
|
74
|
+
* Gets the stored theme name from the settings object in localStorage using this instance's namespaced key.
|
|
74
75
|
*
|
|
75
76
|
* @returns The stored theme name if valid, or 'light' as the default
|
|
76
77
|
*/
|
|
@@ -79,13 +80,22 @@ export class KritzelThemeManager {
|
|
|
79
80
|
return DEFAULT_THEME;
|
|
80
81
|
}
|
|
81
82
|
const stored = localStorage.getItem(this._storageKey);
|
|
82
|
-
if (stored
|
|
83
|
-
return
|
|
83
|
+
if (!stored) {
|
|
84
|
+
return DEFAULT_THEME;
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
const parsed = JSON.parse(stored);
|
|
88
|
+
if (parsed?.theme === 'dark' || parsed?.theme === 'light') {
|
|
89
|
+
return parsed.theme;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
// Invalid JSON, use default
|
|
84
94
|
}
|
|
85
95
|
return DEFAULT_THEME;
|
|
86
96
|
}
|
|
87
97
|
/**
|
|
88
|
-
* Gets the stored theme from the default (non-namespaced) localStorage
|
|
98
|
+
* Gets the stored theme from the default (non-namespaced) settings object in localStorage.
|
|
89
99
|
* Used by static utility helpers that don't have access to a core instance.
|
|
90
100
|
*
|
|
91
101
|
* @returns The stored theme name if valid, or 'light' as the default
|
|
@@ -94,33 +104,29 @@ export class KritzelThemeManager {
|
|
|
94
104
|
if (typeof localStorage === 'undefined') {
|
|
95
105
|
return DEFAULT_THEME;
|
|
96
106
|
}
|
|
97
|
-
const stored = localStorage.getItem(
|
|
98
|
-
if (stored
|
|
99
|
-
return
|
|
107
|
+
const stored = localStorage.getItem(SETTINGS_STORAGE_KEY);
|
|
108
|
+
if (!stored) {
|
|
109
|
+
return DEFAULT_THEME;
|
|
100
110
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
saveTheme(themeName) {
|
|
110
|
-
if (typeof localStorage === 'undefined') {
|
|
111
|
-
return;
|
|
111
|
+
try {
|
|
112
|
+
const parsed = JSON.parse(stored);
|
|
113
|
+
if (parsed?.theme === 'dark' || parsed?.theme === 'light') {
|
|
114
|
+
return parsed.theme;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
// Invalid JSON, use default
|
|
112
119
|
}
|
|
113
|
-
|
|
120
|
+
return DEFAULT_THEME;
|
|
114
121
|
}
|
|
115
122
|
/**
|
|
116
|
-
* Sets the current theme
|
|
117
|
-
*
|
|
123
|
+
* Sets the current theme and applies it to the target element.
|
|
124
|
+
* Does not persist the theme — persistence is handled by the KritzelSettings component.
|
|
118
125
|
*
|
|
119
126
|
* @param themeName - The theme name to set ('light' or 'dark')
|
|
120
127
|
*/
|
|
121
128
|
setTheme(themeName) {
|
|
122
129
|
this._currentTheme = themeName;
|
|
123
|
-
this.saveTheme(themeName);
|
|
124
130
|
if (this._targetElement) {
|
|
125
131
|
this.applyTheme(themeName);
|
|
126
132
|
}
|
|
@@ -19,25 +19,33 @@ export class KritzelTextTool extends KritzelBaseTool {
|
|
|
19
19
|
/** Backing field for {@link opacity}. */
|
|
20
20
|
_opacity = 1;
|
|
21
21
|
/** The font family for new text objects. */
|
|
22
|
-
get fontFamily() {
|
|
22
|
+
get fontFamily() {
|
|
23
|
+
return this._core?.store?.activeText?.fontFamily ?? this._fontFamily;
|
|
24
|
+
}
|
|
23
25
|
set fontFamily(value) {
|
|
24
26
|
this._fontFamily = value;
|
|
25
27
|
this.applyToActiveText({ fontFamily: value });
|
|
26
28
|
}
|
|
27
29
|
/** The font size for new text objects in pixels. */
|
|
28
|
-
get fontSize() {
|
|
30
|
+
get fontSize() {
|
|
31
|
+
return this._core?.store?.activeText?.fontSize ?? this._fontSize;
|
|
32
|
+
}
|
|
29
33
|
set fontSize(value) {
|
|
30
34
|
this._fontSize = value;
|
|
31
35
|
this.applyToActiveText({ fontSize: value });
|
|
32
36
|
}
|
|
33
37
|
/** The font color for new text objects (supports theme-aware light/dark colors). */
|
|
34
|
-
get fontColor() {
|
|
38
|
+
get fontColor() {
|
|
39
|
+
return this._core?.store?.activeText?.fontColor ?? this._fontColor;
|
|
40
|
+
}
|
|
35
41
|
set fontColor(value) {
|
|
36
42
|
this._fontColor = value;
|
|
37
43
|
this.applyToActiveText({ fontColor: value });
|
|
38
44
|
}
|
|
39
45
|
/** The opacity of new text objects (0-1). */
|
|
40
|
-
get opacity() {
|
|
46
|
+
get opacity() {
|
|
47
|
+
return this._core?.store?.activeText?.opacity ?? this._opacity;
|
|
48
|
+
}
|
|
41
49
|
set opacity(value) {
|
|
42
50
|
this._opacity = value;
|
|
43
51
|
this.applyToActiveText({ opacity: value });
|
|
@@ -279,6 +279,9 @@ export class KritzelEditor {
|
|
|
279
279
|
}
|
|
280
280
|
onCurrentThemeChange() {
|
|
281
281
|
setTimeout(() => this.setOsSpecificCssVariables(), 0);
|
|
282
|
+
if (this.engineRef) {
|
|
283
|
+
this.engineRef.saveSettings(this.currentSettingsConfig);
|
|
284
|
+
}
|
|
282
285
|
}
|
|
283
286
|
onTouchStart(event) {
|
|
284
287
|
if (event.cancelable) {
|
|
@@ -555,6 +558,9 @@ export class KritzelEditor {
|
|
|
555
558
|
this.viewportBoundaryBottom = event.detail.viewportBoundaryBottom ?? Infinity;
|
|
556
559
|
this.debugInfo = event.detail.debugInfo;
|
|
557
560
|
this.themeChange.emit(event.detail.theme);
|
|
561
|
+
if (this.engineRef) {
|
|
562
|
+
this.engineRef.saveSettings(event.detail);
|
|
563
|
+
}
|
|
558
564
|
}
|
|
559
565
|
get moreMenuItems() {
|
|
560
566
|
return [
|
|
@@ -677,6 +683,19 @@ export class KritzelEditor {
|
|
|
677
683
|
async loadShortcuts() {
|
|
678
684
|
this.shortcuts = await this.engineRef.getDisplayableShortcuts();
|
|
679
685
|
}
|
|
686
|
+
get currentSettingsConfig() {
|
|
687
|
+
return {
|
|
688
|
+
scaleMin: this.scaleMin,
|
|
689
|
+
scaleMax: this.scaleMax,
|
|
690
|
+
lockDrawingScale: this.lockDrawingScale,
|
|
691
|
+
theme: this.currentTheme,
|
|
692
|
+
viewportBoundaryLeft: this.viewportBoundaryLeft,
|
|
693
|
+
viewportBoundaryRight: this.viewportBoundaryRight,
|
|
694
|
+
viewportBoundaryTop: this.viewportBoundaryTop,
|
|
695
|
+
viewportBoundaryBottom: this.viewportBoundaryBottom,
|
|
696
|
+
debugInfo: this.debugInfo,
|
|
697
|
+
};
|
|
698
|
+
}
|
|
680
699
|
getContentObjects(objects) {
|
|
681
700
|
return objects.filter(obj => !(obj instanceof KritzelSelectionGroup) && !(obj instanceof KritzelSelectionBox));
|
|
682
701
|
}
|
|
@@ -723,27 +742,27 @@ export class KritzelEditor {
|
|
|
723
742
|
const isLoggedIn = this.isLoggedIn;
|
|
724
743
|
const shouldShowCurrentUser = isLoggedIn;
|
|
725
744
|
const shouldShowLoginButton = !!this.loginConfig && !isLoggedIn;
|
|
726
|
-
return (h(Host, { key: '
|
|
745
|
+
return (h(Host, { key: 'e259a79d0fb8e39be29f338c78b3b686c82790ff' }, h("div", { key: '2aa5768df3fe0442ff4b032c1f3defa3e2414d4b', class: "top-left-buttons" }, h("kritzel-workspace-manager", { key: '6bade436347fba887007843ed3ad71f85ea4acb0', visible: this.isWorkspaceManagerVisible, workspaces: this.workspaces, activeWorkspace: this.activeWorkspace, onWorkspaceChange: event => (this.activeWorkspace = event.detail), onIsWorkspaceManagerReady: () => (this.isWorkspaceManagerReady = true) }), h("kritzel-back-to-content", { key: 'cdbf4c27695a5daefe9548a642a9dcd0aff7a77b', visible: this.isBackToContentButtonVisible, onBackToContent: () => this.backToContent() })), h("kritzel-engine", { key: 'e0ac833bd839c04d90c8788663ea0afd6aa35c39', ref: el => {
|
|
727
746
|
if (el) {
|
|
728
747
|
this.engineRef = el;
|
|
729
748
|
}
|
|
730
|
-
}, workspace: this.activeWorkspace, activeWorkspaceId: this.activeWorkspaceId, editorId: this.editorId, syncConfig: this.syncConfig, assetStorageConfig: this.assetStorageConfig, user: this.user, scaleMax: this.scaleMax, lockDrawingScale: this.lockDrawingScale, scaleMin: this.scaleMin, cursorTarget: this.cursorTarget, isLoading: this.isLoading, viewportBoundaryLeft: this.viewportBoundaryLeft, viewportBoundaryRight: this.viewportBoundaryRight, viewportBoundaryTop: this.viewportBoundaryTop, viewportBoundaryBottom: this.viewportBoundaryBottom, wheelEnabled: this.wheelEnabled, theme: this.currentTheme, debugInfo: this.debugInfo, globalContextMenuItems: this.globalContextMenuItems, objectContextMenuItems: this.objectContextMenuItems, onIsEngineReady: event => this.onEngineReady(event), onWorkspacesChange: event => this.handleWorkspacesChange(event), onActiveWorkspaceChange: event => this.handleActiveWorkspaceChange(event), onObjectsChange: event => this.handleObjectsChange(event), onObjectsAdded: event => this.handleObjectsAdded(event), onObjectsRemoved: event => this.handleObjectsRemoved(event), onObjectsUpdated: event => this.handleObjectsUpdated(event), onUndoStateChange: event => this.handleUndoStateChange(event), onObjectsInViewportChange: event => this.handleObjectsInViewportChange(event), onViewportChange: event => this.handleViewportChange(event), onAwarenessChange: event => this.handleAwarenessChange(event) }), h("kritzel-controls", { key: '
|
|
749
|
+
}, workspace: this.activeWorkspace, activeWorkspaceId: this.activeWorkspaceId, editorId: this.editorId, syncConfig: this.syncConfig, assetStorageConfig: this.assetStorageConfig, user: this.user, scaleMax: this.scaleMax, lockDrawingScale: this.lockDrawingScale, scaleMin: this.scaleMin, cursorTarget: this.cursorTarget, isLoading: this.isLoading, viewportBoundaryLeft: this.viewportBoundaryLeft, viewportBoundaryRight: this.viewportBoundaryRight, viewportBoundaryTop: this.viewportBoundaryTop, viewportBoundaryBottom: this.viewportBoundaryBottom, wheelEnabled: this.wheelEnabled, theme: this.currentTheme, debugInfo: this.debugInfo, globalContextMenuItems: this.globalContextMenuItems, objectContextMenuItems: this.objectContextMenuItems, onIsEngineReady: event => this.onEngineReady(event), onWorkspacesChange: event => this.handleWorkspacesChange(event), onActiveWorkspaceChange: event => this.handleActiveWorkspaceChange(event), onObjectsChange: event => this.handleObjectsChange(event), onObjectsAdded: event => this.handleObjectsAdded(event), onObjectsRemoved: event => this.handleObjectsRemoved(event), onObjectsUpdated: event => this.handleObjectsUpdated(event), onUndoStateChange: event => this.handleUndoStateChange(event), onObjectsInViewportChange: event => this.handleObjectsInViewportChange(event), onViewportChange: event => this.handleViewportChange(event), onAwarenessChange: event => this.handleAwarenessChange(event) }), h("kritzel-controls", { key: '396ed985b464306a845a4ef4f54782ccc42bd344', class: { 'keyboard-open': this.isVirtualKeyboardOpen }, style: { display: this.isControlsVisible ? 'flex' : 'none' }, ref: el => {
|
|
731
750
|
if (el) {
|
|
732
751
|
this.controlsRef = el;
|
|
733
752
|
}
|
|
734
|
-
}, controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.currentTheme, onIsControlsReady: () => (this.isControlsReady = true) }), h("div", { key: '
|
|
753
|
+
}, controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, undoState: this.undoState ?? undefined, theme: this.currentTheme, onIsControlsReady: () => (this.isControlsReady = true) }), h("div", { key: '67fdbff9c0259c02bd02bc1342856bc4bdac6d9f', class: "top-right-buttons" }, h("kritzel-settings", { key: '08e1bbfc902e8fe24395babef675654d84bc2dfc', ref: el => {
|
|
735
754
|
if (el) {
|
|
736
755
|
this.settingsRef = el;
|
|
737
756
|
}
|
|
738
|
-
}, shortcuts: this.shortcuts,
|
|
757
|
+
}, shortcuts: this.shortcuts, settings: this.currentSettingsConfig, onSettingsChange: event => this.handleSettingsChange(event) }), h("kritzel-export", { key: 'e3250aaecf428bf763aefea11167b72587cee52d', ref: el => {
|
|
739
758
|
if (el) {
|
|
740
759
|
this.exportRef = el;
|
|
741
760
|
}
|
|
742
|
-
}, workspaceName: this.activeWorkspace?.name || 'workspace', onExportPng: () => this.engineRef.exportViewportAsPng(), onExportSvg: () => this.engineRef.exportViewportAsSvg(), onExportJson: event => this.engineRef.downloadAsJson(event.detail) }), h("kritzel-active-users", { key: '
|
|
761
|
+
}, workspaceName: this.activeWorkspace?.name || 'workspace', onExportPng: () => this.engineRef.exportViewportAsPng(), onExportSvg: () => this.engineRef.exportViewportAsSvg(), onExportJson: event => this.engineRef.downloadAsJson(event.detail) }), h("kritzel-active-users", { key: '6ba93cfeb8eb28d6e7a7c0d8f6813300bd14bd2b', users: this.activeUsers }), shouldShowCurrentUser && h("kritzel-current-user", { key: '4efef69fc7c1b443f6e12fdcda5ed8d26dbebcd3', user: this.user }), shouldShowLoginButton && h("kritzel-button", { key: '54208a3e130fe41f7429516d52f166b08de7e24c', onButtonClick: () => this.loginDialogRef?.open() }, "Sign in"), h("kritzel-more-menu", { key: 'b5a6f5e0e5465655d109ee9047cba97200f94639', items: this.moreMenuItems, visible: this.isMoreMenuVisible }), h("kritzel-share-dialog", { key: 'ee32c5f54395db794ab77ecd0f2e9657db6765c0', ref: el => {
|
|
743
762
|
if (el) {
|
|
744
763
|
this.shareDialogRef = el;
|
|
745
764
|
}
|
|
746
|
-
}, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (h("kritzel-login-dialog", { key: '
|
|
765
|
+
}, isPublic: this.currentIsPublic, workspaceId: this.activeWorkspace?.id, onToggleIsPublic: this.handleToggleIsPublic }), this.loginConfig && (h("kritzel-login-dialog", { key: 'b24a52c160d828218d949ac1d8b9edd9b3c00535', ref: el => {
|
|
747
766
|
if (el) {
|
|
748
767
|
this.loginDialogRef = el;
|
|
749
768
|
}
|
|
@@ -1236,6 +1236,31 @@ export class KritzelEngine {
|
|
|
1236
1236
|
this._isAssetStorageInitialized = false;
|
|
1237
1237
|
await this.initializeSyncAndWorkspace();
|
|
1238
1238
|
}
|
|
1239
|
+
/**
|
|
1240
|
+
* Persists the given settings object to localStorage using the namespaced storage key.
|
|
1241
|
+
* @param settings - The settings configuration to persist.
|
|
1242
|
+
*/
|
|
1243
|
+
async saveSettings(settings) {
|
|
1244
|
+
const key = this.core.getStorageKey('kritzel-settings');
|
|
1245
|
+
localStorage.setItem(key, JSON.stringify(settings));
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Loads the persisted settings object from localStorage.
|
|
1249
|
+
* @returns The stored settings, or null if nothing is stored or the value is invalid.
|
|
1250
|
+
*/
|
|
1251
|
+
async loadSettings() {
|
|
1252
|
+
const key = this.core.getStorageKey('kritzel-settings');
|
|
1253
|
+
const stored = localStorage.getItem(key);
|
|
1254
|
+
if (!stored) {
|
|
1255
|
+
return null;
|
|
1256
|
+
}
|
|
1257
|
+
try {
|
|
1258
|
+
return JSON.parse(stored);
|
|
1259
|
+
}
|
|
1260
|
+
catch {
|
|
1261
|
+
return null;
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1239
1264
|
core;
|
|
1240
1265
|
viewport;
|
|
1241
1266
|
contextMenuHandler;
|
|
@@ -4470,6 +4495,66 @@ export class KritzelEngine {
|
|
|
4470
4495
|
"text": "Reinitializes sync by performing a full teardown and re-initialization.\nDestroys the current Yjs documents and providers, then rebuilds everything\nfrom the current syncConfig. Data reloads from IndexedDB nearly instantly.\nCall this after updating the syncConfig prop (e.g. after authentication state changes).",
|
|
4471
4496
|
"tags": []
|
|
4472
4497
|
}
|
|
4498
|
+
},
|
|
4499
|
+
"saveSettings": {
|
|
4500
|
+
"complexType": {
|
|
4501
|
+
"signature": "(settings: KritzelSettingsConfig) => Promise<void>",
|
|
4502
|
+
"parameters": [{
|
|
4503
|
+
"name": "settings",
|
|
4504
|
+
"type": "KritzelSettingsConfig",
|
|
4505
|
+
"docs": "- The settings configuration to persist."
|
|
4506
|
+
}],
|
|
4507
|
+
"references": {
|
|
4508
|
+
"Promise": {
|
|
4509
|
+
"location": "global",
|
|
4510
|
+
"id": "global::Promise"
|
|
4511
|
+
},
|
|
4512
|
+
"KritzelSettingsConfig": {
|
|
4513
|
+
"location": "import",
|
|
4514
|
+
"path": "../../../interfaces/settings.interface",
|
|
4515
|
+
"id": "src/interfaces/settings.interface.ts::KritzelSettingsConfig",
|
|
4516
|
+
"referenceLocation": "KritzelSettingsConfig"
|
|
4517
|
+
}
|
|
4518
|
+
},
|
|
4519
|
+
"return": "Promise<void>"
|
|
4520
|
+
},
|
|
4521
|
+
"docs": {
|
|
4522
|
+
"text": "Persists the given settings object to localStorage using the namespaced storage key.",
|
|
4523
|
+
"tags": [{
|
|
4524
|
+
"name": "param",
|
|
4525
|
+
"text": "settings - The settings configuration to persist."
|
|
4526
|
+
}]
|
|
4527
|
+
}
|
|
4528
|
+
},
|
|
4529
|
+
"loadSettings": {
|
|
4530
|
+
"complexType": {
|
|
4531
|
+
"signature": "() => Promise<Partial<KritzelSettingsConfig> | null>",
|
|
4532
|
+
"parameters": [],
|
|
4533
|
+
"references": {
|
|
4534
|
+
"Promise": {
|
|
4535
|
+
"location": "global",
|
|
4536
|
+
"id": "global::Promise"
|
|
4537
|
+
},
|
|
4538
|
+
"Partial": {
|
|
4539
|
+
"location": "global",
|
|
4540
|
+
"id": "global::Partial"
|
|
4541
|
+
},
|
|
4542
|
+
"KritzelSettingsConfig": {
|
|
4543
|
+
"location": "import",
|
|
4544
|
+
"path": "../../../interfaces/settings.interface",
|
|
4545
|
+
"id": "src/interfaces/settings.interface.ts::KritzelSettingsConfig",
|
|
4546
|
+
"referenceLocation": "KritzelSettingsConfig"
|
|
4547
|
+
}
|
|
4548
|
+
},
|
|
4549
|
+
"return": "Promise<Partial<KritzelSettingsConfig>>"
|
|
4550
|
+
},
|
|
4551
|
+
"docs": {
|
|
4552
|
+
"text": "Loads the persisted settings object from localStorage.",
|
|
4553
|
+
"tags": [{
|
|
4554
|
+
"name": "returns",
|
|
4555
|
+
"text": "The stored settings, or null if nothing is stored or the value is invalid."
|
|
4556
|
+
}]
|
|
4557
|
+
}
|
|
4473
4558
|
}
|
|
4474
4559
|
};
|
|
4475
4560
|
}
|