@mpen/jsxhtml 0.1.6

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.
@@ -0,0 +1,4 @@
1
+ import type { CommonProps, JsxComponent } from './types';
2
+ import { JsxNode } from './jsx-node';
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;
@@ -0,0 +1,41 @@
1
+ import { CommonProps, JsxChildren } from './types';
2
+ import { JsxNode } from './jsx-node';
3
+ export declare class JsxElement extends JsxNode {
4
+ private readonly tag;
5
+ private readonly props;
6
+ constructor(tag: string, props: CommonProps);
7
+ get [Symbol.toStringTag](): string;
8
+ toString(): string;
9
+ }
10
+ export declare class JsxRawHtml extends JsxNode {
11
+ private readonly html;
12
+ get [Symbol.toStringTag](): string;
13
+ constructor(html: string);
14
+ toString(): string;
15
+ }
16
+ export type DocTypeProps = {
17
+ html?: true;
18
+ };
19
+ export declare class JsxDocType extends JsxNode {
20
+ private readonly attrs;
21
+ get [Symbol.toStringTag](): string;
22
+ constructor(attrs: DocTypeProps);
23
+ toString(): string;
24
+ }
25
+ export declare class JsxComment extends JsxNode {
26
+ private readonly text;
27
+ get [Symbol.toStringTag](): string;
28
+ constructor(text: string);
29
+ toString(): string;
30
+ }
31
+ export declare class JsxEmpty extends JsxNode {
32
+ get [Symbol.toStringTag](): string;
33
+ toString(): string;
34
+ }
35
+ export declare const EMPTY: JsxEmpty;
36
+ export declare class JsxFragment extends JsxNode {
37
+ private readonly children;
38
+ get [Symbol.toStringTag](): string;
39
+ constructor(children: JsxChildren);
40
+ toString(): string;
41
+ }
package/jsx-node.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export declare abstract class JsxNode {
2
+ abstract toString(): string;
3
+ }
4
+ export declare function isJsxNode(x: any): x is JsxNode;
@@ -0,0 +1,6 @@
1
+ import { JsxComponent, CommonProps, ChildrenOnly } from './types';
2
+ import { JsxFragment } from './jsx-elements';
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;
6
+ export declare function Fragment({ children }: ChildrenOnly): JsxFragment;
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@mpen/jsxhtml",
3
+ "version": "0.1.6",
4
+ "packageManager": "bun@1.0.7",
5
+ "exports": "./bundle.cjs",
6
+ "module": "./bundle.mjs",
7
+ "types": "./bundle.d.ts",
8
+ "type": "module",
9
+ "optionalDependencies": {
10
+ "elysia": ">=0.7.21"
11
+ }
12
+ }
package/render.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { JsxRenderable } from './types';
2
+ export declare function render(el: JsxRenderable): string;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Serializes a mapping of style properties for use as inline styles:
3
+ *
4
+ * > createMarkupForStyles({width: '200px', height: 0})
5
+ * "width:200px;height:0;"
6
+ *
7
+ * Undefined values are ignored so that declarative programming is easier.
8
+ * The result should be HTML-escaped before insertion into the DOM.
9
+ *
10
+ * @param {object} styles
11
+ * @return {?string}
12
+ */
13
+ export default function styleObjectToString(styles: StyleObject): string;
14
+ export type StyleObject = Record<string, any>;
package/util.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { FlatString, JsxChildren, JsxComponent } from './types';
2
+ export declare function mapIter<In, Out>(iterable: Iterable<In>, cb: (el: In, i: number) => Out): Out[];
3
+ export declare function getStringTag(value: any): string;
4
+ export declare function isEmptyChildren(children: JsxChildren): boolean;
5
+ export declare function isEmptyRender(el: any): boolean;
6
+ export declare function fullWide(n: number): string;
7
+ export declare function flattenString(content: FlatString, sep?: string): string;
8
+ export declare const isJsxComponent: (x: any) => x is JsxComponent;