forked from thaibault/web-input-material
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
executable file
·62 lines (55 loc) · 2.16 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// #!/usr/bin/env babel-node
// -*- coding: utf-8 -*-
/** @module react-input-material */
'use strict'
/* !
region header
[Project page](https://torben.website/react-material-input)
Copyright Torben Sickert (info["~at~"]torben.website) 16.12.2012
License
-------
This library written by Torben Sickert stand under a creative commons
naming 3.0 unported license.
See https://creativecommons.org/licenses/by/3.0/deed.de
endregion
*/
// region imports
import {Mapping} from 'clientnode/type'
import ReactWeb from 'web-component-wrapper/React'
import {WebComponentAPI} from 'web-component-wrapper/type'
// endregion
export {CircularSpinner} from './components/CircularSpinner'
export {FileInput} from './components/FileInput'
export {GenericAnimate} from './components/GenericAnimate'
export {GenericInput} from './components/GenericInput'
export {GenericInputs} from './components/GenericInputs'
export {GenericInterval} from './components/GenericInterval'
export {RequireableCheckbox} from './components/RequireableCheckbox'
export {SliderInput} from './components/SliderInput'
export {TabBar} from './components/TabBar'
export {TabItem} from './components/TabItem'
export const components:Mapping<WebComponentAPI<typeof ReactWeb>> = {}
/*
Import all react components and extract a dynamically created web-component
class wrapper with corresponding web component register method. A derived
default web component name is provided.
*/
const componentRetriever = require.context('./components', true, /^.+\.ts$/)
componentRetriever.keys().map((name:string):void => {
if (!name.endsWith('.d.ts')) {
const componentAPI:WebComponentAPI<typeof ReactWeb> = (
componentRetriever(name) as
{default:WebComponentAPI<typeof ReactWeb>}
).default
components[componentAPI.component._name] = componentAPI
}
})
export const register = () =>
Object.values(components).map(
(component:WebComponentAPI<typeof ReactWeb>) => component.register()
)
export default components
// region vim modline
// vim: set tabstop=4 shiftwidth=4 expandtab:
// vim: foldmethod=marker foldmarker=region,endregion:
// endregion