@stencil/core 4.38.1 → 4.38.2
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/cli/index.cjs +1 -1
- package/cli/index.js +1 -1
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +26 -7
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +2 -2
- package/internal/app-data/package.json +1 -1
- package/internal/app-globals/package.json +1 -1
- package/internal/client/index.js +1 -1
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/hydrate/index.js +1 -1
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.js +80 -78
- package/internal/package.json +1 -1
- package/internal/stencil-core/index.d.ts +1 -0
- package/internal/stencil-public-runtime.d.ts +19 -10
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +80 -78
- package/mock-doc/index.d.ts +12 -11
- package/mock-doc/index.js +80 -78
- package/mock-doc/package.json +1 -1
- package/package.json +1 -1
- package/screenshot/index.js +1 -1
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +1 -1
- package/sys/node/index.js +25 -25
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +1 -1
- package/testing/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Stencil Hydrate Runner v4.38.
|
|
2
|
+
Stencil Hydrate Runner v4.38.2 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
@@ -160,82 +160,6 @@ var MockAttr = class {
|
|
|
160
160
|
}
|
|
161
161
|
};
|
|
162
162
|
|
|
163
|
-
// src/mock-doc/class-list.ts
|
|
164
|
-
var MockClassList = class {
|
|
165
|
-
constructor(elm) {
|
|
166
|
-
this.elm = elm;
|
|
167
|
-
}
|
|
168
|
-
add(...classNames) {
|
|
169
|
-
const clsNames = getItems(this.elm);
|
|
170
|
-
let updated = false;
|
|
171
|
-
classNames.forEach((className) => {
|
|
172
|
-
className = String(className);
|
|
173
|
-
validateClass(className);
|
|
174
|
-
if (clsNames.includes(className) === false) {
|
|
175
|
-
clsNames.push(className);
|
|
176
|
-
updated = true;
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
if (updated) {
|
|
180
|
-
this.elm.setAttributeNS(null, "class", clsNames.join(" "));
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
remove(...classNames) {
|
|
184
|
-
const clsNames = getItems(this.elm);
|
|
185
|
-
let updated = false;
|
|
186
|
-
classNames.forEach((className) => {
|
|
187
|
-
className = String(className);
|
|
188
|
-
validateClass(className);
|
|
189
|
-
const index = clsNames.indexOf(className);
|
|
190
|
-
if (index > -1) {
|
|
191
|
-
clsNames.splice(index, 1);
|
|
192
|
-
updated = true;
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
if (updated) {
|
|
196
|
-
this.elm.setAttributeNS(null, "class", clsNames.filter((c) => c.length > 0).join(" "));
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
contains(className) {
|
|
200
|
-
className = String(className);
|
|
201
|
-
return getItems(this.elm).includes(className);
|
|
202
|
-
}
|
|
203
|
-
toggle(className) {
|
|
204
|
-
className = String(className);
|
|
205
|
-
if (this.contains(className) === true) {
|
|
206
|
-
this.remove(className);
|
|
207
|
-
} else {
|
|
208
|
-
this.add(className);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
get length() {
|
|
212
|
-
return getItems(this.elm).length;
|
|
213
|
-
}
|
|
214
|
-
item(index) {
|
|
215
|
-
return getItems(this.elm)[index];
|
|
216
|
-
}
|
|
217
|
-
toString() {
|
|
218
|
-
return getItems(this.elm).join(" ");
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
function validateClass(className) {
|
|
222
|
-
if (className === "") {
|
|
223
|
-
throw new Error("The token provided must not be empty.");
|
|
224
|
-
}
|
|
225
|
-
if (/\s/.test(className)) {
|
|
226
|
-
throw new Error(
|
|
227
|
-
`The token provided ('${className}') contains HTML space characters, which are not valid in tokens.`
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
function getItems(elm) {
|
|
232
|
-
const className = elm.getAttribute("class");
|
|
233
|
-
if (typeof className === "string" && className.length > 0) {
|
|
234
|
-
return className.trim().split(" ").filter((c) => c.length > 0);
|
|
235
|
-
}
|
|
236
|
-
return [];
|
|
237
|
-
}
|
|
238
|
-
|
|
239
163
|
// src/mock-doc/css-style-declaration.ts
|
|
240
164
|
var MockCSSStyleDeclaration = class {
|
|
241
165
|
constructor() {
|
|
@@ -10751,6 +10675,81 @@ var STRUCTURE_ELEMENTS = /* @__PURE__ */ new Set([
|
|
|
10751
10675
|
"style"
|
|
10752
10676
|
]);
|
|
10753
10677
|
|
|
10678
|
+
// src/mock-doc/token-list.ts
|
|
10679
|
+
var MockTokenList = class {
|
|
10680
|
+
constructor(elm, attr) {
|
|
10681
|
+
this.elm = elm;
|
|
10682
|
+
this.attr = attr;
|
|
10683
|
+
}
|
|
10684
|
+
add(...tokens) {
|
|
10685
|
+
const items = getItems(this.elm, this.attr);
|
|
10686
|
+
let updated = false;
|
|
10687
|
+
tokens.forEach((token) => {
|
|
10688
|
+
token = String(token);
|
|
10689
|
+
validateToken(token);
|
|
10690
|
+
if (items.includes(token) === false) {
|
|
10691
|
+
items.push(token);
|
|
10692
|
+
updated = true;
|
|
10693
|
+
}
|
|
10694
|
+
});
|
|
10695
|
+
if (updated) {
|
|
10696
|
+
this.elm.setAttributeNS(null, this.attr, items.join(" "));
|
|
10697
|
+
}
|
|
10698
|
+
}
|
|
10699
|
+
remove(...tokens) {
|
|
10700
|
+
const items = getItems(this.elm, this.attr);
|
|
10701
|
+
let updated = false;
|
|
10702
|
+
tokens.forEach((token) => {
|
|
10703
|
+
token = String(token);
|
|
10704
|
+
validateToken(token);
|
|
10705
|
+
const index = items.indexOf(token);
|
|
10706
|
+
if (index > -1) {
|
|
10707
|
+
items.splice(index, 1);
|
|
10708
|
+
updated = true;
|
|
10709
|
+
}
|
|
10710
|
+
});
|
|
10711
|
+
if (updated) {
|
|
10712
|
+
this.elm.setAttributeNS(null, this.attr, items.filter((c) => c.length > 0).join(" "));
|
|
10713
|
+
}
|
|
10714
|
+
}
|
|
10715
|
+
contains(token) {
|
|
10716
|
+
token = String(token);
|
|
10717
|
+
return getItems(this.elm, this.attr).includes(token);
|
|
10718
|
+
}
|
|
10719
|
+
toggle(token) {
|
|
10720
|
+
token = String(token);
|
|
10721
|
+
if (this.contains(token) === true) {
|
|
10722
|
+
this.remove(token);
|
|
10723
|
+
} else {
|
|
10724
|
+
this.add(token);
|
|
10725
|
+
}
|
|
10726
|
+
}
|
|
10727
|
+
get length() {
|
|
10728
|
+
return getItems(this.elm, this.attr).length;
|
|
10729
|
+
}
|
|
10730
|
+
item(index) {
|
|
10731
|
+
return getItems(this.elm, this.attr)[index];
|
|
10732
|
+
}
|
|
10733
|
+
toString() {
|
|
10734
|
+
return getItems(this.elm, this.attr).join(" ");
|
|
10735
|
+
}
|
|
10736
|
+
};
|
|
10737
|
+
function validateToken(token) {
|
|
10738
|
+
if (token === "") {
|
|
10739
|
+
throw new Error("The token provided must not be empty.");
|
|
10740
|
+
}
|
|
10741
|
+
if (/\s/.test(token)) {
|
|
10742
|
+
throw new Error(`The token provided ('${token}') contains HTML space characters, which are not valid in tokens.`);
|
|
10743
|
+
}
|
|
10744
|
+
}
|
|
10745
|
+
function getItems(elm, attr) {
|
|
10746
|
+
const value = elm.getAttribute(attr);
|
|
10747
|
+
if (typeof value === "string" && value.length > 0) {
|
|
10748
|
+
return value.trim().split(" ").filter((c) => c.length > 0);
|
|
10749
|
+
}
|
|
10750
|
+
return [];
|
|
10751
|
+
}
|
|
10752
|
+
|
|
10754
10753
|
// src/mock-doc/node.ts
|
|
10755
10754
|
var MockNode2 = class {
|
|
10756
10755
|
constructor(ownerDocument, nodeType, nodeName, nodeValue) {
|
|
@@ -11018,7 +11017,10 @@ var MockElement = class extends MockNode2 {
|
|
|
11018
11017
|
this.setAttributeNS(null, "class", value);
|
|
11019
11018
|
}
|
|
11020
11019
|
get classList() {
|
|
11021
|
-
return new
|
|
11020
|
+
return new MockTokenList(this, "class");
|
|
11021
|
+
}
|
|
11022
|
+
get part() {
|
|
11023
|
+
return new MockTokenList(this, "part");
|
|
11022
11024
|
}
|
|
11023
11025
|
click() {
|
|
11024
11026
|
dispatchEvent(this, new MockEvent("click", { bubbles: true, cancelable: true, composed: true }));
|
package/internal/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
type CustomMethodDecorator<T> = (target: object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
|
|
2
|
-
type UnionToIntersection<U> = (U extends any ? (
|
|
2
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
3
|
+
type MixinInstance<F> = F extends (base: MixedInCtor) => MixedInCtor<infer I> ? I : never;
|
|
3
4
|
export interface ComponentDecorator {
|
|
4
5
|
(opts?: ComponentOptions): ClassDecorator;
|
|
5
6
|
}
|
|
@@ -340,7 +341,6 @@ export declare function forceUpdate(ref: any): void;
|
|
|
340
341
|
export declare function getRenderingRef(): any;
|
|
341
342
|
export interface HTMLStencilElement extends Omit<HTMLElement, 'autocorrect'> {
|
|
342
343
|
componentOnReady(): Promise<this>;
|
|
343
|
-
autocorrect: 'on' | 'off';
|
|
344
344
|
}
|
|
345
345
|
/**
|
|
346
346
|
* Schedules a DOM-write task. The provided callback will be executed
|
|
@@ -365,18 +365,27 @@ export declare function readTask(task: RafCallback): void;
|
|
|
365
365
|
* Unhandled exception raised while rendering, during event handling, or lifecycles will trigger the custom event handler.
|
|
366
366
|
*/
|
|
367
367
|
export declare const setErrorHandler: (handler: ErrorHandler) => void;
|
|
368
|
-
|
|
368
|
+
/**
|
|
369
|
+
* @deprecated - Use `MixedInCtor` instead:
|
|
370
|
+
* ```ts
|
|
371
|
+
* import { MixedInCtor } from '@stencil/core';
|
|
372
|
+
*
|
|
373
|
+
* const AFactoryFn = <B extends MixedInCtor>(Base: B) => {class A extends Base { propA = A }; return A;}
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
export type MixinFactory = (base: MixedInCtor) => MixedInCtor;
|
|
377
|
+
export type MixedInCtor<T = {}> = new (...args: any[]) => T;
|
|
369
378
|
/**
|
|
370
379
|
* Compose multiple mixin classes into a single constructor.
|
|
371
380
|
* The resulting class has the combined instance types of all mixed-in classes.
|
|
372
381
|
*
|
|
373
382
|
* Example:
|
|
374
|
-
* ```
|
|
375
|
-
* import { Mixin,
|
|
383
|
+
* ```ts
|
|
384
|
+
* import { Mixin, MixedInCtor } from '@stencil/core';
|
|
376
385
|
*
|
|
377
|
-
* const AWrap
|
|
378
|
-
* const BWrap
|
|
379
|
-
* const CWrap
|
|
386
|
+
* const AWrap = <B extends MixedInCtor>(Base: B) => {class A extends Base { propA = A }; return A;}
|
|
387
|
+
* const BWrap = <B extends MixedInCtor>(Base: B) => {class B extends Base { propB = B }; return B;}
|
|
388
|
+
* const CWrap = <B extends MixedInCtor>(Base: B) => {class C extends Base { propC = C }; return C;}
|
|
380
389
|
*
|
|
381
390
|
* class X extends Mixin(AWrap, BWrap, CWrap) {
|
|
382
391
|
* render() { return <div>{this.propA} {this.propB} {this.propC}</div>; }
|
|
@@ -384,9 +393,9 @@ export type MixinFactory = <TBase extends new (...args: any[]) => any>(base: TBa
|
|
|
384
393
|
* ```
|
|
385
394
|
*
|
|
386
395
|
* @param mixinFactories mixin factory functions that return a class which extends from the provided class.
|
|
387
|
-
* @returns a class that
|
|
396
|
+
* @returns a class that is composed from extending each of the provided classes in the order they were provided.
|
|
388
397
|
*/
|
|
389
|
-
export declare function Mixin<TMixins extends readonly MixinFactory[]>(...mixinFactories: TMixins): abstract new (...args: any[]) => UnionToIntersection<
|
|
398
|
+
export declare function Mixin<const TMixins extends readonly MixinFactory[]>(...mixinFactories: TMixins): abstract new (...args: any[]) => UnionToIntersection<MixinInstance<TMixins[number]>>;
|
|
390
399
|
/**
|
|
391
400
|
* This file gets copied to all distributions of stencil component collections.
|
|
392
401
|
* - no imports
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/core/internal/testing",
|
|
3
|
-
"version": "4.38.
|
|
3
|
+
"version": "4.38.2",
|
|
4
4
|
"description": "Stencil internal testing platform to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"private": true
|
package/mock-doc/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil Mock Doc (CommonJS) v4.38.
|
|
2
|
+
Stencil Mock Doc (CommonJS) v4.38.2 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
"use strict";
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
@@ -223,82 +223,6 @@ var NODE_TYPES = /* @__PURE__ */ ((NODE_TYPES2) => {
|
|
|
223
223
|
return NODE_TYPES2;
|
|
224
224
|
})(NODE_TYPES || {});
|
|
225
225
|
|
|
226
|
-
// src/mock-doc/class-list.ts
|
|
227
|
-
var MockClassList = class {
|
|
228
|
-
constructor(elm) {
|
|
229
|
-
this.elm = elm;
|
|
230
|
-
}
|
|
231
|
-
add(...classNames) {
|
|
232
|
-
const clsNames = getItems(this.elm);
|
|
233
|
-
let updated = false;
|
|
234
|
-
classNames.forEach((className) => {
|
|
235
|
-
className = String(className);
|
|
236
|
-
validateClass(className);
|
|
237
|
-
if (clsNames.includes(className) === false) {
|
|
238
|
-
clsNames.push(className);
|
|
239
|
-
updated = true;
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
if (updated) {
|
|
243
|
-
this.elm.setAttributeNS(null, "class", clsNames.join(" "));
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
remove(...classNames) {
|
|
247
|
-
const clsNames = getItems(this.elm);
|
|
248
|
-
let updated = false;
|
|
249
|
-
classNames.forEach((className) => {
|
|
250
|
-
className = String(className);
|
|
251
|
-
validateClass(className);
|
|
252
|
-
const index = clsNames.indexOf(className);
|
|
253
|
-
if (index > -1) {
|
|
254
|
-
clsNames.splice(index, 1);
|
|
255
|
-
updated = true;
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
if (updated) {
|
|
259
|
-
this.elm.setAttributeNS(null, "class", clsNames.filter((c) => c.length > 0).join(" "));
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
contains(className) {
|
|
263
|
-
className = String(className);
|
|
264
|
-
return getItems(this.elm).includes(className);
|
|
265
|
-
}
|
|
266
|
-
toggle(className) {
|
|
267
|
-
className = String(className);
|
|
268
|
-
if (this.contains(className) === true) {
|
|
269
|
-
this.remove(className);
|
|
270
|
-
} else {
|
|
271
|
-
this.add(className);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
get length() {
|
|
275
|
-
return getItems(this.elm).length;
|
|
276
|
-
}
|
|
277
|
-
item(index) {
|
|
278
|
-
return getItems(this.elm)[index];
|
|
279
|
-
}
|
|
280
|
-
toString() {
|
|
281
|
-
return getItems(this.elm).join(" ");
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
function validateClass(className) {
|
|
285
|
-
if (className === "") {
|
|
286
|
-
throw new Error("The token provided must not be empty.");
|
|
287
|
-
}
|
|
288
|
-
if (/\s/.test(className)) {
|
|
289
|
-
throw new Error(
|
|
290
|
-
`The token provided ('${className}') contains HTML space characters, which are not valid in tokens.`
|
|
291
|
-
);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
function getItems(elm) {
|
|
295
|
-
const className = elm.getAttribute("class");
|
|
296
|
-
if (typeof className === "string" && className.length > 0) {
|
|
297
|
-
return className.trim().split(" ").filter((c) => c.length > 0);
|
|
298
|
-
}
|
|
299
|
-
return [];
|
|
300
|
-
}
|
|
301
|
-
|
|
302
226
|
// src/mock-doc/css-style-declaration.ts
|
|
303
227
|
var MockCSSStyleDeclaration = class {
|
|
304
228
|
constructor() {
|
|
@@ -6634,6 +6558,81 @@ var STRUCTURE_ELEMENTS = /* @__PURE__ */ new Set([
|
|
|
6634
6558
|
"style"
|
|
6635
6559
|
]);
|
|
6636
6560
|
|
|
6561
|
+
// src/mock-doc/token-list.ts
|
|
6562
|
+
var MockTokenList = class {
|
|
6563
|
+
constructor(elm, attr) {
|
|
6564
|
+
this.elm = elm;
|
|
6565
|
+
this.attr = attr;
|
|
6566
|
+
}
|
|
6567
|
+
add(...tokens) {
|
|
6568
|
+
const items = getItems(this.elm, this.attr);
|
|
6569
|
+
let updated = false;
|
|
6570
|
+
tokens.forEach((token) => {
|
|
6571
|
+
token = String(token);
|
|
6572
|
+
validateToken(token);
|
|
6573
|
+
if (items.includes(token) === false) {
|
|
6574
|
+
items.push(token);
|
|
6575
|
+
updated = true;
|
|
6576
|
+
}
|
|
6577
|
+
});
|
|
6578
|
+
if (updated) {
|
|
6579
|
+
this.elm.setAttributeNS(null, this.attr, items.join(" "));
|
|
6580
|
+
}
|
|
6581
|
+
}
|
|
6582
|
+
remove(...tokens) {
|
|
6583
|
+
const items = getItems(this.elm, this.attr);
|
|
6584
|
+
let updated = false;
|
|
6585
|
+
tokens.forEach((token) => {
|
|
6586
|
+
token = String(token);
|
|
6587
|
+
validateToken(token);
|
|
6588
|
+
const index = items.indexOf(token);
|
|
6589
|
+
if (index > -1) {
|
|
6590
|
+
items.splice(index, 1);
|
|
6591
|
+
updated = true;
|
|
6592
|
+
}
|
|
6593
|
+
});
|
|
6594
|
+
if (updated) {
|
|
6595
|
+
this.elm.setAttributeNS(null, this.attr, items.filter((c) => c.length > 0).join(" "));
|
|
6596
|
+
}
|
|
6597
|
+
}
|
|
6598
|
+
contains(token) {
|
|
6599
|
+
token = String(token);
|
|
6600
|
+
return getItems(this.elm, this.attr).includes(token);
|
|
6601
|
+
}
|
|
6602
|
+
toggle(token) {
|
|
6603
|
+
token = String(token);
|
|
6604
|
+
if (this.contains(token) === true) {
|
|
6605
|
+
this.remove(token);
|
|
6606
|
+
} else {
|
|
6607
|
+
this.add(token);
|
|
6608
|
+
}
|
|
6609
|
+
}
|
|
6610
|
+
get length() {
|
|
6611
|
+
return getItems(this.elm, this.attr).length;
|
|
6612
|
+
}
|
|
6613
|
+
item(index) {
|
|
6614
|
+
return getItems(this.elm, this.attr)[index];
|
|
6615
|
+
}
|
|
6616
|
+
toString() {
|
|
6617
|
+
return getItems(this.elm, this.attr).join(" ");
|
|
6618
|
+
}
|
|
6619
|
+
};
|
|
6620
|
+
function validateToken(token) {
|
|
6621
|
+
if (token === "") {
|
|
6622
|
+
throw new Error("The token provided must not be empty.");
|
|
6623
|
+
}
|
|
6624
|
+
if (/\s/.test(token)) {
|
|
6625
|
+
throw new Error(`The token provided ('${token}') contains HTML space characters, which are not valid in tokens.`);
|
|
6626
|
+
}
|
|
6627
|
+
}
|
|
6628
|
+
function getItems(elm, attr) {
|
|
6629
|
+
const value = elm.getAttribute(attr);
|
|
6630
|
+
if (typeof value === "string" && value.length > 0) {
|
|
6631
|
+
return value.trim().split(" ").filter((c) => c.length > 0);
|
|
6632
|
+
}
|
|
6633
|
+
return [];
|
|
6634
|
+
}
|
|
6635
|
+
|
|
6637
6636
|
// src/mock-doc/node.ts
|
|
6638
6637
|
var MockNode2 = class {
|
|
6639
6638
|
constructor(ownerDocument, nodeType, nodeName, nodeValue) {
|
|
@@ -6901,7 +6900,10 @@ var MockElement = class extends MockNode2 {
|
|
|
6901
6900
|
this.setAttributeNS(null, "class", value);
|
|
6902
6901
|
}
|
|
6903
6902
|
get classList() {
|
|
6904
|
-
return new
|
|
6903
|
+
return new MockTokenList(this, "class");
|
|
6904
|
+
}
|
|
6905
|
+
get part() {
|
|
6906
|
+
return new MockTokenList(this, "part");
|
|
6905
6907
|
}
|
|
6906
6908
|
click() {
|
|
6907
6909
|
dispatchEvent(this, new MockEvent("click", { bubbles: true, cancelable: true, composed: true }));
|
package/mock-doc/index.d.ts
CHANGED
|
@@ -32,16 +32,6 @@ declare class MockAttr {
|
|
|
32
32
|
get namespaceURI(): string;
|
|
33
33
|
set namespaceURI(namespaceURI: string);
|
|
34
34
|
}
|
|
35
|
-
declare class MockClassList {
|
|
36
|
-
constructor(elm: HTMLElement);
|
|
37
|
-
add(...classNames: string[]): void;
|
|
38
|
-
remove(...classNames: string[]): void;
|
|
39
|
-
contains(className: string): boolean;
|
|
40
|
-
toggle(className: string): void;
|
|
41
|
-
get length(): number;
|
|
42
|
-
item(index: number): string;
|
|
43
|
-
toString(): string;
|
|
44
|
-
}
|
|
45
35
|
declare class MockComment extends MockNode {
|
|
46
36
|
constructor(ownerDocument: any, data: string);
|
|
47
37
|
cloneNode(_deep?: boolean): MockComment;
|
|
@@ -564,7 +554,8 @@ declare class MockElement extends MockNode {
|
|
|
564
554
|
get childElementCount(): number;
|
|
565
555
|
get className(): string;
|
|
566
556
|
set className(value: string);
|
|
567
|
-
get classList():
|
|
557
|
+
get classList(): MockTokenList;
|
|
558
|
+
get part(): MockTokenList;
|
|
568
559
|
click(): void;
|
|
569
560
|
cloneNode(_deep?: boolean): MockElement;
|
|
570
561
|
closest(selector: string): this;
|
|
@@ -955,6 +946,16 @@ declare class MockStorage {
|
|
|
955
946
|
removeItem(key: string): void;
|
|
956
947
|
clear(): void;
|
|
957
948
|
}
|
|
949
|
+
declare class MockTokenList {
|
|
950
|
+
constructor(elm: HTMLElement, attr: string);
|
|
951
|
+
add(...tokens: string[]): void;
|
|
952
|
+
remove(...tokens: string[]): void;
|
|
953
|
+
contains(token: string): boolean;
|
|
954
|
+
toggle(token: string): void;
|
|
955
|
+
get length(): number;
|
|
956
|
+
item(index: number): string;
|
|
957
|
+
toString(): string;
|
|
958
|
+
}
|
|
958
959
|
declare const nativeClearInterval: typeof clearInterval;
|
|
959
960
|
declare const nativeClearTimeout: typeof clearTimeout;
|
|
960
961
|
declare const nativeSetInterval: typeof setInterval;
|
package/mock-doc/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil Mock Doc v4.38.
|
|
2
|
+
Stencil Mock Doc v4.38.2 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
// src/runtime/runtime-constants.ts
|
|
@@ -170,82 +170,6 @@ var NODE_TYPES = /* @__PURE__ */ ((NODE_TYPES2) => {
|
|
|
170
170
|
return NODE_TYPES2;
|
|
171
171
|
})(NODE_TYPES || {});
|
|
172
172
|
|
|
173
|
-
// src/mock-doc/class-list.ts
|
|
174
|
-
var MockClassList = class {
|
|
175
|
-
constructor(elm) {
|
|
176
|
-
this.elm = elm;
|
|
177
|
-
}
|
|
178
|
-
add(...classNames) {
|
|
179
|
-
const clsNames = getItems(this.elm);
|
|
180
|
-
let updated = false;
|
|
181
|
-
classNames.forEach((className) => {
|
|
182
|
-
className = String(className);
|
|
183
|
-
validateClass(className);
|
|
184
|
-
if (clsNames.includes(className) === false) {
|
|
185
|
-
clsNames.push(className);
|
|
186
|
-
updated = true;
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
if (updated) {
|
|
190
|
-
this.elm.setAttributeNS(null, "class", clsNames.join(" "));
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
remove(...classNames) {
|
|
194
|
-
const clsNames = getItems(this.elm);
|
|
195
|
-
let updated = false;
|
|
196
|
-
classNames.forEach((className) => {
|
|
197
|
-
className = String(className);
|
|
198
|
-
validateClass(className);
|
|
199
|
-
const index = clsNames.indexOf(className);
|
|
200
|
-
if (index > -1) {
|
|
201
|
-
clsNames.splice(index, 1);
|
|
202
|
-
updated = true;
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
if (updated) {
|
|
206
|
-
this.elm.setAttributeNS(null, "class", clsNames.filter((c) => c.length > 0).join(" "));
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
contains(className) {
|
|
210
|
-
className = String(className);
|
|
211
|
-
return getItems(this.elm).includes(className);
|
|
212
|
-
}
|
|
213
|
-
toggle(className) {
|
|
214
|
-
className = String(className);
|
|
215
|
-
if (this.contains(className) === true) {
|
|
216
|
-
this.remove(className);
|
|
217
|
-
} else {
|
|
218
|
-
this.add(className);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
get length() {
|
|
222
|
-
return getItems(this.elm).length;
|
|
223
|
-
}
|
|
224
|
-
item(index) {
|
|
225
|
-
return getItems(this.elm)[index];
|
|
226
|
-
}
|
|
227
|
-
toString() {
|
|
228
|
-
return getItems(this.elm).join(" ");
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
function validateClass(className) {
|
|
232
|
-
if (className === "") {
|
|
233
|
-
throw new Error("The token provided must not be empty.");
|
|
234
|
-
}
|
|
235
|
-
if (/\s/.test(className)) {
|
|
236
|
-
throw new Error(
|
|
237
|
-
`The token provided ('${className}') contains HTML space characters, which are not valid in tokens.`
|
|
238
|
-
);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
function getItems(elm) {
|
|
242
|
-
const className = elm.getAttribute("class");
|
|
243
|
-
if (typeof className === "string" && className.length > 0) {
|
|
244
|
-
return className.trim().split(" ").filter((c) => c.length > 0);
|
|
245
|
-
}
|
|
246
|
-
return [];
|
|
247
|
-
}
|
|
248
|
-
|
|
249
173
|
// src/mock-doc/css-style-declaration.ts
|
|
250
174
|
var MockCSSStyleDeclaration = class {
|
|
251
175
|
constructor() {
|
|
@@ -6581,6 +6505,81 @@ var STRUCTURE_ELEMENTS = /* @__PURE__ */ new Set([
|
|
|
6581
6505
|
"style"
|
|
6582
6506
|
]);
|
|
6583
6507
|
|
|
6508
|
+
// src/mock-doc/token-list.ts
|
|
6509
|
+
var MockTokenList = class {
|
|
6510
|
+
constructor(elm, attr) {
|
|
6511
|
+
this.elm = elm;
|
|
6512
|
+
this.attr = attr;
|
|
6513
|
+
}
|
|
6514
|
+
add(...tokens) {
|
|
6515
|
+
const items = getItems(this.elm, this.attr);
|
|
6516
|
+
let updated = false;
|
|
6517
|
+
tokens.forEach((token) => {
|
|
6518
|
+
token = String(token);
|
|
6519
|
+
validateToken(token);
|
|
6520
|
+
if (items.includes(token) === false) {
|
|
6521
|
+
items.push(token);
|
|
6522
|
+
updated = true;
|
|
6523
|
+
}
|
|
6524
|
+
});
|
|
6525
|
+
if (updated) {
|
|
6526
|
+
this.elm.setAttributeNS(null, this.attr, items.join(" "));
|
|
6527
|
+
}
|
|
6528
|
+
}
|
|
6529
|
+
remove(...tokens) {
|
|
6530
|
+
const items = getItems(this.elm, this.attr);
|
|
6531
|
+
let updated = false;
|
|
6532
|
+
tokens.forEach((token) => {
|
|
6533
|
+
token = String(token);
|
|
6534
|
+
validateToken(token);
|
|
6535
|
+
const index = items.indexOf(token);
|
|
6536
|
+
if (index > -1) {
|
|
6537
|
+
items.splice(index, 1);
|
|
6538
|
+
updated = true;
|
|
6539
|
+
}
|
|
6540
|
+
});
|
|
6541
|
+
if (updated) {
|
|
6542
|
+
this.elm.setAttributeNS(null, this.attr, items.filter((c) => c.length > 0).join(" "));
|
|
6543
|
+
}
|
|
6544
|
+
}
|
|
6545
|
+
contains(token) {
|
|
6546
|
+
token = String(token);
|
|
6547
|
+
return getItems(this.elm, this.attr).includes(token);
|
|
6548
|
+
}
|
|
6549
|
+
toggle(token) {
|
|
6550
|
+
token = String(token);
|
|
6551
|
+
if (this.contains(token) === true) {
|
|
6552
|
+
this.remove(token);
|
|
6553
|
+
} else {
|
|
6554
|
+
this.add(token);
|
|
6555
|
+
}
|
|
6556
|
+
}
|
|
6557
|
+
get length() {
|
|
6558
|
+
return getItems(this.elm, this.attr).length;
|
|
6559
|
+
}
|
|
6560
|
+
item(index) {
|
|
6561
|
+
return getItems(this.elm, this.attr)[index];
|
|
6562
|
+
}
|
|
6563
|
+
toString() {
|
|
6564
|
+
return getItems(this.elm, this.attr).join(" ");
|
|
6565
|
+
}
|
|
6566
|
+
};
|
|
6567
|
+
function validateToken(token) {
|
|
6568
|
+
if (token === "") {
|
|
6569
|
+
throw new Error("The token provided must not be empty.");
|
|
6570
|
+
}
|
|
6571
|
+
if (/\s/.test(token)) {
|
|
6572
|
+
throw new Error(`The token provided ('${token}') contains HTML space characters, which are not valid in tokens.`);
|
|
6573
|
+
}
|
|
6574
|
+
}
|
|
6575
|
+
function getItems(elm, attr) {
|
|
6576
|
+
const value = elm.getAttribute(attr);
|
|
6577
|
+
if (typeof value === "string" && value.length > 0) {
|
|
6578
|
+
return value.trim().split(" ").filter((c) => c.length > 0);
|
|
6579
|
+
}
|
|
6580
|
+
return [];
|
|
6581
|
+
}
|
|
6582
|
+
|
|
6584
6583
|
// src/mock-doc/node.ts
|
|
6585
6584
|
var MockNode2 = class {
|
|
6586
6585
|
constructor(ownerDocument, nodeType, nodeName, nodeValue) {
|
|
@@ -6848,7 +6847,10 @@ var MockElement = class extends MockNode2 {
|
|
|
6848
6847
|
this.setAttributeNS(null, "class", value);
|
|
6849
6848
|
}
|
|
6850
6849
|
get classList() {
|
|
6851
|
-
return new
|
|
6850
|
+
return new MockTokenList(this, "class");
|
|
6851
|
+
}
|
|
6852
|
+
get part() {
|
|
6853
|
+
return new MockTokenList(this, "part");
|
|
6852
6854
|
}
|
|
6853
6855
|
click() {
|
|
6854
6856
|
dispatchEvent(this, new MockEvent("click", { bubbles: true, cancelable: true, composed: true }));
|
package/mock-doc/package.json
CHANGED