hyperapplicable
Advanced tools
Comparing version 0.11.1 to 0.11.2
import { Action, Effect, Dispatchable, MaybeVNode, CustomPayloads, Dispatch, Unsubscribe, VNode, ClassProp } from 'hyperapp'; | ||
declare type Debounce<S> = { | ||
type Debounce<S> = { | ||
action: Action<S>; | ||
@@ -8,26 +8,26 @@ delay: number; | ||
}; | ||
declare const debounce: <S>(action: Action<S, any>, delay: number, payload?: unknown) => Effect<S, Debounce<S>>; | ||
declare const debounce: <S>(action: Action<S>, delay: number, payload?: unknown) => Effect<S, Debounce<S>>; | ||
declare const log: <S>(x: unknown) => Effect<S, any>; | ||
declare const log: <S>(x: unknown) => Effect<S>; | ||
declare const next: <S>(x: Dispatchable<S, any>) => Effect<S, any>; | ||
declare const next: <S>(x: Dispatchable<S>) => Effect<S>; | ||
declare const nextFrame: <S>(f: Function, ...args: any[]) => Effect<S, any>; | ||
declare const nextFrame: <S>(f: Function, ...args: any[]) => Effect<S>; | ||
declare type ActionWithPayload<S, P = any> = [action: Action<S, P>, payload: P]; | ||
declare type Content<S> = number | string | MaybeVNode<S>; | ||
declare type CustomProps<T, S, P> = CustomPayloads<S, P> & T; | ||
declare type Effecter<S, P> = (dispatch: Dispatch<S>, payload: P) => void | Promise<void>; | ||
declare type MaybeView<S> = (state: S) => MaybeVNode<S>; | ||
declare type Reaction<S, P = any> = Action<S, P> | ActionWithPayload<S, P>; | ||
declare type StateFormat<S, P = any> = S | StateWithEffects<S, P>; | ||
declare type StateWithEffects<S, P = any> = [state: S, ...effects: Effect<S, P>[]]; | ||
declare type Subscriber<S, P> = (dispatch: Dispatch<S>, payload: P) => void | Unsubscribe; | ||
declare type Transform<S, P = any> = (state: S, payload?: P) => StateFormat<S, P>; | ||
declare type View<S> = (state: S) => VNode<S>; | ||
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>[]; | ||
type ActionWithPayload<S, P = any> = [action: Action<S, P>, payload: P]; | ||
type Content<S> = number | string | MaybeVNode<S>; | ||
type CustomProps<T, S, P> = CustomPayloads<S, P> & T; | ||
type Effecter<S, P> = (dispatch: Dispatch<S>, payload: P) => void | Promise<void>; | ||
type MaybeView<S> = (state: S) => MaybeVNode<S>; | ||
type Reaction<S, P = any> = Action<S, P> | ActionWithPayload<S, P>; | ||
type StateFormat<S, P = any> = S | StateWithEffects<S, P>; | ||
type StateWithEffects<S, P = any> = [state: S, ...effects: Effect<S, P>[]]; | ||
type Subscriber<S, P> = (dispatch: Dispatch<S>, payload: P) => void | Unsubscribe; | ||
type Transform<S, P = any> = (state: S, payload?: P) => StateFormat<S, P>; | ||
type View<S> = (state: S) => VNode<S>; | ||
type ViewComponent<S, P> = <X>(props: CustomPayloads<S, X> & P, content: MaybeVNode<S>[]) => MaybeVNode<S>; | ||
type Vista<S> = Content<S> | VistaView<S> | Vista<S>[]; | ||
type VistaView<S> = (state: S) => MaybeVNode<S> | MaybeVNode<S>[]; | ||
declare const unite: <S>(stateForm: StateFormat<S, any>, ...transforms: Transform<S, any>[]) => StateFormat<S, any>; | ||
declare const unite: <S>(stateForm: StateFormat<S>, ...transforms: Transform<S>[]) => StateFormat<S>; | ||
@@ -34,0 +34,0 @@ declare const box: <S>(classProp: ClassProp, contents: MaybeVNode<S> | MaybeVNode<S>[]) => VNode<S>; |
@@ -1,1 +0,1 @@ | ||
(function(o,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("hyperapp")):typeof define=="function"&&define.amd?define(["exports","hyperapp"],r):(o=typeof globalThis<"u"?globalThis:o||self,r(o.hyperapplicable={},o.Hyperapp))})(this,function(o,r){"use strict";const d=(t,e,n)=>[m,{action:t,delay:e,payload:n}];let a;const m=(t,e)=>{clearTimeout(a),a=setTimeout(()=>window.requestAnimationFrame(()=>t(e.action,e.payload)),e.delay)},A=t=>[b,t],b=(t,e)=>{window.requestAnimationFrame(()=>console.log(e))},g=t=>[h,t],h=(t,e)=>{window.requestAnimationFrame(()=>t(e))},F=(t,...e)=>[S,{f:t,args:e}],S=(t,e)=>{window.requestAnimationFrame(()=>{const n=e.f(...e.args);if(n instanceof Error)throw n;t(i=>n==null?i:n)})},V=(t,...e)=>{let n=t;for(let i=0;i<e.length;++i){const y=e[i];if(!Array.isArray(n))n=y(n);else{const[j,...l]=n,s=y(j);if(!Array.isArray(s))n=[s,...l];else{const[w,...D]=s;n=[w,...l,...D]}}}return n},p=(t,e)=>r.h("div",{class:t},e),q=(t,e)=>typeof e=="function"?"function":e,N=t=>e=>r.h("pre",{},r.text(`${t}: ${JSON.stringify(e[t],q,2)}`)),c=t=>e=>{if(typeof t=="function"){const n=t(e);return Array.isArray(n)?n:[n]}return typeof t=="number"||typeof t=="string"?[r.text(t)]:[t]},T=t=>t==null||typeof t=="boolean"||typeof t=="function"||typeof t=="number"||typeof t=="string"||Array.isArray(t)||u(t),u=t=>typeof t=="object"&&t!=null&&"node"in t,f=t=>e=>Array.isArray(t)?t.reduce((n,i)=>[...n,...Array.isArray(i)?f(i)(e):c(i)(e)],[]):c(t)(e),_=t=>typeof t=="function"||Array.isArray(t)&&t.length>0;o.box=p,o.contentView=c,o.debounce=d,o.isAction=_,o.isVNode=u,o.isVista=T,o.log=A,o.next=g,o.nextFrame=F,o.readout=N,o.unite=V,o.vista=f,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
(function(o,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("hyperapp")):typeof define=="function"&&define.amd?define(["exports","hyperapp"],i):(o=typeof globalThis<"u"?globalThis:o||self,i(o.hyperapplicable={},o.Hyperapp))})(this,function(o,i){"use strict";let a;const l=(t,n,e)=>[m,{action:t,delay:n,payload:e}],m=(t,n)=>{clearTimeout(a),a=setTimeout(()=>window.requestAnimationFrame(()=>t(n.action,n.payload)),n.delay)},A=t=>[b,t],b=(t,n)=>{window.requestAnimationFrame(()=>console.log(n))},g=t=>[h,t],h=(t,n)=>{window.requestAnimationFrame(()=>t(n))},F=(t,...n)=>[S,{f:t,args:n}],S=(t,n)=>{window.requestAnimationFrame(async()=>{const e=await n.f(...n.args);if(e instanceof Error)throw e;t(r=>e??r)})},V=(t,...n)=>{let e=t;for(let r=0;r<n.length;++r){const y=n[r];if(!Array.isArray(e))e=y(e);else{const[j,...d]=e,s=y(j);if(!Array.isArray(s))e=[s,...d];else{const[D,...E]=s;e=[D,...d,...E]}}}return e},p=(t,n)=>i.h("div",{class:t},n),q=t=>n=>i.h("pre",{},i.text(`${t}: ${JSON.stringify(n[t],N,2)}`)),N=(t,n)=>typeof n=="function"?"function":n,c=t=>n=>{if(typeof t=="function"){const e=t(n);return Array.isArray(e)?e:[e]}return typeof t=="number"||typeof t=="string"?[i.text(t)]:[t]},T=t=>t==null||typeof t=="boolean"||typeof t=="function"||typeof t=="number"||typeof t=="string"||Array.isArray(t)||u(t),u=t=>typeof t=="object"&&t!=null&&"node"in t,f=t=>n=>Array.isArray(t)?t.reduce((e,r)=>[...e,...Array.isArray(r)?f(r)(n):c(r)(n)],[]):c(t)(n),w=t=>typeof t=="function"||Array.isArray(t)&&t.length>0;o.box=p,o.contentView=c,o.debounce=l,o.isAction=w,o.isVNode=u,o.isVista=T,o.log=A,o.next=g,o.nextFrame=F,o.readout=q,o.unite=V,o.vista=f,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})}); |
{ | ||
"name": "hyperapplicable", | ||
"version": "0.11.1", | ||
"version": "0.11.2", | ||
"description": "A utility library for Hyperapp.", | ||
@@ -50,14 +50,14 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/jest": "^29.1.2", | ||
"@typescript-eslint/eslint-plugin": "^5.40.0", | ||
"@typescript-eslint/parser": "^5.40.0", | ||
"eslint": "^8.25.0", | ||
"fast-check": "^3.2.0", | ||
"jest": "^29.1.2", | ||
"rollup": "^3.0.0", | ||
"terser": "^5.15.1", | ||
"ts-jest": "^29.0.3", | ||
"tsup": "^6.2.3", | ||
"typescript": "^4.8.4", | ||
"vite": "^3.1.7" | ||
"@types/jest": "^29.5.1", | ||
"@typescript-eslint/eslint-plugin": "^5.59.1", | ||
"@typescript-eslint/parser": "^5.59.1", | ||
"eslint": "^8.39.0", | ||
"fast-check": "^3.8.1", | ||
"jest": "^29.5.0", | ||
"rollup": "^3.21.2", | ||
"terser": "^5.17.1", | ||
"ts-jest": "^29.1.0", | ||
"tsup": "^6.7.0", | ||
"typescript": "^5.0.4", | ||
"vite": "^4.3.3" | ||
}, | ||
@@ -64,0 +64,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8971
101