@thi.ng/hdom-components 5.1.119 → 5.1.121
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/CHANGELOG.md +8 -1
- package/README.md +2 -2
- package/button-group.js +9 -9
- package/package.json +12 -12
- package/pager.js +2 -2
- package/utils/merge-attribs.d.ts +2 -2
- package/utils/merge-attribs.js +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-
|
|
3
|
+
- **Last updated**: 2024-06-29T09:28:36Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,13 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
### [5.1.120](https://github.com/thi-ng/umbrella/tree/@thi.ng/hdom-components@5.1.120) (2024-06-21)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- rename various rest args to be more semantically meaningful ([8088a56](https://github.com/thi-ng/umbrella/commit/8088a56))
|
|
17
|
+
- enforce uniform naming convention of internal functions ([56992b2](https://github.com/thi-ng/umbrella/commit/56992b2))
|
|
18
|
+
|
|
12
19
|
### [5.1.116](https://github.com/thi-ng/umbrella/tree/@thi.ng/hdom-components@5.1.116) (2024-04-20)
|
|
13
20
|
|
|
14
21
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 189 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
|
@@ -68,7 +68,7 @@ Browser ESM import:
|
|
|
68
68
|
|
|
69
69
|
[JSDelivr documentation](https://www.jsdelivr.com/)
|
|
70
70
|
|
|
71
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 2.
|
|
71
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 2.06 KB
|
|
72
72
|
|
|
73
73
|
## Dependencies
|
|
74
74
|
|
package/button-group.js
CHANGED
|
@@ -2,32 +2,32 @@ import { mergeAttribs } from "./utils/merge-attribs.js";
|
|
|
2
2
|
const buttonGroup = (opts) => (_, args, ...buttons) => [
|
|
3
3
|
"div",
|
|
4
4
|
mergeAttribs(opts.attribs, args.attribs),
|
|
5
|
-
...
|
|
5
|
+
...__groupBody(opts, args.disabled, buttons)
|
|
6
6
|
];
|
|
7
|
-
const
|
|
7
|
+
const __groupBody = (opts, disabled, buttons) => {
|
|
8
8
|
switch (buttons.length) {
|
|
9
9
|
case 0:
|
|
10
10
|
return [];
|
|
11
11
|
case 1:
|
|
12
|
-
return [
|
|
12
|
+
return [__bt(opts.inner || opts.first, disabled, buttons[0])];
|
|
13
13
|
case 2:
|
|
14
14
|
return [
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
__bt(opts.first, disabled, buttons[0]),
|
|
16
|
+
__bt(opts.last || opts.first, disabled, buttons[1])
|
|
17
17
|
];
|
|
18
18
|
default: {
|
|
19
|
-
const res = [
|
|
19
|
+
const res = [__bt(opts.first, disabled, buttons[0])];
|
|
20
20
|
const el = opts.inner || opts.first;
|
|
21
21
|
const n = buttons.length - 1;
|
|
22
22
|
for (let i = 1; i < n; i++) {
|
|
23
|
-
res[i] =
|
|
23
|
+
res[i] = __bt(el, disabled, buttons[i]);
|
|
24
24
|
}
|
|
25
|
-
res[n] =
|
|
25
|
+
res[n] = __bt(opts.last || opts.first, disabled, buttons[n]);
|
|
26
26
|
return res;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
const
|
|
30
|
+
const __bt = (el, disabled, bt) => disabled ? [el, { ...bt[0], disabled: true }, ...bt.slice(1)] : [el, ...bt];
|
|
31
31
|
export {
|
|
32
32
|
buttonGroup
|
|
33
33
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/hdom-components",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.121",
|
|
4
4
|
"description": "Raw, skinnable UI & SVG components for @thi.ng/hdom",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/thi-ng/umbrella.git"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://
|
|
13
|
+
"homepage": "https://thi.ng/hdom-components",
|
|
14
14
|
"funding": [
|
|
15
15
|
{
|
|
16
16
|
"type": "github",
|
|
@@ -36,18 +36,18 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.11.
|
|
40
|
-
"@thi.ng/canvas": "^0.2.
|
|
41
|
-
"@thi.ng/checks": "^3.6.
|
|
42
|
-
"@thi.ng/math": "^5.
|
|
43
|
-
"@thi.ng/transducers": "^9.0.
|
|
44
|
-
"@thi.ng/transducers-stats": "^2.1.
|
|
39
|
+
"@thi.ng/api": "^8.11.4",
|
|
40
|
+
"@thi.ng/canvas": "^0.2.21",
|
|
41
|
+
"@thi.ng/checks": "^3.6.6",
|
|
42
|
+
"@thi.ng/math": "^5.11.1",
|
|
43
|
+
"@thi.ng/transducers": "^9.0.7",
|
|
44
|
+
"@thi.ng/transducers-stats": "^2.1.120"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@microsoft/api-extractor": "^7.
|
|
48
|
-
"esbuild": "^0.21.
|
|
47
|
+
"@microsoft/api-extractor": "^7.47.0",
|
|
48
|
+
"esbuild": "^0.21.5",
|
|
49
49
|
"typedoc": "^0.25.13",
|
|
50
|
-
"typescript": "^5.
|
|
50
|
+
"typescript": "^5.5.2"
|
|
51
51
|
},
|
|
52
52
|
"keywords": [
|
|
53
53
|
"browser",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"status": "beta",
|
|
111
111
|
"year": 2018
|
|
112
112
|
},
|
|
113
|
-
"gitHead": "
|
|
113
|
+
"gitHead": "7b950c112fba0b2e7c450765b15624c3382f1354\n"
|
|
114
114
|
}
|
package/pager.js
CHANGED
|
@@ -25,7 +25,7 @@ const pager = (_opts) => {
|
|
|
25
25
|
opts.groupPages,
|
|
26
26
|
map(
|
|
27
27
|
(i) => bt(i, id, maxID, i + 1, i === id),
|
|
28
|
-
|
|
28
|
+
__pageRange(id, maxID, maxBts)
|
|
29
29
|
)
|
|
30
30
|
],
|
|
31
31
|
[
|
|
@@ -42,7 +42,7 @@ const pager = (_opts) => {
|
|
|
42
42
|
];
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
|
-
const
|
|
45
|
+
const __pageRange = (id, maxID, maxBt) => {
|
|
46
46
|
if (maxID > maxBt - 1) {
|
|
47
47
|
const from = Math.max(
|
|
48
48
|
Math.min(id - (maxBt >> 1), maxID - maxBt + 1),
|
package/utils/merge-attribs.d.ts
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* present). Returns merged result object.
|
|
5
5
|
*
|
|
6
6
|
* @param base - base attribs
|
|
7
|
-
* @param
|
|
7
|
+
* @param attribs - overrides
|
|
8
8
|
*
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
11
|
-
export declare const mergeAttribs: (base: any,
|
|
11
|
+
export declare const mergeAttribs: (base: any, attribs: any) => any;
|
|
12
12
|
//# sourceMappingURL=merge-attribs.d.ts.map
|
package/utils/merge-attribs.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const mergeAttribs = (base,
|
|
2
|
-
if (!
|
|
3
|
-
const res = { ...base, ...
|
|
4
|
-
base.class &&
|
|
5
|
-
base.style &&
|
|
1
|
+
const mergeAttribs = (base, attribs) => {
|
|
2
|
+
if (!attribs) return base;
|
|
3
|
+
const res = { ...base, ...attribs };
|
|
4
|
+
base.class && attribs.class && (res.class = base.class + " " + attribs.class);
|
|
5
|
+
base.style && attribs.style && (res.style = { ...base.style, ...attribs.style });
|
|
6
6
|
return res;
|
|
7
7
|
};
|
|
8
8
|
export {
|