@vaadin/component-base 24.7.0-alpha1 → 24.7.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/component-base",
3
- "version": "24.7.0-alpha1",
3
+ "version": "24.7.0-alpha3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,9 +38,9 @@
38
38
  "lit": "^3.0.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@vaadin/chai-plugins": "24.7.0-alpha1",
42
- "@vaadin/testing-helpers": "^1.0.0",
41
+ "@vaadin/chai-plugins": "24.7.0-alpha3",
42
+ "@vaadin/testing-helpers": "^1.1.0",
43
43
  "sinon": "^18.0.0"
44
44
  },
45
- "gitHead": "04be941c9a7b659871c97f31b9cc3ffd7528087b"
45
+ "gitHead": "dd5cfad6c9b54e676f5b10dffba2233775378f40"
46
46
  }
package/src/define.js CHANGED
@@ -13,7 +13,7 @@ function dashToCamelCase(dash) {
13
13
 
14
14
  const experimentalMap = {};
15
15
 
16
- export function defineCustomElement(CustomElement, version = '24.7.0-alpha1') {
16
+ export function defineCustomElement(CustomElement, version = '24.7.0-alpha3') {
17
17
  Object.defineProperty(CustomElement, 'version', {
18
18
  get() {
19
19
  return version;
@@ -4,6 +4,7 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { dedupeMixin } from '@open-wc/dedupe-mixin';
7
+ import { notEqual } from 'lit';
7
8
  import { get, set } from './path-utils.js';
8
9
 
9
10
  const caseMap = {};
@@ -101,12 +102,15 @@ const PolylitMixinImplementation = (superclass) => {
101
102
  get: defaultDescriptor.get,
102
103
  set(value) {
103
104
  const oldValue = this[name];
104
- this[key] = value;
105
- this.requestUpdate(name, oldValue, options);
106
105
 
107
- // Enforce synchronous update
108
- if (this.hasUpdated) {
109
- this.performUpdate();
106
+ if (notEqual(value, oldValue)) {
107
+ this[key] = value;
108
+ this.requestUpdate(name, oldValue, options);
109
+
110
+ // Enforce synchronous update
111
+ if (this.hasUpdated) {
112
+ this.performUpdate();
113
+ }
110
114
  }
111
115
  },
112
116
  configurable: true,
@@ -115,21 +119,17 @@ const PolylitMixinImplementation = (superclass) => {
115
119
  }
116
120
 
117
121
  if (options.readOnly) {
118
- const setter = defaultDescriptor.set;
122
+ const setter = result.set;
119
123
 
120
124
  this.addCheckedInitializer((instance) => {
121
125
  // This is run during construction of the element
122
126
  instance[`_set${upper(name)}`] = function (value) {
123
127
  setter.call(instance, value);
124
-
125
- if (options.sync) {
126
- this.performUpdate();
127
- }
128
128
  };
129
129
  });
130
130
 
131
131
  result = {
132
- get: defaultDescriptor.get,
132
+ get: result.get,
133
133
  set() {
134
134
  // Do nothing, property is read-only.
135
135
  },
@@ -195,6 +195,12 @@ const PolylitMixinImplementation = (superclass) => {
195
195
  return result;
196
196
  }
197
197
 
198
+ static get polylitConfig() {
199
+ return {
200
+ asyncFirstRender: false,
201
+ };
202
+ }
203
+
198
204
  constructor() {
199
205
  super();
200
206
  this.__hasPolylitMixin = true;
@@ -214,6 +220,11 @@ const PolylitMixinImplementation = (superclass) => {
214
220
  parentHost.$ ||= {};
215
221
  parentHost.$[this.id] = this;
216
222
  }
223
+
224
+ const { polylitConfig } = this.constructor;
225
+ if (!this.hasUpdated && !polylitConfig.asyncFirstRender) {
226
+ this.performUpdate();
227
+ }
217
228
  }
218
229
 
219
230
  /** @protected */
@@ -8,6 +8,10 @@ import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
8
8
  const observer = new ResizeObserver((entries) => {
9
9
  setTimeout(() => {
10
10
  entries.forEach((entry) => {
11
+ if (!entry.target.isConnected) {
12
+ return;
13
+ }
14
+
11
15
  // Notify child resizables, if any
12
16
  if (entry.target.resizables) {
13
17
  entry.target.resizables.forEach((resizable) => {