@n-uf/placement 26.11.20 → 26.11.21

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.
@@ -269,21 +269,35 @@ interface StackFit {
269
269
  * only when the stack overflows. `fitStack`'s `previous` reads it to tell room coming back from a change of ages.
270
270
  */
271
271
  readonly need?: number;
272
+ /**
273
+ * The give-way history: every step down from the items' starting forms to the forms chosen, in the order taken (items
274
+ * that went into the » menu together share a `batch`). `fitStack`'s `previous` carries it on, and room coming back
275
+ * undoes it from the last step: growing back is exactly the reverse of giving way.
276
+ */
277
+ readonly steps?: readonly StackStep[];
278
+ }
279
+ /** One give-way step: item `id` went from form `from` to form `to`; steps sharing a `batch` were taken together. */
280
+ interface StackStep {
281
+ readonly id: string;
282
+ readonly from: number;
283
+ readonly to: number;
284
+ readonly batch?: number;
272
285
  }
273
286
  /** What `fitStack` and `stackTargets` take besides the input. */
274
287
  interface FitOptions {
275
288
  /**
276
289
  * The fit the stack had before. While the forms it chose still fit, they are kept: a change of `used` ages alone (a press
277
290
  * on a header) reshapes nothing. Ages decide only who gives way anew (the length shrank, an item was added or opened),
278
- * and room that came back is used, but growing never re-ranks: the fresh fit is taken only if it is a pure gain (no
279
- * item's form is further down, one is further up) or the stack got wider across; otherwise room comes back in the
280
- * reverse of give-way order, and growth stops at the first item that can't grow: the item that gave way most recently
281
- * (highest rank, then `kept`, then the newest used, then the earlier in the stack) goes back to the nearest larger form
282
- * the stack fits with, even when that makes the stack shorter (the last item out of the menu takes the » entry with
283
- * it), and so on; when it fits no larger form, nothing behind it grows. Items in the menu still come out, alone or
284
- * together when only their leaving together fits, but only when that keeps the order: an item leaves only with every
285
- * menu item ahead of it, and only for a form no fewer steps down (from its `from`) than every item ahead of it that
286
- * isn't in the menu.
291
+ * and room that came back is used, but growing never re-ranks: the fresh fit is taken when the stack got wider across;
292
+ * otherwise room comes back by undoing the give-way history (`StackFit.steps`, carried on from fit to fit) from its
293
+ * last step: a batch that went into the » menu together comes out together, an item goes back to the nearest earlier
294
+ * form the stack fits with (the last item out of the menu takes the » entry with it), and the first step that can't
295
+ * be undone stops all growth. Growing back is exactly the reverse of giving way, the menu included: at every length
296
+ * the way back holds what the way down held, whatever presses changed the ages since; an item made `kept` after its
297
+ * step comes back in step order, it doesn't jump ahead. A `previous` without a history
298
+ * (built by hand, or by an older version) grows the old way: a fresh fit that is a pure gain, else the item that gave
299
+ * way most recently (highest rank, then `kept`, the newest used, the earlier in the stack) first, menu items out only
300
+ * while that keeps the order.
287
301
  * One px of room moves nothing. Results under `previous` depend on history: a shrink then a grow may end at another
288
302
  * arrangement than a fresh solve of the same input, and more room never undoes a growth along successive solves.
289
303
  * Growing back is meant for stacks of up to about 50 items (60 small menu items take about 9 ms; the cost grows with
@@ -298,4 +312,4 @@ interface FitOptions {
298
312
  readonly previous?: StackFit;
299
313
  }
300
314
 
301
- export { type CrossLimits as C, DEFAULT_MENU as D, type FitOptions as F, type GroupFormKind as G, type MainSize as M, type PanelFormKind as P, type StackFormKind as S, type WrapSpec as W, type StackForm as a, type StackFit as b, type StackNote as c, type StackInput as d, type StackItem as e, DEFAULT_RAIL as f, type PlacedStackItem as g, type StackAxis as h, type StackMenu as i, type StackNoteCode as j, formCrossMin as k, formFitsCross as l, formMain as m, formSetsCross as n, wrapCross as o, wrapLines as p, wrapRows as q, withItem as w };
315
+ export { type CrossLimits as C, DEFAULT_MENU as D, type FitOptions as F, type GroupFormKind as G, type MainSize as M, type PanelFormKind as P, type StackFormKind as S, type WrapSpec as W, type StackForm as a, type StackFit as b, type StackNote as c, type StackInput as d, type StackItem as e, DEFAULT_RAIL as f, type PlacedStackItem as g, type StackAxis as h, type StackMenu as i, type StackNoteCode as j, type StackStep as k, formCrossMin as l, formFitsCross as m, formMain as n, formSetsCross as o, wrapCross as p, wrapLines as q, wrapRows as r, withItem as w };
@@ -1,6 +1,6 @@
1
1
  import { P as Point, R as Rect } from './geometry-mL-GTRti.js';
2
- import { S as StackFormKind } from './model-DU7MovDa.js';
3
- import { S as Scene, a as ScenePlace, b as SceneLayout, c as StoredScene, Z as Zone, d as Side, e as SceneNoteCode, f as SceneTarget } from './targets-CYJN0Hba.js';
2
+ import { S as StackFormKind } from './model-DPTu2EtG.js';
3
+ import { S as Scene, a as ScenePlace, b as SceneLayout, c as StoredScene, Z as Zone, d as Side, e as SceneNoteCode, f as SceneTarget } from './targets-DRFuud5d.js';
4
4
  import './target-D3PiLg44.js';
5
5
 
6
6
  /**
@@ -13,8 +13,8 @@ import {
13
13
  storeScene,
14
14
  targets,
15
15
  use
16
- } from "./chunk-GCSVZGVX.js";
17
- import "./chunk-RUITEOZ7.js";
16
+ } from "./chunk-TFM4S3L3.js";
17
+ import "./chunk-RL3QB5SM.js";
18
18
  import {
19
19
  rect
20
20
  } from "./chunk-QMTNB2C3.js";
package/dist/scene.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { S as Scene, g as SolveOptions, b as SceneLayout } from './targets-CYJN0Hba.js';
2
- export { C as ColumnPlace, h as ColumnTemplate, D as DEFAULT_FLOAT_SIZE, i as DEFAULT_HIT_BAND, j as DEFAULT_STRIP, k as DockPlace, E as Edge, F as FloatAnchor, l as FloatPlace, K as Kind, O as Orient, P as Place, R as RailPlace, m as RailSpec, n as SIDES, o as SceneAfter, p as SceneEdgeLayout, q as SceneFloat, r as SceneItem, s as SceneItemLayout, t as SceneNote, e as SceneNoteCode, a as ScenePlace, u as SceneRailLayout, v as SceneRead, f as SceneTarget, w as SceneTargetOptions, d as Side, c as StoredScene, x as StoredSceneEdge, y as StoredSceneFloat, z as StoredSceneItem, A as ZONES, Z as Zone, B as ZoneAccepts, G as close, H as dockHome, I as floatAt, J as fold, L as homeFor, M as keep, N as lift, Q as moveTo, T as open, U as orient, V as raise, W as readScene, X as reservedRect, Y as resize, _ as setSide, $ as stops, a0 as storeScene, a1 as targets, a2 as use, a3 as zoneTakes, a4 as zonesTaking } from './targets-CYJN0Hba.js';
1
+ import { S as Scene, g as SolveOptions, b as SceneLayout } from './targets-DRFuud5d.js';
2
+ export { C as ColumnPlace, h as ColumnTemplate, D as DEFAULT_FLOAT_SIZE, i as DEFAULT_HIT_BAND, j as DEFAULT_STRIP, k as DockPlace, E as Edge, F as FloatAnchor, l as FloatPlace, K as Kind, O as Orient, P as Place, R as RailPlace, m as RailSpec, n as SIDES, o as SceneAfter, p as SceneEdgeLayout, q as SceneFloat, r as SceneItem, s as SceneItemLayout, t as SceneNote, e as SceneNoteCode, a as ScenePlace, u as SceneRailLayout, v as SceneRead, w as SceneRefusal, f as SceneTarget, x as SceneTargetOptions, d as Side, c as StoredScene, y as StoredSceneEdge, z as StoredSceneFloat, A as StoredSceneItem, B as ZONES, Z as Zone, G as ZoneAccepts, H as close, I as dockHome, J as floatAt, L as fold, M as homeFor, N as keep, Q as lift, T as moveTo, U as open, V as orient, W as raise, X as readScene, Y as refusals, _ as reservedRect, $ as resize, a0 as setSide, a1 as stops, a2 as storeScene, a3 as targets, a4 as use, a5 as zoneTakes, a6 as zonesTaking } from './targets-DRFuud5d.js';
3
3
  import './geometry-mL-GTRti.js';
4
4
  import './target-D3PiLg44.js';
5
- import './model-DU7MovDa.js';
5
+ import './model-DPTu2EtG.js';
6
6
 
7
7
  /**
8
8
  * `solve(scene, { previous })`: the whole window's layout from one scene.
package/dist/scene.js CHANGED
@@ -16,6 +16,7 @@ import {
16
16
  orient,
17
17
  raise,
18
18
  readScene,
19
+ refusals,
19
20
  reservedRect,
20
21
  resize,
21
22
  setSide,
@@ -26,8 +27,8 @@ import {
26
27
  use,
27
28
  zoneTakes,
28
29
  zonesTaking
29
- } from "./chunk-GCSVZGVX.js";
30
- import "./chunk-RUITEOZ7.js";
30
+ } from "./chunk-TFM4S3L3.js";
31
+ import "./chunk-RL3QB5SM.js";
31
32
  import "./chunk-QMTNB2C3.js";
32
33
  export {
33
34
  DEFAULT_FLOAT_SIZE,
@@ -47,6 +48,7 @@ export {
47
48
  orient,
48
49
  raise,
49
50
  readScene,
51
+ refusals,
50
52
  reservedRect,
51
53
  resize,
52
54
  setSide,
package/dist/stack.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { d as StackInput, F as FitOptions, b as StackFit, e as StackItem } from './model-DU7MovDa.js';
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, W as WrapSpec, k as formCrossMin, l as formFitsCross, m as formMain, n as formSetsCross, w as withItem, o as wrapCross, p as wrapLines, q as wrapRows } from './model-DU7MovDa.js';
1
+ import { d as StackInput, F as FitOptions, b as StackFit, e as StackItem } from './model-DPTu2EtG.js';
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-DPTu2EtG.js';
3
3
  import { R as Rect, P as Point, S as Size } from './geometry-mL-GTRti.js';
4
4
  import { T as Target } from './target-D3PiLg44.js';
5
5
 
@@ -10,12 +10,13 @@ import { T as Target } from './target-D3PiLg44.js';
10
10
  * was added or opened. Room that came back is used, but growing never re-ranks. When the stack got wider across (a wider
11
11
  * limit lets a panel open wider, and the forms that stepped down for the old width may come back) the fresh fit is
12
12
  * taken. When the forms kept leave more spare length than they did (the length grew, a gap or a size shrank; `need` is
13
- * what each fit says its forms need) the fresh fit is taken only if it is a pure gain over the kept one (no item's form
14
- * is further down, at least one is further up); otherwise room comes back in the reverse of give-way order (the item
15
- * that gave way most recently first, so the newest used, with rank and `kept` respected), one item at a time, and growth
16
- * stops at the first item that can't grow: no item behind it jumps the queue. Items in the » menu come out together
17
- * only when that keeps the order. A `previous` with no `need` (one an app built by hand) is no help and the fresh fit
18
- * is returned.
13
+ * what each fit says its forms need) room comes back by undoing the give-way history (`steps`, carried on from fit to
14
+ * fit) from its last step, a batch into the » menu together, an item to the nearest earlier form that fits; the first
15
+ * step that can't be undone stops all growth. So growing back is exactly the reverse of giving way: at every length the
16
+ * way back holds what the way down held. A `previous` without a history (built by hand, or by an older version) grows
17
+ * the old way: a fresh fit that is a pure gain over the kept one, else the item that gave way most recently by its
18
+ * rank, `kept` and age first, one at a time, menu items out only when that keeps the order. A `previous` with no `need`
19
+ * (one an app built by hand) is no help and the fresh fit is returned.
19
20
  */
20
21
  declare function fitStack(input: StackInput, options?: FitOptions): StackFit;
21
22
 
package/dist/stack.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  wrapCross,
18
18
  wrapLines,
19
19
  wrapRows
20
- } from "./chunk-RUITEOZ7.js";
20
+ } from "./chunk-RL3QB5SM.js";
21
21
  import {
22
22
  rect
23
23
  } from "./chunk-QMTNB2C3.js";
@@ -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,6 +52,14 @@ interface SceneItem {
52
52
  readonly closed?: boolean;
53
53
  /** Its zone in its edge (default start). */
54
54
  readonly align?: Zone;
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;
55
63
  /** Its size as a float: `floatAt` with no rect uses it, and a float drop sets it. */
56
64
  readonly floatSize?: Size;
57
65
  /**
@@ -136,6 +144,11 @@ interface Edge {
136
144
  * into its side's rail, in give-way order with the columns (its items' ages). It is never deleted.
137
145
  */
138
146
  readonly giveWay?: boolean;
147
+ /**
148
+ * The default give-way priority of its items (`SceneItem.priority` wins; default 0): a title bar given a lower one has
149
+ * its toolbars step down before an item moved in from another bar would.
150
+ */
151
+ readonly priority?: number;
139
152
  }
140
153
  /** What a side's new columns are made from. */
141
154
  interface ColumnTemplate {
@@ -640,6 +653,26 @@ declare function targets(scene: Scene, dragged: string, options?: SceneTargetOpt
640
653
  * host that draws "no drop" areas reads them from here.
641
654
  */
642
655
  declare function reservedRect(scene: Scene, l: SceneLayout, id: string): Rect;
656
+ /** Where a drop of the dragged item is refused: a host shows "no room here" at the pointer, with no slot anywhere. */
657
+ interface SceneRefusal {
658
+ /** `refuse:<edge>:<zone>`. */
659
+ readonly id: string;
660
+ readonly edge: string;
661
+ readonly zone: Zone;
662
+ /** Where the pointer means it; never over a target's hit. */
663
+ readonly hit: Rect;
664
+ /** `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. */
665
+ readonly reason: "no-room" | "not-accepted";
666
+ }
667
+ /**
668
+ * `refusals(scene, dragged, options?)`: the places a drop of `dragged` is refused, so a host can say so at the pointer
669
+ * (a tint and "No room here") instead of showing a slot elsewhere. A bar's zone (its third, as `targets` picks zones)
670
+ * that has no target is refused: `no-room` when the zone takes the kind, `not-accepted` when it or the bar doesn't; a
671
+ * left or right edge that doesn't take the kind is refused as a whole (zone `start`). Each hit is cut clear of every
672
+ * target's hit (the float target aside), so a pointer over one has no target there but the float. A release over a
673
+ * refusal commits nothing: the item goes home.
674
+ */
675
+ declare function refusals(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneRefusal[];
643
676
  /**
644
677
  * `stops(scene, id, options?)`: the places for "Move to ›" and the arrow keys, in reading order, from the same targets
645
678
  * (`home` and `none` left out): the left side outer to inner, the top bars, the bottom bars, the right side inner to
@@ -647,4 +680,4 @@ declare function reservedRect(scene: Scene, l: SceneLayout, id: string): Rect;
647
680
  */
648
681
  declare function stops(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneTarget[];
649
682
 
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 };
683
+ export { resize 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, fold as L, homeFor as M, keep as N, type Orient as O, type Place as P, lift as Q, type RailPlace as R, type Scene as S, moveTo as T, open as U, orient as V, raise as W, readScene as X, refusals as Y, type Zone as Z, reservedRect as _, type ScenePlace as a, setSide as a0, stops as a1, storeScene as a2, targets as a3, use as a4, zoneTakes as a5, zonesTaking as a6, 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.21",
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",