ripple 0.2.163 → 0.2.165
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/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.2.
|
|
6
|
+
"version": "0.2.165",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"module": "src/runtime/index-client.js",
|
|
9
9
|
"main": "src/runtime/index-client.js",
|
|
@@ -81,6 +81,6 @@
|
|
|
81
81
|
"typescript": "^5.9.2"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
|
-
"ripple": "0.2.
|
|
84
|
+
"ripple": "0.2.165"
|
|
85
85
|
}
|
|
86
86
|
}
|
|
@@ -1159,7 +1159,9 @@ const visitors = {
|
|
|
1159
1159
|
),
|
|
1160
1160
|
);
|
|
1161
1161
|
} else if (attr.type === 'RefAttribute') {
|
|
1162
|
-
|
|
1162
|
+
const ref_id = state.scope.generate('ref');
|
|
1163
|
+
state.setup.push(b.var(ref_id, b.call('_$_.ref_prop')));
|
|
1164
|
+
props.push(b.prop('init', b.id(ref_id), visit(attr.argument, state), true));
|
|
1163
1165
|
} else {
|
|
1164
1166
|
throw new Error('TODO');
|
|
1165
1167
|
}
|
|
@@ -15,7 +15,7 @@ export {
|
|
|
15
15
|
set_selected,
|
|
16
16
|
} from './render.js';
|
|
17
17
|
|
|
18
|
-
export { render, render_spread, async, ref, branch } from './blocks.js';
|
|
18
|
+
export { render, render_spread, async, ref, branch, destroy_block } from './blocks.js';
|
|
19
19
|
|
|
20
20
|
export { event, delegate } from './events.js';
|
|
21
21
|
|
|
@@ -60,7 +60,7 @@ export { for_block as for, for_block_keyed as for_keyed } from './for.js';
|
|
|
60
60
|
|
|
61
61
|
export { if_block as if } from './if.js';
|
|
62
62
|
|
|
63
|
-
export { try_block as try, aborted } from './try.js';
|
|
63
|
+
export { try_block as try, aborted, suspend } from './try.js';
|
|
64
64
|
|
|
65
65
|
export { switch_block as switch } from './switch.js';
|
|
66
66
|
|
|
@@ -83,3 +83,5 @@ export { html } from './html.js';
|
|
|
83
83
|
export { rpc } from './rpc.js';
|
|
84
84
|
|
|
85
85
|
export { tsx_compat } from './compat.js';
|
|
86
|
+
|
|
87
|
+
export { TRY_BLOCK } from './constants.js';
|
|
@@ -933,12 +933,14 @@ export function spread_props(fn) {
|
|
|
933
933
|
* @returns {Object}
|
|
934
934
|
*/
|
|
935
935
|
export function proxy_props(fn) {
|
|
936
|
+
const memo = derived(fn, active_block);
|
|
937
|
+
|
|
936
938
|
return new Proxy(
|
|
937
939
|
{},
|
|
938
940
|
{
|
|
939
941
|
get(_, property) {
|
|
940
942
|
/** @type {Record<string | symbol, any> | Record<string | symbol, any>[]} */
|
|
941
|
-
var obj =
|
|
943
|
+
var obj = get_derived(memo);
|
|
942
944
|
|
|
943
945
|
// Handle array of objects/spreads (for multiple props)
|
|
944
946
|
if (is_array(obj)) {
|
|
@@ -962,7 +964,7 @@ export function proxy_props(fn) {
|
|
|
962
964
|
return true;
|
|
963
965
|
}
|
|
964
966
|
/** @type {Record<string | symbol, any> | Record<string | symbol, any>[]} */
|
|
965
|
-
var obj =
|
|
967
|
+
var obj = get_derived(memo);
|
|
966
968
|
|
|
967
969
|
// Handle array of objects/spreads
|
|
968
970
|
if (is_array(obj)) {
|
|
@@ -978,7 +980,7 @@ export function proxy_props(fn) {
|
|
|
978
980
|
},
|
|
979
981
|
getOwnPropertyDescriptor(_, key) {
|
|
980
982
|
/** @type {Record<string | symbol, any> | Record<string | symbol, any>[]} */
|
|
981
|
-
var obj =
|
|
983
|
+
var obj = get_derived(memo);
|
|
982
984
|
|
|
983
985
|
// Handle array of objects/spreads
|
|
984
986
|
if (is_array(obj)) {
|
|
@@ -999,7 +1001,7 @@ export function proxy_props(fn) {
|
|
|
999
1001
|
},
|
|
1000
1002
|
ownKeys() {
|
|
1001
1003
|
/** @type {Record<string | symbol, any> | Record<string | symbol, any>[]} */
|
|
1002
|
-
var obj =
|
|
1004
|
+
var obj = get_derived(memo);
|
|
1003
1005
|
/** @type {Record<string | symbol, 1>} */
|
|
1004
1006
|
var done = {};
|
|
1005
1007
|
/** @type {(string | symbol)[]} */
|
|
@@ -74,4 +74,34 @@ describe('refs', () => {
|
|
|
74
74
|
|
|
75
75
|
expect(logs).toEqual(['ref called', 'ref called']);
|
|
76
76
|
});
|
|
77
|
+
|
|
78
|
+
it('should handle spreading props with a static ref', () => {
|
|
79
|
+
let logs: string[] = [];
|
|
80
|
+
|
|
81
|
+
component App() {
|
|
82
|
+
let value = track('test');
|
|
83
|
+
|
|
84
|
+
function inputRef(node) {
|
|
85
|
+
logs.push('ref called');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const props = {
|
|
89
|
+
id: 'example',
|
|
90
|
+
@value,
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
<input type="text" {ref inputRef} {...props} />
|
|
94
|
+
|
|
95
|
+
<Input {ref inputRef} {...props} />
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
component Input({ id, value, ...rest }) {
|
|
99
|
+
<input type="text" {id} {value} {...rest} />
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
render(App);
|
|
103
|
+
flushSync();
|
|
104
|
+
|
|
105
|
+
expect(logs).toEqual(['ref called', 'ref called']);
|
|
106
|
+
});
|
|
77
107
|
});
|