@lit-material/back-to-top 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 bohdaq
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,44 @@
1
- # Temporary Holding Version
1
+ # @lit-material/back-to-top
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A "Back to top" button for long pages: it appears once the page has scrolled down, and takes the reader back up and moves focus there. Built with [Lit](https://lit.dev/). Part of [lit-material](https://github.com/bohdaq/lit-material).
4
+
5
+ ## Install
6
+
7
+
8
+ ```sh
9
+ npm install @lit-material/back-to-top @lit-material/tokens
10
+ ```
11
+
12
+
13
+ ## Usage
14
+
15
+
16
+ ```html
17
+ <main id="main">
18
+ <h1>Release notes</h1>
19
+ …
20
+ </main>
21
+ <lit-material-back-to-top target="main"></lit-material-back-to-top>
22
+ ```
23
+
24
+
25
+ ## API
26
+
27
+ | Property | Attribute | Type | Default |
28
+ | ----------- | ----------- | --------- | --------------- |
29
+ | `threshold` | `threshold` | `number` (px scrolled before it shows) | `400` |
30
+ | `target` | `target` | `string` (id of the element at the top) | `""` |
31
+ | `label` | `label` | `string` | `"Back to top"` |
32
+ | `visible` | `visible` (reflected, read it) | `boolean` | `false` |
33
+
34
+ Part: `button`. `--lit-material-back-to-top-inset` (default `16px`) is the distance from the viewport's bottom and end edges.
35
+
36
+ ## Behavior
37
+
38
+ - Fixed to the viewport's bottom end corner; it fades in past `threshold` and out above it. While hidden it's out of the tab order and hidden from assistive technology.
39
+ - With `target`, it's a link to `#target`: a click scrolls there and focuses it (adding `tabindex="-1"` if the element isn't focusable), so keyboard and screen-reader users continue from the top. Without one it scrolls the window to 0. Modified clicks (Ctrl, Cmd, Shift, middle button) behave like a link's.
40
+ - Smooth scrolling, except with `prefers-reduced-motion: reduce`.
41
+
42
+ ## License
43
+
44
+ MIT
@@ -0,0 +1,200 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/back-to-top.ts",
8
+ "declarations": [
9
+ {
10
+ "kind": "class",
11
+ "description": "A \"Back to top\" button for long pages: it appears once the page has\nscrolled past `threshold`, and takes the reader back up — smoothly, unless\nthey prefer reduced motion.\n\nGive it `target`, the id of the element at the top (a page's `<main>` or\n`<h1>`): the button is then an `<a href=\"#target\">` and focus moves there\ntoo, so keyboard and screen-reader users continue from the top instead of\nfrom a button at the bottom. Without a target it scrolls the window to 0.\n\nWhile hidden it's out of the tab order and hidden from assistive\ntechnology.",
12
+ "name": "LitMaterialBackToTop",
13
+ "cssProperties": [
14
+ {
15
+ "description": "Distance from the viewport's bottom and end edges (default `16px`).",
16
+ "name": "--lit-material-back-to-top-inset"
17
+ }
18
+ ],
19
+ "cssParts": [
20
+ {
21
+ "description": "The link.",
22
+ "name": "button"
23
+ }
24
+ ],
25
+ "members": [
26
+ {
27
+ "kind": "field",
28
+ "name": "threshold",
29
+ "type": {
30
+ "text": "number"
31
+ },
32
+ "default": "400",
33
+ "description": "Pixels scrolled before it appears.",
34
+ "attribute": "threshold"
35
+ },
36
+ {
37
+ "kind": "field",
38
+ "name": "target",
39
+ "type": {
40
+ "text": "string"
41
+ },
42
+ "default": "\"\"",
43
+ "description": "Id of the element at the top: scrolled to and focused. Empty: the window's top.",
44
+ "attribute": "target"
45
+ },
46
+ {
47
+ "kind": "field",
48
+ "name": "label",
49
+ "type": {
50
+ "text": "string"
51
+ },
52
+ "default": "\"Back to top\"",
53
+ "attribute": "label"
54
+ },
55
+ {
56
+ "kind": "field",
57
+ "name": "visible",
58
+ "type": {
59
+ "text": "boolean"
60
+ },
61
+ "default": "false",
62
+ "description": "Set while the page is scrolled past `threshold`; reflected.",
63
+ "attribute": "visible",
64
+ "reflects": true
65
+ },
66
+ {
67
+ "kind": "field",
68
+ "name": "ticking",
69
+ "type": {
70
+ "text": "boolean"
71
+ },
72
+ "privacy": "private",
73
+ "default": "false"
74
+ },
75
+ {
76
+ "kind": "field",
77
+ "name": "onScroll",
78
+ "privacy": "private",
79
+ "readonly": true
80
+ },
81
+ {
82
+ "kind": "method",
83
+ "name": "check",
84
+ "privacy": "private",
85
+ "return": {
86
+ "type": {
87
+ "text": "void"
88
+ }
89
+ }
90
+ },
91
+ {
92
+ "kind": "method",
93
+ "name": "targetElement",
94
+ "privacy": "private",
95
+ "return": {
96
+ "type": {
97
+ "text": "HTMLElement | null"
98
+ }
99
+ }
100
+ },
101
+ {
102
+ "kind": "method",
103
+ "name": "onClick",
104
+ "privacy": "private",
105
+ "return": {
106
+ "type": {
107
+ "text": "void"
108
+ }
109
+ },
110
+ "parameters": [
111
+ {
112
+ "name": "event",
113
+ "type": {
114
+ "text": "MouseEvent"
115
+ }
116
+ }
117
+ ]
118
+ }
119
+ ],
120
+ "attributes": [
121
+ {
122
+ "name": "threshold",
123
+ "type": {
124
+ "text": "number"
125
+ },
126
+ "default": "400",
127
+ "description": "Pixels scrolled before it appears.",
128
+ "fieldName": "threshold"
129
+ },
130
+ {
131
+ "name": "target",
132
+ "type": {
133
+ "text": "string"
134
+ },
135
+ "default": "\"\"",
136
+ "description": "Id of the element at the top: scrolled to and focused. Empty: the window's top.",
137
+ "fieldName": "target"
138
+ },
139
+ {
140
+ "name": "label",
141
+ "type": {
142
+ "text": "string"
143
+ },
144
+ "default": "\"Back to top\"",
145
+ "fieldName": "label"
146
+ },
147
+ {
148
+ "name": "visible",
149
+ "type": {
150
+ "text": "boolean"
151
+ },
152
+ "default": "false",
153
+ "description": "Set while the page is scrolled past `threshold`; reflected.",
154
+ "fieldName": "visible"
155
+ }
156
+ ],
157
+ "superclass": {
158
+ "name": "LitElement",
159
+ "package": "lit"
160
+ },
161
+ "tagName": "lit-material-back-to-top",
162
+ "customElement": true
163
+ }
164
+ ],
165
+ "exports": [
166
+ {
167
+ "kind": "js",
168
+ "name": "LitMaterialBackToTop",
169
+ "declaration": {
170
+ "name": "LitMaterialBackToTop",
171
+ "module": "src/back-to-top.ts"
172
+ }
173
+ },
174
+ {
175
+ "kind": "custom-element-definition",
176
+ "name": "lit-material-back-to-top",
177
+ "declaration": {
178
+ "name": "LitMaterialBackToTop",
179
+ "module": "src/back-to-top.ts"
180
+ }
181
+ }
182
+ ]
183
+ },
184
+ {
185
+ "kind": "javascript-module",
186
+ "path": "src/index.ts",
187
+ "declarations": [],
188
+ "exports": [
189
+ {
190
+ "kind": "js",
191
+ "name": "LitMaterialBackToTop",
192
+ "declaration": {
193
+ "name": "LitMaterialBackToTop",
194
+ "module": "./back-to-top.js"
195
+ }
196
+ }
197
+ ]
198
+ }
199
+ ]
200
+ }
@@ -0,0 +1,44 @@
1
+ import { LitElement } from "lit";
2
+ /**
3
+ * A "Back to top" button for long pages: it appears once the page has
4
+ * scrolled past `threshold`, and takes the reader back up — smoothly, unless
5
+ * they prefer reduced motion.
6
+ *
7
+ * Give it `target`, the id of the element at the top (a page's `<main>` or
8
+ * `<h1>`): the button is then an `<a href="#target">` and focus moves there
9
+ * too, so keyboard and screen-reader users continue from the top instead of
10
+ * from a button at the bottom. Without a target it scrolls the window to 0.
11
+ *
12
+ * While hidden it's out of the tab order and hidden from assistive
13
+ * technology.
14
+ *
15
+ * @element lit-material-back-to-top
16
+ *
17
+ * @csspart button - The link.
18
+ *
19
+ * @cssprop --lit-material-back-to-top-inset - Distance from the viewport's bottom and end edges (default `16px`).
20
+ */
21
+ export declare class LitMaterialBackToTop extends LitElement {
22
+ static styles: import("lit").CSSResult;
23
+ /** Pixels scrolled before it appears. */
24
+ threshold: number;
25
+ /** Id of the element at the top: scrolled to and focused. Empty: the window's top. */
26
+ target: string;
27
+ label: string;
28
+ /** Set while the page is scrolled past `threshold`; reflected. */
29
+ visible: boolean;
30
+ private ticking;
31
+ connectedCallback(): void;
32
+ disconnectedCallback(): void;
33
+ private readonly onScroll;
34
+ private check;
35
+ private targetElement;
36
+ private onClick;
37
+ render(): import("lit").TemplateResult<1>;
38
+ }
39
+ declare global {
40
+ interface HTMLElementTagNameMap {
41
+ "lit-material-back-to-top": LitMaterialBackToTop;
42
+ }
43
+ }
44
+ //# sourceMappingURL=back-to-top.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"back-to-top.d.ts","sourceRoot":"","sources":["../src/back-to-top.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AAG5C;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBACa,oBAAqB,SAAQ,UAAU;IAClD,OAAgB,MAAM,0BAwDpB;IAEF,yCAAyC;IACb,SAAS,SAAO;IAE5C,sFAAsF;IAC1E,MAAM,SAAM;IAEZ,KAAK,SAAiB;IAElC,kEAAkE;IACtB,OAAO,UAAS;IAE5D,OAAO,CAAC,OAAO,CAAS;IAEf,iBAAiB,IAAI,IAAI;IAMzB,oBAAoB,IAAI,IAAI;IAKrC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAOvB;IAEF,OAAO,CAAC,KAAK;IAIb,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,OAAO;IAgBN,MAAM;CAUhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,0BAA0B,EAAE,oBAAoB,CAAC;KAClD;CACF"}
@@ -0,0 +1,169 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { css, html, LitElement } from "lit";
8
+ import { customElement, property } from "lit/decorators.js";
9
+ /**
10
+ * A "Back to top" button for long pages: it appears once the page has
11
+ * scrolled past `threshold`, and takes the reader back up — smoothly, unless
12
+ * they prefer reduced motion.
13
+ *
14
+ * Give it `target`, the id of the element at the top (a page's `<main>` or
15
+ * `<h1>`): the button is then an `<a href="#target">` and focus moves there
16
+ * too, so keyboard and screen-reader users continue from the top instead of
17
+ * from a button at the bottom. Without a target it scrolls the window to 0.
18
+ *
19
+ * While hidden it's out of the tab order and hidden from assistive
20
+ * technology.
21
+ *
22
+ * @element lit-material-back-to-top
23
+ *
24
+ * @csspart button - The link.
25
+ *
26
+ * @cssprop --lit-material-back-to-top-inset - Distance from the viewport's bottom and end edges (default `16px`).
27
+ */
28
+ let LitMaterialBackToTop = class LitMaterialBackToTop extends LitElement {
29
+ constructor() {
30
+ super(...arguments);
31
+ /** Pixels scrolled before it appears. */
32
+ this.threshold = 400;
33
+ /** Id of the element at the top: scrolled to and focused. Empty: the window's top. */
34
+ this.target = "";
35
+ this.label = "Back to top";
36
+ /** Set while the page is scrolled past `threshold`; reflected. */
37
+ this.visible = false;
38
+ this.ticking = false;
39
+ this.onScroll = () => {
40
+ if (this.ticking)
41
+ return;
42
+ this.ticking = true;
43
+ requestAnimationFrame(() => {
44
+ this.ticking = false;
45
+ this.check();
46
+ });
47
+ };
48
+ }
49
+ static { this.styles = css `
50
+ :host {
51
+ position: fixed;
52
+ inset-block-end: var(--lit-material-back-to-top-inset, 16px);
53
+ inset-inline-end: var(--lit-material-back-to-top-inset, 16px);
54
+ z-index: 10;
55
+ visibility: hidden;
56
+ opacity: 0;
57
+ transform: translateY(8px);
58
+ transition: opacity 150ms linear, transform 150ms var(--md-sys-motion-easing-standard, cubic-bezier(0.2, 0, 0, 1)), visibility 0s linear 150ms;
59
+ }
60
+ :host([visible]) {
61
+ visibility: visible;
62
+ opacity: 1;
63
+ transform: none;
64
+ transition: opacity 150ms linear, transform 150ms var(--md-sys-motion-easing-standard, cubic-bezier(0.2, 0, 0, 1)), visibility 0s;
65
+ }
66
+ :host([hidden]) {
67
+ display: none;
68
+ }
69
+ a {
70
+ display: inline-flex;
71
+ align-items: center;
72
+ gap: 8px;
73
+ box-sizing: border-box;
74
+ min-height: 40px;
75
+ padding: 0 16px 0 12px;
76
+ border-radius: var(--md-sys-shape-corner-full, 9999px);
77
+ background: var(--md-sys-color-secondary-container, light-dark(#e8def8, #4a4458));
78
+ color: var(--md-sys-color-on-secondary-container, light-dark(#1d192b, #e8def8));
79
+ box-shadow: var(--md-sys-elevation-level3, 0 1px 3px rgb(0 0 0 / 0.3), 0 4px 8px 3px rgb(0 0 0 / 0.15));
80
+ font-family: var(--md-sys-typescale-label-large-font, Roboto, system-ui, sans-serif);
81
+ font-size: var(--md-sys-typescale-label-large-size, 0.875rem);
82
+ font-weight: var(--md-sys-typescale-label-large-weight, 500);
83
+ line-height: var(--md-sys-typescale-label-large-line-height, 1.25rem);
84
+ text-decoration: none;
85
+ }
86
+ a:hover {
87
+ background: color-mix(in srgb, currentColor 8%, var(--md-sys-color-secondary-container, light-dark(#e8def8, #4a4458)));
88
+ }
89
+ a:focus-visible {
90
+ outline: 3px solid var(--md-sys-color-secondary, light-dark(#625b71, #ccc2dc));
91
+ outline-offset: 2px;
92
+ }
93
+ svg {
94
+ width: 18px;
95
+ height: 18px;
96
+ flex: none;
97
+ }
98
+ @media (prefers-reduced-motion: reduce) {
99
+ :host,
100
+ :host([visible]) {
101
+ transform: none;
102
+ transition: none;
103
+ }
104
+ }
105
+ `; }
106
+ connectedCallback() {
107
+ super.connectedCallback();
108
+ window.addEventListener("scroll", this.onScroll, { passive: true });
109
+ this.check();
110
+ }
111
+ disconnectedCallback() {
112
+ super.disconnectedCallback();
113
+ window.removeEventListener("scroll", this.onScroll);
114
+ }
115
+ check() {
116
+ this.visible = window.scrollY > this.threshold;
117
+ }
118
+ targetElement() {
119
+ if (!this.target)
120
+ return null;
121
+ const root = this.getRootNode();
122
+ return root.getElementById?.(this.target) ?? document.getElementById(this.target);
123
+ }
124
+ onClick(event) {
125
+ // Let modified clicks open the link elsewhere, as links do.
126
+ if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
127
+ return;
128
+ event.preventDefault();
129
+ const behavior = matchMedia("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth";
130
+ const target = this.targetElement();
131
+ if (target) {
132
+ target.scrollIntoView({ behavior, block: "start" });
133
+ if (target.tabIndex < 0 && !target.hasAttribute("tabindex"))
134
+ target.setAttribute("tabindex", "-1");
135
+ target.focus({ preventScroll: true });
136
+ }
137
+ else {
138
+ window.scrollTo({ top: 0, behavior });
139
+ this.shadowRoot?.activeElement?.blur();
140
+ }
141
+ }
142
+ render() {
143
+ return html `<a
144
+ part="button"
145
+ href=${`#${this.target}`}
146
+ tabindex=${this.visible ? "0" : "-1"}
147
+ aria-hidden=${this.visible ? "false" : "true"}
148
+ @click=${this.onClick}
149
+ ><svg viewBox="0 0 24 24" aria-hidden="true" fill="currentColor"><path d="M11 20V7.83l-5.59 5.59L4 12l8-8 8 8-1.41 1.42L13 7.83V20z" /></svg>${this.label}</a
150
+ >`;
151
+ }
152
+ };
153
+ __decorate([
154
+ property({ type: Number })
155
+ ], LitMaterialBackToTop.prototype, "threshold", void 0);
156
+ __decorate([
157
+ property()
158
+ ], LitMaterialBackToTop.prototype, "target", void 0);
159
+ __decorate([
160
+ property()
161
+ ], LitMaterialBackToTop.prototype, "label", void 0);
162
+ __decorate([
163
+ property({ type: Boolean, reflect: true })
164
+ ], LitMaterialBackToTop.prototype, "visible", void 0);
165
+ LitMaterialBackToTop = __decorate([
166
+ customElement("lit-material-back-to-top")
167
+ ], LitMaterialBackToTop);
168
+ export { LitMaterialBackToTop };
169
+ //# sourceMappingURL=back-to-top.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"back-to-top.js","sourceRoot":"","sources":["../src/back-to-top.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;GAkBG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,UAAU;IAA7C;;QA2DL,yCAAyC;QACb,cAAS,GAAG,GAAG,CAAC;QAE5C,sFAAsF;QAC1E,WAAM,GAAG,EAAE,CAAC;QAEZ,UAAK,GAAG,aAAa,CAAC;QAElC,kEAAkE;QACtB,YAAO,GAAG,KAAK,CAAC;QAEpD,YAAO,GAAG,KAAK,CAAC;QAaP,aAAQ,GAAG,GAAS,EAAE;YACrC,IAAI,IAAI,CAAC,OAAO;gBAAE,OAAO;YACzB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,qBAAqB,CAAC,GAAG,EAAE;gBAC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,oBAAoB;IADhC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,oBAAoB,CAgIhC"}
@@ -0,0 +1,2 @@
1
+ export { LitMaterialBackToTop } from "./back-to-top.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { LitMaterialBackToTop } from "./back-to-top.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,64 @@
1
1
  {
2
2
  "name": "@lit-material/back-to-top",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Back-to-top button for lit-material: appears after scrolling, returns to the top and moves focus there; a plain anchor without JavaScript.",
5
+ "license": "MIT",
6
+ "author": {
7
+ "name": "bohdaq",
8
+ "email": "bohdaq@gmail.com",
9
+ "url": "https://github.com/bohdaq"
10
+ },
11
+ "homepage": "https://github.com/bohdaq/lit-material#readme",
12
+ "bugs": "https://github.com/bohdaq/lit-material/issues",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+ssh://git@github.com/bohdaq/lit-material.git",
16
+ "directory": "packages/back-to-top"
17
+ },
18
+ "keywords": [
19
+ "lit",
20
+ "web-components",
21
+ "lit-material",
22
+ "material-design",
23
+ "material-design-3",
24
+ "back-to-top",
25
+ "scroll"
26
+ ],
27
+ "type": "module",
28
+ "main": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.ts",
33
+ "default": "./dist/index.js"
34
+ }
35
+ },
36
+ "files": [
37
+ "dist",
38
+ "custom-elements.json"
39
+ ],
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "dependencies": {
44
+ "lit": "^3.2.0",
45
+ "@lit-material/tokens": "0.0.2"
46
+ },
47
+ "devDependencies": {
48
+ "@lit-labs/ssr": "^3.3.1",
49
+ "@open-wc/testing": "^4.0.0",
50
+ "@web/dev-server-esbuild": "^1.0.0",
51
+ "@web/test-runner": "^0.19.0",
52
+ "@web/test-runner-commands": "^0.9.0",
53
+ "@web/test-runner-playwright": "^0.11.0",
54
+ "tsx": "^4.19.0",
55
+ "typescript": "^5.7.0"
56
+ },
57
+ "customElements": "custom-elements.json",
58
+ "scripts": {
59
+ "build": "tsc -p tsconfig.json",
60
+ "typecheck": "tsc -p tsconfig.json --noEmit",
61
+ "test": "web-test-runner && node --import tsx --test src/*.ssr.test.ts",
62
+ "analyze": "custom-elements-manifest analyze --litelement --globs \"src/**/*.ts\" --exclude \"src/**/*.test.ts\" --exclude \"src/**/*.ssr.test.ts\""
63
+ }
6
64
  }