ripple 0.2.139 → 0.2.141

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.
@@ -1,4 +1,4 @@
1
- import { track, effect, flushSync } from 'ripple';
1
+ import { track, trackSplit, effect, flushSync, type Props } from 'ripple';
2
2
 
3
3
  describe('composite > props', () => {
4
4
  it('correctly handles default prop values', () => {
@@ -102,5 +102,47 @@ describe('composite > props', () => {
102
102
  flushSync();
103
103
 
104
104
  expect(logs).toEqual([0, 1]);
105
- })
105
+ });
106
+
107
+ it('correctly retains prop accessors and reactivity when using rest props', () => {
108
+ component Button(props: Props) {
109
+ const [children, rest] = trackSplit(props, ['children']);
110
+ <button {...@rest}>
111
+ <@children />
112
+ </button>
113
+ <style>
114
+ .on {
115
+ color: blue;
116
+ }
117
+ .off {
118
+ color: red;
119
+ }
120
+ </style>
121
+ }
122
+
123
+ component Toggle(props) {
124
+ const [pressed, rest] = trackSplit(props, ['pressed']);
125
+ const onClick = () => @pressed = !@pressed;
126
+ <Button {...@rest} class={@pressed ? 'on' : 'off'} {onClick}>{'button 1'}</Button>
127
+ <Button class={@pressed ? 'on' : 'off'} {onClick}>{'button 2'}</Button>
128
+ }
129
+
130
+ component App() {
131
+ const pressed = track(true);
132
+ <Toggle {pressed} />
133
+ }
134
+
135
+ render(App);
136
+ const button1 = container.querySelectorAll('button')[0];;
137
+ const button2 = container.querySelectorAll('button')[1];
138
+
139
+ expect(button1.className).toContain('on');
140
+ expect(button2.className).toContain('on');
141
+
142
+ button1.click();
143
+ flushSync();
144
+
145
+ expect(button1.className).toContain('off');
146
+ expect(button2.className).toContain('off');
147
+ });
106
148
  });
package/types/index.d.ts CHANGED
@@ -76,7 +76,7 @@ declare global {
76
76
  scope(): any;
77
77
  get_tracked(node: any): any;
78
78
  get_derived(node: any): any;
79
- set(node: any, value: any, block?: any): any;
79
+ set(node: any, value: any): any;
80
80
  // Add other runtime functions as needed for TypeScript analysis
81
81
  };
82
82
  }