@websublime/line-components 0.2.3 → 0.2.4
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpE,OAAO,EAML,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAUb,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,aAAa,EAEd,MAAM,mBAAmB,CAAC;;;;AA8B3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAAa,UAAW,SAAQ,eAA2B;;IACzD,OAAgB,iBAAiB,EAAE,cAAc,CAA6D;IAE9G,OAAgB,UAAU,EAAE,oBAAoB,CAe9C;IAEF,OAAgB,MAAM,8CAkDpB;IAEF,gEAAgE;IACxD,OAAO,EAAE,aAAa,CAAC;IAC/B,oFAAoF;IAC5E,IAAI,EAAE,UAAU,CAAC;IACzB,mEAAmE;IAC3D,QAAQ,EAAE,OAAO,CAAC;IAC1B,kGAAkG;IAC1F,OAAO,EAAE,OAAO,CAAC;IACzB,oGAAoG;IAC5F,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IACrC,kFAAkF;IAC1E,KAAK,EAAE,MAAM,CAAC;IACtB,8DAA8D;IACtD,UAAU,EAAE,MAAM,CAAC;IAC3B,8DAA8D;IACtD,UAAU,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACjD,+DAA+D;IACvD,WAAW,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACnD,8DAA8D;IACtD,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,4DAA4D;IACpD,cAAc,EAAE,OAAO,CAAC;IAChC,gGAAgG;IACxF,cAAc,EAAE,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,EAAE,MAAM,CAAC;IAC/B,2DAA2D;IACnD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,kCAAkC;IAC1B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IA4BvC,cAYC;IAEQ,oBAAoB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAGrD;IAyFD,UAAmB,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,CAQ7D;IAED,UAAmB,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,CAU9D;IAEQ,MAAM,IAAI,cAAc,CAkBhC;CACF;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
|
package/dist/button/index.js
CHANGED
package/dist/button/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["buttonMachine","createMachine","bindable","prop","guard","send","pressed","event","api","disabled","props","loading","connect","service","connectStatic","VARIANTS","TYPES","FORM_ATTRIBUTES","variantConverter","variant","value","typeConverter","type","pressedConverter","emptyRemovesConverter","LineButton","FormAssociated","LineElement","LitElement","commonReset","buttonReset","next","#formDisabled","#onPressedChange","LineMachineController","#machineProps","#onClick","#ctrl","#api","#activate","form","#submit","submitter","name","attribute","release","end","ended","visible","changed","message","root","buttonAttrs","ifDefined","#onPointerDown","#onKeyDown","#onKeyUp","#onFocus","#onBlur","nothing"],"sources":["../../src/shared/button-machine.ts","../../src/button/button.ts"],"sourcesContent":["/**\n * The Button press machine, shared by `<line-button>` and `<line-icon-button>`\n * (spec `0002-button.md` States; Phase 1 spec §6.C.5; ARCH §13.1).\n *\n * The press is the only finite state: `idle → active`. `disabled`, `loading`\n * and `pressed` are props that the `isInteractive` guard and the actions read\n * at event time. `ACTIVATE` flips a toggle through `onPressedChange`. A `watch`\n * cancels a running press when `disabled` or `loading` turns true. The module\n * knows nothing about forms or DOM events and imports no component\n * (MANIFESTO Law 4).\n *\n * @module shared/button-machine\n */\n\nimport { createMachine, type Service } from '@zag-js/core';\n\n/** Machine props. A component passes them as a live function of its own properties. */\nexport interface ButtonMachineProps {\n disabled?: boolean | undefined;\n loading?: boolean | undefined;\n /** `undefined` means the button is not a toggle. */\n pressed?: boolean | undefined;\n /** Called with the next pressed state when an activation flips a toggle. */\n onPressedChange?: ((next: boolean) => void) | undefined;\n}\n\nexport type ButtonMachineEvent =\n | { type: 'PRESS_START' }\n | { type: 'PRESS_END' }\n | { type: 'PRESS_CANCEL' }\n | { type: 'ACTIVATE' }\n | { type: 'FOCUS'; visible: boolean }\n | { type: 'BLUR' };\n\nexport interface ButtonMachineSchema {\n props: ButtonMachineProps;\n context: { focusVisible: boolean };\n state: 'idle' | 'active';\n guard: 'isInteractive';\n action: 'togglePressed' | 'setFocusVisible' | 'clearFocusVisible';\n event: ButtonMachineEvent;\n}\n\nexport type ButtonService = Service<ButtonMachineSchema>;\n\nexport const buttonMachine = createMachine<ButtonMachineSchema>({\n initialState: () => 'idle',\n context: ({ bindable }) => ({\n focusVisible: bindable<boolean>(() => ({ defaultValue: false })),\n }),\n watch({ track, prop, guard, send }) {\n track([() => prop('disabled'), () => prop('loading')], () => {\n if (!guard('isInteractive')) send({ type: 'PRESS_CANCEL' });\n });\n },\n on: {\n ACTIVATE: { guard: 'isInteractive', actions: ['togglePressed'] },\n FOCUS: { actions: ['setFocusVisible'] },\n BLUR: { actions: ['clearFocusVisible'] },\n },\n states: {\n idle: {\n on: { PRESS_START: { target: 'active', guard: 'isInteractive' } },\n },\n active: {\n on: {\n PRESS_END: { target: 'idle' },\n PRESS_CANCEL: { target: 'idle' },\n },\n },\n },\n implementations: {\n guards: {\n isInteractive: ({ prop }) => !(prop('disabled') || prop('loading')),\n },\n actions: {\n togglePressed({ prop }) {\n const pressed = prop('pressed');\n if (pressed !== undefined) prop('onPressedChange')?.(!pressed);\n },\n setFocusVisible({ context, event }) {\n context.set('focusVisible', event.type === 'FOCUS' && event.visible === true);\n },\n clearFocusVisible({ context }) {\n context.set('focusVisible', false);\n },\n },\n },\n});\n\n/** What the inner native `<button>` and the host reflection read. */\nexport interface ButtonApi {\n active: boolean;\n /** `true` only on a pressed toggle. */\n pressed: boolean;\n loading: boolean;\n disabled: boolean;\n focusVisible: boolean;\n /** `!disabled && !loading`: whether an activation runs now. */\n interactive: boolean;\n /** ARIA and `disabled` for the inner `<button>`; an `undefined` attribute is left off. */\n buttonAttrs: {\n 'aria-pressed': 'true' | 'false' | undefined;\n 'aria-disabled': 'true' | undefined;\n disabled: boolean;\n };\n}\n\nfunction api(props: ButtonMachineProps, active: boolean, focusVisible: boolean): ButtonApi {\n const disabled = props.disabled === true;\n const loading = props.loading === true;\n return {\n active,\n pressed: props.pressed === true,\n loading,\n disabled,\n focusVisible,\n interactive: !(disabled || loading),\n buttonAttrs: {\n 'aria-pressed': props.pressed === undefined ? undefined : (String(props.pressed) as 'true' | 'false'),\n 'aria-disabled': loading && !disabled ? 'true' : undefined,\n disabled,\n },\n };\n}\n\n/** Reads the running machine at call time. */\nexport function connect(service: ButtonService): ButtonApi {\n const { prop } = service;\n return api(\n { disabled: prop('disabled'), loading: prop('loading'), pressed: prop('pressed') },\n service.state.matches('active'),\n service.context.get('focusVisible'),\n );\n}\n\n/** The same view without a machine, for the controller's static fallback (MANIFESTO Law 9). */\nexport function connectStatic(props: ButtonMachineProps): ButtonApi {\n return api(props, false, false);\n}\n","import { FormAssociated, LineElement } from '@websublime/line-core';\nimport { LineMachineController } from '@websublime/line-core/machine';\nimport { buttonReset, commonReset } from '@websublime/line-core/styles';\nimport {\n type ComplexAttributeConverter,\n css,\n html,\n LitElement,\n nothing,\n type PropertyDeclarations,\n type PropertyValues,\n type TemplateResult,\n} from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport {\n type ButtonApi,\n type ButtonMachineProps,\n type ButtonMachineSchema,\n buttonMachine,\n connect,\n connectStatic,\n} from '../shared/button-machine.js';\nimport type {\n ButtonFormEnctype,\n ButtonFormMethod,\n ButtonType,\n ButtonVariant,\n LineButtonChangeDetail,\n} from './button.types.js';\n\nconst VARIANTS: readonly ButtonVariant[] = ['default', 'primary', 'borderless'];\nconst TYPES: readonly ButtonType[] = ['submit', 'reset', 'button'];\n\n/** The host attributes the temporary submitter copies, besides `name` and `value`. */\nconst FORM_ATTRIBUTES = ['formaction', 'formmethod', 'formenctype', 'formtarget', 'formnovalidate'] as const;\n\n/** An unknown `variant` behaves as `default`; the attribute keeps what the author wrote. */\nconst variantConverter: ComplexAttributeConverter<ButtonVariant> = {\n fromAttribute: (value) => VARIANTS.find((variant) => variant === value) ?? 'default',\n};\n\n/** An unknown or missing `type` behaves as `submit`, as on a native button; the match ignores case. */\nconst typeConverter: ComplexAttributeConverter<ButtonType> = {\n fromAttribute: (value) => TYPES.find((type) => type === value?.toLowerCase()) ?? 'submit',\n};\n\n/** Absent means not a toggle; `\"false\"` parses to `false` and any other value to `true`. */\nconst pressedConverter: ComplexAttributeConverter<boolean | undefined> = {\n fromAttribute: (value) => (value === null ? undefined : value !== 'false'),\n toAttribute: (value) => (value === undefined ? null : String(value)),\n};\n\n/** Reflects a string and removes the attribute when the string is empty. */\nconst emptyRemovesConverter: ComplexAttributeConverter<string> = {\n fromAttribute: (value) => value ?? '',\n toAttribute: (value) => value || null,\n};\n\n/**\n * `<line-button>` runs an action when the user activates it. It renders a\n * native `<button>` in its shadow root, and the host is a form-associated\n * custom element, so `type=\"submit\"` and `type=\"reset\"` act on its form as a\n * native button does. `pressed` makes it a toggle; `loading` keeps it\n * focusable while it ignores presses.\n *\n * @summary A form-associated button that runs an action, submits or resets its form, or toggles with `pressed`.\n *\n * @slot - The label: text or inline content.\n * @slot prefix - A leading icon.\n * @slot suffix - A trailing icon.\n * @slot loading - A spinner, loading text or both; rendered only while `loading` is on.\n *\n * @csspart root - The inner native `<button>`: box, background, border and focus ring.\n * @csspart label - Wraps the default slot.\n * @csspart loading - Wraps the `loading` slot; present only while `loading` is on.\n *\n * @cssprop [--line-button-radius=var(--line-radius-2)] - Corner radius of `root`.\n * @cssprop [--line-button-bg=var(--line-gray-bg)] - Background of `root`; `primary` uses `var(--line-accent-solid)` and `borderless` uses `transparent`.\n * @cssprop [--line-button-color=var(--line-gray-text)] - Text colour of `root`; `primary` uses `var(--line-accent-contrast)` and `borderless` uses `var(--line-accent-text)`.\n * @cssprop [--line-button-height=var(--line-size-7)] - Minimum block size of `root`.\n * @cssprop [--line-button-padding-inline=var(--line-size-3)] - Inline padding of `root`.\n * @cssprop [--line-button-gap=var(--line-size-2)] - Gap between the prefix, label, suffix and loading zones.\n * @cssprop [--line-button-font-size=var(--line-font-size-1)] - Font size of `root`.\n * @cssprop [--line-button-font-weight=var(--line-font-weight-5)] - Font weight of `root`.\n * @cssprop [--line-button-focus-ring=var(--line-focus-ring, 2px solid currentColor)] - `outline` of `root` while the host has `data-focus-visible`.\n *\n * @fires {CustomEvent<LineButtonChangeDetail>} line-change - A user activation flipped `pressed` on a toggle button; `detail.value` is the new state. Bubbles, not composed.\n *\n * @attr {string} name - The key the submitter value goes under; read through the inherited `name` getter.\n */\nexport class LineButton extends FormAssociated(LineElement) {\n static override shadowRootOptions: ShadowRootInit = { ...LitElement.shadowRootOptions, delegatesFocus: true };\n\n static override properties: PropertyDeclarations = {\n variant: { reflect: true, converter: variantConverter },\n type: { reflect: true, converter: typeConverter },\n disabled: { type: Boolean, reflect: true },\n loading: { type: Boolean, reflect: true },\n pressed: { reflect: true, converter: pressedConverter },\n value: { reflect: true, converter: emptyRemovesConverter },\n formAction: { attribute: 'formaction', reflect: true, converter: emptyRemovesConverter },\n formMethod: { attribute: 'formmethod', reflect: true },\n formEnctype: { attribute: 'formenctype', reflect: true },\n formTarget: { attribute: 'formtarget', reflect: true },\n formNoValidate: { attribute: 'formnovalidate', type: Boolean, reflect: true },\n customValidity: { attribute: 'custom-validity' },\n ariaLabel: { attribute: 'aria-label', reflect: true },\n ariaDescription: { attribute: 'aria-description', reflect: true },\n };\n\n static override styles = [\n commonReset,\n buttonReset,\n css`\n :host {\n --line-button-radius: var(--line-radius-2);\n --line-button-bg: var(--line-gray-bg);\n --line-button-color: var(--line-gray-text);\n --line-button-height: var(--line-size-7);\n --line-button-padding-inline: var(--line-size-3);\n --line-button-gap: var(--line-size-2);\n --line-button-font-size: var(--line-font-size-1);\n --line-button-font-weight: var(--line-font-weight-5);\n --line-button-focus-ring: var(--line-focus-ring, 2px solid currentColor);\n\n display: inline-block;\n }\n\n :host([hidden]) {\n display: none;\n }\n\n :host([variant='primary']) {\n --line-button-bg: var(--line-accent-solid);\n --line-button-color: var(--line-accent-contrast);\n }\n\n :host([variant='borderless']) {\n --line-button-bg: transparent;\n --line-button-color: var(--line-accent-text);\n }\n\n [part='root'] {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: var(--line-button-gap);\n min-block-size: var(--line-button-height);\n padding-inline: var(--line-button-padding-inline);\n border-radius: var(--line-button-radius);\n background: var(--line-button-bg);\n color: var(--line-button-color);\n font-size: var(--line-button-font-size);\n font-weight: var(--line-button-font-weight);\n }\n\n :host([data-focus-visible]) [part='root'] {\n outline: var(--line-button-focus-ring);\n }\n `,\n ];\n\n /** Semantic emphasis; an unknown value behaves as `default`. */\n declare variant: ButtonVariant;\n /** What activation does to the form owner; an unknown value behaves as `submit`. */\n declare type: ButtonType;\n /** Removes the button from the tab order and blocks activation. */\n declare disabled: boolean;\n /** Keeps focus, sets `aria-disabled=\"true\"`, blocks activation and renders the `loading` part. */\n declare loading: boolean;\n /** `undefined` means not a toggle; a toggle flips it on each activation and fires `line-change`. */\n declare pressed: boolean | undefined;\n /** The submitter value; it enters the form data only when this button submits. */\n declare value: string;\n /** Overrides the form's `action` when this button submits. */\n declare formAction: string;\n /** Overrides the form's `method` when this button submits. */\n declare formMethod: ButtonFormMethod | undefined;\n /** Overrides the form's `enctype` when this button submits. */\n declare formEnctype: ButtonFormEnctype | undefined;\n /** Overrides the form's `target` when this button submits. */\n declare formTarget: string | undefined;\n /** Skips constraint validation when this button submits. */\n declare formNoValidate: boolean;\n /** External validity: a non-empty message marks the button invalid while `type` is `submit`. */\n declare customValidity: string;\n /** Copied to the inner button, where it names the role. */\n declare ariaLabel: string | null;\n /** Copied to the inner button. */\n declare ariaDescription: string | null;\n\n /** A disabled `fieldset` ancestor or the host's own `disabled`, from `formDisabledCallback`. */\n #formDisabled = false;\n\n readonly #onPressedChange = (next: boolean): void => {\n this.pressed = next;\n this.dispatchEvent(\n new CustomEvent<LineButtonChangeDetail>('line-change', {\n detail: { value: next },\n bubbles: true,\n composed: false,\n }),\n );\n };\n\n readonly #machineProps = (): ButtonMachineProps => ({\n disabled: this.disabled || this.#formDisabled,\n loading: this.loading,\n pressed: this.pressed,\n onPressedChange: this.#onPressedChange,\n });\n\n readonly #ctrl = new LineMachineController<ButtonMachineSchema>(this, {\n machine: buttonMachine,\n props: this.#machineProps,\n });\n\n constructor() {\n super();\n this.variant = 'default';\n this.type = 'submit';\n this.disabled = false;\n this.loading = false;\n this.value = '';\n this.formAction = '';\n this.formNoValidate = false;\n this.customValidity = '';\n this.addEventListener('click', this.#onClick, { capture: true });\n }\n\n override formDisabledCallback(disabled: boolean): void {\n this.#formDisabled = disabled;\n this.requestUpdate();\n }\n\n /** The machine view, or the static view from the host props when the machine failed to start. */\n #api(): ButtonApi {\n const service = this.#ctrl.service;\n return service && !this.#ctrl.fallback ? connect(service) : connectStatic(this.#machineProps());\n }\n\n /**\n * Stops a click while the button is not interactive. It listens in the\n * capture phase, so it runs before every bubble listener on the host,\n * including an inline `onclick` or a listener added before the upgrade.\n * Otherwise it activates in a later task, once the click dispatch has\n * ended, unless a listener called `preventDefault()`.\n */\n readonly #onClick = (event: MouseEvent): void => {\n if (!this.#api().interactive) {\n event.preventDefault();\n event.stopImmediatePropagation();\n return;\n }\n setTimeout(() => {\n if (!event.defaultPrevented) this.#activate();\n });\n };\n\n #activate(): void {\n this.#ctrl.send({ type: 'ACTIVATE' });\n const form = this.form;\n if (!form) return;\n if (this.type === 'reset') {\n // A control with id or name \"reset\" shadows the method on the form.\n HTMLFormElement.prototype.reset.call(form);\n } else if (this.type === 'submit') {\n this.#submit(form);\n }\n }\n\n /** Submits through a temporary native submitter, so the submission gets the native submitter semantics. */\n #submit(form: HTMLFormElement): void {\n const submitter = form.ownerDocument.createElement('button');\n submitter.type = 'submit';\n submitter.hidden = true;\n submitter.setAttribute('data-line-button-submitter', '');\n const name = this.getAttribute('name');\n if (name !== null) submitter.name = name;\n submitter.value = this.value;\n for (const attribute of FORM_ATTRIBUTES) {\n const value = this.getAttribute(attribute);\n if (value !== null) submitter.setAttribute(attribute, value);\n }\n form.append(submitter);\n try {\n submitter.click();\n } finally {\n submitter.remove();\n }\n }\n\n readonly #onPointerDown = (event: PointerEvent): void => {\n if (event.button !== 0) return;\n this.#ctrl.send({ type: 'PRESS_START' });\n const release = new AbortController();\n const end = (ended: Event): void => {\n release.abort();\n this.#ctrl.send({ type: ended.type === 'pointerup' ? 'PRESS_END' : 'PRESS_CANCEL' });\n };\n window.addEventListener('pointerup', end, { capture: true, signal: release.signal });\n window.addEventListener('pointercancel', end, { capture: true, signal: release.signal });\n };\n\n readonly #onKeyDown = (event: KeyboardEvent): void => {\n if (!event.repeat && (event.key === 'Enter' || event.key === ' ')) this.#ctrl.send({ type: 'PRESS_START' });\n };\n\n readonly #onKeyUp = (event: KeyboardEvent): void => {\n if (event.key === 'Enter' || event.key === ' ') this.#ctrl.send({ type: 'PRESS_END' });\n };\n\n readonly #onFocus = (event: FocusEvent): void => {\n const visible = (event.currentTarget as HTMLButtonElement).matches(':focus-visible');\n this.#ctrl.send({ type: 'FOCUS', visible });\n };\n\n readonly #onBlur = (): void => {\n this.#ctrl.send({ type: 'PRESS_CANCEL' });\n this.#ctrl.send({ type: 'BLUR' });\n };\n\n protected override update(changed: PropertyValues<this>): void {\n const api = this.#api();\n this.reflectState('active', api.active);\n this.reflectState('pressed', api.pressed);\n this.reflectState('loading', api.loading);\n this.reflectState('disabled', api.disabled);\n this.reflectState('focus-visible', api.focusVisible);\n super.update(changed);\n }\n\n protected override updated(changed: PropertyValues<this>): void {\n if (!(changed.has('customValidity') || changed.has('type'))) return;\n const message = this.type === 'submit' ? this.customValidity : '';\n const root = this.renderRoot.querySelector<HTMLButtonElement>('[part=\"root\"]') ?? undefined;\n if (message) {\n this.setValidity({ customError: true }, message, root);\n } else {\n this.setValidity({});\n }\n this.reflectState('invalid', message !== '');\n }\n\n override render(): TemplateResult {\n const { loading, buttonAttrs } = this.#api();\n return html`<button\n part=\"root\"\n type=\"button\"\n ?disabled=${buttonAttrs.disabled}\n aria-pressed=${ifDefined(buttonAttrs['aria-pressed'])}\n aria-disabled=${ifDefined(buttonAttrs['aria-disabled'])}\n aria-label=${ifDefined(this.ariaLabel ?? undefined)}\n aria-description=${ifDefined(this.ariaDescription ?? undefined)}\n @pointerdown=${this.#onPointerDown}\n @keydown=${this.#onKeyDown}\n @keyup=${this.#onKeyUp}\n @focus=${this.#onFocus}\n @blur=${this.#onBlur}\n ><slot name=\"prefix\"></slot><span part=\"label\"><slot></slot></span><slot name=\"suffix\"></slot>${\n loading ? html`<span part=\"loading\"><slot name=\"loading\"></slot></span>` : nothing\n }</button>`;\n }\n}\n\ncustomElements.define('line-button', LineButton);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'line-button': LineButton;\n }\n}\n"],"mappings":";;;;;;;AA6CA,IAAaA,IAAgBC,EAAmC;CAC9D,oBAAoB;CACpB,UAAU,EAAE,mBAAgB,EAC1B,cAAcC,SAAyB,EAAE,cAAc,GAAM,EAAE,EACjE;CACA,MAAM,EAAE,UAAO,SAAM,UAAO,WAAQ;EAClC,EAAM,OAAOC,EAAK,UAAU,SAASA,EAAK,SAAS,CAAC,SAAS;GAC3D,AAAKC,EAAM,eAAe,KAAGC,EAAK,EAAE,MAAM,eAAe,CAAC;EAC5D,CAAC;CACH;CACA,IAAI;EACF,UAAU;GAAE,OAA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S;qBAClBC,EAAUD,EAAY,eAAe,EAAE;sBACtCC,EAAUD,EAAY,gBAAgB,EAAE;mBAC3CC,EAAU,KAAK,aAAa,KAAA,CAAS,EAAE;yBACjCA,EAAU,KAAK,mBAAmB,KAAA,CAAS,EAAE;qBACjD,KAAKC,GAAe;iBACxB,KAAKC,GAAW;eAClB,KAAKC,GAAS;eACd,KAAKC,GAAS;cACf,KAAKC,GAAQ;oGAErB/C,IAAU,CAAI,6DAA6DgD,EAC5E;CACH;AACF;AAEA,eAAe,OAAO,eAAelC,CAAU"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["buttonMachine","createMachine","bindable","prop","guard","send","pressed","event","api","disabled","props","loading","connect","service","connectStatic","VARIANTS","TYPES","FORM_ATTRIBUTES","variantConverter","variant","value","typeConverter","type","pressedConverter","emptyRemovesConverter","LineButton","FormAssociated","LineElement","LitElement","commonReset","buttonReset","next","#formDisabled","#onPressedChange","LineMachineController","#machineProps","#onClick","#ctrl","#api","#activate","form","#submit","submitter","name","attribute","release","end","ended","visible","changed","message","root","buttonAttrs","ifDefined","#onPointerDown","#onKeyDown","#onKeyUp","#onFocus","#onBlur","nothing"],"sources":["../../src/shared/button-machine.ts","../../src/button/button.ts"],"sourcesContent":["/**\n * The Button press machine, shared by `<line-button>` and `<line-icon-button>`\n * (spec `0002-button.md` States; Phase 1 spec §6.C.5; ARCH §13.1).\n *\n * The press is the only finite state: `idle → active`. `disabled`, `loading`\n * and `pressed` are props that the `isInteractive` guard and the actions read\n * at event time. `ACTIVATE` flips a toggle through `onPressedChange`. A `watch`\n * cancels a running press when `disabled` or `loading` turns true. The module\n * knows nothing about forms or DOM events and imports no component\n * (MANIFESTO Law 4).\n *\n * @module shared/button-machine\n */\n\nimport { createMachine, type Service } from '@zag-js/core';\n\n/** Machine props. A component passes them as a live function of its own properties. */\nexport interface ButtonMachineProps {\n disabled?: boolean | undefined;\n loading?: boolean | undefined;\n /** `undefined` means the button is not a toggle. */\n pressed?: boolean | undefined;\n /** Called with the next pressed state when an activation flips a toggle. */\n onPressedChange?: ((next: boolean) => void) | undefined;\n}\n\nexport type ButtonMachineEvent =\n | { type: 'PRESS_START' }\n | { type: 'PRESS_END' }\n | { type: 'PRESS_CANCEL' }\n | { type: 'ACTIVATE' }\n | { type: 'FOCUS'; visible: boolean }\n | { type: 'BLUR' };\n\nexport interface ButtonMachineSchema {\n props: ButtonMachineProps;\n context: { focusVisible: boolean };\n state: 'idle' | 'active';\n guard: 'isInteractive';\n action: 'togglePressed' | 'setFocusVisible' | 'clearFocusVisible';\n event: ButtonMachineEvent;\n}\n\nexport type ButtonService = Service<ButtonMachineSchema>;\n\nexport const buttonMachine = createMachine<ButtonMachineSchema>({\n initialState: () => 'idle',\n context: ({ bindable }) => ({\n focusVisible: bindable<boolean>(() => ({ defaultValue: false })),\n }),\n watch({ track, prop, guard, send }) {\n track([() => prop('disabled'), () => prop('loading')], () => {\n if (!guard('isInteractive')) send({ type: 'PRESS_CANCEL' });\n });\n },\n on: {\n ACTIVATE: { guard: 'isInteractive', actions: ['togglePressed'] },\n FOCUS: { actions: ['setFocusVisible'] },\n BLUR: { actions: ['clearFocusVisible'] },\n },\n states: {\n idle: {\n on: { PRESS_START: { target: 'active', guard: 'isInteractive' } },\n },\n active: {\n on: {\n PRESS_END: { target: 'idle' },\n PRESS_CANCEL: { target: 'idle' },\n },\n },\n },\n implementations: {\n guards: {\n isInteractive: ({ prop }) => !(prop('disabled') || prop('loading')),\n },\n actions: {\n togglePressed({ prop }) {\n const pressed = prop('pressed');\n if (pressed !== undefined) prop('onPressedChange')?.(!pressed);\n },\n setFocusVisible({ context, event }) {\n context.set('focusVisible', event.type === 'FOCUS' && event.visible === true);\n },\n clearFocusVisible({ context }) {\n context.set('focusVisible', false);\n },\n },\n },\n});\n\n/** What the inner native `<button>` and the host reflection read. */\nexport interface ButtonApi {\n active: boolean;\n /** `true` only on a pressed toggle. */\n pressed: boolean;\n loading: boolean;\n disabled: boolean;\n focusVisible: boolean;\n /** `!disabled && !loading`: whether an activation runs now. */\n interactive: boolean;\n /** ARIA and `disabled` for the inner `<button>`; an `undefined` attribute is left off. */\n buttonAttrs: {\n 'aria-pressed': 'true' | 'false' | undefined;\n 'aria-disabled': 'true' | undefined;\n disabled: boolean;\n };\n}\n\nfunction api(props: ButtonMachineProps, active: boolean, focusVisible: boolean): ButtonApi {\n const disabled = props.disabled === true;\n const loading = props.loading === true;\n return {\n active,\n pressed: props.pressed === true,\n loading,\n disabled,\n focusVisible,\n interactive: !(disabled || loading),\n buttonAttrs: {\n 'aria-pressed': props.pressed === undefined ? undefined : (String(props.pressed) as 'true' | 'false'),\n 'aria-disabled': loading && !disabled ? 'true' : undefined,\n disabled,\n },\n };\n}\n\n/** Reads the running machine at call time. */\nexport function connect(service: ButtonService): ButtonApi {\n const { prop } = service;\n return api(\n { disabled: prop('disabled'), loading: prop('loading'), pressed: prop('pressed') },\n service.state.matches('active'),\n service.context.get('focusVisible'),\n );\n}\n\n/** The same view without a machine, for the controller's static fallback (MANIFESTO Law 9). */\nexport function connectStatic(props: ButtonMachineProps): ButtonApi {\n return api(props, false, false);\n}\n","import { FormAssociated, LineElement } from '@websublime/line-core';\nimport { LineMachineController } from '@websublime/line-core/machine';\nimport { buttonReset, commonReset } from '@websublime/line-core/styles';\nimport {\n type ComplexAttributeConverter,\n css,\n html,\n LitElement,\n nothing,\n type PropertyDeclarations,\n type PropertyValues,\n type TemplateResult,\n} from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport {\n type ButtonApi,\n type ButtonMachineProps,\n type ButtonMachineSchema,\n buttonMachine,\n connect,\n connectStatic,\n} from '../shared/button-machine.js';\nimport type {\n ButtonFormEnctype,\n ButtonFormMethod,\n ButtonType,\n ButtonVariant,\n LineButtonChangeDetail,\n} from './button.types.js';\n\nconst VARIANTS: readonly ButtonVariant[] = ['default', 'primary', 'borderless'];\nconst TYPES: readonly ButtonType[] = ['submit', 'reset', 'button'];\n\n/** The host attributes the temporary submitter copies, besides `name` and `value`. */\nconst FORM_ATTRIBUTES = ['formaction', 'formmethod', 'formenctype', 'formtarget', 'formnovalidate'] as const;\n\n/** An unknown `variant` behaves as `default`; the attribute keeps what the author wrote. */\nconst variantConverter: ComplexAttributeConverter<ButtonVariant> = {\n fromAttribute: (value) => VARIANTS.find((variant) => variant === value) ?? 'default',\n};\n\n/** An unknown or missing `type` behaves as `submit`, as on a native button; the match ignores case. */\nconst typeConverter: ComplexAttributeConverter<ButtonType> = {\n fromAttribute: (value) => TYPES.find((type) => type === value?.toLowerCase()) ?? 'submit',\n};\n\n/** Absent means not a toggle; `\"false\"` parses to `false` and any other value to `true`. */\nconst pressedConverter: ComplexAttributeConverter<boolean | undefined> = {\n fromAttribute: (value) => (value === null ? undefined : value !== 'false'),\n toAttribute: (value) => (value === undefined ? null : String(value)),\n};\n\n/** Reflects a string and removes the attribute when the string is empty. */\nconst emptyRemovesConverter: ComplexAttributeConverter<string> = {\n fromAttribute: (value) => value ?? '',\n toAttribute: (value) => value || null,\n};\n\n/**\n * `<line-button>` runs an action when the user activates it. It renders a\n * native `<button>` in its shadow root, and the host is a form-associated\n * custom element, so `type=\"submit\"` and `type=\"reset\"` act on its form as a\n * native button does. `pressed` makes it a toggle; `loading` keeps it\n * focusable while it ignores presses.\n *\n * @summary A form-associated button that runs an action, submits or resets its form, or toggles with `pressed`.\n *\n * @slot - The label: text or inline content.\n * @slot prefix - A leading icon.\n * @slot suffix - A trailing icon.\n * @slot loading - A spinner, loading text or both; rendered only while `loading` is on.\n *\n * @csspart root - The inner native `<button>`: box, background, border and focus ring.\n * @csspart label - Wraps the default slot.\n * @csspart loading - Wraps the `loading` slot; present only while `loading` is on.\n *\n * @cssprop [--line-button-radius=var(--line-radius-2)] - Corner radius of `root`.\n * @cssprop [--line-button-bg=var(--line-gray-bg)] - Background of `root`; `primary` uses `var(--line-accent-solid)` and `borderless` uses `transparent`.\n * @cssprop [--line-button-color=var(--line-gray-text)] - Text colour of `root`; `primary` uses `var(--line-accent-contrast)` and `borderless` uses `var(--line-accent-text)`.\n * @cssprop [--line-button-height=var(--line-size-7)] - Minimum block size of `root`.\n * @cssprop [--line-button-padding-inline=var(--line-size-3)] - Inline padding of `root`.\n * @cssprop [--line-button-gap=var(--line-size-2)] - Gap between the prefix, label, suffix and loading zones.\n * @cssprop [--line-button-font-size=var(--line-font-size-1)] - Font size of `root`.\n * @cssprop [--line-button-font-weight=var(--line-font-weight-5)] - Font weight of `root`.\n * @cssprop [--line-button-focus-ring=var(--line-focus-ring, 2px solid currentColor)] - `outline` of `root` while the host has `data-focus-visible`.\n *\n * @fires {CustomEvent<LineButtonChangeDetail>} line-change - A user activation flipped `pressed` on a toggle button; `detail.value` is the new state. Bubbles, not composed.\n *\n * @attr {string} name - The key the submitter value goes under; read through the inherited `name` getter.\n */\nexport class LineButton extends FormAssociated(LineElement) {\n static override shadowRootOptions: ShadowRootInit = { ...LitElement.shadowRootOptions, delegatesFocus: true };\n\n static override properties: PropertyDeclarations = {\n variant: { reflect: true, useDefault: true, converter: variantConverter },\n type: { reflect: true, useDefault: true, converter: typeConverter },\n disabled: { type: Boolean, reflect: true },\n loading: { type: Boolean, reflect: true },\n pressed: { reflect: true, converter: pressedConverter },\n value: { reflect: true, converter: emptyRemovesConverter },\n formAction: { attribute: 'formaction', reflect: true, converter: emptyRemovesConverter },\n formMethod: { attribute: 'formmethod', reflect: true },\n formEnctype: { attribute: 'formenctype', reflect: true },\n formTarget: { attribute: 'formtarget', reflect: true },\n formNoValidate: { attribute: 'formnovalidate', type: Boolean, reflect: true },\n customValidity: { attribute: 'custom-validity' },\n ariaLabel: { attribute: 'aria-label', reflect: true },\n ariaDescription: { attribute: 'aria-description', reflect: true },\n };\n\n static override styles = [\n commonReset,\n buttonReset,\n css`\n :host {\n --line-button-radius: var(--line-radius-2);\n --line-button-bg: var(--line-gray-bg);\n --line-button-color: var(--line-gray-text);\n --line-button-height: var(--line-size-7);\n --line-button-padding-inline: var(--line-size-3);\n --line-button-gap: var(--line-size-2);\n --line-button-font-size: var(--line-font-size-1);\n --line-button-font-weight: var(--line-font-weight-5);\n --line-button-focus-ring: var(--line-focus-ring, 2px solid currentColor);\n\n display: inline-block;\n }\n\n :host([hidden]) {\n display: none;\n }\n\n :host([variant='primary']) {\n --line-button-bg: var(--line-accent-solid);\n --line-button-color: var(--line-accent-contrast);\n }\n\n :host([variant='borderless']) {\n --line-button-bg: transparent;\n --line-button-color: var(--line-accent-text);\n }\n\n [part='root'] {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: var(--line-button-gap);\n min-block-size: var(--line-button-height);\n padding-inline: var(--line-button-padding-inline);\n border-radius: var(--line-button-radius);\n background: var(--line-button-bg);\n color: var(--line-button-color);\n font-size: var(--line-button-font-size);\n font-weight: var(--line-button-font-weight);\n }\n\n :host([data-focus-visible]) [part='root'] {\n outline: var(--line-button-focus-ring);\n }\n `,\n ];\n\n /** Semantic emphasis; an unknown value behaves as `default`. */\n declare variant: ButtonVariant;\n /** What activation does to the form owner; an unknown value behaves as `submit`. */\n declare type: ButtonType;\n /** Removes the button from the tab order and blocks activation. */\n declare disabled: boolean;\n /** Keeps focus, sets `aria-disabled=\"true\"`, blocks activation and renders the `loading` part. */\n declare loading: boolean;\n /** `undefined` means not a toggle; a toggle flips it on each activation and fires `line-change`. */\n declare pressed: boolean | undefined;\n /** The submitter value; it enters the form data only when this button submits. */\n declare value: string;\n /** Overrides the form's `action` when this button submits. */\n declare formAction: string;\n /** Overrides the form's `method` when this button submits. */\n declare formMethod: ButtonFormMethod | undefined;\n /** Overrides the form's `enctype` when this button submits. */\n declare formEnctype: ButtonFormEnctype | undefined;\n /** Overrides the form's `target` when this button submits. */\n declare formTarget: string | undefined;\n /** Skips constraint validation when this button submits. */\n declare formNoValidate: boolean;\n /** External validity: a non-empty message marks the button invalid while `type` is `submit`. */\n declare customValidity: string;\n /** Copied to the inner button, where it names the role. */\n declare ariaLabel: string | null;\n /** Copied to the inner button. */\n declare ariaDescription: string | null;\n\n /** A disabled `fieldset` ancestor or the host's own `disabled`, from `formDisabledCallback`. */\n #formDisabled = false;\n\n readonly #onPressedChange = (next: boolean): void => {\n this.pressed = next;\n this.dispatchEvent(\n new CustomEvent<LineButtonChangeDetail>('line-change', {\n detail: { value: next },\n bubbles: true,\n composed: false,\n }),\n );\n };\n\n readonly #machineProps = (): ButtonMachineProps => ({\n disabled: this.disabled || this.#formDisabled,\n loading: this.loading,\n pressed: this.pressed,\n onPressedChange: this.#onPressedChange,\n });\n\n readonly #ctrl = new LineMachineController<ButtonMachineSchema>(this, {\n machine: buttonMachine,\n props: this.#machineProps,\n });\n\n constructor() {\n super();\n // `useDefault` keeps these initial values out of the attributes, so an unknown author value stays (C8).\n this.variant = 'default';\n this.type = 'submit';\n this.disabled = false;\n this.loading = false;\n this.value = '';\n this.formAction = '';\n this.formNoValidate = false;\n this.customValidity = '';\n this.addEventListener('click', this.#onClick, { capture: true });\n }\n\n override formDisabledCallback(disabled: boolean): void {\n this.#formDisabled = disabled;\n this.requestUpdate();\n }\n\n /** The machine view, or the static view from the host props when the machine failed to start. */\n #api(): ButtonApi {\n const service = this.#ctrl.service;\n return service && !this.#ctrl.fallback ? connect(service) : connectStatic(this.#machineProps());\n }\n\n /**\n * Stops a click while the button is not interactive. It listens in the\n * capture phase, so it runs before every bubble listener on the host,\n * including an inline `onclick` or a listener added before the upgrade.\n * Otherwise it activates in a later task, once the click dispatch has\n * ended, unless a listener called `preventDefault()`.\n */\n readonly #onClick = (event: MouseEvent): void => {\n if (!this.#api().interactive) {\n event.preventDefault();\n event.stopImmediatePropagation();\n return;\n }\n setTimeout(() => {\n if (!event.defaultPrevented) this.#activate();\n });\n };\n\n #activate(): void {\n this.#ctrl.send({ type: 'ACTIVATE' });\n const form = this.form;\n if (!form) return;\n if (this.type === 'reset') {\n // A control with id or name \"reset\" shadows the method on the form.\n HTMLFormElement.prototype.reset.call(form);\n } else if (this.type === 'submit') {\n this.#submit(form);\n }\n }\n\n /** Submits through a temporary native submitter, so the submission gets the native submitter semantics. */\n #submit(form: HTMLFormElement): void {\n const submitter = form.ownerDocument.createElement('button');\n submitter.type = 'submit';\n submitter.hidden = true;\n submitter.setAttribute('data-line-button-submitter', '');\n const name = this.getAttribute('name');\n if (name !== null) submitter.name = name;\n submitter.value = this.value;\n for (const attribute of FORM_ATTRIBUTES) {\n const value = this.getAttribute(attribute);\n if (value !== null) submitter.setAttribute(attribute, value);\n }\n form.append(submitter);\n try {\n submitter.click();\n } finally {\n submitter.remove();\n }\n }\n\n readonly #onPointerDown = (event: PointerEvent): void => {\n if (event.button !== 0) return;\n this.#ctrl.send({ type: 'PRESS_START' });\n const release = new AbortController();\n const end = (ended: Event): void => {\n release.abort();\n this.#ctrl.send({ type: ended.type === 'pointerup' ? 'PRESS_END' : 'PRESS_CANCEL' });\n };\n window.addEventListener('pointerup', end, { capture: true, signal: release.signal });\n window.addEventListener('pointercancel', end, { capture: true, signal: release.signal });\n };\n\n readonly #onKeyDown = (event: KeyboardEvent): void => {\n if (!event.repeat && (event.key === 'Enter' || event.key === ' ')) this.#ctrl.send({ type: 'PRESS_START' });\n };\n\n readonly #onKeyUp = (event: KeyboardEvent): void => {\n if (event.key === 'Enter' || event.key === ' ') this.#ctrl.send({ type: 'PRESS_END' });\n };\n\n readonly #onFocus = (event: FocusEvent): void => {\n const visible = (event.currentTarget as HTMLButtonElement).matches(':focus-visible');\n this.#ctrl.send({ type: 'FOCUS', visible });\n };\n\n readonly #onBlur = (): void => {\n this.#ctrl.send({ type: 'PRESS_CANCEL' });\n this.#ctrl.send({ type: 'BLUR' });\n };\n\n protected override update(changed: PropertyValues<this>): void {\n const api = this.#api();\n this.reflectState('active', api.active);\n this.reflectState('pressed', api.pressed);\n this.reflectState('loading', api.loading);\n this.reflectState('disabled', api.disabled);\n this.reflectState('focus-visible', api.focusVisible);\n super.update(changed);\n }\n\n protected override updated(changed: PropertyValues<this>): void {\n if (!(changed.has('customValidity') || changed.has('type'))) return;\n const message = this.type === 'submit' ? this.customValidity : '';\n const root = this.renderRoot.querySelector<HTMLButtonElement>('[part=\"root\"]') ?? undefined;\n if (message) {\n this.setValidity({ customError: true }, message, root);\n } else {\n this.setValidity({});\n }\n this.reflectState('invalid', message !== '');\n }\n\n override render(): TemplateResult {\n const { loading, buttonAttrs } = this.#api();\n return html`<button\n part=\"root\"\n type=\"button\"\n ?disabled=${buttonAttrs.disabled}\n aria-pressed=${ifDefined(buttonAttrs['aria-pressed'])}\n aria-disabled=${ifDefined(buttonAttrs['aria-disabled'])}\n aria-label=${ifDefined(this.ariaLabel ?? undefined)}\n aria-description=${ifDefined(this.ariaDescription ?? undefined)}\n @pointerdown=${this.#onPointerDown}\n @keydown=${this.#onKeyDown}\n @keyup=${this.#onKeyUp}\n @focus=${this.#onFocus}\n @blur=${this.#onBlur}\n ><slot name=\"prefix\"></slot><span part=\"label\"><slot></slot></span><slot name=\"suffix\"></slot>${\n loading ? html`<span part=\"loading\"><slot name=\"loading\"></slot></span>` : nothing\n }</button>`;\n }\n}\n\ncustomElements.define('line-button', LineButton);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'line-button': LineButton;\n }\n}\n"],"mappings":";;;;;;;AA6CA,IAAaA,IAAgBC,EAAmC;CAC9D,oBAAoB;CACpB,UAAU,EAAE,mBAAgB,EAC1B,cAAcC,SAAyB,EAAE,cAAc,GAAM,EAAE,EACjE;CACA,MAAM,EAAE,UAAO,SAAM,UAAO,WAAQ;EAClC,EAAM,OAAOC,EAAK,UAAU,SAASA,EAAK,SAAS,CAAC,SAAS;GAC3D,AAAKC,EAAM,eAAe,KAAGC,EAAK,EAAE,MAAM,eAAe,CAAC;EAC5D,CAAC;CACH;CACA,IAAI;EACF,UAAU;GAAE,OAAO;GAAiB,SAAS,CAAC,eAAe;EAAE;EAC/D,OAAO,EAAE,SAAS,CAAC,iBAAiB,EAAE;EACtC,MAAM,EAAE,SAAS,CAAC,mBAAmB,EAAE;CACzC;CACA,QAAQ;EACN,MAAM,EACJ,IAAI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,mBAAmB,KAAA,CAAS,EAAE;qBACjD,KAAKC,GAAe;iBACxB,KAAKC,GAAW;eAClB,KAAKC,GAAS;eACd,KAAKC,GAAS;cACf,KAAKC,GAAQ;oGAErB/C,IAAU,CAAI,6DAA6DgD,EAC5E;CACH;AACF;AAEA,eAAe,OAAO,eAAelC,CAAU"}
|
package/package.json
CHANGED
package/src/button/button.ts
CHANGED
|
@@ -92,8 +92,8 @@ export class LineButton extends FormAssociated(LineElement) {
|
|
|
92
92
|
static override shadowRootOptions: ShadowRootInit = { ...LitElement.shadowRootOptions, delegatesFocus: true };
|
|
93
93
|
|
|
94
94
|
static override properties: PropertyDeclarations = {
|
|
95
|
-
variant: { reflect: true, converter: variantConverter },
|
|
96
|
-
type: { reflect: true, converter: typeConverter },
|
|
95
|
+
variant: { reflect: true, useDefault: true, converter: variantConverter },
|
|
96
|
+
type: { reflect: true, useDefault: true, converter: typeConverter },
|
|
97
97
|
disabled: { type: Boolean, reflect: true },
|
|
98
98
|
loading: { type: Boolean, reflect: true },
|
|
99
99
|
pressed: { reflect: true, converter: pressedConverter },
|
|
@@ -217,6 +217,7 @@ export class LineButton extends FormAssociated(LineElement) {
|
|
|
217
217
|
|
|
218
218
|
constructor() {
|
|
219
219
|
super();
|
|
220
|
+
// `useDefault` keeps these initial values out of the attributes, so an unknown author value stays (C8).
|
|
220
221
|
this.variant = 'default';
|
|
221
222
|
this.type = 'submit';
|
|
222
223
|
this.disabled = false;
|