This commit is contained in:
streamich 2018-10-28 14:30:17 +01:00
commit e5bb81ddb4
74 changed files with 373 additions and 0 deletions

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

27
iframe.html Normal file
View File

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta content="IE=edge" http-equiv="X-UA-Compatible" />
<base target="_parent">
<script>
if (window.parent !== window) {
try {
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
} catch (error) {
// The above line can throw if we do not have access to the parent frame -- i.e. cross origin
}
}
</script>
<title>Storybook</title>
</head>
<body>
<div id="root"></div>
<div id="error-display"></div>
<script type="text/javascript" src="static/preview.cb674882f5d15f3c20f2.bundle.js"></script></body>
</html>

44
index.html Normal file
View File

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="storybook-version" content="3.4.11">
<meta content="IE=edge" http-equiv="X-UA-Compatible" />
<title>Storybook</title>
<style>
/*
When resizing panels, the drag event breaks if the cursor
moves over the iframe. Add the 'dragging' class to the body
at drag start and remove it when the drag ends.
*/
.dragging iframe {
pointer-events: none;
}
/* Styling the fuzzy search box placeholders */
.searchBox::-webkit-input-placeholder { /* Chrome/Opera/Safari */
color: #ddd;
font-size: 16px;
}
.searchBox::-moz-placeholder { /* Firefox 19+ */
color: #ddd;
font-size: 16px;
}
.searchBox:focus{
border-color: #EEE !important;
}
.btn:hover{
background-color: #eee
}
</style>
</head>
<body style="margin: 0;">
<div id="root"></div>
<script type="text/javascript" src="static/manager.e73f75df73342cfc75a0.bundle.js"></script></body>
</html>

1
lib/__stories__/useAsync.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useAudio.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useBattery.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useCounter.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useCss.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useFavicon.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useHover.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useIdle.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useList.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useLogger.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useMap.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useMedia.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useMotion.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useMount.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useNetwork.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useRaf.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useSize.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useSpeech.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useSpring.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useTimeout.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useTitle.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useToggle.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useTween.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

1
lib/__stories__/useUnmount.story.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1 @@
export {};

7
lib/createRouter.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
export interface RouterProviderProps {
route: string;
fullRoute?: string;
parent?: any;
}
declare const createRouter: () => void;
export default createRouter;

33
lib/index.d.ts vendored Normal file
View File

@ -0,0 +1,33 @@
import useAsync from './useAsync';
import useAudio from './useAudio';
import useBattery from './useBattery';
import useCounter from './useCounter';
import useCss from './useCss';
import useFavicon from './useFavicon';
import useGeolocation from './useGeolocation';
import useHover from './useHover';
import useIdle from './useIdle';
import useLifecycles from './useLifecycles';
import useList from './useList';
import useLocalStorage from './useLocalStorage';
import useLocation from './useLocation';
import useLogger from './useLogger';
import useMap from './useMap';
import useMedia from './useMedia';
import useMediaDevices from './useMediaDevices';
import useMotion from './useMotion';
import useMount from './useMount';
import useNetwork from './useNetwork';
import useOrientation from './useOrientation';
import useRaf from './useRaf';
import useSetState from './useSetState';
import useSize from './useSize';
import useSpeech from './useSpeech';
import useSpring from './useSpring';
import useTimeout from './useTimeout';
import useTitle from './useTitle';
import useToggle from './useToggle';
import useTween from './useTween';
import useUnmount from './useUnmount';
import useWindowSize from './useWindowSize';
export { useAsync, useAudio, useBattery, useCounter, useCss, useFavicon, useGeolocation, useHover, useIdle, useLifecycles, useList, useLocalStorage, useLocation, useLogger, useMap, useMedia, useMediaDevices, useMotion, useMount, useNetwork, useOrientation, useRaf, useSetState, useSize, useSpeech, useSpring, useTimeout, useTitle, useToggle, useTween, useUnmount, useWindowSize, };

13
lib/react.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
export declare type UseState = <T>(initialState: T) => [T, (newState: T) => void];
export declare const useState: UseState;
export declare type UseEffect = (didUpdate: () => ((() => void) | void), params?: any[]) => void;
export declare const useEffect: UseEffect;
export interface ReactRef<T> {
current: T;
}
export declare type UseRef = <T>(initialValue: T) => ReactRef<T>;
export declare const useRef: UseRef;
export declare type UseCallback = <T extends ((...args: any[]) => any)>(callback: T, args: any[]) => T;
export declare const useCallback: UseCallback;
export declare type UseMemo = <T>(fn: Function, args: any[]) => T;
export declare const useMemo: UseMemo;

7
lib/useAsync.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
export interface AsyncState<T> {
loading: boolean;
error?: Error | any;
value?: T;
}
declare const useAsync: <T>(fn: () => Promise<T>, args?: any) => AsyncState<T>;
export default useAsync;

23
lib/useAudio.d.ts vendored Normal file
View File

@ -0,0 +1,23 @@
import * as React from 'react';
import { ReactRef } from './react';
export interface AudioProps extends React.AudioHTMLAttributes<any> {
src: string;
}
export interface AudioState {
buffered: any[];
duration: number;
isPlaying: boolean;
muted: boolean;
time: number;
volume: number;
}
export interface AudioControls {
play: () => Promise<void> | void;
pause: () => void;
mute: () => void;
unmute: () => void;
volume: (volume: number) => void;
seek: (time: number) => void;
}
declare const useAudio: (props: AudioProps) => [React.ReactElement<AudioProps>, AudioState, AudioControls, ReactRef<HTMLAudioElement | null>];
export default useAudio;

8
lib/useBattery.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
export interface BatterySensorState {
charging: boolean;
level: number;
chargingTime: number;
dischargingTime: number;
}
declare const useBattery: () => {};
export default useBattery;

4
lib/useCounter.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
export declare type Increment = (inc?: number) => void;
export declare type Set = (value: number) => void;
declare const useCounter: (initialValue?: number) => [number, Increment, Set];
export default useCounter;

7
lib/useCss.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
export interface CssPipe {
className: string;
css: (css: object) => void;
remove: () => void;
}
declare const useCss: (css: object) => string;
export default useCss;

2
lib/useFavicon.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare const useFavicon: (href: string) => void;
export default useFavicon;

21
lib/useGeolocation.d.ts vendored Normal file
View File

@ -0,0 +1,21 @@
export interface GeoLocationSensorState {
accuracy: number;
altitude: number;
altitudeAccuracy: number;
heading: number;
latitude: number;
longitude: number;
speed: number;
timestamp: number;
}
declare const useGeolocation: () => {
accuracy: null;
altitude: null;
altitudeAccuracy: null;
heading: null;
latitude: null;
longitude: null;
speed: null;
timestamp: number;
};
export default useGeolocation;

4
lib/useHover.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import * as React from 'react';
export declare type Element = ((state: boolean) => React.ReactElement<any>) | React.ReactElement<any>;
declare const useHover: (element: Element) => [React.ReactElement<any>, boolean];
export default useHover;

2
lib/useIdle.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare const useIdle: (ms?: number, initialState?: boolean, events?: string[]) => boolean;
export default useIdle;

2
lib/useLifecycles.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare const useLifecycles: (mount: any, unmount?: any) => void;
export default useLifecycles;

8
lib/useList.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
export interface Actions<T> {
set: (list: T[]) => void;
push: (item: T) => void;
filter: (fn: (value: T) => boolean) => void;
sort: (fn?: (a: T, b: T) => number) => void;
}
declare const useList: <T>(initialList?: T[]) => [T[], Actions<T>];
export default useList;

2
lib/useLocalStorage.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare const useLocalStorage: (key: string) => string | undefined;
export default useLocalStorage;

16
lib/useLocation.d.ts vendored Normal file
View File

@ -0,0 +1,16 @@
export interface LocationSensorState {
trigger: string;
state?: any;
length?: number;
hash?: string;
host?: string;
hostname?: string;
href?: string;
origin?: string;
pathname?: string;
port?: string;
protocol?: string;
search?: string;
}
declare const useLocation: () => LocationSensorState;
export default useLocation;

2
lib/useLogger.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare const useLogger: (name: any, props: any) => void;
export default useLogger;

10
lib/useMap.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
export interface Actions<K, V> {
get: (key: K) => any;
set: (key: K, value: V) => void;
remove: (key: K) => void;
reset: () => void;
}
declare const useMap: <T extends {
[key: string]: any;
}>(initialMap?: any) => [T, Actions<string, any>];
export default useMap;

2
lib/useMedia.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare const useMedia: (query: string, defaultState?: boolean) => boolean;
export default useMedia;

2
lib/useMediaDevices.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare const useMediaDevices: () => {};
export default useMediaDevices;

20
lib/useMotion.d.ts vendored Normal file
View File

@ -0,0 +1,20 @@
export interface MotionSensorState {
acceleration: {
x: number | null;
y: number | null;
z: number | null;
};
accelerationIncludingGravity: {
x: number | null;
y: number | null;
z: number | null;
};
rotationRate: {
alpha: number | null;
beta: number | null;
gamma: number | null;
};
interval: number | null;
}
declare const useMotion: (initialState?: MotionSensorState) => MotionSensorState;
export default useMotion;

2
lib/useMount.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare const useMount: (mount: any) => void;
export default useMount;

11
lib/useNetwork.d.ts vendored Normal file
View File

@ -0,0 +1,11 @@
export interface NetworkState {
online?: boolean;
since?: Date;
downlink?: number;
downlinkMax?: number;
effectiveType?: string;
rtt?: number;
type?: string;
}
declare const useNetwork: (initialState?: NetworkState) => NetworkState;
export default useNetwork;

6
lib/useOrientation.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
export interface OrientationState {
angle: number;
type: string;
}
declare const useOrientation: (initialState?: OrientationState) => OrientationState;
export default useOrientation;

2
lib/useRaf.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare const useRaf: (ms?: number, delay?: number) => number;
export default useRaf;

2
lib/useSetState.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare const useSetState: <T extends object>(initialState?: T) => [T, (patch: Partial<T>) => void];
export default useSetState;

8
lib/useSize.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
import * as React from 'react';
export declare type Element = ((state: State) => React.ReactElement<any>) | React.ReactElement<any>;
export interface State {
width: number;
height: number;
}
declare const useSize: (element: Element, { width, height }?: Partial<State>) => [React.ReactElement<any>, State];
export default useSize;

13
lib/useSpeech.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
export interface SpeechState {
isPlaying: boolean;
volume: number;
}
export interface SpeechOptions {
lang?: any;
pitch?: number;
rate?: number;
voice?: any;
volume?: number;
}
declare const useSpeech: (text: string, opts?: SpeechOptions) => SpeechState;
export default useSpeech;

2
lib/useSpring.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare const useSpring: (targetValue?: number, tension?: number, friction?: number) => number;
export default useSpring;

2
lib/useTimeout.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare const useTimeout: (ms?: number) => boolean;
export default useTimeout;

2
lib/useTitle.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare const useTitle: (title: string) => void;
export default useTitle;

5
lib/useToggle.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
export declare type UseToggle = (state: boolean) => [boolean, // state
() => void, // toggle
(state: boolean) => void];
declare const useToggle: UseToggle;
export default useToggle;

3
lib/useTween.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
export declare type Easing = (t: number) => number;
declare const useTween: (easingName?: string, ms?: number, delay?: number) => number;
export default useTween;

2
lib/useUnmount.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare const useUnmount: (unmount: any) => void;
export default useUnmount;

5
lib/useWindowSize.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
declare const useWindowSize: (initialWidth?: number, initialHeight?: number) => {
width: number;
height: number;
};
export default useWindowSize;

3
lib/util.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
export declare const isClient: boolean;
export declare const on: (obj: any, ...args: any[]) => any;
export declare const off: (obj: any, ...args: any[]) => any;

5
lib/util/parseTimeRanges.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
declare const parseTimeRanges: (ranges: any) => {
start: number;
end: number;
}[];
export default parseTimeRanges;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long