@astryx-vue/core 0.19.0 → 0.20.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/dist/AlertDialog/index.js +1 -1
- package/dist/{AlertDialog-CNb0dkY9.js → AlertDialog-Dbg8L2oy.js} +1 -1
- package/dist/AppShell/index.js +1 -1
- package/dist/{AppShell-NvIT99xw.js → AppShell-zEXmJb1h.js} +116 -9
- package/dist/AvatarGroup/index.d.ts +1 -1
- package/dist/Banner/index.d.ts +1 -1
- package/dist/BottomSheet/index.js +2 -2
- package/dist/{BottomSheet-CCW58Kl3.js → BottomSheet-DNuzJPfQ.js} +2 -2
- package/dist/{BottomSheet-HQpcSkPH.js → BottomSheet-DV7bboru.js} +1 -1
- package/dist/Breadcrumbs/index.d.ts +1 -1
- package/dist/Breadcrumbs/index.js +1 -1
- package/dist/{Breadcrumbs-DXzBkpkd.js → Breadcrumbs-yB6yZCuZ.js} +1 -1
- package/dist/Button/index.d.ts +1 -1
- package/dist/ButtonGroup/index.d.ts +1 -1
- package/dist/Calendar/index.d.ts +1 -1
- package/dist/Calendar/index.js +1 -1
- package/dist/{Calendar-DSRNuw3y.js → Calendar-ydp0vJdO.js} +1 -1
- package/dist/Carousel/index.d.ts +1 -1
- package/dist/Center/index.d.ts +1 -1
- package/dist/Chat/index.d.ts +1 -1
- package/dist/CheckboxInput/index.d.ts +1 -1
- package/dist/CheckboxList/index.d.ts +1 -1
- package/dist/ClickableCard/index.d.ts +1 -1
- package/dist/Collapsible/index.js +1 -1
- package/dist/{Collapsible-ExzU7vC0.js → Collapsible-BG-u5nEt.js} +2 -1
- package/dist/CommandPalette/index.js +1 -1
- package/dist/{CommandPalette-CECjNvGB.js → CommandPalette-CV7t0ouM.js} +1 -1
- package/dist/ComplexSelector/index.d.ts +1 -1
- package/dist/ComplexSelector/index.js +1 -1
- package/dist/{ComplexSelector-Dmaag1wm.js → ComplexSelector-BOACo2vq.js} +1 -1
- package/dist/ContextMenu/index.d.ts +1 -1
- package/dist/ContextMenu/index.js +1 -1
- package/dist/{ContextMenu-CujLDt4e.js → ContextMenu-_cj8wRB6.js} +1 -1
- package/dist/DateInput/index.d.ts +1 -1
- package/dist/DateInput/index.js +1 -1
- package/dist/{DateInput-s2H0orUW.js → DateInput-DrMqXWSj.js} +3 -3
- package/dist/DateRangeInput/index.d.ts +1 -1
- package/dist/DateRangeInput/index.js +1 -1
- package/dist/{DateRangeInput-Dn9I2PMM.js → DateRangeInput-BZuyhf-w.js} +19 -11
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.js +1 -1
- package/dist/{DateTimeInput-BR_tdURg.js → DateTimeInput-DhB2gzx5.js} +3 -3
- package/dist/Dialog/index.js +3 -3
- package/dist/{Dialog-BQ5OBB1d.js → Dialog-B2pOTrnQ.js} +1 -1
- package/dist/{Dialog-DgdbRn2l.js → Dialog-CztWmbf8.js} +1 -1
- package/dist/{DialogHeader-D8234o9F.js → DialogHeader-5A5BUTTB.js} +1 -1
- package/dist/Divider/index.d.ts +1 -1
- package/dist/Drawer/index.d.ts +1 -1
- package/dist/Drawer/index.js +1 -1
- package/dist/{Drawer-Dqus7kUc.js → Drawer-Dt6paoDZ.js} +2 -2
- package/dist/DropdownMenu/index.js +2 -2
- package/dist/{DropdownMenu-LQsXd-_V.js → DropdownMenu-CFX1k1Ib.js} +1 -1
- package/dist/{DropdownMenu-BC_zB9le.js → DropdownMenu-D8s058G5.js} +1 -1
- package/dist/FileInput/index.d.ts +1 -1
- package/dist/InfoTip/index.d.ts +1 -1
- package/dist/InputGroup/index.d.ts +1 -1
- package/dist/Lightbox/index.js +1 -1
- package/dist/{Lightbox-RN_f7zRw.js → Lightbox-D8kFIbPj.js} +1 -1
- package/dist/Link/index.d.ts +1 -1
- package/dist/List/index.d.ts +1 -1
- package/dist/MobileNav/index.d.ts +1 -1
- package/dist/MobileNav/index.js +1 -1
- package/dist/{MobileNavToggle-DlQmYaBx.js → MobileNavToggle-CKEOroi0.js} +75 -32
- package/dist/MoreMenu/index.d.ts +1 -1
- package/dist/MultiSelector/index.d.ts +1 -1
- package/dist/MultiSelector/index.js +1 -1
- package/dist/{MultiSelector-BK6nZweN.js → MultiSelector-CkAhUYdn.js} +1 -1
- package/dist/{NavHeadingSurface-C17cbKn9.js → NavHeadingSurface-DZPa2px5.js} +19 -5
- package/dist/NavItem/index.d.ts +2 -2
- package/dist/NavItem/index.js +1 -1
- package/dist/{NavItem-BAe-tUG9.js → NavItem-CcbOJNnY.js} +18 -5
- package/dist/NavMenu/index.d.ts +1 -1
- package/dist/NumberInput/index.d.ts +1 -1
- package/dist/OverflowList/index.d.ts +1 -1
- package/dist/Overlay/index.d.ts +1 -1
- package/dist/Pagination/index.js +1 -1
- package/dist/{Pagination-DFQNX_Mb.js → Pagination-C0oI5FRP.js} +1 -1
- package/dist/Popover/index.d.ts +1 -1
- package/dist/Popover/index.js +1 -1
- package/dist/{Popover-CmAEizH-.js → Popover-Cl4gQQZq.js} +2 -1
- package/dist/PowerSearch/index.d.ts +1 -1
- package/dist/PowerSearch/index.js +1 -1
- package/dist/{PowerSearch-CDEn08Pe.js → PowerSearch-CPgbhvEL.js} +6 -6
- package/dist/Radio/index.d.ts +1 -1
- package/dist/RadioList/index.d.ts +1 -1
- package/dist/ScrollableArea/index.d.ts +1 -1
- package/dist/SelectableCard/index.d.ts +1 -1
- package/dist/Selector/index.d.ts +1 -1
- package/dist/Selector/index.js +1 -1
- package/dist/{Selector-Bo7qkt1P.js → Selector-CUTnAjq-.js} +1 -1
- package/dist/SideNav/index.d.ts +1 -1
- package/dist/SideNav/index.js +2 -2
- package/dist/{SideNav-CcZLUd7G.js → SideNav-5yLlEOdD.js} +511 -57
- package/dist/Switch/index.d.ts +1 -1
- package/dist/TabList/index.d.ts +1 -1
- package/dist/Table/index.d.ts +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/{Table-WukSceMV.js → Table-Eok91IcO.js} +8 -6
- package/dist/TextArea/index.d.ts +1 -1
- package/dist/TextInput/index.d.ts +1 -1
- package/dist/{TimeField-BM-rVFhC.js → TimeField-jfhGVEyI.js} +1 -1
- package/dist/TimeInput/index.d.ts +1 -1
- package/dist/TimeInput/index.js +1 -1
- package/dist/{TimeInput-CkZfhhAr.js → TimeInput-CvFcN4nl.js} +1 -1
- package/dist/Timestamp/index.d.ts +1 -1
- package/dist/ToggleButton/index.d.ts +1 -1
- package/dist/Token/index.d.ts +1 -1
- package/dist/Tokenizer/index.d.ts +1 -1
- package/dist/Toolbar/index.d.ts +1 -1
- package/dist/TopNav/index.d.ts +1 -1
- package/dist/TopNav/index.js +1 -1
- package/dist/{TopNav-CFkThrKq.js → TopNav-CSFUTuyI.js} +3 -3
- package/dist/TreeList/index.js +1 -1
- package/dist/{TreeList-ugSF9DWj.js → TreeList-B33huihx.js} +2 -1
- package/dist/{landing-Bs0aMIsR.js → batch-BJD6Bt-O.js} +42 -740
- package/dist/composables/index.d.ts +1 -1
- package/dist/composables/index.js +4 -4
- package/dist/{composables-BgfubKnk.js → composables-CDrwFX0l.js} +2 -19
- package/dist/context-Cj_zItu2.js +729 -0
- package/dist/edge-DIlkB7vS.js +164 -0
- package/dist/edgeRide-D0oC2JEB.js +499 -0
- package/dist/focusRegion-CmDg7_4b.js +81 -0
- package/dist/{handle-BPXdHbkr.js → handle-ChN2TMKH.js} +1 -1
- package/dist/{index-CuW4AQ7M.d.ts → index--kbwaSXW.d.ts} +1 -1
- package/dist/{index-CryFtTT6.d.ts → index-BIQZa2BD.d.ts} +1 -1
- package/dist/{index-ZbNwGVkS.d.ts → index-BKnyTWPM.d.ts} +1 -1
- package/dist/{index-BDZCJ9ri.d.ts → index-BuubzuE8.d.ts} +2 -2
- package/dist/{index-CEjvYAUZ.d.ts → index-BvWBeoa8.d.ts} +1 -1
- package/dist/{index-BeR-1LgF.d.ts → index-C5fbwY7Y.d.ts} +4 -3
- package/dist/{index-D05JGsT3.d.ts → index-C8wfe0Mr.d.ts} +1 -1
- package/dist/{index-CyMStZq4.d.ts → index-CHLLk77c.d.ts} +6 -6
- package/dist/{index-BLnvQ4Oj.d.ts → index-DBu-H-vB.d.ts} +5 -1
- package/dist/{index-QnlWyUxN.d.ts → index-DE1genab.d.ts} +2 -2
- package/dist/{index-t27MvEzT.d.ts → index-DbfcTFO6.d.ts} +47 -43
- package/dist/{index-lmd9LZKB.d.ts → index-Djf0M7PH.d.ts} +1 -1
- package/dist/{index-9tZJgo0R.d.ts → index-DoSTYXsP.d.ts} +1 -1
- package/dist/{index-CH-xSiJz.d.ts → index-DtZUOyCy.d.ts} +2 -2
- package/dist/{index-CfXW4km8.d.ts → index-GgHVkJtB.d.ts} +1 -1
- package/dist/{index-BapQGST1.d.ts → index-Xhq1E7WZ.d.ts} +3 -3
- package/dist/{index-C1zwvxPH.d.ts → index-ZKBj_1nu.d.ts} +2 -1
- package/dist/{index-CULdl3Dg.d.ts → index-gxuXI7KD.d.ts} +3 -3
- package/dist/{index-dWlCpnua.d.ts → index-mK1ICsVg.d.ts} +1 -1
- package/dist/{index-C9OzEvE_.d.ts → index-mPBIdznc.d.ts} +5 -5
- package/dist/index.d.ts +22 -22
- package/dist/index.js +37 -37
- package/dist/landing-C7nc9JHm.js +104 -0
- package/dist/quietFinished-CKZXgsPM.js +19 -0
- package/dist/{types-BG23kC3S.d.ts → types-C2ZuV4jf.d.ts} +7 -1
- package/dist/{useDateRange-CIXoE_8k.js → useDateRange-D1Szw54e.js} +7 -3
- package/dist/{useFocusTrap-BUd-fvUH.js → useFocusTrap-DsYtRdmV.js} +2 -81
- package/dist/{useMonthGrid-fGHSSrFc.js → useMonthGrid-Bzvlstgc.js} +1 -1
- package/package.json +1 -1
- package/styles/date-range-input.css +19 -2
- package/styles/mobile-nav.css +4 -2
- package/styles/nav-item.css +3 -3
- package/styles/side-nav.css +36 -8
- package/dist/context-ZsDEkhSF.js +0 -24
- package/dist/{index-J6YRJ7Ul.d.ts → index-CHx33xGa.d.ts} +1 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { m as batchPresented, t as areaOf } from "./handle-ChN2TMKH.js";
|
|
2
|
+
import { D as glides, S as originOf, T as visibleRect, a as flush, b as transitionSettles, c as onGlideClock, d as layoutMotion, h as beginChange, l as rectOf, n as batches, o as bandFor, s as collectCandidates, t as batchFor, y as settleTransition } from "./batch-BJD6Bt-O.js";
|
|
3
|
+
//#region src/motion/layout/reportChange.ts
|
|
4
|
+
function resolve(target) {
|
|
5
|
+
return typeof target === "function" ? target() : target.current;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Report a size change of `target` to the handle's area. Call
|
|
9
|
+
* `measureBefore()` before the change commits and `animate()` after it; the
|
|
10
|
+
* content after `target`, up to the area, glides from its old place.
|
|
11
|
+
* Changes in one area in one frame move together. Without a handle, or
|
|
12
|
+
* outside its container, nothing moves.
|
|
13
|
+
*/
|
|
14
|
+
function reportLayoutChange(handle, target) {
|
|
15
|
+
return {
|
|
16
|
+
measureBefore() {
|
|
17
|
+
const element = resolve(target);
|
|
18
|
+
if (element == null || handle == null) return;
|
|
19
|
+
const area = areaOf(handle, element);
|
|
20
|
+
if (area == null) return;
|
|
21
|
+
beginChange(element.ownerDocument);
|
|
22
|
+
const batch = batchFor(area);
|
|
23
|
+
if (batch.changed.has(element)) return;
|
|
24
|
+
batch.changed.add(element);
|
|
25
|
+
batch.changedSize += rectOf(element, batch.cache).height;
|
|
26
|
+
batch.visible ??= visibleRect(area);
|
|
27
|
+
batch.originBefore ??= originOf(area);
|
|
28
|
+
batch.walksToBand ??= area.ownerDocument.defaultView?.getComputedStyle(area).getPropertyValue("overflow-anchor") === "none";
|
|
29
|
+
const needed = Math.max(batch.visible.height, batch.changedSize);
|
|
30
|
+
const walks = needed > batch.reach ? [...batch.changed] : [element];
|
|
31
|
+
if (needed > batch.reach) batch.reach = Math.max(needed, batch.reach * 2);
|
|
32
|
+
const band = bandFor(batch.visible, batch.reach);
|
|
33
|
+
for (const changed of walks) {
|
|
34
|
+
const candidates = collectCandidates(changed, area, band, batch.cache, batch.walksToBand, batch.ancestors, batch.befores);
|
|
35
|
+
for (const [candidate, rect] of candidates) if (!batch.before.has(candidate)) batch.before.set(candidate, onGlideClock(candidate, rect, area));
|
|
36
|
+
batch.candidates.set(changed, [...candidates.keys()]);
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
animate(beforeMove) {
|
|
40
|
+
const element = resolve(target);
|
|
41
|
+
if (element == null || handle == null) return false;
|
|
42
|
+
const area = areaOf(handle, element);
|
|
43
|
+
const batch = area == null ? void 0 : batches.get(area);
|
|
44
|
+
if (batch == null || !batch.changed.has(element)) return false;
|
|
45
|
+
if (beforeMove != null) batch.beforeMove.push(beforeMove);
|
|
46
|
+
if (!batch.scheduled) {
|
|
47
|
+
batch.scheduled = true;
|
|
48
|
+
queueMicrotask(() => batchPresented(() => flush(batch)));
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/motion/layout/landing.ts
|
|
56
|
+
/**
|
|
57
|
+
* A disclosure's indicator (its chevron) turns on the same motion as the
|
|
58
|
+
* glide. Its CSS transition takes the theme's move curve and duration as the
|
|
59
|
+
* glide reads them where the area is, and is immediate under Reduce Motion.
|
|
60
|
+
* Without a handle the inline values are cleared, so the component's own
|
|
61
|
+
* transition applies.
|
|
62
|
+
*/
|
|
63
|
+
function applyLayoutChangeTransition(handle, element) {
|
|
64
|
+
if (element == null) return;
|
|
65
|
+
const area = handle == null ? null : areaOf(handle, element);
|
|
66
|
+
if (area == null) {
|
|
67
|
+
transitionSettles.get(element)?.();
|
|
68
|
+
element.style.removeProperty("transition-duration");
|
|
69
|
+
element.style.removeProperty("transition-timing-function");
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const motion = layoutMotion(area);
|
|
73
|
+
if (motion.kind !== "glide") {
|
|
74
|
+
transitionSettles.get(element)?.();
|
|
75
|
+
element.style.setProperty("transition-duration", "0s");
|
|
76
|
+
element.style.removeProperty("transition-timing-function");
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const ms = Math.round(motion.progress.durationMs * 1e3) / 1e3;
|
|
80
|
+
element.style.setProperty("transition-duration", `${ms}ms`);
|
|
81
|
+
element.style.setProperty("transition-timing-function", motion.progress.easing);
|
|
82
|
+
settleTransition(element, motion.progress);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Lands `element`'s running glide at once: it takes its layout place, and a
|
|
86
|
+
* later change starts from there (a change its caller lands rather than
|
|
87
|
+
* animates, such as a rail that snaps).
|
|
88
|
+
*/
|
|
89
|
+
function landLayoutGlide(element) {
|
|
90
|
+
const glide = glides.get(element);
|
|
91
|
+
if (glide != null) {
|
|
92
|
+
glides.delete(element);
|
|
93
|
+
glide.animation.cancel();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The motion a change in `area` plays, for tests and for SideNav's rail
|
|
98
|
+
* motion, which plays on the same clock (`component:SideNav` FR6).
|
|
99
|
+
*/
|
|
100
|
+
function layoutMotionFor(area) {
|
|
101
|
+
return layoutMotion(area);
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
export { reportLayoutChange as i, landLayoutGlide as n, layoutMotionFor as r, applyLayoutChangeTransition as t };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/motion/quietFinished.ts
|
|
2
|
+
/**
|
|
3
|
+
* @file quietFinished.ts
|
|
4
|
+
* @input An Animation that motion code starts
|
|
5
|
+
* @output quietFinished: marks the animation's current `finished` promise as
|
|
6
|
+
* handled and returns the animation
|
|
7
|
+
* @position Internal to motion: a cancel rejects `finished` with an
|
|
8
|
+
* AbortError. Browsers mark that rejection handled; DOM shims that create
|
|
9
|
+
* the promise eagerly (happy-dom) leave it unhandled, so a test runner
|
|
10
|
+
* reports every cancelled motion as an error. Call it right after the
|
|
11
|
+
* animation starts playing, since starting from idle makes a new promise.
|
|
12
|
+
*/
|
|
13
|
+
function ignore() {}
|
|
14
|
+
function quietFinished(animation) {
|
|
15
|
+
Promise.resolve(animation.finished).catch(ignore);
|
|
16
|
+
return animation;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { quietFinished as t };
|
|
@@ -16,8 +16,14 @@ interface NavItemProps {
|
|
|
16
16
|
rel?: string;
|
|
17
17
|
/** 当前页。 @default false */
|
|
18
18
|
isSelected?: boolean;
|
|
19
|
-
/**
|
|
19
|
+
/** 禁用后渲染成按钮,默认不进入 Tab 顺序。 @default false */
|
|
20
20
|
isDisabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* 禁用后仍保留 Tab 停靠点:按钮不用原生 `disabled`,改写 `aria-disabled="true"`,
|
|
23
|
+
* 点击和回车、空格都不触发行为。侧边导航项打开它。
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
isFocusableWhenDisabled?: boolean;
|
|
21
27
|
/** 高度和内边距。 @default 'md' */
|
|
22
28
|
size?: NavItemSize;
|
|
23
29
|
/** 图标的 CSS class,例如 `i-carbon-home`。 */
|
|
@@ -78,11 +78,15 @@ function isDayOutsideSpan(pending, day, minRangeSpan = 1, maxRangeSpan) {
|
|
|
78
78
|
if (pending == null || pending === day) return false;
|
|
79
79
|
return !isRangeWithinSpan(orderRange(pending, day), minRangeSpan, maxRangeSpan);
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
/**
|
|
82
|
+
* 一段日期范围的显示文字。起止都在今年时省掉年份。`currentYear` 缺省读时钟;
|
|
83
|
+
* 传 `null` 表示今年还不知道(服务端渲染、水合那一趟),这时一律写出年份。
|
|
84
|
+
*/
|
|
85
|
+
function formatDateRange(range, locale, currentYear = (/* @__PURE__ */ new Date()).getFullYear()) {
|
|
82
86
|
if (range == null) return "";
|
|
83
|
-
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
84
87
|
const startYear = Number(range.start.slice(0, 4));
|
|
85
|
-
const
|
|
88
|
+
const endYear = Number(range.end.slice(0, 4));
|
|
89
|
+
const withYear = !(currentYear != null && startYear === endYear && startYear === currentYear);
|
|
86
90
|
const formatter = new Intl.DateTimeFormat(locale === "zh-CN" ? "zh-CN" : "en", {
|
|
87
91
|
month: "short",
|
|
88
92
|
day: "numeric",
|
|
@@ -1,86 +1,7 @@
|
|
|
1
1
|
import { i as trackInteractionModality, p as isImeKeyEvent } from "./interactionModality-B5dR7nnb.js";
|
|
2
|
-
import { r as
|
|
2
|
+
import { i as hasInnerRegionHolding, n as collapseRadioGroups, o as precedes, r as focusablesIn, s as registerRegion, t as attemptFocus } from "./focusRegion-CmDg7_4b.js";
|
|
3
3
|
import { t as focusForLastInput } from "./focusReturn-D7Y7Pwwb.js";
|
|
4
4
|
import { onScopeDispose, ref, toValue, watch } from "vue";
|
|
5
|
-
//#region src/composables/internal/focusRegion.ts
|
|
6
|
-
/**
|
|
7
|
-
* 焦点区域(useFocusTrap)找 Tab 落脚点、判断谁来接这次 Tab 用的几个小工具。
|
|
8
|
-
* 对应原版 Astryx `hooks/useFocusTrap` 和 `hooks/focusableSelector` 里的同名逻辑。
|
|
9
|
-
*/
|
|
10
|
-
/** `a` 在文档顺序上是否排在 `b` 前面。 */
|
|
11
|
-
function precedes(a, b) {
|
|
12
|
-
return (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0;
|
|
13
|
-
}
|
|
14
|
-
/** 按文档顺序排好。浏览器的 querySelectorAll 本来就是文档顺序,jsdom 可能按选择器分组返回。 */
|
|
15
|
-
function inDocumentOrder(nodes) {
|
|
16
|
-
return [...nodes].sort((a, b) => precedes(a, b) ? -1 : 1);
|
|
17
|
-
}
|
|
18
|
-
function isShownAsPopover(element) {
|
|
19
|
-
try {
|
|
20
|
-
return element.matches(":popover-open");
|
|
21
|
-
} catch {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
/** 对话框在顶层里:打开了,或者作为 popover 显示着。 */
|
|
26
|
-
function isDialogShown(dialog) {
|
|
27
|
-
return dialog.open || isShownAsPopover(dialog);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* 元素是否在一个页面不显示的、关着的 `<dialog>` 里。这样的对话框什么都不画,里面也不能聚焦。
|
|
31
|
-
* 关着但页面把它按普通流显示出来的对话框有盒子,里面的控件照样是 Tab 落脚点。
|
|
32
|
-
*/
|
|
33
|
-
function isInHiddenClosedDialog(element) {
|
|
34
|
-
for (let dialog = element.closest("dialog"); dialog != null; dialog = dialog.parentElement?.closest("dialog") ?? null) if (!isDialogShown(dialog) && dialog.ownerDocument.defaultView?.getComputedStyle(dialog).display === "none") return true;
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
function radioNameOf(element) {
|
|
38
|
-
if (!element.matches("input[type=\"radio\"][name]")) return null;
|
|
39
|
-
return element.name || null;
|
|
40
|
-
}
|
|
41
|
-
function isSameRadioGroup(a, b) {
|
|
42
|
-
const name = radioNameOf(a);
|
|
43
|
-
return name != null && name === radioNameOf(b) && a.form === b.form;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* 去掉浏览器按 Tab 时会跳过的单选框,其余元素原样保留。
|
|
47
|
-
* 同名单选组只停一站:有焦点的那个,否则选中的那个;一个都没选时整组都留着,
|
|
48
|
-
* 正向进入落在第一个,反向进入落在最后一个。
|
|
49
|
-
*/
|
|
50
|
-
function collapseRadioGroups(elements, active) {
|
|
51
|
-
return elements.filter((element) => {
|
|
52
|
-
if (radioNameOf(element) == null) return true;
|
|
53
|
-
if (active != null && isSameRadioGroup(element, active)) return element === active;
|
|
54
|
-
return element.checked || !elements.some((other) => isSameRadioGroup(element, other) && other.checked);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
/** 容器里能被 Tab 走到的元素,按文档顺序,不含藏在关着的对话框里的。 */
|
|
58
|
-
function focusablesIn(container) {
|
|
59
|
-
return inDocumentOrder(getFocusables(container)).filter((element) => !isInHiddenClosedDialog(element));
|
|
60
|
-
}
|
|
61
|
-
/** 试着聚焦,返回焦点是否真的过去了。被模态层盖住(inert)的元素会拒绝。 */
|
|
62
|
-
function attemptFocus(element) {
|
|
63
|
-
try {
|
|
64
|
-
element.focus();
|
|
65
|
-
} catch {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
return element.ownerDocument.activeElement === element;
|
|
69
|
-
}
|
|
70
|
-
/** 当前启用的焦点区域容器。区域嵌套时,握着焦点的最里层那个接 Tab。 */
|
|
71
|
-
const activeRegions = /* @__PURE__ */ new Set();
|
|
72
|
-
function registerRegion(container) {
|
|
73
|
-
activeRegions.add(container);
|
|
74
|
-
return () => activeRegions.delete(container);
|
|
75
|
-
}
|
|
76
|
-
/** 焦点是否握在嵌套在 `container` 里的另一个区域(或另一个打开的 `<dialog>`)手里。那时由它接 Tab。 */
|
|
77
|
-
function hasInnerRegionHolding(container, active) {
|
|
78
|
-
const dialog = active.closest("dialog[open]");
|
|
79
|
-
if (dialog != null && dialog !== container && container.contains(dialog)) return true;
|
|
80
|
-
for (const other of activeRegions) if (other !== container && container.contains(other) && other.contains(active)) return true;
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
//#endregion
|
|
84
5
|
//#region src/composables/useFocusTrap.ts
|
|
85
6
|
/**
|
|
86
7
|
* 在容器内陷阱键盘焦点,按 Tab 时循环聚焦容器内的可聚焦元素。
|
|
@@ -235,4 +156,4 @@ function useFocusTrap(options = {}) {
|
|
|
235
156
|
};
|
|
236
157
|
}
|
|
237
158
|
//#endregion
|
|
238
|
-
export {
|
|
159
|
+
export { useFocusTrap as t };
|
package/package.json
CHANGED
|
@@ -59,16 +59,33 @@
|
|
|
59
59
|
color: var(--astryx-color-text-secondary, #525252);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/* 弹层自己滚动:叠起来的日历在矮屏幕上仍然够得着。 */
|
|
62
63
|
.astryx-date-range-popover {
|
|
63
64
|
container-type: inline-size;
|
|
64
65
|
width: 100%;
|
|
66
|
+
max-height: min(32rem, calc(100vh - 32px));
|
|
67
|
+
overflow-y: auto;
|
|
68
|
+
overscroll-behavior: contain;
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
.astryx-date-range-panel {
|
|
68
72
|
display: flex;
|
|
69
73
|
align-items: stretch;
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/*
|
|
77
|
+
* 预设和一个月的日历并排放不下时(窄页面),预设叠到日历上面,
|
|
78
|
+
* 日历和翻月按钮都留在层里;分隔线也从右边换到下边。
|
|
79
|
+
*/
|
|
80
|
+
@container (max-width: 26rem) {
|
|
81
|
+
.astryx-date-range-panel {
|
|
82
|
+
flex-direction: column;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.astryx-date-range-presets {
|
|
86
|
+
border-inline-end: 0;
|
|
87
|
+
border-block-end: 1px solid var(--astryx-color-border, #ebebeb);
|
|
88
|
+
}
|
|
72
89
|
}
|
|
73
90
|
|
|
74
91
|
.astryx-date-range-presets {
|
package/styles/mobile-nav.css
CHANGED
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
display: flex;
|
|
30
30
|
flex-direction: column;
|
|
31
31
|
box-sizing: border-box;
|
|
32
|
-
|
|
32
|
+
/* 抽屉最宽不超过视口的 85%,窄屏上遮罩总留一条可点的空隙。 */
|
|
33
|
+
width: min(var(--astryx-mobile-nav-width, 320px), 85vw);
|
|
33
34
|
height: 100%;
|
|
34
35
|
background: var(--astryx-color-background-popover);
|
|
35
36
|
color: var(--astryx-color-text-primary);
|
|
@@ -60,7 +61,8 @@
|
|
|
60
61
|
align-items: center;
|
|
61
62
|
justify-content: space-between;
|
|
62
63
|
gap: var(--astryx-spacing-2, 8px);
|
|
63
|
-
|
|
64
|
+
/* 至少一条栏高,头部内容更高(标题加搜索框、放大字号折行)时随内容长高,不压到第一项。 */
|
|
65
|
+
min-height: 48px;
|
|
64
66
|
padding-inline: var(--astryx-spacing-2, 8px);
|
|
65
67
|
border-block-end: var(--astryx-border-width, 1px) solid var(--astryx-color-border-emphasized, #d4d4d4);
|
|
66
68
|
}
|
package/styles/nav-item.css
CHANGED
|
@@ -50,18 +50,18 @@
|
|
|
50
50
|
background: transparent;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
.astryx-nav-item:hover:not(:disabled, .astryx-nav-item--plain, .astryx-nav-item--selected) {
|
|
53
|
+
.astryx-nav-item:hover:not(:disabled, .astryx-nav-item--disabled, .astryx-nav-item--plain, .astryx-nav-item--selected) {
|
|
54
54
|
background: var(--astryx-color-overlay-hover);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/* 鼠标按下才用 :active。粗指针改看按压模型写的 data-astryx-press,滚动时不会误亮。 */
|
|
58
58
|
@media not all and (pointer: coarse) {
|
|
59
|
-
.astryx-nav-item:active:not(:disabled, .astryx-nav-item--plain, .astryx-nav-item--selected) {
|
|
59
|
+
.astryx-nav-item:active:not(:disabled, .astryx-nav-item--disabled, .astryx-nav-item--plain, .astryx-nav-item--selected) {
|
|
60
60
|
background: var(--astryx-color-overlay-pressed);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
.astryx-nav-item[data-astryx-press]:not(:disabled, .astryx-nav-item--plain, .astryx-nav-item--selected) {
|
|
64
|
+
.astryx-nav-item[data-astryx-press]:not(:disabled, .astryx-nav-item--disabled, .astryx-nav-item--plain, .astryx-nav-item--selected) {
|
|
65
65
|
background-image: var(--_press-paint-image);
|
|
66
66
|
}
|
|
67
67
|
|
package/styles/side-nav.css
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
overflow: hidden;
|
|
11
11
|
background: transparent;
|
|
12
12
|
color: var(--astryx-color-text-primary);
|
|
13
|
-
transition: width var(--astryx-duration-medium-max) var(--astryx-ease-standard);
|
|
14
13
|
}
|
|
15
14
|
|
|
15
|
+
/* 宽度一步落到最终值,收起、展开的动效由 useRailMotion 用裁剪和淡入淡出播放。 */
|
|
16
16
|
.astryx-side-nav--collapsed {
|
|
17
17
|
width: var(--astryx-side-nav-collapsed-width, 48px);
|
|
18
18
|
}
|
|
@@ -29,10 +29,6 @@
|
|
|
29
29
|
overflow: clip;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
.astryx-side-nav--resizing {
|
|
33
|
-
transition: none;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
32
|
.astryx-side-nav--topbar {
|
|
37
33
|
display: flex;
|
|
38
34
|
flex: 1 1 auto;
|
|
@@ -253,6 +249,24 @@
|
|
|
253
249
|
margin-inline-start: auto;
|
|
254
250
|
}
|
|
255
251
|
|
|
252
|
+
/* 整个标题是链接、旁边还有末端内容时,链接占满剩下的宽度。 */
|
|
253
|
+
.astryx-side-nav-heading__whole-link {
|
|
254
|
+
display: flex;
|
|
255
|
+
flex: 1 1 auto;
|
|
256
|
+
align-items: center;
|
|
257
|
+
align-self: stretch;
|
|
258
|
+
gap: var(--astryx-spacing-2, 8px);
|
|
259
|
+
min-width: 0;
|
|
260
|
+
border-radius: var(--astryx-radius-element, 0.625rem);
|
|
261
|
+
color: inherit;
|
|
262
|
+
text-decoration: none;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.astryx-side-nav-heading__whole-link:focus-visible {
|
|
266
|
+
outline: var(--astryx-focus-outline-width) var(--astryx-focus-outline-style) var(--astryx-focus-outline-color);
|
|
267
|
+
outline-offset: var(--astryx-focus-outline-offset);
|
|
268
|
+
}
|
|
269
|
+
|
|
256
270
|
.astryx-side-nav-heading__icon {
|
|
257
271
|
display: inline-flex;
|
|
258
272
|
flex: none;
|
|
@@ -384,6 +398,11 @@
|
|
|
384
398
|
height: 1em;
|
|
385
399
|
}
|
|
386
400
|
|
|
401
|
+
/* 收起的轨道里,禁用的图标行仍要接住指针,提示气泡才能在悬停时出现。 */
|
|
402
|
+
.astryx-side-nav .astryx-nav-item--disabled.astryx-nav-item--icon-only {
|
|
403
|
+
pointer-events: auto;
|
|
404
|
+
}
|
|
405
|
+
|
|
387
406
|
.astryx-side-nav-item { width: 100%; }
|
|
388
407
|
|
|
389
408
|
/* Nested rows keep the full-width surface; only their content moves inward. */
|
|
@@ -450,19 +469,28 @@
|
|
|
450
469
|
background: var(--astryx-color-overlay-hover);
|
|
451
470
|
}
|
|
452
471
|
|
|
472
|
+
/*
|
|
473
|
+
* 下级组只在收起动画期间裁剪:嵌套行和组等宽,常驻裁剪会切掉它们画在行外的焦点环。
|
|
474
|
+
* overflow 是离散属性,靠 allow-discrete 和等于展开时长的延迟,等行高稳定后才放开裁剪;
|
|
475
|
+
* 收起时立刻回到裁剪,下级行不会在收起过程中溢出。
|
|
476
|
+
*/
|
|
453
477
|
.astryx-side-nav-item__children {
|
|
454
478
|
display: grid;
|
|
455
479
|
grid-template-rows: 1fr;
|
|
456
|
-
|
|
480
|
+
overflow: visible;
|
|
481
|
+
transition:
|
|
482
|
+
grid-template-rows var(--astryx-duration-medium-max) var(--astryx-ease-standard),
|
|
483
|
+
overflow 0s var(--astryx-duration-medium-max) allow-discrete;
|
|
457
484
|
}
|
|
458
485
|
|
|
459
486
|
.astryx-side-nav-item__children--collapsed {
|
|
460
487
|
grid-template-rows: 0fr;
|
|
488
|
+
overflow: hidden;
|
|
489
|
+
transition-delay: 0s, 0s;
|
|
461
490
|
}
|
|
462
491
|
|
|
463
492
|
.astryx-side-nav-item__children-inner {
|
|
464
493
|
min-height: 0;
|
|
465
|
-
overflow: hidden;
|
|
466
494
|
}
|
|
467
495
|
|
|
468
496
|
.astryx-side-nav-item__popover {
|
|
@@ -482,11 +510,11 @@
|
|
|
482
510
|
}
|
|
483
511
|
|
|
484
512
|
@media (prefers-reduced-motion: reduce) {
|
|
485
|
-
.astryx-side-nav,
|
|
486
513
|
.astryx-side-nav-item__children,
|
|
487
514
|
.astryx-side-nav-item__chevron,
|
|
488
515
|
.astryx-side-nav-collapse__chevron {
|
|
489
516
|
transition-duration: 0.01ms;
|
|
517
|
+
transition-delay: 0s;
|
|
490
518
|
}
|
|
491
519
|
}
|
|
492
520
|
}
|
package/dist/context-ZsDEkhSF.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { computed, inject, ref } from "vue";
|
|
2
|
-
//#region src/SideNav/context.ts
|
|
3
|
-
const sideNavRenderModeKey = Symbol("astryx-side-nav-render-mode");
|
|
4
|
-
const defaultRenderMode = computed(() => "default");
|
|
5
|
-
function useSideNavRenderMode() {
|
|
6
|
-
return inject(sideNavRenderModeKey, defaultRenderMode);
|
|
7
|
-
}
|
|
8
|
-
const sideNavCollapseKey = Symbol("astryx-side-nav-collapse");
|
|
9
|
-
const fallbackCollapse = {
|
|
10
|
-
isCollapsed: ref(false),
|
|
11
|
-
isCollapsible: ref(false),
|
|
12
|
-
navId: "",
|
|
13
|
-
toggle: () => {}
|
|
14
|
-
};
|
|
15
|
-
function useSideNavCollapse() {
|
|
16
|
-
return inject(sideNavCollapseKey, fallbackCollapse);
|
|
17
|
-
}
|
|
18
|
-
/** Internal nesting depth; zero for top-level rows and the first rail flyout level. */
|
|
19
|
-
const sideNavDepthKey = Symbol("astryx-side-nav-depth");
|
|
20
|
-
function useSideNavDepth() {
|
|
21
|
-
return inject(sideNavDepthKey, ref(0));
|
|
22
|
-
}
|
|
23
|
-
//#endregion
|
|
24
|
-
export { useSideNavDepth as a, useSideNavCollapse as i, sideNavDepthKey as n, useSideNavRenderMode as o, sideNavRenderModeKey as r, sideNavCollapseKey as t };
|
|
@@ -43,8 +43,8 @@ declare const __VLS_base: import("vue").DefineComponent<TokenProps, {}, {}, {},
|
|
|
43
43
|
onRemove?: ((event: Event) => any) | undefined;
|
|
44
44
|
}>, {
|
|
45
45
|
size: TokenSize;
|
|
46
|
-
disabled: boolean;
|
|
47
46
|
color: "default" | "blue" | "cyan" | "gray" | "green" | "orange" | "pink" | "purple" | "red" | "teal" | "yellow";
|
|
47
|
+
disabled: boolean;
|
|
48
48
|
labelHidden: boolean;
|
|
49
49
|
removable: boolean;
|
|
50
50
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|