@vaadin/split-layout 24.3.0 → 24.4.0-alpha1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/split-layout",
3
- "version": "24.3.0",
3
+ "version": "24.4.0-alpha1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -39,10 +39,10 @@
39
39
  "dependencies": {
40
40
  "@open-wc/dedupe-mixin": "^1.3.0",
41
41
  "@polymer/polymer": "^3.0.0",
42
- "@vaadin/component-base": "~24.3.0",
43
- "@vaadin/vaadin-lumo-styles": "~24.3.0",
44
- "@vaadin/vaadin-material-styles": "~24.3.0",
45
- "@vaadin/vaadin-themable-mixin": "~24.3.0"
42
+ "@vaadin/component-base": "24.4.0-alpha1",
43
+ "@vaadin/vaadin-lumo-styles": "24.4.0-alpha1",
44
+ "@vaadin/vaadin-material-styles": "24.4.0-alpha1",
45
+ "@vaadin/vaadin-themable-mixin": "24.4.0-alpha1"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@esm-bundle/chai": "^4.3.4",
@@ -53,5 +53,5 @@
53
53
  "web-types.json",
54
54
  "web-types.lit.json"
55
55
  ],
56
- "gitHead": "713c37a239d9230774eddc10436c7587a1de09d1"
56
+ "gitHead": "3e2ed41c99d618ff7def2734fd863c21c85775a3"
57
57
  }
@@ -63,17 +63,38 @@ export const SplitLayoutMixin = (superClass) =>
63
63
 
64
64
  /** @private */
65
65
  _processChildren() {
66
- [...this.children].forEach((child, i) => {
67
- if (i === 0) {
68
- this._primaryChild = child;
69
- child.setAttribute('slot', 'primary');
70
- } else if (i === 1) {
71
- this._secondaryChild = child;
72
- child.setAttribute('slot', 'secondary');
73
- } else {
74
- child.removeAttribute('slot');
75
- }
76
- });
66
+ const children = [...this.children];
67
+
68
+ children.filter((child) => child.hasAttribute('slot')).forEach((child) => this._processChildWithSlot(child));
69
+
70
+ children
71
+ .filter((child) => !child.hasAttribute('slot'))
72
+ .forEach((child, i) => this._processChildWithoutSlot(child, i));
73
+ }
74
+
75
+ /** @private */
76
+ _processChildWithSlot(child) {
77
+ const slot = child.getAttribute('slot');
78
+ if (child.__autoSlotted) {
79
+ this[`_${slot}Child`] = null;
80
+ child.removeAttribute('slot');
81
+ } else {
82
+ this[`_${slot}Child`] = child;
83
+ }
84
+ }
85
+
86
+ /** @private */
87
+ _processChildWithoutSlot(child, idx) {
88
+ let slotName;
89
+ if (this._primaryChild || this._secondaryChild) {
90
+ slotName = this._primaryChild ? 'secondary' : 'primary';
91
+ } else {
92
+ slotName = idx === 0 ? 'primary' : 'secondary';
93
+ }
94
+
95
+ this[`_${slotName}Child`] = child;
96
+ child.setAttribute('slot', slotName);
97
+ child.__autoSlotted = true;
77
98
  }
78
99
 
79
100
  /** @private */
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/split-layout",
4
- "version": "24.3.0",
4
+ "version": "24.4.0-alpha1",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/split-layout",
4
- "version": "24.3.0",
4
+ "version": "24.4.0-alpha1",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {