Skip to content

Commit b367bfb

Browse files
committed
Update typephp-runtime.json.gz with latest changes
1 parent 6c0306d commit b367bfb

7 files changed

Lines changed: 326 additions & 80 deletions

File tree

‎docs/.vitepress/theme/components/Playground.vue‎

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@
6262
:is-running="isRunning"
6363
:report="report"
6464
:is-report-mode-active="config.onViolation === 'report'"
65+
:report-view-mode="reportViewMode"
6566
@clear="clearConsole"
6667
@clear-report="clearReport"
68+
@update:report-view-mode="onReportViewModeUpdate"
6769
@toggle-position="toggleLayoutPosition"
6870
/>
6971
</main>
@@ -89,13 +91,15 @@ import PlaygroundOutput from './PlaygroundOutput.vue';
8991
const DRAFT_CODE_KEY = 'typephp_playground_draft_code';
9092
const DRAFT_TITLE_KEY = 'typephp_playground_draft_title';
9193
const DRAFT_PRESET_KEY = 'typephp_playground_draft_preset';
94+
const DRAFT_REPORT_VIEW_KEY = 'typephp_playground_report_view_mode';
9295
9396
const presets = PLAYGROUND_PRESETS;
9497
const selectedPresetId = ref<string>(presets[0]?.id ?? '');
9598
const snippetTitle = ref<string>(presets[0]?.name ?? 'Runtime Reified Generics');
9699
const code = ref<string>(presets[0]?.code ?? '<?php\n');
97100
98101
const viewMode = ref<'source' | 'xray'>('source');
102+
const reportViewMode = ref<'cards' | 'json'>('cards');
99103
const layoutPosition = ref<'bottom' | 'side'>('side');
100104
const windowWidth = ref<number>(typeof window !== 'undefined' ? window.innerWidth : 1200);
101105
@@ -161,7 +165,6 @@ function handleWindowResize() {
161165
windowWidth.value = window.innerWidth;
162166
}
163167
164-
// Global shortcut handler (Ctrl+Enter / Cmd+Enter anywhere on page)
165168
function handleGlobalKeyDown(e: KeyboardEvent) {
166169
if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') {
167170
e.preventDefault();
@@ -180,6 +183,13 @@ function persistDraft() {
180183
}, 350);
181184
}
182185
186+
function onReportViewModeUpdate(mode: 'cards' | 'json') {
187+
reportViewMode.value = mode;
188+
try {
189+
localStorage.setItem(DRAFT_REPORT_VIEW_KEY, mode);
190+
} catch {}
191+
}
192+
183193
onMounted(() => {
184194
window.addEventListener('resize', handleWindowResize);
185195
window.addEventListener('keydown', handleGlobalKeyDown);
@@ -214,9 +224,13 @@ onMounted(() => {
214224
};
215225
}
216226
}
227+
228+
const savedReportView = localStorage.getItem(DRAFT_REPORT_VIEW_KEY);
229+
if (savedReportView === 'cards' || savedReportView === 'json') {
230+
reportViewMode.value = savedReportView;
231+
}
217232
} catch {}
218233
219-
// 1. Check URL Hash first (#code=...)
220234
let restoredFromHash = false;
221235
const hash = window.location.hash;
222236
@@ -232,6 +246,9 @@ onMounted(() => {
232246
if (typeof parsed.title === 'string' && parsed.title.trim()) {
233247
snippetTitle.value = parsed.title;
234248
}
249+
if (parsed.reportViewMode === 'cards' || parsed.reportViewMode === 'json') {
250+
reportViewMode.value = parsed.reportViewMode;
251+
}
235252
if (parsed.config) {
236253
config.value = {
237254
...DEFAULT_PLAYGROUND_CONFIG,
@@ -408,6 +425,7 @@ function onSelectPreset(presetId: string) {
408425
}
409426
viewMode.value = 'source';
410427
428+
// Clear URL hash when switching to an official preset
411429
if (window.location.hash) {
412430
history.replaceState(null, '', window.location.pathname + window.location.search);
413431
}
@@ -422,7 +440,7 @@ function onSelectPreset(presetId: string) {
422440
423441
function runCode() {
424442
const now = performance.now();
425-
if (now - lastRunTimestamp < 150) return;
443+
if (now - lastRunTimestamp < 150) return;
426444
lastRunTimestamp = now;
427445
428446
const activeWorker = worker;
@@ -480,6 +498,7 @@ function shareSnippet() {
480498
title: snippetTitle.value || 'Custom Snippet',
481499
code: code.value,
482500
config: config.value,
501+
reportViewMode: reportViewMode.value, // Persist Cards vs JSON subview in share link
483502
};
484503
const compressed = LZString.compressToEncodedURIComponent(JSON.stringify(payload));
485504
const shareUrl = `${window.location.origin}${window.location.pathname}#code=${compressed}`;

‎docs/.vitepress/theme/components/PlaygroundConfigPopover.vue‎

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@
1616

1717
<!-- Popover Card -->
1818
<div v-if="isOpen" class="config-popover" @click.stop>
19+
<!-- Fixed Header -->
1920
<div class="popover-header">
2021
<span class="popover-title">Engine Configuration</span>
2122
<button class="popover-close-btn" @click="close">&times;</button>
2223
</div>
2324

25+
<!-- Scrollable Body -->
2426
<div class="popover-body">
25-
<!-- 0. Master Switch: Enable/Disable -->
27+
<!-- 0. Master Switch -->
2628
<div class="config-card master-banner">
2729
<div class="config-card-header">
2830
<span class="config-label">Enable TypePHP Enforcement</span>
@@ -161,7 +163,7 @@
161163
<span class="config-desc">Honors @typephp-ignore tags. Turn OFF to simulate a strict CI/CD audit run.</span>
162164
</div>
163165

164-
<!-- Ignore Trace Depth (Spans full width or col) -->
166+
<!-- Ignore Trace Depth -->
165167
<div class="config-card full-span-card">
166168
<div class="config-card-header">
167169
<span class="config-label">Ignore Trace Depth</span>
@@ -215,6 +217,7 @@
215217
</div>
216218
</div>
217219

220+
<!-- Fixed Footer: Always Visible -->
218221
<div class="popover-footer">
219222
<button
220223
class="reset-config-btn"
@@ -333,7 +336,7 @@ onUnmounted(() => {
333336
.config-popover-wrapper {
334337
position: relative;
335338
display: inline-flex;
336-
z-index: 50; /* Stays above workspace resize handles */
339+
z-index: 50;
337340
}
338341
339342
.config-trigger-btn {
@@ -361,6 +364,7 @@ onUnmounted(() => {
361364
z-index: 100;
362365
width: 580px;
363366
max-width: calc(100vw - 24px);
367+
max-height: calc(100vh - 120px);
364368
display: flex;
365369
flex-direction: column;
366370
background: var(--vp-c-bg);
@@ -374,9 +378,10 @@ onUnmounted(() => {
374378
display: flex;
375379
align-items: center;
376380
justify-content: space-between;
377-
padding: 10px 14px;
381+
padding: 8px 14px;
378382
background: var(--vp-c-bg-mute);
379383
border-bottom: 1px solid var(--vp-c-divider);
384+
flex-shrink: 0;
380385
}
381386
382387
.popover-title {
@@ -402,25 +407,36 @@ onUnmounted(() => {
402407
}
403408
404409
.popover-body {
405-
padding: 12px 14px;
410+
padding: 10px 14px;
406411
display: flex;
407412
flex-direction: column;
408-
gap: 8px;
413+
gap: 6px;
414+
flex: 1 1 auto;
415+
min-height: 0;
409416
overflow-y: auto;
410-
max-height: 80vh;
417+
overscroll-behavior: contain;
418+
}
419+
420+
.popover-body::-webkit-scrollbar {
421+
width: 5px;
422+
}
423+
424+
.popover-body::-webkit-scrollbar-thumb {
425+
background: var(--vp-c-divider);
426+
border-radius: 4px;
411427
}
412428
413429
.config-grid {
414430
display: grid;
415431
grid-template-columns: 1fr 1fr;
416-
gap: 8px 10px;
432+
gap: 6px 8px;
417433
}
418434
419435
.config-card {
420436
display: flex;
421437
flex-direction: column;
422-
gap: 4px;
423-
padding: 8px 10px;
438+
gap: 3px;
439+
padding: 7px 9px;
424440
background: var(--vp-c-bg-soft);
425441
border: 1px solid var(--vp-c-divider);
426442
border-radius: 6px;
@@ -443,7 +459,7 @@ onUnmounted(() => {
443459
444460
.config-card.inline-vars-banner {
445461
background: var(--vp-c-bg-soft);
446-
gap: 6px;
462+
gap: 5px;
447463
}
448464
449465
.config-card-header {
@@ -476,7 +492,7 @@ onUnmounted(() => {
476492
}
477493
478494
.config-desc {
479-
font-size: 10px;
495+
font-size: 9.5px;
480496
color: var(--vp-c-text-2);
481497
line-height: 1.35;
482498
}
@@ -485,13 +501,13 @@ onUnmounted(() => {
485501
.inline-chips-group {
486502
display: flex;
487503
flex-wrap: wrap;
488-
gap: 5px;
489-
margin-top: 2px;
504+
gap: 4px;
505+
margin-top: 1px;
490506
}
491507
492508
.inline-chip-btn {
493509
padding: 2px 7px;
494-
font-size: 10px;
510+
font-size: 9.5px;
495511
font-weight: 600;
496512
border: 1px solid var(--vp-c-divider);
497513
border-radius: 12px;
@@ -613,12 +629,14 @@ onUnmounted(() => {
613629
user-select: none;
614630
}
615631
632+
/* Fixed Footer: Always Pinned at Bottom */
616633
.popover-footer {
617634
padding: 8px 14px;
618635
background: var(--vp-c-bg-soft);
619636
border-top: 1px solid var(--vp-c-divider);
620637
display: flex;
621638
justify-content: flex-end;
639+
flex-shrink: 0;
622640
}
623641
624642
.reset-config-btn {
@@ -680,7 +698,7 @@ onUnmounted(() => {
680698
681699
.config-grid {
682700
grid-template-columns: 1fr;
683-
gap: 8px;
701+
gap: 6px;
684702
}
685703
}
686704
</style>

‎docs/.vitepress/theme/components/PlaygroundOutput.vue‎

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,11 @@
193193
<div class="report-subview-toggle">
194194
<button
195195
:class="['subview-btn', { active: reportViewMode === 'cards' }]"
196-
@click="reportViewMode = 'cards'"
196+
@click="$emit('update:reportViewMode', 'cards')"
197197
>Cards</button>
198198
<button
199199
:class="['subview-btn', { active: reportViewMode === 'json' }]"
200-
@click="reportViewMode = 'json'"
200+
@click="$emit('update:reportViewMode', 'json')"
201201
>JSON</button>
202202
</div>
203203

@@ -299,20 +299,22 @@ const props = withDefaults(defineProps<{
299299
position?: 'bottom' | 'side';
300300
report?: AuditReportDocument | null;
301301
isReportModeActive?: boolean;
302+
reportViewMode?: 'cards' | 'json';
302303
}>(), {
303304
position: 'bottom',
304305
report: null,
305306
isReportModeActive: false,
307+
reportViewMode: 'cards',
306308
});
307309
308310
const emit = defineEmits<{
309311
(e: 'clear'): void;
310312
(e: 'clear-report'): void;
311313
(e: 'toggle-position'): void;
314+
(e: 'update:reportViewMode', mode: 'cards' | 'json'): void;
312315
}>();
313316
314317
const activeTab = ref<'console' | 'report'>('console');
315-
const reportViewMode = ref<'cards' | 'json'>('cards');
316318
const isCollapsed = ref<boolean>(false);
317319
const drawerHeight = ref<number>(240);
318320
const drawerWidth = ref<number>(620);
@@ -323,7 +325,6 @@ const totalReportViolations = computed(() => {
323325
return props.report?.summary?.total_violations ?? 0;
324326
});
325327
326-
// Distinguishes non-fatal warnings from fatal exceptions
327328
const isWarningOnly = computed(() => {
328329
if (!props.stderr) return false;
329330
const text = props.stderr;
@@ -342,10 +343,21 @@ const isWarningOnly = computed(() => {
342343
);
343344
});
344345
345-
// Auto-switch to Audit Report tab when report data arrives
346-
watch(() => props.report, (newRep) => {
347-
if (newRep && newRep.violations && newRep.violations.length > 0) {
348-
activeTab.value = 'report';
346+
watch(
347+
[() => props.isReportModeActive, () => props.report],
348+
([isReportMode, newReport]) => {
349+
if (isReportMode && newReport && newReport.violations && newReport.violations.length > 0) {
350+
activeTab.value = 'report';
351+
} else if (!isReportMode && !newReport) {
352+
activeTab.value = 'console';
353+
}
354+
},
355+
{ immediate: true }
356+
);
357+
358+
watch(() => props.isRunning, (running) => {
359+
if (running && !props.isReportModeActive) {
360+
activeTab.value = 'console';
349361
}
350362
});
351363
@@ -698,6 +710,7 @@ defineExpose({
698710
background: var(--vp-c-bg-soft);
699711
}
700712
713+
/* Console View */
701714
.console-view {
702715
padding: 12px 14px;
703716
}
@@ -720,6 +733,7 @@ defineExpose({
720733
border-radius: 4px;
721734
}
722735
736+
/* Non-blocking PHP Warnings / Notices (Amber/Gold) */
723737
.stderr-stream.is-warning {
724738
color: #fbbf24;
725739
background: rgba(245, 158, 11, 0.08);
@@ -768,6 +782,9 @@ defineExpose({
768782
animation: spin 0.8s linear infinite;
769783
}
770784
785+
/* ========================================================
786+
Audit Report Layout & Cards View
787+
======================================================== */
771788
.report-view {
772789
display: flex;
773790
flex-direction: column;
@@ -820,17 +837,20 @@ defineExpose({
820837
color: #ef4444;
821838
}
822839
840+
/* Actions Group inside Summary Bar */
823841
.summary-actions {
824842
display: flex;
825843
align-items: center;
826844
gap: 6px;
845+
flex-shrink: 0;
827846
}
828847
829848
.report-subview-toggle {
830849
display: inline-flex;
831850
border: 1px solid var(--vp-c-divider);
832851
border-radius: 4px;
833852
overflow: hidden;
853+
flex-shrink: 0;
834854
}
835855
836856
.subview-btn {
@@ -862,6 +882,7 @@ defineExpose({
862882
color: var(--vp-c-text-2);
863883
cursor: pointer;
864884
transition: all 0.15s ease;
885+
flex-shrink: 0;
865886
}
866887
867888
.report-action-btn:hover {

0 commit comments

Comments
 (0)