kritzel-stencil 0.4.22 → 0.4.24

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 (225) hide show
  1. package/LICENSE +21 -21
  2. package/LICENSE.md +49 -49
  3. package/dist/cjs/{index-Xav9JFHg.js → index-Dn19mGl-.js} +47 -11
  4. package/dist/cjs/index.cjs.js +2 -51
  5. package/dist/cjs/kritzel-active-users_47.cjs.entry.js +198 -231
  6. package/dist/cjs/kritzel-brush-style.cjs.entry.js +2 -2
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/{schema.constants-CjN-B633.js → schema.constants-CY0WWJYd.js} +44 -20
  9. package/dist/cjs/stencil.cjs.js +2 -2
  10. package/dist/collection/classes/providers/sync/hocuspocus-sync-provider.class.js +0 -21
  11. package/dist/collection/classes/providers/sync/websocket-sync-provider.class.js +1 -29
  12. package/dist/collection/classes/structures/app-state-map.structure.js +1 -4
  13. package/dist/collection/classes/structures/object-map.structure.js +4 -66
  14. package/dist/collection/collection-manifest.json +1 -1
  15. package/dist/collection/components/core/kritzel-awareness-cursors/kritzel-awareness-cursors.css +115 -115
  16. package/dist/collection/components/core/kritzel-awareness-cursors/kritzel-awareness-cursors.js +1 -1
  17. package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.css +10 -10
  18. package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js +1 -1
  19. package/dist/collection/components/core/kritzel-editor/kritzel-editor.css +160 -160
  20. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +18 -51
  21. package/dist/collection/components/core/kritzel-engine/kritzel-engine.css +80 -80
  22. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +102 -65
  23. package/dist/collection/components/core/kritzel-watermark/kritzel-watermark.css +29 -29
  24. package/dist/collection/components/core/kritzel-watermark/kritzel-watermark.js +2 -2
  25. package/dist/collection/components/shared/kritzel-avatar/kritzel-avatar.css +58 -58
  26. package/dist/collection/components/shared/kritzel-avatar/kritzel-avatar.js +3 -3
  27. package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.css +42 -42
  28. package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.js +3 -3
  29. package/dist/collection/components/shared/kritzel-button/kritzel-button.css +73 -73
  30. package/dist/collection/components/shared/kritzel-button/kritzel-button.js +2 -2
  31. package/dist/collection/components/shared/kritzel-color/kritzel-color.css +24 -24
  32. package/dist/collection/components/shared/kritzel-color/kritzel-color.js +2 -2
  33. package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.css +46 -46
  34. package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js +1 -1
  35. package/dist/collection/components/shared/kritzel-dialog/kritzel-dialog.css +209 -209
  36. package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.css +190 -190
  37. package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.js +2 -2
  38. package/dist/collection/components/shared/kritzel-font/kritzel-font.css +10 -10
  39. package/dist/collection/components/shared/kritzel-font/kritzel-font.js +1 -1
  40. package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.css +48 -48
  41. package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.js +2 -2
  42. package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.css +30 -30
  43. package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js +1 -1
  44. package/dist/collection/components/shared/kritzel-icon/kritzel-icon.css +18 -18
  45. package/dist/collection/components/shared/kritzel-input/kritzel-input.css +69 -69
  46. package/dist/collection/components/shared/kritzel-input/kritzel-input.js +1 -1
  47. package/dist/collection/components/shared/kritzel-line-endings/kritzel-line-endings.css +60 -60
  48. package/dist/collection/components/shared/kritzel-line-endings/kritzel-line-endings.js +3 -3
  49. package/dist/collection/components/shared/kritzel-master-detail/kritzel-master-detail.css +190 -190
  50. package/dist/collection/components/shared/kritzel-master-detail/kritzel-master-detail.js +3 -3
  51. package/dist/collection/components/shared/kritzel-menu/kritzel-menu.css +34 -34
  52. package/dist/collection/components/shared/kritzel-menu/kritzel-menu.js +1 -1
  53. package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.css +166 -166
  54. package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.js +2 -2
  55. package/dist/collection/components/shared/kritzel-numeric-input/kritzel-numeric-input.css +102 -102
  56. package/dist/collection/components/shared/kritzel-numeric-input/kritzel-numeric-input.js +1 -1
  57. package/dist/collection/components/shared/kritzel-opacity-slider/kritzel-opacity-slider.css +85 -85
  58. package/dist/collection/components/shared/kritzel-opacity-slider/kritzel-opacity-slider.js +1 -1
  59. package/dist/collection/components/shared/kritzel-pill-tabs/kritzel-pill-tabs.css +68 -68
  60. package/dist/collection/components/shared/kritzel-pill-tabs/kritzel-pill-tabs.js +2 -2
  61. package/dist/collection/components/shared/kritzel-portal/kritzel-portal.js +1 -1
  62. package/dist/collection/components/shared/kritzel-shape-fill/kritzel-shape-fill.css +47 -47
  63. package/dist/collection/components/shared/kritzel-shape-fill/kritzel-shape-fill.js +4 -4
  64. package/dist/collection/components/shared/kritzel-slide-toggle/kritzel-slide-toggle.css +48 -48
  65. package/dist/collection/components/shared/kritzel-slide-toggle/kritzel-slide-toggle.js +1 -1
  66. package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.css +78 -78
  67. package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.js +1 -1
  68. package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.css +37 -37
  69. package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js +1 -1
  70. package/dist/collection/components/shared/kritzel-sync-indicator/kritzel-sync-indicator.css +50 -50
  71. package/dist/collection/components/shared/kritzel-sync-indicator/kritzel-sync-indicator.js +1 -1
  72. package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.css +18 -18
  73. package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js +2 -2
  74. package/dist/collection/components/ui/kritzel-active-users/kritzel-active-users.css +65 -65
  75. package/dist/collection/components/ui/kritzel-back-to-content/kritzel-back-to-content.css +42 -42
  76. package/dist/collection/components/ui/kritzel-back-to-content/kritzel-back-to-content.js +1 -1
  77. package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.css +112 -112
  78. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.css +331 -331
  79. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +6 -6
  80. package/dist/collection/components/ui/kritzel-current-user/kritzel-current-user.css +11 -11
  81. package/dist/collection/components/ui/kritzel-current-user/kritzel-current-user.js +1 -1
  82. package/dist/collection/components/ui/kritzel-current-user-dialog/kritzel-current-user-dialog.css +39 -39
  83. package/dist/collection/components/ui/kritzel-current-user-dialog/kritzel-current-user-dialog.js +1 -1
  84. package/dist/collection/components/ui/kritzel-export/kritzel-export.css +89 -89
  85. package/dist/collection/components/ui/kritzel-export/kritzel-export.js +1 -1
  86. package/dist/collection/components/ui/kritzel-loading-overlay/kritzel-loading-overlay.css +50 -50
  87. package/dist/collection/components/ui/kritzel-loading-overlay/kritzel-loading-overlay.js +1 -1
  88. package/dist/collection/components/ui/kritzel-login-dialog/kritzel-login-dialog.css +98 -98
  89. package/dist/collection/components/ui/kritzel-login-dialog/kritzel-login-dialog.js +1 -1
  90. package/dist/collection/components/ui/kritzel-more-menu/kritzel-more-menu.css +58 -58
  91. package/dist/collection/components/ui/kritzel-more-menu/kritzel-more-menu.js +2 -2
  92. package/dist/collection/components/ui/kritzel-notification-card/kritzel-notification-card.css +101 -101
  93. package/dist/collection/components/ui/kritzel-settings/kritzel-settings.css +137 -137
  94. package/dist/collection/components/ui/kritzel-settings/kritzel-settings.js +1 -1
  95. package/dist/collection/components/ui/kritzel-share-dialog/kritzel-share-dialog.css +150 -150
  96. package/dist/collection/components/ui/kritzel-share-dialog/kritzel-share-dialog.js +2 -2
  97. package/dist/collection/components/ui/kritzel-tool-config/kritzel-tool-config.css +38 -38
  98. package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.css +45 -45
  99. package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js +1 -1
  100. package/dist/collection/components/ui/kritzel-workspace-manager/kritzel-workspace-manager.css +16 -16
  101. package/dist/collection/components/ui/kritzel-zoom-panel/kritzel-zoom-panel.css +72 -72
  102. package/dist/collection/components/ui/kritzel-zoom-panel/kritzel-zoom-panel.js +1 -1
  103. package/dist/collection/constants/version.js +1 -1
  104. package/dist/collection/helpers/cursor.helper.js +6 -6
  105. package/dist/collection/helpers/svg-export.helper.js +41 -41
  106. package/dist/components/index.js +4 -53
  107. package/dist/components/kritzel-active-users.js +1 -1
  108. package/dist/components/kritzel-avatar.js +1 -1
  109. package/dist/components/kritzel-awareness-cursors.js +1 -1
  110. package/dist/components/kritzel-back-to-content.js +1 -1
  111. package/dist/components/kritzel-brush-style.js +4 -4
  112. package/dist/components/kritzel-button.js +1 -1
  113. package/dist/components/kritzel-color-palette.js +1 -1
  114. package/dist/components/kritzel-color.js +1 -1
  115. package/dist/components/kritzel-context-menu.js +1 -1
  116. package/dist/components/kritzel-controls.js +1 -1
  117. package/dist/components/kritzel-current-user-dialog.js +1 -1
  118. package/dist/components/kritzel-current-user.js +1 -1
  119. package/dist/components/kritzel-cursor-trail.js +1 -1
  120. package/dist/components/kritzel-dialog.js +1 -1
  121. package/dist/components/kritzel-dropdown.js +1 -1
  122. package/dist/components/kritzel-editor.js +56 -61
  123. package/dist/components/kritzel-engine.js +1 -1
  124. package/dist/components/kritzel-export.js +1 -1
  125. package/dist/components/kritzel-font-family.js +1 -1
  126. package/dist/components/kritzel-font-size.js +1 -1
  127. package/dist/components/kritzel-font.js +1 -1
  128. package/dist/components/kritzel-icon.js +1 -1
  129. package/dist/components/kritzel-input.js +1 -1
  130. package/dist/components/kritzel-line-endings.js +1 -1
  131. package/dist/components/kritzel-loading-overlay.js +1 -1
  132. package/dist/components/kritzel-login-dialog.js +1 -1
  133. package/dist/components/kritzel-master-detail.js +1 -1
  134. package/dist/components/kritzel-menu-item.js +1 -1
  135. package/dist/components/kritzel-menu.js +1 -1
  136. package/dist/components/kritzel-more-menu.js +1 -1
  137. package/dist/components/kritzel-notification-card.js +1 -1
  138. package/dist/components/kritzel-numeric-input.js +1 -1
  139. package/dist/components/kritzel-opacity-slider.js +1 -1
  140. package/dist/components/kritzel-pill-tabs.js +1 -1
  141. package/dist/components/kritzel-portal.js +1 -1
  142. package/dist/components/kritzel-settings.js +1 -1
  143. package/dist/components/kritzel-shape-fill.js +1 -1
  144. package/dist/components/kritzel-share-dialog.js +1 -1
  145. package/dist/components/kritzel-slide-toggle.js +1 -1
  146. package/dist/components/kritzel-split-button.js +1 -1
  147. package/dist/components/kritzel-stroke-size.js +1 -1
  148. package/dist/components/kritzel-sync-indicator.js +1 -1
  149. package/dist/components/kritzel-tool-config.js +1 -1
  150. package/dist/components/kritzel-tooltip.js +1 -1
  151. package/dist/components/kritzel-utility-panel.js +1 -1
  152. package/dist/components/kritzel-watermark.js +1 -1
  153. package/dist/components/kritzel-workspace-manager.js +1 -1
  154. package/dist/components/kritzel-zoom-panel.js +1 -1
  155. package/dist/components/{p-jIKskj3S.js → p-1Q4VnThv.js} +3 -3
  156. package/dist/components/{p-Cm33td2O.js → p-3tBE7SyG.js} +2 -2
  157. package/dist/components/{p-fL9rl200.js → p-BFYT03fw.js} +3 -3
  158. package/dist/components/{p-DtnMdWWB.js → p-BShrnlam.js} +2 -2
  159. package/dist/components/{p-BsLI_BWq.js → p-BXUx_C0N.js} +2 -2
  160. package/dist/components/{p-CzW58DHM.js → p-BZZ3KRPk.js} +3 -3
  161. package/dist/components/{p-D1rjfWgJ.js → p-BkXQL5Dl.js} +5 -5
  162. package/dist/components/{p-eZXIu4yK.js → p-BppcoKoo.js} +5 -5
  163. package/dist/components/{p-DDTMGbtA.js → p-BrA9NBEE.js} +21 -21
  164. package/dist/components/{p-Czhdc844.js → p-BrqSjRJN.js} +3 -3
  165. package/dist/components/{p-CAoN_STZ.js → p-Bxi-Bm49.js} +2 -2
  166. package/dist/components/{p-B43upypT.js → p-C9_yBEoX.js} +30 -10
  167. package/dist/components/{p-Df3BwVGy.js → p-CHoOe3FD.js} +3 -3
  168. package/dist/components/{p-2WiGyky4.js → p-CLAz6RJc.js} +3 -3
  169. package/dist/components/{p-B5SWPDuq.js → p-CSKToqUl.js} +4 -4
  170. package/dist/components/{p-CF8pLc07.js → p-CSWCmyzb.js} +5 -5
  171. package/dist/components/{p-HoO86l1o.js → p-CWAChRD5.js} +12 -12
  172. package/dist/components/{p-DwMqCX2P.js → p-Ch-KG9To.js} +3 -3
  173. package/dist/components/{p-CSuU8frA.js → p-Ck-87E2G.js} +1 -1
  174. package/dist/components/{p-BFYtCsZu.js → p-Covorf4C.js} +3 -3
  175. package/dist/components/{p-BoN700-O.js → p-Cx-L_28S.js} +3 -3
  176. package/dist/components/{p-vqEUQ-4Q.js → p-D0Trc3IQ.js} +5 -5
  177. package/dist/components/{p-BrNsOp2v.js → p-D2VcPEtL.js} +6 -6
  178. package/dist/components/{p-CSPYkLLH.js → p-D3BzgkIE.js} +2 -2
  179. package/dist/components/{p-bAacqNHq.js → p-D6JycG-I.js} +3 -3
  180. package/dist/components/{p-DB58Oa5V.js → p-DPsbNStn.js} +2 -2
  181. package/dist/components/{p-CwZ3KKFq.js → p-DT_WBwsw.js} +6 -6
  182. package/dist/components/{p-Dx5NfJ0U.js → p-DW1B118Q.js} +9 -9
  183. package/dist/components/{p-BPsKYMH6.js → p-DYPA7jpg.js} +2 -2
  184. package/dist/components/{p-DBqoPgev.js → p-DafP9PAA.js} +2 -2
  185. package/dist/components/{p-Dt7-I2Xz.js → p-DcUIO14-.js} +4 -4
  186. package/dist/components/{p-CXpv9Rxe.js → p-Di--2boB.js} +3 -3
  187. package/dist/components/{p-djJSnjAX.js → p-DjXQxw9R.js} +3 -3
  188. package/dist/components/{p-DVXTPI71.js → p-Dp1CD4gK.js} +2 -2
  189. package/dist/components/{p-BNeE3SiZ.js → p-DwEYMvIn.js} +175 -179
  190. package/dist/components/{p-DKGg-76-.js → p-Dznwo6oc.js} +2 -2
  191. package/dist/components/{p-BozrueXV.js → p-ME1sDz3f.js} +2 -2
  192. package/dist/components/{p-B-585egz.js → p-MhQxGUvY.js} +3 -3
  193. package/dist/components/{p-DX2nriaq.js → p-QSyeAy8R.js} +2 -2
  194. package/dist/components/{p-PjPPCHVL.js → p-Qdo3E8dr.js} +2 -2
  195. package/dist/components/{p-dsxHDlQ3.js → p-b0J2ktAm.js} +7 -7
  196. package/dist/components/{p-C98Eb3_R.js → p-dAXnRkjA.js} +5 -5
  197. package/dist/components/{p-GKmqCI8r.js → p-fSV6KVTC.js} +3 -3
  198. package/dist/components/{p-CaBbajU2.js → p-o3NYKrVL.js} +3 -3
  199. package/dist/components/{p-CrHvaLRV.js → p-vDCa_ZDm.js} +3 -3
  200. package/dist/components/{p-4SPnZZkH.js → p-zG-WUBGF.js} +4 -4
  201. package/dist/esm/{index-Dhio9uis.js → index-2va1Pk9z.js} +47 -11
  202. package/dist/esm/index.js +3 -52
  203. package/dist/esm/kritzel-active-users_47.entry.js +198 -231
  204. package/dist/esm/kritzel-brush-style.entry.js +2 -2
  205. package/dist/esm/loader.js +2 -2
  206. package/dist/esm/{schema.constants-DfvqHmxc.js → schema.constants-DBvUmuDH.js} +44 -20
  207. package/dist/esm/stencil.js +3 -3
  208. package/dist/stencil/index.esm.js +3 -52
  209. package/dist/stencil/{p-Dhio9uis.js → p-2va1Pk9z.js} +47 -11
  210. package/dist/stencil/{p-DfvqHmxc.js → p-DBvUmuDH.js} +44 -20
  211. package/dist/stencil/{p-ab5c4292.entry.js → p-ce6d432e.entry.js} +198 -231
  212. package/dist/stencil/{p-fb32cd8f.entry.js → p-df06ca3a.entry.js} +2 -2
  213. package/dist/stencil/stencil.esm.js +4 -4
  214. package/dist/types/classes/providers/sync/hocuspocus-sync-provider.class.d.ts +0 -5
  215. package/dist/types/classes/providers/sync/websocket-sync-provider.class.d.ts +0 -6
  216. package/dist/types/classes/structures/object-map.structure.d.ts +2 -26
  217. package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +0 -3
  218. package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +11 -9
  219. package/dist/types/components.d.ts +1 -8
  220. package/dist/types/constants/version.d.ts +1 -1
  221. package/dist/types/interfaces/sync-provider.interface.d.ts +0 -13
  222. package/dist/types/stencil-public-runtime.d.ts +12 -0
  223. package/loader/index.d.ts +1 -1
  224. package/package.json +1 -1
  225. package/readme.md +10 -10
@@ -1,17 +1,17 @@
1
- import { p as proxyCustomElement, H, c as createEvent, h, d as Host, t as transformTag } from './p-B43upypT.js';
2
- import { a as KritzelMouseButton, d as defineCustomElement$3 } from './p-Cm33td2O.js';
3
- import { K as KritzelBaseObject, e as KritzelMathHelper, f as KritzelGeometryHelper, a as KritzelPath, b as KritzelLine, d as defineCustomElement$4 } from './p-bAacqNHq.js';
1
+ import { p as proxyCustomElement, H, c as createEvent, h, d as Host, t as transformTag } from './p-C9_yBEoX.js';
2
+ import { a as KritzelMouseButton, d as defineCustomElement$3 } from './p-3tBE7SyG.js';
3
+ import { K as KritzelBaseObject, e as KritzelMathHelper, f as KritzelGeometryHelper, a as KritzelPath, b as KritzelLine, d as defineCustomElement$4 } from './p-D6JycG-I.js';
4
4
  import { c as commonjsGlobal } from './p-BFTU3MAI.js';
5
5
  import { a as KritzelColorHelper, D as DEFAULT_COLOR_PALETTE, K as KritzelThemeManager } from './p-7I4Uzjrw.js';
6
6
  import { K as KritzelDevicesHelper } from './p-jGOpkGDl.js';
7
7
  import { K as KritzelFontRegistry, r as resolveTextToolAvailableFonts } from './p-DJkKlUyZ.js';
8
- import { A as ABSOLUTE_SCALE_MAX, a as ABSOLUTE_SCALE_MIN, d as defineCustomElement$1 } from './p-DtnMdWWB.js';
8
+ import { A as ABSOLUTE_SCALE_MAX, a as ABSOLUTE_SCALE_MIN, d as defineCustomElement$1 } from './p-BShrnlam.js';
9
9
  import { K as KritzelWorkspace, W as WORKSPACE_EXPORT_VERSION } from './p-DAwPPDMS.js';
10
10
  import { K as KritzelHTMLHelper } from './p-WUdQqYnu.js';
11
11
  import { O as ObjectHelper } from './p-DPONTran.js';
12
12
  import * as Y from 'yjs';
13
13
  import { a as CURRENT_WORKSPACE_SCHEMA_VERSION, C as CURRENT_APP_STATE_SCHEMA_VERSION } from './p-CW-VyJgK.js';
14
- import { K as KritzelIconRegistry, d as defineCustomElement$2 } from './p-CSuU8frA.js';
14
+ import { K as KritzelIconRegistry, d as defineCustomElement$2 } from './p-Ck-87E2G.js';
15
15
 
16
16
  class KritzelKeyboardHelper {
17
17
  static forceHideKeyboard() {
@@ -5076,10 +5076,11 @@ class Fitter {
5076
5076
  }
5077
5077
  openMore() {
5078
5078
  let { content, openStart, openEnd } = this.unplaced;
5079
- let inner = contentAt(content, openStart);
5080
- if (!inner.childCount || inner.firstChild.isLeaf)
5079
+ if (maxOpen(content, -1) <= openStart)
5081
5080
  return false;
5082
- this.unplaced = new Slice(content, openStart + 1, Math.max(openEnd, inner.size + openStart >= content.size - openEnd ? openStart + 1 : 0));
5081
+ if (this.unplaced.size > 1 && maxOpen(content, 1) > openEnd)
5082
+ openEnd++;
5083
+ this.unplaced = new Slice(content, openStart + 1, openEnd);
5083
5084
  return true;
5084
5085
  }
5085
5086
  dropNode() {
@@ -5249,6 +5250,14 @@ function invalidMarks(type, fragment, start) {
5249
5250
  function definesContent(type) {
5250
5251
  return type.spec.defining || type.spec.definingForContent;
5251
5252
  }
5253
+ function maxOpen(frag, side) {
5254
+ for (let count = 0;; count++) {
5255
+ let ch = side < 0 ? frag.firstChild : frag.lastChild;
5256
+ if (!ch || ch.isAtom)
5257
+ return count;
5258
+ frag = ch.content;
5259
+ }
5260
+ }
5252
5261
  function replaceRange(tr, from, to, slice) {
5253
5262
  if (!slice.size)
5254
5263
  return tr.deleteRange(from, to);
@@ -7953,7 +7962,8 @@ class WidgetViewDesc extends ViewDesc {
7953
7962
  wrap.appendChild(dom);
7954
7963
  dom = wrap;
7955
7964
  }
7956
- dom.contentEditable = "false";
7965
+ if (!dom.hasAttribute("contenteditable"))
7966
+ dom.contentEditable = "false";
7957
7967
  dom.classList.add("ProseMirror-widget");
7958
7968
  }
7959
7969
  super(parent, [], dom, null);
@@ -9801,8 +9811,14 @@ function maybeWrapTrusted(html) {
9801
9811
  // With the require-trusted-types-for CSP, Chrome will block
9802
9812
  // innerHTML, even on a detached document. This wraps the string in
9803
9813
  // a way that makes the browser allow us to use its parser again.
9804
- if (!_policy)
9805
- _policy = trustedTypes.defaultPolicy || trustedTypes.createPolicy("ProseMirrorClipboard", { createHTML: (s) => s });
9814
+ if (!_policy) {
9815
+ if (_policy = trustedTypes.defaultPolicy)
9816
+ try {
9817
+ return _policy.createHTML(html);
9818
+ }
9819
+ catch (_a) { }
9820
+ _policy = trustedTypes.createPolicy("ProseMirrorClipboard", { createHTML: (s) => s });
9821
+ }
9806
9822
  return _policy.createHTML(html);
9807
9823
  }
9808
9824
  function readHTML(html) {
@@ -9859,6 +9875,12 @@ function addContext(slice, context) {
9859
9875
  let type = schema.nodes[array[i]];
9860
9876
  if (!type || type.hasRequiredAttrs())
9861
9877
  break;
9878
+ try {
9879
+ type.checkAttrs(array[i + 1]);
9880
+ }
9881
+ catch (e) {
9882
+ break;
9883
+ }
9862
9884
  content = Fragment.from(type.create(array[i + 1], content));
9863
9885
  openStart++;
9864
9886
  openEnd++;
@@ -13517,16 +13539,20 @@ a custom function to determine the type of the newly split off block.
13517
13539
  */
13518
13540
  function splitBlockAs(splitNode) {
13519
13541
  return (state, dispatch) => {
13520
- let { $from} = state.selection;
13521
13542
  if (state.selection instanceof NodeSelection && state.selection.node.isBlock) {
13543
+ let { $from } = state.selection;
13522
13544
  if (!$from.parentOffset || !canSplit(state.doc, $from.pos))
13523
13545
  return false;
13524
13546
  if (dispatch)
13525
13547
  dispatch(state.tr.split($from.pos).scrollIntoView());
13526
13548
  return true;
13527
13549
  }
13528
- if (!$from.depth)
13550
+ if (!state.selection.$from.depth)
13529
13551
  return false;
13552
+ let tr = state.tr;
13553
+ if (!state.selection.empty && (state.selection instanceof TextSelection || state.selection instanceof AllSelection))
13554
+ tr.deleteSelection();
13555
+ let { $from } = tr.selection, mapFrom = tr.steps.length;
13530
13556
  let types = [];
13531
13557
  let splitDepth, deflt, atEnd = false, atStart = false;
13532
13558
  for (let d = $from.depth;; d--) {
@@ -13545,10 +13571,7 @@ function splitBlockAs(splitNode) {
13545
13571
  types.unshift(null);
13546
13572
  }
13547
13573
  }
13548
- let tr = state.tr;
13549
- if (state.selection instanceof TextSelection || state.selection instanceof AllSelection)
13550
- tr.deleteSelection();
13551
- let splitPos = tr.mapping.map($from.pos);
13574
+ let splitPos = $from.pos;
13552
13575
  let can = canSplit(tr.doc, splitPos, types.length, types);
13553
13576
  if (!can) {
13554
13577
  types[0] = deflt ? { type: deflt } : null;
@@ -13558,9 +13581,10 @@ function splitBlockAs(splitNode) {
13558
13581
  return false;
13559
13582
  tr.split(splitPos, types.length, types);
13560
13583
  if (!atEnd && atStart && $from.node(splitDepth).type != deflt) {
13561
- let first = tr.mapping.map($from.before(splitDepth)), $first = tr.doc.resolve(first);
13584
+ let mapping = tr.mapping.slice(mapFrom);
13585
+ let first = mapping.map($from.before(splitDepth)), $first = tr.doc.resolve(first);
13562
13586
  if (deflt && $from.node(splitDepth - 1).canReplaceWith($first.index(), $first.index() + 1, deflt))
13563
- tr.setNodeMarkup(tr.mapping.map($from.before(splitDepth)), deflt);
13587
+ tr.setNodeMarkup(mapping.map($from.before(splitDepth)), deflt);
13564
13588
  }
13565
13589
  if (dispatch)
13566
13590
  dispatch(tr.scrollIntoView());
@@ -19295,12 +19319,12 @@ class KritzelCursorHelper {
19295
19319
  // We rotate around the center of the SVG canvas
19296
19320
  const center = size / 2;
19297
19321
  // We use a group to apply the rotation
19298
- const svg = `
19299
- <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
19300
- <g transform="rotate(${rotation} ${center} ${center})">
19301
- ${content}
19302
- </g>
19303
- </svg>
19322
+ const svg = `
19323
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
19324
+ <g transform="rotate(${rotation} ${center} ${center})">
19325
+ ${content}
19326
+ </g>
19327
+ </svg>
19304
19328
  `;
19305
19329
  // Encode the SVG for use in a data URI
19306
19330
  // We need to be careful with encoding to ensure it works across browsers
@@ -43319,10 +43343,6 @@ class KritzelObjectMap {
43319
43343
  _awarenessChangeHandler = null;
43320
43344
  _awarenessChangeCallbacks = [];
43321
43345
  _objectsChangeCallbacks = [];
43322
- _remoteChangesCallbacks = [];
43323
- _docUpdateHandler = null;
43324
- _remoteOrigins = new Set();
43325
- _appliedRemoteChanges = false;
43326
43346
  _lastAwarenessEmitTime = 0;
43327
43347
  _awarenessEmitTimeout = null;
43328
43348
  AWARENESS_THROTTLE_INTERVAL = 100; // milliseconds
@@ -43346,44 +43366,12 @@ class KritzelObjectMap {
43346
43366
  return this._isReady;
43347
43367
  }
43348
43368
  /**
43349
- * Promise that settles when network providers finish connecting and complete
43350
- * their Yjs sync handshake. Resolves immediately if no network providers.
43369
+ * Promise that settles when network providers finish connecting.
43370
+ * Resolves immediately if no network providers. Awaited by the loading overlay.
43351
43371
  */
43352
43372
  whenNetworkSynced() {
43353
43373
  return this._networkSyncPromise ?? Promise.resolve();
43354
43374
  }
43355
- /**
43356
- * Whether any configured provider synchronizes over the network.
43357
- */
43358
- get hasNetworkSyncProvider() {
43359
- return this._providers.some(provider => provider.type === 'network');
43360
- }
43361
- /**
43362
- * Whether remote-originated changes can be told apart from local writes.
43363
- * Requires every network provider to expose its Yjs update origin.
43364
- */
43365
- get supportsRemoteChangeDetection() {
43366
- const networkProviders = this._providers.filter(provider => provider.type === 'network');
43367
- return networkProviders.length > 0 && networkProviders.every(provider => provider.updateOrigin !== undefined);
43368
- }
43369
- /**
43370
- * Whether at least one update originating from a network provider has been
43371
- * applied to this document. Stays `false` when the remote held no data the
43372
- * local document was missing, because Yjs suppresses empty updates.
43373
- */
43374
- get hasAppliedRemoteChanges() {
43375
- return this._appliedRemoteChanges;
43376
- }
43377
- /**
43378
- * Registers a callback invoked whenever a network provider applies changes to this document.
43379
- * @returns A function that unregisters the callback.
43380
- */
43381
- onRemoteChangesApplied(callback) {
43382
- this._remoteChangesCallbacks.push(callback);
43383
- return () => {
43384
- this._remoteChangesCallbacks = this._remoteChangesCallbacks.filter(registered => registered !== callback);
43385
- };
43386
- }
43387
43375
  /**
43388
43376
  * Returns the Yjs Awareness instance, if a network provider is available.
43389
43377
  */
@@ -43626,22 +43614,6 @@ class KritzelObjectMap {
43626
43614
  const providerList = this._providers.map(p => `${p.constructor.name} (${p.type})`).join(', ');
43627
43615
  console.info(`[Kritzel] Workspace sync providers initialized for ${docName}: ${providerList || 'none'}`);
43628
43616
  }
43629
- // Registered before any provider connects so no remote update can be missed.
43630
- for (const provider of this._providers) {
43631
- if (provider.type === 'network' && provider.updateOrigin !== undefined) {
43632
- this._remoteOrigins.add(provider.updateOrigin);
43633
- }
43634
- }
43635
- this._docUpdateHandler = (_update, origin) => {
43636
- if (!this._remoteOrigins.has(origin)) {
43637
- return;
43638
- }
43639
- this._appliedRemoteChanges = true;
43640
- for (const callback of [...this._remoteChangesCallbacks]) {
43641
- callback();
43642
- }
43643
- };
43644
- this._ydoc.on('update', this._docUpdateHandler);
43645
43617
  // captureTimeout is effectively infinite — undo-step boundaries are
43646
43618
  // marked explicitly via markUndoBoundary() in insert/remove/reset and
43647
43619
  // at stroke/gesture boundaries in the tools. This prevents a single
@@ -43695,15 +43667,12 @@ class KritzelObjectMap {
43695
43667
  if (showSyncProviderInfo && networkProviders.length > 0) {
43696
43668
  console.info(`[Kritzel] Workspace network providers connecting in background: ${networkProviders.length}`);
43697
43669
  }
43698
- const networkConnectPromises = networkProviders.map(provider => provider
43699
- .connect()
43700
- .then(() => provider.whenSynced?.())
43701
- .catch(err => {
43670
+ const networkConnectPromises = networkProviders.map(provider => provider.connect().catch(err => {
43702
43671
  if (showSyncProviderInfo) {
43703
43672
  console.error(`[Kritzel] Network sync provider "${provider.constructor.name}" failed to connect:`, err);
43704
43673
  }
43705
43674
  }));
43706
- // Settles once remote data has been reconciled, not merely once the transport connected
43675
+ // Network sync awaited by loading overlay to show remote workspace hydration
43707
43676
  this._networkSyncPromise = networkConnectPromises.length > 0 ? Promise.allSettled(networkConnectPromises).then(() => undefined) : null;
43708
43677
  this._isReady = true;
43709
43678
  // Find the first provider that exposes awareness (network providers)
@@ -44361,13 +44330,6 @@ class KritzelObjectMap {
44361
44330
  this._objectsMap.unobserve(this._objectsObserver);
44362
44331
  this._objectsObserver = null;
44363
44332
  }
44364
- if (this._ydoc && this._docUpdateHandler) {
44365
- this._ydoc.off('update', this._docUpdateHandler);
44366
- }
44367
- this._docUpdateHandler = null;
44368
- this._remoteOrigins.clear();
44369
- this._remoteChangesCallbacks = [];
44370
- this._appliedRemoteChanges = false;
44371
44333
  // Remove undo manager event listeners
44372
44334
  if (this._undoManager) {
44373
44335
  if (this._stackItemAddedHandler) {
@@ -44863,10 +44825,7 @@ class KritzelAppStateMap {
44863
44825
  if (showSyncProviderInfo && networkProviders.length > 0) {
44864
44826
  console.info(`[Kritzel] App-state network providers connecting in background: ${networkProviders.length}`);
44865
44827
  }
44866
- const networkConnectPromises = networkProviders.map(provider => provider
44867
- .connect()
44868
- .then(() => provider.whenSynced?.())
44869
- .catch(err => {
44828
+ const networkConnectPromises = networkProviders.map(provider => provider.connect().catch(err => {
44870
44829
  if (showSyncProviderInfo) {
44871
44830
  console.error(`[Kritzel] Network sync provider "${provider.constructor.name}" failed to connect:`, err);
44872
44831
  }
@@ -48150,8 +48109,8 @@ class KritzelSvgExportHelper {
48150
48109
  .join('\n ');
48151
48110
  const xmlDecl = includeXmlDeclaration ? '<?xml version="1.0" encoding="UTF-8"?>\n' : '';
48152
48111
  const defsContent = defs.length > 0 ? `\n <defs>\n ${defs.join('\n ')}\n </defs>` : '';
48153
- return `${xmlDecl}<svg xmlns="http://www.w3.org/2000/svg" viewBox="${viewBoxX} ${viewBoxY} ${viewBoxWidth} ${viewBoxHeight}" width="${viewBoxWidth}" height="${viewBoxHeight}">${defsContent}
48154
- ${elements}
48112
+ return `${xmlDecl}<svg xmlns="http://www.w3.org/2000/svg" viewBox="${viewBoxX} ${viewBoxY} ${viewBoxWidth} ${viewBoxHeight}" width="${viewBoxWidth}" height="${viewBoxHeight}">${defsContent}
48113
+ ${elements}
48155
48114
  </svg>`;
48156
48115
  }
48157
48116
  /**
@@ -48303,8 +48262,8 @@ class KritzelSvgExportHelper {
48303
48262
  const orient = end === 'start' ? 'auto-start-reverse' : 'auto';
48304
48263
  const refX = 0;
48305
48264
  const refY = size / 2;
48306
- return `<marker id="${markerId}" markerWidth="${size}" markerHeight="${size}" refX="${refX}" refY="${refY}" orient="${orient}" markerUnits="userSpaceOnUse">
48307
- <path d="${path}" fill="${fill}" transform="scale(${size / 10})"/>
48265
+ return `<marker id="${markerId}" markerWidth="${size}" markerHeight="${size}" refX="${refX}" refY="${refY}" orient="${orient}" markerUnits="userSpaceOnUse">
48266
+ <path d="${path}" fill="${fill}" transform="scale(${size / 10})"/>
48308
48267
  </marker>`;
48309
48268
  }
48310
48269
  /**
@@ -48351,10 +48310,10 @@ class KritzelSvgExportHelper {
48351
48310
  const opacity = path.opacity !== 1 ? ` opacity="${path.opacity}"` : '';
48352
48311
  const scale = this.getObjectScale(path);
48353
48312
  // Path needs to be wrapped in a g with translation since path.d uses local coordinates
48354
- return `<g transform="${transform}"${opacity}>
48355
- <svg viewBox="${path.viewBox}" width="${path.totalWidth / scale}" height="${path.totalHeight / scale}" overflow="visible">
48356
- <path d="${path.d}" fill="${fill || 'none'}" stroke="${stroke || 'none'}"${path.strokeWidth ? ` stroke-width="${path.strokeWidth}"` : ''}/>
48357
- </svg>
48313
+ return `<g transform="${transform}"${opacity}>
48314
+ <svg viewBox="${path.viewBox}" width="${path.totalWidth / scale}" height="${path.totalHeight / scale}" overflow="visible">
48315
+ <path d="${path.d}" fill="${fill || 'none'}" stroke="${stroke || 'none'}"${path.strokeWidth ? ` stroke-width="${path.strokeWidth}"` : ''}/>
48316
+ </svg>
48358
48317
  </g>`;
48359
48318
  }
48360
48319
  /**
@@ -48370,10 +48329,10 @@ class KritzelSvgExportHelper {
48370
48329
  const scale = this.getObjectScale(line);
48371
48330
  const markerStart = line.hasStartArrow ? ` marker-start="url(#${line.startMarkerId})"` : '';
48372
48331
  const markerEnd = line.hasEndArrow ? ` marker-end="url(#${line.endMarkerId})"` : '';
48373
- return `<g transform="${transform}"${opacity}>
48374
- <svg viewBox="${line.viewBox}" width="${line.totalWidth / scale}" height="${line.totalHeight / scale}" overflow="visible">
48375
- <path d="${line.d}" fill="none" stroke="${stroke}" stroke-width="${line.strokeWidth}" stroke-linecap="round"${markerStart}${markerEnd}/>
48376
- </svg>
48332
+ return `<g transform="${transform}"${opacity}>
48333
+ <svg viewBox="${line.viewBox}" width="${line.totalWidth / scale}" height="${line.totalHeight / scale}" overflow="visible">
48334
+ <path d="${line.d}" fill="none" stroke="${stroke}" stroke-width="${line.strokeWidth}" stroke-linecap="round"${markerStart}${markerEnd}/>
48335
+ </svg>
48377
48336
  </g>`;
48378
48337
  }
48379
48338
  /**
@@ -48397,18 +48356,18 @@ class KritzelSvgExportHelper {
48397
48356
  const textHtml = this.prosemirrorToHtml(shape.content, shape, theme);
48398
48357
  if (textHtml) {
48399
48358
  const fontColor = KritzelColorHelper.resolveThemeColor(shape.fontColor, theme);
48400
- textContent = `
48401
- <foreignObject x="${shape.x}" y="${shape.y}" width="${shape.width}" height="${shape.height}">
48402
- <div xmlns="http://www.w3.org/1999/xhtml" style="width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; text-align: center; font-family: ${shape.fontFamily}; font-size: ${shape.fontSize}px; color: ${fontColor}; overflow: hidden;">
48403
- ${textHtml}
48404
- </div>
48359
+ textContent = `
48360
+ <foreignObject x="${shape.x}" y="${shape.y}" width="${shape.width}" height="${shape.height}">
48361
+ <div xmlns="http://www.w3.org/1999/xhtml" style="width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; text-align: center; font-family: ${shape.fontFamily}; font-size: ${shape.fontSize}px; color: ${fontColor}; overflow: hidden;">
48362
+ ${textHtml}
48363
+ </div>
48405
48364
  </foreignObject>`;
48406
48365
  }
48407
48366
  }
48408
- return `<g transform="${transform}"${opacity}>
48409
- <svg viewBox="${shape.viewBox}" width="${shape.totalWidth / scale}" height="${shape.totalHeight / scale}" overflow="visible" preserveAspectRatio="none">
48410
- <path d="${pathD}" fill="${fill || 'transparent'}" stroke="${stroke}" stroke-width="${shape.strokeWidth}"/>${textContent}
48411
- </svg>
48367
+ return `<g transform="${transform}"${opacity}>
48368
+ <svg viewBox="${shape.viewBox}" width="${shape.totalWidth / scale}" height="${shape.totalHeight / scale}" overflow="visible" preserveAspectRatio="none">
48369
+ <path d="${pathD}" fill="${fill || 'transparent'}" stroke="${stroke}" stroke-width="${shape.strokeWidth}"/>${textContent}
48370
+ </svg>
48412
48371
  </g>`;
48413
48372
  }
48414
48373
  /**
@@ -48439,10 +48398,10 @@ class KritzelSvgExportHelper {
48439
48398
  // adjusted font-size already accounts for it – keeping both would double-scale
48440
48399
  // the content and overflow the foreignObject.
48441
48400
  const svgFontSizePx = (text.fontSize * (4 / 3) * (text.scaleFactor || 1) / scale).toFixed(4);
48442
- return `<g transform="${transform}"${opacity}>
48443
- <foreignObject x="0" y="0" width="${width}" height="${height}" overflow="visible">
48444
- <div xmlns="http://www.w3.org/1999/xhtml" style="font-family: ${text.fontFamily}; font-size: ${svgFontSizePx}px; color: ${fontColor}; background-color: ${bgColor || 'transparent'}; white-space: pre-wrap; word-wrap: break-word; width: 100%; margin: 0; padding: 0; box-sizing: border-box;">${htmlContent.trim()}</div>
48445
- </foreignObject>
48401
+ return `<g transform="${transform}"${opacity}>
48402
+ <foreignObject x="0" y="0" width="${width}" height="${height}" overflow="visible">
48403
+ <div xmlns="http://www.w3.org/1999/xhtml" style="font-family: ${text.fontFamily}; font-size: ${svgFontSizePx}px; color: ${fontColor}; background-color: ${bgColor || 'transparent'}; white-space: pre-wrap; word-wrap: break-word; width: 100%; margin: 0; padding: 0; box-sizing: border-box;">${htmlContent.trim()}</div>
48404
+ </foreignObject>
48446
48405
  </g>`;
48447
48406
  }
48448
48407
  /**
@@ -48476,9 +48435,9 @@ class KritzelSvgExportHelper {
48476
48435
  return `<tspan x="0" y="${y}" xml:space="preserve">${this.escapeHtml(line)}</tspan>`;
48477
48436
  })
48478
48437
  .join('');
48479
- return `<g transform="${transform}"${opacity}>
48480
- ${bgRect}
48481
- <text font-family="${this.escapeHtml(text.fontFamily)}" font-size="${resolvedFontSizePx}" fill="${fontColor}">${tspans}</text>
48438
+ return `<g transform="${transform}"${opacity}>
48439
+ ${bgRect}
48440
+ <text font-family="${this.escapeHtml(text.fontFamily)}" font-size="${resolvedFontSizePx}" fill="${fontColor}">${tspans}</text>
48482
48441
  </g>`;
48483
48442
  }
48484
48443
  /**
@@ -48506,8 +48465,8 @@ class KritzelSvgExportHelper {
48506
48465
  const width = image.totalWidth / scale;
48507
48466
  const height = image.totalHeight / scale;
48508
48467
  const href = imageDataUrls?.get(image.id) || image.resolvedSrc || image.src || '';
48509
- return `<g transform="${transform}"${opacity}>
48510
- <image href="${href}" x="0" y="0" width="${width}" height="${height}" preserveAspectRatio="xMidYMid meet"/>
48468
+ return `<g transform="${transform}"${opacity}>
48469
+ <image href="${href}" x="0" y="0" width="${width}" height="${height}" preserveAspectRatio="xMidYMid meet"/>
48511
48470
  </g>`;
48512
48471
  }
48513
48472
  /**
@@ -48527,19 +48486,19 @@ class KritzelSvgExportHelper {
48527
48486
  if (rasterSafeForCanvas) {
48528
48487
  // PNG export: render placeholder rect (foreignObject doesn't rasterize to PNG well)
48529
48488
  console.warn('[KritzelCustomElement SVG Export] Custom elements do not serialize well to PNG. Use SVG export or screenshot instead.');
48530
- return `<g transform="${transform}"${opacity}>
48531
- <rect x="0" y="0" width="${width}" height="${height}" fill="#f0f0f0" stroke="#999" stroke-width="1" />
48532
- <text x="${width / 2}" y="${height / 2}" text-anchor="middle" dominant-baseline="middle" font-size="12" fill="#999">[Custom Element]</text>
48489
+ return `<g transform="${transform}"${opacity}>
48490
+ <rect x="0" y="0" width="${width}" height="${height}" fill="#f0f0f0" stroke="#999" stroke-width="1" />
48491
+ <text x="${width / 2}" y="${height / 2}" text-anchor="middle" dominant-baseline="middle" font-size="12" fill="#999">[Custom Element]</text>
48533
48492
  </g>`;
48534
48493
  }
48535
48494
  // SVG export: use foreignObject to embed HTML
48536
48495
  const html = obj.element?.outerHTML || '<div style="border:1px dashed #ccc">Empty</div>';
48537
- return `<g transform="${transform}"${opacity}>
48538
- <foreignObject x="0" y="0" width="${width}" height="${height}">
48539
- <div xmlns="http://www.w3.org/1999/xhtml" style="width:100%;height:100%;overflow:hidden;">
48540
- ${html}
48541
- </div>
48542
- </foreignObject>
48496
+ return `<g transform="${transform}"${opacity}>
48497
+ <foreignObject x="0" y="0" width="${width}" height="${height}">
48498
+ <div xmlns="http://www.w3.org/1999/xhtml" style="width:100%;height:100%;overflow:hidden;">
48499
+ ${html}
48500
+ </div>
48501
+ </foreignObject>
48543
48502
  </g>`;
48544
48503
  }
48545
48504
  /**
@@ -48559,8 +48518,8 @@ class KritzelSvgExportHelper {
48559
48518
  return '';
48560
48519
  }
48561
48520
  const opacity = group.opacity !== 1 ? ` opacity="${group.opacity}"` : '';
48562
- return `<g${opacity}>
48563
- ${children}
48521
+ return `<g${opacity}>
48522
+ ${children}
48564
48523
  </g>`;
48565
48524
  }
48566
48525
  /**
@@ -48970,7 +48929,7 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
48970
48929
  contextMenuStateChange;
48971
48930
  /** Emitted when the combined loading state (external `isLoading` prop or internal workspace loading) changes. */
48972
48931
  loadingChange;
48973
- /** Emitted while remote changes are being applied to the active workspace. Stays silent when the remote holds nothing new. */
48932
+ /** Emitted when remote workspace synchronization is in progress. */
48974
48933
  syncingChange;
48975
48934
  forceUpdate = 0;
48976
48935
  isSyncing = false;
@@ -50551,13 +50510,18 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
50551
50510
  _syncConfigRevision = 0;
50552
50511
  _assetStorageConfigRevision = 0;
50553
50512
  _isWorkspaceLoading = false;
50513
+ _syncingRequestId = 0;
50514
+ _syncingShowTimeout = null;
50515
+ _syncingHideTimeout = null;
50516
+ _syncingVisibleSince = null;
50517
+ _syncingShowDelayMs = 300;
50518
+ _syncingMinimumVisibleMs = 500;
50554
50519
  _hasLoggedUnlicensedWelcomeBanner = false;
50555
50520
  _previousVisibleCustomElements = new Set();
50556
50521
  _revealedImageKeys = new Set();
50557
50522
  _sceneBootstrapOpacity = 1;
50558
50523
  _sceneBootstrapTransitionEnabled = false;
50559
50524
  _sceneBootstrapTransitionTimer = null;
50560
- _remoteChangesUnsubscribe = null;
50561
50525
  _defaultUndoState = {
50562
50526
  canUndo: false,
50563
50527
  canRedo: false,
@@ -50574,16 +50538,65 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
50574
50538
  this.core.store.state.isLoading = this._isWorkspaceLoading || this.isLoading;
50575
50539
  this.loadingChange.emit(this.core.store.state.isLoading);
50576
50540
  }
50577
- syncSyncingState(isSyncing) {
50578
- if (this.isSyncing === isSyncing) {
50541
+ beginSyncingRequest() {
50542
+ this._syncingRequestId++;
50543
+ this.clearSyncingShowTimeout();
50544
+ this.clearSyncingHideTimeout();
50545
+ return this._syncingRequestId;
50546
+ }
50547
+ syncSyncingState(isSyncing, requestId) {
50548
+ if (requestId !== this._syncingRequestId) {
50549
+ return;
50550
+ }
50551
+ if (isSyncing) {
50552
+ this.clearSyncingHideTimeout();
50553
+ if (this.isSyncing || this._syncingShowTimeout !== null) {
50554
+ return;
50555
+ }
50556
+ this._syncingShowTimeout = setTimeout(() => {
50557
+ this._syncingShowTimeout = null;
50558
+ if (requestId !== this._syncingRequestId || this.isSyncing) {
50559
+ return;
50560
+ }
50561
+ this.isSyncing = true;
50562
+ this._syncingVisibleSince = Date.now();
50563
+ this.syncingChange.emit(true);
50564
+ }, this._syncingShowDelayMs);
50565
+ return;
50566
+ }
50567
+ this.clearSyncingShowTimeout();
50568
+ if (!this.isSyncing) {
50569
+ return;
50570
+ }
50571
+ this.clearSyncingHideTimeout();
50572
+ const elapsedMs = Date.now() - (this._syncingVisibleSince ?? Date.now());
50573
+ const remainingVisibleMs = Math.max(0, this._syncingMinimumVisibleMs - elapsedMs);
50574
+ if (remainingVisibleMs === 0) {
50575
+ this.finishSyncingState(requestId);
50576
+ return;
50577
+ }
50578
+ this._syncingHideTimeout = setTimeout(() => this.finishSyncingState(requestId), remainingVisibleMs);
50579
+ }
50580
+ finishSyncingState(requestId) {
50581
+ this._syncingHideTimeout = null;
50582
+ if (requestId !== this._syncingRequestId || !this.isSyncing) {
50579
50583
  return;
50580
50584
  }
50581
- this.isSyncing = isSyncing;
50582
- this.syncingChange.emit(isSyncing);
50585
+ this.isSyncing = false;
50586
+ this._syncingVisibleSince = null;
50587
+ this.syncingChange.emit(false);
50588
+ }
50589
+ clearSyncingShowTimeout() {
50590
+ if (this._syncingShowTimeout !== null) {
50591
+ clearTimeout(this._syncingShowTimeout);
50592
+ this._syncingShowTimeout = null;
50593
+ }
50583
50594
  }
50584
- clearRemoteChangesSubscription() {
50585
- this._remoteChangesUnsubscribe?.();
50586
- this._remoteChangesUnsubscribe = null;
50595
+ clearSyncingHideTimeout() {
50596
+ if (this._syncingHideTimeout !== null) {
50597
+ clearTimeout(this._syncingHideTimeout);
50598
+ this._syncingHideTimeout = null;
50599
+ }
50587
50600
  }
50588
50601
  isNetworkAvailable() {
50589
50602
  return typeof navigator !== 'undefined' && navigator.onLine;
@@ -50700,7 +50713,7 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
50700
50713
  disconnectedCallback() {
50701
50714
  this.throttledPointerMoveMulti.cancel();
50702
50715
  this._revealedImageKeys.clear();
50703
- this.clearRemoteChangesSubscription();
50716
+ this.beginSyncingRequest();
50704
50717
  if (this._sceneBootstrapTransitionTimer !== null) {
50705
50718
  clearTimeout(this._sceneBootstrapTransitionTimer);
50706
50719
  this._sceneBootstrapTransitionTimer = null;
@@ -50950,12 +50963,27 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
50950
50963
  }
50951
50964
  this._isWorkspaceLoading = true;
50952
50965
  this.syncLoadingState();
50966
+ const syncingRequestId = this.beginSyncingRequest();
50953
50967
  const initializationPromise = this.core.initializeWorkspace(workspace, options);
50954
50968
  this._workspaceInitializationPromise = initializationPromise;
50955
50969
  this._workspaceInitializationTargetKey = targetKey;
50956
50970
  try {
50957
50971
  await initializationPromise;
50958
- this.trackRemoteSynchronization();
50972
+ // Track remote sync in the background without blocking the loading overlay.
50973
+ const initializedObjects = this.core.store.objects;
50974
+ const networkSyncPromise = initializedObjects?.whenNetworkSynced();
50975
+ if (networkSyncPromise && this.isNetworkAvailable()) {
50976
+ this.syncSyncingState(true, syncingRequestId);
50977
+ void networkSyncPromise.finally(() => {
50978
+ // Only clear syncing for the currently active object map.
50979
+ if (this.core.store.objects === initializedObjects) {
50980
+ this.syncSyncingState(false, syncingRequestId);
50981
+ }
50982
+ });
50983
+ }
50984
+ else {
50985
+ this.syncSyncingState(false, syncingRequestId);
50986
+ }
50959
50987
  }
50960
50988
  finally {
50961
50989
  // Only the most recent init clears loading state to prevent race conditions
@@ -50967,38 +50995,6 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
50967
50995
  }
50968
50996
  }
50969
50997
  }
50970
- /**
50971
- * Reports syncing only while remote data is actually being reconciled into the
50972
- * active workspace. Yjs suppresses updates that carry nothing new, so a workspace
50973
- * that already matches the remote never reports syncing at all.
50974
- */
50975
- trackRemoteSynchronization() {
50976
- this.clearRemoteChangesSubscription();
50977
- this.syncSyncingState(false);
50978
- const initializedObjects = this.core.store.objects;
50979
- if (!initializedObjects?.hasNetworkSyncProvider || !this.isNetworkAvailable()) {
50980
- return;
50981
- }
50982
- if (initializedObjects.supportsRemoteChangeDetection) {
50983
- this._remoteChangesUnsubscribe = initializedObjects.onRemoteChangesApplied(() => {
50984
- if (this.core.store.objects !== initializedObjects) {
50985
- return;
50986
- }
50987
- this.syncSyncingState(true);
50988
- });
50989
- }
50990
- else {
50991
- // Custom providers without an update origin cannot be diffed, so fall back to reporting the whole handshake.
50992
- this.syncSyncingState(true);
50993
- }
50994
- void initializedObjects.whenNetworkSynced().finally(() => {
50995
- if (this.core.store.objects !== initializedObjects) {
50996
- return;
50997
- }
50998
- this.clearRemoteChangesSubscription();
50999
- this.syncSyncingState(false);
51000
- });
51001
- }
51002
50998
  emitObjectsChange() {
51003
50999
  const objectsMap = this.core.store.objects;
51004
51000
  if (!objectsMap) {
@@ -1,4 +1,4 @@
1
- import { p as proxyCustomElement, H, c as createEvent, h, d as Host, t as transformTag } from './p-B43upypT.js';
1
+ import { p as proxyCustomElement, H, c as createEvent, h, d as Host, t as transformTag } from './p-C9_yBEoX.js';
2
2
 
3
3
  const kritzelNumericInputCss = () => `:host{display:block}.input-container{display:flex;flex-direction:column;gap:6px}.input-label{font-size:14px;font-weight:500;color:var(--kritzel-numeric-input-label-color, #333333)}.input-wrapper{display:flex;position:relative}.numeric-input{flex:1;padding:8px 36px 8px 12px;border:1px solid var(--kritzel-numeric-input-border-color, #ebebeb);border-radius:var(--kritzel-numeric-input-border-radius, 6px);font-size:14px;color:var(--kritzel-numeric-input-text-color, #333333);background-color:var(--kritzel-numeric-input-input-background, #ffffff);outline:none;transition:border-color 150ms ease;box-sizing:border-box}.numeric-input::-webkit-outer-spin-button,.numeric-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.numeric-input[type='number']{-moz-appearance:textfield}.numeric-input::selection{background-color:var(--kritzel-numeric-input-selection-background, #007AFF);color:var(--kritzel-numeric-input-selection-color, #ffffff)}.numeric-input:hover{border-color:var(--kritzel-numeric-input-hover-border-color, #cccccc)}.numeric-input:focus{border-color:var(--kritzel-numeric-input-focus-border-color, #0066ff);border-width:2px;padding:7px 35px 7px 11px}.spinner-buttons{position:absolute;right:1px;top:1px;bottom:1px;display:flex;flex-direction:column;border-left:1px solid var(--kritzel-numeric-input-border-color, #ebebeb);border-radius:0 var(--kritzel-numeric-input-spinner-border-radius, 5px) var(--kritzel-numeric-input-spinner-border-radius, 5px) 0;overflow:hidden}.spinner-button{flex:1;display:flex;align-items:center;justify-content:center;width:24px;padding:0;border:none;background-color:var(--kritzel-numeric-input-spinner-background, #f5f5f5);color:var(--kritzel-numeric-input-spinner-color, #666666);cursor:pointer;transition:background-color 150ms ease}.spinner-button:hover{background-color:var(--kritzel-numeric-input-spinner-hover-background, #ebebeb)}.spinner-button:active{background-color:var(--kritzel-numeric-input-spinner-active-background, #dddddd)}.spinner-up{border-bottom:1px solid var(--kritzel-numeric-input-border-color, #ebebeb)}.spinner-icon{width:10px;height:6px}`;
4
4
 
@@ -97,7 +97,7 @@ const KritzelNumericInput = /*@__PURE__*/ proxyCustomElement(class KritzelNumeri
97
97
  this.valueChange.emit(newValue);
98
98
  };
99
99
  render() {
100
- return (h(Host, { key: '68e6fecd79c3c970d1742b1a0bb8667ca2d31729' }, h("div", { key: 'efcf623186d221690bbb956088ec51343de07f3a', class: "input-container" }, this.label && h("label", { key: '300de793f02008ad037da021003b46fc34fc5239', class: "input-label" }, this.label), h("div", { key: '9ff424901fddfcbdac4835e2b2089df2e0966d0f', class: "input-wrapper" }, h("input", { key: 'fc77e6ad1c0b15e3dd3f960b6448ddab1a9beeb1', type: "number", class: "numeric-input", title: "", min: this.min === Number.MIN_SAFE_INTEGER ? undefined : this.min, max: this.max === Number.MAX_SAFE_INTEGER ? undefined : this.max, step: this.step, value: this.inputValue, placeholder: this.placeholder, onInput: this.handleInput, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, onInvalid: this.handleInvalid }), h("div", { key: 'c286606fa0617cc3acbbe40a27e40b154002e01d', class: "spinner-buttons" }, h("button", { key: 'e3a65a327975918fe604cd196ffb087fc4d3ca47', type: "button", class: "spinner-button spinner-up", onClick: this.handleIncrement, tabIndex: -1, "aria-label": "Increase value" }, h("svg", { key: '62b2ff4ed67ca8b6fc220ff9c63ceca90f75baea', viewBox: "0 0 10 6", class: "spinner-icon" }, h("path", { key: '803d5c30826d40d95f282071f3f88356366a9faf', d: "M1 5L5 1L9 5", stroke: "currentColor", "stroke-width": "1.5", fill: "none", "stroke-linecap": "round", "stroke-linejoin": "round" }))), h("button", { key: '3c54a48e7082f5aaa9ed923357d0cc4a722018b5', type: "button", class: "spinner-button spinner-down", onClick: this.handleDecrement, tabIndex: -1, "aria-label": "Decrease value" }, h("svg", { key: '9f6cb5f34bbb0e70b5773aecec519b7d8b742712', viewBox: "0 0 10 6", class: "spinner-icon" }, h("path", { key: '6539b0d4f4bd26e463fa9152cf58757497355cf6', d: "M1 1L5 5L9 1", stroke: "currentColor", "stroke-width": "1.5", fill: "none", "stroke-linecap": "round", "stroke-linejoin": "round" }))))))));
100
+ return (h(Host, { key: '7af3efe94c98934dcfe701c516ffc7cea2b4fde9' }, h("div", { key: '81347ea86a62f72b5b7662d90670e2ace98b16e7', class: "input-container" }, this.label && h("label", { key: '35b7650a3c4d1b93dbcb763b0c8f3767e3b519ac', class: "input-label" }, this.label), h("div", { key: '691ade138e5ba2ef51a76b1fc54da51fb7dd7389', class: "input-wrapper" }, h("input", { key: '58445c41cc8be438d1065787d375fb9d271f3873', type: "number", class: "numeric-input", title: "", min: this.min === Number.MIN_SAFE_INTEGER ? undefined : this.min, max: this.max === Number.MAX_SAFE_INTEGER ? undefined : this.max, step: this.step, value: this.inputValue, placeholder: this.placeholder, onInput: this.handleInput, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, onInvalid: this.handleInvalid }), h("div", { key: 'c669fc612696c555b96f046a8c70e75e9650af23', class: "spinner-buttons" }, h("button", { key: 'ae904cc60925d48120405f74d656ee9cbf312d70', type: "button", class: "spinner-button spinner-up", onClick: this.handleIncrement, tabIndex: -1, "aria-label": "Increase value" }, h("svg", { key: '4a4964336820cfc2128b98bf245556425919dfb6', viewBox: "0 0 10 6", class: "spinner-icon" }, h("path", { key: 'f305136d337690b0eaa39983d26a67454e4862da', d: "M1 5L5 1L9 5", stroke: "currentColor", "stroke-width": "1.5", fill: "none", "stroke-linecap": "round", "stroke-linejoin": "round" }))), h("button", { key: 'c90f2d9a3deac66dc577142f87f73aef491e5f25', type: "button", class: "spinner-button spinner-down", onClick: this.handleDecrement, tabIndex: -1, "aria-label": "Decrease value" }, h("svg", { key: '2a3e33c55b6ace48f15ec56d78c6aab782c64520', viewBox: "0 0 10 6", class: "spinner-icon" }, h("path", { key: 'f327413078824800ad061126417a8f25578ba2de', d: "M1 1L5 5L9 1", stroke: "currentColor", "stroke-width": "1.5", fill: "none", "stroke-linecap": "round", "stroke-linejoin": "round" }))))))));
101
101
  }
102
102
  static get watchers() { return {
103
103
  "value": [{