@m3e/divider 1.0.0-rc.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 +22 -0
- package/README.md +95 -0
- package/cem.config.mjs +16 -0
- package/demo/index.html +46 -0
- package/dist/css-custom-data.json +32 -0
- package/dist/custom-elements.json +169 -0
- package/dist/html-custom-data.json +33 -0
- package/dist/index.js +198 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +90 -0
- package/dist/index.min.js.map +1 -0
- package/dist/src/DividerElement.d.ts +62 -0
- package/dist/src/DividerElement.d.ts.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/eslint.config.mjs +13 -0
- package/package.json +48 -0
- package/rollup.config.js +32 -0
- package/src/DividerElement.ts +130 -0
- package/src/index.ts +1 -0
- package/tsconfig.json +9 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 matraic
|
|
4
|
+
Contact: matraic@yahoo.com
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# @m3e/divider
|
|
2
|
+
|
|
3
|
+
The `m3e-divider` component visually separates content within layouts, lists, or containers using a thin, unobtrusive line. It supports horizontal and vertical orientation, with optional inset variants to align with layout padding and visual hierarchy. The divider thickness, color, and inset behavior are customizable via CSS properties to maintain consistency across surfaces. It is designed to reinforce spatial relationships without drawing attention, preserving focus on primary content.
|
|
4
|
+
|
|
5
|
+
> **Part of the [M3E](../../README.md) monorepo**
|
|
6
|
+
> This package is maintained within the unified M3E repository, which provides a suite of Material 3 web components.
|
|
7
|
+
|
|
8
|
+
## ๐ฆ Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @m3e/divider
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## ๐ป Editor Integration
|
|
15
|
+
|
|
16
|
+
This package includes a [Custom Elements Manifest](https://github.com/webcomponents/custom-elements-manifest) to support enhanced editor tooling and developer experience.
|
|
17
|
+
|
|
18
|
+
### Visual Studio Code
|
|
19
|
+
|
|
20
|
+
To enable autocomplete and hover documentation for `@m3e/divider`, install the [Custom Elements Manifest Language Server](https://marketplace.visualstudio.com/items?itemName=pwrs.cem-language-server-vscode) extension. It will automatically detect the manifest bundled with this package and surface tag names, attributes, slots, and events in supported files.
|
|
21
|
+
|
|
22
|
+
Alternately, you can explicitly reference the `html-custom-data.json` and `css-custom-data.json` in your workspace settings:
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"html.customData": ["./node_modules/@m3e/divider/dist/html-custom-data.json"],
|
|
27
|
+
"css.customData": ["./node_modules/@m3e/divider/dist/css-custom-data.json"]
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## ๐ Browser Usage
|
|
32
|
+
|
|
33
|
+
This package uses [JavaScript Modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#module_specifiers). To use it directly in a browser without a bundler, use a module script similar to the following.
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<script type="module" src="/node_modules/@m3e/divider/dist/index.js"></script>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
In addition, you must use an [import map](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script/type/importmap) to include dependencies.
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<script type="importmap">
|
|
43
|
+
{
|
|
44
|
+
"imports": {
|
|
45
|
+
"lit": "https://cdn.jsdelivr.net/npm/lit@3.3.0/+esm",
|
|
46
|
+
"@m3e/core": "/node_modules/@m3e/core/dist/index.js"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
</script>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
> For production, use index.min.js for faster load times.
|
|
53
|
+
|
|
54
|
+
## ๐๏ธ Elements
|
|
55
|
+
|
|
56
|
+
- `m3e-divider` โ A thin line that separates content in lists or other containers.
|
|
57
|
+
|
|
58
|
+
## ๐งช Examples
|
|
59
|
+
|
|
60
|
+
The following example illustrates a basic horizontal divider.
|
|
61
|
+
|
|
62
|
+
```html
|
|
63
|
+
<m3e-divider></m3e-divider>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## ๐ API Reference
|
|
67
|
+
|
|
68
|
+
This section details the attributes and CSS custom properties available for the `m3e-divider` component.
|
|
69
|
+
|
|
70
|
+
### โ๏ธ Attributes
|
|
71
|
+
|
|
72
|
+
| Attribute | Type | Default | Description |
|
|
73
|
+
| ------------- | --------- | ------- | ------------------------------------------------------------------ |
|
|
74
|
+
| `inset` | `boolean` | `false` | Whether the divider is indented with equal padding on both sides. |
|
|
75
|
+
| `inset-start` | `boolean` | `false` | Whether the divider is indented with padding on the leading side. |
|
|
76
|
+
| `inset-end` | `boolean` | `false` | Whether the divider is indented with padding on the trailing side. |
|
|
77
|
+
| `vertical` | `boolean` | `false` | Whether the divider is vertically aligned with adjacent content. |
|
|
78
|
+
|
|
79
|
+
### ๐๏ธ CSS Custom Properties
|
|
80
|
+
|
|
81
|
+
| Property | Description |
|
|
82
|
+
| -------------------------------- | -------------------------------------------------------------------- |
|
|
83
|
+
| `--m3e-divider-thickness` | Thickness of the divider line. |
|
|
84
|
+
| `--m3e-divider-color` | Color of the divider line. |
|
|
85
|
+
| `--m3e-divider-inset-size` | Fallback inset size when no specific start or end inset is provided. |
|
|
86
|
+
| `--m3e-divider-inset-start-size` | Leading inset size. |
|
|
87
|
+
| `--m3e-divider-inset-end-size` | Trailing inset size. |
|
|
88
|
+
|
|
89
|
+
## ๐ค Contributing
|
|
90
|
+
|
|
91
|
+
See the root monorepo `CONTRIBUTING.md` for guidelines on contributing to this package.
|
|
92
|
+
|
|
93
|
+
## ๐ License
|
|
94
|
+
|
|
95
|
+
This package is licensed under the MIT License.
|
package/cem.config.mjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { customElementVsCodePlugin } from "custom-element-vs-code-integration";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
globs: ["src/**/*.ts"],
|
|
5
|
+
exclude: ["src/**/*.spec.ts"],
|
|
6
|
+
packagejson: true,
|
|
7
|
+
outdir: "dist",
|
|
8
|
+
litelement: true,
|
|
9
|
+
plugins: [
|
|
10
|
+
customElementVsCodePlugin({
|
|
11
|
+
outdir: "dist",
|
|
12
|
+
htmlFileName: "html-custom-data.json",
|
|
13
|
+
cssFileName: "css-custom-data.json",
|
|
14
|
+
}),
|
|
15
|
+
],
|
|
16
|
+
};
|
package/demo/index.html
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en" style="overflow-y: auto">
|
|
3
|
+
<head>
|
|
4
|
+
<title>Divider for M3E</title>
|
|
5
|
+
<meta charset="utf-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
<meta name="description" content="Divider for M3E" />
|
|
8
|
+
<base href="./" />
|
|
9
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
10
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
11
|
+
<link
|
|
12
|
+
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap"
|
|
13
|
+
rel="stylesheet"
|
|
14
|
+
/>
|
|
15
|
+
<link
|
|
16
|
+
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0..1,0"
|
|
17
|
+
rel="stylesheet"
|
|
18
|
+
/>
|
|
19
|
+
<script type="importmap">
|
|
20
|
+
{
|
|
21
|
+
"imports": {
|
|
22
|
+
"lit": "https://cdn.jsdelivr.net/npm/lit@3.3.0/+esm",
|
|
23
|
+
"@m3e/core": "../../core/dist/index.min.js"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
</script>
|
|
27
|
+
<script type="module" src="../../theme/dist/index.min.js"></script>
|
|
28
|
+
<script type="module" src="../dist/index.min.js"></script>
|
|
29
|
+
<style>
|
|
30
|
+
body {
|
|
31
|
+
font-family: "Roboto";
|
|
32
|
+
}
|
|
33
|
+
*:not(:defined) {
|
|
34
|
+
display: none;
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
37
|
+
</head>
|
|
38
|
+
<body>
|
|
39
|
+
<m3e-theme strong-focus>
|
|
40
|
+
<br /><br />
|
|
41
|
+
<m3e-divider></m3e-divider>
|
|
42
|
+
<br /><br />
|
|
43
|
+
<m3e-divider inset></m3e-divider>
|
|
44
|
+
</m3e-theme>
|
|
45
|
+
</body>
|
|
46
|
+
</html>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/microsoft/vscode-css-languageservice/main/docs/customData.schema.json",
|
|
3
|
+
"version": 1.1,
|
|
4
|
+
"properties": [
|
|
5
|
+
{
|
|
6
|
+
"name": "--m3e-divider-thickness",
|
|
7
|
+
"description": "Thickness of the divider line.",
|
|
8
|
+
"values": []
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": "--m3e-divider-color",
|
|
12
|
+
"description": "Color of the divider line.",
|
|
13
|
+
"values": []
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "--m3e-divider-inset-size",
|
|
17
|
+
"description": "When inset, fallback inset size used when no specific start or end inset is provided.",
|
|
18
|
+
"values": []
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "--m3e-divider-inset-start-size",
|
|
22
|
+
"description": "When inset, leading inset size.",
|
|
23
|
+
"values": []
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "--m3e-divider-inset-end-size",
|
|
27
|
+
"description": "When inset, trailing inset size.",
|
|
28
|
+
"values": []
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"pseudoElements": []
|
|
32
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"readme": "",
|
|
4
|
+
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"kind": "javascript-module",
|
|
7
|
+
"path": "src/DividerElement.ts",
|
|
8
|
+
"declarations": [
|
|
9
|
+
{
|
|
10
|
+
"kind": "class",
|
|
11
|
+
"description": "",
|
|
12
|
+
"name": "M3eDividerElement",
|
|
13
|
+
"cssProperties": [
|
|
14
|
+
{
|
|
15
|
+
"description": "Thickness of the divider line.",
|
|
16
|
+
"name": "--m3e-divider-thickness"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"description": "Color of the divider line.",
|
|
20
|
+
"name": "--m3e-divider-color"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"description": "When inset, fallback inset size used when no specific start or end inset is provided.",
|
|
24
|
+
"name": "--m3e-divider-inset-size"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"description": "When inset, leading inset size.",
|
|
28
|
+
"name": "--m3e-divider-inset-start-size"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"description": "When inset, trailing inset size.",
|
|
32
|
+
"name": "--m3e-divider-inset-end-size"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"members": [
|
|
36
|
+
{
|
|
37
|
+
"kind": "field",
|
|
38
|
+
"name": "vertical",
|
|
39
|
+
"type": {
|
|
40
|
+
"text": "boolean"
|
|
41
|
+
},
|
|
42
|
+
"default": "false",
|
|
43
|
+
"description": "Whether the divider is vertically aligned with adjacent content.",
|
|
44
|
+
"attribute": "vertical",
|
|
45
|
+
"reflects": true
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"kind": "field",
|
|
49
|
+
"name": "inset",
|
|
50
|
+
"type": {
|
|
51
|
+
"text": "boolean"
|
|
52
|
+
},
|
|
53
|
+
"default": "false",
|
|
54
|
+
"description": "Whether the divider is indented with equal padding on both sides.",
|
|
55
|
+
"attribute": "inset",
|
|
56
|
+
"reflects": true
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"kind": "field",
|
|
60
|
+
"name": "insetStart",
|
|
61
|
+
"type": {
|
|
62
|
+
"text": "boolean"
|
|
63
|
+
},
|
|
64
|
+
"default": "false",
|
|
65
|
+
"description": "Whether the divider is indented with padding on the leading side.",
|
|
66
|
+
"attribute": "inset-start",
|
|
67
|
+
"reflects": true
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"kind": "field",
|
|
71
|
+
"name": "insetEnd",
|
|
72
|
+
"type": {
|
|
73
|
+
"text": "boolean"
|
|
74
|
+
},
|
|
75
|
+
"default": "false",
|
|
76
|
+
"description": "Whether the divider is indented with padding on the trailing side.",
|
|
77
|
+
"attribute": "inset-end",
|
|
78
|
+
"reflects": true
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"attributes": [
|
|
82
|
+
{
|
|
83
|
+
"description": "Whether the divider is indented with equal padding on both sides.",
|
|
84
|
+
"name": "inset",
|
|
85
|
+
"type": {
|
|
86
|
+
"text": "boolean"
|
|
87
|
+
},
|
|
88
|
+
"default": "false",
|
|
89
|
+
"fieldName": "inset"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"description": "Whether the divider is indented with padding on the leading side.",
|
|
93
|
+
"name": "inset-start",
|
|
94
|
+
"type": {
|
|
95
|
+
"text": "boolean"
|
|
96
|
+
},
|
|
97
|
+
"default": "false",
|
|
98
|
+
"fieldName": "insetStart"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"description": "Whether the divider is indented with padding on the trailing side.",
|
|
102
|
+
"name": "inset-end",
|
|
103
|
+
"type": {
|
|
104
|
+
"text": "boolean"
|
|
105
|
+
},
|
|
106
|
+
"default": "false",
|
|
107
|
+
"fieldName": "insetEnd"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"description": "Whether the divider is vertically aligned with adjacent content.",
|
|
111
|
+
"name": "vertical",
|
|
112
|
+
"type": {
|
|
113
|
+
"text": "boolean"
|
|
114
|
+
},
|
|
115
|
+
"default": "false",
|
|
116
|
+
"fieldName": "vertical"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"mixins": [
|
|
120
|
+
{
|
|
121
|
+
"name": "Role",
|
|
122
|
+
"package": "@m3e/core"
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
"superclass": {
|
|
126
|
+
"name": "LitElement",
|
|
127
|
+
"package": "lit"
|
|
128
|
+
},
|
|
129
|
+
"tagName": "m3e-divider",
|
|
130
|
+
"customElement": true,
|
|
131
|
+
"summary": "A thin line that separates content in lists or other containers."
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
"exports": [
|
|
135
|
+
{
|
|
136
|
+
"kind": "js",
|
|
137
|
+
"name": "M3eDividerElement",
|
|
138
|
+
"declaration": {
|
|
139
|
+
"name": "M3eDividerElement",
|
|
140
|
+
"module": "src/DividerElement.ts"
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"kind": "custom-element-definition",
|
|
145
|
+
"name": "m3e-divider",
|
|
146
|
+
"declaration": {
|
|
147
|
+
"name": "M3eDividerElement",
|
|
148
|
+
"module": "src/DividerElement.ts"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"kind": "javascript-module",
|
|
155
|
+
"path": "src/index.ts",
|
|
156
|
+
"declarations": [],
|
|
157
|
+
"exports": [
|
|
158
|
+
{
|
|
159
|
+
"kind": "js",
|
|
160
|
+
"name": "*",
|
|
161
|
+
"declaration": {
|
|
162
|
+
"name": "*",
|
|
163
|
+
"package": "\"./DividerElement\""
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
]
|
|
169
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/microsoft/vscode-html-languageservice/main/docs/customData.schema.json",
|
|
3
|
+
"version": 1.1,
|
|
4
|
+
"tags": [
|
|
5
|
+
{
|
|
6
|
+
"name": "m3e-divider",
|
|
7
|
+
"description": "A thin line that separates content in lists or other containers.\n---\n\n\n### **CSS Properties:**\n - **--m3e-divider-thickness** - Thickness of the divider line. _(default: undefined)_\n- **--m3e-divider-color** - Color of the divider line. _(default: undefined)_\n- **--m3e-divider-inset-size** - When inset, fallback inset size used when no specific start or end inset is provided. _(default: undefined)_\n- **--m3e-divider-inset-start-size** - When inset, leading inset size. _(default: undefined)_\n- **--m3e-divider-inset-end-size** - When inset, trailing inset size. _(default: undefined)_",
|
|
8
|
+
"attributes": [
|
|
9
|
+
{
|
|
10
|
+
"name": "inset",
|
|
11
|
+
"description": "Whether the divider is indented with equal padding on both sides.",
|
|
12
|
+
"values": []
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "inset-start",
|
|
16
|
+
"description": "Whether the divider is indented with padding on the leading side.",
|
|
17
|
+
"values": []
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "inset-end",
|
|
21
|
+
"description": "Whether the divider is indented with padding on the trailing side.",
|
|
22
|
+
"values": []
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "vertical",
|
|
26
|
+
"description": "Whether the divider is vertically aligned with adjacent content.",
|
|
27
|
+
"values": []
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"references": []
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* Copyright (c) 2025 matraic
|
|
4
|
+
* See LICENSE file in the project root for full license text.
|
|
5
|
+
*/
|
|
6
|
+
import { LitElement, css } from 'lit';
|
|
7
|
+
import { Role, DesignToken } from '@m3e/core';
|
|
8
|
+
|
|
9
|
+
/******************************************************************************
|
|
10
|
+
Copyright (c) Microsoft Corporation.
|
|
11
|
+
|
|
12
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
13
|
+
purpose with or without fee is hereby granted.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
16
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
17
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
18
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
19
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
20
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
21
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
22
|
+
***************************************************************************** */
|
|
23
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
function __decorate(decorators, target, key, desc) {
|
|
27
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
28
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
29
|
+
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;
|
|
30
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
34
|
+
var e = new Error(message);
|
|
35
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @license
|
|
40
|
+
* Copyright 2017 Google LLC
|
|
41
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
42
|
+
*/
|
|
43
|
+
const t$1=t=>(e,o)=>{ void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @license
|
|
47
|
+
* Copyright 2019 Google LLC
|
|
48
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
49
|
+
*/
|
|
50
|
+
const t=globalThis,e$1=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),o$2=new WeakMap;let n$2 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$1&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$2.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$2.set(s,t));}return t}toString(){return this.cssText}};const r$2=t=>new n$2("string"==typeof t?t:t+"",void 0,s),S=(s,o)=>{if(e$1)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$1=e$1?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$2(e)})(t):t;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @license
|
|
54
|
+
* Copyright 2017 Google LLC
|
|
55
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
56
|
+
*/const{is:i,defineProperty:e,getOwnPropertyDescriptor:h,getOwnPropertyNames:r$1,getOwnPropertySymbols:o$1,getPrototypeOf:n$1}=Object,a=globalThis,c=a.trustedTypes,l=c?c.emptyScript:"",p=a.reactiveElementPolyfillSupport,d=(t,s)=>t,u={toAttribute(t,s){switch(s){case Boolean:t=t?l:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f=(t,s)=>!i(t,s),b={attribute:true,type:String,converter:u,reflect:false,useDefault:false,hasChanged:f};Symbol.metadata??=Symbol("metadata"),a.litPropertyMetadata??=new WeakMap;class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(d("elementProperties")))return;const t=n$1(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d("properties"))){const t=this.properties,s=[...r$1(t),...o$1(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$1(s));}else void 0!==s&&i.push(c$1(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){const e=this.constructor,h=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??f)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM();}updated(t){}firstUpdated(t){}}y.elementStyles=[],y.shadowRootOptions={mode:"open"},y[d("elementProperties")]=new Map,y[d("finalized")]=new Map,p?.({ReactiveElement:y}),(a.reactiveElementVersions??=[]).push("2.1.1");
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @license
|
|
60
|
+
* Copyright 2017 Google LLC
|
|
61
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
62
|
+
*/const o={attribute:true,type:String,converter:u,reflect:false,hasChanged:f},r=(t=o,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=true),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @summary
|
|
66
|
+
* A thin line that separates content in lists or other containers.
|
|
67
|
+
*
|
|
68
|
+
* @description
|
|
69
|
+
* The `m3e-divider` component visually separates content within layouts, lists, or containers using a thin, unobtrusive line.
|
|
70
|
+
* It supports horizontal and vertical orientation, with optional inset variants to align with layout padding and visual hierarchy.
|
|
71
|
+
* The divider thickness, color, and inset behavior are customizable via CSS properties to maintain consistency across surfaces.
|
|
72
|
+
* It is designed to reinforce spatial relationships without drawing attention, preserving focus on primary content.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* The following example illustrates a basic horizontal divider.
|
|
76
|
+
* ```html
|
|
77
|
+
* <m3e-divider></m3e-divider>
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @tag m3e-divider
|
|
81
|
+
*
|
|
82
|
+
* @attr inset - Whether the divider is indented with equal padding on both sides.
|
|
83
|
+
* @attr inset-start - Whether the divider is indented with padding on the leading side.
|
|
84
|
+
* @attr inset-end - Whether the divider is indented with padding on the trailing side.
|
|
85
|
+
* @attr vertical - Whether the divider is vertically aligned with adjacent content.
|
|
86
|
+
*
|
|
87
|
+
* @cssprop --m3e-divider-thickness - Thickness of the divider line.
|
|
88
|
+
* @cssprop --m3e-divider-color - Color of the divider line.
|
|
89
|
+
* @cssprop --m3e-divider-inset-size - When inset, fallback inset size used when no specific start or end inset is provided.
|
|
90
|
+
* @cssprop --m3e-divider-inset-start-size - When inset, leading inset size.
|
|
91
|
+
* @cssprop --m3e-divider-inset-end-size - When inset, trailing inset size.
|
|
92
|
+
*/
|
|
93
|
+
let M3eDividerElement = class M3eDividerElement extends Role(LitElement, "none") {
|
|
94
|
+
constructor() {
|
|
95
|
+
super(...arguments);
|
|
96
|
+
/**
|
|
97
|
+
* Whether the divider is vertically aligned with adjacent content.
|
|
98
|
+
* @default false
|
|
99
|
+
*/
|
|
100
|
+
this.vertical = false;
|
|
101
|
+
/**
|
|
102
|
+
* Whether the divider is indented with equal padding on both sides.
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
this.inset = false;
|
|
106
|
+
/**
|
|
107
|
+
* Whether the divider is indented with padding on the leading side.
|
|
108
|
+
* @default false
|
|
109
|
+
*/
|
|
110
|
+
this.insetStart = false;
|
|
111
|
+
/**
|
|
112
|
+
* Whether the divider is indented with padding on the trailing side.
|
|
113
|
+
* @default false
|
|
114
|
+
*/
|
|
115
|
+
this.insetEnd = false;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
/** The styles of the element. */
|
|
119
|
+
M3eDividerElement.styles = css `
|
|
120
|
+
:host {
|
|
121
|
+
display: block;
|
|
122
|
+
position: relative;
|
|
123
|
+
}
|
|
124
|
+
:host(:not([vertical])) {
|
|
125
|
+
height: var(--m3e-divider-thickness, 1px);
|
|
126
|
+
width: 100%;
|
|
127
|
+
}
|
|
128
|
+
:host([vertical]) {
|
|
129
|
+
width: var(--m3e-divider-thickness, 1px);
|
|
130
|
+
height: 100%;
|
|
131
|
+
}
|
|
132
|
+
:host::before {
|
|
133
|
+
content: "";
|
|
134
|
+
box-sizing: border-box;
|
|
135
|
+
position: absolute;
|
|
136
|
+
}
|
|
137
|
+
:host(:not([vertical]))::before {
|
|
138
|
+
border-bottom: var(--m3e-divider-thickness, 1px) solid
|
|
139
|
+
var(--m3e-divider-color, ${DesignToken.color.outlineVariant});
|
|
140
|
+
height: inherit;
|
|
141
|
+
}
|
|
142
|
+
:host([vertical])::before {
|
|
143
|
+
border-right: var(--m3e-divider-thickness, 1px) solid
|
|
144
|
+
var(--m3e-divider-color, ${DesignToken.color.outlineVariant});
|
|
145
|
+
width: inherit;
|
|
146
|
+
}
|
|
147
|
+
:host([vertical][inset])::before,
|
|
148
|
+
:host([vertical][inset-start])::before {
|
|
149
|
+
top: var(--m3e-divider-inset-start-size, var(--m3e-divider-inset-size, 1rem));
|
|
150
|
+
}
|
|
151
|
+
:host(:not([vertical])[inset])::before,
|
|
152
|
+
:host(:not([vertical])[inset-start])::before {
|
|
153
|
+
left: var(--m3e-divider-inset-start-size, var(--m3e-divider-inset-size, 1rem));
|
|
154
|
+
}
|
|
155
|
+
:host([vertical][inset])::before,
|
|
156
|
+
:host([vertical][inset-start])::before {
|
|
157
|
+
bottom: var(--m3e-divider-inset-end-size, var(--m3e-divider-inset-size, 1rem));
|
|
158
|
+
}
|
|
159
|
+
:host(:not([vertical])[inset])::before,
|
|
160
|
+
:host(:not([vertical])[inset-start])::before {
|
|
161
|
+
right: var(--m3e-divider-inset-end-size, var(--m3e-divider-inset-size, 1rem));
|
|
162
|
+
}
|
|
163
|
+
:host([vertical]:not([inset]):not([inset-start]))::before {
|
|
164
|
+
top: 0;
|
|
165
|
+
}
|
|
166
|
+
:host(:not([vertical]):not([inset]):not([inset-start]))::before {
|
|
167
|
+
left: 0;
|
|
168
|
+
}
|
|
169
|
+
:host([vertical]:not([inset]):not([inset-end]))::before {
|
|
170
|
+
bottom: 0;
|
|
171
|
+
}
|
|
172
|
+
:host(:not([vertical]):not([inset]):not([inset-end]))::before {
|
|
173
|
+
right: 0;
|
|
174
|
+
}
|
|
175
|
+
@media (forced-colors: active) {
|
|
176
|
+
:host::before {
|
|
177
|
+
border-color: GrayText;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
`;
|
|
181
|
+
__decorate([
|
|
182
|
+
n({ type: Boolean, reflect: true })
|
|
183
|
+
], M3eDividerElement.prototype, "vertical", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
n({ type: Boolean, reflect: true })
|
|
186
|
+
], M3eDividerElement.prototype, "inset", void 0);
|
|
187
|
+
__decorate([
|
|
188
|
+
n({ attribute: "inset-start", type: Boolean, reflect: true })
|
|
189
|
+
], M3eDividerElement.prototype, "insetStart", void 0);
|
|
190
|
+
__decorate([
|
|
191
|
+
n({ attribute: "inset-end", type: Boolean, reflect: true })
|
|
192
|
+
], M3eDividerElement.prototype, "insetEnd", void 0);
|
|
193
|
+
M3eDividerElement = __decorate([
|
|
194
|
+
t$1("m3e-divider")
|
|
195
|
+
], M3eDividerElement);
|
|
196
|
+
|
|
197
|
+
export { M3eDividerElement };
|
|
198
|
+
//# sourceMappingURL=index.js.map
|