@adecore/ui 0.31.12 → 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/format/number.js
CHANGED
|
@@ -1,24 +1,33 @@
|
|
|
1
1
|
import { numberFormatter } from './locale.js';
|
|
2
|
-
const WHOLE = {
|
|
3
|
-
|
|
2
|
+
const WHOLE = {
|
|
3
|
+
maximumFractionDigits: 0
|
|
4
|
+
};
|
|
5
|
+
const ONE_DECIMAL = {
|
|
6
|
+
maximumFractionDigits: 1
|
|
7
|
+
};
|
|
4
8
|
/* A count as a region groups one: `1,234,567` there, `1.234.567` here. */
|
|
5
|
-
export const formatNumber =
|
|
9
|
+
export const formatNumber = value => numberFormatter(WHOLE).format(Math.round(value));
|
|
6
10
|
/* The same, to one decimal, where the fraction is the part that means something. */
|
|
7
|
-
export const formatDecimal =
|
|
11
|
+
export const formatDecimal = value => numberFormatter(ONE_DECIMAL).format(value);
|
|
8
12
|
/* One options object per key, so the formatter cached on it is built once (`numberFormatter`). */
|
|
9
|
-
const specCache =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
const specCache = build => {
|
|
14
|
+
const specs = new Map();
|
|
15
|
+
return key => {
|
|
16
|
+
let spec = specs.get(key);
|
|
17
|
+
if (spec === undefined) {
|
|
18
|
+
spec = build(key);
|
|
19
|
+
specs.set(key, spec);
|
|
20
|
+
}
|
|
21
|
+
return spec;
|
|
22
|
+
};
|
|
19
23
|
};
|
|
20
|
-
const fixedSpec = specCache(
|
|
21
|
-
|
|
24
|
+
const fixedSpec = specCache(decimals => ({
|
|
25
|
+
minimumFractionDigits: decimals,
|
|
26
|
+
maximumFractionDigits: decimals
|
|
27
|
+
}));
|
|
28
|
+
const roundedSpec = specCache(decimals => ({
|
|
29
|
+
maximumFractionDigits: decimals
|
|
30
|
+
}));
|
|
22
31
|
/* Always `decimals` places, so values that follow each other keep one width: `1,0` and `1,5`, never `1` and `1,5`. */
|
|
23
32
|
export const formatFixed = (value, decimals) => numberFormatter(fixedSpec(decimals)).format(value);
|
|
24
33
|
/* At most `decimals` places, trailing zeros dropped, for a figure whose fraction may or may not be there: `39`, `1,95`. */
|
|
@@ -31,55 +40,62 @@ const NUMERAL = /^[+-]?\d+(?:\.(\d+))?$/;
|
|
|
31
40
|
* with every digit kept: a decimal or a big integer arrives as text, and a float would round it.
|
|
32
41
|
* Text that is no plain numeral, such as `NaN` or `1e999`, comes back as it is.
|
|
33
42
|
*/
|
|
34
|
-
export const formatNumeral =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
export const formatNumeral = numeral => {
|
|
44
|
+
const text = typeof numeral === 'number' ? String(numeral) : numeral.trim();
|
|
45
|
+
const match = NUMERAL.exec(text);
|
|
46
|
+
if (match === null) {
|
|
47
|
+
return text;
|
|
48
|
+
}
|
|
49
|
+
const decimals = Math.min(match[1]?.length ?? 0, MAX_FRACTION_DIGITS);
|
|
50
|
+
// A string goes to Intl as it is, so it formats the exact decimal and not the nearest double.
|
|
51
|
+
return numberFormatter(fixedSpec(decimals)).format(text);
|
|
43
52
|
};
|
|
44
53
|
/* Percent as Activity Monitor writes it: a decimal under ten, where the difference still shows. */
|
|
45
|
-
export const formatPercent =
|
|
54
|
+
export const formatPercent = value => `${value < 10 ? formatDecimal(value) : formatNumber(value)}%`;
|
|
46
55
|
/*
|
|
47
56
|
* The option objects a money formatter is cached on, one per currency and precision. The cache is
|
|
48
57
|
* keyed on the object itself, so building a fresh one per call would build a fresh formatter too.
|
|
49
58
|
*/
|
|
50
59
|
const moneySpecs = new Map();
|
|
51
60
|
const moneySpec = (currency, maximumFractionDigits) => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
const key = `${currency}|${maximumFractionDigits ?? ''}`;
|
|
62
|
+
const known = moneySpecs.get(key);
|
|
63
|
+
if (known !== undefined) {
|
|
64
|
+
return known;
|
|
65
|
+
}
|
|
66
|
+
// Narrow, or a Dutch region writes a dollar amount as `US$ 5.480,96`, which is a currency lesson
|
|
67
|
+
// nobody asked for in a table of prices.
|
|
68
|
+
const spec = {
|
|
69
|
+
style: 'currency',
|
|
70
|
+
currency,
|
|
71
|
+
currencyDisplay: 'narrowSymbol',
|
|
72
|
+
...(maximumFractionDigits ? {
|
|
73
|
+
maximumFractionDigits
|
|
74
|
+
} : {})
|
|
75
|
+
};
|
|
76
|
+
moneySpecs.set(key, spec);
|
|
77
|
+
return spec;
|
|
67
78
|
};
|
|
68
79
|
/* An amount in the currency it is already in, as a bank statement would print it. */
|
|
69
80
|
export const formatMoney = (value, currency, maximumFractionDigits) => numberFormatter(moneySpec(currency, maximumFractionDigits)).format(value);
|
|
70
|
-
const SIGNIFICANT_MONEY = {
|
|
81
|
+
const SIGNIFICANT_MONEY = {
|
|
82
|
+
style: 'currency',
|
|
83
|
+
currency: 'USD',
|
|
84
|
+
currencyDisplay: 'narrowSymbol',
|
|
85
|
+
maximumSignificantDigits: 3
|
|
86
|
+
};
|
|
71
87
|
/* Dollars to three significant digits, for amounts that run from a fraction of a cent to tens of dollars in one list. */
|
|
72
|
-
export const formatUsdSignificant =
|
|
88
|
+
export const formatUsdSignificant = value => numberFormatter(SIGNIFICANT_MONEY).format(value);
|
|
73
89
|
/* `1.2M`, `412K`, `640`: a token count is read as a size, not counted. */
|
|
74
|
-
export const formatTokens =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
90
|
+
export const formatTokens = value => {
|
|
91
|
+
const rounded = Math.round(value);
|
|
92
|
+
if (rounded >= 1_000_000) {
|
|
93
|
+
return `${formatDecimal(rounded >= 10_000_000 ? Math.round(rounded / 1_000_000) : rounded / 1_000_000)}M`;
|
|
94
|
+
}
|
|
95
|
+
if (rounded >= 1_000) {
|
|
96
|
+
return `${formatDecimal(rounded >= 10_000 ? Math.round(rounded / 1_000) : rounded / 1_000)}K`;
|
|
97
|
+
}
|
|
98
|
+
return formatNumber(rounded);
|
|
83
99
|
};
|
|
84
100
|
const UNITS = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
85
101
|
/*
|
|
@@ -87,12 +103,12 @@ const UNITS = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
|
87
103
|
* a kilobyte, one decimal above that. `whole` is for a column that only has room for a round number.
|
|
88
104
|
*/
|
|
89
105
|
export const formatBytes = (bytes, whole = false) => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
};
|
|
106
|
+
let value = Math.max(0, bytes);
|
|
107
|
+
let unit = 0;
|
|
108
|
+
while (value >= 1024 && unit < UNITS.length - 1) {
|
|
109
|
+
value /= 1024;
|
|
110
|
+
unit++;
|
|
111
|
+
}
|
|
112
|
+
const decimals = unit > 0 && !whole && value < 10;
|
|
113
|
+
return `${decimals ? formatDecimal(value) : formatNumber(value)} ${UNITS[unit]}`;
|
|
114
|
+
};
|
package/dist/format/regions.js
CHANGED
|
@@ -10,6 +10,8 @@ export const FORMAT_SYSTEM = 'system';
|
|
|
10
10
|
export const FORMAT_REGIONS = ['nl-NL', 'en-US', 'en-GB', 'de-DE', 'fr-FR', 'es-ES', 'sv-SE', 'ja-JP'];
|
|
11
11
|
export const FORMAT_REGION_CHOICES = [FORMAT_LANGUAGE, FORMAT_SYSTEM, ...FORMAT_REGIONS];
|
|
12
12
|
/* The country of a region tag, named in `language`: `nl-NL` in English is "Netherlands". */
|
|
13
|
-
export const regionName = (region, language) => new Intl.DisplayNames([language], {
|
|
13
|
+
export const regionName = (region, language) => new Intl.DisplayNames([language], {
|
|
14
|
+
type: 'region'
|
|
15
|
+
}).of(region.slice(region.indexOf('-') + 1)) ?? region;
|
|
14
16
|
/* A stored region, or the language's own for anything this version does not offer. */
|
|
15
|
-
export const formatRegionFrom =
|
|
17
|
+
export const formatRegionFrom = stored => FORMAT_REGION_CHOICES.find(region => region === stored) ?? FORMAT_LANGUAGE;
|
package/dist/format/time-zone.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* The IANA time zone this machine is set to, or null when the runtime does not say. */
|
|
2
|
-
export const localTimeZone = () => Intl.DateTimeFormat().resolvedOptions().timeZone || null;
|
|
2
|
+
export const localTimeZone = () => Intl.DateTimeFormat().resolvedOptions().timeZone || null;
|
package/dist/icon-button-size.js
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
/* The size decides the square and the radius (`.icon-btn` in `theme.css`) and the icon inside: 16 in 32, 14 in 28, 12 below. */
|
|
2
|
-
export const ICON_BUTTON_CLASS = {
|
|
3
|
-
|
|
2
|
+
export const ICON_BUTTON_CLASS = {
|
|
3
|
+
md: undefined,
|
|
4
|
+
sm: 'icon-btn-sm',
|
|
5
|
+
xs: 'icon-btn-xs',
|
|
6
|
+
'2xs': 'icon-btn-2xs'
|
|
7
|
+
};
|
|
8
|
+
export const ICON_BUTTON_ICON_SIZE = {
|
|
9
|
+
md: 16,
|
|
10
|
+
sm: 14,
|
|
11
|
+
xs: 12,
|
|
12
|
+
'2xs': 12
|
|
13
|
+
};
|
package/dist/icon-picker.js
CHANGED
|
@@ -1,31 +1,40 @@
|
|
|
1
|
-
export const isGrouped =
|
|
2
|
-
export const sectionsOf =
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export const isGrouped = icons => Array.isArray(icons);
|
|
2
|
+
export const sectionsOf = icons => isGrouped(icons) ? icons.map(group => ({
|
|
3
|
+
id: group.id,
|
|
4
|
+
label: group.label,
|
|
5
|
+
icons: Object.entries(group.icons)
|
|
6
|
+
})) : [{
|
|
7
|
+
id: '',
|
|
8
|
+
label: null,
|
|
9
|
+
icons: Object.entries(icons)
|
|
10
|
+
}];
|
|
5
11
|
/* The icons whose name, keywords or group label hold the query, case-insensitive. A group without one is left out. */
|
|
6
12
|
export const filterSections = (sections, query, keywords = {}) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
const needle = query.trim().toLowerCase();
|
|
14
|
+
if (needle === '') {
|
|
15
|
+
return [...sections];
|
|
16
|
+
}
|
|
17
|
+
const holds = text => text.toLowerCase().includes(needle);
|
|
18
|
+
return sections.flatMap(section => {
|
|
19
|
+
if (section.label !== null && holds(section.label)) {
|
|
20
|
+
return [section];
|
|
10
21
|
}
|
|
11
|
-
const
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return icons.length > 0 ? [{ ...section, icons }] : [];
|
|
18
|
-
});
|
|
22
|
+
const icons = section.icons.filter(([name]) => holds(name) || (keywords[name] ?? []).some(holds));
|
|
23
|
+
return icons.length > 0 ? [{
|
|
24
|
+
...section,
|
|
25
|
+
icons
|
|
26
|
+
}] : [];
|
|
27
|
+
});
|
|
19
28
|
};
|
|
20
29
|
/* The one icon the grid's tab stop sits on: the one last focused, else the chosen one, else the first, as long as the search shows it. */
|
|
21
30
|
export const tabStopOf = (visible, focused, value) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
if (focused !== null && visible.includes(focused)) {
|
|
32
|
+
return focused;
|
|
33
|
+
}
|
|
34
|
+
if (value !== null && visible.includes(value)) {
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
return visible[0] ?? null;
|
|
29
38
|
};
|
|
30
39
|
/* Rows lie a few pixels apart at least, so a rounding difference between two cells of one row is no new row. */
|
|
31
40
|
const SAME_ROW = 2;
|
|
@@ -35,46 +44,46 @@ const SAME_ROW = 2;
|
|
|
35
44
|
* the focus stays, so the key never scrolls the grid instead.
|
|
36
45
|
*/
|
|
37
46
|
export const cellForKey = (key, boxes, from) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
const last = boxes.length - 1;
|
|
48
|
+
switch (key) {
|
|
49
|
+
case 'ArrowRight':
|
|
50
|
+
return Math.min(from + 1, last);
|
|
51
|
+
case 'ArrowLeft':
|
|
52
|
+
return Math.max(from - 1, 0);
|
|
53
|
+
case 'Home':
|
|
54
|
+
return 0;
|
|
55
|
+
case 'End':
|
|
56
|
+
return last;
|
|
57
|
+
case 'ArrowDown':
|
|
58
|
+
case 'ArrowUp':
|
|
59
|
+
break;
|
|
60
|
+
default:
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
const current = boxes[from];
|
|
64
|
+
if (current === undefined) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
const down = key === 'ArrowDown';
|
|
68
|
+
const tops = boxes.map(box => box.top).filter(top => down ? top > current.top + SAME_ROW : top < current.top - SAME_ROW);
|
|
69
|
+
if (tops.length === 0) {
|
|
70
|
+
return from;
|
|
71
|
+
}
|
|
72
|
+
const row = down ? Math.min(...tops) : Math.max(...tops);
|
|
73
|
+
const center = current.left + current.width / 2;
|
|
74
|
+
let nearest = from;
|
|
75
|
+
let distance = Number.POSITIVE_INFINITY;
|
|
76
|
+
boxes.forEach((box, index) => {
|
|
77
|
+
if (Math.abs(box.top - row) > SAME_ROW) {
|
|
78
|
+
return;
|
|
57
79
|
}
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
80
|
+
const gap = Math.abs(box.left + box.width / 2 - center);
|
|
81
|
+
if (gap < distance) {
|
|
82
|
+
nearest = index;
|
|
83
|
+
distance = gap;
|
|
62
84
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
let nearest = from;
|
|
66
|
-
let distance = Number.POSITIVE_INFINITY;
|
|
67
|
-
boxes.forEach((box, index) => {
|
|
68
|
-
if (Math.abs(box.top - row) > SAME_ROW) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
const gap = Math.abs(box.left + box.width / 2 - center);
|
|
72
|
-
if (gap < distance) {
|
|
73
|
-
nearest = index;
|
|
74
|
-
distance = gap;
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
return nearest;
|
|
85
|
+
});
|
|
86
|
+
return nearest;
|
|
78
87
|
};
|
|
79
88
|
/* Escape empties a search that holds text and goes no further; on an empty one it is left to whatever else hears it, such as a dialog. */
|
|
80
|
-
export const escapeClearsSearch = (key, query) => key === 'Escape' && query !== '';
|
|
89
|
+
export const escapeClearsSearch = (key, query) => key === 'Escape' && query !== '';
|
package/dist/index.js
CHANGED
|
@@ -11,62 +11,62 @@ export * as Menu from './menu/index.parts.js';
|
|
|
11
11
|
export * as Popover from './popover/index.parts.js';
|
|
12
12
|
export * as PreviewCard from './preview-card/index.parts.js';
|
|
13
13
|
export * as Tabs from './tabs/index.parts.js';
|
|
14
|
-
export { AccentSwatches } from
|
|
15
|
-
export { Banner } from
|
|
16
|
-
export { Button } from
|
|
17
|
-
export { ButtonGroup } from
|
|
18
|
-
export { Checkbox } from
|
|
19
|
-
export { ChoiceCards } from
|
|
20
|
-
export { CloseButton } from
|
|
21
|
-
export { ColorSwatch } from
|
|
22
|
-
export { ColorWheelPicker } from
|
|
23
|
-
export { ColumnResizeHandle } from
|
|
24
|
-
export { DisabledReason } from
|
|
25
|
-
export { DockShell } from
|
|
26
|
-
export { EmptyState } from
|
|
27
|
-
export { ErrorBoundary } from
|
|
28
|
-
export { Field, FieldHint, FormError } from
|
|
29
|
-
export { FileIcon } from
|
|
30
|
-
export { Icon } from
|
|
31
|
-
export { IconButton } from
|
|
32
|
-
export { IconPicker } from
|
|
33
|
-
export { Input, TextArea } from
|
|
34
|
-
export { Kbd, KeyCap, Keys } from
|
|
35
|
-
export { ListRow } from
|
|
36
|
-
export { Meter } from
|
|
37
|
-
export { MiddleTruncate } from
|
|
38
|
-
export { PanelEmpty } from
|
|
39
|
-
export { PanelHeader } from
|
|
40
|
-
export { Pill } from
|
|
41
|
-
export { PromptDialog } from
|
|
42
|
-
export { ProjectSwitcher, ProjectSwitcherGroups } from
|
|
43
|
-
export { SectionLabel } from
|
|
44
|
-
export { SegmentBar } from
|
|
45
|
-
export { Segmented } from
|
|
46
|
-
export { Select } from
|
|
47
|
-
export { Separator } from
|
|
48
|
-
export { ShortcutHints } from
|
|
49
|
-
export { Skeleton } from
|
|
50
|
-
export { Slider } from
|
|
51
|
-
export { SlidingColumn } from
|
|
52
|
-
export { Spinner } from
|
|
53
|
-
export { Stepper } from
|
|
54
|
-
export { Surface } from
|
|
55
|
-
export { Switch } from
|
|
56
|
-
export { TextMenu } from
|
|
57
|
-
export { Tile } from
|
|
58
|
-
export { Toasts } from
|
|
59
|
-
export { Tooltip } from
|
|
60
|
-
export { UIProvider } from
|
|
61
|
-
export { Waveform } from
|
|
62
|
-
export { Wipe } from
|
|
63
|
-
export { ZoomControls } from
|
|
14
|
+
export { AccentSwatches } from "./AccentSwatches.js";
|
|
15
|
+
export { Banner } from "./Banner.js";
|
|
16
|
+
export { Button } from "./Button.js";
|
|
17
|
+
export { ButtonGroup } from "./ButtonGroup.js";
|
|
18
|
+
export { Checkbox } from "./Checkbox.js";
|
|
19
|
+
export { ChoiceCards } from "./ChoiceCards.js";
|
|
20
|
+
export { CloseButton } from "./CloseButton.js";
|
|
21
|
+
export { ColorSwatch } from "./ColorSwatch.js";
|
|
22
|
+
export { ColorWheelPicker } from "./ColorWheelPicker.js";
|
|
23
|
+
export { ColumnResizeHandle } from "./ColumnResizeHandle.js";
|
|
24
|
+
export { DisabledReason } from "./DisabledReason.js";
|
|
25
|
+
export { DockShell } from "./DockShell.js";
|
|
26
|
+
export { EmptyState } from "./EmptyState.js";
|
|
27
|
+
export { ErrorBoundary } from "./ErrorBoundary.js";
|
|
28
|
+
export { Field, FieldHint, FormError } from "./Field.js";
|
|
29
|
+
export { FileIcon } from "./FileIcon.js";
|
|
30
|
+
export { Icon } from "./Icon.js";
|
|
31
|
+
export { IconButton } from "./IconButton.js";
|
|
32
|
+
export { IconPicker } from "./IconPicker.js";
|
|
33
|
+
export { Input, TextArea } from "./Input.js";
|
|
34
|
+
export { Kbd, KeyCap, Keys } from "./Kbd.js";
|
|
35
|
+
export { ListRow } from "./ListRow.js";
|
|
36
|
+
export { Meter } from "./Meter.js";
|
|
37
|
+
export { MiddleTruncate } from "./MiddleTruncate.js";
|
|
38
|
+
export { PanelEmpty } from "./PanelEmpty.js";
|
|
39
|
+
export { PanelHeader } from "./PanelHeader.js";
|
|
40
|
+
export { Pill } from "./Pill.js";
|
|
41
|
+
export { PromptDialog } from "./PromptDialog.js";
|
|
42
|
+
export { ProjectSwitcher, ProjectSwitcherGroups } from "./ProjectSwitcher.js";
|
|
43
|
+
export { SectionLabel } from "./SectionLabel.js";
|
|
44
|
+
export { SegmentBar } from "./SegmentBar.js";
|
|
45
|
+
export { Segmented } from "./Segmented.js";
|
|
46
|
+
export { Select } from "./Select.js";
|
|
47
|
+
export { Separator } from "./Separator.js";
|
|
48
|
+
export { ShortcutHints } from "./ShortcutHints.js";
|
|
49
|
+
export { Skeleton } from "./Skeleton.js";
|
|
50
|
+
export { Slider } from "./Slider.js";
|
|
51
|
+
export { SlidingColumn } from "./SlidingColumn.js";
|
|
52
|
+
export { Spinner } from "./Spinner.js";
|
|
53
|
+
export { Stepper } from "./Stepper.js";
|
|
54
|
+
export { Surface } from "./Surface.js";
|
|
55
|
+
export { Switch } from "./Switch.js";
|
|
56
|
+
export { TextMenu } from "./TextMenu.js";
|
|
57
|
+
export { Tile } from "./Tile.js";
|
|
58
|
+
export { Toasts } from "./Toasts.js";
|
|
59
|
+
export { Tooltip } from "./Tooltip.js";
|
|
60
|
+
export { UIProvider } from "./UIProvider.js";
|
|
61
|
+
export { Waveform } from "./Waveform.js";
|
|
62
|
+
export { Wipe } from "./Wipe.js";
|
|
63
|
+
export { ZoomControls } from "./ZoomControls.js";
|
|
64
64
|
export { copyText, readClipboardText } from './clipboard.js';
|
|
65
65
|
export { messageOf } from './error-message.js';
|
|
66
66
|
export { FILE_TREE_ICONS } from './file-icon.js';
|
|
67
67
|
export { cameThroughPortal, isInFloatingLayer } from './floating.js';
|
|
68
|
-
export { LoadedComponent, lazyDialog, lazyNamed, onLazyOpenError } from
|
|
69
|
-
export { LazyBoundary } from
|
|
68
|
+
export { LoadedComponent, lazyDialog, lazyNamed, onLazyOpenError } from "./lazy.js";
|
|
69
|
+
export { LazyBoundary } from "./LazyBoundary.js";
|
|
70
70
|
export { UI_NAMESPACE, UI_RESOURCES } from './locales.js';
|
|
71
71
|
export { isApplePlatform } from './platform.js';
|
|
72
72
|
export { prefetcher } from './prefetch.js';
|
|
@@ -79,10 +79,10 @@ export { useContentSize } from './useContentSize.js';
|
|
|
79
79
|
export { useMeasuredWidth } from './useMeasuredWidth.js';
|
|
80
80
|
export { useNow, useTickingText } from './useNow.js';
|
|
81
81
|
export { useFileTree } from './file-tree/use-file-tree.js';
|
|
82
|
-
export { Workspace } from
|
|
83
|
-
export { DocumentTab, TabStrip } from
|
|
84
|
-
export { SplitView } from
|
|
85
|
-
export { DropPreview } from
|
|
82
|
+
export { Workspace } from "./workspace/Workspace.js";
|
|
83
|
+
export { DocumentTab, TabStrip } from "./workspace/TabStrip.js";
|
|
84
|
+
export { SplitView } from "./workspace/SplitView.js";
|
|
85
|
+
export { DropPreview } from "./workspace/DropPreview.js";
|
|
86
86
|
export { rectDropPreview, sameDropPreview, tabDropPreview } from './workspace/preview.js';
|
|
87
87
|
export { createSplitLayout, updateSplitLayout, splitPanes } from './workspace/model.js';
|
|
88
|
-
export { tabGapAt } from './workspace/geometry.js';
|
|
88
|
+
export { tabGapAt } from './workspace/geometry.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { KeyValueListItem as Item, KeyValueListName as Name, KeyValueListRoot as Root, KeyValueListValue as Value } from
|
|
1
|
+
export { KeyValueListItem as Item, KeyValueListName as Name, KeyValueListRoot as Root, KeyValueListValue as Value } from "./parts.js";
|