@goxjs/goxjs 0.10.0 → 0.12.0

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/README.md CHANGED
@@ -85,6 +85,7 @@ GUI examples (40+ runnable demos live in the repo's `testdata/` directory):
85
85
  goxjs testdata/view_demo2.js # list reuse / conditional keep-alive / multi-branch
86
86
  goxjs testdata/model_demo.js # two-way binding across all eight control types
87
87
  goxjs testdata/router_demo.js # route table / param matching / three-level guards / lazy loading
88
+ goxjs testdata/media_demo.js # media: GIF video / MJPEG / WAV audio, really playing
88
89
  ```
89
90
 
90
91
  ## Router & Screens (`gx/router` / `gx/screen`)
@@ -183,6 +184,67 @@ try {
183
184
  Demo: `goxjs testdata/native_demo.js`. Semantics and export tables:
184
185
  [`docs/gui-guide.md` §9.6](https://github.com/14752222/Gox/blob/main/docs/gui-guide.md#96-原生能力层).
185
186
 
187
+ ## Media (`<video>` / `<audio>`)
188
+
189
+ **New in 0.11.0**: the two media tags finally *play* on Linux — until now the core only defined a host
190
+ contract and every desktop backend downgraded to a poster / placeholder.
191
+
192
+ ```jsx
193
+ <video src="testdata/media_demo.gif" fit="contain" loop playing width={320} height={180}
194
+ onTimeUpdate={(e) => setPos(e.currentTime)} />
195
+ <audio src="testdata/media_demo.wav" playing loop volume={0.8}
196
+ onEnded={() => console.log("done")} />
197
+ ```
198
+
199
+ - **Contract first, never a fake play**: the core only knows the `nativeVideoHost` / `nativeAudioHost`
200
+ interfaces. A backend without that capability draws a poster (or a placeholder bar for audio) and
201
+ **reports honestly** — one stderr warning, one `onError({code:"unsupported"})`, and
202
+ `canIUse("video" / "audio")` answering `false`. It never pretends to be playing.
203
+ - **`gfx/softmedia` (default on Linux)** is the reference implementation of both interfaces, covering
204
+ exactly what the Go standard library can decode: video **GIF** (disposal 0/1/2/3 compositing) and
205
+ **MJPEG**; audio **WAV** (PCM 8/16/24/32-bit + IEEE float) out through PulseAudio (`purego` dlopen,
206
+ zero cgo). No libpulse / no server / no device ⇒ **null sink**: silent, but the playback clock and
207
+ every event stay real.
208
+ - **Out of scope on purpose**: h264 / hevc / vp9 / av1 and mp3 / aac / ogg are not decoded. Those belong
209
+ to a platform media layer (Windows MF / macOS AVPlayerLayer / Linux GStreamer) — it just has to
210
+ implement the same two interfaces.
211
+ - `playing` / `muted` / `loop` / `volume` / `fit` are **controlled** props; whatever the host reports
212
+ comes back as `onReady` / `onPlay` / `onPause` / `onEnded` / `onTimeUpdate({currentTime, duration})`.
213
+
214
+ Demo: `goxjs testdata/media_demo.js` — **run it from the repo root**, asset paths resolve against the
215
+ process working directory. Manual: [`docs/gui-guide.md`](https://github.com/14752222/Gox/blob/main/docs/gui-guide.md);
216
+ scope and rationale: [`docs/media-decision.md`](https://github.com/14752222/Gox/blob/main/docs/media-decision.md).
217
+
218
+ ## 0.12.0 Release Notes
219
+
220
+ - **Anti-aliased rasteriser**: the whole drawing pipeline now composites by **coverage**
221
+ (`coverage = clamp(halfWidth + 0.5 - distanceToEdge, 0, 1)`) instead of snapping to whole
222
+ pixels — lines, circles/arcs, rings (donut charts, gauges) and path fills (area charts,
223
+ polygons) no longer show staircase edges. This is the difference you actually see on
224
+ canvas-drawn dashboards: dark background + saturated thin strokes was the worst case.
225
+ - **Crisp where it matters**: axis-aligned 1px lines and borders stay pixel-exact (no half-lit
226
+ "double line" blur), line widths are unchanged, and total ink is preserved (measured −0.82%
227
+ on the probe scene) — anti-aliasing only redistributes the edges.
228
+ - **Path strokes keep sub-pixel endpoints**: `strokePath` no longer rounds vertices to integers,
229
+ which removes the vertex jitter on polylines.
230
+ - **Fixes & housekeeping**: the spinner's thick-line helper now shares the same anti-aliased
231
+ primitive, so it is no longer the last jagged thing on screen; docs and package notes updated
232
+ to the "coverage anti-aliasing" wording.
233
+
234
+ ## 0.11.0 Release Notes
235
+
236
+ - **Media actually plays**: `<video>` / `<audio>` now ship with `gfx/softmedia`, a pure-Go software
237
+ media backend (GIF / MJPEG video, WAV + PulseAudio audio) wired into the default Linux build.
238
+ `<audio>` is a new tag; `<video>` gained `fit`. Everywhere else the honest-downgrade path is unchanged.
239
+ - **`gx/datav`**: dashboard / data-visualisation component library, with a 29-script screenshot gallery.
240
+ - **GPU presentation backend prototype** (`-tags gpu`): presentation wrappers now stack as a chain in
241
+ front of the software rasteriser. Experimental — the default build is untouched.
242
+ - **Language**: `for...in` destructuring bindings, and heads without a declaration.
243
+ - **Apps**: a foldable-screen demo app covering four scenarios.
244
+ - **Fixes & housekeeping**: `device.vibrate` no longer declares a capability it can never honour (that
245
+ made `canIUse` lie); new platform-independent host-contract test suite; test262 language compliance
246
+ 78.76% → 78.9%.
247
+
186
248
  ## 0.6.0 Release Notes
187
249
 
188
250
  - **GUI on all platforms**: the macOS window backend (cocoa, driving AppKit via purego in pure Go) has landed —
@@ -290,6 +352,7 @@ GUI 示例(仓库 `testdata/` 下有 40+ 个可直接运行的演示):
290
352
  goxjs testdata/view_demo2.js # 列表复用 / 条件保活 / 多分支
291
353
  goxjs testdata/model_demo.js # 八类受控组件的双向绑定
292
354
  goxjs testdata/router_demo.js # 路由表 / 参数匹配 / 三级守卫 / 懒加载
355
+ goxjs testdata/media_demo.js # 媒体:GIF 视频 / MJPEG / WAV 音频真播放
293
356
  ```
294
357
 
295
358
  ### 路由与屏幕(`gx/router` / `gx/screen`)
@@ -384,6 +447,57 @@ try {
384
447
  演示:`goxjs testdata/native_demo.js`。语义与导出表见
385
448
  [`docs/gui-guide.md` §9.6](https://github.com/14752222/Gox/blob/main/docs/gui-guide.md#96-原生能力层)。
386
449
 
450
+ ### 媒体组件(`<video>` / `<audio>`)
451
+
452
+ **0.11.0 起在 Linux 上真的能播** —— 此前内核只有宿主契约,桌面三后端一律降级成封面 / 占位条。
453
+
454
+ ```jsx
455
+ <video src="testdata/media_demo.gif" fit="contain" loop playing width={320} height={180}
456
+ onTimeUpdate={(e) => setPos(e.currentTime)} />
457
+ <audio src="testdata/media_demo.wav" playing loop volume={0.8}
458
+ onEnded={() => console.log("done")} />
459
+ ```
460
+
461
+ - **先有契约,绝不假装在播**:内核只认 `nativeVideoHost` / `nativeAudioHost` 两个接口。后端没有这块
462
+ 能力就画封面(音频是一条占位条)并**诚实报错** —— stderr 告警一次、派发一次 `onError({code:"unsupported"})`、
463
+ `canIUse("video" / "audio")` 照实回答 `false`。
464
+ - **`gfx/softmedia`(Linux 默认挂上)**是这两个接口的参考实现,只覆盖标准库够得着的格式:视频
465
+ **GIF**(disposal 0/1/2/3 合成)与 **MJPEG**;音频 **WAV**(PCM 8/16/24/32 位 + IEEE float)经
466
+ PulseAudio 输出(`purego` dlopen,零 cgo)。没有 libpulse / 没有服务 / 没有设备 ⇒ **null sink**:
467
+ 不放声,但播放时钟与事件全部照真。
468
+ - **刻意的边界**:h264 / hevc / vp9 / av1 与 mp3 / aac / ogg 一概不解 —— 那些属于平台媒体层
469
+ (Windows MF / macOS AVPlayerLayer / Linux GStreamer),它只要实现同样两个接口即可接入。
470
+ - `playing` / `muted` / `loop` / `volume` / `fit` 都是**受控**属性;宿主上报的状态经 `onReady` /
471
+ `onPlay` / `onPause` / `onEnded` / `onTimeUpdate({currentTime, duration})` 回到脚本。
472
+
473
+ 演示:`goxjs testdata/media_demo.js` —— **必须从仓库根运行**,素材路径按进程工作目录解析。手册见
474
+ [`docs/gui-guide.md`](https://github.com/14752222/Gox/blob/main/docs/gui-guide.md);边界与理由见
475
+ [`docs/media-decision.md`](https://github.com/14752222/Gox/blob/main/docs/media-decision.md)。
476
+
477
+ ### 0.12.0 更新
478
+
479
+ - **光栅抗锯齿**:整条绘制链路改为按**覆盖率**合成(`coverage = clamp(半宽 + 0.5 - 到边界距离, 0, 1)`),
480
+ 不再像素级取整 —— 折线、圆弧、环带(环形图 / 仪表盘)、路径填充(面积图 / 多边形)不再有楼梯状锯齿。
481
+ 自绘看板的典型场景(深色底 + 高饱和细线)此前正是最扎眼的一种。
482
+ - **该锐利的地方仍然锐利**:整数端点的 1px 横竖线与边框保持像素精确(不会被糊成两条半亮的线),
483
+ 线宽不变,墨量基本不变(探针场景实测 −0.82%)—— 抗锯齿只是把边缘重新分布。
484
+ - **描边保留亚像素端点**:`strokePath` 不再把顶点取整,折线不再抖。
485
+ - **修复与收尾**:spinner 的粗线改用同一套抗锯齿原语,不再是屏幕上最后一个带锯齿的东西;
486
+ 文档与包内说明同步为「覆盖率抗锯齿」口径。
487
+
488
+ ### 0.11.0 更新
489
+
490
+ - **媒体真的能播了**:`<video>` / `<audio>` 配上 `gfx/softmedia` 软件媒体后端(GIF / MJPEG 视频,
491
+ WAV + PulseAudio 音频),已接进 Linux 默认构建。`<audio>` 是新标签,`<video>` 新增 `fit`;其余平台
492
+ 的诚实降级路径不变。
493
+ - **`gx/datav`**:大屏 / 数据可视化组件库,附带 29 个单组件画廊截图脚本。
494
+ - **GPU 呈现后端原型**(`-tags gpu`):呈现包装器改为**链式叠加**,可挂在软件光栅化之前。实验轨,
495
+ 默认构建不受影响。
496
+ - **语言**:`for...in` 解构绑定,以及无声明的 `for...in` 头部。
497
+ - **应用**:折叠屏四场景演示应用。
498
+ - **修复与收尾**:`device.vibrate` 撤下了"声明了却恒 unsupported"的能力声明(那让 `canIUse` 说谎);
499
+ 新增平台无关的宿主契约测试套件;test262 language 合规率 78.76% → 78.9%。
500
+
387
501
  ### 0.6.0 更新
388
502
 
389
503
  - **GUI 全平台**:macOS 窗口后端(cocoa,purego 纯 Go 驱动 AppKit)落地 —— 桌面 GUI 现在 Windows / macOS / Linux 三平台可用,npm 预编译二进制开箱即含。
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goxjs/goxjs",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "Gox — 用 Go 从零实现的 JavaScript 运行时(lexer → parser → 字节码 VM),单二进制零外部依赖",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {