cotomy 0.1.41 → 0.1.43

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/view.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export declare class CotomyElement {
2
- static createHTMLElement(html: string): HTMLElement;
2
+ static encodeHtml(text: string): string;
3
+ protected static createHTMLElement(html: string): HTMLElement;
3
4
  static first<T extends CotomyElement = CotomyElement>(selector: string, type?: new (el: HTMLElement) => T): T | undefined;
4
5
  static find<T extends CotomyElement = CotomyElement>(selector: string, type?: new (el: HTMLElement) => T): T[];
5
6
  static contains(selector: string): boolean;
@@ -11,7 +12,7 @@ export declare class CotomyElement {
11
12
  private _eventHandlers;
12
13
  constructor(element: HTMLElement | {
13
14
  html: string;
14
- css?: string | null;
15
+ css?: string;
15
16
  } | string);
16
17
  private _scopeId;
17
18
  get scopeId(): string;
@@ -104,15 +105,18 @@ export declare class CotomyElement {
104
105
  get isRightViewport(): boolean;
105
106
  hasAttribute(name: string): boolean;
106
107
  attribute(name: string): string | null | undefined;
107
- setAttribute(name: string, value?: string | number | undefined): this;
108
- removeAttribute(name: string): void;
109
- hasClass(cls: string): boolean;
110
- addClass(cls: string): this;
111
- removeClass(cls: string): this;
112
- setElementStyle(name: string, value: string): this;
113
- removeElementStyle(name: string): this;
114
- get computedStyle(): CSSStyleDeclaration;
108
+ attribute(name: string, value: string | number | undefined): this;
109
+ attribute(name: string, value: null): this;
110
+ hasClass(name: string): boolean;
111
+ addClass(name: string): this;
112
+ removeClass(name: string): this;
113
+ toggleClass(name: string, force?: boolean): this;
115
114
  style(name: string): string;
115
+ style(name: string, value: string): this;
116
+ style(name: string, value: null): this;
117
+ style(name: string, value: undefined): this;
118
+ protected getComputedStyle(): CSSStyleDeclaration;
119
+ computedStyle(name: string): string;
116
120
  get parent(): CotomyElement;
117
121
  get parents(): CotomyElement[];
118
122
  hasChildren(selector?: string): boolean;
@@ -130,46 +134,78 @@ export declare class CotomyElement {
130
134
  insertAfter(append: CotomyElement): this;
131
135
  appendTo(target: CotomyElement): this;
132
136
  prependTo(target: CotomyElement): this;
133
- trigger(event: string, e?: Event | null): this;
137
+ trigger(event: string): this;
138
+ trigger(event: string, e: Event): this;
134
139
  on(event: string, handle: (e: Event) => void | Promise<void>): this;
135
140
  onChild(event: string, selector: string, handle: (e: Event) => void | Promise<void>): this;
136
141
  once(event: string, handle: (e: Event) => void | Promise<void>): this;
137
- off(event: string, handle?: (e: Event) => void | Promise<void>): this;
142
+ off(event: string): this;
143
+ off(event: string, handle: (e: Event) => void | Promise<void>): this;
138
144
  handlers(event: string): Array<(e: Event) => void | Promise<void>>;
139
- click(handle?: ((e: MouseEvent) => void | Promise<void>) | null): this;
140
- dblclick(handle?: ((e: MouseEvent) => void | Promise<void>) | null): this;
141
- mouseover(handle?: ((e: MouseEvent) => void | Promise<void>) | null): this;
142
- mouseout(handle?: ((e: MouseEvent) => void | Promise<void>) | null): this;
143
- mousedown(handle?: ((e: MouseEvent) => void | Promise<void>) | null): this;
144
- mouseup(handle?: ((e: MouseEvent) => void | Promise<void>) | null): this;
145
- mousemove(handle?: ((e: MouseEvent) => void | Promise<void>) | null): this;
146
- mouseenter(handle?: ((e: MouseEvent) => void | Promise<void>) | null): this;
147
- mouseleave(handle?: ((e: MouseEvent) => void | Promise<void>) | null): this;
148
- dragstart(handle?: ((e: DragEvent) => void | Promise<void>) | null): this;
149
- dragend(handle?: ((e: DragEvent) => void | Promise<void>) | null): this;
150
- dragover(handle?: ((e: DragEvent) => void | Promise<void>) | null): this;
151
- dragenter(handle?: ((e: DragEvent) => void | Promise<void>) | null): this;
152
- dragleave(handle?: ((e: DragEvent) => void | Promise<void>) | null): this;
153
- drop(handle?: ((e: DragEvent) => void | Promise<void>) | null): this;
154
- drag(handle?: ((e: DragEvent) => void | Promise<void>) | null): this;
145
+ click(): this;
146
+ click(handle: (e: MouseEvent) => void | Promise<void>): this;
147
+ dblclick(): this;
148
+ dblclick(handle: (e: MouseEvent) => void | Promise<void>): this;
149
+ mouseover(): this;
150
+ mouseover(handle: (e: MouseEvent) => void | Promise<void>): this;
151
+ mouseout(): this;
152
+ mouseout(handle: (e: MouseEvent) => void | Promise<void>): this;
153
+ mousedown(): this;
154
+ mousedown(handle: (e: MouseEvent) => void | Promise<void>): this;
155
+ mouseup(): this;
156
+ mouseup(handle: (e: MouseEvent) => void | Promise<void>): this;
157
+ mousemove(): this;
158
+ mousemove(handle: (e: MouseEvent) => void | Promise<void>): this;
159
+ mouseenter(): this;
160
+ mouseenter(handle: (e: MouseEvent) => void | Promise<void>): this;
161
+ mouseleave(): this;
162
+ mouseleave(handle: (e: MouseEvent) => void | Promise<void>): this;
163
+ dragstart(): this;
164
+ dragstart(handle: (e: DragEvent) => void | Promise<void>): this;
165
+ dragend(): this;
166
+ dragend(handle: (e: DragEvent) => void | Promise<void>): this;
167
+ dragover(): this;
168
+ dragover(handle: (e: DragEvent) => void | Promise<void>): this;
169
+ dragenter(): this;
170
+ dragenter(handle: (e: DragEvent) => void | Promise<void>): this;
171
+ dragleave(): this;
172
+ dragleave(handle: (e: DragEvent) => void | Promise<void>): this;
173
+ drop(): this;
174
+ drop(handle: (e: DragEvent) => void | Promise<void>): this;
175
+ drag(): this;
176
+ drag(handle: (e: DragEvent) => void | Promise<void>): this;
155
177
  removed(handle: ((e: Event) => void | Promise<void>)): this;
156
- keydown(handle?: ((e: KeyboardEvent) => void | Promise<void>) | null): this;
157
- keyup(handle?: ((e: KeyboardEvent) => void | Promise<void>) | null): this;
158
- keypress(handle?: ((e: KeyboardEvent) => void | Promise<void>) | null): this;
159
- change(handle?: ((e: Event) => void | Promise<void>) | null): this;
160
- input(handle?: ((e: Event) => void | Promise<void>) | null): this;
178
+ keydown(): this;
179
+ keydown(handle: (e: KeyboardEvent) => void | Promise<void>): this;
180
+ keyup(): this;
181
+ keyup(handle: (e: KeyboardEvent) => void | Promise<void>): this;
182
+ keypress(): this;
183
+ keypress(handle: (e: KeyboardEvent) => void | Promise<void>): this;
184
+ change(): this;
185
+ change(handle: (e: Event) => void | Promise<void>): this;
186
+ input(): this;
187
+ input(handle: (e: Event) => void | Promise<void>): this;
161
188
  private static _intersectionObserver;
162
189
  static get intersectionObserver(): IntersectionObserver;
163
- inview(handle?: ((e: Event) => void | Promise<void>) | null): this;
164
- outview(handle?: ((e: Event) => void | Promise<void>) | null): this;
165
- focus(handle?: ((e: FocusEvent) => void | Promise<void>) | null): this;
166
- blur(handle?: ((e: FocusEvent) => void | Promise<void>) | null): this;
167
- focusin(handle?: ((e: FocusEvent) => void | Promise<void>) | null): this;
168
- focusout(handle?: ((e: FocusEvent) => void | Promise<void>) | null): this;
190
+ inview(): this;
191
+ inview(handle: (e: Event) => void | Promise<void>): this;
192
+ outview(): this;
193
+ outview(handle: (e: Event) => void | Promise<void>): this;
194
+ focus(): this;
195
+ focus(handle: (e: FocusEvent) => void | Promise<void>): this;
196
+ blur(): this;
197
+ blur(handle: (e: FocusEvent) => void | Promise<void>): this;
198
+ focusin(): this;
199
+ focusin(handle: (e: FocusEvent) => void | Promise<void>): this;
200
+ focusout(): this;
201
+ focusout(handle: (e: FocusEvent) => void | Promise<void>): this;
169
202
  filedrop(handle: (files: File[]) => void | Promise<void>): this;
170
- resize(handle?: ((e: Event) => void | Promise<void>) | null): this;
171
- scroll(handle?: ((e: Event) => void | Promise<void>) | null): this;
172
- changelayout(handle?: ((e: Event) => void | Promise<void>) | null): this;
203
+ resize(): this;
204
+ resize(handle: (e: Event) => void | Promise<void>): this;
205
+ scroll(): this;
206
+ scroll(handle: (e: Event) => void | Promise<void>): this;
207
+ changelayout(): this;
208
+ changelayout(handle: (e: Event) => void | Promise<void>): this;
173
209
  }
174
210
  export declare class CotomyMetaElement extends CotomyElement {
175
211
  static get(name: string): CotomyMetaElement;
@@ -195,10 +231,14 @@ export declare class CotomyWindow {
195
231
  handlers(event: string): Array<(e: Event) => void | Promise<void>>;
196
232
  load(handle: (e: Event) => void | Promise<void>): void;
197
233
  ready(handle: ((e: Event) => void | Promise<void>)): void;
198
- resize(handle?: ((event: Event) => void | Promise<void>) | null): void;
199
- scroll(handle?: ((event: Event) => void | Promise<void>) | null): void;
200
- changeLayout(handle?: ((event: Event) => void | Promise<void>) | null): void;
201
- pageshow(handle?: ((event: PageTransitionEvent) => void | Promise<void>) | null): void;
234
+ resize(): void;
235
+ resize(handle: (event: Event) => void | Promise<void>): void;
236
+ scroll(): void;
237
+ scroll(handle: (event: Event) => void | Promise<void>): void;
238
+ changeLayout(): void;
239
+ changeLayout(handle: (event: Event) => void | Promise<void>): void;
240
+ pageshow(): void;
241
+ pageshow(handle: (event: PageTransitionEvent) => void | Promise<void>): void;
202
242
  get scrollTop(): number;
203
243
  get scrollLeft(): number;
204
244
  get width(): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cotomy",
3
- "version": "0.1.41",
3
+ "version": "0.1.43",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [