jails-js 6.0.1-beta.9 → 6.0.2
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/dist/index.js +553 -610
- package/dist/index.js.map +1 -1
- package/dist/jails.js +1 -1
- package/dist/jails.js.map +1 -1
- package/package.json +11 -3
- package/readme.md +7 -14
- package/src/component.ts +20 -14
- package/src/element.ts +4 -2
- package/src/index.ts +1 -0
- package/tsconfig.json +3 -0
- package/types.d.ts +47 -0
- /package/{html.js → html.mjs} +0 -0
package/src/element.ts
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
import { Component } from './component'
|
2
2
|
|
3
|
+
const register = new WeakMap()
|
4
|
+
|
3
5
|
export const Element = ({ component, templates, start }) => {
|
4
6
|
|
5
7
|
const { name, module, dependencies } = component
|
@@ -24,7 +26,8 @@ export const Element = ({ component, templates, start }) => {
|
|
24
26
|
module,
|
25
27
|
dependencies,
|
26
28
|
templates,
|
27
|
-
signal: this.abortController.signal
|
29
|
+
signal: this.abortController.signal,
|
30
|
+
register
|
28
31
|
})
|
29
32
|
|
30
33
|
if ( rtrn && rtrn.constructor === Promise ) {
|
@@ -39,7 +42,6 @@ export const Element = ({ component, templates, start }) => {
|
|
39
42
|
disconnectedCallback() {
|
40
43
|
this.dispatchEvent( new CustomEvent(':unmount') )
|
41
44
|
this.abortController.abort()
|
42
|
-
delete this.base
|
43
45
|
}
|
44
46
|
}
|
45
47
|
}
|
package/src/index.ts
CHANGED
package/tsconfig.json
CHANGED
package/types.d.ts
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
type EventCallback = ( Event: Event, data?:any ) => void
|
2
|
+
|
3
|
+
export declare const templateConfig: (options: any) => void;
|
4
|
+
export declare const register: (name: string, module: Module, dependencies?: any) => void
|
5
|
+
export declare const start: (target?: HTMLElement) => void;
|
6
|
+
export declare const subscribe:( subject: string, callback: (data:any) => void ) => Function
|
7
|
+
export declare const publish: ( subject: string, data :any ) => void
|
8
|
+
|
9
|
+
export type Component = {
|
10
|
+
|
11
|
+
elm: HTMLElement
|
12
|
+
dependencies: any
|
13
|
+
|
14
|
+
state : {
|
15
|
+
protected( props: Array<string> ): Array<string>
|
16
|
+
set( data: object ) : Promise<any>
|
17
|
+
set( callback: ( state: object ) => any ) : Promise<any>
|
18
|
+
get() : object
|
19
|
+
getRaw() : object
|
20
|
+
}
|
21
|
+
|
22
|
+
main( mainArgs: ( t: Component ) => void ): void
|
23
|
+
|
24
|
+
publish( name: string, value: any ) : void
|
25
|
+
|
26
|
+
subscribe( name: string, value: Function ) : Function
|
27
|
+
|
28
|
+
unmount( callback: () => void ) : void
|
29
|
+
|
30
|
+
on( eventName: string, selector: string | EventCallback, callback?: EventCallback ): void
|
31
|
+
|
32
|
+
emit( eventName: string, data: any ) : void
|
33
|
+
|
34
|
+
off( eventName: string, callback: () => void ): void
|
35
|
+
|
36
|
+
trigger( eventName: string, selector :string, data: any ): void
|
37
|
+
|
38
|
+
innerHTML( target: HTMLElement | string, html?: string ) : void
|
39
|
+
}
|
40
|
+
|
41
|
+
export type Model = {
|
42
|
+
[key: string] : object
|
43
|
+
}
|
44
|
+
|
45
|
+
export type View = ( state: object ) => object
|
46
|
+
|
47
|
+
export type Template = ({ elm: HTMLElement, children: string }) => string
|
/package/{html.js → html.mjs}
RENAMED
File without changes
|