Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0ce089f12 | ||
|
|
28d284046f | ||
|
|
c08f25e0b8 | ||
|
|
c4f23f322b | ||
|
|
6f265e7267 |
No files matched your search
@@ -28,32 +28,55 @@ If any are missing, ask the user or tell them to run plugin-researcher first.
|
|||||||
|
|
||||||
## Phase 2 — Scaffold
|
## Phase 2 — Scaffold
|
||||||
|
|
||||||
From the project root (`C:\dev\wwv\worldwideview`):
|
Always scaffold with the CLI, never by hand. From the project root (`C:\dev\wwv\worldwideview`).
|
||||||
|
|
||||||
|
**Step 1 — build the CLI if `dist/` is missing** (`dist` is gitignored, so fresh worktrees lack it):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Build the CLI first if dist/ is missing (dist is gitignored; fresh worktrees lack it):
|
pnpm --filter @worldwideview/wwv-cli build
|
||||||
# pnpm --filter @worldwideview/wwv-cli build
|
```
|
||||||
#
|
|
||||||
# The CLI accepts flags for every prompt. Pass them all + --yes for a fully
|
**Step 2 — run `create` non-interactively.** The CLI accepts a flag for every prompt;
|
||||||
# non-interactive scaffold (omit any flag to be prompted for just that value):
|
pass them all plus `--yes` so it never blocks on a prompt. Use the variant that matches
|
||||||
|
the architecture — `--seeder-tier` is **websocket-only** (passing it with `polling` does
|
||||||
|
nothing). Requires `@worldwideview/wwv-cli` **≥ 1.3.1** (earlier versions wrongly demanded
|
||||||
|
`--seeder-tier` for polling under `--yes`).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Polling / static (frontend only — NO seeder, so NO --seeder-tier):
|
||||||
node packages/wwv-cli/dist/index.js create <name> \
|
node packages/wwv-cli/dist/index.js create <name> \
|
||||||
--display-name "<Display Name>" \
|
--display-name "<Display Name>" \
|
||||||
--description "<short description>" \
|
--description "<short description>" \
|
||||||
--category <aviation|maritime|space|weather|custom> \
|
--category <aviation|maritime|space|weather|custom> \
|
||||||
--architecture <polling|websocket> \
|
--architecture polling \
|
||||||
|
--render-style <billboard|model|point> \
|
||||||
|
--yes
|
||||||
|
|
||||||
|
# Real-time / WebSocket (also scaffolds a backend seeder — REQUIRES --seeder-tier):
|
||||||
|
node packages/wwv-cli/dist/index.js create <name> \
|
||||||
|
--display-name "<Display Name>" \
|
||||||
|
--description "<short description>" \
|
||||||
|
--category <aviation|maritime|space|weather|custom> \
|
||||||
|
--architecture websocket \
|
||||||
--seeder-tier <community|private> \
|
--seeder-tier <community|private> \
|
||||||
--render-style <billboard|model|point> \
|
--render-style <billboard|model|point> \
|
||||||
--yes
|
--yes
|
||||||
|
|
||||||
pnpm install
|
pnpm install
|
||||||
```
|
```
|
||||||
|
|
||||||
This creates `local-plugins/wwv-plugin-<name>/`. With `--architecture websocket` it also
|
This creates `local-plugins/wwv-plugin-<name>/`. The `websocket` variant also creates the
|
||||||
creates the seeder at `local-seeders/<tier>/packages/<name>/` (correct community/private
|
seeder at `local-seeders/<tier>/packages/<name>/` in the correct community/private layout
|
||||||
layout: `package.json` + `tsup.config.ts` + `src/index.ts`). Verify both exist before proceeding.
|
(`package.json` + `tsup.config.ts` + `src/index.ts`, exporting `{ name, cron, fn }` with
|
||||||
|
`name` === the plugin id). Verify the expected directories exist before proceeding.
|
||||||
|
|
||||||
> The CLI scaffolds the seeder into `local-seeders/<tier>/packages/<name>/` already —
|
> No post-CLI move is required — the CLI already targets `local-seeders/<tier>/packages/<name>/`.
|
||||||
> no post-CLI move is required. (Older CLI versions dropped a bare `seeder.mjs` at
|
> (Pre-1.3.0 CLI dropped a bare `seeder.mjs` at `local-seeders/<tier>/<name>/`; if you ever see
|
||||||
> `local-seeders/<tier>/<name>/`; if you ever see that, the CLI is out of date — rebuild it.)
|
> that shape, the CLI is stale — rebuild it with the Step 1 command.)
|
||||||
|
>
|
||||||
|
> The CLI exits non-zero with a clear message on a bad `--category`/`--architecture`/etc., a
|
||||||
|
> missing required value under `--yes`, or an existing target directory. Treat a non-zero exit
|
||||||
|
> as a hard stop — fix the inputs and re-run; do not fall back to manual scaffolding.
|
||||||
|
|
||||||
**NEVER:**
|
**NEVER:**
|
||||||
- Scaffold manually (always use the CLI)
|
- Scaffold manually (always use the CLI)
|
||||||
@@ -134,13 +157,15 @@ export class MyPlugin implements WorldPlugin {
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Phase 4 — Implement the Seeder (skip for static plugins)
|
## Phase 4 — Implement the Seeder (skip for static / polling-only plugins)
|
||||||
|
|
||||||
Seeders live in `local-seeders/community/` — **this is an independent git repo** (`github.com/silvertakana/wwv-seeders`). Never commit seeder files to the worldwideview repo.
|
Seeders live in `local-seeders/<tier>/` — **independent git repos** (`github.com/silvertakana/wwv-seeders` for community, `wwv-seeders-private` for private). Never commit seeder files to the worldwideview repo.
|
||||||
|
|
||||||
### Create `local-seeders/community/packages/<name>/`
|
If you scaffolded with `--architecture websocket`, **the CLI already created the seeder skeleton** at `local-seeders/<tier>/packages/<name>/` (`package.json` + `tsup.config.ts` + `src/index.ts` with a `{ name, cron, fn }` stub). Do **not** recreate those files — open the generated `src/index.ts` and replace the stub body with real fetch + map logic. The snippets below are the target shapes the CLI emits; use them to verify/adjust what was generated, not to create files from scratch.
|
||||||
|
|
||||||
**`package.json`:**
|
### Generated layout: `local-seeders/<tier>/packages/<name>/`
|
||||||
|
|
||||||
|
**`package.json`** (CLI-generated — only adjust `dependencies` for what your seeder imports):
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"name": "@wwv-seeders/<name>",
|
"name": "@wwv-seeders/<name>",
|
||||||
|
|||||||
@@ -72,6 +72,23 @@ mapWebsocketPayload(payload: any, existingEntities: GeoEntity[]): GeoEntity[]
|
|||||||
- `existingEntities` — current entities in the store for this plugin (use for incremental updates)
|
- `existingEntities` — current entities in the store for this plugin (use for incremental updates)
|
||||||
- Must return a **complete replacement** `GeoEntity[]` (not a diff)
|
- Must return a **complete replacement** `GeoEntity[]` (not a diff)
|
||||||
|
|
||||||
|
### Property Tag Helpers
|
||||||
|
|
||||||
|
Always wrap typed property values with the SDK helpers so the Intel panel renders them richly:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import { dtProp, urlProp, imageProp, videoProp } from "@worldwideview/wwv-plugin-sdk";
|
||||||
|
|
||||||
|
properties: {
|
||||||
|
updated: dtProp(item.updated_at ?? null), // renders as expandable datetime row
|
||||||
|
source: urlProp(item.source_url ?? null), // renders as clickable link
|
||||||
|
preview: imageProp(item.image ?? null), // renders as inline thumbnail
|
||||||
|
stream: videoProp(item.video_url ?? null), // renders as "Watch" link
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
All helpers are null-safe and return `null` for empty input. Plain string/number values that don't need rich rendering need no wrapper.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Plugin Architectures (Manifest Formats)
|
## Plugin Architectures (Manifest Formats)
|
||||||
|
|||||||
@@ -202,7 +202,40 @@ import { Plane } from "lucide-react";
|
|||||||
const iconUrl = createSvgIconUrl(Plane, { color: "#3b82f6" });
|
const iconUrl = createSvgIconUrl(Plane, { color: "#3b82f6" });
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.5 Registration (3 Paths)
|
### 1.5 Property Tag Helpers
|
||||||
|
|
||||||
|
Use these SDK helpers to wrap property values so the Intel panel renders them richly. Without the tag prefix, the panel falls back to plain text.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import { dtProp, urlProp, imageProp, videoProp } from "@worldwideview/wwv-plugin-sdk";
|
||||||
|
```
|
||||||
|
|
||||||
|
| Helper | Tag format stored | Panel renders as |
|
||||||
|
|---|---|---|
|
||||||
|
| `dtProp(iso)` | `"datetime:2026-06-01T05:00:00Z"` | Expandable row: local time (collapsed), UTC + relative (expanded) |
|
||||||
|
| `urlProp(href)` | `"url:https://..."` | Clickable link with external icon |
|
||||||
|
| `imageProp(src)` | `"image:https://..."` | Inline thumbnail |
|
||||||
|
| `videoProp(href)` | `"video:https://..."` | "Watch" link with play icon |
|
||||||
|
|
||||||
|
All four helpers return `null` for empty, `null`, or `undefined` input — safe to call unconditionally.
|
||||||
|
|
||||||
|
**Usage pattern:**
|
||||||
|
```ts
|
||||||
|
properties: {
|
||||||
|
// dates — pass ISO 8601 strings
|
||||||
|
updated_at: dtProp(item.updated_at ?? null),
|
||||||
|
// URLs
|
||||||
|
source_url: urlProp(item.url ?? null),
|
||||||
|
// images and video
|
||||||
|
preview: imageProp(item.image_url ?? null),
|
||||||
|
stream: videoProp(item.video_url ?? null),
|
||||||
|
// plain values — no helper needed
|
||||||
|
name: item.name,
|
||||||
|
count: item.count,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 1.6 Registration (3 Paths)
|
||||||
|
|
||||||
**A. Built-in (monorepo package):**
|
**A. Built-in (monorepo package):**
|
||||||
|
|
||||||
@@ -224,7 +257,7 @@ await pluginManager.registerPlugin(plugin);
|
|||||||
**C. Dynamic import (runtime):**
|
**C. Dynamic import (runtime):**
|
||||||
For user-imported GeoJSON layers, call `pluginManager.loadFromManifest(manifest)` directly.
|
For user-imported GeoJSON layers, call `pluginManager.loadFromManifest(manifest)` directly.
|
||||||
|
|
||||||
### 1.6 Build Configuration (Core Monorepo Packages Only)
|
### 1.7 Build Configuration (Core Monorepo Packages Only)
|
||||||
|
|
||||||
If you decide to manually move a plugin from the local sandbox into the core `packages/` directory, you must manually add it to the build pipeline:
|
If you decide to manually move a plugin from the local sandbox into the core `packages/` directory, you must manually add it to the build pipeline:
|
||||||
|
|
||||||
@@ -652,6 +685,10 @@ Categories are **lowercase**: `"aviation"` not `"Aviation"`, `"natural-disaster"
|
|||||||
- [ ] **Frontend:** Added path alias in `tsconfig.json`
|
- [ ] **Frontend:** Added path alias in `tsconfig.json`
|
||||||
- [ ] **Frontend:** Registered via `pluginRegistry` + `pluginManager` in `AppShell.tsx`
|
- [ ] **Frontend:** Registered via `pluginRegistry` + `pluginManager` in `AppShell.tsx`
|
||||||
- [ ] **Frontend:** `renderEntity()` doesn't mix point/billboard properties
|
- [ ] **Frontend:** `renderEntity()` doesn't mix point/billboard properties
|
||||||
|
- [ ] **Frontend:** Date/time fields wrapped with `dtProp()`
|
||||||
|
- [ ] **Frontend:** External links wrapped with `urlProp()`
|
||||||
|
- [ ] **Frontend:** Image URLs wrapped with `imageProp()`
|
||||||
|
- [ ] **Frontend:** Video/stream URLs wrapped with `videoProp()`
|
||||||
- [ ] **Engine:** Seeder file in `wwv-seeders/src/seeders/<name>.ts` (or private repo)
|
- [ ] **Engine:** Seeder file in `wwv-seeders/src/seeders/<name>.ts` (or private repo)
|
||||||
- [ ] **Engine:** `registerSeeder({ name })` matches frontend plugin `id`
|
- [ ] **Engine:** `registerSeeder({ name })` matches frontend plugin `id`
|
||||||
- [ ] **Engine:** Calls `setLiveSnapshot()` with correct plugin ID key
|
- [ ] **Engine:** Calls `setLiveSnapshot()` with correct plugin ID key
|
||||||
|
|||||||
@@ -1,15 +1,26 @@
|
|||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
# CLI-only changes are covered by cli.yml; skip the full app suite for them.
|
# CLI-only changes are covered by cli.yml; skip the full app suite for them.
|
||||||
|
# Docs/agent-rules/issue-template changes also skip the suite.
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- "packages/wwv-cli/**"
|
- "packages/wwv-cli/**"
|
||||||
|
- ".agents/**"
|
||||||
|
- "**/*.md"
|
||||||
|
- ".github/ISSUE_TEMPLATE/**"
|
||||||
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
||||||
|
- ".github/gc/**"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- "packages/wwv-cli/**"
|
- "packages/wwv-cli/**"
|
||||||
|
- ".agents/**"
|
||||||
|
- "**/*.md"
|
||||||
|
- ".github/ISSUE_TEMPLATE/**"
|
||||||
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
||||||
|
- ".github/gc/**"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Non-blocking dependency audit. Surfaces high / critical vulnerabilities
|
# Non-blocking dependency audit. Surfaces high / critical vulnerabilities
|
||||||
|
|||||||
@@ -1,15 +1,33 @@
|
|||||||
name: Docker Image CI
|
name: Docker Image CI
|
||||||
|
|
||||||
# CLI-only changes are covered by cli.yml; skip the image build for them.
|
# Only rebuild the image when files that affect the final container change.
|
||||||
|
# Doc/agent-rules/test-only changes skip the expensive multi-stage build.
|
||||||
|
# Skipped workflow runs satisfy GitHub required status checks (neutral pass).
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
paths-ignore:
|
paths:
|
||||||
- "packages/wwv-cli/**"
|
- "src/**"
|
||||||
|
- "prisma/**"
|
||||||
|
- "packages/**"
|
||||||
|
- "scripts/**"
|
||||||
|
- "Dockerfile"
|
||||||
|
- "package.json"
|
||||||
|
- "pnpm-lock.yaml"
|
||||||
|
- "next.config.ts"
|
||||||
|
- ".github/workflows/docker-publish.yml"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
paths-ignore:
|
paths:
|
||||||
- "packages/wwv-cli/**"
|
- "src/**"
|
||||||
|
- "prisma/**"
|
||||||
|
- "packages/**"
|
||||||
|
- "scripts/**"
|
||||||
|
- "Dockerfile"
|
||||||
|
- "package.json"
|
||||||
|
- "pnpm-lock.yaml"
|
||||||
|
- "next.config.ts"
|
||||||
|
- ".github/workflows/docker-publish.yml"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: ghcr.io
|
||||||
|
|||||||
@@ -1,14 +1,32 @@
|
|||||||
name: Playwright Tests
|
name: Playwright Tests
|
||||||
# CLI-only changes are covered by cli.yml; skip browser E2E for them.
|
# Only run E2E tests when application code actually changes.
|
||||||
|
# Doc/agent-rules/config-only changes skip the full 3-browser matrix.
|
||||||
|
# Skipped workflow runs satisfy GitHub required status checks (neutral pass).
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main, master ]
|
branches: [ main, master ]
|
||||||
paths-ignore:
|
paths:
|
||||||
- "packages/wwv-cli/**"
|
- "src/**"
|
||||||
|
- "tests/**"
|
||||||
|
- "prisma/**"
|
||||||
|
- "public/**"
|
||||||
|
- "package.json"
|
||||||
|
- "pnpm-lock.yaml"
|
||||||
|
- "next.config.ts"
|
||||||
|
- "playwright.config.ts"
|
||||||
|
- ".github/workflows/playwright.yml"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main, master ]
|
branches: [ main, master ]
|
||||||
paths-ignore:
|
paths:
|
||||||
- "packages/wwv-cli/**"
|
- "src/**"
|
||||||
|
- "tests/**"
|
||||||
|
- "prisma/**"
|
||||||
|
- "public/**"
|
||||||
|
- "package.json"
|
||||||
|
- "pnpm-lock.yaml"
|
||||||
|
- "next.config.ts"
|
||||||
|
- "playwright.config.ts"
|
||||||
|
- ".github/workflows/playwright.yml"
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
+1
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "worldwideview",
|
"name": "worldwideview",
|
||||||
"version": "2.24.5",
|
"version": "2.25.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"packageManager": "[email protected]",
|
"packageManager": "[email protected]",
|
||||||
@@ -120,4 +120,3 @@
|
|||||||
"pnpm": ">=9.0.0"
|
"pnpm": ">=9.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,6 +52,38 @@ export class MyPlugin implements WorldPlugin {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Property Tag Helpers
|
||||||
|
|
||||||
|
Wrap entity property values with these helpers so the WorldWideView Intel panel renders them as rich UI elements instead of plain text.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import { dtProp, urlProp, imageProp, videoProp } from "@worldwideview/wwv-plugin-sdk";
|
||||||
|
```
|
||||||
|
|
||||||
|
| Helper | Wraps | Panel renders as |
|
||||||
|
|---|---|---|
|
||||||
|
| `dtProp(iso: string \| null)` | ISO 8601 date string | Expandable datetime row — local time collapsed, UTC + relative time expanded |
|
||||||
|
| `urlProp(href: string \| null)` | Any URL | Clickable link with external-link icon |
|
||||||
|
| `imageProp(src: string \| null)` | Image URL | Inline thumbnail |
|
||||||
|
| `videoProp(href: string \| null)` | Video/stream URL | "Watch" link with play icon |
|
||||||
|
|
||||||
|
All helpers are **null-safe**: passing `null`, `undefined`, or `""` returns `null`, which the panel skips cleanly.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// In your entity mapper:
|
||||||
|
properties: {
|
||||||
|
last_seen: dtProp(item.timestamp ?? null),
|
||||||
|
source_url: urlProp(item.url ?? null),
|
||||||
|
preview: imageProp(item.image_url ?? null),
|
||||||
|
live_stream: videoProp(item.stream ?? null),
|
||||||
|
// Plain values need no wrapper
|
||||||
|
name: item.name,
|
||||||
|
severity: item.severity,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Values without a tag prefix fall back to plain-text rendering, so existing plugins continue to work unchanged.
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
- **v1.0.3** — Added README with core interfaces and usage docs.
|
- **v1.0.3** — Added README with core interfaces and usage docs.
|
||||||
|
|||||||
@@ -313,3 +313,45 @@ export * from "./viteGlobals";
|
|||||||
|
|
||||||
// ─── Auth Contracts ──────────────────────────────────────────
|
// ─── Auth Contracts ──────────────────────────────────────────
|
||||||
export * from "./auth-contracts";
|
export * from "./auth-contracts";
|
||||||
|
|
||||||
|
// ─── Tagged Property Helpers ─────────────────────────────────
|
||||||
|
/**
|
||||||
|
* Wraps an ISO 8601 date string for rich rendering in the Intel panel.
|
||||||
|
* The panel displays local time (collapsed) and UTC + relative time (expanded).
|
||||||
|
* @param iso - ISO 8601 string (e.g. "2026-06-01T05:00:00Z"), or null/undefined
|
||||||
|
* @returns Tagged string `"datetime:{iso}"`, or `null` if input is empty
|
||||||
|
*/
|
||||||
|
export function dtProp(iso: string | undefined | null): string | null {
|
||||||
|
if (!iso) return null;
|
||||||
|
return `datetime:${iso}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps a URL for rich rendering in the Intel panel as a clickable external link.
|
||||||
|
* @param href - Any URL string, or null/undefined
|
||||||
|
* @returns Tagged string `"url:{href}"`, or `null` if input is empty
|
||||||
|
*/
|
||||||
|
export function urlProp(href: string | undefined | null): string | null {
|
||||||
|
if (!href) return null;
|
||||||
|
return `url:${href}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps an image URL for rich rendering in the Intel panel as an inline thumbnail.
|
||||||
|
* @param src - Image URL string, or null/undefined
|
||||||
|
* @returns Tagged string `"image:{src}"`, or `null` if input is empty
|
||||||
|
*/
|
||||||
|
export function imageProp(src: string | undefined | null): string | null {
|
||||||
|
if (!src) return null;
|
||||||
|
return `image:${src}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps a video or stream URL for rich rendering in the Intel panel as a "Watch" link.
|
||||||
|
* @param href - Video or stream URL string, or null/undefined
|
||||||
|
* @returns Tagged string `"video:{href}"`, or `null` if input is empty
|
||||||
|
*/
|
||||||
|
export function videoProp(href: string | undefined | null): string | null {
|
||||||
|
if (!href) return null;
|
||||||
|
return `video:${href}`;
|
||||||
|
}
|
||||||
Generated
+1149
File diff suppressed because it is too large.
Load diff
@@ -38,8 +38,9 @@ export function PluginIcon({ icon, size = 18, color }: PluginIconProps) {
|
|||||||
if (typeof icon === "string") {
|
if (typeof icon === "string") {
|
||||||
const Resolved = icons[icon as keyof typeof icons] as LucideIcon | undefined;
|
const Resolved = icons[icon as keyof typeof icons] as LucideIcon | undefined;
|
||||||
if (Resolved) return <Resolved size={size} color={color} />;
|
if (Resolved) return <Resolved size={size} color={color} />;
|
||||||
// Treat as emoji or text fallback
|
// Emoji: render as text. Unresolved ASCII icon name: render fallback so stale names don't leak as text.
|
||||||
return <span>{icon}</span>;
|
if (/[^\x00-\x7F]/.test(icon)) return <span>{icon}</span>;
|
||||||
|
return <FallbackIcon size={size} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const IconComponent = icon;
|
const IconComponent = icon;
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import { FeedbackDialog } from "@/components/common/FeedbackDialog";
|
|||||||
import { isDemo } from "@/core/edition";
|
import { isDemo } from "@/core/edition";
|
||||||
|
|
||||||
import { injectHostGlobals } from "@/core/plugins/hostGlobals";
|
import { injectHostGlobals } from "@/core/plugins/hostGlobals";
|
||||||
|
import { getDisabledPluginIds } from "@/core/plugins/pluginPreferences";
|
||||||
import { initLogCatcher } from "@/lib/logCatcher";
|
import { initLogCatcher } from "@/lib/logCatcher";
|
||||||
import { MobileCameraStats } from "./MobileCameraStats";
|
import { MobileCameraStats } from "./MobileCameraStats";
|
||||||
import { MobileHudBar } from "./MobileHudBar";
|
import { MobileHudBar } from "./MobileHudBar";
|
||||||
@@ -88,17 +89,7 @@ export function AppShell() {
|
|||||||
await injectHostGlobals();
|
await injectHostGlobals();
|
||||||
setHostReady(true);
|
setHostReady(true);
|
||||||
|
|
||||||
// Fetch disabled built-in plugins before registration
|
const disabledIds = getDisabledPluginIds();
|
||||||
let disabledIds = new Set<string>();
|
|
||||||
try {
|
|
||||||
const res = await fetch("/api/marketplace/disabled-builtins");
|
|
||||||
if (res.ok) {
|
|
||||||
const data = await res.json();
|
|
||||||
disabledIds = new Set<string>(data.disabledIds ?? []);
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
// Non-critical — load all built-ins if endpoint fails
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup demo defaults
|
// Setup demo defaults
|
||||||
const demoDefaultPlugins = new Set<string>();
|
const demoDefaultPlugins = new Set<string>();
|
||||||
|
|||||||
@@ -74,6 +74,19 @@
|
|||||||
margin-top: 3px;
|
margin-top: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ─── Local Icon ─────────────────────────────────── */
|
||||||
|
.layer-item__local-icon-wrapper {
|
||||||
|
position: relative;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layer-item__local-icon {
|
||||||
|
color: var(--accent-cyan);
|
||||||
|
flex-shrink: 0;
|
||||||
|
cursor: help;
|
||||||
|
}
|
||||||
|
|
||||||
/* ─── Unverified Icon ────────────────────────────── */
|
/* ─── Unverified Icon ────────────────────────────── */
|
||||||
.layer-item__unverified-icon-wrapper {
|
.layer-item__unverified-icon-wrapper {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @module src/components/panels
|
* @module src/components/panels
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ShieldAlert } from "lucide-react";
|
import { ShieldAlert, Wrench } from "lucide-react";
|
||||||
import { PluginIcon } from "@/components/common/PluginIcon";
|
import { PluginIcon } from "@/components/common/PluginIcon";
|
||||||
import { Tooltip } from "@/components/ui/Tooltip";
|
import { Tooltip } from "@/components/ui/Tooltip";
|
||||||
import { pluginManager } from "@/core/plugins/PluginManager";
|
import { pluginManager } from "@/core/plugins/PluginManager";
|
||||||
@@ -27,29 +27,46 @@ const CATEGORY_LABELS: Record<string, string> = {
|
|||||||
custom: "Custom",
|
custom: "Custom",
|
||||||
};
|
};
|
||||||
|
|
||||||
// ─── Trust Helpers ──────────────────────────────────────────
|
// ─── Source / Trust Helpers ─────────────────────────────────
|
||||||
|
|
||||||
type TrustTier = "built-in" | "verified" | "unverified";
|
function isLocalPlugin(pluginId: string): boolean {
|
||||||
|
|
||||||
function getTrust(pluginId: string): TrustTier {
|
|
||||||
const manifest = pluginManager.getManifest(pluginId);
|
const manifest = pluginManager.getManifest(pluginId);
|
||||||
return manifest?.trust ?? "unverified";
|
if (!manifest) return true;
|
||||||
|
const entry = manifest.entry ?? "";
|
||||||
|
return entry.startsWith("/plugins-local/") || entry.startsWith("http://localhost") || entry.startsWith("http://127.0.0.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
function TrustIcon({ trust }: { trust: TrustTier }) {
|
function TrustIcon({ pluginId, pluginName }: { pluginId: string; pluginName: string }) {
|
||||||
if (trust !== "unverified") return null;
|
if (isLocalPlugin(pluginId)) {
|
||||||
|
return (
|
||||||
|
<Tooltip content={`Local plugin: ${pluginName}`}>
|
||||||
|
<span className="layer-item__local-icon-wrapper">
|
||||||
|
<Wrench
|
||||||
|
size={11}
|
||||||
|
className="layer-item__local-icon"
|
||||||
|
aria-label="Local plugin"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
const manifest = pluginManager.getManifest(pluginId);
|
||||||
<Tooltip content="Unverified plugin, use at your own risk">
|
if (manifest?.trust === "unverified") {
|
||||||
<span className="layer-item__unverified-icon-wrapper">
|
return (
|
||||||
<ShieldAlert
|
<Tooltip content="Unverified plugin, use at your own risk">
|
||||||
size={12}
|
<span className="layer-item__unverified-icon-wrapper">
|
||||||
className="layer-item__unverified-icon"
|
<ShieldAlert
|
||||||
aria-label="Unverified plugin"
|
size={12}
|
||||||
/>
|
className="layer-item__unverified-icon"
|
||||||
</span>
|
aria-label="Unverified plugin"
|
||||||
</Tooltip>
|
/>
|
||||||
);
|
</span>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── LayerItem Component ────────────────────────────────────
|
// ─── LayerItem Component ────────────────────────────────────
|
||||||
@@ -88,8 +105,6 @@ export function LayerItem({
|
|||||||
onToggle,
|
onToggle,
|
||||||
onSelect,
|
onSelect,
|
||||||
}: LayerItemProps) {
|
}: LayerItemProps) {
|
||||||
const trust = getTrust(plugin.id);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`layer-item ${isSelected ? "layer-item--selected" : ""}`}
|
className={`layer-item ${isSelected ? "layer-item--selected" : ""}`}
|
||||||
@@ -102,7 +117,7 @@ export function LayerItem({
|
|||||||
<div className="layer-item__info">
|
<div className="layer-item__info">
|
||||||
<div className="layer-item__header">
|
<div className="layer-item__header">
|
||||||
<span className="layer-item__name">{plugin.name}</span>
|
<span className="layer-item__name">{plugin.name}</span>
|
||||||
<TrustIcon trust={trust} />
|
<TrustIcon pluginId={plugin.id} pluginName={plugin.name} />
|
||||||
</div>
|
</div>
|
||||||
<div className="layer-item__desc">{plugin.description}</div>
|
<div className="layer-item__desc">{plugin.description}</div>
|
||||||
<div className="layer-item__footer">
|
<div className="layer-item__footer">
|
||||||
|
|||||||
@@ -69,6 +69,7 @@
|
|||||||
.plugin-item__header {
|
.plugin-item__header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
margin-bottom: 1px;
|
margin-bottom: 1px;
|
||||||
}
|
}
|
||||||
@@ -77,9 +78,7 @@
|
|||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
white-space: nowrap;
|
word-break: break-word;
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.plugin-item__version {
|
.plugin-item__version {
|
||||||
@@ -184,6 +183,7 @@
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
text-align: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all var(--duration-normal) var(--ease-spring);
|
transition: all var(--duration-normal) var(--ease-spring);
|
||||||
flex-shrink: 0%;
|
flex-shrink: 0%;
|
||||||
|
|||||||
@@ -11,12 +11,16 @@
|
|||||||
import { useState, useEffect, useCallback } from "react";
|
import { useState, useEffect, useCallback } from "react";
|
||||||
import {
|
import {
|
||||||
Trash2, ExternalLink, RefreshCw, Download, PowerOff, Power,
|
Trash2, ExternalLink, RefreshCw, Download, PowerOff, Power,
|
||||||
ShieldCheck, ShieldAlert, Shield
|
ShieldCheck, ShieldAlert, HardDrive
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { PluginIcon } from "@/components/common/PluginIcon";
|
import { PluginIcon } from "@/components/common/PluginIcon";
|
||||||
|
import type { ComponentType } from "react";
|
||||||
import { pluginManager } from "@/core/plugins/PluginManager";
|
import { pluginManager } from "@/core/plugins/PluginManager";
|
||||||
|
import { useStore } from "@/core/state/store";
|
||||||
|
import { getDisabledPluginIds, setPluginDisabled } from "@/core/plugins/pluginPreferences";
|
||||||
import { trackEvent } from "@/lib/analytics";
|
import { trackEvent } from "@/lib/analytics";
|
||||||
import { isPluginInstallEnabled } from "@/core/edition";
|
import { isPluginInstallEnabled } from "@/core/edition";
|
||||||
|
import type { PluginManifest } from "@/core/plugins/PluginManifest";
|
||||||
import "./PluginsTab.css";
|
import "./PluginsTab.css";
|
||||||
|
|
||||||
// ─── Types ──────────────────────────────────────────────────
|
// ─── Types ──────────────────────────────────────────────────
|
||||||
@@ -35,9 +39,9 @@ function TrustBadge({ trust }: { trust: string }) {
|
|||||||
if (trust === "built-in") {
|
if (trust === "built-in") {
|
||||||
return (
|
return (
|
||||||
<span className="trust-badge trust-badge--builtin">
|
<span className="trust-badge trust-badge--builtin">
|
||||||
<Shield size={9} />
|
<HardDrive size={9} />
|
||||||
{' '}
|
{' '}
|
||||||
Built-in
|
Local
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -96,13 +100,9 @@ function getTrust(record: PluginRecord): string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getIcon(record: PluginRecord): string {
|
function getIcon(record: PluginRecord): string | ComponentType<{ size?: number; color?: string }> {
|
||||||
const managed = pluginManager.getPlugin(record.pluginId);
|
const managed = pluginManager.getPlugin(record.pluginId);
|
||||||
if (managed) {
|
if (managed) return managed.plugin.icon ?? "📦";
|
||||||
return typeof managed.plugin.icon === "string"
|
|
||||||
? managed.plugin.icon
|
|
||||||
: "📦";
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
return JSON.parse(record.config).icon ?? "📦";
|
return JSON.parse(record.config).icon ?? "📦";
|
||||||
} catch {
|
} catch {
|
||||||
@@ -120,6 +120,11 @@ function getName(record: PluginRecord): string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getVersion(record: PluginRecord): string {
|
||||||
|
if (record.version !== "built-in") return record.version;
|
||||||
|
return pluginManager.getManifest(record.pluginId)?.version ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
// ─── PluginsTab ─────────────────────────────────────────────
|
// ─── PluginsTab ─────────────────────────────────────────────
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -145,7 +150,8 @@ export function PluginsTab() {
|
|||||||
const dbPlugins: PluginRecord[] = data.plugins ?? [];
|
const dbPlugins: PluginRecord[] = data.plugins ?? [];
|
||||||
const dbPluginMap = new Map(dbPlugins.map((p) => [p.pluginId, p]));
|
const dbPluginMap = new Map(dbPlugins.map((p) => [p.pluginId, p]));
|
||||||
|
|
||||||
// Add built-in and local plugins that don't have a DB record yet (enabled by default)
|
// Add built-in and local plugins that don't have a DB record yet
|
||||||
|
const disabledIds = getDisabledPluginIds();
|
||||||
const allManaged = pluginManager.getAllPlugins();
|
const allManaged = pluginManager.getAllPlugins();
|
||||||
for (const managed of allManaged) {
|
for (const managed of allManaged) {
|
||||||
if (!dbPluginMap.has(managed.plugin.id)) {
|
if (!dbPluginMap.has(managed.plugin.id)) {
|
||||||
@@ -154,11 +160,16 @@ export function PluginsTab() {
|
|||||||
version: "built-in",
|
version: "built-in",
|
||||||
config: "{}",
|
config: "{}",
|
||||||
installedAt: new Date().toISOString(),
|
installedAt: new Date().toISOString(),
|
||||||
enabled: true
|
enabled: !disabledIds.has(managed.plugin.id)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Apply localStorage disabled state to all records
|
||||||
|
dbPlugins.forEach((p) => {
|
||||||
|
if (disabledIds.has(p.pluginId)) p.enabled = false;
|
||||||
|
});
|
||||||
|
|
||||||
setPlugins(dbPlugins);
|
setPlugins(dbPlugins);
|
||||||
if (typeof data.canManagePlugins === "boolean") {
|
if (typeof data.canManagePlugins === "boolean") {
|
||||||
setCanInstall(data.canManagePlugins);
|
setCanInstall(data.canManagePlugins);
|
||||||
@@ -192,32 +203,48 @@ export function PluginsTab() {
|
|||||||
|
|
||||||
const handleDisable = async (pluginId: string) => {
|
const handleDisable = async (pluginId: string) => {
|
||||||
setRemoving(pluginId);
|
setRemoving(pluginId);
|
||||||
try {
|
setPluginDisabled(pluginId, true);
|
||||||
await fetch("/api/marketplace/disable", {
|
pluginManager.disablePlugin(pluginId);
|
||||||
method: "POST",
|
const state = useStore.getState();
|
||||||
headers: { "Content-Type": "application/json" },
|
state.setLayerEnabled(pluginId, false);
|
||||||
body: JSON.stringify({ pluginId }),
|
state.clearEntities(pluginId);
|
||||||
});
|
state.setEntityCount(pluginId, 0);
|
||||||
trackEvent("plugin-disable", { plugin: pluginId });
|
if (state.hoveredEntity?.pluginId === pluginId) state.setHoveredEntity(null, null);
|
||||||
setNeedsReload(true);
|
if (state.selectedEntity?.pluginId === pluginId) state.setSelectedEntity(null);
|
||||||
} catch {
|
setNeedsReload(true);
|
||||||
setRemoving(null);
|
trackEvent("plugin-disable", { plugin: pluginId });
|
||||||
}
|
await loadPlugins();
|
||||||
|
setRemoving(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleEnable = async (pluginId: string) => {
|
const handleEnable = async (pluginId: string) => {
|
||||||
setRemoving(pluginId);
|
setRemoving(pluginId);
|
||||||
try {
|
setPluginDisabled(pluginId, false);
|
||||||
await fetch("/api/marketplace/enable", {
|
setNeedsReload(false);
|
||||||
method: "POST",
|
|
||||||
headers: { "Content-Type": "application/json" },
|
const alreadyRegistered = pluginManager.getPlugin(pluginId);
|
||||||
body: JSON.stringify({ pluginId }),
|
if (!alreadyRegistered) {
|
||||||
});
|
// Plugin was disabled at startup — its script was never loaded.
|
||||||
trackEvent("plugin-enable", { plugin: pluginId });
|
// Hot-load the script so it's available; leave the layer toggle off.
|
||||||
setNeedsReload(true);
|
try {
|
||||||
} catch {
|
const res = await fetch("/api/marketplace/load");
|
||||||
setRemoving(null);
|
if (res.ok) {
|
||||||
|
const { manifests } = await res.json() as { manifests: PluginManifest[] };
|
||||||
|
const manifest = manifests.find((m) => m.id === pluginId);
|
||||||
|
if (manifest) {
|
||||||
|
await pluginManager.loadFromManifest(manifest);
|
||||||
|
useStore.getState().initLayer(pluginId, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error("[PluginsTab] Failed to hot-load plugin:", pluginId, err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// Layer stays off — user controls it via the Data Layers toggle.
|
||||||
|
|
||||||
|
trackEvent("plugin-enable", { plugin: pluginId });
|
||||||
|
await loadPlugins();
|
||||||
|
setRemoving(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCheckUpdates = async () => {
|
const handleCheckUpdates = async () => {
|
||||||
@@ -352,10 +379,12 @@ export function PluginsTab() {
|
|||||||
<span className="plugin-item__name">
|
<span className="plugin-item__name">
|
||||||
{getName(record)}
|
{getName(record)}
|
||||||
</span>
|
</span>
|
||||||
|
{getVersion(record) && (
|
||||||
<span className="plugin-item__version">
|
<span className="plugin-item__version">
|
||||||
v
|
v
|
||||||
{record.version}
|
{getVersion(record)}
|
||||||
</span>
|
</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="plugin-item__meta">
|
<div className="plugin-item__meta">
|
||||||
<TrustBadge trust={getTrust(record)} />
|
<TrustBadge trust={getTrust(record)} />
|
||||||
@@ -415,10 +444,12 @@ export function PluginsTab() {
|
|||||||
<span className="plugin-item__name">
|
<span className="plugin-item__name">
|
||||||
{getName(record)}
|
{getName(record)}
|
||||||
</span>
|
</span>
|
||||||
|
{getVersion(record) && (
|
||||||
<span className="plugin-item__version">
|
<span className="plugin-item__version">
|
||||||
v
|
v
|
||||||
{record.version}
|
{getVersion(record)}
|
||||||
</span>
|
</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="plugin-item__meta">
|
<div className="plugin-item__meta">
|
||||||
<TrustBadge trust={getTrust(record)} />
|
<TrustBadge trust={getTrust(record)} />
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
import { useState } from "react";
|
||||||
|
import { IntelPropertyRow } from "./IntelPropertyRow";
|
||||||
|
|
||||||
|
function formatLocal(iso: string): string {
|
||||||
|
return new Date(iso).toLocaleString(undefined, {
|
||||||
|
day: "numeric", month: "2-digit", year: "numeric",
|
||||||
|
hour: "numeric", minute: "2-digit", hour12: true, timeZoneName: "short",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatUtc(iso: string): string {
|
||||||
|
return new Date(iso).toISOString().slice(0, 16).replace("T", " ") + " UTC";
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatRelative(iso: string): string {
|
||||||
|
const diff = new Date(iso).getTime() - Date.now();
|
||||||
|
const abs = Math.abs(diff);
|
||||||
|
const future = diff > 0;
|
||||||
|
if (abs < 60_000) return "just now";
|
||||||
|
if (abs < 3_600_000) {
|
||||||
|
const n = Math.round(abs / 60_000);
|
||||||
|
return future ? `in ${n}m` : `${n}m ago`;
|
||||||
|
}
|
||||||
|
if (abs < 86_400_000) {
|
||||||
|
const n = Math.round(abs / 3_600_000);
|
||||||
|
return future ? `in ${n}h` : `${n}h ago`;
|
||||||
|
}
|
||||||
|
const n = Math.round(abs / 86_400_000);
|
||||||
|
return future ? `in ${n}d` : `${n}d ago`;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DatetimePropertyRowProps {
|
||||||
|
label: string;
|
||||||
|
iso: string;
|
||||||
|
classNamePrefix?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function DatetimePropertyRow({ label, iso, classNamePrefix = "intel-panel" }: DatetimePropertyRowProps) {
|
||||||
|
const [expanded, setExpanded] = useState(false);
|
||||||
|
|
||||||
|
if (expanded) {
|
||||||
|
return (
|
||||||
|
<IntelPropertyRow label={label} isColumn classNamePrefix={classNamePrefix}>
|
||||||
|
<span
|
||||||
|
style={{ cursor: "pointer", fontWeight: 600 }}
|
||||||
|
onClick={() => setExpanded(false)}
|
||||||
|
>
|
||||||
|
{formatLocal(iso)}
|
||||||
|
</span>
|
||||||
|
<span style={{ opacity: 0.6, fontSize: "0.85em" }}>{formatUtc(iso)}</span>
|
||||||
|
<span style={{ opacity: 0.6, fontSize: "0.85em" }}>{formatRelative(iso)}</span>
|
||||||
|
</IntelPropertyRow>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<IntelPropertyRow label={label} classNamePrefix={classNamePrefix}>
|
||||||
|
<span
|
||||||
|
style={{ cursor: "pointer", textDecoration: "underline dotted" }}
|
||||||
|
onClick={() => setExpanded(true)}
|
||||||
|
>
|
||||||
|
{formatLocal(iso)}
|
||||||
|
</span>
|
||||||
|
</IntelPropertyRow>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -11,6 +11,8 @@ import { ImageProperty } from './ImageProperty';
|
|||||||
import { UrlProperty } from './UrlProperty';
|
import { UrlProperty } from './UrlProperty';
|
||||||
import { LongTextProperty } from './LongTextProperty';
|
import { LongTextProperty } from './LongTextProperty';
|
||||||
import { IntelPropertyRow } from './IntelPropertyRow';
|
import { IntelPropertyRow } from './IntelPropertyRow';
|
||||||
|
import { DatetimePropertyRow } from "./DatetimePropertyRow";
|
||||||
|
import { VideoProperty } from "./VideoProperty";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @interface DynamicPropertiesRenderProps
|
* @interface DynamicPropertiesRenderProps
|
||||||
@@ -37,6 +39,52 @@ export function DynamicPropertiesRender({ entity, classNamePrefix = "intel-panel
|
|||||||
const label = key.replace(/_/g, " ");
|
const label = key.replace(/_/g, " ");
|
||||||
const stringValue = String(value);
|
const stringValue = String(value);
|
||||||
|
|
||||||
|
// Tagged dispatch - explicit type prefix, checked before heuristics
|
||||||
|
if (typeof value === "string") {
|
||||||
|
if (value.startsWith("datetime:")) {
|
||||||
|
return (
|
||||||
|
<DatetimePropertyRow
|
||||||
|
key={key}
|
||||||
|
label={label}
|
||||||
|
iso={value.slice(9)}
|
||||||
|
classNamePrefix={classNamePrefix}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (value.startsWith("url:")) {
|
||||||
|
return (
|
||||||
|
<UrlProperty
|
||||||
|
key={key}
|
||||||
|
label={label}
|
||||||
|
url={value.slice(4)}
|
||||||
|
classNamePrefix={classNamePrefix}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (value.startsWith("image:")) {
|
||||||
|
return (
|
||||||
|
<ImageProperty
|
||||||
|
key={key}
|
||||||
|
label={label}
|
||||||
|
imageUrl={value.slice(6)}
|
||||||
|
entityId={entity.id}
|
||||||
|
entityLabel={entity.label ?? ""}
|
||||||
|
classNamePrefix={classNamePrefix}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (value.startsWith("video:")) {
|
||||||
|
return (
|
||||||
|
<VideoProperty
|
||||||
|
key={key}
|
||||||
|
label={label}
|
||||||
|
href={value.slice(6)}
|
||||||
|
classNamePrefix={classNamePrefix}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Identify property type
|
// Identify property type
|
||||||
const isImage = typeof value === "string" && key.toLowerCase().includes("image") && /^https?:\/\//i.test(value);
|
const isImage = typeof value === "string" && key.toLowerCase().includes("image") && /^https?:\/\//i.test(value);
|
||||||
const isUrl = !isImage && typeof value === "string" && /^https?:\/\//i.test(value);
|
const isUrl = !isImage && typeof value === "string" && /^https?:\/\//i.test(value);
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { PlayCircle } from "lucide-react";
|
||||||
|
import { IntelPropertyRow } from "./IntelPropertyRow";
|
||||||
|
|
||||||
|
interface VideoPropertyProps {
|
||||||
|
label: string;
|
||||||
|
href: string;
|
||||||
|
classNamePrefix?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function VideoProperty({ label, href, classNamePrefix = "intel-panel" }: VideoPropertyProps) {
|
||||||
|
return (
|
||||||
|
<IntelPropertyRow label={label} classNamePrefix={classNamePrefix}>
|
||||||
|
<a
|
||||||
|
href={href}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
style={{ display: "flex", alignItems: "center", gap: 4, color: "var(--accent-cyan)" }}
|
||||||
|
>
|
||||||
|
<PlayCircle size={14} />
|
||||||
|
Watch
|
||||||
|
</a>
|
||||||
|
</IntelPropertyRow>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
getApprovedUnverifiedIds,
|
getApprovedUnverifiedIds,
|
||||||
approveUnverifiedPlugin,
|
approveUnverifiedPlugin,
|
||||||
} from "@/lib/marketplace/trustedPlugins";
|
} from "@/lib/marketplace/trustedPlugins";
|
||||||
|
import { getDisabledPluginIds } from "@/core/plugins/pluginPreferences";
|
||||||
import { isDemo } from "@/core/edition";
|
import { isDemo } from "@/core/edition";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,6 +67,7 @@ export function useMarketplaceSync(hostReady: boolean) {
|
|||||||
|
|
||||||
async function loadManifest(manifest: PluginManifest) {
|
async function loadManifest(manifest: PluginManifest) {
|
||||||
if (!manifest.id || loadedIds.current.has(manifest.id)) return;
|
if (!manifest.id || loadedIds.current.has(manifest.id)) return;
|
||||||
|
if (getDisabledPluginIds().has(manifest.id)) return;
|
||||||
if (pluginManager.getPlugin(manifest.id)) {
|
if (pluginManager.getPlugin(manifest.id)) {
|
||||||
loadedIds.current.add(manifest.id);
|
loadedIds.current.add(manifest.id);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
const DISABLED_KEY = "wwv-disabled-plugins";
|
||||||
|
|
||||||
|
export function getDisabledPluginIds(): Set<string> {
|
||||||
|
try {
|
||||||
|
const raw = localStorage.getItem(DISABLED_KEY);
|
||||||
|
if (!raw) return new Set();
|
||||||
|
return new Set<string>(JSON.parse(raw));
|
||||||
|
} catch {
|
||||||
|
return new Set();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setPluginDisabled(pluginId: string, disabled: boolean): void {
|
||||||
|
try {
|
||||||
|
const ids = getDisabledPluginIds();
|
||||||
|
if (disabled) {
|
||||||
|
ids.add(pluginId);
|
||||||
|
} else {
|
||||||
|
ids.delete(pluginId);
|
||||||
|
}
|
||||||
|
localStorage.setItem(DISABLED_KEY, JSON.stringify([...ids]));
|
||||||
|
} catch {
|
||||||
|
// ignore storage errors
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,28 +24,36 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.geojson-btn--primary {
|
.geojson-btn--primary {
|
||||||
background: linear-gradient(135deg, #00e5ff 0%, #00b0ff 100%);
|
background: var(--bg-glass);
|
||||||
color: #0a0e17;
|
color: var(--text-primary);
|
||||||
|
border: 1px solid rgba(var(--accent-rgb), 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.geojson-btn--primary:hover:not(:disabled) {
|
.geojson-btn--primary:hover:not(:disabled) {
|
||||||
box-shadow: 0 0 16px rgba(0, 229, 255, 0.4);
|
background: var(--bg-glass-hover);
|
||||||
|
box-shadow: var(--glass-shadow-inner);
|
||||||
transform: translateY(-1px);
|
transform: translateY(-1px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.geojson-btn--primary:active:not(:disabled) {
|
||||||
|
transform: scale(0.98);
|
||||||
|
}
|
||||||
|
|
||||||
.geojson-btn--primary:disabled {
|
.geojson-btn--primary:disabled {
|
||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
|
transform: none;
|
||||||
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.geojson-btn--secondary {
|
.geojson-btn--secondary {
|
||||||
background: rgba(255, 255, 255, 0.08);
|
background: var(--bg-glass);
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
border: 1px solid var(--glass-border-inner);
|
||||||
}
|
}
|
||||||
|
|
||||||
.geojson-btn--secondary:hover:not(:disabled) {
|
.geojson-btn--secondary:hover:not(:disabled) {
|
||||||
background: rgba(255, 255, 255, 0.14);
|
background: var(--bg-glass-hover);
|
||||||
}
|
}
|
||||||
|
|
||||||
.geojson-btn--secondary:disabled {
|
.geojson-btn--secondary:disabled {
|
||||||
@@ -87,7 +95,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 16px 20px;
|
padding: 16px 20px;
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
|
border-bottom: 1px solid var(--glass-border-inner);
|
||||||
}
|
}
|
||||||
|
|
||||||
.geojson-modal__header h3 {
|
.geojson-modal__header h3 {
|
||||||
@@ -117,7 +125,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
padding: 12px 20px;
|
padding: 12px 20px;
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
border-bottom: 1px solid var(--glass-border-inner);
|
||||||
}
|
}
|
||||||
|
|
||||||
.geojson-tab {
|
.geojson-tab {
|
||||||
@@ -136,13 +144,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.geojson-tab:hover {
|
.geojson-tab:hover {
|
||||||
background: rgba(255, 255, 255, 0.06);
|
background: rgba(var(--accent-rgb), 0.06);
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.geojson-tab--active {
|
.geojson-tab--active {
|
||||||
background: rgba(0, 229, 255, 0.12);
|
background: rgba(var(--accent-rgb), 0.12);
|
||||||
color: #00e5ff;
|
color: var(--accent-cyan);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ─── Body ────────────────────────────────────────────────── */
|
/* ─── Body ────────────────────────────────────────────────── */
|
||||||
@@ -163,7 +171,7 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
padding: 32px 20px;
|
padding: 32px 20px;
|
||||||
border: 2px dashed rgba(255, 255, 255, 0.15);
|
border: 2px dashed rgba(var(--accent-rgb), 0.2);
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -173,9 +181,9 @@
|
|||||||
|
|
||||||
.geojson-dropzone:hover,
|
.geojson-dropzone:hover,
|
||||||
.geojson-dropzone--active {
|
.geojson-dropzone--active {
|
||||||
border-color: #00e5ff;
|
border-color: var(--accent-cyan);
|
||||||
background: rgba(0, 229, 255, 0.04);
|
background: rgba(var(--accent-rgb), 0.04);
|
||||||
color: #00e5ff;
|
color: var(--accent-cyan);
|
||||||
}
|
}
|
||||||
|
|
||||||
.geojson-dropzone p {
|
.geojson-dropzone p {
|
||||||
@@ -194,9 +202,9 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 140px;
|
min-height: 140px;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
border: 1px solid var(--glass-border-inner);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
background: rgba(0, 0, 0, 0.3);
|
background: var(--bg-secondary);
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
font-family: "JetBrains Mono", "Fira Code", monospace;
|
font-family: "JetBrains Mono", "Fira Code", monospace;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
@@ -206,7 +214,7 @@
|
|||||||
|
|
||||||
.geojson-textarea:focus {
|
.geojson-textarea:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
border-color: #00e5ff;
|
border-color: var(--accent-cyan);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ─── Inputs ──────────────────────────────────────────────── */
|
/* ─── Inputs ──────────────────────────────────────────────── */
|
||||||
@@ -214,9 +222,9 @@
|
|||||||
.geojson-input {
|
.geojson-input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 8px 12px;
|
padding: 8px 12px;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
border: 1px solid var(--glass-border-inner);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
background: rgba(0, 0, 0, 0.3);
|
background: var(--bg-secondary);
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
transition: border-color 0.2s;
|
transition: border-color 0.2s;
|
||||||
@@ -224,7 +232,7 @@
|
|||||||
|
|
||||||
.geojson-input:focus {
|
.geojson-input:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
border-color: #00e5ff;
|
border-color: var(--accent-cyan);
|
||||||
}
|
}
|
||||||
|
|
||||||
.geojson-input::placeholder {
|
.geojson-input::placeholder {
|
||||||
@@ -245,7 +253,7 @@
|
|||||||
width: 32px;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border: 2px solid rgba(255, 255, 255, 0.15);
|
border: 2px solid var(--glass-border-inner);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
background: none;
|
background: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -256,8 +264,8 @@
|
|||||||
.geojson-preview {
|
.geojson-preview {
|
||||||
padding: 10px 14px;
|
padding: 10px 14px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
background: rgba(0, 229, 255, 0.06);
|
background: rgba(var(--accent-rgb), 0.06);
|
||||||
border: 1px solid rgba(0, 229, 255, 0.15);
|
border: 1px solid rgba(var(--accent-rgb), 0.15);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
@@ -299,7 +307,7 @@
|
|||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
padding: 12px 20px;
|
padding: 12px 20px;
|
||||||
border-top: 1px solid rgba(255, 255, 255, 0.06);
|
border-top: 1px solid var(--glass-border-inner);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ─── Layer List ──────────────────────────────────────────── */
|
/* ─── Layer List ──────────────────────────────────────────── */
|
||||||
|
|||||||
Reference in new issue
Block a user