Skip to content
This repository was archived by the owner on Nov 13, 2025. It is now read-only.

Commit bce7882

Browse files
authored
Prepare for the elements manifest (#691)
1 parent 2905693 commit bce7882

File tree

116 files changed

+3396
-1474
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+3396
-1474
lines changed

.changeset/ten-monkeys-dress.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@crowdstrike/glide-core': patch
3+
---
4+
5+
Input's `type` attribute is now reflected.

.changeset/twenty-pandas-brake.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
'@crowdstrike/glide-core': minor
3+
---
4+
5+
- Tab Panel no longer has an unused static `instanceCount` property.
6+
- Toggle no longer has a `name` property. `name` only applies to form controls and was unused.
7+
- Tree Item's `hasChildTreeItems` and `hasExpandIcon` properties and its `toggleExpand()` method have been marked private.
8+
9+
Additionally, some internal changes were made to facillitate generating documentation programmatically forced us remove a few exported types and rename some custom properties:
10+
11+
- Input no longer exports a `SUPPORTED_TYPES` interface.
12+
- Toasts no longer exports a `Toast` interface.
13+
- Tab Panel's custom properties have been renamed:
14+
15+
```diff
16+
- --panel-padding-inline-end
17+
+ --padding-inline-end
18+
19+
- --panel-padding-inline-start
20+
+ --padding-inline-start
21+
```

.husky/pre-push

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
NODE_ENV=production pnpm typecheck && NODE_ENV=production pnpm test
4+
NODE_ENV=production pnpm start
5+
NODE_ENV=production pnpm test
6+
NODE_ENV=production pnpm typecheck

.stylelintrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export default {
66
'stylelint-use-nesting',
77
'stylelint-use-logical',
88
'stylelint-order',
9+
'./dist/stylelint/plugin',
910
],
1011
rules: {
1112
// https://github.com/w3c/csswg-drafts/issues/9496
@@ -17,5 +18,6 @@ export default {
1718
'no-descending-specificity': null,
1819
'order/properties-alphabetical-order': true,
1920
'prettier/prettier': true,
21+
'glide-core/no-unprefixed-private-custom-property': true,
2022
},
2123
};

.vscode/settings.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"eslint.workingDirectories": [{ "mode": "auto" }],
3-
"editor.formatOnSave": true,
42
"[javascript]": {
53
"editor.defaultFormatter": "esbenp.prettier-vscode"
64
},
7-
"stylelint.validate": ["css", "postcss", "typescript"],
85
"[typescript]": {
96
"editor.defaultFormatter": "esbenp.prettier-vscode"
10-
}
7+
},
8+
"editor.formatOnSave": true,
9+
"eslint.workingDirectories": [{ "mode": "auto" }],
10+
"stylelint.validate": ["css", "postcss", "typescript"]
1111
}

CONTRIBUTING.md

Lines changed: 26 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -146,44 +146,35 @@ Embrace encapsulation wherever you can.
146146

147147
#### Avoid styling `:host`
148148

149-
Styling `:host` exposes the styles to consumers—allowing internal styles to be overridden.
150-
Due to that, we do not recommend styling `:host` in our components, but rather using CSS variables targeting the tag directly or using a class name.
149+
Styling `:host` exposes styles to consumers—allowing internal styles to be overridden.
150+
Style classes directly instead:
151151

152152
```css
153153
/* ✅ -- GOOD */
154-
/* Target the button tag directly */
155-
button {
156-
background-color: var(--button-background-color);
157-
}
158-
159-
/* Or use a class name <button class="button" */
160154
.button {
161-
background-color: var(--button-background-color);
155+
display: flex;
162156
}
163157
```
164158

165159
```css
166160
/* ❌ -- BAD */
167-
/* Consumers can override via */
168-
/* <cool-button style="background-color: red" which */
169-
/* may not be your intention */
170161
:host {
171-
background-color: #4095bf;
162+
display: flex;
172163
}
173164
```
174165

175166
If you have styles or style variables that apply to the whole component, consider styling a containing element instead.
176-
If your component doesn't have a single containing element, you can add one:
167+
If your component doesn't have a single containing element, simply add one:
177168

178169
```ts
179-
// checkbox.ts
170+
// component.ts
180171
render() {
181172
return html`<div class="component"></div>`
182173
}
183174
```
184175

185176
```ts
186-
// checkbox.styles.ts
177+
// component.styles.ts
187178
import { css } from 'lit';
188179

189180
export default css`
@@ -194,28 +185,26 @@ export default css`
194185

195186
#### Avoid exposing `part`s
196187

197-
[`Part`s](https://developer.mozilla.org/en-US/docs/Web/CSS/::part) expose areas of your UI that consumers can target with CSS, which allows them to customize it to their needs.
198-
Presently, we have no use case for exposing a `part`.
199-
Instead, we should stick with exposing styles via CSS variables until the need arises.
188+
[Parts](https://developer.mozilla.org/en-US/docs/Web/CSS/::part) expose tags within components to arbitrary styling by consumers.
189+
We don't currently have a reason to allow arbitrary styling.
190+
Until we do, use custom properties to allow only certain styles to be overridden.
200191

201192
```ts
202193
// ✅ -- GOOD
203194
@customElement('glide-core-example')
204195
export default class GlideCoreExample extends LitElement {
205196
static override styles = css`
206-
.summary {
207-
font-weight: var(--font-weight-bold);
197+
:host {
198+
--font-weight: 700;
199+
}
200+
201+
.component {
202+
font-weight: var(--font-weight);
208203
}
209204
`;
210205

211206
override render() {
212-
return html`
213-
<details>
214-
<!-- We style the summary directly ourselves -->
215-
<summary class="summary">Details</summary>
216-
<div><slot></slot></div>
217-
</details>
218-
`;
207+
return html`<button class="component">Button</button>`;
219208
}
220209
}
221210
```
@@ -225,13 +214,7 @@ export default class GlideCoreExample extends LitElement {
225214
@customElement('glide-core-example')
226215
export default class GlideCoreExample extends LitElement {
227216
override render() {
228-
return html`
229-
<details>
230-
<!-- We do not want to expose a part -->
231-
<summary part="summary">Details</summary>
232-
<div><slot></slot></div>
233-
</details>
234-
`;
217+
return html` <button part="component">Button</button>`;
235218
}
236219
}
237220
```
@@ -347,24 +330,24 @@ If you need elements from a specific slot, use [assignedElements()](https://deve
347330
#### Prefer using animations only when the user has no reduced motion preference
348331

349332
The [`prefers-reduced-motion`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion) media query is used to detect if a user has enabled a setting on their device to minimize inessential motion.
350-
Our accessibility team recommends only enabling animations when the user doesn't prefer reduced motion.
333+
Our accessibility team recommends only enabling animations when the user has that setting turned off.
351334

352335
```css
353336
/* ✅ -- GOOD */
354337
.animation {
355-
background-color: purple;
338+
transform: translateX(100%);
356339

357340
@media (prefers-reduced-motion: no-preference) {
358-
animation: pulse 1s linear infinite both;
341+
transition: transform 1s;
359342
}
360343
}
361344
```
362345

363346
```css
364347
/* ❌ -- BAD */
365348
.animation {
366-
animation: pulse 1s linear infinite both;
367-
background-color: purple;
349+
transform: translateX(100%);
350+
transition: transform 1s;
368351
}
369352
```
370353

@@ -552,7 +535,7 @@ There are many ways to target the root element of a component in CSS; however, w
552535
// ✅ -- GOOD
553536
css`
554537
.component {
555-
background-color: red;
538+
display: flex;
556539
}
557540
`;
558541

@@ -565,7 +548,7 @@ render() {
565548
// ❌ -- BAD
566549
css`
567550
div {
568-
background-color: red;
551+
display: flex;
569552
}
570553
`;
571554

@@ -616,4 +599,4 @@ So it's best to always override and decorate (using `@property`) inherited prope
616599
It helps clarify how different scripts are used in different contexts.
617600
It also neatly abstracts away specific script names from CI configuration.
618601
619-
In general, think of `:development` scripts as either long-running (`--serve`, `--watch`) or mutative (`--fix`, `--write`) and `:production` scripts as neither of those things.
602+
In general, think of `*:development:*` scripts as long-running (`--serve`, `--watch`) and mutative (`--fix`, `--write`) and `*:production:*` scripts as neither.

eslint.config.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ export default [
4545
'@crowdstrike/glide-core/no-space-press': 'error',
4646
'@crowdstrike/glide-core/prefer-shadow-root-mode': 'error',
4747
'@crowdstrike/glide-core/prefixed-lit-element-class-declaration': 'error',
48+
'@crowdstrike/glide-core/public-member-return-type': 'error',
49+
'@crowdstrike/glide-core/public-getter-default-comment': 'error',
50+
'@crowdstrike/glide-core/event-dispatch-from-this': 'error',
51+
'@crowdstrike/glide-core/string-event-name': 'error',
52+
'@crowdstrike/glide-core/slot-type-comment': 'error',
4853

4954
// Enabling this rule would force us to `await` any function that returns a promise.
5055
// One example is a function that itself `await`s `updateComplete`. The rule is a bit
@@ -289,7 +294,6 @@ export default [
289294
// and other times something else depending on what it's chained with.
290295
...typescript.configs.disableTypeChecked,
291296
},
292-
293297
{
294298
files: ['src/**/*.test.ts', 'src/*.test.*.ts', 'src/*.*.test.*.ts'],
295299
rules: {
@@ -307,6 +311,18 @@ export default [
307311
'@crowdstrike/glide-core/no-skip-tests': 'error',
308312
'@crowdstrike/glide-core/no-to-have-attribute': 'error',
309313
'@crowdstrike/glide-core/prefer-to-be-true-or-false': 'error',
314+
'@crowdstrike/glide-core/public-member-return-type': 'off',
315+
'@crowdstrike/glide-core/public-getter-default-comment': 'off',
316+
'@crowdstrike/glide-core/event-dispatch-from-this': 'off',
317+
'@crowdstrike/glide-core/string-event-name': 'off',
318+
'@crowdstrike/glide-core/slot-type-comment': 'off',
319+
},
320+
},
321+
{
322+
files: ['src/library/**'],
323+
rules: {
324+
'@crowdstrike/glide-core/public-member-return-type': 'off',
325+
'@crowdstrike/glide-core/public-getter-default-comment': 'off',
310326
},
311327
},
312328
];

package.json

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,64 +11,75 @@
1111
},
1212
"files": [
1313
"dist",
14+
"!dist/*.*.test.*.d.ts",
15+
"!dist/*.*.test.*.js",
16+
"!dist/*.stories.d.ts",
17+
"!dist/*.stories.js",
18+
"!dist/*.test.*.d.ts",
19+
"!dist/*.test.*.js",
20+
"!dist/cem-analyzer-plugins",
1421
"!dist/eslint",
1522
"!dist/icons/storybook.*",
1623
"!dist/storybook",
17-
"!dist/*.test.js",
18-
"!dist/*.test.*.d.ts",
19-
"!dist/*.test.*.js",
20-
"!dist/*.stories.js",
21-
"!dist/*.stories.d.ts"
24+
"!dist/stylelint",
25+
"!dist/ts-morph"
2226
],
2327
"exports": {
2428
"./*.js": {
2529
"types": "./dist/*.d.ts",
2630
"import": "./dist/*.js"
2731
},
28-
"./*.styles.js": null,
29-
"./library/*": null,
30-
"./icons/*": null,
31-
"./styles/*": null,
32-
"./label.js": null,
33-
"./toasts.toast.js": null,
32+
"./translations/*": null,
3433
"./tooltip.container.js": null,
34+
"./toasts.toast.js": null,
35+
"./styles/variables.css": "./dist/styles/variables.css",
3536
"./styles/fonts.css": "./dist/styles/fonts.css",
36-
"./styles/variables.css": "./dist/styles/variables.css"
37+
"./styles/*": null,
38+
"./library/*": null,
39+
"./label.js": null,
40+
"./icons/*": null,
41+
"./*.styles.js": null
3742
},
3843
"pnpm": {
3944
"overrides": {
4045
"[email protected]": "^0.25.0",
41-
"[email protected]": "^2.15.4"
46+
"[email protected]": "^2.15.4",
47+
"[email protected]": "1.50.1"
4248
}
4349
},
4450
"scripts": {
4551
"start": "per-env",
46-
"start:development": "storybook dev --config-dir .storybook --no-open --no-version-updates --port 6006",
47-
"start:production": "rimraf ./dist && npm-run-all --parallel start:production:components start:production:storybook start:production:stylesheets --aggregate-output --print-label",
48-
"start:production:components": "tsc --outDir ./dist && node ./terser.js",
52+
"start:development": "npm-run-all --parallel --print-name start:development:*",
53+
"start:development:storybook": "storybook dev --config-dir .storybook --no-open --no-version-updates --port 6006",
54+
"start:production": "rimraf ./dist && npm-run-all --aggregate-output --print-label --parallel start:production:components start:production:storybook start:production:stylesheets",
55+
"start:production:components": "tsc --noCheck --outDir ./dist && node ./terser.js",
4956
"start:production:figma": "pnpm dt export-variables && pnpm dt build-tokens && pnpm dt build-styles",
5057
"start:production:storybook": "storybook build --config-dir .storybook --disable-telemetry --output-dir ./dist/storybook",
5158
"start:production:stylesheets": "node ./esbuild.js",
5259
"format": "per-env",
53-
"format:development": "prettier . --write && stylelint '**/*.styles.ts' --custom-syntax postcss-lit --fix",
54-
"format:production": "prettier . --check && stylelint '**/*.styles.ts' --custom-syntax postcss-lit --no-color",
60+
"format:development": "chokidar '**/*' --ignore 'dist/**' --ignore '.changeset/**' --ignore '.git/**' --ignore 'node_modules/**' --ignore 'pnpm-lock.yaml' --initial --silent --comand 'prettier --write --ignore-unknown {path} && stylelint {path}'",
61+
"format:production": "prettier . --debug-check",
5562
"lint": "per-env",
56-
"lint:development": "npm-run-all --print-name lint:development:*",
57-
"lint:development:eslint": "tsc --outDir ./dist && eslint . --fix",
63+
"lint:development": "npm-run-all --parallel --print-name lint:development:*",
64+
"lint:development:eslint": "chokidar ./eslint-config.js ./src/eslint/** ./src/*.ts ./src/*.*.ts --initial --silent --command 'tsc --noCheck --outDir ./dist && eslint {path} --fix'",
5865
"lint:development:lit-analyzer": "lit-analyzer **/*.ts",
59-
"lint:production": "npm-run-all --parallel --aggregate-output --print-label lint:production:*",
60-
"lint:production:eslint": "tsc --outDir ./dist && eslint .",
66+
"lint:development:stylelint": "chokidar ./.stylelintrc.js ./src/stylelint/** ./src/*.styles.ts ./src/*.*.styles.ts --initial --silent --command 'tsc --noCheck --outDir ./dist && stylelint {path} --custom-syntax postcss-lit --fix'",
67+
"lint:production": "npm-run-all --aggregate-output --print-label --parallel lint:production:*",
68+
"lint:production:eslint": "tsc --noCheck --outDir ./dist && eslint .",
6169
"lint:production:lit-analyzer": "lit-analyzer **/*.ts",
62-
"typecheck": "tsc --noEmit",
70+
"lint:production:stylelint": "tsc --noCheck --outDir ./dist && stylelint '**/*.styles.ts' --custom-syntax postcss-lit --no-color",
6371
"test": "per-env",
64-
"test:development": "npm-run-all --parallel test:development:serve test:development:web-test-runner start:production:stylesheets",
65-
"test:development:serve": "npx http-server dist/coverage/lcov-report --silent",
66-
"test:development:web-test-runner": "web-test-runner --watch",
67-
"test:development:vitest": "vitest --config ./vitest.config.js",
68-
"test:development:vitest:comment": "Vitest is excluded from `test:development` because it muddies the console when running alongside Web Test Runner.",
69-
"test:production": "npm-run-all --parallel test:production:* start:production:stylesheets --aggregate-output --print-label",
70-
"test:production:vitest": "vitest run --config ./vitest.config.js",
71-
"test:production:web-test-runner": "web-test-runner",
72+
"test:development": "pnpm start:production:stylesheets && npm-run-all --parallel test:development:components test:development:serve-component-coverage",
73+
"test:development:components": "web-test-runner --watch",
74+
"test:development:lint-rules": "vitest --config ./vitest.config.js & chokidar './src/eslint/**' './src/stylelint/**' --ignore './src/eslint/rules/*.test.ts' './src/stylelint/*.test.ts' --initial --silent --command 'tsc --noCheck --outDir ./dist'",
75+
"test:development:lint-rules:comment": "Excluded from `test:development` because Vitest muddies the console when running alongside Web Test Runner.",
76+
"test:development:serve-component-coverage": "npx http-server dist/coverage/lcov-report --silent",
77+
"test:production": "pnpm start:production:stylesheets && npm-run-all --aggregate-output --print-label --parallel test:production:*",
78+
"test:production:lint-rules": "tsc --noCheck --outDir ./dist && vitest run --config ./vitest.config.js",
79+
"test:production:components": "web-test-runner",
80+
"typecheck": "per-env",
81+
"typecheck:development": "tsc --outDir ./dist -w",
82+
"typecheck:production": "tsc --outDir ./dist",
7283
"postinstall": "pnpm dlx [email protected] install --with-deps",
7384
"prepare": "is-ci || husky install",
7485
"release": "changeset publish"
@@ -112,6 +123,8 @@
112123
"@web/test-runner-commands": "^0.9.0",
113124
"@web/test-runner-playwright": "^0.11.0",
114125
"chalk": "^5.3.0",
126+
"chokidar-cli": "^3.0.0",
127+
"comment-parser": "^1.4.1",
115128
"esbuild": "^0.25.0",
116129
"eslint": "^9.17.0",
117130
"eslint-config-prettier": "^10.0.1",
@@ -129,6 +142,7 @@
129142
"lit": "^3.2.1",
130143
"lit-analyzer": "^2.0.3",
131144
"minify-literals": "^1.0.10",
145+
"node-html-parser": "^7.0.1",
132146
"npm-run-all2": "^7.0.2",
133147
"per-env": "^1.0.2",
134148
"postcss": "^8.4.49",

0 commit comments

Comments
 (0)