From 74bcafa70fc514bedf8109b3f0b2692360feacf0 Mon Sep 17 00:00:00 2001 From: DarkSky Date: Sun, 22 Nov 2026 06:42:55 +0900 Subject: [PATCH] feat(native-playground): add N-3 perf guardrail, theme/style oracle, and CI self-tests --- .github/workflows/native-playground.yml | 21 + blocksuite/native-playground/AGENTS.md | 9 + blocksuite/native-playground/perf/README.md | 72 + .../native-playground/perf/accepted.json | 1 + .../native-playground/perf/compare-n3.mjs | 1224 +++++++ .../perf/compare-n3.test.mjs | 718 +++++ blocksuite/native-playground/perf/schema.json | 135 + .../tokens/extract-style-oracle.spec.ts | 869 +++++ .../tokens/extract-tokens.mjs | 1009 ++++++ .../native-playground/tokens/fonts.lock | 503 +++ blocksuite/native-playground/tokens/icons.rs | 508 +++ .../tokens/style-oracle.json | 2827 +++++++++++++++++ blocksuite/native-playground/tokens/tokens.rs | 1628 ++++++++++ .../native-playground/tokens/vitest.config.ts | 103 + 14 files changed, 9627 insertions(+) create mode 100644 blocksuite/native-playground/perf/README.md create mode 100644 blocksuite/native-playground/perf/accepted.json create mode 100644 blocksuite/native-playground/perf/compare-n3.mjs create mode 100644 blocksuite/native-playground/perf/compare-n3.test.mjs create mode 100644 blocksuite/native-playground/perf/schema.json create mode 100644 blocksuite/native-playground/tokens/extract-style-oracle.spec.ts create mode 100644 blocksuite/native-playground/tokens/extract-tokens.mjs create mode 100644 blocksuite/native-playground/tokens/fonts.lock create mode 100644 blocksuite/native-playground/tokens/icons.rs create mode 100644 blocksuite/native-playground/tokens/style-oracle.json create mode 100644 blocksuite/native-playground/tokens/tokens.rs create mode 100644 blocksuite/native-playground/tokens/vitest.config.ts diff --git a/.github/workflows/native-playground.yml b/.github/workflows/native-playground.yml index 84d97a1710..85910b14c8 100644 --- a/.github/workflows/native-playground.yml +++ b/.github/workflows/native-playground.yml @@ -54,6 +54,26 @@ jobs: - name: Static invariants and link-flag check run: ./scripts/check-invariants.sh + - name: Perf guardrail self-tests and generated token/icon unit tests + run: | + node --test perf/compare-n3.test.mjs + rustc --edition 2024 --test -D warnings tokens/tokens.rs -o /tmp/tokens_test && /tmp/tokens_test + rustc --edition 2024 --test -D warnings tokens/icons.rs -o /tmp/icons_test && /tmp/icons_test + rm -f /tmp/tokens_test /tmp/icons_test + + - name: Verify generated tokens, icons, and fonts.lock have zero drift + run: | + THEME_VER=$(awk '/^"@toeverything\/theme@/{f=1} f && /version:/{print $2; exit}' ../../yarn.lock) + ICONS_VER=$(awk '/^"@blocksuite\/icons@/{f=1} f && /version:/{print $2; exit}' ../../yarn.lock) + rm -rf /tmp/np-token-deps + mkdir -p /tmp/np-token-deps/node_modules/@toeverything/theme /tmp/np-token-deps/node_modules/@blocksuite/icons + curl -fsSL "https://registry.npmjs.org/@toeverything/theme/-/theme-${THEME_VER}.tgz" \ + | tar -xz --strip-components=1 -C /tmp/np-token-deps/node_modules/@toeverything/theme + curl -fsSL "https://registry.npmjs.org/@blocksuite/icons/-/icons-${ICONS_VER}.tgz" \ + | tar -xz --strip-components=1 -C /tmp/np-token-deps/node_modules/@blocksuite/icons + node tokens/extract-tokens.mjs --check --node-modules /tmp/np-token-deps/node_modules + rm -rf /tmp/np-token-deps + - name: Check WebAssembly target run: cargo check --locked -p ui -p playground --target wasm32-unknown-unknown @@ -149,6 +169,7 @@ jobs: --repo "${{ github.repository }}" \ --branch darksky/native-playground \ --workflow native-playground.yml \ + --run-id "${{ github.run_id }}" \ --current artifacts/perf-metrics.json \ --json-out artifacts/perf-verdict.json \ --fail-on-regression >> "$GITHUB_STEP_SUMMARY" diff --git a/blocksuite/native-playground/AGENTS.md b/blocksuite/native-playground/AGENTS.md index cc64cfffb3..a88c32c80b 100644 --- a/blocksuite/native-playground/AGENTS.md +++ b/blocksuite/native-playground/AGENTS.md @@ -24,6 +24,10 @@ This document records the active engineering invariants enforced in CI today alo - **Callsite tracing**: Under the `harness` feature, `InteractiveElement::snapshot(...)` records post-layout bounds, `content_mask`, interactivity, focus, and `#[track_caller]` `file:line` origins into `Window::frame_snapshot()` for `sources_at(x, y)` and `bs-harness audit`. Non-harness release builds compile to no-op stubs. - **Locked builds & rustflags isolation**: `Cargo.lock` is committed and CI runs with `--locked` and `CARGO_ENCODED_RUSTFLAGS=""` (`scripts/check-invariants.sh` verifies fresh `cargo rustc --print link-args` contains zero leaked root NAPI flags). +### Performance guardrail and theme/style oracle +- **`perf/` (`schema.json`, `accepted.json`, `compare-n3.mjs`, `compare-n3.test.mjs`)**: Zero-dependency rolling `N-3` CI comparator with strict schema validation and rerun history anchoring (`--run-id` `created_at` cutoff + pagination). Deterministic byte sizes (`artifacts_bytes.*`) and work counters (non-`_ms` `benchmarks.*`) are hard-gated at strictly `> 10%` (`--fail-on-regression` exits `1`); shared-runner wall-clock timings (`benchmarks.*_ms` at `> 10%`, `ci_wall_ms.*` at `> 10%` and `> 15_000 ms`) are report-only `ADVISORY_SLOWDOWN`. Intentional increases are acknowledged via `{ metric, accepted_value, reason }` ceiling entries in `perf/accepted.json` (with report-only `stale_acceptances` once the rolling baseline catches up). Unmeasured sub-keys are omitted or `null` (never padded with synthetic `0`s) so newly introduced metrics transition through `BOOTSTRAP`. +- **`tokens/` (`extract-tokens.mjs`, `tokens.rs`, `icons.rs`, `fonts.lock`, `extract-style-oracle.spec.ts`, `style-oracle.json`)**: `extract-tokens.mjs` deterministically generates Rust-`Ord`-sorted `tokens.rs`, `icons.rs` (preserving inherited `` and stroke attributes), and `fonts.lock` (SHA-256 font asset manifest + `CommunityCanvasTextFonts` descriptors), with `--check` and `rustc --edition 2024 --test` enforced on every push in CI. `style-oracle.json` is regenerated via Vitest Browser (`extract-style-oracle.spec.ts`, `isolate: false` reusable iframe) whenever BlockSuite styles or themes change (until its browser CI job lands). + ## Planned Contracts (upcoming crates & features) - **`crates/doc` & `bs-relay`**: Pure CRDT document model (`#![forbid(unsafe_code)]`, zero GUI dependencies) built on `y-octo`, preserving 53-bit `clientId` (`1..=2^53 - 1`), complete flavour schema defaults (0 JS writeback updates on initial load), and top-level Awareness `color` alongside `user` and `selectionV2`. @@ -41,4 +45,9 @@ CARGO_ENCODED_RUSTFLAGS="" cargo check -p ui -p playground --target wasm32-unkno CARGO_ENCODED_RUSTFLAGS="" cargo test --workspace CARGO_ENCODED_RUSTFLAGS="" cargo test --workspace --features harness ./scripts/check-invariants.sh +node --test perf/compare-n3.test.mjs +node tokens/extract-tokens.mjs --check +rustc --edition 2024 --test -D warnings tokens/tokens.rs -o /tmp/tokens_test && /tmp/tokens_test +rustc --edition 2024 --test -D warnings tokens/icons.rs -o /tmp/icons_test && /tmp/icons_test +rm -f /tmp/tokens_test /tmp/icons_test ``` diff --git a/blocksuite/native-playground/perf/README.md b/blocksuite/native-playground/perf/README.md new file mode 100644 index 0000000000..3f941d5399 --- /dev/null +++ b/blocksuite/native-playground/perf/README.md @@ -0,0 +1,72 @@ +# Native Playground CI Performance Guardrail + +Zero-dependency `N-3` regression detector for `darksky/native-playground`. + +## Metrics Schema (`schema.json`) + +Every CI run emits `perf-metrics.json` containing: + +- `schema_version`: integer `1`. +- `commit`: full 40-character lowercase Git SHA. +- `timestamp_utc`: ISO-8601 UTC timestamp. +- `ci_wall_ms`: shared-runner wall-clock durations (`lint_and_wasm`, `headless_linux`, `total_critical_path`). +- `artifacts_bytes`: deterministic build output sizes (`web_wasm_raw`, `web_wasm_gzip`, `headless_bin`). +- `benchmarks`: deterministic engine timings (`{ median, p95 }`, with `p95 >= median`) and work counters: + - `doc_1k_edits_ms` + - `room_sync_1k_ops_ms` + - `layout_10k_blocks_cold_ms` + - `layout_single_keystroke_ms` + - `layout_single_keystroke_blocks_relayout` + - `edgeless_1k_pan_zoom_frame_ms` + - `headless_frame_render_ms` + +Individual sub-keys inside `ci_wall_ms`, `artifacts_bytes`, and `benchmarks` are optional (or `null`) when a benchmark or artifact is not yet produced by CI. Never emit synthetic `0` placeholders for unmeasured metrics: omitted or `null` baseline keys transition cleanly through `BOOTSTRAP` when first introduced instead of triggering false `0 -> positive` (`+inf%`) regressions. + +## Regression Gate vs Advisory Timings + +Current commit metrics are compared against the completed push run from **3 distinct prior commits (`N-3`)** strictly older than the commit under test (`--current-created-at` or the commit's earliest push run on the branch). If `N-3` has no valid `perf-metrics.json` artifact, the comparator walks back `N-3 -> N-2 -> N-1` and uses the oldest valid baseline; with 0 valid prior baselines it emits a clean `bootstrap` pass. + +1. **Deterministic hard gate (`artifacts_bytes.*` and non-`_ms` work counters under `benchmarks.*`)**: + - Flagged as `REGRESSED` (`regressed: true`, sets `has_hard_regression: true`) whenever `(current - baseline) / baseline * 100 > 10.0%` (strictly greater than `--threshold-pct`), or when `baseline === 0` and `current > 0`. + - `--fail-on-regression` exits `1` only when `has_hard_regression` is `true`. +2. **Shared-runner wall-clock advisories (`benchmarks.*_ms` and `ci_wall_ms.*`)**: + - `benchmarks.*_ms` exceeding `> 10.0%`, and `ci_wall_ms.*` exceeding both `> 10.0%` and `> 15000` ms (`--ci-wall-min-delta-ms`), are reported as `ADVISORY_SLOWDOWN` (`advisory: true`, `regressed: false`, sets `has_advisory_slowdown: true`). + - Advisory timings are surfaced in the Markdown summary and `advisory_metrics` in `perf-verdict.json` for investigation on pinned hardware without failing shared-runner CI. + +## Regression Acknowledgements (`accepted.json`) + +Intentional increases (for example, adding a new bundled feature that grows `web_wasm_gzip`) are recorded as value-ceiling entries in `perf/accepted.json` (loaded by default, or via `--accepted `): + +```json +[ + { + "metric": "artifacts_bytes.web_wasm_gzip", + "accepted_value": 800000, + "reason": "Bundled new rich-text feature" + } +] +``` + +- When a metric triggers against the rolling baseline and `current <= accepted_value`, the row is marked `ACCEPTED` (`regressed: false`) while still printing `baseline`, `current`, `delta`, and the accepted ceiling. +- If `current > accepted_value`, it is not accepted (`REGRESSED` for deterministic hard-gate metrics, `ADVISORY_SLOWDOWN` for timings). +- Once the rolling `N-3` baseline catches up (`baseline >= accepted_value`), the entry is reported in `stale_acceptances` (strictly report-only; never fails CI) so it can be pruned cleanly. + +## Usage + +```sh +node blocksuite/native-playground/perf/compare-n3.mjs \ + --fetch-github \ + --repo toeverything/AFFiNE \ + --branch darksky/native-playground \ + --workflow native-playground.yml \ + --run-id "$GITHUB_RUN_ID" \ + --current artifacts/perf-metrics.json \ + --json-out artifacts/perf-verdict.json \ + --fail-on-regression +``` + +## Self-Tests + +```sh +node --test blocksuite/native-playground/perf/compare-n3.test.mjs +``` diff --git a/blocksuite/native-playground/perf/accepted.json b/blocksuite/native-playground/perf/accepted.json new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/blocksuite/native-playground/perf/accepted.json @@ -0,0 +1 @@ +[] diff --git a/blocksuite/native-playground/perf/compare-n3.mjs b/blocksuite/native-playground/perf/compare-n3.mjs new file mode 100644 index 0000000000..7bb75b0ab6 --- /dev/null +++ b/blocksuite/native-playground/perf/compare-n3.mjs @@ -0,0 +1,1224 @@ +#!/usr/bin/env node +import { execFileSync } from 'node:child_process'; +import fs from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; +import { fileURLToPath, pathToFileURL } from 'node:url'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + +export const DEFAULT_THRESHOLD_PCT = 10; +export const DEFAULT_CI_WALL_MIN_DELTA_MS = 15_000; +export const DEFAULT_ARTIFACT_NAME = 'perf-metrics'; +export const DEFAULT_ACCEPTED_PATH = path.join(__dirname, 'accepted.json'); + +const SHA40_RE = /^[0-9a-f]{40}$/; +const ISO_UTC_RE = + /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/; + +const ALLOWED_TOP_KEYS = new Set([ + 'schema_version', + 'commit', + 'timestamp_utc', + 'ci_wall_ms', + 'artifacts_bytes', + 'benchmarks', +]); + +const BENCHMARK_TIMING_KEYS = new Set([ + 'doc_1k_edits_ms', + 'room_sync_1k_ops_ms', + 'layout_10k_blocks_cold_ms', + 'layout_single_keystroke_ms', + 'edgeless_1k_pan_zoom_frame_ms', + 'headless_frame_render_ms', +]); + +const BENCHMARK_COUNTER_KEYS = new Set([ + 'layout_single_keystroke_blocks_relayout', +]); + +const ALL_BENCHMARK_KEYS = [ + 'doc_1k_edits_ms', + 'room_sync_1k_ops_ms', + 'layout_10k_blocks_cold_ms', + 'layout_single_keystroke_ms', + 'layout_single_keystroke_blocks_relayout', + 'edgeless_1k_pan_zoom_frame_ms', + 'headless_frame_render_ms', +]; + +const ARTIFACT_SIZE_KEYS = [ + 'web_wasm_raw', + 'web_wasm_gzip', + 'headless_bin', +]; + +const CI_WALL_KEYS = [ + 'lint_and_wasm', + 'headless_linux', + 'total_critical_path', +]; + +const KNOWN_METRIC_KEYS = new Set([ + ...ALL_BENCHMARK_KEYS.map(k => `benchmarks.${k}`), + ...ARTIFACT_SIZE_KEYS.map(k => `artifacts_bytes.${k}`), + ...CI_WALL_KEYS.map(k => `ci_wall_ms.${k}`), +]); + +const INTEGER_METRIC_KEYS = new Set([ + ...ARTIFACT_SIZE_KEYS.map(k => `artifacts_bytes.${k}`), + ...Array.from(BENCHMARK_COUNTER_KEYS, k => `benchmarks.${k}`), +]); + +const ALLOWED_ACCEPTED_KEYS = new Set(['metric', 'accepted_value', 'reason']); + +function isPlainObject(v) { + return v !== null && typeof v === 'object' && !Array.isArray(v); +} + +/** + * Strict zero-dependency validator matching `perf/schema.json`. + * Throws a descriptive Error if any required field is missing, unknown keys + * exist, or numeric/timing invariants are violated. + */ +export function validatePerfMetrics(payload, label = 'perf-metrics') { + if (!isPlainObject(payload)) { + throw new Error(`${label}: expected JSON object`); + } + + for (const key of Object.keys(payload)) { + if (!ALLOWED_TOP_KEYS.has(key)) { + throw new Error(`${label}: unknown top-level key "${key}"`); + } + } + for (const req of ALLOWED_TOP_KEYS) { + if (!(req in payload)) { + throw new Error(`${label}: missing required top-level key "${req}"`); + } + } + + if (payload.schema_version !== 1) { + throw new Error( + `${label}: schema_version must be 1, got ${JSON.stringify(payload.schema_version)}` + ); + } + if (typeof payload.commit !== 'string' || !SHA40_RE.test(payload.commit)) { + throw new Error( + `${label}: commit must be a 40-char lowercase hex SHA, got ${JSON.stringify(payload.commit)}` + ); + } + if ( + typeof payload.timestamp_utc !== 'string' || + !ISO_UTC_RE.test(payload.timestamp_utc) || + Number.isNaN(Date.parse(payload.timestamp_utc)) + ) { + throw new Error( + `${label}: timestamp_utc must be a valid ISO-8601 date-time, got ${JSON.stringify(payload.timestamp_utc)}` + ); + } + + // ci_wall_ms + if (!isPlainObject(payload.ci_wall_ms)) { + throw new Error(`${label}: ci_wall_ms must be an object`); + } + const allowedWall = new Set(CI_WALL_KEYS); + for (const [k, v] of Object.entries(payload.ci_wall_ms)) { + if (!allowedWall.has(k)) { + throw new Error(`${label}: unknown key ci_wall_ms.${k}`); + } + if (v === null) continue; + if (typeof v !== 'number' || !Number.isFinite(v) || v < 0) { + throw new Error(`${label}: ci_wall_ms.${k} must be a non-negative finite number or null`); + } + } + + // artifacts_bytes + if (!isPlainObject(payload.artifacts_bytes)) { + throw new Error(`${label}: artifacts_bytes must be an object`); + } + const allowedArtifacts = new Set(ARTIFACT_SIZE_KEYS); + for (const [k, v] of Object.entries(payload.artifacts_bytes)) { + if (!allowedArtifacts.has(k)) { + throw new Error(`${label}: unknown key artifacts_bytes.${k}`); + } + if (v === null) continue; + if (typeof v !== 'number' || !Number.isInteger(v) || v < 0) { + throw new Error(`${label}: artifacts_bytes.${k} must be a non-negative integer or null`); + } + } + + // benchmarks + if (!isPlainObject(payload.benchmarks)) { + throw new Error(`${label}: benchmarks must be an object`); + } + for (const [k, v] of Object.entries(payload.benchmarks)) { + if (BENCHMARK_TIMING_KEYS.has(k)) { + if (v === null) continue; + if (!isPlainObject(v)) { + throw new Error(`${label}: benchmarks.${k} must be { median, p95 } or null`); + } + const subKeys = Object.keys(v); + for (const sk of subKeys) { + if (sk !== 'median' && sk !== 'p95') { + throw new Error(`${label}: unknown key benchmarks.${k}.${sk}`); + } + } + if ( + typeof v.median !== 'number' || + !Number.isFinite(v.median) || + v.median < 0 + ) { + throw new Error(`${label}: benchmarks.${k}.median must be a non-negative finite number`); + } + if ( + typeof v.p95 !== 'number' || + !Number.isFinite(v.p95) || + v.p95 < 0 + ) { + throw new Error(`${label}: benchmarks.${k}.p95 must be a non-negative finite number`); + } + if (v.p95 < v.median) { + throw new Error( + `${label}: benchmarks.${k}.p95 (${v.p95}) must be >= median (${v.median})` + ); + } + } else if (BENCHMARK_COUNTER_KEYS.has(k)) { + if (v === null) continue; + if (typeof v !== 'number' || !Number.isInteger(v) || v < 0) { + throw new Error(`${label}: benchmarks.${k} must be a non-negative integer or null`); + } + } else { + throw new Error(`${label}: unknown key benchmarks.${k}`); + } + } + + return payload; +} + +/** + * Validate value-ceiling regression acknowledgement entries loaded from `perf/accepted.json`. + */ +export function validateAcceptedEntries(entries, label = 'accepted.json') { + if (!Array.isArray(entries)) { + throw new Error(`${label}: expected a JSON array`); + } + const seenMetrics = new Set(); + return entries.map((entry, idx) => { + if (!isPlainObject(entry)) { + throw new Error(`${label}[${idx}]: expected an object`); + } + for (const k of Object.keys(entry)) { + if (!ALLOWED_ACCEPTED_KEYS.has(k)) { + throw new Error(`${label}[${idx}]: unknown key "${k}"`); + } + } + if (typeof entry.metric !== 'string' || entry.metric.trim() === '') { + throw new Error(`${label}[${idx}].metric must be a non-empty string`); + } + const metric = entry.metric.trim(); + if (!KNOWN_METRIC_KEYS.has(metric)) { + throw new Error(`${label}[${idx}].metric "${metric}" is not a known metric key`); + } + if (seenMetrics.has(metric)) { + throw new Error(`${label}[${idx}]: duplicate metric "${metric}"`); + } + seenMetrics.add(metric); + + if ( + typeof entry.accepted_value !== 'number' || + !Number.isFinite(entry.accepted_value) || + entry.accepted_value < 0 + ) { + throw new Error( + `${label}[${idx}].accepted_value must be a finite number >= 0` + ); + } + if ( + INTEGER_METRIC_KEYS.has(metric) && + !Number.isInteger(entry.accepted_value) + ) { + throw new Error( + `${label}[${idx}].accepted_value must be an integer for ${metric}` + ); + } + + if (typeof entry.reason !== 'string' || entry.reason.trim() === '') { + throw new Error(`${label}[${idx}].reason must be a non-empty string`); + } + return { + metric, + accepted_value: entry.accepted_value, + reason: entry.reason.trim(), + }; + }); +} + +/** + * Extract the comparable scalar value from a benchmark entry. + * Timing entries use `{ median, p95 }`; work counters are plain numbers. + */ +export function extractMetricValue(entry) { + if (typeof entry === 'number' && Number.isFinite(entry)) { + return { value: entry, p95: null }; + } + if ( + entry && + typeof entry === 'object' && + typeof entry.median === 'number' && + Number.isFinite(entry.median) + ) { + return { + value: entry.median, + p95: + typeof entry.p95 === 'number' && Number.isFinite(entry.p95) + ? entry.p95 + : null, + }; + } + return null; +} + +function cmpCodeUnit(a, b) { + return a < b ? -1 : a > b ? 1 : 0; +} + +/** + * Select eligible prior completed push runs strictly older than the commit + * under test, deduplicating reruns by `head_sha`. + * + * `options` may be a commit SHA string (legacy signature) or + * `{ currentCommit, currentCreatedAt }`. + */ +export function selectBaselineRun(runs, options = null) { + const currentCommit = + typeof options === 'string' + ? options.toLowerCase() + : options?.currentCommit + ? String(options.currentCommit).toLowerCase() + : null; + const explicitCreatedAt = + typeof options === 'object' && options?.currentCreatedAt + ? options.currentCreatedAt + : null; + + const validRuns = runs.filter( + run => + run && + run.head_sha && + (!run.status || run.status === 'completed') && + (!run.conclusion || run.conclusion === 'success') + ); + + // Determine strict time/position anchor for reruns of older commits. + let anchorTimeMs = explicitCreatedAt ? Date.parse(explicitCreatedAt) : NaN; + let anchorLastIndex = -1; + + if (currentCommit) { + for (let i = 0; i < validRuns.length; i += 1) { + const run = validRuns[i]; + if (String(run.head_sha).toLowerCase() === currentCommit) { + anchorLastIndex = i; + if (run.created_at) { + const ts = Date.parse(run.created_at); + if (!Number.isNaN(ts)) { + anchorTimeMs = Number.isNaN(anchorTimeMs) + ? ts + : Math.min(anchorTimeMs, ts); + } + } + } + } + } + + const seen = new Set(); + if (currentCommit) { + seen.add(currentCommit); + } + + const distinctPrior = []; + for (let i = 0; i < validRuns.length; i += 1) { + const run = validRuns[i]; + const sha = String(run.head_sha).toLowerCase(); + if (seen.has(sha)) continue; + + // Enforce strict "older than current commit" ordering + if (!Number.isNaN(anchorTimeMs) && run.created_at) { + const ts = Date.parse(run.created_at); + if (!Number.isNaN(ts) && ts >= anchorTimeMs) { + continue; + } + } else if (anchorLastIndex >= 0 && i <= anchorLastIndex) { + continue; + } + + seen.add(sha); + distinctPrior.push(run); + if (distinctPrior.length === 3) break; + } + + if (distinctPrior.length === 0) { + return { + baseline: null, + baselineDepth: 'bootstrap', + eligibleRuns: [], + history: { n1: null, n2: null, n3: null }, + }; + } + + const n1 = distinctPrior[0] ?? null; + const n2 = distinctPrior[1] ?? null; + const n3 = distinctPrior[2] ?? null; + const baseline = n3 ?? n2 ?? n1; + const baselineDepth = n3 ? 'N-3' : n2 ? 'N-2' : 'N-1'; + + return { + baseline, + baselineDepth, + eligibleRuns: distinctPrior, + history: { n1, n2, n3 }, + }; +} + +function roundPct(value) { + if (value === null || !Number.isFinite(value)) return value; + return Math.round(value * 100) / 100; +} + +function exceedsThreshold(curVal, baseVal, { isCiWall, thresholdPct, ciWallMinDeltaMs }) { + const EPS = 1e-9; + const delta = curVal - baseVal; + const deltaPct = + baseVal === 0 + ? curVal > 0 + ? Number.POSITIVE_INFINITY + : 0 + : (delta / baseVal) * 100; + + const pctOver = deltaPct > thresholdPct + EPS; + if (isCiWall) { + return { + delta, + deltaPct, + pctOver, + triggered: pctOver && delta > ciWallMinDeltaMs + EPS, + }; + } + return { + delta, + deltaPct, + pctOver, + triggered: pctOver, + }; +} + +function lookupMetricEntry(payload, category, field) { + if (!payload) return null; + return extractMetricValue(payload[category]?.[field]); +} + +function evaluateSingleMetric({ + key, + category, + field, + unit, + isDeterministicHardGate, + current, + baseline, + n1, + n2, + accepted, + thresholdPct, + ciWallMinDeltaMs, +}) { + const cur = lookupMetricEntry(current, category, field); + const base = lookupMetricEntry(baseline, category, field); + const n1Val = lookupMetricEntry(n1, category, field); + const n2Val = lookupMetricEntry(n2, category, field); + + if (!cur) return null; + + if (!base) { + return { + key, + category, + unit, + deterministic_hard_gate: isDeterministicHardGate, + current: cur.value, + current_p95: cur.p95, + baseline: null, + baseline_p95: null, + n1: n1Val?.value ?? null, + n2: n2Val?.value ?? null, + delta: null, + delta_pct: null, + delta_pct_infinite: false, + regressed: false, + advisory: false, + accepted: null, + stale_acceptance: null, + status: 'BOOTSTRAP', + }; + } + + const isCiWall = category === 'ci_wall_ms'; + const EPS = 1e-9; + const check = exceedsThreshold(cur.value, base.value, { + isCiWall, + thresholdPct, + ciWallMinDeltaMs, + }); + + const match = accepted.find(a => a.metric === key) ?? null; + const staleAcceptance = + match && base.value >= match.accepted_value - EPS + ? { + key, + unit, + baseline: base.value, + current: cur.value, + accepted_value: match.accepted_value, + reason: match.reason, + } + : null; + + let regressed = false; + let advisory = false; + let status = 'PASS'; + let acceptanceInfo = null; + + if (check.triggered) { + if (match && cur.value <= match.accepted_value + EPS) { + status = 'ACCEPTED'; + acceptanceInfo = { + accepted: true, + accepted_value: match.accepted_value, + reason: match.reason, + }; + } else if (isDeterministicHardGate) { + regressed = true; + status = 'REGRESSED'; + } else { + advisory = true; + status = 'ADVISORY_SLOWDOWN'; + } + } else if (isCiWall && check.pctOver) { + status = 'JITTER_IGNORED'; + } else if ( + check.deltaPct <= -thresholdPct + EPS && + (!isCiWall || Math.abs(check.delta) > ciWallMinDeltaMs + EPS) + ) { + status = 'IMPROVED'; + } + + return { + key, + category, + unit, + deterministic_hard_gate: isDeterministicHardGate, + current: cur.value, + current_p95: cur.p95, + baseline: base.value, + baseline_p95: base.p95, + n1: n1Val?.value ?? null, + n2: n2Val?.value ?? null, + delta: Math.round(check.delta * 1000) / 1000, + delta_pct: Number.isFinite(check.deltaPct) + ? roundPct(check.deltaPct) + : null, + delta_pct_infinite: !Number.isFinite(check.deltaPct), + regressed, + advisory, + accepted: acceptanceInfo, + stale_acceptance: staleAcceptance, + status, + }; +} + +/** + * Compare validated current perf-metrics against baseline (N-3 or earliest valid). + */ +export function comparePerfMetrics({ + current, + baseline = null, + n1 = null, + n2 = null, + accepted = [], + baselineDepth = baseline ? 'N-3' : 'bootstrap', + thresholdPct = DEFAULT_THRESHOLD_PCT, + ciWallMinDeltaMs = DEFAULT_CI_WALL_MIN_DELTA_MS, +}) { + validatePerfMetrics(current, 'current'); + if (baseline !== null) validatePerfMetrics(baseline, 'baseline'); + if (n1 !== null) validatePerfMetrics(n1, 'n1'); + if (n2 !== null) validatePerfMetrics(n2, 'n2'); + const validatedAccepted = validateAcceptedEntries(accepted); + + const metrics = []; + + for (const field of ALL_BENCHMARK_KEYS) { + const isTimingMs = field.endsWith('_ms'); + const row = evaluateSingleMetric({ + key: `benchmarks.${field}`, + category: 'benchmarks', + field, + unit: isTimingMs ? 'ms' : 'count', + isDeterministicHardGate: !isTimingMs, + current, + baseline, + n1, + n2, + accepted: validatedAccepted, + thresholdPct, + ciWallMinDeltaMs, + }); + if (row) metrics.push(row); + } + + for (const field of ARTIFACT_SIZE_KEYS) { + const row = evaluateSingleMetric({ + key: `artifacts_bytes.${field}`, + category: 'artifacts_bytes', + field, + unit: 'bytes', + isDeterministicHardGate: true, + current, + baseline, + n1, + n2, + accepted: validatedAccepted, + thresholdPct, + ciWallMinDeltaMs, + }); + if (row) metrics.push(row); + } + + for (const field of CI_WALL_KEYS) { + const row = evaluateSingleMetric({ + key: `ci_wall_ms.${field}`, + category: 'ci_wall_ms', + field, + unit: 'ms', + isDeterministicHardGate: false, + current, + baseline, + n1, + n2, + accepted: validatedAccepted, + thresholdPct, + ciWallMinDeltaMs, + }); + if (row) metrics.push(row); + } + + const mapSummary = m => ({ + key: m.key, + category: m.category, + current: m.current, + baseline: m.baseline, + delta: m.delta, + delta_pct: m.delta_pct, + delta_pct_infinite: Boolean(m.delta_pct_infinite), + }); + + const regressedMetrics = metrics.filter(m => m.regressed).map(mapSummary); + const advisoryMetrics = metrics.filter(m => m.advisory).map(mapSummary); + const acceptedMetrics = metrics + .filter(m => m.status === 'ACCEPTED') + .map(m => ({ + ...mapSummary(m), + unit: m.unit, + accepted_value: m.accepted?.accepted_value ?? null, + reason: m.accepted?.reason ?? null, + })); + const staleAcceptances = metrics + .filter(m => m.stale_acceptance !== null) + .map(m => m.stale_acceptance); + + const hasHardRegression = regressedMetrics.length > 0; + const hasAdvisorySlowdown = advisoryMetrics.length > 0; + + return { + schema_version: 1, + baseline_depth: baseline ? baselineDepth : 'bootstrap', + current_commit: current.commit ?? null, + baseline_commit: baseline?.commit ?? null, + n1_commit: n1?.commit ?? null, + n2_commit: n2?.commit ?? null, + threshold_pct: thresholdPct, + ci_wall_min_delta_ms: ciWallMinDeltaMs, + has_hard_regression: hasHardRegression, + has_advisory_slowdown: hasAdvisorySlowdown, + needs_perf_investigation: hasHardRegression, + regressed_metrics: regressedMetrics, + advisory_metrics: advisoryMetrics, + accepted_metrics: acceptedMetrics, + stale_acceptances: staleAcceptances, + metrics, + }; +} + +function formatValue(value, unit) { + if (value === null || value === undefined) return '—'; + if (unit === 'bytes') { + return `${Math.round(value).toLocaleString('en-US')} B`; + } + if (unit === 'ms') { + return `${Number(value).toFixed(2)} ms`; + } + return String(value); +} + +function formatDeltaPct(metric) { + if (metric.status === 'BOOTSTRAP') return '—'; + if (metric.delta_pct_infinite) return '+inf%'; + if (metric.delta_pct === null) return '—'; + const sign = metric.delta_pct > 0 ? '+' : ''; + return `${sign}${metric.delta_pct.toFixed(2)}%`; +} + +function shortSha(sha) { + return sha ? String(sha).slice(0, 10) : 'none'; +} + +export function renderMarkdownSummary(verdict) { + const lines = []; + const label = verdict.baseline_depth; + const statusBadge = verdict.has_hard_regression + ? 'REGRESSION DETECTED (`has_hard_regression: true`)' + : verdict.baseline_depth === 'bootstrap' + ? 'BOOTSTRAP (no prior baseline)' + : verdict.has_advisory_slowdown + ? 'PASS WITH ADVISORY SLOWDOWN (`has_hard_regression: false`, `has_advisory_slowdown: true`)' + : 'PASS (`has_hard_regression: false`)'; + + lines.push(`## Native Playground Performance Guardrail (${label})`); + lines.push(''); + lines.push(`- **Status**: ${statusBadge}`); + lines.push(`- **Current commit**: \`${shortSha(verdict.current_commit)}\``); + lines.push( + `- **Baseline (${label})**: \`${shortSha(verdict.baseline_commit)}\`` + ); + lines.push( + `- **Hard gate**: deterministic byte sizes & work counters \`> ${verdict.threshold_pct}%\` | **Advisory**: \`benchmarks.*_ms\` \`> ${verdict.threshold_pct}%\`, \`ci_wall_ms\` \`> ${verdict.threshold_pct}%\` AND \`> ${verdict.ci_wall_min_delta_ms} ms\`` + ); + lines.push(''); + + if (verdict.regressed_metrics.length > 0) { + lines.push('### Hard Regressions'); + lines.push(''); + for (const item of verdict.regressed_metrics) { + const pct = item.delta_pct_infinite + ? '+inf%' + : `+${Number(item.delta_pct).toFixed(2)}%`; + lines.push( + `- \`${item.key}\`: ${item.baseline} -> ${item.current} (${pct} vs ${label})` + ); + } + lines.push(''); + } + + if (verdict.advisory_metrics.length > 0) { + lines.push('### Advisory Shared-Runner Slowdowns (Report-Only)'); + lines.push(''); + for (const item of verdict.advisory_metrics) { + const pct = item.delta_pct_infinite + ? '+inf%' + : `+${Number(item.delta_pct).toFixed(2)}%`; + lines.push( + `- \`${item.key}\`: ${item.baseline} -> ${item.current} (${pct} vs ${label})` + ); + } + lines.push(''); + } + + if (verdict.accepted_metrics.length > 0) { + lines.push('### Accepted Changes (`perf/accepted.json`)'); + lines.push(''); + for (const item of verdict.accepted_metrics) { + const pct = item.delta_pct_infinite + ? '+inf%' + : `+${Number(item.delta_pct).toFixed(2)}%`; + lines.push( + `- \`${item.key}\`: ${item.baseline} -> ${item.current} (${pct} vs ${label}, accepted ceiling ${formatValue(item.accepted_value, item.unit)}: ${item.reason})` + ); + } + lines.push(''); + } + + if (verdict.stale_acceptances && verdict.stale_acceptances.length > 0) { + lines.push('### Stale Acceptances (`perf/accepted.json`)'); + lines.push(''); + for (const item of verdict.stale_acceptances) { + lines.push( + `- \`${item.key}\`: baseline ${formatValue(item.baseline, item.unit)} has reached accepted ceiling ${formatValue(item.accepted_value, item.unit)} (safe to prune: ${item.reason})` + ); + } + lines.push(''); + } + + const hasHistory = verdict.metrics.some(m => m.n1 !== null || m.n2 !== null); + const headerCols = [ + 'Metric', + `Baseline (${label})`, + ...(hasHistory ? ['N-2', 'N-1'] : []), + 'Current', + `Delta vs ${label}`, + 'Status', + ]; + lines.push(`| ${headerCols.join(' | ')} |`); + lines.push(`| ${headerCols.map(() => '---').join(' | ')} |`); + + for (const m of verdict.metrics) { + const row = [ + `\`${m.key}\``, + formatValue(m.baseline, m.unit), + ...(hasHistory + ? [formatValue(m.n2, m.unit), formatValue(m.n1, m.unit)] + : []), + formatValue(m.current, m.unit), + formatDeltaPct(m), + m.status, + ]; + lines.push(`| ${row.join(' | ')} |`); + } + + lines.push(''); + return `${lines.join('\n')}`; +} + +function runGhApiJson(endpoint) { + const stdout = execFileSync('gh', ['api', endpoint], { + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'pipe'], + }); + return JSON.parse(stdout); +} + +/** + * Strictly select an entry whose basename is `perf-metrics.json`. + * Never falls back to arbitrary `*.json` files (such as `perf-verdict.json`). + */ +export function selectPerfMetricsZipEntry(entries) { + const normalized = entries + .map(e => String(e).trim()) + .filter(e => e.length > 0 && !e.endsWith('/')) + .map(e => e.replace(/^\.\//, '')); + + const exact = normalized.find(e => e === 'perf-metrics.json'); + if (exact) return exact; + + const nested = normalized + .filter(e => e.endsWith('/perf-metrics.json')) + .sort(cmpCodeUnit); + return nested.length > 0 ? nested[0] : null; +} + +/** + * Extract, parse, and strictly validate `perf-metrics.json` from a zip archive. + */ +export function extractPerfMetricsFromZip(zipPath) { + let selectedEntry = null; + try { + const listing = execFileSync('unzip', ['-Z1', zipPath], { + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'pipe'], + }); + selectedEntry = selectPerfMetricsZipEntry(listing.split(/\r?\n/)); + } catch { + selectedEntry = null; + } + + if (selectedEntry) { + const extracted = execFileSync('unzip', ['-p', zipPath, selectedEntry], { + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'pipe'], + }); + return validatePerfMetrics(JSON.parse(extracted), `${zipPath}:${selectedEntry}`); + } + + // Fallback when `unzip -Z1` is unavailable: try only exact and nested perf-metrics.json + for (const pattern of ['perf-metrics.json', '*/perf-metrics.json']) { + try { + const extracted = execFileSync('unzip', ['-p', zipPath, pattern], { + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'pipe'], + }); + if (extracted.trim().length > 0) { + return validatePerfMetrics(JSON.parse(extracted), `${zipPath}:${pattern}`); + } + } catch { + // try next candidate pattern + } + } + + throw new Error(`No valid perf-metrics.json entry found in zip: ${zipPath}`); +} + +function downloadArtifactMetricsJson(repo, runId, artifactName) { + const artifactsResp = runGhApiJson( + `repos/${repo}/actions/runs/${runId}/artifacts?per_page=100` + ); + const artifact = (artifactsResp.artifacts ?? []).find( + a => !a.expired && a.name === artifactName + ); + if (!artifact) { + return null; + } + + const tmpZip = path.join( + os.tmpdir(), + `np-perf-${runId}-${process.pid}-${Date.now()}.zip` + ); + try { + const zipBytes = execFileSync( + 'gh', + ['api', `repos/${repo}/actions/artifacts/${artifact.id}/zip`], + { maxBuffer: 50 * 1024 * 1024 } + ); + fs.writeFileSync(tmpZip, zipBytes); + return extractPerfMetricsFromZip(tmpZip); + } catch { + return null; + } finally { + fs.rmSync(tmpZip, { force: true }); + } +} + +/** + * Walk eligible prior runs from oldest (`N-3`) down to newest (`N-1`) and + * choose the oldest run whose artifact loader returns a valid perf-metrics + * payload, plus load intermediate `N-1`/`N-2` payloads for trend & acceptance. + */ +export function resolveWindowFromEligibleRuns(eligibleRuns, loadRun) { + const loaded = new Array(eligibleRuns.length).fill(null); + + let baselineIdx = -1; + for (let i = eligibleRuns.length - 1; i >= 0; i -= 1) { + const payload = loadRun(eligibleRuns[i]); + if (payload) { + try { + validatePerfMetrics(payload, `run:${eligibleRuns[i].id ?? i}`); + loaded[i] = payload; + baselineIdx = i; + break; + } catch { + // invalid artifact payload; fall back toward newer commit + } + } + } + + if (baselineIdx === -1) { + return { + baseline: null, + n1: null, + n2: null, + baselineDepth: 'bootstrap', + }; + } + + // Load newer intermediate runs in the window (for N-1 / N-2 trends & accepted.json checks) + for (let i = 0; i < baselineIdx; i += 1) { + const payload = loadRun(eligibleRuns[i]); + if (payload) { + try { + validatePerfMetrics(payload, `run:${eligibleRuns[i].id ?? i}`); + loaded[i] = payload; + } catch { + loaded[i] = null; + } + } + } + + const baseline = loaded[baselineIdx]; + const baselineDepth = `N-${baselineIdx + 1}`; + const n1 = baselineIdx > 0 ? loaded[0] : null; + const n2 = baselineIdx > 1 ? loaded[1] : null; + + return { baseline, n1, n2, baselineDepth }; +} + +function fetchGithubHistory({ + repo, + branch, + workflow, + currentCommit, + currentCreatedAt, + runId, + artifactName, +}) { + const encodedBranch = encodeURIComponent(branch); + const encodedWorkflow = encodeURIComponent(workflow); + + let anchorCreatedAt = currentCreatedAt ?? null; + if (!anchorCreatedAt && runId) { + const runResp = runGhApiJson( + `repos/${repo}/actions/runs/${encodeURIComponent(runId)}` + ); + anchorCreatedAt = runResp.created_at ?? null; + } else if (!anchorCreatedAt && currentCommit) { + try { + const shaRunsResp = runGhApiJson( + `repos/${repo}/actions/workflows/${encodedWorkflow}/runs?branch=${encodedBranch}&event=push&head_sha=${encodeURIComponent( + currentCommit + )}&per_page=10` + ); + const shaRuns = (shaRunsResp.workflow_runs ?? []) + .map(r => r.created_at) + .filter(Boolean) + .sort(cmpCodeUnit); + if (shaRuns.length > 0) { + anchorCreatedAt = shaRuns[0]; + } + } catch { + // best-effort anchor lookup + } + } + + const createdFilter = anchorCreatedAt + ? `&created=${encodeURIComponent(`<=${anchorCreatedAt}`)}` + : ''; + const baseEndpoint = `repos/${repo}/actions/workflows/${encodedWorkflow}/runs?branch=${encodedBranch}&event=push&status=completed&per_page=30${createdFilter}`; + + const collectedRuns = []; + let selection = { eligibleRuns: [] }; + for (let page = 1; page <= 3; page += 1) { + const resp = runGhApiJson(`${baseEndpoint}&page=${page}`); + const pageRuns = resp.workflow_runs ?? []; + collectedRuns.push(...pageRuns); + selection = selectBaselineRun(collectedRuns, { + currentCommit, + currentCreatedAt: anchorCreatedAt, + }); + if (selection.eligibleRuns.length >= 3 || pageRuns.length < 30) { + break; + } + } + + if (selection.eligibleRuns.length === 0) { + return { + baseline: null, + n1: null, + n2: null, + baselineDepth: 'bootstrap', + }; + } + + return resolveWindowFromEligibleRuns(selection.eligibleRuns, run => + downloadArtifactMetricsJson(repo, run.id, artifactName) + ); +} + +export function parseArgs(argv) { + const opts = { + current: null, + currentCreatedAt: null, + runId: null, + baseline: null, + n1: null, + n2: null, + accepted: null, + fetchGithub: false, + repo: null, + branch: null, + workflow: null, + artifactName: DEFAULT_ARTIFACT_NAME, + thresholdPct: DEFAULT_THRESHOLD_PCT, + ciWallMinDeltaMs: DEFAULT_CI_WALL_MIN_DELTA_MS, + markdownOut: null, + jsonOut: null, + failOnRegression: false, + }; + + for (let i = 0; i < argv.length; i += 1) { + const arg = argv[i]; + const next = () => { + if (i + 1 >= argv.length) { + throw new Error(`Missing value for ${arg}`); + } + i += 1; + return argv[i]; + }; + + switch (arg) { + case '--current': + opts.current = next(); + break; + case '--current-created-at': + opts.currentCreatedAt = next(); + break; + case '--run-id': + opts.runId = next(); + break; + case '--baseline': + opts.baseline = next(); + break; + case '--n1': + opts.n1 = next(); + break; + case '--n2': + opts.n2 = next(); + break; + case '--accepted': + opts.accepted = next(); + break; + case '--fetch-github': + opts.fetchGithub = true; + break; + case '--repo': + opts.repo = next(); + break; + case '--branch': + opts.branch = next(); + break; + case '--workflow': + opts.workflow = next(); + break; + case '--artifact-name': + opts.artifactName = next(); + break; + case '--threshold-pct': + opts.thresholdPct = Number(next()); + break; + case '--ci-wall-min-delta-ms': + opts.ciWallMinDeltaMs = Number(next()); + break; + case '--markdown-out': + opts.markdownOut = next(); + break; + case '--json-out': + opts.jsonOut = next(); + break; + case '--fail-on-regression': + opts.failOnRegression = true; + break; + case '--help': + case '-h': + opts.help = true; + break; + default: + throw new Error(`Unknown argument: ${arg}`); + } + } + + return opts; +} + +function readJsonFile(filePath) { + return JSON.parse(fs.readFileSync(filePath, 'utf8')); +} + +export function main(argv = process.argv.slice(2)) { + const opts = parseArgs(argv); + if (opts.help) { + console.log( + 'Usage: compare-n3.mjs --current [--current-created-at ] [--baseline | --fetch-github --repo --branch --workflow ] [--n1 ] [--n2 ] [--accepted ] [--threshold-pct 10] [--ci-wall-min-delta-ms 15000] [--markdown-out ] [--json-out ] [--fail-on-regression]' + ); + return 0; + } + + if (!opts.current) { + throw new Error('--current is required'); + } + if (!Number.isFinite(opts.thresholdPct) || opts.thresholdPct < 0) { + throw new Error('--threshold-pct must be a non-negative number'); + } + if (!Number.isFinite(opts.ciWallMinDeltaMs) || opts.ciWallMinDeltaMs < 0) { + throw new Error('--ci-wall-min-delta-ms must be a non-negative number'); + } + + const current = validatePerfMetrics(readJsonFile(opts.current), opts.current); + let baseline = null; + let n1 = opts.n1 ? validatePerfMetrics(readJsonFile(opts.n1), opts.n1) : null; + let n2 = opts.n2 ? validatePerfMetrics(readJsonFile(opts.n2), opts.n2) : null; + let baselineDepth = 'N-3'; + + let accepted = []; + if (opts.accepted) { + accepted = validateAcceptedEntries(readJsonFile(opts.accepted), opts.accepted); + } else if (fs.existsSync(DEFAULT_ACCEPTED_PATH)) { + accepted = validateAcceptedEntries( + readJsonFile(DEFAULT_ACCEPTED_PATH), + DEFAULT_ACCEPTED_PATH + ); + } + + if (opts.fetchGithub) { + if (!opts.repo || !opts.branch || !opts.workflow) { + throw new Error( + '--fetch-github requires --repo, --branch, and --workflow' + ); + } + const fetched = fetchGithubHistory({ + repo: opts.repo, + branch: opts.branch, + workflow: opts.workflow, + currentCommit: current.commit ?? null, + currentCreatedAt: opts.currentCreatedAt, + runId: opts.runId, + artifactName: opts.artifactName, + }); + baseline = fetched.baseline; + n1 = n1 ?? fetched.n1; + n2 = n2 ?? fetched.n2; + baselineDepth = fetched.baselineDepth; + } else if (opts.baseline) { + baseline = validatePerfMetrics(readJsonFile(opts.baseline), opts.baseline); + baselineDepth = 'N-3'; + } else { + baselineDepth = 'bootstrap'; + } + + const verdict = comparePerfMetrics({ + current, + baseline, + n1, + n2, + accepted, + baselineDepth, + thresholdPct: opts.thresholdPct, + ciWallMinDeltaMs: opts.ciWallMinDeltaMs, + }); + + const markdown = renderMarkdownSummary(verdict); + + if (opts.markdownOut) { + fs.mkdirSync(path.dirname(path.resolve(opts.markdownOut)), { + recursive: true, + }); + fs.writeFileSync(opts.markdownOut, markdown, 'utf8'); + } + + if (opts.jsonOut) { + fs.mkdirSync(path.dirname(path.resolve(opts.jsonOut)), { + recursive: true, + }); + fs.writeFileSync( + opts.jsonOut, + `${JSON.stringify(verdict, null, 2)}\n`, + 'utf8' + ); + } + + if (!opts.markdownOut) { + process.stdout.write(markdown); + } + + if (opts.failOnRegression && verdict.has_hard_regression) { + return 1; + } + return 0; +} + +if ( + process.argv[1] && + import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href +) { + try { + const code = main(process.argv.slice(2)); + process.exitCode = code; + } catch (error) { + console.error(error instanceof Error ? error.message : String(error)); + process.exitCode = 2; + } +} diff --git a/blocksuite/native-playground/perf/compare-n3.test.mjs b/blocksuite/native-playground/perf/compare-n3.test.mjs new file mode 100644 index 0000000000..10b235c2d9 --- /dev/null +++ b/blocksuite/native-playground/perf/compare-n3.test.mjs @@ -0,0 +1,718 @@ +import assert from 'node:assert/strict'; +import { execFileSync } from 'node:child_process'; +import fs from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; +import test from 'node:test'; +import { fileURLToPath } from 'node:url'; + +import { + comparePerfMetrics, + extractPerfMetricsFromZip, + renderMarkdownSummary, + resolveWindowFromEligibleRuns, + selectBaselineRun, + selectPerfMetricsZipEntry, + validateAcceptedEntries, + validatePerfMetrics, +} from './compare-n3.mjs'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const CLI_PATH = path.join(__dirname, 'compare-n3.mjs'); + +function makeMetrics(commit, overrides = {}) { + return { + schema_version: 1, + commit, + timestamp_utc: '2026-11-21T18:00:00Z', + ci_wall_ms: { + lint_and_wasm: 40_000, + headless_linux: 60_000, + total_critical_path: 80_000, + ...(overrides.ci_wall_ms ?? {}), + }, + artifacts_bytes: { + web_wasm_raw: 2_000_000, + web_wasm_gzip: 700_000, + headless_bin: 15_000_000, + ...(overrides.artifacts_bytes ?? {}), + }, + benchmarks: { + doc_1k_edits_ms: { median: 10.0, p95: 12.0 }, + room_sync_1k_ops_ms: { median: 20.0, p95: 25.0 }, + layout_10k_blocks_cold_ms: { median: 100.0, p95: 112.0 }, + layout_single_keystroke_ms: { median: 0.5, p95: 0.8 }, + layout_single_keystroke_blocks_relayout: 1, + edgeless_1k_pan_zoom_frame_ms: { median: 4.0, p95: 5.0 }, + headless_frame_render_ms: { median: 8.0, p95: 9.5 }, + ...(overrides.benchmarks ?? {}), + }, + }; +} + +function crc32(buf) { + let crc = 0xffffffff; + for (let i = 0; i < buf.length; i += 1) { + crc ^= buf[i]; + for (let j = 0; j < 8; j += 1) { + crc = (crc >>> 1) ^ (crc & 1 ? 0xedb88320 : 0); + } + } + return (crc ^ 0xffffffff) >>> 0; +} + +function buildStoredZip(files) { + const localParts = []; + const centralParts = []; + let offset = 0; + + for (const [name, content] of files) { + const nameBuf = Buffer.from(name, 'utf8'); + const dataBuf = Buffer.from(content, 'utf8'); + const checksum = crc32(dataBuf); + + const local = Buffer.alloc(30); + local.writeUInt32LE(0x04034b50, 0); + local.writeUInt16LE(20, 4); + local.writeUInt16LE(0, 6); + local.writeUInt16LE(0, 8); + local.writeUInt16LE(0, 10); + local.writeUInt16LE(0, 12); + local.writeUInt32LE(checksum, 14); + local.writeUInt32LE(dataBuf.length, 18); + local.writeUInt32LE(dataBuf.length, 22); + local.writeUInt16LE(nameBuf.length, 26); + local.writeUInt16LE(0, 28); + localParts.push(local, nameBuf, dataBuf); + + const central = Buffer.alloc(46); + central.writeUInt32LE(0x02014b50, 0); + central.writeUInt16LE(20, 4); + central.writeUInt16LE(20, 6); + central.writeUInt16LE(0, 8); + central.writeUInt16LE(0, 10); + central.writeUInt16LE(0, 12); + central.writeUInt16LE(0, 14); + central.writeUInt32LE(checksum, 16); + central.writeUInt32LE(dataBuf.length, 20); + central.writeUInt32LE(dataBuf.length, 24); + central.writeUInt16LE(nameBuf.length, 28); + central.writeUInt16LE(0, 30); + central.writeUInt16LE(0, 32); + central.writeUInt16LE(0, 34); + central.writeUInt16LE(0, 36); + central.writeUInt32LE(0, 38); + central.writeUInt32LE(offset, 42); + centralParts.push(central, nameBuf); + + offset += local.length + nameBuf.length + dataBuf.length; + } + + const centralSize = centralParts.reduce((acc, b) => acc + b.length, 0); + const eocd = Buffer.alloc(22); + eocd.writeUInt32LE(0x06054b50, 0); + eocd.writeUInt16LE(0, 4); + eocd.writeUInt16LE(0, 6); + eocd.writeUInt16LE(files.length, 8); + eocd.writeUInt16LE(files.length, 10); + eocd.writeUInt32LE(centralSize, 12); + eocd.writeUInt32LE(offset, 16); + eocd.writeUInt16LE(0, 20); + + return Buffer.concat([...localParts, ...centralParts, eocd]); +} + +test('validatePerfMetrics rejects empty objects, verdict files, unknown keys, and p95 < median', () => { + assert.throws(() => validatePerfMetrics({}), /missing required/); + assert.throws( + () => + validatePerfMetrics({ + schema_version: 1, + has_hard_regression: false, + }), + /unknown top-level key/ + ); + assert.throws( + () => + validatePerfMetrics({ + ...makeMetrics('1'.repeat(40)), + extra_field: 42, + }), + /unknown top-level key/ + ); + assert.throws( + () => + validatePerfMetrics( + makeMetrics('1'.repeat(40), { + benchmarks: { doc_1k_edits_ms: { median: 15.0, p95: 10.0 } }, + }) + ), + /p95 .* must be >= median/ + ); + assert.throws( + () => + validatePerfMetrics({ + ...makeMetrics('1'.repeat(40)), + commit: 'not-a-sha', + }), + /40-char lowercase hex SHA/ + ); +}); + +test('selectBaselineRun handles bootstrap, rerun deduplication, and strict older anchoring', () => { + const s = n => String(n).repeat(40); + const runs = [ + { id: 7, head_sha: s(7), status: 'completed', conclusion: 'success', created_at: '2026-11-21T07:00:00Z' }, + { id: 6, head_sha: s(6), status: 'completed', conclusion: 'success', created_at: '2026-11-21T06:00:00Z' }, + { id: 5, head_sha: s(5), status: 'completed', conclusion: 'success', created_at: '2026-11-21T05:00:00Z' }, + { id: 4, head_sha: s(4), status: 'completed', conclusion: 'success', created_at: '2026-11-21T04:00:00Z' }, + { id: 3, head_sha: s(3), status: 'completed', conclusion: 'success', created_at: '2026-11-21T03:00:00Z' }, + { id: 2, head_sha: s(2), status: 'completed', conclusion: 'success', created_at: '2026-11-21T02:00:00Z' }, + { id: 1, head_sha: s(1), status: 'completed', conclusion: 'success', created_at: '2026-11-21T01:00:00Z' }, + ]; + + // Rerun of commit #4 in [7..1] must consider only [3, 2, 1] and select #1 + const rerun4 = selectBaselineRun(runs, { currentCommit: s(4) }); + assert.equal(rerun4.baseline?.id, 1); + assert.equal(rerun4.baselineDepth, 'N-3'); + assert.deepEqual( + rerun4.eligibleRuns.map(r => r.id), + [3, 2, 1] + ); + + // When SHA #4 is outside the page, --current-created-at still anchors strictly older runs + const pageWithout4 = runs.filter(r => r.id !== 4); + const anchoredByTime = selectBaselineRun(pageWithout4, { + currentCommit: s(4), + currentCreatedAt: '2026-11-21T04:00:00Z', + }); + assert.equal(anchoredByTime.baseline?.id, 1); + assert.deepEqual( + anchoredByTime.eligibleRuns.map(r => r.id), + [3, 2, 1] + ); + + // Bootstrap with 0 prior runs + const empty = selectBaselineRun([], { currentCommit: s(1) }); + assert.equal(empty.baseline, null); + assert.equal(empty.baselineDepth, 'bootstrap'); +}); + +test('resolveWindowFromEligibleRuns falls back from missing N-3 artifact to N-2', () => { + const s = n => String(n).repeat(40); + const eligible = [ + { id: 30, head_sha: s(3) }, // N-1 + { id: 20, head_sha: s(2) }, // N-2 + { id: 10, head_sha: s(1) }, // N-3 (missing artifact!) + ]; + const payloads = new Map([ + [30, makeMetrics(s(3))], + [20, makeMetrics(s(2))], + [10, null], + ]); + + const resolved = resolveWindowFromEligibleRuns(eligible, r => + payloads.get(r.id) + ); + assert.equal(resolved.baselineDepth, 'N-2'); + assert.equal(resolved.baseline?.commit, s(2)); + assert.equal(resolved.n1?.commit, s(3)); + assert.equal(resolved.n2, null); +}); + +test('selectPerfMetricsZipEntry rejects verdict-only zips and never falls back to arbitrary json', () => { + assert.equal( + selectPerfMetricsZipEntry(['perf-verdict.json', 'linux-run1.json']), + null + ); + assert.equal( + selectPerfMetricsZipEntry([ + 'linux-run1.json', + 'artifacts/perf-metrics.json', + 'perf-verdict.json', + ]), + 'artifacts/perf-metrics.json' + ); + assert.equal( + selectPerfMetricsZipEntry([ + 'artifacts/perf-metrics.json', + 'perf-metrics.json', + ]), + 'perf-metrics.json' + ); + + const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'np-perf-zip-')); + try { + const verdictOnlyZip = path.join(dir, 'verdict-only.zip'); + fs.writeFileSync( + verdictOnlyZip, + buildStoredZip([['perf-verdict.json', JSON.stringify({ has_hard_regression: false })]]) + ); + assert.throws(() => extractPerfMetricsFromZip(verdictOnlyZip), /No valid perf-metrics\.json/); + + const validNestedZip = path.join(dir, 'nested.zip'); + const expected = makeMetrics('9'.repeat(40)); + fs.writeFileSync( + validNestedZip, + buildStoredZip([ + ['perf-verdict.json', JSON.stringify({ noise: true })], + ['artifacts/perf-metrics.json', JSON.stringify(expected)], + ]) + ); + const parsed = extractPerfMetricsFromZip(validNestedZip); + assert.equal(parsed.commit, expected.commit); + } finally { + fs.rmSync(dir, { recursive: true, force: true }); + } +}); + +test('deterministic hard gate vs advisory shared-runner timings and --fail-on-regression exit codes', () => { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'np-perf-advisory-')); + try { + const basePath = path.join(dir, 'base.json'); + const timingOnlyPath = path.join(dir, 'timing-only.json'); + const bytesRegPath = path.join(dir, 'bytes-reg.json'); + const jsonOut = path.join(dir, 'verdict.json'); + + fs.writeFileSync(basePath, JSON.stringify(makeMetrics('1'.repeat(40)))); + // Only *_ms timings slowed down (>10%) -> ADVISORY_SLOWDOWN, must exit 0 under --fail-on-regression + fs.writeFileSync( + timingOnlyPath, + JSON.stringify( + makeMetrics('2'.repeat(40), { + ci_wall_ms: { + lint_and_wasm: 40_000, + headless_linux: 60_000, + total_critical_path: 100_000, // +25% and +20s -> ADVISORY_SLOWDOWN + }, + benchmarks: { + doc_1k_edits_ms: { median: 15.0, p95: 18.0 }, // +50% -> ADVISORY_SLOWDOWN + }, + }) + ) + ); + // Deterministic byte size grew +12% -> REGRESSED, must exit 1 under --fail-on-regression + fs.writeFileSync( + bytesRegPath, + JSON.stringify( + makeMetrics('3'.repeat(40), { + artifacts_bytes: { + web_wasm_raw: 2_000_000, + web_wasm_gzip: 784_000, // +12% -> REGRESSED + headless_bin: 15_000_000, + }, + }) + ) + ); + + const advStdout = execFileSync( + process.execPath, + [ + CLI_PATH, + '--current', + timingOnlyPath, + '--baseline', + basePath, + '--json-out', + jsonOut, + '--fail-on-regression', + ], + { encoding: 'utf8' } + ); + assert.match(advStdout, /ADVISORY_SLOWDOWN/); + const advVerdict = JSON.parse(fs.readFileSync(jsonOut, 'utf8')); + assert.equal(advVerdict.has_hard_regression, false); + assert.equal(advVerdict.has_advisory_slowdown, true); + assert.equal(advVerdict.needs_perf_investigation, false); + assert.deepEqual( + advVerdict.advisory_metrics.map(m => m.key).sort(), + ['benchmarks.doc_1k_edits_ms', 'ci_wall_ms.total_critical_path'] + ); + + let exitCode = 0; + let regStdout = ''; + try { + execFileSync( + process.execPath, + [ + CLI_PATH, + '--current', + bytesRegPath, + '--baseline', + basePath, + '--json-out', + jsonOut, + '--fail-on-regression', + ], + { encoding: 'utf8' } + ); + } catch (err) { + exitCode = err.status; + regStdout = String(err.stdout ?? ''); + } + assert.equal(exitCode, 1); + assert.match(regStdout, /REGRESSION DETECTED/); + const regVerdict = JSON.parse(fs.readFileSync(jsonOut, 'utf8')); + assert.equal(regVerdict.has_hard_regression, true); + assert.equal(regVerdict.regressed_metrics[0].key, 'artifacts_bytes.web_wasm_gzip'); + } finally { + fs.rmSync(dir, { recursive: true, force: true }); + } +}); + +test('perf/accepted.json value-ceiling accepts <= ceiling, rejects > ceiling, and reports stale_acceptances without failing CI', () => { + // Validation rejects unknown keys, unknown metrics, duplicate metrics, and non-integer ceilings on integer metrics + assert.throws( + () => + validateAcceptedEntries([ + { + metric: 'artifacts_bytes.web_wasm_gzip', + accepted_value: 125, + reason: 'ok', + commit: '1'.repeat(40), + }, + ]), + /unknown key/ + ); + assert.throws( + () => + validateAcceptedEntries([ + { metric: 'artifacts_bytes.not_a_metric', accepted_value: 125, reason: 'ok' }, + ]), + /not a known metric key/ + ); + assert.throws( + () => + validateAcceptedEntries([ + { metric: 'artifacts_bytes.web_wasm_gzip', accepted_value: 125, reason: 'a' }, + { metric: 'artifacts_bytes.web_wasm_gzip', accepted_value: 130, reason: 'b' }, + ]), + /duplicate metric/ + ); + assert.throws( + () => + validateAcceptedEntries([ + { metric: 'artifacts_bytes.web_wasm_gzip', accepted_value: 125.5, reason: 'float' }, + ]), + /must be an integer/ + ); + + const s = n => String(n).repeat(40); + const runs = [ + { id: 4, head_sha: s(4), status: 'completed', conclusion: 'success', created_at: '2026-11-21T04:00:00Z' }, + { id: 3, head_sha: s(3), status: 'completed', conclusion: 'success', created_at: '2026-11-21T03:00:00Z' }, + { id: 2, head_sha: s(2), status: 'completed', conclusion: 'success', created_at: '2026-11-21T02:00:00Z' }, + { id: 1, head_sha: s(1), status: 'completed', conclusion: 'success', created_at: '2026-11-21T01:00:00Z' }, + ]; + const sel = selectBaselineRun(runs, { currentCommit: s(4) }); + assert.equal(sel.baseline?.head_sha, s(1)); + + const baseline100 = makeMetrics(s(1), { + artifacts_bytes: { + web_wasm_raw: 2_000_000, + web_wasm_gzip: 100, + headless_bin: 15_000_000, + }, + }); + const accepted = [ + { + metric: 'artifacts_bytes.web_wasm_gzip', + accepted_value: 125, + reason: 'Added rich-text shaping tables', + }, + ]; + + // current = 125 (within ceiling 125) -> ACCEPTED, no hard regression, no stale acceptances + const cur125 = makeMetrics(s(4), { + artifacts_bytes: { + web_wasm_raw: 2_000_000, + web_wasm_gzip: 125, + headless_bin: 15_000_000, + }, + }); + const vAccepted = comparePerfMetrics({ + current: cur125, + baseline: baseline100, + accepted, + }); + assert.equal(vAccepted.has_hard_regression, false); + assert.equal(vAccepted.stale_acceptances.length, 0); + const accRow = vAccepted.metrics.find(m => m.key === 'artifacts_bytes.web_wasm_gzip'); + assert.equal(accRow?.status, 'ACCEPTED'); + assert.equal(accRow?.baseline, 100); + assert.equal(accRow?.current, 125); + assert.match(renderMarkdownSummary(vAccepted), /accepted ceiling 125 B/); + + // current = 138 (above ceiling 125) -> REGRESSED + const cur138 = makeMetrics(s(4), { + artifacts_bytes: { + web_wasm_raw: 2_000_000, + web_wasm_gzip: 138, + headless_bin: 15_000_000, + }, + }); + const vReg = comparePerfMetrics({ + current: cur138, + baseline: baseline100, + accepted, + }); + assert.equal(vReg.has_hard_regression, true); + assert.equal( + vReg.metrics.find(m => m.key === 'artifacts_bytes.web_wasm_gzip')?.status, + 'REGRESSED' + ); + + // Baseline catches up to 125, current = 125 -> PASS + stale_acceptances reported, CLI exits 0 + const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'np-perf-stale-')); + try { + const basePath = path.join(dir, 'base125.json'); + const curPath = path.join(dir, 'cur125.json'); + const accPath = path.join(dir, 'accepted.json'); + const jsonOut = path.join(dir, 'verdict.json'); + + fs.writeFileSync( + basePath, + JSON.stringify( + makeMetrics(s(1), { + artifacts_bytes: { + web_wasm_raw: 2_000_000, + web_wasm_gzip: 125, + headless_bin: 15_000_000, + }, + }) + ) + ); + fs.writeFileSync(curPath, JSON.stringify(cur125)); + fs.writeFileSync(accPath, JSON.stringify(accepted)); + + const stdout = execFileSync( + process.execPath, + [ + CLI_PATH, + '--current', + curPath, + '--baseline', + basePath, + '--accepted', + accPath, + '--json-out', + jsonOut, + '--fail-on-regression', + ], + { encoding: 'utf8' } + ); + assert.match(stdout, /### Stale Acceptances/); + const verdict = JSON.parse(fs.readFileSync(jsonOut, 'utf8')); + assert.equal(verdict.has_hard_regression, false); + assert.equal(verdict.stale_acceptances.length, 1); + assert.equal(verdict.stale_acceptances[0].key, 'artifacts_bytes.web_wasm_gzip'); + assert.equal( + verdict.metrics.find(m => m.key === 'artifacts_bytes.web_wasm_gzip')?.status, + 'PASS' + ); + } finally { + fs.rmSync(dir, { recursive: true, force: true }); + } +}); + +test('CLI --fetch-github --run-id uses immutable created_at cutoff and paginates across pages to locate N-3', () => { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'np-perf-gh-')); + try { + const binDir = path.join(dir, 'bin'); + fs.mkdirSync(binDir, { recursive: true }); + const logPath = path.join(dir, 'gh-calls.log'); + const zip1Path = path.join(dir, 'run-1.zip'); + const zip2Path = path.join(dir, 'run-2.zip'); + const zip3Path = path.join(dir, 'run-3.zip'); + const curPath = path.join(dir, 'current.json'); + const jsonOut = path.join(dir, 'verdict.json'); + + const s = n => String(n).repeat(40); + fs.writeFileSync(curPath, JSON.stringify(makeMetrics(s(4)))); + fs.writeFileSync( + zip1Path, + buildStoredZip([['perf-metrics.json', JSON.stringify(makeMetrics(s(1)))]]) + ); + fs.writeFileSync( + zip2Path, + buildStoredZip([['perf-metrics.json', JSON.stringify(makeMetrics(s(2)))]]) + ); + fs.writeFileSync( + zip3Path, + buildStoredZip([['perf-metrics.json', JSON.stringify(makeMetrics(s(3)))]]) + ); + + // Fake `gh` script that logs every `gh api ` call and serves paginated runs + const fakeGhPath = path.join(binDir, 'gh'); + const fakeGhSource = `#!/usr/bin/env node +const fs = require('node:fs'); +const endpoint = process.argv[3] || ''; +fs.appendFileSync(${JSON.stringify(logPath)}, endpoint + '\\n'); + +const s = n => String(n).repeat(40); + +if (endpoint === 'repos/toeverything/AFFiNE/actions/runs/400') { + process.stdout.write(JSON.stringify({ + id: 400, + head_sha: s(4), + created_at: '2026-11-21T04:00:00Z', + })); + process.exit(0); +} + +if (endpoint.startsWith('repos/toeverything/AFFiNE/actions/workflows/native-playground.yml/runs?')) { + if (endpoint.includes('page=1')) { + // 30 runs containing reruns of sha(4), sha(3), sha(2) -> only 2 distinct prior SHAs, forcing page=2! + const page1 = []; + for (let i = 0; i < 10; i += 1) { + page1.push({ id: 400 - i, head_sha: s(4), status: 'completed', conclusion: 'success', created_at: '2026-11-21T04:00:00Z' }); + } + for (let i = 0; i < 10; i += 1) { + page1.push({ id: 300 - i, head_sha: s(3), status: 'completed', conclusion: 'success', created_at: '2026-11-21T03:00:00Z' }); + } + for (let i = 0; i < 10; i += 1) { + page1.push({ id: 200 - i, head_sha: s(2), status: 'completed', conclusion: 'success', created_at: '2026-11-21T02:00:00Z' }); + } + process.stdout.write(JSON.stringify({ workflow_runs: page1 })); + process.exit(0); + } + if (endpoint.includes('page=2')) { + process.stdout.write(JSON.stringify({ + workflow_runs: [ + { id: 1, head_sha: s(1), status: 'completed', conclusion: 'success', created_at: '2026-11-21T01:00:00Z' }, + ], + })); + process.exit(0); + } +} + +if (endpoint === 'repos/toeverything/AFFiNE/actions/runs/1/artifacts?per_page=100') { + process.stdout.write(JSON.stringify({ artifacts: [{ id: 1001, name: 'perf-metrics', expired: false }] })); + process.exit(0); +} +if (endpoint === 'repos/toeverything/AFFiNE/actions/runs/200/artifacts?per_page=100') { + process.stdout.write(JSON.stringify({ artifacts: [{ id: 1002, name: 'perf-metrics', expired: false }] })); + process.exit(0); +} +if (endpoint === 'repos/toeverything/AFFiNE/actions/runs/300/artifacts?per_page=100') { + process.stdout.write(JSON.stringify({ artifacts: [{ id: 1003, name: 'perf-metrics', expired: false }] })); + process.exit(0); +} + +if (endpoint === 'repos/toeverything/AFFiNE/actions/artifacts/1001/zip') { + process.stdout.write(fs.readFileSync(${JSON.stringify(zip1Path)})); + process.exit(0); +} +if (endpoint === 'repos/toeverything/AFFiNE/actions/artifacts/1002/zip') { + process.stdout.write(fs.readFileSync(${JSON.stringify(zip2Path)})); + process.exit(0); +} +if (endpoint === 'repos/toeverything/AFFiNE/actions/artifacts/1003/zip') { + process.stdout.write(fs.readFileSync(${JSON.stringify(zip3Path)})); + process.exit(0); +} + +console.error('Unexpected gh api endpoint:', endpoint); +process.exit(1); +`; + fs.writeFileSync(fakeGhPath, fakeGhSource, { mode: 0o755 }); + + const stdout = execFileSync( + process.execPath, + [ + CLI_PATH, + '--fetch-github', + '--repo', + 'toeverything/AFFiNE', + '--branch', + 'darksky/native-playground', + '--workflow', + 'native-playground.yml', + '--run-id', + '400', + '--current', + curPath, + '--json-out', + jsonOut, + '--fail-on-regression', + ], + { + encoding: 'utf8', + env: { ...process.env, PATH: `${binDir}:${process.env.PATH}` }, + } + ); + + assert.match(stdout, /## Native Playground Performance Guardrail \(N-3\)/); + const verdict = JSON.parse(fs.readFileSync(jsonOut, 'utf8')); + assert.equal(verdict.baseline_depth, 'N-3'); + assert.equal(verdict.baseline_commit, s(1)); + assert.equal(verdict.n2_commit, s(2)); + assert.equal(verdict.n1_commit, s(3)); + assert.equal(verdict.has_hard_regression, false); + + const calls = fs.readFileSync(logPath, 'utf8').trim().split('\n'); + assert.ok( + calls.some(c => c === 'repos/toeverything/AFFiNE/actions/runs/400'), + 'must query run 400 for immutable created_at' + ); + assert.ok( + calls.some( + c => + c.includes('created=%3C%3D2026-11-21T04%3A00%3A00Z') && + c.includes('page=1') + ), + 'must filter by created<=anchor on page=1' + ); + assert.ok( + calls.some( + c => + c.includes('created=%3C%3D2026-11-21T04%3A00%3A00Z') && + c.includes('page=2') + ), + 'must paginate to page=2 when page=1 has < 3 distinct prior SHAs' + ); + } finally { + fs.rmSync(dir, { recursive: true, force: true }); + } +}); + +test('partial-metrics baseline to expanded-metrics current yields BOOTSTRAP on newly introduced keys', () => { + const baseline = { + schema_version: 1, + commit: '1'.repeat(40), + timestamp_utc: '2026-11-21T18:00:00Z', + ci_wall_ms: { headless_linux: 50_000, lint_and_wasm: null }, + artifacts_bytes: { headless_bin: 14_000_000 }, + benchmarks: { + headless_frame_render_ms: { median: 8.0, p95: 9.5 }, + doc_1k_edits_ms: null, + }, + }; + const current = { + schema_version: 1, + commit: '2'.repeat(40), + timestamp_utc: '2026-11-21T19:00:00Z', + ci_wall_ms: { + headless_linux: 52_000, + lint_and_wasm: 35_000, + total_critical_path: 52_000, + }, + artifacts_bytes: { + headless_bin: 14_500_000, + web_wasm_raw: 1_800_000, + web_wasm_gzip: 620_000, + }, + benchmarks: { + headless_frame_render_ms: { median: 8.4, p95: 9.8 }, + doc_1k_edits_ms: { median: 10.2, p95: 12.1 }, + room_sync_1k_ops_ms: { median: 18.5, p95: 22.0 }, + }, + }; + + const verdict = comparePerfMetrics({ current, baseline }); + assert.equal(verdict.has_hard_regression, false); + const byKey = new Map(verdict.metrics.map(m => [m.key, m])); + assert.equal(byKey.get('benchmarks.headless_frame_render_ms')?.status, 'PASS'); + assert.equal(byKey.get('benchmarks.doc_1k_edits_ms')?.status, 'BOOTSTRAP'); + assert.equal(byKey.get('artifacts_bytes.web_wasm_raw')?.status, 'BOOTSTRAP'); +}); diff --git a/blocksuite/native-playground/perf/schema.json b/blocksuite/native-playground/perf/schema.json new file mode 100644 index 0000000000..14a469c64d --- /dev/null +++ b/blocksuite/native-playground/perf/schema.json @@ -0,0 +1,135 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://toeverything.info/schemas/native-playground/perf-metrics.schema.json", + "title": "Native Playground CI Performance Metrics", + "description": "Deterministic benchmark timings, work counters, artifact sizes, and CI wall-clock measurements emitted per commit on darksky/native-playground. Individual sub-keys are optional (or null) when a job or benchmark is not yet active so unmeasured metrics are never padded with synthetic zeros.", + "type": "object", + "additionalProperties": false, + "required": [ + "schema_version", + "commit", + "timestamp_utc", + "ci_wall_ms", + "artifacts_bytes", + "benchmarks" + ], + "properties": { + "schema_version": { + "type": "integer", + "const": 1 + }, + "commit": { + "type": "string", + "pattern": "^[0-9a-f]{40}$", + "description": "Full 40-character lowercase Git commit SHA." + }, + "timestamp_utc": { + "type": "string", + "format": "date-time", + "description": "UTC ISO-8601 timestamp when measurements were recorded." + }, + "ci_wall_ms": { + "type": "object", + "additionalProperties": false, + "properties": { + "lint_and_wasm": { + "type": ["number", "null"], + "minimum": 0 + }, + "headless_linux": { + "type": ["number", "null"], + "minimum": 0 + }, + "total_critical_path": { + "type": ["number", "null"], + "minimum": 0 + } + } + }, + "artifacts_bytes": { + "type": "object", + "additionalProperties": false, + "properties": { + "web_wasm_raw": { + "type": ["integer", "null"], + "minimum": 0 + }, + "web_wasm_gzip": { + "type": ["integer", "null"], + "minimum": 0 + }, + "headless_bin": { + "type": ["integer", "null"], + "minimum": 0 + } + } + }, + "benchmarks": { + "type": "object", + "additionalProperties": false, + "properties": { + "doc_1k_edits_ms": { + "oneOf": [ + { "$ref": "#/$defs/timingSummary" }, + { "type": "null" } + ] + }, + "room_sync_1k_ops_ms": { + "oneOf": [ + { "$ref": "#/$defs/timingSummary" }, + { "type": "null" } + ] + }, + "layout_10k_blocks_cold_ms": { + "oneOf": [ + { "$ref": "#/$defs/timingSummary" }, + { "type": "null" } + ] + }, + "layout_single_keystroke_ms": { + "oneOf": [ + { "$ref": "#/$defs/timingSummary" }, + { "type": "null" } + ] + }, + "layout_single_keystroke_blocks_relayout": { + "type": ["integer", "null"], + "minimum": 0, + "description": "Number of blocks re-laid out during a single keystroke." + }, + "edgeless_1k_pan_zoom_frame_ms": { + "oneOf": [ + { "$ref": "#/$defs/timingSummary" }, + { "type": "null" } + ] + }, + "headless_frame_render_ms": { + "oneOf": [ + { "$ref": "#/$defs/timingSummary" }, + { "type": "null" } + ] + } + } + } + }, + "$defs": { + "timingSummary": { + "type": "object", + "additionalProperties": false, + "required": [ + "median", + "p95" + ], + "properties": { + "median": { + "type": "number", + "minimum": 0 + }, + "p95": { + "type": "number", + "minimum": 0 + } + } + } + } +} diff --git a/blocksuite/native-playground/tokens/extract-style-oracle.spec.ts b/blocksuite/native-playground/tokens/extract-style-oracle.spec.ts new file mode 100644 index 0000000000..e07a81dd7f --- /dev/null +++ b/blocksuite/native-playground/tokens/extract-style-oracle.spec.ts @@ -0,0 +1,869 @@ +import '@toeverything/theme/style.css'; +import '@toeverything/theme/fonts.css'; + +import { AffineSchemas } from '@blocksuite/affine/schemas'; +import { REFERENCE_NODE } from '@blocksuite/affine-shared/consts'; +import { + CommunityCanvasTextFonts, + FontConfigExtension, +} from '@blocksuite/affine/shared/services'; +import type { SurfaceBlockModel } from '@blocksuite/affine/blocks/surface'; +import type { DocMode } from '@blocksuite/affine/model'; +import { Schema, Text } from '@blocksuite/store'; +import { + createAutoIncrementIdGenerator, + TestWorkspace, +} from '@blocksuite/store/test'; +import { TestAffineEditorContainer } from '@blocksuite/integration-test'; +import { effects } from '@blocksuite/integration-test/effects'; +import { getTestStoreManager } from '@blocksuite/integration-test/store'; +import { getTestViewManager } from '@blocksuite/integration-test/view'; +import { describe, expect, test } from 'vitest'; +import { commands } from 'vitest/browser'; + +declare module 'vitest/browser' { + interface BrowserCommands { + writeStyleOracle: (jsonText: string) => Promise; + } +} + +const storeManager = getTestStoreManager(); +const viewManager = getTestViewManager(); +effects(); +const storeExtensions = storeManager.get('store'); + +interface StyleSample { + tag: string; + class_name: string; + rect: { + x: number; + y: number; + width: number; + height: number; + }; + computed: { + display: string; + box_sizing: string; + color: string; + background_color: string; + border_top_color: string; + border_top_width: string; + border_radius: string; + box_shadow: string; + font_family: string; + font_size: string; + font_weight: string; + font_style: string; + line_height: string; + letter_spacing: string; + text_decoration_line: string; + padding_top: string; + padding_right: string; + padding_bottom: string; + padding_left: string; + margin_top: string; + margin_right: string; + margin_bottom: string; + margin_left: string; + transition_property: string; + transition_duration: string; + transition_timing_function: string; + }; + baseline_offset_px: number | null; +} + +interface PseudoStyleSample { + content: string; + position: string; + width: string; + height: string; + left: string; + top: string; + margin_top: string; + margin_bottom: string; + background_color: string; + border_radius: string; +} + +interface ThemeOracle { + theme: 'light' | 'dark'; + viewport: { width: number; height: number }; + root_css_vars: Record; + page_blocks: Record; + quote_accent_bar: PseudoStyleSample | null; + inline_formats: Record; + edgeless_blocks: Record; + edgeless_surface_models: Record>; + transitions: Record< + string, + { property: string; duration: string; timing_function: string } + >; +} + +const ROOT_CSS_VARS = [ + '--affine-theme-mode', + '--affine-font-family', + '--affine-font-code-family', + '--affine-font-base', + '--affine-font-sm', + '--affine-font-xs', + '--affine-font-h-1', + '--affine-font-h-2', + '--affine-font-h-3', + '--affine-font-h-4', + '--affine-font-h-5', + '--affine-font-h-6', + '--affine-line-height', + '--affine-editor-width', + '--affine-paragraph-space', + '--affine-popover-radius', + '--affine-text-primary-color', + '--affine-text-secondary-color', + '--affine-background-primary-color', + '--affine-background-code-block', + '--affine-divider-color', + '--affine-quote-color', + '--affine-link-color', + '--affine-edgeless-grid-color', +]; + +function round2(n: number): number { + return Math.round(n * 100) / 100; +} + +const STRUCTURAL_TAGS = new Set([ + 'affine-note', + 'affine-edgeless-note', + 'affine-edgeless-root', + 'edgeless-note-background', + 'affine-divider', + 'hr', + 'affine-image', + 'affine-surface', +]); + +function measureBaselineOffset(el: Element): number | null { + try { + const tag = el.tagName.toLowerCase(); + if (STRUCTURAL_TAGS.has(tag)) return null; + if ( + el.classList.contains('affine-divider-block-container') || + el.classList.contains('affine-bookmark-card') || + el.classList.contains('affine-list-block__todo-prefix') + ) { + return null; + } + + // Find the element's own inline text target without descending into child blocks + const inlineRoot = + el.querySelector(':scope > rich-text .inline-editor, :scope > .affine-list-rich-text-wrapper rich-text .inline-editor') ?? + el; + + const walker = document.createTreeWalker(inlineRoot, NodeFilter.SHOW_TEXT, { + acceptNode(node) { + if (!node.textContent || !node.textContent.trim()) { + return NodeFilter.FILTER_SKIP; + } + const parentBlock = (node.parentElement as HTMLElement | null)?.closest( + '[data-block-id]' + ); + const hostBlock = (el as HTMLElement).closest('[data-block-id]'); + if (parentBlock && hostBlock && parentBlock !== hostBlock) { + return NodeFilter.FILTER_REJECT; + } + return NodeFilter.FILTER_ACCEPT; + }, + }); + + const textNode = walker.nextNode(); + if (!textNode || !textNode.parentNode) return null; + + const marker = document.createElement('span'); + marker.setAttribute('data-oracle-baseline', '1'); + marker.style.cssText = + 'display:inline-block;width:0;height:0;margin:0;border:0;padding:0;vertical-align:baseline;line-height:0;'; + + textNode.parentNode.insertBefore(marker, textNode); + try { + const markerRect = marker.getBoundingClientRect(); + const hostRect = el.getBoundingClientRect(); + if (hostRect.height === 0) return null; + const offset = round2(markerRect.bottom - hostRect.top); + return offset >= 0 ? offset : null; + } finally { + marker.remove(); + } + } catch { + return null; + } +} + +function sampleElement( + el: Element | null, + originRect?: DOMRect +): StyleSample | null { + if (!el) return null; + const cs = window.getComputedStyle(el); + const r = el.getBoundingClientRect(); + const ox = originRect ? originRect.left : 0; + const oy = originRect ? originRect.top : 0; + + return { + tag: el.tagName.toLowerCase(), + class_name: typeof (el as HTMLElement).className === 'string' + ? (el as HTMLElement).className + : '', + rect: { + x: round2(r.left - ox), + y: round2(r.top - oy), + width: round2(r.width), + height: round2(r.height), + }, + computed: { + display: cs.display, + box_sizing: cs.boxSizing, + color: cs.color, + background_color: cs.backgroundColor, + border_top_color: cs.borderTopColor, + border_top_width: cs.borderTopWidth, + border_radius: cs.borderRadius, + box_shadow: cs.boxShadow, + font_family: cs.fontFamily, + font_size: cs.fontSize, + font_weight: cs.fontWeight, + font_style: cs.fontStyle, + line_height: cs.lineHeight, + letter_spacing: cs.letterSpacing, + text_decoration_line: cs.textDecorationLine, + padding_top: cs.paddingTop, + padding_right: cs.paddingRight, + padding_bottom: cs.paddingBottom, + padding_left: cs.paddingLeft, + margin_top: cs.marginTop, + margin_right: cs.marginRight, + margin_bottom: cs.marginBottom, + margin_left: cs.marginLeft, + transition_property: cs.transitionProperty, + transition_duration: cs.transitionDuration, + transition_timing_function: cs.transitionTimingFunction, + }, + baseline_offset_px: measureBaselineOffset(el), + }; +} + +async function flushFrames() { + await new Promise(resolve => + requestAnimationFrame(() => requestAnimationFrame(() => resolve())) + ); +} + +function createCanonicalCollection() { + const schema = new Schema(); + schema.register(AffineSchemas); + const collection = new TestWorkspace({ + id: 'style-oracle-room', + schema, + idGenerator: createAutoIncrementIdGenerator(), + }); + collection.storeExtensions = storeExtensions; + collection.meta.initialize(); + + const linkedDoc = collection.createDoc('doc:linked').getStore(); + linkedDoc.load(() => { + const pId = linkedDoc.addBlock('affine:page', { + title: new Text('Linked Target Page'), + }); + linkedDoc.addBlock('affine:surface', {}, pId); + }); + + const doc = collection.createDoc('doc:oracle').getStore(); + const blockIds: Record = {}; + + doc.load(() => { + const pageId = doc.addBlock('affine:page', { + title: new Text('Canonical Style Oracle Document'), + }); + blockIds.page = pageId; + + const surfaceId = doc.addBlock('affine:surface', {}, pageId); + blockIds.surface = surfaceId; + + const noteId = doc.addBlock( + 'affine:note', + { + xywh: '[0, 0, 800, 600]', + }, + pageId + ); + blockIds.note = noteId; + + // Headings h1..h6 + for (const level of ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const) { + blockIds[level] = doc.addBlock( + 'affine:paragraph', + { + type: level, + text: new Text(`Heading ${level.toUpperCase()} Sample`), + }, + noteId + ); + } + + // Rich inline formatted paragraph + const richText = new Text([ + { insert: 'Plain ' }, + { insert: 'Bold', attributes: { bold: true } }, + { insert: ' ' }, + { insert: 'Italic', attributes: { italic: true } }, + { insert: ' ' }, + { insert: 'Underline', attributes: { underline: true } }, + { insert: ' ' }, + { insert: 'Strike', attributes: { strike: true } }, + { insert: ' ' }, + { insert: 'inlineCode()', attributes: { code: true } }, + { insert: ' ' }, + { + insert: 'AffineLink', + attributes: { link: 'https://affine.pro' }, + }, + { insert: ' ' }, + { + insert: REFERENCE_NODE, + attributes: { + reference: { + type: 'LinkedPage', + pageId: 'doc:linked', + }, + }, + }, + ]); + blockIds.paragraph_rich = doc.addBlock( + 'affine:paragraph', + { + type: 'text', + text: richText, + }, + noteId + ); + + // Quote + blockIds.quote = doc.addBlock( + 'affine:paragraph', + { + type: 'quote', + text: new Text('Quoted block text with vertical accent bar.'), + }, + noteId + ); + + // Lists: bulleted (with nested child), numbered, todo unchecked/checked, toggle (with child) + const bulletedId = doc.addBlock( + 'affine:list', + { + type: 'bulleted', + text: new Text('Bulleted parent item'), + }, + noteId + ); + blockIds.list_bulleted = bulletedId; + blockIds.list_bulleted_nested = doc.addBlock( + 'affine:list', + { + type: 'bulleted', + text: new Text('Nested bulleted child item'), + }, + bulletedId + ); + + blockIds.list_numbered = doc.addBlock( + 'affine:list', + { + type: 'numbered', + text: new Text('Numbered list item'), + }, + noteId + ); + + blockIds.list_todo_unchecked = doc.addBlock( + 'affine:list', + { + type: 'todo', + checked: false, + text: new Text('Todo unchecked item'), + }, + noteId + ); + + blockIds.list_todo_checked = doc.addBlock( + 'affine:list', + { + type: 'todo', + checked: true, + text: new Text('Todo checked item'), + }, + noteId + ); + + const toggleId = doc.addBlock( + 'affine:list', + { + type: 'toggle', + collapsed: false, + text: new Text('Toggle parent item'), + }, + noteId + ); + blockIds.list_toggle = toggleId; + blockIds.list_toggle_child = doc.addBlock( + 'affine:paragraph', + { + type: 'text', + text: new Text('Toggle child paragraph'), + }, + toggleId + ); + + // Code block + blockIds.code = doc.addBlock( + 'affine:code', + { + language: 'rust', + text: new Text('fn main() {\n println!("native-playground");\n}'), + }, + noteId + ); + + // Divider + blockIds.divider = doc.addBlock('affine:divider', {}, noteId); + + // Bookmark + blockIds.bookmark = doc.addBlock( + 'affine:bookmark', + { + url: 'https://affine.pro', + title: 'AFFiNE Workspace', + description: 'Canonical bookmark card for style oracle measurement.', + }, + noteId + ); + + // Edgeless surface elements: shape + connector + const surface = doc.getBlock(surfaceId)?.model as SurfaceBlockModel; + const shapeAId = surface.addElement({ + type: 'shape', + shapeType: 'rect', + xywh: '[900, 80, 180, 100]', + radius: 0.1, + }); + const shapeBId = surface.addElement({ + type: 'shape', + shapeType: 'ellipse', + xywh: '[1160, 80, 160, 100]', + }); + const connectorId = surface.addElement({ + type: 'connector', + mode: 1, + source: { id: shapeAId }, + target: { id: shapeBId }, + }); + blockIds.surface_shape_rect = shapeAId; + blockIds.surface_shape_ellipse = shapeBId; + blockIds.surface_connector = connectorId; + }); + + doc.resetHistory(); + return { collection, doc, blockIds }; +} + +async function mountEditor( + doc: ReturnType['getStore'] extends () => infer R + ? R + : never, + mode: DocMode, + theme: 'light' | 'dark' +) { + document.documentElement.setAttribute('data-theme', theme); + document.body.style.margin = '0'; + document.body.style.width = '1280px'; + document.body.style.height = '800px'; + + const container = document.createElement('div'); + container.style.width = '1280px'; + container.style.height = '800px'; + container.style.overflow = 'auto'; + + const editor = new TestAffineEditorContainer(); + editor.doc = doc; + editor.mode = mode; + editor.pageSpecs = [ + ...viewManager.get('page'), + FontConfigExtension(CommunityCanvasTextFonts), + ]; + editor.edgelessSpecs = [ + ...viewManager.get('edgeless'), + FontConfigExtension(CommunityCanvasTextFonts), + ]; + + container.append(editor); + document.body.append(container); + await editor.updateComplete; + await flushFrames(); + + return { + editor, + cleanup: async () => { + editor.remove(); + container.remove(); + await flushFrames(); + }, + }; +} + +function queryBlockElement( + editor: TestAffineEditorContainer, + blockId: string +): HTMLElement | null { + return ( + (editor.host?.view.getBlock(blockId) as HTMLElement | null) ?? + document.querySelector(`[data-block-id="${blockId}"]`) + ); +} + +async function captureThemeOracle( + theme: 'light' | 'dark' +): Promise<{ oracle: ThemeOracle; pageMs: number; edgelessMs: number }> { + const { doc, blockIds } = createCanonicalCollection(); + + // 1. Page Mode measurement + const tPageStart = performance.now(); + const pageMount = await mountEditor(doc, 'page', theme); + + const rootStyle = window.getComputedStyle(document.documentElement); + const rootCssVars: Record = {}; + for (const name of ROOT_CSS_VARS) { + rootCssVars[name] = rootStyle.getPropertyValue(name).trim(); + } + + const noteEl = queryBlockElement(pageMount.editor, blockIds.note); + const originRect = noteEl?.getBoundingClientRect(); + + const pageBlocks: Record = {}; + pageBlocks.page_title = sampleElement( + document.querySelector('doc-title .inline-editor') ?? + document.querySelector('doc-title'), + originRect + ); + pageBlocks.note = sampleElement(noteEl, originRect); + + for (const key of [ + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'paragraph_rich', + 'quote', + 'list_bulleted', + 'list_bulleted_nested', + 'list_numbered', + 'list_todo_unchecked', + 'list_todo_checked', + 'list_toggle', + 'list_toggle_child', + 'code', + 'divider', + 'bookmark', + ]) { + const blockEl = queryBlockElement(pageMount.editor, blockIds[key]); + const inner = + blockEl?.querySelector( + '.affine-paragraph-rich-text-wrapper, .affine-list-block-container, .affine-code-block-container, .affine-divider-block-container, .affine-bookmark-card' + ) ?? blockEl; + pageBlocks[key] = sampleElement(inner, originRect); + } + + // Sub-element details for quote bar (::after), divider hr, list prefix, code inline-editor + const quoteEl = queryBlockElement(pageMount.editor, blockIds.quote); + const quoteInner = + quoteEl?.querySelector('.affine-paragraph-rich-text-wrapper.quote') ?? + quoteEl?.querySelector('.quote') ?? + null; + let quoteAccentBar: PseudoStyleSample | null = null; + if (quoteInner) { + const afterCs = window.getComputedStyle(quoteInner, '::after'); + quoteAccentBar = { + content: afterCs.content, + position: afterCs.position, + width: afterCs.width, + height: afterCs.height, + left: afterCs.left, + top: afterCs.top, + margin_top: afterCs.marginTop, + margin_bottom: afterCs.marginBottom, + background_color: afterCs.backgroundColor, + border_radius: afterCs.borderRadius, + }; + } + const dividerEl = queryBlockElement(pageMount.editor, blockIds.divider); + pageBlocks.divider_hr = sampleElement( + dividerEl?.querySelector('hr') ?? null, + originRect + ); + const todoEl = queryBlockElement(pageMount.editor, blockIds.list_todo_unchecked); + pageBlocks.list_todo_prefix = sampleElement( + todoEl?.querySelector('.affine-list-block__todo-prefix') ?? null, + originRect + ); + const codeEl = queryBlockElement(pageMount.editor, blockIds.code); + pageBlocks.code_inline_editor = sampleElement( + codeEl?.querySelector('.inline-editor') ?? null, + originRect + ); + + // Inline formatting samples inside rich paragraph (BlockSuite uses ) + const richEl = queryBlockElement(pageMount.editor, blockIds.paragraph_rich); + const findInlineByText = (needle: string): Element | null => { + if (!richEl) return null; + for (const candidate of richEl.querySelectorAll('affine-text > span')) { + if (candidate.textContent?.trim() === needle) { + return candidate; + } + } + return null; + }; + const inlineFormats: Record = { + bold: sampleElement( + richEl?.querySelector('strong') ?? findInlineByText('Bold'), + originRect + ), + italic: sampleElement( + richEl?.querySelector('em') ?? findInlineByText('Italic'), + originRect + ), + underline: sampleElement( + richEl?.querySelector('u') ?? findInlineByText('Underline'), + originRect + ), + strike: sampleElement( + richEl?.querySelector('s') ?? findInlineByText('Strike'), + originRect + ), + inline_code: sampleElement( + richEl?.querySelector('code') ?? findInlineByText('inlineCode()'), + originRect + ), + link: sampleElement( + richEl?.querySelector('affine-link a, a') ?? findInlineByText('AffineLink'), + originRect + ), + reference: sampleElement( + richEl?.querySelector('affine-reference') ?? null, + originRect + ), + }; + + // Capture representative CSS transitions + const transitions: ThemeOracle['transitions'] = {}; + const collectTransition = (name: string, el: Element | null) => { + if (!el) return; + const cs = window.getComputedStyle(el); + transitions[name] = { + property: cs.transitionProperty, + duration: cs.transitionDuration, + timing_function: cs.transitionTimingFunction, + }; + }; + collectTransition('paragraph_container', pageBlocks.paragraph_rich ? richEl?.querySelector('.affine-paragraph-block-container') ?? null : null); + collectTransition('bookmark_card', queryBlockElement(pageMount.editor, blockIds.bookmark)?.querySelector('.affine-bookmark-card') ?? null); + + await pageMount.cleanup(); + const pageMs = round2(performance.now() - tPageStart); + + // 2. Edgeless Mode measurement (same reusable iframe!) + const tEdgelessStart = performance.now(); + const edgelessMount = await mountEditor(doc, 'edgeless', theme); + + const edgelessRoot = document.querySelector('affine-edgeless-root'); + const edgelessOrigin = edgelessRoot?.getBoundingClientRect(); + const edgelessNoteEl = queryBlockElement(edgelessMount.editor, blockIds.note); + const edgelessBlocks: Record = { + edgeless_root: sampleElement(edgelessRoot, edgelessOrigin), + edgeless_note: sampleElement(edgelessNoteEl, edgelessOrigin), + edgeless_note_background: sampleElement( + edgelessNoteEl?.querySelector('edgeless-note-background') ?? null, + edgelessOrigin + ), + }; + + // Capture active editing transition on edgeless note background + const edgelessNoteContainer = edgelessNoteEl?.querySelector( + '.edgeless-note-container, [data-editing]' + ) as HTMLElement | null; + const noteBgInner = + edgelessNoteEl?.querySelector('edgeless-note-background > div') ?? + edgelessNoteEl?.querySelector('edgeless-note-background') ?? + null; + if (edgelessNoteContainer) { + const prevEditing = edgelessNoteContainer.getAttribute('data-editing'); + edgelessNoteContainer.setAttribute('data-editing', 'true'); + collectTransition('edgeless_note_background_editing', noteBgInner); + if (prevEditing === null) { + edgelessNoteContainer.removeAttribute('data-editing'); + } else { + edgelessNoteContainer.setAttribute('data-editing', prevEditing); + } + } + collectTransition('edgeless_note_background', noteBgInner); + + const surface = doc.getBlock(blockIds.surface)?.model as SurfaceBlockModel; + const shapeRect = surface.getElementById(blockIds.surface_shape_rect) as any; + const shapeEllipse = surface.getElementById( + blockIds.surface_shape_ellipse + ) as any; + const connector = surface.getElementById(blockIds.surface_connector) as any; + + const serializePoints = (pts: unknown): number[][] => { + if (!Array.isArray(pts)) return []; + return pts.map(p => { + if (Array.isArray(p) && p.length >= 2) { + return [round2(Number(p[0])), round2(Number(p[1]))]; + } + if (p && typeof p === 'object' && '0' in p && '1' in p) { + return [ + round2(Number((p as Record)[0])), + round2(Number((p as Record)[1])), + ]; + } + return []; + }); + }; + + const edgelessSurfaceModels: ThemeOracle['edgeless_surface_models'] = { + shape_rect: shapeRect + ? { + type: shapeRect.type, + shapeType: shapeRect.shapeType, + xywh: shapeRect.xywh, + fillColor: shapeRect.fillColor, + strokeColor: shapeRect.strokeColor, + strokeWidth: shapeRect.strokeWidth, + radius: shapeRect.radius, + } + : {}, + shape_ellipse: shapeEllipse + ? { + type: shapeEllipse.type, + shapeType: shapeEllipse.shapeType, + xywh: shapeEllipse.xywh, + fillColor: shapeEllipse.fillColor, + strokeColor: shapeEllipse.strokeColor, + strokeWidth: shapeEllipse.strokeWidth, + } + : {}, + connector: connector + ? { + type: connector.type, + mode: connector.mode, + stroke: connector.stroke, + strokeWidth: connector.strokeWidth, + strokeStyle: connector.strokeStyle, + frontEndpointStyle: connector.frontEndpointStyle, + rearEndpointStyle: connector.rearEndpointStyle, + path: serializePoints(connector.path), + absolutePath: serializePoints(connector.absolutePath), + labelXYWH: connector.labelXYWH ?? null, + } + : {}, + }; + + await edgelessMount.cleanup(); + const edgelessMs = round2(performance.now() - tEdgelessStart); + + return { + oracle: { + theme, + viewport: { width: 1280, height: 800 }, + root_css_vars: rootCssVars, + page_blocks: pageBlocks, + quote_accent_bar: quoteAccentBar, + inline_formats: inlineFormats, + edgeless_blocks: edgelessBlocks, + edgeless_surface_models: edgelessSurfaceModels, + transitions, + }, + pageMs, + edgelessMs, + }; +} + +describe('style-oracle extractor', () => { + test('extracts light and dark computed styles in reusable iframe', async () => { + const light = await captureThemeOracle('light'); + const dark = await captureThemeOracle('dark'); + const warmLight = await captureThemeOracle('light'); + + // Measure steady-state in-place scenario swap inside the reusable iframe + const { doc: benchDoc, blockIds: benchIds } = createCanonicalCollection(); + const benchMount = await mountEditor(benchDoc, 'page', 'light'); + const tInPlaceStart = performance.now(); + document.documentElement.setAttribute('data-theme', 'dark'); + const h1El = queryBlockElement(benchMount.editor, benchIds.h1)?.querySelector( + '.affine-paragraph-rich-text-wrapper' + ); + const h1Sample = sampleElement(h1El ?? null); + const inPlaceScenarioMs = round2(performance.now() - tInPlaceStart); + await benchMount.cleanup(); + expect(h1Sample?.computed.font_size).toBe('28px'); + + expect(light.oracle.root_css_vars['--affine-font-base']).toBe('15px'); + expect(light.oracle.root_css_vars['--affine-font-h-1']).toBe('28px'); + expect(light.oracle.page_blocks.h1?.computed.font_size).toBe('28px'); + expect(light.oracle.inline_formats.bold).not.toBeNull(); + expect(light.oracle.inline_formats.italic).not.toBeNull(); + expect(light.oracle.inline_formats.underline).not.toBeNull(); + expect(light.oracle.inline_formats.strike).not.toBeNull(); + expect(light.oracle.inline_formats.inline_code).not.toBeNull(); + expect(light.oracle.inline_formats.link).not.toBeNull(); + expect(light.oracle.inline_formats.reference).not.toBeNull(); + expect(light.oracle.page_blocks.quote).not.toBeNull(); + expect(light.oracle.quote_accent_bar).not.toBeNull(); + expect(light.oracle.quote_accent_bar?.width).toBe('2px'); + expect(light.oracle.page_blocks.code).not.toBeNull(); + expect(light.oracle.page_blocks.divider).not.toBeNull(); + expect(light.oracle.page_blocks.bookmark).not.toBeNull(); + expect( + (light.oracle.edgeless_surface_models.connector?.absolutePath as unknown[]) + ?.length + ).toBeGreaterThan(0); + expect(dark.oracle.root_css_vars['--affine-theme-mode']).toBe('dark'); + expect(dark.oracle.page_blocks.h1?.computed.font_size).toBe('28px'); + expect(dark.oracle.quote_accent_bar?.width).toBe('2px'); + + const timingsMs = { + cold_light_page_ms: light.pageMs, + cold_light_edgeless_ms: light.edgelessMs, + warm_dark_page_ms: dark.pageMs, + warm_dark_edgeless_ms: dark.edgelessMs, + warm_light_page_ms: warmLight.pageMs, + warm_light_edgeless_ms: warmLight.edgelessMs, + in_place_reusable_iframe_scenario_ms: inPlaceScenarioMs, + }; + + const payload = { + schema_version: 1, + viewport: { width: 1280, height: 800 }, + themes: { + light: light.oracle, + dark: dark.oracle, + }, + }; + + const outPath = await commands.writeStyleOracle( + `${JSON.stringify(payload, null, 2)}\n` + ); + console.log( + `STYLE_ORACLE_WRITTEN path=${outPath} timings=${JSON.stringify(timingsMs)}` + ); + }); +}); diff --git a/blocksuite/native-playground/tokens/extract-tokens.mjs b/blocksuite/native-playground/tokens/extract-tokens.mjs new file mode 100644 index 0000000000..07c6c4c0d1 --- /dev/null +++ b/blocksuite/native-playground/tokens/extract-tokens.mjs @@ -0,0 +1,1009 @@ +#!/usr/bin/env node +import crypto from 'node:crypto'; +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + +const CORE_ICONS = [ + // Mode switch + ['PAGE', 'PageIcon'], + ['EDGELESS', 'EdgelessIcon'], + // Headings + ['HEADING_1', 'Heading1Icon'], + ['HEADING_2', 'Heading2Icon'], + ['HEADING_3', 'Heading3Icon'], + ['HEADING_4', 'Heading4Icon'], + ['HEADING_5', 'Heading5Icon'], + ['HEADING_6', 'Heading6Icon'], + // Lists + ['BULLETED_LIST', 'BulletedListIcon'], + ['NUMBERED_LIST', 'NumberedListIcon'], + ['CHECKBOX_UNCHECKED', 'CheckBoxUnIcon'], + ['CHECKBOX_CHECKED_SOLID', 'CheckBoxCheckSolidIcon'], + ['CHECKBOX_CHECKED_LINEAR', 'CheckBoxCheckLinearIcon'], + ['TOGGLE_DOWN', 'ToggleDownIcon'], + ['TOGGLE_RIGHT', 'ToggleRightIcon'], + // Blocks + ['QUOTE', 'QuoteIcon'], + ['DIVIDER', 'DividerIcon'], + ['CODE_BLOCK', 'CodeBlockIcon'], + ['INLINE_CODE', 'CodeIcon'], + // Formatting & actions + ['COPY', 'CopyIcon'], + ['LINK', 'LinkIcon'], + ['LINKED_PAGE', 'LinkedPageIcon'], + ['BOLD', 'BoldIcon'], + ['ITALIC', 'ItalicIcon'], + ['UNDERLINE', 'UnderLineIcon'], + ['STRIKETHROUGH', 'StrikeThroughIcon'], + ['DELETE', 'DeleteIcon'], + ['DRAG_HANDLE', 'DragCursorIcon'], + // Edgeless tools + ['SHAPE', 'ShapeIcon'], + ['SQUARE', 'SquareIcon'], + ['ROUNDED_RECTANGLE', 'RoundedRectangleIcon'], + ['DIAMOND', 'DiamondIcon'], + ['TRIANGLE', 'TriangleIcon'], + ['CONNECTOR_STRAIGHT', 'ConnectorLIcon'], + ['CONNECTOR_ELBOW', 'ConnectorEIcon'], + ['CONNECTOR_CURVE', 'ConnectorCIcon'], + ['BRUSH', 'BrushIcon'], + ['PEN', 'PenIcon'], + ['HAND', 'HandIcon'], + ['SELECT', 'SelectIcon'], + ['NOTE', 'NoteShadowDuotoneIcon'], + ['FRAME', 'FrameIcon'], + ['TEXT', 'TextIcon'], + ['ADD_TEXT', 'AddTextIcon'], + ['ZOOM_IN', 'ZoomUpIcon'], + ['ZOOM_OUT', 'ZoomDownIcon'], + ['PLUS', 'PlusIcon'], + ['MINUS', 'MinusIcon'], +]; + +/** + * Deterministic UTF-8 / code-unit byte-order comparison matching Rust `&str` `Ord`. + */ +function cmpCodeUnit(a, b) { + return a < b ? -1 : a > b ? 1 : 0; +} + +function parseArgs(argv) { + const opts = { + check: false, + outDir: __dirname, + nodeModules: process.env.NP_NODE_MODULES ?? null, + }; + for (let i = 0; i < argv.length; i += 1) { + const arg = argv[i]; + if (arg === '--check') { + opts.check = true; + } else if (arg === '--out-dir') { + opts.outDir = path.resolve(argv[++i]); + } else if (arg === '--node-modules') { + opts.nodeModules = path.resolve(argv[++i]); + } else if (arg === '--help' || arg === '-h') { + console.log( + 'Usage: extract-tokens.mjs [--check] [--out-dir ] [--node-modules ]' + ); + process.exit(0); + } else { + throw new Error(`Unknown argument: ${arg}`); + } + } + return opts; +} + +function findNodeModulesDir(explicitDir) { + if (explicitDir) { + const themeCss = path.join( + explicitDir, + '@toeverything/theme/dist/style.css' + ); + if (!fs.existsSync(themeCss)) { + throw new Error(`Theme stylesheet not found at ${themeCss}`); + } + return explicitDir; + } + + let dir = __dirname; + while (true) { + const candidate = path.join(dir, 'node_modules'); + if ( + fs.existsSync( + path.join(candidate, '@toeverything/theme/dist/style.css') + ) + ) { + return candidate; + } + const parent = path.dirname(dir); + if (parent === dir) break; + dir = parent; + } + + throw new Error( + 'Could not locate node_modules/@toeverything/theme/dist/style.css. Pass --node-modules or set NP_NODE_MODULES.' + ); +} + +/** + * Strip CSS comments and all `@...` at-rules (including nested `@media print { ... }`) + * using balanced brace scanning so screen `:root` and `[data-theme=...]` tokens are + * never overwritten by print or conditional media blocks. + */ +function stripCssAtRules(cssText) { + const noComments = cssText.replace(/\/\*[\s\S]*?\*\//g, ''); + let out = ''; + let i = 0; + const n = noComments.length; + + while (i < n) { + const ch = noComments[i]; + if (ch === '@') { + // Advance to either ';' (statement at-rule) or '{' (block at-rule) + while (i < n && noComments[i] !== ';' && noComments[i] !== '{') { + i += 1; + } + if (i < n && noComments[i] === ';') { + i += 1; + } else if (i < n && noComments[i] === '{') { + let depth = 1; + i += 1; + while (i < n && depth > 0) { + if (noComments[i] === '{') depth += 1; + else if (noComments[i] === '}') depth -= 1; + i += 1; + } + } + continue; + } + out += ch; + i += 1; + } + + return out; +} + +function parseCssCustomProperties(cssText) { + const stripped = stripCssAtRules(cssText); + const root = new Map(); + const light = new Map(); + const dark = new Map(); + + for (const match of stripped.matchAll(/([^{}]+)\{([^{}]+)\}/g)) { + const selector = match[1].trim(); + const body = match[2]; + const target = + selector === ':root' + ? root + : selector === '[data-theme=light]' || + selector === '[data-theme="light"]' + ? light + : selector === '[data-theme=dark]' || + selector === '[data-theme="dark"]' + ? dark + : null; + if (!target) continue; + + for (const decl of body.matchAll(/(--[a-zA-Z0-9_-]+)\s*:\s*([^;]+)/g)) { + target.set(decl[1].trim(), decl[2].trim()); + } + } + + return { root, light, dark }; +} + +function clampByte(n) { + return Math.max(0, Math.min(255, Math.round(n))); +} + +function parseColor(raw) { + const val = raw.trim(); + if (val === 'transparent') { + return { r: 0, g: 0, b: 0, a: 0 }; + } + + if (val.startsWith('#')) { + const hex = val.slice(1); + if (hex.length === 3 && /^[0-9a-fA-F]{3}$/.test(hex)) { + return { + r: parseInt(hex[0] + hex[0], 16), + g: parseInt(hex[1] + hex[1], 16), + b: parseInt(hex[2] + hex[2], 16), + a: 255, + }; + } + if (hex.length === 4 && /^[0-9a-fA-F]{4}$/.test(hex)) { + return { + r: parseInt(hex[0] + hex[0], 16), + g: parseInt(hex[1] + hex[1], 16), + b: parseInt(hex[2] + hex[2], 16), + a: parseInt(hex[3] + hex[3], 16), + }; + } + if (hex.length === 6 && /^[0-9a-fA-F]{6}$/.test(hex)) { + return { + r: parseInt(hex.slice(0, 2), 16), + g: parseInt(hex.slice(2, 4), 16), + b: parseInt(hex.slice(4, 6), 16), + a: 255, + }; + } + if (hex.length === 8 && /^[0-9a-fA-F]{8}$/.test(hex)) { + return { + r: parseInt(hex.slice(0, 2), 16), + g: parseInt(hex.slice(2, 4), 16), + b: parseInt(hex.slice(4, 6), 16), + a: parseInt(hex.slice(6, 8), 16), + }; + } + return null; + } + + const rgbaMatch = val.match( + /^rgba?\(\s*([\d.]+)\s*[,\s]\s*([\d.]+)\s*[,\s]\s*([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/i + ); + if (rgbaMatch) { + const r = clampByte(Number(rgbaMatch[1])); + const g = clampByte(Number(rgbaMatch[2])); + const b = clampByte(Number(rgbaMatch[3])); + let a = 255; + if (rgbaMatch[4] !== undefined) { + if (rgbaMatch[4].endsWith('%')) { + a = clampByte((Number(rgbaMatch[4].slice(0, -1)) / 100) * 255); + } else { + a = clampByte(Number(rgbaMatch[4]) * 255); + } + } + return { r, g, b, a }; + } + + return null; +} + +function requireVar(map, name) { + const value = map.get(name); + if (value === undefined || value.trim() === '') { + throw new Error(`Required CSS custom property missing: ${name}`); + } + return value.trim(); +} + +function parsePxStrict(raw, name) { + const m = raw.trim().match(/^(-?\d+(?:\.\d+)?)px$/i); + if (m) return Number(m[1]); + const num = Number(raw.trim()); + if (Number.isFinite(num)) return num; + throw new Error(`Expected px or numeric value for ${name}, got: ${raw}`); +} + +function requirePx(map, name) { + return parsePxStrict(requireVar(map, name), name); +} + +function formatF32(n) { + const s = Number(n).toString(); + return s.includes('.') ? `${s}_f32` : `${s}.0_f32`; +} + +function rustStr(s) { + return JSON.stringify(String(s)); +} + +function formatRgba(c) { + return `Rgba::new(${c.r}, ${c.g}, ${c.b}, ${c.a})`; +} + +function resolveColorVar(map, name, depth = 0) { + if (depth > 8) return null; + const raw = map.get(name); + if (!raw) return null; + const varRef = raw.match(/^var\(\s*(--[a-zA-Z0-9_-]+)\s*\)$/); + if (varRef) { + return resolveColorVar(map, varRef[1], depth + 1); + } + return parseColor(raw); +} + +function buildThemeSection(mergedMap) { + const colors = []; + const shadows = []; + const notePalette = []; + const shapePalette = []; + const connectorPalette = []; + + const sortedNames = [...mergedMap.keys()].sort(cmpCodeUnit); + for (const name of sortedNames) { + const raw = mergedMap.get(name); + if (/shadow/i.test(name) && !parseColor(raw)) { + shadows.push([name, raw]); + continue; + } + + const color = resolveColorVar(mergedMap, name); + if (color) { + colors.push([name, color]); + if ( + name.startsWith('--affine-note-background-') || + name.startsWith('--affine-v2-edgeless-note-') + ) { + notePalette.push([name, color]); + } + if ( + name.startsWith('--affine-palette-shape-') || + name.startsWith('--affine-v2-edgeless-palette-') + ) { + shapePalette.push([name, color]); + } + if (name.startsWith('--affine-palette-line-')) { + connectorPalette.push([name, color]); + } + } + } + + return { colors, shadows, notePalette, shapePalette, connectorPalette }; +} + +function generateTokensRs(nodeModulesDir) { + const themePkg = JSON.parse( + fs.readFileSync( + path.join(nodeModulesDir, '@toeverything/theme/package.json'), + 'utf8' + ) + ); + const cssText = fs.readFileSync( + path.join(nodeModulesDir, '@toeverything/theme/dist/style.css'), + 'utf8' + ); + const { root, light, dark } = parseCssCustomProperties(cssText); + + const lightMerged = new Map([...root, ...light]); + const darkMerged = new Map([...root, ...dark]); + + const lightData = buildThemeSection(lightMerged); + const darkData = buildThemeSection(darkMerged); + + const radii = [...root.entries()] + .filter(([k]) => /radius/i.test(k)) + .sort(([a], [b]) => cmpCodeUnit(a, b)) + .map(([k, v]) => [k, parsePxStrict(v, k)]); + + const pickColor = (map, key) => { + const c = resolveColorVar(map, key); + if (!c) { + throw new Error(`Required color token missing or unparseable: ${key}`); + } + return c; + }; + + const renderColorSlice = entries => + entries.map(([k, c]) => ` (${rustStr(k)}, ${formatRgba(c)}),`).join('\n'); + + const renderShadowSlice = entries => + entries.map(([k, v]) => ` (${rustStr(k)}, ${rustStr(v)}),`).join('\n'); + + const renderThemeConst = (constName, map, data) => `pub const ${constName}: ThemeTokens = ThemeTokens { + brand: ${formatRgba(pickColor(map, '--affine-brand-color'))}, + primary: ${formatRgba(pickColor(map, '--affine-primary-color'))}, + secondary: ${formatRgba(pickColor(map, '--affine-secondary-color'))}, + text_primary: ${formatRgba(pickColor(map, '--affine-text-primary-color'))}, + text_secondary: ${formatRgba(pickColor(map, '--affine-text-secondary-color'))}, + text_emphasis: ${formatRgba(pickColor(map, '--affine-text-emphasis-color'))}, + text_disable: ${formatRgba(pickColor(map, '--affine-text-disable-color'))}, + background_primary: ${formatRgba(pickColor(map, '--affine-background-primary-color'))}, + background_secondary: ${formatRgba(pickColor(map, '--affine-background-secondary-color'))}, + background_tertiary: ${formatRgba(pickColor(map, '--affine-background-tertiary-color'))}, + background_code_block: ${formatRgba(pickColor(map, '--affine-background-code-block'))}, + background_modal: ${formatRgba(pickColor(map, '--affine-background-modal-color'))}, + background_overlay_panel: ${formatRgba(pickColor(map, '--affine-background-overlay-panel-color'))}, + border: ${formatRgba(pickColor(map, '--affine-border-color'))}, + divider: ${formatRgba(pickColor(map, '--affine-divider-color'))}, + quote: ${formatRgba(pickColor(map, '--affine-quote-color'))}, + link: ${formatRgba(pickColor(map, '--affine-link-color'))}, + icon: ${formatRgba(pickColor(map, '--affine-icon-color'))}, + icon_secondary: ${formatRgba(pickColor(map, '--affine-icon-secondary'))}, + placeholder: ${formatRgba(pickColor(map, '--affine-placeholder-color'))}, + hover: ${formatRgba(pickColor(map, '--affine-hover-color'))}, + edgeless_grid: ${formatRgba(pickColor(map, '--affine-edgeless-grid-color'))}, + colors: &[ +${renderColorSlice(data.colors)} + ], + shadows: &[ +${renderShadowSlice(data.shadows)} + ], + note_palette: &[ +${renderColorSlice(data.notePalette)} + ], + shape_palette: &[ +${renderColorSlice(data.shapePalette)} + ], + connector_palette: &[ +${renderColorSlice(data.connectorPalette)} + ], +};`; + + const lineHeightRaw = requireVar(root, '--affine-line-height'); + const basePx = requirePx(root, '--affine-font-base'); + const lineHeightCalcMatch = lineHeightRaw.match( + /^calc\(\s*1em\s*\+\s*(\d+(?:\.\d+)?)px\s*\)$/i + ); + const resolvedLineHeightPx = lineHeightCalcMatch + ? basePx + Number(lineHeightCalcMatch[1]) + : parsePxStrict(lineHeightRaw, '--affine-line-height'); + + return `// @generated by blocksuite/native-playground/tokens/extract-tokens.mjs +// Source: @toeverything/theme@${themePkg.version} (dist/style.css) +// Do not edit manually; regenerate with extract-tokens.mjs. + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct Rgba { + pub r: u8, + pub g: u8, + pub b: u8, + pub a: u8, +} + +impl Rgba { + pub const TRANSPARENT: Self = Self::new(0, 0, 0, 0); + + pub const fn new(r: u8, g: u8, b: u8, a: u8) -> Self { + Self { r, g, b, a } + } + + pub const fn to_u32(self) -> u32 { + ((self.r as u32) << 24) + | ((self.g as u32) << 16) + | ((self.b as u32) << 8) + | (self.a as u32) + } + + pub fn to_f32(self) -> [f32; 4] { + [ + self.r as f32 / 255.0, + self.g as f32 / 255.0, + self.b as f32 / 255.0, + self.a as f32 / 255.0, + ] + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ThemeMode { + Light, + Dark, +} + +#[derive(Debug, Clone, Copy)] +pub struct TypographyTokens { + pub font_family: &'static str, + pub font_serif_family: &'static str, + pub font_mono_family: &'static str, + pub font_sans_family: &'static str, + pub font_number_family: &'static str, + pub font_code_family: &'static str, + pub font_base_px: f32, + pub font_sm_px: f32, + pub font_xs_px: f32, + pub font_h1_px: f32, + pub font_h2_px: f32, + pub font_h3_px: f32, + pub font_h4_px: f32, + pub font_h5_px: f32, + pub font_h6_px: f32, + pub line_height_css: &'static str, + pub line_height_base_px: f32, + pub editor_width_px: f32, + pub paragraph_space_px: f32, + pub popover_radius_px: f32, + pub radii: &'static [(&'static str, f32)], +} + +pub const TYPOGRAPHY: TypographyTokens = TypographyTokens { + font_family: ${rustStr(requireVar(root, '--affine-font-family'))}, + font_serif_family: ${rustStr(requireVar(root, '--affine-font-serif-family'))}, + font_mono_family: ${rustStr(requireVar(root, '--affine-font-mono-family'))}, + font_sans_family: ${rustStr(requireVar(root, '--affine-font-sans-family'))}, + font_number_family: ${rustStr(requireVar(root, '--affine-font-number-family'))}, + font_code_family: ${rustStr(requireVar(root, '--affine-font-code-family'))}, + font_base_px: ${formatF32(basePx)}, + font_sm_px: ${formatF32(requirePx(root, '--affine-font-sm'))}, + font_xs_px: ${formatF32(requirePx(root, '--affine-font-xs'))}, + font_h1_px: ${formatF32(requirePx(root, '--affine-font-h-1'))}, + font_h2_px: ${formatF32(requirePx(root, '--affine-font-h-2'))}, + font_h3_px: ${formatF32(requirePx(root, '--affine-font-h-3'))}, + font_h4_px: ${formatF32(requirePx(root, '--affine-font-h-4'))}, + font_h5_px: ${formatF32(requirePx(root, '--affine-font-h-5'))}, + font_h6_px: ${formatF32(requirePx(root, '--affine-font-h-6'))}, + line_height_css: ${rustStr(lineHeightRaw)}, + line_height_base_px: ${formatF32(resolvedLineHeightPx)}, + editor_width_px: ${formatF32(requirePx(root, '--affine-editor-width'))}, + paragraph_space_px: ${formatF32(requirePx(root, '--affine-paragraph-space'))}, + popover_radius_px: ${formatF32(requirePx(root, '--affine-popover-radius'))}, + radii: &[ +${radii.map(([k, v]) => ` (${rustStr(k)}, ${formatF32(v)}),`).join('\n')} + ], +}; + +#[derive(Debug, Clone, Copy)] +pub struct ThemeTokens { + pub brand: Rgba, + pub primary: Rgba, + pub secondary: Rgba, + pub text_primary: Rgba, + pub text_secondary: Rgba, + pub text_emphasis: Rgba, + pub text_disable: Rgba, + pub background_primary: Rgba, + pub background_secondary: Rgba, + pub background_tertiary: Rgba, + pub background_code_block: Rgba, + pub background_modal: Rgba, + pub background_overlay_panel: Rgba, + pub border: Rgba, + pub divider: Rgba, + pub quote: Rgba, + pub link: Rgba, + pub icon: Rgba, + pub icon_secondary: Rgba, + pub placeholder: Rgba, + pub hover: Rgba, + pub edgeless_grid: Rgba, + pub colors: &'static [(&'static str, Rgba)], + pub shadows: &'static [(&'static str, &'static str)], + pub note_palette: &'static [(&'static str, Rgba)], + pub shape_palette: &'static [(&'static str, Rgba)], + pub connector_palette: &'static [(&'static str, Rgba)], +} + +impl ThemeTokens { + pub fn color(&self, css_var: &str) -> Option { + self.colors + .binary_search_by_key(&css_var, |(name, _)| *name) + .ok() + .map(|idx| self.colors[idx].1) + } + + pub fn shadow(&self, css_var: &str) -> Option<&'static str> { + self.shadows + .binary_search_by_key(&css_var, |(name, _)| *name) + .ok() + .map(|idx| self.shadows[idx].1) + } +} + +${renderThemeConst('LIGHT_THEME', lightMerged, lightData)} + +${renderThemeConst('DARK_THEME', darkMerged, darkData)} + +pub const fn theme(mode: ThemeMode) -> &'static ThemeTokens { + match mode { + ThemeMode::Light => &LIGHT_THEME, + ThemeMode::Dark => &DARK_THEME, + } +} + +#[cfg(test)] +mod tests { + use super::*; + + fn assert_strictly_sorted(slice: &[(&str, T)], label: &str) { + for pair in slice.windows(2) { + assert!( + pair[0].0 < pair[1].0, + "{label} is not strictly sorted in Rust Ord: {:?} >= {:?}", + pair[0].0, + pair[1].0 + ); + } + } + + #[test] + fn token_tables_are_sorted_and_round_trip() { + assert_strictly_sorted(LIGHT_THEME.colors, "LIGHT_THEME.colors"); + assert_strictly_sorted(DARK_THEME.colors, "DARK_THEME.colors"); + assert_strictly_sorted(LIGHT_THEME.shadows, "LIGHT_THEME.shadows"); + assert_strictly_sorted(DARK_THEME.shadows, "DARK_THEME.shadows"); + assert_strictly_sorted(TYPOGRAPHY.radii, "TYPOGRAPHY.radii"); + + for &(k, v) in LIGHT_THEME.colors { + assert_eq!(LIGHT_THEME.color(k), Some(v), "LIGHT_THEME.color({k})"); + } + for &(k, v) in DARK_THEME.colors { + assert_eq!(DARK_THEME.color(k), Some(v), "DARK_THEME.color({k})"); + } + for &(k, v) in LIGHT_THEME.shadows { + assert_eq!(LIGHT_THEME.shadow(k), Some(v), "LIGHT_THEME.shadow({k})"); + } + for &(k, v) in DARK_THEME.shadows { + assert_eq!(DARK_THEME.shadow(k), Some(v), "DARK_THEME.shadow({k})"); + } + } + + #[test] + fn screen_font_stack_not_overwritten_by_print_media_rule() { + assert!( + TYPOGRAPHY.font_family.contains("apple-system"), + "expected screen font stack to retain apple-system, got: {}", + TYPOGRAPHY.font_family + ); + assert!( + TYPOGRAPHY.font_family.contains("BlinkMacSystemFont"), + "expected screen font stack to retain BlinkMacSystemFont, got: {}", + TYPOGRAPHY.font_family + ); + } +} +`; +} + +function parseSvgAttributes(tagText) { + const attrs = {}; + for (const m of tagText.matchAll( + /([a-zA-Z_:][-a-zA-Z0-9_:.]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/g + )) { + attrs[m[1]] = m[2] ?? m[3] ?? ''; + } + return attrs; +} + +function generateIconsRs(nodeModulesDir) { + const iconsPkg = JSON.parse( + fs.readFileSync( + path.join(nodeModulesDir, '@blocksuite/icons/package.json'), + 'utf8' + ) + ); + const litMjs = fs.readFileSync( + path.join(nodeModulesDir, '@blocksuite/icons/dist/lit.mjs'), + 'utf8' + ); + + const exportBlockMatch = litMjs.match(/export\s*\{([\s\S]*?)\};/); + if (!exportBlockMatch) { + throw new Error( + 'Could not locate export block in @blocksuite/icons/dist/lit.mjs' + ); + } + const exportToLocal = new Map(); + for (const m of exportBlockMatch[1].matchAll(/(\w+)\s+as\s+(\w+)/g)) { + exportToLocal.set(m[2], m[1]); + } + + const localToSvg = new Map(); + for (const m of litMjs.matchAll( + /const\s+(\w+)\s*=\s*\([^)]*\)\s*=>\s*html`([\s\S]*?)`;/g + )) { + localToSvg.set(m[1], m[2]); + } + + const extracted = []; + for (const [rustConstName, exportName] of CORE_ICONS) { + const localName = exportToLocal.get(exportName); + if (!localName) { + throw new Error( + `Icon export not found in @blocksuite/icons: ${exportName}` + ); + } + const svgTemplate = localToSvg.get(localName); + if (!svgTemplate) { + throw new Error( + `Icon template not found for ${exportName} (${localName})` + ); + } + const svgTagMatch = svgTemplate.match(/]*)>/); + const svgAttrs = svgTagMatch ? parseSvgAttributes(svgTagMatch[1]) : {}; + const viewBox = svgAttrs.viewBox ?? '0 0 24 24'; + const inheritedFill = svgAttrs.fill ?? 'currentColor'; + + const paths = []; + for (const pm of svgTemplate.matchAll(/]*)\/?>/g)) { + const attrs = parseSvgAttributes(pm[1]); + if (!attrs.d) continue; + const strokeWidthNum = + attrs['stroke-width'] !== undefined + ? Number(attrs['stroke-width']) + : 0; + paths.push({ + d: attrs.d, + fill_rule: attrs['fill-rule'] ?? 'nonzero', + clip_rule: attrs['clip-rule'] ?? 'nonzero', + fill: attrs.fill ?? inheritedFill, + stroke: attrs.stroke ?? '', + stroke_width: Number.isFinite(strokeWidthNum) ? strokeWidthNum : 0, + stroke_linecap: attrs['stroke-linecap'] ?? '', + stroke_linejoin: attrs['stroke-linejoin'] ?? '', + }); + } + + if (paths.length === 0) { + throw new Error(`No elements found in icon ${exportName}`); + } + + extracted.push({ + rustConstName, + exportName, + viewBox, + paths, + }); + } + + const sortedByExport = [...extracted].sort((a, b) => + cmpCodeUnit(a.exportName, b.exportName) + ); + + const renderIconDef = item => { + const pathLines = item.paths + .map( + p => + ` IconPath { d: ${rustStr(p.d)}, fill_rule: ${rustStr( + p.fill_rule + )}, clip_rule: ${rustStr(p.clip_rule)}, fill: ${rustStr( + p.fill + )}, stroke: ${rustStr(p.stroke)}, stroke_width: ${formatF32( + p.stroke_width + )}, stroke_linecap: ${rustStr( + p.stroke_linecap + )}, stroke_linejoin: ${rustStr(p.stroke_linejoin)} },` + ) + .join('\n'); + return `IconDef { + name: ${rustStr(item.exportName)}, + view_box: ${rustStr(item.viewBox)}, + paths: &[ +${pathLines} + ], +}`; + }; + + const constDefs = extracted + .map( + item => + `pub const ${item.rustConstName}: IconDef = ${renderIconDef(item)};` + ) + .join('\n\n'); + + const tableEntries = sortedByExport + .map(item => ` ${item.rustConstName},`) + .join('\n'); + + return `// @generated by blocksuite/native-playground/tokens/extract-tokens.mjs +// Source: @blocksuite/icons@${iconsPkg.version} (dist/lit.mjs) +// Do not edit manually; regenerate with extract-tokens.mjs. + +#[derive(Debug, Clone, Copy, PartialEq)] +pub struct IconPath { + pub d: &'static str, + pub fill_rule: &'static str, + pub clip_rule: &'static str, + pub fill: &'static str, + pub stroke: &'static str, + pub stroke_width: f32, + pub stroke_linecap: &'static str, + pub stroke_linejoin: &'static str, +} + +#[derive(Debug, Clone, Copy, PartialEq)] +pub struct IconDef { + pub name: &'static str, + pub view_box: &'static str, + pub paths: &'static [IconPath], +} + +${constDefs} + +pub const ALL_ICONS: &[IconDef] = &[ +${tableEntries} +]; + +pub fn icon_by_name(name: &str) -> Option<&'static IconDef> { + ALL_ICONS + .binary_search_by_key(&name, |icon| icon.name) + .ok() + .map(|idx| &ALL_ICONS[idx]) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn icons_are_sorted_in_rust_ord_and_round_trip() { + for pair in ALL_ICONS.windows(2) { + assert!( + pair[0].name < pair[1].name, + "ALL_ICONS not strictly sorted: {:?} >= {:?}", + pair[0].name, + pair[1].name + ); + } + for icon in ALL_ICONS { + assert_eq!(icon_by_name(icon.name), Some(icon)); + } + assert_eq!(icon_by_name("LinkIcon"), Some(&LINK)); + assert_eq!(icon_by_name("LinkedPageIcon"), Some(&LINKED_PAGE)); + } + + #[test] + fn drag_handle_preserves_inherited_fill_none_and_stroke_attributes() { + assert!(!DRAG_HANDLE.paths.is_empty()); + let stroked: Vec<&IconPath> = DRAG_HANDLE + .paths + .iter() + .filter(|p| !p.stroke.is_empty()) + .collect(); + assert!(!stroked.is_empty(), "DRAG_HANDLE must contain stroked paths"); + for path in stroked { + assert_eq!(path.fill, "none"); + assert!((path.stroke_width - 0.5).abs() < 1e-6); + } + } +} +`; +} + +function walkFilesSorted(rootDir) { + const results = []; + const stack = [rootDir]; + while (stack.length > 0) { + const dir = stack.pop(); + const entries = fs.readdirSync(dir, { withFileTypes: true }); + for (const entry of entries) { + const full = path.join(dir, entry.name); + if (entry.isDirectory()) { + stack.push(full); + } else if (entry.isFile()) { + results.push(full); + } + } + } + results.sort(cmpCodeUnit); + return results; +} + +function parseFontFaces(fontsCssText) { + const faces = []; + for (const m of fontsCssText.matchAll(/@font-face\s*\{([\s\S]*?)\}/g)) { + const body = m[1]; + const pick = prop => { + const pm = body.match(new RegExp(`${prop}\\s*:\\s*([^;]+);`, 'i')); + return pm ? pm[1].trim().replace(/^['"]|['"]$/g, '') : null; + }; + const srcMatch = body.match(/src\s*:\s*url\(\s*['"]?([^)'"]+)['"]?\s*\)/i); + faces.push({ + family: pick('font-family'), + style: pick('font-style') ?? 'normal', + weight: pick('font-weight') ?? 'normal', + display: pick('font-display'), + src: srcMatch ? srcMatch[1].trim() : null, + }); + } + return faces; +} + +function parseCommunityCanvasTextFonts(repoRoot) { + const configPath = path.join( + repoRoot, + 'blocksuite/affine/shared/src/services/font-loader/config.ts' + ); + if (!fs.existsSync(configPath)) return []; + + const text = fs.readFileSync(configPath, 'utf8'); + const startIdx = text.indexOf('export const CommunityCanvasTextFonts'); + if (startIdx === -1) return []; + const slice = text.slice(startIdx); + const endIdx = slice.indexOf('];'); + const block = endIdx === -1 ? slice : slice.slice(0, endIdx); + + const descriptors = []; + for (const objMatch of block.matchAll(/\{([\s\S]*?)\}/g)) { + const body = objMatch[1]; + const fontM = body.match(/font\s*:\s*FontFamily\.([A-Za-z0-9_]+)/); + const urlM = body.match(/url\s*:\s*['"]([^'"]+)['"]/); + const weightM = body.match(/weight\s*:\s*FontWeight\.([A-Za-z0-9_]+)/); + const styleM = body.match(/style\s*:\s*FontStyle\.([A-Za-z0-9_]+)/); + if (fontM && urlM) { + descriptors.push({ + font: fontM[1], + url: urlM[1], + weight: weightM ? weightM[1] : 'Regular', + style: styleM ? styleM[1] : 'Normal', + }); + } + } + return descriptors; +} + +function generateFontsLock(nodeModulesDir) { + const themeDir = path.join(nodeModulesDir, '@toeverything/theme'); + const themePkg = JSON.parse( + fs.readFileSync(path.join(themeDir, 'package.json'), 'utf8') + ); + + const fontsDir = fs.existsSync(path.join(themeDir, 'fonts')) + ? path.join(themeDir, 'fonts') + : path.join(themeDir, 'dist/fonts'); + if (!fs.existsSync(fontsDir)) { + throw new Error(`Bundled fonts directory not found under ${themeDir}`); + } + + const allFiles = walkFilesSorted(fontsDir); + const bundledFiles = allFiles.map(fullPath => { + const bytes = fs.readFileSync(fullPath); + const sha256 = crypto.createHash('sha256').update(bytes).digest('hex'); + const relPath = path.relative(themeDir, fullPath).split(path.sep).join('/'); + return { + path: relPath, + bytes: bytes.length, + sha256, + }; + }); + + const fontsCssPath = path.join(fontsDir, 'fonts.css'); + const fontFaces = fs.existsSync(fontsCssPath) + ? parseFontFaces(fs.readFileSync(fontsCssPath, 'utf8')) + : []; + + const repoRoot = path.resolve(__dirname, '../../..'); + const communityCanvasTextFonts = parseCommunityCanvasTextFonts(repoRoot); + + const manifest = { + schema_version: 1, + source_package: `@toeverything/theme@${themePkg.version}`, + bundled_files: bundledFiles, + font_faces: fontFaces, + community_canvas_text_fonts: communityCanvasTextFonts, + }; + + return `${JSON.stringify(manifest, null, 2)}\n`; +} + +function writeOrCheck(filePath, content, checkMode) { + if (checkMode) { + if (!fs.existsSync(filePath)) { + throw new Error(`Missing generated file: ${filePath}`); + } + const existing = fs.readFileSync(filePath, 'utf8'); + if (existing !== content) { + throw new Error(`Generated file is out of date: ${filePath}`); + } + return; + } + fs.mkdirSync(path.dirname(filePath), { recursive: true }); + fs.writeFileSync(filePath, content, 'utf8'); +} + +function main() { + const opts = parseArgs(process.argv.slice(2)); + const nodeModulesDir = findNodeModulesDir(opts.nodeModules); + + const tokensRs = generateTokensRs(nodeModulesDir); + const iconsRs = generateIconsRs(nodeModulesDir); + const fontsLock = generateFontsLock(nodeModulesDir); + + const tokensPath = path.join(opts.outDir, 'tokens.rs'); + const iconsPath = path.join(opts.outDir, 'icons.rs'); + const fontsLockPath = path.join(opts.outDir, 'fonts.lock'); + + writeOrCheck(tokensPath, tokensRs, opts.check); + writeOrCheck(iconsPath, iconsRs, opts.check); + writeOrCheck(fontsLockPath, fontsLock, opts.check); + + if (opts.check) { + console.log( + 'OK: tokens.rs, icons.rs, and fonts.lock match @toeverything/theme and @blocksuite/icons byte-for-byte.' + ); + } else { + console.log( + `Generated ${tokensPath} (${tokensRs.length} bytes), ${iconsPath} (${iconsRs.length} bytes), and ${fontsLockPath} (${fontsLock.length} bytes).` + ); + } +} + +try { + main(); +} catch (error) { + console.error(error instanceof Error ? error.message : String(error)); + process.exitCode = 1; +} diff --git a/blocksuite/native-playground/tokens/fonts.lock b/blocksuite/native-playground/tokens/fonts.lock new file mode 100644 index 0000000000..4d6c25cdf0 --- /dev/null +++ b/blocksuite/native-playground/tokens/fonts.lock @@ -0,0 +1,503 @@ +{ + "schema_version": 1, + "source_package": "@toeverything/theme@1.1.23", + "bundled_files": [ + { + "path": "fonts/fonts.css", + "bytes": 3686, + "sha256": "59f34df6c7a8d0edaf48979d577df03a7f40f1ed897ee63c8b37fcc9e682398f" + }, + { + "path": "fonts/ibm-plex-mono/IBMPlexMono-Bold.ttf", + "bytes": 135932, + "sha256": "d3cfb27531839bf27f9af6ccc75b862535167295080fd4420a71045e532c5caf" + }, + { + "path": "fonts/ibm-plex-mono/IBMPlexMono-BoldItalic.ttf", + "bytes": 142636, + "sha256": "df42ee7647a59b8c77d062671b0db6f740d4d7fb764df268dd658f150174f5b5" + }, + { + "path": "fonts/ibm-plex-mono/IBMPlexMono-Italic.ttf", + "bytes": 142032, + "sha256": "624dfae6fb84fc07ba3bca5901398141909814b9f80dc08e6372b5aa2a451988" + }, + { + "path": "fonts/ibm-plex-mono/IBMPlexMono-Regular.ttf", + "bytes": 133720, + "sha256": "2f1f8d81a8f9c5d931fd3431b9860a9bebecf7d80c43e950f7cabd2261996248" + }, + { + "path": "fonts/ibm-plex-mono/OFL.txt", + "bytes": 4363, + "sha256": "5294ce778857e1eb02e830b6ab06435537d38f43055327e73d03a2d4d57d5123" + }, + { + "path": "fonts/inter/Inter-VariableFont_slnt,wght.ttf", + "bytes": 803384, + "sha256": "b9a8e5e213977665be2a56db66945a16c686da3d9861af1e7851322cf15495ea" + }, + { + "path": "fonts/inter/OFL.txt", + "bytes": 4376, + "sha256": "6e6410f2892d61813f54654098dc9654d0a3af2e92172999bee07eec13b0a75a" + }, + { + "path": "fonts/kalam/Kalam-Bold.ttf", + "bytes": 460872, + "sha256": "f2b5f6595f274a4bb00777fd7cb2958fa837ac7bf266a9c3f7d724ca01013c95" + }, + { + "path": "fonts/kalam/Kalam-Light.ttf", + "bytes": 437488, + "sha256": "49c6264e8e4448e3057896508b01542cf3d43d64a991e31517f85ad90e6b3764" + }, + { + "path": "fonts/kalam/Kalam-Regular.ttf", + "bytes": 427336, + "sha256": "c2a5822e35bd9826735baf8cea549534fd300c979129299d327a155ed9ef667f" + }, + { + "path": "fonts/kalam/OFL.txt", + "bytes": 4373, + "sha256": "f62ef357d3a1c3d27edd35a6e1ba350e8a8d13499797964eeadefbf0b3b15d1f" + }, + { + "path": "fonts/source-code-pro/OFL.txt", + "bytes": 4528, + "sha256": "d1e6d465a83ba1a3be52db6484868cf5812ae9bbf91abdad3900ba0165afcf93" + }, + { + "path": "fonts/source-code-pro/SourceCodePro-Italic-VariableFont_wght.ttf", + "bytes": 162676, + "sha256": "5a32fafb68b4f7e1d05844943e3aeed2429f927dcd232d46bdcaafe2cd2c6f81" + }, + { + "path": "fonts/source-code-pro/SourceCodePro-VariableFont_wght.ttf", + "bytes": 196132, + "sha256": "cf5851d657afbe3db00539a8ad73467784723cac03b189072316d6377dd703f7" + }, + { + "path": "fonts/source-serif-4/OFL.txt", + "bytes": 4302, + "sha256": "e564f06d018e7b95bc3594c96a17f1d41865af4038c375e7aa974dd69df38602" + }, + { + "path": "fonts/source-serif-4/SourceSerif4-Bold.ttf", + "bytes": 329096, + "sha256": "d6270a6dd7aab3d2c37fe21239341155d4e3d4331d0c1890b3123a9d35336a0a" + }, + { + "path": "fonts/source-serif-4/SourceSerif4-BoldItalic.ttf", + "bytes": 207008, + "sha256": "d80aa30b4d431be4cb47bac2eb95728466869558c73a94021388955151f8cda7" + }, + { + "path": "fonts/source-serif-4/SourceSerif4-Italic-VariableFont_opsz,wght.ttf", + "bytes": 842948, + "sha256": "147ee22102614402f6123231ee798b7a1fbffbfc4ebc77eb5cef9250d5aa635c" + }, + { + "path": "fonts/source-serif-4/SourceSerif4-Italic.ttf", + "bytes": 206920, + "sha256": "736297993410d864b62a1e91ed77bdb74ea0f7fb96256509e2bddbb102c7e794" + }, + { + "path": "fonts/source-serif-4/SourceSerif4-Light.ttf", + "bytes": 328768, + "sha256": "a403cf2efd944b8965304d87900ee9817a794be41602503f582337d20c21d90c" + }, + { + "path": "fonts/source-serif-4/SourceSerif4-LightItalic.ttf", + "bytes": 207052, + "sha256": "919995a9172b57f3efe3215e362815d6de0081658b560de31a4bb7d7b02d2406" + }, + { + "path": "fonts/source-serif-4/SourceSerif4-Medium.ttf", + "bytes": 329064, + "sha256": "3b44675606128827044555c58df7006364436194b6af0ee33984044192788edd" + }, + { + "path": "fonts/source-serif-4/SourceSerif4-MediumItalic.ttf", + "bytes": 207092, + "sha256": "c9ad2e2cdc5d0eb56710920d45169a7d784be8b3da6a8857d694ffa6707a72cc" + }, + { + "path": "fonts/source-serif-4/SourceSerif4-Regular.ttf", + "bytes": 328836, + "sha256": "75fd6c6c2e0edd1710a48e0889683e0f4f33d89a15807bbc1be2f1b83f4997c5" + }, + { + "path": "fonts/source-serif-4/SourceSerif4-SemiBold.ttf", + "bytes": 329140, + "sha256": "9dae036528823edad06b8e9727ba1a56acc8cf186827f1997b9b5d49d22beaee" + }, + { + "path": "fonts/source-serif-4/SourceSerif4-SemiBoldItalic.ttf", + "bytes": 207084, + "sha256": "1c37c41e1d6f484bfa82b0319dc2e6c7d7b23a452e3ac9716b3bddefc22aa8e6" + }, + { + "path": "fonts/source-serif-4/SourceSerif4-VariableFont_opsz,wght.ttf", + "bytes": 1195360, + "sha256": "73ebc46873043020c5764481ccbd3b7ac4bcb33e538e538b5f2648c9291612be" + }, + { + "path": "fonts/space-mono/OFL.txt", + "bytes": 4351, + "sha256": "53c21088047f372ecf1fa354a22c34836b188b7305776f3aaab796aff9f130cd" + }, + { + "path": "fonts/space-mono/SpaceMono-Bold.ttf", + "bytes": 86636, + "sha256": "d9cb77aa0a456dc1ddd67780fb980cf66863a8a09c6e6c48e5a8b466a9a6667a" + }, + { + "path": "fonts/space-mono/SpaceMono-BoldItalic.ttf", + "bytes": 95292, + "sha256": "94ee7b8bc663105187fe9a1add1af23d000e2bfa16c5114fddd4500bb43ddee6" + }, + { + "path": "fonts/space-mono/SpaceMono-Italic.ttf", + "bytes": 103524, + "sha256": "d966f87a0f05796cf27b40d72b6203ab7ed994a8f0f6848d2b271086377d6572" + }, + { + "path": "fonts/space-mono/SpaceMono-Regular.ttf", + "bytes": 90904, + "sha256": "74ea804954f6f3e3ed4c748da603547ff2f88b03f614c7ad85231449d33c51be" + } + ], + "font_faces": [ + { + "family": "Inter", + "style": "normal", + "weight": "1 999", + "display": "swap", + "src": "./inter/Inter-VariableFont_slnt,wght.ttf" + }, + { + "family": "Source Code Pro", + "style": "normal", + "weight": "normal", + "display": "swap", + "src": "./source-code-pro/SourceCodePro-VariableFont_wght.ttf" + }, + { + "family": "Source Code Pro", + "style": "italic", + "weight": "normal", + "display": "swap", + "src": "./source-code-pro/SourceCodePro-Italic-VariableFont_wght.ttf" + }, + { + "family": "Kalam", + "style": "normal", + "weight": "400", + "display": "swap", + "src": "./kalam/Kalam-Regular.ttf" + }, + { + "family": "Kalam", + "style": "normal", + "weight": "300", + "display": "swap", + "src": "./kalam/Kalam-Light.ttf" + }, + { + "family": "Kalam", + "style": "normal", + "weight": "700", + "display": "swap", + "src": "./kalam/Kalam-Bold.ttf" + }, + { + "family": "Source Serif 4", + "style": "normal", + "weight": "400", + "display": "swap", + "src": "./source-serif-4/SourceSerif4-Regular.ttf" + }, + { + "family": "Source Serif 4", + "style": "italic", + "weight": "400", + "display": "swap", + "src": "./source-serif-4/SourceSerif4-Italic.ttf" + }, + { + "family": "Source Serif 4", + "style": "normal", + "weight": "500", + "display": "swap", + "src": "./source-serif-4/SourceSerif4-Medium.ttf" + }, + { + "family": "Source Serif 4", + "style": "italic", + "weight": "500", + "display": "swap", + "src": "./source-serif-4/SourceSerif4-MediumItalic.ttf" + }, + { + "family": "Source Serif 4", + "style": "normal", + "weight": "600", + "display": "swap", + "src": "./source-serif-4/SourceSerif4-SemiBold.ttf" + }, + { + "family": "Source Serif 4", + "style": "italic", + "weight": "600", + "display": "swap", + "src": "./source-serif-4/SourceSerif4-SemiBoldItalic.ttf" + }, + { + "family": "Source Serif 4", + "style": "normal", + "weight": "700", + "display": "swap", + "src": "./source-serif-4/SourceSerif4-Bold.ttf" + }, + { + "family": "Source Serif 4", + "style": "italic", + "weight": "700", + "display": "swap", + "src": "./source-serif-4/SourceSerif4-BoldItalic.ttf" + }, + { + "family": "Space Mono", + "style": "normal", + "weight": "400", + "display": "swap", + "src": "./space-mono/SpaceMono-Regular.ttf" + }, + { + "family": "Space Mono", + "style": "italic", + "weight": "400", + "display": "swap", + "src": "./space-mono/SpaceMono-Italic.ttf" + }, + { + "family": "Space Mono", + "style": "normal", + "weight": "700", + "display": "swap", + "src": "./space-mono/SpaceMono-Bold.ttf" + }, + { + "family": "Space Mono", + "style": "italic", + "weight": "700", + "display": "swap", + "src": "./space-mono/SpaceMono-BoldItalic.ttf" + }, + { + "family": "IBM Plex Mono", + "style": "normal", + "weight": "400", + "display": "swap", + "src": "./ibm-plex-mono/IBMPlexMono-Regular.ttf" + }, + { + "family": "IBM Plex Mono", + "style": "italic", + "weight": "400", + "display": "swap", + "src": "./ibm-plex-mono/IBMPlexMono-Italic.ttf" + }, + { + "family": "IBM Plex Mono", + "style": "normal", + "weight": "700", + "display": "swap", + "src": "./ibm-plex-mono/IBMPlexMono-Bold.ttf" + }, + { + "family": "IBM Plex Mono", + "style": "italic", + "weight": "700", + "display": "swap", + "src": "./ibm-plex-mono/IBMPlexMono-BoldItalic.ttf" + } + ], + "community_canvas_text_fonts": [ + { + "font": "Inter", + "url": "https://fonts.cdnfonts.com/s/19795/Inter-Light-BETA.woff", + "weight": "Light", + "style": "Normal" + }, + { + "font": "Inter", + "url": "https://fonts.cdnfonts.com/s/19795/Inter-Regular.woff", + "weight": "Regular", + "style": "Normal" + }, + { + "font": "Inter", + "url": "https://fonts.cdnfonts.com/s/19795/Inter-SemiBold.woff", + "weight": "SemiBold", + "style": "Normal" + }, + { + "font": "Inter", + "url": "https://fonts.cdnfonts.com/s/19795/Inter-LightItalic-BETA.woff", + "weight": "Light", + "style": "Italic" + }, + { + "font": "Inter", + "url": "https://fonts.cdnfonts.com/s/19795/Inter-Italic.woff", + "weight": "Regular", + "style": "Italic" + }, + { + "font": "Inter", + "url": "https://fonts.cdnfonts.com/s/19795/Inter-SemiBoldItalic.woff", + "weight": "SemiBold", + "style": "Italic" + }, + { + "font": "Kalam", + "url": "https://fonts.cdnfonts.com/s/13130/Kalam-Light.woff", + "weight": "Light", + "style": "Normal" + }, + { + "font": "Kalam", + "url": "https://fonts.cdnfonts.com/s/13130/Kalam-Regular.woff", + "weight": "Regular", + "style": "Normal" + }, + { + "font": "Kalam", + "url": "https://fonts.cdnfonts.com/s/13130/Kalam-Bold.woff", + "weight": "SemiBold", + "style": "Normal" + }, + { + "font": "Satoshi", + "url": "https://fonts.cdnfonts.com/s/85546/Satoshi-Light.woff", + "weight": "Light", + "style": "Normal" + }, + { + "font": "Satoshi", + "url": "https://fonts.cdnfonts.com/s/85546/Satoshi-Regular.woff", + "weight": "Regular", + "style": "Normal" + }, + { + "font": "Satoshi", + "url": "https://fonts.cdnfonts.com/s/85546/Satoshi-Bold.woff", + "weight": "SemiBold", + "style": "Normal" + }, + { + "font": "Satoshi", + "url": "https://fonts.cdnfonts.com/s/85546/Satoshi-LightItalic.woff", + "weight": "Light", + "style": "Italic" + }, + { + "font": "Satoshi", + "url": "https://fonts.cdnfonts.com/s/85546/Satoshi-Italic.woff", + "weight": "Regular", + "style": "Italic" + }, + { + "font": "Satoshi", + "url": "https://fonts.cdnfonts.com/s/85546/Satoshi-BoldItalic.woff", + "weight": "SemiBold", + "style": "Italic" + }, + { + "font": "Poppins", + "url": "https://fonts.cdnfonts.com/s/16009/Poppins-Light.woff", + "weight": "Light", + "style": "Normal" + }, + { + "font": "Poppins", + "url": "https://fonts.cdnfonts.com/s/16009/Poppins-Regular.woff", + "weight": "Regular", + "style": "Normal" + }, + { + "font": "Poppins", + "url": "https://fonts.cdnfonts.com/s/16009/Poppins-Medium.woff", + "weight": "Medium", + "style": "Normal" + }, + { + "font": "Poppins", + "url": "https://fonts.cdnfonts.com/s/16009/Poppins-SemiBold.woff", + "weight": "SemiBold", + "style": "Normal" + }, + { + "font": "Poppins", + "url": "https://fonts.cdnfonts.com/s/16009/Poppins-LightItalic.woff", + "weight": "Light", + "style": "Italic" + }, + { + "font": "Poppins", + "url": "https://fonts.cdnfonts.com/s/16009/Poppins-Italic.woff", + "weight": "Regular", + "style": "Italic" + }, + { + "font": "Poppins", + "url": "https://fonts.cdnfonts.com/s/16009/Poppins-SemiBoldItalic.woff", + "weight": "SemiBold", + "style": "Italic" + }, + { + "font": "Lora", + "url": "https://fonts.cdnfonts.com/s/29883/Lora-Regular.woff", + "weight": "Regular", + "style": "Normal" + }, + { + "font": "Lora", + "url": "https://fonts.cdnfonts.com/s/29883/Lora-Bold.woff", + "weight": "SemiBold", + "style": "Normal" + }, + { + "font": "Lora", + "url": "https://fonts.cdnfonts.com/s/29883/Lora-Italic.woff", + "weight": "Regular", + "style": "Italic" + }, + { + "font": "Lora", + "url": "https://fonts.cdnfonts.com/s/29883/Lora-BoldItalic.woff", + "weight": "SemiBold", + "style": "Italic" + }, + { + "font": "BebasNeue", + "url": "https://fonts.cdnfonts.com/s/14902/BebasNeue%20Light.woff", + "weight": "Light", + "style": "Normal" + }, + { + "font": "BebasNeue", + "url": "https://fonts.cdnfonts.com/s/14902/BebasNeue-Regular.woff", + "weight": "Regular", + "style": "Normal" + }, + { + "font": "OrelegaOne", + "url": "https://fonts.cdnfonts.com/s/93179/OrelegaOne-Regular.woff", + "weight": "Regular", + "style": "Normal" + } + ] +} diff --git a/blocksuite/native-playground/tokens/icons.rs b/blocksuite/native-playground/tokens/icons.rs new file mode 100644 index 0000000000..0d9cfea630 --- /dev/null +++ b/blocksuite/native-playground/tokens/icons.rs @@ -0,0 +1,508 @@ +// @generated by blocksuite/native-playground/tokens/extract-tokens.mjs +// Source: @blocksuite/icons@2.2.17 (dist/lit.mjs) +// Do not edit manually; regenerate with extract-tokens.mjs. + +#[derive(Debug, Clone, Copy, PartialEq)] +pub struct IconPath { + pub d: &'static str, + pub fill_rule: &'static str, + pub clip_rule: &'static str, + pub fill: &'static str, + pub stroke: &'static str, + pub stroke_width: f32, + pub stroke_linecap: &'static str, + pub stroke_linejoin: &'static str, +} + +#[derive(Debug, Clone, Copy, PartialEq)] +pub struct IconDef { + pub name: &'static str, + pub view_box: &'static str, + pub paths: &'static [IconPath], +} + +pub const PAGE: IconDef = IconDef { + name: "PageIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M7 3.25A2.75 2.75 0 0 0 4.25 6v12A2.75 2.75 0 0 0 7 20.75h10A2.75 2.75 0 0 0 19.75 18V6A2.75 2.75 0 0 0 17 3.25zM5.75 6c0-.69.56-1.25 1.25-1.25h10c.69 0 1.25.56 1.25 1.25v12c0 .69-.56 1.25-1.25 1.25H7c-.69 0-1.25-.56-1.25-1.25zM9 7.25a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5zm-.75 4.25a.75.75 0 0 1 .75-.75h6a.75.75 0 0 1 0 1.5H9a.75.75 0 0 1-.75-.75M9 14.25a.75.75 0 0 0 0 1.5h5a.75.75 0 0 0 0-1.5z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const EDGELESS: IconDef = IconDef { + name: "EdgelessIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M7.168 4.75a1.868 1.868 0 1 0 0 3.736 1.868 1.868 0 0 0 0-3.736M3.8 6.618a3.368 3.368 0 0 1 6.729-.226c.842 0 1.651.014 2.493.217.933.226 1.865.672 2.975 1.504l.02.015.02.017c1.566 1.35 2.35 3.533 2.354 5.578h1.66a.75.75 0 0 1 .75.75v4.713a.75.75 0 0 1-.75.75h-4.714a.75.75 0 0 1-.75-.75v-4.713a.75.75 0 0 1 .75-.75h1.554c-.004-1.705-.663-3.42-1.815-4.426-.975-.728-1.719-1.064-2.406-1.23-.712-.172-1.407-.175-2.36-.175v-.057a3.38 3.38 0 0 1-2.392 2.068v3.904a3.37 3.37 0 0 1-.75 6.652 3.368 3.368 0 0 1-.75-6.652V9.903A3.37 3.37 0 0 1 3.8 6.618m3.368 8.605a1.868 1.868 0 1 0 0 3.736 1.868 1.868 0 0 0 0-3.736m8.92 3.213v-3.213H19.3v3.213z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const HEADING_1: IconDef = IconDef { + name: "Heading1Icon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M17.926 6.578v10.898c0 .602.33.963.862.963.541 0 .862-.351.862-.963V5.726c0-.682-.451-1.153-1.093-1.153-.39 0-.742.15-1.373.622l-2.026 1.504c-.4.29-.591.561-.591.852 0 .38.3.692.672.692.22 0 .43-.08.721-.291l1.885-1.374zM4.42 4.903a.77.77 0 0 1 .77.77v5.35h6.168v-5.35a.77.77 0 1 1 1.54 0v12.242a.77.77 0 0 1-1.54 0v-5.351H5.19v5.351a.77.77 0 1 1-1.54 0V5.673a.77.77 0 0 1 .77-.77", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const HEADING_2: IconDef = IconDef { + name: "Heading2Icon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M14.159 16c-.562.638-.725.905-.725 1.248 0 .553.439.886 1.135.886h6.289c.524 0 .829-.276.829-.724 0-.457-.324-.734-.83-.734H15.57v-.114l3.526-4.031c1.715-1.953 2.201-2.859 2.201-4.098 0-2.096-1.648-3.583-3.993-3.583-2.515 0-4.088 1.697-4.088 3.317 0 .514.305.867.772.867.39 0 .658-.258.791-.763.286-1.238 1.191-1.972 2.42-1.972 1.449 0 2.411.896 2.411 2.24 0 .895-.41 1.695-1.486 2.925zM3.419 5.364c.404 0 .731.327.731.731v5.087h5.863V6.095a.732.732 0 1 1 1.464 0v11.637a.732.732 0 0 1-1.464 0v-5.087H4.15v5.087a.732.732 0 1 1-1.463 0V6.095c0-.404.327-.731.732-.731", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const HEADING_3: IconDef = IconDef { + name: "Heading3Icon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M4.05 5.856a.75.75 0 0 0-1.5 0v11.921a.75.75 0 1 0 1.5 0v-5.21h6.006v5.21a.75.75 0 0 0 1.5 0V5.856a.75.75 0 0 0-1.5 0v5.21H4.05zm9.479 9.234c-.418 0-.713.304-.713.732 0 1.454 1.796 2.936 4.248 2.936 2.642 0 4.486-1.558 4.486-3.782 0-1.635-1.226-3.041-2.832-3.222v-.095c1.321-.228 2.395-1.596 2.395-3.031 0-1.977-1.692-3.393-4.068-3.393-2.338 0-3.925 1.425-3.925 2.898 0 .476.285.79.723.79.37 0 .608-.2.798-.723.38-.979 1.235-1.54 2.366-1.54 1.454 0 2.433.875 2.433 2.177s-1.007 2.242-2.395 2.242h-1.121c-.456 0-.76.295-.76.713 0 .409.323.723.76.723h1.188c1.654 0 2.765.978 2.765 2.432s-1.083 2.386-2.784 2.386c-1.293 0-2.281-.57-2.775-1.587-.247-.485-.456-.656-.789-.656", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const HEADING_4: IconDef = IconDef { + name: "Heading4Icon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M18.793 15.755v1.931c0 .552.286.866.79.866.514 0 .8-.314.8-.866v-1.931h.989c.542 0 .847-.267.847-.723 0-.467-.314-.733-.847-.733h-.99V6.696c0-.885-.485-1.38-1.35-1.38-.657 0-1.095.286-1.657 1.114-2.16 3.235-3.016 4.605-4.377 7.013-.333.609-.447.942-.447 1.294 0 .628.495 1.018 1.237 1.018zm0-1.456H14.15v-.095c1.246-2.16 2.94-4.882 4.558-7.27h.085zM2.95 5.705a.73.73 0 0 1 .73.731v5.079h5.855V6.436a.73.73 0 0 1 1.461 0v11.62a.73.73 0 0 1-1.461 0v-5.08H3.68v5.08a.73.73 0 0 1-1.461 0V6.435a.73.73 0 0 1 .73-.73", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const HEADING_5: IconDef = IconDef { + name: "Heading5Icon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M13.615 15.053c-.409 0-.678.316-.678.78 0 1.302 1.534 2.799 3.988 2.799 2.593 0 4.443-1.822 4.443-4.388 0-2.408-1.664-4.1-4.025-4.1-1.07 0-2.157.447-2.575 1.07h-.093l.353-4.137h5.01c.55 0 .856-.251.856-.698 0-.455-.316-.725-.855-.725h-5.215c-.8 0-1.2.326-1.255 1.014l-.41 5.205c-.046.716.224 1.135.754 1.135.297 0 .483-.112 1.162-.744a2.77 2.77 0 0 1 1.905-.725c1.609 0 2.752 1.152 2.752 2.789 0 1.71-1.18 2.9-2.872 2.9-1.116 0-1.971-.54-2.482-1.534-.242-.474-.447-.641-.763-.641M3.082 5.903c.394 0 .714.32.714.715v4.962h5.72V6.618a.714.714 0 1 1 1.427 0v11.351a.714.714 0 1 1-1.428 0v-4.961H3.796v4.961a.714.714 0 1 1-1.428 0V6.618c0-.395.32-.714.714-.714", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const HEADING_6: IconDef = IconDef { + name: "Heading6Icon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M17.65 5.517c-3.098 0-4.825 2.491-4.825 6.98 0 1.932.318 3.379.961 4.406.766 1.203 2.026 1.857 3.603 1.857 2.594 0 4.349-1.746 4.349-4.312 0-2.436-1.661-4.144-4.032-4.144-1.456 0-2.79.803-3.22 1.941h-.074c.028-3.49 1.129-5.32 3.21-5.32.83 0 1.53.3 2.203.962.336.327.532.43.793.43.401 0 .69-.3.69-.7 0-.43-.373-.943-.989-1.344-.709-.486-1.67-.756-2.669-.756m-.196 11.843c-1.652 0-2.809-1.186-2.809-2.856 0-1.652 1.13-2.81 2.744-2.81 1.661 0 2.744 1.12 2.744 2.82 0 1.717-1.074 2.846-2.679 2.846m-14-11.369c.396 0 .717.321.717.717v4.981h5.742V6.708a.717.717 0 0 1 1.434 0v11.396a.717.717 0 1 1-1.434 0v-4.981H4.171v4.981a.717.717 0 1 1-1.433 0V6.708c0-.396.32-.717.717-.717", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const BULLETED_LIST: IconDef = IconDef { + name: "BulletedListIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M4.3 7.5a1 1 0 1 0 0-2 1 1 0 0 0 0 2m4.033-1.75a.75.75 0 0 0 0 1.5l11.917.001a.75.75 0 0 0 0-1.5zm0 5.5a.75.75 0 1 0 0 1.5l11.917.002a.75.75 0 1 0 0-1.5zm0 5.5a.75.75 0 1 0 0 1.5l11.917.002a.75.75 0 0 0 0-1.5zM5.3 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0m-1 6.5a1 1 0 1 0 0-2 1 1 0 0 0 0 2", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const NUMBERED_LIST: IconDef = IconDef { + name: "NumberedListIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M4.129 5.762a.6.6 0 0 0 .15-.08l.255-.177V7.64c0 .188.063.35.181.466a.66.66 0 0 0 .47.177c.186 0 .35-.061.468-.177a.64.64 0 0 0 .182-.466V4.934a.7.7 0 0 0-.197-.52c-.13-.13-.316-.195-.534-.195-.221 0-.434.022-.675.183l-.677.452a.53.53 0 0 0-.252.46c0 .273.203.472.464.472a.5.5 0 0 0 .165-.024m5.277-.16a.768.768 0 0 0 0 1.536h10.326a.768.768 0 1 0 0-1.536zm0 5.632a.768.768 0 0 0 0 1.536h10.326a.768.768 0 1 0 0-1.535zm0 5.633a.768.768 0 1 0 0 1.536h10.326a.768.768 0 1 0 0-1.536zm-2.782-5.753q.018-.099.018-.21c0-.678-.58-1.136-1.486-1.136-.652 0-1.176.277-1.373.721.197-.444.721-.72 1.373-.72.907 0 1.486.457 1.486 1.134q0 .112-.018.211m-1.5 1.64v.02h1.184c.274 0 .43.163.43.414 0-.25-.156-.414-.43-.414H5.126zm-1.384.237c.035-.14.126-.26.284-.393l1.026-.878c.338-.29.48-.453.523-.622-.042.17-.185.331-.523.622l-1.026.879c-.158.131-.25.253-.284.392m.763-1.81a.8.8 0 0 0 .251-.254.7.7 0 0 1 .184-.193.36.36 0 0 1 .202-.054c.113 0 .199.034.255.085.056.05.09.12.09.21 0 .17-.079.304-.502.667l-1.026.878c-.219.184-.336.365-.336.608 0 .156.045.303.152.412.108.108.265.164.463.164h2.073a.54.54 0 0 0 .389-.145.51.51 0 0 0 .142-.371.5.5 0 0 0-.142-.374.54.54 0 0 0-.39-.142h-.932l.496-.428c.287-.25.506-.447.651-.65.15-.207.221-.419.221-.691 0-.37-.16-.684-.442-.902-.281-.217-.677-.335-1.146-.335-.676 0-1.248.288-1.467.783a.7.7 0 0 0-.057.283c0 .155.05.29.152.387.1.095.24.142.4.142a.6.6 0 0 0 .32-.08m-.832 4.897c.152-.414.67-.853 1.557-.853.457 0 .865.096 1.16.29a1 1 0 0 1 .478.865c0 .483-.308.804-.692.941.234.05.43.143.576.279.184.17.285.404.285.687 0 .405-.174.737-.49.966-.313.228-.762.352-1.311.352-.96 0-1.495-.458-1.641-.868a.7.7 0 0 1-.04-.228.5.5 0 0 1 .155-.387.6.6 0 0 1 .413-.142q.174-.001.305.064.13.066.223.203a.8.8 0 0 0 .236.245c.09.055.206.087.377.087.278 0 .46-.165.46-.379a.33.33 0 0 0-.14-.288c-.096-.066-.242-.104-.444-.104H5.11a.48.48 0 0 1-.35-.122.44.44 0 0 1-.12-.323c0-.124.039-.236.12-.317.082-.08.2-.125.35-.125h.028c.178 0 .311-.038.399-.102a.32.32 0 0 0 .131-.268.32.32 0 0 0-.112-.258.5.5 0 0 0-.322-.098.57.57 0 0 0-.286.068.53.53 0 0 0-.198.207.7.7 0 0 1-.241.27.64.64 0 0 1-.343.082.55.55 0 0 1-.401-.144.5.5 0 0 1-.136-.363c0-.085.012-.153.042-.237", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const CHECKBOX_UNCHECKED: IconDef = IconDef { + name: "CheckBoxUnIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M6 3.25A2.75 2.75 0 0 0 3.25 6v12A2.75 2.75 0 0 0 6 20.75h12A2.75 2.75 0 0 0 20.75 18V6A2.75 2.75 0 0 0 18 3.25zM4.75 6c0-.69.56-1.25 1.25-1.25h12c.69 0 1.25.56 1.25 1.25v12c0 .69-.56 1.25-1.25 1.25H6c-.69 0-1.25-.56-1.25-1.25z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const CHECKBOX_CHECKED_SOLID: IconDef = IconDef { + name: "CheckBoxCheckSolidIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M3.25 6A2.75 2.75 0 0 1 6 3.25h12A2.75 2.75 0 0 1 20.75 6v12A2.75 2.75 0 0 1 18 20.75H6A2.75 2.75 0 0 1 3.25 18zm13.28 3.53a.75.75 0 0 0-1.06-1.06l-4.97 4.97-1.47-1.47a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.06 0z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const CHECKBOX_CHECKED_LINEAR: IconDef = IconDef { + name: "CheckBoxCheckLinearIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M6 3.25A2.75 2.75 0 0 0 3.25 6v12A2.75 2.75 0 0 0 6 20.75h12A2.75 2.75 0 0 0 20.75 18V6A2.75 2.75 0 0 0 18 3.25zM4.75 6c0-.69.56-1.25 1.25-1.25h12c.69 0 1.25.56 1.25 1.25v12c0 .69-.56 1.25-1.25 1.25H6c-.69 0-1.25-.56-1.25-1.25zm11.78 3.53a.75.75 0 0 0-1.06-1.06l-4.97 4.97-1.47-1.47a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.06 0z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const TOGGLE_DOWN: IconDef = IconDef { + name: "ToggleDownIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M13.15 15.132a.757.757 0 0 1-1.3 0L8.602 9.605c-.29-.491.072-1.105.65-1.105h6.497c.577 0 .938.614.65 1.105z", fill_rule: "nonzero", clip_rule: "nonzero", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const TOGGLE_RIGHT: IconDef = IconDef { + name: "ToggleRightIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M15.632 11.35a.757.757 0 0 1 0 1.3l-5.527 3.248c-.491.29-1.105-.072-1.105-.65V8.752c0-.577.614-.938 1.105-.65z", fill_rule: "nonzero", clip_rule: "nonzero", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const QUOTE: IconDef = IconDef { + name: "QuoteIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M5 10.966v4.095c0 .565.458 1.024 1.024 1.024h4.095c.566 0 1.024-.459 1.024-1.024v-4.095c0-.566-.459-1.024-1.024-1.024H6.704A3.35 3.35 0 0 1 9.845 7.75v-1.5A4.845 4.845 0 0 0 5 10.966m8 0v4.095c0 .565.458 1.024 1.024 1.024h4.095c.566 0 1.024-.459 1.024-1.024v-4.095c0-.566-.459-1.024-1.024-1.024h-3.415a3.35 3.35 0 0 1 3.141-2.192v-1.5A4.845 4.845 0 0 0 13 10.966", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const DIVIDER: IconDef = IconDef { + name: "DividerIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M4 4.25a.75.75 0 0 1 .75.75v1c0 .69.56 1.25 1.25 1.25h12c.69 0 1.25-.56 1.25-1.25V5a.75.75 0 0 1 1.5 0v1A2.75 2.75 0 0 1 18 8.75H6A2.75 2.75 0 0 1 3.25 6V5A.75.75 0 0 1 4 4.25m0 15.5a.75.75 0 0 0 .75-.75v-1c0-.69.56-1.25 1.25-1.25h12c.69 0 1.25.56 1.25 1.25v1a.75.75 0 0 0 1.5 0v-1A2.75 2.75 0 0 0 18 15.25H6A2.75 2.75 0 0 0 3.25 18v1c0 .414.336.75.75.75m-1-8.5a.75.75 0 0 0 0 1.5h1.2a.75.75 0 0 0 0-1.5H3m3.45.75a.75.75 0 0 1 .75-.75h1.2a.75.75 0 0 1 0 1.5H7.2a.75.75 0 0 1-.75-.75m4.95-.75a.75.75 0 0 0 0 1.5h1.2a.75.75 0 0 0 0-1.5h-1.2m3.45.75a.75.75 0 0 1 .75-.75h1.2a.75.75 0 0 1 0 1.5h-1.2a.75.75 0 0 1-.75-.75m4.95-.75a.75.75 0 0 0 0 1.5H21a.75.75 0 0 0 0-1.5h-1.2", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const CODE_BLOCK: IconDef = IconDef { + name: "CodeBlockIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M2.25 6A2.75 2.75 0 0 1 5 3.25h14A2.75 2.75 0 0 1 21.75 6v12A2.75 2.75 0 0 1 19 20.75H5A2.75 2.75 0 0 1 2.25 18zM5 4.75c-.69 0-1.25.56-1.25 1.25v12c0 .69.56 1.25 1.25 1.25h14c.69 0 1.25-.56 1.25-1.25V6c0-.69-.56-1.25-1.25-1.25zm5.53 4.62a.75.75 0 0 1 0 1.06l-1.59 1.591 1.59 1.591a.75.75 0 0 1-1.06 1.06l-2.122-2.12a.75.75 0 0 1 0-1.061L9.47 9.37a.75.75 0 0 1 1.06 0m2.94 1.06a.75.75 0 1 1 1.06-1.06l2.122 2.12a.75.75 0 0 1 0 1.062l-2.122 2.12a.75.75 0 1 1-1.06-1.06l1.59-1.59z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const INLINE_CODE: IconDef = IconDef { + name: "CodeIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M13.982 4.272a.75.75 0 0 1 .546.91l-3.6 14.4a.75.75 0 1 1-1.456-.364l3.6-14.4a.75.75 0 0 1 .91-.546M7.13 8.07a.75.75 0 0 1 0 1.06L4.06 12.2l3.07 3.07a.75.75 0 0 1-1.06 1.06l-3.6-3.6a.75.75 0 0 1 0-1.06l3.6-3.6a.75.75 0 0 1 1.06 0m9.74 0a.75.75 0 0 1 1.06 0l3.6 3.6a.75.75 0 0 1 0 1.06l-3.6 3.6a.75.75 0 1 1-1.06-1.06l3.07-3.07-3.07-3.07a.75.75 0 0 1 0-1.06", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const COPY: IconDef = IconDef { + name: "CopyIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M3.25 6A2.75 2.75 0 0 1 6 3.25h8A2.75 2.75 0 0 1 16.75 6v1.25H18A2.75 2.75 0 0 1 20.75 10v8A2.75 2.75 0 0 1 18 20.75h-8A2.75 2.75 0 0 1 7.25 18v-1.25H6A2.75 2.75 0 0 1 3.25 14zm5.5 12c0 .69.56 1.25 1.25 1.25h8c.69 0 1.25-.56 1.25-1.25v-8c0-.69-.56-1.25-1.25-1.25h-8c-.69 0-1.25.56-1.25 1.25zm6.5-10.75H10A2.75 2.75 0 0 0 7.25 10v5.25H6c-.69 0-1.25-.56-1.25-1.25V6c0-.69.56-1.25 1.25-1.25h8c.69 0 1.25.56 1.25 1.25z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const LINK: IconDef = IconDef { + name: "LinkIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M18.428 5.572a2.806 2.806 0 0 0-3.967 0l-.978.977a.75.75 0 0 1-1.06-1.06l.977-.978a4.305 4.305 0 1 1 6.089 6.089l-3.556 3.556a4.306 4.306 0 0 1-6.089 0 .75.75 0 0 1 1.061-1.061 2.805 2.805 0 0 0 3.968 0l3.555-3.556a2.806 2.806 0 0 0 0-3.967m-5.333 5.333a2.805 2.805 0 0 0-3.968 0l-3.555 3.556a2.806 2.806 0 0 0 3.967 3.967l.98-.979a.75.75 0 0 1 1.06 1.06l-.979.98A4.305 4.305 0 1 1 4.511 13.4l3.556-3.556a4.306 4.306 0 0 1 6.089 0 .75.75 0 0 1-1.061 1.061", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const LINKED_PAGE: IconDef = IconDef { + name: "LinkedPageIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M4.25 6A2.75 2.75 0 0 1 7 3.25h10A2.75 2.75 0 0 1 19.75 6v6a.75.75 0 0 1-1.5 0V6c0-.69-.56-1.25-1.25-1.25H7c-.69 0-1.25.56-1.25 1.25v12c0 .69.56 1.25 1.25 1.25h5a.75.75 0 0 1 0 1.5H7A2.75 2.75 0 0 1 4.25 18zm4 2A.75.75 0 0 1 9 7.25h3a.75.75 0 0 1 0 1.5H9A.75.75 0 0 1 8.25 8M9 10.75a.75.75 0 0 0 0 1.5h6a.75.75 0 0 0 0-1.5zM8.25 15a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5H9a.75.75 0 0 1-.75-.75m7.25-.75a.75.75 0 0 0 0 1.5h2.69l-3.72 3.72a.75.75 0 1 0 1.06 1.06l3.72-3.72v2.69a.75.75 0 0 0 1.5 0V15a.75.75 0 0 0-.75-.75z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const BOLD: IconDef = IconDef { + name: "BoldIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M6.25 4A.75.75 0 0 1 7 3.25h5.958c2.67 0 4.875 2.105 4.875 4.75 0 1.515-.723 2.853-1.843 3.72 1.626.764 2.76 2.383 2.76 4.28 0 2.645-2.204 4.75-4.875 4.75H7a.75.75 0 0 1-.75-.75zm1.5 8.75v6.5h6.125c1.886 0 3.375-1.477 3.375-3.25s-1.49-3.25-3.375-3.25zm0-1.5h5.208c1.886 0 3.375-1.477 3.375-3.25s-1.489-3.25-3.375-3.25H7.75z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const ITALIC: IconDef = IconDef { + name: "ItalicIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M14.608 3.25H10.25a.75.75 0 0 0 0 1.5h3.34l-4.758 14.5H5a.75.75 0 0 0 0 1.5h8.75a.75.75 0 0 0 0-1.5h-3.34l4.758-14.5H19a.75.75 0 0 0 0-1.5h-4.392", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const UNDERLINE: IconDef = IconDef { + name: "UnderLineIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M7.744 3.968a.808.808 0 1 0-1.616 0v7.003a5.656 5.656 0 1 0 11.313 0V3.968a.808.808 0 1 0-1.616 0v7.003a4.04 4.04 0 1 1-8.08 0zM4.458 19.32a.808.808 0 0 0 0 1.616h15.084a.808.808 0 1 0 0-1.616z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const STRIKETHROUGH: IconDef = IconDef { + name: "StrikeThroughIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M8.406 7.464a3.468 3.468 0 0 1 6.59-1.513.77.77 0 0 0 1.385-.673 5.009 5.009 0 0 0-9.05 4.3h1.793a3.45 3.45 0 0 1-.718-2.114m6.512 8.476c0-.795-.268-1.528-.718-2.113h1.792a5.008 5.008 0 0 1-9.05 4.299.77.77 0 1 1 1.387-.673 3.468 3.468 0 0 0 6.589-1.513M4.297 10.905a.797.797 0 0 0 0 1.594h15.406a.797.797 0 0 0 0-1.594z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const DELETE: IconDef = IconDef { + name: "DeleteIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M10.75 11a.75.75 0 0 0-1.5 0v6a.75.75 0 0 0 1.5 0zM14 10.25a.75.75 0 0 1 .75.75v6a.75.75 0 0 1-1.5 0v-6a.75.75 0 0 1 .75-.75", fill_rule: "nonzero", clip_rule: "nonzero", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + IconPath { d: "M11 2.25A2.75 2.75 0 0 0 8.25 5v1.15H4a.85.85 0 0 0 0 1.7h.309l.81 11.346a2.75 2.75 0 0 0 2.743 2.554h8.276a2.75 2.75 0 0 0 2.743-2.554l.81-11.346H20a.85.85 0 1 0 0-1.7h-4.25V5A2.75 2.75 0 0 0 13 2.25zm3.25 3.9V5c0-.69-.56-1.25-1.25-1.25h-2c-.69 0-1.25.56-1.25 1.25v1.15zm3.937 1.7H5.813l.802 11.24a1.25 1.25 0 0 0 1.247 1.16h8.276c.656 0 1.2-.507 1.247-1.16z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const DRAG_HANDLE: IconDef = IconDef { + name: "DragCursorIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M10.694 3.62c.271-.661.934-1.12 1.693-1.12.993 0 1.823.786 1.823 1.786v.12c.248-.123.528-.192.822-.192.993 0 1.823.786 1.823 1.786v.978c.248-.123.528-.192.822-.192.994 0 1.823.786 1.823 1.785v6c0 3.84-3.198 6.929-7.113 6.929-.96 0-1.884-.131-2.777-.547-.893-.415-1.717-1.098-2.505-2.146l-3.208-4.001a1.755 1.755 0 0 1 .14-2.376 1.845 1.845 0 0 1 2.592.031l.563.653c.308.376.54.631.714.795v-.01c.015-.235.014-.525.013-.875V5.142c0-.999.83-1.785 1.823-1.785.347 0 .674.096.952.264m.87 7.523a.5.5 0 1 1-1 0v-6c0-.42-.354-.786-.822-.786s-.823.365-.823.786v7.865c.001.352.002.683-.015.952-.01.164-.027.329-.062.475a1 1 0 0 1-.236.467.69.69 0 0 1-.64.196 1.2 1.2 0 0 1-.497-.246c-.28-.214-.623-.582-1.046-1.099l-.535-.62a.845.845 0 0 0-1.153.014.756.756 0 0 0-.062 1.028l.003.003 3.214 4.01.01.012c.71.948 1.415 1.513 2.132 1.847.719.334 1.488.453 2.355.453 3.39 0 6.113-2.668 6.113-5.929v-6c0-.42-.355-.785-.823-.785s-.822.365-.822.785V12a.5.5 0 0 1-1 0V6c0-.42-.355-.786-.823-.786s-.822.365-.822.786v5.143a.5.5 0 0 1-1 0V4.286c0-.421-.355-.786-.823-.786s-.823.365-.823.786z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + IconPath { d: "M11.064 11.643a.5.5 0 0 0 .5-.5V4.286c0-.421.355-.786.823-.786s.823.365.823.786v6.857a.5.5 0 1 0 1 0V6c0-.42.354-.786.822-.786s.823.365.823.786v6a.5.5 0 1 0 1 0V8.571c0-.42.355-.785.822-.785.468 0 .823.365.823.785v6c0 3.261-2.724 5.929-6.113 5.929-.867 0-1.636-.119-2.355-.453-.717-.334-1.421-.9-2.132-1.847l-.01-.013-3.214-4.009-.003-.003a.756.756 0 0 1 .062-1.028.845.845 0 0 1 1.153-.014l.535.62c.423.517.766.885 1.046 1.099.138.104.306.209.496.246a.69.69 0 0 0 .641-.196 1 1 0 0 0 .236-.467c.035-.146.052-.31.062-.475.017-.27.016-.6.015-.952V5.143c0-.42.355-.785.823-.785s.822.365.822.786v6a.5.5 0 0 0 .5.5", fill_rule: "nonzero", clip_rule: "nonzero", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + IconPath { d: "M10.694 3.62c.271-.661.934-1.12 1.693-1.12.993 0 1.823.786 1.823 1.786v.12c.248-.123.528-.192.822-.192.993 0 1.823.786 1.823 1.786v.978c.248-.123.528-.192.822-.192.994 0 1.823.786 1.823 1.785v6c0 3.84-3.198 6.929-7.113 6.929-.96 0-1.884-.131-2.777-.547-.893-.415-1.717-1.098-2.505-2.146l-3.208-4.001a1.755 1.755 0 0 1 .14-2.376 1.845 1.845 0 0 1 2.592.031l.563.653c.308.376.54.631.714.795v-.01c.015-.235.014-.525.013-.875V5.142c0-.999.83-1.785 1.823-1.785.347 0 .674.096.952.264m.87 7.523a.5.5 0 1 1-1 0v-6c0-.42-.354-.786-.822-.786s-.823.365-.823.786v7.865c.001.352.002.683-.015.952-.01.164-.027.329-.062.475a1 1 0 0 1-.236.467.69.69 0 0 1-.64.196 1.2 1.2 0 0 1-.497-.246c-.28-.214-.623-.582-1.046-1.099l-.535-.62a.845.845 0 0 0-1.153.014.756.756 0 0 0-.062 1.028l.003.003 3.214 4.01.01.012c.71.948 1.415 1.513 2.132 1.847.719.334 1.488.453 2.355.453 3.39 0 6.113-2.668 6.113-5.929v-6c0-.42-.355-.785-.823-.785s-.822.365-.822.785V12a.5.5 0 0 1-1 0V6c0-.42-.355-.786-.823-.786s-.822.365-.822.786v5.143a.5.5 0 0 1-1 0V4.286c0-.421-.355-.786-.823-.786s-.823.365-.823.786z", fill_rule: "nonzero", clip_rule: "evenodd", fill: "none", stroke: "currentColor", stroke_width: 0.5_f32, stroke_linecap: "round", stroke_linejoin: "round" }, + IconPath { d: "M11.064 11.643a.5.5 0 0 0 .5-.5V4.286c0-.421.355-.786.823-.786s.823.365.823.786v6.857a.5.5 0 1 0 1 0V6c0-.42.354-.786.822-.786s.823.365.823.786v6a.5.5 0 1 0 1 0V8.571c0-.42.355-.785.822-.785.468 0 .823.365.823.785v6c0 3.261-2.724 5.929-6.113 5.929-.867 0-1.636-.119-2.355-.453-.717-.334-1.421-.9-2.132-1.847l-.01-.013-3.214-4.009-.003-.003a.756.756 0 0 1 .062-1.028.845.845 0 0 1 1.153-.014l.535.62c.423.517.766.885 1.046 1.099.138.104.306.209.496.246a.69.69 0 0 0 .641-.196 1 1 0 0 0 .236-.467c.035-.146.052-.31.062-.475.017-.27.016-.6.015-.952V5.143c0-.42.355-.785.823-.785s.822.365.822.786v6a.5.5 0 0 0 .5.5", fill_rule: "nonzero", clip_rule: "nonzero", fill: "none", stroke: "currentColor", stroke_width: 0.5_f32, stroke_linecap: "round", stroke_linejoin: "round" }, + ], +}; + +pub const SHAPE: IconDef = IconDef { + name: "ShapeIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M12 3.25a.75.75 0 0 1 .651.378l3.556 6.222a.75.75 0 0 1-.651 1.122H8.444a.75.75 0 0 1-.65-1.122l3.555-6.222A.75.75 0 0 1 12 3.25M9.737 9.472h4.526L12 5.512zM7.11 14.528a2.361 2.361 0 1 0 0 4.722 2.361 2.361 0 0 0 0-4.722m-3.861 2.36a3.861 3.861 0 1 1 7.722 0 3.861 3.861 0 0 1-7.722 0m9.778-3.11a.75.75 0 0 1 .75-.75H20a.75.75 0 0 1 .75.75V20a.75.75 0 0 1-.75.75h-6.222a.75.75 0 0 1-.75-.75zm1.5.75v4.722h4.722v-4.722z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const SQUARE: IconDef = IconDef { + name: "SquareIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M3.25 3.25h17.5v17.5H3.25zm1.5 1.5v14.5h14.5V4.75z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const ROUNDED_RECTANGLE: IconDef = IconDef { + name: "RoundedRectangleIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M2.25 7A2.75 2.75 0 0 1 5 4.25h14A2.75 2.75 0 0 1 21.75 7v10A2.75 2.75 0 0 1 19 19.75H5A2.75 2.75 0 0 1 2.25 17zM5 5.75c-.69 0-1.25.56-1.25 1.25v10c0 .69.56 1.25 1.25 1.25h14c.69 0 1.25-.56 1.25-1.25V7c0-.69-.56-1.25-1.25-1.25z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const DIAMOND: IconDef = IconDef { + name: "DiamondIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M12 1.94 22.06 12 12 22.06 1.94 12zM4.06 12 12 19.94 19.94 12 12 4.06z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const TRIANGLE: IconDef = IconDef { + name: "TriangleIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "m12 2.5 9.96 17.25H2.04zm0 3L4.64 18.25H19.36z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const CONNECTOR_STRAIGHT: IconDef = IconDef { + name: "ConnectorLIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M13 3.25a.75.75 0 0 0 0 1.5h5.19L3.47 19.47a.75.75 0 1 0 1.06 1.06L19.25 5.81V11a.75.75 0 0 0 1.5 0V4.1a.85.85 0 0 0-.85-.85z", fill_rule: "nonzero", clip_rule: "nonzero", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const CONNECTOR_ELBOW: IconDef = IconDef { + name: "ConnectorEIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M17.03 2.02a.75.75 0 1 0-1.06 1.06l3.67 3.67H14a2.75 2.75 0 0 0-2.75 2.75V18c0 .69-.56 1.25-1.25 1.25H3a.75.75 0 0 0 0 1.5h7A2.75 2.75 0 0 0 12.75 18V9.5c0-.69.56-1.25 1.25-1.25h5.64l-3.67 3.67a.75.75 0 1 0 1.06 1.06l4.88-4.879a.85.85 0 0 0 0-1.202z", fill_rule: "nonzero", clip_rule: "nonzero", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const CONNECTOR_CURVE: IconDef = IconDef { + name: "ConnectorCIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M15.97 2.02a.75.75 0 0 1 1.06 0l4.88 4.879a.85.85 0 0 1 0 1.202l-4.88 4.88a.75.75 0 1 1-1.06-1.062l3.67-3.669H18c-3.151 0-4.552.758-5.25 1.662-.745.963-.873 2.28-1.002 3.898l-.008.101c-.119 1.486-.259 3.245-1.303 4.595C9.323 19.946 7.349 20.75 4 20.75a.75.75 0 0 1 0-1.5c3.151 0 4.552-.758 5.25-1.662.745-.963.873-2.28 1.002-3.898l.008-.101c.119-1.486.259-3.245 1.303-4.595C12.677 7.554 14.651 6.75 18 6.75h1.64l-3.67-3.67a.75.75 0 0 1 0-1.06", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const BRUSH: IconDef = IconDef { + name: "BrushIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M4.25 4.968a.75.75 0 0 1 .782-.717 84 84 0 0 1 7.141.63c1.323.178 2.63.398 3.77.664 1.127.263 2.15.585 2.873.987.228.127.444.275.61.453.164.177.347.461.322.832s-.243.623-.417.766a2.2 2.2 0 0 1-.582.327c-.759.302-2.052.501-3.404.663-.818.098-1.716.187-2.593.275-.594.06-1.178.118-1.723.177q-.416.045-.797.091l.953.142c2.324.342 5.287.777 7.09 1.48.16.064.41.177.585.394a.88.88 0 0 1 .198.551.9.9 0 0 1-.18.532 1.4 1.4 0 0 1-.513.393 4 4 0 0 1-.543.208c-.767.242-1.994.482-3.266.725l-.406.078c-1.175.223-2.39.454-3.412.701a14 14 0 0 0-1.443.413 5 5 0 0 0-.37.15c.295.23.799.507 1.466.801 1.43.631 3.34 1.232 4.669 1.592a.75.75 0 0 1-.393 1.448c-1.361-.37-3.352-.993-4.88-1.668-.75-.33-1.46-.703-1.921-1.102-.222-.192-.478-.467-.58-.828a1.13 1.13 0 0 1 .002-.636c.065-.217.188-.391.327-.527.293-.286.746-.487 1.17-.64a16 16 0 0 1 1.602-.461c1.06-.256 2.312-.494 3.48-.716l.408-.078a75 75 0 0 0 1.951-.392c-1.57-.39-3.545-.681-5.299-.94l-.605-.09c-1.197-.178-2.29-.35-2.908-.545a2.2 2.2 0 0 1-.483-.206c-.098-.06-.459-.292-.473-.755-.015-.48.35-.732.46-.802.159-.102.352-.177.54-.239.76-.247 2.049-.417 3.408-.565.577-.063 1.172-.122 1.767-.182.86-.086 1.722-.171 2.534-.269 1.066-.127 1.954-.264 2.556-.42-.527-.231-1.248-.453-2.12-.657-1.08-.252-2.335-.464-3.63-.64a82 82 0 0 0-7.005-.617.75.75 0 0 1-.717-.78m13.543 8.197-.006-.004zm-.035-.931", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const PEN: IconDef = IconDef { + name: "PenIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M19.279 4.721a1.614 1.614 0 0 0-2.28 0l-.885.883 2.278 2.273.887-.885a1.603 1.603 0 0 0 0-2.271M17.33 8.937l-2.277-2.273L4.25 17.445v2.305h2.245zm-1.39-5.278a3.114 3.114 0 0 1 4.398 0 3.103 3.103 0 0 1 0 4.395L7.335 21.03a.75.75 0 0 1-.53.22H3.5a.75.75 0 0 1-.75-.75v-3.367c0-.2.08-.39.22-.53z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const HAND: IconDef = IconDef { + name: "HandIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M14.733 20.75a11.3 11.3 0 0 1-4.415-.993l-5.44-2.56a2.238 2.238 0 0 1-1.06-2.967c.251-.533.703-.944 1.256-1.144a2.2 2.2 0 0 1 1.694.081l1.016.479c-.477-1.621-1.431-4.305-2.862-5.873l-.883-.717a2.145 2.145 0 0 1 1.014-3.78 2.14 2.14 0 0 1 1.565.36A12.1 12.1 0 0 1 9.39 6.4c.26-.389.637-.684 1.077-.841a2.15 2.15 0 0 1 1.687.08c.235.11.45.26.636.442.238-.27.542-.475.883-.593a2.02 2.02 0 0 1 1.572.08c.279.126.524.318.715.558q.148-.097.318-.15a1.55 1.55 0 0 1 1.987.938l2.11 5.881a6.5 6.5 0 0 1 0 4.35 5.32 5.32 0 0 1-3.223 3.232c-.78.26-1.598.385-2.42.372m-8.802-6.414c-.128-.027-.32-.035-.417 0a.88.88 0 0 0-.512.461.89.89 0 0 0 .433 1.196l5.404 2.613s3.197 1.488 5.828.54a3.9 3.9 0 0 0 2.438-2.41 5.13 5.13 0 0 0 0-3.445l-2.12-5.881a.22.22 0 0 0-.202-.157.23.23 0 0 0-.222.307l.3.886a.664.664 0 0 1-.397.886.66.66 0 0 1-.883-.399l-.583-1.63a.8.8 0 0 0-.38-.416.71.71 0 0 0-.556 0 .725.725 0 0 0-.468.886l.247.93a.657.657 0 0 1-.45.797.65.65 0 0 1-.812-.407l-.583-1.612a.885.885 0 0 0-1.122-.523.884.884 0 0 0-.52 1.125l.423 1.187a.67.67 0 0 1-.397.886.66.66 0 0 1-.883-.399A10.23 10.23 0 0 0 5.77 4.921a.793.793 0 0 0-1.104.177c-.127.168-.116.326-.091.536.024.21.13.402.293.536l.883.744.061.062C8.223 9.57 9.345 14.637 9.39 14.85a.67.67 0 0 1-.239.664.67.67 0 0 1-.688.08l-1.54-.797c-.385-.21-.466-.282-.991-.46", fill_rule: "nonzero", clip_rule: "nonzero", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const SELECT: IconDef = IconDef { + name: "SelectIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M4.012 4.35c-.17-1.5 1.514-2.496 2.748-1.625l13.222 9.336c1.383.976.712 3.15-.98 3.179l-6.661.11a.25.25 0 0 0-.213.127L9.066 20.88c-.836 1.475-3.071 1.019-3.261-.666zm1.883-.4a.25.25 0 0 0-.393.232l1.793 15.863a.25.25 0 0 0 .466.095l3.061-5.403a1.75 1.75 0 0 1 1.494-.887l6.66-.11a.25.25 0 0 0 .141-.454z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const NOTE: IconDef = IconDef { + name: "NoteShadowDuotoneIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M3.25 5A2.75 2.75 0 0 1 6 2.25h9A2.75 2.75 0 0 1 17.75 5v10.857a2.75 2.75 0 0 1-2.75 2.75H6a2.75 2.75 0 0 1-2.75-2.75zM6 3.75c-.69 0-1.25.56-1.25 1.25v10.857c0 .69.56 1.25 1.25 1.25h9c.69 0 1.25-.56 1.25-1.25V5c0-.69-.56-1.25-1.25-1.25z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "#7A7A7A", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + IconPath { d: "M6.25 18.607H15a2.75 2.75 0 0 0 2.75-2.75V5.25H18A2.75 2.75 0 0 1 20.75 8v10.857a2.75 2.75 0 0 1-2.75 2.75H9a2.75 2.75 0 0 1-2.75-2.75z", fill_rule: "nonzero", clip_rule: "nonzero", fill: "#B3B3B3", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const FRAME: IconDef = IconDef { + name: "FrameIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M7 20.75a.75.75 0 0 1-.75-.75v-2.25H4a.75.75 0 0 1 0-1.5h2.25v-8.5H4a.75.75 0 0 1 0-1.5h2.25V4a.75.75 0 0 1 1.5 0v2.25h8.5V4a.75.75 0 0 1 1.5 0v2.25H20a.75.75 0 0 1 0 1.5h-2.25v8.5H20a.75.75 0 0 1 0 1.5h-2.25V20a.75.75 0 0 1-1.5 0v-2.25h-8.5V20a.75.75 0 0 1-.75.75m9.25-4.5v-8.5h-8.5v8.5z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const TEXT: IconDef = IconDef { + name: "TextIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M3.25 4A.75.75 0 0 1 4 3.25h16a.75.75 0 0 1 .75.75v2.667a.75.75 0 0 1-1.5 0V4.75h-6.5v14.5H16a.75.75 0 0 1 0 1.5H8a.75.75 0 0 1 0-1.5h3.25V4.75h-6.5v1.917a.75.75 0 0 1-1.5 0z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const ADD_TEXT: IconDef = IconDef { + name: "AddTextIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M6.25 5A.75.75 0 0 1 7 4.25h14a.75.75 0 0 1 .75.75v2.333a.75.75 0 0 1-1.5 0V5.75h-5.5v12.5h2.75a.75.75 0 0 1 0 1.5h-7a.75.75 0 0 1 0-1.5h2.75V5.75h-5.5v1.583a.75.75 0 1 1-1.5 0z", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + IconPath { d: "M1.25 13a.75.75 0 0 1 .75-.75h5a.75.75 0 0 1 0 1.5H2a.75.75 0 0 1-.75-.75", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + IconPath { d: "M4.5 16.25a.75.75 0 0 1-.75-.75v-5a.75.75 0 0 1 1.5 0v5a.75.75 0 0 1-.75.75", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const ZOOM_IN: IconDef = IconDef { + name: "ZoomUpIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M11.115 4.885a6.23 6.23 0 1 0 4.408 10.634 6.23 6.23 0 0 0-4.408-10.634m5.854 11.102a7.615 7.615 0 1 0-.979.98l4.328 4.33a.692.692 0 1 0 .98-.979zm-5.854-8.333c.383 0 .693.31.693.692v2.077h2.077a.692.692 0 1 1 0 1.385h-2.077v2.077a.692.692 0 1 1-1.385 0v-2.077H8.346a.692.692 0 0 1 0-1.385h2.077V8.346c0-.382.31-.692.692-.692", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const ZOOM_OUT: IconDef = IconDef { + name: "ZoomDownIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M11.115 4.885a6.23 6.23 0 1 0 0 12.461 6.23 6.23 0 0 0 0-12.461M3.5 11.115a7.615 7.615 0 1 1 13.468 4.874l4.33 4.33a.692.692 0 1 1-.98.978l-4.33-4.33A7.615 7.615 0 0 1 3.5 11.116m4.154 0c0-.382.31-.692.692-.692h5.539a.692.692 0 1 1 0 1.385H8.346a.69.69 0 0 1-.692-.693", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const PLUS: IconDef = IconDef { + name: "PlusIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M12 4.5c.46 0 .833.373.833.833v5.834h5.834a.833.833 0 0 1 0 1.666h-5.834v5.834a.833.833 0 0 1-1.666 0v-5.834H5.333a.833.833 0 0 1 0-1.666h5.834V5.333c0-.46.373-.833.833-.833", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const MINUS: IconDef = IconDef { + name: "MinusIcon", + view_box: "0 0 24 24", + paths: &[ + IconPath { d: "M4.5 12c0-.46.373-.833.833-.833h13.334a.833.833 0 0 1 0 1.666H5.333A.833.833 0 0 1 4.5 12", fill_rule: "evenodd", clip_rule: "evenodd", fill: "currentColor", stroke: "", stroke_width: 0.0_f32, stroke_linecap: "", stroke_linejoin: "" }, + ], +}; + +pub const ALL_ICONS: &[IconDef] = &[ + ADD_TEXT, + BOLD, + BRUSH, + BULLETED_LIST, + CHECKBOX_CHECKED_LINEAR, + CHECKBOX_CHECKED_SOLID, + CHECKBOX_UNCHECKED, + CODE_BLOCK, + INLINE_CODE, + CONNECTOR_CURVE, + CONNECTOR_ELBOW, + CONNECTOR_STRAIGHT, + COPY, + DELETE, + DIAMOND, + DIVIDER, + DRAG_HANDLE, + EDGELESS, + FRAME, + HAND, + HEADING_1, + HEADING_2, + HEADING_3, + HEADING_4, + HEADING_5, + HEADING_6, + ITALIC, + LINK, + LINKED_PAGE, + MINUS, + NOTE, + NUMBERED_LIST, + PAGE, + PEN, + PLUS, + QUOTE, + ROUNDED_RECTANGLE, + SELECT, + SHAPE, + SQUARE, + STRIKETHROUGH, + TEXT, + TOGGLE_DOWN, + TOGGLE_RIGHT, + TRIANGLE, + UNDERLINE, + ZOOM_OUT, + ZOOM_IN, +]; + +pub fn icon_by_name(name: &str) -> Option<&'static IconDef> { + ALL_ICONS + .binary_search_by_key(&name, |icon| icon.name) + .ok() + .map(|idx| &ALL_ICONS[idx]) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn icons_are_sorted_in_rust_ord_and_round_trip() { + for pair in ALL_ICONS.windows(2) { + assert!( + pair[0].name < pair[1].name, + "ALL_ICONS not strictly sorted: {:?} >= {:?}", + pair[0].name, + pair[1].name + ); + } + for icon in ALL_ICONS { + assert_eq!(icon_by_name(icon.name), Some(icon)); + } + assert_eq!(icon_by_name("LinkIcon"), Some(&LINK)); + assert_eq!(icon_by_name("LinkedPageIcon"), Some(&LINKED_PAGE)); + } + + #[test] + fn drag_handle_preserves_inherited_fill_none_and_stroke_attributes() { + assert!(!DRAG_HANDLE.paths.is_empty()); + let stroked: Vec<&IconPath> = DRAG_HANDLE + .paths + .iter() + .filter(|p| !p.stroke.is_empty()) + .collect(); + assert!(!stroked.is_empty(), "DRAG_HANDLE must contain stroked paths"); + for path in stroked { + assert_eq!(path.fill, "none"); + assert!((path.stroke_width - 0.5).abs() < 1e-6); + } + } +} diff --git a/blocksuite/native-playground/tokens/style-oracle.json b/blocksuite/native-playground/tokens/style-oracle.json new file mode 100644 index 0000000000..97067bb0da --- /dev/null +++ b/blocksuite/native-playground/tokens/style-oracle.json @@ -0,0 +1,2827 @@ +{ + "schema_version": 1, + "viewport": { + "width": 1280, + "height": 800 + }, + "themes": { + "light": { + "theme": "light", + "viewport": { + "width": 1280, + "height": 800 + }, + "root_css_vars": { + "--affine-theme-mode": "light", + "--affine-font-family": "\"Inter\", \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\",\"Segoe UI Symbol\", \"Noto Color Emoji\"", + "--affine-font-code-family": "\"IBM Plex Mono\", \"Space Mono\", Consolas, Menlo, Monaco, Courier, monospace, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\",\"Segoe UI Symbol\", \"Noto Color Emoji\"", + "--affine-font-base": "15px", + "--affine-font-sm": "14px", + "--affine-font-xs": "12px", + "--affine-font-h-1": "28px", + "--affine-font-h-2": "26px", + "--affine-font-h-3": "24px", + "--affine-font-h-4": "22px", + "--affine-font-h-5": "20px", + "--affine-font-h-6": "18px", + "--affine-line-height": "calc(1em + 8px)", + "--affine-editor-width": "944px", + "--affine-paragraph-space": "8px", + "--affine-popover-radius": "12px", + "--affine-text-primary-color": "rgb(18, 18, 18)", + "--affine-text-secondary-color": "rgb(142, 141, 145)", + "--affine-background-primary-color": "rgb(255, 255, 255)", + "--affine-background-code-block": "rgba(247, 248, 250, 1)", + "--affine-divider-color": "rgb(227, 226, 228)", + "--affine-quote-color": "rgba(194, 193, 197, 1)", + "--affine-link-color": "#1E67AF", + "--affine-edgeless-grid-color": "rgb(230, 230, 230)" + }, + "page_blocks": { + "page_title": { + "tag": "div", + "class_name": " inline-editor ", + "rect": { + "x": 0, + "y": -88, + "width": 752, + "height": 50 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "40px", + "font_weight": "700", + "font_style": "normal", + "line_height": "50px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 40 + }, + "note": { + "tag": "affine-note", + "class_name": "", + "rect": { + "x": 0, + "y": 0, + "width": 752, + "height": 969 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": null + }, + "h1": { + "tag": "div", + "class_name": " affine-paragraph-rich-text-wrapper h1 blocksuite-toggle-button-parent ", + "rect": { + "x": 0, + "y": 18, + "width": 752, + "height": 36 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "28px", + "font_weight": "700", + "font_style": "normal", + "line_height": "36px", + "letter_spacing": "-0.56px", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "18px", + "margin_right": "0px", + "margin_bottom": "10px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 29 + }, + "h2": { + "tag": "div", + "class_name": " affine-paragraph-rich-text-wrapper h2 blocksuite-toggle-button-parent ", + "rect": { + "x": 0, + "y": 68, + "width": 752, + "height": 36 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "26px", + "font_weight": "600", + "font_style": "normal", + "line_height": "36px", + "letter_spacing": "-0.52px", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "14px", + "margin_right": "0px", + "margin_bottom": "10px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 28 + }, + "h3": { + "tag": "div", + "class_name": " affine-paragraph-rich-text-wrapper h3 blocksuite-toggle-button-parent ", + "rect": { + "x": 0, + "y": 116, + "width": 752, + "height": 32 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "24px", + "font_weight": "600", + "font_style": "normal", + "line_height": "32px", + "letter_spacing": "-0.48px", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "12px", + "margin_right": "0px", + "margin_bottom": "10px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 25 + }, + "h4": { + "tag": "div", + "class_name": " affine-paragraph-rich-text-wrapper h4 blocksuite-toggle-button-parent ", + "rect": { + "x": 0, + "y": 160, + "width": 752, + "height": 30 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "22px", + "font_weight": "600", + "font_style": "normal", + "line_height": "30px", + "letter_spacing": "-0.33px", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "12px", + "margin_right": "0px", + "margin_bottom": "10px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 24 + }, + "h5": { + "tag": "div", + "class_name": " affine-paragraph-rich-text-wrapper h5 blocksuite-toggle-button-parent ", + "rect": { + "x": 0, + "y": 202, + "width": 752, + "height": 28 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "20px", + "font_weight": "600", + "font_style": "normal", + "line_height": "28px", + "letter_spacing": "-0.3px", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "12px", + "margin_right": "0px", + "margin_bottom": "10px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 21 + }, + "h6": { + "tag": "div", + "class_name": " affine-paragraph-rich-text-wrapper h6 blocksuite-toggle-button-parent ", + "rect": { + "x": 0, + "y": 242, + "width": 752, + "height": 26 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "18px", + "font_weight": "600", + "font_style": "normal", + "line_height": "26px", + "letter_spacing": "-0.27px", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "12px", + "margin_right": "0px", + "margin_bottom": "10px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 20 + }, + "paragraph_rich": { + "tag": "div", + "class_name": " affine-paragraph-rich-text-wrapper text blocksuite-toggle-button-parent ", + "rect": { + "x": 0, + "y": 278, + "width": 752, + "height": 23 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 17 + }, + "quote": { + "tag": "div", + "class_name": " affine-paragraph-rich-text-wrapper quote blocksuite-toggle-button-parent ", + "rect": { + "x": 0, + "y": 311, + "width": 752, + "height": 46 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "26px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "10px", + "padding_right": "0px", + "padding_bottom": "10px", + "padding_left": "17px", + "margin_top": "8px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 29 + }, + "list_bulleted": { + "tag": "div", + "class_name": "affine-list-block-container", + "rect": { + "x": 0, + "y": 367, + "width": 752, + "height": 58 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "4px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 17 + }, + "list_bulleted_nested": { + "tag": "div", + "class_name": "affine-list-block-container", + "rect": { + "x": 24, + "y": 401, + "width": 728, + "height": 24 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "4px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 17 + }, + "list_numbered": { + "tag": "div", + "class_name": "affine-list-block-container", + "rect": { + "x": 0, + "y": 435, + "width": 752, + "height": 24 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "4px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 17 + }, + "list_todo_unchecked": { + "tag": "div", + "class_name": "affine-list-block-container", + "rect": { + "x": 0, + "y": 469, + "width": 752, + "height": 24 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "4px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 17 + }, + "list_todo_checked": { + "tag": "div", + "class_name": "affine-list-block-container", + "rect": { + "x": 0, + "y": 503, + "width": 752, + "height": 24 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "4px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 17 + }, + "list_toggle": { + "tag": "div", + "class_name": "affine-list-block-container", + "rect": { + "x": 0, + "y": 537, + "width": 752, + "height": 56 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "4px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 17 + }, + "list_toggle_child": { + "tag": "div", + "class_name": " affine-paragraph-rich-text-wrapper text blocksuite-toggle-button-parent ", + "rect": { + "x": 24, + "y": 570, + "width": 728, + "height": 23 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 17 + }, + "code": { + "tag": "div", + "class_name": " affine-code-block-container ", + "rect": { + "x": 0, + "y": 611, + "width": 752, + "height": 124 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgb(247, 248, 250)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "10px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "12px", + "font_weight": "400", + "font_style": "normal", + "line_height": "20px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "32px", + "padding_right": "20px", + "padding_bottom": "32px", + "padding_left": "20px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 46 + }, + "divider": { + "tag": "div", + "class_name": "affine-divider-block-container", + "rect": { + "x": 0, + "y": 753, + "width": 752, + "height": 36 + }, + "computed": { + "display": "flex", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "18px", + "padding_right": "8px", + "padding_bottom": "18px", + "padding_left": "8px", + "margin_top": "8px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": null + }, + "bookmark": { + "tag": "div", + "class_name": "affine-bookmark-card horizontal ", + "rect": { + "x": 0, + "y": 807, + "width": 752, + "height": 116 + }, + "computed": { + "display": "flex", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgb(255, 255, 255)", + "border_top_color": "rgb(243, 243, 243)", + "border_top_width": "1px", + "border_radius": "8px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": null + }, + "divider_hr": { + "tag": "hr", + "class_name": "", + "rect": { + "x": 8, + "y": 770.5, + "width": 736, + "height": 1 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(128, 128, 128)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(227, 226, 228)", + "border_top_width": "1px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "7.5px", + "margin_right": "0px", + "margin_bottom": "7.5px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": null + }, + "list_todo_prefix": { + "tag": "div", + "class_name": "affine-list-block__prefix affine-list-block__todo-prefix ", + "rect": { + "x": 0, + "y": 469, + "width": 24, + "height": 24 + }, + "computed": { + "display": "flex", + "box_sizing": "border-box", + "color": "rgb(119, 117, 125)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(119, 117, 125)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "14px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": null + }, + "code_inline_editor": { + "tag": "div", + "class_name": " inline-editor nowrap-lines ", + "rect": { + "x": 20, + "y": 643, + "width": 708, + "height": 60 + }, + "computed": { + "display": "grid", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "\"IBM Plex Mono\", \"Space Mono\", Consolas, Menlo, Monaco, Courier, monospace, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "12px", + "font_weight": "400", + "font_style": "normal", + "line_height": "20px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 14 + } + }, + "quote_accent_bar": { + "content": "\"\"", + "position": "absolute", + "width": "2px", + "height": "26px", + "left": "0px", + "top": "0px", + "margin_top": "10px", + "margin_bottom": "10px", + "background_color": "rgb(194, 193, 197)", + "border_radius": "18px" + }, + "inline_formats": { + "bold": { + "tag": "span", + "class_name": "", + "rect": { + "x": 38.91, + "y": 279, + "width": 33.44, + "height": 20 + }, + "computed": { + "display": "inline", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "700", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 16 + }, + "italic": { + "tag": "span", + "class_name": "", + "rect": { + "x": 76.25, + "y": 279, + "width": 32.91, + "height": 20 + }, + "computed": { + "display": "inline", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "italic", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 16 + }, + "underline": { + "tag": "span", + "class_name": "", + "rect": { + "x": 113.06, + "y": 279, + "width": 69.59, + "height": 20 + }, + "computed": { + "display": "inline", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "underline", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 16 + }, + "strike": { + "tag": "span", + "class_name": "", + "rect": { + "x": 186.56, + "y": 279, + "width": 40.19, + "height": 20 + }, + "computed": { + "display": "inline", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "line-through", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 16 + }, + "inline_code": { + "tag": "code", + "class_name": "", + "rect": { + "x": 230.66, + "y": 281, + "width": 96.42, + "height": 18 + }, + "computed": { + "display": "inline", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgb(247, 248, 250)", + "border_top_color": "rgb(227, 226, 228)", + "border_top_width": "1px", + "border_radius": "4px", + "box_shadow": "none", + "font_family": "\"IBM Plex Mono\", \"Space Mono\", Consolas, Menlo, Monaco, Courier, monospace, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "12px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "4px", + "padding_bottom": "2px", + "padding_left": "4px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 12 + }, + "link": { + "tag": "a", + "class_name": "", + "rect": { + "x": 330.98, + "y": 279, + "width": 70.52, + "height": 20 + }, + "computed": { + "display": "inline", + "box_sizing": "border-box", + "color": "rgb(30, 103, 175)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(30, 103, 175)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 16 + }, + "reference": { + "tag": "affine-reference", + "class_name": "", + "rect": { + "x": 405.41, + "y": 278, + "width": 166.94, + "height": 22 + }, + "computed": { + "display": "inline", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 17 + } + }, + "edgeless_blocks": { + "edgeless_root": { + "tag": "affine-edgeless-root", + "class_name": "", + "rect": { + "x": 0, + "y": 0, + "width": 1280, + "height": 800 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(0, 0, 0)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(0, 0, 0)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "16px", + "font_weight": "400", + "font_style": "normal", + "line_height": "normal", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": null + }, + "edgeless_note": { + "tag": "affine-edgeless-note", + "class_name": "block-active", + "rect": { + "x": 50, + "y": 131.82, + "width": 715.15, + "height": 912.71 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(18, 18, 18)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "16px", + "font_weight": "400", + "font_style": "normal", + "line_height": "normal", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": null + }, + "edgeless_note_background": { + "tag": "edgeless-note-background", + "class_name": "edgeless-note-background_background__1teuqrt0", + "rect": { + "x": 50, + "y": 131.82, + "width": 715.15, + "height": 912.71 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(18, 18, 18)", + "background_color": "rgb(255, 255, 255)", + "border_top_color": "rgba(0, 0, 0, 0.1)", + "border_top_width": "0px", + "border_radius": "8px", + "box_shadow": "rgba(0, 0, 0, 0.14) 0px 0px 4px 0px, rgba(0, 0, 0, 0.14) 0px 2px 12px 0px", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "16px", + "font_weight": "400", + "font_style": "normal", + "line_height": "24px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": null + } + }, + "edgeless_surface_models": { + "shape_rect": { + "type": "shape", + "shapeType": "rect", + "xywh": "[900, 80, 180, 100]", + "fillColor": "#fcd34d", + "strokeColor": "#fcd34d", + "strokeWidth": 4, + "radius": 0.1 + }, + "shape_ellipse": { + "type": "shape", + "shapeType": "ellipse", + "xywh": "[1160, 80, 160, 100]", + "fillColor": "#fcd34d", + "strokeColor": "#fcd34d", + "strokeWidth": 4 + }, + "connector": { + "type": "connector", + "mode": 1, + "stroke": "#929292", + "strokeWidth": 4, + "strokeStyle": "solid", + "frontEndpointStyle": "None", + "rearEndpointStyle": "Arrow", + "path": [ + [ + 0, + 0 + ], + [ + 80, + 0 + ] + ], + "absolutePath": [ + [ + 1080, + 130 + ], + [ + 1160, + 130 + ] + ], + "labelXYWH": null + } + }, + "transitions": { + "paragraph_container": { + "property": "all", + "duration": "0s", + "timing_function": "ease" + }, + "bookmark_card": { + "property": "all", + "duration": "0s", + "timing_function": "ease" + }, + "edgeless_note_background_editing": { + "property": "left, top, width, height", + "duration": "0.3s, 0.3s, 0.3s, 0.3s", + "timing_function": "ease, ease, ease, ease" + }, + "edgeless_note_background": { + "property": "all", + "duration": "0s", + "timing_function": "ease" + } + } + }, + "dark": { + "theme": "dark", + "viewport": { + "width": 1280, + "height": 800 + }, + "root_css_vars": { + "--affine-theme-mode": "dark", + "--affine-font-family": "\"Inter\", \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\",\"Segoe UI Symbol\", \"Noto Color Emoji\"", + "--affine-font-code-family": "\"IBM Plex Mono\", \"Space Mono\", Consolas, Menlo, Monaco, Courier, monospace, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\",\"Segoe UI Symbol\", \"Noto Color Emoji\"", + "--affine-font-base": "15px", + "--affine-font-sm": "14px", + "--affine-font-xs": "12px", + "--affine-font-h-1": "28px", + "--affine-font-h-2": "26px", + "--affine-font-h-3": "24px", + "--affine-font-h-4": "22px", + "--affine-font-h-5": "20px", + "--affine-font-h-6": "18px", + "--affine-line-height": "calc(1em + 8px)", + "--affine-editor-width": "944px", + "--affine-paragraph-space": "8px", + "--affine-popover-radius": "12px", + "--affine-text-primary-color": "rgb(234, 234, 234)", + "--affine-text-secondary-color": "rgb(156, 156, 160)", + "--affine-background-primary-color": "rgb(20, 20, 20)", + "--affine-background-code-block": "rgba(31, 32, 34, 1)", + "--affine-divider-color": "rgb(114, 114, 114)", + "--affine-quote-color": "rgba(142, 141, 145, 1)", + "--affine-link-color": "#78BEFF", + "--affine-edgeless-grid-color": "rgba(49, 49, 49, .35)" + }, + "page_blocks": { + "page_title": { + "tag": "div", + "class_name": " inline-editor ", + "rect": { + "x": 0, + "y": -88, + "width": 752, + "height": 50 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "40px", + "font_weight": "700", + "font_style": "normal", + "line_height": "50px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 39 + }, + "note": { + "tag": "affine-note", + "class_name": "", + "rect": { + "x": 0, + "y": 0, + "width": 752, + "height": 970 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": null + }, + "h1": { + "tag": "div", + "class_name": " affine-paragraph-rich-text-wrapper h1 blocksuite-toggle-button-parent ", + "rect": { + "x": 0, + "y": 18, + "width": 752, + "height": 36 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "28px", + "font_weight": "700", + "font_style": "normal", + "line_height": "36px", + "letter_spacing": "-0.56px", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "18px", + "margin_right": "0px", + "margin_bottom": "10px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 28 + }, + "h2": { + "tag": "div", + "class_name": " affine-paragraph-rich-text-wrapper h2 blocksuite-toggle-button-parent ", + "rect": { + "x": 0, + "y": 68, + "width": 752, + "height": 36 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "26px", + "font_weight": "600", + "font_style": "normal", + "line_height": "36px", + "letter_spacing": "-0.52px", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "14px", + "margin_right": "0px", + "margin_bottom": "10px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 27 + }, + "h3": { + "tag": "div", + "class_name": " affine-paragraph-rich-text-wrapper h3 blocksuite-toggle-button-parent ", + "rect": { + "x": 0, + "y": 116, + "width": 752, + "height": 32 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "24px", + "font_weight": "600", + "font_style": "normal", + "line_height": "32px", + "letter_spacing": "-0.48px", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "12px", + "margin_right": "0px", + "margin_bottom": "10px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 24 + }, + "h4": { + "tag": "div", + "class_name": " affine-paragraph-rich-text-wrapper h4 blocksuite-toggle-button-parent ", + "rect": { + "x": 0, + "y": 160, + "width": 752, + "height": 30 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "22px", + "font_weight": "600", + "font_style": "normal", + "line_height": "30px", + "letter_spacing": "-0.33px", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "12px", + "margin_right": "0px", + "margin_bottom": "10px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 23 + }, + "h5": { + "tag": "div", + "class_name": " affine-paragraph-rich-text-wrapper h5 blocksuite-toggle-button-parent ", + "rect": { + "x": 0, + "y": 202, + "width": 752, + "height": 28 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "20px", + "font_weight": "600", + "font_style": "normal", + "line_height": "28px", + "letter_spacing": "-0.3px", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "12px", + "margin_right": "0px", + "margin_bottom": "10px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 21 + }, + "h6": { + "tag": "div", + "class_name": " affine-paragraph-rich-text-wrapper h6 blocksuite-toggle-button-parent ", + "rect": { + "x": 0, + "y": 242, + "width": 752, + "height": 26 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "18px", + "font_weight": "600", + "font_style": "normal", + "line_height": "26px", + "letter_spacing": "-0.27px", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "12px", + "margin_right": "0px", + "margin_bottom": "10px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 19 + }, + "paragraph_rich": { + "tag": "div", + "class_name": " affine-paragraph-rich-text-wrapper text blocksuite-toggle-button-parent ", + "rect": { + "x": 0, + "y": 278, + "width": 752, + "height": 24 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 17 + }, + "quote": { + "tag": "div", + "class_name": " affine-paragraph-rich-text-wrapper quote blocksuite-toggle-button-parent ", + "rect": { + "x": 0, + "y": 312, + "width": 752, + "height": 46 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "26px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "10px", + "padding_right": "0px", + "padding_bottom": "10px", + "padding_left": "17px", + "margin_top": "8px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 28 + }, + "list_bulleted": { + "tag": "div", + "class_name": "affine-list-block-container", + "rect": { + "x": 0, + "y": 368, + "width": 752, + "height": 58 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "4px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 17 + }, + "list_bulleted_nested": { + "tag": "div", + "class_name": "affine-list-block-container", + "rect": { + "x": 24, + "y": 402, + "width": 728, + "height": 24 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "4px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 17 + }, + "list_numbered": { + "tag": "div", + "class_name": "affine-list-block-container", + "rect": { + "x": 0, + "y": 436, + "width": 752, + "height": 24 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "4px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 17 + }, + "list_todo_unchecked": { + "tag": "div", + "class_name": "affine-list-block-container", + "rect": { + "x": 0, + "y": 470, + "width": 752, + "height": 24 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "4px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 17 + }, + "list_todo_checked": { + "tag": "div", + "class_name": "affine-list-block-container", + "rect": { + "x": 0, + "y": 504, + "width": 752, + "height": 24 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "4px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 17 + }, + "list_toggle": { + "tag": "div", + "class_name": "affine-list-block-container", + "rect": { + "x": 0, + "y": 538, + "width": 752, + "height": 56 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "4px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 17 + }, + "list_toggle_child": { + "tag": "div", + "class_name": " affine-paragraph-rich-text-wrapper text blocksuite-toggle-button-parent ", + "rect": { + "x": 24, + "y": 571, + "width": 728, + "height": 23 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 17 + }, + "code": { + "tag": "div", + "class_name": " affine-code-block-container ", + "rect": { + "x": 0, + "y": 612, + "width": 752, + "height": 124 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgb(31, 32, 34)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "10px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "12px", + "font_weight": "400", + "font_style": "normal", + "line_height": "20px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "32px", + "padding_right": "20px", + "padding_bottom": "32px", + "padding_left": "20px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 46 + }, + "divider": { + "tag": "div", + "class_name": "affine-divider-block-container", + "rect": { + "x": 0, + "y": 754, + "width": 752, + "height": 36 + }, + "computed": { + "display": "flex", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "18px", + "padding_right": "8px", + "padding_bottom": "18px", + "padding_left": "8px", + "margin_top": "8px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": null + }, + "bookmark": { + "tag": "div", + "class_name": "affine-bookmark-card horizontal ", + "rect": { + "x": 0, + "y": 808, + "width": 752, + "height": 116 + }, + "computed": { + "display": "flex", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgb(20, 20, 20)", + "border_top_color": "rgb(86, 86, 86)", + "border_top_width": "1px", + "border_radius": "8px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": null + }, + "divider_hr": { + "tag": "hr", + "class_name": "", + "rect": { + "x": 8, + "y": 771.5, + "width": 736, + "height": 1 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(128, 128, 128)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(114, 114, 114)", + "border_top_width": "1px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "7.5px", + "margin_right": "0px", + "margin_bottom": "7.5px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": null + }, + "list_todo_prefix": { + "tag": "div", + "class_name": "affine-list-block__prefix affine-list-block__todo-prefix ", + "rect": { + "x": 0, + "y": 470, + "width": 24, + "height": 24 + }, + "computed": { + "display": "flex", + "box_sizing": "border-box", + "color": "rgb(168, 168, 160)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(168, 168, 160)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "14px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": null + }, + "code_inline_editor": { + "tag": "div", + "class_name": " inline-editor nowrap-lines ", + "rect": { + "x": 20, + "y": 644, + "width": 708, + "height": 60 + }, + "computed": { + "display": "grid", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "\"IBM Plex Mono\", \"Space Mono\", Consolas, Menlo, Monaco, Courier, monospace, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "12px", + "font_weight": "400", + "font_style": "normal", + "line_height": "20px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 14 + } + }, + "quote_accent_bar": { + "content": "\"\"", + "position": "absolute", + "width": "2px", + "height": "26px", + "left": "0px", + "top": "0px", + "margin_top": "10px", + "margin_bottom": "10px", + "background_color": "rgb(142, 141, 145)", + "border_radius": "18px" + }, + "inline_formats": { + "bold": { + "tag": "span", + "class_name": "", + "rect": { + "x": 39.5, + "y": 280, + "width": 33, + "height": 19 + }, + "computed": { + "display": "inline", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "700", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 15 + }, + "italic": { + "tag": "span", + "class_name": "", + "rect": { + "x": 76.5, + "y": 280, + "width": 33, + "height": 19 + }, + "computed": { + "display": "inline", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "italic", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 15 + }, + "underline": { + "tag": "span", + "class_name": "", + "rect": { + "x": 113.5, + "y": 280, + "width": 70, + "height": 19 + }, + "computed": { + "display": "inline", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "underline", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 15 + }, + "strike": { + "tag": "span", + "class_name": "", + "rect": { + "x": 187.5, + "y": 280, + "width": 42, + "height": 19 + }, + "computed": { + "display": "inline", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "line-through", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 15 + }, + "inline_code": { + "tag": "code", + "class_name": "", + "rect": { + "x": 233.5, + "y": 282, + "width": 94, + "height": 19 + }, + "computed": { + "display": "inline", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgb(31, 32, 34)", + "border_top_color": "rgb(46, 46, 46)", + "border_top_width": "1px", + "border_radius": "4px", + "box_shadow": "none", + "font_family": "\"IBM Plex Mono\", \"Space Mono\", Consolas, Menlo, Monaco, Courier, monospace, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "12px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "4px", + "padding_bottom": "2px", + "padding_left": "4px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 13 + }, + "link": { + "tag": "a", + "class_name": "", + "rect": { + "x": 331.5, + "y": 280, + "width": 71, + "height": 19 + }, + "computed": { + "display": "inline", + "box_sizing": "border-box", + "color": "rgb(120, 190, 255)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(120, 190, 255)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 15 + }, + "reference": { + "tag": "affine-reference", + "class_name": "", + "rect": { + "x": 406.5, + "y": 279, + "width": 169.75, + "height": 21 + }, + "computed": { + "display": "inline", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "15px", + "font_weight": "400", + "font_style": "normal", + "line_height": "23px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": 16 + } + }, + "edgeless_blocks": { + "edgeless_root": { + "tag": "affine-edgeless-root", + "class_name": "", + "rect": { + "x": 0, + "y": 0, + "width": 1280, + "height": 800 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(0, 0, 0)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(0, 0, 0)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "16px", + "font_weight": "400", + "font_style": "normal", + "line_height": "normal", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": null + }, + "edgeless_note": { + "tag": "affine-edgeless-note", + "class_name": "block-active", + "rect": { + "x": 50, + "y": 131.82, + "width": 715.15, + "height": 912.71 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgba(0, 0, 0, 0)", + "border_top_color": "rgb(234, 234, 234)", + "border_top_width": "0px", + "border_radius": "0px", + "box_shadow": "none", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "16px", + "font_weight": "400", + "font_style": "normal", + "line_height": "normal", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": null + }, + "edgeless_note_background": { + "tag": "edgeless-note-background", + "class_name": "edgeless-note-background_background__1teuqrt0", + "rect": { + "x": 50, + "y": 131.82, + "width": 715.15, + "height": 912.71 + }, + "computed": { + "display": "block", + "box_sizing": "border-box", + "color": "rgb(234, 234, 234)", + "background_color": "rgb(37, 37, 37)", + "border_top_color": "rgba(255, 255, 255, 0.1)", + "border_top_width": "0px", + "border_radius": "8px", + "box_shadow": "rgba(255, 255, 255, 0.44) 0px 0px 2px 0px, rgba(0, 0, 0, 0.3) 0px 2px 12px 0px", + "font_family": "Inter, \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", + "font_size": "16px", + "font_weight": "400", + "font_style": "normal", + "line_height": "24px", + "letter_spacing": "normal", + "text_decoration_line": "none", + "padding_top": "0px", + "padding_right": "0px", + "padding_bottom": "0px", + "padding_left": "0px", + "margin_top": "0px", + "margin_right": "0px", + "margin_bottom": "0px", + "margin_left": "0px", + "transition_property": "all", + "transition_duration": "0s", + "transition_timing_function": "ease" + }, + "baseline_offset_px": null + } + }, + "edgeless_surface_models": { + "shape_rect": { + "type": "shape", + "shapeType": "rect", + "xywh": "[900, 80, 180, 100]", + "fillColor": "#fcd34d", + "strokeColor": "#fcd34d", + "strokeWidth": 4, + "radius": 0.1 + }, + "shape_ellipse": { + "type": "shape", + "shapeType": "ellipse", + "xywh": "[1160, 80, 160, 100]", + "fillColor": "#fcd34d", + "strokeColor": "#fcd34d", + "strokeWidth": 4 + }, + "connector": { + "type": "connector", + "mode": 1, + "stroke": "#929292", + "strokeWidth": 4, + "strokeStyle": "solid", + "frontEndpointStyle": "None", + "rearEndpointStyle": "Arrow", + "path": [ + [ + 0, + 0 + ], + [ + 80, + 0 + ] + ], + "absolutePath": [ + [ + 1080, + 130 + ], + [ + 1160, + 130 + ] + ], + "labelXYWH": null + } + }, + "transitions": { + "paragraph_container": { + "property": "all", + "duration": "0s", + "timing_function": "ease" + }, + "bookmark_card": { + "property": "all", + "duration": "0s", + "timing_function": "ease" + }, + "edgeless_note_background_editing": { + "property": "left, top, width, height", + "duration": "0.3s, 0.3s, 0.3s, 0.3s", + "timing_function": "ease, ease, ease, ease" + }, + "edgeless_note_background": { + "property": "all", + "duration": "0s", + "timing_function": "ease" + } + } + } + } +} diff --git a/blocksuite/native-playground/tokens/tokens.rs b/blocksuite/native-playground/tokens/tokens.rs new file mode 100644 index 0000000000..e719f95527 --- /dev/null +++ b/blocksuite/native-playground/tokens/tokens.rs @@ -0,0 +1,1628 @@ +// @generated by blocksuite/native-playground/tokens/extract-tokens.mjs +// Source: @toeverything/theme@1.1.23 (dist/style.css) +// Do not edit manually; regenerate with extract-tokens.mjs. + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct Rgba { + pub r: u8, + pub g: u8, + pub b: u8, + pub a: u8, +} + +impl Rgba { + pub const TRANSPARENT: Self = Self::new(0, 0, 0, 0); + + pub const fn new(r: u8, g: u8, b: u8, a: u8) -> Self { + Self { r, g, b, a } + } + + pub const fn to_u32(self) -> u32 { + ((self.r as u32) << 24) + | ((self.g as u32) << 16) + | ((self.b as u32) << 8) + | (self.a as u32) + } + + pub fn to_f32(self) -> [f32; 4] { + [ + self.r as f32 / 255.0, + self.g as f32 / 255.0, + self.b as f32 / 255.0, + self.a as f32 / 255.0, + ] + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ThemeMode { + Light, + Dark, +} + +#[derive(Debug, Clone, Copy)] +pub struct TypographyTokens { + pub font_family: &'static str, + pub font_serif_family: &'static str, + pub font_mono_family: &'static str, + pub font_sans_family: &'static str, + pub font_number_family: &'static str, + pub font_code_family: &'static str, + pub font_base_px: f32, + pub font_sm_px: f32, + pub font_xs_px: f32, + pub font_h1_px: f32, + pub font_h2_px: f32, + pub font_h3_px: f32, + pub font_h4_px: f32, + pub font_h5_px: f32, + pub font_h6_px: f32, + pub line_height_css: &'static str, + pub line_height_base_px: f32, + pub editor_width_px: f32, + pub paragraph_space_px: f32, + pub popover_radius_px: f32, + pub radii: &'static [(&'static str, f32)], +} + +pub const TYPOGRAPHY: TypographyTokens = TypographyTokens { + font_family: "\"Inter\", \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\",\"Segoe UI Symbol\", \"Noto Color Emoji\"", + font_serif_family: "\"Source Serif 4\", \"Noto Serif\" , serif, \"Cambria\", apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\",\"Segoe UI Symbol\", \"Noto Color Emoji\"", + font_mono_family: "\"Source Code Pro\", \"IBM Plex Mono\", \"Roboto Mono\",\"Noto Sans Mono\", \"Noto Sans CJK\", apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\",\"Segoe UI Symbol\", \"Noto Color Emoji\"", + font_sans_family: "\"Inter\", \"Source Sans 3\", Poppins, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\",\"Segoe UI Symbol\", \"Noto Color Emoji\"", + font_number_family: "\"Roboto Mono\", \"Noto Sans Mono\", apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\",\"Segoe UI Symbol\", \"Noto Color Emoji\"", + font_code_family: "\"IBM Plex Mono\", \"Space Mono\", Consolas, Menlo, Monaco, Courier, monospace, apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Tahoma, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\",\"Segoe UI Symbol\", \"Noto Color Emoji\"", + font_base_px: 15.0_f32, + font_sm_px: 14.0_f32, + font_xs_px: 12.0_f32, + font_h1_px: 28.0_f32, + font_h2_px: 26.0_f32, + font_h3_px: 24.0_f32, + font_h4_px: 22.0_f32, + font_h5_px: 20.0_f32, + font_h6_px: 18.0_f32, + line_height_css: "calc(1em + 8px)", + line_height_base_px: 23.0_f32, + editor_width_px: 944.0_f32, + paragraph_space_px: 8.0_f32, + popover_radius_px: 12.0_f32, + radii: &[ + ("--affine-popover-radius", 12.0_f32), + ], +}; + +#[derive(Debug, Clone, Copy)] +pub struct ThemeTokens { + pub brand: Rgba, + pub primary: Rgba, + pub secondary: Rgba, + pub text_primary: Rgba, + pub text_secondary: Rgba, + pub text_emphasis: Rgba, + pub text_disable: Rgba, + pub background_primary: Rgba, + pub background_secondary: Rgba, + pub background_tertiary: Rgba, + pub background_code_block: Rgba, + pub background_modal: Rgba, + pub background_overlay_panel: Rgba, + pub border: Rgba, + pub divider: Rgba, + pub quote: Rgba, + pub link: Rgba, + pub icon: Rgba, + pub icon_secondary: Rgba, + pub placeholder: Rgba, + pub hover: Rgba, + pub edgeless_grid: Rgba, + pub colors: &'static [(&'static str, Rgba)], + pub shadows: &'static [(&'static str, &'static str)], + pub note_palette: &'static [(&'static str, Rgba)], + pub shape_palette: &'static [(&'static str, Rgba)], + pub connector_palette: &'static [(&'static str, Rgba)], +} + +impl ThemeTokens { + pub fn color(&self, css_var: &str) -> Option { + self.colors + .binary_search_by_key(&css_var, |(name, _)| *name) + .ok() + .map(|idx| self.colors[idx].1) + } + + pub fn shadow(&self, css_var: &str) -> Option<&'static str> { + self.shadows + .binary_search_by_key(&css_var, |(name, _)| *name) + .ok() + .map(|idx| self.shadows[idx].1) + } +} + +pub const LIGHT_THEME: ThemeTokens = ThemeTokens { + brand: Rgba::new(30, 150, 235, 255), + primary: Rgba::new(30, 150, 235, 255), + secondary: Rgba::new(125, 145, 255, 255), + text_primary: Rgba::new(18, 18, 18, 255), + text_secondary: Rgba::new(142, 141, 145, 255), + text_emphasis: Rgba::new(30, 150, 235, 255), + text_disable: Rgba::new(169, 169, 173, 255), + background_primary: Rgba::new(255, 255, 255, 255), + background_secondary: Rgba::new(244, 244, 245, 255), + background_tertiary: Rgba::new(238, 238, 238, 255), + background_code_block: Rgba::new(247, 248, 250, 255), + background_modal: Rgba::new(0, 0, 0, 191), + background_overlay_panel: Rgba::new(251, 251, 252, 255), + border: Rgba::new(227, 226, 228, 255), + divider: Rgba::new(227, 226, 228, 255), + quote: Rgba::new(194, 193, 197, 255), + link: Rgba::new(30, 103, 175, 255), + icon: Rgba::new(119, 117, 125, 255), + icon_secondary: Rgba::new(119, 117, 125, 153), + placeholder: Rgba::new(192, 191, 193, 255), + hover: Rgba::new(0, 0, 0, 10), + edgeless_grid: Rgba::new(230, 230, 230, 255), + colors: &[ + ("--affine-background-code-block", Rgba::new(247, 248, 250, 255)), + ("--affine-background-error-color", Rgba::new(253, 236, 235, 255)), + ("--affine-background-modal-color", Rgba::new(0, 0, 0, 191)), + ("--affine-background-overlay-panel-color", Rgba::new(251, 251, 252, 255)), + ("--affine-background-primary-color", Rgba::new(255, 255, 255, 255)), + ("--affine-background-processing-color", Rgba::new(233, 241, 255, 255)), + ("--affine-background-secondary-color", Rgba::new(244, 244, 245, 255)), + ("--affine-background-success-color", Rgba::new(231, 250, 243, 255)), + ("--affine-background-tertiary-color", Rgba::new(238, 238, 238, 255)), + ("--affine-background-warning-color", Rgba::new(255, 237, 219, 255)), + ("--affine-black", Rgba::new(0, 0, 0, 255)), + ("--affine-black-10", Rgba::new(0, 0, 0, 26)), + ("--affine-black-30", Rgba::new(0, 0, 0, 77)), + ("--affine-black-50", Rgba::new(0, 0, 0, 128)), + ("--affine-black-60", Rgba::new(0, 0, 0, 153)), + ("--affine-black-80", Rgba::new(0, 0, 0, 204)), + ("--affine-black-90", Rgba::new(0, 0, 0, 230)), + ("--affine-blue", Rgba::new(30, 150, 235, 255)), + ("--affine-blue-100", Rgba::new(219, 244, 254, 255)), + ("--affine-blue-200", Rgba::new(191, 236, 254, 255)), + ("--affine-blue-300", Rgba::new(147, 226, 253, 255)), + ("--affine-blue-400", Rgba::new(96, 207, 250, 255)), + ("--affine-blue-50", Rgba::new(239, 250, 255, 255)), + ("--affine-blue-500", Rgba::new(58, 181, 247, 255)), + ("--affine-blue-600", Rgba::new(30, 150, 235, 255)), + ("--affine-blue-700", Rgba::new(28, 129, 217, 255)), + ("--affine-blue-800", Rgba::new(30, 103, 175, 255)), + ("--affine-blue-900", Rgba::new(30, 87, 138, 255)), + ("--affine-blue-950", Rgba::new(23, 54, 84, 255)), + ("--affine-border-color", Rgba::new(227, 226, 228, 255)), + ("--affine-brand-color", Rgba::new(30, 150, 235, 255)), + ("--affine-button-gray-color", Rgba::new(245, 245, 245, 255)), + ("--affine-divider-color", Rgba::new(227, 226, 228, 255)), + ("--affine-edgeless-grid-color", Rgba::new(230, 230, 230, 255)), + ("--affine-error-color", Rgba::new(235, 67, 53, 255)), + ("--affine-hover-color", Rgba::new(0, 0, 0, 10)), + ("--affine-hover-color-filled", Rgba::new(245, 245, 245, 255)), + ("--affine-icon-color", Rgba::new(119, 117, 125, 255)), + ("--affine-icon-secondary", Rgba::new(119, 117, 125, 153)), + ("--affine-link-color", Rgba::new(30, 103, 175, 255)), + ("--affine-list-color", Rgba::new(133, 131, 140, 255)), + ("--affine-multi-players-blue", Rgba::new(24, 160, 251, 255)), + ("--affine-multi-players-brown", Rgba::new(154, 101, 51, 255)), + ("--affine-multi-players-green", Rgba::new(27, 196, 125, 255)), + ("--affine-multi-players-grey", Rgba::new(170, 170, 170, 255)), + ("--affine-multi-players-magenta", Rgba::new(245, 49, 179, 255)), + ("--affine-multi-players-orange", Rgba::new(255, 138, 0, 255)), + ("--affine-multi-players-purple", Rgba::new(123, 97, 255, 255)), + ("--affine-multi-players-red", Rgba::new(243, 87, 52, 255)), + ("--affine-note-background-black", Rgba::new(0, 0, 0, 255)), + ("--affine-note-background-blue", Rgba::new(205, 235, 255, 255)), + ("--affine-note-background-green", Rgba::new(201, 248, 193, 255)), + ("--affine-note-background-grey", Rgba::new(230, 230, 230, 255)), + ("--affine-note-background-magenta", Rgba::new(255, 218, 237, 255)), + ("--affine-note-background-orange", Rgba::new(255, 196, 143, 255)), + ("--affine-note-background-purple", Rgba::new(221, 214, 254, 255)), + ("--affine-note-background-red", Rgba::new(250, 182, 182, 255)), + ("--affine-note-background-teal", Rgba::new(199, 248, 242, 255)), + ("--affine-note-background-white", Rgba::new(255, 255, 255, 255)), + ("--affine-note-background-yellow", Rgba::new(253, 230, 138, 255)), + ("--affine-palette-line-black", Rgba::new(35, 35, 35, 255)), + ("--affine-palette-line-blue", Rgba::new(79, 144, 255, 255)), + ("--affine-palette-line-green", Rgba::new(124, 194, 112, 255)), + ("--affine-palette-line-grey", Rgba::new(191, 192, 191, 255)), + ("--affine-palette-line-magenta", Rgba::new(230, 96, 164, 255)), + ("--affine-palette-line-navy", Rgba::new(59, 37, 204, 255)), + ("--affine-palette-line-orange", Rgba::new(255, 175, 56, 255)), + ("--affine-palette-line-purple", Rgba::new(110, 82, 223, 255)), + ("--affine-palette-line-red", Rgba::new(237, 63, 63, 255)), + ("--affine-palette-line-tangerine", Rgba::new(250, 124, 69, 255)), + ("--affine-palette-line-teal", Rgba::new(122, 226, 213, 255)), + ("--affine-palette-line-white", Rgba::new(255, 255, 255, 255)), + ("--affine-palette-line-yellow", Rgba::new(255, 211, 56, 255)), + ("--affine-palette-shape-black", Rgba::new(35, 35, 35, 255)), + ("--affine-palette-shape-blue", Rgba::new(184, 227, 255, 255)), + ("--affine-palette-shape-green", Rgba::new(157, 209, 148, 255)), + ("--affine-palette-shape-grey", Rgba::new(216, 217, 216, 255)), + ("--affine-palette-shape-magenta", Rgba::new(237, 140, 189, 255)), + ("--affine-palette-shape-navy", Rgba::new(122, 149, 246, 255)), + ("--affine-palette-shape-orange", Rgba::new(255, 196, 107, 255)), + ("--affine-palette-shape-purple", Rgba::new(147, 126, 231, 255)), + ("--affine-palette-shape-red", Rgba::new(241, 111, 111, 255)), + ("--affine-palette-shape-tangerine", Rgba::new(251, 161, 121, 255)), + ("--affine-palette-shape-teal", Rgba::new(184, 242, 231, 255)), + ("--affine-palette-shape-white", Rgba::new(255, 255, 255, 255)), + ("--affine-palette-shape-yellow", Rgba::new(255, 223, 107, 255)), + ("--affine-placeholder-color", Rgba::new(192, 191, 193, 255)), + ("--affine-primary-color", Rgba::new(30, 150, 235, 255)), + ("--affine-primary-color-04", Rgba::new(30, 150, 235, 10)), + ("--affine-processing-color", Rgba::new(39, 118, 255, 255)), + ("--affine-pure-black", Rgba::new(0, 0, 0, 255)), + ("--affine-pure-black-10", Rgba::new(0, 0, 0, 26)), + ("--affine-pure-black-20", Rgba::new(0, 0, 0, 51)), + ("--affine-pure-black-80", Rgba::new(0, 0, 0, 204)), + ("--affine-pure-white", Rgba::new(255, 255, 255, 255)), + ("--affine-pure-white-10", Rgba::new(255, 255, 255, 26)), + ("--affine-quote-color", Rgba::new(194, 193, 197, 255)), + ("--affine-secondary-color", Rgba::new(125, 145, 255, 255)), + ("--affine-success-color", Rgba::new(16, 203, 134, 255)), + ("--affine-tag-blue", Rgba::new(225, 238, 255, 255)), + ("--affine-tag-gray", Rgba::new(227, 226, 224, 255)), + ("--affine-tag-green", Rgba::new(222, 244, 231, 255)), + ("--affine-tag-magenta", Rgba::new(249, 232, 255, 255)), + ("--affine-tag-orange", Rgba::new(255, 233, 201, 255)), + ("--affine-tag-pink", Rgba::new(251, 231, 255, 255)), + ("--affine-tag-purple", Rgba::new(243, 240, 255, 255)), + ("--affine-tag-red", Rgba::new(255, 225, 225, 255)), + ("--affine-tag-teal", Rgba::new(222, 244, 243, 255)), + ("--affine-tag-white", Rgba::new(245, 245, 245, 255)), + ("--affine-tag-yellow", Rgba::new(255, 243, 215, 255)), + ("--affine-tertiary-color", Rgba::new(239, 250, 255, 255)), + ("--affine-text-disable-color", Rgba::new(169, 169, 173, 255)), + ("--affine-text-emphasis-color", Rgba::new(30, 150, 235, 255)), + ("--affine-text-highlight-blue", Rgba::new(204, 226, 254, 255)), + ("--affine-text-highlight-foreground-blue", Rgba::new(33, 89, 211, 255)), + ("--affine-text-highlight-foreground-green", Rgba::new(20, 147, 67, 255)), + ("--affine-text-highlight-foreground-grey", Rgba::new(122, 122, 122, 255)), + ("--affine-text-highlight-foreground-orange", Rgba::new(211, 79, 11, 255)), + ("--affine-text-highlight-foreground-purple", Rgba::new(132, 46, 211, 255)), + ("--affine-text-highlight-foreground-red", Rgba::new(198, 34, 34, 255)), + ("--affine-text-highlight-foreground-teal", Rgba::new(7, 130, 160, 255)), + ("--affine-text-highlight-foreground-yellow", Rgba::new(182, 124, 4, 255)), + ("--affine-text-highlight-green", Rgba::new(225, 250, 177, 255)), + ("--affine-text-highlight-grey", Rgba::new(234, 236, 239, 255)), + ("--affine-text-highlight-orange", Rgba::new(254, 223, 187, 255)), + ("--affine-text-highlight-pink", Rgba::new(255, 206, 206, 255)), + ("--affine-text-highlight-purple", Rgba::new(237, 221, 255, 255)), + ("--affine-text-highlight-red", Rgba::new(254, 213, 213, 255)), + ("--affine-text-highlight-teal", Rgba::new(173, 248, 233, 255)), + ("--affine-text-highlight-yellow", Rgba::new(254, 243, 161, 255)), + ("--affine-text-primary-color", Rgba::new(18, 18, 18, 255)), + ("--affine-text-secondary-color", Rgba::new(142, 141, 145, 255)), + ("--affine-toggle-circle-background-color", Rgba::new(255, 255, 255, 255)), + ("--affine-toggle-disable-background-color", Rgba::new(119, 117, 125, 255)), + ("--affine-tooltip", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-aI-applyBackground", Rgba::new(146, 146, 146, 18)), + ("--affine-v2-aI-applyDeleteHighlight", Rgba::new(237, 63, 63, 33)), + ("--affine-v2-aI-applyTextHighlight", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-aI-applyTextHighlightBackground", Rgba::new(30, 150, 235, 20)), + ("--affine-v2-aI-errorBackground", Rgba::new(255, 244, 245, 255)), + ("--affine-v2-aI-errorDetailBackground", Rgba::new(255, 255, 255, 153)), + ("--affine-v2-aI-errorText", Rgba::new(237, 63, 63, 255)), + ("--affine-v2-aI-thinkingOutputBackground", Rgba::new(0, 0, 0, 13)), + ("--affine-v2-aI-thinkingOutputText", Rgba::new(0, 0, 0, 166)), + ("--affine-v2-aI-userTextBackground", Rgba::new(243, 243, 243, 255)), + ("--affine-v2-adjustmentHandle-background", Rgba::new(0, 0, 0, 133)), + ("--affine-v2-adjustmentHandle-border", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-backlinks-blockBackgroundColor", Rgba::new(146, 146, 146, 13)), + ("--affine-v2-backlinks-blockBorder", Rgba::new(146, 146, 146, 26)), + ("--affine-v2-backlinks-blockHover", Rgba::new(0, 0, 0, 13)), + ("--affine-v2-badge-believer", Rgba::new(0, 39, 66, 255)), + ("--affine-v2-badge-free", Rgba::new(41, 163, 250, 255)), + ("--affine-v2-badge-pro", Rgba::new(41, 163, 250, 255)), + ("--affine-v2-block-callout-background-blue", Rgba::new(230, 245, 255, 255)), + ("--affine-v2-block-callout-background-green", Rgba::new(249, 254, 231, 255)), + ("--affine-v2-block-callout-background-grey", Rgba::new(245, 245, 245, 255)), + ("--affine-v2-block-callout-background-magenta", Rgba::new(252, 244, 255, 255)), + ("--affine-v2-block-callout-background-orange", Rgba::new(255, 235, 213, 255)), + ("--affine-v2-block-callout-background-purple", Rgba::new(245, 243, 255, 255)), + ("--affine-v2-block-callout-background-red", Rgba::new(252, 229, 230, 255)), + ("--affine-v2-block-callout-background-teal", Rgba::new(226, 253, 249, 255)), + ("--affine-v2-block-callout-background-yellow", Rgba::new(255, 251, 235, 255)), + ("--affine-v2-block-callout-icon-blue", Rgba::new(83, 178, 239, 255)), + ("--affine-v2-block-callout-icon-green", Rgba::new(34, 191, 7, 255)), + ("--affine-v2-block-callout-icon-grey", Rgba::new(205, 205, 205, 255)), + ("--affine-v2-block-callout-icon-magenta", Rgba::new(204, 65, 135, 255)), + ("--affine-v2-block-callout-icon-orange", Rgba::new(255, 174, 99, 255)), + ("--affine-v2-block-callout-icon-purple", Rgba::new(124, 58, 237, 255)), + ("--affine-v2-block-callout-icon-red", Rgba::new(200, 48, 48, 255)), + ("--affine-v2-block-callout-icon-teal", Rgba::new(68, 142, 134, 255)), + ("--affine-v2-block-callout-icon-yellow", Rgba::new(253, 224, 71, 255)), + ("--affine-v2-block-code-lineNum", Rgba::new(179, 179, 179, 255)), + ("--affine-v2-block-comment-hanelActive", Rgba::new(30, 150, 235, 5)), + ("--affine-v2-block-comment-highlightActive", Rgba::new(30, 150, 235, 77)), + ("--affine-v2-block-comment-highlightDefault", Rgba::new(30, 150, 235, 20)), + ("--affine-v2-block-comment-highlightUnderline", Rgba::new(30, 150, 235, 178)), + ("--affine-v2-block-divider-divider", Rgba::new(146, 146, 146, 56)), + ("--affine-v2-block-footnote-numberBg", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-block-footnote-numberBgHover", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-block-list-header", Rgba::new(0, 119, 203, 255)), + ("--affine-v2-block-notSupportedBlock-background", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-block-notSupportedBlock-inlineBg-default", Rgba::new(243, 243, 243, 255)), + ("--affine-v2-block-notSupportedBlock-inlineBg-hover", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-block-recordBlock-buttonBg", Rgba::new(243, 243, 243, 255)), + ("--affine-v2-block-recordBlock-primary", Rgba::new(244, 83, 83, 255)), + ("--affine-v2-block-recordBlock-secordary", Rgba::new(255, 154, 154, 255)), + ("--affine-v2-block-recordBlock-timelineIndeicator", Rgba::new(237, 63, 63, 255)), + ("--affine-v2-button-actionActive", Rgba::new(30, 150, 235, 20)), + ("--affine-v2-button-badgesColor", Rgba::new(237, 63, 63, 255)), + ("--affine-v2-button-buttonOverHover", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-button-checkBox", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-button-disable", Rgba::new(179, 179, 179, 255)), + ("--affine-v2-button-emptyIconBackground", Rgba::new(0, 0, 0, 13)), + ("--affine-v2-button-error", Rgba::new(237, 63, 63, 255)), + ("--affine-v2-button-grabber-default", Rgba::new(0, 0, 0, 26)), + ("--affine-v2-button-grabber-select", Rgba::new(0, 0, 0, 56)), + ("--affine-v2-button-iconButtonSolid", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-button-innerBlackBorder", Rgba::new(0, 0, 0, 26)), + ("--affine-v2-button-mobile-aIActionBackground", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-button-mobile-deletedAction", Rgba::new(237, 63, 63, 255)), + ("--affine-v2-button-primary", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-button-pureWhiteText", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-button-secondary", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-button-sidebarButton-background", Rgba::new(255, 255, 255, 8)), + ("--affine-v2-button-siderbarPrimary-background", Rgba::new(255, 255, 255, 171)), + ("--affine-v2-button-signinbutton-background", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-button-success", Rgba::new(68, 185, 49, 255)), + ("--affine-v2-button-templateLabelBackground", Rgba::new(30, 150, 235, 10)), + ("--affine-v2-calendar-blue", Rgba::new(74, 177, 250, 255)), + ("--affine-v2-calendar-green", Rgba::new(68, 185, 49, 255)), + ("--affine-v2-calendar-grey", Rgba::new(179, 179, 179, 255)), + ("--affine-v2-calendar-magenta", Rgba::new(243, 127, 186, 255)), + ("--affine-v2-calendar-orange", Rgba::new(255, 174, 99, 255)), + ("--affine-v2-calendar-purple", Rgba::new(150, 129, 239, 255)), + ("--affine-v2-calendar-red", Rgba::new(244, 63, 72, 255)), + ("--affine-v2-calendar-teal", Rgba::new(139, 231, 220, 255)), + ("--affine-v2-calendar-yellow", Rgba::new(253, 224, 71, 255)), + ("--affine-v2-centerPeek-background", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-centerPeek-buttonBackground", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-centerPeek-icon", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-centerPeek-overlay", Rgba::new(0, 0, 0, 43)), + ("--affine-v2-chatBlock-chatBlockBg", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-chatBlock-chatBlockBoder", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-chatBlock-chatBlockIcon", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-chatBlock-chatBlockText", Rgba::new(20, 20, 20, 255)), + ("--affine-v2-chip-label-blue", Rgba::new(230, 245, 255, 255)), + ("--affine-v2-chip-label-green", Rgba::new(220, 253, 215, 255)), + ("--affine-v2-chip-label-grey", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-chip-label-magenta", Rgba::new(255, 236, 246, 255)), + ("--affine-v2-chip-label-orange", Rgba::new(255, 235, 213, 255)), + ("--affine-v2-chip-label-purple", Rgba::new(237, 233, 255, 255)), + ("--affine-v2-chip-label-red", Rgba::new(252, 229, 230, 255)), + ("--affine-v2-chip-label-teal", Rgba::new(215, 251, 246, 255)), + ("--affine-v2-chip-label-text", Rgba::new(0, 0, 0, 133)), + ("--affine-v2-chip-label-white", Rgba::new(245, 245, 245, 255)), + ("--affine-v2-chip-label-yellow", Rgba::new(254, 243, 199, 255)), + ("--affine-v2-chip-tag-blue", Rgba::new(132, 207, 255, 255)), + ("--affine-v2-chip-tag-green", Rgba::new(105, 184, 125, 255)), + ("--affine-v2-chip-tag-grey", Rgba::new(179, 179, 179, 255)), + ("--affine-v2-chip-tag-orange", Rgba::new(255, 140, 56, 255)), + ("--affine-v2-chip-tag-purple", Rgba::new(124, 58, 237, 255)), + ("--affine-v2-chip-tag-red", Rgba::new(237, 63, 63, 255)), + ("--affine-v2-chip-tag-teal", Rgba::new(139, 231, 220, 255)), + ("--affine-v2-chip-tag-yellow", Rgba::new(250, 204, 21, 255)), + ("--affine-v2-database-attachment-fileSolidBackground", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-database-border", Rgba::new(0, 0, 0, 26)), + ("--affine-v2-database-buttonBackground", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-database-cardHover", Rgba::new(0, 0, 0, 8)), + ("--affine-v2-database-filterHeaderFadeIn", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-database-filterHeaderFadeOut", Rgba::new(255, 255, 255, 8)), + ("--affine-v2-database-focusBackground", Rgba::new(30, 150, 235, 10)), + ("--affine-v2-database-textSecondary", Rgba::new(0, 0, 0, 133)), + ("--affine-v2-dialog-background-primary", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-edgeless-alignment-edgeGuides", Rgba::new(204, 65, 135, 255)), + ("--affine-v2-edgeless-alignment-guides", Rgba::new(139, 92, 246, 255)), + ("--affine-v2-edgeless-frame-background-black", Rgba::new(205, 205, 205, 255)), + ("--affine-v2-edgeless-frame-background-blue", Rgba::new(230, 245, 255, 255)), + ("--affine-v2-edgeless-frame-background-green", Rgba::new(241, 253, 244, 255)), + ("--affine-v2-edgeless-frame-background-grey", Rgba::new(243, 243, 243, 255)), + ("--affine-v2-edgeless-frame-background-magenta", Rgba::new(255, 236, 246, 255)), + ("--affine-v2-edgeless-frame-background-orange", Rgba::new(255, 235, 213, 255)), + ("--affine-v2-edgeless-frame-background-purple", Rgba::new(237, 233, 255, 255)), + ("--affine-v2-edgeless-frame-background-red", Rgba::new(252, 229, 230, 255)), + ("--affine-v2-edgeless-frame-background-teal", Rgba::new(226, 253, 249, 255)), + ("--affine-v2-edgeless-frame-background-white", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-edgeless-frame-background-yellow", Rgba::new(255, 251, 213, 255)), + ("--affine-v2-edgeless-frame-border-active", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-edgeless-frame-border-default", Rgba::new(0, 0, 0, 43)), + ("--affine-v2-edgeless-frame-fontColor-font", Rgba::new(0, 0, 0, 242)), + ("--affine-v2-edgeless-group-background-background", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-edgeless-group-border-active", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-edgeless-group-border-borderHint", Rgba::new(143, 209, 255, 255)), + ("--affine-v2-edgeless-group-border-hover", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-edgeless-group-fontColor-active", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-edgeless-group-fontColor-default", Rgba::new(0, 0, 0, 133)), + ("--affine-v2-edgeless-group-fontColor-hover", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-edgeless-group-fontColor-rename", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-edgeless-line-black", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-edgeless-line-blue", Rgba::new(41, 163, 250, 255)), + ("--affine-v2-edgeless-line-green", Rgba::new(60, 188, 54, 255)), + ("--affine-v2-edgeless-line-grey", Rgba::new(146, 146, 146, 255)), + ("--affine-v2-edgeless-line-magenta", Rgba::new(230, 96, 164, 255)), + ("--affine-v2-edgeless-line-orange", Rgba::new(255, 140, 56, 255)), + ("--affine-v2-edgeless-line-purple", Rgba::new(110, 82, 223, 255)), + ("--affine-v2-edgeless-line-red", Rgba::new(225, 30, 65, 255)), + ("--affine-v2-edgeless-line-teal", Rgba::new(92, 199, 186, 255)), + ("--affine-v2-edgeless-line-white", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-edgeless-line-yellow", Rgba::new(250, 204, 21, 255)), + ("--affine-v2-edgeless-lock-locked", Rgba::new(146, 146, 146, 133)), + ("--affine-v2-edgeless-mindMap-line", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-edgeless-note-black", Rgba::new(179, 179, 179, 255)), + ("--affine-v2-edgeless-note-blue", Rgba::new(206, 236, 255, 255)), + ("--affine-v2-edgeless-note-green", Rgba::new(201, 248, 193, 255)), + ("--affine-v2-edgeless-note-grey", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-edgeless-note-magenta", Rgba::new(255, 218, 237, 255)), + ("--affine-v2-edgeless-note-orange", Rgba::new(255, 197, 143, 255)), + ("--affine-v2-edgeless-note-purple", Rgba::new(221, 214, 254, 255)), + ("--affine-v2-edgeless-note-red", Rgba::new(251, 183, 183, 255)), + ("--affine-v2-edgeless-note-teal", Rgba::new(199, 248, 242, 255)), + ("--affine-v2-edgeless-note-white", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-edgeless-note-yellow", Rgba::new(253, 230, 138, 255)), + ("--affine-v2-edgeless-palette-black", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-edgeless-palette-heavy-blue", Rgba::new(28, 112, 165, 255)), + ("--affine-v2-edgeless-palette-heavy-green", Rgba::new(68, 119, 86, 255)), + ("--affine-v2-edgeless-palette-heavy-magenta", Rgba::new(148, 21, 85, 255)), + ("--affine-v2-edgeless-palette-heavy-orange", Rgba::new(181, 83, 9, 255)), + ("--affine-v2-edgeless-palette-heavy-purple", Rgba::new(90, 33, 182, 255)), + ("--affine-v2-edgeless-palette-heavy-red", Rgba::new(118, 23, 23, 255)), + ("--affine-v2-edgeless-palette-heavy-yellow", Rgba::new(172, 116, 0, 255)), + ("--affine-v2-edgeless-palette-light-blueLight", Rgba::new(230, 245, 255, 255)), + ("--affine-v2-edgeless-palette-light-greenLight", Rgba::new(241, 253, 244, 255)), + ("--affine-v2-edgeless-palette-light-greyLight", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-edgeless-palette-light-magentaLight", Rgba::new(255, 236, 246, 255)), + ("--affine-v2-edgeless-palette-light-orangeLight", Rgba::new(255, 235, 213, 255)), + ("--affine-v2-edgeless-palette-light-purpleLight", Rgba::new(237, 233, 255, 255)), + ("--affine-v2-edgeless-palette-light-redLight", Rgba::new(252, 229, 230, 255)), + ("--affine-v2-edgeless-palette-light-yellowLight", Rgba::new(255, 251, 213, 255)), + ("--affine-v2-edgeless-palette-medium-blueMedium", Rgba::new(132, 207, 255, 255)), + ("--affine-v2-edgeless-palette-medium-greenMedium", Rgba::new(60, 188, 54, 255)), + ("--affine-v2-edgeless-palette-medium-greyMedium", Rgba::new(146, 146, 146, 255)), + ("--affine-v2-edgeless-palette-medium-magentaMedium", Rgba::new(233, 108, 171, 255)), + ("--affine-v2-edgeless-palette-medium-orangeMedium", Rgba::new(255, 140, 56, 255)), + ("--affine-v2-edgeless-palette-medium-purpleMedium", Rgba::new(110, 82, 223, 255)), + ("--affine-v2-edgeless-palette-medium-redMedium", Rgba::new(251, 112, 129, 255)), + ("--affine-v2-edgeless-palette-medium-yellowMedium", Rgba::new(252, 211, 77, 255)), + ("--affine-v2-edgeless-palette-white", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-edgeless-selection-selectionMarqueeBackground", Rgba::new(30, 150, 235, 20)), + ("--affine-v2-edgeless-selection-selectionMarqueeBorder", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-edgeless-shape-black", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-edgeless-shape-blue", Rgba::new(159, 217, 255, 255)), + ("--affine-v2-edgeless-shape-green", Rgba::new(155, 218, 145, 255)), + ("--affine-v2-edgeless-shape-grey", Rgba::new(205, 205, 205, 255)), + ("--affine-v2-edgeless-shape-magenta", Rgba::new(255, 192, 224, 255)), + ("--affine-v2-edgeless-shape-orange", Rgba::new(255, 174, 99, 255)), + ("--affine-v2-edgeless-shape-purple", Rgba::new(215, 205, 255, 255)), + ("--affine-v2-edgeless-shape-red", Rgba::new(254, 205, 209, 255)), + ("--affine-v2-edgeless-shape-teal", Rgba::new(139, 231, 220, 255)), + ("--affine-v2-edgeless-shape-white", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-edgeless-shape-yellow", Rgba::new(253, 224, 71, 255)), + ("--affine-v2-edgelessToolbar-highlightPen-body", Rgba::new(250, 250, 250, 255)), + ("--affine-v2-edgelessToolbar-highlightPen-body1Linear1-1", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body1Linear1-2", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body1Linear1-3", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-edgelessToolbar-highlightPen-body1Linear2-1", Rgba::new(255, 255, 255, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body1Linear2-2", Rgba::new(255, 255, 255, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body1Linear2-3", Rgba::new(255, 255, 255, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body1Linear2-4", Rgba::new(255, 255, 255, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body2", Rgba::new(243, 243, 243, 255)), + ("--affine-v2-edgelessToolbar-highlightPen-body2Linear1-1", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body2Linear1-2", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body2Linear1-3", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-edgelessToolbar-highlightPen-body2Linear2-1", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body2Linear2-2", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body2Linear2-3", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body2Linear2-4", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body2Linear2-5", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-bodyColorLinear-1", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-bodyColorLinear-2", Rgba::new(0, 0, 0, 252)), + ("--affine-v2-edgelessToolbar-highlightPen-bodyColorLinear-3", Rgba::new(0, 0, 0, 196)), + ("--affine-v2-edgelessToolbar-media-whiteVector", Rgba::new(255, 255, 255, 143)), + ("--affine-v2-edgelessToolbar-note-background", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-edgelessToolbar-note-textColor", Rgba::new(0, 0, 0, 26)), + ("--affine-v2-edgelessToolbar-others-background", Rgba::new(255, 255, 255, 31)), + ("--affine-v2-edgelessToolbar-others-highlightLinearEnd", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-edgelessToolbar-others-highlightLinearStart", Rgba::new(255, 255, 255, 0)), + ("--affine-v2-edgelessToolbar-others-linearCenter", Rgba::new(0, 0, 0, 196)), + ("--affine-v2-edgelessToolbar-others-linearEnd", Rgba::new(0, 0, 0, 31)), + ("--affine-v2-edgelessToolbar-others-linearStart", Rgba::new(255, 255, 255, 31)), + ("--affine-v2-edgelessToolbar-penEraser-eraserBlue-1", Rgba::new(23, 54, 84, 255)), + ("--affine-v2-edgelessToolbar-penEraser-eraserBlue-2", Rgba::new(239, 250, 255, 255)), + ("--affine-v2-edgelessToolbar-penEraser-eraserBlue-3", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-edgelessToolbar-penEraser-eraserBodyFill", Rgba::new(241, 241, 241, 255)), + ("--affine-v2-edgelessToolbar-penEraser-eraserBodyHighlight", Rgba::new(255, 255, 255, 143)), + ("--affine-v2-edgelessToolbar-penEraser-eraserBodyShade2", Rgba::new(0, 0, 0, 51)), + ("--affine-v2-edgelessToolbar-penEraser-eraserBodyShade3", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-edgelessToolbar-penEraser-eraserBorder", Rgba::new(231, 231, 231, 255)), + ("--affine-v2-edgelessToolbar-penEraser-eraserBorder2", Rgba::new(227, 226, 228, 255)), + ("--affine-v2-edgelessToolbar-penEraser-eraserClothHighlight", Rgba::new(255, 255, 255, 28)), + ("--affine-v2-edgelessToolbar-penEraser-eraserClothShade2", Rgba::new(15, 15, 15, 255)), + ("--affine-v2-edgelessToolbar-penEraser-eraserClothShade3", Rgba::new(255, 255, 255, 23)), + ("--affine-v2-edgelessToolbar-penEraser-eraserShadow", Rgba::new(0, 0, 0, 64)), + ("--affine-v2-edgelessToolbar-penEraser-penBackground", Rgba::new(250, 250, 250, 255)), + ("--affine-v2-edgelessToolbar-penEraser-penBodyShade-1", Rgba::new(0, 0, 0, 51)), + ("--affine-v2-edgelessToolbar-penEraser-penBodyShade-2", Rgba::new(0, 0, 0, 26)), + ("--affine-v2-edgelessToolbar-penEraser-penBodyShade-3", Rgba::new(0, 0, 0, 3)), + ("--affine-v2-edgelessToolbar-penEraser-penBodyShade-4", Rgba::new(255, 255, 255, 20)), + ("--affine-v2-edgelessToolbar-penEraser-penInlineShadow", Rgba::new(255, 255, 255, 0)), + ("--affine-v2-icon-activated", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-icon-disable", Rgba::new(179, 179, 179, 255)), + ("--affine-v2-icon-fileIconBorder", Rgba::new(205, 205, 205, 255)), + ("--affine-v2-icon-fileIconColors-blue", Rgba::new(0, 119, 203, 255)), + ("--affine-v2-icon-fileIconColors-green", Rgba::new(29, 156, 7, 255)), + ("--affine-v2-icon-fileIconColors-grey", Rgba::new(30, 27, 75, 255)), + ("--affine-v2-icon-fileIconColors-magenta", Rgba::new(230, 96, 164, 255)), + ("--affine-v2-icon-fileIconColors-purple", Rgba::new(110, 82, 223, 255)), + ("--affine-v2-icon-fileIconColors-red", Rgba::new(237, 63, 63, 255)), + ("--affine-v2-icon-fileIconColors-yellow", Rgba::new(250, 204, 21, 255)), + ("--affine-v2-icon-monotone", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-icon-primary", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-icon-secondary", Rgba::new(179, 179, 179, 255)), + ("--affine-v2-icon-tertiary", Rgba::new(205, 205, 205, 255)), + ("--affine-v2-icon-transparentBlack", Rgba::new(0, 0, 0, 133)), + ("--affine-v2-input-background", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-input-border-active", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-input-border-default", Rgba::new(0, 0, 0, 26)), + ("--affine-v2-input-border-error", Rgba::new(237, 63, 63, 255)), + ("--affine-v2-input-scrollBar-handle", Rgba::new(0, 0, 0, 26)), + ("--affine-v2-integrations-background-iconSolid", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-layer-background-codeBlock", Rgba::new(245, 245, 245, 255)), + ("--affine-v2-layer-background-edgelessGrid", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-layer-background-error", Rgba::new(255, 241, 241, 255)), + ("--affine-v2-layer-background-hoverOverlay", Rgba::new(0, 0, 0, 13)), + ("--affine-v2-layer-background-linkedDocOnEdgeless", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-layer-background-mobile-iOSControl", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-layer-background-mobile-modal", Rgba::new(0, 0, 0, 43)), + ("--affine-v2-layer-background-mobile-primary", Rgba::new(245, 245, 245, 255)), + ("--affine-v2-layer-background-mobile-secondary", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-layer-background-mobile-tertiary", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-layer-background-modal", Rgba::new(0, 0, 0, 178)), + ("--affine-v2-layer-background-modalWhite", Rgba::new(255, 255, 255, 43)), + ("--affine-v2-layer-background-overlayPanel", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-layer-background-primary", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-layer-background-processing", Rgba::new(238, 242, 255, 255)), + ("--affine-v2-layer-background-secondary", Rgba::new(245, 245, 245, 255)), + ("--affine-v2-layer-background-success", Rgba::new(241, 253, 244, 255)), + ("--affine-v2-layer-background-tertiary", Rgba::new(243, 243, 243, 255)), + ("--affine-v2-layer-background-translucentUI", Rgba::new(255, 255, 255, 184)), + ("--affine-v2-layer-background-warning", Rgba::new(255, 247, 238, 255)), + ("--affine-v2-layer-black", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-layer-insideBorder-blackBorder", Rgba::new(0, 0, 0, 26)), + ("--affine-v2-layer-insideBorder-border", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-layer-insideBorder-primaryBorder", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-layer-insideBorder-splitviewActived", Rgba::new(0, 0, 0, 43)), + ("--affine-v2-layer-insideBorder-whiteBorder", Rgba::new(255, 255, 255, 143)), + ("--affine-v2-layer-pureBlack", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-layer-pureWhite", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-layer-white", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-loading-background", Rgba::new(0, 0, 0, 26)), + ("--affine-v2-loading-backgroundLayer", Rgba::new(146, 146, 146, 56)), + ("--affine-v2-loading-foreground", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-loading-imageLoadingBackground", Rgba::new(146, 146, 146, 56)), + ("--affine-v2-loading-imageLoadingLayer", Rgba::new(255, 255, 255, 143)), + ("--affine-v2-others-warnLabel-black", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-others-warnLabel-yellow", Rgba::new(250, 204, 21, 255)), + ("--affine-v2-pagelist-hoverBorder", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-portrait-localPortrait", Rgba::new(0, 0, 0, 56)), + ("--affine-v2-portrait-localPortraitBackground", Rgba::new(0, 0, 0, 26)), + ("--affine-v2-radio-active-chekced", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-radio-active-default", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-radio-disable", Rgba::new(205, 205, 205, 255)), + ("--affine-v2-readwise-quoteBackground", Rgba::new(249, 249, 249, 255)), + ("--affine-v2-readwise-quoteDivider", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-segment-background", Rgba::new(0, 0, 0, 13)), + ("--affine-v2-segment-button", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-selfhost-button-disable", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-selfhost-button-primary", Rgba::new(20, 20, 20, 255)), + ("--affine-v2-selfhost-button-secondary", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-selfhost-button-sidebarButton-bg-hover", Rgba::new(0, 0, 0, 13)), + ("--affine-v2-selfhost-button-sidebarButton-bg-select", Rgba::new(0, 0, 0, 13)), + ("--affine-v2-selfhost-icon-buttonIcon", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-selfhost-icon-buttonIconError", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-selfhost-icon-disable", Rgba::new(179, 179, 179, 255)), + ("--affine-v2-selfhost-icon-primary", Rgba::new(20, 20, 20, 255)), + ("--affine-v2-selfhost-icon-secondary", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-selfhost-icon-tertiary", Rgba::new(179, 179, 179, 255)), + ("--affine-v2-selfhost-layer-background-hoverOverlay", Rgba::new(255, 255, 255, 59)), + ("--affine-v2-selfhost-layer-background-primary", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-selfhost-layer-background-secondary", Rgba::new(249, 249, 249, 255)), + ("--affine-v2-selfhost-layer-background-sidebarBg-sidebarBg", Rgba::new(249, 249, 249, 255)), + ("--affine-v2-selfhost-layer-border-border", Rgba::new(20, 20, 20, 255)), + ("--affine-v2-selfhost-portrait-localPortraitBackground", Rgba::new(0, 0, 0, 13)), + ("--affine-v2-selfhost-progress-error", Rgba::new(237, 63, 63, 255)), + ("--affine-v2-selfhost-progress-primary", Rgba::new(20, 20, 20, 255)), + ("--affine-v2-selfhost-text-button-error", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-selfhost-text-button-primary", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-selfhost-text-placeholder", Rgba::new(179, 179, 179, 255)), + ("--affine-v2-selfhost-text-sidebar-primary", Rgba::new(20, 20, 20, 255)), + ("--affine-v2-selfhost-text-sidebar-secondary", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-selfhost-toggle-backgroundDisable", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-selfhost-toggle-backgroundOff", Rgba::new(205, 205, 205, 255)), + ("--affine-v2-selfhost-toggle-backgroundOn", Rgba::new(20, 20, 20, 255)), + ("--affine-v2-selfhost-toggle-foreground", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-selfhost-toggle-foregroundDisable", Rgba::new(249, 249, 249, 255)), + ("--affine-v2-skeleton-skeleton", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-slashMenu-background", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-status-error", Rgba::new(237, 63, 63, 255)), + ("--affine-v2-status-success", Rgba::new(68, 185, 49, 255)), + ("--affine-v2-switch-buttonBackground-active", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-switch-buttonBackground-hover", Rgba::new(0, 0, 0, 13)), + ("--affine-v2-switch-fontColor-primary", Rgba::new(20, 20, 20, 255)), + ("--affine-v2-switch-fontColor-secondary", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-switch-fontColor-tertiary", Rgba::new(146, 146, 146, 255)), + ("--affine-v2-switch-iconColor-active", Rgba::new(86, 86, 86, 255)), + ("--affine-v2-switch-iconColor-default", Rgba::new(146, 146, 146, 255)), + ("--affine-v2-switch-switchBackground-background", Rgba::new(243, 243, 243, 255)), + ("--affine-v2-tab-divider-divider", Rgba::new(0, 0, 0, 18)), + ("--affine-v2-tab-divider-indicator", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-tab-fontColor-active", Rgba::new(20, 20, 20, 255)), + ("--affine-v2-tab-fontColor-default", Rgba::new(179, 179, 179, 255)), + ("--affine-v2-tab-fontColor-hover", Rgba::new(20, 20, 20, 255)), + ("--affine-v2-tab-iconColor-active", Rgba::new(86, 86, 86, 255)), + ("--affine-v2-tab-iconColor-default", Rgba::new(179, 179, 179, 255)), + ("--affine-v2-tab-iconColor-hover", Rgba::new(86, 86, 86, 255)), + ("--affine-v2-tab-tabBackground-active", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-tab-tabBackground-default", Rgba::new(243, 243, 243, 255)), + ("--affine-v2-tab-tabBackground-hover", Rgba::new(243, 243, 243, 255)), + ("--affine-v2-table-border", Rgba::new(0, 0, 0, 26)), + ("--affine-v2-table-focusBackground", Rgba::new(30, 150, 235, 10)), + ("--affine-v2-table-focusBorder", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-table-headerBackground-blue", Rgba::new(240, 249, 255, 255)), + ("--affine-v2-table-headerBackground-default", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-table-headerBackground-green", Rgba::new(239, 255, 236, 255)), + ("--affine-v2-table-headerBackground-grey", Rgba::new(245, 245, 245, 255)), + ("--affine-v2-table-headerBackground-headerColor", Rgba::new(243, 243, 243, 255)), + ("--affine-v2-table-headerBackground-orange", Rgba::new(255, 247, 238, 255)), + ("--affine-v2-table-headerBackground-purple", Rgba::new(247, 245, 255, 255)), + ("--affine-v2-table-headerBackground-red", Rgba::new(255, 244, 245, 255)), + ("--affine-v2-table-headerBackground-teal", Rgba::new(238, 255, 253, 255)), + ("--affine-v2-table-headerBackground-yellow", Rgba::new(255, 253, 237, 255)), + ("--affine-v2-table-indicator-activated", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-table-indicator-border", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-table-indicator-drag", Rgba::new(0, 0, 0, 43)), + ("--affine-v2-table-indicator-hover", Rgba::new(0, 0, 0, 13)), + ("--affine-v2-table-indicator-pointerActive", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-table-indicator-pointerDefault", Rgba::new(179, 179, 179, 255)), + ("--affine-v2-table-textSecondary", Rgba::new(0, 0, 0, 133)), + ("--affine-v2-tableOfContent-background", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-text-disable", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-text-emphasis", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-text-highlight-bg-blue", Rgba::new(218, 240, 255, 255)), + ("--affine-v2-text-highlight-bg-green", Rgba::new(240, 252, 203, 255)), + ("--affine-v2-text-highlight-bg-grey", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-text-highlight-bg-magenta", Rgba::new(255, 236, 246, 255)), + ("--affine-v2-text-highlight-bg-orange", Rgba::new(255, 235, 213, 255)), + ("--affine-v2-text-highlight-bg-purple", Rgba::new(237, 233, 255, 255)), + ("--affine-v2-text-highlight-bg-red", Rgba::new(252, 229, 230, 255)), + ("--affine-v2-text-highlight-bg-teal", Rgba::new(199, 248, 242, 255)), + ("--affine-v2-text-highlight-bg-yellow", Rgba::new(255, 249, 182, 255)), + ("--affine-v2-text-highlight-border", Rgba::new(0, 0, 0, 56)), + ("--affine-v2-text-highlight-fg-blue", Rgba::new(0, 60, 103, 255)), + ("--affine-v2-text-highlight-fg-green", Rgba::new(34, 92, 24, 255)), + ("--affine-v2-text-highlight-fg-grey", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-text-highlight-fg-magenta", Rgba::new(148, 21, 85, 255)), + ("--affine-v2-text-highlight-fg-orange", Rgba::new(219, 113, 35, 255)), + ("--affine-v2-text-highlight-fg-purple", Rgba::new(124, 58, 237, 255)), + ("--affine-v2-text-highlight-fg-red", Rgba::new(200, 48, 48, 255)), + ("--affine-v2-text-highlight-fg-teal", Rgba::new(14, 72, 65, 255)), + ("--affine-v2-text-highlight-fg-yellow", Rgba::new(172, 116, 0, 255)), + ("--affine-v2-text-link", Rgba::new(3, 95, 159, 255)), + ("--affine-v2-text-listDotAndNumber", Rgba::new(0, 119, 203, 255)), + ("--affine-v2-text-placeholder", Rgba::new(146, 146, 146, 255)), + ("--affine-v2-text-primary", Rgba::new(20, 20, 20, 255)), + ("--affine-v2-text-pureWhite", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-text-secondary", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-text-tertiary", Rgba::new(146, 146, 146, 255)), + ("--affine-v2-toast-cardLayer-second", Rgba::new(249, 249, 249, 255)), + ("--affine-v2-toast-cardLayer-third", Rgba::new(245, 245, 245, 255)), + ("--affine-v2-toast-iconState-error", Rgba::new(237, 63, 63, 255)), + ("--affine-v2-toast-iconState-regular", Rgba::new(0, 119, 203, 255)), + ("--affine-v2-toast-iconState-success", Rgba::new(68, 185, 49, 255)), + ("--affine-v2-toast-overlay-secondary", Rgba::new(0, 0, 0, 8)), + ("--affine-v2-toast-overlay-tertiary", Rgba::new(0, 0, 0, 13)), + ("--affine-v2-toggle-background", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-toggle-backgroundDisable", Rgba::new(179, 179, 179, 255)), + ("--affine-v2-toggle-backgroundOff", Rgba::new(146, 146, 146, 255)), + ("--affine-v2-toggle-foreground", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-toggle-foregroundDisable", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-tooltips-background", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-tooltips-foreground", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-tooltips-secondaryBackground", Rgba::new(255, 255, 255, 43)), + ("--affine-v2-workspacePicker-border", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-workspacePicker-secondaryBackground", Rgba::new(146, 146, 146, 26)), + ("--affine-warning-color", Rgba::new(235, 67, 53, 255)), + ("--affine-white", Rgba::new(255, 255, 255, 255)), + ("--affine-white-10", Rgba::new(255, 255, 255, 26)), + ("--affine-white-30", Rgba::new(255, 255, 255, 77)), + ("--affine-white-50", Rgba::new(255, 255, 255, 128)), + ("--affine-white-60", Rgba::new(255, 255, 255, 153)), + ("--affine-white-80", Rgba::new(255, 255, 255, 204)), + ("--affine-white-90", Rgba::new(255, 255, 255, 230)), + ("--affine-windows-close-button", Rgba::new(196, 43, 28, 255)), + ], + shadows: &[ + ("--affine-active-shadow", "0px 0px 0px 2px rgba(30, 150, 235, .3)"), + ("--affine-ai-empty-shadow", "0px 4px 4px rgba(66, 65, 73, .1), 0px 6px 8px rgba(66, 65, 73, .05)"), + ("--affine-button-inner-shadow", "unset"), + ("--affine-button-shadow", "0px 0px 1px 0px rgba(0, 0, 0, .12), 0px 1px 5px 0px rgba(0, 0, 0, .12)"), + ("--affine-cmd-shadow", "0px 10px 80px 0px rgba(0, 0, 0, .2)"), + ("--affine-embed-shadow", "0px 0px 0px 2px rgba(0, 0, 0, .08)"), + ("--affine-float-button-shadow", "0px 0px 10px rgba(0, 0, 0, .05), 0px 0px 0px .5px rgba(0, 0, 0, .1)"), + ("--affine-float-button-shadow-1", "0px 4px 6px -3px rgba(66, 65, 73, .1), 0px 10px 12px -2px rgba(66, 65, 73, .1)"), + ("--affine-float-button-shadow-2", "0px 4px 4px -2px rgba(66, 65, 73, .1), 0px 6px 8px 1px rgba(66, 65, 73, .05)"), + ("--affine-kanban-shadow", "0px 2px 3px 0px rgba(0, 0, 0, .05)"), + ("--affine-menu-shadow", "0px 10px 18px rgba(0,0,0,.14), 0px -1px 12px rgba(0,0,0,.08)"), + ("--affine-multi-cursors-shadow", "0px 2px 4px 0px rgba(0, 0, 0, .28)"), + ("--affine-multi-players-shadow", "0px 1px 6px 0px rgba(0, 0, 0, .16)"), + ("--affine-note-shadow-box", "0px 0px 4px 0px rgba(0, 0, 0, .14), 0px 2px 12px 0px rgba(0, 0, 0, .14)"), + ("--affine-note-shadow-film", "10px 10px 0px 6px #000, 0px 0px 0px 6px #000"), + ("--affine-note-shadow-float", "0px 0px 32px 0px rgba(0, 0, 0, .09), 0px 0px 3px 0px rgba(0, 0, 0, .1)"), + ("--affine-note-shadow-paper", "0px 2px 4px 0px rgba(0, 0, 0, .05), 0px 0px 0px 10px #FFF, 0px 3px 6px 12px rgba(0, 0, 0, .14)"), + ("--affine-note-shadow-sticker", "0px 6px 16px 0px rgba(0, 0, 0, .08), 0px 26px 18px -20px rgba(0, 0, 0, .1)"), + ("--affine-overlay-panel-shadow", "0px 1px 6px rgba(0,0,0,.16), 0px 8px 14px rgba(0,0,0,.08)"), + ("--affine-overlay-shadow", "0px 1px 6px 0px rgba(0, 0, 0, .16), 0px 8px 14px 0px rgba(0, 0, 0, .08)"), + ("--affine-popover-shadow", "0px 0px 30px rgba(75, 75, 75, .2), 0px 0px 4px rgba(75, 75, 75, .3), inset 0px 0px 0px rgba(227, 226, 228, 1)"), + ("--affine-shadow-1", "0px 0px 4px 0px rgba(66, 65, 73, .14)"), + ("--affine-shadow-2", "0px 0px 12px 0px rgba(66, 65, 73, .18)"), + ("--affine-shadow-3", "0px 0px 20px 0px rgba(66, 65, 73, .22)"), + ("--affine-toggle-circle-shadow", "0px 1px 2px 0px rgba(0, 0, 0, .25), inset -2px -3px 2px 0px rgba(0, 0, 0, .05)"), + ("--affine-toolbar-shadow", "0px 6px 16px #00000024"), + ], + note_palette: &[ + ("--affine-note-background-black", Rgba::new(0, 0, 0, 255)), + ("--affine-note-background-blue", Rgba::new(205, 235, 255, 255)), + ("--affine-note-background-green", Rgba::new(201, 248, 193, 255)), + ("--affine-note-background-grey", Rgba::new(230, 230, 230, 255)), + ("--affine-note-background-magenta", Rgba::new(255, 218, 237, 255)), + ("--affine-note-background-orange", Rgba::new(255, 196, 143, 255)), + ("--affine-note-background-purple", Rgba::new(221, 214, 254, 255)), + ("--affine-note-background-red", Rgba::new(250, 182, 182, 255)), + ("--affine-note-background-teal", Rgba::new(199, 248, 242, 255)), + ("--affine-note-background-white", Rgba::new(255, 255, 255, 255)), + ("--affine-note-background-yellow", Rgba::new(253, 230, 138, 255)), + ("--affine-v2-edgeless-note-black", Rgba::new(179, 179, 179, 255)), + ("--affine-v2-edgeless-note-blue", Rgba::new(206, 236, 255, 255)), + ("--affine-v2-edgeless-note-green", Rgba::new(201, 248, 193, 255)), + ("--affine-v2-edgeless-note-grey", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-edgeless-note-magenta", Rgba::new(255, 218, 237, 255)), + ("--affine-v2-edgeless-note-orange", Rgba::new(255, 197, 143, 255)), + ("--affine-v2-edgeless-note-purple", Rgba::new(221, 214, 254, 255)), + ("--affine-v2-edgeless-note-red", Rgba::new(251, 183, 183, 255)), + ("--affine-v2-edgeless-note-teal", Rgba::new(199, 248, 242, 255)), + ("--affine-v2-edgeless-note-white", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-edgeless-note-yellow", Rgba::new(253, 230, 138, 255)), + ], + shape_palette: &[ + ("--affine-palette-shape-black", Rgba::new(35, 35, 35, 255)), + ("--affine-palette-shape-blue", Rgba::new(184, 227, 255, 255)), + ("--affine-palette-shape-green", Rgba::new(157, 209, 148, 255)), + ("--affine-palette-shape-grey", Rgba::new(216, 217, 216, 255)), + ("--affine-palette-shape-magenta", Rgba::new(237, 140, 189, 255)), + ("--affine-palette-shape-navy", Rgba::new(122, 149, 246, 255)), + ("--affine-palette-shape-orange", Rgba::new(255, 196, 107, 255)), + ("--affine-palette-shape-purple", Rgba::new(147, 126, 231, 255)), + ("--affine-palette-shape-red", Rgba::new(241, 111, 111, 255)), + ("--affine-palette-shape-tangerine", Rgba::new(251, 161, 121, 255)), + ("--affine-palette-shape-teal", Rgba::new(184, 242, 231, 255)), + ("--affine-palette-shape-white", Rgba::new(255, 255, 255, 255)), + ("--affine-palette-shape-yellow", Rgba::new(255, 223, 107, 255)), + ("--affine-v2-edgeless-palette-black", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-edgeless-palette-heavy-blue", Rgba::new(28, 112, 165, 255)), + ("--affine-v2-edgeless-palette-heavy-green", Rgba::new(68, 119, 86, 255)), + ("--affine-v2-edgeless-palette-heavy-magenta", Rgba::new(148, 21, 85, 255)), + ("--affine-v2-edgeless-palette-heavy-orange", Rgba::new(181, 83, 9, 255)), + ("--affine-v2-edgeless-palette-heavy-purple", Rgba::new(90, 33, 182, 255)), + ("--affine-v2-edgeless-palette-heavy-red", Rgba::new(118, 23, 23, 255)), + ("--affine-v2-edgeless-palette-heavy-yellow", Rgba::new(172, 116, 0, 255)), + ("--affine-v2-edgeless-palette-light-blueLight", Rgba::new(230, 245, 255, 255)), + ("--affine-v2-edgeless-palette-light-greenLight", Rgba::new(241, 253, 244, 255)), + ("--affine-v2-edgeless-palette-light-greyLight", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-edgeless-palette-light-magentaLight", Rgba::new(255, 236, 246, 255)), + ("--affine-v2-edgeless-palette-light-orangeLight", Rgba::new(255, 235, 213, 255)), + ("--affine-v2-edgeless-palette-light-purpleLight", Rgba::new(237, 233, 255, 255)), + ("--affine-v2-edgeless-palette-light-redLight", Rgba::new(252, 229, 230, 255)), + ("--affine-v2-edgeless-palette-light-yellowLight", Rgba::new(255, 251, 213, 255)), + ("--affine-v2-edgeless-palette-medium-blueMedium", Rgba::new(132, 207, 255, 255)), + ("--affine-v2-edgeless-palette-medium-greenMedium", Rgba::new(60, 188, 54, 255)), + ("--affine-v2-edgeless-palette-medium-greyMedium", Rgba::new(146, 146, 146, 255)), + ("--affine-v2-edgeless-palette-medium-magentaMedium", Rgba::new(233, 108, 171, 255)), + ("--affine-v2-edgeless-palette-medium-orangeMedium", Rgba::new(255, 140, 56, 255)), + ("--affine-v2-edgeless-palette-medium-purpleMedium", Rgba::new(110, 82, 223, 255)), + ("--affine-v2-edgeless-palette-medium-redMedium", Rgba::new(251, 112, 129, 255)), + ("--affine-v2-edgeless-palette-medium-yellowMedium", Rgba::new(252, 211, 77, 255)), + ("--affine-v2-edgeless-palette-white", Rgba::new(255, 255, 255, 255)), + ], + connector_palette: &[ + ("--affine-palette-line-black", Rgba::new(35, 35, 35, 255)), + ("--affine-palette-line-blue", Rgba::new(79, 144, 255, 255)), + ("--affine-palette-line-green", Rgba::new(124, 194, 112, 255)), + ("--affine-palette-line-grey", Rgba::new(191, 192, 191, 255)), + ("--affine-palette-line-magenta", Rgba::new(230, 96, 164, 255)), + ("--affine-palette-line-navy", Rgba::new(59, 37, 204, 255)), + ("--affine-palette-line-orange", Rgba::new(255, 175, 56, 255)), + ("--affine-palette-line-purple", Rgba::new(110, 82, 223, 255)), + ("--affine-palette-line-red", Rgba::new(237, 63, 63, 255)), + ("--affine-palette-line-tangerine", Rgba::new(250, 124, 69, 255)), + ("--affine-palette-line-teal", Rgba::new(122, 226, 213, 255)), + ("--affine-palette-line-white", Rgba::new(255, 255, 255, 255)), + ("--affine-palette-line-yellow", Rgba::new(255, 211, 56, 255)), + ], +}; + +pub const DARK_THEME: ThemeTokens = ThemeTokens { + brand: Rgba::new(30, 150, 235, 255), + primary: Rgba::new(28, 158, 228, 255), + secondary: Rgba::new(144, 150, 245, 255), + text_primary: Rgba::new(234, 234, 234, 255), + text_secondary: Rgba::new(156, 156, 160, 255), + text_emphasis: Rgba::new(30, 150, 235, 255), + text_disable: Rgba::new(119, 117, 125, 255), + background_primary: Rgba::new(20, 20, 20, 255), + background_secondary: Rgba::new(37, 37, 37, 255), + background_tertiary: Rgba::new(48, 48, 48, 255), + background_code_block: Rgba::new(31, 32, 34, 255), + background_modal: Rgba::new(0, 0, 0, 128), + background_overlay_panel: Rgba::new(30, 30, 30, 255), + border: Rgba::new(46, 46, 46, 255), + divider: Rgba::new(114, 114, 114, 255), + quote: Rgba::new(142, 141, 145, 255), + link: Rgba::new(120, 190, 255, 255), + icon: Rgba::new(168, 168, 160, 255), + icon_secondary: Rgba::new(168, 168, 160, 153), + placeholder: Rgba::new(62, 62, 63, 255), + hover: Rgba::new(255, 255, 255, 26), + edgeless_grid: Rgba::new(49, 49, 49, 89), + colors: &[ + ("--affine-background-code-block", Rgba::new(31, 32, 34, 255)), + ("--affine-background-error-color", Rgba::new(46, 26, 24, 255)), + ("--affine-background-modal-color", Rgba::new(0, 0, 0, 128)), + ("--affine-background-overlay-panel-color", Rgba::new(30, 30, 30, 255)), + ("--affine-background-primary-color", Rgba::new(20, 20, 20, 255)), + ("--affine-background-processing-color", Rgba::new(22, 32, 48, 255)), + ("--affine-background-secondary-color", Rgba::new(37, 37, 37, 255)), + ("--affine-background-success-color", Rgba::new(20, 42, 34, 255)), + ("--affine-background-tertiary-color", Rgba::new(48, 48, 48, 255)), + ("--affine-background-warning-color", Rgba::new(48, 35, 19, 255)), + ("--affine-black", Rgba::new(255, 255, 255, 255)), + ("--affine-black-10", Rgba::new(255, 255, 255, 26)), + ("--affine-black-30", Rgba::new(255, 255, 255, 77)), + ("--affine-black-50", Rgba::new(255, 255, 255, 128)), + ("--affine-black-60", Rgba::new(255, 255, 255, 153)), + ("--affine-black-80", Rgba::new(255, 255, 255, 204)), + ("--affine-black-90", Rgba::new(255, 255, 255, 230)), + ("--affine-blue", Rgba::new(30, 150, 235, 255)), + ("--affine-blue-100", Rgba::new(171, 204, 237, 255)), + ("--affine-blue-200", Rgba::new(149, 194, 234, 255)), + ("--affine-blue-300", Rgba::new(115, 182, 226, 255)), + ("--affine-blue-400", Rgba::new(79, 162, 216, 255)), + ("--affine-blue-50", Rgba::new(181, 208, 242, 255)), + ("--affine-blue-500", Rgba::new(53, 140, 208, 255)), + ("--affine-blue-600", Rgba::new(52, 116, 173, 255)), + ("--affine-blue-700", Rgba::new(55, 106, 154, 255)), + ("--affine-blue-800", Rgba::new(51, 88, 122, 255)), + ("--affine-blue-900", Rgba::new(47, 75, 96, 255)), + ("--affine-blue-950", Rgba::new(32, 45, 55, 255)), + ("--affine-border-color", Rgba::new(46, 46, 46, 255)), + ("--affine-brand-color", Rgba::new(30, 150, 235, 255)), + ("--affine-button-gray-color", Rgba::new(85, 85, 85, 255)), + ("--affine-divider-color", Rgba::new(114, 114, 114, 255)), + ("--affine-edgeless-grid-color", Rgba::new(49, 49, 49, 89)), + ("--affine-error-color", Rgba::new(188, 54, 42, 255)), + ("--affine-hover-color", Rgba::new(255, 255, 255, 26)), + ("--affine-hover-color-filled", Rgba::new(42, 42, 42, 255)), + ("--affine-icon-color", Rgba::new(168, 168, 160, 255)), + ("--affine-icon-secondary", Rgba::new(168, 168, 160, 153)), + ("--affine-link-color", Rgba::new(120, 190, 255, 255)), + ("--affine-list-color", Rgba::new(156, 155, 160, 255)), + ("--affine-multi-players-blue", Rgba::new(24, 160, 251, 255)), + ("--affine-multi-players-brown", Rgba::new(154, 101, 51, 255)), + ("--affine-multi-players-green", Rgba::new(27, 196, 125, 255)), + ("--affine-multi-players-grey", Rgba::new(170, 170, 170, 255)), + ("--affine-multi-players-magenta", Rgba::new(245, 49, 179, 255)), + ("--affine-multi-players-orange", Rgba::new(255, 138, 0, 255)), + ("--affine-multi-players-purple", Rgba::new(123, 97, 255, 255)), + ("--affine-multi-players-red", Rgba::new(243, 87, 52, 255)), + ("--affine-note-background-black", Rgba::new(255, 255, 255, 255)), + ("--affine-note-background-blue", Rgba::new(3, 95, 159, 255)), + ("--affine-note-background-green", Rgba::new(59, 83, 21, 255)), + ("--affine-note-background-grey", Rgba::new(86, 86, 86, 255)), + ("--affine-note-background-magenta", Rgba::new(148, 21, 85, 255)), + ("--affine-note-background-orange", Rgba::new(132, 59, 6, 255)), + ("--affine-note-background-purple", Rgba::new(49, 46, 129, 255)), + ("--affine-note-background-red", Rgba::new(118, 23, 23, 255)), + ("--affine-note-background-teal", Rgba::new(28, 107, 99, 255)), + ("--affine-note-background-white", Rgba::new(0, 0, 0, 255)), + ("--affine-note-background-yellow", Rgba::new(111, 65, 0, 255)), + ("--affine-palette-line-black", Rgba::new(35, 35, 35, 255)), + ("--affine-palette-line-blue", Rgba::new(79, 144, 255, 255)), + ("--affine-palette-line-green", Rgba::new(124, 194, 112, 255)), + ("--affine-palette-line-grey", Rgba::new(191, 192, 191, 255)), + ("--affine-palette-line-magenta", Rgba::new(230, 96, 164, 255)), + ("--affine-palette-line-navy", Rgba::new(59, 37, 204, 255)), + ("--affine-palette-line-orange", Rgba::new(255, 175, 56, 255)), + ("--affine-palette-line-purple", Rgba::new(110, 82, 223, 255)), + ("--affine-palette-line-red", Rgba::new(237, 63, 63, 255)), + ("--affine-palette-line-tangerine", Rgba::new(250, 124, 69, 255)), + ("--affine-palette-line-teal", Rgba::new(122, 226, 213, 255)), + ("--affine-palette-line-white", Rgba::new(255, 255, 255, 255)), + ("--affine-palette-line-yellow", Rgba::new(255, 211, 56, 255)), + ("--affine-palette-shape-black", Rgba::new(35, 35, 35, 255)), + ("--affine-palette-shape-blue", Rgba::new(184, 227, 255, 255)), + ("--affine-palette-shape-green", Rgba::new(157, 209, 148, 255)), + ("--affine-palette-shape-grey", Rgba::new(216, 217, 216, 255)), + ("--affine-palette-shape-magenta", Rgba::new(237, 140, 189, 255)), + ("--affine-palette-shape-navy", Rgba::new(122, 149, 246, 255)), + ("--affine-palette-shape-orange", Rgba::new(255, 196, 107, 255)), + ("--affine-palette-shape-purple", Rgba::new(147, 126, 231, 255)), + ("--affine-palette-shape-red", Rgba::new(241, 111, 111, 255)), + ("--affine-palette-shape-tangerine", Rgba::new(251, 161, 121, 255)), + ("--affine-palette-shape-teal", Rgba::new(184, 242, 231, 255)), + ("--affine-palette-shape-white", Rgba::new(255, 255, 255, 255)), + ("--affine-palette-shape-yellow", Rgba::new(255, 223, 107, 255)), + ("--affine-placeholder-color", Rgba::new(62, 62, 63, 255)), + ("--affine-primary-color", Rgba::new(28, 158, 228, 255)), + ("--affine-primary-color-04", Rgba::new(52, 116, 173, 26)), + ("--affine-processing-color", Rgba::new(31, 94, 204, 255)), + ("--affine-pure-black", Rgba::new(0, 0, 0, 255)), + ("--affine-pure-black-10", Rgba::new(0, 0, 0, 26)), + ("--affine-pure-black-20", Rgba::new(0, 0, 0, 51)), + ("--affine-pure-black-80", Rgba::new(0, 0, 0, 204)), + ("--affine-pure-white", Rgba::new(255, 255, 255, 255)), + ("--affine-pure-white-10", Rgba::new(255, 255, 255, 26)), + ("--affine-quote-color", Rgba::new(142, 141, 145, 255)), + ("--affine-secondary-color", Rgba::new(144, 150, 245, 255)), + ("--affine-success-color", Rgba::new(13, 162, 107, 255)), + ("--affine-tag-blue", Rgba::new(8, 67, 136, 255)), + ("--affine-tag-gray", Rgba::new(41, 41, 41, 255)), + ("--affine-tag-green", Rgba::new(44, 108, 63, 255)), + ("--affine-tag-magenta", Rgba::new(105, 47, 111, 255)), + ("--affine-tag-orange", Rgba::new(185, 129, 46, 255)), + ("--affine-tag-pink", Rgba::new(155, 106, 106, 255)), + ("--affine-tag-purple", Rgba::new(47, 30, 113, 255)), + ("--affine-tag-red", Rgba::new(111, 50, 50, 255)), + ("--affine-tag-teal", Rgba::new(26, 115, 110, 255)), + ("--affine-tag-white", Rgba::new(67, 67, 67, 255)), + ("--affine-tag-yellow", Rgba::new(150, 132, 49, 255)), + ("--affine-tertiary-color", Rgba::new(30, 30, 30, 255)), + ("--affine-text-disable-color", Rgba::new(119, 117, 125, 255)), + ("--affine-text-emphasis-color", Rgba::new(30, 150, 235, 255)), + ("--affine-text-highlight-blue", Rgba::new(56, 75, 122, 255)), + ("--affine-text-highlight-foreground-blue", Rgba::new(128, 183, 251, 255)), + ("--affine-text-highlight-foreground-green", Rgba::new(110, 229, 153, 255)), + ("--affine-text-highlight-foreground-grey", Rgba::new(86, 86, 86, 255)), + ("--affine-text-highlight-foreground-orange", Rgba::new(252, 168, 99, 255)), + ("--affine-text-highlight-foreground-purple", Rgba::new(205, 157, 253, 255)), + ("--affine-text-highlight-foreground-red", Rgba::new(249, 141, 141, 255)), + ("--affine-text-highlight-foreground-teal", Rgba::new(87, 221, 204, 255)), + ("--affine-text-highlight-foreground-yellow", Rgba::new(251, 214, 68, 255)), + ("--affine-text-highlight-green", Rgba::new(26, 91, 50, 255)), + ("--affine-text-highlight-grey", Rgba::new(64, 67, 74, 255)), + ("--affine-text-highlight-orange", Rgba::new(112, 58, 21, 255)), + ("--affine-text-highlight-pink", Rgba::new(127, 93, 93, 255)), + ("--affine-text-highlight-purple", Rgba::new(80, 46, 111, 255)), + ("--affine-text-highlight-red", Rgba::new(108, 39, 39, 255)), + ("--affine-text-highlight-teal", Rgba::new(14, 85, 97, 255)), + ("--affine-text-highlight-yellow", Rgba::new(106, 84, 15, 255)), + ("--affine-text-primary-color", Rgba::new(234, 234, 234, 255)), + ("--affine-text-secondary-color", Rgba::new(156, 156, 160, 255)), + ("--affine-toggle-circle-background-color", Rgba::new(255, 255, 255, 255)), + ("--affine-toggle-disable-background-color", Rgba::new(119, 117, 125, 255)), + ("--affine-tooltip", Rgba::new(234, 234, 234, 255)), + ("--affine-v2-aI-applyBackground", Rgba::new(146, 146, 146, 26)), + ("--affine-v2-aI-applyDeleteHighlight", Rgba::new(237, 63, 63, 59)), + ("--affine-v2-aI-applyTextHighlight", Rgba::new(41, 163, 250, 255)), + ("--affine-v2-aI-applyTextHighlightBackground", Rgba::new(30, 150, 235, 51)), + ("--affine-v2-aI-errorBackground", Rgba::new(237, 63, 63, 46)), + ("--affine-v2-aI-errorDetailBackground", Rgba::new(0, 0, 0, 84)), + ("--affine-v2-aI-errorText", Rgba::new(255, 244, 245, 255)), + ("--affine-v2-aI-thinkingOutputBackground", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-aI-thinkingOutputText", Rgba::new(255, 255, 255, 143)), + ("--affine-v2-aI-userTextBackground", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-adjustmentHandle-background", Rgba::new(0, 0, 0, 133)), + ("--affine-v2-adjustmentHandle-border", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-backlinks-blockBackgroundColor", Rgba::new(146, 146, 146, 26)), + ("--affine-v2-backlinks-blockBorder", Rgba::new(146, 146, 146, 43)), + ("--affine-v2-backlinks-blockHover", Rgba::new(146, 146, 146, 43)), + ("--affine-v2-badge-believer", Rgba::new(0, 39, 66, 255)), + ("--affine-v2-badge-free", Rgba::new(41, 163, 250, 255)), + ("--affine-v2-badge-pro", Rgba::new(41, 163, 250, 255)), + ("--affine-v2-block-callout-background-blue", Rgba::new(0, 39, 66, 255)), + ("--affine-v2-block-callout-background-green", Rgba::new(25, 46, 6, 255)), + ("--affine-v2-block-callout-background-grey", Rgba::new(65, 65, 65, 255)), + ("--affine-v2-block-callout-background-magenta", Rgba::new(95, 10, 53, 255)), + ("--affine-v2-block-callout-background-orange", Rgba::new(69, 26, 2, 255)), + ("--affine-v2-block-callout-background-purple", Rgba::new(30, 27, 75, 255)), + ("--affine-v2-block-callout-background-red", Rgba::new(70, 6, 6, 255)), + ("--affine-v2-block-callout-background-teal", Rgba::new(14, 72, 65, 255)), + ("--affine-v2-block-callout-background-yellow", Rgba::new(50, 26, 4, 255)), + ("--affine-v2-block-callout-icon-blue", Rgba::new(47, 148, 213, 255)), + ("--affine-v2-block-callout-icon-green", Rgba::new(34, 191, 7, 255)), + ("--affine-v2-block-callout-icon-grey", Rgba::new(205, 205, 205, 255)), + ("--affine-v2-block-callout-icon-magenta", Rgba::new(204, 65, 135, 255)), + ("--affine-v2-block-callout-icon-orange", Rgba::new(217, 119, 5, 255)), + ("--affine-v2-block-callout-icon-purple", Rgba::new(124, 58, 237, 255)), + ("--affine-v2-block-callout-icon-red", Rgba::new(200, 48, 48, 255)), + ("--affine-v2-block-callout-icon-teal", Rgba::new(92, 199, 186, 255)), + ("--affine-v2-block-callout-icon-yellow", Rgba::new(224, 170, 0, 255)), + ("--affine-v2-block-code-lineNum", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-block-comment-hanelActive", Rgba::new(255, 255, 255, 13)), + ("--affine-v2-block-comment-highlightActive", Rgba::new(30, 150, 235, 77)), + ("--affine-v2-block-comment-highlightDefault", Rgba::new(30, 150, 235, 20)), + ("--affine-v2-block-comment-highlightUnderline", Rgba::new(30, 150, 235, 178)), + ("--affine-v2-block-divider-divider", Rgba::new(146, 146, 146, 43)), + ("--affine-v2-block-footnote-numberBg", Rgba::new(86, 86, 86, 255)), + ("--affine-v2-block-footnote-numberBgHover", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-block-list-header", Rgba::new(74, 177, 250, 255)), + ("--affine-v2-block-notSupportedBlock-background", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-block-notSupportedBlock-inlineBg-default", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-block-notSupportedBlock-inlineBg-hover", Rgba::new(65, 65, 65, 255)), + ("--affine-v2-block-recordBlock-buttonBg", Rgba::new(118, 23, 23, 255)), + ("--affine-v2-block-recordBlock-primary", Rgba::new(244, 83, 83, 255)), + ("--affine-v2-block-recordBlock-secordary", Rgba::new(200, 48, 48, 255)), + ("--affine-v2-block-recordBlock-timelineIndeicator", Rgba::new(237, 63, 63, 255)), + ("--affine-v2-button-actionActive", Rgba::new(255, 255, 255, 13)), + ("--affine-v2-button-badgesColor", Rgba::new(200, 48, 48, 255)), + ("--affine-v2-button-buttonOverHover", Rgba::new(65, 65, 65, 255)), + ("--affine-v2-button-checkBox", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-button-disable", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-button-emptyIconBackground", Rgba::new(255, 255, 255, 13)), + ("--affine-v2-button-error", Rgba::new(200, 48, 48, 255)), + ("--affine-v2-button-grabber-default", Rgba::new(255, 255, 255, 23)), + ("--affine-v2-button-grabber-select", Rgba::new(255, 255, 255, 33)), + ("--affine-v2-button-iconButtonSolid", Rgba::new(255, 255, 255, 23)), + ("--affine-v2-button-innerBlackBorder", Rgba::new(255, 255, 255, 13)), + ("--affine-v2-button-mobile-aIActionBackground", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-button-mobile-deletedAction", Rgba::new(200, 48, 48, 255)), + ("--affine-v2-button-primary", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-button-pureWhiteText", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-button-secondary", Rgba::new(255, 255, 255, 23)), + ("--affine-v2-button-sidebarButton-background", Rgba::new(255, 255, 255, 8)), + ("--affine-v2-button-siderbarPrimary-background", Rgba::new(0, 0, 0, 43)), + ("--affine-v2-button-signinbutton-background", Rgba::new(65, 65, 65, 255)), + ("--affine-v2-button-success", Rgba::new(29, 156, 7, 255)), + ("--affine-v2-button-templateLabelBackground", Rgba::new(30, 150, 235, 20)), + ("--affine-v2-calendar-blue", Rgba::new(41, 163, 250, 255)), + ("--affine-v2-calendar-green", Rgba::new(60, 188, 54, 255)), + ("--affine-v2-calendar-grey", Rgba::new(146, 146, 146, 255)), + ("--affine-v2-calendar-magenta", Rgba::new(230, 96, 164, 255)), + ("--affine-v2-calendar-orange", Rgba::new(255, 140, 56, 255)), + ("--affine-v2-calendar-purple", Rgba::new(110, 82, 223, 255)), + ("--affine-v2-calendar-red", Rgba::new(237, 63, 63, 255)), + ("--affine-v2-calendar-teal", Rgba::new(92, 199, 186, 255)), + ("--affine-v2-calendar-yellow", Rgba::new(250, 204, 21, 255)), + ("--affine-v2-centerPeek-background", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-centerPeek-buttonBackground", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-centerPeek-icon", Rgba::new(205, 205, 205, 255)), + ("--affine-v2-centerPeek-overlay", Rgba::new(0, 0, 0, 133)), + ("--affine-v2-chatBlock-chatBlockBg", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-chatBlock-chatBlockBoder", Rgba::new(65, 65, 65, 255)), + ("--affine-v2-chatBlock-chatBlockIcon", Rgba::new(205, 205, 205, 255)), + ("--affine-v2-chatBlock-chatBlockText", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-chip-label-blue", Rgba::new(0, 75, 123, 255)), + ("--affine-v2-chip-label-green", Rgba::new(34, 92, 24, 255)), + ("--affine-v2-chip-label-grey", Rgba::new(65, 65, 65, 255)), + ("--affine-v2-chip-label-magenta", Rgba::new(95, 10, 53, 255)), + ("--affine-v2-chip-label-orange", Rgba::new(132, 59, 6, 255)), + ("--affine-v2-chip-label-purple", Rgba::new(37, 19, 109, 255)), + ("--affine-v2-chip-label-red", Rgba::new(70, 6, 6, 255)), + ("--affine-v2-chip-label-teal", Rgba::new(28, 107, 99, 255)), + ("--affine-v2-chip-label-text", Rgba::new(255, 255, 255, 171)), + ("--affine-v2-chip-label-white", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-chip-label-yellow", Rgba::new(172, 116, 0, 255)), + ("--affine-v2-chip-tag-blue", Rgba::new(132, 207, 255, 255)), + ("--affine-v2-chip-tag-green", Rgba::new(105, 184, 125, 255)), + ("--affine-v2-chip-tag-grey", Rgba::new(179, 179, 179, 255)), + ("--affine-v2-chip-tag-orange", Rgba::new(255, 140, 56, 255)), + ("--affine-v2-chip-tag-purple", Rgba::new(124, 58, 237, 255)), + ("--affine-v2-chip-tag-red", Rgba::new(237, 63, 63, 255)), + ("--affine-v2-chip-tag-teal", Rgba::new(139, 231, 220, 255)), + ("--affine-v2-chip-tag-yellow", Rgba::new(250, 204, 21, 255)), + ("--affine-v2-database-attachment-fileSolidBackground", Rgba::new(65, 65, 65, 255)), + ("--affine-v2-database-border", Rgba::new(255, 255, 255, 33)), + ("--affine-v2-database-buttonBackground", Rgba::new(65, 65, 65, 255)), + ("--affine-v2-database-cardHover", Rgba::new(255, 255, 255, 8)), + ("--affine-v2-database-filterHeaderFadeIn", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-database-filterHeaderFadeOut", Rgba::new(0, 0, 0, 8)), + ("--affine-v2-database-focusBackground", Rgba::new(30, 150, 235, 10)), + ("--affine-v2-database-textSecondary", Rgba::new(255, 255, 255, 143)), + ("--affine-v2-dialog-background-primary", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-edgeless-alignment-edgeGuides", Rgba::new(230, 96, 164, 255)), + ("--affine-v2-edgeless-alignment-guides", Rgba::new(139, 92, 246, 255)), + ("--affine-v2-edgeless-frame-background-black", Rgba::new(205, 205, 205, 255)), + ("--affine-v2-edgeless-frame-background-blue", Rgba::new(230, 245, 255, 255)), + ("--affine-v2-edgeless-frame-background-green", Rgba::new(241, 253, 244, 255)), + ("--affine-v2-edgeless-frame-background-grey", Rgba::new(243, 243, 243, 255)), + ("--affine-v2-edgeless-frame-background-magenta", Rgba::new(255, 236, 246, 255)), + ("--affine-v2-edgeless-frame-background-orange", Rgba::new(255, 235, 213, 255)), + ("--affine-v2-edgeless-frame-background-purple", Rgba::new(237, 233, 255, 255)), + ("--affine-v2-edgeless-frame-background-red", Rgba::new(252, 229, 230, 255)), + ("--affine-v2-edgeless-frame-background-teal", Rgba::new(226, 253, 249, 255)), + ("--affine-v2-edgeless-frame-background-white", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-edgeless-frame-background-yellow", Rgba::new(255, 251, 213, 255)), + ("--affine-v2-edgeless-frame-border-active", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-edgeless-frame-border-default", Rgba::new(255, 255, 255, 43)), + ("--affine-v2-edgeless-frame-fontColor-font", Rgba::new(0, 0, 0, 242)), + ("--affine-v2-edgeless-group-background-background", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-edgeless-group-border-active", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-edgeless-group-border-borderHint", Rgba::new(143, 209, 255, 255)), + ("--affine-v2-edgeless-group-border-hover", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-edgeless-group-fontColor-active", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-edgeless-group-fontColor-default", Rgba::new(255, 255, 255, 143)), + ("--affine-v2-edgeless-group-fontColor-hover", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-edgeless-group-fontColor-rename", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-edgeless-line-black", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-edgeless-line-blue", Rgba::new(41, 163, 250, 255)), + ("--affine-v2-edgeless-line-green", Rgba::new(60, 188, 54, 255)), + ("--affine-v2-edgeless-line-grey", Rgba::new(146, 146, 146, 255)), + ("--affine-v2-edgeless-line-magenta", Rgba::new(230, 96, 164, 255)), + ("--affine-v2-edgeless-line-orange", Rgba::new(255, 140, 56, 255)), + ("--affine-v2-edgeless-line-purple", Rgba::new(110, 82, 223, 255)), + ("--affine-v2-edgeless-line-red", Rgba::new(237, 63, 63, 255)), + ("--affine-v2-edgeless-line-teal", Rgba::new(92, 199, 186, 255)), + ("--affine-v2-edgeless-line-white", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-edgeless-line-yellow", Rgba::new(250, 204, 21, 255)), + ("--affine-v2-edgeless-lock-locked", Rgba::new(146, 146, 146, 133)), + ("--affine-v2-edgeless-mindMap-line", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-edgeless-note-black", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-edgeless-note-blue", Rgba::new(0, 75, 123, 255)), + ("--affine-v2-edgeless-note-green", Rgba::new(59, 83, 21, 255)), + ("--affine-v2-edgeless-note-grey", Rgba::new(86, 86, 86, 255)), + ("--affine-v2-edgeless-note-magenta", Rgba::new(95, 10, 53, 255)), + ("--affine-v2-edgeless-note-orange", Rgba::new(132, 59, 6, 255)), + ("--affine-v2-edgeless-note-purple", Rgba::new(49, 46, 129, 255)), + ("--affine-v2-edgeless-note-red", Rgba::new(70, 6, 6, 255)), + ("--affine-v2-edgeless-note-teal", Rgba::new(14, 72, 65, 255)), + ("--affine-v2-edgeless-note-white", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-edgeless-note-yellow", Rgba::new(112, 66, 0, 255)), + ("--affine-v2-edgeless-palette-black", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-edgeless-palette-heavy-blue", Rgba::new(28, 112, 165, 255)), + ("--affine-v2-edgeless-palette-heavy-green", Rgba::new(68, 119, 86, 255)), + ("--affine-v2-edgeless-palette-heavy-magenta", Rgba::new(148, 21, 85, 255)), + ("--affine-v2-edgeless-palette-heavy-orange", Rgba::new(181, 83, 9, 255)), + ("--affine-v2-edgeless-palette-heavy-purple", Rgba::new(90, 33, 182, 255)), + ("--affine-v2-edgeless-palette-heavy-red", Rgba::new(118, 23, 23, 255)), + ("--affine-v2-edgeless-palette-heavy-yellow", Rgba::new(172, 116, 0, 255)), + ("--affine-v2-edgeless-palette-light-blueLight", Rgba::new(230, 245, 255, 255)), + ("--affine-v2-edgeless-palette-light-greenLight", Rgba::new(241, 253, 244, 255)), + ("--affine-v2-edgeless-palette-light-greyLight", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-edgeless-palette-light-magentaLight", Rgba::new(255, 236, 246, 255)), + ("--affine-v2-edgeless-palette-light-orangeLight", Rgba::new(255, 235, 213, 255)), + ("--affine-v2-edgeless-palette-light-purpleLight", Rgba::new(215, 205, 255, 255)), + ("--affine-v2-edgeless-palette-light-redLight", Rgba::new(252, 229, 230, 255)), + ("--affine-v2-edgeless-palette-light-yellowLight", Rgba::new(255, 251, 213, 255)), + ("--affine-v2-edgeless-palette-medium-blueMedium", Rgba::new(132, 207, 255, 255)), + ("--affine-v2-edgeless-palette-medium-greenMedium", Rgba::new(60, 188, 54, 255)), + ("--affine-v2-edgeless-palette-medium-greyMedium", Rgba::new(146, 146, 146, 255)), + ("--affine-v2-edgeless-palette-medium-magentaMedium", Rgba::new(233, 108, 171, 255)), + ("--affine-v2-edgeless-palette-medium-orangeMedium", Rgba::new(255, 140, 56, 255)), + ("--affine-v2-edgeless-palette-medium-purpleMedium", Rgba::new(110, 82, 223, 255)), + ("--affine-v2-edgeless-palette-medium-redMedium", Rgba::new(251, 112, 129, 255)), + ("--affine-v2-edgeless-palette-medium-yellowMedium", Rgba::new(252, 211, 77, 255)), + ("--affine-v2-edgeless-palette-white", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-edgeless-selection-selectionMarqueeBackground", Rgba::new(30, 150, 235, 20)), + ("--affine-v2-edgeless-selection-selectionMarqueeBorder", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-edgeless-shape-black", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-edgeless-shape-blue", Rgba::new(159, 217, 255, 255)), + ("--affine-v2-edgeless-shape-green", Rgba::new(155, 218, 145, 255)), + ("--affine-v2-edgeless-shape-grey", Rgba::new(205, 205, 205, 255)), + ("--affine-v2-edgeless-shape-magenta", Rgba::new(255, 192, 224, 255)), + ("--affine-v2-edgeless-shape-orange", Rgba::new(255, 174, 99, 255)), + ("--affine-v2-edgeless-shape-purple", Rgba::new(215, 205, 255, 255)), + ("--affine-v2-edgeless-shape-red", Rgba::new(251, 183, 183, 255)), + ("--affine-v2-edgeless-shape-teal", Rgba::new(139, 231, 220, 255)), + ("--affine-v2-edgeless-shape-white", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-edgeless-shape-yellow", Rgba::new(253, 224, 71, 255)), + ("--affine-v2-edgelessToolbar-highlightPen-body", Rgba::new(61, 61, 61, 255)), + ("--affine-v2-edgelessToolbar-highlightPen-body1Linear1-1", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body1Linear1-2", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body1Linear1-3", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-edgelessToolbar-highlightPen-body1Linear2-1", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body1Linear2-2", Rgba::new(0, 0, 0, 128)), + ("--affine-v2-edgelessToolbar-highlightPen-body1Linear2-3", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-edgelessToolbar-highlightPen-body1Linear2-4", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-edgelessToolbar-highlightPen-body2", Rgba::new(48, 48, 48, 255)), + ("--affine-v2-edgelessToolbar-highlightPen-body2Linear1-1", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body2Linear1-2", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body2Linear1-3", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body2Linear2-1", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body2Linear2-2", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body2Linear2-3", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-body2Linear2-4", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-edgelessToolbar-highlightPen-body2Linear2-5", Rgba::new(121, 121, 121, 255)), + ("--affine-v2-edgelessToolbar-highlightPen-bodyColorLinear-1", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-highlightPen-bodyColorLinear-2", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-edgelessToolbar-highlightPen-bodyColorLinear-3", Rgba::new(0, 0, 0, 196)), + ("--affine-v2-edgelessToolbar-media-whiteVector", Rgba::new(0, 0, 0, 56)), + ("--affine-v2-edgelessToolbar-note-background", Rgba::new(65, 65, 65, 255)), + ("--affine-v2-edgelessToolbar-note-textColor", Rgba::new(255, 255, 255, 33)), + ("--affine-v2-edgelessToolbar-others-background", Rgba::new(74, 74, 74, 178)), + ("--affine-v2-edgelessToolbar-others-highlightLinearEnd", Rgba::new(255, 255, 255, 31)), + ("--affine-v2-edgelessToolbar-others-highlightLinearStart", Rgba::new(255, 255, 255, 15)), + ("--affine-v2-edgelessToolbar-others-linearCenter", Rgba::new(0, 0, 0, 168)), + ("--affine-v2-edgelessToolbar-others-linearEnd", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-others-linearStart", Rgba::new(0, 0, 0, 0)), + ("--affine-v2-edgelessToolbar-penEraser-eraserBlue-1", Rgba::new(28, 61, 93, 255)), + ("--affine-v2-edgelessToolbar-penEraser-eraserBlue-2", Rgba::new(161, 197, 211, 255)), + ("--affine-v2-edgelessToolbar-penEraser-eraserBlue-3", Rgba::new(26, 124, 193, 255)), + ("--affine-v2-edgelessToolbar-penEraser-eraserBodyFill", Rgba::new(61, 61, 61, 255)), + ("--affine-v2-edgelessToolbar-penEraser-eraserBodyHighlight", Rgba::new(255, 255, 255, 23)), + ("--affine-v2-edgelessToolbar-penEraser-eraserBodyShade2", Rgba::new(0, 0, 0, 204)), + ("--affine-v2-edgelessToolbar-penEraser-eraserBodyShade3", Rgba::new(255, 255, 255, 102)), + ("--affine-v2-edgelessToolbar-penEraser-eraserBorder", Rgba::new(127, 127, 127, 255)), + ("--affine-v2-edgelessToolbar-penEraser-eraserBorder2", Rgba::new(155, 155, 155, 255)), + ("--affine-v2-edgelessToolbar-penEraser-eraserClothHighlight", Rgba::new(255, 255, 255, 28)), + ("--affine-v2-edgelessToolbar-penEraser-eraserClothShade2", Rgba::new(15, 15, 15, 255)), + ("--affine-v2-edgelessToolbar-penEraser-eraserClothShade3", Rgba::new(255, 255, 255, 23)), + ("--affine-v2-edgelessToolbar-penEraser-eraserShadow", Rgba::new(0, 0, 0, 196)), + ("--affine-v2-edgelessToolbar-penEraser-penBackground", Rgba::new(61, 61, 61, 255)), + ("--affine-v2-edgelessToolbar-penEraser-penBodyShade-1", Rgba::new(0, 0, 0, 153)), + ("--affine-v2-edgelessToolbar-penEraser-penBodyShade-2", Rgba::new(0, 0, 0, 102)), + ("--affine-v2-edgelessToolbar-penEraser-penBodyShade-3", Rgba::new(0, 0, 0, 51)), + ("--affine-v2-edgelessToolbar-penEraser-penBodyShade-4", Rgba::new(0, 0, 0, 26)), + ("--affine-v2-edgelessToolbar-penEraser-penInlineShadow", Rgba::new(0, 0, 0, 64)), + ("--affine-v2-icon-activated", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-icon-disable", Rgba::new(65, 65, 65, 255)), + ("--affine-v2-icon-fileIconBorder", Rgba::new(86, 86, 86, 255)), + ("--affine-v2-icon-fileIconColors-blue", Rgba::new(0, 119, 203, 255)), + ("--affine-v2-icon-fileIconColors-green", Rgba::new(29, 156, 7, 255)), + ("--affine-v2-icon-fileIconColors-grey", Rgba::new(49, 46, 129, 255)), + ("--affine-v2-icon-fileIconColors-magenta", Rgba::new(230, 96, 164, 255)), + ("--affine-v2-icon-fileIconColors-purple", Rgba::new(110, 82, 223, 255)), + ("--affine-v2-icon-fileIconColors-red", Rgba::new(237, 63, 63, 255)), + ("--affine-v2-icon-fileIconColors-yellow", Rgba::new(250, 204, 21, 255)), + ("--affine-v2-icon-monotone", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-icon-primary", Rgba::new(243, 243, 243, 255)), + ("--affine-v2-icon-secondary", Rgba::new(205, 205, 205, 255)), + ("--affine-v2-icon-tertiary", Rgba::new(86, 86, 86, 255)), + ("--affine-v2-icon-transparentBlack", Rgba::new(255, 255, 255, 184)), + ("--affine-v2-input-background", Rgba::new(255, 255, 255, 23)), + ("--affine-v2-input-border-active", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-input-border-default", Rgba::new(255, 255, 255, 13)), + ("--affine-v2-input-border-error", Rgba::new(237, 63, 63, 255)), + ("--affine-v2-input-scrollBar-handle", Rgba::new(255, 255, 255, 43)), + ("--affine-v2-integrations-background-iconSolid", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-layer-background-codeBlock", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-layer-background-edgelessGrid", Rgba::new(86, 86, 86, 255)), + ("--affine-v2-layer-background-error", Rgba::new(70, 6, 6, 255)), + ("--affine-v2-layer-background-hoverOverlay", Rgba::new(255, 255, 255, 23)), + ("--affine-v2-layer-background-linkedDocOnEdgeless", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-layer-background-mobile-iOSControl", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-layer-background-mobile-modal", Rgba::new(0, 0, 0, 133)), + ("--affine-v2-layer-background-mobile-primary", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-layer-background-mobile-secondary", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-layer-background-mobile-tertiary", Rgba::new(65, 65, 65, 255)), + ("--affine-v2-layer-background-modal", Rgba::new(0, 0, 0, 133)), + ("--affine-v2-layer-background-modalWhite", Rgba::new(255, 255, 255, 43)), + ("--affine-v2-layer-background-overlayPanel", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-layer-background-primary", Rgba::new(20, 20, 20, 255)), + ("--affine-v2-layer-background-processing", Rgba::new(0, 39, 66, 255)), + ("--affine-v2-layer-background-secondary", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-layer-background-success", Rgba::new(28, 48, 39, 255)), + ("--affine-v2-layer-background-tertiary", Rgba::new(86, 86, 86, 255)), + ("--affine-v2-layer-background-translucentUI", Rgba::new(0, 0, 0, 166)), + ("--affine-v2-layer-background-warning", Rgba::new(50, 26, 4, 255)), + ("--affine-v2-layer-black", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-layer-insideBorder-blackBorder", Rgba::new(255, 255, 255, 13)), + ("--affine-v2-layer-insideBorder-border", Rgba::new(65, 65, 65, 255)), + ("--affine-v2-layer-insideBorder-primaryBorder", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-layer-insideBorder-splitviewActived", Rgba::new(255, 255, 255, 171)), + ("--affine-v2-layer-insideBorder-whiteBorder", Rgba::new(255, 255, 255, 13)), + ("--affine-v2-layer-pureBlack", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-layer-pureWhite", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-layer-white", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-loading-background", Rgba::new(255, 255, 255, 43)), + ("--affine-v2-loading-backgroundLayer", Rgba::new(146, 146, 146, 242)), + ("--affine-v2-loading-foreground", Rgba::new(0, 119, 203, 255)), + ("--affine-v2-loading-imageLoadingBackground", Rgba::new(146, 146, 146, 56)), + ("--affine-v2-loading-imageLoadingLayer", Rgba::new(255, 255, 255, 143)), + ("--affine-v2-others-warnLabel-black", Rgba::new(0, 0, 0, 255)), + ("--affine-v2-others-warnLabel-yellow", Rgba::new(250, 204, 21, 255)), + ("--affine-v2-pagelist-hoverBorder", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-portrait-localPortrait", Rgba::new(255, 255, 255, 59)), + ("--affine-v2-portrait-localPortraitBackground", Rgba::new(255, 255, 255, 43)), + ("--affine-v2-radio-active-chekced", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-radio-active-default", Rgba::new(179, 179, 179, 255)), + ("--affine-v2-radio-disable", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-readwise-quoteBackground", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-readwise-quoteDivider", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-segment-background", Rgba::new(255, 255, 255, 13)), + ("--affine-v2-segment-button", Rgba::new(255, 255, 255, 23)), + ("--affine-v2-selfhost-button-disable", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-selfhost-button-primary", Rgba::new(243, 243, 243, 255)), + ("--affine-v2-selfhost-button-secondary", Rgba::new(255, 255, 255, 23)), + ("--affine-v2-selfhost-button-sidebarButton-bg-hover", Rgba::new(255, 255, 255, 23)), + ("--affine-v2-selfhost-button-sidebarButton-bg-select", Rgba::new(255, 255, 255, 23)), + ("--affine-v2-selfhost-icon-buttonIcon", Rgba::new(20, 20, 20, 255)), + ("--affine-v2-selfhost-icon-buttonIconError", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-selfhost-icon-disable", Rgba::new(86, 86, 86, 255)), + ("--affine-v2-selfhost-icon-primary", Rgba::new(243, 243, 243, 255)), + ("--affine-v2-selfhost-icon-secondary", Rgba::new(205, 205, 205, 255)), + ("--affine-v2-selfhost-icon-tertiary", Rgba::new(86, 86, 86, 255)), + ("--affine-v2-selfhost-layer-background-hoverOverlay", Rgba::new(255, 255, 255, 250)), + ("--affine-v2-selfhost-layer-background-primary", Rgba::new(20, 20, 20, 255)), + ("--affine-v2-selfhost-layer-background-secondary", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-selfhost-layer-background-sidebarBg-sidebarBg", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-selfhost-layer-border-border", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-selfhost-portrait-localPortraitBackground", Rgba::new(255, 255, 255, 33)), + ("--affine-v2-selfhost-progress-error", Rgba::new(200, 48, 48, 255)), + ("--affine-v2-selfhost-progress-primary", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-selfhost-text-button-error", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-selfhost-text-button-primary", Rgba::new(20, 20, 20, 255)), + ("--affine-v2-selfhost-text-placeholder", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-selfhost-text-sidebar-primary", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-selfhost-text-sidebar-secondary", Rgba::new(205, 205, 205, 255)), + ("--affine-v2-selfhost-toggle-backgroundDisable", Rgba::new(65, 65, 65, 255)), + ("--affine-v2-selfhost-toggle-backgroundOff", Rgba::new(86, 86, 86, 255)), + ("--affine-v2-selfhost-toggle-backgroundOn", Rgba::new(179, 179, 179, 255)), + ("--affine-v2-selfhost-toggle-foreground", Rgba::new(255, 255, 255, 250)), + ("--affine-v2-selfhost-toggle-foregroundDisable", Rgba::new(86, 86, 86, 255)), + ("--affine-v2-skeleton-skeleton", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-slashMenu-background", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-status-error", Rgba::new(200, 48, 48, 255)), + ("--affine-v2-status-success", Rgba::new(29, 156, 7, 255)), + ("--affine-v2-switch-buttonBackground-active", Rgba::new(65, 65, 65, 255)), + ("--affine-v2-switch-buttonBackground-hover", Rgba::new(255, 255, 255, 13)), + ("--affine-v2-switch-fontColor-primary", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-switch-fontColor-secondary", Rgba::new(146, 146, 146, 255)), + ("--affine-v2-switch-fontColor-tertiary", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-switch-iconColor-active", Rgba::new(205, 205, 205, 255)), + ("--affine-v2-switch-iconColor-default", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-switch-switchBackground-background", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-tab-divider-divider", Rgba::new(255, 255, 255, 33)), + ("--affine-v2-tab-divider-indicator", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-tab-fontColor-active", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-tab-fontColor-default", Rgba::new(86, 86, 86, 255)), + ("--affine-v2-tab-fontColor-hover", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-tab-iconColor-active", Rgba::new(205, 205, 205, 255)), + ("--affine-v2-tab-iconColor-default", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-tab-iconColor-hover", Rgba::new(205, 205, 205, 255)), + ("--affine-v2-tab-tabBackground-active", Rgba::new(65, 65, 65, 255)), + ("--affine-v2-tab-tabBackground-default", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-tab-tabBackground-hover", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-table-border", Rgba::new(255, 255, 255, 33)), + ("--affine-v2-table-focusBackground", Rgba::new(30, 150, 235, 10)), + ("--affine-v2-table-focusBorder", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-table-headerBackground-blue", Rgba::new(0, 75, 123, 255)), + ("--affine-v2-table-headerBackground-default", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-table-headerBackground-green", Rgba::new(16, 52, 10, 255)), + ("--affine-v2-table-headerBackground-grey", Rgba::new(86, 86, 86, 255)), + ("--affine-v2-table-headerBackground-headerColor", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-table-headerBackground-orange", Rgba::new(132, 59, 6, 255)), + ("--affine-v2-table-headerBackground-purple", Rgba::new(37, 19, 109, 255)), + ("--affine-v2-table-headerBackground-red", Rgba::new(70, 6, 6, 255)), + ("--affine-v2-table-headerBackground-teal", Rgba::new(14, 72, 65, 255)), + ("--affine-v2-table-headerBackground-yellow", Rgba::new(112, 66, 0, 255)), + ("--affine-v2-table-indicator-activated", Rgba::new(30, 150, 235, 255)), + ("--affine-v2-table-indicator-border", Rgba::new(65, 65, 65, 255)), + ("--affine-v2-table-indicator-drag", Rgba::new(255, 255, 255, 33)), + ("--affine-v2-table-indicator-hover", Rgba::new(255, 255, 255, 23)), + ("--affine-v2-table-indicator-pointerActive", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-table-indicator-pointerDefault", Rgba::new(205, 205, 205, 255)), + ("--affine-v2-table-textSecondary", Rgba::new(255, 255, 255, 143)), + ("--affine-v2-tableOfContent-background", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-text-disable", Rgba::new(86, 86, 86, 255)), + ("--affine-v2-text-emphasis", Rgba::new(41, 163, 250, 255)), + ("--affine-v2-text-highlight-bg-blue", Rgba::new(0, 39, 66, 255)), + ("--affine-v2-text-highlight-bg-green", Rgba::new(25, 46, 6, 255)), + ("--affine-v2-text-highlight-bg-grey", Rgba::new(65, 65, 65, 255)), + ("--affine-v2-text-highlight-bg-magenta", Rgba::new(95, 10, 53, 255)), + ("--affine-v2-text-highlight-bg-orange", Rgba::new(132, 59, 6, 255)), + ("--affine-v2-text-highlight-bg-purple", Rgba::new(46, 16, 101, 255)), + ("--affine-v2-text-highlight-bg-red", Rgba::new(70, 6, 6, 255)), + ("--affine-v2-text-highlight-bg-teal", Rgba::new(14, 72, 65, 255)), + ("--affine-v2-text-highlight-bg-yellow", Rgba::new(50, 26, 4, 255)), + ("--affine-v2-text-highlight-border", Rgba::new(255, 255, 255, 59)), + ("--affine-v2-text-highlight-fg-blue", Rgba::new(47, 148, 213, 255)), + ("--affine-v2-text-highlight-fg-green", Rgba::new(155, 218, 145, 255)), + ("--affine-v2-text-highlight-fg-grey", Rgba::new(86, 86, 86, 255)), + ("--affine-v2-text-highlight-fg-magenta", Rgba::new(243, 127, 186, 255)), + ("--affine-v2-text-highlight-fg-orange", Rgba::new(255, 174, 99, 255)), + ("--affine-v2-text-highlight-fg-purple", Rgba::new(150, 129, 239, 255)), + ("--affine-v2-text-highlight-fg-red", Rgba::new(252, 121, 121, 255)), + ("--affine-v2-text-highlight-fg-teal", Rgba::new(68, 142, 134, 255)), + ("--affine-v2-text-highlight-fg-yellow", Rgba::new(250, 204, 21, 255)), + ("--affine-v2-text-link", Rgba::new(122, 200, 255, 255)), + ("--affine-v2-text-listDotAndNumber", Rgba::new(74, 177, 250, 255)), + ("--affine-v2-text-placeholder", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-text-primary", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-text-pureWhite", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-text-secondary", Rgba::new(146, 146, 146, 255)), + ("--affine-v2-text-tertiary", Rgba::new(122, 122, 122, 255)), + ("--affine-v2-toast-cardLayer-second", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-toast-cardLayer-third", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-toast-iconState-error", Rgba::new(200, 48, 48, 255)), + ("--affine-v2-toast-iconState-regular", Rgba::new(3, 95, 159, 255)), + ("--affine-v2-toast-iconState-success", Rgba::new(29, 156, 7, 255)), + ("--affine-v2-toast-overlay-secondary", Rgba::new(0, 0, 0, 13)), + ("--affine-v2-toast-overlay-tertiary", Rgba::new(0, 0, 0, 8)), + ("--affine-v2-toggle-background", Rgba::new(0, 119, 203, 255)), + ("--affine-v2-toggle-backgroundDisable", Rgba::new(65, 65, 65, 255)), + ("--affine-v2-toggle-backgroundOff", Rgba::new(86, 86, 86, 255)), + ("--affine-v2-toggle-foreground", Rgba::new(255, 255, 255, 250)), + ("--affine-v2-toggle-foregroundDisable", Rgba::new(146, 146, 146, 255)), + ("--affine-v2-tooltips-background", Rgba::new(65, 65, 65, 255)), + ("--affine-v2-tooltips-foreground", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-tooltips-secondaryBackground", Rgba::new(255, 255, 255, 43)), + ("--affine-v2-workspacePicker-border", Rgba::new(65, 65, 65, 255)), + ("--affine-v2-workspacePicker-secondaryBackground", Rgba::new(146, 146, 146, 43)), + ("--affine-warning-color", Rgba::new(188, 54, 42, 255)), + ("--affine-white", Rgba::new(0, 0, 0, 255)), + ("--affine-white-10", Rgba::new(0, 0, 0, 26)), + ("--affine-white-30", Rgba::new(0, 0, 0, 77)), + ("--affine-white-50", Rgba::new(0, 0, 0, 128)), + ("--affine-white-60", Rgba::new(0, 0, 0, 153)), + ("--affine-white-80", Rgba::new(0, 0, 0, 204)), + ("--affine-white-90", Rgba::new(0, 0, 0, 230)), + ("--affine-windows-close-button", Rgba::new(196, 43, 28, 255)), + ], + shadows: &[ + ("--affine-active-shadow", "0px 0px 0px 2px rgba(28, 158, 228, .3)"), + ("--affine-ai-empty-shadow", "0px 4px 4px rgba(66, 65, 73, .1), 0px 6px 8px rgba(66, 65, 73, .05)"), + ("--affine-button-inner-shadow", "unset"), + ("--affine-button-shadow", "0px 0px 1px 0px rgba(0, 0, 0, .2), 0px 1px 5px 0px rgba(0, 0, 0, .2)"), + ("--affine-cmd-shadow", "0px 16px 80px 0px rgba(0, 0, 0, .8)"), + ("--affine-embed-shadow", "0px 0px 0px 2px rgba(255, 255, 255, .14)"), + ("--affine-float-button-shadow", "0px 0px 10px rgba(0, 0, 0, .05), 0px 0px 0px .5px rgba(0, 0, 0, .1)"), + ("--affine-float-button-shadow-1", "0px 4px 6px -3px rgba(0, 0, 0, .1), 0px 10px 12px -2px rgba(0, 0, 0, .1)"), + ("--affine-float-button-shadow-2", "0px 4px 4px -2px rgba(15, 15, 15, .1), 0px 6px 8px 1px rgba(15, 15, 15, .05)"), + ("--affine-kanban-shadow", "0px 2px 3px 0px rgba(0, 0, 0, .6)"), + ("--affine-menu-shadow", "0px 10px 18px rgba(0,0,0,.14), 0px -1px 12px rgba(0,0,0,.08)"), + ("--affine-multi-cursors-shadow", "0px 2px 4px 0px rgba(0, 0, 0, .28)"), + ("--affine-multi-players-shadow", "0px 1px 6px 0px rgba(0, 0, 0, .16)"), + ("--affine-note-shadow-box", "0px 0px 2px 0px rgba(255, 255, 255, .44), 0px 2px 12px 0px rgba(0, 0, 0, .3)"), + ("--affine-note-shadow-film", "10px 10px 0px 6px #7A7A7A, 0px 0px 0px 6px #7A7A7A"), + ("--affine-note-shadow-float", "0px 0px 32px 0px rgba(0, 0, 0, .3), 0px 0px 2px 0px rgba(255, 255, 255, .44)"), + ("--affine-note-shadow-paper", "0px 2px 4px 0px rgba(0, 0, 0, .3), 0px 0px 10px #7A7A7A, 0px 6px 12px rgba(0, 0, 0, .4)"), + ("--affine-note-shadow-sticker", "0px 24px 26px -10px rgba(0, 0, 0, .22), 0px 26px 18px -18px rgba(0, 0, 0, .52)"), + ("--affine-overlay-panel-shadow", "0px 1px 6px rgba(0,0,0,.2), 0px 8px 14px rgba(0,0,0,.3)"), + ("--affine-overlay-shadow", "0px 1px 6px 0px rgba(0, 0, 0, .72), 0px 8px 14px 0px rgba(0, 0, 0, .32)"), + ("--affine-popover-shadow", "0px 0px 30px 0px rgba(0, 0, 0, .1), 0px 0px 8px 0px rgba(0, 0, 0, .18), 0px 0px 0px .5px rgba(48, 48, 48, 1) inset"), + ("--affine-shadow-1", "0px 0px 4px 0px rgba(0, 0, 0, .24)"), + ("--affine-shadow-2", "0px 0px 12px 0px rgba(0, 0, 0, .28)"), + ("--affine-shadow-3", "0px 0px 20px 0px rgba(0, 0, 0, .32)"), + ("--affine-toggle-circle-shadow", "0px 1px 2px 0px rgba(0, 0, 0, .25), inset -2px -3px 2px 0px rgba(0, 0, 0, .05)"), + ("--affine-toolbar-shadow", "0px 6px 18px #00000052"), + ], + note_palette: &[ + ("--affine-note-background-black", Rgba::new(255, 255, 255, 255)), + ("--affine-note-background-blue", Rgba::new(3, 95, 159, 255)), + ("--affine-note-background-green", Rgba::new(59, 83, 21, 255)), + ("--affine-note-background-grey", Rgba::new(86, 86, 86, 255)), + ("--affine-note-background-magenta", Rgba::new(148, 21, 85, 255)), + ("--affine-note-background-orange", Rgba::new(132, 59, 6, 255)), + ("--affine-note-background-purple", Rgba::new(49, 46, 129, 255)), + ("--affine-note-background-red", Rgba::new(118, 23, 23, 255)), + ("--affine-note-background-teal", Rgba::new(28, 107, 99, 255)), + ("--affine-note-background-white", Rgba::new(0, 0, 0, 255)), + ("--affine-note-background-yellow", Rgba::new(111, 65, 0, 255)), + ("--affine-v2-edgeless-note-black", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-edgeless-note-blue", Rgba::new(0, 75, 123, 255)), + ("--affine-v2-edgeless-note-green", Rgba::new(59, 83, 21, 255)), + ("--affine-v2-edgeless-note-grey", Rgba::new(86, 86, 86, 255)), + ("--affine-v2-edgeless-note-magenta", Rgba::new(95, 10, 53, 255)), + ("--affine-v2-edgeless-note-orange", Rgba::new(132, 59, 6, 255)), + ("--affine-v2-edgeless-note-purple", Rgba::new(49, 46, 129, 255)), + ("--affine-v2-edgeless-note-red", Rgba::new(70, 6, 6, 255)), + ("--affine-v2-edgeless-note-teal", Rgba::new(14, 72, 65, 255)), + ("--affine-v2-edgeless-note-white", Rgba::new(37, 37, 37, 255)), + ("--affine-v2-edgeless-note-yellow", Rgba::new(112, 66, 0, 255)), + ], + shape_palette: &[ + ("--affine-palette-shape-black", Rgba::new(35, 35, 35, 255)), + ("--affine-palette-shape-blue", Rgba::new(184, 227, 255, 255)), + ("--affine-palette-shape-green", Rgba::new(157, 209, 148, 255)), + ("--affine-palette-shape-grey", Rgba::new(216, 217, 216, 255)), + ("--affine-palette-shape-magenta", Rgba::new(237, 140, 189, 255)), + ("--affine-palette-shape-navy", Rgba::new(122, 149, 246, 255)), + ("--affine-palette-shape-orange", Rgba::new(255, 196, 107, 255)), + ("--affine-palette-shape-purple", Rgba::new(147, 126, 231, 255)), + ("--affine-palette-shape-red", Rgba::new(241, 111, 111, 255)), + ("--affine-palette-shape-tangerine", Rgba::new(251, 161, 121, 255)), + ("--affine-palette-shape-teal", Rgba::new(184, 242, 231, 255)), + ("--affine-palette-shape-white", Rgba::new(255, 255, 255, 255)), + ("--affine-palette-shape-yellow", Rgba::new(255, 223, 107, 255)), + ("--affine-v2-edgeless-palette-black", Rgba::new(255, 255, 255, 255)), + ("--affine-v2-edgeless-palette-heavy-blue", Rgba::new(28, 112, 165, 255)), + ("--affine-v2-edgeless-palette-heavy-green", Rgba::new(68, 119, 86, 255)), + ("--affine-v2-edgeless-palette-heavy-magenta", Rgba::new(148, 21, 85, 255)), + ("--affine-v2-edgeless-palette-heavy-orange", Rgba::new(181, 83, 9, 255)), + ("--affine-v2-edgeless-palette-heavy-purple", Rgba::new(90, 33, 182, 255)), + ("--affine-v2-edgeless-palette-heavy-red", Rgba::new(118, 23, 23, 255)), + ("--affine-v2-edgeless-palette-heavy-yellow", Rgba::new(172, 116, 0, 255)), + ("--affine-v2-edgeless-palette-light-blueLight", Rgba::new(230, 245, 255, 255)), + ("--affine-v2-edgeless-palette-light-greenLight", Rgba::new(241, 253, 244, 255)), + ("--affine-v2-edgeless-palette-light-greyLight", Rgba::new(230, 230, 230, 255)), + ("--affine-v2-edgeless-palette-light-magentaLight", Rgba::new(255, 236, 246, 255)), + ("--affine-v2-edgeless-palette-light-orangeLight", Rgba::new(255, 235, 213, 255)), + ("--affine-v2-edgeless-palette-light-purpleLight", Rgba::new(215, 205, 255, 255)), + ("--affine-v2-edgeless-palette-light-redLight", Rgba::new(252, 229, 230, 255)), + ("--affine-v2-edgeless-palette-light-yellowLight", Rgba::new(255, 251, 213, 255)), + ("--affine-v2-edgeless-palette-medium-blueMedium", Rgba::new(132, 207, 255, 255)), + ("--affine-v2-edgeless-palette-medium-greenMedium", Rgba::new(60, 188, 54, 255)), + ("--affine-v2-edgeless-palette-medium-greyMedium", Rgba::new(146, 146, 146, 255)), + ("--affine-v2-edgeless-palette-medium-magentaMedium", Rgba::new(233, 108, 171, 255)), + ("--affine-v2-edgeless-palette-medium-orangeMedium", Rgba::new(255, 140, 56, 255)), + ("--affine-v2-edgeless-palette-medium-purpleMedium", Rgba::new(110, 82, 223, 255)), + ("--affine-v2-edgeless-palette-medium-redMedium", Rgba::new(251, 112, 129, 255)), + ("--affine-v2-edgeless-palette-medium-yellowMedium", Rgba::new(252, 211, 77, 255)), + ("--affine-v2-edgeless-palette-white", Rgba::new(0, 0, 0, 255)), + ], + connector_palette: &[ + ("--affine-palette-line-black", Rgba::new(35, 35, 35, 255)), + ("--affine-palette-line-blue", Rgba::new(79, 144, 255, 255)), + ("--affine-palette-line-green", Rgba::new(124, 194, 112, 255)), + ("--affine-palette-line-grey", Rgba::new(191, 192, 191, 255)), + ("--affine-palette-line-magenta", Rgba::new(230, 96, 164, 255)), + ("--affine-palette-line-navy", Rgba::new(59, 37, 204, 255)), + ("--affine-palette-line-orange", Rgba::new(255, 175, 56, 255)), + ("--affine-palette-line-purple", Rgba::new(110, 82, 223, 255)), + ("--affine-palette-line-red", Rgba::new(237, 63, 63, 255)), + ("--affine-palette-line-tangerine", Rgba::new(250, 124, 69, 255)), + ("--affine-palette-line-teal", Rgba::new(122, 226, 213, 255)), + ("--affine-palette-line-white", Rgba::new(255, 255, 255, 255)), + ("--affine-palette-line-yellow", Rgba::new(255, 211, 56, 255)), + ], +}; + +pub const fn theme(mode: ThemeMode) -> &'static ThemeTokens { + match mode { + ThemeMode::Light => &LIGHT_THEME, + ThemeMode::Dark => &DARK_THEME, + } +} + +#[cfg(test)] +mod tests { + use super::*; + + fn assert_strictly_sorted(slice: &[(&str, T)], label: &str) { + for pair in slice.windows(2) { + assert!( + pair[0].0 < pair[1].0, + "{label} is not strictly sorted in Rust Ord: {:?} >= {:?}", + pair[0].0, + pair[1].0 + ); + } + } + + #[test] + fn token_tables_are_sorted_and_round_trip() { + assert_strictly_sorted(LIGHT_THEME.colors, "LIGHT_THEME.colors"); + assert_strictly_sorted(DARK_THEME.colors, "DARK_THEME.colors"); + assert_strictly_sorted(LIGHT_THEME.shadows, "LIGHT_THEME.shadows"); + assert_strictly_sorted(DARK_THEME.shadows, "DARK_THEME.shadows"); + assert_strictly_sorted(TYPOGRAPHY.radii, "TYPOGRAPHY.radii"); + + for &(k, v) in LIGHT_THEME.colors { + assert_eq!(LIGHT_THEME.color(k), Some(v), "LIGHT_THEME.color({k})"); + } + for &(k, v) in DARK_THEME.colors { + assert_eq!(DARK_THEME.color(k), Some(v), "DARK_THEME.color({k})"); + } + for &(k, v) in LIGHT_THEME.shadows { + assert_eq!(LIGHT_THEME.shadow(k), Some(v), "LIGHT_THEME.shadow({k})"); + } + for &(k, v) in DARK_THEME.shadows { + assert_eq!(DARK_THEME.shadow(k), Some(v), "DARK_THEME.shadow({k})"); + } + } + + #[test] + fn screen_font_stack_not_overwritten_by_print_media_rule() { + assert!( + TYPOGRAPHY.font_family.contains("apple-system"), + "expected screen font stack to retain apple-system, got: {}", + TYPOGRAPHY.font_family + ); + assert!( + TYPOGRAPHY.font_family.contains("BlinkMacSystemFont"), + "expected screen font stack to retain BlinkMacSystemFont, got: {}", + TYPOGRAPHY.font_family + ); + } +} diff --git a/blocksuite/native-playground/tokens/vitest.config.ts b/blocksuite/native-playground/tokens/vitest.config.ts new file mode 100644 index 0000000000..f7c5174bc7 --- /dev/null +++ b/blocksuite/native-playground/tokens/vitest.config.ts @@ -0,0 +1,103 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin'; +import { playwright } from '@vitest/browser-playwright'; +import { transform as esbuildTransform } from 'esbuild'; +import type { Plugin } from 'vite'; +import { defineConfig } from 'vitest/config'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const REPO_ROOT = path.resolve(__dirname, '../../..'); +const INTEGRATION_TEST_ROOT = path.resolve(__dirname, '../../integration-test'); +const DEFAULT_OUT_PATH = + process.env.STYLE_ORACLE_OUT ?? path.join(__dirname, 'style-oracle.json'); + +const writeStyleOracle = async (_ctx: unknown, jsonText: string) => { + fs.mkdirSync(path.dirname(DEFAULT_OUT_PATH), { recursive: true }); + fs.writeFileSync(DEFAULT_OUT_PATH, jsonText, 'utf8'); + return DEFAULT_OUT_PATH; +}; + +/** + * Downlevel TC39 2022-03 decorators (used by Lit & BlockSuite @Peekable) + * before Vite 8's oxc transform runs, so Chromium receives valid ES2022 JS. + */ +function tc39DecoratorsPlugin(): Plugin { + return { + name: 'np-tc39-decorators', + enforce: 'pre', + async transform(code, id) { + const cleanId = id.split('?')[0]; + if (!/\.(?:ts|tsx)$/.test(cleanId)) return null; + if (cleanId.endsWith('.css.ts') || cleanId.includes('/node_modules/')) { + return null; + } + if (!code.includes('@')) return null; + + const result = await esbuildTransform(code, { + loader: cleanId.endsWith('.tsx') ? 'tsx' : 'ts', + sourcefile: cleanId, + target: 'es2022', + tsconfigRaw: { + compilerOptions: { + experimentalDecorators: false, + useDefineForClassFields: false, + }, + }, + }); + return { + code: result.code, + map: result.map || null, + }; + }, + }; +} + +const NODE_MODULES_REAL = (() => { + try { + return fs.realpathSync(path.join(REPO_ROOT, 'node_modules')); + } catch { + return path.join(REPO_ROOT, 'node_modules'); + } +})(); + +export default defineConfig({ + root: INTEGRATION_TEST_ROOT, + server: { + fs: { + allow: [REPO_ROOT, NODE_MODULES_REAL], + }, + }, + optimizeDeps: { + rolldownOptions: { + transform: { + target: 'es2022', + }, + }, + }, + plugins: [tc39DecoratorsPlugin(), vanillaExtractPlugin()], + test: { + include: ['../native-playground/tokens/extract-style-oracle.spec.ts'], + fileParallelism: false, + testTimeout: 60_000, + browser: { + enabled: true, + headless: true, + provider: playwright(), + isolate: false, + instances: [{ browser: 'chromium' }], + viewport: { + width: 1280, + height: 800, + }, + commands: { + writeStyleOracle, + }, + }, + deps: { + interopDefault: true, + }, + }, +});