svelte 3.46.3 → 3.46.6

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/internal/index.js CHANGED
@@ -1767,7 +1767,8 @@ function create_ssr_component(fn) {
1767
1767
  function add_attribute(name, value, boolean) {
1768
1768
  if (value == null || (boolean && !value))
1769
1769
  return '';
1770
- return ` ${name}${value === true && boolean_attributes.has(name) ? '' : `=${typeof value === 'string' ? JSON.stringify(escape(value)) : `"${value}"`}`}`;
1770
+ const assignment = (boolean && value === true) ? '' : `="${escape_attribute_value(value.toString())}"`;
1771
+ return ` ${name}${assignment}`;
1771
1772
  }
1772
1773
  function add_classes(classes) {
1773
1774
  return classes ? ` class="${classes}"` : '';
@@ -1969,7 +1970,7 @@ class SvelteComponent {
1969
1970
  }
1970
1971
 
1971
1972
  function dispatch_dev(type, detail) {
1972
- document.dispatchEvent(custom_event(type, Object.assign({ version: '3.46.3' }, detail), true));
1973
+ document.dispatchEvent(custom_event(type, Object.assign({ version: '3.46.6' }, detail), true));
1973
1974
  }
1974
1975
  function append_dev(target, node) {
1975
1976
  dispatch_dev('SvelteDOMInsert', { target, node });
@@ -1764,7 +1764,8 @@ function create_ssr_component(fn) {
1764
1764
  function add_attribute(name, value, boolean) {
1765
1765
  if (value == null || (boolean && !value))
1766
1766
  return '';
1767
- return ` ${name}${value === true && boolean_attributes.has(name) ? '' : `=${typeof value === 'string' ? JSON.stringify(escape(value)) : `"${value}"`}`}`;
1767
+ const assignment = (boolean && value === true) ? '' : `="${escape_attribute_value(value.toString())}"`;
1768
+ return ` ${name}${assignment}`;
1768
1769
  }
1769
1770
  function add_classes(classes) {
1770
1771
  return classes ? ` class="${classes}"` : '';
@@ -1967,7 +1968,7 @@ class SvelteComponent {
1967
1968
  }
1968
1969
 
1969
1970
  function dispatch_dev(type, detail) {
1970
- document.dispatchEvent(custom_event(type, Object.assign({ version: '3.46.3' }, detail), true));
1971
+ document.dispatchEvent(custom_event(type, Object.assign({ version: '3.46.6' }, detail), true));
1971
1972
  }
1972
1973
  function append_dev(target, node) {
1973
1974
  dispatch_dev('SvelteDOMInsert', { target, node });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte",
3
- "version": "3.46.3",
3
+ "version": "3.46.6",
4
4
  "description": "Cybernetically enhanced web apps",
5
5
  "module": "index.mjs",
6
6
  "main": "index",
@@ -16,7 +16,7 @@
16
16
  "transition",
17
17
  "easing",
18
18
  "motion",
19
- "svelte",
19
+ "action",
20
20
  "README.md"
21
21
  ],
22
22
  "exports": {
@@ -39,6 +39,9 @@
39
39
  "import": "./compiler.mjs",
40
40
  "require": "./compiler.js"
41
41
  },
42
+ "./action": {
43
+ "types": "./types/runtime/action/index.d.ts"
44
+ },
42
45
  "./animate": {
43
46
  "types": "./types/runtime/animate/index.d.ts",
44
47
  "import": "./animate/index.mjs",
@@ -86,10 +89,6 @@
86
89
  "test": "mocha --exit",
87
90
  "test:unit": "mocha --require sucrase/register --recursive src/**/__test__.ts --exit",
88
91
  "quicktest": "mocha",
89
- "precoverage": "c8 mocha",
90
- "coverage": "c8 report --reporter=text-lcov > coverage.lcov && c8 report --reporter=html",
91
- "codecov": "codecov",
92
- "precodecov": "npm run coverage",
93
92
  "build": "rollup -c && npm run tsd",
94
93
  "prepare": "npm run build",
95
94
  "dev": "rollup -cw",
@@ -114,7 +113,7 @@
114
113
  "bugs": {
115
114
  "url": "https://github.com/sveltejs/svelte/issues"
116
115
  },
117
- "homepage": "https://github.com/sveltejs/svelte#README",
116
+ "homepage": "https://svelte.dev",
118
117
  "devDependencies": {
119
118
  "@ampproject/remapping": "^0.3.0",
120
119
  "@rollup/plugin-commonjs": "^11.0.0",
@@ -131,9 +130,7 @@
131
130
  "@typescript-eslint/parser": "^4.31.2",
132
131
  "acorn": "^8.4.1",
133
132
  "agadoo": "^1.1.0",
134
- "c8": "^5.0.1",
135
- "code-red": "^0.2.4",
136
- "codecov": "^3.5.0",
133
+ "code-red": "^0.2.5",
137
134
  "css-tree": "^1.1.2",
138
135
  "eslint": "^7.32.0",
139
136
  "eslint-plugin-import": "^2.24.2",
@@ -9,4 +9,6 @@ export default class Text extends Node {
9
9
  synthetic: boolean;
10
10
  constructor(component: Component, parent: INode, scope: TemplateScope, info: TemplateNode);
11
11
  should_skip(): any;
12
+ keep_space(): boolean;
13
+ within_pre(): boolean;
12
14
  }
@@ -91,9 +91,9 @@ export interface Style extends BaseNode {
91
91
  }
92
92
  export interface Ast {
93
93
  html: TemplateNode;
94
- css: Style;
95
- instance: Script;
96
- module: Script;
94
+ css?: Style;
95
+ instance?: Script;
96
+ module?: Script;
97
97
  }
98
98
  export interface Warning {
99
99
  start?: {
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Pushes all `items` into `array` using `push`, therefore mutating the array.
3
+ * We do this for memory and perf reasons, and because `array.push(...items)` would
4
+ * run into a "max call stack size exceeded" error with too many items (~65k).
5
+ * @param array
6
+ * @param items
7
+ */
8
+ export declare function push_array<T>(array: T[], items: T[]): void;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Actions can return an object containing the two properties defined in this interface. Both are optional.
3
+ * - update: An action can have a parameter. This method will be called whenever that parameter changes,
4
+ * immediately after Svelte has applied updates to the markup.
5
+ * - destroy: Method that is called after the element is unmounted
6
+ *
7
+ * Example usage:
8
+ * ```ts
9
+ * export function myAction(node: HTMLElement, parameter: Parameter): ActionReturn<Parameter> {
10
+ * // ...
11
+ * return {
12
+ * update: (updatedParameter) => {...},
13
+ * destroy: () => {...}
14
+ * };
15
+ * }
16
+ * ```
17
+ *
18
+ * Docs: https://svelte.dev/docs#template-syntax-element-directives-use-action
19
+ */
20
+ export interface ActionReturn<Parameter = any> {
21
+ update?: (parameter: Parameter) => void;
22
+ destroy?: () => void;
23
+ }
24
+ /**
25
+ * Actions are functions that are called when an element is created.
26
+ * You can use this interface to type such actions.
27
+ * The following example defines an action that only works on `<div>` elements
28
+ * and optionally accepts a parameter which it has a default value for:
29
+ * ```ts
30
+ * export const myAction: Action<HTMLDivElement, { someProperty: boolean }> = (node, param = { someProperty: true }) => {
31
+ * // ...
32
+ * }
33
+ * ```
34
+ * You can return an object with methods `update` and `destroy` from the function.
35
+ * See interface `ActionReturn` for more details.
36
+ *
37
+ * Docs: https://svelte.dev/docs#template-syntax-element-directives-use-action
38
+ */
39
+ export interface Action<Element = HTMLElement, Parameter = any> {
40
+ <Node extends Element>(node: Node, parameter?: Parameter): void | ActionReturn<Parameter>;
41
+ }