@swiftbrowser/native 0.17.6 → 0.17.7

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.
@@ -385,6 +385,49 @@ public struct StepperProps: Equatable, Sendable {
385
385
  }
386
386
  }
387
387
 
388
+ /// `video` (docs/ops-protocol.md, "Video and audio"): a view of an `AVPlayer`, as the app works its props out.
389
+ public struct VideoProps: Equatable, Sendable {
390
+ /// The media URL; nil while there is none.
391
+ public var url: String?
392
+ /// Whether the player plays here (only its newest view plays it).
393
+ public var playing: Bool
394
+ public var muted: Bool
395
+ /// 0…1.
396
+ public var volume: Double
397
+ /// The playback rate (the default rate while paused).
398
+ public var rate: Double
399
+ public var loop: Bool
400
+ /// `resizeAspect`, `resizeAspectFill` or `resize`.
401
+ public var gravity: String
402
+ /// The system's playback controls.
403
+ public var controls: Bool
404
+ /// Seconds; seek once per serial, reporting `seeked` with it.
405
+ public var seekTime: Double
406
+ public var seekSerial: Int
407
+ /// Report the position this often (seconds) while playing.
408
+ public var report: Double?
409
+ /// The video's pixel size once known: the aspect ratio of an axis left open.
410
+ public var width: Double?
411
+ public var height: Double?
412
+
413
+ public init(props: JSONObject) {
414
+ url = props.string("url")
415
+ playing = props.bool("playing") ?? false
416
+ muted = props.bool("muted") ?? false
417
+ volume = props.double("volume") ?? 1
418
+ rate = props.double("rate") ?? 1
419
+ loop = props.bool("loop") ?? false
420
+ gravity = props.string("gravity") ?? "resizeAspect"
421
+ controls = props.bool("controls") ?? true
422
+ let seek = props.object("seek")
423
+ seekTime = seek?.double("time") ?? 0
424
+ seekSerial = seek?.int("serial") ?? 0
425
+ report = props.double("report")
426
+ width = props.double("width")
427
+ height = props.double("height")
428
+ }
429
+ }
430
+
388
431
  public struct SliderProps: Equatable, Sendable {
389
432
  public var value: Double
390
433
  public var min: Double
@@ -57,8 +57,18 @@ public struct RendererEvent: Equatable, Sendable {
57
57
  }
58
58
  /// A `stepper` half was tapped (`value` is ±1).
59
59
  public static func step(_ id: Int, _ delta: Int) -> RendererEvent { with("step", id: id, ["value": .number(Double(delta))]) }
60
- /// A `slider` moved.
61
- public static func slide(_ id: Int, _ value: Double) -> RendererEvent { with("slide", id: id, ["value": .number(value)]) }
60
+ /// A `slider` moved; `editing` true with a drag's first value and false with its last (`onEditingChanged`), nil between.
61
+ public static func slide(_ id: Int, _ value: Double, editing: Bool? = nil) -> RendererEvent {
62
+ var fields: JSONObject = ["value": .number(value)]
63
+ if let editing { fields["editing"] = .bool(editing) }
64
+ return with("slide", id: id, fields)
65
+ }
66
+ /// A `video` element's playback (docs/ops-protocol.md, "`video` events"): `event` names it (`ready`, `time`, `status`, `seeked`, `play`, `pause`, `volume`, `rate`, `ended`, `error`), `fields` are its own.
67
+ public static func video(_ id: Int, _ event: String, _ fields: JSONObject = [:]) -> RendererEvent {
68
+ var all = fields
69
+ all["event"] = .string(event)
70
+ return with("video", id: id, all)
71
+ }
62
72
  /// A `datepicker` changed; `seconds` since 1970.
63
73
  public static func date(_ id: Int, seconds: Double) -> RendererEvent { with("date", id: id, ["value": .number(seconds)]) }
64
74
  /// A `textfield` with `focused` gained or lost focus.
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/wasm/SwiftBrowserNative.wasm
3
- size: 49333823 bytes
4
- sha256: f14edd41221a10a6f752f899f5eff663bbdbadd186d7503fad5eabe1e94bf916
3
+ size: 49658341 bytes
4
+ sha256: 9aa09e4a1125c88786c07b9293dd9eec6264583717cd1f8227808596da2d911a