svelte-common 6.8.5 → 6.8.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/package.json +8 -8
- package/src/attribute.mjs +5 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-common",
|
|
3
|
-
"version": "6.8.
|
|
3
|
+
"version": "6.8.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"prepare": "vite build",
|
|
32
32
|
"start": "vite",
|
|
33
33
|
"test": "npm run test:ava && npm run test:cafe",
|
|
34
|
-
"test:cafe": "testcafe $BROWSER:headless tests/cafe/*-cafe.mjs
|
|
34
|
+
"test:cafe": "testcafe $BROWSER:headless tests/cafe/*-cafe.mjs -s build/test --page-request-timeout 5000 --app-init-delay 8000 --app vite",
|
|
35
35
|
"test:ava": "ava --timeout 2m tests/*-ava.mjs tests/*-ava-node.mjs && ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
|
|
36
36
|
"cover": "c8 -x 'tests/**/*' --temp-directory build/tmp ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs && c8 report -r lcov -o build/coverage --temp-directory build/tmp",
|
|
37
37
|
"docs": "documentation readme --section=API ./src/**/*.mjs",
|
|
@@ -53,18 +53,18 @@
|
|
|
53
53
|
"c8": "^8.0.1",
|
|
54
54
|
"documentation": "^14.0.2",
|
|
55
55
|
"mf-styling": "^3.0.6",
|
|
56
|
-
"npm-pkgbuild": "^12.1
|
|
56
|
+
"npm-pkgbuild": "^12.3.1",
|
|
57
57
|
"semantic-release": "^22.0.5",
|
|
58
|
-
"stylelint": "^15.
|
|
58
|
+
"stylelint": "^15.11.0",
|
|
59
59
|
"stylelint-config-standard": "^34.0.0",
|
|
60
|
-
"svelte": "^4.2.
|
|
60
|
+
"svelte": "^4.2.2",
|
|
61
61
|
"testcafe": "^3.3.0",
|
|
62
|
-
"vite": "^4.
|
|
63
|
-
"vite-plugin-compression2": "^0.
|
|
62
|
+
"vite": "^4.5.0",
|
|
63
|
+
"vite-plugin-compression2": "^0.11.0"
|
|
64
64
|
},
|
|
65
65
|
"optionalDependencies": {
|
|
66
66
|
"mf-hosting-cloudflare": "^1.0.6",
|
|
67
|
-
"mf-hosting-frontend": "^2.2.
|
|
67
|
+
"mf-hosting-frontend": "^2.2.4"
|
|
68
68
|
},
|
|
69
69
|
"repository": {
|
|
70
70
|
"type": "git",
|
package/src/attribute.mjs
CHANGED
|
@@ -192,14 +192,14 @@ export function* tokens(string) {
|
|
|
192
192
|
* Set Object attribute.
|
|
193
193
|
* The name may be a property path like 'a.b.c'.
|
|
194
194
|
* @param {Object} object
|
|
195
|
-
* @param {string}
|
|
195
|
+
* @param {string} expression
|
|
196
196
|
* @param {any} value
|
|
197
197
|
*/
|
|
198
|
-
export function setAttribute(object,
|
|
198
|
+
export function setAttribute(object, expression, value) {
|
|
199
199
|
let lastObject = object;
|
|
200
200
|
let lastKey;
|
|
201
201
|
|
|
202
|
-
for (const token of tokens(
|
|
202
|
+
for (const token of tokens(expression)) {
|
|
203
203
|
switch (token) {
|
|
204
204
|
case ">":
|
|
205
205
|
case "<":
|
|
@@ -229,7 +229,7 @@ export function setAttribute(object, name, value) {
|
|
|
229
229
|
* Deliver attribute value.
|
|
230
230
|
* The name may be a property path like 'a.b.c' or a[2]
|
|
231
231
|
* @param {Object} object
|
|
232
|
-
* @param {string}
|
|
232
|
+
* @param {string} expression
|
|
233
233
|
* @returns {any} value associated with the given property name
|
|
234
234
|
*/
|
|
235
235
|
export function getAttribute(object, expression) {
|
|
@@ -263,11 +263,7 @@ export function getAttributeAndOperator(object, expression, getters = {}) {
|
|
|
263
263
|
break;
|
|
264
264
|
case "]":
|
|
265
265
|
// TODO: should loop over array actually getAttribute api should deliver iterators
|
|
266
|
-
if (
|
|
267
|
-
object = object[0];
|
|
268
|
-
}
|
|
269
|
-
else {
|
|
270
|
-
if(object[Symbol.iterator])
|
|
266
|
+
if (object[Symbol.iterator]) {
|
|
271
267
|
object = [...object][0];
|
|
272
268
|
}
|
|
273
269
|
|