@crewlethq/ui 0.131.0 → 0.131.2
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/AppShell/AppShell.d.ts +47 -196
- package/dist/AppShell/index.js +2 -2
- package/dist/{AppShell-N5IHITJM.css → AppShell-RPILZZW5.css} +109 -431
- package/dist/ArtifactBar/index.js +4 -4
- package/dist/ArtifactCard/ArtifactCard.d.ts +13 -39
- package/dist/ArtifactCard/index.js +1 -1
- package/dist/{ArtifactCard-ZH6KCD5O.css → ArtifactCard-PWMC7RAY.css} +15 -49
- package/dist/ArtifactMakeRow/ArtifactMakeRow.d.ts +3 -16
- package/dist/AvatarPicker/index.js +5 -5
- package/dist/BrandSample/index.js +1 -1
- package/dist/{BrandSample-3OSKZAGG.css → BrandSample-WSBT7FQ5.css} +5 -25
- package/dist/Breadcrumb/Breadcrumb.d.ts +5 -41
- package/dist/Breadcrumb/index.js +1 -1
- package/dist/{Breadcrumb-MQJWJVN3.css → Breadcrumb-JDBQXPR5.css} +12 -58
- package/dist/Canvas/Canvas.d.ts +52 -228
- package/dist/Canvas/geometry.d.ts +31 -139
- package/dist/Canvas/index.js +1 -1
- package/dist/CanvasBoard/index.js +3 -3
- package/dist/CanvasToolbar/index.js +2 -2
- package/dist/CodeBlock/index.js +1 -1
- package/dist/ColorSwatch/index.js +2 -2
- package/dist/CommentThread/CommentThread.d.ts +3 -21
- package/dist/CommentThread/index.js +1 -1
- package/dist/{CommentThread-544KCZT7.css → CommentThread-YU6VSVS4.css} +2 -4
- package/dist/Composer/Composer.d.ts +17 -54
- package/dist/ConfirmField/index.js +2 -2
- package/dist/ContrastBadge/index.js +2 -2
- package/dist/ContrastHelp/index.js +3 -3
- package/dist/Copyable/Copyable.d.ts +2 -11
- package/dist/Copyable/index.js +1 -1
- package/dist/{Copyable-XMLKKJDT.css → Copyable-U3UJL3BP.css} +9 -32
- package/dist/DataGrid/DataGrid.d.ts +46 -136
- package/dist/DataGrid/index.js +1 -1
- package/dist/DataTable/index.js +2 -2
- package/dist/DataView/index.js +3 -3
- package/dist/DocTabsEditor/index.js +2 -2
- package/dist/{Editor-MEPTWBY5.js → Editor-HDHT5BX2.js} +2 -2
- package/dist/GraphCanvas/GraphCanvas.d.ts +22 -79
- package/dist/GraphCanvas/index.js +2 -2
- package/dist/GraphCanvas/layout.d.ts +10 -35
- package/dist/HuePicker/index.js +4 -4
- package/dist/InlineCode/InlineCode.d.ts +7 -28
- package/dist/InlineCode/index.js +1 -1
- package/dist/InlineCode-3KJCBT5I.css +80 -0
- package/dist/Link/Link.d.ts +3 -25
- package/dist/Link/index.js +1 -1
- package/dist/{Link-Y7RHTR6F.css → Link-7AADYG2F.css} +12 -35
- package/dist/LinkInterstitial/index.js +2 -2
- package/dist/LogoSlot/index.js +3 -3
- package/dist/MarkdownEditor/index.js +4 -4
- package/dist/MentionMenu/MentionMenu.d.ts +9 -31
- package/dist/Menu/Menu.d.ts +9 -91
- package/dist/Menu/index.js +1 -1
- package/dist/MergeConflicts/index.js +4 -4
- package/dist/ObjectHeader/index.js +2 -2
- package/dist/OrgTable/index.js +3 -3
- package/dist/PresenterView/index.js +2 -2
- package/dist/PropertyList/index.js +3 -3
- package/dist/RailList/index.js +3 -3
- package/dist/RichEditor/index.js +1 -1
- package/dist/SearchTrigger/SearchTrigger.d.ts +8 -36
- package/dist/SearchTrigger/index.js +1 -1
- package/dist/{SearchTrigger-MME7NIHX.css → SearchTrigger-3HO7D6NP.css} +5 -17
- package/dist/SegmentedControl/index.js +3 -3
- package/dist/Select/Select.d.ts +6 -0
- package/dist/Select/index.js +1 -1
- package/dist/{Select-AF5YMSC6.css → Select-2FAOIL73.css} +64 -6
- package/dist/ShareDialog/index.js +3 -3
- package/dist/SheetColumnEditor/index.js +6 -6
- package/dist/SheetGrid/index.js +2 -2
- package/dist/SlideFilmstrip/index.js +2 -2
- package/dist/TableCells/index.js +2 -2
- package/dist/Tabs/index.js +2 -2
- package/dist/ThemeSwitcher/index.js +4 -4
- package/dist/TimeRangePicker/index.js +4 -4
- package/dist/TimeWindowPicker/index.js +2 -2
- package/dist/TreeCanvas/TreeCanvas.d.ts +50 -248
- package/dist/TreeCanvas/index.js +2 -2
- package/dist/TreeGrid/index.js +2 -2
- package/dist/ValueField/index.js +2 -2
- package/dist/VersionCompare/index.js +4 -4
- package/dist/{chunk-O43SIR3W.js → chunk-3QQ3QHQR.js} +1 -1
- package/dist/{chunk-MZV45HQB.js → chunk-3T6URIXM.js} +1 -1
- package/dist/{chunk-H2QSDZTX.js → chunk-3ZURIGQ7.js} +1 -1
- package/dist/{chunk-KQFOPY2P.js → chunk-4H577HEE.js} +1 -1
- package/dist/{chunk-3WSDAVE6.js → chunk-5PAABHF7.js} +1 -1
- package/dist/{chunk-3DAIOPAV.js → chunk-63NULHGF.js} +1 -1
- package/dist/{chunk-NFA7CSCD.js → chunk-6BMPVSUB.js} +1 -1
- package/dist/{chunk-GQPKDPMS.js → chunk-6W5D4A3V.js} +1 -1
- package/dist/{chunk-WZ5TDJ2K.js → chunk-7GFLKLCG.js} +1 -1
- package/dist/{chunk-JY6WSDUG.js → chunk-AIQHJ2HF.js} +1 -1
- package/dist/{chunk-M32NBSS7.js → chunk-B2RTWEZZ.js} +4 -6
- package/dist/{chunk-3P24SMTI.js → chunk-B5MCTPXL.js} +1 -1
- package/dist/{chunk-V2FD4RPS.js → chunk-BGPHGCDT.js} +1 -1
- package/dist/{chunk-QNDXLHBO.js → chunk-CN2EDXAW.js} +1 -1
- package/dist/{chunk-NLGRDKCK.js → chunk-EPH5EPKN.js} +2 -2
- package/dist/{chunk-AKCIF6XN.js → chunk-FEJVDORA.js} +1 -1
- package/dist/{chunk-PFTUWDZN.js → chunk-FIH5EMJF.js} +1 -1
- package/dist/{chunk-OWYIRWEX.js → chunk-FMRRKLNX.js} +1 -1
- package/dist/{chunk-QM2QFKIA.js → chunk-FVXNR63H.js} +2 -2
- package/dist/{chunk-2AKVGQ73.js → chunk-GDBROEQ5.js} +1 -1
- package/dist/{chunk-NMBGVHGQ.js → chunk-GSLN7WL2.js} +2 -2
- package/dist/{chunk-KMIS2R67.js → chunk-HJAX4356.js} +1 -1
- package/dist/{chunk-WLCPN22T.js → chunk-HKYLPYVF.js} +1 -1
- package/dist/{chunk-Q4JX6UO7.js → chunk-HMEFWPAA.js} +3 -7
- package/dist/{chunk-OVFB63RZ.js → chunk-JANUABBT.js} +3 -5
- package/dist/{chunk-AIYSPVVZ.js → chunk-JDRBZYIA.js} +1 -1
- package/dist/{chunk-7FSIBX4S.js → chunk-JG66SXCX.js} +1 -1
- package/dist/{chunk-SIL5WE55.js → chunk-LPQF7Z44.js} +1 -1
- package/dist/{chunk-D2KJ5GQC.js → chunk-N2DCSSYC.js} +2 -2
- package/dist/{chunk-2TZNTPF5.js → chunk-NDWXVEY6.js} +2 -4
- package/dist/{chunk-4Q7AWZ6O.js → chunk-OIC6S5ES.js} +1 -1
- package/dist/{chunk-6ZFQ6TAM.js → chunk-OU22GKZK.js} +32 -18
- package/dist/{chunk-QFE6T6GW.js → chunk-P4QAS5TS.js} +1 -1
- package/dist/{chunk-JKFA2F7J.js → chunk-R4YUMULC.js} +1 -1
- package/dist/{chunk-E3AFQTWT.js → chunk-SRPV3EAJ.js} +1 -1
- package/dist/{chunk-QDXSBVZR.js → chunk-TBNA64RD.js} +2 -2
- package/dist/{chunk-K5WTII2H.js → chunk-U67UM3VS.js} +1 -1
- package/dist/{chunk-RMGPZQVJ.js → chunk-UTKI2SAM.js} +1 -1
- package/dist/{chunk-KUECTV2P.js → chunk-W443OSWT.js} +1 -1
- package/dist/{chunk-XHNV272L.js → chunk-W4UJWFCZ.js} +1 -1
- package/dist/{chunk-EGHOU7U2.js → chunk-WGAEHKGW.js} +5 -12
- package/dist/{chunk-MNACKUBB.js → chunk-WIGJ4J5U.js} +3 -3
- package/dist/{chunk-32QLSXKL.js → chunk-WWCQDCH5.js} +1 -1
- package/dist/{chunk-3DGNF2EH.js → chunk-XGZXKG53.js} +2 -2
- package/dist/{chunk-MNVIIZQP.js → chunk-YADYQHHW.js} +2 -5
- package/dist/{chunk-Y7FPSBCN.js → chunk-YBOGOTYV.js} +1 -1
- package/dist/{chunk-ECOWCJHQ.js → chunk-YTDZY3PY.js} +1 -1
- package/dist/{chunk-6POROC4M.js → chunk-ZO3MXMAC.js} +1 -1
- package/dist/generated/index.js +78 -78
- package/dist/index.js +78 -78
- package/dist/styles.css +253 -703
- package/dist/utils/pathBreaks.d.ts +3 -8
- package/package.json +3 -3
- package/dist/InlineCode-BEYQFJQT.css +0 -106
- package/dist/{chunk-HERJFKPF.js → chunk-AF3F35DQ.js} +1 -1
- package/dist/{chunk-3YOLD7WG.js → chunk-F7NHMBGJ.js} +1 -1
package/dist/Canvas/Canvas.d.ts
CHANGED
|
@@ -1,84 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* the page's own scroller is the wrong instrument for it: an application shell
|
|
6
|
-
* usually has exactly one element allowed to scroll, and a chart that scrolled
|
|
7
|
-
* it sideways would fight the router's scroll memory and every other screen's
|
|
8
|
-
* layout. So the chart lives in its own viewport, the geometry of moving
|
|
9
|
-
* around it is `geometry.ts`, and this component is the wiring from pointers,
|
|
10
|
-
* wheels and keys to that geometry.
|
|
11
|
-
*
|
|
12
|
-
* THE RULES IT KEEPS.
|
|
13
|
-
*
|
|
14
|
-
* - IT FILLS THE HEIGHT ITS CONTAINER GIVES IT and never grows the page. A
|
|
15
|
-
* screen that wants a full height canvas gives it a full height box.
|
|
16
|
-
* - THE PAGE STILL SCROLLS. A plain wheel pans the canvas only while focus is
|
|
17
|
-
* inside it; otherwise the wheel belongs to the page, so a reader scrolling
|
|
18
|
-
* down is never caught by a chart passing under the pointer. Ctrl or Command
|
|
19
|
-
* with the wheel zooms toward the cursor wherever the pointer is, which is
|
|
20
|
-
* also what a trackpad pinch sends.
|
|
21
|
-
* - TOUCH IS OPT IN. Until the canvas is tapped, one finger scrolls the page
|
|
22
|
-
* (`touch-action: pan-y`); a tap activates it, one finger then pans, and a
|
|
23
|
-
* visible Done control hands the finger back to the page. Two fingers pinch
|
|
24
|
-
* toward their midpoint at any time, because two fingers are never a scroll.
|
|
25
|
-
* - THE ZOOM KEYS ARE THE CANVAS'S, WHEREVER FOCUS IS INSIDE IT: `+`, `-` and
|
|
26
|
-
* `0` (and Ctrl or Command with `=`, `-` and `0`) work on an item as well as
|
|
27
|
-
* on the viewport, because the tab stop a chart hands out is an ITEM and a
|
|
28
|
-
* reader who has navigated the content is exactly the reader who wants to
|
|
29
|
-
* zoom it. They are in no other keyboard pattern here, so there is nothing
|
|
30
|
-
* for them to collide with. The PAN keys are the viewport's own: the arrows
|
|
31
|
-
* belong to whatever holds focus, so a tree's navigation and a listbox's
|
|
32
|
-
* selection are never eaten. A text field inside keeps every key it is sent.
|
|
33
|
-
* - HOW FAR IT ZOOMS IS THE CONTENT'S ANSWER: out as far as the fit, because
|
|
34
|
-
* there is nothing beyond the whole chart to see, and in until the largest
|
|
35
|
-
* item fills the pane, because that is what a reader pressing Zoom in is
|
|
36
|
-
* asking for. See `zoomLimits`.
|
|
37
|
-
* - THE ZOOM SAYS WHAT IT IS, between the two steppers, and a reader can type
|
|
38
|
-
* one. A zoom has a value as well as a direction, and two chevrons say only
|
|
39
|
-
* the direction: without the readout, getting back to actual size from a
|
|
40
|
-
* stray pinch is pressing a chevron until it looks right. What is typed goes
|
|
41
|
-
* through the same clamp as every other zoom.
|
|
42
|
-
* - A FOCUSED ITEM IS NEVER SCROLLED INTO VIEW BEHIND THE TRANSFORM'S BACK.
|
|
43
|
-
* The viewport clips rather than scrolls, but a browser still scrolls a
|
|
44
|
-
* clipping box to show a focused descendant; that scroll is converted into a
|
|
45
|
-
* pan and reset, so the transform stays the one source of truth.
|
|
46
|
-
* - ITS CHROME IS ONE GROUP IN ONE CORNER: the zoom bar, whatever the caller
|
|
47
|
-
* adds to the end of it, and whatever bars it stacks under it. Everything in
|
|
48
|
-
* that group acts on the canvas, so it is drawn beside the canvas rather
|
|
49
|
-
* than in the page's own toolbar.
|
|
50
|
-
* - ITS OVERLAY IS A LayerHost. The untransformed layer over the viewport is
|
|
51
|
-
* the portal target for every menu, popover and picker opened from an item
|
|
52
|
-
* inside, so each is placed from its anchor's viewport rectangle rather than
|
|
53
|
-
* scaled by the zoom or clipped inside a card. The host receives
|
|
54
|
-
* `LAYER_REPOSITION_EVENT` whenever the content moves beneath it, which is
|
|
55
|
-
* how an open surface follows its anchor through a pan or a zoom.
|
|
56
|
-
* - FIT HAPPENS ONCE, on the first layout that has both a measured viewport
|
|
57
|
-
* and content bounds, and again only on request. A data push that changes
|
|
58
|
-
* the content never moves the operator's view, and nothing is shown before
|
|
59
|
-
* that first fit. With `refitOnResize`, a RESIZE refits a view nobody has
|
|
60
|
-
* moved since its last fit: that view was the whole content, and a window
|
|
61
|
-
* made narrower that kept the old zoom would cut the content off for a
|
|
62
|
-
* reader who never asked to look at less of it. Once the reader has panned
|
|
63
|
-
* or zoomed, a resize keeps their view and only keeps the content
|
|
64
|
-
* reachable. It is opt in because a screen that chooses its own views
|
|
65
|
-
* after a fit (a chart held at a legible zoom) decides its own refits.
|
|
66
|
-
* The same "untouched" is what `restoreView` asks: a fit it gives back is
|
|
67
|
-
* the fit of the content as it stands then, never the old fit's transform.
|
|
68
|
-
* - MOTION ONLY ON REQUEST. A fit, a zoom button or a reveal eases; a drag, a
|
|
69
|
-
* pinch, a wheel and a relayout anchor never do, and under reduced motion
|
|
70
|
-
* nothing does. An easing lasts as long as its transition: a clamp that
|
|
71
|
-
* arrives while one runs (a data push) rides along with it, and one that
|
|
72
|
-
* arrives after it has settled moves at once, as any move nobody asked for
|
|
73
|
-
* must. A request that moves nothing starts no easing.
|
|
74
|
-
*
|
|
75
|
-
* Pointer capture is used where the browser has it and the drag is tracked on
|
|
76
|
-
* the window either way, so a drag that leaves the viewport keeps panning.
|
|
77
|
-
* Fullscreen is not this component's concern: a surface that goes fullscreen
|
|
78
|
-
* must take its dialogs and toasts with it, so the screen that owns those
|
|
79
|
-
* decides.
|
|
80
|
-
*
|
|
81
|
-
* Ported from the engine dashboard's `ui/Canvas.tsx`, with its suite.
|
|
2
|
+
* A pannable, zoomable viewport over positioned content that wires pointers,
|
|
3
|
+
* wheels and keys to `geometry.ts`. It fits once, on the first measured layout,
|
|
4
|
+
* then only on request or on a resize of an untouched fit (`refitOnResize`).
|
|
82
5
|
*/
|
|
83
6
|
import { type ReactNode, type Ref } from 'react';
|
|
84
7
|
import { type CanvasPoint, type CanvasRect, type CanvasSize, type CanvasView } from './geometry.js';
|
|
@@ -88,12 +11,9 @@ import { type CanvasPoint, type CanvasRect, type CanvasSize, type CanvasView } f
|
|
|
88
11
|
*/
|
|
89
12
|
export type CanvasEase = 'near' | 'travel';
|
|
90
13
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
* viewport the canvas's own bars leave, in viewport coordinates) and `fit`
|
|
95
|
-
* (the view that shows all of the content there). Answering null opens on the
|
|
96
|
-
* fit, which then counts as one: see `refitOnResize`.
|
|
14
|
+
* An opening view worked out from the viewport (such as one item centred),
|
|
15
|
+
* asked once when the first content is placed, with `room` (what the bars
|
|
16
|
+
* leave) and `fit`. Null opens on the fit, which then counts as one.
|
|
97
17
|
*/
|
|
98
18
|
export type CanvasOpening = (room: CanvasRect, fit: CanvasView) => CanvasView | null;
|
|
99
19
|
/** What a screen can ask of a canvas it holds a ref to. */
|
|
@@ -106,61 +26,28 @@ export interface CanvasHandle {
|
|
|
106
26
|
zoomTo(scale: number): void;
|
|
107
27
|
/**
|
|
108
28
|
* Pan the least distance that brings a world rectangle into view, clear of
|
|
109
|
-
* the end bar
|
|
110
|
-
*
|
|
111
|
-
* `outside` is where a rectangle lying WHOLLY outside the view is brought:
|
|
112
|
-
* `edge`, the default, just inside the nearest edge, for a reader stepping
|
|
113
|
-
* to the next item; `centre`, the middle of the view at the same zoom, for a
|
|
114
|
-
* reader SENT to an item somewhere else, and that move travels rather than
|
|
115
|
-
* corrects. A rectangle partly in view moves the least distance either way.
|
|
116
|
-
* See [revealView].
|
|
29
|
+
* the end bar. One wholly outside lands inside the nearest edge (`edge`) or
|
|
30
|
+
* travels to the middle (`centre`, for a reader sent there): [revealView].
|
|
117
31
|
*/
|
|
118
32
|
reveal(target: CanvasRect, outside?: 'edge' | 'centre'): void;
|
|
119
33
|
/** Keep a node still on screen across a relayout: see `anchorView`. */
|
|
120
34
|
anchor(before: CanvasPoint, after: CanvasPoint): void;
|
|
121
35
|
/**
|
|
122
|
-
* Ease onto one world rectangle, remembering the view it left
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* the chart moves to it, leaves room around it (`regionView`), and gives the
|
|
126
|
-
* reader their own view back on [restoreView]. Calling it twice remembers
|
|
127
|
-
* only the first view, so a second region is still left by one restore.
|
|
128
|
-
*
|
|
129
|
-
* `context` is how many times the region's own width the visible width comes
|
|
130
|
-
* to: [CANVAS_FOCUS_CONTEXT] unless it is named, and
|
|
131
|
-
* [CANVAS_COMPOSE_CONTEXT] for a region a reader has to type into rather
|
|
132
|
-
* than merely look at. `ceiling` is how far in the ease may zoom, for a
|
|
133
|
-
* region with a size of its own to respect: see [regionView].
|
|
36
|
+
* Ease onto one world rectangle, remembering the first view it left for
|
|
37
|
+
* [restoreView]. `context` and `ceiling` are as in [regionView]; pass
|
|
38
|
+
* [CANVAS_COMPOSE_CONTEXT] for a region a reader types into.
|
|
134
39
|
*/
|
|
135
40
|
focusRegion(target: CanvasRect, context?: number, ceiling?: number): void;
|
|
136
41
|
/**
|
|
137
|
-
* Remember the view
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* FOR A REGION THAT DOES NOT EXIST YET. [focusRegion] remembers the view it
|
|
141
|
-
* leaves, which is the right moment whenever the thing being eased onto was
|
|
142
|
-
* already on the chart. A node being COMPOSED is not: its card has to be
|
|
143
|
-
* added to the content and measured before there is a rectangle to ease
|
|
144
|
-
* onto, and the content growing is itself a change the canvas answers by
|
|
145
|
-
* keeping what it holds reachable. So by the time `focusRegion` could be
|
|
146
|
-
* called, the view is no longer the one the reader was on, and what came
|
|
147
|
-
* back afterwards was the chart as the GHOST had left it. Measured on the
|
|
148
|
-
* engine's own builder: 198px sideways, every time an add was cancelled.
|
|
149
|
-
*
|
|
150
|
-
* Calling it twice keeps the first view, as [focusRegion] does.
|
|
42
|
+
* Remember the current view for [restoreView] without moving, for a region
|
|
43
|
+
* not on the chart yet (a node being composed is measured first, and the
|
|
44
|
+
* content growing moves the view). A second call keeps the first view.
|
|
151
45
|
*/
|
|
152
46
|
rememberView(): void;
|
|
153
47
|
/**
|
|
154
|
-
* Ease back to the view [focusRegion] or [rememberView] left,
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
* A FIT IS GIVEN BACK AS A FIT. Where the view left was the untouched fit (a
|
|
158
|
-
* fit nobody has moved since, as `refitOnResize` counts one), what comes
|
|
159
|
-
* back is the fit of the content as it stands NOW rather than the old fit's
|
|
160
|
-
* zoom and pan: a fit says "all of the content", and a surface that changed
|
|
161
|
-
* the content while it was open (a node added in it, a branch opened for
|
|
162
|
-
* it) and gave back the old transform cut the new content off at the edges.
|
|
163
|
-
* A view the reader moved is theirs, and comes back exactly.
|
|
48
|
+
* Ease back to the view [focusRegion] or [rememberView] left, once. An
|
|
49
|
+
* untouched fit comes back as the fit of the content as it is now; a view
|
|
50
|
+
* the reader moved comes back exactly.
|
|
164
51
|
*/
|
|
165
52
|
restoreView(): void;
|
|
166
53
|
/** A world rectangle in viewport coordinates, for positioning an overlay. */
|
|
@@ -172,16 +59,9 @@ export interface CanvasHandle {
|
|
|
172
59
|
worldAt(client: CanvasPoint): CanvasPoint;
|
|
173
60
|
}
|
|
174
61
|
/**
|
|
175
|
-
* The pointer the field shows while nothing is
|
|
176
|
-
*
|
|
177
|
-
* `
|
|
178
|
-
* wants. A surface with tools names the one its tool means: `pointer` for
|
|
179
|
-
* selecting, `crosshair` for placing a thing, `text` for placing text. A pan
|
|
180
|
-
* in progress always shows the closed hand, whatever the tool.
|
|
181
|
-
*
|
|
182
|
-
* Each is the operating system's own pointer (`grab`, `default`, `crosshair`,
|
|
183
|
-
* `text`, and `grabbing` for a pan), the hand a reader already knows from
|
|
184
|
-
* every map and design tool, rather than a drawing of the kit's own.
|
|
62
|
+
* The pointer the field shows while nothing is dragged, as the system's own
|
|
63
|
+
* cursor: `hand` (grab) for a field that pans, or a tool's (`pointer`,
|
|
64
|
+
* `crosshair`, `text`). A pan in progress always shows `grabbing`.
|
|
185
65
|
*/
|
|
186
66
|
export type CanvasCursor = 'hand' | 'pointer' | 'crosshair' | 'text';
|
|
187
67
|
/** Every string the canvas renders on its own. */
|
|
@@ -221,32 +101,21 @@ export interface CanvasProps {
|
|
|
221
101
|
/** The positioned content: the layer that is panned and zoomed. */
|
|
222
102
|
children: ReactNode;
|
|
223
103
|
/**
|
|
224
|
-
* Anything drawn over the viewport without the transform
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
* THE LAYER IS INERT AND ITS CHILDREN ARE NOT. Empty space passes a press
|
|
228
|
-
* through to the viewport beneath, but each child takes its own presses
|
|
229
|
-
* back, because a control drawn here has to be pressable. So a note that
|
|
230
|
-
* must not swallow the drag that pans the chart sets `pointer-events: none`
|
|
231
|
-
* on itself.
|
|
104
|
+
* Anything drawn over the viewport without the transform. Empty space passes
|
|
105
|
+
* presses through but each child takes its own, so a note that must not
|
|
106
|
+
* block a pan sets `pointer-events: none` on itself.
|
|
232
107
|
*/
|
|
233
108
|
overlay?: ReactNode;
|
|
234
109
|
/** The zoom out, zoom in and fit controls. */
|
|
235
110
|
controls?: boolean | undefined;
|
|
236
111
|
/**
|
|
237
|
-
* Which corner the controls sit in.
|
|
238
|
-
*
|
|
239
|
-
* `top-right` is where a chart's own toolbar belongs, and where the console
|
|
240
|
-
* org chart puts it: out of the way of the content, which a tree grows
|
|
241
|
-
* DOWNWARD from its root, and beside the first place a reader looks after
|
|
242
|
-
* the root itself.
|
|
112
|
+
* Which corner the controls sit in. `top-right` suits a tree, which grows
|
|
113
|
+
* downward from its root.
|
|
243
114
|
*/
|
|
244
115
|
controlsPlacement?: 'top-right' | 'bottom-right' | undefined;
|
|
245
116
|
/**
|
|
246
|
-
* Anything else in the control bar,
|
|
247
|
-
*
|
|
248
|
-
* the page's own toolbar because it acts on the CANVAS, and a control that
|
|
249
|
-
* acts on the canvas from 800px away is a control nobody finds.
|
|
117
|
+
* Anything else in the control bar, after the zoom controls (fullscreen,
|
|
118
|
+
* print, download): a control that acts on the canvas sits beside it.
|
|
250
119
|
*/
|
|
251
120
|
controlsExtra?: ReactNode | undefined;
|
|
252
121
|
/**
|
|
@@ -267,58 +136,31 @@ export interface CanvasProps {
|
|
|
267
136
|
*/
|
|
268
137
|
controlsStart?: ReactNode | undefined;
|
|
269
138
|
/**
|
|
270
|
-
* A bar of the caller's own
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
* running off a narrow canvas, and a fit keeps the content clear of it.
|
|
139
|
+
* A bar of the caller's own at the end across from the control bar, on its
|
|
140
|
+
* surface and inset. It wraps on a narrow canvas, and a fit keeps the
|
|
141
|
+
* content clear of it.
|
|
274
142
|
*/
|
|
275
143
|
overlayEnd?: ReactNode | undefined;
|
|
276
144
|
/**
|
|
277
|
-
* A note under the controls,
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
* DECORATION, AND AN ANNOUNCEMENT. It takes no press and no tab stop, so it
|
|
281
|
-
* never comes between a reader and the chart; it is a `status` region, so a
|
|
282
|
-
* canvas that puts one up when it enters a state a reader cannot see out of
|
|
283
|
-
* says so to a reader who cannot see it either. Give it a node whose content
|
|
284
|
-
* comes and goes rather than the node itself: the region stays in the
|
|
285
|
-
* document while it is empty, and a live region that was already there when
|
|
286
|
-
* its message arrives is a message a screen reader announces.
|
|
145
|
+
* A note under the controls, such as "Press Esc to leave fullscreen", in a
|
|
146
|
+
* `status` region with no press or tab stop. Keep passing a node and change
|
|
147
|
+
* its content, so the region exists before the message arrives.
|
|
287
148
|
*/
|
|
288
149
|
hint?: ReactNode | undefined;
|
|
289
150
|
/**
|
|
290
|
-
* The width, in world units, of the largest single item the
|
|
291
|
-
*
|
|
292
|
-
* It is what the largest zoom is derived from ([zoomLimits]): a reader who
|
|
293
|
-
* keeps pressing Zoom in is asking to look at one item, so the ceiling is
|
|
294
|
-
* the zoom that gives them one. Unset, the fixed ceiling stands.
|
|
151
|
+
* The width, in world units, of the largest single item: the largest zoom
|
|
152
|
+
* fills the viewport with it ([zoomLimits]). Unset, the fixed ceiling stands.
|
|
295
153
|
*/
|
|
296
154
|
largestItemWidth?: number | undefined;
|
|
297
155
|
/**
|
|
298
|
-
*
|
|
299
|
-
* about one part of it.
|
|
300
|
-
*
|
|
301
|
-
* The content is blurred and faded rather than covered, so the chart is
|
|
302
|
-
* still there behind the decision being made about it, which is what the
|
|
303
|
-
* console chart does while a node is being added. It is a state rather than
|
|
304
|
-
* an entrance, so a reader who asked for less motion simply gets it.
|
|
156
|
+
* Blurs and fades the content back, for a surface opened over the canvas
|
|
157
|
+
* about one part of it. A state, not an entrance, so reduced motion holds.
|
|
305
158
|
*/
|
|
306
159
|
dimmed?: boolean | undefined;
|
|
307
160
|
/**
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
* itself, such as an organization chart: the dots say the field pans before
|
|
312
|
-
* anybody drags it. They are drawn on the frame rather than on the content,
|
|
313
|
-
* so they stay put while the content moves over them. `plain`, the default,
|
|
314
|
-
* is the page's own ground and nothing else.
|
|
315
|
-
*
|
|
316
|
-
* `grid` is a design tool's ground: the same dots laid on the content's own
|
|
317
|
-
* plane, so they pan with it and their pitch follows the zoom (see
|
|
318
|
-
* [gridOf]). For a canvas of things a person places and arranges, where the
|
|
319
|
-
* grid is the surface they are placed ON rather than a texture behind a
|
|
320
|
-
* chart, and a grid that stayed put while the boards moved over it would
|
|
321
|
-
* read as two planes sliding apart.
|
|
161
|
+
* The field under the content: `plain` (the page's ground), `dotted` (dots
|
|
162
|
+
* on the frame that stay put, saying the field pans), or `grid` (dots on the
|
|
163
|
+
* content's plane that pan and scale with it, see [gridOf]).
|
|
322
164
|
*/
|
|
323
165
|
ground?: CanvasGround | undefined;
|
|
324
166
|
/**
|
|
@@ -331,18 +173,13 @@ export interface CanvasProps {
|
|
|
331
173
|
cursor?: CanvasCursor | undefined;
|
|
332
174
|
/**
|
|
333
175
|
* Refit on a resize while the view is still the last fit, rather than keep
|
|
334
|
-
* the
|
|
335
|
-
*
|
|
336
|
-
* boards. Off by default: a screen that adjusts the view after each fit
|
|
337
|
-
* (holding a zoom, revealing a card) runs its own refit.
|
|
176
|
+
* the old zoom. Off by default: a screen that adjusts the view after each
|
|
177
|
+
* fit runs its own refit.
|
|
338
178
|
*/
|
|
339
179
|
refitOnResize?: boolean | undefined;
|
|
340
180
|
/**
|
|
341
|
-
* Whether one finger can pan the canvas
|
|
342
|
-
*
|
|
343
|
-
* On by default, behind the tap that activates it. Turned off, one finger
|
|
344
|
-
* always belongs to the page and only a two finger pinch reaches the canvas,
|
|
345
|
-
* which is what a chart embedded in a long scrolling page wants.
|
|
181
|
+
* Whether one finger can pan the canvas, after the tap that activates it.
|
|
182
|
+
* Off, one finger always scrolls the page and only a pinch reaches it.
|
|
346
183
|
*/
|
|
347
184
|
touch?: boolean | undefined;
|
|
348
185
|
/** Every string the canvas renders itself, for another language. */
|
|
@@ -350,21 +187,14 @@ export interface CanvasProps {
|
|
|
350
187
|
/** Called once, when the first measured layout has been fitted. */
|
|
351
188
|
onReady?: (() => void) | undefined;
|
|
352
189
|
/**
|
|
353
|
-
* Called with the view and the viewport's size whenever either changes,
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
* THE VIEW IT IS GIVEN IS WHERE THE CONTENT IS GOING, not where an easing
|
|
357
|
-
* has got to: a fit or a zoom step reports its destination at once, so a
|
|
358
|
-
* surface that mounts what is on screen (a design's live artboards) mounts
|
|
359
|
-
* what the reader will see when the move lands, rather than chasing every
|
|
360
|
-
* frame of it.
|
|
190
|
+
* Called with the view and the viewport's size whenever either changes, from
|
|
191
|
+
* the first fit on. The view is where an easing is going, not where it has
|
|
192
|
+
* got to.
|
|
361
193
|
*/
|
|
362
194
|
onViewChange?: ((view: CanvasView, viewport: CanvasSize) => void) | undefined;
|
|
363
195
|
/**
|
|
364
|
-
* The view to open on instead of the fit,
|
|
365
|
-
*
|
|
366
|
-
* An opening that depends on the viewport's size is a [CanvasOpening],
|
|
367
|
-
* asked at that moment.
|
|
196
|
+
* The view to open on instead of the fit, read once when the first content
|
|
197
|
+
* is placed and kept reachable; a [CanvasOpening] is asked at that moment.
|
|
368
198
|
*/
|
|
369
199
|
initialView?: CanvasView | CanvasOpening | undefined;
|
|
370
200
|
ref?: Ref<CanvasHandle> | undefined;
|
|
@@ -372,15 +202,9 @@ export interface CanvasProps {
|
|
|
372
202
|
}
|
|
373
203
|
export declare function Canvas({ label, content, children, overlay, controls, controlsPlacement, controlsExtra, controlsActualSize, controlsBelow, controlsStart, overlayEnd, hint, largestItemWidth, dimmed, ground, minZoom, cursor, refitOnResize, touch, labels, onReady, onViewChange, initialView, ref, className, }: CanvasProps): import("react").JSX.Element;
|
|
374
204
|
/**
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
* The world's pitch doubles or halves with the zoom so the screen pitch stays
|
|
379
|
-
* between one and two steps, as a design tool's grid does: at every zoom the
|
|
380
|
-
* dots are as dense as the dotted ground's and never twice as sparse, and one
|
|
381
|
-
* of them always sits on the content's origin, so the grid and the content
|
|
382
|
-
* never slide apart. The offset is the view's own translation, since the
|
|
383
|
-
* background repeats from it both ways.
|
|
205
|
+
* Where a `grid` ground's dots fall for a view: their screen pitch (one to two
|
|
206
|
+
* dotted steps, halving or doubling with the zoom) and the screen point one
|
|
207
|
+
* sits on, so the grid never slides off the content's origin.
|
|
384
208
|
*/
|
|
385
209
|
export declare function gridOf(view: CanvasView): {
|
|
386
210
|
scale: number;
|
|
@@ -1,33 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* browser-free suite cannot otherwise reach: jsdom has no layout, no pointer
|
|
6
|
-
* capture and no `DOMMatrix`, so a zoom that drifted off the cursor or a fit
|
|
7
|
-
* that cropped the root would pass any component suite. Kept pure, each rule
|
|
8
|
-
* is a function of numbers with a suite of its own, and the component is left
|
|
9
|
-
* with the wiring. `placePopup` in the Layer module is the same idea for the
|
|
10
|
-
* surfaces that float over a canvas.
|
|
11
|
-
*
|
|
12
|
-
* THE MODEL. A view is `{ x, y, k }`: a world point `p` lands on screen at
|
|
13
|
-
* `p * k + (x, y)`, with the origin at the viewport's top left corner. Every
|
|
14
|
-
* function returns a new view and never mutates one.
|
|
15
|
-
*
|
|
16
|
-
* THE RULES IT KEEPS.
|
|
17
|
-
*
|
|
18
|
-
* - A ZOOM KEEPS ITS FOCUS STILL. The world point under the cursor (or the
|
|
19
|
-
* pinch midpoint, or the viewport centre for a key) stays where it was,
|
|
20
|
-
* including when the zoom is clamped at a limit.
|
|
21
|
-
* - CONTENT CANNOT BE LOST. A pan leaves at least a margin of the content on
|
|
22
|
-
* screen on each axis, so nobody drags the chart away and has nothing left
|
|
23
|
-
* to drag it back by.
|
|
24
|
-
* - A FIT NEVER ENLARGES past one to one, and when the content is too tall to
|
|
25
|
-
* fit even at the smallest zoom it aligns to the TOP, where a tree's root
|
|
26
|
-
* is, rather than centring the root off screen.
|
|
27
|
-
* - A REVEAL MOVES AS LITTLE AS IT CAN: nothing when the target is already in
|
|
28
|
-
* view, otherwise just enough to bring it inside the padding. The one
|
|
29
|
-
* exception is asked for by name: a target a reader is SENT to that none of
|
|
30
|
-
* the view shows is drawn in its middle (see [revealView]).
|
|
2
|
+
* A pannable, zoomable viewport's geometry as pure functions, so jsdom suites
|
|
3
|
+
* can test it. A world point `p` is drawn at `p * k + (x, y)`, and a fit too
|
|
4
|
+
* tall for the viewport aligns to the top, where a tree's root is.
|
|
31
5
|
*/
|
|
32
6
|
export interface CanvasPoint {
|
|
33
7
|
x: number;
|
|
@@ -48,59 +22,28 @@ export interface CanvasView {
|
|
|
48
22
|
/** No pan and no zoom: what a canvas shows before it has been fitted. */
|
|
49
23
|
export declare const IDENTITY_VIEW: CanvasView;
|
|
50
24
|
/**
|
|
51
|
-
* The smallest zoom
|
|
52
|
-
*
|
|
53
|
-
* shape of the structure and where a card sits in it are still legible.
|
|
54
|
-
*
|
|
55
|
-
* IT IS A BACKSTOP, NOT THE FLOOR. Once the content has been measured the
|
|
56
|
-
* floor is the FIT itself ([zoomLimits]): there is nothing to see past the
|
|
57
|
-
* whole chart, and a reader who has shrunk it to a quarter of that has a
|
|
58
|
-
* screen of grey and no way to tell which way is back. It is what the console
|
|
59
|
-
* chart does, where zooming out lerps toward the fit and snaps to it.
|
|
25
|
+
* The smallest zoom for content not yet measured; once it is measured, the
|
|
26
|
+
* floor is the fit itself ([zoomLimits]).
|
|
60
27
|
*/
|
|
61
28
|
export declare const CANVAS_MIN_ZOOM = 0.25;
|
|
62
29
|
/**
|
|
63
|
-
* The smallest a canvas's largest zoom may be, for content whose
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* THE CEILING IS NORMALLY THE CONTENT'S ([zoomLimits]): one item filling the
|
|
67
|
-
* viewport, which is the console chart's own ceiling and the answer to "let me
|
|
68
|
-
* look at THIS one". Double size was the ceiling for every chart once, which
|
|
69
|
-
* on a 180px node in a 1267px viewport is a fifth of the magnification a
|
|
70
|
-
* reader can ask for there.
|
|
30
|
+
* The smallest a canvas's largest zoom may be, for content whose items were
|
|
31
|
+
* never measured; normally one item filling the viewport sets it.
|
|
71
32
|
*/
|
|
72
33
|
export declare const CANVAS_MAX_ZOOM = 2;
|
|
73
34
|
/**
|
|
74
|
-
* The largest zoom any canvas will go to, however small its largest item
|
|
75
|
-
*
|
|
76
|
-
* A chart whose widest card is a few dozen pixels would otherwise let a reader
|
|
77
|
-
* zoom to twenty times, where a pan of one wheel notch crosses the whole
|
|
78
|
-
* content and nothing on screen says where they are.
|
|
35
|
+
* The largest zoom any canvas will go to, however small its largest item, so a
|
|
36
|
+
* wheel notch never pans across the whole content.
|
|
79
37
|
*/
|
|
80
38
|
export declare const CANVAS_ZOOM_CEILING = 8;
|
|
81
39
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* Three, because the point of easing onto a region is to say where it is as
|
|
86
|
-
* well as what it is: the region fills the middle third and its surroundings
|
|
87
|
-
* are still drawn either side of it. The console chart's own ghost is 280
|
|
88
|
-
* units wide and it eases to a visible width between 660 and 1040, which is
|
|
89
|
-
* 2.4 to 3.7 times.
|
|
40
|
+
* The visible width, as a multiple of the region's own, that [regionView] gives
|
|
41
|
+
* a focused region: it fills the middle third with its surroundings in view.
|
|
90
42
|
*/
|
|
91
43
|
export declare const CANVAS_FOCUS_CONTEXT = 3;
|
|
92
44
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* thirds of the pane rather than a third.
|
|
96
|
-
*
|
|
97
|
-
* A region focused because a surface is ABOUT it is being pointed at, and the
|
|
98
|
-
* point is as much where it is as what it is. A node being COMPOSED in the
|
|
99
|
-
* chart is the other thing: its card holds the form, so what is drawn there
|
|
100
|
-
* has to be read and typed into at a size a pointer can hit. Measured on this
|
|
101
|
-
* build, the builder's add form is 320 by 400 and the pane 900 by 700: at
|
|
102
|
-
* [CANVAS_FOCUS_CONTEXT] it is drawn at 0.58 of its own size, with a 24px
|
|
103
|
-
* target landing on 14 screen pixels. At this step it is drawn at 1.16.
|
|
45
|
+
* The visible width for a region a reader types into (a node being composed):
|
|
46
|
+
* one and a half times its own, so its form is drawn near actual size.
|
|
104
47
|
*/
|
|
105
48
|
export declare const CANVAS_COMPOSE_CONTEXT = 1.5;
|
|
106
49
|
/** A fit shows everything at no more than actual size: a small tree is not blown up. */
|
|
@@ -112,11 +55,8 @@ export declare const CANVAS_FIT_MAX_ZOOM = 1;
|
|
|
112
55
|
*/
|
|
113
56
|
export declare const CANVAS_ZOOM_STEP = 1.2;
|
|
114
57
|
/**
|
|
115
|
-
* Wheel zoom per pixel of
|
|
116
|
-
*
|
|
117
|
-
* `CANVAS_ZOOM_STEP`: a wheel notch and a key press do the same thing. A
|
|
118
|
-
* trackpad pinch reports small deltas many times a second, which this turns
|
|
119
|
-
* into a smooth zoom.
|
|
58
|
+
* Wheel zoom per pixel of delta, so one mouse-wheel notch (about 100 pixels)
|
|
59
|
+
* is exactly one `CANVAS_ZOOM_STEP`.
|
|
120
60
|
*/
|
|
121
61
|
export declare const CANVAS_WHEEL_ZOOM_PER_PIXEL: number;
|
|
122
62
|
/** What a wheel "line" is in pixels, for devices that report lines. */
|
|
@@ -150,20 +90,9 @@ export interface CanvasZoomLimits {
|
|
|
150
90
|
/** What a canvas allows before its content has been measured. */
|
|
151
91
|
export declare const CANVAS_ZOOM_LIMITS: CanvasZoomLimits;
|
|
152
92
|
/**
|
|
153
|
-
* How far this content
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* zooming out past it only shrinks the chart away from the reader; the console
|
|
157
|
-
* chart refuses it outright, and this is that refusal. Before the content has
|
|
158
|
-
* been measured there is no fit to floor at, so the backstop stands.
|
|
159
|
-
*
|
|
160
|
-
* THE CEILING IS ONE ITEM FILLING THE VIEWPORT, which is what a reader asking
|
|
161
|
-
* for more zoom is asking for: to look at THIS card. `largestItem` is the
|
|
162
|
-
* width in world units of the widest one, which the chart above this knows
|
|
163
|
-
* because it measured every card; with none given the fixed ceiling stands. It
|
|
164
|
-
* never goes below that fixed ceiling and never above [CANVAS_ZOOM_CEILING].
|
|
165
|
-
*
|
|
166
|
-
* `floor` is the fit's own floor, passed through to [fitView].
|
|
93
|
+
* How far this content may be zoomed: out to its fit ([fitView] with `floor`,
|
|
94
|
+
* or `floor` itself unmeasured) and in until its widest item (`largestItem`)
|
|
95
|
+
* fills the viewport, between [CANVAS_MAX_ZOOM] and [CANVAS_ZOOM_CEILING].
|
|
167
96
|
*/
|
|
168
97
|
export declare function zoomLimits(content: CanvasRect | null, viewport: CanvasSize, largestItem?: number, padding?: number, floor?: number): CanvasZoomLimits;
|
|
169
98
|
export declare function clampZoom(k: number, limits?: CanvasZoomLimits): number;
|
|
@@ -182,35 +111,20 @@ export declare function zoomAt(view: CanvasView, factor: number, focus: CanvasPo
|
|
|
182
111
|
*/
|
|
183
112
|
export declare function clampPan(view: CanvasView, content: CanvasRect, viewport: CanvasSize, margin?: number): CanvasView;
|
|
184
113
|
/**
|
|
185
|
-
* The view that shows all of `content`, centred, at no more than actual size
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
* is named. A chart of cards keeps that floor, because below it a card is a
|
|
189
|
-
* grey smudge and panning the overflow is the better view. A canvas of pages
|
|
190
|
-
* names a lower one: a design laid out across many 1440px boards is several
|
|
191
|
-
* screens wide, and a fit that stops at a quarter clips it on every side.
|
|
114
|
+
* The view that shows all of `content`, centred, at no more than actual size
|
|
115
|
+
* and no less than `floor`: a chart of cards keeps [CANVAS_MIN_ZOOM], a canvas
|
|
116
|
+
* of wide pages names a lower one.
|
|
192
117
|
*/
|
|
193
118
|
export declare function fitView(content: CanvasRect, viewport: CanvasSize, padding?: number, floor?: number): CanvasView;
|
|
194
119
|
/**
|
|
195
|
-
* The smallest pan that brings
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
* `outside` is where a target lying WHOLLY outside the viewport is brought.
|
|
199
|
-
* `edge`, the default, is the least pan, which leaves it just inside the edge
|
|
200
|
-
* it came in by: right for a reader stepping to the next item, which is
|
|
201
|
-
* beside the one before. `centre` draws its middle on the viewport's middle:
|
|
202
|
-
* for a reader SENT to an item somewhere else (after an operation, an undo or
|
|
203
|
-
* a search), whom the least pan left against the edge with nothing of the
|
|
204
|
-
* content around it on that side. A target partly in view moves the least
|
|
205
|
-
* distance either way, and one in view does not move.
|
|
120
|
+
* The smallest pan that brings `target` inside the padded viewport, at the same
|
|
121
|
+
* zoom. A target wholly outside lands just inside the edge it came in by
|
|
122
|
+
* (`edge`) or in the middle (`centre`, for a reader sent there from elsewhere).
|
|
206
123
|
*/
|
|
207
124
|
export declare function revealView(view: CanvasView, target: CanvasRect, viewport: CanvasSize, padding?: number, outside?: 'edge' | 'centre'): CanvasView;
|
|
208
125
|
/**
|
|
209
|
-
* The view that draws world point `after` where `before` was drawn
|
|
210
|
-
*
|
|
211
|
-
* What keeps a node still on screen when a relayout moves it in the world: a
|
|
212
|
-
* card grows, its siblings shift, and the one the operator just acted on stays
|
|
213
|
-
* under their eyes instead of jumping away.
|
|
126
|
+
* The view that draws world point `after` where `before` was drawn, so a node
|
|
127
|
+
* a relayout moves stays still on screen.
|
|
214
128
|
*/
|
|
215
129
|
export declare function anchorView(view: CanvasView, before: CanvasPoint, after: CanvasPoint): CanvasView;
|
|
216
130
|
/** Where a two-pointer gesture began. */
|
|
@@ -220,11 +134,8 @@ export interface PinchStart {
|
|
|
220
134
|
b: CanvasPoint;
|
|
221
135
|
}
|
|
222
136
|
/**
|
|
223
|
-
* The view for a pinch
|
|
224
|
-
*
|
|
225
|
-
* The spread scales the zoom, and the world point under the starting midpoint
|
|
226
|
-
* follows the current midpoint, so one gesture zooms and pans together the way
|
|
227
|
-
* every touch map does.
|
|
137
|
+
* The view for a pinch moved from `start` to `a` and `b`: the spread scales the
|
|
138
|
+
* zoom, and the world point under the first midpoint follows the current one.
|
|
228
139
|
*/
|
|
229
140
|
export declare function pinchView(start: PinchStart, a: CanvasPoint, b: CanvasPoint, limits?: CanvasZoomLimits): CanvasView;
|
|
230
141
|
/** The minimal slice of a WheelEvent these functions read. */
|
|
@@ -247,27 +158,8 @@ export declare function wheelZoomFactor(dy: number): number;
|
|
|
247
158
|
/** Whether a press that went from `a` to `b` has become a drag. */
|
|
248
159
|
export declare function beyondSlop(a: CanvasPoint, b: CanvasPoint, pointerType: string): boolean;
|
|
249
160
|
/**
|
|
250
|
-
* The view that
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
* WHAT IT IS FOR: a surface that is about ONE node (a form for the child about
|
|
254
|
-
* to be added under it, say) has to be able to say WHERE that node is, and the
|
|
255
|
-
* chart is the only thing that can say it. Easing onto the region is the
|
|
256
|
-
* console chart's own answer, and it saves the view it left so the reader is
|
|
257
|
-
* put back exactly where they were when the surface closes.
|
|
258
|
-
*
|
|
259
|
-
* THE ZOOM IS THE REGION'S, NOT THE READER'S: the region is given the middle
|
|
260
|
-
* third of the viewport ([CANVAS_FOCUS_CONTEXT]), clamped to what this content
|
|
261
|
-
* allows, so a small region is enlarged and a huge one is shrunk to fit.
|
|
262
|
-
*
|
|
263
|
-
* `ceiling` is how far that may go IN, for a region that has a size of its own
|
|
264
|
-
* to respect. A node being pointed AT has none, so the default is no ceiling
|
|
265
|
-
* and a small chart's node fills the pane; a region holding a FORM was drawn
|
|
266
|
-
* at the size its controls were designed at, and enlarging it is a page zoom
|
|
267
|
-
* nobody asked for. Measured on a two-node company: the engine's add form was
|
|
268
|
-
* drawn at 233%, its 16px labels at 37px and its buttons past a finger's
|
|
269
|
-
* width, with the chart around it off screen. [CANVAS_FIT_MAX_ZOOM] is the
|
|
270
|
-
* ceiling such a caller passes, which is the same "never blown up" this
|
|
271
|
-
* module's fit already keeps.
|
|
161
|
+
* The view that centres one world rectangle with room around it: the region
|
|
162
|
+
* gets 1/`context` of the visible width, clamped to `limits` and `ceiling`. A
|
|
163
|
+
* region holding a form passes [CANVAS_FIT_MAX_ZOOM] so it is never enlarged.
|
|
272
164
|
*/
|
|
273
165
|
export declare function regionView(region: CanvasRect, viewport: CanvasSize, limits?: CanvasZoomLimits, context?: number, ceiling?: number): CanvasView;
|
package/dist/Canvas/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CANVAS_COMPOSE_CONTEXT, CANVAS_FIT_MAX_ZOOM, CANVAS_FIT_PADDING, CANVAS_FOCUS_CONTEXT, CANVAS_MAX_ZOOM, CANVAS_MIN_ZOOM, CANVAS_PAN_MARGIN, CANVAS_PAN_STEP, CANVAS_REVEAL_PADDING, CANVAS_TAP_SLOP, CANVAS_WHEEL_LINE_PX, CANVAS_WHEEL_ZOOM_PER_PIXEL, CANVAS_ZOOM_CEILING, CANVAS_ZOOM_LIMITS, CANVAS_ZOOM_STEP, Canvas, IDENTITY_VIEW, ShortcutTip, anchorView, beyondSlop, clampPan, clampZoom, fitView, gridOf, panBy, pinchView, regionView, revealView, screenRect, toScreen, toWorld, wheelPixels, wheelZoomFactor, zoomAt, zoomLimits } from '../chunk-
|
|
1
|
+
export { CANVAS_COMPOSE_CONTEXT, CANVAS_FIT_MAX_ZOOM, CANVAS_FIT_PADDING, CANVAS_FOCUS_CONTEXT, CANVAS_MAX_ZOOM, CANVAS_MIN_ZOOM, CANVAS_PAN_MARGIN, CANVAS_PAN_STEP, CANVAS_REVEAL_PADDING, CANVAS_TAP_SLOP, CANVAS_WHEEL_LINE_PX, CANVAS_WHEEL_ZOOM_PER_PIXEL, CANVAS_ZOOM_CEILING, CANVAS_ZOOM_LIMITS, CANVAS_ZOOM_STEP, Canvas, IDENTITY_VIEW, ShortcutTip, anchorView, beyondSlop, clampPan, clampZoom, fitView, gridOf, panBy, pinchView, regionView, revealView, screenRect, toScreen, toWorld, wheelPixels, wheelZoomFactor, zoomAt, zoomLimits } from '../chunk-YADYQHHW.js';
|
|
2
2
|
import '../chunk-X4HBZSXA.js';
|
|
3
3
|
import '../chunk-VBBLHS2Y.js';
|
|
4
4
|
import '../chunk-M2M6ZD7P.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { BOARD_NAME_MIN_CHARS, CANVAS_BOARD_MAX_LIVE, CANVAS_BOARD_MIN_LIVE_WIDTH, CANVAS_BOARD_MIN_ZOOM, CANVAS_NOTE_COLORS, CanvasBoard, TITLE_GLYPH_EM, boardName, boardRoom, liveBoards, titleSize } from '../chunk-
|
|
1
|
+
export { BOARD_NAME_MIN_CHARS, CANVAS_BOARD_MAX_LIVE, CANVAS_BOARD_MIN_LIVE_WIDTH, CANVAS_BOARD_MIN_ZOOM, CANVAS_NOTE_COLORS, CanvasBoard, TITLE_GLYPH_EM, boardName, boardRoom, liveBoards, titleSize } from '../chunk-FVXNR63H.js';
|
|
2
2
|
import '../chunk-YJPQJVRJ.js';
|
|
3
|
-
import '../chunk-
|
|
3
|
+
import '../chunk-FEJVDORA.js';
|
|
4
4
|
import '../chunk-NPEI2QAN.js';
|
|
5
|
-
import '../chunk-
|
|
5
|
+
import '../chunk-YADYQHHW.js';
|
|
6
6
|
import '../chunk-X4HBZSXA.js';
|
|
7
7
|
import '../chunk-VBBLHS2Y.js';
|
|
8
8
|
import '../chunk-M2M6ZD7P.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { CanvasToolbar, toolForKey } from '../chunk-
|
|
1
|
+
export { CanvasToolbar, toolForKey } from '../chunk-FEJVDORA.js';
|
|
2
2
|
import '../chunk-NPEI2QAN.js';
|
|
3
|
-
import '../chunk-
|
|
3
|
+
import '../chunk-YADYQHHW.js';
|
|
4
4
|
import '../chunk-X4HBZSXA.js';
|
|
5
5
|
import '../chunk-VBBLHS2Y.js';
|
|
6
6
|
import '../chunk-M2M6ZD7P.js';
|