@unabridged/midwest 0.23.4 → 0.24.3
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/app/assets/javascript/midwest/index.ts +6 -0
- package/app/assets/javascript/midwest/viewport_observer.ts +49 -0
- package/app/assets/javascript/midwest.js +660 -72
- package/app/assets/javascript/midwest.js.map +1 -1
- package/app/assets/stylesheets/midwest/dark-mode.css +50 -0
- package/app/assets/stylesheets/midwest.css +1 -1
- package/app/assets/stylesheets/midwest.tailwind.css +8 -1
- package/dist/css/midwest.css +1 -1
- package/dist/javascript/collection/app/assets/javascript/midwest/index.js +6 -0
- package/dist/javascript/collection/app/assets/javascript/midwest/index.js.map +1 -1
- package/dist/javascript/collection/app/assets/javascript/midwest/viewport_observer.js +22 -0
- package/dist/javascript/collection/app/assets/javascript/midwest/viewport_observer.js.map +1 -0
- package/dist/javascript/collection/app/components/midwest/carousel_component/carousel_component_controller.js +4 -7
- package/dist/javascript/collection/app/components/midwest/carousel_component/carousel_component_controller.js.map +1 -1
- package/dist/javascript/collection/app/components/midwest/command_palette_component/command_palette_component_controller.js +66 -8
- package/dist/javascript/collection/app/components/midwest/command_palette_component/command_palette_component_controller.js.map +1 -1
- package/dist/javascript/collection/app/components/midwest/dropdown_component/dropdown_component_controller.js +0 -6
- package/dist/javascript/collection/app/components/midwest/dropdown_component/dropdown_component_controller.js.map +1 -1
- package/dist/javascript/collection/app/components/midwest/intersection_observer_component/intersection_observer_component_controller.js +20 -25
- package/dist/javascript/collection/app/components/midwest/intersection_observer_component/intersection_observer_component_controller.js.map +1 -1
- package/dist/javascript/collection/app/components/midwest/motion_component/motion_component_controller.js +32 -0
- package/dist/javascript/collection/app/components/midwest/motion_component/motion_component_controller.js.map +1 -0
- package/dist/javascript/collection/app/components/midwest/notification_component/notification_component_controller.js +4 -12
- package/dist/javascript/collection/app/components/midwest/notification_component/notification_component_controller.js.map +1 -1
- package/dist/javascript/collection/app/components/midwest/panorama_component/panorama_component_controller.js +296 -0
- package/dist/javascript/collection/app/components/midwest/panorama_component/panorama_component_controller.js.map +1 -0
- package/dist/javascript/collection/app/components/midwest/playlist_component/playlist_component_controller.js +220 -0
- package/dist/javascript/collection/app/components/midwest/playlist_component/playlist_component_controller.js.map +1 -0
- package/dist/javascript/collection/app/components/midwest/table_component/load_more_controller.js +10 -14
- package/dist/javascript/collection/app/components/midwest/table_component/load_more_controller.js.map +1 -1
- package/dist/javascript/midwest.js +660 -72
- package/dist/javascript/midwest.js.map +1 -1
- package/package.json +1 -1
|
@@ -36,6 +36,9 @@ import IntersectionObserver from '../../../components/midwest/intersection_obser
|
|
|
36
36
|
import FocusTrap from '../../../components/midwest/focus_trap_component/focus_trap_component_controller'
|
|
37
37
|
import Onboarding from '../../../components/midwest/onboarding_component/onboarding_component_controller'
|
|
38
38
|
import ThemeSwitch from '../../../components/midwest/form/switch_component/theme_switch_controller'
|
|
39
|
+
import Panorama from '../../../components/midwest/panorama_component/panorama_component_controller'
|
|
40
|
+
import Playlist from '../../../components/midwest/playlist_component/playlist_component_controller'
|
|
41
|
+
import Motion from '../../../components/midwest/motion_component/motion_component_controller'
|
|
39
42
|
/* IMPORTS */
|
|
40
43
|
|
|
41
44
|
export { Card, Banner, CountdownTimer, Chart }
|
|
@@ -79,5 +82,8 @@ export function registerMidwestControllers (application: any) {
|
|
|
79
82
|
application.register('midwest-focus-trap', FocusTrap)
|
|
80
83
|
application.register('midwest-onboarding', Onboarding)
|
|
81
84
|
application.register('midwest-theme-switch', ThemeSwitch)
|
|
85
|
+
application.register('midwest-panorama', Panorama)
|
|
86
|
+
application.register('midwest-playlist', Playlist)
|
|
87
|
+
application.register('midwest-motion', Motion)
|
|
82
88
|
/* EXPORTS */
|
|
83
89
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Shared viewport-detection helper for components that react to scrolling into
|
|
2
|
+
// and out of view (IntersectionObserverComponent, MotionComponent, …).
|
|
3
|
+
//
|
|
4
|
+
// Wraps the IntersectionObserver API so controllers only describe *what* to do
|
|
5
|
+
// on enter/leave, not the observer plumbing. Components own the reaction (toggle
|
|
6
|
+
// a class, dispatch an event, reveal an animation); this module owns creating,
|
|
7
|
+
// observing, and tearing down the observer so the behavior stays consistent.
|
|
8
|
+
|
|
9
|
+
export interface ViewportObserverOptions {
|
|
10
|
+
// Fraction(s) of the element that must be visible to count as intersecting.
|
|
11
|
+
threshold?: number | number[]
|
|
12
|
+
// Margin around the viewport root (CSS shorthand string).
|
|
13
|
+
rootMargin?: string
|
|
14
|
+
// Stop observing after the first time the element enters the viewport.
|
|
15
|
+
once?: boolean
|
|
16
|
+
// Called each time the element enters the viewport.
|
|
17
|
+
onEnter?: (entry: IntersectionObserverEntry) => void
|
|
18
|
+
// Called each time the element leaves the viewport. Never called after the
|
|
19
|
+
// first enter when `once` is true (the observer has disconnected by then).
|
|
20
|
+
onLeave?: (entry: IntersectionObserverEntry) => void
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Observe `element` crossing the viewport threshold, invoking the callbacks as
|
|
24
|
+
// it enters and leaves. Returns a teardown function that disconnects the
|
|
25
|
+
// observer; callers should invoke it from their controller's `disconnect()`.
|
|
26
|
+
export function observeViewport (
|
|
27
|
+
element: Element,
|
|
28
|
+
options: ViewportObserverOptions = {}
|
|
29
|
+
): () => void {
|
|
30
|
+
const { threshold = 0, rootMargin = '0px', once = false, onEnter, onLeave } = options
|
|
31
|
+
|
|
32
|
+
const observer = new IntersectionObserver(
|
|
33
|
+
(entries) => {
|
|
34
|
+
for (const entry of entries) {
|
|
35
|
+
if (entry.isIntersecting) {
|
|
36
|
+
onEnter?.(entry)
|
|
37
|
+
if (once) observer.disconnect()
|
|
38
|
+
} else {
|
|
39
|
+
onLeave?.(entry)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{ threshold, rootMargin }
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
observer.observe(element)
|
|
47
|
+
|
|
48
|
+
return () => observer.disconnect()
|
|
49
|
+
}
|