@sharadox/globe-web-library 0.0.0-stage → 0.1.0

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.
Files changed (115) hide show
  1. package/LICENCA.md +76 -0
  2. package/LICENSE.md +76 -0
  3. package/NOTICE.md +3 -0
  4. package/README.md +60 -2
  5. package/distribution/arc/index.d.ts +4 -0
  6. package/distribution/arc/index.d.ts.map +1 -0
  7. package/distribution/arc/index.js +29 -0
  8. package/distribution/arc/index.js.map +1 -0
  9. package/distribution/arc/type.d.ts +12 -0
  10. package/distribution/arc/type.d.ts.map +1 -0
  11. package/distribution/arc/type.js +2 -0
  12. package/distribution/arc/type.js.map +1 -0
  13. package/distribution/color/index.d.ts +9 -0
  14. package/distribution/color/index.d.ts.map +1 -0
  15. package/distribution/color/index.js +11 -0
  16. package/distribution/color/index.js.map +1 -0
  17. package/distribution/color/type.d.ts +20 -0
  18. package/distribution/color/type.d.ts.map +1 -0
  19. package/distribution/color/type.js +2 -0
  20. package/distribution/color/type.js.map +1 -0
  21. package/distribution/dots/index.d.ts +4 -0
  22. package/distribution/dots/index.d.ts.map +1 -0
  23. package/distribution/dots/index.js +38 -0
  24. package/distribution/dots/index.js.map +1 -0
  25. package/distribution/dots/type.d.ts +7 -0
  26. package/distribution/dots/type.d.ts.map +1 -0
  27. package/distribution/dots/type.js +2 -0
  28. package/distribution/dots/type.js.map +1 -0
  29. package/distribution/drag-controller/index.d.ts +11 -0
  30. package/distribution/drag-controller/index.d.ts.map +1 -0
  31. package/distribution/drag-controller/index.js +65 -0
  32. package/distribution/drag-controller/index.js.map +1 -0
  33. package/distribution/drag-controller/type.d.ts +26 -0
  34. package/distribution/drag-controller/type.d.ts.map +1 -0
  35. package/distribution/drag-controller/type.js +2 -0
  36. package/distribution/drag-controller/type.js.map +1 -0
  37. package/distribution/globe/index.d.ts +12 -0
  38. package/distribution/globe/index.d.ts.map +1 -0
  39. package/distribution/globe/index.js +38 -0
  40. package/distribution/globe/index.js.map +1 -0
  41. package/distribution/globe/index.module.css +37 -0
  42. package/distribution/globe/type.d.ts +16 -0
  43. package/distribution/globe/type.d.ts.map +1 -0
  44. package/distribution/globe/type.js +2 -0
  45. package/distribution/globe/type.js.map +1 -0
  46. package/distribution/globe-drag/index.d.ts +7 -0
  47. package/distribution/globe-drag/index.d.ts.map +1 -0
  48. package/distribution/globe-drag/index.js +49 -0
  49. package/distribution/globe-drag/index.js.map +1 -0
  50. package/distribution/hex-channel/index.d.ts +3 -0
  51. package/distribution/hex-channel/index.d.ts.map +1 -0
  52. package/distribution/hex-channel/index.js +8 -0
  53. package/distribution/hex-channel/index.js.map +1 -0
  54. package/distribution/land-point-generator/entry/index.d.ts +3 -0
  55. package/distribution/land-point-generator/entry/index.d.ts.map +1 -0
  56. package/distribution/land-point-generator/entry/index.js +13 -0
  57. package/distribution/land-point-generator/entry/index.js.map +1 -0
  58. package/distribution/land-point-generator/index.d.ts +10 -0
  59. package/distribution/land-point-generator/index.d.ts.map +1 -0
  60. package/distribution/land-point-generator/index.js +23 -0
  61. package/distribution/land-point-generator/index.js.map +1 -0
  62. package/distribution/land-points/index.d.ts +6 -0
  63. package/distribution/land-points/index.d.ts.map +1 -0
  64. package/distribution/land-points/index.js +20 -0
  65. package/distribution/land-points/index.js.map +1 -0
  66. package/distribution/latitude-longitude-to-vector/index.d.ts +7 -0
  67. package/distribution/latitude-longitude-to-vector/index.d.ts.map +1 -0
  68. package/distribution/latitude-longitude-to-vector/index.js +12 -0
  69. package/distribution/latitude-longitude-to-vector/index.js.map +1 -0
  70. package/distribution/marker/index.d.ts +4 -0
  71. package/distribution/marker/index.d.ts.map +1 -0
  72. package/distribution/marker/index.js +21 -0
  73. package/distribution/marker/index.js.map +1 -0
  74. package/distribution/marker/type.d.ts +9 -0
  75. package/distribution/marker/type.d.ts.map +1 -0
  76. package/distribution/marker/type.js +2 -0
  77. package/distribution/marker/type.js.map +1 -0
  78. package/distribution/place/type.d.ts +6 -0
  79. package/distribution/place/type.d.ts.map +1 -0
  80. package/distribution/place/type.js +2 -0
  81. package/distribution/place/type.js.map +1 -0
  82. package/distribution/shader/arc/index.d.ts +6 -0
  83. package/distribution/shader/arc/index.d.ts.map +1 -0
  84. package/distribution/shader/arc/index.js +24 -0
  85. package/distribution/shader/arc/index.js.map +1 -0
  86. package/distribution/shader/atmosphere/index.d.ts +6 -0
  87. package/distribution/shader/atmosphere/index.d.ts.map +1 -0
  88. package/distribution/shader/atmosphere/index.js +15 -0
  89. package/distribution/shader/atmosphere/index.js.map +1 -0
  90. package/distribution/shader/body/index.d.ts +6 -0
  91. package/distribution/shader/body/index.d.ts.map +1 -0
  92. package/distribution/shader/body/index.js +15 -0
  93. package/distribution/shader/body/index.js.map +1 -0
  94. package/distribution/shader/dot/index.d.ts +6 -0
  95. package/distribution/shader/dot/index.d.ts.map +1 -0
  96. package/distribution/shader/dot/index.js +29 -0
  97. package/distribution/shader/dot/index.js.map +1 -0
  98. package/distribution/shader/glow-vertex/index.d.ts +3 -0
  99. package/distribution/shader/glow-vertex/index.d.ts.map +1 -0
  100. package/distribution/shader/glow-vertex/index.js +9 -0
  101. package/distribution/shader/glow-vertex/index.js.map +1 -0
  102. package/distribution/web-gl-support/index.d.ts +3 -0
  103. package/distribution/web-gl-support/index.d.ts.map +1 -0
  104. package/distribution/web-gl-support/index.js +11 -0
  105. package/distribution/web-gl-support/index.js.map +1 -0
  106. package/distribution/world/index.d.ts +4 -0
  107. package/distribution/world/index.d.ts.map +1 -0
  108. package/distribution/world/index.js +38 -0
  109. package/distribution/world/index.js.map +1 -0
  110. package/distribution/world/type.d.ts +15 -0
  111. package/distribution/world/type.d.ts.map +1 -0
  112. package/distribution/world/type.js +2 -0
  113. package/distribution/world/type.js.map +1 -0
  114. package/llms.txt +10 -0
  115. package/package.json +103 -3
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useFrame } from "@react-three/fiber";
4
+ import { useMemo, useRef } from "react";
5
+ import { AdditiveBlending, BackSide, MathUtils, NormalBlending, ShaderMaterial } from "three";
6
+ import { Arc } from "@sharadox/globe-web-library/arc";
7
+ import { Dots } from "@sharadox/globe-web-library/dots";
8
+ import { Marker } from "@sharadox/globe-web-library/marker";
9
+ import { ATMOSPHERE_SHADER } from "@sharadox/globe-web-library/shader/atmosphere";
10
+ import { BODY_SHADER } from "@sharadox/globe-web-library/shader/body";
11
+ /** The planet scene: body, atmosphere, land dots, arcs from home and markers. Rotation comes from the drag controller. */
12
+ export function World({ data, drag, colors, home, destinations }) {
13
+ const group = useRef(null);
14
+ useFrame((_, deltaSeconds) => {
15
+ const planet = group.current;
16
+ if (!planet)
17
+ return;
18
+ const target = drag.step(deltaSeconds);
19
+ planet.rotation.y = MathUtils.damp(planet.rotation.y, target.y, 6, deltaSeconds);
20
+ planet.rotation.x = MathUtils.damp(planet.rotation.x, target.x, 6, deltaSeconds);
21
+ });
22
+ const body = useMemo(() => new ShaderMaterial({
23
+ vertexShader: BODY_SHADER.vertex,
24
+ fragmentShader: BODY_SHADER.fragment,
25
+ uniforms: { base: { value: colors.body }, rimColor: { value: colors.rim } },
26
+ }), [colors]);
27
+ const atmosphere = useMemo(() => new ShaderMaterial({
28
+ vertexShader: ATMOSPHERE_SHADER.vertex,
29
+ fragmentShader: ATMOSPHERE_SHADER.fragment,
30
+ uniforms: { strength: { value: colors.additive ? 0.42 : 0.2 }, color: { value: colors.ink } },
31
+ side: BackSide,
32
+ transparent: true,
33
+ blending: colors.additive ? AdditiveBlending : NormalBlending,
34
+ depthWrite: false,
35
+ }), [colors]);
36
+ return (_jsxs(_Fragment, { children: [_jsx("mesh", { scale: 1.16, material: atmosphere, children: _jsx("sphereGeometry", { args: [1, 64, 64] }) }), _jsxs("group", { ref: group, children: [_jsx("mesh", { material: body, children: _jsx("sphereGeometry", { args: [0.995, 96, 96] }) }), _jsx(Dots, { data: data, colors: colors }), destinations.map((place, index) => (_jsx(Arc, { from: home, to: [place.latitude, place.longitude], offset: index / destinations.length, colors: colors }, index))), destinations.map((place, index) => (_jsx(Marker, { latitude: place.latitude, longitude: place.longitude, color: colors.inkHex }, `marker${index}`))), _jsx(Marker, { latitude: home.latitude, longitude: home.longitude, color: colors.inkHex, home: true })] })] }));
37
+ }
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/world/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAc,MAAM,OAAO,CAAC;AAC1G,OAAO,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAGtE,0HAA0H;AAC1H,MAAM,UAAU,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAmB;IAC/E,MAAM,KAAK,GAAG,MAAM,CAAQ,IAAI,CAAC,CAAC;IAClC,QAAQ,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE;QAC3B,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACvC,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,CAA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E,QAAQ,EAAE,UAAU,YACrC,yBAAgB,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,GAAI,GAChC,EACP,iBAAO,GAAG,EAAE,KAAK,aACf,eAAM,QAAQ,EAAE,IAAI,YAClB,yBAAgB,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,GAAI,GACpC,EACP,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAI,EACnC,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAClC,KAAC,GAAG,IAEF,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,EACrC,MAAM,EAAE,KAAK,GAAG,YAAY,CAAC,MAAM,EACnC,MAAM,EAAE,MAAM,IAJT,KAAK,CAKV,CACH,CAAC,EACD,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAClC,KAAC,MAAM,IAAwB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,IAA5F,SAAS,KAAK,EAAE,CAAgF,CAC9G,CAAC,EACF,KAAC,MAAM,IAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,SAAG,IACnF,IACP,CACJ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { GlobeColors } from "@sharadox/globe-web-library/color/type";
2
+ import type { GlobeDragController } from "@sharadox/globe-web-library/drag-controller/type";
3
+ import type { Place } from "@sharadox/globe-web-library/place/type";
4
+ export interface WorldProperties {
5
+ /** Float32 [latitude, longitude] land pairs. */
6
+ data: Float32Array;
7
+ /** Supplies the rotation each frame. */
8
+ drag: GlobeDragController;
9
+ colors: GlobeColors;
10
+ /** Where arcs start, marked with a pulsing ring. */
11
+ home: Place;
12
+ /** Where arcs go. */
13
+ destinations: readonly Place[];
14
+ }
15
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/world/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAC;AAC5F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAEpE,MAAM,WAAW,eAAe;IAC9B,gDAAgD;IAChD,IAAI,EAAE,YAAY,CAAC;IACnB,wCAAwC;IACxC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,MAAM,EAAE,WAAW,CAAC;IACpB,oDAAoD;IACpD,IAAI,EAAE,KAAK,CAAC;IACZ,qBAAqB;IACrB,YAAY,EAAE,SAAS,KAAK,EAAE,CAAC;CAChC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/world/type.ts"],"names":[],"mappings":""}
package/llms.txt ADDED
@@ -0,0 +1,10 @@
1
+ # @sharadox/globe-web-library
2
+
3
+ > Interactive 3D dot globe for React (three.js + @react-three/fiber), client-only.
4
+
5
+ - /globe: <Globe palette={{ ink, body, rim, dark }} home={{ latitude, longitude }} destinations={[...]} landPoints="/globe/land.bin" label className /> — fills positioned parent; load with next/dynamic ssr:false
6
+ - Generate land dots: `globe-land-points public/globe/land.bin` (bin) or landPoints(topology, samples=42000, southernLimit=-60)
7
+ - /drag-controller createDragController(initial, autoRotate) (pure); /globe-drag useGlobeDrag; /land-points useLandPoints(url)
8
+ - /world <World> scene for custom Canvas; /color globeColors(palette)
9
+ - CSS vars: --globe-glow, --globe-surface
10
+ - Peer: react, react-dom. Licence: Sharadox Open Source Licence 0.1.0
package/package.json CHANGED
@@ -1,6 +1,106 @@
1
1
  {
2
2
  "name": "@sharadox/globe-web-library",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "An interactive 3D dot globe for React (three.js): land dots, arcs with travelling pulses, markers, drag with inertia, auto-rotation, colours from the page, plus the land dots generator.",
5
+ "private": false,
6
+ "license": "SEE LICENSE IN LICENCA.md",
7
+ "author": "Sharadox <contact@sharadox.com>",
8
+ "type": "module",
9
+ "exports": {
10
+ "./*/type": {
11
+ "sharadox-source": "./source/*/type.ts",
12
+ "types": "./distribution/*/type.d.ts"
13
+ },
14
+ "./*": {
15
+ "sharadox-source": [
16
+ "./source/*/index.ts",
17
+ "./source/*/index.tsx"
18
+ ],
19
+ "types": "./distribution/*/index.d.ts",
20
+ "default": "./distribution/*/index.js"
21
+ }
22
+ },
23
+ "files": [
24
+ "distribution",
25
+ "LICENCA.md",
26
+ "LICENSE.md",
27
+ "NOTICE.md",
28
+ "llms.txt"
29
+ ],
30
+ "sideEffects": [
31
+ "**/*.css"
32
+ ],
33
+ "engines": {
34
+ "node": ">=24"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "lint-staged": {
40
+ "*.{ts,tsx,js,mjs,cjs}": [
41
+ "prettier --write",
42
+ "eslint --fix --max-warnings=0"
43
+ ],
44
+ "*.{json,md,yml,yaml,scss}": "prettier --write"
45
+ },
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/Sharadox/globe-web-library.git"
49
+ },
50
+ "homepage": "https://github.com/Sharadox/globe-web-library#readme",
51
+ "devDependencies": {
52
+ "@sharadox/es-lint-configuration-web-library": "^0.1.1",
53
+ "@sharadox/library-build-web-library": "^0.1.1",
54
+ "@sharadox/prettier-configuration-web-library": "^0.1.0",
55
+ "@sharadox/turborepo-configuration-web-library": "^0.1.0",
56
+ "@sharadox/type-script-configuration-web-library": "^0.2.0",
57
+ "@sharadox/vitest-configuration-web-library": "^0.1.2",
58
+ "@testing-library/dom": "^10.4.2",
59
+ "@testing-library/react": "^16.3.3",
60
+ "@types/d3-geo": "^3.1.1",
61
+ "@types/node": "^24.19.2",
62
+ "@types/react": "^19.3.0",
63
+ "@types/react-dom": "^19.3.0",
64
+ "@types/three": "^0.187.0",
65
+ "@types/topojson-client": "^3.1.5",
66
+ "@types/topojson-specification": "^1.0.5",
67
+ "@vitest/coverage-v8": "^5.1.0",
68
+ "eslint": "9.39.5",
69
+ "happy-dom": "^21.0.4",
70
+ "husky": "^9.1.7",
71
+ "lint-staged": "^17.6.0",
72
+ "prettier": "^3.10.0",
73
+ "react": "^19.3.1",
74
+ "react-dom": "^19.3.1",
75
+ "turbo": "^2.11.10",
76
+ "typedoc": "^0.28.20",
77
+ "typescript": "6.0.3",
78
+ "vitest": "^5.1.0"
79
+ },
80
+ "dependencies": {
81
+ "@react-three/fiber": "^9.8.2",
82
+ "@sharadox/web-library": "^0.5.0",
83
+ "d3-geo": "^3.1.2",
84
+ "three": "^0.180.0",
85
+ "topojson-client": "^3.1.0",
86
+ "world-atlas": "^2.0.2"
87
+ },
88
+ "peerDependencies": {
89
+ "react": ">=19",
90
+ "react-dom": ">=19"
91
+ },
92
+ "bin": {
93
+ "globe-land-points": "./distribution/land-point-generator/entry/index.js"
94
+ },
95
+ "scripts": {
96
+ "build": "library-build",
97
+ "lint": "eslint --max-warnings=0 .",
98
+ "format": "prettier --write .",
99
+ "format:check": "prettier --check .",
100
+ "type-check": "tsc --noEmit",
101
+ "test:unit": "vitest run --coverage",
102
+ "documentation": "typedoc",
103
+ "verify": "turbo run format:check lint type-check test:unit build",
104
+ "test:benchmark": "vitest bench --run --passWithNoTests"
105
+ }
6
106
  }