@yolean/evidence 0.0.0-stage → 40.2.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.
Files changed (41) hide show
  1. package/LICENSE +21 -0
  2. package/cli.js +436 -0
  3. package/package.json +66 -3
  4. package/template/README.md +11 -0
  5. package/template/postcss.config.cjs +15 -0
  6. package/template/src/app.css +327 -0
  7. package/template/src/app.html +96 -0
  8. package/template/src/fix-tprotocol-service-worker.js +36 -0
  9. package/template/src/global.d.ts +1 -0
  10. package/template/src/hooks.client.js +19 -0
  11. package/template/src/hooks.server.js +41 -0
  12. package/template/src/pages/+error.svelte +57 -0
  13. package/template/src/pages/+layout.js +187 -0
  14. package/template/src/pages/+layout.svelte +10 -0
  15. package/template/src/pages/+page.md +16 -0
  16. package/template/src/pages/api/[...route]/evidencemeta.json/+server.js +48 -0
  17. package/template/src/pages/api/[route_hash]/[additional_hash]/all-queries.json/+server.js +10 -0
  18. package/template/src/pages/api/customFormattingSettings.json/+server.js +82 -0
  19. package/template/src/pages/api/customFormattingSettings.json/GET.json/+server.js +6 -0
  20. package/template/src/pages/api/pagesManifest.json/+server.js +92 -0
  21. package/template/src/pages/api/pagesManifest.json/buildPageManifest.spec.js +274 -0
  22. package/template/src/pages/api/prerendered_queries/[query_hash].arrow/+server.js +10 -0
  23. package/template/src/pages/api/settings.json/+server.js +107 -0
  24. package/template/src/pages/explore/+layout.js +5 -0
  25. package/template/src/pages/explore/console/+page.svelte +5 -0
  26. package/template/src/pages/explore/schema/+page.svelte +13 -0
  27. package/template/src/pages/fix-tprotocol-service-worker.js/+server.js +20 -0
  28. package/template/src/pages/manifest.webmanifest/+server.js +21 -0
  29. package/template/src/pages/settings/+layout.server.js +1 -0
  30. package/template/src/pages/settings/+page.js +25 -0
  31. package/template/src/pages/settings/+page.server.js +110 -0
  32. package/template/src/pages/settings/+page.svelte +111 -0
  33. package/template/static/apple-touch-icon.png +0 -0
  34. package/template/static/favicon.ico +0 -0
  35. package/template/static/icon-192.png +0 -0
  36. package/template/static/icon-512.png +0 -0
  37. package/template/static/icon.svg +6 -0
  38. package/template/svelte.config.js +106 -0
  39. package/template/tailwind.config.cjs +48 -0
  40. package/template/vite.config.js +99 -0
  41. package/README.md +0 -3
@@ -0,0 +1,327 @@
1
+ /* Write your global styles here, in PostCSS syntax */
2
+ @tailwind base;
3
+ @tailwind components;
4
+ @tailwind utilities;
5
+
6
+ @layer base {
7
+ html {
8
+ @apply scroll-smooth;
9
+ }
10
+
11
+ body {
12
+ @apply select-none;
13
+ }
14
+
15
+ /* Default border color */
16
+ * {
17
+ @apply border-base-300;
18
+ }
19
+
20
+ /* osx style scrollbars */
21
+ .pretty-scrollbar {
22
+ scrollbar-width: thin;
23
+ scrollbar-color: theme('colors.base-300') transparent;
24
+ }
25
+
26
+ .pretty-scrollbar::-webkit-scrollbar {
27
+ height: 6px;
28
+ width: 6px;
29
+ }
30
+
31
+ .pretty-scrollbar::-webkit-scrollbar-track {
32
+ background-color: transparent;
33
+ }
34
+
35
+ .pretty-scrollbar::-webkit-scrollbar-thumb {
36
+ background-color: transparent;
37
+ border-radius: 7px;
38
+ }
39
+
40
+ .pretty-scrollbar:hover::-webkit-scrollbar-thumb {
41
+ background-color: theme('colors.base-200');
42
+ }
43
+
44
+ /* hidden scrollbar */
45
+ .no-scrollbar::-webkit-scrollbar {
46
+ display: none;
47
+ }
48
+ .no-scrollbar {
49
+ -ms-overflow-style: none;
50
+ scrollbar-width: none;
51
+ }
52
+
53
+ /* remove user agent styles for select */
54
+ select {
55
+ appearance: none;
56
+ -moz-appearance: none;
57
+ -webkit-appearance: none;
58
+ }
59
+ }
60
+
61
+ @layer components {
62
+ .markdown {
63
+ @apply leading-normal font-sans text-base antialiased;
64
+ }
65
+
66
+ img.markdown {
67
+ @apply mx-auto h-auto max-w-full rounded-lg;
68
+ }
69
+
70
+ article.markdown a.markdown {
71
+ @apply text-primary underline decoration-transparent hover:decoration-primary transition-all duration-200 !important;
72
+ }
73
+
74
+ p.markdown,
75
+ ul.markdown,
76
+ ol.markdown {
77
+ margin-block-end: 1.2em;
78
+ margin-block-start: 0em;
79
+ }
80
+
81
+ /* lists */
82
+
83
+ ol.markdown {
84
+ @apply list-decimal ps-6;
85
+ }
86
+ ul.markdown {
87
+ @apply list-disc ps-6;
88
+ }
89
+
90
+ /* 1st level list */
91
+ ul.markdown,
92
+ ol.markdown {
93
+ /* 2nd level unordered list */
94
+ & ul.markdown {
95
+ @apply list-circle;
96
+ }
97
+ /* 2nd level ordered list */
98
+ & ol.markdown {
99
+ @apply list-lower-alpha;
100
+ }
101
+
102
+ /* any 2nd level list */
103
+ & ul.markdown,
104
+ & ol.markdown {
105
+ @apply mt-1;
106
+ margin-block-end: 0em;
107
+
108
+ /* 3rd level unordered list */
109
+ & ul.markdown {
110
+ @apply list-square;
111
+ }
112
+ /* 3rd level ordered list */
113
+ & ol.markdown {
114
+ @apply list-lower-roman;
115
+ }
116
+ }
117
+
118
+ li.markdown {
119
+ @apply list-item;
120
+ text-align: -webkit-match-parent;
121
+
122
+ & + li.markdown {
123
+ @apply mt-1;
124
+ }
125
+ }
126
+ }
127
+
128
+ h1.markdown,
129
+ h2.markdown,
130
+ h3.markdown,
131
+ h4.markdown,
132
+ h5.markdown,
133
+ h6.markdown {
134
+ @apply scroll-mt-14 break-inside-avoid font-sans text-base-heading;
135
+ /* ensure that table of contents links scroll with room for the header */
136
+ }
137
+
138
+ h1.title:first-of-type,
139
+ h1.markdown:first-of-type {
140
+ @apply mt-1 mb-2;
141
+ }
142
+
143
+ h1.title {
144
+ @apply mt-5 mb-1 text-2xl tracking-wide font-bold break-inside-avoid;
145
+ }
146
+
147
+ h1.markdown {
148
+ @apply mt-5 mb-1 text-2xl tracking-wide font-bold break-inside-avoid;
149
+ }
150
+
151
+ h2.markdown {
152
+ @apply mt-3 mb-1 text-xl font-semibold;
153
+ }
154
+
155
+ h3.markdown {
156
+ @apply mt-2 mb-1 font-semibold text-base;
157
+ }
158
+
159
+ h4.markdown {
160
+ @apply mt-1 text-sm font-semibold;
161
+ }
162
+
163
+ h5.markdown {
164
+ @apply mt-1 text-xs font-semibold;
165
+ }
166
+
167
+ h6.markdown {
168
+ @apply mt-1 text-xs;
169
+ }
170
+
171
+ hr.markdown {
172
+ @apply h-px my-8 max-w-xl mx-auto bg-base-300 border-0;
173
+ }
174
+
175
+ code.markdown {
176
+ @apply font-mono text-[0.875em] bg-base-200 border border-base-300 rounded px-1 select-all py-0.5;
177
+ }
178
+
179
+ form code {
180
+ font-size: unset;
181
+ }
182
+
183
+ blockquote.markdown {
184
+ @apply bg-base-200 border-l-4 border-base-content-muted pl-3 my-8 py-2;
185
+ }
186
+
187
+ blockquote.markdown > blockquote.markdown {
188
+ @apply m-0;
189
+ }
190
+
191
+ blockquote.markdown > :first-child {
192
+ @apply mt-0;
193
+ }
194
+
195
+ blockquote.markdown > :last-child {
196
+ @apply mb-0;
197
+ }
198
+
199
+ blockquote.markdown * {
200
+ @apply text-base-content-muted;
201
+ }
202
+ /* Ensure size and color are maintained for bold, italic, strikethrough */
203
+ strong.markdown {
204
+ @apply text-[1em] text-inherit;
205
+ }
206
+
207
+ em.markdown {
208
+ @apply text-[1em] text-inherit;
209
+ }
210
+
211
+ del.markdown {
212
+ @apply text-[1em] text-inherit;
213
+ }
214
+
215
+ a.markdown {
216
+ @apply text-[1em] text-inherit;
217
+ }
218
+
219
+ table.markdown {
220
+ @apply min-w-full border-collapse text-center mx-auto my-5;
221
+ }
222
+
223
+ th.markdown {
224
+ @apply text-sm font-medium border-b border-gray-800 py-0 px-2 text-ellipsis overflow-hidden;
225
+ }
226
+
227
+ td.markdown {
228
+ @apply text-sm py-1 px-2 overflow-hidden text-ellipsis;
229
+ }
230
+ }
231
+
232
+ :root {
233
+ /* Layout header height */
234
+ --header-height: 3.5rem;
235
+ /* Font stacks */
236
+ --monospace-font-family: theme(fontFamily.mono);
237
+ --ui-font-family: theme(fontFamily.sans);
238
+ --ui-font-family-compact: theme(fontFamily.sans);
239
+
240
+ /*
241
+ !! DEPRECATED !!
242
+ Kept for backwards compatibility with users projects
243
+ */
244
+ --blue-50: #eff6ff;
245
+ --blue-100: #dbeafe;
246
+ --blue-200: #bfdbfe;
247
+ --blue-300: #93c5fd;
248
+ --blue-400: #60a5fa;
249
+ --blue-500: #3b82f6;
250
+ --blue-600: #2563eb;
251
+ --blue-700: #1d4ed8;
252
+ --blue-800: #1e40af;
253
+ --blue-900: #1e3a8a;
254
+ --blue-999: #172554;
255
+ --blue-link: var(--blue-700);
256
+
257
+ --green-50: #f0fdf4;
258
+ --green-100: #dcfce7;
259
+ --green-200: #bbf7d0;
260
+ --green-300: #86efac;
261
+ --green-400: #4ade80;
262
+ --green-500: #22c55e;
263
+ --green-600: #16a34a;
264
+ --green-700: #15803d;
265
+ --green-800: #166534;
266
+ --green-900: #14532d;
267
+ --green-999: #052e16;
268
+
269
+ --grey-50: #f9fafb;
270
+ --grey-100: #f3f4f6;
271
+ --grey-200: #e5e7eb;
272
+ --grey-300: #d1d5db;
273
+ --grey-400: #9ca3af;
274
+ --grey-500: #6b7280;
275
+ --grey-600: #4b5563;
276
+ --grey-700: #374151;
277
+ --grey-800: #1f2937;
278
+ --grey-900: #111827;
279
+ --grey-999: #030712;
280
+
281
+ --red-50: #fef2f2;
282
+ --red-100: #fee2e2;
283
+ --red-200: #fecaca;
284
+ --red-300: #fca5a5;
285
+ --red-400: #f87171;
286
+ --red-500: #ef4444;
287
+ --red-600: #dc2626;
288
+ --red-700: #b91c1c;
289
+ --red-800: #991b1b;
290
+ --red-900: #7f1d1d;
291
+ --red-999: #450a0a;
292
+
293
+ --yellow-50: #fefce8;
294
+ --yellow-100: #fef9c3;
295
+ --yellow-200: #fef08a;
296
+ --yellow-300: #fde047;
297
+ --yellow-400: #facc15;
298
+ --yellow-500: #eab308;
299
+ --yellow-600: #ca8a04;
300
+ --yellow-700: #a16207;
301
+ --yellow-800: #854d0e;
302
+ --yellow-900: #713f12;
303
+ --yellow-999: #422006;
304
+ }
305
+
306
+ [data-theme='dark'] .__evidence-leaflet-tile-layer__ {
307
+ filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
308
+ }
309
+
310
+ @media print {
311
+ html {
312
+ -webkit-print-color-adjust: exact;
313
+ print-color-adjust: exact;
314
+ }
315
+
316
+ h1,
317
+ h2,
318
+ h3,
319
+ h4 {
320
+ break-after: avoid-page;
321
+ }
322
+
323
+ article {
324
+ orphans: 2;
325
+ widows: 2;
326
+ }
327
+ }
@@ -0,0 +1,96 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link rel="icon" href="%sveltekit.assets%/favicon.ico" sizes="32x32" />
6
+ <link rel="icon" href="%sveltekit.assets%/icon.svg" type="image/svg+xml" />
7
+ <link rel="apple-touch-icon" href="%sveltekit.assets%/apple-touch-icon.png" />
8
+ <link rel="manifest" href="%sveltekit.assets%/manifest.webmanifest" />
9
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
10
+ <script>
11
+ try {
12
+ /** @type {'light' | 'dark' | 'system'} */
13
+ const savedTheme = localStorage.getItem('evidence-theme') ?? 'system';
14
+ const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
15
+ const theme = savedTheme === 'system' ? (prefersDark ? 'dark' : 'light') : savedTheme;
16
+ document.documentElement.setAttribute('data-theme', theme);
17
+ } catch (e) {}
18
+ </script>
19
+ %sveltekit.head%
20
+ </head>
21
+ <body>
22
+ <script>
23
+ /*loading*/
24
+ </script>
25
+ <div>
26
+ <!-- SvelteKit Hydrated Content -->
27
+ %sveltekit.body%
28
+
29
+ <!-- SplashScreen -->
30
+ <div
31
+ aria-disabled
32
+ id="__evidence_project_splash"
33
+ data-test-id="__evidence_project_splash"
34
+ style="visibility: hidden"
35
+ >
36
+ <svg width="100" height="100" viewBox="-8 -8 588 588" xmlns="http://www.w3.org/2000/svg">
37
+ <path
38
+ d="M7.19462e-05 74.3583C109.309 74.3583 195.795 86.2578 286.834 37.825C377.872 -10.6077 466.416 1.29174 573.667 1.29175L573.667 126.549C466.416 126.549 377.373 114.91 286.834 163.082C196.294 211.254 109.309 199.615 6.11417e-05 199.615L7.19462e-05 74.3583Z"
39
+ class="draw-path"
40
+ />
41
+ <path
42
+ d="M573.669 499.31C464.36 499.31 377.874 487.411 286.835 535.843C195.797 584.276 107.252 572.377 0.0014801 572.377V447.12C107.252 447.12 196.295 458.758 286.835 410.586C377.375 362.415 464.36 374.053 573.669 374.053V499.31Z"
43
+ class="draw-path"
44
+ />
45
+ <path
46
+ d="M452.896 186.499C395.028 187.686 341.581 194.947 286.835 224.074C211.396 264.212 136.995 262.826 52.2355 261.247C35.2696 260.931 17.8887 260.608 0.0014801 260.608V385.865C18.1032 385.865 35.6721 386.204 52.81 386.534C137.212 388.162 211.162 389.589 286.835 349.331C341.838 320.07 395.18 312.831 452.896 311.685V186.499Z"
47
+ class="draw-path"
48
+ />
49
+ </svg>
50
+ </div>
51
+ </div>
52
+ </body>
53
+ </html>
54
+
55
+ <style>
56
+ #__evidence_project_splash {
57
+ position: fixed;
58
+ top: 0;
59
+ left: 0;
60
+ width: 100vw;
61
+ height: 100vh;
62
+ background-color: #ffffff;
63
+ display: flex;
64
+ justify-content: center;
65
+ align-items: center;
66
+ z-index: 9999;
67
+ }
68
+
69
+ [data-theme='dark'] #__evidence_project_splash {
70
+ background-color: #000000;
71
+ }
72
+
73
+ .draw-path {
74
+ fill: #000000;
75
+ animation: blinking-logo 2s;
76
+ animation-fill-mode: both;
77
+ animation-iteration-count: infinite;
78
+ animation-timing-function: ease-in-out;
79
+ }
80
+
81
+ [data-theme='dark'] .draw-path {
82
+ fill: #ffffff;
83
+ }
84
+
85
+ @keyframes blinking-logo {
86
+ 0% {
87
+ fill-opacity: 1;
88
+ }
89
+ 50% {
90
+ fill-opacity: 0.2;
91
+ }
92
+ 100% {
93
+ fill-opacity: 1;
94
+ }
95
+ }
96
+ </style>
@@ -0,0 +1,36 @@
1
+ /** This ServiceWorker adds Cache-Control=no-cache to requests loading a .parquet file on a Windows machine to prevent TProtocolException within duckdb-wasm */
2
+
3
+ // @ts-check
4
+ /// <reference types="@sveltejs/kit" />
5
+ /// <reference no-default-lib="true"/>
6
+ /// <reference lib="webworker" />
7
+
8
+ const sw = /** @type {ServiceWorkerGlobalScope} */ (/** @type {unknown} */ (self));
9
+
10
+ // The following line is replaced when disabling the service worker using VITE_EVIDENCE_DISABLE_WINDOWS_CACHE_SERVICE_WORKER
11
+ const disabled = false;
12
+
13
+ sw.addEventListener('activate', () => {
14
+ if (disabled) {
15
+ console.debug(
16
+ 'Detected VITE_EVIDENCE_DISABLE_WINDOWS_CACHE_SERVICE_WORKER. Service Worker disabled.'
17
+ );
18
+ }
19
+ });
20
+
21
+ sw.addEventListener('fetch', (event) => {
22
+ if (disabled) return;
23
+ if (!event.request.url.endsWith('.parquet')) return;
24
+
25
+ const userAgent = event.request.headers.get('User-Agent');
26
+ const isWindows = userAgent?.includes('Windows');
27
+ if (!isWindows) return;
28
+
29
+ const headers = new Headers(event.request.headers);
30
+ headers.set('Cache-Control', 'no-cache');
31
+ headers.set('X-Evidence-Windows-Cache-Disable', 'true');
32
+
33
+ const newRequest = new Request(event.request.url, { headers });
34
+
35
+ event.respondWith(fetch(newRequest));
36
+ });
@@ -0,0 +1 @@
1
+ /// <reference types="@sveltejs/kit" />
@@ -0,0 +1,19 @@
1
+ /** @param {Error | unknown} e */
2
+ const transformError = (e) => {
3
+ if (!(e instanceof Error)) {
4
+ return JSON.parse(JSON.stringify(e));
5
+ } else {
6
+ return {
7
+ message: e.message,
8
+ stack: e.stack,
9
+ name: e.name,
10
+ cause: e.cause ? transformError(e.cause) : undefined
11
+ };
12
+ }
13
+ };
14
+
15
+ /** @type {import("@sveltejs/kit").HandleClientError } */
16
+ export const handleError = (e) => {
17
+ console.error(`Error in client-side routing`, e);
18
+ return transformError(e.error);
19
+ };
@@ -0,0 +1,41 @@
1
+ import { dev } from '$app/environment';
2
+ import { log } from '@evidence-dev/sdk/logger';
3
+
4
+ /** @param {Error | unknown} e */
5
+ const transformError = (e) => {
6
+ if (!(e instanceof Error)) {
7
+ return JSON.parse(JSON.stringify(e));
8
+ } else {
9
+ return {
10
+ message: e.message,
11
+ stack: e.stack,
12
+ name: e.name,
13
+ cause: e.cause ? transformError(e.cause) : undefined
14
+ };
15
+ }
16
+ };
17
+
18
+ /** @type {import("@sveltejs/kit").HandleClientError } */
19
+ export const handleError = (e) => {
20
+ log.error(`${e.message} | ${e.event.route.id ?? ''}`, {
21
+ url: e.event.url.href,
22
+ status: e.status
23
+ });
24
+ log.debug(e);
25
+ return transformError(e.error);
26
+ };
27
+
28
+ /** @type {import('@sveltejs/kit').Handle} */
29
+ export function handle({ event, resolve }) {
30
+ const loading = dev
31
+ ? `
32
+ setTimeout(() => {
33
+ const splash = document.getElementById('__evidence_project_splash');
34
+ if (splash) {
35
+ splash.style.visibility = 'visible';
36
+ }
37
+ }, 250);`
38
+ : '';
39
+
40
+ return resolve(event, { transformPageChunk: ({ html }) => html.replace('/*loading*/', loading) });
41
+ }
@@ -0,0 +1,57 @@
1
+ <script>
2
+ import { page } from '$app/stores';
3
+ import { Accordion, AccordionItem, CopyButton } from '@evidence-dev/core-components';
4
+
5
+ import { browser } from '$app/environment';
6
+
7
+ // Remove splash screen from app.html
8
+ if (browser) {
9
+ const splash = document.getElementById('__evidence_project_splash');
10
+ splash?.remove();
11
+ }
12
+
13
+ /** @param {Error | unknown} e */
14
+ const expand = (error) => {
15
+ let output = '';
16
+ if (error.stack) {
17
+ output += error.stack;
18
+ }
19
+ if (error.cause) {
20
+ output += '\n\nCaused By:\n\t';
21
+ output += expand(error.cause).split('\n').join('\n\t');
22
+ }
23
+ return output;
24
+ };
25
+
26
+ $: expanded = expand($page.error);
27
+ </script>
28
+
29
+ {#if $page.status === 404}
30
+ <h1 class="mt-0 mb-8 py-0">Page Not Found</h1>
31
+ <p>
32
+ <span class="font-mono text-base">{$page.status}</span>: The page
33
+ <span class="font-mono text-base bg-base-200">{$page.url.pathname}</span> can't be found in the project.
34
+ </p>
35
+ {:else if $page.status === 500}
36
+ <h1 class="mt-0 mb-8 py-0">Application Error</h1>
37
+
38
+ {#if $page.error.message}
39
+ <p class="font-mono text-sm bg-base-200 px-2 py-2">
40
+ <span class="font-mono text-base">{$page.status}</span>:{$page.error.message}
41
+ </p>{/if}
42
+ {#if $page.error.stack || $page.error.cause}
43
+ <Accordion>
44
+ <AccordionItem title="Error Details">
45
+ <div class="relative">
46
+ <span class="absolute top-2 right-2">
47
+ <CopyButton textToCopy={expanded} />
48
+ </span>
49
+ <pre class="font-mono text-sm bg-base-200 px-2 py-2 overflow-auto">{expanded}</pre>
50
+ </div>
51
+ </AccordionItem>
52
+ </Accordion>
53
+ {/if}
54
+ {:else}
55
+ <h1>Unknown Error Encountered</h1>
56
+ <span class="font-mono text-base">HTTP {$page.status}</span>
57
+ {/if}