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

hyperapplicable

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperapplicable - npm Package Compare versions

Comparing version 0.4.3 to 0.5.0

15

dist/hyperapplicable.d.ts

@@ -1,6 +0,7 @@

import { Action, MaybeVNode, CustomPayloads, Dispatch, Effect, Unsubscribe, ClassProp, VNode, Dispatchable } from 'hyperapp';
import { ClassProp, MaybeVNode, VNode, Action, CustomPayloads, Dispatch, Effect, Unsubscribe, Dispatchable } from 'hyperapp';
declare const box: <S>(classProp: ClassProp, contents: MaybeVNode<S> | MaybeVNode<S>[]) => VNode<S>;
declare type ActionWithPayload<S, P = any> = [action: Action<S, P>, payload: P];
declare type Content<S> = number | string | MaybeVNode<S>;
declare type Contents<S> = Content<S> | View<S> | (Content<S> | View<S>)[];
declare type CustomProps<T, S, P> = CustomPayloads<S, P> & T;

@@ -15,10 +16,10 @@ declare type Effecter<S, P> = (dispatch: Dispatch<S>, payload: P) => void | Promise<void>;

declare type ViewComponent<S, P> = <X>(props: CustomPayloads<S, X> & P, content: MaybeVNode<S>[]) => MaybeVNode<S>;
declare type Vista<S> = Content<S> | VistaView<S> | Vista<S>[];
declare type VistaView<S> = (state: S) => MaybeVNode<S> | MaybeVNode<S>[];
declare const box: <S>(classProp: ClassProp, content: Content<S> | Content<S>[]) => VNode<S>;
declare const contentNode: <S>(x: Content<S>) => MaybeVNode<S>;
declare const contentView: <S>(view: Content<S> | View<S>) => (state: S) => MaybeVNode<S>;
declare const contentView: <S>(view: Content<S> | VistaView<S>) => (state: S) => MaybeVNode<S>[];
declare const isContent: <S>(x: unknown) => x is Content<S>;
declare const isVNode: <S>(x: unknown) => x is VNode<S>;
declare const vista: <S>(views: Contents<S>) => (state: S) => MaybeVNode<S>[];
declare const vista: <S>(views: Vista<S>) => (state: S) => MaybeVNode<S>[];

@@ -35,2 +36,2 @@ declare const handleWith: <S>(handlers: readonly Transform<S, Event>[]) => (state: StateFormat<S, any>, event: Event) => StateFormat<S, any>;

export { ActionWithPayload, Content, Contents, CustomProps, Effecter, Reaction, StateFormat, StateWithEffects, Subscriber, Transform, View, ViewComponent, box, contentNode, contentView, handleWith, isAction, isContent, isVNode, next, readout, unite, vista };
export { ActionWithPayload, Content, CustomProps, Effecter, Reaction, StateFormat, StateWithEffects, Subscriber, Transform, View, ViewComponent, Vista, VistaView, box, contentNode, contentView, handleWith, isAction, isContent, isVNode, next, readout, unite, vista };

@@ -1,11 +0,17 @@

import { text, h } from "hyperapp";
import { h, text } from "hyperapp";
const box = (classProp, contents) => h("div", { class: classProp }, contents);
const contentNode = (x) => typeof x === "number" || typeof x === "string" ? text(x) : x;
const contentView = (view) => (state) => typeof view === "function" ? view(state) : contentNode(view);
const isContent = (x) => typeof x === "number" || typeof x === "string" || x == null || typeof x === "boolean" || isVNode(x);
const contentView = (view) => (state) => {
if (typeof view === "function") {
const x = view(state);
return Array.isArray(x) ? x : [x];
}
return typeof view === "number" || typeof view === "string" ? [text(view)] : [view];
};
const isContent = (x) => x == null || typeof x === "boolean" || typeof x === "number" || typeof x === "string" || isVNode(x);
const isVNode = (x) => x != null && typeof x === "object" && "node" in x;
const vista = (views) => (state) => Array.isArray(views) ? views.map((view) => contentView(view)(state)) : [contentView(views)(state)];
const box = (classProp, content) => {
const stuff = Array.isArray(content) ? content.map(contentNode) : contentNode(content);
return h("div", { class: classProp }, stuff);
};
const vista = (views) => (state) => !Array.isArray(views) ? contentView(views)(state) : views.reduce((nodes, view) => [
...nodes,
...!Array.isArray(view) ? contentView(view)(state) : vista(view)(state)
], []);
const unite = (transform, stateForm, payload) => {

@@ -12,0 +18,0 @@ if (!Array.isArray(stateForm)) {

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

(function(e,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("hyperapp")):typeof define=="function"&&define.amd?define(["exports","hyperapp"],o):(e=typeof globalThis!="undefined"?globalThis:e||self,o(e.hyperapplicable={},e.Hyperapp))})(this,function(e,o){"use strict";const c=t=>typeof t=="number"||typeof t=="string"?o.text(t):t,s=t=>n=>typeof t=="function"?t(n):c(t),a=t=>typeof t=="number"||typeof t=="string"||t==null||typeof t=="boolean"||d(t),d=t=>t!=null&&typeof t=="object"&&"node"in t,l=t=>n=>Array.isArray(t)?t.map(i=>s(i)(n)):[s(t)(n)],A=(t,n)=>{const i=Array.isArray(n)?n.map(c):c(n);return o.h("div",{class:t},i)},y=(t,n,i)=>{if(!Array.isArray(n))return t(n,i);const[f,...r]=n,u=t(f,i);if(!Array.isArray(u))return[u,...r];const[S,...V]=u;return[S,...r,...V]},h=t=>(n,i)=>t.reduce((f,r)=>y(r,f,i),n),p=t=>typeof t=="function"||Array.isArray(t)&&t.length>0,b=(t,n)=>{window.requestAnimationFrame(()=>t(n))},m=t=>[b,t],N=(t,n)=>typeof n=="function"?"function":n,g=t=>n=>o.h("pre",{},o.text(`${t}: ${JSON.stringify(n[t],N,2)}`));e.box=A,e.contentNode=c,e.contentView=s,e.handleWith=h,e.isAction=p,e.isContent=a,e.isVNode=d,e.next=m,e.readout=g,e.unite=y,e.vista=l,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
(function(e,i){typeof exports=="object"&&typeof module!="undefined"?i(exports,require("hyperapp")):typeof define=="function"&&define.amd?define(["exports","hyperapp"],i):(e=typeof globalThis!="undefined"?globalThis:e||self,i(e.hyperapplicable={},e.Hyperapp))})(this,function(e,i){"use strict";const a=(t,n)=>i.h("div",{class:t},n),l=t=>typeof t=="number"||typeof t=="string"?i.text(t):t,u=t=>n=>{if(typeof t=="function"){const o=t(n);return Array.isArray(o)?o:[o]}return typeof t=="number"||typeof t=="string"?[i.text(t)]:[t]},A=t=>t==null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||s(t),s=t=>t!=null&&typeof t=="object"&&"node"in t,y=t=>n=>Array.isArray(t)?t.reduce((o,r)=>[...o,...Array.isArray(r)?y(r)(n):u(r)(n)],[]):u(t)(n),d=(t,n,o)=>{if(!Array.isArray(n))return t(n,o);const[r,...c]=n,f=t(r,o);if(!Array.isArray(f))return[f,...c];const[S,...V]=f;return[S,...c,...V]},b=t=>(n,o)=>t.reduce((r,c)=>d(c,r,o),n),h=t=>typeof t=="function"||Array.isArray(t)&&t.length>0,p=(t,n)=>{window.requestAnimationFrame(()=>t(n))},g=t=>[p,t],m=(t,n)=>typeof n=="function"?"function":n,N=t=>n=>i.h("pre",{},i.text(`${t}: ${JSON.stringify(n[t],m,2)}`));e.box=a,e.contentNode=l,e.contentView=u,e.handleWith=b,e.isAction=h,e.isContent=A,e.isVNode=s,e.next=g,e.readout=N,e.unite=d,e.vista=y,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
{
"name": "hyperapplicable",
"version": "0.4.3",
"version": "0.5.0",
"description": "A utility library for Hyperapp.",

@@ -5,0 +5,0 @@ "keywords": [

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