ariadne_view_components 0.0.55-x64-mingw-ucrt → 0.0.57-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2 -0
  3. data/app/assets/builds/ariadne_view_components.css +16 -4
  4. data/app/assets/javascripts/ariadne_view_components.js +8 -0
  5. data/app/assets/javascripts/ariadne_view_components.js.map +1 -0
  6. data/app/assets/javascripts/components/ariadne/accumulator_controller/accumulator_controller.d.ts +22 -0
  7. data/app/assets/javascripts/components/ariadne/ariadne-form.d.ts +22 -0
  8. data/app/assets/javascripts/components/ariadne/ariadne.d.ts +2 -0
  9. data/app/assets/javascripts/components/ariadne/clipboard_copy_component/clipboard-copy-component.d.ts +4 -0
  10. data/app/assets/javascripts/components/ariadne/dropdown/menu_component.d.ts +1 -0
  11. data/app/assets/javascripts/components/ariadne/events_controller/events_controller.d.ts +4 -0
  12. data/app/assets/javascripts/components/ariadne/options_controller/options_controller.d.ts +39 -0
  13. data/app/assets/javascripts/components/ariadne/outlet_manager_controller/outlet_manager_controller.d.ts +42 -0
  14. data/app/assets/javascripts/components/ariadne/rich_text_area_component/rich-text-area-component.d.ts +6 -0
  15. data/app/assets/javascripts/components/ariadne/slideover_component/slideover-component.d.ts +9 -0
  16. data/app/assets/javascripts/components/ariadne/string_match_controller/string_match_controller.d.ts +27 -0
  17. data/app/assets/javascripts/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.d.ts +48 -0
  18. data/app/assets/javascripts/components/ariadne/tab_container_component/tab-container-component.d.ts +1 -0
  19. data/app/assets/javascripts/components/ariadne/tab_nav_component/tab-nav-component.d.ts +9 -0
  20. data/app/assets/javascripts/components/ariadne/time_ago_component/time-ago-component.d.ts +1 -0
  21. data/app/assets/javascripts/components/ariadne/toggleable_controller/toggleable_controller.d.ts +34 -0
  22. data/app/assets/javascripts/components/ariadne/tooltip_component/tooltip-component.d.ts +24 -0
  23. data/app/components/ariadne/options_controller/options_controller.js +6 -3
  24. data/app/components/ariadne/options_controller/options_controller.ts +9 -4
  25. data/app/components/ariadne/outlet_manager_controller/outlet_manager_controller.js +1 -1
  26. data/app/components/ariadne/outlet_manager_controller/outlet_manager_controller.ts +1 -1
  27. data/lib/ariadne/view_components/version.rb +1 -1
  28. metadata +21 -2
@@ -0,0 +1,22 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ export default class AccumulatorController extends Controller {
3
+ static targets: string[];
4
+ static values: {
5
+ syncAttrs: {
6
+ type: ArrayConstructor;
7
+ default: string[];
8
+ };
9
+ sumAttr: {
10
+ type: string;
11
+ default: string;
12
+ };
13
+ };
14
+ sumTargets: Array<HTMLElement>;
15
+ accumulatorTarget?: HTMLElement;
16
+ syncAttrsValue: Array<string>;
17
+ sumAttrValue: string;
18
+ connect(): void;
19
+ accumulate(): void;
20
+ setAttributesTo(sum: number): void;
21
+ get accumulator(): Element;
22
+ }
@@ -0,0 +1,22 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ import type { TemplateResult } from 'lit-html';
3
+ type HTMLFormField = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
4
+ export default class AriadneFormWith extends Controller {
5
+ static targets: string[];
6
+ readonly formFieldTargets: [HTMLFormField];
7
+ connect(): void;
8
+ disconnect(): void;
9
+ onBlur: (event: Event) => void;
10
+ onSubmit: (event: Event) => void;
11
+ validateForm(): boolean;
12
+ validateField(field: HTMLFormField): boolean;
13
+ shouldValidateField(field: HTMLFormField): boolean;
14
+ refreshErrorForInvalidField(field: HTMLFormField, isValid: boolean): void;
15
+ removeExistingErrorMessage(field: HTMLFormField): void;
16
+ showErrorForInvalidField(field: HTMLFormField): void;
17
+ buildFieldErrorHtml(field: HTMLFormField): string;
18
+ get formFields(): HTMLFormField[];
19
+ get firstInvalidField(): HTMLFormField | undefined;
20
+ getRenderString: (data: TemplateResult) => string;
21
+ }
22
+ export {};
@@ -0,0 +1,2 @@
1
+ import './tab_container_component/tab-container-component';
2
+ import './time_ago_component/time-ago-component';
@@ -0,0 +1,4 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ export default class ClipboardCopyComponent extends Controller {
3
+ copy(): void;
4
+ }
@@ -0,0 +1 @@
1
+ import '@github/details-menu-element';
@@ -0,0 +1,4 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ export default class EventsController extends Controller {
3
+ stopPropagation(e: Event): void;
4
+ }
@@ -0,0 +1,39 @@
1
+ import { TOutletChangeData } from '../outlet_manager_controller/outlet_manager_controller';
2
+ import SyncedBooleanAttributesController from '../synced_boolean_attributes_controller/synced_boolean_attributes_controller';
3
+ type TOptionKey = string | number;
4
+ type TActiveOptions = {
5
+ [k: TOptionKey]: boolean;
6
+ };
7
+ export interface OptionsOutlet extends SyncedBooleanAttributesController<TActiveOptions> {
8
+ select: (e: Event, updateTo?: TOutletChangeData<TActiveOptions>) => void;
9
+ }
10
+ export default class OptionsController extends SyncedBooleanAttributesController<TActiveOptions> implements OptionsOutlet {
11
+ #private;
12
+ static outlets: string[];
13
+ static targets: string[];
14
+ static values: {
15
+ activeOptions: ObjectConstructor;
16
+ isMulti: {
17
+ type: BooleanConstructor;
18
+ default: boolean;
19
+ };
20
+ toggleable: {
21
+ type: BooleanConstructor;
22
+ default: boolean;
23
+ };
24
+ syncedAttrs: ArrayConstructor;
25
+ antiAttrs: ArrayConstructor;
26
+ protectAttrs: BooleanConstructor;
27
+ outletEvents: ArrayConstructor;
28
+ };
29
+ readonly optionTargets: Array<Element>;
30
+ activeOptionsValue: TActiveOptions;
31
+ readonly isMultiValue: boolean;
32
+ readonly toggleableValue: boolean;
33
+ select(event: Event, updateTo?: TOutletChangeData<TActiveOptions>): void;
34
+ optionTargetConnected(element: Element): void;
35
+ getValueForElement(element: Element): boolean;
36
+ getState(): TActiveOptions;
37
+ outletUpdate: (event: Event, updateTo?: TOutletChangeData<TActiveOptions>) => void;
38
+ }
39
+ export {};
@@ -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,6 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ export default class RichTextArea extends Controller {
3
+ static targets: string[];
4
+ readonly editorTargets: [HTMLDivElement];
5
+ connect(): void;
6
+ }
@@ -0,0 +1,9 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ export default class SlideoverComponent extends Controller {
3
+ static targets: string[];
4
+ readonly expandableTarget: HTMLDivElement;
5
+ readonly expandWrapperTarget: HTMLDivElement;
6
+ readonly slidePanelTargets: [HTMLDivElement];
7
+ readonly buttonWrapperTarget: HTMLDivElement;
8
+ toggle(): void;
9
+ }
@@ -0,0 +1,27 @@
1
+ import { TOutletChangeData } from '../outlet_manager_controller/outlet_manager_controller';
2
+ import SyncedBooleanAttributesController from '../synced_boolean_attributes_controller/synced_boolean_attributes_controller';
3
+ export interface StringMatchOutlet extends SyncedBooleanAttributesController<string> {
4
+ change: (event: Event, updateTo?: TOutletChangeData<string>) => void;
5
+ }
6
+ export default class StringMatchController extends SyncedBooleanAttributesController<string> implements StringMatchOutlet {
7
+ #private;
8
+ static outlets: string[];
9
+ static targets: string[];
10
+ static values: {
11
+ keyword: StringConstructor;
12
+ syncedAttrs: ArrayConstructor;
13
+ antiAttrs: ArrayConstructor;
14
+ protectAttrs: BooleanConstructor;
15
+ outletEvents: ArrayConstructor;
16
+ };
17
+ readonly matchTargets: Array<HTMLElement>;
18
+ readonly hasMatchTarget: boolean;
19
+ readonly emptyTarget: Element;
20
+ readonly hasEmptyTarget: boolean;
21
+ keywordValue: string;
22
+ change(event: Event, updateTo?: TOutletChangeData<string>): void;
23
+ getElementsToSync(): Element[] | null | undefined;
24
+ getValueForElement(element: Element): boolean;
25
+ getState(): string;
26
+ outletUpdate: (event: Event, updateTo?: TOutletChangeData<string>) => void;
27
+ }
@@ -0,0 +1,48 @@
1
+ import OutletManagerController from '../outlet_manager_controller/outlet_manager_controller';
2
+ export type TStimulusDispatchEvent<TDetails> = {
3
+ target?: Element | undefined;
4
+ detail?: TDetails | undefined;
5
+ prefix?: string | undefined;
6
+ bubbles?: boolean | undefined;
7
+ cancelable?: boolean | undefined;
8
+ preventDefault: () => void;
9
+ };
10
+ export type TBooleanValueDetail = {
11
+ value: boolean;
12
+ };
13
+ export interface TSyncAttrDetail extends TBooleanValueDetail {
14
+ attr: string;
15
+ }
16
+ export default class SyncedBooleanAttributesController<T> extends OutletManagerController<T> {
17
+ #private;
18
+ static values: {
19
+ syncedAttrs: ArrayConstructor;
20
+ antiAttrs: ArrayConstructor;
21
+ protectAttrs: BooleanConstructor;
22
+ outletEvents: ArrayConstructor;
23
+ };
24
+ readonly syncedAttrsValue: string[];
25
+ readonly hasSyncedAttrsValue: boolean;
26
+ readonly antiAttrsValue: string[];
27
+ readonly hasAntiAttrsValue: boolean;
28
+ readonly protectAttrsValue: boolean;
29
+ static removeOnFalseAttrs: {
30
+ [k: string]: boolean;
31
+ };
32
+ syncedAttrsLookup: {
33
+ [k: string]: boolean;
34
+ } | null;
35
+ antiAttrsLookup: {
36
+ [k: string]: boolean;
37
+ } | null;
38
+ getValueForElement(element: Element): boolean | null;
39
+ getElementsToSync(): Array<Element> | null | undefined;
40
+ connect(): void;
41
+ updateAttributesForElement(element: Element, value: boolean): void;
42
+ getSyncedAttrsForElement(element: Element): string[] | null;
43
+ getAntiAttrsForElement(element: Element): string[] | null;
44
+ getParsedAttributeForElement<T>(element: Element, attribute: string): T | null;
45
+ syncElementAttributes(): void;
46
+ validateAttrChange(dispatchEvent: TStimulusDispatchEvent<TSyncAttrDetail>): void;
47
+ doesElementHaveOnAttrs(element: Element): boolean;
48
+ }
@@ -0,0 +1 @@
1
+ import '@github/tab-container-element';
@@ -0,0 +1,9 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ export default class TabNavComponent extends Controller {
3
+ static targets: string[];
4
+ readonly tabTargets: [HTMLAnchorElement];
5
+ SELECTED_CLASSES: string[];
6
+ UNSELECTED_CLASSES: string[];
7
+ connect(): void;
8
+ toggle(event: Event): void;
9
+ }
@@ -0,0 +1 @@
1
+ import '@github/time-elements';
@@ -0,0 +1,34 @@
1
+ import type { TOutletChangeData } from '../outlet_manager_controller/outlet_manager_controller';
2
+ import SyncedBooleanAttributesController from '../synced_boolean_attributes_controller/synced_boolean_attributes_controller';
3
+ export interface ToggleableOutlet extends SyncedBooleanAttributesController<boolean> {
4
+ toggle: (event: Event, updateTo?: TOutletChangeData<boolean>) => void;
5
+ }
6
+ export default class ToggleableController extends SyncedBooleanAttributesController<boolean> implements ToggleableOutlet {
7
+ static outlets: string[];
8
+ static values: {
9
+ state: {
10
+ type: BooleanConstructor;
11
+ default: boolean;
12
+ };
13
+ closeOnOutsideClick: {
14
+ type: BooleanConstructor;
15
+ default: boolean;
16
+ };
17
+ syncedAttrs: ArrayConstructor;
18
+ antiAttrs: ArrayConstructor;
19
+ protectAttrs: BooleanConstructor;
20
+ outletEvents: ArrayConstructor;
21
+ };
22
+ stateValue: boolean;
23
+ readonly closeOnOutsideClickValue: boolean;
24
+ connect(): void;
25
+ toggle(event: Event, updateTo?: TOutletChangeData<boolean>): void;
26
+ on(event: Event): void;
27
+ off(event: Event): void;
28
+ clickOutside(event: Event): void;
29
+ getValueForElement(element: Element): boolean | null;
30
+ getElementsToSync(): Element[] | null | undefined;
31
+ getState(): boolean;
32
+ get event_key_postfix(): "on" | "off";
33
+ outletUpdate: (event: Event, updateTo?: TOutletChangeData<boolean>) => void;
34
+ }
@@ -0,0 +1,24 @@
1
+ import { Controller } from '@hotwired/stimulus';
2
+ import type { Instance, Placement } from '@popperjs/core';
3
+ export default class TooltipComponent extends Controller {
4
+ static targets: string[];
5
+ readonly triggerTarget: HTMLElement;
6
+ readonly tooltipTarget: HTMLElement;
7
+ static values: {
8
+ placement: {
9
+ type: StringConstructor;
10
+ default: string;
11
+ };
12
+ offset: {
13
+ type: ArrayConstructor;
14
+ default: number[];
15
+ };
16
+ };
17
+ readonly placementValue: Placement;
18
+ readonly offsetValue: Array<number>;
19
+ popperInstance: Instance;
20
+ connect(): void;
21
+ disconnect(): void;
22
+ show(): void;
23
+ hide(): void;
24
+ }
@@ -74,11 +74,14 @@ _OptionsController_instances = new WeakSet(), _OptionsController_shouldChangeSta
74
74
  delete copy[key];
75
75
  this.activeOptionsValue = copy;
76
76
  }, _OptionsController_getElementKey = function _OptionsController_getElementKey(element) {
77
- const elementValue = element.getAttribute('data-option-value');
78
- if (elementValue) {
77
+ const elementValue = element === null || element === void 0 ? void 0 : element.getAttribute('data-option-value');
78
+ if (elementValue)
79
79
  return elementValue;
80
+ const content = element === null || element === void 0 ? void 0 : element.textContent;
81
+ if (content === null) {
82
+ throw new Error(`${element.tagName} was given as an options target without a data-option-value or textContent. One must be provided to identify the target.`);
80
83
  }
81
- return element.textContent.trim();
84
+ return content.trim();
82
85
  };
83
86
  OptionsController.outlets = SyncedBooleanAttributesController.outlets;
84
87
  OptionsController.targets = ['option'];
@@ -96,12 +96,17 @@ export default class OptionsController
96
96
  }
97
97
 
98
98
  #getElementKey(element: Element) {
99
- const elementValue = element.getAttribute('data-option-value')
100
- if (elementValue) {
101
- return elementValue
99
+ const elementValue = element?.getAttribute('data-option-value')
100
+ if (elementValue) return elementValue
101
+
102
+ const content = (element as HTMLElement)?.textContent
103
+ if (content === null) {
104
+ throw new Error(
105
+ `${element.tagName} was given as an options target without a data-option-value or textContent. One must be provided to identify the target.`,
106
+ )
102
107
  }
103
108
 
104
- return (element as HTMLElement).textContent.trim()
109
+ return content.trim()
105
110
  }
106
111
 
107
112
  getValueForElement(element: Element) {
@@ -15,7 +15,7 @@ class OutletManagerController extends Controller {
15
15
  getOutlets() {
16
16
  return null;
17
17
  }
18
- outletUpdate(event, data) { }
18
+ outletUpdate(event, data) { } // eslint-disable-line no-unused-vars
19
19
  getState() {
20
20
  return null;
21
21
  }
@@ -121,7 +121,7 @@ export default class OutletManagerController<T> extends Controller {
121
121
  return null
122
122
  }
123
123
 
124
- outletUpdate(event: Event, data: TOutletChangeData<T>): void {}
124
+ outletUpdate(event: Event, data: TOutletChangeData<T>): void {} // eslint-disable-line no-unused-vars
125
125
 
126
126
  getState(): T {
127
127
  return null as T
@@ -3,6 +3,6 @@
3
3
  # :nocov:
4
4
  module Ariadne
5
5
  module ViewComponents
6
- VERSION = "0.0.55"
6
+ VERSION = "0.0.57"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ariadne_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.55
4
+ version: 0.0.57
5
5
  platform: x64-mingw-ucrt
6
6
  authors:
7
7
  - Garen J. Torikian
@@ -112,6 +112,25 @@ files:
112
112
  - LICENSE.txt
113
113
  - README.md
114
114
  - app/assets/builds/ariadne_view_components.css
115
+ - app/assets/javascripts/ariadne_view_components.js
116
+ - app/assets/javascripts/ariadne_view_components.js.map
117
+ - app/assets/javascripts/components/ariadne/accumulator_controller/accumulator_controller.d.ts
118
+ - app/assets/javascripts/components/ariadne/ariadne-form.d.ts
119
+ - app/assets/javascripts/components/ariadne/ariadne.d.ts
120
+ - app/assets/javascripts/components/ariadne/clipboard_copy_component/clipboard-copy-component.d.ts
121
+ - app/assets/javascripts/components/ariadne/dropdown/menu_component.d.ts
122
+ - app/assets/javascripts/components/ariadne/events_controller/events_controller.d.ts
123
+ - app/assets/javascripts/components/ariadne/options_controller/options_controller.d.ts
124
+ - app/assets/javascripts/components/ariadne/outlet_manager_controller/outlet_manager_controller.d.ts
125
+ - app/assets/javascripts/components/ariadne/rich_text_area_component/rich-text-area-component.d.ts
126
+ - app/assets/javascripts/components/ariadne/slideover_component/slideover-component.d.ts
127
+ - app/assets/javascripts/components/ariadne/string_match_controller/string_match_controller.d.ts
128
+ - app/assets/javascripts/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.d.ts
129
+ - app/assets/javascripts/components/ariadne/tab_container_component/tab-container-component.d.ts
130
+ - app/assets/javascripts/components/ariadne/tab_nav_component/tab-nav-component.d.ts
131
+ - app/assets/javascripts/components/ariadne/time_ago_component/time-ago-component.d.ts
132
+ - app/assets/javascripts/components/ariadne/toggleable_controller/toggleable_controller.d.ts
133
+ - app/assets/javascripts/components/ariadne/tooltip_component/tooltip-component.d.ts
115
134
  - app/assets/stylesheets/ariadne_view_components.css
116
135
  - app/assets/stylesheets/dropdown.css
117
136
  - app/assets/stylesheets/prosemirror.css
@@ -323,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
323
342
  - !ruby/object:Gem::Version
324
343
  version: '0'
325
344
  requirements: []
326
- rubygems_version: 3.4.16
345
+ rubygems_version: 3.4.17
327
346
  signing_key:
328
347
  specification_version: 4
329
348
  summary: ViewComponents for the Ariadne Design System