@fusion.dev/helix-headless 0.16.4 → 0.16.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/custom-elements.json +14 -4
- package/dist/badge/root/badge-root.d.ts +13 -1
- package/dist/badge/root/badge-root.js +6 -3
- package/package.json +5 -5
- package/types/jsx.d.ts +42 -2
- package/types/vue.d.ts +11 -1
package/custom-elements.json
CHANGED
|
@@ -2330,12 +2330,22 @@
|
|
|
2330
2330
|
"kind": "field",
|
|
2331
2331
|
"name": "value",
|
|
2332
2332
|
"type": {
|
|
2333
|
-
"text": "string"
|
|
2333
|
+
"text": "number | string"
|
|
2334
2334
|
},
|
|
2335
2335
|
"default": "''",
|
|
2336
|
-
"description": "The count or short text to show.\n\nAbsent shows a dot, zero shows nothing.",
|
|
2336
|
+
"description": "The count or short text to show.\n\nAbsent shows a dot, zero shows nothing.\n\n**A string, and a number is taken anyway.** What this shows is usually a\ncount, so `value={unread}` is the first thing a React consumer writes, and\na property assignment does not go through the attribute converter that\nwould have made it a string. Read raw it went straight into\n`this.value.trim()`, which threw inside `render` and left the mark showing\nwhatever it had last: measured, a badge set to the number 2 stayed an 8px\ndot with no digit in it, and the console carried\n`TypeError: this.value.trim is not a function`. A component whose whole job\nis showing a count must not lose the count for being handed one.",
|
|
2337
2337
|
"attribute": "value"
|
|
2338
2338
|
},
|
|
2339
|
+
{
|
|
2340
|
+
"kind": "field",
|
|
2341
|
+
"name": "given",
|
|
2342
|
+
"type": {
|
|
2343
|
+
"text": "string"
|
|
2344
|
+
},
|
|
2345
|
+
"privacy": "private",
|
|
2346
|
+
"description": "The value as text, whatever it was set to.",
|
|
2347
|
+
"readonly": true
|
|
2348
|
+
},
|
|
2339
2349
|
{
|
|
2340
2350
|
"kind": "field",
|
|
2341
2351
|
"name": "blank",
|
|
@@ -2551,10 +2561,10 @@
|
|
|
2551
2561
|
{
|
|
2552
2562
|
"name": "value",
|
|
2553
2563
|
"type": {
|
|
2554
|
-
"text": "string"
|
|
2564
|
+
"text": "number | string"
|
|
2555
2565
|
},
|
|
2556
2566
|
"default": "''",
|
|
2557
|
-
"description": "The count or short text to show.\n\nAbsent shows a dot, zero shows nothing.",
|
|
2567
|
+
"description": "The count or short text to show.\n\nAbsent shows a dot, zero shows nothing.\n\n**A string, and a number is taken anyway.** What this shows is usually a\ncount, so `value={unread}` is the first thing a React consumer writes, and\na property assignment does not go through the attribute converter that\nwould have made it a string. Read raw it went straight into\n`this.value.trim()`, which threw inside `render` and left the mark showing\nwhatever it had last: measured, a badge set to the number 2 stayed an 8px\ndot with no digit in it, and the console carried\n`TypeError: this.value.trim is not a function`. A component whose whole job\nis showing a count must not lose the count for being handed one.",
|
|
2558
2568
|
"fieldName": "value"
|
|
2559
2569
|
}
|
|
2560
2570
|
],
|
|
@@ -46,8 +46,20 @@ export declare class HelixHeadlessBadge extends HelixElement {
|
|
|
46
46
|
* The count or short text to show.
|
|
47
47
|
*
|
|
48
48
|
* Absent shows a dot, zero shows nothing.
|
|
49
|
+
*
|
|
50
|
+
* **A string, and a number is taken anyway.** What this shows is usually a
|
|
51
|
+
* count, so `value={unread}` is the first thing a React consumer writes, and
|
|
52
|
+
* a property assignment does not go through the attribute converter that
|
|
53
|
+
* would have made it a string. Read raw it went straight into
|
|
54
|
+
* `this.value.trim()`, which threw inside `render` and left the mark showing
|
|
55
|
+
* whatever it had last: measured, a badge set to the number 2 stayed an 8px
|
|
56
|
+
* dot with no digit in it, and the console carried
|
|
57
|
+
* `TypeError: this.value.trim is not a function`. A component whose whole job
|
|
58
|
+
* is showing a count must not lose the count for being handed one.
|
|
49
59
|
*/
|
|
50
|
-
value: string;
|
|
60
|
+
value: number | string;
|
|
61
|
+
/** The value as text, whatever it was set to. */
|
|
62
|
+
private get given();
|
|
51
63
|
/** Whether the value counts nothing, in which case there is no mark. */
|
|
52
64
|
private get blank();
|
|
53
65
|
/** What the indicator reads, once the cap has been applied. */
|
|
@@ -13,15 +13,18 @@ let HelixHeadlessBadge = class HelixHeadlessBadge extends HelixElement {
|
|
|
13
13
|
this.label = '';
|
|
14
14
|
this.value = '';
|
|
15
15
|
}
|
|
16
|
+
get given() {
|
|
17
|
+
return String(this.value ?? '');
|
|
18
|
+
}
|
|
16
19
|
get blank() {
|
|
17
|
-
return this.
|
|
20
|
+
return this.given.trim() !== '' && Number(this.given) === 0;
|
|
18
21
|
}
|
|
19
22
|
get text() {
|
|
20
|
-
const count = Number(this.
|
|
23
|
+
const count = Number(this.given);
|
|
21
24
|
if (this.max !== undefined && Number.isFinite(count) && count > this.max) {
|
|
22
25
|
return `${this.max}+`;
|
|
23
26
|
}
|
|
24
|
-
return this.
|
|
27
|
+
return this.given;
|
|
25
28
|
}
|
|
26
29
|
render() {
|
|
27
30
|
const blank = this.blank;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fusion.dev/helix-headless",
|
|
3
3
|
"description": "Headless component tier. Structure, accessibility, state, and form participation. No styling.",
|
|
4
|
-
"version": "0.16.
|
|
4
|
+
"version": "0.16.6",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ross Sheppard <ross.sheppard@fusion.dev>",
|
|
7
7
|
"repository": {
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
},
|
|
46
46
|
"bugs": "https://github.com/project-fusion/fusion/issues",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@fusion.dev/helix-core": "0.16.
|
|
49
|
-
"@fusion.dev/helix-icons": "0.16.
|
|
48
|
+
"@fusion.dev/helix-core": "0.16.6",
|
|
49
|
+
"@fusion.dev/helix-icons": "0.16.6",
|
|
50
50
|
"uqr": "^0.1.3"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@custom-elements-manifest/analyzer": "^0.11.0",
|
|
54
|
-
"@fusion.dev/helix-cem": "0.16.
|
|
55
|
-
"@fusion.dev/helix-testing": "0.16.
|
|
54
|
+
"@fusion.dev/helix-cem": "0.16.6",
|
|
55
|
+
"@fusion.dev/helix-testing": "0.16.6",
|
|
56
56
|
"@fusion.dev/scripts": "0.0.0-dev",
|
|
57
57
|
"@happy-dom/global-registrator": "^20.0.0",
|
|
58
58
|
"@lit-labs/ssr": "^3.3.0",
|
package/types/jsx.d.ts
CHANGED
|
@@ -802,7 +802,17 @@ Past it the indicator reads `{max}+`. */
|
|
|
802
802
|
max?: (HelixHeadlessBadge["max"]) | undefined;
|
|
803
803
|
/** The count or short text to show.
|
|
804
804
|
|
|
805
|
-
Absent shows a dot, zero shows nothing.
|
|
805
|
+
Absent shows a dot, zero shows nothing.
|
|
806
|
+
|
|
807
|
+
**A string, and a number is taken anyway.** What this shows is usually a
|
|
808
|
+
count, so `value={unread}` is the first thing a React consumer writes, and
|
|
809
|
+
a property assignment does not go through the attribute converter that
|
|
810
|
+
would have made it a string. Read raw it went straight into
|
|
811
|
+
`this.value.trim()`, which threw inside `render` and left the mark showing
|
|
812
|
+
whatever it had last: measured, a badge set to the number 2 stayed an 8px
|
|
813
|
+
dot with no digit in it, and the console carried
|
|
814
|
+
`TypeError: this.value.trim is not a function`. A component whose whole job
|
|
815
|
+
is showing a count must not lose the count for being handed one. */
|
|
806
816
|
value?: (HelixHeadlessBadge["value"]) | undefined;
|
|
807
817
|
};
|
|
808
818
|
|
|
@@ -817,7 +827,17 @@ Past it the indicator reads `{max}+`. */
|
|
|
817
827
|
"prop:max"?: (HelixHeadlessBadge["max"]) | undefined;
|
|
818
828
|
/** The count or short text to show.
|
|
819
829
|
|
|
820
|
-
Absent shows a dot, zero shows nothing.
|
|
830
|
+
Absent shows a dot, zero shows nothing.
|
|
831
|
+
|
|
832
|
+
**A string, and a number is taken anyway.** What this shows is usually a
|
|
833
|
+
count, so `value={unread}` is the first thing a React consumer writes, and
|
|
834
|
+
a property assignment does not go through the attribute converter that
|
|
835
|
+
would have made it a string. Read raw it went straight into
|
|
836
|
+
`this.value.trim()`, which threw inside `render` and left the mark showing
|
|
837
|
+
whatever it had last: measured, a badge set to the number 2 stayed an 8px
|
|
838
|
+
dot with no digit in it, and the console carried
|
|
839
|
+
`TypeError: this.value.trim is not a function`. A component whose whole job
|
|
840
|
+
is showing a count must not lose the count for being handed one. */
|
|
821
841
|
"prop:value"?: (HelixHeadlessBadge["value"]) | undefined;
|
|
822
842
|
|
|
823
843
|
/** Set the innerHTML of the element */
|
|
@@ -16179,6 +16199,16 @@ export type CustomElements = {
|
|
|
16179
16199
|
* - `value`: The count or short text to show.
|
|
16180
16200
|
*
|
|
16181
16201
|
* Absent shows a dot, zero shows nothing.
|
|
16202
|
+
*
|
|
16203
|
+
* **A string, and a number is taken anyway.** What this shows is usually a
|
|
16204
|
+
* count, so `value={unread}` is the first thing a React consumer writes, and
|
|
16205
|
+
* a property assignment does not go through the attribute converter that
|
|
16206
|
+
* would have made it a string. Read raw it went straight into
|
|
16207
|
+
* `this.value.trim()`, which threw inside `render` and left the mark showing
|
|
16208
|
+
* whatever it had last: measured, a badge set to the number 2 stayed an 8px
|
|
16209
|
+
* dot with no digit in it, and the console carried
|
|
16210
|
+
* `TypeError: this.value.trim is not a function`. A component whose whole job
|
|
16211
|
+
* is showing a count must not lose the count for being handed one.
|
|
16182
16212
|
* - `whenSettled`: Resolves a frame after the first update, when transitions are switched on.
|
|
16183
16213
|
*
|
|
16184
16214
|
* **Named `whenSettled` because `settled` is taken four times over**, by
|
|
@@ -30610,6 +30640,16 @@ export type CustomElementsSolidJs = {
|
|
|
30610
30640
|
* - `value`: The count or short text to show.
|
|
30611
30641
|
*
|
|
30612
30642
|
* Absent shows a dot, zero shows nothing.
|
|
30643
|
+
*
|
|
30644
|
+
* **A string, and a number is taken anyway.** What this shows is usually a
|
|
30645
|
+
* count, so `value={unread}` is the first thing a React consumer writes, and
|
|
30646
|
+
* a property assignment does not go through the attribute converter that
|
|
30647
|
+
* would have made it a string. Read raw it went straight into
|
|
30648
|
+
* `this.value.trim()`, which threw inside `render` and left the mark showing
|
|
30649
|
+
* whatever it had last: measured, a badge set to the number 2 stayed an 8px
|
|
30650
|
+
* dot with no digit in it, and the console carried
|
|
30651
|
+
* `TypeError: this.value.trim is not a function`. A component whose whole job
|
|
30652
|
+
* is showing a count must not lose the count for being handed one.
|
|
30613
30653
|
* - `whenSettled`: Resolves a frame after the first update, when transitions are switched on.
|
|
30614
30654
|
*
|
|
30615
30655
|
* **Named `whenSettled` because `settled` is taken four times over**, by
|
package/types/vue.d.ts
CHANGED
|
@@ -426,7 +426,17 @@ Past it the indicator reads `{max}+`. */
|
|
|
426
426
|
max?: (HelixHeadlessBadge["max"]) | undefined;
|
|
427
427
|
/** The count or short text to show.
|
|
428
428
|
|
|
429
|
-
Absent shows a dot, zero shows nothing.
|
|
429
|
+
Absent shows a dot, zero shows nothing.
|
|
430
|
+
|
|
431
|
+
**A string, and a number is taken anyway.** What this shows is usually a
|
|
432
|
+
count, so `value={unread}` is the first thing a React consumer writes, and
|
|
433
|
+
a property assignment does not go through the attribute converter that
|
|
434
|
+
would have made it a string. Read raw it went straight into
|
|
435
|
+
`this.value.trim()`, which threw inside `render` and left the mark showing
|
|
436
|
+
whatever it had last: measured, a badge set to the number 2 stayed an 8px
|
|
437
|
+
dot with no digit in it, and the console carried
|
|
438
|
+
`TypeError: this.value.trim is not a function`. A component whose whole job
|
|
439
|
+
is showing a count must not lose the count for being handed one. */
|
|
430
440
|
value?: (HelixHeadlessBadge["value"]) | undefined;
|
|
431
441
|
};
|
|
432
442
|
|