Skip to content

Commit 0173074

Browse files
authored
docs(bundle): enhance README with detailed overview, usage instructions (#5836)
* docs(bundle): enhance README with detailed overview, usage instructions * docs: update README.md for clarity and consistency
1 parent b1c00fc commit 0173074

File tree

1 file changed

+56
-14
lines changed

1 file changed

+56
-14
lines changed

1st-gen/tools/bundle/README.md

Lines changed: 56 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,67 @@
1-
## Description
1+
## Overview
22

3-
`@spectrum-web-components/bundle` is a master dependency that allows a project to import any and all of the Spectrum Web Components. While it is a great approach to prototyping, the fact that is versions all of the Spectrum Web Components packages collectively means that depending on it can leave you with a lot of package updates to manage at any one version change. For a more predictable upgrade process we suggest that you depend upon individual packages directly, but hope you find this bundle productive when initially trying to get into the act of developing with Spectrum Web Components!
3+
`@spectrum-web-components/bundle` is a master dependency that allows a project to import any and all of the Spectrum Web Components. While it is a great approach to prototyping, the fact that it versions all of the Spectrum Web Components packages collectively means that depending on it can leave you with a lot of package updates to manage at any one version change. For a more predictable upgrade process we suggest that you depend upon individual packages directly, but hope you find this bundle productive when initially trying to get into the act of developing with Spectrum Web Components.
44

55
### Usage
66

77
[![See it on NPM!](https://img.shields.io/npm/v/@spectrum-web-components/bundle?style=for-the-badge)](https://www.npmjs.com/package/@spectrum-web-components/bundle)
88
[![How big is this package in your project?](https://img.shields.io/bundlephobia/minzip/@spectrum-web-components/bundle?style=for-the-badge)](https://bundlephobia.com/result?p=@spectrum-web-components/bundle)
99

10-
```
10+
```bash
1111
yarn add @spectrum-web-components/bundle
1212
```
1313

1414
Import the side effectful registrations of the bundled components:
1515

16-
```
16+
```javascript
1717
import '@spectrum-web-components/bundle/elements.js';
1818
```
1919

2020
When looking to leverage their base classes as a type and/or for extension purposes, do so via something like the following for the `ActionButton` base class:
2121

22-
```
22+
```javascript
2323
import { ActionButton } from '@spectrum-web-components/bundle';
2424
```
2525

26-
### Icons
26+
### Anatomy
27+
28+
The bundle consists of several key parts:
29+
30+
- All Spectrum Web Component elements registrations
31+
- Base classes for all components available for type checking and extension
32+
- Namespaced icon exports for UI and workflow icons (e.g., `UIIcons`, `WorkflowIcons`)
33+
34+
### Options
2735

28-
While this bundle directly re-exports the majority of functionality as they would be exported from their own packages, icon packages that export template literals are handled a little different. Due to the large number of exports that they feature, each of these packages are namespaced when included in the bundle.
36+
#### Component Registration
2937

30-
#### UI
38+
Import all component registrations at once for rapid prototyping:
3139

32-
`@spectrum-web-components/icons-ui` is renamed to `UIIcons` when leveraging the bundle. This means that you can use workflow icons in your demonstration code by importing them from `@spectrum-web-components/bundle/icons.js` like the following:
40+
```javascript
41+
import '@spectrum-web-components/bundle/elements.js';
42+
```
43+
44+
This registers all available Spectrum Web Components for use in your application.
3345

46+
#### Type Imports
47+
48+
Import individual component classes for type checking and extension purposes:
49+
50+
```javascript
51+
import { ActionButton, Button, Tooltip } from '@spectrum-web-components/bundle';
3452
```
53+
54+
### Behaviors
55+
56+
#### Icon Handling
57+
58+
While this bundle directly re-exports the majority of functionality as they would be exported from their own packages, icon packages that export template literals are handled differently. Due to the large number of exports that they feature, each of these packages is namespaced when included in the bundle.
59+
60+
##### UI Icons
61+
62+
`@spectrum-web-components/icons-ui` is renamed to `UIIcons` when leveraging the bundle. This means that you can use UI icons in your code by importing them from `@spectrum-web-components/bundle/icons.js`:
63+
64+
```javascript
3565
import { UIIcons } from '@spectrum-web-components/bundle/icons.js';
3666

3767
console.log(UIIcons.AsteriskIcon());
@@ -41,16 +71,28 @@ TemplateResult {strings: Array[1], values: Array[0], type: "html", processor: De
4171
***/
4272
```
4373

44-
#### Workflow
74+
##### Workflow Icons
4575

46-
`@spectrum-web-components/icons-workflow` is namespaced to `WorkflowIcons` when leveraging the bundle. This means that you can use workflow icons in your demonstration code by importing them from `@spectrum-web-components/bundle/icons.js` like the following:
76+
`@spectrum-web-components/icons-workflow` is namespaced to `WorkflowIcons` when leveraging the bundle. This means that you can use workflow icons in your code by importing them from `@spectrum-web-components/bundle/icons.js`:
4777

48-
```
49-
import { IconsWorkflow } from '@spectrum-web-components/bundle/icons.js';
78+
```javascript
79+
import { WorkflowIcons } from '@spectrum-web-components/bundle/icons.js';
5080

51-
console.log(IconsWorkflow.CircleIcon());
81+
console.log(WorkflowIcons.CircleIcon());
5282

5383
/***
5484
TemplateResult {strings: Array[1], values: Array[0], type: "html", processor: DefaultTemplateProcessor, constructor: Object}
5585
***/
5686
```
87+
88+
#### Version Management
89+
90+
The bundle versions all Spectrum Web Components packages collectively. This means:
91+
92+
- A single version bump updates all components simultaneously
93+
- You may receive updates for components you're not actively using
94+
- For production applications, consider depending on individual packages for more granular control
95+
96+
### Accessibility
97+
98+
All components included in the bundle follow WCAG accessibility guidelines. Each component maintains its own accessibility features as documented in their individual package documentation. Refer to the specific component documentation pages for detailed accessibility information.

0 commit comments

Comments
 (0)