@wcstack/idle 4.0.0-rc.8 → 4.0.0-rc.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +2 -0
- package/README.md +2 -0
- package/dist/auto.min.js +1 -1
- package/dist/auto.min.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +52 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -87,6 +87,8 @@ npm install @wcstack/idle
|
|
|
87
87
|
| ----------- | ------ | ------- | ---- |
|
|
88
88
|
| `threshold` | number | `60000` | `userState`が`"idle"`になるまでの最小アイドル時間(ms)。バリデーションなし——範囲外の値はブラウザ自身のrejectに委ねます。 |
|
|
89
89
|
|
|
90
|
+
**`null` と `undefined`。** 属性に対応する入力(`threshold`)は、`null` を「クリア」として扱います。属性を外し、入力は既定値(`60000`)に戻ります。`undefined` は「値が無い」で、属性を最初の書き込みの前の状態 — マークアップに書かれた値、無ければ属性なし — に戻します。どちらも文字列 `"null"` / `"undefined"` として書くことはありません(`@wcstack/state` は `undefined` を書きませんが、React 19 は値のあった prop を外したときに書き、直接の代入でも届きます)。
|
|
91
|
+
|
|
90
92
|
## `:state()` による CSS スタイリング
|
|
91
93
|
|
|
92
94
|
`<wcs-idle>` は 2 つの boolean 出力ステートを
|
package/README.md
CHANGED
|
@@ -89,6 +89,8 @@ npm install @wcstack/idle
|
|
|
89
89
|
| ----------- | ------ | ------- | ------------ |
|
|
90
90
|
| `threshold` | number | `60000` | Minimum idle time (ms) before `userState` becomes `"idle"`. Not validated — an out-of-range value is left to the browser's own rejection. |
|
|
91
91
|
|
|
92
|
+
**`null` and `undefined`.** The input backed by an attribute (`threshold`) takes `null` as "clear": the attribute is removed and the input falls back to its default (`60000`). `undefined` means "no value supplied": the attribute goes back to what it was before the first write — the value written in the markup, or none. Neither is ever written as the string `"null"` / `"undefined"`. (`@wcstack/state` never writes `undefined`; React 19 does when a prop that had a value is removed, and so can a direct assignment.)
|
|
93
|
+
|
|
92
94
|
## CSS styling with `:state()`
|
|
93
95
|
|
|
94
96
|
`<wcs-idle>` reflects two boolean output states onto its
|
package/dist/auto.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e={tagNames:{idle:"wcs-idle"}},t="capability-missing",r="not-allowed",s="idle-error";class n extends EventTarget{static wcBindable={protocol:"wc-bindable",version:1,properties:[{name:"userState",event:"wcs-idle:change",semantics:"state",getter:e=>e.detail.userState},{name:"screenState",event:"wcs-idle:change",semantics:"state",getter:e=>e.detail.screenState},{name:"active",event:"wcs-idle:change",semantics:"state",getter:e=>"active"===e.detail.userState},{name:"error",event:"wcs-idle:error",semantics:"state"},{name:"errorInfo",event:"wcs-idle:error-info-changed",semantics:"state"}],commands:[{name:"requestPermission",async:!0},{name:"start",async:!0},{name:"stop"}]};_target;_userState=null;_screenState=null;_error=null;_errorInfo=null;_detector=null;_abortController=null;_gen=0;_ready=Promise.resolve();constructor(e){super(),this._target=e??this}get ready(){return this._ready}get userState(){return this._userState}get screenState(){return this._screenState}get active(){return"active"===this._userState}get error(){return this._error}get errorInfo(){return this._errorInfo}observe(){return this._ready}dispose(){this.stop()}_api(){const e=globalThis;return"function"==typeof e.IdleDetector?e.IdleDetector:void 0}_setState(e,t){this._userState===e&&this._screenState===t||(this._userState=e,this._screenState=t,this._target.dispatchEvent(new CustomEvent("wcs-idle:change",{detail:{userState:e,screenState:t},bubbles:!0})))}_setError(e,n){this._error!==e&&(this._error=e,this._commitErrorInfo(null===e?null:function(e,n){return"unsupported"===e?{code:t,phase:"probe",recoverable:!1,message:n}:"NotAllowedError"===e?{code:r,phase:"start",recoverable:!1,message:n}:{code:s,phase:"execute",recoverable:!1,message:n}}(n,this._errorInfoMessage(e))),this._target.dispatchEvent(new CustomEvent("wcs-idle:error",{detail:e,bubbles:!0})))}_errorInfoMessage(e){const t=null!=e&&"object"==typeof e&&"error"in e?e.error:e;return"string"==typeof t?.message?t.message:String(t)}_commitErrorInfo(e){this._errorInfo=e,this._target.dispatchEvent(new CustomEvent("wcs-idle:error-info-changed",{detail:e,bubbles:!0}))}async requestPermission(){const e=this._api();if(!e)return this._setError({message:"IdleDetector is not supported in this browser"},"unsupported"),"denied";try{const t=await e.requestPermission();return this._setError(null),"granted"===t?"granted":"denied"}catch(e){return this._setError({error:e},e?.name),"denied"}}async start(e=6e4){this.stop();const t=this._api();if(!t)return void this._setError({message:"IdleDetector is not supported in this browser"},"unsupported");const r=new AbortController;this._abortController=r;const s=++this._gen;try{const n=new t;if(n.addEventListener("change",this._onChange),this._detector=n,await n.start({threshold:e,signal:r.signal}),s!==this._gen)return;this._setError(null),this._setState(n.userState,n.screenState)}catch(e){if(s!==this._gen)return;this._detector?.removeEventListener("change",this._onChange),this._detector=null,this._abortController=null,this._setError({error:e},e?.name)}}stop(){this._gen++,this._abortController?.abort(),this._abortController=null,this._detector&&(this._detector.removeEventListener("change",this._onChange),this._detector=null)}_onChange=e=>{const t=e.target;this._setState(t.userState,t.screenState)}}function o(e,t){let r=Object.getPrototypeOf(e);for(;null!==r;){const e=Object.getOwnPropertyDescriptor(r,t);if(void 0!==e)return"function"==typeof e.get||"function"==typeof e.set;r=Object.getPrototypeOf(r)}return!1}
|
|
1
|
+
const e={tagNames:{idle:"wcs-idle"}},t="capability-missing",r="not-allowed",s="idle-error";class n extends EventTarget{static wcBindable={protocol:"wc-bindable",version:1,properties:[{name:"userState",event:"wcs-idle:change",semantics:"state",getter:e=>e.detail.userState},{name:"screenState",event:"wcs-idle:change",semantics:"state",getter:e=>e.detail.screenState},{name:"active",event:"wcs-idle:change",semantics:"state",getter:e=>"active"===e.detail.userState},{name:"error",event:"wcs-idle:error",semantics:"state"},{name:"errorInfo",event:"wcs-idle:error-info-changed",semantics:"state"}],commands:[{name:"requestPermission",async:!0},{name:"start",async:!0},{name:"stop"}]};_target;_userState=null;_screenState=null;_error=null;_errorInfo=null;_detector=null;_abortController=null;_gen=0;_ready=Promise.resolve();constructor(e){super(),this._target=e??this}get ready(){return this._ready}get userState(){return this._userState}get screenState(){return this._screenState}get active(){return"active"===this._userState}get error(){return this._error}get errorInfo(){return this._errorInfo}observe(){return this._ready}dispose(){this.stop()}_api(){const e=globalThis;return"function"==typeof e.IdleDetector?e.IdleDetector:void 0}_setState(e,t){this._userState===e&&this._screenState===t||(this._userState=e,this._screenState=t,this._target.dispatchEvent(new CustomEvent("wcs-idle:change",{detail:{userState:e,screenState:t},bubbles:!0})))}_setError(e,n){this._error!==e&&(this._error=e,this._commitErrorInfo(null===e?null:function(e,n){return"unsupported"===e?{code:t,phase:"probe",recoverable:!1,message:n}:"NotAllowedError"===e?{code:r,phase:"start",recoverable:!1,message:n}:{code:s,phase:"execute",recoverable:!1,message:n}}(n,this._errorInfoMessage(e))),this._target.dispatchEvent(new CustomEvent("wcs-idle:error",{detail:e,bubbles:!0})))}_errorInfoMessage(e){const t=null!=e&&"object"==typeof e&&"error"in e?e.error:e;return"string"==typeof t?.message?t.message:String(t)}_commitErrorInfo(e){this._errorInfo=e,this._target.dispatchEvent(new CustomEvent("wcs-idle:error-info-changed",{detail:e,bubbles:!0}))}async requestPermission(){const e=this._api();if(!e)return this._setError({message:"IdleDetector is not supported in this browser"},"unsupported"),"denied";try{const t=await e.requestPermission();return this._setError(null),"granted"===t?"granted":"denied"}catch(e){return this._setError({error:e},e?.name),"denied"}}async start(e=6e4){this.stop();const t=this._api();if(!t)return void this._setError({message:"IdleDetector is not supported in this browser"},"unsupported");const r=new AbortController;this._abortController=r;const s=++this._gen;try{const n=new t;if(n.addEventListener("change",this._onChange),this._detector=n,await n.start({threshold:e,signal:r.signal}),s!==this._gen)return;this._setError(null),this._setState(n.userState,n.screenState)}catch(e){if(s!==this._gen)return;this._detector?.removeEventListener("change",this._onChange),this._detector=null,this._abortController=null,this._setError({error:e},e?.name)}}stop(){this._gen++,this._abortController?.abort(),this._abortController=null,this._detector&&(this._detector.removeEventListener("change",this._onChange),this._detector=null)}_onChange=e=>{const t=e.target;this._setState(t.userState,t.screenState)}}function o(e,t){let r=Object.getPrototypeOf(e);for(;null!==r;){const e=Object.getOwnPropertyDescriptor(r,t);if(void 0!==e)return"function"==typeof e.get||"function"==typeof e.set;r=Object.getPrototypeOf(r)}return!1}const i=new WeakMap;function a(e,t,r){const s=function(e,t){let r=i.get(e);return void 0===r&&(r=new Map,i.set(e,r)),r.has(t)||r.set(t,e.getAttribute(t)),r.get(t)}(e,t);!function(e,t,r){null===r?e.removeAttribute(t):e.setAttribute(t,r)}(e,t,void 0===r?s:null===r?null:String(r))}class c extends HTMLElement{static hasConnectedCallbackPromise=!0;static wcBindable={...n.wcBindable,inputs:[{name:"threshold",attribute:"threshold"}],commands:n.wcBindable.commands};_core;_connectedCallbackPromise=Promise.resolve();_internals=null;constructor(){super(),this._core=new n(this),this._internals=this._initInternals(),this._wireStates({"wcs-idle:change":e=>({active:"active"===e.userState}),"wcs-idle:error":e=>({error:null!=e})})}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[r,s]of Object.entries(e))this.addEventListener(r,e=>{const r=this.hasAttribute("debug-states");for(const[n,o]of Object.entries(s(e.detail))){try{o?t.add(n):t.delete(n)}catch{}r&&this.toggleAttribute(`data-wcs-state-${n}`,o)}})}get threshold(){const e=this.getAttribute("threshold");if(null===e||""===e.trim())return 6e4;const t=Number(e);return Number.isFinite(t)?t:6e4}set threshold(e){a(this,"threshold",e)}get userState(){return this._core.userState}get screenState(){return this._core.screenState}get active(){return this._core.active}get error(){return this._core.error}get errorInfo(){return this._core.errorInfo}get connectedCallbackPromise(){return this._connectedCallbackPromise}requestPermission(){return this._core.requestPermission()}start(e){return this._core.start(e??this.threshold)}stop(){this._core.stop()}connectedCallback(){!function(e){const t=e.constructor?.wcBindable,r=t?.inputs;if(void 0!==r)for(const t of r){const r=t.name;if(!Object.prototype.hasOwnProperty.call(e,r))continue;if(!o(e,r))continue;const s=e,n=s[r];delete s[r],s[r]=n}}(this),this.style.display="none",this._connectedCallbackPromise=this._core.observe()}disconnectedCallback(){this._core.dispose()}}var l;!function(t=customElements){t.get(e.tagNames.idle)||t.define(e.tagNames.idle,c)}(l);
|
|
2
2
|
//# sourceMappingURL=auto.min.js.map
|
package/dist/auto.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto.min.js","sources":["../src/config.ts","../src/core/idleCapabilities.ts","../src/core/IdleCore.ts","../src/protocol/upgradeProperties.ts","../src/components/Idle.ts","../src/bootstrapIdle.ts","../src/registerComponents.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n idle: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n idle: \"wcs-idle\",\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: `bootstrapIdle` refuses it. */\nfunction invalid(key: string): never {\n throw new Error(`[@wcstack/idle] bootstrapIdle: \"${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","/**\n * idleCapabilities.ts\n *\n * Idle Detection node 固有の error code(taxonomy)と derivation。汎用の error info 型は\n * `./platformCapability.js`(/io-core/ から copy-distribution される生成ファイル)から\n * import する。idle は requestPermission()/start()/stop() の単一コマンド経路で、競合する\n * operation を持たない(2 回目の start() は前を stop() してから開始する supersede)ため\n * lane は持たず、error taxonomy(errorInfo)のみを採用する。\n *\n * この node の `_setError` は 2 形態の入力を受ける:\n * 1. synthetic な非対応マーカー(`{ message: \"IdleDetector is not supported…\" }`、\n * `.name` 無し)— `globalThis.IdleDetector` 不在。\n * 2. caught された rejection を包んだ `{ error: e }`(`e.name` が実 Error.name)。\n * 両者を message coupling 無しに弁別するため、呼び出し側が明示的な `name` ヒントを渡す\n * (storage の `deriveStorageErrorInfo(error, name)` / screen-orientation と同じ\n * discriminator 技法)。非対応経路は `\"unsupported\"` を、caught 経路は wrap した\n * `e?.name` を渡す。\n *\n * requestPermission()/start() の実 rejection 名は spec のとおり gesture 文脈外 /\n * 権限未許可で `NotAllowedError`。それ以外(生の Error / TypeError(threshold 不正)/\n * `.name` 欠如の nullish reject 等)は一括して `idle-error`。\n */\n\nimport type { WcsIoErrorInfo } from \"./platformCapability.js\";\n\n/** 安定した idle error code(taxonomy)。値は公開キーとして固定。 */\nexport const WCS_IDLE_ERROR_CODE = {\n /** Idle Detection API 非対応(`globalThis.IdleDetector` 不在)。 */\n CapabilityMissing: \"capability-missing\",\n /** `NotAllowedError` — 権限拒否 / user-gesture 文脈外。retry では回復しない。 */\n NotAllowed: \"not-allowed\",\n /** その他の requestPermission()/start() 失敗(生 throw / TypeError / nullish reject 等)。 */\n IdleError: \"idle-error\",\n} as const;\n\n/**\n * idle の失敗を serializable な error taxonomy に写す。\n *\n * `name` は呼び出し側が渡す discriminator:synthetic 非対応なら `\"unsupported\"`、\n * caught 例外なら wrap した `e?.name`(生の非 Error / nullish reject では `undefined`)。\n * `message` は wrap を解いた下位値から抽出済みの文言(非対応なら synthetic の message)。\n *\n * - `\"unsupported\"` は利用直前の能力欠如 → phase=\"probe\" / capability-missing。\n * - `NotAllowedError` は requestPermission()/start() の権限ゲート失敗 → phase=\"start\" /\n * not-allowed / recoverable=false(gesture 違反と実 \"denied\" は区別しない設計 §4.1)。\n * - それ以外(生の throw、TypeError、`.name` 欠如等)は実行中の失敗 → phase=\"execute\" /\n * idle-error / recoverable=false。\n */\nexport function deriveIdleErrorInfo(name: string | undefined, message: string): WcsIoErrorInfo {\n if (name === \"unsupported\") {\n return { code: WCS_IDLE_ERROR_CODE.CapabilityMissing, phase: \"probe\", recoverable: false, message };\n }\n if (name === \"NotAllowedError\") {\n return { code: WCS_IDLE_ERROR_CODE.NotAllowed, phase: \"start\", recoverable: false, message };\n }\n return { code: WCS_IDLE_ERROR_CODE.IdleError, phase: \"execute\", recoverable: false, message };\n}\n","import { IdleScreenState, IdleUserState, IWcBindable } from \"../types.js\";\nimport { WcsIoErrorInfo } from \"./platformCapability.js\";\nimport { deriveIdleErrorInfo } from \"./idleCapabilities.js\";\n\ninterface IdleDetectorLike extends EventTarget {\n userState: IdleUserState;\n screenState: IdleScreenState;\n start(options: { threshold: number; signal: AbortSignal }): Promise<void>;\n}\n\ninterface IdleDetectorCtor {\n new (): IdleDetectorLike;\n requestPermission(): Promise<\"granted\" | \"denied\">;\n}\n\nconst MIN_THRESHOLD = 60000;\n\n/**\n * Headless Idle Detection primitive. A thin, framework-agnostic wrapper around\n * `IdleDetector` exposed through the wc-bindable protocol.\n *\n * Reference implementation for batch2's \"gesture-gated permission\" archetype\n * (docs/idle-detection-tag-design.md). `requestPermission()` wraps the static,\n * user-gesture-gated `IdleDetector.requestPermission()` — this Core never\n * calls it automatically; the caller must invoke it from within a real\n * gesture handler.\n *\n * Deliberately does NOT track the 4-value permission state (prompt/granted/\n * denied/unsupported) itself: `navigator.permissions.query({name:\n * \"idle-detection\"})` exists, so compose with `<wcs-permission\n * name=\"idle-detection\">` for that instead (§0). This Core only exposes the\n * actual idle state (userState/screenState) plus the one-time\n * requestPermission()/start()/stop() actions.\n */\nexport class IdleCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"userState\", event: \"wcs-idle:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.userState },\n { name: \"screenState\", event: \"wcs-idle:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.screenState },\n {\n name: \"active\",\n event: \"wcs-idle:change\",\n semantics: \"state\",\n getter: (e: Event) => (e as CustomEvent).detail.userState === \"active\",\n },\n // never-throw (§3.6): requestPermission()/start() failures land here\n // instead of rejecting/throwing. Mirrors every other bidirectional IO\n // node in this batch (fetch, share, screen-orientation).\n { name: \"error\", event: \"wcs-idle:error\", semantics: \"state\" },\n // Serializable failure taxonomy (stable code / phase / recoverable), or null.\n // Additive bindable output derived from `error` (capability-missing / not-allowed\n // / idle-error); the existing `error` property/event are unchanged. Fires\n // wcs-idle:error-info-changed. No lane — requestPermission()/start()/stop() form a\n // single command path (a 2nd start() supersedes the 1st), not competing operations.\n { name: \"errorInfo\", event: \"wcs-idle:error-info-changed\", semantics: \"state\" },\n ],\n // No `inputs`: the Core has no settable `threshold` state — `threshold` is a\n // per-call argument to `start(threshold)`, not a property/setter. The DOM-driven\n // `threshold` input surface belongs to the Shell (which declares it and backs it\n // with the `threshold` attribute), mirroring geolocation/intersection where the\n // Core declares no inputs and the Shell adds them.\n commands: [\n { name: \"requestPermission\", async: true },\n { name: \"start\", async: true },\n { name: \"stop\" },\n ],\n };\n\n private _target: EventTarget;\n private _userState: IdleUserState | null = null;\n private _screenState: IdleScreenState | null = null;\n private _error: any = null;\n // Additive failure taxonomy, kept strictly in sync with `_error` (derived on\n // every _setError, cleared to null when error clears). The two transition together.\n private _errorInfo: WcsIoErrorInfo | null = null;\n private _detector: IdleDetectorLike | null = null;\n private _abortController: AbortController | null = null;\n\n // Generation guard (§3.4): bumped on dispose()/stop() and each start().\n private _gen = 0;\n\n // SSR (§3.8): never auto-starts on connect, so there is no probe to await —\n // readiness is always immediate (docs/idle-detection-tag-design.md §7).\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n }\n\n get ready(): Promise<void> {\n return this._ready;\n }\n\n get userState(): IdleUserState | null {\n return this._userState;\n }\n\n get screenState(): IdleScreenState | null {\n return this._screenState;\n }\n\n get active(): boolean {\n return this._userState === \"active\";\n }\n\n get error(): any {\n return this._error;\n }\n\n /**\n * The last failure's serializable `WcsIoErrorInfo` (stable `code` / `phase` /\n * `recoverable`), or null. Additive wc-bindable property (event\n * `wcs-idle:error-info-changed`), derived from `error`; the existing `error`\n * property/event are unchanged.\n */\n get errorInfo(): WcsIoErrorInfo | null {\n return this._errorInfo;\n }\n\n // Lifecycle (§3.5). observe() is a synchronous no-op: unlike most IO nodes,\n // this Core deliberately does NOT auto-start on connect (§6) — permission\n // is gesture-gated, so attempting start() before it is granted is\n // guaranteed to fail.\n observe(): Promise<void> {\n return this._ready;\n }\n\n dispose(): void {\n this.stop();\n }\n\n private _api(): IdleDetectorCtor | undefined {\n const g = globalThis as any;\n return typeof g.IdleDetector === \"function\" ? g.IdleDetector : undefined;\n }\n\n private _setState(userState: IdleUserState, screenState: IdleScreenState): void {\n if (this._userState === userState && this._screenState === screenState) return;\n this._userState = userState;\n this._screenState = screenState;\n this._target.dispatchEvent(new CustomEvent(\"wcs-idle:change\", {\n detail: { userState, screenState },\n bubbles: true,\n }));\n }\n\n // `name` is the discriminator for the additive `errorInfo` taxonomy only (it\n // stays out of the public `error` shape): the synthetic unsupported marker has\n // no `.name`, so the unsupported call sites pass an explicit `\"unsupported\"`\n // hint (storage/screen-orientation-style — avoids coupling to `error.message`),\n // while the caught paths pass the wrapped rejection's `Error.name` (`e?.name`).\n // `null` clears (no name).\n private _setError(error: any, name?: string): void {\n if (this._error === error) return;\n this._error = error;\n // Keep the additive `errorInfo` taxonomy in sync with `error`: derive from the\n // discriminator + extracted message (or null on clear). Fires before the `error`\n // event so an observer binding both sees the classification first, mirroring the\n // io-node family.\n this._commitErrorInfo(error === null ? null : deriveIdleErrorInfo(name, this._errorInfoMessage(error)));\n this._target.dispatchEvent(new CustomEvent(\"wcs-idle:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n // Extract a serializable string message for `errorInfo` WITHOUT normalizing the\n // public `error` shape. The public error is either the synthetic `{ message }`\n // (unsupported) or a wrapped `{ error: e }` (a caught rejection). For the wrapped\n // form the meaningful message lives on `e`, so unwrap one level before reading\n // `.message`; a non-conformant / nullish value (e.g. `Promise.reject(undefined)`)\n // falls back to `String(...)` so it still classifies instead of throwing\n // (never-throw §3.6).\n private _errorInfoMessage(error: any): string {\n const src = error != null && typeof error === \"object\" && \"error\" in error ? error.error : error;\n return typeof src?.message === \"string\" ? src.message : String(src);\n }\n\n // Called only from _setError (which already same-value-guards on the error\n // reference), so errorInfo transitions exactly when error does — no separate\n // guard needed here.\n private _commitErrorInfo(info: WcsIoErrorInfo | null): void {\n this._errorInfo = info;\n this._target.dispatchEvent(new CustomEvent(\"wcs-idle:error-info-changed\", {\n detail: info,\n bubbles: true,\n }));\n }\n\n /**\n * Wraps the static, user-gesture-gated `IdleDetector.requestPermission()`.\n * MUST be invoked from within a real user gesture handler by the caller —\n * this Core cannot manufacture one. never-throw: a gesture-context\n * rejection resolves to `\"denied\"` and lands in `error`. Gesture violation\n * and an actual \"denied\" outcome are not distinguished — both mean \"not\n * usable right now\" (§4.1).\n */\n async requestPermission(): Promise<\"granted\" | \"denied\"> {\n const Ctor = this._api();\n if (!Ctor) {\n this._setError({ message: \"IdleDetector is not supported in this browser\" }, \"unsupported\");\n return \"denied\";\n }\n try {\n const result = await Ctor.requestPermission();\n // Symmetric with start()'s success path: any settled (non-throwing)\n // outcome — granted or a plain \"denied\" — supersedes a stale error from\n // an earlier attempt (e.g. a prior gesture-context rejection).\n this._setError(null);\n return result === \"granted\" ? \"granted\" : \"denied\";\n } catch (e: any) {\n this._setError({ error: e }, e?.name);\n return \"denied\";\n }\n }\n\n /**\n * Start an idle-detection session. `threshold` (ms) must be >= 60000 per\n * spec — not validated here (§3): an out-of-range value is left to the\n * browser's own TypeError, which never-throw absorbs into `error`.\n */\n async start(threshold: number = MIN_THRESHOLD): Promise<void> {\n this.stop(); // supersede any in-flight session (mirrors FetchCore's \"cancel then start\")\n\n const Ctor = this._api();\n if (!Ctor) {\n this._setError({ message: \"IdleDetector is not supported in this browser\" }, \"unsupported\");\n return;\n }\n\n const ac = new AbortController();\n this._abortController = ac;\n const gen = ++this._gen;\n\n try {\n const detector = new Ctor();\n detector.addEventListener(\"change\", this._onChange);\n this._detector = detector;\n await detector.start({ threshold, signal: ac.signal });\n if (gen !== this._gen) return; // stale (stop()/dispose() ran during the await)\n this._setError(null);\n this._setState(detector.userState, detector.screenState);\n } catch (e: any) {\n // No separate AbortError check: stop()/dispose() bump `_gen` *before*\n // calling `ac.abort()` (see stop() below), so a stop()-triggered\n // AbortError always has a stale `gen` here and is already caught by\n // the check above. The signal is private and never exposed, so an\n // AbortError from any other source cannot occur.\n if (gen !== this._gen) return;\n // Tear down the failed session's listener/controller (mirrors stop()):\n // without this, the failed `_detector` stays wired to `_onChange` and a\n // later `change` on that same (never-truly-started) instance would\n // still write state, contradicting the error just recorded.\n this._detector?.removeEventListener(\"change\", this._onChange);\n this._detector = null;\n this._abortController = null;\n this._setError({ error: e }, e?.name);\n }\n }\n\n /** Stop the current session (if any) and detach its listener. Safe to call when not started. */\n stop(): void {\n this._gen++;\n this._abortController?.abort();\n this._abortController = null;\n if (this._detector) {\n this._detector.removeEventListener(\"change\", this._onChange);\n this._detector = null;\n }\n }\n\n private _onChange = (event: Event): void => {\n const detector = event.target as IdleDetectorLike;\n this._setState(detector.userState, detector.screenState);\n };\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/upgrade-properties.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n// custom element の property upgrade — `static wcBindable.inputs` に宣言した入力のうち、\n// 要素が upgrade される前に代入された own データプロパティを取り込み直す。\n//\n// なぜ必要か:\n// 未定義タグの要素は素の HTMLElement なので、`el.url = \"...\"` は own データプロパティを作る。\n// upgrade 後にクラスの accessor が prototype へ入っても own プロパティが優先されるため、\n// setter は二度と呼ばれず、値は要素へ届かないまま消える(エラーも警告も出ない)。\n// 常にプロパティ代入を行う framework(Angular の `[prop]`、Lit の `.prop=`、\n// Solid の `prop:`、Vue の `.prop` 修飾子)× 遅延定義(autoloader / CDN / code-split)で\n// 常態的に起きる。docs/architecture-hardening/13-framework-adapter-binding-constraints.md §1.2。\n//\n// 安全側の判定:\n// own プロパティがあっても、prototype チェーンに accessor が無ければ「シャドウ」ではなく\n// その own プロパティ自体が正規の格納先なので触らない(public class field を壊さない)。\n//\n// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/upgrade-properties.ts), then run\n// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies\n// (packages/<pkg>/src/protocol/upgradeProperties.ts). Those copies are generated — do not edit them.\nimport { IWcBindable } from \"./wcBindable.js\";\n\nfunction hasAccessorOnPrototype(target: object, name: string): boolean {\n let proto = Object.getPrototypeOf(target);\n while (proto !== null) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, name);\n if (descriptor !== undefined) {\n return typeof descriptor.get === \"function\" || typeof descriptor.set === \"function\";\n }\n proto = Object.getPrototypeOf(proto);\n }\n return false;\n}\n\n/**\n * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で\n * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。\n *\n * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。\n * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。\n * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。\n */\nexport function upgradeProperties(element: object): void {\n const declaration = (element as { constructor?: { wcBindable?: IWcBindable } }).constructor?.wcBindable;\n const inputs = declaration?.inputs;\n if (inputs === undefined) return;\n for (const input of inputs) {\n const name = input.name;\n if (!Object.prototype.hasOwnProperty.call(element, name)) continue;\n if (!hasAccessorOnPrototype(element, name)) continue;\n const record = element as Record<string, unknown>;\n const value = record[name];\n delete record[name];\n record[name] = value;\n }\n}\n","import { IdleScreenState, IdleUserState, IWcBindable } from \"../types.js\";\nimport { IdleCore } from \"../core/IdleCore.js\";\nimport { WcsIoErrorInfo } from \"../core/platformCapability.js\";\nimport { upgradeProperties } from \"../protocol/upgradeProperties.js\";\n\n/**\n * `<wcs-idle>` — declarative Idle Detection API primitive.\n *\n * Does NOT auto-start on connect (docs/idle-detection-tag-design.md §6): the\n * permission gate sits in front of `start()`, so an unconditional\n * connectedCallback start would be guaranteed to fail before permission is\n * granted. Callers drive `requestPermission()` → `start()` explicitly, e.g.\n * from a click handler.\n *\n * Compose with `<wcs-permission name=\"idle-detection\">` for prompt/granted/\n * denied status — this Shell only exposes the actual idle state.\n */\nexport class WcsIdle extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n\n static wcBindable: IWcBindable = {\n ...IdleCore.wcBindable,\n inputs: [\n { name: \"threshold\", attribute: \"threshold\" },\n ],\n // Core の commands をそのまま継承(単一情報源)。\n commands: IdleCore.wcBindable.commands,\n };\n\n private _core: IdleCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new IdleCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-idle:change\": (d) => ({ active: d.userState === \"active\" }),\n \"wcs-idle:error\": (d) => ({ error: d != null }),\n });\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 (docs/custom-state-reflection-design.md §3.1/§3.4): attachInternals\n // is absent 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 /**\n * Minimum idle time (ms) before `userState` becomes `\"idle\"`. This value is\n * read only at `start()` time — there is no `attributeChangedCallback`\n * (deliberately not declared in `observedAttributes`, mirroring\n * `<wcs-gyroscope>`'s `frequency`), so mutating the attribute/property on an\n * already-running session has no effect until the caller `stop()`s and\n * `start()`s again.\n */\n get threshold(): number {\n const attr = this.getAttribute(\"threshold\");\n // An absent, empty, or whitespace-only attribute all mean \"no value\n // supplied\" and must fall back to the default — without this check,\n // `Number(\"\")`/`Number(\" \")` coerce to `0` (finite), which would slip\n // past the `Number.isFinite` fallback below and silently return `0`\n // instead of the documented 60000ms default.\n if (attr === null || attr.trim() === \"\") return 60000;\n const n = Number(attr);\n return Number.isFinite(n) ? n : 60000;\n }\n\n set threshold(value: number) {\n this.setAttribute(\"threshold\", String(value));\n }\n\n // --- Core delegated getters ---\n\n get userState(): IdleUserState | null {\n return this._core.userState;\n }\n\n get screenState(): IdleScreenState | null {\n return this._core.screenState;\n }\n\n get active(): boolean {\n return this._core.active;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get errorInfo(): WcsIoErrorInfo | null {\n return this._core.errorInfo;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Commands (delegated to Core) ---\n\n requestPermission(): Promise<\"granted\" | \"denied\"> {\n return this._core.requestPermission();\n }\n\n start(threshold?: number): Promise<void> {\n return this._core.start(threshold ?? this.threshold);\n }\n\n stop(): void {\n this._core.stop();\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n // upgrade 前に代入された input を取り込み直す(doc 13 §1.2 / Phase A1)\n upgradeProperties(this);\n this.style.display = \"none\";\n // No auto-start (§6) — observe() is a synchronous no-op, kept only for\n // API uniformity with other IO nodes' lifecycle.\n this._connectedCallbackPromise = this._core.observe();\n }\n\n disconnectedCallback(): void {\n this._core.dispose();\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapIdle(userConfig?: IWritableConfig, registry?: CustomElementRegistry): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents(registry);\n}\n","import { WcsIdle } from \"./components/Idle.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.idle)) {\n registry.define(config.tagNames.idle, WcsIdle);\n }\n}\n"],"names":["config","tagNames","idle","WCS_IDLE_ERROR_CODE","IdleCore","EventTarget","static","protocol","version","properties","name","event","semantics","getter","e","detail","userState","screenState","commands","async","_target","_userState","_screenState","_error","_errorInfo","_detector","_abortController","_gen","_ready","Promise","resolve","constructor","target","super","this","ready","active","error","errorInfo","observe","dispose","stop","_api","g","globalThis","IdleDetector","undefined","_setState","dispatchEvent","CustomEvent","bubbles","_setError","_commitErrorInfo","message","code","phase","recoverable","deriveIdleErrorInfo","_errorInfoMessage","src","String","info","requestPermission","Ctor","result","start","threshold","ac","AbortController","gen","detector","addEventListener","_onChange","signal","removeEventListener","abort","hasAccessorOnPrototype","proto","Object","getPrototypeOf","descriptor","getOwnPropertyDescriptor","get","set","WcsIdle","HTMLElement","wcBindable","inputs","attribute","_core","_connectedCallbackPromise","_internals","_initInternals","_wireStates","d","debugStates","states","attachInternals","internals","add","delete","map","toStates","entries","debug","hasAttribute","on","toggleAttribute","attr","getAttribute","trim","n","Number","isFinite","value","setAttribute","connectedCallbackPromise","connectedCallback","element","declaration","input","prototype","hasOwnProperty","call","record","upgradeProperties","style","display","disconnectedCallback","registry","customElements","define","registerComponents"],"mappings":"AAQA,MA0BaA,EA1BoB,CAC/BC,SAAU,CACRC,KAAM,aCgBGC,EAEQ,qBAFRA,EAIC,cAJDA,EAMA,aCEP,MAAOC,UAAiBC,YAC5BC,kBAAiC,CAC/BC,SAAU,cACVC,QAAS,EACTC,WAAY,CACV,CAAEC,KAAM,YAAaC,MAAO,kBAAmBC,UAAW,QAASC,OAASC,GAAcA,EAAkBC,OAAOC,WACnH,CAAEN,KAAM,cAAeC,MAAO,kBAAmBC,UAAW,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B,KAAKuD,MAAMxE,WACpB,CAEA,UAAImB,GACF,OAAOF,KAAKuD,MAAMrD,MACpB,CAEA,SAAIC,GACF,OAAOH,KAAKuD,MAAMpD,KACpB,CAEA,aAAIC,GACF,OAAOJ,KAAKuD,MAAMnD,SACpB,CAEA,4BAAI8E,GACF,OAAOlF,KAAKwD,yBACd,CAIA,iBAAA5B,GACE,OAAO5B,KAAKuD,MAAM3B,mBACpB,CAEA,KAAAG,CAAMC,GACJ,OAAOhC,KAAKuD,MAAMxB,MAAMC,GAAahC,KAAKgC,UAC5C,CAEA,IAAAzB,GACEP,KAAKuD,MAAMhD,MACb,CAIA,iBAAA4E,ID1GI,SAA4BC,GAChC,MAAMC,EAAeD,EAA2DvF,aAAauD,WACvFC,EAASgC,GAAahC,OAC5B,QAAezC,IAAXyC,EACJ,IAAK,MAAMiC,KAASjC,EAAQ,CAC1B,MAAM7E,EAAO8G,EAAM9G,KACnB,IAAKoE,OAAO2C,UAAUC,eAAeC,KAAKL,EAAS5G,GAAO,SAC1D,IAAKkE,EAAuB0C,EAAS5G,GAAO,SAC5C,MAAMkH,EAASN,EACTJ,EAAQU,EAAOlH,UACdkH,EAAOlH,GACdkH,EAAOlH,GAAQwG,CACjB,CACF,CC+FIW,CAAkB3F,MAClBA,KAAK4F,MAAMC,QAAU,OAGrB7F,KAAKwD,0BAA4BxD,KAAKuD,MAAMlD,SAC9C,CAEA,oBAAAyF,GACE9F,KAAKuD,MAAMjD,SACb,EC/JI,IAAsDyF,GCItD,SAA6BA,EAAkCC,gBAC9DD,EAAS/C,IAAIlF,EAAOC,SAASC,OAChC+H,EAASE,OAAOnI,EAAOC,SAASC,KAAMkF,EAE1C,CDJEgD,CAAmBH"}
|
|
1
|
+
{"version":3,"file":"auto.min.js","sources":["../src/config.ts","../src/core/idleCapabilities.ts","../src/core/IdleCore.ts","../src/protocol/upgradeProperties.ts","../src/protocol/inputAttribute.ts","../src/components/Idle.ts","../src/bootstrapIdle.ts","../src/registerComponents.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n idle: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n idle: \"wcs-idle\",\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: `bootstrapIdle` refuses it. */\nfunction invalid(key: string): never {\n throw new Error(`[@wcstack/idle] bootstrapIdle: \"${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","/**\n * idleCapabilities.ts\n *\n * Idle Detection node 固有の error code(taxonomy)と derivation。汎用の error info 型は\n * `./platformCapability.js`(/io-core/ から copy-distribution される生成ファイル)から\n * import する。idle は requestPermission()/start()/stop() の単一コマンド経路で、競合する\n * operation を持たない(2 回目の start() は前を stop() してから開始する supersede)ため\n * lane は持たず、error taxonomy(errorInfo)のみを採用する。\n *\n * この node の `_setError` は 2 形態の入力を受ける:\n * 1. synthetic な非対応マーカー(`{ message: \"IdleDetector is not supported…\" }`、\n * `.name` 無し)— `globalThis.IdleDetector` 不在。\n * 2. caught された rejection を包んだ `{ error: e }`(`e.name` が実 Error.name)。\n * 両者を message coupling 無しに弁別するため、呼び出し側が明示的な `name` ヒントを渡す\n * (storage の `deriveStorageErrorInfo(error, name)` / screen-orientation と同じ\n * discriminator 技法)。非対応経路は `\"unsupported\"` を、caught 経路は wrap した\n * `e?.name` を渡す。\n *\n * requestPermission()/start() の実 rejection 名は spec のとおり gesture 文脈外 /\n * 権限未許可で `NotAllowedError`。それ以外(生の Error / TypeError(threshold 不正)/\n * `.name` 欠如の nullish reject 等)は一括して `idle-error`。\n */\n\nimport type { WcsIoErrorInfo } from \"./platformCapability.js\";\n\n/** 安定した idle error code(taxonomy)。値は公開キーとして固定。 */\nexport const WCS_IDLE_ERROR_CODE = {\n /** Idle Detection API 非対応(`globalThis.IdleDetector` 不在)。 */\n CapabilityMissing: \"capability-missing\",\n /** `NotAllowedError` — 権限拒否 / user-gesture 文脈外。retry では回復しない。 */\n NotAllowed: \"not-allowed\",\n /** その他の requestPermission()/start() 失敗(生 throw / TypeError / nullish reject 等)。 */\n IdleError: \"idle-error\",\n} as const;\n\n/**\n * idle の失敗を serializable な error taxonomy に写す。\n *\n * `name` は呼び出し側が渡す discriminator:synthetic 非対応なら `\"unsupported\"`、\n * caught 例外なら wrap した `e?.name`(生の非 Error / nullish reject では `undefined`)。\n * `message` は wrap を解いた下位値から抽出済みの文言(非対応なら synthetic の message)。\n *\n * - `\"unsupported\"` は利用直前の能力欠如 → phase=\"probe\" / capability-missing。\n * - `NotAllowedError` は requestPermission()/start() の権限ゲート失敗 → phase=\"start\" /\n * not-allowed / recoverable=false(gesture 違反と実 \"denied\" は区別しない設計 §4.1)。\n * - それ以外(生の throw、TypeError、`.name` 欠如等)は実行中の失敗 → phase=\"execute\" /\n * idle-error / recoverable=false。\n */\nexport function deriveIdleErrorInfo(name: string | undefined, message: string): WcsIoErrorInfo {\n if (name === \"unsupported\") {\n return { code: WCS_IDLE_ERROR_CODE.CapabilityMissing, phase: \"probe\", recoverable: false, message };\n }\n if (name === \"NotAllowedError\") {\n return { code: WCS_IDLE_ERROR_CODE.NotAllowed, phase: \"start\", recoverable: false, message };\n }\n return { code: WCS_IDLE_ERROR_CODE.IdleError, phase: \"execute\", recoverable: false, message };\n}\n","import { IdleScreenState, IdleUserState, IWcBindable } from \"../types.js\";\nimport { WcsIoErrorInfo } from \"./platformCapability.js\";\nimport { deriveIdleErrorInfo } from \"./idleCapabilities.js\";\n\ninterface IdleDetectorLike extends EventTarget {\n userState: IdleUserState;\n screenState: IdleScreenState;\n start(options: { threshold: number; signal: AbortSignal }): Promise<void>;\n}\n\ninterface IdleDetectorCtor {\n new (): IdleDetectorLike;\n requestPermission(): Promise<\"granted\" | \"denied\">;\n}\n\nconst MIN_THRESHOLD = 60000;\n\n/**\n * Headless Idle Detection primitive. A thin, framework-agnostic wrapper around\n * `IdleDetector` exposed through the wc-bindable protocol.\n *\n * Reference implementation for batch2's \"gesture-gated permission\" archetype\n * (docs/idle-detection-tag-design.md). `requestPermission()` wraps the static,\n * user-gesture-gated `IdleDetector.requestPermission()` — this Core never\n * calls it automatically; the caller must invoke it from within a real\n * gesture handler.\n *\n * Deliberately does NOT track the 4-value permission state (prompt/granted/\n * denied/unsupported) itself: `navigator.permissions.query({name:\n * \"idle-detection\"})` exists, so compose with `<wcs-permission\n * name=\"idle-detection\">` for that instead (§0). This Core only exposes the\n * actual idle state (userState/screenState) plus the one-time\n * requestPermission()/start()/stop() actions.\n */\nexport class IdleCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"userState\", event: \"wcs-idle:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.userState },\n { name: \"screenState\", event: \"wcs-idle:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.screenState },\n {\n name: \"active\",\n event: \"wcs-idle:change\",\n semantics: \"state\",\n getter: (e: Event) => (e as CustomEvent).detail.userState === \"active\",\n },\n // never-throw (§3.6): requestPermission()/start() failures land here\n // instead of rejecting/throwing. Mirrors every other bidirectional IO\n // node in this batch (fetch, share, screen-orientation).\n { name: \"error\", event: \"wcs-idle:error\", semantics: \"state\" },\n // Serializable failure taxonomy (stable code / phase / recoverable), or null.\n // Additive bindable output derived from `error` (capability-missing / not-allowed\n // / idle-error); the existing `error` property/event are unchanged. Fires\n // wcs-idle:error-info-changed. No lane — requestPermission()/start()/stop() form a\n // single command path (a 2nd start() supersedes the 1st), not competing operations.\n { name: \"errorInfo\", event: \"wcs-idle:error-info-changed\", semantics: \"state\" },\n ],\n // No `inputs`: the Core has no settable `threshold` state — `threshold` is a\n // per-call argument to `start(threshold)`, not a property/setter. The DOM-driven\n // `threshold` input surface belongs to the Shell (which declares it and backs it\n // with the `threshold` attribute), mirroring geolocation/intersection where the\n // Core declares no inputs and the Shell adds them.\n commands: [\n { name: \"requestPermission\", async: true },\n { name: \"start\", async: true },\n { name: \"stop\" },\n ],\n };\n\n private _target: EventTarget;\n private _userState: IdleUserState | null = null;\n private _screenState: IdleScreenState | null = null;\n private _error: any = null;\n // Additive failure taxonomy, kept strictly in sync with `_error` (derived on\n // every _setError, cleared to null when error clears). The two transition together.\n private _errorInfo: WcsIoErrorInfo | null = null;\n private _detector: IdleDetectorLike | null = null;\n private _abortController: AbortController | null = null;\n\n // Generation guard (§3.4): bumped on dispose()/stop() and each start().\n private _gen = 0;\n\n // SSR (§3.8): never auto-starts on connect, so there is no probe to await —\n // readiness is always immediate (docs/idle-detection-tag-design.md §7).\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n }\n\n get ready(): Promise<void> {\n return this._ready;\n }\n\n get userState(): IdleUserState | null {\n return this._userState;\n }\n\n get screenState(): IdleScreenState | null {\n return this._screenState;\n }\n\n get active(): boolean {\n return this._userState === \"active\";\n }\n\n get error(): any {\n return this._error;\n }\n\n /**\n * The last failure's serializable `WcsIoErrorInfo` (stable `code` / `phase` /\n * `recoverable`), or null. Additive wc-bindable property (event\n * `wcs-idle:error-info-changed`), derived from `error`; the existing `error`\n * property/event are unchanged.\n */\n get errorInfo(): WcsIoErrorInfo | null {\n return this._errorInfo;\n }\n\n // Lifecycle (§3.5). observe() is a synchronous no-op: unlike most IO nodes,\n // this Core deliberately does NOT auto-start on connect (§6) — permission\n // is gesture-gated, so attempting start() before it is granted is\n // guaranteed to fail.\n observe(): Promise<void> {\n return this._ready;\n }\n\n dispose(): void {\n this.stop();\n }\n\n private _api(): IdleDetectorCtor | undefined {\n const g = globalThis as any;\n return typeof g.IdleDetector === \"function\" ? g.IdleDetector : undefined;\n }\n\n private _setState(userState: IdleUserState, screenState: IdleScreenState): void {\n if (this._userState === userState && this._screenState === screenState) return;\n this._userState = userState;\n this._screenState = screenState;\n this._target.dispatchEvent(new CustomEvent(\"wcs-idle:change\", {\n detail: { userState, screenState },\n bubbles: true,\n }));\n }\n\n // `name` is the discriminator for the additive `errorInfo` taxonomy only (it\n // stays out of the public `error` shape): the synthetic unsupported marker has\n // no `.name`, so the unsupported call sites pass an explicit `\"unsupported\"`\n // hint (storage/screen-orientation-style — avoids coupling to `error.message`),\n // while the caught paths pass the wrapped rejection's `Error.name` (`e?.name`).\n // `null` clears (no name).\n private _setError(error: any, name?: string): void {\n if (this._error === error) return;\n this._error = error;\n // Keep the additive `errorInfo` taxonomy in sync with `error`: derive from the\n // discriminator + extracted message (or null on clear). Fires before the `error`\n // event so an observer binding both sees the classification first, mirroring the\n // io-node family.\n this._commitErrorInfo(error === null ? null : deriveIdleErrorInfo(name, this._errorInfoMessage(error)));\n this._target.dispatchEvent(new CustomEvent(\"wcs-idle:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n // Extract a serializable string message for `errorInfo` WITHOUT normalizing the\n // public `error` shape. The public error is either the synthetic `{ message }`\n // (unsupported) or a wrapped `{ error: e }` (a caught rejection). For the wrapped\n // form the meaningful message lives on `e`, so unwrap one level before reading\n // `.message`; a non-conformant / nullish value (e.g. `Promise.reject(undefined)`)\n // falls back to `String(...)` so it still classifies instead of throwing\n // (never-throw §3.6).\n private _errorInfoMessage(error: any): string {\n const src = error != null && typeof error === \"object\" && \"error\" in error ? error.error : error;\n return typeof src?.message === \"string\" ? src.message : String(src);\n }\n\n // Called only from _setError (which already same-value-guards on the error\n // reference), so errorInfo transitions exactly when error does — no separate\n // guard needed here.\n private _commitErrorInfo(info: WcsIoErrorInfo | null): void {\n this._errorInfo = info;\n this._target.dispatchEvent(new CustomEvent(\"wcs-idle:error-info-changed\", {\n detail: info,\n bubbles: true,\n }));\n }\n\n /**\n * Wraps the static, user-gesture-gated `IdleDetector.requestPermission()`.\n * MUST be invoked from within a real user gesture handler by the caller —\n * this Core cannot manufacture one. never-throw: a gesture-context\n * rejection resolves to `\"denied\"` and lands in `error`. Gesture violation\n * and an actual \"denied\" outcome are not distinguished — both mean \"not\n * usable right now\" (§4.1).\n */\n async requestPermission(): Promise<\"granted\" | \"denied\"> {\n const Ctor = this._api();\n if (!Ctor) {\n this._setError({ message: \"IdleDetector is not supported in this browser\" }, \"unsupported\");\n return \"denied\";\n }\n try {\n const result = await Ctor.requestPermission();\n // Symmetric with start()'s success path: any settled (non-throwing)\n // outcome — granted or a plain \"denied\" — supersedes a stale error from\n // an earlier attempt (e.g. a prior gesture-context rejection).\n this._setError(null);\n return result === \"granted\" ? \"granted\" : \"denied\";\n } catch (e: any) {\n this._setError({ error: e }, e?.name);\n return \"denied\";\n }\n }\n\n /**\n * Start an idle-detection session. `threshold` (ms) must be >= 60000 per\n * spec — not validated here (§3): an out-of-range value is left to the\n * browser's own TypeError, which never-throw absorbs into `error`.\n */\n async start(threshold: number = MIN_THRESHOLD): Promise<void> {\n this.stop(); // supersede any in-flight session (mirrors FetchCore's \"cancel then start\")\n\n const Ctor = this._api();\n if (!Ctor) {\n this._setError({ message: \"IdleDetector is not supported in this browser\" }, \"unsupported\");\n return;\n }\n\n const ac = new AbortController();\n this._abortController = ac;\n const gen = ++this._gen;\n\n try {\n const detector = new Ctor();\n detector.addEventListener(\"change\", this._onChange);\n this._detector = detector;\n await detector.start({ threshold, signal: ac.signal });\n if (gen !== this._gen) return; // stale (stop()/dispose() ran during the await)\n this._setError(null);\n this._setState(detector.userState, detector.screenState);\n } catch (e: any) {\n // No separate AbortError check: stop()/dispose() bump `_gen` *before*\n // calling `ac.abort()` (see stop() below), so a stop()-triggered\n // AbortError always has a stale `gen` here and is already caught by\n // the check above. The signal is private and never exposed, so an\n // AbortError from any other source cannot occur.\n if (gen !== this._gen) return;\n // Tear down the failed session's listener/controller (mirrors stop()):\n // without this, the failed `_detector` stays wired to `_onChange` and a\n // later `change` on that same (never-truly-started) instance would\n // still write state, contradicting the error just recorded.\n this._detector?.removeEventListener(\"change\", this._onChange);\n this._detector = null;\n this._abortController = null;\n this._setError({ error: e }, e?.name);\n }\n }\n\n /** Stop the current session (if any) and detach its listener. Safe to call when not started. */\n stop(): void {\n this._gen++;\n this._abortController?.abort();\n this._abortController = null;\n if (this._detector) {\n this._detector.removeEventListener(\"change\", this._onChange);\n this._detector = null;\n }\n }\n\n private _onChange = (event: Event): void => {\n const detector = event.target as IdleDetectorLike;\n this._setState(detector.userState, detector.screenState);\n };\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/upgrade-properties.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n// custom element の property upgrade — `static wcBindable.inputs` に宣言した入力のうち、\n// 要素が upgrade される前に代入された own データプロパティを取り込み直す。\n//\n// なぜ必要か:\n// 未定義タグの要素は素の HTMLElement なので、`el.url = \"...\"` は own データプロパティを作る。\n// upgrade 後にクラスの accessor が prototype へ入っても own プロパティが優先されるため、\n// setter は二度と呼ばれず、値は要素へ届かないまま消える(エラーも警告も出ない)。\n// 常にプロパティ代入を行う framework(Angular の `[prop]`、Lit の `.prop=`、\n// Solid の `prop:`、Vue の `.prop` 修飾子)× 遅延定義(autoloader / CDN / code-split)で\n// 常態的に起きる。docs/architecture-hardening/13-framework-adapter-binding-constraints.md §1.2。\n//\n// 安全側の判定:\n// own プロパティがあっても、prototype チェーンに accessor が無ければ「シャドウ」ではなく\n// その own プロパティ自体が正規の格納先なので触らない(public class field を壊さない)。\n//\n// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/upgrade-properties.ts), then run\n// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies\n// (packages/<pkg>/src/protocol/upgradeProperties.ts). Those copies are generated — do not edit them.\nimport { IWcBindable } from \"./wcBindable.js\";\n\nfunction hasAccessorOnPrototype(target: object, name: string): boolean {\n let proto = Object.getPrototypeOf(target);\n while (proto !== null) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, name);\n if (descriptor !== undefined) {\n return typeof descriptor.get === \"function\" || typeof descriptor.set === \"function\";\n }\n proto = Object.getPrototypeOf(proto);\n }\n return false;\n}\n\n/**\n * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で\n * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。\n *\n * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。\n * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。\n * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。\n */\nexport function upgradeProperties(element: object): void {\n const declaration = (element as { constructor?: { wcBindable?: IWcBindable } }).constructor?.wcBindable;\n const inputs = declaration?.inputs;\n if (inputs === undefined) return;\n for (const input of inputs) {\n const name = input.name;\n if (!Object.prototype.hasOwnProperty.call(element, name)) continue;\n if (!hasAccessorOnPrototype(element, name)) continue;\n const record = element as Record<string, unknown>;\n const value = record[name];\n delete record[name];\n record[name] = value;\n }\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/input-attribute.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n// 属性へ反映する wc-bindable 入力の producer 側(SPEC-extensions § Producer guidance for inputs の P1〜P3)。\n// 入力の setter は属性をこの 2 関数で書く。それで次が揃う:\n// - `undefined` は「値が無い」(P1): 属性を、この関数で最初に書く前の状態 — マークアップに書かれた値、\n// 無ければ属性なし(= その入力の文書化した既定値)— へ戻す。applier プロファイルを宣言する binder は\n// 値の後の `undefined` を書き(A2)、React 19 も書き、直接の代入でも届く。\n// - `null` はクリア(P2): 属性なし、つまり文書化した既定値。\n// - どちらも文字列 \"undefined\" / \"null\" として属性に入らない。\n//\n// 「最初に書く前」は、その最初の書き込みのときに読む(遅延)。upgrade 前に代入されたプロパティは\n// connectedCallback の upgradeProperties() が通し直すので、そのときにはパーサが書いた属性が揃っている。\n// 要素自身が setter を通さずに書いた属性は、最初の書き込みより前なら「最初の状態」に含まれる。\n//\n// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/input-attribute.ts), then run\n// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies\n// (packages/<pkg>/src/protocol/inputAttribute.ts). Those copies are generated — do not edit them.\n\nconst initialAttributes = new WeakMap<Element, Map<string, string | null>>();\n\n/** The attribute as it stood before the first write through these helpers. */\nfunction initialAttribute(el: Element, name: string): string | null {\n let byName = initialAttributes.get(el);\n if (byName === undefined) {\n byName = new Map();\n initialAttributes.set(el, byName);\n }\n if (!byName.has(name)) byName.set(name, el.getAttribute(name));\n return byName.get(name) as string | null;\n}\n\nfunction writeAttribute(el: Element, name: string, value: string | null): void {\n if (value === null) el.removeAttribute(name);\n else el.setAttribute(name, value);\n}\n\n/**\n * A value attribute. `value` is written as `String(value)`; `null` removes the attribute;\n * `undefined` restores the attribute the element started with.\n */\nexport function reflectAttribute(el: Element, name: string, value: unknown): void {\n const initial = initialAttribute(el, name);\n writeAttribute(el, name, value === undefined ? initial : value === null ? null : String(value));\n}\n\n/**\n * A boolean attribute, present while `value` is truthy (`null` and `false` remove it);\n * `undefined` restores the attribute the element started with.\n */\nexport function reflectBooleanAttribute(el: Element, name: string, value: unknown): void {\n const initial = initialAttribute(el, name);\n writeAttribute(el, name, value === undefined ? initial : value ? \"\" : null);\n}\n","import { IdleScreenState, IdleUserState, IWcBindable } from \"../types.js\";\nimport { IdleCore } from \"../core/IdleCore.js\";\nimport { WcsIoErrorInfo } from \"../core/platformCapability.js\";\nimport { upgradeProperties } from \"../protocol/upgradeProperties.js\";\nimport { reflectAttribute } from \"../protocol/inputAttribute.js\";\n\n/**\n * `<wcs-idle>` — declarative Idle Detection API primitive.\n *\n * Does NOT auto-start on connect (docs/idle-detection-tag-design.md §6): the\n * permission gate sits in front of `start()`, so an unconditional\n * connectedCallback start would be guaranteed to fail before permission is\n * granted. Callers drive `requestPermission()` → `start()` explicitly, e.g.\n * from a click handler.\n *\n * Compose with `<wcs-permission name=\"idle-detection\">` for prompt/granted/\n * denied status — this Shell only exposes the actual idle state.\n */\nexport class WcsIdle extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n\n static wcBindable: IWcBindable = {\n ...IdleCore.wcBindable,\n inputs: [\n { name: \"threshold\", attribute: \"threshold\" },\n ],\n // Core の commands をそのまま継承(単一情報源)。\n commands: IdleCore.wcBindable.commands,\n };\n\n private _core: IdleCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new IdleCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-idle:change\": (d) => ({ active: d.userState === \"active\" }),\n \"wcs-idle:error\": (d) => ({ error: d != null }),\n });\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 (docs/custom-state-reflection-design.md §3.1/§3.4): attachInternals\n // is absent 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 /**\n * Minimum idle time (ms) before `userState` becomes `\"idle\"`. This value is\n * read only at `start()` time — there is no `attributeChangedCallback`\n * (deliberately not declared in `observedAttributes`, mirroring\n * `<wcs-gyroscope>`'s `frequency`), so mutating the attribute/property on an\n * already-running session has no effect until the caller `stop()`s and\n * `start()`s again.\n */\n get threshold(): number {\n const attr = this.getAttribute(\"threshold\");\n // An absent, empty, or whitespace-only attribute all mean \"no value\n // supplied\" and must fall back to the default — without this check,\n // `Number(\"\")`/`Number(\" \")` coerce to `0` (finite), which would slip\n // past the `Number.isFinite` fallback below and silently return `0`\n // instead of the documented 60000ms default.\n if (attr === null || attr.trim() === \"\") return 60000;\n const n = Number(attr);\n return Number.isFinite(n) ? n : 60000;\n }\n\n // Never lets setAttribute stringify null / undefined: `null` removes the\n // attribute (the 60000ms default), `undefined` restores the attribute the\n // element started with (wc-bindable producer guidance P1; React 19 and a\n // direct assignment deliver it, @wcstack/state does not).\n set threshold(value: number | null | undefined) {\n reflectAttribute(this, \"threshold\", value);\n }\n\n // --- Core delegated getters ---\n\n get userState(): IdleUserState | null {\n return this._core.userState;\n }\n\n get screenState(): IdleScreenState | null {\n return this._core.screenState;\n }\n\n get active(): boolean {\n return this._core.active;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get errorInfo(): WcsIoErrorInfo | null {\n return this._core.errorInfo;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Commands (delegated to Core) ---\n\n requestPermission(): Promise<\"granted\" | \"denied\"> {\n return this._core.requestPermission();\n }\n\n start(threshold?: number): Promise<void> {\n return this._core.start(threshold ?? this.threshold);\n }\n\n stop(): void {\n this._core.stop();\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n // upgrade 前に代入された input を取り込み直す(doc 13 §1.2 / Phase A1)\n upgradeProperties(this);\n this.style.display = \"none\";\n // No auto-start (§6) — observe() is a synchronous no-op, kept only for\n // API uniformity with other IO nodes' lifecycle.\n this._connectedCallbackPromise = this._core.observe();\n }\n\n disconnectedCallback(): void {\n this._core.dispose();\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapIdle(userConfig?: IWritableConfig, registry?: CustomElementRegistry): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents(registry);\n}\n","import { WcsIdle } from \"./components/Idle.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.idle)) {\n registry.define(config.tagNames.idle, WcsIdle);\n }\n}\n"],"names":["config","tagNames","idle","WCS_IDLE_ERROR_CODE","IdleCore","EventTarget","static","protocol","version","properties","name","event","semantics","getter","e","detail","userState","screenState","commands","async","_target","_userState","_screenState","_error","_errorInfo","_detector","_abortController","_gen","_ready","Promise","resolve","constructor","target","super","this","ready","active","error","errorInfo","observe","dispose","stop","_api","g","globalThis","IdleDetector","undefined","_setState","dispatchEvent","CustomEvent","bubbles","_setError","_commitErrorInfo","message","code","phase","recoverable","deriveIdleErrorInfo","_errorInfoMessage","src","String","info","requestPermission","Ctor","result","start","threshold","ac","AbortController","gen","detector","addEventListener","_onChange","signal","removeEventListener","abort","hasAccessorOnPrototype","proto","Object","getPrototypeOf","descriptor","getOwnPropertyDescriptor","get","set","initialAttributes","WeakMap","reflectAttribute","el","value","initial","byName","Map","has","getAttribute","initialAttribute","removeAttribute","setAttribute","writeAttribute","WcsIdle","HTMLElement","wcBindable","inputs","attribute","_core","_connectedCallbackPromise","_internals","_initInternals","_wireStates","d","debugStates","states","attachInternals","internals","add","delete","map","toStates","entries","debug","hasAttribute","on","toggleAttribute","attr","trim","n","Number","isFinite","connectedCallbackPromise","connectedCallback","element","declaration","input","prototype","hasOwnProperty","call","record","upgradeProperties","style","display","disconnectedCallback","registry","customElements","define","registerComponents"],"mappings":"AAQA,MA0BaA,EA1BoB,CAC/BC,SAAU,CACRC,KAAM,aCgBGC,EAEQ,qBAFRA,EAIC,cAJDA,EAMA,aCEP,MAAOC,UAAiBC,YAC5BC,kBAAiC,CAC/BC,SAAU,cACVC,QAAS,EACTC,WAAY,CACV,CAAEC,KAAM,YAAaC,MAAO,kBAAmBC,UAAW,QAASC,OAASC,GAAcA,EAAkBC,OAAOC,WACnH,CAAEN,KAAM,cAAeC,MAAO,kBAAmBC,UAAW,QA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+C,EAAO7H,UACd6H,EAAO7H,GACd6H,EAAO7H,GAAQ8E,CACjB,CACF,CEoGIgD,CAAkBtG,MAClBA,KAAKuG,MAAMC,QAAU,OAGrBxG,KAAKsE,0BAA4BtE,KAAKqE,MAAMhE,SAC9C,CAEA,oBAAAoG,GACEzG,KAAKqE,MAAM/D,SACb,ECpKI,IAAsDoG,GCItD,SAA6BA,EAAkCC,gBAC9DD,EAAS1D,IAAIlF,EAAOC,SAASC,OAChC0I,EAASE,OAAO9I,EAAOC,SAASC,KAAMgG,EAE1C,CDJE6C,CAAmBH"}
|
package/dist/index.d.ts
CHANGED
|
@@ -186,7 +186,7 @@ declare class WcsIdle extends HTMLElement {
|
|
|
186
186
|
* `start()`s again.
|
|
187
187
|
*/
|
|
188
188
|
get threshold(): number;
|
|
189
|
-
set threshold(value: number);
|
|
189
|
+
set threshold(value: number | null | undefined);
|
|
190
190
|
get userState(): IdleUserState | null;
|
|
191
191
|
get screenState(): IdleScreenState | null;
|
|
192
192
|
get active(): boolean;
|
package/dist/index.esm.js
CHANGED
|
@@ -400,6 +400,53 @@ function upgradeProperties(element) {
|
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
|
|
403
|
+
// ===========================================================================
|
|
404
|
+
// AUTO-GENERATED FILE - DO NOT EDIT.
|
|
405
|
+
// Generated from /protocol/input-attribute.ts by scripts/sync-protocol-types.mjs.
|
|
406
|
+
// Run `node scripts/sync-protocol-types.mjs` after editing the source.
|
|
407
|
+
// ===========================================================================
|
|
408
|
+
// 属性へ反映する wc-bindable 入力の producer 側(SPEC-extensions § Producer guidance for inputs の P1〜P3)。
|
|
409
|
+
// 入力の setter は属性をこの 2 関数で書く。それで次が揃う:
|
|
410
|
+
// - `undefined` は「値が無い」(P1): 属性を、この関数で最初に書く前の状態 — マークアップに書かれた値、
|
|
411
|
+
// 無ければ属性なし(= その入力の文書化した既定値)— へ戻す。applier プロファイルを宣言する binder は
|
|
412
|
+
// 値の後の `undefined` を書き(A2)、React 19 も書き、直接の代入でも届く。
|
|
413
|
+
// - `null` はクリア(P2): 属性なし、つまり文書化した既定値。
|
|
414
|
+
// - どちらも文字列 "undefined" / "null" として属性に入らない。
|
|
415
|
+
//
|
|
416
|
+
// 「最初に書く前」は、その最初の書き込みのときに読む(遅延)。upgrade 前に代入されたプロパティは
|
|
417
|
+
// connectedCallback の upgradeProperties() が通し直すので、そのときにはパーサが書いた属性が揃っている。
|
|
418
|
+
// 要素自身が setter を通さずに書いた属性は、最初の書き込みより前なら「最初の状態」に含まれる。
|
|
419
|
+
//
|
|
420
|
+
// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/input-attribute.ts), then run
|
|
421
|
+
// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies
|
|
422
|
+
// (packages/<pkg>/src/protocol/inputAttribute.ts). Those copies are generated — do not edit them.
|
|
423
|
+
const initialAttributes = new WeakMap();
|
|
424
|
+
/** The attribute as it stood before the first write through these helpers. */
|
|
425
|
+
function initialAttribute(el, name) {
|
|
426
|
+
let byName = initialAttributes.get(el);
|
|
427
|
+
if (byName === undefined) {
|
|
428
|
+
byName = new Map();
|
|
429
|
+
initialAttributes.set(el, byName);
|
|
430
|
+
}
|
|
431
|
+
if (!byName.has(name))
|
|
432
|
+
byName.set(name, el.getAttribute(name));
|
|
433
|
+
return byName.get(name);
|
|
434
|
+
}
|
|
435
|
+
function writeAttribute(el, name, value) {
|
|
436
|
+
if (value === null)
|
|
437
|
+
el.removeAttribute(name);
|
|
438
|
+
else
|
|
439
|
+
el.setAttribute(name, value);
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* A value attribute. `value` is written as `String(value)`; `null` removes the attribute;
|
|
443
|
+
* `undefined` restores the attribute the element started with.
|
|
444
|
+
*/
|
|
445
|
+
function reflectAttribute(el, name, value) {
|
|
446
|
+
const initial = initialAttribute(el, name);
|
|
447
|
+
writeAttribute(el, name, value === undefined ? initial : value === null ? null : String(value));
|
|
448
|
+
}
|
|
449
|
+
|
|
403
450
|
/**
|
|
404
451
|
* `<wcs-idle>` — declarative Idle Detection API primitive.
|
|
405
452
|
*
|
|
@@ -503,8 +550,12 @@ class WcsIdle extends HTMLElement {
|
|
|
503
550
|
const n = Number(attr);
|
|
504
551
|
return Number.isFinite(n) ? n : 60000;
|
|
505
552
|
}
|
|
553
|
+
// Never lets setAttribute stringify null / undefined: `null` removes the
|
|
554
|
+
// attribute (the 60000ms default), `undefined` restores the attribute the
|
|
555
|
+
// element started with (wc-bindable producer guidance P1; React 19 and a
|
|
556
|
+
// direct assignment deliver it, @wcstack/state does not).
|
|
506
557
|
set threshold(value) {
|
|
507
|
-
this
|
|
558
|
+
reflectAttribute(this, "threshold", value);
|
|
508
559
|
}
|
|
509
560
|
// --- Core delegated getters ---
|
|
510
561
|
get userState() {
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/config.ts","../src/core/idleCapabilities.ts","../src/core/IdleCore.ts","../src/protocol/upgradeProperties.ts","../src/components/Idle.ts","../src/registerComponents.ts","../src/bootstrapIdle.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n idle: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n idle: \"wcs-idle\",\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: `bootstrapIdle` refuses it. */\nfunction invalid(key: string): never {\n throw new Error(`[@wcstack/idle] bootstrapIdle: \"${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","/**\n * idleCapabilities.ts\n *\n * Idle Detection node 固有の error code(taxonomy)と derivation。汎用の error info 型は\n * `./platformCapability.js`(/io-core/ から copy-distribution される生成ファイル)から\n * import する。idle は requestPermission()/start()/stop() の単一コマンド経路で、競合する\n * operation を持たない(2 回目の start() は前を stop() してから開始する supersede)ため\n * lane は持たず、error taxonomy(errorInfo)のみを採用する。\n *\n * この node の `_setError` は 2 形態の入力を受ける:\n * 1. synthetic な非対応マーカー(`{ message: \"IdleDetector is not supported…\" }`、\n * `.name` 無し)— `globalThis.IdleDetector` 不在。\n * 2. caught された rejection を包んだ `{ error: e }`(`e.name` が実 Error.name)。\n * 両者を message coupling 無しに弁別するため、呼び出し側が明示的な `name` ヒントを渡す\n * (storage の `deriveStorageErrorInfo(error, name)` / screen-orientation と同じ\n * discriminator 技法)。非対応経路は `\"unsupported\"` を、caught 経路は wrap した\n * `e?.name` を渡す。\n *\n * requestPermission()/start() の実 rejection 名は spec のとおり gesture 文脈外 /\n * 権限未許可で `NotAllowedError`。それ以外(生の Error / TypeError(threshold 不正)/\n * `.name` 欠如の nullish reject 等)は一括して `idle-error`。\n */\n\nimport type { WcsIoErrorInfo } from \"./platformCapability.js\";\n\n/** 安定した idle error code(taxonomy)。値は公開キーとして固定。 */\nexport const WCS_IDLE_ERROR_CODE = {\n /** Idle Detection API 非対応(`globalThis.IdleDetector` 不在)。 */\n CapabilityMissing: \"capability-missing\",\n /** `NotAllowedError` — 権限拒否 / user-gesture 文脈外。retry では回復しない。 */\n NotAllowed: \"not-allowed\",\n /** その他の requestPermission()/start() 失敗(生 throw / TypeError / nullish reject 等)。 */\n IdleError: \"idle-error\",\n} as const;\n\n/**\n * idle の失敗を serializable な error taxonomy に写す。\n *\n * `name` は呼び出し側が渡す discriminator:synthetic 非対応なら `\"unsupported\"`、\n * caught 例外なら wrap した `e?.name`(生の非 Error / nullish reject では `undefined`)。\n * `message` は wrap を解いた下位値から抽出済みの文言(非対応なら synthetic の message)。\n *\n * - `\"unsupported\"` は利用直前の能力欠如 → phase=\"probe\" / capability-missing。\n * - `NotAllowedError` は requestPermission()/start() の権限ゲート失敗 → phase=\"start\" /\n * not-allowed / recoverable=false(gesture 違反と実 \"denied\" は区別しない設計 §4.1)。\n * - それ以外(生の throw、TypeError、`.name` 欠如等)は実行中の失敗 → phase=\"execute\" /\n * idle-error / recoverable=false。\n */\nexport function deriveIdleErrorInfo(name: string | undefined, message: string): WcsIoErrorInfo {\n if (name === \"unsupported\") {\n return { code: WCS_IDLE_ERROR_CODE.CapabilityMissing, phase: \"probe\", recoverable: false, message };\n }\n if (name === \"NotAllowedError\") {\n return { code: WCS_IDLE_ERROR_CODE.NotAllowed, phase: \"start\", recoverable: false, message };\n }\n return { code: WCS_IDLE_ERROR_CODE.IdleError, phase: \"execute\", recoverable: false, message };\n}\n","import { IdleScreenState, IdleUserState, IWcBindable } from \"../types.js\";\nimport { WcsIoErrorInfo } from \"./platformCapability.js\";\nimport { deriveIdleErrorInfo } from \"./idleCapabilities.js\";\n\ninterface IdleDetectorLike extends EventTarget {\n userState: IdleUserState;\n screenState: IdleScreenState;\n start(options: { threshold: number; signal: AbortSignal }): Promise<void>;\n}\n\ninterface IdleDetectorCtor {\n new (): IdleDetectorLike;\n requestPermission(): Promise<\"granted\" | \"denied\">;\n}\n\nconst MIN_THRESHOLD = 60000;\n\n/**\n * Headless Idle Detection primitive. A thin, framework-agnostic wrapper around\n * `IdleDetector` exposed through the wc-bindable protocol.\n *\n * Reference implementation for batch2's \"gesture-gated permission\" archetype\n * (docs/idle-detection-tag-design.md). `requestPermission()` wraps the static,\n * user-gesture-gated `IdleDetector.requestPermission()` — this Core never\n * calls it automatically; the caller must invoke it from within a real\n * gesture handler.\n *\n * Deliberately does NOT track the 4-value permission state (prompt/granted/\n * denied/unsupported) itself: `navigator.permissions.query({name:\n * \"idle-detection\"})` exists, so compose with `<wcs-permission\n * name=\"idle-detection\">` for that instead (§0). This Core only exposes the\n * actual idle state (userState/screenState) plus the one-time\n * requestPermission()/start()/stop() actions.\n */\nexport class IdleCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"userState\", event: \"wcs-idle:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.userState },\n { name: \"screenState\", event: \"wcs-idle:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.screenState },\n {\n name: \"active\",\n event: \"wcs-idle:change\",\n semantics: \"state\",\n getter: (e: Event) => (e as CustomEvent).detail.userState === \"active\",\n },\n // never-throw (§3.6): requestPermission()/start() failures land here\n // instead of rejecting/throwing. Mirrors every other bidirectional IO\n // node in this batch (fetch, share, screen-orientation).\n { name: \"error\", event: \"wcs-idle:error\", semantics: \"state\" },\n // Serializable failure taxonomy (stable code / phase / recoverable), or null.\n // Additive bindable output derived from `error` (capability-missing / not-allowed\n // / idle-error); the existing `error` property/event are unchanged. Fires\n // wcs-idle:error-info-changed. No lane — requestPermission()/start()/stop() form a\n // single command path (a 2nd start() supersedes the 1st), not competing operations.\n { name: \"errorInfo\", event: \"wcs-idle:error-info-changed\", semantics: \"state\" },\n ],\n // No `inputs`: the Core has no settable `threshold` state — `threshold` is a\n // per-call argument to `start(threshold)`, not a property/setter. The DOM-driven\n // `threshold` input surface belongs to the Shell (which declares it and backs it\n // with the `threshold` attribute), mirroring geolocation/intersection where the\n // Core declares no inputs and the Shell adds them.\n commands: [\n { name: \"requestPermission\", async: true },\n { name: \"start\", async: true },\n { name: \"stop\" },\n ],\n };\n\n private _target: EventTarget;\n private _userState: IdleUserState | null = null;\n private _screenState: IdleScreenState | null = null;\n private _error: any = null;\n // Additive failure taxonomy, kept strictly in sync with `_error` (derived on\n // every _setError, cleared to null when error clears). The two transition together.\n private _errorInfo: WcsIoErrorInfo | null = null;\n private _detector: IdleDetectorLike | null = null;\n private _abortController: AbortController | null = null;\n\n // Generation guard (§3.4): bumped on dispose()/stop() and each start().\n private _gen = 0;\n\n // SSR (§3.8): never auto-starts on connect, so there is no probe to await —\n // readiness is always immediate (docs/idle-detection-tag-design.md §7).\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n }\n\n get ready(): Promise<void> {\n return this._ready;\n }\n\n get userState(): IdleUserState | null {\n return this._userState;\n }\n\n get screenState(): IdleScreenState | null {\n return this._screenState;\n }\n\n get active(): boolean {\n return this._userState === \"active\";\n }\n\n get error(): any {\n return this._error;\n }\n\n /**\n * The last failure's serializable `WcsIoErrorInfo` (stable `code` / `phase` /\n * `recoverable`), or null. Additive wc-bindable property (event\n * `wcs-idle:error-info-changed`), derived from `error`; the existing `error`\n * property/event are unchanged.\n */\n get errorInfo(): WcsIoErrorInfo | null {\n return this._errorInfo;\n }\n\n // Lifecycle (§3.5). observe() is a synchronous no-op: unlike most IO nodes,\n // this Core deliberately does NOT auto-start on connect (§6) — permission\n // is gesture-gated, so attempting start() before it is granted is\n // guaranteed to fail.\n observe(): Promise<void> {\n return this._ready;\n }\n\n dispose(): void {\n this.stop();\n }\n\n private _api(): IdleDetectorCtor | undefined {\n const g = globalThis as any;\n return typeof g.IdleDetector === \"function\" ? g.IdleDetector : undefined;\n }\n\n private _setState(userState: IdleUserState, screenState: IdleScreenState): void {\n if (this._userState === userState && this._screenState === screenState) return;\n this._userState = userState;\n this._screenState = screenState;\n this._target.dispatchEvent(new CustomEvent(\"wcs-idle:change\", {\n detail: { userState, screenState },\n bubbles: true,\n }));\n }\n\n // `name` is the discriminator for the additive `errorInfo` taxonomy only (it\n // stays out of the public `error` shape): the synthetic unsupported marker has\n // no `.name`, so the unsupported call sites pass an explicit `\"unsupported\"`\n // hint (storage/screen-orientation-style — avoids coupling to `error.message`),\n // while the caught paths pass the wrapped rejection's `Error.name` (`e?.name`).\n // `null` clears (no name).\n private _setError(error: any, name?: string): void {\n if (this._error === error) return;\n this._error = error;\n // Keep the additive `errorInfo` taxonomy in sync with `error`: derive from the\n // discriminator + extracted message (or null on clear). Fires before the `error`\n // event so an observer binding both sees the classification first, mirroring the\n // io-node family.\n this._commitErrorInfo(error === null ? null : deriveIdleErrorInfo(name, this._errorInfoMessage(error)));\n this._target.dispatchEvent(new CustomEvent(\"wcs-idle:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n // Extract a serializable string message for `errorInfo` WITHOUT normalizing the\n // public `error` shape. The public error is either the synthetic `{ message }`\n // (unsupported) or a wrapped `{ error: e }` (a caught rejection). For the wrapped\n // form the meaningful message lives on `e`, so unwrap one level before reading\n // `.message`; a non-conformant / nullish value (e.g. `Promise.reject(undefined)`)\n // falls back to `String(...)` so it still classifies instead of throwing\n // (never-throw §3.6).\n private _errorInfoMessage(error: any): string {\n const src = error != null && typeof error === \"object\" && \"error\" in error ? error.error : error;\n return typeof src?.message === \"string\" ? src.message : String(src);\n }\n\n // Called only from _setError (which already same-value-guards on the error\n // reference), so errorInfo transitions exactly when error does — no separate\n // guard needed here.\n private _commitErrorInfo(info: WcsIoErrorInfo | null): void {\n this._errorInfo = info;\n this._target.dispatchEvent(new CustomEvent(\"wcs-idle:error-info-changed\", {\n detail: info,\n bubbles: true,\n }));\n }\n\n /**\n * Wraps the static, user-gesture-gated `IdleDetector.requestPermission()`.\n * MUST be invoked from within a real user gesture handler by the caller —\n * this Core cannot manufacture one. never-throw: a gesture-context\n * rejection resolves to `\"denied\"` and lands in `error`. Gesture violation\n * and an actual \"denied\" outcome are not distinguished — both mean \"not\n * usable right now\" (§4.1).\n */\n async requestPermission(): Promise<\"granted\" | \"denied\"> {\n const Ctor = this._api();\n if (!Ctor) {\n this._setError({ message: \"IdleDetector is not supported in this browser\" }, \"unsupported\");\n return \"denied\";\n }\n try {\n const result = await Ctor.requestPermission();\n // Symmetric with start()'s success path: any settled (non-throwing)\n // outcome — granted or a plain \"denied\" — supersedes a stale error from\n // an earlier attempt (e.g. a prior gesture-context rejection).\n this._setError(null);\n return result === \"granted\" ? \"granted\" : \"denied\";\n } catch (e: any) {\n this._setError({ error: e }, e?.name);\n return \"denied\";\n }\n }\n\n /**\n * Start an idle-detection session. `threshold` (ms) must be >= 60000 per\n * spec — not validated here (§3): an out-of-range value is left to the\n * browser's own TypeError, which never-throw absorbs into `error`.\n */\n async start(threshold: number = MIN_THRESHOLD): Promise<void> {\n this.stop(); // supersede any in-flight session (mirrors FetchCore's \"cancel then start\")\n\n const Ctor = this._api();\n if (!Ctor) {\n this._setError({ message: \"IdleDetector is not supported in this browser\" }, \"unsupported\");\n return;\n }\n\n const ac = new AbortController();\n this._abortController = ac;\n const gen = ++this._gen;\n\n try {\n const detector = new Ctor();\n detector.addEventListener(\"change\", this._onChange);\n this._detector = detector;\n await detector.start({ threshold, signal: ac.signal });\n if (gen !== this._gen) return; // stale (stop()/dispose() ran during the await)\n this._setError(null);\n this._setState(detector.userState, detector.screenState);\n } catch (e: any) {\n // No separate AbortError check: stop()/dispose() bump `_gen` *before*\n // calling `ac.abort()` (see stop() below), so a stop()-triggered\n // AbortError always has a stale `gen` here and is already caught by\n // the check above. The signal is private and never exposed, so an\n // AbortError from any other source cannot occur.\n if (gen !== this._gen) return;\n // Tear down the failed session's listener/controller (mirrors stop()):\n // without this, the failed `_detector` stays wired to `_onChange` and a\n // later `change` on that same (never-truly-started) instance would\n // still write state, contradicting the error just recorded.\n this._detector?.removeEventListener(\"change\", this._onChange);\n this._detector = null;\n this._abortController = null;\n this._setError({ error: e }, e?.name);\n }\n }\n\n /** Stop the current session (if any) and detach its listener. Safe to call when not started. */\n stop(): void {\n this._gen++;\n this._abortController?.abort();\n this._abortController = null;\n if (this._detector) {\n this._detector.removeEventListener(\"change\", this._onChange);\n this._detector = null;\n }\n }\n\n private _onChange = (event: Event): void => {\n const detector = event.target as IdleDetectorLike;\n this._setState(detector.userState, detector.screenState);\n };\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/upgrade-properties.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n// custom element の property upgrade — `static wcBindable.inputs` に宣言した入力のうち、\n// 要素が upgrade される前に代入された own データプロパティを取り込み直す。\n//\n// なぜ必要か:\n// 未定義タグの要素は素の HTMLElement なので、`el.url = \"...\"` は own データプロパティを作る。\n// upgrade 後にクラスの accessor が prototype へ入っても own プロパティが優先されるため、\n// setter は二度と呼ばれず、値は要素へ届かないまま消える(エラーも警告も出ない)。\n// 常にプロパティ代入を行う framework(Angular の `[prop]`、Lit の `.prop=`、\n// Solid の `prop:`、Vue の `.prop` 修飾子)× 遅延定義(autoloader / CDN / code-split)で\n// 常態的に起きる。docs/architecture-hardening/13-framework-adapter-binding-constraints.md §1.2。\n//\n// 安全側の判定:\n// own プロパティがあっても、prototype チェーンに accessor が無ければ「シャドウ」ではなく\n// その own プロパティ自体が正規の格納先なので触らない(public class field を壊さない)。\n//\n// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/upgrade-properties.ts), then run\n// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies\n// (packages/<pkg>/src/protocol/upgradeProperties.ts). Those copies are generated — do not edit them.\nimport { IWcBindable } from \"./wcBindable.js\";\n\nfunction hasAccessorOnPrototype(target: object, name: string): boolean {\n let proto = Object.getPrototypeOf(target);\n while (proto !== null) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, name);\n if (descriptor !== undefined) {\n return typeof descriptor.get === \"function\" || typeof descriptor.set === \"function\";\n }\n proto = Object.getPrototypeOf(proto);\n }\n return false;\n}\n\n/**\n * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で\n * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。\n *\n * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。\n * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。\n * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。\n */\nexport function upgradeProperties(element: object): void {\n const declaration = (element as { constructor?: { wcBindable?: IWcBindable } }).constructor?.wcBindable;\n const inputs = declaration?.inputs;\n if (inputs === undefined) return;\n for (const input of inputs) {\n const name = input.name;\n if (!Object.prototype.hasOwnProperty.call(element, name)) continue;\n if (!hasAccessorOnPrototype(element, name)) continue;\n const record = element as Record<string, unknown>;\n const value = record[name];\n delete record[name];\n record[name] = value;\n }\n}\n","import { IdleScreenState, IdleUserState, IWcBindable } from \"../types.js\";\nimport { IdleCore } from \"../core/IdleCore.js\";\nimport { WcsIoErrorInfo } from \"../core/platformCapability.js\";\nimport { upgradeProperties } from \"../protocol/upgradeProperties.js\";\n\n/**\n * `<wcs-idle>` — declarative Idle Detection API primitive.\n *\n * Does NOT auto-start on connect (docs/idle-detection-tag-design.md §6): the\n * permission gate sits in front of `start()`, so an unconditional\n * connectedCallback start would be guaranteed to fail before permission is\n * granted. Callers drive `requestPermission()` → `start()` explicitly, e.g.\n * from a click handler.\n *\n * Compose with `<wcs-permission name=\"idle-detection\">` for prompt/granted/\n * denied status — this Shell only exposes the actual idle state.\n */\nexport class WcsIdle extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n\n static wcBindable: IWcBindable = {\n ...IdleCore.wcBindable,\n inputs: [\n { name: \"threshold\", attribute: \"threshold\" },\n ],\n // Core の commands をそのまま継承(単一情報源)。\n commands: IdleCore.wcBindable.commands,\n };\n\n private _core: IdleCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new IdleCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-idle:change\": (d) => ({ active: d.userState === \"active\" }),\n \"wcs-idle:error\": (d) => ({ error: d != null }),\n });\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 (docs/custom-state-reflection-design.md §3.1/§3.4): attachInternals\n // is absent 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 /**\n * Minimum idle time (ms) before `userState` becomes `\"idle\"`. This value is\n * read only at `start()` time — there is no `attributeChangedCallback`\n * (deliberately not declared in `observedAttributes`, mirroring\n * `<wcs-gyroscope>`'s `frequency`), so mutating the attribute/property on an\n * already-running session has no effect until the caller `stop()`s and\n * `start()`s again.\n */\n get threshold(): number {\n const attr = this.getAttribute(\"threshold\");\n // An absent, empty, or whitespace-only attribute all mean \"no value\n // supplied\" and must fall back to the default — without this check,\n // `Number(\"\")`/`Number(\" \")` coerce to `0` (finite), which would slip\n // past the `Number.isFinite` fallback below and silently return `0`\n // instead of the documented 60000ms default.\n if (attr === null || attr.trim() === \"\") return 60000;\n const n = Number(attr);\n return Number.isFinite(n) ? n : 60000;\n }\n\n set threshold(value: number) {\n this.setAttribute(\"threshold\", String(value));\n }\n\n // --- Core delegated getters ---\n\n get userState(): IdleUserState | null {\n return this._core.userState;\n }\n\n get screenState(): IdleScreenState | null {\n return this._core.screenState;\n }\n\n get active(): boolean {\n return this._core.active;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get errorInfo(): WcsIoErrorInfo | null {\n return this._core.errorInfo;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Commands (delegated to Core) ---\n\n requestPermission(): Promise<\"granted\" | \"denied\"> {\n return this._core.requestPermission();\n }\n\n start(threshold?: number): Promise<void> {\n return this._core.start(threshold ?? this.threshold);\n }\n\n stop(): void {\n this._core.stop();\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n // upgrade 前に代入された input を取り込み直す(doc 13 §1.2 / Phase A1)\n upgradeProperties(this);\n this.style.display = \"none\";\n // No auto-start (§6) — observe() is a synchronous no-op, kept only for\n // API uniformity with other IO nodes' lifecycle.\n this._connectedCallbackPromise = this._core.observe();\n }\n\n disconnectedCallback(): void {\n this._core.dispose();\n }\n}\n","import { WcsIdle } from \"./components/Idle.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.idle)) {\n registry.define(config.tagNames.idle, WcsIdle);\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapIdle(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,IAAI,EAAE,UAAU;AACjB,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;AA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ACvB;IACA,kBAAkB,CAAC,QAAQ,CAAC;AAC9B;;;;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/config.ts","../src/core/idleCapabilities.ts","../src/core/IdleCore.ts","../src/protocol/upgradeProperties.ts","../src/protocol/inputAttribute.ts","../src/components/Idle.ts","../src/registerComponents.ts","../src/bootstrapIdle.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n idle: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n idle: \"wcs-idle\",\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: `bootstrapIdle` refuses it. */\nfunction invalid(key: string): never {\n throw new Error(`[@wcstack/idle] bootstrapIdle: \"${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","/**\n * idleCapabilities.ts\n *\n * Idle Detection node 固有の error code(taxonomy)と derivation。汎用の error info 型は\n * `./platformCapability.js`(/io-core/ から copy-distribution される生成ファイル)から\n * import する。idle は requestPermission()/start()/stop() の単一コマンド経路で、競合する\n * operation を持たない(2 回目の start() は前を stop() してから開始する supersede)ため\n * lane は持たず、error taxonomy(errorInfo)のみを採用する。\n *\n * この node の `_setError` は 2 形態の入力を受ける:\n * 1. synthetic な非対応マーカー(`{ message: \"IdleDetector is not supported…\" }`、\n * `.name` 無し)— `globalThis.IdleDetector` 不在。\n * 2. caught された rejection を包んだ `{ error: e }`(`e.name` が実 Error.name)。\n * 両者を message coupling 無しに弁別するため、呼び出し側が明示的な `name` ヒントを渡す\n * (storage の `deriveStorageErrorInfo(error, name)` / screen-orientation と同じ\n * discriminator 技法)。非対応経路は `\"unsupported\"` を、caught 経路は wrap した\n * `e?.name` を渡す。\n *\n * requestPermission()/start() の実 rejection 名は spec のとおり gesture 文脈外 /\n * 権限未許可で `NotAllowedError`。それ以外(生の Error / TypeError(threshold 不正)/\n * `.name` 欠如の nullish reject 等)は一括して `idle-error`。\n */\n\nimport type { WcsIoErrorInfo } from \"./platformCapability.js\";\n\n/** 安定した idle error code(taxonomy)。値は公開キーとして固定。 */\nexport const WCS_IDLE_ERROR_CODE = {\n /** Idle Detection API 非対応(`globalThis.IdleDetector` 不在)。 */\n CapabilityMissing: \"capability-missing\",\n /** `NotAllowedError` — 権限拒否 / user-gesture 文脈外。retry では回復しない。 */\n NotAllowed: \"not-allowed\",\n /** その他の requestPermission()/start() 失敗(生 throw / TypeError / nullish reject 等)。 */\n IdleError: \"idle-error\",\n} as const;\n\n/**\n * idle の失敗を serializable な error taxonomy に写す。\n *\n * `name` は呼び出し側が渡す discriminator:synthetic 非対応なら `\"unsupported\"`、\n * caught 例外なら wrap した `e?.name`(生の非 Error / nullish reject では `undefined`)。\n * `message` は wrap を解いた下位値から抽出済みの文言(非対応なら synthetic の message)。\n *\n * - `\"unsupported\"` は利用直前の能力欠如 → phase=\"probe\" / capability-missing。\n * - `NotAllowedError` は requestPermission()/start() の権限ゲート失敗 → phase=\"start\" /\n * not-allowed / recoverable=false(gesture 違反と実 \"denied\" は区別しない設計 §4.1)。\n * - それ以外(生の throw、TypeError、`.name` 欠如等)は実行中の失敗 → phase=\"execute\" /\n * idle-error / recoverable=false。\n */\nexport function deriveIdleErrorInfo(name: string | undefined, message: string): WcsIoErrorInfo {\n if (name === \"unsupported\") {\n return { code: WCS_IDLE_ERROR_CODE.CapabilityMissing, phase: \"probe\", recoverable: false, message };\n }\n if (name === \"NotAllowedError\") {\n return { code: WCS_IDLE_ERROR_CODE.NotAllowed, phase: \"start\", recoverable: false, message };\n }\n return { code: WCS_IDLE_ERROR_CODE.IdleError, phase: \"execute\", recoverable: false, message };\n}\n","import { IdleScreenState, IdleUserState, IWcBindable } from \"../types.js\";\nimport { WcsIoErrorInfo } from \"./platformCapability.js\";\nimport { deriveIdleErrorInfo } from \"./idleCapabilities.js\";\n\ninterface IdleDetectorLike extends EventTarget {\n userState: IdleUserState;\n screenState: IdleScreenState;\n start(options: { threshold: number; signal: AbortSignal }): Promise<void>;\n}\n\ninterface IdleDetectorCtor {\n new (): IdleDetectorLike;\n requestPermission(): Promise<\"granted\" | \"denied\">;\n}\n\nconst MIN_THRESHOLD = 60000;\n\n/**\n * Headless Idle Detection primitive. A thin, framework-agnostic wrapper around\n * `IdleDetector` exposed through the wc-bindable protocol.\n *\n * Reference implementation for batch2's \"gesture-gated permission\" archetype\n * (docs/idle-detection-tag-design.md). `requestPermission()` wraps the static,\n * user-gesture-gated `IdleDetector.requestPermission()` — this Core never\n * calls it automatically; the caller must invoke it from within a real\n * gesture handler.\n *\n * Deliberately does NOT track the 4-value permission state (prompt/granted/\n * denied/unsupported) itself: `navigator.permissions.query({name:\n * \"idle-detection\"})` exists, so compose with `<wcs-permission\n * name=\"idle-detection\">` for that instead (§0). This Core only exposes the\n * actual idle state (userState/screenState) plus the one-time\n * requestPermission()/start()/stop() actions.\n */\nexport class IdleCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"userState\", event: \"wcs-idle:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.userState },\n { name: \"screenState\", event: \"wcs-idle:change\", semantics: \"state\", getter: (e: Event) => (e as CustomEvent).detail.screenState },\n {\n name: \"active\",\n event: \"wcs-idle:change\",\n semantics: \"state\",\n getter: (e: Event) => (e as CustomEvent).detail.userState === \"active\",\n },\n // never-throw (§3.6): requestPermission()/start() failures land here\n // instead of rejecting/throwing. Mirrors every other bidirectional IO\n // node in this batch (fetch, share, screen-orientation).\n { name: \"error\", event: \"wcs-idle:error\", semantics: \"state\" },\n // Serializable failure taxonomy (stable code / phase / recoverable), or null.\n // Additive bindable output derived from `error` (capability-missing / not-allowed\n // / idle-error); the existing `error` property/event are unchanged. Fires\n // wcs-idle:error-info-changed. No lane — requestPermission()/start()/stop() form a\n // single command path (a 2nd start() supersedes the 1st), not competing operations.\n { name: \"errorInfo\", event: \"wcs-idle:error-info-changed\", semantics: \"state\" },\n ],\n // No `inputs`: the Core has no settable `threshold` state — `threshold` is a\n // per-call argument to `start(threshold)`, not a property/setter. The DOM-driven\n // `threshold` input surface belongs to the Shell (which declares it and backs it\n // with the `threshold` attribute), mirroring geolocation/intersection where the\n // Core declares no inputs and the Shell adds them.\n commands: [\n { name: \"requestPermission\", async: true },\n { name: \"start\", async: true },\n { name: \"stop\" },\n ],\n };\n\n private _target: EventTarget;\n private _userState: IdleUserState | null = null;\n private _screenState: IdleScreenState | null = null;\n private _error: any = null;\n // Additive failure taxonomy, kept strictly in sync with `_error` (derived on\n // every _setError, cleared to null when error clears). The two transition together.\n private _errorInfo: WcsIoErrorInfo | null = null;\n private _detector: IdleDetectorLike | null = null;\n private _abortController: AbortController | null = null;\n\n // Generation guard (§3.4): bumped on dispose()/stop() and each start().\n private _gen = 0;\n\n // SSR (§3.8): never auto-starts on connect, so there is no probe to await —\n // readiness is always immediate (docs/idle-detection-tag-design.md §7).\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n }\n\n get ready(): Promise<void> {\n return this._ready;\n }\n\n get userState(): IdleUserState | null {\n return this._userState;\n }\n\n get screenState(): IdleScreenState | null {\n return this._screenState;\n }\n\n get active(): boolean {\n return this._userState === \"active\";\n }\n\n get error(): any {\n return this._error;\n }\n\n /**\n * The last failure's serializable `WcsIoErrorInfo` (stable `code` / `phase` /\n * `recoverable`), or null. Additive wc-bindable property (event\n * `wcs-idle:error-info-changed`), derived from `error`; the existing `error`\n * property/event are unchanged.\n */\n get errorInfo(): WcsIoErrorInfo | null {\n return this._errorInfo;\n }\n\n // Lifecycle (§3.5). observe() is a synchronous no-op: unlike most IO nodes,\n // this Core deliberately does NOT auto-start on connect (§6) — permission\n // is gesture-gated, so attempting start() before it is granted is\n // guaranteed to fail.\n observe(): Promise<void> {\n return this._ready;\n }\n\n dispose(): void {\n this.stop();\n }\n\n private _api(): IdleDetectorCtor | undefined {\n const g = globalThis as any;\n return typeof g.IdleDetector === \"function\" ? g.IdleDetector : undefined;\n }\n\n private _setState(userState: IdleUserState, screenState: IdleScreenState): void {\n if (this._userState === userState && this._screenState === screenState) return;\n this._userState = userState;\n this._screenState = screenState;\n this._target.dispatchEvent(new CustomEvent(\"wcs-idle:change\", {\n detail: { userState, screenState },\n bubbles: true,\n }));\n }\n\n // `name` is the discriminator for the additive `errorInfo` taxonomy only (it\n // stays out of the public `error` shape): the synthetic unsupported marker has\n // no `.name`, so the unsupported call sites pass an explicit `\"unsupported\"`\n // hint (storage/screen-orientation-style — avoids coupling to `error.message`),\n // while the caught paths pass the wrapped rejection's `Error.name` (`e?.name`).\n // `null` clears (no name).\n private _setError(error: any, name?: string): void {\n if (this._error === error) return;\n this._error = error;\n // Keep the additive `errorInfo` taxonomy in sync with `error`: derive from the\n // discriminator + extracted message (or null on clear). Fires before the `error`\n // event so an observer binding both sees the classification first, mirroring the\n // io-node family.\n this._commitErrorInfo(error === null ? null : deriveIdleErrorInfo(name, this._errorInfoMessage(error)));\n this._target.dispatchEvent(new CustomEvent(\"wcs-idle:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n // Extract a serializable string message for `errorInfo` WITHOUT normalizing the\n // public `error` shape. The public error is either the synthetic `{ message }`\n // (unsupported) or a wrapped `{ error: e }` (a caught rejection). For the wrapped\n // form the meaningful message lives on `e`, so unwrap one level before reading\n // `.message`; a non-conformant / nullish value (e.g. `Promise.reject(undefined)`)\n // falls back to `String(...)` so it still classifies instead of throwing\n // (never-throw §3.6).\n private _errorInfoMessage(error: any): string {\n const src = error != null && typeof error === \"object\" && \"error\" in error ? error.error : error;\n return typeof src?.message === \"string\" ? src.message : String(src);\n }\n\n // Called only from _setError (which already same-value-guards on the error\n // reference), so errorInfo transitions exactly when error does — no separate\n // guard needed here.\n private _commitErrorInfo(info: WcsIoErrorInfo | null): void {\n this._errorInfo = info;\n this._target.dispatchEvent(new CustomEvent(\"wcs-idle:error-info-changed\", {\n detail: info,\n bubbles: true,\n }));\n }\n\n /**\n * Wraps the static, user-gesture-gated `IdleDetector.requestPermission()`.\n * MUST be invoked from within a real user gesture handler by the caller —\n * this Core cannot manufacture one. never-throw: a gesture-context\n * rejection resolves to `\"denied\"` and lands in `error`. Gesture violation\n * and an actual \"denied\" outcome are not distinguished — both mean \"not\n * usable right now\" (§4.1).\n */\n async requestPermission(): Promise<\"granted\" | \"denied\"> {\n const Ctor = this._api();\n if (!Ctor) {\n this._setError({ message: \"IdleDetector is not supported in this browser\" }, \"unsupported\");\n return \"denied\";\n }\n try {\n const result = await Ctor.requestPermission();\n // Symmetric with start()'s success path: any settled (non-throwing)\n // outcome — granted or a plain \"denied\" — supersedes a stale error from\n // an earlier attempt (e.g. a prior gesture-context rejection).\n this._setError(null);\n return result === \"granted\" ? \"granted\" : \"denied\";\n } catch (e: any) {\n this._setError({ error: e }, e?.name);\n return \"denied\";\n }\n }\n\n /**\n * Start an idle-detection session. `threshold` (ms) must be >= 60000 per\n * spec — not validated here (§3): an out-of-range value is left to the\n * browser's own TypeError, which never-throw absorbs into `error`.\n */\n async start(threshold: number = MIN_THRESHOLD): Promise<void> {\n this.stop(); // supersede any in-flight session (mirrors FetchCore's \"cancel then start\")\n\n const Ctor = this._api();\n if (!Ctor) {\n this._setError({ message: \"IdleDetector is not supported in this browser\" }, \"unsupported\");\n return;\n }\n\n const ac = new AbortController();\n this._abortController = ac;\n const gen = ++this._gen;\n\n try {\n const detector = new Ctor();\n detector.addEventListener(\"change\", this._onChange);\n this._detector = detector;\n await detector.start({ threshold, signal: ac.signal });\n if (gen !== this._gen) return; // stale (stop()/dispose() ran during the await)\n this._setError(null);\n this._setState(detector.userState, detector.screenState);\n } catch (e: any) {\n // No separate AbortError check: stop()/dispose() bump `_gen` *before*\n // calling `ac.abort()` (see stop() below), so a stop()-triggered\n // AbortError always has a stale `gen` here and is already caught by\n // the check above. The signal is private and never exposed, so an\n // AbortError from any other source cannot occur.\n if (gen !== this._gen) return;\n // Tear down the failed session's listener/controller (mirrors stop()):\n // without this, the failed `_detector` stays wired to `_onChange` and a\n // later `change` on that same (never-truly-started) instance would\n // still write state, contradicting the error just recorded.\n this._detector?.removeEventListener(\"change\", this._onChange);\n this._detector = null;\n this._abortController = null;\n this._setError({ error: e }, e?.name);\n }\n }\n\n /** Stop the current session (if any) and detach its listener. Safe to call when not started. */\n stop(): void {\n this._gen++;\n this._abortController?.abort();\n this._abortController = null;\n if (this._detector) {\n this._detector.removeEventListener(\"change\", this._onChange);\n this._detector = null;\n }\n }\n\n private _onChange = (event: Event): void => {\n const detector = event.target as IdleDetectorLike;\n this._setState(detector.userState, detector.screenState);\n };\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/upgrade-properties.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n// custom element の property upgrade — `static wcBindable.inputs` に宣言した入力のうち、\n// 要素が upgrade される前に代入された own データプロパティを取り込み直す。\n//\n// なぜ必要か:\n// 未定義タグの要素は素の HTMLElement なので、`el.url = \"...\"` は own データプロパティを作る。\n// upgrade 後にクラスの accessor が prototype へ入っても own プロパティが優先されるため、\n// setter は二度と呼ばれず、値は要素へ届かないまま消える(エラーも警告も出ない)。\n// 常にプロパティ代入を行う framework(Angular の `[prop]`、Lit の `.prop=`、\n// Solid の `prop:`、Vue の `.prop` 修飾子)× 遅延定義(autoloader / CDN / code-split)で\n// 常態的に起きる。docs/architecture-hardening/13-framework-adapter-binding-constraints.md §1.2。\n//\n// 安全側の判定:\n// own プロパティがあっても、prototype チェーンに accessor が無ければ「シャドウ」ではなく\n// その own プロパティ自体が正規の格納先なので触らない(public class field を壊さない)。\n//\n// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/upgrade-properties.ts), then run\n// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies\n// (packages/<pkg>/src/protocol/upgradeProperties.ts). Those copies are generated — do not edit them.\nimport { IWcBindable } from \"./wcBindable.js\";\n\nfunction hasAccessorOnPrototype(target: object, name: string): boolean {\n let proto = Object.getPrototypeOf(target);\n while (proto !== null) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, name);\n if (descriptor !== undefined) {\n return typeof descriptor.get === \"function\" || typeof descriptor.set === \"function\";\n }\n proto = Object.getPrototypeOf(proto);\n }\n return false;\n}\n\n/**\n * `connectedCallback` の先頭で呼ぶ。宣言済み input のうち upgrade 前の代入で\n * accessor をシャドウしている own プロパティを、delete → 再代入で setter に通し直す。\n *\n * - 冪等: 再代入は accessor を通るので own プロパティは残らず、2 回目以降は no-op。\n * - 宣言に `inputs` が無い要素、`wcBindable` を持たない要素では何もしない。\n * - 値の意味は変えない。今まで捨てられていた代入が届くようになる一方向の変化。\n */\nexport function upgradeProperties(element: object): void {\n const declaration = (element as { constructor?: { wcBindable?: IWcBindable } }).constructor?.wcBindable;\n const inputs = declaration?.inputs;\n if (inputs === undefined) return;\n for (const input of inputs) {\n const name = input.name;\n if (!Object.prototype.hasOwnProperty.call(element, name)) continue;\n if (!hasAccessorOnPrototype(element, name)) continue;\n const record = element as Record<string, unknown>;\n const value = record[name];\n delete record[name];\n record[name] = value;\n }\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /protocol/input-attribute.ts by scripts/sync-protocol-types.mjs.\n// Run `node scripts/sync-protocol-types.mjs` after editing the source.\n// ===========================================================================\n\n// 属性へ反映する wc-bindable 入力の producer 側(SPEC-extensions § Producer guidance for inputs の P1〜P3)。\n// 入力の setter は属性をこの 2 関数で書く。それで次が揃う:\n// - `undefined` は「値が無い」(P1): 属性を、この関数で最初に書く前の状態 — マークアップに書かれた値、\n// 無ければ属性なし(= その入力の文書化した既定値)— へ戻す。applier プロファイルを宣言する binder は\n// 値の後の `undefined` を書き(A2)、React 19 も書き、直接の代入でも届く。\n// - `null` はクリア(P2): 属性なし、つまり文書化した既定値。\n// - どちらも文字列 \"undefined\" / \"null\" として属性に入らない。\n//\n// 「最初に書く前」は、その最初の書き込みのときに読む(遅延)。upgrade 前に代入されたプロパティは\n// connectedCallback の upgradeProperties() が通し直すので、そのときにはパーサが書いた属性が揃っている。\n// 要素自身が setter を通さずに書いた属性は、最初の書き込みより前なら「最初の状態」に含まれる。\n//\n// SINGLE SOURCE OF TRUTH: edit only this file (/protocol/input-attribute.ts), then run\n// `node scripts/sync-protocol-types.mjs` to regenerate the per-package copies\n// (packages/<pkg>/src/protocol/inputAttribute.ts). Those copies are generated — do not edit them.\n\nconst initialAttributes = new WeakMap<Element, Map<string, string | null>>();\n\n/** The attribute as it stood before the first write through these helpers. */\nfunction initialAttribute(el: Element, name: string): string | null {\n let byName = initialAttributes.get(el);\n if (byName === undefined) {\n byName = new Map();\n initialAttributes.set(el, byName);\n }\n if (!byName.has(name)) byName.set(name, el.getAttribute(name));\n return byName.get(name) as string | null;\n}\n\nfunction writeAttribute(el: Element, name: string, value: string | null): void {\n if (value === null) el.removeAttribute(name);\n else el.setAttribute(name, value);\n}\n\n/**\n * A value attribute. `value` is written as `String(value)`; `null` removes the attribute;\n * `undefined` restores the attribute the element started with.\n */\nexport function reflectAttribute(el: Element, name: string, value: unknown): void {\n const initial = initialAttribute(el, name);\n writeAttribute(el, name, value === undefined ? initial : value === null ? null : String(value));\n}\n\n/**\n * A boolean attribute, present while `value` is truthy (`null` and `false` remove it);\n * `undefined` restores the attribute the element started with.\n */\nexport function reflectBooleanAttribute(el: Element, name: string, value: unknown): void {\n const initial = initialAttribute(el, name);\n writeAttribute(el, name, value === undefined ? initial : value ? \"\" : null);\n}\n","import { IdleScreenState, IdleUserState, IWcBindable } from \"../types.js\";\nimport { IdleCore } from \"../core/IdleCore.js\";\nimport { WcsIoErrorInfo } from \"../core/platformCapability.js\";\nimport { upgradeProperties } from \"../protocol/upgradeProperties.js\";\nimport { reflectAttribute } from \"../protocol/inputAttribute.js\";\n\n/**\n * `<wcs-idle>` — declarative Idle Detection API primitive.\n *\n * Does NOT auto-start on connect (docs/idle-detection-tag-design.md §6): the\n * permission gate sits in front of `start()`, so an unconditional\n * connectedCallback start would be guaranteed to fail before permission is\n * granted. Callers drive `requestPermission()` → `start()` explicitly, e.g.\n * from a click handler.\n *\n * Compose with `<wcs-permission name=\"idle-detection\">` for prompt/granted/\n * denied status — this Shell only exposes the actual idle state.\n */\nexport class WcsIdle extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n\n static wcBindable: IWcBindable = {\n ...IdleCore.wcBindable,\n inputs: [\n { name: \"threshold\", attribute: \"threshold\" },\n ],\n // Core の commands をそのまま継承(単一情報源)。\n commands: IdleCore.wcBindable.commands,\n };\n\n private _core: IdleCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new IdleCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-idle:change\": (d) => ({ active: d.userState === \"active\" }),\n \"wcs-idle:error\": (d) => ({ error: d != null }),\n });\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 (docs/custom-state-reflection-design.md §3.1/§3.4): attachInternals\n // is absent 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 /**\n * Minimum idle time (ms) before `userState` becomes `\"idle\"`. This value is\n * read only at `start()` time — there is no `attributeChangedCallback`\n * (deliberately not declared in `observedAttributes`, mirroring\n * `<wcs-gyroscope>`'s `frequency`), so mutating the attribute/property on an\n * already-running session has no effect until the caller `stop()`s and\n * `start()`s again.\n */\n get threshold(): number {\n const attr = this.getAttribute(\"threshold\");\n // An absent, empty, or whitespace-only attribute all mean \"no value\n // supplied\" and must fall back to the default — without this check,\n // `Number(\"\")`/`Number(\" \")` coerce to `0` (finite), which would slip\n // past the `Number.isFinite` fallback below and silently return `0`\n // instead of the documented 60000ms default.\n if (attr === null || attr.trim() === \"\") return 60000;\n const n = Number(attr);\n return Number.isFinite(n) ? n : 60000;\n }\n\n // Never lets setAttribute stringify null / undefined: `null` removes the\n // attribute (the 60000ms default), `undefined` restores the attribute the\n // element started with (wc-bindable producer guidance P1; React 19 and a\n // direct assignment deliver it, @wcstack/state does not).\n set threshold(value: number | null | undefined) {\n reflectAttribute(this, \"threshold\", value);\n }\n\n // --- Core delegated getters ---\n\n get userState(): IdleUserState | null {\n return this._core.userState;\n }\n\n get screenState(): IdleScreenState | null {\n return this._core.screenState;\n }\n\n get active(): boolean {\n return this._core.active;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get errorInfo(): WcsIoErrorInfo | null {\n return this._core.errorInfo;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Commands (delegated to Core) ---\n\n requestPermission(): Promise<\"granted\" | \"denied\"> {\n return this._core.requestPermission();\n }\n\n start(threshold?: number): Promise<void> {\n return this._core.start(threshold ?? this.threshold);\n }\n\n stop(): void {\n this._core.stop();\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n // upgrade 前に代入された input を取り込み直す(doc 13 §1.2 / Phase A1)\n upgradeProperties(this);\n this.style.display = \"none\";\n // No auto-start (§6) — observe() is a synchronous no-op, kept only for\n // API uniformity with other IO nodes' lifecycle.\n this._connectedCallbackPromise = this._core.observe();\n }\n\n disconnectedCallback(): void {\n this._core.dispose();\n }\n}\n","import { WcsIdle } from \"./components/Idle.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.idle)) {\n registry.define(config.tagNames.idle, WcsIdle);\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapIdle(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,IAAI,EAAE,UAAU;AACjB,KAAA;CACF;AAED,SAAS,UAAU,CAAI,GAAM,EAAA;AAC3B,IAAA,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;AAAE,QAAA,OAAO,GAAG;AACvD,IAAA,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;IAClB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;AAClC,QAAA,UAAU,CAAE,GAA+B,CAAC,GAAG,CAAC,CAAC;IACnD;AACA,IAAA,OAAO,GAAG;AACZ;AAEA,SAAS,SAAS,CAAI,GAAM,EAAA;AAC1B,IAAA,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;AAAE,QAAA,OAAO,GAAG;IACvD,MAAM,KAAK,GAA4B,EAAE;IACzC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAClC,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAAE,GAA+B,CAAC,GAAG,CAAC,CAAC;IAC/D;AACA,IAAA,OAAO,KAAU;AACnB;AAEA,IAAI,YAAY,GAAmB,IAAI;AAEhC,MAAM,MAAM,GAAY,OAAkB;SAE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3
|
+
"version": "4.0.0-rc.9",
|
|
4
4
|
"description": "Declarative Idle Detection component for Web Components. Framework-agnostic IdleDetector wrapper via wc-bindable-protocol.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.esm.js",
|