@vaadin/component-base 25.1.0-alpha5 → 25.1.0-alpha7

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.
@@ -0,0 +1,244 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/delegate-state-mixin.js",
8
+ "declarations": [
9
+ {
10
+ "kind": "variable",
11
+ "name": "DelegateStateMixin",
12
+ "description": "A mixin to delegate properties and attributes to a target element."
13
+ }
14
+ ],
15
+ "exports": [
16
+ {
17
+ "kind": "js",
18
+ "name": "DelegateStateMixin",
19
+ "declaration": {
20
+ "name": "DelegateStateMixin",
21
+ "module": "src/delegate-state-mixin.js"
22
+ }
23
+ }
24
+ ]
25
+ },
26
+ {
27
+ "kind": "javascript-module",
28
+ "path": "src/dir-mixin.js",
29
+ "declarations": [
30
+ {
31
+ "kind": "mixin",
32
+ "description": "A mixin to handle `dir` attribute based on the one set on the `<html>` element.",
33
+ "name": "DirMixin",
34
+ "members": [],
35
+ "attributes": [],
36
+ "parameters": [
37
+ {
38
+ "name": "superClass"
39
+ }
40
+ ]
41
+ }
42
+ ],
43
+ "exports": [
44
+ {
45
+ "kind": "js",
46
+ "name": "DirMixin",
47
+ "declaration": {
48
+ "name": "DirMixin",
49
+ "module": "src/dir-mixin.js"
50
+ }
51
+ }
52
+ ]
53
+ },
54
+ {
55
+ "kind": "javascript-module",
56
+ "path": "src/element-mixin.js",
57
+ "declarations": [
58
+ {
59
+ "kind": "mixin",
60
+ "description": "",
61
+ "name": "ElementMixin",
62
+ "members": [],
63
+ "mixins": [
64
+ {
65
+ "name": "DirMixin",
66
+ "module": "src/dir-mixin.js"
67
+ }
68
+ ],
69
+ "parameters": [
70
+ {
71
+ "name": "superClass"
72
+ }
73
+ ],
74
+ "attributes": []
75
+ }
76
+ ],
77
+ "exports": [
78
+ {
79
+ "kind": "js",
80
+ "name": "ElementMixin",
81
+ "declaration": {
82
+ "name": "ElementMixin",
83
+ "module": "src/element-mixin.js"
84
+ }
85
+ }
86
+ ]
87
+ },
88
+ {
89
+ "kind": "javascript-module",
90
+ "path": "src/i18n-mixin.js",
91
+ "declarations": [
92
+ {
93
+ "kind": "mixin",
94
+ "description": "A mixin that allows to set partial I18N properties.",
95
+ "name": "I18nMixin",
96
+ "members": [],
97
+ "attributes": [],
98
+ "parameters": [
99
+ {
100
+ "name": "defaultI18n"
101
+ },
102
+ {
103
+ "name": "superClass"
104
+ }
105
+ ]
106
+ }
107
+ ],
108
+ "exports": [
109
+ {
110
+ "kind": "js",
111
+ "name": "I18nMixin",
112
+ "declaration": {
113
+ "name": "I18nMixin",
114
+ "module": "src/i18n-mixin.js"
115
+ }
116
+ }
117
+ ]
118
+ },
119
+ {
120
+ "kind": "javascript-module",
121
+ "path": "src/overlay-class-mixin.js",
122
+ "declarations": [
123
+ {
124
+ "kind": "mixin",
125
+ "description": "A mixin that forwards CSS class names to the internal overlay element\nby setting the `overlayClass` property or `overlay-class` attribute.",
126
+ "name": "OverlayClassMixin",
127
+ "members": [
128
+ {
129
+ "kind": "field",
130
+ "name": "overlayClass",
131
+ "privacy": "public",
132
+ "type": {
133
+ "text": "string"
134
+ },
135
+ "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
136
+ "attribute": "overlay-class"
137
+ }
138
+ ],
139
+ "attributes": [
140
+ {
141
+ "name": "overlay-class",
142
+ "type": {
143
+ "text": "string"
144
+ },
145
+ "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
146
+ "fieldName": "overlayClass"
147
+ }
148
+ ],
149
+ "parameters": [
150
+ {
151
+ "name": "superclass"
152
+ }
153
+ ]
154
+ }
155
+ ],
156
+ "exports": [
157
+ {
158
+ "kind": "js",
159
+ "name": "OverlayClassMixin",
160
+ "declaration": {
161
+ "name": "OverlayClassMixin",
162
+ "module": "src/overlay-class-mixin.js"
163
+ }
164
+ }
165
+ ]
166
+ },
167
+ {
168
+ "kind": "javascript-module",
169
+ "path": "src/polylit-mixin.js",
170
+ "declarations": [
171
+ {
172
+ "kind": "mixin",
173
+ "description": "",
174
+ "name": "PolylitMixin",
175
+ "members": [],
176
+ "events": [],
177
+ "parameters": [
178
+ {
179
+ "name": "superclass"
180
+ }
181
+ ],
182
+ "mixins": [
183
+ {
184
+ "name": "dedupeMixin",
185
+ "package": "@open-wc/dedupe-mixin"
186
+ }
187
+ ]
188
+ }
189
+ ],
190
+ "exports": [
191
+ {
192
+ "kind": "js",
193
+ "name": "PolylitMixin",
194
+ "declaration": {
195
+ "name": "PolylitMixin",
196
+ "module": "src/polylit-mixin.js"
197
+ }
198
+ }
199
+ ]
200
+ },
201
+ {
202
+ "kind": "javascript-module",
203
+ "path": "src/resize-mixin.js",
204
+ "declarations": [
205
+ {
206
+ "kind": "variable",
207
+ "name": "ResizeMixin",
208
+ "description": "A mixin that uses a ResizeObserver to listen to host size changes."
209
+ }
210
+ ],
211
+ "exports": [
212
+ {
213
+ "kind": "js",
214
+ "name": "ResizeMixin",
215
+ "declaration": {
216
+ "name": "ResizeMixin",
217
+ "module": "src/resize-mixin.js"
218
+ }
219
+ }
220
+ ]
221
+ },
222
+ {
223
+ "kind": "javascript-module",
224
+ "path": "src/slot-styles-mixin.js",
225
+ "declarations": [
226
+ {
227
+ "kind": "variable",
228
+ "name": "SlotStylesMixin",
229
+ "description": "Mixin to insert styles into the outer scope to handle slotted components.\nThis is useful e.g. to hide native `<input type=\"number\">` controls."
230
+ }
231
+ ],
232
+ "exports": [
233
+ {
234
+ "kind": "js",
235
+ "name": "SlotStylesMixin",
236
+ "declaration": {
237
+ "name": "SlotStylesMixin",
238
+ "module": "src/slot-styles-mixin.js"
239
+ }
240
+ }
241
+ ]
242
+ }
243
+ ]
244
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/component-base",
3
- "version": "25.1.0-alpha5",
3
+ "version": "25.1.0-alpha7",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -23,7 +23,8 @@
23
23
  "custom_typings",
24
24
  "index.d.ts",
25
25
  "index.js",
26
- "src"
26
+ "src",
27
+ "custom-elements.json"
27
28
  ],
28
29
  "keywords": [
29
30
  "Vaadin",
@@ -37,10 +38,11 @@
37
38
  "lit": "^3.0.0"
38
39
  },
39
40
  "devDependencies": {
40
- "@vaadin/chai-plugins": "25.1.0-alpha5",
41
- "@vaadin/test-runner-commands": "25.1.0-alpha5",
41
+ "@vaadin/chai-plugins": "25.1.0-alpha7",
42
+ "@vaadin/test-runner-commands": "25.1.0-alpha7",
42
43
  "@vaadin/testing-helpers": "^2.0.0",
43
44
  "sinon": "^21.0.0"
44
45
  },
45
- "gitHead": "9681e63d220c9e8d9d7c58cee272e5820b8ced19"
46
+ "customElements": "custom-elements.json",
47
+ "gitHead": "98c586125f769c8fefd307536965293668fda81d"
46
48
  }
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 = '25.1.0-alpha5') {
16
+ export function defineCustomElement(CustomElement, version = '25.1.0-alpha7') {
17
17
  Object.defineProperty(CustomElement, 'version', {
18
18
  get() {
19
19
  return version;
@@ -11,6 +11,7 @@ export class SlotObserver {
11
11
  constructor(
12
12
  slot: HTMLSlotElement,
13
13
  callback: (info: { addedNodes: Node[]; currentNodes: Node[]; movedNodes: Node[]; removedNodes: Node[] }) => void,
14
+ forceInitial?: boolean,
14
15
  );
15
16
 
16
17
  /**
@@ -8,13 +8,16 @@
8
8
  * A helper for observing slot changes.
9
9
  */
10
10
  export class SlotObserver {
11
- constructor(slot, callback) {
11
+ constructor(slot, callback, forceInitial) {
12
12
  /** @type HTMLSlotElement */
13
13
  this.slot = slot;
14
14
 
15
15
  /** @type Function */
16
16
  this.callback = callback;
17
17
 
18
+ /** @type boolean */
19
+ this.forceInitial = forceInitial;
20
+
18
21
  /** @type {Node[]} */
19
22
  this._storedNodes = [];
20
23
 
@@ -96,10 +99,16 @@ export class SlotObserver {
96
99
  });
97
100
  }
98
101
 
99
- if (addedNodes.length || removedNodes.length || movedNodes.length) {
102
+ // By default, callback is not invoked if there is no child nodes in the slot.
103
+ // Use `forceInitial` flag if needed to also invoke it for the initial state.
104
+ if (addedNodes.length || removedNodes.length || movedNodes.length || this.forceInitial) {
100
105
  this.callback({ addedNodes, currentNodes, movedNodes, removedNodes });
101
106
  }
102
107
 
108
+ if (this.forceInitial) {
109
+ this.forceInitial = false;
110
+ }
111
+
103
112
  this._storedNodes = currentNodes;
104
113
  }
105
114
  }