@mpen/jsxhtml 0.1.19 → 0.1.20

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,5 +1,5 @@
1
1
  import { DocTypeProps, JsxComment, JsxDocType, JsxRawHtml } from './jsx-elements';
2
- import { CommonProps, StringChildren } from './types';
2
+ import { AnyAttributes, StringChildren } from './jsx-types';
3
3
  /**
4
4
  * Unescaped HTML.
5
5
  */
@@ -15,7 +15,7 @@ export declare function DocType(props: DocTypeProps): JsxDocType;
15
15
  /**
16
16
  * `<!DOCTYPE html><html ...>{children}</html>`
17
17
  */
18
- export declare function HtmlDocument({ children, ...htmlAttrs }: CommonProps): import("./jsx-node").JsxNode;
18
+ export declare function HtmlDocument({ children, ...htmlAttrs }: AnyAttributes): import("./jsx-node").JsxNode;
19
19
  /**
20
20
  * No output.
21
21
  */
package/dev.d.ts CHANGED
@@ -1 +1,2 @@
1
+ /// <reference lib="dom" />
1
2
  export {};
package/escape.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Attributes, AttributeValue, Stringable } from './types';
1
+ import { Attributes, AttributeValue, Stringable } from './jsx-types';
2
2
  export declare function tagName(string: Stringable): string;
3
3
  export declare function attrName(string: Stringable): string;
4
4
  export declare function attrValue(value: Stringable): string;
@@ -0,0 +1,83 @@
1
+ export type AnchorElement = {
2
+ /**
3
+ * Causes the browser to treat the linked URL as a download. Can be used with or without a filename value:
4
+ *
5
+ * - Without a value, the browser will suggest a filename/extension, generated from various sources:
6
+ * - The `Content-Disposition` HTTP header
7
+ * - The final segment in the URL path
8
+ * - The media type (from the Content-Type header, the start of a data: URL, or Blob.type for a blob: URL)
9
+ * - `filename`: defining a value suggests it as the filename. / and \ characters are converted to underscores
10
+ * (_). Filesystems may forbid other characters in filenames, so browsers will adjust the suggested name if
11
+ * necessary.
12
+ */
13
+ download?: true | string;
14
+ /**
15
+ * The URL that the hyperlink points to. Links are not restricted to HTTP-based URLs — they can use any URL scheme
16
+ * supported by browsers:
17
+ *
18
+ * - Sections of a page with document fragments
19
+ * - Specific text portions with text fragments
20
+ * - Pieces of media files with media fragments
21
+ * - Telephone numbers with tel: URLs
22
+ * - Email addresses with mailto: URLs
23
+ * - SMS text messages with sms: URLs
24
+ * - While web browsers may not support other URL schemes, websites can with registerProtocolHandler()
25
+ */
26
+ href?: string;
27
+ /**
28
+ * Hints at the human language of the linked URL. No built-in functionality. Allowed values are the same as the
29
+ * global lang attribute.
30
+ */
31
+ hreflang?: string;
32
+ /**
33
+ * A space-separated list of URLs. When the link is followed, the browser will send POST requests with the body
34
+ * PING to the URLs. Typically for tracking.
35
+ */
36
+ ping?: string;
37
+ /**
38
+ * How much of the referrer to send when following the link.
39
+ */
40
+ referrerpolicy?: ReferrerPolicy | string;
41
+ /**
42
+ * The relationship of the linked URL as space-separated link types.
43
+ */
44
+ rel?: string;
45
+ /**
46
+ * Where to display the linked URL, as the name for a browsing context (a tab, window, or <iframe>).
47
+ */
48
+ target?: '_self' | '_blank' | '_parent' | '_top' | string;
49
+ /**
50
+ * Hints at the linked URL's format with a MIME type. No built-in functionality.
51
+ */
52
+ type?: string;
53
+ /**
54
+ * @deprecated
55
+ */
56
+ charset?: string;
57
+ /**
58
+ * @deprecated
59
+ */
60
+ coords?: string;
61
+ /**
62
+ * @deprecated
63
+ */
64
+ name?: string;
65
+ /**
66
+ * @deprecated
67
+ */
68
+ rev?: string;
69
+ /**
70
+ * @deprecated
71
+ */
72
+ shape?: string;
73
+ };
74
+ export declare const enum ReferrerPolicy {
75
+ NoReferrer = "no-referrer",
76
+ NoReferrerWhenDowngrade = "no-referrer-when-downgrade",
77
+ Origin = "origin",
78
+ OriginWhenCrossOrigin = "origin-when-cross-origin",
79
+ SameOrigin = "same-origin",
80
+ StrictOrigin = "strict-origin",
81
+ StrictOriginWhenCrossOrigin = "strict-origin-when-cross-origin",
82
+ UnsafeUrl = "unsafe-url"
83
+ }
@@ -0,0 +1,286 @@
1
+ /// <reference lib="dom" />
2
+ export type StandardGlobalAttributes = {
3
+ /**
4
+ * Provides a hint for generating a keyboard shortcut for the current element. This attribute consists of a
5
+ * space-separated list of characters. The browser should use the first one that exists on the computer keyboard
6
+ * layout.
7
+ */
8
+ accesskey?: string;
9
+ /**
10
+ * Controls whether and how text input is automatically capitalized as it is entered/edited by the user. It can
11
+ * have the following values:
12
+ *
13
+ * - `off` or `none`, no autocapitalization is applied (all letters default to lowercase)
14
+ * - `on` or `sentences`, the first letter of each sentence defaults to a capital letter; all other letters default
15
+ * to lowercase
16
+ * - `words`, the first letter of each word defaults to a capital letter; all other letters default to lowercase
17
+ * - `characters`, all letters should default to uppercase
18
+ */
19
+ autocapitalize?: string;
20
+ /**
21
+ * Indicates that an element is to be focused on page load, or as soon as the <dialog> it is part of is displayed.
22
+ * This attribute is a boolean, initially false.
23
+ */
24
+ autofocus?: string;
25
+ /**
26
+ * A space-separated list of the classes of the element. Classes allow CSS and JavaScript to select and access
27
+ * specific elements via the class selectors or functions like the method Document.getElementsByClassName().
28
+ */
29
+ class?: string;
30
+ /**
31
+ * An enumerated attribute indicating if the element should be editable by the user. If so, the browser modifies
32
+ * its widget to allow editing. The attribute must take one of the following values:
33
+ *
34
+ * - `true` or the empty string, which indicates that the element must be editable;
35
+ * - `false`, which indicates that the element must not be editable.
36
+ */
37
+ contenteditable?: string;
38
+ /**
39
+ * The id of a `<menu>` to use as the contextual menu for this element.
40
+ *
41
+ * @deprecated
42
+ */
43
+ contextmenu?: string;
44
+ /**
45
+ * Forms a class of attributes, called custom data attributes, that allow proprietary information to be exchanged
46
+ * between the HTML and its DOM representation that may be used by scripts. All such custom data are available via
47
+ * the HTMLElement interface of the element the attribute is set on. The HTMLElement.dataset property gives access
48
+ * to them.
49
+ */
50
+ [data: `data-${string}`]: string;
51
+ /**
52
+ * An enumerated attribute indicating the directionality of the element's text. It can have the following values:
53
+ *
54
+ * - `ltr`, which means left to right and is to be used for languages that are written from the left to the right
55
+ * (like English);
56
+ * - `rtl`, which means right to left and is to be used for languages that are written from the right to the left
57
+ * (like Arabic);
58
+ * - `auto`, which lets the user agent decide. It uses a basic algorithm as it parses the characters inside the
59
+ * element until it finds a character with a strong directionality, then it applies that directionality to the
60
+ * whole element.
61
+ */
62
+ dir?: string;
63
+ /**
64
+ * An enumerated attribute indicating whether the element can be dragged, using the Drag and Drop API. It can have
65
+ * the following values:
66
+ *
67
+ * - `true`, which indicates that the element may be dragged
68
+ * - `false`, which indicates that the element may not be dragged.
69
+ */
70
+ draggable?: string;
71
+ /**
72
+ * Hints what action label (or icon) to present for the enter key on virtual keyboards.
73
+ */
74
+ enterkeyhint?: string;
75
+ /**
76
+ * Used to transitively export shadow parts from a nested shadow tree into a containing light tree.
77
+ * @experimental
78
+ */
79
+ exportparts?: string;
80
+ /**
81
+ * An enumerated attribute indicating that the element is not yet, or is no longer, relevant. For example, it can
82
+ * be used to hide elements of the page that can't be used until the login process has been completed. The browser
83
+ * won't render such elements. This attribute must not be used to hide content that could legitimately be shown.
84
+ */
85
+ hidden?: boolean | 'hidden' | 'until-found';
86
+ /**
87
+ * Defines a unique identifier (ID) which must be unique in the whole document. Its purpose is to identify the
88
+ * element when linking (using a fragment identifier), scripting, or styling (with CSS).
89
+ */
90
+ id?: string;
91
+ /**
92
+ * A boolean value that makes the browser disregard user input events for the element. Useful when click events are
93
+ * present.
94
+ */
95
+ inert?: boolean;
96
+ /**
97
+ * Provides a hint to browsers about the type of virtual keyboard configuration to use when editing this element or
98
+ * its contents. Used primarily on <input> elements, but is usable on any element while in contenteditable mode.
99
+ */
100
+ inputmode?: InputMode | string;
101
+ /**
102
+ * Allows you to specify that a standard HTML element should behave like a registered custom built-in element (see
103
+ * Using custom elements for more details).
104
+ */
105
+ is?: string;
106
+ /**
107
+ * [Microdata](https://html.spec.whatwg.org/multipage/microdata.html#microdata)
108
+ *
109
+ * The unique, global identifier of an item.
110
+ */
111
+ itemid?: string;
112
+ /**
113
+ * [Microdata](https://html.spec.whatwg.org/multipage/microdata.html#microdata)
114
+ *
115
+ * Used to add properties to an item. Every HTML element may have an itemprop attribute specified, where an
116
+ * itemprop consists of a name and value pair.
117
+ */
118
+ itemprop?: string;
119
+ /**
120
+ * [Microdata](https://html.spec.whatwg.org/multipage/microdata.html#microdata)
121
+ *
122
+ * Properties that are not descendants of an element with the itemscope attribute can be associated with the item
123
+ * using an itemref. It provides a list of element ids (not itemids) with additional properties elsewhere in the
124
+ * document.
125
+ */
126
+ itemref?: string;
127
+ /**
128
+ * [Microdata](https://html.spec.whatwg.org/multipage/microdata.html#microdata)
129
+ *
130
+ * itemscope (usually) works along with itemtype to specify that the HTML contained in a block is about a
131
+ * particular item. itemscope creates the Item and defines the scope of the itemtype associated with it. itemtype
132
+ * is a valid URL of a vocabulary (such as schema.org) that describes the item and its properties context.
133
+ */
134
+ itemscope?: string;
135
+ /**
136
+ * [Microdata](https://html.spec.whatwg.org/multipage/microdata.html#microdata)
137
+ *
138
+ * Specifies the URL of the vocabulary that will be used to define itemprops (item properties) in the data
139
+ * structure. itemscope is used to set the scope of where in the data structure the vocabulary set by itemtype will
140
+ * be active.
141
+ */
142
+ itemtype?: string;
143
+ /**
144
+ * Helps define the language of an element: the language that non-editable elements are in, or the language that
145
+ * editable elements should be written in by the user. The attribute contains one "language tag" (made of
146
+ * hyphen-separated "language subtags") in the format defined in RFC 5646: Tags for Identifying Languages (also
147
+ * known as BCP 47). xml:lang has priority over it.
148
+ */
149
+ lang?: string;
150
+ /**
151
+ * A cryptographic nonce ("number used once") which can be used by Content Security Policy to determine whether or
152
+ * not a given fetch will be allowed to proceed.
153
+ */
154
+ nonce?: string;
155
+ /**
156
+ * A space-separated list of the part names of the element. Part names allows CSS to select and style specific
157
+ * elements in a shadow tree via the ::part pseudo-element.
158
+ */
159
+ part?: string;
160
+ /**
161
+ * Used to designate an element as a popover element (see Popover API). Popover elements are hidden via display:
162
+ * none until opened via an invoking/control element (i.e. a <button> or <input type="button"> with a popovertarget
163
+ * attribute) or a HTMLElement.showPopover() call.
164
+ */
165
+ popover?: string;
166
+ /**
167
+ * An enumerated attribute defines whether the element may be checked for spelling errors. It may have the
168
+ * following values:
169
+ *
170
+ * - empty string or true, which indicates that the element should be, if possible, checked for spelling errors;
171
+ * - `false`, which indicates that the element should not be checked for spelling errors.
172
+ */
173
+ spellcheck?: string;
174
+ /**
175
+ * Contains CSS styling declarations to be applied to the element. Note that it is recommended for styles to be
176
+ * defined in a separate file or files. This attribute and the <style> element have mainly the purpose of allowing
177
+ * for quick styling, for example for testing purposes.
178
+ */
179
+ style?: string;
180
+ /**
181
+ * An integer attribute indicating if the element can take input focus (is focusable), if it should participate to
182
+ * sequential keyboard navigation, and if so, at what position. It can take several values:
183
+ *
184
+ * - a negative value means that the element should be focusable, but should not be reachable via sequential
185
+ * keyboard navigation;
186
+ * - 0 means that the element should be focusable and reachable via sequential keyboard navigation, but its
187
+ * relative order is defined by the platform convention;
188
+ * - a positive value means that the element should be focusable and reachable via sequential keyboard navigation;
189
+ * the order in which the elements are focused is the increasing value of the tabindex. If several elements share
190
+ * the same tabindex, their relative order follows their relative positions in the document.
191
+ */
192
+ tabindex?: Numeric;
193
+ /**
194
+ * Contains a text representing advisory information related to the element it belongs to. Such information can
195
+ * typically, but not necessarily, be presented to the user as a tooltip.
196
+ */
197
+ title?: string;
198
+ /**
199
+ * An enumerated attribute that is used to specify whether an element's attribute values and the values of its Text
200
+ * node children are to be translated when the page is localized, or whether to leave them unchanged. It can have
201
+ * the following values:
202
+ *
203
+ * - empty string or yes, which indicates that the element will be translated.
204
+ * - no, which indicates that the element will not be translated.
205
+ */
206
+ translate?: true | 'yes' | 'no';
207
+ /**
208
+ * An enumerated attribute used to control the on-screen virtual keyboard behavior on devices such as tablets,
209
+ * mobile phones, or other devices where a hardware keyboard may not be available for elements that also uses the
210
+ * contenteditable attribute.
211
+ *
212
+ * - `auto` or an empty string, which automatically shows the virtual keyboard when the element is focused or
213
+ * tapped.
214
+ * - `manual`, which decouples focus and tap on the element from the virtual keyboard's state.
215
+ */
216
+ virtualkeyboardpolicy?: true | 'auto' | 'manual';
217
+ };
218
+ export type Numeric = number | `${number}`;
219
+ export declare const enum InputMode {
220
+ /**
221
+ * No virtual keyboard. For when the page implements its own keyboard input control.
222
+ */
223
+ None = "none",
224
+ /**
225
+ * Standard input keyboard for the user's current locale.
226
+ */
227
+ Text = "text",
228
+ /**
229
+ * Fractional numeric input keyboard containing the digits and decimal separator for the user's locale (typically .
230
+ * or ,). Devices may or may not show a minus key (-).
231
+ */
232
+ Decimal = "decimal",
233
+ /**
234
+ * Numeric input keyboard, but only requires the digits 0–9. Devices may or may not show a minus key.
235
+ */
236
+ Numeric = "numeric",
237
+ /**
238
+ * A telephone keypad input, including the digits 0–9, the asterisk (*), and the pound (#) key. Inputs that
239
+ * *require* a telephone number should typically use <input type="tel"> instead.
240
+ */
241
+ Tel = "tel",
242
+ /**
243
+ * A virtual keyboard optimized for search input. For instance, the return/submit key may be labeled "Search",
244
+ * along with possible other optimizations. Inputs that require a search query should typically use <input
245
+ * type="search"> instead.
246
+ */
247
+ Search = "search",
248
+ /**
249
+ * A virtual keyboard optimized for entering email addresses. Typically includes the @character as well as other
250
+ * optimizations. Inputs that require email addresses should typically use <input type="email"> instead.
251
+ */
252
+ Email = "email",
253
+ /**
254
+ * A keypad optimized for entering URLs. This may have the / key more prominent, for example. Enhanced features
255
+ * could include history access and so on. Inputs that require a URL should typically use <input type="url">
256
+ * instead.
257
+ */
258
+ Url = "url"
259
+ }
260
+ export type AriaAttributes = {
261
+ /**
262
+ * Roles define the semantic meaning of content, allowing screen readers and other tools to present and support
263
+ * interaction with an object in a way that is consistent with user expectations of that type of object. roles are
264
+ * added to HTML elements using role="role_type", where role_type is the name of a role in the ARIA specification.
265
+ *
266
+ * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles
267
+ */
268
+ role?: string;
269
+ [aria: `aria-${string}`]: string;
270
+ };
271
+ export type XmlAttributes = {
272
+ /**
273
+ * @deprecated
274
+ */
275
+ 'xml:lang': string;
276
+ /**
277
+ * @deprecated
278
+ */
279
+ 'xml:base': string;
280
+ };
281
+ export type GlobalEventHandlers = {
282
+ [evt in EventHandlerNames]?: string | ((this: HTMLElement) => void);
283
+ };
284
+ export type AllGlobalAttributes = StandardGlobalAttributes | AriaAttributes | GlobalEventHandlers;
285
+ type EventHandlerNames = 'onauxclick' | 'onbeforeinput' | 'onbeforematch' | 'onbeforetoggle' | 'onblur' | 'oncancel' | 'oncanplay' | 'oncanplaythrough' | 'onchange' | 'onclick' | 'onclose' | 'oncontextlost' | 'oncontextmenu' | 'oncontextrestored' | 'oncopy' | 'oncuechange' | 'oncut' | 'ondblclick' | 'ondrag' | 'ondragend' | 'ondragenter' | 'ondragleave' | 'ondragover' | 'ondragstart' | 'ondrop' | 'ondurationchange' | 'onemptied' | 'onended' | 'onerror' | 'onfocus' | 'onformdata' | 'oninput' | 'oninvalid' | 'onkeydown' | 'onkeypress' | 'onkeyup' | 'onload' | 'onloadeddata' | 'onloadedmetadata' | 'onloadstart' | 'onmousedown' | 'onmouseenter' | 'onmouseleave' | 'onmousemove' | 'onmouseout' | 'onmouseover' | 'onmouseup' | 'onpaste' | 'onpause' | 'onplay' | 'onplaying' | 'onprogress' | 'onratechange' | 'onreset' | 'onresize' | 'onscroll' | 'onscrollend' | 'onsecuritypolicyviolation' | 'onseeked' | 'onseeking' | 'onselect' | 'onslotchange' | 'onstalled' | 'onsubmit' | 'onsuspend' | 'ontimeupdate' | 'ontoggle' | 'onvolumechange' | 'onwaiting' | 'onwheel';
286
+ export {};
@@ -1 +1,153 @@
1
- export type HtmlElements = 'a' | 'abbr' | 'acronym' | 'address' | 'area' | 'article' | 'aside' | 'audio' | 'b' | 'base' | 'bdi' | 'bdo' | 'big' | 'blockquote' | 'body' | 'br' | 'button' | 'canvas' | 'caption' | 'center' | 'cite' | 'code' | 'col' | 'colgroup' | 'content' | 'data' | 'datalist' | 'dd' | 'del' | 'details' | 'dfn' | 'dialog' | 'dir' | 'div' | 'dl' | 'dt' | 'em' | 'embed' | 'fieldset' | 'figcaption' | 'figure' | 'font' | 'footer' | 'form' | 'frame' | 'frameset' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'head' | 'header' | 'hgroup' | 'hr' | 'html' | 'i' | 'iframe' | 'image' | 'img' | 'input' | 'ins' | 'kbd' | 'keygen' | 'label' | 'legend' | 'li' | 'link' | 'main' | 'map' | 'mark' | 'marquee' | 'menu' | 'menuitem' | 'meta' | 'meter' | 'nav' | 'nobr' | 'noembed' | 'noframes' | 'noscript' | 'object' | 'ol' | 'optgroup' | 'option' | 'output' | 'p' | 'param' | 'picture' | 'plaintext' | 'portal' | 'pre' | 'progress' | 'q' | 'rb' | 'rp' | 'rt' | 'rtc' | 'ruby' | 's' | 'samp' | 'script' | 'search' | 'section' | 'select' | 'shadow' | 'slot' | 'small' | 'source' | 'span' | 'strike' | 'strong' | 'style' | 'sub' | 'summary' | 'sup' | 'table' | 'tbody' | 'td' | 'template' | 'textarea' | 'tfoot' | 'th' | 'thead' | 'time' | 'title' | 'tr' | 'track' | 'tt' | 'u' | 'ul' | 'var' | 'video' | 'wbr' | 'xmp';
1
+ import { AnyAttributes } from '../jsx-types';
2
+ import { AllGlobalAttributes } from './GlobalAttributes';
3
+ import { AnchorElement } from './AnchorElement';
4
+ export type IntrinsicElements = {
5
+ /**
6
+ * The <a> HTML element (or anchor element), with its href attribute, creates a hyperlink to web pages, files,
7
+ * email addresses, locations in the same page, or anything else a URL can address.
8
+ *
9
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a
10
+ */
11
+ a: AnchorElement & AllGlobalAttributes;
12
+ abbr: AnyAttributes;
13
+ acronym: AnyAttributes;
14
+ address: AnyAttributes;
15
+ area: AnyAttributes;
16
+ article: AnyAttributes;
17
+ aside: AnyAttributes;
18
+ audio: AnyAttributes;
19
+ b: AnyAttributes;
20
+ base: AnyAttributes;
21
+ bdi: AnyAttributes;
22
+ bdo: AnyAttributes;
23
+ big: AnyAttributes;
24
+ blockquote: AnyAttributes;
25
+ body: AnyAttributes;
26
+ br: AnyAttributes;
27
+ button: AnyAttributes;
28
+ canvas: AnyAttributes;
29
+ caption: AnyAttributes;
30
+ center: AnyAttributes;
31
+ cite: AnyAttributes;
32
+ code: AnyAttributes;
33
+ col: AnyAttributes;
34
+ colgroup: AnyAttributes;
35
+ content: AnyAttributes;
36
+ data: AnyAttributes;
37
+ datalist: AnyAttributes;
38
+ dd: AnyAttributes;
39
+ del: AnyAttributes;
40
+ details: AnyAttributes;
41
+ dfn: AnyAttributes;
42
+ dialog: AnyAttributes;
43
+ dir: AnyAttributes;
44
+ div: AnyAttributes;
45
+ dl: AnyAttributes;
46
+ dt: AnyAttributes;
47
+ em: AnyAttributes;
48
+ embed: AnyAttributes;
49
+ fieldset: AnyAttributes;
50
+ figcaption: AnyAttributes;
51
+ figure: AnyAttributes;
52
+ font: AnyAttributes;
53
+ footer: AnyAttributes;
54
+ form: AnyAttributes;
55
+ frame: AnyAttributes;
56
+ frameset: AnyAttributes;
57
+ h1: AnyAttributes;
58
+ h2: AnyAttributes;
59
+ h3: AnyAttributes;
60
+ h4: AnyAttributes;
61
+ h5: AnyAttributes;
62
+ h6: AnyAttributes;
63
+ head: AnyAttributes;
64
+ header: AnyAttributes;
65
+ hgroup: AnyAttributes;
66
+ hr: AnyAttributes;
67
+ html: AnyAttributes;
68
+ i: AnyAttributes;
69
+ iframe: AnyAttributes;
70
+ image: AnyAttributes;
71
+ img: AnyAttributes;
72
+ /**
73
+ * The `<input>` HTML element is used to create interactive controls for web-based forms in order to accept data
74
+ * from the user; a wide variety of types of input data and control widgets are available, depending on the device
75
+ * and user agent. The `<input>` element is one of the most powerful and complex in all of HTML due to the sheer
76
+ * number of combinations of input types and attributes.
77
+ */
78
+ input: AnyAttributes;
79
+ ins: AnyAttributes;
80
+ kbd: AnyAttributes;
81
+ keygen: AnyAttributes;
82
+ label: AnyAttributes;
83
+ legend: AnyAttributes;
84
+ li: AnyAttributes;
85
+ link: AnyAttributes;
86
+ main: AnyAttributes;
87
+ map: AnyAttributes;
88
+ mark: AnyAttributes;
89
+ marquee: AnyAttributes;
90
+ menu: AnyAttributes;
91
+ menuitem: AnyAttributes;
92
+ meta: AnyAttributes;
93
+ meter: AnyAttributes;
94
+ nav: AnyAttributes;
95
+ nobr: AnyAttributes;
96
+ noembed: AnyAttributes;
97
+ noframes: AnyAttributes;
98
+ noscript: AnyAttributes;
99
+ object: AnyAttributes;
100
+ ol: AnyAttributes;
101
+ optgroup: AnyAttributes;
102
+ option: AnyAttributes;
103
+ output: AnyAttributes;
104
+ p: AnyAttributes;
105
+ param: AnyAttributes;
106
+ picture: AnyAttributes;
107
+ plaintext: AnyAttributes;
108
+ portal: AnyAttributes;
109
+ pre: AnyAttributes;
110
+ progress: AnyAttributes;
111
+ q: AnyAttributes;
112
+ rb: AnyAttributes;
113
+ rp: AnyAttributes;
114
+ rt: AnyAttributes;
115
+ rtc: AnyAttributes;
116
+ ruby: AnyAttributes;
117
+ s: AnyAttributes;
118
+ samp: AnyAttributes;
119
+ script: AnyAttributes;
120
+ search: AnyAttributes;
121
+ section: AnyAttributes;
122
+ select: AnyAttributes;
123
+ shadow: AnyAttributes;
124
+ slot: AnyAttributes;
125
+ small: AnyAttributes;
126
+ source: AnyAttributes;
127
+ span: AnyAttributes;
128
+ strike: AnyAttributes;
129
+ strong: AnyAttributes;
130
+ style: AnyAttributes;
131
+ sub: AnyAttributes;
132
+ summary: AnyAttributes;
133
+ sup: AnyAttributes;
134
+ table: AnyAttributes;
135
+ tbody: AnyAttributes;
136
+ td: AnyAttributes;
137
+ template: AnyAttributes;
138
+ textarea: AnyAttributes;
139
+ tfoot: AnyAttributes;
140
+ th: AnyAttributes;
141
+ thead: AnyAttributes;
142
+ time: AnyAttributes;
143
+ title: AnyAttributes;
144
+ tr: AnyAttributes;
145
+ track: AnyAttributes;
146
+ tt: AnyAttributes;
147
+ u: AnyAttributes;
148
+ ul: AnyAttributes;
149
+ var: AnyAttributes;
150
+ video: AnyAttributes;
151
+ wbr: AnyAttributes;
152
+ xmp: AnyAttributes;
153
+ };
package/index.cjs CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
- var jsxRuntime = require("./jsx-runtime-fpN2EWm-.js");
7
+ var jsxRuntime = require("./jsx-runtime-zSLyeHpr.js");
8
8
 
9
9
  function RawHtml({children}) {
10
10
  return new jsxRuntime.JsxRawHtml(jsxRuntime.flattenString(children));
package/index.d.ts CHANGED
@@ -2,10 +2,10 @@ export * from './jsx-elements';
2
2
  export * from './custom-components';
3
3
  export * from './elysia-plugin';
4
4
  export { isJsxNode } from './jsx-node';
5
- import type { CommonProps, JsxComponent, JsxRenderable } from './types';
5
+ import type { AnyAttributes, JsxComponent, JsxRenderable } from './jsx-types';
6
6
  import { Fragment as _Fragment } from './jsx-runtime';
7
7
  declare namespace React {
8
- function createElement(tag: string | JsxComponent, props: CommonProps, ...children: JsxRenderable[]): import("./jsx-node").JsxNode;
8
+ function createElement(tag: string | JsxComponent, props: AnyAttributes, ...children: JsxRenderable[]): import("./jsx-node").JsxNode;
9
9
  const Fragment: typeof _Fragment;
10
10
  }
11
11
  export default React;
package/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { J as JsxRawHtml, f as flattenString, E as EMPTY, a as JsxDocType, j as jsxs, b as jsx, F as Fragment, i as isJsxNode } from "./jsx-runtime-K1okUiXU.js";
1
+ import { J as JsxRawHtml, f as flattenString, E as EMPTY, a as JsxDocType, j as jsxs, b as jsx, F as Fragment, i as isJsxNode } from "./jsx-runtime-FjVmLblX.js";
2
2
 
3
- export { d as JsxComment, c as JsxElement, e as JsxEmpty, g as JsxFragment } from "./jsx-runtime-K1okUiXU.js";
3
+ export { d as JsxComment, c as JsxElement, e as JsxEmpty, g as JsxFragment } from "./jsx-runtime-FjVmLblX.js";
4
4
 
5
5
  function RawHtml({children}) {
6
6
  return new JsxRawHtml(flattenString(children));
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
 
3
- var jsxRuntime = require("./jsx-runtime-fpN2EWm-.js");
3
+ var jsxRuntime = require("./jsx-runtime-zSLyeHpr.js");
4
4
 
5
5
  function jsxDEV(tag, props, key, isStaticChildren, source, self) {
6
6
  let node = jsxRuntime.jsx(...arguments);
7
+ if (process.env.JSXHTML_DEV) return node;
7
8
  if (jsxRuntime.isJsxComponent(tag) && !(node instanceof jsxRuntime.JsxComment)) {
8
9
  const name = tag.displayName ?? tag.name ?? "Unknown";
9
10
  node = new jsxRuntime.JsxFragment([ new jsxRuntime.JsxComment(`<${name}>`), node, new jsxRuntime.JsxComment(`</${name}>`) ]);
@@ -1,4 +1,4 @@
1
- import type { CommonProps, JsxComponent } from './types';
1
+ import type { AnyAttributes, JsxComponent } from './jsx-types';
2
2
  import { JsxNode } from './jsx-node';
3
3
  export { jsx, Fragment } from './jsx-runtime';
4
- export declare function jsxDEV(tag: string | JsxComponent, props: CommonProps, key: unknown, isStaticChildren: unknown, source: unknown, self: unknown): JsxNode;
4
+ export declare function jsxDEV(tag: string | JsxComponent, props: AnyAttributes, key: unknown, isStaticChildren: unknown, source: unknown, self: unknown): JsxNode;
@@ -1,9 +1,10 @@
1
- import { b as jsx, h as isJsxComponent, d as JsxComment, g as JsxFragment } from "./jsx-runtime-K1okUiXU.js";
1
+ import { b as jsx, h as isJsxComponent, d as JsxComment, g as JsxFragment } from "./jsx-runtime-FjVmLblX.js";
2
2
 
3
- export { F as Fragment } from "./jsx-runtime-K1okUiXU.js";
3
+ export { F as Fragment } from "./jsx-runtime-FjVmLblX.js";
4
4
 
5
5
  function jsxDEV(tag, props, key, isStaticChildren, source, self) {
6
6
  let node = jsx(...arguments);
7
+ if (process.env.JSXHTML_DEV) return node;
7
8
  if (isJsxComponent(tag) && !(node instanceof JsxComment)) {
8
9
  const name = tag.displayName ?? tag.name ?? "Unknown";
9
10
  node = new JsxFragment([ new JsxComment(`<${name}>`), node, new JsxComment(`</${name}>`) ]);
package/jsx-elements.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { CommonProps, JsxChildren } from './types';
1
+ import { AnyAttributes, JsxChildren } from './jsx-types';
2
2
  import { JsxNode } from './jsx-node';
3
3
  export declare class JsxElement extends JsxNode {
4
4
  private readonly tag;
5
5
  private readonly props;
6
- constructor(tag: string, props: CommonProps);
6
+ constructor(tag: string, props: AnyAttributes);
7
7
  get [Symbol.toStringTag](): string;
8
8
  toString(): string;
9
9
  }
@@ -1316,62 +1316,22 @@ const entityMap = {
1316
1316
  ffl: "ffllig"
1317
1317
  };
1318
1318
 
1319
- function getDefaultExportFromCjs(x) {
1320
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
1321
- }
1322
-
1323
- var classnames = {
1324
- exports: {}
1325
- };
1326
-
1327
- /*!
1328
- Copyright (c) 2018 Jed Watson.
1329
- Licensed under the MIT License (MIT), see
1330
- http://jedwatson.github.io/classnames
1331
- */ (function(module) {
1332
- (function() {
1333
- var hasOwn = {}.hasOwnProperty;
1334
- function classNames() {
1335
- var classes = [];
1336
- for (var i = 0; i < arguments.length; i++) {
1337
- var arg = arguments[i];
1338
- if (!arg) continue;
1339
- var argType = typeof arg;
1340
- if (argType === "string" || argType === "number") {
1341
- classes.push(arg);
1342
- } else if (Array.isArray(arg)) {
1343
- if (arg.length) {
1344
- var inner = classNames.apply(null, arg);
1345
- if (inner) {
1346
- classes.push(inner);
1347
- }
1348
- }
1349
- } else if (argType === "object") {
1350
- if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
1351
- classes.push(arg.toString());
1352
- continue;
1353
- }
1354
- for (var key in arg) {
1355
- if (hasOwn.call(arg, key) && arg[key]) {
1356
- classes.push(key);
1357
- }
1358
- }
1359
- }
1319
+ function cc(names) {
1320
+ if (typeof names === "string" || typeof names === "number") return "" + names;
1321
+ let out = "";
1322
+ if (Array.isArray(names)) {
1323
+ for (let i = 0, tmp; i < names.length; i++) {
1324
+ if ((tmp = cc(names[i])) !== "") {
1325
+ out += (out && " ") + tmp;
1360
1326
  }
1361
- return classes.join(" ");
1362
1327
  }
1363
- if (module.exports) {
1364
- classNames.default = classNames;
1365
- module.exports = classNames;
1366
- } else {
1367
- window.classNames = classNames;
1328
+ } else {
1329
+ for (let k in names) {
1330
+ if (names[k]) out += (out && " ") + k;
1368
1331
  }
1369
- })();
1370
- })(classnames);
1371
-
1372
- var classnamesExports = classnames.exports;
1373
-
1374
- var classNames = getDefaultExportFromCjs(classnamesExports);
1332
+ }
1333
+ return out;
1334
+ }
1375
1335
 
1376
1336
  function isFunction(obj) {
1377
1337
  return typeof obj === "function";
@@ -1496,7 +1456,7 @@ function attrKvPair(rawAttr, rawVal) {
1496
1456
  return null;
1497
1457
  }
1498
1458
  if (rawAttr === "class" && !isString_1(rawVal)) {
1499
- rawVal = classNames(rawVal);
1459
+ rawVal = cc(rawVal);
1500
1460
  }
1501
1461
  if (rawAttr === "style" && isPlainObject_1(rawVal)) {
1502
1462
  rawVal = styleObjectToString(rawVal);
@@ -1718,7 +1678,9 @@ function jsx(tag, props, key, isStaticChildren, source, self) {
1718
1678
  return new JsxElement(tag, props);
1719
1679
  }
1720
1680
 
1721
- const jsxs = jsx;
1681
+ function jsxs(...args) {
1682
+ return new JsxRawHtml(jsx(...args).toString());
1683
+ }
1722
1684
 
1723
1685
  function Fragment({children}) {
1724
1686
  return new JsxFragment(children);
@@ -1318,62 +1318,22 @@ const entityMap = {
1318
1318
  ffl: "ffllig"
1319
1319
  };
1320
1320
 
1321
- function getDefaultExportFromCjs(x) {
1322
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
1323
- }
1324
-
1325
- var classnames = {
1326
- exports: {}
1327
- };
1328
-
1329
- /*!
1330
- Copyright (c) 2018 Jed Watson.
1331
- Licensed under the MIT License (MIT), see
1332
- http://jedwatson.github.io/classnames
1333
- */ (function(module) {
1334
- (function() {
1335
- var hasOwn = {}.hasOwnProperty;
1336
- function classNames() {
1337
- var classes = [];
1338
- for (var i = 0; i < arguments.length; i++) {
1339
- var arg = arguments[i];
1340
- if (!arg) continue;
1341
- var argType = typeof arg;
1342
- if (argType === "string" || argType === "number") {
1343
- classes.push(arg);
1344
- } else if (Array.isArray(arg)) {
1345
- if (arg.length) {
1346
- var inner = classNames.apply(null, arg);
1347
- if (inner) {
1348
- classes.push(inner);
1349
- }
1350
- }
1351
- } else if (argType === "object") {
1352
- if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
1353
- classes.push(arg.toString());
1354
- continue;
1355
- }
1356
- for (var key in arg) {
1357
- if (hasOwn.call(arg, key) && arg[key]) {
1358
- classes.push(key);
1359
- }
1360
- }
1361
- }
1321
+ function cc(names) {
1322
+ if (typeof names === "string" || typeof names === "number") return "" + names;
1323
+ let out = "";
1324
+ if (Array.isArray(names)) {
1325
+ for (let i = 0, tmp; i < names.length; i++) {
1326
+ if ((tmp = cc(names[i])) !== "") {
1327
+ out += (out && " ") + tmp;
1362
1328
  }
1363
- return classes.join(" ");
1364
1329
  }
1365
- if (module.exports) {
1366
- classNames.default = classNames;
1367
- module.exports = classNames;
1368
- } else {
1369
- window.classNames = classNames;
1330
+ } else {
1331
+ for (let k in names) {
1332
+ if (names[k]) out += (out && " ") + k;
1370
1333
  }
1371
- })();
1372
- })(classnames);
1373
-
1374
- var classnamesExports = classnames.exports;
1375
-
1376
- var classNames = getDefaultExportFromCjs(classnamesExports);
1334
+ }
1335
+ return out;
1336
+ }
1377
1337
 
1378
1338
  function isFunction(obj) {
1379
1339
  return typeof obj === "function";
@@ -1498,7 +1458,7 @@ function attrKvPair(rawAttr, rawVal) {
1498
1458
  return null;
1499
1459
  }
1500
1460
  if (rawAttr === "class" && !isString_1(rawVal)) {
1501
- rawVal = classNames(rawVal);
1461
+ rawVal = cc(rawVal);
1502
1462
  }
1503
1463
  if (rawAttr === "style" && isPlainObject_1(rawVal)) {
1504
1464
  rawVal = styleObjectToString(rawVal);
@@ -1720,7 +1680,9 @@ function jsx(tag, props, key, isStaticChildren, source, self) {
1720
1680
  return new JsxElement(tag, props);
1721
1681
  }
1722
1682
 
1723
- const jsxs = jsx;
1683
+ function jsxs(...args) {
1684
+ return new JsxRawHtml(jsx(...args).toString());
1685
+ }
1724
1686
 
1725
1687
  function Fragment({children}) {
1726
1688
  return new JsxFragment(children);
package/jsx-runtime.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var jsxRuntime = require("./jsx-runtime-fpN2EWm-.js");
3
+ var jsxRuntime = require("./jsx-runtime-zSLyeHpr.js");
4
4
 
5
5
  exports.Fragment = jsxRuntime.Fragment;
6
6
 
package/jsx-runtime.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { JsxComponent, CommonProps, ChildrenOnly } from './types';
1
+ import { JsxComponent, AnyAttributes, ChildrenOnly } from './jsx-types';
2
2
  import { JsxFragment } from './jsx-elements';
3
3
  import { JsxNode } from './jsx-node';
4
- export declare function jsx(tag: string | JsxComponent, props: CommonProps, key?: unknown, isStaticChildren?: unknown, source?: unknown, self?: unknown): JsxNode;
5
- export declare const jsxs: typeof jsx;
4
+ export declare function jsx(tag: string | JsxComponent, props: AnyAttributes, key?: unknown, isStaticChildren?: unknown, source?: unknown, self?: unknown): JsxNode;
5
+ export declare function jsxs(...args: Parameters<typeof jsx>): JsxNode;
6
6
  export declare function Fragment({ children }: ChildrenOnly): JsxFragment;
package/jsx-runtime.mjs CHANGED
@@ -1 +1 @@
1
- export { F as Fragment, b as jsx, j as jsxs } from "./jsx-runtime-K1okUiXU.js";
1
+ export { F as Fragment, b as jsx, j as jsxs } from "./jsx-runtime-FjVmLblX.js";
@@ -1,9 +1,11 @@
1
1
  import { JsxNode } from './jsx-node';
2
+ import { AllGlobalAttributes } from './htmlspec/GlobalAttributes';
3
+ import { Override } from './util-types';
2
4
  export interface Stringable {
3
5
  toString(): string;
4
6
  }
5
7
  export type PlainObject = Record<PropertyKey, unknown>;
6
- export type ClassNames = import('classnames').Argument;
8
+ export type ClassNames = import('classcat').Class;
7
9
  export type StyleObject = import('csstype').Properties | import('csstype').PropertiesHyphen;
8
10
  export type AttributeValue = Stringable | StyleObject | ClassNames;
9
11
  export type AttrKvPair = [name: string, value: AttributeValue];
@@ -17,12 +19,17 @@ export type HtmlSafe = {
17
19
  };
18
20
  export type JsxRenderable = any;
19
21
  export type JsxChildren = JsxRenderable | Iterable<JsxRenderable>;
20
- export type CommonProps = Omit<AttrObj, 'children' | 'style' | 'class'> & {
22
+ export type SpecialProps = {
21
23
  children?: JsxChildren;
22
24
  style?: StyleObject | string;
25
+ /**
26
+ * CSS class.
27
+ */
23
28
  class?: ClassNames;
24
29
  };
25
- export type JsxComponent<P = CommonProps> = ((props: P) => JsxNode) & {
30
+ export type CommonProps = Override<AllGlobalAttributes, SpecialProps>;
31
+ export type AnyAttributes = Override<AttrObj, CommonProps>;
32
+ export type JsxComponent<P = AnyAttributes> = ((props: P) => JsxNode) & {
26
33
  displayName?: string;
27
34
  name?: string;
28
35
  };
package/jsx.d.ts CHANGED
@@ -1,7 +1,6 @@
1
+ /// <reference no-default-lib="true"/>
1
2
  declare namespace JSX {
2
- type IntrinsicElements = {
3
- [_ in import('./htmlspec/IntrinsicElements').HtmlElements]: import('./types').CommonProps;
4
- };
3
+ type IntrinsicElements = import('./htmlspec/IntrinsicElements').IntrinsicElements;
5
4
  type Element = import('./jsx-node').JsxNode;
6
5
  interface ElementChildrenAttribute {
7
6
  children: unknown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpen/jsxhtml",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "packageManager": "bun@1.0.7",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.mjs",
@@ -25,5 +25,8 @@
25
25
  ],
26
26
  "optionalDependencies": {
27
27
  "elysia": ">=0.7.21"
28
+ },
29
+ "dependencies": {
30
+ "classcat": "^5.0.4"
28
31
  }
29
32
  }
package/render.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { JsxRenderable } from './types';
1
+ import { JsxRenderable } from './jsx-types';
2
2
  export declare function render(el: JsxRenderable): string;
@@ -1,4 +1,4 @@
1
- import { StyleObject } from './types';
1
+ import { StyleObject } from './jsx-types';
2
2
  /**
3
3
  * Serializes a mapping of style properties for use as inline styles:
4
4
  *
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Same as a string type but allows autocompletion of literal values
3
+ */
4
+ export type AnyString = string & {};
5
+ export type Override<Base, Extension, DeleteKeys extends PropertyKey = never> = Omit<Base, keyof Extension | DeleteKeys> & Extension;
package/util.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { FlatString, JsxChildren, JsxComponent } from './types';
1
+ import { FlatString, JsxChildren, JsxComponent } from './jsx-types';
2
2
  export declare function mapIter<In, Out>(iterable: Iterable<In>, cb: (el: In, i: number) => Out): Out[];
3
3
  export declare function getStringTag(value: any): string;
4
4
  export declare function isEmptyChildren(children: JsxChildren): boolean;