@joist/di 2.0.0-next.1 → 2.0.0-next.10

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Di
2
2
 
3
- Dependency Injection in ~800 bytes. Can be used with and without decorators.
3
+ Dependency Injection in ~800 bytes.
4
4
 
5
5
  #### Installation:
6
6
 
@@ -11,7 +11,7 @@ npm i @joist/di
11
11
  #### Example:
12
12
 
13
13
  ```TS
14
- import { Injector, inject } from '@joist/di';
14
+ import { Injector } from '@joist/di';
15
15
 
16
16
  class FooService {
17
17
  sayHello() {
@@ -20,7 +20,9 @@ class FooService {
20
20
  }
21
21
 
22
22
  class BarService {
23
- constructor(@inject(FooService) private foo: FooService) {}
23
+ static deps = [FooService];
24
+
25
+ constructor(private foo: FooService) {}
24
26
 
25
27
  sayHello() {
26
28
  return this.foo.sayHello();
@@ -32,8 +34,6 @@ const app = new Injector();
32
34
  app.get(BarService).sayHello(); // Hello from BarService and Hello from FooService
33
35
  ```
34
36
 
35
-
36
-
37
37
  #### Override A Service:
38
38
 
39
39
  ```TS
@@ -46,7 +46,9 @@ class FooService {
46
46
  }
47
47
 
48
48
  class BarService {
49
- constructor(@inject(FooService) private foo: FooService) {}
49
+ static deps = [FooService];
50
+
51
+ constructor(private foo: FooService) {}
50
52
 
51
53
  sayHello() {
52
54
  return 'Hello From BarService and ' + this.foo.sayHello();
@@ -77,7 +79,7 @@ If you have nested injectors and you want to make sure the same instance is prov
77
79
  ```TS
78
80
  import { service } from '@joist/di';
79
81
 
80
- @service()
82
+ @service
81
83
  class FooService {
82
84
  sayHello() {
83
85
  return 'Hello From FooService';
@@ -87,22 +89,27 @@ class FooService {
87
89
 
88
90
  ## Custom Elements
89
91
 
90
- Joist DI was built with custom elements in mind and ships with a seperate DOM lib.
92
+ Joist DI was built with custom elements in mind. Custom elements are an example where you do not have direct control over how your classes are instantiated.
91
93
 
92
- The `@injectable()` decorator allows the Joist Dependency Injector to pass arguments to your custom element when instances of your element is created.
94
+ Since the browser will be what initializes your custom elements we need to be able to tell the browser how to pass arguments.
95
+
96
+ The `@injectable` decorator allows the Joist Dependency Injector to pass arguments to your custom element when instances of your element is created.
97
+
98
+ `@injectable` is on required when you will not be able to manually create instances via an injector.
93
99
 
94
100
  #### Inject dependency into your custom element constructor
95
101
 
96
102
  ```TS
97
- import { inject, service } from '@joist/di';
98
- import { injectable } from '@joist/di/dom';
103
+ import { inject, service, injectable } from '@joist/di';
99
104
 
100
- @service()
105
+ @service
101
106
  class MyService {}
102
107
 
103
- @injectable()
108
+ @injectable
104
109
  class MyElement extends HTMLElement {
105
- constructor(@inject(MyService) public myService: MyService) {}
110
+ static deps = [MyService];
111
+
112
+ constructor(public myService: MyService) {}
106
113
  }
107
114
 
108
115
  customElements.define('my-element', MyElement);
@@ -113,7 +120,7 @@ customElements.define('my-element', MyElement);
113
120
  This allows your to override services for different environments or scenarios
114
121
 
115
122
  ```TS
116
- import { defineEnvironment, injectable } from '@joist/di/dom';
123
+ import { defineEnvironment, injectable } from '@joist/di';
117
124
 
118
125
  class Config {
119
126
  apiUrl = 'http://localhost:4000/api/'
@@ -128,9 +135,11 @@ defineEnvironment([
128
135
  }
129
136
  ]);
130
137
 
131
- @injectable()
138
+ @injectable
132
139
  class MyElement extends HTMLElement {
133
- constructor(@inject(Config) config: Config) {
140
+ static deps = [Config];
141
+
142
+ constructor(config: Config) {
134
143
  console.log(config.apiUrl); // http://real-api/api/
135
144
  }
136
145
  }
package/package.json CHANGED
@@ -1,18 +1,14 @@
1
1
  {
2
2
  "name": "@joist/di",
3
- "version": "2.0.0-next.1",
3
+ "version": "2.0.0-next.10",
4
4
  "main": "./target/build/lib.js",
5
5
  "module": "./target/build/lib.js",
6
6
  "exports": {
7
7
  ".": {
8
8
  "import": "./target/build/lib.js"
9
- },
10
- "./dom": {
11
- "import": "./target/build/lib/dom.js"
12
9
  }
13
10
  },
14
11
  "files": [
15
- "dom",
16
12
  "target/build"
17
13
  ],
18
14
  "sideEffects": false,
@@ -38,5 +34,5 @@
38
34
  "test": "tsc -p tsconfig.test.json && wtr --config ../../wtr.config.mjs --port 8001",
39
35
  "build": "tsc -p tsconfig.build.json"
40
36
  },
41
- "gitHead": "4aa7624fcfb85d1ba3b9189166d47976ec893664"
37
+ "gitHead": "1e45b0733eedef4d9d8680ddcb140e3ad3a578aa"
42
38
  }
@@ -1,5 +1,5 @@
1
- import { Injector } from '../injector';
2
- import { Provider } from '../provider';
1
+ import { Injector } from './injector';
2
+ import { Provider } from './provider';
3
3
  export declare function defineEnvironment(providers?: Provider<any>[]): Injector;
4
4
  export declare function getEnvironmentRef(): Injector;
5
5
  export declare function clearEnvironment(): void;
@@ -1,4 +1,4 @@
1
- import { Injector } from '../injector';
1
+ import { Injector } from './injector';
2
2
  let rootInjector = null;
3
3
  export function defineEnvironment(providers = []) {
4
4
  rootInjector = new Injector({ providers });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.js","sourceRoot":"","sources":["../../../lib/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,IAAI,YAAY,GAAoB,IAAI,CAAC;AAEzC,MAAM,UAAU,iBAAiB,CAAC,YAA6B,EAAE;IAC/D,YAAY,GAAG,IAAI,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;IAE3C,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,IAAI,YAAY,EAAE;QAChB,OAAO,YAAY,CAAC;KACrB;IAED,OAAO,iBAAiB,EAAE,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,YAAY,GAAG,IAAI,CAAC;AACtB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { Provider, ProviderToken } from './provider';
2
+ export interface Injectable {
3
+ deps: ProviderToken<any>[];
4
+ providers?: Provider<any>[];
5
+ new (...args: any[]): any;
6
+ }
7
+ export declare function injectable<T extends Injectable>(Clazz: T): {
8
+ new (...args: any[]): {
9
+ [x: string]: any;
10
+ };
11
+ deps: ProviderToken<any>[];
12
+ providers?: Provider<any>[] | undefined;
13
+ } & T;
@@ -0,0 +1,17 @@
1
+ import { getEnvironmentRef } from './environment';
2
+ import { Injector } from './injector';
3
+ export function injectable(Clazz) {
4
+ const { deps, providers } = Clazz;
5
+ return class InjectableElement extends Clazz {
6
+ constructor(...args) {
7
+ if (args.length || !deps.length) {
8
+ super(...args);
9
+ }
10
+ else {
11
+ const i = new Injector({ providers }, getEnvironmentRef());
12
+ super(...deps.map((dep) => i.get(dep)));
13
+ }
14
+ }
15
+ };
16
+ }
17
+ //# sourceMappingURL=injectable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"injectable.js","sourceRoot":"","sources":["../../../lib/injectable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAUtC,MAAM,UAAU,UAAU,CAAuB,KAAQ;IACvD,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAElC,OAAO,MAAM,iBAAkB,SAAQ,KAAK;QAC1C,YAAY,GAAG,IAAW;YACxB,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;gBAC/B,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;aAChB;iBAAM;gBACL,MAAM,CAAC,GAAG,IAAI,QAAQ,CAAC,EAAE,SAAS,EAAE,EAAE,iBAAiB,EAAE,CAAC,CAAC;gBAE3D,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;aACzC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,2 +1,2 @@
1
1
  import { ProviderToken } from '../lib/provider';
2
- export declare function service(): (provider: ProviderToken<any>) => void;
2
+ export declare function service(provider: ProviderToken<any>): any;
@@ -1,6 +1,5 @@
1
- export function service() {
2
- return function (provider) {
3
- Object.defineProperty(provider, 'provideInRoot', { value: true });
4
- };
1
+ export function service(provider) {
2
+ Object.defineProperty(provider, 'provideInRoot', { value: true });
3
+ return provider;
5
4
  }
6
5
  //# sourceMappingURL=service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"service.js","sourceRoot":"","sources":["../../../lib/service.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,OAAO;IACrB,OAAO,UAAU,QAA4B;QAC3C,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACpE,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../../../lib/service.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,OAAO,CAAC,QAA4B;IAClD,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAElE,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -2,4 +2,5 @@ export { Injector, InjectorOptions } from './lib/injector';
2
2
  export { Provider, ProviderToken } from './lib/provider';
3
3
  export { readProviderDeps } from './lib/utils';
4
4
  export { service } from './lib/service';
5
- export { inject } from './lib/inject';
5
+ export { getEnvironmentRef, defineEnvironment } from './lib/environment';
6
+ export { injectable } from './lib/injectable';
@@ -1,5 +1,6 @@
1
1
  export { Injector } from './lib/injector';
2
2
  export { readProviderDeps } from './lib/utils';
3
3
  export { service } from './lib/service';
4
- export { inject } from './lib/inject';
4
+ export { getEnvironmentRef, defineEnvironment } from './lib/environment';
5
+ export { injectable } from './lib/injectable';
5
6
  //# sourceMappingURL=lib.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lib.js","sourceRoot":"","sources":["../../lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"lib.js","sourceRoot":"","sources":["../../lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
package/dom/package.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "main": "../target/build/lib/dom.js",
3
- "module": "../target/build/lib/dom.js"
4
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"environment.js","sourceRoot":"","sources":["../../../../lib/dom/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,IAAI,YAAY,GAAoB,IAAI,CAAC;AAEzC,MAAM,UAAU,iBAAiB,CAAC,YAA6B,EAAE;IAC/D,YAAY,GAAG,IAAI,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;IAE3C,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,IAAI,YAAY,EAAE;QAChB,OAAO,YAAY,CAAC;KACrB;IAED,OAAO,iBAAiB,EAAE,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,YAAY,GAAG,IAAI,CAAC;AACtB,CAAC"}
@@ -1,311 +0,0 @@
1
- import { Provider } from '../provider';
2
- export interface InjectableConfig {
3
- providers: Provider<any>[];
4
- }
5
- export interface Injectable {
6
- [key: string | symbol]: any;
7
- new (...args: any[]): HTMLElement;
8
- }
9
- export declare function injectable({ providers }?: InjectableConfig): <T extends Injectable>(CustomElement: T) => {
10
- new (...args: any[]): {
11
- accessKey: string;
12
- readonly accessKeyLabel: string;
13
- autocapitalize: string;
14
- dir: string;
15
- draggable: boolean;
16
- hidden: boolean;
17
- innerText: string;
18
- lang: string;
19
- readonly offsetHeight: number;
20
- readonly offsetLeft: number;
21
- readonly offsetParent: Element | null;
22
- readonly offsetTop: number;
23
- readonly offsetWidth: number;
24
- outerText: string;
25
- spellcheck: boolean;
26
- title: string;
27
- translate: boolean;
28
- attachInternals(): ElementInternals;
29
- click(): void;
30
- addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void;
31
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
32
- removeEventListener<K_1 extends keyof HTMLElementEventMap>(type: K_1, listener: (this: HTMLElement, ev: HTMLElementEventMap[K_1]) => any, options?: boolean | EventListenerOptions | undefined): void;
33
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
34
- readonly attributes: NamedNodeMap;
35
- readonly classList: DOMTokenList;
36
- className: string;
37
- readonly clientHeight: number;
38
- readonly clientLeft: number;
39
- readonly clientTop: number;
40
- readonly clientWidth: number;
41
- id: string;
42
- readonly localName: string;
43
- readonly namespaceURI: string | null;
44
- onfullscreenchange: ((this: Element, ev: Event) => any) | null;
45
- onfullscreenerror: ((this: Element, ev: Event) => any) | null;
46
- outerHTML: string;
47
- readonly ownerDocument: Document;
48
- readonly part: DOMTokenList;
49
- readonly prefix: string | null;
50
- readonly scrollHeight: number;
51
- scrollLeft: number;
52
- scrollTop: number;
53
- readonly scrollWidth: number;
54
- readonly shadowRoot: ShadowRoot | null;
55
- slot: string;
56
- readonly tagName: string;
57
- attachShadow(init: ShadowRootInit): ShadowRoot;
58
- closest<K_2 extends keyof HTMLElementTagNameMap>(selector: K_2): HTMLElementTagNameMap[K_2] | null;
59
- closest<K_3 extends keyof SVGElementTagNameMap>(selector: K_3): SVGElementTagNameMap[K_3] | null;
60
- closest<E extends Element = Element>(selectors: string): E | null;
61
- getAttribute(qualifiedName: string): string | null;
62
- getAttributeNS(namespace: string | null, localName: string): string | null;
63
- getAttributeNames(): string[];
64
- getAttributeNode(qualifiedName: string): Attr | null;
65
- getAttributeNodeNS(namespace: string | null, localName: string): Attr | null;
66
- getBoundingClientRect(): DOMRect;
67
- getClientRects(): DOMRectList;
68
- getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
69
- getElementsByTagName<K_4 extends keyof HTMLElementTagNameMap>(qualifiedName: K_4): HTMLCollectionOf<HTMLElementTagNameMap[K_4]>;
70
- getElementsByTagName<K_5 extends keyof SVGElementTagNameMap>(qualifiedName: K_5): HTMLCollectionOf<SVGElementTagNameMap[K_5]>;
71
- getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
72
- getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
73
- getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
74
- getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf<Element>;
75
- hasAttribute(qualifiedName: string): boolean;
76
- hasAttributeNS(namespace: string | null, localName: string): boolean;
77
- hasAttributes(): boolean;
78
- hasPointerCapture(pointerId: number): boolean;
79
- insertAdjacentElement(where: InsertPosition, element: Element): Element | null;
80
- insertAdjacentHTML(position: InsertPosition, text: string): void;
81
- insertAdjacentText(where: InsertPosition, data: string): void;
82
- matches(selectors: string): boolean;
83
- releasePointerCapture(pointerId: number): void;
84
- removeAttribute(qualifiedName: string): void;
85
- removeAttributeNS(namespace: string | null, localName: string): void;
86
- removeAttributeNode(attr: Attr): Attr;
87
- requestFullscreen(options?: FullscreenOptions | undefined): Promise<void>;
88
- requestPointerLock(): void;
89
- scroll(options?: ScrollToOptions | undefined): void;
90
- scroll(x: number, y: number): void;
91
- scrollBy(options?: ScrollToOptions | undefined): void;
92
- scrollBy(x: number, y: number): void;
93
- scrollIntoView(arg?: boolean | ScrollIntoViewOptions | undefined): void;
94
- scrollTo(options?: ScrollToOptions | undefined): void;
95
- scrollTo(x: number, y: number): void;
96
- setAttribute(qualifiedName: string, value: string): void;
97
- setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
98
- setAttributeNode(attr: Attr): Attr | null;
99
- setAttributeNodeNS(attr: Attr): Attr | null;
100
- setPointerCapture(pointerId: number): void;
101
- toggleAttribute(qualifiedName: string, force?: boolean | undefined): boolean;
102
- webkitMatchesSelector(selectors: string): boolean;
103
- readonly baseURI: string;
104
- readonly childNodes: NodeListOf<ChildNode>;
105
- readonly firstChild: ChildNode | null;
106
- readonly isConnected: boolean;
107
- readonly lastChild: ChildNode | null;
108
- readonly nextSibling: ChildNode | null;
109
- readonly nodeName: string;
110
- readonly nodeType: number;
111
- nodeValue: string | null;
112
- readonly parentElement: HTMLElement | null;
113
- readonly parentNode: ParentNode | null;
114
- readonly previousSibling: ChildNode | null;
115
- textContent: string | null;
116
- appendChild<T_1 extends Node>(node: T_1): T_1;
117
- cloneNode(deep?: boolean | undefined): Node;
118
- compareDocumentPosition(other: Node): number;
119
- contains(other: Node | null): boolean;
120
- getRootNode(options?: GetRootNodeOptions | undefined): Node;
121
- hasChildNodes(): boolean;
122
- insertBefore<T_2 extends Node>(node: T_2, child: Node | null): T_2;
123
- isDefaultNamespace(namespace: string | null): boolean;
124
- isEqualNode(otherNode: Node | null): boolean;
125
- isSameNode(otherNode: Node | null): boolean;
126
- lookupNamespaceURI(prefix: string | null): string | null;
127
- lookupPrefix(namespace: string | null): string | null;
128
- normalize(): void;
129
- removeChild<T_3 extends Node>(child: T_3): T_3;
130
- replaceChild<T_4 extends Node>(node: Node, child: T_4): T_4;
131
- readonly ATTRIBUTE_NODE: number;
132
- readonly CDATA_SECTION_NODE: number;
133
- readonly COMMENT_NODE: number;
134
- readonly DOCUMENT_FRAGMENT_NODE: number;
135
- readonly DOCUMENT_NODE: number;
136
- readonly DOCUMENT_POSITION_CONTAINED_BY: number;
137
- readonly DOCUMENT_POSITION_CONTAINS: number;
138
- readonly DOCUMENT_POSITION_DISCONNECTED: number;
139
- readonly DOCUMENT_POSITION_FOLLOWING: number;
140
- readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;
141
- readonly DOCUMENT_POSITION_PRECEDING: number;
142
- readonly DOCUMENT_TYPE_NODE: number;
143
- readonly ELEMENT_NODE: number;
144
- readonly ENTITY_NODE: number;
145
- readonly ENTITY_REFERENCE_NODE: number;
146
- readonly NOTATION_NODE: number;
147
- readonly PROCESSING_INSTRUCTION_NODE: number;
148
- readonly TEXT_NODE: number;
149
- dispatchEvent(event: Event): boolean;
150
- ariaAtomic: string;
151
- ariaAutoComplete: string;
152
- ariaBusy: string;
153
- ariaChecked: string;
154
- ariaColCount: string;
155
- ariaColIndex: string;
156
- ariaColSpan: string;
157
- ariaCurrent: string;
158
- ariaDisabled: string;
159
- ariaExpanded: string;
160
- ariaHasPopup: string;
161
- ariaHidden: string;
162
- ariaKeyShortcuts: string;
163
- ariaLabel: string;
164
- ariaLevel: string;
165
- ariaLive: string;
166
- ariaModal: string;
167
- ariaMultiLine: string;
168
- ariaMultiSelectable: string;
169
- ariaOrientation: string;
170
- ariaPlaceholder: string;
171
- ariaPosInSet: string;
172
- ariaPressed: string;
173
- ariaReadOnly: string;
174
- ariaRequired: string;
175
- ariaRoleDescription: string;
176
- ariaRowCount: string;
177
- ariaRowIndex: string;
178
- ariaRowSpan: string;
179
- ariaSelected: string;
180
- ariaSetSize: string;
181
- ariaSort: string;
182
- ariaValueMax: string;
183
- ariaValueMin: string;
184
- ariaValueNow: string;
185
- ariaValueText: string;
186
- animate(keyframes: PropertyIndexedKeyframes | Keyframe[] | null, options?: number | KeyframeAnimationOptions | undefined): Animation;
187
- getAnimations(options?: GetAnimationsOptions | undefined): Animation[];
188
- after(...nodes: (string | Node)[]): void;
189
- before(...nodes: (string | Node)[]): void;
190
- remove(): void;
191
- replaceWith(...nodes: (string | Node)[]): void;
192
- innerHTML: string;
193
- readonly nextElementSibling: Element | null;
194
- readonly previousElementSibling: Element | null;
195
- readonly childElementCount: number;
196
- readonly children: HTMLCollection;
197
- readonly firstElementChild: Element | null;
198
- readonly lastElementChild: Element | null;
199
- append(...nodes: (string | Node)[]): void;
200
- prepend(...nodes: (string | Node)[]): void;
201
- querySelector<K_6 extends keyof HTMLElementTagNameMap>(selectors: K_6): HTMLElementTagNameMap[K_6] | null;
202
- querySelector<K_7 extends keyof SVGElementTagNameMap>(selectors: K_7): SVGElementTagNameMap[K_7] | null;
203
- querySelector<E_1 extends Element = Element>(selectors: string): E_1 | null;
204
- querySelectorAll<K_8 extends keyof HTMLElementTagNameMap>(selectors: K_8): NodeListOf<HTMLElementTagNameMap[K_8]>;
205
- querySelectorAll<K_9 extends keyof SVGElementTagNameMap>(selectors: K_9): NodeListOf<SVGElementTagNameMap[K_9]>;
206
- querySelectorAll<E_2 extends Element = Element>(selectors: string): NodeListOf<E_2>;
207
- replaceChildren(...nodes: (string | Node)[]): void;
208
- readonly assignedSlot: HTMLSlotElement | null;
209
- oncopy: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
210
- oncut: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
211
- onpaste: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
212
- readonly style: CSSStyleDeclaration;
213
- contentEditable: string;
214
- enterKeyHint: string;
215
- inputMode: string;
216
- readonly isContentEditable: boolean;
217
- onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
218
- onanimationcancel: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
219
- onanimationend: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
220
- onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
221
- onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
222
- onauxclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
223
- onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
224
- oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
225
- oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null;
226
- onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
227
- onclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
228
- onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null;
229
- oncontextmenu: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
230
- oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
231
- ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
232
- ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
233
- ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
234
- ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
235
- ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
236
- ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
237
- ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
238
- ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
239
- ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
240
- onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null;
241
- onended: ((this: GlobalEventHandlers, ev: Event) => any) | null;
242
- onerror: OnErrorEventHandler;
243
- onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
244
- onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null;
245
- ongotpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
246
- oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null;
247
- oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null;
248
- onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
249
- onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
250
- onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
251
- onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;
252
- onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
253
- onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
254
- onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
255
- onlostpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
256
- onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
257
- onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
258
- onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
259
- onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
260
- onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
261
- onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
262
- onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
263
- onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null;
264
- onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
265
- onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null;
266
- onpointercancel: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
267
- onpointerdown: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
268
- onpointerenter: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
269
- onpointerleave: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
270
- onpointermove: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
271
- onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
272
- onpointerover: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
273
- onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
274
- onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent<EventTarget>) => any) | null;
275
- onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
276
- onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null;
277
- onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
278
- onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null;
279
- onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null;
280
- onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null;
281
- onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null;
282
- onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
283
- onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
284
- onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null;
285
- onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null;
286
- onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
287
- ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
288
- ontoggle: ((this: GlobalEventHandlers, ev: Event) => any) | null;
289
- ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
290
- ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
291
- ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
292
- ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
293
- ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
294
- ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
295
- ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
296
- ontransitionstart: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
297
- onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
298
- onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null;
299
- onwebkitanimationend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
300
- onwebkitanimationiteration: ((this: GlobalEventHandlers, ev: Event) => any) | null;
301
- onwebkitanimationstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
302
- onwebkittransitionend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
303
- onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null;
304
- autofocus: boolean;
305
- readonly dataset: DOMStringMap;
306
- nonce?: string | undefined;
307
- tabIndex: number;
308
- blur(): void;
309
- focus(options?: FocusOptions | undefined): void;
310
- };
311
- } & T;
@@ -1,20 +0,0 @@
1
- import { getEnvironmentRef } from './environment';
2
- import { Injector } from '../injector';
3
- import { readProviderDeps } from '../utils';
4
- export function injectable({ providers } = { providers: [] }) {
5
- return (CustomElement) => {
6
- return class InjectableElement extends CustomElement {
7
- constructor(...args) {
8
- if (args.length) {
9
- super(...args);
10
- }
11
- else {
12
- const i = new Injector({ providers }, getEnvironmentRef());
13
- const deps = readProviderDeps(CustomElement).map((dep) => i.get(dep));
14
- super(...deps);
15
- }
16
- }
17
- };
18
- };
19
- }
20
- //# sourceMappingURL=injectable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"injectable.js","sourceRoot":"","sources":["../../../../lib/dom/injectable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAW5C,MAAM,UAAU,UAAU,CAAC,EAAE,SAAS,KAAuB,EAAE,SAAS,EAAE,EAAE,EAAE;IAC5E,OAAO,CAAuB,aAAgB,EAAE,EAAE;QAChD,OAAO,MAAM,iBAAkB,SAAQ,aAAa;YAClD,YAAY,GAAG,IAAW;gBACxB,IAAI,IAAI,CAAC,MAAM,EAAE;oBACf,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;iBAChB;qBAAM;oBACL,MAAM,CAAC,GAAG,IAAI,QAAQ,CAAC,EAAE,SAAS,EAAE,EAAE,iBAAiB,EAAE,CAAC,CAAC;oBAC3D,MAAM,IAAI,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;oBAEtE,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;iBAChB;YACH,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -1,2 +0,0 @@
1
- export { getEnvironmentRef, defineEnvironment } from './dom/environment';
2
- export { injectable, InjectableConfig } from './dom/injectable';
@@ -1,3 +0,0 @@
1
- export { getEnvironmentRef, defineEnvironment } from './dom/environment';
2
- export { injectable } from './dom/injectable';
3
- //# sourceMappingURL=dom.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dom.js","sourceRoot":"","sources":["../../../lib/dom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAoB,MAAM,kBAAkB,CAAC"}
@@ -1,2 +0,0 @@
1
- import { ProviderToken } from '../lib/provider';
2
- export declare function inject(injectable: ProviderToken<any>): (target: any, _: string, index: number) => void;
@@ -1,8 +0,0 @@
1
- import { PROVIDER_DEPS_KEY } from '../lib/utils';
2
- export function inject(injectable) {
3
- return function (target, _, index) {
4
- target[PROVIDER_DEPS_KEY] = target[PROVIDER_DEPS_KEY] || [];
5
- target[PROVIDER_DEPS_KEY][index] = injectable;
6
- };
7
- }
8
- //# sourceMappingURL=inject.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inject.js","sourceRoot":"","sources":["../../../lib/inject.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,UAAU,MAAM,CAAC,UAA8B;IACnD,OAAO,UAAU,MAAW,EAAE,CAAS,EAAE,KAAa;QACpD,MAAM,CAAC,iBAAiB,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;QAC5D,MAAM,CAAC,iBAAiB,CAAC,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC;IAChD,CAAC,CAAC;AACJ,CAAC"}