@ucalgary-design-system/core 1.0.6 → 1.0.7
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 +6 -0
- package/README.md +33 -11
- package/core.css +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,33 +1,55 @@
|
|
|
1
1
|
# Core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Core package provides the foundation for all UCDS web components.
|
|
4
|
+
It includes:
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
* **BaseElement** — the base class extended by all UCDS components.
|
|
7
|
+
* **Base styles** — global UCalgary Design System styles for standard HTML elements.
|
|
8
|
+
* **Token injector** — a utility that ensures design tokens are available wherever UCDS components are used.
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
## Installation
|
|
8
11
|
|
|
9
12
|
```sh
|
|
10
|
-
npm install @ucalgary-design-system/
|
|
13
|
+
npm install @ucalgary-design-system/core
|
|
11
14
|
```
|
|
12
15
|
|
|
13
16
|
## Usage
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
### Extending BaseElement
|
|
19
|
+
|
|
20
|
+
When creating a new component, always extend `BaseElement`:
|
|
16
21
|
|
|
17
22
|
```ts
|
|
18
|
-
import '@ucalgary-design-system/core';
|
|
23
|
+
import { BaseElement } from '@ucalgary-design-system/core';
|
|
24
|
+
import { customElement } from 'lit/decorators.js';
|
|
25
|
+
|
|
26
|
+
@customElement('ucds-my-component')
|
|
27
|
+
export class MyComponent extends BaseElement {}
|
|
19
28
|
```
|
|
20
29
|
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
This ensures consistent lifecycle behavior and integration with UCDS utilities.
|
|
31
|
+
|
|
32
|
+
### Token injector
|
|
33
|
+
|
|
34
|
+
All generated UCDS components automatically include the token injector in their entry file.
|
|
35
|
+
This means **you do not need to call it manually** when consuming components from the library.
|
|
36
|
+
|
|
37
|
+
You might only need to call it directly if:
|
|
38
|
+
|
|
39
|
+
* You are building a custom component outside of the generator.
|
|
40
|
+
* You want global tokens available in a project without using UCDS components.
|
|
41
|
+
|
|
23
42
|
```ts
|
|
24
|
-
@
|
|
25
|
-
|
|
43
|
+
import { injectGlobalTokens } from '@ucalgary-design-system/core';
|
|
44
|
+
|
|
45
|
+
injectGlobalTokens();
|
|
26
46
|
```
|
|
27
47
|
|
|
48
|
+
> 💡 In most cases, you can ignore this. The injector runs automatically when you use UCDS components.
|
|
49
|
+
|
|
28
50
|
## Development
|
|
29
51
|
|
|
30
|
-
Build the
|
|
52
|
+
Build the package locally:
|
|
31
53
|
|
|
32
54
|
```sh
|
|
33
55
|
npm run build
|