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

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.
@@ -31,7 +31,10 @@ class Adapter extends DomAdapter {
31
31
  isRoot = false;
32
32
  }
33
33
  onUpdated(() => {
34
- this.componentRendingStack.pop();
34
+ const context = this.componentRendingStack[this.componentRendingStack.length - 1];
35
+ if (context === component) {
36
+ this.componentRendingStack.pop();
37
+ }
35
38
  textbusComponent.changeMarker.rendered();
36
39
  if (!this.componentRootElementCaches.get(textbusComponent)) {
37
40
  // eslint-disable-next-line max-len
@@ -77,8 +80,15 @@ class Adapter extends DomAdapter {
77
80
  throw adapterError(`cannot found view component \`${component.name}\`!`);
78
81
  }
79
82
  slotRender(slot, slotHostRender, renderEnv) {
83
+ var _a;
80
84
  const context = this.componentRendingStack[this.componentRendingStack.length - 1];
81
- context.__slots__.push(slot);
85
+ if (context) {
86
+ context.__slots__.push(slot);
87
+ }
88
+ else if (!this.renderedSlotCache.has(slot)) {
89
+ throw adapterError(`Unrendered slots must be rendered together with the corresponding "${((_a = slot.parent) === null || _a === void 0 ? void 0 : _a.name) || 'unknown'}" component`);
90
+ }
91
+ this.renderedSlotCache.set(slot, true);
82
92
  const vElement = slot.toTree(slotHostRender, renderEnv);
83
93
  this.slotRootVElementCaches.set(slot, vElement);
84
94
  const vNodeToJSX = (vNode) => {
package/bundles/index.js CHANGED
@@ -33,7 +33,10 @@ class Adapter extends platformBrowser.DomAdapter {
33
33
  isRoot = false;
34
34
  }
35
35
  core$1.onUpdated(() => {
36
- this.componentRendingStack.pop();
36
+ const context = this.componentRendingStack[this.componentRendingStack.length - 1];
37
+ if (context === component) {
38
+ this.componentRendingStack.pop();
39
+ }
37
40
  textbusComponent.changeMarker.rendered();
38
41
  if (!this.componentRootElementCaches.get(textbusComponent)) {
39
42
  // eslint-disable-next-line max-len
@@ -79,8 +82,15 @@ class Adapter extends platformBrowser.DomAdapter {
79
82
  throw adapterError(`cannot found view component \`${component.name}\`!`);
80
83
  }
81
84
  slotRender(slot, slotHostRender, renderEnv) {
85
+ var _a;
82
86
  const context = this.componentRendingStack[this.componentRendingStack.length - 1];
83
- context.__slots__.push(slot);
87
+ if (context) {
88
+ context.__slots__.push(slot);
89
+ }
90
+ else if (!this.renderedSlotCache.has(slot)) {
91
+ throw adapterError(`Unrendered slots must be rendered together with the corresponding "${((_a = slot.parent) === null || _a === void 0 ? void 0 : _a.name) || 'unknown'}" component`);
92
+ }
93
+ this.renderedSlotCache.set(slot, true);
84
94
  const vElement = slot.toTree(slotHostRender, renderEnv);
85
95
  this.slotRootVElementCaches.set(slot, vElement);
86
96
  const vNodeToJSX = (vNode) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/adapter-viewfly",
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
  "@viewfly/core": "^0.6.3"
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
  }