@stencil/core 3.0.0-alpha.1 → 3.0.0-beta.0

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.
Files changed (67) hide show
  1. package/cli/config-flags.d.ts +16 -16
  2. package/cli/index.cjs +5 -4
  3. package/cli/index.js +5 -4
  4. package/cli/package.json +1 -1
  5. package/compiler/lib.dom.d.ts +308 -70
  6. package/compiler/lib.dom.iterable.d.ts +6 -2
  7. package/compiler/lib.es2015.promise.d.ts +9 -4
  8. package/compiler/lib.es2015.proxy.d.ts +1 -1
  9. package/compiler/lib.es2015.reflect.d.ts +25 -2
  10. package/compiler/lib.es2015.symbol.wellknown.d.ts +3 -3
  11. package/compiler/lib.es2019.d.ts +1 -0
  12. package/compiler/lib.es2019.intl.d.ts +25 -0
  13. package/compiler/lib.es2020.intl.d.ts +1 -1
  14. package/compiler/lib.es5.d.ts +26 -13
  15. package/compiler/lib.webworker.d.ts +266 -30
  16. package/compiler/lib.webworker.iterable.d.ts +10 -2
  17. package/compiler/package.json +1 -1
  18. package/compiler/stencil.d.ts +1 -23
  19. package/compiler/stencil.js +1413 -323
  20. package/compiler/stencil.min.js +2 -2
  21. package/compiler/sys/in-memory-fs.d.ts +3 -3
  22. package/compiler/transpile.d.ts +32 -0
  23. package/dependencies.json +2 -1
  24. package/dev-server/client/app-error.d.ts +1 -1
  25. package/dev-server/client/index.js +1 -1
  26. package/dev-server/client/package.json +1 -1
  27. package/dev-server/connector.html +2 -2
  28. package/dev-server/index.js +1 -1
  29. package/dev-server/open-in-editor-api.js +1 -1
  30. package/dev-server/package.json +1 -1
  31. package/dev-server/server-process.js +2 -2
  32. package/internal/app-data/index.cjs +4 -0
  33. package/internal/app-data/index.js +4 -0
  34. package/internal/app-data/package.json +1 -1
  35. package/internal/client/css-shim.js +2 -2
  36. package/internal/client/dom.js +1 -1
  37. package/internal/client/index.js +20 -3
  38. package/internal/client/package.json +1 -1
  39. package/internal/client/patch-browser.js +15 -2
  40. package/internal/client/patch-esm.js +3 -1
  41. package/internal/client/polyfills/css-shim.js +1 -1
  42. package/internal/client/shadow-css.js +1 -1
  43. package/internal/hydrate/index.js +2 -2
  44. package/internal/hydrate/package.json +1 -1
  45. package/internal/hydrate/runner.js +4 -4
  46. package/internal/package.json +1 -1
  47. package/internal/stencil-private.d.ts +37 -37
  48. package/internal/stencil-public-compiler.d.ts +43 -35
  49. package/internal/stencil-public-runtime.d.ts +3 -3
  50. package/internal/testing/package.json +1 -1
  51. package/mock-doc/index.cjs +1 -1
  52. package/mock-doc/index.d.ts +2 -2
  53. package/mock-doc/index.js +1 -1
  54. package/mock-doc/package.json +1 -1
  55. package/package.json +8 -8
  56. package/screenshot/package.json +1 -1
  57. package/sys/node/autoprefixer.js +1 -1
  58. package/sys/node/glob.js +1 -1
  59. package/sys/node/index.js +29 -42
  60. package/sys/node/package.json +1 -1
  61. package/sys/node/prompts.js +1 -1
  62. package/sys/node/worker.js +1 -1
  63. package/testing/index.js +19 -13
  64. package/testing/jest/jest-preprocessor.d.ts +3 -3
  65. package/testing/package.json +1 -1
  66. package/testing/puppeteer/puppeteer-declarations.d.ts +4 -4
  67. package/testing/testing-utils.d.ts +1 -1
@@ -46,6 +46,10 @@ interface Cache {
46
46
  addAll(requests: Iterable<RequestInfo>): Promise<void>;
47
47
  }
48
48
 
49
+ interface CanvasPath {
50
+ roundRect(x: number, y: number, w: number, h: number, radii?: number | DOMPointInit | Iterable<number | DOMPointInit>): void;
51
+ }
52
+
49
53
  interface CanvasPathDrawingStyles {
50
54
  setLineDash(segments: Iterable<number>): void;
51
55
  }
@@ -273,8 +277,8 @@ interface WEBGL_draw_buffers {
273
277
  interface WEBGL_multi_draw {
274
278
  multiDrawArraysInstancedWEBGL(mode: GLenum, firstsList: Int32Array | Iterable<GLint>, firstsOffset: GLuint, countsList: Int32Array | Iterable<GLsizei>, countsOffset: GLuint, instanceCountsList: Int32Array | Iterable<GLsizei>, instanceCountsOffset: GLuint, drawcount: GLsizei): void;
275
279
  multiDrawArraysWEBGL(mode: GLenum, firstsList: Int32Array | Iterable<GLint>, firstsOffset: GLuint, countsList: Int32Array | Iterable<GLsizei>, countsOffset: GLuint, drawcount: GLsizei): void;
276
- multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: Int32Array | Iterable<GLint>, countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | Iterable<GLsizei>, offsetsOffset: GLuint, instanceCountsList: Int32Array | Iterable<GLsizei>, instanceCountsOffset: GLuint, drawcount: GLsizei): void;
277
- multiDrawElementsWEBGL(mode: GLenum, countsList: Int32Array | Iterable<GLint>, countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | Iterable<GLsizei>, offsetsOffset: GLuint, drawcount: GLsizei): void;
280
+ multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: Int32Array | Iterable<GLsizei>, countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | Iterable<GLsizei>, offsetsOffset: GLuint, instanceCountsList: Int32Array | Iterable<GLsizei>, instanceCountsOffset: GLuint, drawcount: GLsizei): void;
281
+ multiDrawElementsWEBGL(mode: GLenum, countsList: Int32Array | Iterable<GLsizei>, countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | Iterable<GLsizei>, offsetsOffset: GLuint, drawcount: GLsizei): void;
278
282
  }
279
283
 
280
284
  interface WebGL2RenderingContextBase {
@@ -41,7 +41,7 @@ interface PromiseConstructor {
41
41
  all<T extends readonly unknown[] | []>(values: T): Promise<{ -readonly [P in keyof T]: Awaited<T[P]> }>;
42
42
 
43
43
  // see: lib.es2015.iterable.d.ts
44
- // all<T>(values: Iterable<T | PromiseLike<T>>): Promise<T[]>;
44
+ // all<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>[]>;
45
45
 
46
46
  /**
47
47
  * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
@@ -52,7 +52,7 @@ interface PromiseConstructor {
52
52
  race<T extends readonly unknown[] | []>(values: T): Promise<Awaited<T[number]>>;
53
53
 
54
54
  // see: lib.es2015.iterable.d.ts
55
- // race<T>(values: Iterable<T>): Promise<T extends PromiseLike<infer U> ? U : T>;
55
+ // race<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>>;
56
56
 
57
57
  /**
58
58
  * Creates a new rejected promise for the provided reason.
@@ -66,13 +66,18 @@ interface PromiseConstructor {
66
66
  * @returns A resolved promise.
67
67
  */
68
68
  resolve(): Promise<void>;
69
-
70
69
  /**
71
70
  * Creates a new resolved promise for the provided value.
72
71
  * @param value A promise.
73
72
  * @returns A promise whose internal state matches the provided promise.
74
73
  */
75
- resolve<T>(value: T | PromiseLike<T>): Promise<T>;
74
+ resolve<T>(value: T): Promise<Awaited<T>>;
75
+ /**
76
+ * Creates a new resolved promise for the provided value.
77
+ * @param value A promise.
78
+ * @returns A promise whose internal state matches the provided promise.
79
+ */
80
+ resolve<T>(value: T | PromiseLike<T>): Promise<Awaited<T>>;
76
81
  }
77
82
 
78
83
  declare var Promise: PromiseConstructor;
@@ -98,7 +98,7 @@ interface ProxyHandler<T extends object> {
98
98
  * @param target The original object which is being proxied.
99
99
  * @param p The name or `Symbol` of the property to set.
100
100
  * @param receiver The object to which the assignment was originally directed.
101
- * @returns `A `Boolean` indicating whether or not the property was set.
101
+ * @returns A `Boolean` indicating whether or not the property was set.
102
102
  */
103
103
  set?(target: T, p: string | symbol, newValue: any, receiver: any): boolean;
104
104
 
@@ -26,6 +26,11 @@ declare namespace Reflect {
26
26
  * @param thisArgument The object to be used as the this object.
27
27
  * @param argumentsList An array of argument values to be passed to the function.
28
28
  */
29
+ function apply<T, A extends readonly any[], R>(
30
+ target: (this: T, ...args: A) => R,
31
+ thisArgument: T,
32
+ argumentsList: Readonly<A>,
33
+ ): R;
29
34
  function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
30
35
 
31
36
  /**
@@ -35,6 +40,11 @@ declare namespace Reflect {
35
40
  * @param argumentsList An array of argument values to be passed to the constructor.
36
41
  * @param newTarget The constructor to be used as the `new.target` object.
37
42
  */
43
+ function construct<A extends readonly any[], R>(
44
+ target: new (...args: A) => R,
45
+ argumentsList: Readonly<A>,
46
+ newTarget?: new (...args: any) => any,
47
+ ): R;
38
48
  function construct(target: Function, argumentsList: ArrayLike<any>, newTarget?: Function): any;
39
49
 
40
50
  /**
@@ -61,7 +71,11 @@ declare namespace Reflect {
61
71
  * @param receiver The reference to use as the `this` value in the getter function,
62
72
  * if `target[propertyKey]` is an accessor property.
63
73
  */
64
- function get(target: object, propertyKey: PropertyKey, receiver?: any): any;
74
+ function get<T extends object, P extends PropertyKey>(
75
+ target: T,
76
+ propertyKey: P,
77
+ receiver?: unknown,
78
+ ): P extends keyof T ? T[P] : any;
65
79
 
66
80
  /**
67
81
  * Gets the own property descriptor of the specified object.
@@ -69,7 +83,10 @@ declare namespace Reflect {
69
83
  * @param target Object that contains the property.
70
84
  * @param propertyKey The property name.
71
85
  */
72
- function getOwnPropertyDescriptor(target: object, propertyKey: PropertyKey): PropertyDescriptor | undefined;
86
+ function getOwnPropertyDescriptor<T extends object, P extends PropertyKey>(
87
+ target: T,
88
+ propertyKey: P,
89
+ ): TypedPropertyDescriptor<P extends keyof T ? T[P] : any> | undefined;
73
90
 
74
91
  /**
75
92
  * Returns the prototype of an object.
@@ -111,6 +128,12 @@ declare namespace Reflect {
111
128
  * @param receiver The reference to use as the `this` value in the setter function,
112
129
  * if `target[propertyKey]` is an accessor property.
113
130
  */
131
+ function set<T extends object, P extends PropertyKey>(
132
+ target: T,
133
+ propertyKey: P,
134
+ value: P extends keyof T ? T[P] : any,
135
+ receiver?: any,
136
+ ): boolean;
114
137
  function set(target: object, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
115
138
 
116
139
  /**
@@ -239,9 +239,9 @@ interface String {
239
239
  match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null;
240
240
 
241
241
  /**
242
- * Replaces first match with string or all matches with RegExp.
243
- * @param searchValue A string or RegExp search value.
244
- * @param replaceValue A string containing the text to replace for match.
242
+ * Passes a string and {@linkcode replaceValue} to the `[Symbol.replace]` method on {@linkcode searchValue}. This method is expected to implement its own replacement algorithm.
243
+ * @param searchValue An object that supports searching for and replacing matches within a string.
244
+ * @param replaceValue The replacement text.
245
245
  */
246
246
  replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string;
247
247
 
@@ -23,3 +23,4 @@ and limitations under the License.
23
23
  /// <reference lib="es2019.object" />
24
24
  /// <reference lib="es2019.string" />
25
25
  /// <reference lib="es2019.symbol" />
26
+ /// <reference lib="es2019.intl" />
@@ -0,0 +1,25 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation. All rights reserved.
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
+ this file except in compliance with the License. You may obtain a copy of the
5
+ License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
+ MERCHANTABLITY OR NON-INFRINGEMENT.
11
+
12
+ See the Apache Version 2.0 License for specific language governing permissions
13
+ and limitations under the License.
14
+ ***************************************************************************** */
15
+
16
+
17
+
18
+ /// <reference no-default-lib="true"/>
19
+
20
+
21
+ declare namespace Intl {
22
+ interface DateTimeFormatPartTypesRegistry {
23
+ unknown: any
24
+ }
25
+ }
@@ -103,7 +103,7 @@ declare namespace Intl {
103
103
  *
104
104
  * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
105
105
  */
106
- type LocalesArgument = UnicodeBCP47LocaleIdentifier | Locale | (UnicodeBCP47LocaleIdentifier | Locale)[] | undefined;
106
+ type LocalesArgument = UnicodeBCP47LocaleIdentifier | Locale | readonly (UnicodeBCP47LocaleIdentifier | Locale)[] | undefined;
107
107
 
108
108
  /**
109
109
  * An object with some or all of properties of `options` parameter
@@ -214,12 +214,6 @@ interface ObjectConstructor {
214
214
  */
215
215
  seal<T>(o: T): T;
216
216
 
217
- /**
218
- * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
219
- * @param a Object on which to lock the attributes.
220
- */
221
- freeze<T>(a: T[]): readonly T[];
222
-
223
217
  /**
224
218
  * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
225
219
  * @param f Object on which to lock the attributes.
@@ -449,8 +443,8 @@ interface String {
449
443
 
450
444
  /**
451
445
  * Replaces text in a string, using a regular expression or search string.
452
- * @param searchValue A string to search for.
453
- * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.
446
+ * @param searchValue A string or regular expression to search for.
447
+ * @param replaceValue A string containing the text to replace. When the {@linkcode searchValue} is a `RegExp`, all matches are replaced if the `g` flag is set (or only those matches at the beginning, if the `y` flag is also present). Otherwise, only the first match of {@linkcode searchValue} is replaced.
454
448
  */
455
449
  replace(searchValue: string | RegExp, replaceValue: string): string;
456
450
 
@@ -908,7 +902,17 @@ interface Date {
908
902
  interface DateConstructor {
909
903
  new(): Date;
910
904
  new(value: number | string): Date;
911
- new(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;
905
+ /**
906
+ * Creates a new Date.
907
+ * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.
908
+ * @param monthIndex The month as a number between 0 and 11 (January to December).
909
+ * @param date The date as a number between 1 and 31.
910
+ * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour.
911
+ * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes.
912
+ * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds.
913
+ * @param ms A number from 0 to 999 that specifies the milliseconds.
914
+ */
915
+ new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;
912
916
  (): string;
913
917
  readonly prototype: Date;
914
918
  /**
@@ -919,14 +923,15 @@ interface DateConstructor {
919
923
  /**
920
924
  * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.
921
925
  * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.
922
- * @param month The month as a number between 0 and 11 (January to December).
926
+ * @param monthIndex The month as a number between 0 and 11 (January to December).
923
927
  * @param date The date as a number between 1 and 31.
924
928
  * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour.
925
929
  * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes.
926
930
  * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds.
927
931
  * @param ms A number from 0 to 999 that specifies the milliseconds.
928
932
  */
929
- UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number;
933
+ UTC(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number;
934
+ /** Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC). */
930
935
  now(): number;
931
936
  }
932
937
 
@@ -941,6 +946,10 @@ interface RegExpMatchArray extends Array<string> {
941
946
  * A copy of the search string.
942
947
  */
943
948
  input?: string;
949
+ /**
950
+ * The first match. This will always be present because `null` will be returned if there are no matches.
951
+ */
952
+ 0: string;
944
953
  }
945
954
 
946
955
  interface RegExpExecArray extends Array<string> {
@@ -952,6 +961,10 @@ interface RegExpExecArray extends Array<string> {
952
961
  * A copy of the search string.
953
962
  */
954
963
  input: string;
964
+ /**
965
+ * The first match. This will always be present because `null` will be returned if there are no matches.
966
+ */
967
+ 0: string;
955
968
  }
956
969
 
957
970
  interface RegExp {
@@ -1532,8 +1545,8 @@ interface Promise<T> {
1532
1545
  */
1533
1546
  type Awaited<T> =
1534
1547
  T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode
1535
- T extends object & { then(onfulfilled: infer F): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped
1536
- F extends ((value: infer V, ...args: any) => any) ? // if the argument to `then` is callable, extracts the first argument
1548
+ T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped
1549
+ F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument
1537
1550
  Awaited<V> : // recursively unwrap the value
1538
1551
  never : // the argument to `then` was not callable
1539
1552
  T; // non-object or non-thenable