ariadne_view_components 0.0.48 → 0.0.49

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2 -0
  3. data/app/assets/javascripts/ariadne_view_components.js +2 -2
  4. data/app/assets/javascripts/ariadne_view_components.js.map +1 -1
  5. data/app/assets/javascripts/components/ariadne/events_controller/events_controller.d.ts +4 -0
  6. data/app/assets/javascripts/components/ariadne/options_controller/options_controller.d.ts +30 -11
  7. data/app/assets/javascripts/components/ariadne/outlet_manager_controller/outlet_manager_controller.d.ts +42 -0
  8. data/app/assets/javascripts/components/ariadne/string_match_controller/string_match_controller.d.ts +27 -0
  9. data/app/assets/javascripts/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.d.ts +44 -0
  10. data/app/assets/javascripts/components/ariadne/toggleable_controller/toggleable_controller.d.ts +17 -17
  11. data/app/components/ariadne/ariadne.js +4 -0
  12. data/app/components/ariadne/ariadne.ts +4 -0
  13. data/app/components/ariadne/close_button_component.html.erb +1 -1
  14. data/app/components/ariadne/close_button_component.rb +2 -1
  15. data/app/components/ariadne/combobox_component.html.erb +14 -0
  16. data/app/components/ariadne/combobox_component.rb +76 -0
  17. data/app/components/ariadne/events_controller/events_controller.d.ts +4 -0
  18. data/app/components/ariadne/events_controller/events_controller.js +6 -0
  19. data/app/components/ariadne/events_controller/events_controller.ts +7 -0
  20. data/app/components/ariadne/layout_component.html.erb +21 -0
  21. data/app/components/ariadne/layout_component.rb +69 -0
  22. data/app/components/ariadne/modal_component.html.erb +11 -0
  23. data/app/components/ariadne/modal_component.rb +88 -0
  24. data/app/components/ariadne/options_controller/options_controller.d.ts +30 -11
  25. data/app/components/ariadne/options_controller/options_controller.js +75 -27
  26. data/app/components/ariadne/options_controller/options_controller.ts +104 -29
  27. data/app/components/ariadne/outlet_manager_controller/outlet_manager_controller.d.ts +42 -0
  28. data/app/components/ariadne/outlet_manager_controller/outlet_manager_controller.js +237 -0
  29. data/app/components/ariadne/outlet_manager_controller/outlet_manager_controller.ts +278 -0
  30. data/app/components/ariadne/popover_component.html.erb +0 -1
  31. data/app/components/ariadne/show_more_button_component.html.erb +1 -1
  32. data/app/components/ariadne/string_match_controller/string_match_controller.d.ts +27 -0
  33. data/app/components/ariadne/string_match_controller/string_match_controller.js +51 -0
  34. data/app/components/ariadne/string_match_controller/string_match_controller.ts +64 -0
  35. data/app/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.d.ts +44 -0
  36. data/app/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.js +153 -0
  37. data/app/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.ts +192 -0
  38. data/app/components/ariadne/toggleable_controller/toggleable_controller.d.ts +17 -17
  39. data/app/components/ariadne/toggleable_controller/toggleable_controller.js +35 -55
  40. data/app/components/ariadne/toggleable_controller/toggleable_controller.ts +41 -51
  41. data/lib/ariadne/view_components/version.rb +1 -1
  42. data/static/audited_at.json +3 -0
  43. data/static/constants.json +74 -0
  44. data/static/statuses.json +3 -0
  45. metadata +24 -2
@@ -3,48 +3,96 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
3
3
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
- var _OptionsController_instances, _OptionsController_updateAllAttrsForElement, _OptionsController_syncAttrsForTarget;
7
- import { Controller } from '@hotwired/stimulus';
8
- class OptionsController extends Controller {
6
+ var _OptionsController_instances, _OptionsController_shouldChangeState, _OptionsController_activateIndex, _OptionsController_deactivateIndex, _OptionsController_getElementKey, _OptionsController_buildActiveTargets;
7
+ import SyncedBooleanAttributesController from '../synced_boolean_attributes_controller/synced_boolean_attributes_controller';
8
+ class OptionsController extends SyncedBooleanAttributesController {
9
9
  constructor() {
10
10
  super(...arguments);
11
11
  _OptionsController_instances.add(this);
12
+ this.optionTargetLookup = new Map();
13
+ this.outletUpdate = this.select;
12
14
  }
13
15
  connect() {
14
- this.select(new Event('Init'), this.activeIndexValue);
16
+ __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_buildActiveTargets).call(this);
17
+ this.syncElementAttributes();
15
18
  }
16
- select(e, newIndex) {
19
+ select(event, updateTo = {}) {
20
+ var _a;
21
+ const activeOptions = updateTo.data;
17
22
  for (let index in this.optionTargets) {
18
23
  const target = this.optionTargets[index];
19
- const isActive = newIndex === undefined ? target === e.currentTarget : Number(index) === Number(newIndex);
20
- if (isActive) {
21
- this.activeIndexValue = Number(index);
24
+ const wasSelected = target === event.currentTarget;
25
+ const isCurrentlyActive = (_a = this.getValueForElement(target)) !== null && _a !== void 0 ? _a : false;
26
+ const optionKey = __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_getElementKey).call(this, target);
27
+ const shouldChangeState = activeOptions !== undefined
28
+ ? !!activeOptions[optionKey] !== isCurrentlyActive
29
+ : __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_shouldChangeState).call(this, isCurrentlyActive, wasSelected);
30
+ if (shouldChangeState) {
31
+ const willBeActive = !isCurrentlyActive;
32
+ this.updateAttributesForElement(target, willBeActive);
33
+ willBeActive ? __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_activateIndex).call(this, optionKey) : __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_deactivateIndex).call(this, optionKey);
22
34
  }
23
- __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_updateAllAttrsForElement).call(this, target, isActive);
24
35
  }
36
+ this.sendToOutlets(event, Object.assign(Object.assign({}, updateTo), { data: this.activeOptionsValue }));
37
+ }
38
+ getValueForElement(element) {
39
+ var _a;
40
+ if (!this.optionTargetLookup.has(element)) {
41
+ return null;
42
+ }
43
+ const optionKey = __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_getElementKey).call(this, element);
44
+ return (_a = this.activeOptionsValue[optionKey]) !== null && _a !== void 0 ? _a : false;
45
+ }
46
+ getState() {
47
+ return this.activeOptionsValue;
25
48
  }
26
49
  }
27
- _OptionsController_instances = new WeakSet(), _OptionsController_updateAllAttrsForElement = function _OptionsController_updateAllAttrsForElement(element, value) {
28
- if (this.hasSyncedAttrsValue) {
29
- __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_syncAttrsForTarget).call(this, element, this.syncedAttrsValue, value);
50
+ _OptionsController_instances = new WeakSet(), _OptionsController_shouldChangeState = function _OptionsController_shouldChangeState(isCurrentlyActive, wasSelected) {
51
+ if (!wasSelected && !isCurrentlyActive) {
52
+ // Not currently on and wasn't selected, no reason to change
53
+ return false;
54
+ }
55
+ if (!wasSelected && isCurrentlyActive && this.isMultiValue) {
56
+ // It wasn't selected and it is on. However, multi value is on so just leave it
57
+ return false;
30
58
  }
31
- if (this.hasAntiAttrsValue) {
32
- __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_syncAttrsForTarget).call(this, element, this.antiAttrsValue, !value);
59
+ if (wasSelected && isCurrentlyActive && !this.toggleableValue) {
60
+ // It was selected and it's on. But toggle isn't on so just leave it
61
+ return false;
33
62
  }
34
- }, _OptionsController_syncAttrsForTarget = function _OptionsController_syncAttrsForTarget(element, attrs, value) {
35
- const attrState = String(value);
36
- for (let index in attrs) {
37
- const attr = attrs[index];
38
- element.setAttribute(attr, attrState);
63
+ // Wasn't selected and it's active but only one can be active
64
+ // Was selected and it's active but toggling behavior means it should deactivate
65
+ // Was selected and it's not on, so it just needs to be turned on
66
+ return true;
67
+ }, _OptionsController_activateIndex = function _OptionsController_activateIndex(key) {
68
+ this.activeOptionsValue = Object.assign(Object.assign({}, this.activeOptionsValue), { [key]: true });
69
+ }, _OptionsController_deactivateIndex = function _OptionsController_deactivateIndex(key) {
70
+ const copy = Object.assign({}, this.activeOptionsValue);
71
+ delete copy[key];
72
+ this.activeOptionsValue = copy;
73
+ }, _OptionsController_getElementKey = function _OptionsController_getElementKey(element) {
74
+ const elementValue = element.getAttribute('data-option-value');
75
+ if (elementValue) {
76
+ return elementValue;
77
+ }
78
+ return element.innerText.trim();
79
+ }, _OptionsController_buildActiveTargets = function _OptionsController_buildActiveTargets() {
80
+ this.optionTargetLookup = new Map();
81
+ for (let index in this.optionTargets) {
82
+ const target = this.optionTargets[index];
83
+ const optionKey = __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_getElementKey).call(this, target);
84
+ this.optionTargetLookup.set(target, optionKey);
85
+ const onSyncAttr = !!this.syncedAttrsValue.find(attr => target.getAttribute(attr) === 'true');
86
+ if (onSyncAttr) {
87
+ __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_activateIndex).call(this, optionKey);
88
+ }
89
+ else {
90
+ const hasOffAttr = !!this.antiAttrsValue.find(attr => target.getAttribute(attr) === 'false');
91
+ hasOffAttr && __classPrivateFieldGet(this, _OptionsController_instances, "m", _OptionsController_activateIndex).call(this, optionKey);
92
+ }
39
93
  }
40
94
  };
95
+ OptionsController.outlets = SyncedBooleanAttributesController.outlets;
41
96
  OptionsController.targets = ['option'];
42
- OptionsController.values = {
43
- activeIndex: {
44
- type: Number,
45
- default: 0,
46
- },
47
- syncedAttrs: Array,
48
- antiAttrs: Array,
49
- };
97
+ OptionsController.values = Object.assign(Object.assign({}, SyncedBooleanAttributesController.values), { activeOptions: Object, isMulti: { type: Boolean, default: false }, toggleable: { type: Boolean, default: false } });
50
98
  export default OptionsController;
@@ -1,57 +1,132 @@
1
- import {Controller} from '@hotwired/stimulus'
1
+ import {TOutletChangeData} from '../outlet_manager_controller/outlet_manager_controller'
2
+ import SyncedBooleanAttributesController from '../synced_boolean_attributes_controller/synced_boolean_attributes_controller'
2
3
 
3
- export default class OptionsController extends Controller {
4
+ type TOptionKey = string | number
5
+ type TActiveOptions = {[k: TOptionKey]: boolean}
6
+ export interface OptionsOutlet extends SyncedBooleanAttributesController<TActiveOptions> {
7
+ select: (e: Event, updateTo?: TOutletChangeData<TActiveOptions>) => void
8
+ }
9
+
10
+ export default class OptionsController
11
+ extends SyncedBooleanAttributesController<TActiveOptions>
12
+ implements OptionsOutlet
13
+ {
14
+ static outlets = SyncedBooleanAttributesController.outlets
4
15
  static targets = ['option']
5
16
 
6
17
  static values = {
7
- activeIndex: {
8
- type: Number,
9
- default: 0,
10
- },
11
- syncedAttrs: Array,
12
- antiAttrs: Array,
18
+ ...SyncedBooleanAttributesController.values,
19
+ activeOptions: Object, // The currently active elements in TActiveOptions format
20
+ isMulti: {type: Boolean, default: false}, // Allows more than one selection
21
+ toggleable: {type: Boolean, default: false}, // If true, selecting the same value twice will turn it off. If false, nothing happens
13
22
  }
14
23
 
24
+ // Targets
15
25
  declare readonly optionTargets: Array<Element>
16
- declare activeIndexValue: number
17
26
 
18
- declare readonly syncedAttrsValue: string[]
19
- declare readonly hasSyncedAttrsValue: boolean
20
- declare readonly antiAttrsValue: string[]
21
- declare readonly hasAntiAttrsValue: boolean
27
+ // Values
28
+ declare activeOptionsValue: TActiveOptions
29
+ declare readonly isMultiValue: boolean
30
+ declare readonly toggleableValue: boolean
31
+
32
+ optionTargetLookup: Map<Element, TOptionKey> = new Map()
22
33
 
23
34
  connect(): void {
24
- this.select(new Event('Init'), this.activeIndexValue)
35
+ this.#buildActiveTargets()
36
+ this.syncElementAttributes()
25
37
  }
26
38
 
27
- select(e: Event, newIndex?: number) {
39
+ select(event: Event, updateTo: TOutletChangeData<TActiveOptions> = {}) {
40
+ const activeOptions = updateTo.data
28
41
  for (let index in this.optionTargets) {
29
42
  const target = this.optionTargets[index]
30
- const isActive = newIndex === undefined ? target === e.currentTarget : Number(index) === Number(newIndex)
43
+ const wasSelected = target === event.currentTarget
44
+ const isCurrentlyActive = this.getValueForElement(target) ?? false
45
+ const optionKey = this.#getElementKey(target)
46
+ const shouldChangeState =
47
+ activeOptions !== undefined
48
+ ? !!activeOptions[optionKey] !== isCurrentlyActive
49
+ : this.#shouldChangeState(isCurrentlyActive, wasSelected)
31
50
 
32
- if (isActive) {
33
- this.activeIndexValue = Number(index)
51
+ if (shouldChangeState) {
52
+ const willBeActive = !isCurrentlyActive
53
+ this.updateAttributesForElement(target, willBeActive)
54
+ willBeActive ? this.#activateIndex(optionKey) : this.#deactivateIndex(optionKey)
34
55
  }
56
+ }
57
+
58
+ this.sendToOutlets(event, {...updateTo, data: this.activeOptionsValue})
59
+ }
35
60
 
36
- this.#updateAllAttrsForElement(target, isActive)
61
+ #shouldChangeState(isCurrentlyActive: boolean, wasSelected: boolean) {
62
+ if (!wasSelected && !isCurrentlyActive) {
63
+ // Not currently on and wasn't selected, no reason to change
64
+ return false
37
65
  }
66
+
67
+ if (!wasSelected && isCurrentlyActive && this.isMultiValue) {
68
+ // It wasn't selected and it is on. However, multi value is on so just leave it
69
+ return false
70
+ }
71
+
72
+ if (wasSelected && isCurrentlyActive && !this.toggleableValue) {
73
+ // It was selected and it's on. But toggle isn't on so just leave it
74
+ return false
75
+ }
76
+
77
+ // Wasn't selected and it's active but only one can be active
78
+ // Was selected and it's active but toggling behavior means it should deactivate
79
+ // Was selected and it's not on, so it just needs to be turned on
80
+ return true
81
+ }
82
+
83
+ #activateIndex(key: TOptionKey) {
84
+ this.activeOptionsValue = {...this.activeOptionsValue, [key]: true}
85
+ }
86
+
87
+ #deactivateIndex(key: TOptionKey) {
88
+ const copy = {...this.activeOptionsValue}
89
+ delete copy[key]
90
+ this.activeOptionsValue = copy
38
91
  }
39
92
 
40
- #updateAllAttrsForElement(element: Element, value: boolean) {
41
- if (this.hasSyncedAttrsValue) {
42
- this.#syncAttrsForTarget(element, this.syncedAttrsValue, value)
93
+ #getElementKey(element: Element) {
94
+ const elementValue = element.getAttribute('data-option-value')
95
+ if (elementValue) {
96
+ return elementValue
43
97
  }
44
98
 
45
- if (this.hasAntiAttrsValue) {
46
- this.#syncAttrsForTarget(element, this.antiAttrsValue, !value)
99
+ return (element as HTMLElement).innerText.trim()
100
+ }
101
+
102
+ #buildActiveTargets() {
103
+ this.optionTargetLookup = new Map()
104
+ for (let index in this.optionTargets) {
105
+ const target = this.optionTargets[index]
106
+ const optionKey = this.#getElementKey(target)
107
+ this.optionTargetLookup.set(target, optionKey)
108
+ const onSyncAttr = !!this.syncedAttrsValue.find(attr => target.getAttribute(attr) === 'true')
109
+ if (onSyncAttr) {
110
+ this.#activateIndex(optionKey)
111
+ } else {
112
+ const hasOffAttr = !!this.antiAttrsValue.find(attr => target.getAttribute(attr) === 'false')
113
+ hasOffAttr && this.#activateIndex(optionKey)
114
+ }
47
115
  }
48
116
  }
49
117
 
50
- #syncAttrsForTarget(element: Element, attrs: string[], value: boolean) {
51
- const attrState = String(value)
52
- for (let index in attrs) {
53
- const attr = attrs[index]
54
- element.setAttribute(attr, attrState)
118
+ getValueForElement(element: Element) {
119
+ if (!this.optionTargetLookup.has(element)) {
120
+ return null
55
121
  }
122
+
123
+ const optionKey = this.#getElementKey(element)
124
+ return this.activeOptionsValue[optionKey] ?? false
56
125
  }
126
+
127
+ getState() {
128
+ return this.activeOptionsValue
129
+ }
130
+
131
+ outletUpdate = this.select
57
132
  }
@@ -0,0 +1,42 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ type TOutletEventLookup = boolean | {
3
+ [k: string]: TOutletEventLookup;
4
+ };
5
+ export type TOutletChangeData<T> = {
6
+ eventKey?: string;
7
+ data?: T;
8
+ } | undefined;
9
+ export default class OutletManagerController<T> extends Controller {
10
+ #private;
11
+ static values: {
12
+ outletEvents: ArrayConstructor;
13
+ };
14
+ readonly outletEventsValue: Array<string>;
15
+ readonly hasOutletEventsValue: boolean;
16
+ static outlets: string[];
17
+ readonly toggleableOutlets: Array<OutletManagerController<T>>;
18
+ readonly hasToggleableOutlet: boolean;
19
+ readonly optionsOutlets: Array<OutletManagerController<T>>;
20
+ readonly hasOptionsOutlet: boolean;
21
+ readonly stringMatchOutlets: Array<OutletManagerController<T>>;
22
+ readonly hasStringMatchOutlet: boolean;
23
+ outletEventsLookup: TOutletEventLookup | null;
24
+ static domEvents: {
25
+ [k: string]: boolean;
26
+ };
27
+ eventRecords: Map<Event, boolean>;
28
+ getOutlets(): Array<OutletManagerController<T>> | null | void;
29
+ outletUpdate(event: Event, data: TOutletChangeData<T>): void;
30
+ getState(): T;
31
+ connect(): void;
32
+ syncOutlets(): void;
33
+ sendToOutlets(event: Event, updateTo?: TOutletChangeData<T>): void;
34
+ isListeningForOutletEvent(eventTypes: string): boolean;
35
+ isDOMEventName(eventName: string): boolean;
36
+ getEventKey(event: Event): string;
37
+ hasHeardEvent(event: Event): boolean;
38
+ get event_key_prefix(): string;
39
+ get event_key_postfix(): string;
40
+ get outletEvents(): TOutletEventLookup;
41
+ }
42
+ export {};
@@ -0,0 +1,237 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
+ };
6
+ var _OutletManagerController_instances, _OutletManagerController_outlets_get;
7
+ import { Controller } from '@hotwired/stimulus';
8
+ class OutletManagerController extends Controller {
9
+ constructor() {
10
+ super(...arguments);
11
+ _OutletManagerController_instances.add(this);
12
+ this.outletEventsLookup = null;
13
+ this.eventRecords = new Map();
14
+ }
15
+ getOutlets() {
16
+ return null;
17
+ }
18
+ outletUpdate(event, data) { }
19
+ getState() {
20
+ return null;
21
+ }
22
+ connect() {
23
+ this.syncOutlets();
24
+ }
25
+ syncOutlets() {
26
+ const event = new Event('init');
27
+ this.sendToOutlets(event, {
28
+ data: this.getState(),
29
+ eventKey: this.getEventKey(event),
30
+ });
31
+ }
32
+ sendToOutlets(event, updateTo = {}) {
33
+ var _a;
34
+ const eventKey = (_a = updateTo.eventKey) !== null && _a !== void 0 ? _a : this.getEventKey(event);
35
+ const outlets = __classPrivateFieldGet(this, _OutletManagerController_instances, "a", _OutletManagerController_outlets_get);
36
+ if (outlets === null || outlets === void 0 ? void 0 : outlets.length) {
37
+ for (const index in outlets) {
38
+ const outlet = outlets[index];
39
+ if (outlet.isListeningForOutletEvent(eventKey) && !this.hasHeardEvent(event)) {
40
+ const isSameControllerType = this.identifier === outlet.identifier;
41
+ outlet.outletUpdate(event, { eventKey, data: isSameControllerType ? updateTo.data : undefined });
42
+ }
43
+ }
44
+ }
45
+ }
46
+ isListeningForOutletEvent(eventTypes) {
47
+ const eventTypeNames = eventTypes.split('-');
48
+ if (!eventTypeNames.length) {
49
+ return false;
50
+ }
51
+ let lookup = this.outletEvents;
52
+ for (let i = 0; i < eventTypeNames.length; i++) {
53
+ const name = eventTypeNames[i];
54
+ if (typeof lookup === 'boolean') {
55
+ return lookup;
56
+ }
57
+ const hasWildCard = lookup['*'] !== undefined;
58
+ let nextKey = name;
59
+ if (hasWildCard) {
60
+ nextKey = '*';
61
+ }
62
+ else {
63
+ const isListeningForDOMEvent = lookup.domEvent !== undefined;
64
+ if (isListeningForDOMEvent && !this.isDOMEventName(name)) {
65
+ return false;
66
+ }
67
+ else if (isListeningForDOMEvent) {
68
+ nextKey = 'domEvent';
69
+ }
70
+ }
71
+ if (!lookup[nextKey]) {
72
+ return false;
73
+ }
74
+ lookup = lookup[nextKey];
75
+ }
76
+ return true;
77
+ }
78
+ isDOMEventName(eventName) {
79
+ return OutletManagerController.domEvents[eventName];
80
+ }
81
+ getEventKey(event) {
82
+ const pre = this.event_key_prefix;
83
+ const post = this.event_key_postfix;
84
+ const maybePreHyphen = pre ? '-' : '';
85
+ const maybePrefix = pre !== null && pre !== void 0 ? pre : '';
86
+ const maybePostHyphen = post ? '-' : '';
87
+ const maybePostfix = post !== null && post !== void 0 ? post : '';
88
+ return `${this.identifier}-${maybePrefix}${maybePreHyphen}${event.type}${maybePostHyphen}${maybePostfix}`;
89
+ }
90
+ hasHeardEvent(event) {
91
+ if (this.eventRecords.has(event)) {
92
+ return true;
93
+ }
94
+ this.eventRecords.set(event, true);
95
+ setTimeout(() => this.eventRecords.delete(event));
96
+ return false;
97
+ }
98
+ get event_key_prefix() {
99
+ return '';
100
+ }
101
+ get event_key_postfix() {
102
+ return '';
103
+ }
104
+ get outletEvents() {
105
+ if (!this.outletEventsLookup && this.hasOutletEventsValue) {
106
+ this.outletEventsLookup = this.outletEventsValue.reduce((acc, eventType) => {
107
+ let step = acc;
108
+ eventType.split('-').forEach((eventTypeName, i, splitArr) => {
109
+ if (typeof step === 'boolean') {
110
+ return;
111
+ }
112
+ if (i === splitArr.length - 1) {
113
+ step[eventTypeName] = true;
114
+ }
115
+ else if (step[eventTypeName] === undefined) {
116
+ step[eventTypeName] = {};
117
+ }
118
+ step = step[eventTypeName];
119
+ });
120
+ return acc;
121
+ }, {});
122
+ }
123
+ else if (!this.outletEventsLookup) {
124
+ this.outletEventsLookup = { '*': true };
125
+ }
126
+ return this.outletEventsLookup;
127
+ }
128
+ }
129
+ _OutletManagerController_instances = new WeakSet(), _OutletManagerController_outlets_get = function _OutletManagerController_outlets_get() {
130
+ const outlets = this.getOutlets();
131
+ if (outlets) {
132
+ return outlets;
133
+ }
134
+ const defaultOutlets = [];
135
+ if (this.hasToggleableOutlet) {
136
+ defaultOutlets.push(...this.toggleableOutlets);
137
+ }
138
+ if (this.hasOptionsOutlet) {
139
+ defaultOutlets.push(...this.optionsOutlets);
140
+ }
141
+ if (this.hasStringMatchOutlet) {
142
+ defaultOutlets.push(...this.stringMatchOutlets);
143
+ }
144
+ return defaultOutlets;
145
+ };
146
+ OutletManagerController.values = {
147
+ outletEvents: Array,
148
+ };
149
+ OutletManagerController.outlets = ['toggleable', 'options', 'string-match'];
150
+ OutletManagerController.domEvents = {
151
+ abort: true,
152
+ afterprint: true,
153
+ animationend: true,
154
+ animationiteration: true,
155
+ animationstart: true,
156
+ beforeprint: true,
157
+ beforeunload: true,
158
+ blur: true,
159
+ canplay: true,
160
+ canplaythrough: true,
161
+ change: true,
162
+ click: true,
163
+ contextmenu: true,
164
+ copy: true,
165
+ cut: true,
166
+ dblclick: true,
167
+ drag: true,
168
+ dragend: true,
169
+ dragenter: true,
170
+ dragleave: true,
171
+ dragover: true,
172
+ dragstart: true,
173
+ drop: true,
174
+ durationchange: true,
175
+ ended: true,
176
+ error: true,
177
+ focus: true,
178
+ focusin: true,
179
+ focusout: true,
180
+ fullscreenchange: true,
181
+ fullscreenerror: true,
182
+ hashchange: true,
183
+ input: true,
184
+ invalid: true,
185
+ keydown: true,
186
+ keypress: true,
187
+ keyup: true,
188
+ load: true,
189
+ loadeddata: true,
190
+ loadedmetadata: true,
191
+ loadstart: true,
192
+ message: true,
193
+ mousedown: true,
194
+ mouseenter: true,
195
+ mouseleave: true,
196
+ mousemove: true,
197
+ mouseover: true,
198
+ mouseout: true,
199
+ mouseup: true,
200
+ mousewheel: true,
201
+ offline: true,
202
+ online: true,
203
+ open: true,
204
+ pagehide: true,
205
+ pageshow: true,
206
+ paste: true,
207
+ pause: true,
208
+ play: true,
209
+ playing: true,
210
+ popstate: true,
211
+ progress: true,
212
+ ratechange: true,
213
+ resize: true,
214
+ reset: true,
215
+ scroll: true,
216
+ search: true,
217
+ seeked: true,
218
+ seeking: true,
219
+ select: true,
220
+ show: true,
221
+ stalled: true,
222
+ storage: true,
223
+ submit: true,
224
+ suspend: true,
225
+ timeupdate: true,
226
+ toggle: true,
227
+ touchcancel: true,
228
+ touchend: true,
229
+ touchmove: true,
230
+ touchstart: true,
231
+ transitionend: true,
232
+ unload: true,
233
+ volumechange: true,
234
+ waiting: true,
235
+ wheel: true,
236
+ };
237
+ export default OutletManagerController;