elements-kit 0.27.11 → 0.27.12
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/ui/overlay/index.d.mts +22 -1
- package/dist/ui/overlay/index.mjs +119 -2
- package/package.json +1 -1
|
@@ -31,6 +31,27 @@ declare class WindowBox implements ReadonlyBox, IDirection {
|
|
|
31
31
|
get direction(): Direction;
|
|
32
32
|
}
|
|
33
33
|
declare const WINDOW_BOX: WindowBox;
|
|
34
|
+
/**
|
|
35
|
+
* A box grown by a margin per side — the offset off an anchor, as CSS spells
|
|
36
|
+
* it. The sides default like the `margin` shorthand: one value is every side,
|
|
37
|
+
* two is block then inline, three is top/inline/bottom.
|
|
38
|
+
*
|
|
39
|
+
* Every field is assignable and reactive, and each also takes a signal — so
|
|
40
|
+
* the box or a side can be swapped, or driven. Reads through, so it tracks
|
|
41
|
+
* whatever the wrapped box tracks.
|
|
42
|
+
*/
|
|
43
|
+
declare class MarginBox implements ReadonlyBox {
|
|
44
|
+
box: MaybeReactive<ReadonlyBox>;
|
|
45
|
+
top: MaybeReactive<number>;
|
|
46
|
+
right: MaybeReactive<number>;
|
|
47
|
+
bottom: MaybeReactive<number>;
|
|
48
|
+
left: MaybeReactive<number>;
|
|
49
|
+
constructor(box: MaybeReactive<ReadonlyBox>, top?: MaybeReactive<number>, right?: MaybeReactive<number>, bottom?: MaybeReactive<number>, left?: MaybeReactive<number>);
|
|
50
|
+
get x(): number;
|
|
51
|
+
get y(): number;
|
|
52
|
+
get w(): number;
|
|
53
|
+
get h(): number;
|
|
54
|
+
}
|
|
34
55
|
declare class ElementBox implements ReadonlyBox {
|
|
35
56
|
#private;
|
|
36
57
|
constructor(el: MaybeReactive<Element>);
|
|
@@ -291,4 +312,4 @@ declare class Motion implements IMotion {
|
|
|
291
312
|
abort(initial?: number): void;
|
|
292
313
|
}
|
|
293
314
|
//#endregion
|
|
294
|
-
export { type Align, type Axis, type BlockSide, type Boundary, ElementBox, gestures_d_exports as Gestures, type IDirection, type IMotion, type IOrigin, type InlineSide, type Inset, Motion, MutableRegion, type Origin, type OriginX, type OriginY, OverlayBox, type PhysicalInset, type Pin, PositionArea, type PositionAreaValue, type ReadonlyBox, type Region, WINDOW_BOX, WindowBox, anchor_length };
|
|
315
|
+
export { type Align, type Axis, type BlockSide, type Boundary, ElementBox, gestures_d_exports as Gestures, type IDirection, type IMotion, type IOrigin, type InlineSide, type Inset, MarginBox, Motion, MutableRegion, type Origin, type OriginX, type OriginY, OverlayBox, type PhysicalInset, type Pin, PositionArea, type PositionAreaValue, type ReadonlyBox, type Region, WINDOW_BOX, WindowBox, anchor_length };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "../../chunk-CfYAbeIz.mjs";
|
|
2
2
|
import { c as batch, u as effect, x as signal } from "../../lib-Dw0g-vex.mjs";
|
|
3
|
-
import { reactive } from "../../signals/index.mjs";
|
|
3
|
+
import { reactive, resolve } from "../../signals/index.mjs";
|
|
4
4
|
import { t as scope } from "../../scope-B1kDu4YX.mjs";
|
|
5
5
|
import { direction } from "../../utilities/direction.mjs";
|
|
6
6
|
import { createElementRect } from "../../utilities/element-rect.mjs";
|
|
@@ -342,6 +342,89 @@ function pinOf(region, lo, hi) {
|
|
|
342
342
|
}
|
|
343
343
|
//#endregion
|
|
344
344
|
//#region src/ui/overlay/box.ts
|
|
345
|
+
var __create$1 = Object.create;
|
|
346
|
+
var __defProp$1 = Object.defineProperty;
|
|
347
|
+
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
348
|
+
var __knownSymbol$1 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
349
|
+
var __typeError$1 = (msg) => {
|
|
350
|
+
throw TypeError(msg);
|
|
351
|
+
};
|
|
352
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, {
|
|
353
|
+
enumerable: true,
|
|
354
|
+
configurable: true,
|
|
355
|
+
writable: true,
|
|
356
|
+
value
|
|
357
|
+
}) : obj[key] = value;
|
|
358
|
+
var __name$1 = (target, value) => __defProp$1(target, "name", {
|
|
359
|
+
value,
|
|
360
|
+
configurable: true
|
|
361
|
+
});
|
|
362
|
+
var __decoratorStart$1 = (base) => [
|
|
363
|
+
,
|
|
364
|
+
,
|
|
365
|
+
,
|
|
366
|
+
__create$1(base?.[__knownSymbol$1("metadata")] ?? null)
|
|
367
|
+
];
|
|
368
|
+
var __decoratorStrings$1 = [
|
|
369
|
+
"class",
|
|
370
|
+
"method",
|
|
371
|
+
"getter",
|
|
372
|
+
"setter",
|
|
373
|
+
"accessor",
|
|
374
|
+
"field",
|
|
375
|
+
"value",
|
|
376
|
+
"get",
|
|
377
|
+
"set"
|
|
378
|
+
];
|
|
379
|
+
var __expectFn$1 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$1("Function expected") : fn;
|
|
380
|
+
var __decoratorContext$1 = (kind, name, done, metadata, fns) => ({
|
|
381
|
+
kind: __decoratorStrings$1[kind],
|
|
382
|
+
name,
|
|
383
|
+
metadata,
|
|
384
|
+
addInitializer: (fn) => done._ ? __typeError$1("Already initialized") : fns.push(__expectFn$1(fn || null))
|
|
385
|
+
});
|
|
386
|
+
var __decoratorMetadata$1 = (array, target) => __defNormalProp$1(target, __knownSymbol$1("metadata"), array[3]);
|
|
387
|
+
var __runInitializers$1 = (array, flags, self, value) => {
|
|
388
|
+
for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) flags & 1 ? fns[i].call(self) : value = fns[i].call(self, value);
|
|
389
|
+
return value;
|
|
390
|
+
};
|
|
391
|
+
var __decorateElement$1 = (array, flags, name, decorators, target, extra) => {
|
|
392
|
+
var fn, it, done, ctx, access, k = flags & 7, s = !!(flags & 8), p = !!(flags & 16);
|
|
393
|
+
var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0, key = __decoratorStrings$1[k + 5];
|
|
394
|
+
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
|
395
|
+
var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc$1(k < 4 ? target : {
|
|
396
|
+
get [name]() {
|
|
397
|
+
return __privateGet$1(this, extra);
|
|
398
|
+
},
|
|
399
|
+
set [name](x) {
|
|
400
|
+
return __privateSet$1(this, extra, x);
|
|
401
|
+
}
|
|
402
|
+
}, name));
|
|
403
|
+
k ? p && k < 4 && __name$1(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name$1(target, name);
|
|
404
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
405
|
+
ctx = __decoratorContext$1(k, name, done = {}, array[3], extraInitializers);
|
|
406
|
+
if (k) {
|
|
407
|
+
ctx.static = s, ctx.private = p, access = ctx.access = { has: p ? (x) => __privateIn$1(target, x) : (x) => name in x };
|
|
408
|
+
if (k ^ 3) access.get = p ? (x) => (k ^ 1 ? __privateGet$1 : __privateMethod$1)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
|
409
|
+
if (k > 2) access.set = p ? (x, y) => __privateSet$1(x, target, y, k ^ 4 ? extra : desc.set) : (x, y) => x[name] = y;
|
|
410
|
+
}
|
|
411
|
+
it = (0, decorators[i])(k ? k < 4 ? p ? extra : desc[key] : k > 4 ? void 0 : {
|
|
412
|
+
get: desc.get,
|
|
413
|
+
set: desc.set
|
|
414
|
+
} : target, ctx), done._ = 1;
|
|
415
|
+
if (k ^ 4 || it === void 0) __expectFn$1(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);
|
|
416
|
+
else if (typeof it !== "object" || it === null) __typeError$1("Object expected");
|
|
417
|
+
else __expectFn$1(fn = it.get) && (desc.get = fn), __expectFn$1(fn = it.set) && (desc.set = fn), __expectFn$1(fn = it.init) && initializers.unshift(fn);
|
|
418
|
+
}
|
|
419
|
+
return k || __decoratorMetadata$1(array, target), desc && __defProp$1(target, name, desc), p ? k ^ 4 ? extra : desc : target;
|
|
420
|
+
};
|
|
421
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
422
|
+
var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
|
|
423
|
+
var __privateIn$1 = (member, obj) => Object(obj) !== obj ? __typeError$1("Cannot use the \"in\" operator on this value") : member.has(obj);
|
|
424
|
+
var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
425
|
+
var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
426
|
+
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
427
|
+
var _left_dec, _bottom_dec, _right_dec, _top_dec, _box_dec, _init$1;
|
|
345
428
|
var WindowBox = class {
|
|
346
429
|
get x() {
|
|
347
430
|
return 0;
|
|
@@ -360,6 +443,40 @@ var WindowBox = class {
|
|
|
360
443
|
}
|
|
361
444
|
};
|
|
362
445
|
const WINDOW_BOX = new WindowBox();
|
|
446
|
+
_box_dec = [reactive()], _top_dec = [reactive()], _right_dec = [reactive()], _bottom_dec = [reactive()], _left_dec = [reactive()];
|
|
447
|
+
var MarginBox = class {
|
|
448
|
+
constructor(box, top = 0, right = top, bottom = top, left = right) {
|
|
449
|
+
__publicField$1(this, "box", __runInitializers$1(_init$1, 8, this)), __runInitializers$1(_init$1, 11, this);
|
|
450
|
+
__publicField$1(this, "top", __runInitializers$1(_init$1, 12, this)), __runInitializers$1(_init$1, 15, this);
|
|
451
|
+
__publicField$1(this, "right", __runInitializers$1(_init$1, 16, this)), __runInitializers$1(_init$1, 19, this);
|
|
452
|
+
__publicField$1(this, "bottom", __runInitializers$1(_init$1, 20, this)), __runInitializers$1(_init$1, 23, this);
|
|
453
|
+
__publicField$1(this, "left", __runInitializers$1(_init$1, 24, this)), __runInitializers$1(_init$1, 27, this);
|
|
454
|
+
this.box = box;
|
|
455
|
+
this.top = top;
|
|
456
|
+
this.right = right;
|
|
457
|
+
this.bottom = bottom;
|
|
458
|
+
this.left = left;
|
|
459
|
+
}
|
|
460
|
+
get x() {
|
|
461
|
+
return resolve(this.box).x - resolve(this.left);
|
|
462
|
+
}
|
|
463
|
+
get y() {
|
|
464
|
+
return resolve(this.box).y - resolve(this.top);
|
|
465
|
+
}
|
|
466
|
+
get w() {
|
|
467
|
+
return resolve(this.box).w + resolve(this.left) + resolve(this.right);
|
|
468
|
+
}
|
|
469
|
+
get h() {
|
|
470
|
+
return resolve(this.box).h + resolve(this.top) + resolve(this.bottom);
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
_init$1 = __decoratorStart$1(null);
|
|
474
|
+
__decorateElement$1(_init$1, 5, "box", _box_dec, MarginBox);
|
|
475
|
+
__decorateElement$1(_init$1, 5, "top", _top_dec, MarginBox);
|
|
476
|
+
__decorateElement$1(_init$1, 5, "right", _right_dec, MarginBox);
|
|
477
|
+
__decorateElement$1(_init$1, 5, "bottom", _bottom_dec, MarginBox);
|
|
478
|
+
__decorateElement$1(_init$1, 5, "left", _left_dec, MarginBox);
|
|
479
|
+
__decoratorMetadata$1(_init$1, MarginBox);
|
|
363
480
|
var ElementBox = class {
|
|
364
481
|
#rect;
|
|
365
482
|
constructor(el) {
|
|
@@ -726,4 +843,4 @@ var Motion = class {
|
|
|
726
843
|
}
|
|
727
844
|
};
|
|
728
845
|
//#endregion
|
|
729
|
-
export { ElementBox, gestures_exports as Gestures, Motion, MutableRegion, OverlayBox, PositionArea, WINDOW_BOX, WindowBox, anchor_length };
|
|
846
|
+
export { ElementBox, gestures_exports as Gestures, MarginBox, 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.
|
|
4
|
+
"version": "0.27.12",
|
|
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",
|