@lightningjs/blits 1.7.0 → 1.8.0

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/index.d.ts CHANGED
@@ -15,19 +15,824 @@
15
15
  * SPDX-License-Identifier: Apache-2.0
16
16
  */
17
17
 
18
- import Component from './src/component.js'
19
- import Application from './src/application.js'
20
- import Launch from './src/launch.js'
21
- import Plugin from './src/plugin.js'
18
+ import {type ShaderEffect as RendererShaderEffect, type WebGlCoreShader} from '@lightningjs/renderer'
22
19
 
23
- /**
24
- * Blits - The Lightning 3 App Development Framework
25
- */
26
- declare module Blits {
27
- export { Component }
28
- export { Application }
29
- export { Launch }
30
- export { Plugin }
31
- }
20
+ declare module '@lightningjs/blits' {
21
+
22
+ interface Hooks {
23
+ /**
24
+ * Fires when the Component is being instantiated
25
+ * At this moment child elements will not be available yet
26
+ */
27
+ init?: () => void;
28
+ /**
29
+ * Fires when the Component is fully initialized and ready for interaction.
30
+ */
31
+ ready?: () => void;
32
+ /**
33
+ * Triggers when the Component receives focus.
34
+ *
35
+ * This event can fire multiple times during the component's lifecycle
36
+ */
37
+ focus?: () => void;
38
+ /**
39
+ * Triggers when the Component loses focus.
40
+ *
41
+ * This event can fire multiple times during the component's lifecycle
42
+ */
43
+ unfocus?: () => void;
44
+ /**
45
+ * Fires when the Component is being destroyed and removed.
46
+ */
47
+ destroy?: () => void;
48
+ /**
49
+ * Fires upon each frame start (allowing you to tap directly into the renderloop)
50
+ *
51
+ * Note: This hook will fire continuously, multiple times per second!
52
+ */
53
+ frameTick?: () => void;
54
+ /**
55
+ * Fires when the component enters the viewport _margin_ and is attached to the render tree
56
+ *
57
+ * This event can fire multiple times during the component's lifecycle
58
+ */
59
+ attach?: () => void;
60
+ /**
61
+ * Fires when the component leaves the viewport _margin_ and is detached from the render tree
62
+ *
63
+ * This event can fire multiple times during the component's lifecycle
64
+ */
65
+ detach?: () => void;
66
+ /**
67
+ * Fires when the component enters the visible viewport
68
+ *
69
+ * This event can fire multiple times during the component's lifecycle
70
+ */
71
+ enter?: () => void;
72
+ /**
73
+ * Fires when the component leaves the visible viewport
74
+ *
75
+ * This event can fire multiple times during the component's lifecycle
76
+ */
77
+ exit?: () => void;
78
+ }
79
+
80
+ interface Input {
81
+ [key: string]: (event: KeyboardEvent) => void | undefined,
82
+ /**
83
+ * Catch all input function
84
+ *
85
+ * Will be invoked when there is no dedicated function for a certain key
86
+ */
87
+ // @ts-ignore
88
+ any?: (event: KeyboardEvent) => void
89
+ }
90
+
91
+ interface Log {
92
+ /**
93
+ * Log an info message
94
+ */
95
+ info(...args): typeof console.info
96
+ /**
97
+ * Log an error message
98
+ */
99
+ error(...args): typeof console.error
100
+ /**
101
+ * Log a warning
102
+ */
103
+ warn(...args): typeof console.warn
104
+ /**
105
+ * Log a debug message
106
+ */
107
+ debug(...args): typeof console.debug
108
+ }
109
+
110
+
111
+
112
+ interface RouteData {
113
+ [key: string]: any
114
+ }
115
+
116
+ // todo: specify valid route options
117
+ interface RouteOptions {
118
+ [key: string]: any
119
+ }
120
+
121
+ interface Router {
122
+ /**
123
+ * Navigate to a different location
124
+ *
125
+ * @param {string}
126
+ */
127
+ to(location: string, data?: RouteData, options?: RouteOptions): void;
128
+
129
+ /**
130
+ * Navigate to the previous location
131
+ */
132
+ back(): boolean;
133
+
134
+ /**
135
+ * Get the current route read-only
136
+ */
137
+ readonly currentRoute: Route;
138
+
139
+ /**
140
+ * Get the list of all routes
141
+ */
142
+ readonly routes: Route[];
143
+
144
+ /**
145
+ * Get navigating state
146
+ */
147
+ readonly navigating: boolean;
148
+
149
+ }
150
+
151
+ type ComponentBase = {
152
+ /**
153
+ * Listen to events emitted by other components
154
+ */
155
+ $listen: {
156
+ (event: string, callback: (args: any) => void, priority?: number): void;
157
+ }
158
+ /**
159
+ * Emit events that other components can listen to
160
+ * @param name - name of the event to be emitted
161
+ * @param data - optional data to be passed along
162
+ */
163
+ $emit(name: string, data?: any): void;
164
+
165
+ /**
166
+ * Set a timeout that is automatically cleaned upon component destroy
167
+ */
168
+ $setTimeout: (callback: (args: any) => void, ms?: number | undefined) => ReturnType<typeof setTimeout>
169
+
170
+ /**
171
+ * Clear a timeout
172
+ */
173
+ $clearTimeout: (id: ReturnType<typeof setTimeout>) => void
174
+
175
+ /**
176
+ * Set an interval that is automatically cleaned upon component destroy
177
+ */
178
+ $setInterval: (callback: (args: any) => void, ms?: number | undefined) => ReturnType<typeof setInterval>
179
+
180
+ /**
181
+ * Clear a interval
182
+ */
183
+ $clearInterval: (id: ReturnType<typeof setInterval>) => void
184
+
185
+ /**
186
+ * Log to the console with prettier output and configurable debug levels in Settings
187
+ */
188
+ $log: Log
189
+
190
+ /**
191
+ * Set focus to the Component, optionally pass a KeyboardEvent for instant event bubbling
192
+ */
193
+ $focus: (event?: KeyboardEvent) => void
194
+ /**
195
+ * @deprecated
196
+ * Deprecated: use `this.$focus()` instead
197
+ */
198
+ focus: (event?: KeyboardEvent) => void
199
+
200
+ /**
201
+ * Select a child Element or Component by ref
202
+ *
203
+ * Elements and Components in the template can have an optional ref argument.
204
+ * Returns an Element Instance or Component Instance.
205
+ * Useful for passing on the focus to a Child component.
206
+ *
207
+ * @example
208
+ * ```js
209
+ * const menu = this.$select('Menu')
210
+ * if(menu) {
211
+ * menu.$focus()
212
+ * }
213
+ * ```
214
+ */
215
+ $select: (ref: string) => ComponentBase
216
+
217
+ /**
218
+ * @deprecated
219
+ * Deprecated: use `this.$select()` instead
220
+ */
221
+ select: (ref: string) => ComponentBase
222
+
223
+ /**
224
+ * Announcer methods for screen reader support
225
+ */
226
+ // $announcer: Announcer
227
+
228
+ /**
229
+ * Triggers a forced update on state variables.
230
+ */
231
+ $trigger: (key: string) => void
232
+ /**
233
+ * @deprecated
234
+ *
235
+ * Triggers a forced update on state variables.
236
+ * Deprecated: use `this.$trigger()` instead
237
+ */
238
+ trigger: (key: string) => void
239
+
240
+ /**
241
+ * Router instance
242
+ */
243
+ $router: Router
244
+ }
245
+
246
+ /**
247
+ * Prop object
248
+ */
249
+ type PropObject = {
250
+ /**
251
+ * Name of the prop
252
+ */
253
+ key: string,
254
+ /**
255
+ * Whether the prop is required to be passed
256
+ */
257
+ required?: boolean,
258
+ /**
259
+ * Default value for the prop when omited
260
+ */
261
+ default?: any,
262
+ /**
263
+ * Cast the value of the prop
264
+ *
265
+ * @example
266
+ * ```js
267
+ * {
268
+ * cast: Number, // casts to a number
269
+ * cast: (v) => v.toUpperCase() // casts to uppercase
270
+ * }
271
+ * ```
272
+ */
273
+ cast?: () => any
274
+ };
275
+
276
+ // Props Array
277
+ type Props = (string | PropObject)[];
278
+
279
+ // Extract the prop names from the props array
280
+ type ExtractPropNames<P extends Props> = {
281
+ readonly [K in P[number] as K extends string ? K : K extends { key: infer Key } ? Key : never]: any;
282
+ };
283
+
284
+ // Update the PropsDefinition to handle props as strings or objects
285
+ type PropsDefinition<P extends Props> = ExtractPropNames<P>;
286
+
287
+ type ComponentContext<P extends Props, S, M, C> = ThisType<PropsDefinition<P> & S & M & C & ComponentBase>
288
+
289
+ interface ComponentConfig<P extends Props, S, M, C, W> {
290
+ components?: {
291
+ [key: string]: ComponentFactory,
292
+ },
293
+ /**
294
+ * XML-based template string of the Component
295
+ *
296
+ * @example
297
+ * ```xml
298
+ * <Element :x="$x" w="400" h="1080" color="#64748b">
299
+ * <Element x="50" y="40">
300
+ * <Button color="#e4e4e7" />
301
+ * <Button color="#e4e4e7" y="100" />
302
+ * <Button color="#e4e4e7" y="200" />
303
+ * <Button color="#e4e4e7" y="300" />
304
+ * </Element>
305
+ * </Element>
306
+ * ```
307
+ */
308
+ template?: String,
309
+ /**
310
+ * Allowed props to be passed into the Component by the parent
311
+ *
312
+ * Can be a simple array with `prop` keys as strings.
313
+ * Alternatively objects can be used to specify `required` props and `default` values
314
+ *
315
+ * @example
316
+ * ```js
317
+ * props: ['index', {
318
+ * key: 'alpha',
319
+ * required: true
320
+ * }, {
321
+ * key: 'color',
322
+ * default: 'red'
323
+ * }]
324
+ * ```
325
+ */
326
+ props?: P;
327
+ /**
328
+ * Reactive internal state of the Component instance
329
+ *
330
+ * Should return an object (literal) with key value pairs.
331
+ * Can contain nested objects, but beware that too deep nesting can have
332
+ * a negative impact on performance
333
+ *
334
+ * @example
335
+ * ```js
336
+ * state() {
337
+ * return {
338
+ * items: [],
339
+ * color: 'red',
340
+ * alpha: 0.1
341
+ * }
342
+ * }
343
+ * ```
344
+ */
345
+ state?: (this: PropsDefinition<P>) => S;
346
+ /**
347
+ * Methods for abstracting more complex business logic into separate function
348
+ */
349
+ methods?: M & ComponentContext<P, S, M, C>
350
+ /**
351
+ * Hooking into Lifecycle events
352
+ */
353
+ hooks?: Hooks & ComponentContext<P, S, M, C>
354
+ /**
355
+ * Tapping into user input
356
+ */
357
+ input?: Input & ComponentContext<P, S, M, C>
358
+ /**
359
+ * Computed properties
360
+ */
361
+ computed?: C & ComponentContext<P, S, M, C>
362
+ /**
363
+ * Watchers for changes to state variables, props or computed properties
364
+ */
365
+ watch?: W & ComponentContext<P, S, M, C>
366
+ }
367
+
368
+ interface ApplicationConfig<P extends Props, S, M, C, W> extends ComponentConfig<P, S, M, C, W> {
369
+ /**
370
+ * Routes definition
371
+ *
372
+ * @example
373
+ *
374
+ * ```js
375
+ * routes: [
376
+ * { path: '/', component: Home },
377
+ * { path: '/details', component: Details },
378
+ * { path: '/account', component: Account },
379
+ * ]
380
+ * ```
381
+ */
382
+ routes?: Route[]
383
+ }
32
384
 
33
- export default Blits
385
+
386
+ interface Transition {
387
+ /**
388
+ * Name of the prop to transition (i.e. 'x', 'y', 'alpha', 'color')
389
+ */
390
+ prop: string,
391
+ /**
392
+ * Value the prop should transition to (i.e. 0, 100, '#223388')
393
+ */
394
+ value: any,
395
+ /**
396
+ * Duration of the transition in milliseconds, defaults to 300
397
+ */
398
+ duration?: number,
399
+ /**
400
+ * Easing function to apply to the transition
401
+ */
402
+ easing?: string,
403
+ /**
404
+ * Delay before the transition starts in milliseconds
405
+ */
406
+ delay?: number
407
+ }
408
+
409
+ interface Before {
410
+ /**
411
+ * Name of the prop to set before the transition starts
412
+ */
413
+ prop: string,
414
+ /**
415
+ * Value the prop to set before the transition starts
416
+ */
417
+ value: any,
418
+ }
419
+
420
+ interface RouteTransition {
421
+ /**
422
+ * Setting or Array of Settings before new view enters into the router view
423
+ */
424
+ before: Before | Before[],
425
+ /**
426
+ * Transition or Array of Transitions for new view to enters into the router view
427
+ */
428
+ in: Transition | Transition[],
429
+ /**
430
+ * Transition or Array of Transitions for old view to leave the router view
431
+ */
432
+ out: Transition | Transition[],
433
+ }
434
+
435
+ type RouteTransitionFunction = (previousRoute: Route, currentRoute: Route) => RequireAtLeastOne<RouteTransition>
436
+
437
+ interface RouteAnnounce {
438
+ /**
439
+ * Message to be announced
440
+ */
441
+ message: String,
442
+ /**
443
+ * Politeness level
444
+ *
445
+ * Defaults to 'off'
446
+ */
447
+ politeness?: 'off' | 'polite' | 'assertive'
448
+ }
449
+
450
+ type RequireAtLeastOne<T> = {
451
+ [K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>
452
+ }[keyof T]
453
+
454
+ interface RouteHooks {
455
+ before?: (to: Route, from: Route) => string | Route;
456
+ }
457
+
458
+ type Route = {
459
+ /**
460
+ * URI path for the route
461
+ */
462
+ path: string,
463
+ /**
464
+ * Component to load when activating the route
465
+ */
466
+ component: ComponentFactory // todo: or promise returning a component instance
467
+ /**
468
+ * Transition configuration for the route
469
+ */
470
+ transition?: RequireAtLeastOne<RouteTransition> | RouteTransitionFunction,
471
+ /**
472
+ * Extra route options
473
+ */
474
+ options?: object // todo: specify which options are available,
475
+ /**
476
+ * Message to be announced when visiting the route (often used for accessibility purposes)
477
+ *
478
+ * Can be either a `String` with the message or an object that defines the message and the
479
+ * politeness level
480
+ */
481
+ announce?: String | RouteAnnounce
482
+ /**
483
+ * Register hooks for the route
484
+ */
485
+ hooks?: RouteHooks
486
+ /**
487
+ * Route path parameters
488
+ */
489
+ readonly params?: {
490
+ [key: string]: string | number
491
+ }
492
+ /**
493
+ * Allows for attaching custom data to a route, either hardcoded in the
494
+ * route definition or asigned to the route object in a before hook
495
+ *
496
+ * Will be merged with the route params and navigation data and passed as
497
+ * props into the route component
498
+ */
499
+ data?: {
500
+ [key: string]: any
501
+ }
502
+ }
503
+
504
+ type ComponentFactory = () => void
505
+
506
+ // Launch Related
507
+
508
+ type DebugLevel = 0 | 1 | 2
509
+ type LogTypes = 'info' | 'warn' | 'error' | 'debug'
510
+
511
+ interface WebFont {
512
+ /**
513
+ * Name of the font family
514
+ */
515
+ family: string,
516
+ /**
517
+ * Type of font (web)
518
+ */
519
+ type: 'web',
520
+ /**
521
+ * Location to the font file (i.e. `/fonts/OpenSans-Medium.ttf`)
522
+ */
523
+ file: string
524
+ }
525
+
526
+ interface SdfFontWithFile {
527
+ /**
528
+ * Location of the font file (i.e. `/fonts/OpenSans-Medium.ttf`)
529
+ */
530
+ file: string
531
+ }
532
+
533
+ interface SdfFontWithPngJson {
534
+ /**
535
+ * Location of the font map (i.e. `'/fonts/Lato-Regular.msdf.json'`)
536
+ */
537
+ json: string,
538
+ /**
539
+ * Location of the font png (i.e. `'/fonts/Lato-Regular.msdf.png'`)
540
+ */
541
+ png: string
542
+ }
543
+
544
+ type SdfFont = {
545
+ /**
546
+ * Name of the font family
547
+ */
548
+ family: string,
549
+ /**
550
+ * Type of font (web)
551
+ */
552
+ type: 'msdf' | 'sdf',
553
+ } & (SdfFontWithFile | SdfFontWithPngJson)
554
+
555
+ type Font = WebFont | SdfFont
556
+
557
+ type ShaderEffect = {
558
+ name: string,
559
+ type: RendererShaderEffect
560
+ }
561
+
562
+ type Shader = {
563
+ name: string,
564
+ type: WebGlCoreShader
565
+ }
566
+
567
+ type ScreenResolutions = 'hd' | '720p' | 720 | 'fhd' | 'fullhd' | '1080p' | 1080 | '4k' | '2160p' | 2160
568
+
569
+ type ReactivityModes = 'Proxy' | 'defineProperty'
570
+ type RenderModes = 'webgl' | 'canvas'
571
+
572
+ /**
573
+ * Settings
574
+ *
575
+ * Launcher function that sets up the Lightning renderer and instantiates
576
+ * the Blits App
577
+ */
578
+ interface Settings {
579
+ /**
580
+ * Width of the Application
581
+ */
582
+ w?: number,
583
+ /**
584
+ * Height of the Application
585
+ */
586
+ h?: number,
587
+ /**
588
+ * Whether to enable multithreaded
589
+ */
590
+ multithreaded?: boolean,
591
+ /**
592
+ * Debug level for console log messages
593
+ */
594
+ debugLevel?: DebugLevel | LogTypes[],
595
+ /**
596
+ * Fonts to be used in the Application
597
+ */
598
+ fonts?: Font[],
599
+ /**
600
+ * Effects to be used by DynamicShader
601
+ */
602
+ effects?: ShaderEffect[],
603
+ /**
604
+ * Shaders to be used in the application
605
+ */
606
+ shaders?: Shader[],
607
+ /**
608
+ * Default font family to use in the Application when no font attribute is specified
609
+ * on a Text-component
610
+ *
611
+ * The default font must be registered in the `fonts` array in the settings.
612
+ *
613
+ * Defaults to `sans-serif` font family, which is the default of the Lightning Renderer
614
+ */
615
+ defaultFont?: string,
616
+ /**
617
+ * Custom keymapping
618
+ */
619
+ keymap?: object,
620
+ /**
621
+ * Mode of reactivity (`Proxy` or `defineProperty`)
622
+ */
623
+ reactivityMode?: ReactivityModes,
624
+ /**
625
+ * Screen resolution of the device, defining the pixelRatio used to convert dimensions
626
+ * and positions in the App code to the actual device logical coordinates
627
+ *
628
+ * If not supplied, Blits will try to autodetect the device screen resolution. Otherwise
629
+ * the exact dimensions and positions used the app code are used.
630
+ *
631
+ * Note: If the option `pixelRatio` is specified in the Settings object, this value will take presedence
632
+ * over the screen resolution setting.
633
+ *
634
+ * Currently 3 screen resolutions are supported, which can be defined with different alias values:
635
+ *
636
+ * For 720x1080 (1px = 0.66666667px)
637
+ * - hd
638
+ * - 720p
639
+ * - 720
640
+ *
641
+ * For 1080x1920 (1px = 1px)
642
+ * - fhd
643
+ * - fullhd
644
+ * - 1080p
645
+ * - 1080
646
+ *
647
+ * For 2160x3840 (1px = 2px)
648
+ * - 4k
649
+ * - 2160p
650
+ * - 2160
651
+ */
652
+ screenResolution?: ScreenResolutions,
653
+ /**
654
+ * Custom pixel ratio of the device used to convert dimensions
655
+ * and positions in the App code to the actual device logical coordinates
656
+ *
657
+ * Takes presedence over the `screenResolution` setting
658
+ *
659
+ * Defaults to 1 if not specified
660
+ */
661
+ pixelRatio?: number
662
+ /**
663
+ * Interval in milliseconds to receive FPS updates
664
+ *
665
+ * @remarks
666
+ * If set to `0`, FPS updates will be disabled.
667
+ *
668
+ * @defaultValue `1000` (disabled)
669
+ */
670
+ fpsInterval?: number
671
+ /**
672
+ * Maximum number of web workers to spin up simultaneously for offloading functionality such
673
+ * as image loading to separate threads (when supported by the browser)
674
+ *
675
+ * If not specified defaults to the number of logical processers available as reported by
676
+ * `navigator.hardwareConcurrency` (or 2 if `navigator.hardwareConcurrency` is not supported)
677
+ */
678
+ webWorkersLimit?: number
679
+ /**
680
+ * Background color of the canvas (also known as the clearColor)
681
+ *
682
+ * Can be a color name (red, blue, silver), a hexadecimal color (`#000000`, `#ccc`),
683
+ * or a color number in rgba order (`0xff0033ff`)
684
+ *
685
+ * Defauls to transparent (`0x00000000`)
686
+ *
687
+ */
688
+ canvasColor?: string,
689
+ /**
690
+ * Enable inspector
691
+ *
692
+ * Enables the inspector tool for debugging and inspecting the application, the node tree
693
+ * will be replicated in the DOM and can be inspected using the browser's developer tools
694
+ *
695
+ * Defaults to `false`
696
+ */
697
+ inspector?: boolean,
698
+ /**
699
+ * Add an extra margin to the viewport for earlier pre-loading of elements and components
700
+ *
701
+ * By default the Lightning renderer, only renders elements that are inside the defined viewport.
702
+ * Everything outside of these bounds is removed from the render tree.
703
+ *
704
+ * With the viewportMargin you have the option to _virtually_ increase the viewport area,
705
+ * to expedite the pre-loading of elements and / or delay the unloading of elements depending
706
+ * on their position in the (virtual) viewport
707
+ *
708
+ * The margin can be specified in 4 directions by defining an array [top, right, bottom, left],
709
+ * or as a single number which is then applied to all 4 directions equally.
710
+ *
711
+ * Defaults to `0`
712
+ */
713
+ viewportMargin?: number | [number, number, number, number],
714
+ /**
715
+ * Threshold in `Megabytes` after which all the textures that are currently not visible
716
+ * within the configured viewport margin will be be freed and cleaned up
717
+ *
718
+ * When passed `0` the threshold is disabled and textures will not be actively freed
719
+ * and cleaned up
720
+ *
721
+ * Defaults to `200` (mb)
722
+ */
723
+ gpuMemoryLimit?: number,
724
+ /**
725
+ * Defines which mode the renderer should operate in: `webgl` or `canvas`
726
+ *
727
+ * SDF fonts are not supported in _canvas_ renderMode. Instead, _web_ fonts should
728
+ * be used. Also note that Canvas2d rendering doesnt support the use of shaders.
729
+ *
730
+ * Defaults to `webgl`
731
+ */
732
+ renderMode?: RenderModes,
733
+
734
+ /**
735
+ * The time, in milliseconds, after which Blits considers a key press a _hold_ key press
736
+ *
737
+ * During a hold key press the focus delegation behaviour is different: when scrolling
738
+ * through a long list, focus is not handed over to each individual list item, creating a
739
+ * smoother experience
740
+ *
741
+ * Defaults to `50` (ms)
742
+ */
743
+ holdTimeout?: number
744
+ }
745
+
746
+ interface State {
747
+ [key: string]: any
748
+ }
749
+
750
+ interface Methods {
751
+ [key: string]: any
752
+ }
753
+
754
+ interface Watch {
755
+ [key: string]: any
756
+ }
757
+
758
+ interface Computed {
759
+ [key: string]: any
760
+ }
761
+
762
+
763
+ interface Plugin {
764
+ /**
765
+ * Name of the plugin. The plugin will be accessible on each Component's
766
+ * `this` scope under this name, prefixed with a `$` (i.e. myplugin => `this.$myplugin`)
767
+ */
768
+ name: string,
769
+ /**
770
+ * Singleton function that will be used to instantiate the plugin.
771
+ * Should do all necessary setup and ideally return an object with
772
+ * properties or methods that can be used in the App
773
+ */
774
+ plugin: () => any
775
+ }
776
+
777
+
778
+ /**
779
+ * Blits App Framework
780
+ */
781
+ export interface Blits {
782
+ /**
783
+ * Blits Application
784
+ * @param {ApplicationConfig} config - Application Configuration object
785
+ */
786
+ Application<
787
+ P extends Props,
788
+ S extends State,
789
+ M extends Methods,
790
+ C extends Computed,
791
+ W extends Watch>(config: ApplicationConfig<P, S, M, C, W>) : ComponentFactory
792
+ /**
793
+ * Blits Component
794
+ * @param {string} name - The name of the Component
795
+ * @param {ComponentConfig} config - Component Configuration object
796
+ */
797
+ Component<
798
+ P extends Props,
799
+ S extends State,
800
+ M extends Methods,
801
+ C extends Computed,
802
+ W extends Watch>(name: string, config: ComponentConfig<P, S, M, C, W>) : ComponentFactory
803
+ /**
804
+ * Blits Launch
805
+ */
806
+ Launch(App: ComponentFactory, target: HTMLElement | String, settings?: Settings) : void
807
+ /**
808
+ * Blits Plugin
809
+ *
810
+ * @param plugin
811
+ * Plugin object or singleton function that will be used to instantiate the
812
+ * plugin. Should do all necessary setup and ideally return an object with
813
+ * properties or methods that can be used in the App
814
+ *
815
+ * @param nameOrOptions
816
+ * Name of the plugin or options object, to be passed into the plugin instantiation.
817
+ *
818
+ * When passing a string, the value will be used as **name** of the plugin. The plugin
819
+ * will be accessible on each Component's `this` scope under this name, prefixed with a `$`
820
+ * (i.e. myplugin => `this.$myplugin`)
821
+ *
822
+ * Passing a name is **required** when `plugin` argument is a singleton function
823
+ *
824
+ * When passing an object, the value will be considered to be an `options` object.
825
+ * The options object will be passed into the plugin instantiation method. Can
826
+ * be used to set default values
827
+ *
828
+ * @param options
829
+ * Object with options to be passed into the plugin instantiation method.
830
+ * Can be used to set default values
831
+ */
832
+ Plugin(plugin: Plugin, nameOrOptions?: string | object , options?: object) : void
833
+ }
834
+
835
+ const Blits: Blits;
836
+
837
+ export default Blits;
838
+ }