@textbus/adapter-vue 4.0.0-alpha.35 → 4.0.0-alpha.37

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,7 +40,10 @@ class Adapter extends DomAdapter {
40
40
  });
41
41
  onUpdated(() => {
42
42
  var _a;
43
- self.componentRendingStack.pop();
43
+ const context = self.componentRendingStack[self.componentRendingStack.length - 1];
44
+ if (context === component) {
45
+ self.componentRendingStack.pop();
46
+ }
44
47
  component.changeMarker.rendered();
45
48
  self.onViewUpdated.next();
46
49
  if (!(((_a = self.componentRefs.get(component)) === null || _a === void 0 ? void 0 : _a.value) instanceof HTMLElement)) {
@@ -89,8 +92,15 @@ class Adapter extends DomAdapter {
89
92
  throw adapterError(`cannot found view component \`${component.name}\`!`);
90
93
  }
91
94
  slotRender(slot, slotHostRender, renderEnv) {
95
+ var _a;
92
96
  const context = this.componentRendingStack[this.componentRendingStack.length - 1];
93
- context.__slots__.push(slot);
97
+ if (context) {
98
+ context.__slots__.push(slot);
99
+ }
100
+ else if (!this.renderedSlotCache.has(slot)) {
101
+ throw adapterError(`Unrendered slots must be rendered together with the corresponding "${((_a = slot.parent) === null || _a === void 0 ? void 0 : _a.name) || 'unknown'}" component`);
102
+ }
103
+ this.renderedSlotCache.set(slot, true);
94
104
  const vElement = slot.toTree(slotHostRender, renderEnv);
95
105
  this.slotRootVElementCaches.set(slot, vElement);
96
106
  const vNodeToJSX = (vNode) => {
package/bundles/index.js CHANGED
@@ -42,7 +42,10 @@ class Adapter extends platformBrowser.DomAdapter {
42
42
  });
43
43
  vue.onUpdated(() => {
44
44
  var _a;
45
- self.componentRendingStack.pop();
45
+ const context = self.componentRendingStack[self.componentRendingStack.length - 1];
46
+ if (context === component) {
47
+ self.componentRendingStack.pop();
48
+ }
46
49
  component.changeMarker.rendered();
47
50
  self.onViewUpdated.next();
48
51
  if (!(((_a = self.componentRefs.get(component)) === null || _a === void 0 ? void 0 : _a.value) instanceof HTMLElement)) {
@@ -91,8 +94,15 @@ class Adapter extends platformBrowser.DomAdapter {
91
94
  throw adapterError(`cannot found view component \`${component.name}\`!`);
92
95
  }
93
96
  slotRender(slot, slotHostRender, renderEnv) {
97
+ var _a;
94
98
  const context = this.componentRendingStack[this.componentRendingStack.length - 1];
95
- context.__slots__.push(slot);
99
+ if (context) {
100
+ context.__slots__.push(slot);
101
+ }
102
+ else if (!this.renderedSlotCache.has(slot)) {
103
+ throw adapterError(`Unrendered slots must be rendered together with the corresponding "${((_a = slot.parent) === null || _a === void 0 ? void 0 : _a.name) || 'unknown'}" component`);
104
+ }
105
+ this.renderedSlotCache.set(slot, true);
96
106
  const vElement = slot.toTree(slotHostRender, renderEnv);
97
107
  this.slotRootVElementCaches.set(slot, vElement);
98
108
  const vNodeToJSX = (vNode) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/adapter-vue",
3
- "version": "4.0.0-alpha.35",
3
+ "version": "4.0.0-alpha.37",
4
4
  "description": "Textbus is a rich text editor and framework that is highly customizable and extensible to achieve rich wysiwyg effects.",
5
5
  "main": "./bundles/index.js",
6
6
  "module": "./bundles/index.esm.js",
@@ -26,8 +26,8 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "@tanbo/stream": "^1.2.3",
29
- "@textbus/core": "^4.0.0-alpha.35",
30
- "@textbus/platform-browser": "^4.0.0-alpha.35",
29
+ "@textbus/core": "^4.0.0-alpha.37",
30
+ "@textbus/platform-browser": "^4.0.0-alpha.37",
31
31
  "vue": "^3.3.4"
32
32
  },
33
33
  "devDependencies": {
@@ -48,5 +48,5 @@
48
48
  "bugs": {
49
49
  "url": "https://github.com/textbus/textbus.git/issues"
50
50
  },
51
- "gitHead": "a50ac82617ef249feadbe926bae178912ed9a310"
51
+ "gitHead": "7a67eda8ef99b52bbc356002ca3396d64b6c1e89"
52
52
  }