@wcstack/resize 4.10.1 → 4.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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 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 WeakSet;function r(e,t,n){if(s.has(e))return;s.add(e);const r=e.localName??"element";console.warn(`[wcs/input-as-attribute] <${r}> has the attribute ${t}="${n}": an object was written as an attribute, so the element did not receive it. A framework does that when the property is set before the element's definition loads (React 19), or when told to (Vue's .attr). Load the definition before rendering, or assign the property through a ref (Vue: .prop). (Said once per element.)`,e)}const i=new WeakMap;function o(e,t){let n=i.get(e);return void 0===n&&(n=new Map,i.set(e,n)),n.has(t)||n.set(t,e.getAttribute(t)),n.get(t)}function c(e,t,n){null===n?e.removeAttribute(t):e.setAttribute(t,n)}function a(e,t,n){const s=o(e,t);c(e,t,void 0===n?s:null===n?null:String(n))}function h(e,t,n){const s=o(e,t);c(e,t,void 0===n?s:n?"":null)}const l=["content-box","border-box","device-pixel-content-box"];class b 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;_observePending=!1;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){a(this,"target",e)}get box(){return this.getAttribute("box")??""}set box(e){a(this,"box",e)}get round(){return this.hasAttribute("round")}set round(e){h(this,"round",e)}get once(){return this.hasAttribute("once")}set once(e){h(this,"once",e)}get manual(){return this.hasAttribute("manual")}set manual(e){h(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._observePending=!1,this._core.disconnect()}disconnect(){this._observePending=!1,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 l.includes(e)?e:"content-box"}_options(){return{box:this._parseBox(),round:this.round}}_onChange=e=>{e.target===this&&this.once&&this._core.disconnect()};_scheduleObserve(){this._observePending||(this._observePending=!0,queueMicrotask(()=>{this._observePending&&(this._observePending=!1,this.isConnected&&!this.manual&&this.observe())}))}connectedCallback(){!function(e){const t=e.constructor?.wcBindable,s=t?.inputs;if(void 0===s)return;const i=e.getAttribute;for(const t of s){const s=t.name,o="function"==typeof i?i.call(e,s.toLowerCase()):null;if(null!==o&&o.startsWith("[object ")&&r(e,s,o),!Object.prototype.hasOwnProperty.call(e,s))continue;if(!n(e,s))continue;const c=e,a=c[s];delete c[s],c[s]=a}}(this),this.addEventListener("wcs-resize:change",this._onChange),this._scheduleObserve(),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._scheduleObserve()}}var u;!function(t=customElements){t.get(e.tagNames.resize)||t.define(e.tagNames.resize,b)}(u);
1
+ const e={tagNames:{resize:"wcs-resize"}};var t="@wcstack/resize",n="4.11.2";class s 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 r(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 i=new WeakSet;function o(e,t,n){if(i.has(e))return;i.add(e);const s=e.localName??"element";console.warn(`[wcs/input-as-attribute] <${s}> has the attribute ${t}="${n}": an object was written as an attribute, so the element did not receive it. A framework does that when the property is set before the element's definition loads (React 19), or when told to (Vue's .attr). Load the definition before rendering, or assign the property through a ref (Vue: .prop). (Said once per element.)`,e)}const c=new WeakMap;function a(e,t){let n=c.get(e);return void 0===n&&(n=new Map,c.set(e,n)),n.has(t)||n.set(t,e.getAttribute(t)),n.get(t)}function h(e,t,n){null===n?e.removeAttribute(t):e.setAttribute(t,n)}function l(e,t,n){const s=a(e,t);h(e,t,void 0===n?s:null===n?null:String(n))}function u(e,t,n){const s=a(e,t);h(e,t,void 0===n?s:n?"":null)}const b=["content-box","border-box","device-pixel-content-box"];class d extends HTMLElement{static hasConnectedCallbackPromise=!0;static observedAttributes=["target","box","round"];static wcBindable={...s.wcBindable,properties:[...s.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:s.wcBindable.commands};_core;_trigger=!1;_connectedCallbackPromise=Promise.resolve();_internals=null;_observePending=!1;constructor(){super(),this._core=new s(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){l(this,"target",e)}get box(){return this.getAttribute("box")??""}set box(e){l(this,"box",e)}get round(){return this.hasAttribute("round")}set round(e){u(this,"round",e)}get once(){return this.hasAttribute("once")}set once(e){u(this,"once",e)}get manual(){return this.hasAttribute("manual")}set manual(e){u(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._observePending=!1,this._core.disconnect()}disconnect(){this._observePending=!1,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 b.includes(e)?e:"content-box"}_options(){return{box:this._parseBox(),round:this.round}}_onChange=e=>{e.target===this&&this.once&&this._core.disconnect()};_scheduleObserve(){this._observePending||(this._observePending=!0,queueMicrotask(()=>{this._observePending&&(this._observePending=!1,this.isConnected&&!this.manual&&this.observe())}))}connectedCallback(){!function(e){const t=e.constructor?.wcBindable,n=t?.inputs;if(void 0===n)return;const s=e.getAttribute;for(const t of n){const n=t.name,i="function"==typeof s?s.call(e,n.toLowerCase()):null;if(null!==i&&i.startsWith("[object ")&&o(e,n,i),!Object.prototype.hasOwnProperty.call(e,n))continue;if(!r(e,n))continue;const c=e,a=c[n];delete c[n],c[n]=a}}(this),this.addEventListener("wcs-resize:change",this._onChange),this._scheduleObserve(),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._scheduleObserve()}}const g=Symbol.for("wcstack.package"),_=new WeakSet;function v(e,t){Object.defineProperty(e,g,{value:t,configurable:!0})}function f(e,t,n,s,r){if(void 0!==s&&(n===s||n.prototype instanceof s))return;const i=n[g];if(i===r||_.has(e))return;_.add(e);const o=r.slice(0,r.lastIndexOf("@"));console.warn(`[${o}] [wcs/package-twice] <${t}> is already defined by ${i??`another copy of ${o} that does not name its version`}; this copy, ${r}, does nothing. Load each package once.`)}function m(s=customElements){!function(e,t,n){for(const[s,r]of n){const n=e.get(s);void 0===n?(v(r,t),e.define(s,r)):f(e,s,n,r,t)}}(s,`${t}@${n}`,[[e.tagNames.resize,d]])}var p;m(p);
2
2
  //# sourceMappingURL=auto.min.js.map
@@ -1 +1 @@
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// 属性になってしまったオブジェクトの入力(`files=\"[object File]\"`)を、要素ごとに 1 回だけ言う。\n// React 19 は定義前の要素にプロパティが無いのでオブジェクトを属性に書き、Vue の `.attr` も\n// 書く。要素はその入力をプロパティでしか読まないので、何も受け取らず、何も言わなかった\n// (docs/seam-apps.md、fw-inventory)。\nconst toldObjectAttribute = new WeakSet<object>();\n\nfunction warnObjectAttribute(element: object, name: string, value: string): void {\n if (toldObjectAttribute.has(element)) return;\n toldObjectAttribute.add(element);\n const tag = (element as { localName?: string }).localName ?? \"element\";\n console.warn(\n `[wcs/input-as-attribute] <${tag}> has the attribute ${name}=\"${value}\": an object was written as an ` +\n `attribute, so the element did not receive it. A framework does that when the property is set before the ` +\n `element's definition loads (React 19), or when told to (Vue's .attr). Load the definition before rendering, ` +\n `or assign the property through a ref (Vue: .prop). (Said once per element.)`,\n element,\n );\n}\n\n/**\n * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で\n * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。\n *\n * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。\n * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。\n * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。\n * - 値が `[object …]` の属性(属性に書かれてしまったオブジェクトの入力)は、要素ごとに 1 回警告する。\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 const getAttribute = (element as { getAttribute?: (name: string) => string | null }).getAttribute;\n for (const input of inputs) {\n const name = input.name;\n const attribute = typeof getAttribute === \"function\" ? getAttribute.call(element, name.toLowerCase()) : null;\n if (attribute !== null && attribute.startsWith(\"[object \")) warnObjectAttribute(element, name, attribute);\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 // _scheduleObserve のマイクロタスクが待っている間 true\n private _observePending = false;\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 / disconnect は、予約中の自動 observe(_scheduleObserve)も取り消す。\n // 同じタスクで接続(や属性の変化)の後に呼ばれたとき、以前の同期の observe を止めたのと\n // 同じく何も監視しない(timing-and-firing-contract §23)。observe / trigger は取り消さない\n // — 予約の observe は同じ target・options なら no-op(冪等)。\n unobserve(): void {\n this._observePending = false;\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._observePending = false;\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 // 自動 observe の判断はマイクロタスクで、そのときの manual / target / box / round で\n // 1 回だけ行う(timing-and-firing-contract §23)。router は遷移で同じノードを入れ直し、\n // 新しいルートの params から state が入力を書くのはマイクロタスク — その場で observe\n // すると、前の target で observer を張り、前の manual をラッチしていた\n // (docs/seam-apps.md、shift-desk)。接続と属性の変化はここへまとまり、observer は\n // 1 回だけ作り直す。判断の前に外れた要素は何もしない。\n private _scheduleObserve(): void {\n if (this._observePending) return;\n this._observePending = true;\n queueMicrotask(() => {\n // unobserve / disconnect が予約を取り消していれば何もしない(同じタスクで予約し直して\n // いれば、このマイクロタスクがその判断を受け持ち、後の分は何もしない)\n if (!this._observePending) return;\n this._observePending = false;\n if (this.isConnected && !this.manual) {\n this.observe();\n }\n });\n }\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 this._scheduleObserve();\n // SSR: back connectedCallbackPromise with the Core's readiness probe. The\n // observation itself is started in the microtask above via the element-observe\n // command (it runs before any await on this promise resumes); this captures the\n // (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 re-observe goes through the\n // same microtask as the connect-time one (_scheduleObserve), so the autoloader\n // upgrade case (attributeChangedCallback + connectedCallback) and several inputs\n // written in one task rebuild the observer once.\n if (!this.isConnected || this.manual) return;\n this._scheduleObserve();\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","toldObjectAttribute","WeakSet","warnObjectAttribute","value","has","add","tag","localName","console","warn","initialAttributes","WeakMap","initialAttribute","el","byName","Map","getAttribute","writeAttribute","removeAttribute","setAttribute","reflectAttribute","initial","String","reflectBooleanAttribute","BOX_VALUES","WcsResize","HTMLElement","wcBindable","inputs","attribute","_core","_trigger","_connectedCallbackPromise","_internals","_observePending","_initInternals","_wireStates","d","connectedCallbackPromise","debugStates","states","attachInternals","internals","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","_scheduleObserve","queueMicrotask","isConnected","connectedCallback","declaration","input","call","toLowerCase","startsWith","prototype","hasOwnProperty","record","upgradeProperties","disconnectedCallback","removeEventListener","attributeChangedCallback","_name","oldValue","newValue","registry","custom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F,iBAAkB,EACnB/F,KAAKoI,cAAgBpI,KAAKiH,QAC5BjH,KAAKE,aAGX,CAEA,iBAAAmI,IFlSI,SAA4BlI,GAChC,MAAMmI,EAAenI,EAA2DN,aAAa2F,WACvFC,EAAS6C,GAAa7C,OAC5B,QAAe/B,IAAX+B,EAAsB,OAC1B,MAAMZ,EAAgB1E,EAA+D0E,aACrF,IAAK,MAAM0D,KAAS9C,EAAQ,CAC1B,MAAM/G,EAAO6J,EAAM7J,KACbgH,EAAoC,mBAAjBb,EAA8BA,EAAa2D,KAAKrI,EAASzB,EAAK+J,eAAiB,KAExG,GADkB,OAAd/C,GAAsBA,EAAUgD,WAAW,aAAa3E,EAAoB5D,EAASzB,EAAMgH,IAC1FpC,OAAOqF,UAAUC,eAAeJ,KAAKrI,EAASzB,GAAO,SAC1D,IAAK0E,EAAuBjD,EAASzB,GAAO,SAC5C,MAAMmK,EAAS1I,EACT6D,EAAQ6E,EAAOnK,UACdmK,EAAOnK,GACdmK,EAAOnK,GAAQsF,CACjB,CACF,CEoRI8E,CAAkB9I,MAClBA,KAAK2G,iBAAiB,oBAAqB3G,KAAKiI,WAChDjI,KAAKkI,mBAKLlI,KAAK6F,0BAA4B7F,KAAK2F,MAAMzF,SAC9C,CAEA,oBAAA6I,GACE/I,KAAKgJ,oBAAoB,oBAAqBhJ,KAAKiI,WACnDjI,KAAK2F,MAAMrF,SACb,CAEA,wBAAA2I,CAAyBC,EAAeC,EAAyBC,GAM3DD,IAAaC,GAKZpJ,KAAKoI,cAAepI,KAAKiH,QAC9BjH,KAAKkI,kBACP,EC9XI,IAAwDmB,GCIxD,SAA6BA,EAAkCC,gBAC9DD,EAAS1F,IAAI1F,EAAOC,SAASC,SAChCkL,EAASE,OAAOtL,EAAOC,SAASC,OAAQmH,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/protocol/defineElement.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// 属性になってしまったオブジェクトの入力(`files=\"[object File]\"`)を、要素ごとに 1 回だけ言う。\n// React 19 は定義前の要素にプロパティが無いのでオブジェクトを属性に書き、Vue の `.attr` も\n// 書く。要素はその入力をプロパティでしか読まないので、何も受け取らず、何も言わなかった\n// (docs/seam-apps.md、fw-inventory)。\nconst toldObjectAttribute = new WeakSet<object>();\n\nfunction warnObjectAttribute(element: object, name: string, value: string): void {\n if (toldObjectAttribute.has(element)) return;\n toldObjectAttribute.add(element);\n const tag = (element as { localName?: string }).localName ?? \"element\";\n console.warn(\n `[wcs/input-as-attribute] <${tag}> has the attribute ${name}=\"${value}\": an object was written as an ` +\n `attribute, so the element did not receive it. A framework does that when the property is set before the ` +\n `element's definition loads (React 19), or when told to (Vue's .attr). Load the definition before rendering, ` +\n `or assign the property through a ref (Vue: .prop). (Said once per element.)`,\n element,\n );\n}\n\n/**\n * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で\n * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。\n *\n * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。\n * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。\n * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。\n * - 値が `[object …]` の属性(属性に書かれてしまったオブジェクトの入力)は、要素ごとに 1 回警告する。\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 const getAttribute = (element as { getAttribute?: (name: string) => string | null }).getAttribute;\n for (const input of inputs) {\n const name = input.name;\n const attribute = typeof getAttribute === \"function\" ? getAttribute.call(element, name.toLowerCase()) : null;\n if (attribute !== null && attribute.startsWith(\"[object \")) warnObjectAttribute(element, name, attribute);\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 // _scheduleObserve のマイクロタスクが待っている間 true\n private _observePending = false;\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 / disconnect は、予約中の自動 observe(_scheduleObserve)も取り消す。\n // 同じタスクで接続(や属性の変化)の後に呼ばれたとき、以前の同期の observe を止めたのと\n // 同じく何も監視しない(timing-and-firing-contract §23)。observe / trigger は取り消さない\n // — 予約の observe は同じ target・options なら no-op(冪等)。\n unobserve(): void {\n this._observePending = false;\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._observePending = false;\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 // 自動 observe の判断はマイクロタスクで、そのときの manual / target / box / round で\n // 1 回だけ行う(timing-and-firing-contract §23)。router は遷移で同じノードを入れ直し、\n // 新しいルートの params から state が入力を書くのはマイクロタスク — その場で observe\n // すると、前の target で observer を張り、前の manual をラッチしていた\n // (docs/seam-apps.md、shift-desk)。接続と属性の変化はここへまとまり、observer は\n // 1 回だけ作り直す。判断の前に外れた要素は何もしない。\n private _scheduleObserve(): void {\n if (this._observePending) return;\n this._observePending = true;\n queueMicrotask(() => {\n // unobserve / disconnect が予約を取り消していれば何もしない(同じタスクで予約し直して\n // いれば、このマイクロタスクがその判断を受け持ち、後の分は何もしない)\n if (!this._observePending) return;\n this._observePending = false;\n if (this.isConnected && !this.manual) {\n this.observe();\n }\n });\n }\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 this._scheduleObserve();\n // SSR: back connectedCallbackPromise with the Core's readiness probe. The\n // observation itself is started in the microtask above via the element-observe\n // command (it runs before any await on this promise resumes); this captures the\n // (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 re-observe goes through the\n // same microtask as the connect-time one (_scheduleObserve), so the autoloader\n // upgrade case (attributeChangedCallback + connectedCallback) and several inputs\n // written in one task rebuild the observer once.\n if (!this.isConnected || this.manual) return;\n this._scheduleObserve();\n }\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/define-element.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * One copy of each package on a page (docs/timing-and-firing-contract.md §24). The first copy the\n * page evaluates defines the tags and a second one does nothing, so a copy that finds its tag defined\n * by another copy of the package — not its class, not a subclass of it, not the same version — warns\n * `[wcs/package-twice]` once per registry, naming both versions. The classes it defines carry\n * `\"<package>@<version>\"` under `Symbol.for(\"wcstack.package\")`; a class without it is named\n * \"another copy of <package> that does not name its version\" (an older copy, or one loaded through\n * an entry that does not stamp).\n */\n\n/** The static a class defined through this helper carries: `\"@wcstack/fetch@<version>\"`. */\nexport const PACKAGE_STAMP: unique symbol = Symbol.for(\"wcstack.package\");\n\ntype Stamped = { [PACKAGE_STAMP]?: string };\n\n/** The registries this copy warned about: one warning per package per registry. */\nconst warned = new WeakSet<CustomElementRegistry>();\n\n/**\n * Marks `cls` as defined by `pkg` (`\"@wcstack/fetch@<version>\"`). A subclass inherits the mark, and\n * `defineProperty` writes it even where a parent's mark is read-only.\n */\nexport function stampPackage(cls: CustomElementConstructor, pkg: string): void {\n Object.defineProperty(cls, PACKAGE_STAMP, { value: pkg, configurable: true });\n}\n\n/**\n * Warns when `tag` is defined as `existing` by another copy of the package `pkg` names: `existing`\n * is neither `own` nor a subclass of it (omit `own` when the copy has no class to compare with), and\n * carries another version or none. Once per registry.\n */\nexport function warnIfAnotherCopy(\n registry: CustomElementRegistry,\n tag: string,\n existing: CustomElementConstructor,\n own: CustomElementConstructor | undefined,\n pkg: string,\n): void {\n if (own !== undefined && (existing === own || existing.prototype instanceof own)) return;\n const theirs = (existing as Stamped)[PACKAGE_STAMP];\n if (theirs === pkg || warned.has(registry)) return;\n warned.add(registry);\n const name = pkg.slice(0, pkg.lastIndexOf(\"@\"));\n console.warn(\n `[${name}] [wcs/package-twice] <${tag}> is already defined by ` +\n `${theirs ?? `another copy of ${name} that does not name its version`}; ` +\n `this copy, ${pkg}, does nothing. Load each package once.`,\n );\n}\n\n/**\n * Defines each `[tag, class]` in `registry` unless the tag is already defined, stamping the class\n * with `pkg` (`\"@wcstack/fetch@<version>\"`). A tag another copy of the package defined first is left\n * as it is, with the warning above.\n */\nexport function defineElements(\n registry: CustomElementRegistry,\n pkg: string,\n definitions: readonly (readonly [tag: string, cls: CustomElementConstructor])[],\n): void {\n for (const [tag, cls] of definitions) {\n const existing = registry.get(tag);\n if (existing === undefined) {\n stampPackage(cls, pkg);\n registry.define(tag, cls);\n } else {\n warnIfAnotherCopy(registry, tag, existing, cls, pkg);\n }\n }\n}\n","import pkg from \"../package.json\" with { type: \"json\" };\nimport { WcsResize } from \"./components/Resize.js\";\nimport { config } from \"./config.js\";\nimport { defineElements } from \"./protocol/defineElement.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 defineElements(registry, `${pkg.name}@${pkg.version}`, [\n [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":["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","toldObjectAttribute","WeakSet","warnObjectAttribute","value","has","add","tag","localName","console","warn","initialAttributes","WeakMap","initialAttribute","el","byName","Map","getAttribute","writeAttribute","removeAttribute","setAttribute","reflectAttribute","initial","String","reflectBooleanAttribute","BOX_VALUES","WcsResize","HTMLElement","wcBindable","inputs","attribute","_core","_trigger","_connectedCallbackPromise","_internals","_observePending","_initInternals","_wireStates","d","connectedCallbackPromise","debugStates","states","attachInternals","internals","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","_scheduleObserve","queueMicrotask","isConnected","connectedCallback","declaration","input","call","toLowerCase","startsWith","prototype","hasOwnProperty","record","upgradeProperties","disconnectedCallback","removeEventListener","attributeChangedCallback","_name","oldValue","newValue","PACKAGE_STAMP","Symbol","for","warned","stampPackage","cls","pkg","defineProperty","configurable","warnIfAnotherCopy","registry","existing","own","theirs","slice","lastIndexOf","registerComponents","customElements","definitions","define","defineElements"],"mappings":"AAQA,MA0BaA,EA1BoB,CAC/BC,SAAU,CACRC,OAAQ,kDCaN,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,CAAEA,KAAM,aACR,CAAEA,KAAM,gB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EAAkBC,EAAU5F,EAAK6F,EAAUN,EAAKC,EAEpD,CACF,CChEEc,CAAeV,EAAU,GAAGJ,KAAYA,IAAe,CACrD,CAAC1L,EAAOC,SAASC,OAAQmH,IAE7B,CCVM,IAAwDyE,EAI5DM,EAAmBN"}
package/dist/index.esm.js CHANGED
@@ -58,6 +58,8 @@ function setConfig(partialConfig) {
58
58
  frozenConfig = null;
59
59
  }
60
60
 
61
+ var pkg = {"name":"@wcstack/resize","version":"4.11.2"};
62
+
61
63
  /**
62
64
  * Headless element-size primitive. A thin, framework-agnostic wrapper around the
63
65
  * ResizeObserver API exposed through the wc-bindable protocol.
@@ -822,15 +824,75 @@ class WcsResize extends HTMLElement {
822
824
  }
823
825
  }
824
826
 
827
+ // ===========================================================================
828
+ // AUTO-GENERATED FILE - DO NOT EDIT.
829
+ // Generated from /protocol/define-element.ts by scripts/sync-protocol-types.mjs.
830
+ // Run `node scripts/sync-protocol-types.mjs` after editing the source.
831
+ // ===========================================================================
832
+ /**
833
+ * One copy of each package on a page (docs/timing-and-firing-contract.md §24). The first copy the
834
+ * page evaluates defines the tags and a second one does nothing, so a copy that finds its tag defined
835
+ * by another copy of the package — not its class, not a subclass of it, not the same version — warns
836
+ * `[wcs/package-twice]` once per registry, naming both versions. The classes it defines carry
837
+ * `"<package>@<version>"` under `Symbol.for("wcstack.package")`; a class without it is named
838
+ * "another copy of <package> that does not name its version" (an older copy, or one loaded through
839
+ * an entry that does not stamp).
840
+ */
841
+ /** The static a class defined through this helper carries: `"@wcstack/fetch@<version>"`. */
842
+ const PACKAGE_STAMP = Symbol.for("wcstack.package");
843
+ /** The registries this copy warned about: one warning per package per registry. */
844
+ const warned = new WeakSet();
845
+ /**
846
+ * Marks `cls` as defined by `pkg` (`"@wcstack/fetch@<version>"`). A subclass inherits the mark, and
847
+ * `defineProperty` writes it even where a parent's mark is read-only.
848
+ */
849
+ function stampPackage(cls, pkg) {
850
+ Object.defineProperty(cls, PACKAGE_STAMP, { value: pkg, configurable: true });
851
+ }
852
+ /**
853
+ * Warns when `tag` is defined as `existing` by another copy of the package `pkg` names: `existing`
854
+ * is neither `own` nor a subclass of it (omit `own` when the copy has no class to compare with), and
855
+ * carries another version or none. Once per registry.
856
+ */
857
+ function warnIfAnotherCopy(registry, tag, existing, own, pkg) {
858
+ if (own !== undefined && (existing === own || existing.prototype instanceof own))
859
+ return;
860
+ const theirs = existing[PACKAGE_STAMP];
861
+ if (theirs === pkg || warned.has(registry))
862
+ return;
863
+ warned.add(registry);
864
+ const name = pkg.slice(0, pkg.lastIndexOf("@"));
865
+ console.warn(`[${name}] [wcs/package-twice] <${tag}> is already defined by ` +
866
+ `${theirs ?? `another copy of ${name} that does not name its version`}; ` +
867
+ `this copy, ${pkg}, does nothing. Load each package once.`);
868
+ }
869
+ /**
870
+ * Defines each `[tag, class]` in `registry` unless the tag is already defined, stamping the class
871
+ * with `pkg` (`"@wcstack/fetch@<version>"`). A tag another copy of the package defined first is left
872
+ * as it is, with the warning above.
873
+ */
874
+ function defineElements(registry, pkg, definitions) {
875
+ for (const [tag, cls] of definitions) {
876
+ const existing = registry.get(tag);
877
+ if (existing === undefined) {
878
+ stampPackage(cls, pkg);
879
+ registry.define(tag, cls);
880
+ }
881
+ else {
882
+ warnIfAnotherCopy(registry, tag, existing, cls, pkg);
883
+ }
884
+ }
885
+ }
886
+
825
887
  /**
826
888
  * Register this package's tags. Pass a scoped `CustomElementRegistry` to define
827
889
  * them for a single shadow tree -- scoped registries do not inherit the global
828
890
  * one, so a tree using one needs its own definitions.
829
891
  */
830
892
  function registerComponents(registry = customElements) {
831
- if (!registry.get(config.tagNames.resize)) {
832
- registry.define(config.tagNames.resize, WcsResize);
833
- }
893
+ defineElements(registry, `${pkg.name}@${pkg.version}`, [
894
+ [config.tagNames.resize, WcsResize],
895
+ ]);
834
896
  }
835
897
 
836
898
  function bootstrapResize(userConfig, registry) {
@@ -1 +1 @@
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// 属性になってしまったオブジェクトの入力(`files=\"[object File]\"`)を、要素ごとに 1 回だけ言う。\n// React 19 は定義前の要素にプロパティが無いのでオブジェクトを属性に書き、Vue の `.attr` も\n// 書く。要素はその入力をプロパティでしか読まないので、何も受け取らず、何も言わなかった\n// (docs/seam-apps.md、fw-inventory)。\nconst toldObjectAttribute = new WeakSet<object>();\n\nfunction warnObjectAttribute(element: object, name: string, value: string): void {\n if (toldObjectAttribute.has(element)) return;\n toldObjectAttribute.add(element);\n const tag = (element as { localName?: string }).localName ?? \"element\";\n console.warn(\n `[wcs/input-as-attribute] <${tag}> has the attribute ${name}=\"${value}\": an object was written as an ` +\n `attribute, so the element did not receive it. A framework does that when the property is set before the ` +\n `element's definition loads (React 19), or when told to (Vue's .attr). Load the definition before rendering, ` +\n `or assign the property through a ref (Vue: .prop). (Said once per element.)`,\n element,\n );\n}\n\n/**\n * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で\n * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。\n *\n * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。\n * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。\n * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。\n * - 値が `[object …]` の属性(属性に書かれてしまったオブジェクトの入力)は、要素ごとに 1 回警告する。\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 const getAttribute = (element as { getAttribute?: (name: string) => string | null }).getAttribute;\n for (const input of inputs) {\n const name = input.name;\n const attribute = typeof getAttribute === \"function\" ? getAttribute.call(element, name.toLowerCase()) : null;\n if (attribute !== null && attribute.startsWith(\"[object \")) warnObjectAttribute(element, name, attribute);\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 // _scheduleObserve のマイクロタスクが待っている間 true\n private _observePending = false;\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 / disconnect は、予約中の自動 observe(_scheduleObserve)も取り消す。\n // 同じタスクで接続(や属性の変化)の後に呼ばれたとき、以前の同期の observe を止めたのと\n // 同じく何も監視しない(timing-and-firing-contract §23)。observe / trigger は取り消さない\n // — 予約の observe は同じ target・options なら no-op(冪等)。\n unobserve(): void {\n this._observePending = false;\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._observePending = false;\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 // 自動 observe の判断はマイクロタスクで、そのときの manual / target / box / round で\n // 1 回だけ行う(timing-and-firing-contract §23)。router は遷移で同じノードを入れ直し、\n // 新しいルートの params から state が入力を書くのはマイクロタスク — その場で observe\n // すると、前の target で observer を張り、前の manual をラッチしていた\n // (docs/seam-apps.md、shift-desk)。接続と属性の変化はここへまとまり、observer は\n // 1 回だけ作り直す。判断の前に外れた要素は何もしない。\n private _scheduleObserve(): void {\n if (this._observePending) return;\n this._observePending = true;\n queueMicrotask(() => {\n // unobserve / disconnect が予約を取り消していれば何もしない(同じタスクで予約し直して\n // いれば、このマイクロタスクがその判断を受け持ち、後の分は何もしない)\n if (!this._observePending) return;\n this._observePending = false;\n if (this.isConnected && !this.manual) {\n this.observe();\n }\n });\n }\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 this._scheduleObserve();\n // SSR: back connectedCallbackPromise with the Core's readiness probe. The\n // observation itself is started in the microtask above via the element-observe\n // command (it runs before any await on this promise resumes); this captures the\n // (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 re-observe goes through the\n // same microtask as the connect-time one (_scheduleObserve), so the autoloader\n // upgrade case (attributeChangedCallback + connectedCallback) and several inputs\n // written in one task rebuild the observer once.\n if (!this.isConnected || this.manual) return;\n this._scheduleObserve();\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,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QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACzC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,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;;;;"}
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/protocol/defineElement.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// 属性になってしまったオブジェクトの入力(`files=\"[object File]\"`)を、要素ごとに 1 回だけ言う。\n// React 19 は定義前の要素にプロパティが無いのでオブジェクトを属性に書き、Vue の `.attr` も\n// 書く。要素はその入力をプロパティでしか読まないので、何も受け取らず、何も言わなかった\n// (docs/seam-apps.md、fw-inventory)。\nconst toldObjectAttribute = new WeakSet<object>();\n\nfunction warnObjectAttribute(element: object, name: string, value: string): void {\n if (toldObjectAttribute.has(element)) return;\n toldObjectAttribute.add(element);\n const tag = (element as { localName?: string }).localName ?? \"element\";\n console.warn(\n `[wcs/input-as-attribute] <${tag}> has the attribute ${name}=\"${value}\": an object was written as an ` +\n `attribute, so the element did not receive it. A framework does that when the property is set before the ` +\n `element's definition loads (React 19), or when told to (Vue's .attr). Load the definition before rendering, ` +\n `or assign the property through a ref (Vue: .prop). (Said once per element.)`,\n element,\n );\n}\n\n/**\n * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で\n * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。\n *\n * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。\n * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。\n * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。\n * - 値が `[object …]` の属性(属性に書かれてしまったオブジェクトの入力)は、要素ごとに 1 回警告する。\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 const getAttribute = (element as { getAttribute?: (name: string) => string | null }).getAttribute;\n for (const input of inputs) {\n const name = input.name;\n const attribute = typeof getAttribute === \"function\" ? getAttribute.call(element, name.toLowerCase()) : null;\n if (attribute !== null && attribute.startsWith(\"[object \")) warnObjectAttribute(element, name, attribute);\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 // _scheduleObserve のマイクロタスクが待っている間 true\n private _observePending = false;\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 / disconnect は、予約中の自動 observe(_scheduleObserve)も取り消す。\n // 同じタスクで接続(や属性の変化)の後に呼ばれたとき、以前の同期の observe を止めたのと\n // 同じく何も監視しない(timing-and-firing-contract §23)。observe / trigger は取り消さない\n // — 予約の observe は同じ target・options なら no-op(冪等)。\n unobserve(): void {\n this._observePending = false;\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._observePending = false;\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 // 自動 observe の判断はマイクロタスクで、そのときの manual / target / box / round で\n // 1 回だけ行う(timing-and-firing-contract §23)。router は遷移で同じノードを入れ直し、\n // 新しいルートの params から state が入力を書くのはマイクロタスク — その場で observe\n // すると、前の target で observer を張り、前の manual をラッチしていた\n // (docs/seam-apps.md、shift-desk)。接続と属性の変化はここへまとまり、observer は\n // 1 回だけ作り直す。判断の前に外れた要素は何もしない。\n private _scheduleObserve(): void {\n if (this._observePending) return;\n this._observePending = true;\n queueMicrotask(() => {\n // unobserve / disconnect が予約を取り消していれば何もしない(同じタスクで予約し直して\n // いれば、このマイクロタスクがその判断を受け持ち、後の分は何もしない)\n if (!this._observePending) return;\n this._observePending = false;\n if (this.isConnected && !this.manual) {\n this.observe();\n }\n });\n }\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 this._scheduleObserve();\n // SSR: back connectedCallbackPromise with the Core's readiness probe. The\n // observation itself is started in the microtask above via the element-observe\n // command (it runs before any await on this promise resumes); this captures the\n // (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 re-observe goes through the\n // same microtask as the connect-time one (_scheduleObserve), so the autoloader\n // upgrade case (attributeChangedCallback + connectedCallback) and several inputs\n // written in one task rebuild the observer once.\n if (!this.isConnected || this.manual) return;\n this._scheduleObserve();\n }\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/define-element.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * One copy of each package on a page (docs/timing-and-firing-contract.md §24). The first copy the\n * page evaluates defines the tags and a second one does nothing, so a copy that finds its tag defined\n * by another copy of the package — not its class, not a subclass of it, not the same version — warns\n * `[wcs/package-twice]` once per registry, naming both versions. The classes it defines carry\n * `\"<package>@<version>\"` under `Symbol.for(\"wcstack.package\")`; a class without it is named\n * \"another copy of <package> that does not name its version\" (an older copy, or one loaded through\n * an entry that does not stamp).\n */\n\n/** The static a class defined through this helper carries: `\"@wcstack/fetch@<version>\"`. */\nexport const PACKAGE_STAMP: unique symbol = Symbol.for(\"wcstack.package\");\n\ntype Stamped = { [PACKAGE_STAMP]?: string };\n\n/** The registries this copy warned about: one warning per package per registry. */\nconst warned = new WeakSet<CustomElementRegistry>();\n\n/**\n * Marks `cls` as defined by `pkg` (`\"@wcstack/fetch@<version>\"`). A subclass inherits the mark, and\n * `defineProperty` writes it even where a parent's mark is read-only.\n */\nexport function stampPackage(cls: CustomElementConstructor, pkg: string): void {\n Object.defineProperty(cls, PACKAGE_STAMP, { value: pkg, configurable: true });\n}\n\n/**\n * Warns when `tag` is defined as `existing` by another copy of the package `pkg` names: `existing`\n * is neither `own` nor a subclass of it (omit `own` when the copy has no class to compare with), and\n * carries another version or none. Once per registry.\n */\nexport function warnIfAnotherCopy(\n registry: CustomElementRegistry,\n tag: string,\n existing: CustomElementConstructor,\n own: CustomElementConstructor | undefined,\n pkg: string,\n): void {\n if (own !== undefined && (existing === own || existing.prototype instanceof own)) return;\n const theirs = (existing as Stamped)[PACKAGE_STAMP];\n if (theirs === pkg || warned.has(registry)) return;\n warned.add(registry);\n const name = pkg.slice(0, pkg.lastIndexOf(\"@\"));\n console.warn(\n `[${name}] [wcs/package-twice] <${tag}> is already defined by ` +\n `${theirs ?? `another copy of ${name} that does not name its version`}; ` +\n `this copy, ${pkg}, does nothing. Load each package once.`,\n );\n}\n\n/**\n * Defines each `[tag, class]` in `registry` unless the tag is already defined, stamping the class\n * with `pkg` (`\"@wcstack/fetch@<version>\"`). A tag another copy of the package defined first is left\n * as it is, with the warning above.\n */\nexport function defineElements(\n registry: CustomElementRegistry,\n pkg: string,\n definitions: readonly (readonly [tag: string, cls: CustomElementConstructor])[],\n): void {\n for (const [tag, cls] of definitions) {\n const existing = registry.get(tag);\n if (existing === undefined) {\n stampPackage(cls, pkg);\n registry.define(tag, cls);\n } else {\n warnIfAnotherCopy(registry, tag, existing, cls, pkg);\n }\n }\n}\n","import pkg from \"../package.json\" with { type: \"json\" };\nimport { WcsResize } from \"./components/Resize.js\";\nimport { config } from \"./config.js\";\nimport { defineElements } from \"./protocol/defineElement.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 defineElements(registry, `${pkg.name}@${pkg.version}`, [\n [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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AQ,EAAE,CAAA,EAAG,GAAG,CAAC,IAAI,CAAA,CAAA,EAAI,GAAG,CAAC,OAAO,CAAA,CAAE,EAAE;AACrD,QAAA,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;AACpC,KAAA,CAAC;AACJ;;ACVM,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.10.1",
3
+ "version": "4.11.2",
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",