@textbus/adapter-vue 4.0.0-alpha.36 → 4.0.0-alpha.38

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.
@@ -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)) {
@@ -54,6 +57,7 @@ class Adapter extends DomAdapter {
54
57
  const result = setup(props);
55
58
  if (typeof result === 'function') {
56
59
  return function () {
60
+ component.__slots__.forEach(i => self.renderedSlotCache.delete(i));
57
61
  component.__slots__.length = 0;
58
62
  self.componentRendingStack.push(component);
59
63
  return result();
@@ -89,8 +93,15 @@ class Adapter extends DomAdapter {
89
93
  throw adapterError(`cannot found view component \`${component.name}\`!`);
90
94
  }
91
95
  slotRender(slot, slotHostRender, renderEnv) {
96
+ var _a;
92
97
  const context = this.componentRendingStack[this.componentRendingStack.length - 1];
93
- context.__slots__.push(slot);
98
+ if (context) {
99
+ context.__slots__.push(slot);
100
+ }
101
+ else if (!this.renderedSlotCache.has(slot)) {
102
+ throw adapterError(`Unrendered slots must be rendered together with the corresponding "${((_a = slot.parent) === null || _a === void 0 ? void 0 : _a.name) || 'unknown'}" component`);
103
+ }
104
+ this.renderedSlotCache.set(slot, true);
94
105
  const vElement = slot.toTree(slotHostRender, renderEnv);
95
106
  this.slotRootVElementCaches.set(slot, vElement);
96
107
  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)) {
@@ -56,6 +59,7 @@ class Adapter extends platformBrowser.DomAdapter {
56
59
  const result = setup(props);
57
60
  if (typeof result === 'function') {
58
61
  return function () {
62
+ component.__slots__.forEach(i => self.renderedSlotCache.delete(i));
59
63
  component.__slots__.length = 0;
60
64
  self.componentRendingStack.push(component);
61
65
  return result();
@@ -91,8 +95,15 @@ class Adapter extends platformBrowser.DomAdapter {
91
95
  throw adapterError(`cannot found view component \`${component.name}\`!`);
92
96
  }
93
97
  slotRender(slot, slotHostRender, renderEnv) {
98
+ var _a;
94
99
  const context = this.componentRendingStack[this.componentRendingStack.length - 1];
95
- context.__slots__.push(slot);
100
+ if (context) {
101
+ context.__slots__.push(slot);
102
+ }
103
+ else if (!this.renderedSlotCache.has(slot)) {
104
+ throw adapterError(`Unrendered slots must be rendered together with the corresponding "${((_a = slot.parent) === null || _a === void 0 ? void 0 : _a.name) || 'unknown'}" component`);
105
+ }
106
+ this.renderedSlotCache.set(slot, true);
96
107
  const vElement = slot.toTree(slotHostRender, renderEnv);
97
108
  this.slotRootVElementCaches.set(slot, vElement);
98
109
  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.36",
3
+ "version": "4.0.0-alpha.38",
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.36",
30
- "@textbus/platform-browser": "^4.0.0-alpha.36",
29
+ "@textbus/core": "^4.0.0-alpha.38",
30
+ "@textbus/platform-browser": "^4.0.0-alpha.38",
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": "dbcf24938a558780bc752cdcd3633d0e21a7a0d9"
51
+ "gitHead": "6fd37c779309331bbe5ef1b93b2c3d0d47735636"
52
52
  }