campfire.js
Version:
a cozy web framework
44 lines (43 loc) • 2.87 kB
TypeScript
import { insert, empty, rm, select, onload } from "./dom/mod.ts";
import { extend, nu } from "./dom/nu.ts";
import { NuBuilder } from "./dom/NuBuilder.ts";
import { ListStore, MapStore, Store, store } from "./stores/mod.ts";
import { html, r } from "./templating/html.ts";
import { mustache, template } from "./templating/mustache.ts";
import { seq, escape, unescape, callbackify, poll, ids } from './utils.ts';
import { CfDom } from "./dom/mod.ts";
import type { SelectParams } from "./dom/mod.ts";
import type { RawHtmlOptions } from "./templating/html.ts";
import type { ElementPosition, ElementProperties, AnySubscriber, EventSubscriber, Template } from "./types.ts";
import type { Callback, Callbackified } from "./utils.ts";
import { track, tracked, untrack } from "./dom/tracking.ts";
declare const _default: {
ListStore: typeof ListStore;
MapStore: typeof MapStore;
Store: typeof Store;
store: typeof store;
nu: <const Info extends string, Elem extends import("./types.ts").InferElementType<Info>, Deps extends Record<string, Store<any>>>(elt?: Info | Elem, args?: ElementProperties<Elem, Deps>) => NuBuilder<Elem, Deps, Info>;
mustache: <T extends Record<string, any> = Record<string, any>>(template: string, ctx: T) => string;
template: <T extends Record<string, any> = Record<string, any>>(template: string) => (ctx: T) => string;
escape: (str: string) => string;
unescape: (str: string) => string;
extend: <T extends HTMLElement, D extends Record<string, Store<any>>>(elt: T, args?: ElementProperties<T, D>) => [T, ...HTMLElement[]];
insert: (els: Element | Element[], where: ElementPosition) => Element | Element[];
empty: (elt: Element) => void;
rm: (elt: Element) => void;
select: typeof select;
onload: (cb: (ev: Event) => void) => void;
html: (strings: TemplateStringsArray, ...values: (string | boolean | number | import("./templating/html.ts").RawHtml)[]) => string;
r: (val: any, options?: RawHtmlOptions) => import("./templating/html.ts").RawHtml;
seq: (...args: number[]) => number[];
CfDom: typeof CfDom;
callbackify: <T extends any[], U = unknown, E = any>(fn: (...args: T) => Promise<U>) => Callbackified<T, U, E>;
poll: (fn: () => void, interval: number, callNow?: boolean) => () => void;
ids: (prefix?: string) => () => string;
track: (id: string, elt: HTMLElement) => void;
tracked: (id: string) => HTMLElement | null;
untrack: (id: string) => void;
};
export default _default;
export { ListStore, MapStore, Store, store, nu, mustache, template, escape, unescape, extend, insert, empty, rm, select, onload, html, r, seq, CfDom, callbackify, poll, ids, track, tracked, untrack };
export type { ElementPosition, ElementProperties, AnySubscriber, EventSubscriber, Template, NuBuilder, SelectParams, RawHtmlOptions, Callback, Callbackified };