sv-arcgis 1.1.0-next.4 → 1.3.0-next.1
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/README.md +1 -2
- package/bin/sv-arcgis-setup.js +381 -172
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
- SvelteKit installed (`npx sv create [project_name]`)
|
|
4
4
|
|
|
5
5
|
## 🗜️ Setup
|
|
6
|
-
|
|
7
|
-
1. Install sv-arcgis `npm i sv-arcgis`
|
|
6
|
+
1. Install [sv-arcgis](https://www.npmjs.com/package/sv-arcgis) `npm i sv-arcgis`
|
|
8
7
|
2. Run sv-arcgis `npx sv-arcgis`
|
|
9
8
|
3. ⚠️ Follow instructions in terminal
|
|
10
9
|
|
package/bin/sv-arcgis-setup.js
CHANGED
|
@@ -71,10 +71,11 @@ const onCancel = () => {
|
|
|
71
71
|
|
|
72
72
|
async function generateConfig() {
|
|
73
73
|
|
|
74
|
-
// Check if SvelteKit is installed
|
|
74
|
+
// Check if Svelte/SvelteKit is installed
|
|
75
|
+
const isSvelte = fs.existsSync(path.join(process.cwd(), 'src/App.svelte'));
|
|
75
76
|
const isSvelteKit = fs.existsSync(path.join(process.cwd(), 'src/routes/+page.svelte'));
|
|
76
|
-
if (!isSvelteKit) {
|
|
77
|
-
console.log("🛑 This doesn\'t seem like a SvelteKit project.");
|
|
77
|
+
if (!isSvelte && !isSvelteKit) {
|
|
78
|
+
console.log("🛑 This doesn\'t seem like a Svelte/SvelteKit project.");
|
|
78
79
|
console.log("🛑 Have you ran 'npx sv create ./' yet?");
|
|
79
80
|
process.exit(1);
|
|
80
81
|
}
|
|
@@ -216,7 +217,7 @@ const arcGisApiKey = await prompts([
|
|
|
216
217
|
{
|
|
217
218
|
type: 'text',
|
|
218
219
|
name: 'ARC_GIS_API_KEY',
|
|
219
|
-
message: 'Enter your ArcGIS API key
|
|
220
|
+
message: 'Enter your ArcGIS API key',
|
|
220
221
|
validate: value => {
|
|
221
222
|
global.arcGisApiKeyIsNull = value.length === 0;
|
|
222
223
|
return true;
|
|
@@ -229,7 +230,7 @@ const arcGisClientId = await prompts([
|
|
|
229
230
|
{
|
|
230
231
|
type: 'text',
|
|
231
232
|
name: 'ARC_GIS_CLIENT_ID',
|
|
232
|
-
message: 'Enter your ArcGIS Client ID
|
|
233
|
+
message: 'Enter your ArcGIS Client ID',
|
|
233
234
|
validate: value => {
|
|
234
235
|
global.arcGisClientIdIsNull = value.length === 0;
|
|
235
236
|
return true;
|
|
@@ -242,7 +243,7 @@ const arcGisClientSecret = await prompts([
|
|
|
242
243
|
{
|
|
243
244
|
type: 'text',
|
|
244
245
|
name: 'ARC_GIS_CLIENT_SECRET',
|
|
245
|
-
message: 'Enter your ArcGIS Client Secret
|
|
246
|
+
message: 'Enter your ArcGIS Client Secret',
|
|
246
247
|
validate: value => {
|
|
247
248
|
global.arcGisClientSecretIsNull = value.length === 0;
|
|
248
249
|
return true;
|
|
@@ -332,7 +333,7 @@ if (calcite.CALCITE === true) {
|
|
|
332
333
|
console.log("📦 Installing ArcGIS Core, Map Components, and Calcite Components...");
|
|
333
334
|
initPromises.push(
|
|
334
335
|
new Promise((resolve, reject) => {
|
|
335
|
-
exec(\`\${packageManager} install @arcgis/core@4.
|
|
336
|
+
exec(\`\${packageManager} install @arcgis/core@4.33.12 @arcgis/map-components@4.33.12 @esri/calcite-components@2.13.0\`, (error, stdout, stderr) => {
|
|
336
337
|
if (error) {
|
|
337
338
|
console.log('error:', chalk.white.bgRed(error.message));
|
|
338
339
|
reject(error);
|
|
@@ -346,7 +347,7 @@ if (calcite.CALCITE === true) {
|
|
|
346
347
|
console.log("📦 Installing ArcGIS Core and Map Components...");
|
|
347
348
|
initPromises.push(
|
|
348
349
|
new Promise((resolve, reject) => {
|
|
349
|
-
exec(\`\${packageManager} install @arcgis/core@4.
|
|
350
|
+
exec(\`\${packageManager} install @arcgis/core@4.33.12 @arcgis/map-components@4.33.12\`, (error, stdout, stderr) => {
|
|
350
351
|
if (error) {
|
|
351
352
|
console.log('error:', chalk.white.bgRed(error.message));
|
|
352
353
|
reject(error);
|
|
@@ -372,202 +373,394 @@ if (initPromises.length > 0) {
|
|
|
372
373
|
|
|
373
374
|
// Add demo page?
|
|
374
375
|
if (demo.DEMO === true) {
|
|
375
|
-
|
|
376
|
-
|
|
376
|
+
let arcgisRouteDir;
|
|
377
|
+
if (isSvelte) {
|
|
378
|
+
// console.log("📦 Svelte DEMO...");
|
|
379
|
+
// Create directory called 'arcgis' in './src/'
|
|
380
|
+
|
|
381
|
+
arcgisRouteDir = path.join(process.cwd(), 'src', 'lib');
|
|
382
|
+
} else if (isSvelteKit) {
|
|
383
|
+
console.log("📦 SvelteKit DEMO...");
|
|
384
|
+
// Create directory called 'arcgis' in './src/routes/'
|
|
385
|
+
|
|
386
|
+
arcgisRouteDir = path.join(process.cwd(), 'src', 'routes', 'arcgis');
|
|
387
|
+
}
|
|
388
|
+
|
|
377
389
|
if (!fs.existsSync(arcgisRouteDir)) {
|
|
378
390
|
fs.mkdirSync(arcgisRouteDir, { recursive: true });
|
|
379
391
|
}
|
|
380
392
|
|
|
381
|
-
// Create a demo page within this directory
|
|
382
|
-
const demoPagePath = path.join(arcgisRouteDir, '+page.svelte');
|
|
393
|
+
// Create a demo page within this directory
|
|
394
|
+
const demoPagePath = isSvelte ? path.join(arcgisRouteDir, 'ArcGIS.svelte') : path.join(arcgisRouteDir, '+page.svelte');
|
|
395
|
+
let demoPageContent;
|
|
383
396
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
397
|
+
if (isSvelteKit) {
|
|
398
|
+
demoPageContent = \`<script lang="ts">
|
|
399
|
+
// config
|
|
400
|
+
import config from "$lib/config";
|
|
401
|
+
|
|
402
|
+
// sk
|
|
403
|
+
import { onMount } from "svelte";
|
|
404
|
+
import { browser } from "$app/environment";
|
|
405
|
+
import { env } from "$env/dynamic/public";
|
|
406
|
+
|
|
407
|
+
// variables
|
|
408
|
+
let mapWrap: HTMLDivElement | null = $state(null);
|
|
409
|
+
|
|
410
|
+
onMount(() => {
|
|
411
|
+
console.log("env", env);
|
|
412
|
+
console.log("config", config);
|
|
413
|
+
console.log("mapWrap", mapWrap);
|
|
414
|
+
});
|
|
401
415
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
</div>
|
|
440
|
-
{#if config.SECURITY_CLASSIFICATION}
|
|
441
|
-
<div
|
|
442
|
-
class="e-demo-security-bar e-demo-security-bar--{config.SECURITY_CLASSIFICATION}"
|
|
443
|
-
>
|
|
444
|
-
Security Classification: {config.SECURITY_CLASSIFICATION.toUpperCase()}
|
|
416
|
+
if (browser) {
|
|
417
|
+
import("@arcgis/map-components/dist/loader").then(
|
|
418
|
+
({ defineCustomElements }) => {
|
|
419
|
+
defineCustomElements(window, {
|
|
420
|
+
resourcesUrl: "https://js.arcgis.com/map-components/4.33.12/assets",
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
</script>
|
|
426
|
+
|
|
427
|
+
<svelte:head>
|
|
428
|
+
<title>🗺️ SV + ArcGIS Demo</title>
|
|
429
|
+
</svelte:head>
|
|
430
|
+
|
|
431
|
+
<main class="e-demo">
|
|
432
|
+
{#if config.SECURITY_CLASSIFICATION}
|
|
433
|
+
<div
|
|
434
|
+
class="e-demo-security-bar e-demo-security-bar--{config.SECURITY_CLASSIFICATION}"
|
|
435
|
+
>
|
|
436
|
+
Security Classification: {config.SECURITY_CLASSIFICATION.toUpperCase()}
|
|
437
|
+
</div>
|
|
438
|
+
{/if}
|
|
439
|
+
<div class="e-demo-container">
|
|
440
|
+
<div class="e-demo-header">
|
|
441
|
+
<h1>🗺️ SV + ArcGIS Demo</h1>
|
|
442
|
+
</div>
|
|
443
|
+
<div class="e-demo-map-wrap" bind:this={mapWrap}>
|
|
444
|
+
<arcgis-map item-id="05e015c5f0314db9a487a9b46cb37eca">
|
|
445
|
+
<arcgis-zoom position="top-left"></arcgis-zoom>
|
|
446
|
+
</arcgis-map>
|
|
447
|
+
{#if config.CALCITE}
|
|
448
|
+
<calcite-button href="/" appearance="solid" scale="m">
|
|
449
|
+
Go Home
|
|
450
|
+
</calcite-button>
|
|
451
|
+
{/if}
|
|
452
|
+
</div>
|
|
445
453
|
</div>
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
.e-demo-container {
|
|
467
|
-
display: flex;
|
|
468
|
-
flex-direction: column;
|
|
469
|
-
align-items: center;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
.e-demo-header {
|
|
473
|
-
padding: 1rem;
|
|
474
|
-
color: #f1f1f1;
|
|
454
|
+
{#if config.SECURITY_CLASSIFICATION}
|
|
455
|
+
<div
|
|
456
|
+
class="e-demo-security-bar e-demo-security-bar--{config.SECURITY_CLASSIFICATION}"
|
|
457
|
+
>
|
|
458
|
+
Security Classification: {config.SECURITY_CLASSIFICATION.toUpperCase()}
|
|
459
|
+
</div>
|
|
460
|
+
{/if}
|
|
461
|
+
</main>
|
|
462
|
+
|
|
463
|
+
<style>
|
|
464
|
+
@import "https://js.arcgis.com/4.31/@arcgis/core/assets/esri/themes/dark/main.css";\${calcite.CALCITE ? '\\n @import "@esri/calcite-components/dist/calcite/calcite.css";' : ''}
|
|
465
|
+
|
|
466
|
+
:global(body:has(.e-demo)) {
|
|
467
|
+
margin: 0;
|
|
468
|
+
padding: 0;
|
|
469
|
+
height: 100%;
|
|
470
|
+
width: 100%;
|
|
471
|
+
background: #212121;
|
|
472
|
+
}
|
|
475
473
|
|
|
476
|
-
|
|
477
|
-
|
|
474
|
+
.e-demo {
|
|
475
|
+
display: grid;
|
|
476
|
+
grid-template-rows: 24px 1fr 24px;
|
|
477
|
+
height: 100vh;
|
|
478
|
+
}
|
|
478
479
|
|
|
479
|
-
|
|
480
|
-
|
|
480
|
+
.e-demo-container {
|
|
481
|
+
display: flex;
|
|
482
|
+
flex-direction: column;
|
|
483
|
+
align-items: center;
|
|
481
484
|
}
|
|
482
|
-
}
|
|
483
485
|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
gap: 2rem;
|
|
488
|
-
width: 50vmax;
|
|
489
|
-
height: 100vh;
|
|
490
|
-
margin-inline: auto;
|
|
491
|
-
margin: 0;
|
|
492
|
-
padding: 0;
|
|
493
|
-
padding-block-end: 2rem;
|
|
494
|
-
|
|
495
|
-
& arcgis-map {
|
|
496
|
-
width: 100%;
|
|
497
|
-
height: 50vh;
|
|
486
|
+
.e-demo-header {
|
|
487
|
+
padding: 1rem;
|
|
488
|
+
color: #f1f1f1;
|
|
498
489
|
|
|
499
|
-
|
|
500
|
-
transition:
|
|
490
|
+
translate: 0 0;
|
|
491
|
+
transition: translate 1s ease-out;
|
|
501
492
|
|
|
502
493
|
@starting-style {
|
|
503
|
-
|
|
494
|
+
translate: 0 -4px;
|
|
504
495
|
}
|
|
505
496
|
}
|
|
506
497
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
498
|
+
.e-demo-map-wrap {
|
|
499
|
+
display: flex;
|
|
500
|
+
flex-direction: column;
|
|
501
|
+
gap: 2rem;
|
|
502
|
+
width: 50vmax;
|
|
503
|
+
height: 100vh;
|
|
504
|
+
margin-inline: auto;
|
|
505
|
+
margin: 0;
|
|
506
|
+
padding: 0;
|
|
507
|
+
padding-block-end: 2rem;
|
|
508
|
+
|
|
509
|
+
& arcgis-map {
|
|
510
|
+
width: 100%;
|
|
511
|
+
height: 50vh;
|
|
512
|
+
|
|
513
|
+
opacity: 1;
|
|
514
|
+
transition: opacity 2s ease-out;
|
|
515
|
+
|
|
516
|
+
@starting-style {
|
|
517
|
+
opacity: 0;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
511
520
|
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
align-items: center;
|
|
516
|
-
justify-content: center;
|
|
517
|
-
inset-block-start: 0;
|
|
518
|
-
height: 22px;
|
|
519
|
-
background-color: #000;
|
|
520
|
-
color: #fff;
|
|
521
|
-
margin: 0;
|
|
522
|
-
font-size: 14px;
|
|
523
|
-
z-index: 1;
|
|
524
|
-
|
|
525
|
-
&:not(:first-of-type) {
|
|
526
|
-
inset-block-end: 0;
|
|
521
|
+
& calcite-button {
|
|
522
|
+
align-self: center;
|
|
523
|
+
}
|
|
527
524
|
}
|
|
528
525
|
|
|
529
|
-
|
|
526
|
+
.e-demo-security-bar {
|
|
527
|
+
position: sticky;
|
|
528
|
+
display: flex;
|
|
529
|
+
align-items: center;
|
|
530
|
+
justify-content: center;
|
|
531
|
+
inset-block-start: 0;
|
|
532
|
+
height: 22px;
|
|
533
|
+
background-color: #000;
|
|
530
534
|
color: #fff;
|
|
531
|
-
|
|
535
|
+
margin: 0;
|
|
536
|
+
font-size: 14px;
|
|
537
|
+
z-index: 1;
|
|
538
|
+
|
|
539
|
+
&:not(:first-of-type) {
|
|
540
|
+
inset-block-end: 0;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
&.e-demo-security-bar--classified {
|
|
544
|
+
color: #fff;
|
|
545
|
+
background-color: #723d9a;
|
|
546
|
+
}
|
|
547
|
+
&.e-demo-security-bar--confidential {
|
|
548
|
+
color: #fff;
|
|
549
|
+
background-color: #0033a0;
|
|
550
|
+
}
|
|
551
|
+
&.e-demo-security-bar--controlled_unclassified_information {
|
|
552
|
+
color: #fff;
|
|
553
|
+
background-color: #3d1e5a;
|
|
554
|
+
}
|
|
555
|
+
&.e-demo-security-bar--secret {
|
|
556
|
+
color: #fff;
|
|
557
|
+
background-color: #c8102e;
|
|
558
|
+
}
|
|
559
|
+
&.e-demo-security-bar--top_secret {
|
|
560
|
+
color: #000;
|
|
561
|
+
background-color: #ff671f;
|
|
562
|
+
}
|
|
563
|
+
&.e-demo-security-bar--top_secret_sensitive_compartment_information {
|
|
564
|
+
color: #000;
|
|
565
|
+
background-color: #f7ea48;
|
|
566
|
+
}
|
|
567
|
+
&.e-demo-security-bar--unclassified {
|
|
568
|
+
color: #fff;
|
|
569
|
+
background-color: #007a33;
|
|
570
|
+
}
|
|
532
571
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
572
|
+
</style>
|
|
573
|
+
\`;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
if (isSvelte) {
|
|
577
|
+
demoPageContent = \`<script>
|
|
578
|
+
// config
|
|
579
|
+
import config from "./config";
|
|
580
|
+
|
|
581
|
+
// sk
|
|
582
|
+
import { onMount } from "svelte";
|
|
583
|
+
|
|
584
|
+
// variables
|
|
585
|
+
let mapWrap = $state(null);
|
|
586
|
+
|
|
587
|
+
onMount(() => {
|
|
588
|
+
console.log("config", config);
|
|
589
|
+
console.log("mapWrap", mapWrap);
|
|
590
|
+
});
|
|
591
|
+
|
|
592
|
+
import("@arcgis/map-components/dist/loader").then(
|
|
593
|
+
({ defineCustomElements }) => {
|
|
594
|
+
defineCustomElements(window, {
|
|
595
|
+
resourcesUrl: "https://js.arcgis.com/map-components/4.33.12/assets",
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
);
|
|
599
|
+
</script>
|
|
600
|
+
|
|
601
|
+
<svelte:head>
|
|
602
|
+
<title>🗺️ SV + ArcGIS Demo</title>
|
|
603
|
+
</svelte:head>
|
|
604
|
+
|
|
605
|
+
<main class="e-demo">
|
|
606
|
+
{#if config.SECURITY_CLASSIFICATION}
|
|
607
|
+
<div
|
|
608
|
+
class="e-demo-security-bar e-demo-security-bar--{config.SECURITY_CLASSIFICATION}"
|
|
609
|
+
>
|
|
610
|
+
Security Classification: {config.SECURITY_CLASSIFICATION.toUpperCase()}
|
|
611
|
+
</div>
|
|
612
|
+
{/if}
|
|
613
|
+
<div class="e-demo-container">
|
|
614
|
+
<div class="e-demo-header">
|
|
615
|
+
<h1>🗺️ SV + ArcGIS Demo</h1>
|
|
616
|
+
</div>
|
|
617
|
+
<div class="e-demo-map-wrap" bind:this={mapWrap}>
|
|
618
|
+
<arcgis-map item-id="05e015c5f0314db9a487a9b46cb37eca">
|
|
619
|
+
<arcgis-zoom position="top-left"></arcgis-zoom>
|
|
620
|
+
</arcgis-map>
|
|
621
|
+
{#if config.CALCITE}
|
|
622
|
+
<calcite-button href="/" appearance="solid" scale="m">
|
|
623
|
+
Go Home
|
|
624
|
+
</calcite-button>
|
|
625
|
+
{/if}
|
|
626
|
+
</div>
|
|
627
|
+
</div>
|
|
628
|
+
{#if config.SECURITY_CLASSIFICATION}
|
|
629
|
+
<div
|
|
630
|
+
class="e-demo-security-bar e-demo-security-bar--{config.SECURITY_CLASSIFICATION}"
|
|
631
|
+
>
|
|
632
|
+
Security Classification: {config.SECURITY_CLASSIFICATION.toUpperCase()}
|
|
633
|
+
</div>
|
|
634
|
+
{/if}
|
|
635
|
+
</main>
|
|
636
|
+
|
|
637
|
+
<style>
|
|
638
|
+
@import "https://js.arcgis.com/4.31/@arcgis/core/assets/esri/themes/dark/main.css";\${calcite.CALCITE ? '\\n @import "@esri/calcite-components/dist/calcite/calcite.css";' : ''}
|
|
639
|
+
|
|
640
|
+
:global(body:has(.e-demo)) {
|
|
641
|
+
margin: 0;
|
|
642
|
+
padding: 0;
|
|
643
|
+
height: 100%;
|
|
644
|
+
width: 100%;
|
|
645
|
+
background: #212121;
|
|
536
646
|
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
647
|
+
|
|
648
|
+
.e-demo {
|
|
649
|
+
display: grid;
|
|
650
|
+
grid-template-rows: 24px 1fr 24px;
|
|
651
|
+
height: 100vh;
|
|
540
652
|
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
653
|
+
|
|
654
|
+
.e-demo-container {
|
|
655
|
+
display: flex;
|
|
656
|
+
flex-direction: column;
|
|
657
|
+
align-items: center;
|
|
544
658
|
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
659
|
+
|
|
660
|
+
.e-demo-header {
|
|
661
|
+
padding: 1rem;
|
|
662
|
+
color: #f1f1f1;
|
|
663
|
+
|
|
664
|
+
translate: 0 0;
|
|
665
|
+
transition: translate 1s ease-out;
|
|
666
|
+
|
|
667
|
+
@starting-style {
|
|
668
|
+
translate: 0 -4px;
|
|
669
|
+
}
|
|
548
670
|
}
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
671
|
+
|
|
672
|
+
.e-demo-map-wrap {
|
|
673
|
+
display: flex;
|
|
674
|
+
flex-direction: column;
|
|
675
|
+
gap: 2rem;
|
|
676
|
+
width: 50vmax;
|
|
677
|
+
height: 100vh;
|
|
678
|
+
margin-inline: auto;
|
|
679
|
+
margin: 0;
|
|
680
|
+
padding: 0;
|
|
681
|
+
padding-block-end: 2rem;
|
|
682
|
+
|
|
683
|
+
& arcgis-map {
|
|
684
|
+
width: 100%;
|
|
685
|
+
height: 50vh;
|
|
686
|
+
|
|
687
|
+
opacity: 1;
|
|
688
|
+
transition: opacity 2s ease-out;
|
|
689
|
+
|
|
690
|
+
@starting-style {
|
|
691
|
+
opacity: 0;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
& calcite-button {
|
|
696
|
+
align-self: center;
|
|
697
|
+
}
|
|
552
698
|
}
|
|
553
|
-
|
|
699
|
+
|
|
700
|
+
.e-demo-security-bar {
|
|
701
|
+
position: sticky;
|
|
702
|
+
display: flex;
|
|
703
|
+
align-items: center;
|
|
704
|
+
justify-content: center;
|
|
705
|
+
inset-block-start: 0;
|
|
706
|
+
height: 22px;
|
|
707
|
+
background-color: #000;
|
|
554
708
|
color: #fff;
|
|
555
|
-
|
|
709
|
+
margin: 0;
|
|
710
|
+
font-size: 14px;
|
|
711
|
+
z-index: 1;
|
|
712
|
+
|
|
713
|
+
&:not(:first-of-type) {
|
|
714
|
+
inset-block-end: 0;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
&.e-demo-security-bar--classified {
|
|
718
|
+
color: #fff;
|
|
719
|
+
background-color: #723d9a;
|
|
720
|
+
}
|
|
721
|
+
&.e-demo-security-bar--confidential {
|
|
722
|
+
color: #fff;
|
|
723
|
+
background-color: #0033a0;
|
|
724
|
+
}
|
|
725
|
+
&.e-demo-security-bar--controlled_unclassified_information {
|
|
726
|
+
color: #fff;
|
|
727
|
+
background-color: #3d1e5a;
|
|
728
|
+
}
|
|
729
|
+
&.e-demo-security-bar--secret {
|
|
730
|
+
color: #fff;
|
|
731
|
+
background-color: #c8102e;
|
|
732
|
+
}
|
|
733
|
+
&.e-demo-security-bar--top_secret {
|
|
734
|
+
color: #000;
|
|
735
|
+
background-color: #ff671f;
|
|
736
|
+
}
|
|
737
|
+
&.e-demo-security-bar--top_secret_sensitive_compartment_information {
|
|
738
|
+
color: #000;
|
|
739
|
+
background-color: #f7ea48;
|
|
740
|
+
}
|
|
741
|
+
&.e-demo-security-bar--unclassified {
|
|
742
|
+
color: #fff;
|
|
743
|
+
background-color: #007a33;
|
|
744
|
+
}
|
|
556
745
|
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
746
|
+
</style>
|
|
747
|
+
\`;
|
|
748
|
+
}
|
|
560
749
|
|
|
561
750
|
fs.writeFileSync(demoPagePath, demoPageContent);
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
751
|
+
if (isSvelte) {
|
|
752
|
+
console.log(\`✅ Created demo page at ./src/routes/arcgis/ArcGIS.svelte\`);
|
|
753
|
+
} else {
|
|
754
|
+
console.log(\`✅ Created demo page at ./src/routes/arcgis/+page.svelte\`);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
// Update root page
|
|
758
|
+
const rootRouteDir = isSvelte ? path.join(process.cwd(), 'src') : path.join(process.cwd(), 'src', 'routes');
|
|
759
|
+
const rootPagePath = isSvelte ? path.join(rootRouteDir, 'App.svelte') : path.join(rootRouteDir, '+page.svelte');
|
|
760
|
+
const rootPageUpdate = isSvelte ? \`import ArcGIS from './lib/ArcGIS.svelte';\` : \`<p>Visit the <a href="arcgis">arcgis demo page</a> and view console.log output</p>\`;
|
|
761
|
+
|
|
569
762
|
// Read existing root page content and append the demo link
|
|
570
|
-
if (fs.existsSync(rootPagePath)) {
|
|
763
|
+
if (fs.existsSync(rootPagePath) && isSvelteKit) {
|
|
571
764
|
const existingContent = fs.readFileSync(rootPagePath, 'utf8');
|
|
572
765
|
if (!existingContent.includes('arcgis demo page')) {
|
|
573
766
|
const updatedContent = existingContent + \`\n\` + rootPageUpdate;
|
|
@@ -575,6 +768,22 @@ if (demo.DEMO === true) {
|
|
|
575
768
|
}
|
|
576
769
|
console.log(\`✅ Updated homepage with demo link\`);
|
|
577
770
|
}
|
|
771
|
+
|
|
772
|
+
if (fs.existsSync(rootPagePath) && isSvelte) {
|
|
773
|
+
const existingContent = fs.readFileSync(rootPagePath, 'utf8');
|
|
774
|
+
if (!existingContent.includes('ArcGIS.svelte')) {
|
|
775
|
+
const scriptTagRegex = /(<script[^>]*>)/;
|
|
776
|
+
const match = existingContent.match(scriptTagRegex);
|
|
777
|
+
if (match) {
|
|
778
|
+
const insertionPoint = match.index + match[0].length;
|
|
779
|
+
const updatedContent =
|
|
780
|
+
existingContent.slice(0, insertionPoint) + rootPageUpdate + existingContent.slice(insertionPoint);
|
|
781
|
+
fs.writeFileSync(rootPagePath, updatedContent);
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
console.log('nice');
|
|
785
|
+
}
|
|
786
|
+
}
|
|
578
787
|
}
|
|
579
788
|
|
|
580
789
|
const config = {
|