@g9tm/lynxcontrols-intro-carousel 0.0.0-stage → 1.4.2

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.
@@ -0,0 +1,257 @@
1
+ import "./intro-carousel.css";
2
+ import { startTimer, stopTimer, useControllableState } from "@g9tm/lynxcontrols/base";
3
+ import { G9Button } from "@g9tm/lynxcontrols/button";
4
+ import { G9ActivityIndicator } from "@g9tm/lynxcontrols/display";
5
+ import { useG9HostInsetsOrNull } from "@g9tm/lynxcontrols/host";
6
+ import { G9IconSlot } from "@g9tm/lynxcontrols/icon";
7
+ import { useG9Core, useG9Diagnostics, useG9Direction, useG9OptionalService, useG9Settings, useG9Strings, useG9Theme, useG9Window } from "@g9tm/lynxcontrols/provider";
8
+ import { formatColor } from "@g9tm/lynxcontrols-foundation";
9
+ import { Swiper } from "@lynx-js/lynx-ui-swiper";
10
+ import { useEffect, useMemo, useRef, useSyncExternalStore } from "@lynx-js/react";
11
+ import { G9IntroMediaController } from "./media.jsx";
12
+ import { clampIntroIndex, g9IntroMetrics, introChromePadding, introOverlayOpacities } from "./model.jsx";
13
+ function createIntroCarouselController() {
14
+ let target = null;
15
+ return {
16
+ beginPresentation: ()=>null == target ? void 0 : target.begin(),
17
+ stopAndReleaseMedia: ()=>null == target ? void 0 : target.release(),
18
+ bind (next) {
19
+ target = next;
20
+ return ()=>{
21
+ if (target === next) target = null;
22
+ };
23
+ }
24
+ };
25
+ }
26
+ function useIntroCarousel() {
27
+ const ref = useRef(null);
28
+ if (null === ref.current) ref.current = createIntroCarouselController();
29
+ return ref.current;
30
+ }
31
+ const hex2 = (n)=>Math.round(255 * Math.min(Math.max(n, 0), 1)).toString(16).padStart(2, '0');
32
+ function withAlpha(color, alpha) {
33
+ return /^#[0-9a-f]{6}$/i.test(color) ? `${color}${hex2(alpha)}` : color;
34
+ }
35
+ function G9IntroCarousel(props) {
36
+ var _props_slides, _props_defaultCurrentIndex, _props_active, _props_overlayOpacity, _props_overlayTopOpacityRatio, _props_overlayTopOpacity, _props_overlayColor, _props_className, _snap_fallback, _props_startupCoverFadeDurationMs, _props_logo;
37
+ const slides = null != (_props_slides = props.slides) ? _props_slides : [];
38
+ const strings = useG9Strings();
39
+ const settings = useG9Settings();
40
+ const rtl = 'rtl' === useG9Direction();
41
+ const primary = formatColor(useG9Theme().palette.Primary);
42
+ const win = useG9Window();
43
+ const insets = useG9HostInsetsOrNull();
44
+ const chrome = introChromePadding(insets, props.bottomInset);
45
+ const core = useG9Core();
46
+ const media = useG9OptionalService('media');
47
+ const diagnostics = useG9Diagnostics();
48
+ const [rawIndex, setIndex] = useControllableState({
49
+ value: props.currentIndex,
50
+ defaultValue: null != (_props_defaultCurrentIndex = props.defaultCurrentIndex) ? _props_defaultCurrentIndex : 0,
51
+ onChange: props.onCurrentIndexChange,
52
+ name: 'G9IntroCarousel.currentIndex'
53
+ });
54
+ const index = clampIntroIndex(rawIndex, slides.length);
55
+ const latest = useRef(props);
56
+ latest.current = props;
57
+ const mediaRef = useRef(media);
58
+ mediaRef.current = media;
59
+ const controller = useMemo(()=>new G9IntroMediaController({
60
+ setTimer: (cb, ms)=>startTimer(cb, ms),
61
+ clearTimer: (h)=>stopTimer(h),
62
+ now: ()=>core.services.clock.monotonicNow(),
63
+ provider: ()=>mediaRef.current,
64
+ options: ()=>{
65
+ var _p_useMediaFadeTransitions, _p_useVideoLoopFade, _p_skipFirstSlideInitialFadeIn, _p_mediaFadeInDurationMs, _p_mediaFadeOutDurationMs, _p_startupCoverImageSource, _p_startupCoverDurationMs, _p_startupCoverFadeDurationMs, _p_initialVideoStartSeconds;
66
+ const p = latest.current;
67
+ return {
68
+ useMediaFadeTransitions: null != (_p_useMediaFadeTransitions = p.useMediaFadeTransitions) ? _p_useMediaFadeTransitions : true,
69
+ useVideoLoopFade: null != (_p_useVideoLoopFade = p.useVideoLoopFade) ? _p_useVideoLoopFade : true,
70
+ skipFirstSlideInitialFadeIn: null != (_p_skipFirstSlideInitialFadeIn = p.skipFirstSlideInitialFadeIn) ? _p_skipFirstSlideInitialFadeIn : true,
71
+ mediaFadeInDurationMs: null != (_p_mediaFadeInDurationMs = p.mediaFadeInDurationMs) ? _p_mediaFadeInDurationMs : g9IntroMetrics.mediaFadeInDurationMs,
72
+ mediaFadeOutDurationMs: null != (_p_mediaFadeOutDurationMs = p.mediaFadeOutDurationMs) ? _p_mediaFadeOutDurationMs : g9IntroMetrics.mediaFadeOutDurationMs,
73
+ startupCoverImageSource: null != (_p_startupCoverImageSource = p.startupCoverImageSource) ? _p_startupCoverImageSource : null,
74
+ startupCoverDurationMs: null != (_p_startupCoverDurationMs = p.startupCoverDurationMs) ? _p_startupCoverDurationMs : 0,
75
+ startupCoverFadeDurationMs: null != (_p_startupCoverFadeDurationMs = p.startupCoverFadeDurationMs) ? _p_startupCoverFadeDurationMs : g9IntroMetrics.startupCoverFadeDurationMs,
76
+ initialVideoStartSeconds: null != (_p_initialVideoStartSeconds = p.initialVideoStartSeconds) ? _p_initialVideoStartSeconds : 0
77
+ };
78
+ },
79
+ onFirstContentReady: ()=>{
80
+ var _latest_current_onFirstContentReady, _latest_current;
81
+ return null == (_latest_current_onFirstContentReady = (_latest_current = latest.current).onFirstContentReady) ? void 0 : _latest_current_onFirstContentReady.call(_latest_current);
82
+ },
83
+ onFallback: (i, reason)=>{
84
+ var _latest_current_onMediaFallback, _latest_current;
85
+ return null == (_latest_current_onMediaFallback = (_latest_current = latest.current).onMediaFallback) ? void 0 : _latest_current_onMediaFallback.call(_latest_current, i, reason);
86
+ },
87
+ onError: (error)=>diagnostics.log({
88
+ level: 'warning',
89
+ message: 'G9IntroCarousel: media failed.',
90
+ source: 'G9IntroCarousel',
91
+ error
92
+ })
93
+ }), []);
94
+ const snap = useSyncExternalStore(controller.subscribe, controller.getSnapshot);
95
+ const slidesRef = useRef(slides);
96
+ slidesRef.current = slides;
97
+ const indexRef = useRef(index);
98
+ indexRef.current = index;
99
+ const active = null != (_props_active = props.active) ? _props_active : true;
100
+ useEffect(()=>{
101
+ var _props_autoBegin;
102
+ if (!active) return void controller.release();
103
+ if (null != (_props_autoBegin = props.autoBegin) ? _props_autoBegin : true) controller.begin(slidesRef.current, indexRef.current);
104
+ }, [
105
+ active
106
+ ]);
107
+ useEffect(()=>{
108
+ if (controller.isPresented) controller.show(slides, index);
109
+ }, [
110
+ index,
111
+ slides
112
+ ]);
113
+ useEffect(()=>{
114
+ var _props_controller;
115
+ return null == (_props_controller = props.controller) ? void 0 : _props_controller.bind({
116
+ begin: ()=>controller.begin(slidesRef.current, indexRef.current),
117
+ release: ()=>controller.release()
118
+ });
119
+ }, [
120
+ props.controller
121
+ ]);
122
+ useEffect(()=>()=>controller.dispose(), []);
123
+ const swiper = useRef(null);
124
+ const go = (next)=>{
125
+ const target = clampIntroIndex(next, slides.length);
126
+ if (target === index) return;
127
+ setIndex(target);
128
+ try {
129
+ var _swiper_current;
130
+ null == (_swiper_current = swiper.current) || _swiper_current.swipeTo(target, {
131
+ animate: true
132
+ });
133
+ } catch {}
134
+ };
135
+ const overlay = introOverlayOpacities({
136
+ overlayOpacity: null != (_props_overlayOpacity = props.overlayOpacity) ? _props_overlayOpacity : g9IntroMetrics.overlayOpacity,
137
+ useGradientOverlay: true === props.useGradientOverlay,
138
+ overlayTopOpacityRatio: null != (_props_overlayTopOpacityRatio = props.overlayTopOpacityRatio) ? _props_overlayTopOpacityRatio : g9IntroMetrics.overlayTopOpacityRatio,
139
+ overlayTopOpacity: null != (_props_overlayTopOpacity = props.overlayTopOpacity) ? _props_overlayTopOpacity : null
140
+ });
141
+ const color = null != (_props_overlayColor = props.overlayColor) ? _props_overlayColor : '#000000';
142
+ const overlayStyle = props.useGradientOverlay ? {
143
+ backgroundImage: `linear-gradient(to bottom, ${withAlpha(color, overlay.top)}, ${withAlpha(color, overlay.bottom)})`
144
+ } : {
145
+ backgroundColor: color,
146
+ opacity: overlay.bottom
147
+ };
148
+ const slide = slides[index];
149
+ const resolve = (key, fallback)=>{
150
+ var _strings_resolve;
151
+ return key ? null != (_strings_resolve = strings.resolve(key)) ? _strings_resolve : fallback : fallback;
152
+ };
153
+ const nextLabel = resolve('IntroNext', 'Next');
154
+ const prevLabel = resolve('IntroPrevious', 'Previous');
155
+ const prev = <view key="prev" className={`g9-intro__nav g9-intro__nav--prev g9-intro__nav--${rtl ? 'right' : 'left'}`} style={{
156
+ opacity: index > 0 ? 1 : 0
157
+ }} accessibility-element accessibility-traits="button" accessibility-label={prevLabel} bindtap={index > 0 ? ()=>go(index - 1) : void 0}>
158
+ {}
159
+ {rtl ? <text className="g9-intro__nav-text">{prevLabel}</text> : null}
160
+ <G9IconSlot icon={rtl ? settings.glyphs.chevronForward : settings.glyphs.chevronBack} size={20} color="#ffffff"/>
161
+ {rtl ? null : <text className="g9-intro__nav-text">{prevLabel}</text>}
162
+ </view>;
163
+ const next = <view key="next" className={`g9-intro__nav g9-intro__nav--next g9-intro__nav--${rtl ? 'left' : 'right'}`} style={{
164
+ opacity: index < slides.length - 1 ? 1 : 0
165
+ }} accessibility-element accessibility-traits="button" accessibility-label={nextLabel} bindtap={index < slides.length - 1 ? ()=>go(index + 1) : void 0}>
166
+ {}
167
+ {rtl ? null : <text className="g9-intro__nav-text">{nextLabel}</text>}
168
+ <G9IconSlot icon={rtl ? settings.glyphs.chevronBack : settings.glyphs.chevronForward} size={20} color="#ffffff"/>
169
+ {rtl ? <text className="g9-intro__nav-text">{nextLabel}</text> : null}
170
+ </view>;
171
+ const logo = props.logoSource ? 'string' == typeof props.logoSource ? {
172
+ imagePath: props.logoSource
173
+ } : {
174
+ image: props.logoSource
175
+ } : null;
176
+ return <view className={`g9-intro ${null != (_props_className = props.className) ? _props_className : ''}`} style={{
177
+ backgroundColor: g9IntroMetrics.backdropColor
178
+ }}>
179
+ <view className={`g9-intro__media g9-intro__media--${snap.kind}`} data-fallback={null != (_snap_fallback = snap.fallback) ? _snap_fallback : ''} style={{
180
+ opacity: snap.visible ? 1 : 0,
181
+ transition: `opacity ${snap.fadeMs}ms ease-in-out`
182
+ }}>
183
+ {'video' === snap.kind && snap.player ? snap.player.view : null}
184
+ {'image' === snap.kind && snap.imageUri ? <image className="g9-intro__image" src={snap.imageUri} mode="aspectFill"/> : null}
185
+ </view>
186
+ {props.startupCoverImageSource ? <image className="g9-intro__cover" src={props.startupCoverImageSource} mode="aspectFill" style={{
187
+ opacity: snap.coverVisible ? 1 : 0,
188
+ transition: `opacity ${null != (_props_startupCoverFadeDurationMs = props.startupCoverFadeDurationMs) ? _props_startupCoverFadeDurationMs : g9IntroMetrics.startupCoverFadeDurationMs}ms ease-out`
189
+ }}/> : null}
190
+ <view className="g9-intro__overlay" style={overlayStyle}/>
191
+ <Swiper ref={swiper} style={{
192
+ position: 'absolute',
193
+ top: '0px',
194
+ left: '0px',
195
+ right: '0px',
196
+ bottom: '0px'
197
+ }} data={slides} itemWidth={win.width} initialIndex={index} RTL={rtl} onChange={(current)=>{
198
+ if (current !== indexRef.current) setIndex(clampIntroIndex(current, slidesRef.current.length));
199
+ }}>
200
+ {({ index: i })=><view key={i} className="g9-intro__page"/>}
201
+ </Swiper>
202
+ {snap.loading ? <view className="g9-intro__spinner">
203
+ <G9ActivityIndicator running size={28} color="#ffffff"/>
204
+ </view> : null}
205
+ <view className="g9-intro__chrome" {...chrome && {
206
+ style: {
207
+ paddingTop: `${chrome.top}px`,
208
+ paddingBottom: `${chrome.bottom}px`,
209
+ paddingLeft: `${chrome.left}px`,
210
+ paddingRight: `${chrome.right}px`
211
+ }
212
+ }}>
213
+ {}
214
+ <view className="g9-intro__header">
215
+ <view className="g9-intro__header-spacer"/>
216
+ {props.onLanguage ? <view className="g9-intro__language" accessibility-element accessibility-traits="button" bindtap={()=>{
217
+ var _latest_current_onLanguage, _latest_current;
218
+ return null == (_latest_current_onLanguage = (_latest_current = latest.current).onLanguage) ? void 0 : _latest_current_onLanguage.call(_latest_current);
219
+ }}>
220
+ <G9IconSlot icon="language" size={22} color="#ffffff"/>
221
+ </view> : null}
222
+ </view>
223
+ {props.logo || logo ? <view className="g9-intro__logo" style={{
224
+ marginTop: `${g9IntroMetrics.logoTopMargin}px`
225
+ }}>
226
+ {null != (_props_logo = props.logo) ? _props_logo : logo ? <G9IconSlot {...logo} size={g9IntroMetrics.logoHeight}/> : null}
227
+ </view> : null}
228
+ <view className="g9-intro__spacer"/>
229
+ <view className="g9-intro__text">
230
+ <text className="g9-intro__title">{resolve(null == slide ? void 0 : slide.titleResourceKey, '')}</text>
231
+ <text className="g9-intro__subtitle">{resolve(null == slide ? void 0 : slide.subtitleResourceKey, '')}</text>
232
+ </view>
233
+ {}
234
+ <view className="g9-intro__nav-row">
235
+ {rtl ? next : prev}
236
+ <view className="g9-intro__steps" style={{
237
+ flexDirection: rtl ? 'row-reverse' : 'row'
238
+ }}>
239
+ {slides.map((_, i)=><view key={i} className={`g9-intro__step${i === index ? ' g9-intro__step--active' : ''}`} style={{
240
+ width: `${i === index ? g9IntroMetrics.stepActiveWidth : g9IntroMetrics.stepInactiveWidth}px`,
241
+ ...i === index ? {
242
+ backgroundColor: primary
243
+ } : {}
244
+ }}/>)}
245
+ </view>
246
+ {rtl ? prev : next}
247
+ </view>
248
+ <G9Button className="g9-intro__cta" text={resolve('IntroSignIn', 'Sign in to your account')} onPress={()=>{
249
+ var _latest_current_onComplete, _latest_current;
250
+ return null == (_latest_current_onComplete = (_latest_current = latest.current).onComplete) ? void 0 : _latest_current_onComplete.call(_latest_current);
251
+ }}/>
252
+ </view>
253
+ </view>;
254
+ }
255
+ export { G9IntroCarousel, createIntroCarouselController, useIntroCarousel };
256
+
257
+ //# sourceMappingURL=intro-carousel.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intro-carousel.jsx","sources":["../src/intro-carousel.tsx"],"sourcesContent":["import './intro-carousel.css';\nimport { startTimer, stopTimer, useControllableState } from '@g9tm/lynxcontrols/base';\nimport { G9Button } from '@g9tm/lynxcontrols/button';\nimport { G9ActivityIndicator } from '@g9tm/lynxcontrols/display';\nimport { useG9HostInsetsOrNull } from '@g9tm/lynxcontrols/host';\nimport { G9IconSlot } from '@g9tm/lynxcontrols/icon';\nimport {\n useG9Core,\n useG9Diagnostics,\n useG9Direction,\n useG9OptionalService,\n useG9Settings,\n useG9Strings,\n useG9Theme,\n useG9Window,\n} from '@g9tm/lynxcontrols/provider';\nimport type { G9ImageSource } from '@g9tm/lynxcontrols-foundation';\nimport { formatColor } from '@g9tm/lynxcontrols-foundation';\nimport { Swiper, type SwiperRef } from '@lynx-js/lynx-ui-swiper';\nimport { type ReactNode, useEffect, useMemo, useRef, useSyncExternalStore } from '@lynx-js/react';\nimport { G9IntroMediaController, type G9IntroMediaOptions } from './media';\nimport {\n clampIntroIndex,\n type G9IntroFallbackReason,\n type G9IntroSlideItem,\n g9IntroMetrics,\n introChromePadding,\n introOverlayOpacities,\n} from './model';\n\n/** Imperative handle (MAUI `BeginPresentation` / `StopAndReleaseMedia`), from {@link useIntroCarousel}. */\nexport interface G9IntroCarouselController {\n /** Starts the media (and the startup cover) once the carousel is on screen. */\n beginPresentation(): void;\n /** Stops and releases the player, e.g. before the page goes away. */\n stopAndReleaseMedia(): void;\n /** @internal set by the mounted carousel */\n bind(target: { begin(): void; release(): void }): () => void;\n}\n\n/** Creates a controller outside React. */\nexport function createIntroCarouselController(): G9IntroCarouselController {\n let target: { begin(): void; release(): void } | null = null;\n return {\n beginPresentation: () => target?.begin(),\n stopAndReleaseMedia: () => target?.release(),\n bind(next) {\n target = next;\n return () => {\n if (target === next) target = null;\n };\n },\n };\n}\n\n/** A stable controller for a `G9IntroCarousel`. */\nexport function useIntroCarousel(): G9IntroCarouselController {\n const ref = useRef<G9IntroCarouselController | null>(null);\n if (ref.current === null) ref.current = createIntroCarouselController();\n return ref.current;\n}\n\n/** Props of {@link G9IntroCarousel} (MAUI bindable properties, commands and events). */\nexport interface G9IntroCarouselProps extends Partial<G9IntroMediaOptions> {\n /** Brand logo above the slide text; none by default (MAUI `LogoSource`). */\n readonly logoSource?: string | G9ImageSource | null;\n /** A logo ELEMENT (e.g. a vector wordmark), drawn where `logoSource` would be; wins over it. */\n readonly logo?: ReactNode;\n readonly slides?: readonly G9IntroSlideItem[];\n /** Controlled slide (MAUI `CurrentIndex`, two-way). */\n readonly currentIndex?: number;\n readonly defaultCurrentIndex?: number;\n readonly onCurrentIndexChange?: (index: number) => void;\n /**\n * Lifts the chrome — caption, step dots, arrows and the sign-in button — by this many dp above the bottom while the\n * media still fills the screen (MAUI 1.4.2 `BottomInset`, set from the page's bottom safe-area inset). Default: the\n * host's bottom inset (MAUI's default is 0 because a MAUI page does not know it).\n */\n readonly bottomInset?: number;\n /** Bottom (or flat) overlay opacity. Default 0.52. */\n readonly overlayOpacity?: number;\n readonly useGradientOverlay?: boolean;\n /** Gradient top = bottom × ratio unless `overlayTopOpacity` is set. Default 0.4. */\n readonly overlayTopOpacityRatio?: number;\n readonly overlayTopOpacity?: number | null;\n /** Default black. */\n readonly overlayColor?: string;\n /** The header language button (MAUI `LanguageCommand`); hidden without it. */\n readonly onLanguage?: () => void;\n /** The sign-in call to action (MAUI `CompleteCommand`). */\n readonly onComplete?: () => void;\n /** Once, the first time real content is on screen (MAUI `FirstContentReady`). */\n readonly onFirstContentReady?: () => void;\n /** A video slide showed its image instead, and why (desktop video stays `'video-unsupported'` until D14). */\n readonly onMediaFallback?: (index: number, reason: G9IntroFallbackReason) => void;\n /** Start presenting on mount. Default true; set false and call `beginPresentation()` yourself (MAUI login flow). */\n readonly autoBegin?: boolean;\n /** While false the media is released (page in the background, carousel hidden). Default true. */\n readonly active?: boolean;\n readonly controller?: G9IntroCarouselController;\n readonly className?: string;\n}\n\nconst hex2 = (n: number) =>\n Math.round(Math.min(Math.max(n, 0), 1) * 255)\n .toString(16)\n .padStart(2, '0');\n\n/** `#rrggbb` + alpha → `#rrggbbaa` (other colour forms pass through with the opacity applied as `opacity`). */\nfunction withAlpha(color: string, alpha: number): string {\n return /^#[0-9a-f]{6}$/i.test(color) ? `${color}${hex2(alpha)}` : color;\n}\n\n/**\n * Full-screen onboarding slides (MAUI `G9IntroCarousel`): one media slot behind a dark (flat or gradient) overlay,\n * logo, localized title and subtitle, step pills, previous / next (swapped in RTL), a language button and the sign-in\n * call to action. Slides swipe through lynx-ui `Swiper`. Video goes through `services.media`\n * (`supportsVideo` / `createPlayer`); when it cannot play, the slide image shows and `onMediaFallback` says why. The\n * player is released on slide change, when `active` turns false, on `stopAndReleaseMedia()` and on unmount.\n */\nexport function G9IntroCarousel(props: G9IntroCarouselProps): ReactNode {\n const slides = props.slides ?? [];\n const strings = useG9Strings();\n const settings = useG9Settings();\n const rtl = useG9Direction() === 'rtl';\n const primary = formatColor(useG9Theme().palette.Primary);\n const win = useG9Window();\n // Inside an edge-to-edge host the chrome clears the system bars (the language button under the status bar, the call\n // to action above the gesture bar); the media and the overlay still run to the screen edges.\n const insets = useG9HostInsetsOrNull();\n const chrome = introChromePadding(insets, props.bottomInset);\n const core = useG9Core();\n const media = useG9OptionalService('media');\n const diagnostics = useG9Diagnostics();\n const [rawIndex, setIndex] = useControllableState<number>({\n value: props.currentIndex,\n defaultValue: props.defaultCurrentIndex ?? 0,\n onChange: props.onCurrentIndexChange,\n name: 'G9IntroCarousel.currentIndex',\n });\n const index = clampIntroIndex(rawIndex, slides.length);\n const latest = useRef(props);\n latest.current = props;\n const mediaRef = useRef(media);\n mediaRef.current = media;\n\n const controller = useMemo(\n () =>\n new G9IntroMediaController({\n setTimer: (cb, ms) => startTimer(cb, ms),\n clearTimer: (h) => stopTimer(h as never),\n now: () => core.services.clock.monotonicNow(),\n provider: () => mediaRef.current,\n options: () => {\n const p = latest.current;\n return {\n useMediaFadeTransitions: p.useMediaFadeTransitions ?? true,\n useVideoLoopFade: p.useVideoLoopFade ?? true,\n skipFirstSlideInitialFadeIn: p.skipFirstSlideInitialFadeIn ?? true,\n mediaFadeInDurationMs: p.mediaFadeInDurationMs ?? g9IntroMetrics.mediaFadeInDurationMs,\n mediaFadeOutDurationMs: p.mediaFadeOutDurationMs ?? g9IntroMetrics.mediaFadeOutDurationMs,\n startupCoverImageSource: p.startupCoverImageSource ?? null,\n startupCoverDurationMs: p.startupCoverDurationMs ?? 0,\n startupCoverFadeDurationMs: p.startupCoverFadeDurationMs ?? g9IntroMetrics.startupCoverFadeDurationMs,\n initialVideoStartSeconds: p.initialVideoStartSeconds ?? 0,\n };\n },\n onFirstContentReady: () => latest.current.onFirstContentReady?.(),\n onFallback: (i, reason) => latest.current.onMediaFallback?.(i, reason),\n onError: (error) =>\n diagnostics.log({\n level: 'warning',\n message: 'G9IntroCarousel: media failed.',\n source: 'G9IntroCarousel',\n error,\n }),\n }),\n [],\n );\n const snap = useSyncExternalStore(controller.subscribe, controller.getSnapshot);\n const slidesRef = useRef(slides);\n slidesRef.current = slides;\n const indexRef = useRef(index);\n indexRef.current = index;\n\n const active = props.active ?? true;\n useEffect(() => {\n if (!active) {\n controller.release();\n return;\n }\n if (props.autoBegin ?? true) controller.begin(slidesRef.current, indexRef.current);\n }, [active]);\n useEffect(() => {\n if (controller.isPresented) controller.show(slides, index);\n }, [index, slides]);\n useEffect(\n () =>\n props.controller?.bind({\n begin: () => controller.begin(slidesRef.current, indexRef.current),\n release: () => controller.release(),\n }),\n [props.controller],\n );\n useEffect(() => () => controller.dispose(), []);\n\n // Swipes go through lynx-ui Swiper; nav taps move it.\n const swiper = useRef<SwiperRef | null>(null);\n const go = (next: number) => {\n const target = clampIntroIndex(next, slides.length);\n if (target === index) return;\n setIndex(target);\n try {\n swiper.current?.swipeTo(target, { animate: true });\n } catch {\n // The swiper is gone (unmounted mid-tap).\n }\n };\n\n const overlay = introOverlayOpacities({\n overlayOpacity: props.overlayOpacity ?? g9IntroMetrics.overlayOpacity,\n useGradientOverlay: props.useGradientOverlay === true,\n overlayTopOpacityRatio: props.overlayTopOpacityRatio ?? g9IntroMetrics.overlayTopOpacityRatio,\n overlayTopOpacity: props.overlayTopOpacity ?? null,\n });\n const color = props.overlayColor ?? '#000000';\n const overlayStyle = props.useGradientOverlay\n ? {\n backgroundImage: `linear-gradient(to bottom, ${withAlpha(color, overlay.top)}, ${withAlpha(color, overlay.bottom)})`,\n }\n : { backgroundColor: color, opacity: overlay.bottom };\n\n const slide = slides[index];\n const resolve = (key: string | undefined, fallback: string) => (key ? (strings.resolve(key) ?? fallback) : fallback);\n const nextLabel = resolve('IntroNext', 'Next');\n const prevLabel = resolve('IntroPrevious', 'Previous');\n const prev = (\n <view\n key=\"prev\"\n className={`g9-intro__nav g9-intro__nav--prev g9-intro__nav--${rtl ? 'right' : 'left'}`}\n style={{ opacity: index > 0 ? 1 : 0 }}\n accessibility-element\n accessibility-traits=\"button\"\n accessibility-label={prevLabel}\n bindtap={index > 0 ? () => go(index - 1) : undefined}\n >\n {/* MAUI ApplyNavDirection: the chevron sits on the OUTER side — Previous = [‹ label] in LTR, [label ›] in RTL. */}\n {rtl ? <text className=\"g9-intro__nav-text\">{prevLabel}</text> : null}\n <G9IconSlot icon={rtl ? settings.glyphs.chevronForward : settings.glyphs.chevronBack} size={20} color=\"#ffffff\" />\n {rtl ? null : <text className=\"g9-intro__nav-text\">{prevLabel}</text>}\n </view>\n );\n const next = (\n <view\n key=\"next\"\n className={`g9-intro__nav g9-intro__nav--next g9-intro__nav--${rtl ? 'left' : 'right'}`}\n style={{ opacity: index < slides.length - 1 ? 1 : 0 }}\n accessibility-element\n accessibility-traits=\"button\"\n accessibility-label={nextLabel}\n bindtap={index < slides.length - 1 ? () => go(index + 1) : undefined}\n >\n {/* Next = [label ›] in LTR, [‹ label] in RTL. */}\n {rtl ? null : <text className=\"g9-intro__nav-text\">{nextLabel}</text>}\n <G9IconSlot icon={rtl ? settings.glyphs.chevronBack : settings.glyphs.chevronForward} size={20} color=\"#ffffff\" />\n {rtl ? <text className=\"g9-intro__nav-text\">{nextLabel}</text> : null}\n </view>\n );\n const logo = props.logoSource\n ? typeof props.logoSource === 'string'\n ? { imagePath: props.logoSource }\n : { image: props.logoSource }\n : null;\n\n return (\n <view className={`g9-intro ${props.className ?? ''}`} style={{ backgroundColor: g9IntroMetrics.backdropColor }}>\n <view\n className={`g9-intro__media g9-intro__media--${snap.kind}`}\n data-fallback={snap.fallback ?? ''}\n style={{ opacity: snap.visible ? 1 : 0, transition: `opacity ${snap.fadeMs}ms ease-in-out` }}\n >\n {snap.kind === 'video' && snap.player ? (snap.player.view as ReactNode) : null}\n {snap.kind === 'image' && snap.imageUri ? (\n <image className=\"g9-intro__image\" src={snap.imageUri} mode=\"aspectFill\" />\n ) : null}\n </view>\n {props.startupCoverImageSource ? (\n <image\n className=\"g9-intro__cover\"\n src={props.startupCoverImageSource}\n mode=\"aspectFill\"\n style={{\n opacity: snap.coverVisible ? 1 : 0,\n transition: `opacity ${props.startupCoverFadeDurationMs ?? g9IntroMetrics.startupCoverFadeDurationMs}ms ease-out`,\n }}\n />\n ) : null}\n <view className=\"g9-intro__overlay\" style={overlayStyle} />\n <Swiper\n ref={swiper}\n style={{ position: 'absolute', top: '0px', left: '0px', right: '0px', bottom: '0px' }}\n data={slides as G9IntroSlideItem[]}\n itemWidth={win.width}\n initialIndex={index}\n RTL={rtl}\n onChange={(current: number) => {\n if (current !== indexRef.current) setIndex(clampIntroIndex(current, slidesRef.current.length));\n }}\n >\n {({ index: i }: { index: number }) => <view key={i} className=\"g9-intro__page\" />}\n </Swiper>\n {snap.loading ? (\n <view className=\"g9-intro__spinner\">\n <G9ActivityIndicator running size={28} color=\"#ffffff\" />\n </view>\n ) : null}\n <view\n className=\"g9-intro__chrome\"\n {...(chrome && {\n style: {\n paddingTop: `${chrome.top}px`,\n paddingBottom: `${chrome.bottom}px`,\n paddingLeft: `${chrome.left}px`,\n paddingRight: `${chrome.right}px`,\n },\n })}\n >\n {/* MAUI header grid (always LTR): the language button top-right, the logo centred on the row below. */}\n <view className=\"g9-intro__header\">\n <view className=\"g9-intro__header-spacer\" />\n {props.onLanguage ? (\n <view\n className=\"g9-intro__language\"\n accessibility-element\n accessibility-traits=\"button\"\n bindtap={() => latest.current.onLanguage?.()}\n >\n <G9IconSlot icon=\"language\" size={22} color=\"#ffffff\" />\n </view>\n ) : null}\n </view>\n {props.logo || logo ? (\n <view className=\"g9-intro__logo\" style={{ marginTop: `${g9IntroMetrics.logoTopMargin}px` }}>\n {props.logo ?? (logo ? <G9IconSlot {...logo} size={g9IntroMetrics.logoHeight} /> : null)}\n </view>\n ) : null}\n <view className=\"g9-intro__spacer\" />\n <view className=\"g9-intro__text\">\n <text className=\"g9-intro__title\">{resolve(slide?.titleResourceKey, '')}</text>\n <text className=\"g9-intro__subtitle\">{resolve(slide?.subtitleResourceKey, '')}</text>\n </view>\n {/* MAUI nav row: [Previous | steps | Next] (Next on the left in RTL), the steps centred between them and\n following the reading direction (the first slide's step at the reading start); the active one Primary. */}\n <view className=\"g9-intro__nav-row\">\n {rtl ? next : prev}\n <view className=\"g9-intro__steps\" style={{ flexDirection: rtl ? 'row-reverse' : 'row' }}>\n {slides.map((_, i) => (\n <view\n key={i}\n className={`g9-intro__step${i === index ? ' g9-intro__step--active' : ''}`}\n style={{\n width: `${i === index ? g9IntroMetrics.stepActiveWidth : g9IntroMetrics.stepInactiveWidth}px`,\n ...(i === index ? { backgroundColor: primary } : {}),\n }}\n />\n ))}\n </view>\n {rtl ? prev : next}\n </view>\n <G9Button\n className=\"g9-intro__cta\"\n text={resolve('IntroSignIn', 'Sign in to your account')}\n onPress={() => latest.current.onComplete?.()}\n />\n </view>\n </view>\n );\n}\n"],"names":["createIntroCarouselController","target","next","useIntroCarousel","ref","useRef","hex2","n","Math","withAlpha","color","alpha","G9IntroCarousel","props","_props_slides","_props_defaultCurrentIndex","_props_active","_props_overlayOpacity","_props_overlayTopOpacityRatio","_props_overlayTopOpacity","_props_overlayColor","_props_className","_snap_fallback","_props_startupCoverFadeDurationMs","_props_logo","slides","strings","useG9Strings","settings","useG9Settings","rtl","useG9Direction","primary","formatColor","useG9Theme","win","useG9Window","insets","useG9HostInsetsOrNull","chrome","introChromePadding","core","useG9Core","media","useG9OptionalService","diagnostics","useG9Diagnostics","rawIndex","setIndex","useControllableState","index","clampIntroIndex","latest","mediaRef","controller","useMemo","G9IntroMediaController","cb","ms","startTimer","h","stopTimer","_p_useMediaFadeTransitions","_p_useVideoLoopFade","_p_skipFirstSlideInitialFadeIn","_p_mediaFadeInDurationMs","_p_mediaFadeOutDurationMs","_p_startupCoverImageSource","_p_startupCoverDurationMs","_p_startupCoverFadeDurationMs","_p_initialVideoStartSeconds","p","g9IntroMetrics","_latest_current","i","reason","error","snap","useSyncExternalStore","slidesRef","indexRef","active","useEffect","_props_autoBegin","_props_controller","swiper","go","_swiper_current","overlay","introOverlayOpacities","overlayStyle","slide","resolve","key","fallback","_strings_resolve","nextLabel","prevLabel","prev","view","undefined","text","G9IconSlot","logo","image","Swiper","current","G9ActivityIndicator","_","G9Button"],"mappings":";;;;;;;;;;;;AAyCO,SAASA;IACd,IAAIC,SAAoD;IACxD,OAAO;QACL,mBAAmB,IAAMA,QAAAA,SAAAA,KAAAA,IAAAA,OAAQ,KAAK;QACtC,qBAAqB,IAAMA,QAAAA,SAAAA,KAAAA,IAAAA,OAAQ,OAAO;QAC1C,MAAKC,IAAI;YACPD,SAASC;YACT,OAAO;gBACL,IAAID,WAAWC,MAAMD,SAAS;YAChC;QACF;IACF;AACF;AAGO,SAASE;IACd,MAAMC,MAAMC,OAAyC;IACrD,IAAID,AAAgB,SAAhBA,IAAI,OAAO,EAAWA,IAAI,OAAO,GAAGJ;IACxC,OAAOI,IAAI,OAAO;AACpB;AA2CA,MAAME,OAAO,CAACC,IACZC,KAAK,KAAK,CAACA,AAA8B,MAA9BA,KAAK,GAAG,CAACA,KAAK,GAAG,CAACD,GAAG,IAAI,IACjC,QAAQ,CAAC,IACT,QAAQ,CAAC,GAAG;AAGjB,SAASE,UAAUC,KAAa,EAAEC,KAAa;IAC7C,OAAO,kBAAkB,IAAI,CAACD,SAAS,GAAGA,QAAQJ,KAAKK,QAAQ,GAAGD;AACpE;AASO,SAASE,gBA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AAerE,MAAM,gBAAgB;IAAM,GAAG;YACvF,CAACL,OAAO,GAAG,CAAC,CAACmF,GAAGlC,KACbyB,KACC,KAAKzB,GACL,WAAW,CAAC,cAAc,EAAEA,MAAMxB,QAAQ,4BAA4B,IAAI,EAC1E,OAAO;YACL,OAAO,GAAGwB,MAAMxB,QAAQsB,eAAe,eAAe,GAAGA,eAAe,iBAAiB,CAAC,EAAE,CAAC;YAC7F,GAAIE,MAAMxB,QAAQ;gBAAE,iBAAiBlB;YAAQ,IAAI,CAAC,CAAC;QACrD,MAED;UACL,EAAEmE,KAAK;UACP,CAACrE,MAAMoE,OAAOhG,KAAK;QACrB,EAAEiG,KAAK;QACP,CAACU,SACC,UAAU,gBACV,MAAMjB,QAAQ,eAAe,4BAC7B,SAAS;YAAMnB,4BAAAA;uBAAAA,CAAAA,6BAAAA,AAAAA,CAAAA,kBAAAA,OAAO,OAAO,AAAD,EAAE,UAAU,AAAD,IAAxBA,KAAAA,IAAAA,2BAAAA,IAAAA,CAAAA;QACf;MACJ,EAAE0B,KAAK;IACT,EAAEA;AAEN"}
@@ -0,0 +1,85 @@
1
+ import type { G9MediaPlayer, G9MediaProvider } from '@g9tm/lynxcontrols-foundation';
2
+ import { type G9IntroFallbackReason, type G9IntroSlideItem } from './model.js';
3
+ /** What the media layer shows. */
4
+ export interface G9IntroMediaSnapshot {
5
+ /** The slide whose media is loaded (or loading). */
6
+ readonly index: number;
7
+ readonly kind: 'none' | 'video' | 'image' | 'empty';
8
+ readonly player: G9MediaPlayer | null;
9
+ readonly imageUri: string | null;
10
+ /** Media opacity target (1 shown, 0 hidden) and the duration of the move there. */
11
+ readonly visible: boolean;
12
+ readonly fadeMs: number;
13
+ /** A spinner while a slide's media loads (MAUI brief spinner overlay). */
14
+ readonly loading: boolean;
15
+ /** Why the slide shows its image (or nothing) instead of a video; `null` when it plays its video. */
16
+ readonly fallback: G9IntroFallbackReason | null;
17
+ /** Startup poster (MAUI `StartupCoverImageSource`): visible, and fading out. */
18
+ readonly coverVisible: boolean;
19
+ }
20
+ /** Inputs of {@link G9IntroMediaController}. */
21
+ export interface G9IntroMediaConfig {
22
+ setTimer(callback: () => void, ms: number): unknown;
23
+ clearTimer(handle: unknown): void;
24
+ now(): number;
25
+ provider(): G9MediaProvider | undefined;
26
+ options(): G9IntroMediaOptions;
27
+ /** Raised once, the first time real content is on screen (MAUI `FirstContentReady`). */
28
+ onFirstContentReady(): void;
29
+ onFallback(index: number, reason: G9IntroFallbackReason): void;
30
+ onError(error: unknown): void;
31
+ }
32
+ /** The media options of the carousel (MAUI bindable properties). */
33
+ export interface G9IntroMediaOptions {
34
+ readonly useMediaFadeTransitions: boolean;
35
+ readonly useVideoLoopFade: boolean;
36
+ readonly skipFirstSlideInitialFadeIn: boolean;
37
+ readonly mediaFadeInDurationMs: number;
38
+ readonly mediaFadeOutDurationMs: number;
39
+ readonly startupCoverImageSource: string | null;
40
+ readonly startupCoverDurationMs: number;
41
+ readonly startupCoverFadeDurationMs: number;
42
+ readonly initialVideoStartSeconds: number;
43
+ }
44
+ /**
45
+ * The carousel's single media slot (MAUI keeps ONE MediaElement and swaps its source): one player at a time, the
46
+ * previous one disposed before the next slide's media loads; fade out before a manual change, fade in on reveal (not
47
+ * for the very first reveal with `skipFirstSlideInitialFadeIn`); loop fades from the player's `nearEnd` / `looped`
48
+ * events; image fallback with a reason; first-content readiness once; everything released on `release()`.
49
+ */
50
+ export declare class G9IntroMediaController {
51
+ private readonly config;
52
+ private snapshot;
53
+ private readonly listeners;
54
+ private generation;
55
+ private timers;
56
+ private unsubscribePlayer;
57
+ private firstReady;
58
+ private firstRevealDone;
59
+ private videoSeekUsed;
60
+ private presented;
61
+ private coverShownAt;
62
+ private coverMediaReady;
63
+ private disposed;
64
+ constructor(config: G9IntroMediaConfig);
65
+ subscribe: (listener: () => void) => (() => void);
66
+ getSnapshot: () => G9IntroMediaSnapshot;
67
+ private update;
68
+ private later;
69
+ private clearTimers;
70
+ get isPresented(): boolean;
71
+ /** Starts presenting (MAUI `BeginPresentation`): the startup cover, then the current slide's media. */
72
+ begin(slides: readonly G9IntroSlideItem[], index: number): void;
73
+ /** Shows `index`'s media: fades the current media out (manual change), disposes it, loads the next. */
74
+ show(slides: readonly G9IntroSlideItem[], index: number, animateOut?: boolean): void;
75
+ private disposePlayer;
76
+ private load;
77
+ private showImage;
78
+ private settle;
79
+ private reveal;
80
+ private tryDismissCover;
81
+ /** Stops and releases the player (MAUI `StopAndReleaseMedia`); `begin` / `show` load again later. */
82
+ release(): void;
83
+ dispose(): void;
84
+ }
85
+ //# sourceMappingURL=media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../src/media.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EAItB,MAAM,SAAS,CAAC;AAEjB,kCAAkC;AAClC,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IACpD,QAAQ,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,mFAAmF;IACnF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,qGAAqG;IACrG,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAChD,gFAAgF;IAChF,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;CAChC;AAED,gDAAgD;AAChD,MAAM,WAAW,kBAAkB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