@orion-ds/core 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 +152 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/theme.css +7919 -0
- package/dist/tokens/brands.d.ts +10 -0
- package/dist/tokens/brands.d.ts.map +1 -0
- package/dist/tokens/brands.js +154 -0
- package/dist/tokens/brands.js.map +1 -0
- package/dist/tokens/index.d.ts +11 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/index.js +16 -0
- package/dist/tokens/index.js.map +1 -0
- package/dist/tokens/primitives.d.ts +10 -0
- package/dist/tokens/primitives.d.ts.map +1 -0
- package/dist/tokens/primitives.js +192 -0
- package/dist/tokens/primitives.js.map +1 -0
- package/dist/tokens/themes.d.ts +14 -0
- package/dist/tokens/themes.d.ts.map +1 -0
- package/dist/tokens/themes.js +125 -0
- package/dist/tokens/themes.js.map +1 -0
- package/dist/tokens/types.d.ts +317 -0
- package/dist/tokens/types.d.ts.map +1 -0
- package/dist/tokens/types.js +8 -0
- package/dist/tokens/types.js.map +1 -0
- package/dist/tokens/utils.d.ts +46 -0
- package/dist/tokens/utils.d.ts.map +1 -0
- package/dist/tokens/utils.js +81 -0
- package/dist/tokens/utils.js.map +1 -0
- package/package.json +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Orion Design System
|
|
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,152 @@
|
|
|
1
|
+
# @orion/core
|
|
2
|
+
|
|
3
|
+
Core design tokens and utilities for the Orion Design System.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @orion/core
|
|
9
|
+
# or
|
|
10
|
+
pnpm add @orion/core
|
|
11
|
+
# or
|
|
12
|
+
yarn add @orion/core
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Import CSS Variables
|
|
18
|
+
|
|
19
|
+
```css
|
|
20
|
+
@import '@orion/core/theme.css';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Use TypeScript Tokens
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { primitives, getToken, getSemanticToken } from '@orion/core';
|
|
27
|
+
|
|
28
|
+
// Access primitive tokens
|
|
29
|
+
const brandColor = primitives.color.brand.orion[500]; // "#1B5BFF"
|
|
30
|
+
const spacing = primitives.spacing[4]; // "16px"
|
|
31
|
+
|
|
32
|
+
// Get tokens by path
|
|
33
|
+
const color = getToken('color.brand.orion.500'); // "#1B5BFF"
|
|
34
|
+
|
|
35
|
+
// Get semantic tokens
|
|
36
|
+
const surfaceBase = getSemanticToken('light', 'surface.base'); // "#ffffff"
|
|
37
|
+
const textPrimary = getSemanticToken('dark', 'text.primary'); // "#ffffff"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Type-Safe Token Paths
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import type { TokenPath, SemanticTokenPath } from '@orion/core';
|
|
44
|
+
|
|
45
|
+
// TypeScript will autocomplete and validate token paths
|
|
46
|
+
const path: TokenPath = 'color.brand.orion.500'; // ✅
|
|
47
|
+
const invalid: TokenPath = 'color.brand.invalid.500'; // ❌ Type error
|
|
48
|
+
|
|
49
|
+
const semantic: SemanticTokenPath = 'surface.base'; // ✅
|
|
50
|
+
const invalidSemantic: SemanticTokenPath = 'invalid.token'; // ❌ Type error
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Brand and Theme Support
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import { brands, themes, getBrand, isValidTheme } from '@orion/core';
|
|
57
|
+
|
|
58
|
+
// Access brand configuration
|
|
59
|
+
const orionBrand = getBrand('orion');
|
|
60
|
+
console.log(orionBrand.accentColor); // "#1B5BFF"
|
|
61
|
+
console.log(orionBrand.radius); // "12px"
|
|
62
|
+
|
|
63
|
+
// Check if theme is valid
|
|
64
|
+
if (isValidTheme('dark')) {
|
|
65
|
+
// Load dark theme
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Access all themes
|
|
69
|
+
console.log(themes.light);
|
|
70
|
+
console.log(themes.dark);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Features
|
|
74
|
+
|
|
75
|
+
- **Type-Safe**: Full TypeScript support with autocomplete
|
|
76
|
+
- **Chain of Truth**: Enforced token hierarchy (Primitives → Semantics → Components)
|
|
77
|
+
- **Multi-Brand**: Support for Orion, UVM, Unitec, and Laureate brands
|
|
78
|
+
- **Multi-Theme**: Light and dark theme support
|
|
79
|
+
- **Zero Runtime**: Types are compile-time only, no runtime overhead
|
|
80
|
+
- **Tree-Shakeable**: Import only what you need
|
|
81
|
+
|
|
82
|
+
## Architecture
|
|
83
|
+
|
|
84
|
+
### Primitives (Layer 1)
|
|
85
|
+
Raw values that never change:
|
|
86
|
+
- Colors (brand, neutral, status)
|
|
87
|
+
- Typography (family, size, weight, line-height)
|
|
88
|
+
- Spacing (0-32 scale)
|
|
89
|
+
- Radius (sm, md, lg, xl, full)
|
|
90
|
+
- Blur (sm, md, lg, xl)
|
|
91
|
+
|
|
92
|
+
### Semantics (Layer 2)
|
|
93
|
+
Intent-based aliases that describe purpose:
|
|
94
|
+
- Surface (base, subtle, layer, glass, sunken)
|
|
95
|
+
- Text (primary, secondary, tertiary, inverse, brand)
|
|
96
|
+
- Interactive (primary, secondary, ghost)
|
|
97
|
+
- Border (subtle, strong, interactive)
|
|
98
|
+
- Status (error, success, warning, info)
|
|
99
|
+
|
|
100
|
+
### CSS Variables (Layer 3)
|
|
101
|
+
Browser-consumable variables:
|
|
102
|
+
- `--surface-base`
|
|
103
|
+
- `--text-primary`
|
|
104
|
+
- `--interactive-primary`
|
|
105
|
+
- `--spacing-4`
|
|
106
|
+
- `--radius-control`
|
|
107
|
+
|
|
108
|
+
## Token Path Types
|
|
109
|
+
|
|
110
|
+
All token paths are type-checked:
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
type ColorTokenPath =
|
|
114
|
+
| `color.brand.${Brand}.${keyof ColorShades}`
|
|
115
|
+
| `color.neutral.${keyof NeutralColors}`
|
|
116
|
+
| 'color.error.500'
|
|
117
|
+
| 'color.success.500'
|
|
118
|
+
| 'color.warning.500'
|
|
119
|
+
| 'color.info.500';
|
|
120
|
+
|
|
121
|
+
type SemanticTokenPath =
|
|
122
|
+
| `surface.${keyof SurfaceSemantics}`
|
|
123
|
+
| `text.${keyof TextSemantics}`
|
|
124
|
+
| `interactive.primary.${keyof InteractivePrimarySemantics}`
|
|
125
|
+
// ...
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## API Reference
|
|
129
|
+
|
|
130
|
+
### Functions
|
|
131
|
+
|
|
132
|
+
#### `getToken(path: TokenPath): string`
|
|
133
|
+
Get a primitive token value by path.
|
|
134
|
+
|
|
135
|
+
#### `getSemanticToken(theme: Theme, path: SemanticTokenPath): string`
|
|
136
|
+
Get a semantic token value for a specific theme.
|
|
137
|
+
|
|
138
|
+
#### `getBrand(brand: Brand): BrandConfig`
|
|
139
|
+
Get brand configuration.
|
|
140
|
+
|
|
141
|
+
#### `toCSSVariable(path: SemanticTokenPath): string`
|
|
142
|
+
Convert semantic path to CSS variable name.
|
|
143
|
+
|
|
144
|
+
#### `isValidTheme(value: string): value is Theme`
|
|
145
|
+
Type guard for valid theme.
|
|
146
|
+
|
|
147
|
+
#### `isValidBrand(value: string): value is Brand`
|
|
148
|
+
Type guard for valid brand.
|
|
149
|
+
|
|
150
|
+
## License
|
|
151
|
+
|
|
152
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @orion/core - Orion Design System Core Package
|
|
3
|
+
*
|
|
4
|
+
* This package provides the foundational design tokens and utilities
|
|
5
|
+
* for the Orion Design System. It follows the "Chain of Truth" architecture:
|
|
6
|
+
*
|
|
7
|
+
* Layer 1: Primitives (raw values)
|
|
8
|
+
* Layer 2: Semantics (intent-based aliases)
|
|
9
|
+
* Layer 3: CSS Variables (browser-consumable)
|
|
10
|
+
* Layer 4: Components (blind consumers)
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
export * from './tokens';
|
|
15
|
+
export type { Theme, Brand, TokenPath, SemanticTokenPath, CSSVariableName, Primitives, SemanticTokens, } from './tokens/types';
|
|
16
|
+
export { primitives, color, typography, spacing, radius, blur, icon, } from './tokens/primitives';
|
|
17
|
+
export { lightTheme, darkTheme, themes, } from './tokens/themes';
|
|
18
|
+
export { brands, defaultBrand, } from './tokens/brands';
|
|
19
|
+
export { getToken, getSemanticToken, getBrand, toCSSVariable, isValidTheme, isValidBrand, } from './tokens/utils';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,cAAc,UAAU,CAAC;AAGzB,YAAY,EACV,KAAK,EACL,KAAK,EACL,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,cAAc,GACf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,UAAU,EACV,KAAK,EACL,UAAU,EACV,OAAO,EACP,MAAM,EACN,IAAI,EACJ,IAAI,GACL,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,UAAU,EACV,SAAS,EACT,MAAM,GACP,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,MAAM,EACN,YAAY,GACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,YAAY,GACb,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @orion/core - Orion Design System Core Package
|
|
3
|
+
*
|
|
4
|
+
* This package provides the foundational design tokens and utilities
|
|
5
|
+
* for the Orion Design System. It follows the "Chain of Truth" architecture:
|
|
6
|
+
*
|
|
7
|
+
* Layer 1: Primitives (raw values)
|
|
8
|
+
* Layer 2: Semantics (intent-based aliases)
|
|
9
|
+
* Layer 3: CSS Variables (browser-consumable)
|
|
10
|
+
* Layer 4: Components (blind consumers)
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
// Export all token types and values
|
|
15
|
+
export * from './tokens';
|
|
16
|
+
export { primitives, color, typography, spacing, radius, blur, icon, } from './tokens/primitives';
|
|
17
|
+
export { lightTheme, darkTheme, themes, } from './tokens/themes';
|
|
18
|
+
export { brands, defaultBrand, } from './tokens/brands';
|
|
19
|
+
export { getToken, getSemanticToken, getBrand, toCSSVariable, isValidTheme, isValidBrand, } from './tokens/utils';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,oCAAoC;AACpC,cAAc,UAAU,CAAC;AAazB,OAAO,EACL,UAAU,EACV,KAAK,EACL,UAAU,EACV,OAAO,EACP,MAAM,EACN,IAAI,EACJ,IAAI,GACL,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,UAAU,EACV,SAAS,EACT,MAAM,GACP,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,MAAM,EACN,YAAY,GACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,YAAY,GACb,MAAM,gBAAgB,CAAC"}
|