@fusion.dev/helix-core 0.234.0 → 0.235.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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/audit-nesting/audit-nesting-off.d.ts +3 -1
- package/dist/utils/audit-nesting/audit-nesting-off.js +1 -0
- package/dist/utils/audit-nesting/audit-nesting.d.ts +18 -0
- package/dist/utils/audit-nesting/audit-nesting.js +18 -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 +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { auditChildren, auditEntry } from '@fusion.dev/helix-core/audits/children';
|
|
2
2
|
export { auditIconControl, auditName } from '@fusion.dev/helix-core/audits/name';
|
|
3
|
-
export { auditNesting } from '@fusion.dev/helix-core/audits/nesting';
|
|
3
|
+
export { auditNesting, auditWrapped } from '@fusion.dev/helix-core/audits/nesting';
|
|
4
4
|
export { auditServed } from '@fusion.dev/helix-core/audits/served';
|
|
5
5
|
export { AriaForwardController, type AriaForwardOptions, } from './controllers/aria-forward-controller/aria-forward-controller.js';
|
|
6
6
|
export { ArrivalController, type ArrivalOptions, } from './controllers/arrival-controller/arrival-controller.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { auditChildren, auditEntry } from '@fusion.dev/helix-core/audits/children';
|
|
2
2
|
export { auditIconControl, auditName } from '@fusion.dev/helix-core/audits/name';
|
|
3
|
-
export { auditNesting } from '@fusion.dev/helix-core/audits/nesting';
|
|
3
|
+
export { auditNesting, auditWrapped } from '@fusion.dev/helix-core/audits/nesting';
|
|
4
4
|
export { auditServed } from '@fusion.dev/helix-core/audits/served';
|
|
5
5
|
export { AriaForwardController, } from './controllers/aria-forward-controller/aria-forward-controller.js';
|
|
6
6
|
export { ArrivalController, } from './controllers/arrival-controller/arrival-controller.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { auditNesting as audit } from './audit-nesting.js';
|
|
1
|
+
import type { auditNesting as audit, auditWrapped as auditRows } from './audit-nesting.js';
|
|
2
2
|
/**
|
|
3
3
|
* The unslotted-item warning in a production build: nothing.
|
|
4
4
|
*
|
|
@@ -8,3 +8,5 @@ import type { auditNesting as audit } from './audit-nesting.js';
|
|
|
8
8
|
* builds. See `audit-nesting.ts`.
|
|
9
9
|
*/
|
|
10
10
|
export declare const auditNesting: typeof audit;
|
|
11
|
+
/** The wrapped-row warning in a production build: nothing. See `audit-nesting.ts`. */
|
|
12
|
+
export declare const auditWrapped: typeof auditRows;
|
|
@@ -17,3 +17,21 @@
|
|
|
17
17
|
* `slot` is the name of the slot that nests an item.
|
|
18
18
|
*/
|
|
19
19
|
export declare const auditNesting: (host: HTMLElement, slot: string) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Reports a row that sits inside an element of the page's own, between it and
|
|
22
|
+
* the container, where the container reads only its direct children.
|
|
23
|
+
*
|
|
24
|
+
* A menu's rows are its children, the rows of its sections and the rows in
|
|
25
|
+
* another row's `submenu` slot. A row inside a `<div>` or a framework's host
|
|
26
|
+
* element is none of those: the arrow keys skip it, and a drilled page hides
|
|
27
|
+
* every child that is not a row, so a wrapped row's submenu opens on an empty
|
|
28
|
+
* page. **Nothing unwraps it**, for the reason `auditNesting` gives.
|
|
29
|
+
*
|
|
30
|
+
* **In a development build only**, from `#audit-nesting`, as `auditNesting` is.
|
|
31
|
+
*
|
|
32
|
+
* `row` is the row's tag. `reached` returns the rows the container reads, and is
|
|
33
|
+
* called only here, so a production build never walks the tree for it.
|
|
34
|
+
* `consequence` says what being wrapped costs the row it is given, after "so",
|
|
35
|
+
* and `fix` is the sentence that says where the row belongs.
|
|
36
|
+
*/
|
|
37
|
+
export declare const auditWrapped: (host: HTMLElement, row: string, reached: () => Iterable<Element>, consequence: (stray: Element) => string, fix: string) => void;
|
|
@@ -17,3 +17,21 @@ export const auditNesting = (host, slot) => {
|
|
|
17
17
|
tag: host.localName,
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
|
+
const wrapped = new WeakSet();
|
|
21
|
+
export const auditWrapped = (host, row, reached, consequence, fix) => {
|
|
22
|
+
if (wrapped.has(host)) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const known = new Set(reached());
|
|
26
|
+
const stray = [...host.querySelectorAll(row)].find((each) => !known.has(each) && each.parentElement?.closest(host.localName) === host);
|
|
27
|
+
const wrapper = stray?.parentElement;
|
|
28
|
+
if (!(stray && wrapper)) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
wrapped.add(host);
|
|
32
|
+
reportRuntime({
|
|
33
|
+
kind: 'wrapped-row',
|
|
34
|
+
message: `<${stray.localName}> sits inside a <${wrapper.localName}> in <${host.localName}>, so ${consequence(stray)}. ${fix}`,
|
|
35
|
+
tag: host.localName,
|
|
36
|
+
});
|
|
37
|
+
};
|
|
@@ -127,6 +127,11 @@ export type RuntimeKind =
|
|
|
127
127
|
| 'untold-toggle'
|
|
128
128
|
/** A slotted trigger is a plain element, which cannot be told it opens something. */
|
|
129
129
|
| 'untold-trigger'
|
|
130
|
+
/**
|
|
131
|
+
* A row sits inside an element between it and the container that reads it, such as a menu
|
|
132
|
+
* item in a `<div>`, so the keys skip it and its submenu opens empty. Development builds only.
|
|
133
|
+
*/
|
|
134
|
+
| 'wrapped-row'
|
|
130
135
|
/** A tooltip wraps a trigger that does not name it, and opened before a reader reached the trigger. */
|
|
131
136
|
| 'wrapped-trigger';
|
|
132
137
|
/** One event: what went wrong, where, and the sentence that says what to do. */
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.235.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.235.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Fusion Development Group",
|
|
7
7
|
"repository": {
|
|
@@ -81,12 +81,12 @@
|
|
|
81
81
|
"bugs": "https://github.com/project-fusion/fusion/issues",
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@floating-ui/dom": "^1.8.0",
|
|
84
|
-
"@fusion.dev/helix-icons": "0.
|
|
84
|
+
"@fusion.dev/helix-icons": "0.235.0",
|
|
85
85
|
"tslib": "^2.8.1"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
|
-
"@fusion.dev/helix-cem": "0.
|
|
89
|
-
"@fusion.dev/helix-testing": "0.
|
|
88
|
+
"@fusion.dev/helix-cem": "0.235.0",
|
|
89
|
+
"@fusion.dev/helix-testing": "0.235.0",
|
|
90
90
|
"@lit-labs/ssr": "^4.1.0",
|
|
91
91
|
"lit": "^3.2.1"
|
|
92
92
|
},
|