mini-van-plate
Advanced tools
Comparing version 0.5.2 to 0.5.3
{ | ||
"name": "mini-van-plate", | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"description": "A minimalist template engine for DOM generation and manipulation, working for both client-side and server-side rendering", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -157,3 +157,3 @@ # **Mini-Van**: A Minimalist Template Engine for Client/Server-side Rendering without JSX | ||
```typescript | ||
import van from "https://deno.land/x/minivan@0.5.2/src/van-plate.js" | ||
import van from "https://deno.land/x/minivan@0.5.3/src/van-plate.js" | ||
@@ -199,3 +199,3 @@ const {a, body, li, p, ul} = van.tags | ||
import { DOMParser } from "https://deno.land/x/deno_dom@v0.1.38/deno-dom-wasm.ts" | ||
import van from "https://deno.land/x/minivan@0.5.2/src/mini-van.js" | ||
import van from "https://deno.land/x/minivan@0.5.3/src/mini-van.js" | ||
@@ -240,3 +240,3 @@ const document = new DOMParser().parseFromString("", "text/html")! | ||
```javascript | ||
import van from "https://cdn.jsdelivr.net/gh/vanjs-org/mini-van/public/mini-van-0.5.2.min.js" | ||
import van from "https://cdn.jsdelivr.net/gh/vanjs-org/mini-van/public/mini-van-0.5.3.min.js" | ||
``` | ||
@@ -247,6 +247,6 @@ | ||
```html | ||
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/vanjs-org/mini-van/public/mini-van-0.5.2.nomodule.min.js"></script> | ||
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/vanjs-org/mini-van/public/mini-van-0.5.3.nomodule.min.js"></script> | ||
``` | ||
Alternative, you can download the files ([`mini-van-0.5.2.min.js`](https://vanjs.org/autodownload?file=mini-van-0.5.2.min.js), [`mini-van-0.5.2.nomodule.min.js`](https://vanjs.org/autodownload?file=mini-van-0.5.2.nomodule.min.js)) and serve them locally. | ||
Alternative, you can download the files ([`mini-van-0.5.3.min.js`](https://vanjs.org/autodownload?file=mini-van-0.5.3.min.js), [`mini-van-0.5.3.nomodule.min.js`](https://vanjs.org/autodownload?file=mini-van-0.5.3.nomodule.min.js)) and serve them locally. | ||
@@ -253,0 +253,0 @@ You can find all relevant **Mini-Van** files in this [Download Table](https://vanjs.org/minivan#download-table). |
@@ -16,10 +16,15 @@ export interface State<T> { | ||
export type ValidChildDomValue<ElementType, TextNodeType> = | ||
Primitive | ElementType | TextNodeType | null | undefined | ||
interface HasFirstChild {firstChild?: unknown} | ||
export type BindingFunc<ElementType, TextNodeType> = | ||
type NodeType<ElementType extends HasFirstChild> = | ||
Omit<ElementType["firstChild"], "after" | "before" | "remove" | "replaceWith"> | ||
export type ValidChildDomValue<ElementType extends HasFirstChild, TextNodeType> = | ||
Primitive | ElementType | NodeType<ElementType> | TextNodeType | null | undefined | ||
export type BindingFunc<ElementType extends HasFirstChild, TextNodeType> = | ||
| ((dom?: ElementType | TextNodeType) => ValidChildDomValue<ElementType, TextNodeType>) | ||
| ((dom?: ElementType) => ElementType) | ||
export type ChildDom<ElementType, TextNodeType> = | ||
export type ChildDom<ElementType extends HasFirstChild, TextNodeType> = | ||
| ValidChildDomValue<ElementType, TextNodeType> | ||
@@ -30,10 +35,11 @@ | StateView<Primitive | null | undefined> | ||
type AddFunc<ElementType, TextNodeType> = | ||
type AddFunc<ElementType extends HasFirstChild, TextNodeType> = | ||
(dom: ElementType, ...children: readonly ChildDom<ElementType, TextNodeType>[]) => ElementType | ||
export type TagFunc<ElementType, TextNodeType, ResultType = ElementType> = | ||
export type TagFunc<ElementType extends HasFirstChild, TextNodeType, ResultType = ElementType> = | ||
(first?: Props | ChildDom<ElementType, TextNodeType>, | ||
...rest: readonly ChildDom<ElementType, TextNodeType>[]) => ResultType | ||
type Tags<ElementType, TextNodeType> = Readonly<Record<string, TagFunc<ElementType, TextNodeType>>> | ||
type Tags<ElementType extends HasFirstChild, TextNodeType> = | ||
Readonly<Record<string, TagFunc<ElementType, TextNodeType>>> | ||
@@ -46,3 +52,3 @@ // Tags type in browser context, which contains the signatures to tag functions that return | ||
export interface VanObj<ElementType, TextNodeType> { | ||
export interface VanObj<ElementType extends HasFirstChild, TextNodeType> { | ||
readonly state: <T>(initVal: T) => State<T> | ||
@@ -63,3 +69,3 @@ readonly val: <T>(s: T | StateView<T>) => T | ||
export interface Van extends VanObj<Element, Text> { | ||
readonly vanWithDoc: <ElementType, TextNodeType>(doc: { | ||
readonly vanWithDoc: <ElementType extends HasFirstChild, TextNodeType>(doc: { | ||
createElement(s: any): ElementType, | ||
@@ -66,0 +72,0 @@ createTextNode(s: any): TextNodeType, |
22147
217