From 59c3bc96c4b9e5dbd631549dc5478b22177487c5 Mon Sep 17 00:00:00 2001 From: dev Date: Tue, 26 May 2026 21:42:18 +0200 Subject: [PATCH] fix(color-picker): emit data-state explicitly on Provider props MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Audit caught 'data-state not emitted' on the ColorPicker Provider. The morfo declares `data-state ∈ [open, closed]` with `value: v.stateRef('open')` — the runtime's `syncAttrs` can sync this from `dom.apply`, but only if the provider receives a `ref` on its opts (which the ColorPickerProvider doesn't — `ColorPickerOpts` extends `ProviderOpts` + `StateProps` without the ref slot). Rather than re-shape the opts to add ref + bind it in the wrapper, just emit `data-state` explicitly in the provider's props derivation, same form as the other six declarative attrs that the provider already materialises (`data-format`, `data-invalid`, `data-disabled`, `data-readonly`, `data-required`, `aria-invalid`). Matches the dialog/drawer/popover doctrinal pattern for disclosure attrs. After this commit `morfo:check`: 1 issue remaining (date-picker `data-kind="date"` — separate domain issue, addressed next). Co-Authored-By: Claude Opus 4.7 (1M context) --- .../color-picker/color-picker-provider.svelte.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/uix/soma/components/color-picker/color-picker-provider.svelte.ts b/src/uix/soma/components/color-picker/color-picker-provider.svelte.ts index 311bdf559..f686fbfb0 100644 --- a/src/uix/soma/components/color-picker/color-picker-provider.svelte.ts +++ b/src/uix/soma/components/color-picker/color-picker-provider.svelte.ts @@ -368,6 +368,13 @@ export class ColorPickerProvider { ...this.runtimePart.props, dir: this.opts.dir.current, 'aria-invalid': this.isInvalid || undefined, + // Mirror the morfo `data-state ∈ [open, closed]` disclosure + // contract (same shape as dialog / drawer / popover). The + // ColorPickerProvider doesn't receive `ref` on its opts, so + // the runtime's `syncAttrs` effect can't bind a target and + // emit this attr via `dom.apply`; we set it explicitly here + // so the contract is satisfied. + 'data-state': this.opts.open.current ? ('open' as const) : ('closed' as const), 'data-format': this.opts.format.current, 'data-invalid': boolToEmptyStrOrUndef(this.isInvalid), 'data-disabled': boolToEmptyStrOrUndef(this.isDisabled),