mcard-studio 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/astro.config.mjs +46 -2
- package/bin/mcard-studio.mjs +1 -1
- package/cli/lib/runtimeContext.mjs +6 -3
- package/dist/client/_astro/{ChartAnalyticsViewlet.Cevj0EOs.js → ChartAnalyticsViewlet.CBW-JyA3.js} +1 -1
- package/dist/client/_astro/ClmPcardViewlet.cvKsR2ng.js +3 -0
- package/dist/client/_astro/D3GraphViewlet.8YEIrCGL.js +2 -0
- package/dist/client/_astro/DockviewSpatialWorkbench.BTd66LPl.js +12 -0
- package/dist/client/_astro/DocumentViewlets.KY1HcNka.js +2 -0
- package/dist/client/_astro/DxfViewlet.B3N5zpZR.js +1 -0
- package/dist/client/_astro/ExcalidrawWhiteboardViewlet.CMJGCQN4.js +1 -0
- package/dist/client/_astro/{FaroVCardSpanInstrumenter.BIk2NhJY.js → FaroVCardSpanInstrumenter.ClIqZujq.js} +1 -1
- package/dist/client/_astro/{FontSpecimenViewlet.CpONhJh0.js → FontSpecimenViewlet.ChIyr0B8.js} +1 -1
- package/dist/client/_astro/HeadMeta.astro_astro_type_script_index_0_lang.D3FSc061.js +1 -0
- package/dist/client/_astro/{ImageViewlet.CHeNvX6L.js → ImageViewlet.Cs-u7-wt.js} +1 -1
- package/dist/client/_astro/{KatexFormulaViewlet.Cy_InWOK.js → KatexFormulaViewlet.0nOzV_qD.js} +1 -1
- package/dist/client/_astro/KoishiChatViewlet.DLsMmwdb.js +16 -0
- package/dist/client/_astro/MCardLibraryHarness.WBT9W10S.js +2 -0
- package/dist/client/_astro/{MarkdownViewlet.qoPlM-TZ.js → MarkdownViewlet.BIolkNXf.js} +25 -25
- package/dist/client/_astro/{MermaidDiagramViewlet.RnwDfQl6.js → MermaidDiagramViewlet.CkRk7QsS.js} +1 -1
- package/dist/client/_astro/PCardRendererBridge.DhaRSprd.js +1 -0
- package/dist/client/_astro/RendererPCardRegistry.brM2KiQs.js +1 -0
- package/dist/client/_astro/{SchemaYamlViewlet.D6HVdmrq.js → SchemaYamlViewlet.Bc7nkK4M.js} +1 -1
- package/dist/client/_astro/{ShellContainer.astro_astro_type_script_index_0_lang.2oi8fhQo.js → ShellContainer.astro_astro_type_script_index_0_lang.5q1gCLvf.js} +1 -1
- package/dist/client/_astro/{Spatial3dViewlet.CCYBSSib.js → Spatial3dViewlet.C-jjhr0A.js} +1 -1
- package/dist/client/_astro/{StudioLayout.CBgiVbeb.css → StudioLayout.CX8XGtZV.css} +1 -1
- package/dist/client/_astro/StudioWorkbench.B1QwGHWM.js +7 -0
- package/dist/client/_astro/{SvgViewlet.BxlWQ-JX.js → SvgViewlet.uGxvb06H.js} +1 -1
- package/dist/client/_astro/{TerminalView.DWZR-hUa.js → TerminalView.DP7G7E1m.js} +4 -4
- package/dist/client/_astro/{ThemeSettingsViewlet.Cb1r8fWw.js → ThemeSettingsViewlet.UaTHcGnF.js} +1 -1
- package/dist/client/_astro/{TikzDiagramViewlet.CqY7VTeP.js → TikzDiagramViewlet.O8MJyXfT.js} +1 -1
- package/dist/client/_astro/VideoPlayerViewlet.-ycmo3kY.js +1 -0
- package/dist/client/_astro/WebappZenViewlet.PNce4u2T.js +1 -0
- package/dist/client/_astro/{WelcomeViewport.LwKTA6h7.js → WelcomeViewport.CZ6RxGSw.js} +1 -1
- package/dist/client/_astro/{agentIdentityCredentialService.BtKVsl2C.js → agentIdentityCredentialService.BEtZzBlO.js} +5 -5
- package/dist/client/_astro/cardTypeDetector.C2HH5RnU.js +1 -0
- package/dist/client/_astro/disposable.BmlxZrDf.js +1 -0
- package/dist/client/_astro/{markdownService.D-tM2RYx.js → markdownService.CpuKl0vp.js} +1 -1
- package/dist/client/_astro/{mcardStore.BiAvqM-D.js → mcardStore.nSWnzeLg.js} +2 -2
- package/dist/client/_astro/mcardVfs.BSdys1Y7.js +3 -0
- package/dist/client/_astro/pathsConfig.CSBBSzwH.js +2 -0
- package/dist/client/_astro/polyfills.Bi7kO8cu.js +1 -0
- package/dist/client/_astro/rendererEventBus.DirFDmGw.js +1 -0
- package/dist/client/_astro/themeStore.BajxvCga.js +1 -0
- package/dist/client/_astro/{tikzCompiler.DFojjdxR.js → tikzCompiler.-fXMNQpz.js} +1 -1
- package/dist/client/_astro/{useMCardHydration.Co47OH3D.js → useMCardHydration.Bjj_N5Gv.js} +1 -1
- package/dist/client/_astro/vendor-ai.D6NcJ6lu.js +69 -0
- package/dist/client/_astro/vendor-clm-kernel.B0kxq3g4.js +108 -0
- package/dist/client/_astro/vfsHandles.D4Pq18pW.js +1 -0
- package/dist/client/_astro/vfsPersistence.DVrd1BZj.js +1 -0
- package/dist/client/_astro/vfsTransactions.DBNtFuRz.js +1 -0
- package/dist/client/_astro/{workspaceStore.CXakha4Y.js → workspaceStore.DUHW2YBc.js} +1 -1
- package/dist/client/js/buffer-polyfill.js +14 -0
- package/dist/server/chunks/{StudioLayout_D163irJ0.mjs → StudioLayout_taayQJ5b.mjs} +2 -2
- package/dist/server/chunks/{_.._ZXsz792-.mjs → _.._CoQKwo62.mjs} +137 -91
- package/dist/server/chunks/{_handle__D_cIJYrU.mjs → _handle__D8dKQPUS.mjs} +3 -3
- package/dist/server/chunks/{cardTypeDetector_CyW1Xnmy.mjs → cardTypeDetector_C55M_HWS.mjs} +9 -0
- package/dist/server/chunks/{cards_B89BvF6W.mjs → cards_rVOc8K6H.mjs} +2 -2
- package/dist/server/chunks/cas_DTxlZ4Le.mjs +68 -0
- package/dist/server/chunks/{dispatch_DOwSKukU.mjs → dispatch_BTW4E_BJ.mjs} +8 -7
- package/dist/server/chunks/{dispatch_CxWKiHpn.mjs → dispatch_MbkljUxD.mjs} +8 -8
- package/dist/server/chunks/{export_DRouradA.mjs → export_DkEwDE2T.mjs} +3 -3
- package/dist/server/chunks/{health_Dfa5I0-X.mjs → health_cRt0M0yu.mjs} +1 -1
- package/dist/server/chunks/{mcard-library_DvPPUs9_.mjs → mcard-library_CLHvyslV.mjs} +1 -1
- package/dist/server/chunks/{mcardVfs_CeezzRvt.mjs → mcardVfs_DvNburKb.mjs} +5 -30
- package/dist/server/chunks/{move__RFvIDkq.mjs → move_DYcaXBLV.mjs} +6 -6
- package/dist/server/chunks/{pathsConfig_CgNYYLVm.mjs → pathsConfig_Dack-p2f.mjs} +13 -3
- package/dist/server/chunks/{proxy_CrWJQIBe.mjs → proxy_CMbbdBPW.mjs} +2 -2
- package/dist/server/chunks/{raw_DzNDaDVP.mjs → raw_C97sJWhg.mjs} +59 -26
- package/dist/server/chunks/{serverBootstrap_XKo2s6Ha.mjs → serverBootstrap_BDdSRIu5.mjs} +2 -2
- package/dist/server/chunks/tree_BwmO-pTe.mjs +186 -0
- package/dist/server/chunks/vfsCore_DIKpk-pk.mjs +98 -0
- package/dist/server/chunks/{vfsTreeScan_CKp7kMt9.mjs → vfsTreeScan_CRoCluPB.mjs} +18 -10
- package/dist/server/chunks/workspaceRoot_CRx3taID.mjs +157 -0
- package/dist/server/chunks/{write_popiFsO7.mjs → write_BLsmsTIx.mjs} +6 -5
- package/dist/server/chunks/{ws-server-init_CkcgcI5V.mjs → ws-server-init_Cfft7U5u.mjs} +343 -298
- package/dist/server/entry.mjs +8 -4
- package/dist/server/entry2.mjs +67 -28
- package/dist/server/virtual_astro_middleware.mjs +2 -2
- package/package.json +2 -2
- package/public/js/buffer-polyfill.js +14 -0
- package/src/components/studio/views/cardViewlets/ClmRegistryComponentViewlet.tsx +133 -0
- package/src/components/studio/views/cardViewlets/DxfViewlet.tsx +230 -0
- package/src/components/studio/views/cardViewlets/VideoPlayerViewlet.tsx +4 -4
- package/src/components/studio/views/cardViewlets/coreViewletDefs.ts +2 -2
- package/src/components/studio/views/cardViewlets/documents/AudioPlayerViewlet.tsx +15 -3
- package/src/components/studio/views/cardViewlets/documents/PdfViewlet.tsx +25 -7
- package/src/components/studio/views/cardViewlets/markdown/stages/wikilinkStage.ts +2 -1
- package/src/components/studio/views/cardViewlets/mediaViewletDefs.ts +21 -1
- package/src/components/studio/views/cardViewlets/webapp/WebappCanvas.tsx +40 -15
- package/src/components/studio/views/cardViewlets/webapp/WebappDevicePresetBar.tsx +108 -0
- package/src/components/studio/views/cardViewlets/webapp/WebappZenViewlet.tsx +23 -30
- package/src/components/studio/views/fileTree/MCardFileTree.tsx +71 -54
- package/src/components/studio/views/fileTree/hooks/useFileTreeSync.ts +0 -1
- package/src/components/studio/views/fileTree/hooks/usePartitionedTrees.ts +68 -23
- package/src/components/studio/views/fileTree/hooks/useSectionAccordion.ts +21 -11
- package/src/components/studio/views/functions/UnifiedFunctionExplorerViewlet.tsx +168 -0
- package/src/components/studio/views/history/HistoryPanel.tsx +110 -0
- package/src/components/studio/views/lineage/LineagePanel.tsx +152 -0
- package/src/components/studio/views/navigation/HandleLineageDrawer.tsx +89 -0
- package/src/components/studio/views/navigation/MultiCardCollectionBrowser.tsx +154 -0
- package/src/components/studio/views/pills/HashPill.tsx +101 -0
- package/src/components/studio/views/residency/ResidencyIndicator.tsx +82 -0
- package/src/config/app_config.json +3 -3
- package/src/core/projection/catalog.ts +105 -0
- package/src/core/projection/collection.ts +148 -0
- package/src/core/projection/handleSubscription.ts +132 -0
- package/src/core/projection/index.ts +4 -0
- package/src/core/projection/selectors.ts +29 -0
- package/src/core/projection/views.ts +242 -0
- package/src/core/refinement/designMetrics.ts +104 -0
- package/src/core/refinement/fibrationProjector.ts +142 -0
- package/src/core/refinement/lagrangianEngine.ts +137 -0
- package/src/core/refinement/refinementCommands.ts +82 -0
- package/src/core/viewport/deviceArchetypeRegistry.ts +177 -0
- package/src/core/viewport/viewportAudit.ts +150 -0
- package/src/edge/storeFilter.d.ts +4 -0
- package/src/edge/storeFilter.js +54 -0
- package/src/edge/storeFilter.ts +52 -0
- package/src/layouts/StudioLayout.astro +1 -0
- package/src/lib/cryptoPolyfill.js +77 -1
- package/src/lib/fsPolyfill.js +65 -0
- package/src/lib/urlPolyfill.js +21 -0
- package/src/lib/zlibPolyfill.js +35 -0
- package/src/packages/mcard-studio/package.json +2 -2
- package/src/packages/mcard-studio/type/legacyMapping.ts +5 -0
- package/src/packages/mcard-studio/viewlets/manifests.ts +2 -0
- package/src/packages/mcard-studio/viewlets/moduleMap.ts +12 -0
- package/src/packages/mcard-studio/viewlets/refinementManifests.ts +114 -0
- package/src/pages/api/dispatch.ts +3 -2
- package/src/pages/api/vfs/cas.ts +114 -0
- package/src/pages/api/vfs/move.ts +5 -5
- package/src/pages/api/vfs/raw.ts +72 -27
- package/src/pages/api/vfs/tree.ts +130 -11
- package/src/pages/api/vfs/write.ts +5 -4
- package/src/pages/index.astro +75 -0
- package/src/server/api/kernelDispatch.ts +8 -8
- package/src/server/artifactCollectionService.ts +4 -7
- package/src/server/artifactRepository.ts +4 -3
- package/src/server/clmRunner.mjs +1 -1
- package/src/server/collectionOwner.mjs +5 -5
- package/src/server/effects/executionPersistenceService.mjs +11 -11
- package/src/server/effects/resultSealingService.mjs +2 -2
- package/src/server/fileIngestService.mjs +21 -9
- package/src/server/fileWatcherService.mjs +4 -1
- package/src/server/handlers/fileChangeHandler.mjs +18 -10
- package/src/server/handlers/saveExecutionLogHandler.mjs +6 -6
- package/src/server/notificationService.mjs +14 -1
- package/src/server/scripts/buildSeedingMemory.mjs +3 -3
- package/src/server/serverMemoryRepository.ts +41 -59
- package/src/server/vfsTreeScan.ts +16 -10
- package/src/server/workspaceRoot.ts +143 -5
- package/src/services/cardTypeDetector.ts +4 -0
- package/src/services/databaseSyncService.ts +30 -46
- package/src/services/inBrowserLlm/engines/litertEngine.ts +1 -1
- package/src/services/namespaceProtocolClient.ts +221 -0
- package/src/services/renderers/pcard/RendererPCardRegistry.ts +4 -66
- package/src/services/renderers/pcard/modalitySpecs.ts +125 -0
- package/src/services/renderers/pcard/types.ts +7 -1
- package/src/services/renderers/rendererEventBus.ts +5 -3
- package/src/services/unifiedFunctionExecutionService.ts +145 -0
- package/src/services/vfs/vfsCore.ts +12 -1
- package/src/services/vfs/vfsMigration.ts +95 -0
- package/src/services/vfs/vfsMutations.ts +17 -35
- package/src/services/vfs/vfsPersistence.ts +19 -24
- package/src/services/vfs/vfsSync.ts +55 -17
- package/src/services/vfs/vfsVersions.ts +23 -34
- package/src/services/workbenchExecutionPolicy.ts +183 -0
- package/src/stores/mcardCollectionStore.ts +2 -0
- package/src/styles/dockview.css +34 -0
- package/src/ui/viewlets/FibrationRefinementViewlet.tsx +155 -0
- package/src/ui/viewlets/PetriConformanceViewlet.tsx +166 -0
- package/src/ui/viewlets/ResponsiveViewportLabViewlet.tsx +175 -0
- package/src/ui/viewlets/SprintGovernanceViewlet.tsx +176 -0
- package/src/ui/viewlets/viewletFocus.ts +35 -0
- package/src/ui/viewlets/viewportLabParts.tsx +190 -0
- package/dist/client/_astro/ClmPcardViewlet.DW5Yft0E.js +0 -3
- package/dist/client/_astro/D3GraphViewlet.DAjPz1DP.js +0 -2
- package/dist/client/_astro/DockviewSpatialWorkbench.DyQjSoHd.js +0 -12
- package/dist/client/_astro/DocumentViewlets.Dm_GL3AL.js +0 -2
- package/dist/client/_astro/ExcalidrawWhiteboardViewlet.DrlW7B6G.js +0 -1
- package/dist/client/_astro/HeadMeta.astro_astro_type_script_index_0_lang.DGXU-3Lu.js +0 -1
- package/dist/client/_astro/KoishiChatViewlet.B0eDEMnT.js +0 -16
- package/dist/client/_astro/MCardLibraryHarness.CUJLJFBt.js +0 -2
- package/dist/client/_astro/PCardRendererBridge.BnyaE05I.js +0 -1
- package/dist/client/_astro/RendererPCardRegistry.CLr4j1Ub.js +0 -1
- package/dist/client/_astro/StudioWorkbench.CF0SOYwy.js +0 -7
- package/dist/client/_astro/VideoPlayerViewlet.DoSYmmoQ.js +0 -1
- package/dist/client/_astro/WebappZenViewlet.CQW50OhX.js +0 -1
- package/dist/client/_astro/cardTypeDetector.C9kGObMh.js +0 -1
- package/dist/client/_astro/disposable.66apX1Q2.js +0 -1
- package/dist/client/_astro/empty.DOwCrGXH.js +0 -1
- package/dist/client/_astro/mcardVfs.Bj-RA0p7.js +0 -2
- package/dist/client/_astro/path.CR60mj9W.js +0 -1
- package/dist/client/_astro/pathsConfig.D0hV34p7.js +0 -2
- package/dist/client/_astro/polyfills.DcBkS56X.js +0 -1
- package/dist/client/_astro/rendererEventBus.CyFnSRLk.js +0 -1
- package/dist/client/_astro/themeStore.zUMFLo3Q.js +0 -1
- package/dist/client/_astro/vendor-ai.CZe7UVVK.js +0 -69
- package/dist/client/_astro/vfsHandles.B-nczBRy.js +0 -1
- package/dist/client/_astro/vfsPersistence.D6zRzVML.js +0 -1
- package/dist/client/_astro/vfsTransactions.04mkEHxD.js +0 -1
- package/dist/server/chunks/cryptoPolyfill_99rxUwYC.mjs +0 -180
- package/dist/server/chunks/kernelHash_DRaj51hY.mjs +0 -5
- package/dist/server/chunks/tree_CE2BhvyJ.mjs +0 -76
- package/dist/server/chunks/vfsCore_B6nCiBl5.mjs +0 -21
- package/dist/server/chunks/workspaceRoot_DVSUbYkd.mjs +0 -71
- package/src/server/kernelHash.ts +0 -22
- package/src/server/storage/cardCollection.ts +0 -94
- package/src/server/storage/index.ts +0 -3
- package/src/server/storage/mcard.ts +0 -99
- package/src/server/storage/sqliteNodeEngine.ts +0 -121
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ResponsiveViewportLabViewlet — Multi-Device Responsive UI Lab
|
|
3
|
+
* (SMR-12 · DoD-SMR-12-02), registered as `pcard:render/viewport-lab`.
|
|
4
|
+
*
|
|
5
|
+
* Migrates `LandingPage/responsive-lab.html`: a Single-Device stage and a
|
|
6
|
+
* Synchronized Quad-Device Matrix (Wearable + Cellphone + Laptop + Desktop),
|
|
7
|
+
* with the containment scale math, the 90° orientation swap, CSS breakpoint
|
|
8
|
+
* rulers, a touch-target heatmap, and one-click conformance witness sealing.
|
|
9
|
+
*
|
|
10
|
+
* Pure view (INV-FM-02): every decision is made by the pure registry; this file
|
|
11
|
+
* renders it and raises intents. It performs no network or storage access.
|
|
12
|
+
*
|
|
13
|
+
* Contract D budget: <= 250 LOC.
|
|
14
|
+
*/
|
|
15
|
+
import React, { useMemo, useState } from 'react';
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
CLASS_DEFAULT_PRESET,
|
|
19
|
+
DEVICE_CLASSES,
|
|
20
|
+
DEVICE_CLASS_IDS,
|
|
21
|
+
auditViewport,
|
|
22
|
+
getPreset,
|
|
23
|
+
isMatrixConformant,
|
|
24
|
+
sealViewportWitness,
|
|
25
|
+
type DeviceClassId,
|
|
26
|
+
type ViewportWitness,
|
|
27
|
+
} from '../../core/viewport/deviceArchetypeRegistry';
|
|
28
|
+
import {
|
|
29
|
+
DeviceFrame,
|
|
30
|
+
measurementFor,
|
|
31
|
+
type LabMeasurements,
|
|
32
|
+
type ViewportLabSample,
|
|
33
|
+
} from './viewportLabParts';
|
|
34
|
+
|
|
35
|
+
export type { ManifestPortalSampleDescriptor, ViewportLabSample } from './viewportLabParts';
|
|
36
|
+
export {
|
|
37
|
+
DeviceFrame,
|
|
38
|
+
adaptImportedPortalSamples,
|
|
39
|
+
frameGeometry,
|
|
40
|
+
measurementFor,
|
|
41
|
+
rulerMarks,
|
|
42
|
+
} from './viewportLabParts';
|
|
43
|
+
|
|
44
|
+
export interface ResponsiveViewportLabViewletProps {
|
|
45
|
+
readonly samples: readonly ViewportLabSample[];
|
|
46
|
+
readonly mode?: 'single' | 'quad';
|
|
47
|
+
/** Live measurements per class; absent measurements fall back to the declared payload. */
|
|
48
|
+
readonly measurements?: LabMeasurements;
|
|
49
|
+
readonly rotated?: boolean;
|
|
50
|
+
readonly showRulers?: boolean;
|
|
51
|
+
readonly showHeatmap?: boolean;
|
|
52
|
+
readonly onSealWitness?: (witness: ViewportWitness) => void;
|
|
53
|
+
readonly onOpenExternal?: (url: string) => void;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const ResponsiveViewportLabViewlet: React.FC<ResponsiveViewportLabViewletProps> = ({
|
|
57
|
+
samples,
|
|
58
|
+
mode = 'quad',
|
|
59
|
+
measurements,
|
|
60
|
+
rotated: rotatedProp = false,
|
|
61
|
+
showRulers: rulersProp = true,
|
|
62
|
+
showHeatmap: heatmapProp = true,
|
|
63
|
+
onSealWitness,
|
|
64
|
+
onOpenExternal,
|
|
65
|
+
}) => {
|
|
66
|
+
const [selected, setSelected] = useState<ViewportLabSample | null>(samples[0] ?? null);
|
|
67
|
+
const [activeClass, setActiveClass] = useState<DeviceClassId>('cellphone');
|
|
68
|
+
const [rotated, setRotated] = useState(rotatedProp);
|
|
69
|
+
const [showRulers, setShowRulers] = useState(rulersProp);
|
|
70
|
+
const [showHeatmap, setShowHeatmap] = useState(heatmapProp);
|
|
71
|
+
const [witness, setWitness] = useState<ViewportWitness | null>(null);
|
|
72
|
+
|
|
73
|
+
const target = selected ?? samples[0]!;
|
|
74
|
+
const classes: readonly DeviceClassId[] = mode === 'quad' ? DEVICE_CLASS_IDS : [activeClass];
|
|
75
|
+
|
|
76
|
+
const audits = useMemo(() => {
|
|
77
|
+
const entries = DEVICE_CLASS_IDS.map((id) => {
|
|
78
|
+
const preset = getPreset(CLASS_DEFAULT_PRESET[id])!;
|
|
79
|
+
return [
|
|
80
|
+
id,
|
|
81
|
+
auditViewport(measurementFor(target, id, measurements), id, { width: preset.width, height: preset.height }),
|
|
82
|
+
] as const;
|
|
83
|
+
});
|
|
84
|
+
return Object.fromEntries(entries);
|
|
85
|
+
}, [target, measurements]);
|
|
86
|
+
|
|
87
|
+
const conformant = isMatrixConformant(audits as never);
|
|
88
|
+
|
|
89
|
+
const seal = () => {
|
|
90
|
+
const sealed = sealViewportWitness(target.handle, audits as never);
|
|
91
|
+
setWitness(sealed);
|
|
92
|
+
if (sealed) onSealWitness?.(sealed);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<section className="viewport-lab" aria-label="Responsive viewport lab" data-role="viewport-lab" data-mode={mode}>
|
|
97
|
+
<header>
|
|
98
|
+
<h3>Responsive Viewport Lab</h3>
|
|
99
|
+
<div role="toolbar" aria-label="Viewport lab controls">
|
|
100
|
+
<button type="button" data-role="toggle-rotation" aria-pressed={rotated} onClick={() => setRotated((v) => !v)}>
|
|
101
|
+
↻ Rotate 90°
|
|
102
|
+
</button>
|
|
103
|
+
<button type="button" data-role="toggle-rulers" aria-pressed={showRulers} onClick={() => setShowRulers((v) => !v)}>
|
|
104
|
+
📏 Rulers
|
|
105
|
+
</button>
|
|
106
|
+
<button type="button" data-role="toggle-heatmap" aria-pressed={showHeatmap} onClick={() => setShowHeatmap((v) => !v)}>
|
|
107
|
+
🎯 Touch Heatmap
|
|
108
|
+
</button>
|
|
109
|
+
<button type="button" data-role="seal-witness" disabled={!conformant} onClick={seal}>
|
|
110
|
+
Seal Conformance Witness
|
|
111
|
+
</button>
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<ul data-role="sample-list">
|
|
115
|
+
{samples.map((sample) => (
|
|
116
|
+
<li key={sample.handle}>
|
|
117
|
+
<button
|
|
118
|
+
type="button"
|
|
119
|
+
data-role="sample"
|
|
120
|
+
aria-pressed={target.handle === sample.handle}
|
|
121
|
+
onClick={() => setSelected(sample)}
|
|
122
|
+
>
|
|
123
|
+
{sample.label}
|
|
124
|
+
</button>
|
|
125
|
+
</li>
|
|
126
|
+
))}
|
|
127
|
+
</ul>
|
|
128
|
+
|
|
129
|
+
<ul data-role="class-list">
|
|
130
|
+
{DEVICE_CLASS_IDS.map((id) => (
|
|
131
|
+
<li key={id}>
|
|
132
|
+
<button
|
|
133
|
+
type="button"
|
|
134
|
+
data-role="device-class"
|
|
135
|
+
aria-pressed={activeClass === id}
|
|
136
|
+
onClick={() => setActiveClass(id)}
|
|
137
|
+
>
|
|
138
|
+
{DEVICE_CLASSES[id].label}
|
|
139
|
+
</button>
|
|
140
|
+
</li>
|
|
141
|
+
))}
|
|
142
|
+
</ul>
|
|
143
|
+
</header>
|
|
144
|
+
|
|
145
|
+
<div className="viewport-stage" data-role="viewport-stage" data-matrix={mode}>
|
|
146
|
+
{classes.map((id) => (
|
|
147
|
+
<DeviceFrame
|
|
148
|
+
key={id}
|
|
149
|
+
deviceClass={id}
|
|
150
|
+
presetId={CLASS_DEFAULT_PRESET[id]}
|
|
151
|
+
sample={target}
|
|
152
|
+
measurement={measurementFor(target, id, measurements)}
|
|
153
|
+
rotated={rotated}
|
|
154
|
+
showRulers={showRulers}
|
|
155
|
+
showHeatmap={showHeatmap}
|
|
156
|
+
/>
|
|
157
|
+
))}
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
{witness && (
|
|
161
|
+
<p data-role="witness">
|
|
162
|
+
{witness.contract} · {witness.classes.length}/4 classes · <code>{witness.witnessHash.slice(0, 12)}…</code>
|
|
163
|
+
</p>
|
|
164
|
+
)}
|
|
165
|
+
|
|
166
|
+
{target.kind === 'external' && target.url && (
|
|
167
|
+
<button type="button" data-role="open-external" onClick={() => onOpenExternal?.(target.url!)}>
|
|
168
|
+
Open {target.url} in membrane
|
|
169
|
+
</button>
|
|
170
|
+
)}
|
|
171
|
+
</section>
|
|
172
|
+
);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export default ResponsiveViewportLabViewlet;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SprintGovernanceViewlet — Sprint registry & deployment unit budget inspector
|
|
3
|
+
* (SMR-11 · DoD-SMR-11-04), registered as `pcard:render/sprint-governance`.
|
|
4
|
+
*
|
|
5
|
+
* Supersedes the local `sprint-registry.html` and `deployment-inspector.js` islands:
|
|
6
|
+
* it projects the sprint registry (sprint manifests, DoD seal state) and the
|
|
7
|
+
* multi-device `.mcard.db` deployment units with byte budgets, raising a threshold
|
|
8
|
+
* alert when a unit exceeds its budget. Read-only.
|
|
9
|
+
*
|
|
10
|
+
* Contract D budget: <= 240 LOC.
|
|
11
|
+
*/
|
|
12
|
+
import React, { useMemo, useState } from 'react';
|
|
13
|
+
|
|
14
|
+
import type { AssessmentUnit } from '@/core/refinement/fibrationProjector';
|
|
15
|
+
|
|
16
|
+
export interface SprintManifest {
|
|
17
|
+
readonly code: string;
|
|
18
|
+
readonly title?: string;
|
|
19
|
+
readonly status?: string;
|
|
20
|
+
readonly dodTotal?: number;
|
|
21
|
+
readonly dodPassed?: number;
|
|
22
|
+
readonly seal?: 'sealed' | 'open' | 'none';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface SprintGovernanceProjection {
|
|
26
|
+
readonly total: number;
|
|
27
|
+
readonly byStatus: Readonly<Record<string, number>>;
|
|
28
|
+
readonly sealed: number;
|
|
29
|
+
readonly dodTotal: number;
|
|
30
|
+
readonly dodPassed: number;
|
|
31
|
+
readonly dodCompletion: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Projects the sprint registry: counts by status and the DoD completion ratio. */
|
|
35
|
+
export function projectSprintGovernance(sprints: readonly SprintManifest[]): SprintGovernanceProjection {
|
|
36
|
+
const byStatus: Record<string, number> = {};
|
|
37
|
+
let sealed = 0;
|
|
38
|
+
let dodTotal = 0;
|
|
39
|
+
let dodPassed = 0;
|
|
40
|
+
for (const sprint of sprints) {
|
|
41
|
+
const status = sprint.status ?? 'unknown';
|
|
42
|
+
byStatus[status] = (byStatus[status] ?? 0) + 1;
|
|
43
|
+
if (sprint.seal === 'sealed') sealed += 1;
|
|
44
|
+
dodTotal += sprint.dodTotal ?? 0;
|
|
45
|
+
dodPassed += sprint.dodPassed ?? 0;
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
total: sprints.length,
|
|
49
|
+
byStatus,
|
|
50
|
+
sealed,
|
|
51
|
+
dodTotal,
|
|
52
|
+
dodPassed,
|
|
53
|
+
dodCompletion: dodTotal === 0 ? 0 : Number((dodPassed / dodTotal).toFixed(4)),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface BudgetAlert {
|
|
58
|
+
readonly unit: string;
|
|
59
|
+
readonly payloadBytes: number;
|
|
60
|
+
readonly overBy: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Deployment budget alerts. A unit over its threshold is reported with the excess;
|
|
65
|
+
* units already flagged `within_budget: false` are always reported.
|
|
66
|
+
*/
|
|
67
|
+
export function deploymentBudgetAlerts(
|
|
68
|
+
units: readonly AssessmentUnit[],
|
|
69
|
+
thresholdBytes = 262_144,
|
|
70
|
+
): BudgetAlert[] {
|
|
71
|
+
return units
|
|
72
|
+
.filter((unit) => (unit.payload_bytes ?? 0) > thresholdBytes || unit.within_budget === false)
|
|
73
|
+
.map((unit) => ({
|
|
74
|
+
unit: unit.unit,
|
|
75
|
+
payloadBytes: unit.payload_bytes ?? 0,
|
|
76
|
+
overBy: Math.max(0, (unit.payload_bytes ?? 0) - thresholdBytes),
|
|
77
|
+
}))
|
|
78
|
+
.sort((a, b) => b.overBy - a.overBy);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface SprintGovernanceViewletProps {
|
|
82
|
+
readonly sprints: readonly SprintManifest[];
|
|
83
|
+
readonly units?: readonly AssessmentUnit[];
|
|
84
|
+
readonly budgetBytes?: number;
|
|
85
|
+
readonly onSelectSprint?: (code: string) => void;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const SprintGovernanceViewlet: React.FC<SprintGovernanceViewletProps> = ({
|
|
89
|
+
sprints,
|
|
90
|
+
units = [],
|
|
91
|
+
budgetBytes = 262_144,
|
|
92
|
+
onSelectSprint,
|
|
93
|
+
}) => {
|
|
94
|
+
const [threshold, setThreshold] = useState(budgetBytes);
|
|
95
|
+
const projection = useMemo(() => projectSprintGovernance(sprints), [sprints]);
|
|
96
|
+
const alerts = useMemo(() => deploymentBudgetAlerts(units, threshold), [units, threshold]);
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<section className="sprint-governance" aria-label="Sprint registry and deployment unit governance">
|
|
100
|
+
<header>
|
|
101
|
+
<h3>Sprint Registry & Deployment Units</h3>
|
|
102
|
+
<p data-role="sprint-summary">
|
|
103
|
+
{projection.total} sprint manifest(s) · {projection.sealed} sealed · DoD{' '}
|
|
104
|
+
{projection.dodPassed}/{projection.dodTotal} ({(projection.dodCompletion * 100).toFixed(1)}%)
|
|
105
|
+
</p>
|
|
106
|
+
</header>
|
|
107
|
+
|
|
108
|
+
<ul className="governance-status" data-role="status-breakdown">
|
|
109
|
+
{Object.entries(projection.byStatus).map(([status, count]) => (
|
|
110
|
+
<li key={status} data-status={status}>
|
|
111
|
+
{status}: {count}
|
|
112
|
+
</li>
|
|
113
|
+
))}
|
|
114
|
+
</ul>
|
|
115
|
+
|
|
116
|
+
<label className="governance-threshold">
|
|
117
|
+
<span>Budget threshold (bytes)</span>
|
|
118
|
+
<input
|
|
119
|
+
type="number"
|
|
120
|
+
aria-label="Budget threshold"
|
|
121
|
+
min={0}
|
|
122
|
+
value={threshold}
|
|
123
|
+
onChange={(event) => setThreshold(Number(event.target.value) || 0)}
|
|
124
|
+
/>
|
|
125
|
+
</label>
|
|
126
|
+
|
|
127
|
+
{alerts.length > 0 ? (
|
|
128
|
+
<aside className="governance-alerts" role="alert" data-role="budget-alerts">
|
|
129
|
+
<p>
|
|
130
|
+
{alerts.length} deployment unit(s) over the {threshold} byte threshold:
|
|
131
|
+
</p>
|
|
132
|
+
<ul>
|
|
133
|
+
{alerts.map((alert) => (
|
|
134
|
+
<li key={alert.unit}>
|
|
135
|
+
<code>{alert.unit}</code> — {alert.payloadBytes} bytes (+{alert.overBy})
|
|
136
|
+
</li>
|
|
137
|
+
))}
|
|
138
|
+
</ul>
|
|
139
|
+
</aside>
|
|
140
|
+
) : (
|
|
141
|
+
<p className="governance-clear" data-role="budget-alerts">
|
|
142
|
+
All deployment units within the {threshold} byte threshold.
|
|
143
|
+
</p>
|
|
144
|
+
)}
|
|
145
|
+
|
|
146
|
+
<table className="governance-sprints">
|
|
147
|
+
<thead>
|
|
148
|
+
<tr>
|
|
149
|
+
<th scope="col">Sprint</th>
|
|
150
|
+
<th scope="col">Status</th>
|
|
151
|
+
<th scope="col">Seal</th>
|
|
152
|
+
<th scope="col">DoD</th>
|
|
153
|
+
</tr>
|
|
154
|
+
</thead>
|
|
155
|
+
<tbody>
|
|
156
|
+
{sprints.map((sprint) => (
|
|
157
|
+
<tr key={sprint.code} data-role="sprint-row">
|
|
158
|
+
<th scope="row">
|
|
159
|
+
<button type="button" onClick={() => onSelectSprint?.(sprint.code)}>
|
|
160
|
+
{sprint.code}
|
|
161
|
+
</button>
|
|
162
|
+
</th>
|
|
163
|
+
<td>{sprint.status ?? 'unknown'}</td>
|
|
164
|
+
<td>{sprint.seal ?? 'none'}</td>
|
|
165
|
+
<td>
|
|
166
|
+
{sprint.dodPassed ?? 0}/{sprint.dodTotal ?? 0}
|
|
167
|
+
</td>
|
|
168
|
+
</tr>
|
|
169
|
+
))}
|
|
170
|
+
</tbody>
|
|
171
|
+
</table>
|
|
172
|
+
</section>
|
|
173
|
+
);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export default SprintGovernanceViewlet;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* src/ui/viewlets/viewletFocus.ts
|
|
3
|
+
* Focus dispatch for the refinement inspectors (SMR-11 · DoD-SMR-11-06).
|
|
4
|
+
*
|
|
5
|
+
* The console parses a slash command into an intent (pure, in core); this module is
|
|
6
|
+
* the effectful half — it asks the workbench to open and focus the viewlet through a
|
|
7
|
+
* window event, the same pattern the dual-spatial split uses. Keeping the effect here
|
|
8
|
+
* means `src/core/` stays pure.
|
|
9
|
+
*
|
|
10
|
+
* Contract D budget: <= 250 LOC.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
parseRefinementCommand,
|
|
15
|
+
type RefinementCommandIntent,
|
|
16
|
+
} from '@/core/refinement/refinementCommands';
|
|
17
|
+
|
|
18
|
+
export const VIEWLET_FOCUS_EVENT = 'clm:viewlet-focus-requested';
|
|
19
|
+
|
|
20
|
+
/** Asks the workbench to open and focus a renderer PCard handle. */
|
|
21
|
+
export function requestViewletFocus(handle: string): boolean {
|
|
22
|
+
if (typeof window === 'undefined' || typeof window.dispatchEvent !== 'function') return false;
|
|
23
|
+
window.dispatchEvent(new CustomEvent(VIEWLET_FOCUS_EVENT, { detail: { handle } }));
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Parses console input and focuses the inspector it names.
|
|
29
|
+
* Returns the intent so the caller can answer an unknown command in the console.
|
|
30
|
+
*/
|
|
31
|
+
export function dispatchRefinementCommand(input: string): RefinementCommandIntent {
|
|
32
|
+
const intent = parseRefinementCommand(input);
|
|
33
|
+
if (intent.kind === 'open-viewlet') requestViewletFocus(intent.handle);
|
|
34
|
+
return intent;
|
|
35
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* viewportLabParts.tsx — Presentational parts of the Responsive Viewport Lab
|
|
3
|
+
* Canonical Path: src/ui/viewlets/viewportLabParts.tsx
|
|
4
|
+
* Program: EPIC-SMR · Sprint: SMR-12 (DoD-SMR-12-02)
|
|
5
|
+
*
|
|
6
|
+
* The frame, its geometry, the breakpoint rulers, and the touch-target heatmap,
|
|
7
|
+
* separated from `ResponsiveViewportLabViewlet.tsx` so both stay inside the
|
|
8
|
+
* Contract D ceiling. The viewlet re-exports this surface, so callers and tests
|
|
9
|
+
* still import from the viewlet.
|
|
10
|
+
*
|
|
11
|
+
* Pure view: no network, no storage. Contract D budget: <= 250 LOC.
|
|
12
|
+
*/
|
|
13
|
+
import React from 'react';
|
|
14
|
+
|
|
15
|
+
import {
|
|
16
|
+
DEVICE_CLASSES,
|
|
17
|
+
DEVICE_PRESETS,
|
|
18
|
+
aspectRatio,
|
|
19
|
+
auditViewport,
|
|
20
|
+
containmentScale,
|
|
21
|
+
getPreset,
|
|
22
|
+
rotate,
|
|
23
|
+
type DeviceClassId,
|
|
24
|
+
type ViewportMeasurement,
|
|
25
|
+
} from '../../core/viewport/deviceArchetypeRegistry';
|
|
26
|
+
|
|
27
|
+
export interface ViewportLabSample {
|
|
28
|
+
readonly handle: string;
|
|
29
|
+
readonly label: string;
|
|
30
|
+
readonly kind: 'inline' | 'external';
|
|
31
|
+
readonly url?: string | null;
|
|
32
|
+
readonly fixture?: 'frameable' | 'csp-frame-ancestors' | 'x-frame-options-deny' | 'timeout' | 'offline' | null;
|
|
33
|
+
readonly snapshotHash: string;
|
|
34
|
+
readonly contentBytes: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ManifestPortalSampleDescriptor {
|
|
38
|
+
readonly handle: string;
|
|
39
|
+
readonly label: string;
|
|
40
|
+
readonly kind: 'inline' | 'external';
|
|
41
|
+
readonly url?: string | null;
|
|
42
|
+
readonly fixture?: ViewportLabSample['fixture'];
|
|
43
|
+
readonly snapshot_hash?: string;
|
|
44
|
+
readonly content_bytes?: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Adapts imported MCard tree entries (populated by `importMCardDatabase`) and
|
|
49
|
+
* manifest sample descriptors into `ViewportLabSample` props for `ResponsiveViewportLabViewlet`.
|
|
50
|
+
*/
|
|
51
|
+
export function adaptImportedPortalSamples(
|
|
52
|
+
tree: Record<string, { handle?: string; hash: string; content: string | Uint8Array; sizeBytes?: number } | undefined>,
|
|
53
|
+
manifestSamples: readonly ManifestPortalSampleDescriptor[],
|
|
54
|
+
rootPrefix?: string,
|
|
55
|
+
): readonly ViewportLabSample[] {
|
|
56
|
+
const cleanPrefix = rootPrefix ? rootPrefix.replace(/^\/+/, '').replace(/\/+$/, '') : '';
|
|
57
|
+
const colonPrefix = cleanPrefix ? `${cleanPrefix.replace(/\//g, ':')}:` : '';
|
|
58
|
+
const slashPrefix = cleanPrefix ? `${cleanPrefix}/` : '';
|
|
59
|
+
|
|
60
|
+
return manifestSamples.map((desc) => {
|
|
61
|
+
const candidates = [
|
|
62
|
+
desc.handle,
|
|
63
|
+
desc.handle.replace(/:/g, '/'),
|
|
64
|
+
...(cleanPrefix
|
|
65
|
+
? [
|
|
66
|
+
`${colonPrefix}${desc.handle.replace(/\//g, ':')}`,
|
|
67
|
+
`${slashPrefix}${desc.handle.replace(/:/g, '/')}`,
|
|
68
|
+
]
|
|
69
|
+
: []),
|
|
70
|
+
];
|
|
71
|
+
const node = candidates.map((k) => tree[k]).find((n) => n !== undefined);
|
|
72
|
+
if (!node) {
|
|
73
|
+
throw new Error(`Imported portal sample not found in studioMCardFs tree for handle: ${desc.handle}`);
|
|
74
|
+
}
|
|
75
|
+
const contentBytes =
|
|
76
|
+
typeof node.content === 'string'
|
|
77
|
+
? new TextEncoder().encode(node.content).byteLength
|
|
78
|
+
: node.content instanceof Uint8Array
|
|
79
|
+
? node.content.byteLength
|
|
80
|
+
: (node.sizeBytes ?? desc.content_bytes ?? 0);
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
handle: desc.handle,
|
|
84
|
+
label: desc.label,
|
|
85
|
+
kind: desc.kind,
|
|
86
|
+
url: desc.url ?? null,
|
|
87
|
+
fixture: desc.fixture ?? null,
|
|
88
|
+
snapshotHash: node.hash,
|
|
89
|
+
contentBytes,
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export type LabMeasurements = Partial<Record<DeviceClassId, ViewportMeasurement>>;
|
|
95
|
+
|
|
96
|
+
/** Breakpoint rulers: the canonical CSS widths, filtered to the frame. */
|
|
97
|
+
export function rulerMarks(width: number): readonly number[] {
|
|
98
|
+
return [320, 375, 768, 1024, 1440, 1920].filter((bp) => bp <= width);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** The measurement to audit a class with: live when provided, declared otherwise. */
|
|
102
|
+
export function measurementFor(
|
|
103
|
+
sample: ViewportLabSample,
|
|
104
|
+
deviceClass: DeviceClassId,
|
|
105
|
+
measurements?: LabMeasurements,
|
|
106
|
+
): ViewportMeasurement {
|
|
107
|
+
return measurements?.[deviceClass] ?? { scrollWidth: 0, clientWidth: 0, payloadBytes: sample.contentBytes, touchTargets: [] };
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** The stage geometry for one frame, after rotation and containment scaling. */
|
|
111
|
+
export function frameGeometry(presetId: string, available: { width: number; height: number }, rotated: boolean) {
|
|
112
|
+
const preset = getPreset(presetId) ?? DEVICE_PRESETS[0]!;
|
|
113
|
+
const base = rotated ? rotate(preset) : { width: preset.width, height: preset.height };
|
|
114
|
+
return {
|
|
115
|
+
...base,
|
|
116
|
+
scale: containmentScale(available.width, available.height, base.width, base.height),
|
|
117
|
+
preset,
|
|
118
|
+
aspect: aspectRatio(base.width, base.height),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export const DeviceFrame: React.FC<{
|
|
123
|
+
deviceClass: DeviceClassId;
|
|
124
|
+
presetId: string;
|
|
125
|
+
sample: ViewportLabSample;
|
|
126
|
+
measurement: ViewportMeasurement;
|
|
127
|
+
rotated: boolean;
|
|
128
|
+
showRulers: boolean;
|
|
129
|
+
showHeatmap: boolean;
|
|
130
|
+
}> = ({ deviceClass, presetId, sample, measurement, rotated, showRulers, showHeatmap }) => {
|
|
131
|
+
const spec = DEVICE_CLASSES[deviceClass];
|
|
132
|
+
const geometry = frameGeometry(presetId, { width: 320, height: 260 }, rotated);
|
|
133
|
+
const violations = auditViewport(measurement, deviceClass, { width: geometry.width, height: geometry.height });
|
|
134
|
+
const overflow = measurement.scrollWidth - measurement.clientWidth;
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<figure
|
|
138
|
+
className="viewport-frame"
|
|
139
|
+
data-role="device-frame"
|
|
140
|
+
data-device-class={deviceClass}
|
|
141
|
+
data-preset={presetId}
|
|
142
|
+
data-verdict={violations.length === 0 ? 'pass' : 'fail'}
|
|
143
|
+
style={{ width: geometry.width * geometry.scale, height: geometry.height * geometry.scale }}
|
|
144
|
+
>
|
|
145
|
+
<figcaption>
|
|
146
|
+
<span data-role="device-label">{spec.label}</span>{' '}
|
|
147
|
+
<code data-role="device-geometry">
|
|
148
|
+
{geometry.width}×{geometry.height}
|
|
149
|
+
</code>{' '}
|
|
150
|
+
<span data-role="device-aspect">{geometry.aspect}</span>
|
|
151
|
+
<span data-role="device-budget">{(spec.maxBytes / (1024 * 1024)).toFixed(0)} MB</span>
|
|
152
|
+
</figcaption>
|
|
153
|
+
|
|
154
|
+
{showRulers && (
|
|
155
|
+
<ol className="viewport-rulers" data-role="rulers" aria-label="CSS breakpoint rulers">
|
|
156
|
+
{rulerMarks(geometry.width).map((bp) => (
|
|
157
|
+
<li key={bp} data-role="ruler-mark" data-breakpoint={bp}>
|
|
158
|
+
{bp}
|
|
159
|
+
</li>
|
|
160
|
+
))}
|
|
161
|
+
</ol>
|
|
162
|
+
)}
|
|
163
|
+
|
|
164
|
+
{showHeatmap && (
|
|
165
|
+
<div className="viewport-heatmap" data-role="touch-heatmap">
|
|
166
|
+
{(measurement.touchTargets ?? []).map((size, i) => (
|
|
167
|
+
<span
|
|
168
|
+
key={`${size}-${i}`}
|
|
169
|
+
data-role="touch-target"
|
|
170
|
+
data-size={size}
|
|
171
|
+
data-undersized={spec.minTouchTarget !== null && size < spec.minTouchTarget ? 'true' : 'false'}
|
|
172
|
+
/>
|
|
173
|
+
))}
|
|
174
|
+
</div>
|
|
175
|
+
)}
|
|
176
|
+
|
|
177
|
+
<p data-role="device-verdict">
|
|
178
|
+
{violations.length === 0
|
|
179
|
+
? `conformant · overflow ${overflow}px`
|
|
180
|
+
: violations.map((v) => `${v.rule}: ${v.detail}`).join(' · ')}
|
|
181
|
+
</p>
|
|
182
|
+
|
|
183
|
+
{sample.kind === 'external' && sample.fixture && sample.fixture !== 'frameable' && (
|
|
184
|
+
<p data-role="membrane-fallback">
|
|
185
|
+
{sample.fixture} restriction · Sovereign Snapshot <code>{sample.snapshotHash.slice(0, 8)}…</code>
|
|
186
|
+
</p>
|
|
187
|
+
)}
|
|
188
|
+
</figure>
|
|
189
|
+
);
|
|
190
|
+
};
|