@holoscript/traits 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/LICENSE +21 -0
- package/README.md +89 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/package.json +45 -0
- package/src/index.ts +15 -0
- package/tsconfig.json +5 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 HoloScript Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# @holoscript/traits
|
|
2
|
+
|
|
3
|
+
> Standard trait library for HoloScript — 2,000+ semantic traits across 40+ categories.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The traits package provides the complete vocabulary of HoloScript traits organized into domain-specific categories. Traits are semantic annotations (`@physics`, `@grabbable`, `@ai_agent`) that describe WHAT an entity is — the compiler handles HOW it runs on each platform.
|
|
8
|
+
|
|
9
|
+
## Trait Architecture
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
CrossRealityTraitRegistry TraitDependencyGraph
|
|
13
|
+
├── register(trait) ├── objectTraits (mapping)
|
|
14
|
+
├── getByCategory(cat) └── resolve dependencies
|
|
15
|
+
├── getAllTraitIds()
|
|
16
|
+
└── registerBuiltinTraits()
|
|
17
|
+
|
|
18
|
+
TraitSupportMatrix MoMETraitDatabase
|
|
19
|
+
└── detectCategory(path) ├── listCategory(cat)
|
|
20
|
+
└── TraitExpert.category
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Categories
|
|
24
|
+
|
|
25
|
+
| Category | Examples | Count |
|
|
26
|
+
|----------|----------|-------|
|
|
27
|
+
| **Core VR** | `@grabbable`, `@throwable`, `@pointable`, `@teleport` | 50+ |
|
|
28
|
+
| **Physics** | `@rigidbody`, `@collider`, `@force_field`, `@joint` | 80+ |
|
|
29
|
+
| **Audio** | `@spatial_audio`, `@reverb`, `@audio_zone` | 30+ |
|
|
30
|
+
| **Visual** | `@pbr_material`, `@glass_material`, `@toon_material` | 600+ |
|
|
31
|
+
| **AI/Agents** | `@agent`, `@llm_agent`, `@patrol`, `@behavior_tree` | 65+ |
|
|
32
|
+
| **IoT** | `@iot_sensor`, `@digital_twin`, `@mqtt_bridge` | 40+ |
|
|
33
|
+
| **Robotics** | `@joint_revolute`, `@force_torque_sensor`, `@urdf` | 213+ |
|
|
34
|
+
| **Economy** | `@credit`, `@marketplace`, `@escrow` | 20+ |
|
|
35
|
+
| **Networking** | `@networked`, `@crdt_state`, `@voice_chat` | 50+ |
|
|
36
|
+
| **Shader** | `@gaussian_splat`, `@subsurface`, `@toon_shader` | 100+ |
|
|
37
|
+
|
|
38
|
+
See `src/traits/constants/` for the full list of 101 category files.
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { VR_TRAITS } from '@holoscript/traits'; // All traits
|
|
44
|
+
import { PHYSICS_TRAITS } from '@holoscript/traits'; // Physics only
|
|
45
|
+
import { MAGIC_FANTASY_TRAITS } from '@holoscript/traits'; // Magic/Fantasy only
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Registering Custom Traits
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import { CrossRealityTraitRegistry } from '@holoscript/core';
|
|
52
|
+
|
|
53
|
+
const registry = new CrossRealityTraitRegistry();
|
|
54
|
+
registry.registerBuiltinTraits();
|
|
55
|
+
registry.register({
|
|
56
|
+
id: 'my_custom_trait',
|
|
57
|
+
category: 'gameplay',
|
|
58
|
+
properties: { damage: 'number', range: 'number' },
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Detecting Trait Category
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { detectCategory } from '@holoscript/core';
|
|
66
|
+
|
|
67
|
+
const category = detectCategory('src/traits/constants/physics.ts', content);
|
|
68
|
+
// → 'physics'
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Key Classes
|
|
72
|
+
|
|
73
|
+
| Class | File | Purpose |
|
|
74
|
+
|-------|------|---------|
|
|
75
|
+
| `CrossRealityTraitRegistry` | `core/src/compiler/platform/` | Register, query, and manage traits across platforms |
|
|
76
|
+
| `TraitDependencyGraph` | `core/src/compiler/` | Track trait-to-object mappings and dependencies |
|
|
77
|
+
| `TraitSupportMatrix` | `core/src/traits/` | Category detection and platform support matrix |
|
|
78
|
+
| `MoMETraitDatabase` | `core/src/traits/` | Mixture-of-Memory-Experts trait database |
|
|
79
|
+
| `ShaderTrait` | `core/src/traits/` | Shader compilation for all targets |
|
|
80
|
+
| `GLTFTrait` | `core/src/traits/` | glTF extension requirements |
|
|
81
|
+
|
|
82
|
+
## Related
|
|
83
|
+
|
|
84
|
+
- [Traits Reference](../../docs/traits/index.md) — Usage docs for all categories
|
|
85
|
+
- [CrossRealityTraitRegistry](../../docs/architecture/TRAIT_SYSTEM.md) — Architecture deep-dive
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@holoscript/core/traits';
|
package/dist/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@holoscript/traits",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "HoloScript standard traits library — 1,800+ trait definitions for spatial computing",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/brianonbased-dev/HoloScript.git",
|
|
18
|
+
"directory": "packages/traits"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@holoscript/core": "5.1.1"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"tsup": "^8.0.1",
|
|
25
|
+
"typescript": "~5.9.3",
|
|
26
|
+
"vitest": "^4.1.0"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/brianonbased-dev/HoloScript#readme",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/brianonbased-dev/HoloScript/issues"
|
|
31
|
+
},
|
|
32
|
+
"author": "Brian X Base Team",
|
|
33
|
+
"keywords": [
|
|
34
|
+
"holoscript",
|
|
35
|
+
"xr",
|
|
36
|
+
"webxr",
|
|
37
|
+
"vr",
|
|
38
|
+
"ar",
|
|
39
|
+
"spatial-computing"
|
|
40
|
+
],
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsup src/index.ts --format esm --dts",
|
|
43
|
+
"test": "vitest run"
|
|
44
|
+
}
|
|
45
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @holoscript/traits — Standard Traits Library
|
|
3
|
+
*
|
|
4
|
+
* Public API for HoloScript's 1,800+ trait definitions.
|
|
5
|
+
* Re-exports from @holoscript/core/traits barrel.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* import { Transform, Renderable, PhysicsBody } from '@holoscript/traits';
|
|
9
|
+
*
|
|
10
|
+
* This is the canonical entry point for traits.
|
|
11
|
+
* Source files live in @holoscript/core/src/traits/ (Phase 2 keeps them in core
|
|
12
|
+
* due to back-imports into ../types, ../runtime, ../agents).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export * from '@holoscript/core/traits';
|