@chialab/pdfjs-lib 1.0.0-alpha.22 → 1.0.0-alpha.23

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.
@@ -25147,7 +25147,7 @@ var SvgCanvasContext = class {
25147
25147
  __publicField(this, "_transformMatrixStack", []);
25148
25148
  __publicField(this, "_root");
25149
25149
  __publicField(this, "_defs");
25150
- __publicField(this, "_currentGroup");
25150
+ __publicField(this, "_currentGroup", null);
25151
25151
  __publicField(this, "_currentElement", null);
25152
25152
  __publicField(this, "_currentMarked", null);
25153
25153
  __publicField(this, "_transformMatrix", new DOMMatrix([1, 0, 0, 1, 0, 0]));
@@ -25284,7 +25284,7 @@ var SvgCanvasContext = class {
25284
25284
  this._root.attrs.height = height;
25285
25285
  }
25286
25286
  save() {
25287
- this._groupStack.push(this._currentGroup);
25287
+ this._groupStack.push(this._currentGroup ?? this._root);
25288
25288
  this._currentGroup = this._ensureTransformationGroup();
25289
25289
  this._styleStack.push(this._getStyleState());
25290
25290
  this._transformMatrixStack.push(this.getTransform());
@@ -25756,10 +25756,10 @@ var SvgCanvasContext = class {
25756
25756
  return;
25757
25757
  }
25758
25758
  if (!this._currentMarked) {
25759
- this._addNode(node, this._currentGroup);
25759
+ this._addNode(node, this._currentGroup ?? this._root);
25760
25760
  return;
25761
25761
  }
25762
- let group = this._currentGroup;
25762
+ let group = this._currentGroup ?? this._root;
25763
25763
  if (this._currentMarked.elements.length === 0) {
25764
25764
  const markedStackToAdd = [this._currentMarked];
25765
25765
  let i;
@@ -26000,17 +26000,26 @@ var SvgCanvasContext = class {
26000
26000
  }
26001
26001
  _clearCanvas() {
26002
26002
  this._defs.children = [];
26003
- this._root.children = [this._defs];
26003
+ this._addNode(this._defs, this._root);
26004
26004
  this._currentGroup = this._root;
26005
26005
  this._groupStack = [];
26006
26006
  this._parents.clear();
26007
26007
  }
26008
26008
  destroy() {
26009
- this._clearCanvas();
26010
26009
  this.canvas.width = 0;
26011
26010
  this.canvas.height = 0;
26011
+ this._styleStack = [];
26012
+ this._groupStack = [];
26013
+ this._markedStack = [];
26014
+ this._transformMatrixStack = [];
26012
26015
  this._ctx = null;
26013
26016
  this._canvas = null;
26017
+ this._currentGroup = null;
26018
+ this._currentElement = null;
26019
+ this._currentMarked = null;
26020
+ this._currentPosition = {};
26021
+ this._transformMatrix = new DOMMatrix();
26022
+ this._parents.clear();
26014
26023
  }
26015
26024
  };
26016
26025
  async function createSvgContext(width, height) {
@@ -24191,7 +24191,7 @@ var SvgCanvasContext = class {
24191
24191
  __publicField(this, "_transformMatrixStack", []);
24192
24192
  __publicField(this, "_root");
24193
24193
  __publicField(this, "_defs");
24194
- __publicField(this, "_currentGroup");
24194
+ __publicField(this, "_currentGroup", null);
24195
24195
  __publicField(this, "_currentElement", null);
24196
24196
  __publicField(this, "_currentMarked", null);
24197
24197
  __publicField(this, "_transformMatrix", new DOMMatrix([1, 0, 0, 1, 0, 0]));
@@ -24328,7 +24328,7 @@ var SvgCanvasContext = class {
24328
24328
  this._root.attrs.height = height;
24329
24329
  }
24330
24330
  save() {
24331
- this._groupStack.push(this._currentGroup);
24331
+ this._groupStack.push(this._currentGroup ?? this._root);
24332
24332
  this._currentGroup = this._ensureTransformationGroup();
24333
24333
  this._styleStack.push(this._getStyleState());
24334
24334
  this._transformMatrixStack.push(this.getTransform());
@@ -24800,10 +24800,10 @@ var SvgCanvasContext = class {
24800
24800
  return;
24801
24801
  }
24802
24802
  if (!this._currentMarked) {
24803
- this._addNode(node, this._currentGroup);
24803
+ this._addNode(node, this._currentGroup ?? this._root);
24804
24804
  return;
24805
24805
  }
24806
- let group = this._currentGroup;
24806
+ let group = this._currentGroup ?? this._root;
24807
24807
  if (this._currentMarked.elements.length === 0) {
24808
24808
  const markedStackToAdd = [this._currentMarked];
24809
24809
  let i;
@@ -25044,17 +25044,26 @@ var SvgCanvasContext = class {
25044
25044
  }
25045
25045
  _clearCanvas() {
25046
25046
  this._defs.children = [];
25047
- this._root.children = [this._defs];
25047
+ this._addNode(this._defs, this._root);
25048
25048
  this._currentGroup = this._root;
25049
25049
  this._groupStack = [];
25050
25050
  this._parents.clear();
25051
25051
  }
25052
25052
  destroy() {
25053
- this._clearCanvas();
25054
25053
  this.canvas.width = 0;
25055
25054
  this.canvas.height = 0;
25055
+ this._styleStack = [];
25056
+ this._groupStack = [];
25057
+ this._markedStack = [];
25058
+ this._transformMatrixStack = [];
25056
25059
  this._ctx = null;
25057
25060
  this._canvas = null;
25061
+ this._currentGroup = null;
25062
+ this._currentElement = null;
25063
+ this._currentMarked = null;
25064
+ this._currentPosition = {};
25065
+ this._transformMatrix = new DOMMatrix();
25066
+ this._parents.clear();
25058
25067
  }
25059
25068
  };
25060
25069
  async function createSvgContext(width, height) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chialab/pdfjs-lib",
3
3
  "description": "A custom Mozilla's PDF.js build with better Node support and extras.",
4
- "version": "1.0.0-alpha.22",
4
+ "version": "1.0.0-alpha.23",
5
5
  "type": "module",
6
6
  "author": "Chialab <dev@chialab.it>",
7
7
  "license": "MIT",