@adecore/ui 0.31.11 → 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/dist/AccentSwatches.js +290 -13
- package/dist/Banner.js +90 -9
- package/dist/Button.js +114 -22
- package/dist/ButtonGroup.js +62 -8
- package/dist/Checkbox.js +73 -4
- package/dist/ChoiceCards.js +205 -11
- package/dist/CloseButton.js +87 -7
- package/dist/ColorSwatch.js +132 -15
- package/dist/ColorWheelPicker.js +305 -71
- package/dist/ColumnResizeHandle.js +43 -8
- package/dist/DisabledReason.js +27 -8
- package/dist/DockShell.js +144 -37
- package/dist/EmptyState.js +95 -6
- package/dist/ErrorBoundary.js +254 -31
- package/dist/Field.js +349 -31
- package/dist/FileIcon.js +67 -6
- package/dist/Icon.js +38 -6
- package/dist/IconButton.js +176 -20
- package/dist/IconPicker.js +344 -73
- package/dist/Input.js +233 -14
- package/dist/Kbd.js +150 -10
- package/dist/LazyBoundary.js +14 -5
- package/dist/ListRow.js +75 -15
- package/dist/Meter.js +108 -5
- package/dist/MiddleTruncate.js +126 -45
- package/dist/PanelEmpty.js +64 -5
- package/dist/PanelHeader.js +95 -13
- package/dist/Pill.js +114 -19
- package/dist/ProjectSwitcher.js +225 -12
- package/dist/PromptDialog.js +352 -37
- package/dist/SectionLabel.js +62 -8
- package/dist/SegmentBar.js +197 -36
- package/dist/Segmented.js +130 -23
- package/dist/Select.js +310 -19
- package/dist/SelectSearch.js +344 -29
- package/dist/Separator.js +35 -4
- package/dist/ShortcutHints.js +146 -76
- package/dist/Skeleton.js +31 -4
- package/dist/Slider.js +172 -10
- package/dist/SlidingColumn.js +194 -34
- package/dist/Spinner.js +100 -3
- package/dist/Stepper.js +232 -11
- package/dist/Surface.js +62 -8
- package/dist/Switch.js +60 -6
- package/dist/TextMenu.js +212 -17
- package/dist/Tile.js +149 -5
- package/dist/Toasts.js +391 -33
- package/dist/Tooltip.js +153 -16
- package/dist/UIProvider.js +62 -15
- package/dist/Waveform.js +362 -93
- package/dist/Wipe.js +259 -34
- package/dist/ZoomControls.js +356 -14
- package/dist/class-name.js +1 -1
- package/dist/clipboard.js +15 -17
- package/dist/context-menu/index.parts.js +1 -1
- package/dist/dialog/index.parts.js +1 -1
- package/dist/dialog/parts.js +378 -29
- package/dist/dialog-layer.js +51 -18
- package/dist/error-boundary.js +19 -19
- package/dist/error-message.js +1 -1
- package/dist/field-context.js +7 -5
- package/dist/file-icon.js +23 -21
- package/dist/file-tree/helpers.js +133 -119
- package/dist/file-tree/index.parts.js +3 -3
- package/dist/file-tree/parts.js +418 -127
- package/dist/file-tree/style.js +1 -1
- package/dist/file-tree/use-file-tree-shift.js +43 -30
- package/dist/file-tree/use-file-tree.js +60 -18
- package/dist/file-tree/use-slots.js +220 -192
- package/dist/floating.js +2 -2
- package/dist/format/datetime.js +88 -38
- package/dist/format/duration.js +59 -53
- package/dist/format/index.js +1 -1
- package/dist/format/locale.js +76 -56
- package/dist/format/number.js +77 -61
- package/dist/format/regions.js +4 -2
- package/dist/format/time-zone.js +1 -1
- package/dist/icon-button-size.js +12 -2
- package/dist/icon-picker.js +70 -61
- package/dist/index.js +57 -57
- package/dist/key-value-list/index.parts.js +1 -1
- package/dist/key-value-list/parts.js +256 -22
- package/dist/lazy-landings.js +10 -10
- package/dist/lazy.js +84 -71
- package/dist/locales/en.js +80 -80
- package/dist/locales/nl.js +80 -80
- package/dist/locales.js +10 -7
- package/dist/menu/index.parts.js +1 -1
- package/dist/menu/parts.js +882 -44
- package/dist/merge-refs.js +8 -9
- package/dist/middle-truncate.js +24 -25
- package/dist/modality.js +27 -19
- package/dist/placement.js +11 -20
- package/dist/platform.js +6 -6
- package/dist/popover/index.parts.js +1 -1
- package/dist/popover/parts.js +173 -11
- package/dist/popup-layer.js +38 -17
- package/dist/prefetch.js +78 -79
- package/dist/preview-card/index.parts.js +1 -1
- package/dist/project-switcher-row.js +153 -12
- package/dist/select-row.js +69 -5
- package/dist/select-shared.js +6 -6
- package/dist/selection.js +16 -16
- package/dist/seti-icons.js +413 -413
- package/dist/settings/ConfirmDialog.js +55 -8
- package/dist/settings/DetailHeader.js +72 -4
- package/dist/settings/MasterDetail.js +119 -7
- package/dist/settings/SettingsDialog.js +820 -80
- package/dist/settings/SettingsRow.js +205 -18
- package/dist/settings/SettingsSection.js +96 -6
- package/dist/settings/index.js +7 -7
- package/dist/settings/target.js +7 -2
- package/dist/shortcut-hints.js +73 -55
- package/dist/shortcut.js +140 -104
- package/dist/step-places.js +1 -1
- package/dist/tabs/index.parts.js +1 -1
- package/dist/tabs/overflow.js +18 -18
- package/dist/tabs/parts.js +780 -166
- package/dist/testing/dedupe.js +82 -75
- package/dist/testing/fake-source.js +12 -12
- package/dist/testing/index.js +1 -1
- package/dist/toast-store.js +65 -46
- package/dist/tree/index.parts.js +1 -1
- package/dist/tree/parts.js +721 -94
- package/dist/tree/shift.js +28 -22
- package/dist/tree/style.js +2 -2
- package/dist/tree/use-tree-shift.js +178 -117
- package/dist/useAsyncAction.js +23 -19
- package/dist/useColumnResize.js +36 -34
- package/dist/useContentSize.js +62 -18
- package/dist/useMeasuredWidth.js +14 -3
- package/dist/useNow.js +73 -30
- package/dist/wipe-split.js +14 -14
- package/dist/workspace/DropPreview.js +60 -7
- package/dist/workspace/SplitView.js +1025 -441
- package/dist/workspace/TabStrip.js +810 -191
- package/dist/workspace/Workspace.js +276 -26
- package/dist/workspace/context.js +8 -3
- package/dist/workspace/geometry.js +173 -150
- package/dist/workspace/model.js +313 -250
- package/dist/workspace/preview.js +61 -61
- package/dist/zoom.js +2 -2
- package/package.json +1 -1
- package/src/ErrorBoundary.tsx +1 -1
- package/src/Field.tsx +4 -3
- package/src/IconPicker.tsx +3 -3
- package/src/LazyBoundary.tsx +2 -0
- package/src/MiddleTruncate.tsx +2 -2
- package/src/SegmentBar.tsx +2 -2
- package/src/Toasts.tsx +3 -1
- package/src/Tooltip.tsx +7 -10
- package/src/Waveform.tsx +3 -3
- package/src/file-tree/parts.tsx +6 -9
- package/src/file-tree/use-file-tree-shift.tsx +6 -9
- package/src/lazy.tsx +4 -0
- package/src/locales/en.ts +4 -4
- package/src/locales/nl.ts +5 -5
- package/src/settings/SettingsDialog.tsx +1 -1
- package/src/tree/parts.tsx +5 -8
- package/src/useContentSize.ts +3 -3
- package/src/workspace/SplitView.tsx +2 -2
- package/src/workspace/TabStrip.tsx +2 -3
- package/src/workspace/Workspace.tsx +2 -5
package/dist/merge-refs.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/* One callback ref that fills a component's own ref and the one its caller handed in. */
|
|
2
|
-
export const mergeRefs = (...refs) =>
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
ref.current = node;
|
|
9
|
-
}
|
|
2
|
+
export const mergeRefs = (...refs) => node => {
|
|
3
|
+
for (const ref of refs) {
|
|
4
|
+
if (typeof ref === 'function') {
|
|
5
|
+
ref(node);
|
|
6
|
+
} else if (ref) {
|
|
7
|
+
ref.current = node;
|
|
10
8
|
}
|
|
11
|
-
}
|
|
9
|
+
}
|
|
10
|
+
};
|
package/dist/middle-truncate.js
CHANGED
|
@@ -5,30 +5,29 @@ export const MIDDLE_ELLIPSIS = '…';
|
|
|
5
5
|
* what tells two of them apart. Code points, never UTF-16 units, so a cut never halves a character.
|
|
6
6
|
*/
|
|
7
7
|
export function fitMiddle(text, width, measure) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
8
|
+
if (measure(text) <= width) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
const characters = Array.from(text);
|
|
12
|
+
const cutAt = kept => {
|
|
13
|
+
const headLength = Math.floor(kept / 2);
|
|
14
|
+
const tailStart = characters.length - (kept - headLength);
|
|
15
|
+
return {
|
|
16
|
+
head: characters.slice(0, headLength).join(''),
|
|
17
|
+
middle: characters.slice(headLength, tailStart).join(''),
|
|
18
|
+
tail: characters.slice(tailStart).join('')
|
|
20
19
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
20
|
+
};
|
|
21
|
+
const fits = cut => measure(cut.head + MIDDLE_ELLIPSIS + cut.tail) <= width;
|
|
22
|
+
let low = 0;
|
|
23
|
+
let high = characters.length - 1;
|
|
24
|
+
while (low < high) {
|
|
25
|
+
const kept = Math.ceil((low + high) / 2);
|
|
26
|
+
if (fits(cutAt(kept))) {
|
|
27
|
+
low = kept;
|
|
28
|
+
} else {
|
|
29
|
+
high = kept - 1;
|
|
32
30
|
}
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
}
|
|
32
|
+
return cutAt(low);
|
|
33
|
+
}
|
package/dist/modality.js
CHANGED
|
@@ -1,28 +1,36 @@
|
|
|
1
1
|
let current = null;
|
|
2
2
|
let started = false;
|
|
3
|
-
const set =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
const set = modality => {
|
|
4
|
+
if (current === modality) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
current = modality;
|
|
8
|
+
document.documentElement.dataset.modality = modality;
|
|
9
9
|
};
|
|
10
10
|
/* Which device the app was last driven with, as `data-modality` on the root. `:focus-visible` alone
|
|
11
11
|
cannot tell: focus a script moves (Base UI's hovered menu item) keeps matching it once a single
|
|
12
12
|
keystroke anywhere, a terminal included, raised the browser's keyboard flag. `UIProvider` starts
|
|
13
13
|
it; a second call does nothing. */
|
|
14
14
|
export function startInputModality() {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
if (started) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
started = true;
|
|
19
|
+
set('pointer');
|
|
20
|
+
window.addEventListener('keydown', event => {
|
|
21
|
+
// A modifier on its own is half of a shift-click as often as it is a keystroke.
|
|
22
|
+
if (event.key !== 'Shift' && event.key !== 'Control' && event.key !== 'Alt' && event.key !== 'Meta') {
|
|
23
|
+
set('keyboard');
|
|
17
24
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
25
|
+
}, {
|
|
26
|
+
capture: true
|
|
27
|
+
});
|
|
28
|
+
window.addEventListener('pointerdown', () => set('pointer'), {
|
|
29
|
+
capture: true,
|
|
30
|
+
passive: true
|
|
31
|
+
});
|
|
32
|
+
window.addEventListener('pointermove', () => set('pointer'), {
|
|
33
|
+
capture: true,
|
|
34
|
+
passive: true
|
|
35
|
+
});
|
|
36
|
+
}
|
package/dist/placement.js
CHANGED
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
/* The positioner props a popup part takes beside its own, so a caller places a popup on the one element it renders. */
|
|
2
|
-
const PLACEMENT_KEYS = [
|
|
3
|
-
'side',
|
|
4
|
-
'align',
|
|
5
|
-
'sideOffset',
|
|
6
|
-
'alignOffset',
|
|
7
|
-
'collisionPadding',
|
|
8
|
-
'collisionBoundary',
|
|
9
|
-
'collisionAvoidance',
|
|
10
|
-
'anchor',
|
|
11
|
-
'sticky',
|
|
12
|
-
'positionMethod'
|
|
13
|
-
];
|
|
2
|
+
const PLACEMENT_KEYS = ['side', 'align', 'sideOffset', 'alignOffset', 'collisionPadding', 'collisionBoundary', 'collisionAvoidance', 'anchor', 'sticky', 'positionMethod'];
|
|
14
3
|
/* Splits a popup part's props into what goes to the positioner and what goes to the popup. */
|
|
15
4
|
export function splitPlacement(props) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
5
|
+
const placement = {};
|
|
6
|
+
const rest = {
|
|
7
|
+
...props
|
|
8
|
+
};
|
|
9
|
+
for (const key of PLACEMENT_KEYS) {
|
|
10
|
+
placement[key] = props[key];
|
|
11
|
+
delete rest[key];
|
|
12
|
+
}
|
|
13
|
+
return [placement, rest];
|
|
14
|
+
}
|
package/dist/platform.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* True on macOS and iOS, where a shortcut is written with ⌘ instead of Ctrl. The keyboard in question is the one in front of this page. */
|
|
2
2
|
export const isApplePlatform = () => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
if (typeof navigator === 'undefined') {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
const hints = navigator.userAgentData;
|
|
7
|
+
return applePlatformFrom(hints?.platform || navigator.platform);
|
|
8
8
|
};
|
|
9
|
-
export const applePlatformFrom =
|
|
9
|
+
export const applePlatformFrom = platform => /mac|iphone|ipad/i.test(platform ?? '');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PopoverClose as Close, PopoverDescription as Description, PopoverPopup as Popup, PopoverRoot as Root, PopoverTitle as Title, PopoverTrigger as Trigger } from
|
|
1
|
+
export { PopoverClose as Close, PopoverDescription as Description, PopoverPopup as Popup, PopoverRoot as Root, PopoverTitle as Title, PopoverTrigger as Trigger } from "./parts.js";
|
package/dist/popover/parts.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { Popover as BasePopover } from '@base-ui/react/popover';
|
|
3
3
|
import { PreviewCard as BasePreviewCard } from '@base-ui/react/preview-card';
|
|
4
4
|
import { withClass } from '../class-name.js';
|
|
@@ -8,10 +8,11 @@ import { renderPositioner } from '../popup-layer.js';
|
|
|
8
8
|
* The surface a popup is drawn on. `menu` is the padded card menus use, `picker` a card whose
|
|
9
9
|
* content runs to its edges (a search field on top of a list), and `plain` leaves the surface to the caller.
|
|
10
10
|
*/
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
const POPUP_VARIANT = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
menu: 'menu-popup',
|
|
14
|
+
picker: 'picker-popup',
|
|
15
|
+
plain: ''
|
|
15
16
|
};
|
|
16
17
|
export const PopoverRoot = BasePopover.Root;
|
|
17
18
|
export const PopoverTrigger = BasePopover.Trigger;
|
|
@@ -19,14 +20,175 @@ export const PopoverClose = BasePopover.Close;
|
|
|
19
20
|
export const PopoverTitle = BasePopover.Title;
|
|
20
21
|
export const PopoverDescription = BasePopover.Description;
|
|
21
22
|
/* The portal, the positioner and the popup of a popover: under its trigger and lined up with its start unless it says otherwise. */
|
|
22
|
-
export function PopoverPopup(
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
export function PopoverPopup(t0) {
|
|
24
|
+
const $ = _c(19);
|
|
25
|
+
let align;
|
|
26
|
+
let className;
|
|
27
|
+
let side;
|
|
28
|
+
let sideOffset;
|
|
29
|
+
let t1;
|
|
30
|
+
let variant;
|
|
31
|
+
if ($[0] !== t0) {
|
|
32
|
+
const {
|
|
33
|
+
variant: t2,
|
|
34
|
+
side: t3,
|
|
35
|
+
align: t4,
|
|
36
|
+
sideOffset: t5,
|
|
37
|
+
className: t6,
|
|
38
|
+
...props
|
|
39
|
+
} = t0;
|
|
40
|
+
className = t6;
|
|
41
|
+
variant = t2 === undefined ? "menu" : t2;
|
|
42
|
+
side = t3 === undefined ? "bottom" : t3;
|
|
43
|
+
align = t4 === undefined ? "start" : t4;
|
|
44
|
+
sideOffset = t5 === undefined ? 8 : t5;
|
|
45
|
+
t1 = splitPlacement(props);
|
|
46
|
+
$[0] = t0;
|
|
47
|
+
$[1] = align;
|
|
48
|
+
$[2] = className;
|
|
49
|
+
$[3] = side;
|
|
50
|
+
$[4] = sideOffset;
|
|
51
|
+
$[5] = t1;
|
|
52
|
+
$[6] = variant;
|
|
53
|
+
} else {
|
|
54
|
+
align = $[1];
|
|
55
|
+
className = $[2];
|
|
56
|
+
side = $[3];
|
|
57
|
+
sideOffset = $[4];
|
|
58
|
+
t1 = $[5];
|
|
59
|
+
variant = $[6];
|
|
60
|
+
}
|
|
61
|
+
const [placement, popupProps] = t1;
|
|
62
|
+
const t2 = POPUP_VARIANT[variant];
|
|
63
|
+
let t3;
|
|
64
|
+
if ($[7] !== className || $[8] !== t2) {
|
|
65
|
+
t3 = withClass(t2, className);
|
|
66
|
+
$[7] = className;
|
|
67
|
+
$[8] = t2;
|
|
68
|
+
$[9] = t3;
|
|
69
|
+
} else {
|
|
70
|
+
t3 = $[9];
|
|
71
|
+
}
|
|
72
|
+
let t4;
|
|
73
|
+
if ($[10] !== popupProps || $[11] !== t3) {
|
|
74
|
+
t4 = /*#__PURE__*/_jsx(BasePopover.Popup, {
|
|
75
|
+
className: t3,
|
|
76
|
+
...popupProps
|
|
77
|
+
});
|
|
78
|
+
$[10] = popupProps;
|
|
79
|
+
$[11] = t3;
|
|
80
|
+
$[12] = t4;
|
|
81
|
+
} else {
|
|
82
|
+
t4 = $[12];
|
|
83
|
+
}
|
|
84
|
+
let t5;
|
|
85
|
+
if ($[13] !== align || $[14] !== placement || $[15] !== side || $[16] !== sideOffset || $[17] !== t4) {
|
|
86
|
+
t5 = /*#__PURE__*/_jsx(BasePopover.Portal, {
|
|
87
|
+
children: /*#__PURE__*/_jsx(BasePopover.Positioner, {
|
|
88
|
+
className: "popup-positioner",
|
|
89
|
+
render: renderPositioner,
|
|
90
|
+
...placement,
|
|
91
|
+
side: side,
|
|
92
|
+
align: align,
|
|
93
|
+
sideOffset: sideOffset,
|
|
94
|
+
children: t4
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
$[13] = align;
|
|
98
|
+
$[14] = placement;
|
|
99
|
+
$[15] = side;
|
|
100
|
+
$[16] = sideOffset;
|
|
101
|
+
$[17] = t4;
|
|
102
|
+
$[18] = t5;
|
|
103
|
+
} else {
|
|
104
|
+
t5 = $[18];
|
|
105
|
+
}
|
|
106
|
+
return t5;
|
|
25
107
|
}
|
|
26
108
|
export const PreviewCardRoot = BasePreviewCard.Root;
|
|
27
109
|
export const PreviewCardTrigger = BasePreviewCard.Trigger;
|
|
28
110
|
/* A card that opens while the pointer rests on its trigger, drawn like a popover. */
|
|
29
|
-
export function PreviewCardPopup(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
111
|
+
export function PreviewCardPopup(t0) {
|
|
112
|
+
const $ = _c(19);
|
|
113
|
+
let align;
|
|
114
|
+
let className;
|
|
115
|
+
let side;
|
|
116
|
+
let sideOffset;
|
|
117
|
+
let t1;
|
|
118
|
+
let variant;
|
|
119
|
+
if ($[0] !== t0) {
|
|
120
|
+
const {
|
|
121
|
+
variant: t2,
|
|
122
|
+
side: t3,
|
|
123
|
+
align: t4,
|
|
124
|
+
sideOffset: t5,
|
|
125
|
+
className: t6,
|
|
126
|
+
...props
|
|
127
|
+
} = t0;
|
|
128
|
+
className = t6;
|
|
129
|
+
variant = t2 === undefined ? "menu" : t2;
|
|
130
|
+
side = t3 === undefined ? "bottom" : t3;
|
|
131
|
+
align = t4 === undefined ? "start" : t4;
|
|
132
|
+
sideOffset = t5 === undefined ? 8 : t5;
|
|
133
|
+
t1 = splitPlacement(props);
|
|
134
|
+
$[0] = t0;
|
|
135
|
+
$[1] = align;
|
|
136
|
+
$[2] = className;
|
|
137
|
+
$[3] = side;
|
|
138
|
+
$[4] = sideOffset;
|
|
139
|
+
$[5] = t1;
|
|
140
|
+
$[6] = variant;
|
|
141
|
+
} else {
|
|
142
|
+
align = $[1];
|
|
143
|
+
className = $[2];
|
|
144
|
+
side = $[3];
|
|
145
|
+
sideOffset = $[4];
|
|
146
|
+
t1 = $[5];
|
|
147
|
+
variant = $[6];
|
|
148
|
+
}
|
|
149
|
+
const [placement, popupProps] = t1;
|
|
150
|
+
const t2 = POPUP_VARIANT[variant];
|
|
151
|
+
let t3;
|
|
152
|
+
if ($[7] !== className || $[8] !== t2) {
|
|
153
|
+
t3 = withClass(t2, className);
|
|
154
|
+
$[7] = className;
|
|
155
|
+
$[8] = t2;
|
|
156
|
+
$[9] = t3;
|
|
157
|
+
} else {
|
|
158
|
+
t3 = $[9];
|
|
159
|
+
}
|
|
160
|
+
let t4;
|
|
161
|
+
if ($[10] !== popupProps || $[11] !== t3) {
|
|
162
|
+
t4 = /*#__PURE__*/_jsx(BasePreviewCard.Popup, {
|
|
163
|
+
className: t3,
|
|
164
|
+
...popupProps
|
|
165
|
+
});
|
|
166
|
+
$[10] = popupProps;
|
|
167
|
+
$[11] = t3;
|
|
168
|
+
$[12] = t4;
|
|
169
|
+
} else {
|
|
170
|
+
t4 = $[12];
|
|
171
|
+
}
|
|
172
|
+
let t5;
|
|
173
|
+
if ($[13] !== align || $[14] !== placement || $[15] !== side || $[16] !== sideOffset || $[17] !== t4) {
|
|
174
|
+
t5 = /*#__PURE__*/_jsx(BasePreviewCard.Portal, {
|
|
175
|
+
children: /*#__PURE__*/_jsx(BasePreviewCard.Positioner, {
|
|
176
|
+
className: "z-(--z-popup)",
|
|
177
|
+
...placement,
|
|
178
|
+
side: side,
|
|
179
|
+
align: align,
|
|
180
|
+
sideOffset: sideOffset,
|
|
181
|
+
children: t4
|
|
182
|
+
})
|
|
183
|
+
});
|
|
184
|
+
$[13] = align;
|
|
185
|
+
$[14] = placement;
|
|
186
|
+
$[15] = side;
|
|
187
|
+
$[16] = sideOffset;
|
|
188
|
+
$[17] = t4;
|
|
189
|
+
$[18] = t5;
|
|
190
|
+
} else {
|
|
191
|
+
t5 = $[18];
|
|
192
|
+
}
|
|
193
|
+
return t5;
|
|
194
|
+
}
|
package/dist/popup-layer.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
1
2
|
import { createElement, useLayoutEffect } from 'react';
|
|
2
3
|
// One attribute serves every open popup, so it stays until the last one closes.
|
|
3
4
|
const open = new Set();
|
|
@@ -7,24 +8,44 @@ const open = new Set();
|
|
|
7
8
|
* browser restyle the whole page on every DOM insertion.
|
|
8
9
|
*/
|
|
9
10
|
function usePopupLayer(isOpen) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const $ = _c(3);
|
|
12
|
+
let t0;
|
|
13
|
+
let t1;
|
|
14
|
+
if ($[0] !== isOpen) {
|
|
15
|
+
t0 = () => {
|
|
16
|
+
if (!isOpen) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const self = Symbol("popup");
|
|
20
|
+
open.add(self);
|
|
21
|
+
document.documentElement.setAttribute("data-popup-open", "");
|
|
22
|
+
return () => {
|
|
23
|
+
open.delete(self);
|
|
24
|
+
if (open.size === 0) {
|
|
25
|
+
document.documentElement.removeAttribute("data-popup-open");
|
|
13
26
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
t1 = [isOpen];
|
|
30
|
+
$[0] = isOpen;
|
|
31
|
+
$[1] = t0;
|
|
32
|
+
$[2] = t1;
|
|
33
|
+
} else {
|
|
34
|
+
t0 = $[1];
|
|
35
|
+
t1 = $[2];
|
|
36
|
+
}
|
|
37
|
+
useLayoutEffect(t0, t1);
|
|
24
38
|
}
|
|
25
|
-
function LayerPositioner(
|
|
26
|
-
|
|
27
|
-
|
|
39
|
+
function LayerPositioner(t0) {
|
|
40
|
+
const {
|
|
41
|
+
open: isOpen,
|
|
42
|
+
...props
|
|
43
|
+
} = t0;
|
|
44
|
+
usePopupLayer(isOpen);
|
|
45
|
+
return createElement("div", props);
|
|
28
46
|
}
|
|
29
47
|
/* The `render` of a popup's positioner, which knows whether the popup is open and so marks the root for as long as it is. */
|
|
30
|
-
export const renderPositioner = (props, state) => createElement(LayerPositioner, {
|
|
48
|
+
export const renderPositioner = (props, state) => createElement(LayerPositioner, {
|
|
49
|
+
...props,
|
|
50
|
+
open: state.open
|
|
51
|
+
});
|
package/dist/prefetch.js
CHANGED
|
@@ -4,101 +4,100 @@
|
|
|
4
4
|
* joins the end, which is how a lazy surface inside another lazy one gets its turn.
|
|
5
5
|
*/
|
|
6
6
|
export class Prefetcher {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
registered = [];
|
|
8
|
+
queued = new Set();
|
|
9
|
+
queue = [];
|
|
10
|
+
everythingOn = false;
|
|
11
|
+
running = null;
|
|
12
|
+
loading = false;
|
|
13
|
+
whenIdle;
|
|
14
|
+
/* Asked on every ask and again before every load, since a person can turn data saving on while the page runs. */
|
|
15
|
+
allowed;
|
|
16
|
+
constructor(whenIdle, allowed = () => true) {
|
|
17
|
+
this.whenIdle = whenIdle;
|
|
18
|
+
this.allowed = allowed;
|
|
19
|
+
}
|
|
20
|
+
/* True while a prefetch waits on its chunk, so a failure it causes is not taken for a person's. */
|
|
21
|
+
get busy() {
|
|
22
|
+
return this.loading;
|
|
23
|
+
}
|
|
24
|
+
register(load) {
|
|
25
|
+
this.registered.push(load);
|
|
26
|
+
if (this.everythingOn) {
|
|
27
|
+
this.enqueue(load);
|
|
19
28
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
29
|
+
}
|
|
30
|
+
/* Loads this one module, ahead of whatever is registered. */
|
|
31
|
+
prefetch(load) {
|
|
32
|
+
if (!this.allowed()) {
|
|
33
|
+
return Promise.resolve();
|
|
23
34
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
this.enqueue(load);
|
|
36
|
+
return this.drain();
|
|
37
|
+
}
|
|
38
|
+
/* Loads every registered module, and every one registered from now on. */
|
|
39
|
+
prefetchEverything() {
|
|
40
|
+
if (!this.allowed()) {
|
|
41
|
+
return Promise.resolve();
|
|
29
42
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return Promise.resolve();
|
|
34
|
-
}
|
|
35
|
-
this.enqueue(load);
|
|
36
|
-
return this.drain();
|
|
43
|
+
this.everythingOn = true;
|
|
44
|
+
for (const load of this.registered) {
|
|
45
|
+
this.enqueue(load);
|
|
37
46
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
this.everythingOn = true;
|
|
44
|
-
for (const load of this.registered) {
|
|
45
|
-
this.enqueue(load);
|
|
46
|
-
}
|
|
47
|
-
return this.drain();
|
|
47
|
+
return this.drain();
|
|
48
|
+
}
|
|
49
|
+
enqueue(load) {
|
|
50
|
+
if (this.queued.has(load)) {
|
|
51
|
+
return;
|
|
48
52
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
this.queued.add(load);
|
|
54
|
+
this.queue.push(load);
|
|
55
|
+
void this.drain();
|
|
56
|
+
}
|
|
57
|
+
drain() {
|
|
58
|
+
// Never on an empty queue: `loadQueue` would clear `running` before it is even set.
|
|
59
|
+
if (this.running === null && this.queue.length > 0) {
|
|
60
|
+
this.running = this.loadQueue();
|
|
56
61
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
return this.running ?? Promise.resolve();
|
|
63
|
+
}
|
|
64
|
+
async loadQueue() {
|
|
65
|
+
try {
|
|
66
|
+
for (let load = this.queue.shift(); load; load = this.queue.shift()) {
|
|
67
|
+
await new Promise(resolve => this.whenIdle(resolve));
|
|
68
|
+
if (!this.allowed()) {
|
|
69
|
+
// Data saving came on while it waited; a later ask may queue it again.
|
|
70
|
+
this.queued.delete(load);
|
|
71
|
+
continue;
|
|
61
72
|
}
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
async loadQueue() {
|
|
73
|
+
this.loading = true;
|
|
65
74
|
try {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
this.loading = true;
|
|
74
|
-
try {
|
|
75
|
-
await load();
|
|
76
|
-
}
|
|
77
|
-
catch {
|
|
78
|
-
// A later open tries again; a chunk a deploy removed is the app's to answer, and `busy` tells it this was only a prefetch.
|
|
79
|
-
}
|
|
80
|
-
finally {
|
|
81
|
-
this.loading = false;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
finally {
|
|
86
|
-
this.running = null;
|
|
75
|
+
await load();
|
|
76
|
+
} catch {
|
|
77
|
+
// A later open tries again; a chunk a deploy removed is the app's to answer, and `busy` tells it this was only a prefetch.
|
|
78
|
+
} finally {
|
|
79
|
+
this.loading = false;
|
|
87
80
|
}
|
|
81
|
+
}
|
|
82
|
+
} finally {
|
|
83
|
+
this.running = null;
|
|
88
84
|
}
|
|
85
|
+
}
|
|
89
86
|
}
|
|
90
87
|
/* Safari has no idle callback; the timeout at least lets the frame that asked finish first. */
|
|
91
88
|
const FALLBACK_DELAY_MS = 50;
|
|
92
89
|
/* A canvas that keeps drawing (a blinking cursor, a stream) may never leave an idle moment, and a prefetch that never runs helps nobody. */
|
|
93
90
|
const IDLE_TIMEOUT_MS = 2000;
|
|
94
|
-
const whenIdle =
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
91
|
+
const whenIdle = run => {
|
|
92
|
+
if (typeof requestIdleCallback === 'function') {
|
|
93
|
+
requestIdleCallback(() => run(), {
|
|
94
|
+
timeout: IDLE_TIMEOUT_MS
|
|
95
|
+
});
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
setTimeout(run, FALLBACK_DELAY_MS);
|
|
100
99
|
};
|
|
101
100
|
/* Not in every DOM typing yet, and only Chromium reports it. */
|
|
102
101
|
const savesData = () => navigator.connection?.saveData === true;
|
|
103
102
|
/* The one every `lazyNamed` and `lazyDialog` registers with. */
|
|
104
|
-
export const prefetcher = /* @__PURE__ */
|
|
103
|
+
export const prefetcher = /* @__PURE__ */new Prefetcher(whenIdle, () => !savesData());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PreviewCardPopup as Popup, PreviewCardRoot as Root, PreviewCardTrigger as Trigger } from
|
|
1
|
+
export { PreviewCardPopup as Popup, PreviewCardRoot as Root, PreviewCardTrigger as Trigger } from "../popover/parts.js";
|