uifolio 0.4.0 → 0.5.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/src/lib/video.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Helpers vidéo partagés par les composants de la librairie.
3
- * Aucune dépendance : copier ce fichier avec le composant suffit.
2
+ * Video helpers shared by the library components.
3
+ * No dependency: copying this file along with the component is enough.
4
4
  */
5
5
 
6
6
  export type PlayerSource =
@@ -28,7 +28,7 @@ export function toSourceList(input: PlayerSource | PlayerSource[]): PlayerSource
28
28
  return Array.isArray(input) ? input : [input]
29
29
  }
30
30
 
31
- /** Signature stable, utilisée pour ne pas recréer les object URLs à chaque render. */
31
+ /** Stable signature, so object URLs are not recreated on every render. */
32
32
  export function sourceSignature(input: PlayerSource | PlayerSource[]): string {
33
33
  return toSourceList(input)
34
34
  .map((source) => {
@@ -75,7 +75,7 @@ export function youtubeThumbnailFallback(id: string): string {
75
75
  loop?: boolean
76
76
  muted?: boolean
77
77
  controls?: boolean
78
- /** Origine de la page hôte : l'API iframe YouTube lui associe les commandes postMessage. */
78
+ /** Host page origin: the YouTube iframe API matches postMessage commands to it. */
79
79
  origin?: string
80
80
  playsinline?: boolean
81
81
  }
@@ -123,7 +123,7 @@ export function buildEmbedUrl(
123
123
 
124
124
 
125
125
  /* -------------------------------------------------------------------------- */
126
- /* Pilotage des embeds (YouTube / Vimeo) par postMessage */
126
+ /* Driving the embeds (YouTube / Vimeo) through postMessage */
127
127
  /* -------------------------------------------------------------------------- */
128
128
 
129
129
  export type EmbedKind = 'youtube' | 'vimeo'
@@ -132,12 +132,12 @@ export type EmbedCommand =
132
132
  | { type: 'play' }
133
133
  | { type: 'pause' }
134
134
  | { type: 'seek'; time: number }
135
- /** Volume normalisé 0–1, converti dans l'unité de chaque plateforme. */
135
+ /** Normalized volume 0–1, converted into each platform's unit. */
136
136
  | { type: 'volume'; volume: number }
137
137
  | { type: 'mute'; muted: boolean }
138
138
  | { type: 'rate'; rate: number }
139
139
 
140
- /** Message à poster dans l'iframe : chaîne JSON pour YouTube, objet pour Vimeo. */
140
+ /** Message to post into the iframe: a JSON string for YouTube, an object for Vimeo. */
141
141
  export function embedCommand(
142
142
  kind: EmbedKind,
143
143
  command: EmbedCommand,
@@ -190,10 +190,10 @@ const VIMEO_EVENTS = [
190
190
  'playbackratechange',
191
191
  ]
192
192
 
193
- /** Messages à envoyer à l'iframe pour recevoir son état et ses événements. */
193
+ /** Messages to send to the iframe to receive its state and events. */
194
194
  export function embedHandshake(kind: EmbedKind): Array<Record<string, unknown> | string> {
195
195
  if (kind === 'youtube') {
196
- // Démarre l'émission des messages `infoDelivery` (temps, durée, état).
196
+ // Starts the `infoDelivery` messages (time, duration, state).
197
197
  return [JSON.stringify({ event: 'listening', id: 1, channel: 'widget' })]
198
198
  }
199
199
  return [
@@ -249,7 +249,7 @@ function parseYoutubeStatus(raw: unknown): EmbedStatus | null {
249
249
  if (duration !== undefined && duration > 0) status.duration = duration
250
250
 
251
251
  const playerState = toNumber(info.playerState)
252
- // -1 non démarré, 0 terminé, 1 lecture, 2 pause, 3 buffering, 5 prêt.
252
+ // -1 unstarted, 0 ended, 1 playing, 2 paused, 3 buffering, 5 cued.
253
253
  if (playerState !== undefined) status.playing = playerState === 1 || playerState === 3
254
254
 
255
255
  const muted = info.muted
@@ -312,7 +312,7 @@ function parseVimeoStatus(raw: unknown): EmbedStatus | null {
312
312
  return null
313
313
  }
314
314
 
315
- /** Décode un message postMessage émis par l'iframe et en extrait l'état de lecture. */
315
+ /** Decodes a postMessage sent by the iframe and extracts the playback state. */
316
316
  export function parseEmbedMessage(kind: EmbedKind, raw: unknown): EmbedStatus | null {
317
317
  return kind === 'youtube' ? parseYoutubeStatus(raw) : parseVimeoStatus(raw)
318
318
  }
@@ -335,7 +335,7 @@ export function formatTime(value: number): string {
335
335
  return `${minutes}:${paddedSeconds}`
336
336
  }
337
337
 
338
- /** "16/9" | 16/9 | 1.77 | "auto" -> valeur CSS aspect-ratio. */
338
+ /** "16/9" | 16/9 | 1.77 | "auto" -> CSS aspect-ratio value. */
339
339
  export function toAspectRatio(value: string | number | undefined): string | undefined {
340
340
  if (value == null) return undefined
341
341
  if (typeof value === 'number') return String(value)
package/src/lib/vtt.ts CHANGED
@@ -57,7 +57,7 @@ function cleanCueText(lines: string[]): string {
57
57
  .trim()
58
58
  }
59
59
 
60
- /** Parse un fichier WebVTT en cues. Tolérant : ignore entêtes, notes, styles et blocs invalides. */
60
+ /** Parses a WebVTT file into cues. Tolerant: skips headers, notes, styles and invalid blocks. */
61
61
  export function parseVtt(raw: string): VttCue[] {
62
62
  const lines = raw
63
63
  .replace(/^\uFEFF/, '')
@@ -1,18 +0,0 @@
1
- const accentToScheme: Record<string, { dark: string; light: string; foreground: string; background: string }> = {
2
- '#10b981': {
3
- dark: '#0f172a',
4
- light: '#0f172a',
5
- foreground: '#f1f5f9',
6
- background: '#ecfdf5',
7
- },
8
- default: {
9
- dark: '#f8fafc',
10
- light: '#0f172a',
11
- foreground: '#0f172a',
12
- background: '#ffffff',
13
- },
14
- }
15
-
16
- export function accentTokens(accent: string) {
17
- return accentToScheme[accent] ?? accentToScheme.default
18
- }