ripple 0.3.17 → 0.3.18
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/CHANGELOG.md +7 -0
- package/package.json +2 -2
- package/src/runtime/element.js +11 -11
- package/src/runtime/internal/client/composite.js +2 -2
- package/src/runtime/internal/client/expression.js +5 -5
- package/src/runtime/internal/client/index.js +1 -1
- package/src/runtime/internal/client/portal.js +4 -4
- package/src/runtime/internal/server/index.js +4 -4
- package/tests/client/__snapshots__/computed-properties.test.tsrx.snap +49 -0
- package/tests/client/__snapshots__/for.test.tsrx.snap +319 -0
- package/tests/client/__snapshots__/html.test.tsrx.snap +40 -0
- package/tests/client/basic/__snapshots__/basic.attributes.test.tsrx.snap +60 -0
- package/tests/client/basic/__snapshots__/basic.rendering.test.tsrx.snap +59 -0
- package/tests/client/basic/{basic.components.test.rsrx → basic.components.test.tsrx} +51 -1
- package/tests/client/basic/{basic.errors.test.rsrx → basic.errors.test.tsrx} +12 -12
- package/tests/client/basic/{basic.styling.test.rsrx → basic.styling.test.tsrx} +1 -1
- package/tests/client/compiler/__snapshots__/compiler.assignments.test.tsrx.snap +12 -0
- package/tests/client/compiler/__snapshots__/compiler.typescript.test.tsrx.snap +46 -0
- package/tests/client/compiler/{compiler.assignments.test.rsrx → compiler.assignments.test.tsrx} +2 -2
- package/tests/client/compiler/{compiler.attributes.test.rsrx → compiler.attributes.test.tsrx} +4 -4
- package/tests/client/compiler/{compiler.basic.test.rsrx → compiler.basic.test.tsrx} +44 -30
- package/tests/client/compiler/{compiler.tracked-access.test.rsrx → compiler.tracked-access.test.tsrx} +16 -16
- package/tests/client/compiler/{compiler.try-in-function.test.rsrx → compiler.try-in-function.test.tsrx} +8 -8
- package/tests/client/compiler/{compiler.typescript.test.rsrx → compiler.typescript.test.tsrx} +4 -4
- package/tests/client/composite/__snapshots__/composite.render.test.tsrx.snap +37 -0
- package/tests/client/css/{global-additional-cases.test.rsrx → global-additional-cases.test.tsrx} +27 -27
- package/tests/client/css/{global-advanced-selectors.test.rsrx → global-advanced-selectors.test.tsrx} +8 -8
- package/tests/client/css/{global-at-rules.test.rsrx → global-at-rules.test.tsrx} +5 -5
- package/tests/client/css/{global-basic.test.rsrx → global-basic.test.tsrx} +7 -7
- package/tests/client/css/{global-classes-ids.test.rsrx → global-classes-ids.test.tsrx} +7 -7
- package/tests/client/css/{global-combinators.test.rsrx → global-combinators.test.tsrx} +5 -5
- package/tests/client/css/{global-complex-nesting.test.rsrx → global-complex-nesting.test.tsrx} +7 -7
- package/tests/client/css/{global-edge-cases.test.rsrx → global-edge-cases.test.tsrx} +9 -9
- package/tests/client/css/{global-keyframes.test.rsrx → global-keyframes.test.tsrx} +5 -5
- package/tests/client/css/{global-nested.test.rsrx → global-nested.test.tsrx} +5 -5
- package/tests/client/css/{global-pseudo.test.rsrx → global-pseudo.test.tsrx} +6 -6
- package/tests/client/css/{global-scoping.test.rsrx → global-scoping.test.tsrx} +10 -10
- package/tests/client/css/{style-identifier.test.rsrx → style-identifier.test.tsrx} +12 -16
- package/tests/client/{function-overload.test.rsrx → function-overload.test.tsrx} +1 -1
- package/tests/client/{return.test.rsrx → return.test.tsrx} +16 -18
- package/tests/hydration/build-components.js +2 -4
- package/tests/hydration/compiled/client/basic.js +1 -1
- package/tests/hydration/compiled/client/composite.js +4 -4
- package/tests/hydration/compiled/client/head.js +11 -11
- package/tests/hydration/compiled/client/hmr.js +1 -1
- package/tests/hydration/compiled/client/html.js +19 -19
- package/tests/hydration/compiled/client/if-children.js +2 -2
- package/tests/hydration/compiled/client/portal.js +4 -4
- package/tests/hydration/compiled/server/basic.js +1 -1
- package/tests/hydration/compiled/server/composite.js +4 -4
- package/tests/hydration/compiled/server/head.js +11 -11
- package/tests/hydration/compiled/server/hmr.js +1 -1
- package/tests/hydration/compiled/server/html.js +19 -19
- package/tests/hydration/compiled/server/if-children.js +2 -2
- package/tests/hydration/compiled/server/portal.js +4 -4
- package/tests/hydration/components/{html-in-template.rsrx → html-in-template.tsrx} +1 -1
- package/tests/server/__snapshots__/compiler.test.tsrx.snap +95 -0
- package/tests/server/{basic.components.test.rsrx → basic.components.test.tsrx} +48 -0
- package/tests/server/{compiler.test.rsrx → compiler.test.tsrx} +17 -17
- package/tests/server/{html-nesting-validation.test.rsrx → html-nesting-validation.test.tsrx} +38 -38
- package/tests/server/{style-identifier.test.rsrx → style-identifier.test.tsrx} +1 -1
- package/tests/utils/compiler-compat-config.test.js +3 -3
- package/tests/utils/vite-plugin-config.test.js +1 -1
- package/tests/utils/vite-plugin-hmr.test.js +7 -7
- package/tsconfig.json +0 -4
- package/types/index.d.ts +6 -4
- /package/tests/client/{_etc.test.rsrx → _etc.test.tsrx} +0 -0
- /package/tests/client/array/{array.copy-within.test.rsrx → array.copy-within.test.tsrx} +0 -0
- /package/tests/client/array/{array.derived.test.rsrx → array.derived.test.tsrx} +0 -0
- /package/tests/client/array/{array.iteration.test.rsrx → array.iteration.test.tsrx} +0 -0
- /package/tests/client/array/{array.mutations.test.rsrx → array.mutations.test.tsrx} +0 -0
- /package/tests/client/array/{array.static.test.rsrx → array.static.test.tsrx} +0 -0
- /package/tests/client/array/{array.to-methods.test.rsrx → array.to-methods.test.tsrx} +0 -0
- /package/tests/client/{async-suspend.test.rsrx → async-suspend.test.tsrx} +0 -0
- /package/tests/client/basic/{basic.attributes.test.rsrx → basic.attributes.test.tsrx} +0 -0
- /package/tests/client/basic/{basic.collections.test.rsrx → basic.collections.test.tsrx} +0 -0
- /package/tests/client/basic/{basic.events.test.rsrx → basic.events.test.tsrx} +0 -0
- /package/tests/client/basic/{basic.get-set.test.rsrx → basic.get-set.test.tsrx} +0 -0
- /package/tests/client/basic/{basic.hmr.test.rsrx → basic.hmr.test.tsrx} +0 -0
- /package/tests/client/basic/{basic.reactivity.test.rsrx → basic.reactivity.test.tsrx} +0 -0
- /package/tests/client/basic/{basic.rendering.test.rsrx → basic.rendering.test.tsrx} +0 -0
- /package/tests/client/basic/{basic.utilities.test.rsrx → basic.utilities.test.tsrx} +0 -0
- /package/tests/client/{boundaries.test.rsrx → boundaries.test.tsrx} +0 -0
- /package/tests/client/compiler/{compiler.regex.test.rsrx → compiler.regex.test.tsrx} +0 -0
- /package/tests/client/composite/{composite.dynamic-components.test.rsrx → composite.dynamic-components.test.tsrx} +0 -0
- /package/tests/client/composite/{composite.generics.test.rsrx → composite.generics.test.tsrx} +0 -0
- /package/tests/client/composite/{composite.props.test.rsrx → composite.props.test.tsrx} +0 -0
- /package/tests/client/composite/{composite.reactivity.test.rsrx → composite.reactivity.test.tsrx} +0 -0
- /package/tests/client/composite/{composite.render.test.rsrx → composite.render.test.tsrx} +0 -0
- /package/tests/client/{computed-properties.test.rsrx → computed-properties.test.tsrx} +0 -0
- /package/tests/client/{context.test.rsrx → context.test.tsrx} +0 -0
- /package/tests/client/{date.test.rsrx → date.test.tsrx} +0 -0
- /package/tests/client/{dynamic-elements.test.rsrx → dynamic-elements.test.tsrx} +0 -0
- /package/tests/client/{events.test.rsrx → events.test.tsrx} +0 -0
- /package/tests/client/{for.test.rsrx → for.test.tsrx} +0 -0
- /package/tests/client/{function-overload-import.rsrx → function-overload-import.tsrx} +0 -0
- /package/tests/client/{head.test.rsrx → head.test.tsrx} +0 -0
- /package/tests/client/{html.test.rsrx → html.test.tsrx} +0 -0
- /package/tests/client/{input-value.test.rsrx → input-value.test.tsrx} +0 -0
- /package/tests/client/{lazy-destructuring.test.rsrx → lazy-destructuring.test.tsrx} +0 -0
- /package/tests/client/{map.test.rsrx → map.test.tsrx} +0 -0
- /package/tests/client/{media-query.test.rsrx → media-query.test.tsrx} +0 -0
- /package/tests/client/{object.test.rsrx → object.test.tsrx} +0 -0
- /package/tests/client/{portal.test.rsrx → portal.test.tsrx} +0 -0
- /package/tests/client/{ref.test.rsrx → ref.test.tsrx} +0 -0
- /package/tests/client/{set.test.rsrx → set.test.tsrx} +0 -0
- /package/tests/client/{svg.test.rsrx → svg.test.tsrx} +0 -0
- /package/tests/client/{switch.test.rsrx → switch.test.tsrx} +0 -0
- /package/tests/client/{try.test.rsrx → try.test.tsrx} +0 -0
- /package/tests/client/{tsx.test.rsrx → tsx.test.tsrx} +0 -0
- /package/tests/client/{typescript-generics.test.rsrx → typescript-generics.test.tsrx} +0 -0
- /package/tests/client/url/{url.derived.test.rsrx → url.derived.test.tsrx} +0 -0
- /package/tests/client/url/{url.parsing.test.rsrx → url.parsing.test.tsrx} +0 -0
- /package/tests/client/url/{url.partial-removal.test.rsrx → url.partial-removal.test.tsrx} +0 -0
- /package/tests/client/url/{url.reactivity.test.rsrx → url.reactivity.test.tsrx} +0 -0
- /package/tests/client/url/{url.serialization.test.rsrx → url.serialization.test.tsrx} +0 -0
- /package/tests/client/url-search-params/{url-search-params.derived.test.rsrx → url-search-params.derived.test.tsrx} +0 -0
- /package/tests/client/url-search-params/{url-search-params.initialization.test.rsrx → url-search-params.initialization.test.tsrx} +0 -0
- /package/tests/client/url-search-params/{url-search-params.iteration.test.rsrx → url-search-params.iteration.test.tsrx} +0 -0
- /package/tests/client/url-search-params/{url-search-params.mutation.test.rsrx → url-search-params.mutation.test.tsrx} +0 -0
- /package/tests/client/url-search-params/{url-search-params.retrieval.test.rsrx → url-search-params.retrieval.test.tsrx} +0 -0
- /package/tests/client/url-search-params/{url-search-params.serialization.test.rsrx → url-search-params.serialization.test.tsrx} +0 -0
- /package/tests/client/url-search-params/{url-search-params.tracked-url.test.rsrx → url-search-params.tracked-url.test.tsrx} +0 -0
- /package/tests/hydration/components/{basic.rsrx → basic.tsrx} +0 -0
- /package/tests/hydration/components/{composite.rsrx → composite.tsrx} +0 -0
- /package/tests/hydration/components/{events.rsrx → events.tsrx} +0 -0
- /package/tests/hydration/components/{for.rsrx → for.tsrx} +0 -0
- /package/tests/hydration/components/{head.rsrx → head.tsrx} +0 -0
- /package/tests/hydration/components/{hmr.rsrx → hmr.tsrx} +0 -0
- /package/tests/hydration/components/{html.rsrx → html.tsrx} +0 -0
- /package/tests/hydration/components/{if-children.rsrx → if-children.tsrx} +0 -0
- /package/tests/hydration/components/{if.rsrx → if.tsrx} +0 -0
- /package/tests/hydration/components/{mixed-control-flow.rsrx → mixed-control-flow.tsrx} +0 -0
- /package/tests/hydration/components/{nested-control-flow.rsrx → nested-control-flow.tsrx} +0 -0
- /package/tests/hydration/components/{portal.rsrx → portal.tsrx} +0 -0
- /package/tests/hydration/components/{reactivity.rsrx → reactivity.tsrx} +0 -0
- /package/tests/hydration/components/{return.rsrx → return.tsrx} +0 -0
- /package/tests/hydration/components/{switch.rsrx → switch.tsrx} +0 -0
- /package/tests/hydration/components/{try.rsrx → try.tsrx} +0 -0
- /package/tests/server/{await.test.rsrx → await.test.tsrx} +0 -0
- /package/tests/server/{basic.attributes.test.rsrx → basic.attributes.test.tsrx} +0 -0
- /package/tests/server/{basic.test.rsrx → basic.test.tsrx} +0 -0
- /package/tests/server/{composite.props.test.rsrx → composite.props.test.tsrx} +0 -0
- /package/tests/server/{composite.test.rsrx → composite.test.tsrx} +0 -0
- /package/tests/server/{context.test.rsrx → context.test.tsrx} +0 -0
- /package/tests/server/{dynamic-elements.test.rsrx → dynamic-elements.test.tsrx} +0 -0
- /package/tests/server/{for.test.rsrx → for.test.tsrx} +0 -0
- /package/tests/server/{head.test.rsrx → head.test.tsrx} +0 -0
- /package/tests/server/{if.test.rsrx → if.test.tsrx} +0 -0
- /package/tests/server/{lazy-destructuring.test.rsrx → lazy-destructuring.test.tsrx} +0 -0
- /package/tests/server/{return.test.rsrx → return.test.tsrx} +0 -0
- /package/tests/server/{streaming-ssr.test.rsrx → streaming-ssr.test.tsrx} +0 -0
- /package/tests/server/{switch.test.rsrx → switch.test.tsrx} +0 -0
- /package/tests/server/{try.test.rsrx → try.test.tsrx} +0 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Ripple is an elegant TypeScript UI framework",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Dominic Gannaway",
|
|
6
|
-
"version": "0.3.
|
|
6
|
+
"version": "0.3.18",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"module": "src/runtime/index-client.js",
|
|
9
9
|
"main": "src/runtime/index-client.js",
|
|
@@ -86,6 +86,6 @@
|
|
|
86
86
|
"@tsrx/ripple": "0.0.5"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
|
-
"ripple": "0.3.
|
|
89
|
+
"ripple": "0.3.18"
|
|
90
90
|
}
|
|
91
91
|
}
|
package/src/runtime/element.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
const
|
|
1
|
+
const TSRX_ELEMENT = Symbol.for('ripple.element');
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @typedef {{
|
|
5
5
|
* render: Function;
|
|
6
|
-
* [
|
|
7
|
-
* }}
|
|
6
|
+
* [TSRX_ELEMENT]: true;
|
|
7
|
+
* }} TSRXElement
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @param {Function} render
|
|
12
|
-
* @returns {
|
|
12
|
+
* @returns {TSRXElement}
|
|
13
13
|
*/
|
|
14
|
-
export function
|
|
14
|
+
export function tsrx_element(render) {
|
|
15
15
|
return {
|
|
16
16
|
render,
|
|
17
|
-
[
|
|
17
|
+
[TSRX_ELEMENT]: true,
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* @param {any} value
|
|
23
|
-
* @returns {value is
|
|
23
|
+
* @returns {value is TSRXElement}
|
|
24
24
|
*/
|
|
25
|
-
export function
|
|
26
|
-
return value != null && value[
|
|
25
|
+
export function is_tsrx_element(value) {
|
|
26
|
+
return value != null && value[TSRX_ELEMENT] === true;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -31,9 +31,9 @@ export function is_ripple_element(value) {
|
|
|
31
31
|
* @returns {any}
|
|
32
32
|
*/
|
|
33
33
|
export function normalize_children(value) {
|
|
34
|
-
if (value == null ||
|
|
34
|
+
if (value == null || is_tsrx_element(value) || typeof value !== 'function') {
|
|
35
35
|
return value;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
return
|
|
38
|
+
return tsrx_element(value);
|
|
39
39
|
}
|
|
@@ -5,7 +5,7 @@ import { COMPOSITE_BLOCK, DEFAULT_NAMESPACE, NAMESPACE_URI } from './constants.j
|
|
|
5
5
|
import { hydrate_next, hydrating } from './hydration.js';
|
|
6
6
|
import { active_block, active_namespace, get, with_ns } from './runtime.js';
|
|
7
7
|
import { top_element_to_ns } from './utils.js';
|
|
8
|
-
import {
|
|
8
|
+
import { is_tsrx_element } from '../../element.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @typedef {((anchor: Node, props: Record<string, any>, block: Block | null) => void)} ComponentFunction
|
|
@@ -69,7 +69,7 @@ export function composite(get_component, node, props) {
|
|
|
69
69
|
|
|
70
70
|
render_spread(element, () => props || {});
|
|
71
71
|
|
|
72
|
-
if (
|
|
72
|
+
if (is_tsrx_element(props?.children)) {
|
|
73
73
|
var child_anchor = document.createComment('');
|
|
74
74
|
element.appendChild(child_anchor);
|
|
75
75
|
|
|
@@ -6,7 +6,7 @@ import { create_text, get_next_sibling } from './operations.js';
|
|
|
6
6
|
import { active_block } from './runtime.js';
|
|
7
7
|
import { hydrating, set_hydrate_node } from './hydration.js';
|
|
8
8
|
import { COMMENT_NODE, HYDRATION_END, HYDRATION_START, TEXT_NODE } from '../../../constants.js';
|
|
9
|
-
import {
|
|
9
|
+
import { is_tsrx_element } from '../../element.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Finds the nearest enclosing BRANCH_BLOCK in the block hierarchy.
|
|
@@ -36,7 +36,7 @@ export function expression(node, get_value) {
|
|
|
36
36
|
var end = null;
|
|
37
37
|
/** @type {Text | null} */
|
|
38
38
|
var text = null;
|
|
39
|
-
/** @type {string | import('../../element.js').
|
|
39
|
+
/** @type {string | import('../../element.js').TSRXElement | typeof UNINITIALIZED} */
|
|
40
40
|
var value = UNINITIALIZED;
|
|
41
41
|
var is_element = false;
|
|
42
42
|
var initialized = false;
|
|
@@ -47,7 +47,7 @@ export function expression(node, get_value) {
|
|
|
47
47
|
|
|
48
48
|
render(() => {
|
|
49
49
|
var next_value = get_value();
|
|
50
|
-
var next_is_element =
|
|
50
|
+
var next_is_element = is_tsrx_element(next_value);
|
|
51
51
|
var is_hydration_marker = hydrating && anchor.nodeType === COMMENT_NODE;
|
|
52
52
|
|
|
53
53
|
if (is_hydration_marker) {
|
|
@@ -99,7 +99,7 @@ export function expression(node, get_value) {
|
|
|
99
99
|
|
|
100
100
|
// Update parent branch's s.start to include content inserted before anchor.
|
|
101
101
|
// This ensures that when the parent branch is destroyed, the full DOM range
|
|
102
|
-
// (including
|
|
102
|
+
// (including TSRXElement content) is removed.
|
|
103
103
|
if (
|
|
104
104
|
parent_branch !== null &&
|
|
105
105
|
parent_branch.s !== null &&
|
|
@@ -114,7 +114,7 @@ export function expression(node, get_value) {
|
|
|
114
114
|
// If parent's start is the anchor (or comes after child's start),
|
|
115
115
|
// update it to include the child's content
|
|
116
116
|
if (parent_start === anchor || parent_start === end) {
|
|
117
|
-
// Save original so we can restore it when switching to non-
|
|
117
|
+
// Save original so we can restore it when switching to non-TSRXElement
|
|
118
118
|
if (modified_parent_branch === null) {
|
|
119
119
|
modified_parent_branch = parent_branch;
|
|
120
120
|
original_parent_start = parent_start;
|
|
@@ -12,11 +12,11 @@ import {
|
|
|
12
12
|
set_hydrating,
|
|
13
13
|
set_hydrate_node,
|
|
14
14
|
} from './hydration.js';
|
|
15
|
-
import {
|
|
15
|
+
import { is_tsrx_element } from '../../element.js';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @param {any} _
|
|
19
|
-
* @param {{ target: Element, children: import('../../element.js').
|
|
19
|
+
* @param {{ target: Element, children: import('../../element.js').TSRXElement }} props
|
|
20
20
|
* @returns {void}
|
|
21
21
|
*/
|
|
22
22
|
export function Portal(_, props) {
|
|
@@ -27,7 +27,7 @@ export function Portal(_, props) {
|
|
|
27
27
|
|
|
28
28
|
/** @type {Element | symbol} */
|
|
29
29
|
let target = UNINITIALIZED;
|
|
30
|
-
/** @type {import('../../element.js').
|
|
30
|
+
/** @type {import('../../element.js').TSRXElement | symbol} */
|
|
31
31
|
let children = UNINITIALIZED;
|
|
32
32
|
/** @type {Block | null} */
|
|
33
33
|
var b = null;
|
|
@@ -71,7 +71,7 @@ export function Portal(_, props) {
|
|
|
71
71
|
var block = /** @type {Block} */ (active_block);
|
|
72
72
|
|
|
73
73
|
b = branch(() => {
|
|
74
|
-
if (
|
|
74
|
+
if (is_tsrx_element(children)) {
|
|
75
75
|
children.render(/** @type {Text} */ (anchor), block);
|
|
76
76
|
}
|
|
77
77
|
});
|
|
@@ -28,7 +28,7 @@ import { is_boolean_attribute } from '../../../utils/attributes.js';
|
|
|
28
28
|
import { clsx } from 'clsx';
|
|
29
29
|
import { normalize_css_property_name } from '../../../utils/normalize_css_property_name.js';
|
|
30
30
|
import { BLOCK_CLOSE, BLOCK_OPEN } from '../../../constants.js';
|
|
31
|
-
import {
|
|
31
|
+
import { is_tsrx_element, normalize_children, tsrx_element } from '../../element.js';
|
|
32
32
|
import {
|
|
33
33
|
is_tag_valid_with_parent,
|
|
34
34
|
is_tag_valid_with_ancestor,
|
|
@@ -48,7 +48,7 @@ export { hash } from '../../../utils/hashing.js';
|
|
|
48
48
|
export { context } from './context.js';
|
|
49
49
|
export { try_block, component_block, regular_block } from './blocks.js';
|
|
50
50
|
export { array_slice };
|
|
51
|
-
export {
|
|
51
|
+
export { tsrx_element, normalize_children };
|
|
52
52
|
|
|
53
53
|
export function noop() {}
|
|
54
54
|
|
|
@@ -59,7 +59,7 @@ export function noop() {}
|
|
|
59
59
|
export function render_expression(value) {
|
|
60
60
|
output_push(BLOCK_OPEN);
|
|
61
61
|
|
|
62
|
-
if (
|
|
62
|
+
if (is_tsrx_element(value)) {
|
|
63
63
|
value.render({});
|
|
64
64
|
} else {
|
|
65
65
|
output_push(escape(value ?? ''));
|
|
@@ -940,7 +940,7 @@ export function spread_attrs(attrs, css_hash) {
|
|
|
940
940
|
for (name in attrs) {
|
|
941
941
|
var value = attrs[name];
|
|
942
942
|
|
|
943
|
-
if (name === 'children' || typeof value === 'function' ||
|
|
943
|
+
if (name === 'children' || typeof value === 'function' || is_tsrx_element(value)) continue;
|
|
944
944
|
|
|
945
945
|
if (is_ripple_object(value)) {
|
|
946
946
|
value = get(value);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`computed tracked properties > should update a property using assignment 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div>
|
|
6
|
+
0
|
|
7
|
+
</div>
|
|
8
|
+
<button>
|
|
9
|
+
Increment
|
|
10
|
+
</button>
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
exports[`computed tracked properties > should update a property using assignment 2`] = `
|
|
16
|
+
<div>
|
|
17
|
+
<div>
|
|
18
|
+
1
|
|
19
|
+
</div>
|
|
20
|
+
<button>
|
|
21
|
+
Increment
|
|
22
|
+
</button>
|
|
23
|
+
|
|
24
|
+
</div>
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
exports[`computed tracked properties > should update a property using update expressions 1`] = `
|
|
28
|
+
<div>
|
|
29
|
+
<div>
|
|
30
|
+
0
|
|
31
|
+
</div>
|
|
32
|
+
<button>
|
|
33
|
+
Increment
|
|
34
|
+
</button>
|
|
35
|
+
|
|
36
|
+
</div>
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
exports[`computed tracked properties > should update a property using update expressions 2`] = `
|
|
40
|
+
<div>
|
|
41
|
+
<div>
|
|
42
|
+
1
|
|
43
|
+
</div>
|
|
44
|
+
<button>
|
|
45
|
+
Increment
|
|
46
|
+
</button>
|
|
47
|
+
|
|
48
|
+
</div>
|
|
49
|
+
`;
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`for statements > correctly handles intermediate statements in for block 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div>
|
|
6
|
+
<div>
|
|
7
|
+
<div>
|
|
8
|
+
1
|
|
9
|
+
</div>
|
|
10
|
+
<div>
|
|
11
|
+
1
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
<div>
|
|
15
|
+
<div>
|
|
16
|
+
2
|
|
17
|
+
</div>
|
|
18
|
+
<div>
|
|
19
|
+
2
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
<div>
|
|
23
|
+
<div>
|
|
24
|
+
3
|
|
25
|
+
</div>
|
|
26
|
+
<div>
|
|
27
|
+
3
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
</div>
|
|
32
|
+
<button>
|
|
33
|
+
Add Item
|
|
34
|
+
</button>
|
|
35
|
+
|
|
36
|
+
</div>
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
exports[`for statements > correctly handles intermediate statements in for block 2`] = `
|
|
40
|
+
<div>
|
|
41
|
+
<div>
|
|
42
|
+
<div>
|
|
43
|
+
<div>
|
|
44
|
+
1
|
|
45
|
+
</div>
|
|
46
|
+
<div>
|
|
47
|
+
1
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
<div>
|
|
51
|
+
<div>
|
|
52
|
+
2
|
|
53
|
+
</div>
|
|
54
|
+
<div>
|
|
55
|
+
2
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
<div>
|
|
59
|
+
<div>
|
|
60
|
+
3
|
|
61
|
+
</div>
|
|
62
|
+
<div>
|
|
63
|
+
3
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
<div>
|
|
67
|
+
<div>
|
|
68
|
+
4
|
|
69
|
+
</div>
|
|
70
|
+
<div>
|
|
71
|
+
4
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
</div>
|
|
76
|
+
<button>
|
|
77
|
+
Add Item
|
|
78
|
+
</button>
|
|
79
|
+
|
|
80
|
+
</div>
|
|
81
|
+
`;
|
|
82
|
+
|
|
83
|
+
exports[`for statements > correctly handles keyed for...of loops 1`] = `
|
|
84
|
+
<div>
|
|
85
|
+
<!---->
|
|
86
|
+
<div>
|
|
87
|
+
0:Item 1
|
|
88
|
+
</div>
|
|
89
|
+
<div>
|
|
90
|
+
1:Item 2
|
|
91
|
+
</div>
|
|
92
|
+
<div>
|
|
93
|
+
2:Item 3
|
|
94
|
+
</div>
|
|
95
|
+
<!---->
|
|
96
|
+
<button>
|
|
97
|
+
Reverse
|
|
98
|
+
</button>
|
|
99
|
+
|
|
100
|
+
</div>
|
|
101
|
+
`;
|
|
102
|
+
|
|
103
|
+
exports[`for statements > correctly handles keyed for...of loops 2`] = `
|
|
104
|
+
<div>
|
|
105
|
+
<!---->
|
|
106
|
+
<div>
|
|
107
|
+
0:Item 3
|
|
108
|
+
</div>
|
|
109
|
+
<div>
|
|
110
|
+
1:Item 2
|
|
111
|
+
</div>
|
|
112
|
+
<div>
|
|
113
|
+
2:Item 1
|
|
114
|
+
</div>
|
|
115
|
+
<!---->
|
|
116
|
+
<button>
|
|
117
|
+
Reverse
|
|
118
|
+
</button>
|
|
119
|
+
|
|
120
|
+
</div>
|
|
121
|
+
`;
|
|
122
|
+
|
|
123
|
+
exports[`for statements > correctly handles the index in a for...of loop 1`] = `
|
|
124
|
+
<div>
|
|
125
|
+
<div>
|
|
126
|
+
<div>
|
|
127
|
+
0 : a
|
|
128
|
+
</div>
|
|
129
|
+
<div>
|
|
130
|
+
1 : b
|
|
131
|
+
</div>
|
|
132
|
+
<div>
|
|
133
|
+
2 : c
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
</div>
|
|
137
|
+
<button>
|
|
138
|
+
Add Item
|
|
139
|
+
</button>
|
|
140
|
+
<button>
|
|
141
|
+
Reverse
|
|
142
|
+
</button>
|
|
143
|
+
|
|
144
|
+
</div>
|
|
145
|
+
`;
|
|
146
|
+
|
|
147
|
+
exports[`for statements > correctly handles the index in a for...of loop 2`] = `
|
|
148
|
+
<div>
|
|
149
|
+
<div>
|
|
150
|
+
<div>
|
|
151
|
+
0 : a
|
|
152
|
+
</div>
|
|
153
|
+
<div>
|
|
154
|
+
1 : b
|
|
155
|
+
</div>
|
|
156
|
+
<div>
|
|
157
|
+
2 : c
|
|
158
|
+
</div>
|
|
159
|
+
<div>
|
|
160
|
+
3 : d
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
</div>
|
|
164
|
+
<button>
|
|
165
|
+
Add Item
|
|
166
|
+
</button>
|
|
167
|
+
<button>
|
|
168
|
+
Reverse
|
|
169
|
+
</button>
|
|
170
|
+
|
|
171
|
+
</div>
|
|
172
|
+
`;
|
|
173
|
+
|
|
174
|
+
exports[`for statements > correctly handles the index in a for...of loop 3`] = `
|
|
175
|
+
<div>
|
|
176
|
+
<div>
|
|
177
|
+
<div>
|
|
178
|
+
0 : d
|
|
179
|
+
</div>
|
|
180
|
+
<div>
|
|
181
|
+
1 : c
|
|
182
|
+
</div>
|
|
183
|
+
<div>
|
|
184
|
+
2 : b
|
|
185
|
+
</div>
|
|
186
|
+
<div>
|
|
187
|
+
3 : a
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
</div>
|
|
191
|
+
<button>
|
|
192
|
+
Add Item
|
|
193
|
+
</button>
|
|
194
|
+
<button>
|
|
195
|
+
Reverse
|
|
196
|
+
</button>
|
|
197
|
+
|
|
198
|
+
</div>
|
|
199
|
+
`;
|
|
200
|
+
|
|
201
|
+
exports[`for statements > handles updating with new objects with same key 1`] = `
|
|
202
|
+
<div>
|
|
203
|
+
<!---->
|
|
204
|
+
<div>
|
|
205
|
+
0:Item 1
|
|
206
|
+
</div>
|
|
207
|
+
<div>
|
|
208
|
+
1:Item 2
|
|
209
|
+
</div>
|
|
210
|
+
<div>
|
|
211
|
+
2:Item 3
|
|
212
|
+
</div>
|
|
213
|
+
<!---->
|
|
214
|
+
<button>
|
|
215
|
+
Reverse
|
|
216
|
+
</button>
|
|
217
|
+
|
|
218
|
+
</div>
|
|
219
|
+
`;
|
|
220
|
+
|
|
221
|
+
exports[`for statements > handles updating with new objects with same key 2`] = `
|
|
222
|
+
<div>
|
|
223
|
+
<!---->
|
|
224
|
+
<div>
|
|
225
|
+
0:Item 1!
|
|
226
|
+
</div>
|
|
227
|
+
<div>
|
|
228
|
+
1:Item 2!
|
|
229
|
+
</div>
|
|
230
|
+
<div>
|
|
231
|
+
2:Item 3!
|
|
232
|
+
</div>
|
|
233
|
+
<!---->
|
|
234
|
+
<button>
|
|
235
|
+
Reverse
|
|
236
|
+
</button>
|
|
237
|
+
|
|
238
|
+
</div>
|
|
239
|
+
`;
|
|
240
|
+
|
|
241
|
+
exports[`for statements > renders a simple dynamic array 1`] = `
|
|
242
|
+
<div>
|
|
243
|
+
<!---->
|
|
244
|
+
<div
|
|
245
|
+
class="Item 1"
|
|
246
|
+
>
|
|
247
|
+
Item 1
|
|
248
|
+
</div>
|
|
249
|
+
<div
|
|
250
|
+
class="Item 2"
|
|
251
|
+
>
|
|
252
|
+
Item 2
|
|
253
|
+
</div>
|
|
254
|
+
<div
|
|
255
|
+
class="Item 3"
|
|
256
|
+
>
|
|
257
|
+
Item 3
|
|
258
|
+
</div>
|
|
259
|
+
<!---->
|
|
260
|
+
<button>
|
|
261
|
+
Add Item
|
|
262
|
+
</button>
|
|
263
|
+
|
|
264
|
+
</div>
|
|
265
|
+
`;
|
|
266
|
+
|
|
267
|
+
exports[`for statements > renders a simple dynamic array 2`] = `
|
|
268
|
+
<div>
|
|
269
|
+
<!---->
|
|
270
|
+
<div
|
|
271
|
+
class="Item 1"
|
|
272
|
+
>
|
|
273
|
+
Item 1
|
|
274
|
+
</div>
|
|
275
|
+
<div
|
|
276
|
+
class="Item 2"
|
|
277
|
+
>
|
|
278
|
+
Item 2
|
|
279
|
+
</div>
|
|
280
|
+
<div
|
|
281
|
+
class="Item 3"
|
|
282
|
+
>
|
|
283
|
+
Item 3
|
|
284
|
+
</div>
|
|
285
|
+
<div
|
|
286
|
+
class="Item 4"
|
|
287
|
+
>
|
|
288
|
+
Item 4
|
|
289
|
+
</div>
|
|
290
|
+
<!---->
|
|
291
|
+
<button>
|
|
292
|
+
Add Item
|
|
293
|
+
</button>
|
|
294
|
+
|
|
295
|
+
</div>
|
|
296
|
+
`;
|
|
297
|
+
|
|
298
|
+
exports[`for statements > renders a simple static array 1`] = `
|
|
299
|
+
<div>
|
|
300
|
+
<!---->
|
|
301
|
+
<div
|
|
302
|
+
class="Item 1"
|
|
303
|
+
>
|
|
304
|
+
Item 1
|
|
305
|
+
</div>
|
|
306
|
+
<div
|
|
307
|
+
class="Item 2"
|
|
308
|
+
>
|
|
309
|
+
Item 2
|
|
310
|
+
</div>
|
|
311
|
+
<div
|
|
312
|
+
class="Item 3"
|
|
313
|
+
>
|
|
314
|
+
Item 3
|
|
315
|
+
</div>
|
|
316
|
+
<!---->
|
|
317
|
+
|
|
318
|
+
</div>
|
|
319
|
+
`;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`html directive > renders dynamic html 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<!---->
|
|
6
|
+
<div>
|
|
7
|
+
Test
|
|
8
|
+
</div>
|
|
9
|
+
<!---->
|
|
10
|
+
<button>
|
|
11
|
+
Update
|
|
12
|
+
</button>
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
exports[`html directive > renders dynamic html 2`] = `
|
|
18
|
+
<div>
|
|
19
|
+
<!---->
|
|
20
|
+
<div>
|
|
21
|
+
Updated
|
|
22
|
+
</div>
|
|
23
|
+
<!---->
|
|
24
|
+
<button>
|
|
25
|
+
Update
|
|
26
|
+
</button>
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
exports[`html directive > renders static html 1`] = `
|
|
32
|
+
<div>
|
|
33
|
+
<!---->
|
|
34
|
+
<div>
|
|
35
|
+
Test
|
|
36
|
+
</div>
|
|
37
|
+
<!---->
|
|
38
|
+
|
|
39
|
+
</div>
|
|
40
|
+
`;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`basic client > attribute rendering > handles boolean attributes with no prop value provides 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="container"
|
|
7
|
+
>
|
|
8
|
+
<button
|
|
9
|
+
disabled=""
|
|
10
|
+
>
|
|
11
|
+
Button
|
|
12
|
+
</button>
|
|
13
|
+
<input
|
|
14
|
+
checked=""
|
|
15
|
+
type="checkbox"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
</div>
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
exports[`basic client > attribute rendering > handles boolean props correctly 1`] = `
|
|
23
|
+
<div>
|
|
24
|
+
<div
|
|
25
|
+
data-disabled=""
|
|
26
|
+
/>
|
|
27
|
+
<input
|
|
28
|
+
disabled=""
|
|
29
|
+
/>
|
|
30
|
+
<!---->
|
|
31
|
+
|
|
32
|
+
</div>
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
exports[`basic client > attribute rendering > render spread props without duplication 1`] = `
|
|
36
|
+
<div>
|
|
37
|
+
<div>
|
|
38
|
+
<input
|
|
39
|
+
id="vehicle1"
|
|
40
|
+
name="car"
|
|
41
|
+
type="checkbox"
|
|
42
|
+
value="Bike"
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
</div>
|
|
47
|
+
`;
|
|
48
|
+
|
|
49
|
+
exports[`basic client > attribute rendering > render static attributes 1`] = `
|
|
50
|
+
<div>
|
|
51
|
+
<div
|
|
52
|
+
class="foo"
|
|
53
|
+
id="bar"
|
|
54
|
+
style="color: red;"
|
|
55
|
+
>
|
|
56
|
+
Hello World
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
</div>
|
|
60
|
+
`;
|