Bidirectional bridge between pl_editor's DS_DATA_MODEL and a Yjs doc, two same-origin
tabs syncing over BroadcastChannel. Full architecture in features/yjs-bridge/0001-0002.
C++ (wasm layer, wasm/bindings/pl_editor_embind.cpp — public DS_DATA_MODEL API only,
zero added fork divergence beyond the OnModify hook):
- snapshot-differ ChangeSource: diff model vs last-emitted snapshot on OnModify,
emit per-item delta JSON via EM_ASM window.kicadCollab.onDelta
- kicadCollabApply(json): apply remote delta by uuid — scalars (text/segment/rect)
by field, polygon/bitmap via SetPageLayout-append blob; reseed snapshot + HardRedraw
- kicadCollabSnapshot() (seed/baseline), s_applyingRemote echo guard, and a
kicadCollabTestAddText() PoC local-edit hook
- wire format: {added:[item],changed:[item],removed:[uuid]}, item = {id,type,...fields}
JS (web/apps/frontend/src/wasm/collab/, generic + schema-agnostic):
- reconciler: uuid-keyed Y.Map of per-item Y.Map; down = onDelta→Y, up = observe→apply,
origin-tagged echo suppression; seed-once join adopts the doc authoritatively
- broadcast-transport: minimal BroadcastChannel Yjs provider (query/state catch-up)
- WasmTool wiring behind ?collab=1 (pl_editor only); gated debug logging
Tests: tests/kicad/pl_editor-collab.spec.ts — single-page C++ contract (snapshot/apply
changed+removed+added/echo-suppression) + two-tab BroadcastChannel A<->B propagation.
Reconciler+yjs bundled via esbuild (tests/collab/build.mjs, npm run build:collab).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
48 lines
3.4 KiB
JSON
48 lines
3.4 KiB
JSON
{
|
|
"name": "kicad-wasm-tests",
|
|
"version": "1.0.0",
|
|
"description": "Playwright tests for wxWidgets WASM and KiCad",
|
|
"scripts": {
|
|
"test": "playwright test",
|
|
"test:ui": "playwright test --ui",
|
|
"test:headed": "playwright test --headed",
|
|
"build-wasm": "cd apps && make -f Makefile.wasm",
|
|
"build:collab": "node collab/build.mjs",
|
|
"serve": "npx serve apps -p 8080 -c ../serve.json",
|
|
"setup:kicad": "./scripts/setup-kicad-wasm.sh",
|
|
"test:web": "npm run setup:kicad && playwright test --config=playwright-web.config.ts --project=firefox",
|
|
"test:web:headed": "npm run setup:kicad && playwright test --config=playwright-web.config.ts --project=chromium --headed",
|
|
"test:kicad:firefox": "npm run setup:kicad && playwright test --config=playwright-kicad.config.ts --project=firefox",
|
|
"test:kicad:chrome": "npm run setup:kicad && playwright test --config=playwright-kicad.config.ts --project=chromium --headed",
|
|
"test:kicad": "npm run test:kicad:firefox",
|
|
"test:kicad:headed": "npm run test:kicad:chrome",
|
|
"test:pcbnew:firefox": "npm run setup:kicad && playwright test --config=playwright-kicad.config.ts --project=firefox kicad/pcbnew.spec.ts",
|
|
"test:pcbnew:chrome": "npm run setup:kicad && playwright test --config=playwright-kicad.config.ts --project=chromium --headed kicad/pcbnew.spec.ts",
|
|
"test:eeschema:firefox": "npm run setup:kicad && playwright test --config=playwright-kicad.config.ts --project=firefox kicad/eeschema.spec.ts",
|
|
"test:eeschema:chrome": "npm run setup:kicad && playwright test --config=playwright-kicad.config.ts --project=chromium --headed kicad/eeschema.spec.ts",
|
|
"test:eeschema": "npm run test:eeschema:firefox",
|
|
"test:eeschema:headed": "npm run test:eeschema:chrome",
|
|
"test:calculator:firefox": "npm run setup:kicad && playwright test --config=playwright-kicad.config.ts --project=firefox kicad/calculator.spec.ts",
|
|
"test:calculator:chrome": "npm run setup:kicad && playwright test --config=playwright-kicad.config.ts --project=chromium --headed kicad/calculator.spec.ts",
|
|
"test:calculator": "npm run test:calculator:firefox",
|
|
"test:calculator:headed": "npm run test:calculator:chrome",
|
|
"test:symbol_editor:firefox": "npm run setup:kicad && playwright test --config=playwright-kicad.config.ts --project=firefox kicad/symbol_editor.spec.ts",
|
|
"test:symbol_editor:chrome": "npm run setup:kicad && playwright test --config=playwright-kicad.config.ts --project=chromium --headed kicad/symbol_editor.spec.ts",
|
|
"test:symbol_editor": "npm run test:symbol_editor:firefox",
|
|
"test:symbol_editor:headed": "npm run test:symbol_editor:chrome",
|
|
"test:gerbview:firefox": "npm run setup:kicad && playwright test --config=playwright-kicad.config.ts --project=firefox kicad/gerbview.spec.ts",
|
|
"test:gerbview:chrome": "npm run setup:kicad && playwright test --config=playwright-kicad.config.ts --project=chromium --headed kicad/gerbview.spec.ts",
|
|
"test:gerbview": "npm run test:gerbview:firefox",
|
|
"test:gerbview:headed": "npm run test:gerbview:chrome",
|
|
"test:coroutine:firefox": "playwright test --config=playwright-coroutine.config.ts --project=firefox",
|
|
"test:coroutine:chrome": "playwright test --config=playwright-coroutine.config.ts --project=chromium --headed"
|
|
},
|
|
"devDependencies": {
|
|
"@playwright/test": "^1.40.0",
|
|
"@types/node": "^24.10.1",
|
|
"esbuild": "^0.28.0",
|
|
"serve": "^14.2.0",
|
|
"typescript": "^5.9.3",
|
|
"yjs": "^13.6.31"
|
|
}
|
|
}
|