@wcstack/tilt 1.16.0 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.ja.md CHANGED
@@ -78,6 +78,57 @@ npm install @wcstack/tilt
78
78
 
79
79
  **無し。**
80
80
 
81
+ ## `:state()` による CSS スタイリング
82
+
83
+ `<wcs-tilt>` は 1 つの boolean 出力ステートを
84
+ [`ElementInternals` の `CustomStateSet`](https://developer.mozilla.org/ja/docs/Web/API/CustomStateSet)
85
+ に反映します。そのため `data-wcs` バインディングやクラスの手動トグルなしに、CSS の
86
+ `:state()` 疑似クラスで直接スタイリングできます。`alpha` / `beta` / `gamma` /
87
+ `permissionState` は反映されません——連続値または対応する boolean 派生 getter を持たない
88
+ enum 出力のため(guidelines §4.2)、反映されるのは `error` のみです。`absolute`
89
+ も同様に除外されます——連続的な `wcs-tilt:change` ストリームからしか導出できず、
90
+ 専用の boolean イベントを持たないためです。
91
+
92
+ | ステート | on になる条件 |
93
+ |----------|----------------|
94
+ | `error` | `wcs-tilt:error` が非 `null` の detail で発火(`null` でクリア) |
95
+
96
+ ```css
97
+ form:has(wcs-tilt:state(error)) .banner { display: block; }
98
+ ```
99
+
100
+ 属性やクラスと異なり `:state()` は要素の外部から書き込めないため、この出力ステートが
101
+ 入力と混同される心配がありません。
102
+
103
+ **対応ブラウザ**(新構文 `:state(x)`): Chrome/Edge 125+、Safari 17.4+、Firefox 126+。
104
+ 非対応の環境ではステートが一切 set されないだけです — `:state()` セレクタがマッチしなく
105
+ なりますが、`<wcs-tilt>` 自体は通常どおり動作し続けます(graceful degradation・never-throw)。
106
+
107
+ **SSR:** `:state()` は HTML にシリアライズできないため、サーバーレンダリングされた
108
+ マークアップの初期ペイントにはこれらのステートは乗りません(`@wcstack/server` は無改変)。
109
+ ハイドレーション前の見た目を制御したい場合は、代わりに `wcs-tilt:not(:defined)` と組み合わせてください。
110
+
111
+ ### デバッグ
112
+
113
+ カスタムステートは DevTools の Elements パネルには表示されず、`attachInternals()`
114
+ は同一要素に 2 回呼べないため、コンソールから直接覗く手段がありません。そのための
115
+ デバッグ専用の補助を 2 つ用意しています:
116
+
117
+ - `el.debugStates` — 現在 on になっているステート名の**スナップショット**配列
118
+ (例: `["error"]`)。`wc-bindable` の一部ではなく(バインド対象ではない)、
119
+ 形状も契約として保証されません — デバッグ用途にのみ使ってください。
120
+ - `debug-states` 属性(opt-in・既定 OFF)は、ステート変化を要素の
121
+ `data-wcs-state-error` 属性にミラーします。Elements パネルを開いておけば、
122
+ トグルのたびにハイライトされます:
123
+
124
+ ```html
125
+ <wcs-tilt debug-states></wcs-tilt>
126
+ ```
127
+
128
+ **CSS は `data-wcs-state-*` ではなく `:state()` に書いてください。** ミラーされた
129
+ 属性は、DevTools を開いた状態でステート変化を可視化するためだけのものであり、
130
+ スタイリング用の正式なフックではありません。
131
+
81
132
  ## 注意・制限
82
133
 
83
134
  - **connect時に自動startしません。**
package/README.md CHANGED
@@ -79,6 +79,60 @@ Every path referenced by `data-wcs` (`tiltBeta`, `tiltGamma`, `tiltTransform`, `
79
79
 
80
80
  **None.**
81
81
 
82
+ ## CSS styling with `:state()`
83
+
84
+ `<wcs-tilt>` reflects one boolean output state onto its
85
+ [`ElementInternals` `CustomStateSet`](https://developer.mozilla.org/en-US/docs/Web/API/CustomStateSet),
86
+ so you can style it directly from CSS with the `:state()` pseudo-class — no
87
+ `data-wcs` binding or extra class toggling required. `alpha` / `beta` /
88
+ `gamma` / `permissionState` are not reflected: they are continuous-valued or
89
+ enum outputs with no matching derived boolean getter (guidelines §4.2), so
90
+ `error` is the only reflected state. `absolute` is likewise excluded — it can
91
+ only be derived from the continuous `wcs-tilt:change` stream, not from a
92
+ dedicated boolean event.
93
+
94
+ | State | On when |
95
+ |-------|---------|
96
+ | `error` | `wcs-tilt:error` fires with a non-`null` detail (cleared on `null`) |
97
+
98
+ ```css
99
+ form:has(wcs-tilt:state(error)) .banner { display: block; }
100
+ ```
101
+
102
+ Unlike attributes or classes, `:state()` cannot be written from outside the
103
+ element, so there is no risk of confusing this output state with an input.
104
+
105
+ **Browser support** (`:state(x)` syntax): Chrome/Edge 125+, Safari 17.4+,
106
+ Firefox 126+. In older browsers the states are simply never set — `:state()`
107
+ selectors never match, but `<wcs-tilt>` itself keeps working normally
108
+ (graceful degradation, never-throw).
109
+
110
+ **SSR**: `:state()` cannot be serialized into HTML, so server-rendered markup
111
+ never carries these states on first paint (`@wcstack/server` is unaffected).
112
+ If you need to style the pre-hydration gap, pair your rule with
113
+ `wcs-tilt:not(:defined)` instead.
114
+
115
+ ### Debugging
116
+
117
+ Custom states are invisible in DevTools' Elements panel and `attachInternals()`
118
+ cannot be called twice, so there is no console way to inspect them directly.
119
+ Two debug-only aids are provided for that:
120
+
121
+ - `el.debugStates` — a **snapshot** array of the currently-on state names
122
+ (e.g. `["error"]`). It is not part of `wc-bindable` (not a bind target)
123
+ and its shape is not a guaranteed contract — use it for debugging only.
124
+ - The `debug-states` attribute (opt-in, default off) mirrors state changes
125
+ onto a `data-wcs-state-error` attribute on the element, so the Elements
126
+ panel highlights it as it toggles:
127
+
128
+ ```html
129
+ <wcs-tilt debug-states></wcs-tilt>
130
+ ```
131
+
132
+ **Write your CSS against `:state()`, not `data-wcs-state-*`.** The mirrored
133
+ attribute exists purely to make state changes visible while debugging with
134
+ DevTools open; it is not a supported styling hook.
135
+
82
136
  ## Notes & limitations
83
137
 
84
138
  - **Does not auto-start on connect.**
package/dist/index.d.ts CHANGED
@@ -141,7 +141,11 @@ declare class WcsTilt extends HTMLElement {
141
141
  static wcBindable: IWcBindable;
142
142
  private _core;
143
143
  private _connectedCallbackPromise;
144
+ private _internals;
144
145
  constructor();
146
+ get debugStates(): string[];
147
+ private _initInternals;
148
+ private _wireStates;
145
149
  get alpha(): number | null;
146
150
  get beta(): number | null;
147
151
  get gamma(): number | null;
package/dist/index.esm.js CHANGED
@@ -242,9 +242,62 @@ class WcsTilt extends HTMLElement {
242
242
  };
243
243
  _core;
244
244
  _connectedCallbackPromise = Promise.resolve();
245
+ _internals = null;
245
246
  constructor() {
246
247
  super();
247
248
  this._core = new TiltCore(this);
249
+ this._internals = this._initInternals();
250
+ this._wireStates({
251
+ "wcs-tilt:error": (d) => ({ error: d != null }),
252
+ });
253
+ }
254
+ // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of
255
+ // wc-bindable (not a bind target); see README "CSS styling with :state()".
256
+ // MUST NOT return the live CustomStateSet (that would let callers write
257
+ // states from outside, defeating the point of :state() being read-only).
258
+ get debugStates() {
259
+ return this._internals ? [...this._internals.states] : [];
260
+ }
261
+ _initInternals() {
262
+ // never-throw (async-io-node-guidelines.md §3.6): attachInternals is absent
263
+ // in happy-dom / older environments, and pre-125 Chromium rejects
264
+ // non-dashed state names from states.add() (probed and discarded here).
265
+ // Either case silently disables reflection — the component still works,
266
+ // it just doesn't expose :state() selectors.
267
+ try {
268
+ if (typeof this.attachInternals !== "function")
269
+ return null;
270
+ const internals = this.attachInternals();
271
+ internals.states.add("wcs-probe");
272
+ internals.states.delete("wcs-probe");
273
+ return internals;
274
+ }
275
+ catch {
276
+ return null;
277
+ }
278
+ }
279
+ _wireStates(map) {
280
+ if (this._internals === null)
281
+ return;
282
+ const states = this._internals.states;
283
+ for (const [event, toStates] of Object.entries(map)) {
284
+ this.addEventListener(event, (e) => {
285
+ const debug = this.hasAttribute("debug-states");
286
+ for (const [name, on] of Object.entries(toStates(e.detail))) {
287
+ try {
288
+ if (on) {
289
+ states.add(name);
290
+ }
291
+ else {
292
+ states.delete(name);
293
+ }
294
+ }
295
+ catch { /* never-throw */ }
296
+ if (debug)
297
+ this.toggleAttribute(`data-wcs-state-${name}`, on);
298
+ }
299
+ });
300
+ }
248
301
  }
249
302
  // --- Core delegated getters ---
250
303
  get alpha() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/config.ts","../src/core/TiltCore.ts","../src/components/Tilt.ts","../src/registerComponents.ts","../src/bootstrapTilt.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n tilt: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n tilt: \"wcs-tilt\",\n },\n};\n\nfunction deepFreeze<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n Object.freeze(obj);\n for (const key of Object.keys(obj)) {\n deepFreeze((obj as Record<string, unknown>)[key]);\n }\n return obj;\n}\n\nfunction deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n const clone: Record<string, unknown> = {};\n for (const key of Object.keys(obj)) {\n clone[key] = deepClone((obj as Record<string, unknown>)[key]);\n }\n return clone as T;\n}\n\nlet frozenConfig: IConfig | null = null;\n\nexport const config: IConfig = _config as IConfig;\n\nexport function getConfig(): IConfig {\n if (!frozenConfig) {\n frozenConfig = deepFreeze(deepClone(_config));\n }\n return frozenConfig;\n}\n\nexport function setConfig(partialConfig: IWritableConfig): void {\n if (partialConfig.tagNames) {\n Object.assign(_config.tagNames, partialConfig.tagNames);\n }\n frozenConfig = null;\n}\n","import { IWcBindable, TiltPermissionState } from \"../types.js\";\n\ninterface DeviceOrientationEventCtor {\n requestPermission?: () => Promise<\"granted\" | \"denied\">;\n}\n\ninterface WcsTiltSnapshot {\n alpha: number | null;\n beta: number | null;\n gamma: number | null;\n absolute: boolean | null;\n}\n\nconst UNSUPPORTED_SNAPSHOT: WcsTiltSnapshot = Object.freeze({\n alpha: null,\n beta: null,\n gamma: null,\n absolute: null,\n});\n\n/**\n * Headless Device Orientation primitive. A thin, framework-agnostic wrapper\n * around `window`'s `deviceorientation` event exposed through the wc-bindable\n * protocol.\n *\n * The batch2 sibling of `@wcstack/idle` (docs/device-orientation-tag-design.md).\n * Unlike Idle Detection, there is no matching Permissions API entry for this\n * feature (`navigator.permissions.query` has no \"device-orientation\" name), so\n * `permissionState` must be tracked **locally** rather than composed with\n * `<wcs-permission>` — the defining asymmetry within batch2.\n *\n * No `_gen` generation guard: subscribing/unsubscribing to `deviceorientation`\n * (start/stop) is fully synchronous, so that path never needs one. This node\n * does have an async probe — `requestPermission()` awaits the static\n * `DeviceOrientationEvent.requestPermission()` — but its post-await write is\n * a benign `permissionState`/`error` value set + dispatch with no\n * subscription/resource management to race, so `_gen` is unneeded there too\n * (docs/device-orientation-tag-design.md §4, corrected after an earlier\n * revision mistakenly reused `@wcstack/network`'s \"no async probe at all\"\n * rationale).\n */\nexport class TiltCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"alpha\", event: \"wcs-tilt:change\", getter: (e: Event) => (e as CustomEvent).detail.alpha },\n { name: \"beta\", event: \"wcs-tilt:change\", getter: (e: Event) => (e as CustomEvent).detail.beta },\n { name: \"gamma\", event: \"wcs-tilt:change\", getter: (e: Event) => (e as CustomEvent).detail.gamma },\n { name: \"absolute\", event: \"wcs-tilt:change\", getter: (e: Event) => (e as CustomEvent).detail.absolute },\n { name: \"permissionState\", event: \"wcs-tilt:permission-changed\" },\n // never-throw (§3.6): requestPermission() failures land here instead of\n // rejecting/throwing. Mirrors idle (same batch2) and the accelerometer\n // family (batch5) — see docs/io-node-batch-implementation-plan.md.\n { name: \"error\", event: \"wcs-tilt:error\" },\n ],\n commands: [\n { name: \"requestPermission\", async: true },\n { name: \"start\" },\n { name: \"stop\" },\n ],\n };\n\n private _target: EventTarget;\n private _snapshot: WcsTiltSnapshot = UNSUPPORTED_SNAPSHOT;\n private _permissionState: TiltPermissionState = \"unknown\";\n private _error: any = null;\n private _subscribed = false;\n\n // SSR (§3.8): never auto-starts on connect, so there is no probe to await —\n // readiness is always immediate.\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 alpha(): number | null {\n return this._snapshot.alpha;\n }\n\n get beta(): number | null {\n return this._snapshot.beta;\n }\n\n get gamma(): number | null {\n return this._snapshot.gamma;\n }\n\n get absolute(): boolean | null {\n return this._snapshot.absolute;\n }\n\n get permissionState(): TiltPermissionState {\n return this._permissionState;\n }\n\n get error(): any {\n return this._error;\n }\n\n // Lifecycle (§3.5). observe() is a synchronous no-op: like `<wcs-idle>`,\n // this Core deliberately does NOT auto-start on connect (§6) on platforms\n // that gate deviceorientation behind requestPermission().\n observe(): Promise<void> {\n return this._ready;\n }\n\n dispose(): void {\n this.stop();\n }\n\n private _deviceOrientationEventCtor(): DeviceOrientationEventCtor | undefined {\n const g = globalThis as any;\n return typeof g.DeviceOrientationEvent !== \"undefined\" ? g.DeviceOrientationEvent : undefined;\n }\n\n private _setPermissionState(state: TiltPermissionState): void {\n if (this._permissionState === state) return;\n this._permissionState = state;\n this._target.dispatchEvent(new CustomEvent(\"wcs-tilt:permission-changed\", {\n detail: state,\n bubbles: true,\n }));\n }\n\n private _setError(error: any): void {\n if (this._error === error) return;\n this._error = error;\n this._target.dispatchEvent(new CustomEvent(\"wcs-tilt:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n /**\n * Wraps iOS 13+ Safari's static, gesture-gated\n * `DeviceOrientationEvent.requestPermission()`. On platforms without this\n * gate (Android Chrome, desktop) there is nothing to ask, so this resolves\n * to `\"granted\"` immediately without querying anything — callers can write\n * one `requestPermission()` → `start()` flow that works everywhere\n * (docs/device-orientation-tag-design.md §3).\n *\n * never-throw (§3.6): a gesture-context rejection resolves to `\"denied\"`\n * and the raw error lands in `error` instead of propagating. Mirrors\n * `<wcs-idle>`'s `requestPermission()` (docs/idle-detection-tag-design.md\n * §4.1) — any settled (non-throwing) outcome supersedes a stale `error`\n * from an earlier attempt.\n */\n async requestPermission(): Promise<TiltPermissionState> {\n const Ctor = this._deviceOrientationEventCtor();\n if (typeof Ctor?.requestPermission !== \"function\") {\n this._setError(null);\n this._setPermissionState(\"granted\");\n return \"granted\";\n }\n try {\n const result = await Ctor.requestPermission();\n const state: TiltPermissionState = result === \"granted\" ? \"granted\" : \"denied\";\n this._setError(null);\n this._setPermissionState(state);\n return state;\n } catch (e) {\n // never-throw: a gesture-context rejection resolves to \"denied\".\n this._setError({ error: e });\n this._setPermissionState(\"denied\");\n return \"denied\";\n }\n }\n\n /** Subscribe to `deviceorientation`. Idempotent — a second start() while already subscribed is a no-op. */\n start(): void {\n if (this._subscribed) return;\n this._subscribed = true;\n globalThis.window?.addEventListener(\"deviceorientation\", this._onOrientation as EventListener);\n }\n\n /** Unsubscribe from `deviceorientation`. Safe to call when not started. */\n stop(): void {\n if (!this._subscribed) return;\n this._subscribed = false;\n globalThis.window?.removeEventListener(\"deviceorientation\", this._onOrientation as EventListener);\n }\n\n private _onOrientation = (event: DeviceOrientationEvent): void => {\n this._apply({\n alpha: event.alpha,\n beta: event.beta,\n gamma: event.gamma,\n absolute: event.absolute,\n });\n };\n\n // Same-value guard (§3.3 MUST).\n private _apply(next: WcsTiltSnapshot): void {\n const prev = this._snapshot;\n if (\n prev.alpha === next.alpha &&\n prev.beta === next.beta &&\n prev.gamma === next.gamma &&\n prev.absolute === next.absolute\n ) {\n return;\n }\n this._snapshot = next;\n this._target.dispatchEvent(new CustomEvent(\"wcs-tilt:change\", {\n detail: next,\n bubbles: true,\n }));\n }\n}\n","import { IWcBindable, TiltPermissionState } from \"../types.js\";\nimport { TiltCore } from \"../core/TiltCore.js\";\n\n/**\n * `<wcs-tilt>` — declarative Device Orientation API monitor.\n *\n * Named `tilt` (not `orientation`/`device-orientation`) to avoid colliding\n * with `<wcs-screen-orientation>` (docs/device-orientation-tag-design.md §9).\n *\n * Does NOT auto-start on connect, mirroring `<wcs-idle>`: on iOS, subscribing\n * before permission is granted silently receives no events. Callers drive\n * `requestPermission()` → `start()` explicitly.\n */\nexport class WcsTilt extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n\n static wcBindable: IWcBindable = {\n ...TiltCore.wcBindable,\n inputs: [],\n // Core の commands をそのまま継承(単一情報源)。\n commands: TiltCore.wcBindable.commands,\n };\n\n private _core: TiltCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n\n constructor() {\n super();\n this._core = new TiltCore(this);\n }\n\n // --- Core delegated getters ---\n\n get alpha(): number | null {\n return this._core.alpha;\n }\n\n get beta(): number | null {\n return this._core.beta;\n }\n\n get gamma(): number | null {\n return this._core.gamma;\n }\n\n get absolute(): boolean | null {\n return this._core.absolute;\n }\n\n get permissionState(): TiltPermissionState {\n return this._core.permissionState;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Commands (delegated to Core) ---\n\n requestPermission(): Promise<TiltPermissionState> {\n return this._core.requestPermission();\n }\n\n start(): void {\n this._core.start();\n }\n\n stop(): void {\n this._core.stop();\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n this.style.display = \"none\";\n this._connectedCallbackPromise = this._core.observe();\n }\n\n disconnectedCallback(): void {\n this._core.dispose();\n }\n}\n","import { WcsTilt } from \"./components/Tilt.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.tilt)) {\n customElements.define(config.tagNames.tilt, WcsTilt);\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapTilt(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n"],"names":[],"mappings":"AAQA,MAAM,OAAO,GAAoB;AAC/B,IAAA,QAAQ,EAAE;AACR,QAAA,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,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AI,EAAE,OAAO,CAAC;IACtD;AACF;;ACHM,SAAU,aAAa,CAAC,UAA4B,EAAA;IACxD,IAAI,UAAU,EAAE;QACd,SAAS,CAAC,UAAU,CAAC;IACvB;AACA,IAAA,kBAAkB,EAAE;AACtB;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../src/config.ts","../src/core/TiltCore.ts","../src/components/Tilt.ts","../src/registerComponents.ts","../src/bootstrapTilt.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n tilt: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n tilt: \"wcs-tilt\",\n },\n};\n\nfunction deepFreeze<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n Object.freeze(obj);\n for (const key of Object.keys(obj)) {\n deepFreeze((obj as Record<string, unknown>)[key]);\n }\n return obj;\n}\n\nfunction deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n const clone: Record<string, unknown> = {};\n for (const key of Object.keys(obj)) {\n clone[key] = deepClone((obj as Record<string, unknown>)[key]);\n }\n return clone as T;\n}\n\nlet frozenConfig: IConfig | null = null;\n\nexport const config: IConfig = _config as IConfig;\n\nexport function getConfig(): IConfig {\n if (!frozenConfig) {\n frozenConfig = deepFreeze(deepClone(_config));\n }\n return frozenConfig;\n}\n\nexport function setConfig(partialConfig: IWritableConfig): void {\n if (partialConfig.tagNames) {\n Object.assign(_config.tagNames, partialConfig.tagNames);\n }\n frozenConfig = null;\n}\n","import { IWcBindable, TiltPermissionState } from \"../types.js\";\n\ninterface DeviceOrientationEventCtor {\n requestPermission?: () => Promise<\"granted\" | \"denied\">;\n}\n\ninterface WcsTiltSnapshot {\n alpha: number | null;\n beta: number | null;\n gamma: number | null;\n absolute: boolean | null;\n}\n\nconst UNSUPPORTED_SNAPSHOT: WcsTiltSnapshot = Object.freeze({\n alpha: null,\n beta: null,\n gamma: null,\n absolute: null,\n});\n\n/**\n * Headless Device Orientation primitive. A thin, framework-agnostic wrapper\n * around `window`'s `deviceorientation` event exposed through the wc-bindable\n * protocol.\n *\n * The batch2 sibling of `@wcstack/idle` (docs/device-orientation-tag-design.md).\n * Unlike Idle Detection, there is no matching Permissions API entry for this\n * feature (`navigator.permissions.query` has no \"device-orientation\" name), so\n * `permissionState` must be tracked **locally** rather than composed with\n * `<wcs-permission>` — the defining asymmetry within batch2.\n *\n * No `_gen` generation guard: subscribing/unsubscribing to `deviceorientation`\n * (start/stop) is fully synchronous, so that path never needs one. This node\n * does have an async probe — `requestPermission()` awaits the static\n * `DeviceOrientationEvent.requestPermission()` — but its post-await write is\n * a benign `permissionState`/`error` value set + dispatch with no\n * subscription/resource management to race, so `_gen` is unneeded there too\n * (docs/device-orientation-tag-design.md §4, corrected after an earlier\n * revision mistakenly reused `@wcstack/network`'s \"no async probe at all\"\n * rationale).\n */\nexport class TiltCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"alpha\", event: \"wcs-tilt:change\", getter: (e: Event) => (e as CustomEvent).detail.alpha },\n { name: \"beta\", event: \"wcs-tilt:change\", getter: (e: Event) => (e as CustomEvent).detail.beta },\n { name: \"gamma\", event: \"wcs-tilt:change\", getter: (e: Event) => (e as CustomEvent).detail.gamma },\n { name: \"absolute\", event: \"wcs-tilt:change\", getter: (e: Event) => (e as CustomEvent).detail.absolute },\n { name: \"permissionState\", event: \"wcs-tilt:permission-changed\" },\n // never-throw (§3.6): requestPermission() failures land here instead of\n // rejecting/throwing. Mirrors idle (same batch2) and the accelerometer\n // family (batch5) — see docs/io-node-batch-implementation-plan.md.\n { name: \"error\", event: \"wcs-tilt:error\" },\n ],\n commands: [\n { name: \"requestPermission\", async: true },\n { name: \"start\" },\n { name: \"stop\" },\n ],\n };\n\n private _target: EventTarget;\n private _snapshot: WcsTiltSnapshot = UNSUPPORTED_SNAPSHOT;\n private _permissionState: TiltPermissionState = \"unknown\";\n private _error: any = null;\n private _subscribed = false;\n\n // SSR (§3.8): never auto-starts on connect, so there is no probe to await —\n // readiness is always immediate.\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 alpha(): number | null {\n return this._snapshot.alpha;\n }\n\n get beta(): number | null {\n return this._snapshot.beta;\n }\n\n get gamma(): number | null {\n return this._snapshot.gamma;\n }\n\n get absolute(): boolean | null {\n return this._snapshot.absolute;\n }\n\n get permissionState(): TiltPermissionState {\n return this._permissionState;\n }\n\n get error(): any {\n return this._error;\n }\n\n // Lifecycle (§3.5). observe() is a synchronous no-op: like `<wcs-idle>`,\n // this Core deliberately does NOT auto-start on connect (§6) on platforms\n // that gate deviceorientation behind requestPermission().\n observe(): Promise<void> {\n return this._ready;\n }\n\n dispose(): void {\n this.stop();\n }\n\n private _deviceOrientationEventCtor(): DeviceOrientationEventCtor | undefined {\n const g = globalThis as any;\n return typeof g.DeviceOrientationEvent !== \"undefined\" ? g.DeviceOrientationEvent : undefined;\n }\n\n private _setPermissionState(state: TiltPermissionState): void {\n if (this._permissionState === state) return;\n this._permissionState = state;\n this._target.dispatchEvent(new CustomEvent(\"wcs-tilt:permission-changed\", {\n detail: state,\n bubbles: true,\n }));\n }\n\n private _setError(error: any): void {\n if (this._error === error) return;\n this._error = error;\n this._target.dispatchEvent(new CustomEvent(\"wcs-tilt:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n /**\n * Wraps iOS 13+ Safari's static, gesture-gated\n * `DeviceOrientationEvent.requestPermission()`. On platforms without this\n * gate (Android Chrome, desktop) there is nothing to ask, so this resolves\n * to `\"granted\"` immediately without querying anything — callers can write\n * one `requestPermission()` → `start()` flow that works everywhere\n * (docs/device-orientation-tag-design.md §3).\n *\n * never-throw (§3.6): a gesture-context rejection resolves to `\"denied\"`\n * and the raw error lands in `error` instead of propagating. Mirrors\n * `<wcs-idle>`'s `requestPermission()` (docs/idle-detection-tag-design.md\n * §4.1) — any settled (non-throwing) outcome supersedes a stale `error`\n * from an earlier attempt.\n */\n async requestPermission(): Promise<TiltPermissionState> {\n const Ctor = this._deviceOrientationEventCtor();\n if (typeof Ctor?.requestPermission !== \"function\") {\n this._setError(null);\n this._setPermissionState(\"granted\");\n return \"granted\";\n }\n try {\n const result = await Ctor.requestPermission();\n const state: TiltPermissionState = result === \"granted\" ? \"granted\" : \"denied\";\n this._setError(null);\n this._setPermissionState(state);\n return state;\n } catch (e) {\n // never-throw: a gesture-context rejection resolves to \"denied\".\n this._setError({ error: e });\n this._setPermissionState(\"denied\");\n return \"denied\";\n }\n }\n\n /** Subscribe to `deviceorientation`. Idempotent — a second start() while already subscribed is a no-op. */\n start(): void {\n if (this._subscribed) return;\n this._subscribed = true;\n globalThis.window?.addEventListener(\"deviceorientation\", this._onOrientation as EventListener);\n }\n\n /** Unsubscribe from `deviceorientation`. Safe to call when not started. */\n stop(): void {\n if (!this._subscribed) return;\n this._subscribed = false;\n globalThis.window?.removeEventListener(\"deviceorientation\", this._onOrientation as EventListener);\n }\n\n private _onOrientation = (event: DeviceOrientationEvent): void => {\n this._apply({\n alpha: event.alpha,\n beta: event.beta,\n gamma: event.gamma,\n absolute: event.absolute,\n });\n };\n\n // Same-value guard (§3.3 MUST).\n private _apply(next: WcsTiltSnapshot): void {\n const prev = this._snapshot;\n if (\n prev.alpha === next.alpha &&\n prev.beta === next.beta &&\n prev.gamma === next.gamma &&\n prev.absolute === next.absolute\n ) {\n return;\n }\n this._snapshot = next;\n this._target.dispatchEvent(new CustomEvent(\"wcs-tilt:change\", {\n detail: next,\n bubbles: true,\n }));\n }\n}\n","import { IWcBindable, TiltPermissionState } from \"../types.js\";\nimport { TiltCore } from \"../core/TiltCore.js\";\n\n/**\n * `<wcs-tilt>` — declarative Device Orientation API monitor.\n *\n * Named `tilt` (not `orientation`/`device-orientation`) to avoid colliding\n * with `<wcs-screen-orientation>` (docs/device-orientation-tag-design.md §9).\n *\n * Does NOT auto-start on connect, mirroring `<wcs-idle>`: on iOS, subscribing\n * before permission is granted silently receives no events. Callers drive\n * `requestPermission()` → `start()` explicitly.\n */\nexport class WcsTilt extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n\n static wcBindable: IWcBindable = {\n ...TiltCore.wcBindable,\n inputs: [],\n // Core の commands をそのまま継承(単一情報源)。\n commands: TiltCore.wcBindable.commands,\n };\n\n private _core: TiltCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new TiltCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-tilt: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 (async-io-node-guidelines.md §3.6): attachInternals is absent\n // in happy-dom / older environments, and pre-125 Chromium rejects\n // non-dashed state names from states.add() (probed and discarded here).\n // Either case silently disables reflection — the component still works,\n // it just doesn't expose :state() selectors.\n try {\n if (typeof this.attachInternals !== \"function\") return null;\n const internals = this.attachInternals();\n internals.states.add(\"wcs-probe\");\n internals.states.delete(\"wcs-probe\");\n return internals;\n } catch {\n return null;\n }\n }\n\n private _wireStates(map: Record<string, (detail: any) => Record<string, boolean>>): void {\n if (this._internals === null) return;\n const states = this._internals.states;\n for (const [event, toStates] of Object.entries(map)) {\n this.addEventListener(event, (e) => {\n const debug = this.hasAttribute(\"debug-states\");\n for (const [name, on] of Object.entries(toStates((e as CustomEvent).detail))) {\n try {\n if (on) { states.add(name); } else { states.delete(name); }\n } catch { /* never-throw */ }\n if (debug) this.toggleAttribute(`data-wcs-state-${name}`, on);\n }\n });\n }\n }\n\n // --- Core delegated getters ---\n\n get alpha(): number | null {\n return this._core.alpha;\n }\n\n get beta(): number | null {\n return this._core.beta;\n }\n\n get gamma(): number | null {\n return this._core.gamma;\n }\n\n get absolute(): boolean | null {\n return this._core.absolute;\n }\n\n get permissionState(): TiltPermissionState {\n return this._core.permissionState;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Commands (delegated to Core) ---\n\n requestPermission(): Promise<TiltPermissionState> {\n return this._core.requestPermission();\n }\n\n start(): void {\n this._core.start();\n }\n\n stop(): void {\n this._core.stop();\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n this.style.display = \"none\";\n this._connectedCallbackPromise = this._core.observe();\n }\n\n disconnectedCallback(): void {\n this._core.dispose();\n }\n}\n","import { WcsTilt } from \"./components/Tilt.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.tilt)) {\n customElements.define(config.tagNames.tilt, WcsTilt);\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapTilt(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n"],"names":[],"mappings":"AAQA,MAAM,OAAO,GAAoB;AAC/B,IAAA,QAAQ,EAAE;AACR,QAAA,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;AAC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,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;IACvD;IAEA,oBAAoB,GAAA;AAClB,QAAA,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;IACtB;;;SC/Hc,kBAAkB,GAAA;AAChC,IAAA,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QAC7C,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACtD;AACF;;ACHM,SAAU,aAAa,CAAC,UAA4B,EAAA;IACxD,IAAI,UAAU,EAAE;QACd,SAAS,CAAC,UAAU,CAAC;IACvB;AACA,IAAA,kBAAkB,EAAE;AACtB;;;;"}
@@ -1,2 +1,2 @@
1
- const t={tagNames:{tilt:"wcs-tilt"}};function e(t){if(null===t||"object"!=typeof t)return t;Object.freeze(t);for(const s of Object.keys(t))e(t[s]);return t}function s(t){if(null===t||"object"!=typeof t)return t;const e={};for(const r of Object.keys(t))e[r]=s(t[r]);return e}let r=null;const n=t;function a(){return r||(r=e(s(t))),r}const i=Object.freeze({alpha:null,beta:null,gamma:null,absolute:null});class o extends EventTarget{static wcBindable={protocol:"wc-bindable",version:1,properties:[{name:"alpha",event:"wcs-tilt:change",getter:t=>t.detail.alpha},{name:"beta",event:"wcs-tilt:change",getter:t=>t.detail.beta},{name:"gamma",event:"wcs-tilt:change",getter:t=>t.detail.gamma},{name:"absolute",event:"wcs-tilt:change",getter:t=>t.detail.absolute},{name:"permissionState",event:"wcs-tilt:permission-changed"},{name:"error",event:"wcs-tilt:error"}],commands:[{name:"requestPermission",async:!0},{name:"start"},{name:"stop"}]};_target;_snapshot=i;_permissionState="unknown";_error=null;_subscribed=!1;_ready=Promise.resolve();constructor(t){super(),this._target=t??this}get ready(){return this._ready}get alpha(){return this._snapshot.alpha}get beta(){return this._snapshot.beta}get gamma(){return this._snapshot.gamma}get absolute(){return this._snapshot.absolute}get permissionState(){return this._permissionState}get error(){return this._error}observe(){return this._ready}dispose(){this.stop()}_deviceOrientationEventCtor(){const t=globalThis;return void 0!==t.DeviceOrientationEvent?t.DeviceOrientationEvent:void 0}_setPermissionState(t){this._permissionState!==t&&(this._permissionState=t,this._target.dispatchEvent(new CustomEvent("wcs-tilt:permission-changed",{detail:t,bubbles:!0})))}_setError(t){this._error!==t&&(this._error=t,this._target.dispatchEvent(new CustomEvent("wcs-tilt:error",{detail:t,bubbles:!0})))}async requestPermission(){const t=this._deviceOrientationEventCtor();if("function"!=typeof t?.requestPermission)return this._setError(null),this._setPermissionState("granted"),"granted";try{const e="granted"===await t.requestPermission()?"granted":"denied";return this._setError(null),this._setPermissionState(e),e}catch(t){return this._setError({error:t}),this._setPermissionState("denied"),"denied"}}start(){this._subscribed||(this._subscribed=!0,globalThis.window?.addEventListener("deviceorientation",this._onOrientation))}stop(){this._subscribed&&(this._subscribed=!1,globalThis.window?.removeEventListener("deviceorientation",this._onOrientation))}_onOrientation=t=>{this._apply({alpha:t.alpha,beta:t.beta,gamma:t.gamma,absolute:t.absolute})};_apply(t){const e=this._snapshot;e.alpha===t.alpha&&e.beta===t.beta&&e.gamma===t.gamma&&e.absolute===t.absolute||(this._snapshot=t,this._target.dispatchEvent(new CustomEvent("wcs-tilt:change",{detail:t,bubbles:!0})))}}class c extends HTMLElement{static hasConnectedCallbackPromise=!0;static wcBindable={...o.wcBindable,inputs:[],commands:o.wcBindable.commands};_core;_connectedCallbackPromise=Promise.resolve();constructor(){super(),this._core=new o(this)}get alpha(){return this._core.alpha}get beta(){return this._core.beta}get gamma(){return this._core.gamma}get absolute(){return this._core.absolute}get permissionState(){return this._core.permissionState}get error(){return this._core.error}get connectedCallbackPromise(){return this._connectedCallbackPromise}requestPermission(){return this._core.requestPermission()}start(){this._core.start()}stop(){this._core.stop()}connectedCallback(){this.style.display="none",this._connectedCallbackPromise=this._core.observe()}disconnectedCallback(){this._core.dispose()}}function l(e){var s;e&&((s=e).tagNames&&Object.assign(t.tagNames,s.tagNames),r=null),customElements.get(n.tagNames.tilt)||customElements.define(n.tagNames.tilt,c)}export{o as TiltCore,c as WcsTilt,l as bootstrapTilt,a as getConfig};
1
+ const t={tagNames:{tilt:"wcs-tilt"}};function e(t){if(null===t||"object"!=typeof t)return t;Object.freeze(t);for(const s of Object.keys(t))e(t[s]);return t}function s(t){if(null===t||"object"!=typeof t)return t;const e={};for(const r of Object.keys(t))e[r]=s(t[r]);return e}let r=null;const n=t;function a(){return r||(r=e(s(t))),r}const i=Object.freeze({alpha:null,beta:null,gamma:null,absolute:null});class o extends EventTarget{static wcBindable={protocol:"wc-bindable",version:1,properties:[{name:"alpha",event:"wcs-tilt:change",getter:t=>t.detail.alpha},{name:"beta",event:"wcs-tilt:change",getter:t=>t.detail.beta},{name:"gamma",event:"wcs-tilt:change",getter:t=>t.detail.gamma},{name:"absolute",event:"wcs-tilt:change",getter:t=>t.detail.absolute},{name:"permissionState",event:"wcs-tilt:permission-changed"},{name:"error",event:"wcs-tilt:error"}],commands:[{name:"requestPermission",async:!0},{name:"start"},{name:"stop"}]};_target;_snapshot=i;_permissionState="unknown";_error=null;_subscribed=!1;_ready=Promise.resolve();constructor(t){super(),this._target=t??this}get ready(){return this._ready}get alpha(){return this._snapshot.alpha}get beta(){return this._snapshot.beta}get gamma(){return this._snapshot.gamma}get absolute(){return this._snapshot.absolute}get permissionState(){return this._permissionState}get error(){return this._error}observe(){return this._ready}dispose(){this.stop()}_deviceOrientationEventCtor(){const t=globalThis;return void 0!==t.DeviceOrientationEvent?t.DeviceOrientationEvent:void 0}_setPermissionState(t){this._permissionState!==t&&(this._permissionState=t,this._target.dispatchEvent(new CustomEvent("wcs-tilt:permission-changed",{detail:t,bubbles:!0})))}_setError(t){this._error!==t&&(this._error=t,this._target.dispatchEvent(new CustomEvent("wcs-tilt:error",{detail:t,bubbles:!0})))}async requestPermission(){const t=this._deviceOrientationEventCtor();if("function"!=typeof t?.requestPermission)return this._setError(null),this._setPermissionState("granted"),"granted";try{const e="granted"===await t.requestPermission()?"granted":"denied";return this._setError(null),this._setPermissionState(e),e}catch(t){return this._setError({error:t}),this._setPermissionState("denied"),"denied"}}start(){this._subscribed||(this._subscribed=!0,globalThis.window?.addEventListener("deviceorientation",this._onOrientation))}stop(){this._subscribed&&(this._subscribed=!1,globalThis.window?.removeEventListener("deviceorientation",this._onOrientation))}_onOrientation=t=>{this._apply({alpha:t.alpha,beta:t.beta,gamma:t.gamma,absolute:t.absolute})};_apply(t){const e=this._snapshot;e.alpha===t.alpha&&e.beta===t.beta&&e.gamma===t.gamma&&e.absolute===t.absolute||(this._snapshot=t,this._target.dispatchEvent(new CustomEvent("wcs-tilt:change",{detail:t,bubbles:!0})))}}class l extends HTMLElement{static hasConnectedCallbackPromise=!0;static wcBindable={...o.wcBindable,inputs:[],commands:o.wcBindable.commands};_core;_connectedCallbackPromise=Promise.resolve();_internals=null;constructor(){super(),this._core=new o(this),this._internals=this._initInternals(),this._wireStates({"wcs-tilt:error":t=>({error:null!=t})})}get debugStates(){return this._internals?[...this._internals.states]:[]}_initInternals(){try{if("function"!=typeof this.attachInternals)return null;const t=this.attachInternals();return t.states.add("wcs-probe"),t.states.delete("wcs-probe"),t}catch{return null}}_wireStates(t){if(null===this._internals)return;const e=this._internals.states;for(const[s,r]of Object.entries(t))this.addEventListener(s,t=>{const s=this.hasAttribute("debug-states");for(const[n,a]of Object.entries(r(t.detail))){try{a?e.add(n):e.delete(n)}catch{}s&&this.toggleAttribute(`data-wcs-state-${n}`,a)}})}get alpha(){return this._core.alpha}get beta(){return this._core.beta}get gamma(){return this._core.gamma}get absolute(){return this._core.absolute}get permissionState(){return this._core.permissionState}get error(){return this._core.error}get connectedCallbackPromise(){return this._connectedCallbackPromise}requestPermission(){return this._core.requestPermission()}start(){this._core.start()}stop(){this._core.stop()}connectedCallback(){this.style.display="none",this._connectedCallbackPromise=this._core.observe()}disconnectedCallback(){this._core.dispose()}}function c(e){var s;e&&((s=e).tagNames&&Object.assign(t.tagNames,s.tagNames),r=null),customElements.get(n.tagNames.tilt)||customElements.define(n.tagNames.tilt,l)}export{o as TiltCore,l as WcsTilt,c as bootstrapTilt,a as getConfig};
2
2
  //# sourceMappingURL=index.esm.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.min.js","sources":["../src/config.ts","../src/core/TiltCore.ts","../src/components/Tilt.ts","../src/bootstrapTilt.ts","../src/registerComponents.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n tilt: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n tilt: \"wcs-tilt\",\n },\n};\n\nfunction deepFreeze<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n Object.freeze(obj);\n for (const key of Object.keys(obj)) {\n deepFreeze((obj as Record<string, unknown>)[key]);\n }\n return obj;\n}\n\nfunction deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n const clone: Record<string, unknown> = {};\n for (const key of Object.keys(obj)) {\n clone[key] = deepClone((obj as Record<string, unknown>)[key]);\n }\n return clone as T;\n}\n\nlet frozenConfig: IConfig | null = null;\n\nexport const config: IConfig = _config as IConfig;\n\nexport function getConfig(): IConfig {\n if (!frozenConfig) {\n frozenConfig = deepFreeze(deepClone(_config));\n }\n return frozenConfig;\n}\n\nexport function setConfig(partialConfig: IWritableConfig): void {\n if (partialConfig.tagNames) {\n Object.assign(_config.tagNames, partialConfig.tagNames);\n }\n frozenConfig = null;\n}\n","import { IWcBindable, TiltPermissionState } from \"../types.js\";\n\ninterface DeviceOrientationEventCtor {\n requestPermission?: () => Promise<\"granted\" | \"denied\">;\n}\n\ninterface WcsTiltSnapshot {\n alpha: number | null;\n beta: number | null;\n gamma: number | null;\n absolute: boolean | null;\n}\n\nconst UNSUPPORTED_SNAPSHOT: WcsTiltSnapshot = Object.freeze({\n alpha: null,\n beta: null,\n gamma: null,\n absolute: null,\n});\n\n/**\n * Headless Device Orientation primitive. A thin, framework-agnostic wrapper\n * around `window`'s `deviceorientation` event exposed through the wc-bindable\n * protocol.\n *\n * The batch2 sibling of `@wcstack/idle` (docs/device-orientation-tag-design.md).\n * Unlike Idle Detection, there is no matching Permissions API entry for this\n * feature (`navigator.permissions.query` has no \"device-orientation\" name), so\n * `permissionState` must be tracked **locally** rather than composed with\n * `<wcs-permission>` — the defining asymmetry within batch2.\n *\n * No `_gen` generation guard: subscribing/unsubscribing to `deviceorientation`\n * (start/stop) is fully synchronous, so that path never needs one. This node\n * does have an async probe — `requestPermission()` awaits the static\n * `DeviceOrientationEvent.requestPermission()` — but its post-await write is\n * a benign `permissionState`/`error` value set + dispatch with no\n * subscription/resource management to race, so `_gen` is unneeded there too\n * (docs/device-orientation-tag-design.md §4, corrected after an earlier\n * revision mistakenly reused `@wcstack/network`'s \"no async probe at all\"\n * rationale).\n */\nexport class TiltCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"alpha\", event: \"wcs-tilt:change\", getter: (e: Event) => (e as CustomEvent).detail.alpha },\n { name: \"beta\", event: \"wcs-tilt:change\", getter: (e: Event) => (e as CustomEvent).detail.beta },\n { name: \"gamma\", event: \"wcs-tilt:change\", getter: (e: Event) => (e as CustomEvent).detail.gamma },\n { name: \"absolute\", event: \"wcs-tilt:change\", getter: (e: Event) => (e as CustomEvent).detail.absolute },\n { name: \"permissionState\", event: \"wcs-tilt:permission-changed\" },\n // never-throw (§3.6): requestPermission() failures land here instead of\n // rejecting/throwing. Mirrors idle (same batch2) and the accelerometer\n // family (batch5) — see docs/io-node-batch-implementation-plan.md.\n { name: \"error\", event: \"wcs-tilt:error\" },\n ],\n commands: [\n { name: \"requestPermission\", async: true },\n { name: \"start\" },\n { name: \"stop\" },\n ],\n };\n\n private _target: EventTarget;\n private _snapshot: WcsTiltSnapshot = UNSUPPORTED_SNAPSHOT;\n private _permissionState: TiltPermissionState = \"unknown\";\n private _error: any = null;\n private _subscribed = false;\n\n // SSR (§3.8): never auto-starts on connect, so there is no probe to await —\n // readiness is always immediate.\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 alpha(): number | null {\n return this._snapshot.alpha;\n }\n\n get beta(): number | null {\n return this._snapshot.beta;\n }\n\n get gamma(): number | null {\n return this._snapshot.gamma;\n }\n\n get absolute(): boolean | null {\n return this._snapshot.absolute;\n }\n\n get permissionState(): TiltPermissionState {\n return this._permissionState;\n }\n\n get error(): any {\n return this._error;\n }\n\n // Lifecycle (§3.5). observe() is a synchronous no-op: like `<wcs-idle>`,\n // this Core deliberately does NOT auto-start on connect (§6) on platforms\n // that gate deviceorientation behind requestPermission().\n observe(): Promise<void> {\n return this._ready;\n }\n\n dispose(): void {\n this.stop();\n }\n\n private _deviceOrientationEventCtor(): DeviceOrientationEventCtor | undefined {\n const g = globalThis as any;\n return typeof g.DeviceOrientationEvent !== \"undefined\" ? g.DeviceOrientationEvent : undefined;\n }\n\n private _setPermissionState(state: TiltPermissionState): void {\n if (this._permissionState === state) return;\n this._permissionState = state;\n this._target.dispatchEvent(new CustomEvent(\"wcs-tilt:permission-changed\", {\n detail: state,\n bubbles: true,\n }));\n }\n\n private _setError(error: any): void {\n if (this._error === error) return;\n this._error = error;\n this._target.dispatchEvent(new CustomEvent(\"wcs-tilt:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n /**\n * Wraps iOS 13+ Safari's static, gesture-gated\n * `DeviceOrientationEvent.requestPermission()`. On platforms without this\n * gate (Android Chrome, desktop) there is nothing to ask, so this resolves\n * to `\"granted\"` immediately without querying anything — callers can write\n * one `requestPermission()` → `start()` flow that works everywhere\n * (docs/device-orientation-tag-design.md §3).\n *\n * never-throw (§3.6): a gesture-context rejection resolves to `\"denied\"`\n * and the raw error lands in `error` instead of propagating. Mirrors\n * `<wcs-idle>`'s `requestPermission()` (docs/idle-detection-tag-design.md\n * §4.1) — any settled (non-throwing) outcome supersedes a stale `error`\n * from an earlier attempt.\n */\n async requestPermission(): Promise<TiltPermissionState> {\n const Ctor = this._deviceOrientationEventCtor();\n if (typeof Ctor?.requestPermission !== \"function\") {\n this._setError(null);\n this._setPermissionState(\"granted\");\n return \"granted\";\n }\n try {\n const result = await Ctor.requestPermission();\n const state: TiltPermissionState = result === \"granted\" ? \"granted\" : \"denied\";\n this._setError(null);\n this._setPermissionState(state);\n return state;\n } catch (e) {\n // never-throw: a gesture-context rejection resolves to \"denied\".\n this._setError({ error: e });\n this._setPermissionState(\"denied\");\n return \"denied\";\n }\n }\n\n /** Subscribe to `deviceorientation`. Idempotent — a second start() while already subscribed is a no-op. */\n start(): void {\n if (this._subscribed) return;\n this._subscribed = true;\n globalThis.window?.addEventListener(\"deviceorientation\", this._onOrientation as EventListener);\n }\n\n /** Unsubscribe from `deviceorientation`. Safe to call when not started. */\n stop(): void {\n if (!this._subscribed) return;\n this._subscribed = false;\n globalThis.window?.removeEventListener(\"deviceorientation\", this._onOrientation as EventListener);\n }\n\n private _onOrientation = (event: DeviceOrientationEvent): void => {\n this._apply({\n alpha: event.alpha,\n beta: event.beta,\n gamma: event.gamma,\n absolute: event.absolute,\n });\n };\n\n // Same-value guard (§3.3 MUST).\n private _apply(next: WcsTiltSnapshot): void {\n const prev = this._snapshot;\n if (\n prev.alpha === next.alpha &&\n prev.beta === next.beta &&\n prev.gamma === next.gamma &&\n prev.absolute === next.absolute\n ) {\n return;\n }\n this._snapshot = next;\n this._target.dispatchEvent(new CustomEvent(\"wcs-tilt:change\", {\n detail: next,\n bubbles: true,\n }));\n }\n}\n","import { IWcBindable, TiltPermissionState } from \"../types.js\";\nimport { TiltCore } from \"../core/TiltCore.js\";\n\n/**\n * `<wcs-tilt>` — declarative Device Orientation API monitor.\n *\n * Named `tilt` (not `orientation`/`device-orientation`) to avoid colliding\n * with `<wcs-screen-orientation>` (docs/device-orientation-tag-design.md §9).\n *\n * Does NOT auto-start on connect, mirroring `<wcs-idle>`: on iOS, subscribing\n * before permission is granted silently receives no events. Callers drive\n * `requestPermission()` → `start()` explicitly.\n */\nexport class WcsTilt extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n\n static wcBindable: IWcBindable = {\n ...TiltCore.wcBindable,\n inputs: [],\n // Core の commands をそのまま継承(単一情報源)。\n commands: TiltCore.wcBindable.commands,\n };\n\n private _core: TiltCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n\n constructor() {\n super();\n this._core = new TiltCore(this);\n }\n\n // --- Core delegated getters ---\n\n get alpha(): number | null {\n return this._core.alpha;\n }\n\n get beta(): number | null {\n return this._core.beta;\n }\n\n get gamma(): number | null {\n return this._core.gamma;\n }\n\n get absolute(): boolean | null {\n return this._core.absolute;\n }\n\n get permissionState(): TiltPermissionState {\n return this._core.permissionState;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Commands (delegated to Core) ---\n\n requestPermission(): Promise<TiltPermissionState> {\n return this._core.requestPermission();\n }\n\n start(): void {\n this._core.start();\n }\n\n stop(): void {\n this._core.stop();\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n this.style.display = \"none\";\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 bootstrapTilt(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n","import { WcsTilt } from \"./components/Tilt.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.tilt)) {\n customElements.define(config.tagNames.tilt, WcsTilt);\n }\n}\n"],"names":["_config","tagNames","tilt","deepFreeze","obj","Object","freeze","key","keys","deepClone","clone","frozenConfig","config","getConfig","UNSUPPORTED_SNAPSHOT","alpha","beta","gamma","absolute","TiltCore","EventTarget","static","protocol","version","properties","name","event","getter","e","detail","commands","async","_target","_snapshot","_permissionState","_error","_subscribed","_ready","Promise","resolve","constructor","target","super","this","ready","permissionState","error","observe","dispose","stop","_deviceOrientationEventCtor","g","globalThis","DeviceOrientationEvent","undefined","_setPermissionState","state","dispatchEvent","CustomEvent","bubbles","_setError","requestPermission","Ctor","start","window","addEventListener","_onOrientation","removeEventListener","_apply","next","prev","WcsTilt","HTMLElement","wcBindable","inputs","_core","_connectedCallbackPromise","connectedCallbackPromise","connectedCallback","style","display","disconnectedCallback","bootstrapTilt","userConfig","partialConfig","assign","customElements","get","define"],"mappings":"AAQA,MAAMA,EAA2B,CAC/BC,SAAU,CACRC,KAAM,aAIV,SAASC,EAAcC,GACrB,GAAY,OAARA,GAA+B,iBAARA,EAAkB,OAAOA,EACpDC,OAAOC,OAAOF,GACd,IAAK,MAAMG,KAAOF,OAAOG,KAAKJ,GAC5BD,EAAYC,EAAgCG,IAE9C,OAAOH,CACT,CAEA,SAASK,EAAaL,GACpB,GAAY,OAARA,GAA+B,iBAARA,EAAkB,OAAOA,EACpD,MAAMM,EAAiC,CAAA,EACvC,IAAK,MAAMH,KAAOF,OAAOG,KAAKJ,GAC5BM,EAAMH,GAAOE,EAAWL,EAAgCG,IAE1D,OAAOG,CACT,CAEA,IAAIC,EAA+B,KAE5B,MAAMC,EAAkBZ,WAEfa,IAId,OAHKF,IACHA,EAAeR,EAAWM,EAAUT,KAE/BW,CACT,CC5BA,MAAMG,EAAwCT,OAAOC,OAAO,CAC1DS,MAAO,KACPC,KAAM,KACNC,MAAO,KACPC,SAAU,OAwBN,MAAOC,UAAiBC,YAC5BC,kBAAiC,CAC/BC,SAAU,cACVC,QAAS,EACTC,WAAY,CACV,CAAEC,KAAM,QAASC,MAAO,kBAAmBC,OAASC,GAAcA,EAAkBC,OAAOd,OAC3F,CAAEU,KAAM,OAAQC,MAAO,kBAAm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AAI5B,GACF,OAAO4B,KAAKgC,MAAM5D,KACpB,CAEA,QAAIC,GACF,OAAO2B,KAAKgC,MAAM3D,IACpB,CAEA,SAAIC,GACF,OAAO0B,KAAKgC,MAAM1D,KACpB,CAEA,YAAIC,GACF,OAAOyB,KAAKgC,MAAMzD,QACpB,CAEA,mBAAI2B,GACF,OAAOF,KAAKgC,MAAM9B,eACpB,CAEA,SAAIC,GACF,OAAOH,KAAKgC,MAAM7B,KACpB,CAEA,4BAAI+B,GACF,OAAOlC,KAAKiC,yBACd,CAIA,iBAAAf,GACE,OAAOlB,KAAKgC,MAAMd,mBACpB,CAEA,KAAAE,GACEpB,KAAKgC,MAAMZ,OACb,CAEA,IAAAd,GACEN,KAAKgC,MAAM1B,MACb,CAIA,iBAAA6B,GACEnC,KAAKoC,MAAMC,QAAU,OACrBrC,KAAKiC,0BAA4BjC,KAAKgC,MAAM5B,SAC9C,CAEA,oBAAAkC,GACEtC,KAAKgC,MAAM3B,SACb,EChFI,SAAUkC,EAAcC,GHuCxB,IAAoBC,EGtCpBD,KHsCoBC,EGrCZD,GHsCMlF,UAChBI,OAAOgF,OAAOrF,EAAQC,SAAUmF,EAAcnF,UAEhDU,EAAe,MI3CV2E,eAAeC,IAAI3E,EAAOX,SAASC,OACtCoF,eAAeE,OAAO5E,EAAOX,SAASC,KAAMqE,EDIhD"}
1
+ {"version":3,"file":"index.esm.min.js","sources":["../src/config.ts","../src/core/TiltCore.ts","../src/components/Tilt.ts","../src/bootstrapTilt.ts","../src/registerComponents.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n tilt: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n tilt: \"wcs-tilt\",\n },\n};\n\nfunction deepFreeze<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n Object.freeze(obj);\n for (const key of Object.keys(obj)) {\n deepFreeze((obj as Record<string, unknown>)[key]);\n }\n return obj;\n}\n\nfunction deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n const clone: Record<string, unknown> = {};\n for (const key of Object.keys(obj)) {\n clone[key] = deepClone((obj as Record<string, unknown>)[key]);\n }\n return clone as T;\n}\n\nlet frozenConfig: IConfig | null = null;\n\nexport const config: IConfig = _config as IConfig;\n\nexport function getConfig(): IConfig {\n if (!frozenConfig) {\n frozenConfig = deepFreeze(deepClone(_config));\n }\n return frozenConfig;\n}\n\nexport function setConfig(partialConfig: IWritableConfig): void {\n if (partialConfig.tagNames) {\n Object.assign(_config.tagNames, partialConfig.tagNames);\n }\n frozenConfig = null;\n}\n","import { IWcBindable, TiltPermissionState } from \"../types.js\";\n\ninterface DeviceOrientationEventCtor {\n requestPermission?: () => Promise<\"granted\" | \"denied\">;\n}\n\ninterface WcsTiltSnapshot {\n alpha: number | null;\n beta: number | null;\n gamma: number | null;\n absolute: boolean | null;\n}\n\nconst UNSUPPORTED_SNAPSHOT: WcsTiltSnapshot = Object.freeze({\n alpha: null,\n beta: null,\n gamma: null,\n absolute: null,\n});\n\n/**\n * Headless Device Orientation primitive. A thin, framework-agnostic wrapper\n * around `window`'s `deviceorientation` event exposed through the wc-bindable\n * protocol.\n *\n * The batch2 sibling of `@wcstack/idle` (docs/device-orientation-tag-design.md).\n * Unlike Idle Detection, there is no matching Permissions API entry for this\n * feature (`navigator.permissions.query` has no \"device-orientation\" name), so\n * `permissionState` must be tracked **locally** rather than composed with\n * `<wcs-permission>` — the defining asymmetry within batch2.\n *\n * No `_gen` generation guard: subscribing/unsubscribing to `deviceorientation`\n * (start/stop) is fully synchronous, so that path never needs one. This node\n * does have an async probe — `requestPermission()` awaits the static\n * `DeviceOrientationEvent.requestPermission()` — but its post-await write is\n * a benign `permissionState`/`error` value set + dispatch with no\n * subscription/resource management to race, so `_gen` is unneeded there too\n * (docs/device-orientation-tag-design.md §4, corrected after an earlier\n * revision mistakenly reused `@wcstack/network`'s \"no async probe at all\"\n * rationale).\n */\nexport class TiltCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"alpha\", event: \"wcs-tilt:change\", getter: (e: Event) => (e as CustomEvent).detail.alpha },\n { name: \"beta\", event: \"wcs-tilt:change\", getter: (e: Event) => (e as CustomEvent).detail.beta },\n { name: \"gamma\", event: \"wcs-tilt:change\", getter: (e: Event) => (e as CustomEvent).detail.gamma },\n { name: \"absolute\", event: \"wcs-tilt:change\", getter: (e: Event) => (e as CustomEvent).detail.absolute },\n { name: \"permissionState\", event: \"wcs-tilt:permission-changed\" },\n // never-throw (§3.6): requestPermission() failures land here instead of\n // rejecting/throwing. Mirrors idle (same batch2) and the accelerometer\n // family (batch5) — see docs/io-node-batch-implementation-plan.md.\n { name: \"error\", event: \"wcs-tilt:error\" },\n ],\n commands: [\n { name: \"requestPermission\", async: true },\n { name: \"start\" },\n { name: \"stop\" },\n ],\n };\n\n private _target: EventTarget;\n private _snapshot: WcsTiltSnapshot = UNSUPPORTED_SNAPSHOT;\n private _permissionState: TiltPermissionState = \"unknown\";\n private _error: any = null;\n private _subscribed = false;\n\n // SSR (§3.8): never auto-starts on connect, so there is no probe to await —\n // readiness is always immediate.\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 alpha(): number | null {\n return this._snapshot.alpha;\n }\n\n get beta(): number | null {\n return this._snapshot.beta;\n }\n\n get gamma(): number | null {\n return this._snapshot.gamma;\n }\n\n get absolute(): boolean | null {\n return this._snapshot.absolute;\n }\n\n get permissionState(): TiltPermissionState {\n return this._permissionState;\n }\n\n get error(): any {\n return this._error;\n }\n\n // Lifecycle (§3.5). observe() is a synchronous no-op: like `<wcs-idle>`,\n // this Core deliberately does NOT auto-start on connect (§6) on platforms\n // that gate deviceorientation behind requestPermission().\n observe(): Promise<void> {\n return this._ready;\n }\n\n dispose(): void {\n this.stop();\n }\n\n private _deviceOrientationEventCtor(): DeviceOrientationEventCtor | undefined {\n const g = globalThis as any;\n return typeof g.DeviceOrientationEvent !== \"undefined\" ? g.DeviceOrientationEvent : undefined;\n }\n\n private _setPermissionState(state: TiltPermissionState): void {\n if (this._permissionState === state) return;\n this._permissionState = state;\n this._target.dispatchEvent(new CustomEvent(\"wcs-tilt:permission-changed\", {\n detail: state,\n bubbles: true,\n }));\n }\n\n private _setError(error: any): void {\n if (this._error === error) return;\n this._error = error;\n this._target.dispatchEvent(new CustomEvent(\"wcs-tilt:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n /**\n * Wraps iOS 13+ Safari's static, gesture-gated\n * `DeviceOrientationEvent.requestPermission()`. On platforms without this\n * gate (Android Chrome, desktop) there is nothing to ask, so this resolves\n * to `\"granted\"` immediately without querying anything — callers can write\n * one `requestPermission()` → `start()` flow that works everywhere\n * (docs/device-orientation-tag-design.md §3).\n *\n * never-throw (§3.6): a gesture-context rejection resolves to `\"denied\"`\n * and the raw error lands in `error` instead of propagating. Mirrors\n * `<wcs-idle>`'s `requestPermission()` (docs/idle-detection-tag-design.md\n * §4.1) — any settled (non-throwing) outcome supersedes a stale `error`\n * from an earlier attempt.\n */\n async requestPermission(): Promise<TiltPermissionState> {\n const Ctor = this._deviceOrientationEventCtor();\n if (typeof Ctor?.requestPermission !== \"function\") {\n this._setError(null);\n this._setPermissionState(\"granted\");\n return \"granted\";\n }\n try {\n const result = await Ctor.requestPermission();\n const state: TiltPermissionState = result === \"granted\" ? \"granted\" : \"denied\";\n this._setError(null);\n this._setPermissionState(state);\n return state;\n } catch (e) {\n // never-throw: a gesture-context rejection resolves to \"denied\".\n this._setError({ error: e });\n this._setPermissionState(\"denied\");\n return \"denied\";\n }\n }\n\n /** Subscribe to `deviceorientation`. Idempotent — a second start() while already subscribed is a no-op. */\n start(): void {\n if (this._subscribed) return;\n this._subscribed = true;\n globalThis.window?.addEventListener(\"deviceorientation\", this._onOrientation as EventListener);\n }\n\n /** Unsubscribe from `deviceorientation`. Safe to call when not started. */\n stop(): void {\n if (!this._subscribed) return;\n this._subscribed = false;\n globalThis.window?.removeEventListener(\"deviceorientation\", this._onOrientation as EventListener);\n }\n\n private _onOrientation = (event: DeviceOrientationEvent): void => {\n this._apply({\n alpha: event.alpha,\n beta: event.beta,\n gamma: event.gamma,\n absolute: event.absolute,\n });\n };\n\n // Same-value guard (§3.3 MUST).\n private _apply(next: WcsTiltSnapshot): void {\n const prev = this._snapshot;\n if (\n prev.alpha === next.alpha &&\n prev.beta === next.beta &&\n prev.gamma === next.gamma &&\n prev.absolute === next.absolute\n ) {\n return;\n }\n this._snapshot = next;\n this._target.dispatchEvent(new CustomEvent(\"wcs-tilt:change\", {\n detail: next,\n bubbles: true,\n }));\n }\n}\n","import { IWcBindable, TiltPermissionState } from \"../types.js\";\nimport { TiltCore } from \"../core/TiltCore.js\";\n\n/**\n * `<wcs-tilt>` — declarative Device Orientation API monitor.\n *\n * Named `tilt` (not `orientation`/`device-orientation`) to avoid colliding\n * with `<wcs-screen-orientation>` (docs/device-orientation-tag-design.md §9).\n *\n * Does NOT auto-start on connect, mirroring `<wcs-idle>`: on iOS, subscribing\n * before permission is granted silently receives no events. Callers drive\n * `requestPermission()` → `start()` explicitly.\n */\nexport class WcsTilt extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n\n static wcBindable: IWcBindable = {\n ...TiltCore.wcBindable,\n inputs: [],\n // Core の commands をそのまま継承(単一情報源)。\n commands: TiltCore.wcBindable.commands,\n };\n\n private _core: TiltCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new TiltCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-tilt: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 (async-io-node-guidelines.md §3.6): attachInternals is absent\n // in happy-dom / older environments, and pre-125 Chromium rejects\n // non-dashed state names from states.add() (probed and discarded here).\n // Either case silently disables reflection — the component still works,\n // it just doesn't expose :state() selectors.\n try {\n if (typeof this.attachInternals !== \"function\") return null;\n const internals = this.attachInternals();\n internals.states.add(\"wcs-probe\");\n internals.states.delete(\"wcs-probe\");\n return internals;\n } catch {\n return null;\n }\n }\n\n private _wireStates(map: Record<string, (detail: any) => Record<string, boolean>>): void {\n if (this._internals === null) return;\n const states = this._internals.states;\n for (const [event, toStates] of Object.entries(map)) {\n this.addEventListener(event, (e) => {\n const debug = this.hasAttribute(\"debug-states\");\n for (const [name, on] of Object.entries(toStates((e as CustomEvent).detail))) {\n try {\n if (on) { states.add(name); } else { states.delete(name); }\n } catch { /* never-throw */ }\n if (debug) this.toggleAttribute(`data-wcs-state-${name}`, on);\n }\n });\n }\n }\n\n // --- Core delegated getters ---\n\n get alpha(): number | null {\n return this._core.alpha;\n }\n\n get beta(): number | null {\n return this._core.beta;\n }\n\n get gamma(): number | null {\n return this._core.gamma;\n }\n\n get absolute(): boolean | null {\n return this._core.absolute;\n }\n\n get permissionState(): TiltPermissionState {\n return this._core.permissionState;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Commands (delegated to Core) ---\n\n requestPermission(): Promise<TiltPermissionState> {\n return this._core.requestPermission();\n }\n\n start(): void {\n this._core.start();\n }\n\n stop(): void {\n this._core.stop();\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n this.style.display = \"none\";\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 bootstrapTilt(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n","import { WcsTilt } from \"./components/Tilt.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.tilt)) {\n customElements.define(config.tagNames.tilt, WcsTilt);\n }\n}\n"],"names":["_config","tagNames","tilt","deepFreeze","obj","Object","freeze","key","keys","deepClone","clone","frozenConfig","config","getConfig","UNSUPPORTED_SNAPSHOT","alpha","beta","gamma","absolute","TiltCore","EventTarget","static","protocol","version","properties","name","event","getter","e","detail","commands","async","_target","_snapshot","_permissionState","_error","_subscribed","_ready","Promise","resolve","constructor","target","super","this","ready","permissionState","error","observe","dispose","stop","_deviceOrientationEventCtor","g","globalThis","DeviceOrientationEvent","undefined","_setPermissionState","state","dispatchEvent","CustomEvent","bubbles","_setError","requestPermission","Ctor","start","window","addEventListener","_onOrientation","removeEventListener","_apply","next","prev","WcsTilt","HTMLElement","wcBindable","inputs","_core","_connectedCallbackPromise","_internals","_initInternals","_wireStates","d","debugStates","states","attachInternals","internals","add","delete","map","toStates","entries","debug","hasAttribute","on","toggleAttribute","connectedCallbackPromise","connectedCallback","style","display","disconnectedCallback","bootstrapTilt","userConfig","partialConfig","assign","customElements","get","define"],"mappings":"AAQA,MAAMA,EAA2B,CAC/BC,SAAU,CACRC,KAAM,aAIV,SAASC,EAAcC,GACrB,GAAY,OAARA,GAA+B,iBAARA,EAAkB,OAAOA,EACpDC,OAAOC,OAAOF,GACd,IAAK,MAAMG,KAAOF,OAAOG,KAAKJ,GAC5BD,EAAYC,EAAgCG,IAE9C,OAAOH,CACT,CAEA,SAASK,EAAaL,GACpB,GAAY,OAARA,GAA+B,iBAARA,EAAkB,OAAOA,EACpD,MAAMM,EAAiC,CAAA,EACvC,IAAK,MAAMH,KAAOF,OAAOG,KAAKJ,GAC5BM,EAAMH,GAAOE,EAAWL,EAAgC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,CAIA,SAAI7E,GACF,OAAO4B,KAAKgC,MAAM5D,KACpB,CAEA,QAAIC,GACF,OAAO2B,KAAKgC,MAAM3D,IACpB,CAEA,SAAIC,GACF,OAAO0B,KAAKgC,MAAM1D,KACpB,CAEA,YAAIC,GACF,OAAOyB,KAAKgC,MAAMzD,QACpB,CAEA,mBAAI2B,GACF,OAAOF,KAAKgC,MAAM9B,eACpB,CAEA,SAAIC,GACF,OAAOH,KAAKgC,MAAM7B,KACpB,CAEA,4BAAIgD,GACF,OAAOnD,KAAKiC,yBACd,CAIA,iBAAAf,GACE,OAAOlB,KAAKgC,MAAMd,mBACpB,CAEA,KAAAE,GACEpB,KAAKgC,MAAMZ,OACb,CAEA,IAAAd,GACEN,KAAKgC,MAAM1B,MACb,CAIA,iBAAA8C,GACEpD,KAAKqD,MAAMC,QAAU,OACrBtD,KAAKiC,0BAA4BjC,KAAKgC,MAAM5B,SAC9C,CAEA,oBAAAmD,GACEvD,KAAKgC,MAAM3B,SACb,EC9HI,SAAUmD,EAAcC,GHuCxB,IAAoBC,EGtCpBD,KHsCoBC,EGrCZD,GHsCMnG,UAChBI,OAAOiG,OAAOtG,EAAQC,SAAUoG,EAAcpG,UAEhDU,EAAe,MI3CV4F,eAAeC,IAAI5F,EAAOX,SAASC,OACtCqG,eAAeE,OAAO7F,EAAOX,SAASC,KAAMqE,EDIhD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wcstack/tilt",
3
- "version": "1.16.0",
3
+ "version": "1.17.0",
4
4
  "description": "Declarative Device Orientation component for Web Components. Framework-agnostic deviceorientation wrapper via wc-bindable-protocol.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.esm.js",