@rhtml/hooks 0.0.114 → 0.0.117

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/element.d.ts CHANGED
@@ -3,7 +3,7 @@ export interface HookElementOptions {
3
3
  observedAttributes: string[];
4
4
  shadowRoot?: boolean;
5
5
  }
6
- export declare const component: (renderFn: (e: HTMLElement) => TemplateResult, { observedAttributes, shadowRoot }?: HookElementOptions) => {
6
+ export declare const component: (renderFn: (e: HTMLElement) => TemplateResult, { observedAttributes, shadowRoot, }?: HookElementOptions) => {
7
7
  new (): {
8
8
  connectedCallback(): void;
9
9
  render(): void;
@@ -21,15 +21,16 @@ export declare const component: (renderFn: (e: HTMLElement) => TemplateResult, {
21
21
  readonly offsetParent: Element;
22
22
  readonly offsetTop: number;
23
23
  readonly offsetWidth: number;
24
+ outerText: string;
24
25
  spellcheck: boolean;
25
26
  title: string;
26
27
  translate: boolean;
28
+ attachInternals(): ElementInternals;
27
29
  click(): void;
28
- addEventListener<K extends "waiting" | "error" | "abort" | "cancel" | "progress" | "ended" | "input" | "select" | "fullscreenchange" | "fullscreenerror" | "animationcancel" | "animationend" | "animationiteration" | "animationstart" | "auxclick" | "blur" | "canplay" | "canplaythrough" | "change" | "click" | "close" | "contextmenu" | "cuechange" | "dblclick" | "drag" | "dragend" | "dragenter" | "dragexit" | "dragleave" | "dragover" | "dragstart" | "drop" | "durationchange" | "emptied" | "focus" | "focusin" | "focusout" | "gotpointercapture" | "invalid" | "keydown" | "keypress" | "keyup" | "load" | "loadeddata" | "loadedmetadata" | "loadstart" | "lostpointercapture" | "mousedown" | "mouseenter" | "mouseleave" | "mousemove" | "mouseout" | "mouseover" | "mouseup" | "pause" | "play" | "playing" | "pointercancel" | "pointerdown" | "pointerenter" | "pointerleave" | "pointermove" | "pointerout" | "pointerover" | "pointerup" | "ratechange" | "reset" | "resize" | "scroll" | "securitypolicyviolation" | "seeked" | "seeking" | "selectionchange" | "selectstart" | "stalled" | "submit" | "suspend" | "timeupdate" | "toggle" | "touchcancel" | "touchend" | "touchmove" | "touchstart" | "transitioncancel" | "transitionend" | "transitionrun" | "transitionstart" | "volumechange" | "wheel" | "copy" | "cut" | "paste">(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
30
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
29
31
  addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
30
- removeEventListener<K_1 extends "waiting" | "error" | "abort" | "cancel" | "progress" | "ended" | "input" | "select" | "fullscreenchange" | "fullscreenerror" | "animationcancel" | "animationend" | "animationiteration" | "animationstart" | "auxclick" | "blur" | "canplay" | "canplaythrough" | "change" | "click" | "close" | "contextmenu" | "cuechange" | "dblclick" | "drag" | "dragend" | "dragenter" | "dragexit" | "dragleave" | "dragover" | "dragstart" | "drop" | "durationchange" | "emptied" | "focus" | "focusin" | "focusout" | "gotpointercapture" | "invalid" | "keydown" | "keypress" | "keyup" | "load" | "loadeddata" | "loadedmetadata" | "loadstart" | "lostpointercapture" | "mousedown" | "mouseenter" | "mouseleave" | "mousemove" | "mouseout" | "mouseover" | "mouseup" | "pause" | "play" | "playing" | "pointercancel" | "pointerdown" | "pointerenter" | "pointerleave" | "pointermove" | "pointerout" | "pointerover" | "pointerup" | "ratechange" | "reset" | "resize" | "scroll" | "securitypolicyviolation" | "seeked" | "seeking" | "selectionchange" | "selectstart" | "stalled" | "submit" | "suspend" | "timeupdate" | "toggle" | "touchcancel" | "touchend" | "touchmove" | "touchstart" | "transitioncancel" | "transitionend" | "transitionrun" | "transitionstart" | "volumechange" | "wheel" | "copy" | "cut" | "paste">(type: K_1, listener: (this: HTMLElement, ev: HTMLElementEventMap[K_1]) => any, options?: boolean | EventListenerOptions): void;
32
+ removeEventListener<K_1 extends keyof HTMLElementEventMap>(type: K_1, listener: (this: HTMLElement, ev: HTMLElementEventMap[K_1]) => any, options?: boolean | EventListenerOptions): void;
31
33
  removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
32
- readonly assignedSlot: HTMLSlotElement;
33
34
  readonly attributes: NamedNodeMap;
34
35
  readonly classList: DOMTokenList;
35
36
  className: string;
@@ -44,6 +45,7 @@ export declare const component: (renderFn: (e: HTMLElement) => TemplateResult, {
44
45
  onfullscreenerror: (this: Element, ev: Event) => any;
45
46
  outerHTML: string;
46
47
  readonly ownerDocument: Document;
48
+ readonly part: DOMTokenList;
47
49
  readonly prefix: string;
48
50
  readonly scrollHeight: number;
49
51
  scrollLeft: number;
@@ -53,32 +55,31 @@ export declare const component: (renderFn: (e: HTMLElement) => TemplateResult, {
53
55
  slot: string;
54
56
  readonly tagName: string;
55
57
  attachShadow(init: ShadowRootInit): ShadowRoot;
56
- closest<K_2 extends "object" | "link" | "small" | "sub" | "sup" | "track" | "progress" | "a" | "abbr" | "address" | "applet" | "area" | "article" | "aside" | "audio" | "b" | "base" | "basefont" | "bdi" | "bdo" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "dir" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "font" | "footer" | "form" | "frame" | "frameset" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "label" | "legend" | "li" | "main" | "map" | "mark" | "marquee" | "menu" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "source" | "span" | "strong" | "style" | "summary" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "u" | "ul" | "var" | "video" | "wbr">(selector: K_2): HTMLElementTagNameMap[K_2];
57
- closest<K_3 extends "symbol" | "a" | "script" | "style" | "title" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "svg" | "switch" | "text" | "textPath" | "tspan" | "use" | "view">(selector: K_3): SVGElementTagNameMap[K_3];
58
- closest<E extends Element = Element>(selector: string): E;
58
+ closest<K_2 extends keyof HTMLElementTagNameMap>(selector: K_2): HTMLElementTagNameMap[K_2];
59
+ closest<K_3 extends keyof SVGElementTagNameMap>(selector: K_3): SVGElementTagNameMap[K_3];
60
+ closest<E extends Element = Element>(selectors: string): E;
59
61
  getAttribute(qualifiedName: string): string;
60
62
  getAttributeNS(namespace: string, localName: string): string;
61
63
  getAttributeNames(): string[];
62
- getAttributeNode(name: string): Attr;
63
- getAttributeNodeNS(namespaceURI: string, localName: string): Attr;
64
+ getAttributeNode(qualifiedName: string): Attr;
65
+ getAttributeNodeNS(namespace: string, localName: string): Attr;
64
66
  getBoundingClientRect(): DOMRect;
65
67
  getClientRects(): DOMRectList;
66
68
  getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
67
- getElementsByTagName<K_4 extends "object" | "link" | "small" | "sub" | "sup" | "track" | "progress" | "a" | "abbr" | "address" | "applet" | "area" | "article" | "aside" | "audio" | "b" | "base" | "basefont" | "bdi" | "bdo" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "dir" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "font" | "footer" | "form" | "frame" | "frameset" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "label" | "legend" | "li" | "main" | "map" | "mark" | "marquee" | "menu" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "source" | "span" | "strong" | "style" | "summary" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "u" | "ul" | "var" | "video" | "wbr">(qualifiedName: K_4): HTMLCollectionOf<HTMLElementTagNameMap[K_4]>;
68
- getElementsByTagName<K_5 extends "symbol" | "a" | "script" | "style" | "title" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "svg" | "switch" | "text" | "textPath" | "tspan" | "use" | "view">(qualifiedName: K_5): HTMLCollectionOf<SVGElementTagNameMap[K_5]>;
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]>;
69
71
  getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
70
72
  getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
71
73
  getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
72
- getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf<Element>;
74
+ getElementsByTagNameNS(namespace: string, localName: string): HTMLCollectionOf<Element>;
73
75
  hasAttribute(qualifiedName: string): boolean;
74
76
  hasAttributeNS(namespace: string, localName: string): boolean;
75
77
  hasAttributes(): boolean;
76
78
  hasPointerCapture(pointerId: number): boolean;
77
- insertAdjacentElement(position: InsertPosition, insertedElement: Element): Element;
78
- insertAdjacentHTML(where: InsertPosition, html: string): void;
79
- insertAdjacentText(where: InsertPosition, text: string): void;
79
+ insertAdjacentElement(where: InsertPosition, element: Element): Element;
80
+ insertAdjacentHTML(position: InsertPosition, text: string): void;
81
+ insertAdjacentText(where: InsertPosition, data: string): void;
80
82
  matches(selectors: string): boolean;
81
- msGetRegionContent(): any;
82
83
  releasePointerCapture(pointerId: number): void;
83
84
  removeAttribute(qualifiedName: string): void;
84
85
  removeAttributeNS(namespace: string, localName: string): void;
@@ -109,24 +110,24 @@ export declare const component: (renderFn: (e: HTMLElement) => TemplateResult, {
109
110
  readonly nodeType: number;
110
111
  nodeValue: string;
111
112
  readonly parentElement: HTMLElement;
112
- readonly parentNode: Node & ParentNode;
113
+ readonly parentNode: ParentNode;
113
114
  readonly previousSibling: ChildNode;
114
115
  textContent: string;
115
- appendChild<T extends Node>(newChild: T): T;
116
+ appendChild<T extends Node>(node: T): T;
116
117
  cloneNode(deep?: boolean): Node;
117
118
  compareDocumentPosition(other: Node): number;
118
119
  contains(other: Node): boolean;
119
120
  getRootNode(options?: GetRootNodeOptions): Node;
120
121
  hasChildNodes(): boolean;
121
- insertBefore<T_1 extends Node>(newChild: T_1, refChild: Node): T_1;
122
+ insertBefore<T_1 extends Node>(node: T_1, child: Node): T_1;
122
123
  isDefaultNamespace(namespace: string): boolean;
123
124
  isEqualNode(otherNode: Node): boolean;
124
125
  isSameNode(otherNode: Node): boolean;
125
126
  lookupNamespaceURI(prefix: string): string;
126
127
  lookupPrefix(namespace: string): string;
127
128
  normalize(): void;
128
- removeChild<T_2 extends Node>(oldChild: T_2): T_2;
129
- replaceChild<T_3 extends Node>(newChild: Node, oldChild: T_3): T_3;
129
+ removeChild<T_2 extends Node>(child: T_2): T_2;
130
+ replaceChild<T_3 extends Node>(node: Node, child: T_3): T_3;
130
131
  readonly ATTRIBUTE_NODE: number;
131
132
  readonly CDATA_SECTION_NODE: number;
132
133
  readonly COMMENT_NODE: number;
@@ -146,8 +147,44 @@ export declare const component: (renderFn: (e: HTMLElement) => TemplateResult, {
146
147
  readonly PROCESSING_INSTRUCTION_NODE: number;
147
148
  readonly TEXT_NODE: number;
148
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;
149
186
  animate(keyframes: PropertyIndexedKeyframes | Keyframe[], options?: number | KeyframeAnimationOptions): Animation;
150
- getAnimations(): Animation[];
187
+ getAnimations(options?: GetAnimationsOptions): Animation[];
151
188
  after(...nodes: (string | Node)[]): void;
152
189
  before(...nodes: (string | Node)[]): void;
153
190
  remove(): void;
@@ -161,17 +198,20 @@ export declare const component: (renderFn: (e: HTMLElement) => TemplateResult, {
161
198
  readonly lastElementChild: Element;
162
199
  append(...nodes: (string | Node)[]): void;
163
200
  prepend(...nodes: (string | Node)[]): void;
164
- querySelector<K_6 extends "object" | "link" | "small" | "sub" | "sup" | "track" | "progress" | "a" | "abbr" | "address" | "applet" | "area" | "article" | "aside" | "audio" | "b" | "base" | "basefont" | "bdi" | "bdo" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "dir" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "font" | "footer" | "form" | "frame" | "frameset" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "label" | "legend" | "li" | "main" | "map" | "mark" | "marquee" | "menu" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "source" | "span" | "strong" | "style" | "summary" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "u" | "ul" | "var" | "video" | "wbr">(selectors: K_6): HTMLElementTagNameMap[K_6];
165
- querySelector<K_7 extends "symbol" | "a" | "script" | "style" | "title" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "svg" | "switch" | "text" | "textPath" | "tspan" | "use" | "view">(selectors: K_7): SVGElementTagNameMap[K_7];
201
+ querySelector<K_6 extends keyof HTMLElementTagNameMap>(selectors: K_6): HTMLElementTagNameMap[K_6];
202
+ querySelector<K_7 extends keyof SVGElementTagNameMap>(selectors: K_7): SVGElementTagNameMap[K_7];
166
203
  querySelector<E_1 extends Element = Element>(selectors: string): E_1;
167
- querySelectorAll<K_8 extends "object" | "link" | "small" | "sub" | "sup" | "track" | "progress" | "a" | "abbr" | "address" | "applet" | "area" | "article" | "aside" | "audio" | "b" | "base" | "basefont" | "bdi" | "bdo" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "dir" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "font" | "footer" | "form" | "frame" | "frameset" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "label" | "legend" | "li" | "main" | "map" | "mark" | "marquee" | "menu" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "source" | "span" | "strong" | "style" | "summary" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "u" | "ul" | "var" | "video" | "wbr">(selectors: K_8): NodeListOf<HTMLElementTagNameMap[K_8]>;
168
- querySelectorAll<K_9 extends "symbol" | "a" | "script" | "style" | "title" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "svg" | "switch" | "text" | "textPath" | "tspan" | "use" | "view">(selectors: K_9): NodeListOf<SVGElementTagNameMap[K_9]>;
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]>;
169
206
  querySelectorAll<E_2 extends Element = Element>(selectors: string): NodeListOf<E_2>;
207
+ replaceChildren(...nodes: (string | Node)[]): void;
208
+ readonly assignedSlot: HTMLSlotElement;
170
209
  oncopy: (this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any;
171
210
  oncut: (this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any;
172
211
  onpaste: (this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any;
173
212
  readonly style: CSSStyleDeclaration;
174
213
  contentEditable: string;
214
+ enterKeyHint: string;
175
215
  inputMode: string;
176
216
  readonly isContentEditable: boolean;
177
217
  onabort: (this: GlobalEventHandlers, ev: UIEvent) => any;
@@ -181,7 +221,6 @@ export declare const component: (renderFn: (e: HTMLElement) => TemplateResult, {
181
221
  onanimationstart: (this: GlobalEventHandlers, ev: AnimationEvent) => any;
182
222
  onauxclick: (this: GlobalEventHandlers, ev: MouseEvent) => any;
183
223
  onblur: (this: GlobalEventHandlers, ev: FocusEvent) => any;
184
- oncancel: (this: GlobalEventHandlers, ev: Event) => any;
185
224
  oncanplay: (this: GlobalEventHandlers, ev: Event) => any;
186
225
  oncanplaythrough: (this: GlobalEventHandlers, ev: Event) => any;
187
226
  onchange: (this: GlobalEventHandlers, ev: Event) => any;
@@ -193,7 +232,6 @@ export declare const component: (renderFn: (e: HTMLElement) => TemplateResult, {
193
232
  ondrag: (this: GlobalEventHandlers, ev: DragEvent) => any;
194
233
  ondragend: (this: GlobalEventHandlers, ev: DragEvent) => any;
195
234
  ondragenter: (this: GlobalEventHandlers, ev: DragEvent) => any;
196
- ondragexit: (this: GlobalEventHandlers, ev: Event) => any;
197
235
  ondragleave: (this: GlobalEventHandlers, ev: DragEvent) => any;
198
236
  ondragover: (this: GlobalEventHandlers, ev: DragEvent) => any;
199
237
  ondragstart: (this: GlobalEventHandlers, ev: DragEvent) => any;
@@ -203,6 +241,7 @@ export declare const component: (renderFn: (e: HTMLElement) => TemplateResult, {
203
241
  onended: (this: GlobalEventHandlers, ev: Event) => any;
204
242
  onerror: OnErrorEventHandlerNonNull;
205
243
  onfocus: (this: GlobalEventHandlers, ev: FocusEvent) => any;
244
+ onformdata: (this: GlobalEventHandlers, ev: FormDataEvent) => any;
206
245
  ongotpointercapture: (this: GlobalEventHandlers, ev: PointerEvent) => any;
207
246
  oninput: (this: GlobalEventHandlers, ev: Event) => any;
208
247
  oninvalid: (this: GlobalEventHandlers, ev: Event) => any;
@@ -243,8 +282,9 @@ export declare const component: (renderFn: (e: HTMLElement) => TemplateResult, {
243
282
  onselect: (this: GlobalEventHandlers, ev: Event) => any;
244
283
  onselectionchange: (this: GlobalEventHandlers, ev: Event) => any;
245
284
  onselectstart: (this: GlobalEventHandlers, ev: Event) => any;
285
+ onslotchange: (this: GlobalEventHandlers, ev: Event) => any;
246
286
  onstalled: (this: GlobalEventHandlers, ev: Event) => any;
247
- onsubmit: (this: GlobalEventHandlers, ev: Event) => any;
287
+ onsubmit: (this: GlobalEventHandlers, ev: SubmitEvent) => any;
248
288
  onsuspend: (this: GlobalEventHandlers, ev: Event) => any;
249
289
  ontimeupdate: (this: GlobalEventHandlers, ev: Event) => any;
250
290
  ontoggle: (this: GlobalEventHandlers, ev: Event) => any;
@@ -258,6 +298,10 @@ export declare const component: (renderFn: (e: HTMLElement) => TemplateResult, {
258
298
  ontransitionstart: (this: GlobalEventHandlers, ev: TransitionEvent) => any;
259
299
  onvolumechange: (this: GlobalEventHandlers, ev: Event) => any;
260
300
  onwaiting: (this: GlobalEventHandlers, ev: Event) => any;
301
+ onwebkitanimationend: (this: GlobalEventHandlers, ev: Event) => any;
302
+ onwebkitanimationiteration: (this: GlobalEventHandlers, ev: Event) => any;
303
+ onwebkitanimationstart: (this: GlobalEventHandlers, ev: Event) => any;
304
+ onwebkittransitionend: (this: GlobalEventHandlers, ev: Event) => any;
261
305
  onwheel: (this: GlobalEventHandlers, ev: WheelEvent) => any;
262
306
  autofocus: boolean;
263
307
  readonly dataset: DOMStringMap;
package/dist/element.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.component = void 0;
4
4
  const lit_html_1 = require("@rxdi/lit-html");
5
5
  const hooks_core_1 = require("./hooks-core");
6
- exports.component = (renderFn, { observedAttributes, shadowRoot } = {}) => class extends HTMLElement {
6
+ const component = (renderFn, { observedAttributes, shadowRoot, } = {}) => class extends HTMLElement {
7
7
  static get observedAttributes() {
8
8
  return observedAttributes || [];
9
9
  }
@@ -14,10 +14,11 @@ exports.component = (renderFn, { observedAttributes, shadowRoot } = {}) => class
14
14
  this.render();
15
15
  }
16
16
  render() {
17
- lit_html_1.render(hooks_core_1.renderWithHooks(this, renderFn, this.render.bind(this)), shadowRoot ? this.shadowRoot : this);
17
+ (0, lit_html_1.render)((0, hooks_core_1.renderWithHooks)(this, renderFn, this.render.bind(this)), shadowRoot ? this.shadowRoot : this);
18
18
  }
19
19
  attributeChangedCallback(name, oldValue, newValue) {
20
20
  console.log(`Value ${name} changed from ${oldValue} to ${newValue}`);
21
21
  }
22
22
  };
23
+ exports.component = component;
23
24
  //# sourceMappingURL=element.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"element.js","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":";;;AAAA,6CAAwD;AAExD,6CAA+C;AAOlC,QAAA,SAAS,GAAG,CACvB,QAA4C,EAC5C,EACE,kBAAkB,EAClB,UAAU,KACY,EAAwB,EAChD,EAAE,CACF,KAAM,SAAQ,WAAW;IACvB,MAAM,KAAK,kBAAkB;QAC3B,OAAO,kBAAkB,IAAI,EAAE,CAAC;IAClC,CAAC;IACD,iBAAiB;QACf,IAAI,UAAU,EAAE;YACd,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;SACrC;QACD,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IACD,MAAM;QACJ,iBAAM,CACJ,4BAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EACvD,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CACpC,CAAC;IACJ,CAAC;IACD,wBAAwB,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ;QAC/C,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,iBAAiB,QAAQ,OAAO,QAAQ,EAAE,CAAC,CAAC;IACvE,CAAC;CACF,CAAC"}
1
+ {"version":3,"file":"element.js","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":";;;AAAA,6CAAwD;AAExD,6CAA+C;AAOxC,MAAM,SAAS,GAAG,CACvB,QAA4C,EAC5C,EACE,kBAAkB,EAClB,UAAU,MACY,EAAwB,EAChD,EAAE,CACF,KAAM,SAAQ,WAAW;IACvB,MAAM,KAAK,kBAAkB;QAC3B,OAAO,kBAAkB,IAAI,EAAE,CAAC;IAClC,CAAC;IACD,iBAAiB;QACf,IAAI,UAAU,EAAE;YACd,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;SACrC;QACD,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IACD,MAAM;QACJ,IAAA,iBAAM,EACJ,IAAA,4BAAe,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EACvD,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CACpC,CAAC;IACJ,CAAC;IACD,wBAAwB,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ;QAC/C,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,iBAAiB,QAAQ,OAAO,QAAQ,EAAE,CAAC,CAAC;IACvE,CAAC;CACF,CAAC;AA1BS,QAAA,SAAS,aA0BlB"}
@@ -2,9 +2,9 @@ export interface HookState {
2
2
  element: HTMLElement;
3
3
  renderIsInProgress: boolean;
4
4
  hooksExecutedThisRender: number;
5
- elementUpdateFn: Function;
5
+ elementUpdateFn: () => void;
6
6
  }
7
- export declare const renderWithHooks: (element: HTMLElement, templateFn: Function, elementUpdateFn: Function) => any;
7
+ export declare const renderWithHooks: (element: HTMLElement, templateFn: (element: HTMLElement) => unknown, elementUpdateFn: () => void) => unknown;
8
8
  export declare const getCurrentElement: () => HTMLElement;
9
- export declare const getElementUpdateFn: () => Function;
9
+ export declare const getElementUpdateFn: () => () => void;
10
10
  export declare const registerHook: (name?: string) => [HTMLElement, number];
@@ -7,7 +7,7 @@ const OnRender = (element, elementUpdateFn) => {
7
7
  element,
8
8
  renderIsInProgress: true,
9
9
  hooksExecutedThisRender: 0,
10
- elementUpdateFn
10
+ elementUpdateFn,
11
11
  };
12
12
  };
13
13
  const OnEndRender = () => {
@@ -15,22 +15,26 @@ const OnEndRender = () => {
15
15
  element: null,
16
16
  renderIsInProgress: false,
17
17
  hooksExecutedThisRender: 0,
18
- elementUpdateFn: null
18
+ elementUpdateFn: null,
19
19
  };
20
20
  };
21
- exports.renderWithHooks = (element, templateFn, elementUpdateFn) => {
21
+ const renderWithHooks = (element, templateFn, elementUpdateFn) => {
22
22
  OnRender(element, elementUpdateFn);
23
23
  const template = templateFn(element);
24
24
  OnEndRender();
25
25
  return template;
26
26
  };
27
- exports.getCurrentElement = () => hooksState.element;
28
- exports.getElementUpdateFn = () => hooksState.elementUpdateFn;
29
- exports.registerHook = (name) => {
27
+ exports.renderWithHooks = renderWithHooks;
28
+ const getCurrentElement = () => hooksState.element;
29
+ exports.getCurrentElement = getCurrentElement;
30
+ const getElementUpdateFn = () => hooksState.elementUpdateFn;
31
+ exports.getElementUpdateFn = getElementUpdateFn;
32
+ const registerHook = (name) => {
30
33
  if (!hooksState.renderIsInProgress) {
31
34
  throw new Error(`Hooks must be called from within an element's render() method. ${name} was not.`);
32
35
  }
33
36
  const hookId = hooksState.hooksExecutedThisRender++;
34
37
  return [hooksState.element, hookId];
35
38
  };
39
+ exports.registerHook = registerHook;
36
40
  //# sourceMappingURL=hooks-core.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks-core.js","sourceRoot":"","sources":["../src/hooks-core.ts"],"names":[],"mappings":";;;AAOA,IAAI,UAAqB,CAAC;AAE1B,MAAM,QAAQ,GAAG,CAAC,OAAoB,EAAE,eAAyB,EAAE,EAAE;IACnE,UAAU,GAAG;QACX,OAAO;QACP,kBAAkB,EAAE,IAAI;QACxB,uBAAuB,EAAE,CAAC;QAC1B,eAAe;KAChB,CAAC;AACJ,CAAC,CAAC;AA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,kBAAkB,EAAE,KAAK;QACzB,uBAAuB,EAAE,CAAC;QAC1B,eAAe,EAAE,IAAI;KACtB,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,eAAe,GAAG,CAC7B,OAAoB,EACpB,UAA6C,EAC7C,eAA2B,EAC3B,EAAE;IACF,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACnC,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACrC,WAAW,EAAE,CAAC;IACd,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AATW,QAAA,eAAe,mBAS1B;AAEK,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;AAA7C,QAAA,iBAAiB,qBAA4B;AAEnD,MAAM,kBAAkB,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC;AAAtD,QAAA,kBAAkB,sBAAoC;AAE5D,MAAM,YAAY,GAAG,CAAC,IAAa,EAAyB,EAAE;IACnE,IAAI,CAAC,UAAU,CAAC,kBAAkB,EAAE;QAClC,MAAM,IAAI,KAAK,CACb,kEAAkE,IAAI,WAAW,CAClF,CAAC;KACH;IACD,MAAM,MAAM,GAAG,UAAU,CAAC,uBAAuB,EAAE,CAAC;IACpD,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACtC,CAAC,CAAC;AARW,QAAA,YAAY,gBAQvB"}
package/dist/index.js CHANGED
@@ -1,13 +1,17 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
8
12
  }));
9
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
15
  };
12
16
  Object.defineProperty(exports, "__esModule", { value: true });
13
17
  __exportStar(require("./use-state"), exports);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA4B;AAC5B,+CAA6B;AAC7B,4CAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,+CAA6B;AAC7B,4CAA0B"}
package/dist/use-state.js CHANGED
@@ -13,9 +13,9 @@ const updateState = (element, hookID, elementUpdateFn, newValue) => {
13
13
  elementUpdateFn();
14
14
  }
15
15
  };
16
- exports.useState = (value) => {
17
- const [element, hookID] = hooks_core_1.registerHook();
18
- const elementUpdateFn = hooks_core_1.getElementUpdateFn();
16
+ const useState = (value) => {
17
+ const [element, hookID] = (0, hooks_core_1.registerHook)();
18
+ const elementUpdateFn = (0, hooks_core_1.getElementUpdateFn)();
19
19
  if (!stateMap.has(element)) {
20
20
  stateMap.set(element, new Map());
21
21
  }
@@ -24,7 +24,8 @@ exports.useState = (value) => {
24
24
  }
25
25
  return [
26
26
  stateMap.get(element).get(hookID),
27
- updateState.bind(null, element, hookID, elementUpdateFn)
27
+ updateState.bind(null, element, hookID, elementUpdateFn),
28
28
  ];
29
29
  };
30
+ exports.useState = useState;
30
31
  //# sourceMappingURL=use-state.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-state.js","sourceRoot":"","sources":["../src/use-state.ts"],"names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": "0.0.114",
3
+ "version": "0.0.117",
4
4
  "description": "Reactive HyperText Markup Language",
5
5
  "scripts": {
6
6
  "start": "npx parcel ./examples/index.html --out-dir build/examples",
@@ -18,16 +18,7 @@
18
18
  "dependencies": {
19
19
  "@rxdi/lit-html": "^0.7.133"
20
20
  },
21
- "devDependencies": {
22
- "eslint": "^6.7.2",
23
- "eslint-config-prettier": "^6.7.0",
24
- "eslint-plugin-prettier": "^3.1.1",
25
- "eslint-plugin-simple-import-sort": "^5.0.0",
26
- "@typescript-eslint/eslint-plugin": "^2.10.0",
27
- "@typescript-eslint/parser": "^2.10.0",
28
- "prettier": "^1.19.1",
29
- "ts-jest": "25.2.1"
30
- },
21
+ "devDependencies": {},
31
22
  "author": "Kristiyan Tachev",
32
23
  "license": "MIT",
33
24
  "browserslist": [
package/src/element.ts CHANGED
@@ -11,7 +11,7 @@ export const component = (
11
11
  renderFn: (e: HTMLElement) => TemplateResult,
12
12
  {
13
13
  observedAttributes,
14
- shadowRoot
14
+ shadowRoot,
15
15
  }: HookElementOptions = {} as HookElementOptions
16
16
  ) =>
17
17
  class extends HTMLElement {
package/src/hooks-core.ts CHANGED
@@ -2,17 +2,17 @@ export interface HookState {
2
2
  element: HTMLElement;
3
3
  renderIsInProgress: boolean;
4
4
  hooksExecutedThisRender: number;
5
- elementUpdateFn: Function;
5
+ elementUpdateFn: () => void;
6
6
  }
7
7
 
8
8
  let hooksState: HookState;
9
9
 
10
- const OnRender = (element: HTMLElement, elementUpdateFn: Function) => {
10
+ const OnRender = (element: HTMLElement, elementUpdateFn: () => void) => {
11
11
  hooksState = {
12
12
  element,
13
13
  renderIsInProgress: true,
14
14
  hooksExecutedThisRender: 0,
15
- elementUpdateFn
15
+ elementUpdateFn,
16
16
  };
17
17
  };
18
18
 
@@ -21,14 +21,14 @@ const OnEndRender = () => {
21
21
  element: null,
22
22
  renderIsInProgress: false,
23
23
  hooksExecutedThisRender: 0,
24
- elementUpdateFn: null
24
+ elementUpdateFn: null,
25
25
  };
26
26
  };
27
27
 
28
28
  export const renderWithHooks = (
29
29
  element: HTMLElement,
30
- templateFn: Function,
31
- elementUpdateFn: Function
30
+ templateFn: (element: HTMLElement) => unknown,
31
+ elementUpdateFn: () => void
32
32
  ) => {
33
33
  OnRender(element, elementUpdateFn);
34
34
  const template = templateFn(element);
package/src/use-state.ts CHANGED
@@ -5,7 +5,7 @@ const stateMap = new WeakMap<HTMLElement, Map<number, unknown>>();
5
5
  const updateState = <T>(
6
6
  element: HTMLElement,
7
7
  hookID: number,
8
- elementUpdateFn: Function,
8
+ elementUpdateFn: () => void,
9
9
  newValue: T
10
10
  ) => {
11
11
  const currentValue = stateMap.get(element).get(hookID);
@@ -32,6 +32,6 @@ export const useState = <T>(value: T) => {
32
32
 
33
33
  return [
34
34
  stateMap.get(element).get(hookID),
35
- updateState.bind(null, element, hookID, elementUpdateFn)
35
+ updateState.bind(null, element, hookID, elementUpdateFn),
36
36
  ];
37
37
  };
package/.eslintrc.js DELETED
@@ -1,26 +0,0 @@
1
- module.exports = {
2
- // Specifies the ESLint parser
3
- parser: "@typescript-eslint/parser",
4
- extends: [
5
- // Uses the recommended rules from the @typescript-eslint/eslint-plugin
6
- "plugin:@typescript-eslint/recommended",
7
- // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
8
- "prettier/@typescript-eslint",
9
- // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
10
- "plugin:prettier/recommended"
11
- ],
12
- parserOptions: {
13
- // Allows for the parsing of modern ECMAScript features
14
- ecmaVersion: 2018,
15
- // Allows for the use of imports
16
- sourceType: "module"
17
- },
18
- rules: {
19
- "@typescript-eslint/explicit-function-return-type": 0,
20
- "simple-import-sort/sort": "error",
21
- "sort-imports": "off",
22
- "import/order": "off",
23
- "@typescript-eslint/camelcase": 0
24
- },
25
- plugins: ["simple-import-sort"]
26
- };
package/.prettierrc DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "singleQuote": true,
3
- "printWidth": 80
4
- }
package/jest.config.js DELETED
@@ -1,16 +0,0 @@
1
- module.exports = {
2
- testEnvironment: 'node',
3
- testPathIgnorePatterns: ['/node_modules/'],
4
- coverageReporters: ['lcov', 'html'],
5
- rootDir: './',
6
- moduleFileExtensions: ['ts', 'tsx', 'js', 'json', 'node'],
7
- globals: {
8
- __DEV__: true
9
- },
10
- transform: {
11
- '\\.(ts|tsx)$': 'ts-jest'
12
- },
13
- testRegex: '/src/.*\\.spec.(ts|tsx|js)$',
14
- verbose: true,
15
- collectCoverage: true
16
- };
package/tslint.json DELETED
@@ -1,113 +0,0 @@
1
- {
2
- "rules": {
3
- "arrow-return-shorthand": true,
4
- "callable-types": true,
5
- "class-name": true,
6
- "comment-format": [
7
- true,
8
- "check-space"
9
- ],
10
- "curly": true,
11
- "eofline": true,
12
- "forin": true,
13
- "import-blacklist": [
14
- true,
15
- "rxjs/Rx"
16
- ],
17
- "import-spacing": true,
18
- "indent": [
19
- true,
20
- "spaces"
21
- ],
22
- "interface-over-type-literal": true,
23
- "label-position": true,
24
- "max-line-length": [
25
- true,
26
- 140
27
- ],
28
- "member-access": false,
29
- "member-ordering": [
30
- true,
31
- {
32
- "order": [
33
- "static-field",
34
- "instance-field",
35
- "static-method",
36
- "instance-method"
37
- ]
38
- }
39
- ],
40
- "no-arg": true,
41
- "no-bitwise": true,
42
- "no-console": [
43
- true,
44
- "debug",
45
- "info",
46
- "time",
47
- "timeEnd",
48
- "trace"
49
- ],
50
- "no-construct": true,
51
- "no-debugger": true,
52
- "no-duplicate-super": true,
53
- "no-empty": false,
54
- "no-empty-interface": true,
55
- "no-eval": true,
56
- "no-inferrable-types": [
57
- true,
58
- "ignore-params"
59
- ],
60
- "no-misused-new": true,
61
- "no-non-null-assertion": true,
62
- "no-shadowed-variable": true,
63
- "no-string-literal": false,
64
- "no-string-throw": true,
65
- "no-switch-case-fall-through": true,
66
- "no-trailing-whitespace": true,
67
- "no-unnecessary-initializer": true,
68
- "no-unused-expression": true,
69
- "no-var-keyword": true,
70
- "object-literal-sort-keys": false,
71
- "one-line": [
72
- true,
73
- "check-open-brace",
74
- "check-catch",
75
- "check-else",
76
- "check-whitespace"
77
- ],
78
- "prefer-const": true,
79
- "quotemark": [
80
- true,
81
- "single"
82
- ],
83
- "radix": true,
84
- "semicolon": [
85
- false,
86
- "never"
87
- ],
88
- "triple-equals": [
89
- true,
90
- "allow-null-check"
91
- ],
92
- "typedef-whitespace": [
93
- true,
94
- {
95
- "call-signature": "nospace",
96
- "index-signature": "nospace",
97
- "parameter": "nospace",
98
- "property-declaration": "nospace",
99
- "variable-declaration": "nospace"
100
- }
101
- ],
102
- "unified-signatures": true,
103
- "variable-name": false,
104
- "whitespace": [
105
- true,
106
- "check-branch",
107
- "check-decl",
108
- "check-operator",
109
- "check-separator",
110
- "check-type"
111
- ]
112
- }
113
- }