mini-van-plate
Advanced tools
Comparing version 0.5.0 to 0.5.2
{ | ||
"name": "mini-van-plate", | ||
"version": "0.5.0", | ||
"version": "0.5.2", | ||
"description": "A minimalist template engine for DOM generation and manipulation, working for both client-side and server-side rendering", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -75,3 +75,3 @@ # **Mini-Van**: A Minimalist Template Engine for Client/Server-side Rendering without JSX | ||
Preview via [CodeSandbox](https://codesandbox.io/p/sandbox/hopeful-perlman-rh7wvk?file=/van-plate-server.mjs:1,1). | ||
Preview via [CodeSandbox](https://codesandbox.io/p/sandbox/github/vanjs-org/vanjs-org.github.io/tree/master/sitegen/node-examples/van-plate-server?file=%2Fvan-plate-server.mjs%3A1%2C1). | ||
@@ -139,3 +139,3 @@ As illustrated in the example, `render` method can be called on the object returned from the [`tag function`](https://vanjs.org/tutorial#api-tags) to generate a `string` that can be used for serving. | ||
Preview via [CodeSandbox](https://codesandbox.io/p/sandbox/eloquent-nova-s9km5j?file=/mini-van-server.mjs:1,1). | ||
Preview via [CodeSandbox](https://codesandbox.io/p/sandbox/github/vanjs-org/vanjs-org.github.io/tree/master/sitegen/node-examples/mini-van-server?file=%2Fmini-van-server.mjs%3A1%2C1). | ||
@@ -159,3 +159,3 @@ Similar to `van-plate` mode, we have a helper function `html` defined in `mini-van.js` which is equivalent to: | ||
```typescript | ||
import van from "https://deno.land/x/minivan@0.4.2/src/van-plate.js" | ||
import van from "https://deno.land/x/minivan@0.5.2/src/van-plate.js" | ||
@@ -189,3 +189,3 @@ const {a, body, li, p, ul} = van.tags | ||
Preview via [CodeSandbox](https://codesandbox.io/p/sandbox/eloquent-bird-95rzff?file=/van-plate-server.ts:1,1). | ||
Preview via [CodeSandbox](https://codesandbox.io/p/sandbox/github/vanjs-org/vanjs-org.github.io/tree/master/sitegen/deno-examples/van-plate-server?file=%2Fvan-plate-server.ts%3A1%2C1). | ||
@@ -202,3 +202,3 @@ ### `mini-van` mode | ||
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.4.2/src/mini-van.js" | ||
import van from "https://deno.land/x/minivan@0.5.2/src/mini-van.js" | ||
@@ -236,3 +236,3 @@ const document = new DOMParser().parseFromString("", "text/html")! | ||
Preview via [CodeSandbox](https://codesandbox.io/p/sandbox/heuristic-browser-vtxh3c?file=/mini-van-server.ts:1,1). | ||
Preview via [CodeSandbox](https://codesandbox.io/p/sandbox/github/vanjs-org/vanjs-org.github.io/tree/master/sitegen/deno-examples/mini-van-server?file=%2Fmini-van-server.ts%3A1%2C1). | ||
@@ -244,3 +244,3 @@ ## Client-Side: Getting Started | ||
```javascript | ||
import van from "https://cdn.jsdelivr.net/gh/vanjs-org/mini-van/public/mini-van-0.4.2.min.js" | ||
import van from "https://cdn.jsdelivr.net/gh/vanjs-org/mini-van/public/mini-van-0.5.2.min.js" | ||
``` | ||
@@ -251,6 +251,6 @@ | ||
```html | ||
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/vanjs-org/mini-van/public/mini-van-0.4.2.nomodule.min.js"></script> | ||
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/vanjs-org/mini-van/public/mini-van-0.5.2.nomodule.min.js"></script> | ||
``` | ||
Alternative, you can download the files ([`mini-van-0.4.2.min.js`](https://vanjs.org/autodownload?file=mini-van-0.4.2.min.js), [`mini-van-0.4.2.nomodule.min.js`](https://vanjs.org/autodownload?file=mini-van-0.4.2.nomodule.min.js)) and serve them locally. | ||
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. | ||
@@ -257,0 +257,0 @@ You can find all relevant **Mini-Van** files in this [Download Table](https://vanjs.org/minivan#download-table). |
@@ -36,148 +36,8 @@ export interface State<T> { | ||
type Tags<ElementType, TextNodeType> = Record<string, TagFunc<ElementType, TextNodeType>> | ||
type Tags<ElementType, TextNodeType> = Readonly<Record<string, TagFunc<ElementType, TextNodeType>>> | ||
// Tags type in browser context, which contains the signatures to tag functions that return | ||
// specialized DOM elements. | ||
interface BrowserTags extends Tags<Element, Text> { | ||
// Register known element types | ||
// Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element | ||
// Main root | ||
readonly html: TagFunc<Element, Text, HTMLHtmlElement> | ||
// Document metadata | ||
readonly base: TagFunc<Element, Text, HTMLBaseElement> | ||
readonly head: TagFunc<Element, Text, HTMLHeadElement> | ||
readonly link: TagFunc<Element, Text, HTMLLinkElement> | ||
readonly meta: TagFunc<Element, Text, HTMLMetaElement> | ||
readonly style: TagFunc<Element, Text, HTMLStyleElement> | ||
readonly title: TagFunc<Element, Text, HTMLTitleElement> | ||
// Sectioning root | ||
readonly body: TagFunc<Element, Text, HTMLBodyElement> | ||
// Content sectioning | ||
readonly address: TagFunc<Element, Text, HTMLElement> | ||
readonly article: TagFunc<Element, Text, HTMLElement> | ||
readonly aside: TagFunc<Element, Text, HTMLElement> | ||
readonly footer: TagFunc<Element, Text, HTMLElement> | ||
readonly header: TagFunc<Element, Text, HTMLElement> | ||
readonly h1: TagFunc<Element, Text, HTMLHeadingElement> | ||
readonly h2: TagFunc<Element, Text, HTMLHeadingElement> | ||
readonly h3: TagFunc<Element, Text, HTMLHeadingElement> | ||
readonly h4: TagFunc<Element, Text, HTMLHeadingElement> | ||
readonly h5: TagFunc<Element, Text, HTMLHeadingElement> | ||
readonly h6: TagFunc<Element, Text, HTMLHeadingElement> | ||
readonly hgroup: TagFunc<Element, Text, HTMLElement> | ||
readonly main: TagFunc<Element, Text, HTMLElement> | ||
readonly nav: TagFunc<Element, Text, HTMLElement> | ||
readonly section: TagFunc<Element, Text, HTMLElement> | ||
// Text content | ||
readonly blockquote: TagFunc<Element, Text, HTMLQuoteElement> | ||
readonly dd: TagFunc<Element, Text, HTMLElement> | ||
readonly div: TagFunc<Element, Text, HTMLDivElement> | ||
readonly dl: TagFunc<Element, Text, HTMLDListElement> | ||
readonly dt: TagFunc<Element, Text, HTMLElement> | ||
readonly figcaption: TagFunc<Element, Text, HTMLElement> | ||
readonly figure: TagFunc<Element, Text, HTMLElement> | ||
readonly hr: TagFunc<Element, Text, HTMLHRElement> | ||
readonly li: TagFunc<Element, Text, HTMLLIElement> | ||
readonly menu: TagFunc<Element, Text, HTMLMenuElement> | ||
readonly ol: TagFunc<Element, Text, HTMLOListElement> | ||
readonly p: TagFunc<Element, Text, HTMLParagraphElement> | ||
readonly pre: TagFunc<Element, Text, HTMLPreElement> | ||
readonly ul: TagFunc<Element, Text, HTMLUListElement> | ||
// Inline text semantics | ||
readonly a: TagFunc<Element, Text, HTMLAnchorElement> | ||
readonly abbr: TagFunc<Element, Text, HTMLElement> | ||
readonly b: TagFunc<Element, Text, HTMLElement> | ||
readonly bdi: TagFunc<Element, Text, HTMLElement> | ||
readonly bdo: TagFunc<Element, Text, HTMLElement> | ||
readonly br: TagFunc<Element, Text, HTMLBRElement> | ||
readonly cite: TagFunc<Element, Text, HTMLElement> | ||
readonly code: TagFunc<Element, Text, HTMLElement> | ||
readonly data: TagFunc<Element, Text, HTMLDataElement> | ||
readonly dfn: TagFunc<Element, Text, HTMLElement> | ||
readonly em: TagFunc<Element, Text, HTMLElement> | ||
readonly i: TagFunc<Element, Text, HTMLElement> | ||
readonly kbd: TagFunc<Element, Text, HTMLElement> | ||
readonly mark: TagFunc<Element, Text, HTMLElement> | ||
readonly q: TagFunc<Element, Text, HTMLQuoteElement> | ||
readonly rp: TagFunc<Element, Text, HTMLElement> | ||
readonly rt: TagFunc<Element, Text, HTMLElement> | ||
readonly ruby: TagFunc<Element, Text, HTMLElement> | ||
readonly s: TagFunc<Element, Text, HTMLElement> | ||
readonly samp: TagFunc<Element, Text, HTMLElement> | ||
readonly small: TagFunc<Element, Text, HTMLElement> | ||
readonly span: TagFunc<Element, Text, HTMLSpanElement> | ||
readonly strong: TagFunc<Element, Text, HTMLElement> | ||
readonly sub: TagFunc<Element, Text, HTMLElement> | ||
readonly sup: TagFunc<Element, Text, HTMLElement> | ||
readonly time: TagFunc<Element, Text, HTMLTimeElement> | ||
readonly u: TagFunc<Element, Text, HTMLElement> | ||
readonly var: TagFunc<Element, Text, HTMLElement> | ||
readonly wbr: TagFunc<Element, Text, HTMLElement> | ||
// Image and multimedia | ||
readonly area: TagFunc<Element, Text, HTMLAreaElement> | ||
readonly audio: TagFunc<Element, Text, HTMLAudioElement> | ||
readonly img: TagFunc<Element, Text, HTMLImageElement> | ||
readonly map: TagFunc<Element, Text, HTMLMapElement> | ||
readonly track: TagFunc<Element, Text, HTMLTrackElement> | ||
readonly video: TagFunc<Element, Text, HTMLVideoElement> | ||
// Embedded content | ||
readonly embed: TagFunc<Element, Text, HTMLEmbedElement> | ||
readonly iframe: TagFunc<Element, Text, HTMLIFrameElement> | ||
readonly object: TagFunc<Element, Text, HTMLObjectElement> | ||
readonly picture: TagFunc<Element, Text, HTMLPictureElement> | ||
readonly source: TagFunc<Element, Text, HTMLSourceElement> | ||
// Scripting | ||
readonly canvas: TagFunc<Element, Text, HTMLCanvasElement> | ||
readonly noscript: TagFunc<Element, Text, HTMLElement> | ||
readonly script: TagFunc<Element, Text, HTMLScriptElement> | ||
// Demarcating edits | ||
readonly del: TagFunc<Element, Text, HTMLModElement> | ||
readonly ins: TagFunc<Element, Text, HTMLModElement> | ||
// Table content | ||
readonly caption: TagFunc<Element, Text, HTMLTableCaptionElement> | ||
readonly col: TagFunc<Element, Text, HTMLTableColElement> | ||
readonly colgroup: TagFunc<Element, Text, HTMLTableColElement> | ||
readonly table: TagFunc<Element, Text, HTMLTableElement> | ||
readonly tbody: TagFunc<Element, Text, HTMLTableSectionElement> | ||
readonly td: TagFunc<Element, Text, HTMLTableCellElement> | ||
readonly tfoot: TagFunc<Element, Text, HTMLTableSectionElement> | ||
readonly th: TagFunc<Element, Text, HTMLTableCellElement> | ||
readonly thead: TagFunc<Element, Text, HTMLTableSectionElement> | ||
readonly tr: TagFunc<Element, Text, HTMLTableRowElement> | ||
// Forms | ||
readonly button: TagFunc<Element, Text, HTMLButtonElement> | ||
readonly datalist: TagFunc<Element, Text, HTMLDataListElement> | ||
readonly fieldset: TagFunc<Element, Text, HTMLFieldSetElement> | ||
readonly form: TagFunc<Element, Text, HTMLFormElement> | ||
readonly input: TagFunc<Element, Text, HTMLInputElement> | ||
readonly label: TagFunc<Element, Text, HTMLLabelElement> | ||
readonly legend: TagFunc<Element, Text, HTMLLegendElement> | ||
readonly meter: TagFunc<Element, Text, HTMLMeterElement> | ||
readonly optgroup: TagFunc<Element, Text, HTMLOptGroupElement> | ||
readonly option: TagFunc<Element, Text, HTMLOptionElement> | ||
readonly output: TagFunc<Element, Text, HTMLOutputElement> | ||
readonly progress: TagFunc<Element, Text, HTMLProgressElement> | ||
readonly select: TagFunc<Element, Text, HTMLSelectElement> | ||
readonly textarea: TagFunc<Element, Text, HTMLTextAreaElement> | ||
// Interactive elements | ||
readonly details: TagFunc<Element, Text, HTMLDetailsElement> | ||
readonly dialog: TagFunc<Element, Text, HTMLDialogElement> | ||
readonly summary: TagFunc<Element, Text, HTMLElement> | ||
// Web Components | ||
readonly slot: TagFunc<Element, Text, HTMLSlotElement> | ||
readonly template: TagFunc<Element, Text, HTMLTemplateElement> | ||
type BrowserTags = Tags<Element, Text> & { | ||
[K in keyof HTMLElementTagNameMap]: TagFunc<Element, Text, HTMLElementTagNameMap[K]> | ||
} | ||
@@ -184,0 +44,0 @@ |
@@ -33,4 +33,4 @@ export interface State<T> { | ||
readonly _: (f: () => PropValue) => () => PropValue | ||
readonly tags: Record<string, TagFunc> | ||
readonly tagsNS: (namespaceURI: string) => Record<string, TagFunc> | ||
readonly tags: Readonly<Record<string, TagFunc>> | ||
readonly tagsNS: (namespaceURI: string) => Readonly<Record<string, TagFunc>> | ||
readonly html: (first?: Props | ChildDom, ...rest: readonly ChildDom[]) => string | ||
@@ -37,0 +37,0 @@ } |
21764
213