aboutsummaryrefslogtreecommitdiff
path: root/static/ts/components.ts
blob: c78b5753a7519141cc6e3676aeab5c009dcabf7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
   Actuall creation of all web components.

   More text

   @category Web Components
   @module components
  */

import { ComponentDescription } from './components/vevent-description'
import { ComponentEdit } from './components/vevent-edit'
import { VEventDL } from './components/vevent-dl'
import { ComponentBlock } from './components/vevent-block'
import { DateTimeInput } from './components/date-time-input'
import { PopupElement } from './components/popup-element'
import { InputList } from './components/input-list'
import { EditRRule } from './components/edit-rrule'
import { TabGroupElement } from './components/tab-group-element'
import { VEventChangelog } from './components/changelog'
import { SliderInput } from './components/slider'
import { DateJump } from './components/date-jump'

export { initialize_components }

/**
   Create web components from all our components.

   The reason each components module doesn't simply initialize its own component
   is due to some components needing to be initialized AFTER some global
   variables (see inline comments).

   @TODO
   Fix the initialization order dependency

   @TODO
   or otherwise have a static field on each component specifying it's desired name.
   */
function initialize_components() {
    /* These MUST be created AFTER vcal_objcets and event_calendar_mapping are
    inistialized, since their constructors assume that that piece of global
    state is available */
    customElements.define('vevent-description', ComponentDescription);
    customElements.define('vevent-edit', ComponentEdit);
    customElements.define('vevent-dl', VEventDL);
    customElements.define('vevent-block', ComponentBlock);
    customElements.define('vevent-edit-rrule', EditRRule);

    /* date-time-input should be instansiatable any time, but we do it here
    becouse why not */

    customElements.define('date-time-input', DateTimeInput /*, { extends: 'input' } */)
    customElements.define('input-list', InputList);
    customElements.define('slider-input', SliderInput);
    customElements.define('date-jump', DateJump);

    /* These maybe also require that the global maps are initialized */
    customElements.define('popup-element', PopupElement)
    customElements.define('tab-group', TabGroupElement)
    customElements.define('vevent-changelog', VEventChangelog);
}