File tree Expand file tree Collapse file tree 3 files changed +67
-1
lines changed Expand file tree Collapse file tree 3 files changed +67
-1
lines changed Original file line number Diff line number Diff line change @@ -103,3 +103,51 @@ export function load(app: Application) {
103
103
```
104
104
105
105
[ RendererHooks ] : https://typedoc.org/api/interfaces/RendererHooks.html
106
+
107
+ ## Registering your own custom elements/attributes
108
+
109
+ Start by writing a ` jsx.d.ts ` file somewhere.
110
+
111
+ ```` ts
112
+ // src/jsx.d.ts
113
+ import { JSX as TypeDocJSX } from " typedoc" ;
114
+
115
+ declare module " typedoc" {
116
+ namespace JSX {
117
+ namespace JSX {
118
+ interface IntrinsicAttributes {
119
+ popover? : boolean ;
120
+ popovertarget? : string ;
121
+ popovertargetaction? : " hide" | " show" | " toggle" ;
122
+ }
123
+ interface IntrinsicElements {
124
+ // add your custom elements here, ie:
125
+ /**
126
+ * @example
127
+ * ```tsx
128
+ * <drop-down trigger="#my-trigger" class="header-menu">
129
+ * <button>Option #1</button>
130
+ * <button>Option #2</button>
131
+ * </drop-down>
132
+ * ```
133
+ */
134
+ " drop-down" : IntrinsicAttributes & {
135
+ /**
136
+ * A query selector, ie: '#my-trigger'
137
+ */
138
+ trigger: string ;
139
+ };
140
+ }
141
+ }
142
+ }
143
+ }
144
+ ````
145
+
146
+ Then in your plugin entry point, reference the ` jsx.d.ts ` file with a triple-slash directive.
147
+
148
+ ``` ts
149
+ // src/index.ts
150
+ /// <reference types = " ./jsx.d.ts" />
151
+
152
+ export function load(app : Application ) { … }
153
+ ```
Original file line number Diff line number Diff line change @@ -185,6 +185,19 @@ export interface JsxHtmlGlobalProps {
185
185
tabIndex ?: number ;
186
186
title ?: string ;
187
187
translate ?: boolean ;
188
+
189
+ // popover attributes
190
+ /**
191
+ * Default: 'auto'. true and 'auto' are equivalent
192
+ *
193
+ * See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API) for more details
194
+ */
195
+ popover ?: boolean | "auto" | "manual" ;
196
+ /**
197
+ * It must be the popover element id, see [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API)
198
+ */
199
+ popovertarget ?: string ;
200
+ popovertargetaction ?: "hide" | "show" | "toggle" ;
188
201
}
189
202
190
203
/**
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import type {
20
20
JsxElement ,
21
21
JsxChildren ,
22
22
JsxComponent ,
23
+ JsxHtmlGlobalProps ,
23
24
} from "./jsx.elements.js" ;
24
25
import { JsxFragment } from "./jsx.elements.js" ;
25
26
@@ -50,7 +51,11 @@ export function Raw(_props: { html: string }) {
50
51
* @hidden
51
52
*/
52
53
export declare namespace JSX {
53
- export { IntrinsicElements , JsxElement as Element } ;
54
+ export {
55
+ IntrinsicElements ,
56
+ JsxElement as Element ,
57
+ JsxHtmlGlobalProps as IntrinsicAttributes ,
58
+ } ;
54
59
}
55
60
56
61
const voidElements = new Set ( [
You can’t perform that action at this time.
0 commit comments