ripple 0.2.141 → 0.2.143
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.143",
|
|
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.143"
|
|
85
85
|
}
|
|
86
86
|
}
|
|
@@ -925,8 +925,10 @@ const visitors = {
|
|
|
925
925
|
const args = [handler, b.id('__block'), ...hoisted_params];
|
|
926
926
|
delegated_assignment = b.array(args);
|
|
927
927
|
} else if (
|
|
928
|
-
handler.type === 'Identifier' &&
|
|
929
|
-
|
|
928
|
+
(handler.type === 'Identifier' &&
|
|
929
|
+
is_declared_function_within_component(handler, context)) ||
|
|
930
|
+
handler.type === 'ArrowFunctionExpression' ||
|
|
931
|
+
handler.type === 'FunctionExpression'
|
|
930
932
|
) {
|
|
931
933
|
delegated_assignment = handler;
|
|
932
934
|
} else {
|
|
@@ -1379,7 +1381,7 @@ const visitors = {
|
|
|
1379
1381
|
}
|
|
1380
1382
|
|
|
1381
1383
|
const left = object(argument);
|
|
1382
|
-
const binding = context.state.scope.get(left.name);
|
|
1384
|
+
const binding = left && context.state.scope.get(left.name);
|
|
1383
1385
|
const transformers = left && binding?.transform;
|
|
1384
1386
|
|
|
1385
1387
|
if (left === argument) {
|
|
@@ -194,7 +194,12 @@ function set_attribute_helper(element, key, value) {
|
|
|
194
194
|
* @returns {string}
|
|
195
195
|
*/
|
|
196
196
|
function to_class(value, hash) {
|
|
197
|
-
return value == null
|
|
197
|
+
return value == null
|
|
198
|
+
? (hash ?? '')
|
|
199
|
+
: // Fast-path for string values
|
|
200
|
+
typeof value === 'string'
|
|
201
|
+
? value + (hash ? ' ' + hash : '')
|
|
202
|
+
: clsx([value, hash]);
|
|
198
203
|
}
|
|
199
204
|
|
|
200
205
|
/**
|
|
@@ -207,24 +212,27 @@ function to_class(value, hash) {
|
|
|
207
212
|
export function set_class(dom, value, hash, is_html = true) {
|
|
208
213
|
// @ts-expect-error need to add __className to patched prototype
|
|
209
214
|
var prev_class_name = dom.__className;
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
dom.className = next_class_name;
|
|
215
|
+
|
|
216
|
+
if (prev_class_name !== value) {
|
|
217
|
+
var next_class_name = to_class(value, hash);
|
|
218
|
+
|
|
219
|
+
if (prev_class_name !== next_class_name) {
|
|
220
|
+
// Removing the attribute when the value is only an empty string causes
|
|
221
|
+
// peformance issues vs simply making the className an empty string. So
|
|
222
|
+
// we should only remove the class if the the value is nullish.
|
|
223
|
+
if (value == null && !hash) {
|
|
224
|
+
dom.removeAttribute('class');
|
|
221
225
|
} else {
|
|
222
|
-
|
|
226
|
+
if (is_html) {
|
|
227
|
+
dom.className = next_class_name;
|
|
228
|
+
} else {
|
|
229
|
+
dom.setAttribute('class', next_class_name);
|
|
230
|
+
}
|
|
223
231
|
}
|
|
224
232
|
}
|
|
225
233
|
|
|
226
234
|
// @ts-expect-error need to add __className to patched prototype
|
|
227
|
-
dom.__className =
|
|
235
|
+
dom.__className = value;
|
|
228
236
|
}
|
|
229
237
|
}
|
|
230
238
|
|
|
@@ -342,6 +342,23 @@ export component App() {
|
|
|
342
342
|
|
|
343
343
|
<div>{test}</div>
|
|
344
344
|
}
|
|
345
|
+
`;
|
|
346
|
+
expect(() => compile(code, 'test.ripple')).not.toThrow();
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
it('should not error on `this` MemberExpression with a UpdateExpression', () => {
|
|
350
|
+
const code = `
|
|
351
|
+
class Test {
|
|
352
|
+
constructor() {
|
|
353
|
+
this.count = 0;
|
|
354
|
+
this.count++; // This should not fail
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export component App() {
|
|
359
|
+
const test = new Test();
|
|
360
|
+
<div>{test.count}</div>
|
|
361
|
+
}
|
|
345
362
|
`;
|
|
346
363
|
expect(() => compile(code, 'test.ripple')).not.toThrow();
|
|
347
364
|
});
|