canvas-globe 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +39 -7
- package/codemeta.json +2 -2
- package/package.json +18 -3
- package/src/react.js +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,26 @@ All notable changes to this package are documented here. The format follows
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.1.6] - 2026-09-15
|
|
10
|
+
|
|
11
|
+
- Improved the package description and discovery metadata used by npm,
|
|
12
|
+
Context7, CodeMeta, search engines, and coding assistants.
|
|
13
|
+
- Removed the discontinued CodeSandbox repository-import link from the README.
|
|
14
|
+
- Hardened project maintenance with scheduled dependency updates and more
|
|
15
|
+
reliable Storybook visual-test baselines.
|
|
16
|
+
|
|
17
|
+
## [0.1.5] - 2026-09-15
|
|
18
|
+
|
|
19
|
+
- Added an animated README demo, Storybook stories, framework starters, a
|
|
20
|
+
shadcn registry component, Context7 metadata, and a reusable coding-agent
|
|
21
|
+
skill.
|
|
22
|
+
- Added publishable `react-canvas-globe` and `create-canvas-globe` companion
|
|
23
|
+
packages for package-name discovery and project scaffolding.
|
|
24
|
+
- Fixed React client-component compatibility and forwarded-ref lifecycle
|
|
25
|
+
updates, plus safe cleanup for asynchronously loaded Svelte integrations.
|
|
26
|
+
- Improved README capture portability and pinned the Chromatic workflow action
|
|
27
|
+
to an immutable release commit.
|
|
28
|
+
|
|
9
29
|
## [0.1.4] - 2026-09-14
|
|
10
30
|
|
|
11
31
|
- Published the browser-safe package entry points to JSR under
|
package/README.md
CHANGED
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
[](LICENSE)
|
|
8
8
|
[](types/index.d.ts)
|
|
9
9
|
[](package.json)
|
|
10
|
+
[](https://skills.sh/Shree-hari/canvas-globe)
|
|
10
11
|
|
|
11
|
-
[](https://canvasglobe.swiftools.com/playground)
|
|
12
13
|
|
|
13
14
|
[**Open the live playground**](https://canvasglobe.swiftools.com/playground) ·
|
|
14
15
|
[Examples](https://canvasglobe.swiftools.com/examples) ·
|
|
@@ -18,7 +19,10 @@
|
|
|
18
19
|
[Commercial pricing](https://canvasglobe.swiftools.com/pricing)
|
|
19
20
|
|
|
20
21
|
[](https://stackblitz.com/github/Shree-hari/canvas-globe?startScript=start)
|
|
21
|
-
|
|
22
|
+
|
|
23
|
+
**Start with your stack:** [Vanilla JS](starters/vanilla-vite) | [React + Vite](starters/react-vite) | [Next.js](starters/nextjs-app-router) | [Vue](starters/vue-vite) | [SvelteKit](starters/sveltekit) | [Web Component](starters/web-component-vite)
|
|
24
|
+
|
|
25
|
+
**Install with shadcn:** `npx shadcn@latest add https://canvasglobe.swiftools.com/r/canvas-globe.json`
|
|
22
26
|
|
|
23
27
|
`canvas-globe` is a zero-dependency JavaScript library for an interactive
|
|
24
28
|
**3D globe** and **flat world map** on Canvas 2D. It works with
|
|
@@ -107,7 +111,7 @@ npx jsr add @swiftools/canvas-globe
|
|
|
107
111
|
You can also import the JSR release directly in Deno:
|
|
108
112
|
|
|
109
113
|
```js
|
|
110
|
-
import { createGlobe } from "jsr:@swiftools/canvas-globe@0.1.
|
|
114
|
+
import { createGlobe } from "jsr:@swiftools/canvas-globe@0.1.6";
|
|
111
115
|
```
|
|
112
116
|
|
|
113
117
|
The React entry point remains on npm so React's peer dependency is resolved by
|
|
@@ -118,19 +122,19 @@ your existing application rather than installing a second React copy.
|
|
|
118
122
|
For a plain `<script>` installation, use the versioned UMD build:
|
|
119
123
|
|
|
120
124
|
```html
|
|
121
|
-
<script src="https://cdn.jsdelivr.net/npm/canvas-globe@0.1.
|
|
125
|
+
<script src="https://cdn.jsdelivr.net/npm/canvas-globe@0.1.6/dist/canvas-globe.umd.js"></script>
|
|
122
126
|
```
|
|
123
127
|
|
|
124
128
|
The same npm release is also available from UNPKG:
|
|
125
129
|
|
|
126
130
|
```html
|
|
127
|
-
<script src="https://unpkg.com/canvas-globe@0.1.
|
|
131
|
+
<script src="https://unpkg.com/canvas-globe@0.1.6/dist/canvas-globe.umd.js"></script>
|
|
128
132
|
```
|
|
129
133
|
|
|
130
134
|
Modern browsers can import the package through an ESM CDN:
|
|
131
135
|
|
|
132
136
|
```js
|
|
133
|
-
import { createGlobe } from "https://esm.sh/canvas-globe@0.1.
|
|
137
|
+
import { createGlobe } from "https://esm.sh/canvas-globe@0.1.6";
|
|
134
138
|
```
|
|
135
139
|
|
|
136
140
|
Pin an exact version in production so a future release cannot change a deployed page unexpectedly.
|
|
@@ -150,7 +154,7 @@ import { createGlobe } from "canvas-globe";
|
|
|
150
154
|
Or drop the UMD build on a page with no build step at all:
|
|
151
155
|
|
|
152
156
|
```html
|
|
153
|
-
<script src="https://cdn.jsdelivr.net/npm/canvas-globe@0.1.
|
|
157
|
+
<script src="https://cdn.jsdelivr.net/npm/canvas-globe@0.1.6/dist/canvas-globe.umd.js"></script>
|
|
154
158
|
<canvas id="globe" style="width:520px;aspect-ratio:1"></canvas>
|
|
155
159
|
<script>
|
|
156
160
|
CanvasGlobe.createGlobe(document.getElementById("globe"), {
|
|
@@ -227,6 +231,29 @@ export function Visitors({ markers }) {
|
|
|
227
231
|
|
|
228
232
|
React is an optional peer dependency: only the `/react` entry point needs it.
|
|
229
233
|
|
|
234
|
+
For a dedicated React package name, install the thin companion entry point:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
npm install react-canvas-globe
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
To scaffold a complete starter for React, Next.js, Vue, SvelteKit, Vanilla
|
|
241
|
+
JavaScript, or Web Components, run:
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
npm create canvas-globe@latest my-globe
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### AI-assisted setup
|
|
248
|
+
|
|
249
|
+
Install the repository's CanvasGlobe skill for compatible coding agents:
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
npx skills add https://github.com/Shree-hari/canvas-globe --skill canvas-globe
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Or copy the maintained prompt from the [AI-assisted setup guide](https://canvasglobe.swiftools.com/getting-started/ai-assisted-setup). The skill and prompt select the correct framework entry point, include cleanup and accessibility, and require a real license key before shipping. Proprietary projects are directed to [commercial pricing](https://canvasglobe.swiftools.com/pricing); GPLv3-compatible projects are directed to the [GPL licensing path](https://canvasglobe.swiftools.com/licensing).
|
|
256
|
+
|
|
230
257
|
## Options
|
|
231
258
|
|
|
232
259
|
| Option | Default | Description |
|
|
@@ -700,8 +727,13 @@ npm test # node --test, no test framework to install
|
|
|
700
727
|
npm run build # dist/canvas-globe.umd.js, with a gzipped size budget
|
|
701
728
|
npm run example # demo at http://localhost:8099
|
|
702
729
|
npm run release:check # tests, types, build and packed-artifact validation
|
|
730
|
+
npm run capture:readme # regenerate the animated README demo with Chrome or Chromium
|
|
703
731
|
```
|
|
704
732
|
|
|
733
|
+
The README capture script detects common Chrome and Chromium locations. If the
|
|
734
|
+
browser is installed elsewhere, set `CANVAS_GLOBE_CHROME` to its executable
|
|
735
|
+
path before running `npm run capture:readme`.
|
|
736
|
+
|
|
705
737
|
The product website and documentation are maintained separately at
|
|
706
738
|
[canvasglobe.swiftools.com](https://canvasglobe.swiftools.com/).
|
|
707
739
|
|
package/codemeta.json
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
"@type": "SoftwareSourceCode",
|
|
4
4
|
"name": "CanvasGlobe",
|
|
5
5
|
"identifier": "canvas-globe",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "CanvasGlobe helps developers add interactive 3D globes and flat world maps to JavaScript and React apps with Canvas 2D, without WebGL, map tiles, API keys, or runtime network calls.",
|
|
7
7
|
"url": "https://canvasglobe.swiftools.com/",
|
|
8
|
-
"version": "0.1.
|
|
8
|
+
"version": "0.1.6",
|
|
9
9
|
"codeRepository": "https://github.com/Shree-hari/canvas-globe",
|
|
10
10
|
"issueTracker": "https://github.com/Shree-hari/canvas-globe/issues",
|
|
11
11
|
"downloadUrl": "https://www.npmjs.com/package/canvas-globe",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "canvas-globe",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.6",
|
|
4
|
+
"description": "Build interactive 3D globes and flat world maps in JavaScript or React with Canvas 2D, without WebGL, map tiles, API keys, or runtime network calls.",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harsh Jhunjhunuwala"
|
|
@@ -92,10 +92,16 @@
|
|
|
92
92
|
"build": "node scripts/build.mjs",
|
|
93
93
|
"data": "node scripts/generate-data.mjs && node scripts/generate-timezones.mjs",
|
|
94
94
|
"example": "node scripts/serve.mjs",
|
|
95
|
+
"storybook": "storybook dev -p 6006",
|
|
96
|
+
"build-storybook": "storybook build",
|
|
97
|
+
"build:registry": "shadcn build --output .registry-build",
|
|
98
|
+
"capture:readme": "node scripts/capture-readme-demo.mjs",
|
|
95
99
|
"test": "node --test",
|
|
100
|
+
"test:ecosystem": "npm run build:registry && node scripts/validate-ecosystem.mjs && npm --prefix packages/create-canvas-globe test",
|
|
96
101
|
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
102
|
+
"typecheck:ecosystem": "tsc --noEmit -p tsconfig.ecosystem.json",
|
|
97
103
|
"smoke:package": "node scripts/package-smoke.mjs",
|
|
98
|
-
"release:check": "npm run test && npm run typecheck && npm run build && node scripts/release-check.mjs && npm run smoke:package",
|
|
104
|
+
"release:check": "npm run test && npm run typecheck && npm run typecheck:ecosystem && npm run test:ecosystem && npm run build && node scripts/release-check.mjs && npm run smoke:package",
|
|
99
105
|
"prepublishOnly": "npm run test && npm run typecheck && npm run build && node scripts/release-check.mjs"
|
|
100
106
|
},
|
|
101
107
|
"peerDependencies": {
|
|
@@ -107,7 +113,16 @@
|
|
|
107
113
|
}
|
|
108
114
|
},
|
|
109
115
|
"devDependencies": {
|
|
116
|
+
"@storybook/addon-a11y": "^10.6.0",
|
|
117
|
+
"@storybook/html-vite": "^10.6.0",
|
|
118
|
+
"@types/react": "^19.3.0",
|
|
119
|
+
"chromatic": "^18.8.1",
|
|
120
|
+
"gifenc": "^1.0.3",
|
|
121
|
+
"playwright-core": "^1.63.0",
|
|
122
|
+
"pngjs": "^7.0.0",
|
|
110
123
|
"polygon-clipping": "^0.15.7",
|
|
124
|
+
"shadcn": "^4.21.0",
|
|
125
|
+
"storybook": "^10.6.0",
|
|
111
126
|
"topojson-client": "^3.1.0",
|
|
112
127
|
"typescript": "^5.5.0"
|
|
113
128
|
},
|
package/src/react.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
/* @ts-self-types="../types/react.d.ts" */
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* React binding. `import { Globe } from "canvas-globe/react"`.
|
|
5
7
|
* React is a peer dependency and is only required by this entry point.
|
|
6
8
|
*/
|
|
7
|
-
import { createElement, forwardRef, useEffect, useImperativeHandle, useRef } from "react";
|
|
9
|
+
import { createElement, forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
8
10
|
import { GeoGlobe } from "./geo-globe.js";
|
|
9
11
|
import { mapAspect } from "./geo.js";
|
|
10
12
|
|
|
@@ -17,6 +19,7 @@ export const Globe = forwardRef(function Globe(props, ref) {
|
|
|
17
19
|
|
|
18
20
|
const canvasRef = useRef(null);
|
|
19
21
|
const globeRef = useRef(null);
|
|
22
|
+
const [globe, setGlobe] = useState(null);
|
|
20
23
|
const handlers = useRef(props);
|
|
21
24
|
const previous = useRef(null);
|
|
22
25
|
const initial = useRef(options);
|
|
@@ -27,6 +30,7 @@ export const Globe = forwardRef(function Globe(props, ref) {
|
|
|
27
30
|
for (const name of CALLBACKS) bound[name] = (...args) => handlers.current[name]?.(...args);
|
|
28
31
|
const globe = new GeoGlobe(canvasRef.current, { ...initial.current, ...bound });
|
|
29
32
|
globeRef.current = globe;
|
|
33
|
+
setGlobe(globe);
|
|
30
34
|
previous.current = initial.current;
|
|
31
35
|
return () => {
|
|
32
36
|
globe.destroy();
|
|
@@ -49,7 +53,7 @@ export const Globe = forwardRef(function Globe(props, ref) {
|
|
|
49
53
|
if (changed) globe.setOptions(patch);
|
|
50
54
|
});
|
|
51
55
|
|
|
52
|
-
useImperativeHandle(ref, () =>
|
|
56
|
+
useImperativeHandle(ref, () => globe, [globe]);
|
|
53
57
|
|
|
54
58
|
const aspect = options.mode === "map" ? 1 / mapAspect(options.latRange, options.projection) : 1;
|
|
55
59
|
return createElement("canvas", {
|