@wcstack/eyedropper 1.20.0 → 1.21.1
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 +5 -0
- package/README.md +6 -0
- package/dist/index.d.ts +112 -26
- package/dist/index.esm.js +516 -94
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/config.ts","../src/core/EyedropperCore.ts","../src/components/Eyedropper.ts","../src/registerComponents.ts","../src/bootstrapEyedropper.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n eyedropper: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n eyedropper: \"wcs-eyedropper\",\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\n// Note: this is the live, mutable internal config. It is not part of the public\n// package exports (see exports.ts) — only `getConfig()` (a frozen snapshot) is\n// surfaced. `setConfig()` is applied internally via `bootstrapEyedropper()` and\n// is not re-exported from the package root, though a deep path import\n// (`.../src/config.js`) can still reach and mutate it. Accepted as-is for\n// cross-package consistency: every @wcstack package follows this same shape.\n// Use `getConfig()` for a frozen, safe read.\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, WcsEyedropperData } from \"../types.js\";\n\n/**\n * Headless EyeDropper primitive. A thin, framework-agnostic wrapper around\n * `new EyeDropper().open(options)` exposed through the wc-bindable protocol.\n *\n * This is a simplified derivative of `FetchCore._doFetch`\n * (docs/eyedropper-tag-design.md §1, docs/web-share-tag-design.md §2): it\n * keeps the single `_gen` generation guard, the same-value-guarded private\n * setters, and the never-throw try/catch wrapper — the same skeleton\n * `@wcstack/share`'s `ShareCore` uses.\n *\n * Unlike `ShareCore`, this Core **does** restore `AbortController`/`abort()`\n * (docs/eyedropper-tag-design.md §2): `EyeDropper.open()` accepts a `{signal}`\n * option, so — unlike Web Share — a caller has a real platform mechanism to\n * cancel an in-flight color pick. The shape mirrors `FetchCore.abort()`\n * (packages/fetch/src/core/FetchCore.ts:159-164) including the identity check\n * on the locally-held `AbortController` in the `finally` block\n * (packages/fetch/src/core/FetchCore.ts:312-314), so a fast abort()→open()\n * sequence never lets a stale controller null out the new call's controller.\n *\n * Both the user dismissing the picker with Escape and the caller invoking\n * `abort()` reject `open()` with the same `AbortError` — both land on\n * `cancelled` without distinction (docs/eyedropper-tag-design.md §2).\n */\nexport class EyedropperCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"value\", event: \"wcs-eyedropper:complete\", getter: (e: Event) => (e as CustomEvent).detail.value },\n { name: \"loading\", event: \"wcs-eyedropper:loading-changed\" },\n { name: \"error\", event: \"wcs-eyedropper:error\" },\n { name: \"cancelled\", event: \"wcs-eyedropper:cancelled-changed\" },\n ],\n commands: [\n { name: \"open\", async: true },\n { name: \"abort\" },\n ],\n };\n\n private _target: EventTarget;\n private _value: WcsEyedropperData | null = null;\n private _loading: boolean = false;\n private _error: any = null;\n private _cancelled: boolean = false;\n private _abortController: AbortController | null = null;\n // Generation guard (§3.4 of the guidelines): bumped on dispose() (and each\n // open() start). An open() that settles after dispose() has a stale `gen`\n // and MUST NOT write state to a torn-down element. Not bumped on the\n // unsupported early-return — no asynchronous work is started, so there is\n // no generation to protect (docs/eyedropper-tag-design.md §4).\n private _gen = 0;\n // SSR (§3.8): no asynchronous probe to await, so readiness is 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 value(): WcsEyedropperData | null {\n return this._value;\n }\n\n get loading(): boolean {\n return this._loading;\n }\n\n get error(): any {\n return this._error;\n }\n\n get cancelled(): boolean {\n return this._cancelled;\n }\n\n // Lifecycle (§3.5). EyeDropper is command-driven with no subscription to\n // establish, so observe() is an idempotent no-op that resolves once ready;\n // dispose() invalidates any in-flight open() and aborts it.\n observe(): Promise<void> {\n return this._ready;\n }\n\n dispose(): void {\n this._gen++;\n this.abort();\n }\n\n private _setLoading(loading: boolean): void {\n if (this._loading === loading) return;\n this._loading = loading;\n this._target.dispatchEvent(new CustomEvent(\"wcs-eyedropper:loading-changed\", {\n detail: loading,\n bubbles: true,\n }));\n }\n\n private _setValue(value: WcsEyedropperData | null): void {\n if (this._value === value) return;\n this._value = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-eyedropper:complete\", {\n detail: { value },\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-eyedropper:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n private _setCancelled(cancelled: boolean): void {\n if (this._cancelled === cancelled) return;\n this._cancelled = cancelled;\n this._target.dispatchEvent(new CustomEvent(\"wcs-eyedropper:cancelled-changed\", {\n detail: cancelled,\n bubbles: true,\n }));\n }\n\n // API resolution is call-time, never cached (§3.7): lets tests install/remove\n // the global EyeDropper constructor freely and lets an unsupported\n // environment (non-Chromium browsers, as of 2026) be detected correctly on\n // every call (docs/eyedropper-tag-design.md §4).\n private _api(): (new () => { open(options?: { signal?: AbortSignal }): Promise<WcsEyedropperData> }) | undefined {\n const g = globalThis as any;\n return typeof g.EyeDropper === \"function\" ? g.EyeDropper : undefined;\n }\n\n /**\n * Cancels an in-flight `open()` call, if any. A no-op when no open() is in\n * flight (no AbortController has been created yet, or the previous one has\n * already settled) — mirrors `FetchCore.abort()`\n * (packages/fetch/src/core/FetchCore.ts:159-164).\n */\n abort(): void {\n if (this._abortController) {\n this._abortController.abort();\n this._abortController = null;\n }\n }\n\n async open(): Promise<WcsEyedropperData | null> {\n // never-throw + unsupported (§4): resolve API at call time and bail out\n // immediately if absent. No _gen bump — no asynchronous work is started,\n // so there is no generation to protect, and `new EyeDropper()` is never\n // constructed.\n const EyeDropperCtor = this._api();\n if (!EyeDropperCtor) {\n this._setError({ message: \"EyeDropper API is not supported in this browser.\" });\n return null;\n }\n\n // Cancel any previous in-flight pick before starting a new one (mirrors\n // FetchCore._doFetch's `this.abort()` at the top).\n this.abort();\n\n // Hold the controller in a local so the finally block (which can run after\n // a subsequent open() has already replaced this._abortController) only\n // clears the field when it still owns it — identical identity check to\n // FetchCore._doFetch (packages/fetch/src/core/FetchCore.ts:312-314). This\n // is what keeps a fast abort()→open() sequence from letting a stale\n // controller null out the new call's controller.\n const ac = new AbortController();\n this._abortController = ac;\n const { signal } = ac;\n\n const gen = ++this._gen;\n\n this._setLoading(true);\n // Reset the previous outcome before starting a new open() so a stale\n // cancelled/error does not linger into this call's result\n // (docs/eyedropper-tag-design.md §1, docs/web-share-tag-design.md §3).\n this._setError(null);\n this._setCancelled(false);\n\n try {\n const result = await new EyeDropperCtor().open({ signal });\n\n // Stale completion (dispose() ran, or a superseding open() ran, while\n // the picker was open). Drop the result without writing state.\n if (gen !== this._gen) {\n return null;\n }\n\n // The platform's own result object ({ sRGBHex }) is used verbatim — no\n // synthesis needed, unlike Web Share's `value`\n // (docs/eyedropper-tag-design.md §3).\n this._setValue(result);\n this._setLoading(false);\n return result;\n } catch (e: any) {\n // Stale completion (dispose() ran, or a superseding open() ran, while\n // the picker was open).\n if (gen !== this._gen) {\n return null;\n }\n if (e?.name === \"AbortError\") {\n // Either the user dismissed the picker with Escape, or the caller\n // invoked abort() — both are a routine cancellation, not a platform\n // failure, and are not distinguished (docs/eyedropper-tag-design.md\n // §2). Kept out of `error`.\n this._setCancelled(true);\n } else {\n this._setError(e);\n }\n this._setLoading(false);\n return null;\n } finally {\n if (this._abortController === ac) {\n this._abortController = null;\n }\n }\n }\n}\n","import { IWcBindable, WcsEyedropperData } from \"../types.js\";\nimport { EyedropperCore } from \"../core/EyedropperCore.js\";\n\n/**\n * `<wcs-eyedropper>` — declarative EyeDropper API primitive.\n *\n * The smallest command-only Shell in the batch (docs/eyedropper-tag-design.md\n * §5), mirroring `<wcs-share>`: no attributes at all. `open()` takes no\n * per-call argument — the `{signal}` option is supplied internally by the\n * Core's own AbortController, never via the command-token surface.\n */\nexport class WcsEyedropper extends HTMLElement {\n // SSR (§4.4): observe() completes synchronously, but the Shell still exposes\n // connectedCallbackPromise so the state binder can await it uniformly across\n // all IO nodes before snapshotting.\n static hasConnectedCallbackPromise = true;\n\n static wcBindable: IWcBindable = {\n ...EyedropperCore.wcBindable,\n inputs: [],\n // Core の commands をそのまま継承(単一情報源)。\n commands: EyedropperCore.wcBindable.commands,\n };\n\n private _core: EyedropperCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new EyedropperCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-eyedropper:loading-changed\": (d) => ({ loading: d === true }),\n \"wcs-eyedropper:cancelled-changed\": (d) => ({ cancelled: d === true }),\n \"wcs-eyedropper: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 value(): WcsEyedropperData | null {\n return this._core.value;\n }\n\n get loading(): boolean {\n return this._core.loading;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get cancelled(): boolean {\n return this._core.cancelled;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Commands ---\n\n open(): Promise<WcsEyedropperData | null> {\n return this._core.open();\n }\n\n abort(): void {\n this._core.abort();\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 { WcsEyedropper } from \"./components/Eyedropper.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.eyedropper)) {\n customElements.define(config.tagNames.eyedropper, WcsEyedropper);\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapEyedropper(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,UAAU,EAAE,gBAAgB;AAC7B,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;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,MAAM,GAAY,OAAkB;SAEjC,SAAS,GAAA;IACvB,IAAI,CAAC,YAAY,EAAE;QACjB,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC/C;AACA,IAAA,OAAO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AE;IAC1B;IAEA,KAAK,GAAA;AACH,QAAA,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;IACpB;;IAIA,iBAAiB,GAAA;AACf,QAAA,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM;QAC3B,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;IACvD;IAEA,oBAAoB,GAAA;AAClB,QAAA,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;IACtB;;;SCtHc,kBAAkB,GAAA;AAChC,IAAA,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;QACnD,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;IAClE;AACF;;ACHM,SAAU,mBAAmB,CAAC,UAA4B,EAAA;IAC9D,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/operationLane.ts","../src/core/platformCapability.ts","../src/core/eyedropperCapabilities.ts","../src/core/EyedropperCore.ts","../src/components/Eyedropper.ts","../src/registerComponents.ts","../src/bootstrapEyedropper.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n eyedropper: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n eyedropper: \"wcs-eyedropper\",\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\n// Note: this is the live, mutable internal config. It is not part of the public\n// package exports (see exports.ts) — only `getConfig()` (a frozen snapshot) is\n// surfaced. `setConfig()` is applied internally via `bootstrapEyedropper()` and\n// is not re-exported from the package root, though a deep path import\n// (`.../src/config.js`) can still reach and mutate it. Accepted as-is for\n// cross-package consistency: every @wcstack package follows this same shape.\n// Use `getConfig()` for a frozen, safe read.\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","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /io-core/operation-lane.ts by scripts/sync-io-core.mjs.\n// Run `node scripts/sync-io-core.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * operationLane.ts\n *\n * Phase 4 (docs/architecture-hardening/09-remediation-design.md §5, §5.1) の\n * OperationTicket / CommitGuard / terminal CAS を型付き実装した lane プリミティブ。\n * docs/async-execution-model.md §5 が既に規範化した排他モード\n * (latest / queue / exhaust / overlap) を、`AbortController` だけでは防げない\n * 「取消不能な Promise・abort と同時に完了した結果の commit」から守るための\n * 実行時ガードとして具体化する。\n *\n * 配置方針 (§5): 本ファイルは /io-core/ の単一正典であり、scripts/sync-io-core.mjs が\n * 各 IO ノードの src/core/ へ生成コピー (AUTO-GENERATED, 編集禁止) を配布する。\n * `protocol/wcBindable.ts` と同じ copy-distribution 方式で、ランタイム依存を導入せず\n * 各パッケージのバンドルへ inline される (zero-runtime-dep / 自己完結 CDN を維持)。\n * 編集はこの正典に対して行い、`node scripts/sync-io-core.mjs` で再配布する。\n *\n * PoC 実装対象は fetch の `latest` policy のみ。queue / exhaust / overlap は\n * 「全 policy の lane unit」(§8 完了条件) として `operationLane.test.ts` が\n * 直接検証する。lane 自体は promise を実行せず、bookkeeping と guard の\n * 状態機械に徹する — 実際の非同期処理は Core が駆動し lane に照合する。\n */\n\n/** §5: 排他モードの語彙。async-execution-model.md §5 の 4 モードに対応 (parallel は予約語・スコープ外)。 */\nexport type LanePolicy = \"latest\" | \"queue\" | \"exhaust\" | \"overlap\";\n\n/** §5: 各 operation の一回限りの終端結果。 */\nexport type TerminalOutcome = \"success\" | \"error\" | \"timeout\" | \"aborted\" | \"stale\";\n\n/** §5: 論理操作 1 件の identity。retry は同じ operationId を再利用する。 */\nexport interface OperationTicket {\n readonly operationId: number;\n /** 発行時に捕捉した I/O Core の observe / reconnect / dispose lifecycle 世代。 */\n readonly ownerGeneration: number;\n readonly laneKey: string;\n readonly policy: LanePolicy;\n /** supersede bookkeeping に使う epoch (latest policy のみ)。 */\n readonly supersedeEpoch?: number;\n}\n\n/** §5: operation の 1 回の試行。retry で attempt++ と resource signal だけ差し替える。 */\nexport interface OperationAttempt {\n readonly operationId: number;\n readonly attempt: number;\n readonly signal?: AbortSignal;\n}\n\n/** §6: DevTools 側 channel へ流す trace(fetch では既定 off・zero-cost)。 */\nexport type OperationTraceEvent =\n | { readonly type: \"io:operation-started\"; readonly operationId: number; readonly laneKey: string; readonly policy: LanePolicy }\n | { readonly type: \"io:operation-retried\"; readonly operationId: number; readonly laneKey: string; readonly attempt: number }\n | { readonly type: \"io:operation-settled\"; readonly operationId: number; readonly laneKey: string; readonly outcome: TerminalOutcome }\n | { readonly type: \"io:stale-dropped\"; readonly operationId: number; readonly laneKey: string };\n\nexport interface OperationLaneOptions {\n /** attempt ごとに AbortController を発行し signal を渡す (fetch/upload 系)。 */\n readonly withSignal?: boolean;\n /**\n * trace subscriber。undefined なら trace record を一切生成しない\n * (§10.3 hook-off zero allocation の gate)。\n */\n readonly trace?: (event: OperationTraceEvent) => void;\n}\n\n/** 内部の終端状態。absence = pending。'committing' は multi-setter commit 中の中間状態。 */\ntype TerminalStatus = \"committing\" | TerminalOutcome;\n\n/**\n * 1 レーン = 独立した排他単位。Core が 1 つ以上所有する (module singleton にしない —\n * 複数 <wcs-fetch> 間で漏れるため)。\n */\nexport class OperationLane {\n readonly laneKey: string;\n readonly policy: LanePolicy;\n\n private _ownerGeneration = 0;\n private _latestEpoch = 0;\n private _nextOperationId = 1;\n // latest / queue / exhaust の単一 active。queue は head を指す。\n private _activeOperationId: number | undefined = undefined;\n // overlap の active set (§5: 内部 bookkeeping のみ・observable 公開はしない)。\n private readonly _activeOperationIds = new Set<number>();\n // queue policy の FIFO。\n private readonly _queue: OperationTicket[] = [];\n private _inFlightCount = 0;\n // opId → 終端状態 (absence = pending)。\n private readonly _terminal = new Map<number, TerminalStatus>();\n // claimTerminal で確定した outcome (finalize が 'committing' を最終値へ移す)。\n private readonly _claimedOutcome = new Map<number, TerminalOutcome>();\n // opId → AbortController (identity は opId が保証。cross-op clobber は構造上起きない)。\n private readonly _controllers = new Map<number, AbortController>();\n // opId → attempt 数。\n private readonly _attempts = new Map<number, number>();\n private readonly _withSignal: boolean;\n private readonly _trace?: (event: OperationTraceEvent) => void;\n\n constructor(laneKey: string, policy: LanePolicy, options: OperationLaneOptions = {}) {\n this.laneKey = laneKey;\n this.policy = policy;\n this._withSignal = options.withSignal ?? false;\n this._trace = options.trace;\n }\n\n get ownerGeneration(): number {\n return this._ownerGeneration;\n }\n\n get inFlightCount(): number {\n return this._inFlightCount;\n }\n\n get latestEpoch(): number {\n return this._latestEpoch;\n }\n\n get activeOperationId(): number | undefined {\n return this._activeOperationId;\n }\n\n /**\n * 新しい要求の到着。arrival policy を適用し ticket + 最初の attempt を発行する。\n * exhaust で実行中の場合だけ null を返す (新要求を ticket 化せず拒否 = 冪等 no-op)。\n */\n begin(): { ticket: OperationTicket; attempt: OperationAttempt } | null {\n let supersedeEpoch: number | undefined;\n switch (this.policy) {\n case \"latest\": {\n // latestEpoch を進め、旧 active を abort (可能なら)。旧 ticket は settle 時に\n // eligibility 不一致で stale となる。\n supersedeEpoch = ++this._latestEpoch;\n if (this._activeOperationId !== undefined) {\n this._abortController(this._activeOperationId);\n }\n break;\n }\n case \"exhaust\": {\n // 実行中なら新要求を拒否 (呼び出し側は既存結果へ合流)。\n if (this._activeOperationId !== undefined) {\n return null;\n }\n break;\n }\n case \"queue\":\n case \"overlap\":\n break;\n }\n\n const operationId = this._nextOperationId++;\n const ticket: OperationTicket = {\n operationId,\n ownerGeneration: this._ownerGeneration,\n laneKey: this.laneKey,\n policy: this.policy,\n supersedeEpoch,\n };\n\n switch (this.policy) {\n case \"latest\":\n case \"exhaust\":\n this._activeOperationId = operationId;\n break;\n case \"queue\":\n this._queue.push(ticket);\n // 先頭だけを active にする (先行が完了するまで待つ)。\n if (this._activeOperationId === undefined) {\n this._activeOperationId = operationId;\n }\n break;\n case \"overlap\":\n this._activeOperationIds.add(operationId);\n break;\n }\n\n this._inFlightCount += 1;\n this._attempts.set(operationId, 1);\n const attempt = this._makeAttempt(operationId, 1);\n if (this._trace !== undefined) {\n this._trace({ type: \"io:operation-started\", operationId, laneKey: this.laneKey, policy: this.policy });\n }\n return { ticket, attempt };\n }\n\n /**\n * retry: 同じ operationId に新しい attempt を作る。attempt number と resource signal\n * だけを更新する (§5)。既に終端した operation には作れない (null)。\n */\n retry(ticket: OperationTicket): OperationAttempt | null {\n if (ticket.ownerGeneration !== this._ownerGeneration) return null;\n if (this._terminal.has(ticket.operationId)) return null;\n const previous = this._attempts.get(ticket.operationId);\n if (previous === undefined) return null;\n const attemptNo = previous + 1;\n this._attempts.set(ticket.operationId, attemptNo);\n // 前の attempt の signal は破棄し、新しい controller を張る。\n this._releaseController(ticket.operationId);\n const attempt = this._makeAttempt(ticket.operationId, attemptNo);\n if (this._trace !== undefined) {\n this._trace({ type: \"io:operation-retried\", operationId: ticket.operationId, laneKey: this.laneKey, attempt: attemptNo });\n }\n return attempt;\n }\n\n /**\n * CommitGuard (§5.1)。外部可視の setter / event dispatch の直前に呼ぶ。\n * (1) owner lifecycle generation 一致 (2) terminal settle 前 (3) policy eligibility。\n */\n canCommit(ticket: OperationTicket): boolean {\n if (ticket.ownerGeneration !== this._ownerGeneration) return false;\n const status = this._terminal.get(ticket.operationId);\n // absence = pending / 'committing' = multi-setter commit 中。どちらも settle 前。\n if (status !== undefined && status !== \"committing\") return false;\n return this._isEligible(ticket);\n }\n\n /**\n * terminal CAS (§5.1): pending → committing を claim する。勝者だけが true。\n * eligibility / owner gen を満たさない場合も false。claim 後は commit 中となり、\n * canCommit は各 setter の直前で再検査する (setter が同期 supersede しても取りこぼさない)。\n */\n claimTerminal(ticket: OperationTicket, outcome: TerminalOutcome): boolean {\n if (ticket.ownerGeneration !== this._ownerGeneration) return false;\n if (this._terminal.has(ticket.operationId)) return false; // 既に committing / 終端\n if (!this._isEligible(ticket)) return false;\n this._terminal.set(ticket.operationId, \"committing\");\n this._claimedOutcome.set(ticket.operationId, outcome);\n return true;\n }\n\n /** claim 済み outcome (timer が claim → catch が読む等)。未 claim なら undefined。 */\n claimedOutcome(ticket: OperationTicket): TerminalOutcome | undefined {\n return this._claimedOutcome.get(ticket.operationId);\n }\n\n /**\n * operation の後始末。claim 済みなら outcome を確定し、未 claim なら stale-drop。\n * controller を解放し in-flight を減らし、policy の bookkeeping を進める。冪等。\n */\n finalize(ticket: OperationTicket): void {\n const operationId = ticket.operationId;\n const status = this._terminal.get(operationId);\n if (status !== undefined && status !== \"committing\") {\n // 既に確定済み。冪等に return。\n return;\n }\n let outcome: TerminalOutcome;\n if (status === \"committing\") {\n outcome = this._claimedOutcome.get(operationId) ?? \"stale\";\n } else {\n // 一度も claim されなかった (supersede / dispose で eligibility を失った)。\n outcome = \"stale\";\n }\n this._terminal.set(operationId, outcome);\n this._claimedOutcome.delete(operationId);\n this._releaseController(operationId);\n this._attempts.delete(operationId);\n if (this._inFlightCount > 0) this._inFlightCount -= 1;\n this._advanceBookkeeping(operationId);\n if (this._trace !== undefined) {\n if (outcome === \"stale\") {\n this._trace({ type: \"io:stale-dropped\", operationId, laneKey: this.laneKey });\n } else {\n this._trace({ type: \"io:operation-settled\", operationId, laneKey: this.laneKey, outcome });\n }\n }\n }\n\n /** operation の signal (resource 解放用)。withSignal でなければ undefined。 */\n signalOf(ticket: OperationTicket): AbortSignal | undefined {\n return this._controllers.get(ticket.operationId)?.signal;\n }\n\n /** best-effort な resource 中断。正しさは owner gen / eligibility / terminal CAS が担う。 */\n abort(ticket: OperationTicket): void {\n this._abortController(ticket.operationId);\n }\n\n /**\n * 現在 active な operation を中断する (利用者による明示キャンセル)。epoch は進めない —\n * 中断された operation は eligibility を保ったまま 'aborted' を claim できる\n * (loading をクリアしつつ in-flight 状態を残す)。\n */\n abortActive(): void {\n if (this._activeOperationId !== undefined) {\n this._abortController(this._activeOperationId);\n }\n for (const operationId of this._activeOperationIds) {\n this._abortController(operationId);\n }\n }\n\n /**\n * dispose (§4.1 world generation)。owner generation を bump して全 ticket を無効化し、\n * 生きている controller を全て abort する。dispose 後に settle した operation は\n * owner gen 不一致で外部 commit しない。retention gate (§10.3) のため live な\n * 全 operation を即時に stale として finalize し、controller / attempt を解放する。\n */\n disposeOwner(): void {\n this._ownerGeneration += 1;\n for (const operationId of Array.from(this._controllers.keys())) {\n this._abortController(operationId);\n // finalize は dispose 後 (terminal='stale') に early-return するため controller を\n // 解放しない。retention gate (§10.3) を満たすためここで明示的に解放する。\n this._releaseController(operationId);\n }\n for (const operationId of Array.from(this._attempts.keys())) {\n if (!this._terminal.has(operationId)) {\n this._terminal.set(operationId, \"stale\");\n }\n this._claimedOutcome.delete(operationId);\n this._attempts.delete(operationId);\n if (this._trace !== undefined) {\n this._trace({ type: \"io:stale-dropped\", operationId, laneKey: this.laneKey });\n }\n }\n this._activeOperationId = undefined;\n this._activeOperationIds.clear();\n this._queue.length = 0;\n this._inFlightCount = 0;\n }\n\n // --- internal ---\n\n private _makeAttempt(operationId: number, attemptNo: number): OperationAttempt {\n let signal: AbortSignal | undefined;\n // AbortController 不在環境(古い runtime / 一部 SSR)では degraded: signal なしで進む。\n // 正しさは owner generation / eligibility / terminal CAS が担うため、native 中断が\n // 無くても supersede / dispose は機能する(best-effort resource 中断が省かれるだけ)。\n if (this._withSignal && typeof AbortController === \"function\") {\n const controller = new AbortController();\n this._controllers.set(operationId, controller);\n signal = controller.signal;\n }\n return { operationId, attempt: attemptNo, signal };\n }\n\n private _isEligible(ticket: OperationTicket): boolean {\n switch (this.policy) {\n case \"latest\":\n return ticket.supersedeEpoch === this._latestEpoch;\n case \"queue\":\n case \"exhaust\":\n return this._activeOperationId === ticket.operationId;\n case \"overlap\":\n return this._activeOperationIds.has(ticket.operationId);\n }\n }\n\n private _advanceBookkeeping(operationId: number): void {\n switch (this.policy) {\n case \"latest\":\n case \"exhaust\":\n if (this._activeOperationId === operationId) {\n this._activeOperationId = undefined;\n }\n break;\n case \"queue\": {\n // 完了した ticket を FIFO から取り除き、次の先頭を active にする。filter で\n // 「先頭 / 非先頭 / 不在」を一様に扱う (finalize は冪等ガードを通った op のみ到達)。\n const remaining = this._queue.filter((t) => t.operationId !== operationId);\n this._queue.length = 0;\n this._queue.push(...remaining);\n this._activeOperationId = this._queue.length > 0 ? this._queue[0].operationId : undefined;\n break;\n }\n case \"overlap\":\n this._activeOperationIds.delete(operationId);\n break;\n }\n }\n\n private _abortController(operationId: number): void {\n const controller = this._controllers.get(operationId);\n if (controller !== undefined && !controller.signal.aborted) {\n controller.abort();\n }\n }\n\n private _releaseController(operationId: number): void {\n this._controllers.delete(operationId);\n }\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /io-core/platform-capability.ts by scripts/sync-io-core.mjs.\n// Run `node scripts/sync-io-core.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * platform-capability.ts\n *\n * Phase 6(docs/architecture-hardening/09-remediation-design.md §7.2 /\n * 07-browser-capability-variance.md)の browser capability 判定と error taxonomy の\n * 汎用プリミティブ。node 固有の capability registry / error code は各パッケージが\n * 別ファイルで宣言し、この汎用層(型 + assess 機構)を import する。\n *\n * 原則:\n * - feature detection は境界(利用直前)で行う。module 評価時に browser global を\n * 参照しない(SSR / worker で import が失敗しない)。\n * - capability ID(`web.fetch` 等)は文字列を global property path として eval せず、\n * registry が ID ごとに副作用のない presence probe を対応付ける。\n * - availability / permission / readiness / activity / operation error を 1 つの\n * `ready / unsupported / error` enum に畳まない。required 欠如は開始しない、\n * optional 欠如は宣言済み fallback で readiness を `degraded` にする。\n *\n * 配置: 本ファイルは /io-core/ の単一正典であり、scripts/sync-io-core.mjs が\n * 各 IO ノードの src/core/ へ生成コピー (AUTO-GENERATED, 編集禁止) を配布する。\n * `protocol/wcBindable.ts` と同じ copy-distribution 方式で、ランタイム依存を導入せず\n * 各パッケージのバンドルへ inline される (zero-runtime-dep / 自己完結 CDN を維持)。\n * 編集はこの正典に対して行い、`node scripts/sync-io-core.mjs` で再配布する。\n *\n * pure(module 評価時に browser global 非参照)。\n */\n\nexport type Availability = \"available\" | \"missing\" | \"unknown\";\nexport type PermissionState = \"granted\" | \"denied\" | \"prompt\" | \"not-applicable\" | \"unknown\";\nexport type Readiness = \"idle\" | \"ready\" | \"degraded\";\nexport type Activity = \"inactive\" | \"active\";\nexport type PreconditionState = \"satisfied\" | \"required\" | \"not-applicable\";\n\n/** operation error の phase(taxonomy)。 */\nexport type WcsIoErrorPhase = \"probe\" | \"start\" | \"execute\" | \"decode\" | \"commit\" | \"dispose\";\n\n/** serializable な error info(non-cloneable な cause とは分離。DevTools / remote へは info のみ)。 */\nexport interface WcsIoErrorInfo {\n readonly code: string;\n readonly phase: WcsIoErrorPhase;\n readonly recoverable: boolean;\n readonly capabilityId?: string;\n readonly message: string;\n}\n\nexport interface PlatformAssessment {\n readonly availability: ReadonlyMap<string, Availability>;\n readonly permission: PermissionState;\n readonly readiness: Readiness;\n readonly activity: Activity;\n readonly preconditions: {\n readonly secureContext: PreconditionState;\n readonly userActivation: PreconditionState;\n };\n readonly epoch: number;\n readonly lastError?: WcsIoErrorInfo;\n}\n\n/** capability 1 件の仕様。probe は副作用なく presence を返す(利用直前に呼ぶ)。 */\nexport interface CapabilitySpec {\n readonly probe: () => boolean;\n readonly requiresSecureContext?: boolean;\n readonly requiresUserActivation?: boolean;\n /** browser compatibility dataset のキー(任意・診断用)。 */\n readonly compatKey?: string;\n}\n\nexport type CapabilityRegistry = ReadonlyMap<string, CapabilitySpec>;\n\nexport interface AssessOptions {\n readonly required: readonly string[];\n readonly optional?: readonly string[];\n readonly permission?: PermissionState;\n readonly activity?: Activity;\n readonly epoch?: number;\n readonly lastError?: WcsIoErrorInfo;\n}\n\nfunction isSecureContext(): boolean {\n return (globalThis as { isSecureContext?: unknown }).isSecureContext === true;\n}\n\n/**\n * capability を利用直前に評価して PlatformAssessment を作る。\n * required が 1 つでも欠ければ readiness は \"idle\"(開始不可)、\n * required 揃い + optional 欠けは \"degraded\"、全揃いは \"ready\"。\n */\nexport function assessCapabilities(registry: CapabilityRegistry, options: AssessOptions): PlatformAssessment {\n const availability = new Map<string, Availability>();\n const evaluate = (id: string): Availability => {\n const spec = registry.get(id);\n if (spec === undefined) return \"unknown\";\n return spec.probe() ? \"available\" : \"missing\";\n };\n\n let requiredAllAvailable = true;\n for (const id of options.required) {\n const a = evaluate(id);\n availability.set(id, a);\n if (a !== \"available\") requiredAllAvailable = false;\n }\n let optionalAllAvailable = true;\n for (const id of options.optional ?? []) {\n const a = evaluate(id);\n availability.set(id, a);\n if (a !== \"available\") optionalAllAvailable = false;\n }\n\n const readiness: Readiness = !requiredAllAvailable ? \"idle\" : (optionalAllAvailable ? \"ready\" : \"degraded\");\n\n // preconditions: 対象 capability のいずれかが要求する場合だけ評価する。\n const allIds = [...options.required, ...(options.optional ?? [])];\n const needsSecure = allIds.some((id) => registry.get(id)?.requiresSecureContext === true);\n const needsActivation = allIds.some((id) => registry.get(id)?.requiresUserActivation === true);\n const secureContext: PreconditionState = needsSecure ? (isSecureContext() ? \"satisfied\" : \"required\") : \"not-applicable\";\n const userActivation: PreconditionState = needsActivation ? \"required\" : \"not-applicable\";\n\n return {\n availability,\n permission: options.permission ?? \"not-applicable\",\n readiness,\n activity: options.activity ?? \"inactive\",\n preconditions: { secureContext, userActivation },\n epoch: options.epoch ?? 0,\n lastError: options.lastError,\n };\n}\n\n/** availability から「required がすべて available か」を判定するヘルパ(supported の最低条件)。 */\nexport function requiredCapabilitiesAvailable(assessment: PlatformAssessment, required: readonly string[]): boolean {\n return required.every((id) => assessment.availability.get(id) === \"available\");\n}\n","/**\n * eyedropperCapabilities.ts\n *\n * EyeDropper node 固有の capability registry と error code。汎用の assess 機構・型は\n * `./platformCapability.js`(/io-core/ から copy-distribution される生成ファイル)から\n * import する。node 固有の宣言はこのハンドライトファイルに置き、生成コピーとは分離する。\n */\n\nimport { CapabilityRegistry, CapabilitySpec } from \"./platformCapability.js\";\n\n/** 安定した eyedropper error code(taxonomy)。値は公開キーとして固定。 */\nexport const WCS_EYEDROPPER_ERROR_CODE = {\n CapabilityMissing: \"capability-missing\",\n PickFailed: \"pick-failed\",\n} as const;\n\n/** eyedropper node の capability registry。文字列 ID を eval せず明示 probe を持つ。 */\nexport const EYEDROPPER_CAPABILITIES: CapabilityRegistry = new Map<string, CapabilitySpec>([\n [\"web.eyedropper\", { probe: () => typeof (globalThis as { EyeDropper?: unknown }).EyeDropper === \"function\", compatKey: \"api.EyeDropper\" }],\n]);\n","import { IWcBindable, WcsEyedropperData } from \"../types.js\";\nimport { OperationLane, OperationTicket } from \"./operationLane.js\";\nimport {\n PlatformAssessment,\n WcsIoErrorInfo,\n WcsIoErrorPhase,\n assessCapabilities,\n requiredCapabilitiesAvailable,\n} from \"./platformCapability.js\";\nimport { EYEDROPPER_CAPABILITIES, WCS_EYEDROPPER_ERROR_CODE } from \"./eyedropperCapabilities.js\";\n\n/**\n * Headless EyeDropper primitive. A thin, framework-agnostic wrapper around\n * `new EyeDropper().open(options)` exposed through the wc-bindable protocol.\n *\n * Concurrency is owned by the shared `OperationLane` (io-core) with the `latest`\n * policy: `EyeDropper.open()` accepts a `{signal}`, so — unlike Web Share / Contact\n * Picker (exhaust) — a caller has a real platform mechanism to cancel an in-flight\n * pick. A new `open()` supersedes the previous one (the lane aborts its\n * AbortController and the superseded completion fails the terminal CAS), and the\n * `abort()` command aborts the active pick. This replaces the ad-hoc `_gen` +\n * `_abortController` + finally-block identity check with the same lane FetchCore\n * uses; the lane owns the per-attempt AbortController and the commit guard.\n *\n * Both the user dismissing the picker with Escape and the caller invoking\n * `abort()` reject `open()` with the same `AbortError` — both land on `cancelled`\n * without distinction (docs/eyedropper-tag-design.md §2).\n */\nexport class EyedropperCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"value\", event: \"wcs-eyedropper:complete\", getter: (e: Event) => (e as CustomEvent).detail.value },\n { name: \"loading\", event: \"wcs-eyedropper:loading-changed\" },\n { name: \"error\", event: \"wcs-eyedropper:error\" },\n { name: \"cancelled\", event: \"wcs-eyedropper:cancelled-changed\" },\n // Serializable failure taxonomy (stable code / phase / recoverable), or null.\n // Additive bindable output; the existing `error` property/event are unchanged.\n // Fires its own `wcs-eyedropper:error-info-changed` event; no getter, so the\n // bound value is the event detail (mirrors `error` / `loading` / `cancelled`).\n { name: \"errorInfo\", event: \"wcs-eyedropper:error-info-changed\" },\n ],\n commands: [\n { name: \"open\", async: true },\n { name: \"abort\" },\n ],\n };\n\n // Required capability (probed at call time, never at module eval).\n private static readonly REQUIRED_CAPABILITIES = [\"web.eyedropper\"] as const;\n\n private _target: EventTarget;\n private _value: WcsEyedropperData | null = null;\n private _loading: boolean = false;\n private _error: any = null;\n private _cancelled: boolean = false;\n private _errorInfo: WcsIoErrorInfo | null = null;\n // Concurrency lane (io-core). `latest`: a new open() supersedes + aborts the\n // in-flight one (switchMap). `withSignal: true`: the lane owns the per-attempt\n // AbortController whose signal is passed to EyeDropper.open(). dispose() bumps\n // the owner generation and aborts.\n private _lane = new OperationLane(\"eyedropper\", \"latest\", { withSignal: true });\n // SSR (§3.8): no asynchronous probe to await, so readiness is 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 value(): WcsEyedropperData | null {\n return this._value;\n }\n\n get loading(): boolean {\n return this._loading;\n }\n\n get error(): any {\n return this._error;\n }\n\n get cancelled(): boolean {\n return this._cancelled;\n }\n\n /**\n * The last failure's serializable `WcsIoErrorInfo` (stable `code` / `phase` /\n * `recoverable` / `capabilityId`), or null. Exposed as an additive wc-bindable\n * property (event `wcs-eyedropper:error-info-changed`); the existing `error`\n * property/event are unchanged. Note user/abort cancellation is `cancelled`, not\n * `errorInfo`.\n */\n get errorInfo(): WcsIoErrorInfo | null {\n return this._errorInfo;\n }\n\n /**\n * Whether the required platform capability (`web.eyedropper`) is available right\n * now — decided by call-time feature detection, not User-Agent. Core-only,\n * additive.\n */\n get supported(): boolean {\n return requiredCapabilitiesAvailable(this.platformAssessment, EyedropperCore.REQUIRED_CAPABILITIES);\n }\n\n /**\n * Full platform assessment (availability / readiness / preconditions), probed at\n * call time. Core-only opt-in dev / sidecar view.\n */\n get platformAssessment(): PlatformAssessment {\n return assessCapabilities(EYEDROPPER_CAPABILITIES, {\n required: EyedropperCore.REQUIRED_CAPABILITIES,\n activity: this._loading ? \"active\" : \"inactive\",\n lastError: this._errorInfo ?? undefined,\n });\n }\n\n // Lifecycle (§3.5). EyeDropper is command-driven with no subscription to\n // establish, so observe() is an idempotent no-op that resolves once ready;\n // dispose() bumps the lane's owner generation (invalidating any in-flight open())\n // and aborts its AbortController.\n observe(): Promise<void> {\n return this._ready;\n }\n\n dispose(): void {\n this._lane.disposeOwner();\n }\n\n // CommitGuard (§5.1): external setters / event dispatch only run if the ticket\n // still holds owner generation, is pre-terminal, and is the lane's latest epoch\n // (a superseding open() can invalidate a ticket mid-commit).\n private _commitStep(ticket: OperationTicket, step: () => void): void {\n if (this._lane.canCommit(ticket)) {\n step();\n }\n }\n\n private _setLoading(loading: boolean): void {\n if (this._loading === loading) return;\n this._loading = loading;\n this._target.dispatchEvent(new CustomEvent(\"wcs-eyedropper:loading-changed\", {\n detail: loading,\n bubbles: true,\n }));\n }\n\n private _setValue(value: WcsEyedropperData | null): void {\n if (this._value === value) return;\n this._value = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-eyedropper:complete\", {\n detail: { value },\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-eyedropper:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n private _setCancelled(cancelled: boolean): void {\n if (this._cancelled === cancelled) return;\n this._cancelled = cancelled;\n this._target.dispatchEvent(new CustomEvent(\"wcs-eyedropper:cancelled-changed\", {\n detail: cancelled,\n bubbles: true,\n }));\n }\n\n // Single mutation point for `errorInfo`, mirroring `_setError`'s same-value guard\n // and event dispatch so the additive `errorInfo` wc-bindable property stays in\n // sync with `error`. Each failure builds a fresh object (reference guard passes);\n // the clear path passes null (suppresses a redundant null→null per open start).\n private _setErrorInfo(code: string, phase: WcsIoErrorPhase, recoverable: boolean, message: string, capabilityId?: string): void {\n this._commitErrorInfo({ code, phase, recoverable, message, ...(capabilityId === undefined ? {} : { capabilityId }) });\n }\n\n private _commitErrorInfo(info: WcsIoErrorInfo | null): void {\n if (this._errorInfo === info) return;\n this._errorInfo = info;\n this._target.dispatchEvent(new CustomEvent(\"wcs-eyedropper:error-info-changed\", {\n detail: info,\n bubbles: true,\n }));\n }\n\n /**\n * Cancels an in-flight `open()` call, if any (a no-op otherwise). Aborts the\n * lane's active AbortController — the in-flight open() then rejects with\n * `AbortError` and lands on `cancelled`. The epoch is not advanced, so the\n * aborted operation keeps eligibility to claim the `aborted` terminal.\n */\n abort(): void {\n this._lane.abortActive();\n }\n\n async open(): Promise<WcsEyedropperData | null> {\n // never-throw + unsupported (§4 / §7.2): probe the required capability at call\n // time (non-Chromium browsers lack this API). If `web.eyedropper` is absent, do\n // NOT start — surface a stable `capability-missing` taxonomy and the existing\n // error message shape.\n const assessment = this.platformAssessment;\n if (!requiredCapabilitiesAvailable(assessment, EyedropperCore.REQUIRED_CAPABILITIES)) {\n const missing = EyedropperCore.REQUIRED_CAPABILITIES.find((id) => assessment.availability.get(id) !== \"available\");\n const message = \"EyeDropper API is not supported in this browser.\";\n this._setErrorInfo(WCS_EYEDROPPER_ERROR_CODE.CapabilityMissing, \"start\", false, message, missing);\n this._setError({ message });\n return null;\n }\n\n // `latest`: advance the epoch and abort the previous in-flight pick (supersede).\n // begin() never returns null for latest.\n const started = this._lane.begin()!;\n const { ticket, attempt } = started;\n const signal = attempt.signal;\n\n // Capability probed above → EyeDropper is present. Resolve the constructor at\n // call time (never cached, §3.7) so tests can install/remove it freely.\n const EyeDropperCtor = (globalThis as { EyeDropper?: new () => { open(options?: { signal?: AbortSignal }): Promise<WcsEyedropperData> } }).EyeDropper!;\n\n this._commitStep(ticket, () => this._setLoading(true));\n // Reset the previous outcome before starting a new open() so a stale\n // cancelled/error/errorInfo does not linger into this call's result.\n this._commitStep(ticket, () => {\n this._commitErrorInfo(null);\n this._setError(null);\n this._setCancelled(false);\n });\n\n try {\n const result = await new EyeDropperCtor().open({ signal });\n // Terminal CAS: a stale (superseded / dispose-invalidated) completion loses\n // the claim and is dropped without writing state.\n if (!this._lane.claimTerminal(ticket, \"success\")) {\n return null;\n }\n // The platform's own result object ({ sRGBHex }) is used verbatim (§3).\n // Separate commit steps (like FetchCore): if `_setValue`'s event listener\n // synchronously supersedes this op, the following `_setLoading(false)` is\n // stopped by the commit guard rather than clobbering the newer op.\n this._commitStep(ticket, () => this._setValue(result));\n this._commitStep(ticket, () => this._setLoading(false));\n this._lane.finalize(ticket);\n return result;\n } catch (e: any) {\n const cancelled = e?.name === \"AbortError\";\n if (!this._lane.claimTerminal(ticket, cancelled ? \"aborted\" : \"error\")) {\n return null;\n }\n this._commitStep(ticket, () => {\n if (cancelled) {\n // Either the user dismissed the picker with Escape or the caller invoked\n // abort() — a routine cancellation, not a platform failure, and not\n // distinguished (§2). Kept out of `error`/`errorInfo`.\n this._setCancelled(true);\n } else {\n const message = String(e?.message ?? \"Color pick failed.\");\n this._setErrorInfo(WCS_EYEDROPPER_ERROR_CODE.PickFailed, \"execute\", true, message);\n this._setError(e ?? { message });\n }\n });\n this._commitStep(ticket, () => this._setLoading(false));\n this._lane.finalize(ticket);\n return null;\n }\n }\n}\n","import { IWcBindable, WcsEyedropperData } from \"../types.js\";\nimport { EyedropperCore } from \"../core/EyedropperCore.js\";\nimport { WcsIoErrorInfo } from \"../core/platformCapability.js\";\n\n/**\n * `<wcs-eyedropper>` — declarative EyeDropper API primitive.\n *\n * The smallest command-only Shell in the batch (docs/eyedropper-tag-design.md\n * §5), mirroring `<wcs-share>`: no attributes at all. `open()` takes no\n * per-call argument — the `{signal}` option is supplied internally by the\n * Core's own AbortController, never via the command-token surface.\n */\nexport class WcsEyedropper extends HTMLElement {\n // SSR (§4.4): observe() completes synchronously, but the Shell still exposes\n // connectedCallbackPromise so the state binder can await it uniformly across\n // all IO nodes before snapshotting.\n static hasConnectedCallbackPromise = true;\n\n static wcBindable: IWcBindable = {\n ...EyedropperCore.wcBindable,\n inputs: [],\n // Core の commands をそのまま継承(単一情報源)。\n commands: EyedropperCore.wcBindable.commands,\n };\n\n private _core: EyedropperCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new EyedropperCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-eyedropper:loading-changed\": (d) => ({ loading: d === true }),\n \"wcs-eyedropper:cancelled-changed\": (d) => ({ cancelled: d === true }),\n \"wcs-eyedropper: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 value(): WcsEyedropperData | null {\n return this._core.value;\n }\n\n get loading(): boolean {\n return this._core.loading;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get cancelled(): boolean {\n return this._core.cancelled;\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 ---\n\n open(): Promise<WcsEyedropperData | null> {\n return this._core.open();\n }\n\n abort(): void {\n this._core.abort();\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 { WcsEyedropper } from \"./components/Eyedropper.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.eyedropper)) {\n customElements.define(config.tagNames.eyedropper, WcsEyedropper);\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapEyedropper(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,UAAU,EAAE,gBAAgB;AAC7B,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;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,MAAM,GAAY,OAAkB;SAEjC,SAAS,GAAA;IACvB,IAAI,CAAC,YAAY,EAAE;QACjB,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,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const r of Object.keys(e))t(e[r]);return e}function r(e){if(null===e||"object"!=typeof e)return e;const t={};for(const n of Object.keys(e))t[n]=r(e[n]);return t}let n=null;const s=e;function o(){return n||(n=t(r(e))),n}class a extends EventTarget{static wcBindable={protocol:"wc-bindable",version:1,properties:[{name:"value",event:"wcs-eyedropper:complete",getter:e=>e.detail.value},{name:"loading",event:"wcs-eyedropper:loading-changed"},{name:"error",event:"wcs-eyedropper:error"},{name:"cancelled",event:"wcs-eyedropper:cancelled-changed"}],commands:[{name:"open",async:!0},{name:"abort"}]};_target;_value=null;_loading=!1;_error=null;_cancelled=!1;_abortController=null;_gen=0;_ready=Promise.resolve();constructor(e){super(),this._target=e??this}get ready(){return this._ready}get value(){return this._value}get loading(){return this._loading}get error(){return this._error}get cancelled(){return this._cancelled}observe(){return this._ready}dispose(){this._gen++,this.abort()}_setLoading(e){this._loading!==e&&(this._loading=e,this._target.dispatchEvent(new CustomEvent("wcs-eyedropper:loading-changed",{detail:e,bubbles:!0})))}_setValue(e){this._value!==e&&(this._value=e,this._target.dispatchEvent(new CustomEvent("wcs-eyedropper:complete",{detail:{value:e},bubbles:!0})))}_setError(e){this._error!==e&&(this._error=e,this._target.dispatchEvent(new CustomEvent("wcs-eyedropper:error",{detail:e,bubbles:!0})))}_setCancelled(e){this._cancelled!==e&&(this._cancelled=e,this._target.dispatchEvent(new CustomEvent("wcs-eyedropper:cancelled-changed",{detail:e,bubbles:!0})))}_api(){const e=globalThis;return"function"==typeof e.EyeDropper?e.EyeDropper:void 0}abort(){this._abortController&&(this._abortController.abort(),this._abortController=null)}async open(){const e=this._api();if(!e)return this._setError({message:"EyeDropper API is not supported in this browser."}),null;this.abort();const t=new AbortController;this._abortController=t;const{signal:r}=t,n=++this._gen;this._setLoading(!0),this._setError(null),this._setCancelled(!1);try{const t=await(new e).open({signal:r});return n!==this._gen?null:(this._setValue(t),this._setLoading(!1),t)}catch(e){return n!==this._gen||("AbortError"===e?.name?this._setCancelled(!0):this._setError(e),this._setLoading(!1)),null}finally{this._abortController===t&&(this._abortController=null)}}}class l extends HTMLElement{static hasConnectedCallbackPromise=!0;static wcBindable={...a.wcBindable,inputs:[],commands:a.wcBindable.commands};_core;_connectedCallbackPromise=Promise.resolve();_internals=null;constructor(){super(),this._core=new a(this),this._internals=this._initInternals(),this._wireStates({"wcs-eyedropper:loading-changed":e=>({loading:!0===e}),"wcs-eyedropper:cancelled-changed":e=>({cancelled:!0===e}),"wcs-eyedropper: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,n]of Object.entries(e))this.addEventListener(r,e=>{const r=this.hasAttribute("debug-states");for(const[s,o]of Object.entries(n(e.detail))){try{o?t.add(s):t.delete(s)}catch{}r&&this.toggleAttribute(`data-wcs-state-${s}`,o)}})}get value(){return this._core.value}get loading(){return this._core.loading}get error(){return this._core.error}get cancelled(){return this._core.cancelled}get connectedCallbackPromise(){return this._connectedCallbackPromise}open(){return this._core.open()}abort(){this._core.abort()}connectedCallback(){this.style.display="none",this._connectedCallbackPromise=this._core.observe()}disconnectedCallback(){this._core.dispose()}}function i(t){var r;t&&((r=t).tagNames&&Object.assign(e.tagNames,r.tagNames),n=null),customElements.get(s.tagNames.eyedropper)||customElements.define(s.tagNames.eyedropper,l)}export{a as EyedropperCore,l as WcsEyedropper,i as bootstrapEyedropper,o as getConfig};
|
|
1
|
+
const e={tagNames:{eyedropper:"wcs-eyedropper"}};function t(e){if(null===e||"object"!=typeof e)return e;Object.freeze(e);for(const i of Object.keys(e))t(e[i]);return e}function i(e){if(null===e||"object"!=typeof e)return e;const t={};for(const r of Object.keys(e))t[r]=i(e[r]);return t}let r=null;const s=e;function n(){return r||(r=t(i(e))),r}class o{laneKey;policy;_ownerGeneration=0;_latestEpoch=0;_nextOperationId=1;_activeOperationId=void 0;_activeOperationIds=new Set;_queue=[];_inFlightCount=0;_terminal=new Map;_claimedOutcome=new Map;_controllers=new Map;_attempts=new Map;_withSignal;_trace;constructor(e,t,i={}){this.laneKey=e,this.policy=t,this._withSignal=i.withSignal??!1,this._trace=i.trace}get ownerGeneration(){return this._ownerGeneration}get inFlightCount(){return this._inFlightCount}get latestEpoch(){return this._latestEpoch}get activeOperationId(){return this._activeOperationId}begin(){let e;switch(this.policy){case"latest":e=++this._latestEpoch,void 0!==this._activeOperationId&&this._abortController(this._activeOperationId);break;case"exhaust":if(void 0!==this._activeOperationId)return null}const t=this._nextOperationId++,i={operationId:t,ownerGeneration:this._ownerGeneration,laneKey:this.laneKey,policy:this.policy,supersedeEpoch:e};switch(this.policy){case"latest":case"exhaust":this._activeOperationId=t;break;case"queue":this._queue.push(i),void 0===this._activeOperationId&&(this._activeOperationId=t);break;case"overlap":this._activeOperationIds.add(t)}this._inFlightCount+=1,this._attempts.set(t,1);const r=this._makeAttempt(t,1);return void 0!==this._trace&&this._trace({type:"io:operation-started",operationId:t,laneKey:this.laneKey,policy:this.policy}),{ticket:i,attempt:r}}retry(e){if(e.ownerGeneration!==this._ownerGeneration)return null;if(this._terminal.has(e.operationId))return null;const t=this._attempts.get(e.operationId);if(void 0===t)return null;const i=t+1;this._attempts.set(e.operationId,i),this._releaseController(e.operationId);const r=this._makeAttempt(e.operationId,i);return void 0!==this._trace&&this._trace({type:"io:operation-retried",operationId:e.operationId,laneKey:this.laneKey,attempt:i}),r}canCommit(e){if(e.ownerGeneration!==this._ownerGeneration)return!1;const t=this._terminal.get(e.operationId);return(void 0===t||"committing"===t)&&this._isEligible(e)}claimTerminal(e,t){return e.ownerGeneration===this._ownerGeneration&&(!this._terminal.has(e.operationId)&&(!!this._isEligible(e)&&(this._terminal.set(e.operationId,"committing"),this._claimedOutcome.set(e.operationId,t),!0)))}claimedOutcome(e){return this._claimedOutcome.get(e.operationId)}finalize(e){const t=e.operationId,i=this._terminal.get(t);if(void 0!==i&&"committing"!==i)return;let r;r="committing"===i?this._claimedOutcome.get(t)??"stale":"stale",this._terminal.set(t,r),this._claimedOutcome.delete(t),this._releaseController(t),this._attempts.delete(t),this._inFlightCount>0&&(this._inFlightCount-=1),this._advanceBookkeeping(t),void 0!==this._trace&&("stale"===r?this._trace({type:"io:stale-dropped",operationId:t,laneKey:this.laneKey}):this._trace({type:"io:operation-settled",operationId:t,laneKey:this.laneKey,outcome:r}))}signalOf(e){return this._controllers.get(e.operationId)?.signal}abort(e){this._abortController(e.operationId)}abortActive(){void 0!==this._activeOperationId&&this._abortController(this._activeOperationId);for(const e of this._activeOperationIds)this._abortController(e)}disposeOwner(){this._ownerGeneration+=1;for(const e of Array.from(this._controllers.keys()))this._abortController(e),this._releaseController(e);for(const e of Array.from(this._attempts.keys()))this._terminal.has(e)||this._terminal.set(e,"stale"),this._claimedOutcome.delete(e),this._attempts.delete(e),void 0!==this._trace&&this._trace({type:"io:stale-dropped",operationId:e,laneKey:this.laneKey});this._activeOperationId=void 0,this._activeOperationIds.clear(),this._queue.length=0,this._inFlightCount=0}_makeAttempt(e,t){let i;if(this._withSignal&&"function"==typeof AbortController){const t=new AbortController;this._controllers.set(e,t),i=t.signal}return{operationId:e,attempt:t,signal:i}}_isEligible(e){switch(this.policy){case"latest":return e.supersedeEpoch===this._latestEpoch;case"queue":case"exhaust":return this._activeOperationId===e.operationId;case"overlap":return this._activeOperationIds.has(e.operationId)}}_advanceBookkeeping(e){switch(this.policy){case"latest":case"exhaust":this._activeOperationId===e&&(this._activeOperationId=void 0);break;case"queue":{const t=this._queue.filter(t=>t.operationId!==e);this._queue.length=0,this._queue.push(...t),this._activeOperationId=this._queue.length>0?this._queue[0].operationId:void 0;break}case"overlap":this._activeOperationIds.delete(e)}}_abortController(e){const t=this._controllers.get(e);void 0===t||t.signal.aborted||t.abort()}_releaseController(e){this._controllers.delete(e)}}function a(e,t){const i=new Map,r=t=>{const i=e.get(t);return void 0===i?"unknown":i.probe()?"available":"missing"};let s=!0;for(const e of t.required){const t=r(e);i.set(e,t),"available"!==t&&(s=!1)}let n=!0;for(const e of t.optional??[]){const t=r(e);i.set(e,t),"available"!==t&&(n=!1)}const o=s?n?"ready":"degraded":"idle",a=[...t.required,...t.optional??[]],l=a.some(t=>!0===e.get(t)?.requiresSecureContext),c=a.some(t=>!0===e.get(t)?.requiresUserActivation),h=l?!0===globalThis.isSecureContext?"satisfied":"required":"not-applicable",d=c?"required":"not-applicable";return{availability:i,permission:t.permission??"not-applicable",readiness:o,activity:t.activity??"inactive",preconditions:{secureContext:h,userActivation:d},epoch:t.epoch??0,lastError:t.lastError}}function l(e,t){return t.every(t=>"available"===e.availability.get(t))}const c={CapabilityMissing:"capability-missing",PickFailed:"pick-failed"},h=new Map([["web.eyedropper",{probe:()=>"function"==typeof globalThis.EyeDropper,compatKey:"api.EyeDropper"}]]);class d extends EventTarget{static wcBindable={protocol:"wc-bindable",version:1,properties:[{name:"value",event:"wcs-eyedropper:complete",getter:e=>e.detail.value},{name:"loading",event:"wcs-eyedropper:loading-changed"},{name:"error",event:"wcs-eyedropper:error"},{name:"cancelled",event:"wcs-eyedropper:cancelled-changed"},{name:"errorInfo",event:"wcs-eyedropper:error-info-changed"}],commands:[{name:"open",async:!0},{name:"abort"}]};static REQUIRED_CAPABILITIES=["web.eyedropper"];_target;_value=null;_loading=!1;_error=null;_cancelled=!1;_errorInfo=null;_lane=new o("eyedropper","latest",{withSignal:!0});_ready=Promise.resolve();constructor(e){super(),this._target=e??this}get ready(){return this._ready}get value(){return this._value}get loading(){return this._loading}get error(){return this._error}get cancelled(){return this._cancelled}get errorInfo(){return this._errorInfo}get supported(){return l(this.platformAssessment,d.REQUIRED_CAPABILITIES)}get platformAssessment(){return a(h,{required:d.REQUIRED_CAPABILITIES,activity:this._loading?"active":"inactive",lastError:this._errorInfo??void 0})}observe(){return this._ready}dispose(){this._lane.disposeOwner()}_commitStep(e,t){this._lane.canCommit(e)&&t()}_setLoading(e){this._loading!==e&&(this._loading=e,this._target.dispatchEvent(new CustomEvent("wcs-eyedropper:loading-changed",{detail:e,bubbles:!0})))}_setValue(e){this._value!==e&&(this._value=e,this._target.dispatchEvent(new CustomEvent("wcs-eyedropper:complete",{detail:{value:e},bubbles:!0})))}_setError(e){this._error!==e&&(this._error=e,this._target.dispatchEvent(new CustomEvent("wcs-eyedropper:error",{detail:e,bubbles:!0})))}_setCancelled(e){this._cancelled!==e&&(this._cancelled=e,this._target.dispatchEvent(new CustomEvent("wcs-eyedropper:cancelled-changed",{detail:e,bubbles:!0})))}_setErrorInfo(e,t,i,r,s){this._commitErrorInfo({code:e,phase:t,recoverable:i,message:r,...void 0===s?{}:{capabilityId:s}})}_commitErrorInfo(e){this._errorInfo!==e&&(this._errorInfo=e,this._target.dispatchEvent(new CustomEvent("wcs-eyedropper:error-info-changed",{detail:e,bubbles:!0})))}abort(){this._lane.abortActive()}async open(){const e=this.platformAssessment;if(!l(e,d.REQUIRED_CAPABILITIES)){const t=d.REQUIRED_CAPABILITIES.find(t=>"available"!==e.availability.get(t)),i="EyeDropper API is not supported in this browser.";return this._setErrorInfo(c.CapabilityMissing,"start",!1,i,t),this._setError({message:i}),null}const t=this._lane.begin(),{ticket:i,attempt:r}=t,s=r.signal,n=globalThis.EyeDropper;this._commitStep(i,()=>this._setLoading(!0)),this._commitStep(i,()=>{this._commitErrorInfo(null),this._setError(null),this._setCancelled(!1)});try{const e=await(new n).open({signal:s});return this._lane.claimTerminal(i,"success")?(this._commitStep(i,()=>this._setValue(e)),this._commitStep(i,()=>this._setLoading(!1)),this._lane.finalize(i),e):null}catch(e){const t="AbortError"===e?.name;return this._lane.claimTerminal(i,t?"aborted":"error")?(this._commitStep(i,()=>{if(t)this._setCancelled(!0);else{const t=String(e?.message??"Color pick failed.");this._setErrorInfo(c.PickFailed,"execute",!0,t),this._setError(e??{message:t})}}),this._commitStep(i,()=>this._setLoading(!1)),this._lane.finalize(i),null):null}}}class p extends HTMLElement{static hasConnectedCallbackPromise=!0;static wcBindable={...d.wcBindable,inputs:[],commands:d.wcBindable.commands};_core;_connectedCallbackPromise=Promise.resolve();_internals=null;constructor(){super(),this._core=new d(this),this._internals=this._initInternals(),this._wireStates({"wcs-eyedropper:loading-changed":e=>({loading:!0===e}),"wcs-eyedropper:cancelled-changed":e=>({cancelled:!0===e}),"wcs-eyedropper: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[i,r]of Object.entries(e))this.addEventListener(i,e=>{const i=this.hasAttribute("debug-states");for(const[s,n]of Object.entries(r(e.detail))){try{n?t.add(s):t.delete(s)}catch{}i&&this.toggleAttribute(`data-wcs-state-${s}`,n)}})}get value(){return this._core.value}get loading(){return this._core.loading}get error(){return this._core.error}get cancelled(){return this._core.cancelled}get errorInfo(){return this._core.errorInfo}get connectedCallbackPromise(){return this._connectedCallbackPromise}open(){return this._core.open()}abort(){this._core.abort()}connectedCallback(){this.style.display="none",this._connectedCallbackPromise=this._core.observe()}disconnectedCallback(){this._core.dispose()}}function _(t){var i;t&&((i=t).tagNames&&Object.assign(e.tagNames,i.tagNames),r=null),customElements.get(s.tagNames.eyedropper)||customElements.define(s.tagNames.eyedropper,p)}export{d as EyedropperCore,c as WCS_EYEDROPPER_ERROR_CODE,p as WcsEyedropper,_ as bootstrapEyedropper,n 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/EyedropperCore.ts","../src/components/Eyedropper.ts","../src/bootstrapEyedropper.ts","../src/registerComponents.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n eyedropper: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n eyedropper: \"wcs-eyedropper\",\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\n// Note: this is the live, mutable internal config. It is not part of the public\n// package exports (see exports.ts) — only `getConfig()` (a frozen snapshot) is\n// surfaced. `setConfig()` is applied internally via `bootstrapEyedropper()` and\n// is not re-exported from the package root, though a deep path import\n// (`.../src/config.js`) can still reach and mutate it. Accepted as-is for\n// cross-package consistency: every @wcstack package follows this same shape.\n// Use `getConfig()` for a frozen, safe read.\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, WcsEyedropperData } from \"../types.js\";\n\n/**\n * Headless EyeDropper primitive. A thin, framework-agnostic wrapper around\n * `new EyeDropper().open(options)` exposed through the wc-bindable protocol.\n *\n * This is a simplified derivative of `FetchCore._doFetch`\n * (docs/eyedropper-tag-design.md §1, docs/web-share-tag-design.md §2): it\n * keeps the single `_gen` generation guard, the same-value-guarded private\n * setters, and the never-throw try/catch wrapper — the same skeleton\n * `@wcstack/share`'s `ShareCore` uses.\n *\n * Unlike `ShareCore`, this Core **does** restore `AbortController`/`abort()`\n * (docs/eyedropper-tag-design.md §2): `EyeDropper.open()` accepts a `{signal}`\n * option, so — unlike Web Share — a caller has a real platform mechanism to\n * cancel an in-flight color pick. The shape mirrors `FetchCore.abort()`\n * (packages/fetch/src/core/FetchCore.ts:159-164) including the identity check\n * on the locally-held `AbortController` in the `finally` block\n * (packages/fetch/src/core/FetchCore.ts:312-314), so a fast abort()→open()\n * sequence never lets a stale controller null out the new call's controller.\n *\n * Both the user dismissing the picker with Escape and the caller invoking\n * `abort()` reject `open()` with the same `AbortError` — both land on\n * `cancelled` without distinction (docs/eyedropper-tag-design.md §2).\n */\nexport class EyedropperCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"value\", event: \"wcs-eyedropper:complete\", getter: (e: Event) => (e as CustomEvent).detail.value },\n { name: \"loading\", event: \"wcs-eyedropper:loading-changed\" },\n { name: \"error\", event: \"wcs-eyedropper:error\" },\n { name: \"cancelled\", event: \"wcs-eyedropper:cancelled-changed\" },\n ],\n commands: [\n { name: \"open\", async: true },\n { name: \"abort\" },\n ],\n };\n\n private _target: EventTarget;\n private _value: WcsEyedropperData | null = null;\n private _loading: boolean = false;\n private _error: any = null;\n private _cancelled: boolean = false;\n private _abortController: AbortController | null = null;\n // Generation guard (§3.4 of the guidelines): bumped on dispose() (and each\n // open() start). An open() that settles after dispose() has a stale `gen`\n // and MUST NOT write state to a torn-down element. Not bumped on the\n // unsupported early-return — no asynchronous work is started, so there is\n // no generation to protect (docs/eyedropper-tag-design.md §4).\n private _gen = 0;\n // SSR (§3.8): no asynchronous probe to await, so readiness is 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 value(): WcsEyedropperData | null {\n return this._value;\n }\n\n get loading(): boolean {\n return this._loading;\n }\n\n get error(): any {\n return this._error;\n }\n\n get cancelled(): boolean {\n return this._cancelled;\n }\n\n // Lifecycle (§3.5). EyeDropper is command-driven with no subscription to\n // establish, so observe() is an idempotent no-op that resolves once ready;\n // dispose() invalidates any in-flight open() and aborts it.\n observe(): Promise<void> {\n return this._ready;\n }\n\n dispose(): void {\n this._gen++;\n this.abort();\n }\n\n private _setLoading(loading: boolean): void {\n if (this._loading === loading) return;\n this._loading = loading;\n this._target.dispatchEvent(new CustomEvent(\"wcs-eyedropper:loading-changed\", {\n detail: loading,\n bubbles: true,\n }));\n }\n\n private _setValue(value: WcsEyedropperData | null): void {\n if (this._value === value) return;\n this._value = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-eyedropper:complete\", {\n detail: { value },\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-eyedropper:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n private _setCancelled(cancelled: boolean): void {\n if (this._cancelled === cancelled) return;\n this._cancelled = cancelled;\n this._target.dispatchEvent(new CustomEvent(\"wcs-eyedropper:cancelled-changed\", {\n detail: cancelled,\n bubbles: true,\n }));\n }\n\n // API resolution is call-time, never cached (§3.7): lets tests install/remove\n // the global EyeDropper constructor freely and lets an unsupported\n // environment (non-Chromium browsers, as of 2026) be detected correctly on\n // every call (docs/eyedropper-tag-design.md §4).\n private _api(): (new () => { open(options?: { signal?: AbortSignal }): Promise<WcsEyedropperData> }) | undefined {\n const g = globalThis as any;\n return typeof g.EyeDropper === \"function\" ? g.EyeDropper : undefined;\n }\n\n /**\n * Cancels an in-flight `open()` call, if any. A no-op when no open() is in\n * flight (no AbortController has been created yet, or the previous one has\n * already settled) — mirrors `FetchCore.abort()`\n * (packages/fetch/src/core/FetchCore.ts:159-164).\n */\n abort(): void {\n if (this._abortController) {\n this._abortController.abort();\n this._abortController = null;\n }\n }\n\n async open(): Promise<WcsEyedropperData | null> {\n // never-throw + unsupported (§4): resolve API at call time and bail out\n // immediately if absent. No _gen bump — no asynchronous work is started,\n // so there is no generation to protect, and `new EyeDropper()` is never\n // constructed.\n const EyeDropperCtor = this._api();\n if (!EyeDropperCtor) {\n this._setError({ message: \"EyeDropper API is not supported in this browser.\" });\n return null;\n }\n\n // Cancel any previous in-flight pick before starting a new one (mirrors\n // FetchCore._doFetch's `this.abort()` at the top).\n this.abort();\n\n // Hold the controller in a local so the finally block (which can run after\n // a subsequent open() has already replaced this._abortController) only\n // clears the field when it still owns it — identical identity check to\n // FetchCore._doFetch (packages/fetch/src/core/FetchCore.ts:312-314). This\n // is what keeps a fast abort()→open() sequence from letting a stale\n // controller null out the new call's controller.\n const ac = new AbortController();\n this._abortController = ac;\n const { signal } = ac;\n\n const gen = ++this._gen;\n\n this._setLoading(true);\n // Reset the previous outcome before starting a new open() so a stale\n // cancelled/error does not linger into this call's result\n // (docs/eyedropper-tag-design.md §1, docs/web-share-tag-design.md §3).\n this._setError(null);\n this._setCancelled(false);\n\n try {\n const result = await new EyeDropperCtor().open({ signal });\n\n // Stale completion (dispose() ran, or a superseding open() ran, while\n // the picker was open). Drop the result without writing state.\n if (gen !== this._gen) {\n return null;\n }\n\n // The platform's own result object ({ sRGBHex }) is used verbatim — no\n // synthesis needed, unlike Web Share's `value`\n // (docs/eyedropper-tag-design.md §3).\n this._setValue(result);\n this._setLoading(false);\n return result;\n } catch (e: any) {\n // Stale completion (dispose() ran, or a superseding open() ran, while\n // the picker was open).\n if (gen !== this._gen) {\n return null;\n }\n if (e?.name === \"AbortError\") {\n // Either the user dismissed the picker with Escape, or the caller\n // invoked abort() — both are a routine cancellation, not a platform\n // failure, and are not distinguished (docs/eyedropper-tag-design.md\n // §2). Kept out of `error`.\n this._setCancelled(true);\n } else {\n this._setError(e);\n }\n this._setLoading(false);\n return null;\n } finally {\n if (this._abortController === ac) {\n this._abortController = null;\n }\n }\n }\n}\n","import { IWcBindable, WcsEyedropperData } from \"../types.js\";\nimport { EyedropperCore } from \"../core/EyedropperCore.js\";\n\n/**\n * `<wcs-eyedropper>` — declarative EyeDropper API primitive.\n *\n * The smallest command-only Shell in the batch (docs/eyedropper-tag-design.md\n * §5), mirroring `<wcs-share>`: no attributes at all. `open()` takes no\n * per-call argument — the `{signal}` option is supplied internally by the\n * Core's own AbortController, never via the command-token surface.\n */\nexport class WcsEyedropper extends HTMLElement {\n // SSR (§4.4): observe() completes synchronously, but the Shell still exposes\n // connectedCallbackPromise so the state binder can await it uniformly across\n // all IO nodes before snapshotting.\n static hasConnectedCallbackPromise = true;\n\n static wcBindable: IWcBindable = {\n ...EyedropperCore.wcBindable,\n inputs: [],\n // Core の commands をそのまま継承(単一情報源)。\n commands: EyedropperCore.wcBindable.commands,\n };\n\n private _core: EyedropperCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new EyedropperCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-eyedropper:loading-changed\": (d) => ({ loading: d === true }),\n \"wcs-eyedropper:cancelled-changed\": (d) => ({ cancelled: d === true }),\n \"wcs-eyedropper: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 value(): WcsEyedropperData | null {\n return this._core.value;\n }\n\n get loading(): boolean {\n return this._core.loading;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get cancelled(): boolean {\n return this._core.cancelled;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Commands ---\n\n open(): Promise<WcsEyedropperData | null> {\n return this._core.open();\n }\n\n abort(): void {\n this._core.abort();\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 bootstrapEyedropper(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n","import { WcsEyedropper } from \"./components/Eyedropper.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.eyedropper)) {\n customElements.define(config.tagNames.eyedropper, WcsEyedropper);\n }\n}\n"],"names":["_config","tagNames","eyedropper","deepFreeze","obj","Object","freeze","key","keys","deepClone","clone","frozenConfig","config","getConfig","EyedropperCore","EventTarget","static","protocol","version","properties","name","event","getter","e","detail","value","commands","async","_target","_value","_loading","_error","_cancelled","_abortController","_gen","_ready","Promise","resolve","constructor","target","super","this","ready","loading","error","cancelled","observe","dispose","abort","_setLoading","dispatchEvent","CustomEvent","bubbles","_setValue","_setError","_setCancelled","_api","g","globalThis","EyeDropper","undefined","open","EyeDropperCtor","message","ac","AbortController","signal","gen","result","WcsEyedropper","HTMLElement","wcBindable","inputs","_core","_connectedCallbackPromise","_internals","_initInternals","_wireStates","d","debugStates","states","attachInternals","internals","add","delete","map","toStates","entries","addEventListener","debug","hasAttribute","on","toggleAttribute","connectedCallbackPromise","connectedCallback","style","display","disconnectedCallback","bootstrapEyedropper","userConfig","partialConfig","assign","customElements","get","define"],"mappings":"AAQA,MAAMA,EAA2B,CAC/BC,SAAU,CACRC,WAAY,mBAIhB,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,KAS5B,MAAMC,EAAkBZ,WAEfa,IAId,OAHKF,IACHA,EAAeR,EAAWM,EAAUT,KAE/BW,CACT,CCvBM,MAAOG,UAAuBC,YAClCC,kBAAiC,CAC/BC,SAAU,cACVC,QAAS,EACTC,WAAY,CACV,CAAEC,KAAM,QAASC,MAAO,0BAA2BC,OAASC,GAAcA,EAAkBC,OAAOC,OACnG,CAAEL,KAAM,UAAWC,MAAO,kCAC1B,CAAED,KAAM,QAASC,MAAO,wBACxB,CAAED,KAAM,YAAaC,MAAO,qCAE9BK,SAAU,CACR,CAAEN,KAAM,OAAQO,OAAO,GACvB,CAAEP,KAAM,WAIJQ,QACAC,OAAmC,KACnCC,UAAoB,EACpBC,OAAc,KACdC,YAAsB,EACtBC,iBAA2C,KAM3CC,KAAO,EAEPC,OAAwBC,QAAQC,UAExC,WAAAC,CAAYC,GACVC,QACAC,KAAKb,QAAUW,GAAUE,IAC3B,CAEA,SAAI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MAAMK,EAASvC,KAAKkC,WAAWK,OAC/B,IAAK,MAAO3D,EAAOiE,KAAajF,OAAOkF,QAAQF,GAC7C5C,KAAK+C,iBAAiBnE,EAAQE,IAC5B,MAAMkE,EAAQhD,KAAKiD,aAAa,gBAChC,IAAK,MAAOtE,EAAMuE,KAAOtF,OAAOkF,QAAQD,EAAU/D,EAAkBC,SAAU,CAC5E,IACMmE,EAAMX,EAAOG,IAAI/D,GAAgB4D,EAAOI,OAAOhE,EACrD,CAAE,MAA0B,CACxBqE,GAAOhD,KAAKmD,gBAAgB,kBAAkBxE,IAAQuE,EAC5D,GAGN,CAIA,SAAIlE,GACF,OAAOgB,KAAKgC,MAAMhD,KACpB,CAEA,WAAIkB,GACF,OAAOF,KAAKgC,MAAM9B,OACpB,CAEA,SAAIC,GACF,OAAOH,KAAKgC,MAAM7B,KACpB,CAEA,aAAIC,GACF,OAAOJ,KAAKgC,MAAM5B,SACpB,CAEA,4BAAIgD,GACF,OAAOpD,KAAKiC,yBACd,CAIA,IAAAb,GACE,OAAOpB,KAAKgC,MAAMZ,MACpB,CAEA,KAAAb,GACEP,KAAKgC,MAAMzB,OACb,CAIA,iBAAA8C,GACErD,KAAKsD,MAAMC,QAAU,OACrBvD,KAAKiC,0BAA4BjC,KAAKgC,MAAM3B,SAC9C,CAEA,oBAAAmD,GACExD,KAAKgC,MAAM1B,SACb,ECrHI,SAAUmD,EAAoBC,GH8C9B,IAAoBC,EG7CpBD,KH6CoBC,EG5CZD,GH6CMlG,UAChBI,OAAOgG,OAAOrG,EAAQC,SAAUmG,EAAcnG,UAEhDU,EAAe,MIlDV2F,eAAeC,IAAI3F,EAAOX,SAASC,aACtCoG,eAAeE,OAAO5F,EAAOX,SAASC,WAAYmE,EDItD"}
|
|
1
|
+
{"version":3,"file":"index.esm.min.js","sources":["../src/config.ts","../src/core/operationLane.ts","../src/core/platformCapability.ts","../src/core/eyedropperCapabilities.ts","../src/core/EyedropperCore.ts","../src/components/Eyedropper.ts","../src/bootstrapEyedropper.ts","../src/registerComponents.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n eyedropper: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n eyedropper: \"wcs-eyedropper\",\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\n// Note: this is the live, mutable internal config. It is not part of the public\n// package exports (see exports.ts) — only `getConfig()` (a frozen snapshot) is\n// surfaced. `setConfig()` is applied internally via `bootstrapEyedropper()` and\n// is not re-exported from the package root, though a deep path import\n// (`.../src/config.js`) can still reach and mutate it. Accepted as-is for\n// cross-package consistency: every @wcstack package follows this same shape.\n// Use `getConfig()` for a frozen, safe read.\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","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /io-core/operation-lane.ts by scripts/sync-io-core.mjs.\n// Run `node scripts/sync-io-core.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * operationLane.ts\n *\n * Phase 4 (docs/architecture-hardening/09-remediation-design.md §5, §5.1) の\n * OperationTicket / CommitGuard / terminal CAS を型付き実装した lane プリミティブ。\n * docs/async-execution-model.md §5 が既に規範化した排他モード\n * (latest / queue / exhaust / overlap) を、`AbortController` だけでは防げない\n * 「取消不能な Promise・abort と同時に完了した結果の commit」から守るための\n * 実行時ガードとして具体化する。\n *\n * 配置方針 (§5): 本ファイルは /io-core/ の単一正典であり、scripts/sync-io-core.mjs が\n * 各 IO ノードの src/core/ へ生成コピー (AUTO-GENERATED, 編集禁止) を配布する。\n * `protocol/wcBindable.ts` と同じ copy-distribution 方式で、ランタイム依存を導入せず\n * 各パッケージのバンドルへ inline される (zero-runtime-dep / 自己完結 CDN を維持)。\n * 編集はこの正典に対して行い、`node scripts/sync-io-core.mjs` で再配布する。\n *\n * PoC 実装対象は fetch の `latest` policy のみ。queue / exhaust / overlap は\n * 「全 policy の lane unit」(§8 完了条件) として `operationLane.test.ts` が\n * 直接検証する。lane 自体は promise を実行せず、bookkeeping と guard の\n * 状態機械に徹する — 実際の非同期処理は Core が駆動し lane に照合する。\n */\n\n/** §5: 排他モードの語彙。async-execution-model.md §5 の 4 モードに対応 (parallel は予約語・スコープ外)。 */\nexport type LanePolicy = \"latest\" | \"queue\" | \"exhaust\" | \"overlap\";\n\n/** §5: 各 operation の一回限りの終端結果。 */\nexport type TerminalOutcome = \"success\" | \"error\" | \"timeout\" | \"aborted\" | \"stale\";\n\n/** §5: 論理操作 1 件の identity。retry は同じ operationId を再利用する。 */\nexport interface OperationTicket {\n readonly operationId: number;\n /** 発行時に捕捉した I/O Core の observe / reconnect / dispose lifecycle 世代。 */\n readonly ownerGeneration: number;\n readonly laneKey: string;\n readonly policy: LanePolicy;\n /** supersede bookkeeping に使う epoch (latest policy のみ)。 */\n readonly supersedeEpoch?: number;\n}\n\n/** §5: operation の 1 回の試行。retry で attempt++ と resource signal だけ差し替える。 */\nexport interface OperationAttempt {\n readonly operationId: number;\n readonly attempt: number;\n readonly signal?: AbortSignal;\n}\n\n/** §6: DevTools 側 channel へ流す trace(fetch では既定 off・zero-cost)。 */\nexport type OperationTraceEvent =\n | { readonly type: \"io:operation-started\"; readonly operationId: number; readonly laneKey: string; readonly policy: LanePolicy }\n | { readonly type: \"io:operation-retried\"; readonly operationId: number; readonly laneKey: string; readonly attempt: number }\n | { readonly type: \"io:operation-settled\"; readonly operationId: number; readonly laneKey: string; readonly outcome: TerminalOutcome }\n | { readonly type: \"io:stale-dropped\"; readonly operationId: number; readonly laneKey: string };\n\nexport interface OperationLaneOptions {\n /** attempt ごとに AbortController を発行し signal を渡す (fetch/upload 系)。 */\n readonly withSignal?: boolean;\n /**\n * trace subscriber。undefined なら trace record を一切生成しない\n * (§10.3 hook-off zero allocation の gate)。\n */\n readonly trace?: (event: OperationTraceEvent) => void;\n}\n\n/** 内部の終端状態。absence = pending。'committing' は multi-setter commit 中の中間状態。 */\ntype TerminalStatus = \"committing\" | TerminalOutcome;\n\n/**\n * 1 レーン = 独立した排他単位。Core が 1 つ以上所有する (module singleton にしない —\n * 複数 <wcs-fetch> 間で漏れるため)。\n */\nexport class OperationLane {\n readonly laneKey: string;\n readonly policy: LanePolicy;\n\n private _ownerGeneration = 0;\n private _latestEpoch = 0;\n private _nextOperationId = 1;\n // latest / queue / exhaust の単一 active。queue は head を指す。\n private _activeOperationId: number | undefined = undefined;\n // overlap の active set (§5: 内部 bookkeeping のみ・observable 公開はしない)。\n private readonly _activeOperationIds = new Set<number>();\n // queue policy の FIFO。\n private readonly _queue: OperationTicket[] = [];\n private _inFlightCount = 0;\n // opId → 終端状態 (absence = pending)。\n private readonly _terminal = new Map<number, TerminalStatus>();\n // claimTerminal で確定した outcome (finalize が 'committing' を最終値へ移す)。\n private readonly _claimedOutcome = new Map<number, TerminalOutcome>();\n // opId → AbortController (identity は opId が保証。cross-op clobber は構造上起きない)。\n private readonly _controllers = new Map<number, AbortController>();\n // opId → attempt 数。\n private readonly _attempts = new Map<number, number>();\n private readonly _withSignal: boolean;\n private readonly _trace?: (event: OperationTraceEvent) => void;\n\n constructor(laneKey: string, policy: LanePolicy, options: OperationLaneOptions = {}) {\n this.laneKey = laneKey;\n this.policy = policy;\n this._withSignal = options.withSignal ?? false;\n this._trace = options.trace;\n }\n\n get ownerGeneration(): number {\n return this._ownerGeneration;\n }\n\n get inFlightCount(): number {\n return this._inFlightCount;\n }\n\n get latestEpoch(): number {\n return this._latestEpoch;\n }\n\n get activeOperationId(): number | undefined {\n return this._activeOperationId;\n }\n\n /**\n * 新しい要求の到着。arrival policy を適用し ticket + 最初の attempt を発行する。\n * exhaust で実行中の場合だけ null を返す (新要求を ticket 化せず拒否 = 冪等 no-op)。\n */\n begin(): { ticket: OperationTicket; attempt: OperationAttempt } | null {\n let supersedeEpoch: number | undefined;\n switch (this.policy) {\n case \"latest\": {\n // latestEpoch を進め、旧 active を abort (可能なら)。旧 ticket は settle 時に\n // eligibility 不一致で stale となる。\n supersedeEpoch = ++this._latestEpoch;\n if (this._activeOperationId !== undefined) {\n this._abortController(this._activeOperationId);\n }\n break;\n }\n case \"exhaust\": {\n // 実行中なら新要求を拒否 (呼び出し側は既存結果へ合流)。\n if (this._activeOperationId !== undefined) {\n return null;\n }\n break;\n }\n case \"queue\":\n case \"overlap\":\n break;\n }\n\n const operationId = this._nextOperationId++;\n const ticket: OperationTicket = {\n operationId,\n ownerGeneration: this._ownerGeneration,\n laneKey: this.laneKey,\n policy: this.policy,\n supersedeEpoch,\n };\n\n switch (this.policy) {\n case \"latest\":\n case \"exhaust\":\n this._activeOperationId = operationId;\n break;\n case \"queue\":\n this._queue.push(ticket);\n // 先頭だけを active にする (先行が完了するまで待つ)。\n if (this._activeOperationId === undefined) {\n this._activeOperationId = operationId;\n }\n break;\n case \"overlap\":\n this._activeOperationIds.add(operationId);\n break;\n }\n\n this._inFlightCount += 1;\n this._attempts.set(operationId, 1);\n const attempt = this._makeAttempt(operationId, 1);\n if (this._trace !== undefined) {\n this._trace({ type: \"io:operation-started\", operationId, laneKey: this.laneKey, policy: this.policy });\n }\n return { ticket, attempt };\n }\n\n /**\n * retry: 同じ operationId に新しい attempt を作る。attempt number と resource signal\n * だけを更新する (§5)。既に終端した operation には作れない (null)。\n */\n retry(ticket: OperationTicket): OperationAttempt | null {\n if (ticket.ownerGeneration !== this._ownerGeneration) return null;\n if (this._terminal.has(ticket.operationId)) return null;\n const previous = this._attempts.get(ticket.operationId);\n if (previous === undefined) return null;\n const attemptNo = previous + 1;\n this._attempts.set(ticket.operationId, attemptNo);\n // 前の attempt の signal は破棄し、新しい controller を張る。\n this._releaseController(ticket.operationId);\n const attempt = this._makeAttempt(ticket.operationId, attemptNo);\n if (this._trace !== undefined) {\n this._trace({ type: \"io:operation-retried\", operationId: ticket.operationId, laneKey: this.laneKey, attempt: attemptNo });\n }\n return attempt;\n }\n\n /**\n * CommitGuard (§5.1)。外部可視の setter / event dispatch の直前に呼ぶ。\n * (1) owner lifecycle generation 一致 (2) terminal settle 前 (3) policy eligibility。\n */\n canCommit(ticket: OperationTicket): boolean {\n if (ticket.ownerGeneration !== this._ownerGeneration) return false;\n const status = this._terminal.get(ticket.operationId);\n // absence = pending / 'committing' = multi-setter commit 中。どちらも settle 前。\n if (status !== undefined && status !== \"committing\") return false;\n return this._isEligible(ticket);\n }\n\n /**\n * terminal CAS (§5.1): pending → committing を claim する。勝者だけが true。\n * eligibility / owner gen を満たさない場合も false。claim 後は commit 中となり、\n * canCommit は各 setter の直前で再検査する (setter が同期 supersede しても取りこぼさない)。\n */\n claimTerminal(ticket: OperationTicket, outcome: TerminalOutcome): boolean {\n if (ticket.ownerGeneration !== this._ownerGeneration) return false;\n if (this._terminal.has(ticket.operationId)) return false; // 既に committing / 終端\n if (!this._isEligible(ticket)) return false;\n this._terminal.set(ticket.operationId, \"committing\");\n this._claimedOutcome.set(ticket.operationId, outcome);\n return true;\n }\n\n /** claim 済み outcome (timer が claim → catch が読む等)。未 claim なら undefined。 */\n claimedOutcome(ticket: OperationTicket): TerminalOutcome | undefined {\n return this._claimedOutcome.get(ticket.operationId);\n }\n\n /**\n * operation の後始末。claim 済みなら outcome を確定し、未 claim なら stale-drop。\n * controller を解放し in-flight を減らし、policy の bookkeeping を進める。冪等。\n */\n finalize(ticket: OperationTicket): void {\n const operationId = ticket.operationId;\n const status = this._terminal.get(operationId);\n if (status !== undefined && status !== \"committing\") {\n // 既に確定済み。冪等に return。\n return;\n }\n let outcome: TerminalOutcome;\n if (status === \"committing\") {\n outcome = this._claimedOutcome.get(operationId) ?? \"stale\";\n } else {\n // 一度も claim されなかった (supersede / dispose で eligibility を失った)。\n outcome = \"stale\";\n }\n this._terminal.set(operationId, outcome);\n this._claimedOutcome.delete(operationId);\n this._releaseController(operationId);\n this._attempts.delete(operationId);\n if (this._inFlightCount > 0) this._inFlightCount -= 1;\n this._advanceBookkeeping(operationId);\n if (this._trace !== undefined) {\n if (outcome === \"stale\") {\n this._trace({ type: \"io:stale-dropped\", operationId, laneKey: this.laneKey });\n } else {\n this._trace({ type: \"io:operation-settled\", operationId, laneKey: this.laneKey, outcome });\n }\n }\n }\n\n /** operation の signal (resource 解放用)。withSignal でなければ undefined。 */\n signalOf(ticket: OperationTicket): AbortSignal | undefined {\n return this._controllers.get(ticket.operationId)?.signal;\n }\n\n /** best-effort な resource 中断。正しさは owner gen / eligibility / terminal CAS が担う。 */\n abort(ticket: OperationTicket): void {\n this._abortController(ticket.operationId);\n }\n\n /**\n * 現在 active な operation を中断する (利用者による明示キャンセル)。epoch は進めない —\n * 中断された operation は eligibility を保ったまま 'aborted' を claim できる\n * (loading をクリアしつつ in-flight 状態を残す)。\n */\n abortActive(): void {\n if (this._activeOperationId !== undefined) {\n this._abortController(this._activeOperationId);\n }\n for (const operationId of this._activeOperationIds) {\n this._abortController(operationId);\n }\n }\n\n /**\n * dispose (§4.1 world generation)。owner generation を bump して全 ticket を無効化し、\n * 生きている controller を全て abort する。dispose 後に settle した operation は\n * owner gen 不一致で外部 commit しない。retention gate (§10.3) のため live な\n * 全 operation を即時に stale として finalize し、controller / attempt を解放する。\n */\n disposeOwner(): void {\n this._ownerGeneration += 1;\n for (const operationId of Array.from(this._controllers.keys())) {\n this._abortController(operationId);\n // finalize は dispose 後 (terminal='stale') に early-return するため controller を\n // 解放しない。retention gate (§10.3) を満たすためここで明示的に解放する。\n this._releaseController(operationId);\n }\n for (const operationId of Array.from(this._attempts.keys())) {\n if (!this._terminal.has(operationId)) {\n this._terminal.set(operationId, \"stale\");\n }\n this._claimedOutcome.delete(operationId);\n this._attempts.delete(operationId);\n if (this._trace !== undefined) {\n this._trace({ type: \"io:stale-dropped\", operationId, laneKey: this.laneKey });\n }\n }\n this._activeOperationId = undefined;\n this._activeOperationIds.clear();\n this._queue.length = 0;\n this._inFlightCount = 0;\n }\n\n // --- internal ---\n\n private _makeAttempt(operationId: number, attemptNo: number): OperationAttempt {\n let signal: AbortSignal | undefined;\n // AbortController 不在環境(古い runtime / 一部 SSR)では degraded: signal なしで進む。\n // 正しさは owner generation / eligibility / terminal CAS が担うため、native 中断が\n // 無くても supersede / dispose は機能する(best-effort resource 中断が省かれるだけ)。\n if (this._withSignal && typeof AbortController === \"function\") {\n const controller = new AbortController();\n this._controllers.set(operationId, controller);\n signal = controller.signal;\n }\n return { operationId, attempt: attemptNo, signal };\n }\n\n private _isEligible(ticket: OperationTicket): boolean {\n switch (this.policy) {\n case \"latest\":\n return ticket.supersedeEpoch === this._latestEpoch;\n case \"queue\":\n case \"exhaust\":\n return this._activeOperationId === ticket.operationId;\n case \"overlap\":\n return this._activeOperationIds.has(ticket.operationId);\n }\n }\n\n private _advanceBookkeeping(operationId: number): void {\n switch (this.policy) {\n case \"latest\":\n case \"exhaust\":\n if (this._activeOperationId === operationId) {\n this._activeOperationId = undefined;\n }\n break;\n case \"queue\": {\n // 完了した ticket を FIFO から取り除き、次の先頭を active にする。filter で\n // 「先頭 / 非先頭 / 不在」を一様に扱う (finalize は冪等ガードを通った op のみ到達)。\n const remaining = this._queue.filter((t) => t.operationId !== operationId);\n this._queue.length = 0;\n this._queue.push(...remaining);\n this._activeOperationId = this._queue.length > 0 ? this._queue[0].operationId : undefined;\n break;\n }\n case \"overlap\":\n this._activeOperationIds.delete(operationId);\n break;\n }\n }\n\n private _abortController(operationId: number): void {\n const controller = this._controllers.get(operationId);\n if (controller !== undefined && !controller.signal.aborted) {\n controller.abort();\n }\n }\n\n private _releaseController(operationId: number): void {\n this._controllers.delete(operationId);\n }\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /io-core/platform-capability.ts by scripts/sync-io-core.mjs.\n// Run `node scripts/sync-io-core.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * platform-capability.ts\n *\n * Phase 6(docs/architecture-hardening/09-remediation-design.md §7.2 /\n * 07-browser-capability-variance.md)の browser capability 判定と error taxonomy の\n * 汎用プリミティブ。node 固有の capability registry / error code は各パッケージが\n * 別ファイルで宣言し、この汎用層(型 + assess 機構)を import する。\n *\n * 原則:\n * - feature detection は境界(利用直前)で行う。module 評価時に browser global を\n * 参照しない(SSR / worker で import が失敗しない)。\n * - capability ID(`web.fetch` 等)は文字列を global property path として eval せず、\n * registry が ID ごとに副作用のない presence probe を対応付ける。\n * - availability / permission / readiness / activity / operation error を 1 つの\n * `ready / unsupported / error` enum に畳まない。required 欠如は開始しない、\n * optional 欠如は宣言済み fallback で readiness を `degraded` にする。\n *\n * 配置: 本ファイルは /io-core/ の単一正典であり、scripts/sync-io-core.mjs が\n * 各 IO ノードの src/core/ へ生成コピー (AUTO-GENERATED, 編集禁止) を配布する。\n * `protocol/wcBindable.ts` と同じ copy-distribution 方式で、ランタイム依存を導入せず\n * 各パッケージのバンドルへ inline される (zero-runtime-dep / 自己完結 CDN を維持)。\n * 編集はこの正典に対して行い、`node scripts/sync-io-core.mjs` で再配布する。\n *\n * pure(module 評価時に browser global 非参照)。\n */\n\nexport type Availability = \"available\" | \"missing\" | \"unknown\";\nexport type PermissionState = \"granted\" | \"denied\" | \"prompt\" | \"not-applicable\" | \"unknown\";\nexport type Readiness = \"idle\" | \"ready\" | \"degraded\";\nexport type Activity = \"inactive\" | \"active\";\nexport type PreconditionState = \"satisfied\" | \"required\" | \"not-applicable\";\n\n/** operation error の phase(taxonomy)。 */\nexport type WcsIoErrorPhase = \"probe\" | \"start\" | \"execute\" | \"decode\" | \"commit\" | \"dispose\";\n\n/** serializable な error info(non-cloneable な cause とは分離。DevTools / remote へは info のみ)。 */\nexport interface WcsIoErrorInfo {\n readonly code: string;\n readonly phase: WcsIoErrorPhase;\n readonly recoverable: boolean;\n readonly capabilityId?: string;\n readonly message: string;\n}\n\nexport interface PlatformAssessment {\n readonly availability: ReadonlyMap<string, Availability>;\n readonly permission: PermissionState;\n readonly readiness: Readiness;\n readonly activity: Activity;\n readonly preconditions: {\n readonly secureContext: PreconditionState;\n readonly userActivation: PreconditionState;\n };\n readonly epoch: number;\n readonly lastError?: WcsIoErrorInfo;\n}\n\n/** capability 1 件の仕様。probe は副作用なく presence を返す(利用直前に呼ぶ)。 */\nexport interface CapabilitySpec {\n readonly probe: () => boolean;\n readonly requiresSecureContext?: boolean;\n readonly requiresUserActivation?: boolean;\n /** browser compatibility dataset のキー(任意・診断用)。 */\n readonly compatKey?: string;\n}\n\nexport type CapabilityRegistry = ReadonlyMap<string, CapabilitySpec>;\n\nexport interface AssessOptions {\n readonly required: readonly string[];\n readonly optional?: readonly string[];\n readonly permission?: PermissionState;\n readonly activity?: Activity;\n readonly epoch?: number;\n readonly lastError?: WcsIoErrorInfo;\n}\n\nfunction isSecureContext(): boolean {\n return (globalThis as { isSecureContext?: unknown }).isSecureContext === true;\n}\n\n/**\n * capability を利用直前に評価して PlatformAssessment を作る。\n * required が 1 つでも欠ければ readiness は \"idle\"(開始不可)、\n * required 揃い + optional 欠けは \"degraded\"、全揃いは \"ready\"。\n */\nexport function assessCapabilities(registry: CapabilityRegistry, options: AssessOptions): PlatformAssessment {\n const availability = new Map<string, Availability>();\n const evaluate = (id: string): Availability => {\n const spec = registry.get(id);\n if (spec === undefined) return \"unknown\";\n return spec.probe() ? \"available\" : \"missing\";\n };\n\n let requiredAllAvailable = true;\n for (const id of options.required) {\n const a = evaluate(id);\n availability.set(id, a);\n if (a !== \"available\") requiredAllAvailable = false;\n }\n let optionalAllAvailable = true;\n for (const id of options.optional ?? []) {\n const a = evaluate(id);\n availability.set(id, a);\n if (a !== \"available\") optionalAllAvailable = false;\n }\n\n const readiness: Readiness = !requiredAllAvailable ? \"idle\" : (optionalAllAvailable ? \"ready\" : \"degraded\");\n\n // preconditions: 対象 capability のいずれかが要求する場合だけ評価する。\n const allIds = [...options.required, ...(options.optional ?? [])];\n const needsSecure = allIds.some((id) => registry.get(id)?.requiresSecureContext === true);\n const needsActivation = allIds.some((id) => registry.get(id)?.requiresUserActivation === true);\n const secureContext: PreconditionState = needsSecure ? (isSecureContext() ? \"satisfied\" : \"required\") : \"not-applicable\";\n const userActivation: PreconditionState = needsActivation ? \"required\" : \"not-applicable\";\n\n return {\n availability,\n permission: options.permission ?? \"not-applicable\",\n readiness,\n activity: options.activity ?? \"inactive\",\n preconditions: { secureContext, userActivation },\n epoch: options.epoch ?? 0,\n lastError: options.lastError,\n };\n}\n\n/** availability から「required がすべて available か」を判定するヘルパ(supported の最低条件)。 */\nexport function requiredCapabilitiesAvailable(assessment: PlatformAssessment, required: readonly string[]): boolean {\n return required.every((id) => assessment.availability.get(id) === \"available\");\n}\n","/**\n * eyedropperCapabilities.ts\n *\n * EyeDropper node 固有の capability registry と error code。汎用の assess 機構・型は\n * `./platformCapability.js`(/io-core/ から copy-distribution される生成ファイル)から\n * import する。node 固有の宣言はこのハンドライトファイルに置き、生成コピーとは分離する。\n */\n\nimport { CapabilityRegistry, CapabilitySpec } from \"./platformCapability.js\";\n\n/** 安定した eyedropper error code(taxonomy)。値は公開キーとして固定。 */\nexport const WCS_EYEDROPPER_ERROR_CODE = {\n CapabilityMissing: \"capability-missing\",\n PickFailed: \"pick-failed\",\n} as const;\n\n/** eyedropper node の capability registry。文字列 ID を eval せず明示 probe を持つ。 */\nexport const EYEDROPPER_CAPABILITIES: CapabilityRegistry = new Map<string, CapabilitySpec>([\n [\"web.eyedropper\", { probe: () => typeof (globalThis as { EyeDropper?: unknown }).EyeDropper === \"function\", compatKey: \"api.EyeDropper\" }],\n]);\n","import { IWcBindable, WcsEyedropperData } from \"../types.js\";\nimport { OperationLane, OperationTicket } from \"./operationLane.js\";\nimport {\n PlatformAssessment,\n WcsIoErrorInfo,\n WcsIoErrorPhase,\n assessCapabilities,\n requiredCapabilitiesAvailable,\n} from \"./platformCapability.js\";\nimport { EYEDROPPER_CAPABILITIES, WCS_EYEDROPPER_ERROR_CODE } from \"./eyedropperCapabilities.js\";\n\n/**\n * Headless EyeDropper primitive. A thin, framework-agnostic wrapper around\n * `new EyeDropper().open(options)` exposed through the wc-bindable protocol.\n *\n * Concurrency is owned by the shared `OperationLane` (io-core) with the `latest`\n * policy: `EyeDropper.open()` accepts a `{signal}`, so — unlike Web Share / Contact\n * Picker (exhaust) — a caller has a real platform mechanism to cancel an in-flight\n * pick. A new `open()` supersedes the previous one (the lane aborts its\n * AbortController and the superseded completion fails the terminal CAS), and the\n * `abort()` command aborts the active pick. This replaces the ad-hoc `_gen` +\n * `_abortController` + finally-block identity check with the same lane FetchCore\n * uses; the lane owns the per-attempt AbortController and the commit guard.\n *\n * Both the user dismissing the picker with Escape and the caller invoking\n * `abort()` reject `open()` with the same `AbortError` — both land on `cancelled`\n * without distinction (docs/eyedropper-tag-design.md §2).\n */\nexport class EyedropperCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"value\", event: \"wcs-eyedropper:complete\", getter: (e: Event) => (e as CustomEvent).detail.value },\n { name: \"loading\", event: \"wcs-eyedropper:loading-changed\" },\n { name: \"error\", event: \"wcs-eyedropper:error\" },\n { name: \"cancelled\", event: \"wcs-eyedropper:cancelled-changed\" },\n // Serializable failure taxonomy (stable code / phase / recoverable), or null.\n // Additive bindable output; the existing `error` property/event are unchanged.\n // Fires its own `wcs-eyedropper:error-info-changed` event; no getter, so the\n // bound value is the event detail (mirrors `error` / `loading` / `cancelled`).\n { name: \"errorInfo\", event: \"wcs-eyedropper:error-info-changed\" },\n ],\n commands: [\n { name: \"open\", async: true },\n { name: \"abort\" },\n ],\n };\n\n // Required capability (probed at call time, never at module eval).\n private static readonly REQUIRED_CAPABILITIES = [\"web.eyedropper\"] as const;\n\n private _target: EventTarget;\n private _value: WcsEyedropperData | null = null;\n private _loading: boolean = false;\n private _error: any = null;\n private _cancelled: boolean = false;\n private _errorInfo: WcsIoErrorInfo | null = null;\n // Concurrency lane (io-core). `latest`: a new open() supersedes + aborts the\n // in-flight one (switchMap). `withSignal: true`: the lane owns the per-attempt\n // AbortController whose signal is passed to EyeDropper.open(). dispose() bumps\n // the owner generation and aborts.\n private _lane = new OperationLane(\"eyedropper\", \"latest\", { withSignal: true });\n // SSR (§3.8): no asynchronous probe to await, so readiness is 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 value(): WcsEyedropperData | null {\n return this._value;\n }\n\n get loading(): boolean {\n return this._loading;\n }\n\n get error(): any {\n return this._error;\n }\n\n get cancelled(): boolean {\n return this._cancelled;\n }\n\n /**\n * The last failure's serializable `WcsIoErrorInfo` (stable `code` / `phase` /\n * `recoverable` / `capabilityId`), or null. Exposed as an additive wc-bindable\n * property (event `wcs-eyedropper:error-info-changed`); the existing `error`\n * property/event are unchanged. Note user/abort cancellation is `cancelled`, not\n * `errorInfo`.\n */\n get errorInfo(): WcsIoErrorInfo | null {\n return this._errorInfo;\n }\n\n /**\n * Whether the required platform capability (`web.eyedropper`) is available right\n * now — decided by call-time feature detection, not User-Agent. Core-only,\n * additive.\n */\n get supported(): boolean {\n return requiredCapabilitiesAvailable(this.platformAssessment, EyedropperCore.REQUIRED_CAPABILITIES);\n }\n\n /**\n * Full platform assessment (availability / readiness / preconditions), probed at\n * call time. Core-only opt-in dev / sidecar view.\n */\n get platformAssessment(): PlatformAssessment {\n return assessCapabilities(EYEDROPPER_CAPABILITIES, {\n required: EyedropperCore.REQUIRED_CAPABILITIES,\n activity: this._loading ? \"active\" : \"inactive\",\n lastError: this._errorInfo ?? undefined,\n });\n }\n\n // Lifecycle (§3.5). EyeDropper is command-driven with no subscription to\n // establish, so observe() is an idempotent no-op that resolves once ready;\n // dispose() bumps the lane's owner generation (invalidating any in-flight open())\n // and aborts its AbortController.\n observe(): Promise<void> {\n return this._ready;\n }\n\n dispose(): void {\n this._lane.disposeOwner();\n }\n\n // CommitGuard (§5.1): external setters / event dispatch only run if the ticket\n // still holds owner generation, is pre-terminal, and is the lane's latest epoch\n // (a superseding open() can invalidate a ticket mid-commit).\n private _commitStep(ticket: OperationTicket, step: () => void): void {\n if (this._lane.canCommit(ticket)) {\n step();\n }\n }\n\n private _setLoading(loading: boolean): void {\n if (this._loading === loading) return;\n this._loading = loading;\n this._target.dispatchEvent(new CustomEvent(\"wcs-eyedropper:loading-changed\", {\n detail: loading,\n bubbles: true,\n }));\n }\n\n private _setValue(value: WcsEyedropperData | null): void {\n if (this._value === value) return;\n this._value = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-eyedropper:complete\", {\n detail: { value },\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-eyedropper:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n private _setCancelled(cancelled: boolean): void {\n if (this._cancelled === cancelled) return;\n this._cancelled = cancelled;\n this._target.dispatchEvent(new CustomEvent(\"wcs-eyedropper:cancelled-changed\", {\n detail: cancelled,\n bubbles: true,\n }));\n }\n\n // Single mutation point for `errorInfo`, mirroring `_setError`'s same-value guard\n // and event dispatch so the additive `errorInfo` wc-bindable property stays in\n // sync with `error`. Each failure builds a fresh object (reference guard passes);\n // the clear path passes null (suppresses a redundant null→null per open start).\n private _setErrorInfo(code: string, phase: WcsIoErrorPhase, recoverable: boolean, message: string, capabilityId?: string): void {\n this._commitErrorInfo({ code, phase, recoverable, message, ...(capabilityId === undefined ? {} : { capabilityId }) });\n }\n\n private _commitErrorInfo(info: WcsIoErrorInfo | null): void {\n if (this._errorInfo === info) return;\n this._errorInfo = info;\n this._target.dispatchEvent(new CustomEvent(\"wcs-eyedropper:error-info-changed\", {\n detail: info,\n bubbles: true,\n }));\n }\n\n /**\n * Cancels an in-flight `open()` call, if any (a no-op otherwise). Aborts the\n * lane's active AbortController — the in-flight open() then rejects with\n * `AbortError` and lands on `cancelled`. The epoch is not advanced, so the\n * aborted operation keeps eligibility to claim the `aborted` terminal.\n */\n abort(): void {\n this._lane.abortActive();\n }\n\n async open(): Promise<WcsEyedropperData | null> {\n // never-throw + unsupported (§4 / §7.2): probe the required capability at call\n // time (non-Chromium browsers lack this API). If `web.eyedropper` is absent, do\n // NOT start — surface a stable `capability-missing` taxonomy and the existing\n // error message shape.\n const assessment = this.platformAssessment;\n if (!requiredCapabilitiesAvailable(assessment, EyedropperCore.REQUIRED_CAPABILITIES)) {\n const missing = EyedropperCore.REQUIRED_CAPABILITIES.find((id) => assessment.availability.get(id) !== \"available\");\n const message = \"EyeDropper API is not supported in this browser.\";\n this._setErrorInfo(WCS_EYEDROPPER_ERROR_CODE.CapabilityMissing, \"start\", false, message, missing);\n this._setError({ message });\n return null;\n }\n\n // `latest`: advance the epoch and abort the previous in-flight pick (supersede).\n // begin() never returns null for latest.\n const started = this._lane.begin()!;\n const { ticket, attempt } = started;\n const signal = attempt.signal;\n\n // Capability probed above → EyeDropper is present. Resolve the constructor at\n // call time (never cached, §3.7) so tests can install/remove it freely.\n const EyeDropperCtor = (globalThis as { EyeDropper?: new () => { open(options?: { signal?: AbortSignal }): Promise<WcsEyedropperData> } }).EyeDropper!;\n\n this._commitStep(ticket, () => this._setLoading(true));\n // Reset the previous outcome before starting a new open() so a stale\n // cancelled/error/errorInfo does not linger into this call's result.\n this._commitStep(ticket, () => {\n this._commitErrorInfo(null);\n this._setError(null);\n this._setCancelled(false);\n });\n\n try {\n const result = await new EyeDropperCtor().open({ signal });\n // Terminal CAS: a stale (superseded / dispose-invalidated) completion loses\n // the claim and is dropped without writing state.\n if (!this._lane.claimTerminal(ticket, \"success\")) {\n return null;\n }\n // The platform's own result object ({ sRGBHex }) is used verbatim (§3).\n // Separate commit steps (like FetchCore): if `_setValue`'s event listener\n // synchronously supersedes this op, the following `_setLoading(false)` is\n // stopped by the commit guard rather than clobbering the newer op.\n this._commitStep(ticket, () => this._setValue(result));\n this._commitStep(ticket, () => this._setLoading(false));\n this._lane.finalize(ticket);\n return result;\n } catch (e: any) {\n const cancelled = e?.name === \"AbortError\";\n if (!this._lane.claimTerminal(ticket, cancelled ? \"aborted\" : \"error\")) {\n return null;\n }\n this._commitStep(ticket, () => {\n if (cancelled) {\n // Either the user dismissed the picker with Escape or the caller invoked\n // abort() — a routine cancellation, not a platform failure, and not\n // distinguished (§2). Kept out of `error`/`errorInfo`.\n this._setCancelled(true);\n } else {\n const message = String(e?.message ?? \"Color pick failed.\");\n this._setErrorInfo(WCS_EYEDROPPER_ERROR_CODE.PickFailed, \"execute\", true, message);\n this._setError(e ?? { message });\n }\n });\n this._commitStep(ticket, () => this._setLoading(false));\n this._lane.finalize(ticket);\n return null;\n }\n }\n}\n","import { IWcBindable, WcsEyedropperData } from \"../types.js\";\nimport { EyedropperCore } from \"../core/EyedropperCore.js\";\nimport { WcsIoErrorInfo } from \"../core/platformCapability.js\";\n\n/**\n * `<wcs-eyedropper>` — declarative EyeDropper API primitive.\n *\n * The smallest command-only Shell in the batch (docs/eyedropper-tag-design.md\n * §5), mirroring `<wcs-share>`: no attributes at all. `open()` takes no\n * per-call argument — the `{signal}` option is supplied internally by the\n * Core's own AbortController, never via the command-token surface.\n */\nexport class WcsEyedropper extends HTMLElement {\n // SSR (§4.4): observe() completes synchronously, but the Shell still exposes\n // connectedCallbackPromise so the state binder can await it uniformly across\n // all IO nodes before snapshotting.\n static hasConnectedCallbackPromise = true;\n\n static wcBindable: IWcBindable = {\n ...EyedropperCore.wcBindable,\n inputs: [],\n // Core の commands をそのまま継承(単一情報源)。\n commands: EyedropperCore.wcBindable.commands,\n };\n\n private _core: EyedropperCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new EyedropperCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-eyedropper:loading-changed\": (d) => ({ loading: d === true }),\n \"wcs-eyedropper:cancelled-changed\": (d) => ({ cancelled: d === true }),\n \"wcs-eyedropper: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 value(): WcsEyedropperData | null {\n return this._core.value;\n }\n\n get loading(): boolean {\n return this._core.loading;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get cancelled(): boolean {\n return this._core.cancelled;\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 ---\n\n open(): Promise<WcsEyedropperData | null> {\n return this._core.open();\n }\n\n abort(): void {\n this._core.abort();\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 bootstrapEyedropper(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n","import { WcsEyedropper } from \"./components/Eyedropper.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.eyedropper)) {\n customElements.define(config.tagNames.eyedropper, WcsEyedropper);\n }\n}\n"],"names":["_config","tagNames","eyedropper","deepFreeze","obj","Object","freeze","key","keys","deepClone","clone","frozenConfig","config","getConfig","OperationLane","laneKey","policy","_ownerGeneration","_latestEpoch","_nextOperationId","_activeOperationId","undefined","_activeOperationIds","Set","_queue","_inFlightCount","_terminal","Map","_claimedOutcome","_controllers","_attempts","_withSignal","_trace","constructor","options","this","withSignal","trace","ownerGeneration","inFlightCount","latestEpoch","activeOperationId","begin","supersedeEpoch","_abortController","operationId","ticket","push","add","set","attempt","_makeAttempt","type","retry","has","previous","get","attemptNo","_releaseController","canCommit","status","_isEligible","claimTerminal","outcome","claimedOutcome","finalize","delete","_advanceBookkeeping","signalOf","signal","abort","abortActive","disposeOwner","Array","from","clear","length","AbortController","controller","remaining","filter","t","aborted","assessCapabilities","registry","availability","evaluate","id","spec","probe","requiredAllAvailable","required","a","optionalAllAvailable","optional","readiness","allIds","needsSecure","some","requiresSecureContext","needsActivation","requiresUserActivation","secureContext","globalThis","isSecureContext","userActivation","permission","activity","preconditions","epoch","lastError","requiredCapabilitiesAvailable","assessment","every","WCS_EYEDROPPER_ERROR_CODE","CapabilityMissing","PickFailed","EYEDROPPER_CAPABILITIES","EyeDropper","compatKey","EyedropperCore","EventTarget","static","protocol","version","properties","name","event","getter","e","detail","value","commands","async","_target","_value","_loading","_error","_cancelled","_errorInfo","_lane","_ready","Promise","resolve","target","super","ready","loading","error","cancelled","errorInfo","supported","platformAssessment","REQUIRED_CAPABILITIES","observe","dispose","_commitStep","step","_setLoading","dispatchEvent","CustomEvent","bubbles","_setValue","_setError","_setCancelled","_setErrorInfo","code","phase","recoverable","message","capabilityId","_commitErrorInfo","info","open","missing","find","started","EyeDropperCtor","result","String","WcsEyedropper","HTMLElement","wcBindable","inputs","_core","_connectedCallbackPromise","_internals","_initInternals","_wireStates","d","debugStates","states","attachInternals","internals","map","toStates","entries","addEventListener","debug","hasAttribute","on","toggleAttribute","connectedCallbackPromise","connectedCallback","style","display","disconnectedCallback","bootstrapEyedropper","userConfig","partialConfig","assign","customElements","define"],"mappings":"AAQA,MAAMA,EAA2B,CAC/BC,SAAU,CACRC,WAAY,mBAIhB,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,KAS5B,MAAMC,EAAkBZ,WAEfa,IAId,OAHKF,IACHA,EAAeR,EAAWM,EAAUT,KAE/BW,CACT,OC4BaG,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AAKqJ,MAAMlC,SACpB,CAEA,4BAAIoD,GACF,OAAOvK,KAAKsJ,yBACd,CAIA,IAAAZ,GACE,OAAO1I,KAAKqJ,MAAMX,MACpB,CAEA,KAAAvG,GACEnC,KAAKqJ,MAAMlH,OACb,CAIA,iBAAAqI,GACExK,KAAKyK,MAAMC,QAAU,OACrB1K,KAAKsJ,0BAA4BtJ,KAAKqJ,MAAM9B,SAC9C,CAEA,oBAAAoD,GACE3K,KAAKqJ,MAAM7B,SACb,EC1HI,SAAUoD,EAAoBC,GN8C9B,IAAoBC,EM7CpBD,KN6CoBC,EM5CZD,GN6CM/M,UAChBI,OAAO6M,OAAOlN,EAAQC,SAAUgN,EAAchN,UAEhDU,EAAe,MOlDVwM,eAAe3J,IAAI5C,EAAOX,SAASC,aACtCiN,eAAeC,OAAOxM,EAAOX,SAASC,WAAYkL,EDItD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wcstack/eyedropper",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.1",
|
|
4
4
|
"description": "Declarative EyeDropper component for Web Components. Framework-agnostic EyeDropper.open() primitive via wc-bindable-protocol.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.esm.js",
|