elements-kit 0.27.11 → 0.27.13
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 +28 -5
- package/dist/ui/overlay/index.mjs +231 -53
- 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>);
|
|
@@ -179,16 +200,18 @@ type PositionAreaValue = AreaKeyword | Unordered<BlockKeyword, InlineKeyword> |
|
|
|
179
200
|
* anchor's near edge, spans its far edge, center is `anchor-center`. Not a
|
|
180
201
|
* box: a pin per axis, with no geometry of its own.
|
|
181
202
|
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
203
|
+
* The area is assignable — reassigning re-aims the region in place, so a menu
|
|
204
|
+
* can flip side without a new one. Parsed on assignment; the pins read the
|
|
205
|
+
* anchor on every access, so an `effect` tracks both.
|
|
184
206
|
*
|
|
185
207
|
* No gap parameter, for the same reason CSS has none: the offset off the
|
|
186
208
|
* anchor is the overlay's own `margin`.
|
|
187
209
|
*/
|
|
188
210
|
declare class PositionArea implements Region {
|
|
189
211
|
#private;
|
|
190
|
-
|
|
191
|
-
|
|
212
|
+
area: PositionAreaValue;
|
|
213
|
+
anchor: ReadonlyBox & Partial<IDirection>;
|
|
214
|
+
constructor(anchor: ReadonlyBox & Partial<IDirection>, area: PositionAreaValue);
|
|
192
215
|
/** The pin lines — the viewport point {@link origin} lands on. */
|
|
193
216
|
get x(): number;
|
|
194
217
|
get y(): number;
|
|
@@ -291,4 +314,4 @@ declare class Motion implements IMotion {
|
|
|
291
314
|
abort(initial?: number): void;
|
|
292
315
|
}
|
|
293
316
|
//#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 };
|
|
317
|
+
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
|
-
import { c as batch, u as effect, x as signal } from "../../lib-Dw0g-vex.mjs";
|
|
3
|
-
import { reactive } from "../../signals/index.mjs";
|
|
2
|
+
import { c as batch, l as computed, u as effect, x as signal } from "../../lib-Dw0g-vex.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";
|
|
@@ -104,11 +104,90 @@ var MutableRegion = class {
|
|
|
104
104
|
};
|
|
105
105
|
//#endregion
|
|
106
106
|
//#region src/ui/overlay/anchor.ts
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
var __create$2 = Object.create;
|
|
108
|
+
var __defProp$2 = Object.defineProperty;
|
|
109
|
+
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
110
|
+
var __knownSymbol$2 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
111
|
+
var __typeError$2 = (msg) => {
|
|
112
|
+
throw TypeError(msg);
|
|
113
|
+
};
|
|
114
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
configurable: true,
|
|
117
|
+
writable: true,
|
|
118
|
+
value
|
|
119
|
+
}) : obj[key] = value;
|
|
120
|
+
var __name$2 = (target, value) => __defProp$2(target, "name", {
|
|
121
|
+
value,
|
|
122
|
+
configurable: true
|
|
123
|
+
});
|
|
124
|
+
var __decoratorStart$2 = (base) => [
|
|
125
|
+
,
|
|
126
|
+
,
|
|
127
|
+
,
|
|
128
|
+
__create$2(base?.[__knownSymbol$2("metadata")] ?? null)
|
|
129
|
+
];
|
|
130
|
+
var __decoratorStrings$2 = [
|
|
131
|
+
"class",
|
|
132
|
+
"method",
|
|
133
|
+
"getter",
|
|
134
|
+
"setter",
|
|
135
|
+
"accessor",
|
|
136
|
+
"field",
|
|
137
|
+
"value",
|
|
138
|
+
"get",
|
|
139
|
+
"set"
|
|
140
|
+
];
|
|
141
|
+
var __expectFn$2 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$2("Function expected") : fn;
|
|
142
|
+
var __decoratorContext$2 = (kind, name, done, metadata, fns) => ({
|
|
143
|
+
kind: __decoratorStrings$2[kind],
|
|
144
|
+
name,
|
|
145
|
+
metadata,
|
|
146
|
+
addInitializer: (fn) => done._ ? __typeError$2("Already initialized") : fns.push(__expectFn$2(fn || null))
|
|
147
|
+
});
|
|
148
|
+
var __decoratorMetadata$2 = (array, target) => __defNormalProp$2(target, __knownSymbol$2("metadata"), array[3]);
|
|
149
|
+
var __runInitializers$2 = (array, flags, self, value) => {
|
|
150
|
+
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);
|
|
151
|
+
return value;
|
|
152
|
+
};
|
|
153
|
+
var __decorateElement$2 = (array, flags, name, decorators, target, extra) => {
|
|
154
|
+
var fn, it, done, ctx, access, k = flags & 7, s = !!(flags & 8), p = !!(flags & 16);
|
|
155
|
+
var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0, key = __decoratorStrings$2[k + 5];
|
|
156
|
+
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
|
157
|
+
var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc$2(k < 4 ? target : {
|
|
158
|
+
get [name]() {
|
|
159
|
+
return __privateGet$2(this, extra);
|
|
160
|
+
},
|
|
161
|
+
set [name](x) {
|
|
162
|
+
return __privateSet$2(this, extra, x);
|
|
163
|
+
}
|
|
164
|
+
}, name));
|
|
165
|
+
k ? p && k < 4 && __name$2(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name$2(target, name);
|
|
166
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
167
|
+
ctx = __decoratorContext$2(k, name, done = {}, array[3], extraInitializers);
|
|
168
|
+
if (k) {
|
|
169
|
+
ctx.static = s, ctx.private = p, access = ctx.access = { has: p ? (x) => __privateIn$2(target, x) : (x) => name in x };
|
|
170
|
+
if (k ^ 3) access.get = p ? (x) => (k ^ 1 ? __privateGet$2 : __privateMethod$2)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
|
171
|
+
if (k > 2) access.set = p ? (x, y) => __privateSet$2(x, target, y, k ^ 4 ? extra : desc.set) : (x, y) => x[name] = y;
|
|
172
|
+
}
|
|
173
|
+
it = (0, decorators[i])(k ? k < 4 ? p ? extra : desc[key] : k > 4 ? void 0 : {
|
|
174
|
+
get: desc.get,
|
|
175
|
+
set: desc.set
|
|
176
|
+
} : target, ctx), done._ = 1;
|
|
177
|
+
if (k ^ 4 || it === void 0) __expectFn$2(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);
|
|
178
|
+
else if (typeof it !== "object" || it === null) __typeError$2("Object expected");
|
|
179
|
+
else __expectFn$2(fn = it.get) && (desc.get = fn), __expectFn$2(fn = it.set) && (desc.set = fn), __expectFn$2(fn = it.init) && initializers.unshift(fn);
|
|
180
|
+
}
|
|
181
|
+
return k || __decoratorMetadata$2(array, target), desc && __defProp$2(target, name, desc), p ? k ^ 4 ? extra : desc : target;
|
|
182
|
+
};
|
|
183
|
+
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
184
|
+
var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
|
|
185
|
+
var __privateIn$2 = (member, obj) => Object(obj) !== obj ? __typeError$2("Cannot use the \"in\" operator on this value") : member.has(obj);
|
|
186
|
+
var __privateGet$2 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
187
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError$2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
188
|
+
var __privateSet$2 = (obj, member, value, setter) => (__accessCheck$2(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
189
|
+
var __privateMethod$2 = (obj, member, method) => (__accessCheck$2(obj, member, "access private method"), method);
|
|
190
|
+
var _anchor_dec, _area_dec, _init$2, _resolved, _PositionArea_instances, px_get, py_get;
|
|
112
191
|
function anchor_length(box, inset, side) {
|
|
113
192
|
const physical = resolveInset(inset);
|
|
114
193
|
const block = physical === "top" || physical === "bottom";
|
|
@@ -116,7 +195,6 @@ function anchor_length(box, inset, side) {
|
|
|
116
195
|
const size = block ? box.h : box.w;
|
|
117
196
|
return lo + fraction(box, block, physical, side) * size;
|
|
118
197
|
}
|
|
119
|
-
/** A side, as a fraction of the axis measured from its top/left edge. */
|
|
120
198
|
function fraction(box, block, inset, side) {
|
|
121
199
|
switch (side) {
|
|
122
200
|
case "top":
|
|
@@ -131,12 +209,9 @@ function fraction(box, block, inset, side) {
|
|
|
131
209
|
const rtl = side === "self-start" || side === "self-end" ? (box.direction ?? rootDirection()) === "rtl" : rootDirection() === "rtl";
|
|
132
210
|
return !block && rtl ? 1 - logical : logical;
|
|
133
211
|
}
|
|
134
|
-
/** The document root's direction — the fallback when a box has no own. */
|
|
135
212
|
function rootDirection() {
|
|
136
213
|
return getComputedStyle(document.documentElement).direction === "rtl" ? "rtl" : "ltr";
|
|
137
214
|
}
|
|
138
|
-
/** A logical inset longhand → its physical side, through the containing
|
|
139
|
-
* block's direction (horizontal writing modes — only inline flips). */
|
|
140
215
|
function resolveInset(inset) {
|
|
141
216
|
switch (inset) {
|
|
142
217
|
case "inset-block-start": return "top";
|
|
@@ -164,8 +239,6 @@ const A = (region, self = false) => ({
|
|
|
164
239
|
physical: false,
|
|
165
240
|
self
|
|
166
241
|
});
|
|
167
|
-
/** The full `position-area` keyword grammar → axis + physical region. The
|
|
168
|
-
* key type forces this table and {@link PositionAreaValue} to stay in step. */
|
|
169
242
|
const KEYWORDS = {
|
|
170
243
|
top: B("start", true),
|
|
171
244
|
bottom: B("end", true),
|
|
@@ -216,18 +289,11 @@ const SPAN_ALL = KEYWORDS["span-all"];
|
|
|
216
289
|
function flipRegion(r) {
|
|
217
290
|
return r === "start" ? "end" : r === "end" ? "start" : r === "span-start" ? "span-end" : r === "span-end" ? "span-start" : r;
|
|
218
291
|
}
|
|
219
|
-
/** Resolve a keyword to a physical region: block never flips; inline flips
|
|
220
|
-
* in RTL unless the keyword is physical. */
|
|
221
292
|
function toPhysical(kw, axis, dir, selfDir) {
|
|
222
293
|
const r = kw.region;
|
|
223
294
|
if (r === "center" || r === "span-all" || axis === "block" || kw.physical) return r;
|
|
224
295
|
return (kw.self ? selfDir : dir) === "rtl" ? flipRegion(r) : r;
|
|
225
296
|
}
|
|
226
|
-
/**
|
|
227
|
-
* Parse a `position-area` value into a physical {@link Area}. One or two
|
|
228
|
-
* keywords, order-independent; an axis-specific single keyword spans the
|
|
229
|
-
* other axis, an ambiguous one applies to both. Unknown/empty → `block-end`.
|
|
230
|
-
*/
|
|
231
297
|
function resolveArea(area, dir = "ltr", selfDir = dir) {
|
|
232
298
|
const tokens = area.trim().toLowerCase().split(/\s+/).filter(Boolean);
|
|
233
299
|
const fallback = () => ({
|
|
@@ -263,59 +329,54 @@ function resolveArea(area, dir = "ltr", selfDir = dir) {
|
|
|
263
329
|
inline: inline ? toPhysical(inline, "inline", dir, selfDir) : "center"
|
|
264
330
|
};
|
|
265
331
|
}
|
|
266
|
-
|
|
267
|
-
* The reactive `position-area` property: which of the anchor's edges a box
|
|
268
|
-
* pins to, and the self-alignment that follows — outward regions hug the
|
|
269
|
-
* anchor's near edge, spans its far edge, center is `anchor-center`. Not a
|
|
270
|
-
* box: a pin per axis, with no geometry of its own.
|
|
271
|
-
*
|
|
272
|
-
* Parsed once, at construction; the pins read the anchor on every access, so
|
|
273
|
-
* reading them in an `effect` tracks it.
|
|
274
|
-
*
|
|
275
|
-
* No gap parameter, for the same reason CSS has none: the offset off the
|
|
276
|
-
* anchor is the overlay's own `margin`.
|
|
277
|
-
*/
|
|
332
|
+
_area_dec = [reactive()], _anchor_dec = [reactive()];
|
|
278
333
|
var PositionArea = class {
|
|
279
|
-
anchor;
|
|
280
|
-
#area;
|
|
281
334
|
constructor(anchor, area) {
|
|
335
|
+
__privateAdd(this, _PositionArea_instances);
|
|
336
|
+
__publicField$2(this, "area", __runInitializers$2(_init$2, 8, this)), __runInitializers$2(_init$2, 11, this);
|
|
337
|
+
__publicField$2(this, "anchor", __runInitializers$2(_init$2, 12, this)), __runInitializers$2(_init$2, 15, this);
|
|
338
|
+
__privateAdd(this, _resolved);
|
|
282
339
|
this.anchor = anchor;
|
|
283
|
-
this
|
|
284
|
-
|
|
285
|
-
get #px() {
|
|
286
|
-
const a = this.anchor;
|
|
287
|
-
return pinOf(this.#area.inline, a.x, a.x + a.w);
|
|
288
|
-
}
|
|
289
|
-
get #py() {
|
|
290
|
-
const a = this.anchor;
|
|
291
|
-
return pinOf(this.#area.block, a.y, a.y + a.h);
|
|
340
|
+
this.area = area;
|
|
341
|
+
__privateSet$2(this, _resolved, computed(() => resolveArea(this.area, this.anchor.direction ?? rootDirection())));
|
|
292
342
|
}
|
|
293
343
|
/** The pin lines — the viewport point {@link origin} lands on. */
|
|
294
344
|
get x() {
|
|
295
|
-
return this
|
|
345
|
+
return __privateGet$2(this, _PositionArea_instances, px_get).at;
|
|
296
346
|
}
|
|
297
347
|
get y() {
|
|
298
|
-
return this
|
|
348
|
+
return __privateGet$2(this, _PositionArea_instances, py_get).at;
|
|
299
349
|
}
|
|
300
350
|
/** The box point landing on ({@link x}, {@link y}). Two axes, not one
|
|
301
351
|
* side: a corner area pins a corner. */
|
|
302
352
|
get origin() {
|
|
303
353
|
return {
|
|
304
|
-
x: originX(this
|
|
305
|
-
y: originY(this
|
|
354
|
+
x: originX(__privateGet$2(this, _PositionArea_instances, px_get)),
|
|
355
|
+
y: originY(__privateGet$2(this, _PositionArea_instances, py_get))
|
|
306
356
|
};
|
|
307
357
|
}
|
|
308
358
|
/** Every axis is pinned, so only the box's size is read. */
|
|
309
359
|
place(box) {
|
|
310
360
|
return {
|
|
311
|
-
x: placePinned(this
|
|
312
|
-
y: placePinned(this
|
|
361
|
+
x: placePinned(__privateGet$2(this, _PositionArea_instances, px_get), box.w),
|
|
362
|
+
y: placePinned(__privateGet$2(this, _PositionArea_instances, py_get), box.h)
|
|
313
363
|
};
|
|
314
364
|
}
|
|
315
365
|
};
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
366
|
+
_init$2 = __decoratorStart$2(null);
|
|
367
|
+
_resolved = /* @__PURE__ */ new WeakMap();
|
|
368
|
+
_PositionArea_instances = /* @__PURE__ */ new WeakSet();
|
|
369
|
+
px_get = function() {
|
|
370
|
+
const a = this.anchor;
|
|
371
|
+
return pinOf(__privateGet$2(this, _resolved).call(this).inline, a.x, a.x + a.w);
|
|
372
|
+
};
|
|
373
|
+
py_get = function() {
|
|
374
|
+
const a = this.anchor;
|
|
375
|
+
return pinOf(__privateGet$2(this, _resolved).call(this).block, a.y, a.y + a.h);
|
|
376
|
+
};
|
|
377
|
+
__decorateElement$2(_init$2, 5, "area", _area_dec, PositionArea);
|
|
378
|
+
__decorateElement$2(_init$2, 5, "anchor", _anchor_dec, PositionArea);
|
|
379
|
+
__decoratorMetadata$2(_init$2, PositionArea);
|
|
319
380
|
function pinOf(region, lo, hi) {
|
|
320
381
|
switch (region) {
|
|
321
382
|
case "start": return {
|
|
@@ -342,6 +403,89 @@ function pinOf(region, lo, hi) {
|
|
|
342
403
|
}
|
|
343
404
|
//#endregion
|
|
344
405
|
//#region src/ui/overlay/box.ts
|
|
406
|
+
var __create$1 = Object.create;
|
|
407
|
+
var __defProp$1 = Object.defineProperty;
|
|
408
|
+
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
409
|
+
var __knownSymbol$1 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
410
|
+
var __typeError$1 = (msg) => {
|
|
411
|
+
throw TypeError(msg);
|
|
412
|
+
};
|
|
413
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, {
|
|
414
|
+
enumerable: true,
|
|
415
|
+
configurable: true,
|
|
416
|
+
writable: true,
|
|
417
|
+
value
|
|
418
|
+
}) : obj[key] = value;
|
|
419
|
+
var __name$1 = (target, value) => __defProp$1(target, "name", {
|
|
420
|
+
value,
|
|
421
|
+
configurable: true
|
|
422
|
+
});
|
|
423
|
+
var __decoratorStart$1 = (base) => [
|
|
424
|
+
,
|
|
425
|
+
,
|
|
426
|
+
,
|
|
427
|
+
__create$1(base?.[__knownSymbol$1("metadata")] ?? null)
|
|
428
|
+
];
|
|
429
|
+
var __decoratorStrings$1 = [
|
|
430
|
+
"class",
|
|
431
|
+
"method",
|
|
432
|
+
"getter",
|
|
433
|
+
"setter",
|
|
434
|
+
"accessor",
|
|
435
|
+
"field",
|
|
436
|
+
"value",
|
|
437
|
+
"get",
|
|
438
|
+
"set"
|
|
439
|
+
];
|
|
440
|
+
var __expectFn$1 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$1("Function expected") : fn;
|
|
441
|
+
var __decoratorContext$1 = (kind, name, done, metadata, fns) => ({
|
|
442
|
+
kind: __decoratorStrings$1[kind],
|
|
443
|
+
name,
|
|
444
|
+
metadata,
|
|
445
|
+
addInitializer: (fn) => done._ ? __typeError$1("Already initialized") : fns.push(__expectFn$1(fn || null))
|
|
446
|
+
});
|
|
447
|
+
var __decoratorMetadata$1 = (array, target) => __defNormalProp$1(target, __knownSymbol$1("metadata"), array[3]);
|
|
448
|
+
var __runInitializers$1 = (array, flags, self, value) => {
|
|
449
|
+
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);
|
|
450
|
+
return value;
|
|
451
|
+
};
|
|
452
|
+
var __decorateElement$1 = (array, flags, name, decorators, target, extra) => {
|
|
453
|
+
var fn, it, done, ctx, access, k = flags & 7, s = !!(flags & 8), p = !!(flags & 16);
|
|
454
|
+
var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0, key = __decoratorStrings$1[k + 5];
|
|
455
|
+
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
|
456
|
+
var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc$1(k < 4 ? target : {
|
|
457
|
+
get [name]() {
|
|
458
|
+
return __privateGet$1(this, extra);
|
|
459
|
+
},
|
|
460
|
+
set [name](x) {
|
|
461
|
+
return __privateSet$1(this, extra, x);
|
|
462
|
+
}
|
|
463
|
+
}, name));
|
|
464
|
+
k ? p && k < 4 && __name$1(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name$1(target, name);
|
|
465
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
466
|
+
ctx = __decoratorContext$1(k, name, done = {}, array[3], extraInitializers);
|
|
467
|
+
if (k) {
|
|
468
|
+
ctx.static = s, ctx.private = p, access = ctx.access = { has: p ? (x) => __privateIn$1(target, x) : (x) => name in x };
|
|
469
|
+
if (k ^ 3) access.get = p ? (x) => (k ^ 1 ? __privateGet$1 : __privateMethod$1)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
|
470
|
+
if (k > 2) access.set = p ? (x, y) => __privateSet$1(x, target, y, k ^ 4 ? extra : desc.set) : (x, y) => x[name] = y;
|
|
471
|
+
}
|
|
472
|
+
it = (0, decorators[i])(k ? k < 4 ? p ? extra : desc[key] : k > 4 ? void 0 : {
|
|
473
|
+
get: desc.get,
|
|
474
|
+
set: desc.set
|
|
475
|
+
} : target, ctx), done._ = 1;
|
|
476
|
+
if (k ^ 4 || it === void 0) __expectFn$1(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);
|
|
477
|
+
else if (typeof it !== "object" || it === null) __typeError$1("Object expected");
|
|
478
|
+
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);
|
|
479
|
+
}
|
|
480
|
+
return k || __decoratorMetadata$1(array, target), desc && __defProp$1(target, name, desc), p ? k ^ 4 ? extra : desc : target;
|
|
481
|
+
};
|
|
482
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
483
|
+
var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
|
|
484
|
+
var __privateIn$1 = (member, obj) => Object(obj) !== obj ? __typeError$1("Cannot use the \"in\" operator on this value") : member.has(obj);
|
|
485
|
+
var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
486
|
+
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);
|
|
487
|
+
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
488
|
+
var _left_dec, _bottom_dec, _right_dec, _top_dec, _box_dec, _init$1;
|
|
345
489
|
var WindowBox = class {
|
|
346
490
|
get x() {
|
|
347
491
|
return 0;
|
|
@@ -360,6 +504,40 @@ var WindowBox = class {
|
|
|
360
504
|
}
|
|
361
505
|
};
|
|
362
506
|
const WINDOW_BOX = new WindowBox();
|
|
507
|
+
_box_dec = [reactive()], _top_dec = [reactive()], _right_dec = [reactive()], _bottom_dec = [reactive()], _left_dec = [reactive()];
|
|
508
|
+
var MarginBox = class {
|
|
509
|
+
constructor(box, top = 0, right = top, bottom = top, left = right) {
|
|
510
|
+
__publicField$1(this, "box", __runInitializers$1(_init$1, 8, this)), __runInitializers$1(_init$1, 11, this);
|
|
511
|
+
__publicField$1(this, "top", __runInitializers$1(_init$1, 12, this)), __runInitializers$1(_init$1, 15, this);
|
|
512
|
+
__publicField$1(this, "right", __runInitializers$1(_init$1, 16, this)), __runInitializers$1(_init$1, 19, this);
|
|
513
|
+
__publicField$1(this, "bottom", __runInitializers$1(_init$1, 20, this)), __runInitializers$1(_init$1, 23, this);
|
|
514
|
+
__publicField$1(this, "left", __runInitializers$1(_init$1, 24, this)), __runInitializers$1(_init$1, 27, this);
|
|
515
|
+
this.box = box;
|
|
516
|
+
this.top = top;
|
|
517
|
+
this.right = right;
|
|
518
|
+
this.bottom = bottom;
|
|
519
|
+
this.left = left;
|
|
520
|
+
}
|
|
521
|
+
get x() {
|
|
522
|
+
return resolve(this.box).x - resolve(this.left);
|
|
523
|
+
}
|
|
524
|
+
get y() {
|
|
525
|
+
return resolve(this.box).y - resolve(this.top);
|
|
526
|
+
}
|
|
527
|
+
get w() {
|
|
528
|
+
return resolve(this.box).w + resolve(this.left) + resolve(this.right);
|
|
529
|
+
}
|
|
530
|
+
get h() {
|
|
531
|
+
return resolve(this.box).h + resolve(this.top) + resolve(this.bottom);
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
_init$1 = __decoratorStart$1(null);
|
|
535
|
+
__decorateElement$1(_init$1, 5, "box", _box_dec, MarginBox);
|
|
536
|
+
__decorateElement$1(_init$1, 5, "top", _top_dec, MarginBox);
|
|
537
|
+
__decorateElement$1(_init$1, 5, "right", _right_dec, MarginBox);
|
|
538
|
+
__decorateElement$1(_init$1, 5, "bottom", _bottom_dec, MarginBox);
|
|
539
|
+
__decorateElement$1(_init$1, 5, "left", _left_dec, MarginBox);
|
|
540
|
+
__decoratorMetadata$1(_init$1, MarginBox);
|
|
363
541
|
var ElementBox = class {
|
|
364
542
|
#rect;
|
|
365
543
|
constructor(el) {
|
|
@@ -726,4 +904,4 @@ var Motion = class {
|
|
|
726
904
|
}
|
|
727
905
|
};
|
|
728
906
|
//#endregion
|
|
729
|
-
export { ElementBox, gestures_exports as Gestures, Motion, MutableRegion, OverlayBox, PositionArea, WINDOW_BOX, WindowBox, anchor_length };
|
|
907
|
+
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.13",
|
|
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",
|