svelte-common 4.22.16 → 4.22.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/README.md +9 -11
- package/package.json +12 -12
- package/src/attribute.mjs +1 -1
- package/src/filter.mjs +2 -2
- package/src/sorting.mjs +7 -7
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[](https://svelte.dev)
|
|
2
2
|
[](https://www.npmjs.com/package/svelte-common)
|
|
3
3
|
[](https://opensource.org/licenses/BSD-3-Clause)
|
|
4
|
-
[](https://bundlejs.com/?q=svelte-common)
|
|
5
5
|
[](https://npmjs.org/package/svelte-common)
|
|
6
6
|
[](https://github.com/arlac77/svelte-common/issues)
|
|
7
7
|
[](https://actions-badge.atrox.dev/arlac77/svelte-common/goto)
|
|
@@ -64,7 +64,7 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
|
|
|
64
64
|
* `default` **any?** the default value
|
|
65
65
|
* `set` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** set the value
|
|
66
66
|
* `get` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** get the value can be used to calculate default values
|
|
67
|
-
* `env` **([
|
|
67
|
+
* `env` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)> | [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))?** environment variable use to provide the value
|
|
68
68
|
|
|
69
69
|
## tokens
|
|
70
70
|
|
|
@@ -118,8 +118,8 @@ Generate filter function.
|
|
|
118
118
|
|
|
119
119
|
### Parameters
|
|
120
120
|
|
|
121
|
-
* `filterBy` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
122
|
-
* `getters` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
121
|
+
* `filterBy` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** 
|
|
122
|
+
* `getters` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** 
|
|
123
123
|
|
|
124
124
|
Returns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** 
|
|
125
125
|
|
|
@@ -152,10 +152,8 @@ Synchronizes store value with the nodes "aria-sort" attribute.
|
|
|
152
152
|
|
|
153
153
|
### Parameters
|
|
154
154
|
|
|
155
|
-
* `th`
|
|
156
|
-
* `store`
|
|
157
|
-
* `the` **[Node](https://developer.mozilla.org/docs/Web/API/Node/nextSibling)** header node
|
|
158
|
-
* `to` **WritableStore** keep in sync with sorting properties
|
|
155
|
+
* `th` **[Element](https://developer.mozilla.org/docs/Web/API/Element)** the header node
|
|
156
|
+
* `store` **WritableStore** keep in sync with sorting properties
|
|
159
157
|
|
|
160
158
|
## sorter
|
|
161
159
|
|
|
@@ -163,10 +161,10 @@ Generate a sort function for a given sort-by set.
|
|
|
163
161
|
|
|
164
162
|
### Parameters
|
|
165
163
|
|
|
166
|
-
* `sortBy` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
167
|
-
* `getters` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
164
|
+
* `sortBy` **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))?** 
|
|
165
|
+
* `getters` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** 
|
|
168
166
|
|
|
169
|
-
Returns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** sorter
|
|
167
|
+
Returns **([Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** sorter
|
|
170
168
|
|
|
171
169
|
## keyPrefixStore
|
|
172
170
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-common",
|
|
3
|
-
"version": "4.22.
|
|
3
|
+
"version": "4.22.18",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -34,28 +34,28 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"svelte-command": "^1.1.39",
|
|
37
|
-
"svelte-entitlement": "^1.2.
|
|
37
|
+
"svelte-entitlement": "^1.2.51"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@semantic-release/commit-analyzer": "^9.0.2",
|
|
41
41
|
"@semantic-release/exec": "^6.0.3",
|
|
42
|
-
"@semantic-release/release-notes-generator": "^
|
|
43
|
-
"@sveltejs/vite-plugin-svelte": "^2.
|
|
42
|
+
"@semantic-release/release-notes-generator": "^11.0.1",
|
|
43
|
+
"@sveltejs/vite-plugin-svelte": "^2.3.0",
|
|
44
44
|
"ava": "^5.2.0",
|
|
45
45
|
"c8": "^7.13.0",
|
|
46
|
-
"documentation": "^14.0.
|
|
46
|
+
"documentation": "^14.0.2",
|
|
47
47
|
"mf-styling": "^1.7.54",
|
|
48
|
-
"npm-pkgbuild": "^11.8.
|
|
49
|
-
"semantic-release": "^21.0.
|
|
50
|
-
"stylelint": "^15.6.
|
|
48
|
+
"npm-pkgbuild": "^11.8.6",
|
|
49
|
+
"semantic-release": "^21.0.2",
|
|
50
|
+
"stylelint": "^15.6.2",
|
|
51
51
|
"stylelint-config-standard": "^33.0.0",
|
|
52
|
-
"svelte": "^3.
|
|
53
|
-
"testcafe": "^2.
|
|
54
|
-
"vite": "^4.3.
|
|
52
|
+
"svelte": "^3.59.1",
|
|
53
|
+
"testcafe": "^2.6.0",
|
|
54
|
+
"vite": "^4.3.8"
|
|
55
55
|
},
|
|
56
56
|
"optionalDependencies": {
|
|
57
57
|
"mf-hosting-cloudflare": "^1.0.5",
|
|
58
|
-
"mf-hosting-frontend": "^1.9.
|
|
58
|
+
"mf-hosting-frontend": "^1.9.2"
|
|
59
59
|
},
|
|
60
60
|
"repository": {
|
|
61
61
|
"type": "git",
|
package/src/attribute.mjs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @property {any} [default] the default value
|
|
11
11
|
* @property {Function} [set] set the value
|
|
12
12
|
* @property {Function} [get] get the value can be used to calculate default values
|
|
13
|
-
* @property {string|string
|
|
13
|
+
* @property {string[]|string} [env] environment variable use to provide the value
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
/**
|
package/src/filter.mjs
CHANGED
|
@@ -23,8 +23,8 @@ function numberOp(a, b, op) {
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Generate filter function.
|
|
26
|
-
* @param {Object} filterBy
|
|
27
|
-
* @param {Object} getters
|
|
26
|
+
* @param {Object} [filterBy]
|
|
27
|
+
* @param {Object} [getters]
|
|
28
28
|
* @returns {Function}
|
|
29
29
|
*/
|
|
30
30
|
export function filter(filterBy, getters) {
|
package/src/sorting.mjs
CHANGED
|
@@ -26,8 +26,8 @@ export function toggleOrderBy(orderBy) {
|
|
|
26
26
|
/**
|
|
27
27
|
* Add sortable toggle button to a th node.
|
|
28
28
|
* Synchronizes store value with the nodes "aria-sort" attribute.
|
|
29
|
-
* @param {
|
|
30
|
-
* @param {WritableStore}
|
|
29
|
+
* @param {Element} th the header node
|
|
30
|
+
* @param {WritableStore} store keep in sync with sorting properties
|
|
31
31
|
*/
|
|
32
32
|
export function sortable(th, store) {
|
|
33
33
|
const storeSubscription = store.subscribe(orderBy =>
|
|
@@ -76,14 +76,14 @@ export function sortable(th, store) {
|
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
78
|
* Generate a sort function for a given sort-by set.
|
|
79
|
-
* @param {Object} sortBy
|
|
80
|
-
* @param {Object} getters
|
|
81
|
-
* @return {Function} sorter
|
|
79
|
+
* @param {Object|undefined} [sortBy]
|
|
80
|
+
* @param {Object} [getters]
|
|
81
|
+
* @return {Function|undefined} sorter
|
|
82
82
|
*/
|
|
83
|
-
export function sorter(sortBy, getters
|
|
83
|
+
export function sorter(sortBy, getters) {
|
|
84
84
|
if (sortBy) {
|
|
85
85
|
for (const [key, value] of Object.entries(sortBy)) {
|
|
86
|
-
const getter = getters[key] || getAttribute;
|
|
86
|
+
const getter = getters && getters[key] || getAttribute;
|
|
87
87
|
|
|
88
88
|
let rev = 1;
|
|
89
89
|
|