@sigma-studio/viewer 0.188.2 → 0.255.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 +23 -0
- package/dist/index.js +11 -12
- package/dist/styles.css +1 -1
- package/dist/types.d.ts +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -141,6 +141,29 @@ npm run viewer:example
|
|
|
141
141
|
|
|
142
142
|
`npm run viewer:pack`は公開せず、npm packageの内容だけを確認します。
|
|
143
143
|
|
|
144
|
+
### CSSの視覚回帰テスト
|
|
145
|
+
|
|
146
|
+
`src/styles-sync.test.ts`はスタイルシート同士をテキストとして突き合わせるだけで、**適用した結果**は見ていません。値のずれ(`--editor-font-size`の変更、共有`document-surface.css`の余白変更など)はこれをすり抜けます。
|
|
147
|
+
|
|
148
|
+
その差分を数値で捕まえるのが`apps/desktop/tests/e2e/viewer-css-parity.spec.ts`です。`packages/viewer/dist`を実ブラウザに配って代表文書を描き、`.sigma-viewer`配下の全要素について`getComputedStyle`と`getBoundingClientRect`を採取し、コミット済みベースラインと比較します。差分は`<要素> | <プロパティ>`の行として出ます(スクリーンショット比較ではありません)。
|
|
149
|
+
|
|
150
|
+
```sh
|
|
151
|
+
# 1. dist を作る。作業ツリーのパスに非ASCII文字が含まれる場合は
|
|
152
|
+
# scripts/build.mjs の new URL().pathname が percent-encode されて失敗するので、
|
|
153
|
+
# ASCIIパスのクローン(git worktree add --detach /tmp/<name> <ref> + node_modules を cp)で実行し
|
|
154
|
+
# packages/viewer/dist をコピーして戻す。
|
|
155
|
+
npm run viewer:build
|
|
156
|
+
|
|
157
|
+
# 2. 走らせる(Next の dev server は不要。spec が自前で静的サーバを立てる)
|
|
158
|
+
cd apps/desktop
|
|
159
|
+
SIGMA_STUDIO_E2E_BASE_URL=http://127.0.0.1:<空きポート> \
|
|
160
|
+
npx playwright test tests/e2e/viewer-css-parity.spec.ts
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
`dist`が無い、または`dist/styles.css`が元のCSS(`packages/viewer/src/styles.css` / `apps/desktop/src/app/document-surface.css`)より古い場合は、理由付きでskipされます。古いビルドを測ると「作業ツリーに既にある退行」を緑と報告してしまうためです。
|
|
164
|
+
|
|
165
|
+
ベースラインの更新は`--update-snapshots`を付けて再実行し、**差分を1行ずつ読んでから**コミットします。ファイル名にはPlaywrightのplatform suffix(`-chromium-darwin`)が付きます。フォントとChromiumのビルドに依存する計測なので、書き出した機械・ブラウザでのみ意味を持ちます。
|
|
166
|
+
|
|
144
167
|
## ライセンス
|
|
145
168
|
|
|
146
169
|
MIT
|