@wcstack/resize 1.12.1
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/README.ja.md +189 -0
- package/README.md +189 -0
- package/dist/auto.js +3 -0
- package/dist/auto.min.js +1 -0
- package/dist/index.d.ts +302 -0
- package/dist/index.esm.js +592 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.esm.min.js +2 -0
- package/dist/index.esm.min.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,592 @@
|
|
|
1
|
+
const _config = {
|
|
2
|
+
tagNames: {
|
|
3
|
+
resize: "wcs-resize",
|
|
4
|
+
},
|
|
5
|
+
};
|
|
6
|
+
function deepFreeze(obj) {
|
|
7
|
+
if (obj === null || typeof obj !== "object")
|
|
8
|
+
return obj;
|
|
9
|
+
Object.freeze(obj);
|
|
10
|
+
for (const key of Object.keys(obj)) {
|
|
11
|
+
deepFreeze(obj[key]);
|
|
12
|
+
}
|
|
13
|
+
return obj;
|
|
14
|
+
}
|
|
15
|
+
function deepClone(obj) {
|
|
16
|
+
if (obj === null || typeof obj !== "object")
|
|
17
|
+
return obj;
|
|
18
|
+
const clone = {};
|
|
19
|
+
for (const key of Object.keys(obj)) {
|
|
20
|
+
clone[key] = deepClone(obj[key]);
|
|
21
|
+
}
|
|
22
|
+
return clone;
|
|
23
|
+
}
|
|
24
|
+
let frozenConfig = null;
|
|
25
|
+
const config = _config;
|
|
26
|
+
function getConfig() {
|
|
27
|
+
if (!frozenConfig) {
|
|
28
|
+
frozenConfig = deepFreeze(deepClone(_config));
|
|
29
|
+
}
|
|
30
|
+
return frozenConfig;
|
|
31
|
+
}
|
|
32
|
+
function setConfig(partialConfig) {
|
|
33
|
+
if (partialConfig.tagNames) {
|
|
34
|
+
Object.assign(_config.tagNames, partialConfig.tagNames);
|
|
35
|
+
}
|
|
36
|
+
frozenConfig = null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Headless element-size primitive. A thin, framework-agnostic wrapper around the
|
|
41
|
+
* ResizeObserver API exposed through the wc-bindable protocol.
|
|
42
|
+
*
|
|
43
|
+
* Like IntersectionCore, the thing being observed is a *DOM element* — so
|
|
44
|
+
* `observe()` takes the target node. The Core stays DOM-resolution-agnostic: it
|
|
45
|
+
* observes whatever element it is handed (the Shell resolves the `target` selector
|
|
46
|
+
* before calling). It is a read-only producer — element/layout → state only.
|
|
47
|
+
*
|
|
48
|
+
* Every observer callback is published via the single `wcs-resize:change` event;
|
|
49
|
+
* `width` / `height` are read from it through getters (mirroring how
|
|
50
|
+
* IntersectionCore derives `intersecting` / `ratio` from one event), so an observer
|
|
51
|
+
* binding any of them is notified on every change.
|
|
52
|
+
*
|
|
53
|
+
* `width` / `height` follow the observed `box` (border-box / device-pixel /
|
|
54
|
+
* content-box) and are rounded to integers when `round` is set — `round` absorbs
|
|
55
|
+
* the sub-pixel jitter that would otherwise let a size→layout→size loop oscillate.
|
|
56
|
+
*
|
|
57
|
+
* Single-target by design: the Shell observes exactly one element, so the state
|
|
58
|
+
* reflects that element. Multi-target observation is intentionally out of scope.
|
|
59
|
+
*/
|
|
60
|
+
class ResizeCore extends EventTarget {
|
|
61
|
+
static wcBindable = {
|
|
62
|
+
protocol: "wc-bindable",
|
|
63
|
+
version: 1,
|
|
64
|
+
properties: [
|
|
65
|
+
{ name: "entry", event: "wcs-resize:change" },
|
|
66
|
+
{ name: "width", event: "wcs-resize:change", getter: (e) => e.detail.width },
|
|
67
|
+
{ name: "height", event: "wcs-resize:change", getter: (e) => e.detail.height },
|
|
68
|
+
{ name: "observing", event: "wcs-resize:observing-changed" },
|
|
69
|
+
],
|
|
70
|
+
commands: [
|
|
71
|
+
{ name: "observe" },
|
|
72
|
+
{ name: "unobserve" },
|
|
73
|
+
{ name: "disconnect" },
|
|
74
|
+
],
|
|
75
|
+
};
|
|
76
|
+
_target;
|
|
77
|
+
// The live observer and the single element it observes. The *requested* options
|
|
78
|
+
// are kept so a repeated observe() with identical options is a no-op (avoids the
|
|
79
|
+
// create→observe→disconnect churn an autoloader upgrade can otherwise cause). It
|
|
80
|
+
// is the requested box — not the effective one — so a re-observe of an unsupported
|
|
81
|
+
// box (which falls back to content-box) still hits the idempotency guard instead
|
|
82
|
+
// of rebuilding+falling-back every time. `_effectiveBox` separately tracks the box
|
|
83
|
+
// actually in effect, which is what normalization reads.
|
|
84
|
+
_observer = null;
|
|
85
|
+
_observed = null;
|
|
86
|
+
_options = {};
|
|
87
|
+
_effectiveBox = "content-box";
|
|
88
|
+
_entry = null;
|
|
89
|
+
_observing = false;
|
|
90
|
+
constructor(target) {
|
|
91
|
+
super();
|
|
92
|
+
this._target = target ?? this;
|
|
93
|
+
}
|
|
94
|
+
get entry() {
|
|
95
|
+
return this._entry;
|
|
96
|
+
}
|
|
97
|
+
get width() {
|
|
98
|
+
return this._entry ? this._entry.width : 0;
|
|
99
|
+
}
|
|
100
|
+
get height() {
|
|
101
|
+
return this._entry ? this._entry.height : 0;
|
|
102
|
+
}
|
|
103
|
+
get observing() {
|
|
104
|
+
return this._observing;
|
|
105
|
+
}
|
|
106
|
+
// --- State setters with event dispatch ---
|
|
107
|
+
_setEntry(entry) {
|
|
108
|
+
// No same-value guard: `change` carries event semantics (every callback is a
|
|
109
|
+
// distinct observation) and `width` / `height` are derived getters that must
|
|
110
|
+
// re-fire on each entry, mirroring IntersectionCore's `change`.
|
|
111
|
+
this._entry = entry;
|
|
112
|
+
this._target.dispatchEvent(new CustomEvent("wcs-resize:change", {
|
|
113
|
+
detail: entry,
|
|
114
|
+
bubbles: true,
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
_setObserving(observing) {
|
|
118
|
+
if (this._observing === observing)
|
|
119
|
+
return;
|
|
120
|
+
this._observing = observing;
|
|
121
|
+
this._target.dispatchEvent(new CustomEvent("wcs-resize:observing-changed", {
|
|
122
|
+
detail: observing,
|
|
123
|
+
bubbles: true,
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
// --- Public API ---
|
|
127
|
+
/**
|
|
128
|
+
* Start observing `element`. Idempotent while already observing the same element
|
|
129
|
+
* with the same options. Changing the element or options tears down the current
|
|
130
|
+
* observer and builds a new one (re-observing also re-delivers the initial size,
|
|
131
|
+
* which is how a `round` toggle re-fires with the new rounding).
|
|
132
|
+
*
|
|
133
|
+
* If ResizeObserver is unavailable (SSR) this is a silent no-op — `observing`
|
|
134
|
+
* stays false. If the requested `box` is unsupported, it retries once with
|
|
135
|
+
* `content-box` before giving up; both giving-up paths leave `observing` false,
|
|
136
|
+
* consistent with the never-throw design of the other @wcstack sensors.
|
|
137
|
+
*/
|
|
138
|
+
observe(element, options = {}) {
|
|
139
|
+
if (this._observer && this._observed === element && this._optionsEqual(this._options, options)) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
this._teardownObserver();
|
|
143
|
+
const observer = this._createObserver();
|
|
144
|
+
if (!observer) {
|
|
145
|
+
// Unsupported environment (no ResizeObserver). If we were already observing,
|
|
146
|
+
// that observation is now gone — reflect it rather than reporting a stale true.
|
|
147
|
+
this._setObserving(false);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const effectiveBox = this._beginObserve(observer, element, options.box);
|
|
151
|
+
if (effectiveBox === null) {
|
|
152
|
+
// observe() threw even after the content-box fallback — no live observation.
|
|
153
|
+
observer.disconnect();
|
|
154
|
+
this._setObserving(false);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
this._observer = observer;
|
|
158
|
+
this._observed = element;
|
|
159
|
+
// Store the *requested* options (raw) for the idempotency guard; `_effectiveBox`
|
|
160
|
+
// holds the box that actually took effect (content-box after a fallback) for
|
|
161
|
+
// normalization to read.
|
|
162
|
+
this._options = { box: options.box, round: options.round };
|
|
163
|
+
this._effectiveBox = effectiveBox;
|
|
164
|
+
this._setObserving(true);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Stop observing `element`. A no-op if it is not the currently observed element.
|
|
168
|
+
* The observer instance is torn down (single-target Core), so a later observe()
|
|
169
|
+
* rebuilds it.
|
|
170
|
+
*/
|
|
171
|
+
unobserve(element) {
|
|
172
|
+
if (this._observed !== element)
|
|
173
|
+
return;
|
|
174
|
+
this._teardownObserver();
|
|
175
|
+
this._setObserving(false);
|
|
176
|
+
}
|
|
177
|
+
/** Stop all observation and release the observer. */
|
|
178
|
+
disconnect() {
|
|
179
|
+
this._teardownObserver();
|
|
180
|
+
this._setObserving(false);
|
|
181
|
+
}
|
|
182
|
+
// --- Internal ---
|
|
183
|
+
_teardownObserver() {
|
|
184
|
+
if (this._observer) {
|
|
185
|
+
this._observer.disconnect();
|
|
186
|
+
this._observer = null;
|
|
187
|
+
}
|
|
188
|
+
this._observed = null;
|
|
189
|
+
}
|
|
190
|
+
_createObserver() {
|
|
191
|
+
// No constructor try/catch: unlike IntersectionObserver (which validates
|
|
192
|
+
// rootMargin at construction), the ResizeObserver constructor takes only a
|
|
193
|
+
// callback and has no throwing precondition. The throw path is on observe()
|
|
194
|
+
// (an unsupported `box`), handled in _beginObserve.
|
|
195
|
+
if (typeof ResizeObserver === "undefined")
|
|
196
|
+
return null;
|
|
197
|
+
return new ResizeObserver(this._onResize);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Start observing with the requested `box`, retrying once with `content-box` if
|
|
201
|
+
* the runtime rejects the box (e.g. `device-pixel-content-box` on engines that do
|
|
202
|
+
* not support it). Returns the box actually in effect, or `null` if observation
|
|
203
|
+
* could not start at all.
|
|
204
|
+
*/
|
|
205
|
+
_beginObserve(observer, element, box) {
|
|
206
|
+
const requested = box ?? "content-box";
|
|
207
|
+
try {
|
|
208
|
+
observer.observe(element, { box: requested });
|
|
209
|
+
return requested;
|
|
210
|
+
}
|
|
211
|
+
catch {
|
|
212
|
+
// Already content-box and it still threw — nothing safer to fall back to.
|
|
213
|
+
if (requested === "content-box")
|
|
214
|
+
return null;
|
|
215
|
+
try {
|
|
216
|
+
observer.observe(element, { box: "content-box" });
|
|
217
|
+
return "content-box";
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
_onResize = (entries) => {
|
|
225
|
+
for (const entry of entries) {
|
|
226
|
+
this._setEntry(this._normalizeEntry(entry));
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
_normalizeEntry(entry) {
|
|
230
|
+
const contentRect = this._normalizeRect(entry.contentRect);
|
|
231
|
+
const contentBoxSize = this._firstBoxSize(entry.contentBoxSize);
|
|
232
|
+
const borderBoxSize = this._firstBoxSize(entry.borderBoxSize);
|
|
233
|
+
// devicePixelContentBoxSize is Chromium-only; absent on other engines.
|
|
234
|
+
const devicePixelContentBoxSize = this._firstBoxSize(entry.devicePixelContentBoxSize);
|
|
235
|
+
const { width, height } = this._headlineSize(contentBoxSize, borderBoxSize, devicePixelContentBoxSize, contentRect);
|
|
236
|
+
return {
|
|
237
|
+
width,
|
|
238
|
+
height,
|
|
239
|
+
contentRect,
|
|
240
|
+
contentBoxSize,
|
|
241
|
+
borderBoxSize,
|
|
242
|
+
devicePixelContentBoxSize,
|
|
243
|
+
target: entry.target,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Pick the headline width/height from the boxSize matching the observed `box`,
|
|
248
|
+
* falling back to `contentRect` when that fragment is absent (older engines only
|
|
249
|
+
* fill contentRect). `inlineSize`/`blockSize` map to width/height (correct for
|
|
250
|
+
* horizontal writing modes). Rounds to integers when `round` is set.
|
|
251
|
+
*/
|
|
252
|
+
_headlineSize(contentBoxSize, borderBoxSize, devicePixelContentBoxSize, contentRect) {
|
|
253
|
+
const box = this._effectiveBox;
|
|
254
|
+
let size;
|
|
255
|
+
if (box === "border-box") {
|
|
256
|
+
size = borderBoxSize;
|
|
257
|
+
}
|
|
258
|
+
else if (box === "device-pixel-content-box") {
|
|
259
|
+
size = devicePixelContentBoxSize;
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
size = contentBoxSize;
|
|
263
|
+
}
|
|
264
|
+
let width;
|
|
265
|
+
let height;
|
|
266
|
+
if (size) {
|
|
267
|
+
width = size.inlineSize;
|
|
268
|
+
height = size.blockSize;
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
width = contentRect.width;
|
|
272
|
+
height = contentRect.height;
|
|
273
|
+
}
|
|
274
|
+
if (this._options.round) {
|
|
275
|
+
width = Math.round(width);
|
|
276
|
+
height = Math.round(height);
|
|
277
|
+
}
|
|
278
|
+
return { width, height };
|
|
279
|
+
}
|
|
280
|
+
_firstBoxSize(list) {
|
|
281
|
+
if (!list || list.length === 0)
|
|
282
|
+
return null;
|
|
283
|
+
const first = list[0];
|
|
284
|
+
return { inlineSize: first.inlineSize, blockSize: first.blockSize };
|
|
285
|
+
}
|
|
286
|
+
_normalizeRect(rect) {
|
|
287
|
+
return {
|
|
288
|
+
x: rect.x,
|
|
289
|
+
y: rect.y,
|
|
290
|
+
width: rect.width,
|
|
291
|
+
height: rect.height,
|
|
292
|
+
top: rect.top,
|
|
293
|
+
right: rect.right,
|
|
294
|
+
bottom: rect.bottom,
|
|
295
|
+
left: rect.left,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
_optionsEqual(a, b) {
|
|
299
|
+
if ((a.box ?? "content-box") !== (b.box ?? "content-box"))
|
|
300
|
+
return false;
|
|
301
|
+
return (a.round ?? false) === (b.round ?? false);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const BOX_VALUES = ["content-box", "border-box", "device-pixel-content-box"];
|
|
306
|
+
/**
|
|
307
|
+
* `<wcs-resize>` — declarative ResizeObserver.
|
|
308
|
+
*
|
|
309
|
+
* The `target` attribute is the single knob that decides both *what* is observed
|
|
310
|
+
* and how the element renders (it never injects a layout box unless asked):
|
|
311
|
+
*
|
|
312
|
+
* | `target` | observes | display | use case |
|
|
313
|
+
* |-----------------|-----------------------|-------------|----------------------|
|
|
314
|
+
* | omitted | first element child | `contents` | size a wrapped child |
|
|
315
|
+
* | `"#panel"` / sel| the matched element | `none` | size an existing node|
|
|
316
|
+
* | `"self"` | the element itself | `block` | container-width probe|
|
|
317
|
+
*
|
|
318
|
+
* `display:contents` means wrapping a child injects no box of its own (so a
|
|
319
|
+
* `<wcs-resize><div></wcs-resize>` does not disturb a flex/grid parent); the
|
|
320
|
+
* `target="self"` form takes a `display:block` box that, as a zero-height element,
|
|
321
|
+
* stretches to the parent's available inline size — a container-width probe.
|
|
322
|
+
*
|
|
323
|
+
* Note: a `display:contents` / `display:none` element generates no box, so the
|
|
324
|
+
* observed node must be the child / selector target (which do have boxes), never
|
|
325
|
+
* the `<wcs-resize>` host itself except in the `self` form.
|
|
326
|
+
*/
|
|
327
|
+
class WcsResize extends HTMLElement {
|
|
328
|
+
static hasConnectedCallbackPromise = false;
|
|
329
|
+
// Only attributes that change *what or how* we observe trigger a re-observe.
|
|
330
|
+
// `once` is intentionally excluded: it is evaluated at change fire time (in
|
|
331
|
+
// `_onChange`), so toggling it takes effect without re-observing — and a
|
|
332
|
+
// re-observe on its change would be a pure no-op (same target, same options).
|
|
333
|
+
// `manual` is also excluded: it is a connect-time policy ("don't auto-observe on
|
|
334
|
+
// connect"), not a live switch that should start/stop an active observation.
|
|
335
|
+
// `box` and `round` ARE observed: changing them rebuilds the observer, and the
|
|
336
|
+
// rebuild re-delivers the initial size — which is exactly how a `round` toggle
|
|
337
|
+
// re-emits width/height with the new rounding.
|
|
338
|
+
static observedAttributes = ["target", "box", "round"];
|
|
339
|
+
static wcBindable = {
|
|
340
|
+
...ResizeCore.wcBindable,
|
|
341
|
+
properties: [
|
|
342
|
+
...ResizeCore.wcBindable.properties,
|
|
343
|
+
{ name: "trigger", event: "wcs-resize:trigger-changed" },
|
|
344
|
+
],
|
|
345
|
+
// Shell-level settable surface. Each input carries its mirrored `attribute`
|
|
346
|
+
// hint; `trigger` has none — it is a momentary command-property, not a
|
|
347
|
+
// declarative attribute. The observe / unobserve / disconnect commands are
|
|
348
|
+
// inherited from the Core via the spread above.
|
|
349
|
+
inputs: [
|
|
350
|
+
{ name: "target", attribute: "target" },
|
|
351
|
+
{ name: "box", attribute: "box" },
|
|
352
|
+
{ name: "round", attribute: "round" },
|
|
353
|
+
{ name: "once", attribute: "once" },
|
|
354
|
+
{ name: "manual", attribute: "manual" },
|
|
355
|
+
{ name: "trigger" },
|
|
356
|
+
],
|
|
357
|
+
// Core の commands をそのまま継承(単一情報源)。<wcs-intersect>/<wcs-sse> と同型。
|
|
358
|
+
// spread でも継承されるが、Core に command 追加時の追従漏れを防ぐため明示参照する。
|
|
359
|
+
commands: ResizeCore.wcBindable.commands,
|
|
360
|
+
};
|
|
361
|
+
_core;
|
|
362
|
+
_trigger = false;
|
|
363
|
+
constructor() {
|
|
364
|
+
super();
|
|
365
|
+
this._core = new ResizeCore(this);
|
|
366
|
+
}
|
|
367
|
+
// --- Attribute accessors ---
|
|
368
|
+
get target() {
|
|
369
|
+
return this.getAttribute("target") ?? "";
|
|
370
|
+
}
|
|
371
|
+
set target(value) {
|
|
372
|
+
this.setAttribute("target", value);
|
|
373
|
+
}
|
|
374
|
+
get box() {
|
|
375
|
+
return this.getAttribute("box") ?? "";
|
|
376
|
+
}
|
|
377
|
+
set box(value) {
|
|
378
|
+
this.setAttribute("box", value);
|
|
379
|
+
}
|
|
380
|
+
get round() {
|
|
381
|
+
return this.hasAttribute("round");
|
|
382
|
+
}
|
|
383
|
+
set round(value) {
|
|
384
|
+
if (value) {
|
|
385
|
+
this.setAttribute("round", "");
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
this.removeAttribute("round");
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
get once() {
|
|
392
|
+
return this.hasAttribute("once");
|
|
393
|
+
}
|
|
394
|
+
set once(value) {
|
|
395
|
+
if (value) {
|
|
396
|
+
this.setAttribute("once", "");
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
this.removeAttribute("once");
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
get manual() {
|
|
403
|
+
return this.hasAttribute("manual");
|
|
404
|
+
}
|
|
405
|
+
set manual(value) {
|
|
406
|
+
if (value) {
|
|
407
|
+
this.setAttribute("manual", "");
|
|
408
|
+
}
|
|
409
|
+
else {
|
|
410
|
+
this.removeAttribute("manual");
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
// --- Core delegated getters ---
|
|
414
|
+
get entry() {
|
|
415
|
+
return this._core.entry;
|
|
416
|
+
}
|
|
417
|
+
get width() {
|
|
418
|
+
return this._core.width;
|
|
419
|
+
}
|
|
420
|
+
get height() {
|
|
421
|
+
return this._core.height;
|
|
422
|
+
}
|
|
423
|
+
get observing() {
|
|
424
|
+
return this._core.observing;
|
|
425
|
+
}
|
|
426
|
+
// --- Command property ---
|
|
427
|
+
get trigger() {
|
|
428
|
+
return this._trigger;
|
|
429
|
+
}
|
|
430
|
+
set trigger(value) {
|
|
431
|
+
// Momentary command-property: a false→true write re-runs observe(). Mirrors the
|
|
432
|
+
// trigger flag on <wcs-intersect> / <wcs-geo>. Prefer the command-token protocol
|
|
433
|
+
// (`command.observe: $command.start`) for state-driven observation; this exists
|
|
434
|
+
// mainly for simple boolean bindings.
|
|
435
|
+
const v = !!value; // normalize truthy state-bindings, like <wcs-intersect>'s setter
|
|
436
|
+
if (v) {
|
|
437
|
+
this._trigger = true;
|
|
438
|
+
// try/finally mirrors <wcs-intersect>'s set trigger: observe() is never-throw
|
|
439
|
+
// today, but should a synchronous throw path ever appear, the finally still
|
|
440
|
+
// auto-resets _trigger (no stuck-true latch) and emits the completion notice.
|
|
441
|
+
try {
|
|
442
|
+
this.observe();
|
|
443
|
+
}
|
|
444
|
+
finally {
|
|
445
|
+
this._trigger = false;
|
|
446
|
+
// Always auto-reset to false after the observe() attempt — this is the
|
|
447
|
+
// *momentary acknowledgement* that the trigger was consumed, NOT a signal
|
|
448
|
+
// that observation succeeded (whether the target resolved is reflected by
|
|
449
|
+
// `observing`, not by this event). Read `observing` if you need the outcome.
|
|
450
|
+
this.dispatchEvent(new CustomEvent("wcs-resize:trigger-changed", {
|
|
451
|
+
detail: false,
|
|
452
|
+
bubbles: true,
|
|
453
|
+
}));
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
// --- Commands ---
|
|
458
|
+
/** Re-resolve the target from the DOM and (re)start observing. */
|
|
459
|
+
observe() {
|
|
460
|
+
const { element, display } = this._resolveTarget();
|
|
461
|
+
// `display` is derived from the `target` *mode* (self/selector/child), not from
|
|
462
|
+
// whether the selector currently matches — so it is applied unconditionally,
|
|
463
|
+
// before the resolution check. A `target="#x"` whose node is momentarily absent
|
|
464
|
+
// still renders `display:none` (it is a selector pointer, never a box).
|
|
465
|
+
this.style.display = display;
|
|
466
|
+
if (!element) {
|
|
467
|
+
// The target is no longer resolvable (e.g. a `target` selector whose node was
|
|
468
|
+
// removed from the DOM). Tear down any stale observation so `observing` does
|
|
469
|
+
// not keep reporting true against a node that is gone.
|
|
470
|
+
this._core.disconnect();
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
this._core.observe(element, this._options());
|
|
474
|
+
}
|
|
475
|
+
unobserve() {
|
|
476
|
+
// Single-target Shell: "stop observing my target" is exactly the Core's
|
|
477
|
+
// teardown. Delegate to the Core's tracked state rather than re-resolving the
|
|
478
|
+
// selector, so a target that has since left the DOM can still be stopped
|
|
479
|
+
// (re-resolving would yield null and silently leave the observer running).
|
|
480
|
+
this._core.disconnect();
|
|
481
|
+
}
|
|
482
|
+
disconnect() {
|
|
483
|
+
this._core.disconnect();
|
|
484
|
+
}
|
|
485
|
+
// --- Internal ---
|
|
486
|
+
_resolveTarget() {
|
|
487
|
+
const target = this.target;
|
|
488
|
+
if (target === "self") {
|
|
489
|
+
// Explicit sentinel: observe the element itself. As a display:block zero-height
|
|
490
|
+
// box it stretches to the parent's available inline size — a container probe.
|
|
491
|
+
return { element: this, display: "block" };
|
|
492
|
+
}
|
|
493
|
+
if (target !== "") {
|
|
494
|
+
// Selector pointer: observe a referenced element in place, staying invisible.
|
|
495
|
+
const scope = this.getRootNode();
|
|
496
|
+
// A user-authored selector can be syntactically invalid (e.g. `#`, `:::`,
|
|
497
|
+
// `[data-*`), which makes querySelector throw a SyntaxError. Swallow it and
|
|
498
|
+
// treat the target as unresolvable — the same "nothing to observe" path as a
|
|
499
|
+
// selector matching no element — so a bad attribute never lets the throw escape
|
|
500
|
+
// observe() → connectedCallback / attributeChangedCallback (never-throw).
|
|
501
|
+
return { element: this._safeQuery(scope, target), display: "none" };
|
|
502
|
+
}
|
|
503
|
+
// Omitted: observe the first element child without injecting a box of our own.
|
|
504
|
+
const child = this.firstElementChild;
|
|
505
|
+
if (child) {
|
|
506
|
+
return { element: child, display: "contents" };
|
|
507
|
+
}
|
|
508
|
+
// No child to wrap (e.g. used as an empty marker) — fall back to self.
|
|
509
|
+
return { element: this, display: "block" };
|
|
510
|
+
}
|
|
511
|
+
// Wrap querySelector so a syntactically invalid user-authored selector resolves to
|
|
512
|
+
// null (unresolvable) instead of letting the SyntaxError escape — keeping the
|
|
513
|
+
// sensor never-throw, mirroring intersection's _safeQuery guard.
|
|
514
|
+
_safeQuery(scope, selector) {
|
|
515
|
+
try {
|
|
516
|
+
return scope.querySelector(selector);
|
|
517
|
+
}
|
|
518
|
+
catch {
|
|
519
|
+
return null;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
_parseBox() {
|
|
523
|
+
const raw = this.box.trim();
|
|
524
|
+
// Decision: an unrecognized box value falls back to content-box at parse time
|
|
525
|
+
// (rather than letting the Core's observe() reject it), mirroring threshold's
|
|
526
|
+
// range filter in <wcs-intersect>. The Core still has its own runtime fallback
|
|
527
|
+
// for a *valid-but-unsupported* box (e.g. device-pixel-content-box on Safari).
|
|
528
|
+
return BOX_VALUES.includes(raw) ? raw : "content-box";
|
|
529
|
+
}
|
|
530
|
+
_options() {
|
|
531
|
+
return {
|
|
532
|
+
box: this._parseBox(),
|
|
533
|
+
round: this.round,
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
_onChange = (event) => {
|
|
537
|
+
// `wcs-resize:change` bubbles, so a nested `<wcs-resize>` descendant's change
|
|
538
|
+
// would otherwise reach this (ancestor) listener and let a *child's* resize tear
|
|
539
|
+
// down *our* observer. Only act on our own Core's event. (This also avoids
|
|
540
|
+
// reading `.detail` off a foreign event shape.)
|
|
541
|
+
if (event.target !== this)
|
|
542
|
+
return;
|
|
543
|
+
// `once`: tear down after the first size observation. ResizeObserver always
|
|
544
|
+
// delivers the initial size on observe(), so once = measure-once. Gated at fire
|
|
545
|
+
// time so toggling the `once` attribute takes effect live.
|
|
546
|
+
if (this.once) {
|
|
547
|
+
this._core.disconnect();
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
// --- Lifecycle ---
|
|
551
|
+
connectedCallback() {
|
|
552
|
+
this.addEventListener("wcs-resize:change", this._onChange);
|
|
553
|
+
if (!this.manual) {
|
|
554
|
+
this.observe();
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
disconnectedCallback() {
|
|
558
|
+
this.removeEventListener("wcs-resize:change", this._onChange);
|
|
559
|
+
this._core.disconnect();
|
|
560
|
+
}
|
|
561
|
+
attributeChangedCallback(_name, oldValue, newValue) {
|
|
562
|
+
// Defensive same-value guard. Per the HTML spec, an attribute change reaction is
|
|
563
|
+
// enqueued whenever setAttribute() runs — including with an unchanged value — so
|
|
564
|
+
// attributeChangedCallback CAN fire on a same-value write. Re-observing on an
|
|
565
|
+
// unchanged attribute would be a wasted observer rebuild, so bail early when the
|
|
566
|
+
// value did not actually change. Kept intentionally; do not remove.
|
|
567
|
+
if (oldValue === newValue)
|
|
568
|
+
return;
|
|
569
|
+
// Only react once connected and in automatic mode. The Core's idempotency guard
|
|
570
|
+
// absorbs the autoloader upgrade case (attributeChangedCallback +
|
|
571
|
+
// connectedCallback both calling observe() with identical options).
|
|
572
|
+
if (!this.isConnected || this.manual)
|
|
573
|
+
return;
|
|
574
|
+
this.observe();
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
function registerComponents() {
|
|
579
|
+
if (!customElements.get(config.tagNames.resize)) {
|
|
580
|
+
customElements.define(config.tagNames.resize, WcsResize);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
function bootstrapResize(userConfig) {
|
|
585
|
+
if (userConfig) {
|
|
586
|
+
setConfig(userConfig);
|
|
587
|
+
}
|
|
588
|
+
registerComponents();
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
export { ResizeCore, WcsResize, bootstrapResize, getConfig };
|
|
592
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/config.ts","../src/core/ResizeCore.ts","../src/components/Resize.ts","../src/registerComponents.ts","../src/bootstrapResize.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n resize: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n resize: \"wcs-resize\",\n },\n};\n\nfunction deepFreeze<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n Object.freeze(obj);\n for (const key of Object.keys(obj)) {\n deepFreeze((obj as Record<string, unknown>)[key]);\n }\n return obj;\n}\n\nfunction deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n const clone: Record<string, unknown> = {};\n for (const key of Object.keys(obj)) {\n clone[key] = deepClone((obj as Record<string, unknown>)[key]);\n }\n return clone as T;\n}\n\nlet frozenConfig: IConfig | null = null;\n\nexport const config: IConfig = _config as IConfig;\n\nexport function getConfig(): IConfig {\n if (!frozenConfig) {\n frozenConfig = deepFreeze(deepClone(_config));\n }\n return frozenConfig;\n}\n\nexport function setConfig(partialConfig: IWritableConfig): void {\n if (partialConfig.tagNames) {\n Object.assign(_config.tagNames, partialConfig.tagNames);\n }\n frozenConfig = null;\n}\n","import { IWcBindable, ResizeOptions, ResizeBoxOption, WcsResizeEntry, WcsResizeRect, WcsResizeBoxSize } from \"../types.js\";\n\n/**\n * Headless element-size primitive. A thin, framework-agnostic wrapper around the\n * ResizeObserver API exposed through the wc-bindable protocol.\n *\n * Like IntersectionCore, the thing being observed is a *DOM element* — so\n * `observe()` takes the target node. The Core stays DOM-resolution-agnostic: it\n * observes whatever element it is handed (the Shell resolves the `target` selector\n * before calling). It is a read-only producer — element/layout → state only.\n *\n * Every observer callback is published via the single `wcs-resize:change` event;\n * `width` / `height` are read from it through getters (mirroring how\n * IntersectionCore derives `intersecting` / `ratio` from one event), so an observer\n * binding any of them is notified on every change.\n *\n * `width` / `height` follow the observed `box` (border-box / device-pixel /\n * content-box) and are rounded to integers when `round` is set — `round` absorbs\n * the sub-pixel jitter that would otherwise let a size→layout→size loop oscillate.\n *\n * Single-target by design: the Shell observes exactly one element, so the state\n * reflects that element. Multi-target observation is intentionally out of scope.\n */\nexport class ResizeCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"entry\", event: \"wcs-resize:change\" },\n { name: \"width\", event: \"wcs-resize:change\", getter: (e: Event) => (e as CustomEvent).detail.width },\n { name: \"height\", event: \"wcs-resize:change\", getter: (e: Event) => (e as CustomEvent).detail.height },\n { name: \"observing\", event: \"wcs-resize:observing-changed\" },\n ],\n commands: [\n { name: \"observe\" },\n { name: \"unobserve\" },\n { name: \"disconnect\" },\n ],\n };\n\n private _target: EventTarget;\n\n // The live observer and the single element it observes. The *requested* options\n // are kept so a repeated observe() with identical options is a no-op (avoids the\n // create→observe→disconnect churn an autoloader upgrade can otherwise cause). It\n // is the requested box — not the effective one — so a re-observe of an unsupported\n // box (which falls back to content-box) still hits the idempotency guard instead\n // of rebuilding+falling-back every time. `_effectiveBox` separately tracks the box\n // actually in effect, which is what normalization reads.\n private _observer: ResizeObserver | null = null;\n private _observed: Element | null = null;\n private _options: ResizeOptions = {};\n private _effectiveBox: ResizeBoxOption = \"content-box\";\n\n private _entry: WcsResizeEntry | null = null;\n private _observing: boolean = false;\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n }\n\n get entry(): WcsResizeEntry | null {\n return this._entry;\n }\n\n get width(): number {\n return this._entry ? this._entry.width : 0;\n }\n\n get height(): number {\n return this._entry ? this._entry.height : 0;\n }\n\n get observing(): boolean {\n return this._observing;\n }\n\n // --- State setters with event dispatch ---\n\n private _setEntry(entry: WcsResizeEntry): void {\n // No same-value guard: `change` carries event semantics (every callback is a\n // distinct observation) and `width` / `height` are derived getters that must\n // re-fire on each entry, mirroring IntersectionCore's `change`.\n this._entry = entry;\n this._target.dispatchEvent(new CustomEvent(\"wcs-resize:change\", {\n detail: entry,\n bubbles: true,\n }));\n }\n\n private _setObserving(observing: boolean): void {\n if (this._observing === observing) return;\n this._observing = observing;\n this._target.dispatchEvent(new CustomEvent(\"wcs-resize:observing-changed\", {\n detail: observing,\n bubbles: true,\n }));\n }\n\n // --- Public API ---\n\n /**\n * Start observing `element`. Idempotent while already observing the same element\n * with the same options. Changing the element or options tears down the current\n * observer and builds a new one (re-observing also re-delivers the initial size,\n * which is how a `round` toggle re-fires with the new rounding).\n *\n * If ResizeObserver is unavailable (SSR) this is a silent no-op — `observing`\n * stays false. If the requested `box` is unsupported, it retries once with\n * `content-box` before giving up; both giving-up paths leave `observing` false,\n * consistent with the never-throw design of the other @wcstack sensors.\n */\n observe(element: Element, options: ResizeOptions = {}): void {\n if (this._observer && this._observed === element && this._optionsEqual(this._options, options)) {\n return;\n }\n this._teardownObserver();\n const observer = this._createObserver();\n if (!observer) {\n // Unsupported environment (no ResizeObserver). If we were already observing,\n // that observation is now gone — reflect it rather than reporting a stale true.\n this._setObserving(false);\n return;\n }\n const effectiveBox = this._beginObserve(observer, element, options.box);\n if (effectiveBox === null) {\n // observe() threw even after the content-box fallback — no live observation.\n observer.disconnect();\n this._setObserving(false);\n return;\n }\n this._observer = observer;\n this._observed = element;\n // Store the *requested* options (raw) for the idempotency guard; `_effectiveBox`\n // holds the box that actually took effect (content-box after a fallback) for\n // normalization to read.\n this._options = { box: options.box, round: options.round };\n this._effectiveBox = effectiveBox;\n this._setObserving(true);\n }\n\n /**\n * Stop observing `element`. A no-op if it is not the currently observed element.\n * The observer instance is torn down (single-target Core), so a later observe()\n * rebuilds it.\n */\n unobserve(element: Element): void {\n if (this._observed !== element) return;\n this._teardownObserver();\n this._setObserving(false);\n }\n\n /** Stop all observation and release the observer. */\n disconnect(): void {\n this._teardownObserver();\n this._setObserving(false);\n }\n\n // --- Internal ---\n\n private _teardownObserver(): void {\n if (this._observer) {\n this._observer.disconnect();\n this._observer = null;\n }\n this._observed = null;\n }\n\n private _createObserver(): ResizeObserver | null {\n // No constructor try/catch: unlike IntersectionObserver (which validates\n // rootMargin at construction), the ResizeObserver constructor takes only a\n // callback and has no throwing precondition. The throw path is on observe()\n // (an unsupported `box`), handled in _beginObserve.\n if (typeof ResizeObserver === \"undefined\") return null;\n return new ResizeObserver(this._onResize);\n }\n\n /**\n * Start observing with the requested `box`, retrying once with `content-box` if\n * the runtime rejects the box (e.g. `device-pixel-content-box` on engines that do\n * not support it). Returns the box actually in effect, or `null` if observation\n * could not start at all.\n */\n private _beginObserve(observer: ResizeObserver, element: Element, box?: ResizeBoxOption): ResizeBoxOption | null {\n const requested = box ?? \"content-box\";\n try {\n observer.observe(element, { box: requested });\n return requested;\n } catch {\n // Already content-box and it still threw — nothing safer to fall back to.\n if (requested === \"content-box\") return null;\n try {\n observer.observe(element, { box: \"content-box\" });\n return \"content-box\";\n } catch {\n return null;\n }\n }\n }\n\n private _onResize = (entries: ResizeObserverEntry[]): void => {\n for (const entry of entries) {\n this._setEntry(this._normalizeEntry(entry));\n }\n };\n\n private _normalizeEntry(entry: ResizeObserverEntry): WcsResizeEntry {\n const contentRect = this._normalizeRect(entry.contentRect);\n const contentBoxSize = this._firstBoxSize(entry.contentBoxSize);\n const borderBoxSize = this._firstBoxSize(entry.borderBoxSize);\n // devicePixelContentBoxSize is Chromium-only; absent on other engines.\n const devicePixelContentBoxSize = this._firstBoxSize((entry as { devicePixelContentBoxSize?: ReadonlyArray<ResizeObserverSize> }).devicePixelContentBoxSize);\n const { width, height } = this._headlineSize(contentBoxSize, borderBoxSize, devicePixelContentBoxSize, contentRect);\n return {\n width,\n height,\n contentRect,\n contentBoxSize,\n borderBoxSize,\n devicePixelContentBoxSize,\n target: entry.target,\n };\n }\n\n /**\n * Pick the headline width/height from the boxSize matching the observed `box`,\n * falling back to `contentRect` when that fragment is absent (older engines only\n * fill contentRect). `inlineSize`/`blockSize` map to width/height (correct for\n * horizontal writing modes). Rounds to integers when `round` is set.\n */\n private _headlineSize(\n contentBoxSize: WcsResizeBoxSize | null,\n borderBoxSize: WcsResizeBoxSize | null,\n devicePixelContentBoxSize: WcsResizeBoxSize | null,\n contentRect: WcsResizeRect,\n ): { width: number; height: number } {\n const box = this._effectiveBox;\n let size: WcsResizeBoxSize | null;\n if (box === \"border-box\") {\n size = borderBoxSize;\n } else if (box === \"device-pixel-content-box\") {\n size = devicePixelContentBoxSize;\n } else {\n size = contentBoxSize;\n }\n let width: number;\n let height: number;\n if (size) {\n width = size.inlineSize;\n height = size.blockSize;\n } else {\n width = contentRect.width;\n height = contentRect.height;\n }\n if (this._options.round) {\n width = Math.round(width);\n height = Math.round(height);\n }\n return { width, height };\n }\n\n private _firstBoxSize(list: ReadonlyArray<ResizeObserverSize> | undefined): WcsResizeBoxSize | null {\n if (!list || list.length === 0) return null;\n const first = list[0];\n return { inlineSize: first.inlineSize, blockSize: first.blockSize };\n }\n\n private _normalizeRect(rect: DOMRectReadOnly): WcsResizeRect {\n return {\n x: rect.x,\n y: rect.y,\n width: rect.width,\n height: rect.height,\n top: rect.top,\n right: rect.right,\n bottom: rect.bottom,\n left: rect.left,\n };\n }\n\n private _optionsEqual(a: ResizeOptions, b: ResizeOptions): boolean {\n if ((a.box ?? \"content-box\") !== (b.box ?? \"content-box\")) return false;\n return (a.round ?? false) === (b.round ?? false);\n }\n}\n","import { IWcBindable, ResizeOptions, ResizeBoxOption, WcsResizeEntry } from \"../types.js\";\nimport { ResizeCore } from \"../core/ResizeCore.js\";\n\nconst BOX_VALUES: ReadonlyArray<ResizeBoxOption> = [\"content-box\", \"border-box\", \"device-pixel-content-box\"];\n\n/**\n * `<wcs-resize>` — declarative ResizeObserver.\n *\n * The `target` attribute is the single knob that decides both *what* is observed\n * and how the element renders (it never injects a layout box unless asked):\n *\n * | `target` | observes | display | use case |\n * |-----------------|-----------------------|-------------|----------------------|\n * | omitted | first element child | `contents` | size a wrapped child |\n * | `\"#panel\"` / sel| the matched element | `none` | size an existing node|\n * | `\"self\"` | the element itself | `block` | container-width probe|\n *\n * `display:contents` means wrapping a child injects no box of its own (so a\n * `<wcs-resize><div></wcs-resize>` does not disturb a flex/grid parent); the\n * `target=\"self\"` form takes a `display:block` box that, as a zero-height element,\n * stretches to the parent's available inline size — a container-width probe.\n *\n * Note: a `display:contents` / `display:none` element generates no box, so the\n * observed node must be the child / selector target (which do have boxes), never\n * the `<wcs-resize>` host itself except in the `self` form.\n */\nexport class WcsResize extends HTMLElement {\n static hasConnectedCallbackPromise = false;\n // Only attributes that change *what or how* we observe trigger a re-observe.\n // `once` is intentionally excluded: it is evaluated at change fire time (in\n // `_onChange`), so toggling it takes effect without re-observing — and a\n // re-observe on its change would be a pure no-op (same target, same options).\n // `manual` is also excluded: it is a connect-time policy (\"don't auto-observe on\n // connect\"), not a live switch that should start/stop an active observation.\n // `box` and `round` ARE observed: changing them rebuilds the observer, and the\n // rebuild re-delivers the initial size — which is exactly how a `round` toggle\n // re-emits width/height with the new rounding.\n static observedAttributes = [\"target\", \"box\", \"round\"];\n\n static wcBindable: IWcBindable = {\n ...ResizeCore.wcBindable,\n properties: [\n ...ResizeCore.wcBindable.properties,\n { name: \"trigger\", event: \"wcs-resize:trigger-changed\" },\n ],\n // Shell-level settable surface. Each input carries its mirrored `attribute`\n // hint; `trigger` has none — it is a momentary command-property, not a\n // declarative attribute. The observe / unobserve / disconnect commands are\n // inherited from the Core via the spread above.\n inputs: [\n { name: \"target\", attribute: \"target\" },\n { name: \"box\", attribute: \"box\" },\n { name: \"round\", attribute: \"round\" },\n { name: \"once\", attribute: \"once\" },\n { name: \"manual\", attribute: \"manual\" },\n { name: \"trigger\" },\n ],\n // Core の commands をそのまま継承(単一情報源)。<wcs-intersect>/<wcs-sse> と同型。\n // spread でも継承されるが、Core に command 追加時の追従漏れを防ぐため明示参照する。\n commands: ResizeCore.wcBindable.commands,\n };\n\n private _core: ResizeCore;\n private _trigger: boolean = false;\n\n constructor() {\n super();\n this._core = new ResizeCore(this);\n }\n\n // --- Attribute accessors ---\n\n get target(): string {\n return this.getAttribute(\"target\") ?? \"\";\n }\n\n set target(value: string) {\n this.setAttribute(\"target\", value);\n }\n\n get box(): string {\n return this.getAttribute(\"box\") ?? \"\";\n }\n\n set box(value: string) {\n this.setAttribute(\"box\", value);\n }\n\n get round(): boolean {\n return this.hasAttribute(\"round\");\n }\n\n set round(value: boolean) {\n if (value) {\n this.setAttribute(\"round\", \"\");\n } else {\n this.removeAttribute(\"round\");\n }\n }\n\n get once(): boolean {\n return this.hasAttribute(\"once\");\n }\n\n set once(value: boolean) {\n if (value) {\n this.setAttribute(\"once\", \"\");\n } else {\n this.removeAttribute(\"once\");\n }\n }\n\n get manual(): boolean {\n return this.hasAttribute(\"manual\");\n }\n\n set manual(value: boolean) {\n if (value) {\n this.setAttribute(\"manual\", \"\");\n } else {\n this.removeAttribute(\"manual\");\n }\n }\n\n // --- Core delegated getters ---\n\n get entry(): WcsResizeEntry | null {\n return this._core.entry;\n }\n\n get width(): number {\n return this._core.width;\n }\n\n get height(): number {\n return this._core.height;\n }\n\n get observing(): boolean {\n return this._core.observing;\n }\n\n // --- Command property ---\n\n get trigger(): boolean {\n return this._trigger;\n }\n\n set trigger(value: boolean) {\n // Momentary command-property: a false→true write re-runs observe(). Mirrors the\n // trigger flag on <wcs-intersect> / <wcs-geo>. Prefer the command-token protocol\n // (`command.observe: $command.start`) for state-driven observation; this exists\n // mainly for simple boolean bindings.\n const v = !!value; // normalize truthy state-bindings, like <wcs-intersect>'s setter\n if (v) {\n this._trigger = true;\n // try/finally mirrors <wcs-intersect>'s set trigger: observe() is never-throw\n // today, but should a synchronous throw path ever appear, the finally still\n // auto-resets _trigger (no stuck-true latch) and emits the completion notice.\n try {\n this.observe();\n } finally {\n this._trigger = false;\n // Always auto-reset to false after the observe() attempt — this is the\n // *momentary acknowledgement* that the trigger was consumed, NOT a signal\n // that observation succeeded (whether the target resolved is reflected by\n // `observing`, not by this event). Read `observing` if you need the outcome.\n this.dispatchEvent(new CustomEvent(\"wcs-resize:trigger-changed\", {\n detail: false,\n bubbles: true,\n }));\n }\n }\n }\n\n // --- Commands ---\n\n /** Re-resolve the target from the DOM and (re)start observing. */\n observe(): void {\n const { element, display } = this._resolveTarget();\n // `display` is derived from the `target` *mode* (self/selector/child), not from\n // whether the selector currently matches — so it is applied unconditionally,\n // before the resolution check. A `target=\"#x\"` whose node is momentarily absent\n // still renders `display:none` (it is a selector pointer, never a box).\n this.style.display = display;\n if (!element) {\n // The target is no longer resolvable (e.g. a `target` selector whose node was\n // removed from the DOM). Tear down any stale observation so `observing` does\n // not keep reporting true against a node that is gone.\n this._core.disconnect();\n return;\n }\n this._core.observe(element, this._options());\n }\n\n unobserve(): void {\n // Single-target Shell: \"stop observing my target\" is exactly the Core's\n // teardown. Delegate to the Core's tracked state rather than re-resolving the\n // selector, so a target that has since left the DOM can still be stopped\n // (re-resolving would yield null and silently leave the observer running).\n this._core.disconnect();\n }\n\n disconnect(): void {\n this._core.disconnect();\n }\n\n // --- Internal ---\n\n private _resolveTarget(): { element: Element | null; display: string } {\n const target = this.target;\n if (target === \"self\") {\n // Explicit sentinel: observe the element itself. As a display:block zero-height\n // box it stretches to the parent's available inline size — a container probe.\n return { element: this, display: \"block\" };\n }\n if (target !== \"\") {\n // Selector pointer: observe a referenced element in place, staying invisible.\n const scope = this.getRootNode() as Document | ShadowRoot;\n // A user-authored selector can be syntactically invalid (e.g. `#`, `:::`,\n // `[data-*`), which makes querySelector throw a SyntaxError. Swallow it and\n // treat the target as unresolvable — the same \"nothing to observe\" path as a\n // selector matching no element — so a bad attribute never lets the throw escape\n // observe() → connectedCallback / attributeChangedCallback (never-throw).\n return { element: this._safeQuery(scope, target), display: \"none\" };\n }\n // Omitted: observe the first element child without injecting a box of our own.\n const child = this.firstElementChild;\n if (child) {\n return { element: child, display: \"contents\" };\n }\n // No child to wrap (e.g. used as an empty marker) — fall back to self.\n return { element: this, display: \"block\" };\n }\n\n // Wrap querySelector so a syntactically invalid user-authored selector resolves to\n // null (unresolvable) instead of letting the SyntaxError escape — keeping the\n // sensor never-throw, mirroring intersection's _safeQuery guard.\n private _safeQuery(scope: Document | ShadowRoot, selector: string): Element | null {\n try {\n return scope.querySelector(selector);\n } catch {\n return null;\n }\n }\n\n private _parseBox(): ResizeBoxOption {\n const raw = this.box.trim();\n // Decision: an unrecognized box value falls back to content-box at parse time\n // (rather than letting the Core's observe() reject it), mirroring threshold's\n // range filter in <wcs-intersect>. The Core still has its own runtime fallback\n // for a *valid-but-unsupported* box (e.g. device-pixel-content-box on Safari).\n return (BOX_VALUES as ReadonlyArray<string>).includes(raw) ? (raw as ResizeBoxOption) : \"content-box\";\n }\n\n private _options(): ResizeOptions {\n return {\n box: this._parseBox(),\n round: this.round,\n };\n }\n\n private _onChange = (event: Event): void => {\n // `wcs-resize:change` bubbles, so a nested `<wcs-resize>` descendant's change\n // would otherwise reach this (ancestor) listener and let a *child's* resize tear\n // down *our* observer. Only act on our own Core's event. (This also avoids\n // reading `.detail` off a foreign event shape.)\n if (event.target !== this) return;\n // `once`: tear down after the first size observation. ResizeObserver always\n // delivers the initial size on observe(), so once = measure-once. Gated at fire\n // time so toggling the `once` attribute takes effect live.\n if (this.once) {\n this._core.disconnect();\n }\n };\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n this.addEventListener(\"wcs-resize:change\", this._onChange);\n if (!this.manual) {\n this.observe();\n }\n }\n\n disconnectedCallback(): void {\n this.removeEventListener(\"wcs-resize:change\", this._onChange);\n this._core.disconnect();\n }\n\n attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void {\n // Defensive same-value guard. Per the HTML spec, an attribute change reaction is\n // enqueued whenever setAttribute() runs — including with an unchanged value — so\n // attributeChangedCallback CAN fire on a same-value write. Re-observing on an\n // unchanged attribute would be a wasted observer rebuild, so bail early when the\n // value did not actually change. Kept intentionally; do not remove.\n if (oldValue === newValue) return;\n // Only react once connected and in automatic mode. The Core's idempotency guard\n // absorbs the autoloader upgrade case (attributeChangedCallback +\n // connectedCallback both calling observe() with identical options).\n if (!this.isConnected || this.manual) return;\n this.observe();\n }\n}\n","import { WcsResize } from \"./components/Resize.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.resize)) {\n customElements.define(config.tagNames.resize, WcsResize);\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapResize(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n"],"names":[],"mappings":"AAQA,MAAM,OAAO,GAAoB;AAC/B,IAAA,QAAQ,EAAE;AACR,QAAA,MAAM,EAAE,YAAY;AACrB,KAAA;CACF;AAED,SAAS,UAAU,CAAI,GAAM,EAAA;AAC3B,IAAA,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;AAAE,QAAA,OAAO,GAAG;AACvD,IAAA,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;IAClB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;AAClC,QAAA,UAAU,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