-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add registry polyfill info to getting started #345
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
56fa1e2
add registry polyfill info to getting started
20643d9
Update packages/pharos-site/src/pages/getting-started.mdx
ddefe6b
Merge branch 'develop' into docs/registry-polyfill
daneah 3465732
Merge branch 'develop' into docs/registry-polyfill
db52184
chore(deps): add registry polyfill info to getting started
fa127ec
Revert "chore(deps): add registry polyfill info to getting started"
befbc19
chore(docs): fix linting using jsx
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,14 @@ Once installed, the `node_modules/` directory should contain directories similar | |
Pharos uses <PharosLink href="https://developer.mozilla.org/en-US/docs/Web/Web_Components">Web Components</PharosLink> to remain compatible with modern JavaScript frameworks, such as Vue or React. | ||
To accomodate patterns of each framework, the implementations vary slightly. | ||
|
||
You need to first register components on the [custom element registry](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry) for them to be usable in your code. | ||
You will first need to provide the scoped custom element registry to your application. | ||
This is generally achieved by including this script tag in the head of your application. | ||
|
||
```jsx | ||
<script src="https://cdn.jsdelivr.net/npm/@webcomponents/[email protected]/scoped-custom-element-registry.min.js"></script> | ||
``` | ||
|
||
You then need to register components on the [custom element registry](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry) for them to be usable in your code. | ||
To register components, you can use the `registerComponents` utility to define all the Pharos components your application uses, with a consistent scoping prefix: | ||
|
||
```javascript | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest version is 0.0.5. Not sure if that should be the recommendation (perhaps should be tested first).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what would be a satisfactory way to test this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use that version on a page that has at least a couple mfes registering components and ensure there aren't any console/JS errors I'd say.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updating to version >= 0.0.4 ends up breaking some unit tests
specifically
https://github.com/ithaka/pharos/blob/docs/registry-polyfill/packages/pharos/src/components/dropdown-menu/pharos-dropdown-menu-item.test.ts#L117-L139