mini-van-plate
Advanced tools
Comparing version 0.3.3 to 0.3.4
{ | ||
"name": "mini-van-plate", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "A minimalist template engine for DOM generation and manipulation, working for both client-side and server-side rendering", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -151,3 +151,3 @@ # **Mini-Van**: A Minimalist Template Engine for Client/Server-side Rendering without JSX | ||
import { serve } from "https://deno.land/std@0.184.0/http/server.ts" | ||
import van from "https://deno.land/x/minivan@0.3.3/src/van-plate.js" | ||
import van from "https://deno.land/x/minivan@/src/van-plate.js" | ||
@@ -190,3 +190,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.3.3/src/mini-van.js" | ||
import van from "https://deno.land/x/minivan@/src/mini-van.js" | ||
@@ -226,12 +226,12 @@ const document = new DOMParser().parseFromString("", "text/html")! | ||
To get started on the client side, download the latest version [`mini-van-0.3.3.min.js`](https://vanjs.org/autodownload?file=mini-van-0.3.3.min.js) and add the line below to your script: | ||
To get started on the client side, download the latest version [`mini-van-.min.js`](https://vanjs.org/autodownload?file=mini-van-.min.js) and add the line below to your script: | ||
```javascript | ||
import van from "./mini-van-0.3.3.min.js" | ||
import van from "./mini-van-.min.js" | ||
``` | ||
To code without ES6 modules, you can download the bundled version [`mini-van-0.3.3.nomodule.min.js`](https://vanjs.org/autodownload?file=mini-van-0.3.3.nomodule.min.js) and add the following line to your HTML file instead: | ||
To code without ES6 modules, you can download the bundled version [`mini-van-.nomodule.min.js`](https://vanjs.org/autodownload?file=mini-van-.nomodule.min.js) and add the following line to your HTML file instead: | ||
```html | ||
<script type="text/javascript" src="mini-van-0.3.3.nomodule.min.js"></script> | ||
<script type="text/javascript" src="mini-van-.nomodule.min.js"></script> | ||
``` | ||
@@ -238,0 +238,0 @@ |
@@ -12,4 +12,6 @@ /// <reference types="./mini-van.d.ts" /> | ||
let _result = { | ||
add: (dom, ...children) => ( | ||
children.flat(Infinity).forEach(child => dom.appendChild(toDom(child))), dom), | ||
add: (dom, ...children) => { | ||
for (let child of children.flat(Infinity)) dom.appendChild(toDom(child)) | ||
return dom | ||
}, | ||
@@ -19,4 +21,4 @@ tags: new Proxy((name, ...args) => { | ||
let dom = doc.createElement(name) | ||
Obj.entries(props).forEach(([k, v]) => | ||
dom[k] !== undefined ? dom[k] = v : dom.setAttribute(k, v)) | ||
for (let [k, v] of Obj.entries(props)) | ||
dom[k] !== undefined ? dom[k] = v : dom.setAttribute(k, v) | ||
return _result.add(dom, ...children) | ||
@@ -23,0 +25,0 @@ }, {get: (tag, name) => tag.bind(null, name)}), |
21109
7
218