jails-js 5.0.0-beta.2 → 5.0.0-beta.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,39 +1,44 @@
1
1
  {
2
- "name": "jails-js",
3
- "version": "5.0.0-beta.2",
4
- "description": "A Modern Javascript Library",
5
- "main": "dist/jails.js",
6
- "scripts": {
7
- "start": "webpack --watch --mode=development",
8
- "build": "webpack --mode=production",
9
- "test": "echo \"Error: no test specified\" && exit 1"
10
- },
11
- "repository": {
12
- "type": "git",
13
- "url": "https://github.com/jails-org/Jails.git"
14
- },
15
- "keywords": [
16
- "Jails",
17
- "Javascript",
18
- "Component",
19
- "Micro-Library"
20
- ],
21
- "author": "javiani",
22
- "license": "MIT",
23
- "bugs": {
24
- "url": "https://github.com/jails-org/Jails/issues"
25
- },
26
- "homepage": "https://github.com/jails-org/Jails",
27
- "devDependencies": {
28
- "@babel/core": "^7.2.2",
29
- "@babel/preset-env": "^7.2.3",
30
- "babel-loader": "^8.0.5",
31
- "babel-preset-env": "^1.7.0",
32
- "webpack": "^5.59.1",
33
- "webpack-cli": "^3.2.1"
34
- },
35
- "dependencies": {
36
- "morphdom": "^2.6.1",
37
- "sodajs": "^0.4.10"
38
- }
2
+ "name": "jails-js",
3
+ "version": "5.0.0-beta.22",
4
+ "description": "Jails | A Functional Component Library",
5
+ "main": "dist/index.js",
6
+ "types": "types/index.d.ts",
7
+ "scripts": {
8
+ "start": "webpack --watch --mode=development",
9
+ "build": "webpack --mode=production",
10
+ "publish-beta": "yarn build && npm version prerelease --preid=beta && npm publish --tag beta",
11
+ "test": "echo \"Error: no test specified\" && exit 1"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/jails-org/Jails.git"
16
+ },
17
+ "keywords": [
18
+ "Jails",
19
+ "Javascript",
20
+ "Component",
21
+ "Micro-Library"
22
+ ],
23
+ "author": "javiani",
24
+ "license": "MIT",
25
+ "bugs": {
26
+ "url": "https://github.com/jails-org/Jails/issues"
27
+ },
28
+ "homepage": "https://github.com/jails-org/Jails",
29
+ "devDependencies": {
30
+ "@babel/core": "^7.2.2",
31
+ "@babel/preset-env": "^7.2.3",
32
+ "babel-loader": "^8.0.5",
33
+ "babel-plugin-transform-custom-element-classes": "^0.1.0",
34
+ "babel-preset-env": "^1.7.0",
35
+ "ts-loader": "^9.2.6",
36
+ "typescript": "^4.5.4",
37
+ "webpack": "^5.59.1",
38
+ "webpack-cli": "^3.2.1"
39
+ },
40
+ "dependencies": {
41
+ "morphdom": "^2.6.1",
42
+ "squirrelly": "^8.0.8"
43
+ }
39
44
  }
@@ -0,0 +1,147 @@
1
+ import morphdom from 'morphdom'
2
+
3
+ import { rAF, dup, buildtemplates } from './utils'
4
+ import { on, off, trigger } from './utils/events'
5
+ import { publish, subscribe } from './utils/pubsub'
6
+
7
+ export default function Component( elm, { module, dependencies, templates, components }) {
8
+
9
+ const options = getOptions( module )
10
+ buildtemplates( elm, components, templates )
11
+
12
+ const tplid = elm.getAttribute('tplid')
13
+ const template = tplid ? templates[tplid] : null
14
+ const state = { data: module.model ? dup(module.model) : {} }
15
+
16
+ let updates = []
17
+
18
+ const base = {
19
+ template,
20
+ elm,
21
+ dependencies,
22
+ publish,
23
+ subscribe,
24
+
25
+ main(fn) {
26
+ options.main = fn
27
+ },
28
+
29
+ unmount(fn) {
30
+ options.unmount = fn
31
+ },
32
+
33
+ onupdate(fn) {
34
+ options.onupdate = fn
35
+ },
36
+
37
+ on(eventName, selectorOrCallback, callback) {
38
+ on(elm, eventName, selectorOrCallback, callback)
39
+ },
40
+
41
+ off(eventName, callback) {
42
+ off(elm, eventName, callback)
43
+ },
44
+
45
+ trigger(eventName, target, args) {
46
+ if (target.constructor === String) {
47
+ Array
48
+ .from(elm.querySelectorAll(target))
49
+ .forEach( children => trigger(children, eventName, { args: args }) )
50
+ }
51
+ else trigger(elm, eventName, { args: target })
52
+ },
53
+
54
+ emit: ( ...args ) => {
55
+ trigger(elm, args.shift(), { args: args })
56
+ },
57
+
58
+ state: {
59
+ set( data ) {
60
+ if (data.constructor === Function) {
61
+ const newstate = dup(state.data)
62
+ data(newstate)
63
+ base.render(newstate)
64
+ } else {
65
+ base.render(data)
66
+ }
67
+ return new Promise((resolve) => rAF(_ => rAF(resolve)))
68
+ },
69
+ get() {
70
+ return dup(state.data)
71
+ }
72
+ },
73
+
74
+ render(data = state.data) {
75
+
76
+ if (!document.body.contains(elm)) {
77
+ return
78
+ }
79
+
80
+ state.data = Object.assign(state.data, data)
81
+
82
+ const newdata = dup(state.data)
83
+ const newhtml = base.template(options.view(newdata))
84
+
85
+ morphdom(elm, newhtml, morphdomOptions(elm, options))
86
+
87
+ rAF(_ => {
88
+ Array
89
+ .from(elm.querySelectorAll('[tplid]'))
90
+ .forEach((child: any) => {
91
+ child.options.onupdate(newdata)
92
+ child.base.render(newdata)
93
+ })
94
+ })
95
+ }
96
+ }
97
+
98
+ return { base, options }
99
+ }
100
+
101
+ const getOptions = (module) => ({
102
+ main: (a) => a,
103
+ unmount: (a) => a,
104
+ onupdate: (a) => a,
105
+ view: module.view ? module.view : (a) => a
106
+ })
107
+
108
+ const morphdomOptions = (_parent, options ) => ({
109
+
110
+ onNodeAdded: onUpdates(_parent, options),
111
+ onElUpdated: onUpdates(_parent, options),
112
+ onBeforeElChildrenUpdated: checkStatic,
113
+ onBeforeElUpdated: checkStatic,
114
+
115
+ getNodeKey(node) {
116
+ if (node.nodeType === 1 && node.getAttribute('tplid'))
117
+ return node.dataset.key || node.getAttribute('tplid')
118
+ return false
119
+ }
120
+ })
121
+
122
+ const checkStatic = (node) => {
123
+ if ('static' in node.dataset || 'html-static' in node.attributes) {
124
+ return false
125
+ }
126
+ }
127
+
128
+ const onUpdates = (_parent, options) => (node) => {
129
+
130
+ if (node.nodeType === 1) {
131
+
132
+ if (node.getAttribute && node.getAttribute('scope')) {
133
+ const json = node.getAttribute('scope')
134
+ const scope = (new Function(`return ${json}`))()
135
+ Array.from(node.querySelectorAll('[tplid]'))
136
+ .map((el) => {
137
+ const data = Object.assign({}, _parent.base.state.get(), scope)
138
+ options.onupdate(data)
139
+ el.base.render(data)
140
+ })
141
+
142
+ node.removeAttribute('scope')
143
+ }
144
+ }
145
+
146
+ return node
147
+ }
package/src/element.ts ADDED
@@ -0,0 +1,52 @@
1
+ import Component from './component'
2
+ import { purge } from './utils'
3
+
4
+ export default function Element(module, dependencies, templates, components) {
5
+
6
+ return class extends HTMLElement {
7
+
8
+ base: any
9
+ options: any
10
+ returns : any
11
+ __events: any
12
+
13
+ constructor() {
14
+
15
+ super()
16
+
17
+ const { base, options } = Component(this, { module, dependencies, templates, components })
18
+
19
+ this.base = base
20
+ this.options = options
21
+ this.returns = module.default(base)
22
+ }
23
+
24
+ connectedCallback() {
25
+ this.base.render()
26
+
27
+ if( this.returns && this.returns.constructor === Promise ) {
28
+ this.returns.then( _ => {
29
+ if( this.base ) {
30
+ this.options.main().forEach(f => f(this.base))
31
+ }
32
+ })
33
+ }else {
34
+ this.options.main().forEach(f => f(this.base))
35
+ }
36
+ }
37
+
38
+ disconnectedCallback() {
39
+ this.options.unmount(this.base)
40
+ if(!document.body.contains(this) ) {
41
+ this.__events = null
42
+ this.base.elm = null
43
+ this.base = null
44
+ purge(this)
45
+ }
46
+ }
47
+
48
+ attributeChangedCallback() {
49
+ //TODO
50
+ }
51
+ }
52
+ }
package/src/index.ts ADDED
@@ -0,0 +1,29 @@
1
+
2
+ import { buildtemplates } from './utils'
3
+ import Element from './element'
4
+
5
+ const templates = {}
6
+ const components = {}
7
+
8
+ export default {
9
+
10
+ register( name:string, module:any, dependencies: object ) {
11
+ components[name] = { name, module, dependencies }
12
+ },
13
+
14
+ start() {
15
+ const body = document.body
16
+ buildtemplates( body, components, templates )
17
+ registerComponents()
18
+ }
19
+ }
20
+
21
+ const registerComponents = () => {
22
+ Object
23
+ .values( components )
24
+ .forEach( (component) => {
25
+ const { name, module, dependencies } = component
26
+ const Base = Element(module, dependencies, templates, components)
27
+ customElements.define(name, Base)
28
+ })
29
+ }
@@ -0,0 +1,86 @@
1
+ import { compile, defaultConfig, filters } from 'squirrelly'
2
+ import { decodeHtmlEntities } from './utils'
3
+
4
+ defaultConfig.tags = ['{', '}']
5
+ defaultConfig.useWith = true
6
+
7
+ export default function templateSystem( element ) {
8
+
9
+ const tree = document.createElement('template')
10
+
11
+ tree.innerHTML = element.outerHTML.replace(/<\/?template[^>]*>/g, '')
12
+
13
+ directives(tree.content)
14
+
15
+ const html = decodeHtmlEntities(
16
+ tree.innerHTML
17
+ .replace(/html-(selected|checked|readonly|disabled|autoplay)=\"(.*)\"/g, `{@if ($2) }$1{/if}`)
18
+ .replace(/html-/g, '')
19
+ )
20
+
21
+ const template = compile(html, defaultConfig)
22
+
23
+ return ( data ) => {
24
+ return template(data, defaultConfig)
25
+ }
26
+ }
27
+
28
+ /**@Directives */
29
+
30
+ const directives = (vdom) => {
31
+
32
+ const nodes = Array
33
+ .from(vdom.querySelectorAll('[html-for],[html-if],[html-foreach]'))
34
+ .reverse()
35
+
36
+ if (nodes.length) {
37
+
38
+ nodes.forEach(( node ) => {
39
+ if (node.getAttribute('html-foreach')) {
40
+ const instruction = node.getAttribute('html-foreach') || ''
41
+ const split = instruction.match(/(.*)\sin\s(.*)/) || ''
42
+ const varname = split[1]
43
+ const object = split[2]
44
+ node.removeAttribute('html-foreach')
45
+ node.setAttribute('scope', `{${varname} | JSON($key, '${varname}')}`)
46
+ const open = document.createTextNode(`{@foreach(${object}) => $key, ${varname}}`)
47
+ const close = document.createTextNode('{/foreach}')
48
+ wrap(open, node, close)
49
+ } else if (node.getAttribute('html-for')) {
50
+ const instruction = node.getAttribute('html-for') || ''
51
+ const split = instruction.match(/(.*)\sin\s(.*)/) || ''
52
+ const varname = split[1]
53
+ const object = split[2]
54
+ node.removeAttribute('html-for')
55
+ node.setAttribute('scope', `{${varname} | JSON($index, '${varname}')}`)
56
+ const open = document.createTextNode(`{@each(${object}) => ${varname}, $index}`)
57
+ const close = document.createTextNode('{/each}')
58
+ wrap(open, node, close)
59
+ } else if (node.getAttribute('html-if')) {
60
+ const instruction = node.getAttribute('html-if')
61
+ node.removeAttribute('html-if')
62
+ const open = document.createTextNode(`{@if (${instruction}) }`)
63
+ const close = document.createTextNode('{/if}')
64
+ wrap(open, node, close)
65
+ }
66
+ })
67
+ }
68
+
69
+ return vdom
70
+ }
71
+
72
+ filters.define('JSON', (scope, index, varname) => {
73
+
74
+ const key = index.constructor == String ? '$key' : '$index'
75
+ const newobject = { $index: index } as any
76
+
77
+ newobject[varname] = scope
78
+ newobject[key] = index
79
+
80
+ return JSON.stringify(newobject)
81
+ })
82
+
83
+ const wrap = (open, node, close) => {
84
+ node.parentNode?.insertBefore(open, node)
85
+ node.parentNode?.insertBefore(close, node.nextSibling)
86
+ }
@@ -41,7 +41,7 @@ const delegate = (node, selector, callback) => {
41
41
  e.delegateTarget = parent
42
42
  callback.apply(element, [e].concat(detail.args))
43
43
  }
44
- if( parent === node ) break
44
+ if (parent === node) break
45
45
  parent = parent.parentNode
46
46
  }
47
47
  }
@@ -0,0 +1,80 @@
1
+ import templateSystem from '../template-system'
2
+
3
+ const textarea = document.createElement('textarea')
4
+
5
+ export const rAF = (fn) => {
6
+ if (requestAnimationFrame)
7
+ return requestAnimationFrame(fn)
8
+ else
9
+ return setTimeout(fn, 1000 / 60)
10
+ }
11
+
12
+ export const uuid = () => {
13
+ return 'xxxxxxxx'.replace(/[xy]/g, (c) => {
14
+ const r = Math.random() * 8 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8)
15
+ return v.toString(8)
16
+ })
17
+ }
18
+
19
+ export const stripTemplateTag = ( element ) => {
20
+ const templates = Array.from(element.querySelectorAll('template'))
21
+ // https://gist.github.com/harmenjanssen/07e425248779c65bc5d11b02fb913274
22
+ templates.forEach((template) => {
23
+ template.parentNode?.replaceChild(template.content, template)
24
+ stripTemplateTag(template.content)
25
+ })
26
+ }
27
+
28
+ export const dup = (o) => {
29
+ return JSON.parse(JSON.stringify(o))
30
+ }
31
+
32
+ export const createTemplateId = (element, templates ) => {
33
+
34
+ const tplid = element.getAttribute('tplid')
35
+
36
+ if (!tplid) {
37
+ const id = uuid()
38
+ element.setAttribute('tplid', id)
39
+ templates[id] = templateSystem(element)
40
+ }
41
+ }
42
+
43
+ export const buildtemplates = ( target, components, templates ) => {
44
+
45
+ return Array
46
+ .from(target.querySelectorAll('*'))
47
+ .filter((node) => node.tagName.toLowerCase() in components)
48
+ .reverse()
49
+ .map((node) => {
50
+ Array.from(node.querySelectorAll('template'))
51
+ .map((template) => buildtemplates(template.content, components, templates))
52
+ createTemplateId(node, templates)
53
+ return node
54
+ })
55
+ }
56
+
57
+ export const decodeHtmlEntities = ( str ) => {
58
+ textarea.innerHTML = str
59
+ return textarea.value
60
+ }
61
+
62
+ // http://crockford.com/javascript/memory/leak.html
63
+ export const purge = (d) => {
64
+ var a = d.attributes, i, l, n
65
+ if (a) {
66
+ for (i = a.length - 1; i >= 0; i -= 1) {
67
+ n = a[i].name
68
+ if (typeof d[n] === 'function') {
69
+ d[n] = null
70
+ }
71
+ }
72
+ }
73
+ a = d.childNodes
74
+ if (a) {
75
+ l = a.length
76
+ for (i = 0; i < l; i += 1) {
77
+ purge(d.childNodes[i])
78
+ }
79
+ }
80
+ }
@@ -0,0 +1,20 @@
1
+ const topics: any = {}
2
+ const _async: any = {}
3
+
4
+ export const publish = (name, params) => {
5
+ _async[name] = Object.assign({}, _async[name], params)
6
+ if (topics[name])
7
+ topics[name].forEach(topic => topic(params))
8
+ }
9
+
10
+ export const subscribe = (name, method) => {
11
+ topics[name] = topics[name] || []
12
+ topics[name].push(method)
13
+ if (name in _async) {
14
+ method(_async[name])
15
+ }
16
+ return () => {
17
+ topics[name] = topics[name].filter( fn => fn != method )
18
+ }
19
+ }
20
+
package/tsconfig.json ADDED
@@ -0,0 +1,106 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig to read more about this file */
4
+
5
+ /* Projects */
6
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
+
13
+ /* Language and Environment */
14
+ "target": "ES2015", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
+ "lib": ["es2015", "dom"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
17
+ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
18
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
20
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
22
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
23
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
26
+
27
+ /* Modules */
28
+ "module":"CommonJS", /* Specify what module code is generated. */
29
+ // "rootDir": "./src", /* Specify the root folder within your source files. */
30
+ "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
31
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
32
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
33
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
34
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
35
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
36
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
37
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
38
+ // "resolveJsonModule": true, /* Enable importing .json files. */
39
+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
40
+
41
+ /* JavaScript Support */
42
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
43
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
44
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
45
+
46
+ /* Emit */
47
+ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
48
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
49
+ "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
50
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
51
+ // "outFile": "types/index.d.ts", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
52
+ "outDir": "types", /* Specify an output folder for all emitted files. */
53
+ // "removeComments": true, /* Disable emitting comments. */
54
+ // "noEmit": true, /* Disable emitting files from a compilation. */
55
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
56
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
57
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
58
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
59
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
60
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
61
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
62
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
63
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
64
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
65
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
66
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
67
+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
68
+ // "declarationDir": "./dist/types", /* Specify the output directory for generated declaration files. */
69
+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
70
+
71
+ /* Interop Constraints */
72
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
73
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
74
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
75
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
76
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
77
+
78
+ /* Type Checking */
79
+ // "strict": true, /* Enable all strict type-checking options. */
80
+ "noImplicitAny": false, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
81
+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
82
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
83
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
84
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
85
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
86
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
87
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
88
+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
89
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
90
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
91
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
92
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
93
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
94
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
95
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
96
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
97
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
98
+
99
+ /* Completeness */
100
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
101
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
102
+ },
103
+ "files": [
104
+ "src/index.ts"
105
+ ]
106
+ }
@@ -0,0 +1,32 @@
1
+ export default function Component(elm: any, { module, dependencies, templates, components }: {
2
+ module: any;
3
+ dependencies: any;
4
+ templates: any;
5
+ components: any;
6
+ }): {
7
+ base: {
8
+ template: any;
9
+ elm: any;
10
+ dependencies: any;
11
+ publish: (name: any, params: any) => void;
12
+ subscribe: (name: any, method: any) => () => void;
13
+ main(fn: any): void;
14
+ unmount(fn: any): void;
15
+ onupdate(fn: any): void;
16
+ on(eventName: any, selectorOrCallback: any, callback: any): void;
17
+ off(eventName: any, callback: any): void;
18
+ trigger(eventName: any, target: any, args: any): void;
19
+ emit: (...args: any[]) => void;
20
+ state: {
21
+ set(data: any): Promise<unknown>;
22
+ get(): any;
23
+ };
24
+ render(data?: any): void;
25
+ };
26
+ options: {
27
+ main: (a: any) => any;
28
+ unmount: (a: any) => any;
29
+ onupdate: (a: any) => any;
30
+ view: any;
31
+ };
32
+ };