svelte 4.0.0 → 4.0.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/README.md +1 -1
- package/compiler.cjs +604 -226
- package/package.json +15 -14
- package/src/compiler/compile/internal_exports.js +1 -1
- package/src/compiler/compile/nodes/Element.js +5 -1
- package/src/compiler/compile/nodes/shared/Context.js +1 -0
- package/src/compiler/compile/render_dom/wrappers/Element/Attribute.js +12 -1
- package/src/compiler/compile/render_dom/wrappers/Element/index.js +12 -4
- package/src/compiler/compile/render_dom/wrappers/RawMustacheTag.js +1 -1
- package/src/runtime/action/public.d.ts +7 -10
- package/src/runtime/internal/Component.js +89 -83
- package/src/runtime/internal/public.d.ts +4 -6
- package/src/runtime/internal/utils.js +36 -1
- package/src/shared/version.js +1 -1
- package/types/index.d.ts +11 -16
- package/types/index.d.ts.map +1 -1
- package/src/compiler/tsconfig.json +0 -15
- package/src/runtime/tsconfig.json +0 -18
package/types/index.d.ts
CHANGED
|
@@ -78,14 +78,12 @@ declare module 'svelte' {
|
|
|
78
78
|
interface EventDispatcher<EventMap extends Record<string, any>> {
|
|
79
79
|
// Implementation notes:
|
|
80
80
|
// - undefined extends X instead of X extends undefined makes this work better with both strict and nonstrict mode
|
|
81
|
-
// -
|
|
81
|
+
// - | null | undefined is added for convenience, as they are equivalent for the custom event constructor (both result in a null detail)
|
|
82
82
|
<Type extends keyof EventMap>(
|
|
83
|
-
...args:
|
|
84
|
-
? [type: Type, parameter?: null | undefined, options?: DispatchOptions]
|
|
85
|
-
: null extends EventMap[Type]
|
|
86
|
-
? [type: Type, parameter?: EventMap[Type], options?: DispatchOptions]
|
|
83
|
+
...args: null extends EventMap[Type]
|
|
84
|
+
? [type: Type, parameter?: EventMap[Type] | null | undefined, options?: DispatchOptions]
|
|
87
85
|
: undefined extends EventMap[Type]
|
|
88
|
-
? [type: Type, parameter?: EventMap[Type], options?: DispatchOptions]
|
|
86
|
+
? [type: Type, parameter?: EventMap[Type] | null | undefined, options?: DispatchOptions]
|
|
89
87
|
: [type: Type, parameter: EventMap[Type], options?: DispatchOptions]
|
|
90
88
|
): boolean;
|
|
91
89
|
}
|
|
@@ -1301,8 +1299,8 @@ declare module 'svelte/action' {
|
|
|
1301
1299
|
/**
|
|
1302
1300
|
* Actions can return an object containing the two properties defined in this interface. Both are optional.
|
|
1303
1301
|
* - update: An action can have a parameter. This method will be called whenever that parameter changes,
|
|
1304
|
-
* immediately after Svelte has applied updates to the markup. `ActionReturn` and `ActionReturn<
|
|
1305
|
-
* mean that the action accepts no parameters
|
|
1302
|
+
* immediately after Svelte has applied updates to the markup. `ActionReturn` and `ActionReturn<undefined>` both
|
|
1303
|
+
* mean that the action accepts no parameters.
|
|
1306
1304
|
* - destroy: Method that is called after the element is unmounted
|
|
1307
1305
|
*
|
|
1308
1306
|
* Additionally, you can specify which additional attributes and events the action enables on the applied element.
|
|
@@ -1327,10 +1325,10 @@ declare module 'svelte/action' {
|
|
|
1327
1325
|
* Docs: https://svelte.dev/docs/svelte-action
|
|
1328
1326
|
*/
|
|
1329
1327
|
export interface ActionReturn<
|
|
1330
|
-
Parameter =
|
|
1328
|
+
Parameter = undefined,
|
|
1331
1329
|
Attributes extends Record<string, any> = Record<never, any>
|
|
1332
1330
|
> {
|
|
1333
|
-
update?:
|
|
1331
|
+
update?: (parameter: Parameter) => void;
|
|
1334
1332
|
destroy?: () => void;
|
|
1335
1333
|
/**
|
|
1336
1334
|
* ### DO NOT USE THIS
|
|
@@ -1350,7 +1348,7 @@ declare module 'svelte/action' {
|
|
|
1350
1348
|
* // ...
|
|
1351
1349
|
* }
|
|
1352
1350
|
* ```
|
|
1353
|
-
* `Action<HTMLDivElement>` and `Action<HTMLDiveElement,
|
|
1351
|
+
* `Action<HTMLDivElement>` and `Action<HTMLDiveElement, undefined>` both signal that the action accepts no parameters.
|
|
1354
1352
|
*
|
|
1355
1353
|
* You can return an object with methods `update` and `destroy` from the function and type which additional attributes and events it has.
|
|
1356
1354
|
* See interface `ActionReturn` for more details.
|
|
@@ -1359,13 +1357,11 @@ declare module 'svelte/action' {
|
|
|
1359
1357
|
*/
|
|
1360
1358
|
export interface Action<
|
|
1361
1359
|
Element = HTMLElement,
|
|
1362
|
-
Parameter =
|
|
1360
|
+
Parameter = undefined,
|
|
1363
1361
|
Attributes extends Record<string, any> = Record<never, any>
|
|
1364
1362
|
> {
|
|
1365
1363
|
<Node extends Element>(
|
|
1366
|
-
...args:
|
|
1367
|
-
? [node: Node]
|
|
1368
|
-
: undefined extends Parameter
|
|
1364
|
+
...args: undefined extends Parameter
|
|
1369
1365
|
? [node: Node, parameter?: Parameter]
|
|
1370
1366
|
: [node: Node, parameter: Parameter]
|
|
1371
1367
|
): void | ActionReturn<Parameter, Attributes>;
|
|
@@ -1373,7 +1369,6 @@ declare module 'svelte/action' {
|
|
|
1373
1369
|
|
|
1374
1370
|
// Implementation notes:
|
|
1375
1371
|
// - undefined extends X instead of X extends undefined makes this work better with both strict and nonstrict mode
|
|
1376
|
-
// - [X] extends [never] is needed, X extends never would reduce the whole resulting type to never and not to one of the condition outcomes
|
|
1377
1372
|
}
|
|
1378
1373
|
|
|
1379
1374
|
declare module 'svelte/animate' {
|
package/types/index.d.ts.map
CHANGED
|
@@ -179,5 +179,5 @@
|
|
|
179
179
|
null,
|
|
180
180
|
null
|
|
181
181
|
],
|
|
182
|
-
"mappings": ";kBAGiBA,2BAA2BA;;;;;;;;;;;;;;;;;;;;;;;;;;;aA2BhCC,eAAeA;;;;;;;;;;;;;;aAcfC,cAAcA;;;;;;;;;;;;;;;;;;;;;;aAsBdC,aAAaA;;;;;;;;;WASRC,eAAeA;;;;WAIfC,eAAeA
|
|
182
|
+
"mappings": ";kBAGiBA,2BAA2BA;;;;;;;;;;;;;;;;;;;;;;;;;;;aA2BhCC,eAAeA;;;;;;;;;;;;;;aAcfC,cAAcA;;;;;;;;;;;;;;;;;;;;;;aAsBdC,aAAaA;;;;;;;;;WASRC,eAAeA;;;;WA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kBAURS,QAAQA;;;;;;;;;;;;;;MEjCbJ,WAAWA;;;MAMXK,MAAMA;;;;;;MAMNC,YAAYA;;;;;;;;;iBGKRC,QAAQA;;;;;;;iBAeRC,QAAQA;;;;;;;;;iBA6JRC,QAAQA;;;;;;;;;;aChMZC,cAAcA;;kBAETC,gBAAgBA;;;;;;;;kBAQhBC,UAAUA;;;;;;;;kBAQVC,UAAUA;;;;;;kBAMVC,SAASA;;;;;;;;;kBASTC,WAAWA;;;;;;;kBAOXC,WAAWA;;;;;;;;kBAQXC,UAAUA;;;;;;;kBAOVC,eAAeA;;;;;;;;;;iBC5ChBC,IAAIA;;;;;;iBAyBJC,IAAIA;;;;;;iBAkBJC,GAAGA;;;;;;iBA4BHC,KAAKA;;;;;;iBA4CLC,KAAKA;;;;;;iBA4BLC,IAAIA;;;;;;;;iBAmCJC,SAASA"
|
|
183
183
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.json",
|
|
3
|
-
"include": ["."],
|
|
4
|
-
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"lib": ["es2017", "webworker"],
|
|
7
|
-
"allowJs": true,
|
|
8
|
-
"checkJs": true,
|
|
9
|
-
// silences wrong TS error, we don't compile, we only typecheck
|
|
10
|
-
"outDir": "./irrelevant/unused"
|
|
11
|
-
|
|
12
|
-
// TODO: remove mocha types from the whole project
|
|
13
|
-
// "types": ["node", "estree"]
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.json",
|
|
3
|
-
"include": ["."],
|
|
4
|
-
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"lib": ["es2015", "dom", "dom.iterable"],
|
|
7
|
-
"target": "es2015",
|
|
8
|
-
"types": [],
|
|
9
|
-
|
|
10
|
-
"baseUrl": ".",
|
|
11
|
-
"paths": {
|
|
12
|
-
"svelte": ["."],
|
|
13
|
-
"svelte/*": ["*"]
|
|
14
|
-
},
|
|
15
|
-
"allowJs": true,
|
|
16
|
-
"checkJs": true
|
|
17
|
-
}
|
|
18
|
-
}
|