@easy-editor/core 0.0.10 → 0.0.12
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/cjs/index.development.js +52 -37
- package/dist/cjs/index.development.js.map +1 -1
- package/dist/cjs/index.js +52 -37
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.production.js +52 -37
- package/dist/cjs/index.production.js.map +1 -1
- package/dist/document/document.d.ts +15 -4
- package/dist/esm/index.development.js +52 -37
- package/dist/esm/index.development.js.map +1 -1
- package/dist/esm/index.js +52 -37
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.production.js +52 -37
- package/dist/esm/index.production.js.map +1 -1
- package/dist/index.js +52 -37
- package/dist/simulator/simulator.d.ts +1 -0
- package/package.json +1 -1
|
@@ -6909,9 +6909,6 @@ class NodeChildren {
|
|
|
6909
6909
|
if (i === index) {
|
|
6910
6910
|
return;
|
|
6911
6911
|
}
|
|
6912
|
-
if (index === i) {
|
|
6913
|
-
return;
|
|
6914
|
-
}
|
|
6915
6912
|
children.splice(index, 1);
|
|
6916
6913
|
children.splice(i, 0, node);
|
|
6917
6914
|
}
|
|
@@ -7387,7 +7384,7 @@ let Node$1 = class Node {
|
|
|
7387
7384
|
return false;
|
|
7388
7385
|
}
|
|
7389
7386
|
insert(node, ref, useMutator = true) {
|
|
7390
|
-
if (ref && typeof ref === 'number') {
|
|
7387
|
+
if (ref !== undefined && typeof ref === 'number') {
|
|
7391
7388
|
const nodeInstance = ensureNode(node, this.document);
|
|
7392
7389
|
this.children?.internalInsert(nodeInstance, ref, useMutator);
|
|
7393
7390
|
} else {
|
|
@@ -7666,7 +7663,7 @@ const ensureNode = (node, document) => {
|
|
|
7666
7663
|
return nodeInstance;
|
|
7667
7664
|
};
|
|
7668
7665
|
|
|
7669
|
-
let _initProto$c, _init__opened, _init_extra__opened, _init_nodes, _init_extra_nodes, _init__dropLocation, _init_extra__dropLocation;
|
|
7666
|
+
let _initProto$c, _init__opened, _init_extra__opened, _init__suspended, _init_extra__suspended, _init_nodes, _init_extra_nodes, _init__dropLocation, _init_extra__dropLocation;
|
|
7670
7667
|
let DOCUMENT_EVENT = /*#__PURE__*/function (DOCUMENT_EVENT) {
|
|
7671
7668
|
DOCUMENT_EVENT["ADD"] = "document:add";
|
|
7672
7669
|
DOCUMENT_EVENT["REMOVE"] = "document:remove";
|
|
@@ -7676,7 +7673,7 @@ let DOCUMENT_EVENT = /*#__PURE__*/function (DOCUMENT_EVENT) {
|
|
|
7676
7673
|
}({});
|
|
7677
7674
|
class Document {
|
|
7678
7675
|
static {
|
|
7679
|
-
[_init__opened, _init_extra__opened, _init_nodes, _init_extra_nodes, _init__dropLocation, _init_extra__dropLocation, _initProto$c] = _applyDecs2311(this, [], [[[observable, observable.ref], 17, "_opened"], [[observable, observable.shallow], 17, "nodes"], [[observable, observable.ref], 17, "_dropLocation"], [action, 4, "dropLocation"], [action, 2, "import"], [action, 2, "remove"], [action, 2, "purge"], [action, 2, "createNode"], [action, 2, "internalRemoveNode"], [action, 2, "unlinkNode"], [action, 2, "
|
|
7676
|
+
[_init__opened, _init_extra__opened, _init__suspended, _init_extra__suspended, _init_nodes, _init_extra_nodes, _init__dropLocation, _init_extra__dropLocation, _initProto$c] = _applyDecs2311(this, [], [[[observable, observable.ref], 17, "_opened"], [[observable, observable.ref], 17, "_suspended"], [[observable, observable.shallow], 17, "nodes"], [[observable, observable.ref], 17, "_dropLocation"], [action, 4, "dropLocation"], [action, 2, "import"], [action, 2, "remove"], [action, 2, "purge"], [action, 2, "createNode"], [action, 2, "internalRemoveNode"], [action, 2, "unlinkNode"], [action, 2, "setSuspense"], [action, 2, "open"], [action, 2, "close"]]).e;
|
|
7680
7677
|
}
|
|
7681
7678
|
isDocument = (_initProto$c(this), true);
|
|
7682
7679
|
emitter = createEventBus('Document');
|
|
@@ -7687,7 +7684,20 @@ class Document {
|
|
|
7687
7684
|
set _opened(v) {
|
|
7688
7685
|
this.#A = v;
|
|
7689
7686
|
}
|
|
7690
|
-
|
|
7687
|
+
#B = (_init_extra__opened(this), _init__suspended(this, false));
|
|
7688
|
+
get _suspended() {
|
|
7689
|
+
return this.#B;
|
|
7690
|
+
}
|
|
7691
|
+
set _suspended(v) {
|
|
7692
|
+
this.#B = v;
|
|
7693
|
+
}
|
|
7694
|
+
get suspended() {
|
|
7695
|
+
return this._suspended || !this._opened;
|
|
7696
|
+
}
|
|
7697
|
+
get active() {
|
|
7698
|
+
return !this.suspended;
|
|
7699
|
+
}
|
|
7700
|
+
_blank = (_init_extra__suspended(this), true);
|
|
7691
7701
|
rootNode = null;
|
|
7692
7702
|
get root() {
|
|
7693
7703
|
return this.rootNode;
|
|
@@ -7708,12 +7718,12 @@ class Document {
|
|
|
7708
7718
|
set fileName(fileName) {
|
|
7709
7719
|
this.rootNode?.getExtraProp('fileName', true)?.setValue(fileName);
|
|
7710
7720
|
}
|
|
7711
|
-
#
|
|
7721
|
+
#C = _init_nodes(this, new Set());
|
|
7712
7722
|
get nodes() {
|
|
7713
|
-
return this.#
|
|
7723
|
+
return this.#C;
|
|
7714
7724
|
}
|
|
7715
7725
|
set nodes(v) {
|
|
7716
|
-
this.#
|
|
7726
|
+
this.#C = v;
|
|
7717
7727
|
}
|
|
7718
7728
|
get opened() {
|
|
7719
7729
|
return this._opened;
|
|
@@ -7725,12 +7735,12 @@ class Document {
|
|
|
7725
7735
|
getHistory() {
|
|
7726
7736
|
return this.history;
|
|
7727
7737
|
}
|
|
7728
|
-
#
|
|
7738
|
+
#D = _init__dropLocation(this, null);
|
|
7729
7739
|
get _dropLocation() {
|
|
7730
|
-
return this.#
|
|
7740
|
+
return this.#D;
|
|
7731
7741
|
}
|
|
7732
7742
|
set _dropLocation(v) {
|
|
7733
|
-
this.#
|
|
7743
|
+
this.#D = v;
|
|
7734
7744
|
}
|
|
7735
7745
|
set dropLocation(loc) {
|
|
7736
7746
|
this._dropLocation = loc;
|
|
@@ -7867,38 +7877,39 @@ class Document {
|
|
|
7867
7877
|
insertNodes(parent, nodes, at, copy) {
|
|
7868
7878
|
return insertChildren(parent, nodes, at, copy);
|
|
7869
7879
|
}
|
|
7880
|
+
setSuspense(flag) {
|
|
7881
|
+
if (!this._opened && !flag) {
|
|
7882
|
+
return;
|
|
7883
|
+
}
|
|
7884
|
+
this._suspended = flag;
|
|
7885
|
+
this.simulator?.setSuspense(flag);
|
|
7886
|
+
if (!flag) {
|
|
7887
|
+
this.project.checkExclusive(this);
|
|
7888
|
+
}
|
|
7889
|
+
}
|
|
7890
|
+
suspense() {
|
|
7891
|
+
this.setSuspense(true);
|
|
7892
|
+
}
|
|
7893
|
+
activate() {
|
|
7894
|
+
this.setSuspense(false);
|
|
7895
|
+
}
|
|
7870
7896
|
open() {
|
|
7871
7897
|
const originState = this._opened;
|
|
7872
7898
|
this._opened = true;
|
|
7873
7899
|
if (originState === false) {
|
|
7874
7900
|
this.designer.postEvent(DOCUMENT_EVENT.OPEN, this);
|
|
7875
7901
|
}
|
|
7876
|
-
if (this.
|
|
7877
|
-
this.
|
|
7902
|
+
if (this._suspended) {
|
|
7903
|
+
this.setSuspense(false);
|
|
7878
7904
|
} else {
|
|
7879
|
-
this.
|
|
7905
|
+
this.project.checkExclusive(this);
|
|
7880
7906
|
}
|
|
7881
7907
|
return this;
|
|
7882
7908
|
}
|
|
7883
7909
|
close() {
|
|
7884
|
-
this.
|
|
7910
|
+
this.setSuspense(true);
|
|
7885
7911
|
this._opened = false;
|
|
7886
7912
|
}
|
|
7887
|
-
setOpened(flag) {
|
|
7888
|
-
if (!this._opened && !flag) {
|
|
7889
|
-
return;
|
|
7890
|
-
}
|
|
7891
|
-
this._opened = flag;
|
|
7892
|
-
if (!flag) {
|
|
7893
|
-
this.project.checkExclusive(this);
|
|
7894
|
-
}
|
|
7895
|
-
}
|
|
7896
|
-
suspense() {
|
|
7897
|
-
this.setOpened(false);
|
|
7898
|
-
}
|
|
7899
|
-
activate() {
|
|
7900
|
-
this.setOpened(true);
|
|
7901
|
-
}
|
|
7902
7913
|
isModified() {
|
|
7903
7914
|
return this.history.isSavePoint();
|
|
7904
7915
|
}
|
|
@@ -7991,7 +8002,7 @@ class Project {
|
|
|
7991
8002
|
}
|
|
7992
8003
|
documentsMap = (_init_extra_documents(this), new Map());
|
|
7993
8004
|
get currentDocument() {
|
|
7994
|
-
return this.documents.find(document => document.
|
|
8005
|
+
return this.documents.find(document => document.active);
|
|
7995
8006
|
}
|
|
7996
8007
|
#B = _init__config(this);
|
|
7997
8008
|
get _config() {
|
|
@@ -8105,14 +8116,15 @@ class Project {
|
|
|
8105
8116
|
}
|
|
8106
8117
|
return this.createDocument().open();
|
|
8107
8118
|
}
|
|
8108
|
-
if (typeof idOrDoc === 'string') {
|
|
8109
|
-
const got = this.documents.find(
|
|
8119
|
+
if (typeof idOrDoc === 'string' || typeof idOrDoc === 'number') {
|
|
8120
|
+
const got = this.documents.find(item => item.fileName === String(idOrDoc) || String(item.id) === String(idOrDoc));
|
|
8110
8121
|
if (got) {
|
|
8111
8122
|
return got.open();
|
|
8112
8123
|
}
|
|
8113
|
-
const data = this.data.componentsTree.find(data => data.fileName === idOrDoc);
|
|
8124
|
+
const data = this.data.componentsTree.find(data => data.fileName === String(idOrDoc));
|
|
8114
8125
|
if (data) {
|
|
8115
|
-
|
|
8126
|
+
const doc = this.createDocument(data);
|
|
8127
|
+
return doc.open();
|
|
8116
8128
|
}
|
|
8117
8129
|
return null;
|
|
8118
8130
|
}
|
|
@@ -8564,6 +8576,9 @@ class Simulator {
|
|
|
8564
8576
|
data: snippet.schema
|
|
8565
8577
|
}));
|
|
8566
8578
|
}
|
|
8579
|
+
setSuspense(suspended) {
|
|
8580
|
+
return false;
|
|
8581
|
+
}
|
|
8567
8582
|
setupEvents() {
|
|
8568
8583
|
this.setupDragAndClick();
|
|
8569
8584
|
this.setupDetecting();
|