@vaadin/split-layout 23.4.0-alpha2 → 23.4.0-alpha3

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": "23.4.0-alpha2",
3
+ "version": "23.4.0-alpha3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,10 +36,10 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@polymer/polymer": "^3.0.0",
39
- "@vaadin/component-base": "23.4.0-alpha2",
40
- "@vaadin/vaadin-lumo-styles": "23.4.0-alpha2",
41
- "@vaadin/vaadin-material-styles": "23.4.0-alpha2",
42
- "@vaadin/vaadin-themable-mixin": "23.4.0-alpha2"
39
+ "@vaadin/component-base": "23.4.0-alpha3",
40
+ "@vaadin/vaadin-lumo-styles": "23.4.0-alpha3",
41
+ "@vaadin/vaadin-material-styles": "23.4.0-alpha3",
42
+ "@vaadin/vaadin-themable-mixin": "23.4.0-alpha3"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@esm-bundle/chai": "^4.3.4",
@@ -50,5 +50,5 @@
50
50
  "web-types.json",
51
51
  "web-types.lit.json"
52
52
  ],
53
- "gitHead": "3fa9a5d13db6baf0307f863669ab2f3f5114c6a0"
53
+ "gitHead": "2336e451b1971dfb2dc4b601e11d05cafdb91516"
54
54
  }
@@ -258,17 +258,38 @@ class SplitLayout extends ElementMixin(ThemableMixin(PolymerElement)) {
258
258
 
259
259
  /** @private */
260
260
  _processChildren() {
261
- [...this.children].forEach((child, i) => {
262
- if (i === 0) {
263
- this._primaryChild = child;
264
- child.setAttribute('slot', 'primary');
265
- } else if (i === 1) {
266
- this._secondaryChild = child;
267
- child.setAttribute('slot', 'secondary');
268
- } else {
269
- child.removeAttribute('slot');
270
- }
271
- });
261
+ const children = [...this.children];
262
+
263
+ children.filter((child) => child.hasAttribute('slot')).forEach((child) => this._processChildWithSlot(child));
264
+
265
+ children
266
+ .filter((child) => !child.hasAttribute('slot'))
267
+ .forEach((child, i) => this._processChildWithoutSlot(child, i));
268
+ }
269
+
270
+ /** @private */
271
+ _processChildWithSlot(child) {
272
+ const slot = child.getAttribute('slot');
273
+ if (child.__autoSlotted) {
274
+ this[`_${slot}Child`] = null;
275
+ child.removeAttribute('slot');
276
+ } else {
277
+ this[`_${slot}Child`] = child;
278
+ }
279
+ }
280
+
281
+ /** @private */
282
+ _processChildWithoutSlot(child, idx) {
283
+ let slotName;
284
+ if (this._primaryChild || this._secondaryChild) {
285
+ slotName = this._primaryChild ? 'secondary' : 'primary';
286
+ } else {
287
+ slotName = idx === 0 ? 'primary' : 'secondary';
288
+ }
289
+
290
+ this[`_${slotName}Child`] = child;
291
+ child.setAttribute('slot', slotName);
292
+ child.__autoSlotted = true;
272
293
  }
273
294
 
274
295
  /** @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": "23.4.0-alpha2",
4
+ "version": "23.4.0-alpha3",
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": "23.4.0-alpha2",
4
+ "version": "23.4.0-alpha3",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {