* chore(merge): resolve conflicts, fix mockWs error, and apply refactor standards * Potential fix for pull request finding 'CodeQL / Incomplete URL substring sanitization' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Potential fix for pull request finding 'CodeQL / Incomplete URL substring sanitization' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Potential fix for pull request finding 'CodeQL / Incomplete URL substring sanitization' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * fix(ci): Stabilize github actions and resolve test failures - fix(tests): update WsClient mock to use standard function for Vitest constructor compatibility - fix(db): correct PrismaClient import path to use generated output directory - fix(e2e): add predev database boot step to playwright CI workflow - chore: sync pnpm-lock.yaml after merge conflict resolution * refactor(plugins): decouple GeoJSON plugin and implement data bus lifecycle - feat(sdk): [Minor] Added dynamicPluginCreate, dynamicPluginRemove, and pluginUnregistered to DataBusEvents. - feat(core): [Minor] Implemented unregisterPlugin in PluginManager.ts for automated IndexedDB caching cleanup and polling teardown. - feat(core): [Minor] Added removeLayer to layersSlice.ts to support safe removal of plugin states. - refactor(plugins): [Patch] Refactored useGeoJsonImport.ts and ImportedLayerList.tsx to decouple from direct manager imports, utilizing DataBus for lifecycle events. - refactor(core): [Patch] Added pluginUnregistered listener to DataBusSubscriber.tsx to handle state and cache cleanup synchronously via event. * fix(types): resolve PluginManager type errors * refactor(core): decouple PluginManager and fix rendering invariants - refactor(core): Replace Zustand mutations in PluginManager with DataBus events (Patch) - refactor(sdk): Add layerLoadingChanged, pluginError, pluginUnregistered to DataBusEvents (Patch) - refactor(ui): Subscribe to new DataBus events in DataBusSubscriber (Patch) - fix(plugins): Remove size from BaseAviationPlugin to fix model rendering clipping (Patch) - fix(plugins): Migrate BaseIncidentPlugin from size to iconScale to fix billboard clipping (Patch) * chore: resolve lockfile conflict --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
70 lines
3.4 KiB
JavaScript
70 lines
3.4 KiB
JavaScript
"use strict";
|
|
/**
|
|
* @file index.ts
|
|
* @description Core SDK for WorldWideView plugin development.
|
|
* Defines the foundational types, interfaces, and utilities required
|
|
* to build data seeders, visualizers, and UI extensions.
|
|
* @module @worldwideview/wwv-plugin-sdk
|
|
*/
|
|
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.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);
|
|
// ─── Auth Contracts ──────────────────────────────────────────
|
|
__exportStar(require("./auth-contracts"), exports);
|