svelte-common 4.22.15 → 4.22.17
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 +24 -7
- package/package.json +11 -11
- 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)
|
|
@@ -26,6 +26,8 @@ or the [live example](https://arlac77.github.io/components/svelte-common/example
|
|
|
26
26
|
|
|
27
27
|
### Table of Contents
|
|
28
28
|
|
|
29
|
+
* [AttributeDefinition](#attributedefinition)
|
|
30
|
+
* [Properties](#properties)
|
|
29
31
|
* [tokens](#tokens)
|
|
30
32
|
* [Parameters](#parameters)
|
|
31
33
|
* [setAttribute](#setattribute)
|
|
@@ -47,6 +49,23 @@ or the [live example](https://arlac77.github.io/components/svelte-common/example
|
|
|
47
49
|
* [keyPrefixStore](#keyprefixstore)
|
|
48
50
|
* [Parameters](#parameters-9)
|
|
49
51
|
|
|
52
|
+
## AttributeDefinition
|
|
53
|
+
|
|
54
|
+
Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
55
|
+
|
|
56
|
+
### Properties
|
|
57
|
+
|
|
58
|
+
* `type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
59
|
+
* `writable` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 
|
|
60
|
+
* `private` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** should the value be shown
|
|
61
|
+
* `depends` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** name of an attribute we depend on
|
|
62
|
+
* `additionalAttributes` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** extra attributes that are present in case our attribute is set
|
|
63
|
+
* `description` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
64
|
+
* `default` **any?** the default value
|
|
65
|
+
* `set` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** set the value
|
|
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` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>)?** environment variable use to provide the value
|
|
68
|
+
|
|
50
69
|
## tokens
|
|
51
70
|
|
|
52
71
|
Split property path into tokens
|
|
@@ -99,8 +118,8 @@ Generate filter function.
|
|
|
99
118
|
|
|
100
119
|
### Parameters
|
|
101
120
|
|
|
102
|
-
* `filterBy` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
103
|
-
* `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)?** 
|
|
104
123
|
|
|
105
124
|
Returns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** 
|
|
106
125
|
|
|
@@ -133,10 +152,8 @@ Synchronizes store value with the nodes "aria-sort" attribute.
|
|
|
133
152
|
|
|
134
153
|
### Parameters
|
|
135
154
|
|
|
136
|
-
* `th`
|
|
137
|
-
* `store`
|
|
138
|
-
* `the` **[Node](https://developer.mozilla.org/docs/Web/API/Node/nextSibling)** header node
|
|
139
|
-
* `to` **WritableStore** keep in sync with sorting properties
|
|
155
|
+
* `th` **[Node](https://developer.mozilla.org/docs/Web/API/Node/nextSibling)** the header node
|
|
156
|
+
* `store` **WritableStore** keep in sync with sorting properties
|
|
140
157
|
|
|
141
158
|
## sorter
|
|
142
159
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-common",
|
|
3
|
-
"version": "4.22.
|
|
3
|
+
"version": "4.22.17",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -34,24 +34,24 @@
|
|
|
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.
|
|
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",
|
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
|
|