New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

infrontjs

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

infrontjs - npm Package Compare versions

Comparing version 0.3.0 to 0.5.0

src/core/Api.js

153

dist/IF.es.js

@@ -29,2 +29,13 @@ /**

/**
* Checks if given value is string
*
* @param {*} v Value to check
* @returns {boolean}
*/
function isString( v )
{
return ( typeof v === 'string' || v instanceof String );
}
/**
* Checks if given value is a class constructor

@@ -200,29 +211,2 @@ * Refer:

class State
{
constructor( app, routeParams )
{
this.app = app;
this.routeParams = routeParams;
}
canEnter()
{
return true;
}
canExit()
{
return true;
}
enter()
{
}
exit()
{
}
}
// Generated by CoffeeScript 1.10.0

@@ -691,2 +675,34 @@

class State
{
constructor( app, routeParams )
{
this.app = app;
this.routeParams = routeParams;
}
canEnter()
{
return true;
}
canExit()
{
return true;
}
getRedirectTo()
{
return null;
}
enter()
{
}
exit()
{
}
}
class Router

@@ -824,3 +840,3 @@ {

{
console.error( e );
console && console.error( e );
// Uncatched error

@@ -838,3 +854,2 @@ }

this.currentState = null;
this.pathToStateFolder = this.app.settings.getPropertyValue( 'stateManager.rootPath' );
}

@@ -849,6 +864,14 @@

if ( false === this._states.hasOwnProperty( stateClass.ID ) )
// Throw an error if ID is null or already taken
if ( false === isString( stateClass.ID ) )
{
this._states[ stateClass.ID ] = stateClass;
throw new Error( 'Given stateClass does not have a valid static ID' );
}
if ( true === this._states.hasOwnProperty( stateClass.ID ) )
{
throw new Error( 'stateClass.ID already exists in states pool.' );
}
this._states[ stateClass.ID ] = stateClass;
}

@@ -872,4 +895,11 @@

{
// @todo Think about how to handle this
return false;
const redirectTo = newState.getRedirectTo();
if ( redirectTo )
{
this.app.router.redirect( redirectTo );
}
else
{
throw Error( 'Forbidden to enter new state:' + newState.ID );
}
}

@@ -962,4 +992,9 @@

async fetchTemplate( templateUrl, useCache = true )
getHtml( tmpl, data = {} )
{
return _template( tmpl, data );
}
async get( templateUrl, useCache = true )
{
let tmplHtml = useCache ? this._getTemplateFromCache( templateUrl ) : null;

@@ -979,17 +1014,2 @@ if ( !tmplHtml )

}
compileTemplate( tmpl, data = {} )
{
return _template( tmpl, data );
}
async renderTemplate( templateUrl, data = {}, containerElement = null )
{
let tmpl = await this.fetchTemplate( templateUrl ),
html = this.compileTemplate( tmpl, data );
this.app.viewManager.render( html, containerElement );
return html;
}
}

@@ -1052,3 +1072,3 @@

// Global app pool
const apps = [];
const apps = {};

@@ -1062,2 +1082,3 @@ const DEFAULT_PROPS = {

const DEFAULT_SETTINGS = {
"sayHello" : true,
"l18n" : {

@@ -1092,2 +1113,8 @@ "defaultLanguage" : "en"

// If container property is a string, check if it is a querySelector
if ( isString( this.container ) )
{
this.container = document.querySelector( this.container );
}
if ( !this.container || false === this.container instanceof HTMLElement )

@@ -1107,2 +1134,7 @@ {

apps[ this.uid ] = this;
if ( true === this.settings.sayHello && console )
{
console && console.log( "%c»InfrontJS« Version " + version, "font-family: monospace sans-serif; background-color: black; color: white;" );
}
}

@@ -1150,12 +1182,11 @@

function getApp( uid = '' )
function getApp( uid = null )
{
if ( uid )
if ( uid && apps.hasOwnProperty( uid ) )
{
uid = '' + uid;
return apps.find( app => app.uid === uid );
return apps[ uid ];
}
else if ( apps.length > 0 )
else if ( null === uid && Object.keys( apps ) > 0 )
{
return apps[ 0 ];
return apps[ Object.keys( apps )[ 0 ] ];
}

@@ -1166,3 +1197,2 @@ else

}
}

@@ -1190,11 +1220,8 @@

{
console.warn( `App with UID ${uid} not found.` );
console && console.warn( `App with UID ${uid} not found.` );
}
}
const version = "0.3.0";
const version = "0.4.0";
// Marketing ;-)
console.log( "%c»InfrontJS« Version " + version, "font-family: monospace sans-serif; background-color: black; color: white;" );
export { Api, App, PropertyObject, State, createUid, destroyApp, getApp, isClass, isClassChildOf, isPlainObject, trim, version };
export { Api, App, L18n, PropertyObject, Router, State, StateManager, TemplateManager, ViewManager, createUid, destroyApp, getApp, isClass, isClassChildOf, isPlainObject, trim, version };

@@ -35,2 +35,13 @@ (function (global, factory) {

/**
* Checks if given value is string
*
* @param {*} v Value to check
* @returns {boolean}
*/
function isString( v )
{
return ( typeof v === 'string' || v instanceof String );
}
/**
* Checks if given value is a class constructor

@@ -206,29 +217,2 @@ * Refer:

class State
{
constructor( app, routeParams )
{
this.app = app;
this.routeParams = routeParams;
}
canEnter()
{
return true;
}
canExit()
{
return true;
}
enter()
{
}
exit()
{
}
}
// Generated by CoffeeScript 1.10.0

@@ -697,2 +681,34 @@

class State
{
constructor( app, routeParams )
{
this.app = app;
this.routeParams = routeParams;
}
canEnter()
{
return true;
}
canExit()
{
return true;
}
getRedirectTo()
{
return null;
}
enter()
{
}
exit()
{
}
}
class Router

@@ -830,3 +846,3 @@ {

{
console.error( e );
console && console.error( e );
// Uncatched error

@@ -844,3 +860,2 @@ }

this.currentState = null;
this.pathToStateFolder = this.app.settings.getPropertyValue( 'stateManager.rootPath' );
}

@@ -855,6 +870,14 @@

if ( false === this._states.hasOwnProperty( stateClass.ID ) )
// Throw an error if ID is null or already taken
if ( false === isString( stateClass.ID ) )
{
this._states[ stateClass.ID ] = stateClass;
throw new Error( 'Given stateClass does not have a valid static ID' );
}
if ( true === this._states.hasOwnProperty( stateClass.ID ) )
{
throw new Error( 'stateClass.ID already exists in states pool.' );
}
this._states[ stateClass.ID ] = stateClass;
}

@@ -878,4 +901,11 @@

{
// @todo Think about how to handle this
return false;
const redirectTo = newState.getRedirectTo();
if ( redirectTo )
{
this.app.router.redirect( redirectTo );
}
else
{
throw Error( 'Forbidden to enter new state:' + newState.ID );
}
}

@@ -968,4 +998,9 @@

async fetchTemplate( templateUrl, useCache = true )
getHtml( tmpl, data = {} )
{
return _template( tmpl, data );
}
async get( templateUrl, useCache = true )
{
let tmplHtml = useCache ? this._getTemplateFromCache( templateUrl ) : null;

@@ -985,17 +1020,2 @@ if ( !tmplHtml )

}
compileTemplate( tmpl, data = {} )
{
return _template( tmpl, data );
}
async renderTemplate( templateUrl, data = {}, containerElement = null )
{
let tmpl = await this.fetchTemplate( templateUrl ),
html = this.compileTemplate( tmpl, data );
this.app.viewManager.render( html, containerElement );
return html;
}
}

@@ -1058,3 +1078,3 @@

// Global app pool
const apps = [];
const apps = {};

@@ -1068,2 +1088,3 @@ const DEFAULT_PROPS = {

const DEFAULT_SETTINGS = {
"sayHello" : true,
"l18n" : {

@@ -1098,2 +1119,8 @@ "defaultLanguage" : "en"

// If container property is a string, check if it is a querySelector
if ( isString( this.container ) )
{
this.container = document.querySelector( this.container );
}
if ( !this.container || false === this.container instanceof HTMLElement )

@@ -1113,2 +1140,7 @@ {

apps[ this.uid ] = this;
if ( true === this.settings.sayHello && console )
{
console && console.log( "%c»InfrontJS« Version " + version, "font-family: monospace sans-serif; background-color: black; color: white;" );
}
}

@@ -1156,12 +1188,11 @@

function getApp( uid = '' )
function getApp( uid = null )
{
if ( uid )
if ( uid && apps.hasOwnProperty( uid ) )
{
uid = '' + uid;
return apps.find( app => app.uid === uid );
return apps[ uid ];
}
else if ( apps.length > 0 )
else if ( null === uid && Object.keys( apps ) > 0 )
{
return apps[ 0 ];
return apps[ Object.keys( apps )[ 0 ] ];
}

@@ -1172,3 +1203,2 @@ else

}
}

@@ -1196,15 +1226,17 @@

{
console.warn( `App with UID ${uid} not found.` );
console && console.warn( `App with UID ${uid} not found.` );
}
}
const version = "0.3.0";
const version = "0.4.0";
// Marketing ;-)
console.log( "%c»InfrontJS« Version " + version, "font-family: monospace sans-serif; background-color: black; color: white;" );
exports.Api = Api;
exports.App = App;
exports.L18n = L18n;
exports.PropertyObject = PropertyObject;
exports.Router = Router;
exports.State = State;
exports.StateManager = StateManager;
exports.TemplateManager = TemplateManager;
exports.ViewManager = ViewManager;
exports.createUid = createUid;

@@ -1211,0 +1243,0 @@ exports.destroyApp = destroyApp;

{
"name": "infrontjs",
"version": "0.3.0",
"version": "0.5.0",
"description": "The progressive frontend framework.",
"main": "src/IF.js",
"scripts": {
"build" : "rollup -c",
"build": "rollup -c",
"test": "echo \"Error: no test specified\" && exit 1"

@@ -31,3 +31,6 @@ },

"rollup": "^2.79.0"
},
"dependencies": {
"infrontjs": "^0.3.0"
}
}

@@ -1,3 +0,4 @@

import { PropertyObject } from "../base/PropertyObject.js";
import { createUid } from "../util/Functions.js";
import { PropertyObject } from "./PropertyObject.js";
import { createUid, isString } from "../util/Functions.js";
import { version } from "../IF.js";

@@ -11,3 +12,3 @@ import { Router } from "./Router.js";

// Global app pool
const apps = [];
const apps = {};

@@ -21,2 +22,3 @@ const DEFAULT_PROPS = {

const DEFAULT_SETTINGS = {
"sayHello" : true,
"l18n" : {

@@ -51,2 +53,8 @@ "defaultLanguage" : "en"

// If container property is a string, check if it is a querySelector
if ( isString( this.container ) )
{
this.container = document.querySelector( this.container );
}
if ( !this.container || false === this.container instanceof HTMLElement )

@@ -66,2 +74,7 @@ {

apps[ this.uid ] = this;
if ( true === this.settings.sayHello && console )
{
console && console.log( "%c»InfrontJS« Version " + version, "font-family: monospace sans-serif; background-color: black; color: white;" );
}
}

@@ -109,12 +122,11 @@

function getApp( uid = '' )
function getApp( uid = null )
{
if ( uid )
if ( uid && apps.hasOwnProperty( uid ) )
{
uid = '' + uid;
return apps.find( app => app.uid === uid );
return apps[ uid ];
}
else if ( apps.length > 0 )
else if ( null === uid && Object.keys( apps ) > 0 )
{
return apps[ 0 ];
return apps[ Object.keys( apps )[ 0 ] ];
}

@@ -125,3 +137,2 @@ else

}
}

@@ -149,3 +160,3 @@

{
console.warn( `App with UID ${uid} not found.` );
console && console.warn( `App with UID ${uid} not found.` );
}

@@ -152,0 +163,0 @@ }

import { trim, isClass, isClassChildOf } from "../util/Functions.js";
import { UrlPattern } from "../util/UrlPattern.js";
import { RouteParams } from "../util/RouteParams.js";
import { State } from "./../base/State.js";
import { State } from "./State.js";

@@ -138,3 +138,3 @@ class Router

{
console.error( e );
console && console.error( e );
// Uncatched error

@@ -141,0 +141,0 @@ }

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

import { isClass, isClassChildOf } from "../util/Functions.js";
import { State } from "../base/State.js";
import { isClass, isClassChildOf, isString } from "../util/Functions.js";
import { State } from "./State.js";

@@ -11,3 +11,2 @@ class StateManager

this.currentState = null;
this.pathToStateFolder = this.app.settings.getPropertyValue( 'stateManager.rootPath' );
}

@@ -22,6 +21,14 @@

if ( false === this._states.hasOwnProperty( stateClass.ID ) )
// Throw an error if ID is null or already taken
if ( false === isString( stateClass.ID ) )
{
this._states[ stateClass.ID ] = stateClass;
throw new Error( 'Given stateClass does not have a valid static ID' );
}
if ( true === this._states.hasOwnProperty( stateClass.ID ) )
{
throw new Error( 'stateClass.ID already exists in states pool.' );
}
this._states[ stateClass.ID ] = stateClass;
}

@@ -45,4 +52,11 @@

{
// @todo Think about how to handle this
return false;
const redirectTo = newState.getRedirectTo();
if ( redirectTo )
{
this.app.router.redirect( redirectTo );
}
else
{
throw Error( 'Forbidden to enter new state:' + newState.ID );
}
}

@@ -49,0 +63,0 @@

@@ -51,4 +51,9 @@ function _template( html, data )

async fetchTemplate( templateUrl, useCache = true )
getHtml( tmpl, data = {} )
{
return _template( tmpl, data );
}
async get( templateUrl, useCache = true )
{
let tmplHtml = useCache ? this._getTemplateFromCache( templateUrl ) : null;

@@ -68,19 +73,4 @@ if ( !tmplHtml )

}
compileTemplate( tmpl, data = {} )
{
return _template( tmpl, data );
}
async renderTemplate( templateUrl, data = {}, containerElement = null )
{
let tmpl = await this.fetchTemplate( templateUrl ),
html = this.compileTemplate( tmpl, data );
this.app.viewManager.render( html, containerElement );
return html;
}
}
export { TemplateManager };

@@ -1,18 +0,16 @@

export const version = "0.3.0";
export const version = "0.4.0";
// Base
import { Api } from "./base/Api.js";
import { PropertyObject } from "./base/PropertyObject.js";
import { State } from "./base/State.js";
// Classes
export { Api } from "./core/Api.js";
export { App, destroyApp, getApp } from "./core/App.js";
export { L18n } from "./core/L18n.js";
export { PropertyObject } from "./core/PropertyObject.js";
export { Router } from "./core/Router.js";
export { State } from "./core/State.js";
export { StateManager } from "./core/StateManager.js";
export { TemplateManager } from "./core/TemplateManager.js";
export { ViewManager } from "./core/ViewManager.js";
export { Api, PropertyObject, State };
// global functions
export { trim, createUid, isPlainObject, isClass, isClassChildOf } from "./util/Functions.js";
// Core
export { App, destroyApp, getApp } from "./core/App.js";
// Marketing ;-)
console.log( "%c»InfrontJS« Version " + version, "font-family: monospace sans-serif; background-color: black; color: white;" );

@@ -29,2 +29,13 @@ /**

/**
* Checks if given value is string
*
* @param {*} v Value to check
* @returns {boolean}
*/
function isString( v )
{
return ( typeof v === 'string' || v instanceof String );
}
/**
* Checks if given value is a class constructor

@@ -125,2 +136,2 @@ * Refer:

export { trim, createUid, isPlainObject, isClass, isClassChildOf };
export { trim, createUid, isPlainObject, isString, isClass, isClassChildOf };
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