@fusion.dev/helix-core 0.31.0 → 0.32.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/controllers/floating-controller/floating-controller.d.ts +9 -0
- package/dist/controllers/floating-controller/floating-controller.js +5 -1
- package/dist/controllers/popover-controller/popover-controller.d.ts +5 -0
- package/dist/controllers/popover-controller/popover-controller.js +1 -0
- package/package.json +4 -4
package/custom-elements.json
CHANGED
|
@@ -1372,7 +1372,7 @@
|
|
|
1372
1372
|
},
|
|
1373
1373
|
"privacy": "private",
|
|
1374
1374
|
"readonly": true,
|
|
1375
|
-
"default": "new FloatingController(host, { anchor: options.anchor, ...(options.arrow === undefined ? {} : { arrow: options.arrow }), floating: options.surface, ...(options.offset === undefined ? {} : { offset: options.offset }), ...(options.placement === undefined ? {} : { placement: options.placement }), ...(options.within === undefined ? {} : { within: options.within }), })"
|
|
1375
|
+
"default": "new FloatingController(host, { anchor: options.anchor, ...(options.arrow === undefined ? {} : { arrow: options.arrow }), floating: options.surface, ...(options.offset === undefined ? {} : { offset: options.offset }), ...(options.onPlace === undefined ? {} : { onPlace: options.onPlace }), ...(options.placement === undefined ? {} : { placement: options.placement }), ...(options.within === undefined ? {} : { within: options.within }), })"
|
|
1376
1376
|
},
|
|
1377
1377
|
{
|
|
1378
1378
|
"kind": "field",
|
|
@@ -18,6 +18,15 @@ export interface FloatingOptions {
|
|
|
18
18
|
* reader cannot use.
|
|
19
19
|
*/
|
|
20
20
|
flip?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Told the placement the element landed on, after every measurement.
|
|
23
|
+
*
|
|
24
|
+
* `data-placement` already says it, on the floating element, which is inside
|
|
25
|
+
* the host's shadow root. A stylesheet outside reaches that element through
|
|
26
|
+
* `::part()`, and `::part()` cannot be followed by an attribute selector, so
|
|
27
|
+
* a host whose surface is drawn from outside records the side on itself.
|
|
28
|
+
*/
|
|
29
|
+
onPlace?: (placement: Placement) => void;
|
|
21
30
|
/**
|
|
22
31
|
* Space between the anchor and the floating element, in pixels.
|
|
23
32
|
*
|
|
@@ -37,7 +37,10 @@ export class FloatingController {
|
|
|
37
37
|
: this.options.placement;
|
|
38
38
|
const middleware = [offset(gap ?? 0)];
|
|
39
39
|
if (this.options.flip !== false) {
|
|
40
|
-
|
|
40
|
+
const side = (preferred ?? 'bottom-start').split('-')[0];
|
|
41
|
+
middleware.push(flip(side === 'left' || side === 'right'
|
|
42
|
+
? { crossAxis: 'alignment', fallbackAxisSideDirection: 'end' }
|
|
43
|
+
: {}));
|
|
41
44
|
}
|
|
42
45
|
if (this.options.shift !== false) {
|
|
43
46
|
const inside = this.options.within?.();
|
|
@@ -72,6 +75,7 @@ export class FloatingController {
|
|
|
72
75
|
});
|
|
73
76
|
floating.setAttribute('data-placement', placement);
|
|
74
77
|
floating.setAttribute('data-placed', '');
|
|
78
|
+
this.options.onPlace?.(placement);
|
|
75
79
|
const point = middlewareData.arrow;
|
|
76
80
|
if (pointer && point) {
|
|
77
81
|
Object.assign(pointer.style, {
|
|
@@ -56,6 +56,11 @@ export interface PopoverOptions {
|
|
|
56
56
|
* select puts focus back on its trigger, and a tooltip does neither.
|
|
57
57
|
*/
|
|
58
58
|
onDismiss: () => void;
|
|
59
|
+
/**
|
|
60
|
+
* Told the placement the surface landed on, after every measurement. Passed
|
|
61
|
+
* through to the floating pass, which says why a host would want it.
|
|
62
|
+
*/
|
|
63
|
+
onPlace?: (placement: Placement) => void;
|
|
59
64
|
/**
|
|
60
65
|
* Whether the host wants the surface up, read after every update.
|
|
61
66
|
*
|
|
@@ -9,6 +9,7 @@ export class PopoverController {
|
|
|
9
9
|
...(options.arrow === undefined ? {} : { arrow: options.arrow }),
|
|
10
10
|
floating: options.surface,
|
|
11
11
|
...(options.offset === undefined ? {} : { offset: options.offset }),
|
|
12
|
+
...(options.onPlace === undefined ? {} : { onPlace: options.onPlace }),
|
|
12
13
|
...(options.placement === undefined ? {} : { placement: options.placement }),
|
|
13
14
|
...(options.within === undefined ? {} : { within: options.within }),
|
|
14
15
|
});
|
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.32.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ross Sheppard <ross.sheppard@fusion.dev>",
|
|
7
7
|
"repository": {
|
|
@@ -34,12 +34,12 @@
|
|
|
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.
|
|
37
|
+
"@fusion.dev/helix-icons": "0.32.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@custom-elements-manifest/analyzer": "^0.11.0",
|
|
41
|
-
"@fusion.dev/helix-cem": "0.
|
|
42
|
-
"@fusion.dev/helix-testing": "0.
|
|
41
|
+
"@fusion.dev/helix-cem": "0.32.0",
|
|
42
|
+
"@fusion.dev/helix-testing": "0.32.0",
|
|
43
43
|
"lit": "^3.2.1"
|
|
44
44
|
},
|
|
45
45
|
"homepage": "https://fusion.dev",
|