feat(native-playground): add N-3 perf guardrail, theme/style oracle, and CI self-tests

This commit is contained in:
DarkSky committed 2026-11-23 13:58:03 +09:00
1 parent dbe1e2f2c7
commit 74bcafa70f
14 files changed
+9627

No files matched your search

+21
View File
@@ -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"
+9
View File
@@ -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 `<svg fill>` 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
```
@@ -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 <path>`):
```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
```
@@ -0,0 +1 @@
[]
File diff suppressed because it is too large. Load diff
@@ -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 <endpoint>` 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');
});
@@ -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
}
}
}
}
}
@@ -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<string>;
}
}
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<string, string>;
page_blocks: Record<string, StyleSample | null>;
quote_accent_bar: PseudoStyleSample | null;
inline_formats: Record<string, StyleSample | null>;
edgeless_blocks: Record<string, StyleSample | null>;
edgeless_surface_models: Record<string, Record<string, unknown>>;
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<void>(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<string, string> = {};
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<TestWorkspace['createDoc']>['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<string, string> = {};
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<string, StyleSample | null> = {};
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 <affine-text><span>)
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<string, StyleSample | null> = {
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<string, StyleSample | null> = {
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<number, unknown>)[0])),
round2(Number((p as Record<number, unknown>)[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)}`
);
});
});
File diff suppressed because it is too large. Load diff
@@ -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"
}
]
}
@@ -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);
}
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -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,
},
},
});