Compare commits
311
Commits
v0.2.0
...
feat/docker-ci
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48a17bf3ee | ||
|
|
2e4c074f77 | ||
|
|
e2108f5049 | ||
|
|
b76067c0bb | ||
|
|
04e614e1ed | ||
|
|
0d14a63246 | ||
|
|
781fe9e790 | ||
|
|
f0c2d81e18 | ||
|
|
f86b7d1e94 | ||
|
|
28704e6fe1 | ||
|
|
01e291a40e | ||
|
|
909e150b3d | ||
|
|
1fe3a77383 | ||
|
|
998f98851e | ||
|
|
9c51cdb8a2 | ||
|
|
d74ae694a4 | ||
|
|
ec4c89fe51 | ||
|
|
44e8ff9b70 | ||
|
|
cc90d3c2a3 | ||
|
|
0e6268bf72 | ||
|
|
764af74d14 | ||
|
|
29269c668a | ||
|
|
c60a0c9d56 | ||
|
|
05b2dce394 | ||
|
|
390518be0f | ||
|
|
e07bc60672 | ||
|
|
d75618f9aa | ||
|
|
aa34e1c49d | ||
|
|
2f618ce2cf | ||
|
|
085f4aa90c | ||
|
|
c1ddb91268 | ||
|
|
b3bc62ad8e | ||
|
|
32a4df4952 | ||
|
|
3ac36446bf | ||
|
|
ac95a64115 | ||
|
|
1d07698df7 | ||
|
|
583622f091 | ||
|
|
bfdbd0313d | ||
|
|
a70f93af0a | ||
|
|
26970e6adc | ||
|
|
63bc49949a | ||
|
|
ce45f2d4b6 | ||
|
|
bec1080cb8 | ||
|
|
ed4826484c | ||
|
|
77e6bf1d55 | ||
|
|
fa6413e953 | ||
|
|
53a9931e94 | ||
|
|
055ead345a | ||
|
|
89c247e913 | ||
|
|
df7df20c46 | ||
|
|
b738072e05 | ||
|
|
414ac3b194 | ||
|
|
f3b48ac302 | ||
|
|
bea39455e6 | ||
|
|
1a984251b6 | ||
|
|
67ca2abdbc | ||
|
|
b10e7d0a7f | ||
|
|
6be56b9966 | ||
|
|
4951a2d047 | ||
|
|
3fa1aeb80c | ||
|
|
c6b27a6079 | ||
|
|
c8c619210f | ||
|
|
01f923b806 | ||
|
|
487cb46f03 | ||
|
|
d05f93e610 | ||
|
|
701b7b3b23 | ||
|
|
1eff015bbb | ||
|
|
84129f1d9e | ||
|
|
60dbc5af66 | ||
|
|
8abc2ea2ef | ||
|
|
76243e08c0 | ||
|
|
57d6bbbe02 | ||
|
|
e1910011aa | ||
|
|
f81d9315e0 | ||
|
|
48cf43e68d | ||
|
|
f30a539ebf | ||
|
|
57a602eb60 | ||
|
|
a2c8dd2f55 | ||
|
|
f272a9a617 | ||
|
|
8fe71c637d | ||
|
|
aee5154eaf | ||
|
|
ae8c422c2f | ||
|
|
e61928b2a1 | ||
|
|
7749804365 | ||
|
|
c115058008 | ||
|
|
86c97ec191 | ||
|
|
b5b925dd06 | ||
|
|
7488677f7a | ||
|
|
14a8bf5369 | ||
|
|
96e4a1c591 | ||
|
|
6cb6dfd1d6 | ||
|
|
c31871b321 | ||
|
|
245118412f | ||
|
|
a75a4f0f9a | ||
|
|
f8664d8255 | ||
|
|
dad91079b2 | ||
|
|
273112424c | ||
|
|
9cc51f483a | ||
|
|
0adef65616 | ||
|
|
5b2b8a0a8d | ||
|
|
f33e7efb8d | ||
|
|
425dcbbc8e | ||
|
|
484104a2b0 | ||
|
|
7e34ab6da0 | ||
|
|
5b45d79790 | ||
|
|
7684d23398 | ||
|
|
a5610f0c8d | ||
|
|
4d178544e5 | ||
|
|
8a58f4a732 | ||
|
|
026eaae074 | ||
|
|
6515b43711 | ||
|
|
94a0ca4731 | ||
|
|
de60ed3ffe | ||
|
|
f5898b253a | ||
|
|
561a44fe77 | ||
|
|
b431fc526a | ||
|
|
3deefc9607 | ||
|
|
20363d509b | ||
|
|
134c3a5443 | ||
|
|
ab4cb2553a | ||
|
|
3bc3b3461f | ||
|
|
11a75b6458 | ||
|
|
62b8436353 | ||
|
|
875eda7ea2 | ||
|
|
82246daab0 | ||
|
|
7513ff9dfa | ||
|
|
96b032c2d0 | ||
|
|
de4f77d250 | ||
|
|
7c59ba4dc3 | ||
|
|
951e070466 | ||
|
|
adadce06b1 | ||
|
|
2341409bb4 | ||
|
|
7fee8e9fcf | ||
|
|
682c21296c | ||
|
|
aec6f20edc | ||
|
|
c89b55884f | ||
|
|
ded3ae9416 | ||
|
|
0808326967 | ||
|
|
889bd5aade | ||
|
|
a17aafa6f6 | ||
|
|
18da3a492c | ||
|
|
2fd3f84b2f | ||
|
|
68d350572f | ||
|
|
7660e707f7 | ||
|
|
f510c7de34 | ||
|
|
35e9e7d70d | ||
|
|
74f3793313 | ||
|
|
913e25ccac | ||
|
|
2ec151c68b | ||
|
|
cf49eef883 | ||
|
|
b56dacf04f | ||
|
|
22bb77492e | ||
|
|
ca1447f26a | ||
|
|
7f1bf00ef7 | ||
|
|
aeb9ddb96b | ||
|
|
3852e1175d | ||
|
|
1474e28de0 | ||
|
|
8a5ace61b2 | ||
|
|
932713e7a2 | ||
|
|
50228a43c8 | ||
|
|
326c69e92f | ||
|
|
e3225d4dab | ||
|
|
23d1538ea2 | ||
|
|
5f89715ee6 | ||
|
|
22f22ead37 | ||
|
|
5eff117972 | ||
|
|
b92e5b3683 | ||
|
|
b79f0f025d | ||
|
|
f40615ee21 | ||
|
|
222ae0950e | ||
|
|
afe89f8c0e | ||
|
|
867e495353 | ||
|
|
6263f7766b | ||
|
|
d65600786f | ||
|
|
a3a04d84c0 | ||
|
|
f295609ea2 | ||
|
|
80064996e9 | ||
|
|
973bef6386 | ||
|
|
4e2287aa5f | ||
|
|
17b8c7bb62 | ||
|
|
d10c68004a | ||
|
|
10830efca5 | ||
|
|
c3d9b2b536 | ||
|
|
3a04c64e79 | ||
|
|
eea424a826 | ||
|
|
4edcce2468 | ||
|
|
d54d9a480c | ||
|
|
b7d76b5e58 | ||
|
|
e83e45e8b9 | ||
|
|
86b7550c38 | ||
|
|
09b4b44c3e | ||
|
|
c6b26d20bc | ||
|
|
36ee84857b | ||
|
|
25b19ec635 | ||
|
|
614d3af796 | ||
|
|
bc05d93ce8 | ||
|
|
c0789f831c | ||
|
|
3be23a3ebc | ||
|
|
abd40ede1b | ||
|
|
c7d980390d | ||
|
|
aab5e39aa3 | ||
|
|
05bc8856f6 | ||
|
|
562a53e853 | ||
|
|
419744e64b | ||
|
|
b008537694 | ||
|
|
11919731d2 | ||
|
|
2a285312b0 | ||
|
|
027672d885 | ||
|
|
e016342dea | ||
|
|
a56e2b6340 | ||
|
|
b1fa384476 | ||
|
|
efa886ad3e | ||
|
|
3d25b2642a | ||
|
|
ca7125f3ac | ||
|
|
c247e3dde0 | ||
|
|
a25d7ce09b | ||
|
|
1bbd97b382 | ||
|
|
5999ef7d8d | ||
|
|
a764eefcd8 | ||
|
|
f2bd3fecfe | ||
|
|
ee5702f21e | ||
|
|
c4e9dd3951 | ||
|
|
2e928d2d64 | ||
|
|
8ec9465274 | ||
|
|
de40d79662 | ||
|
|
853c173c37 | ||
|
|
fcef4d46fa | ||
|
|
3e8a54a541 | ||
|
|
5c97ceaa64 | ||
|
|
9312c40862 | ||
|
|
52a08dfd7b | ||
|
|
fe1c80e798 | ||
|
|
bce7da4006 | ||
|
|
534ccc03af | ||
|
|
0736b7a051 | ||
|
|
c706d83009 | ||
|
|
6b3f351d38 | ||
|
|
62c333e99a | ||
|
|
e46096dd87 | ||
|
|
48c4045f84 | ||
|
|
c656c86baa | ||
|
|
975c4b1d38 | ||
|
|
38fc546b12 | ||
|
|
66f9d705d7 | ||
|
|
652aa3f94f | ||
|
|
e6995e3a17 | ||
|
|
ba8d031d19 | ||
|
|
4d33d434c0 | ||
|
|
350f70c34f | ||
|
|
0c54d6ca1d | ||
|
|
9a92640469 | ||
|
|
44c05efd95 | ||
|
|
b19ec0af6e | ||
|
|
0a3d7c96ea | ||
|
|
665ad5317c | ||
|
|
5ca9be2070 | ||
|
|
e6dc172871 | ||
|
|
74d61f3e8c | ||
|
|
875e12cb22 | ||
|
|
c773eacceb | ||
|
|
91123ecc1b | ||
|
|
51b7fe01d5 | ||
|
|
f98615e198 | ||
|
|
0d795bf5e8 | ||
|
|
76b7fea27b | ||
|
|
2e93b45927 | ||
|
|
8b7b4204b4 | ||
|
|
5d62ce138a | ||
|
|
706fde7610 | ||
|
|
7db1980e0f | ||
|
|
60a584d03f | ||
|
|
9f9e0fb81a | ||
|
|
665893ef80 | ||
|
|
f5ea9d6432 | ||
|
|
f4c420a665 | ||
|
|
6c6f44cc7e | ||
|
|
c4f32ece18 | ||
|
|
6cfef39e1b | ||
|
|
bccdc6aa26 | ||
|
|
fcdea75bdc | ||
|
|
9748d02820 | ||
|
|
39c7324872 | ||
|
|
53f4a02d07 | ||
|
|
3f6c9bf7c7 | ||
|
|
3df54a8c47 | ||
|
|
1d90209d51 | ||
|
|
f64d5a61ba | ||
|
|
c995716d02 | ||
|
|
899d23e2e5 | ||
|
|
59b0c638c7 | ||
|
|
9e8ea82480 | ||
|
|
3c516ff021 | ||
|
|
e77626d84d | ||
|
|
5f85a1d9e8 | ||
|
|
4845b72cc8 | ||
|
|
3522c7646f | ||
|
|
97188a9c64 | ||
|
|
90b9c029df | ||
|
|
c2722856d8 | ||
|
|
1505b0902b | ||
|
|
83752b96c9 | ||
|
|
9db38cb0de | ||
|
|
522e976739 | ||
|
|
19b521c5ca | ||
|
|
e8e2311422 | ||
|
|
41e2413af4 | ||
|
|
a3e19cecef | ||
|
|
62daafc4a0 | ||
|
|
3f17dd21f8 | ||
|
|
400ac5aa13 | ||
|
|
83d329e407 |
No files matched your search
@@ -0,0 +1,16 @@
|
||||
# Database Migrations & Schema Modification Rules
|
||||
|
||||
## 1. Defensive Migrations
|
||||
When making database schema changes, you must ensure that generated migrations are resilient against environmental discrepancies.
|
||||
|
||||
- **Review Generated SQL**: Always review the `.sql` files generated by `npx prisma migrate dev`.
|
||||
- **Add "IF EXISTS" clauses**: SQLite and Prisma can sometimes produce brittle drop statements (`DROP INDEX "my_index"`). To prevent migrations from crashing if a state desynchronization occurs (e.g., the index was already dropped or never created), manually edit the migration file to use `DROP INDEX IF EXISTS "my_index";` or `DROP TABLE IF EXISTS "table_name";`.
|
||||
- **Data Preservation**: When dropping columns or renaming, SQLite does not cleanly support it and requires table recreation. Carefully review the `INSERT INTO "new_table" SELECT ...` clauses to ensure data is correctly mapped.
|
||||
|
||||
## 2. Managing Failed Migrations
|
||||
If a migration fails in production:
|
||||
- **Never blindly mark as resolved**: Do not run `prisma migrate resolve --applied <migration_name>` unless you have explicitly verified that the database schema precisely matches the expected state.
|
||||
- If you use `resolve --applied`, Prisma will permanently skip that migration in the future, leaving your database structurally out of sync with your Prisma Client.
|
||||
|
||||
## 3. Backups Before DDL
|
||||
Never perform direct DDL operations (ALTER, DROP, CREATE) on a production database (via Prisma or direct SQLite access) without first confirming an automated backup exists, or manually taking a backup of the `wwv.db` file.
|
||||
@@ -1,95 +0,0 @@
|
||||
---
|
||||
trigger: model_decision
|
||||
description: This is an explanation of the purpose of the project
|
||||
---
|
||||
|
||||
WorldWideView is best described as a modular, real‑time geospatial intelligence engine built on top of a CesiumJS 3D globe, designed to ingest live data streams, transform them through a plugin system, and render them as high‑performance visual layers. The repository you have open shows a Next.js application with a generalized plugin architecture and a Cesium viewer at its core .
|
||||
|
||||
🌍 What WorldWideView fundamentally is
|
||||
WorldWideView is a real‑time situational awareness platform. It takes raw, fast‑moving geospatial signals—like aircraft positions, maritime AIS, satellite orbits, or any other sensor feed—and turns them into interactive, cinematic layers on a 3D globe. The system is built to be:
|
||||
|
||||
Modular, so each data source is a plugin.
|
||||
|
||||
High‑performance, using Cesium primitives instead of entities.
|
||||
|
||||
Extensible, allowing new data types without rewriting the core.
|
||||
|
||||
Real‑time, updating the globe smoothly as new data arrives.
|
||||
|
||||
Visual, using icons, arrows, and 3D models to represent moving objects.
|
||||
|
||||
It’s essentially your own open, customizable version of tools like SkyGlass, ADSBexchange 3D, or WorldView (Bilawal Sidhu’s demo), but engineered for long‑term scalability.
|
||||
|
||||
🧩 Core components of the system
|
||||
Plugin system (your recent commits)
|
||||
Your latest commit message—“generalize plugin system, remove aviation special treatment” —shows that the architecture now treats every data source as a plugin. This means:
|
||||
|
||||
Each plugin defines how it fetches, parses, and visualizes data.
|
||||
|
||||
The core engine doesn’t care whether the plugin is aviation, maritime, satellites, or something else.
|
||||
|
||||
You can add new intelligence layers without touching the core.
|
||||
|
||||
This is a major architectural milestone.
|
||||
|
||||
Cesium rendering engine
|
||||
The project initializes a Cesium globe inside a Next.js app. Cesium handles:
|
||||
|
||||
Globe rendering
|
||||
|
||||
Camera control
|
||||
|
||||
Terrain and imagery layers
|
||||
|
||||
Worker‑based geometry processing
|
||||
|
||||
High‑performance primitives for thousands of objects
|
||||
|
||||
Your open tabs (Cesium picking performance, CZML, map type switching) show you’re actively tuning this layer.
|
||||
|
||||
Real‑time data ingestion
|
||||
The system is designed to ingest live feeds such as:
|
||||
|
||||
ADS‑B aircraft positions
|
||||
|
||||
AIS maritime positions
|
||||
|
||||
Satellite TLE propagation
|
||||
|
||||
Custom sensor networks
|
||||
|
||||
Each plugin transforms raw data into Cesium‑ready primitives.
|
||||
|
||||
Visual representation
|
||||
Your recent work on low‑poly aircraft icons and arrow models shows the platform is moving toward:
|
||||
|
||||
Lightweight, directional markers
|
||||
|
||||
Orientation‑aware icons
|
||||
|
||||
Smooth fly‑to tracking
|
||||
|
||||
Cinematic camera behavior
|
||||
|
||||
This is what gives the platform its “WorldView‑like” feel.
|
||||
|
||||
🚀 What makes WorldWideView unique
|
||||
1. It’s modular from the ground up
|
||||
Most geospatial dashboards hard‑code aviation or maritime logic. You’ve removed that. Any data source can become a plugin.
|
||||
|
||||
2. It’s built for performance
|
||||
You’re migrating from Cesium Entities to Primitives, optimizing picking, and reducing GPU stalls—this is what allows thousands of objects to render smoothly.
|
||||
|
||||
3. It’s designed for real‑time intelligence
|
||||
Not just visualization—actual situational awareness. The architecture supports:
|
||||
|
||||
live updates
|
||||
|
||||
event‑driven pipelines
|
||||
|
||||
time‑dynamic objects
|
||||
|
||||
replay capability (future feature)
|
||||
|
||||
4. It’s open and extensible
|
||||
Unlike proprietary tools, your system can be extended by anyone who writes a plugin.
|
||||
@@ -1,12 +0,0 @@
|
||||
---
|
||||
description: cesium
|
||||
---
|
||||
|
||||
https://cesium.com/
|
||||
https://cesium.com/platform/cesiumjs/
|
||||
https://cesium.com/platform/cesiumjs/ion-sdk/
|
||||
https://sandcastle.cesium.com/?id=czml
|
||||
https://cesium.com/learn/cesiumjs-learn/
|
||||
https://cesium.com/learn/cesiumjs-learn/cesiumjs-camera/
|
||||
https://cesium.com/learn/cesiumjs-learn/cesiumjs-geometry-appearances/
|
||||
https://cesium.com/learn/cesiumjs-learn/cesiumjs-flight-tracker/
|
||||
@@ -0,0 +1,25 @@
|
||||
node_modules
|
||||
**/node_modules
|
||||
**/dist
|
||||
**/.next
|
||||
.git
|
||||
|
||||
# Database files at ANY depth
|
||||
/data
|
||||
packages/*/data
|
||||
**/*.db
|
||||
**/*.sqlite
|
||||
**/*.sqlite3
|
||||
**/*-journal
|
||||
**/*.db-wal
|
||||
**/*.db-shm
|
||||
|
||||
# Environment files
|
||||
.env*
|
||||
!*.env.example
|
||||
|
||||
# Non-build directories
|
||||
artifacts/
|
||||
performance/
|
||||
tmp/
|
||||
*.geojson
|
||||
@@ -0,0 +1,15 @@
|
||||
DATABASE_URL=file:./data/wwv.db
|
||||
|
||||
# Default plugins enabled on boot for demo edition
|
||||
# Comma-separated list of plugin IDs
|
||||
NEXT_PUBLIC_DEMO_DEFAULT_PLUGINS=iranwarlive,satellite,gps-jamming
|
||||
|
||||
# Edition: "local" | "cloud" | "demo"
|
||||
NEXT_PUBLIC_WWV_EDITION=local
|
||||
|
||||
# Auth Secret (REQUIRED for Docker — generate with: openssl rand -hex 32)
|
||||
# Must be stable across container restarts to preserve sessions.
|
||||
# [WARNING] NEVER commit real secrets here. Real secrets must ONLY go into .env.local!
|
||||
AUTH_SECRET=changeme_d64c1f35b447da89cf6ed5a0988da1379b21904edb91a87c3f5a63942e3d23a4_changeme
|
||||
|
||||
|
||||
+50
-4
@@ -1,15 +1,61 @@
|
||||
# Environment Variables Example
|
||||
# ============================================================
|
||||
# .env — committed to git (non-secret defaults)
|
||||
# ============================================================
|
||||
# This file is tracked by git. Only put non-secret values here.
|
||||
# Prisma reads DATABASE_URL from this file.
|
||||
|
||||
# Cesium Ion Access Token (Required for terrain and default imagery)
|
||||
# Get your token at https://ion.cesium.com/
|
||||
# Database (SQLite for local — zero config; PostgreSQL for cloud)
|
||||
DATABASE_URL=file:./data/wwv.db
|
||||
|
||||
# ============================================================
|
||||
# .env.local — NOT committed (secrets & API keys)
|
||||
# ============================================================
|
||||
# Copy everything below into a new file called .env.local
|
||||
# .env.local is gitignored and overrides .env values.
|
||||
|
||||
# Auth Secret (REQUIRED — generate with: openssl rand -hex 32)
|
||||
# Must remain stable across restarts to preserve sessions and tokens.
|
||||
# For Docker: also set this in the host environment or a .env file
|
||||
# at the project root so docker-compose can inject it.
|
||||
AUTH_SECRET=
|
||||
|
||||
# Cesium Ion Access Token (optional — get one free at https://ion.cesium.com/)
|
||||
NEXT_PUBLIC_CESIUM_ION_TOKEN=
|
||||
|
||||
# Bing Maps API Key (Optional, for high-res imagery)
|
||||
# Get your key at https://www.bingmapsportal.com/
|
||||
NEXT_PUBLIC_BING_MAPS_KEY=
|
||||
|
||||
# Supabase Configuration (Required for persistence and historical data)
|
||||
# Supabase Configuration (Optional — cloud-only features)
|
||||
# Found in your Supabase Project Settings > API
|
||||
NEXT_PUBLIC_SUPABASE_URL=
|
||||
NEXT_PUBLIC_SUPABASE_ANON_KEY=
|
||||
SUPABASE_SERVICE_ROLE_KEY=
|
||||
SUPABASE_DATABASE_URL=
|
||||
|
||||
# OpenSky Network — multi-account credential rotation
|
||||
# Comma-separated clientId:clientSecret pairs.
|
||||
# Example: OPENSKY_CREDENTIALS=acct1-id:acct1-secret,acct2-id:acct2-secret
|
||||
OPENSKY_CREDENTIALS=
|
||||
|
||||
# ACLED API — Civil Unrest & Conflict data (free for non-commercial use)
|
||||
# Register at https://developer.acleddata.com/ to obtain credentials.
|
||||
# Data is updated weekly (Mondays) with global protest, riot, and violence events.
|
||||
ACLED_EMAIL=
|
||||
ACLED_PASSWORD=
|
||||
|
||||
# Marketplace Bridge Token — shared secret for marketplace → WWV install requests
|
||||
# Generate any random string, then set the same value in the marketplace instance config.
|
||||
WWV_BRIDGE_TOKEN=
|
||||
|
||||
# Default plugins enabled on boot for demo edition
|
||||
# Comma-separated list of plugin IDs
|
||||
NEXT_PUBLIC_DEMO_DEFAULT_PLUGINS=
|
||||
|
||||
# Edition: "local" | "cloud" | "demo"
|
||||
NEXT_PUBLIC_WWV_EDITION=local
|
||||
|
||||
# Demo Admin Secret (demo edition only)
|
||||
# Allows operator plugin management on the demo instance via x-wwv-admin-secret header.
|
||||
# Generate any random string. Only set this on the demo deployment.
|
||||
# WWV_DEMO_ADMIN_SECRET=
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
name: Bug Report
|
||||
about: Create a report to help us improve WorldWideView
|
||||
title: '[BUG] '
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots/Logs**
|
||||
If applicable, add screenshots or console output to help explain your problem.
|
||||
|
||||
**Environment (please complete the following information):**
|
||||
- OS: [e.g. Windows, macOS]
|
||||
- Browser [e.g. chrome, safari, firefox]
|
||||
- WorldWideView Edition [e.g. local, demo, cloud]
|
||||
@@ -0,0 +1,19 @@
|
||||
---
|
||||
name: Core Feature Request
|
||||
about: Suggest an idea for the core WorldWideView engine
|
||||
title: '[FEATURE] '
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Note:** If this is about adding a new data source (like mapping vessels or plotting weather), please use the **Plugin Proposal** template instead! This template is for core engine features (like camera logic, filtering, or rendering pipeline upgrades).
|
||||
@@ -0,0 +1,25 @@
|
||||
---
|
||||
name: Plugin Proposal
|
||||
about: Suggest a new real-time data source plugin
|
||||
title: '[PLUGIN] '
|
||||
labels: plugin-idea, help-wanted
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**What data source do you want to add?**
|
||||
Please provide a brief description of the intelligence data (e.g., Global Earthquakes, Shipping Vessels, Weather Radar, Local Train Networks).
|
||||
|
||||
**Is there an available API?**
|
||||
Please link to any public or authenticated APIs that provide this data.
|
||||
*(e.g., USGS Earthquake API: https://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php)*
|
||||
|
||||
**What should the plugin render?**
|
||||
- What kind of marker? (e.g., dots, icons, 3D models)
|
||||
- Does it require historical tracking (paths), or just current position?
|
||||
|
||||
**Would you be interested in building this?**
|
||||
- [ ] Yes, I'd like to try building it!
|
||||
- [ ] No, just putting the idea out there.
|
||||
|
||||
*(Looking to build it yourself? Check out the [Build a Plugin in 5 Minutes](https://github.com/silvertakana/worldwideview#build-a-plugin-in-5-minutes) guide in the README!)*
|
||||
@@ -0,0 +1,44 @@
|
||||
## Summary
|
||||
|
||||
<!-- A short description of what this PR does and why. -->
|
||||
|
||||
## Type of Change
|
||||
|
||||
- [ ] Bug fix
|
||||
- [ ] New feature
|
||||
- [ ] New plugin
|
||||
- [ ] Refactor / code quality
|
||||
- [ ] Documentation
|
||||
- [ ] Performance improvement
|
||||
|
||||
## Related Issue
|
||||
|
||||
Closes #<!-- issue number -->
|
||||
|
||||
## Changes Made
|
||||
|
||||
<!-- List the key changes. Be specific about files and modules affected. -->
|
||||
|
||||
-
|
||||
-
|
||||
|
||||
## Testing
|
||||
|
||||
- [ ] I ran `npm test` and all tests pass
|
||||
- [ ] I manually tested this in the browser against a live data source
|
||||
- [ ] I added or updated tests for my changes
|
||||
|
||||
## Plugin Checklist (if applicable)
|
||||
|
||||
- [ ] Plugin is registered with `PluginRegistry`
|
||||
- [ ] Plugin does not import or depend on core rendering logic directly
|
||||
- [ ] Plugin cleans up Cesium primitives on unmount/disable
|
||||
- [ ] No hardcoded credentials or API keys committed
|
||||
|
||||
## Screenshots / Recordings
|
||||
|
||||
<!-- If this changes the UI or globe rendering, include a screenshot or screen recording. -->
|
||||
|
||||
## Notes for Reviewer
|
||||
|
||||
<!-- Any context that would help the reviewer understand the approach or trade-offs. -->
|
||||
@@ -0,0 +1,59 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
typecheck:
|
||||
name: Type Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- run: npx prisma generate
|
||||
- run: pnpm exec tsc --noEmit
|
||||
|
||||
test:
|
||||
name: Unit Tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- run: npx prisma generate
|
||||
- run: pnpm test
|
||||
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
needs: [typecheck, test]
|
||||
env:
|
||||
DATABASE_URL: file:./data/wwv.db
|
||||
AUTH_SECRET: ci-placeholder-secret-not-used-in-tests
|
||||
NEXT_PUBLIC_WWV_EDITION: local
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- run: npx prisma generate
|
||||
- run: pnpm build
|
||||
@@ -0,0 +1,44 @@
|
||||
name: Claude Code Review
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, ready_for_review, reopened]
|
||||
# Optional: Only run on specific file changes
|
||||
# paths:
|
||||
# - "src/**/*.ts"
|
||||
# - "src/**/*.tsx"
|
||||
# - "src/**/*.js"
|
||||
# - "src/**/*.jsx"
|
||||
|
||||
jobs:
|
||||
claude-review:
|
||||
# Optional: Filter by PR author
|
||||
# if: |
|
||||
# github.event.pull_request.user.login == 'external-contributor' ||
|
||||
# github.event.pull_request.user.login == 'new-developer' ||
|
||||
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
issues: read
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Run Claude Code Review
|
||||
id: claude-review
|
||||
uses: anthropics/claude-code-action@v1
|
||||
with:
|
||||
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
||||
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
|
||||
plugins: 'code-review@claude-code-plugins'
|
||||
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
|
||||
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
|
||||
# or https://code.claude.com/docs/en/cli-reference for available options
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
name: Claude Code
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
pull_request_review_comment:
|
||||
types: [created]
|
||||
issues:
|
||||
types: [opened, assigned]
|
||||
pull_request_review:
|
||||
types: [submitted]
|
||||
|
||||
jobs:
|
||||
claude:
|
||||
if: |
|
||||
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
|
||||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
|
||||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
|
||||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
issues: read
|
||||
id-token: write
|
||||
actions: read # Required for Claude to read CI results on PRs
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Run Claude Code
|
||||
id: claude
|
||||
uses: anthropics/claude-code-action@v1
|
||||
with:
|
||||
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
||||
|
||||
# This is an optional setting that allows Claude to read CI results on PRs
|
||||
additional_permissions: |
|
||||
actions: read
|
||||
|
||||
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
|
||||
# prompt: 'Update the pull request description to include a summary of changes.'
|
||||
|
||||
# Optional: Add claude_args to customize behavior and configuration
|
||||
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
|
||||
# or https://code.claude.com/docs/en/cli-reference for available options
|
||||
# claude_args: '--allowed-tools Bash(gh pr *)'
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
name: Docker Build and Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main", "feat/docker-ci" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=sha
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
@@ -0,0 +1,38 @@
|
||||
name: Publish Plugin to NPM
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "wwv-plugin-*-v*" # e.g. wwv-plugin-aviation-v1.0.1
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write # Required for OIDC trusted publishing (no NPM_TOKEN needed)
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Detect package name from tag
|
||||
id: pkg
|
||||
run: |
|
||||
TAG="${{ github.ref_name }}"
|
||||
# Strips the -vX.Y.Z suffix: "wwv-plugin-aviation-v1.0.1" → "wwv-plugin-aviation"
|
||||
PKG=$(echo "$TAG" | sed 's/-v[0-9].*//')
|
||||
echo "package=$PKG" >> $GITHUB_OUTPUT
|
||||
echo "Publishing: $PKG"
|
||||
|
||||
- name: Build package
|
||||
run: npm run build -w packages/${{ steps.pkg.outputs.package }}
|
||||
|
||||
- name: Publish to NPM (OIDC)
|
||||
run: npm publish packages/${{ steps.pkg.outputs.package }} --access public --provenance
|
||||
+43
-1
@@ -1,7 +1,7 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
node_modules/
|
||||
/.pnp
|
||||
.pnp.*
|
||||
.yarn/*
|
||||
@@ -17,12 +17,37 @@
|
||||
/.next/
|
||||
/out/
|
||||
|
||||
# agents
|
||||
/.agents/
|
||||
|
||||
# claude code IDE config
|
||||
/.claude/
|
||||
/.cline/
|
||||
|
||||
# performance
|
||||
/performance/
|
||||
|
||||
# artifacts
|
||||
/artifacts/
|
||||
|
||||
# scripts (tracked, but temporary scratchpads should go in /local-scripts/)
|
||||
|
||||
|
||||
# local database
|
||||
/data/
|
||||
packages/*/data/
|
||||
*.db
|
||||
*.sqlite
|
||||
*.sqlite3
|
||||
*.db-shm
|
||||
*.db-wal
|
||||
|
||||
# temporary files and credentials
|
||||
/tmp/
|
||||
|
||||
# generated prisma client
|
||||
/src/generated/
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
@@ -38,6 +63,7 @@ yarn-error.log*
|
||||
|
||||
# env files (can opt-in for committing if needed)
|
||||
.env*
|
||||
!.env
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
@@ -45,3 +71,19 @@ yarn-error.log*
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
|
||||
# Plugin build artifacts
|
||||
packages/*/dist/
|
||||
|
||||
# Reference Reference Codebases
|
||||
/worldmonitor/
|
||||
|
||||
# Developmental scripts & temporary sandbox
|
||||
/local-scripts/
|
||||
/public/plugins-local/
|
||||
|
||||
# git worktrees
|
||||
/.worktrees/
|
||||
|
||||
# proprietary extracted services
|
||||
packages/wwv-data-engine/
|
||||
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Next.js: debug server-side",
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"command": "pnpm run dev",
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
{
|
||||
"name": "Next.js: debug client-side",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"url": "http://localhost:3000",
|
||||
"webRoot": "${workspaceFolder}",
|
||||
"sourceMapPathOverrides": {
|
||||
"webpack://_N_E/*": "${webRoot}/*"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "WWV Data Engine: debug",
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"command": "pnpm --filter wwv-data-engine run dev",
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
{
|
||||
"name": "Full Stack: debug",
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"command": "pnpm run dev:all",
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "npm: dev:all",
|
||||
"type": "npm",
|
||||
"script": "dev:all",
|
||||
"problemMatcher": [],
|
||||
"isBackground": true,
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "new"
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,363 @@
|
||||
# WorldWideView — Agent Rules
|
||||
|
||||
## 1. Project Identity
|
||||
|
||||
WorldWideView is a **real-time geospatial intelligence engine** that visualizes live global data on an interactive 3D globe. Built with **Next.js 16**, **CesiumJS**, **React 19**, and **Zustand**, it renders everything from live aircraft and maritime vessels to conflict events, satellites, and environmental data — all through a modular plugin architecture.
|
||||
|
||||
### Target Inspiration
|
||||
Our primary design, feature-set, and operational layout goal is to mimic the structure and capabilities of `www.worldmonitor.app`.
|
||||
- **Reference Codebase**: [GitHub - koala73/worldmonitor](https://github.com/koala73/worldmonitor)
|
||||
---
|
||||
|
||||
## 2. Tech Stack
|
||||
|
||||
| Layer | Technology |
|
||||
|---|---|
|
||||
| Framework | Next.js 16 (App Router, `output: "standalone"`) |
|
||||
| Language | TypeScript 5, strict mode |
|
||||
| 3D Engine | CesiumJS + Resium (Google Photorealistic 3D Tiles) |
|
||||
| State | Zustand (slice-based: globe, layers, timeline, UI, filters, data, config, favorites, geojson) |
|
||||
| Event Bus | Custom typed `DataBus` (pub/sub singleton) |
|
||||
| Styling | Vanilla CSS — **no Tailwind** |
|
||||
| Database | SQLite via Prisma (local), PostgreSQL (cloud) |
|
||||
| Auth | NextAuth v5 beta (Credentials provider, JWT sessions) |
|
||||
| Package Manager | pnpm (monorepo with `pnpm-workspace.yaml`) |
|
||||
| Testing | Vitest + jsdom + React Testing Library |
|
||||
| Deployment | Docker multi-stage build → Coolify |
|
||||
| Analytics | Vercel Analytics / custom `trackEvent` |
|
||||
|
||||
---
|
||||
|
||||
## 3. Directory Structure
|
||||
|
||||
```
|
||||
worldwideview/
|
||||
├── src/
|
||||
│ ├── app/ # Next.js App Router (pages, API routes, layouts)
|
||||
│ │ ├── api/ # Server-side API routes (auth, aviation, camera, etc.)
|
||||
│ │ ├── login/ # Login page
|
||||
│ │ ├── setup/ # First-time setup page
|
||||
│ │ └── globals.css # Root stylesheet
|
||||
│ ├── components/
|
||||
│ │ ├── common/ # Shared UI: BootOverlay, FloatingWindow, PluginIcon
|
||||
│ │ ├── layout/ # AppShell, Header, SearchBar, DataBusSubscriber
|
||||
│ │ ├── panels/ # LayerPanel, EntityInfoCard, FilterPanel, GraphicsSettings
|
||||
│ │ ├── timeline/ # Timeline component
|
||||
│ │ ├── marketplace/ # Plugin install/unverified dialogs
|
||||
│ │ ├── ui/ # Tooltip, ReloadToast
|
||||
│ │ └── video/ # Floating video manager
|
||||
│ ├── core/
|
||||
│ │ ├── data/ # DataBus, PollingManager, CacheLayer, SmartFetcher
|
||||
│ │ ├── filters/ # filterEngine (applies plugin filters to entities)
|
||||
│ │ ├── globe/ # GlobeView, EntityRenderer, AnimationLoop, StackManager,
|
||||
│ │ │ │ CameraController, InteractionHandler, SelectionHandler,
|
||||
│ │ │ │ ModelManager, ImageryProviderFactory
|
||||
│ │ │ └── hooks/ # useCameraActions, useEntityRendering, useModelRendering, etc.
|
||||
│ │ ├── hooks/ # useBootSequence, useIsMobile, useMarketplaceSync
|
||||
│ │ ├── plugins/ # PluginManager, PluginRegistry, PluginManifest,
|
||||
│ │ │ │ loadPluginFromManifest, validateManifest, InstalledPluginsLoader
|
||||
│ │ │ └── loaders/ # DeclarativePlugin, StaticDataPlugin, mapJsonToEntities
|
||||
│ │ └── state/ # Zustand store + slices (config, data, globe, layers, timeline, ui, etc.)
|
||||
│ ├── lib/ # auth, db, rateLimit, analytics, AIS stream, marketplace APIs
|
||||
│ ├── plugins/ # GeoJSON plugin registrations
|
||||
│ ├── styles/ # HUD animations CSS
|
||||
│ ├── types/ # GeoJSON types, Umami types
|
||||
│ └── generated/ # Prisma generated client (gitignored)
|
||||
├── packages/ # pnpm monorepo workspace packages
|
||||
│ ├── wwv-plugin-sdk/ # Plugin SDK: type definitions, manifest schema
|
||||
│ ├── wwv-plugin-aviation/
|
||||
│ ├── wwv-plugin-maritime/
|
||||
│ ├── wwv-plugin-wildfire/
|
||||
│ ├── wwv-plugin-borders/
|
||||
│ ├── wwv-plugin-camera/
|
||||
│ ├── wwv-plugin-military-aviation/
|
||||
│ ├── wwv-plugin-satellite/
|
||||
│ ├── wwv-plugin-iranwarlive/ # Includes standalone backend/ microservice
|
||||
│ └── wwv-plugin-{airports,embassies,lighthouses,nuclear,seaports,spaceports,volcanoes}/
|
||||
├── prisma/ # schema.prisma, migrations/
|
||||
├── public/ # Static assets, Cesium workers, plugin GeoJSON data
|
||||
├── scripts/ # Build scripts (copy-cesium, scaffold-osm-plugin, setup)
|
||||
├── data/ # SQLite database (gitignored, Docker volume)
|
||||
├── Dockerfile # Multi-stage production build
|
||||
├── docker-compose.yml # Main app + microservice backends
|
||||
└── .agents/ # Agent documentation, rules, skills, workflows
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. Architecture Patterns
|
||||
|
||||
### 4.1 Plugin System (Core Abstraction)
|
||||
|
||||
Every data source is a **plugin** implementing the `WorldPlugin` interface from `@worldwideview/wwv-plugin-sdk`. The lifecycle utilizes a real-time WebSocket Firehose pipeline:
|
||||
|
||||
```text
|
||||
PluginRegistry.register() → PluginManager.registerPlugin()
|
||||
→ plugin.initialize(context)
|
||||
|
||||
Visibility Toggle → DataBusSubscriber subscribes to layer via WsClient
|
||||
→ Engine responds with instantaneous websocket snapshots over /stream
|
||||
→ WsClient pipes to DataBus.emit("dataUpdated", WsStreamPayload)
|
||||
→ Store → EntityRenderer → Globe
|
||||
```
|
||||
|
||||
Four plugin architectures exist (All-Bundle Model):
|
||||
1. **Data Engine Seeder** — Standalone Fastify container with SQLite microservice or unified seeders (e.g., `iranwarlive-backend`).
|
||||
2. **Dynamic CDN Loaded (Bundle)** — Externally developed plugins dynamically imported at runtime via ES module CDNs (e.g., `unpkg.com` version-pinned URLs).
|
||||
3. **Static Compiled (Bundle)** — Static GeoJSON data wrapped into JS bundles via `wwvStaticCompiler` during build/sync (previously `StaticDataPlugin`).
|
||||
4. **Active Proxied (Bundle)** — Next.js API routes bundled to provide frontend interactions (previously `DeclarativePlugin`).
|
||||
|
||||
All plugins are now dynamically imported at runtime as ES module bundles via `loadPluginFromManifest` utilizing `import(/* webpackIgnore: true */ entry)`. The legacy `StaticDataPlugin` and `DeclarativePlugin` runtimes are fully deprecated.
|
||||
|
||||
Plugin types are re-exported from SDK through `src/core/plugins/PluginTypes.ts` and `PluginManifest.ts` — **source of truth is always `@worldwideview/wwv-plugin-sdk`**.
|
||||
|
||||
### 4.2 State Management
|
||||
|
||||
Zustand store with **nine slices**: `globe`, `layers`, `timeline`, `ui`, `filter`, `data`, `config`, `favorites`, `geojson`. Each slice is in its own file under `src/core/state/`.
|
||||
|
||||
- Access via `useStore` hook or `useStore.getState()` outside React
|
||||
- Plugin settings stored in `configSlice.dataConfig.pluginSettings`
|
||||
- Polling intervals stored in `configSlice.dataConfig.pollingIntervals`
|
||||
|
||||
### 4.3 Data Pipeline
|
||||
|
||||
```text
|
||||
Engine push /stream → DataBusSubscriber WsClient router
|
||||
→ WsClient.handleMessage() → DataBus.emit("websocketData")
|
||||
→ DataBusSubscriber → _hydrateSnapshot() → Store.entitiesByPlugin
|
||||
→ GlobeView (memoized visible entities)
|
||||
→ EntityRenderer (billboard/point primitives)
|
||||
→ AnimationLoop (horizon culling, hover/selection)
|
||||
→ StackManager (co-located entity grouping)
|
||||
```
|
||||
|
||||
### 4.3.1 Split-Routing (Cloud Fallback)
|
||||
|
||||
When a local engine is detected at `localhost:5001`, the frontend fetches its `/manifest` to discover available seeders. Per-plugin routing via `resolveEngineUrl`:
|
||||
- Plugin's seeder is in local manifest → `ws://localhost:5001/stream`
|
||||
- Plugin's seeder is NOT in local manifest → `wss://dataengine.worldwideview.dev/stream`
|
||||
|
||||
This enables core contributors running the public (community) engine locally to see local data for their seeders while proprietary sources (aviation, maritime) continue streaming from the cloud.
|
||||
|
||||
The data engine uses a **public upstream / private fork** model:
|
||||
- `wwv-data-engine` (public) — community seeders, contributors fork and PR here
|
||||
- `wwv-data-engine-internal` (private) — all seeders, deploys to Coolify via `git merge upstream/main`
|
||||
|
||||
### 4.4 Rendering Pipeline
|
||||
|
||||
- **Primitive-based**: Uses `PointPrimitiveCollection`, `BillboardCollection`, `LabelCollection` — NOT Cesium Entity API
|
||||
- **Chunked processing**: Large datasets (10k+) rendered via `ChunkedProcessor`
|
||||
- **LOD system**: Model-type entities promoted to 3D models at close range (`useModelRendering`)
|
||||
- **Horizon culling**: Manual dot-product calculation against Earth radius (NOT depth testing)
|
||||
- **Stack/Spiderifier**: `StackManager` groups co-located entities; `stackAnimation` handles expansion
|
||||
|
||||
### 4.5 Edition System
|
||||
|
||||
Three editions controlled by `NEXT_PUBLIC_WWV_EDITION`:
|
||||
- **`local`** — Self-hosted, full features, auth enabled
|
||||
- **`cloud`** — Managed cloud instance, full features
|
||||
- **`demo`** — Public demo, auth disabled, optional admin via `WWV_DEMO_ADMIN_SECRET`
|
||||
|
||||
Feature flags derived from edition in `src/core/edition.ts`.
|
||||
|
||||
---
|
||||
|
||||
## 5. Critical Conventions
|
||||
|
||||
### 5.1 File Size
|
||||
|
||||
**Max 150 lines per file.** If a file grows beyond this, modularize it. Extract helpers, split components, use hooks.
|
||||
|
||||
### 5.2 Import Aliases
|
||||
|
||||
- `@/*` → `./src/*`
|
||||
- `@worldwideview/wwv-plugin-sdk` → `./packages/wwv-plugin-sdk/src`
|
||||
- Each plugin has its own alias in `tsconfig.json`
|
||||
|
||||
### 5.3 CSS Rules
|
||||
|
||||
- **Vanilla CSS only** — no Tailwind, no CSS-in-JS
|
||||
- Global styles in `src/app/globals.css`
|
||||
- Component-scoped styles use CSS Modules (`.module.css`) or co-located `.css` files
|
||||
- HUD animations in `src/styles/hud-animations.css`
|
||||
|
||||
### 5.4 Rendering Entity Rules
|
||||
|
||||
When returning `CesiumEntityOptions` from `renderEntity()`:
|
||||
|
||||
- **Points**: Use `type: "point"` with `color`, `size`, `outlineColor`, `outlineWidth`
|
||||
- **Billboards**: Use `type: "billboard"` with `iconUrl`, `color`, `iconScale`
|
||||
- **NEVER mix**: Do not use `size`/`outlineWidth`/`outlineColor` on billboard entities — causes GPU clipping
|
||||
|
||||
### 5.5 Plugin Registration
|
||||
|
||||
Built-in plugins are instantiated in `AppShell.tsx` and registered via `PluginRegistry` → `PluginManager`. Marketplace-installed plugins are loaded from the database via `InstalledPluginsLoader`.
|
||||
|
||||
### 5.6 Workspace Rules
|
||||
|
||||
- Always run `pnpm install` from project root after creating new packages
|
||||
- Plugin packages go in `packages/wwv-plugin-<name>/`
|
||||
- Microservice backends go in `packages/wwv-plugin-<name>/backend/`
|
||||
- Both globs (`packages/*` and `packages/*/backend`) are in `pnpm-workspace.yaml`
|
||||
- Add new plugins to `transpilePackages` in `next.config.ts` and `paths` in `tsconfig.json`
|
||||
|
||||
### 5.7 AI Meta-Directives: Antigravity Standard (Claude Code)
|
||||
|
||||
> [!NOTE]
|
||||
> This repository is orchestrated via the **Antigravity open standard** using **Claude Code** as the active agent. The entry point for Claude Code is `CLAUDE.md` at the project root.
|
||||
|
||||
> [!WARNING]
|
||||
> - **Always** use standard `.md` file extensions for rules, skills, and workflows.
|
||||
> - **Never** use proprietary `.mdc` extensions.
|
||||
> - **Never** reference Cursor IDE rules; we use the open `.agents/` standard.
|
||||
> - **MUST**: You MUST update Semantic Versioning numbering inside the relevant `package.json` file prior to executing any code commits, adhering strictly to the `[/commit]` workflow rules (`feat:` -> Minor, `fix/refactor/perf:` -> Patch).
|
||||
> - **MUST Detail Commit Levels & Bumps**: On description changes or release notes, you must detail the level of commit (Major/Minor/Fix) for *each* individual change. If there are multiple accumulated changes, you MUST EITHER commit them individually and bump the version each time, OR commit them all at once and bump the version multiple times.
|
||||
> - **MUST Explain Complex Concepts Simply**: Whenever providing a complicated technical explanation to the user, you MUST include a simple explanation below it. Use an analogy with reference to the correct terminology, comparing the concept to something from everyday life to ensure the user easily understands it.
|
||||
|
||||
### 5.8 Workspace Hygiene
|
||||
Whenever agents generate temporary debugging scripts, test REST endpoints via `.mjs`, or dump traces/JSON outputs, they **MUST** save these exclusively inside `/local-scripts/`. The root directory is strictly for production configuration files.
|
||||
|
||||
---
|
||||
|
||||
## 6. Environment Variables
|
||||
|
||||
| Variable | Required | Description |
|
||||
|---|---|---|
|
||||
| `DATABASE_URL` | Yes | SQLite: `file:./data/wwv.db` |
|
||||
| `AUTH_SECRET` | Yes | JWT signing secret (generate with `openssl rand -hex 32`) |
|
||||
| `NEXT_PUBLIC_CESIUM_ION_TOKEN` | No | Cesium Ion access token |
|
||||
| `NEXT_PUBLIC_BING_MAPS_KEY` | No | Bing Maps imagery |
|
||||
| `NEXT_PUBLIC_GOOGLE_MAPS_API_KEY` | No | Google 3D Tiles |
|
||||
| `NEXT_PUBLIC_WWV_EDITION` | No | `local` / `cloud` / `demo` (default: `local`) |
|
||||
| `NEXT_PUBLIC_WWV_PLUGIN_DATA_ENGINE_URL` | No | Override engine WebSocket URL (default: cloud) |
|
||||
| `OPENSKY_CREDENTIALS` | No | Comma-separated `id:secret` pairs for credential rotation |
|
||||
| `WWV_BRIDGE_TOKEN` | No | Shared secret for marketplace → WWV install bridge |
|
||||
| `WWV_DEMO_ADMIN_SECRET` | No | Demo edition admin password |
|
||||
| `IRANWARLIVE_BACKEND_URL` | No | Override for IranWarLive microservice URL |
|
||||
|
||||
Secrets go in `.env.local` (gitignored). Non-secrets go in `.env` (committed).
|
||||
|
||||
---
|
||||
|
||||
## 7. Development Commands
|
||||
|
||||
```bash
|
||||
pnpm install # Install all workspace dependencies
|
||||
pnpm run setup # Generate .env.local with AUTH_SECRET (first-time setup)
|
||||
pnpm dev # Next.js frontend only (auto-runs prisma migrate deploy + copy-cesium)
|
||||
pnpm dev:all # Frontend + wwv-data-engine concurrently (normal development)
|
||||
pnpm dev:backends # Run only the data engine in dev mode
|
||||
pnpm build # Production build
|
||||
pnpm test # Run all Vitest tests (scoped to src/lib, src/core, src/plugins)
|
||||
pnpm db:reset # Reset and re-migrate the frontend SQLite database (destructive)
|
||||
pnpm start:backends # Start all plugin microservice backends in parallel
|
||||
pnpm clean:backends # Wipe all plugin SQLite databases
|
||||
pnpm run scaffold-osm-plugin <name> # Generate a new plugin from scaffold
|
||||
```
|
||||
|
||||
Frontend runs at `http://localhost:3000`.
|
||||
|
||||
---
|
||||
|
||||
## 8. Deployment
|
||||
|
||||
- **Docker**: Multi-stage Dockerfile using the Extractor Pattern (`deps` → `builder` → `runner`). The `node_modules` folders must be explicitly untracked in from `git` across the workspace to prevent corrupted BuildKit contextual cache overlaps during the `COPY . .` stage.
|
||||
- **Standalone output**: `next.config.ts` uses `output: "standalone"`.
|
||||
- **Cesium assets**: Copied to `public/cesium/` via `scripts/copy-cesium.mjs` at build time, excluded from output tracing.
|
||||
- **Prisma Configuration**: `prisma.config.ts` must export a native javascript object instead of dynamically importing CLI wrapper binaries (`prisma/config` or `dotenv`). The standalone Next.js tracer strips CLI devDependencies during the build, which will cause fatal runtime container crashes if imported.
|
||||
- **Microservices**: Separate containers defined in `docker-compose.yml`, proxied via `next.config.ts` rewrites.
|
||||
- **Coolify**: Deployed via Dockerfile builder natively mapping environment variables continuously into the container shell. Persistent storage mount required at `/app/data` for the SQLite root node database.
|
||||
- **Docker volumes**: Mount `/app/data` (frontend SQLite), `/app/packages/wwv-data-engine/data` (data engine SQLite), `/data` (Redis)
|
||||
|
||||
---
|
||||
|
||||
## 9. Testing Strategy
|
||||
|
||||
- **Framework**: Vitest with jsdom environment
|
||||
- **Coverage**: `src/lib/**`, `src/core/**`, `src/plugins/**`
|
||||
- **Run**: `pnpm test` (or `vitest run`)
|
||||
- **Key test files**: `rateLimit.test.ts`, `edition.test.ts`, `demoAdmin.test.ts`, `DeclarativePlugin.test.ts`, `cors.test.ts`, `repository.test.ts`, `marketplaceToken.test.ts`
|
||||
|
||||
---
|
||||
|
||||
## 10. Security Headers
|
||||
|
||||
Configured in `next.config.ts` `headers()`:
|
||||
- **CSP**: Restrictive with exceptions for CesiumJS (`unsafe-eval`, `unsafe-inline`), camera streams (`http: https:`), and analytics
|
||||
- **X-Frame-Options**: DENY
|
||||
- **X-Content-Type-Options**: nosniff
|
||||
- **Referrer-Policy**: strict-origin-when-cross-origin
|
||||
- **Permissions-Policy**: camera/microphone disabled, geolocation self-only
|
||||
|
||||
---
|
||||
|
||||
## 11. Related Repositories
|
||||
|
||||
| Repo | Purpose |
|
||||
|---|---|
|
||||
| `worldwideview` | Main application (this repo) |
|
||||
| `wwv-data-engine` | Open-source data engine — community seeders (PUBLIC) |
|
||||
| `wwv-data-engine-internal` | Proprietary data engine — all seeders (PRIVATE, deployed to Coolify) |
|
||||
| `worldwideview-marketplace` | Plugin marketplace web app |
|
||||
| `worldwideview-plugins` | Published npm plugin packages |
|
||||
| `worldwideview-web` | Marketing / landing page |
|
||||
|
||||
---
|
||||
|
||||
## 12. On-Demand Rules
|
||||
|
||||
Read the relevant rule file when working in that domain:
|
||||
|
||||
| Rule | When to use | Path |
|
||||
|---|---|---|
|
||||
| `monorepo-workflow` | pnpm commands, adding packages, workspace config | `.agents/rules/monorepo-workflow.md` |
|
||||
| `plugin-architecture` | Creating/modifying plugins, lifecycle, registration | `.agents/rules/plugin-architecture.md` |
|
||||
| `cesium-rendering` | Globe rendering, entity types, primitives, LOD, culling | `.agents/rules/cesium-rendering.md` |
|
||||
| `state-management` | Zustand slices, store access, plugin settings | `.agents/rules/state-management.md` |
|
||||
| `database-migrations` | Prisma schema changes, migrations, SQLite/Postgres | `.agents/rules/database-migrations.md` |
|
||||
| `continuous-improvement` | When to create/update rules, skills, or workflows | `.agents/rules/continuous-improvement.md` |
|
||||
| `context-and-memory` | How to orient and maintain project context between sessions | `.agents/rules/context-and-memory.md` |
|
||||
|
||||
---
|
||||
|
||||
## 13. Slash Commands / Workflows
|
||||
|
||||
Invoke by name. Read the skill/workflow file and follow its steps.
|
||||
|
||||
| Command | Description | File |
|
||||
|---|---|---|
|
||||
| `/commit` | **Required before every commit** — bump semver + conventional commit | `.agents/skills/commit/SKILL.md` |
|
||||
| `/remember` | Save a lesson, constraint, or fact into `.agents/` permanent memory | `.agents/skills/remember/SKILL.md` |
|
||||
| `/pr-review` | 6-role comprehensive pull request review | `.agents/skills/pr-review/SKILL.md` |
|
||||
| `/update-context` | Sync `.agents/context/` with current project state | Global skill |
|
||||
| `/local-dev` | Check, start, and troubleshoot local dev environment | `.agents/workflows/local-dev.md` |
|
||||
| `/data-engine-cli` | Use the wwv-data-engine CLI wrapper | `.agents/workflows/data-engine-cli.md` |
|
||||
| `/debugging-coolify` | Troubleshoot deployed apps on Coolify via MCP/SSH | `.agents/workflows/debugging-coolify.md` |
|
||||
| `/five` | Five Whys root cause analysis | `.agents/workflows/five.md` |
|
||||
| `/stitch-to-nextjs` | Generate UI with Stitch MCP, port into Next.js | `.agents/workflows/stitch-to-nextjs.md` |
|
||||
| `/bing-news-hydration` | Hydrate event attributes with Bing RSS news | `.agents/workflows/bing-news-hydration.md` |
|
||||
| `/generate-user-roadmap` | Generate updated user-facing roadmap | `.agents/workflows/generate-user-roadmap.md` |
|
||||
|
||||
---
|
||||
|
||||
## 14. Agent Skills Reference
|
||||
|
||||
Refer to these skill documents for specialized tasks:
|
||||
|
||||
### Project Skills (`.agents/skills/`)
|
||||
|
||||
| Skill | When to Use |
|
||||
|---|---|
|
||||
| `worldwideview-plugin-creation` | **Use when creating any plugin** — strict architectural checklist |
|
||||
| `plugin-creation-master-guide.md` | Decision matrix for choosing plugin architecture |
|
||||
| `osm-static-plugin-creation.md` | Creating static GeoJSON plugins from OpenStreetMap |
|
||||
| `microservice-plugin-creation.md` | Building standalone Fastify microservice backends |
|
||||
| `database-operations.md` | Prisma schema changes, migrations, database queries |
|
||||
| `database-incident-recovery-procedures.md` | Authoritative protocol for safely restoring a broken production database |
|
||||
| `index-documentation.md` | Maintaining project documentation index |
|
||||
| `context7` | Fetch up-to-date library docs via Context7 API |
|
||||
| `cesium-context7` | CesiumJS-specific documentation lookup |
|
||||
|
||||
### Global Skills
|
||||
|
||||
52 skills are available across all projects. See `.agents/global-skills-index.md` for the full list and invocation paths.
|
||||
@@ -0,0 +1,55 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and maintainers of **WorldWideView** pledge to make participation in our project and community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, colour, religion, or sexual identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
||||
|
||||
---
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behaviour that contributes to a positive environment:
|
||||
|
||||
- Using welcoming and inclusive language
|
||||
- Being respectful of differing viewpoints and experiences
|
||||
- Gracefully accepting constructive criticism
|
||||
- Focusing on what is best for the community
|
||||
- Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behaviour:
|
||||
|
||||
- The use of sexualised language or imagery, and sexual attention or advances of any kind
|
||||
- Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
- Public or private harassment
|
||||
- Publishing others' private information without explicit permission
|
||||
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
---
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Maintainers are responsible for clarifying and enforcing our standards of acceptable behaviour and will take appropriate and fair corrective action in response to any behaviour that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
Maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct.
|
||||
|
||||
---
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all project spaces — GitHub issues, pull requests, discussions, and any other official channels.
|
||||
|
||||
---
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behaviour may be reported by opening a GitHub issue marked **[CoC]** or by contacting the maintainer directly via GitHub.
|
||||
|
||||
All complaints will be reviewed and investigated promptly and fairly. The maintainer is obligated to respect the privacy and security of the reporter.
|
||||
|
||||
---
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 2.1.
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
# Contributing to WorldWideView
|
||||
|
||||
Thank you for your interest in contributing to **WorldWideView** — a modular, real-time geospatial intelligence engine!
|
||||
|
||||
This project is licensed under the [Elastic License 2.0](./LICENSE). By submitting a contribution, you agree that your code will be made available under those same terms.
|
||||
|
||||
---
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Getting Started](#getting-started)
|
||||
- [Development Setup](#development-setup)
|
||||
- [Project Structure](#project-structure)
|
||||
- [How to Contribute](#how-to-contribute)
|
||||
- [Plugin Contributions](#plugin-contributions)
|
||||
- [Code Standards](#code-standards)
|
||||
- [Commit & Branch Conventions](#commit--branch-conventions)
|
||||
- [Pull Request Process](#pull-request-process)
|
||||
- [Running Tests](#running-tests)
|
||||
|
||||
---
|
||||
|
||||
## Getting Started
|
||||
|
||||
1. **Fork** the repository on GitHub.
|
||||
2. **Clone** your fork locally:
|
||||
```bash
|
||||
git clone https://github.com/<your-username>/worldwideview.git
|
||||
cd worldwideview
|
||||
```
|
||||
3. **Install dependencies**:
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
4. **Generate environment file** (auto-creates `.env.local` with `AUTH_SECRET`):
|
||||
```bash
|
||||
npm run setup
|
||||
```
|
||||
5. **Start the dev server**:
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Visit `http://localhost:3000` to confirm everything is running.
|
||||
|
||||
---
|
||||
|
||||
## Development Setup
|
||||
|
||||
| Requirement | Version |
|
||||
|-------------|---------|
|
||||
| Node.js | 18+ |
|
||||
| npm | 9+ |
|
||||
|
||||
See [`docs/SETUP.md`](docs/SETUP.md) for detailed environment setup, including Cesium Ion token configuration.
|
||||
|
||||
---
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
src/
|
||||
core/ # Core engine: state, data bus, plugin registry
|
||||
plugins/ # Data source plugins (ADS-B, AIS, satellites, etc.)
|
||||
components/ # React UI components
|
||||
hooks/ # Custom React hooks
|
||||
docs/ # Architecture and user guides
|
||||
```
|
||||
|
||||
See [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) for a deep dive into the rendering pipeline and plugin lifecycle.
|
||||
|
||||
---
|
||||
|
||||
## How to Contribute
|
||||
|
||||
Ways you can help:
|
||||
|
||||
- 🐛 **Bug fixes** — Check the [issue tracker](https://github.com/silvertakana/worldwideview/issues)
|
||||
- 🧩 **New plugins** — Add a new data source layer (see below)
|
||||
- 📖 **Documentation** — Improve guides or add examples
|
||||
- ⚡ **Performance** — Cesium primitive optimizations, GPU stall reduction
|
||||
- 🧪 **Tests** — Expand Vitest coverage
|
||||
|
||||
For large features, **open an issue first** to discuss the design before writing code.
|
||||
|
||||
---
|
||||
|
||||
## Plugin Contributions
|
||||
|
||||
The core extension point of WorldWideView is its **plugin system**. Each plugin is a self-contained data layer that:
|
||||
|
||||
1. Fetches or subscribes to a data source
|
||||
2. Transforms raw data into Cesium-ready primitives
|
||||
3. Registers itself with the `PluginRegistry`
|
||||
|
||||
See [`docs/PLUGIN_GUIDE.md`](docs/PLUGIN_GUIDE.md) for a full walkthrough. New plugins are very welcome — if you have access to a live geospatial data feed, a plugin is the best way to contribute.
|
||||
|
||||
---
|
||||
|
||||
## Code Standards
|
||||
|
||||
This project follows these principles:
|
||||
|
||||
- **Single Responsibility Principle** — each file/module does one thing
|
||||
- **DRY & SOLID** — avoid duplication, favour composition
|
||||
- **Clean Architecture** — UI, logic, and data are separate concerns
|
||||
- **Defensive Programming** — validate inputs, handle edge cases explicitly
|
||||
- **File size** — keep files under 150 lines; split into modules if needed
|
||||
|
||||
Use TypeScript strictly. Avoid `any` unless absolutely unavoidable.
|
||||
|
||||
---
|
||||
|
||||
## Commit & Branch Conventions
|
||||
|
||||
**Branch naming:**
|
||||
```
|
||||
feat/short-description
|
||||
fix/short-description
|
||||
docs/short-description
|
||||
refactor/short-description
|
||||
```
|
||||
|
||||
**Commit messages** follow [Conventional Commits](https://www.conventionalcommits.org/):
|
||||
```
|
||||
feat: add maritime AIS plugin
|
||||
fix: resolve camera snap on globe reset
|
||||
docs: update plugin guide with lifecycle diagram
|
||||
refactor: extract billboard factory from CesiumMap
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Pull Request Process
|
||||
|
||||
1. Ensure your branch is up to date with `main`.
|
||||
2. Run tests and confirm they pass: `npm test`
|
||||
3. Fill out the [PR template](.github/PULL_REQUEST_TEMPLATE.md) completely.
|
||||
4. Request a review — PRs need at least one approval before merging.
|
||||
5. Squash commits on merge if the history is noisy.
|
||||
|
||||
---
|
||||
|
||||
## Running Tests
|
||||
|
||||
```bash
|
||||
npm test # Run all tests via Vitest
|
||||
npm run test:ui # Open Vitest UI (interactive)
|
||||
```
|
||||
|
||||
Tests live alongside source files in `__tests__/` directories or as `.test.ts` files.
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
# Stage 0: Extract package.json files for layer caching
|
||||
FROM alpine AS extractor
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN find . -type f \! -name 'package.json' \! -name 'pnpm-workspace.yaml' \! -name 'pnpm-lock.yaml' -delete && \
|
||||
find . -type d -empty -delete
|
||||
|
||||
# Stage 1: Install ALL dependencies (needed for build)
|
||||
FROM node:22-alpine AS deps
|
||||
RUN corepack enable pnpm
|
||||
RUN apk add --no-cache python3 make g++
|
||||
WORKDIR /app
|
||||
# Copy only the extracted package.jsons
|
||||
COPY --from=extractor /app ./
|
||||
# Install dependencies with cache mount for pnpm store
|
||||
RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store pnpm install --frozen-lockfile
|
||||
|
||||
|
||||
# Stage 3: Build the application
|
||||
FROM deps AS builder
|
||||
# Copy full source code
|
||||
COPY . .
|
||||
RUN DATABASE_URL="file:./data/wwv.db" npx prisma generate
|
||||
|
||||
# Create an empty SQLite database with all tables applied
|
||||
RUN mkdir -p ./data && DATABASE_URL=file:./data/wwv.db npx prisma migrate deploy
|
||||
|
||||
# Next.js inlines NEXT_PUBLIC_* vars at build time — must be declared as ARGs
|
||||
ARG NEXT_PUBLIC_CESIUM_ION_TOKEN
|
||||
ARG NEXT_PUBLIC_GOOGLE_MAPS_API_KEY
|
||||
ARG NEXT_PUBLIC_BING_MAPS_KEY
|
||||
ARG NEXT_PUBLIC_WWV_EDITION
|
||||
ARG NEXT_PUBLIC_WS_ENGINE_URL
|
||||
ARG NEXT_PUBLIC_ADSENSE_CLIENT_ID
|
||||
ARG NEXT_PUBLIC_SUPABASE_URL
|
||||
ARG NEXT_PUBLIC_SUPABASE_ANON_KEY
|
||||
|
||||
# Run Next.js build with Webpack cache mounted
|
||||
RUN --mount=type=cache,target=/app/.next/cache NODE_OPTIONS="--max_old_space_size=3072" pnpm run build
|
||||
RUN node scripts/copy-cesium.mjs
|
||||
|
||||
# Stage 4: Production runner
|
||||
FROM node:22-alpine AS runner
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV HOSTNAME=0.0.0.0
|
||||
ENV PORT=3000
|
||||
ENV DATABASE_URL=file:./data/wwv.db
|
||||
ENV AUTH_TRUST_HOST=true
|
||||
|
||||
# Copy Prisma schema + migrations for runtime DB init
|
||||
COPY --from=builder /app/prisma ./prisma
|
||||
COPY --from=builder /app/prisma.config.ts ./prisma.config.ts
|
||||
|
||||
# Copy Prisma generated client
|
||||
COPY --from=builder /app/src/generated ./src/generated
|
||||
|
||||
# Copy standalone server output
|
||||
COPY --from=builder /app/.next/standalone ./
|
||||
|
||||
# We no longer copy proddeps/node_modules. Next.js standalone output
|
||||
# already traces and copies all the exact node_modules needed for production.
|
||||
|
||||
# Copy static assets that standalone mode does NOT include
|
||||
COPY --from=builder /app/.next/static ./.next/static
|
||||
COPY --from=builder /app/public ./public
|
||||
|
||||
# Entrypoint: migrate DB on first run, then start server
|
||||
COPY docker-entrypoint.sh ./docker-entrypoint.sh
|
||||
RUN chmod +x ./docker-entrypoint.sh
|
||||
|
||||
# Declare /app/data as a persistent volume mount point.
|
||||
VOLUME ["/app/data"]
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENTRYPOINT ["./docker-entrypoint.sh"]
|
||||
@@ -1,250 +0,0 @@
|
||||
# World Wide View — Implementation Plan
|
||||
|
||||
A next-generation, open-source geospatial intelligence platform combining **Worldview's cinematic CesiumJS 3D globe** with **Worldmonitor's data-rich ingestion engine**, built around a **modular plugin ecosystem**, and designed for both **community self-hosting** and **commercial SaaS deployment**.
|
||||
|
||||
## User Review Required
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **CesiumJS + Google 3D Tiles (Recommended)**: For a "low cost, fast, and efficient" setup that looks like Bilawal's "Worldview" videos, I recommend **CesiumJS with Google Maps Photorealistic 3D Tiles**.
|
||||
> - **Cost**: Google Provides a **$200/month free credit**, which covers ~33,000 sessions (each session is 3 hours of 3D globe usage). This is essentially **$0 for small-to-medium volume**.
|
||||
> - **Efficiency**: CesiumJS is built natively for 3D Tiles and time-dynamic data (CZML), making it the "fastest" path to build the cinematic features you want.
|
||||
> - **Alternatives**: MapLibre GL JS is "lighter" for standard maps but lacks the high-end 3D terrain/building polish. Deck.gl is better suited for the dashboard overlays (which we can still integrate into Cesium).
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **Scope for this bootstrap**: This plan covers **Phase 1 — Foundation/MVP** only. This gets you a working 3D globe app with the plugin architecture, 3 live data layers, a timeline, cinematic camera, and a sidebar intelligence panel. Subsequent phases will be planned after Phase 1 ships.
|
||||
|
||||
> [!WARNING]
|
||||
> **API keys required**:
|
||||
> - **Google Maps Tile API Key** (Required for Photorealistic 3D Tiles — Includes $200/mo credit).
|
||||
> - **OpenSky Network** account (free at [opensky-network.org](https://opensky-network.org)).
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Proposed Changes
|
||||
|
||||
### Project Scaffolding
|
||||
|
||||
Summary: Initialize a Next.js (App Router) + TypeScript project with a modular architecture, designed from day one as a plugin ecosystem.
|
||||
|
||||
#### [NEW] [package.json](file:///c:/dev/World%20Wide%20View/package.json)
|
||||
Root `package.json` with Next.js, React 18, TypeScript, CesiumJS, and Resium. Will include a custom `copy-cesium` script to move static assets to `/public/cesium` for Next.js compatibility.
|
||||
|
||||
#### [NEW] [next.config.mjs](file:///c:/dev/World%20Wide%20View/next.config.mjs)
|
||||
Next.js config with path aliases, environment variable handling, and specific Webpack exclusions for CesiumJS Node.js dependencies.
|
||||
|
||||
#### [NEW] [tsconfig.json](file:///c:/dev/World%20Wide%20View/tsconfig.json)
|
||||
TypeScript config with strict mode, path aliases for `@/core`, `@/plugins`, `@/components`.
|
||||
|
||||
#### [NEW] [.env.example](file:///c:/dev/World%20Wide%20View/.env.example)
|
||||
Template with all required/optional environment variables documented.
|
||||
|
||||
---
|
||||
|
||||
### Directory Structure
|
||||
|
||||
```
|
||||
c:\dev\World Wide View\
|
||||
├── public/ # Static assets (including /cesium)
|
||||
├── src/
|
||||
│ ├── app/ # Next.js App Router
|
||||
│ │ ├── page.tsx # Main entry (Client component)
|
||||
│ │ ├── layout.tsx # Root layout
|
||||
│ │ ├── globals.css # Global styles
|
||||
│ │ └── api/ # Next.js Route Handlers (Backend)
|
||||
│ │ ├── aviation/route.ts# OpenSky proxy
|
||||
│ │ ├── maritime/route.ts# AIS proxy
|
||||
│ │ └── wildfire/route.ts# NASA FIRMS proxy
|
||||
│ ├── core/ # Core platform code
|
||||
│ │ ├── globe/ # CesiumJS globe wrapper (Dynamic Import)
|
||||
│ │ │ ├── GlobeView.tsx # Main 3D globe component
|
||||
│ │ │ ├── CameraController.ts # Cinematic camera system
|
||||
│ │ │ ├── LayerRenderer.ts # Renders plugin data on globe
|
||||
│ │ │ └── TimelineSync.ts # Syncs Cesium clock with UI
|
||||
│ │ ├── plugins/ # Plugin system
|
||||
│ │ │ ├── PluginManager.ts # Plugin lifecycle manager
|
||||
│ │ │ ├── PluginTypes.ts # Plugin interface definitions
|
||||
│ │ │ └── PluginRegistry.ts# Registration & discovery
|
||||
│ │ ├── data/ # Data management
|
||||
│ │ │ ├── DataBus.ts # Event bus for data flow
|
||||
│ │ │ ├── CacheLayer.ts # In-memory + IndexedDB caching
|
||||
│ │ │ └── PollingManager.ts# Manages refresh intervals
|
||||
│ │ └── state/ # Global state management
|
||||
│ │ └── store.ts # Zustand store
|
||||
│ ├── plugins/ # Built-in data source plugins
|
||||
│ │ ├── aviation/ # OpenSky / ADS-B
|
||||
│ │ ├── maritime/ # AIS vessel tracking
|
||||
│ │ └── wildfire/ # NASA FIRMS
|
||||
│ ├── components/ # UI components
|
||||
│ │ ├── layout/ # AppShell, Header, Sidebar
|
||||
│ │ ├── panels/ # LayerPanel, IntelPanel, Detail
|
||||
│ │ ├── timeline/ # Timeline scrubber
|
||||
│ │ └── common/ # Loading, Toast, etc.
|
||||
│ └── utils/ # Helpers
|
||||
├── .env.example
|
||||
├── package.json
|
||||
├── tsconfig.json
|
||||
└── next.config.mjs
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Core Globe Component
|
||||
|
||||
#### [NEW] [GlobeView.tsx](file:///c:/dev/World%20Wide%20View/src/core/globe/GlobeView.tsx)
|
||||
- CesiumJS `Viewer` inside React using Resium
|
||||
- WGS84 ellipsoid, terrain, imagery layers
|
||||
- Request render mode for performance
|
||||
- Integrates with `TimelineSync` for time-based filtering
|
||||
|
||||
#### [NEW] [CameraController.ts](file:///c:/dev/World%20Wide%20View/src/core/globe/CameraController.ts)
|
||||
- Cinematic fly-to animations with easing (Worldview-style smooth transitions)
|
||||
- 8 regional presets (Global, Americas, Europe, MENA, Asia, Africa, Oceania, LatAm)
|
||||
- Orbit mode for idle/attract state
|
||||
- URL state sync (lat, lon, zoom, heading, pitch)
|
||||
|
||||
#### [NEW] [LayerRenderer.ts](file:///c:/dev/World%20Wide%20View/src/core/globe/LayerRenderer.ts)
|
||||
- Renders plugin data as Cesium entities (points, billboards, polylines, polygons)
|
||||
- Smart clustering via `EntityCluster`
|
||||
- Progressive disclosure (detail at higher zoom)
|
||||
- Color/size coding based on data attributes
|
||||
|
||||
#### [NEW] [TimelineSync.ts](file:///c:/dev/World%20Wide%20View/src/core/globe/TimelineSync.ts)
|
||||
- Bidirectional sync between Cesium clock and UI timeline
|
||||
- Time window filtering (1h, 6h, 24h, 48h, 7d)
|
||||
- Playback controls, speed multiplier
|
||||
- Notifies plugins of current time window
|
||||
|
||||
---
|
||||
|
||||
### Plugin System
|
||||
|
||||
The heart of the modular architecture. Every data source implements a standard interface.
|
||||
|
||||
#### [NEW] [PluginTypes.ts](file:///c:/dev/World%20Wide%20View/src/core/plugins/PluginTypes.ts)
|
||||
```typescript
|
||||
export interface WorldPlugin {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
icon: string;
|
||||
category: 'aviation' | 'maritime' | 'conflict' | 'natural-disaster' |
|
||||
'infrastructure' | 'cyber' | 'economic' | 'custom';
|
||||
version: string;
|
||||
|
||||
initialize(context: PluginContext): Promise<void>;
|
||||
destroy(): void;
|
||||
fetch(timeRange: TimeRange): Promise<GeoEntity[]>;
|
||||
getPollingInterval(): number;
|
||||
getLayerConfig(): LayerConfig;
|
||||
renderEntity(entity: GeoEntity): CesiumEntityOptions;
|
||||
|
||||
// Optional UI hooks
|
||||
getSidebarComponent?(): React.ComponentType;
|
||||
getDetailComponent?(): React.ComponentType<{ entity: GeoEntity }>;
|
||||
}
|
||||
```
|
||||
|
||||
#### [NEW] [PluginManager.ts](file:///c:/dev/World%20Wide%20View/src/core/plugins/PluginManager.ts)
|
||||
- Plugin lifecycle (register, initialize, enable, disable, destroy)
|
||||
- Routes data from plugins → `LayerRenderer`
|
||||
- Manages polling per plugin
|
||||
- Emits events via `DataBus`
|
||||
|
||||
#### [NEW] [PluginRegistry.ts](file:///c:/dev/World%20Wide%20View/src/core/plugins/PluginRegistry.ts)
|
||||
- Static registry of built-in plugins + dynamic registration API
|
||||
|
||||
---
|
||||
|
||||
### Built-in Plugins (3 for MVP)
|
||||
|
||||
#### [NEW] Aviation — [src/plugins/aviation/](file:///c:/dev/World%20Wide%20View/src/plugins/aviation/)
|
||||
- **Source**: OpenSky Network REST API
|
||||
- **Rendering**: Aircraft billboards with heading rotation, altitude coloring
|
||||
- **Polling**: 10s | **Backend proxy**: `/api/aviation`
|
||||
|
||||
#### [NEW] Maritime — [src/plugins/maritime/](file:///c:/dev/World%20Wide%20View/src/plugins/maritime/)
|
||||
- **Source**: Public AIS feeds
|
||||
- **Rendering**: Ship icons, color-coded by vessel type
|
||||
- **Polling**: 60s | **Backend proxy**: `/api/maritime`
|
||||
|
||||
#### [NEW] Wildfire — [src/plugins/wildfire/](file:///c:/dev/World%20Wide%20View/src/plugins/wildfire/)
|
||||
- **Source**: NASA FIRMS (VIIRS thermal hotspots)
|
||||
- **Rendering**: Heat-colored point clusters (FRP intensity)
|
||||
- **Polling**: 5min | **Backend proxy**: `/api/wildfire`
|
||||
|
||||
---
|
||||
|
||||
### UI Components
|
||||
|
||||
Dark, cinematic, premium interface — glassmorphism panels floating over the globe.
|
||||
|
||||
#### [NEW] [AppShell.tsx](file:///c:/dev/World%20Wide%20View/src/components/layout/AppShell.tsx)
|
||||
Full-viewport layout with globe as background, floating glassmorphism header, collapsible sidebars, bottom timeline.
|
||||
|
||||
#### [NEW] [Header.tsx](file:///c:/dev/World%20Wide%20View/src/components/layout/Header.tsx)
|
||||
Branding, Cmd+K search, region presets, time window selector, settings.
|
||||
|
||||
#### [NEW] [LayerPanel.tsx](file:///c:/dev/World%20Wide%20View/src/components/panels/LayerPanel.tsx)
|
||||
Toggleable plugin layers grouped by category with entity counts.
|
||||
|
||||
#### [NEW] [Timeline.tsx](file:///c:/dev/World%20Wide%20View/src/components/timeline/Timeline.tsx)
|
||||
Horizontal time scrubber, playback controls, event density sparkline.
|
||||
|
||||
#### [NEW] [index.css](file:///c:/dev/World%20Wide%20View/src/styles/index.css)
|
||||
Dark-mode-first design system: deep navy/charcoal palette, glassmorphism, Inter + JetBrains Mono typography, smooth micro-animations.
|
||||
|
||||
---
|
||||
|
||||
### Backend API (Next.js Route Handlers)
|
||||
|
||||
#### [NEW] [src/app/api/](file:///c:/dev/World%20Wide%20View/src/app/api/)
|
||||
Next.js Route Handlers utilizing Web Standard Request/Response APIs. Handles rate limiting, server-side data fetching (proxying), and caching (via Next.js `fetch` cache or in-memory). This replaces the need for a separate Express server.
|
||||
|
||||
#### [NEW] Route files
|
||||
- `src/app/api/aviation/route.ts` — OpenSky proxy
|
||||
- `src/app/api/maritime/route.ts` — AIS proxy
|
||||
- `src/app/api/wildfire/route.ts` — NASA FIRMS proxy
|
||||
|
||||
---
|
||||
|
||||
### State Management
|
||||
|
||||
#### [NEW] [store.ts](file:///c:/dev/World%20Wide%20View/src/core/state/store.ts)
|
||||
Zustand store with slices: `globe`, `layers`, `timeline`, `ui`, `data`.
|
||||
|
||||
---
|
||||
|
||||
## Verification Plan
|
||||
|
||||
### Automated Tests
|
||||
|
||||
**Build verification:**
|
||||
```bash
|
||||
cd "c:\dev\World Wide View"
|
||||
npm run build
|
||||
```
|
||||
|
||||
**Type checking:**
|
||||
```bash
|
||||
cd "c:\dev\World Wide View"
|
||||
npx tsc --noEmit
|
||||
```
|
||||
|
||||
### Browser Verification
|
||||
1. Open `http://localhost:5173` → CesiumJS globe renders with terrain, header/sidebar/timeline visible
|
||||
2. Enable aviation layer → aircraft icons appear, clicking shows detail
|
||||
3. Enable wildfire layer → fire hotspots render as colored points
|
||||
4. Scrub timeline → data filters by time window
|
||||
5. Click region presets → smooth cinematic fly-to animations
|
||||
|
||||
### Manual Verification
|
||||
1. Run `npm run dev` — starts the Next.js integrated development server
|
||||
2. Verify 3D globe renders with terrain and satellite imagery (ensuring SSR is properly disabled for the globe component)
|
||||
3. Toggle layers via layer panel
|
||||
4. Drag timeline to filter events
|
||||
5. Test camera preset fly-tos
|
||||
6. Resize browser — panels collapse gracefully
|
||||
|
||||
> [!TIP]
|
||||
> First run requires `VITE_CESIUM_TOKEN` in `.env` (free from [cesium.com/ion](https://cesium.com/ion)). App shows a warning if missing but still renders a basic globe.
|
||||
@@ -1,38 +1,219 @@
|
||||
# WorldWideView
|
||||
<div align="center">
|
||||
|
||||
**WorldWideView** is a modular, real-time geospatial intelligence engine built on top of a CesiumJS 3D globe. It is designed to ingest live data streams, transform them through a generalized plugin system, and render them as high-performance visual layers.
|
||||
<!-- Generated: 2026-04-19 02:20:00 UTC -->
|
||||
# WorldWideView 🌍
|
||||
|
||||
As a real-time situational awareness platform, it turns raw geospatial signals—such as aircraft positions, maritime AIS, or satellite orbits—into interactive, cinematic layers on a high-fidelity 3D globe.
|
||||
**The Open-Source, Plugin-Driven Geospatial Intelligence Engine**
|
||||
|
||||
## Key Philosophies
|
||||
[](LICENSE)
|
||||
[](CONTRIBUTING.md)
|
||||
|
||||
- **Modular Intelligence**: Every data source is a plugin. The core engine is data-agnostic.
|
||||
- **High-Performance Rendering**: Engineered for scale using Cesium primitives to handle 100,000+ objects smoothly.
|
||||
- **Situational Awareness**: Designed for real-time updates and cinematic visualization (orientated icons, smooth tracking).
|
||||
- **Extensible & Open**: Add new intelligence layers without touching the core architecture.
|
||||
*A modular situational awareness platform designed to ingest live data streams and render them as interactive, cinematic layers on a high-fidelity CesiumJS 3D globe.*
|
||||
|
||||
## Quick Start
|
||||
<!-- 📸 Replace with a high-res GIF or screenshot of the platform running with multiple layers enabled -->
|
||||

|
||||
|
||||
```bash
|
||||
git clone https://github.com/your-repo/worldwideview.git
|
||||
cd worldwideview
|
||||
npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Visit `http://localhost:3000` to see the live globe.
|
||||
|
||||
## Fair-Use Notice
|
||||
|
||||
This application may contain copyrighted material the use of which has not always been specifically authorized by the copyright owner. Such material is made available for educational purposes, situational awareness, and to advance understanding of global events. It is believed that this constitutes a "fair use" of any such copyrighted material as provided for in section 107 of the US Copyright Law.
|
||||
|
||||
## Key Documentation Sections
|
||||
|
||||
- **[Setup & Installation Guide](docs/SETUP.md)**: Detailed environment and local development setup.
|
||||
- **[Architecture (Engineering Depth)](docs/ARCHITECTURE.md)**: Deep dive into the Cesium rendering pipeline, event data bus, and performance optimizations.
|
||||
- **[Plugin System Guide](docs/PLUGIN_GUIDE.md)**: How to build and register custom data layers.
|
||||
- **[User Guide](docs/USER_GUIDE.md)**: Application features and navigation tips.
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
For a full list of resources, see the **[Documentation Index](docs/index.md)**.
|
||||
WorldWideView is a real-time geospatial engine visualizing live global data on an interactive 3D globe. Utilizing a dynamic "All-Bundle" plugin architecture, independent data sources—like live aircraft, satellites, or OSINT news clusters—are ingested and rendered decoupled from the core 3D viewer.
|
||||
|
||||
---
|
||||
|
||||
## 🛠 Prerequisites
|
||||
|
||||
Before starting, ensure you have the required tools installed based on how you want to use WorldWideView:
|
||||
- **For Self-Hosting:** You only need Docker.
|
||||
- **For Local Development/Contributing:** You need Node.js and `pnpm`.
|
||||
|
||||
### Installing Docker (For Self-Hosting)
|
||||
- **Windows / Mac:** Download and install [Docker Desktop](https://www.docker.com/products/docker-desktop/). *(Windows users: Ensure WSL 2 integration is enabled in Settings > Resources > WSL Integration).*
|
||||
- **Linux (Ubuntu/Debian):**
|
||||
```bash
|
||||
curl -fsSL https://get.docker.com -o get-docker.sh
|
||||
sudo sh get-docker.sh
|
||||
```
|
||||
|
||||
### Installing pnpm (For Developers)
|
||||
If you want to contribute to the code, you'll need the `pnpm` package manager:
|
||||
- **Windows (PowerShell):** `iwr https://get.pnpm.io/install.ps1 -useb | iex`
|
||||
- **Mac / Linux:** `curl -fsSL https://get.pnpm.io/install.sh | sh -`
|
||||
- **Or via npm:** `npm install -g pnpm`
|
||||
|
||||
---
|
||||
|
||||
## 🐋 Self-Hosting & Production Deployment (Docker)
|
||||
|
||||
WorldWideView uses a multi-stage Dockerfile designed for standalone output, natively supporting deployment via Coolify or standard Docker Compose.
|
||||
|
||||
### Instant Self-Hosting (Recommended)
|
||||
Get the platform running on your own server instantly using our automated Docker Compose deployment scripts:
|
||||
|
||||
**Mac/Linux:**
|
||||
```bash
|
||||
mkdir worldwideview && cd worldwideview
|
||||
curl -fsSL https://raw.githubusercontent.com/silvertakana/worldwideview/main/setup.sh | bash
|
||||
```
|
||||
|
||||
**Windows (PowerShell):**
|
||||
```powershell
|
||||
mkdir worldwideview; cd worldwideview
|
||||
Invoke-WebRequest -Uri https://raw.githubusercontent.com/silvertakana/worldwideview/main/setup.ps1 -UseBasicParsing | Invoke-Expression
|
||||
```
|
||||
|
||||
### Manual Docker Deployment
|
||||
If you prefer to deploy manually:
|
||||
```bash
|
||||
# Start the core app, Redis cache, and Data Engine microservice in production mode
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
**Persistent Storage Requirements:**
|
||||
When deploying to production, ensure you mount the following volumes to prevent data loss:
|
||||
- Mount `/app/data` to persist the core SQLite database.
|
||||
- Mount `/app/packages/wwv-data-engine/data` to persist the custom plugin microservices SQLite layer.
|
||||
- Mount `/data` to persist the standalone Redis container.
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Installation & Setup (Local Development)
|
||||
|
||||
Get the source code running locally for contributing or modifying the core platform.
|
||||
|
||||
### Quick Start Scripts
|
||||
**Mac/Linux:**
|
||||
```bash
|
||||
git clone https://github.com/silvertakana/worldwideview.git
|
||||
cd worldwideview
|
||||
bash local-dev.sh
|
||||
```
|
||||
|
||||
**Windows (PowerShell):**
|
||||
```powershell
|
||||
git clone https://github.com/silvertakana/worldwideview.git
|
||||
cd worldwideview
|
||||
.\local-dev.ps1
|
||||
```
|
||||
|
||||
### Manual Setup
|
||||
```bash
|
||||
git clone https://github.com/silvertakana/worldwideview.git
|
||||
cd worldwideview
|
||||
pnpm install
|
||||
pnpm run setup # generates .env.local with AUTH_SECRET
|
||||
pnpm run dev:all # boots the UI, cache layers, and the marketplace engine
|
||||
```
|
||||
Visit `http://localhost:3000` to see the live globe.
|
||||
|
||||
---
|
||||
|
||||
## ⚡ Plugin Development Quick Start
|
||||
|
||||
WorldWideView’s architecture means **everything is a plugin**. The core engine is completely data-agnostic. You can build your own WorldWideView plugins using the officially supported CLI toolchain.
|
||||
|
||||
### 1. Scaffold your plugin
|
||||
The plugin folder is pure code. It contains no Docker boilerplate.
|
||||
```bash
|
||||
npx @worldwideview/create-plugin my-layer
|
||||
cd my-layer
|
||||
npm install
|
||||
```
|
||||
|
||||
### 2. Sideload the plugin into your platform
|
||||
The CLI acts as a bridge, injecting your compiled plugin directly into your running WorldWideView instance.
|
||||
|
||||
**If you are running the platform via Docker:**
|
||||
Ensure your Docker Compose file has a volume mount exposing the plugin directory:
|
||||
`volumes: [ "./my-local-plugins:/app/public/plugins-local" ]`
|
||||
And set the environment variable: `WWV_PLUGIN_DEV=true`
|
||||
|
||||
Then, tell the CLI where that exposed folder is:
|
||||
```bash
|
||||
# Save the path so you only have to type it once
|
||||
npx wwv config set wwv-path /absolute/path/to/my-local-plugins
|
||||
|
||||
# Start the dev server and link the plugin!
|
||||
npm run link
|
||||
```
|
||||
|
||||
**If you cloned the platform repository (`pnpm dev`):**
|
||||
```bash
|
||||
npx wwv config set wwv-path ../worldwideview
|
||||
npm run link
|
||||
```
|
||||
|
||||
The CLI will start Vite in watch mode. Every time you save a file, it compiles in milliseconds and pushes the update directly into your WorldWideView instance. Refresh your browser to see changes!
|
||||
|
||||
### 3. Validate & Publish
|
||||
If you are building a simple, static data layer and don't need local testing:
|
||||
```bash
|
||||
npm run validate
|
||||
npm run build
|
||||
npm publish
|
||||
```
|
||||
|
||||
📖 **[Read the Full Plugin Guide](docs/PLUGIN_GUIDE.md)** for a deep dive into hooking up websockets or static datasets.
|
||||
|
||||
---
|
||||
|
||||
## 🧠 Core Architecture & Philosophies
|
||||
|
||||
- **Open-Core Data Engine**: The real-time backend data pipeline operates on a public/private split-routing model. Community seeders (like ISS tracking) live in the open-source `wwv-data-engine`, while proprietary sources seamlessly interleave via our internal cloud endpoints.
|
||||
- **Dynamic, Decentralized Plugins**: The plugin ecosystem uses a decentralized architecture fetching ES module CDN bundles (e.g., from unpkg) at runtime. The core engine is a lightweight shell that loads data providers dynamically via the marketplace.
|
||||
- **High-Performance Rendering**: Engineered for scale using raw Cesium primitives to smoothly handle upwards of 100,000+ objects simultaneously without GPU stalls.
|
||||
- **Cinematic Situational Awareness**: Implements horizon culling, smooth camera tracking, orientation-locked billboarding, and stack spiderification for dense locations.
|
||||
|
||||
---
|
||||
|
||||
## 🏛 Repository Ecosystem
|
||||
|
||||
WorldWideView follows an **Open-Core** philosophy distributed across several independent, specialized repositories:
|
||||
|
||||
1. **[worldwideview](https://github.com/silvertakana/worldwideview)** *(This Repo)*
|
||||
The main Next.js frontend, CesiumJS rendering engine, and core plugin loading framework.
|
||||
2. **[wwv-data-engine](https://github.com/silvertakana/wwv-data-engine)**
|
||||
The open-source community data backend. It polls public APIs (like ISS tracking or USGS earthquakes) and streams them to the frontend via WebSocket.
|
||||
*(Note: The official production deployment uses a proprietary internal fork of this engine that includes additional restricted seeders like aviation and maritime).*
|
||||
3. **[worldwideview-plugins](https://github.com/silvertakana/worldwideview-plugins)**
|
||||
Our first-party maintained plugins (borders, nuclear sites, military bases, etc.) developed directly by the core team.
|
||||
4. **[worldwideview-marketplace](https://github.com/silvertakana/worldwideview-marketplace)**
|
||||
The web application driving the plugin directory and community submissions.
|
||||
5. **[worldwideview-web](https://github.com/silvertakana/worldwideview-web)**
|
||||
The marketing, documentation, and landing site.
|
||||
|
||||
---
|
||||
|
||||
## 🏗 Development & Code Map
|
||||
|
||||
### Key Entry Points
|
||||
- UI Loader: `src/components/layout/AppShell.tsx`
|
||||
- Dynamic Plugin Ingestion: `src/core/plugins/loadPluginFromManifest.ts`
|
||||
- Global WebSocket Event Loop: `src/core/data/DataBus.ts`
|
||||
- Environment Config: `.env.local` alongside `src/core/edition.ts`
|
||||
|
||||
---
|
||||
|
||||
## 📚 Documentation Index
|
||||
|
||||
- **[Setup & Installation Guide](docs/SETUP.md)**: Detailed environment and local development setup.
|
||||
- **[Architecture (Engineering Depth)](docs/ARCHITECTURE.md)**: Deep dive into the Cesium rendering pipeline, event data bus, and performance optimizations.
|
||||
- **[Contributions Guide](CONTRIBUTING.md)**: How to help out, coding standards, and commit conventions.
|
||||
- **[User Guide](docs/USER_GUIDE.md)**: Application features and navigation tips.
|
||||
|
||||
### Internal Engineering Docs
|
||||
- **[Build System](docs/build-system.md)**: Find compile targets for UI bundles and internal `wwvStaticCompiler` plugin bundling.
|
||||
- **[Testing Overview](docs/testing.md)**: Understanding Vitest strategies and isolated typing execution targets.
|
||||
- **[Development Patterns](docs/development.md)**: View standard hook approaches, Zustand architecture rules, and snippet targets.
|
||||
- **[Deployment Workflows](docs/deployment.md)**: Detailed insights on Next.js standalone execution and persistent database volume arrays.
|
||||
- **[Source File Catalog](docs/files.md)**: High-level mappings of core ingestion controllers to rendering context interfaces.
|
||||
|
||||
---
|
||||
|
||||
## 🤝 Contributing & Community
|
||||
|
||||
We are actively looking for contributors to help build new data plugins and optimize the core 3D engine!
|
||||
- Found a bug or have an idea? Search the [Issue Tracker](https://github.com/silvertakana/worldwideview/issues) and submit a report.
|
||||
- Want to build something? Check out our **[Pinned Plugin Wishlist](https://github.com/silvertakana/worldwideview/issues)** for great first issues!
|
||||
|
||||
> **Fair-Use Notice:** This application may contain copyrighted material the use of which has not always been specifically authorized by the copyright owner. Such material is made available for educational purposes, situational awareness, and to advance understanding of global events under "fair use" (Section 107 of the US Copyright Law).
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
# WorldWideView — Implementation Roadmap
|
||||
|
||||
Each stage is **self-contained and demo-able**. Any stage can be shipped independently.
|
||||
|
||||
---
|
||||
|
||||
## Stage 1: Plugin SDK & Manifest Schema ✅
|
||||
**Demo:** "Here's the schema that defines a plugin. Our existing aviation plugin has a manifest file."
|
||||
|
||||
- [x] `plugin.json` manifest files for each existing plugin
|
||||
- [x] Manifest validation logic (`validateManifest()`)
|
||||
- [x] `type` field on `WorldPlugin` interface (`"data-layer" | "extension"`)
|
||||
- [x] `capabilities` field on `WorldPlugin` interface
|
||||
- [x] `@worldwideview/wwv-plugin-sdk` npm package — shared types published to npm
|
||||
|
||||
---
|
||||
|
||||
## Stage 2: Marketplace Browse UI (Static Catalog) ✅
|
||||
**Demo:** "Open the marketplace, see all available plugins with categories and search."
|
||||
|
||||
- [x] `worldwideview-marketplace` repo (Next.js)
|
||||
- [x] Browse page — grid of plugin cards with icons, descriptions, categories
|
||||
- [x] Search + category filter
|
||||
- [x] Plugin detail page (readme, version history, install count)
|
||||
|
||||
---
|
||||
|
||||
## Stage 3: Prisma ORM & Local Database ✅
|
||||
**Demo:** "Run `pnpm run dev` on a fresh clone. SQLite auto-creates. App works with zero config."
|
||||
|
||||
- [x] Prisma (`prisma` + `@prisma/client`)
|
||||
- [x] Schema: `InstalledPlugin`, `Setting`, `User`, `AviationHistory`, `NpmCache`
|
||||
- [x] SQLite default: `DATABASE_URL=file:./data/wwv.db`
|
||||
- [x] `predev` script: `prisma migrate deploy`
|
||||
- [x] DB auto-creates on first run — zero manual setup
|
||||
|
||||
---
|
||||
|
||||
## Stage 4: Bridge API & One-Click Install ✅
|
||||
**Demo:** "Click 'Install' on marketplace → plugin appears in your local WWV instance."
|
||||
|
||||
- [x] `GET /api/marketplace/install-redirect` — session-based redirect install flow
|
||||
- [x] `GET /api/marketplace/grant-token` — issues marketplace JWT without install
|
||||
- [x] `GET /api/marketplace/status` — list installed plugins (session or JWT auth)
|
||||
- [x] `POST /api/marketplace/uninstall` — delete installed plugin record
|
||||
- [x] `GET /api/marketplace/load` — serve valid manifests to client at startup
|
||||
- [x] `GET /api/auth/setup-status` — CORS-enabled connection test endpoint
|
||||
- [x] `src/lib/marketplace/marketplaceToken.ts` — `issueMarketplaceToken()` / `verifyMarketplaceToken()`
|
||||
- [x] `src/lib/marketplace/auth.ts` — `validateMarketplaceAuth()` (session → JWT → legacy token)
|
||||
- [x] `src/lib/marketplace/registryClient.ts` — Ed25519 registry verification + 5-min cache
|
||||
- [x] Marketplace: `InstanceConfig`, `InstallButton`, `useInstalledPlugins`, `InstalledPluginCard`, Manage page
|
||||
- [x] NPM-driven submission: Admin enters package name → marketplace fetches + parses `"worldwideview"` block from `package.json`
|
||||
- [x] `NpmCache` table — decouples marketplace from live NPM registry
|
||||
|
||||
---
|
||||
|
||||
## Stage 5: AI & Sharing Features (Immediate User Value)
|
||||
**Demo:** "Chat with the AI to explore the globe, record a narrated briefing, and share the view via a URL."
|
||||
|
||||
- [ ] Unified Data Format schema (WWVDocument) with snapshot radius bounding
|
||||
- [ ] Base64url view link sharing (`#v=...`)
|
||||
- [ ] Shared `ActionExecutor` core for Animation & Copilot
|
||||
- [ ] Animation Engine (TrackScheduler, Player, overlays, TTS voice)
|
||||
- [ ] MCP Server (tools wrapping the action vocabulary)
|
||||
- [ ] Hybrid Spatial Awareness (Pre-computed summaries + MCP spatial query tools)
|
||||
|
||||
---
|
||||
|
||||
## Stage 6: Publisher Workflow
|
||||
**Demo:** "A plugin author submits their plugin. After review, it appears in the catalog."
|
||||
|
||||
- [ ] Marketplace user accounts (Supabase Auth — email/password + GitHub OAuth)
|
||||
- [ ] Publisher submission form (upload bundle, fill metadata, declare capabilities)
|
||||
- [ ] Admin review queue (approve/reject with notes)
|
||||
- [ ] Version management (semver, changelogs)
|
||||
- [ ] Publisher dashboard (install counts, download analytics)
|
||||
- [ ] Publisher namespaces (`publisher.plugin-name`)
|
||||
|
||||
---
|
||||
|
||||
## Stage 7: Cloud Platform & Accounts
|
||||
**Demo:** "User registers, gets [user].app.worldwideview.dev, installs plugins from marketplace."
|
||||
|
||||
- [ ] `app.worldwideview.dev` — auth/register/dashboard
|
||||
- [ ] Auto-provisioning on signup (tenant DB row → instance live immediately)
|
||||
- [ ] RLS tenant isolation in PostgreSQL
|
||||
- [ ] Cloud edition adapters (`auth.ts`, `storage.ts`, `tenant.ts`)
|
||||
- [ ] Runtime settings store + setup wizard
|
||||
- [ ] License key validation with RSA public key
|
||||
- [ ] Tier gating (free/pro/enterprise feature flags)
|
||||
- [ ] Cloudflare Turnstile + nginx rate limiting for bot prevention
|
||||
- [ ] SSO: marketplace redirects to `app.worldwideview.dev` for login
|
||||
|
||||
---
|
||||
|
||||
## Stage 8: Built-In Data Services
|
||||
**Demo:** "Aviation and maritime data with full history, served from api.worldwideview.dev."
|
||||
|
||||
- [ ] `api.worldwideview.dev` — aviation/maritime polling + persistence
|
||||
- [ ] Redesign aviation as declarative plugin pointing to `api.worldwideview.dev`
|
||||
- [ ] Redesign maritime the same way
|
||||
- [ ] History/timeline with `%t` parameter substitution
|
||||
- [ ] Snapshot capture (pro tier — counts toward storage quota)
|
||||
- [ ] API key proxy with per-tenant-per-plugin rate limiting and response caching
|
||||
|
||||
---
|
||||
|
||||
## Stage 9: Trust Tiers, Extensions & Polish
|
||||
**Demo:** "Install a verified extension plugin that adds cockpit view to aviation."
|
||||
|
||||
- [x] Ed25519-signed plugin registry (`GET /api/registry` on marketplace)
|
||||
- [x] Server-side trust stamping at install time
|
||||
- [x] Trust tier badges (`TrustBadge` component — Official / Verified / Unverified)
|
||||
- [x] Unverified plugin warning dialog (`UnverifiedPluginDialog` + `useMarketplaceSync`)
|
||||
- [ ] Extension plugin type support in `PluginManager`
|
||||
- [ ] Activation events and contribution points
|
||||
- [ ] Capability enforcement at runtime (`PluginPermissionError`)
|
||||
- [ ] Web Worker sandboxing for unverified plugins (`comlink`)
|
||||
- [ ] Reviews & ratings system
|
||||
- [ ] Extension packs (bundles of related plugins)
|
||||
- [ ] Auto-update mechanism (local: manual opt-in; cloud: automatic CDN swap)
|
||||
- [ ] Plausible/Umami self-hosted analytics
|
||||
|
||||
---
|
||||
|
||||
## Stage 10: Infrastructure & Monetization
|
||||
**Demo:** "Buy Pro, paste license key, unlock snapshot history and higher rate limits."
|
||||
|
||||
- [ ] Coolify on ThinkPad T480s — deploy all services
|
||||
- [ ] Uptime Kuma monitoring (all subdomains)
|
||||
- [ ] Stripe Checkout for license purchase
|
||||
- [ ] Storage quota enforcement (cloud only)
|
||||
- [ ] Stripe Connect for marketplace revenue split on paid plugins
|
||||
- [ ] Cloudflare R2 as CDN for plugin bundles (`cdn.worldwideview.dev`)
|
||||
|
||||
---
|
||||
|
||||
## Resolved Architectural Decisions
|
||||
|
||||
| Decision | Resolution |
|
||||
|---|---|
|
||||
| **License** | EL2.0 for WorldWideView core; Open Source for marketplace |
|
||||
| **Shared types** | `@worldwideview/plugin-sdk` npm package (MIT) |
|
||||
| **Hosting** | Coolify (ThinkPad T480s). Landing page on Vercel (static export) |
|
||||
| **Database** | Supabase PostgreSQL (cloud), SQLite (local), Prisma ORM |
|
||||
| **Tenant isolation** | Row-Level Security (RLS) in shared PostgreSQL |
|
||||
| **User settings** | Runtime settings store in DB, not `.env` |
|
||||
| **Bot prevention** | Email verification + Cloudflare Turnstile + rate limiting |
|
||||
| **Plugin execution** | Client-side (browser), not server-side |
|
||||
| **Plugin architecture** | VS Code model — activation events, contribution points, namespaces |
|
||||
| **Server-side compute** | Not supported — third-party backends handle compute |
|
||||
| **Auth** | Auth.js on `app.worldwideview.dev`. `Credentials` (local), `@auth/supabase-adapter` (cloud). Marketplace uses SSO redirect |
|
||||
| **Instance provisioning** | Auto-provision on signup — just a DB row insert |
|
||||
| **API proxy** | `apikey` plugins routed through cached proxy, per-tenant-per-plugin rate limits |
|
||||
| **History** | Third-party `historyUrl` with `%t` (all tiers), WWV snapshot capture (pro only) |
|
||||
| **Built-in data** | Aviation/maritime → declarative plugins → `api.worldwideview.dev` |
|
||||
| **CI/CD** | GitHub Actions → GHCR → Coolify webhook |
|
||||
| **Plugin trust registry** | Ed25519-signed JSON, public key hardcoded in WWV, trust stamped server-side at install |
|
||||
| **Package manager** | pnpm workspaces (migrated from npm) |
|
||||
| **NPM submission flow** | Admin enters package name → marketplace infers manifest from `"worldwideview"` block in `package.json` |
|
||||
| **NPM caching** | `NpmCache` table decouples marketplace from live NPM registry |
|
||||
@@ -1,46 +0,0 @@
|
||||
# WorldWideView — Phase 1 MVP Task Breakdown
|
||||
|
||||
## Planning
|
||||
- [/] Explore existing codebase and understand project state
|
||||
- [/] Write implementation plan for Phase 1 MVP
|
||||
- [ ] Get user approval on implementation plan
|
||||
|
||||
## Phase 1: Project Scaffolding
|
||||
- [ ] Initialize Next.js + TypeScript project with App Router
|
||||
- [ ] Configure CesiumJS integration (Webpack, static assets, SSR bypass)
|
||||
- [ ] Set up design system (CSS custom properties, glassmorphism, typography)
|
||||
- [ ] Configure Zustand state management
|
||||
- [ ] Set up path aliases and project structure
|
||||
|
||||
## Phase 2: Core Globe Component
|
||||
- [ ] Implement `GlobeView.tsx` — CesiumJS viewer with Google 3D Tiles
|
||||
- [ ] Implement `CameraController.ts` — cinematic fly-to, orbit mode, presets
|
||||
- [ ] Implement `LayerRenderer.ts` — entity rendering, clustering, progressive disclosure
|
||||
- [ ] Implement `TimelineSync.ts` — clock sync, time-window filtering, playback
|
||||
|
||||
## Phase 3: Plugin System
|
||||
- [ ] Define `PluginTypes.ts` — `WorldPlugin` interface, `GeoEntity`, `LayerConfig`
|
||||
- [ ] Implement `PluginManager.ts` — lifecycle, polling, data routing
|
||||
- [ ] Implement `PluginRegistry.ts` — static + dynamic registration
|
||||
- [ ] Implement `DataBus.ts` — event bus for cross-plugin communication
|
||||
- [ ] Implement `CacheLayer.ts` — in-memory + IndexedDB caching
|
||||
- [ ] Implement `PollingManager.ts` — per-plugin refresh
|
||||
|
||||
## Phase 4: Built-in Plugins (MVP)
|
||||
- [ ] Aviation plugin (OpenSky Network)
|
||||
- [ ] Maritime plugin (AIS feeds)
|
||||
- [ ] Wildfire plugin (NASA FIRMS)
|
||||
- [ ] Backend API proxy routes for each plugin
|
||||
|
||||
## Phase 5: UI Components
|
||||
- [ ] `AppShell.tsx` — full-viewport layout with floating panels
|
||||
- [ ] `Header.tsx` — branding, search, region presets, time selector
|
||||
- [ ] `LayerPanel.tsx` — toggleable layer list grouped by category
|
||||
- [ ] `Timeline.tsx` — horizontal scrubber with playback controls
|
||||
- [ ] `IntelPanel.tsx` — entity detail and intelligence sidebar
|
||||
- [ ] Global CSS design system (dark mode, glassmorphism, animations)
|
||||
|
||||
## Phase 6: Verification
|
||||
- [ ] Build verification (`npm run build` + type-check)
|
||||
- [ ] Browser verification — globe renders, layers toggle, camera presets work
|
||||
- [ ] Manual verification — time scrubbing, responsive layout, API proxies
|
||||
@@ -0,0 +1 @@
|
||||
{"message":"fix(aviation): implement exponential backoff for rate limits","tree":"55c74a09dac7ce178ecf94d5cb48b2502e57e759","parents":["e25ddc0b648b757ea32b7376bab50d8e75d6d330"]}
|
||||
@@ -0,0 +1,54 @@
|
||||
const fs = require("fs");
|
||||
const { execSync } = require("child_process");
|
||||
|
||||
const uuidsToDelete = [
|
||||
"i331gbc1zzytx7via8lntdm6",
|
||||
"pow71xsobdas7etf5r3hy5ug",
|
||||
"l79dyd03lhtcpgi7swkoxm55",
|
||||
"ry6160tpy4gh2xjfwr011no0",
|
||||
"gfe78t8jm53lltentz19ze60",
|
||||
"e1cg7q8khyvpti5rkp351559",
|
||||
"c35cvvqxhdbslk8yc24g04wk",
|
||||
"ijj9pqkavlusy2wmzsbjtc74",
|
||||
"ghe6bzlr6ex6j51lgxzyhd46",
|
||||
"h3v45w2u1essulzeg56i27a3",
|
||||
"oxk05amog4fla0lskmkfx64x",
|
||||
"yxm4mn60lfp9qah0q4yf2hij",
|
||||
"ezjxo4ehs96lv0ji1n2r0auw",
|
||||
"t12x7pgptsqiu5gbvv35gun5",
|
||||
"urq1ll00a3vv9on6pulmpofe",
|
||||
"eb5zgw5wlgvio2gggbiphpam",
|
||||
"ld1h3pody4nxj3b44pbskl53",
|
||||
"x111xfygqxrlbf5wqlx59f6d",
|
||||
"se1weqr4dj7thp4p1l055wfc",
|
||||
"cqses6urxff0n94i0u6lktzt",
|
||||
"nvcir33nyuvzk5niy3s7eg9w",
|
||||
"s63onga2s6v8r3k10lrdwzth",
|
||||
"cf3uedqnjmwv48h7tm91d95r",
|
||||
"o9124dnnieau9wxoefyxvfgu",
|
||||
"kxzobc8qlvigbsk1d35dpiyi",
|
||||
"eh8lzjbsy2c9kwj2emztcmf6",
|
||||
"umfsos2vcmotfk2cfpqdoycc",
|
||||
"yn1mdh0fngiati6r4625qvv9"
|
||||
];
|
||||
|
||||
const token = "1|vPZPgvB8vVi8ZD5ZKS8lrCrwNlPofVv4I8Tjmqmyd01f92d2";
|
||||
const baseUrl = "https://coolify.worldwideview.dev/api/v1";
|
||||
const appUuid = "nmn55t4io3myfubs72worn7k";
|
||||
|
||||
async function run() {
|
||||
for (const id of uuidsToDelete) {
|
||||
console.log("Deleting", id);
|
||||
try {
|
||||
const res = await fetch(`${baseUrl}/applications/${appUuid}/envs/${id}`, {
|
||||
method: "DELETE",
|
||||
headers: { "Authorization": `Bearer ${token}` }
|
||||
});
|
||||
console.log(id, res.status);
|
||||
} catch(e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
@@ -0,0 +1,21 @@
|
||||
services:
|
||||
wwv:
|
||||
build: .
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- wwv-data:/app/data
|
||||
env_file:
|
||||
- path: .env
|
||||
required: false
|
||||
environment:
|
||||
- "AUTH_SECRET=${AUTH_SECRET:-default_secret_for_local_dev}"
|
||||
- "WWV_DEMO_ADMIN_SECRET=${WWV_DEMO_ADMIN_SECRET:-}"
|
||||
- "WWV_BRIDGE_TOKEN=${WWV_BRIDGE_TOKEN:-}"
|
||||
|
||||
volumes:
|
||||
wwv-data:
|
||||
|
||||
networks:
|
||||
coolify:
|
||||
external: true
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
# ─── Docker Entrypoint ───────────────────────────────────────
|
||||
# Ensures the SQLite database exists and is migrated before
|
||||
# starting the application. On first run with a fresh volume
|
||||
# the DB file won't exist yet, so we run prisma migrate deploy.
|
||||
|
||||
set -e
|
||||
|
||||
mkdir -p ./data
|
||||
echo "[entrypoint] Running database migrations..."
|
||||
npx -y prisma migrate deploy
|
||||
echo "[entrypoint] Migrations complete."
|
||||
|
||||
exec node server.js
|
||||
+19
-56
@@ -1,62 +1,25 @@
|
||||
<!-- Generated: 2026-04-19 15:23:00 UTC -->
|
||||
# System Architecture
|
||||
|
||||
WorldWideView is a high-performance, event-driven geospatial intelligence engine. It is designed to ingest live, fast-moving signals—such as aviation ADS-B, maritime AIS, or satellite feeds—and transform them into cinematic, real-time visual layers on a 3D globe.
|
||||
WorldWideView operates on a decoupled Core-and-Plugin architecture. The central platform provides the 3D globe, HUD, timeline, and rendering optimizations, while separate intelligence domains are entirely handled by external plugin packages that are bundled and ingested at runtime.
|
||||
|
||||
## Module Breakdown
|
||||
The underlying data backbone uses a WebSocket Firehose, streaming continuous high-frequency metrics from standalone data engine microservices perfectly isolated from the visualization layer.
|
||||
|
||||
1. **`src/core/plugins`**: The registration and lifecycle management layer. Defines how plugins are booted and destroyed.
|
||||
2. **`src/core/data`**: The "Heartbeat" of the system.
|
||||
- **DataBus**: Decentralized event pipeline for all system actions.
|
||||
- **PollingManager**: Intelligent scheduler for external API calls with backoff logic.
|
||||
- **CacheLayer**: 2-stage persistent caching (In-Memory + IndexedDB).
|
||||
3. **`src/core/globe`**: The Rendering Engine.
|
||||
- **Cesium Integration**: Low-level control over the Cesium Viewer.
|
||||
- **EntityRenderer**: High-performance "Primitive" renderer.
|
||||
4. **`src/plugins`**: Domain-specific logic (Aviation, Maritime, etc.).
|
||||
## Component Map
|
||||
- **UI Platform:** `src/components/layout/AppShell.tsx`
|
||||
- **3D Visualizer:** `src/core/globe/GlobeView.tsx`
|
||||
- **State Store:** `src/core/state/globeSlice.ts` and peers.
|
||||
- **Event Bus:** `src/core/data/DataBus.ts`
|
||||
- **Microservice Connectors:** `packages/wwv-plugin-sdk/src/PluginManifest.ts`
|
||||
|
||||
## Performance: Primitives vs. Entities
|
||||
## Key Files
|
||||
- `src/core/globe/GlobeView.tsx` (lines 60-150): The central CesiumJS ingestion point and scene orchestrator.
|
||||
- `src/core/globe/EntityRenderer.tsx` (lines 45-120): High-performance batched Primitive mapping for geometric entities.
|
||||
- `src/core/plugins/PluginManager.ts` (lines 20-100): Validates and bootstraps compiled ES Modules from CDN/local sources.
|
||||
|
||||
One of our core design decisions is using **Cesium Primitives** instead of the standard high-level **Entity API** for high-count datasets.
|
||||
|
||||
| Feature | Entity API | Primitive API (WWV) |
|
||||
|---|---|---|
|
||||
| **Abstration** | High (Easy to use) | Low (Direct GPU access) |
|
||||
| **Overhead** | Significant per-entity JS objects | Minimal (Batched rendering) |
|
||||
| **Max Capacity** | ~1,000 entities | **100,000+ points/billboards** |
|
||||
| **WWV Use Case** | Info window content | Live data point visualization |
|
||||
|
||||
**Why?** The Entity API in Cesium is great for rich features but triggers significant CPU overhead when managing thousands of moving objects. By using `PointPrimitiveCollection` and `BillboardCollection`, WorldWideView batches these draw calls, ensuring 60FPS even with dense global data.
|
||||
|
||||
## Data Pipeline (Example: Aviation)
|
||||
|
||||
The following diagram trace the journey of a single data point from a remote sensor to the user's screen:
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant S as Remote API (e.g. OpenSky)
|
||||
participant P as Plugin (AviationPlugin)
|
||||
participant D as DataBus
|
||||
participant R as EntityRenderer
|
||||
participant G as GPU (Cesium)
|
||||
|
||||
Note over S, P: Polling Interval (e.g. 30s)
|
||||
S->>P: raw JSON data
|
||||
rect rgb(200, 230, 255)
|
||||
Note right of P: Mapping to GeoEntity
|
||||
P->>P: parse, filter, sanitize
|
||||
end
|
||||
P->>D: emit("dataUpdated", { entities })
|
||||
D->>R: trigger render cycle
|
||||
rect rgb(255, 230, 200)
|
||||
Note right of R: Batch Update Primitives
|
||||
R->>G: update collection buffer
|
||||
end
|
||||
G-->>G: 60FPS visualization
|
||||
```
|
||||
|
||||
## Design Principles
|
||||
|
||||
- **Single Responsibility (SRP)**: Plugins only handle data mapping; they don't know about the UI or the Cache.
|
||||
- **Dependency Inversion**: The `PluginManager` communicates with plugins through the `WorldPlugin` interface, allowing new plugins to be added without modifying core code.
|
||||
- **Event-Driven Architecture**: The system is reactive. Components subscribe to what they need, reducing prop-drilling and unnecessary re-renders.
|
||||
- **Defensive Programming**: All external API calls in plugins are wrapped in error boundaries and handled by the `PollingManager`'s backoff logic to prevent system-wide failures.
|
||||
## Data Flow
|
||||
The real-time data flow triggers globally via WebSockets:
|
||||
1. `src/lib/WsClient.ts` captures the socket frame from `dataengine.worldwideview.dev`.
|
||||
2. Emits payload through `src/core/data/DataBus.ts` (lines 30-50).
|
||||
3. The `DataBusSubscriber.tsx` hook catches the event, sanitizing and merging the data into `src/core/state/dataSlice.ts`.
|
||||
4. `EntityRenderer` automatically reacts to State changes, triggering low-level Cesium Primitive re-draws against the GPU.
|
||||
+22
-28
@@ -5,46 +5,40 @@ Follow these steps to set up your development environment and get WorldWideView
|
||||
## Requirements
|
||||
|
||||
- **Node.js**: v18.17 or higher (tested on v20+)
|
||||
- **NPM**: v9 or higher
|
||||
- **pnpm**: v8 or higher (`npm install -g pnpm`)
|
||||
- **Browser**: Chrome, Firefox, or Edge (CesiumJS requires WebGL support)
|
||||
|
||||
## Environment Setup
|
||||
|
||||
WorldWideView requires several API keys to function correctly. You can copy the provided `.env.example` file to `.env.local` and fill in the values:
|
||||
Run the setup script to auto-generate `.env.local` with a secure `AUTH_SECRET`:
|
||||
|
||||
```bash
|
||||
cp .env.example .env.local
|
||||
pnpm run setup
|
||||
```
|
||||
|
||||
Or manually create a `.env.local` file in the root directory:
|
||||
This copies `.env.example` → `.env.local` and fills in `AUTH_SECRET` automatically. You can then optionally add API keys for enhanced features (Cesium Ion, Bing Maps, OpenSky, etc.).
|
||||
|
||||
```env
|
||||
# Cesium Ion Access Token (Required for terrain and default imagery)
|
||||
NEXT_PUBLIC_CESIUM_ION_TOKEN=your_token_here
|
||||
|
||||
# Bing Maps API Key (Optional, for high-res imagery)
|
||||
NEXT_PUBLIC_BING_MAPS_KEY=your_key_here
|
||||
|
||||
# Supabase Configuration (Required for persistence and historical data)
|
||||
NEXT_PUBLIC_SUPABASE_URL=your_project_url
|
||||
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key
|
||||
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
|
||||
```
|
||||
> [!NOTE]
|
||||
> `AUTH_SECRET` must remain stable across restarts. The setup script generates it once and writes it to `.env.local`. Never commit `.env.local` to git.
|
||||
|
||||
## Running Locally
|
||||
|
||||
1. **Install Dependencies**:
|
||||
```bash
|
||||
npm install
|
||||
pnpm install
|
||||
```
|
||||
|
||||
2. **Start Dev Server**:
|
||||
2. **Generate environment file** (first time only):
|
||||
```bash
|
||||
npm run dev
|
||||
pnpm run setup
|
||||
```
|
||||
*Note: Our `dev` script automatically runs `predev` to copy Cesium assets to the public directory.*
|
||||
|
||||
3. **Open Browser**:
|
||||
3. **Start Dev Server**:
|
||||
```bash
|
||||
pnpm run dev:all
|
||||
```
|
||||
|
||||
4. **Open Browser**:
|
||||
Navigate to [http://localhost:3000](http://localhost:3000).
|
||||
|
||||
## Folder Structure Explanation
|
||||
@@ -53,9 +47,9 @@ Understanding the project layout:
|
||||
|
||||
```text
|
||||
worldwideview/
|
||||
├── .agents/ # Agentic AI workflows and memory
|
||||
├── docs/ # Project documentation (Markdowns)
|
||||
├── public/ # Static assets (Imagery, GeoJSON, Cesium dependencies)
|
||||
├── docs/ # Project documentation
|
||||
├── packages/ # Plugin packages (pnpm workspaces)
|
||||
├── public/ # Static assets (GeoJSON data files, Cesium dependencies)
|
||||
├── scripts/ # Build and utility scripts (e.g., copy-cesium.mjs)
|
||||
└── src/
|
||||
├── app/ # Next.js App Router (Layouts, Pages, API Routes)
|
||||
@@ -64,8 +58,8 @@ worldwideview/
|
||||
│ ├── data/ # Data management (DataBus, Polling, Cache)
|
||||
│ ├── globe/ # Cesium-specific hooks and view logic
|
||||
│ └── plugins/ # Plugin system base and registry
|
||||
├── lib/ # Utility libraries and server-side polling
|
||||
└── plugins/ # Feature-specific plugins (Aviation, Maritime, etc.)
|
||||
├── lib/ # Utility libraries and server-side logic
|
||||
└── plugins/ # Built-in plugins (Aviation, Maritime, etc.)
|
||||
```
|
||||
|
||||
## Verification
|
||||
@@ -77,5 +71,5 @@ To verify your setup:
|
||||
|
||||
---
|
||||
|
||||
> [!IMPORTANT]
|
||||
> If you encounter issues with hot reloading (HMR), ensure you are running with the `--webpack` flag in the dev script (this is the default in our `package.json`).
|
||||
> [!TIP]
|
||||
> The database is created automatically on first run — no manual setup is required. If you need to reset it, delete `data/wwv.db` and restart the dev server.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 816 KiB |
@@ -0,0 +1,20 @@
|
||||
<!-- Generated: 2026-04-19 15:23:00 UTC -->
|
||||
# Build System
|
||||
|
||||
WorldWideView operates using a strict `pnpm` monorepo workspace to manage the core Next.js application alongside its surrounding plugin ecosystem.
|
||||
|
||||
The build relies heavily on Next.js standalone output tracing optimization, allowing minimal-footprint Docker images via Multi-stage resolution.
|
||||
|
||||
## Key Files
|
||||
- `pnpm-workspace.yaml`: Governs the inclusion of `packages/*` elements.
|
||||
- `next.config.ts` (lines 10-45): Implements `output: "standalone"` and strict Content-Security-Policy headers.
|
||||
- `Dockerfile` (lines 1-110): Executes the multi-stage Extractor Pattern (`deps` → `builder` → `runner`).
|
||||
|
||||
## Build Workflows
|
||||
- **Dependency Install:** `pnpm install` must be run from the root directory to respect strict workspace hoisting natively.
|
||||
- **Development Proxy:** `pnpm dev` triggers the frontend server locally with active HMR, while executing pre-build scripts like `copy-cesium.mjs`.
|
||||
- **Plugin Compilation:** Run `pnpm -r build` inside `packages/worldwideview-plugins/` to trigger Vite bundle execution mapped to `dist/frontend.mjs`.
|
||||
|
||||
## Platform Setup
|
||||
- **Cesium Resources:** Required assets (Workers, Assets, Widgets) are structurally bound into the `public/cesium/` folder during the pre-build pipeline initialized by `scripts/copy-cesium.mjs` (lines 10-38).
|
||||
- **SQLite Engine:** `prisma.config.ts` must export native javascript objects (free of dev CLI wrappers) for Next.js to trace correctly in the final standalone Node build.
|
||||
@@ -0,0 +1,344 @@
|
||||
# Creating a WorldWideView Plugin
|
||||
|
||||
This guide walks you through building, publishing, and listing your own WorldWideView plugin from scratch.
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
WorldWideView plugins display geospatial data on a 3D Cesium globe. Every plugin must implement the `WorldPlugin` interface from the **Plugin SDK** (`@worldwideview/wwv-plugin-sdk`).
|
||||
|
||||
There are **three plugin formats**:
|
||||
|
||||
| Format | Use Case | Example |
|
||||
|---|---|---|
|
||||
| **`static`** | GeoJSON file loaded at startup — no API calls at runtime | Military Bases, Nuclear Facilities, Embassies |
|
||||
| **`bundle`** | Full TypeScript class with custom logic, live API data, UI components | Aviation, Maritime, Wildfire |
|
||||
| **`declarative`** | JSON-only manifest that points to an external API — no code needed | *(Future)* |
|
||||
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Node.js ≥ 18
|
||||
- An NPM account (for publishing)
|
||||
- A running WorldWideView instance (local clone or Docker container)
|
||||
|
||||
---
|
||||
|
||||
## Step 1 — Scaffold Your Plugin
|
||||
|
||||
WorldWideView plugins are strictly decoupled from the core application. You do **not** build them inside the WorldWideView monorepo. Instead, use the official CLI tool:
|
||||
|
||||
```bash
|
||||
npx @worldwideview/create-plugin@latest my-data-layer
|
||||
cd my-data-layer
|
||||
npm install
|
||||
```
|
||||
|
||||
This will generate a ready-to-use template including your `package.json`, `plugin.json`, and Vite build configuration.
|
||||
|
||||
### Linking During Development
|
||||
|
||||
To see your plugin live on the globe while you develop:
|
||||
|
||||
1. Configure your CLI to point to your running WorldWideView instance:
|
||||
```bash
|
||||
npx wwv config set wwv-path C:\path\to\your\worldwideview
|
||||
```
|
||||
2. Link the plugin:
|
||||
```bash
|
||||
npm run link
|
||||
```
|
||||
3. Run the dev watcher to rebuild on save:
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
*Note: If you are running WorldWideView via Docker, ensure `WWV_PLUGIN_DEV=true` is set in your environment variables and mount your plugin's `dist/` folder into the container's `/app/plugins-local/` directory.*
|
||||
|
||||
> [!IMPORTANT]
|
||||
> The `worldwideview` object block inside your `package.json` is strictly required for the CLI link command and if you intend to publish your plugin to the WorldWideView Marketplace. The marketplace uses this internal manifest to determine how to categorize and display your plugin automatically.
|
||||
> * `id`: The unique string identifier.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> The SDK is declared as a **peer dependency**, not a direct dependency. The host application provides it at runtime.
|
||||
|
||||
---
|
||||
|
||||
## Step 2 — Write Your Plugin Code
|
||||
|
||||
Create `src/index.ts`. Here are examples for the two most common formats:
|
||||
|
||||
### Option A — Static GeoJSON Plugin (simplest)
|
||||
|
||||
For static plugins, the npm package is just metadata. The actual loading is handled by the `StaticDataPlugin` loader at runtime, driven by a manifest + GeoJSON file.
|
||||
|
||||
```typescript
|
||||
/**
|
||||
* @worldwideview/wwv-plugin-my-data
|
||||
*
|
||||
* Static GeoJSON plugin — my custom dataset.
|
||||
*
|
||||
* This package exists for npm registry metadata. The actual plugin logic
|
||||
* is handled by WorldWideView's StaticDataPlugin loader at runtime using
|
||||
* the manifest + GeoJSON data file served from the host application.
|
||||
*/
|
||||
export const PLUGIN_ID = "my-data" as const;
|
||||
```
|
||||
|
||||
For static plugins you also need:
|
||||
1. A **GeoJSON file** placed at `public/data/my_data.geojson` in the main app
|
||||
2. A **manifest entry** in the marketplace (see Step 4)
|
||||
|
||||
### Option B — Bundle Plugin (full control)
|
||||
|
||||
For bundle plugins, you write a class that implements the `WorldPlugin` interface:
|
||||
|
||||
```typescript
|
||||
import type {
|
||||
WorldPlugin,
|
||||
GeoEntity,
|
||||
TimeRange,
|
||||
PluginContext,
|
||||
LayerConfig,
|
||||
CesiumEntityOptions,
|
||||
} from "@worldwideview/wwv-plugin-sdk";
|
||||
|
||||
export class MyDataPlugin implements WorldPlugin {
|
||||
// ─── Required Metadata ──────────────────────────────
|
||||
id = "my-data";
|
||||
name = "My Data Layer";
|
||||
description = "Displays custom points on the globe.";
|
||||
icon = "MapPin"; // Lucide icon name (string)
|
||||
category = "custom" as const;
|
||||
version = "1.0.0";
|
||||
|
||||
// ─── Lifecycle ──────────────────────────────────────
|
||||
async initialize(ctx: PluginContext): Promise<void> {
|
||||
// Called once when the plugin is loaded.
|
||||
// Use ctx.apiBaseUrl, ctx.timeRange, ctx.onDataUpdate, etc.
|
||||
}
|
||||
|
||||
destroy(): void {
|
||||
// Called when the plugin is unloaded. Clean up timers, sockets, etc.
|
||||
}
|
||||
|
||||
// ─── Data ───────────────────────────────────────────
|
||||
async fetch(timeRange: TimeRange): Promise<GeoEntity[]> {
|
||||
// Fetch your data from an API and return GeoEntity objects.
|
||||
const res = await fetch("https://api.example.com/points");
|
||||
const data = await res.json();
|
||||
|
||||
return data.map((item: any) => ({
|
||||
id: String(item.id),
|
||||
pluginId: this.id,
|
||||
latitude: item.lat,
|
||||
longitude: item.lon,
|
||||
altitude: 0,
|
||||
timestamp: new Date(),
|
||||
label: item.name,
|
||||
properties: { type: item.type },
|
||||
}));
|
||||
}
|
||||
|
||||
getPollingInterval(): number {
|
||||
return 60_000; // Re-fetch every 60 seconds
|
||||
}
|
||||
|
||||
// ─── Rendering ──────────────────────────────────────
|
||||
getLayerConfig(): LayerConfig {
|
||||
return {
|
||||
color: "#3b82f6",
|
||||
clusterEnabled: true,
|
||||
clusterDistance: 40,
|
||||
maxEntities: 5000,
|
||||
};
|
||||
}
|
||||
|
||||
renderEntity(entity: GeoEntity): CesiumEntityOptions {
|
||||
return {
|
||||
type: "point",
|
||||
color: "#3b82f6",
|
||||
size: 8,
|
||||
};
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Step 3 — Publish to npm
|
||||
|
||||
```bash
|
||||
cd packages/wwv-plugin-my-data
|
||||
pnpm publish --access public
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> The marketplace pulls metadata (version, description, keywords, readme) directly from the npm registry. You do not need to duplicate this information anywhere else.
|
||||
|
||||
---
|
||||
|
||||
## Step 4 — Submit to the Marketplace
|
||||
|
||||
Once your package is published to npm, submit it for listing in the WorldWideView Marketplace:
|
||||
|
||||
1. Go to [marketplace.worldwideview.dev/submit](https://marketplace.worldwideview.dev/submit) (or open the Admin UI on a local marketplace instance)
|
||||
2. Enter your **npm package name** (e.g. `@worldwideview/wwv-plugin-my-data`)
|
||||
3. The marketplace automatically fetches your metadata from npm and reads the `"worldwideview"` block from your `package.json`
|
||||
4. Your plugin enters a **pending** state for review
|
||||
5. Once approved, it appears in the browse catalog
|
||||
|
||||
> [!IMPORTANT]
|
||||
> The `"worldwideview"` block in your `package.json` is required for submission. Make sure `id`, `icon`, `category`, and `format` are correctly set before publishing.
|
||||
|
||||
### For static format plugins
|
||||
|
||||
If your plugin uses `"format": "static"`, your **GeoJSON file** must be hosted and accessible at a public URL, or included in the `public/data/` folder of the host WorldWideView application. The `dataFile` path in your manifest should point to that URL.
|
||||
|
||||
If you are contributing a plugin for inclusion in the official WorldWideView release, place the GeoJSON at `public/data/<name>.geojson` and open a pull request.
|
||||
|
||||
---
|
||||
|
||||
## Step 5 — Test Locally
|
||||
|
||||
1. Start all WorldWideView services: `pnpm run dev:all` (in the monorepo root)
|
||||
2. (Wait for both the main app and marketplace to start)
|
||||
3. Open the marketplace at `http://localhost:3001/browse`
|
||||
4. Find your plugin and click **Install**
|
||||
5. Verify the data appears on the globe at `http://localhost:3000`
|
||||
|
||||
---
|
||||
|
||||
## SDK Interface Reference
|
||||
|
||||
The `WorldPlugin` interface requires these properties and methods:
|
||||
|
||||
### Required Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
|---|---|---|
|
||||
| `id` | `string` | Unique plugin identifier (e.g., `"my-data"`) |
|
||||
| `name` | `string` | Display name shown in the sidebar |
|
||||
| `description` | `string` | Short description |
|
||||
| `icon` | `string \| ComponentType` | Lucide icon name or React component |
|
||||
| `category` | `PluginCategory` | One of: `aviation`, `maritime`, `conflict`, `natural-disaster`, `infrastructure`, `cyber`, `economic`, `custom` |
|
||||
| `version` | `string` | Semver version string |
|
||||
|
||||
### Required Methods
|
||||
|
||||
| Method | Returns | Description |
|
||||
|---|---|---|
|
||||
| `initialize(ctx)` | `Promise<void>` | Set up the plugin. Receives `PluginContext` with API URLs, time range, callbacks |
|
||||
| `destroy()` | `void` | Clean up resources (timers, sockets, etc.) |
|
||||
| `fetch(timeRange)` | `Promise<GeoEntity[]>` | Return the data to display on the globe |
|
||||
| `getPollingInterval()` | `number` | Milliseconds between `fetch()` calls |
|
||||
| `getLayerConfig()` | `LayerConfig` | Layer appearance (color, clustering, limits) |
|
||||
| `renderEntity(entity)` | `CesiumEntityOptions` | How each entity renders on the globe |
|
||||
|
||||
### Optional Methods
|
||||
|
||||
| Method | Returns | Description |
|
||||
|---|---|---|
|
||||
| `getSelectionBehavior(entity)` | `SelectionBehavior \| null` | Trail / fly-to on click |
|
||||
| `getServerConfig()` | `ServerPluginConfig` | Server-side API routing |
|
||||
| `getFilterDefinitions()` | `FilterDefinition[]` | Declarative filter UI |
|
||||
| `getSidebarComponent()` | `ComponentType` | Custom sidebar panel |
|
||||
| `getDetailComponent()` | `ComponentType<{ entity }>` | Custom detail panel |
|
||||
| `getSettingsComponent()` | `ComponentType<{ pluginId }>` | Custom settings panel |
|
||||
|
||||
### Key Types
|
||||
|
||||
```typescript
|
||||
interface GeoEntity {
|
||||
id: string;
|
||||
pluginId: string;
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
altitude?: number;
|
||||
heading?: number;
|
||||
speed?: number;
|
||||
timestamp: Date;
|
||||
label?: string;
|
||||
properties: Record<string, unknown>;
|
||||
}
|
||||
|
||||
interface LayerConfig {
|
||||
color: string;
|
||||
iconUrl?: string;
|
||||
clusterEnabled: boolean;
|
||||
clusterDistance: number;
|
||||
minZoomLevel?: number;
|
||||
maxEntities?: number;
|
||||
}
|
||||
|
||||
interface CesiumEntityOptions {
|
||||
type: "billboard" | "point" | "polyline" | "polygon" | "label" | "model";
|
||||
color?: string;
|
||||
size?: number;
|
||||
iconUrl?: string;
|
||||
rotation?: number;
|
||||
modelUrl?: string;
|
||||
modelScale?: number;
|
||||
// ... more options
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Real Examples
|
||||
|
||||
### Borders Plugin (bundle format)
|
||||
|
||||
A minimal bundle plugin that implements the `WorldPlugin` interface directly:
|
||||
|
||||
- **Source**: `packages/wwv-plugin-borders/src/index.ts`
|
||||
- **npm**: `@worldwideview/wwv-plugin-borders`
|
||||
|
||||
### Military Bases Plugin (static format)
|
||||
|
||||
A static GeoJSON plugin where the npm package is just metadata:
|
||||
|
||||
- **Source**: `packages/wwv-plugin-military-bases/src/index.ts`
|
||||
- **GeoJSON**: `public/data/military_bases.geojson`
|
||||
- **npm**: `@worldwideview/wwv-plugin-military-bases`
|
||||
- **Manifest**: Defined in `worldwideview-marketplace/src/data/pluginManifests.ts`
|
||||
|
||||
---
|
||||
|
||||
## How It All Connects
|
||||
|
||||
```
|
||||
Developer writes plugin
|
||||
│
|
||||
▼
|
||||
Publish to npm ► npm registry (stores version, description, keywords, readme)
|
||||
│
|
||||
▼
|
||||
Submit npm package name to Marketplace
|
||||
│
|
||||
▼
|
||||
Marketplace fetches metadata from npm ← npm registry
|
||||
and reads the "worldwideview" block from package.json
|
||||
│
|
||||
▼
|
||||
Review → Plugin appears in browse catalog
|
||||
│
|
||||
▼
|
||||
User clicks "Install"
|
||||
│
|
||||
▼
|
||||
Marketplace sends manifest to WorldWideView instance
|
||||
│
|
||||
▼
|
||||
Plugin saved to database (Prisma) → loaded on next startup
|
||||
│
|
||||
▼
|
||||
loadPluginFromManifest() routes by format:
|
||||
static → StaticDataPlugin (GeoJSON loader)
|
||||
bundle → dynamic import()
|
||||
│
|
||||
▼
|
||||
Plugin renders on the 3D globe
|
||||
```
|
||||
@@ -0,0 +1,18 @@
|
||||
<!-- Generated: 2026-04-19 15:23:00 UTC -->
|
||||
# Deployment
|
||||
|
||||
WorldWideView is container-first. The codebase relies entirely on Dockerizing the Next.js `output: "standalone"` artifact and its localized Prisma SQLite core to enable horizontal orchestration.
|
||||
|
||||
Deployments are coordinated directly via Coolify natively compiling the Docker configurations.
|
||||
|
||||
## Package Types
|
||||
- **Next.js Core Bundle:** Built directly via `pnpm build`, extracting into `<root>/.next/standalone`.
|
||||
- **Plugin Microservices:** Hosted alongside the Next.js router natively using Fastify images (defined in `docker-compose.yml`), enabling real-time Python/Node scraping backends exclusively connected via docker network aliases.
|
||||
- **CDN ESM Bundles:** Independent frontend plugins run via Vite rollup configurations (`vite.config.ts`), generating `dist/frontend.mjs` payloads published to the public NPM registry.
|
||||
|
||||
## Platform Deployment
|
||||
- **Dockerfile:** `Dockerfile` explicitly targets `node:22-alpine` instances to restrict vulnerability surface areas while mapping the necessary system volume at `/app/data` to capture the `wwv.db` SQLite instantiation safely out-of-container (lines 80-112).
|
||||
- **Environment Hydration:** Coolify directly passes the active environment headers `.env` values at runtime, utilizing `.env.local` natively for credentials like `AUTH_SECRET` and `DATABASE_URL`.
|
||||
|
||||
## Reference
|
||||
The core production mapping operates cleanly off HTTP port `3000`. Refer to `next.config.ts` (lines 5-15) for strict caching strategies utilized globally across deployments.
|
||||
@@ -0,0 +1,26 @@
|
||||
<!-- Generated: 2026-04-19 15:23:00 UTC -->
|
||||
# Development
|
||||
|
||||
Development on WorldWideView leverages modern, rigid structural constraints to ensure cross-plugin consistency, extreme browser optimization, and a minimal global footprint.
|
||||
|
||||
New features are designed within isolated workspaces, using SDK structures rather than forcing logic into the core engine.
|
||||
|
||||
## Code Style
|
||||
- **TypeScript Strictness:** Strict types are enforced across all domains (`tsconfig.json` lines 4-20). Any use of `any` inside platform routers is forbidden.
|
||||
- **Styling constraints:** All CSS is strictly limited to Vanilla CSS via CSS Modules (`.module.css`). Tailwind is prohibited to prevent styling collisions natively with dynamically loaded elements from third-party plugins. (`src/app/globals.css`).
|
||||
|
||||
## Common Patterns
|
||||
- **Env Variable Injection:** Plugins read remote contexts generically instantiated via the SDK.
|
||||
```typescript
|
||||
// From wwv-plugin-aviation/src/index.ts:60-70
|
||||
let engineBase = this.context?.env?.DATA_ENGINE_URL || "https://dataengine.worldwideview.dev";
|
||||
```
|
||||
- **Zustand Slices:** The store is heavily splintered based on structural domain, keeping the hook listeners granular so mapping updates don't aggressively trigger `AppShell` root rerenders. (`src/core/state/globeSlice.ts`).
|
||||
|
||||
## Workflows
|
||||
- **Local Database Setup:** Run `pnpm db:reset` to nuke and redeploy the standard Prisma schema across `data/wwv.db`.
|
||||
- **Generating Plugins:** Use the global CLI `npx @worldwideview/create-plugin@latest <name>` to initialize a decoupled plugin outside of the monorepo.
|
||||
- **Linking Plugins:** Use `npm run link` in the plugin directory after setting `npx wwv config set wwv-path <path>`.
|
||||
|
||||
## Reference
|
||||
File size is constrained to a 150-line soft cap. Hooks and computational math helpers must be rigorously offloaded (e.g. `src/core/globe/hooks/useModelRendering.ts`).
|
||||
@@ -0,0 +1,25 @@
|
||||
<!-- Generated: 2026-04-19 15:23:00 UTC -->
|
||||
# Files Catalog
|
||||
|
||||
WorldWideView maps rigid structural directories to manage its layered microservice architecture, distinguishing tightly between UI layout routing, system memory, 3D visualization, and microservice ingestion mechanisms.
|
||||
|
||||
Every major component is siloed deeply to ensure the monolithic main engine remains perfectly isolated and agnostic to individual data sources.
|
||||
|
||||
## Core Source Files
|
||||
- `src/app/` - The Next.js 16 core routing platform, housing layout constraints, `api/` backends, and full-screen auth portals.
|
||||
- `src/components/` - Segmented React JSX components handling overlay panels, timeline UI, and floating popups.
|
||||
- `src/core/plugins/` - Essential bridge scripts that validate manifested metadata parameters before dynamically allocating JS module environments to run external logic. (`PluginManager.ts`)
|
||||
|
||||
## Platform Implementation
|
||||
- `src/core/globe/GlobeView.tsx` - Initializer mapping global config hooks to the main Cesium `Viewer`.
|
||||
- `src/core/globe/EntityRenderer.tsx` - Extremely hot processing loop extracting Zustand state variables directly to WebGL GPU hardware calls via Cesium Primitives.
|
||||
- `src/core/globe/StackManager.ts` - Spiderifier spatial engine dynamically resolving overlapping coordinate markers geometrically in 3D-space.
|
||||
|
||||
## Build System
|
||||
- `Dockerfile` - Multi-stage container instructions targeting a 110MB production Alpine build footprint.
|
||||
- `next.config.ts` - NextJS 16 overrides forcing standalone rendering extraction and tight CSP headers.
|
||||
- `prisma/schema.prisma` - DB tables strictly configuring Prisma to bind exclusively towards locally-mounted SQLite structures.
|
||||
|
||||
## Configuration
|
||||
- `.agents/` - Complete repository workflow configuration (Antigravity Code). Contains AI `rules/`, `skills/`, and internal architectural `context/` for automatic coordination.
|
||||
- `public/cesium/` - Runtime engine bundles duplicated exclusively during pre-build tracking (copied from `node_modules`).
|
||||
@@ -0,0 +1,21 @@
|
||||
<!-- Generated: 2026-04-19 15:23:00 UTC -->
|
||||
# Project Overview
|
||||
|
||||
WorldWideView is a real-time geospatial intelligence engine that visualizes live global data on an interactive 3D globe. It leverages a modern frontend stack to render high-density datasets (aircraft, maritime vessels, conflict events, environmental data) synchronously.
|
||||
|
||||
The core value proposition is mapping diverse, decoupled intelligence streams onto a central geographic interface using a dynamically loaded plugin architecture. Data sources operate completely decoupled from the display platform, streaming observations via WebSockets for sub-second visual updates.
|
||||
|
||||
## Key Files
|
||||
- `package.json` (lines 1-80) - Core dependencies and project metadata.
|
||||
- `src/app/layout.tsx` (lines 15-40) - Global application shell and React structure.
|
||||
- `src/core/plugins/PluginManager.ts` (lines 20-56) - Heart of the engine, registers and lifecycle-manages external intelligence views.
|
||||
|
||||
## Technology Stack
|
||||
- **Framework:** Next.js 16 (App Router) — `src/app/`
|
||||
- **3D Engine:** CesiumJS + Resium — `src/core/globe/GlobeView.tsx` (lines 40-90)
|
||||
- **State Management:** Zustand — `src/core/state/store.ts` (slice pattern)
|
||||
- **Database:** Prisma ORM w/ SQLite locally — `prisma/schema.prisma`
|
||||
- **Typing:** TypeScript 5 w/ Strict Mode — `tsconfig.json`
|
||||
|
||||
## Platform Support
|
||||
Built as a highly portable Next.js container, it supports `local`, `cloud`, and `demo` editions via the `NEXT_PUBLIC_WWV_EDITION` flag declared in `.env.local` and evaluated at runtime in `src/core/edition.ts`.
|
||||
@@ -0,0 +1,216 @@
|
||||
# Plugin Architecture Migration Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** Migrate the WorldWideView plugin architecture from compile-time hardcoded imports to a dynamic, runtime-loaded ecosystem where external developers can build, host, and distribute plugins without touching the core repository.
|
||||
|
||||
**Architecture:** We will introduce a bundler (`tsup`) to the SDK to compile `bundle` plugins into browser-ready ECMAScript Modules (ESM). We will expose shared dependencies (`react`, `cesium`, `lucide-react`) via a global `window.__WWV_SHARED__` object. Finally, we will refactor `AppShell.tsx` to dynamically load all plugins at runtime via `import(/* webpackIgnore: true */)`, removing the hardcoded imports, and we will update `loadPluginFromManifest.ts` to seamlessly handle the global dependency injection.
|
||||
|
||||
**Tech Stack:** Next.js, React, CesiumJS, tsup.
|
||||
|
||||
---
|
||||
|
||||
## User Review Required
|
||||
|
||||
> [!WARNING]
|
||||
> **Breaking Change**: This migration will decouple your built-in plugins from `AppShell.tsx`. They will now act as true "external" plugins that are loaded at runtime. During the transition, if the build steps aren't executed, the plugins will temporarily stop appearing on the globe. We will mitigate this by ensuring the build step runs before `next dev`.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **Static GeoJSON Files**: Since static `.geojson` files currently live in `public/data`, we will leave them there during phase 1 of this migration to ensure the app doesn't break, but we will point the plugin manifests to load them via absolute or absolute-relative URLs (`/data/...`). In phase 2, we will introduce a symlink script to move them out of `public` entirely.
|
||||
|
||||
## Open Questions
|
||||
|
||||
1. **Build Tool Choice**: I am proposing `tsup` because it requires zero configuration to output multiple formats, automatically externalizes dependencies, and natively transpiles TypeScript/React. Are you comfortable adding `tsup` to the `wwv-plugin-sdk` package?
|
||||
2. **Local Serving**: To test "built-in" plugins using the dynamic loading method, we need the Next.js app to serve their compiled `plugin.js` bundles. My plan adds a quick copy script to the root `package.json` that copies their `dist` folders into `public/builtin-plugins/` so they can be fetched locally via HTTP. Does this sound good?
|
||||
|
||||
## Proposed Changes
|
||||
|
||||
### Task 1: Initialize Global Shared Dependencies
|
||||
|
||||
**Files:**
|
||||
- Modify: `c:\dev\worldwideview\src\components\layout\AppShell.tsx`
|
||||
- Create: `c:\dev\worldwideview\src\core\plugins\PluginGlobals.ts`
|
||||
|
||||
- [ ] **Step 1: Create the PluginGlobals initializer**
|
||||
|
||||
```typescript
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import * as ReactDomServer from "react-dom/server";
|
||||
import { Plane, Ship, Camera, Shield, Flame, Map, Swords, Atom, Landmark, Mountain, PlaneTakeoff, Anchor, Lamp, Rocket, SunMoon, Cable, Pickaxe, ShieldAlert, Crosshair, SatelliteDish, Hand, Radar, Scale } from "lucide-react";
|
||||
import * as Cesium from "cesium";
|
||||
import * as WWVPluginSDK from "@worldwideview/wwv-plugin-sdk";
|
||||
|
||||
export function initPluginGlobals() {
|
||||
if (typeof window === "undefined") return;
|
||||
|
||||
// Create a registry of Lucide icons commonly used by plugins to prevent them from bundling the massive icon library
|
||||
const lucideIcons = {
|
||||
Plane, Ship, Camera, Shield, Flame, Map, Swords, Atom, Landmark, Mountain,
|
||||
PlaneTakeoff, Anchor, Lamp, Rocket, SunMoon, Cable, Pickaxe, ShieldAlert,
|
||||
Crosshair, SatelliteDish, Hand, Radar, Scale
|
||||
};
|
||||
|
||||
(window as any).__WWV_SHARED__ = {
|
||||
"react": React,
|
||||
"react-dom": ReactDOM,
|
||||
"react-dom/server": ReactDomServer,
|
||||
"cesium": Cesium,
|
||||
"@worldwideview/wwv-plugin-sdk": WWVPluginSDK,
|
||||
"lucide-react": lucideIcons
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Inject globals in AppShell before anything loads**
|
||||
|
||||
In `AppShell.tsx`, import and call `initPluginGlobals()` at the top of the file, outside of any React components.
|
||||
|
||||
```tsx
|
||||
import { initPluginGlobals } from "@/core/plugins/PluginGlobals";
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
// Initialize globals immediately so they exist before any dynamic imports
|
||||
if (typeof window !== "undefined") {
|
||||
initPluginGlobals();
|
||||
}
|
||||
//... rest of the file
|
||||
```
|
||||
|
||||
### Task 2: Configure SDK Build Tool (`tsup`)
|
||||
|
||||
**Files:**
|
||||
- Modify: `c:\dev\worldwideview\packages\wwv-plugin-sdk\package.json`
|
||||
- Create: `c:\dev\worldwideview\packages\wwv-plugin-sdk\bin\wwv-plugin-build.js`
|
||||
|
||||
- [ ] **Step 1: Add tsup dependency**
|
||||
|
||||
Run: `pnpm --filter @worldwideview/wwv-plugin-sdk add -D tsup`
|
||||
|
||||
- [ ] **Step 2: Create the wwv-plugin-build CLI wrapper**
|
||||
|
||||
Add this to `wwv-plugin-sdk/bin/wwv-plugin-build.js`:
|
||||
|
||||
```javascript
|
||||
#!/usr/bin/env node
|
||||
const { build } = require("tsup");
|
||||
const path = require("path");
|
||||
|
||||
async function run() {
|
||||
const cwd = process.cwd();
|
||||
await build({
|
||||
entry: ["src/index.ts"],
|
||||
outDir: "dist",
|
||||
format: ["esm"],
|
||||
target: "es2022",
|
||||
clean: true,
|
||||
dts: false,
|
||||
minify: false,
|
||||
sourcemap: true,
|
||||
// Mark all these as externals so they aren't bundled
|
||||
external: ["react", "react-dom", "cesium", "@worldwideview/wwv-plugin-sdk", "lucide-react"],
|
||||
// Provide a shim that converts bare imports into global lookups
|
||||
esbuildPlugins: [{
|
||||
name: "wwv-globals",
|
||||
setup(build) {
|
||||
build.onResolve({ filter: /^(react|react-dom|cesium|@worldwideview\/wwv-plugin-sdk|lucide-react)$/ }, args => {
|
||||
return { path: args.path, namespace: "wwv-global" };
|
||||
});
|
||||
build.onLoad({ filter: /.*/, namespace: "wwv-global" }, args => {
|
||||
let globalKey = args.path;
|
||||
if (args.path === "lucide-react") return { contents: `module.exports = window.__WWV_SHARED__["lucide-react"];` };
|
||||
return { contents: `module.exports = window.__WWV_SHARED__["${globalKey}"];` };
|
||||
});
|
||||
}
|
||||
}]
|
||||
});
|
||||
}
|
||||
run();
|
||||
```
|
||||
|
||||
- [ ] **Step 3: Update SDK package.json to expose the bin**
|
||||
|
||||
```json
|
||||
"bin": {
|
||||
"wwv-plugin-build": "./bin/wwv-plugin-build.js"
|
||||
},
|
||||
```
|
||||
|
||||
### Task 3: Refactor Plugins to use Build Tool and Manifests
|
||||
|
||||
**Files:**
|
||||
- Modify: `wwv-plugin-aviation/package.json`
|
||||
- Modify: `wwv-plugin-aviation/plugin.json` (Create)
|
||||
|
||||
- [ ] **Step 1: Add build script to aviation plugin**
|
||||
|
||||
```json
|
||||
"scripts": {
|
||||
"build": "wwv-plugin-build"
|
||||
},
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Create plugin.json for aviation**
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "aviation",
|
||||
"name": "Aviation",
|
||||
"version": "1.0.7",
|
||||
"type": "data-layer",
|
||||
"format": "bundle",
|
||||
"trust": "built-in",
|
||||
"capabilities": ["data:own", "network:fetch"],
|
||||
"category": "aviation",
|
||||
"icon": "Plane",
|
||||
"entry": "/builtin-plugins/aviation/index.mjs"
|
||||
}
|
||||
```
|
||||
|
||||
*(Repeat for all other built-in plugins)*
|
||||
|
||||
### Task 4: Dynamic Initial Loader
|
||||
|
||||
**Files:**
|
||||
- Modify: `c:\dev\worldwideview\src\components\layout\AppShell.tsx`
|
||||
- Modify: `c:\dev\worldwideview\package.json`
|
||||
|
||||
- [ ] **Step 1: Remove Hardcoded Plugins**
|
||||
|
||||
In `AppShell.tsx`, delete the `builtIns` array and `import` statements at the top.
|
||||
|
||||
- [ ] **Step 2: Fetch and load all plugins via manifest**
|
||||
|
||||
Modify `AppShell.tsx` `startPlatform`:
|
||||
|
||||
```typescript
|
||||
// Fetch the unified list of ALL installed plugins (both built-in and dynamic)
|
||||
const res = await fetch("/api/marketplace/load");
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
for (const manifest of data.manifests) {
|
||||
if (disabledIds.has(manifest.id)) continue;
|
||||
try {
|
||||
await pluginManager.loadFromManifest(manifest);
|
||||
initLayer(manifest.id);
|
||||
} catch (e) {
|
||||
console.error("Failed to load plugin", manifest.id, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 3: Add predev copy-script**
|
||||
|
||||
Modify `package.json` to copy compiled plugin `dist` folders to `public/builtin-plugins` so the Next.js server can serve them at the `/builtin-plugins/...` path.
|
||||
|
||||
## Verification Plan
|
||||
|
||||
### Automated Tests
|
||||
- Run `pnpm --filter wwv-plugin-aviation build` to ensure `tsup` generates a valid ES Module with no bundled React.
|
||||
- Verify `dist/index.mjs` contains `window.__WWV_SHARED__["react"]` lookups.
|
||||
|
||||
### Manual Verification
|
||||
- Start the Next.js server.
|
||||
- Open network tab in browser and verify `GET /builtin-plugins/aviation/index.mjs` succeeds.
|
||||
- Verify the Aviation plugin appears on the globe and renders planes successfully, indicating that it successfully retrieved Cesium and React from the global shared context.
|
||||
@@ -0,0 +1,475 @@
|
||||
# Demo Google AdSense Panel Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** Add a Google AdSense vertical ad strip to the right side of the demo instance, with a dismissible banner explaining it's temporary to fund hosting.
|
||||
|
||||
**Architecture:** Three layers: (1) load the AdSense script conditionally in the root layout only when `isDemo` is true, (2) a reusable `AdUnit` client component that calls `adsbygoogle.push({})`, (3) a `DemoAdStrip` shell component that wraps the ad unit + a "why ads?" dismissible message, positioned as a fixed vertical strip on the right edge. CSP headers in `next.config.ts` must be updated to allow the AdSense domains.
|
||||
|
||||
**Tech Stack:** Next.js 16 (App Router, `next/script`), Google AdSense, vanilla CSS, Vitest
|
||||
|
||||
---
|
||||
|
||||
## File Structure
|
||||
|
||||
| File | Action | Responsibility |
|
||||
|---|---|---|
|
||||
| `src/app/layout.tsx` | MODIFY | Conditionally load AdSense `<Script>` for demo |
|
||||
| `next.config.ts` | MODIFY | Add AdSense domains to CSP `script-src` and `frame-src` |
|
||||
| `.env` | MODIFY | Add `NEXT_PUBLIC_ADSENSE_CLIENT_ID` placeholder |
|
||||
| `src/components/ads/AdUnit.tsx` | CREATE | Generic reusable AdSense unit component |
|
||||
| `src/components/ads/DemoAdStrip.tsx` | CREATE | Demo-only vertical strip: ad + "why ads?" message |
|
||||
| `src/components/ads/DemoAdStrip.css` | CREATE | Styles for the vertical ad strip |
|
||||
| `src/components/layout/AppShell.tsx` | MODIFY | Import and render `<DemoAdStrip />` |
|
||||
| `src/types/adsense.d.ts` | CREATE | TypeScript ambient declaration for `window.adsbygoogle` |
|
||||
|
||||
---
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **Before starting:** You need a Google AdSense publisher ID (`ca-pub-XXXXXXXXXXXXXXXX`) and an ad slot ID. These go into `.env` as `NEXT_PUBLIC_ADSENSE_CLIENT_ID` and are passed to the ad unit component. You can get these from [Google AdSense](https://www.google.com/adsense/). Without them the ads will not render, but the component framework will still work.
|
||||
|
||||
---
|
||||
|
||||
### Task 1: TypeScript Ambient Declaration for AdSense
|
||||
|
||||
**Files:**
|
||||
- Create: `src/types/adsense.d.ts`
|
||||
|
||||
- [ ] **Step 1: Create the ambient type declaration**
|
||||
|
||||
```ts
|
||||
// src/types/adsense.d.ts
|
||||
interface Window {
|
||||
adsbygoogle: Array<Record<string, unknown>>;
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Commit**
|
||||
|
||||
```bash
|
||||
git add src/types/adsense.d.ts
|
||||
git commit -m "chore: add adsense ambient type declaration"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 2: Environment Variable
|
||||
|
||||
**Files:**
|
||||
- Modify: `.env`
|
||||
|
||||
- [ ] **Step 1: Add the AdSense client ID placeholder**
|
||||
|
||||
Add the following line to the end of `.env`:
|
||||
|
||||
```
|
||||
# Google AdSense — only used on demo edition
|
||||
NEXT_PUBLIC_ADSENSE_CLIENT_ID=
|
||||
```
|
||||
|
||||
The actual value (`ca-pub-XXXXXXXXXXXXXXXX`) should be set in `.env.local` for local testing or in the deployment environment. The ad slot IDs will be hardcoded in the component since there's only one placement.
|
||||
|
||||
- [ ] **Step 2: Commit**
|
||||
|
||||
```bash
|
||||
git add .env
|
||||
git commit -m "chore: add NEXT_PUBLIC_ADSENSE_CLIENT_ID env var"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 3: CSP Headers Update
|
||||
|
||||
**Files:**
|
||||
- Modify: `next.config.ts:29-52`
|
||||
|
||||
- [ ] **Step 1: Update CSP in next.config.ts**
|
||||
|
||||
In the `headers()` function, modify the `script-src` and `frame-src` directives to allow AdSense domains.
|
||||
|
||||
```ts
|
||||
// Change this line (line 39):
|
||||
"script-src 'self' 'unsafe-eval' 'unsafe-inline' blob: https://analytics.worldwideview.dev https://va.vercel-scripts.com",
|
||||
|
||||
// To this:
|
||||
"script-src 'self' 'unsafe-eval' 'unsafe-inline' blob: https://analytics.worldwideview.dev https://va.vercel-scripts.com https://pagead2.googlesyndication.com https://adservice.google.com https://www.googletagservices.com",
|
||||
```
|
||||
|
||||
```ts
|
||||
// Change this line (line 49):
|
||||
"frame-src 'self' *.youtube.com *.youtube-nocookie.com *.twitch.tv *.vimeo.com *.webcamera.pl *.ivideon.com *.rtsp.me *.bnu.tv",
|
||||
|
||||
// To this:
|
||||
"frame-src 'self' *.youtube.com *.youtube-nocookie.com *.twitch.tv *.vimeo.com *.webcamera.pl *.ivideon.com *.rtsp.me *.bnu.tv https://googleads.g.doubleclick.net https://tpc.googlesyndication.com",
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Commit**
|
||||
|
||||
```bash
|
||||
git add next.config.ts
|
||||
git commit -m "feat: add Google AdSense domains to CSP headers"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 4: AdSense Script in Root Layout
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/app/layout.tsx:24-39`
|
||||
|
||||
- [ ] **Step 1: Conditionally load AdSense script for demo edition**
|
||||
|
||||
Add the AdSense `<Script>` tag inside `<head>`, using the `NEXT_PUBLIC_` env var for the client ID and the `NEXT_PUBLIC_WWV_EDITION` env var to gate loading.
|
||||
|
||||
```tsx
|
||||
// src/app/layout.tsx — updated <head> section
|
||||
<head>
|
||||
{/* Load CesiumJS base styles (optional, but helps with UI widgets if used later) */}
|
||||
<link rel="stylesheet" href="/cesium/Widgets/widgets.css" />
|
||||
</head>
|
||||
<body suppressHydrationWarning>
|
||||
{children}
|
||||
<Analytics />
|
||||
<Script
|
||||
src="https://analytics.worldwideview.dev/script.js"
|
||||
data-website-id="2c8f6c09-2651-4a2a-af99-b8cee1612b9a"
|
||||
strategy="afterInteractive"
|
||||
/>
|
||||
{process.env.NEXT_PUBLIC_WWV_EDITION === "demo" &&
|
||||
process.env.NEXT_PUBLIC_ADSENSE_CLIENT_ID && (
|
||||
<Script
|
||||
src={`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${process.env.NEXT_PUBLIC_ADSENSE_CLIENT_ID}`}
|
||||
crossOrigin="anonymous"
|
||||
strategy="afterInteractive"
|
||||
/>
|
||||
)}
|
||||
</body>
|
||||
```
|
||||
|
||||
> **Note:** We use the raw env var at the layout level (Server Component) rather than importing `isDemo` which uses `process.env.NEXT_PUBLIC_WWV_EDITION` anyway. This avoids importing the edition module into the root layout.
|
||||
|
||||
- [ ] **Step 2: Commit**
|
||||
|
||||
```bash
|
||||
git add src/app/layout.tsx
|
||||
git commit -m "feat: conditionally load AdSense script on demo edition"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 5: Reusable AdUnit Component
|
||||
|
||||
**Files:**
|
||||
- Create: `src/components/ads/AdUnit.tsx`
|
||||
|
||||
- [ ] **Step 1: Create the generic AdSense unit component**
|
||||
|
||||
```tsx
|
||||
// src/components/ads/AdUnit.tsx
|
||||
"use client";
|
||||
|
||||
import { useEffect, useRef } from "react";
|
||||
|
||||
interface AdUnitProps {
|
||||
adSlot: string;
|
||||
adFormat?: string;
|
||||
style?: React.CSSProperties;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function AdUnit({ adSlot, adFormat = "auto", style, className }: AdUnitProps) {
|
||||
const pushed = useRef(false);
|
||||
const clientId = process.env.NEXT_PUBLIC_ADSENSE_CLIENT_ID;
|
||||
|
||||
useEffect(() => {
|
||||
if (pushed.current || !clientId) return;
|
||||
try {
|
||||
(window.adsbygoogle = window.adsbygoogle || []).push({});
|
||||
pushed.current = true;
|
||||
} catch (err) {
|
||||
console.error("[AdUnit] AdSense push error:", err);
|
||||
}
|
||||
}, [clientId]);
|
||||
|
||||
if (!clientId) return null;
|
||||
|
||||
return (
|
||||
<div className={className} style={style}>
|
||||
<ins
|
||||
className="adsbygoogle"
|
||||
style={{ display: "block" }}
|
||||
data-ad-client={clientId}
|
||||
data-ad-slot={adSlot}
|
||||
data-ad-format={adFormat}
|
||||
data-full-width-responsive="false"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
> **Key detail:** The `pushed` ref prevents double-push on React strict mode / hot reload. `data-full-width-responsive="false"` prevents the ad from expanding beyond the container — critical for a fixed-width vertical strip.
|
||||
|
||||
- [ ] **Step 2: Commit**
|
||||
|
||||
```bash
|
||||
git add src/components/ads/AdUnit.tsx
|
||||
git commit -m "feat: add reusable AdUnit component"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 6: DemoAdStrip Component + Styles
|
||||
|
||||
**Files:**
|
||||
- Create: `src/components/ads/DemoAdStrip.tsx`
|
||||
- Create: `src/components/ads/DemoAdStrip.css`
|
||||
|
||||
- [ ] **Step 1: Create the CSS for the vertical ad strip**
|
||||
|
||||
```css
|
||||
/* src/components/ads/DemoAdStrip.css */
|
||||
|
||||
.demo-ad-strip {
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 160px;
|
||||
z-index: 45;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--space-md);
|
||||
padding: var(--space-sm);
|
||||
pointer-events: none;
|
||||
transition: transform var(--duration-slow) var(--ease-smooth),
|
||||
opacity var(--duration-slow) var(--ease-smooth);
|
||||
}
|
||||
|
||||
.demo-ad-strip--hidden {
|
||||
transform: translateX(200px);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.demo-ad-strip__ad {
|
||||
pointer-events: auto;
|
||||
width: 160px;
|
||||
min-height: 600px;
|
||||
}
|
||||
|
||||
.demo-ad-strip__banner {
|
||||
pointer-events: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: var(--space-xs);
|
||||
padding: var(--space-sm) var(--space-md);
|
||||
background: var(--bg-glass);
|
||||
backdrop-filter: blur(var(--glass-blur));
|
||||
-webkit-backdrop-filter: blur(var(--glass-blur));
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: var(--radius-md);
|
||||
max-width: 160px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
transition: all var(--duration-fast) var(--ease-smooth);
|
||||
}
|
||||
|
||||
.demo-ad-strip__banner:hover {
|
||||
border-color: rgba(var(--accent-rgb), 0.3);
|
||||
box-shadow: var(--glow-cyan);
|
||||
}
|
||||
|
||||
.demo-ad-strip__banner-label {
|
||||
font-size: 9px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.demo-ad-strip__banner-text {
|
||||
font-size: 11px;
|
||||
line-height: 1.4;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.demo-ad-strip__close {
|
||||
position: absolute;
|
||||
top: var(--space-xs);
|
||||
right: var(--space-xs);
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--text-muted);
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: color var(--duration-fast) var(--ease-smooth);
|
||||
}
|
||||
|
||||
.demo-ad-strip__close:hover {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
/* Hide on mobile — ads shouldn't overlay the full-screen globe */
|
||||
@media (max-width: 768px) {
|
||||
.demo-ad-strip {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Create the DemoAdStrip component**
|
||||
|
||||
```tsx
|
||||
// src/components/ads/DemoAdStrip.tsx
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { isDemo } from "@/core/edition";
|
||||
import { AdUnit } from "./AdUnit";
|
||||
import { X } from "lucide-react";
|
||||
import "./DemoAdStrip.css";
|
||||
|
||||
/** The ad slot ID for the vertical skyscraper unit — set this in AdSense dashboard. */
|
||||
const VERTICAL_AD_SLOT = "REPLACE_WITH_YOUR_AD_SLOT_ID";
|
||||
|
||||
export function DemoAdStrip() {
|
||||
const [showMessage, setShowMessage] = useState(false);
|
||||
const [closed, setClosed] = useState(false);
|
||||
|
||||
if (!isDemo || closed) return null;
|
||||
|
||||
return (
|
||||
<aside className="demo-ad-strip" aria-label="Sponsored content">
|
||||
<AdUnit
|
||||
adSlot={VERTICAL_AD_SLOT}
|
||||
adFormat="vertical"
|
||||
className="demo-ad-strip__ad"
|
||||
/>
|
||||
|
||||
<div
|
||||
className="demo-ad-strip__banner"
|
||||
onClick={() => setShowMessage((prev) => !prev)}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
onKeyDown={(e) => { if (e.key === "Enter") setShowMessage((prev) => !prev); }}
|
||||
>
|
||||
<button
|
||||
className="demo-ad-strip__close"
|
||||
onClick={(e) => { e.stopPropagation(); setClosed(true); }}
|
||||
aria-label="Dismiss ad panel"
|
||||
>
|
||||
<X size={12} />
|
||||
</button>
|
||||
<span className="demo-ad-strip__banner-label">Why ads?</span>
|
||||
{showMessage ? (
|
||||
<span className="demo-ad-strip__banner-text">
|
||||
This isn't permanent — it's temporary because I'm a single
|
||||
dev and need to cover hosting costs. Thank you for understanding.
|
||||
</span>
|
||||
) : (
|
||||
<span className="demo-ad-strip__banner-text">
|
||||
Click to learn more
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 3: Commit**
|
||||
|
||||
```bash
|
||||
git add src/components/ads/DemoAdStrip.tsx src/components/ads/DemoAdStrip.css
|
||||
git commit -m "feat: add DemoAdStrip with Google AdSense vertical unit"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 7: Integrate into AppShell
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/components/layout/AppShell.tsx:8-9,168`
|
||||
|
||||
- [ ] **Step 1: Add import**
|
||||
|
||||
After the existing `CameraStatsPanel` import (line 8), add:
|
||||
|
||||
```tsx
|
||||
import CameraStatsPanel from "@/components/panels/CameraStatsPanel";
|
||||
import { DemoAdStrip } from "@/components/ads/DemoAdStrip"; // ADD THIS
|
||||
import { Timeline } from "@/components/timeline/Timeline";
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Add the JSX**
|
||||
|
||||
After `<EntityInfoCard />` (line 168), add:
|
||||
|
||||
```tsx
|
||||
<EntityInfoCard />
|
||||
<DemoAdStrip />
|
||||
<Timeline />
|
||||
```
|
||||
|
||||
- [ ] **Step 3: Commit**
|
||||
|
||||
```bash
|
||||
git add src/components/layout/AppShell.tsx
|
||||
git commit -m "feat: integrate DemoAdStrip into AppShell"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 8: ads.txt for AdSense Verification
|
||||
|
||||
**Files:**
|
||||
- Create: `public/ads.txt`
|
||||
|
||||
- [ ] **Step 1: Create ads.txt**
|
||||
|
||||
```
|
||||
google.com, ca-pub-XXXXXXXXXXXXXXXX, DIRECT, f08c47fec0942fa0
|
||||
```
|
||||
|
||||
> Replace `ca-pub-XXXXXXXXXXXXXXXX` with your actual publisher ID. This file is required by AdSense for domain verification.
|
||||
|
||||
- [ ] **Step 2: Commit**
|
||||
|
||||
```bash
|
||||
git add public/ads.txt
|
||||
git commit -m "chore: add ads.txt for AdSense domain verification"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Open Questions
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **Do you have a Google AdSense publisher ID yet?** If not, you'll need to sign up at https://www.google.com/adsense/ and get your `ca-pub-XXXX` ID and create a 160x600 "Wide Skyscraper" ad unit to get the slot ID. The code will render nothing gracefully until these are configured.
|
||||
|
||||
> [!WARNING]
|
||||
> **CSP changes are required for AdSense to work.** The current CSP is restrictive and blocks `pagead2.googlesyndication.com` and `googleads.g.doubleclick.net`. Task 3 adds them. Without this, ads will be silently blocked by the browser.
|
||||
|
||||
---
|
||||
|
||||
## Verification Plan
|
||||
|
||||
### Manual Verification
|
||||
|
||||
1. Set `NEXT_PUBLIC_WWV_EDITION=demo` and `NEXT_PUBLIC_ADSENSE_CLIENT_ID=ca-pub-XXXX` in `.env.local`
|
||||
2. Run `pnpm dev`
|
||||
3. Verify: A 160px vertical strip appears on the right edge of the screen
|
||||
4. Verify: The "Why ads?" banner is clickable and toggles the explanation message
|
||||
5. Verify: Clicking the X dismisses the entire strip
|
||||
6. Verify: On mobile viewport widths (< 768px), the strip is hidden
|
||||
7. Verify: Set `NEXT_PUBLIC_WWV_EDITION=local` → strip does not render at all
|
||||
8. Verify: Browser console shows no CSP violations related to AdSense domains
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,145 @@
|
||||
# Expand OSM Chips Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** Expand the available OSM search chips to include a curated list of ~30 pre-loaded OSINT-relevant tags, and add a live Taginfo API autocomplete search to dynamically find and select any of the millions of other OSM tags.
|
||||
|
||||
**Architecture:** We will replace the current small `COMMON_TAGS` array with a richer, categorized list inside the `OSMSidebar` file. To allow access to "all" tags without crashing the UI, we will add a debounced fetch hook that hits `https://taginfo.openstreetmap.org/api/4/tags/popular` (or the equivalent search endpoint) when the user types in the filter box. These dynamically fetched tags will temporarily populate the chip list.
|
||||
|
||||
**Tech Stack:** React, TypeScript, Taginfo API
|
||||
|
||||
---
|
||||
|
||||
### Task 1: Update Pre-Loaded COMMON_TAGS
|
||||
|
||||
**Files:**
|
||||
- Modify: `c:\dev\worldwideview\packages\wwv-plugin-osm-search\src\components\OSMSidebar.tsx:6-11`
|
||||
|
||||
- [ ] **Step 1: Replace existing COMMON_TAGS array**
|
||||
|
||||
```tsx
|
||||
const COMMON_TAGS = [
|
||||
// Military & Security
|
||||
"military=base", "military=bunker", "amenity=police", "amenity=prison",
|
||||
// Aviation & Maritime
|
||||
"aeroway=aerodrome", "aeroway=helipad", "aeroway=hangar", "man_made=pier", "harbour=yes",
|
||||
// Infrastructure & Utilities
|
||||
"power=plant", "power=substation", "telecom=antenna", "man_made=communications_tower", "man_made=water_tower",
|
||||
// Transport
|
||||
"highway=bus_stop", "railway=station", "amenity=fuel", "amenity=parking",
|
||||
// Medical & Emergency
|
||||
"amenity=hospital", "amenity=fire_station", "amenity=clinic",
|
||||
// General Commercial & Industrial
|
||||
"shop=supermarket", "tourism=hotel", "industrial=factory", "landuse=industrial",
|
||||
// Education & Amenities
|
||||
"amenity=school", "amenity=university", "amenity=cafe", "building=house"
|
||||
];
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Commit**
|
||||
|
||||
```bash
|
||||
git add packages/wwv-plugin-osm-search/src/components/OSMSidebar.tsx
|
||||
git commit -m "feat(osm-search): expand quick preset tags with OSINT categories"
|
||||
```
|
||||
|
||||
### Task 2: Implement Taginfo Dynamic Autocomplete
|
||||
|
||||
**Files:**
|
||||
- Modify: `c:\dev\worldwideview\packages\wwv-plugin-osm-search\src\components\OSMSidebar.tsx`
|
||||
|
||||
- [ ] **Step 1: Add state and debounced fetch logic inside OSMSidebar component**
|
||||
|
||||
```tsx
|
||||
const [searchText, setSearchText] = useState("");
|
||||
const [activeTags, setActiveTags] = useState<string[]>([]);
|
||||
const [dynamicTags, setDynamicTags] = useState<string[]>([]);
|
||||
const [isSearchingApi, setIsSearchingApi] = useState(false);
|
||||
|
||||
// Add this useEffect below the useState hooks
|
||||
React.useEffect(() => {
|
||||
if (searchText.length < 3) {
|
||||
setDynamicTags([]);
|
||||
return;
|
||||
}
|
||||
|
||||
const timer = setTimeout(async () => {
|
||||
setIsSearchingApi(true);
|
||||
try {
|
||||
// Fetch tags matching the search term from OSM Taginfo
|
||||
const res = await fetch(`https://taginfo.openstreetmap.org/api/4/search/by_keyword?query=${encodeURIComponent(searchText)}`);
|
||||
const data = await res.json();
|
||||
if (data && data.data) {
|
||||
// Extract exact key=value pairs or just keys, format as "key=value"
|
||||
const tags = data.data
|
||||
.filter((item: any) => item.key && item.value)
|
||||
.map((item: any) => `${item.key}=${item.value}`)
|
||||
.slice(0, 15); // Limit to top 15 results
|
||||
setDynamicTags(tags);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Taginfo fetch failed", err);
|
||||
} finally {
|
||||
setIsSearchingApi(false);
|
||||
}
|
||||
}, 500); // 500ms debounce
|
||||
|
||||
return () => clearTimeout(timer);
|
||||
}, [searchText]);
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Update rendering logic to merge static and dynamic tags**
|
||||
|
||||
Look for the `renderedTags` definition and replace it:
|
||||
|
||||
```tsx
|
||||
// Combine filtered common tags with newly fetched dynamic tags, removing duplicates
|
||||
const filteredCommon = searchText
|
||||
? COMMON_TAGS.filter(t => t.toLowerCase().includes(searchText.toLowerCase()))
|
||||
: COMMON_TAGS;
|
||||
|
||||
const renderedTags = Array.from(new Set([...filteredCommon, ...dynamicTags]));
|
||||
```
|
||||
|
||||
- [ ] **Step 3: Add loading indicator to the search input area**
|
||||
|
||||
Look for the `<input>` element for `searchText` and wrap it/add a loading indicator:
|
||||
|
||||
```tsx
|
||||
<div style={{ position: "relative" }}>
|
||||
<input
|
||||
style={{
|
||||
width: "100%",
|
||||
padding: "8px",
|
||||
paddingRight: "24px",
|
||||
backgroundColor: "rgba(0,0,0,0.3)",
|
||||
color: "#fff",
|
||||
border: "1px solid var(--border-subtle)",
|
||||
borderRadius: "4px",
|
||||
fontSize: "13px"
|
||||
}}
|
||||
placeholder="Filter or search OSM for tags..."
|
||||
value={searchText}
|
||||
onChange={e => setSearchText(e.target.value)}
|
||||
/>
|
||||
{isSearchingApi && (
|
||||
<span style={{
|
||||
position: "absolute",
|
||||
right: "8px",
|
||||
top: "50%",
|
||||
transform: "translateY(-50%)",
|
||||
fontSize: "10px",
|
||||
color: "var(--text-muted)"
|
||||
}}>
|
||||
⏳
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
```
|
||||
|
||||
- [ ] **Step 4: Commit**
|
||||
|
||||
```bash
|
||||
git add packages/wwv-plugin-osm-search/src/components/OSMSidebar.tsx
|
||||
git commit -m "feat(osm-search): add live Taginfo autocomplete for unlisted tags"
|
||||
```
|
||||
@@ -0,0 +1,139 @@
|
||||
# Plugin Versioning Streamlining Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** Refactor all WorldWideView plugin classes to derive their `version` property dynamically from their local `package.json` file rather than hardcoding string literals.
|
||||
|
||||
**Architecture:** We will replace the hardcoded `version = "x.y.z"` strings in the core `WorldPlugin` interface implementations across all monorepo packages. We will utilize TypeScript's JSON module resolution feature to `import pkg from "../package.json"` and map `version = pkg.version`. This ensures that `pnpm version patch` is the single source of truth and eliminates the double-bookkeeping that previously made CI fixes tedious.
|
||||
|
||||
**Tech Stack:** TypeScript, Next.js / bundler (JSON module resolution), pnpm workspaces.
|
||||
|
||||
---
|
||||
|
||||
## Task 1: Verify TypeScript Configuration
|
||||
|
||||
**Files:**
|
||||
- Modify: N/A (Verification step)
|
||||
|
||||
- [ ] **Step 1: Check `tsconfig.json` for JSON resolution**
|
||||
|
||||
Run: `cat tsconfig.json | grep resolveJsonModule`
|
||||
Expected: `"resolveJsonModule": true`
|
||||
|
||||
- [ ] **Step 2: Check compiler compatibility**
|
||||
|
||||
Run: `pnpm exec tsc --noEmit`
|
||||
Expected: PASS (exit code 0)
|
||||
|
||||
## Task 2: Refactor Group A Plugins (Core Infrastructure)
|
||||
|
||||
**Files:**
|
||||
- Modify: `packages/wwv-plugin-aviation/src/index.ts`
|
||||
- Modify: `packages/wwv-plugin-maritime/src/index.ts`
|
||||
- Modify: `packages/wwv-plugin-military-aviation/src/index.ts`
|
||||
|
||||
- [ ] **Step 1: Update plugin classes**
|
||||
|
||||
For each file above, modify the imports and the class body:
|
||||
|
||||
```typescript
|
||||
import pkg from "../package.json";
|
||||
// ...
|
||||
export class AviationPlugin implements WorldPlugin { // (or extends BasePlugin)
|
||||
// ...
|
||||
version = pkg.version;
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Verify compilation**
|
||||
|
||||
Run: `pnpm exec tsc --noEmit`
|
||||
Expected: PASS
|
||||
|
||||
- [ ] **Step 3: Commit**
|
||||
|
||||
```bash
|
||||
git commit -am "refactor(plugins): derive version dynamically for core infrastructure plugins [Patch]"
|
||||
```
|
||||
|
||||
## Task 3: Refactor Group B Plugins (Facilities & Infrastructure)
|
||||
|
||||
**Files:**
|
||||
- Modify: `packages/wwv-plugin-airports/src/index.ts`
|
||||
- Modify: `packages/wwv-plugin-seaports/src/index.ts`
|
||||
- Modify: `packages/wwv-plugin-spaceports/src/index.ts`
|
||||
- Modify: `packages/wwv-plugin-embassies/src/index.ts`
|
||||
- Modify: `packages/wwv-plugin-lighthouses/src/index.ts`
|
||||
- Modify: `packages/wwv-plugin-nuclear/src/index.ts`
|
||||
- Modify: `packages/wwv-plugin-undersea-cables/src/index.ts`
|
||||
- Modify: `packages/wwv-plugin-mineral-mines/src/index.ts`
|
||||
|
||||
- [ ] **Step 1: Update plugin classes**
|
||||
|
||||
For each file above, replace `version = "..."` with `version = pkg.version` and add `import pkg from "../package.json";`.
|
||||
|
||||
- [ ] **Step 2: Verify compilation**
|
||||
|
||||
Run: `pnpm exec tsc --noEmit`
|
||||
Expected: PASS
|
||||
|
||||
- [ ] **Step 3: Commit**
|
||||
|
||||
```bash
|
||||
git commit -am "refactor(plugins): derive version dynamically for facility plugins [Patch]"
|
||||
```
|
||||
|
||||
## Task 4: Refactor Group C Plugins (Hazards & Events)
|
||||
|
||||
**Files:**
|
||||
- Modify: `packages/wwv-plugin-earthquakes/src/index.ts`
|
||||
- Modify: `packages/wwv-plugin-volcanoes/src/index.ts`
|
||||
- Modify: `packages/wwv-plugin-wildfire/src/index.ts`
|
||||
- Modify: `packages/wwv-plugin-conflict-events/src/index.tsx`
|
||||
- Modify: `packages/wwv-plugin-conflict-zones/src/index.tsx`
|
||||
- Modify: `packages/wwv-plugin-civil-unrest/src/index.tsx`
|
||||
- Modify: `packages/wwv-plugin-cyber-attacks/src/index.tsx`
|
||||
- Modify: `packages/wwv-plugin-international-sanctions/src/index.tsx`
|
||||
|
||||
- [ ] **Step 1: Update plugin classes**
|
||||
|
||||
For each file above, replace `version = "..."` with `version = pkg.version` and add `import pkg from "../package.json";`. Note that some files are `.tsx`.
|
||||
|
||||
- [ ] **Step 2: Verify compilation**
|
||||
|
||||
Run: `pnpm exec tsc --noEmit`
|
||||
Expected: PASS
|
||||
|
||||
- [ ] **Step 3: Commit**
|
||||
|
||||
```bash
|
||||
git commit -am "refactor(plugins): derive version dynamically for event and hazard plugins [Patch]"
|
||||
```
|
||||
|
||||
## Task 5: Refactor Group D Plugins (Misc & Utilities)
|
||||
|
||||
**Files:**
|
||||
- Modify: `packages/wwv-plugin-satellite/src/index.ts`
|
||||
- Modify: `packages/wwv-plugin-surveillance-satellites/src/index.tsx`
|
||||
- Modify: `packages/wwv-plugin-osm-search/src/index.ts`
|
||||
- Modify: `packages/wwv-plugin-iranwarlive/src/index.ts`
|
||||
- Modify: `packages/wwv-plugin-daynight/src/index.ts`
|
||||
- Modify: `packages/wwv-plugin-camera/src/index.ts`
|
||||
- Modify: `packages/wwv-plugin-borders/src/index.ts`
|
||||
- Modify: `packages/wwv-plugin-gps-jamming/src/index.tsx`
|
||||
- Modify: `packages/wwv-plugin-air-defense/src/index.tsx`
|
||||
|
||||
- [ ] **Step 1: Update plugin classes**
|
||||
|
||||
For each file above, replace `version = "..."` with `version = pkg.version` and add `import pkg from "../package.json";`.
|
||||
|
||||
- [ ] **Step 2: Verify compilation and tests**
|
||||
|
||||
Run: `pnpm exec tsc --noEmit`
|
||||
Run: `pnpm test`
|
||||
Expected: PASS
|
||||
|
||||
- [ ] **Step 3: Commit**
|
||||
|
||||
```bash
|
||||
git commit -am "refactor(plugins): derive version dynamically for utility plugins [Patch]"
|
||||
```
|
||||
@@ -0,0 +1,124 @@
|
||||
# Demo Default Plugins Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** Enable specific plugins by default on the demo edition via environment variables so the user is immediately impressed.
|
||||
|
||||
**Architecture:** Update `layersSlice.ts` to accept an optional `defaultEnabled` parameter in `initLayer`. In `AppShell.tsx`, look up `NEXT_PUBLIC_DEMO_DEFAULT_PLUGINS` when the edition is `demo`, and pass the flag true to `initLayer` for matching plugins during registration. Document the variable in `.env.example`.
|
||||
|
||||
**Tech Stack:** Next.js, Zustand, TypeScript.
|
||||
|
||||
---
|
||||
|
||||
### Task 1: Update layer slice definition
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/core/state/layersSlice.ts`
|
||||
|
||||
- [ ] **Step 1: Write the implementation**
|
||||
|
||||
Update `initLayer` in `src/core/state/layersSlice.ts` to accept a second parameter:
|
||||
|
||||
```typescript
|
||||
// Add defaultEnabled parameter to the interface
|
||||
export interface LayersSlice {
|
||||
// ...
|
||||
initLayer: (pluginId: string, defaultEnabled?: boolean) => void;
|
||||
}
|
||||
|
||||
// ...
|
||||
|
||||
// Use the parameter in the state updater
|
||||
initLayer: (pluginId, defaultEnabled = false) =>
|
||||
set((state) => ({
|
||||
layers: {
|
||||
...state.layers,
|
||||
[pluginId]: state.layers[pluginId] || { enabled: defaultEnabled, entityCount: 0, loading: false },
|
||||
},
|
||||
})),
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Commit**
|
||||
|
||||
```bash
|
||||
git add src/core/state/layersSlice.ts
|
||||
npm run commit -- "feat: add defaultEnabled param to initLayer in layers slice"
|
||||
```
|
||||
|
||||
### Task 2: Apply default configuration in AppShell
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/components/layout/AppShell.tsx`
|
||||
|
||||
- [ ] **Step 1: Write the implementation**
|
||||
|
||||
Add `isDemo` import at the top of `src/components/layout/AppShell.tsx`:
|
||||
|
||||
```typescript
|
||||
import { isDemo } from "@/core/edition";
|
||||
```
|
||||
|
||||
In `AppShell.tsx`, around line 71, inside `startPlatform()`, fetch the value from the environment if the instance is demo:
|
||||
|
||||
```typescript
|
||||
// Fetch disabled built-in plugins before registration
|
||||
let disabledIds = new Set<string>();
|
||||
// ... (keep existing try/catch block)
|
||||
|
||||
// Setup demo defaults
|
||||
const demoDefaultPlugins = new Set<string>();
|
||||
if (isDemo) {
|
||||
const envVar = process.env.NEXT_PUBLIC_DEMO_DEFAULT_PLUGINS || "";
|
||||
envVar.split(",").forEach(s => {
|
||||
const clean = s.trim();
|
||||
if (clean) demoDefaultPlugins.add(clean);
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
Then update the `pluginManager` registration loop to inject the boolean for `initLayer`:
|
||||
|
||||
```typescript
|
||||
for (const plugin of pluginRegistry.getAll()) {
|
||||
await pluginManager.registerPlugin(plugin);
|
||||
initLayer(plugin.id, demoDefaultPlugins.has(plugin.id));
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Run test to verify it passes**
|
||||
|
||||
Run type checks to verify no compilation issues:
|
||||
`npx tsc --noEmit`
|
||||
|
||||
- [ ] **Step 3: Commit**
|
||||
|
||||
```bash
|
||||
git add src/components/layout/AppShell.tsx
|
||||
npm run commit -- "feat: parse and apply default demo plugins via NEXT_PUBLIC_DEMO_DEFAULT_PLUGINS"
|
||||
```
|
||||
|
||||
### Task 3: Document environment definitions
|
||||
|
||||
**Files:**
|
||||
- Modify: `.env.example`
|
||||
- Modify: `.env`
|
||||
|
||||
- [ ] **Step 1: Write the implementation**
|
||||
|
||||
Update `.env.example` and `.env` around the `NEXT_PUBLIC_WWV_EDITION=local` definition:
|
||||
|
||||
```dotenv
|
||||
# Default plugins enabled on boot for demo edition
|
||||
# Comma-separated list of plugin IDs (e.g. aviation,maritime,iranwarlive)
|
||||
NEXT_PUBLIC_DEMO_DEFAULT_PLUGINS=
|
||||
|
||||
# Edition: "local" | "cloud" | "demo"
|
||||
NEXT_PUBLIC_WWV_EDITION=local
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Commit**
|
||||
|
||||
```bash
|
||||
git add .env.example .env
|
||||
npm run commit -- "docs: add NEXT_PUBLIC_DEMO_DEFAULT_PLUGINS to env templates"
|
||||
```
|
||||
@@ -0,0 +1,177 @@
|
||||
# Decouple Plugin Proxies Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** Strip out hardcoded proxy endpoints from the `worldwideview` core repository to enforce a fully decoupled plugin ecosystem, replacing them with direct browser fetching or a universal CORS proxy.
|
||||
|
||||
**Architecture:** Remove preferential API routes (`/api/earthquake`, `/api/undersea-cables`, `/api/camera/*`) from the `worldwideview` core app. Promote the existing camera proxy to a universal `/api/proxy` with strict SSRF defenses. Provide direct browser-fetch code for the `wwv-plugin-earthquakes` where CORS permits, and migrate traffic camera fetchers directly into the `wwv-plugin-camera` package to fetch via the universal proxy.
|
||||
|
||||
**Tech Stack:** Next.js 16 (App Router), TypeScript, pnpm workspace
|
||||
|
||||
---
|
||||
|
||||
### Task 1: Promote Universal Proxy in Core Repository
|
||||
|
||||
**Files:**
|
||||
- Create (Move): `src/app/api/proxy/route.ts`
|
||||
- Delete: `src/app/api/camera/proxy/route.ts`
|
||||
|
||||
- [ ] **Step 1: Relocate the proxy route and update logs**
|
||||
|
||||
Move the existing camera proxy to act as a system-wide universal proxy.
|
||||
|
||||
Run: `mkdir -p src/app/api/proxy`
|
||||
Run: `mv src/app/api/camera/proxy/route.ts src/app/api/proxy/route.ts`
|
||||
|
||||
- [ ] **Step 2: Update the error logging prefix in the new file**
|
||||
|
||||
Modify `src/app/api/proxy/route.ts` near line 97:
|
||||
|
||||
```json
|
||||
{
|
||||
"instruction": "Update the error logging prefix",
|
||||
"replace_chunks": [
|
||||
{
|
||||
"start_line": 96,
|
||||
"end_line": 98,
|
||||
"target_content": " } catch (error: any) {\n console.error(\"[CameraProxy] Error fetching target URL:\", error);\n return NextResponse.json(",
|
||||
"replacement_content": " } catch (error: any) {\n console.error(\"[UniversalProxy] Error fetching target URL:\", error);\n return NextResponse.json("
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 3: Commit the Universal Proxy**
|
||||
|
||||
```bash
|
||||
git add src/app/api/proxy/route.ts src/app/api/camera/proxy/route.ts
|
||||
git commit -m "refactor: promote camera proxy to universal proxy"
|
||||
```
|
||||
|
||||
### Task 2: Strip Preferential Proxy Routes From Core Application
|
||||
|
||||
**Files:**
|
||||
- Delete: `src/app/api/earthquake/route.ts`
|
||||
- Delete: `src/app/api/undersea-cables/route.ts`
|
||||
- Delete: everything in `src/app/api/camera` codebase (`caltrans`, `extract`, `gdot`, `test`, `tfl`, `traffic`)
|
||||
|
||||
- [ ] **Step 1: Delete all plugin-specific Next.js API routes**
|
||||
|
||||
Run: `rm -rf src/app/api/earthquake`
|
||||
Run: `rm -rf src/app/api/undersea-cables`
|
||||
|
||||
**WAIT**: For `src/app/api/camera`, we must physically copy the fetchers into `worldwideview-plugins` before we delete them.
|
||||
|
||||
Run: `cp -r src/app/api/camera/caltrans ../worldwideview-plugins/packages/wwv-plugin-camera/src/`
|
||||
Run: `cp -r src/app/api/camera/gdot ../worldwideview-plugins/packages/wwv-plugin-camera/src/`
|
||||
Run: `cp -r src/app/api/camera/tfl ../worldwideview-plugins/packages/wwv-plugin-camera/src/`
|
||||
Run: `rm -rf src/app/api/camera`
|
||||
|
||||
- [ ] **Step 2: Commit the deleted API routes**
|
||||
|
||||
```bash
|
||||
git add src/app/api/earthquake src/app/api/undersea-cables src/app/api/camera
|
||||
git commit -m "refactor!: strip preferential plugin APIs from core"
|
||||
```
|
||||
|
||||
### Task 3: Migrate Earthquakes and Undersea Cables Plugins
|
||||
|
||||
**Files:**
|
||||
- Modify: `../worldwideview-plugins/packages/wwv-plugin-earthquakes/src/index.ts`
|
||||
- Modify: `../worldwideview-plugins/packages/wwv-plugin-undersea-cables/src/index.ts`
|
||||
|
||||
- [ ] **Step 1: Update Earthquakes plugin to direct browser fetch (Option A)**
|
||||
|
||||
In `../worldwideview-plugins/packages/wwv-plugin-earthquakes/src/index.ts`, replace the `/api/earthquake` fetch with the USGS direct URL.
|
||||
|
||||
```json
|
||||
{
|
||||
"instruction": "Replace the API fetch with direct USGS fetch and remove apiBasePath",
|
||||
"replace_chunks": [
|
||||
{
|
||||
"start_line": 38,
|
||||
"end_line": 40,
|
||||
"target_content": " try {\n const res = await globalThis.fetch(`/api/earthquake`);\n if (!res.ok) {",
|
||||
"replacement_content": " try {\n const res = await globalThis.fetch(`https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson`);\n if (!res.ok) {"
|
||||
},
|
||||
{
|
||||
"start_line": 94,
|
||||
"end_line": 96,
|
||||
"target_content": " getServerConfig(): ServerPluginConfig {\n return { apiBasePath: \"/api/earthquake\", pollingIntervalMs: 120000, historyEnabled: false };\n }",
|
||||
"replacement_content": " getServerConfig(): ServerPluginConfig {\n return { pollingIntervalMs: 120000, historyEnabled: false };\n }"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Update Undersea Cables plugin to use Universal Proxy (Option B)**
|
||||
|
||||
In `../worldwideview-plugins/packages/wwv-plugin-undersea-cables/src/index.ts`:
|
||||
|
||||
```json
|
||||
{
|
||||
"instruction": "Proxy route to universal proxy",
|
||||
"replace_chunks": [
|
||||
{
|
||||
"start_line": 35,
|
||||
"end_line": 37,
|
||||
"target_content": " // Proxy route to bypass CORS for Telegeography submarine cable map API\n const url = \"/api/undersea-cables\";\n ",
|
||||
"replacement_content": " // Proxy route to bypass CORS for Telegeography submarine cable map API\n const targetUrl = encodeURIComponent(\"https://www.submarinecablemap.com/api/v3/cable/cable-geo.json\");\n const url = `/api/proxy?url=${targetUrl}`;\n "
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 3: Commit the plugin migrations**
|
||||
|
||||
```bash
|
||||
cd ../worldwideview-plugins
|
||||
git add packages/wwv-plugin-earthquakes/src/index.ts packages/wwv-plugin-undersea-cables/src/index.ts
|
||||
git commit -m "refactor: transition earthquake and undersea cables to decoupled fetching"
|
||||
cd ../worldwideview
|
||||
```
|
||||
|
||||
### Task 4: Refactor Camera Plugin to Fetch Natively
|
||||
|
||||
**Files:**
|
||||
- Modify: `../worldwideview-plugins/packages/wwv-plugin-camera/src/index.ts`
|
||||
- Delete: `caltrans`, `gdot`, `tfl` previously copied components (combine into `trafficFetchers.ts`)
|
||||
|
||||
- [ ] **Step 1: Consolidate the camera fetchers**
|
||||
|
||||
Create `../worldwideview-plugins/packages/wwv-plugin-camera/src/trafficFetchers.ts`.
|
||||
Migrate the code from the `caltransFetcher.ts`, `gdotFetcher.ts`, and `tflFetcher.ts` files that we copied in Task 2.
|
||||
Crucially, when doing `fetch(...)` in these fetchers, if the endpoint doesn't support CORS, wrap it in `/api/proxy?url=${encodeURIComponent(...) }` so the browser can fetch it. Ensure the data models align.
|
||||
|
||||
- [ ] **Step 2: Update `wwv-plugin-camera/src/index.ts` to call the fetchers natively**
|
||||
|
||||
In `../worldwideview-plugins/packages/wwv-plugin-camera/src/index.ts` function `loadTrafficCameras()`:
|
||||
|
||||
```json
|
||||
{
|
||||
"instruction": "Replace API fetch with native client-side parallel fetching",
|
||||
"replace_chunks": [
|
||||
{
|
||||
"start_line": 106,
|
||||
"end_line": 118,
|
||||
"target_content": " private async loadTrafficCameras(): Promise<void> {\n try {\n const res = await fetch(\"/api/camera/traffic\");\n if (!res.ok) throw new Error(`API returned ${res.status}`);\n const data = await res.json();\n if (data.cameras && Array.isArray(data.cameras)) {\n this.sourceBuckets[\"default\"] = data.cameras.map(\n (f: unknown, i: number) => mapGeoJsonFeature(f, i, \"traffic\"),\n );\n }\n } catch (err) {\n console.warn(\"[CameraPlugin] Traffic cameras API failed:\", err);\n }",
|
||||
"replacement_content": " private async loadTrafficCameras(): Promise<void> {\n try {\n const { fetchCaltrans, fetchGdot, fetchTfl } = await import(\"./trafficFetchers\");\n const [caltrans, gdot, tfl] = await Promise.allSettled([\n fetchCaltrans(), fetchGdot(), fetchTfl()\n ]);\n \n const cameras = [];\n if (caltrans.status === \"fulfilled\") cameras.push(...caltrans.value);\n if (gdot.status === \"fulfilled\") cameras.push(...gdot.value);\n if (tfl.status === \"fulfilled\") cameras.push(...tfl.value);\n\n if (cameras.length > 0) {\n this.sourceBuckets[\"default\"] = cameras.map(\n (f: unknown, i: number) => mapGeoJsonFeature(f, i, \"traffic\"),\n );\n }\n } catch (err) {\n console.warn(\"[CameraPlugin] Traffic cameras API failed:\", err);\n }"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 3: Remove the extra node API files from the plugin source tree**
|
||||
|
||||
Run: `rm -rf ../worldwideview-plugins/packages/wwv-plugin-camera/src/caltrans`
|
||||
Run: `rm -rf ../worldwideview-plugins/packages/wwv-plugin-camera/src/gdot`
|
||||
Run: `rm -rf ../worldwideview-plugins/packages/wwv-plugin-camera/src/tfl`
|
||||
|
||||
- [ ] **Step 4: Commit Camera plugin refactoring**
|
||||
|
||||
```bash
|
||||
cd ../worldwideview-plugins
|
||||
git add packages/wwv-plugin-camera/src
|
||||
git commit -m "feat: migrate traffic camera fetchers to client-side plugin bundle"
|
||||
cd ../worldwideview
|
||||
```
|
||||
@@ -0,0 +1,25 @@
|
||||
<!-- Generated: 2026-04-19 15:23:00 UTC -->
|
||||
# Testing
|
||||
|
||||
WorldWideView maintains a robust Vitest testing infrastructure utilizing `jsdom` environments to mock browser globals and React Testing Library utilities for accurate integration flow testing.
|
||||
|
||||
The primary requirement is full test coverage over authentication routes, edge-case platform parsing, and API rate-limit security.
|
||||
|
||||
## Test Types
|
||||
- **Unit Logic:** Verifies math, utilities, and configuration mappings (e.g. `edition.test.ts`).
|
||||
- **Middleware Integration:** Evaluates Request/Response blocks (e.g. `rateLimit.test.ts`).
|
||||
- **Component Mocking:** Exercises the React ecosystem state behaviors (e.g. `DeclarativePlugin.test.ts`).
|
||||
|
||||
## Key Files
|
||||
- `vitest.config.ts` (lines 5-25): Defines the inclusion criteria spanning `src/lib/**`, `src/core/**`, and `src/plugins/**`.
|
||||
- `src/lib/rateLimit.test.ts` (lines 15-60): Demonstrates test encapsulation regarding the Upstash Redis fallbacks.
|
||||
- `src/core/edition.test.ts` (lines 10-30): Confirms valid feature flag evaluations across local/demo builds.
|
||||
|
||||
## Running Tests
|
||||
Run tests natively within the root directory utilizing `pnpm`:
|
||||
```bash
|
||||
# Execute standard test suite runs over all watched directories
|
||||
pnpm test
|
||||
# OR
|
||||
vitest run
|
||||
```
|
||||
@@ -0,0 +1,6 @@
|
||||
const { PrismaClient } = require('./src/generated/prisma');
|
||||
const prisma = new PrismaClient();
|
||||
prisma.installedPlugin.findMany().then(r => console.log(JSON.stringify(r.map(record => {
|
||||
const manifest = JSON.parse(record.config);
|
||||
return { id: manifest.id, entry: manifest.entry, format: manifest.format };
|
||||
}), null, 2))).catch(console.error).finally(() => prisma.$disconnect());
|
||||
@@ -0,0 +1,9 @@
|
||||
import sqlite3
|
||||
import json
|
||||
conn = sqlite3.connect('data/wwv.db')
|
||||
cursor = conn.cursor()
|
||||
cursor.execute('SELECT id, dataSource FROM installed_plugins')
|
||||
rows = cursor.fetchall()
|
||||
for r in rows:
|
||||
if r[1]:
|
||||
print(f"plugin={r[0]}, dataSource={r[1]}")
|
||||
@@ -0,0 +1,37 @@
|
||||
Write-Host "[*] Setting up WorldWideView for Local Development..."
|
||||
|
||||
# Check for pnpm
|
||||
try {
|
||||
$null = Get-Command pnpm -ErrorAction Stop
|
||||
} catch {
|
||||
Write-Host "[Error] pnpm is not installed or not in PATH."
|
||||
Write-Host "Please install it first: https://pnpm.io/installation"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "[*] Installing dependencies..."
|
||||
pnpm install
|
||||
|
||||
Write-Host "[*] Running initial setup (generating secrets)..."
|
||||
pnpm run setup
|
||||
|
||||
# Check for the sibling Data Engine repository
|
||||
if (-not (Test-Path "../wwv-data-engine")) {
|
||||
Write-Host ""
|
||||
Write-Host "=====================================================================" -ForegroundColor Yellow
|
||||
Write-Host "[!] NOTICE: Local Data Engine not found at ../wwv-data-engine" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
Write-Host "Frontend-Only Mode: You are developing the frontend UI." -ForegroundColor Green
|
||||
Write-Host "WorldWideView will automatically stream data from the Cloud Engine." -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Write-Host "Full-Stack Mode: If you want to develop backend data seeders, you" -ForegroundColor Cyan
|
||||
Write-Host "must clone the open-source data engine as a sibling directory:" -ForegroundColor Cyan
|
||||
Write-Host " cd ..; git clone https://github.com/silvertakana/wwv-data-engine"
|
||||
Write-Host " cd wwv-data-engine; pnpm install"
|
||||
Write-Host "=====================================================================" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
Write-Host "[*] Starting local Next.js frontend server..."
|
||||
Write-Host " (To run the data engine backends concurrently, run: pnpm dev:all)"
|
||||
pnpm run dev
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "🌍 Setting up WorldWideView for Local Development..."
|
||||
|
||||
# Check for pnpm
|
||||
if ! command -v pnpm &> /dev/null; then
|
||||
echo "❌ Error: pnpm is required but not installed."
|
||||
echo "Please install it first: https://pnpm.io/installation"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "📦 Installing dependencies..."
|
||||
pnpm install
|
||||
|
||||
echo "🔐 Running initial setup (generating secrets)..."
|
||||
pnpm run setup
|
||||
|
||||
# Check for the sibling Data Engine repository
|
||||
if [ ! -d "../wwv-data-engine" ]; then
|
||||
echo ""
|
||||
echo "====================================================================="
|
||||
echo "⚠️ NOTICE: Local Data Engine not found at ../wwv-data-engine"
|
||||
echo ""
|
||||
echo "Frontend-Only Mode: You are developing the frontend UI."
|
||||
echo "WorldWideView will automatically stream data from the Cloud Engine."
|
||||
echo ""
|
||||
echo "Full-Stack Mode: If you want to develop backend data seeders, you"
|
||||
echo "must clone the open-source data engine as a sibling directory:"
|
||||
echo " cd .. && git clone https://github.com/silvertakana/wwv-data-engine"
|
||||
echo " cd wwv-data-engine && pnpm install"
|
||||
echo "====================================================================="
|
||||
echo ""
|
||||
fi
|
||||
|
||||
echo "🚀 Starting local Next.js frontend server..."
|
||||
echo " (To run the data engine backends concurrently, run: pnpm dev:all)"
|
||||
pnpm run dev
|
||||
Whitespace-only changes.
+336749
File diff suppressed because it is too large.
Load diff
+77
-37
@@ -1,46 +1,66 @@
|
||||
import type { NextConfig } from "next";
|
||||
import path from "path";
|
||||
import webpack from "webpack";
|
||||
import CopyPlugin from "copy-webpack-plugin";
|
||||
|
||||
const cesiumSource = path.resolve(__dirname, "node_modules/cesium/Build/Cesium");
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
output: "standalone",
|
||||
serverExternalPackages: ["better-sqlite3", "@prisma/adapter-better-sqlite3", "@prisma/client", "prisma"],
|
||||
transpilePackages: ["@worldwideview/wwv-plugin-sdk","resium",
|
||||
"react-player",
|
||||
"satellite.js"
|
||||
],
|
||||
experimental: {
|
||||
memoryBasedWorkersCount: true,
|
||||
cpus: 2,
|
||||
optimizePackageImports: ["lucide-react"],
|
||||
},
|
||||
typescript: {
|
||||
ignoreBuildErrors: true,
|
||||
},
|
||||
async headers() {
|
||||
return [
|
||||
{
|
||||
source: "/(.*)",
|
||||
headers: [
|
||||
{
|
||||
key: "Content-Security-Policy",
|
||||
value: [
|
||||
"default-src 'self'",
|
||||
// CesiumJS requires unsafe-eval (worker compilation) and unsafe-inline (styles)
|
||||
"script-src 'self' 'unsafe-eval' 'unsafe-inline' blob: https://unpkg.com https://cdn.jsdelivr.net https://analytics.worldwideview.dev https://va.vercel-scripts.com https://pagead2.googlesyndication.com https://adservice.google.com https://www.googletagservices.com https://ep2.adtrafficquality.google https://static.cloudflareinsights.com",
|
||||
"style-src 'self' 'unsafe-inline' fonts.googleapis.com",
|
||||
"font-src 'self' fonts.gstatic.com",
|
||||
// Camera streams load images/MJPEG from arbitrary IPs worldwide — http: https: required
|
||||
"img-src 'self' data: blob: http: https:",
|
||||
// Camera HLS streams and external data fetches need arbitrary origins
|
||||
"connect-src 'self' http: https: ws: wss:",
|
||||
// HLS video streams from arbitrary camera sources
|
||||
"media-src 'self' blob: http: https:",
|
||||
// Embeddable video platforms for camera iframes
|
||||
"frame-src 'self' *.youtube.com *.youtube-nocookie.com *.twitch.tv *.vimeo.com *.webcamera.pl *.ivideon.com *.rtsp.me *.bnu.tv https://googleads.g.doubleclick.net https://tpc.googlesyndication.com https://ep2.adtrafficquality.google https://*.google.com",
|
||||
"worker-src 'self' blob:",
|
||||
"frame-ancestors 'none'",
|
||||
].join("; "),
|
||||
},
|
||||
{ key: "X-Frame-Options", value: "DENY" },
|
||||
{ key: "X-Content-Type-Options", value: "nosniff" },
|
||||
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
|
||||
{ key: "X-DNS-Prefetch-Control", value: "on" },
|
||||
{
|
||||
key: "Permissions-Policy",
|
||||
value: "camera=(), microphone=(), geolocation=(self)",
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
},
|
||||
|
||||
outputFileTracingExcludes: {
|
||||
"*": ["./public/cesium/**"],
|
||||
},
|
||||
env: {
|
||||
CESIUM_BASE_URL: "/cesium",
|
||||
},
|
||||
webpack: (config, { isServer }) => {
|
||||
webpack: (config, { isServer, webpack }) => {
|
||||
if (!isServer) {
|
||||
// Copy Cesium static assets to public/cesium (Production only)
|
||||
if (process.env.NODE_ENV === "production" || !isServer) {
|
||||
// We only add it here if it's production or if we're not using predev
|
||||
// To be safe, let's just make it only run if NOT in dev
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
config.plugins?.push(
|
||||
new CopyPlugin({
|
||||
patterns: [
|
||||
{
|
||||
from: path.join(cesiumSource, "Workers"),
|
||||
to: path.resolve(__dirname, "public/cesium/Workers"),
|
||||
},
|
||||
{
|
||||
from: path.join(cesiumSource, "ThirdParty"),
|
||||
to: path.resolve(__dirname, "public/cesium/ThirdParty"),
|
||||
},
|
||||
{
|
||||
from: path.join(cesiumSource, "Assets"),
|
||||
to: path.resolve(__dirname, "public/cesium/Assets"),
|
||||
},
|
||||
{
|
||||
from: path.join(cesiumSource, "Widgets"),
|
||||
to: path.resolve(__dirname, "public/cesium/Widgets"),
|
||||
},
|
||||
],
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Define CESIUM_BASE_URL for Cesium's worker resolution
|
||||
config.plugins?.push(
|
||||
new webpack.DefinePlugin({
|
||||
@@ -64,4 +84,24 @@ const nextConfig: NextConfig = {
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
import { withSentryConfig } from "@sentry/nextjs";
|
||||
|
||||
export default withSentryConfig(nextConfig, {
|
||||
// For all available options, see:
|
||||
// https://github.com/getsentry/sentry-webpack-plugin#options
|
||||
org: process.env.SENTRY_ORG,
|
||||
project: process.env.SENTRY_PROJECT,
|
||||
sentryUrl: process.env.GLITCHTIP_SERVER_URL,
|
||||
authToken: process.env.SENTRY_AUTH_TOKEN,
|
||||
|
||||
// Automatically tree-shake Sentry logger statements to reduce bundle size
|
||||
disableLogger: true,
|
||||
|
||||
// Hides source maps from generated client bundles
|
||||
sourcemaps: {
|
||||
disable: true,
|
||||
},
|
||||
|
||||
// Upload a larger set of source maps for prettier stack traces (increases build time)
|
||||
widenClientFileUpload: true,
|
||||
});
|
||||
Generated
-4480
File diff suppressed because it is too large.
Load diff
+46
-7
@@ -1,36 +1,75 @@
|
||||
{
|
||||
"name": "worldwideview",
|
||||
"version": "0.1.0",
|
||||
"version": "1.18.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"setup": "node scripts/setup.mjs",
|
||||
"test-worktree": "node scripts/test-worktree.mjs",
|
||||
"clean": "node -e \"const fs=require('fs');fs.rmSync('.next',{recursive:true,force:true})\"",
|
||||
"dev": "next dev --webpack",
|
||||
"predev": "node scripts/copy-cesium.mjs",
|
||||
"dev:all": "concurrently -n \"next,backends\" -c \"magenta,blue\" \"pnpm dev\" \"pnpm dev:backends\"",
|
||||
"dev:backends": "cd ../wwv-data-engine && pnpm dev",
|
||||
"predev": "npx prisma migrate deploy && node scripts/copy-cesium.mjs",
|
||||
"copy-cesium": "node scripts/copy-cesium.mjs",
|
||||
"build": "next build --webpack",
|
||||
"start": "next start"
|
||||
"start": "next start",
|
||||
"test": "vitest run",
|
||||
"db:reset": "npx prisma migrate reset --force"
|
||||
},
|
||||
"dependencies": {
|
||||
"@auth/prisma-adapter": "^2.11.1",
|
||||
"@prisma/adapter-better-sqlite3": "^7.5.0",
|
||||
"@prisma/client": "^7.5.0",
|
||||
"@sentry/nextjs": "^10.48.0",
|
||||
"@supabase/supabase-js": "^2.98.0",
|
||||
"@vercel/analytics": "^1.6.1",
|
||||
"@worldwideview/wwv-plugin-sdk": "workspace:*",
|
||||
"bcryptjs": "^3.0.3",
|
||||
"cesium": "^1.139.0",
|
||||
"cheerio": "^1.2.0",
|
||||
"hls.js": "^1.6.15",
|
||||
"insecam-api": "^0.0.3",
|
||||
"jsdom": "^28.1.0",
|
||||
"jose": "^6.2.2",
|
||||
"lucide-react": "^0.576.0",
|
||||
"next": "16.1.6",
|
||||
"next": "16.2.3",
|
||||
"next-auth": "^5.0.0-beta.30",
|
||||
"prisma": "^7.5.0",
|
||||
"react": "19.2.3",
|
||||
"react-dom": "19.2.3",
|
||||
"react-player": "^3.4.0",
|
||||
"resium": "^1.19.4",
|
||||
"resium": "1.19.4",
|
||||
"satellite.js": "^7.0.0",
|
||||
"tslib": "^2.8.1",
|
||||
"ws": "^8.14.2",
|
||||
"zustand": "^5.0.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@testing-library/dom": "^10.4.1",
|
||||
"@testing-library/react": "^16.3.2",
|
||||
"@types/bcryptjs": "^3.0.0",
|
||||
"@types/cesium": "^1.70.4",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^19",
|
||||
"@types/react-dom": "^19",
|
||||
"@types/ws": "^8.18.1",
|
||||
"@vitejs/plugin-react": "^5.1.4",
|
||||
"concurrently": "^9.2.1",
|
||||
"copy-webpack-plugin": "^14.0.0",
|
||||
"typescript": "^5"
|
||||
"jsdom": "^28.1.0",
|
||||
"rollup-plugin-external-globals": "^0.13.0",
|
||||
"typescript": "^5",
|
||||
"vite": "^8.0.8",
|
||||
"vitest": "^4.0.18"
|
||||
},
|
||||
"pnpm": {
|
||||
"onlyBuiltDependencies": [
|
||||
"@prisma/engines",
|
||||
"better-sqlite3",
|
||||
"esbuild",
|
||||
"prisma",
|
||||
"protobufjs",
|
||||
"sharp",
|
||||
"unrs-resolver"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
# @worldwideview/wwv-plugin-sdk
|
||||
|
||||
Plugin SDK for building [WorldWideView](https://github.com/silvertakana/worldwideview) globe plugins. Provides TypeScript types, interfaces, and utilities that all plugins depend on.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install @worldwideview/wwv-plugin-sdk
|
||||
```
|
||||
|
||||
## Core Interfaces
|
||||
|
||||
| Interface | Purpose |
|
||||
|---|---|
|
||||
| `WorldPlugin` | Main plugin contract — lifecycle, data fetching, rendering |
|
||||
| `GeoEntity` | A positioned object on the globe (lat/lon/alt + properties) |
|
||||
| `PluginContext` | Host app context injected into every plugin at init |
|
||||
| `LayerConfig` | Visual layer settings (color, clustering, limits) |
|
||||
| `CesiumEntityOptions` | Per-entity Cesium rendering options (point, model, etc.) |
|
||||
| `SelectionBehavior` | Optional trail / fly-to behavior on entity selection |
|
||||
| `FilterDefinition` | Declarative filter UI (text, select, range, boolean) |
|
||||
| `ServerPluginConfig` | Server-side API routing and polling config |
|
||||
|
||||
## Quick Example
|
||||
|
||||
```ts
|
||||
import type { WorldPlugin, GeoEntity, TimeRange, PluginContext, LayerConfig, CesiumEntityOptions } from "@worldwideview/wwv-plugin-sdk";
|
||||
|
||||
export class MyPlugin implements WorldPlugin {
|
||||
id = "my-plugin";
|
||||
name = "My Plugin";
|
||||
description = "A custom WorldWideView plugin";
|
||||
icon = "🌍";
|
||||
category = "custom";
|
||||
version = "1.0.0";
|
||||
|
||||
async initialize(ctx: PluginContext) { /* setup */ }
|
||||
destroy() { /* cleanup */ }
|
||||
|
||||
async fetch(timeRange: TimeRange): Promise<GeoEntity[]> {
|
||||
// Return geo-positioned entities
|
||||
return [];
|
||||
}
|
||||
|
||||
getPollingInterval() { return 30000; }
|
||||
getLayerConfig(): LayerConfig {
|
||||
return { color: "#3b82f6", clusterEnabled: true, clusterDistance: 40 };
|
||||
}
|
||||
renderEntity(entity: GeoEntity): CesiumEntityOptions {
|
||||
return { type: "point", color: "#3b82f6", size: 6 };
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Changelog
|
||||
|
||||
- **v1.0.3** — Added README with core interfaces and usage docs.
|
||||
- **v1.0.2** — Package metadata updates.
|
||||
- **v1.0.1** — Package configuration fixes.
|
||||
- **v1.0.0** — Initial release with core types and interfaces.
|
||||
|
||||
## License
|
||||
|
||||
ISC
|
||||
+242
@@ -0,0 +1,242 @@
|
||||
import type { ComponentType } from "react";
|
||||
/** Standard SVG icon size (px) used by createSvgIconUrl when no size is given. */
|
||||
export declare const DEFAULT_ICON_SIZE = 32;
|
||||
export interface IconUrlOptions extends Record<string, unknown> {
|
||||
/** Icon color (stroke). */
|
||||
color?: string;
|
||||
/** SVG icon size in px (default: DEFAULT_ICON_SIZE). */
|
||||
size?: number;
|
||||
/** Show circle background behind icon (default: true). */
|
||||
background?: boolean;
|
||||
/** Background fill color (default: semi-transparent dark slate). */
|
||||
backgroundColor?: string;
|
||||
}
|
||||
/**
|
||||
* Convert a React icon component into a `data:image/svg+xml` URL for Cesium billboards.
|
||||
* By default wraps the icon in a filled circle for visibility on any terrain.
|
||||
* Pass `{ background: false }` to opt out.
|
||||
*/
|
||||
export declare function createSvgIconUrl(Icon: ComponentType<any>, opts?: IconUrlOptions): string;
|
||||
export type { PluginManifest, PluginFormat, PluginType, TrustTier, PluginCapability, DataSourceConfig, FieldMapping, RenderingConfig } from "./manifest";
|
||||
export type PluginCategory = "aviation" | "maritime" | "military" | "conflict" | "natural-disaster" | "infrastructure" | "space" | "cyber" | "economic" | "intelligence" | "custom";
|
||||
export interface TimeRange {
|
||||
start: Date;
|
||||
end: Date;
|
||||
}
|
||||
export type TimeWindow = "1h" | "6h" | "24h" | "48h" | "7d";
|
||||
export interface GeoEntity {
|
||||
id: string;
|
||||
pluginId: string;
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
altitude?: number;
|
||||
heading?: number;
|
||||
speed?: number;
|
||||
timestamp: Date;
|
||||
label?: string;
|
||||
properties: Record<string, unknown>;
|
||||
}
|
||||
export interface WsStreamPayload {
|
||||
type: "data" | "error";
|
||||
pluginId?: string;
|
||||
payload?: GeoEntity[];
|
||||
error?: string;
|
||||
}
|
||||
export interface LayerConfig {
|
||||
color: string;
|
||||
iconUrl?: string;
|
||||
clusterEnabled: boolean;
|
||||
clusterDistance: number;
|
||||
minZoomLevel?: number;
|
||||
maxEntities?: number;
|
||||
/** If true, the core primitive renderer and StackManager will ignore this plugin's entities. Use when getGlobeComponent completely manages rendering. */
|
||||
disableDefaultRendering?: boolean;
|
||||
}
|
||||
export interface CesiumEntityOptions {
|
||||
type: "billboard" | "point" | "polyline" | "polygon" | "label" | "model";
|
||||
color?: string;
|
||||
size?: number;
|
||||
iconUrl?: string;
|
||||
rotation?: number;
|
||||
outlineColor?: string;
|
||||
outlineWidth?: number;
|
||||
labelText?: string;
|
||||
labelFont?: string;
|
||||
distanceDisplayCondition?: {
|
||||
near: number;
|
||||
far: number;
|
||||
};
|
||||
disableDepthTestDistance?: number;
|
||||
/** Billboard scale override (default: 0.6). Plugin devs can set this to control icon size. */
|
||||
iconScale?: number;
|
||||
/** GPU Depth Test bias (meters). Negative values pull billboard towards camera (default: -1000 for visibility). */
|
||||
depthBias?: number;
|
||||
modelUrl?: string;
|
||||
modelScale?: number;
|
||||
modelMinPixelSize?: number;
|
||||
modelHeadingOffset?: number;
|
||||
trailOptions?: {
|
||||
width?: number;
|
||||
color?: string;
|
||||
dashPattern?: "solid" | "dashed";
|
||||
opacityFade?: boolean;
|
||||
};
|
||||
/** Skip mathematical horizon culling (useful for high-altitude objects like satellites) */
|
||||
disableManualHorizonCulling?: boolean;
|
||||
/** Skip combining this entity into clusters/stacks when zoomed out */
|
||||
disableClustering?: boolean;
|
||||
}
|
||||
export interface SelectionBehavior {
|
||||
showTrail?: boolean;
|
||||
trailDurationSec?: number;
|
||||
trailStepSec?: number;
|
||||
trailColor?: string;
|
||||
flyToOffsetMultiplier?: number;
|
||||
flyToBaseDistance?: number;
|
||||
}
|
||||
export interface ServerPluginConfig {
|
||||
apiBasePath: string;
|
||||
pollingIntervalMs: number;
|
||||
requiresAuth?: boolean;
|
||||
historyEnabled?: boolean;
|
||||
availabilityEnabled?: boolean;
|
||||
/** WebSocket URL for direct engine connection. Overrides the global default engine URL. */
|
||||
streamUrl?: string;
|
||||
}
|
||||
export interface PluginContext {
|
||||
apiBaseUrl: string;
|
||||
/**
|
||||
* Key-value map of generic environment variables.
|
||||
* The engine surfaces any variable starting with NEXT_PUBLIC_WWV_PLUGIN_
|
||||
*
|
||||
* WARNING: These are exposed to the client-side browser bundle.
|
||||
* DO NOT USE THIS FOR API KEYS. For sensitive tokens, use getSecret() if provided.
|
||||
*/
|
||||
env: Record<string, string>;
|
||||
/** The running edition of the WWV engine */
|
||||
edition: "local" | "cloud" | "demo";
|
||||
timeRange: TimeRange;
|
||||
onDataUpdate: (entities: GeoEntity[]) => void;
|
||||
onError: (error: Error) => void;
|
||||
/** Get plugin-specific settings from the app config store */
|
||||
getPluginSettings: <T = unknown>(pluginId: string) => T | undefined;
|
||||
/** Returns true if the app is in timeline playback mode */
|
||||
isPlaybackMode: () => boolean;
|
||||
/** Returns the current timeline time (relevant in playback mode) */
|
||||
getCurrentTime: () => Date;
|
||||
}
|
||||
export interface FilterSelectOption {
|
||||
value: string;
|
||||
label: string;
|
||||
}
|
||||
export interface FilterRangeConfig {
|
||||
min: number;
|
||||
max: number;
|
||||
step: number;
|
||||
}
|
||||
export interface FilterDefinition {
|
||||
id: string;
|
||||
label: string;
|
||||
type: "text" | "select" | "range" | "boolean";
|
||||
propertyKey: string;
|
||||
options?: FilterSelectOption[];
|
||||
range?: FilterRangeConfig;
|
||||
}
|
||||
export type FilterValue = {
|
||||
type: "text";
|
||||
value: string;
|
||||
} | {
|
||||
type: "select";
|
||||
values: string[];
|
||||
} | {
|
||||
type: "range";
|
||||
min: number;
|
||||
max: number;
|
||||
} | {
|
||||
type: "boolean";
|
||||
value: boolean;
|
||||
};
|
||||
export interface WorldPlugin {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
icon: string | ComponentType<{
|
||||
size?: number;
|
||||
color?: string;
|
||||
}>;
|
||||
category: PluginCategory;
|
||||
version: string;
|
||||
initialize(ctx: PluginContext): Promise<void>;
|
||||
destroy(): void;
|
||||
fetch(timeRange: TimeRange): Promise<GeoEntity[]>;
|
||||
getPollingInterval(): number;
|
||||
getLayerConfig(): LayerConfig;
|
||||
renderEntity(entity: GeoEntity): CesiumEntityOptions;
|
||||
getSelectionBehavior?(entity: GeoEntity): SelectionBehavior | null;
|
||||
getServerConfig?(): ServerPluginConfig;
|
||||
getFilterDefinitions?(): FilterDefinition[];
|
||||
getLegend?(): {
|
||||
label: string;
|
||||
color: string;
|
||||
filterId?: string;
|
||||
filterValue?: string;
|
||||
}[];
|
||||
getSidebarComponent?(): ComponentType<{
|
||||
plugin?: any;
|
||||
} | any>;
|
||||
getDetailComponent?(): ComponentType<{
|
||||
entity: GeoEntity;
|
||||
}>;
|
||||
getSettingsComponent?(): ComponentType<{
|
||||
pluginId: string;
|
||||
}>;
|
||||
/** Custom React component injected into the Globe view for rendering primitives/data sources (e.g. GeoJSON). */
|
||||
getGlobeComponent?(): ComponentType<{
|
||||
viewer: any;
|
||||
enabled: boolean;
|
||||
}>;
|
||||
requiresConfiguration?(settings: unknown): boolean;
|
||||
/** Map raw websocket payload into GeoEntity array. Optional existingEntities is provided so plugins can merge state (e.g. historical trails). */
|
||||
mapWebsocketPayload?(payload: any, existingEntities?: GeoEntity[]): GeoEntity[];
|
||||
}
|
||||
export type GlobePlugin = WorldPlugin;
|
||||
export type DataBusEvents = {
|
||||
pluginRegistered: {
|
||||
pluginId: string;
|
||||
defaultInterval: number;
|
||||
};
|
||||
dataUpdated: {
|
||||
pluginId: string;
|
||||
entities: GeoEntity[];
|
||||
};
|
||||
entitySelected: {
|
||||
entity: GeoEntity | null;
|
||||
};
|
||||
layerToggled: {
|
||||
pluginId: string;
|
||||
enabled: boolean;
|
||||
};
|
||||
timeRangeChanged: {
|
||||
timeRange: TimeRange;
|
||||
};
|
||||
cameraPreset: {
|
||||
presetId: string;
|
||||
};
|
||||
cameraFaceTowards: {
|
||||
lat: number;
|
||||
lon: number;
|
||||
alt: number;
|
||||
};
|
||||
cameraGoTo: {
|
||||
lat: number;
|
||||
lon: number;
|
||||
alt: number;
|
||||
distance?: number;
|
||||
maxPitch?: number;
|
||||
heading?: number;
|
||||
};
|
||||
globeReady: Record<string, never>;
|
||||
};
|
||||
export * from "./viteGlobals";
|
||||
export { wwvStaticCompiler } from "./vite/wwvStaticCompiler";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAI3C,kFAAkF;AAClF,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAKpC,MAAM,WAAW,cAAe,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC3D,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oEAAoE;IACpE,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,aAAa,CAAC,GAAG,CAAC,EACxB,IAAI,GAAE,cAAmB,GAC1B,MAAM,CA4BR;AAGD,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGzJ,MAAM,MAAM,cAAc,GACpB,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,kBAAkB,GAClB,gBAAgB,GAChB,OAAO,GACP,OAAO,GACP,UAAU,GACV,cAAc,GACd,QAAQ,CAAC;AAGf,MAAM,WAAW,SAAS;IACtB,KAAK,EAAE,IAAI,CAAC;IACZ,GAAG,EAAE,IAAI,CAAC;CACb;AAED,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC;AAG5D,MAAM,WAAW,SAAS;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD,MAAM,WAAW,WAAW;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yJAAyJ;IACzJ,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACrC;AAGD,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;IACzE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACzD,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,8FAA8F;IAC9F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mHAAmH;IACnH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE;QACX,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;QACjC,WAAW,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;IACF,2FAA2F;IAC3F,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,sEAAsE;IACtE,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAGD,MAAM,WAAW,iBAAiB;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAGD,MAAM,WAAW,kBAAkB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,2FAA2F;IAC3F,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAKD,MAAM,WAAW,aAAa;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,4CAA4C;IAC5C,OAAO,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;IACpC,SAAS,EAAE,SAAS,CAAC;IACrB,YAAY,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;IAC9C,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAChC,6DAA6D;IAC7D,iBAAiB,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC,GAAG,SAAS,CAAC;IACpE,2DAA2D;IAC3D,cAAc,EAAE,MAAM,OAAO,CAAC;IAC9B,oEAAoE;IACpE,cAAc,EAAE,MAAM,IAAI,CAAC;CAC9B;AAGD,MAAM,WAAW,kBAAkB;IAAG,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;CAAE;AACrE,MAAM,WAAW,iBAAiB;IAAG,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;CAAE;AAC9E,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC/B,KAAK,CAAC,EAAE,iBAAiB,CAAC;CAC7B;AAED,MAAM,MAAM,WAAW,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAG1C,MAAM,WAAW,WAAW;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChE,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAGhB,UAAU,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,OAAO,IAAI,IAAI,CAAC;IAGhB,KAAK,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAClD,kBAAkB,IAAI,MAAM,CAAC;IAG7B,cAAc,IAAI,WAAW,CAAC;IAC9B,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,mBAAmB,CAAC;IAGrD,oBAAoB,CAAC,CAAC,MAAM,EAAE,SAAS,GAAG,iBAAiB,GAAG,IAAI,CAAC;IACnE,eAAe,CAAC,IAAI,kBAAkB,CAAC;IACvC,oBAAoB,CAAC,IAAI,gBAAgB,EAAE,CAAC;IAC5C,SAAS,CAAC,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAALine truncated
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
// ─── WorldWideView Plugin SDK ─────────────────────────────────
|
||||
// The public API for building WorldWideView plugins.
|
||||
// Import from "@worldwideview/wwv-plugin-sdk" in your plugin.
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
var __rest = (this && this.__rest) || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.wwvStaticCompiler = exports.DEFAULT_ICON_SIZE = void 0;
|
||||
exports.createSvgIconUrl = createSvgIconUrl;
|
||||
const react_1 = require("react");
|
||||
const server_1 = require("react-dom/server");
|
||||
/** Standard SVG icon size (px) used by createSvgIconUrl when no size is given. */
|
||||
exports.DEFAULT_ICON_SIZE = 32;
|
||||
/** Default dark background color for icon circles. */
|
||||
const DEFAULT_BG_COLOR = "rgba(15, 23, 42, 0.85)";
|
||||
/**
|
||||
* Convert a React icon component into a `data:image/svg+xml` URL for Cesium billboards.
|
||||
* By default wraps the icon in a filled circle for visibility on any terrain.
|
||||
* Pass `{ background: false }` to opt out.
|
||||
*/
|
||||
function createSvgIconUrl(Icon, opts = {}) {
|
||||
const { background = true, backgroundColor = DEFAULT_BG_COLOR, size = exports.DEFAULT_ICON_SIZE } = opts, iconProps = __rest(opts, ["background", "backgroundColor", "size"]);
|
||||
const innerSvg = (0, server_1.renderToStaticMarkup)((0, react_1.createElement)(Icon, Object.assign({ size }, iconProps)));
|
||||
if (!background) {
|
||||
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(innerSvg)}`;
|
||||
}
|
||||
// Wrap the icon in a larger SVG with a filled circle behind it
|
||||
const padding = 6;
|
||||
const totalSize = size + padding * 2;
|
||||
const center = totalSize / 2;
|
||||
const radius = totalSize / 2 - 1;
|
||||
const wrappedSvg = [
|
||||
`<svg xmlns="http://www.w3.org/2000/svg" width="${totalSize}" height="${totalSize}" viewBox="0 0 ${totalSize} ${totalSize}">`,
|
||||
`<circle cx="${center}" cy="${center}" r="${radius}" fill="${backgroundColor}" />`,
|
||||
`<g transform="translate(${padding}, ${padding})">${innerSvg}</g>`,
|
||||
`</svg>`,
|
||||
].join("");
|
||||
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(wrappedSvg)}`;
|
||||
}
|
||||
__exportStar(require("./viteGlobals"), exports);
|
||||
var wwvStaticCompiler_1 = require("./vite/wwvStaticCompiler");
|
||||
Object.defineProperty(exports, "wwvStaticCompiler", { enumerable: true, get: function () { return wwvStaticCompiler_1.wwvStaticCompiler; } });
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
import type { PluginCategory } from "./index";
|
||||
export type PluginFormat = "declarative" | "static" | "bundle";
|
||||
export type PluginType = "data-layer" | "extension";
|
||||
export type TrustTier = "built-in" | "verified" | "unverified";
|
||||
export type PluginCapability = "data:own" | `data:read:${string}` | "ui:detail-panel" | "ui:sidebar" | "ui:toolbar" | "ui:settings" | "globe:overlay" | "globe:camera" | "storage:read" | "storage:write" | "network:fetch";
|
||||
export interface DataSourceConfig {
|
||||
url: string;
|
||||
method: "GET" | "POST";
|
||||
pollInterval: number;
|
||||
format: "geojson" | "json" | "csv";
|
||||
auth?: {
|
||||
type: "header" | "query";
|
||||
key: string;
|
||||
envVar: string;
|
||||
} | null;
|
||||
headers?: Record<string, string>;
|
||||
body?: Record<string, unknown>;
|
||||
arrayPath?: string;
|
||||
/** WebSocket URL for direct engine connection (e.g., wss://my-engine.example.com/stream). */
|
||||
streamUrl?: string;
|
||||
}
|
||||
export interface FieldMapping {
|
||||
id: string;
|
||||
latitude: string;
|
||||
longitude: string;
|
||||
altitude?: string;
|
||||
heading?: string;
|
||||
speed?: string;
|
||||
label?: string;
|
||||
timestamp?: string;
|
||||
properties?: Record<string, string>;
|
||||
}
|
||||
export interface RenderingConfig {
|
||||
entityType: "billboard" | "point" | "polyline" | "polygon" | "label" | "model";
|
||||
color?: string;
|
||||
icon?: string;
|
||||
sizeField?: string;
|
||||
labelField?: string;
|
||||
clusterEnabled?: boolean;
|
||||
clusterDistance?: number;
|
||||
modelUrl?: string;
|
||||
minZoomLevel?: number;
|
||||
maxEntities?: number;
|
||||
}
|
||||
export interface PluginManifest {
|
||||
id: string;
|
||||
name: string;
|
||||
version: string;
|
||||
description?: string;
|
||||
type: PluginType;
|
||||
format: PluginFormat;
|
||||
trust: TrustTier;
|
||||
capabilities: PluginCapability[];
|
||||
category: PluginCategory | string;
|
||||
icon?: string;
|
||||
compatibility?: {
|
||||
worldwideview: string;
|
||||
};
|
||||
requires?: {
|
||||
envVars?: string[];
|
||||
};
|
||||
dataSource?: DataSourceConfig;
|
||||
fieldMapping?: FieldMapping;
|
||||
dataFile?: string;
|
||||
rendering?: RenderingConfig;
|
||||
entry?: string;
|
||||
assets?: string[];
|
||||
extends?: string[];
|
||||
}
|
||||
//# sourceMappingURL=manifest.d.ts.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAC/D,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,WAAW,CAAC;AACpD,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,CAAC;AAE/D,MAAM,MAAM,gBAAgB,GACtB,UAAU,GACV,aAAa,MAAM,EAAE,GACrB,iBAAiB,GACjB,YAAY,GACZ,YAAY,GACZ,aAAa,GACb,eAAe,GACf,cAAc,GACd,cAAc,GACd,eAAe,GACf,eAAe,CAAC;AAEtB,MAAM,WAAW,gBAAgB;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC;IACnC,IAAI,CAAC,EAAE;QAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6FAA6F;IAC7F,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,eAAe;IAC5B,UAAU,EAAE,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,SAAS,CAAC;IACjB,YAAY,EAAE,gBAAgB,EAAE,CAAC;IACjC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,QAAQ,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAClC,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB"}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
// ─── Plugin Manifest Types ───────────────────────────────────
|
||||
// Schema for plugin.json manifest files.
|
||||
// Three formats: declarative (JSON-only), static (GeoJSON), bundle (JS code).
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "@worldwideview/wwv-plugin-sdk",
|
||||
"version": "1.5.0",
|
||||
"description": "Plugin SDK — types, interfaces, and utilities for building WorldWideView globe plugins",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc --project tsconfig.build.json",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"keywords": [
|
||||
"worldwideview",
|
||||
"wwv-plugin-sdk",
|
||||
"globe",
|
||||
"cesium",
|
||||
"plugin-sdk",
|
||||
"geospatial"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/silvertakana/worldwideview.git",
|
||||
"directory": "packages/wwv-plugin-sdk"
|
||||
},
|
||||
"homepage": "https://github.com/silvertakana/worldwideview#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/silvertakana/worldwideview/issues"
|
||||
},
|
||||
"license": "ISC",
|
||||
"author": "WorldWideView",
|
||||
"peerDependencies": {
|
||||
"react": ">=18"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5",
|
||||
"@types/react": "^19"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,273 @@
|
||||
// ─── WorldWideView Plugin SDK ─────────────────────────────────
|
||||
// The public API for building WorldWideView plugins.
|
||||
// Import from "@worldwideview/wwv-plugin-sdk" in your plugin.
|
||||
|
||||
import type { ComponentType } from "react";
|
||||
import { createElement } from "react";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
|
||||
/** Standard SVG icon size (px) used by createSvgIconUrl when no size is given. */
|
||||
export const DEFAULT_ICON_SIZE = 32;
|
||||
|
||||
/** Default dark background color for icon circles. */
|
||||
const DEFAULT_BG_COLOR = "rgba(15, 23, 42, 0.85)";
|
||||
|
||||
export interface IconUrlOptions extends Record<string, unknown> {
|
||||
/** Icon color (stroke). */
|
||||
color?: string;
|
||||
/** SVG icon size in px (default: DEFAULT_ICON_SIZE). */
|
||||
size?: number;
|
||||
/** Show circle background behind icon (default: true). */
|
||||
background?: boolean;
|
||||
/** Background fill color (default: semi-transparent dark slate). */
|
||||
backgroundColor?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a React icon component into a `data:image/svg+xml` URL for Cesium billboards.
|
||||
* By default wraps the icon in a filled circle for visibility on any terrain.
|
||||
* Pass `{ background: false }` to opt out.
|
||||
*/
|
||||
export function createSvgIconUrl(
|
||||
Icon: ComponentType<any>,
|
||||
opts: IconUrlOptions = {},
|
||||
): string {
|
||||
const {
|
||||
background = true,
|
||||
backgroundColor = DEFAULT_BG_COLOR,
|
||||
size = DEFAULT_ICON_SIZE,
|
||||
...iconProps
|
||||
} = opts;
|
||||
|
||||
const innerSvg = renderToStaticMarkup(createElement(Icon, { size, ...iconProps }));
|
||||
|
||||
if (!background) {
|
||||
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(innerSvg)}`;
|
||||
}
|
||||
|
||||
// Wrap the icon in a larger SVG with a filled circle behind it
|
||||
const padding = 6;
|
||||
const totalSize = size + padding * 2;
|
||||
const center = totalSize / 2;
|
||||
const radius = totalSize / 2 - 1;
|
||||
|
||||
const wrappedSvg = [
|
||||
`<svg xmlns="http://www.w3.org/2000/svg" width="${totalSize}" height="${totalSize}" viewBox="0 0 ${totalSize} ${totalSize}">`,
|
||||
`<circle cx="${center}" cy="${center}" r="${radius}" fill="${backgroundColor}" />`,
|
||||
`<g transform="translate(${padding}, ${padding})">${innerSvg}</g>`,
|
||||
`</svg>`,
|
||||
].join("");
|
||||
|
||||
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(wrappedSvg)}`;
|
||||
}
|
||||
|
||||
// ─── Re-export manifest types ─────────────────────────────────
|
||||
export type { PluginManifest, PluginFormat, PluginType, TrustTier, PluginCapability, DataSourceConfig, FieldMapping, RenderingConfig } from "./manifest";
|
||||
|
||||
// ─── Categories ──────────────────────────────────────────────
|
||||
export type PluginCategory =
|
||||
| "aviation"
|
||||
| "maritime"
|
||||
| "military"
|
||||
| "conflict"
|
||||
| "natural-disaster"
|
||||
| "infrastructure"
|
||||
| "space"
|
||||
| "cyber"
|
||||
| "economic"
|
||||
| "intelligence"
|
||||
| "custom";
|
||||
|
||||
// ─── Time ────────────────────────────────────────────────────
|
||||
export interface TimeRange {
|
||||
start: Date;
|
||||
end: Date;
|
||||
}
|
||||
|
||||
export type TimeWindow = "1h" | "6h" | "24h" | "48h" | "7d";
|
||||
|
||||
// ─── Geo Entities ────────────────────────────────────────────
|
||||
export interface GeoEntity {
|
||||
id: string;
|
||||
pluginId: string;
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
altitude?: number;
|
||||
heading?: number;
|
||||
speed?: number;
|
||||
timestamp: Date;
|
||||
label?: string;
|
||||
properties: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface WsStreamPayload {
|
||||
type: "data" | "error";
|
||||
pluginId?: string;
|
||||
payload?: GeoEntity[];
|
||||
error?: string;
|
||||
}
|
||||
|
||||
// ─── Layer Config ────────────────────────────────────────────
|
||||
export interface LayerConfig {
|
||||
color: string;
|
||||
iconUrl?: string;
|
||||
clusterEnabled: boolean;
|
||||
clusterDistance: number;
|
||||
minZoomLevel?: number;
|
||||
maxEntities?: number;
|
||||
/** If true, the core primitive renderer and StackManager will ignore this plugin's entities. Use when getGlobeComponent completely manages rendering. */
|
||||
disableDefaultRendering?: boolean;
|
||||
}
|
||||
|
||||
// ─── Cesium Entity Options ───────────────────────────────────
|
||||
export interface CesiumEntityOptions {
|
||||
type: "billboard" | "point" | "polyline" | "polygon" | "label" | "model";
|
||||
color?: string;
|
||||
size?: number;
|
||||
iconUrl?: string;
|
||||
rotation?: number;
|
||||
outlineColor?: string;
|
||||
outlineWidth?: number;
|
||||
labelText?: string;
|
||||
labelFont?: string;
|
||||
distanceDisplayCondition?: { near: number; far: number };
|
||||
disableDepthTestDistance?: number;
|
||||
/** Billboard scale override (default: 0.6). Plugin devs can set this to control icon size. */
|
||||
iconScale?: number;
|
||||
/** GPU Depth Test bias (meters). Negative values pull billboard towards camera (default: -1000 for visibility). */
|
||||
depthBias?: number;
|
||||
modelUrl?: string;
|
||||
modelScale?: number;
|
||||
modelMinPixelSize?: number;
|
||||
modelHeadingOffset?: number;
|
||||
trailOptions?: {
|
||||
width?: number;
|
||||
color?: string;
|
||||
dashPattern?: "solid" | "dashed";
|
||||
opacityFade?: boolean;
|
||||
};
|
||||
/** Skip mathematical horizon culling (useful for high-altitude objects like satellites) */
|
||||
disableManualHorizonCulling?: boolean;
|
||||
/** Skip combining this entity into clusters/stacks when zoomed out */
|
||||
disableClustering?: boolean;
|
||||
}
|
||||
|
||||
// ─── Selection Behavior ──────────────────────────────────────
|
||||
export interface SelectionBehavior {
|
||||
showTrail?: boolean;
|
||||
trailDurationSec?: number;
|
||||
trailStepSec?: number;
|
||||
trailColor?: string;
|
||||
flyToOffsetMultiplier?: number;
|
||||
flyToBaseDistance?: number;
|
||||
}
|
||||
|
||||
// ─── Server Plugin Config ────────────────────────────────────
|
||||
export interface ServerPluginConfig {
|
||||
apiBasePath: string;
|
||||
pollingIntervalMs: number;
|
||||
requiresAuth?: boolean;
|
||||
historyEnabled?: boolean;
|
||||
availabilityEnabled?: boolean;
|
||||
/** WebSocket URL for direct engine connection. Overrides the global default engine URL. */
|
||||
streamUrl?: string;
|
||||
}
|
||||
|
||||
// ─── Plugin Context ──────────────────────────────────────────
|
||||
// Provided by the host app when initializing each plugin.
|
||||
// All plugins (built-in and 3rd party) receive the same context.
|
||||
export interface PluginContext {
|
||||
apiBaseUrl: string;
|
||||
/**
|
||||
* Key-value map of generic environment variables.
|
||||
* The engine surfaces any variable starting with NEXT_PUBLIC_WWV_PLUGIN_
|
||||
*
|
||||
* WARNING: These are exposed to the client-side browser bundle.
|
||||
* DO NOT USE THIS FOR API KEYS. For sensitive tokens, use getSecret() if provided.
|
||||
*/
|
||||
env: Record<string, string>;
|
||||
/** The running edition of the WWV engine */
|
||||
edition: "local" | "cloud" | "demo";
|
||||
timeRange: TimeRange;
|
||||
onDataUpdate: (entities: GeoEntity[]) => void;
|
||||
onError: (error: Error) => void;
|
||||
/** Get plugin-specific settings from the app config store */
|
||||
getPluginSettings: <T = unknown>(pluginId: string) => T | undefined;
|
||||
/** Returns true if the app is in timeline playback mode */
|
||||
isPlaybackMode: () => boolean;
|
||||
/** Returns the current timeline time (relevant in playback mode) */
|
||||
getCurrentTime: () => Date;
|
||||
}
|
||||
|
||||
// ─── Filter Definitions ──────────────────────────────────────
|
||||
export interface FilterSelectOption { value: string; label: string; }
|
||||
export interface FilterRangeConfig { min: number; max: number; step: number; }
|
||||
export interface FilterDefinition {
|
||||
id: string;
|
||||
label: string;
|
||||
type: "text" | "select" | "range" | "boolean";
|
||||
propertyKey: string;
|
||||
options?: FilterSelectOption[];
|
||||
range?: FilterRangeConfig;
|
||||
}
|
||||
|
||||
export type FilterValue =
|
||||
| { type: "text"; value: string }
|
||||
| { type: "select"; values: string[] }
|
||||
| { type: "range"; min: number; max: number }
|
||||
| { type: "boolean"; value: boolean };
|
||||
|
||||
// ─── World Plugin Interface ──────────────────────────────────
|
||||
export interface WorldPlugin {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
icon: string | ComponentType<{ size?: number; color?: string }>;
|
||||
category: PluginCategory;
|
||||
version: string;
|
||||
|
||||
// Lifecycle
|
||||
initialize(ctx: PluginContext): Promise<void>;
|
||||
destroy(): void;
|
||||
|
||||
// Data
|
||||
fetch(timeRange: TimeRange): Promise<GeoEntity[]>;
|
||||
getPollingInterval(): number;
|
||||
|
||||
// Rendering
|
||||
getLayerConfig(): LayerConfig;
|
||||
renderEntity(entity: GeoEntity): CesiumEntityOptions;
|
||||
|
||||
// Optional
|
||||
getSelectionBehavior?(entity: GeoEntity): SelectionBehavior | null;
|
||||
getServerConfig?(): ServerPluginConfig;
|
||||
getFilterDefinitions?(): FilterDefinition[];
|
||||
getLegend?(): { label: string; color: string; filterId?: string; filterValue?: string }[];
|
||||
getSidebarComponent?(): ComponentType<{ plugin?: any } | any>;
|
||||
getDetailComponent?(): ComponentType<{ entity: GeoEntity }>;
|
||||
getSettingsComponent?(): ComponentType<{ pluginId: string }>;
|
||||
/** Custom React component injected into the Globe view for rendering primitives/data sources (e.g. GeoJSON). */
|
||||
getGlobeComponent?(): ComponentType<{ viewer: any; enabled: boolean }>;
|
||||
requiresConfiguration?(settings: unknown): boolean;
|
||||
/** Map raw websocket payload into GeoEntity array. Optional existingEntities is provided so plugins can merge state (e.g. historical trails). */
|
||||
mapWebsocketPayload?(payload: any, existingEntities?: GeoEntity[]): GeoEntity[];
|
||||
}
|
||||
|
||||
// ─── Aliases for backwards compatibility ─────────────────────
|
||||
export type GlobePlugin = WorldPlugin;
|
||||
|
||||
// ─── Data Bus Event Types ────────────────────────────────────
|
||||
export type DataBusEvents = {
|
||||
pluginRegistered: { pluginId: string; defaultInterval: number };
|
||||
dataUpdated: { pluginId: string; entities: GeoEntity[] };
|
||||
entitySelected: { entity: GeoEntity | null };
|
||||
layerToggled: { pluginId: string; enabled: boolean };
|
||||
timeRangeChanged: { timeRange: TimeRange };
|
||||
cameraPreset: { presetId: string };
|
||||
cameraFaceTowards: { lat: number; lon: number; alt: number };
|
||||
cameraGoTo: { lat: number; lon: number; alt: number; distance?: number; maxPitch?: number; heading?: number };
|
||||
globeReady: Record<string, never>;
|
||||
};
|
||||
|
||||
export * from "./viteGlobals";
|
||||
export { wwvStaticCompiler } from "./vite/wwvStaticCompiler";
|
||||
@@ -0,0 +1,82 @@
|
||||
// ─── Plugin Manifest Types ───────────────────────────────────
|
||||
// Schema for plugin.json manifest files.
|
||||
// Three formats: declarative (JSON-only), static (GeoJSON), bundle (JS code).
|
||||
|
||||
import type { PluginCategory } from "./index";
|
||||
|
||||
export type PluginFormat = "declarative" | "static" | "bundle";
|
||||
export type PluginType = "data-layer" | "extension";
|
||||
export type TrustTier = "built-in" | "verified" | "unverified";
|
||||
|
||||
export type PluginCapability =
|
||||
| "data:own"
|
||||
| `data:read:${string}`
|
||||
| "ui:detail-panel"
|
||||
| "ui:sidebar"
|
||||
| "ui:toolbar"
|
||||
| "ui:settings"
|
||||
| "globe:overlay"
|
||||
| "globe:camera"
|
||||
| "storage:read"
|
||||
| "storage:write"
|
||||
| "network:fetch";
|
||||
|
||||
export interface DataSourceConfig {
|
||||
url: string;
|
||||
method: "GET" | "POST";
|
||||
pollInterval: number;
|
||||
format: "geojson" | "json" | "csv";
|
||||
auth?: { type: "header" | "query"; key: string; envVar: string } | null;
|
||||
headers?: Record<string, string>;
|
||||
body?: Record<string, unknown>;
|
||||
arrayPath?: string;
|
||||
/** WebSocket URL for direct engine connection (e.g., wss://my-engine.example.com/stream). */
|
||||
streamUrl?: string;
|
||||
}
|
||||
|
||||
export interface FieldMapping {
|
||||
id: string;
|
||||
latitude: string;
|
||||
longitude: string;
|
||||
altitude?: string;
|
||||
heading?: string;
|
||||
speed?: string;
|
||||
label?: string;
|
||||
timestamp?: string;
|
||||
properties?: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface RenderingConfig {
|
||||
entityType: "billboard" | "point" | "polyline" | "polygon" | "label" | "model";
|
||||
color?: string;
|
||||
icon?: string;
|
||||
sizeField?: string;
|
||||
labelField?: string;
|
||||
clusterEnabled?: boolean;
|
||||
clusterDistance?: number;
|
||||
modelUrl?: string;
|
||||
minZoomLevel?: number;
|
||||
maxEntities?: number;
|
||||
}
|
||||
|
||||
export interface PluginManifest {
|
||||
id: string;
|
||||
name: string;
|
||||
version: string;
|
||||
description?: string;
|
||||
type: PluginType;
|
||||
format: PluginFormat;
|
||||
trust: TrustTier;
|
||||
capabilities: PluginCapability[];
|
||||
category: PluginCategory | string;
|
||||
icon?: string;
|
||||
compatibility?: { worldwideview: string };
|
||||
requires?: { envVars?: string[] };
|
||||
dataSource?: DataSourceConfig;
|
||||
fieldMapping?: FieldMapping;
|
||||
dataFile?: string;
|
||||
rendering?: RenderingConfig;
|
||||
entry?: string;
|
||||
assets?: string[];
|
||||
extends?: string[];
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Vite plugin that auto-generates a WorldPlugin class for static plugins.
|
||||
*
|
||||
* If the plugin's package.json has `worldwideview.format: "static"` and
|
||||
* no `src/index.ts` exists, this plugin injects a virtual module that:
|
||||
* - Fetches GeoJSON data from the CDN at runtime
|
||||
* - Converts features into GeoEntity objects
|
||||
* - Renders with the manifest's rendering config
|
||||
*/
|
||||
export function wwvStaticCompiler(): any {
|
||||
let pluginRoot = "";
|
||||
let manifest: any = null;
|
||||
let generatedEntry = "";
|
||||
|
||||
return {
|
||||
name: "wwv-static-compiler",
|
||||
enforce: "pre" as const,
|
||||
|
||||
config(userConfig: any) {
|
||||
pluginRoot = userConfig.root || process.cwd();
|
||||
const pkgPath = path.join(pluginRoot, "package.json");
|
||||
if (!fs.existsSync(pkgPath)) return;
|
||||
|
||||
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
||||
manifest = pkg.worldwideview || null;
|
||||
if (!manifest) return;
|
||||
|
||||
manifest._packageName = pkg.name;
|
||||
manifest._packageVersion = pkg.version;
|
||||
manifest._description = pkg.description || "";
|
||||
|
||||
const srcIndex = path.join(pluginRoot, "src", "index.ts");
|
||||
if (fs.existsSync(srcIndex)) return; // real source exists
|
||||
|
||||
// Write a generated entry file
|
||||
const srcDir = path.join(pluginRoot, "src");
|
||||
if (!fs.existsSync(srcDir)) fs.mkdirSync(srcDir, { recursive: true });
|
||||
|
||||
generatedEntry = path.join(srcDir, "__generated_entry.js");
|
||||
const source = generateStaticPluginSource(manifest);
|
||||
fs.writeFileSync(generatedEntry, source, "utf-8");
|
||||
|
||||
// Redirect lib entry to the generated file
|
||||
if (userConfig.build?.lib) {
|
||||
userConfig.build.lib.entry = generatedEntry;
|
||||
}
|
||||
},
|
||||
|
||||
buildEnd() {
|
||||
// Clean up the generated file, but ONLY if we are not in watch mode
|
||||
const isWatchMode = process.argv.includes("--watch") || process.argv.includes("-w");
|
||||
if (!isWatchMode && generatedEntry && fs.existsSync(generatedEntry)) {
|
||||
fs.unlinkSync(generatedEntry);
|
||||
generatedEntry = "";
|
||||
}
|
||||
},
|
||||
|
||||
closeBundle() {
|
||||
// Also clean up on close (redundant safety)
|
||||
const isWatchMode = process.argv.includes("--watch") || process.argv.includes("-w");
|
||||
if (!isWatchMode && generatedEntry && fs.existsSync(generatedEntry)) {
|
||||
fs.unlinkSync(generatedEntry);
|
||||
generatedEntry = "";
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function generateStaticPluginSource(manifest: any): string {
|
||||
const pluginId = manifest.id;
|
||||
const pluginName = manifest.name || pluginId;
|
||||
const description = manifest._description || "";
|
||||
const category = manifest.category || "custom";
|
||||
const icon = manifest.icon || "MapPin";
|
||||
const version = manifest._packageVersion || "1.0.0";
|
||||
const packageName = manifest._packageName;
|
||||
|
||||
const color =
|
||||
manifest.rendering?.defaultColor ||
|
||||
manifest.rendering?.color ||
|
||||
"#3b82f6";
|
||||
const entityType = manifest.rendering?.entityType || "point";
|
||||
const clusterEnabled = manifest.rendering?.clusterEnabled ?? true;
|
||||
const clusterDistance = manifest.rendering?.clusterDistance ?? 50;
|
||||
const maxEntities = manifest.rendering?.maxEntities ?? 5000;
|
||||
const labelField = manifest.rendering?.labelField || "name";
|
||||
|
||||
const dataFileName = manifest.dataFile
|
||||
? path.basename(manifest.dataFile)
|
||||
: "data.json";
|
||||
|
||||
const renderBlock =
|
||||
entityType === "billboard"
|
||||
? `
|
||||
const cacheKey = "default";
|
||||
if (!this._iconUrls[cacheKey]) {
|
||||
this._iconUrls[cacheKey] = createSvgIconUrl(${icon}, { color: ${JSON.stringify(color)} });
|
||||
}
|
||||
return { type: "billboard", iconUrl: this._iconUrls[cacheKey], color: ${JSON.stringify(color)}, iconScale: 0.5 };`
|
||||
: `
|
||||
return { type: "point", color: ${JSON.stringify(color)}, size: 6 };`;
|
||||
|
||||
return `
|
||||
import { ${icon} } from "lucide-react";
|
||||
import { createSvgIconUrl } from "@worldwideview/wwv-plugin-sdk";
|
||||
import dataRaw from "../data/${dataFileName}?raw";
|
||||
|
||||
function representativePoint(geom) {
|
||||
if (!geom) return { lat: 0, lon: 0 };
|
||||
switch (geom.type) {
|
||||
case "Point":
|
||||
return { lat: geom.coordinates[1], lon: geom.coordinates[0], alt: geom.coordinates[2] };
|
||||
case "MultiPoint":
|
||||
case "LineString":
|
||||
return { lat: geom.coordinates[0][1], lon: geom.coordinates[0][0] };
|
||||
case "Polygon":
|
||||
case "MultiLineString":
|
||||
return { lat: geom.coordinates[0][0][1], lon: geom.coordinates[0][0][0] };
|
||||
case "MultiPolygon":
|
||||
return { lat: geom.coordinates[0][0][0][1], lon: geom.coordinates[0][0][0][0] };
|
||||
default:
|
||||
return { lat: 0, lon: 0 };
|
||||
}
|
||||
}
|
||||
|
||||
export default class AutoStaticPlugin {
|
||||
id = ${JSON.stringify(pluginId)};
|
||||
name = ${JSON.stringify(pluginName)};
|
||||
description = ${JSON.stringify(description)};
|
||||
icon = ${icon};
|
||||
category = ${JSON.stringify(category)};
|
||||
version = ${JSON.stringify(version)};
|
||||
|
||||
_context = null;
|
||||
_entities = [];
|
||||
_iconUrls = {};
|
||||
|
||||
async initialize(ctx) {
|
||||
this._context = ctx;
|
||||
let data = null;
|
||||
try {
|
||||
data = JSON.parse(dataRaw);
|
||||
} catch(e) {
|
||||
console.error("Failed to parse data for ${pluginId}", e);
|
||||
}
|
||||
if (data && Array.isArray(data.features)) {
|
||||
this._entities = data.features.map((f, i) => {
|
||||
const pt = representativePoint(f.geometry);
|
||||
return {
|
||||
id: "${pluginId}-" + (f.id ?? i),
|
||||
pluginId: ${JSON.stringify(pluginId)},
|
||||
latitude: pt.lat,
|
||||
longitude: pt.lon,
|
||||
altitude: pt.alt,
|
||||
timestamp: new Date(),
|
||||
label: f.properties?.${labelField} ?? f.properties?.name ?? undefined,
|
||||
properties: { ...f.properties, _geometryType: f.geometry?.type },
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
destroy() { this._context = null; this._entities = []; }
|
||||
async fetch(_timeRange) { return this._entities; }
|
||||
getPollingInterval() { return 0; }
|
||||
|
||||
getLayerConfig() {
|
||||
return {
|
||||
color: ${JSON.stringify(color)},
|
||||
clusterEnabled: ${clusterEnabled},
|
||||
clusterDistance: ${clusterDistance},
|
||||
maxEntities: ${maxEntities},
|
||||
};
|
||||
}
|
||||
|
||||
renderEntity(_entity) {${renderBlock}
|
||||
}
|
||||
}
|
||||
`;
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
|
||||
interface GlobalsMap {
|
||||
[moduleId: string]: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A Vite/Rollup plugin that resolves shared dependencies to the
|
||||
* `globalThis.__WWV_HOST__` object injected by the core WWV engine.
|
||||
*
|
||||
* This ensures that dynamically loaded CDN plugins inherit the exact
|
||||
* React, Zustand, and Cesium instances of the host application,
|
||||
* eliminating "Invalid Hook Call" and "useCallback" context mismatches.
|
||||
*/
|
||||
export function wwvPluginGlobals(): any {
|
||||
const HOST_MAPPINGS: GlobalsMap = {
|
||||
"react": "React",
|
||||
"react-dom": "ReactDOM",
|
||||
"react/jsx-runtime": "jsxRuntime",
|
||||
"cesium": "Cesium",
|
||||
"resium": "Resium",
|
||||
// zustand is also part of WWVHostGlobals or maybe not? Wait. I should check hostGlobals.ts!
|
||||
"@worldwideview/wwv-plugin-sdk": "WWVPluginSDK",
|
||||
"@/core/state/store": "useStore",
|
||||
"@/core/plugins/PluginManager": "pluginManager",
|
||||
"@/components/video/CameraStream": "CameraStream"
|
||||
};
|
||||
|
||||
return {
|
||||
name: "wwv-plugin-globals",
|
||||
enforce: "pre",
|
||||
resolveId(id: string) {
|
||||
if (id in HOST_MAPPINGS || id === "zustand") {
|
||||
// Ensure Rollup doesn't try to look for these modules in node_modules
|
||||
return "\0" + id;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
load(id: string) {
|
||||
if (!id.startsWith("\0")) return null;
|
||||
const originalId = id.slice(1);
|
||||
|
||||
if (originalId === "react") {
|
||||
return `
|
||||
const React = globalThis.__WWV_HOST__.React;
|
||||
export default React;
|
||||
export const { useState, useEffect, useRef, useMemo, useCallback, useContext, useReducer, useLayoutEffect, StrictMode, Suspense, createContext, createElement, cloneElement, isValidElement, Fragment, Children, Component, PureComponent, createRef, forwardRef, memo, lazy, startTransition, useTransition, useDeferredValue, useId, useSyncExternalStore, useInsertionEffect } = React;
|
||||
`;
|
||||
}
|
||||
if (originalId === "react-dom") {
|
||||
return `
|
||||
const ReactDOM = globalThis.__WWV_HOST__.ReactDOM;
|
||||
export default ReactDOM;
|
||||
export const { createPortal, flushSync } = ReactDOM;
|
||||
`;
|
||||
}
|
||||
if (originalId === "react/jsx-runtime") {
|
||||
return `
|
||||
const jsxRuntime = globalThis.__WWV_HOST__.jsxRuntime;
|
||||
export const jsx = jsxRuntime.jsx;
|
||||
export const jsxs = jsxRuntime.jsxs;
|
||||
export const Fragment = jsxRuntime.Fragment;
|
||||
`;
|
||||
}
|
||||
if (originalId === "cesium") {
|
||||
return `
|
||||
const Cesium = globalThis.__WWV_HOST__.Cesium;
|
||||
export default Cesium;
|
||||
// Export common bindings for direct destructuring
|
||||
export const { Viewer, Entity, Cartesian3, Cartesian2, Color, CallbackProperty, DistanceDisplayCondition, NearFarScalar, HeightReference, Resource, Rectangle, PolygonHierarchy, ClassificationType, ArcType, Math, JulianDate, TimeInterval, TimeIntervalCollection, SampledPositionProperty, GeoJsonDataSource, PinBuilder, CustomDataSource, ConstantProperty, ColorMaterialProperty, Cartographic } = Cesium;
|
||||
`;
|
||||
}
|
||||
if (originalId === "resium") {
|
||||
return `
|
||||
const Resium = globalThis.__WWV_HOST__.Resium;
|
||||
export default Resium;
|
||||
export const { Entity, PointGraphics, BillboardGraphics, CustomDataSource, Camera, PolygonGraphics, PolylineGraphics, EllipseGraphics, LabelGraphics, ModelGraphics, PathGraphics, BoxGraphics, GeoJsonDataSource, ScreenSpaceEventHandler, ScreenSpaceEvent } = Resium;
|
||||
`;
|
||||
}
|
||||
if (originalId === "@worldwideview/wwv-plugin-sdk") {
|
||||
return `
|
||||
const SDK = globalThis.__WWV_HOST__.WWVPluginSDK;
|
||||
export default SDK;
|
||||
export const { WorldPlugin, PluginManifest, createSvgIconUrl, DEFAULT_ICON_SIZE } = SDK;
|
||||
`;
|
||||
}
|
||||
// If zustand is required, wait, is Zustand in host globals?
|
||||
if (originalId === "zustand") {
|
||||
return `
|
||||
if (!globalThis.__WWV_HOST__.zustand) {
|
||||
console.warn("zustand was not found on WWV_HOST");
|
||||
}
|
||||
const zustand = globalThis.__WWV_HOST__.zustand || {};
|
||||
export default zustand;
|
||||
export const { create, createStore, useStore } = zustand;
|
||||
`;
|
||||
}
|
||||
if (originalId === "@/core/state/store") {
|
||||
return `export const useStore = globalThis.__WWV_HOST__.useStore;`;
|
||||
}
|
||||
if (originalId === "@/core/plugins/PluginManager") {
|
||||
return `export const pluginManager = globalThis.__WWV_HOST__.pluginManager;`;
|
||||
}
|
||||
if (originalId === "@/components/video/CameraStream") {
|
||||
return `export const CameraStream = globalThis.__WWV_HOST__.CameraStream;`;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"outDir": "dist",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node"
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx"]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2017",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"module": "esnext",
|
||||
"moduleResolution": "bundler",
|
||||
"jsx": "react-jsx",
|
||||
"strict": true,
|
||||
"noEmit": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"isolatedModules": true,
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx"]
|
||||
}
|
||||
Generated
+7992
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,3 @@
|
||||
packages:
|
||||
- 'packages/*'
|
||||
- 'packages/*/backend'
|
||||
@@ -0,0 +1,25 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
let dbUrl = process.env.DATABASE_URL;
|
||||
|
||||
if (!dbUrl) {
|
||||
try {
|
||||
const envPath = path.resolve(process.cwd(), ".env");
|
||||
if (fs.existsSync(envPath)) {
|
||||
const envContent = fs.readFileSync(envPath, "utf8");
|
||||
const match = envContent.match(/^DATABASE_URL=(.*)$/m);
|
||||
if (match) {
|
||||
dbUrl = match[1].trim();
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
datasource: {
|
||||
url: dbUrl,
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "aviation_history" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"icao24" TEXT NOT NULL,
|
||||
"callsign" TEXT,
|
||||
"timestamp" DATETIME NOT NULL,
|
||||
"latitude" REAL NOT NULL,
|
||||
"longitude" REAL NOT NULL,
|
||||
"altitude" REAL,
|
||||
"speed" REAL,
|
||||
"heading" REAL
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "installed_plugins" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"pluginId" TEXT NOT NULL,
|
||||
"version" TEXT NOT NULL,
|
||||
"config" TEXT NOT NULL DEFAULT '{}',
|
||||
"installedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "settings" (
|
||||
"key" TEXT NOT NULL PRIMARY KEY,
|
||||
"value" TEXT NOT NULL
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "aviation_history_timestamp_idx" ON "aviation_history"("timestamp");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "aviation_history_timestamp_icao24_key" ON "aviation_history"("timestamp", "icao24");
|
||||
@@ -0,0 +1,12 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "users" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"email" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"hashedPassword" TEXT NOT NULL,
|
||||
"role" TEXT NOT NULL DEFAULT 'user',
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "users_email_key" ON "users"("email");
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the `aviation_history` table. If the table is not empty, all the data it contains will be lost.
|
||||
- Added the required column `updatedAt` to the `installed_plugins` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- DropIndex
|
||||
DROP INDEX "aviation_history_timestamp_icao24_key";
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX "aviation_history_timestamp_idx";
|
||||
|
||||
-- DropTable
|
||||
PRAGMA foreign_keys=off;
|
||||
DROP TABLE "aviation_history";
|
||||
PRAGMA foreign_keys=on;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "favorites" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"entityId" TEXT NOT NULL,
|
||||
"pluginId" TEXT NOT NULL,
|
||||
"label" TEXT NOT NULL,
|
||||
"pluginName" TEXT NOT NULL,
|
||||
"lastSeen" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"userId" TEXT NOT NULL,
|
||||
CONSTRAINT "favorites_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- RedefineTables
|
||||
PRAGMA defer_foreign_keys=ON;
|
||||
PRAGMA foreign_keys=OFF;
|
||||
CREATE TABLE "new_installed_plugins" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"pluginId" TEXT NOT NULL,
|
||||
"version" TEXT NOT NULL,
|
||||
"config" TEXT NOT NULL DEFAULT '{}',
|
||||
"enabled" BOOLEAN NOT NULL DEFAULT true,
|
||||
"installedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL
|
||||
);
|
||||
INSERT INTO "new_installed_plugins" ("config", "id", "installedAt", "pluginId", "version") SELECT "config", "id", "installedAt", "pluginId", "version" FROM "installed_plugins";
|
||||
DROP TABLE "installed_plugins";
|
||||
ALTER TABLE "new_installed_plugins" RENAME TO "installed_plugins";
|
||||
CREATE UNIQUE INDEX "installed_plugins_pluginId_key" ON "installed_plugins"("pluginId");
|
||||
PRAGMA foreign_keys=ON;
|
||||
PRAGMA defer_foreign_keys=OFF;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "favorites_userId_entityId_key" ON "favorites"("userId", "entityId");
|
||||
@@ -0,0 +1,3 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (e.g., Git)
|
||||
provider = "sqlite"
|
||||
@@ -0,0 +1,76 @@
|
||||
// Prisma schema — SQLite for local, PostgreSQL for cloud.
|
||||
// Connection URL configured in prisma.config.ts
|
||||
|
||||
datasource db {
|
||||
provider = "sqlite"
|
||||
}
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client"
|
||||
output = "../src/generated/prisma"
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(uuid())
|
||||
email String @unique
|
||||
name String
|
||||
hashedPassword String
|
||||
role String @default("user")
|
||||
createdAt DateTime @default(now())
|
||||
favorites Favorite[]
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
|
||||
model Favorite {
|
||||
id String @id @default(uuid())
|
||||
entityId String
|
||||
pluginId String
|
||||
label String
|
||||
pluginName String
|
||||
lastSeen DateTime @default(now())
|
||||
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([userId, entityId])
|
||||
@@map("favorites")
|
||||
}
|
||||
|
||||
// DISABLED — aviation history feature is currently turned off.
|
||||
// Uncomment to re-enable.
|
||||
//
|
||||
// model AviationHistory {
|
||||
// id Int @id @default(autoincrement())
|
||||
// icao24 String
|
||||
// callsign String?
|
||||
// timestamp DateTime
|
||||
// latitude Float
|
||||
// longitude Float
|
||||
// altitude Float?
|
||||
// speed Float?
|
||||
// heading Float?
|
||||
//
|
||||
// @@unique([timestamp, icao24])
|
||||
// @@index([timestamp])
|
||||
// @@map("aviation_history")
|
||||
// }
|
||||
|
||||
model InstalledPlugin {
|
||||
id String @id @default(uuid())
|
||||
pluginId String @unique
|
||||
version String
|
||||
config String @default("{}")
|
||||
enabled Boolean @default(true)
|
||||
installedAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@map("installed_plugins")
|
||||
}
|
||||
|
||||
model Setting {
|
||||
key String @id
|
||||
value String
|
||||
|
||||
@@map("settings")
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
google.com, pub-3325496707858400, DIRECT, f08c47fec0942fa0
|
||||
Binary file not shown.
@@ -0,0 +1,11 @@
|
||||
Model Information:
|
||||
* title: Airplane
|
||||
* source: https://sketchfab.com/3d-models/airplane-df0d3bc1c930405a96125679268b96d9
|
||||
* author: sardornosirov203 (https://sketchfab.com/sardornosirov203)
|
||||
|
||||
Model License:
|
||||
* license type: CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)
|
||||
* requirements: Author must be credited. Commercial use is allowed.
|
||||
|
||||
If you use this 3D model in your project be sure to copy paste this credit wherever you share it:
|
||||
This work is based on "Airplane" (https://sketchfab.com/3d-models/airplane-df0d3bc1c930405a96125679268b96d9) by sardornosirov203 (https://sketchfab.com/sardornosirov203) licensed under CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)
|
||||
Binary file not shown.
@@ -0,0 +1,217 @@
|
||||
{
|
||||
"accessors": [
|
||||
{
|
||||
"bufferView": 2,
|
||||
"componentType": 5126,
|
||||
"count": 6605,
|
||||
"max": [
|
||||
1.0392043590545654,
|
||||
8.712139129638672,
|
||||
6.981330871582031
|
||||
],
|
||||
"min": [
|
||||
-3.7596216201782227,
|
||||
-9.34218692779541,
|
||||
-6.981330871582031
|
||||
],
|
||||
"type": "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView": 2,
|
||||
"byteOffset": 79260,
|
||||
"componentType": 5126,
|
||||
"count": 6605,
|
||||
"max": [
|
||||
1.0,
|
||||
1.0,
|
||||
1.0
|
||||
],
|
||||
"min": [
|
||||
-1.0,
|
||||
-1.0,
|
||||
-1.0
|
||||
],
|
||||
"type": "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView": 1,
|
||||
"componentType": 5126,
|
||||
"count": 6605,
|
||||
"max": [
|
||||
1.0826516151428223,
|
||||
1.0
|
||||
],
|
||||
"min": [
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"type": "VEC2"
|
||||
},
|
||||
{
|
||||
"bufferView": 0,
|
||||
"componentType": 5125,
|
||||
"count": 13422,
|
||||
"type": "SCALAR"
|
||||
}
|
||||
],
|
||||
"asset": {
|
||||
"extras": {
|
||||
"author": "sardornosirov203 (https://sketchfab.com/sardornosirov203)",
|
||||
"license": "CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)",
|
||||
"source": "https://sketchfab.com/3d-models/airplane-df0d3bc1c930405a96125679268b96d9",
|
||||
"title": "Airplane"
|
||||
},
|
||||
"generator": "Sketchfab-15.34.0",
|
||||
"version": "2.0"
|
||||
},
|
||||
"bufferViews": [
|
||||
{
|
||||
"buffer": 0,
|
||||
"byteLength": 53688,
|
||||
"name": "floatBufferViews",
|
||||
"target": 34963
|
||||
},
|
||||
{
|
||||
"buffer": 0,
|
||||
"byteLength": 52840,
|
||||
"byteOffset": 53688,
|
||||
"byteStride": 8,
|
||||
"name": "floatBufferViews",
|
||||
"target": 34962
|
||||
},
|
||||
{
|
||||
"buffer": 0,
|
||||
"byteLength": 158520,
|
||||
"byteOffset": 106528,
|
||||
"byteStride": 12,
|
||||
"name": "floatBufferViews",
|
||||
"target": 34962
|
||||
}
|
||||
],
|
||||
"buffers": [
|
||||
{
|
||||
"byteLength": 265048,
|
||||
"uri": "scene.bin"
|
||||
}
|
||||
],
|
||||
"materials": [
|
||||
{
|
||||
"doubleSided": true,
|
||||
"name": "Material.001",
|
||||
"pbrMetallicRoughness": {
|
||||
"metallicFactor": 0.988768,
|
||||
"roughnessFactor": 0.202273
|
||||
}
|
||||
}
|
||||
],
|
||||
"meshes": [
|
||||
{
|
||||
"name": "Object_0",
|
||||
"primitives": [
|
||||
{
|
||||
"attributes": {
|
||||
"NORMAL": 1,
|
||||
"POSITION": 0,
|
||||
"TEXCOORD_0": 2
|
||||
},
|
||||
"indices": 3,
|
||||
"material": 0,
|
||||
"mode": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"nodes": [
|
||||
{
|
||||
"children": [
|
||||
1
|
||||
],
|
||||
"matrix": [
|
||||
1.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
2.220446049250313e-16,
|
||||
-1.0,
|
||||
0.0,
|
||||
0.0,
|
||||
1.0,
|
||||
2.220446049250313e-16,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
1.0
|
||||
],
|
||||
"name": "Sketchfab_model"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
2
|
||||
],
|
||||
"name": "root"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
3
|
||||
],
|
||||
"matrix": [
|
||||
1.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
2.220446049250313e-16,
|
||||
1.0,
|
||||
0.0,
|
||||
0.0,
|
||||
-1.0,
|
||||
2.220446049250313e-16,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
1.0
|
||||
],
|
||||
"name": "GLTF_SceneRootNode"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
4
|
||||
],
|
||||
"matrix": [
|
||||
2.041668293203005e-08,
|
||||
-0.24220889806747353,
|
||||
-0.0,
|
||||
0.0,
|
||||
0.24220889806747353,
|
||||
2.041668293203005e-08,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
-0.0,
|
||||
0.24220889806747437,
|
||||
0.0,
|
||||
-0.029667379334568977,
|
||||
-0.2017381340265274,
|
||||
0.0,
|
||||
1.0
|
||||
],
|
||||
"name": "Cylinder_5"
|
||||
},
|
||||
{
|
||||
"mesh": 0,
|
||||
"name": "Object_4"
|
||||
}
|
||||
],
|
||||
"scene": 0,
|
||||
"scenes": [
|
||||
{
|
||||
"name": "Sketchfab_Scene",
|
||||
"nodes": [
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @license
|
||||
* Cesium - https://github.com/CesiumGS/cesium
|
||||
* Version 1.139.1
|
||||
*
|
||||
* Copyright 2011-2022 Cesium Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Columbus View (Pat. Pend.)
|
||||
*
|
||||
* Portions licensed separately.
|
||||
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
||||
*/
|
||||
|
||||
import{a as C}from"./chunk-ZSYYF6UE.js";import{a as P}from"./chunk-QWRZXNH3.js";import{a as L}from"./chunk-F2ZMVLJV.js";import{a as O}from"./chunk-VGILZD7B.js";import{a as y}from"./chunk-RXYBLNW3.js";import{e as S}from"./chunk-VIMSDF2W.js";var T={};function b(a,e){return y.equalsEpsilon(a.latitude,e.latitude,y.EPSILON10)&&y.equalsEpsilon(a.longitude,e.longitude,y.EPSILON10)}var q=new L,v=new L;function w(a,e,i,h){e=P(e,O.equalsEpsilon);let p=e.length;if(p<2)return;let E=S(h),u=S(i),l=new Array(p),g=new Array(p),r=new Array(p),d=e[0];l[0]=d;let f=a.cartesianToCartographic(d,q);u&&(f.height=i[0]),g[0]=f.height,E?r[0]=h[0]:r[0]=0;let o=g[0],m=r[0],t=o===m,n=1;for(let c=1;c<p;++c){let A=e[c],s=a.cartesianToCartographic(A,v);u&&(s.height=i[c]),t=t&&s.height===0,b(f,s)?f.height<s.height&&(g[n-1]=s.height):(l[n]=A,g[n]=s.height,E?r[n]=h[c]:r[n]=0,t=t&&g[n]===r[n],L.clone(s,f),++n)}if(!(t||n<2))return l.length=n,g.length=n,r.length=n,{positions:l,topHeights:g,bottomHeights:r}}var D=new Array(2),F=new Array(2),B={positions:void 0,height:void 0,granularity:void 0,ellipsoid:void 0};T.computePositions=function(a,e,i,h,p,E){let u=w(a,e,i,h);if(!S(u))return;e=u.positions,i=u.topHeights,h=u.bottomHeights;let l=e.length,g=l-2,r,d,f=y.chordLength(p,a.maximumRadius),o=B;if(o.minDistance=f,o.ellipsoid=a,E){let m=0,t;for(t=0;t<l-1;t++)m+=C.numberOfPoints(e[t],e[t+1],f)+1;r=new Float64Array(m*3),d=new Float64Array(m*3);let n=D,c=F;o.positions=n,o.height=c;let A=0;for(t=0;t<l-1;t++){n[0]=e[t],n[1]=e[t+1],c[0]=i[t],c[1]=i[t+1];let s=C.generateArc(o);r.set(s,A),c[0]=h[t],c[1]=h[t+1],d.set(C.generateArc(o),A),A+=s.length}}else o.positions=e,o.height=i,r=new Float64Array(C.generateArc(o)),o.height=h,d=new Float64Array(C.generateArc(o));return{bottomPositions:d,topPositions:r,numCorners:g}};var j=T;export{j as a};
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @license
|
||||
* Cesium - https://github.com/CesiumGS/cesium
|
||||
* Version 1.139.1
|
||||
*
|
||||
* Copyright 2011-2022 Cesium Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Columbus View (Pat. Pend.)
|
||||
*
|
||||
* Portions licensed separately.
|
||||
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
||||
*/
|
||||
|
||||
import{a as g}from"./chunk-WQ5ZC6ME.js";import{a as d}from"./chunk-XVAXSA53.js";import{j as x}from"./chunk-V6RJRUKY.js";import{a as p,b as M,c as O}from"./chunk-F2ZMVLJV.js";import{b as m}from"./chunk-TXOEXY5C.js";import{e as f}from"./chunk-VIMSDF2W.js";function n(i,h,o,t){this.x=i??0,this.y=h??0,this.width=o??0,this.height=t??0}n.packedLength=4;n.pack=function(i,h,o){return m.typeOf.object("value",i),m.defined("array",h),o=o??0,h[o++]=i.x,h[o++]=i.y,h[o++]=i.width,h[o]=i.height,h};n.unpack=function(i,h,o){return m.defined("array",i),h=h??0,f(o)||(o=new n),o.x=i[h++],o.y=i[h++],o.width=i[h++],o.height=i[h],o};n.fromPoints=function(i,h){if(f(h)||(h=new n),!f(i)||i.length===0)return h.x=0,h.y=0,h.width=0,h.height=0,h;let o=i.length,t=i[0].x,c=i[0].y,e=i[0].x,w=i[0].y;for(let y=1;y<o;y++){let R=i[y],b=R.x,j=R.y;t=Math.min(b,t),e=Math.max(b,e),c=Math.min(j,c),w=Math.max(j,w)}return h.x=t,h.y=c,h.width=e-t,h.height=w-c,h};var L=new g,X=new p,Y=new p;n.fromRectangle=function(i,h,o){if(f(o)||(o=new n),!f(i))return o.x=0,o.y=0,o.width=0,o.height=0,o;L._ellipsoid=O.default,h=h??L;let t=h.project(x.southwest(i,X)),c=h.project(x.northeast(i,Y));return M.subtract(c,t,c),o.x=t.x,o.y=t.y,o.width=c.x,o.height=c.y,o};n.clone=function(i,h){if(f(i))return f(h)?(h.x=i.x,h.y=i.y,h.width=i.width,h.height=i.height,h):new n(i.x,i.y,i.width,i.height)};n.union=function(i,h,o){m.typeOf.object("left",i),m.typeOf.object("right",h),f(o)||(o=new n);let t=Math.min(i.x,h.x),c=Math.min(i.y,h.y),e=Math.max(i.x+i.width,h.x+h.width),w=Math.max(i.y+i.height,h.y+h.height);return o.x=t,o.y=c,o.width=e-t,o.height=w-c,o};n.expand=function(i,h,o){m.typeOf.object("rectangle",i),m.typeOf.object("point",h),o=n.clone(i,o);let t=h.x-o.x,c=h.y-o.y;return t>o.width?o.width=t:t<0&&(o.width-=t,o.x=h.x),c>o.height?o.height=c:c<0&&(o.height-=c,o.y=h.y),o};n.intersect=function(i,h){m.typeOf.object("left",i),m.typeOf.object("right",h);let o=i.x,t=i.y,c=h.x,e=h.y;return o>c+h.width||o+i.width<c||t+i.height<e||t>e+h.height?d.OUTSIDE:d.INTERSECTING};n.equals=function(i,h){return i===h||f(i)&&f(h)&&i.x===h.x&&i.y===h.y&&i.width===h.width&&i.height===h.height};n.prototype.clone=function(i){return n.clone(this,i)};n.prototype.intersect=function(i){return n.intersect(this,i)};n.prototype.equals=function(i){return n.equals(this,i)};var S=n;export{S as a};
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @license
|
||||
* Cesium - https://github.com/CesiumGS/cesium
|
||||
* Version 1.139.1
|
||||
*
|
||||
* Copyright 2011-2022 Cesium Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Columbus View (Pat. Pend.)
|
||||
*
|
||||
* Portions licensed separately.
|
||||
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
||||
*/
|
||||
|
||||
import{a as Ma}from"./chunk-X2JEUMCS.js";import{a as Ub,b as Pa,c as Fa}from"./chunk-AJGKN5FZ.js";import{a as Ea}from"./chunk-BPTWZPZ6.js";import{a as ra}from"./chunk-GVYQ2MV7.js";import{a as rb}from"./chunk-CAEAJPBH.js";import{a as Ha}from"./chunk-HJG35BQ3.js";import{a as ib,b as gb}from"./chunk-5U3HZZCI.js";import{b as db,c as wa}from"./chunk-WQ5ZC6ME.js";import{a as Ka,b as $b,d as hb,e as Fb,f as Mb,g as Na,i as Ta,j as xa}from"./chunk-V6RJRUKY.js";import{b as P}from"./chunk-R6PWD5CA.js";import{a as tb}from"./chunk-BDF6MEVU.js";import{a as za}from"./chunk-OEIACSKL.js";import{a as V,b as K,c as Aa,d as nb}from"./chunk-F2ZMVLJV.js";import{a as u,b as ya,c as fb}from"./chunk-VGILZD7B.js";import{a as $}from"./chunk-RXYBLNW3.js";import{a as Ia,b as J}from"./chunk-TXOEXY5C.js";import{d as Qb,e as Q}from"./chunk-VIMSDF2W.js";var De=(function(){var c="b9H79Tebbbe9ok9Geueu9Geub9Gbb9Gruuuuuuueu9Gvuuuuueu9Gduueu9Gluuuueu9Gvuuuuub9Gouuuuuub9Gluuuub9GiuuueuiE8AdilveoveovrrwrrrDDoDrbqqbelve9Weiiviebeoweuec;G:Qdkr:PlCo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8F9TW79O9V9Wt9FW9U9J9V9KW9wWVtW949c919M9MWV9mW4W2be8A9TW79O9V9Wt9FW9U9J9V9KW9wWVtW949c919M9MWVbd8F9TW79O9V9Wt9FW9U9J9V9KW9wWVtW949c919M9MWV9c9V919U9KbiE9TW79O9V9Wt9FW9U9J9V9KW9wWVtW949wWV79P9V9UblY9TW79O9V9Wt9FW9U9J9V9KW69U9KW949c919M9MWVbv8E9TW79O9V9Wt9FW9U9J9V9KW69U9KW949c919M9MWV9c9V919U9Kbo8A9TW79O9V9Wt9FW9U9J9V9KW69U9KW949wWV79P9V9UbrE9TW79O9V9Wt9FW9U9J9V9KW69U9KW949tWG91W9U9JWbwa9TW79O9V9Wt9FW9U9J9V9KW69U9KW949tWG91W9U9JW9c9V919U9KbDL9TW79O9V9Wt9FW9U9J9V9KWS9P2tWV9p9JtbqK9TW79O9V9Wt9FW9U9J9V9KWS9P2tWV9r919HtbkL9TW79O9V9Wt9FW9U9J9V9KWS9P2tWVT949WbxY9TW79O9V9Wt9FW9U9J9V9KWS9P2tWVJ9V29VVbmE9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94J9H9J9OWbza9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94J9H9J9OW9ttV9P9WbHa9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94SWt9J9O9sW9T9H9WbOK9TW79O9V9Wt9F79W9Ht9P9H29t9VVt9sW9T9H9WbAl79IV9RbXDwebcekdKYq:p28Adbk:Bhdhud9:8Jjjjjbc;qw9Rgr8KjjjjbcbhwdnaeTmbabcbyd;m:kjjbaoaocb9iEgDc:GeV86bbarc;adfcbcjdz:xjjjb8AdnaiTmbarc;adfadalz:wjjjb8Akarc;abfalfcbcbcjdal9RalcFe0Ez:xjjjb8Aarc;abfarc;adfalz:wjjjb8AarcUf9cb83ibarc8Wf9cb83ibarcyf9cb83ibarcaf9cb83ibarcKf9cb83ibarczf9cb83ibar9cb83iwar9cb83ibcj;abal9Uc;WFbGcjdalca0Ehqdnaicd6mbavcd9imbaDTmbadcefhkaqci2gxal2hmarc;alfclfhParc;qlfceVhsarc;qofclVhzarc;qofcKfhHarc;qofczfhOcbhAincdhCcbhodnavci6mbaH9cb83ibaO9cb83ibar9cb83i;yoar9cb83i;qoadaAfgoybbhXcbhQincbhwcbhLdninaoalfhKaoybbgYaX7aLVhLawcP0meaKhoaYhXawcefgwaQfai6mbkkcbhXarc;qofhwincwh8AcwhEdnaLaX93gocFeGg3cs0mbclhEa3ci0mba3cb9hcethEkdnaocw4cFeGg3cs0mbclh8Aa3ci0mba3cb9hceth8Aka8AaEfh3awydbh5cwh8AcwhEdnaocz4cFeGg8Ecs0mbclhEa8Eci0mba8Ecb9hcethEka3a5fh3dnaocFFFFb0mbclh8AaocFFF8F0mbaocFFFr0ceth8Akawa3aEfa8AfBdbawclfhwaXcefgXcw9hmbkaKhoaYhXaQczfgQai6mbkcbhocehwazhLinawaoaLydbarc;qofaocdtfydb6EhoaLclfhLawcefgwcw9hmbkcihCkcbh3arc;qlfcbcjdz:xjjjb8Aarc;alfcwfcbBdbar9cb83i;alaoclth8Fadhaaqhhakh5inarc;qlfadcba3cufgoaoa30Eal2falz:wjjjb8Aaiahaiah6Ehgdnaqaia39Ra3aqfai6EgYcsfc9WGgoaY9nmbarc;qofaYfcbaoaY9Rz:xjjjb8Akada3al2fh8Jcbh8Kina8Ka8FVcl4hQarc;alfa8Kcdtfh8LaAh8Mcbh8Nina8NaAfhwdndndndndndna8KPldebidkasa8Mc98GgLfhoa5aLfh8Aarc;qlfawc98GgLfRbbhXcwhwinaoRbbawtaXVhXaocefhoawcwfgwca9hmbkaYTmla8Ncith8Ea8JaLfhEcbhKinaERbbhLcwhoa8AhwinawRbbaotaLVhLawcefhwaocwfgoca9hmbkarc;qofaKfaLaX7aQ93a8E486bba8Aalfh8AaEalfhEaLhXaKcefgKaY9hmbxlkkaYTmia8Mc9:Ghoa8NcitcwGhEarc;qlfawceVfRbbcwtarc;qlfawc9:GfRbbVhLarc;qofhwaghXinawa5aofRbbcwtaaaofRbbVg8AaL9RgLcetaLcztcz91cs47cFFiGaE486bbaoalfhoawcefhwa8AhLa3aXcufgX9hmbxikkaYTmda8Jawfhoarc;qlfawfRbbhLarc;qofhwaghXinawaoRbbg8AaL9RgLcetaLcKtcK91cr4786bbawcefhwaoalfhoa8AhLa3aXcufgX9hmbxdkkaYTmeka8LydbhEcbhKarc;qofhoincdhLcbhwinaLaoawfRbbcb9hfhLawcefgwcz9hmbkclhXcbhwinaXaoawfRbbcd0fhXawcefgwcz9hmbkcwh8Acbhwina8AaoawfRbbcP0fh8Aawcefgwcz9hmbkaLaXaLaX6Egwa8Aawa8A6Egwczawcz6EaEfhEaoczfhoaKczfgKaY6mbka8LaEBdbka8Mcefh8Ma8Ncefg8Ncl9hmbka8Kcefg8KaC9hmbkaaamfhaahaxfhha5amfh5a3axfg3ai6mbkcbhocehwaPhLinawaoaLydbarc;alfaocdtfydb6EhoaLclfhLawcefgXhwaCaX9hmbkaraAcd4fa8FcdVaoaocdSE86bbaAclfgAal6mbkkabaefh8Kabcefhoalcd4gecbaDEhkadcefhOarc;abfceVhHcbhmdndninaiam9nmearc;qofcbcjdz:xjjjb8Aa8Kao9Rak6mdadamal2gwfhxcbh8JaOawfhzaocbakz:xjjjbghakfh5aqaiam9Ramaqfai6Egscsfgocl4cifcd4hCaoc9WGg8LThPindndndndndndndndndndnaDTmbara8Jcd4fRbbgLciGPlbedlbkasTmdaxa8Jfhoarc;abfa8JfRbbhLarc;qofhwashXinawaoRbbg8AaL9RgLcetaLcKtcK91cr4786bbawcefhwaoalfhoa8AhLaXcufgXmbxikkasTmia8JcitcwGhEarc;abfa8JceVfRbbcwtarc;abfa8Jc9:GgofRbbVhLaxaofhoarc;qofhwashXinawao8Vbbg8AaL9RgLcetaLcztcz91cs47cFFiGaE486bbawcefhwaoalfhoa8AhLaXcufgXmbxdkkaHa8Jc98GgEfhoazaEfh8Aarc;abfaEfRbbhXcwhwinaoRbbawtaXVhXaocefhoawcwfgwca9hmbkasTmbaLcl4hYa8JcitcKGh3axaEfhEcbhKinaERbbhLcwhoa8AhwinawRbbaotaLVhLawcefhwaocwfgoca9hmbkarc;qofaKfaLaX7aY93a3486bba8Aalfh8AaEalfhEaLhXaKcefgKas9hmbkkaDmbcbhoxlka8LTmbcbhodninarc;qofaofgwcwf8Pibaw8Pib:e9qTmeaoczfgoa8L9pmdxbkkdnavmbcehoxikcbhEaChKaChYinarc;qofaEfgocwf8Pibhyao8Pibh8PcdhLcbhwinaLaoawfRbbcb9hfhLawcefgwcz9hmbkclhXcbhwinaXaoawfRbbcd0fhXawcefgwcz9hmbkcwh8Acbhwina8AaoawfRbbcP0fh8Aawcefgwcz9hmbkaLaXaLaX6Egoa8Line truncated
|
||||
importScripts("${ob(CESIUM_WORKERS)}");
|
||||
CesiumWorkers["${g}"]();
|
||||
`;return b=ob(p),new Worker(b,s)}if(b=c,e||(b=Na(`${_._workerModulePrefix+g}.js`)),!nb.supportsEsmWebWorkers())throw new za("This browser is not supported. Please update your browser to continue.");return s.type="module",new Worker(b,s)}async function bc(c,o){let e={modulePath:void 0,wasmBinaryFile:void 0,wasmBinary:void 0};if(!nb.supportsWebAssembly()){if(!Q(o.fallbackModulePath))throw new za(`This browser does not support Web Assembly, and no backup module was provided for ${c._workerPath}`);return e.modulePath=Na(o.fallbackModulePath),e}e.wasmBinaryFile=Na(o.wasmBinaryFile);let g=await Mb.fetchArrayBuffer({url:e.wasmBinaryFile});return e.wasmBinary=g,e}function _(c,o){this._workerPath=c,this._maximumActiveTasks=o??Number.POSITIVE_INFINITY,this._activeTasks=0,this._nextID=0,this._webAssemblyPromise=void 0}var cc=(c,o,e,g)=>{let s=({data:b})=>{if(b.id===o){if(Q(b.error)){let r=b.error;r.name==="RuntimeError"?(r=new za(b.error.message),r.stack=b.error.stack):r.name==="DeveloperError"?(r=new Ia(b.error.message),r.stack=b.error.stack):r.name==="Error"&&(r=new Error(b.error.message),r.stack=b.error.stack),lb.raiseEvent(r),g(r)}else lb.raiseEvent(),e(b.result);c.removeEventListener("message",s)}};return s},ec=[];async function dc(c,o,e){let g=await Promise.resolve(zb());Q(e)?g||(e.length=0):e=ec;let s=c._nextID++,b=new Promise((r,p)=>{c._worker.addEventListener("message",cc(c._worker,s,r,p))});return c._worker.postMessage({id:s,baseUrl:Na.getCesiumBaseUrl().url,parameters:o,canTransferArrayBuffer:g},e),b}async function fc(c,o,e){++c._activeTasks;try{let g=await dc(c,o,e);return--c._activeTasks,g}catch(g){throw--c._activeTasks,g}}_.prototype.scheduleTask=function(c,o){if(Q(this._worker)||(this._worker=mb(this._workerPath)),!(this._activeTasks>=this._maximumActiveTasks))return fc(this,c,o)};_.prototype.initWebAssemblyModule=async function(c){if(Q(this._webAssemblyPromise))return this._webAssemblyPromise;let o=async()=>{let e=this._worker=mb(this._workerPath),g=await bc(this,c),s=await Promise.resolve(zb()),b,r=g.wasmBinary;Q(r)&&s&&(b=[r]);let p=new Promise((E,F)=>{e.onmessage=function({data:y}){Q(y)?E(y.result):F(new za("Could not configure wasm module"))}});return e.postMessage({canTransferArrayBuffer:s,parameters:{webAssemblyConfig:g}},b),p};return this._webAssemblyPromise=o(),this._webAssemblyPromise};_.prototype.isDestroyed=function(){return!1};_.prototype.destroy=function(){return Q(this._worker)&&this._worker.terminate(),Bb(this)};_.taskCompletedEvent=lb;_._defaultWorkerModulePrefix="Workers/";_._workerModulePrefix=_._defaultWorkerModulePrefix;_._canTransferArrayBuffer=void 0;var Kb=_;var hc=3;function kb(c,o,e){J.defined("vertices",c),J.defined("indices",o),J.defined("encoding",e),this._vertices=c,this._indices=o,this._encoding=e,this._inverseTransform=new P,this._needsRebuild=!0,this._rootNode=new jb}var nc=new Kb("incrementallyBuildTerrainPicker");Object.defineProperties(kb.prototype,{needsRebuild:{get:function(){return this._needsRebuild},set:function(c){this._needsRebuild=c}}});function jb(){this.x=0,this.y=0,this.level=0,this.aabb=Tb(this.x,this.y,this.level),this.intersectingTriangles=new Uint32Array(0),this.children=[],this.buildingChildren=!1}jb.prototype.addChild=function(c){if(c<0||c>3)throw new Ia("TerrainPickerNode child index must be between 0 and 3, inclusive.");let o=new jb;o.x=this.x*2+(c&1),o.y=this.y*2+(c>>1&1),o.level=this.level+1,o.aabb=Tb(o.x,o.y,o.level),this.children[c]=o};var tc=new ib,Za=[new u,new u,new u];kb.prototype.rayIntersect=function(c,o,e,g,s){this._needsRebuild&&rc(this,o);let b=this._inverseTransform,r=tc;r.origin=P.multiplyByPoint(b,c.origin,r.origin),r.direction=P.multiplyByPointAsVector(b,c.direction,r.direction);let p=[];return Hb(this._rootNode,r,p),mc(this,p,c,e,g,s)};function rc(c,o){P.inverse(o,c._inverseTransform),c._needsRebuild=!1;let e=c._indices.length/3,g=new Uint32Array(e);for(let s=0;s<e;++s)g[s]=s;c._rootNode.intersectingTriangles=g,c._rootNode.children.length=0}var ic=new u,gc=new u;function Tb(c,o,e){let g=1/Math.pow(2,e),s=u.fromElements(c*g-.5,o*g-.5,-.5,ic),b=u.fromElements((c+1)*g-.5,(o+1)*g-.5,.5,gc);return Ha.fromCorners(s,b)}function oc(c,o,e,g,s){u.pack(e[0],c,9*s),u.pack(e[1],c,9*s+3),u.pack(e[2],c,9*s+6),o[s]=g}var lc=new db;function Hb(c,o,e){let g=gb.rayAxisAlignedBoundingBox(o,c.aabb,lc);if(!Q(g))return;if(!c.children.length||c.buildingChildren){e.push({node:c,interval:new db(g.start,g.stop)});return}for(let b=0;b<c.children.length;b++)Hb(c.children[b],o,e)}function mc(c,o,e,g,s,b){let r=o.sort(function(E,F){return E.interval.start-F.interval.start}),p=Number.MAX_VALUE;for(let E=0;E<r.length;E++){let F=r[E],y=sc(c,e,F.node,g,s,b);if(p=Math.min(y,p),p!==Number.MAX_VALUE)break}if(p!==Number.MAX_VALUE)return ib.getPoint(e,p)}function sc(c,o,e,g,s,b){let r=Number.MAX_VALUE,p=c._encoding,E=c._indices,F=c._vertices,y=e.intersectingTriangles.length,O=!(e.level>=hc)&&!e.buildingChildren,k,j;O&&(k=new Float64Array(y*9),j=new Uint32Array(y));f
Line truncated
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @license
|
||||
* Cesium - https://github.com/CesiumGS/cesium
|
||||
* Version 1.139.1
|
||||
*
|
||||
* Copyright 2011-2022 Cesium Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Columbus View (Pat. Pend.)
|
||||
*
|
||||
* Portions licensed separately.
|
||||
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
||||
*/
|
||||
|
||||
import{c as O}from"./chunk-VGILZD7B.js";import{a as f}from"./chunk-TXOEXY5C.js";import{e as t}from"./chunk-VIMSDF2W.js";function n(e){e=e??O.EMPTY_OBJECT,this.position=e.position??!1,this.normal=e.normal??!1,this.st=e.st??!1,this.bitangent=e.bitangent??!1,this.tangent=e.tangent??!1,this.color=e.color??!1}n.POSITION_ONLY=Object.freeze(new n({position:!0}));n.POSITION_AND_NORMAL=Object.freeze(new n({position:!0,normal:!0}));n.POSITION_NORMAL_AND_ST=Object.freeze(new n({position:!0,normal:!0,st:!0}));n.POSITION_AND_ST=Object.freeze(new n({position:!0,st:!0}));n.POSITION_AND_COLOR=Object.freeze(new n({position:!0,color:!0}));n.ALL=Object.freeze(new n({position:!0,normal:!0,st:!0,tangent:!0,bitangent:!0}));n.DEFAULT=n.POSITION_NORMAL_AND_ST;n.packedLength=6;n.pack=function(e,o,i){if(!t(e))throw new f("value is required");if(!t(o))throw new f("array is required");return i=i??0,o[i++]=e.position?1:0,o[i++]=e.normal?1:0,o[i++]=e.st?1:0,o[i++]=e.tangent?1:0,o[i++]=e.bitangent?1:0,o[i]=e.color?1:0,o};n.unpack=function(e,o,i){if(!t(e))throw new f("array is required");return o=o??0,t(i)||(i=new n),i.position=e[o++]===1,i.normal=e[o++]===1,i.st=e[o++]===1,i.tangent=e[o++]===1,i.bitangent=e[o++]===1,i.color=e[o]===1,i};n.clone=function(e,o){if(t(e))return t(o)||(o=new n),o.position=e.position,o.normal=e.normal,o.st=e.st,o.tangent=e.tangent,o.bitangent=e.bitangent,o.color=e.color,o};var _=n;export{_ as a};
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @license
|
||||
* Cesium - https://github.com/CesiumGS/cesium
|
||||
* Version 1.139.1
|
||||
*
|
||||
* Copyright 2011-2022 Cesium Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Columbus View (Pat. Pend.)
|
||||
*
|
||||
* Portions licensed separately.
|
||||
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
||||
*/
|
||||
|
||||
import{b as U}from"./chunk-WQ5ZC6ME.js";import{a as ft}from"./chunk-F2ZMVLJV.js";import{a as i,b}from"./chunk-VGILZD7B.js";import{a as y}from"./chunk-RXYBLNW3.js";import{a as w,b as tt}from"./chunk-TXOEXY5C.js";import{e as g}from"./chunk-VIMSDF2W.js";var nt={};nt.computeDiscriminant=function(t,n,r){if(typeof t!="number")throw new w("a is a required number.");if(typeof n!="number")throw new w("b is a required number.");if(typeof r!="number")throw new w("c is a required number.");return n*n-4*t*r};function mt(t,n,r){let e=t+n;return y.sign(t)!==y.sign(n)&&Math.abs(e/Math.max(Math.abs(t),Math.abs(n)))<r?0:e}nt.computeRealRoots=function(t,n,r){if(typeof t!="number")throw new w("a is a required number.");if(typeof n!="number")throw new w("b is a required number.");if(typeof r!="number")throw new w("c is a required number.");let e;if(t===0)return n===0?[]:[-r/n];if(n===0){if(r===0)return[0,0];let u=Math.abs(r),f=Math.abs(t);if(u<f&&u/f<y.EPSILON14)return[0,0];if(u>f&&f/u<y.EPSILON14)return[];if(e=-r/t,e<0)return[];let h=Math.sqrt(e);return[-h,h]}else if(r===0)return e=-n/t,e<0?[e,0]:[0,e];let o=n*n,s=4*t*r,c=mt(o,-s,y.EPSILON14);if(c<0)return[];let a=-.5*mt(n,y.sign(n)*Math.sqrt(c),y.EPSILON14);return n>0?[a/t,r/a]:[r/a,a/t]};var z=nt;var rt={};rt.computeDiscriminant=function(t,n,r,e){if(typeof t!="number")throw new w("a is a required number.");if(typeof n!="number")throw new w("b is a required number.");if(typeof r!="number")throw new w("c is a required number.");if(typeof e!="number")throw new w("d is a required number.");let o=t*t,s=n*n,c=r*r,a=e*e;return 18*t*n*r*e+s*c-27*o*a-4*(t*c*r+s*n*e)};function et(t,n,r,e){let o=t,s=n/3,c=r/3,a=e,u=o*c,f=s*a,h=s*s,d=c*c,p=o*c-h,q=o*a-s*c,m=s*a-d,l=4*p*m-q*q,E,x;if(l<0){let J,k,G;h*f>=u*d?(J=o,k=p,G=-2*s*p+o*q):(J=a,k=m,G=-a*q+2*c*m);let ut=-(G<0?-1:1)*Math.abs(J)*Math.sqrt(-l);x=-G+ut;let K=x/2,Y=K<0?-Math.pow(-K,1/3):Math.pow(K,1/3),$=x===ut?-Y:-k/Y;return E=k<=0?Y+$:-G/(Y*Y+$*$+k),h*f>=u*d?[(E-s)/o]:[-a/(E+c)]}let v=p,W=-2*s*p+o*q,L=m,B=-a*q+2*c*m,I=Math.sqrt(l),C=Math.sqrt(3)/2,P=Math.abs(Math.atan2(o*I,-W)/3);E=2*Math.sqrt(-v);let R=Math.cos(P);x=E*R;let S=E*(-R/2-C*Math.sin(P)),M=x+S>2*s?x-s:S-s,N=o,D=M/N;P=Math.abs(Math.atan2(a*I,-B)/3),E=2*Math.sqrt(-L),R=Math.cos(P),x=E*R,S=E*(-R/2-C*Math.sin(P));let _=-a,Z=x+S<2*c?x+c:S+c,A=_/Z,Rt=N*Z,at=-M*Z-N*_,bt=M*_,V=(c*at-s*bt)/(-s*at+c*Rt);return D<=V?D<=A?V<=A?[D,V,A]:[D,A,V]:[A,D,V]:D<=A?[V,D,A]:V<=A?[V,A,D]:[A,V,D]}rt.computeRealRoots=function(t,n,r,e){if(typeof t!="number")throw new w("a is a required number.");if(typeof n!="number")throw new w("b is a required number.");if(typeof r!="number")throw new w("c is a required number.");if(typeof e!="number")throw new w("d is a required number.");let o,s;if(t===0)return z.computeRealRoots(n,r,e);if(n===0){if(r===0){if(e===0)return[0,0,0];s=-e/t;let c=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3);return[c,c,c]}else if(e===0)return o=z.computeRealRoots(t,0,r),o.Length===0?[0]:[o[0],0,o[1]];return et(t,0,r,e)}else{if(r===0)return e===0?(s=-n/t,s<0?[s,0,0]:[0,0,s]):et(t,n,0,e);if(e===0)return o=z.computeRealRoots(t,n,r),o.length===0?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]}return et(t,n,r,e)};var H=rt;var ot={};ot.computeDiscriminant=function(t,n,r,e,o){if(typeof t!="number")throw new w("a is a required number.");if(typeof n!="number")throw new w("b is a required number.");if(typeof r!="number")throw new w("c is a required number.");if(typeof e!="number")throw new w("d is a required number.");if(typeof o!="number")throw new w("e is a required number.");let s=t*t,c=s*t,a=n*n,u=a*n,f=r*r,h=f*r,d=e*e,p=d*e,q=o*o,m=q*o;return a*f*d-4*u*p-4*t*h*d+18*t*n*r*p-27*s*d*d+256*c*m+o*(18*u*r*e-4*a*h+16*t*f*f-80*t*n*f*e-6*t*a*d+144*s*r*d)+q*(144*t*a*r-27*a*a-128*s*f-192*s*n*e)};function T(t,n,r,e){let o=t*t,s=n-3*o/8,c=r-n*t/2+o*t/8,a=e-r*t/4+n*o/16-3*o*o/256,u=H.computeRealRoots(1,2*s,s*s-4*a,-c*c);if(u.length>0){let f=-t/4,h=u[u.length-1];if(Math.abs(h)<y.EPSILON14){let d=z.computeRealRoots(1,s,a);if(d.length===2){let p=d[0],q=d[1],m;if(p>=0&&q>=0){let l=Math.sqrt(p),E=Math.sqrt(q);return[f-E,f-l,f+l,f+E]}else{if(p>=0&&q<0)return m=Math.sqrt(p),[f-m,f+m];if(p<0&&q>=0)return m=Math.sqrt(q),[f-m,f+m]}}return[]}else if(h>0){let d=Math.sqrt(h),p=(s+h-c/d)/2,q=(s+h+c/d)/2,m=z.computeRealRoots(1,d,p),l=z.computeRealRoots(1,-d,q);return m.length!==0?(m[0]+=f,m[1]+=f,l.length!==0?(l[0]+=f,l[1]+=f,m[1]<=l[0]?[m[0],m[1],l[0],l[1]]:l[1]<=m[0]?[l[0],l[1],m[0],m[1]]:m[0]>=l[0]&&m[1]<=l[1]?[l[0],m[0],m[1],l[1]]:l[0]>=m[0]&&l[1]<=m[1]?[m[0],l[0],l[1],m[1]]:m[0]>l[0]&&m[0]<l[1]?[l[0],m[0],l[1],m[1]]:[m[0],l[0],m[1],l[1]]):m):l.length!==0?(l[0]+=f,l[1]+=f,l):[]}}return[]}function j(t,n,r,e){let o=r*r,s=n*n,c=t*t,a=-2*n,u=r*t+s-4*e,f=c*e-r*n*t+o,h=H.computeRealRoots(1,a,u,f);if(h.length>0){let d=h[0],p=n-d,q=p*p,m=t/2,l=p/2,E=q-4*e,x=q+4*Math.abs(e),v=c-4*d,W=c+4*Math.abs(d),L,B;if(d<0||E*W<v*x){let N=Math.sqrt(v);L=N/2,B=N===0?0:(t*l-r)/N}else{let N=Math.sqrt(E);L=N===0?0:(t*l-r)/N,B=N/2}leLine truncated
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @license
|
||||
* Cesium - https://github.com/CesiumGS/cesium
|
||||
* Version 1.139.1
|
||||
*
|
||||
* Copyright 2011-2022 Cesium Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Columbus View (Pat. Pend.)
|
||||
*
|
||||
* Portions licensed separately.
|
||||
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
||||
*/
|
||||
|
||||
import{a as N}from"./chunk-XB2TPQAQ.js";import{a}from"./chunk-RXYBLNW3.js";import{a as t}from"./chunk-TXOEXY5C.js";import{e as i}from"./chunk-VIMSDF2W.js";var r={UNSIGNED_BYTE:N.UNSIGNED_BYTE,UNSIGNED_SHORT:N.UNSIGNED_SHORT,UNSIGNED_INT:N.UNSIGNED_INT};r.getSizeInBytes=function(e){switch(e){case r.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case r.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case r.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}throw new t("indexDatatype is required and must be a valid IndexDatatype constant.")};r.fromSizeInBytes=function(e){switch(e){case 2:return r.UNSIGNED_SHORT;case 4:return r.UNSIGNED_INT;case 1:return r.UNSIGNED_BYTE;default:throw new t("Size in bytes cannot be mapped to an IndexDatatype")}};r.validate=function(e){return i(e)&&(e===r.UNSIGNED_BYTE||e===r.UNSIGNED_SHORT||e===r.UNSIGNED_INT)};r.createTypedArray=function(e,n){if(!i(e))throw new t("numberOfVertices is required.");return e>=a.SIXTY_FOUR_KILOBYTES?new Uint32Array(n):new Uint16Array(n)};r.createTypedArrayFromArrayBuffer=function(e,n,E,o){if(!i(e))throw new t("numberOfVertices is required.");if(!i(n))throw new t("sourceArray is required.");if(!i(E))throw new t("byteOffset is required.");return e>=a.SIXTY_FOUR_KILOBYTES?new Uint32Array(n,E,o):new Uint16Array(n,E,o)};r.fromTypedArray=function(e){if(e instanceof Uint8Array)return r.UNSIGNED_BYTE;if(e instanceof Uint16Array)return r.UNSIGNED_SHORT;if(e instanceof Uint32Array)return r.UNSIGNED_INT;throw new t("array must be a Uint8Array, Uint16Array, or Uint32Array.")};var u=Object.freeze(r);export{u as a};
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @license
|
||||
* Cesium - https://github.com/CesiumGS/cesium
|
||||
* Version 1.139.1
|
||||
*
|
||||
* Copyright 2011-2022 Cesium Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Columbus View (Pat. Pend.)
|
||||
*
|
||||
* Portions licensed separately.
|
||||
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
||||
*/
|
||||
|
||||
import{h as O,i as R,j as G,k as L}from"./chunk-V6RJRUKY.js";import{b as E}from"./chunk-R6PWD5CA.js";import{a as u}from"./chunk-XB2TPQAQ.js";import{a as N,b as s}from"./chunk-F2ZMVLJV.js";import{a as S,b as y,c as A}from"./chunk-VGILZD7B.js";import{a as I,b as w}from"./chunk-TXOEXY5C.js";import{e as f}from"./chunk-VIMSDF2W.js";var U={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3},F=Object.freeze(U);var r={POINTS:u.POINTS,LINES:u.LINES,LINE_LOOP:u.LINE_LOOP,LINE_STRIP:u.LINE_STRIP,TRIANGLES:u.TRIANGLES,TRIANGLE_STRIP:u.TRIANGLE_STRIP,TRIANGLE_FAN:u.TRIANGLE_FAN};r.isLines=function(t){return t===r.LINES||t===r.LINE_LOOP||t===r.LINE_STRIP};r.isTriangles=function(t){return t===r.TRIANGLES||t===r.TRIANGLE_STRIP||t===r.TRIANGLE_FAN};r.validate=function(t){return t===r.POINTS||t===r.LINES||t===r.LINE_LOOP||t===r.LINE_STRIP||t===r.TRIANGLES||t===r.TRIANGLE_STRIP||t===r.TRIANGLE_FAN};var M=Object.freeze(r);function _(t){t=t??A.EMPTY_OBJECT,w.typeOf.object("options.attributes",t.attributes),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=t.primitiveType??M.TRIANGLES,this.boundingSphere=t.boundingSphere,this.geometryType=t.geometryType??F.NONE,this.boundingSphereCV=t.boundingSphereCV,this.offsetAttribute=t.offsetAttribute}_.computeNumberOfVertices=function(t){w.typeOf.object("geometry",t);let c=-1;for(let a in t.attributes)if(t.attributes.hasOwnProperty(a)&&f(t.attributes[a])&&f(t.attributes[a].values)){let o=t.attributes[a],e=o.values.length/o.componentsPerAttribute;if(c!==e&&c!==-1)throw new I("All attribute lists must have the same number of attributes.");c=e}return c};var W=new N,H=new S,g=new E,Z=[new N,new N,new N],K=[new s,new s,new s],$=[new s,new s,new s],tt=new S,et=new O,rt=new E,nt=new L;_._textureCoordinateRotationPoints=function(t,c,a,o){let e,V=G.center(o,W),D=N.toCartesian(V,a,H),Y=R.eastNorthUpToFixedFrame(D,a,g),C=E.inverse(Y,g),b=K,m=Z;m[0].longitude=o.west,m[0].latitude=o.south,m[1].longitude=o.west,m[1].latitude=o.north,m[2].longitude=o.east,m[2].latitude=o.south;let n=tt;for(e=0;e<3;e++)N.toCartesian(m[e],a,n),n=E.multiplyByPointAsVector(C,n,n),b[e].x=n.x,b[e].y=n.y;let z=O.fromAxisAngle(S.UNIT_Z,-c,et),B=y.fromQuaternion(z,rt),v=t.length,T=Number.POSITIVE_INFINITY,p=Number.POSITIVE_INFINITY,x=Number.NEGATIVE_INFINITY,d=Number.NEGATIVE_INFINITY;for(e=0;e<v;e++)n=E.multiplyByPointAsVector(C,t[e],n),n=y.multiplyByVector(B,n,n),T=Math.min(T,n.x),p=Math.min(p,n.y),x=Math.max(x,n.x),d=Math.max(d,n.y);let j=L.fromRotation(c,nt),i=$;i[0].x=T,i[0].y=p,i[1].x=T,i[1].y=d,i[2].x=x,i[2].y=p;let l=b[0],k=b[2].x-l.x,X=b[1].y-l.y;for(e=0;e<3;e++){let h=i[e];L.multiplyByVector(j,h,h),h.x=(h.x-l.x)/k,h.y=(h.y-l.y)/X}let q=i[0],J=i[1],Q=i[2],P=new Array(6);return s.pack(q,P),s.pack(J,P,2),s.pack(Q,P,4),P};var Lt=_;function ot(t){if(t=t??A.EMPTY_OBJECT,!f(t.componentDatatype))throw new I("options.componentDatatype is required.");if(!f(t.componentsPerAttribute))throw new I("options.componentsPerAttribute is required.");if(t.componentsPerAttribute<1||t.componentsPerAttribute>4)throw new I("options.componentsPerAttribute must be between 1 and 4.");if(!f(t.values))throw new I("options.values is required.");this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=t.normalize??!1,this.values=t.values}var Ot=ot;export{F as a,M as b,Lt as c,Ot as d};
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @license
|
||||
* Cesium - https://github.com/CesiumGS/cesium
|
||||
* Version 1.139.1
|
||||
*
|
||||
* Copyright 2011-2022 Cesium Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Columbus View (Pat. Pend.)
|
||||
*
|
||||
* Portions licensed separately.
|
||||
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
||||
*/
|
||||
|
||||
import{a as y}from"./chunk-CAEAJPBH.js";import{c as W}from"./chunk-WQ5ZC6ME.js";import{j as k}from"./chunk-V6RJRUKY.js";import{b as h}from"./chunk-R6PWD5CA.js";import{a as A}from"./chunk-BDF6MEVU.js";import{a as F,b as T,c as w}from"./chunk-F2ZMVLJV.js";import{a as s}from"./chunk-VGILZD7B.js";import{a as _}from"./chunk-RXYBLNW3.js";import{a as I,b as r}from"./chunk-TXOEXY5C.js";import{e as l}from"./chunk-VIMSDF2W.js";function b(e,t){r.typeOf.object("ellipsoid",e),this._ellipsoid=e,this._cameraPosition=new s,this._cameraPositionInScaledSpace=new s,this._distanceToLimbInScaledSpaceSquared=0,l(t)&&(this.cameraPosition=t)}Object.defineProperties(b.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},cameraPosition:{get:function(){return this._cameraPosition},set:function(e){let o=this._ellipsoid.transformPositionToScaledSpace(e,this._cameraPositionInScaledSpace),n=s.magnitudeSquared(o)-1;s.clone(e,this._cameraPosition),this._cameraPositionInScaledSpace=o,this._distanceToLimbInScaledSpaceSquared=n}}});var L=new s;b.prototype.isPointVisible=function(e){let o=this._ellipsoid.transformPositionToScaledSpace(e,L);return D(o,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};b.prototype.isScaledSpacePointVisible=function(e){return D(e,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};var tt=new s;b.prototype.isScaledSpacePointVisiblePossiblyUnderEllipsoid=function(e,t){let o=this._ellipsoid,n,i;return l(t)&&t<0&&o.minimumRadius>-t?(i=tt,i.x=this._cameraPosition.x/(o.radii.x+t),i.y=this._cameraPosition.y/(o.radii.y+t),i.z=this._cameraPosition.z/(o.radii.z+t),n=i.x*i.x+i.y*i.y+i.z*i.z-1):(i=this._cameraPositionInScaledSpace,n=this._distanceToLimbInScaledSpaceSquared),D(e,i,n)};b.prototype.computeHorizonCullingPoint=function(e,t,o){return Q(this._ellipsoid,e,t,o)};var U=w.clone(w.UNIT_SPHERE);b.prototype.computeHorizonCullingPointPossiblyUnderEllipsoid=function(e,t,o,n){let i=v(this._ellipsoid,o,U);return Q(i,e,t,n)};b.prototype.computeHorizonCullingPointFromVertices=function(e,t,o,n,i){return Z(this._ellipsoid,e,t,o,n,i)};b.prototype.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid=function(e,t,o,n,i,c){let a=v(this._ellipsoid,i,U);return Z(a,e,t,o,n,c)};var et=[];b.prototype.computeHorizonCullingPointFromRectangle=function(e,t,o){r.typeOf.object("rectangle",e);let n=k.subsample(e,t,0,et),i=W.fromPoints(n);if(!(s.magnitude(i.center)<.1*t.minimumRadius))return this.computeHorizonCullingPoint(i.center,n,o)};var ot=new s;function v(e,t,o){if(l(t)&&t<0&&e.minimumRadius>-t){let n=s.fromElements(e.radii.x+t,e.radii.y+t,e.radii.z+t,ot);e=w.fromCartesian3(n,o)}return e}function Q(e,t,o,n){r.typeOf.object("directionToPoint",t),r.defined("positions",o),l(n)||(n=new s);let i=K(e,t),c=0;for(let a=0,m=o.length;a<m;++a){let d=o[a],u=B(e,d,i);if(u<0)return;c=Math.max(c,u)}return J(i,c,n)}var q=new s;function Z(e,t,o,n,i,c){r.typeOf.object("directionToPoint",t),r.defined("vertices",o),r.typeOf.number("stride",n),l(c)||(c=new s),n=n??3,i=i??s.ZERO;let a=K(e,t),m=0;for(let d=0,u=o.length;d<u;d+=n){q.x=o[d]+i.x,q.y=o[d+1]+i.y,q.z=o[d+2]+i.z;let f=B(e,q,a);if(f<0)return;m=Math.max(m,f)}return J(a,m,c)}function D(e,t,o){let n=t,i=o,c=s.subtract(e,n,L),a=-s.dot(c,n);return!(i<0?a>0:a>i&&a*a/s.magnitudeSquared(c)>i)}var it=new s,nt=new s;function B(e,t,o){let n=e.transformPositionToScaledSpace(t,it),i=s.magnitudeSquared(n),c=Math.sqrt(i),a=s.divideByScalar(n,c,nt);i=Math.max(1,i),c=Math.max(1,c);let m=s.dot(a,o),d=s.magnitude(s.cross(a,o,a)),u=1/c,f=Math.sqrt(i-1)*u;return 1/(m*u-d*f)}function J(e,t,o){if(!(t<=0||t===1/0||t!==t))return s.multiplyByScalar(e,t,o)}var R=new s;function K(e,t){return s.equals(t,s.ZERO)?t:(e.transformPositionToScaledSpace(t,R),s.normalize(R,R))}var Nt=b;var j={};j.getHeight=function(e,t,o){if(!Number.isFinite(t))throw new I("scale must be a finite number.");if(!Number.isFinite(o))throw new I("relativeHeight must be a finite number.");return(e-o)*t+o};var at=new F;j.getPosition=function(e,t,o,n,i){let c=t.cartesianToCartographic(e,at);if(!l(c))return s.clone(e,i);let a=j.getHeight(c.height,o,n);return s.fromRadians(c.longitude,c.latitude,a,t,i)};var X=j;var st={NONE:0,BITS12:1},g=Object.freeze(st);var C=new s,ct=new s,N=new T,rt=new h,mt=new h,dt=Math.pow(2,12);function p(e,t,o,n,i,c,a,m,d,u){let f=g.NONE,O,S;if(l(t)&&l(o)&&l(n)&&l(i)){let z=t.minimum,G=t.maximum,x=s.subtract(G,z,ct),$=n-o;Math.max(s.maximumComponent(x),$)<dt-1?f=g.BITS12:f=g.NONE;let P=h.fromScale(x,rt);P=h.setTranslation(P,z,P);let E=h.fromScale(s.fromElements(1/x.x,1/x.y,1/x.z,C),mt);E=h.multiplyByTranslation(E,s.negate(z,C),E),S=h.clone(i,new h);let H=h.getTranslation(i,C);H=s.subtract(H,e,C),S=h.setTranslation(S,H,S),S=h.multiply(S,P,S),O=h.inverseTransformation(i,new h),O=h.multiply(E,O,O),i=h.multiply(i,P,new h)}this.quantization=f,this.minimumHeight=o,this.maximumHeight=n,this.center=s.clone(e),this.toScaledENU=O,this.fromScaledENU=i,this.matrix=S,this.hasVertexNormalLine truncated
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @license
|
||||
* Cesium - https://github.com/CesiumGS/cesium
|
||||
* Version 1.139.1
|
||||
*
|
||||
* Copyright 2011-2022 Cesium Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Columbus View (Pat. Pend.)
|
||||
*
|
||||
* Portions licensed separately.
|
||||
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
||||
*/
|
||||
|
||||
import{a as P,c as T}from"./chunk-F2ZMVLJV.js";import{a as p}from"./chunk-VGILZD7B.js";import{a}from"./chunk-RXYBLNW3.js";import{a as I,b as g}from"./chunk-TXOEXY5C.js";import{e as l}from"./chunk-VIMSDF2W.js";function w(n,i,o){if(n===0)return i*o;let t=n*n,e=t*t,c=e*t,r=c*t,h=r*t,s=h*t,d=o,u=Math.sin(2*d),f=Math.sin(4*d),M=Math.sin(6*d),_=Math.sin(8*d),E=Math.sin(10*d),S=Math.sin(12*d);return i*((1-t/4-3*e/64-5*c/256-175*r/16384-441*h/65536-4851*s/1048576)*d-(3*t/8+3*e/32+45*c/1024+105*r/4096+2205*h/131072+6237*s/524288)*u+(15*e/256+45*c/1024+525*r/16384+1575*h/65536+155925*s/8388608)*f-(35*c/3072+175*r/12288+3675*h/262144+13475*s/1048576)*M+(315*r/131072+2205*h/524288+43659*s/8388608)*_-(693*h/1310720+6237*s/5242880)*E+1001*s/8388608*S)}function H(n,i,o){let t=n/o;if(i===0)return t;let e=t*t,c=e*t,r=c*t,h=i,s=h*h,d=s*s,u=d*s,f=u*s,M=f*s,_=M*s,E=Math.sin(2*t),S=Math.cos(2*t),v=Math.sin(4*t),W=Math.cos(4*t),V=Math.sin(6*t),C=Math.cos(6*t),N=Math.sin(8*t),R=Math.cos(8*t),b=Math.sin(10*t),x=Math.cos(10*t),U=Math.sin(12*t);return t+t*s/4+7*t*d/64+15*t*u/256+579*t*f/16384+1515*t*M/65536+16837*t*_/1048576+(3*t*d/16+45*t*u/256-t*(32*e-561)*f/4096-t*(232*e-1677)*M/16384+t*(399985-90560*e+512*r)*_/5242880)*S+(21*t*u/256+483*t*f/4096-t*(224*e-1969)*M/16384-t*(33152*e-112599)*_/1048576)*W+(151*t*f/4096+4681*t*M/65536+1479*t*_/16384-453*c*_/32768)*C+(1097*t*M/65536+42783*t*_/1048576)*R+8011*t*_/1048576*x+(3*s/8+3*d/16+213*u/2048-3*e*u/64+255*f/4096-33*e*f/512+20861*M/524288-33*e*M/512+r*M/1024+28273*_/1048576-471*e*_/8192+9*r*_/4096)*E+(21*d/256+21*u/256+533*f/8192-21*e*f/512+197*M/4096-315*e*M/4096+584039*_/16777216-12517*e*_/131072+7*r*_/2048)*v+(151*u/6144+151*f/4096+5019*M/131072-453*e*M/16384+26965*_/786432-8607*e*_/131072)*V+(1097*f/131072+1097*M/65536+225797*_/10485760-1097*e*_/65536)*N+(8011*M/2621440+8011*_/1048576)*b+293393*_/251658240*U}function O(n,i){if(n===0)return Math.log(Math.tan(.5*(a.PI_OVER_TWO+i)));let o=n*Math.sin(i);return Math.log(Math.tan(.5*(a.PI_OVER_TWO+i)))-n/2*Math.log((1+o)/(1-o))}function z(n,i,o,t,e){let c=O(n._ellipticity,o),r=O(n._ellipticity,e);return Math.atan2(a.negativePiToPi(t-i),r-c)}function k(n,i,o,t,e,c,r){let h=n._heading,s=c-t,d=0;if(a.equalsEpsilon(Math.abs(h),a.PI_OVER_TWO,a.EPSILON8))if(i===o)d=i*Math.cos(e)*a.negativePiToPi(s);else{let u=Math.sin(e);d=i*Math.cos(e)*a.negativePiToPi(s)/Math.sqrt(1-n._ellipticitySquared*u*u)}else{let u=w(n._ellipticity,i,e);d=(w(n._ellipticity,i,r)-u)/Math.cos(h)}return Math.abs(d)}var A=new p,q=new p;function y(n,i,o,t){let e=p.normalize(t.cartographicToCartesian(i,q),A),c=p.normalize(t.cartographicToCartesian(o,q),q);g.typeOf.number.greaterThanOrEquals("value",Math.abs(Math.abs(p.angleBetween(e,c))-Math.PI),.0125);let r=t.maximumRadius,h=t.minimumRadius,s=r*r,d=h*h;n._ellipticitySquared=(s-d)/s,n._ellipticity=Math.sqrt(n._ellipticitySquared),n._start=P.clone(i,n._start),n._start.height=0,n._end=P.clone(o,n._end),n._end.height=0,n._heading=z(n,i.longitude,i.latitude,o.longitude,o.latitude),n._distance=k(n,t.maximumRadius,t.minimumRadius,i.longitude,i.latitude,o.longitude,o.latitude)}function D(n,i,o,t,e,c){if(o===0)return P.clone(n,c);let r=e*e,h,s,d;if(Math.abs(a.PI_OVER_TWO-Math.abs(i))>a.EPSILON8){let u=w(e,t,n.latitude),f=o*Math.cos(i),M=u+f;if(s=H(M,e,t),Math.abs(i)<a.EPSILON10)h=a.negativePiToPi(n.longitude);else{let _=O(e,n.latitude),E=O(e,s);d=Math.tan(i)*(E-_),h=a.negativePiToPi(n.longitude+d)}}else{s=n.latitude;let u;if(e===0)u=t*Math.cos(n.latitude);else{let f=Math.sin(n.latitude);u=t*Math.cos(n.latitude)/Math.sqrt(1-r*f*f)}d=o/u,i>0?h=a.negativePiToPi(n.longitude+d):h=a.negativePiToPi(n.longitude-d)}return l(c)?(c.longitude=h,c.latitude=s,c.height=0,c):new P(h,s,0)}function m(n,i,o){let t=o??T.default;this._ellipsoid=t,this._start=new P,this._end=new P,this._heading=void 0,this._distance=void 0,this._ellipticity=void 0,this._ellipticitySquared=void 0,l(n)&&l(i)&&y(this,n,i,t)}Object.defineProperties(m.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return g.defined("distance",this._distance),this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},heading:{get:function(){return g.defined("distance",this._distance),this._heading}}});m.fromStartHeadingDistance=function(n,i,o,t,e){g.defined("start",n),g.defined("heading",i),g.defined("distance",o),g.typeOf.number.greaterThan("distance",o,0);let c=t??T.default,r=c.maximumRadius,h=c.minimumRadius,s=r*r,d=h*h,u=Math.sqrt((s-d)/s);i=a.negativePiToPi(i);let f=D(n,i,o,c.maximumRadius,u);return!l(e)||l(t)&&!t.equals(e.ellipsoid)?new m(n,f,c):(e.setEndPoints(n,f),e)};m.prototype.setEndPoints=function(n,i){g.defined("start",n),g.defined("end",i),y(this,n,i,this._ellipsoid)};m.prototype.interpolateUsingFraction=function(n,i){return this.interpolateUsingSurfaceDistance(n*this._distance,i)};m.prototype.interpolateUsingSurfaceDistance=function(n,i){if(g.typeOf.number("distance",n),!l(this._distance)||thiLine truncated
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @license
|
||||
* Cesium - https://github.com/CesiumGS/cesium
|
||||
* Version 1.139.1
|
||||
*
|
||||
* Copyright 2011-2022 Cesium Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Columbus View (Pat. Pend.)
|
||||
*
|
||||
* Portions licensed separately.
|
||||
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
||||
*/
|
||||
|
||||
import{a as N}from"./chunk-XB2TPQAQ.js";import{a}from"./chunk-TXOEXY5C.js";import{e as T}from"./chunk-VIMSDF2W.js";var r={BYTE:N.BYTE,UNSIGNED_BYTE:N.UNSIGNED_BYTE,SHORT:N.SHORT,UNSIGNED_SHORT:N.UNSIGNED_SHORT,INT:N.INT,UNSIGNED_INT:N.UNSIGNED_INT,FLOAT:N.FLOAT,DOUBLE:N.DOUBLE};r.getSizeInBytes=function(n){if(!T(n))throw new a("value is required.");switch(n){case r.BYTE:return Int8Array.BYTES_PER_ELEMENT;case r.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case r.SHORT:return Int16Array.BYTES_PER_ELEMENT;case r.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case r.INT:return Int32Array.BYTES_PER_ELEMENT;case r.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case r.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case r.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new a("componentDatatype is not a valid value.")}};r.fromTypedArray=function(n){if(n instanceof Int8Array)return r.BYTE;if(n instanceof Uint8Array)return r.UNSIGNED_BYTE;if(n instanceof Int16Array)return r.SHORT;if(n instanceof Uint16Array)return r.UNSIGNED_SHORT;if(n instanceof Int32Array)return r.INT;if(n instanceof Uint32Array)return r.UNSIGNED_INT;if(n instanceof Float32Array)return r.FLOAT;if(n instanceof Float64Array)return r.DOUBLE;throw new a("array must be an Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, or Float64Array.")};r.validate=function(n){return T(n)&&(n===r.BYTE||n===r.UNSIGNED_BYTE||n===r.SHORT||n===r.UNSIGNED_SHORT||n===r.INT||n===r.UNSIGNED_INT||n===r.FLOAT||n===r.DOUBLE)};r.createTypedArray=function(n,e){if(!T(n))throw new a("componentDatatype is required.");if(!T(e))throw new a("valuesOrLength is required.");switch(n){case r.BYTE:return new Int8Array(e);case r.UNSIGNED_BYTE:return new Uint8Array(e);case r.SHORT:return new Int16Array(e);case r.UNSIGNED_SHORT:return new Uint16Array(e);case r.INT:return new Int32Array(e);case r.UNSIGNED_INT:return new Uint32Array(e);case r.FLOAT:return new Float32Array(e);case r.DOUBLE:return new Float64Array(e);default:throw new a("componentDatatype is not a valid value.")}};r.createArrayBufferView=function(n,e,E,t){if(!T(n))throw new a("componentDatatype is required.");if(!T(e))throw new a("buffer is required.");switch(E=E??0,t=t??(e.byteLength-E)/r.getSizeInBytes(n),n){case r.BYTE:return new Int8Array(e,E,t);case r.UNSIGNED_BYTE:return new Uint8Array(e,E,t);case r.SHORT:return new Int16Array(e,E,t);case r.UNSIGNED_SHORT:return new Uint16Array(e,E,t);case r.INT:return new Int32Array(e,E,t);case r.UNSIGNED_INT:return new Uint32Array(e,E,t);case r.FLOAT:return new Float32Array(e,E,t);case r.DOUBLE:return new Float64Array(e,E,t);default:throw new a("componentDatatype is not a valid value.")}};r.fromName=function(n){switch(n){case"BYTE":return r.BYTE;case"UNSIGNED_BYTE":return r.UNSIGNED_BYTE;case"SHORT":return r.SHORT;case"UNSIGNED_SHORT":return r.UNSIGNED_SHORT;case"INT":return r.INT;case"UNSIGNED_INT":return r.UNSIGNED_INT;case"FLOAT":return r.FLOAT;case"DOUBLE":return r.DOUBLE;default:throw new a("name is not a valid value.")}};var A=Object.freeze(r);export{A as a};
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @license
|
||||
* Cesium - https://github.com/CesiumGS/cesium
|
||||
* Version 1.139.1
|
||||
*
|
||||
* Copyright 2011-2022 Cesium Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Columbus View (Pat. Pend.)
|
||||
*
|
||||
* Portions licensed separately.
|
||||
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
||||
*/
|
||||
|
||||
import{a as c,c as p}from"./chunk-F2ZMVLJV.js";import{a as u}from"./chunk-VGILZD7B.js";import{a as d}from"./chunk-RXYBLNW3.js";import{a as s}from"./chunk-TXOEXY5C.js";import{e as a}from"./chunk-VIMSDF2W.js";function e(t){this._ellipsoid=t??p.WGS84,this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(e.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});e.mercatorAngleToGeodeticLatitude=function(t){return d.PI_OVER_TWO-2*Math.atan(Math.exp(-t))};e.geodeticLatitudeToMercatorAngle=function(t){t>e.MaximumLatitude?t=e.MaximumLatitude:t<-e.MaximumLatitude&&(t=-e.MaximumLatitude);let i=Math.sin(t);return .5*Math.log((1+i)/(1-i))};e.MaximumLatitude=e.mercatorAngleToGeodeticLatitude(Math.PI);e.prototype.project=function(t,i){let o=this._semimajorAxis,r=t.longitude*o,n=e.geodeticLatitudeToMercatorAngle(t.latitude)*o,m=t.height;return a(i)?(i.x=r,i.y=n,i.z=m,i):new u(r,n,m)};e.prototype.unproject=function(t,i){if(!a(t))throw new s("cartesian is required");let o=this._oneOverSemimajorAxis,r=t.x*o,n=e.mercatorAngleToGeodeticLatitude(t.y*o),m=t.z;return a(i)?(i.longitude=r,i.latitude=n,i.height=m,i):new c(r,n,m)};var A=e;export{A as a};
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @license
|
||||
* Cesium - https://github.com/CesiumGS/cesium
|
||||
* Version 1.139.1
|
||||
*
|
||||
* Copyright 2011-2022 Cesium Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Columbus View (Pat. Pend.)
|
||||
*
|
||||
* Portions licensed separately.
|
||||
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
||||
*/
|
||||
|
||||
import{k as N}from"./chunk-V6RJRUKY.js";import{a as S,b as z}from"./chunk-R6PWD5CA.js";import{a as p}from"./chunk-BDF6MEVU.js";import{b as C}from"./chunk-F2ZMVLJV.js";import{a as T,b as w}from"./chunk-VGILZD7B.js";import{a as m}from"./chunk-RXYBLNW3.js";import{a as h,b as c}from"./chunk-TXOEXY5C.js";import{e as b}from"./chunk-VIMSDF2W.js";var a={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};a.getMathType=function(e){switch(e){case a.SCALAR:return Number;case a.VEC2:return C;case a.VEC3:return T;case a.VEC4:return S;case a.MAT2:return N;case a.MAT3:return w;case a.MAT4:return z;default:throw new h("attributeType is not a valid value.")}};a.getNumberOfComponents=function(e){switch(e){case a.SCALAR:return 1;case a.VEC2:return 2;case a.VEC3:return 3;case a.VEC4:case a.MAT2:return 4;case a.MAT3:return 9;case a.MAT4:return 16;default:throw new h("attributeType is not a valid value.")}};a.getAttributeLocationCount=function(e){switch(e){case a.SCALAR:case a.VEC2:case a.VEC3:case a.VEC4:return 1;case a.MAT2:return 2;case a.MAT3:return 3;case a.MAT4:return 4;default:throw new h("attributeType is not a valid value.")}};a.getGlslType=function(e){switch(c.typeOf.string("attributeType",e),e){case a.SCALAR:return"float";case a.VEC2:return"vec2";case a.VEC3:return"vec3";case a.VEC4:return"vec4";case a.MAT2:return"mat2";case a.MAT3:return"mat3";case a.MAT4:return"mat4";default:throw new h("attributeType is not a valid value.")}};var F=Object.freeze(a);var V=1/256,k=65536,l=256,r={};r.octEncodeInRange=function(e,t,n){c.defined("vector",e),c.defined("result",n);let o=T.magnitudeSquared(e);if(Math.abs(o-1)>m.EPSILON6)throw new h("vector must be normalized.");if(n.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),n.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){let i=n.x,d=n.y;n.x=(1-Math.abs(d))*m.signNotZero(i),n.y=(1-Math.abs(i))*m.signNotZero(d)}return n.x=m.toSNorm(n.x,t),n.y=m.toSNorm(n.y,t),n};r.octEncode=function(e,t){return r.octEncodeInRange(e,255,t)};var E=new C,D=new Uint8Array(1);function M(e){return D[0]=e,D[0]}r.octEncodeToCartesian4=function(e,t){return r.octEncodeInRange(e,65535,E),t.x=M(E.x*V),t.y=M(E.x),t.z=M(E.y*V),t.w=M(E.y),t};r.octDecodeInRange=function(e,t,n,o){if(c.defined("result",o),e<0||e>n||t<0||t>n)throw new h(`x and y must be unsigned normalized integers between 0 and ${n}`);if(o.x=m.fromSNorm(e,n),o.y=m.fromSNorm(t,n),o.z=1-(Math.abs(o.x)+Math.abs(o.y)),o.z<0){let i=o.x;o.x=(1-Math.abs(o.y))*m.signNotZero(i),o.y=(1-Math.abs(i))*m.signNotZero(o.y)}return T.normalize(o,o)};r.octDecode=function(e,t,n){return r.octDecodeInRange(e,t,255,n)};r.octDecodeFromCartesian4=function(e,t){c.typeOf.object("encoded",e),c.typeOf.object("result",t);let n=e.x,o=e.y,i=e.z,d=e.w;if(n<0||n>255||o<0||o>255||i<0||i>255||d<0||d>255)throw new h("x, y, z, and w must be unsigned normalized integers between 0 and 255");let f=n*l+o,s=i*l+d;return r.octDecodeInRange(f,s,65535,t)};r.octPackFloat=function(e){return c.defined("encoded",e),256*e.x+e.y};var x=new C;r.octEncodeFloat=function(e){return r.octEncode(e,x),r.octPackFloat(x)};r.octDecodeFloat=function(e,t){c.defined("value",e);let n=e/256,o=Math.floor(n),i=(n-o)*256;return r.octDecode(o,i,t)};r.octPack=function(e,t,n,o){c.defined("v1",e),c.defined("v2",t),c.defined("v3",n),c.defined("result",o);let i=r.octEncodeFloat(e),d=r.octEncodeFloat(t),f=r.octEncode(n,x);return o.x=65536*f.x+i,o.y=65536*f.y+d,o};r.octUnpack=function(e,t,n,o){c.defined("packed",e),c.defined("v1",t),c.defined("v2",n),c.defined("v3",o);let i=e.x/65536,d=Math.floor(i),f=(i-d)*65536;i=e.y/65536;let s=Math.floor(i),u=(i-s)*65536;r.octDecodeFloat(f,t),r.octDecodeFloat(u,n),r.octDecode(d,s,o)};r.compressTextureCoordinates=function(e){c.defined("textureCoordinates",e);let t=e.x*4095|0,n=e.y*4095|0;return 4096*t+n};r.decompressTextureCoordinates=function(e,t){c.defined("compressed",e),c.defined("result",t);let n=e/4096,o=Math.floor(n);return t.x=o/4095,t.y=(e-o*4096)/4095,t};function g(e){return e>>1^-(e&1)}r.zigZagDeltaDecode=function(e,t,n){c.defined("uBuffer",e),c.defined("vBuffer",t),c.typeOf.number.equals("uBuffer.length","vBuffer.length",e.length,t.length),b(n)&&c.typeOf.number.equals("uBuffer.length","heightBuffer.length",e.length,n.length);let o=e.length,i=0,d=0,f=0;for(let s=0;s<o;++s)i+=g(e[s]),d+=g(t[s]),e[s]=i,t[s]=d,b(n)&&(f+=g(n[s]),n[s]=f)};r.dequantize=function(e,t,n,o){c.defined("typedArray",e),c.defined("componentDatatype",t),c.defined("type",n),c.defined("count",o);let i=F.getNumberOfComponents(n),d;switch(t){case p.BYTE:d=127;break;case p.UNSIGNED_BYTE:d=255;break;case p.SHORT:d=32767;break;case p.UNSIGNED_SHORT:d=65535;break;case p.INT:d=2147483647;break;case p.UNSIGNED_INT:d=4294967295;break;default:throw new h(`Cannot dequantize component datatype: ${t}`)}let f=new Float32Array(o*i);for(let s=0;s<o;s++)for(let u=0;u<i;u++){let y=s*i+u;f[y]=Math.max(e[y]/d,-1)}return f};r.encodeRGB8=function(e){return c.typeOf.object("color",e),Math.rLine truncated
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* @license
|
||||
* Cesium - https://github.com/CesiumGS/cesium
|
||||
* Version 1.139.1
|
||||
*
|
||||
* Copyright 2011-2022 Cesium Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Columbus View (Pat. Pend.)
|
||||
*
|
||||
* Portions licensed separately.
|
||||
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
||||
*/
|
||||
|
||||
import{e as f}from"./chunk-VIMSDF2W.js";function c(t){let n,a=t.name,e=t.message;f(a)&&f(e)?n=`${a}: ${e}`:n=t.toString();let o=t.stack;return f(o)&&(n+=`
|
||||
${o}`),n}var i=c;function l(t){async function n({data:e}){let o=[],s={id:e.id,result:void 0,error:void 0};self.CESIUM_BASE_URL=e.baseUrl;try{let r=await t(e.parameters,o);s.result=r}catch(r){r instanceof Error?s.error={name:r.name,message:r.message,stack:r.stack}:s.error=r}e.canTransferArrayBuffer||(o.length=0);try{postMessage(s,o)}catch(r){s.result=void 0,s.error=`postMessage failed with error: ${i(r)}
|
||||
with responseMessage: ${JSON.stringify(s)}`,postMessage(s)}}function a(e){postMessage({id:e.data?.id,error:`postMessage failed with error: ${JSON.stringify(e)}`})}return self.onmessage=n,self.onmessageerror=a,self}var d=l;export{d as a};
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @license
|
||||
* Cesium - https://github.com/CesiumGS/cesium
|
||||
* Version 1.139.1
|
||||
*
|
||||
* Copyright 2011-2022 Cesium Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Columbus View (Pat. Pend.)
|
||||
*
|
||||
* Portions licensed separately.
|
||||
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
||||
*/
|
||||
|
||||
var r,u=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&u.decode();var a=null;function h(){return(a===null||a.byteLength===0)&&(a=new Uint8Array(r.memory.buffer)),a}function b(e,t){return e=e>>>0,u.decode(h().subarray(e,e+t))}var o=null;function g(){return(o===null||o.byteLength===0)&&(o=new Uint32Array(r.memory.buffer)),o}function m(e,t){return e=e>>>0,g().subarray(e/4,e/4+t)}var y=0;function x(e,t){let n=t(e.length*4,4)>>>0;return g().set(e,n/4),y=e.length,n}function c(e){let t=r.__wbindgen_export_0.get(e);return r.__externref_table_dealloc(e),t}function U(e,t,n,i,_){let s=r.generate_splat_texture(e,t,n,i,_);if(s[2])throw c(s[1]);return f.__wrap(s[0])}function M(e,t,n){let i=r.radix_sort_gaussians_indexes(e,t,n);if(i[2])throw c(i[1]);return c(i[0])}var w=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>r.__wbg_texturedata_free(e>>>0,1)),f=class e{static __wrap(t){t=t>>>0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,w.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,w.unregister(this),t}free(){let t=this.__destroy_into_raw();r.__wbg_texturedata_free(t,0)}get data(){let t=r.texturedata_data(this.__wbg_ptr);var n=m(t[0],t[1]).slice();return r.__wbindgen_free(t[0],t[1]*4,4),n}get width(){return r.texturedata_width(this.__wbg_ptr)>>>0}get height(){return r.texturedata_height(this.__wbg_ptr)>>>0}static new(t,n,i){let _=x(t,r.__wbindgen_malloc),s=y,p=r.texturedata_new(_,s,n,i);return e.__wrap(p)}};async function A(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(i){if(e.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",i);else throw i}let n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function d(){let e={};return e.wbg={},e.wbg.__wbg_buffer_609cc3eee51ed158=function(t){return t.buffer},e.wbg.__wbg_length_3b4f022188ae8db6=function(t){return t.length},e.wbg.__wbg_length_a446193dc22c12f8=function(t){return t.length},e.wbg.__wbg_new_780abee5c1739fd7=function(t){return new Float32Array(t)},e.wbg.__wbg_new_a12002a7f91c75be=function(t){return new Uint8Array(t)},e.wbg.__wbg_new_e3b321dcfef89fc7=function(t){return new Uint32Array(t)},e.wbg.__wbg_newwithbyteoffsetandlength_f1dead44d1fc7212=function(t,n,i){return new Uint32Array(t,n>>>0,i>>>0)},e.wbg.__wbg_set_10bad9bee0e9c58b=function(t,n,i){t.set(n,i>>>0)},e.wbg.__wbg_set_65595bdd868b3009=function(t,n,i){t.set(n,i>>>0)},e.wbg.__wbindgen_init_externref_table=function(){let t=r.__wbindgen_export_0,n=t.grow(4);t.set(0,void 0),t.set(n+0,void 0),t.set(n+1,null),t.set(n+2,!0),t.set(n+3,!1)},e.wbg.__wbindgen_memory=function(){return r.memory},e.wbg.__wbindgen_string_new=function(t,n){return b(t,n)},e.wbg.__wbindgen_throw=function(t,n){throw new Error(b(t,n))},e}function l(e,t){return r=e.exports,W.__wbindgen_wasm_module=t,o=null,a=null,r.__wbindgen_start(),r}function O(e){if(r!==void 0)return r;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=d();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let n=new WebAssembly.Instance(e,t);return l(n,e)}async function W(e){if(r!==void 0)return r;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("wasm_splats_bg.wasm",import.meta.url));let t=d();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:i}=await A(await e,t);return l(n,i)}export{U as a,M as b,O as c};
|
||||
Loaded 100 of 481 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user