@lit-material/divider 0.0.1
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 +21 -0
- package/README.md +60 -0
- package/dist/divider-styles.d.ts +2 -0
- package/dist/divider-styles.d.ts.map +1 -0
- package/dist/divider-styles.js +43 -0
- package/dist/divider-styles.js.map +1 -0
- package/dist/divider.d.ts +33 -0
- package/dist/divider.d.ts.map +1 -0
- package/dist/divider.js +66 -0
- package/dist/divider.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +60 -0
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
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @lit-material/divider
|
|
2
|
+
|
|
3
|
+
A Material Design 3 divider web component built with [Lit](https://lit.dev/). Part of
|
|
4
|
+
[lit-material](https://github.com/bohdaq/lit-material).
|
|
5
|
+
|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install @lit-material/divider @lit-material/tokens
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```html
|
|
17
|
+
<link rel="stylesheet" href="node_modules/@lit-material/tokens/css/index.css" />
|
|
18
|
+
<script type="module">
|
|
19
|
+
import "@lit-material/divider";
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<!-- Full-bleed (default). -->
|
|
23
|
+
<lit-material-divider></lit-material-divider>
|
|
24
|
+
|
|
25
|
+
<!-- Inset — e.g. aligned with a list item's text, not its leading icon. -->
|
|
26
|
+
<lit-material-divider inset-start></lit-material-divider>
|
|
27
|
+
|
|
28
|
+
<!-- "Middle inset" — indented on both sides. -->
|
|
29
|
+
<lit-material-divider inset-start inset-end></lit-material-divider>
|
|
30
|
+
|
|
31
|
+
<!-- Vertical, e.g. between two toolbar buttons in a flex row. -->
|
|
32
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
33
|
+
<lit-material-button variant="text">Cut</lit-material-button>
|
|
34
|
+
<lit-material-divider orientation="vertical"></lit-material-divider>
|
|
35
|
+
<lit-material-button variant="text">Copy</lit-material-button>
|
|
36
|
+
</div>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## API
|
|
40
|
+
|
|
41
|
+
| Property | Attribute | Type | Default |
|
|
42
|
+
| ------------- | --------------- | -------------------------------- | -------------- |
|
|
43
|
+
| `orientation` | `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` |
|
|
44
|
+
| `insetStart` | `inset-start` | `boolean` | `false` |
|
|
45
|
+
| `insetEnd` | `inset-end` | `boolean` | `false` |
|
|
46
|
+
|
|
47
|
+
No slot — purely visual, with no shadow DOM content at all. The host element itself *is* the
|
|
48
|
+
line, styled directly via `:host`. No dependency on `@lit-material/core` (nothing to click or
|
|
49
|
+
focus).
|
|
50
|
+
|
|
51
|
+
`insetStart`/`insetEnd` indent the line on the axis perpendicular to it — inline (left/right) for
|
|
52
|
+
a horizontal divider, block (top/bottom) for a vertical one. Neither set is a full-bleed divider;
|
|
53
|
+
both set is MD3's "middle inset" variant.
|
|
54
|
+
|
|
55
|
+
`role="separator"` is set automatically, with `aria-orientation="vertical"` added when
|
|
56
|
+
`orientation` is vertical (the ARIA default is horizontal, so it's omitted in that case).
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"divider-styles.d.ts","sourceRoot":"","sources":["../src/divider-styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAwClB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
height: 1px;
|
|
7
|
+
width: 100%;
|
|
8
|
+
background-color: var(--md-sys-color-outline-variant, #cac4d0);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* Inset: indented from the axis perpendicular to the line itself — the
|
|
12
|
+
inline (left/right) axis for a horizontal divider. */
|
|
13
|
+
:host([inset-start]) {
|
|
14
|
+
margin-inline-start: 16px;
|
|
15
|
+
width: auto;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host([inset-end]) {
|
|
19
|
+
margin-inline-end: 16px;
|
|
20
|
+
width: auto;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:host([orientation="vertical"]) {
|
|
24
|
+
display: inline-block;
|
|
25
|
+
align-self: stretch;
|
|
26
|
+
height: auto;
|
|
27
|
+
width: 1px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* Vertical: "inset" indents the block (top/bottom) axis instead. */
|
|
31
|
+
:host([orientation="vertical"][inset-start]) {
|
|
32
|
+
margin-inline-start: 0;
|
|
33
|
+
margin-block-start: 16px;
|
|
34
|
+
width: 1px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:host([orientation="vertical"][inset-end]) {
|
|
38
|
+
margin-inline-end: 0;
|
|
39
|
+
margin-block-end: 16px;
|
|
40
|
+
width: 1px;
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
//# sourceMappingURL=divider-styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"divider-styles.js","sourceRoot":"","sources":["../src/divider-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCxB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export type DividerOrientation = "horizontal" | "vertical";
|
|
3
|
+
/**
|
|
4
|
+
* Material Design 3 divider — a thin line that groups or separates content,
|
|
5
|
+
* typically inside a list or between sections.
|
|
6
|
+
*
|
|
7
|
+
* Purely visual: no slot, no shadow DOM content at all (`render()` returns
|
|
8
|
+
* nothing) — the host element itself *is* the line, styled directly via
|
|
9
|
+
* `:host`. No dependency on `@lit-material/core` (nothing to click or
|
|
10
|
+
* focus).
|
|
11
|
+
*
|
|
12
|
+
* `insetStart`/`insetEnd` indent the line on the axis perpendicular to it
|
|
13
|
+
* (inline/left-right for a horizontal divider, block/top-bottom for a
|
|
14
|
+
* vertical one) — e.g. to align a divider under a list item's text with a
|
|
15
|
+
* leading icon it doesn't run under. Both unset is a full-bleed divider;
|
|
16
|
+
* both set is MD3's "middle inset" variant.
|
|
17
|
+
*
|
|
18
|
+
* @element lit-material-divider
|
|
19
|
+
*/
|
|
20
|
+
export declare class LitMaterialDivider extends LitElement {
|
|
21
|
+
static styles: import("lit").CSSResult;
|
|
22
|
+
orientation: DividerOrientation;
|
|
23
|
+
insetStart: boolean;
|
|
24
|
+
insetEnd: boolean;
|
|
25
|
+
protected willUpdate(): void;
|
|
26
|
+
render(): symbol;
|
|
27
|
+
}
|
|
28
|
+
declare global {
|
|
29
|
+
interface HTMLElementTagNameMap {
|
|
30
|
+
"lit-material-divider": LitMaterialDivider;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=divider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"divider.d.ts","sourceRoot":"","sources":["../src/divider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAW,MAAM,KAAK,CAAC;AAI1C,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,UAAU,CAAC;AAE3D;;;;;;;;;;;;;;;;GAgBG;AACH,qBACa,kBAAmB,SAAQ,UAAU;IAChD,OAAgB,MAAM,0BAAU;IAEH,WAAW,EAAE,kBAAkB,CAAgB;IACN,UAAU,UAAS;IACrB,QAAQ,UAAS;cAElE,UAAU,IAAI,IAAI;IAa5B,MAAM;CAGhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,sBAAsB,EAAE,kBAAkB,CAAC;KAC5C;CACF"}
|
package/dist/divider.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
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 { LitElement, nothing } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import { styles } from "./divider-styles.js";
|
|
10
|
+
/**
|
|
11
|
+
* Material Design 3 divider — a thin line that groups or separates content,
|
|
12
|
+
* typically inside a list or between sections.
|
|
13
|
+
*
|
|
14
|
+
* Purely visual: no slot, no shadow DOM content at all (`render()` returns
|
|
15
|
+
* nothing) — the host element itself *is* the line, styled directly via
|
|
16
|
+
* `:host`. No dependency on `@lit-material/core` (nothing to click or
|
|
17
|
+
* focus).
|
|
18
|
+
*
|
|
19
|
+
* `insetStart`/`insetEnd` indent the line on the axis perpendicular to it
|
|
20
|
+
* (inline/left-right for a horizontal divider, block/top-bottom for a
|
|
21
|
+
* vertical one) — e.g. to align a divider under a list item's text with a
|
|
22
|
+
* leading icon it doesn't run under. Both unset is a full-bleed divider;
|
|
23
|
+
* both set is MD3's "middle inset" variant.
|
|
24
|
+
*
|
|
25
|
+
* @element lit-material-divider
|
|
26
|
+
*/
|
|
27
|
+
let LitMaterialDivider = class LitMaterialDivider extends LitElement {
|
|
28
|
+
constructor() {
|
|
29
|
+
super(...arguments);
|
|
30
|
+
this.orientation = "horizontal";
|
|
31
|
+
this.insetStart = false;
|
|
32
|
+
this.insetEnd = false;
|
|
33
|
+
}
|
|
34
|
+
static { this.styles = styles; }
|
|
35
|
+
willUpdate() {
|
|
36
|
+
// Not connectedCallback(): attribute mutations made there don't make it
|
|
37
|
+
// into SSR's serialized host tag (see lit-material-linear-progress for
|
|
38
|
+
// the full explanation) — willUpdate() runs inside the same
|
|
39
|
+
// synchronous pass that produces SSR's output.
|
|
40
|
+
if (!this.hasAttribute("role"))
|
|
41
|
+
this.setAttribute("role", "separator");
|
|
42
|
+
if (this.orientation === "vertical") {
|
|
43
|
+
this.setAttribute("aria-orientation", "vertical");
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
this.removeAttribute("aria-orientation");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
render() {
|
|
50
|
+
return nothing;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
__decorate([
|
|
54
|
+
property({ reflect: true })
|
|
55
|
+
], LitMaterialDivider.prototype, "orientation", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
property({ type: Boolean, attribute: "inset-start", reflect: true })
|
|
58
|
+
], LitMaterialDivider.prototype, "insetStart", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
property({ type: Boolean, attribute: "inset-end", reflect: true })
|
|
61
|
+
], LitMaterialDivider.prototype, "insetEnd", void 0);
|
|
62
|
+
LitMaterialDivider = __decorate([
|
|
63
|
+
customElement("lit-material-divider")
|
|
64
|
+
], LitMaterialDivider);
|
|
65
|
+
export { LitMaterialDivider };
|
|
66
|
+
//# sourceMappingURL=divider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"divider.js","sourceRoot":"","sources":["../src/divider.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI7C;;;;;;;;;;;;;;;;GAgBG;AAEI,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,UAAU;IAA3C;;QAGwB,gBAAW,GAAuB,YAAY,CAAC;QACN,eAAU,GAAG,KAAK,CAAC;QACrB,aAAQ,GAAG,KAAK,CAAC;IAkBvF,CAAC;aAtBiB,WAAM,GAAG,MAAM,AAAT,CAAU;IAMb,UAAU;QAC3B,wEAAwE;QACxE,uEAAuE;QACvE,4DAA4D;QAC5D,+CAA+C;QAC/C,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;YAAE,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QACvE,IAAI,IAAI,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;YACpC,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;QACpD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAEQ,MAAM;QACb,OAAO,OAAO,CAAC;IACjB,CAAC;;AAnB4B;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uDAAgD;AACN;IAArE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sDAAoB;AACrB;IAAnE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDAAkB;AAL1E,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAuB9B"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lit-material/divider",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Material Design 3 divider web component (horizontal or vertical, optionally inset).",
|
|
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/divider"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"lit",
|
|
20
|
+
"web-components",
|
|
21
|
+
"lit-material",
|
|
22
|
+
"material-design",
|
|
23
|
+
"material-design-3",
|
|
24
|
+
"divider"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"main": "./dist/index.js",
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"default": "./dist/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist"
|
|
37
|
+
],
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"lit": "^3.2.0",
|
|
43
|
+
"@lit-material/tokens": "0.0.1"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@lit-labs/ssr": "^3.3.1",
|
|
47
|
+
"@open-wc/testing": "^4.0.0",
|
|
48
|
+
"@web/dev-server-esbuild": "^1.0.0",
|
|
49
|
+
"@web/test-runner": "^0.19.0",
|
|
50
|
+
"@web/test-runner-commands": "^0.9.0",
|
|
51
|
+
"@web/test-runner-playwright": "^0.11.0",
|
|
52
|
+
"tsx": "^4.19.0",
|
|
53
|
+
"typescript": "^5.7.0"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsc -p tsconfig.json",
|
|
57
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
58
|
+
"test": "web-test-runner && node --import tsx --test src/*.ssr.test.ts"
|
|
59
|
+
}
|
|
60
|
+
}
|