@wcstack/resize 4.0.0-rc.8 → 4.0.0-rc.9
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/auto.min.js +1 -1
- package/dist/auto.min.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.esm.js +66 -20
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -120,6 +120,8 @@ npm install @wcstack/resize
|
|
|
120
120
|
| `once` | boolean | `false` | 初回計測後に切断(一度きり計測)。 |
|
|
121
121
|
| `manual` | boolean | `false` | connect 時に自動監視せず、コマンドで駆動する。 |
|
|
122
122
|
|
|
123
|
+
**`null` と `undefined`。** 属性に対応する入力(`target`・`box`・`round`・`once`・`manual`)は、`null` を「クリア」として扱います。属性を外し、入力は既定値(`target` なら最初の子)に戻ります。`undefined` は「値が無い」で、属性を最初の書き込みの前の状態 — マークアップに書かれた値、無ければ属性なし — に戻します。どちらも文字列 `"null"` / `"undefined"` として書くことはなく、何にも一致しない `"undefined"` というセレクタになることもありません(`@wcstack/state` は `undefined` を書きませんが、React 19 は値のあった prop を外したときに書き、直接の代入でも届きます)。`trigger` はどちらも無視します。
|
|
124
|
+
|
|
123
125
|
> **`trigger`** には*属性がありません* — `@wcstack/state` 配線専用の momentary なコマンドプロパティです。`false → true` の書き込みで `observe()` を再実行し、即 `false` に戻ります(一度きりの確認応答。実際の成否は `observing` を読む)。状態駆動の監視には、この boolean よりコマンドトークンプロトコル(`command.observe: …`)を推奨します。
|
|
124
126
|
|
|
125
127
|
## 出力状態
|
package/README.md
CHANGED
|
@@ -120,6 +120,8 @@ Two defenses, in order of preference:
|
|
|
120
120
|
| `once` | boolean | `false` | Disconnect after the first size observation (measure-once). |
|
|
121
121
|
| `manual` | boolean | `false` | Do not auto-observe on connect; drive it via commands instead. |
|
|
122
122
|
|
|
123
|
+
**`null` and `undefined`.** The inputs backed by an attribute (`target`, `box`, `round`, `once`, `manual`) take `null` as "clear": the attribute is removed and the input falls back to its default (for `target`, the first child). `undefined` means "no value supplied": the attribute goes back to what it was before the first write — the value written in the markup, or none. Neither is ever written as the string `"null"` / `"undefined"` (an `"undefined"` selector would match nothing). (`@wcstack/state` never writes `undefined`; React 19 does when a prop that had a value is removed, and so can a direct assignment.) `trigger` ignores both.
|
|
124
|
+
|
|
123
125
|
> **`trigger`** has *no attribute* — it is a momentary command-property meant for `@wcstack/state` wiring only. A `false → true` write re-runs `observe()` and the property auto-resets to `false` (a one-shot acknowledgement; read `observing` for the actual outcome). Prefer the command-token protocol (`command.observe: …`) over this boolean for state-driven observation.
|
|
124
126
|
|
|
125
127
|
## Output state
|
package/dist/auto.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e={tagNames:{resize:"wcs-resize"}};class t 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
|
|
1
|
+
const e={tagNames:{resize:"wcs-resize"}};class t 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 n(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 s=new WeakMap;function r(e,t){let n=s.get(e);return void 0===n&&(n=new Map,s.set(e,n)),n.has(t)||n.set(t,e.getAttribute(t)),n.get(t)}function i(e,t,n){null===n?e.removeAttribute(t):e.setAttribute(t,n)}function o(e,t,n){const s=r(e,t);i(e,t,void 0===n?s:null===n?null:String(n))}function c(e,t,n){const s=r(e,t);i(e,t,void 0===n?s:n?"":null)}const a=["content-box","border-box","device-pixel-content-box"];class h extends HTMLElement{static hasConnectedCallbackPromise=!0;static observedAttributes=["target","box","round"];static wcBindable={...t.wcBindable,properties:[...t.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:t.wcBindable.commands};_core;_trigger=!1;_connectedCallbackPromise=Promise.resolve();_internals=null;constructor(){super(),this._core=new t(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){o(this,"target",e)}get box(){return this.getAttribute("box")??""}set box(e){o(this,"box",e)}get round(){return this.hasAttribute("round")}set round(e){c(this,"round",e)}get once(){return this.hasAttribute("once")}set once(e){c(this,"once",e)}get manual(){return this.hasAttribute("manual")}set manual(e){c(this,"manual",e)}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,s=t?.inputs;if(void 0!==s)for(const t of s){const s=t.name;if(!Object.prototype.hasOwnProperty.call(e,s))continue;if(!n(e,s))continue;const r=e,i=r[s];delete r[s],r[s]=i}}(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()}}var l;!function(t=customElements){t.get(e.tagNames.resize)||t.define(e.tagNames.resize,h)}(l);
|
|
2
2
|
//# sourceMappingURL=auto.min.js.map
|
package/dist/auto.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto.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\n/** A misspelt option would otherwise do nothing: `bootstrapResize` refuses it. */\nfunction invalid(key: string): never {\n throw new Error(`[@wcstack/resize] bootstrapResize: \"${key}\" is not one of its options, or not of the option's type.`);\n}\n\n/**\n * Applies the options given; an undefined value is left out. An option this package does not\n * have, a value of another type than its default (null, or an array for an object, included) or\n * a tag name it does not define throws, and then nothing is applied.\n */\nexport function setConfig(partialConfig: IWritableConfig): void {\n const options = _config as unknown as Record<string, unknown>;\n const tags = _config.tagNames as Record<string, string>;\n const given = Object.entries(partialConfig).filter(([, value]) => value !== undefined);\n const givenTags = Object.entries(partialConfig.tagNames ?? {}).filter(([, tag]) => tag !== undefined);\n for (const [key, value] of given) {\n const current = options[key];\n if (!Object.hasOwn(options, key) || value === null || typeof value !== typeof current || Array.isArray(value) !== Array.isArray(current)) {\n invalid(key);\n }\n }\n for (const [name, tag] of givenTags) {\n if (!Object.hasOwn(tags, name) || typeof tag !== \"string\") invalid(`tagNames.${name}`);\n }\n for (const [name, tag] of givenTags) tags[name] = tag as string;\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, registry?: CustomElementRegistry): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents(registry);\n}\n","import { WcsResize } from \"./components/Resize.js\";\nimport { config } from \"./config.js\";\n\n/**\n * Register this package's tags. Pass a scoped `CustomElementRegistry` to define\n * them for a single shadow tree -- scoped registries do not inherit the global\n * one, so a tree using one needs its own definitions.\n */\nexport function registerComponents(registry: CustomElementRegistry = customElements): void {\n if (!registry.get(config.tagNames.resize)) {\n registry.define(config.tagNames.resize, WcsResize);\n }\n}\n"],"names":["config","tagNames","resize","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","Object","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","registry","customElements","define","registerComponents"],"mappings":"AAQA,MA0BaA,EA1BoB,CAC/BC,SAAU,CACRC,OAAQ,eCaN,MAAOC,UAAmBC,YAC9BC,kBAAiC,CAC/BC,SAAU,cACV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mB,SAAWE,MAIjBA,KAAK4F,MACP5F,KAAKmE,MAAM5D,cAMf,iBAAAuG,ID/RI,SAA4B3G,GAChC,MAAM4G,EAAe5G,EAA2DN,aAAamE,WACvFC,EAAS8C,GAAa9C,OAC5B,QAAeP,IAAXO,EACJ,IAAK,MAAM+C,KAAS/C,EAAQ,CAC1B,MAAMvF,EAAOsI,EAAMtI,KACnB,IAAK4E,OAAO2D,UAAUC,eAAeC,KAAKhH,EAASzB,GAAO,SAC1D,IAAK0E,EAAuBjD,EAASzB,GAAO,SAC5C,MAAM0I,EAASjH,EACTsF,EAAQ2B,EAAO1I,UACd0I,EAAO1I,GACd0I,EAAO1I,GAAQ+G,CACjB,CACF,CCoRI4B,CAAkBrH,MAClBA,KAAKmF,iBAAiB,oBAAqBnF,KAAK6G,WAC3C7G,KAAK6F,QACR7F,KAAKE,UAKPF,KAAKqE,0BAA4BrE,KAAKmE,MAAMjE,SAC9C,CAEA,oBAAAoH,GACEtH,KAAKuH,oBAAoB,oBAAqBvH,KAAK6G,WACnD7G,KAAKmE,MAAM7D,SACb,CAEA,wBAAAkH,CAAyBC,EAAeC,EAAyBC,GAM3DD,IAAaC,GAIZ3H,KAAK4H,cAAe5H,KAAK6F,QAC9B7F,KAAKE,SACP,ECvWI,IAAwD2H,GCIxD,SAA6BA,EAAkCC,gBAC9DD,EAASlE,IAAI1F,EAAOC,SAASC,SAChC0J,EAASE,OAAO9J,EAAOC,SAASC,OAAQ2F,EAE5C,CDJEkE,CAAmBH"}
|
|
1
|
+
{"version":3,"file":"auto.min.js","sources":["../src/config.ts","../src/core/ResizeCore.ts","../src/protocol/upgradeProperties.ts","../src/protocol/inputAttribute.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\n/** A misspelt option would otherwise do nothing: `bootstrapResize` refuses it. */\nfunction invalid(key: string): never {\n throw new Error(`[@wcstack/resize] bootstrapResize: \"${key}\" is not one of its options, or not of the option's type.`);\n}\n\n/**\n * Applies the options given; an undefined value is left out. An option this package does not\n * have, a value of another type than its default (null, or an array for an object, included) or\n * a tag name it does not define throws, and then nothing is applied.\n */\nexport function setConfig(partialConfig: IWritableConfig): void {\n const options = _config as unknown as Record<string, unknown>;\n const tags = _config.tagNames as Record<string, string>;\n const given = Object.entries(partialConfig).filter(([, value]) => value !== undefined);\n const givenTags = Object.entries(partialConfig.tagNames ?? {}).filter(([, tag]) => tag !== undefined);\n for (const [key, value] of given) {\n const current = options[key];\n if (!Object.hasOwn(options, key) || value === null || typeof value !== typeof current || Array.isArray(value) !== Array.isArray(current)) {\n invalid(key);\n }\n }\n for (const [name, tag] of givenTags) {\n if (!Object.hasOwn(tags, name) || typeof tag !== \"string\") invalid(`tagNames.${name}`);\n }\n for (const [name, tag] of givenTags) tags[name] = tag as string;\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","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/input-attribute.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n// 属性へ反映する wc-bindable 入力の producer 側(SPEC-extensions § Producer guidance for inputs の P1〜P3)。\n// 入力の setter は属性をこの 2 関数で書く。それで次が揃う:\n// - `undefined` は「値が無い」(P1): 属性を、この関数で最初に書く前の状態 — マークアップに書かれた値、\n// 無ければ属性なし(= その入力の文書化した既定値)— へ戻す。applier プロファイルを宣言する binder は\n// 値の後の `undefined` を書き(A2)、React 19 も書き、直接の代入でも届く。\n// - `null` はクリア(P2): 属性なし、つまり文書化した既定値。\n// - どちらも文字列 \"undefined\" / \"null\" として属性に入らない。\n//\n// 「最初に書く前」は、その最初の書き込みのときに読む(遅延)。upgrade 前に代入されたプロパティは\n// connectedCallback の upgradeProperties() が通し直すので、そのときにはパーサが書いた属性が揃っている。\n// 要素自身が setter を通さずに書いた属性は、最初の書き込みより前なら「最初の状態」に含まれる。\n//\n// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/input-attribute.ts), then run\n// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies\n// (packages/<pkg>/src/protocol/inputAttribute.ts). Those copies are generated — do not edit them.\n\nconst initialAttributes = new WeakMap<Element, Map<string, string | null>>();\n\n/** The attribute as it stood before the first write through these helpers. */\nfunction initialAttribute(el: Element, name: string): string | null {\n let byName = initialAttributes.get(el);\n if (byName === undefined) {\n byName = new Map();\n initialAttributes.set(el, byName);\n }\n if (!byName.has(name)) byName.set(name, el.getAttribute(name));\n return byName.get(name) as string | null;\n}\n\nfunction writeAttribute(el: Element, name: string, value: string | null): void {\n if (value === null) el.removeAttribute(name);\n else el.setAttribute(name, value);\n}\n\n/**\n * A value attribute. `value` is written as `String(value)`; `null` removes the attribute;\n * `undefined` restores the attribute the element started with.\n */\nexport function reflectAttribute(el: Element, name: string, value: unknown): void {\n const initial = initialAttribute(el, name);\n writeAttribute(el, name, value === undefined ? initial : value === null ? null : String(value));\n}\n\n/**\n * A boolean attribute, present while `value` is truthy (`null` and `false` remove it);\n * `undefined` restores the attribute the element started with.\n */\nexport function reflectBooleanAttribute(el: Element, name: string, value: unknown): void {\n const initial = initialAttribute(el, name);\n writeAttribute(el, name, value === undefined ? initial : value ? \"\" : null);\n}\n","import { IWcBindable, ResizeOptions, ResizeBoxOption, WcsResizeEntry } from \"../types.js\";\nimport { ResizeCore } from \"../core/ResizeCore.js\";\nimport { upgradeProperties } from \"../protocol/upgradeProperties.js\";\nimport { reflectAttribute, reflectBooleanAttribute } from \"../protocol/inputAttribute.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 // Setters never let setAttribute stringify null / undefined (an \"undefined\"\n // target is a selector that matches nothing, so nothing would be observed):\n // `null` removes the attribute (the default), `undefined` restores the\n // attribute the element started with (wc-bindable producer guidance P1;\n // React 19 and a direct assignment deliver it, @wcstack/state does not).\n\n get target(): string {\n return this.getAttribute(\"target\") ?? \"\";\n }\n\n set target(value: string | null | undefined) {\n reflectAttribute(this, \"target\", value);\n }\n\n get box(): string {\n return this.getAttribute(\"box\") ?? \"\";\n }\n\n set box(value: string | null | undefined) {\n reflectAttribute(this, \"box\", value);\n }\n\n get round(): boolean {\n return this.hasAttribute(\"round\");\n }\n\n set round(value: boolean | null | undefined) {\n reflectBooleanAttribute(this, \"round\", value);\n }\n\n get once(): boolean {\n return this.hasAttribute(\"once\");\n }\n\n set once(value: boolean | null | undefined) {\n reflectBooleanAttribute(this, \"once\", value);\n }\n\n get manual(): boolean {\n return this.hasAttribute(\"manual\");\n }\n\n set manual(value: boolean | null | undefined) {\n reflectBooleanAttribute(this, \"manual\", value);\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, registry?: CustomElementRegistry): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents(registry);\n}\n","import { WcsResize } from \"./components/Resize.js\";\nimport { config } from \"./config.js\";\n\n/**\n * Register this package's tags. Pass a scoped `CustomElementRegistry` to define\n * them for a single shadow tree -- scoped registries do not inherit the global\n * one, so a tree using one needs its own definitions.\n */\nexport function registerComponents(registry: CustomElementRegistry = customElements): void {\n if (!registry.get(config.tagNames.resize)) {\n registry.define(config.tagNames.resize, WcsResize);\n }\n}\n"],"names":["config","tagNames","resize","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","Object","getPrototypeOf","descriptor","getOwnPropertyDescriptor","undefined","get","set","initialAttributes","WeakMap","initialAttribute","el","byName","Map","has","getAttribute","writeAttribute","value","removeAttribute","setAttribute","reflectAttribute","initial","String","reflectBooleanAttribute","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","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","registry","customElements","define","registerComponents"],"mappings":"AAQA,MA0BaA,EA1BoB,CAC/BC,SAAU,CACRC,OAAQ,eCaN,MAAOC,UAAmBC,YAC9BC,kBAAiC,CAC/BC,SAAU,cACVC,QAAS,EACTC,WAAY,CACV,CAAEC,KAAM,QAASC,MAAO,oBAAqBC,UAAW,SACxD,CAAEF,KAAM,QAASC,MAAO,oBAAqBC,UAAW,QAASC,OAASC,GAAcA,EAAkBC,OAAOC,OACjH,CAAEN,KAAM,SAAUC,MAAO,oBAAqBC,UAAW,QAASC,OAASC,GAAcA,EAAkBC,OAAOE,QAClH,CAAEP,KAAM,YAAaC,MAAO,+BAAgCC,UAAW,UAEzEM,SAAU,CACR,CAAER,KAAM,WACR,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package/dist/index.d.ts
CHANGED
|
@@ -314,15 +314,15 @@ declare class WcsResize extends HTMLElement {
|
|
|
314
314
|
private _initInternals;
|
|
315
315
|
private _wireStates;
|
|
316
316
|
get target(): string;
|
|
317
|
-
set target(value: string);
|
|
317
|
+
set target(value: string | null | undefined);
|
|
318
318
|
get box(): string;
|
|
319
|
-
set box(value: string);
|
|
319
|
+
set box(value: string | null | undefined);
|
|
320
320
|
get round(): boolean;
|
|
321
|
-
set round(value: boolean);
|
|
321
|
+
set round(value: boolean | null | undefined);
|
|
322
322
|
get once(): boolean;
|
|
323
|
-
set once(value: boolean);
|
|
323
|
+
set once(value: boolean | null | undefined);
|
|
324
324
|
get manual(): boolean;
|
|
325
|
-
set manual(value: boolean);
|
|
325
|
+
set manual(value: boolean | null | undefined);
|
|
326
326
|
get entry(): WcsResizeEntry | null;
|
|
327
327
|
get width(): number;
|
|
328
328
|
get height(): number;
|
package/dist/index.esm.js
CHANGED
|
@@ -388,6 +388,61 @@ function upgradeProperties(element) {
|
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
+
// ===========================================================================
|
|
392
|
+
// AUTO-GENERATED FILE - DO NOT EDIT.
|
|
393
|
+
// Generated from /protocol/input-attribute.ts by scripts/sync-protocol-types.mjs.
|
|
394
|
+
// Run `node scripts/sync-protocol-types.mjs` after editing the source.
|
|
395
|
+
// ===========================================================================
|
|
396
|
+
// 属性へ反映する wc-bindable 入力の producer 側(SPEC-extensions § Producer guidance for inputs の P1〜P3)。
|
|
397
|
+
// 入力の setter は属性をこの 2 関数で書く。それで次が揃う:
|
|
398
|
+
// - `undefined` は「値が無い」(P1): 属性を、この関数で最初に書く前の状態 — マークアップに書かれた値、
|
|
399
|
+
// 無ければ属性なし(= その入力の文書化した既定値)— へ戻す。applier プロファイルを宣言する binder は
|
|
400
|
+
// 値の後の `undefined` を書き(A2)、React 19 も書き、直接の代入でも届く。
|
|
401
|
+
// - `null` はクリア(P2): 属性なし、つまり文書化した既定値。
|
|
402
|
+
// - どちらも文字列 "undefined" / "null" として属性に入らない。
|
|
403
|
+
//
|
|
404
|
+
// 「最初に書く前」は、その最初の書き込みのときに読む(遅延)。upgrade 前に代入されたプロパティは
|
|
405
|
+
// connectedCallback の upgradeProperties() が通し直すので、そのときにはパーサが書いた属性が揃っている。
|
|
406
|
+
// 要素自身が setter を通さずに書いた属性は、最初の書き込みより前なら「最初の状態」に含まれる。
|
|
407
|
+
//
|
|
408
|
+
// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/input-attribute.ts), then run
|
|
409
|
+
// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies
|
|
410
|
+
// (packages/<pkg>/src/protocol/inputAttribute.ts). Those copies are generated — do not edit them.
|
|
411
|
+
const initialAttributes = new WeakMap();
|
|
412
|
+
/** The attribute as it stood before the first write through these helpers. */
|
|
413
|
+
function initialAttribute(el, name) {
|
|
414
|
+
let byName = initialAttributes.get(el);
|
|
415
|
+
if (byName === undefined) {
|
|
416
|
+
byName = new Map();
|
|
417
|
+
initialAttributes.set(el, byName);
|
|
418
|
+
}
|
|
419
|
+
if (!byName.has(name))
|
|
420
|
+
byName.set(name, el.getAttribute(name));
|
|
421
|
+
return byName.get(name);
|
|
422
|
+
}
|
|
423
|
+
function writeAttribute(el, name, value) {
|
|
424
|
+
if (value === null)
|
|
425
|
+
el.removeAttribute(name);
|
|
426
|
+
else
|
|
427
|
+
el.setAttribute(name, value);
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* A value attribute. `value` is written as `String(value)`; `null` removes the attribute;
|
|
431
|
+
* `undefined` restores the attribute the element started with.
|
|
432
|
+
*/
|
|
433
|
+
function reflectAttribute(el, name, value) {
|
|
434
|
+
const initial = initialAttribute(el, name);
|
|
435
|
+
writeAttribute(el, name, value === undefined ? initial : value === null ? null : String(value));
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* A boolean attribute, present while `value` is truthy (`null` and `false` remove it);
|
|
439
|
+
* `undefined` restores the attribute the element started with.
|
|
440
|
+
*/
|
|
441
|
+
function reflectBooleanAttribute(el, name, value) {
|
|
442
|
+
const initial = initialAttribute(el, name);
|
|
443
|
+
writeAttribute(el, name, value === undefined ? initial : value ? "" : null);
|
|
444
|
+
}
|
|
445
|
+
|
|
391
446
|
const BOX_VALUES = ["content-box", "border-box", "device-pixel-content-box"];
|
|
392
447
|
/**
|
|
393
448
|
* `<wcs-resize>` — declarative ResizeObserver.
|
|
@@ -511,50 +566,41 @@ class WcsResize extends HTMLElement {
|
|
|
511
566
|
}
|
|
512
567
|
}
|
|
513
568
|
// --- Attribute accessors ---
|
|
569
|
+
//
|
|
570
|
+
// Setters never let setAttribute stringify null / undefined (an "undefined"
|
|
571
|
+
// target is a selector that matches nothing, so nothing would be observed):
|
|
572
|
+
// `null` removes the attribute (the default), `undefined` restores the
|
|
573
|
+
// attribute the element started with (wc-bindable producer guidance P1;
|
|
574
|
+
// React 19 and a direct assignment deliver it, @wcstack/state does not).
|
|
514
575
|
get target() {
|
|
515
576
|
return this.getAttribute("target") ?? "";
|
|
516
577
|
}
|
|
517
578
|
set target(value) {
|
|
518
|
-
this
|
|
579
|
+
reflectAttribute(this, "target", value);
|
|
519
580
|
}
|
|
520
581
|
get box() {
|
|
521
582
|
return this.getAttribute("box") ?? "";
|
|
522
583
|
}
|
|
523
584
|
set box(value) {
|
|
524
|
-
this
|
|
585
|
+
reflectAttribute(this, "box", value);
|
|
525
586
|
}
|
|
526
587
|
get round() {
|
|
527
588
|
return this.hasAttribute("round");
|
|
528
589
|
}
|
|
529
590
|
set round(value) {
|
|
530
|
-
|
|
531
|
-
this.setAttribute("round", "");
|
|
532
|
-
}
|
|
533
|
-
else {
|
|
534
|
-
this.removeAttribute("round");
|
|
535
|
-
}
|
|
591
|
+
reflectBooleanAttribute(this, "round", value);
|
|
536
592
|
}
|
|
537
593
|
get once() {
|
|
538
594
|
return this.hasAttribute("once");
|
|
539
595
|
}
|
|
540
596
|
set once(value) {
|
|
541
|
-
|
|
542
|
-
this.setAttribute("once", "");
|
|
543
|
-
}
|
|
544
|
-
else {
|
|
545
|
-
this.removeAttribute("once");
|
|
546
|
-
}
|
|
597
|
+
reflectBooleanAttribute(this, "once", value);
|
|
547
598
|
}
|
|
548
599
|
get manual() {
|
|
549
600
|
return this.hasAttribute("manual");
|
|
550
601
|
}
|
|
551
602
|
set manual(value) {
|
|
552
|
-
|
|
553
|
-
this.setAttribute("manual", "");
|
|
554
|
-
}
|
|
555
|
-
else {
|
|
556
|
-
this.removeAttribute("manual");
|
|
557
|
-
}
|
|
603
|
+
reflectBooleanAttribute(this, "manual", value);
|
|
558
604
|
}
|
|
559
605
|
// --- Core delegated getters ---
|
|
560
606
|
get entry() {
|
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/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\n/** A misspelt option would otherwise do nothing: `bootstrapResize` refuses it. */\nfunction invalid(key: string): never {\n throw new Error(`[@wcstack/resize] bootstrapResize: \"${key}\" is not one of its options, or not of the option's type.`);\n}\n\n/**\n * Applies the options given; an undefined value is left out. An option this package does not\n * have, a value of another type than its default (null, or an array for an object, included) or\n * a tag name it does not define throws, and then nothing is applied.\n */\nexport function setConfig(partialConfig: IWritableConfig): void {\n const options = _config as unknown as Record<string, unknown>;\n const tags = _config.tagNames as Record<string, string>;\n const given = Object.entries(partialConfig).filter(([, value]) => value !== undefined);\n const givenTags = Object.entries(partialConfig.tagNames ?? {}).filter(([, tag]) => tag !== undefined);\n for (const [key, value] of given) {\n const current = options[key];\n if (!Object.hasOwn(options, key) || value === null || typeof value !== typeof current || Array.isArray(value) !== Array.isArray(current)) {\n invalid(key);\n }\n }\n for (const [name, tag] of givenTags) {\n if (!Object.hasOwn(tags, name) || typeof tag !== \"string\") invalid(`tagNames.${name}`);\n }\n for (const [name, tag] of givenTags) tags[name] = tag as string;\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\n/**\n * Register this package's tags. Pass a scoped `CustomElementRegistry` to define\n * them for a single shadow tree -- scoped registries do not inherit the global\n * one, so a tree using one needs its own definitions.\n */\nexport function registerComponents(registry: CustomElementRegistry = customElements): void {\n if (!registry.get(config.tagNames.resize)) {\n registry.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, registry?: CustomElementRegistry): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents(registry);\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,QAAQ;AAAE,QAAA,OAAO,GAAG;IACvD,MAAM,KAAK,GAA4B,EAAE;IACzC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAClC,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAAE,GAA+B,CAAC,GAAG,CAAC,CAAC;IAC/D;AACA,IAAA,OAAO,KAAU;AACnB;AAEA,IAAI,YAAY,GAAmB,IAAI;AAEhC,MAAM,MAAM,GAAY,OAAkB;SAEjC,SAAS,GAAA;IACvB,IAAI,CAAC,YAAY,EAAE;QACjB,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC/C;AACA,IAAA,OAAO,YAAY;AACrB;A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EAAE,SAAS,CAAC;IACpD;AACF;;ACRM,SAAU,eAAe,CAAC,UAA4B,EAAE,QAAgC,EAAA;IAC5F,IAAI,UAAU,EAAE;QACd,SAAS,CAAC,UAAU,CAAC;IACvB;IACA,kBAAkB,CAAC,QAAQ,CAAC;AAC9B;;;;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/config.ts","../src/core/ResizeCore.ts","../src/protocol/upgradeProperties.ts","../src/protocol/inputAttribute.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\n/** A misspelt option would otherwise do nothing: `bootstrapResize` refuses it. */\nfunction invalid(key: string): never {\n throw new Error(`[@wcstack/resize] bootstrapResize: \"${key}\" is not one of its options, or not of the option's type.`);\n}\n\n/**\n * Applies the options given; an undefined value is left out. An option this package does not\n * have, a value of another type than its default (null, or an array for an object, included) or\n * a tag name it does not define throws, and then nothing is applied.\n */\nexport function setConfig(partialConfig: IWritableConfig): void {\n const options = _config as unknown as Record<string, unknown>;\n const tags = _config.tagNames as Record<string, string>;\n const given = Object.entries(partialConfig).filter(([, value]) => value !== undefined);\n const givenTags = Object.entries(partialConfig.tagNames ?? {}).filter(([, tag]) => tag !== undefined);\n for (const [key, value] of given) {\n const current = options[key];\n if (!Object.hasOwn(options, key) || value === null || typeof value !== typeof current || Array.isArray(value) !== Array.isArray(current)) {\n invalid(key);\n }\n }\n for (const [name, tag] of givenTags) {\n if (!Object.hasOwn(tags, name) || typeof tag !== \"string\") invalid(`tagNames.${name}`);\n }\n for (const [name, tag] of givenTags) tags[name] = tag as string;\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","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/input-attribute.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n// 属性へ反映する wc-bindable 入力の producer 側(SPEC-extensions § Producer guidance for inputs の P1〜P3)。\n// 入力の setter は属性をこの 2 関数で書く。それで次が揃う:\n// - `undefined` は「値が無い」(P1): 属性を、この関数で最初に書く前の状態 — マークアップに書かれた値、\n// 無ければ属性なし(= その入力の文書化した既定値)— へ戻す。applier プロファイルを宣言する binder は\n// 値の後の `undefined` を書き(A2)、React 19 も書き、直接の代入でも届く。\n// - `null` はクリア(P2): 属性なし、つまり文書化した既定値。\n// - どちらも文字列 \"undefined\" / \"null\" として属性に入らない。\n//\n// 「最初に書く前」は、その最初の書き込みのときに読む(遅延)。upgrade 前に代入されたプロパティは\n// connectedCallback の upgradeProperties() が通し直すので、そのときにはパーサが書いた属性が揃っている。\n// 要素自身が setter を通さずに書いた属性は、最初の書き込みより前なら「最初の状態」に含まれる。\n//\n// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/input-attribute.ts), then run\n// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies\n// (packages/<pkg>/src/protocol/inputAttribute.ts). Those copies are generated — do not edit them.\n\nconst initialAttributes = new WeakMap<Element, Map<string, string | null>>();\n\n/** The attribute as it stood before the first write through these helpers. */\nfunction initialAttribute(el: Element, name: string): string | null {\n let byName = initialAttributes.get(el);\n if (byName === undefined) {\n byName = new Map();\n initialAttributes.set(el, byName);\n }\n if (!byName.has(name)) byName.set(name, el.getAttribute(name));\n return byName.get(name) as string | null;\n}\n\nfunction writeAttribute(el: Element, name: string, value: string | null): void {\n if (value === null) el.removeAttribute(name);\n else el.setAttribute(name, value);\n}\n\n/**\n * A value attribute. `value` is written as `String(value)`; `null` removes the attribute;\n * `undefined` restores the attribute the element started with.\n */\nexport function reflectAttribute(el: Element, name: string, value: unknown): void {\n const initial = initialAttribute(el, name);\n writeAttribute(el, name, value === undefined ? initial : value === null ? null : String(value));\n}\n\n/**\n * A boolean attribute, present while `value` is truthy (`null` and `false` remove it);\n * `undefined` restores the attribute the element started with.\n */\nexport function reflectBooleanAttribute(el: Element, name: string, value: unknown): void {\n const initial = initialAttribute(el, name);\n writeAttribute(el, name, value === undefined ? initial : value ? \"\" : null);\n}\n","import { IWcBindable, ResizeOptions, ResizeBoxOption, WcsResizeEntry } from \"../types.js\";\nimport { ResizeCore } from \"../core/ResizeCore.js\";\nimport { upgradeProperties } from \"../protocol/upgradeProperties.js\";\nimport { reflectAttribute, reflectBooleanAttribute } from \"../protocol/inputAttribute.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 // Setters never let setAttribute stringify null / undefined (an \"undefined\"\n // target is a selector that matches nothing, so nothing would be observed):\n // `null` removes the attribute (the default), `undefined` restores the\n // attribute the element started with (wc-bindable producer guidance P1;\n // React 19 and a direct assignment deliver it, @wcstack/state does not).\n\n get target(): string {\n return this.getAttribute(\"target\") ?? \"\";\n }\n\n set target(value: string | null | undefined) {\n reflectAttribute(this, \"target\", value);\n }\n\n get box(): string {\n return this.getAttribute(\"box\") ?? \"\";\n }\n\n set box(value: string | null | undefined) {\n reflectAttribute(this, \"box\", value);\n }\n\n get round(): boolean {\n return this.hasAttribute(\"round\");\n }\n\n set round(value: boolean | null | undefined) {\n reflectBooleanAttribute(this, \"round\", value);\n }\n\n get once(): boolean {\n return this.hasAttribute(\"once\");\n }\n\n set once(value: boolean | null | undefined) {\n reflectBooleanAttribute(this, \"once\", value);\n }\n\n get manual(): boolean {\n return this.hasAttribute(\"manual\");\n }\n\n set manual(value: boolean | null | undefined) {\n reflectBooleanAttribute(this, \"manual\", value);\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\n/**\n * Register this package's tags. Pass a scoped `CustomElementRegistry` to define\n * them for a single shadow tree -- scoped registries do not inherit the global\n * one, so a tree using one needs its own definitions.\n */\nexport function registerComponents(registry: CustomElementRegistry = customElements): void {\n if (!registry.get(config.tagNames.resize)) {\n registry.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, registry?: CustomElementRegistry): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents(registry);\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,QAAQ;AAAE,QAAA,OAAO,GAAG;IACvD,MAAM,KAAK,GAA4B,EAAE;IACzC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAClC,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAAE,GAA+B,CAAC,GAAG,CAAC,CAAC;IAC/D;AACA,IAAA,OAAO,KAAU;AACnB;AAEA,IAAI,YAAY,GAAmB,IAAI;AAEhC,MAAM,MAAM,GAAY,OAAkB;SAEjC,SAAS,GAAA;IACvB,IAAI,CAAC,YAAY,E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QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IACpD;AACF;;ACRM,SAAU,eAAe,CAAC,UAA4B,EAAE,QAAgC,EAAA;IAC5F,IAAI,UAAU,EAAE;QACd,SAAS,CAAC,UAAU,CAAC;IACvB;IACA,kBAAkB,CAAC,QAAQ,CAAC;AAC9B;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wcstack/resize",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.9",
|
|
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",
|