@n-uf/placement 26.11.34 → 26.11.37
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/CHANGELOG.md +163 -0
- package/README.md +147 -20
- package/dist/{chunk-VKB3UWKX.js → chunk-2PWDUBPG.js} +520 -97
- package/dist/chunk-2PWDUBPG.js.map +1 -0
- package/dist/{chunk-AVMZIXGO.js → chunk-NF7RYK3U.js} +9 -49
- package/dist/chunk-NF7RYK3U.js.map +1 -0
- package/dist/chunk-R3AAANRY.js +220 -0
- package/dist/chunk-R3AAANRY.js.map +1 -0
- package/dist/desk.d.ts +2 -2
- package/dist/dock.js +2 -1
- package/dist/dock.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/{model-BSIKmANw.d.ts → model-CuE-ML-f.d.ts} +111 -19
- package/dist/panels.d.ts +3 -3
- package/dist/regions-Db_RyT4P.d.ts +48 -0
- package/dist/scene-cases.d.ts +42 -10
- package/dist/scene-cases.js +109 -10
- package/dist/scene-cases.js.map +1 -1
- package/dist/scene.d.ts +100 -6
- package/dist/scene.js +11 -1
- package/dist/stack.d.ts +1 -1
- package/dist/{target-2RYYKkd1.d.ts → target-fhD5UVlt.d.ts} +2 -0
- package/dist/{targets-Du5_4T1u.d.ts → targets-DnVNZVQW.d.ts} +1 -1
- package/dist/targets.d.ts +17 -32
- package/dist/targets.js +20 -54
- package/dist/targets.js.map +1 -1
- package/dist/tiling.d.ts +114 -0
- package/dist/tiling.js +40 -0
- package/dist/tiling.js.map +1 -0
- package/package.json +6 -2
- package/dist/chunk-AVMZIXGO.js.map +0 -1
- package/dist/chunk-VKB3UWKX.js.map +0 -1
package/dist/scene.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { h as SceneItem, O as Orient, S as Scene, E as Edge,
|
|
2
|
-
export { C as ColumnPlace,
|
|
1
|
+
import { F as FloatAnchorAt, h as FloatAnchor, K as Kind, i as ZoneAccepts, j as SceneItem, O as Orient, S as Scene, E as Edge, d as Side, R as RailMode, Z as Zone, k as SolveOptions, b as SceneLayout, g as SceneRefusal, l as SceneTargetOptions, f as SceneTarget } from './model-CuE-ML-f.js';
|
|
2
|
+
export { C as ColumnPlace, m as ColumnTemplate, D as DEFAULT_FLOAT_SIZE, n as DEFAULT_HIT_BAND, o as DEFAULT_RAIL_MAGNET, p as DEFAULT_STRIP, q as DockPlace, r as FLOAT_ANCHORS, s as FloatAnchorOffset, t as FloatPlace, u as FloatResize, P as Place, v as RAIL_MODES, w as RAIL_STRIP_MIN, x as RAIL_VISIBILITIES, y as RailDropPolicy, z as RailPlace, A as RailSpec, B as RailVisibility, G as ResizeEdges, H as ResizeLimit, I as SIDES, J as SceneAfter, L as SceneChrome, M as SceneEdgeLayout, N as SceneFloat, Q as SceneItemLayout, T as SceneNote, e as SceneNoteCode, a as ScenePlace, U as SceneRailLayout, V as SceneRead, c as StoredScene, W as StoredSceneEdge, X as StoredSceneFloat, Y as StoredSceneItem, _ as ZONES, $ as canFold, a0 as close, a1 as dockHome, a2 as fitResize, a3 as floatAt, a4 as fold, a5 as homeFor, a6 as keep, a7 as lift, a8 as moveTo, a9 as open, aa as orient, ab as raise, ac as readScene, ad as resize, ae as setRailMode, af as setSide, ag as storeScene, ah as use } from './model-CuE-ML-f.js';
|
|
3
3
|
import { S as Size, R as Rect } from './geometry-Bf37LbCT.js';
|
|
4
4
|
export { F as FloatFit, f as fitFloat } from './float-fit-DCYxRMru.js';
|
|
5
|
-
import './target-
|
|
5
|
+
import { T as Target } from './target-fhD5UVlt.js';
|
|
6
6
|
import './model-X7eUaKlA.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -10,6 +10,8 @@ import './model-X7eUaKlA.js';
|
|
|
10
10
|
* zone and forms, whether a side edge is a toolbar bar, and how an item floats (its orient, size and form). Pure.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
/** The name of a float's anchor, with or without an offset: `"content-top-right"` for `{ at: "content-top-right", dy: 12 }`. */
|
|
14
|
+
declare const anchorName: (anchor: FloatAnchorAt) => FloatAnchor;
|
|
13
15
|
/** Whether `edge` takes kind `kind` in `zone`: its `accepts`, narrowed by `zoneAccepts` when given (a zone not listed takes nothing). */
|
|
14
16
|
declare const zoneTakes: (edge: {
|
|
15
17
|
readonly accepts: readonly Kind[];
|
|
@@ -20,6 +22,15 @@ declare const zonesTaking: (edge: {
|
|
|
20
22
|
readonly accepts: readonly Kind[];
|
|
21
23
|
readonly zoneAccepts?: ZoneAccepts;
|
|
22
24
|
}, kind: Kind) => Zone[];
|
|
25
|
+
/**
|
|
26
|
+
* Whether `edge` takes `kind` anywhere: its `accepts` lists it and at least one of its zones takes it (`zoneTakes`). An
|
|
27
|
+
* edge whose zones take nothing for the kind (`zoneAccepts: {}`) takes it nowhere, exactly as one whose `accepts` lacks
|
|
28
|
+
* it: the one test drop targets and refusals ask. The stored form and `readScene` keep reading `accepts` itself.
|
|
29
|
+
*/
|
|
30
|
+
declare const edgeTakes: (edge: {
|
|
31
|
+
readonly accepts: readonly Kind[];
|
|
32
|
+
readonly zoneAccepts?: ZoneAccepts;
|
|
33
|
+
}, kind: Kind) => boolean;
|
|
23
34
|
/** How the rails of `side` show their items (`Scene.railModes`, default `"titles"`); top and bottom have no rails. */
|
|
24
35
|
declare const railModeOf: (scene: Scene, side: Side) => RailMode;
|
|
25
36
|
/**
|
|
@@ -137,14 +148,97 @@ declare const virtualEdgeId: (kind: "column" | "rail", side: ColumnSide) => stri
|
|
|
137
148
|
*/
|
|
138
149
|
declare function placeTargetId(place: PlaceLike, item: string): string | null;
|
|
139
150
|
|
|
151
|
+
/**
|
|
152
|
+
* `targets(scene, dragged, { previous, endReach, floatSize })`: every drop target for one dragged item, in the shape
|
|
153
|
+
* `@n-uf/motion/drag` takes (`id`, `priority`, `hit`, `slot?`, `free?`). Each target's `after(point, grab)` is the scene
|
|
154
|
+
* a release there commits and its layout, `solve(after.scene, { previous })`: the host draws every item from that layout
|
|
155
|
+
* during the preview (C22), so the preview is the result by construction.
|
|
156
|
+
*
|
|
157
|
+
* One model makes every docked target and refusal: **edge → zones → slots → tiles**, then one ordered
|
|
158
|
+
* filter.
|
|
159
|
+
*
|
|
160
|
+
* - **Edges.** Every edge, empty or occupied, and two virtual edges per side: the column lines and the rail.
|
|
161
|
+
* - **Zones.** Each edge's start, center and end zones have an extent along it. Where items keep their length and the
|
|
162
|
+
* zones only align them (bars, compact rails, side toolbar bars) the extents are the edge's thirds; where items fill
|
|
163
|
+
* the edge (panel columns) a zone's extent is the span the solver gives it: a plain column is one zone, a tray column
|
|
164
|
+
* its panels' span and its tray's (`EDGE_KINDS`, the only data keyed on the kind of edge). The outer extents reach
|
|
165
|
+
* `endReach` past the edge's ends.
|
|
166
|
+
* - **The seen geometry.** Every tile is laid in one layout: the committed one, the item in place, as the user sees it
|
|
167
|
+
* (lines, zone extents, ownership, bands). A place counts in the scene with the item lifted (a gap's `at`, a column's
|
|
168
|
+
* or rail's `ring`); its `after` is the solved drop. An edge the lift deletes offers nothing: the item's own column
|
|
169
|
+
* collapses into home. A zone where items keep their length reaches over the cards seen in it.
|
|
170
|
+
* - **Slots.** A zone's insertion lines (`gap:<edge>:<zone>:<at>`; on an edge with no members at all a zone has one,
|
|
171
|
+
* `strip:<edge>:<zone>`). The item's own place is an interval, its own rect along the edge (its » entry in the menu):
|
|
172
|
+
* home. The home slot's line lies at both ends of it, so the gaps right beside it are home's (the same move).
|
|
173
|
+
* - **Tiles.** A zone's extent split halfway between its slots' lines (lines that lie past the extent are spread into
|
|
174
|
+
* it); the own interval keeps exactly its length. Panel bodies don't split the tiling: clipping takes them out, and a
|
|
175
|
+
* slot whose tile is all body has no room. Across: the edge's thickness (the larger of seen and after the drop), an
|
|
176
|
+
* empty edge's strip depth (`Edge.strip`, default 24, inward), a compact rail's `RAIL_REACH` further inward.
|
|
177
|
+
* - **Filter**, in order: (i) the edge and zone take the kind (`accepts`, `zoneAccepts`), and an empty side column opens
|
|
178
|
+
* only through its start zone; (ii) the drop fits (C29: no » entry, no new overflow or `too-wide`, every fixed item
|
|
179
|
+
* keeps its form, place and least length, a title bar's title its natural width with the toolbar in its first form;
|
|
180
|
+
* the slot covers no chrome or reserved rect). A slot (i) or (ii) removes is a refusal over its own tile, with that
|
|
181
|
+
* reason (`refusals()`). (iii) Space ownership and clipping (`EDGE_KINDS`): owned > virtual > overreach. A zone's
|
|
182
|
+
* room loses its reserved rects and what edges ranked before it own (in `solve`'s laying order); a zone with no room,
|
|
183
|
+
* or a slot with none in reach, isn't offered. Each tile's owned part is cut clear of the tiles before it, of what
|
|
184
|
+
* outranks its edge, of its panel bodies, of every fixed item that doesn't grow and of the chrome; clipping changes a
|
|
185
|
+
* slot's shape, never who owns it, so every piece left is the slot's (`hits`, `hit` the largest); then the virtual
|
|
186
|
+
* edges take what no edge owns; then each overreach takes what is left and joins its owned part where it meets it
|
|
187
|
+
* whole. Refused places own nothing: they take what the surviving tiles and the other edges' seen rects leave. A
|
|
188
|
+
* stretch is owned by what the user sees there; if the owner has no slot there, it refuses. Slots that are the same
|
|
189
|
+
* move are one (home's, where one of them is home). (iv) `blocked` rects are `none:<i>`.
|
|
190
|
+
*
|
|
191
|
+
* Ids: `gap:<edge>:<zone>:<at>` (priority 2), `strip:<edge>:<zone>` (2), `column:<side>:<ring>` (2), `rail:<side>:<ring>`
|
|
192
|
+
* (1), `none:<i>` (1), `float:<id>` (3, free). A slot that would put the item back where it is keeps its id with place
|
|
193
|
+
* `home` (no slot, nothing committed); `home:<id>` (1) is emitted too, over the same tile (its own rect when no slot is
|
|
194
|
+
* its home), for hosts that read it. A floating item has no home: a move inside its own rect is a float move.
|
|
195
|
+
*
|
|
196
|
+
* - `column:<side>:<ring>`: a new column on each column line of a side whose `scene.columns[side]` takes the kind
|
|
197
|
+
* (outside the outermost open column, between two, inside the innermost; on a side with none, at the content's
|
|
198
|
+
* edge), up to `COLUMN_REACH` px each way (two lines nearer than that meet halfway), only where the new column shows
|
|
199
|
+
* open (elsewhere refused).
|
|
200
|
+
* - `rail:<side>:<ring>`: docking folded into a side's rail (its rail and its template take the kind), before each
|
|
201
|
+
* folded column's segments and after the last, or, with no rail shown, the outer `RAIL_EDGE` px from the side's
|
|
202
|
+
* outer edge (the window's, an inset's strip included; flush after the side's outside bars), landing where the rail
|
|
203
|
+
* lands (`SceneLayout.railPlaces`). The outermost column line's zone starts where it ends. For a kind with a rail
|
|
204
|
+
* drop policy (`Scene.railDrop`), the side's rail is a drop strip instead, spring-loaded, owning its rect
|
|
205
|
+
* (`./targets/rail-strip`); on a side with no declared rail, its rail is its outermost column that takes the kind,
|
|
206
|
+
* drawn as a rail once the item docks in it folded.
|
|
207
|
+
* - `float:<id>`: when `floatKinds` lists the kind, the whole plane: the landing is the float with the pointer holding
|
|
208
|
+
* it at `grab` (default its middle), in the stage and clear of the docked items, the bars and the chrome. Its orient:
|
|
209
|
+
* `options.floatOrient`, else its float's, else the item's (`floatOrientOf`). Its size: `options.floatSize`, else its
|
|
210
|
+
* float's size, else `floatSizeOf`.
|
|
211
|
+
*
|
|
212
|
+
* `stops(scene, id)` orders the same targets (no home, no none) for "Move to ›" and the arrow keys.
|
|
213
|
+
*
|
|
214
|
+
* A dropped item counts as just used (`use`). An unknown or closed item has no targets; a fixed item has none either,
|
|
215
|
+
* but on an edge that `moves: "side"` (an anchor): `side:<other side>` (2), over the place its edge takes there
|
|
216
|
+
* (`setSide`), and `home:<id>` over its own rect (`./targets/anchor`).
|
|
217
|
+
*
|
|
218
|
+
* The phases live in `./targets/`: `kinds` (`EDGE_KINDS`), `model` (the shapes), `filter` (the drag's context and
|
|
219
|
+
* filter ii), `edges` and `virtual` (generation), `ownership` and `tiles` (filter iii and clipping).
|
|
220
|
+
*/
|
|
221
|
+
|
|
140
222
|
declare function targets(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneTarget[];
|
|
141
223
|
/**
|
|
142
224
|
* `refusals(scene, dragged, options?)`: the places a drop of `dragged` is refused, so a host can say so at the pointer
|
|
143
225
|
* (a tint and "No room here") instead of showing a slot elsewhere: each slot the filter removed, over its own tile,
|
|
144
|
-
* `not-accepted` where the edge or zone doesn't take the kind, `no-room` where the drop wouldn't fit.
|
|
145
|
-
* refusal
|
|
226
|
+
* `not-accepted` where the edge or zone doesn't take the kind, `no-room` where the drop wouldn't fit. An edge that takes
|
|
227
|
+
* the kind in no zone is one refusal over its drawn rect (fixed items included) less what targets own; every refusal
|
|
228
|
+
* lies in the stage, a zone's inside its edge's ends. A release over a refusal commits nothing: the item goes home.
|
|
146
229
|
*/
|
|
147
230
|
declare function refusals(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneRefusal[];
|
|
231
|
+
/** A refusal in the pick's shape: `refuse: true`, at priority 2 (it never lies under a target, so only the float is less precise). */
|
|
232
|
+
interface SceneRefusalTarget extends Target {
|
|
233
|
+
readonly refuse: true;
|
|
234
|
+
readonly refusal: SceneRefusal;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* `refusalTargets(refusals)`: each refusal as a target for `@n-uf/motion/drag`'s drag intent (`refuse: true`, its
|
|
238
|
+
* pieces as `hits`). Pass them with the targets: the intent never holds or shows one, a release over one lands nowhere,
|
|
239
|
+
* and the frame's `refused` says which the pointer is over (`refused.refusal` is the `SceneRefusal`).
|
|
240
|
+
*/
|
|
241
|
+
declare function refusalTargets(list: readonly SceneRefusal[]): SceneRefusalTarget[];
|
|
148
242
|
/**
|
|
149
243
|
* `stops(scene, id, options?)`: the places for "Move to ›" and the arrow keys, in reading order, from the same targets
|
|
150
244
|
* (`home` and `none` left out): the left side outer to inner, the top bars, the bottom bars, the right side inner to
|
|
@@ -157,4 +251,4 @@ declare function refusals(scene: Scene, dragged: string, options?: SceneTargetOp
|
|
|
157
251
|
*/
|
|
158
252
|
declare function stops(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneTarget[];
|
|
159
253
|
|
|
160
|
-
export { Edge, Kind, Orient, RailMode, Scene, SceneItem, SceneLayout, SceneRefusal, SceneTarget, SceneTargetOptions, Side, SolveOptions, type TargetIdParts, Zone, ZoneAccepts, floatOrientOf, floatSizeOf, isOutsideSideBar, isSideBar, parseTargetId, placeTargetId, railModeOf, refusals, reservedRect, solve, stops, targetId, targets, virtualEdgeId, zoneTakes, zonesTaking };
|
|
254
|
+
export { Edge, FloatAnchor, FloatAnchorAt, Kind, Orient, RailMode, Scene, SceneItem, SceneLayout, SceneRefusal, type SceneRefusalTarget, SceneTarget, SceneTargetOptions, Side, SolveOptions, type TargetIdParts, Zone, ZoneAccepts, anchorName, edgeTakes, floatOrientOf, floatSizeOf, isOutsideSideBar, isSideBar, parseTargetId, placeTargetId, railModeOf, refusalTargets, refusals, reservedRect, solve, stops, targetId, targets, virtualEdgeId, zoneTakes, zonesTaking };
|
package/dist/scene.js
CHANGED
|
@@ -3,13 +3,17 @@ import {
|
|
|
3
3
|
DEFAULT_HIT_BAND,
|
|
4
4
|
DEFAULT_RAIL_MAGNET,
|
|
5
5
|
DEFAULT_STRIP,
|
|
6
|
+
FLOAT_ANCHORS,
|
|
6
7
|
RAIL_MODES,
|
|
7
8
|
RAIL_STRIP_MIN,
|
|
8
9
|
RAIL_VISIBILITIES,
|
|
9
10
|
SIDES,
|
|
10
11
|
ZONES,
|
|
12
|
+
anchorName,
|
|
13
|
+
canFold,
|
|
11
14
|
close,
|
|
12
15
|
dockHome,
|
|
16
|
+
edgeTakes,
|
|
13
17
|
fitResize,
|
|
14
18
|
floatAt,
|
|
15
19
|
floatOrientOf,
|
|
@@ -28,6 +32,7 @@ import {
|
|
|
28
32
|
railModeOf,
|
|
29
33
|
raise,
|
|
30
34
|
readScene,
|
|
35
|
+
refusalTargets,
|
|
31
36
|
refusals,
|
|
32
37
|
reservedRect,
|
|
33
38
|
resize,
|
|
@@ -42,7 +47,7 @@ import {
|
|
|
42
47
|
virtualEdgeId,
|
|
43
48
|
zoneTakes,
|
|
44
49
|
zonesTaking
|
|
45
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-2PWDUBPG.js";
|
|
46
51
|
import {
|
|
47
52
|
fitFloat
|
|
48
53
|
} from "./chunk-AE3BWTAE.js";
|
|
@@ -52,13 +57,17 @@ export {
|
|
|
52
57
|
DEFAULT_HIT_BAND,
|
|
53
58
|
DEFAULT_RAIL_MAGNET,
|
|
54
59
|
DEFAULT_STRIP,
|
|
60
|
+
FLOAT_ANCHORS,
|
|
55
61
|
RAIL_MODES,
|
|
56
62
|
RAIL_STRIP_MIN,
|
|
57
63
|
RAIL_VISIBILITIES,
|
|
58
64
|
SIDES,
|
|
59
65
|
ZONES,
|
|
66
|
+
anchorName,
|
|
67
|
+
canFold,
|
|
60
68
|
close,
|
|
61
69
|
dockHome,
|
|
70
|
+
edgeTakes,
|
|
62
71
|
fitFloat,
|
|
63
72
|
fitResize,
|
|
64
73
|
floatAt,
|
|
@@ -78,6 +87,7 @@ export {
|
|
|
78
87
|
railModeOf,
|
|
79
88
|
raise,
|
|
80
89
|
readScene,
|
|
90
|
+
refusalTargets,
|
|
81
91
|
refusals,
|
|
82
92
|
reservedRect,
|
|
83
93
|
resize,
|
package/dist/stack.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { d as StackInput, F as FitOptions, b as StackFit, e as StackItem } from './model-X7eUaKlA.js';
|
|
2
2
|
export { C as CrossLimits, D as DEFAULT_MENU, f as DEFAULT_RAIL, G as GroupFormKind, M as MainSize, P as PanelFormKind, g as PlacedStackItem, h as StackAxis, a as StackForm, S as StackFormKind, i as StackMenu, c as StackNote, j as StackNoteCode, k as StackStep, W as WrapSpec, l as formCrossMin, m as formFitsCross, n as formMain, o as formSetsCross, w as withItem, p as wrapCross, q as wrapLines, r as wrapRows } from './model-X7eUaKlA.js';
|
|
3
3
|
import { R as Rect, P as Point, S as Size } from './geometry-Bf37LbCT.js';
|
|
4
|
-
import { T as Target } from './target-
|
|
4
|
+
import { T as Target } from './target-fhD5UVlt.js';
|
|
5
5
|
import { F as FloatFit$1 } from './float-fit-DCYxRMru.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -20,6 +20,8 @@ interface Target {
|
|
|
20
20
|
readonly slot?: Rect;
|
|
21
21
|
readonly label?: string;
|
|
22
22
|
readonly free?: boolean;
|
|
23
|
+
/** A refusal, not a target: it takes part in the pick under the pointer, but nothing lands on it (`refusalTargets`). */
|
|
24
|
+
readonly refuse?: true;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
export type { Target as T };
|
package/dist/targets.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { T as Target } from './target-
|
|
1
|
+
import { T as Target } from './target-fhD5UVlt.js';
|
|
2
2
|
import { R as Rect, P as Point, S as Size } from './geometry-Bf37LbCT.js';
|
|
3
3
|
import { D as DeskState, g as Layout, a as Construction, O as Options } from './constructions-Cbz7uEAZ.js';
|
|
4
4
|
import { Place, Arrangement, HostId, HostSpec, GroupSize } from './toolbar.js';
|
|
5
|
-
import { d as PanelTarget, s as PanelStopsOptions, r as PanelStop } from './targets-
|
|
5
|
+
import { d as PanelTarget, s as PanelStopsOptions, r as PanelStop } from './targets-DnVNZVQW.js';
|
|
6
|
+
import { P as PaneSide, a as PaneCenter, b as PaneRegion } from './regions-Db_RyT4P.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Each desk construction's drop targets, as pure functions: from the state with the dragged item lifted out, a list
|
|
@@ -182,46 +183,30 @@ declare function keyboardStops(targets: readonly PanelTarget[], options?: PanelS
|
|
|
182
183
|
declare function keyboardStops<G extends string>(targets: readonly (ToolbarTarget<G> | ToolbarFloatTarget<G>)[], options?: KeyboardStopsOptions<G>): KeyboardStop<G>[];
|
|
183
184
|
|
|
184
185
|
/**
|
|
185
|
-
* A pane's drop zones
|
|
186
|
-
*
|
|
187
|
-
* center. The five zones tile the pane with no gaps and no overlaps.
|
|
188
|
-
*
|
|
189
|
-
* Meant for `@n-uf/motion/drag`'s `placeOf(target, point, previous)`: one target per pane, its place the zone under
|
|
190
|
-
* the pointer, the previous zone held for `hysteresis` px past its boundary so a pointer resting on a boundary
|
|
191
|
-
* doesn't flicker. A zone that takes no drop is the consumer's to answer with a null place.
|
|
186
|
+
* A pane's drop zones, the old names of `@n-uf/placement/tiling`'s pane drop regions. Each wraps the tiling function
|
|
187
|
+
* and maps the old option names; all are deprecated and go when this entry does.
|
|
192
188
|
*/
|
|
193
189
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
190
|
+
/** @deprecated Use `PaneRegion` from `@n-uf/placement/tiling`. */
|
|
191
|
+
type PaneZone = PaneRegion;
|
|
192
|
+
/** @deprecated Use `PANE_SIDES` from `@n-uf/placement/tiling`. */
|
|
193
|
+
declare const PANE_EDGES: readonly PaneSide[];
|
|
194
|
+
/** @deprecated Use `PaneRegionOptions` from `@n-uf/placement/tiling` (`center`, `centerX`, `centerY`, `centerMin`). */
|
|
197
195
|
interface PaneZoneOptions {
|
|
198
|
-
/** The center rectangle's share of each pane axis (0.05 to 0.95); `centreX` / `centreY` override one axis. */
|
|
199
196
|
readonly centre?: number;
|
|
200
197
|
readonly centreX?: number;
|
|
201
198
|
readonly centreY?: number;
|
|
202
|
-
/** The least the center spans on either axis, px (a small pane keeps a usable center). */
|
|
203
199
|
readonly centreMin?: number;
|
|
204
|
-
/** How far past its boundary the previous zone holds, px. */
|
|
205
200
|
readonly hysteresis?: number;
|
|
206
|
-
/** Device pixels per px: the center's edges snap to that grid, as the browser draws them. */
|
|
207
201
|
readonly pixelRatio?: number;
|
|
208
202
|
}
|
|
203
|
+
/** @deprecated Use `PANE_REGION_DEFAULTS` from `@n-uf/placement/tiling`. */
|
|
209
204
|
declare const PANE_ZONE_DEFAULTS: Required<Omit<PaneZoneOptions, "centreX" | "centreY">>;
|
|
210
|
-
/**
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
readonly right: number;
|
|
217
|
-
readonly bottom: number;
|
|
218
|
-
}
|
|
219
|
-
/** Where the center rectangle of a pane of `size` lies, by these options. */
|
|
220
|
-
declare function paneCentre(size: Size, options?: PaneZoneOptions): PaneCentre;
|
|
221
|
-
/**
|
|
222
|
-
* The zone of `rect` (a pane, in the same coordinates as `point`) the point is in. With a `previous` zone, the point
|
|
223
|
-
* has to be `hysteresis` px past that zone's boundary before the zone changes: no time-based debounce, only geometry.
|
|
224
|
-
*/
|
|
225
|
-
declare function paneZone(rect: Rect, point: Point, previous?: PaneZone | null, options?: PaneZoneOptions): PaneZone;
|
|
205
|
+
/** @deprecated Use `PaneCenter` from `@n-uf/placement/tiling`. */
|
|
206
|
+
type PaneCentre = PaneCenter;
|
|
207
|
+
/** @deprecated Use `paneCenter` from `@n-uf/placement/tiling`. */
|
|
208
|
+
declare const paneCentre: (size: Size, options?: PaneZoneOptions) => PaneCenter;
|
|
209
|
+
/** @deprecated Use `paneRegion` from `@n-uf/placement/tiling`. */
|
|
210
|
+
declare const paneZone: (rect: Rect, point: Point, previous?: PaneZone | null, options?: PaneZoneOptions) => PaneZone;
|
|
226
211
|
|
|
227
212
|
export { type Allows, type DeskDrop, type DeskTarget, type DeskTargetInput, type FloatTargetInput, HOST_READING_ORDER, type HostTargetsInput, type KeyboardStop, type KeyboardStopsOptions, LINE_REACH, type Made, PANE_EDGES, PANE_ZONE_DEFAULTS, type PaneCentre, type PaneZone, type PaneZoneOptions, SNAP, Target, type ToolbarFloatTarget, type ToolbarTarget, ZONE_REACH, deskDrop, deskTargets, floatTarget, hostTargets, keyboardStops, paneCentre, paneZone };
|
package/dist/targets.js
CHANGED
|
@@ -23,7 +23,13 @@ import {
|
|
|
23
23
|
treeRails,
|
|
24
24
|
treeShown,
|
|
25
25
|
treeTiles
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-NF7RYK3U.js";
|
|
27
|
+
import {
|
|
28
|
+
PANE_REGION_DEFAULTS,
|
|
29
|
+
PANE_SIDES,
|
|
30
|
+
paneCenter,
|
|
31
|
+
paneRegion
|
|
32
|
+
} from "./chunk-R3AAANRY.js";
|
|
27
33
|
import {
|
|
28
34
|
HOST_LABEL,
|
|
29
35
|
ZONES,
|
|
@@ -410,59 +416,19 @@ function toolbarStops(targets, options) {
|
|
|
410
416
|
}
|
|
411
417
|
|
|
412
418
|
// src/targets/zones.ts
|
|
413
|
-
var PANE_EDGES =
|
|
414
|
-
var
|
|
415
|
-
var
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
}
|
|
427
|
-
function depths(p, c) {
|
|
428
|
-
return [
|
|
429
|
-
{ zone: "top", depth: (c.top - p.y) / Math.max(c.top, 1) },
|
|
430
|
-
{ zone: "right", depth: (p.x - c.right) / Math.max(c.width - c.right, 1) },
|
|
431
|
-
{ zone: "bottom", depth: (p.y - c.bottom) / Math.max(c.height - c.bottom, 1) },
|
|
432
|
-
{ zone: "left", depth: (c.left - p.x) / Math.max(c.left, 1) }
|
|
433
|
-
];
|
|
434
|
-
}
|
|
435
|
-
function rawZone(p, c) {
|
|
436
|
-
if (p.x >= c.left && p.x <= c.right && p.y >= c.top && p.y <= c.bottom) return "center";
|
|
437
|
-
let best = "center";
|
|
438
|
-
let deepest = 0;
|
|
439
|
-
for (const d of depths(p, c)) {
|
|
440
|
-
if (d.depth > deepest) {
|
|
441
|
-
deepest = d.depth;
|
|
442
|
-
best = d.zone;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
return best;
|
|
446
|
-
}
|
|
447
|
-
function toward(p, zone, by, c) {
|
|
448
|
-
if (zone === "left") return { x: p.x - by, y: p.y };
|
|
449
|
-
if (zone === "right") return { x: p.x + by, y: p.y };
|
|
450
|
-
if (zone === "top") return { x: p.x, y: p.y - by };
|
|
451
|
-
if (zone === "bottom") return { x: p.x, y: p.y + by };
|
|
452
|
-
const dx = c.width / 2 - p.x;
|
|
453
|
-
const dy = c.height / 2 - p.y;
|
|
454
|
-
const len = Math.hypot(dx, dy);
|
|
455
|
-
if (len <= by || len === 0) return { x: c.width / 2, y: c.height / 2 };
|
|
456
|
-
return { x: p.x + dx / len * by, y: p.y + dy / len * by };
|
|
457
|
-
}
|
|
458
|
-
function paneZone(rect2, point, previous = null, options = {}) {
|
|
459
|
-
const c = paneCentre(rect2, options);
|
|
460
|
-
const p = { x: point.x - rect2.x, y: point.y - rect2.y };
|
|
461
|
-
const raw = rawZone(p, c);
|
|
462
|
-
const by = Math.max(0, options.hysteresis ?? PANE_ZONE_DEFAULTS.hysteresis);
|
|
463
|
-
if (previous === null || by === 0 || previous === raw) return raw;
|
|
464
|
-
return rawZone(toward(p, previous, by, c), c) === previous ? previous : raw;
|
|
465
|
-
}
|
|
419
|
+
var PANE_EDGES = PANE_SIDES;
|
|
420
|
+
var R = PANE_REGION_DEFAULTS;
|
|
421
|
+
var PANE_ZONE_DEFAULTS = { centre: R.center, centreMin: R.centerMin, hysteresis: R.hysteresis, pixelRatio: R.pixelRatio };
|
|
422
|
+
var regionOptions = (o) => ({
|
|
423
|
+
...o.centre === void 0 ? {} : { center: o.centre },
|
|
424
|
+
...o.centreX === void 0 ? {} : { centerX: o.centreX },
|
|
425
|
+
...o.centreY === void 0 ? {} : { centerY: o.centreY },
|
|
426
|
+
...o.centreMin === void 0 ? {} : { centerMin: o.centreMin },
|
|
427
|
+
...o.hysteresis === void 0 ? {} : { hysteresis: o.hysteresis },
|
|
428
|
+
...o.pixelRatio === void 0 ? {} : { pixelRatio: o.pixelRatio }
|
|
429
|
+
});
|
|
430
|
+
var paneCentre = (size, options = {}) => paneCenter(size, regionOptions(options));
|
|
431
|
+
var paneZone = (rect2, point, previous = null, options = {}) => paneRegion(rect2, point, previous, regionOptions(options));
|
|
466
432
|
export {
|
|
467
433
|
HOST_READING_ORDER,
|
|
468
434
|
LINE_REACH,
|