From e38cff1fa3492c9d4b8452a3eb611a184aec4825 Mon Sep 17 00:00:00 2001 From: chirokas <157580465+chirokas@users.noreply.github.com> Date: Fri, 28 Mar 2025 13:29:18 +0000 Subject: [PATCH] feat: add support for Popover API --- packages/runtime-dom/src/jsx.ts | 12 +++++++++++- packages/shared/src/domAttrConfig.ts | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/runtime-dom/src/jsx.ts b/packages/runtime-dom/src/jsx.ts index 5292441cd..06cb8c19b 100644 --- a/packages/runtime-dom/src/jsx.ts +++ b/packages/runtime-dom/src/jsx.ts @@ -304,6 +304,8 @@ export interface HTMLAttributes extends AriaAttributes, EventHandlers { security?: string unselectable?: 'on' | 'off' + popover?: '' | 'auto' | 'manual' + // Living Standard /** * Hints at the type of data that might be entered by the user while editing the element or its contents @@ -382,6 +384,8 @@ export interface ButtonHTMLAttributes extends HTMLAttributes { formnovalidate?: Booleanish formtarget?: string name?: string + popovertarget?: string + popovertargetaction?: 'hide' | 'show' | 'toggle' type?: 'submit' | 'reset' | 'button' value?: string | ReadonlyArray | number } @@ -407,7 +411,6 @@ export interface DataHTMLAttributes extends HTMLAttributes { export interface DetailsHTMLAttributes extends HTMLAttributes { name?: string open?: Booleanish - onToggle?: (payload: ToggleEvent) => void } export interface DelHTMLAttributes extends HTMLAttributes { @@ -417,6 +420,7 @@ export interface DelHTMLAttributes extends HTMLAttributes { export interface DialogHTMLAttributes extends HTMLAttributes { open?: Booleanish + onCancel?: (payload: Event) => void onClose?: (payload: Event) => void } @@ -549,6 +553,8 @@ export interface InputHTMLAttributes extends HTMLAttributes { name?: string pattern?: string placeholder?: string + popovertarget?: string + popovertargetaction?: 'toggle' | 'show' | 'hide' readonly?: Booleanish required?: Booleanish size?: Numberish @@ -1382,6 +1388,10 @@ export interface Events { // transition events onTransitionend: TransitionEvent onTransitionstart: TransitionEvent + + // Toggle Events + onToggle?: ToggleEvent + onBeforetoggle?: ToggleEvent } type EventHandlers = { diff --git a/packages/shared/src/domAttrConfig.ts b/packages/shared/src/domAttrConfig.ts index b5f016632..39a21ce17 100644 --- a/packages/shared/src/domAttrConfig.ts +++ b/packages/shared/src/domAttrConfig.ts @@ -71,7 +71,8 @@ export const isKnownHtmlAttr: (key: string) => boolean = /*@__PURE__*/ makeMap( `height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,` + `ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,` + `manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,` + - `open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,` + + `open,optimum,pattern,ping,placeholder,popover,popovertarget,popovertargetaction,` + + `poster,preload,radiogroup,readonly,` + `referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,` + `selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,` + `start,step,style,summary,tabindex,target,title,translate,type,usemap,` +