@fusion.dev/helix-headless 0.4.7 → 0.6.0
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
CHANGED
|
@@ -74918,7 +74918,7 @@
|
|
|
74918
74918
|
"text": "number"
|
|
74919
74919
|
},
|
|
74920
74920
|
"default": "32",
|
|
74921
|
-
"description": "How tall one row is, in pixels, used to map scroll offset to an index.",
|
|
74921
|
+
"description": "How tall one row is, in pixels, used to map scroll offset to an index.\n\nAn estimate rather than a measurement while `measured` is off, which is\nright whenever the rows really are one height and is the cheaper of the two.",
|
|
74922
74922
|
"attribute": "estimate"
|
|
74923
74923
|
},
|
|
74924
74924
|
{
|
|
@@ -74941,6 +74941,16 @@
|
|
|
74941
74941
|
"description": "What the list is called, since the rendered rows are only a window on it.",
|
|
74942
74942
|
"attribute": "label"
|
|
74943
74943
|
},
|
|
74944
|
+
{
|
|
74945
|
+
"kind": "field",
|
|
74946
|
+
"name": "measured",
|
|
74947
|
+
"type": {
|
|
74948
|
+
"text": "boolean"
|
|
74949
|
+
},
|
|
74950
|
+
"default": "false",
|
|
74951
|
+
"description": "Places rows by what they came to rather than by `estimate`.\n\n**Off by default, because the straight line is better when it holds.** One\nestimate makes offset and index convert by division, which can never\ndisagree with itself; measuring is what a set of genuinely different\nheights needs and costs a read of each row as it renders. A list of\none-line rows should leave this alone.",
|
|
74952
|
+
"attribute": "measured"
|
|
74953
|
+
},
|
|
74944
74954
|
{
|
|
74945
74955
|
"kind": "field",
|
|
74946
74956
|
"name": "rows",
|
|
@@ -74956,7 +74966,18 @@
|
|
|
74956
74966
|
"name": "virtualize",
|
|
74957
74967
|
"privacy": "private",
|
|
74958
74968
|
"readonly": true,
|
|
74959
|
-
"default": "new VirtualizeController(this, { container: () => this.renderRoot.querySelector<HTMLElement>('[part=\"viewport\"]'), count: () => this.rows.length, estimate: () => this.estimate, })"
|
|
74969
|
+
"default": "new VirtualizeController(this, { container: () => this.renderRoot.querySelector<HTMLElement>('[part=\"viewport\"]'), count: () => this.rows.length, estimate: () => this.estimate, measured: () => this.measured, rows: () => this.drawn(), })"
|
|
74970
|
+
},
|
|
74971
|
+
{
|
|
74972
|
+
"kind": "method",
|
|
74973
|
+
"name": "drawn",
|
|
74974
|
+
"privacy": "private",
|
|
74975
|
+
"return": {
|
|
74976
|
+
"type": {
|
|
74977
|
+
"text": "{ element: HTMLElement; index: number }[]"
|
|
74978
|
+
}
|
|
74979
|
+
},
|
|
74980
|
+
"description": "The rows in the tree, each with the item it drew.\n\n**Read off `data-index` rather than counted**, because what is in the tree\nwhen the controller asks is what `place` appended on the *previous* pass:\n`hostUpdated` runs before `updated`, so counting from the current window\nwould record the right heights against the wrong items every time the\nwindow moved."
|
|
74960
74981
|
},
|
|
74961
74982
|
{
|
|
74962
74983
|
"kind": "method",
|
|
@@ -75160,7 +75181,7 @@
|
|
|
75160
75181
|
"text": "number"
|
|
75161
75182
|
},
|
|
75162
75183
|
"default": "32",
|
|
75163
|
-
"description": "How tall one row is, in pixels, used to map scroll offset to an index.",
|
|
75184
|
+
"description": "How tall one row is, in pixels, used to map scroll offset to an index.\n\nAn estimate rather than a measurement while `measured` is off, which is\nright whenever the rows really are one height and is the cheaper of the two.",
|
|
75164
75185
|
"fieldName": "estimate"
|
|
75165
75186
|
},
|
|
75166
75187
|
{
|
|
@@ -75180,6 +75201,15 @@
|
|
|
75180
75201
|
"default": "''",
|
|
75181
75202
|
"description": "What the list is called, since the rendered rows are only a window on it.",
|
|
75182
75203
|
"fieldName": "label"
|
|
75204
|
+
},
|
|
75205
|
+
{
|
|
75206
|
+
"name": "measured",
|
|
75207
|
+
"type": {
|
|
75208
|
+
"text": "boolean"
|
|
75209
|
+
},
|
|
75210
|
+
"default": "false",
|
|
75211
|
+
"description": "Places rows by what they came to rather than by `estimate`.\n\n**Off by default, because the straight line is better when it holds.** One\nestimate makes offset and index convert by division, which can never\ndisagree with itself; measuring is what a set of genuinely different\nheights needs and costs a read of each row as it renders. A list of\none-line rows should leave this alone.",
|
|
75212
|
+
"fieldName": "measured"
|
|
75183
75213
|
}
|
|
75184
75214
|
],
|
|
75185
75215
|
"superclass": {
|
|
@@ -32,6 +32,9 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
32
32
|
export declare class HelixHeadlessVirtualList extends HelixElement {
|
|
33
33
|
/**
|
|
34
34
|
* How tall one row is, in pixels, used to map scroll offset to an index.
|
|
35
|
+
*
|
|
36
|
+
* An estimate rather than a measurement while `measured` is off, which is
|
|
37
|
+
* right whenever the rows really are one height and is the cheaper of the two.
|
|
35
38
|
*/
|
|
36
39
|
estimate: number;
|
|
37
40
|
/**
|
|
@@ -42,6 +45,16 @@ export declare class HelixHeadlessVirtualList extends HelixElement {
|
|
|
42
45
|
* What the list is called, since the rendered rows are only a window on it.
|
|
43
46
|
*/
|
|
44
47
|
label: string;
|
|
48
|
+
/**
|
|
49
|
+
* Places rows by what they came to rather than by `estimate`.
|
|
50
|
+
*
|
|
51
|
+
* **Off by default, because the straight line is better when it holds.** One
|
|
52
|
+
* estimate makes offset and index convert by division, which can never
|
|
53
|
+
* disagree with itself; measuring is what a set of genuinely different
|
|
54
|
+
* heights needs and costs a read of each row as it renders. A list of
|
|
55
|
+
* one-line rows should leave this alone.
|
|
56
|
+
*/
|
|
57
|
+
measured: boolean;
|
|
45
58
|
/**
|
|
46
59
|
* The parsed source.
|
|
47
60
|
*
|
|
@@ -49,6 +62,16 @@ export declare class HelixHeadlessVirtualList extends HelixElement {
|
|
|
49
62
|
*/
|
|
50
63
|
private rows;
|
|
51
64
|
private readonly virtualize;
|
|
65
|
+
/**
|
|
66
|
+
* The rows in the tree, each with the item it drew.
|
|
67
|
+
*
|
|
68
|
+
* **Read off `data-index` rather than counted**, because what is in the tree
|
|
69
|
+
* when the controller asks is what `place` appended on the *previous* pass:
|
|
70
|
+
* `hostUpdated` runs before `updated`, so counting from the current window
|
|
71
|
+
* would record the right heights against the wrong items every time the
|
|
72
|
+
* window moved.
|
|
73
|
+
*/
|
|
74
|
+
private drawn;
|
|
52
75
|
/**
|
|
53
76
|
* Reads the source named by `for`, once the document exists to read.
|
|
54
77
|
*
|
|
@@ -13,13 +13,22 @@ let HelixHeadlessVirtualList = class HelixHeadlessVirtualList extends HelixEleme
|
|
|
13
13
|
this.estimate = 32;
|
|
14
14
|
this.for = '';
|
|
15
15
|
this.label = '';
|
|
16
|
+
this.measured = false;
|
|
16
17
|
this.rows = [];
|
|
17
18
|
this.virtualize = new VirtualizeController(this, {
|
|
18
19
|
container: () => this.renderRoot.querySelector('[part="viewport"]'),
|
|
19
20
|
count: () => this.rows.length,
|
|
20
21
|
estimate: () => this.estimate,
|
|
22
|
+
measured: () => this.measured,
|
|
23
|
+
rows: () => this.drawn(),
|
|
21
24
|
});
|
|
22
25
|
}
|
|
26
|
+
drawn() {
|
|
27
|
+
return [...this.querySelectorAll('[data-index]')].map((element) => ({
|
|
28
|
+
element,
|
|
29
|
+
index: Number(element.dataset.index),
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
23
32
|
firstUpdated(changed) {
|
|
24
33
|
super.firstUpdated?.(changed);
|
|
25
34
|
this.read();
|
|
@@ -73,6 +82,7 @@ let HelixHeadlessVirtualList = class HelixHeadlessVirtualList extends HelixEleme
|
|
|
73
82
|
element.setAttribute('role', 'listitem');
|
|
74
83
|
element.setAttribute('aria-posinset', String(at + 1));
|
|
75
84
|
element.setAttribute('aria-setsize', String(total));
|
|
85
|
+
element.setAttribute('data-index', String(at));
|
|
76
86
|
}
|
|
77
87
|
fragment.append(clone);
|
|
78
88
|
}
|
|
@@ -102,6 +112,9 @@ __decorate([
|
|
|
102
112
|
__decorate([
|
|
103
113
|
property()
|
|
104
114
|
], HelixHeadlessVirtualList.prototype, "label", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
property({ type: Boolean })
|
|
117
|
+
], HelixHeadlessVirtualList.prototype, "measured", void 0);
|
|
105
118
|
__decorate([
|
|
106
119
|
state()
|
|
107
120
|
], HelixHeadlessVirtualList.prototype, "rows", void 0);
|
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.
|
|
4
|
+
"version": "0.6.0",
|
|
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.
|
|
49
|
-
"@fusion.dev/helix-icons": "0.
|
|
48
|
+
"@fusion.dev/helix-core": "0.6.0",
|
|
49
|
+
"@fusion.dev/helix-icons": "0.6.0",
|
|
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.
|
|
55
|
-
"@fusion.dev/helix-testing": "0.
|
|
54
|
+
"@fusion.dev/helix-cem": "0.6.0",
|
|
55
|
+
"@fusion.dev/helix-testing": "0.6.0",
|
|
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
|
@@ -15296,21 +15296,43 @@ past the end is the one write the platform answers with an exception. */
|
|
|
15296
15296
|
};
|
|
15297
15297
|
|
|
15298
15298
|
export type HelixHeadlessVirtualListProps = {
|
|
15299
|
-
/** How tall one row is, in pixels, used to map scroll offset to an index.
|
|
15299
|
+
/** How tall one row is, in pixels, used to map scroll offset to an index.
|
|
15300
|
+
|
|
15301
|
+
An estimate rather than a measurement while `measured` is off, which is
|
|
15302
|
+
right whenever the rows really are one height and is the cheaper of the two. */
|
|
15300
15303
|
estimate?: (HelixHeadlessVirtualList["estimate"]) | undefined;
|
|
15301
15304
|
/** Id of the element holding the rows, as JSON in a script. */
|
|
15302
15305
|
for?: (HelixHeadlessVirtualList["for"]) | undefined;
|
|
15303
15306
|
/** What the list is called, since the rendered rows are only a window on it. */
|
|
15304
15307
|
label?: (HelixHeadlessVirtualList["label"]) | undefined;
|
|
15308
|
+
/** Places rows by what they came to rather than by `estimate`.
|
|
15309
|
+
|
|
15310
|
+
**Off by default, because the straight line is better when it holds.** One
|
|
15311
|
+
estimate makes offset and index convert by division, which can never
|
|
15312
|
+
disagree with itself; measuring is what a set of genuinely different
|
|
15313
|
+
heights needs and costs a read of each row as it renders. A list of
|
|
15314
|
+
one-line rows should leave this alone. */
|
|
15315
|
+
measured?: (HelixHeadlessVirtualList["measured"]) | undefined;
|
|
15305
15316
|
};
|
|
15306
15317
|
|
|
15307
15318
|
export type HelixHeadlessVirtualListSolidJsProps = {
|
|
15308
|
-
/** How tall one row is, in pixels, used to map scroll offset to an index.
|
|
15319
|
+
/** How tall one row is, in pixels, used to map scroll offset to an index.
|
|
15320
|
+
|
|
15321
|
+
An estimate rather than a measurement while `measured` is off, which is
|
|
15322
|
+
right whenever the rows really are one height and is the cheaper of the two. */
|
|
15309
15323
|
"prop:estimate"?: (HelixHeadlessVirtualList["estimate"]) | undefined;
|
|
15310
15324
|
/** Id of the element holding the rows, as JSON in a script. */
|
|
15311
15325
|
"prop:for"?: (HelixHeadlessVirtualList["for"]) | undefined;
|
|
15312
15326
|
/** What the list is called, since the rendered rows are only a window on it. */
|
|
15313
15327
|
"prop:label"?: (HelixHeadlessVirtualList["label"]) | undefined;
|
|
15328
|
+
/** Places rows by what they came to rather than by `estimate`.
|
|
15329
|
+
|
|
15330
|
+
**Off by default, because the straight line is better when it holds.** One
|
|
15331
|
+
estimate makes offset and index convert by division, which can never
|
|
15332
|
+
disagree with itself; measuring is what a set of genuinely different
|
|
15333
|
+
heights needs and costs a read of each row as it renders. A list of
|
|
15334
|
+
one-line rows should leave this alone. */
|
|
15335
|
+
"prop:measured"?: (HelixHeadlessVirtualList["measured"]) | undefined;
|
|
15314
15336
|
|
|
15315
15337
|
/** Set the innerHTML of the element */
|
|
15316
15338
|
innerHTML?: (string) | undefined;
|
|
@@ -29423,8 +29445,18 @@ export type CustomElements = {
|
|
|
29423
29445
|
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
29424
29446
|
*
|
|
29425
29447
|
* - `estimate`: How tall one row is, in pixels, used to map scroll offset to an index.
|
|
29448
|
+
*
|
|
29449
|
+
* An estimate rather than a measurement while `measured` is off, which is
|
|
29450
|
+
* right whenever the rows really are one height and is the cheaper of the two.
|
|
29426
29451
|
* - `for`: Id of the element holding the rows, as JSON in a script.
|
|
29427
29452
|
* - `label`: What the list is called, since the rendered rows are only a window on it.
|
|
29453
|
+
* - `measured`: Places rows by what they came to rather than by `estimate`.
|
|
29454
|
+
*
|
|
29455
|
+
* **Off by default, because the straight line is better when it holds.** One
|
|
29456
|
+
* estimate makes offset and index convert by division, which can never
|
|
29457
|
+
* disagree with itself; measuring is what a set of genuinely different
|
|
29458
|
+
* heights needs and costs a read of each row as it renders. A list of
|
|
29459
|
+
* one-line rows should leave this alone.
|
|
29428
29460
|
* - `whenSettled`: Resolves a frame after the first update, when transitions are switched on.
|
|
29429
29461
|
*
|
|
29430
29462
|
* **Named `whenSettled` because `settled` is taken four times over**, by
|
|
@@ -43837,8 +43869,18 @@ export type CustomElementsSolidJs = {
|
|
|
43837
43869
|
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
43838
43870
|
*
|
|
43839
43871
|
* - `estimate`: How tall one row is, in pixels, used to map scroll offset to an index.
|
|
43872
|
+
*
|
|
43873
|
+
* An estimate rather than a measurement while `measured` is off, which is
|
|
43874
|
+
* right whenever the rows really are one height and is the cheaper of the two.
|
|
43840
43875
|
* - `for`: Id of the element holding the rows, as JSON in a script.
|
|
43841
43876
|
* - `label`: What the list is called, since the rendered rows are only a window on it.
|
|
43877
|
+
* - `measured`: Places rows by what they came to rather than by `estimate`.
|
|
43878
|
+
*
|
|
43879
|
+
* **Off by default, because the straight line is better when it holds.** One
|
|
43880
|
+
* estimate makes offset and index convert by division, which can never
|
|
43881
|
+
* disagree with itself; measuring is what a set of genuinely different
|
|
43882
|
+
* heights needs and costs a read of each row as it renders. A list of
|
|
43883
|
+
* one-line rows should leave this alone.
|
|
43842
43884
|
* - `whenSettled`: Resolves a frame after the first update, when transitions are switched on.
|
|
43843
43885
|
*
|
|
43844
43886
|
* **Named `whenSettled` because `settled` is taken four times over**, by
|
package/types/vue.d.ts
CHANGED
|
@@ -7846,12 +7846,23 @@ export type HelixHeadlessVideoVueEvents = {
|
|
|
7846
7846
|
};
|
|
7847
7847
|
|
|
7848
7848
|
export type HelixHeadlessVirtualListVueProps = {
|
|
7849
|
-
/** How tall one row is, in pixels, used to map scroll offset to an index.
|
|
7849
|
+
/** How tall one row is, in pixels, used to map scroll offset to an index.
|
|
7850
|
+
|
|
7851
|
+
An estimate rather than a measurement while `measured` is off, which is
|
|
7852
|
+
right whenever the rows really are one height and is the cheaper of the two. */
|
|
7850
7853
|
estimate?: (HelixHeadlessVirtualList["estimate"]) | undefined;
|
|
7851
7854
|
/** Id of the element holding the rows, as JSON in a script. */
|
|
7852
7855
|
for?: (HelixHeadlessVirtualList["for"]) | undefined;
|
|
7853
7856
|
/** What the list is called, since the rendered rows are only a window on it. */
|
|
7854
7857
|
label?: (HelixHeadlessVirtualList["label"]) | undefined;
|
|
7858
|
+
/** Places rows by what they came to rather than by `estimate`.
|
|
7859
|
+
|
|
7860
|
+
**Off by default, because the straight line is better when it holds.** One
|
|
7861
|
+
estimate makes offset and index convert by division, which can never
|
|
7862
|
+
disagree with itself; measuring is what a set of genuinely different
|
|
7863
|
+
heights needs and costs a read of each row as it renders. A list of
|
|
7864
|
+
one-line rows should leave this alone. */
|
|
7865
|
+
measured?: (HelixHeadlessVirtualList["measured"]) | undefined;
|
|
7855
7866
|
};
|
|
7856
7867
|
|
|
7857
7868
|
export type HelixHeadlessVirtualListVueEvents = {};
|