baseguard 1.0.0
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/.eslintrc.json +25 -0
- package/.prettierrc +8 -0
- package/README.md +94 -0
- package/bin/base.js +494 -0
- package/dist/ai/fix-manager.d.ts +67 -0
- package/dist/ai/fix-manager.d.ts.map +1 -0
- package/dist/ai/fix-manager.js +326 -0
- package/dist/ai/fix-manager.js.map +1 -0
- package/dist/ai/gemini-analyzer.d.ts +116 -0
- package/dist/ai/gemini-analyzer.d.ts.map +1 -0
- package/dist/ai/gemini-analyzer.js +572 -0
- package/dist/ai/gemini-analyzer.js.map +1 -0
- package/dist/ai/index.d.ts +4 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +5 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/jules-implementer.d.ts +115 -0
- package/dist/ai/jules-implementer.d.ts.map +1 -0
- package/dist/ai/jules-implementer.js +387 -0
- package/dist/ai/jules-implementer.js.map +1 -0
- package/dist/commands/automation.d.ts +5 -0
- package/dist/commands/automation.d.ts.map +1 -0
- package/dist/commands/automation.js +305 -0
- package/dist/commands/automation.js.map +1 -0
- package/dist/commands/check.d.ts +9 -0
- package/dist/commands/check.d.ts.map +1 -0
- package/dist/commands/check.js +113 -0
- package/dist/commands/check.js.map +1 -0
- package/dist/commands/config.d.ts +11 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +324 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/fix.d.ts +9 -0
- package/dist/commands/fix.d.ts.map +1 -0
- package/dist/commands/fix.js +207 -0
- package/dist/commands/fix.js.map +1 -0
- package/dist/commands/index.d.ts +6 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +7 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init.d.ts +9 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +125 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/core/api-key-manager.d.ts +83 -0
- package/dist/core/api-key-manager.d.ts.map +1 -0
- package/dist/core/api-key-manager.js +244 -0
- package/dist/core/api-key-manager.js.map +1 -0
- package/dist/core/baseguard.d.ts +46 -0
- package/dist/core/baseguard.d.ts.map +1 -0
- package/dist/core/baseguard.js +132 -0
- package/dist/core/baseguard.js.map +1 -0
- package/dist/core/baseline-checker.d.ts +63 -0
- package/dist/core/baseline-checker.d.ts.map +1 -0
- package/dist/core/baseline-checker.js +502 -0
- package/dist/core/baseline-checker.js.map +1 -0
- package/dist/core/cache-manager.d.ts +88 -0
- package/dist/core/cache-manager.d.ts.map +1 -0
- package/dist/core/cache-manager.js +213 -0
- package/dist/core/cache-manager.js.map +1 -0
- package/dist/core/configuration.d.ts +140 -0
- package/dist/core/configuration.d.ts.map +1 -0
- package/dist/core/configuration.js +474 -0
- package/dist/core/configuration.js.map +1 -0
- package/dist/core/directory-filter.d.ts +90 -0
- package/dist/core/directory-filter.d.ts.map +1 -0
- package/dist/core/directory-filter.js +319 -0
- package/dist/core/directory-filter.js.map +1 -0
- package/dist/core/error-handler.d.ts +110 -0
- package/dist/core/error-handler.d.ts.map +1 -0
- package/dist/core/error-handler.js +392 -0
- package/dist/core/error-handler.js.map +1 -0
- package/dist/core/file-processor.d.ts +80 -0
- package/dist/core/file-processor.d.ts.map +1 -0
- package/dist/core/file-processor.js +259 -0
- package/dist/core/file-processor.js.map +1 -0
- package/dist/core/gitignore-manager.d.ts +44 -0
- package/dist/core/gitignore-manager.d.ts.map +1 -0
- package/dist/core/gitignore-manager.js +147 -0
- package/dist/core/gitignore-manager.js.map +1 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +13 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/lazy-loader.d.ts +68 -0
- package/dist/core/lazy-loader.d.ts.map +1 -0
- package/dist/core/lazy-loader.js +260 -0
- package/dist/core/lazy-loader.js.map +1 -0
- package/dist/core/memory-manager.d.ts +1 -0
- package/dist/core/memory-manager.d.ts.map +1 -0
- package/dist/core/memory-manager.js +2 -0
- package/dist/core/memory-manager.js.map +1 -0
- package/dist/core/startup-optimizer.d.ts +45 -0
- package/dist/core/startup-optimizer.d.ts.map +1 -0
- package/dist/core/startup-optimizer.js +140 -0
- package/dist/core/startup-optimizer.js.map +1 -0
- package/dist/git/automation-engine.d.ts +58 -0
- package/dist/git/automation-engine.d.ts.map +1 -0
- package/dist/git/automation-engine.js +318 -0
- package/dist/git/automation-engine.js.map +1 -0
- package/dist/git/github-manager.d.ts +71 -0
- package/dist/git/github-manager.d.ts.map +1 -0
- package/dist/git/github-manager.js +226 -0
- package/dist/git/github-manager.js.map +1 -0
- package/dist/git/hook-manager.d.ts +43 -0
- package/dist/git/hook-manager.d.ts.map +1 -0
- package/dist/git/hook-manager.js +191 -0
- package/dist/git/hook-manager.js.map +1 -0
- package/dist/git/index.d.ts +4 -0
- package/dist/git/index.d.ts.map +1 -0
- package/dist/git/index.js +5 -0
- package/dist/git/index.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/parsers/feature-validator.d.ts +60 -0
- package/dist/parsers/feature-validator.d.ts.map +1 -0
- package/dist/parsers/feature-validator.js +483 -0
- package/dist/parsers/feature-validator.js.map +1 -0
- package/dist/parsers/index.d.ts +8 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/parsers/index.js +9 -0
- package/dist/parsers/index.js.map +1 -0
- package/dist/parsers/parser-manager.d.ts +103 -0
- package/dist/parsers/parser-manager.d.ts.map +1 -0
- package/dist/parsers/parser-manager.js +321 -0
- package/dist/parsers/parser-manager.js.map +1 -0
- package/dist/parsers/parser.d.ts +23 -0
- package/dist/parsers/parser.d.ts.map +1 -0
- package/dist/parsers/parser.js +6 -0
- package/dist/parsers/parser.js.map +1 -0
- package/dist/parsers/react-parser.d.ts +22 -0
- package/dist/parsers/react-parser.d.ts.map +1 -0
- package/dist/parsers/react-parser.js +307 -0
- package/dist/parsers/react-parser.js.map +1 -0
- package/dist/parsers/svelte-parser.d.ts +33 -0
- package/dist/parsers/svelte-parser.d.ts.map +1 -0
- package/dist/parsers/svelte-parser.js +408 -0
- package/dist/parsers/svelte-parser.js.map +1 -0
- package/dist/parsers/vanilla-parser.d.ts +31 -0
- package/dist/parsers/vanilla-parser.d.ts.map +1 -0
- package/dist/parsers/vanilla-parser.js +590 -0
- package/dist/parsers/vanilla-parser.js.map +1 -0
- package/dist/parsers/vue-parser.d.ts +9 -0
- package/dist/parsers/vue-parser.d.ts.map +1 -0
- package/dist/parsers/vue-parser.js +16 -0
- package/dist/parsers/vue-parser.js.map +1 -0
- package/dist/terminal-header.d.ts +12 -0
- package/dist/terminal-header.js +45 -0
- package/dist/types/index.d.ts +83 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/ui/components.d.ts +133 -0
- package/dist/ui/components.d.ts.map +1 -0
- package/dist/ui/components.js +482 -0
- package/dist/ui/components.js.map +1 -0
- package/dist/ui/help.d.ts +11 -0
- package/dist/ui/help.d.ts.map +1 -0
- package/dist/ui/help.js +161 -0
- package/dist/ui/help.js.map +1 -0
- package/dist/ui/index.d.ts +5 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +5 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/prompts.d.ts +63 -0
- package/dist/ui/prompts.d.ts.map +1 -0
- package/dist/ui/prompts.js +611 -0
- package/dist/ui/prompts.js.map +1 -0
- package/dist/ui/terminal-header.d.ts +13 -0
- package/dist/ui/terminal-header.d.ts.map +1 -0
- package/dist/ui/terminal-header.js +46 -0
- package/dist/ui/terminal-header.js.map +1 -0
- package/package.json +80 -0
- package/src/ai/__tests__/gemini-analyzer.test.ts +181 -0
- package/src/ai/fix-manager.ts +362 -0
- package/src/ai/gemini-analyzer.ts +671 -0
- package/src/ai/index.ts +4 -0
- package/src/ai/jules-implementer.ts +459 -0
- package/src/commands/automation.ts +344 -0
- package/src/commands/check.ts +299 -0
- package/src/commands/config.ts +365 -0
- package/src/commands/fix.ts +234 -0
- package/src/commands/index.ts +6 -0
- package/src/commands/init.ts +142 -0
- package/src/commands/status.ts +0 -0
- package/src/core/api-key-manager.ts +298 -0
- package/src/core/baseguard.ts +742 -0
- package/src/core/baseline-checker.ts +563 -0
- package/src/core/cache-manager.ts +270 -0
- package/src/core/configuration-recovery.ts +676 -0
- package/src/core/configuration.ts +559 -0
- package/src/core/debug-logger.ts +590 -0
- package/src/core/directory-filter.ts +421 -0
- package/src/core/error-handler.ts +517 -0
- package/src/core/file-processor.ts +331 -0
- package/src/core/gitignore-manager.ts +169 -0
- package/src/core/graceful-degradation-manager.ts +596 -0
- package/src/core/index.ts +13 -0
- package/src/core/lazy-loader.ts +307 -0
- package/src/core/logger.ts +0 -0
- package/src/core/memory-manager.ts +294 -0
- package/src/core/startup-optimizer.ts +173 -0
- package/src/core/system-error-handler.ts +746 -0
- package/src/git/automation-engine.ts +361 -0
- package/src/git/github-manager.ts +260 -0
- package/src/git/hook-manager.ts +210 -0
- package/src/git/index.ts +4 -0
- package/src/index.ts +8 -0
- package/src/parsers/feature-validator.ts +559 -0
- package/src/parsers/index.ts +8 -0
- package/src/parsers/parser-manager.ts +419 -0
- package/src/parsers/parser.ts +26 -0
- package/src/parsers/react-parser-optimized.ts +161 -0
- package/src/parsers/react-parser.ts +359 -0
- package/src/parsers/svelte-parser.ts +506 -0
- package/src/parsers/vanilla-parser.ts +682 -0
- package/src/parsers/vue-parser.ts +472 -0
- package/src/types/index.ts +92 -0
- package/src/ui/components.ts +567 -0
- package/src/ui/help.ts +193 -0
- package/src/ui/index.ts +4 -0
- package/src/ui/prompts.ts +688 -0
- package/src/ui/terminal-header.ts +59 -0
- package/test-config-commands.js +56 -0
- package/test-header-simple.js +33 -0
- package/test-terminal-header.js +12 -0
- package/test-ui.js +29 -0
- package/tests/e2e/baseguard.e2e.test.ts +516 -0
- package/tests/e2e/cross-platform.e2e.test.ts +420 -0
- package/tests/e2e/git-integration.e2e.test.ts +487 -0
- package/tests/fixtures/react-project/package.json +14 -0
- package/tests/fixtures/react-project/src/App.css +76 -0
- package/tests/fixtures/react-project/src/App.tsx +77 -0
- package/tests/fixtures/svelte-project/package.json +11 -0
- package/tests/fixtures/svelte-project/src/App.svelte +369 -0
- package/tests/fixtures/vanilla-project/index.html +76 -0
- package/tests/fixtures/vanilla-project/script.js +331 -0
- package/tests/fixtures/vanilla-project/styles.css +359 -0
- package/tests/fixtures/vue-project/package.json +12 -0
- package/tests/fixtures/vue-project/src/App.vue +216 -0
- package/tsconfig.json +36 -0
- package/vitest.config.ts +10 -0
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
// Modern JavaScript features for comprehensive testing
|
|
2
|
+
|
|
3
|
+
// Modern JavaScript syntax and APIs
|
|
4
|
+
class VanillaTestApp {
|
|
5
|
+
#privateField = 'private data'; // Private fields - baseline newly available
|
|
6
|
+
|
|
7
|
+
constructor() {
|
|
8
|
+
this.setupEventListeners();
|
|
9
|
+
this.initializeModernAPIs();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
setupEventListeners() {
|
|
13
|
+
// Modern event listener setup with optional chaining
|
|
14
|
+
document.getElementById('openDialog')?.addEventListener('click', this.openDialog.bind(this));
|
|
15
|
+
document.getElementById('testAPIs')?.addEventListener('click', this.testWebAPIs.bind(this));
|
|
16
|
+
document.getElementById('testCanvas')?.addEventListener('click', this.testCanvas.bind(this));
|
|
17
|
+
document.getElementById('testWebGL')?.addEventListener('click', this.testWebGL.bind(this));
|
|
18
|
+
document.getElementById('testServiceWorker')?.addEventListener('click', this.testServiceWorker.bind(this));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async initializeModernAPIs() {
|
|
22
|
+
// Top-level await would be used here in a module context
|
|
23
|
+
await this.setupResizeObserver();
|
|
24
|
+
this.testModernJavaScript();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async setupResizeObserver() {
|
|
28
|
+
// ResizeObserver - baseline newly available
|
|
29
|
+
if ('ResizeObserver' in window) {
|
|
30
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
31
|
+
entries.forEach(entry => {
|
|
32
|
+
console.log('Vanilla: Element resized:', entry.target.tagName, entry.contentRect);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const dialog = document.getElementById('testDialog');
|
|
37
|
+
if (dialog) {
|
|
38
|
+
resizeObserver.observe(dialog);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
testModernJavaScript() {
|
|
44
|
+
// structuredClone - baseline newly available
|
|
45
|
+
const complexData = {
|
|
46
|
+
name: 'Vanilla JS Test',
|
|
47
|
+
nested: {
|
|
48
|
+
array: [1, 2, 3],
|
|
49
|
+
date: new Date(),
|
|
50
|
+
map: new Map([['key', 'value']])
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
if ('structuredClone' in window) {
|
|
55
|
+
const cloned = structuredClone(complexData);
|
|
56
|
+
console.log('Vanilla: Cloned complex data:', cloned);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Array.at() - baseline newly available
|
|
60
|
+
const testArray = ['first', 'second', 'third', 'fourth', 'last'];
|
|
61
|
+
const firstItem = testArray.at?.(0) ?? testArray[0];
|
|
62
|
+
const lastItem = testArray.at?.(-1) ?? testArray[testArray.length - 1];
|
|
63
|
+
console.log('Vanilla: Array access:', { firstItem, lastItem });
|
|
64
|
+
|
|
65
|
+
// Optional chaining and nullish coalescing - baseline widely available
|
|
66
|
+
const config = { api: { endpoint: null, timeout: undefined } };
|
|
67
|
+
const endpoint = config?.api?.endpoint ?? 'https://default-api.com';
|
|
68
|
+
const timeout = config?.api?.timeout ?? 5000;
|
|
69
|
+
console.log('Vanilla: Config values:', { endpoint, timeout });
|
|
70
|
+
|
|
71
|
+
// Private field access
|
|
72
|
+
console.log('Vanilla: Private field accessible:', this.#privateField);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
openDialog() {
|
|
76
|
+
const dialog = document.getElementById('testDialog');
|
|
77
|
+
if (dialog && 'showModal' in dialog) {
|
|
78
|
+
// HTMLDialogElement.showModal() - baseline newly available
|
|
79
|
+
dialog.showModal();
|
|
80
|
+
} else {
|
|
81
|
+
// Fallback for older browsers
|
|
82
|
+
console.warn('Dialog.showModal() not supported');
|
|
83
|
+
dialog.style.display = 'block';
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async testWebAPIs() {
|
|
88
|
+
// AbortController - baseline widely available
|
|
89
|
+
const controller = new AbortController();
|
|
90
|
+
const { signal } = controller;
|
|
91
|
+
|
|
92
|
+
try {
|
|
93
|
+
// Fetch with modern options
|
|
94
|
+
const response = await fetch('https://jsonplaceholder.typicode.com/posts/1', {
|
|
95
|
+
signal,
|
|
96
|
+
method: 'GET',
|
|
97
|
+
headers: {
|
|
98
|
+
'Accept': 'application/json',
|
|
99
|
+
'Content-Type': 'application/json'
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
if (response.ok) {
|
|
104
|
+
const data = await response.json();
|
|
105
|
+
console.log('Vanilla: Fetch successful:', data.title);
|
|
106
|
+
}
|
|
107
|
+
} catch (error) {
|
|
108
|
+
if (error.name === 'AbortError') {
|
|
109
|
+
console.log('Vanilla: Fetch aborted');
|
|
110
|
+
} else {
|
|
111
|
+
console.error('Vanilla: Fetch error:', error);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Test abort after 100ms
|
|
116
|
+
setTimeout(() => controller.abort(), 100);
|
|
117
|
+
|
|
118
|
+
// IntersectionObserver - baseline widely available
|
|
119
|
+
if ('IntersectionObserver' in window) {
|
|
120
|
+
const observer = new IntersectionObserver((entries) => {
|
|
121
|
+
entries.forEach(entry => {
|
|
122
|
+
console.log('Vanilla: Intersection:', entry.target.id, entry.isIntersecting);
|
|
123
|
+
});
|
|
124
|
+
}, {
|
|
125
|
+
threshold: [0, 0.25, 0.5, 0.75, 1],
|
|
126
|
+
rootMargin: '10px'
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const canvas = document.getElementById('testCanvas');
|
|
130
|
+
if (canvas) {
|
|
131
|
+
observer.observe(canvas);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// URLSearchParams - baseline widely available
|
|
136
|
+
const params = new URLSearchParams();
|
|
137
|
+
params.set('framework', 'vanilla');
|
|
138
|
+
params.set('test', 'web-apis');
|
|
139
|
+
params.set('timestamp', Date.now().toString());
|
|
140
|
+
console.log('Vanilla: URL params:', params.toString());
|
|
141
|
+
|
|
142
|
+
// FormData - baseline widely available
|
|
143
|
+
const formData = new FormData();
|
|
144
|
+
formData.append('test', 'vanilla-js');
|
|
145
|
+
formData.append('features', JSON.stringify(['modern', 'apis']));
|
|
146
|
+
console.log('Vanilla: FormData created with', formData.get('test'));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
testCanvas() {
|
|
150
|
+
const canvas = document.getElementById('testCanvas');
|
|
151
|
+
if (!canvas) return;
|
|
152
|
+
|
|
153
|
+
const ctx = canvas.getContext('2d');
|
|
154
|
+
if (!ctx) return;
|
|
155
|
+
|
|
156
|
+
// Modern Canvas API features
|
|
157
|
+
ctx.save();
|
|
158
|
+
|
|
159
|
+
// Canvas filter - baseline newly available
|
|
160
|
+
if ('filter' in ctx) {
|
|
161
|
+
ctx.filter = 'blur(2px) brightness(1.1) contrast(1.2)';
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Draw with modern features
|
|
165
|
+
ctx.fillStyle = '#4285f4';
|
|
166
|
+
ctx.fillRect(10, 10, 100, 100);
|
|
167
|
+
|
|
168
|
+
// Reset filter
|
|
169
|
+
ctx.filter = 'none';
|
|
170
|
+
|
|
171
|
+
// Gradient with modern color syntax
|
|
172
|
+
const gradient = ctx.createLinearGradient(0, 0, 200, 0);
|
|
173
|
+
gradient.addColorStop(0, '#ff6b6b');
|
|
174
|
+
gradient.addColorStop(1, '#4ecdc4');
|
|
175
|
+
|
|
176
|
+
ctx.fillStyle = gradient;
|
|
177
|
+
ctx.fillRect(120, 10, 100, 100);
|
|
178
|
+
|
|
179
|
+
// Path2D - baseline widely available
|
|
180
|
+
if ('Path2D' in window) {
|
|
181
|
+
const path = new Path2D();
|
|
182
|
+
path.arc(75, 150, 50, 0, 2 * Math.PI);
|
|
183
|
+
ctx.fillStyle = '#feca57';
|
|
184
|
+
ctx.fill(path);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
ctx.restore();
|
|
188
|
+
|
|
189
|
+
// Test OffscreenCanvas - baseline newly available
|
|
190
|
+
if ('OffscreenCanvas' in window) {
|
|
191
|
+
const offscreen = new OffscreenCanvas(200, 200);
|
|
192
|
+
const offscreenCtx = offscreen.getContext('2d');
|
|
193
|
+
|
|
194
|
+
if (offscreenCtx) {
|
|
195
|
+
offscreenCtx.fillStyle = '#ff9ff3';
|
|
196
|
+
offscreenCtx.fillRect(0, 0, 100, 100);
|
|
197
|
+
|
|
198
|
+
// Convert to blob - modern API
|
|
199
|
+
offscreen.convertToBlob().then(blob => {
|
|
200
|
+
console.log('Vanilla: OffscreenCanvas blob created:', blob.size, 'bytes');
|
|
201
|
+
}).catch(error => {
|
|
202
|
+
console.error('Vanilla: OffscreenCanvas error:', error);
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
testWebGL() {
|
|
209
|
+
const canvas = document.getElementById('testCanvas');
|
|
210
|
+
if (!canvas) return;
|
|
211
|
+
|
|
212
|
+
// Test WebGL2 - baseline widely available
|
|
213
|
+
const gl = canvas.getContext('webgl2');
|
|
214
|
+
if (!gl) {
|
|
215
|
+
console.warn('Vanilla: WebGL2 not supported, trying WebGL1');
|
|
216
|
+
const gl1 = canvas.getContext('webgl');
|
|
217
|
+
if (gl1) {
|
|
218
|
+
gl1.clearColor(0.2, 0.4, 0.8, 1.0);
|
|
219
|
+
gl1.clear(gl1.COLOR_BUFFER_BIT);
|
|
220
|
+
console.log('Vanilla: WebGL1 context created');
|
|
221
|
+
}
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// WebGL2 specific features
|
|
226
|
+
gl.clearColor(0.1, 0.2, 0.3, 1.0);
|
|
227
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
228
|
+
|
|
229
|
+
// Test WebGL2 specific functionality
|
|
230
|
+
const texture = gl.createTexture();
|
|
231
|
+
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
232
|
+
|
|
233
|
+
// texStorage2D is WebGL2 specific
|
|
234
|
+
gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGBA8, 256, 256);
|
|
235
|
+
|
|
236
|
+
console.log('Vanilla: WebGL2 context created and texture allocated');
|
|
237
|
+
|
|
238
|
+
// Test WebGL extensions
|
|
239
|
+
const extensions = gl.getSupportedExtensions();
|
|
240
|
+
console.log('Vanilla: WebGL extensions:', extensions?.length || 0);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
async testServiceWorker() {
|
|
244
|
+
// Service Worker - baseline widely available
|
|
245
|
+
if ('serviceWorker' in navigator) {
|
|
246
|
+
try {
|
|
247
|
+
const registration = await navigator.serviceWorker.register('/sw.js');
|
|
248
|
+
console.log('Vanilla: Service Worker registered:', registration.scope);
|
|
249
|
+
|
|
250
|
+
// Listen for updates
|
|
251
|
+
registration.addEventListener('updatefound', () => {
|
|
252
|
+
console.log('Vanilla: Service Worker update found');
|
|
253
|
+
});
|
|
254
|
+
} catch (error) {
|
|
255
|
+
console.log('Vanilla: Service Worker registration failed:', error.message);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// Cache API - baseline widely available
|
|
260
|
+
if ('caches' in window) {
|
|
261
|
+
try {
|
|
262
|
+
const cache = await caches.open('vanilla-test-cache-v1');
|
|
263
|
+
await cache.add('/');
|
|
264
|
+
console.log('Vanilla: Cache API working');
|
|
265
|
+
|
|
266
|
+
// Test cache match
|
|
267
|
+
const response = await cache.match('/');
|
|
268
|
+
if (response) {
|
|
269
|
+
console.log('Vanilla: Cache match successful');
|
|
270
|
+
}
|
|
271
|
+
} catch (error) {
|
|
272
|
+
console.error('Vanilla: Cache API error:', error);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// Push API check (requires HTTPS and user permission)
|
|
277
|
+
if ('PushManager' in window && 'serviceWorker' in navigator) {
|
|
278
|
+
const permission = await Notification.requestPermission();
|
|
279
|
+
console.log('Vanilla: Notification permission:', permission);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Background Sync check
|
|
283
|
+
if ('serviceWorker' in navigator && 'sync' in window.ServiceWorkerRegistration.prototype) {
|
|
284
|
+
console.log('Vanilla: Background Sync supported');
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Initialize the app when DOM is loaded
|
|
290
|
+
if (document.readyState === 'loading') {
|
|
291
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
292
|
+
new VanillaTestApp();
|
|
293
|
+
});
|
|
294
|
+
} else {
|
|
295
|
+
new VanillaTestApp();
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// Test modern JavaScript features at module level
|
|
299
|
+
console.log('Vanilla: Script loaded with modern features');
|
|
300
|
+
|
|
301
|
+
// Test globalThis - baseline widely available
|
|
302
|
+
if (typeof globalThis !== 'undefined') {
|
|
303
|
+
globalThis.vanillaTestApp = 'loaded';
|
|
304
|
+
console.log('Vanilla: globalThis available');
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Test BigInt - baseline widely available
|
|
308
|
+
if (typeof BigInt !== 'undefined') {
|
|
309
|
+
const bigNumber = BigInt(Number.MAX_SAFE_INTEGER) + 1n;
|
|
310
|
+
console.log('Vanilla: BigInt test:', bigNumber.toString());
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// Test dynamic import (would be used in module context)
|
|
314
|
+
// Dynamic imports are baseline newly available
|
|
315
|
+
if (typeof import === 'function') {
|
|
316
|
+
console.log('Vanilla: Dynamic import supported');
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// Test WeakRef and FinalizationRegistry - baseline newly available
|
|
320
|
+
if (typeof WeakRef !== 'undefined') {
|
|
321
|
+
const obj = { data: 'test' };
|
|
322
|
+
const weakRef = new WeakRef(obj);
|
|
323
|
+
console.log('Vanilla: WeakRef created');
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (typeof FinalizationRegistry !== 'undefined') {
|
|
327
|
+
const registry = new FinalizationRegistry((heldValue) => {
|
|
328
|
+
console.log('Vanilla: Object finalized:', heldValue);
|
|
329
|
+
});
|
|
330
|
+
console.log('Vanilla: FinalizationRegistry created');
|
|
331
|
+
}
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
/* Modern CSS features for comprehensive testing */
|
|
2
|
+
|
|
3
|
+
/* CSS Custom Properties with modern color functions */
|
|
4
|
+
:root {
|
|
5
|
+
--primary-color: oklch(0.7 0.2 240);
|
|
6
|
+
--secondary-color: color(display-p3 0.2 0.8 0.4);
|
|
7
|
+
--accent-color: color-mix(in srgb, blue 60%, red);
|
|
8
|
+
--gradient-bg: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* Modern CSS reset and base styles */
|
|
12
|
+
*,
|
|
13
|
+
*::before,
|
|
14
|
+
*::after {
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
body {
|
|
19
|
+
margin: 0;
|
|
20
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
21
|
+
line-height: 1.6;
|
|
22
|
+
color-scheme: light dark;
|
|
23
|
+
accent-color: var(--primary-color);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* Container queries - baseline newly available */
|
|
27
|
+
.vanilla-app {
|
|
28
|
+
container-type: inline-size;
|
|
29
|
+
container-name: main-container;
|
|
30
|
+
|
|
31
|
+
/* Modern CSS properties */
|
|
32
|
+
aspect-ratio: 16/9;
|
|
33
|
+
min-height: 100vh;
|
|
34
|
+
padding: 2rem;
|
|
35
|
+
|
|
36
|
+
/* Modern CSS functions and values */
|
|
37
|
+
background: color-mix(in srgb, lightblue 30%, white);
|
|
38
|
+
backdrop-filter: blur(10px);
|
|
39
|
+
|
|
40
|
+
/* CSS Grid with modern features */
|
|
41
|
+
display: grid;
|
|
42
|
+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
|
43
|
+
gap: clamp(1rem, 3vw, 2rem);
|
|
44
|
+
|
|
45
|
+
/* Logical properties */
|
|
46
|
+
padding-inline: max(2rem, 5vw);
|
|
47
|
+
margin-block: 1rem;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Container query rules */
|
|
51
|
+
@container main-container (min-width: 768px) {
|
|
52
|
+
.vanilla-app {
|
|
53
|
+
grid-template-columns: repeat(2, 1fr);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.container-test {
|
|
57
|
+
grid-column: span 2;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@container main-container (min-width: 1200px) {
|
|
62
|
+
.vanilla-app {
|
|
63
|
+
grid-template-columns: repeat(3, 1fr);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.grid-container {
|
|
67
|
+
grid-column: span 3;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* Modern CSS selectors */
|
|
72
|
+
.vanilla-app:has(dialog[open]) {
|
|
73
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
74
|
+
backdrop-filter: blur(15px) brightness(0.8);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.vanilla-app:has(.details-section[open]) {
|
|
78
|
+
border-left: 4px solid var(--accent-color);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* CSS Nesting */
|
|
82
|
+
.button-group {
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-wrap: wrap;
|
|
85
|
+
gap: 1rem;
|
|
86
|
+
|
|
87
|
+
button {
|
|
88
|
+
background: var(--gradient-bg);
|
|
89
|
+
color: white;
|
|
90
|
+
border: none;
|
|
91
|
+
padding: 0.75rem 1.5rem;
|
|
92
|
+
border-radius: 8px;
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
font-weight: 500;
|
|
95
|
+
transition: all 0.3s ease;
|
|
96
|
+
|
|
97
|
+
&:hover {
|
|
98
|
+
transform: translateY(-2px) scale(1.02);
|
|
99
|
+
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&:focus-visible {
|
|
103
|
+
outline: 2px solid var(--primary-color);
|
|
104
|
+
outline-offset: 2px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&:active {
|
|
108
|
+
transform: translateY(0) scale(0.98);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* Modern pseudo-classes */
|
|
114
|
+
.vanilla-app *:is(h1, h2, h3) {
|
|
115
|
+
color: var(--primary-color);
|
|
116
|
+
font-weight: 600;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.vanilla-app *:where(p, li) {
|
|
120
|
+
color: #333;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* Container for container query testing */
|
|
124
|
+
.container-test {
|
|
125
|
+
container-type: inline-size;
|
|
126
|
+
container-name: test-container;
|
|
127
|
+
background: linear-gradient(45deg, var(--primary-color), transparent);
|
|
128
|
+
padding: 2rem;
|
|
129
|
+
border-radius: 12px;
|
|
130
|
+
|
|
131
|
+
/* Modern CSS units and functions */
|
|
132
|
+
width: min(100%, 600px);
|
|
133
|
+
height: max(200px, 20vh);
|
|
134
|
+
|
|
135
|
+
.nested-container {
|
|
136
|
+
background: rgba(255, 255, 255, 0.8);
|
|
137
|
+
padding: 1rem;
|
|
138
|
+
border-radius: 8px;
|
|
139
|
+
margin-top: 1rem;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@container test-container (min-width: 400px) {
|
|
144
|
+
.container-test {
|
|
145
|
+
display: grid;
|
|
146
|
+
grid-template-columns: 1fr 1fr;
|
|
147
|
+
gap: 1rem;
|
|
148
|
+
|
|
149
|
+
h3 {
|
|
150
|
+
grid-column: span 2;
|
|
151
|
+
text-align: center;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/* CSS Grid with modern features */
|
|
157
|
+
.grid-container {
|
|
158
|
+
display: grid;
|
|
159
|
+
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
|
160
|
+
gap: 1rem;
|
|
161
|
+
padding: 1rem;
|
|
162
|
+
background: color-mix(in srgb, var(--secondary-color) 20%, white);
|
|
163
|
+
border-radius: 8px;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.grid-item {
|
|
167
|
+
background: var(--gradient-bg);
|
|
168
|
+
color: white;
|
|
169
|
+
padding: 2rem 1rem;
|
|
170
|
+
text-align: center;
|
|
171
|
+
border-radius: 6px;
|
|
172
|
+
|
|
173
|
+
/* Modern CSS transforms and animations */
|
|
174
|
+
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
|
175
|
+
|
|
176
|
+
&:hover {
|
|
177
|
+
transform: rotate(2deg) scale(1.05);
|
|
178
|
+
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* Dialog styling with modern CSS */
|
|
183
|
+
dialog {
|
|
184
|
+
border: none;
|
|
185
|
+
border-radius: 16px;
|
|
186
|
+
padding: 0;
|
|
187
|
+
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
|
|
188
|
+
backdrop-filter: blur(10px);
|
|
189
|
+
|
|
190
|
+
&::backdrop {
|
|
191
|
+
background: color-mix(in srgb, black 60%, transparent);
|
|
192
|
+
backdrop-filter: blur(5px);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.dialog-content {
|
|
197
|
+
padding: 2rem;
|
|
198
|
+
background: linear-gradient(135deg, white, #f8f9fa);
|
|
199
|
+
border-radius: 16px;
|
|
200
|
+
min-width: 300px;
|
|
201
|
+
|
|
202
|
+
h2 {
|
|
203
|
+
margin-top: 0;
|
|
204
|
+
color: var(--primary-color);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
form {
|
|
208
|
+
display: flex;
|
|
209
|
+
gap: 1rem;
|
|
210
|
+
justify-content: flex-end;
|
|
211
|
+
margin-top: 2rem;
|
|
212
|
+
|
|
213
|
+
button {
|
|
214
|
+
padding: 0.5rem 1rem;
|
|
215
|
+
border: 1px solid #ddd;
|
|
216
|
+
border-radius: 4px;
|
|
217
|
+
cursor: pointer;
|
|
218
|
+
|
|
219
|
+
&[value="confirm"] {
|
|
220
|
+
background: var(--primary-color);
|
|
221
|
+
color: white;
|
|
222
|
+
border-color: var(--primary-color);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
&:hover {
|
|
226
|
+
opacity: 0.9;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/* Details/Summary styling */
|
|
233
|
+
.details-section {
|
|
234
|
+
background: rgba(255, 255, 255, 0.9);
|
|
235
|
+
border-radius: 8px;
|
|
236
|
+
padding: 1rem;
|
|
237
|
+
|
|
238
|
+
summary {
|
|
239
|
+
cursor: pointer;
|
|
240
|
+
font-weight: 600;
|
|
241
|
+
color: var(--primary-color);
|
|
242
|
+
padding: 0.5rem;
|
|
243
|
+
border-radius: 4px;
|
|
244
|
+
|
|
245
|
+
&:hover {
|
|
246
|
+
background: rgba(0, 0, 0, 0.05);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
&[open] summary {
|
|
251
|
+
margin-bottom: 1rem;
|
|
252
|
+
border-bottom: 1px solid #eee;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/* Canvas styling */
|
|
257
|
+
canvas {
|
|
258
|
+
border: 2px solid var(--primary-color);
|
|
259
|
+
border-radius: 8px;
|
|
260
|
+
background: white;
|
|
261
|
+
width: 100%;
|
|
262
|
+
height: auto;
|
|
263
|
+
|
|
264
|
+
&:hover {
|
|
265
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/* Modern input styling */
|
|
270
|
+
.modern-inputs {
|
|
271
|
+
background: rgba(255, 255, 255, 0.9);
|
|
272
|
+
padding: 1.5rem;
|
|
273
|
+
border-radius: 8px;
|
|
274
|
+
|
|
275
|
+
input {
|
|
276
|
+
display: block;
|
|
277
|
+
width: 100%;
|
|
278
|
+
margin: 0.5rem 0;
|
|
279
|
+
padding: 0.5rem;
|
|
280
|
+
border: 1px solid #ddd;
|
|
281
|
+
border-radius: 4px;
|
|
282
|
+
|
|
283
|
+
&:focus-visible {
|
|
284
|
+
outline: 2px solid var(--primary-color);
|
|
285
|
+
outline-offset: 1px;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/* Loading test styling */
|
|
291
|
+
.loading-test {
|
|
292
|
+
text-align: center;
|
|
293
|
+
|
|
294
|
+
img {
|
|
295
|
+
border-radius: 8px;
|
|
296
|
+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
|
|
297
|
+
max-width: 100%;
|
|
298
|
+
height: auto;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/* CSS @supports for progressive enhancement */
|
|
303
|
+
@supports (container-type: inline-size) {
|
|
304
|
+
.vanilla-app {
|
|
305
|
+
border: 3px solid var(--accent-color);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
@supports (backdrop-filter: blur(10px)) {
|
|
310
|
+
.vanilla-app {
|
|
311
|
+
background: rgba(255, 255, 255, 0.8);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
@supports (color-mix(in srgb, red, blue)) {
|
|
316
|
+
.grid-item {
|
|
317
|
+
background: color-mix(in srgb, var(--primary-color) 80%, white);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/* Modern CSS animations */
|
|
322
|
+
@keyframes fadeInUp {
|
|
323
|
+
from {
|
|
324
|
+
opacity: 0;
|
|
325
|
+
transform: translateY(20px);
|
|
326
|
+
}
|
|
327
|
+
to {
|
|
328
|
+
opacity: 1;
|
|
329
|
+
transform: translateY(0);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.vanilla-app > * {
|
|
334
|
+
animation: fadeInUp 0.6s ease-out;
|
|
335
|
+
animation-fill-mode: both;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.vanilla-app > *:nth-child(1) { animation-delay: 0.1s; }
|
|
339
|
+
.vanilla-app > *:nth-child(2) { animation-delay: 0.2s; }
|
|
340
|
+
.vanilla-app > *:nth-child(3) { animation-delay: 0.3s; }
|
|
341
|
+
.vanilla-app > *:nth-child(4) { animation-delay: 0.4s; }
|
|
342
|
+
|
|
343
|
+
/* CSS scroll-behavior */
|
|
344
|
+
html {
|
|
345
|
+
scroll-behavior: smooth;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/* Modern CSS for print */
|
|
349
|
+
@media print {
|
|
350
|
+
.vanilla-app {
|
|
351
|
+
background: white !important;
|
|
352
|
+
color: black !important;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.button-group,
|
|
356
|
+
canvas {
|
|
357
|
+
display: none;
|
|
358
|
+
}
|
|
359
|
+
}
|