@fusion.dev/helix-core 0.169.0 → 0.170.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 +86 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/utils/audit-served/audit-served-off.d.ts +10 -0
- package/dist/utils/audit-served/audit-served-off.js +1 -0
- package/dist/utils/audit-served/audit-served.d.ts +20 -0
- package/dist/utils/audit-served/audit-served.js +32 -0
- package/dist/utils/report-runtime/report-runtime.d.ts +5 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +15 -4
package/custom-elements.json
CHANGED
|
@@ -12743,6 +12743,14 @@
|
|
|
12743
12743
|
"package": "#audit-name"
|
|
12744
12744
|
}
|
|
12745
12745
|
},
|
|
12746
|
+
{
|
|
12747
|
+
"kind": "js",
|
|
12748
|
+
"name": "auditServed",
|
|
12749
|
+
"declaration": {
|
|
12750
|
+
"name": "auditServed",
|
|
12751
|
+
"package": "#audit-served"
|
|
12752
|
+
}
|
|
12753
|
+
},
|
|
12746
12754
|
{
|
|
12747
12755
|
"kind": "js",
|
|
12748
12756
|
"name": "AriaForwardController",
|
|
@@ -24552,6 +24560,82 @@
|
|
|
24552
24560
|
}
|
|
24553
24561
|
]
|
|
24554
24562
|
},
|
|
24563
|
+
{
|
|
24564
|
+
"kind": "javascript-module",
|
|
24565
|
+
"path": "src/utils/audit-served/audit-served-off.ts",
|
|
24566
|
+
"declarations": [
|
|
24567
|
+
{
|
|
24568
|
+
"kind": "function",
|
|
24569
|
+
"name": "auditServed",
|
|
24570
|
+
"description": "The served-rows check in a production build: nothing.\n\n`#audit-served` resolves here unless the bundler or runtime asks for the\n`development` condition, so a production build carries none of the check's\ncode. The signature is the check's, so a call site reads the same in both\nbuilds. See `audit-served.ts`.",
|
|
24571
|
+
"type": {
|
|
24572
|
+
"text": "typeof audit"
|
|
24573
|
+
}
|
|
24574
|
+
}
|
|
24575
|
+
],
|
|
24576
|
+
"exports": [
|
|
24577
|
+
{
|
|
24578
|
+
"kind": "js",
|
|
24579
|
+
"name": "auditServed",
|
|
24580
|
+
"declaration": {
|
|
24581
|
+
"name": "auditServed",
|
|
24582
|
+
"module": "src/utils/audit-served/audit-served-off.ts"
|
|
24583
|
+
}
|
|
24584
|
+
}
|
|
24585
|
+
]
|
|
24586
|
+
},
|
|
24587
|
+
{
|
|
24588
|
+
"kind": "javascript-module",
|
|
24589
|
+
"path": "src/utils/audit-served/audit-served.ts",
|
|
24590
|
+
"declarations": [
|
|
24591
|
+
{
|
|
24592
|
+
"kind": "function",
|
|
24593
|
+
"name": "auditServed",
|
|
24594
|
+
"return": {
|
|
24595
|
+
"type": {
|
|
24596
|
+
"text": "void"
|
|
24597
|
+
}
|
|
24598
|
+
},
|
|
24599
|
+
"parameters": [
|
|
24600
|
+
{
|
|
24601
|
+
"name": "host",
|
|
24602
|
+
"type": {
|
|
24603
|
+
"text": "HTMLElement"
|
|
24604
|
+
}
|
|
24605
|
+
},
|
|
24606
|
+
{
|
|
24607
|
+
"name": "served",
|
|
24608
|
+
"type": {
|
|
24609
|
+
"text": "readonly Element[]"
|
|
24610
|
+
}
|
|
24611
|
+
},
|
|
24612
|
+
{
|
|
24613
|
+
"name": "drawn",
|
|
24614
|
+
"type": {
|
|
24615
|
+
"text": "readonly Element[]"
|
|
24616
|
+
}
|
|
24617
|
+
},
|
|
24618
|
+
{
|
|
24619
|
+
"name": "page",
|
|
24620
|
+
"type": {
|
|
24621
|
+
"text": "number"
|
|
24622
|
+
}
|
|
24623
|
+
}
|
|
24624
|
+
],
|
|
24625
|
+
"description": "Reports a table whose first drawn page differs from the rows the page\nserved, which a reader sees as the rows changing under them once the\nscript runs.\n\n**The served rows are the page's own markup and the drawn ones are the\ntable's**, so nothing else can catch it: the two are made by different\ncode, often on different machines, and either can sort, page or format\ndifferently. Compared by the words in each cell, which is what a reader\nsees change, and only as far as the first difference.\n\n**In a development build only**, as `missing-name` is: every table would pay\nfor a sentence meant for the person writing the page. Core imports it as\n`#audit-served`, which `package.json` resolves here under the `development`\ncondition and to `audit-served-off.ts`, which does nothing, everywhere else.\n\n`served` are the rows the page wrote, `drawn` the rows the table drew in\ntheir place, and `page` how many rows the first page holds."
|
|
24626
|
+
}
|
|
24627
|
+
],
|
|
24628
|
+
"exports": [
|
|
24629
|
+
{
|
|
24630
|
+
"kind": "js",
|
|
24631
|
+
"name": "auditServed",
|
|
24632
|
+
"declaration": {
|
|
24633
|
+
"name": "auditServed",
|
|
24634
|
+
"module": "src/utils/audit-served/audit-served.ts"
|
|
24635
|
+
}
|
|
24636
|
+
}
|
|
24637
|
+
]
|
|
24638
|
+
},
|
|
24555
24639
|
{
|
|
24556
24640
|
"kind": "javascript-module",
|
|
24557
24641
|
"path": "src/utils/audit-source/audit-source-off.ts",
|
|
@@ -33589,7 +33673,7 @@
|
|
|
33589
33673
|
"type": {
|
|
33590
33674
|
"text": "string"
|
|
33591
33675
|
},
|
|
33592
|
-
"default": "'0.
|
|
33676
|
+
"default": "'0.170.0'",
|
|
33593
33677
|
"description": "The version of the package this file ships in.\n\n**Written by `fusion/scripts/version.mjs`** wherever it writes the package's\n`package.json`, and stamped back into the repository beside it after a\nrelease, so the two never disagree; a spec beside this holds them to it.\nNothing else in the running code knows which release it is."
|
|
33594
33678
|
}
|
|
33595
33679
|
],
|
|
@@ -34149,6 +34233,6 @@
|
|
|
34149
34233
|
],
|
|
34150
34234
|
"helix": {
|
|
34151
34235
|
"package": "@fusion.dev/helix-core",
|
|
34152
|
-
"version": "0.
|
|
34236
|
+
"version": "0.170.0"
|
|
34153
34237
|
}
|
|
34154
34238
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { auditName } from '@fusion.dev/helix-core/audits/name';
|
|
2
|
+
export { auditServed } from '@fusion.dev/helix-core/audits/served';
|
|
2
3
|
export { AriaForwardController, type AriaForwardOptions, } from './controllers/aria-forward-controller/aria-forward-controller.js';
|
|
3
4
|
export { ArrivalController, type ArrivalOptions, } from './controllers/arrival-controller/arrival-controller.js';
|
|
4
5
|
export { ChartPointerController, type ChartPointerHost, type ReadingHeard, } from './controllers/chart-pointer-controller/chart-pointer-controller.js';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { auditName } from '@fusion.dev/helix-core/audits/name';
|
|
2
|
+
export { auditServed } from '@fusion.dev/helix-core/audits/served';
|
|
2
3
|
export { AriaForwardController, } from './controllers/aria-forward-controller/aria-forward-controller.js';
|
|
3
4
|
export { ArrivalController, } from './controllers/arrival-controller/arrival-controller.js';
|
|
4
5
|
export { ChartPointerController, } from './controllers/chart-pointer-controller/chart-pointer-controller.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { auditServed as audit } from './audit-served.js';
|
|
2
|
+
/**
|
|
3
|
+
* The served-rows check in a production build: nothing.
|
|
4
|
+
*
|
|
5
|
+
* `#audit-served` resolves here unless the bundler or runtime asks for the
|
|
6
|
+
* `development` condition, so a production build carries none of the check's
|
|
7
|
+
* code. The signature is the check's, so a call site reads the same in both
|
|
8
|
+
* builds. See `audit-served.ts`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const auditServed: typeof audit;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const auditServed = () => { };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reports a table whose first drawn page differs from the rows the page
|
|
3
|
+
* served, which a reader sees as the rows changing under them once the
|
|
4
|
+
* script runs.
|
|
5
|
+
*
|
|
6
|
+
* **The served rows are the page's own markup and the drawn ones are the
|
|
7
|
+
* table's**, so nothing else can catch it: the two are made by different
|
|
8
|
+
* code, often on different machines, and either can sort, page or format
|
|
9
|
+
* differently. Compared by the words in each cell, which is what a reader
|
|
10
|
+
* sees change, and only as far as the first difference.
|
|
11
|
+
*
|
|
12
|
+
* **In a development build only**, as `missing-name` is: every table would pay
|
|
13
|
+
* for a sentence meant for the person writing the page. Core imports it as
|
|
14
|
+
* `#audit-served`, which `package.json` resolves here under the `development`
|
|
15
|
+
* condition and to `audit-served-off.ts`, which does nothing, everywhere else.
|
|
16
|
+
*
|
|
17
|
+
* `served` are the rows the page wrote, `drawn` the rows the table drew in
|
|
18
|
+
* their place, and `page` how many rows the first page holds.
|
|
19
|
+
*/
|
|
20
|
+
export declare const auditServed: (host: HTMLElement, served: readonly Element[], drawn: readonly Element[], page: number) => void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { reportRuntime } from '../report-runtime/report-runtime.js';
|
|
2
|
+
const audited = new WeakSet();
|
|
3
|
+
const said = (row) => [...row.children]
|
|
4
|
+
.filter((cell) => /-table-cell$/.test(cell.localName) || cell.matches('[part~="cell"]'))
|
|
5
|
+
.map((cell) => (cell.textContent ?? '').replace(/\s+/g, ' ').trim())
|
|
6
|
+
.join(' | ');
|
|
7
|
+
export const auditServed = (host, served, drawn, page) => {
|
|
8
|
+
if (served.length === 0 || audited.has(host)) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const table = `<${host.localName}${host.getAttribute('label') ? ` label="${host.getAttribute('label')}"` : ''}>`;
|
|
12
|
+
let differs = '';
|
|
13
|
+
if (served.length > page) {
|
|
14
|
+
differs = `serves ${served.length} rows and its first page holds ${page}`;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
const at = served.findIndex((row, index) => drawn[index] && said(row) !== said(drawn[index]));
|
|
18
|
+
if (at !== -1) {
|
|
19
|
+
differs = `serves row ${at + 1} as "${said(served[at])}" and draws it as "${said(drawn[at])}"`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (differs === '') {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
audited.add(host);
|
|
26
|
+
reportRuntime({
|
|
27
|
+
kind: 'served-rows-differ',
|
|
28
|
+
message: `${table} ${differs}, so the rows change once the table draws its own. ` +
|
|
29
|
+
'Serve the first page in the order, the page size and the formatting the table draws it with.',
|
|
30
|
+
tag: host.localName,
|
|
31
|
+
});
|
|
32
|
+
};
|
|
@@ -63,6 +63,11 @@ export type RuntimeKind =
|
|
|
63
63
|
| 'refused-length'
|
|
64
64
|
/** A React handler prop is a removed callback, which never ran from JSX. Development builds only. */
|
|
65
65
|
| 'removed-callback'
|
|
66
|
+
/**
|
|
67
|
+
* A Data Table's first drawn page differs from the rows the page served, so the rows change
|
|
68
|
+
* once it draws. Development builds only.
|
|
69
|
+
*/
|
|
70
|
+
| 'served-rows-differ'
|
|
66
71
|
/**
|
|
67
72
|
* A React handler prop uses Solid's `on:`, which React reads as another event's name.
|
|
68
73
|
* Development builds only.
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.170.0';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fusion.dev/helix-core",
|
|
3
3
|
"description": "Helix element primitives: base classes, mixins, decorators, utilities.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.170.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ross Sheppard <ross.sheppard@fusion.dev>",
|
|
7
7
|
"repository": {
|
|
@@ -29,6 +29,12 @@
|
|
|
29
29
|
"helix-development": "./dist/helix-element/react-audit.js",
|
|
30
30
|
"default": "./dist/helix-element/react-audit-off.js"
|
|
31
31
|
},
|
|
32
|
+
"./audits/served": {
|
|
33
|
+
"types": "./dist/utils/audit-served/audit-served.d.ts",
|
|
34
|
+
"development": "./dist/utils/audit-served/audit-served.js",
|
|
35
|
+
"helix-development": "./dist/utils/audit-served/audit-served.js",
|
|
36
|
+
"default": "./dist/utils/audit-served/audit-served-off.js"
|
|
37
|
+
},
|
|
32
38
|
"./audits/source": {
|
|
33
39
|
"types": "./dist/utils/audit-source/audit-source.d.ts",
|
|
34
40
|
"development": "./dist/utils/audit-source/audit-source.js",
|
|
@@ -56,11 +62,11 @@
|
|
|
56
62
|
"bugs": "https://github.com/project-fusion/fusion/issues",
|
|
57
63
|
"dependencies": {
|
|
58
64
|
"@floating-ui/dom": "^1.8.0",
|
|
59
|
-
"@fusion.dev/helix-icons": "0.
|
|
65
|
+
"@fusion.dev/helix-icons": "0.170.0"
|
|
60
66
|
},
|
|
61
67
|
"devDependencies": {
|
|
62
|
-
"@fusion.dev/helix-cem": "0.
|
|
63
|
-
"@fusion.dev/helix-testing": "0.
|
|
68
|
+
"@fusion.dev/helix-cem": "0.170.0",
|
|
69
|
+
"@fusion.dev/helix-testing": "0.170.0",
|
|
64
70
|
"@lit-labs/ssr": "^4.1.0",
|
|
65
71
|
"lit": "^3.2.1"
|
|
66
72
|
},
|
|
@@ -71,6 +77,11 @@
|
|
|
71
77
|
"helix-development": "./src/utils/audit-name/audit-name.ts",
|
|
72
78
|
"default": "./src/utils/audit-name/audit-name-off.ts"
|
|
73
79
|
},
|
|
80
|
+
"#audit-served": {
|
|
81
|
+
"development": "./src/utils/audit-served/audit-served.ts",
|
|
82
|
+
"helix-development": "./src/utils/audit-served/audit-served.ts",
|
|
83
|
+
"default": "./src/utils/audit-served/audit-served-off.ts"
|
|
84
|
+
},
|
|
74
85
|
"#audit-source": {
|
|
75
86
|
"development": "./src/utils/audit-source/audit-source.ts",
|
|
76
87
|
"helix-development": "./src/utils/audit-source/audit-source.ts",
|