@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.
package/dist/media.jsx ADDED
@@ -0,0 +1,264 @@
1
+ import { introImageSource, introSlideHasVideo, introVideoSource } from "./model.jsx";
2
+ function _define_property(obj, key, value) {
3
+ if (key in obj) Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ else obj[key] = value;
10
+ return obj;
11
+ }
12
+ class G9IntroMediaController {
13
+ update(patch) {
14
+ this.snapshot = {
15
+ ...this.snapshot,
16
+ ...patch
17
+ };
18
+ for (const listener of Array.from(this.listeners))listener();
19
+ }
20
+ later(callback, ms) {
21
+ const handle = this.config.setTimer(()=>{
22
+ this.timers.delete(handle);
23
+ callback();
24
+ }, ms);
25
+ this.timers.add(handle);
26
+ }
27
+ clearTimers() {
28
+ for (const handle of this.timers)this.config.clearTimer(handle);
29
+ this.timers.clear();
30
+ }
31
+ get isPresented() {
32
+ return this.presented;
33
+ }
34
+ begin(slides, index) {
35
+ if (this.disposed) return;
36
+ if (!this.presented) {
37
+ this.presented = true;
38
+ const o = this.config.options();
39
+ if (o.startupCoverImageSource && o.startupCoverDurationMs > 0) {
40
+ this.coverShownAt = this.config.now();
41
+ this.coverMediaReady = false;
42
+ this.update({
43
+ coverVisible: true
44
+ });
45
+ this.later(()=>this.tryDismissCover(), o.startupCoverDurationMs);
46
+ }
47
+ }
48
+ this.show(slides, index, false);
49
+ }
50
+ show(slides, index, animateOut = true) {
51
+ if (this.disposed || !this.presented) return;
52
+ const slide = slides[index];
53
+ if (this.snapshot.index === index && 'none' !== this.snapshot.kind) return;
54
+ const generation = ++this.generation;
55
+ const o = this.config.options();
56
+ const fadeOut = o.useMediaFadeTransitions && animateOut && 'none' !== this.snapshot.kind ? o.mediaFadeOutDurationMs : 0;
57
+ if (fadeOut > 0) {
58
+ this.update({
59
+ visible: false,
60
+ fadeMs: fadeOut,
61
+ loading: true
62
+ });
63
+ this.later(()=>{
64
+ if (generation === this.generation) this.load(slide, index, generation);
65
+ }, fadeOut);
66
+ return;
67
+ }
68
+ this.load(slide, index, generation);
69
+ }
70
+ disposePlayer() {
71
+ var _this_unsubscribePlayer, _this;
72
+ null == (_this_unsubscribePlayer = (_this = this).unsubscribePlayer) || _this_unsubscribePlayer.call(_this);
73
+ this.unsubscribePlayer = null;
74
+ const player = this.snapshot.player;
75
+ if (!player) return;
76
+ try {
77
+ player.dispose();
78
+ } catch (error) {
79
+ this.config.onError(error);
80
+ }
81
+ }
82
+ load(slide, index, generation) {
83
+ this.disposePlayer();
84
+ this.update({
85
+ index,
86
+ kind: 'none',
87
+ player: null,
88
+ imageUri: null,
89
+ visible: false,
90
+ fadeMs: 0,
91
+ loading: true,
92
+ fallback: null
93
+ });
94
+ if (!slide) return void this.settle(generation, 'empty', null, null);
95
+ const provider = this.config.provider();
96
+ if (!introSlideHasVideo(slide)) return void this.showImage(slide, index, generation, 'no-video', provider);
97
+ if (!(null == provider ? void 0 : provider.createPlayer)) return void this.showImage(slide, index, generation, 'no-media-provider', provider);
98
+ if (provider.supportsVideo && false === provider.supportsVideo()) return void this.showImage(slide, index, generation, 'video-unsupported', provider);
99
+ const createPlayer = provider.createPlayer.bind(provider);
100
+ const o = this.config.options();
101
+ provider.resolve(introVideoSource(slide)).then((media)=>{
102
+ if (generation !== this.generation || this.disposed) return;
103
+ let player;
104
+ try {
105
+ const startSeconds = !this.videoSeekUsed && o.initialVideoStartSeconds > 0 ? o.initialVideoStartSeconds : 0;
106
+ this.videoSeekUsed = true;
107
+ player = createPlayer(media, {
108
+ loop: true,
109
+ muted: true,
110
+ ...startSeconds > 0 ? {
111
+ startSeconds
112
+ } : {},
113
+ ...o.useVideoLoopFade ? {
114
+ nearEndSeconds: o.mediaFadeOutDurationMs / 1000
115
+ } : {}
116
+ });
117
+ } catch (error) {
118
+ this.config.onError(error);
119
+ this.showImage(slide, index, generation, 'video-failed', provider);
120
+ return;
121
+ }
122
+ this.unsubscribePlayer = player.subscribe((event)=>{
123
+ if (generation !== this.generation || this.disposed) return;
124
+ const opts = this.config.options();
125
+ if ('ready' === event.type) this.reveal(generation);
126
+ else if ('error' === event.type) {
127
+ this.config.onError(event.error);
128
+ this.showImage(slide, index, generation, 'video-failed', provider);
129
+ } else if ('nearEnd' === event.type) {
130
+ if (opts.useVideoLoopFade && opts.mediaFadeOutDurationMs > 0) this.update({
131
+ visible: false,
132
+ fadeMs: opts.mediaFadeOutDurationMs
133
+ });
134
+ } else if (opts.useVideoLoopFade) this.update({
135
+ visible: true,
136
+ fadeMs: opts.mediaFadeInDurationMs
137
+ });
138
+ });
139
+ this.update({
140
+ kind: 'video',
141
+ player
142
+ });
143
+ player.play();
144
+ }, (error)=>{
145
+ if (generation !== this.generation || this.disposed) return;
146
+ this.config.onError(error);
147
+ this.showImage(slide, index, generation, 'video-failed', provider);
148
+ });
149
+ }
150
+ showImage(slide, index, generation, reason, provider) {
151
+ this.disposePlayer();
152
+ if ('no-video' !== reason) this.config.onFallback(index, reason);
153
+ const source = introImageSource(slide);
154
+ if (!source) return void this.settle(generation, 'empty', null, reason);
155
+ const raw = 'asset' in source ? source.asset : source.uri;
156
+ if (!provider) return void this.settle(generation, 'image', raw, reason);
157
+ provider.resolve(source).then((media)=>{
158
+ if (generation === this.generation && !this.disposed) this.settle(generation, 'image', media.uri, reason);
159
+ }, ()=>{
160
+ if (generation === this.generation && !this.disposed) this.settle(generation, 'image', raw, reason);
161
+ });
162
+ }
163
+ settle(generation, kind, imageUri, reason) {
164
+ this.update({
165
+ kind,
166
+ player: null,
167
+ imageUri,
168
+ fallback: reason
169
+ });
170
+ this.reveal(generation);
171
+ }
172
+ reveal(generation) {
173
+ if (generation !== this.generation) return;
174
+ const o = this.config.options();
175
+ const immediate = !o.useMediaFadeTransitions || o.skipFirstSlideInitialFadeIn && !this.firstRevealDone;
176
+ this.firstRevealDone = true;
177
+ this.update({
178
+ visible: true,
179
+ fadeMs: immediate ? 0 : o.mediaFadeInDurationMs,
180
+ loading: false
181
+ });
182
+ this.coverMediaReady = true;
183
+ this.tryDismissCover();
184
+ if (!this.firstReady) {
185
+ this.firstReady = true;
186
+ this.config.onFirstContentReady();
187
+ }
188
+ }
189
+ tryDismissCover() {
190
+ if (!this.snapshot.coverVisible || !this.coverMediaReady) return;
191
+ const o = this.config.options();
192
+ if (this.config.now() - this.coverShownAt < o.startupCoverDurationMs) return;
193
+ this.update({
194
+ coverVisible: false
195
+ });
196
+ }
197
+ release() {
198
+ this.generation += 1;
199
+ this.clearTimers();
200
+ this.disposePlayer();
201
+ this.update({
202
+ index: -1,
203
+ kind: 'none',
204
+ player: null,
205
+ imageUri: null,
206
+ visible: false,
207
+ loading: false,
208
+ coverVisible: false
209
+ });
210
+ this.presented = false;
211
+ }
212
+ dispose() {
213
+ this.release();
214
+ this.disposed = true;
215
+ }
216
+ constructor(config){
217
+ _define_property(this, "config", void 0);
218
+ _define_property(this, "snapshot", void 0);
219
+ _define_property(this, "listeners", void 0);
220
+ _define_property(this, "generation", void 0);
221
+ _define_property(this, "timers", void 0);
222
+ _define_property(this, "unsubscribePlayer", void 0);
223
+ _define_property(this, "firstReady", void 0);
224
+ _define_property(this, "firstRevealDone", void 0);
225
+ _define_property(this, "videoSeekUsed", void 0);
226
+ _define_property(this, "presented", void 0);
227
+ _define_property(this, "coverShownAt", void 0);
228
+ _define_property(this, "coverMediaReady", void 0);
229
+ _define_property(this, "disposed", void 0);
230
+ _define_property(this, "subscribe", void 0);
231
+ _define_property(this, "getSnapshot", void 0);
232
+ this.config = config;
233
+ this.snapshot = {
234
+ index: -1,
235
+ kind: 'none',
236
+ player: null,
237
+ imageUri: null,
238
+ visible: false,
239
+ fadeMs: 0,
240
+ loading: false,
241
+ fallback: null,
242
+ coverVisible: false
243
+ };
244
+ this.listeners = new Set();
245
+ this.generation = 0;
246
+ this.timers = new Set();
247
+ this.unsubscribePlayer = null;
248
+ this.firstReady = false;
249
+ this.firstRevealDone = false;
250
+ this.videoSeekUsed = false;
251
+ this.presented = false;
252
+ this.coverShownAt = 0;
253
+ this.coverMediaReady = false;
254
+ this.disposed = false;
255
+ this.subscribe = (listener)=>{
256
+ this.listeners.add(listener);
257
+ return ()=>this.listeners.delete(listener);
258
+ };
259
+ this.getSnapshot = ()=>this.snapshot;
260
+ }
261
+ }
262
+ export { G9IntroMediaController };
263
+
264
+ //# sourceMappingURL=media.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.jsx","sources":["../src/media.ts"],"sourcesContent":["import type { G9MediaPlayer, G9MediaProvider } from '@g9tm/lynxcontrols-foundation';\nimport {\n type G9IntroFallbackReason,\n type G9IntroSlideItem,\n introImageSource,\n introSlideHasVideo,\n introVideoSource,\n} from './model';\n\n/** What the media layer shows. */\nexport interface G9IntroMediaSnapshot {\n /** The slide whose media is loaded (or loading). */\n readonly index: number;\n readonly kind: 'none' | 'video' | 'image' | 'empty';\n readonly player: G9MediaPlayer | null;\n readonly imageUri: string | null;\n /** Media opacity target (1 shown, 0 hidden) and the duration of the move there. */\n readonly visible: boolean;\n readonly fadeMs: number;\n /** A spinner while a slide's media loads (MAUI brief spinner overlay). */\n readonly loading: boolean;\n /** Why the slide shows its image (or nothing) instead of a video; `null` when it plays its video. */\n readonly fallback: G9IntroFallbackReason | null;\n /** Startup poster (MAUI `StartupCoverImageSource`): visible, and fading out. */\n readonly coverVisible: boolean;\n}\n\n/** Inputs of {@link G9IntroMediaController}. */\nexport interface G9IntroMediaConfig {\n setTimer(callback: () => void, ms: number): unknown;\n clearTimer(handle: unknown): void;\n now(): number;\n provider(): G9MediaProvider | undefined;\n options(): G9IntroMediaOptions;\n /** Raised once, the first time real content is on screen (MAUI `FirstContentReady`). */\n onFirstContentReady(): void;\n onFallback(index: number, reason: G9IntroFallbackReason): void;\n onError(error: unknown): void;\n}\n\n/** The media options of the carousel (MAUI bindable properties). */\nexport interface G9IntroMediaOptions {\n readonly useMediaFadeTransitions: boolean;\n readonly useVideoLoopFade: boolean;\n readonly skipFirstSlideInitialFadeIn: boolean;\n readonly mediaFadeInDurationMs: number;\n readonly mediaFadeOutDurationMs: number;\n readonly startupCoverImageSource: string | null;\n readonly startupCoverDurationMs: number;\n readonly startupCoverFadeDurationMs: number;\n readonly initialVideoStartSeconds: number;\n}\n\n/**\n * The carousel's single media slot (MAUI keeps ONE MediaElement and swaps its source): one player at a time, the\n * previous one disposed before the next slide's media loads; fade out before a manual change, fade in on reveal (not\n * for the very first reveal with `skipFirstSlideInitialFadeIn`); loop fades from the player's `nearEnd` / `looped`\n * events; image fallback with a reason; first-content readiness once; everything released on `release()`.\n */\nexport class G9IntroMediaController {\n private snapshot: G9IntroMediaSnapshot = {\n index: -1,\n kind: 'none',\n player: null,\n imageUri: null,\n visible: false,\n fadeMs: 0,\n loading: false,\n fallback: null,\n coverVisible: false,\n };\n private readonly listeners = new Set<() => void>();\n private generation = 0;\n private timers = new Set<unknown>();\n private unsubscribePlayer: (() => void) | null = null;\n private firstReady = false;\n private firstRevealDone = false;\n private videoSeekUsed = false;\n private presented = false;\n private coverShownAt = 0;\n private coverMediaReady = false;\n private disposed = false;\n\n constructor(private readonly config: G9IntroMediaConfig) {}\n\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n };\n\n getSnapshot = (): G9IntroMediaSnapshot => this.snapshot;\n\n private update(patch: Partial<G9IntroMediaSnapshot>): void {\n this.snapshot = { ...this.snapshot, ...patch };\n for (const listener of Array.from(this.listeners)) listener();\n }\n\n private later(callback: () => void, ms: number): void {\n const handle = this.config.setTimer(() => {\n this.timers.delete(handle);\n callback();\n }, ms);\n this.timers.add(handle);\n }\n\n private clearTimers(): void {\n for (const handle of this.timers) this.config.clearTimer(handle);\n this.timers.clear();\n }\n\n get isPresented(): boolean {\n return this.presented;\n }\n\n /** Starts presenting (MAUI `BeginPresentation`): the startup cover, then the current slide's media. */\n begin(slides: readonly G9IntroSlideItem[], index: number): void {\n if (this.disposed) return;\n if (!this.presented) {\n this.presented = true;\n const o = this.config.options();\n if (o.startupCoverImageSource && o.startupCoverDurationMs > 0) {\n this.coverShownAt = this.config.now();\n this.coverMediaReady = false;\n this.update({ coverVisible: true });\n this.later(() => this.tryDismissCover(), o.startupCoverDurationMs);\n }\n }\n this.show(slides, index, false);\n }\n\n /** Shows `index`'s media: fades the current media out (manual change), disposes it, loads the next. */\n show(slides: readonly G9IntroSlideItem[], index: number, animateOut = true): void {\n if (this.disposed || !this.presented) return;\n const slide = slides[index];\n if (this.snapshot.index === index && this.snapshot.kind !== 'none') return;\n const generation = ++this.generation;\n const o = this.config.options();\n const fadeOut =\n o.useMediaFadeTransitions && animateOut && this.snapshot.kind !== 'none' ? o.mediaFadeOutDurationMs : 0;\n if (fadeOut > 0) {\n this.update({ visible: false, fadeMs: fadeOut, loading: true });\n this.later(() => {\n if (generation === this.generation) this.load(slide, index, generation);\n }, fadeOut);\n return;\n }\n this.load(slide, index, generation);\n }\n\n private disposePlayer(): void {\n this.unsubscribePlayer?.();\n this.unsubscribePlayer = null;\n const player = this.snapshot.player;\n if (!player) return;\n try {\n player.dispose();\n } catch (error) {\n this.config.onError(error);\n }\n }\n\n private load(slide: G9IntroSlideItem | undefined, index: number, generation: number): void {\n this.disposePlayer();\n this.update({\n index,\n kind: 'none',\n player: null,\n imageUri: null,\n visible: false,\n fadeMs: 0,\n loading: true,\n fallback: null,\n });\n if (!slide) {\n this.settle(generation, 'empty', null, null);\n return;\n }\n const provider = this.config.provider();\n if (!introSlideHasVideo(slide)) {\n this.showImage(slide, index, generation, 'no-video', provider);\n return;\n }\n if (!provider?.createPlayer) {\n this.showImage(slide, index, generation, 'no-media-provider', provider);\n return;\n }\n if (provider.supportsVideo && provider.supportsVideo() === false) {\n this.showImage(slide, index, generation, 'video-unsupported', provider);\n return;\n }\n const createPlayer = provider.createPlayer.bind(provider);\n const o = this.config.options();\n provider.resolve(introVideoSource(slide) as never).then(\n (media) => {\n if (generation !== this.generation || this.disposed) return;\n let player: G9MediaPlayer;\n try {\n const startSeconds = !this.videoSeekUsed && o.initialVideoStartSeconds > 0 ? o.initialVideoStartSeconds : 0;\n this.videoSeekUsed = true;\n player = createPlayer(media, {\n loop: true,\n muted: true,\n ...(startSeconds > 0 ? { startSeconds } : {}),\n ...(o.useVideoLoopFade ? { nearEndSeconds: o.mediaFadeOutDurationMs / 1000 } : {}),\n });\n } catch (error) {\n this.config.onError(error);\n this.showImage(slide, index, generation, 'video-failed', provider);\n return;\n }\n this.unsubscribePlayer = player.subscribe((event) => {\n if (generation !== this.generation || this.disposed) return;\n const opts = this.config.options();\n if (event.type === 'ready') {\n this.reveal(generation);\n } else if (event.type === 'error') {\n this.config.onError(event.error);\n this.showImage(slide, index, generation, 'video-failed', provider);\n } else if (event.type === 'nearEnd') {\n if (opts.useVideoLoopFade && opts.mediaFadeOutDurationMs > 0) {\n this.update({ visible: false, fadeMs: opts.mediaFadeOutDurationMs });\n }\n } else if (opts.useVideoLoopFade) {\n this.update({ visible: true, fadeMs: opts.mediaFadeInDurationMs });\n }\n });\n this.update({ kind: 'video', player });\n player.play();\n },\n (error: unknown) => {\n if (generation !== this.generation || this.disposed) return;\n this.config.onError(error);\n this.showImage(slide, index, generation, 'video-failed', provider);\n },\n );\n }\n\n private showImage(\n slide: G9IntroSlideItem,\n index: number,\n generation: number,\n reason: G9IntroFallbackReason,\n provider: G9MediaProvider | undefined,\n ): void {\n this.disposePlayer();\n if (reason !== 'no-video') this.config.onFallback(index, reason);\n const source = introImageSource(slide);\n if (!source) {\n this.settle(generation, 'empty', null, reason);\n return;\n }\n const raw = 'asset' in source ? source.asset : source.uri;\n if (!provider) {\n this.settle(generation, 'image', raw, reason);\n return;\n }\n provider.resolve(source).then(\n (media) => {\n if (generation === this.generation && !this.disposed) this.settle(generation, 'image', media.uri, reason);\n },\n () => {\n if (generation === this.generation && !this.disposed) this.settle(generation, 'image', raw, reason);\n },\n );\n }\n\n private settle(\n generation: number,\n kind: 'image' | 'empty',\n imageUri: string | null,\n reason: G9IntroFallbackReason | null,\n ): void {\n this.update({ kind, player: null, imageUri, fallback: reason });\n this.reveal(generation);\n }\n\n private reveal(generation: number): void {\n if (generation !== this.generation) return;\n const o = this.config.options();\n const immediate = !o.useMediaFadeTransitions || (o.skipFirstSlideInitialFadeIn && !this.firstRevealDone);\n this.firstRevealDone = true;\n this.update({ visible: true, fadeMs: immediate ? 0 : o.mediaFadeInDurationMs, loading: false });\n this.coverMediaReady = true;\n this.tryDismissCover();\n if (!this.firstReady) {\n this.firstReady = true;\n this.config.onFirstContentReady();\n }\n }\n\n private tryDismissCover(): void {\n if (!this.snapshot.coverVisible || !this.coverMediaReady) return;\n const o = this.config.options();\n if (this.config.now() - this.coverShownAt < o.startupCoverDurationMs) return;\n this.update({ coverVisible: false });\n }\n\n /** Stops and releases the player (MAUI `StopAndReleaseMedia`); `begin` / `show` load again later. */\n release(): void {\n this.generation += 1;\n this.clearTimers();\n this.disposePlayer();\n this.update({\n index: -1,\n kind: 'none',\n player: null,\n imageUri: null,\n visible: false,\n loading: false,\n coverVisible: false,\n });\n this.presented = false;\n }\n\n dispose(): void {\n this.release();\n this.disposed = true;\n }\n}\n"],"names":["G9IntroMediaController","patch","listener","Array","callback","ms","handle","slides","index","o","animateOut","slide","generation","fadeOut","_this","player","error","provider","introSlideHasVideo","createPlayer","introVideoSource","media","startSeconds","event","opts","reason","source","introImageSource","raw","kind","imageUri","immediate","config","Set"],"mappings":";;;;;;;;;;;AA2DO,MAAMA;IAiCH,OAAOC,KAAoC,EAAQ;QACzD,IAAI,CAAC,QAAQ,GAAG;YAAE,GAAG,IAAI,CAAC,QAAQ;YAAE,GAAGA,KAAK;QAAC;QAC7C,KAAK,MAAMC,YAAYC,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,EAAGD;IACrD;IAEQ,MAAME,QAAoB,EAAEC,EAAU,EAAQ;QACpD,MAAMC,SAAS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type { G9MediaSource } from '@g9tm/lynxcontrols-foundation';
2
+ /** One onboarding slide (MAUI `G9IntroSlideItem`). */
3
+ export interface G9IntroSlideItem {
4
+ /** Bundled video asset (e.g. `'Onboarding/1video.mp4'`), played through `services.media`. */
5
+ readonly videoAssetPath?: string | null;
6
+ /** Image shown for image-only slides and whenever the video cannot play. */
7
+ readonly imageSource?: string | null;
8
+ /** String key of the title, resolved through the app's string provider. */
9
+ readonly titleResourceKey?: string;
10
+ readonly subtitleResourceKey?: string;
11
+ }
12
+ /** `true` when the slide has a video (MAUI `HasVideo`). */
13
+ export declare function introSlideHasVideo(slide: G9IntroSlideItem): boolean;
14
+ /** Why a slide shows its image instead of a video. */
15
+ export type G9IntroFallbackReason =
16
+ /** The slide has no video. */
17
+ 'no-video'
18
+ /** No `services.media`, or it cannot create players. */
19
+ | 'no-media-provider'
20
+ /** The provider reports no video support on this target (desktop until decision D14 is resolved). */
21
+ | 'video-unsupported'
22
+ /** Resolving or playing the video failed. */
23
+ | 'video-failed';
24
+ /** Intro defaults (MAUI `G9Metrics.Intro*`). */
25
+ export declare const g9IntroMetrics: Readonly<{
26
+ overlayOpacity: 0.52;
27
+ overlayTopOpacityRatio: 0.4;
28
+ startupCoverFadeDurationMs: 320;
29
+ mediaFadeInDurationMs: 420;
30
+ mediaFadeOutDurationMs: 420;
31
+ logoWidth: 192;
32
+ logoHeight: 34;
33
+ titleFontSize: 18;
34
+ subtitleFontSize: 14;
35
+ navFontSize: 14;
36
+ stepActiveWidth: 28;
37
+ stepInactiveWidth: 20;
38
+ stepHeight: 4;
39
+ stepSpacing: 6;
40
+ chromePadding: 20;
41
+ headerTopPadding: 16;
42
+ logoTopMargin: 48;
43
+ textBottomMargin: 12;
44
+ navMinTouchHeight: 48;
45
+ backdropColor: "#2E7D32";
46
+ }>;
47
+ /**
48
+ * The overlay's top and bottom opacity (MAUI `IntroOverlayDrawable`): flat → both `overlayOpacity`; gradient → the
49
+ * bottom is `overlayOpacity` and the top is `overlayTopOpacity` when set, else `overlayOpacity × ratio`.
50
+ */
51
+ export declare function introOverlayOpacities(options: {
52
+ readonly overlayOpacity: number;
53
+ readonly useGradientOverlay: boolean;
54
+ readonly overlayTopOpacityRatio: number;
55
+ readonly overlayTopOpacity: number | null;
56
+ }): {
57
+ readonly top: number;
58
+ readonly bottom: number;
59
+ };
60
+ /** The media source for a slide's video. */
61
+ export declare function introVideoSource(slide: G9IntroSlideItem): G9MediaSource | null;
62
+ /** The media source for a slide's image. */
63
+ export declare function introImageSource(slide: G9IntroSlideItem): G9MediaSource | null;
64
+ /** The host's safe insets as the chrome reads them (`useG9HostInsetsOrNull`). */
65
+ export interface G9IntroInsets {
66
+ readonly top: number;
67
+ readonly bottom: number;
68
+ readonly start: number;
69
+ readonly end: number;
70
+ }
71
+ /**
72
+ * Padding of the chrome (caption, step dots, arrows, sign-in button) — the media and the overlay always run to the
73
+ * screen edges. Inside an edge-to-edge host it clears the system bars; `bottomInset` (MAUI 1.4.2
74
+ * `G9IntroCarousel.BottomInset`) replaces the host's BOTTOM inset when given (a host that reserves the home indicator
75
+ * itself passes 0). Null = the stylesheet's own padding (no host insets and no explicit inset).
76
+ */
77
+ export declare function introChromePadding(insets: G9IntroInsets | null, bottomInset?: number | null): {
78
+ top: number;
79
+ bottom: number;
80
+ left: number;
81
+ right: number;
82
+ } | null;
83
+ /** Clamp an index into the slides (MAUI `ClampIndex`). */
84
+ export declare function clampIntroIndex(index: number, count: number): number;
85
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,sDAAsD;AACtD,MAAM,WAAW,gBAAgB;IAC/B,6FAA6F;IAC7F,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,4EAA4E;IAC5E,QAAQ,CAAC,WAAW,C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AAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,aAAa,GAAG,IAAI,EAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAC1B;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAUrE;AAED,0DAA0D;AAC1D,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIpE"}
package/dist/model.jsx ADDED
@@ -0,0 +1,80 @@
1
+ function introSlideHasVideo(slide) {
2
+ return null != slide.videoAssetPath && '' !== slide.videoAssetPath.trim();
3
+ }
4
+ const g9IntroMetrics = Object.freeze({
5
+ overlayOpacity: 0.52,
6
+ overlayTopOpacityRatio: 0.4,
7
+ startupCoverFadeDurationMs: 320,
8
+ mediaFadeInDurationMs: 420,
9
+ mediaFadeOutDurationMs: 420,
10
+ logoWidth: 192,
11
+ logoHeight: 34,
12
+ titleFontSize: 18,
13
+ subtitleFontSize: 14,
14
+ navFontSize: 14,
15
+ stepActiveWidth: 28,
16
+ stepInactiveWidth: 20,
17
+ stepHeight: 4,
18
+ stepSpacing: 6,
19
+ chromePadding: 20,
20
+ headerTopPadding: 16,
21
+ logoTopMargin: 48,
22
+ textBottomMargin: 12,
23
+ navMinTouchHeight: 48,
24
+ backdropColor: '#2E7D32'
25
+ });
26
+ function introOverlayOpacities(options) {
27
+ const clamp = (v)=>Number.isFinite(v) ? Math.min(Math.max(v, 0), 1) : 0;
28
+ const bottom = clamp(options.overlayOpacity);
29
+ if (!options.useGradientOverlay) return {
30
+ top: bottom,
31
+ bottom
32
+ };
33
+ const top = null != options.overlayTopOpacity && Number.isFinite(options.overlayTopOpacity) ? clamp(options.overlayTopOpacity) : clamp(bottom * options.overlayTopOpacityRatio);
34
+ return {
35
+ top,
36
+ bottom
37
+ };
38
+ }
39
+ function introVideoSource(slide) {
40
+ if (!introSlideHasVideo(slide)) return null;
41
+ const path = slide.videoAssetPath.trim();
42
+ return /^https?:\/\//i.test(path) ? {
43
+ kind: 'video',
44
+ uri: path
45
+ } : {
46
+ kind: 'video',
47
+ asset: path
48
+ };
49
+ }
50
+ function introImageSource(slide) {
51
+ if (null == slide.imageSource || '' === slide.imageSource.trim()) return null;
52
+ const path = slide.imageSource.trim();
53
+ return /^https?:\/\//i.test(path) ? {
54
+ kind: 'image',
55
+ uri: path
56
+ } : {
57
+ kind: 'image',
58
+ asset: path
59
+ };
60
+ }
61
+ function introChromePadding(insets, bottomInset) {
62
+ var _ref, _ref1;
63
+ const explicit = 'number' == typeof bottomInset && Number.isFinite(bottomInset) ? Math.max(0, bottomInset) : null;
64
+ if (!insets && null === explicit) return null;
65
+ const side = insets ? Math.max(insets.start, insets.end) : 0;
66
+ return {
67
+ top: 16 + (null != (_ref = null == insets ? void 0 : insets.top) ? _ref : 0),
68
+ bottom: 20 + (null != (_ref1 = null != explicit ? explicit : null == insets ? void 0 : insets.bottom) ? _ref1 : 0),
69
+ left: 20 + side,
70
+ right: 20 + side
71
+ };
72
+ }
73
+ function clampIntroIndex(index, count) {
74
+ if (count <= 0) return 0;
75
+ if (!Number.isFinite(index)) return 0;
76
+ return Math.min(Math.max(Math.trunc(index), 0), count - 1);
77
+ }
78
+ export { clampIntroIndex, g9IntroMetrics, introChromePadding, introImageSource, introOverlayOpacities, introSlideHasVideo, introVideoSource };
79
+
80
+ //# sourceMappingURL=model.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.jsx","sources":["../src/model.ts"],"sourcesContent":["import type { G9MediaSource } from '@g9tm/lynxcontrols-foundation';\n\n/** One onboarding slide (MAUI `G9IntroSlideItem`). */\nexport interface G9IntroSlideItem {\n /** Bundled video asset (e.g. `'Onboarding/1video.mp4'`), played through `services.media`. */\n readonly videoAssetPath?: string | null;\n /** Image shown for image-only slides and whenever the video cannot play. */\n readonly imageSource?: string | null;\n /** String key of the title, resolved through the app's string provider. */\n readonly titleResourceKey?: string;\n readonly subtitleResourceKey?: string;\n}\n\n/** `true` when the slide has a video (MAUI `HasVideo`). */\nexport function introSlideHasVideo(slide: G9IntroSlideItem): boolean {\n return slide.videoAssetPath != null && slide.videoAssetPath.trim() !== '';\n}\n\n/** Why a slide shows its image instead of a video. */\nexport type G9IntroFallbackReason =\n /** The slide has no video. */\n | 'no-video'\n /** No `services.media`, or it cannot create players. */\n | 'no-media-provider'\n /** The provider reports no video support on this target (desktop until decision D14 is resolved). */\n | 'video-unsupported'\n /** Resolving or playing the video failed. */\n | 'video-failed';\n\n/** Intro defaults (MAUI `G9Metrics.Intro*`). */\nexport const g9IntroMetrics = Object.freeze({\n overlayOpacity: 0.52,\n overlayTopOpacityRatio: 0.4,\n startupCoverFadeDurationMs: 320,\n mediaFadeInDurationMs: 420,\n mediaFadeOutDurationMs: 420,\n logoWidth: 192,\n logoHeight: 34,\n titleFontSize: 18,\n subtitleFontSize: 14,\n navFontSize: 14,\n stepActiveWidth: 28,\n stepInactiveWidth: 20,\n stepHeight: 4,\n stepSpacing: 6,\n chromePadding: 20,\n headerTopPadding: 16,\n logoTopMargin: 48,\n textBottomMargin: 12,\n navMinTouchHeight: 48,\n backdropColor: '#2E7D32',\n});\n\n/**\n * The overlay's top and bottom opacity (MAUI `IntroOverlayDrawable`): flat → both `overlayOpacity`; gradient → the\n * bottom is `overlayOpacity` and the top is `overlayTopOpacity` when set, else `overlayOpacity × ratio`.\n */\nexport function introOverlayOpacities(options: {\n readonly overlayOpacity: number;\n readonly useGradientOverlay: boolean;\n readonly overlayTopOpacityRatio: number;\n readonly overlayTopOpacity: number | null;\n}): { readonly top: number; readonly bottom: number } {\n const clamp = (v: number) => (Number.isFinite(v) ? Math.min(Math.max(v, 0), 1) : 0);\n const bottom = clamp(options.overlayOpacity);\n if (!options.useGradientOverlay) return { top: bottom, bottom };\n const top =\n options.overlayTopOpacity != null && Number.isFinite(options.overlayTopOpacity)\n ? clamp(options.overlayTopOpacity)\n : clamp(bottom * options.overlayTopOpacityRatio);\n return { top, bottom };\n}\n\n/** The media source for a slide's video. */\nexport function introVideoSource(slide: G9IntroSlideItem): G9MediaSource | null {\n if (!introSlideHasVideo(slide)) return null;\n const path = (slide.videoAssetPath as string).trim();\n return /^https?:\\/\\//i.test(path) ? { kind: 'video', uri: path } : { kind: 'video', asset: path };\n}\n\n/** The media source for a slide's image. */\nexport function introImageSource(slide: G9IntroSlideItem): G9MediaSource | null {\n if (slide.imageSource == null || slide.imageSource.trim() === '') return null;\n const path = slide.imageSource.trim();\n return /^https?:\\/\\//i.test(path) ? { kind: 'image', uri: path } : { kind: 'image', asset: path };\n}\n\n/** The host's safe insets as the chrome reads them (`useG9HostInsetsOrNull`). */\nexport interface G9IntroInsets {\n readonly top: number;\n readonly bottom: number;\n readonly start: number;\n readonly end: number;\n}\n\n/**\n * Padding of the chrome (caption, step dots, arrows, sign-in button) — the media and the overlay always run to the\n * screen edges. Inside an edge-to-edge host it clears the system bars; `bottomInset` (MAUI 1.4.2\n * `G9IntroCarousel.BottomInset`) replaces the host's BOTTOM inset when given (a host that reserves the home indicator\n * itself passes 0). Null = the stylesheet's own padding (no host insets and no explicit inset).\n */\nexport function introChromePadding(\n insets: G9IntroInsets | null,\n bottomInset?: number | null,\n): { top: number; bottom: number; left: number; right: number } | null {\n const explicit = typeof bottomInset === 'number' && Number.isFinite(bottomInset) ? Math.max(0, bottomInset) : null;\n if (!insets && explicit === null) return null;\n const side = insets ? Math.max(insets.start, insets.end) : 0; // a cutout on either side: keep it symmetric\n return {\n top: 16 + (insets?.top ?? 0),\n bottom: 20 + (explicit ?? insets?.bottom ?? 0),\n left: 20 + side,\n right: 20 + side,\n };\n}\n\n/** Clamp an index into the slides (MAUI `ClampIndex`). */\nexport function clampIntroIndex(index: number, count: number): number {\n if (count <= 0) return 0;\n if (!Number.isFinite(index)) return 0;\n return Math.min(Math.max(Math.trunc(index), 0), count - 1);\n}\n"],"names":["introSlideHasVideo","slide","g9IntroMetrics","Object","introOverlayOpacities","options","clamp","v","Number","Math","bottom","top","introVideoSource","path","introImageSource","introChromePadding","insets","bottomInset","_ref1","explicit","side","clampIntroIndex","index","count"],"mappings":"AAcO,SAASA,mBAAmBC,KAAuB;IACxD,OAAOA,AAAwB,QAAxBA,MAAM,cAAc,IAAYA,AAAgC,OAAhCA,MAAM,cAAc,CAAC,IAAI;AAClE;AAcO,MAAMC,iBAAiBC,OAAO,MAAM,CAAC;IAC1C,gBAAgB;IAChB,wBAAwB;IACxB,4BAA4B;IAC5B,uBAAuB;IACvB,wBAAwB;IACxB,WAAW;IACX,YAAY;IACZ,eAAe;IACf,kBAAkB;IAClB,aAAa;IACb,iBAAiB;IACjB,mBAAmB;IACnB,YAAY;IACZ,aAAa;IACb,eAAe;IACf,kBAAkB;IAClB,eAAe;IACf,kBAAkB;IAClB,mBAAmB;IACnB,eAAe;AACjB;AAMO,SAASC,sBAAsBC,OAKrC;IACC,MAAMC,QAAQ,CAACC,IAAeC,OAAO,QAAQ,CAACD,KAAKE,KAAK,GAAG,CAACA,KAAK,GAAG,CAACF,GAAG,IAAI,KAAK;IACjF,MAAMG,SAASJ,MAAMD,QAAQ,cAAc;IAC3C,IAAI,CAACA,QAAQ,kBAAkB,EAAE,OAAO;QAAE,KAAKK;QAAQA;IAAO;IAC9D,MAAMC,MACJN,AAA6B,QAA7BA,QAAQ,iBAAiB,IAAYG,OAAO,QAAQ,CAACH,QAAQ,iBAAiB,IAC1EC,MAAMD,QAAQ,iBAAiB,IAC/BC,MAAMI,SAASL,QAAQ,sBAAsB;IACnD,OAAO;QAAEM;QAAKD;IAAO;AACvB;AAGO,SAASE,iBAAiBX,KAAuB;IACtD,IAAI,CAACD,mBAAmBC,QAAQ,OAAO;IACvC,MAAMY,OAAQZ,MAAM,cAAc,CAAY,IAAI;IAClD,OAAO,gBAAgB,IAAI,CAACY,QAAQ;QAAE,MAA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version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.4.2",
4
+ "description": "G9IntroCarousel: onboarding slides with image/video through a media provider.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "sideEffects": [
8
+ "**/*.css"
9
+ ],
10
+ "exports": {
11
+ ".": {
12
+ "source": "./src/index.ts",
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.jsx"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "README.md"
20
+ ],
21
+ "scripts": {
22
+ "build": "rslib build"
23
+ },
24
+ "dependencies": {
25
+ "@g9tm/lynxcontrols": "1.4.2",
26
+ "@g9tm/lynxcontrols-foundation": "1.4.2",
27
+ "@lynx-js/lynx-ui-swiper": "3.139.0"
28
+ },
29
+ "peerDependencies": {
30
+ "@lynx-js/react": ">=0.126.2 <0.127.0"
31
+ }
32
+ }