@nerd-bible/wordgard 0.6.2-beta10 → 0.6.2-beta11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/doc.d.ts CHANGED
@@ -2049,7 +2049,7 @@ declare class ChangeSet {
2049
2049
  */
2050
2050
  pad(before: number, after: number): ChangeSet;
2051
2051
  /**
2052
- Clip the set to only a sub-region. This can fail, if there are
2052
+ Clip the set to only a sub-region. This can fail if there are
2053
2053
  replacements across the region's sides, in which case the
2054
2054
  method returns null
2055
2055
  */
package/dist/doc.js CHANGED
@@ -2364,13 +2364,12 @@ class ChangeSet {
2364
2364
  for (let i = 0, pos = 0; i < this.sections.length && pos <= to;) {
2365
2365
  let value = this.data[i >> 1], len = this.sections[i++], ins = this.sections[i++];
2366
2366
  let end = pos + len;
2367
- if (ins > 0) {
2368
- if (pos >= from && end <= to)
2369
- addSection(sections, data, end - pos, ins, value);
2370
- else if (end > from && pos < from)
2371
- return null;
2367
+ if (pos >= from && end <= to) {
2368
+ addSection(sections, data, len, ins, value);
2372
2369
  }
2373
- else if (pos < to && end > from) {
2370
+ else if (end > from && pos < to) {
2371
+ if (ins >= 0)
2372
+ return null;
2374
2373
  addSection(sections, data, Math.min(end, to) - Math.max(pos, from), ins, value);
2375
2374
  }
2376
2375
  pos = end;
package/dist/editor.js CHANGED
@@ -2999,6 +2999,7 @@ const baseStyles = /*@__PURE__*/buildTheme("." + styleID, {
2999
2999
  ".wg-buffer": {
3000
3000
  verticalAlign: "bottom",
3001
3001
  height: "1em",
3002
+ display: "inline"
3002
3003
  },
3003
3004
  ".wg-blockBuffer": {
3004
3005
  position: "absolute"
@@ -7417,6 +7418,7 @@ const theme = /*@__PURE__*/Wordgard.styles({
7417
7418
  fill: "currentColor",
7418
7419
  width: "var(--wg-menu-item-size)",
7419
7420
  height: "var(--wg-menu-item-size)",
7421
+ display: "inline-block"
7420
7422
  },
7421
7423
  "wg-menu-spacer": {
7422
7424
  display: "block",
package/dist/schema.js CHANGED
@@ -809,7 +809,7 @@ function figure(conf = {}) {
809
809
  function imageResizing() {
810
810
  return [GardState.schemaElement.of(ImageSize), imageResizing.keyBindings, imageResizing.dragHandle];
811
811
  }
812
- const resizeTheme = /*@__PURE__*/Wordgard.theme({
812
+ const resizeStyle = /*@__PURE__*/Wordgard.styles({
813
813
  ".wg-resize-hover": {
814
814
  display: "inline-block",
815
815
  lineHeight: "0.1",
@@ -939,7 +939,7 @@ const resizeHandlers = /*@__PURE__*/(() => [
939
939
  GardState.prec.high(resizeHandlers),
940
940
  resizeState,
941
941
  Decoration.Point.source.of(s => s.field(resizeState).deco),
942
- resizeTheme
942
+ resizeStyle
943
943
  ];
944
944
  ;return imageResizing})(imageResizing);
945
945
  ;image = /*@__PURE__*/(function (image) {
package/dist/set.js CHANGED
@@ -137,6 +137,7 @@ let SetBuilder$1 = class SetBuilder {
137
137
  spilled = null;
138
138
  lastTo = -1;
139
139
  lastFrom = -1;
140
+ closed = false;
140
141
  get next() {
141
142
  return this.spilled || (this.spilled = new SetBuilder());
142
143
  }
@@ -147,6 +148,7 @@ let SetBuilder$1 = class SetBuilder {
147
148
  else {
148
149
  this.chunks.push(chunk);
149
150
  this.lastTo = chunk.end;
151
+ this.closed = true;
150
152
  }
151
153
  }
152
154
  add(source, pre) {
@@ -172,13 +174,14 @@ let SetBuilder$1 = class SetBuilder {
172
174
  }
173
175
  addInner(value, from, to) {
174
176
  let chunk;
175
- if (this.chunks.length) {
177
+ if (this.chunks.length && !this.closed) {
176
178
  chunk = this.chunks[this.chunks.length - 1];
177
179
  if (chunk.value.length >= 512)
178
180
  chunk = undefined;
179
181
  }
180
182
  if (!chunk) {
181
183
  this.chunks.push(chunk = new Chunk$1(from, [], [], []));
184
+ this.closed = false;
182
185
  }
183
186
  chunk.from.push(from - chunk.start);
184
187
  chunk.to.push(to - chunk.start);
@@ -470,10 +473,12 @@ class SetBuilder {
470
473
  chunks = [];
471
474
  lastPos = -1;
472
475
  lastSide = -1;
476
+ closed = false;
473
477
  addChunk(chunk) {
474
478
  this.chunks.push(chunk);
475
479
  this.lastPos = chunk.end;
476
480
  this.lastSide = chunk.endSide;
481
+ this.closed = true;
477
482
  }
478
483
  add(source, pre) {
479
484
  if (typeof source != "function") {
@@ -491,13 +496,15 @@ class SetBuilder {
491
496
  }
492
497
  addPoint(value, pos) {
493
498
  let chunk;
494
- if (this.chunks.length) {
499
+ let wasClosed = this.closed;
500
+ if (this.chunks.length && !wasClosed) {
495
501
  chunk = this.chunks[this.chunks.length - 1];
496
502
  if (chunk.value.length >= 512)
497
503
  chunk = undefined;
498
504
  }
499
505
  if (!chunk) {
500
506
  this.chunks.push(chunk = new Chunk(pos, [], []));
507
+ this.closed = false;
501
508
  }
502
509
  chunk.pos.push(pos - chunk.start);
503
510
  chunk.value.push(value);
@@ -512,6 +519,8 @@ class SetBuilder {
512
519
  if (!chunkI)
513
520
  break;
514
521
  nextChunk = this.chunks[--chunkI];
522
+ if (wasClosed)
523
+ nextChunk = this.chunks[chunkI] = new Chunk(nextChunk.start, nextChunk.pos.slice(), nextChunk.value.slice());
515
524
  nextI = nextChunk.value.length - 1;
516
525
  }
517
526
  if ((pos - nextChunk.pos[nextI] || value.side - nextChunk.value[nextI].side) >= 0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nerd-bible/wordgard",
3
- "version": "0.6.2-beta10",
3
+ "version": "0.6.2-beta11",
4
4
  "description": "Semantic rich text editor system",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",