Skip to content

Commit 6c0306d

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

7 files changed

Lines changed: 753 additions & 99 deletions

File tree

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

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
/>
5151
</div>
5252

53-
<!-- Output Console Partial -->
53+
<!-- Output Console & Audit Report Partial -->
5454
<PlaygroundOutput
5555
ref="outputDrawerRef"
5656
:position="effectivePosition"
@@ -60,7 +60,10 @@
6060
:duration="duration"
6161
:status-message="workerStatus"
6262
:is-running="isRunning"
63+
:report="report"
64+
:is-report-mode-active="config.onViolation === 'report'"
6365
@clear="clearConsole"
66+
@clear-report="clearReport"
6467
@toggle-position="toggleLayoutPosition"
6568
/>
6669
</main>
@@ -75,7 +78,8 @@ import {
7578
PLAYGROUND_PRESETS,
7679
DEFAULT_PLAYGROUND_CONFIG,
7780
DEFAULT_INLINE_VARS_CONFIG,
78-
type PlaygroundConfig
81+
type PlaygroundConfig,
82+
type AuditReportDocument
7983
} from '../presets';
8084
import PlaygroundToolbar from './PlaygroundToolbar.vue';
8185
import PlaygroundLoadingOverlay from './PlaygroundLoadingOverlay.vue';
@@ -110,6 +114,7 @@ const stderr = ref<string>('');
110114
const exitCode = ref<number | null>(null);
111115
const duration = ref<string>('');
112116
const transformedCode = ref<string>('');
117+
const report = ref<AuditReportDocument | null>(null);
113118
114119
const copiedLink = ref<boolean>(false);
115120
const copiedCode = ref<boolean>(false);
@@ -131,6 +136,8 @@ const hasCustomConfig = computed<boolean>(() => {
131136
132137
return (
133138
config.value.enabled !== DEFAULT_PLAYGROUND_CONFIG.enabled ||
139+
config.value.onViolation !== DEFAULT_PLAYGROUND_CONFIG.onViolation ||
140+
config.value.redactValues !== DEFAULT_PLAYGROUND_CONFIG.redactValues ||
134141
config.value.ignoreTraceDepth !== DEFAULT_PLAYGROUND_CONFIG.ignoreTraceDepth ||
135142
config.value.arrayValidation !== DEFAULT_PLAYGROUND_CONFIG.arrayValidation ||
136143
config.value.strictReturnGenericInvariance !== DEFAULT_PLAYGROUND_CONFIG.strictReturnGenericInvariance ||
@@ -308,6 +315,11 @@ onMounted(() => {
308315
stderr.value = data.stderr;
309316
exitCode.value = data.exitCode;
310317
duration.value = data.duration;
318+
report.value = data.report || null;
319+
break;
320+
321+
case 'REPORT_CLEARED':
322+
report.value = null;
311323
break;
312324
313325
case 'TRANSFORM_RESULT':
@@ -364,7 +376,6 @@ function formatCode() {
364376
function onCodeUpdate(newCode: string) {
365377
code.value = newCode;
366378
367-
// If user modifies code away from the selected preset, mark as custom
368379
const matched = presets.find((p) => p.id === selectedPresetId.value);
369380
if (matched && matched.code !== newCode) {
370381
selectedPresetId.value = 'custom';
@@ -397,28 +408,29 @@ function onSelectPreset(presetId: string) {
397408
}
398409
viewMode.value = 'source';
399410
400-
// Clear URL hash when switching to an official preset
401411
if (window.location.hash) {
402412
history.replaceState(null, '', window.location.pathname + window.location.search);
403413
}
404414
405415
persistDraft();
406416
clearConsole();
417+
report.value = null;
407418
triggerTransform();
408419
runCode();
409420
}
410421
}
411422
412423
function runCode() {
413424
const now = performance.now();
414-
if (now - lastRunTimestamp < 150) return; // Debounce rapid key triggers
425+
if (now - lastRunTimestamp < 150) return;
415426
lastRunTimestamp = now;
416427
417428
const activeWorker = worker;
418429
if (!activeWorker || !isReady.value || isRunning.value) return;
419430
420431
isRunning.value = true;
421432
clearConsole();
433+
report.value = null;
422434
423435
outputDrawerRef.value?.expand();
424436
@@ -448,6 +460,11 @@ function clearConsole() {
448460
duration.value = '';
449461
}
450462
463+
function clearReport() {
464+
report.value = null;
465+
worker?.postMessage({ action: 'CLEAR_REPORT' });
466+
}
467+
451468
function copyEditorCode() {
452469
const textToCopy = viewMode.value === 'source' ? code.value : transformedCode.value;
453470
navigator.clipboard.writeText(textToCopy).then(() => {

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

Lines changed: 75 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</div>
2323

2424
<div class="popover-body">
25-
<!-- 0. Master Switch: Full Width Top Banner -->
25+
<!-- 0. Master Switch: Enable/Disable -->
2626
<div class="config-card master-banner">
2727
<div class="config-card-header">
2828
<span class="config-label">Enable TypePHP Enforcement</span>
@@ -37,9 +37,42 @@
3737
<span class="config-desc">Turn OFF to run pure native PHP for zero-overhead baseline benchmarking.</span>
3838
</div>
3939

40+
<!-- 1. Violation Strategy Banner (Throw | Warn | Report) -->
41+
<div class="config-card strategy-banner">
42+
<div class="config-card-header">
43+
<span class="config-label">Violation Strategy</span>
44+
<div class="pill-group">
45+
<button
46+
:class="['pill-btn', { active: modelValue.onViolation === 'throw' }]"
47+
title="Throw TypeError on first contract failure"
48+
@click="updateField('onViolation', 'throw')"
49+
>Throw</button>
50+
<button
51+
:class="['pill-btn', { active: modelValue.onViolation === 'warn' }]"
52+
title="Log E_USER_WARNING and continue execution"
53+
@click="updateField('onViolation', 'warn')"
54+
>Warn</button>
55+
<button
56+
:class="['pill-btn', { active: modelValue.onViolation === 'report' }]"
57+
title="Collect all violations and export structured JSON audit report"
58+
@click="updateField('onViolation', 'report')"
59+
>Report</button>
60+
</div>
61+
</div>
62+
<span class="config-desc">
63+
{{
64+
modelValue.onViolation === 'throw'
65+
? 'Strict mode: Halts execution immediately upon first contract violation.'
66+
: (modelValue.onViolation === 'warn'
67+
? 'Non-blocking mode: Logs PHP warnings and lets execution complete.'
68+
: 'Audit mode: Collects all violations silently and outputs structured JSON report.')
69+
}}
70+
</span>
71+
</div>
72+
4073
<!-- 2-Column Responsive Grid -->
4174
<div class="config-grid">
42-
<!-- Column 1, Item 1: Array Validation Strategy -->
75+
<!-- Array Validation Strategy -->
4376
<div class="config-card">
4477
<div class="config-card-header">
4578
<span class="config-label">Array Validation</span>
@@ -57,21 +90,22 @@
5790
<span class="config-desc">Full scans 100% of items. Hybrid uses O(1) sampling on arrays &gt; 128 items.</span>
5891
</div>
5992

60-
<!-- Column 2, Item 1: Dynamic Property Reads (__get) -->
93+
<!-- Redact Values (GDPR/PII) -->
6194
<div class="config-card">
6295
<div class="config-card-header">
63-
<span class="config-label">Property Reads (__get)</span>
96+
<span class="config-label">Redact Raw Values</span>
6497
<button
65-
:class="['toggle-switch', { active: modelValue.magicPropertyReads }]"
66-
@click="updateField('magicPropertyReads', !modelValue.magicPropertyReads)"
98+
:class="['toggle-switch', { active: modelValue.redactValues }]"
99+
title="Mask raw values in errors and reports for GDPR/HIPAA compliance"
100+
@click="updateField('redactValues', !modelValue.redactValues)"
67101
>
68102
<span class="toggle-knob"></span>
69103
</button>
70104
</div>
71-
<span class="config-desc">Enforces @property-read on __get(). Keep OFF for unhydrated ORM models.</span>
105+
<span class="config-desc">Masks raw values in errors (e.g. 'string given' instead of secret values).</span>
72106
</div>
73107

74-
<!-- Column 1, Item 2: Strict Generic Return Invariance -->
108+
<!-- Strict Generic Return Invariance -->
75109
<div class="config-card">
76110
<div class="config-card-header">
77111
<span class="config-label">Return Invariance</span>
@@ -85,21 +119,21 @@
85119
<span class="config-desc">PHPStan Level MAX invariance. Turn OFF for pragmatic return covariance.</span>
86120
</div>
87121

88-
<!-- Column 2, Item 2: Respect Ignore Tags -->
122+
<!-- Dynamic Property Reads (__get) -->
89123
<div class="config-card">
90124
<div class="config-card-header">
91-
<span class="config-label">Respect Ignore Tags</span>
125+
<span class="config-label">Property Reads (__get)</span>
92126
<button
93-
:class="['toggle-switch', { active: modelValue.respectIgnoreTags }]"
94-
@click="updateField('respectIgnoreTags', !modelValue.respectIgnoreTags)"
127+
:class="['toggle-switch', { active: modelValue.magicPropertyReads }]"
128+
@click="updateField('magicPropertyReads', !modelValue.magicPropertyReads)"
95129
>
96130
<span class="toggle-knob"></span>
97131
</button>
98132
</div>
99-
<span class="config-desc">Honors @typephp-ignore tags. Turn OFF to simulate a strict CI/CD audit run.</span>
133+
<span class="config-desc">Enforces @property-read on __get(). Keep OFF for unhydrated ORM models.</span>
100134
</div>
101135

102-
<!-- Column 1, Item 3: Respect Native Nullability -->
136+
<!-- Respect Native Nullability -->
103137
<div class="config-card">
104138
<div class="config-card-header">
105139
<span class="config-label">Native Nullability</span>
@@ -113,8 +147,22 @@
113147
<span class="config-desc">Permits null if native parameter has ?Type even if omitted in DocBlock.</span>
114148
</div>
115149

116-
<!-- Column 2, Item 3: Ignore Trace Depth -->
150+
<!-- Respect Ignore Tags -->
117151
<div class="config-card">
152+
<div class="config-card-header">
153+
<span class="config-label">Respect Ignore Tags</span>
154+
<button
155+
:class="['toggle-switch', { active: modelValue.respectIgnoreTags }]"
156+
@click="updateField('respectIgnoreTags', !modelValue.respectIgnoreTags)"
157+
>
158+
<span class="toggle-knob"></span>
159+
</button>
160+
</div>
161+
<span class="config-desc">Honors @typephp-ignore tags. Turn OFF to simulate a strict CI/CD audit run.</span>
162+
</div>
163+
164+
<!-- Ignore Trace Depth (Spans full width or col) -->
165+
<div class="config-card full-span-card">
118166
<div class="config-card-header">
119167
<span class="config-label">Ignore Trace Depth</span>
120168
<div class="stepper-widget">
@@ -285,7 +333,7 @@ onUnmounted(() => {
285333
.config-popover-wrapper {
286334
position: relative;
287335
display: inline-flex;
288-
z-index: 50;
336+
z-index: 50; /* Stays above workspace resize handles */
289337
}
290338
291339
.config-trigger-btn {
@@ -310,7 +358,7 @@ onUnmounted(() => {
310358
position: absolute;
311359
top: calc(100% + 8px);
312360
right: 0;
313-
z-index: 100;
361+
z-index: 100;
314362
width: 580px;
315363
max-width: calc(100vw - 24px);
316364
display: flex;
@@ -357,7 +405,7 @@ onUnmounted(() => {
357405
padding: 12px 14px;
358406
display: flex;
359407
flex-direction: column;
360-
gap: 10px;
408+
gap: 8px;
361409
overflow-y: auto;
362410
max-height: 80vh;
363411
}
@@ -383,11 +431,16 @@ onUnmounted(() => {
383431
border-color: var(--vp-c-brand-1);
384432
}
385433
386-
.config-card.master-banner {
434+
.config-card.master-banner,
435+
.config-card.strategy-banner {
387436
background: var(--vp-c-bg-mute);
388437
border-color: var(--vp-c-divider);
389438
}
390439
440+
.config-card.full-span-card {
441+
grid-column: 1 / -1;
442+
}
443+
391444
.config-card.inline-vars-banner {
392445
background: var(--vp-c-bg-soft);
393446
gap: 6px;
@@ -437,7 +490,7 @@ onUnmounted(() => {
437490
}
438491
439492
.inline-chip-btn {
440-
padding: 3px 8px;
493+
padding: 2px 7px;
441494
font-size: 10px;
442495
font-weight: 600;
443496
border: 1px solid var(--vp-c-divider);
@@ -459,7 +512,7 @@ onUnmounted(() => {
459512
color: #fff;
460513
}
461514
462-
/* Controls */
515+
/* Pill Controls */
463516
.pill-group {
464517
display: inline-flex;
465518
border: 1px solid var(--vp-c-divider);
@@ -470,7 +523,7 @@ onUnmounted(() => {
470523
}
471524
472525
.pill-btn {
473-
padding: 1px 6px;
526+
padding: 1px 7px;
474527
font-size: 10px;
475528
font-weight: 600;
476529
border: none;

0 commit comments

Comments
 (0)