Merge remote-tracking branch 'origin/main' into samehkhamis/kit-sweep-layer-finder

# Conflicts:
#	docs/VUE-MIGRATION.md
#	scripts/format-scope.json
This commit is contained in:
Sameh Khamis committed 2026-11-19 04:32:21 -08:00
commit 7ba6d86485
19 files changed
+372 -97

No files matched your search

+84
View File
@@ -0,0 +1,84 @@
// The entity card's buttons and Material glyphs are the kit's: neither its
// template nor the camera preview and nearby lists it renders hand-writes a
// <button> or a Material Symbols span. The Ask GEV button's chat bubble is
// not a Material symbol the page loads, so it stays drawn as inline SVG; the
// hero views (model, route globe, cockpit view, ground view, graphs) draw
// their own pictures and have no controls.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
/** A view's template block: everything outside script and style. */
function template(file) {
const source = readFileSync(
new URL(`../views/panels/${file}`, import.meta.url),
'utf8',
);
return source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
}
const card = template('EntityCard.vue');
const camera = template('CctvPreview.vue');
const nearby = template('SpotConditions.vue');
const heroViews = [
'AircraftModelHero.vue',
'RouteGlobe.vue',
'FlightCockpitView.vue',
'SatelliteGroundView.vue',
'PreviewHud.vue',
'AltitudeGraph.vue',
].map(template);
test('the entity card hand-writes no button; each is a UiButton', () => {
for (const markup of [card, camera, nearby, ...heroViews])
assert.deepEqual(markup.match(/<button\b/gi) ?? [], []);
// Photos, Route, 3D, Cockpit view, the cockpit entry, Fly to, Follow and
// Ask GEV.
assert.equal(card.match(/<UiButton\b/g)?.length, 8);
assert.equal(card.match(/<UiCloseButton\b/g)?.length, 1);
// A camera's bigger view and More info; its popup closes with a UiCloseButton.
assert.equal(camera.match(/<UiButton\b/g)?.length, 2);
assert.equal(camera.match(/<UiCloseButton\b/g)?.length, 1);
// The traffic, hazard, alert and other nearby rows.
assert.equal(nearby.match(/<UiButton\b/g)?.length, 4);
});
test('the preview switch and Follow are pressed toggles with their classes', () => {
const previews = card.match(/<UiButton v-if="\w+" :pressed[^>]*>/g) ?? [];
assert.equal(previews.length, 4);
for (const button of previews) {
assert.match(button, /pressed-class="active"/);
assert.doesNotMatch(button, /aria-pressed|:class=/);
}
assert.match(
card,
/<UiButton v-if="store\.canFollow\(\)" class="entity-card__action" :pressed="Boolean\(store\.isFollowing\(\)\)" pressed-class="entity-card__action--on"/,
);
});
test('the entity card hand-writes no Material glyph; each is a UiIcon', () => {
for (const markup of [card, camera, nearby, ...heroViews])
assert.deepEqual(markup.match(/material-symbols-outlined/g) ?? [], []);
const counts = [
// The preview switch's three, the hero glyph, the header icon, the
// warning, the route's plane, the route note and the three actions.
[card, 11],
// Bigger view, the popup's camera and More info.
[camera, 3],
// The two weather glyphs, five headings and three row glyphs.
[nearby, 10],
];
for (const [markup, count] of counts) {
const icons = markup.match(/<UiIcon\b[^>]*>/g) ?? [];
assert.equal(icons.length, count);
// Without it the kit writes an 18px size that beats the card's own rules.
for (const icon of icons) assert.match(icon, /:size="null"/);
}
});
test('the only inline SVG glyph is the Ask GEV chat bubble', () => {
const svgs = [...card.matchAll(/<svg\b[\s\S]*?<\/svg\s*>/g)].map((m) => m[0]);
assert.equal(svgs.length, 1);
assert.match(svgs[0], /<path d="M4 5h16v11H9l-5 4z" \/>/);
for (const markup of [camera, nearby])
assert.deepEqual(markup.match(/<svg\b/gi) ?? [], []);
});
+37
View File
@@ -0,0 +1,37 @@
// The Omnibar's buttons and Material glyphs are the kit's: its template
// hand-writes no <button> and no Material Symbols span. Its two inline SVG
// glyphs (the mic and the chat row's bubble) are not Material symbols the
// page loads, so they stay as they are drawn.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const source = readFileSync(
new URL('../views/panels/Omnibar.vue', import.meta.url),
'utf8',
);
/** The template block: everything outside script and style. */
const template = source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
test('the Omnibar hand-writes no button; each is a UiButton', () => {
assert.deepEqual(template.match(/<button\b/gi) ?? [], []);
assert.equal(template.match(/<UiButton\b/g)?.length, 2);
});
test('the Omnibar hand-writes no Material glyph; each is a UiIcon', () => {
assert.deepEqual(template.match(/material-symbols-outlined/g) ?? [], []);
const icons = template.match(/<UiIcon\b[^>]*>/g) ?? [];
assert.equal(icons.length, 3);
// Without it the kit writes an 18px size that beats the Omnibar's own rules.
for (const icon of icons) assert.match(icon, /:size="null"/);
});
test('the only inline SVG glyphs are the mic and the chat row bubble', () => {
const svgs = [...template.matchAll(/<svg\b[\s\S]*?<\/svg\s*>/g)].map(
(m) => m[0],
);
assert.equal(svgs.length, 2);
assert.match(svgs[0], /<rect x="9" y="3" width="6" height="11" rx="3" \/>/);
assert.match(svgs[1], /class="omnibar-item-icon"/);
assert.match(svgs[1], /<path d="M4 5h16v11H9l-5 4z" \/>/);
});
+53
View File
@@ -0,0 +1,53 @@
// The Visual panel's buttons and Material glyphs are the kit's: neither its
// template nor the presets it renders hand-writes a <button>, a Material
// Symbols span or an inline SVG. The toggles' text glyphs (◎ ▣ ✈ □ ✨ 🔍)
// and the presets' style glyphs are characters, not Material symbols, so
// they stay text the panel's rules size.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
/** A view's template block: everything outside script and style. */
function template(file) {
const source = readFileSync(
new URL(`../views/panels/${file}`, import.meta.url),
'utf8',
);
return source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
}
const panel = template('DisplayPanel.vue');
const presets = template('VisualPresets.vue');
test('the Visual panel hand-writes no button; each is a UiButton', () => {
for (const markup of [panel, presets])
assert.deepEqual(markup.match(/<button\b/gi) ?? [], []);
// HUD, Sonar, Detection, 3D, Clean UI, Celestial, Bloom, Sharpen and
// Reset to default.
assert.equal(panel.match(/<UiButton\b/g)?.length, 9);
// The style presets and the map source chips.
assert.equal(presets.match(/<UiButton\b/g)?.length, 2);
// Scope, the sky rows and the application's toggle rows.
assert.equal(panel.match(/<UiCheckbox\b/g)?.length, 3);
// 3D model coverage and detection label allocation.
assert.equal(panel.match(/<UiSegmented\b/g)?.length, 2);
});
test('the Visual panel hand-writes no Material glyph; each is a UiIcon', () => {
for (const markup of [panel, presets]) {
assert.deepEqual(markup.match(/material-symbols-outlined/g) ?? [], []);
assert.deepEqual(markup.match(/<svg\b/gi) ?? [], []);
}
const icons = panel.match(/<UiIcon\b[^>]*>/g) ?? [];
// Scope, Celestial, the sky rows, the application's rows and Reset.
assert.equal(icons.length, 5);
// Without it the kit writes an 18px size that beats the panel's own rules.
for (const icon of icons) assert.match(icon, /:size="null"/);
});
test('the toggles keep their text glyphs as plain spans', () => {
const glyphs = [...panel.matchAll(/<span class="pp-icon">([^<]*)<\/span>/g)];
assert.deepEqual(
glyphs.map((m) => m[1]),
['&#x25CE;', '&#x25A3;', '&#x2708;', '&#x25A1;', '&#x2728;', '&#x1F50D;'],
);
});
+37
View File
@@ -0,0 +1,37 @@
// The welcome card's buttons and Material glyphs are the kit's: its template
// hand-writes no <button> and no Material Symbols span, and its one box is a
// UiCheckbox. Its two inline SVGs (God mode's globe and its callouts) are
// drawings, not glyphs, and its outbound links stay links.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const source = readFileSync(
new URL('../views/WelcomeView.vue', import.meta.url),
'utf8',
);
/** The template block: everything outside script and style. */
const template = source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
test('the welcome card hand-writes no button; each is a UiButton', () => {
assert.deepEqual(template.match(/<button\b/gi) ?? [], []);
// SKIP, the three start tiles, BROWSE STORIES, BACK and the main action.
assert.equal(template.match(/<UiButton\b/g)?.length, 7);
assert.equal(template.match(/<UiCheckbox\b/g)?.length, 1);
});
test('the welcome card hand-writes no Material glyph; each is a UiIcon', () => {
assert.deepEqual(template.match(/material-symbols-outlined/g) ?? [], []);
const icons = template.match(/<UiIcon\b[^>]*>/g) ?? [];
// The three tiles, the three tips, the Stories card and the main arrow.
assert.equal(icons.length, 8);
// Without it the kit writes an 18px size that beats first-run.css's rules.
for (const icon of icons) assert.match(icon, /:size="null"/);
});
test('the only inline SVGs are God mode preview drawings', () => {
const svgs = [...template.matchAll(/<svg\b[^>]*>/g)].map((m) => m[0]);
assert.equal(svgs.length, 2);
assert.match(svgs[0], /class="first-run-globe"/);
assert.match(svgs[1], /class="first-run-callouts"/);
});