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

@dwightbcoder/action-ui

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dwightbcoder/action-ui - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

dist/action-ui.js

18

package.json
{
"name": "@dwightbcoder/action-ui",
"version": "1.0.1",
"version": "1.0.2",
"description": "Action UI is a Javascript framework for building event-base user interfaces",
"main": "src/index.js",
"main": "dist/index.js",
"directories": {
"example": "example"
},
"prepublish": "npm run build",
"scripts": {
"rollup": "rollup src/index.js --format iife --name ActionUI --file src/bundle.js",
"babel:dev": "NODE_ENV=dev babel src/bundle.js -d dist && mv dist/bundle.js dist/action-ui.js",
"babel:prod": "NODE_ENV=production babel src/bundle.js -d dist && mv dist/bundle.js dist/action-ui.min.js",
"build": "npm run rollup && npm run babel:dev && npm run babel:prod && cp -a src dist/es6",
"test": "echo \"Error: no test specified\" && exit 1"

@@ -31,3 +36,10 @@ },

},
"homepage": "https://github.com/dwightbcoder/action-ui#readme"
"homepage": "https://github.com/dwightbcoder/action-ui#readme",
"devDependencies": {
"@babel/cli": "^7.6.2",
"@babel/core": "^7.6.2",
"@babel/preset-env": "^7.6.2",
"babel-preset-minify": "^0.5.1"
},
"dependencies": {}
}

@@ -9,2 +9,3 @@ import * as Util from './modules/util.js'

export { View } from './modules/view.js'
export { ViewFile } from './modules/view.file.js'
export { ViewHandlebars } from './modules/view.handlebars.js'

26

src/modules/router.js
import * as Util from './util.js'
import { Controller } from './controller.js'
import { View } from './view.js'
import { ViewFile } from './view.file.js'
import { ViewHandlebars } from './view.handlebars.js'

@@ -12,3 +13,3 @@

this._instance = {}
this.view = (view instanceof View) ? view : new View(view)
this.view = (view instanceof View) ? view : new ViewFile(view)
this.state = state

@@ -32,5 +33,5 @@ window.addEventListener('popstate', this.changeState.bind(this))

controller = this.controllerName(pathController)
pathMethod = path[0]
pathMethod = route == '/' ? _options.defaultMethod : path[0]
}
if (! this._instance[controller])

@@ -50,8 +51,13 @@ {

let result = null
let template = pathController + '/' + pathMethod
let view = pathController + '/' + pathMethod
let method = Util.camelCase(pathMethod)
if ( this._instance[controller].view instanceof ViewHandlebars)
if ( this._instance[controller].view instanceof ViewFile)
{
this._instance[controller].view.html = template
this._instance[controller].view.file = view
}
else if ( this._instance[controller].view instanceof ViewHandlebars)
{
this._instance[controller].view.html = view
}

@@ -64,3 +70,3 @@ if (_options.autoload && ! (this._instance[controller][method] instanceof Function))

model.dev = location.host == _options.devHost
model.view = template
model.view = view
model.controller = pathController

@@ -147,4 +153,8 @@ model.method = pathMethod

{
if ( this._instance[controller].view instanceof ViewHandlebars)
if ( this._instance[controller].view instanceof ViewFile)
{
this._instance[controller].view.file = _options.errorView
}
else if ( this._instance[controller].view instanceof ViewHandlebars)
{
this._instance[controller].view.html = _options.errorView

@@ -151,0 +161,0 @@ }

@@ -1,2 +0,3 @@

import { View } from './view.js'
import { ViewFile } from './view.file.js'
import { deepAssign } from './util.js'

@@ -8,31 +9,15 @@ /**

*/
class ViewHandlebars extends View
class ViewHandlebars extends ViewFile
{
constructor(name, template, model)
{
if (arguments.length == 2)
{
model = template
template = undefined
}
if (!template)
{
template = name
}
super(name, template, model)
}
render()
{
if ( ViewHandlebars.options.verbose ) console.info( 'ViewHandlebars.render()', this.name, {view:this} )
if ( _options.verbose ) console.info( 'ViewHandlebars.render()', this.name, {view:this} )
var _promise = null
if ('string' == (typeof this._html))
if (this._html == null)
{
if (Handlebars.templates && Handlebars.templates[this._html])
if (Handlebars.templates && Handlebars.templates[this.file])
{
this._html = Handlebars.templates[this._html]
this._html = Handlebars.templates[this.file]
_promise = Promise.resolve()

@@ -42,7 +27,3 @@ }

{
let template = this._html + '.' + ViewHandlebars.options.extension
_promise = fetch(ViewHandlebars.options.basePath + template)
.then(response => { if (response.ok) return response.text() })
.then(html => this._html = Handlebars.compile(html))
.catch(e => { throw new Error('Template not found: ' + template) })
_promise = this.fetch().then(() => this._html = Handlebars.compile(this._html))
}

@@ -60,19 +41,12 @@ }

// View factory
static create(options)
{
if ( options.template )
{
options.template = options.name
}
static get options() { return _options }
static set options(value) { deepAssign(_options, value) }
return new ViewHandlebars(options.name, options.template, options.model)
}
// #endregion
}
ViewHandlebars.options.basePath = ''
let _options = {}
ViewHandlebars.options = ViewFile.options
ViewHandlebars.options.extension = 'hbs'
export { ViewHandlebars }

@@ -1,2 +0,2 @@

import * as Util from './util.js'
import { deepAssign } from './util.js'
import { Model } from './model.js'

@@ -113,3 +113,3 @@

static get options() { return _options }
static set options(value) { Util.deepAssign(_options, value) }
static set options(value) { deepAssign(_options, value) }

@@ -116,0 +116,0 @@ // #endregion

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