phonux 0.2.0-rc.8 → 0.2.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/ColumnDivider.d.ts +30 -0
- package/ColumnDivider.js +65 -0
- package/DESIGN.md +239 -53
- package/LICENSE +344 -30
- package/Panel.js +2 -1
- package/PanelFrame.js +8 -4
- package/PanelLoader.js +10 -3
- package/PanelRow.d.ts +2 -0
- package/PanelRow.js +87 -50
- package/PanelRowSlot.js +11 -6
- package/README.md +138 -21
- package/THIRD_PARTY_NOTICES.md +236 -4
- package/Workspace.js +2 -2
- package/WorkspaceColumn.d.ts +6 -0
- package/WorkspaceColumn.js +186 -26
- package/arrowDirection.d.ts +8 -0
- package/arrowDirection.js +19 -0
- package/arrowKeys.js +1 -1
- package/autoMount.js +1 -1
- package/chromeBand.d.ts +10 -0
- package/chromeBand.js +13 -0
- package/cli/plan.d.ts +5 -1
- package/cli/plan.js +19 -5
- package/cli/runner.d.ts +1 -1
- package/cli/runner.js +51 -11
- package/columnHandle.d.ts +135 -5
- package/columnHandle.js +292 -26
- package/columnMotion.d.ts +57 -0
- package/columnMotion.js +212 -0
- package/columnSplit.d.ts +69 -0
- package/columnSplit.js +156 -0
- package/columnTabOrder.d.ts +25 -0
- package/columnTabOrder.js +76 -0
- package/defaultTheme.js +10 -1
- package/devMode.d.ts +6 -0
- package/devMode.js +13 -0
- package/docs/audits/0.2.0.md +72 -0
- package/dragToClose.d.ts +9 -1
- package/dragToClose.js +48 -7
- package/emblaDots.d.ts +2 -0
- package/emblaDots.js +31 -3
- package/emblaRow.d.ts +15 -49
- package/emblaRow.js +107 -271
- package/hostPanels.d.ts +1 -1
- package/hostPanels.js +3 -2
- package/index.d.ts +8 -3
- package/index.js +2 -0
- package/labels.d.ts +199 -9
- package/labels.js +111 -6
- package/offerCard.d.ts +13 -6
- package/offerCard.js +11 -6
- package/package.json +5 -2
- package/panelApiLevel.js +3 -2
- package/panelCloseFocus.d.ts +2 -0
- package/panelCloseFocus.js +31 -0
- package/panelConfigure.js +5 -0
- package/panelFooter.d.ts +1 -1
- package/panelFooter.js +3 -2
- package/panelHeaderButtons.js +3 -1
- package/panelIds.d.ts +1 -1
- package/panelIds.js +3 -2
- package/panelLevelChecks.js +2 -2
- package/panelRowTabOrder.d.ts +4 -0
- package/panelRowTabOrder.js +58 -12
- package/panelSettings.d.ts +35 -4
- package/panelSettings.js +67 -13
- package/panelSizeControl.js +11 -3
- package/panelSlotContext.d.ts +2 -0
- package/panelSlotContext.js +2 -0
- package/panelViewBoundary.d.ts +26 -0
- package/panelViewBoundary.js +33 -0
- package/panels/usePanelClosing.d.ts +2 -0
- package/panels/usePanelClosing.js +26 -3
- package/panels/useProvidePanels.d.ts +9 -2
- package/panels/useProvidePanels.js +8 -4
- package/panels/useWorkspacePersistence.js +15 -4
- package/phoneModels.d.ts +2 -3
- package/phoneModels.js +4 -3
- package/qrCode.d.ts +19 -0
- package/qrCode.js +35 -0
- package/rowBar.d.ts +5 -0
- package/rowBar.js +9 -15
- package/rowDom.d.ts +6 -0
- package/rowDom.js +6 -0
- package/rowDraw.d.ts +2 -2
- package/rowDraw.js +3 -10
- package/rowFloor.d.ts +8 -0
- package/rowFloor.js +8 -0
- package/rowNumbers.d.ts +77 -24
- package/rowNumbers.js +82 -100
- package/rowRecentre.d.ts +32 -0
- package/rowRecentre.js +57 -0
- package/rowShrink.d.ts +32 -0
- package/rowShrink.js +51 -0
- package/rowStep.d.ts +9 -0
- package/rowStep.js +29 -8
- package/rowWheelSteps.d.ts +43 -0
- package/rowWheelSteps.js +67 -0
- package/settingsPatch.js +22 -7
- package/shareParts.d.ts +54 -0
- package/shareParts.js +42 -4
- package/shareSafety.d.ts +19 -0
- package/shareSafety.js +40 -0
- package/shareSheet.d.ts +71 -8
- package/shareSheet.js +91 -7
- package/sharedList.d.ts +8 -3
- package/sharedList.js +3 -3
- package/slotMover.d.ts +1 -1
- package/slotMover.js +3 -5
- package/templateView.js +2 -1
- package/trustScreen.d.ts +70 -0
- package/trustScreen.js +261 -0
- package/undoCloseToast.d.ts +2 -1
- package/undoCloseToast.js +19 -2
- package/usePanelDots.d.ts +13 -4
- package/usePanelDots.js +4 -16
- package/workspaceCore.js +2 -1
- package/workspaceState.d.ts +5 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The divider between two spaces a column shows side by side: a focusable slider that moves by whole slots, by pointer or by key.
|
|
3
|
+
* DESIGN.md, "Side by side".
|
|
4
|
+
*/
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import type { WorkspaceColumnHandle } from './columnHandle.js';
|
|
7
|
+
import type { PhonuxLabels } from './labels.js';
|
|
8
|
+
/** What a divider needs to draw and to move. @internal */
|
|
9
|
+
export interface ColumnDividerProps {
|
|
10
|
+
column: WorkspaceColumnHandle;
|
|
11
|
+
/** Evens the split out; the column's own, which knows each cell's sticky slots. */
|
|
12
|
+
evenSplit: () => void;
|
|
13
|
+
/** The row slots of every cell the window shows, left to right. */
|
|
14
|
+
rows: readonly number[];
|
|
15
|
+
/** The index of the cell on this divider's left. */
|
|
16
|
+
at: number;
|
|
17
|
+
/** The id of the cell it resizes, the one on its left, whose row panels `aria-valuenow` counts. */
|
|
18
|
+
controls: string;
|
|
19
|
+
/** The names of the two spaces it parts. */
|
|
20
|
+
names: readonly [string, string];
|
|
21
|
+
/** The least row slots a side keeps. */
|
|
22
|
+
least: number;
|
|
23
|
+
/** One phone plus one gap, in px: the distance a slot moves the divider. */
|
|
24
|
+
pitch: number;
|
|
25
|
+
/** Where the divider's centre sits, as a CSS length from the column's left edge. */
|
|
26
|
+
center: string;
|
|
27
|
+
labels: PhonuxLabels;
|
|
28
|
+
}
|
|
29
|
+
/** The divider. Pointer: a press and drag moves it a slot at a time; keys: Left and Right move it one slot, Home and End to the minimums; a double click evens the split. @internal */
|
|
30
|
+
export declare function ColumnDivider({ column, evenSplit, rows, at, controls, names, least, pitch, center, labels }: ColumnDividerProps): React.ReactElement;
|
package/ColumnDivider.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The divider between two spaces a column shows side by side: a focusable slider that moves by whole slots, by pointer or by key.
|
|
4
|
+
* DESIGN.md, "Side by side".
|
|
5
|
+
*/
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import Box from '@mui/material/Box';
|
|
8
|
+
import { dividerRange, shiftDivider } from './columnSplit.js';
|
|
9
|
+
/** The width of the strip that takes the pointer, in px, centered on the gap between the two cells. */
|
|
10
|
+
const HIT_PX = 24;
|
|
11
|
+
const LINE_PX = 2;
|
|
12
|
+
/** The divider. Pointer: a press and drag moves it a slot at a time; keys: Left and Right move it one slot, Home and End to the minimums; a double click evens the split. @internal */
|
|
13
|
+
export function ColumnDivider({ column, evenSplit, rows, at, controls, names, least, pitch, center, labels }) {
|
|
14
|
+
const range = dividerRange(rows, at, least);
|
|
15
|
+
const drag = React.useRef(null);
|
|
16
|
+
const [dragging, setDragging] = React.useState(false);
|
|
17
|
+
const move = (next) => {
|
|
18
|
+
if (next.some((r, k) => r !== rows[k]))
|
|
19
|
+
column.setSplit(next);
|
|
20
|
+
};
|
|
21
|
+
return (_jsx(Box, { role: "separator", "aria-orientation": "vertical", "aria-label": labels.splitDivider(names[0], names[1]), "aria-controls": controls, "aria-valuemin": range.min, "aria-valuemax": range.max, "aria-valuenow": rows[at], "aria-valuetext": labels.splitValue(names[0], rows[at], names[1], rows[at + 1]),
|
|
22
|
+
// Focusable, and reached by Tab only through the column's steering: the dividers follow every cell in the DOM, where the
|
|
23
|
+
// browser's own step out of the last space would land on them.
|
|
24
|
+
tabIndex: -1, "data-column-divider": at, "data-column-divider-dragging": dragging ? '' : undefined, onPointerDown: (e) => {
|
|
25
|
+
if (e.button !== 0)
|
|
26
|
+
return;
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
e.currentTarget.focus({ preventScroll: true });
|
|
29
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
30
|
+
drag.current = { x: e.clientX, rows };
|
|
31
|
+
setDragging(true);
|
|
32
|
+
}, onPointerMove: (e) => {
|
|
33
|
+
const start = drag.current;
|
|
34
|
+
if (start === null)
|
|
35
|
+
return;
|
|
36
|
+
move(shiftDivider(start.rows, at, Math.round((e.clientX - start.x) / pitch), least));
|
|
37
|
+
}, onPointerUp: () => {
|
|
38
|
+
drag.current = null;
|
|
39
|
+
setDragging(false);
|
|
40
|
+
}, onPointerCancel: () => {
|
|
41
|
+
drag.current = null;
|
|
42
|
+
setDragging(false);
|
|
43
|
+
}, onKeyDown: (e) => {
|
|
44
|
+
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)
|
|
45
|
+
return;
|
|
46
|
+
const to = e.key === 'ArrowLeft' ? rows[at] - 1 : e.key === 'ArrowRight' ? rows[at] + 1 : e.key === 'Home' ? range.min : e.key === 'End' ? range.max : undefined;
|
|
47
|
+
if (to === undefined)
|
|
48
|
+
return;
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
move(shiftDivider(rows, at, to - rows[at], least));
|
|
51
|
+
}, onDoubleClick: () => evenSplit(), sx: {
|
|
52
|
+
position: 'absolute',
|
|
53
|
+
top: 0,
|
|
54
|
+
bottom: 0,
|
|
55
|
+
left: `calc(${center} - ${HIT_PX / 2}px)`,
|
|
56
|
+
width: HIT_PX,
|
|
57
|
+
zIndex: 5,
|
|
58
|
+
cursor: 'col-resize',
|
|
59
|
+
touchAction: 'none',
|
|
60
|
+
outline: 'none',
|
|
61
|
+
'& [data-column-divider-line]': { position: 'absolute', top: 0, bottom: 0, left: (HIT_PX - LINE_PX) / 2, width: LINE_PX, borderRadius: `${LINE_PX}px`, background: 'currentColor', opacity: dragging ? 0.8 : 0.5, pointerEvents: 'none' },
|
|
62
|
+
'&:hover [data-column-divider-line]': { opacity: 0.7 },
|
|
63
|
+
'&:focus-visible [data-column-divider-line]': { opacity: 1, background: 'var(--phonux-primary, currentColor)' },
|
|
64
|
+
}, children: _jsx("div", { "aria-hidden": true, "data-column-divider-line": "" }) }));
|
|
65
|
+
}
|