Skip to content

Commit f3db9e9

Browse files
committed
update docs
1 parent cb156dc commit f3db9e9

File tree

7 files changed

+242
-213
lines changed

7 files changed

+242
-213
lines changed

CONTRIBUTING.md

+2-204
Original file line numberDiff line numberDiff line change
@@ -1,207 +1,5 @@
11
# Contributing to Shoelace
22

3-
Shoelace is an open source project, meaning everyone can use it and contribute to its development. When you join our community, you'll find a friendly group of enthusiasts at all experience levels who are willing to chat about anything and everything related to Shoelace.
3+
Before contributing, please review the contributions guidelines at:
44

5-
The easiest way to get started contributing is to join the [community chat](https://discord.gg/mg8f26C). This is where we hang out, discuss new ideas, ask for feedback, and more!
6-
7-
A common misconception about contributing to an open source project is that you need to know how to code. This simply isn't true. In fact, there are _many_ ways to contribute, and some of the most important contributions come from those who never write a single line of code. Here's a list of ways you can make a meaningful contribution to the project:
8-
9-
- Submitting well-written bug reports
10-
- Submitting feature requests that are within the scope of the project
11-
- Improving the documentation
12-
- Responding to users that need help in the community chat
13-
- Triaging issues on GitHub
14-
- Being a developer advocate for the project
15-
- Sponsoring the project financially
16-
- Writing tests
17-
- And, of course, contributing code!
18-
19-
Please take a moment to review these guidelines to make the contribution process as easy as possible for both yourself and the project's maintainers.
20-
21-
## Using the Issue Tracker
22-
23-
The [issue tracker](https://github.com/shoelace-style/shoelace/issues) is for bug reports, feature requests, and pull requests.
24-
25-
- Please **do not** use the issue tracker for personal support requests. Use [the discussion forum](https://github.com/shoelace-style/shoelace/discussions/categories/help) instead.
26-
- Please **do not** derail, hijack, or troll issues. Keep the discussion on topic and be respectful of others.
27-
- Please **do not** post comments with "+1" or "👍". Use [reactions](https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) instead.
28-
- Please **do** use the issue tracker for feature requests, bug reports, and pull requests.
29-
30-
Issues that do not follow these guidelines are subject to closure. There simply aren't enough resources for the author and contributors to troubleshoot personal support requests.
31-
32-
### Feature Requests
33-
34-
Feature requests can be added using the issue tracker.
35-
36-
- Please **do** search for an existing request before suggesting a new feature.
37-
- Please **do** use the "👍" reaction to vote for a feature.
38-
- Please **do** share substantial use cases and perspective that support new features if they haven't already been mentioned.
39-
- Please **do not** bump, spam, or ping contributors to prioritize your own feature.
40-
41-
If you would like your feature prioritized, please consider [sponsoring the project](https://github.com/sponsors/claviska).
42-
43-
### Bug Reports
44-
45-
A bug is _a demonstrable problem_ caused by code in the library. Bug reports are an important contribution to the quality of the project. When submitting a bug report, there are a few steps you can take to make sure your issues gets attention quickly.
46-
47-
- Please **do not** paste in large blocks of irrelevant code
48-
- Please **do** search for an existing issue before creating a new one
49-
- Please **do** explain the bug clearly
50-
- Please **do** provide a minimal test case that demonstrates the bug (e.g. [jsfiddle.net](https://jsfiddle.net/) or [CodePen](https://codepen.io/))
51-
- Please **do** provide additional information, when necessary, to replicate the bug
52-
53-
**A minimal test case is critical to a successful bug report.** It demonstrates that the bug exists in the library and not in surrounding code. Contributors should be able to understand the bug without studying your code, otherwise they'll probably move on to another bug.
54-
55-
If you would like your bug prioritized, please consider [sponsoring the project](https://github.com/sponsors/claviska).
56-
57-
### Pull Requests
58-
59-
To keep the project on track, please consider the following guidelines before submitting a PR.
60-
61-
- Please **do not** submit a PR without opening an issue first, especially for non-trivial changes. This may prevent you from doing work that won't be accepted for various reasons (e.g. someone is already working on it, it's not a good fit for the project, it needs additional planning, etc.)
62-
- Please **do** make sure your PR clearly defines what you're changing. Even if you feel your changes are obvious, please explain them so other contributors can more easily review your works. PRs without detailed descriptions are subject to closure pending more details.
63-
- Please **do not** edit anything in `dist/`. These files are generated automatically, so you need to edit the source files instead.
64-
65-
The author reserves the right to reject any PR that's outside the scope of the project or doesn't meet code quality standards.
66-
67-
### Branches
68-
69-
`current` - This branch reflects the latest release and powers [shoelace.style](https://shoelace.style/).
70-
71-
`next` - This branch is where pull requests will land. It reflects what's coming in the _next_ release, which can be previewed at [next.shoelace.style](https://next.shoelace.style/).
72-
73-
## Conventions
74-
75-
This section aims to describe some of the design decisions and code conventions that support the project. All contributors are expected to follow conventions and best practices, even those not explicitly defined in this document. When in doubt, refer to existing source code and execute your best judgment.
76-
77-
In order to keep the project in a maintainable state, code that doesn't follow conventions and best practices will need to be refactored before it will be accepted. This isn't a knock on your code or your style — it's something the author considers necessary to operate a successful open source project.
78-
79-
### Semantic Versioning
80-
81-
Shoelace follows [Semantic Versioning](https://semver.org/). Breaking changes in components with the "Stable" badge will not be accepted until the next major version. As such, all contributions must consider the project's roadmap and take this into consideration. Features that are deemed no longer necessary will be deprecated but not removed.
82-
83-
Components with the "Experimental" badge should not be used in production. They are made available as release candidates for development and testing purposes. As such, changes to experimental components will not be subject to semantic versioning.
84-
85-
### Code Formatting & Linting
86-
87-
The majority of code formatting is handled automatically by [Prettier](https://prettier.io/) at build time. However, for the best experience, you should [install it in your editor](https://prettier.io/docs/en/editors.html) and enable format on save.
88-
89-
Linting is run automatically at build time. By design, the project will not build if the linter is unhappy. Contributors are strongly encouraged to install an ESLint plugin for your editor for the best developer experience.
90-
91-
### BEM Class Names
92-
93-
All components use a [shadow DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM), so styles are completely encapsulated from the rest of the document. As a result, class names _inside_ a component won't conflict with class names _outside_ the component, so we're free to name them whatever we want.
94-
95-
Internally, each component uses the [BEM methodology](http://getbem.com/) for its class names. There is no technical requirement to do this — it's purely the preference of the author. However, all contributions are expected to follow this practice for the sake of consistency.
96-
97-
## Developer Tips
98-
99-
### Documentation is the key to success
100-
101-
Nobody likes writing documentation, but not having good docs is frustrating to users and makes the project less appealing. Fortunately, writing documentation for Shoelace is really easy!
102-
103-
A lot of the documentation is generated automatically based on JSDoc comments in each component's source code. If you have ESLint enabled, your editor will tell you when a comment is missing. This may feel a bit naggy, but it's a very good thing. Every property, method, event, etc. is documented this way. By adding comments as you code, the docs are more easily kept up to date.
104-
105-
The documentation pages are served up by [Docsify](https://docsify.now.sh/). Check out `docs/_sidebar.md` and `docs/components/` to get an idea of how pages are created and formatted. If you're creating a new component, it may help to use an existing component's markdown file as a template.
106-
107-
If you need help with documentation, feel free to reach out!
108-
109-
### Choose composability when possible
110-
111-
When designed right, web components are highly composable, meaning you can easily reuse them in other components. This reduces the overall size of the library, expedites feature development, and maintains a consistent user experience throughout.
112-
113-
The select component, for example, makes use of the dropdown, input, and menu components. Because it's offloading most of its functionality and styles to these lower-level components, the select component remains very lightweight and its appearance and behavior is consistent with other form controls and menus.
114-
115-
### When to use a standard property vs. a CSS custom property
116-
117-
When designing a component's API, standard properties ("props") are generally used to change the _behavior_ of a component, whereas CSS custom properties ("CSS variables") are used to change the _appearance_ of a component. Remember that props can't respond to media queries, but CSS variables can.
118-
119-
There are some exceptions to this (e.g. when it significantly improves developer experience), but a good rule of thumbs is "will this need to change based on screen size?" If so, you probably want to use a CSS variable.
120-
121-
### Custom event names
122-
123-
All custom events must start with `sl-` as a namespace. For compatibility with frameworks that utilize DOM templates, custom events must have lowercase, kebab-style names. For example, use `sl-change` instead of `slChange`.
124-
125-
This convention avoids the problem of browsers lowercasing attributes, causing some frameworks to be unable to listen to them. This problem isn't specific to one framework, but [Vue's documentation](https://vuejs.org/v2/guide/components-custom-events.html#Event-Names) provides a good explanation of the problem.
126-
127-
> Additionally, `v-on` event listeners inside DOM templates will be automatically transformed to lowercase (due to HTML’s case-insensitivity), so `v-on:myEvent` would become `v-on:myevent` – making `myEvent` impossible to listen to.
128-
129-
### When to use a CSS custom property vs. a CSS part
130-
131-
There are two ways to enable customizations for components. One way is with CSS custom properties ("CSS variables"), the other is with CSS parts ("parts").
132-
133-
CSS variables are scoped to the host element and can be reused throughout the component. A good example of a CSS variable would be `--border-width`, which might get reused throughout a component to ensure borders share the same width for all internal elements.
134-
135-
Parts let you target a specific element inside the component's shadow DOM but, by design, you can't target a part's children or siblings. You can _only_ customize the part itself. Use a part when you need to allow a single element inside the component to accept styles.
136-
137-
This convention can be relaxed when the developer experience is greatly improved by not following these suggestions.
138-
139-
### Boolean Props
140-
141-
Boolean props should _always_ default to `false`, otherwise there's no way for the user to unset it without JavaScript. To keep the API as friendly and consistent as possible, use a name like `noHeader` with a default value of `false` instead of `header` with a default value of `true`.
142-
143-
### A Note About Sass
144-
145-
The Shoelace _source_ is developed using Sass for the convenience of nested selectors, imports, and tedious things such as color palette generation. By design, Sass variables, color functions, and other preprocessor-specific feaures are not used in the source and will not be accepted in a PR.
146-
147-
Consumers of the library should never need to worry about preprocessing the library.
148-
149-
### Positioning Popovers
150-
151-
Shoelace uses an internal popover utility for dropdowns, tooltips, etc. This is a light abstraction of Popper.js designed to make positioning and transitioning things easy and consistent throughout the library. When possible, use this utility instead of relying on Popper directly. See `src/utilities/popover.ts` for details.
152-
153-
### Host and Base Elements
154-
155-
All components have a host element, which is a reference to the actual `<sl-*>` elements. Make sure to always set the host element's `display` property to the appropriate value depending on your needs, as the default is `inline` per the HTML spec.
156-
157-
```css
158-
:host {
159-
display: inline-block;
160-
}
161-
```
162-
163-
Aside from `display`, avoid setting properties on the host element when possible. The reason for this is that styles applied to the host element are not encapsulated. Instead, create a base element that wraps the internals and style that instead. This convention also makes it easier to use BEM in components.
164-
165-
```css
166-
.sl-example {
167-
/* This is the base element */
168-
}
169-
170-
.sl-example--primary {
171-
/* Primary modifier */
172-
}
173-
```
174-
175-
To expose custom properties for a component, define them in the `:host` block and use the following syntax for comments so they appear in the generated docs.
176-
177-
```css
178-
/**
179-
* @param --color: The component's text color.
180-
* @param --background-color: The component's background color.
181-
*/
182-
:host {
183-
--color: white;
184-
--background-color: tomato;
185-
186-
display: inline-block;
187-
}
188-
```
189-
190-
### Conditional Slots
191-
192-
When a component relies on the presence of slotted content to do something, don't assume its initial state is permanent. Slotted content can be added or removed any time and components must be aware of this. A good practice to manage this is:
193-
194-
- Create a `handleSlotChange` method that uses `hasSlot` (imported from `src/utilities/slot.ts`) to update state variables for the associated slot(s)
195-
- Add `onSlotchange={this.handleSlotChange}` to the slots you want to watch
196-
- Never conditionally render `<slot>` elements in a component — always use `hidden` so the slot remains in the DOM and the `slotchange` event can be captured
197-
198-
See the source of card, dialog, or drawer for examples.
199-
200-
### Form Controls
201-
202-
Form controls should support validation through the following conventions:
203-
204-
- All form controls must an `invalid` prop that reflects its validity
205-
- All form controls must have a `setCustomValidity()` method so the user can set a custom validation message
206-
- All form controls must have a `reportValidity()` method that reports its validity during form submission
207-
- All form controls should mirror their native validation attributes such as `required`, `pattern`, `minlength`, `maxlength`, etc. when possible
5+
[shoelace.style/resources/contributing](https://shoelace.style/resources/contributing)

docs/_sidebar.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
- [Usage](/getting-started/usage.md)
55
- [Customizing](/getting-started/customizing.md)
66
- [Themes](/getting-started/themes.md)
7-
- [Community](/getting-started/community.md)
8-
- [Changelog](/getting-started/changelog.md)
7+
8+
- Resources
9+
- [Community](/resources/community.md)
10+
- [Contributing](/resources/contributing.md)
11+
- [Changelog](/resources/changelog.md)
912

1013
- Components
1114
- [Alert](/components/alert.md)
@@ -46,7 +49,7 @@
4649
- [Textarea](/components/textarea.md)
4750
- [Tooltip](/components/tooltip.md)
4851

49-
- Utility Components
52+
- Utilities
5053
- [Animation](/components/animation.md)
5154
- [Format Bytes](/components/format-bytes.md)
5255
- [Format Date](/components/format-date.md)
@@ -65,5 +68,5 @@
6568
- [Z-index](/tokens/z-index.md)
6669

6770
- Tutorials
68-
- [Integrating with Rails](/tutorials/integrating-with-rails.md)
69-
- [Integrating with NextJS](/tutorials/integrating-with-nextjs.md)
71+
- [Integrating with NextJS](/tutorials/integrating-with-nextjs.md)
72+
- [Integrating with Rails](/tutorials/integrating-with-rails.md)
File renamed without changes.

docs/getting-started/community.md renamed to docs/resources/community.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The [discussion forum](https://github.com/shoelace-style/shoelace/discussions) i
1111
- Ask for help
1212
- Share ideas and get feedback
1313
- Show the community what you're working on
14-
- Hang out with other designers, developers, and Shoelace users
14+
- Learn more about the project, its values, and its roadmap
1515

1616
<sl-button type="primary" href="https://github.com/shoelace-style/shoelace/discussions" target="_blank">
1717
Join the Discussion
@@ -24,7 +24,7 @@ The [community chat](https://discord.gg/mg8f26C) is open to the public and power
2424
- Ask for help
2525
- Share ideas and get feedback
2626
- Show the community what you're working on
27-
- Hang out with other designers, developers, and Shoelace users
27+
- Chat live with other designers, developers, and Shoelace fans
2828

2929
<sl-button type="primary" href="https://discord.gg/mg8f26C" target="_blank">
3030
Join the Chat

0 commit comments

Comments
 (0)