Skip to content

Commit 3005e66

Browse files
authored
Merge pull request #425 from phase2/feature/controller-docs
feat(updates): Documentation and Storybook updates.
2 parents fd4332f + 5519672 commit 3005e66

File tree

14 files changed

+434
-363
lines changed

14 files changed

+434
-363
lines changed

.storybook/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module.exports = {
3535
modernInlineRender: true,
3636
},
3737
framework: {
38-
name: '@storybook/web-components-vite',
38+
name: getAbsolutePath('@storybook/web-components-vite'),
3939
options: {},
4040
},
4141
docs: {

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@
9090
"@commitlint/cli": "^17.4.0",
9191
"@commitlint/config-conventional": "^17.4.0",
9292
"@open-wc/testing": "^3.0.0-next.2",
93-
"@storybook/addon-actions": "^7.3.0",
94-
"@storybook/addon-docs": "^7.3.2",
95-
"@storybook/addon-essentials": "^7.3.0",
96-
"@storybook/addon-links": "^7.3.0",
97-
"@storybook/web-components": "^7.3.0",
98-
"@storybook/web-components-vite": "^7.3.0",
93+
"@storybook/addon-actions": "^7.4.0",
94+
"@storybook/addon-docs": "^7.4.0",
95+
"@storybook/addon-essentials": "^7.4.0",
96+
"@storybook/addon-links": "^7.4.0",
97+
"@storybook/web-components": "^7.4.0",
98+
"@storybook/web-components-vite": "^7.4.0",
9999
"@types/estree": "^0.0.47",
100100
"@typescript-eslint/eslint-plugin": "^5.0.0",
101101
"@typescript-eslint/parser": "^5.0.0",
@@ -131,7 +131,7 @@
131131
"react-syntax-highlighter": "^15.5.0",
132132
"rimraf": "^3.0.2",
133133
"rsync": "^0.6.1",
134-
"storybook": "^7.3.0",
134+
"storybook": "^7.4.0",
135135
"svgo": "^2.8.0",
136136
"tailwindcss": "3.0.0",
137137
"ts-lit-plugin": "^1.2.1",

packages/components/@deprecated/outline-form/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# @phase2/outline-form
22

3+
## 0.1.6
4+
5+
### Patch Changes
6+
7+
- Updated dependencies
8+
- @phase2/outline-controller-light-dom-styles-controller@0.0.4
9+
10+
## 0.1.5
11+
12+
### Patch Changes
13+
14+
- Updated dependencies
15+
- @phase2/outline-controller-light-dom-styles-controller@0.0.3
16+
317
## 0.1.4
418

519
### Patch Changes

packages/components/@deprecated/outline-form/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@phase2/outline-form",
3-
"version": "0.1.4",
3+
"version": "0.1.6",
44
"description": "The Outline Components for the form component",
55
"keywords": [
66
"outline components",
@@ -29,7 +29,7 @@
2929
},
3030
"dependencies": {
3131
"@phase2/outline-core": "^0.2.5",
32-
"@phase2/outline-controller-light-dom-styles-controller": "^0.0.2",
32+
"@phase2/outline-controller-light-dom-styles-controller": "^0.0.4",
3333
"lit": "^2.3.1",
3434
"tslib": "^2.1.0"
3535
},

packages/controllers/@deprecated/light-dom-styles/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# @phase2/outline-controller-light-dom-styles-controller
22

3+
## 0.0.4
4+
5+
### Patch Changes
6+
7+
- Documentation Updates
8+
9+
## 0.0.3
10+
11+
### Patch Changes
12+
13+
- Documentation updates
14+
315
## 0.0.2
416

517
### Patch Changes

packages/controllers/@deprecated/light-dom-styles/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![Latest version for outline-controller-light-dom-styles-controller](https://img.shields.io/npm/v/@phase2/outline-controller-light-dom-styles-controller)](https://www.npmjs.com/package/@phase2/outline-controller-light-dom-styles-controller)
2+
13
# `LightDomStyles` Controller
24

35
> This controller is deprecated, and the `StyleController` from `@phase2/outline-controller-style-controller` should be utilized in its place when possible.

packages/controllers/@deprecated/light-dom-styles/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@phase2/outline-controller-light-dom-styles-controller",
3-
"version": "0.0.2",
3+
"version": "0.0.4",
44
"description": "Deprecated controller to manage styles via Light DOM.",
55
"keywords": [
66
"outline components",

packages/controllers/adopted-stylesheets/CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# @phase2/outline-adopted-stylesheets-controller
22

3+
## 0.0.4
4+
5+
### Patch Changes
6+
7+
- Documentation Updates
8+
9+
## 0.0.3
10+
11+
### Patch Changes
12+
13+
- Documentation Update
14+
15+
## 0.0.2
16+
17+
### Patch Changes
18+
19+
- Documentation updates
20+
321
## 0.0.1
422

523
### Patch Changes
Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,53 @@
1-
# AdoptedStyleSheets Controller
1+
# `AdoptedStylesheets` Controller
22

3-
The `AdoptedStyleSheets` controller is a part of the `@phase2/outline-adopted-stylesheets-controller` package. This controller helps components attach "global" document styles without duplication at the component level as well as de-duping any previous inclusions into `AdoptedStyleSheets`.
3+
[![Latest version for outline-adopted-stylesheets-controller](https://img.shields.io/npm/v/@phase2/outline-adopted-stylesheets-controller)](https://www.npmjs.com/package/@phase2/outline-adopted-stylesheets-controller)
4+
5+
> The `AdoptedStylesheets` controller is a part of the `@phase2/outline-adopted-stylesheets-controller` package. This controller helps components attach "global" document styles without duplication at the component level as well as de-duping any previous inclusions into `AdoptedStylesheets`.
6+
7+
## Installing the `AdoptedStylesheets` Controller
8+
9+
Install the new package:
10+
11+
```bash
12+
yarn add @phase2/outline-adopted-stylesheets-controller
13+
```
414

515
## Overview
616

7-
Adopted stylesheets are a way to apply styles to a document or a shadow root. They are a part of the CSS Shadow Parts specification. You can read more about them [here](https://wicg.github.io/construct-stylesheets/).
17+
Adopted stylesheets are a method to apply styles to a document or a shadow root. They are a part of the CSS Shadow Parts specification. Unfortunately, the original documentation link is no longer available. However, you can find more information about adopted stylesheets and their usage in web components in the following resources:
18+
19+
- [MDN Web Docs: Document adoptedStyleSheets](https://developer.mozilla.org/en-US/docs/Web/API/Document/adoptedStyleSheets): This documentation provides an in-depth look at the `adoptedStyleSheets` property of the `Document` interface.
20+
- [MDN Web Docs: ShadowRoot adoptedStyleSheets](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/adoptedStyleSheets): This documentation provides an in-depth look at the `adoptedStyleSheets` property of the `ShadowRoot` interface.
821

922
## Methods
1023

11-
The `AdoptedStyleSheets` controller provides the following methods:
24+
The `AdoptedStylesheets` controller provides the following methods:
1225

13-
- `constructor(globalStyles: CSSResult)`: This method is used to create a new instance of the `AdoptedStyleSheets` controller. It takes a `CSSResult` object as a parameter, which represents the global styles to be adopted.
26+
- `constructor(globalStyles: CSSResult)`: This method is used to create a new instance of the `AdoptedStylesheets` controller. It takes a `CSSResult` object as a parameter, which represents the global styles to be adopted.
1427

1528
- `hostConnected()`: This method is called when the host element is connected to the DOM. It adds the document's stylesheet to the adopted stylesheets if it is not already present.
1629

1730
- `hostDisconnected()`: This method is called when the host element is disconnected from the DOM. It removes the document's stylesheet from the adopted stylesheets if it is present.
1831

1932
## Usage
2033

21-
Here is an example of how to use the `AdoptedStyleSheets` controller in a component:
34+
Here is an example of how to use the `AdoptedStylesheets` controller in a component:
2235

2336
```typescript
24-
import { AdoptedStyleSheets } from '@phase2/outline-adopted-stylesheets-controller';
37+
import { AdoptedStylesheets } from '@phase2/outline-adopted-stylesheets-controller';
2538
import { css, CSSResult } from 'lit';
2639
import { OutlineElement } from '@phase2/outline-core';
2740
import globalStyles from './my-component.lightDom.css.lit';
2841

2942
class MyComponent extends OutlineElement {
30-
adoptedStylesheets: AdoptedStyleSheets;
43+
AdoptedStylesheets: AdoptedStylesheets;
3144

3245
connectedCallback() {
3346
super.connectedCallback();
34-
this.adoptedStylesheets = new AdoptedStyleSheets(globalStyles);
35-
this.addController(this.adoptedStylesheets);
47+
this.AdoptedStylesheets = new AdoptedStylesheets(globalStyles);
48+
this.addController(this.AdoptedStylesheets);
3649
}
3750
}
3851
```
3952

40-
In the provided example, the `connectedCallback` method is utilized. This method is invoked whenever the element is inserted into the DOM. Within this method, an instance of `AdoptedStyleSheets` is created and added as a controller. This is a more efficient approach than creating the instance and adding the controller within the `constructor`. The reason for this is that it delays these operations until the element is actually inserted into the DOM. If there are many such elements that are created but not immediately added to the DOM, this approach can significantly improve the startup performance of your application. Therefore, the `connectedCallback` method is a crucial part of managing the lifecycle of a web component, especially when dealing with adopted stylesheets.
53+
In the provided example, the `connectedCallback` method is utilized. This method is invoked whenever the element is inserted into the DOM. Within this method, an instance of `AdoptedStylesheets` is created and added as a controller. This is a more efficient approach than creating the instance and adding the controller within the `constructor`. The reason for this is that it delays these operations until the element is actually inserted into the DOM. If there are many such elements that are created but not immediately added to the DOM, this approach can significantly improve the startup performance of your application. Therefore, the `connectedCallback` method is a crucial part of managing the lifecycle of a web component, especially when dealing with adopted stylesheets.

packages/controllers/adopted-stylesheets/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@phase2/outline-adopted-stylesheets-controller",
3-
"version": "0.0.1",
3+
"version": "0.0.4",
44
"description": "Controller to help with managing native AdoptedStylesheet implementations.",
55
"keywords": [
66
"outline components",

0 commit comments

Comments
 (0)