elements-kit 0.27.6 → 0.27.7

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.
@@ -96,11 +96,6 @@ interface Region {
96
96
  readonly bottom: number | null;
97
97
  place(box: ReadonlyBox): Box;
98
98
  }
99
- /** One axis of a {@link Region.place}: where a box `n` long, currently at
100
- * `own`, starts once `pin` is honoured. */
101
- declare function placeAxis(pin: Pin, own: number, n: number): number;
102
- /** The inset a pin yields on one edge: its coordinate if it pins that edge. */
103
- declare function inset(pin: Pin, edge: "start" | "end"): number | null;
104
99
  /**
105
100
  * A {@link Region} driven by writes — for gestures, where the box grows away
106
101
  * from the edge the user is not dragging. Assigning an inset pins that edge
@@ -176,7 +171,8 @@ declare class PositionArea implements Region, ReadonlyBox {
176
171
  get right(): number | null;
177
172
  get top(): number | null;
178
173
  get bottom(): number | null;
179
- place(box: ReadonlyBox): Box;
174
+ /** Every axis is pinned, so only the box's size is read. */
175
+ place(box: Pick<ReadonlyBox, "w" | "h">): Box;
180
176
  }
181
177
  //#endregion
182
178
  //#region src/ui/overlay/overlay.d.ts
@@ -265,4 +261,4 @@ declare class Motion implements IMotion {
265
261
  abort(initial?: number): void;
266
262
  }
267
263
  //#endregion
268
- export { type Align, type Axis, type BlockSide, type Boundary, ElementBox, gestures_d_exports as Gestures, type IDirection, type IMotion, type InlineSide, type Inset, Motion, MutableRegion, OverlayBox, type PhysicalInset, type Pin, PositionArea, type ReadonlyBox, type Region, WINDOW_BOX, WindowBox, anchor_length, inset, placeAxis };
264
+ export { type Align, type Axis, type BlockSide, type Boundary, ElementBox, gestures_d_exports as Gestures, type IDirection, type IMotion, type InlineSide, type Inset, Motion, MutableRegion, OverlayBox, type PhysicalInset, type Pin, PositionArea, type ReadonlyBox, type Region, WINDOW_BOX, WindowBox, anchor_length };
@@ -6,14 +6,16 @@ import { direction } from "../../utilities/direction.mjs";
6
6
  import { createElementRect } from "../../utilities/element-rect.mjs";
7
7
  import { windowSize } from "../../utilities/window-size.mjs";
8
8
  //#region src/ui/overlay/area.ts
9
- /** One axis of a {@link Region.place}: where a box `n` long, currently at
10
- * `own`, starts once `pin` is honoured. */
11
- function placeAxis(pin, own, n) {
12
- if (!pin) return own;
9
+ /** Where a box `n` long starts on a pinned axis. */
10
+ function placePinned(pin, n) {
13
11
  if (pin.align === "start") return pin.at;
14
12
  if (pin.align === "end") return pin.at - n;
15
13
  return pin.at - n / 2;
16
14
  }
15
+ /** One axis of a {@link Region.place}: pinned, or `own` if the axis is free. */
16
+ function placeAxis(pin, own, n) {
17
+ return pin ? placePinned(pin, n) : own;
18
+ }
17
19
  /** The inset a pin yields on one edge: its coordinate if it pins that edge. */
18
20
  function inset(pin, edge) {
19
21
  return pin?.align === edge ? pin.at : null;
@@ -364,10 +366,11 @@ var PositionArea = class {
364
366
  get bottom() {
365
367
  return inset(this.#py, "end");
366
368
  }
369
+ /** Every axis is pinned, so only the box's size is read. */
367
370
  place(box) {
368
371
  return {
369
- x: placeAxis(this.#px, box.x, box.w),
370
- y: placeAxis(this.#py, box.y, box.h),
372
+ x: placePinned(this.#px, box.w),
373
+ y: placePinned(this.#py, box.h),
371
374
  w: box.w,
372
375
  h: box.h
373
376
  };
@@ -721,4 +724,4 @@ var Motion = class {
721
724
  }
722
725
  };
723
726
  //#endregion
724
- export { ElementBox, gestures_exports as Gestures, Motion, MutableRegion, OverlayBox, PositionArea, WINDOW_BOX, WindowBox, anchor_length, inset, placeAxis };
727
+ export { ElementBox, gestures_exports as Gestures, Motion, MutableRegion, OverlayBox, PositionArea, WINDOW_BOX, WindowBox, anchor_length };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "elements-kit",
3
3
  "type": "module",
4
- "version": "0.27.6",
4
+ "version": "0.27.7",
5
5
  "description": "A lightweight reactive UI library that transforms native HTMLElements into reactive components with signals. Ideal for framework-agnostic applications and web components.",
6
6
  "keywords": [
7
7
  "webcomponents",