@editora/ui-core 0.1.12 → 0.1.14
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/README.md +95 -5
- package/dist/alert-dialog.cjs.js +18 -18
- package/dist/alert-dialog.esm.js +130 -117
- package/dist/app-header.cjs.js +22 -2
- package/dist/app-header.esm.js +22 -2
- package/dist/badge.cjs.js +5 -5
- package/dist/badge.esm.js +9 -8
- package/dist/color-picker.cjs.js +4 -4
- package/dist/color-picker.esm.js +40 -31
- package/dist/combobox.cjs.js +21 -21
- package/dist/combobox.esm.js +79 -40
- package/dist/command-palette.cjs.js +1 -1
- package/dist/command-palette.esm.js +2 -2
- package/dist/components/date-time-utils.d.ts +2 -1
- package/dist/components/date-time-utils.d.ts.map +1 -1
- package/dist/components/ui-alert-dialog.d.ts +2 -0
- package/dist/components/ui-alert-dialog.d.ts.map +1 -1
- package/dist/components/ui-app-header.d.ts.map +1 -1
- package/dist/components/ui-badge.d.ts.map +1 -1
- package/dist/components/ui-color-picker.d.ts.map +1 -1
- package/dist/components/ui-combobox.d.ts +4 -1
- package/dist/components/ui-combobox.d.ts.map +1 -1
- package/dist/components/ui-context-menu.d.ts +6 -0
- package/dist/components/ui-context-menu.d.ts.map +1 -1
- package/dist/components/ui-date-picker.d.ts +3 -0
- package/dist/components/ui-date-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-picker.d.ts +3 -0
- package/dist/components/ui-date-range-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-time-picker.d.ts +3 -0
- package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
- package/dist/components/ui-date-time-picker.d.ts +3 -0
- package/dist/components/ui-date-time-picker.d.ts.map +1 -1
- package/dist/components/ui-dialog.d.ts +3 -0
- package/dist/components/ui-dialog.d.ts.map +1 -1
- package/dist/components/ui-drawer.d.ts +14 -0
- package/dist/components/ui-drawer.d.ts.map +1 -1
- package/dist/components/ui-floating-toolbar.d.ts +3 -0
- package/dist/components/ui-floating-toolbar.d.ts.map +1 -1
- package/dist/components/ui-gantt.d.ts +30 -1
- package/dist/components/ui-gantt.d.ts.map +1 -1
- package/dist/components/ui-hover-card.d.ts +3 -0
- package/dist/components/ui-hover-card.d.ts.map +1 -1
- package/dist/components/ui-menu.d.ts +1 -0
- package/dist/components/ui-menu.d.ts.map +1 -1
- package/dist/components/ui-menubar.d.ts +1 -0
- package/dist/components/ui-menubar.d.ts.map +1 -1
- package/dist/components/ui-positioner.d.ts.map +1 -1
- package/dist/components/ui-quick-actions.d.ts.map +1 -1
- package/dist/components/ui-radio.d.ts +47 -0
- package/dist/components/ui-radio.d.ts.map +1 -0
- package/dist/components/ui-select.d.ts +8 -0
- package/dist/components/ui-select.d.ts.map +1 -1
- package/dist/components/ui-selection-popup.d.ts.map +1 -1
- package/dist/components/ui-stepper.d.ts.map +1 -1
- package/dist/components/ui-time-picker.d.ts +3 -0
- package/dist/components/ui-time-picker.d.ts.map +1 -1
- package/dist/context-menu.cjs.js +12 -12
- package/dist/context-menu.esm.js +160 -133
- package/dist/date-field.cjs.js +1 -1
- package/dist/date-field.esm.js +3 -2
- package/dist/date-picker.cjs.js +13 -13
- package/dist/date-picker.esm.js +101 -67
- package/dist/date-range-picker.cjs.js +14 -14
- package/dist/date-range-picker.esm.js +99 -65
- package/dist/date-range-time-picker.cjs.js +13 -13
- package/dist/date-range-time-picker.esm.js +77 -45
- package/dist/date-time-picker.cjs.js +13 -13
- package/dist/date-time-picker.esm.js +133 -101
- package/dist/date-time-utils-66480de4.js +1 -0
- package/dist/date-time-utils-a2c7af25.mjs +307 -0
- package/dist/dialog.cjs.js +29 -20
- package/dist/dialog.esm.js +90 -70
- package/dist/drawer.cjs.js +16 -16
- package/dist/drawer.esm.js +216 -98
- package/dist/floating-toolbar.cjs.js +6 -16
- package/dist/floating-toolbar.esm.js +57 -40
- package/dist/gantt.cjs.js +656 -74
- package/dist/gantt.esm.js +1050 -100
- package/dist/hover-card.cjs.js +4 -4
- package/dist/hover-card.esm.js +62 -39
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +300 -286
- package/dist/menu.cjs.js +2 -2
- package/dist/menu.esm.js +118 -110
- package/dist/menubar.cjs.js +5 -5
- package/dist/menubar.esm.js +83 -78
- package/dist/{overlayManager-ece06517.js → overlayManager-0eda4e08.js} +1 -1
- package/dist/{overlayManager-86454af7.mjs → overlayManager-5bbd4dc3.mjs} +1 -1
- package/dist/popover.cjs.js +1 -1
- package/dist/popover.esm.js +2 -2
- package/dist/portal-c69756c0.js +1 -0
- package/dist/portal-fe73e5cc.mjs +123 -0
- package/dist/portal.d.ts +29 -3
- package/dist/portal.d.ts.map +1 -1
- package/dist/positioner-33529bb8.js +1 -0
- package/dist/positioner-e9770c66.mjs +582 -0
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +36 -26
- package/dist/primitives/positioner.d.ts +199 -1
- package/dist/primitives/positioner.d.ts.map +1 -1
- package/dist/quick-actions.cjs.js +10 -4
- package/dist/quick-actions.esm.js +27 -21
- package/dist/radio.cjs.js +259 -0
- package/dist/radio.esm.js +455 -0
- package/dist/{runtime-4ac0107b.mjs → runtime-161f68a2.mjs} +24 -23
- package/dist/runtime-3f13807b.js +1 -0
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.esm.js +39 -24
- package/dist/scroll-lock-31da444f.mjs +56 -0
- package/dist/scroll-lock-d7b0df21.js +1 -0
- package/dist/scroll-lock.d.ts.map +1 -1
- package/dist/select.cjs.js +14 -15
- package/dist/select.esm.js +117 -97
- package/dist/selection-popup.cjs.js +4 -7
- package/dist/selection-popup.esm.js +8 -11
- package/dist/split-button.cjs.js +1 -1
- package/dist/split-button.esm.js +2 -2
- package/dist/standalone/radio.d.ts +2 -0
- package/dist/standalone/radio.d.ts.map +1 -0
- package/dist/stepper.cjs.js +19 -50
- package/dist/stepper.esm.js +17 -48
- package/dist/time-field.cjs.js +1 -1
- package/dist/time-field.esm.js +3 -2
- package/dist/time-picker.cjs.js +15 -15
- package/dist/time-picker.esm.js +100 -68
- package/dist/tooltip.cjs.js +1 -1
- package/dist/tooltip.esm.js +2 -1
- package/package.json +1 -1
- package/dist/date-time-utils-5cf58cd0.js +0 -1
- package/dist/date-time-utils-bdceb7af.mjs +0 -273
- package/dist/portal-1cf392ca.mjs +0 -114
- package/dist/portal-d8d7fbca.js +0 -1
- package/dist/positioner-accc6e5f.js +0 -1
- package/dist/positioner-fbd61bf1.mjs +0 -132
- package/dist/runtime-5f282bc8.js +0 -1
- package/dist/scroll-lock-48793569.js +0 -1
- package/dist/scroll-lock-9de6d328.mjs +0 -53
package/dist/positioner.esm.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
1
|
+
import { E as a } from "./ElementBase-909688f3.mjs";
|
|
2
|
+
import { l as h } from "./positioner-e9770c66.mjs";
|
|
3
|
+
const c = `
|
|
4
4
|
:host {
|
|
5
5
|
display: contents;
|
|
6
6
|
color-scheme: light dark;
|
|
7
7
|
}
|
|
8
8
|
`;
|
|
9
|
-
function
|
|
9
|
+
function r(s, t = 0) {
|
|
10
10
|
const e = Number(s);
|
|
11
11
|
return Number.isFinite(e) ? e : t;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function o(s) {
|
|
14
14
|
if (s == null)
|
|
15
15
|
return !1;
|
|
16
16
|
const t = s.toLowerCase();
|
|
@@ -32,10 +32,10 @@ function u(s) {
|
|
|
32
32
|
"left-end"
|
|
33
33
|
])).has(s) ? s : "bottom";
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function d(s) {
|
|
36
36
|
return s === "absolute" ? "absolute" : "fixed";
|
|
37
37
|
}
|
|
38
|
-
class
|
|
38
|
+
class f extends a {
|
|
39
39
|
constructor() {
|
|
40
40
|
super(...arguments), this._positioner = null, this._observer = null;
|
|
41
41
|
}
|
|
@@ -50,6 +50,11 @@ class d extends c {
|
|
|
50
50
|
"shift",
|
|
51
51
|
"match-width",
|
|
52
52
|
"fit-viewport",
|
|
53
|
+
"auto-placement",
|
|
54
|
+
"hide-when-detached",
|
|
55
|
+
"inline",
|
|
56
|
+
"boundary-padding",
|
|
57
|
+
"dir",
|
|
53
58
|
"anchor",
|
|
54
59
|
"headless"
|
|
55
60
|
];
|
|
@@ -61,8 +66,8 @@ class d extends c {
|
|
|
61
66
|
var t;
|
|
62
67
|
(t = this._observer) == null || t.disconnect(), this._observer = null, this._destroyPositioner(), super.disconnectedCallback();
|
|
63
68
|
}
|
|
64
|
-
attributeChangedCallback(t, e,
|
|
65
|
-
e !==
|
|
69
|
+
attributeChangedCallback(t, e, i) {
|
|
70
|
+
e !== i && this._syncPositioner();
|
|
66
71
|
}
|
|
67
72
|
open() {
|
|
68
73
|
this.setAttribute("open", "");
|
|
@@ -81,12 +86,12 @@ class d extends c {
|
|
|
81
86
|
_resolveAnchor() {
|
|
82
87
|
const t = this.getAttribute("anchor");
|
|
83
88
|
if (t) {
|
|
84
|
-
const
|
|
85
|
-
if (r instanceof HTMLElement)
|
|
86
|
-
return r;
|
|
87
|
-
const n = document.querySelector(t);
|
|
89
|
+
const i = this.getRootNode(), n = i instanceof ShadowRoot || i instanceof Document ? i.querySelector(t) : null;
|
|
88
90
|
if (n instanceof HTMLElement)
|
|
89
91
|
return n;
|
|
92
|
+
const l = document.querySelector(t);
|
|
93
|
+
if (l instanceof HTMLElement)
|
|
94
|
+
return l;
|
|
90
95
|
}
|
|
91
96
|
const e = this.querySelector('[slot="anchor"]');
|
|
92
97
|
return e instanceof HTMLElement ? e : null;
|
|
@@ -107,31 +112,36 @@ class d extends c {
|
|
|
107
112
|
this._destroyPositioner();
|
|
108
113
|
return;
|
|
109
114
|
}
|
|
110
|
-
this._destroyPositioner(), this._positioner =
|
|
115
|
+
this._destroyPositioner(), this._positioner = h({
|
|
111
116
|
anchor: t,
|
|
112
117
|
floating: e,
|
|
113
118
|
placement: u(this.getAttribute("placement")),
|
|
114
|
-
strategy:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
strategy: d(this.getAttribute("strategy")),
|
|
120
|
+
dir: this.getAttribute("dir") === "rtl" ? "rtl" : "ltr",
|
|
121
|
+
offset: r(this.getAttribute("offset"), 8),
|
|
122
|
+
crossOffset: r(this.getAttribute("cross-offset"), 0),
|
|
123
|
+
flip: !this.hasAttribute("flip") || o(this.getAttribute("flip")),
|
|
124
|
+
shift: !this.hasAttribute("shift") || o(this.getAttribute("shift")),
|
|
125
|
+
matchWidth: o(this.getAttribute("match-width")),
|
|
126
|
+
fitViewport: o(this.getAttribute("fit-viewport")),
|
|
127
|
+
autoPlacement: o(this.getAttribute("auto-placement")),
|
|
128
|
+
hideWhenDetached: o(this.getAttribute("hide-when-detached")),
|
|
129
|
+
inline: o(this.getAttribute("inline")),
|
|
130
|
+
boundaryPadding: r(this.getAttribute("boundary-padding"), 4),
|
|
121
131
|
arrow: this.querySelector('[slot="arrow"], .arrow'),
|
|
122
|
-
onUpdate: (
|
|
123
|
-
this.dispatchEvent(new CustomEvent("position-change", { detail:
|
|
132
|
+
onUpdate: (i) => {
|
|
133
|
+
this.dispatchEvent(new CustomEvent("position-change", { detail: i, bubbles: !0, composed: !0 }));
|
|
124
134
|
}
|
|
125
135
|
});
|
|
126
136
|
}
|
|
127
137
|
render() {
|
|
128
|
-
this.setContent(`<style>${
|
|
138
|
+
this.setContent(`<style>${c}</style><slot name="anchor"></slot><slot name="content"></slot><slot></slot>`);
|
|
129
139
|
}
|
|
130
140
|
shouldRenderOnAttributeChange() {
|
|
131
141
|
return !1;
|
|
132
142
|
}
|
|
133
143
|
}
|
|
134
|
-
typeof customElements < "u" && !customElements.get("ui-positioner") && customElements.define("ui-positioner",
|
|
144
|
+
typeof customElements < "u" && !customElements.get("ui-positioner") && customElements.define("ui-positioner", f);
|
|
135
145
|
export {
|
|
136
|
-
|
|
146
|
+
f as UIPositioner
|
|
137
147
|
};
|
|
@@ -1,21 +1,139 @@
|
|
|
1
1
|
export type PositionerPlacement = 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
|
|
2
2
|
export type PositionerStrategy = 'absolute' | 'fixed';
|
|
3
3
|
export type PositionerSticky = 'partial' | 'always' | 'never';
|
|
4
|
-
export type
|
|
4
|
+
export type PositionerSide = 'top' | 'right' | 'bottom' | 'left';
|
|
5
|
+
export type PositionerAlign = 'center' | 'start' | 'end';
|
|
6
|
+
export type PositionerVirtualElement = {
|
|
5
7
|
getBoundingClientRect: () => DOMRect;
|
|
8
|
+
getClientRects?: () => DOMRectList | DOMRect[];
|
|
9
|
+
contextElement?: Element;
|
|
6
10
|
};
|
|
11
|
+
export type PositionerAnchor = HTMLElement | DOMRect | PositionerVirtualElement;
|
|
12
|
+
export interface PositionerMiddlewareData {
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
offset?: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
};
|
|
18
|
+
flip?: {
|
|
19
|
+
overflows: Array<{
|
|
20
|
+
placement: PositionerPlacement;
|
|
21
|
+
overflow: PositionerOverflow;
|
|
22
|
+
}>;
|
|
23
|
+
};
|
|
24
|
+
autoPlacement?: {
|
|
25
|
+
index: number;
|
|
26
|
+
overflows: Array<{
|
|
27
|
+
placement: PositionerPlacement;
|
|
28
|
+
overflow: PositionerOverflow;
|
|
29
|
+
}>;
|
|
30
|
+
};
|
|
31
|
+
shift?: {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
};
|
|
35
|
+
arrow?: {
|
|
36
|
+
x?: number;
|
|
37
|
+
y?: number;
|
|
38
|
+
centerOffset: number;
|
|
39
|
+
};
|
|
40
|
+
size?: {
|
|
41
|
+
availableWidth: number;
|
|
42
|
+
availableHeight: number;
|
|
43
|
+
};
|
|
44
|
+
hide?: {
|
|
45
|
+
referenceHidden: boolean;
|
|
46
|
+
escaped: boolean;
|
|
47
|
+
referenceHiddenOffsets: PositionerOverflow;
|
|
48
|
+
escapedOffsets: PositionerOverflow;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
7
51
|
export interface PositionerState {
|
|
8
52
|
x: number;
|
|
9
53
|
y: number;
|
|
10
54
|
placement: PositionerPlacement;
|
|
55
|
+
strategy?: PositionerStrategy;
|
|
11
56
|
availableWidth: number;
|
|
12
57
|
availableHeight: number;
|
|
58
|
+
middlewareData?: PositionerMiddlewareData;
|
|
59
|
+
referenceHidden?: boolean;
|
|
60
|
+
escaped?: boolean;
|
|
61
|
+
rects?: PositionerRects;
|
|
62
|
+
}
|
|
63
|
+
export type PositionerOverflow = {
|
|
64
|
+
top: number;
|
|
65
|
+
right: number;
|
|
66
|
+
bottom: number;
|
|
67
|
+
left: number;
|
|
68
|
+
};
|
|
69
|
+
export type PositionerRects = {
|
|
70
|
+
reference: DOMRect;
|
|
71
|
+
floating: DOMRect;
|
|
72
|
+
};
|
|
73
|
+
export type PositionerBoundaryRect = {
|
|
74
|
+
top: number;
|
|
75
|
+
left: number;
|
|
76
|
+
right: number;
|
|
77
|
+
bottom: number;
|
|
78
|
+
width: number;
|
|
79
|
+
height: number;
|
|
80
|
+
};
|
|
81
|
+
export interface PositionerPlatform {
|
|
82
|
+
getElementRects?: (data: {
|
|
83
|
+
anchor: PositionerAnchor;
|
|
84
|
+
floating: HTMLElement | DOMRect;
|
|
85
|
+
placement: PositionerPlacement;
|
|
86
|
+
inline: boolean;
|
|
87
|
+
}) => PositionerRects;
|
|
88
|
+
getClientRects?: (anchor: PositionerAnchor) => DOMRect[] | DOMRectList;
|
|
89
|
+
getClippingRect?: (data: {
|
|
90
|
+
anchor: PositionerAnchor;
|
|
91
|
+
floating: HTMLElement | DOMRect;
|
|
92
|
+
boundary: HTMLElement | null;
|
|
93
|
+
}) => PositionerBoundaryRect;
|
|
94
|
+
}
|
|
95
|
+
export interface PositionerMiddlewareState {
|
|
96
|
+
x: number;
|
|
97
|
+
y: number;
|
|
98
|
+
initialPlacement: PositionerPlacement;
|
|
99
|
+
placement: PositionerPlacement;
|
|
100
|
+
strategy: PositionerStrategy;
|
|
101
|
+
rects: PositionerRects;
|
|
102
|
+
elements: {
|
|
103
|
+
anchor: PositionerAnchor;
|
|
104
|
+
floating: HTMLElement | DOMRect;
|
|
105
|
+
};
|
|
106
|
+
boundary: ViewportRect;
|
|
107
|
+
padding: number;
|
|
108
|
+
rtl: boolean;
|
|
109
|
+
middlewareData: PositionerMiddlewareData;
|
|
110
|
+
getRects(placement: PositionerPlacement): PositionerRects;
|
|
111
|
+
getAnchorRect(placement: PositionerPlacement): DOMRect;
|
|
112
|
+
getCoords(placement: PositionerPlacement, referenceRect?: DOMRect): {
|
|
113
|
+
x: number;
|
|
114
|
+
y: number;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export interface PositionerMiddlewareReturn {
|
|
118
|
+
x?: number;
|
|
119
|
+
y?: number;
|
|
120
|
+
placement?: PositionerPlacement;
|
|
121
|
+
data?: unknown;
|
|
122
|
+
reset?: boolean | {
|
|
123
|
+
placement?: PositionerPlacement;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
export interface PositionerMiddleware {
|
|
127
|
+
name: string;
|
|
128
|
+
options?: unknown;
|
|
129
|
+
fn(state: PositionerMiddlewareState): PositionerMiddlewareReturn | void;
|
|
13
130
|
}
|
|
14
131
|
export interface PositionerOptions {
|
|
15
132
|
anchor: PositionerAnchor;
|
|
16
133
|
floating: HTMLElement;
|
|
17
134
|
placement?: PositionerPlacement;
|
|
18
135
|
strategy?: PositionerStrategy;
|
|
136
|
+
dir?: 'ltr' | 'rtl';
|
|
19
137
|
offset?: number;
|
|
20
138
|
crossOffset?: number;
|
|
21
139
|
flip?: boolean;
|
|
@@ -23,18 +141,98 @@ export interface PositionerOptions {
|
|
|
23
141
|
matchWidth?: boolean;
|
|
24
142
|
fitViewport?: boolean;
|
|
25
143
|
arrow?: HTMLElement | null;
|
|
144
|
+
arrowPadding?: number;
|
|
26
145
|
boundary?: HTMLElement | null;
|
|
146
|
+
boundaryPadding?: number;
|
|
147
|
+
autoPlacement?: boolean;
|
|
148
|
+
allowedPlacements?: PositionerPlacement[];
|
|
149
|
+
fallbackPlacements?: PositionerPlacement[];
|
|
150
|
+
inline?: boolean;
|
|
151
|
+
hideWhenDetached?: boolean;
|
|
152
|
+
platform?: PositionerPlatform;
|
|
153
|
+
middleware?: PositionerMiddleware[];
|
|
27
154
|
sticky?: PositionerSticky;
|
|
28
155
|
observeWindowResize?: boolean;
|
|
29
156
|
observeScroll?: boolean;
|
|
157
|
+
observeAncestorScroll?: boolean;
|
|
158
|
+
observeAncestorResize?: boolean;
|
|
159
|
+
observeLayoutShift?: boolean;
|
|
30
160
|
observeAnchorResize?: boolean;
|
|
31
161
|
observeFloatingResize?: boolean;
|
|
162
|
+
animationFrame?: boolean;
|
|
32
163
|
onUpdate?: (data: PositionerState) => void;
|
|
33
164
|
}
|
|
34
165
|
export interface PositionerHandle {
|
|
35
166
|
update(): PositionerState;
|
|
36
167
|
destroy(): void;
|
|
37
168
|
}
|
|
169
|
+
export interface PositionerAutoUpdateOptions {
|
|
170
|
+
observeWindowResize?: boolean;
|
|
171
|
+
observeScroll?: boolean;
|
|
172
|
+
observeAncestorScroll?: boolean;
|
|
173
|
+
observeAncestorResize?: boolean;
|
|
174
|
+
observeLayoutShift?: boolean;
|
|
175
|
+
observeAnchorResize?: boolean;
|
|
176
|
+
observeFloatingResize?: boolean;
|
|
177
|
+
animationFrame?: boolean;
|
|
178
|
+
}
|
|
179
|
+
type ViewportRect = PositionerBoundaryRect;
|
|
180
|
+
type OffsetMiddlewareOptions = number | {
|
|
181
|
+
mainAxis?: number;
|
|
182
|
+
crossAxis?: number;
|
|
183
|
+
};
|
|
184
|
+
type ShiftMiddlewareOptions = {
|
|
185
|
+
padding?: number;
|
|
186
|
+
mainAxis?: boolean;
|
|
187
|
+
crossAxis?: boolean;
|
|
188
|
+
};
|
|
189
|
+
type FlipMiddlewareOptions = {
|
|
190
|
+
padding?: number;
|
|
191
|
+
fallbackPlacements?: PositionerPlacement[];
|
|
192
|
+
};
|
|
193
|
+
type AutoPlacementMiddlewareOptions = {
|
|
194
|
+
padding?: number;
|
|
195
|
+
allowedPlacements?: PositionerPlacement[];
|
|
196
|
+
};
|
|
197
|
+
type ArrowMiddlewareOptions = {
|
|
198
|
+
element?: HTMLElement | null;
|
|
199
|
+
padding?: number;
|
|
200
|
+
};
|
|
201
|
+
type SizeMiddlewareOptions = {
|
|
202
|
+
padding?: number;
|
|
203
|
+
apply?: (data: {
|
|
204
|
+
availableWidth: number;
|
|
205
|
+
availableHeight: number;
|
|
206
|
+
rects: PositionerRects;
|
|
207
|
+
elements: PositionerMiddlewareState['elements'];
|
|
208
|
+
}) => void;
|
|
209
|
+
};
|
|
210
|
+
type HideMiddlewareOptions = {
|
|
211
|
+
padding?: number;
|
|
212
|
+
};
|
|
213
|
+
export declare function createVirtualPoint(x: number, y: number, contextElement?: Element): PositionerVirtualElement;
|
|
214
|
+
export declare function createVirtualRect(rect: DOMRect | {
|
|
215
|
+
x?: number;
|
|
216
|
+
y?: number;
|
|
217
|
+
top: number;
|
|
218
|
+
left: number;
|
|
219
|
+
width: number;
|
|
220
|
+
height: number;
|
|
221
|
+
}, contextElement?: Element): PositionerVirtualElement;
|
|
222
|
+
export declare function createVirtualRange(range: Range, contextElement?: Element): PositionerVirtualElement;
|
|
223
|
+
export declare function detectPositionerOverflow(state: Pick<PositionerMiddlewareState, 'x' | 'y' | 'rects' | 'boundary' | 'padding'>, options?: {
|
|
224
|
+
elementContext?: 'floating' | 'reference';
|
|
225
|
+
padding?: number;
|
|
226
|
+
}): PositionerOverflow;
|
|
227
|
+
export declare function offsetMiddleware(options?: OffsetMiddlewareOptions): PositionerMiddleware;
|
|
228
|
+
export declare function flipMiddleware(options?: FlipMiddlewareOptions): PositionerMiddleware;
|
|
229
|
+
export declare function autoPlacementMiddleware(options?: AutoPlacementMiddlewareOptions): PositionerMiddleware;
|
|
230
|
+
export declare function shiftMiddleware(options?: ShiftMiddlewareOptions): PositionerMiddleware;
|
|
231
|
+
export declare function sizeMiddleware(options?: SizeMiddlewareOptions): PositionerMiddleware;
|
|
232
|
+
export declare function arrowMiddleware(options?: ArrowMiddlewareOptions): PositionerMiddleware;
|
|
233
|
+
export declare function hideMiddleware(options?: HideMiddlewareOptions): PositionerMiddleware;
|
|
38
234
|
export declare function computePositionState(anchor: PositionerAnchor, floating: HTMLElement | DOMRect, options?: Omit<PositionerOptions, 'anchor' | 'floating' | 'onUpdate'>): PositionerState;
|
|
235
|
+
export declare function autoUpdatePositioner(anchor: PositionerAnchor, floating: HTMLElement, update: () => void, options?: PositionerAutoUpdateOptions): () => void;
|
|
39
236
|
export declare function createPositioner(options: PositionerOptions): PositionerHandle;
|
|
237
|
+
export {};
|
|
40
238
|
//# sourceMappingURL=positioner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positioner.d.ts","sourceRoot":"","sources":["../../src/primitives/positioner.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAC3B,KAAK,GACL,WAAW,GACX,SAAS,GACT,OAAO,GACP,aAAa,GACb,WAAW,GACX,QAAQ,GACR,cAAc,GACd,YAAY,GACZ,MAAM,GACN,YAAY,GACZ,UAAU,CAAC;AAEf,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,OAAO,CAAC;AACtD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAC9D,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"positioner.d.ts","sourceRoot":"","sources":["../../src/primitives/positioner.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,G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GAAG,gBAAgB,CA4C7E"}
|
|
@@ -124,6 +124,7 @@
|
|
|
124
124
|
:host([floating]) {
|
|
125
125
|
position: fixed;
|
|
126
126
|
z-index: 1250;
|
|
127
|
+
contain: layout paint;
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
:host([floating][placement="bottom-right"]) {
|
|
@@ -146,6 +147,11 @@
|
|
|
146
147
|
top: 16px;
|
|
147
148
|
}
|
|
148
149
|
|
|
150
|
+
:host([floating]) .root {
|
|
151
|
+
transform: translateZ(0);
|
|
152
|
+
backface-visibility: hidden;
|
|
153
|
+
}
|
|
154
|
+
|
|
149
155
|
:host([headless]) .root {
|
|
150
156
|
display: none;
|
|
151
157
|
}
|
|
@@ -191,11 +197,11 @@
|
|
|
191
197
|
border-color: Highlight;
|
|
192
198
|
}
|
|
193
199
|
}
|
|
194
|
-
`;let g=0;function l(u){return u.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}class d extends h.ElementBase{constructor(){super(),this._instanceId=++g,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this)}static get observedAttributes(){return["open","mode","orientation","variant","floating","placement","collapsible","label","headless"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onClick),this.root.addEventListener("keydown",this._onKeyDown),this.getAttribute("mode")!=="fab"&&!this.hasAttribute("collapsible")&&!this.hasAttribute("open")&&this.setAttribute("open","")}disconnectedCallback(){this.root.removeEventListener("click",this._onClick),this.root.removeEventListener("keydown",this._onKeyDown),super.disconnectedCallback()}attributeChangedCallback(e,i,t){if(i!==t){if(e==="open"){this._syncOpenUi();return}this.isConnected&&this.requestRender()}}get open(){return this.hasAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}show(){this.toggle(!0)}hide(){this.toggle(!1)}toggle(e){const i=typeof e=="boolean"?e:!this.open;this.open=i;const t={open:i};this.dispatchEvent(new CustomEvent(i?"open":"close",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("toggle",{detail:t,bubbles:!0,composed:!0}))}_actions(){const e=this.root.querySelector('slot[name="action"]');return e?e.assignedElements({flatten:!0}).filter(i=>i instanceof HTMLElement):[]}_actionsId(){return`ui-quick-actions-${this._instanceId}-actions`}_syncActionAccessibility(e){this._actions().forEach((t,
|
|
200
|
+
`;let g=0;function l(u){return u.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}class d extends h.ElementBase{constructor(){super(),this._instanceId=++g,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this)}static get observedAttributes(){return["open","mode","orientation","variant","floating","placement","collapsible","label","headless"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onClick),this.root.addEventListener("keydown",this._onKeyDown),this.getAttribute("mode")!=="fab"&&!this.hasAttribute("collapsible")&&!this.hasAttribute("open")&&this.setAttribute("open","")}disconnectedCallback(){this.root.removeEventListener("click",this._onClick),this.root.removeEventListener("keydown",this._onKeyDown),super.disconnectedCallback()}attributeChangedCallback(e,i,t){if(i!==t){if(e==="open"){this._syncOpenUi();return}this.isConnected&&this.requestRender()}}get open(){return this.hasAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}show(){this.toggle(!0)}hide(){this.toggle(!1)}toggle(e){const i=typeof e=="boolean"?e:!this.open;this.open=i;const t={open:i};this.dispatchEvent(new CustomEvent(i?"open":"close",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("toggle",{detail:t,bubbles:!0,composed:!0}))}_actions(){const e=this.root.querySelector('slot[name="action"]');return e?e.assignedElements({flatten:!0}).filter(i=>i instanceof HTMLElement):[]}_actionsId(){return`ui-quick-actions-${this._instanceId}-actions`}_syncActionAccessibility(e){this._actions().forEach((t,n)=>{var r;if(t.id||(t.id=`ui-quick-actions-${this._instanceId}-action-${n+1}`),t.hasAttribute("role")||t.setAttribute("role","button"),!t.hasAttribute("aria-label")){const o=(r=t.textContent)==null?void 0:r.trim();o&&t.setAttribute("aria-label",o)}if(e){const o=t.getAttribute("data-ui-quick-tabindex");o!=null?(o==="__none__"?t.removeAttribute("tabindex"):t.setAttribute("tabindex",o),t.removeAttribute("data-ui-quick-tabindex")):t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"),t.setAttribute("aria-hidden","false");return}t.hasAttribute("data-ui-quick-tabindex")||t.setAttribute("data-ui-quick-tabindex",t.getAttribute("tabindex")??"__none__"),t.setAttribute("tabindex","-1"),t.setAttribute("aria-hidden","true")})}_onClick(e){var s;const i=e.target;if(!i)return;if(i.closest(".toggle")){this.toggle();return}const n=e.composedPath(),r=this._actions(),o=r.find(b=>n.includes(b));if(!o)return;const a=r.indexOf(o),c={index:a,id:o.id||o.getAttribute("data-id")||String(a+1),label:o.getAttribute("aria-label")||((s=o.textContent)==null?void 0:s.trim())||`Action ${a+1}`};this.dispatchEvent(new CustomEvent("select",{detail:c,bubbles:!0,composed:!0})),this.getAttribute("mode")==="fab"&&this.hide()}_moveFocus(e,i){const t=this._actions();if(!t.length)return;const n=t.indexOf(e);if(n<0)return;const r=(n+i+t.length)%t.length;t[r].focus()}_onKeyDown(e){if(e.key==="Escape"&&this.open&&this.getAttribute("mode")==="fab"){e.preventDefault(),this.hide();return}const i=e.target;if(!i)return;const n=this._actions().find(s=>s===i||s.contains(i));if(!n)return;const r=this.getAttribute("orientation")==="vertical"||this.getAttribute("mode")==="fab",o=!r&&getComputedStyle(this).direction==="rtl",a=r?"ArrowDown":o?"ArrowLeft":"ArrowRight",c=r?"ArrowUp":o?"ArrowRight":"ArrowLeft";if(e.key===a){e.preventDefault(),this._moveFocus(n,1);return}if(e.key===c){e.preventDefault(),this._moveFocus(n,-1);return}if(e.key==="Home"||e.key==="End"){e.preventDefault();const s=this._actions();if(!s.length)return;(e.key==="Home"?s[0]:s[s.length-1]).focus()}}_syncOpenUi(){if(!this.isConnected)return;if(!this.root.querySelector(".root")){this.requestRender();return}const e=this.getAttribute("mode")==="fab"?"fab":"bar",i=this.hasAttribute("collapsible")||e==="fab",t=this.open||!i&&e==="bar",n=this.getAttribute("label")||"Quick actions",r=this.root.querySelector(".toggle");r&&(r.textContent=t?"−":"+",r.setAttribute("aria-label",n),r.setAttribute("aria-expanded",t?"true":"false"));const o=this.root.querySelector(".actions");o&&(t?o.removeAttribute("hidden"):o.setAttribute("hidden","")),this._syncActionAccessibility(t)}render(){const e=this.getAttribute("mode")==="fab"?"fab":"bar",i=this.hasAttribute("collapsible")||e==="fab",t=this.open||!i&&e==="bar",n=this.getAttribute("label")||"Quick actions",r=this._actionsId(),o=this.getAttribute("orientation")==="vertical"||e==="fab"?"vertical":"horizontal";this.setContent(`
|
|
195
201
|
<style>${p}</style>
|
|
196
|
-
<section class="root" part="root" role="toolbar" aria-label="${l(
|
|
197
|
-
${i?`<button type="button" class="toggle" part="toggle" aria-label="${l(
|
|
198
|
-
<div id="${r}" class="actions" part="actions" role="group" aria-label="${l(
|
|
202
|
+
<section class="root" part="root" role="toolbar" aria-label="${l(n)}" aria-orientation="${o}">
|
|
203
|
+
${i?`<button type="button" class="toggle" part="toggle" aria-label="${l(n)}" aria-controls="${r}" aria-haspopup="true" aria-expanded="${t?"true":"false"}">${t?"−":"+"}</button>`:""}
|
|
204
|
+
<div id="${r}" class="actions" part="actions" role="group" aria-label="${l(n)} list" ${t?"":"hidden"}>
|
|
199
205
|
<slot name="action"></slot>
|
|
200
206
|
</div>
|
|
201
207
|
</section>
|
|
@@ -125,6 +125,7 @@ const h = `
|
|
|
125
125
|
:host([floating]) {
|
|
126
126
|
position: fixed;
|
|
127
127
|
z-index: 1250;
|
|
128
|
+
contain: layout paint;
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
:host([floating][placement="bottom-right"]) {
|
|
@@ -147,6 +148,11 @@ const h = `
|
|
|
147
148
|
top: 16px;
|
|
148
149
|
}
|
|
149
150
|
|
|
151
|
+
:host([floating]) .root {
|
|
152
|
+
transform: translateZ(0);
|
|
153
|
+
backface-visibility: hidden;
|
|
154
|
+
}
|
|
155
|
+
|
|
150
156
|
:host([headless]) .root {
|
|
151
157
|
display: none;
|
|
152
158
|
}
|
|
@@ -255,9 +261,9 @@ class g extends b {
|
|
|
255
261
|
return `ui-quick-actions-${this._instanceId}-actions`;
|
|
256
262
|
}
|
|
257
263
|
_syncActionAccessibility(e) {
|
|
258
|
-
this._actions().forEach((t,
|
|
264
|
+
this._actions().forEach((t, n) => {
|
|
259
265
|
var r;
|
|
260
|
-
if (t.id || (t.id = `ui-quick-actions-${this._instanceId}-action-${
|
|
266
|
+
if (t.id || (t.id = `ui-quick-actions-${this._instanceId}-action-${n + 1}`), t.hasAttribute("role") || t.setAttribute("role", "button"), !t.hasAttribute("aria-label")) {
|
|
261
267
|
const o = (r = t.textContent) == null ? void 0 : r.trim();
|
|
262
268
|
o && t.setAttribute("aria-label", o);
|
|
263
269
|
}
|
|
@@ -270,7 +276,7 @@ class g extends b {
|
|
|
270
276
|
});
|
|
271
277
|
}
|
|
272
278
|
_onClick(e) {
|
|
273
|
-
var
|
|
279
|
+
var s;
|
|
274
280
|
const i = e.target;
|
|
275
281
|
if (!i)
|
|
276
282
|
return;
|
|
@@ -278,13 +284,13 @@ class g extends b {
|
|
|
278
284
|
this.toggle();
|
|
279
285
|
return;
|
|
280
286
|
}
|
|
281
|
-
const
|
|
287
|
+
const n = e.composedPath(), r = this._actions(), o = r.find((d) => n.includes(d));
|
|
282
288
|
if (!o)
|
|
283
289
|
return;
|
|
284
290
|
const a = r.indexOf(o), c = {
|
|
285
291
|
index: a,
|
|
286
292
|
id: o.id || o.getAttribute("data-id") || String(a + 1),
|
|
287
|
-
label: o.getAttribute("aria-label") || ((
|
|
293
|
+
label: o.getAttribute("aria-label") || ((s = o.textContent) == null ? void 0 : s.trim()) || `Action ${a + 1}`
|
|
288
294
|
};
|
|
289
295
|
this.dispatchEvent(new CustomEvent("select", { detail: c, bubbles: !0, composed: !0 })), this.getAttribute("mode") === "fab" && this.hide();
|
|
290
296
|
}
|
|
@@ -292,10 +298,10 @@ class g extends b {
|
|
|
292
298
|
const t = this._actions();
|
|
293
299
|
if (!t.length)
|
|
294
300
|
return;
|
|
295
|
-
const
|
|
296
|
-
if (
|
|
301
|
+
const n = t.indexOf(e);
|
|
302
|
+
if (n < 0)
|
|
297
303
|
return;
|
|
298
|
-
const r = (
|
|
304
|
+
const r = (n + i + t.length) % t.length;
|
|
299
305
|
t[r].focus();
|
|
300
306
|
}
|
|
301
307
|
_onKeyDown(e) {
|
|
@@ -306,24 +312,24 @@ class g extends b {
|
|
|
306
312
|
const i = e.target;
|
|
307
313
|
if (!i)
|
|
308
314
|
return;
|
|
309
|
-
const
|
|
310
|
-
if (!
|
|
315
|
+
const n = this._actions().find((s) => s === i || s.contains(i));
|
|
316
|
+
if (!n)
|
|
311
317
|
return;
|
|
312
318
|
const r = this.getAttribute("orientation") === "vertical" || this.getAttribute("mode") === "fab", o = !r && getComputedStyle(this).direction === "rtl", a = r ? "ArrowDown" : o ? "ArrowLeft" : "ArrowRight", c = r ? "ArrowUp" : o ? "ArrowRight" : "ArrowLeft";
|
|
313
319
|
if (e.key === a) {
|
|
314
|
-
e.preventDefault(), this._moveFocus(
|
|
320
|
+
e.preventDefault(), this._moveFocus(n, 1);
|
|
315
321
|
return;
|
|
316
322
|
}
|
|
317
323
|
if (e.key === c) {
|
|
318
|
-
e.preventDefault(), this._moveFocus(
|
|
324
|
+
e.preventDefault(), this._moveFocus(n, -1);
|
|
319
325
|
return;
|
|
320
326
|
}
|
|
321
327
|
if (e.key === "Home" || e.key === "End") {
|
|
322
328
|
e.preventDefault();
|
|
323
|
-
const
|
|
324
|
-
if (!
|
|
329
|
+
const s = this._actions();
|
|
330
|
+
if (!s.length)
|
|
325
331
|
return;
|
|
326
|
-
(e.key === "Home" ?
|
|
332
|
+
(e.key === "Home" ? s[0] : s[s.length - 1]).focus();
|
|
327
333
|
}
|
|
328
334
|
}
|
|
329
335
|
_syncOpenUi() {
|
|
@@ -333,18 +339,18 @@ class g extends b {
|
|
|
333
339
|
this.requestRender();
|
|
334
340
|
return;
|
|
335
341
|
}
|
|
336
|
-
const e = this.getAttribute("mode") === "fab" ? "fab" : "bar", i = this.hasAttribute("collapsible") || e === "fab", t = this.open || !i && e === "bar",
|
|
337
|
-
r && (r.textContent = t ? "−" : "+", r.setAttribute("aria-label",
|
|
342
|
+
const e = this.getAttribute("mode") === "fab" ? "fab" : "bar", i = this.hasAttribute("collapsible") || e === "fab", t = this.open || !i && e === "bar", n = this.getAttribute("label") || "Quick actions", r = this.root.querySelector(".toggle");
|
|
343
|
+
r && (r.textContent = t ? "−" : "+", r.setAttribute("aria-label", n), r.setAttribute("aria-expanded", t ? "true" : "false"));
|
|
338
344
|
const o = this.root.querySelector(".actions");
|
|
339
345
|
o && (t ? o.removeAttribute("hidden") : o.setAttribute("hidden", "")), this._syncActionAccessibility(t);
|
|
340
346
|
}
|
|
341
347
|
render() {
|
|
342
|
-
const e = this.getAttribute("mode") === "fab" ? "fab" : "bar", i = this.hasAttribute("collapsible") || e === "fab", t = this.open || !i && e === "bar",
|
|
348
|
+
const e = this.getAttribute("mode") === "fab" ? "fab" : "bar", i = this.hasAttribute("collapsible") || e === "fab", t = this.open || !i && e === "bar", n = this.getAttribute("label") || "Quick actions", r = this._actionsId(), o = this.getAttribute("orientation") === "vertical" || e === "fab" ? "vertical" : "horizontal";
|
|
343
349
|
this.setContent(`
|
|
344
350
|
<style>${h}</style>
|
|
345
|
-
<section class="root" part="root" role="toolbar" aria-label="${l(
|
|
346
|
-
${i ? `<button type="button" class="toggle" part="toggle" aria-label="${l(
|
|
347
|
-
<div id="${r}" class="actions" part="actions" role="group" aria-label="${l(
|
|
351
|
+
<section class="root" part="root" role="toolbar" aria-label="${l(n)}" aria-orientation="${o}">
|
|
352
|
+
${i ? `<button type="button" class="toggle" part="toggle" aria-label="${l(n)}" aria-controls="${r}" aria-haspopup="true" aria-expanded="${t ? "true" : "false"}">${t ? "−" : "+"}</button>` : ""}
|
|
353
|
+
<div id="${r}" class="actions" part="actions" role="group" aria-label="${l(n)} list" ${t ? "" : "hidden"}>
|
|
348
354
|
<slot name="action"></slot>
|
|
349
355
|
</div>
|
|
350
356
|
</section>
|