kritzel-stencil 0.1.14 → 0.1.15

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.
Files changed (194) hide show
  1. package/dist/cjs/{default-line-tool.config-DvzIh9zU.js → default-line-tool.config-DuwiflC4.js} +772 -109
  2. package/dist/cjs/index.cjs.js +4 -1
  3. package/dist/cjs/kritzel-back-to-content_32.cjs.entry.js +228 -144
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/stencil.cjs.js +1 -1
  6. package/dist/collection/classes/core/core.class.js +6 -0
  7. package/dist/collection/classes/handlers/line-handle.handler.js +3 -2
  8. package/dist/collection/classes/managers/theme.manager.js +104 -0
  9. package/dist/collection/classes/objects/line.class.js +5 -3
  10. package/dist/collection/classes/objects/path.class.js +3 -3
  11. package/dist/collection/classes/objects/selection-box.class.js +2 -2
  12. package/dist/collection/classes/objects/shape.class.js +12 -11
  13. package/dist/collection/classes/objects/text.class.js +5 -4
  14. package/dist/collection/classes/tools/brush-tool.class.js +1 -1
  15. package/dist/collection/classes/tools/line-tool.class.js +3 -27
  16. package/dist/collection/classes/tools/selection-tool.class.js +6 -4
  17. package/dist/collection/classes/tools/shape-tool.class.js +5 -20
  18. package/dist/collection/classes/tools/text-tool.class.js +3 -18
  19. package/dist/collection/components/core/kritzel-editor/kritzel-editor.css +1 -1
  20. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +38 -2
  21. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +75 -24
  22. package/dist/collection/components/shared/kritzel-color/kritzel-color.css +5 -1
  23. package/dist/collection/components/shared/kritzel-color/kritzel-color.js +51 -8
  24. package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.css +1 -1
  25. package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js +70 -17
  26. package/dist/collection/components/shared/kritzel-dialog/kritzel-dialog.css +2 -2
  27. package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.css +14 -14
  28. package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.css +1 -1
  29. package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.css +1 -1
  30. package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js +3 -2
  31. package/dist/collection/components/shared/kritzel-line-endings/kritzel-line-endings.css +1 -1
  32. package/dist/collection/components/shared/kritzel-line-endings/kritzel-line-endings.js +3 -25
  33. package/dist/collection/components/shared/kritzel-master-detail/kritzel-master-detail.css +2 -2
  34. package/dist/collection/components/shared/kritzel-menu/kritzel-menu.css +1 -1
  35. package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.css +6 -5
  36. package/dist/collection/components/shared/kritzel-numeric-input/kritzel-numeric-input.css +1 -1
  37. package/dist/collection/components/shared/kritzel-numeric-input/kritzel-numeric-input.js +1 -1
  38. package/dist/collection/components/shared/kritzel-opacity-slider/kritzel-opacity-slider.css +3 -3
  39. package/dist/collection/components/shared/kritzel-portal/kritzel-portal.js +46 -1
  40. package/dist/collection/components/shared/kritzel-shape-fill/kritzel-shape-fill.css +1 -1
  41. package/dist/collection/components/shared/kritzel-shape-fill/kritzel-shape-fill.js +3 -3
  42. package/dist/collection/components/shared/kritzel-slide-toggle/kritzel-slide-toggle.css +2 -1
  43. package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.css +2 -2
  44. package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.css +1 -1
  45. package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js +1 -1
  46. package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.css +6 -5
  47. package/dist/collection/components/ui/kritzel-back-to-content/kritzel-back-to-content.css +1 -1
  48. package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.css +1 -1
  49. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.css +7 -7
  50. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +45 -7
  51. package/dist/collection/components/ui/kritzel-export/kritzel-export.css +9 -13
  52. package/dist/collection/components/ui/kritzel-more-menu/kritzel-more-menu.css +8 -8
  53. package/dist/collection/components/ui/kritzel-settings/kritzel-settings.js +15 -3
  54. package/dist/collection/components/ui/kritzel-tool-config/kritzel-tool-config.js +39 -4
  55. package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.css +7 -6
  56. package/dist/collection/configs/default-brush-tool.config.js +1 -1
  57. package/dist/collection/configs/default-line-tool.config.js +1 -1
  58. package/dist/collection/configs/default-shape-tool.config.js +3 -3
  59. package/dist/collection/configs/default-text-tool.config.js +1 -1
  60. package/dist/collection/constants/color-palette.constants.js +31 -24
  61. package/dist/collection/constants/version.js +1 -1
  62. package/dist/collection/helpers/color.helper.js +23 -5
  63. package/dist/collection/helpers/theme.helper.js +69 -0
  64. package/dist/collection/index.js +4 -0
  65. package/dist/collection/interfaces/theme.interface.js +1 -0
  66. package/dist/collection/themes/dark-theme.js +236 -0
  67. package/dist/collection/themes/light-theme.js +233 -0
  68. package/dist/components/index.d.ts +1 -1
  69. package/dist/components/index.js +1 -1
  70. package/dist/components/kritzel-back-to-content.js +1 -1
  71. package/dist/components/kritzel-brush-style.js +1 -1
  72. package/dist/components/kritzel-color-palette.js +1 -1
  73. package/dist/components/kritzel-color.js +1 -1
  74. package/dist/components/kritzel-context-menu.js +1 -1
  75. package/dist/components/kritzel-controls.js +1 -1
  76. package/dist/components/kritzel-dialog.js +1 -1
  77. package/dist/components/kritzel-dropdown.js +1 -1
  78. package/dist/components/kritzel-editor.js +1 -1
  79. package/dist/components/kritzel-engine.js +1 -1
  80. package/dist/components/kritzel-export.js +1 -1
  81. package/dist/components/kritzel-font-family.js +1 -1
  82. package/dist/components/kritzel-font-size.js +1 -1
  83. package/dist/components/kritzel-line-endings.js +1 -1
  84. package/dist/components/kritzel-master-detail.js +1 -1
  85. package/dist/components/kritzel-menu-item.js +1 -1
  86. package/dist/components/kritzel-menu.js +1 -1
  87. package/dist/components/kritzel-more-menu.js +1 -1
  88. package/dist/components/kritzel-numeric-input.js +1 -1
  89. package/dist/components/kritzel-opacity-slider.js +1 -1
  90. package/dist/components/kritzel-portal.js +1 -1
  91. package/dist/components/kritzel-settings.js +1 -1
  92. package/dist/components/kritzel-shape-fill.js +1 -1
  93. package/dist/components/kritzel-slide-toggle.js +1 -1
  94. package/dist/components/kritzel-split-button.js +1 -1
  95. package/dist/components/kritzel-stroke-size.js +1 -1
  96. package/dist/components/kritzel-tool-config.js +1 -1
  97. package/dist/components/kritzel-tooltip.js +1 -1
  98. package/dist/components/kritzel-utility-panel.js +1 -1
  99. package/dist/components/kritzel-workspace-manager.js +1 -1
  100. package/dist/components/p-6USF_L1F.js +1 -0
  101. package/dist/components/p-8uzm1dKV.js +1 -0
  102. package/dist/components/p-B5R3r6_m.js +1 -0
  103. package/dist/components/p-B6L-euG3.js +1 -0
  104. package/dist/components/{p-CSWxqKCC.js → p-BMYSfzzJ.js} +1 -1
  105. package/dist/components/{p-B6UZznNo.js → p-BXNQ6L9k.js} +1 -1
  106. package/dist/components/p-BbfgUPVl.js +1 -0
  107. package/dist/components/p-BqZdHh6f.js +1 -0
  108. package/dist/components/p-C5flBv2m.js +1 -0
  109. package/dist/components/{p-DN1_B6ky.js → p-CCvoXqIn.js} +1 -1
  110. package/dist/components/{p-C7GNWyf2.js → p-CIAs81AV.js} +1 -1
  111. package/dist/components/p-CJTKpwmi.js +1 -0
  112. package/dist/components/{p-CIiUpoDZ.js → p-CKG7ycw4.js} +1 -1
  113. package/dist/components/{p-BtGrZ0-u.js → p-CTQmvTXG.js} +1 -1
  114. package/dist/components/p-CYPjUjdI.js +1 -0
  115. package/dist/components/p-CinNuTeF.js +1 -0
  116. package/dist/components/p-Cz1aTJ3F.js +1 -0
  117. package/dist/components/p-D9GoermT.js +1 -0
  118. package/dist/components/p-DBmK9l5y.js +1 -0
  119. package/dist/components/p-DRXq8ybi.js +1 -0
  120. package/dist/components/{p-CEYFDak6.js → p-Dme4j-Ei.js} +1 -1
  121. package/dist/components/p-DnB4Srvo.js +1 -0
  122. package/dist/components/{p-C2cNCqzd.js → p-Mre0ZWEc.js} +1 -1
  123. package/dist/components/p-NBmc8spY.js +9 -0
  124. package/dist/components/p-RU06uu0S.js +1 -0
  125. package/dist/components/p-et8QBqmj.js +1 -0
  126. package/dist/components/{p-BCZgrVsy.js → p-hIj0tNZB.js} +1 -1
  127. package/dist/components/p-ki9PrPGQ.js +1 -0
  128. package/dist/components/{p-BG4Z2Dwn.js → p-n0XDtwWP.js} +1 -1
  129. package/dist/esm/{default-line-tool.config-cZLDi3SD.js → default-line-tool.config-CuDRR6We.js} +769 -110
  130. package/dist/esm/index.js +2 -2
  131. package/dist/esm/kritzel-back-to-content_32.entry.js +228 -144
  132. package/dist/esm/loader.js +1 -1
  133. package/dist/esm/stencil.js +1 -1
  134. package/dist/stencil/index.esm.js +1 -1
  135. package/dist/stencil/p-781f1927.entry.js +9 -0
  136. package/dist/stencil/p-CuDRR6We.js +1 -0
  137. package/dist/stencil/stencil.esm.js +1 -1
  138. package/dist/types/classes/core/core.class.d.ts +3 -0
  139. package/dist/types/classes/managers/theme.manager.d.ts +56 -0
  140. package/dist/types/classes/objects/base-object.class.d.ts +3 -2
  141. package/dist/types/classes/objects/line.class.d.ts +2 -1
  142. package/dist/types/classes/objects/path.class.d.ts +4 -3
  143. package/dist/types/classes/objects/shape.class.d.ts +10 -9
  144. package/dist/types/classes/objects/text.class.d.ts +3 -2
  145. package/dist/types/classes/tools/brush-tool.class.d.ts +3 -2
  146. package/dist/types/classes/tools/line-tool.class.d.ts +3 -2
  147. package/dist/types/classes/tools/selection-tool.class.d.ts +6 -5
  148. package/dist/types/classes/tools/shape-tool.class.d.ts +5 -4
  149. package/dist/types/classes/tools/text-tool.class.d.ts +3 -2
  150. package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +4 -0
  151. package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +4 -0
  152. package/dist/types/components/shared/kritzel-color/kritzel-color.d.ts +5 -2
  153. package/dist/types/components/shared/kritzel-color-palette/kritzel-color-palette.d.ts +6 -3
  154. package/dist/types/components/shared/kritzel-line-endings/kritzel-line-endings.d.ts +0 -2
  155. package/dist/types/components/shared/kritzel-portal/kritzel-portal.d.ts +2 -0
  156. package/dist/types/components/ui/kritzel-controls/kritzel-controls.d.ts +3 -0
  157. package/dist/types/components/ui/kritzel-settings/kritzel-settings.d.ts +4 -0
  158. package/dist/types/components/ui/kritzel-tool-config/kritzel-tool-config.d.ts +4 -1
  159. package/dist/types/components.d.ts +32 -18
  160. package/dist/types/constants/color-palette.constants.d.ts +25 -1
  161. package/dist/types/constants/version.d.ts +1 -1
  162. package/dist/types/helpers/color.helper.d.ts +14 -4
  163. package/dist/types/helpers/theme.helper.d.ts +41 -0
  164. package/dist/types/index.d.ts +4 -0
  165. package/dist/types/interfaces/arrow-head.interface.d.ts +2 -1
  166. package/dist/types/interfaces/line-options.interface.d.ts +2 -1
  167. package/dist/types/interfaces/object.interface.d.ts +3 -2
  168. package/dist/types/interfaces/path-options.interface.d.ts +3 -2
  169. package/dist/types/interfaces/settings.interface.d.ts +3 -0
  170. package/dist/types/interfaces/theme.interface.d.ts +323 -0
  171. package/dist/types/interfaces/toolbar-control.interface.d.ts +11 -10
  172. package/dist/types/themes/dark-theme.d.ts +5 -0
  173. package/dist/types/themes/light-theme.d.ts +5 -0
  174. package/package.json +1 -1
  175. package/dist/components/p-4IV4i5r-.js +0 -1
  176. package/dist/components/p-5Vxv1ZKh.js +0 -1
  177. package/dist/components/p-9VVxMmQY.js +0 -1
  178. package/dist/components/p-BdnNVYxB.js +0 -1
  179. package/dist/components/p-BhTMzfWj.js +0 -1
  180. package/dist/components/p-BtTXKrNq.js +0 -9
  181. package/dist/components/p-C40Eqc_i.js +0 -1
  182. package/dist/components/p-C8jozyvo.js +0 -1
  183. package/dist/components/p-CCiIxqPN.js +0 -1
  184. package/dist/components/p-CP3i626h.js +0 -1
  185. package/dist/components/p-CnO82wQT.js +0 -1
  186. package/dist/components/p-CpfCNRr2.js +0 -1
  187. package/dist/components/p-CuifaWTr.js +0 -1
  188. package/dist/components/p-DSMMwH1h.js +0 -1
  189. package/dist/components/p-DgMrqt6e.js +0 -1
  190. package/dist/components/p-DuK31Tjt.js +0 -1
  191. package/dist/components/p-K1KgiJP8.js +0 -1
  192. package/dist/components/p-yzi-W-0P.js +0 -1
  193. package/dist/stencil/p-1e78ba5f.entry.js +0 -9
  194. package/dist/stencil/p-cZLDi3SD.js +0 -1
@@ -14041,11 +14041,739 @@ Depending on the detected platform, this will hold
14041
14041
  */
14042
14042
  const baseKeymap = mac ? macBaseKeymap : pcBaseKeymap;
14043
14043
 
14044
+ /**
14045
+ * Helper function to resolve a color value for a specific theme
14046
+ */
14047
+ function resolveColor(color, theme) {
14048
+ return color[theme];
14049
+ }
14050
+ /**
14051
+ * Default color palette shared across all tool configurations.
14052
+ * This ensures consistency in color options throughout the application.
14053
+ * All colors support theme-specific variations.
14054
+ */
14055
+ const DEFAULT_COLOR_PALETTE = [
14056
+ { light: '#000000', dark: '#ffffff', label: 'Primary' },
14057
+ { light: '#ff5252', dark: '#ff5252' },
14058
+ { light: '#ffbc00', dark: '#ffbc00' },
14059
+ { light: '#00c853', dark: '#00c853' },
14060
+ { light: '#0000FF', dark: '#0000FF' },
14061
+ { light: '#d500f9', dark: '#d500f9' },
14062
+ { light: '#fafafa', dark: '#212121', label: 'Background' },
14063
+ { light: '#a52714', dark: '#a52714' },
14064
+ { light: '#ee8100', dark: '#ee8100' },
14065
+ { light: '#558b2f', dark: '#558b2f' },
14066
+ { light: '#01579b', dark: '#01579b' },
14067
+ { light: '#8e24aa', dark: '#8e24aa' },
14068
+ { light: '#90a4ae', dark: '#607d8b', label: 'Neutral' },
14069
+ { light: '#ff4081', dark: '#ff4081' },
14070
+ { light: '#ff6e40', dark: '#ff6e40' },
14071
+ { light: '#aeea00', dark: '#aeea00' },
14072
+ { light: '#304ffe', dark: '#304ffe' },
14073
+ { light: '#7c4dff', dark: '#7c4dff' },
14074
+ { light: '#cfd8dc', dark: '#455a64' },
14075
+ { light: '#f8bbd0', dark: '#ec407a' },
14076
+ { light: '#ffccbc', dark: '#ff7043' },
14077
+ { light: '#f0f4c3', dark: '#c0ca33' },
14078
+ { light: '#9fa8da', dark: '#5c6bc0' },
14079
+ { light: '#d1c4e9', dark: '#9575cd' },
14080
+ ];
14081
+
14082
+ /**
14083
+ * Light theme preset - the default theme
14084
+ */
14085
+ const lightTheme = {
14086
+ name: 'light',
14087
+ global: {
14088
+ borderColor: '#ebebeb',
14089
+ dividerColor: '#e0e0e0',
14090
+ focusColor: '#007acc',
14091
+ focusRingColor: 'rgba(0, 122, 255, 0.3)',
14092
+ pointerCursor: 'pointer',
14093
+ hoverBackground: 'hsl(0, 0%, 0%, 4.3%)',
14094
+ iconColor: 'currentColor',
14095
+ scrollbarThumbColor: '#ebebeb',
14096
+ textPrimary: '#000000',
14097
+ textSecondary: '#333333',
14098
+ },
14099
+ selection: {
14100
+ borderColor: '#007AFF',
14101
+ handleColor: '#ffffff',
14102
+ },
14103
+ checkerboard: {
14104
+ colorDark: '#cccccc',
14105
+ colorLight: '#ffffff',
14106
+ },
14107
+ backToContent: {
14108
+ activeBackgroundColor: 'hsl(0, 0%, 0%, 8.6%)',
14109
+ backgroundColor: '#ffffff',
14110
+ border: '1px solid #ebebeb',
14111
+ boxShadow: '0 0 3px rgba(0, 0, 0, 0.08)',
14112
+ color: '#000000',
14113
+ hoverBackgroundColor: 'hsl(0, 0%, 0%, 4.3%)',
14114
+ },
14115
+ colorPalette: {
14116
+ circleBorderColor: '#dddcdc',
14117
+ hoverBackgroundColor: '#ebebeb',
14118
+ selectedBackgroundColor: '#ebebeb',
14119
+ },
14120
+ contextMenu: {
14121
+ backgroundColor: '#ffffff',
14122
+ border: '1px solid #ebebeb',
14123
+ borderRadius: '12px',
14124
+ boxShadow: '0 1px 6px rgba(0, 0, 0, 0.12)',
14125
+ itemActiveBackgroundColor: 'hsl(0, 0%, 0%, 8.6%)',
14126
+ itemBorderRadius: '12px',
14127
+ itemColor: '#333333',
14128
+ itemDisabledColor: '#aaaaaa',
14129
+ itemFontSize: '14px',
14130
+ itemGap: '8px',
14131
+ itemHoverBackgroundColor: 'hsl(0, 0%, 0%, 4.3%)',
14132
+ itemPadding: '8px',
14133
+ padding: '4px',
14134
+ },
14135
+ controls: {
14136
+ backgroundColor: '#ffffff',
14137
+ border: '1px solid #ebebeb',
14138
+ boxShadow: '0 0 3px rgba(0, 0, 0, 0.08)',
14139
+ controlActiveBackgroundColor: 'hsl(0, 0%, 0%, 8.6%)',
14140
+ controlColor: '#000000',
14141
+ controlHoverBackgroundColor: 'hsl(0, 0%, 0%, 4.3%)',
14142
+ controlSelectedBackgroundColor: '#007AFF',
14143
+ controlSelectedColor: '#ffffff',
14144
+ },
14145
+ dialog: {
14146
+ backdropColor: 'rgba(0, 0, 0, 0.4)',
14147
+ backgroundColor: '#ffffff',
14148
+ border: '1px solid #ebebeb',
14149
+ boxShadow: '0 4px 24px rgba(0, 0, 0, 0.15)',
14150
+ closeButtonActiveBackground: 'hsl(0, 0%, 0%, 8.6%)',
14151
+ closeButtonBackground: 'transparent',
14152
+ closeButtonColor: '#333333',
14153
+ closeButtonHoverBackground: 'hsl(0, 0%, 0%, 4.3%)',
14154
+ closeButtonHoverColor: '#000000',
14155
+ fontFamily: 'inherit',
14156
+ footerBorder: '1px solid #ebebeb',
14157
+ headerBorder: '1px solid #ebebeb',
14158
+ titleColor: '#000000',
14159
+ },
14160
+ dropdown: {
14161
+ accentColor: '#007bff',
14162
+ hoverBackgroundColor: '#f0f0f0',
14163
+ selectedBackgroundColor: '#007bff1a',
14164
+ textColor: '#333333',
14165
+ },
14166
+ editor: {
14167
+ controlsBottom: '16px',
14168
+ controlsTransform: 'translateX(-50%)',
14169
+ controlsTransition: 'opacity 0.2s ease',
14170
+ controlsTransitionDuration: '0.2s',
14171
+ topLeftButtonsLeft: '16px',
14172
+ topLeftButtonsTop: '16px',
14173
+ topRightButtonsRight: '16px',
14174
+ topRightButtonsTop: '16px',
14175
+ },
14176
+ engine: {
14177
+ backgroundColor: '#ffffff',
14178
+ },
14179
+ fontSize: {
14180
+ hoverBackgroundColor: '#ebebeb',
14181
+ selectedBackgroundColor: '#ebebeb',
14182
+ textColor: '#333333',
14183
+ },
14184
+ lineEndings: {
14185
+ hoverBackgroundColor: '#ebebeb',
14186
+ labelColor: '#666666',
14187
+ optionBackground: '#ffffff',
14188
+ selectedBackgroundColor: '#ebebeb',
14189
+ },
14190
+ masterDetail: {
14191
+ backButtonColor: '#333333',
14192
+ backgroundColor: '#ffffff',
14193
+ detailBackgroundColor: '#ffffff',
14194
+ detailFocusOutline: '2px solid #007AFF',
14195
+ menuBackgroundColor: '#ffffff',
14196
+ menuBorderRight: '1px solid #ebebeb',
14197
+ menuItemActiveBackgroundColor: 'hsl(0, 0%, 0%, 8.6%)',
14198
+ menuItemBackgroundColor: 'transparent',
14199
+ menuItemChevronColor: '#aaaaaa',
14200
+ menuItemColor: '#333333',
14201
+ menuItemDisabledColor: '#aaaaaa',
14202
+ menuItemFocusOutline: '2px solid #007AFF',
14203
+ menuItemHoverBackgroundColor: 'hsl(0, 0%, 0%, 4.3%)',
14204
+ menuItemSelectedBackgroundColor: '#007AFF',
14205
+ menuItemSelectedColor: '#ffffff',
14206
+ menuItemSelectedHoverBackgroundColor: '#007AFF',
14207
+ },
14208
+ menu: {
14209
+ backgroundColor: '#ffffff',
14210
+ border: '1px solid #ebebeb',
14211
+ borderRadius: '12px',
14212
+ boxShadow: '0 0 3px rgba(0, 0, 0, 0.08)',
14213
+ gap: '4px',
14214
+ itemBorderRadius: '12px',
14215
+ itemButtonHoverBackgroundColor: 'hsl(0, 0%, 0%, 4.3%)',
14216
+ itemChildOpenBackgroundColor: 'hsl(0, 0%, 0%, 3%)',
14217
+ itemColor: '#333333',
14218
+ itemEditingBackgroundColor: '#f0f0f0',
14219
+ itemFontSize: '14px',
14220
+ itemHeight: '40px',
14221
+ itemInputBorder: '1px solid #ccc',
14222
+ itemInputHeight: '32px',
14223
+ itemInputSelectionColor: 'rgba(255, 255, 255, 0.16)',
14224
+ itemInputSelectionTextColor: '#000000',
14225
+ itemMinHeight: '40px',
14226
+ itemOverlayBackgroundColor: 'hsl(0, 0%, 0%, 4.3%)',
14227
+ itemPadding: '8px',
14228
+ itemSelectedBackgroundColor: '#007aff',
14229
+ itemSelectedColor: '#ffffff',
14230
+ padding: '8px',
14231
+ width: '200px',
14232
+ },
14233
+ moreMenu: {
14234
+ buttonActiveBackgroundColor: '#e9e9e9',
14235
+ buttonBackgroundColor: '#ffffff',
14236
+ buttonBorder: '1px solid #ebebeb',
14237
+ buttonBorderRadius: '12px',
14238
+ buttonBoxShadow: '0 0 3px rgba(0, 0, 0, 0.08)',
14239
+ buttonColor: '#000000',
14240
+ buttonHoverBackgroundColor: '#f5f5f5',
14241
+ },
14242
+ numericInput: {
14243
+ borderColor: '#ebebeb',
14244
+ focusBorderColor: '#007AFF',
14245
+ hoverBorderColor: '#ccc',
14246
+ inputBackground: '#ffffff',
14247
+ labelColor: '#666666',
14248
+ spinnerActiveBackground: 'hsl(0, 0%, 0%, 8.6%)',
14249
+ spinnerBackground: 'transparent',
14250
+ spinnerColor: '#333333',
14251
+ spinnerHoverBackground: 'hsl(0, 0%, 0%, 4.3%)',
14252
+ textColor: '#333333',
14253
+ },
14254
+ opacitySlider: {
14255
+ activeColor: '#007AFF',
14256
+ thumbBorderColor: '#007AFF',
14257
+ thumbColor: '#ffffff',
14258
+ trackColor: '#e0e0e0',
14259
+ },
14260
+ portal: {
14261
+ maxHeight: '300px',
14262
+ },
14263
+ settings: {
14264
+ contentHeadingColor: '#000000',
14265
+ contentTextColor: '#333333',
14266
+ descriptionColor: '#666666',
14267
+ labelColor: '#333333',
14268
+ },
14269
+ shapeFill: {
14270
+ hoverBackgroundColor: '#ebebeb',
14271
+ optionBackground: '#ffffff',
14272
+ selectedBackgroundColor: '#ebebeb',
14273
+ },
14274
+ slideToggle: {
14275
+ borderRadius: '11px',
14276
+ height: '22px',
14277
+ thumbColor: '#fff',
14278
+ thumbSize: '18px',
14279
+ trackCheckedColor: '#007AFF',
14280
+ trackColor: '#ccc',
14281
+ transitionDuration: '0.2s',
14282
+ width: '40px',
14283
+ },
14284
+ splitButton: {
14285
+ backgroundColor: '#ffffff',
14286
+ border: '1px solid #ebebeb',
14287
+ boxShadow: '0 0 3px rgba(0, 0, 0, 0.08)',
14288
+ color: '#000000',
14289
+ dividerBackgroundColor: '#ebebeb',
14290
+ hoverBackgroundColor: 'hsl(0, 0%, 0%, 4.3%)',
14291
+ },
14292
+ strokeSize: {
14293
+ hoverBackgroundColor: '#ebebeb',
14294
+ selectedBackgroundColor: '#ebebeb',
14295
+ },
14296
+ submenu: {
14297
+ gap: '4px',
14298
+ },
14299
+ tooltip: {
14300
+ backgroundColor: '#ffffff',
14301
+ border: '1px solid #ebebeb',
14302
+ borderRadius: '16px',
14303
+ boxShadow: '0 1px 6px rgba(0, 0, 0, 0.12)',
14304
+ color: '#000000',
14305
+ padding: '12px',
14306
+ },
14307
+ utilityPanel: {
14308
+ backgroundColor: '#e2e2e2',
14309
+ buttonBorderRadius: '8px',
14310
+ buttonColor: '#333333',
14311
+ buttonHoverBackgroundColor: 'hsl(0, 0%, 0%, 4.3%)',
14312
+ separatorColor: 'hsl(0, 0%, 0%, 8%)',
14313
+ },
14314
+ };
14315
+
14316
+ /**
14317
+ * Dark theme preset
14318
+ */
14319
+ const darkTheme = {
14320
+ name: 'dark',
14321
+ global: {
14322
+ borderColor: '#3a3a3a',
14323
+ dividerColor: '#3a3a3a',
14324
+ focusColor: '#4da3ff',
14325
+ focusRingColor: 'rgba(0, 122, 255, 0.4)',
14326
+ pointerCursor: 'pointer',
14327
+ hoverBackground: 'hsl(0, 0%, 100%, 8%)',
14328
+ iconColor: 'currentColor',
14329
+ scrollbarThumbColor: '#555555',
14330
+ textPrimary: '#ffffff',
14331
+ textSecondary: '#e0e0e0',
14332
+ },
14333
+ selection: {
14334
+ borderColor: '#0A84FF',
14335
+ handleColor: '#1a1a1a',
14336
+ },
14337
+ checkerboard: {
14338
+ colorDark: '#4a4a4a',
14339
+ colorLight: '#3a3a3a',
14340
+ },
14341
+ backToContent: {
14342
+ activeBackgroundColor: 'hsl(0, 0%, 100%, 12%)',
14343
+ backgroundColor: '#2a2a2a',
14344
+ border: '1px solid #3a3a3a',
14345
+ boxShadow: '0 0 6px rgba(0, 0, 0, 0.3)',
14346
+ color: '#ffffff',
14347
+ hoverBackgroundColor: 'hsl(0, 0%, 100%, 8%)',
14348
+ },
14349
+ colorPalette: {
14350
+ circleBorderColor: '#4a4a4a',
14351
+ hoverBackgroundColor: '#3a3a3a',
14352
+ selectedBackgroundColor: '#3a3a3a',
14353
+ },
14354
+ contextMenu: {
14355
+ backgroundColor: '#2a2a2a',
14356
+ border: '1px solid #3a3a3a',
14357
+ borderRadius: '12px',
14358
+ boxShadow: '0 1px 8px rgba(0, 0, 0, 0.4)',
14359
+ itemActiveBackgroundColor: 'hsl(0, 0%, 100%, 12%)',
14360
+ itemBorderRadius: '12px',
14361
+ itemColor: '#e0e0e0',
14362
+ itemDisabledColor: '#666666',
14363
+ itemFontSize: '14px',
14364
+ itemGap: '8px',
14365
+ itemHoverBackgroundColor: 'hsl(0, 0%, 100%, 8%)',
14366
+ itemPadding: '8px',
14367
+ padding: '4px',
14368
+ },
14369
+ controls: {
14370
+ backgroundColor: '#2a2a2a',
14371
+ border: '1px solid #3a3a3a',
14372
+ boxShadow: '0 0 6px rgba(0, 0, 0, 0.3)',
14373
+ controlActiveBackgroundColor: 'hsl(0, 0%, 100%, 12%)',
14374
+ controlColor: '#ffffff',
14375
+ controlHoverBackgroundColor: 'hsl(0, 0%, 100%, 8%)',
14376
+ controlSelectedBackgroundColor: '#0A84FF',
14377
+ controlSelectedColor: '#ffffff',
14378
+ },
14379
+ dialog: {
14380
+ backdropColor: 'rgba(0, 0, 0, 0.6)',
14381
+ backgroundColor: '#2a2a2a',
14382
+ bodyPadding: '16px',
14383
+ border: '1px solid #3a3a3a',
14384
+ borderRadius: '16px',
14385
+ boxShadow: '0 4px 24px rgba(0, 0, 0, 0.5)',
14386
+ closeButtonActiveBackground: 'hsl(0, 0%, 100%, 12%)',
14387
+ closeButtonBackground: 'transparent',
14388
+ closeButtonColor: '#e0e0e0',
14389
+ closeButtonHoverBackground: 'hsl(0, 0%, 100%, 8%)',
14390
+ closeButtonHoverColor: '#ffffff',
14391
+ footerBorder: '1px solid #3a3a3a',
14392
+ headerBorder: '1px solid #3a3a3a',
14393
+ titleColor: '#ffffff',
14394
+ titleFontSize: '18px',
14395
+ titleFontWeight: '600',
14396
+ },
14397
+ dropdown: {
14398
+ accentColor: '#0A84FF',
14399
+ hoverBackgroundColor: '#3a3a3a',
14400
+ selectedBackgroundColor: 'rgba(10, 132, 255, 0.2)',
14401
+ textColor: '#e0e0e0',
14402
+ },
14403
+ editor: {
14404
+ controlsBottom: '16px',
14405
+ controlsTransform: 'translateX(-50%)',
14406
+ controlsTransition: 'opacity 0.2s ease',
14407
+ controlsTransitionDuration: '0.2s',
14408
+ topLeftButtonsLeft: '16px',
14409
+ topLeftButtonsTop: '16px',
14410
+ topRightButtonsRight: '16px',
14411
+ topRightButtonsTop: '16px',
14412
+ },
14413
+ engine: {
14414
+ backgroundColor: '#1a1a1a',
14415
+ },
14416
+ fontSize: {
14417
+ hoverBackgroundColor: '#3a3a3a',
14418
+ selectedBackgroundColor: '#3a3a3a',
14419
+ textColor: '#e0e0e0',
14420
+ },
14421
+ lineEndings: {
14422
+ hoverBackgroundColor: '#3a3a3a',
14423
+ labelColor: '#999999',
14424
+ optionBackground: '#2a2a2a',
14425
+ selectedBackgroundColor: '#3a3a3a',
14426
+ },
14427
+ masterDetail: {
14428
+ backButtonColor: '#e0e0e0',
14429
+ backgroundColor: '#2a2a2a',
14430
+ detailBackgroundColor: '#2a2a2a',
14431
+ detailFocusOutline: '2px solid #0A84FF',
14432
+ menuBackgroundColor: '#2a2a2a',
14433
+ menuBorderRight: '1px solid #3a3a3a',
14434
+ menuItemActiveBackgroundColor: 'hsl(0, 0%, 100%, 12%)',
14435
+ menuItemBackgroundColor: 'transparent',
14436
+ menuItemChevronColor: '#666666',
14437
+ menuItemColor: '#e0e0e0',
14438
+ menuItemDisabledColor: '#666666',
14439
+ menuItemFocusOutline: '2px solid #0A84FF',
14440
+ menuItemHoverBackgroundColor: 'hsl(0, 0%, 100%, 8%)',
14441
+ menuItemSelectedBackgroundColor: '#0A84FF',
14442
+ menuItemSelectedColor: '#ffffff',
14443
+ menuItemSelectedHoverBackgroundColor: '#0A84FF',
14444
+ },
14445
+ menu: {
14446
+ backgroundColor: '#2a2a2a',
14447
+ border: '1px solid #3a3a3a',
14448
+ borderRadius: '12px',
14449
+ boxShadow: '0 0 6px rgba(0, 0, 0, 0.3)',
14450
+ gap: '4px',
14451
+ itemBorderRadius: '12px',
14452
+ itemButtonHoverBackgroundColor: 'hsl(0, 0%, 100%, 8%)',
14453
+ itemChildOpenBackgroundColor: 'hsl(0, 0%, 100%, 6%)',
14454
+ itemColor: '#e0e0e0',
14455
+ itemEditingBackgroundColor: '#3a3a3a',
14456
+ itemFontSize: '14px',
14457
+ itemHeight: '40px',
14458
+ itemInputBorder: '1px solid #4a4a4a',
14459
+ itemInputHeight: '32px',
14460
+ itemInputSelectionColor: 'rgba(255, 255, 255, 0.2)',
14461
+ itemInputSelectionTextColor: '#ffffff',
14462
+ itemMinHeight: '40px',
14463
+ itemOverlayBackgroundColor: 'hsl(0, 0%, 0%, 20%)',
14464
+ itemPadding: '8px',
14465
+ itemSelectedBackgroundColor: '#0A84FF',
14466
+ itemSelectedColor: '#ffffff',
14467
+ padding: '8px',
14468
+ width: '200px',
14469
+ },
14470
+ moreMenu: {
14471
+ buttonActiveBackgroundColor: '#444444',
14472
+ buttonBackgroundColor: '#2a2a2a',
14473
+ buttonBorder: '1px solid #3a3a3a',
14474
+ buttonBorderRadius: '12px',
14475
+ buttonBoxShadow: '0 0 6px rgba(0, 0, 0, 0.3)',
14476
+ buttonColor: '#ffffff',
14477
+ buttonHoverBackgroundColor: '#3b3b3b',
14478
+ },
14479
+ numericInput: {
14480
+ borderColor: '#3a3a3a',
14481
+ focusBorderColor: '#0A84FF',
14482
+ hoverBorderColor: '#4a4a4a',
14483
+ inputBackground: '#1a1a1a',
14484
+ labelColor: '#999999',
14485
+ spinnerActiveBackground: 'hsl(0, 0%, 100%, 12%)',
14486
+ spinnerBackground: 'transparent',
14487
+ spinnerColor: '#e0e0e0',
14488
+ spinnerHoverBackground: 'hsl(0, 0%, 100%, 8%)',
14489
+ textColor: '#e0e0e0',
14490
+ },
14491
+ opacitySlider: {
14492
+ activeColor: '#0A84FF',
14493
+ thumbBorderColor: '#0A84FF',
14494
+ thumbColor: '#ffffff',
14495
+ trackColor: '#4a4a4a',
14496
+ },
14497
+ portal: {
14498
+ maxHeight: '300px',
14499
+ },
14500
+ settings: {
14501
+ contentHeadingColor: '#ffffff',
14502
+ contentTextColor: '#e0e0e0',
14503
+ descriptionColor: '#999999',
14504
+ labelColor: '#e0e0e0',
14505
+ },
14506
+ shapeFill: {
14507
+ hoverBackgroundColor: '#3a3a3a',
14508
+ optionBackground: '#2a2a2a',
14509
+ selectedBackgroundColor: '#3a3a3a',
14510
+ },
14511
+ slideToggle: {
14512
+ borderRadius: '11px',
14513
+ height: '22px',
14514
+ thumbColor: '#ffffff',
14515
+ thumbSize: '18px',
14516
+ trackCheckedColor: '#0A84FF',
14517
+ trackColor: '#4a4a4a',
14518
+ transitionDuration: '0.2s',
14519
+ width: '40px',
14520
+ },
14521
+ splitButton: {
14522
+ backgroundColor: '#2a2a2a',
14523
+ border: '1px solid #3a3a3a',
14524
+ boxShadow: '0 0 6px rgba(0, 0, 0, 0.3)',
14525
+ color: '#ffffff',
14526
+ dividerBackgroundColor: '#3a3a3a',
14527
+ hoverBackgroundColor: 'hsl(0, 0%, 100%, 8%)',
14528
+ },
14529
+ strokeSize: {
14530
+ hoverBackgroundColor: '#3a3a3a',
14531
+ selectedBackgroundColor: '#3a3a3a',
14532
+ },
14533
+ submenu: {
14534
+ gap: '4px',
14535
+ },
14536
+ tooltip: {
14537
+ backgroundColor: '#2a2a2a',
14538
+ border: '1px solid #3a3a3a',
14539
+ borderRadius: '16px',
14540
+ boxShadow: '0 1px 8px rgba(0, 0, 0, 0.4)',
14541
+ color: '#ffffff',
14542
+ padding: '12px',
14543
+ },
14544
+ utilityPanel: {
14545
+ backgroundColor: '#3a3a3a',
14546
+ buttonBorderRadius: '8px',
14547
+ buttonColor: '#e0e0e0',
14548
+ buttonHoverBackgroundColor: 'hsl(0, 0%, 100%, 8%)',
14549
+ separatorColor: 'hsl(0, 0%, 100%, 12%)',
14550
+ },
14551
+ };
14552
+
14553
+ class ThemeHelper {
14554
+ /**
14555
+ * Converts a camelCase string to kebab-case.
14556
+ * @example ThemeHelper.camelToKebab('controlHoverBackgroundColor') → 'control-hover-background-color'
14557
+ * @example ThemeHelper.camelToKebab('backgroundColor') → 'background-color'
14558
+ * @example ThemeHelper.camelToKebab('gap') → 'gap'
14559
+ */
14560
+ static camelToKebab(str) {
14561
+ return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
14562
+ }
14563
+ /**
14564
+ * Recursively flattens a theme object into a map of CSS variable names to values.
14565
+ * Skips the 'name' property at the root level since it's the theme identifier, not a CSS value.
14566
+ *
14567
+ * @param theme - The theme object to flatten
14568
+ * @param prefix - The CSS variable prefix (default: '--kritzel')
14569
+ * @returns A Map of CSS variable names to their values
14570
+ *
14571
+ * @example
14572
+ * ThemeHelper.flattenThemeToVariables(lightTheme)
14573
+ * // Returns Map {
14574
+ * // '--kritzel-global-pointer-cursor' => 'pointer',
14575
+ * // '--kritzel-controls-gap' => '8px',
14576
+ * // ...
14577
+ * // }
14578
+ */
14579
+ static flattenThemeToVariables(theme, prefix = '--kritzel') {
14580
+ const variables = new Map();
14581
+ const recurse = (obj, currentPrefix, isRoot = false) => {
14582
+ for (const [key, value] of Object.entries(obj)) {
14583
+ // Skip the 'name' property at the root level
14584
+ if (isRoot && key === 'name') {
14585
+ continue;
14586
+ }
14587
+ const kebabKey = ThemeHelper.camelToKebab(key);
14588
+ const variableName = `${currentPrefix}-${kebabKey}`;
14589
+ if (typeof value === 'object' && value !== null) {
14590
+ recurse(value, variableName);
14591
+ }
14592
+ else if (typeof value === 'string') {
14593
+ variables.set(variableName, value);
14594
+ }
14595
+ }
14596
+ };
14597
+ recurse(theme, prefix, true);
14598
+ return variables;
14599
+ }
14600
+ /**
14601
+ * Applies a map of CSS variables to an HTML element.
14602
+ *
14603
+ * @param element - The target HTML element
14604
+ * @param variables - A Map of CSS variable names to values
14605
+ */
14606
+ static applyVariablesToElement(element, variables) {
14607
+ for (const [name, value] of variables) {
14608
+ element.style.setProperty(name, value);
14609
+ }
14610
+ }
14611
+ /**
14612
+ * Convenience method that flattens a theme and applies it to an element in one call.
14613
+ *
14614
+ * @param element - The target HTML element
14615
+ * @param theme - The theme object to apply
14616
+ */
14617
+ static applyThemeToElement(element, theme) {
14618
+ const variables = ThemeHelper.flattenThemeToVariables(theme);
14619
+ ThemeHelper.applyVariablesToElement(element, variables);
14620
+ }
14621
+ }
14622
+
14623
+ const THEME_STORAGE_KEY = 'kritzel-theme';
14624
+ const DEFAULT_THEME = 'light';
14625
+ /**
14626
+ * Manages theme state and application across the Kritzel editor.
14627
+ * Handles theme persistence, retrieval, and CSS variable application.
14628
+ */
14629
+ class KritzelThemeManager {
14630
+ _core;
14631
+ _currentTheme = DEFAULT_THEME;
14632
+ _targetElement = null;
14633
+ constructor(core) {
14634
+ this._core = core;
14635
+ this._currentTheme = KritzelThemeManager.getStoredTheme();
14636
+ }
14637
+ /**
14638
+ * Gets the current active theme name.
14639
+ */
14640
+ get currentTheme() {
14641
+ return this._currentTheme;
14642
+ }
14643
+ /**
14644
+ * Sets the target element where theme CSS variables will be applied.
14645
+ */
14646
+ setTargetElement(element) {
14647
+ this._targetElement = element;
14648
+ if (this._targetElement) {
14649
+ this.applyTheme(this._currentTheme);
14650
+ }
14651
+ }
14652
+ /**
14653
+ * Gets the current target element.
14654
+ */
14655
+ getTargetElement() {
14656
+ return this._targetElement;
14657
+ }
14658
+ /**
14659
+ * Gets the theme object by name.
14660
+ */
14661
+ getThemeByName(themeName) {
14662
+ return themeName === 'dark' ? darkTheme : lightTheme;
14663
+ }
14664
+ /**
14665
+ * Gets the stored theme name from localStorage.
14666
+ * Can be called statically without a manager instance.
14667
+ * @returns The stored theme name, or 'light' as default
14668
+ */
14669
+ static getStoredTheme() {
14670
+ if (typeof localStorage === 'undefined') {
14671
+ return DEFAULT_THEME;
14672
+ }
14673
+ const stored = localStorage.getItem(THEME_STORAGE_KEY);
14674
+ if (stored === 'dark' || stored === 'light') {
14675
+ return stored;
14676
+ }
14677
+ return DEFAULT_THEME;
14678
+ }
14679
+ /**
14680
+ * Saves the theme name to localStorage.
14681
+ */
14682
+ saveTheme(themeName) {
14683
+ if (typeof localStorage === 'undefined') {
14684
+ return;
14685
+ }
14686
+ localStorage.setItem(THEME_STORAGE_KEY, themeName);
14687
+ }
14688
+ /**
14689
+ * Sets the current theme, saves it to storage, and applies it to the target element.
14690
+ */
14691
+ setTheme(themeName) {
14692
+ this._currentTheme = themeName;
14693
+ this.saveTheme(themeName);
14694
+ if (this._targetElement) {
14695
+ this.applyTheme(themeName);
14696
+ }
14697
+ }
14698
+ /**
14699
+ * Checks if the current theme is dark.
14700
+ */
14701
+ isDarkTheme() {
14702
+ return this._currentTheme === 'dark';
14703
+ }
14704
+ /**
14705
+ * Applies a theme to the target element by setting CSS custom properties.
14706
+ * Uses the generic theme utility to automatically derive CSS variable names
14707
+ * from the theme interface structure.
14708
+ */
14709
+ applyTheme(themeName) {
14710
+ if (!this._targetElement) {
14711
+ return;
14712
+ }
14713
+ const theme = this.getThemeByName(themeName);
14714
+ ThemeHelper.applyThemeToElement(this._targetElement, theme);
14715
+ }
14716
+ /**
14717
+ * Cleans up theme manager state.
14718
+ */
14719
+ cleanup() {
14720
+ this._targetElement = null;
14721
+ }
14722
+ }
14723
+
14724
+ class KritzelColorHelper {
14725
+ /**
14726
+ * Resolves a color value based on the current theme.
14727
+ * Handles both simple string colors and theme-aware color objects.
14728
+ * @param color - The color to resolve (string or ThemeAwareColor)
14729
+ * @param theme - Optional theme to use. If not provided, uses current theme from ThemeManager
14730
+ * @returns The resolved hex color string, or empty string if color is undefined
14731
+ */
14732
+ static resolveThemeColor(color, theme) {
14733
+ if (!color) {
14734
+ return '';
14735
+ }
14736
+ const currentTheme = theme ?? KritzelThemeManager.getStoredTheme();
14737
+ return resolveColor(color, currentTheme);
14738
+ }
14739
+ /**
14740
+ * Applies opacity to a theme-aware color and returns an rgba string.
14741
+ * @param color - The theme-aware color object
14742
+ * @param opacity - The opacity value between 0 and 1
14743
+ * @param theme - Optional theme to use. If not provided, uses current theme from ThemeManager
14744
+ * @returns The color as an rgba string, or the resolved hex if opacity is 1
14745
+ */
14746
+ static applyOpacity(color, opacity, theme) {
14747
+ const hexColor = this.resolveThemeColor(color, theme);
14748
+ if (!hexColor || opacity >= 1)
14749
+ return hexColor;
14750
+ const sanitizedHex = hexColor.startsWith('#') ? hexColor.slice(1) : hexColor;
14751
+ let r, g, b;
14752
+ if (sanitizedHex.length === 3) {
14753
+ r = parseInt(sanitizedHex[0] + sanitizedHex[0], 16);
14754
+ g = parseInt(sanitizedHex[1] + sanitizedHex[1], 16);
14755
+ b = parseInt(sanitizedHex[2] + sanitizedHex[2], 16);
14756
+ }
14757
+ else if (sanitizedHex.length === 6) {
14758
+ r = parseInt(sanitizedHex.substring(0, 2), 16);
14759
+ g = parseInt(sanitizedHex.substring(2, 4), 16);
14760
+ b = parseInt(sanitizedHex.substring(4, 6), 16);
14761
+ }
14762
+ else {
14763
+ return hexColor;
14764
+ }
14765
+ if (isNaN(r) || isNaN(g) || isNaN(b)) {
14766
+ return hexColor;
14767
+ }
14768
+ return `rgba(${r}, ${g}, ${b}, ${opacity})`;
14769
+ }
14770
+ }
14771
+
14044
14772
  class KritzelText extends KritzelBaseObject {
14045
14773
  __class__ = 'KritzelText';
14046
14774
  fontFamily = 'Arial';
14047
14775
  fontSize = 8;
14048
- fontColor = '#000000';
14776
+ fontColor = { light: '#000000', dark: '#ffffff' };
14049
14777
  initialWidth = 1;
14050
14778
  initialHeight = 1;
14051
14779
  scale = 1;
@@ -14079,7 +14807,7 @@ class KritzelText extends KritzelBaseObject {
14079
14807
  this.translateY = config.translateY || 0;
14080
14808
  this.fontSize = config.fontSize || 8;
14081
14809
  this.fontFamily = config.fontFamily || 'Arial';
14082
- this.fontColor = config.fontColor || '#000000';
14810
+ this.fontColor = config.fontColor || { light: '#000000', dark: '#ffffff' };
14083
14811
  this.width = this.initialWidth / (this._core.store.state.scale < 0 ? this._core.store.state.scale : 1);
14084
14812
  this.height = (this.fontSize * 1.2) / (this._core.store.state.scale < 0 ? this._core.store.state.scale : 1);
14085
14813
  this.scale = config.scale || 1;
@@ -14097,7 +14825,7 @@ class KritzelText extends KritzelBaseObject {
14097
14825
  object.translateY = 0;
14098
14826
  object.width = object.initialWidth / (object._core.store.state.scale < 0 ? object._core.store.state.scale : 1);
14099
14827
  object.height = (object.fontSize * 1.2) / (object._core.store.state.scale < 0 ? object._core.store.state.scale : 1);
14100
- object.backgroundColor = 'transparent';
14828
+ object.backgroundColor = { light: 'transparent', dark: 'transparent' };
14101
14829
  object.initialWidth = object.width;
14102
14830
  object.initialHeight = object.height;
14103
14831
  object.scaleFactor = 1;
@@ -14112,7 +14840,7 @@ class KritzelText extends KritzelBaseObject {
14112
14840
  }
14113
14841
  element.style.fontFamily = this.fontFamily;
14114
14842
  element.style.fontSize = `${this.fontSize}pt`;
14115
- element.style.color = this.fontColor;
14843
+ element.style.color = KritzelColorHelper.resolveThemeColor(this.fontColor);
14116
14844
  if (this.isMounted && this.elementRef === element && this.editor.dom.parentElement === element) {
14117
14845
  requestAnimationFrame(() => this.adjustSizeOnInput());
14118
14846
  return;
@@ -14318,7 +15046,7 @@ class KritzelPath extends KritzelBaseObject {
14318
15046
  __class__ = 'KritzelPath';
14319
15047
  points;
14320
15048
  d;
14321
- stroke = 'none';
15049
+ stroke = { light: 'none', dark: 'none' };
14322
15050
  strokeWidth;
14323
15051
  lineSlack = 0.5;
14324
15052
  fill;
@@ -14343,7 +15071,7 @@ class KritzelPath extends KritzelBaseObject {
14343
15071
  this.translateY = config?.translateY ?? 0;
14344
15072
  this.scale = config?.scale ?? 1;
14345
15073
  this.strokeWidth = config?.strokeWidth ?? 8;
14346
- this.fill = config?.fill ?? '#000000';
15074
+ this.fill = config?.fill ?? { light: '#000000', dark: '#ffffff' };
14347
15075
  this.d = this.generateSvgPath();
14348
15076
  this.updateDimensions();
14349
15077
  }
@@ -14358,7 +15086,7 @@ class KritzelPath extends KritzelBaseObject {
14358
15086
  object.translateY = options?.translateY ?? 0;
14359
15087
  object.scale = options?.scale ?? 1;
14360
15088
  object.strokeWidth = options?.strokeWidth ?? 8;
14361
- object.fill = options?.fill ?? '#000000';
15089
+ object.fill = options?.fill ?? { light: '#000000', dark: '#ffffff' };
14362
15090
  object.opacity = options?.opacity ?? 1;
14363
15091
  object.zIndex = core.store.currentZIndex;
14364
15092
  object.d = object.generateSvgPath();
@@ -14780,7 +15508,7 @@ class KritzelLine extends KritzelBaseObject {
14780
15508
  this.translateY = config?.translateY ?? 0;
14781
15509
  this.scale = config?.scale ?? 1;
14782
15510
  this.strokeWidth = config?.strokeWidth ?? 4;
14783
- this.stroke = config?.stroke ?? '#000000';
15511
+ this.stroke = config?.stroke ?? { light: '#000000', dark: '#ffffff' };
14784
15512
  this.startAnchor = config?.startAnchor;
14785
15513
  this.endAnchor = config?.endAnchor;
14786
15514
  this.arrows = config?.arrows;
@@ -14802,7 +15530,7 @@ class KritzelLine extends KritzelBaseObject {
14802
15530
  object.translateY = options?.translateY ?? 0;
14803
15531
  object.scale = options?.scale ?? 1;
14804
15532
  object.strokeWidth = options?.strokeWidth ?? 4;
14805
- object.stroke = options?.stroke ?? '#000000';
15533
+ object.stroke = options?.stroke ?? { light: '#000000', dark: '#ffffff' };
14806
15534
  object.opacity = options?.opacity ?? 1;
14807
15535
  object.startAnchor = options?.startAnchor;
14808
15536
  object.endAnchor = options?.endAnchor;
@@ -15315,7 +16043,8 @@ class KritzelLine extends KritzelBaseObject {
15315
16043
  /** Get the arrow fill color for start or end, defaulting to stroke color */
15316
16044
  getArrowFill(end) {
15317
16045
  const config = end === 'start' ? this.arrows?.start : this.arrows?.end;
15318
- return config?.fill ?? this.stroke;
16046
+ const color = config?.fill ?? this.stroke;
16047
+ return KritzelColorHelper.resolveThemeColor(color);
15319
16048
  }
15320
16049
  /**
15321
16050
  * Generate SVG path data for an arrow head based on the given style.
@@ -15842,39 +16571,8 @@ class KritzelBaseTool {
15842
16571
  }
15843
16572
  }
15844
16573
 
15845
- /**
15846
- * Default color palette shared across all tool configurations.
15847
- * This ensures consistency in color options throughout the application.
15848
- */
15849
- const DEFAULT_COLOR_PALETTE = [
15850
- '#000000',
15851
- '#ff5252',
15852
- '#ffbc00',
15853
- '#00c853',
15854
- '#0000FF',
15855
- '#d500f9',
15856
- '#fafafa',
15857
- '#a52714',
15858
- '#ee8100',
15859
- '#558b2f',
15860
- '#01579b',
15861
- '#8e24aa',
15862
- '#90a4ae',
15863
- '#ff4081',
15864
- '#ff6e40',
15865
- '#aeea00',
15866
- '#304ffe',
15867
- '#7c4dff',
15868
- '#cfd8dc',
15869
- '#f8bbd0',
15870
- '#ffccbc',
15871
- '#f0f4c3',
15872
- '#9fa8da',
15873
- '#d1c4e9',
15874
- ];
15875
-
15876
16574
  class KritzelBrushTool extends KritzelBaseTool {
15877
- color = '#000000';
16575
+ color = DEFAULT_COLOR_PALETTE[0];
15878
16576
  size = 6;
15879
16577
  opacity = 1;
15880
16578
  palette = [...DEFAULT_COLOR_PALETTE];
@@ -16363,35 +17061,10 @@ class KritzelSelectionGroup extends KritzelBaseObject {
16363
17061
  }
16364
17062
 
16365
17063
  class KritzelLineTool extends KritzelBaseTool {
16366
- color = '#000000';
17064
+ color = DEFAULT_COLOR_PALETTE[0];
16367
17065
  size = 4;
16368
17066
  opacity = 1;
16369
- palette = [
16370
- '#000000',
16371
- '#ff5252',
16372
- '#ffbc00',
16373
- '#00c853',
16374
- '#0000FF',
16375
- '#d500f9',
16376
- '#fafafa',
16377
- '#a52714',
16378
- '#ee8100',
16379
- '#558b2f',
16380
- '#01579b',
16381
- '#8e24aa',
16382
- '#90a4ae',
16383
- '#ff4081',
16384
- '#ff6e40',
16385
- '#aeea00',
16386
- '#304ffe',
16387
- '#7c4dff',
16388
- '#cfd8dc',
16389
- '#f8bbd0',
16390
- '#ffccbc',
16391
- '#f0f4c3',
16392
- '#9fa8da',
16393
- '#d1c4e9',
16394
- ];
17067
+ palette = [...DEFAULT_COLOR_PALETTE];
16395
17068
  /** Arrow head configuration for lines created with this tool */
16396
17069
  arrows;
16397
17070
  _startX = 0;
@@ -16745,25 +17418,9 @@ class KritzelImageTool extends KritzelBaseTool {
16745
17418
  class KritzelTextTool extends KritzelBaseTool {
16746
17419
  fontFamily = 'Arial';
16747
17420
  fontSize = 16;
16748
- fontColor = '#000000';
17421
+ fontColor = DEFAULT_COLOR_PALETTE[0];
16749
17422
  opacity = 1;
16750
- palette = [
16751
- '#000000',
16752
- '#FFFFFF',
16753
- '#FF0000',
16754
- '#00FF00',
16755
- '#0000FF',
16756
- '#FFFF00',
16757
- '#FF00FF',
16758
- '#00FFFF',
16759
- '#808080',
16760
- '#C0C0C0',
16761
- '#800000',
16762
- '#008000',
16763
- '#000080',
16764
- '#808000',
16765
- '#800080',
16766
- ];
17423
+ palette = [...DEFAULT_COLOR_PALETTE];
16767
17424
  constructor(core) {
16768
17425
  super(core);
16769
17426
  }
@@ -17541,8 +18198,8 @@ class KritzelSelectionBox extends KritzelBaseObject {
17541
18198
  object.workspaceId = core.store.state.activeWorkspace.id;
17542
18199
  object.scale = core.store.state.scale;
17543
18200
  object.zIndex = 99999;
17544
- object.backgroundColor = 'var(--kritzel-selection-box-background-color, rgba(0, 122, 255, 0.2))';
17545
- object.borderColor = 'var(--kritzel-selection-box-border-color, rgba(0, 122, 255, 0.5))';
18201
+ object.backgroundColor = { light: 'rgba(0, 122, 255, 0.2)', dark: 'rgba(0, 122, 255, 0.2)' };
18202
+ object.borderColor = { light: 'rgba(0, 122, 255, 0.5)', dark: 'rgba(0, 122, 255, 0.5)' };
17546
18203
  object.borderWidth = 2;
17547
18204
  object.height = 0;
17548
18205
  object.width = 0;
@@ -17970,7 +18627,7 @@ class KritzelLineHandleHandler extends KritzelBaseHandler {
17970
18627
  t,
17971
18628
  edgeX,
17972
18629
  edgeY,
17973
- lineStroke: line.stroke,
18630
+ lineStroke: KritzelColorHelper.resolveThemeColor(line.stroke),
17974
18631
  lineStrokeWidth: line.strokeWidth / line.scale,
17975
18632
  arrowOffset: line.hasStartArrow ? line.getArrowSize('start') / line.scale : undefined,
17976
18633
  arrowStyle: line.hasStartArrow ? line.arrows?.start?.style : undefined,
@@ -18032,7 +18689,7 @@ class KritzelLineHandleHandler extends KritzelBaseHandler {
18032
18689
  t,
18033
18690
  edgeX,
18034
18691
  edgeY,
18035
- lineStroke: line.stroke,
18692
+ lineStroke: KritzelColorHelper.resolveThemeColor(line.stroke),
18036
18693
  lineStrokeWidth: line.strokeWidth / line.scale,
18037
18694
  arrowOffset: line.hasEndArrow ? line.getArrowSize('end') / line.scale : undefined,
18038
18695
  arrowStyle: line.hasEndArrow ? line.arrows?.end?.style : undefined,
@@ -18215,12 +18872,12 @@ exports.ShapeType = void 0;
18215
18872
  class KritzelShape extends KritzelBaseObject {
18216
18873
  __class__ = 'KritzelShape';
18217
18874
  shapeType = exports.ShapeType.Rectangle;
18218
- fillColor = 'transparent';
18219
- strokeColor = '#000000';
18875
+ fillColor = { light: 'transparent', dark: 'transparent' };
18876
+ strokeColor = { light: '#000000', dark: '#ffffff' };
18220
18877
  strokeWidth = 4;
18221
18878
  fontFamily = 'Arial';
18222
18879
  fontSize = 16;
18223
- fontColor = '#000000';
18880
+ fontColor = { light: '#000000', dark: '#ffffff' };
18224
18881
  /** Screen-space x coordinate of the shape's top-left corner (like Path.x) */
18225
18882
  x = 0;
18226
18883
  /** Screen-space y coordinate of the shape's top-left corner (like Path.y) */
@@ -18254,12 +18911,12 @@ class KritzelShape extends KritzelBaseObject {
18254
18911
  this.width = config.width ?? 100;
18255
18912
  this.height = config.height ?? 100;
18256
18913
  this.shapeType = config.shapeType ?? exports.ShapeType.Rectangle;
18257
- this.fillColor = config.fillColor ?? 'transparent';
18258
- this.strokeColor = config.strokeColor ?? '#000000';
18914
+ this.fillColor = config.fillColor ?? { light: 'transparent', dark: 'transparent' };
18915
+ this.strokeColor = config.strokeColor ?? { light: '#000000', dark: '#ffffff' };
18259
18916
  this.strokeWidth = config.strokeWidth ?? 4;
18260
18917
  this.fontSize = config.fontSize ?? 16;
18261
18918
  this.fontFamily = config.fontFamily ?? 'Arial';
18262
- this.fontColor = config.fontColor ?? '#000000';
18919
+ this.fontColor = config.fontColor ?? { light: '#000000', dark: '#ffffff' };
18263
18920
  this.scale = config.scale ?? 1;
18264
18921
  this.scaleFactor = config.scaleX ?? 1;
18265
18922
  }
@@ -18284,14 +18941,14 @@ class KritzelShape extends KritzelBaseObject {
18284
18941
  object.width = config?.width ?? 100;
18285
18942
  object.height = config?.height ?? 100;
18286
18943
  object.shapeType = config?.shapeType ?? exports.ShapeType.Rectangle;
18287
- object.fillColor = config?.fillColor ?? 'transparent';
18288
- object.strokeColor = config?.strokeColor ?? '#000000';
18944
+ object.fillColor = config?.fillColor ?? { light: 'transparent', dark: 'transparent' };
18945
+ object.strokeColor = config?.strokeColor ?? { light: '#000000', dark: '#ffffff' };
18289
18946
  object.strokeWidth = config?.strokeWidth ?? 4;
18290
18947
  object.opacity = config?.opacity ?? 1;
18291
18948
  object.fontSize = config?.fontSize ?? 16;
18292
18949
  object.fontFamily = config?.fontFamily ?? 'Arial';
18293
- object.fontColor = config?.fontColor ?? '#000000';
18294
- object.backgroundColor = 'transparent';
18950
+ object.fontColor = config?.fontColor ?? { light: '#000000', dark: '#ffffff' };
18951
+ object.backgroundColor = { light: 'transparent', dark: 'transparent' };
18295
18952
  object.scaleFactor = 1;
18296
18953
  object.scale = config?.scale ?? core.store.state.scale;
18297
18954
  object.zIndex = core.store.currentZIndex;
@@ -18333,7 +18990,7 @@ class KritzelShape extends KritzelBaseObject {
18333
18990
  }
18334
18991
  element.style.fontFamily = this.fontFamily;
18335
18992
  element.style.fontSize = `${this.fontSize}pt`;
18336
- element.style.color = this.fontColor;
18993
+ element.style.color = KritzelColorHelper.resolveThemeColor(this.fontColor);
18337
18994
  element.style.whiteSpace = 'pre-wrap';
18338
18995
  element.style.wordWrap = 'break-word';
18339
18996
  element.innerHTML = '';
@@ -18603,7 +19260,7 @@ class KritzelSelectionTool extends KritzelBaseTool {
18603
19260
  get color() {
18604
19261
  const objects = this.flattenObjects(this.getSelectedObjects());
18605
19262
  if (objects.length === 0)
18606
- return '#000000';
19263
+ return DEFAULT_COLOR_PALETTE[0];
18607
19264
  for (const obj of objects) {
18608
19265
  if (obj instanceof KritzelPath)
18609
19266
  return obj.fill;
@@ -18614,7 +19271,7 @@ class KritzelSelectionTool extends KritzelBaseTool {
18614
19271
  if (obj instanceof KritzelShape)
18615
19272
  return obj.strokeColor;
18616
19273
  }
18617
- return '#000000';
19274
+ return DEFAULT_COLOR_PALETTE[0];
18618
19275
  }
18619
19276
  set color(value) {
18620
19277
  const objects = this.flattenObjects(this.getSelectedObjects());
@@ -18678,7 +19335,7 @@ class KritzelSelectionTool extends KritzelBaseTool {
18678
19335
  if (obj instanceof KritzelShape)
18679
19336
  return obj.fillColor;
18680
19337
  }
18681
- return 'transparent';
19338
+ return { light: 'transparent', dark: 'transparent' };
18682
19339
  }
18683
19340
  set fillColor(value) {
18684
19341
  const objects = this.flattenObjects(this.getSelectedObjects());
@@ -18686,7 +19343,9 @@ class KritzelSelectionTool extends KritzelBaseTool {
18686
19343
  if (obj instanceof KritzelShape) {
18687
19344
  this._core.updateObject(obj, { fillColor: value });
18688
19345
  // When switching to fill mode, also update stroke color to match
18689
- if (value !== 'transparent') {
19346
+ const isTransparent = typeof value === 'string' ? value === 'transparent' :
19347
+ (value.light === 'transparent' && value.dark === 'transparent');
19348
+ if (!isTransparent) {
18690
19349
  this._core.updateObject(obj, { strokeColor: value });
18691
19350
  }
18692
19351
  }
@@ -36372,7 +37031,7 @@ class KritzelAnchorManager {
36372
37031
 
36373
37032
  const DEFAULT_BRUSH_CONFIG = {
36374
37033
  type: 'pen',
36375
- color: '#000000',
37034
+ color: DEFAULT_COLOR_PALETTE[0],
36376
37035
  size: 16,
36377
37036
  palettes: {
36378
37037
  pen: [...DEFAULT_COLOR_PALETTE],
@@ -36380,14 +37039,14 @@ const DEFAULT_BRUSH_CONFIG = {
36380
37039
  };
36381
37040
 
36382
37041
  const DEFAULT_TEXT_CONFIG = {
36383
- color: '#000000',
37042
+ color: DEFAULT_COLOR_PALETTE[0],
36384
37043
  size: 8,
36385
37044
  fontFamily: 'Arial',
36386
37045
  palette: [...DEFAULT_COLOR_PALETTE],
36387
37046
  };
36388
37047
 
36389
37048
  const DEFAULT_LINE_TOOL_CONFIG = {
36390
- color: '#000000',
37049
+ color: DEFAULT_COLOR_PALETTE[0],
36391
37050
  size: 4,
36392
37051
  palette: [...DEFAULT_COLOR_PALETTE],
36393
37052
  arrows: {
@@ -36411,6 +37070,7 @@ exports.KritzelBaseObject = KritzelBaseObject;
36411
37070
  exports.KritzelBaseTool = KritzelBaseTool;
36412
37071
  exports.KritzelBrushTool = KritzelBrushTool;
36413
37072
  exports.KritzelClassHelper = KritzelClassHelper;
37073
+ exports.KritzelColorHelper = KritzelColorHelper;
36414
37074
  exports.KritzelCursorHelper = KritzelCursorHelper;
36415
37075
  exports.KritzelDevicesHelper = KritzelDevicesHelper;
36416
37076
  exports.KritzelEraserTool = KritzelEraserTool;
@@ -36429,6 +37089,7 @@ exports.KritzelSelectionTool = KritzelSelectionTool;
36429
37089
  exports.KritzelShape = KritzelShape;
36430
37090
  exports.KritzelText = KritzelText;
36431
37091
  exports.KritzelTextTool = KritzelTextTool;
37092
+ exports.KritzelThemeManager = KritzelThemeManager;
36432
37093
  exports.KritzelToolRegistry = KritzelToolRegistry;
36433
37094
  exports.KritzelWorkspace = KritzelWorkspace;
36434
37095
  exports.ObjectHelper = ObjectHelper;
@@ -36440,6 +37101,7 @@ exports.create = create$8;
36440
37101
  exports.createDecoder = createDecoder$1;
36441
37102
  exports.createEncoder = createEncoder$1;
36442
37103
  exports.createUint8ArrayFromArrayBuffer = createUint8ArrayFromArrayBuffer;
37104
+ exports.darkTheme = darkTheme;
36443
37105
  exports.encodeStateAsUpdate = encodeStateAsUpdate;
36444
37106
  exports.encodeStateVector = encodeStateVector;
36445
37107
  exports.equalityDeep = equalityDeep$1;
@@ -36448,6 +37110,7 @@ exports.fromBase64 = fromBase64;
36448
37110
  exports.getUnixTime = getUnixTime$1;
36449
37111
  exports.isNode = isNode;
36450
37112
  exports.length = length$2;
37113
+ exports.lightTheme = lightTheme;
36451
37114
  exports.map = map;
36452
37115
  exports.min = min$2;
36453
37116
  exports.offChange = offChange;