stimulus-library 0.9.8 → 0.9.10
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/controllers/ajax/async_block_controller.d.ts +17 -0
- package/dist/controllers/ajax/index.d.ts +4 -0
- package/dist/controllers/ajax/lazy_block_controller.d.ts +9 -0
- package/dist/controllers/ajax/load_block_controller.d.ts +23 -0
- package/dist/controllers/ajax/poll_block_controller.d.ts +15 -0
- package/dist/controllers/anchor_spy_controller.d.ts +21 -0
- package/dist/controllers/back_link_controller.d.ts +16 -0
- package/dist/controllers/clipboard_controller.d.ts +18 -0
- package/dist/controllers/confirm_controller.d.ts +12 -0
- package/dist/controllers/confirm_navigation_controller.d.ts +14 -0
- package/dist/controllers/debug_controller.d.ts +6 -0
- package/dist/controllers/disable_with_controller.d.ts +19 -0
- package/dist/controllers/dismissable_controller.d.ts +6 -0
- package/dist/controllers/element_save_controller.d.ts +30 -0
- package/dist/controllers/empty_dom_controller.d.ts +21 -0
- package/dist/controllers/equalize_controller.d.ts +15 -0
- package/dist/controllers/forms/auto_submit_form_controller.d.ts +22 -0
- package/dist/controllers/forms/autosize_controller.d.ts +8 -0
- package/dist/controllers/forms/char_count_controller.d.ts +20 -0
- package/dist/controllers/forms/checkbox_disable_inputs_controller.d.ts +16 -0
- package/dist/controllers/forms/checkbox_enable_inputs_controller.d.ts +16 -0
- package/dist/controllers/forms/checkbox_select_all_controller.d.ts +13 -0
- package/dist/controllers/forms/checkbox_xor_controller.d.ts +8 -0
- package/dist/controllers/forms/detect_dirty_controller.d.ts +14 -0
- package/dist/controllers/forms/detect_dirty_form_controller.d.ts +17 -0
- package/dist/controllers/forms/enable_inputs_controller.d.ts +13 -0
- package/dist/controllers/forms/focus_steal_controller.d.ts +11 -0
- package/dist/controllers/forms/form_rc_controller.d.ts +17 -0
- package/dist/controllers/forms/form_save_controller.d.ts +31 -0
- package/dist/controllers/forms/index.d.ts +22 -0
- package/dist/controllers/forms/limited_selection_checkboxes_controller.d.ts +16 -0
- package/dist/controllers/forms/navigate_form_errors_controller.d.ts +40 -0
- package/dist/controllers/forms/nested_form_controller.d.ts +21 -0
- package/dist/controllers/forms/password_confirm_controller.d.ts +11 -0
- package/dist/controllers/forms/password_peek_controller.d.ts +8 -0
- package/dist/controllers/forms/remote_form_controller.d.ts +13 -0
- package/dist/controllers/forms/sync_inputs_controller.d.ts +19 -0
- package/dist/controllers/forms/value_warn_controller.d.ts +30 -0
- package/dist/controllers/forms/word_count_controller.d.ts +20 -0
- package/dist/controllers/index.d.ts +31 -0
- package/dist/controllers/media/fallback_image_controller.d.ts +19 -0
- package/dist/controllers/media/index.d.ts +3 -0
- package/dist/controllers/media/lightbox_image_controller.d.ts +30 -0
- package/dist/controllers/media/media_player_controller.d.ts +9 -0
- package/dist/controllers/persisted_dismissable_controller.d.ts +14 -0
- package/dist/controllers/prefetch_controller.d.ts +16 -0
- package/dist/controllers/print_button_controller.d.ts +7 -0
- package/dist/controllers/refresh_page_controller.d.ts +11 -0
- package/dist/controllers/responsive_iframe_controller.d.ts +16 -0
- package/dist/controllers/scroll/index.d.ts +5 -0
- package/dist/controllers/scroll/scroll_container_controller.d.ts +21 -0
- package/dist/controllers/scroll/scroll_into_focus_controller.d.ts +15 -0
- package/dist/controllers/scroll/scroll_to_bottom_controller.d.ts +11 -0
- package/dist/controllers/scroll/scroll_to_controller.d.ts +17 -0
- package/dist/controllers/scroll/scroll_to_top_controller.d.ts +11 -0
- package/dist/controllers/self_destruct_controller.d.ts +8 -0
- package/dist/controllers/signal/base_controller.d.ts +13 -0
- package/dist/controllers/signal/events.d.ts +4 -0
- package/dist/controllers/signal/expressions.d.ts +1 -0
- package/dist/controllers/signal/index.d.ts +6 -0
- package/dist/controllers/signal/signal_action_controller.d.ts +13 -0
- package/dist/controllers/signal/signal_disable_controller.d.ts +14 -0
- package/dist/controllers/signal/signal_dom_children_controller.d.ts +16 -0
- package/dist/controllers/signal/signal_enable_controller.d.ts +14 -0
- package/dist/controllers/signal/signal_input_controller.d.ts +20 -0
- package/dist/controllers/signal/signal_input_controller.js +16 -0
- package/dist/controllers/signal/signal_visibility_controller.d.ts +17 -0
- package/dist/controllers/sticky_controller.d.ts +15 -0
- package/dist/controllers/tables/index.d.ts +2 -0
- package/dist/controllers/tables/table_sort_controller.d.ts +20 -0
- package/dist/controllers/tables/table_truncate_controller.d.ts +30 -0
- package/dist/controllers/teleport_controller.d.ts +15 -0
- package/dist/controllers/temporary_state_controller.d.ts +27 -0
- package/dist/controllers/toggle_class_controller.d.ts +35 -0
- package/dist/controllers/trix_modifier_controller.d.ts +87 -0
- package/dist/controllers/turbo/index.d.ts +3 -0
- package/dist/controllers/turbo/turbo_frame_history_controller.d.ts +7 -0
- package/dist/controllers/turbo/turbo_frame_rc_controller.d.ts +20 -0
- package/dist/controllers/turbo/turbo_frame_refresh_controller.d.ts +13 -0
- package/dist/controllers/utility/alert_controller.d.ts +8 -0
- package/dist/controllers/utility/fullscreen_controller.d.ts +7 -0
- package/dist/controllers/utility/index.d.ts +8 -0
- package/dist/controllers/utility/intersection_controller.d.ts +13 -0
- package/dist/controllers/utility/interval_controller.d.ts +10 -0
- package/dist/controllers/utility/presence_controller.d.ts +13 -0
- package/dist/controllers/utility/print_controller.d.ts +4 -0
- package/dist/controllers/utility/timeout_controller.d.ts +9 -0
- package/dist/controllers/utility/user_focus_controller.d.ts +8 -0
- package/dist/controllers/visual/clock_controller.d.ts +15 -0
- package/dist/controllers/visual/countdown_controller.d.ts +46 -0
- package/dist/controllers/visual/duration_controller.d.ts +25 -0
- package/dist/controllers/visual/index.d.ts +7 -0
- package/dist/controllers/visual/tabs_controller.d.ts +29 -0
- package/dist/controllers/visual/time_distance_controller.d.ts +15 -0
- package/dist/controllers/visual/tree_view_controller.d.ts +25 -0
- package/dist/controllers/visual/tween_number_controller.d.ts +29 -0
- package/dist/index.d.ts +3 -0
- package/dist/mixins/create_mixin.d.ts +2 -0
- package/dist/mixins/index.d.ts +11 -0
- package/dist/mixins/install_class_methods.d.ts +5 -0
- package/dist/mixins/use_click_outside.d.ts +4 -0
- package/dist/mixins/use_event_bus.d.ts +7 -0
- package/dist/mixins/use_event_listener.d.ts +19 -0
- package/dist/mixins/use_fullscreen.d.ts +8 -0
- package/dist/mixins/use_geolocation.d.ts +18 -0
- package/dist/mixins/use_hover.d.ts +4 -0
- package/dist/mixins/use_injected_html.d.ts +10 -0
- package/dist/mixins/use_intersection.d.ts +13 -0
- package/dist/mixins/use_interval.d.ts +2 -0
- package/dist/mixins/use_localstorage.d.ts +20 -0
- package/dist/mixins/use_mutation_observer.d.ts +2 -0
- package/dist/mixins/use_resize_observer.d.ts +2 -0
- package/dist/mixins/use_temporary_content.d.ts +5 -0
- package/dist/mixins/use_timeout.d.ts +2 -0
- package/dist/mixins/use_trix_modifiers.d.ts +10 -0
- package/dist/polyfills/string.replaceAll.d.ts +0 -0
- package/dist/utilities/arrays.d.ts +1 -0
- package/dist/utilities/base_controller.d.ts +11 -0
- package/dist/utilities/easingFunctions.d.ts +34 -0
- package/dist/utilities/elements.d.ts +48 -0
- package/dist/utilities/ephemeral_controller.d.ts +6 -0
- package/dist/utilities/event_bus.d.ts +3 -0
- package/dist/utilities/events.d.ts +2 -0
- package/dist/utilities/fetchRetry.d.ts +1 -0
- package/dist/utilities/index.d.ts +7 -0
- package/dist/utilities/logging.d.ts +5 -0
- package/dist/utilities/reactive.d.ts +1 -0
- package/dist/utilities/request_submit.d.ts +2 -0
- package/dist/utilities/scroll.d.ts +10 -0
- package/dist/utilities/stimulus.d.ts +2 -0
- package/dist/utilities/strings.d.ts +1 -0
- package/dist/utilities/turbo.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { BaseController } from "../utilities/base_controller";
|
|
2
|
+
export type ToggleClassMode = "on" | "off" | "toggle";
|
|
3
|
+
export declare class ToggleClassController extends BaseController {
|
|
4
|
+
static targets: string[];
|
|
5
|
+
static values: {
|
|
6
|
+
class: StringConstructor;
|
|
7
|
+
mouseEnter: StringConstructor;
|
|
8
|
+
mouseLeave: StringConstructor;
|
|
9
|
+
clickAway: BooleanConstructor;
|
|
10
|
+
initial: StringConstructor;
|
|
11
|
+
};
|
|
12
|
+
readonly toggleTargets: HTMLElement[];
|
|
13
|
+
readonly classValue: string;
|
|
14
|
+
readonly hasClassValue: boolean;
|
|
15
|
+
readonly mouseEnterValue: ToggleClassMode;
|
|
16
|
+
readonly hasMouseEnterValue: boolean;
|
|
17
|
+
readonly mouseLeaveValue: ToggleClassMode;
|
|
18
|
+
readonly hasMouseLeaveValue: boolean;
|
|
19
|
+
readonly clickAwayValue: boolean;
|
|
20
|
+
readonly hasClickAwayValue: boolean;
|
|
21
|
+
readonly initialValue: "on" | "off";
|
|
22
|
+
readonly hasInitialValue: boolean;
|
|
23
|
+
connect(): void;
|
|
24
|
+
clickOutside(): void;
|
|
25
|
+
mouseEnter(): {};
|
|
26
|
+
mouseLeave(): {};
|
|
27
|
+
on(event?: Event): void;
|
|
28
|
+
off(event?: Event): void;
|
|
29
|
+
toggle(event?: Event): void;
|
|
30
|
+
private _elementWasToggled;
|
|
31
|
+
private _elementToggleStatus;
|
|
32
|
+
private _elementToggle;
|
|
33
|
+
private _elementOn;
|
|
34
|
+
private _elementOff;
|
|
35
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { BaseController } from "../utilities/base_controller";
|
|
2
|
+
import { TrixElementsPayload } from "../mixins/use_trix_modifiers";
|
|
3
|
+
interface TrixInstallable {
|
|
4
|
+
install: (elements: TrixElementsPayload) => void;
|
|
5
|
+
uninstall: (elements: TrixElementsPayload) => void;
|
|
6
|
+
pasteEvent?: (event: TrixPasteEvent) => void;
|
|
7
|
+
}
|
|
8
|
+
interface TrixPasteEventPayload {
|
|
9
|
+
dataTransfer: DataTransfer;
|
|
10
|
+
html: string;
|
|
11
|
+
range: [number, number];
|
|
12
|
+
type: string;
|
|
13
|
+
}
|
|
14
|
+
interface TrixPasteEvent extends CustomEvent {
|
|
15
|
+
paste: TrixPasteEventPayload;
|
|
16
|
+
}
|
|
17
|
+
export declare class TrixModifierController extends BaseController {
|
|
18
|
+
get enabledBehaviours(): TrixInstallable[];
|
|
19
|
+
get bold(): {
|
|
20
|
+
install: (elements: TrixElementsPayload) => void;
|
|
21
|
+
pasteEvent(pasteEvent: TrixPasteEvent): void;
|
|
22
|
+
uninstall: (elements: TrixElementsPayload) => void;
|
|
23
|
+
};
|
|
24
|
+
get bulletList(): {
|
|
25
|
+
install: (elements: TrixElementsPayload) => void;
|
|
26
|
+
pasteEvent(pasteEvent: TrixPasteEvent): void;
|
|
27
|
+
uninstall: (elements: TrixElementsPayload) => void;
|
|
28
|
+
};
|
|
29
|
+
get code(): {
|
|
30
|
+
install: (elements: TrixElementsPayload) => void;
|
|
31
|
+
pasteEvent(pasteEvent: TrixPasteEvent): void;
|
|
32
|
+
uninstall: (elements: TrixElementsPayload) => void;
|
|
33
|
+
};
|
|
34
|
+
get heading(): {
|
|
35
|
+
install: (elements: TrixElementsPayload) => void;
|
|
36
|
+
pasteEvent(pasteEvent: TrixPasteEvent): void;
|
|
37
|
+
uninstall: (elements: TrixElementsPayload) => void;
|
|
38
|
+
};
|
|
39
|
+
get italic(): {
|
|
40
|
+
install: (elements: TrixElementsPayload) => void;
|
|
41
|
+
pasteEvent(pasteEvent: TrixPasteEvent): void;
|
|
42
|
+
uninstall: (elements: TrixElementsPayload) => void;
|
|
43
|
+
};
|
|
44
|
+
get strikethrough(): {
|
|
45
|
+
install: (elements: TrixElementsPayload) => void;
|
|
46
|
+
pasteEvent(pasteEvent: TrixPasteEvent): void;
|
|
47
|
+
uninstall: (elements: TrixElementsPayload) => void;
|
|
48
|
+
};
|
|
49
|
+
get link(): {
|
|
50
|
+
install: (elements: TrixElementsPayload) => void;
|
|
51
|
+
pasteEvent(pasteEvent: TrixPasteEvent): void;
|
|
52
|
+
uninstall: (elements: TrixElementsPayload) => void;
|
|
53
|
+
};
|
|
54
|
+
get indents(): {
|
|
55
|
+
install: ({ toolbar }: TrixElementsPayload) => void;
|
|
56
|
+
uninstall: ({ toolbar }: TrixElementsPayload) => void;
|
|
57
|
+
};
|
|
58
|
+
get numberList(): {
|
|
59
|
+
install: ({ toolbar }: TrixElementsPayload) => void;
|
|
60
|
+
uninstall: ({ toolbar }: TrixElementsPayload) => void;
|
|
61
|
+
};
|
|
62
|
+
get quote(): {
|
|
63
|
+
install: ({ toolbar }: TrixElementsPayload) => void;
|
|
64
|
+
uninstall: ({ toolbar }: TrixElementsPayload) => void;
|
|
65
|
+
};
|
|
66
|
+
get fileUploads(): {
|
|
67
|
+
install(elements: TrixElementsPayload): void;
|
|
68
|
+
pasteEvent(event: TrixPasteEvent): void;
|
|
69
|
+
uninstall(elements: TrixElementsPayload): void;
|
|
70
|
+
};
|
|
71
|
+
connect(): void;
|
|
72
|
+
install(elements: TrixElementsPayload): void;
|
|
73
|
+
pasteEvent(event: TrixPasteEvent): void;
|
|
74
|
+
uninstall(elements: TrixElementsPayload): void;
|
|
75
|
+
simpleHideShowHandlers(selector: string): {
|
|
76
|
+
install: ({ toolbar }: TrixElementsPayload) => void;
|
|
77
|
+
uninstall: ({ toolbar }: TrixElementsPayload) => void;
|
|
78
|
+
};
|
|
79
|
+
formattingHandlers(selector: string, trixAttribute: string): {
|
|
80
|
+
install: (elements: TrixElementsPayload) => void;
|
|
81
|
+
pasteEvent(pasteEvent: TrixPasteEvent): void;
|
|
82
|
+
uninstall: (elements: TrixElementsPayload) => void;
|
|
83
|
+
};
|
|
84
|
+
showToolbarSelector(toolbar: HTMLElement, selector: string): void;
|
|
85
|
+
hideToolbarSelector(toolbar: HTMLElement, selector: string): void;
|
|
86
|
+
}
|
|
87
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseController } from "../../utilities/base_controller";
|
|
2
|
+
export declare class TurboFrameRCController extends BaseController {
|
|
3
|
+
static values: {
|
|
4
|
+
frameId: StringConstructor;
|
|
5
|
+
src: StringConstructor;
|
|
6
|
+
loadingMessage: StringConstructor;
|
|
7
|
+
};
|
|
8
|
+
readonly frameIdValue: string;
|
|
9
|
+
readonly srcValue: string;
|
|
10
|
+
readonly hasSrcValue: boolean;
|
|
11
|
+
readonly loadingMessageValue: string;
|
|
12
|
+
readonly hasLoadingMessageValue: boolean;
|
|
13
|
+
toggle(event?: Event): void;
|
|
14
|
+
setSrc(event?: Event): void;
|
|
15
|
+
clear(event?: Event): void;
|
|
16
|
+
private _setSrc;
|
|
17
|
+
private _clear;
|
|
18
|
+
private _getFrame;
|
|
19
|
+
private _getSrc;
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseController } from "../../utilities/base_controller";
|
|
2
|
+
export declare class TurboFrameRefreshController extends BaseController {
|
|
3
|
+
static values: {
|
|
4
|
+
interval: NumberConstructor;
|
|
5
|
+
poll: BooleanConstructor;
|
|
6
|
+
};
|
|
7
|
+
readonly intervalValue: number;
|
|
8
|
+
readonly pollValue: boolean;
|
|
9
|
+
readonly hasPollValue: boolean;
|
|
10
|
+
get _poll(): boolean;
|
|
11
|
+
connect(): void;
|
|
12
|
+
refresh(event?: Event): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './alert_controller';
|
|
2
|
+
export * from './fullscreen_controller';
|
|
3
|
+
export * from './intersection_controller';
|
|
4
|
+
export * from './interval_controller';
|
|
5
|
+
export * from './presence_controller';
|
|
6
|
+
export * from './print_controller';
|
|
7
|
+
export * from './timeout_controller';
|
|
8
|
+
export * from './user_focus_controller';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseController } from "../../utilities/base_controller";
|
|
2
|
+
export declare class IntersectionController extends BaseController {
|
|
3
|
+
static values: {
|
|
4
|
+
threshold: StringConstructor;
|
|
5
|
+
};
|
|
6
|
+
readonly isVisible: boolean;
|
|
7
|
+
readonly thresholdValue: string;
|
|
8
|
+
readonly hasThresholdValue: boolean;
|
|
9
|
+
get _threshold(): number[];
|
|
10
|
+
connect(): void;
|
|
11
|
+
appear(entry: IntersectionObserverEntry): void;
|
|
12
|
+
disappear(entry: IntersectionObserverEntry): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseController } from "../../utilities/base_controller";
|
|
2
|
+
export declare class IntervalController extends BaseController {
|
|
3
|
+
static values: {
|
|
4
|
+
seconds: NumberConstructor;
|
|
5
|
+
};
|
|
6
|
+
readonly secondsValue: number;
|
|
7
|
+
readonly hasSecondsValue: boolean;
|
|
8
|
+
connect(): void;
|
|
9
|
+
_interval(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseController } from "../../utilities/base_controller";
|
|
2
|
+
export declare class PresenceController extends BaseController {
|
|
3
|
+
static values: {
|
|
4
|
+
name: StringConstructor;
|
|
5
|
+
};
|
|
6
|
+
nameValue: string;
|
|
7
|
+
readonly hasNameValue: boolean;
|
|
8
|
+
get name(): string;
|
|
9
|
+
get _addedEventName(): string;
|
|
10
|
+
get _removedEventName(): string;
|
|
11
|
+
connect(): void;
|
|
12
|
+
disconnect(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseController } from "../../utilities/base_controller";
|
|
2
|
+
export declare class ClockController extends BaseController {
|
|
3
|
+
static targets: string[];
|
|
4
|
+
readonly hasHoursTarget: boolean;
|
|
5
|
+
readonly hoursTarget: HTMLElement;
|
|
6
|
+
readonly hasMinutesTarget: boolean;
|
|
7
|
+
readonly minutesTarget: HTMLElement;
|
|
8
|
+
readonly hasSecondsTarget: boolean;
|
|
9
|
+
readonly secondsTarget: HTMLElement;
|
|
10
|
+
readonly hasMillisecondsTarget: boolean;
|
|
11
|
+
readonly millisecondsTarget: HTMLElement;
|
|
12
|
+
get _tickInterval(): 1 | 1000 | 15000 | 300000;
|
|
13
|
+
connect(): void;
|
|
14
|
+
_tick(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type Duration } from "date-fns";
|
|
2
|
+
import { BaseController } from "../../utilities/base_controller";
|
|
3
|
+
export declare class CountdownController extends BaseController {
|
|
4
|
+
static values: {
|
|
5
|
+
deadline: StringConstructor;
|
|
6
|
+
removeUnused: BooleanConstructor;
|
|
7
|
+
};
|
|
8
|
+
static targets: string[];
|
|
9
|
+
static classes: string[];
|
|
10
|
+
readonly deadlineValue: string;
|
|
11
|
+
readonly removeUnusedValue: boolean;
|
|
12
|
+
readonly hasRemoveUnusedValue: boolean;
|
|
13
|
+
readonly hasYearsTarget: boolean;
|
|
14
|
+
readonly yearsTarget: HTMLElement;
|
|
15
|
+
readonly hasMonthsTarget: boolean;
|
|
16
|
+
readonly monthsTarget: HTMLElement;
|
|
17
|
+
readonly hasDaysTarget: boolean;
|
|
18
|
+
readonly daysTarget: HTMLElement;
|
|
19
|
+
readonly hasHoursTarget: boolean;
|
|
20
|
+
readonly hoursTarget: HTMLElement;
|
|
21
|
+
readonly hasMinutesTarget: boolean;
|
|
22
|
+
readonly minutesTarget: HTMLElement;
|
|
23
|
+
readonly hasSecondsTarget: boolean;
|
|
24
|
+
readonly secondsTarget: HTMLElement;
|
|
25
|
+
addEndedClasses: (el?: HTMLElement) => void;
|
|
26
|
+
removeEndedClasses: (el?: HTMLElement) => void;
|
|
27
|
+
addCountingDownClasses: (el?: HTMLElement) => void;
|
|
28
|
+
removeCountingDownClasses: (el?: HTMLElement) => void;
|
|
29
|
+
_timeout: null | ReturnType<typeof window.setTimeout>;
|
|
30
|
+
get _removeUnused(): boolean;
|
|
31
|
+
get _deadlineDate(): Date;
|
|
32
|
+
initialize(): void;
|
|
33
|
+
connect(): void;
|
|
34
|
+
disconnect(): void;
|
|
35
|
+
deadlineValueChanged(): void;
|
|
36
|
+
_tick(): void;
|
|
37
|
+
_clearTick(): void;
|
|
38
|
+
_updateTarget(target: HTMLElement, value: number): void;
|
|
39
|
+
_removeTargetIfUnused(target: HTMLElement, value: number): void;
|
|
40
|
+
_years(duration: Duration): number;
|
|
41
|
+
_months(duration: Duration): number;
|
|
42
|
+
_days(duration: Duration): number;
|
|
43
|
+
_hours(duration: Duration): number;
|
|
44
|
+
_minutes(duration: Duration): number;
|
|
45
|
+
_seconds(duration: Duration): number;
|
|
46
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Duration } from "date-fns";
|
|
2
|
+
import { BaseController } from "../../utilities/base_controller";
|
|
3
|
+
export declare class DurationController extends BaseController {
|
|
4
|
+
static values: {
|
|
5
|
+
timestamp: NumberConstructor;
|
|
6
|
+
minutes: BooleanConstructor;
|
|
7
|
+
seconds: BooleanConstructor;
|
|
8
|
+
};
|
|
9
|
+
readonly minutesValue: boolean;
|
|
10
|
+
readonly hasMinutesValue: boolean;
|
|
11
|
+
readonly secondsValue: boolean;
|
|
12
|
+
readonly hasSecondsValue: boolean;
|
|
13
|
+
timestampValue: number;
|
|
14
|
+
readonly hasTimestampValue: boolean;
|
|
15
|
+
_clearInterval: () => void;
|
|
16
|
+
get _format(): string[];
|
|
17
|
+
get _output(): string;
|
|
18
|
+
get _seconds(): boolean;
|
|
19
|
+
get _minutes(): boolean;
|
|
20
|
+
get _timestamp(): Date;
|
|
21
|
+
get _duration(): Duration;
|
|
22
|
+
get _tickInterval(): 1000 | 15000 | 120000;
|
|
23
|
+
connect(): void;
|
|
24
|
+
_update(): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './clock_controller';
|
|
2
|
+
export * from './countdown_controller';
|
|
3
|
+
export * from './duration_controller';
|
|
4
|
+
export * from './tabs_controller';
|
|
5
|
+
export * from './time_distance_controller';
|
|
6
|
+
export * from './tree_view_controller';
|
|
7
|
+
export * from './tween_number_controller';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BaseController } from "../../utilities/base_controller";
|
|
2
|
+
export declare class TabsController extends BaseController {
|
|
3
|
+
static values: {
|
|
4
|
+
currentTab: NumberConstructor;
|
|
5
|
+
equalize: BooleanConstructor;
|
|
6
|
+
};
|
|
7
|
+
static targets: string[];
|
|
8
|
+
static classes: string[];
|
|
9
|
+
currentTabValue: number;
|
|
10
|
+
hasCurrentTabValue: boolean;
|
|
11
|
+
equalizeValue: boolean;
|
|
12
|
+
hasEqualizeValue: boolean;
|
|
13
|
+
readonly linkTargets: HTMLElement[];
|
|
14
|
+
readonly contentTargets: HTMLElement[];
|
|
15
|
+
addHideClasses: (el?: HTMLElement) => void;
|
|
16
|
+
removeHideClasses: (el?: HTMLElement) => void;
|
|
17
|
+
addActiveClasses: (el?: HTMLElement) => void;
|
|
18
|
+
removeActiveClasses: (el?: HTMLElement) => void;
|
|
19
|
+
get defaultHideClasses(): string[];
|
|
20
|
+
get defaultActiveClasses(): string[];
|
|
21
|
+
get _currentTab(): number;
|
|
22
|
+
get _equalize(): boolean;
|
|
23
|
+
connect(): void;
|
|
24
|
+
switchTabs(event: Event): void;
|
|
25
|
+
currentTabValueChanged(): void;
|
|
26
|
+
_selectTab(index: number): void;
|
|
27
|
+
_clampIndex(index: number): number;
|
|
28
|
+
_setMinHeight(): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Duration } from "date-fns";
|
|
2
|
+
import { BaseController } from "../../utilities/base_controller";
|
|
3
|
+
export declare class TimeDistanceController extends BaseController {
|
|
4
|
+
static values: {
|
|
5
|
+
timestamp: NumberConstructor;
|
|
6
|
+
};
|
|
7
|
+
timestampValue: number;
|
|
8
|
+
readonly hasTimestampValue: boolean;
|
|
9
|
+
_timestamp: Date;
|
|
10
|
+
get _duration(): Duration;
|
|
11
|
+
get _nextUpdate(): number | null;
|
|
12
|
+
timestampValueChanged(): void;
|
|
13
|
+
connect(): void;
|
|
14
|
+
_update(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseController } from "../../utilities/base_controller";
|
|
2
|
+
export declare class TreeViewController extends BaseController {
|
|
3
|
+
static classes: string[];
|
|
4
|
+
activeClasses: string[];
|
|
5
|
+
activeClassesPresent: (el?: HTMLElement) => boolean;
|
|
6
|
+
addActiveClasses: (el?: HTMLElement) => void;
|
|
7
|
+
removeActiveClasses: (el?: HTMLElement) => void;
|
|
8
|
+
addCollapsedClasses: (el?: HTMLElement) => void;
|
|
9
|
+
removeCollapsedClasses: (el?: HTMLElement) => void;
|
|
10
|
+
get defaultActiveClasses(): string[];
|
|
11
|
+
get defaultCollapsedClasses(): string[];
|
|
12
|
+
initialize(): void;
|
|
13
|
+
connect(): void;
|
|
14
|
+
disconnect(): void;
|
|
15
|
+
_setup(): void;
|
|
16
|
+
_setupNode(el: HTMLElement): void;
|
|
17
|
+
_teardown(): void;
|
|
18
|
+
_teardownNode(el: HTMLElement): void;
|
|
19
|
+
_nodeClicked(event: MouseEvent): void;
|
|
20
|
+
_nodeActive(el: HTMLElement): boolean;
|
|
21
|
+
_showNode(el: HTMLElement): void;
|
|
22
|
+
_hideNode(el: HTMLElement): void;
|
|
23
|
+
_hasNested(el: HTMLElement): boolean;
|
|
24
|
+
mutate(entries: MutationRecord[]): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BaseController } from "../../utilities/base_controller";
|
|
2
|
+
import { EasingFunction, EasingFunctions } from "../../utilities/easingFunctions";
|
|
3
|
+
export declare class TweenNumberController extends BaseController {
|
|
4
|
+
static values: {
|
|
5
|
+
start: NumberConstructor;
|
|
6
|
+
end: NumberConstructor;
|
|
7
|
+
duration: NumberConstructor;
|
|
8
|
+
easing: StringConstructor;
|
|
9
|
+
};
|
|
10
|
+
startValue: number;
|
|
11
|
+
readonly hasStartValue: boolean;
|
|
12
|
+
endValue: number;
|
|
13
|
+
readonly hasEndValue: boolean;
|
|
14
|
+
durationValue: number;
|
|
15
|
+
readonly hasDurationValue: boolean;
|
|
16
|
+
easingValue: keyof typeof EasingFunctions;
|
|
17
|
+
readonly hasEasingValue: boolean;
|
|
18
|
+
private observer?;
|
|
19
|
+
private observe?;
|
|
20
|
+
private unobserve?;
|
|
21
|
+
private teardownObserver?;
|
|
22
|
+
get start(): number;
|
|
23
|
+
get end(): number;
|
|
24
|
+
get durationMs(): number;
|
|
25
|
+
get easingFunction(): EasingFunction;
|
|
26
|
+
connect(): void;
|
|
27
|
+
appear(_entry: IntersectionObserverEntry): void;
|
|
28
|
+
tween(): void;
|
|
29
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './use_event_listener';
|
|
2
|
+
export * from './use_fullscreen';
|
|
3
|
+
export * from './use_geolocation';
|
|
4
|
+
export * from './use_injected_html';
|
|
5
|
+
export * from './use_intersection';
|
|
6
|
+
export * from './use_interval';
|
|
7
|
+
export * from './use_localstorage';
|
|
8
|
+
export * from './use_mutation_observer';
|
|
9
|
+
export * from './use_resize_observer';
|
|
10
|
+
export * from './use_temporary_content';
|
|
11
|
+
export * from './use_timeout';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus";
|
|
2
|
+
export declare function useEventBus(controller: Controller, eventNameOrNames: string | string[], handler: (...args: any[]) => void, opts?: {
|
|
3
|
+
debounce?: number;
|
|
4
|
+
}): {
|
|
5
|
+
setup: () => void;
|
|
6
|
+
teardown: () => void;
|
|
7
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus";
|
|
2
|
+
export declare function useEventListener(controller: Controller, element: Document | Window | HTMLElement, eventNameOrNames: string | string[], handler: (...args: any[]) => void, opts?: AddEventListenerOptions & {
|
|
3
|
+
debounce?: number;
|
|
4
|
+
}): {
|
|
5
|
+
setup: () => void;
|
|
6
|
+
teardown: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare function useEventListeners(controller: Controller, element: Document | Window | HTMLElement, eventNameOrNames: string | string[], handler: (...args: any[]) => void, opts?: AddEventListenerOptions & {
|
|
9
|
+
debounce?: number;
|
|
10
|
+
}): {
|
|
11
|
+
setup: () => void;
|
|
12
|
+
teardown: () => void;
|
|
13
|
+
};
|
|
14
|
+
export declare function useCollectionEventListener(controller: Controller, elements: Array<Document | Window | HTMLElement>, eventNameOrNames: string | string[], handler: (...args: any[]) => void, opts?: AddEventListenerOptions & {
|
|
15
|
+
debounce?: number;
|
|
16
|
+
}): (() => void)[];
|
|
17
|
+
export declare function useCollectionEventListeners(controller: Controller, elements: Array<Document | Window | HTMLElement>, eventNameOrNames: string | string[], handler: (...args: any[]) => void, opts?: AddEventListenerOptions & {
|
|
18
|
+
debounce?: number;
|
|
19
|
+
}): (() => void)[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus";
|
|
2
|
+
export declare function useFullscreen(controller: Controller, el?: Element): {
|
|
3
|
+
isFullscreen: () => boolean;
|
|
4
|
+
enter: () => Promise<void>;
|
|
5
|
+
exit: () => Promise<void>;
|
|
6
|
+
toggle: () => Promise<void>;
|
|
7
|
+
teardown: () => void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus";
|
|
2
|
+
export interface GeolocationOptions extends Partial<PositionOptions> {
|
|
3
|
+
}
|
|
4
|
+
export interface GeolocationData {
|
|
5
|
+
locatedAt: number | null;
|
|
6
|
+
error: GeolocationPositionError | null;
|
|
7
|
+
coords: {
|
|
8
|
+
accuracy: number;
|
|
9
|
+
latitude: number;
|
|
10
|
+
longitude: number;
|
|
11
|
+
altitude: number | null;
|
|
12
|
+
altitudeAccuracy: number | null;
|
|
13
|
+
heading: number | null;
|
|
14
|
+
speed: number | null;
|
|
15
|
+
};
|
|
16
|
+
teardown: () => void;
|
|
17
|
+
}
|
|
18
|
+
export declare function useGeolocation(controller: Controller, options?: GeolocationOptions, update?: (...args: any[]) => void, error?: (...args: any[]) => void): GeolocationData;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus";
|
|
2
|
+
export declare function useInjectedFragment(controller: Controller, targetElement: HTMLElement, insertPosition: InsertPosition, fragment: DocumentFragment, options?: {
|
|
3
|
+
cleanup?: boolean;
|
|
4
|
+
}): [ChildNode[], () => void];
|
|
5
|
+
export declare function useInjectedHTML(controller: Controller, targetElement: HTMLElement, insertPosition: InsertPosition, html: string, options?: {
|
|
6
|
+
cleanup?: boolean;
|
|
7
|
+
}): [ChildNode[], () => void];
|
|
8
|
+
export declare function useInjectedElement(controller: Controller, targetElement: HTMLElement, insertPosition: InsertPosition, element: HTMLElement, options?: {
|
|
9
|
+
cleanup?: boolean;
|
|
10
|
+
}): [ChildNode, () => void];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus";
|
|
2
|
+
export declare function useIntersectionObserver(controller: Controller, handler: IntersectionObserverCallback, options?: IntersectionObserverInit): {
|
|
3
|
+
observer: IntersectionObserver;
|
|
4
|
+
teardown: () => void;
|
|
5
|
+
observe: (element: HTMLElement) => void | undefined;
|
|
6
|
+
unobserve: (element: HTMLElement) => void | undefined;
|
|
7
|
+
};
|
|
8
|
+
export declare function useIntersection(controller: Controller, element: HTMLElement, appear?: null | ((entry: IntersectionObserverEntry) => void), disappear?: null | ((entry: IntersectionObserverEntry) => void), options?: IntersectionObserverInit): {
|
|
9
|
+
observer: IntersectionObserver;
|
|
10
|
+
observe: () => void | undefined;
|
|
11
|
+
unobserve: () => void | undefined;
|
|
12
|
+
teardown: () => void;
|
|
13
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus";
|
|
2
|
+
export type Serializer<T> = {
|
|
3
|
+
deserialize(raw: string): T;
|
|
4
|
+
serialize(value: T): string;
|
|
5
|
+
isEmpty(value: T): boolean;
|
|
6
|
+
};
|
|
7
|
+
export interface LocalStorageProxy<T> {
|
|
8
|
+
get value(): T;
|
|
9
|
+
set value(value: T);
|
|
10
|
+
read(): T;
|
|
11
|
+
write(value: T): void;
|
|
12
|
+
clear(): void;
|
|
13
|
+
isEmpty(): boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const StorageSerializers: Record<'boolean' | 'object' | 'number' | 'any' | 'string' | 'map' | 'set', Serializer<any>> & {
|
|
16
|
+
[idx: string]: Serializer<any>;
|
|
17
|
+
};
|
|
18
|
+
export declare function useLocalStorage<T>(controller: Controller, key: string, defaultValue: T, opts?: {
|
|
19
|
+
writeDefaults: boolean;
|
|
20
|
+
}): LocalStorageProxy<T>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus";
|
|
2
|
+
export declare function useTemporaryContent(controller: Controller, target: HTMLElement, content: string, timeout?: number, teardownCallback?: () => void): {
|
|
3
|
+
teardown: () => void;
|
|
4
|
+
update(newContent: string): void;
|
|
5
|
+
};
|