;
rendering?: string;
}
export interface MonoBuiltinElements {
/**
* A built-in element of mono-jsx that toggles the visibility of its children.
* @mono-jsx
*/
show: BaseAttributes & {
/**
* Show the children if the value is truthy.
*/
when?: any;
/**
* Enables view transition for the children.
*/
viewTransition?: string | boolean;
};
/**
* A built-in element of mono-jsx that toggles the visibility of its children.
* @mono-jsx
*/
hidden: BaseAttributes & {
/**
* Hide the children if the value is truthy.
*/
when?: any;
/**
* Enables view transition for the children.
*/
viewTransition?: string | boolean;
};
/**
* A a built-in element of mono-jsx that chooses one of its children based on the `slot` attribute to display.
* It is similar to a switch statement in programming languages.
* @mono-jsx
*/
switch: BaseAttributes & {
/**
* Which child to display.
*/
value?: string | number | boolean | null;
/**
* Enables view transition for the children.
*/
viewTransition?: string | boolean;
};
}
declare global {
namespace JSX {
type ElementType =
| {
[K in keyof IntrinsicElements]: P extends IntrinsicElements[K] ? K : never;
}[keyof IntrinsicElements]
| ComponentType
;
type Raw = (template: MaybeGetter | TemplateStringsArray, ...values: unknown[]) => Element;
interface CustomAttributes {}
interface HtmlCustomAttributes {}
interface BuiltinElements {}
interface CustomElements {}
interface Element extends VNode, Response {}
interface IntrinsicAttributes extends BaseAttributes, AsyncComponentAttributes {}
interface IntrinsicElements extends HTML.Elements, HTML.SVGElements, HTML.CustomElements, JSX.BuiltinElements, MonoBuiltinElements {}
}
interface FCExtension {}
/**
* mono-jsx component scope.
*/
type FC> =
& {
/**
* The `refs` object stores variables in clide side.
*
* **⚠ This is a client-side only API.**
*/
readonly refs: Refs;
/**
* Initializes the signals.
*/
init(initValue: Signals): void;
/**
* Creates a computed signal.
*/
computed(fn: () => T): T;
/**
* A shortcut for `this.computed(fn)`.
*/
$(fn: () => T): T;
/**
* Creates a side effect.
* **The effect function is only called on client side.**
*/
effect(fn: () => (() => void) | void): void;
}
& FCExtension
& Omit, keyof FCExtension>;
/**
* Defines the `this.refs` type.
*/
type WithRefs = T extends FC ? FC : never;
/**
* The JSX namespace object.
* @mono-jsx
*/
var JSX: {
customElements: {
/**
* Defines a built-in custom element.
* @mono-jsx
*/
define: (tagName: string, fc: ComponentType) => void;
};
};
/**
* Creates XSS-unsafed HTML content.
* @mono-jsx
*/
var html: JSX.Raw;
/**
* An alias to `html`.
* @mono-jsx
*/
var css: JSX.Raw;
/**
* An alias to `html`.
* @mono-jsx
*/
var js: JSX.Raw;
}