@wcstack/resize 1.22.6 → 1.24.0
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 +2 -0
- package/README.md +2 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.esm.js +49 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -231,6 +231,8 @@ core.observe(document.querySelector("#panel"), { box: "border-box", round: true
|
|
|
231
231
|
core.disconnect();
|
|
232
232
|
```
|
|
233
233
|
|
|
234
|
+
Core の構造サーフェスは wcstack I/O ノード横断の規範です([async-io-node-guidelines §3.9](../../docs/async-io-node-guidelines.md))。要素なしで signals に束縛するには [@wcstack/signals — Core を直接束縛する](../signals/README.ja.md#core-を直接束縛する要素なし) を参照。
|
|
235
|
+
|
|
234
236
|
## 注意・制限
|
|
235
237
|
|
|
236
238
|
- **単一対象。** 各 `<wcs-resize>` は厳密に 1 要素を監視し、状態は単一の値面にマップされます。多数の対象には多数の要素を使ってください。
|
package/README.md
CHANGED
|
@@ -233,6 +233,8 @@ core.observe(document.querySelector("#panel"), { box: "border-box", round: true
|
|
|
233
233
|
core.disconnect();
|
|
234
234
|
```
|
|
235
235
|
|
|
236
|
+
The structural Core surface is normative across wcstack IO nodes ([async-io-node-guidelines §3.9](../../docs/async-io-node-guidelines.md)); to bind it into signals with no element at all, see [@wcstack/signals — Binding a Core directly](../signals/README.md#binding-a-core-directly-no-element).
|
|
237
|
+
|
|
236
238
|
## Notes & limitations
|
|
237
239
|
|
|
238
240
|
- **Single target.** Each `<wcs-resize>` observes exactly one element so the state maps to a single value surface. For many targets, use many elements.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observation semantics of a `properties` entry.
|
|
3
|
+
*
|
|
4
|
+
* "state" — current value. A snapshot may cache it, and equality-based dedupe is safe.
|
|
5
|
+
* "event" — occurrence. Repeated identical payloads are distinct occurrences; never dedupe.
|
|
6
|
+
* "handle" — live / opaque resource with its own lifecycle (e.g. MediaStream). Not
|
|
7
|
+
* snapshot-safe and not necessarily serializable; consumers need an explicit
|
|
8
|
+
* ref / callback surface rather than a value slot.
|
|
9
|
+
*/
|
|
10
|
+
type WcBindableSemantics = "state" | "event" | "handle";
|
|
1
11
|
interface IWcBindableProperty {
|
|
2
12
|
readonly name: string;
|
|
3
13
|
readonly event: string;
|
|
4
14
|
readonly getter?: (event: Event) => any;
|
|
15
|
+
/**
|
|
16
|
+
* Optional, additive, forward-compatible. An absent value means **unspecified**, NOT
|
|
17
|
+
* "state": a reader that finds no `semantics` MUST keep the behavior it had before this
|
|
18
|
+
* field existed (deliver the update as-is; do not start deduping, caching or serializing
|
|
19
|
+
* on assumption). Only an explicit value licenses a reader to change its handling.
|
|
20
|
+
*/
|
|
21
|
+
readonly semantics?: WcBindableSemantics;
|
|
5
22
|
}
|
|
6
23
|
interface IWcBindableInput {
|
|
7
24
|
readonly name: string;
|
package/dist/index.esm.js
CHANGED
|
@@ -62,10 +62,10 @@ class ResizeCore extends EventTarget {
|
|
|
62
62
|
protocol: "wc-bindable",
|
|
63
63
|
version: 1,
|
|
64
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" },
|
|
65
|
+
{ name: "entry", event: "wcs-resize:change", semantics: "state" },
|
|
66
|
+
{ name: "width", event: "wcs-resize:change", semantics: "state", getter: (e) => e.detail.width },
|
|
67
|
+
{ name: "height", event: "wcs-resize:change", semantics: "state", getter: (e) => e.detail.height },
|
|
68
|
+
{ name: "observing", event: "wcs-resize:observing-changed", semantics: "state" },
|
|
69
69
|
],
|
|
70
70
|
commands: [
|
|
71
71
|
{ name: "observe" },
|
|
@@ -324,6 +324,48 @@ class ResizeCore extends EventTarget {
|
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
+
// ===========================================================================
|
|
328
|
+
// AUTO-GENERATED FILE - DO NOT EDIT.
|
|
329
|
+
// Generated from /protocol/upgrade-properties.ts by scripts/sync-protocol-types.mjs.
|
|
330
|
+
// Run `node scripts/sync-protocol-types.mjs` after editing the source.
|
|
331
|
+
// ===========================================================================
|
|
332
|
+
function hasAccessorOnPrototype(target, name) {
|
|
333
|
+
let proto = Object.getPrototypeOf(target);
|
|
334
|
+
while (proto !== null) {
|
|
335
|
+
const descriptor = Object.getOwnPropertyDescriptor(proto, name);
|
|
336
|
+
if (descriptor !== undefined) {
|
|
337
|
+
return typeof descriptor.get === "function" || typeof descriptor.set === "function";
|
|
338
|
+
}
|
|
339
|
+
proto = Object.getPrototypeOf(proto);
|
|
340
|
+
}
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で
|
|
345
|
+
* accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。
|
|
346
|
+
*
|
|
347
|
+
* - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。
|
|
348
|
+
* - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。
|
|
349
|
+
* - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。
|
|
350
|
+
*/
|
|
351
|
+
function upgradeProperties(element) {
|
|
352
|
+
const declaration = element.constructor?.wcBindable;
|
|
353
|
+
const inputs = declaration?.inputs;
|
|
354
|
+
if (inputs === undefined)
|
|
355
|
+
return;
|
|
356
|
+
for (const input of inputs) {
|
|
357
|
+
const name = input.name;
|
|
358
|
+
if (!Object.prototype.hasOwnProperty.call(element, name))
|
|
359
|
+
continue;
|
|
360
|
+
if (!hasAccessorOnPrototype(element, name))
|
|
361
|
+
continue;
|
|
362
|
+
const record = element;
|
|
363
|
+
const value = record[name];
|
|
364
|
+
delete record[name];
|
|
365
|
+
record[name] = value;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
327
369
|
const BOX_VALUES = ["content-box", "border-box", "device-pixel-content-box"];
|
|
328
370
|
/**
|
|
329
371
|
* `<wcs-resize>` — declarative ResizeObserver.
|
|
@@ -362,7 +404,7 @@ class WcsResize extends HTMLElement {
|
|
|
362
404
|
...ResizeCore.wcBindable,
|
|
363
405
|
properties: [
|
|
364
406
|
...ResizeCore.wcBindable.properties,
|
|
365
|
-
{ name: "trigger", event: "wcs-resize:trigger-changed" },
|
|
407
|
+
{ name: "trigger", event: "wcs-resize:trigger-changed", semantics: "state" },
|
|
366
408
|
],
|
|
367
409
|
// Shell-level settable surface. Each input carries its mirrored `attribute`
|
|
368
410
|
// hint; `trigger` has none — it is a momentary command-property, not a
|
|
@@ -631,6 +673,8 @@ class WcsResize extends HTMLElement {
|
|
|
631
673
|
};
|
|
632
674
|
// --- Lifecycle ---
|
|
633
675
|
connectedCallback() {
|
|
676
|
+
// upgrade 前に代入された input を取り込み直す(doc 13 §1.2 / Phase A1)
|
|
677
|
+
upgradeProperties(this);
|
|
634
678
|
this.addEventListener("wcs-resize:change", this._onChange);
|
|
635
679
|
if (!this.manual) {
|
|
636
680
|
this.observe();
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +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 // SSR: ResizeObserver delivers the initial size synchronously, so there is no\n // asynchronous probe to await — readiness is immediate. Kept as a field so the\n // Shell can expose it as connectedCallbackPromise uniformly with the other nodes.\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n }\n\n /** Resolves once the first probe settles. Synchronous here, so already resolved. */\n get ready(): Promise<void> {\n return this._ready;\n }\n\n /**\n * Lifecycle entry point (§3.5). When called with no element it is an idempotent\n * no-op that resolves once ready — resize is command-driven (the Shell resolves\n * the target and calls observe(element)), so connect-time monitoring is started\n * via that command, not here. The Shell backs `connectedCallbackPromise` with\n * this no-arg form. When called with an element it delegates to the element\n * observe command below and still returns `ready` for a uniform return shape.\n */\n observe(): Promise<void>;\n observe(element: Element, options?: ResizeOptions): Promise<void>;\n observe(element?: Element, options: ResizeOptions = {}): Promise<void> {\n if (element) {\n this._observeElement(element, options);\n }\n return this._ready;\n }\n\n /**\n * Tear down the observer and invalidate the lifecycle (§3.5). Mirrors disconnect()\n * but is the lifecycle-named counterpart the Shell calls from disconnectedCallback;\n * a later observe() rebuilds the observer.\n */\n dispose(): void {\n this.disconnect();\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 private _observeElement(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 = true;\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 private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new ResizeCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-resize:observing-changed\": (d) => ({ observing: d === true }),\n });\n }\n\n // SSR: the state binder awaits this before snapshotting. Backed by the Core's\n // synchronous `ready` (resize delivers the initial size synchronously, so it is\n // already resolved); exposed for uniformity with the other @wcstack IO nodes.\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (async-io-node-guidelines.md §3.6): attachInternals is absent\n // in happy-dom / older environments, and pre-125 Chromium rejects\n // non-dashed state names from states.add() (probed and discarded here).\n // Either case silently disables reflection — the component still works,\n // it just doesn't expose :state() selectors.\n try {\n if (typeof this.attachInternals !== \"function\") return null;\n const internals = this.attachInternals();\n internals.states.add(\"wcs-probe\");\n internals.states.delete(\"wcs-probe\");\n return internals;\n } catch {\n return null;\n }\n }\n\n private _wireStates(map: Record<string, (detail: any) => Record<string, boolean>>): void {\n if (this._internals === null) return;\n const states = this._internals.states;\n for (const [event, toStates] of Object.entries(map)) {\n this.addEventListener(event, (e) => {\n const debug = this.hasAttribute(\"debug-states\");\n for (const [name, on] of Object.entries(toStates((e as CustomEvent).detail))) {\n try {\n if (on) { states.add(name); } else { states.delete(name); }\n } catch { /* never-throw */ }\n if (debug) this.toggleAttribute(`data-wcs-state-${name}`, on);\n }\n });\n }\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 // SSR: back connectedCallbackPromise with the Core's readiness probe. The\n // observation itself is started above via the element-observe command; this\n // captures the (synchronously resolved) ready promise for the state binder.\n this._connectedCallbackPromise = this._core.observe();\n }\n\n disconnectedCallback(): void {\n this.removeEventListener(\"wcs-resize:change\", this._onChange);\n this._core.dispose();\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,CAAE,GAA+B,CAAC,GAAG,CAAC,CAAC;IACnD;AACA,IAAA,OAAO,GAAG;AACZ;AAEA,SAAS,SAAS,CAAI,GAAM,EAAA;AAC1B,IAAA,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAA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;AAC7D,QAAA,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;IACtB;AAEA,IAAA,wBAAwB,CAAC,KAAa,EAAE,QAAuB,EAAE,QAAuB,EAAA;;;;;;QAMtF,IAAI,QAAQ,KAAK,QAAQ;YAAE;;;;AAI3B,QAAA,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,MAAM;YAAE;QACtC,IAAI,CAAC,OAAO,EAAE;IAChB;;;SCrWc,kBAAkB,GAAA;AAChC,IAAA,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QAC/C,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC1D;AACF;;ACHM,SAAU,eAAe,CAAC,UAA4B,EAAA;IAC1D,IAAI,UAAU,EAAE;QACd,SAAS,CAAC,UAAU,CAAC;IACvB;AACA,IAAA,kBAAkB,EAAE;AACtB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/config.ts","../src/core/ResizeCore.ts","../src/protocol/upgradeProperties.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\", semantics: \"state\" },\n { name: \"width\", event: \"wcs-resize:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.width },\n { name: \"height\", event: \"wcs-resize:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.height },\n { name: \"observing\", event: \"wcs-resize:observing-changed\", semantics: \"state\" },\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 // SSR: ResizeObserver delivers the initial size synchronously, so there is no\n // asynchronous probe to await — readiness is immediate. Kept as a field so the\n // Shell can expose it as connectedCallbackPromise uniformly with the other nodes.\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n }\n\n /** Resolves once the first probe settles. Synchronous here, so already resolved. */\n get ready(): Promise<void> {\n return this._ready;\n }\n\n /**\n * Lifecycle entry point (§3.5). When called with no element it is an idempotent\n * no-op that resolves once ready — resize is command-driven (the Shell resolves\n * the target and calls observe(element)), so connect-time monitoring is started\n * via that command, not here. The Shell backs `connectedCallbackPromise` with\n * this no-arg form. When called with an element it delegates to the element\n * observe command below and still returns `ready` for a uniform return shape.\n */\n observe(): Promise<void>;\n observe(element: Element, options?: ResizeOptions): Promise<void>;\n observe(element?: Element, options: ResizeOptions = {}): Promise<void> {\n if (element) {\n this._observeElement(element, options);\n }\n return this._ready;\n }\n\n /**\n * Tear down the observer and invalidate the lifecycle (§3.5). Mirrors disconnect()\n * but is the lifecycle-named counterpart the Shell calls from disconnectedCallback;\n * a later observe() rebuilds the observer.\n */\n dispose(): void {\n this.disconnect();\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 private _observeElement(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","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/upgrade-properties.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n// custom element の property upgrade — `static wcBindable.inputs` に宣言した入力のうち、\n// 要素が upgrade される前に代入された own データプロパティを取り込み直す。\n//\n// なぜ必要か:\n// 未定義タグの要素は素の HTMLElement なので、`el.url = \"...\"` は own データプロパティを作る。\n// upgrade 後にクラスの accessor が prototype へ入っても own プロパティが優先されるため、\n// setter は二度と呼ばれず、値は要素へ届かないまま消える(エラーも警告も出ない)。\n// 常にプロパティ代入を行う framework(Angular の `[prop]`、Lit の `.prop=`、\n// Solid の `prop:`、Vue の `.prop` 修飾子)× 遅延定義(autoloader / CDN / code-split)で\n// 常態的に起きる。docs/architecture-hardening/13-framework-adapter-binding-constraints.md §1.2。\n//\n// 安全側の判定:\n// own プロパティがあっても、prototype チェーンに accessor が無ければ「シャドウ」ではなく\n// その own プロパティ自体が正規の格納先なので触らない(public class field を壊さない)。\n//\n// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/upgrade-properties.ts), then run\n// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies\n// (packages/<pkg>/src/protocol/upgradeProperties.ts). Those copies are generated — do not edit them.\nimport { IWcBindable } from \"./wcBindable.js\";\n\nfunction hasAccessorOnPrototype(target: object, name: string): boolean {\n let proto = Object.getPrototypeOf(target);\n while (proto !== null) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, name);\n if (descriptor !== undefined) {\n return typeof descriptor.get === \"function\" || typeof descriptor.set === \"function\";\n }\n proto = Object.getPrototypeOf(proto);\n }\n return false;\n}\n\n/**\n * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で\n * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。\n *\n * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。\n * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。\n * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。\n */\nexport function upgradeProperties(element: object): void {\n const declaration = (element as { constructor?: { wcBindable?: IWcBindable } }).constructor?.wcBindable;\n const inputs = declaration?.inputs;\n if (inputs === undefined) return;\n for (const input of inputs) {\n const name = input.name;\n if (!Object.prototype.hasOwnProperty.call(element, name)) continue;\n if (!hasAccessorOnPrototype(element, name)) continue;\n const record = element as Record<string, unknown>;\n const value = record[name];\n delete record[name];\n record[name] = value;\n }\n}\n","import { IWcBindable, ResizeOptions, ResizeBoxOption, WcsResizeEntry } from \"../types.js\";\nimport { ResizeCore } from \"../core/ResizeCore.js\";\nimport { upgradeProperties } from \"../protocol/upgradeProperties.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 = true;\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\", semantics: \"state\" },\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 private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new ResizeCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-resize:observing-changed\": (d) => ({ observing: d === true }),\n });\n }\n\n // SSR: the state binder awaits this before snapshotting. Backed by the Core's\n // synchronous `ready` (resize delivers the initial size synchronously, so it is\n // already resolved); exposed for uniformity with the other @wcstack IO nodes.\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (async-io-node-guidelines.md §3.6): attachInternals is absent\n // in happy-dom / older environments, and pre-125 Chromium rejects\n // non-dashed state names from states.add() (probed and discarded here).\n // Either case silently disables reflection — the component still works,\n // it just doesn't expose :state() selectors.\n try {\n if (typeof this.attachInternals !== \"function\") return null;\n const internals = this.attachInternals();\n internals.states.add(\"wcs-probe\");\n internals.states.delete(\"wcs-probe\");\n return internals;\n } catch {\n return null;\n }\n }\n\n private _wireStates(map: Record<string, (detail: any) => Record<string, boolean>>): void {\n if (this._internals === null) return;\n const states = this._internals.states;\n for (const [event, toStates] of Object.entries(map)) {\n this.addEventListener(event, (e) => {\n const debug = this.hasAttribute(\"debug-states\");\n for (const [name, on] of Object.entries(toStates((e as CustomEvent).detail))) {\n try {\n if (on) { states.add(name); } else { states.delete(name); }\n } catch { /* never-throw */ }\n if (debug) this.toggleAttribute(`data-wcs-state-${name}`, on);\n }\n });\n }\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 // upgrade 前に代入された input を取り込み直す(doc 13 §1.2 / Phase A1)\n upgradeProperties(this);\n this.addEventListener(\"wcs-resize:change\", this._onChange);\n if (!this.manual) {\n this.observe();\n }\n // SSR: back connectedCallbackPromise with the Core's readiness probe. The\n // observation itself is started above via the element-observe command; this\n // captures the (synchronously resolved) ready promise for the state binder.\n this._connectedCallbackPromise = this._core.observe();\n }\n\n disconnectedCallback(): void {\n this.removeEventListener(\"wcs-resize:change\", this._onChange);\n this._core.dispose();\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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E,IAAI,CAAC,SAAS,CAAC;AAC1D,QAAA,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,IAAI,CAAC,OAAO,EAAE;QAChB;;;;QAIA,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;IACvD;IAEA,oBAAoB,GAAA;QAClB,IAAI,CAAC,mBAAmB,CAAC,mBAAmB,EAAE,IAAI,CAAC,SAAS,CAAC;AAC7D,QAAA,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;IACtB;AAEA,IAAA,wBAAwB,CAAC,KAAa,EAAE,QAAuB,EAAE,QAAuB,EAAA;;;;;;QAMtF,IAAI,QAAQ,KAAK,QAAQ;YAAE;;;;AAI3B,QAAA,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,MAAM;YAAE;QACtC,IAAI,CAAC,OAAO,EAAE;IAChB;;;SCxWc,kBAAkB,GAAA;AAChC,IAAA,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QAC/C,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC1D;AACF;;ACHM,SAAU,eAAe,CAAC,UAA4B,EAAA;IAC1D,IAAI,UAAU,EAAE;QACd,SAAS,CAAC,UAAU,CAAC;IACvB;AACA,IAAA,kBAAkB,EAAE;AACtB;;;;"}
|
package/dist/index.esm.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e={tagNames:{resize:"wcs-resize"}};function t(e){if(null===e||"object"!=typeof e)return e;Object.freeze(e);for(const
|
|
1
|
+
const e={tagNames:{resize:"wcs-resize"}};function t(e){if(null===e||"object"!=typeof e)return e;Object.freeze(e);for(const n of Object.keys(e))t(e[n]);return e}function n(e){if(null===e||"object"!=typeof e)return e;const t={};for(const s of Object.keys(e))t[s]=n(e[s]);return t}let s=null;const r=e;function i(){return s||(s=t(n(e))),s}class o extends EventTarget{static wcBindable={protocol:"wc-bindable",version:1,properties:[{name:"entry",event:"wcs-resize:change",semantics:"state"},{name:"width",event:"wcs-resize:change",semantics:"state",getter:e=>e.detail.width},{name:"height",event:"wcs-resize:change",semantics:"state",getter:e=>e.detail.height},{name:"observing",event:"wcs-resize:observing-changed",semantics:"state"}],commands:[{name:"observe"},{name:"unobserve"},{name:"disconnect"}]};_target;_observer=null;_observed=null;_options={};_effectiveBox="content-box";_entry=null;_observing=!1;_ready=Promise.resolve();constructor(e){super(),this._target=e??this}get ready(){return this._ready}observe(e,t={}){return e&&this._observeElement(e,t),this._ready}dispose(){this.disconnect()}get entry(){return this._entry}get width(){return this._entry?this._entry.width:0}get height(){return this._entry?this._entry.height:0}get observing(){return this._observing}_setEntry(e){this._entry=e,this._target.dispatchEvent(new CustomEvent("wcs-resize:change",{detail:e,bubbles:!0}))}_setObserving(e){this._observing!==e&&(this._observing=e,this._target.dispatchEvent(new CustomEvent("wcs-resize:observing-changed",{detail:e,bubbles:!0})))}_observeElement(e,t={}){if(this._observer&&this._observed===e&&this._optionsEqual(this._options,t))return;this._teardownObserver();const n=this._createObserver();if(!n)return void this._setObserving(!1);const s=this._beginObserve(n,e,t.box);if(null===s)return n.disconnect(),void this._setObserving(!1);this._observer=n,this._observed=e,this._options={box:t.box,round:t.round},this._effectiveBox=s,this._setObserving(!0)}unobserve(e){this._observed===e&&(this._teardownObserver(),this._setObserving(!1))}disconnect(){this._teardownObserver(),this._setObserving(!1)}_teardownObserver(){this._observer&&(this._observer.disconnect(),this._observer=null),this._observed=null}_createObserver(){return"undefined"==typeof ResizeObserver?null:new ResizeObserver(this._onResize)}_beginObserve(e,t,n){const s=n??"content-box";try{return e.observe(t,{box:s}),s}catch{if("content-box"===s)return null;try{return e.observe(t,{box:"content-box"}),"content-box"}catch{return null}}}_onResize=e=>{for(const t of e)this._setEntry(this._normalizeEntry(t))};_normalizeEntry(e){const t=this._normalizeRect(e.contentRect),n=this._firstBoxSize(e.contentBoxSize),s=this._firstBoxSize(e.borderBoxSize),r=this._firstBoxSize(e.devicePixelContentBoxSize),{width:i,height:o}=this._headlineSize(n,s,r,t);return{width:i,height:o,contentRect:t,contentBoxSize:n,borderBoxSize:s,devicePixelContentBoxSize:r,target:e.target}}_headlineSize(e,t,n,s){const r=this._effectiveBox;let i,o,c;return i="border-box"===r?t:"device-pixel-content-box"===r?n:e,i?(o=i.inlineSize,c=i.blockSize):(o=s.width,c=s.height),this._options.round&&(o=Math.round(o),c=Math.round(c)),{width:o,height:c}}_firstBoxSize(e){if(!e||0===e.length)return null;const t=e[0];return{inlineSize:t.inlineSize,blockSize:t.blockSize}}_normalizeRect(e){return{x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left}}_optionsEqual(e,t){return(e.box??"content-box")===(t.box??"content-box")&&(e.round??!1)===(t.round??!1)}}function c(e,t){let n=Object.getPrototypeOf(e);for(;null!==n;){const e=Object.getOwnPropertyDescriptor(n,t);if(void 0!==e)return"function"==typeof e.get||"function"==typeof e.set;n=Object.getPrototypeOf(n)}return!1}const a=["content-box","border-box","device-pixel-content-box"];class h extends HTMLElement{static hasConnectedCallbackPromise=!0;static observedAttributes=["target","box","round"];static wcBindable={...o.wcBindable,properties:[...o.wcBindable.properties,{name:"trigger",event:"wcs-resize:trigger-changed",semantics:"state"}],inputs:[{name:"target",attribute:"target"},{name:"box",attribute:"box"},{name:"round",attribute:"round"},{name:"once",attribute:"once"},{name:"manual",attribute:"manual"},{name:"trigger"}],commands:o.wcBindable.commands};_core;_trigger=!1;_connectedCallbackPromise=Promise.resolve();_internals=null;constructor(){super(),this._core=new o(this),this._internals=this._initInternals(),this._wireStates({"wcs-resize:observing-changed":e=>({observing:!0===e})})}get connectedCallbackPromise(){return this._connectedCallbackPromise}get debugStates(){return this._internals?[...this._internals.states]:[]}_initInternals(){try{if("function"!=typeof this.attachInternals)return null;const e=this.attachInternals();return e.states.add("wcs-probe"),e.states.delete("wcs-probe"),e}catch{return null}}_wireStates(e){if(null===this._internals)return;const t=this._internals.states;for(const[n,s]of Object.entries(e))this.addEventListener(n,e=>{const n=this.hasAttribute("debug-states");for(const[r,i]of Object.entries(s(e.detail))){try{i?t.add(r):t.delete(r)}catch{}n&&this.toggleAttribute(`data-wcs-state-${r}`,i)}})}get target(){return this.getAttribute("target")??""}set target(e){this.setAttribute("target",e)}get box(){return this.getAttribute("box")??""}set box(e){this.setAttribute("box",e)}get round(){return this.hasAttribute("round")}set round(e){e?this.setAttribute("round",""):this.removeAttribute("round")}get once(){return this.hasAttribute("once")}set once(e){e?this.setAttribute("once",""):this.removeAttribute("once")}get manual(){return this.hasAttribute("manual")}set manual(e){e?this.setAttribute("manual",""):this.removeAttribute("manual")}get entry(){return this._core.entry}get width(){return this._core.width}get height(){return this._core.height}get observing(){return this._core.observing}get trigger(){return this._trigger}set trigger(e){if(!!e){this._trigger=!0;try{this.observe()}finally{this._trigger=!1,this.dispatchEvent(new CustomEvent("wcs-resize:trigger-changed",{detail:!1,bubbles:!0}))}}}observe(){const{element:e,display:t}=this._resolveTarget();this.style.display=t,e?this._core.observe(e,this._options()):this._core.disconnect()}unobserve(){this._core.disconnect()}disconnect(){this._core.disconnect()}_resolveTarget(){const e=this.target;if("self"===e)return{element:this,display:"block"};if(""!==e){const t=this.getRootNode();return{element:this._safeQuery(t,e),display:"none"}}const t=this.firstElementChild;return t?{element:t,display:"contents"}:{element:this,display:"block"}}_safeQuery(e,t){try{return e.querySelector(t)}catch{return null}}_parseBox(){const e=this.box.trim();return a.includes(e)?e:"content-box"}_options(){return{box:this._parseBox(),round:this.round}}_onChange=e=>{e.target===this&&this.once&&this._core.disconnect()};connectedCallback(){!function(e){const t=e.constructor?.wcBindable,n=t?.inputs;if(void 0!==n)for(const t of n){const n=t.name;if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!c(e,n))continue;const s=e,r=s[n];delete s[n],s[n]=r}}(this),this.addEventListener("wcs-resize:change",this._onChange),this.manual||this.observe(),this._connectedCallbackPromise=this._core.observe()}disconnectedCallback(){this.removeEventListener("wcs-resize:change",this._onChange),this._core.dispose()}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&!this.manual&&this.observe()}}function b(t){var n;t&&((n=t).tagNames&&Object.assign(e.tagNames,n.tagNames),s=null),customElements.get(r.tagNames.resize)||customElements.define(r.tagNames.resize,h)}export{o as ResizeCore,h as WcsResize,b as bootstrapResize,i as getConfig};
|
|
2
2
|
//# sourceMappingURL=index.esm.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.min.js","sources":["../src/config.ts","../src/core/ResizeCore.ts","../src/components/Resize.ts","../src/bootstrapResize.ts","../src/registerComponents.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 // SSR: ResizeObserver delivers the initial size synchronously, so there is no\n // asynchronous probe to await — readiness is immediate. Kept as a field so the\n // Shell can expose it as connectedCallbackPromise uniformly with the other nodes.\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n }\n\n /** Resolves once the first probe settles. Synchronous here, so already resolved. */\n get ready(): Promise<void> {\n return this._ready;\n }\n\n /**\n * Lifecycle entry point (§3.5). When called with no element it is an idempotent\n * no-op that resolves once ready — resize is command-driven (the Shell resolves\n * the target and calls observe(element)), so connect-time monitoring is started\n * via that command, not here. The Shell backs `connectedCallbackPromise` with\n * this no-arg form. When called with an element it delegates to the element\n * observe command below and still returns `ready` for a uniform return shape.\n */\n observe(): Promise<void>;\n observe(element: Element, options?: ResizeOptions): Promise<void>;\n observe(element?: Element, options: ResizeOptions = {}): Promise<void> {\n if (element) {\n this._observeElement(element, options);\n }\n return this._ready;\n }\n\n /**\n * Tear down the observer and invalidate the lifecycle (§3.5). Mirrors disconnect()\n * but is the lifecycle-named counterpart the Shell calls from disconnectedCallback;\n * a later observe() rebuilds the observer.\n */\n dispose(): void {\n this.disconnect();\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 private _observeElement(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 = true;\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 private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new ResizeCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-resize:observing-changed\": (d) => ({ observing: d === true }),\n });\n }\n\n // SSR: the state binder awaits this before snapshotting. Backed by the Core's\n // synchronous `ready` (resize delivers the initial size synchronously, so it is\n // already resolved); exposed for uniformity with the other @wcstack IO nodes.\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (async-io-node-guidelines.md §3.6): attachInternals is absent\n // in happy-dom / older environments, and pre-125 Chromium rejects\n // non-dashed state names from states.add() (probed and discarded here).\n // Either case silently disables reflection — the component still works,\n // it just doesn't expose :state() selectors.\n try {\n if (typeof this.attachInternals !== \"function\") return null;\n const internals = this.attachInternals();\n internals.states.add(\"wcs-probe\");\n internals.states.delete(\"wcs-probe\");\n return internals;\n } catch {\n return null;\n }\n }\n\n private _wireStates(map: Record<string, (detail: any) => Record<string, boolean>>): void {\n if (this._internals === null) return;\n const states = this._internals.states;\n for (const [event, toStates] of Object.entries(map)) {\n this.addEventListener(event, (e) => {\n const debug = this.hasAttribute(\"debug-states\");\n for (const [name, on] of Object.entries(toStates((e as CustomEvent).detail))) {\n try {\n if (on) { states.add(name); } else { states.delete(name); }\n } catch { /* never-throw */ }\n if (debug) this.toggleAttribute(`data-wcs-state-${name}`, on);\n }\n });\n }\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 // SSR: back connectedCallbackPromise with the Core's readiness probe. The\n // observation itself is started above via the element-observe command; this\n // captures the (synchronously resolved) ready promise for the state binder.\n this._connectedCallbackPromise = this._core.observe();\n }\n\n disconnectedCallback(): void {\n this.removeEventListener(\"wcs-resize:change\", this._onChange);\n this._core.dispose();\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 { 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","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"],"names":["_config","tagNames","resize","deepFreeze","obj","Object","freeze","key","keys","deepClone","clone","frozenConfig","config","getConfig","ResizeCore","EventTarget","static","protocol","version","properties","name","event","getter","e","detail","width","height","commands","_target","_observer","_observed","_options","_effectiveBox","_entry","_observing","_ready","Promise","resolve","constructor","target","super","this","ready","observe","element","options","_observeElement","dispose","disconnect","entry","observing","_setEntry","dispatchEvent","CustomEvent","bubbles","_setObserving","_optionsEqual","_teardownObserver","observer","_createObserver","effectiveBox","_beginObserve","box","round","unobserve","ResizeObserver","_onResize","requested","entries","_normalizeEntry","contentRect","_normalizeRect","contentBoxSize","_firstBoxSize","borderBoxSize","devicePixelContentBoxSize","_headlineSize","size","inlineSize","blockSize","Math","list","length","first","rect","x","y","top","right","bottom","left","a","b","BOX_VALUES","WcsResize","HTMLElement","wcBindable","inputs","attribute","_core","_trigger","_connectedCallbackPromise","_internals","_initInternals","_wireStates","d","connectedCallbackPromise","debugStates","states","attachInternals","internals","add","delete","map","toStates","addEventListener","debug","hasAttribute","on","toggleAttribute","getAttribute","value","setAttribute","removeAttribute","once","manual","trigger","display","_resolveTarget","style","scope","getRootNode","_safeQuery","child","firstElementChild","selector","querySelector","_parseBox","raw","trim","includes","_onChange","connectedCallback","disconnectedCallback","removeEventListener","attributeChangedCallback","_name","oldValue","newValue","isConnected","bootstrapResize","userConfig","partialConfig","assign","customElements","get","define"],"mappings":"AAQA,MAAMA,EAA2B,CAC/BC,SAAU,CACRC,OAAQ,eAIZ,SAASC,EAAcC,GACrB,GAAY,OAARA,GAA+B,iBAARA,EAAkB,OAAOA,EACpDC,OAAOC,OAAOF,GACd,IAAK,MAAMG,KAAOF,OAAOG,KAAKJ,GAC5BD,EAAYC,EAAgCG,IAE9C,OAAOH,CACT,CAEA,SAASK,EAAaL,GACpB,GAAY,OAARA,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SAAWE,MAIjBA,KAAKmF,MACPnF,KAAK0D,MAAMnD,cAMf,iBAAA8F,GACErG,KAAK0E,iBAAiB,oBAAqB1E,KAAKoG,WAC3CpG,KAAKoF,QACRpF,KAAKE,UAKPF,KAAK4D,0BAA4B5D,KAAK0D,MAAMxD,SAC9C,CAEA,oBAAAoG,GACEtG,KAAKuG,oBAAoB,oBAAqBvG,KAAKoG,WACnDpG,KAAK0D,MAAMpD,SACb,CAEA,wBAAAkG,CAAyBC,EAAeC,EAAyBC,GAM3DD,IAAaC,GAIZ3G,KAAK4G,cAAe5G,KAAKoF,QAC9BpF,KAAKE,SACP,ECpWI,SAAU2G,EAAgBC,GHuC1B,IAAoBC,EGtCpBD,KHsCoBC,EGrCZD,GHsCMtJ,UAChBI,OAAOoJ,OAAOzJ,EAAQC,SAAUuJ,EAAcvJ,UAEhDU,EAAe,MI3CV+I,eAAeC,IAAI/I,EAAOX,SAASC,SACtCwJ,eAAeE,OAAOhJ,EAAOX,SAASC,OAAQ4F,EDIlD"}
|
|
1
|
+
{"version":3,"file":"index.esm.min.js","sources":["../src/config.ts","../src/core/ResizeCore.ts","../src/protocol/upgradeProperties.ts","../src/components/Resize.ts","../src/bootstrapResize.ts","../src/registerComponents.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\", semantics: \"state\" },\n { name: \"width\", event: \"wcs-resize:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.width },\n { name: \"height\", event: \"wcs-resize:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.height },\n { name: \"observing\", event: \"wcs-resize:observing-changed\", semantics: \"state\" },\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 // SSR: ResizeObserver delivers the initial size synchronously, so there is no\n // asynchronous probe to await — readiness is immediate. Kept as a field so the\n // Shell can expose it as connectedCallbackPromise uniformly with the other nodes.\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n }\n\n /** Resolves once the first probe settles. Synchronous here, so already resolved. */\n get ready(): Promise<void> {\n return this._ready;\n }\n\n /**\n * Lifecycle entry point (§3.5). When called with no element it is an idempotent\n * no-op that resolves once ready — resize is command-driven (the Shell resolves\n * the target and calls observe(element)), so connect-time monitoring is started\n * via that command, not here. The Shell backs `connectedCallbackPromise` with\n * this no-arg form. When called with an element it delegates to the element\n * observe command below and still returns `ready` for a uniform return shape.\n */\n observe(): Promise<void>;\n observe(element: Element, options?: ResizeOptions): Promise<void>;\n observe(element?: Element, options: ResizeOptions = {}): Promise<void> {\n if (element) {\n this._observeElement(element, options);\n }\n return this._ready;\n }\n\n /**\n * Tear down the observer and invalidate the lifecycle (§3.5). Mirrors disconnect()\n * but is the lifecycle-named counterpart the Shell calls from disconnectedCallback;\n * a later observe() rebuilds the observer.\n */\n dispose(): void {\n this.disconnect();\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 private _observeElement(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","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/upgrade-properties.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n// custom element の property upgrade — `static wcBindable.inputs` に宣言した入力のうち、\n// 要素が upgrade される前に代入された own データプロパティを取り込み直す。\n//\n// なぜ必要か:\n// 未定義タグの要素は素の HTMLElement なので、`el.url = \"...\"` は own データプロパティを作る。\n// upgrade 後にクラスの accessor が prototype へ入っても own プロパティが優先されるため、\n// setter は二度と呼ばれず、値は要素へ届かないまま消える(エラーも警告も出ない)。\n// 常にプロパティ代入を行う framework(Angular の `[prop]`、Lit の `.prop=`、\n// Solid の `prop:`、Vue の `.prop` 修飾子)× 遅延定義(autoloader / CDN / code-split)で\n// 常態的に起きる。docs/architecture-hardening/13-framework-adapter-binding-constraints.md §1.2。\n//\n// 安全側の判定:\n// own プロパティがあっても、prototype チェーンに accessor が無ければ「シャドウ」ではなく\n// その own プロパティ自体が正規の格納先なので触らない(public class field を壊さない)。\n//\n// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/upgrade-properties.ts), then run\n// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies\n// (packages/<pkg>/src/protocol/upgradeProperties.ts). Those copies are generated — do not edit them.\nimport { IWcBindable } from \"./wcBindable.js\";\n\nfunction hasAccessorOnPrototype(target: object, name: string): boolean {\n let proto = Object.getPrototypeOf(target);\n while (proto !== null) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, name);\n if (descriptor !== undefined) {\n return typeof descriptor.get === \"function\" || typeof descriptor.set === \"function\";\n }\n proto = Object.getPrototypeOf(proto);\n }\n return false;\n}\n\n/**\n * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で\n * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。\n *\n * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。\n * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。\n * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。\n */\nexport function upgradeProperties(element: object): void {\n const declaration = (element as { constructor?: { wcBindable?: IWcBindable } }).constructor?.wcBindable;\n const inputs = declaration?.inputs;\n if (inputs === undefined) return;\n for (const input of inputs) {\n const name = input.name;\n if (!Object.prototype.hasOwnProperty.call(element, name)) continue;\n if (!hasAccessorOnPrototype(element, name)) continue;\n const record = element as Record<string, unknown>;\n const value = record[name];\n delete record[name];\n record[name] = value;\n }\n}\n","import { IWcBindable, ResizeOptions, ResizeBoxOption, WcsResizeEntry } from \"../types.js\";\nimport { ResizeCore } from \"../core/ResizeCore.js\";\nimport { upgradeProperties } from \"../protocol/upgradeProperties.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 = true;\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\", semantics: \"state\" },\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 private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new ResizeCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-resize:observing-changed\": (d) => ({ observing: d === true }),\n });\n }\n\n // SSR: the state binder awaits this before snapshotting. Backed by the Core's\n // synchronous `ready` (resize delivers the initial size synchronously, so it is\n // already resolved); exposed for uniformity with the other @wcstack IO nodes.\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (async-io-node-guidelines.md §3.6): attachInternals is absent\n // in happy-dom / older environments, and pre-125 Chromium rejects\n // non-dashed state names from states.add() (probed and discarded here).\n // Either case silently disables reflection — the component still works,\n // it just doesn't expose :state() selectors.\n try {\n if (typeof this.attachInternals !== \"function\") return null;\n const internals = this.attachInternals();\n internals.states.add(\"wcs-probe\");\n internals.states.delete(\"wcs-probe\");\n return internals;\n } catch {\n return null;\n }\n }\n\n private _wireStates(map: Record<string, (detail: any) => Record<string, boolean>>): void {\n if (this._internals === null) return;\n const states = this._internals.states;\n for (const [event, toStates] of Object.entries(map)) {\n this.addEventListener(event, (e) => {\n const debug = this.hasAttribute(\"debug-states\");\n for (const [name, on] of Object.entries(toStates((e as CustomEvent).detail))) {\n try {\n if (on) { states.add(name); } else { states.delete(name); }\n } catch { /* never-throw */ }\n if (debug) this.toggleAttribute(`data-wcs-state-${name}`, on);\n }\n });\n }\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 // upgrade 前に代入された input を取り込み直す(doc 13 §1.2 / Phase A1)\n upgradeProperties(this);\n this.addEventListener(\"wcs-resize:change\", this._onChange);\n if (!this.manual) {\n this.observe();\n }\n // SSR: back connectedCallbackPromise with the Core's readiness probe. The\n // observation itself is started above via the element-observe command; this\n // captures the (synchronously resolved) ready promise for the state binder.\n this._connectedCallbackPromise = this._core.observe();\n }\n\n disconnectedCallback(): void {\n this.removeEventListener(\"wcs-resize:change\", this._onChange);\n this._core.dispose();\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 { 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","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"],"names":["_config","tagNames","resize","deepFreeze","obj","Object","freeze","key","keys","deepClone","clone","frozenConfig","config","getConfig","ResizeCore","EventTarget","static","protocol","version","properties","name","event","semantics","getter","e","detail","width","height","commands","_target","_observer","_observed","_options","_effectiveBox","_entry","_observing","_ready","Promise","resolve","constructor","target","super","this","ready","observe","element","options","_observeElement","dispose","disconnect","entry","observing","_setEntry","dispatchEvent","CustomEvent","bubbles","_setObserving","_optionsEqual","_teardownObserver","observer","_createObserver","effectiveBox","_beginObserve","box","round","unobserve","ResizeObserver","_onResize","requested","entries","_normalizeEntry","contentRect","_normalizeRect","contentBoxSize","_firstBoxSize","borderBoxSize","devicePixelContentBoxSize","_headlineSize","size","inlineSize","blockSize","Math","list","length","first","rect","x","y","top","right","bottom","left","a","b","hasAccessorOnPrototype","proto","getPrototypeOf","descriptor","getOwnPropertyDescriptor","undefined","get","set","BOX_VALUES","WcsResize","HTMLElement","wcBindable","inputs","attribute","_core","_trigger","_connectedCallbackPromise","_internals","_initInternals","_wireStates","d","connectedCallbackPromise","debugStates","states","attachInternals","internals","add","delete","map","toStates","addEventListener","debug","hasAttribute","on","toggleAttribute","getAttribute","value","setAttribute","removeAttribute","once","manual","trigger","display","_resolveTarget","style","scope","getRootNode","_safeQuery","child","firstElementChild","selector","querySelector","_parseBox","raw","trim","includes","_onChange","connectedCallback","declaration","input","prototype","hasOwnProperty","call","record","upgradeProperties","disconnectedCallback","removeEventListener","attributeChangedCallback","_name","oldValue","newValue","isConnected","bootstrapResize","userConfig","partialConfig","assign","customElements","define"],"mappings":"AAQA,MAAMA,EAA2B,CAC/BC,SAAU,CACRC,OAAQ,eAIZ,SAASC,EAAcC,GACrB,GAAY,OAARA,GAA+B,iBAARA,EAAkB,OAAOA,EACpDC,OAAOC,OAAOF,GACd,IAAK,MAAMG,KAAOF,OAAOG,KAAKJ,GAC5BD,EAAYC,EAAgCG,IAE9C,OAAOH,CACT,CAEA,SAASK,EAAaL,GACpB,GAAY,OAARA,GAA+B,iBAARA,EAAkB,OAAOA,EACpD,MAAMM,EAAiC,CAAA,EACvC,IAAK,MAAMH,KAAOF,OAAOG,KAAKJ,GAC5BM,EAAMH,GAAOE,EAAWL,EAAgCG,IAE1D,OAAOG,CACT,CAEA,IAAIC,EAA+B,KAE5B,MAAMC,EAAkBZ,WAEfa,IAId,OAHKF,IACHA,EAAeR,EAAWM,EAAUT,KAE/BW,CACT,CClBM,MAAOG,UAAmBC,YAC9BC,kBAAiC,CAC/BC,SAAU,cACVC,QAAS,EACTC,WAA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mB,SAAWE,MAIjBA,KAAK2F,MACP3F,KAAKkE,MAAM3D,cAMf,iBAAAsG,ID/RI,SAA4B1G,GAChC,MAAM2G,EAAe3G,EAA2DN,aAAakE,WACvFC,EAAS8C,GAAa9C,OAC5B,QAAeP,IAAXO,EACJ,IAAK,MAAM+C,KAAS/C,EAAQ,CAC1B,MAAMtF,EAAOqI,EAAMrI,KACnB,IAAKf,OAAOqJ,UAAUC,eAAeC,KAAK/G,EAASzB,GAAO,SAC1D,IAAK0E,EAAuBjD,EAASzB,GAAO,SAC5C,MAAMyI,EAAShH,EACTqF,EAAQ2B,EAAOzI,UACdyI,EAAOzI,GACdyI,EAAOzI,GAAQ8G,CACjB,CACF,CCoRI4B,CAAkBpH,MAClBA,KAAKkF,iBAAiB,oBAAqBlF,KAAK4G,WAC3C5G,KAAK4F,QACR5F,KAAKE,UAKPF,KAAKoE,0BAA4BpE,KAAKkE,MAAMhE,SAC9C,CAEA,oBAAAmH,GACErH,KAAKsH,oBAAoB,oBAAqBtH,KAAK4G,WACnD5G,KAAKkE,MAAM5D,SACb,CAEA,wBAAAiH,CAAyBC,EAAeC,EAAyBC,GAM3DD,IAAaC,GAIZ1H,KAAK2H,cAAe3H,KAAK4F,QAC9B5F,KAAKE,SACP,ECvWI,SAAU0H,EAAgBC,GJuC1B,IAAoBC,EItCpBD,KJsCoBC,EIrCZD,GJsCMtK,UAChBI,OAAOoK,OAAOzK,EAAQC,SAAUuK,EAAcvK,UAEhDU,EAAe,MK3CV+J,eAAetE,IAAIxF,EAAOX,SAASC,SACtCwK,eAAeC,OAAO/J,EAAOX,SAASC,OAAQqG,EDIlD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wcstack/resize",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0",
|
|
4
4
|
"description": "Declarative ResizeObserver component for Web Components. Framework-agnostic element-size primitive via wc-bindable-protocol.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.esm.js",
|