baseguard 1.0.2 → 1.0.4
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/.baseguardrc.example.json +63 -63
- package/.eslintrc.json +24 -24
- package/.prettierrc +7 -7
- package/CHANGELOG.md +195 -195
- package/DEPLOYMENT.md +624 -624
- package/DEPLOYMENT_CHECKLIST.md +239 -239
- package/DEPLOYMENT_SUMMARY_v1.0.2.md +202 -202
- package/QUICK_START.md +134 -134
- package/README.md +488 -488
- package/RELEASE_NOTES_v1.0.2.md +434 -434
- package/bin/base.js +628 -613
- package/dist/ai/fix-manager.d.ts.map +1 -1
- package/dist/ai/fix-manager.js +1 -1
- package/dist/ai/fix-manager.js.map +1 -1
- package/dist/ai/gemini-analyzer.d.ts.map +1 -1
- package/dist/ai/gemini-analyzer.js +29 -35
- package/dist/ai/gemini-analyzer.js.map +1 -1
- package/dist/ai/gemini-code-fixer.d.ts.map +1 -1
- package/dist/ai/gemini-code-fixer.js +58 -58
- package/dist/ai/gemini-code-fixer.js.map +1 -1
- package/dist/ai/jules-implementer.d.ts +3 -0
- package/dist/ai/jules-implementer.d.ts.map +1 -1
- package/dist/ai/jules-implementer.js +63 -32
- package/dist/ai/jules-implementer.js.map +1 -1
- package/dist/ai/unified-code-fixer.js.map +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +1 -1
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/config.js +2 -1
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/fix.d.ts.map +1 -1
- package/dist/commands/fix.js +44 -15
- package/dist/commands/fix.js.map +1 -1
- package/dist/core/api-key-manager.js +2 -2
- package/dist/core/api-key-manager.js.map +1 -1
- package/dist/core/baseguard.d.ts +1 -0
- package/dist/core/baseguard.d.ts.map +1 -1
- package/dist/core/baseguard.js +13 -10
- package/dist/core/baseguard.js.map +1 -1
- package/dist/core/baseline-checker.d.ts.map +1 -1
- package/dist/core/baseline-checker.js +2 -1
- package/dist/core/baseline-checker.js.map +1 -1
- package/dist/core/configuration-recovery.d.ts.map +1 -1
- package/dist/core/configuration-recovery.js +1 -1
- package/dist/core/configuration-recovery.js.map +1 -1
- package/dist/core/debug-logger.d.ts.map +1 -1
- package/dist/core/debug-logger.js +1 -1
- package/dist/core/debug-logger.js.map +1 -1
- package/dist/core/error-handler.d.ts.map +1 -1
- package/dist/core/error-handler.js +2 -1
- package/dist/core/error-handler.js.map +1 -1
- package/dist/core/gitignore-manager.js +5 -5
- package/dist/core/graceful-degradation-manager.d.ts.map +1 -1
- package/dist/core/graceful-degradation-manager.js +16 -16
- package/dist/core/graceful-degradation-manager.js.map +1 -1
- package/dist/core/lazy-loader.d.ts.map +1 -1
- package/dist/core/lazy-loader.js +9 -2
- package/dist/core/lazy-loader.js.map +1 -1
- package/dist/core/memory-manager.d.ts +0 -3
- package/dist/core/memory-manager.d.ts.map +1 -1
- package/dist/core/memory-manager.js.map +1 -1
- package/dist/core/parser-worker.d.ts +2 -0
- package/dist/core/parser-worker.d.ts.map +1 -0
- package/dist/core/parser-worker.js +19 -0
- package/dist/core/parser-worker.js.map +1 -0
- package/dist/core/startup-optimizer.d.ts +2 -0
- package/dist/core/startup-optimizer.d.ts.map +1 -1
- package/dist/core/startup-optimizer.js +19 -12
- package/dist/core/startup-optimizer.js.map +1 -1
- package/dist/core/system-error-handler.d.ts.map +1 -1
- package/dist/core/system-error-handler.js +18 -11
- package/dist/core/system-error-handler.js.map +1 -1
- package/dist/git/automation-engine.d.ts.map +1 -1
- package/dist/git/automation-engine.js +5 -4
- package/dist/git/automation-engine.js.map +1 -1
- package/dist/git/github-manager.d.ts.map +1 -1
- package/dist/git/github-manager.js.map +1 -1
- package/dist/git/hook-manager.js +5 -5
- package/dist/git/hook-manager.js.map +1 -1
- package/dist/parsers/parser-manager.d.ts.map +1 -1
- package/dist/parsers/parser-manager.js +1 -1
- package/dist/parsers/parser-manager.js.map +1 -1
- package/dist/parsers/svelte-parser.js +1 -1
- package/dist/parsers/svelte-parser.js.map +1 -1
- package/dist/parsers/vanilla-parser.d.ts.map +1 -1
- package/dist/parsers/vanilla-parser.js.map +1 -1
- package/dist/parsers/vue-parser.d.ts.map +1 -1
- package/dist/parsers/vue-parser.js.map +1 -1
- package/dist/ui/components.d.ts +1 -1
- package/dist/ui/components.d.ts.map +1 -1
- package/dist/ui/components.js +11 -11
- package/dist/ui/components.js.map +1 -1
- package/dist/ui/terminal-header.js +14 -14
- package/package.json +105 -105
- package/src/ai/__tests__/gemini-analyzer.test.ts +180 -180
- package/src/ai/agentkit-orchestrator.ts +533 -533
- package/src/ai/fix-manager.ts +362 -362
- package/src/ai/gemini-analyzer.ts +665 -671
- package/src/ai/gemini-code-fixer.ts +539 -540
- package/src/ai/index.ts +3 -3
- package/src/ai/jules-implementer.ts +504 -460
- package/src/ai/unified-code-fixer.ts +347 -347
- package/src/commands/automation.ts +343 -343
- package/src/commands/check.ts +298 -299
- package/src/commands/config.ts +584 -583
- package/src/commands/fix.ts +264 -238
- package/src/commands/index.ts +6 -6
- package/src/commands/init.ts +155 -155
- package/src/commands/status.ts +306 -306
- package/src/core/api-key-manager.ts +298 -298
- package/src/core/baseguard.ts +757 -756
- package/src/core/baseline-checker.ts +564 -563
- package/src/core/cache-manager.ts +271 -271
- package/src/core/configuration-recovery.ts +672 -673
- package/src/core/configuration.ts +595 -595
- package/src/core/debug-logger.ts +590 -590
- package/src/core/directory-filter.ts +420 -420
- package/src/core/error-handler.ts +518 -517
- package/src/core/file-processor.ts +337 -337
- package/src/core/gitignore-manager.ts +168 -168
- package/src/core/graceful-degradation-manager.ts +596 -596
- package/src/core/index.ts +16 -16
- package/src/core/lazy-loader.ts +317 -307
- package/src/core/memory-manager.ts +290 -295
- package/src/core/parser-worker.ts +33 -0
- package/src/core/startup-optimizer.ts +246 -243
- package/src/core/system-error-handler.ts +755 -750
- package/src/git/automation-engine.ts +361 -361
- package/src/git/github-manager.ts +190 -192
- package/src/git/hook-manager.ts +210 -210
- package/src/git/index.ts +3 -3
- package/src/index.ts +7 -7
- package/src/parsers/feature-validator.ts +558 -558
- package/src/parsers/index.ts +7 -7
- package/src/parsers/parser-manager.ts +418 -419
- package/src/parsers/parser.ts +25 -25
- package/src/parsers/react-parser-optimized.ts +160 -160
- package/src/parsers/react-parser.ts +358 -358
- package/src/parsers/svelte-parser.ts +510 -510
- package/src/parsers/vanilla-parser.ts +685 -686
- package/src/parsers/vue-parser.ts +476 -478
- package/src/types/index.ts +95 -95
- package/src/ui/components.ts +567 -567
- package/src/ui/help.ts +192 -192
- package/src/ui/index.ts +3 -3
- package/src/ui/prompts.ts +680 -680
- package/src/ui/terminal-header.ts +58 -58
- package/test-build.js +40 -40
- package/test-config-commands.js +55 -55
- package/test-header-simple.js +32 -32
- package/test-terminal-header.js +11 -11
- package/test-ui.js +28 -28
- package/tests/e2e/baseguard.e2e.test.ts +515 -515
- package/tests/e2e/cross-platform.e2e.test.ts +419 -419
- package/tests/e2e/git-integration.e2e.test.ts +486 -486
- package/tests/fixtures/react-project/package.json +13 -13
- package/tests/fixtures/react-project/src/App.css +75 -75
- package/tests/fixtures/react-project/src/App.tsx +76 -76
- package/tests/fixtures/svelte-project/package.json +10 -10
- package/tests/fixtures/svelte-project/src/App.svelte +368 -368
- package/tests/fixtures/vanilla-project/index.html +75 -75
- package/tests/fixtures/vanilla-project/script.js +330 -330
- package/tests/fixtures/vanilla-project/styles.css +358 -358
- package/tests/fixtures/vue-project/package.json +11 -11
- package/tests/fixtures/vue-project/src/App.vue +215 -215
- package/tsconfig.json +34 -34
- package/vitest.config.ts +11 -11
- package/dist/terminal-header.d.ts +0 -12
- package/dist/terminal-header.js +0 -45
|
@@ -1,369 +1,369 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { onMount, onDestroy } from 'svelte';
|
|
3
|
-
|
|
4
|
-
let dialogOpen = false;
|
|
5
|
-
let dialogElement: HTMLDialogElement;
|
|
6
|
-
let canvasElement: HTMLCanvasElement;
|
|
7
|
-
let resizeObserver: ResizeObserver | null = null;
|
|
8
|
-
|
|
9
|
-
onMount(() => {
|
|
10
|
-
setupModernAPIs();
|
|
11
|
-
setupCanvas();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
onDestroy(() => {
|
|
15
|
-
if (resizeObserver) {
|
|
16
|
-
resizeObserver.disconnect();
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
function setupModernAPIs() {
|
|
21
|
-
// ResizeObserver - baseline newly available
|
|
22
|
-
resizeObserver = new ResizeObserver((entries) => {
|
|
23
|
-
console.log('Svelte: Element resized:', entries);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
if (dialogElement) {
|
|
27
|
-
resizeObserver.observe(dialogElement);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// structuredClone - baseline newly available
|
|
31
|
-
const testData = { svelte: true, reactive: { state: 'awesome' } };
|
|
32
|
-
const cloned = structuredClone(testData);
|
|
33
|
-
console.log('Svelte: Cloned data:', cloned);
|
|
34
|
-
|
|
35
|
-
// Array.at() - baseline newly available
|
|
36
|
-
const frameworks = ['svelte', 'vue', 'react', 'angular'];
|
|
37
|
-
const firstFramework = frameworks.at(0);
|
|
38
|
-
const lastFramework = frameworks.at(-1);
|
|
39
|
-
console.log('Svelte: First and last frameworks:', firstFramework, lastFramework);
|
|
40
|
-
|
|
41
|
-
// Optional chaining and nullish coalescing - baseline widely available
|
|
42
|
-
const config = { api: { endpoint: null } };
|
|
43
|
-
const endpoint = config?.api?.endpoint ?? 'https://default-api.com';
|
|
44
|
-
console.log('Svelte: API endpoint:', endpoint);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function setupCanvas() {
|
|
48
|
-
if (!canvasElement) return;
|
|
49
|
-
|
|
50
|
-
const ctx = canvasElement.getContext('2d');
|
|
51
|
-
if (ctx) {
|
|
52
|
-
// Modern Canvas API - filter property
|
|
53
|
-
ctx.filter = 'blur(3px) brightness(1.2)';
|
|
54
|
-
ctx.fillStyle = '#ff3e00';
|
|
55
|
-
ctx.fillRect(20, 20, 80, 80);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function openDialog() {
|
|
60
|
-
if (dialogElement) {
|
|
61
|
-
// HTMLDialogElement.showModal() - baseline newly available
|
|
62
|
-
dialogElement.showModal();
|
|
63
|
-
}
|
|
64
|
-
dialogOpen = true;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function closeDialog() {
|
|
68
|
-
if (dialogElement) {
|
|
69
|
-
dialogElement.close();
|
|
70
|
-
}
|
|
71
|
-
dialogOpen = false;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function testWebAPIs() {
|
|
75
|
-
// Test various modern Web APIs
|
|
76
|
-
|
|
77
|
-
// AbortController - baseline widely available
|
|
78
|
-
const controller = new AbortController();
|
|
79
|
-
const { signal } = controller;
|
|
80
|
-
|
|
81
|
-
// Fetch with modern options
|
|
82
|
-
fetch('https://api.example.com/svelte-data', {
|
|
83
|
-
signal,
|
|
84
|
-
method: 'POST',
|
|
85
|
-
headers: {
|
|
86
|
-
'Content-Type': 'application/json'
|
|
87
|
-
},
|
|
88
|
-
body: JSON.stringify({ framework: 'svelte' })
|
|
89
|
-
})
|
|
90
|
-
.then(response => response.json())
|
|
91
|
-
.catch(error => {
|
|
92
|
-
if (error.name === 'AbortError') {
|
|
93
|
-
console.log('Svelte: Fetch aborted');
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
// Abort after 500ms
|
|
98
|
-
setTimeout(() => controller.abort(), 500);
|
|
99
|
-
|
|
100
|
-
// IntersectionObserver - baseline widely available
|
|
101
|
-
const observer = new IntersectionObserver((entries) => {
|
|
102
|
-
entries.forEach(entry => {
|
|
103
|
-
console.log('Svelte: Element intersection:', entry.isIntersecting);
|
|
104
|
-
});
|
|
105
|
-
}, {
|
|
106
|
-
threshold: [0, 0.5, 1]
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
if (canvasElement) {
|
|
110
|
-
observer.observe(canvasElement);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Test URLSearchParams - baseline widely available
|
|
114
|
-
const params = new URLSearchParams();
|
|
115
|
-
params.set('framework', 'svelte');
|
|
116
|
-
params.set('version', '4.2');
|
|
117
|
-
console.log('Svelte: URL params:', params.toString());
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function testAdvancedCanvas() {
|
|
121
|
-
if (!canvasElement) return;
|
|
122
|
-
|
|
123
|
-
// Test OffscreenCanvas - baseline newly available
|
|
124
|
-
if ('OffscreenCanvas' in window) {
|
|
125
|
-
const offscreen = new OffscreenCanvas(150, 150);
|
|
126
|
-
const ctx = offscreen.getContext('2d');
|
|
127
|
-
if (ctx) {
|
|
128
|
-
ctx.fillStyle = '#ff3e00';
|
|
129
|
-
ctx.fillRect(0, 0, 75, 75);
|
|
130
|
-
|
|
131
|
-
// Convert to ImageBitmap - modern API
|
|
132
|
-
offscreen.convertToBlob().then(blob => {
|
|
133
|
-
console.log('Svelte: OffscreenCanvas blob created:', blob.size);
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// Test WebGL2 - baseline widely available
|
|
139
|
-
const gl = canvasElement.getContext('webgl2');
|
|
140
|
-
if (gl) {
|
|
141
|
-
gl.clearColor(1.0, 0.24, 0.0, 1.0); // Svelte orange
|
|
142
|
-
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
143
|
-
|
|
144
|
-
// Test WebGL2 specific features
|
|
145
|
-
const texture = gl.createTexture();
|
|
146
|
-
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
147
|
-
gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGBA8, 256, 256);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function testServiceWorker() {
|
|
152
|
-
// Service Worker registration - baseline widely available
|
|
153
|
-
if ('serviceWorker' in navigator) {
|
|
154
|
-
navigator.serviceWorker.register('/sw.js')
|
|
155
|
-
.then(registration => {
|
|
156
|
-
console.log('Svelte: SW registered:', registration.scope);
|
|
157
|
-
})
|
|
158
|
-
.catch(error => {
|
|
159
|
-
console.log('Svelte: SW registration failed:', error);
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// Test Cache API - baseline widely available
|
|
164
|
-
if ('caches' in window) {
|
|
165
|
-
caches.open('svelte-cache-v1').then(cache => {
|
|
166
|
-
cache.add('/api/data');
|
|
167
|
-
console.log('Svelte: Cache opened and populated');
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
</script>
|
|
172
|
-
|
|
173
|
-
<div class="svelte-app">
|
|
174
|
-
<h1>Svelte Test App</h1>
|
|
175
|
-
|
|
176
|
-
<div class="button-group">
|
|
177
|
-
<button on:click={openDialog}>Open Dialog</button>
|
|
178
|
-
<button on:click={testWebAPIs}>Test Web APIs</button>
|
|
179
|
-
<button on:click={testAdvancedCanvas}>Test Canvas</button>
|
|
180
|
-
<button on:click={testServiceWorker}>Test Service Worker</button>
|
|
181
|
-
</div>
|
|
182
|
-
|
|
183
|
-
<dialog bind:this={dialogElement} open={dialogOpen}>
|
|
184
|
-
<div class="dialog-content">
|
|
185
|
-
<h2>Modern Dialog in Svelte</h2>
|
|
186
|
-
<p>This dialog uses the native HTML dialog element with modern CSS styling.</p>
|
|
187
|
-
<button on:click={closeDialog}>Close Dialog</button>
|
|
188
|
-
</div>
|
|
189
|
-
</dialog>
|
|
190
|
-
|
|
191
|
-
<div class="container-test">
|
|
192
|
-
<h3>Container Query Test</h3>
|
|
193
|
-
<p>This container adapts based on its own size, not the viewport.</p>
|
|
194
|
-
</div>
|
|
195
|
-
|
|
196
|
-
<canvas bind:this={canvasElement} width="300" height="200"></canvas>
|
|
197
|
-
</div>
|
|
198
|
-
|
|
199
|
-
<style>
|
|
200
|
-
/* Modern CSS features in Svelte component */
|
|
201
|
-
.svelte-app {
|
|
202
|
-
container-type: inline-size;
|
|
203
|
-
container-name: svelte-container;
|
|
204
|
-
|
|
205
|
-
/* Modern CSS properties */
|
|
206
|
-
aspect-ratio: 16/10;
|
|
207
|
-
accent-color: #ff3e00;
|
|
208
|
-
color-scheme: light dark;
|
|
209
|
-
|
|
210
|
-
/* CSS Grid with modern features */
|
|
211
|
-
display: grid;
|
|
212
|
-
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
213
|
-
gap: 2rem;
|
|
214
|
-
|
|
215
|
-
/* Modern CSS functions */
|
|
216
|
-
background: color-mix(in srgb, #ff3e00 20%, white);
|
|
217
|
-
|
|
218
|
-
/* Backdrop filter */
|
|
219
|
-
backdrop-filter: blur(8px) saturate(1.2);
|
|
220
|
-
|
|
221
|
-
padding: 2rem;
|
|
222
|
-
border-radius: 12px;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/* Container queries */
|
|
226
|
-
@container svelte-container (min-width: 600px) {
|
|
227
|
-
.container-test {
|
|
228
|
-
font-size: 1.3rem;
|
|
229
|
-
grid-column: span 2;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
.button-group {
|
|
233
|
-
display: flex;
|
|
234
|
-
gap: 1rem;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
@container svelte-container (max-width: 400px) {
|
|
239
|
-
.svelte-app {
|
|
240
|
-
grid-template-columns: 1fr;
|
|
241
|
-
gap: 1rem;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/* Modern selectors */
|
|
246
|
-
.svelte-app:has(dialog[open]) {
|
|
247
|
-
background-color: rgba(255, 62, 0, 0.1);
|
|
248
|
-
backdrop-filter: blur(12px);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/* CSS nesting */
|
|
252
|
-
.button-group {
|
|
253
|
-
display: grid;
|
|
254
|
-
gap: 0.5rem;
|
|
255
|
-
|
|
256
|
-
button {
|
|
257
|
-
background: linear-gradient(135deg, #ff3e00, #ff6b35);
|
|
258
|
-
color: white;
|
|
259
|
-
border: none;
|
|
260
|
-
padding: 0.75rem 1.5rem;
|
|
261
|
-
border-radius: 6px;
|
|
262
|
-
cursor: pointer;
|
|
263
|
-
transition: all 0.2s ease;
|
|
264
|
-
|
|
265
|
-
&:hover {
|
|
266
|
-
transform: translateY(-2px);
|
|
267
|
-
box-shadow: 0 4px 12px rgba(255, 62, 0, 0.3);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
&:focus-visible {
|
|
271
|
-
outline: 2px solid #ff3e00;
|
|
272
|
-
outline-offset: 2px;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
&:active {
|
|
276
|
-
transform: translateY(0);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
.container-test {
|
|
282
|
-
background: linear-gradient(45deg, #ff3e00, transparent);
|
|
283
|
-
padding: 1.5rem;
|
|
284
|
-
border-radius: 8px;
|
|
285
|
-
|
|
286
|
-
/* Modern CSS units and functions */
|
|
287
|
-
width: clamp(200px, 100%, 500px);
|
|
288
|
-
height: max(120px, 12vh);
|
|
289
|
-
margin-block: 1rem;
|
|
290
|
-
padding-inline: 2rem;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/* Dialog styling with modern CSS */
|
|
294
|
-
dialog {
|
|
295
|
-
border: none;
|
|
296
|
-
border-radius: 12px;
|
|
297
|
-
padding: 0;
|
|
298
|
-
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
|
|
299
|
-
backdrop-filter: blur(10px);
|
|
300
|
-
|
|
301
|
-
&::backdrop {
|
|
302
|
-
background: color-mix(in srgb, black 50%, transparent);
|
|
303
|
-
backdrop-filter: blur(4px);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
.dialog-content {
|
|
308
|
-
padding: 2rem;
|
|
309
|
-
background: linear-gradient(135deg, white, #f8f9fa);
|
|
310
|
-
border-radius: 12px;
|
|
311
|
-
|
|
312
|
-
h2 {
|
|
313
|
-
margin-top: 0;
|
|
314
|
-
color: #ff3e00;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
button {
|
|
318
|
-
background: #ff3e00;
|
|
319
|
-
color: white;
|
|
320
|
-
border: none;
|
|
321
|
-
padding: 0.5rem 1rem;
|
|
322
|
-
border-radius: 4px;
|
|
323
|
-
cursor: pointer;
|
|
324
|
-
|
|
325
|
-
&:hover {
|
|
326
|
-
background: #e63600;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
canvas {
|
|
332
|
-
border: 2px solid #ff3e00;
|
|
333
|
-
border-radius: 8px;
|
|
334
|
-
background: white;
|
|
335
|
-
|
|
336
|
-
&:hover {
|
|
337
|
-
box-shadow: 0 4px 16px rgba(255, 62, 0, 0.2);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
/* CSS custom properties with modern color functions */
|
|
342
|
-
:root {
|
|
343
|
-
--svelte-primary: oklch(0.6 0.25 25);
|
|
344
|
-
--svelte-secondary: color(display-p3 1 0.24 0);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
/* Modern pseudo-classes and logical properties */
|
|
348
|
-
.svelte-app > * {
|
|
349
|
-
margin-block-end: 1rem;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
.svelte-app *:is(h1, h2, h3) {
|
|
353
|
-
color: var(--svelte-primary);
|
|
354
|
-
font-weight: 600;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
/* CSS @supports for progressive enhancement */
|
|
358
|
-
@supports (container-type: inline-size) {
|
|
359
|
-
.svelte-app {
|
|
360
|
-
border: 3px solid #ff3e00;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
@supports (backdrop-filter: blur(10px)) {
|
|
365
|
-
dialog {
|
|
366
|
-
background: rgba(255, 255, 255, 0.9);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount, onDestroy } from 'svelte';
|
|
3
|
+
|
|
4
|
+
let dialogOpen = false;
|
|
5
|
+
let dialogElement: HTMLDialogElement;
|
|
6
|
+
let canvasElement: HTMLCanvasElement;
|
|
7
|
+
let resizeObserver: ResizeObserver | null = null;
|
|
8
|
+
|
|
9
|
+
onMount(() => {
|
|
10
|
+
setupModernAPIs();
|
|
11
|
+
setupCanvas();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
onDestroy(() => {
|
|
15
|
+
if (resizeObserver) {
|
|
16
|
+
resizeObserver.disconnect();
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
function setupModernAPIs() {
|
|
21
|
+
// ResizeObserver - baseline newly available
|
|
22
|
+
resizeObserver = new ResizeObserver((entries) => {
|
|
23
|
+
console.log('Svelte: Element resized:', entries);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
if (dialogElement) {
|
|
27
|
+
resizeObserver.observe(dialogElement);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// structuredClone - baseline newly available
|
|
31
|
+
const testData = { svelte: true, reactive: { state: 'awesome' } };
|
|
32
|
+
const cloned = structuredClone(testData);
|
|
33
|
+
console.log('Svelte: Cloned data:', cloned);
|
|
34
|
+
|
|
35
|
+
// Array.at() - baseline newly available
|
|
36
|
+
const frameworks = ['svelte', 'vue', 'react', 'angular'];
|
|
37
|
+
const firstFramework = frameworks.at(0);
|
|
38
|
+
const lastFramework = frameworks.at(-1);
|
|
39
|
+
console.log('Svelte: First and last frameworks:', firstFramework, lastFramework);
|
|
40
|
+
|
|
41
|
+
// Optional chaining and nullish coalescing - baseline widely available
|
|
42
|
+
const config = { api: { endpoint: null } };
|
|
43
|
+
const endpoint = config?.api?.endpoint ?? 'https://default-api.com';
|
|
44
|
+
console.log('Svelte: API endpoint:', endpoint);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function setupCanvas() {
|
|
48
|
+
if (!canvasElement) return;
|
|
49
|
+
|
|
50
|
+
const ctx = canvasElement.getContext('2d');
|
|
51
|
+
if (ctx) {
|
|
52
|
+
// Modern Canvas API - filter property
|
|
53
|
+
ctx.filter = 'blur(3px) brightness(1.2)';
|
|
54
|
+
ctx.fillStyle = '#ff3e00';
|
|
55
|
+
ctx.fillRect(20, 20, 80, 80);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function openDialog() {
|
|
60
|
+
if (dialogElement) {
|
|
61
|
+
// HTMLDialogElement.showModal() - baseline newly available
|
|
62
|
+
dialogElement.showModal();
|
|
63
|
+
}
|
|
64
|
+
dialogOpen = true;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function closeDialog() {
|
|
68
|
+
if (dialogElement) {
|
|
69
|
+
dialogElement.close();
|
|
70
|
+
}
|
|
71
|
+
dialogOpen = false;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function testWebAPIs() {
|
|
75
|
+
// Test various modern Web APIs
|
|
76
|
+
|
|
77
|
+
// AbortController - baseline widely available
|
|
78
|
+
const controller = new AbortController();
|
|
79
|
+
const { signal } = controller;
|
|
80
|
+
|
|
81
|
+
// Fetch with modern options
|
|
82
|
+
fetch('https://api.example.com/svelte-data', {
|
|
83
|
+
signal,
|
|
84
|
+
method: 'POST',
|
|
85
|
+
headers: {
|
|
86
|
+
'Content-Type': 'application/json'
|
|
87
|
+
},
|
|
88
|
+
body: JSON.stringify({ framework: 'svelte' })
|
|
89
|
+
})
|
|
90
|
+
.then(response => response.json())
|
|
91
|
+
.catch(error => {
|
|
92
|
+
if (error.name === 'AbortError') {
|
|
93
|
+
console.log('Svelte: Fetch aborted');
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Abort after 500ms
|
|
98
|
+
setTimeout(() => controller.abort(), 500);
|
|
99
|
+
|
|
100
|
+
// IntersectionObserver - baseline widely available
|
|
101
|
+
const observer = new IntersectionObserver((entries) => {
|
|
102
|
+
entries.forEach(entry => {
|
|
103
|
+
console.log('Svelte: Element intersection:', entry.isIntersecting);
|
|
104
|
+
});
|
|
105
|
+
}, {
|
|
106
|
+
threshold: [0, 0.5, 1]
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
if (canvasElement) {
|
|
110
|
+
observer.observe(canvasElement);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Test URLSearchParams - baseline widely available
|
|
114
|
+
const params = new URLSearchParams();
|
|
115
|
+
params.set('framework', 'svelte');
|
|
116
|
+
params.set('version', '4.2');
|
|
117
|
+
console.log('Svelte: URL params:', params.toString());
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function testAdvancedCanvas() {
|
|
121
|
+
if (!canvasElement) return;
|
|
122
|
+
|
|
123
|
+
// Test OffscreenCanvas - baseline newly available
|
|
124
|
+
if ('OffscreenCanvas' in window) {
|
|
125
|
+
const offscreen = new OffscreenCanvas(150, 150);
|
|
126
|
+
const ctx = offscreen.getContext('2d');
|
|
127
|
+
if (ctx) {
|
|
128
|
+
ctx.fillStyle = '#ff3e00';
|
|
129
|
+
ctx.fillRect(0, 0, 75, 75);
|
|
130
|
+
|
|
131
|
+
// Convert to ImageBitmap - modern API
|
|
132
|
+
offscreen.convertToBlob().then(blob => {
|
|
133
|
+
console.log('Svelte: OffscreenCanvas blob created:', blob.size);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Test WebGL2 - baseline widely available
|
|
139
|
+
const gl = canvasElement.getContext('webgl2');
|
|
140
|
+
if (gl) {
|
|
141
|
+
gl.clearColor(1.0, 0.24, 0.0, 1.0); // Svelte orange
|
|
142
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
143
|
+
|
|
144
|
+
// Test WebGL2 specific features
|
|
145
|
+
const texture = gl.createTexture();
|
|
146
|
+
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
147
|
+
gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGBA8, 256, 256);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function testServiceWorker() {
|
|
152
|
+
// Service Worker registration - baseline widely available
|
|
153
|
+
if ('serviceWorker' in navigator) {
|
|
154
|
+
navigator.serviceWorker.register('/sw.js')
|
|
155
|
+
.then(registration => {
|
|
156
|
+
console.log('Svelte: SW registered:', registration.scope);
|
|
157
|
+
})
|
|
158
|
+
.catch(error => {
|
|
159
|
+
console.log('Svelte: SW registration failed:', error);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Test Cache API - baseline widely available
|
|
164
|
+
if ('caches' in window) {
|
|
165
|
+
caches.open('svelte-cache-v1').then(cache => {
|
|
166
|
+
cache.add('/api/data');
|
|
167
|
+
console.log('Svelte: Cache opened and populated');
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
</script>
|
|
172
|
+
|
|
173
|
+
<div class="svelte-app">
|
|
174
|
+
<h1>Svelte Test App</h1>
|
|
175
|
+
|
|
176
|
+
<div class="button-group">
|
|
177
|
+
<button on:click={openDialog}>Open Dialog</button>
|
|
178
|
+
<button on:click={testWebAPIs}>Test Web APIs</button>
|
|
179
|
+
<button on:click={testAdvancedCanvas}>Test Canvas</button>
|
|
180
|
+
<button on:click={testServiceWorker}>Test Service Worker</button>
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
<dialog bind:this={dialogElement} open={dialogOpen}>
|
|
184
|
+
<div class="dialog-content">
|
|
185
|
+
<h2>Modern Dialog in Svelte</h2>
|
|
186
|
+
<p>This dialog uses the native HTML dialog element with modern CSS styling.</p>
|
|
187
|
+
<button on:click={closeDialog}>Close Dialog</button>
|
|
188
|
+
</div>
|
|
189
|
+
</dialog>
|
|
190
|
+
|
|
191
|
+
<div class="container-test">
|
|
192
|
+
<h3>Container Query Test</h3>
|
|
193
|
+
<p>This container adapts based on its own size, not the viewport.</p>
|
|
194
|
+
</div>
|
|
195
|
+
|
|
196
|
+
<canvas bind:this={canvasElement} width="300" height="200"></canvas>
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
<style>
|
|
200
|
+
/* Modern CSS features in Svelte component */
|
|
201
|
+
.svelte-app {
|
|
202
|
+
container-type: inline-size;
|
|
203
|
+
container-name: svelte-container;
|
|
204
|
+
|
|
205
|
+
/* Modern CSS properties */
|
|
206
|
+
aspect-ratio: 16/10;
|
|
207
|
+
accent-color: #ff3e00;
|
|
208
|
+
color-scheme: light dark;
|
|
209
|
+
|
|
210
|
+
/* CSS Grid with modern features */
|
|
211
|
+
display: grid;
|
|
212
|
+
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
213
|
+
gap: 2rem;
|
|
214
|
+
|
|
215
|
+
/* Modern CSS functions */
|
|
216
|
+
background: color-mix(in srgb, #ff3e00 20%, white);
|
|
217
|
+
|
|
218
|
+
/* Backdrop filter */
|
|
219
|
+
backdrop-filter: blur(8px) saturate(1.2);
|
|
220
|
+
|
|
221
|
+
padding: 2rem;
|
|
222
|
+
border-radius: 12px;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/* Container queries */
|
|
226
|
+
@container svelte-container (min-width: 600px) {
|
|
227
|
+
.container-test {
|
|
228
|
+
font-size: 1.3rem;
|
|
229
|
+
grid-column: span 2;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.button-group {
|
|
233
|
+
display: flex;
|
|
234
|
+
gap: 1rem;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
@container svelte-container (max-width: 400px) {
|
|
239
|
+
.svelte-app {
|
|
240
|
+
grid-template-columns: 1fr;
|
|
241
|
+
gap: 1rem;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/* Modern selectors */
|
|
246
|
+
.svelte-app:has(dialog[open]) {
|
|
247
|
+
background-color: rgba(255, 62, 0, 0.1);
|
|
248
|
+
backdrop-filter: blur(12px);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/* CSS nesting */
|
|
252
|
+
.button-group {
|
|
253
|
+
display: grid;
|
|
254
|
+
gap: 0.5rem;
|
|
255
|
+
|
|
256
|
+
button {
|
|
257
|
+
background: linear-gradient(135deg, #ff3e00, #ff6b35);
|
|
258
|
+
color: white;
|
|
259
|
+
border: none;
|
|
260
|
+
padding: 0.75rem 1.5rem;
|
|
261
|
+
border-radius: 6px;
|
|
262
|
+
cursor: pointer;
|
|
263
|
+
transition: all 0.2s ease;
|
|
264
|
+
|
|
265
|
+
&:hover {
|
|
266
|
+
transform: translateY(-2px);
|
|
267
|
+
box-shadow: 0 4px 12px rgba(255, 62, 0, 0.3);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
&:focus-visible {
|
|
271
|
+
outline: 2px solid #ff3e00;
|
|
272
|
+
outline-offset: 2px;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
&:active {
|
|
276
|
+
transform: translateY(0);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.container-test {
|
|
282
|
+
background: linear-gradient(45deg, #ff3e00, transparent);
|
|
283
|
+
padding: 1.5rem;
|
|
284
|
+
border-radius: 8px;
|
|
285
|
+
|
|
286
|
+
/* Modern CSS units and functions */
|
|
287
|
+
width: clamp(200px, 100%, 500px);
|
|
288
|
+
height: max(120px, 12vh);
|
|
289
|
+
margin-block: 1rem;
|
|
290
|
+
padding-inline: 2rem;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/* Dialog styling with modern CSS */
|
|
294
|
+
dialog {
|
|
295
|
+
border: none;
|
|
296
|
+
border-radius: 12px;
|
|
297
|
+
padding: 0;
|
|
298
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
|
|
299
|
+
backdrop-filter: blur(10px);
|
|
300
|
+
|
|
301
|
+
&::backdrop {
|
|
302
|
+
background: color-mix(in srgb, black 50%, transparent);
|
|
303
|
+
backdrop-filter: blur(4px);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.dialog-content {
|
|
308
|
+
padding: 2rem;
|
|
309
|
+
background: linear-gradient(135deg, white, #f8f9fa);
|
|
310
|
+
border-radius: 12px;
|
|
311
|
+
|
|
312
|
+
h2 {
|
|
313
|
+
margin-top: 0;
|
|
314
|
+
color: #ff3e00;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
button {
|
|
318
|
+
background: #ff3e00;
|
|
319
|
+
color: white;
|
|
320
|
+
border: none;
|
|
321
|
+
padding: 0.5rem 1rem;
|
|
322
|
+
border-radius: 4px;
|
|
323
|
+
cursor: pointer;
|
|
324
|
+
|
|
325
|
+
&:hover {
|
|
326
|
+
background: #e63600;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
canvas {
|
|
332
|
+
border: 2px solid #ff3e00;
|
|
333
|
+
border-radius: 8px;
|
|
334
|
+
background: white;
|
|
335
|
+
|
|
336
|
+
&:hover {
|
|
337
|
+
box-shadow: 0 4px 16px rgba(255, 62, 0, 0.2);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/* CSS custom properties with modern color functions */
|
|
342
|
+
:root {
|
|
343
|
+
--svelte-primary: oklch(0.6 0.25 25);
|
|
344
|
+
--svelte-secondary: color(display-p3 1 0.24 0);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/* Modern pseudo-classes and logical properties */
|
|
348
|
+
.svelte-app > * {
|
|
349
|
+
margin-block-end: 1rem;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.svelte-app *:is(h1, h2, h3) {
|
|
353
|
+
color: var(--svelte-primary);
|
|
354
|
+
font-weight: 600;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/* CSS @supports for progressive enhancement */
|
|
358
|
+
@supports (container-type: inline-size) {
|
|
359
|
+
.svelte-app {
|
|
360
|
+
border: 3px solid #ff3e00;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
@supports (backdrop-filter: blur(10px)) {
|
|
365
|
+
dialog {
|
|
366
|
+
background: rgba(255, 255, 255, 0.9);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
369
|
</style>
|