@fusion.dev/helix-core 0.111.0 → 0.111.1
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
|
@@ -1358,6 +1358,54 @@
|
|
|
1358
1358
|
}
|
|
1359
1359
|
]
|
|
1360
1360
|
},
|
|
1361
|
+
{
|
|
1362
|
+
"kind": "javascript-module",
|
|
1363
|
+
"path": "src/controllers/host-click-controller/host-click-controller.ts",
|
|
1364
|
+
"declarations": [
|
|
1365
|
+
{
|
|
1366
|
+
"kind": "class",
|
|
1367
|
+
"description": "Passes a click on the host itself to the control inside that answers clicks.\n\n**A click dispatched on the host reaches nothing that toggles.** A switch,\na checkbox or a radio renders its control in its shadow root, and only a\nclick that lands there moves it. `element.click()`, a test's or an\nautomation's, is dispatched on the host, and so is the click a `<label for>`\non the page sends the element it names: `helix-switch` left `checked` false\nunder `click()` while a pointer press on it turned it on. A native checkbox\ntoggles on both, and code written against one expects it.\n\n**Only a click that starts at the host**, whose path begins there. A press\ninside the shadow root reaches the host too, retargeted, and has already\ndone its work where it landed; the click this sends to the control reaches\nthe host the same way, and goes no further.",
|
|
1368
|
+
"name": "HostClickController",
|
|
1369
|
+
"members": [
|
|
1370
|
+
{
|
|
1371
|
+
"kind": "method",
|
|
1372
|
+
"name": "hostConnected",
|
|
1373
|
+
"return": {
|
|
1374
|
+
"type": {
|
|
1375
|
+
"text": "void"
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
},
|
|
1379
|
+
{
|
|
1380
|
+
"kind": "method",
|
|
1381
|
+
"name": "hostDisconnected",
|
|
1382
|
+
"return": {
|
|
1383
|
+
"type": {
|
|
1384
|
+
"text": "void"
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
},
|
|
1388
|
+
{
|
|
1389
|
+
"kind": "field",
|
|
1390
|
+
"name": "forward",
|
|
1391
|
+
"privacy": "private",
|
|
1392
|
+
"readonly": true
|
|
1393
|
+
}
|
|
1394
|
+
],
|
|
1395
|
+
"helix": {}
|
|
1396
|
+
}
|
|
1397
|
+
],
|
|
1398
|
+
"exports": [
|
|
1399
|
+
{
|
|
1400
|
+
"kind": "js",
|
|
1401
|
+
"name": "HostClickController",
|
|
1402
|
+
"declaration": {
|
|
1403
|
+
"name": "HostClickController",
|
|
1404
|
+
"module": "src/controllers/host-click-controller/host-click-controller.ts"
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
]
|
|
1408
|
+
},
|
|
1361
1409
|
{
|
|
1362
1410
|
"kind": "javascript-module",
|
|
1363
1411
|
"path": "src/controllers/idle-controller/idle-controller.ts",
|
|
@@ -6046,6 +6094,14 @@
|
|
|
6046
6094
|
"module": "./controllers/fullscreen-controller/fullscreen-controller.js"
|
|
6047
6095
|
}
|
|
6048
6096
|
},
|
|
6097
|
+
{
|
|
6098
|
+
"kind": "js",
|
|
6099
|
+
"name": "HostClickController",
|
|
6100
|
+
"declaration": {
|
|
6101
|
+
"name": "HostClickController",
|
|
6102
|
+
"module": "./controllers/host-click-controller/host-click-controller.js"
|
|
6103
|
+
}
|
|
6104
|
+
},
|
|
6049
6105
|
{
|
|
6050
6106
|
"kind": "js",
|
|
6051
6107
|
"name": "IdleController",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* Passes a click on the host itself to the control inside that answers clicks.
|
|
4
|
+
*
|
|
5
|
+
* **A click dispatched on the host reaches nothing that toggles.** A switch,
|
|
6
|
+
* a checkbox or a radio renders its control in its shadow root, and only a
|
|
7
|
+
* click that lands there moves it. `element.click()`, a test's or an
|
|
8
|
+
* automation's, is dispatched on the host, and so is the click a `<label for>`
|
|
9
|
+
* on the page sends the element it names: `helix-switch` left `checked` false
|
|
10
|
+
* under `click()` while a pointer press on it turned it on. A native checkbox
|
|
11
|
+
* toggles on both, and code written against one expects it.
|
|
12
|
+
*
|
|
13
|
+
* **Only a click that starts at the host**, whose path begins there. A press
|
|
14
|
+
* inside the shadow root reaches the host too, retargeted, and has already
|
|
15
|
+
* done its work where it landed; the click this sends to the control reaches
|
|
16
|
+
* the host the same way, and goes no further.
|
|
17
|
+
*/
|
|
18
|
+
export declare class HostClickController implements ReactiveController {
|
|
19
|
+
private readonly host;
|
|
20
|
+
private readonly target;
|
|
21
|
+
constructor(host: ReactiveControllerHost & HTMLElement, target: () => HTMLElement | null | undefined);
|
|
22
|
+
hostConnected(): void;
|
|
23
|
+
hostDisconnected(): void;
|
|
24
|
+
private readonly forward;
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class HostClickController {
|
|
2
|
+
constructor(host, target) {
|
|
3
|
+
this.host = host;
|
|
4
|
+
this.target = target;
|
|
5
|
+
this.forward = (event) => {
|
|
6
|
+
if (event.composedPath()[0] !== this.host) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
this.target()?.click();
|
|
10
|
+
};
|
|
11
|
+
host.addController(this);
|
|
12
|
+
}
|
|
13
|
+
hostConnected() {
|
|
14
|
+
this.host.addEventListener('click', this.forward);
|
|
15
|
+
}
|
|
16
|
+
hostDisconnected() {
|
|
17
|
+
this.host.removeEventListener('click', this.forward);
|
|
18
|
+
}
|
|
19
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { DismissController, type DismissOptions, } from './controllers/dismiss-c
|
|
|
9
9
|
export { DrilldownController, type DrilldownOptions, } from './controllers/drilldown-controller/drilldown-controller.js';
|
|
10
10
|
export { FloatingController, type FloatingOptions, type Placement, type Side, } from './controllers/floating-controller/floating-controller.js';
|
|
11
11
|
export { FullscreenController } from './controllers/fullscreen-controller/fullscreen-controller.js';
|
|
12
|
+
export { HostClickController } from './controllers/host-click-controller/host-click-controller.js';
|
|
12
13
|
export { IdleController } from './controllers/idle-controller/idle-controller.js';
|
|
13
14
|
export { IndicatorController, type IndicatorOptions, } from './controllers/indicator-controller/indicator-controller.js';
|
|
14
15
|
export { KeyboardNavigationController, type KeyboardNavigationOptions, type NavigableItem, } from './controllers/keyboard-navigation-controller/keyboard-navigation-controller.js';
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export { DismissController, } from './controllers/dismiss-controller/dismiss-con
|
|
|
9
9
|
export { DrilldownController, } from './controllers/drilldown-controller/drilldown-controller.js';
|
|
10
10
|
export { FloatingController, } from './controllers/floating-controller/floating-controller.js';
|
|
11
11
|
export { FullscreenController } from './controllers/fullscreen-controller/fullscreen-controller.js';
|
|
12
|
+
export { HostClickController } from './controllers/host-click-controller/host-click-controller.js';
|
|
12
13
|
export { IdleController } from './controllers/idle-controller/idle-controller.js';
|
|
13
14
|
export { IndicatorController, } from './controllers/indicator-controller/indicator-controller.js';
|
|
14
15
|
export { KeyboardNavigationController, } from './controllers/keyboard-navigation-controller/keyboard-navigation-controller.js';
|
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.111.
|
|
4
|
+
"version": "0.111.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ross Sheppard <ross.sheppard@fusion.dev>",
|
|
7
7
|
"repository": {
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"bugs": "https://github.com/project-fusion/fusion/issues",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@floating-ui/dom": "^1.8.0",
|
|
37
|
-
"@fusion.dev/helix-icons": "0.111.
|
|
37
|
+
"@fusion.dev/helix-icons": "0.111.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@fusion.dev/helix-cem": "0.111.
|
|
41
|
-
"@fusion.dev/helix-testing": "0.111.
|
|
40
|
+
"@fusion.dev/helix-cem": "0.111.1",
|
|
41
|
+
"@fusion.dev/helix-testing": "0.111.1",
|
|
42
42
|
"@lit-labs/ssr": "^4.1.0",
|
|
43
43
|
"lit": "^3.2.1"
|
|
44
44
|
},
|