entangled-worlds-orbiters-shared 1.0.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.
- package/README.md +75 -0
- package/package.json +49 -0
- package/public/config/textures.json +332 -0
- package/src/arrow-ui/BooleanController.js +31 -0
- package/src/arrow-ui/ColorController.js +108 -0
- package/src/arrow-ui/Controller.js +447 -0
- package/src/arrow-ui/FunctionController.js +27 -0
- package/src/arrow-ui/GUI.js +595 -0
- package/src/arrow-ui/NumberController.js +567 -0
- package/src/arrow-ui/OptionController.js +64 -0
- package/src/arrow-ui/StringController.js +41 -0
- package/src/arrow-ui/index.js +13 -0
- package/src/arrow-ui/lilGuiLoader.js +10 -0
- package/src/arrow-ui/utils/getColorFormat.js +75 -0
- package/src/arrow-ui/utils/injectStyles.js +10 -0
- package/src/arrow-ui/utils/normalizeColorString.js +29 -0
- package/src/config/index.js +8 -0
- package/src/config/textureConfig.js +299 -0
- package/src/core/index.js +3 -0
- package/src/core/lightFresnel.js +64 -0
- package/src/core/lights.js +43 -0
- package/src/index.js +8 -0
- package/src/loaders/bodyTextureLoader.js +39 -0
- package/src/loaders/cubeMapLoader.js +264 -0
- package/src/loaders/glbLoader.js +71 -0
- package/src/loaders/index.js +4 -0
- package/src/moons/index.js +3 -0
- package/src/moons/moonsGeneration.js +228 -0
- package/src/moons/moonsManager.js +64 -0
- package/src/utils/dispose.js +20 -0
- package/src/utils/index.js +3 -0
- package/src/utils/materials.js +31 -0
- package/src/world/cloudShell.js +89 -0
- package/src/world/index.js +6 -0
- package/src/world/worldGLB.js +7 -0
- package/src/world/worldManager.js +93 -0
- package/src/world/worldNormal.js +25 -0
- package/src/world/worldTexture.js +239 -0
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Entangled Worlds Orbiters Shared Library
|
|
2
|
+
|
|
3
|
+
A shared library containing core components for 3D world rendering, moons system, and UI components used across Entangled Worlds applications.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **World System**: Core world rendering with textured spheres, normal materials, GLB models, and cloud shells
|
|
8
|
+
- **Moons System**: Orbital moon generation and management
|
|
9
|
+
- **Arrow UI**: Reusable UI component system based on lil-gui
|
|
10
|
+
- **Loaders**: Texture, GLB, and cubemap loading utilities
|
|
11
|
+
- **Core Rendering**: Lighting, Fresnel effects, and material utilities
|
|
12
|
+
- **Configuration**: Texture and configuration management system
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install entangled-worlds-orbiters-shared
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```javascript
|
|
23
|
+
// Import specific modules
|
|
24
|
+
import { WorldManager } from 'entangled-worlds-orbiters-shared/world';
|
|
25
|
+
import { MoonsManager } from 'entangled-worlds-orbiters-shared/moons';
|
|
26
|
+
import { GUI } from 'entangled-worlds-orbiters-shared/arrow-ui';
|
|
27
|
+
|
|
28
|
+
// Or import everything
|
|
29
|
+
import * as EntangledWorlds from 'entangled-worlds-orbiters-shared';
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Modules
|
|
33
|
+
|
|
34
|
+
### World System
|
|
35
|
+
- `WorldManager` - Main world orchestration
|
|
36
|
+
- `worldTexture` - Textured sphere generation
|
|
37
|
+
- `worldNormal` - Normal material spheres
|
|
38
|
+
- `worldGLB` - GLB model loading
|
|
39
|
+
- `cloudShell` - Cloud rendering system
|
|
40
|
+
|
|
41
|
+
### Moons System
|
|
42
|
+
- `MoonsManager` - Moons orchestration
|
|
43
|
+
- `moonsGeneration` - Moon generation logic
|
|
44
|
+
|
|
45
|
+
### Arrow UI
|
|
46
|
+
- Complete UI component system based on lil-gui
|
|
47
|
+
- Controllers for boolean, color, function, number, option, and string inputs
|
|
48
|
+
|
|
49
|
+
### Loaders
|
|
50
|
+
- `cubeMapLoader` - Skybox loading
|
|
51
|
+
- `glbLoader` - GLB loading utilities
|
|
52
|
+
- `bodyTextureLoader` - Texture loading
|
|
53
|
+
|
|
54
|
+
### Core
|
|
55
|
+
- `lights` - Lighting setup
|
|
56
|
+
- `lightFresnel` - Fresnel glow effects
|
|
57
|
+
|
|
58
|
+
### Utils
|
|
59
|
+
- `materials` - Material utilities
|
|
60
|
+
- `dispose` - Memory management
|
|
61
|
+
|
|
62
|
+
### Configuration
|
|
63
|
+
- `textureConfig` - Texture configuration system
|
|
64
|
+
|
|
65
|
+
## Peer Dependencies
|
|
66
|
+
|
|
67
|
+
This library requires Three.js and three-stdlib as peer dependencies:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npm install three three-stdlib
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
|
|
75
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "entangled-worlds-orbiters-shared",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Shared library for entangled worlds orbiters - contains core world rendering, moons system, and UI components",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/index.js",
|
|
9
|
+
"./world": "./src/world/index.js",
|
|
10
|
+
"./moons": "./src/moons/index.js",
|
|
11
|
+
"./arrow-ui": "./src/arrow-ui/index.js",
|
|
12
|
+
"./loaders": "./src/loaders/index.js",
|
|
13
|
+
"./core": "./src/core/index.js",
|
|
14
|
+
"./config": "./src/config/index.js",
|
|
15
|
+
"./utils": "./src/utils/index.js"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"src/**/*",
|
|
19
|
+
"public/**/*",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"keywords": [
|
|
23
|
+
"three.js",
|
|
24
|
+
"3d",
|
|
25
|
+
"orbiter",
|
|
26
|
+
"world",
|
|
27
|
+
"planets",
|
|
28
|
+
"moons",
|
|
29
|
+
"rendering"
|
|
30
|
+
],
|
|
31
|
+
"author": "Plantasia Space",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"three": "^0.166.1",
|
|
35
|
+
"three-stdlib": "^2.34.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"three": "^0.166.1",
|
|
39
|
+
"three-stdlib": "^2.34.0"
|
|
40
|
+
},
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git@github.com:plantasia-space-org/entangled-worlds-orbiters-shared.git"
|
|
44
|
+
},
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/plantasia-space-org/entangled-worlds-orbiters-shared/issues"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://github.com/plantasia-space-org/entangled-worlds-orbiters-shared#readme"
|
|
49
|
+
}
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0",
|
|
3
|
+
"lastUpdated": "2024-01-01T00:00:00Z",
|
|
4
|
+
"baseUrl": "/default",
|
|
5
|
+
"textures": {
|
|
6
|
+
"clouds": {
|
|
7
|
+
"category": "atmospheric",
|
|
8
|
+
"basePath": "/clouds",
|
|
9
|
+
"defaultTexture": "04-clouds.ktx2",
|
|
10
|
+
"items": [
|
|
11
|
+
{
|
|
12
|
+
"id": "water-drops",
|
|
13
|
+
"filename": "18-water-drops.ktx2",
|
|
14
|
+
"label": "Water Drops",
|
|
15
|
+
"description": "Atmospheric water droplets",
|
|
16
|
+
"tags": ["atmospheric", "water", "natural"]
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "scream-1",
|
|
20
|
+
"filename": "17-scream.ktx2",
|
|
21
|
+
"label": "Scream",
|
|
22
|
+
"description": "Abstract screaming patterns",
|
|
23
|
+
"tags": ["abstract", "artistic"]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"id": "scream-2",
|
|
27
|
+
"filename": "16-scream.ktx2",
|
|
28
|
+
"label": "Scream Alt",
|
|
29
|
+
"description": "Alternative screaming patterns",
|
|
30
|
+
"tags": ["abstract", "artistic"]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "neon-lights-1",
|
|
34
|
+
"filename": "15-neon-lights.ktx2",
|
|
35
|
+
"label": "Neon Lights",
|
|
36
|
+
"description": "Electric neon lighting effects",
|
|
37
|
+
"tags": ["electric", "urban", "artificial"]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": "neon-lights-2",
|
|
41
|
+
"filename": "14-neon-lights.ktx2",
|
|
42
|
+
"label": "Neon Lights Alt",
|
|
43
|
+
"description": "Alternative neon lighting",
|
|
44
|
+
"tags": ["electric", "urban", "artificial"]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"id": "neon-lights-3",
|
|
48
|
+
"filename": "13-neon-lights.ktx2",
|
|
49
|
+
"label": "Neon Lights Pro",
|
|
50
|
+
"description": "Professional neon effects",
|
|
51
|
+
"tags": ["electric", "urban", "artificial"]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"id": "marble-1",
|
|
55
|
+
"filename": "12-marble.ktx2",
|
|
56
|
+
"label": "Marble",
|
|
57
|
+
"description": "Natural marble patterns",
|
|
58
|
+
"tags": ["stone", "natural", "elegant"]
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"id": "marble-2",
|
|
62
|
+
"filename": "11-marble.ktx2",
|
|
63
|
+
"label": "Marble Alt",
|
|
64
|
+
"description": "Alternative marble texture",
|
|
65
|
+
"tags": ["stone", "natural", "elegant"]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"id": "isolines-1",
|
|
69
|
+
"filename": "10-isolines.ktx2",
|
|
70
|
+
"label": "Isolines",
|
|
71
|
+
"description": "Topographic isolines",
|
|
72
|
+
"tags": ["geometric", "lines", "technical"]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "isolines-2",
|
|
76
|
+
"filename": "09-isolines.ktx2",
|
|
77
|
+
"label": "Isolines Alt",
|
|
78
|
+
"description": "Alternative isolines pattern",
|
|
79
|
+
"tags": ["geometric", "lines", "technical"]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"id": "fordite-1",
|
|
83
|
+
"filename": "08-fordite.ktx2",
|
|
84
|
+
"label": "Fordite",
|
|
85
|
+
"description": "Industrial fordite patterns",
|
|
86
|
+
"tags": ["industrial", "layered", "colorful"]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"id": "fordite-2",
|
|
90
|
+
"filename": "07-fordite.ktx2",
|
|
91
|
+
"label": "Fordite Alt",
|
|
92
|
+
"description": "Alternative fordite texture",
|
|
93
|
+
"tags": ["industrial", "layered", "colorful"]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"id": "entangled-1",
|
|
97
|
+
"filename": "06-entangled.ktx2",
|
|
98
|
+
"label": "Entangled",
|
|
99
|
+
"description": "Quantum entangled patterns",
|
|
100
|
+
"tags": ["quantum", "abstract", "complex"]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"id": "entangled-2",
|
|
104
|
+
"filename": "05-entangled.ktx2",
|
|
105
|
+
"label": "Entangled Alt",
|
|
106
|
+
"description": "Alternative entangled patterns",
|
|
107
|
+
"tags": ["quantum", "abstract", "complex"]
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"id": "clouds-1",
|
|
111
|
+
"filename": "04-clouds.ktx2",
|
|
112
|
+
"label": "Clouds",
|
|
113
|
+
"description": "Natural cloud formations",
|
|
114
|
+
"tags": ["natural", "atmospheric", "default"]
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"id": "clouds-2",
|
|
118
|
+
"filename": "03-clouds.ktx2",
|
|
119
|
+
"label": "Clouds Alt",
|
|
120
|
+
"description": "Alternative cloud patterns",
|
|
121
|
+
"tags": ["natural", "atmospheric"]
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"id": "cave-art-1",
|
|
125
|
+
"filename": "02-cave-art.ktx2",
|
|
126
|
+
"label": "Cave Art",
|
|
127
|
+
"description": "Ancient cave paintings",
|
|
128
|
+
"tags": ["ancient", "artistic", "historic"]
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"id": "cave-art-2",
|
|
132
|
+
"filename": "01-cave-art.ktx2",
|
|
133
|
+
"label": "Cave Art Alt",
|
|
134
|
+
"description": "Alternative cave art patterns",
|
|
135
|
+
"tags": ["ancient", "artistic", "historic"]
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
"moons": {
|
|
140
|
+
"category": "celestial",
|
|
141
|
+
"basePath": "/textures/moons",
|
|
142
|
+
"defaultTexture": "moon-equirectangular.ktx2",
|
|
143
|
+
"items": [
|
|
144
|
+
{
|
|
145
|
+
"id": "electric-moon",
|
|
146
|
+
"filename": "moon-equirectangular.ktx2",
|
|
147
|
+
"label": "Electric Moon",
|
|
148
|
+
"description": "Standard lunar surface texture",
|
|
149
|
+
"tags": ["lunar", "realistic", "default"],
|
|
150
|
+
"fallback": "moon-equirectangular.jpg"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"id": "earth-moon",
|
|
154
|
+
"filename": "2k_moon.ktx2",
|
|
155
|
+
"label": "Earth Moon",
|
|
156
|
+
"description": "Realistic Earth satellite texture",
|
|
157
|
+
"tags": ["lunar", "earth", "satellite"],
|
|
158
|
+
"fallback": "2k_moon.jpg"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"id": "crater-lines",
|
|
162
|
+
"filename": "crater-lines.ktx2",
|
|
163
|
+
"label": "Crater Lines",
|
|
164
|
+
"description": "Linear crater formations across the lunar surface",
|
|
165
|
+
"tags": ["craters", "lunar", "pattern"],
|
|
166
|
+
"fallback": "crater-lines.jpg"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"id": "moon-dust",
|
|
170
|
+
"filename": "moon-dust.ktx2",
|
|
171
|
+
"label": "Moon Dust",
|
|
172
|
+
"description": "Fine dust texture inspired by lunar regolith",
|
|
173
|
+
"tags": ["dust", "surface", "regolith"],
|
|
174
|
+
"fallback": "moon-dust.jpg"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"id": "lunar-scepter",
|
|
178
|
+
"filename": "lunar-scepter.ktx2",
|
|
179
|
+
"label": "Lunar Scepter",
|
|
180
|
+
"description": "Sharp, vertical ridge texture reminiscent of lunar highlands",
|
|
181
|
+
"tags": ["ridges", "highlands", "lunar"],
|
|
182
|
+
"fallback": "lunar-scepter.jpg"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"id": "satin-moon",
|
|
186
|
+
"filename": "satin-moon.ktx2",
|
|
187
|
+
"label": "Satin Moon",
|
|
188
|
+
"description": "Smooth satin-like lunar surface",
|
|
189
|
+
"tags": ["smooth", "lunar", "texture"],
|
|
190
|
+
"fallback": "satin-moon.jpg"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"id": "impact-craters",
|
|
194
|
+
"filename": "impact-craters.ktx2",
|
|
195
|
+
"label": "Impact Craters",
|
|
196
|
+
"description": "Dense field of lunar craters",
|
|
197
|
+
"tags": ["craters", "impact", "texture"],
|
|
198
|
+
"fallback": "impact-craters.jpg"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"id": "eclipse-dots",
|
|
202
|
+
"filename": "eclipse-dots.ktx2",
|
|
203
|
+
"label": "Eclipse Dots",
|
|
204
|
+
"description": "Pattern of scattered dots inspired by lunar eclipses",
|
|
205
|
+
"tags": ["dots", "eclipse", "pattern"],
|
|
206
|
+
"fallback": "eclipse-dots.jpg"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"id": "shadow-dots",
|
|
210
|
+
"filename": "shadow-dots.ktx2",
|
|
211
|
+
"label": "Shadow Dots",
|
|
212
|
+
"description": "Dot textures evoking shadows over the lunar surface",
|
|
213
|
+
"tags": ["dots", "shadows", "surface"],
|
|
214
|
+
"fallback": "shadow-dots.jpg"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"id": "moonrise",
|
|
218
|
+
"filename": "moonrise.ktx2",
|
|
219
|
+
"label": "Moonrise",
|
|
220
|
+
"description": "Atmospheric gradient evoking moonrise",
|
|
221
|
+
"tags": ["moonrise", "gradient", "lunar"],
|
|
222
|
+
"fallback": "moonrise.jpg"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"id": "midnight-moon",
|
|
226
|
+
"filename": "midnight-moon.ktx2",
|
|
227
|
+
"label": "Midnight Moon",
|
|
228
|
+
"description": "Dark-toned lunar surface texture",
|
|
229
|
+
"tags": ["midnight", "dark", "lunar"],
|
|
230
|
+
"fallback": "midnight-moon.jpg"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"id": "pale-orbit",
|
|
234
|
+
"filename": "pale-orbit.ktx2",
|
|
235
|
+
"label": "Pale Orbit",
|
|
236
|
+
"description": "Light lunar surface with subtle orbital tones",
|
|
237
|
+
"tags": ["orbit", "pale", "surface"],
|
|
238
|
+
"fallback": "pale-orbit.jpg"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"id": "tidal-glow",
|
|
242
|
+
"filename": "tidal-glow.ktx2",
|
|
243
|
+
"label": "Tidal Glow",
|
|
244
|
+
"description": "Soft glowing lunar texture reflecting tidal pull",
|
|
245
|
+
"tags": ["glow", "tidal", "lunar"],
|
|
246
|
+
"fallback": "tidal-glow.jpg"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"id": "silver-glow",
|
|
250
|
+
"filename": "silver-glow.ktx2",
|
|
251
|
+
"label": "Silver Glow",
|
|
252
|
+
"description": "Bright silver surface with reflective highlights",
|
|
253
|
+
"tags": ["silver", "glow", "lunar"],
|
|
254
|
+
"fallback": "silver-glow.jpg"
|
|
255
|
+
}
|
|
256
|
+
]
|
|
257
|
+
},
|
|
258
|
+
"skyboxes": {
|
|
259
|
+
"category": "environment",
|
|
260
|
+
"basePath": "/skybox",
|
|
261
|
+
"defaultSkybox": "001",
|
|
262
|
+
"items": [
|
|
263
|
+
{
|
|
264
|
+
"id": "001",
|
|
265
|
+
"label": "Deep Space",
|
|
266
|
+
"description": "Deep space with distant stars",
|
|
267
|
+
"tags": ["space", "dark", "minimal"]
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"id": "002",
|
|
271
|
+
"label": "Nebula Field",
|
|
272
|
+
"description": "Colorful nebula formations",
|
|
273
|
+
"tags": ["nebula", "colorful", "cosmic"]
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"id": "003",
|
|
277
|
+
"label": "Galaxy Center",
|
|
278
|
+
"description": "Dense galactic core region",
|
|
279
|
+
"tags": ["galaxy", "dense", "bright"]
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"id": "004",
|
|
283
|
+
"label": "Binary System",
|
|
284
|
+
"description": "Binary star system environment",
|
|
285
|
+
"tags": ["binary", "stars", "orange"]
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"id": "005",
|
|
289
|
+
"label": "Cosmic Web",
|
|
290
|
+
"description": "Large-scale cosmic structure",
|
|
291
|
+
"tags": ["cosmic", "web", "structure"]
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"id": "006",
|
|
295
|
+
"label": "Stellar Nursery",
|
|
296
|
+
"description": "Star formation region",
|
|
297
|
+
"tags": ["formation", "young", "bright"]
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"id": "007",
|
|
301
|
+
"label": "Dark Matter",
|
|
302
|
+
"description": "Dark matter visualization",
|
|
303
|
+
"tags": ["dark", "matter", "theoretical"]
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"id": "008",
|
|
307
|
+
"label": "Quantum Foam",
|
|
308
|
+
"description": "Quantum scale space-time",
|
|
309
|
+
"tags": ["quantum", "foam", "microscopic"]
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"id": "009",
|
|
313
|
+
"label": "Event Horizon",
|
|
314
|
+
"description": "Black hole event horizon",
|
|
315
|
+
"tags": ["black hole", "horizon", "gravity"]
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"id": "010",
|
|
319
|
+
"label": "Multiverse",
|
|
320
|
+
"description": "Multiple universe visualization",
|
|
321
|
+
"tags": ["multiverse", "infinite", "parallel"]
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"id": "011",
|
|
325
|
+
"label": "Void Space",
|
|
326
|
+
"description": "Empty cosmic void region",
|
|
327
|
+
"tags": ["void", "empty", "minimal"]
|
|
328
|
+
}
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import Controller from './Controller';
|
|
2
|
+
|
|
3
|
+
export default class BooleanController extends Controller {
|
|
4
|
+
|
|
5
|
+
constructor( parent, object, property ) {
|
|
6
|
+
|
|
7
|
+
super( parent, object, property, 'boolean', 'label' );
|
|
8
|
+
|
|
9
|
+
this.$input = document.createElement( 'input' );
|
|
10
|
+
this.$input.setAttribute( 'type', 'checkbox' );
|
|
11
|
+
this.$input.setAttribute( 'aria-labelledby', this.$name.id );
|
|
12
|
+
|
|
13
|
+
this.$widget.appendChild( this.$input );
|
|
14
|
+
|
|
15
|
+
this.$input.addEventListener( 'change', () => {
|
|
16
|
+
this.setValue( this.$input.checked );
|
|
17
|
+
this._callOnFinishChange();
|
|
18
|
+
} );
|
|
19
|
+
|
|
20
|
+
this.$disable = this.$input;
|
|
21
|
+
|
|
22
|
+
this.updateDisplay();
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
updateDisplay() {
|
|
27
|
+
this.$input.checked = this.getValue();
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import Controller from './Controller';
|
|
2
|
+
|
|
3
|
+
import getColorFormat from './utils/getColorFormat';
|
|
4
|
+
import normalizeColorString from './utils/normalizeColorString';
|
|
5
|
+
|
|
6
|
+
export default class ColorController extends Controller {
|
|
7
|
+
|
|
8
|
+
constructor( parent, object, property, rgbScale ) {
|
|
9
|
+
|
|
10
|
+
super( parent, object, property, 'color' );
|
|
11
|
+
|
|
12
|
+
this.$input = document.createElement( 'input' );
|
|
13
|
+
this.$input.setAttribute( 'type', 'color' );
|
|
14
|
+
this.$input.setAttribute( 'tabindex', -1 );
|
|
15
|
+
this.$input.setAttribute( 'aria-labelledby', this.$name.id );
|
|
16
|
+
|
|
17
|
+
this.$text = document.createElement( 'input' );
|
|
18
|
+
this.$text.setAttribute( 'type', 'text' );
|
|
19
|
+
this.$text.setAttribute( 'spellcheck', 'false' );
|
|
20
|
+
this.$text.setAttribute( 'aria-labelledby', this.$name.id );
|
|
21
|
+
|
|
22
|
+
this.$display = document.createElement( 'div' );
|
|
23
|
+
this.$display.classList.add( 'display' );
|
|
24
|
+
|
|
25
|
+
this.$display.appendChild( this.$input );
|
|
26
|
+
this.$widget.appendChild( this.$display );
|
|
27
|
+
this.$widget.appendChild( this.$text );
|
|
28
|
+
|
|
29
|
+
this._format = getColorFormat( this.initialValue );
|
|
30
|
+
this._rgbScale = rgbScale;
|
|
31
|
+
|
|
32
|
+
this._initialValueHexString = this.save();
|
|
33
|
+
this._textFocused = false;
|
|
34
|
+
|
|
35
|
+
this.$input.addEventListener( 'input', () => {
|
|
36
|
+
this._setValueFromHexString( this.$input.value );
|
|
37
|
+
} );
|
|
38
|
+
|
|
39
|
+
this.$input.addEventListener( 'blur', () => {
|
|
40
|
+
this._callOnFinishChange();
|
|
41
|
+
} );
|
|
42
|
+
|
|
43
|
+
this.$text.addEventListener( 'input', () => {
|
|
44
|
+
const tryParse = normalizeColorString( this.$text.value );
|
|
45
|
+
if ( tryParse ) {
|
|
46
|
+
this._setValueFromHexString( tryParse );
|
|
47
|
+
}
|
|
48
|
+
} );
|
|
49
|
+
|
|
50
|
+
this.$text.addEventListener( 'focus', () => {
|
|
51
|
+
this._textFocused = true;
|
|
52
|
+
this.$text.select();
|
|
53
|
+
} );
|
|
54
|
+
|
|
55
|
+
this.$text.addEventListener( 'blur', () => {
|
|
56
|
+
this._textFocused = false;
|
|
57
|
+
this.updateDisplay();
|
|
58
|
+
this._callOnFinishChange();
|
|
59
|
+
} );
|
|
60
|
+
|
|
61
|
+
this.$disable = this.$text;
|
|
62
|
+
|
|
63
|
+
this.updateDisplay();
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
reset() {
|
|
68
|
+
this._setValueFromHexString( this._initialValueHexString );
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
_setValueFromHexString( value ) {
|
|
73
|
+
|
|
74
|
+
if ( this._format.isPrimitive ) {
|
|
75
|
+
|
|
76
|
+
const newValue = this._format.fromHexString( value );
|
|
77
|
+
this.setValue( newValue );
|
|
78
|
+
|
|
79
|
+
} else {
|
|
80
|
+
|
|
81
|
+
this._format.fromHexString( value, this.getValue(), this._rgbScale );
|
|
82
|
+
this._callOnChange();
|
|
83
|
+
this.updateDisplay();
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
save() {
|
|
90
|
+
return this._format.toHexString( this.getValue(), this._rgbScale );
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
load( value ) {
|
|
94
|
+
this._setValueFromHexString( value );
|
|
95
|
+
this._callOnFinishChange();
|
|
96
|
+
return this;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
updateDisplay() {
|
|
100
|
+
this.$input.value = this._format.toHexString( this.getValue(), this._rgbScale );
|
|
101
|
+
if ( !this._textFocused ) {
|
|
102
|
+
this.$text.value = this.$input.value.substring( 1 );
|
|
103
|
+
}
|
|
104
|
+
this.$display.style.backgroundColor = this.$input.value;
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
}
|