-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
module.js
executable file
·65 lines (47 loc) · 1.84 KB
/
module.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
<details-toggle>
The gods of the World Wide Web, in their eternal wisdom, delivered onto us a
`<details>` element that is impossible to style with opening or closing
transitions. So the `<details-toggle>` custom element provides an animated
alternative.
<details-toggle>
<h4 slot="summary">Click to open</h4>
Crunchum ipsum dolor sit coder void, constructor function, sed do while loop
python orientation semi colon incident. Duis aute irure indent tabs or spaces
velit esse cilium buntum how crunchy duntum. Excepteur tranquilis syntax
error memorandum qui officia nostrud operating system alertus.
</details-toggle>
## Import
<!--
Download the latest release:
[github.com/stephband/details-toggle/releases](https://github.com/stephband/details-toggle/releases)
-->
Include the CSS:
```html
<link rel="stylesheet" href="./details-toggle.css" />
```
Import and register the `<details-toggle>` custom element, upgrading any
instances already in the DOM:
```js
import DetailsToggle from './details-toggle.js';
```
## Use
A `details-toggle` is collapsed to the height of its `slot="summary"` content by
default, and opens to display all content when the summary content is clicked.
```html
<details-toggle>
<h4 slot="summary">Click to open</h4>
Crunchum ipsum dolor sit coder void, constructor function, sed
do while loop python orientation semi colon incident. Duis aute
irure indent tabs or spaces velit esse cilium buntum how crunchy
duntum.
</details-toggle>
```
**/
import element from '../dom/modules/element.js';
import lifecycle from './modules/lifecycle.js';
import properties from './modules/properties.js';
const stylesheet =
window.detailsToggleStylesheet ||
import.meta.url.replace(/\/[^\/]*([?#].*)?$/, '/') + 'shadow.css';
export default element('<details-toggle>', lifecycle, properties, stylesheet);