@n-uf/placement 26.11.20 → 26.11.22

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.
@@ -1,6 +1,6 @@
1
1
  import { R as Rect, S as Size, P as Point } from './geometry-mL-GTRti.js';
2
2
  import { T as Target } from './target-D3PiLg44.js';
3
- import { C as CrossLimits, a as StackForm, S as StackFormKind, b as StackFit, c as StackNote } from './model-DU7MovDa.js';
3
+ import { C as CrossLimits, a as StackForm, S as StackFormKind, b as StackFit, c as StackNote } from './model-DPTu2EtG.js';
4
4
 
5
5
  /**
6
6
  * The scene's shapes: one model of a whole window. A scene is a stage (the window's inner rect), the edges along its
@@ -52,8 +52,24 @@ interface SceneItem {
52
52
  readonly closed?: boolean;
53
53
  /** Its zone in its edge (default start). */
54
54
  readonly align?: Zone;
55
- /** Its size as a float: `floatAt` with no rect uses it, and a float drop sets it. */
55
+ /**
56
+ * Its give-way priority in its edge (default: the edge's `priority`, else 0). When an edge runs short, items step down
57
+ * their forms (row, wrap in a column, icons, then the edge's » menu) lowest priority first, ties to the one used longest
58
+ * ago; room coming back brings them up in the exact reverse order, each to its remembered form. It adds to every one
59
+ * of its forms' `rank` (`./stack`), so a host may still rank single forms. Give the controls that must stay out of the
60
+ * menu the highest priority.
61
+ */
62
+ readonly priority?: number;
63
+ /**
64
+ * Its size as a float: `floatAt` with no rect uses it, and a float drop sets it. Without it, a float takes its first
65
+ * form's natural size along its orient (`floatSizeOf`), or `DEFAULT_FLOAT_SIZE` when that form grows (a panel's card).
66
+ */
56
67
  readonly floatSize?: Size;
68
+ /**
69
+ * Which of its forms it uses as a float when the float names no `orient` (`floatOrientOf`). Default: the axis of its
70
+ * first form, the first of `forms.row` / `forms.column` it declares (a group declared row first floats as a row).
71
+ */
72
+ readonly floatOrient?: Orient;
57
73
  /**
58
74
  * The least a float of it is shrunk to: a float larger than the region floats lie in is laid out at
59
75
  * `max(floatMin, min(its size, the region))` each way. A floor wider than the region keeps it at the region's left
@@ -128,7 +144,10 @@ interface Edge {
128
144
  readonly column?: boolean;
129
145
  /**
130
146
  * An anchor edge (a left or right edge that takes nothing, holding a fixed item such as a thumbnail strip) lies outside
131
- * `Scene.inset` and the gutter: at the window's side, the inset after it, toward the content.
147
+ * `Scene.inset` and the gutter: at the window's side, the inset after it, toward the content. A full top or bottom bar
148
+ * with it lies at the window's edge, full width, the inset after it; the side edges then run between such bars (an
149
+ * anchor through the inset beside them). On a left or right side, from the window's side inward: its toolbar bars
150
+ * with it (`isOutsideSideBar`), the side's rail, its anchors, the inset, the columns.
132
151
  */
133
152
  readonly outsideInset?: boolean;
134
153
  /**
@@ -136,6 +155,11 @@ interface Edge {
136
155
  * into its side's rail, in give-way order with the columns (its items' ages). It is never deleted.
137
156
  */
138
157
  readonly giveWay?: boolean;
158
+ /**
159
+ * The default give-way priority of its items (`SceneItem.priority` wins; default 0): a title bar given a lower one has
160
+ * its toolbars step down before an item moved in from another bar would.
161
+ */
162
+ readonly priority?: number;
139
163
  }
140
164
  /** What a side's new columns are made from. */
141
165
  interface ColumnTemplate {
@@ -177,7 +201,7 @@ interface SceneFloat {
177
201
  readonly rect: Rect;
178
202
  /** Follow the content's side or corner until a drop gives it a real rect. */
179
203
  readonly anchor?: FloatAnchor;
180
- /** Which of the item's forms it uses (default `"column"`). */
204
+ /** Which of the item's forms it uses (default: the item's `floatOrientOf`). */
181
205
  readonly orient?: Orient;
182
206
  }
183
207
  interface Scene {
@@ -223,9 +247,10 @@ interface Scene {
223
247
  readonly left?: number;
224
248
  };
225
249
  /**
226
- * When `inset` applies (default `"always"`): `"docked"` keeps it only while something is docked beside the content (an
227
- * open column or a rail: a left or right edge that takes something, with an item that isn't closed; an anchor alone
228
- * doesn't count); with nothing there, the content is the whole stage.
250
+ * When `inset` applies (default `"always"`): `"docked"` keeps it only while a panel is docked beside the content (an
251
+ * open panel column or a rail showing panels: a left or right edge that takes something, with an item that isn't
252
+ * closed or fixed and whose first column form is `open`, `header` or `rail`). Bars, toolbar groups and an anchor
253
+ * never count, wherever they sit; with no panel there, the content is the whole stage.
229
254
  */
230
255
  readonly insetWhen?: "always" | "docked";
231
256
  /** Space after each left or right edge and each rail that takes room, toward the content, px (default 0). */
@@ -393,6 +418,24 @@ declare const DEFAULT_STRIP = 24;
393
418
  declare const DEFAULT_HIT_BAND = 24;
394
419
  /** A float's size when neither the item nor the call gives one, px. */
395
420
  declare const DEFAULT_FLOAT_SIZE: Size;
421
+ /**
422
+ * A left or right toolbar bar outside the inset: told from a column edge by its kinds, it takes something and nothing
423
+ * the side's columns or its rail take (`Scene.columns[side].accepts`, `Scene.rails[side].accepts`); an anchor takes
424
+ * nothing. A side with neither a column template nor a rail has nothing to tell them apart by, so no edge there is a
425
+ * bar. It lies outermost on its side, before the side's rail.
426
+ */
427
+ declare function isOutsideSideBar(scene: Scene, e: Edge): boolean;
428
+ /**
429
+ * The orient a float of `item` takes when it names none: its `floatOrient`, else the axis of its first form (the first
430
+ * of `forms.row` / `forms.column` it declares with any form), else column.
431
+ */
432
+ declare const floatOrientOf: (item: SceneItem) => Orient;
433
+ /**
434
+ * A float's size when nothing gives one: the item's `floatSize`, else its first form's natural size along `orient`
435
+ * (default `floatOrientOf`), else `DEFAULT_FLOAT_SIZE` when that form grows (a panel's card has no natural float length)
436
+ * or the item has no form there.
437
+ */
438
+ declare function floatSizeOf(item: SceneItem, orient?: Orient): Size;
396
439
 
397
440
  /**
398
441
  * The scene's pure changes. Each returns a new scene and leaves the one it was given as it was; a change that can't
@@ -407,7 +450,8 @@ declare const DEFAULT_FLOAT_SIZE: Size;
407
450
  * and its side's rings are closed up.
408
451
  * - `homeFor(scene, id, start)`: the place a start scene gives the item, for `moveTo`.
409
452
  * - `floatAt(scene, id, rect?, orient?)`: floats it on top at `rect` (its size becomes `floatSize`); with no rect, at
410
- * its `floatSize` (or the default size) anchored to the content's top-right corner.
453
+ * its `floatSizeOf` size anchored to the content's top-right corner: its `floatSize`, else its form's natural size
454
+ * along its orient (the float's, `orient`, else `floatOrientOf`), else the default size.
411
455
  * - `fold(scene, id, on)`: folded by hand starts it at its second form (`from: 1`); unfolding clears `from`.
412
456
  * - `use(scene, id)`: the newest age. Under `previous` it reshapes nothing.
413
457
  * - `keep(scene, id, on)`, `open(scene, id)`, `close(scene, id)`.
@@ -577,16 +621,19 @@ declare function readScene(data: unknown, base: Scene): SceneRead;
577
621
  * - `strip:<edge>` (2): an empty edge that accepts the kind (its start zone takes it): a strip `Edge.strip` px (default
578
622
  * 24) deep along its side, inside the content and clear of overlay edges, so never over a docked edge or a panel's
579
623
  * body (a compact rail's strip alone stays at the window edge, its own place); a gap hit that spans it trims its ends,
580
- * and with nothing left it has no target. `after` shows the edge holding the item.
624
+ * and under 1 px left it has no target. Home covers all of the dragged item's own rect: a strip (a `rail:` strip
625
+ * too) keeps only what lies outside it. `after` shows the edge holding the item.
581
626
  * - `float:<id>` (3, free): when `floatKinds` lists the kind. The hit covers the whole plane; the landing is the float
582
627
  * with the pointer holding it at `grab` (default its middle), in the stage and clear of the docked items, the bars
583
- * and the chrome. Its size: `options.floatSize`, else its float's size, else the item's `floatSize`, else the default.
628
+ * and the chrome. Its orient: `options.floatOrient`, else its float's, else the item's (`floatOrientOf`). Its size:
629
+ * `options.floatSize`, else its float's size, else `floatSizeOf` (the item's `floatSize`, else its form's natural
630
+ * size along that orient, else the default).
584
631
  * - `column:<side>:<ring>` (2): a new column on each column line of a side whose `scene.columns[side]` takes the kind
585
632
  * (outside the outermost open column, between two, inside the innermost; on a side with none, at the content's
586
633
  * edge), `COLUMN_REACH` px each way, only where the new column shows open.
587
634
  * - `rail:<side>:<ring>` (1): docking folded into a side's rail (its rail and its template take the kind), before each
588
- * folded column's segments and after the last, or a strip `RAIL_EDGE` px deep at the side's outer edge when no rail
589
- * shows.
635
+ * folded column's segments and after the last, or a strip `RAIL_EDGE` px deep where the rail lands (flush after its
636
+ * outside toolbar bars, `isOutsideSideBar`, else at the window's side less the inset) when no rail shows.
590
637
  * - `none:<i>` (1): over each `scene.blocked` rect. It takes the pointer, and a release there commits nothing.
591
638
  * - `home:<id>` (1): over a docked item's own rect (or its » entry); a floating item has none, so a move inside its own
592
639
  * rect is a float move. A release there commits nothing. A gap, column line or rail drop that
@@ -630,6 +677,8 @@ interface SceneTargetOptions {
630
677
  readonly endReach?: number;
631
678
  /** The float's size for the float target. */
632
679
  readonly floatSize?: Size;
680
+ /** The float's orient for the float target (default: its float's, else the item's `floatOrientOf`). */
681
+ readonly floatOrient?: Orient;
633
682
  /** As `solve`'s: edge or item ids solved without `previous`, in every `after` too. */
634
683
  readonly fresh?: readonly string[];
635
684
  }
@@ -640,6 +689,26 @@ declare function targets(scene: Scene, dragged: string, options?: SceneTargetOpt
640
689
  * host that draws "no drop" areas reads them from here.
641
690
  */
642
691
  declare function reservedRect(scene: Scene, l: SceneLayout, id: string): Rect;
692
+ /** Where a drop of the dragged item is refused: a host shows "no room here" at the pointer, with no slot anywhere. */
693
+ interface SceneRefusal {
694
+ /** `refuse:<edge>:<zone>`. */
695
+ readonly id: string;
696
+ readonly edge: string;
697
+ readonly zone: Zone;
698
+ /** Where the pointer means it; never over a target's hit. */
699
+ readonly hit: Rect;
700
+ /** `no-room`: the zone takes the kind, but no gap of it fits (a title bar at the title's natural width, say). `not-accepted`: the edge or zone doesn't take the kind. */
701
+ readonly reason: "no-room" | "not-accepted";
702
+ }
703
+ /**
704
+ * `refusals(scene, dragged, options?)`: the places a drop of `dragged` is refused, so a host can say so at the pointer
705
+ * (a tint and "No room here") instead of showing a slot elsewhere. A bar's zone (its third, as `targets` picks zones)
706
+ * that has no target is refused: `no-room` when the zone takes the kind, `not-accepted` when it or the bar doesn't; a
707
+ * left or right edge that doesn't take the kind is refused as a whole (zone `start`). Each hit is cut clear of every
708
+ * target's hit (the float target aside), so a pointer over one has no target there but the float. A release over a
709
+ * refusal commits nothing: the item goes home.
710
+ */
711
+ declare function refusals(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneRefusal[];
643
712
  /**
644
713
  * `stops(scene, id, options?)`: the places for "Move to ›" and the arrow keys, in reading order, from the same targets
645
714
  * (`home` and `none` left out): the left side outer to inner, the top bars, the bottom bars, the right side inner to
@@ -647,4 +716,4 @@ declare function reservedRect(scene: Scene, l: SceneLayout, id: string): Rect;
647
716
  */
648
717
  declare function stops(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneTarget[];
649
718
 
650
- export { stops as $, ZONES as A, type ZoneAccepts as B, type ColumnPlace as C, DEFAULT_FLOAT_SIZE as D, type Edge as E, type FloatAnchor as F, close as G, dockHome as H, floatAt as I, fold as J, type Kind as K, homeFor as L, keep as M, lift as N, type Orient as O, type Place as P, moveTo as Q, type RailPlace as R, type Scene as S, open as T, orient as U, raise as V, readScene as W, reservedRect as X, resize as Y, type Zone as Z, setSide as _, type ScenePlace as a, storeScene as a0, targets as a1, use as a2, zoneTakes as a3, zonesTaking as a4, type SceneLayout as b, type StoredScene as c, type Side as d, type SceneNoteCode as e, type SceneTarget as f, type SolveOptions as g, type ColumnTemplate as h, DEFAULT_HIT_BAND as i, DEFAULT_STRIP as j, type DockPlace as k, type FloatPlace as l, type RailSpec as m, SIDES as n, type SceneAfter as o, type SceneEdgeLayout as p, type SceneFloat as q, type SceneItem as r, type SceneItemLayout as s, type SceneNote as t, type SceneRailLayout as u, type SceneRead as v, type SceneTargetOptions as w, type StoredSceneEdge as x, type StoredSceneFloat as y, type StoredSceneItem as z };
719
+ export { readScene as $, type StoredSceneItem as A, ZONES as B, type ColumnPlace as C, DEFAULT_FLOAT_SIZE as D, type Edge as E, type FloatAnchor as F, type ZoneAccepts as G, close as H, dockHome as I, floatAt as J, type Kind as K, floatOrientOf as L, floatSizeOf as M, fold as N, type Orient as O, type Place as P, homeFor as Q, type RailPlace as R, type Scene as S, isOutsideSideBar as T, keep as U, lift as V, moveTo as W, open as X, orient as Y, type Zone as Z, raise as _, type ScenePlace as a, refusals as a0, reservedRect as a1, resize as a2, setSide as a3, stops as a4, storeScene as a5, targets as a6, use as a7, zoneTakes as a8, zonesTaking as a9, type SceneLayout as b, type StoredScene as c, type Side as d, type SceneNoteCode as e, type SceneTarget as f, type SolveOptions as g, type ColumnTemplate as h, DEFAULT_HIT_BAND as i, DEFAULT_STRIP as j, type DockPlace as k, type FloatPlace as l, type RailSpec as m, SIDES as n, type SceneAfter as o, type SceneEdgeLayout as p, type SceneFloat as q, type SceneItem as r, type SceneItemLayout as s, type SceneNote as t, type SceneRailLayout as u, type SceneRead as v, type SceneRefusal as w, type SceneTargetOptions as x, type StoredSceneEdge as y, type StoredSceneFloat as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n-uf/placement",
3
- "version": "26.11.20",
3
+ "version": "26.11.22",
4
4
  "description": "Where things go: desk docks, rails and palettes, panel columns, toolbar groups, and the drop targets for each. Pure state in, rects out. No DOM, no framework, no motion.",
5
5
  "keywords": [
6
6
  "layout",