Socket
Socket
Sign inDemoInstall

mini-van-plate

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mini-van-plate - npm Package Compare versions

Comparing version 0.3.6 to 0.3.7

2

package.json
{
"name": "mini-van-plate",
"version": "0.3.6",
"version": "0.3.7",
"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.6/src/van-plate.js"
import van from "https://deno.land/x/minivan@0.3.7/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.6/src/mini-van.js"
import van from "https://deno.land/x/minivan@0.3.7/src/mini-van.js"

@@ -238,3 +238,3 @@ const document = new DOMParser().parseFromString("", "text/html")!

You can find all relevant **Mini-Van** files in this [Download Table](https://vanjs.org/minivan#download-table).
You can find all relevant **Mini-Van** files in this [Download Table](https://vanjs.org/minivan#download-table).

@@ -241,0 +241,0 @@ ## API Reference

@@ -10,3 +10,3 @@ export type Primitive = string | number | boolean | bigint

export type ChildDom<ElementType, TextNodeType> = Primitive | ElementType | TextNodeType
| readonly ChildDom<ElementType, TextNodeType>[]
| readonly ChildDom<ElementType, TextNodeType>[] | null | undefined

@@ -20,3 +20,3 @@ type AddFunc<ElementType, TextNodeType> =

type Tags<ElementType, TextNodeType> = {
interface Tags<ElementType, TextNodeType> {
readonly [key: string]: TagFunc<ElementType, TextNodeType>

@@ -27,3 +27,3 @@ }

// specialized DOM elements.
type BrowserTags = Tags<Element, Text> & {
interface BrowserTags extends Tags<Element, Text> {
// Register known element types

@@ -145,3 +145,3 @@ // Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element

export type Van = {
export interface Van {
readonly vanWithDoc: VanWithDoc

@@ -148,0 +148,0 @@ readonly add: AddFunc<Element, Text>

@@ -6,3 +6,3 @@ /// <reference types="./mini-van.d.ts" />

// Aliasing some builtin symbols to reduce the bundle size.
let Obj = Object
let Obj = Object, _undefined

@@ -14,3 +14,4 @@ let vanWithDoc = doc => {

add: (dom, ...children) => {
for (let child of children.flat(Infinity)) dom.appendChild(toDom(child))
for (let child of children.flat(Infinity))
if (child != _undefined) dom.appendChild(toDom(child))
return dom

@@ -17,0 +18,0 @@ },

@@ -9,3 +9,3 @@ type Primitive = string | number | boolean | bigint

export type ChildDom = Primitive | Element | readonly ChildDom[]
export type ChildDom = Primitive | Element | readonly ChildDom[] | null | undefined

@@ -12,0 +12,0 @@ export type TagFunc = (first?: Props | ChildDom, ...rest: readonly ChildDom[]) => Element

@@ -39,3 +39,3 @@ /// <reference types="./van-plate.d.ts" />

const toStr = children => children.flat(Infinity).map(
const toStr = children => children.map(
c => Object.getPrototypeOf(c) === elementProto ? c.render() : escape(c.toString())).join("")

@@ -49,7 +49,9 @@

(v ? " " + k : "") : ` ${k}=${JSON.stringify(v)}`).join("")
const flattenedChildren = children.flat(Infinity).filter(c => c != null)
return {__proto__: elementProto, name, propsStr,
childrenStrs: children.length > 0 ? [toStr(children)] : []}
childrenStrs: flattenedChildren.length > 0 ? [toStr(flattenedChildren)] : []}
}, { get: (tag, name) => tag.bind(null, name) })
const add = (dom, ...children) => {
children = children.flat(Infinity).filter(c => c != null)
if (children.length > 0) dom.childrenStrs.push(toStr(children))

@@ -56,0 +58,0 @@ return dom

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc