@patternfly/pfe-core 2.4.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/controllers/activedescendant-controller.d.ts +99 -0
- package/controllers/activedescendant-controller.js +230 -0
- package/controllers/activedescendant-controller.js.map +1 -0
- package/controllers/at-focus-controller.d.ts +56 -0
- package/controllers/at-focus-controller.js +168 -0
- package/controllers/at-focus-controller.js.map +1 -0
- package/controllers/cascade-controller.d.ts +11 -0
- package/controllers/cascade-controller.js +10 -3
- package/controllers/cascade-controller.js.map +1 -1
- package/controllers/combobox-controller.d.ts +117 -0
- package/controllers/combobox-controller.js +611 -0
- package/controllers/combobox-controller.js.map +1 -0
- package/controllers/css-variable-controller.js +1 -1
- package/controllers/css-variable-controller.js.map +1 -1
- package/controllers/floating-dom-controller.d.ts +10 -3
- package/controllers/floating-dom-controller.js +93 -83
- package/controllers/floating-dom-controller.js.map +1 -1
- package/controllers/internals-controller.d.ts +104 -42
- package/controllers/internals-controller.js +354 -36
- package/controllers/internals-controller.js.map +1 -1
- package/controllers/light-dom-controller.js +2 -2
- package/controllers/light-dom-controller.js.map +1 -1
- package/controllers/listbox-controller.d.ts +143 -0
- package/controllers/listbox-controller.js +443 -0
- package/controllers/listbox-controller.js.map +1 -0
- package/controllers/logger.d.ts +33 -6
- package/controllers/logger.js +58 -13
- package/controllers/logger.js.map +1 -1
- package/controllers/overflow-controller.d.ts +10 -3
- package/controllers/overflow-controller.js +79 -44
- package/controllers/overflow-controller.js.map +1 -1
- package/controllers/perf-controller.js.map +1 -1
- package/controllers/property-observer-controller.d.ts +13 -16
- package/controllers/property-observer-controller.js +55 -27
- package/controllers/property-observer-controller.js.map +1 -1
- package/controllers/roving-tabindex-controller.d.ts +19 -50
- package/controllers/roving-tabindex-controller.js +64 -183
- package/controllers/roving-tabindex-controller.js.map +1 -1
- package/controllers/scroll-spy-controller.d.ts +4 -1
- package/controllers/scroll-spy-controller.js +94 -93
- package/controllers/scroll-spy-controller.js.map +1 -1
- package/controllers/slot-controller.d.ts +26 -19
- package/controllers/slot-controller.js +94 -83
- package/controllers/slot-controller.js.map +1 -1
- package/controllers/style-controller.js +3 -1
- package/controllers/style-controller.js.map +1 -1
- package/controllers/tabs-aria-controller.d.ts +31 -0
- package/controllers/tabs-aria-controller.js +97 -0
- package/controllers/tabs-aria-controller.js.map +1 -0
- package/controllers/test/combobox-controller.spec.d.ts +1 -0
- package/controllers/test/combobox-controller.spec.js +282 -0
- package/controllers/test/combobox-controller.spec.js.map +1 -0
- package/controllers/timestamp-controller.js +73 -70
- package/controllers/timestamp-controller.js.map +1 -1
- package/core.d.ts +3 -23
- package/core.js +1 -38
- package/core.js.map +1 -1
- package/custom-elements.json +7302 -2817
- package/decorators/bound.d.ts +3 -1
- package/decorators/bound.js +3 -1
- package/decorators/bound.js.map +1 -1
- package/decorators/cascades.d.ts +2 -0
- package/decorators/cascades.js +2 -0
- package/decorators/cascades.js.map +1 -1
- package/decorators/deprecation.d.ts +6 -5
- package/decorators/deprecation.js +6 -5
- package/decorators/deprecation.js.map +1 -1
- package/decorators/initializer.js.map +1 -1
- package/decorators/listen.d.ts +8 -0
- package/decorators/listen.js +22 -0
- package/decorators/listen.js.map +1 -0
- package/decorators/observed.d.ts +12 -16
- package/decorators/observed.js +39 -44
- package/decorators/observed.js.map +1 -1
- package/decorators/observes.d.ts +15 -0
- package/decorators/observes.js +30 -0
- package/decorators/observes.js.map +1 -0
- package/decorators/time.d.ts +1 -0
- package/decorators/time.js +6 -9
- package/decorators/time.js.map +1 -1
- package/decorators/trace.d.ts +4 -1
- package/decorators/trace.js +4 -1
- package/decorators/trace.js.map +1 -1
- package/decorators.d.ts +2 -0
- package/decorators.js +2 -0
- package/decorators.js.map +1 -1
- package/functions/arraysAreEquivalent.d.ts +9 -0
- package/functions/arraysAreEquivalent.js +28 -0
- package/functions/arraysAreEquivalent.js.map +1 -0
- package/functions/containsDeep.d.ts +8 -0
- package/functions/containsDeep.js +23 -0
- package/functions/containsDeep.js.map +1 -0
- package/functions/context.d.ts +8 -0
- package/functions/context.js +21 -0
- package/functions/context.js.map +1 -0
- package/functions/debounce.js.map +1 -1
- package/functions/isElementInView.d.ts +4 -6
- package/functions/isElementInView.js +9 -11
- package/functions/isElementInView.js.map +1 -1
- package/package.json +10 -4
- package/functions/deprecatedCustomEvent.d.ts +0 -5
- package/functions/deprecatedCustomEvent.js +0 -12
- package/functions/deprecatedCustomEvent.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox-controller.js","sourceRoot":"","sources":["combobox-controller.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,OAAO,EAAwD,MAAM,KAAK,CAAC;AAMpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAUrD,SAAS,WAAW,CAAC,OAAuB,EAAE,QAAgB;IAC5D,IAAI,OAAO,GAAG,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzC,IAAI,IAAI,GAAG,OAAO,EAAE,WAAW,EAAE,CAAC;IAClC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,OAAO,KAAK,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI,OAAO,EAAE,CAAC;QAC1C,KAAK,EAAE,CAAC;QACR,IAAI,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;QAC7B,IAAI,IAAI,YAAY,UAAU,EAAE,CAAC;YAC/B,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,CAAC;aAAM,IAAI,IAAI,YAAY,QA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,iCAAO,CAAC,CAAC;mBACtD,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC;mBAC1C,KAAK,CAAC;YACb,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;AACH,CAAC;AA5WM,6CAAM,CAAe;AAErB,6CAAiB,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,EAArC,CAAsC;AAE5C,wBAAK,GAAG;IACrB,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;CACI,AARU,CAQT;AAEI,0BAAO,GAAG,IAAI,MAAM,CAAC,EAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,AAAjD,CAAkD;AAExE;IACE,+BAA+B;IAC/B,sEAAmB,CAAC,SAAS,GAAG;;;;;;;;;;;;OAY7B,CAAC;AACN,CAAC,GAAA,CAAA","sourcesContent":["import { nothing, type ReactiveController, type ReactiveControllerHost } from 'lit';\nimport type { ActivedescendantControllerOptions } from './activedescendant-controller.js';\nimport type { RovingTabindexControllerOptions } from './roving-tabindex-controller.js';\nimport type { ATFocusController } from './at-focus-controller';\nimport type { ListboxControllerOptions } from './listbox-controller.js';\n\nimport { ListboxController, isItem, isItemDisabled } from './listbox-controller.js';\nimport { RovingTabindexController } from './roving-tabindex-controller.js';\nimport { ActivedescendantController } from './activedescendant-controller.js';\nimport { InternalsController } from './internals-controller.js';\nimport { getRandomId } from '../functions/random.js';\nimport type { RequireProps } from '../core.js';\n\ntype AllOptions<Item extends HTMLElement> =\n ActivedescendantControllerOptions<Item>\n & ListboxControllerOptions<Item>\n & RovingTabindexControllerOptions<Item>;\n\ntype Lang = typeof ComboboxController['langs'][number];\n\nfunction deepClosest(element: Element | null, selector: string) {\n let closest = element?.closest(selector);\n let root = element?.getRootNode();\n let count = 0;\n while (count < 500 && !closest && element) {\n count++;\n root = element.getRootNode();\n if (root instanceof ShadowRoot) {\n element = root.host;\n } else if (root instanceof Document) {\n element = document.documentElement;\n } else {\n return null;\n }\n closest = element.closest(selector);\n }\n return closest;\n}\n\nfunction getItemValue<Item extends HTMLElement>(item: Item): string {\n if ('value' in item && typeof item.value === 'string') {\n return item.value;\n } else {\n return '';\n }\n}\n\nfunction isItemFiltered<Item extends HTMLElement>(item: Item, value: string): boolean {\n return !getItemValue(item)\n .toLowerCase()\n .startsWith(value.toLowerCase());\n}\n\nfunction setItemHidden(item: HTMLElement, hidden: boolean) {\n item.hidden = hidden;\n}\n\nfunction setComboboxValue(item: HTMLElement, value: string): void {\n if (!('value' in item)) {\n // eslint-disable-next-line no-console\n return console.warn(`Cannot set value on combobox element ${item.localName}`);\n } else {\n item.value = value;\n }\n}\n\nfunction getComboboxValue(combobox: HTMLElement): string {\n if ('value' in combobox && typeof combobox.value === 'string') {\n return combobox.value;\n } else {\n // eslint-disable-next-line no-console\n return console.warn(`Cannot get value from combobox element ${combobox.localName}`), '';\n }\n}\n\nexport interface ComboboxControllerOptions<Item extends HTMLElement> extends\n Omit<AllOptions<Item>,\n | 'getATFocusedItem'\n | 'getControlsElements'\n | 'getActiveDescendantContainer'\n | 'getItemsContainer'> {\n /**\n * Predicate which establishes whether the listbox is expanded\n * e.g. `isExpanded: () => this.expanded`, if the host's `expanded` property\n * should correspond to the listbox expanded state.\n */\n isExpanded(): boolean;\n /**\n * Callback which the host must implement to change the expanded state to true.\n * Return or resolve false to prevent the change.\n */\n requestShowListbox(): void | boolean | Promise<boolean> | Promise<void>;\n /**\n * Callback which the host must implement to change the expanded to false.\n * Return or resolve false to prevent the default.\n */\n requestHideListbox(): void | boolean | Promise<boolean> | Promise<void>;\n /**\n * Returns the listbox container element\n */\n getListboxElement(): HTMLElement | null;\n /**\n * Returns the toggle button, if it exists\n */\n getToggleButton(): HTMLElement | null;\n /**\n * Returns the combobox input, if it exists\n */\n getComboboxInput(): HTMLElement | null;\n /**\n * Returns the label for the toggle button, combobox input, and listbox.\n * when `ariaLabelledByElements` is supported, the label elements associated with\n * the host element are used instead, and this value is ignored.\n */\n getFallbackLabel(): string;\n /**\n * Called on an item to retrieve it's value string. By default, returns the `value` property\n * of the item, as if it implemented the `<option>` element's interface.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement\n */\n getItemValue?(item: Item): string;\n /**\n * Optional callback, called on the combobox input element to set its value.\n * by default, returns the element's `value` DOM property.\n */\n getComboboxValue?(combobox: HTMLElement): string;\n /**\n * Optional callback, called on the combobox input element to set its value.\n * by default, sets the element's `value` DOM property.\n */\n setComboboxValue?(item: HTMLElement, value: string): void;\n /**\n * Called on each item, with the combobox input, to determine if the item should be shown in the\n * listbox or filtered out. Return false to hide the item. By default, checks whether the item's\n * value starts with the input value (when both are lowercased).\n */\n isItemFiltered?(item: Item, value: string): boolean;\n /**\n * Called on each item when the filter changes.\n * By default, toggles the `hidden` attribute on the item\n */\n setItemHidden?(item: Item, hidden: boolean): void;\n}\n\n/**\n * @summary Implements the WAI-ARIA pattern [Editable Combobox with Both List and Inline Autocomplete].\n *\n * Combobox with keyboard and pointer navigation, using the aria-activedescendant pattern.\n *\n * WARNING: Safari VoiceOver does not support aria-activedescendant, so Safari users\n * rely on the combobox input value being announced when navigating the listbox with the keyboard.\n * We have erred on the side that it may be less-broken to avoid announcing disabled items in that\n * case, rather than announcing the disabled items value without indicating that it is disabled.\n * @see (https://bugs.webkit.org/show_bug.cgi?id=269026)\n *\n * [pattern]: https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-both/\n */\nexport class ComboboxController<\n Item extends HTMLElement\n> implements ReactiveController {\n public static of<T extends HTMLElement>(\n host: ReactiveControllerHost,\n options: ComboboxControllerOptions<T>,\n ): ComboboxController<T> {\n return new ComboboxController(host, options);\n }\n\n /**\n * Whether the `ariaActiveDescendantElement` IDL attribute is supported for cross-root ARIA.\n */\n public static get supportsCrossRootActiveDescendant(): boolean {\n return ActivedescendantController.supportsCrossRootActiveDescendant;\n }\n\n static #alert?: HTMLElement;\n\n static #alertTemplate = document.createElement('template');\n\n private static langs = [\n 'en',\n 'es',\n 'de',\n 'fr',\n 'it',\n 'ja',\n 'zh',\n ] as const;\n\n private static langsRE = new RegExp(ComboboxController.langs.join('|'));\n\n static {\n // apply visually-hidden styles\n this.#alertTemplate.innerHTML = `\n <div role=\"alert\" style=\"\n border: 0;\n clip: rect(0, 0, 0, 0);\n block-size: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n white-space: nowrap;\n inline-size: 1px;\n \"></div>\n `;\n }\n\n private options: RequireProps<ComboboxControllerOptions<Item>,\n | 'isItemDisabled'\n | 'isItem'\n | 'isItemFiltered'\n | 'getItemValue'\n | 'getOrientation'\n | 'getComboboxValue'\n | 'setComboboxValue'\n | 'setItemHidden'\n >;\n\n #lb: ListboxController<Item>;\n #fc?: ATFocusController<Item>;\n #preventListboxGainingFocus = false;\n #input: HTMLElement | null = null;\n #button: HTMLElement | null = null;\n #listbox: HTMLElement | null = null;\n #buttonInitialRole: string | null = null;\n #mo = new MutationObserver(() => this.#initItems());\n #microcopy = new Map<string, Record<Lang, string>>(Object.entries({\n dimmed: {\n en: 'dimmed',\n es: 'atenuada',\n de: 'gedimmt',\n it: 'oscurato',\n fr: 'atténué',\n ja: '暗くなった',\n zh: '变暗',\n },\n selected: {\n en: 'selected',\n es: 'seleccionado',\n de: 'ausgewählt',\n fr: 'choisie',\n it: 'selezionato',\n ja: '選ばれた',\n zh: '选',\n },\n of: {\n en: 'of',\n es: 'de',\n de: 'von',\n fr: 'sur',\n it: 'di',\n ja: '件目',\n zh: '的',\n },\n }));\n\n /** All items */\n get items(): Item[] {\n return this.#lb.items;\n }\n\n set items(value: Item[]) {\n this.#lb.items = value;\n }\n\n /** Whether the combobox is disabled */\n get disabled() {\n return this.#lb.disabled;\n }\n\n set disabled(value: boolean) {\n this.#lb.disabled = value;\n }\n\n /** Whether multiselect is enabled */\n get multi() {\n return this.#lb.multi;\n }\n\n set multi(value: boolean) {\n this.#lb.multi = value;\n }\n\n /** The current selection: a list of items */\n get selected() {\n return this.#lb.selected;\n }\n\n set selected(value: Item[]) {\n this.#lb.selected = value;\n }\n\n get #hasTextInput() {\n return this.options.getComboboxInput();\n }\n\n get #focusedItem() {\n return this.#fc?.items.at(Math.max(this.#fc?.atFocusedItemIndex ?? -1, 0)) ?? null;\n }\n\n get #element() {\n if (this.host instanceof HTMLElement) {\n return this.host;\n } else if (this.options.getListboxElement() instanceof HTMLElement) {\n return this.options.getListboxElement();\n }\n }\n\n private constructor(\n public host: ReactiveControllerHost,\n options: ComboboxControllerOptions<Item>,\n ) {\n host.addController(this);\n this.options = {\n isItem,\n getItemValue,\n isItemFiltered,\n isItemDisabled,\n getComboboxValue,\n setComboboxValue,\n setItemHidden,\n getOrientation: () => 'vertical',\n ...options,\n };\n this.#lb = ListboxController.of(host, {\n isItem: this.options.isItem,\n getItemsContainer: this.options.getListboxElement,\n getControlsElements: () => [\n this.options.getToggleButton(),\n this.options.getComboboxInput(),\n ].filter(x => !!x),\n getATFocusedItem: () => this.items[this.#fc?.atFocusedItemIndex ?? -1] ?? null,\n isItemDisabled: this.options.isItemDisabled,\n setItemSelected: this.options.setItemSelected,\n });\n }\n\n async hostConnected(): Promise<void> {\n await this.host.updateComplete;\n this.hostUpdated();\n }\n\n hostUpdated(): void {\n if (!this.#fc) {\n this.#init();\n }\n const expanded = this.options.isExpanded();\n this.#button?.setAttribute('aria-expanded', String(expanded));\n this.#input?.setAttribute('aria-expanded', String(expanded));\n if (this.#hasTextInput) {\n this.#button?.setAttribute('tabindex', '-1');\n } else {\n this.#button?.removeAttribute('tabindex');\n }\n this.#initLabels();\n }\n\n hostDisconnected(): void {\n this.#fc?.hostDisconnected();\n }\n\n /**\n * Order of operations is important\n */\n async #init() {\n await this.host.updateComplete;\n this.#initListbox();\n this.#initItems();\n this.#initButton();\n this.#initInput();\n this.#initLabels();\n this.#initController();\n }\n\n #initListbox() {\n this.#mo.disconnect();\n this.#listbox?.removeEventListener('focusout', this.#onFocusoutListbox);\n this.#listbox?.removeEventListener('keydown', this.#onKeydownListbox);\n this.#listbox?.removeEventListener('click', this.#onClickListbox);\n this.#listbox = this.options.getListboxElement();\n if (!this.#listbox) {\n throw new Error('ComboboxController getListboxElement() option must return an element');\n }\n this.#listbox.addEventListener('focusout', this.#onFocusoutListbox);\n this.#listbox.addEventListener('keydown', this.#onKeydownListbox);\n this.#listbox.addEventListener('click', this.#onClickListbox);\n this.#listbox.id ??= getRandomId();\n this.#mo.observe(this.#listbox, { childList: true });\n }\n\n #initButton() {\n this.#button?.removeEventListener('click', this.#onClickButton);\n this.#button?.removeEventListener('keydown', this.#onKeydownButton);\n this.#button = this.options.getToggleButton();\n if (!this.#button) {\n throw new Error('ComboboxController getToggleButton() option must return an element');\n }\n this.#buttonInitialRole = this.#button.role;\n this.#button.role = 'combobox';\n this.#button.setAttribute('aria-controls', this.#listbox?.id ?? '');\n this.#button.addEventListener('click', this.#onClickButton);\n this.#button.addEventListener('keydown', this.#onKeydownButton);\n }\n\n #initInput() {\n this.#input?.removeEventListener('click', this.#onClickButton);\n this.#input?.removeEventListener('keyup', this.#onKeyupInput);\n this.#input?.removeEventListener('keydown', this.#onKeydownInput);\n\n this.#input = this.options.getComboboxInput();\n if (this.#input && !('value' in this.#input)) {\n throw new Error(`ComboboxController getToggleInput() option must return an element with a value property`);\n } else if (this.#input) {\n this.#input.role = 'combobox';\n this.#button!.role = this.#buttonInitialRole;\n this.#input.setAttribute('aria-autocomplete', 'both');\n this.#input.setAttribute('aria-controls', this.#listbox?.id ?? '');\n this.#input.addEventListener('click', this.#onClickButton);\n this.#input.addEventListener('keyup', this.#onKeyupInput);\n this.#input.addEventListener('keydown', this.#onKeydownInput);\n }\n }\n\n #initLabels() {\n const labels = InternalsController.getLabels(this.host)\n ?? this.#element?.ariaLabelledByElements\n ?? [];\n const label = this.options.getFallbackLabel()\n || this.#element?.ariaLabelledByElements?.map(x => x.textContent).join('')\n || null;\n\n for (const element of [this.#button, this.#listbox, this.#input].filter(x => !!x)) {\n if ('ariaLabelledByElements' in HTMLElement.prototype && labels.filter(x => !!x).length) {\n element.ariaLabelledByElements = [...labels ?? []];\n } else {\n element.ariaLabel = label;\n }\n }\n }\n\n #initController() {\n this.#fc?.hostDisconnected();\n const { getOrientation } = this.options;\n const getItems = () => this.items;\n const getItemsContainer = () => this.#listbox;\n if (this.#hasTextInput) {\n this.#fc = ActivedescendantController.of(this.host, {\n getItems, getItemsContainer, getOrientation,\n getActiveDescendantContainer: () => this.#input,\n getControlsElements: () => [\n this.options.getToggleButton(),\n this.options.getComboboxInput(),\n ].filter(x => !!x),\n setItemActive: this.options.setItemActive,\n });\n } else {\n this.#fc = RovingTabindexController.of(this.host, {\n getItems, getItemsContainer, getOrientation,\n getControlsElements: () => [\n this.options.getToggleButton(),\n ].filter(x => !!x),\n });\n }\n }\n\n #initItems() {\n if (this.#listbox) {\n this.items = this.options.getItems();\n }\n }\n\n async #show(): Promise<void> {\n const success = await this.options.requestShowListbox();\n this.#filterItems();\n if (success !== false && !this.#hasTextInput) {\n if (!this.#preventListboxGainingFocus) {\n (this.#focusedItem ?? this.#fc?.items.at(0))?.focus();\n this.#preventListboxGainingFocus = false;\n }\n }\n }\n\n async #hide(): Promise<void> {\n await this.options.requestHideListbox();\n }\n\n async #toggle() {\n if (this.options.isExpanded()) {\n return this.#hide();\n } else {\n return this.#show();\n }\n }\n\n #translate(key: string, lang: Lang) {\n const strings = this.#microcopy.get(key);\n return strings?.[lang] ?? key;\n }\n\n // TODO(bennypowers): perhaps move this to ActivedescendantController\n #announce(item: Item) {\n const value = this.options.getItemValue(item);\n ComboboxController.#alert?.remove();\n const fragment = ComboboxController.#alertTemplate.content.cloneNode(true) as DocumentFragment;\n ComboboxController.#alert = fragment.firstElementChild as HTMLElement;\n let text = value;\n const lang = deepClosest(this.#listbox, '[lang]')?.getAttribute('lang') ?? 'en';\n const langKey = lang?.match(ComboboxController.langsRE)?.at(0) as Lang ?? 'en';\n if (this.options.isItemDisabled(item)) {\n text += ` (${this.#translate('dimmed', langKey)})`;\n }\n if (this.#lb.isSelected(item)) {\n text += `, (${this.#translate('selected', langKey)})`;\n }\n if (item.hasAttribute('aria-setsize') && item.hasAttribute('aria-posinset')) {\n if (langKey === 'ja') {\n text += `, (${item.getAttribute('aria-setsize')} 件中 ${item.getAttribute('aria-posinset')} 件目)`;\n } else {\n text += `, (${item.getAttribute('aria-posinset')} ${this.#translate('of', langKey)} ${item.getAttribute('aria-setsize')})`;\n }\n }\n ComboboxController.#alert.lang = lang;\n ComboboxController.#alert.innerText = text;\n document.body.append(ComboboxController.#alert);\n }\n\n #filterItems() {\n if (this.#input) {\n let value: string;\n for (const item of this.items) {\n const hidden =\n !!this.options.isExpanded()\n && !!(value = this.options.getComboboxValue(this.#input))\n && this.options.isItemFiltered?.(item, value)\n || false;\n this.options.setItemHidden(item, hidden);\n }\n }\n }\n\n #onClickButton = () => {\n if (!this.options.isExpanded()) {\n this.#show();\n } else {\n this.#hide();\n }\n };\n\n #onClickListbox = (event: MouseEvent) => {\n if (!this.multi && event.composedPath().some(this.options.isItem)) {\n this.#hide();\n }\n };\n\n /**\n * Handle keypresses on the input\n * ## `Down Arrow`\n * - If the textbox is not empty and the listbox is displayed,\n * moves visual focus to the first suggested value.\n * - If the textbox is empty and the listbox is not displayed,\n * opens the listbox and moves visual focus to the first option.\n * - In both cases DOM focus remains on the textbox.\n *\n * ## `Alt + Down Arrow`\n * Opens the listbox without moving focus or changing selection.\n *\n * ## `Up Arrow`\n * - If the textbox is not empty and the listbox is displayed,\n * moves visual focus to the last suggested value.\n * - If the textbox is empty, first opens the listbox if it is not already displayed\n * and then moves visual focus to the last option.\n * - In both cases DOM focus remains on the textbox.\n *\n * ## `Enter`\n * Closes the listbox if it is displayed.\n *\n * ## `Escape`\n * - If the listbox is displayed, closes it.\n * - If the listbox is not displayed, clears the textbox.\n *\n * ## Standard single line text editing keys\n * - Keys used for cursor movement and text manipulation,\n * such as `Delete` and `Shift + Right Arrow`.\n * - An HTML `input` with `type=\"text\"` is used for the textbox so the browser will provide\n * platform-specific editing keys.\n *\n * @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-list\n * @param event keydown event\n */\n #onKeydownInput = (event: KeyboardEvent) => {\n if (event.ctrlKey || event.shiftKey || !this.#input) {\n return;\n }\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n if (!this.options.isExpanded()) {\n this.#preventListboxGainingFocus = event.altKey;\n this.#show();\n }\n break;\n case 'Enter':\n if (!this.multi) {\n this.#hide();\n }\n break;\n case 'Escape':\n if (!this.options.isExpanded()) {\n this.options.setComboboxValue(this.#input, '');\n this.host.requestUpdate();\n }\n this.#hide();\n break;\n case 'Alt':\n case 'AltGraph':\n case 'Shift':\n case 'Control':\n case 'Fn':\n case 'Symbol':\n case 'Hyper':\n case 'Super':\n case 'Meta':\n case 'CapsLock':\n case 'FnLock':\n case 'NumLock':\n case 'Tab':\n case 'ScrollLock':\n case 'SymbolLock':\n case ' ':\n break;\n default:\n if (!this.options.isExpanded()) {\n this.#show();\n }\n }\n };\n\n /**\n * Populates the combobox input with the focused value when navigating the listbox,\n * and filters the items when typing.\n * @param event keyup event\n */\n #onKeyupInput = (event: KeyboardEvent) => {\n if (!this.#input) {\n return;\n }\n switch (event.key) {\n case 'ArrowUp':\n case 'ArrowDown':\n /**\n * Safari VoiceOver does not support aria-activedescendant, so we must.\n * approximate the correct behaviour by constructing a visually-hidden alert role\n * @see (https://bugs.webkit.org/show_bug.cgi?id=269026)\n */\n if (this.#focusedItem\n && this.options.getComboboxInput()\n && InternalsController.isSafari) {\n this.#announce(this.#focusedItem);\n }\n break;\n default:\n this.#filterItems();\n }\n };\n\n #onKeydownButton = (event: KeyboardEvent) => {\n if (this.#hasTextInput) {\n return this.#onKeydownInput(event);\n } else {\n return this.#onKeydownToggleButton(event);\n }\n };\n\n #onKeydownListbox = (event: KeyboardEvent) => {\n if (!this.#hasTextInput) {\n switch (event.key) {\n case 'Home':\n case 'End':\n this.#onKeydownToggleButton(event);\n break;\n case 'Escape':\n this.#hide();\n this.#button?.focus();\n break;\n case 'Enter':\n case ' ': {\n const eventItem = event.composedPath().find(this.options.isItem);\n if (eventItem\n && !this.multi\n && this.options.isExpanded()\n && !this.options.isItemDisabled(eventItem)\n ) {\n this.#hide();\n this.#button?.focus();\n }\n }\n }\n }\n };\n\n #onFocusoutListbox = (event: FocusEvent) => {\n if (!this.#hasTextInput && this.options.isExpanded()) {\n const root = this.#element?.getRootNode();\n if ((root instanceof ShadowRoot || root instanceof Document)\n && !this.items.includes(event.relatedTarget as Item)\n ) {\n this.#hide();\n }\n }\n };\n\n #onKeydownToggleButton = async (event: KeyboardEvent) => {\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n if (!this.options.isExpanded()) {\n this.#show();\n }\n break;\n case 'Home':\n if (!this.options.isExpanded()) {\n await this.#show();\n }\n if (this.#fc) {\n this.#fc.atFocusedItemIndex = 0;\n }\n break;\n case 'End':\n if (!this.options.isExpanded()) {\n await this.#show();\n }\n if (this.#fc) {\n this.#fc.atFocusedItemIndex = this.items.length - 1;\n }\n break;\n case ' ':\n case 'Enter':\n // prevent scroll\n event.preventDefault();\n await this.#toggle();\n await this.host.updateComplete;\n if (!this.options.isExpanded()) {\n this.#button?.focus();\n }\n break;\n }\n };\n\n /**\n * For Browsers which do not support `ariaActiveDescendantElement`, we must clone\n * the listbox items into the same root as the combobox input\n * Call this method to return either an array of (cloned) list box items, to be placed in your\n * shadow template, or nothing in the case the browser supports cross-root aria.\n */\n public renderItemsToShadowRoot(): Node[] | typeof nothing {\n if (this.#fc instanceof ActivedescendantController) {\n return this.#fc.renderItemsToShadowRoot();\n } else {\n return nothing;\n }\n }\n}\n"]}
|
|
@@ -4,7 +4,7 @@ export class CssVariableController {
|
|
|
4
4
|
this.style = window.getComputedStyle(host);
|
|
5
5
|
}
|
|
6
6
|
parseProperty(name) {
|
|
7
|
-
return name.
|
|
7
|
+
return name.substring(0, 2) !== '--' ? `--${name}` : name;
|
|
8
8
|
}
|
|
9
9
|
getVariable(name) {
|
|
10
10
|
return this.style.getPropertyValue(this.parseProperty(name)).trim() || null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css-variable-controller.js","sourceRoot":"","sources":["css-variable-controller.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,qBAAqB;IAGhC,YAAmB,IAAqB;QAArB,SAAI,GAAJ,IAAI,CAAiB;QACtC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IAEO,aAAa,CAAC,IAAY;QAChC,OAAO,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"css-variable-controller.js","sourceRoot":"","sources":["css-variable-controller.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,qBAAqB;IAGhC,YAAmB,IAAqB;QAArB,SAAI,GAAJ,IAAI,CAAiB;QACtC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IAEO,aAAa,CAAC,IAAY;QAChC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5D,CAAC;IAED,WAAW,CAAC,IAAY;QACtB,OAAO,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC;IAC9E,CAAC;CAGF","sourcesContent":["import type { ReactiveElement, ReactiveController } from 'lit';\n\nexport class CssVariableController implements ReactiveController {\n style: CSSStyleDeclaration;\n\n constructor(public host: ReactiveElement) {\n this.style = window.getComputedStyle(host);\n }\n\n private parseProperty(name: string) {\n return name.substring(0, 2) !== '--' ? `--${name}` : name;\n }\n\n getVariable(name: string): string | null {\n return this.style.getPropertyValue(this.parseProperty(name)).trim() || null;\n }\n\n hostConnected?(): void;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Placement } from '@floating-ui/dom';
|
|
2
|
-
import type { ReactiveController,
|
|
2
|
+
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
3
3
|
import type { StyleInfo } from 'lit/directives/style-map.js';
|
|
4
4
|
import type { OffsetOptions as Offset } from '@floating-ui/core';
|
|
5
5
|
export type { Placement };
|
|
@@ -42,9 +42,16 @@ export declare class FloatingDOMController implements ReactiveController {
|
|
|
42
42
|
* - `--_floating-content-translate`: translate to apply to floating content.
|
|
43
43
|
*/
|
|
44
44
|
get styles(): StyleInfo;
|
|
45
|
-
constructor(host:
|
|
45
|
+
constructor(host: ReactiveControllerHost, options: FloatingDOMControllerOptions);
|
|
46
46
|
hostDisconnected(): void;
|
|
47
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Show the floating DOM
|
|
49
|
+
* @param [options={}]
|
|
50
|
+
* @param options.offset
|
|
51
|
+
* @param options.placement
|
|
52
|
+
* @param options.flip
|
|
53
|
+
* @param options.fallbackPlacements
|
|
54
|
+
* */
|
|
48
55
|
show({ offset, placement, flip, fallbackPlacements }?: ShowOptions): Promise<void>;
|
|
49
56
|
/** Hide the floating DOM */
|
|
50
57
|
hide(): Promise<void>;
|
|
@@ -1,45 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
var _FloatingDOMController_instances, _FloatingDOMController_open, _FloatingDOMController_opening, _FloatingDOMController_cleanup, _FloatingDOMController_anchor, _FloatingDOMController_alignment, _FloatingDOMController_styles, _FloatingDOMController_placement, _FloatingDOMController_options, _FloatingDOMController_invoker_get, _FloatingDOMController_content_get, _FloatingDOMController_arrow_get, _FloatingDOMController_update;
|
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
|
+
import { autoUpdate, computePosition, offset as offsetMiddleware, shift as shiftMiddleware, flip as flipMiddleware, arrow as arrowMiddleware, } from '@floating-ui/dom';
|
|
2
4
|
/**
|
|
3
5
|
* Controls floating DOM within a web component, e.g. tooltips and popovers
|
|
4
6
|
*/
|
|
5
7
|
export class FloatingDOMController {
|
|
6
|
-
#open = false;
|
|
7
|
-
#opening = false;
|
|
8
|
-
#cleanup;
|
|
9
|
-
#anchor;
|
|
10
|
-
#alignment;
|
|
11
|
-
#styles;
|
|
12
|
-
#placement;
|
|
13
|
-
#options;
|
|
14
|
-
get #invoker() {
|
|
15
|
-
const { invoker } = this.#options;
|
|
16
|
-
return typeof invoker === 'function' ? invoker() : invoker;
|
|
17
|
-
}
|
|
18
|
-
get #content() {
|
|
19
|
-
const { content } = this.#options;
|
|
20
|
-
return typeof content === 'function' ? content() : content;
|
|
21
|
-
}
|
|
22
|
-
get #arrow() {
|
|
23
|
-
const { arrow } = this.#options;
|
|
24
|
-
return typeof arrow === 'function' ? arrow() : arrow;
|
|
25
|
-
}
|
|
26
8
|
/** The crosswise alignment of the invoker on which to display the floating DOM */
|
|
27
9
|
get alignment() {
|
|
28
|
-
return this
|
|
10
|
+
return __classPrivateFieldGet(this, _FloatingDOMController_alignment, "f") ?? 'center';
|
|
29
11
|
}
|
|
30
12
|
/** The side of the invoker on which to display the floating DOM */
|
|
31
13
|
get anchor() {
|
|
32
|
-
return this
|
|
14
|
+
return __classPrivateFieldGet(this, _FloatingDOMController_anchor, "f") ?? '';
|
|
33
15
|
}
|
|
34
16
|
/**
|
|
35
17
|
* When true, the floating DOM is visible
|
|
36
18
|
*/
|
|
37
19
|
get open() {
|
|
38
|
-
return this
|
|
20
|
+
return __classPrivateFieldGet(this, _FloatingDOMController_open, "f");
|
|
39
21
|
}
|
|
40
22
|
/** The computed placement of the floating DOM */
|
|
41
23
|
get placement() {
|
|
42
|
-
return this
|
|
24
|
+
return __classPrivateFieldGet(this, _FloatingDOMController_placement, "f") ?? 'top';
|
|
43
25
|
}
|
|
44
26
|
/**
|
|
45
27
|
* Styles to apply to your element's container
|
|
@@ -47,86 +29,114 @@ export class FloatingDOMController {
|
|
|
47
29
|
* - `--_floating-content-translate`: translate to apply to floating content.
|
|
48
30
|
*/
|
|
49
31
|
get styles() {
|
|
50
|
-
return this
|
|
32
|
+
return __classPrivateFieldGet(this, _FloatingDOMController_styles, "f") ?? {};
|
|
51
33
|
}
|
|
52
34
|
constructor(host, options) {
|
|
35
|
+
_FloatingDOMController_instances.add(this);
|
|
53
36
|
this.host = host;
|
|
37
|
+
_FloatingDOMController_open.set(this, false);
|
|
38
|
+
_FloatingDOMController_opening.set(this, false);
|
|
39
|
+
_FloatingDOMController_cleanup.set(this, void 0);
|
|
40
|
+
_FloatingDOMController_anchor.set(this, void 0);
|
|
41
|
+
_FloatingDOMController_alignment.set(this, void 0);
|
|
42
|
+
_FloatingDOMController_styles.set(this, void 0);
|
|
43
|
+
_FloatingDOMController_placement.set(this, void 0);
|
|
44
|
+
_FloatingDOMController_options.set(this, void 0);
|
|
54
45
|
host.addController(this);
|
|
55
|
-
this
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
__classPrivateFieldSet(this, _FloatingDOMController_options, {
|
|
47
|
+
invoker: (() => host),
|
|
48
|
+
shift: true,
|
|
49
|
+
...options,
|
|
50
|
+
}, "f");
|
|
58
51
|
}
|
|
59
52
|
hostDisconnected() {
|
|
60
|
-
this
|
|
61
|
-
}
|
|
62
|
-
async #update(placement = 'top', offset, flip = true, fallbackPlacements) {
|
|
63
|
-
const { padding, shift } = this.#options;
|
|
64
|
-
const invoker = this.#invoker;
|
|
65
|
-
const content = this.#content;
|
|
66
|
-
const arrow = this.#arrow;
|
|
67
|
-
if (!invoker || !content) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
const { x, y, placement: _placement, middlewareData } = await computePosition(invoker, content, {
|
|
71
|
-
strategy: 'absolute',
|
|
72
|
-
placement,
|
|
73
|
-
middleware: [
|
|
74
|
-
offsetMiddleware(offset),
|
|
75
|
-
shift && shiftMiddleware({ padding }),
|
|
76
|
-
arrow && arrowMiddleware({ element: arrow, padding: arrow.offsetHeight / 2 }),
|
|
77
|
-
flip && flipMiddleware({ padding, fallbackPlacements }),
|
|
78
|
-
].filter(Boolean)
|
|
79
|
-
});
|
|
80
|
-
if (arrow) {
|
|
81
|
-
const { x: arrowX, y: arrowY } = middlewareData.arrow || {};
|
|
82
|
-
const staticSide = {
|
|
83
|
-
top: 'bottom',
|
|
84
|
-
right: 'left',
|
|
85
|
-
bottom: 'top',
|
|
86
|
-
left: 'right',
|
|
87
|
-
}[_placement.split('-')[0]] || '';
|
|
88
|
-
Object.assign(arrow.style, {
|
|
89
|
-
left: arrowX != null ? `${arrowX}px` : '',
|
|
90
|
-
top: arrowY != null && !['top'].includes(_placement) ? `${arrowY}px` : '',
|
|
91
|
-
right: '',
|
|
92
|
-
bottom: '',
|
|
93
|
-
[staticSide]: `-${arrow.offsetHeight / 2}px`,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
this.#placement = _placement;
|
|
97
|
-
[this.#anchor, this.#alignment] = (this.#placement.split('-') ?? []);
|
|
98
|
-
this.#styles = {
|
|
99
|
-
'--_floating-content-translate': `${x}px ${y}px`,
|
|
100
|
-
};
|
|
101
|
-
this.host.requestUpdate();
|
|
53
|
+
__classPrivateFieldGet(this, _FloatingDOMController_cleanup, "f")?.call(this);
|
|
102
54
|
}
|
|
103
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Show the floating DOM
|
|
57
|
+
* @param [options={}]
|
|
58
|
+
* @param options.offset
|
|
59
|
+
* @param options.placement
|
|
60
|
+
* @param options.flip
|
|
61
|
+
* @param options.fallbackPlacements
|
|
62
|
+
* */
|
|
104
63
|
async show({ offset, placement, flip, fallbackPlacements } = {}) {
|
|
105
|
-
const invoker = this
|
|
106
|
-
const content = this
|
|
64
|
+
const invoker = __classPrivateFieldGet(this, _FloatingDOMController_instances, "a", _FloatingDOMController_invoker_get);
|
|
65
|
+
const content = __classPrivateFieldGet(this, _FloatingDOMController_instances, "a", _FloatingDOMController_content_get);
|
|
107
66
|
if (!invoker || !content) {
|
|
108
67
|
return;
|
|
109
68
|
}
|
|
110
|
-
if (!this
|
|
111
|
-
this
|
|
112
|
-
const p = this
|
|
113
|
-
this
|
|
69
|
+
if (!__classPrivateFieldGet(this, _FloatingDOMController_opening, "f")) {
|
|
70
|
+
__classPrivateFieldSet(this, _FloatingDOMController_opening, true, "f");
|
|
71
|
+
const p = __classPrivateFieldGet(this, _FloatingDOMController_instances, "m", _FloatingDOMController_update).call(this, placement, offset, flip, fallbackPlacements);
|
|
72
|
+
__classPrivateFieldSet(this, _FloatingDOMController_cleanup, __classPrivateFieldGet(this, _FloatingDOMController_cleanup, "f") ?? autoUpdate(invoker, content, () => __classPrivateFieldGet(this, _FloatingDOMController_instances, "m", _FloatingDOMController_update).call(this, placement, offset, flip, fallbackPlacements)), "f");
|
|
114
73
|
await p;
|
|
115
|
-
this
|
|
74
|
+
__classPrivateFieldSet(this, _FloatingDOMController_opening, false, "f");
|
|
116
75
|
}
|
|
117
|
-
this
|
|
76
|
+
__classPrivateFieldSet(this, _FloatingDOMController_open, true, "f");
|
|
118
77
|
this.host.requestUpdate();
|
|
119
78
|
}
|
|
120
79
|
/** Hide the floating DOM */
|
|
121
80
|
async hide() {
|
|
122
81
|
await this.host.updateComplete;
|
|
123
|
-
while (this
|
|
82
|
+
while (__classPrivateFieldGet(this, _FloatingDOMController_opening, "f") && !this.open) {
|
|
124
83
|
await new Promise(requestAnimationFrame);
|
|
125
84
|
}
|
|
126
|
-
this
|
|
127
|
-
this
|
|
85
|
+
__classPrivateFieldSet(this, _FloatingDOMController_open, false, "f");
|
|
86
|
+
__classPrivateFieldGet(this, _FloatingDOMController_cleanup, "f")?.call(this);
|
|
128
87
|
this.host.requestUpdate();
|
|
129
88
|
await this.host.updateComplete;
|
|
130
89
|
}
|
|
131
90
|
}
|
|
91
|
+
_FloatingDOMController_open = new WeakMap(), _FloatingDOMController_opening = new WeakMap(), _FloatingDOMController_cleanup = new WeakMap(), _FloatingDOMController_anchor = new WeakMap(), _FloatingDOMController_alignment = new WeakMap(), _FloatingDOMController_styles = new WeakMap(), _FloatingDOMController_placement = new WeakMap(), _FloatingDOMController_options = new WeakMap(), _FloatingDOMController_instances = new WeakSet(), _FloatingDOMController_invoker_get = function _FloatingDOMController_invoker_get() {
|
|
92
|
+
const { invoker } = __classPrivateFieldGet(this, _FloatingDOMController_options, "f");
|
|
93
|
+
return typeof invoker === 'function' ? invoker() : invoker;
|
|
94
|
+
}, _FloatingDOMController_content_get = function _FloatingDOMController_content_get() {
|
|
95
|
+
const { content } = __classPrivateFieldGet(this, _FloatingDOMController_options, "f");
|
|
96
|
+
return typeof content === 'function' ? content() : content;
|
|
97
|
+
}, _FloatingDOMController_arrow_get = function _FloatingDOMController_arrow_get() {
|
|
98
|
+
const { arrow } = __classPrivateFieldGet(this, _FloatingDOMController_options, "f");
|
|
99
|
+
return typeof arrow === 'function' ? arrow() : arrow;
|
|
100
|
+
}, _FloatingDOMController_update = async function _FloatingDOMController_update(placement = 'top', offset, flip = true, fallbackPlacements) {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
const { padding, shift } = __classPrivateFieldGet(this, _FloatingDOMController_options, "f");
|
|
103
|
+
const invoker = __classPrivateFieldGet(this, _FloatingDOMController_instances, "a", _FloatingDOMController_invoker_get);
|
|
104
|
+
const content = __classPrivateFieldGet(this, _FloatingDOMController_instances, "a", _FloatingDOMController_content_get);
|
|
105
|
+
const arrow = __classPrivateFieldGet(this, _FloatingDOMController_instances, "a", _FloatingDOMController_arrow_get);
|
|
106
|
+
if (!invoker || !content) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const { x, y, placement: _placement, middlewareData, } = await computePosition(invoker, content, {
|
|
110
|
+
strategy: 'absolute',
|
|
111
|
+
placement,
|
|
112
|
+
middleware: [
|
|
113
|
+
offsetMiddleware(offset),
|
|
114
|
+
shift && shiftMiddleware({ padding }),
|
|
115
|
+
arrow && arrowMiddleware({ element: arrow, padding: arrow.offsetHeight / 2 }),
|
|
116
|
+
flip && flipMiddleware({ padding, fallbackPlacements }),
|
|
117
|
+
].filter(Boolean),
|
|
118
|
+
});
|
|
119
|
+
if (arrow) {
|
|
120
|
+
const { x: arrowX, y: arrowY } = middlewareData.arrow || {};
|
|
121
|
+
const staticSide = {
|
|
122
|
+
top: 'bottom',
|
|
123
|
+
right: 'left',
|
|
124
|
+
bottom: 'top',
|
|
125
|
+
left: 'right',
|
|
126
|
+
}[_placement.split('-')[0]] || '';
|
|
127
|
+
Object.assign(arrow.style, {
|
|
128
|
+
left: arrowX != null ? `${arrowX}px` : '',
|
|
129
|
+
top: arrowY != null && !['top'].includes(_placement) ? `${arrowY}px` : '',
|
|
130
|
+
right: '',
|
|
131
|
+
bottom: '',
|
|
132
|
+
[staticSide]: `-${arrow.offsetHeight / 2}px`,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
__classPrivateFieldSet(this, _FloatingDOMController_placement, _placement, "f");
|
|
136
|
+
_a = this, _b = this, [({ set value(_c) { __classPrivateFieldSet(_a, _FloatingDOMController_anchor, _c, "f"); } }).value, ({ set value(_c) { __classPrivateFieldSet(_b, _FloatingDOMController_alignment, _c, "f"); } }).value] = (__classPrivateFieldGet(this, _FloatingDOMController_placement, "f").split('-') ?? []);
|
|
137
|
+
__classPrivateFieldSet(this, _FloatingDOMController_styles, {
|
|
138
|
+
'--_floating-content-translate': `${x}px ${y}px`,
|
|
139
|
+
}, "f");
|
|
140
|
+
this.host.requestUpdate();
|
|
141
|
+
};
|
|
132
142
|
//# sourceMappingURL=floating-dom-controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floating-dom-controller.js","sourceRoot":"","sources":["floating-dom-controller.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,UAAU,EACV,eAA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,CAAC;IACjC,CAAC;CACF","sourcesContent":["import type { Placement } from '@floating-ui/dom';\nimport type { ReactiveController, ReactiveElement } from 'lit';\nimport type { StyleInfo } from 'lit/directives/style-map.js';\nimport type { OffsetOptions as Offset } from '@floating-ui/core';\n\nexport type { Placement };\n\nimport {\n autoUpdate,\n computePosition,\n offset as offsetMiddleware,\n shift as shiftMiddleware,\n flip as flipMiddleware,\n arrow as arrowMiddleware\n} from '@floating-ui/dom';\n\ntype Lazy<T> = T | (() => T | null | undefined);\n\ninterface FloatingDOMControllerOptions {\n content: Lazy<HTMLElement>;\n invoker?: Lazy<HTMLElement>;\n arrow?: Lazy<HTMLElement>;\n shift?: boolean;\n padding?: number;\n fallbackPlacements?: Placement[];\n}\n\ninterface ShowOptions {\n offset?: Offset;\n placement?: Placement;\n flip?: boolean;\n fallbackPlacements?: Placement[];\n}\n\nexport type Anchor = '' | 'top' | 'left' | 'bottom' | 'right';\nexport type Alignment = 'center' | 'start' | 'end';\n\n/**\n * Controls floating DOM within a web component, e.g. tooltips and popovers\n */\nexport class FloatingDOMController implements ReactiveController {\n #open = false;\n #opening = false;\n #cleanup?: () => void;\n #anchor?: Anchor;\n #alignment?: Alignment;\n #styles?: StyleInfo;\n #placement?: Placement;\n #options: Required<FloatingDOMControllerOptions>;\n\n get #invoker() {\n const { invoker } = this.#options;\n return typeof invoker === 'function' ? invoker() : invoker;\n }\n\n get #content() {\n const { content } = this.#options;\n return typeof content === 'function' ? content() : content;\n }\n\n get #arrow() {\n const { arrow } = this.#options;\n return typeof arrow === 'function' ? arrow() : arrow;\n }\n\n /** The crosswise alignment of the invoker on which to display the floating DOM */\n get alignment() {\n return this.#alignment ?? 'center';\n }\n\n /** The side of the invoker on which to display the floating DOM */\n get anchor() {\n return this.#anchor ?? '';\n }\n\n /**\n * When true, the floating DOM is visible\n */\n get open() {\n return this.#open;\n }\n\n /** The computed placement of the floating DOM */\n get placement(): Placement {\n return this.#placement ?? 'top';\n }\n\n /**\n * Styles to apply to your element's container\n *\n * - `--_floating-content-translate`: translate to apply to floating content.\n */\n get styles(): StyleInfo {\n return this.#styles ?? {};\n }\n\n constructor(\n private host: ReactiveElement,\n options: FloatingDOMControllerOptions\n ) {\n host.addController(this);\n this.#options = options as Required<FloatingDOMControllerOptions>;\n this.#options.invoker ??= host;\n this.#options.shift ??= true;\n }\n\n hostDisconnected() {\n this.#cleanup?.();\n }\n\n async #update(placement: Placement = 'top', offset?: Offset, flip = true, fallbackPlacements?: Placement[]) {\n const { padding, shift } = this.#options;\n\n const invoker = this.#invoker;\n const content = this.#content;\n const arrow = this.#arrow;\n if (!invoker || !content) {\n return;\n }\n const { x, y, placement: _placement, middlewareData } = await computePosition(invoker, content, {\n strategy: 'absolute',\n placement,\n middleware: [\n offsetMiddleware(offset),\n shift && shiftMiddleware({ padding }),\n arrow && arrowMiddleware({ element: arrow, padding: arrow.offsetHeight / 2 }),\n flip && flipMiddleware({ padding, fallbackPlacements }),\n ].filter(Boolean)\n });\n\n if (arrow) {\n const { x: arrowX, y: arrowY } = middlewareData.arrow || {};\n\n const staticSide = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n }[_placement.split('-')[0]] || '';\n\n Object.assign(arrow.style, {\n left: arrowX != null ? `${arrowX}px` : '',\n top: arrowY != null && !['top'].includes(_placement) ? `${arrowY}px` : '',\n right: '',\n bottom: '',\n [staticSide]: `-${arrow.offsetHeight / 2}px`,\n });\n }\n\n this.#placement = _placement;\n [this.#anchor, this.#alignment] = (this.#placement.split('-') ?? []) as [Anchor, Alignment];\n this.#styles = {\n '--_floating-content-translate': `${x}px ${y}px`,\n };\n this.host.requestUpdate();\n }\n\n /** Show the floating DOM */\n async show({ offset, placement, flip, fallbackPlacements }: ShowOptions = {}) {\n const invoker = this.#invoker;\n const content = this.#content;\n if (!invoker || !content) {\n return;\n }\n if (!this.#opening) {\n this.#opening = true;\n const p = this.#update(placement, offset, flip, fallbackPlacements);\n this.#cleanup ??= autoUpdate(invoker, content, () =>\n this.#update(placement, offset, flip, fallbackPlacements));\n await p;\n this.#opening = false;\n }\n this.#open = true;\n this.host.requestUpdate();\n }\n\n /** Hide the floating DOM */\n async hide() {\n await this.host.updateComplete;\n while (this.#opening && !this.open) {\n await new Promise(requestAnimationFrame);\n }\n this.#open = false;\n this.#cleanup?.();\n this.host.requestUpdate();\n await this.host.updateComplete;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"floating-dom-controller.js","sourceRoot":"","sources":["floating-dom-controller.ts"],"names":[],"mappings":";;AAOA,OAAO,EACL,UAAU,EACV,eAAe,EACf,MAAM,IAAI,gBAAgB,EAC1B,KAAK,IAAI,eAAe,EACxB,IAAI,IAAI,cAAc,EACtB,KAAK,IAAI,eAAe,GACzB,MAAM,kBAAkB,CAAC;AAuB1B;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAyBhC,kFAAkF;IAClF,IAAI,SAAS;QACX,OAAO,uBAAA,IAAI,wCAAW,IAAI,QAAQ,CAAC;IACrC,CAAC;IAED,mEAAmE;IACnE,IAAI,MAAM;QACR,OAAO,uBAAA,IAAI,qCAAQ,IAAI,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACN,OAAO,uBAAA,IAAI,mCAAM,CAAC;IACpB,CAAC;IAED,iDAAiD;IACjD,IAAI,SAAS;QACX,OAAO,uBAAA,IAAI,wCAAW,IAAI,KAAK,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACH,IAAI,MAAM;QACR,OAAO,uBAAA,IAAI,qCAAQ,IAAI,EAAE,CAAC;IAC5B,CAAC;IAED,YACU,IAA4B,EACpC,OAAqC;;QAD7B,SAAI,GAAJ,IAAI,CAAwB;QAxDtC,sCAAQ,KAAK,EAAC;QACd,yCAAW,KAAK,EAAC;QACjB,iDAAsB;QACtB,gDAAiB;QACjB,mDAAuB;QACvB,gDAAoB;QACpB,mDAAuB;QACvB,iDAAuC;QAoDrC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC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,KAAK,CAAC,YAAY,GAAG,CAAC,IAAI;SAC7C,CAAC,CAAC;IACL,CAAC;IAED,uBAAA,IAAI,oCAAc,UAAU,MAAA,CAAC;IAC7B,KAAC,IAAI,OAAU,IAAI,EAAnB,yMAA+B,GAAG,CAAC,uBAAA,IAAI,wCAAW,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAwB,CAAC;IAC5F,uBAAA,IAAI,iCAAW;QACb,+BAA+B,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI;KACjD,MAAA,CAAC;IACF,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;AAC5B,CAAC","sourcesContent":["import type { Placement } from '@floating-ui/dom';\nimport type { LitElement, ReactiveController, ReactiveControllerHost } from 'lit';\nimport type { StyleInfo } from 'lit/directives/style-map.js';\nimport type { OffsetOptions as Offset } from '@floating-ui/core';\n\nexport type { Placement };\n\nimport {\n autoUpdate,\n computePosition,\n offset as offsetMiddleware,\n shift as shiftMiddleware,\n flip as flipMiddleware,\n arrow as arrowMiddleware,\n} from '@floating-ui/dom';\n\ntype Lazy<T> = T | (() => T | null | undefined);\n\ninterface FloatingDOMControllerOptions {\n content: Lazy<HTMLElement>;\n invoker?: Lazy<HTMLElement>;\n arrow?: Lazy<HTMLElement>;\n shift?: boolean;\n padding?: number;\n fallbackPlacements?: Placement[];\n}\n\ninterface ShowOptions {\n offset?: Offset;\n placement?: Placement;\n flip?: boolean;\n fallbackPlacements?: Placement[];\n}\n\nexport type Anchor = '' | 'top' | 'left' | 'bottom' | 'right';\nexport type Alignment = 'center' | 'start' | 'end';\n\n/**\n * Controls floating DOM within a web component, e.g. tooltips and popovers\n */\nexport class FloatingDOMController implements ReactiveController {\n #open = false;\n #opening = false;\n #cleanup?: () => void;\n #anchor?: Anchor;\n #alignment?: Alignment;\n #styles?: StyleInfo;\n #placement?: Placement;\n #options: FloatingDOMControllerOptions;\n\n get #invoker() {\n const { invoker } = this.#options;\n return typeof invoker === 'function' ? invoker() : invoker;\n }\n\n get #content() {\n const { content } = this.#options;\n return typeof content === 'function' ? content() : content;\n }\n\n get #arrow() {\n const { arrow } = this.#options;\n return typeof arrow === 'function' ? arrow() : arrow;\n }\n\n /** The crosswise alignment of the invoker on which to display the floating DOM */\n get alignment(): Alignment {\n return this.#alignment ?? 'center';\n }\n\n /** The side of the invoker on which to display the floating DOM */\n get anchor(): Anchor {\n return this.#anchor ?? '';\n }\n\n /**\n * When true, the floating DOM is visible\n */\n get open(): boolean {\n return this.#open;\n }\n\n /** The computed placement of the floating DOM */\n get placement(): Placement {\n return this.#placement ?? 'top';\n }\n\n /**\n * Styles to apply to your element's container\n *\n * - `--_floating-content-translate`: translate to apply to floating content.\n */\n get styles(): StyleInfo {\n return this.#styles ?? {};\n }\n\n constructor(\n private host: ReactiveControllerHost,\n options: FloatingDOMControllerOptions\n ) {\n host.addController(this);\n this.#options = {\n invoker: (() => host as LitElement),\n shift: true,\n ...options,\n };\n }\n\n hostDisconnected(): void {\n this.#cleanup?.();\n }\n\n async #update(\n placement: Placement = 'top',\n offset?: Offset,\n flip = true,\n fallbackPlacements?: Placement[],\n ) {\n const { padding, shift } = this.#options;\n\n const invoker = this.#invoker;\n const content = this.#content;\n const arrow = this.#arrow;\n if (!invoker || !content) {\n return;\n }\n const {\n x,\n y,\n placement: _placement,\n middlewareData,\n } = await computePosition(invoker, content, {\n strategy: 'absolute',\n placement,\n middleware: [\n offsetMiddleware(offset),\n shift && shiftMiddleware({ padding }),\n arrow && arrowMiddleware({ element: arrow, padding: arrow.offsetHeight / 2 }),\n flip && flipMiddleware({ padding, fallbackPlacements }),\n ].filter(Boolean),\n });\n\n if (arrow) {\n const { x: arrowX, y: arrowY } = middlewareData.arrow || {};\n\n const staticSide = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n }[_placement.split('-')[0]] || '';\n\n Object.assign(arrow.style, {\n left: arrowX != null ? `${arrowX}px` : '',\n top: arrowY != null && !['top'].includes(_placement) ? `${arrowY}px` : '',\n right: '',\n bottom: '',\n [staticSide]: `-${arrow.offsetHeight / 2}px`,\n });\n }\n\n this.#placement = _placement;\n [this.#anchor, this.#alignment] = (this.#placement.split('-') ?? []) as [Anchor, Alignment];\n this.#styles = {\n '--_floating-content-translate': `${x}px ${y}px`,\n };\n this.host.requestUpdate();\n }\n\n /**\n * Show the floating DOM\n * @param [options={}]\n * @param options.offset\n * @param options.placement\n * @param options.flip\n * @param options.fallbackPlacements\n * */\n async show({ offset, placement, flip, fallbackPlacements }: ShowOptions = {}): Promise<void> {\n const invoker = this.#invoker;\n const content = this.#content;\n if (!invoker || !content) {\n return;\n }\n if (!this.#opening) {\n this.#opening = true;\n const p = this.#update(placement, offset, flip, fallbackPlacements);\n this.#cleanup ??= autoUpdate(invoker, content, () =>\n this.#update(placement, offset, flip, fallbackPlacements));\n await p;\n this.#opening = false;\n }\n this.#open = true;\n this.host.requestUpdate();\n }\n\n /** Hide the floating DOM */\n async hide(): Promise<void> {\n await this.host.updateComplete;\n while (this.#opening && !this.open) {\n await new Promise(requestAnimationFrame);\n }\n this.#open = false;\n this.#cleanup?.();\n this.host.requestUpdate();\n await this.host.updateComplete;\n }\n}\n"]}
|
|
@@ -1,53 +1,101 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactiveController, type ReactiveControllerHost } from 'lit';
|
|
2
|
+
interface InternalsControllerOptions extends Partial<ARIAMixin> {
|
|
3
|
+
getHTMLElement?(): HTMLElement;
|
|
4
|
+
}
|
|
2
5
|
export declare class InternalsController implements ReactiveController, ARIAMixin {
|
|
3
6
|
#private;
|
|
4
|
-
host: ReactiveControllerHost
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
host: ReactiveControllerHost;
|
|
8
|
+
private options?;
|
|
9
|
+
private static instances;
|
|
10
|
+
readonly form: ElementInternals['form'];
|
|
11
|
+
readonly shadowRoot: ElementInternals['shadowRoot'];
|
|
12
|
+
readonly states: unknown;
|
|
13
|
+
readonly willValidate: ElementInternals['willValidate'];
|
|
14
|
+
readonly validationMessage: ElementInternals['validationMessage'];
|
|
15
|
+
static getLabels(host: ReactiveControllerHost): Element[];
|
|
16
|
+
static isSafari: boolean;
|
|
17
|
+
static of(host: ReactiveControllerHost, options?: InternalsControllerOptions): InternalsController;
|
|
18
|
+
role: string | null;
|
|
19
|
+
ariaActivedescendant: string | null;
|
|
20
|
+
ariaAtomic: string | null;
|
|
21
|
+
ariaAutoComplete: string | null;
|
|
22
|
+
ariaBusy: string | null;
|
|
23
|
+
ariaBrailleLabel: string | null;
|
|
24
|
+
ariaBrailleRoleDescription: string | null;
|
|
25
|
+
ariaChecked: string | null;
|
|
26
|
+
ariaColCount: string | null;
|
|
27
|
+
ariaColIndex: string | null;
|
|
12
28
|
ariaColIndexText: string | null;
|
|
13
|
-
ariaColSpan:
|
|
14
|
-
ariaCurrent:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
ariaColSpan: string | null;
|
|
30
|
+
ariaCurrent: string | null;
|
|
31
|
+
ariaDescription: string | null;
|
|
32
|
+
ariaDisabled: string | null;
|
|
33
|
+
ariaExpanded: string | null;
|
|
34
|
+
ariaHasPopup: string | null;
|
|
35
|
+
ariaHidden: string | null;
|
|
36
|
+
ariaInvalid: string | null;
|
|
37
|
+
ariaKeyShortcuts: string | null;
|
|
38
|
+
ariaLabel: string | null;
|
|
39
|
+
ariaLevel: string | null;
|
|
40
|
+
ariaLive: string | null;
|
|
41
|
+
ariaModal: string | null;
|
|
42
|
+
ariaMultiLine: string | null;
|
|
43
|
+
ariaMultiSelectable: string | null;
|
|
44
|
+
ariaOrientation: string | null;
|
|
45
|
+
ariaPlaceholder: string | null;
|
|
46
|
+
ariaPosInSet: string | null;
|
|
47
|
+
ariaPressed: string | null;
|
|
48
|
+
ariaReadOnly: string | null;
|
|
49
|
+
ariaRequired: string | null;
|
|
50
|
+
ariaRoleDescription: string | null;
|
|
51
|
+
ariaRowCount: string | null;
|
|
52
|
+
ariaRowIndex: string | null;
|
|
36
53
|
ariaRowIndexText: string | null;
|
|
37
|
-
ariaRowSpan:
|
|
38
|
-
ariaSelected:
|
|
39
|
-
ariaSetSize:
|
|
40
|
-
ariaSort:
|
|
41
|
-
ariaValueMax:
|
|
42
|
-
ariaValueMin:
|
|
43
|
-
ariaValueNow:
|
|
44
|
-
ariaValueText:
|
|
54
|
+
ariaRowSpan: string | null;
|
|
55
|
+
ariaSelected: string | null;
|
|
56
|
+
ariaSetSize: string | null;
|
|
57
|
+
ariaSort: string | null;
|
|
58
|
+
ariaValueMax: string | null;
|
|
59
|
+
ariaValueMin: string | null;
|
|
60
|
+
ariaValueNow: string | null;
|
|
61
|
+
ariaValueText: string | null;
|
|
62
|
+
/** WARNING: be careful of cross-root ARIA browser support */
|
|
63
|
+
ariaActiveDescendantElement: Element | null;
|
|
64
|
+
/** WARNING: be careful of cross-root ARIA browser support */
|
|
65
|
+
ariaControlsElements: Element[] | null;
|
|
66
|
+
/** WARNING: be careful of cross-root ARIA browser support */
|
|
67
|
+
ariaDescribedByElements: Element[] | null;
|
|
68
|
+
/** WARNING: be careful of cross-root ARIA browser support */
|
|
69
|
+
ariaDetailsElements: Element[] | null;
|
|
70
|
+
/** WARNING: be careful of cross-root ARIA browser support */
|
|
71
|
+
ariaErrorMessageElements: Element[] | null;
|
|
72
|
+
/** WARNING: be careful of cross-root ARIA browser support */
|
|
73
|
+
ariaFlowToElements: Element[] | null;
|
|
74
|
+
/** WARNING: be careful of cross-root ARIA browser support */
|
|
75
|
+
ariaLabelledByElements: Element[] | null;
|
|
76
|
+
/** WARNING: be careful of cross-root ARIA browser support */
|
|
77
|
+
ariaOwnsElements: Element[] | null;
|
|
45
78
|
/** True when the control is disabled via it's containing fieldset element */
|
|
46
79
|
get formDisabled(): boolean;
|
|
47
|
-
static protos: WeakMap<object, any>;
|
|
48
80
|
get labels(): NodeList;
|
|
49
81
|
get validity(): ValidityState;
|
|
50
|
-
|
|
82
|
+
/** A best-attempt based on observed behaviour in FireFox 115 on fedora 38 */
|
|
83
|
+
get computedLabelText(): string;
|
|
84
|
+
private get element();
|
|
85
|
+
private internals;
|
|
86
|
+
private _formDisabled;
|
|
87
|
+
private constructor();
|
|
88
|
+
/**
|
|
89
|
+
* Typescript (with experimental decorators) will compile the class
|
|
90
|
+
* such that the order of operations is:
|
|
91
|
+
* 1. set up constructor parameter fields
|
|
92
|
+
* 2. run decorated field setters with initializers as the value
|
|
93
|
+
* 3. run the rest of the constructor
|
|
94
|
+
* Because of that, `this.internals` may not be available in the decorator setter
|
|
95
|
+
* so we cheat here with nullish coalescing assignment operator `??=`;
|
|
96
|
+
*/
|
|
97
|
+
private attachOrRetrieveInternals;
|
|
98
|
+
private initializeOptions;
|
|
51
99
|
hostConnected?(): void;
|
|
52
100
|
setFormValue(...args: Parameters<ElementInternals['setFormValue']>): void;
|
|
53
101
|
setValidity(...args: Parameters<ElementInternals['setValidity']>): void;
|
|
@@ -56,3 +104,17 @@ export declare class InternalsController implements ReactiveController, ARIAMixi
|
|
|
56
104
|
submit(): void;
|
|
57
105
|
reset(): void;
|
|
58
106
|
}
|
|
107
|
+
/** @see https://w3c.github.io/aria/#ref-for-dom-ariamixin-ariaactivedescendantelement-1 */
|
|
108
|
+
declare global {
|
|
109
|
+
interface ARIAMixin {
|
|
110
|
+
ariaActiveDescendantElement: Element | null;
|
|
111
|
+
ariaControlsElements: readonly Element[] | null;
|
|
112
|
+
ariaDescribedByElements: readonly Element[] | null;
|
|
113
|
+
ariaDetailsElements: readonly Element[] | null;
|
|
114
|
+
ariaErrorMessageElements: readonly Element[] | null;
|
|
115
|
+
ariaFlowToElements: readonly Element[] | null;
|
|
116
|
+
ariaLabelledByElements: readonly Element[] | null;
|
|
117
|
+
ariaOwnsElements: readonly Element[] | null;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export {};
|