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.
@@ -0,0 +1,311 @@
1
+ export default function Element(module: any, dependencies: any, templates: any, components: any): {
2
+ new (): {
3
+ base: any;
4
+ options: any;
5
+ __events: any;
6
+ connectedCallback(): void;
7
+ disconnectedCallback(): void;
8
+ attributeChangedCallback(): void;
9
+ accessKey: string;
10
+ readonly accessKeyLabel: string;
11
+ autocapitalize: string;
12
+ dir: string;
13
+ draggable: boolean;
14
+ hidden: boolean;
15
+ innerText: string;
16
+ lang: string;
17
+ readonly offsetHeight: number;
18
+ readonly offsetLeft: number;
19
+ readonly offsetParent: Element;
20
+ readonly offsetTop: number;
21
+ readonly offsetWidth: number;
22
+ outerText: string;
23
+ spellcheck: boolean;
24
+ title: string;
25
+ translate: boolean;
26
+ attachInternals(): ElementInternals;
27
+ click(): void;
28
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
29
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
30
+ removeEventListener<K_1 extends keyof HTMLElementEventMap>(type: K_1, listener: (this: HTMLElement, ev: HTMLElementEventMap[K_1]) => any, options?: boolean | EventListenerOptions): void;
31
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
32
+ readonly attributes: NamedNodeMap;
33
+ readonly classList: DOMTokenList;
34
+ className: string;
35
+ readonly clientHeight: number;
36
+ readonly clientLeft: number;
37
+ readonly clientTop: number;
38
+ readonly clientWidth: number;
39
+ id: string;
40
+ readonly localName: string;
41
+ readonly namespaceURI: string;
42
+ onfullscreenchange: (this: Element, ev: Event) => any;
43
+ onfullscreenerror: (this: Element, ev: Event) => any;
44
+ outerHTML: string;
45
+ readonly ownerDocument: Document;
46
+ readonly part: DOMTokenList;
47
+ readonly prefix: string;
48
+ readonly scrollHeight: number;
49
+ scrollLeft: number;
50
+ scrollTop: number;
51
+ readonly scrollWidth: number;
52
+ readonly shadowRoot: ShadowRoot;
53
+ slot: string;
54
+ readonly tagName: string;
55
+ attachShadow(init: ShadowRootInit): ShadowRoot;
56
+ closest<K_2 extends keyof HTMLElementTagNameMap>(selector: K_2): HTMLElementTagNameMap[K_2];
57
+ closest<K_3 extends keyof SVGElementTagNameMap>(selector: K_3): SVGElementTagNameMap[K_3];
58
+ closest<E extends Element = Element>(selectors: string): E;
59
+ getAttribute(qualifiedName: string): string;
60
+ getAttributeNS(namespace: string, localName: string): string;
61
+ getAttributeNames(): string[];
62
+ getAttributeNode(qualifiedName: string): Attr;
63
+ getAttributeNodeNS(namespace: string, localName: string): Attr;
64
+ getBoundingClientRect(): DOMRect;
65
+ getClientRects(): DOMRectList;
66
+ getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
67
+ getElementsByTagName<K_4 extends keyof HTMLElementTagNameMap>(qualifiedName: K_4): HTMLCollectionOf<HTMLElementTagNameMap[K_4]>;
68
+ getElementsByTagName<K_5 extends keyof SVGElementTagNameMap>(qualifiedName: K_5): HTMLCollectionOf<SVGElementTagNameMap[K_5]>;
69
+ getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
70
+ getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
71
+ getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
72
+ getElementsByTagNameNS(namespace: string, localName: string): HTMLCollectionOf<Element>;
73
+ hasAttribute(qualifiedName: string): boolean;
74
+ hasAttributeNS(namespace: string, localName: string): boolean;
75
+ hasAttributes(): boolean;
76
+ hasPointerCapture(pointerId: number): boolean;
77
+ insertAdjacentElement(where: InsertPosition, element: Element): Element;
78
+ insertAdjacentHTML(position: InsertPosition, text: string): void;
79
+ insertAdjacentText(where: InsertPosition, data: string): void;
80
+ matches(selectors: string): boolean;
81
+ releasePointerCapture(pointerId: number): void;
82
+ removeAttribute(qualifiedName: string): void;
83
+ removeAttributeNS(namespace: string, localName: string): void;
84
+ removeAttributeNode(attr: Attr): Attr;
85
+ requestFullscreen(options?: FullscreenOptions): Promise<void>;
86
+ requestPointerLock(): void;
87
+ scroll(options?: ScrollToOptions): void;
88
+ scroll(x: number, y: number): void;
89
+ scrollBy(options?: ScrollToOptions): void;
90
+ scrollBy(x: number, y: number): void;
91
+ scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
92
+ scrollTo(options?: ScrollToOptions): void;
93
+ scrollTo(x: number, y: number): void;
94
+ setAttribute(qualifiedName: string, value: string): void;
95
+ setAttributeNS(namespace: string, qualifiedName: string, value: string): void;
96
+ setAttributeNode(attr: Attr): Attr;
97
+ setAttributeNodeNS(attr: Attr): Attr;
98
+ setPointerCapture(pointerId: number): void;
99
+ toggleAttribute(qualifiedName: string, force?: boolean): boolean;
100
+ webkitMatchesSelector(selectors: string): boolean;
101
+ readonly baseURI: string;
102
+ readonly childNodes: NodeListOf<ChildNode>;
103
+ readonly firstChild: ChildNode;
104
+ readonly isConnected: boolean;
105
+ readonly lastChild: ChildNode;
106
+ readonly nextSibling: ChildNode;
107
+ readonly nodeName: string;
108
+ readonly nodeType: number;
109
+ nodeValue: string;
110
+ readonly parentElement: HTMLElement;
111
+ readonly parentNode: ParentNode;
112
+ readonly previousSibling: ChildNode;
113
+ textContent: string;
114
+ appendChild<T extends Node>(node: T): T;
115
+ cloneNode(deep?: boolean): Node;
116
+ compareDocumentPosition(other: Node): number;
117
+ contains(other: Node): boolean;
118
+ getRootNode(options?: GetRootNodeOptions): Node;
119
+ hasChildNodes(): boolean;
120
+ insertBefore<T_1 extends Node>(node: T_1, child: Node): T_1;
121
+ isDefaultNamespace(namespace: string): boolean;
122
+ isEqualNode(otherNode: Node): boolean;
123
+ isSameNode(otherNode: Node): boolean;
124
+ lookupNamespaceURI(prefix: string): string;
125
+ lookupPrefix(namespace: string): string;
126
+ normalize(): void;
127
+ removeChild<T_2 extends Node>(child: T_2): T_2;
128
+ replaceChild<T_3 extends Node>(node: Node, child: T_3): T_3;
129
+ readonly ATTRIBUTE_NODE: number;
130
+ readonly CDATA_SECTION_NODE: number;
131
+ readonly COMMENT_NODE: number;
132
+ readonly DOCUMENT_FRAGMENT_NODE: number;
133
+ readonly DOCUMENT_NODE: number;
134
+ readonly DOCUMENT_POSITION_CONTAINED_BY: number;
135
+ readonly DOCUMENT_POSITION_CONTAINS: number;
136
+ readonly DOCUMENT_POSITION_DISCONNECTED: number;
137
+ readonly DOCUMENT_POSITION_FOLLOWING: number;
138
+ readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;
139
+ readonly DOCUMENT_POSITION_PRECEDING: number;
140
+ readonly DOCUMENT_TYPE_NODE: number;
141
+ readonly ELEMENT_NODE: number;
142
+ readonly ENTITY_NODE: number;
143
+ readonly ENTITY_REFERENCE_NODE: number;
144
+ readonly NOTATION_NODE: number;
145
+ readonly PROCESSING_INSTRUCTION_NODE: number;
146
+ readonly TEXT_NODE: number;
147
+ dispatchEvent(event: Event): boolean;
148
+ ariaAtomic: string;
149
+ ariaAutoComplete: string;
150
+ ariaBusy: string;
151
+ ariaChecked: string;
152
+ ariaColCount: string;
153
+ ariaColIndex: string;
154
+ ariaColSpan: string;
155
+ ariaCurrent: string;
156
+ ariaDisabled: string;
157
+ ariaExpanded: string;
158
+ ariaHasPopup: string;
159
+ ariaHidden: string;
160
+ ariaKeyShortcuts: string;
161
+ ariaLabel: string;
162
+ ariaLevel: string;
163
+ ariaLive: string;
164
+ ariaModal: string;
165
+ ariaMultiLine: string;
166
+ ariaMultiSelectable: string;
167
+ ariaOrientation: string;
168
+ ariaPlaceholder: string;
169
+ ariaPosInSet: string;
170
+ ariaPressed: string;
171
+ ariaReadOnly: string;
172
+ ariaRequired: string;
173
+ ariaRoleDescription: string;
174
+ ariaRowCount: string;
175
+ ariaRowIndex: string;
176
+ ariaRowSpan: string;
177
+ ariaSelected: string;
178
+ ariaSetSize: string;
179
+ ariaSort: string;
180
+ ariaValueMax: string;
181
+ ariaValueMin: string;
182
+ ariaValueNow: string;
183
+ ariaValueText: string;
184
+ animate(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions): Animation;
185
+ getAnimations(options?: GetAnimationsOptions): Animation[];
186
+ after(...nodes: (string | Node)[]): void;
187
+ before(...nodes: (string | Node)[]): void;
188
+ remove(): void;
189
+ replaceWith(...nodes: (string | Node)[]): void;
190
+ innerHTML: string;
191
+ readonly nextElementSibling: Element;
192
+ readonly previousElementSibling: Element;
193
+ readonly childElementCount: number;
194
+ readonly children: HTMLCollection;
195
+ readonly firstElementChild: Element;
196
+ readonly lastElementChild: Element;
197
+ append(...nodes: (string | Node)[]): void;
198
+ prepend(...nodes: (string | Node)[]): void;
199
+ querySelector<K_6 extends keyof HTMLElementTagNameMap>(selectors: K_6): HTMLElementTagNameMap[K_6];
200
+ querySelector<K_7 extends keyof SVGElementTagNameMap>(selectors: K_7): SVGElementTagNameMap[K_7];
201
+ querySelector<E_1 extends Element = Element>(selectors: string): E_1;
202
+ querySelectorAll<K_8 extends keyof HTMLElementTagNameMap>(selectors: K_8): NodeListOf<HTMLElementTagNameMap[K_8]>;
203
+ querySelectorAll<K_9 extends keyof SVGElementTagNameMap>(selectors: K_9): NodeListOf<SVGElementTagNameMap[K_9]>;
204
+ querySelectorAll<E_2 extends Element = Element>(selectors: string): NodeListOf<E_2>;
205
+ replaceChildren(...nodes: (string | Node)[]): void;
206
+ readonly assignedSlot: HTMLSlotElement;
207
+ oncopy: (this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any;
208
+ oncut: (this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any;
209
+ onpaste: (this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any;
210
+ readonly style: CSSStyleDeclaration;
211
+ contentEditable: string;
212
+ enterKeyHint: string;
213
+ inputMode: string;
214
+ readonly isContentEditable: boolean;
215
+ onabort: (this: GlobalEventHandlers, ev: UIEvent) => any;
216
+ onanimationcancel: (this: GlobalEventHandlers, ev: AnimationEvent) => any;
217
+ onanimationend: (this: GlobalEventHandlers, ev: AnimationEvent) => any;
218
+ onanimationiteration: (this: GlobalEventHandlers, ev: AnimationEvent) => any;
219
+ onanimationstart: (this: GlobalEventHandlers, ev: AnimationEvent) => any;
220
+ onauxclick: (this: GlobalEventHandlers, ev: MouseEvent) => any;
221
+ onblur: (this: GlobalEventHandlers, ev: FocusEvent) => any;
222
+ oncanplay: (this: GlobalEventHandlers, ev: Event) => any;
223
+ oncanplaythrough: (this: GlobalEventHandlers, ev: Event) => any;
224
+ onchange: (this: GlobalEventHandlers, ev: Event) => any;
225
+ onclick: (this: GlobalEventHandlers, ev: MouseEvent) => any;
226
+ onclose: (this: GlobalEventHandlers, ev: Event) => any;
227
+ oncontextmenu: (this: GlobalEventHandlers, ev: MouseEvent) => any;
228
+ oncuechange: (this: GlobalEventHandlers, ev: Event) => any;
229
+ ondblclick: (this: GlobalEventHandlers, ev: MouseEvent) => any;
230
+ ondrag: (this: GlobalEventHandlers, ev: DragEvent) => any;
231
+ ondragend: (this: GlobalEventHandlers, ev: DragEvent) => any;
232
+ ondragenter: (this: GlobalEventHandlers, ev: DragEvent) => any;
233
+ ondragleave: (this: GlobalEventHandlers, ev: DragEvent) => any;
234
+ ondragover: (this: GlobalEventHandlers, ev: DragEvent) => any;
235
+ ondragstart: (this: GlobalEventHandlers, ev: DragEvent) => any;
236
+ ondrop: (this: GlobalEventHandlers, ev: DragEvent) => any;
237
+ ondurationchange: (this: GlobalEventHandlers, ev: Event) => any;
238
+ onemptied: (this: GlobalEventHandlers, ev: Event) => any;
239
+ onended: (this: GlobalEventHandlers, ev: Event) => any;
240
+ onerror: OnErrorEventHandlerNonNull;
241
+ onfocus: (this: GlobalEventHandlers, ev: FocusEvent) => any;
242
+ onformdata: (this: GlobalEventHandlers, ev: FormDataEvent) => any;
243
+ ongotpointercapture: (this: GlobalEventHandlers, ev: PointerEvent) => any;
244
+ oninput: (this: GlobalEventHandlers, ev: Event) => any;
245
+ oninvalid: (this: GlobalEventHandlers, ev: Event) => any;
246
+ onkeydown: (this: GlobalEventHandlers, ev: KeyboardEvent) => any;
247
+ onkeypress: (this: GlobalEventHandlers, ev: KeyboardEvent) => any;
248
+ onkeyup: (this: GlobalEventHandlers, ev: KeyboardEvent) => any;
249
+ onload: (this: GlobalEventHandlers, ev: Event) => any;
250
+ onloadeddata: (this: GlobalEventHandlers, ev: Event) => any;
251
+ onloadedmetadata: (this: GlobalEventHandlers, ev: Event) => any;
252
+ onloadstart: (this: GlobalEventHandlers, ev: Event) => any;
253
+ onlostpointercapture: (this: GlobalEventHandlers, ev: PointerEvent) => any;
254
+ onmousedown: (this: GlobalEventHandlers, ev: MouseEvent) => any;
255
+ onmouseenter: (this: GlobalEventHandlers, ev: MouseEvent) => any;
256
+ onmouseleave: (this: GlobalEventHandlers, ev: MouseEvent) => any;
257
+ onmousemove: (this: GlobalEventHandlers, ev: MouseEvent) => any;
258
+ onmouseout: (this: GlobalEventHandlers, ev: MouseEvent) => any;
259
+ onmouseover: (this: GlobalEventHandlers, ev: MouseEvent) => any;
260
+ onmouseup: (this: GlobalEventHandlers, ev: MouseEvent) => any;
261
+ onpause: (this: GlobalEventHandlers, ev: Event) => any;
262
+ onplay: (this: GlobalEventHandlers, ev: Event) => any;
263
+ onplaying: (this: GlobalEventHandlers, ev: Event) => any;
264
+ onpointercancel: (this: GlobalEventHandlers, ev: PointerEvent) => any;
265
+ onpointerdown: (this: GlobalEventHandlers, ev: PointerEvent) => any;
266
+ onpointerenter: (this: GlobalEventHandlers, ev: PointerEvent) => any;
267
+ onpointerleave: (this: GlobalEventHandlers, ev: PointerEvent) => any;
268
+ onpointermove: (this: GlobalEventHandlers, ev: PointerEvent) => any;
269
+ onpointerout: (this: GlobalEventHandlers, ev: PointerEvent) => any;
270
+ onpointerover: (this: GlobalEventHandlers, ev: PointerEvent) => any;
271
+ onpointerup: (this: GlobalEventHandlers, ev: PointerEvent) => any;
272
+ onprogress: (this: GlobalEventHandlers, ev: ProgressEvent<EventTarget>) => any;
273
+ onratechange: (this: GlobalEventHandlers, ev: Event) => any;
274
+ onreset: (this: GlobalEventHandlers, ev: Event) => any;
275
+ onresize: (this: GlobalEventHandlers, ev: UIEvent) => any;
276
+ onscroll: (this: GlobalEventHandlers, ev: Event) => any;
277
+ onsecuritypolicyviolation: (this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any;
278
+ onseeked: (this: GlobalEventHandlers, ev: Event) => any;
279
+ onseeking: (this: GlobalEventHandlers, ev: Event) => any;
280
+ onselect: (this: GlobalEventHandlers, ev: Event) => any;
281
+ onselectionchange: (this: GlobalEventHandlers, ev: Event) => any;
282
+ onselectstart: (this: GlobalEventHandlers, ev: Event) => any;
283
+ onslotchange: (this: GlobalEventHandlers, ev: Event) => any;
284
+ onstalled: (this: GlobalEventHandlers, ev: Event) => any;
285
+ onsubmit: (this: GlobalEventHandlers, ev: SubmitEvent) => any;
286
+ onsuspend: (this: GlobalEventHandlers, ev: Event) => any;
287
+ ontimeupdate: (this: GlobalEventHandlers, ev: Event) => any;
288
+ ontoggle: (this: GlobalEventHandlers, ev: Event) => any;
289
+ ontouchcancel?: (this: GlobalEventHandlers, ev: TouchEvent) => any;
290
+ ontouchend?: (this: GlobalEventHandlers, ev: TouchEvent) => any;
291
+ ontouchmove?: (this: GlobalEventHandlers, ev: TouchEvent) => any;
292
+ ontouchstart?: (this: GlobalEventHandlers, ev: TouchEvent) => any;
293
+ ontransitioncancel: (this: GlobalEventHandlers, ev: TransitionEvent) => any;
294
+ ontransitionend: (this: GlobalEventHandlers, ev: TransitionEvent) => any;
295
+ ontransitionrun: (this: GlobalEventHandlers, ev: TransitionEvent) => any;
296
+ ontransitionstart: (this: GlobalEventHandlers, ev: TransitionEvent) => any;
297
+ onvolumechange: (this: GlobalEventHandlers, ev: Event) => any;
298
+ onwaiting: (this: GlobalEventHandlers, ev: Event) => any;
299
+ onwebkitanimationend: (this: GlobalEventHandlers, ev: Event) => any;
300
+ onwebkitanimationiteration: (this: GlobalEventHandlers, ev: Event) => any;
301
+ onwebkitanimationstart: (this: GlobalEventHandlers, ev: Event) => any;
302
+ onwebkittransitionend: (this: GlobalEventHandlers, ev: Event) => any;
303
+ onwheel: (this: GlobalEventHandlers, ev: WheelEvent) => any;
304
+ autofocus: boolean;
305
+ readonly dataset: DOMStringMap;
306
+ nonce?: string;
307
+ tabIndex: number;
308
+ blur(): void;
309
+ focus(options?: FocusOptions): void;
310
+ };
311
+ };
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ register(name: string, module: any, dependencies: object): void;
3
+ start(): void;
4
+ };
5
+ export default _default;
package/types/index.ts ADDED
@@ -0,0 +1,41 @@
1
+ export type Component = {
2
+
3
+ elm: HTMLElement
4
+ dependencies: object
5
+
6
+ state : {
7
+ set( data: object ) : void
8
+ set( callback: ( state: object ) => any ) : void
9
+ get() : object
10
+ }
11
+
12
+ main( mainArgs: ( t: any ) => Array<Function> ): void
13
+
14
+ publish( name: string, value: any ) : void
15
+
16
+ subscribe( name: string, value: Function ) : Function
17
+
18
+ template( data: object ) : void
19
+
20
+ unmount( callback: () => void ) : void
21
+
22
+ onupdate( callback: () => void ) : void
23
+
24
+ on( eventName: string, selector: string, callback: () => void ): void
25
+
26
+ on( eventName: string, callback: () => void ): void
27
+
28
+ emit( eventName: string, data: any ) : void
29
+
30
+ off( eventName: string, callback: () => void ): void
31
+
32
+ trigger( eventName: string, selector :string, data: any ): void
33
+
34
+ render( data: object ) : void
35
+ }
36
+
37
+ export type Model = {
38
+ [key: string] : object
39
+ }
40
+
41
+ export type View = ( state: object ) => object
@@ -0,0 +1 @@
1
+ export default function templateSystem(element: any): (data: any) => string;
@@ -0,0 +1,3 @@
1
+ export declare const on: (node: any, ev: any, selectorOrCallback: any, callback: any) => void;
2
+ export declare const off: (node: any, ev: any, fn: any) => void;
3
+ export declare const trigger: (node: any, name: any, args: any) => void;
@@ -0,0 +1,8 @@
1
+ /// <reference types="node" />
2
+ export declare const rAF: (fn: any) => number | NodeJS.Timeout;
3
+ export declare const uuid: () => string;
4
+ export declare const stripTemplateTag: (element: any) => void;
5
+ export declare const dup: (o: any) => any;
6
+ export declare const createTemplateId: (element: any, templates: any) => void;
7
+ export declare const buildtemplates: (target: any, components: any, templates: any) => unknown[];
8
+ export declare const decodeHtmlEntities: (str: any) => string;
@@ -0,0 +1,2 @@
1
+ export declare const publish: (name: any, params: any) => void;
2
+ export declare const subscribe: (name: any, method: any) => () => void;
@@ -0,0 +1,35 @@
1
+ const path = require('path')
2
+
3
+ module.exports = {
4
+
5
+ devtool: 'source-map',
6
+
7
+ resolve: {
8
+ extensions: ['.ts', '.js', '.json']
9
+ },
10
+
11
+ entry: {
12
+ index: './src/index.ts'
13
+ },
14
+
15
+ module: {
16
+ rules: [
17
+ {
18
+ test: /\.ts$/,
19
+ exclude: [/node_modules/],
20
+ loader: 'ts-loader',
21
+ options: {
22
+ transpileOnly: true
23
+ }
24
+ }
25
+ ]
26
+ },
27
+
28
+ output: {
29
+ path: path.resolve(__dirname, './dist'),
30
+ filename: '[name].js',
31
+ libraryTarget: 'umd',
32
+ library: 'jails',
33
+ umdNamedDefine: true
34
+ }
35
+ }
package/.eslintignore DELETED
@@ -1,2 +0,0 @@
1
- node_modules/*
2
- build/*
package/.eslintrc DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "rules": {
3
- "indent": [2,"tab", {"SwitchCase":1}],
4
- "quotes": [2,"single"],
5
- "semi": [2,"never"],
6
- "no-unused-vars": ["warn", { "vars": "all", "args": "none" }],
7
- "no-console": 0
8
- },
9
- "env": {
10
- "es6": true,
11
- "browser": true,
12
- "node" : true,
13
- "jquery": true,
14
- },
15
- "extends": "eslint:recommended",
16
- "parserOptions": {
17
- "sourceType": "module"
18
- },
19
- "globals":{}
20
- }
package/.eslintrc.js DELETED
@@ -1,28 +0,0 @@
1
- module.exports = {
2
- "parser":"babel-eslint",
3
- "rules": {
4
- "indent": [2,"tab", {"SwitchCase":1}],
5
- "quotes": [2,"single"],
6
- "semi": [2,"never"],
7
- "no-unused-vars": ["warn", { "vars": "all", "args": "none" }],
8
- "no-console": 0
9
- },
10
- "env": {
11
- "es6": true,
12
- "browser": true,
13
- "node" : true,
14
- "jquery": true,
15
- },
16
- "extends": "eslint:recommended",
17
- "parserOptions": {
18
- "sourceType": "module",
19
- "ecmaVersion": 2017,
20
- "ecmaFeatures": {
21
- "experimentalObjectRestSpread": true
22
- }
23
- },
24
- "globals":{
25
- "APPCONFIG":true,
26
- "webcomponents":true
27
- }
28
- }
package/dist/jails.js DELETED
@@ -1 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("jails",[],t):"object"==typeof exports?exports.jails=t():e.jails=t()}(self,(function(){return(()=>{var e={17:function(e){var t;t=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(1),a=n(2);function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var l="undefined"!=typeof document?document:{},u=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"soda-";s(this,e),this._prefix=t}return i(e,[{key:"setDocument",value:function(e){l=e}},{key:"run",value:function(e,t){var n=this,r=l.createElement("div");l.documentMode<9&&(r.style.display="none",l.body.appendChild(r)),r.innerHTML=e,(0,a.nodes2Arr)(r.childNodes).map((function(e){n.compileNode(e,t)}));var i=r.innerHTML;return l.documentMode<9&&l.body.removeChild(r),i}},{key:"prefix",value:function(e){this._prefix=e}},{key:"_getPrefixReg",value:function(){return new RegExp("^"+this._prefix)}},{key:"_getPrefixedDirectiveMap",value:function(){var t=this,n={};return e.sodaDirectives.map((function(e){var r=t._prefix+e.name;n[r]=e})),n}},{key:"_removeSodaMark",value:function(e,t){e.removeAttribute(t)}},{key:"compileNode",value:function(t,n){var i=this,s=this._getPrefixReg(),u=e.sodaDirectives,c=this._getPrefixedDirectiveMap();!function e(t,n){t.nodeType===(t.TEXT_NODE||3)&&(t.nodeValue=t.nodeValue.replace(o.VALUE_OUT_REG,(function(e,t){var o=i.parseSodaExpression(t,n);return"object"===(void 0===o?"undefined":r(o))&&(o=JSON.stringify(o,null,2)),o}))),t.attributes&&t.attributes.length&&(u.map((function(e){var r=e.name,o=e.opt,s=i._prefix+r;if((0,a.exist)(t.getAttribute(s))){var u=t.getAttribute(s);o.link.bind(i)({expression:u,scope:n,el:t,parseSodaExpression:i.parseSodaExpression.bind(i),getValue:i.getValue.bind(i),compileNode:i.compileNode.bind(i),document:l}),i._removeSodaMark(t,s)}})),(0,a.nodes2Arr)(t.attributes).filter((function(e){return!c[e.name]})).map((function(e){if(s.test(e.name)){var r=e.name.replace(s,"");if(r&&(0,a.exist)(e.value)){var o=i.parseComplexExpression(e.value,n);!1!==o&&(0,a.exist)(o)&&t.setAttribute(r,o),i._removeSodaMark(t,e.name)}}else(0,a.exist)(e.value)&&(e.value=i.parseComplexExpression(e.value,n))}))),(0,a.nodes2Arr)(t.childNodes).map((function(t){e(t,n)}))}(t,n)}},{key:"getEvalFunc",value:function(t){return new Function("getValue","sodaFilterMap","return function sodaExp(scope){ return "+t+"}")(this.getValue,e.sodaFilterMap)}},{key:"getValue",value:function(e,t){return o.CONST_REGG.lastIndex=0,t.replace(o.CONST_REGG,(function(t){return void 0===e[t]?t:e[t]})),"true"===t||"false"!==t&&function t(n,r){var i=r.indexOf(".");if(i>-1){var a=r.substr(0,i);return r=r.substr(i+1),void 0!==e[a]&&o.CONST_REG.test(a)&&(a=e[a]),void 0!==n[a]&&null!==n[a]?t(n[a],r):""}return r=r.trim(),void 0!==e[r]&&o.CONST_REG.test(r)&&(r=e[r]),void 0!==n[r]?n[r]:""}(e,t)}},{key:"parseComplexExpression",value:function(e,t){var n=this,r=o.ONLY_VALUE_OUT_REG.exec(e);if(r){var i=r[1];return this.parseSodaExpression(i,t)}return e.replace(o.VALUE_OUT_REG,(function(e,r){return n.parseSodaExpression(r,t)}))}},{key:"parseSodaExpression",value:function(e,t){var n=this;e=(e=e.replace(o.STRING_REG,(function(e,n,r){var i=(0,a.getRandom)();return t[i]=n||r,i}))).replace(o.OR_REG,o.OR_REPLACE).split("|");for(var r=0;r<e.length;r++)e[r]=(e[r].replace(new RegExp(o.OR_REPLACE,"g"),"||")||"").trim();for(var i=e[0]||"",s=e.slice(1);o.ATTR_REG_NG.test(i);)o.ATTR_REG.lastIndex=0,i=i.replace(o.ATTR_REG,(function(e,r){var i=(0,a.getAttrVarKey)(),o=n.parseSodaExpression(r,t);return t[i]=o,"."+i}));return i=i.replace(o.OBJECT_REG,(function(e){return"getValue(scope,'"+e.trim()+"')"})),i=this.parseFilter(s,i),this.getEvalFunc(i)(t)}},{key:"parseFilter",value:function(t,n){var r=e.sodaFilterMap;return function e(){if(i=t.shift()){for(var i,a=(i=i.split(":")).slice(1)||[],s=(i[0]||"").trim(),l=0;l<a.length;l++)o.OBJECT_REG_NG.test(a[l])&&(a[l]="getValue(scope,'"+a[l]+"')");r[s]&&(a.unshift(n),a=a.join(","),n="sodaFilterMap['"+s+"']("+a+")"),e()}}(),n}}],[{key:"filter",value:function(e,t){this.sodaFilterMap[e]=t}},{key:"getFilter",value:function(e){return this.sodaFilterMap[e]}},{key:"directive",value:function(e,t){var n=t.priority,r=void 0===n?0:n,i=void 0;for(i=0;i<this.sodaDirectives.length;i++){var o=this.sodaDirectives[i].opt.priority,a=void 0===o?0:o;if(r<a);else if(r>=a)break}this.sodaDirectives.splice(i,0,{name:e,opt:t})}},{key:"discribe",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{compile:!0};this.template[e]={funcOrStr:t,option:n}}},{key:"getTmpl",value:function(e,t){var n=this.template[e],r=n.funcOrStr,i=n.option,o=void 0===i?{}:i;return{template:"function"==typeof r?r.apply(null,t):r,option:o}}}]),e}();u.sodaDirectives=[],u.sodaFilterMap={},u.template={},t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IDENTOR_REG=/[a-zA-Z_\$]+[\w\$]*/g,t.STRING_REG=/"([^"]*)"|'([^']*)'/g,t.NUMBER_REG=/\d+|\d*\.\d+/g,t.OBJECT_REG=/[a-zA-Z_\$]+[\w\$]*(?:\s*\.\s*(?:[a-zA-Z_\$]+[\w\$]*|\d+))*/g,t.OBJECT_REG_NG=/[a-zA-Z_\$]+[\w\$]*(?:\s*\.\s*(?:[a-zA-Z_\$]+[\w\$]*|\d+))*/,t.ATTR_REG=/\[([^\[\]]*)\]/g,t.ATTR_REG_NG=/\[([^\[\]]*)\]/,t.ATTR_REG_DOT=/\.([a-zA-Z_\$]+[\w\$]*)/g,t.NOT_ATTR_REG=/[^\.|]([a-zA-Z_\$]+[\w\$]*)/g,t.OR_REG=/\|\|/g,t.OR_REPLACE="OR_OPERATOR",t.CONST_PRIFIX="_$C$_",t.CONST_REG=/^_\$C\$_/,t.CONST_REGG=/_\$C\$_[^\.]+/g,t.VALUE_OUT_REG=/\{\{([^\}]*)\}\}/g,t.ONLY_VALUE_OUT_REG=/^\{\{([^\}]*)\}\}$/},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assign=t.nodes2Arr=t.exist=t.getRandom=t.getAttrVarKey=void 0;var r=n(1),i=(t.getAttrVarKey=function(){return r.CONST_PRIFIX+~~(1e6*Math.random())},t.getRandom=function(){return"$$"+~~(1e6*Math.random())},t.exist=function(e){return null!=e&&""!==e&&void 0!==e},t.nodes2Arr=function(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n]);return t},Object.getOwnPropertySymbols),o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,s=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)};t.assign=Object.assign||function(e,t){for(var n,r,l=s(e),u=1;u<arguments.length;u++){for(var c in n=Object(arguments[u]))o.call(n,c)&&(l[c]=n[c]);if(i){r=i(n);for(var d=0;d<r.length;d++)a.call(n,r[d])&&(l[r[d]]=n[r[d]])}}return l}},function(e,t,n){"use strict";var r,i=(r=n(0))&&r.__esModule?r:{default:r},o=n(2);n(4),n(5),n(6),n(7),n(8),n(9),n(10);var a=new i.default,s={prefix:function(e){a.prefix(e)},filter:function(e,t){i.default.filter(e,t)},directive:function(e,t){i.default.directive(e,t)},setDocument:function(e){a.setDocument(e)},discribe:function(e,t,n){i.default.discribe(e,t,n)},Soda:i.default},l=(0,o.assign)((function(e,t){return a.run(e,t)}),s);e.exports=l},function(e,t,n){"use strict";var r;((r=n(0))&&r.__esModule?r:{default:r}).default.directive("repeat",{priority:10,link:function(e){var t,n,r,i=this,o=e.scope,a=e.el,s=e.expression,l=e.getValue,u=(e.parseSodaExpression,e.compileNode),c=s.replace(/\s+by\s+([^\s]+)$/,(function(e,t){return t&&(r=(t||"").trim()),""})),d=/([^\s]+)\s+in\s+([^\s]+)|\(([^,]+)\s*,\s*([^)]+)\)\s+in\s+([^\s]+)/.exec(c);if(d){if(d[1]&&d[2]){if(t=(d[1]||"").trim(),n=(d[2]||"").trim(),!t||!n)return}else d[3]&&d[4]&&d[5]&&(r=(d[3]||"").trim(),t=(d[4]||"").trim(),n=(d[5]||"").trim());r=r||"$index";var f=l(o,n)||[],p=function(e){var n=a.cloneNode(!0),s=Object.create(o);s[r]=e,s[t]=f[e],n.removeAttribute(i._prefix+"repeat"),a.parentNode.insertBefore(n,a),u(n,s)};if("length"in f)for(var v=0;v<f.length;v++)p(v);else for(var v in f)f.hasOwnProperty(v)&&p(v);a.parentNode.removeChild(a),a.childNodes&&a.childNodes.length&&(a.innerHTML="")}}})},function(e,t,n){"use strict";var r;((r=n(0))&&r.__esModule?r:{default:r}).default.directive("if",{priority:9,link:function(e){var t=e.expression,n=e.parseSodaExpression,r=e.scope,i=e.el;n(t,r)||(i.parentNode&&i.parentNode.removeChild(i),i.innerHTML="")}})},function(e,t,n){"use strict";var r,i=(r=n(0))&&r.__esModule?r:{default:r};i.default.directive("class",{link:function(e){var t=e.scope,n=e.el,r=e.expression,i=(0,e.parseSodaExpression)(r,t);i&&function(e,t){e.className?e.className.match(function(e){return new RegExp("(^|\\s+)"+e+"(\\s+|$)","g")}(t))||(e.className+=" "+t):e.className=t}(n,i)}})},function(e,t,n){"use strict";var r;((r=n(0))&&r.__esModule?r:{default:r}).default.directive("html",{link:function(e){var t=e.expression,n=e.scope,r=e.el,i=(0,e.parseSodaExpression)(t,n);i&&(r.innerHTML=i)}})},function(e,t,n){"use strict";var r;((r=n(0))&&r.__esModule?r:{default:r}).default.directive("replace",{link:function(e){var t=e.scope,n=e.el,r=e.expression,i=e.parseSodaExpression,o=e.document,a=i(r,t);if(a){var s=o.createElement("div");if(s.innerHTML=a,n.parentNode)for(;s.childNodes[0];)n.parentNode.insertBefore(s.childNodes[0],n)}n.parentNode&&n.parentNode.removeChild(n)}})},function(e,t,n){"use strict";var r;((r=n(0))&&r.__esModule?r:{default:r}).default.directive("style",{link:function(e){var t=e.scope,n=e.el,r=e.expression,i=(0,e.parseSodaExpression)(r,t),o=function(e,t){return/opacity|z-index/.test(e)?parseFloat(t):isNaN(t)?t:t+"px"};if(i){var a=[];for(var s in i)if(i.hasOwnProperty(s)){var l=o(s,i[s]);a.push([s,l].join(":"))}var u=n.style;for(s=0;s<u.length;s++){var c=u[s];i[c]||a.push([c,u[c]].join(":"))}var d=a.join(";");n.setAttribute("style",d)}}})},function(e,t,n){"use strict";var r,i=(r=n(0))&&r.__esModule?r:{default:r};i.default.directive("include",{priority:8,link:function(e){var t=e.scope,n=e.el,r=e.parseSodaExpression,o=e.expression.replace(/\{\{([^\}]*)\}\}/g,(function(e,n){return r(n,t)})),a=(o=o.split(":"))[0],s=o.slice(1),l=i.default.getTmpl(a,s),u=l.template,c=l.option;u&&((void 0===c?{}:c).compile?n.outerHTML=this.run(u,t):n.outerHTML=u)}})}])},e.exports=t()}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.r(r),n.d(r,{default:()=>M});var e,t={};n.r(t),n.d(t,{publish:()=>_,subscribe:()=>g,unsubscribe:()=>y});var i="undefined"==typeof document?void 0:document,o=!!i&&"content"in i.createElement("template"),a=!!i&&i.createRange&&"createContextualFragment"in i.createRange();function s(e,t){var n,r,i=e.nodeName,o=t.nodeName;return i===o||(n=i.charCodeAt(0),r=o.charCodeAt(0),n<=90&&r>=97?i===o.toUpperCase():r<=90&&n>=97&&o===i.toUpperCase())}function l(e,t,n){e[n]!==t[n]&&(e[n]=t[n],e[n]?e.setAttribute(n,""):e.removeAttribute(n))}var u={OPTION:function(e,t){var n=e.parentNode;if(n){var r=n.nodeName.toUpperCase();"OPTGROUP"===r&&(r=(n=n.parentNode)&&n.nodeName.toUpperCase()),"SELECT"!==r||n.hasAttribute("multiple")||(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),n.selectedIndex=-1)}l(e,t,"selected")},INPUT:function(e,t){l(e,t,"checked"),l(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var n=t.value;e.value!==n&&(e.value=n);var r=e.firstChild;if(r){var i=r.nodeValue;if(i==n||!n&&i==e.placeholder)return;r.nodeValue=n}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var n,r,i=-1,o=0,a=e.firstChild;a;)if("OPTGROUP"===(r=a.nodeName&&a.nodeName.toUpperCase()))a=(n=a).firstChild;else{if("OPTION"===r){if(a.hasAttribute("selected")){i=o;break}o++}!(a=a.nextSibling)&&n&&(a=n.nextSibling,n=null)}e.selectedIndex=i}}};function c(){}function d(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}const f=function(t,n,r){if(r||(r={}),"string"==typeof n)if("#document"===t.nodeName||"HTML"===t.nodeName||"BODY"===t.nodeName){var l=n;(n=i.createElement("html")).innerHTML=l}else f=(f=n).trim(),n=o?function(e){var t=i.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}(f):a?function(t){return e||(e=i.createRange()).selectNode(i.body),e.createContextualFragment(t).childNodes[0]}(f):function(e){var t=i.createElement("body");return t.innerHTML=e,t.childNodes[0]}(f);var f,p=r.getNodeKey||d,v=r.onBeforeNodeAdded||c,m=r.onNodeAdded||c,h=r.onBeforeElUpdated||c,b=r.onElUpdated||c,_=r.onBeforeNodeDiscarded||c,g=r.onNodeDiscarded||c,y=r.onBeforeElChildrenUpdated||c,E=!0===r.childrenOnly,x=Object.create(null),N=[];function A(e){N.push(e)}function T(e,t){if(1===e.nodeType)for(var n=e.firstChild;n;){var r=void 0;t&&(r=p(n))?A(r):(g(n),n.firstChild&&T(n,t)),n=n.nextSibling}}function O(e,t,n){!1!==_(e)&&(t&&t.removeChild(e),g(e),T(e,n))}function S(e){m(e);for(var t=e.firstChild;t;){var n=t.nextSibling,r=p(t);if(r){var i=x[r];i&&s(t,i)?(t.parentNode.replaceChild(i,t),R(i,t)):S(t)}else S(t);t=n}}function R(e,t,n){var r=p(t);if(r&&delete x[r],!n){if(!1===h(e,t))return;if(function(e,t){var n,r,i,o,a=t.attributes;if(11!==t.nodeType&&11!==e.nodeType){for(var s=a.length-1;s>=0;s--)r=(n=a[s]).name,i=n.namespaceURI,o=n.value,i?(r=n.localName||r,e.getAttributeNS(i,r)!==o&&("xmlns"===n.prefix&&(r=n.name),e.setAttributeNS(i,r,o))):e.getAttribute(r)!==o&&e.setAttribute(r,o);for(var l=e.attributes,u=l.length-1;u>=0;u--)r=(n=l[u]).name,(i=n.namespaceURI)?(r=n.localName||r,t.hasAttributeNS(i,r)||e.removeAttributeNS(i,r)):t.hasAttribute(r)||e.removeAttribute(r)}}(e,t),b(e),!1===y(e,t))return}"TEXTAREA"!==e.nodeName?function(e,t){var n,r,o,a,l,c=t.firstChild,d=e.firstChild;e:for(;c;){for(a=c.nextSibling,n=p(c);d;){if(o=d.nextSibling,c.isSameNode&&c.isSameNode(d)){c=a,d=o;continue e}r=p(d);var f=d.nodeType,m=void 0;if(f===c.nodeType&&(1===f?(n?n!==r&&((l=x[n])?o===l?m=!1:(e.insertBefore(l,d),r?A(r):O(d,e,!0),d=l):m=!1):r&&(m=!1),(m=!1!==m&&s(d,c))&&R(d,c)):3!==f&&8!=f||(m=!0,d.nodeValue!==c.nodeValue&&(d.nodeValue=c.nodeValue))),m){c=a,d=o;continue e}r?A(r):O(d,e,!0),d=o}if(n&&(l=x[n])&&s(l,c))e.appendChild(l),R(l,c);else{var h=v(c);!1!==h&&(h&&(c=h),c.actualize&&(c=c.actualize(e.ownerDocument||i)),e.appendChild(c),S(c))}c=a,d=o}!function(e,t,n){for(;t;){var r=t.nextSibling;(n=p(t))?A(n):O(t,e,!0),t=r}}(e,d,r);var b=u[e.nodeName];b&&b(e,t)}(e,t):u.TEXTAREA(e,t)}!function e(t){if(1===t.nodeType||11===t.nodeType)for(var n=t.firstChild;n;){var r=p(n);r&&(x[r]=n),e(n),n=n.nextSibling}}(t);var C,M,w=t,G=w.nodeType,j=n.nodeType;if(!E)if(1===G)1===j?s(t,n)||(g(t),w=function(e,t){for(var n=e.firstChild;n;){var r=n.nextSibling;t.appendChild(n),n=r}return t}(t,(C=n.nodeName,(M=n.namespaceURI)&&"http://www.w3.org/1999/xhtml"!==M?i.createElementNS(M,C):i.createElement(C)))):w=n;else if(3===G||8===G){if(j===G)return w.nodeValue!==n.nodeValue&&(w.nodeValue=n.nodeValue),w;w=n}if(w===n)g(t);else{if(n.isSameNode&&n.isSameNode(w))return;if(R(w,n,E),N)for(var P=0,k=N.length;P<k;P++){var L=x[N[P]];L&&O(L,L.parentNode,!1)}}return!E&&w!==t&&t.parentNode&&(w.actualize&&(w=w.actualize(t.ownerDocument||i)),t.parentNode.replaceChild(w,t)),w};var p=n(17),v=n.n(p);const m=e=>{(requestAnimationFrame||setTimeout)(e,1e3/60)},h={},b={},_=(e,t)=>{b[e]=Object.assign({},b[e],t),h[e]&&h[e].forEach((e=>e(t)))},g=(e,t)=>{h[e]=h[e]||[],h[e].push(t),e in b&&t(b[e])},y=e=>{h[e.name]=(h[e.name]||[]).filter((t=>t!=e.method)),h[e.name].length||(delete h[e.name],delete b[e.name])},E="CustomEvent"in window&&"function"==typeof window.CustomEvent?(e,t)=>new CustomEvent(e,t):(e,t)=>{const n=document.createEvent("CustomEvent");return n.initCustomEvent(e,!0,!0,t),n},x=(e,t)=>function(n){const r=this,i=n.detail||{};e.__events[t].forEach((e=>{e.handler.apply(r,[n].concat(i.args))}))},N=(e,t)=>{e.__events[t]&&e.__events[t].listener&&(e.removeEventListener(t,e.__events[t].listener,"focus"==t||"blur"==t||"mouseenter"==t||"mouseleave"==t),delete e.__events[t])},A=(e,t,n)=>function(r){const i=this,o=r.detail||{};let a=r.target;for(;a&&(a.matches(t)&&(r.delegateTarget=a,n.apply(i,[r].concat(o.args))),a!==e);)a=a.parentNode},T=(e,t,n)=>{e.dispatchEvent(E(t,{bubbles:!0,detail:n}))};var O;(O=v()).prefix("v-"),O.directive("repeat",{priority:10,link({scope:e,el:t,expression:n,getValue:r,compileNode:i}){let o,a,s;const l=n.replace(/\s+by\s+([^\s]+)$/,((e,t)=>(t&&(s=(t||"").trim()),""))),u=/([^\s]+)\s+in\s+([^\s]+)|\(([^,]+)\s*,\s*([^)]+)\)\s+in\s+([^\s]+)/.exec(l);if(!u)return;if(u[1]&&u[2]){if(o=(u[1]||"").trim(),a=(u[2]||"").trim(),!o||!a)return}else u[3]&&u[4]&&u[5]&&(s=(u[3]||"").trim(),o=(u[4]||"").trim(),a=(u[5]||"").trim());s=s||"$index";const c=r(e,a)||[],d=n=>{const r=t.cloneNode(!0),a=Object.create(e);a[s]=n,a[o]=c[n],r.removeAttribute(`${this._prefix}repeat`),t.parentNode.insertBefore(r,t),Array.from(r.querySelectorAll("[data-component]")).forEach((e=>e.setAttribute("initialState",JSON.stringify(a)))),i(r,a)};if("length"in c)for(var f=0;f<c.length;f++)d(f);else for(var f in c)c.hasOwnProperty(f)&&d(f);t.parentNode.removeChild(t),t.childNodes&&t.childNodes.length&&(t.innerHTML="")}});let S={},R=[];const C={},M={start(){w.start(),w.observe()},register(e,t,n={}){C[e]={name:e,module:t,dependencies:n}}},w={start(){var e;e=document.body,Array.from(e.querySelectorAll("template")).forEach((e=>{e.parentNode.replaceChild(e.content,e)})),w.scan(document.body,G)},scan(e,t){if(1===e.nodeType){const n=Array.from(e.querySelectorAll("[data-component]"));(e.dataset.component?[e].concat(n):n).reverse().forEach(t)}},observe(){new MutationObserver((e=>e.forEach((e=>{"childList"===e.type&&(e.addedNodes.length?Array.from(e.addedNodes).forEach((e=>w.scan(e,G))):e.removedNodes.length&&Array.from(e.removedNodes).forEach((e=>w.scan(e,w.remove))))})))).observe(document.body,{childList:!0,subtree:!0})},remove(e){const t=R.find((t=>t.element==e));t&&t.dispose()}},G=e=>{let n,r;e.getAttribute("tplid")?(n=e.getAttribute("tplid"),r=R.find((e=>e.tplid==n)).template):(n="xxxxxxxx".replace(/[xy]/g,(e=>{const t=8*Math.random()|0;return("x"==e?t:3&t|8).toString(8)})),e.setAttribute("tplid",n),r=j(e.outerHTML));const i={tplid:n,element:e,template:r,instances:{},destroyers:[],promises:[],view:e=>e,parentUpdate:e=>null,dispose(){i.promises.length?Promise.all(i.promises).then((e=>{this.destroyers.forEach((e=>e(i)))})):this.destroyers.forEach((e=>e(i)))},model:Object.assign({},JSON.parse(e.getAttribute("initialState"))),update(t,n=!1){this.model=Object.assign({global:S},this.model,t),S=P(t),n&&this.parentUpdate(this.model);const r=JSON.parse(JSON.stringify(this.model));f(e,v()(this.template,this.view(r)),{onNodeDiscarded:e=>(w.scan(e,w.remove),!0),onBeforeElUpdated:(e,t)=>!(e.isEqualNode(t)||1==e.nodeType&&"static"in e.dataset)}),m((t=>{Array.from(e.querySelectorAll("[data-component]")).forEach((e=>{const t=JSON.parse(e.getAttribute("initialState"))||{},n=R.find((t=>t.element==e)),{global:r,parent:i,...o}=this.model;if(n){const e=Object.assign(t,{parent:o,global:S});n.update(e,!0)}}))}))}};R.push(i),e.dataset.component.split(/\s/).forEach((n=>{const r=C[n];if(!r)return void console.warn(`Jails - Module ${n} not registered`);const{module:o,dependencies:a}=r;i.model=Object.assign({},o.model,i.model);const s=function({name:e,element:t,dependencies:n,Pubsub:r,ElementInterface:i,AST:o}){const a=[];let s,l=[],u=new Promise((e=>s=e));const c={name:e,dependencies:n,elm:t,publish:r.publish,unsubscribe:r.unsubscribe,__initialize(){s(c)},main(e){u.then((t=>e().forEach((e=>e(c))))).catch((e=>console.error(e)))},expose(t){i.instances[e].methods=t},state:{set(e){if(e.constructor===Function){const t=i.model;e(t),i.update(t)}else i.update(e);return l.forEach((e=>e(i.model))),new Promise((e=>m(e)))},get:()=>i.model,subscribe(e){l.push(e)},unsubscribe(e){l=l.filter((t=>t!==e))}},destroy(e){i.destroyers.push(e)},on(e,n,r){((e,t,n,r)=>{if(e.__events=e.__events||{},e.__events[t]=e.__events[t]||[],!e.__events[t].length){const n=x(e,t);e.addEventListener(t,n,"focus"==t||"blur"==t||"mouseenter"==t||"mouseleave"==t),e.__events[t].listener=n}n.call?e.__events[t].push({handler:n,callback:n}):e.__events[t].push({handler:A(e,n,r),callback:r})})(t,e,n,r)},off(e,n){((e,t,n)=>{if(n&&e.__events[t]&&e.__events[t].length){var r=e.__events[t];e.__events[t]=e.__events[t].filter((function(e){return e.callback!=n})),e.__events[t].listener=r.listener,e.__events[t].length||N(e,t)}else N(e,t)})(t,e,n)},trigger(e,n,r){n.constructor===String?T(t.querySelector(n),e,{args:r}):T(t,e,{args:n})},emit(e,n){const r=Array.prototype.slice.call(arguments);T(t,r.shift(),{args:r})},update(e){i.parentUpdate=e},get:(e,n)=>function(){m((r=>{const i=Array.prototype.slice.call(arguments),a=i.shift(),s=`[data-component*=${e}]`;if(n=n?s+n:s,Array.from(t.querySelectorAll(n)).forEach((t=>{const n=o.find((e=>e.element==t));if(n){const t=n.instances[e];t&&a in t.methods&&t.methods[a].apply(null,i)}})),t.matches(n)){const n=o.find((e=>e.element==t)).instances[e];n&&a in n.methods&&n.methods[a].apply(null,i)}}))},subscribe(e,t){a.push({name:e,method:t}),r.subscribe(e,t)}};return c}({name:n,element:e,dependencies:a,Pubsub:t,ElementInterface:i,AST:R}),l=o.default(s);l&&l.then&&i.promises.push(l),s.__initialize(),i.view=o.view||i.view,i.instances[n]={methods:{}}})),i.update()},j=e=>{const t=(e=>e.replace(/<template.*?>|<\/template>/g,""))(e),n=document.createElement("div");return n.innerHTML=t,Array.from(n.querySelectorAll("[data-component]")).forEach((e=>{const t=R.find((t=>t.tplid===e.getAttribute("tplid")));t&&(e.outerHTML=t.template)})),n.innerHTML},P=e=>(Object.assign(S,e),delete S.parent,delete S.global,S)})(),r})()}));
package/src/component.js DELETED
@@ -1,127 +0,0 @@
1
- import { on, off, trigger } from './utils/events'
2
- import { rAF } from './utils'
3
-
4
- export default function Component ({
5
- name,
6
- element,
7
- dependencies,
8
- Pubsub,
9
- ElementInterface,
10
- AST
11
- }) {
12
-
13
- const subscriptions = []
14
-
15
- let stateSubscriptions = []
16
- let resolver
17
- let promise = new Promise(resolve => resolver = resolve)
18
-
19
- const base = {
20
-
21
- name,
22
- dependencies,
23
- elm: element,
24
- publish: Pubsub.publish,
25
- unsubscribe: Pubsub.unsubscribe,
26
-
27
- __initialize() {
28
- resolver(base)
29
- },
30
-
31
- main(fn) {
32
- promise
33
- .then( _ => fn().forEach(lambda => lambda(base)))
34
- .catch( err => console.error( err) )
35
- },
36
-
37
- expose(methods) {
38
- ElementInterface.instances[name].methods = methods
39
- },
40
-
41
- state: {
42
- set( state ) {
43
- if( state.constructor === Function ){
44
- const model = ElementInterface.model
45
- state(model)
46
- ElementInterface.update(model)
47
- } else {
48
- ElementInterface.update(state)
49
- }
50
- stateSubscriptions.forEach( fn => fn(ElementInterface.model) )
51
- return new Promise((resolve) => rAF(resolve))
52
- },
53
- get() {
54
- return ElementInterface.model
55
- },
56
- subscribe(fn){
57
- stateSubscriptions.push(fn)
58
- },
59
- unsubscribe(fn){
60
- stateSubscriptions = stateSubscriptions.filter( item => item !== fn )
61
- }
62
- },
63
-
64
- destroy(callback) {
65
- ElementInterface.destroyers.push(callback)
66
- },
67
-
68
- on(name, selectorOrCallback, callback) {
69
- on(element, name, selectorOrCallback, callback)
70
- },
71
-
72
- off(name, callback) {
73
- off(element, name, callback)
74
- },
75
-
76
- trigger(ev, target, args) {
77
- if (target.constructor === String)
78
- trigger(element.querySelector(target), ev, { args: args })
79
- else trigger(element, ev, { args: target })
80
- },
81
-
82
- emit(n, params) {
83
- const args = Array.prototype.slice.call(arguments)
84
- trigger(element, args.shift(), { args: args })
85
- },
86
-
87
- update(fn) {
88
- ElementInterface.parentUpdate = fn
89
- },
90
-
91
- get(name, query) {
92
-
93
- return function () {
94
- rAF(_ => {
95
- const args = Array.prototype.slice.call(arguments),
96
- method = args.shift(),
97
- selector = `[data-component*=${name}]`
98
- query = query ? selector + query : selector
99
-
100
- Array.from(element.querySelectorAll(query))
101
- .forEach(el => {
102
- const item = AST.find( item => item.element == el )
103
- if( item ) {
104
- const instance = item.instances[name]
105
- if (instance && (method in instance.methods))
106
- instance.methods[method].apply(null, args)
107
- }
108
- })
109
-
110
- if (element.matches(query)) {
111
- const item = AST.find( item => item.element == element )
112
- const instance = item.instances[name]
113
- if (instance && method in instance.methods)
114
- instance.methods[method].apply(null, args)
115
- }
116
- })
117
- }
118
- },
119
-
120
- subscribe(name, method) {
121
- subscriptions.push({ name, method })
122
- Pubsub.subscribe(name, method)
123
- }
124
- }
125
-
126
- return base
127
- }