@kritzel/engine 0.4.32 → 0.4.34

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 (33) hide show
  1. package/dist/cjs/{engine.constants-cfbepvaI.js → engine.constants-VyFrUl1W.js} +32 -31
  2. package/dist/cjs/{index-BrjM5aN2.js → index-BP5Iy6FQ.js} +15 -9
  3. package/dist/cjs/index.cjs.js +2 -2
  4. package/dist/cjs/kritzel-awareness-cursors_5.cjs.entry.js +2 -2
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/stencil.cjs.js +2 -2
  7. package/dist/collection/collection-manifest.json +1 -1
  8. package/dist/collection/constants/version.js +1 -1
  9. package/dist/components/index.js +6 -6
  10. package/dist/components/kritzel-awareness-cursors.js +1 -1
  11. package/dist/components/kritzel-cursor-trail.js +1 -1
  12. package/dist/components/kritzel-engine.js +37 -36
  13. package/dist/components/kritzel-icon.js +1 -1
  14. package/dist/components/kritzel-watermark.js +1 -1
  15. package/dist/components/{p-Bnuu1qip.js → p-BHVbfJrf.js} +1 -1
  16. package/dist/components/{p-9YjkpHyU.js → p-BTU9qcSW.js} +1 -1
  17. package/dist/components/{p-CJ5B8cMK.js → p-BWfRbEIq.js} +4 -3
  18. package/dist/components/{p-BIUT0gBe.js → p-NAEiq8CK.js} +1 -1
  19. package/dist/components/{p-DXnF4FeS.js → p-k0LxV9Bg.js} +1 -1
  20. package/dist/esm/{engine.constants-DPDQhv6S.js → engine.constants-BHTr2qPx.js} +32 -31
  21. package/dist/esm/{index-Hqbtnnex.js → index-C8PnHbLt.js} +15 -9
  22. package/dist/esm/index.js +3 -3
  23. package/dist/esm/kritzel-awareness-cursors_5.entry.js +2 -2
  24. package/dist/esm/loader.js +2 -2
  25. package/dist/esm/stencil.js +3 -3
  26. package/dist/stencil/index.esm.js +3 -3
  27. package/dist/stencil/{p-d678528e.entry.js → p-40097a38.entry.js} +2 -2
  28. package/dist/stencil/{p-DPDQhv6S.js → p-BHTr2qPx.js} +32 -31
  29. package/dist/stencil/{p-Hqbtnnex.js → p-C8PnHbLt.js} +15 -9
  30. package/dist/stencil/stencil.esm.js +4 -4
  31. package/dist/types/constants/version.d.ts +1 -1
  32. package/dist/types/stencil-public-runtime.d.ts +61 -55
  33. package/package.json +3 -1
@@ -1387,7 +1387,6 @@ class Mark {
1387
1387
  if (!type)
1388
1388
  throw new RangeError(`There is no mark type ${json.type} in this schema`);
1389
1389
  let mark = type.create(json.attrs);
1390
- type.checkAttrs(mark.attrs);
1391
1390
  return mark;
1392
1391
  }
1393
1392
  /**
@@ -2367,11 +2366,11 @@ class Node {
2367
2366
  */
2368
2367
  check() {
2369
2368
  this.type.checkContent(this.content);
2370
- this.type.checkAttrs(this.attrs);
2369
+ checkAttrs(this.type.attrs, this.attrs, "node", this.type.name);
2371
2370
  let copy = Mark.none;
2372
2371
  for (let i = 0; i < this.marks.length; i++) {
2373
2372
  let mark = this.marks[i];
2374
- mark.type.checkAttrs(mark.attrs);
2373
+ checkAttrs(mark.type.attrs, mark.attrs, "mark", mark.type.name);
2375
2374
  copy = mark.addToSet(copy);
2376
2375
  }
2377
2376
  if (!Mark.sameSet(copy, this.marks))
@@ -2412,7 +2411,6 @@ class Node {
2412
2411
  }
2413
2412
  let content = Fragment.fromJSON(schema, json.content);
2414
2413
  let node = schema.nodeType(json.type).create(json.attrs, content, marks);
2415
- node.type.checkAttrs(node.attrs);
2416
2414
  return node;
2417
2415
  }
2418
2416
  }
@@ -2462,6 +2460,15 @@ function wrapMarks(marks, str) {
2462
2460
  str = marks[i].type.name + "(" + str + ")";
2463
2461
  return str;
2464
2462
  }
2463
+ function checkAttrs(attrs, values, type, name) {
2464
+ for (let attr in values)
2465
+ if (!(attr in attrs))
2466
+ throw new RangeError(`Unsupported attribute ${attr} for ${type} of type ${name}`);
2467
+ for (let attr in attrs) {
2468
+ if (attrs[attr].validate)
2469
+ attrs[attr].validate(values[attr]);
2470
+ }
2471
+ }
2465
2472
 
2466
2473
  /**
2467
2474
  Instances of this class represent a match state of a node type's
@@ -2916,27 +2923,21 @@ function defaultAttrs(attrs) {
2916
2923
  function computeAttrs(attrs, value) {
2917
2924
  let built = Object.create(null);
2918
2925
  for (let name in attrs) {
2926
+ let attr = attrs[name];
2919
2927
  let given = value && value[name];
2920
2928
  if (given === undefined) {
2921
- let attr = attrs[name];
2922
2929
  if (attr.hasDefault)
2923
2930
  given = attr.default;
2924
2931
  else
2925
2932
  throw new RangeError("No value supplied for attribute " + name);
2926
2933
  }
2934
+ else if (attr.validate) {
2935
+ attr.validate(given);
2936
+ }
2927
2937
  built[name] = given;
2928
2938
  }
2929
2939
  return built;
2930
2940
  }
2931
- function checkAttrs(attrs, values, type, name) {
2932
- for (let attr in values)
2933
- if (!(attr in attrs))
2934
- throw new RangeError(`Unsupported attribute ${attr} for ${type} of type ${name}`);
2935
- for (let attr in attrs) {
2936
- if (attrs[attr].validate)
2937
- attrs[attr].validate(values[attr]);
2938
- }
2939
- }
2940
2941
  function initAttrs(typeName, attrs) {
2941
2942
  let result = Object.create(null);
2942
2943
  if (attrs)
@@ -3108,11 +3109,9 @@ let NodeType$1 = class NodeType {
3108
3109
  throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);
3109
3110
  }
3110
3111
  /**
3111
- @internal
3112
+ @internal no longer useful, but called by old prosemirror-view versions
3112
3113
  */
3113
- checkAttrs(attrs) {
3114
- checkAttrs(this.attrs, attrs, "node", this.name);
3115
- }
3114
+ checkAttrs(attrs) { }
3116
3115
  /**
3117
3116
  Check whether the given mark type is allowed in this node.
3118
3117
  */
@@ -3259,12 +3258,6 @@ class MarkType {
3259
3258
  return set[i];
3260
3259
  }
3261
3260
  /**
3262
- @internal
3263
- */
3264
- checkAttrs(attrs) {
3265
- checkAttrs(this.attrs, attrs, "mark", this.name);
3266
- }
3267
- /**
3268
3261
  Queries whether a given mark type is
3269
3262
  [excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.
3270
3263
  */
@@ -9956,7 +9949,8 @@ function nodeLen(node) {
9956
9949
  }
9957
9950
  function isIgnorable(dom, dir) {
9958
9951
  let desc = dom.pmViewDesc;
9959
- return desc && desc.size == 0 && (dir < 0 || dom.nextSibling || dom.nodeName != "BR");
9952
+ return desc ? desc.size == 0 && (dir < 0 || dom.nextSibling || dom.nodeName != "BR")
9953
+ : dom.nodeType == 1 && dom.contentEditable == "false";
9960
9954
  }
9961
9955
  function skipIgnoredNodes(view, dir) {
9962
9956
  return dir < 0 ? skipIgnoredNodesBefore(view) : skipIgnoredNodesAfter(view);
@@ -10545,12 +10539,11 @@ function addContext(slice, context) {
10545
10539
  if (!type || type.hasRequiredAttrs())
10546
10540
  break;
10547
10541
  try {
10548
- type.checkAttrs(array[i + 1]);
10542
+ content = Fragment.from(type.create(array[i + 1], content));
10549
10543
  }
10550
10544
  catch (e) {
10551
10545
  break;
10552
10546
  }
10553
- content = Fragment.from(type.create(array[i + 1], content));
10554
10547
  openStart++;
10555
10548
  openEnd++;
10556
10549
  }
@@ -11030,7 +11023,7 @@ editHandlers.compositionstart = editHandlers.compositionupdate = view => {
11030
11023
  if (!view.composing) {
11031
11024
  view.domObserver.flush();
11032
11025
  let { state } = view, $pos = state.selection.$to;
11033
- if (state.selection instanceof TextSelection &&
11026
+ if (state.selection instanceof TextSelection && state.selection.empty &&
11034
11027
  (state.storedMarks ||
11035
11028
  (!$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some(m => m.type.spec.inclusive === false)) ||
11036
11029
  chrome && windows$1 && selectionBeforeUneditable(view))) { // Issue #1500
@@ -12667,9 +12660,7 @@ function readDOMChange(view, from, to, typeOver, addedNodes) {
12667
12660
  // as being an iOS enter press), just dispatch an Enter key instead.
12668
12661
  if (((ios && view.input.lastIOSEnter > Date.now() - 225 &&
12669
12662
  (!inlineChange || addedNodes.some(n => n.nodeName == "DIV" || n.nodeName == "P"))) ||
12670
- (!inlineChange && $from.pos < parse.doc.content.size &&
12671
- (!$from.sameParent($to) || !$from.parent.inlineContent) &&
12672
- $from.pos < $to.pos && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", "")))) &&
12663
+ (!inlineChange && looksLikeEnter(parse.doc, $from.pos, $to.pos))) &&
12673
12664
  view.someProp("handleKeyDown", f => f(view, keyEvent(13, "Enter")))) {
12674
12665
  view.input.lastIOSEnter = 0;
12675
12666
  return;
@@ -12820,6 +12811,16 @@ function looksLikeBackspace(old, start, end, $newStart, $newEnd) {
12820
12811
  // The fragments after the join point must match
12821
12812
  return $newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content);
12822
12813
  }
12814
+ function looksLikeEnter(content, from, to) {
12815
+ let newTextlines = 0, newLeaves = 0;
12816
+ content.nodesBetween(from, to, (node, pos) => {
12817
+ if (node.isTextblock && pos >= from && pos < to)
12818
+ newTextlines++;
12819
+ else if (node.isText ? /\S/.test(node.text.slice(Math.max(0, from - pos), Math.min(node.nodeSize, to - pos))) : node.isLeaf)
12820
+ newLeaves++;
12821
+ });
12822
+ return newLeaves == 0 && newTextlines == 1;
12823
+ }
12823
12824
  function skipClosingAndOpening($pos, fromEnd, mayOpen) {
12824
12825
  let depth = $pos.depth, end = fromEnd ? $pos.end() : $pos.pos;
12825
12826
  while (depth > 0 && (fromEnd || $pos.indexAfter(depth) == $pos.node(depth).childCount)) {
@@ -22,7 +22,7 @@ const NAMESPACE = 'stencil';
22
22
  const BUILD = /* stencil */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, propChangeCallback: true, state: true, updatable: true};
23
23
 
24
24
  /*
25
- Stencil Client Platform v4.44.2 | MIT Licensed | https://stenciljs.com
25
+ Stencil Client Platform v4.45.1 | MIT Licensed | https://stenciljs.com
26
26
  */
27
27
 
28
28
 
@@ -868,7 +868,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
868
868
  if (idxInOld >= 0) {
869
869
  elmToMove = oldCh[idxInOld];
870
870
  if (elmToMove.$tag$ !== newStartVnode.$tag$) {
871
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
871
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
872
872
  } else {
873
873
  patch(elmToMove, newStartVnode, isInitialRender);
874
874
  oldCh[idxInOld] = void 0;
@@ -1303,21 +1303,26 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1303
1303
  }
1304
1304
  return;
1305
1305
  }
1306
- const setterSetVal = () => {
1306
+ const parsedValue = parsePropertyValue(
1307
+ newValue,
1308
+ memberFlags);
1309
+ const setterSetVal = (val) => {
1307
1310
  const currentValue = ref.$lazyInstance$[memberName];
1308
1311
  if (!ref.$instanceValues$.get(memberName) && currentValue) {
1309
1312
  ref.$instanceValues$.set(memberName, currentValue);
1310
1313
  }
1311
- ref.$lazyInstance$[memberName] = parsePropertyValue(
1312
- newValue,
1313
- memberFlags);
1314
+ ref.$lazyInstance$[memberName] = val;
1314
1315
  setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
1315
1316
  };
1316
1317
  if (ref.$lazyInstance$) {
1317
- setterSetVal();
1318
+ setterSetVal(parsedValue);
1318
1319
  } else {
1320
+ ref.$instanceValues$.set(memberName, parsedValue);
1319
1321
  ref.$fetchedCbList$.push(() => {
1320
- setterSetVal();
1322
+ const pendingValue = ref.$instanceValues$.get(memberName);
1323
+ if (ref.$lazyInstance$[memberName] !== pendingValue) {
1324
+ setterSetVal(pendingValue);
1325
+ }
1321
1326
  });
1322
1327
  }
1323
1328
  }
@@ -1371,8 +1376,9 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1371
1376
  if (isBooleanTarget) {
1372
1377
  newValue = newValue === null || newValue === "false" ? false : true;
1373
1378
  }
1379
+ const currentValue = propMemberFlags & 4096 /* Setter */ ? hostRef.$instanceValues$.get(propName) : this[propName];
1374
1380
  const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
1375
- if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) {
1381
+ if (!isSpuriousBooleanRemoval && newValue != currentValue && (!propDesc.get || !!propDesc.set)) {
1376
1382
  this[propName] = newValue;
1377
1383
  }
1378
1384
  });
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var engine_constants = require('./engine.constants-cfbepvaI.js');
3
+ var engine_constants = require('./engine.constants-VyFrUl1W.js');
4
4
  var Y = require('yjs');
5
5
  var yIndexeddb = require('y-indexeddb');
6
6
  var yWebsocket = require('y-websocket');
@@ -4150,7 +4150,7 @@ const DEFAULT_ASSET_STORAGE_CONFIG = {
4150
4150
  * This file is auto-generated by the version bump scripts.
4151
4151
  * Do not modify manually.
4152
4152
  */
4153
- const KRITZEL_VERSION = '0.4.32';
4153
+ const KRITZEL_VERSION = '0.4.34';
4154
4154
 
4155
4155
  exports.ABSOLUTE_SCALE_MAX = engine_constants.ABSOLUTE_SCALE_MAX;
4156
4156
  exports.ABSOLUTE_SCALE_MIN = engine_constants.ABSOLUTE_SCALE_MIN;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BrjM5aN2.js');
4
- var engine_constants = require('./engine.constants-cfbepvaI.js');
3
+ var index = require('./index-BP5Iy6FQ.js');
4
+ var engine_constants = require('./engine.constants-VyFrUl1W.js');
5
5
  var Y = require('yjs');
6
6
 
7
7
  function _interopNamespace(e) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BrjM5aN2.js');
3
+ var index = require('./index-BP5Iy6FQ.js');
4
4
  var appGlobals = require('./app-globals-V2Kpy_OQ.js');
5
5
 
6
6
  const defineCustomElements = async (win, options) => {
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BrjM5aN2.js');
3
+ var index = require('./index-BP5Iy6FQ.js');
4
4
  var appGlobals = require('./app-globals-V2Kpy_OQ.js');
5
5
 
6
6
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
7
7
  /*
8
- Stencil Client Patch Browser v4.44.2 | MIT Licensed | https://stenciljs.com
8
+ Stencil Client Patch Browser v4.45.1 | MIT Licensed | https://stenciljs.com
9
9
  */
10
10
 
11
11
  var patchBrowser = () => {
@@ -11,7 +11,7 @@
11
11
  ],
12
12
  "compiler": {
13
13
  "name": "@stencil/core",
14
- "version": "4.44.2",
14
+ "version": "4.45.1",
15
15
  "typescriptVersion": "5.8.3"
16
16
  },
17
17
  "collections": [],
@@ -3,4 +3,4 @@
3
3
  * This file is auto-generated by the version bump scripts.
4
4
  * Do not modify manually.
5
5
  */
6
- export const KRITZEL_VERSION = '0.4.32';
6
+ export const KRITZEL_VERSION = '0.4.34';
@@ -1,13 +1,13 @@
1
- export { g as getAssetPath, r as render, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-CJ5B8cMK.js';
2
- import { D as DEFAULT_COLOR_PALETTE } from './p-DXnF4FeS.js';
3
- export { K as KritzelBaseObject, c as KritzelColorHelper, b as KritzelLine, a as KritzelPath, d as KritzelThemeManager, O as ObjectHelper, T as ThemeHelper, e as darkTheme, l as lightTheme, r as resolveColor } from './p-DXnF4FeS.js';
1
+ export { g as getAssetPath, r as render, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-BWfRbEIq.js';
2
+ import { D as DEFAULT_COLOR_PALETTE } from './p-k0LxV9Bg.js';
3
+ export { K as KritzelBaseObject, c as KritzelColorHelper, b as KritzelLine, a as KritzelPath, d as KritzelThemeManager, O as ObjectHelper, T as ThemeHelper, e as darkTheme, l as lightTheme, r as resolveColor } from './p-k0LxV9Bg.js';
4
4
  import { D as DEFAULT_STROKE_SIZES, a as DEFAULT_FONT_SIZES, b as DEFAULT_TEXT_TOOL_AVAILABLE_FONTS, S as ShapeType } from './kritzel-engine.js';
5
5
  export { M as APP_STATE_MIGRATIONS, A as AssetNotFoundError, O as CURRENT_APP_STATE_SCHEMA_VERSION, P as CURRENT_WORKSPACE_SCHEMA_VERSION, E as DEFAULT_SYNC_CONFIG, G as DE_LOCALE, F as EN_LOCALE, H as FR_LOCALE, I as IndexedDBAssetProvider, J as KritzelAlignment, x as KritzelAnchorManager, v as KritzelAssetResolver, j as KritzelBaseTool, k as KritzelBrushTool, q as KritzelCursorHelper, s as KritzelDevicesHelper, f as KritzelDynamicObject, B as KritzelDynamicObjectRendererRegistry, KritzelEngine, m as KritzelEraserTool, C as KritzelFontRegistry, d as KritzelGroup, t as KritzelHTMLHelper, g as KritzelIframeObject, c as KritzelImage, n as KritzelImageTool, r as KritzelKeyboardHelper, z as KritzelLicenseManager, l as KritzelLineTool, y as KritzelLocalizationManager, i as KritzelSelectionBox, h as KritzelSelectionGroup, u as KritzelSelectionTool, e as KritzelShape, p as KritzelShapeTool, K as KritzelText, o as KritzelTextTool, w as KritzelWorkspace, W as WORKSPACE_EXPORT_VERSION, N as WORKSPACE_MIGRATIONS, defineCustomElement as defineCustomElementKritzelEngine, Q as resolveTextToolAvailableFonts, L as runMigrations } from './kritzel-engine.js';
6
6
  import * as Y from 'yjs';
7
7
  import { IndexeddbPersistence } from 'y-indexeddb';
8
8
  import { WebsocketProvider } from 'y-websocket';
9
- export { K as KritzelIconRegistry, d as defaultIcons } from './p-BIUT0gBe.js';
10
- export { A as ABSOLUTE_SCALE_MAX, a as ABSOLUTE_SCALE_MIN, K as KRITZEL_WEBSITE_URL } from './p-Bnuu1qip.js';
9
+ export { K as KritzelIconRegistry, d as defaultIcons } from './p-NAEiq8CK.js';
10
+ export { A as ABSOLUTE_SCALE_MAX, a as ABSOLUTE_SCALE_MIN, K as KRITZEL_WEBSITE_URL } from './p-BHVbfJrf.js';
11
11
  export { KritzelAwarenessCursors, defineCustomElement as defineCustomElementKritzelAwarenessCursors } from './kritzel-awareness-cursors.js';
12
12
  export { KritzelCursorTrail, defineCustomElement as defineCustomElementKritzelCursorTrail } from './kritzel-cursor-trail.js';
13
13
  export { KritzelIcon, defineCustomElement as defineCustomElementKritzelIcon } from './kritzel-icon.js';
@@ -4138,6 +4138,6 @@ const DEFAULT_ASSET_STORAGE_CONFIG = {
4138
4138
  * This file is auto-generated by the version bump scripts.
4139
4139
  * Do not modify manually.
4140
4140
  */
4141
- const KRITZEL_VERSION = '0.4.32';
4141
+ const KRITZEL_VERSION = '0.4.34';
4142
4142
 
4143
4143
  export { BroadcastSyncProvider, DEFAULT_ASSET_STORAGE_CONFIG, DEFAULT_BRUSH_CONFIG, DEFAULT_COLOR_PALETTE, DEFAULT_LINE_TOOL_CONFIG, DEFAULT_SHAPE_CONFIG, DEFAULT_TEXT_CONFIG, DEFAULT_TEXT_TOOL_AVAILABLE_FONTS, HocuspocusSyncProvider, HttpAssetProvider, InMemorySyncProvider, IndexedDBSyncProvider, KRITZEL_VERSION, KritzelToolConfigHelper, PresignedAssetProvider, ShapeType, WebSocketSyncProvider, hasRemoteSyncProvider };
@@ -1,4 +1,4 @@
1
- import { f as KritzelAwarenessCursors$1, g as defineCustomElement$1 } from './p-DXnF4FeS.js';
1
+ import { f as KritzelAwarenessCursors$1, g as defineCustomElement$1 } from './p-k0LxV9Bg.js';
2
2
 
3
3
  const KritzelAwarenessCursors = KritzelAwarenessCursors$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { K as KritzelCursorTrail$1, d as defineCustomElement$1 } from './p-9YjkpHyU.js';
1
+ import { K as KritzelCursorTrail$1, d as defineCustomElement$1 } from './p-BTU9qcSW.js';
2
2
 
3
3
  const KritzelCursorTrail = KritzelCursorTrail$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,9 +1,9 @@
1
- import { p as proxyCustomElement, H, c as createEvent, h, d as Host, t as transformTag } from './p-CJ5B8cMK.js';
2
- import { a as KritzelMouseButton, d as defineCustomElement$4 } from './p-9YjkpHyU.js';
3
- import { K as KritzelBaseObject, h as KritzelMathHelper, c as KritzelColorHelper, i as KritzelGeometryHelper, D as DEFAULT_COLOR_PALETTE, a as KritzelPath, b as KritzelLine, O as ObjectHelper, d as KritzelThemeManager, g as defineCustomElement$5 } from './p-DXnF4FeS.js';
4
- import { A as ABSOLUTE_SCALE_MAX, a as ABSOLUTE_SCALE_MIN, d as defineCustomElement$2 } from './p-Bnuu1qip.js';
1
+ import { p as proxyCustomElement, H, c as createEvent, h, d as Host, t as transformTag } from './p-BWfRbEIq.js';
2
+ import { a as KritzelMouseButton, d as defineCustomElement$4 } from './p-BTU9qcSW.js';
3
+ import { K as KritzelBaseObject, h as KritzelMathHelper, c as KritzelColorHelper, i as KritzelGeometryHelper, D as DEFAULT_COLOR_PALETTE, a as KritzelPath, b as KritzelLine, O as ObjectHelper, d as KritzelThemeManager, g as defineCustomElement$5 } from './p-k0LxV9Bg.js';
4
+ import { A as ABSOLUTE_SCALE_MAX, a as ABSOLUTE_SCALE_MIN, d as defineCustomElement$2 } from './p-BHVbfJrf.js';
5
5
  import * as Y from 'yjs';
6
- import { K as KritzelIconRegistry, a as defineCustomElement$3 } from './p-BIUT0gBe.js';
6
+ import { K as KritzelIconRegistry, a as defineCustomElement$3 } from './p-NAEiq8CK.js';
7
7
 
8
8
  class KritzelDevicesHelper {
9
9
  static isTouchDevice() {
@@ -739,7 +739,6 @@ class Mark {
739
739
  if (!type)
740
740
  throw new RangeError(`There is no mark type ${json.type} in this schema`);
741
741
  let mark = type.create(json.attrs);
742
- type.checkAttrs(mark.attrs);
743
742
  return mark;
744
743
  }
745
744
  /**
@@ -1719,11 +1718,11 @@ class Node {
1719
1718
  */
1720
1719
  check() {
1721
1720
  this.type.checkContent(this.content);
1722
- this.type.checkAttrs(this.attrs);
1721
+ checkAttrs(this.type.attrs, this.attrs, "node", this.type.name);
1723
1722
  let copy = Mark.none;
1724
1723
  for (let i = 0; i < this.marks.length; i++) {
1725
1724
  let mark = this.marks[i];
1726
- mark.type.checkAttrs(mark.attrs);
1725
+ checkAttrs(mark.type.attrs, mark.attrs, "mark", mark.type.name);
1727
1726
  copy = mark.addToSet(copy);
1728
1727
  }
1729
1728
  if (!Mark.sameSet(copy, this.marks))
@@ -1764,7 +1763,6 @@ class Node {
1764
1763
  }
1765
1764
  let content = Fragment.fromJSON(schema, json.content);
1766
1765
  let node = schema.nodeType(json.type).create(json.attrs, content, marks);
1767
- node.type.checkAttrs(node.attrs);
1768
1766
  return node;
1769
1767
  }
1770
1768
  }
@@ -1814,6 +1812,15 @@ function wrapMarks(marks, str) {
1814
1812
  str = marks[i].type.name + "(" + str + ")";
1815
1813
  return str;
1816
1814
  }
1815
+ function checkAttrs(attrs, values, type, name) {
1816
+ for (let attr in values)
1817
+ if (!(attr in attrs))
1818
+ throw new RangeError(`Unsupported attribute ${attr} for ${type} of type ${name}`);
1819
+ for (let attr in attrs) {
1820
+ if (attrs[attr].validate)
1821
+ attrs[attr].validate(values[attr]);
1822
+ }
1823
+ }
1817
1824
 
1818
1825
  /**
1819
1826
  Instances of this class represent a match state of a node type's
@@ -2268,27 +2275,21 @@ function defaultAttrs(attrs) {
2268
2275
  function computeAttrs(attrs, value) {
2269
2276
  let built = Object.create(null);
2270
2277
  for (let name in attrs) {
2278
+ let attr = attrs[name];
2271
2279
  let given = value && value[name];
2272
2280
  if (given === undefined) {
2273
- let attr = attrs[name];
2274
2281
  if (attr.hasDefault)
2275
2282
  given = attr.default;
2276
2283
  else
2277
2284
  throw new RangeError("No value supplied for attribute " + name);
2278
2285
  }
2286
+ else if (attr.validate) {
2287
+ attr.validate(given);
2288
+ }
2279
2289
  built[name] = given;
2280
2290
  }
2281
2291
  return built;
2282
2292
  }
2283
- function checkAttrs(attrs, values, type, name) {
2284
- for (let attr in values)
2285
- if (!(attr in attrs))
2286
- throw new RangeError(`Unsupported attribute ${attr} for ${type} of type ${name}`);
2287
- for (let attr in attrs) {
2288
- if (attrs[attr].validate)
2289
- attrs[attr].validate(values[attr]);
2290
- }
2291
- }
2292
2293
  function initAttrs(typeName, attrs) {
2293
2294
  let result = Object.create(null);
2294
2295
  if (attrs)
@@ -2460,11 +2461,9 @@ let NodeType$1 = class NodeType {
2460
2461
  throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);
2461
2462
  }
2462
2463
  /**
2463
- @internal
2464
+ @internal no longer useful, but called by old prosemirror-view versions
2464
2465
  */
2465
- checkAttrs(attrs) {
2466
- checkAttrs(this.attrs, attrs, "node", this.name);
2467
- }
2466
+ checkAttrs(attrs) { }
2468
2467
  /**
2469
2468
  Check whether the given mark type is allowed in this node.
2470
2469
  */
@@ -2611,12 +2610,6 @@ class MarkType {
2611
2610
  return set[i];
2612
2611
  }
2613
2612
  /**
2614
- @internal
2615
- */
2616
- checkAttrs(attrs) {
2617
- checkAttrs(this.attrs, attrs, "mark", this.name);
2618
- }
2619
- /**
2620
2613
  Queries whether a given mark type is
2621
2614
  [excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.
2622
2615
  */
@@ -9308,7 +9301,8 @@ function nodeLen(node) {
9308
9301
  }
9309
9302
  function isIgnorable(dom, dir) {
9310
9303
  let desc = dom.pmViewDesc;
9311
- return desc && desc.size == 0 && (dir < 0 || dom.nextSibling || dom.nodeName != "BR");
9304
+ return desc ? desc.size == 0 && (dir < 0 || dom.nextSibling || dom.nodeName != "BR")
9305
+ : dom.nodeType == 1 && dom.contentEditable == "false";
9312
9306
  }
9313
9307
  function skipIgnoredNodes(view, dir) {
9314
9308
  return dir < 0 ? skipIgnoredNodesBefore(view) : skipIgnoredNodesAfter(view);
@@ -9897,12 +9891,11 @@ function addContext(slice, context) {
9897
9891
  if (!type || type.hasRequiredAttrs())
9898
9892
  break;
9899
9893
  try {
9900
- type.checkAttrs(array[i + 1]);
9894
+ content = Fragment.from(type.create(array[i + 1], content));
9901
9895
  }
9902
9896
  catch (e) {
9903
9897
  break;
9904
9898
  }
9905
- content = Fragment.from(type.create(array[i + 1], content));
9906
9899
  openStart++;
9907
9900
  openEnd++;
9908
9901
  }
@@ -10382,7 +10375,7 @@ editHandlers.compositionstart = editHandlers.compositionupdate = view => {
10382
10375
  if (!view.composing) {
10383
10376
  view.domObserver.flush();
10384
10377
  let { state } = view, $pos = state.selection.$to;
10385
- if (state.selection instanceof TextSelection &&
10378
+ if (state.selection instanceof TextSelection && state.selection.empty &&
10386
10379
  (state.storedMarks ||
10387
10380
  (!$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some(m => m.type.spec.inclusive === false)) ||
10388
10381
  chrome && windows$1 && selectionBeforeUneditable(view))) { // Issue #1500
@@ -12019,9 +12012,7 @@ function readDOMChange(view, from, to, typeOver, addedNodes) {
12019
12012
  // as being an iOS enter press), just dispatch an Enter key instead.
12020
12013
  if (((ios && view.input.lastIOSEnter > Date.now() - 225 &&
12021
12014
  (!inlineChange || addedNodes.some(n => n.nodeName == "DIV" || n.nodeName == "P"))) ||
12022
- (!inlineChange && $from.pos < parse.doc.content.size &&
12023
- (!$from.sameParent($to) || !$from.parent.inlineContent) &&
12024
- $from.pos < $to.pos && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", "")))) &&
12015
+ (!inlineChange && looksLikeEnter(parse.doc, $from.pos, $to.pos))) &&
12025
12016
  view.someProp("handleKeyDown", f => f(view, keyEvent(13, "Enter")))) {
12026
12017
  view.input.lastIOSEnter = 0;
12027
12018
  return;
@@ -12172,6 +12163,16 @@ function looksLikeBackspace(old, start, end, $newStart, $newEnd) {
12172
12163
  // The fragments after the join point must match
12173
12164
  return $newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content);
12174
12165
  }
12166
+ function looksLikeEnter(content, from, to) {
12167
+ let newTextlines = 0, newLeaves = 0;
12168
+ content.nodesBetween(from, to, (node, pos) => {
12169
+ if (node.isTextblock && pos >= from && pos < to)
12170
+ newTextlines++;
12171
+ else if (node.isText ? /\S/.test(node.text.slice(Math.max(0, from - pos), Math.min(node.nodeSize, to - pos))) : node.isLeaf)
12172
+ newLeaves++;
12173
+ });
12174
+ return newLeaves == 0 && newTextlines == 1;
12175
+ }
12175
12176
  function skipClosingAndOpening($pos, fromEnd, mayOpen) {
12176
12177
  let depth = $pos.depth, end = fromEnd ? $pos.end() : $pos.pos;
12177
12178
  while (depth > 0 && (fromEnd || $pos.indexAfter(depth) == $pos.node(depth).childCount)) {
@@ -1,4 +1,4 @@
1
- import { b as KritzelIcon$1, a as defineCustomElement$1 } from './p-BIUT0gBe.js';
1
+ import { b as KritzelIcon$1, a as defineCustomElement$1 } from './p-NAEiq8CK.js';
2
2
 
3
3
  const KritzelIcon = KritzelIcon$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { b as KritzelWatermark$1, d as defineCustomElement$1 } from './p-Bnuu1qip.js';
1
+ import { b as KritzelWatermark$1, d as defineCustomElement$1 } from './p-BHVbfJrf.js';
2
2
 
3
3
  const KritzelWatermark = KritzelWatermark$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { p as proxyCustomElement, H, h, d as Host, t as transformTag } from './p-CJ5B8cMK.js';
1
+ import { p as proxyCustomElement, H, h, d as Host, t as transformTag } from './p-BWfRbEIq.js';
2
2
 
3
3
  const ABSOLUTE_SCALE_MAX = 1000;
4
4
  const ABSOLUTE_SCALE_MIN = 0.0001;
@@ -1,4 +1,4 @@
1
- import { p as proxyCustomElement, H, h, d as Host, t as transformTag } from './p-CJ5B8cMK.js';
1
+ import { p as proxyCustomElement, H, h, d as Host, t as transformTag } from './p-BWfRbEIq.js';
2
2
 
3
3
  var KritzelMouseButton;
4
4
  (function (KritzelMouseButton) {
@@ -2,7 +2,7 @@ const NAMESPACE = 'stencil';
2
2
  const BUILD = /* stencil */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: false, state: true, updatable: true};
3
3
 
4
4
  /*
5
- Stencil Client Platform v4.44.2 | MIT Licensed | https://stenciljs.com
5
+ Stencil Client Platform v4.45.1 | MIT Licensed | https://stenciljs.com
6
6
  */
7
7
 
8
8
 
@@ -782,7 +782,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
782
782
  if (idxInOld >= 0) {
783
783
  elmToMove = oldCh[idxInOld];
784
784
  if (elmToMove.$tag$ !== newStartVnode.$tag$) {
785
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
785
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
786
786
  } else {
787
787
  patch(elmToMove, newStartVnode, isInitialRender);
788
788
  oldCh[idxInOld] = void 0;
@@ -1220,8 +1220,9 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1220
1220
  if (isBooleanTarget) {
1221
1221
  newValue = newValue === null || newValue === "false" ? false : true;
1222
1222
  }
1223
+ const currentValue = this[propName];
1223
1224
  const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
1224
- if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) {
1225
+ if (!isSpuriousBooleanRemoval && newValue != currentValue && (!propDesc.get || !!propDesc.set)) {
1225
1226
  this[propName] = newValue;
1226
1227
  }
1227
1228
  });
@@ -1,4 +1,4 @@
1
- import { p as proxyCustomElement, H, f as forceUpdate, h, d as Host, t as transformTag } from './p-CJ5B8cMK.js';
1
+ import { p as proxyCustomElement, H, f as forceUpdate, h, d as Host, t as transformTag } from './p-BWfRbEIq.js';
2
2
 
3
3
  const KRITZEL_ICON_REGISTRY_KEY = '__kritzelIconRegistry__';
4
4
  const getGlobalRegistryStore = () => {
@@ -1,4 +1,4 @@
1
- import { p as proxyCustomElement, t as transformTag, H, h, d as Host } from './p-CJ5B8cMK.js';
1
+ import { p as proxyCustomElement, t as transformTag, H, h, d as Host } from './p-BWfRbEIq.js';
2
2
 
3
3
  class ObjectHelper {
4
4
  static generateUUID(length = 16) {