Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dvo/stamp

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dvo/stamp - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

package.json
{
"name": "@dvo/stamp",
"version": "0.0.1",
"version": "0.0.2",
"description": "Tool for lightweight componentization.",

@@ -5,0 +5,0 @@ "main": "stamp.js",

@@ -85,3 +85,3 @@ # STAMP

- `stamp()` Creates the component from the template, mutates it and appends to the target (by default, the template's container).
- `stamp()` <small>:function</small> Creates the component from the template, mutates it and appends to the target (by default, the template's container). If an argument function is passed, it will be run against the element *after* it is appended.
- `alias()` <small>:string</small> Give the current stamp an alias, so it's easy to retrieve it later by calling `Stamp.get(alias)`.

@@ -88,0 +88,0 @@ - `change()` <small>:function</small> Defines a mutator function to be called just before stamping. The function receives the component instance **before** it is appended to the DOM, so manipulations on it are cheaper and you don't get FOUC.

const stampData = {}
const aliasData = {}
window.$$ = [
stampData,
aliasData
]
const identity = x => x

@@ -13,3 +9,2 @@

this.template = document.querySelector(selector)
// this.targetSelector = null
this.target = this.template.parentElement

@@ -25,3 +20,2 @@ this.cap = Infinity

function Stamp (selector) {

@@ -52,5 +46,6 @@ let data = {}

},
stamp () {
stamp (callback) {
console.log('?', !!callback)
if (count() < data.cap) {
console.log('!!', count(), data.cap)
const target = data.target
const clone = data.template.content.cloneNode(true)

@@ -60,3 +55,7 @@ const cloneContent = clone.firstElementChild

cloneContent.setAttribute('data-_stamp', data.selector)
data.target.append(clone)
target.append(clone)
if (callback) {
console.log('cbk', callback, target.lastElementChild)
callback(target.lastElementChild)
}
}

@@ -74,3 +73,2 @@ return this

target (targetSelector) {
// data.targetSelector = targetSelector
data.target = document.querySelector(targetSelector)

@@ -104,3 +102,3 @@ return this

debug () {
console.log('stamp data:', data)
console.debug('stamp data:', data)
return this

@@ -107,0 +105,0 @@ }

Sorry, the diff of this file is not supported yet

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