-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·275 lines (185 loc) · 14.5 KB
/
index.html
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<!DOCTYPE html>
<!-- Literal template "/Users/stephband/Sites/details-toggle/index.html.literal" -->
<html lang="en">
<head>
<title>details-toggle</title>
<meta charset="utf-8" />
<meta name="author" content="Stephen Band" />
<meta name="description" content="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. The <details-toggle> custom element provides an animated alternative." />
<meta name="viewport" content="width=device-width" />
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@stephband">
<meta property="og:title" content="details-toggle" />
<meta property="og:description" content="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. The <details-toggle> custom element provides an animated alternative." />
<meta property="og:image" content="https://stephen.band/details-toggle/card.jpg" />
<meta property="og:url" content="https://stephen.band/details-toggle/" />
<script title="load">
document.documentElement.className += ' js loading';
// window.addEventListener('DOMContentLoaded', () => document.documentElement.classList.remove('content-loading'));
// Wait for other load handlers to run first - Bolt does a few things on
// load (eg. targetable scrolls) and we want them to run before the loading
// class is removed
window.addEventListener('load', () => window.requestAnimationFrame(() => document.documentElement.classList.remove('loading')));
</script>
<script title="debug">
window.DEBUG = true;
window.detailsToggleStylesheet = 'https://stephen.band/literal/documentation/build/details-toggle/shadow.css';
</script>
<link rel="stylesheet" href="literal/documentation/module.css">
<!--link rel="stylesheet" href="https://stephen.band/literal/documentation/build/module.css"-->
<link rel="preload" as="style" href="https://stephen.band/literal/documentation/build/details-toggle/shadow.css">
<link rel="stylesheet" href="./module.css">
</head>
<body class="4x-grid @1-6x-grid @2-7x-grid @3-9x-grid grid">
<div class="x1 4x @2-x2 x-stretch y-start documentation-block block">
<h1 id="details-toggle"><span class="tag-brace"><</span>details-toggle<span class="tag-brace">></span></h1>
<p>The gods of the World Wide Web, in their eternal wisdom, delivered onto us a
<code><details></code> element that is impossible to style with opening or closing
transitions. So the <code><details-toggle></code> custom element provides an animated
alternative.</p>
<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>
<h2 id="import">Import</h2>
<!--
Download the latest release:
[github.com/stephband/details-toggle/releases](https://github.com/stephband/details-toggle/releases)
-->
<p>Include the CSS:</p>
<pre><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>link</span> <span class="token attr-name">rel</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>stylesheet<span class="token punctuation">"</span></span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>./details-toggle.css<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span></code></pre>
<p>Import and register the <code><details-toggle></code> custom element, upgrading any
instances already in the DOM:</p>
<pre><code class="language-js"><span class="token keyword">import</span> DetailsToggle <span class="token keyword">from</span> <span class="token string">'literal/documentation/templates/details-toggle.js'</span><span class="token punctuation">;</span></code></pre>
<h2 id="use">Use</h2>
<p>A <code>details-toggle</code> is collapsed to the height of its <code>slot="summary"</code> content by
default, and opens to display all content when the summary content is clicked.</p>
<pre><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>details-toggle</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>h4</span> <span class="token attr-name">slot</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>summary<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>Click to open<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>h4</span><span class="token punctuation">></span></span>
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.
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>details-toggle</span><span class="token punctuation">></span></span></code></pre>
</div>
<div class="x1 4x @1-3x @2-x2 x-stretch y-start">
<h3>Attributes</h3>
<details-toggle class="attribute-details-toggle" id="attribute-open">
<h4 class="attribute-text text-05" slot="summary">
<code class="token language-html">open</code>
</h4>
<p>A boolean attribute describing the state of the <code>details-toggle</code>.</p>
</details-toggle>
<h3>Properties</h3>
<details-toggle class="property-details-toggle" id="property-open">
<h4 class="property-text text-05" slot="summary">
<code class="property language-js">.open</code>
</h4>
<p>false
A boolean property describing the state of the <code>details-toggle</code>: <code>true</code>
when the <code>details-toggle</code> is open, <code>false</code> when it is not.</p>
</details-toggle>
<h3>Events</h3>
<details-toggle class="string-details-toggle" id="string-details-activate">
<h4 class="string-text text-05" slot="summary">
<code class=" language-js">"details-activate"</code>
</h4>
<p>Sent from <code>details-toggle</code> when opened.</p>
</details-toggle>
<details-toggle class="string-details-toggle" id="string-details-deactivate">
<h4 class="string-text text-05" slot="summary">
<code class=" language-js">"details-deactivate"</code>
</h4>
<p>Sent from <code>details-toggle</code> when closed.</p>
</details-toggle>
</div>
<div class="x1 4x @1-x4 @1-3x @2-x5 x-stretch y-start">
<h3>Parts</h3>
<details-toggle class="part-details-toggle" id="part-content">
<h4 class="part-text text-05" slot="summary">
<code class=" language-css">::part(content)</code>
</h4>
<p>Style the content block of the <code><details-toggle></code>. Use this to alter the
opening/closing transition. To continue to use the toggle with an opening/closing
animation <code>max-height</code>, <code>margin-bottom</code> and <code>padding-bottom</code> must be included:</p>
<pre><code class="language-css"><span class="token selector">details-toggle::part(content)</span> <span class="token punctuation">{</span>
<span class="token property">transition</span><span class="token punctuation">:</span>
max-height 0.5s <span class="token function">cubic-bezier</span><span class="token punctuation">(</span>0.25<span class="token punctuation">,</span> 0<span class="token punctuation">,</span> 0.5<span class="token punctuation">,</span> 1<span class="token punctuation">)</span><span class="token punctuation">,</span>
margin-bottom 0.5s <span class="token function">cubic-bezier</span><span class="token punctuation">(</span>0.25<span class="token punctuation">,</span> 0<span class="token punctuation">,</span> 0.5<span class="token punctuation">,</span> 1<span class="token punctuation">)</span><span class="token punctuation">,</span>
padding-bottom 0.5s <span class="token function">cubic-bezier</span><span class="token punctuation">(</span>0.25<span class="token punctuation">,</span> 0<span class="token punctuation">,</span> 0.5<span class="token punctuation">,</span> 1<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token selector">details-toggle[open]::part(content)</span> <span class="token punctuation">{</span>
<span class="token property">transition</span><span class="token punctuation">:</span>
max-height 0.3s <span class="token function">cubic-bezier</span><span class="token punctuation">(</span>0.25<span class="token punctuation">,</span> 0<span class="token punctuation">,</span> 0.5<span class="token punctuation">,</span> 1<span class="token punctuation">)</span><span class="token punctuation">,</span>
margin-bottom 0.3s <span class="token function">cubic-bezier</span><span class="token punctuation">(</span>0.25<span class="token punctuation">,</span> 0<span class="token punctuation">,</span> 0.5<span class="token punctuation">,</span> 1<span class="token punctuation">)</span><span class="token punctuation">,</span>
padding-bottom 0.3s <span class="token function">cubic-bezier</span><span class="token punctuation">(</span>0.25<span class="token punctuation">,</span> 0<span class="token punctuation">,</span> 0.5<span class="token punctuation">,</span> 1<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span></code></pre>
</details-toggle>
<h3>Variables</h3>
<details-toggle class="var-details-toggle" id="var-bleed">
<h4 class="var-text text-05" slot="summary">
<code class=" language-css">--bleed</code>
</h4>
<p>A <code><details-toggle></code> hides the overflow of it’s content. Normally this would
truncate shadows and any element that hangs outside its padding box, but to
avoid this the content slot is made to ‘bleed’ larger than the parent box.
This variable controls the bleed distance.</p>
</details-toggle>
</div>
<section class="x1 4x @2-x2 x-stretch y-start">
<h2>Contribute</h2>
<p>
Support development:
<a aria-label="Sponsor @stephband" href="https://github.com/sponsors/stephband" class="githubsponsor-button button">
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" class="fill octicon octicon-heart icon-sponsor mr-1 v-align-middle color-fg-sponsors anim-pulse-in">
<path fill-rule="evenodd" d="M4.25 2.5c-1.336 0-2.75 1.164-2.75 3 0 2.15 1.58 4.144 3.365 5.682A20.565 20.565 0 008 13.393a20.561 20.561 0 003.135-2.211C12.92 9.644 14.5 7.65 14.5 5.5c0-1.836-1.414-3-2.75-3-1.373 0-2.609.986-3.029 2.456a.75.75 0 01-1.442 0C6.859 3.486 5.623 2.5 4.25 2.5zM8 14.25l-.345.666-.002-.001-.006-.003-.018-.01a7.643 7.643 0 01-.31-.17 22.075 22.075 0 01-3.434-2.414C2.045 10.731 0 8.35 0 5.5 0 2.836 2.086 1 4.25 1 5.797 1 7.153 1.802 8 3.02 8.847 1.802 10.203 1 11.75 1 13.914 1 16 2.836 16 5.5c0 2.85-2.045 5.231-3.885 6.818a22.08 22.08 0 01-3.744 2.584l-.018.01-.006.003h-.002L8 14.25zm0 0l.345.666a.752.752 0 01-.69 0L8 14.25z"></path>
</svg>
<span class="v-align-middle">Sponsor</span>
</a>
</p>
<ul>
<li>Contribute to the repo: <a href="https://github.com/stephband/details-toggle"><code>github.com/stephband/details-toggle</code></a></li>
<li>Report a problem: <a href="https://github.com/stephband/details-toggle/issues"><code>github.com/stephband/details-toggle/issues</code></a></li>
</ul>
</section>
<hr class="x1 4x @2-x2 x-stretch" />
<div class="x1 4x @2-x2 x-stretch y-start">
<p class="text-10">
Built by <a href="https://stephen.band">Stephen Band</a> for
<a href="https://cruncher.ch"><img style="width: 1.366666667em; display: inline-block; vertical-align: bottom; margin-top: -0.1em; margin-bottom: -0.1em;" src="https://cruncher.ch/static/images/logo.svg" alt="Cruncher logo"/> Cruncher</a>.
</p>
<p class="text-10">
Documentation set in <a href="https://www.swisstypefaces.com/fonts/euclid/">Euclid</a>
and <a href="https://github.com/evilmartians/mono">Martian Mono</a>. Fonts
used for documentation not included as part of the license covering the
use of <code>details-toggle</code>.
</p>
</div>
<footer class="x1 4x @1-6x @2-7x @3-9x 4x-grid @1-6x-grid @2-7x-grid @3-9x-grid grid grid footer">
<div class="x1 4x @1-2x @2-x2 x-stretch y-start">
<h3>Elements</h3>
<a class="block" href="https://stephen.band/slide-show/"><code><slide-show></code></a>
<a class="block" href="https://stephen.band/details-toggle/"><code><details-toggle></code></a>
<a class="block" href="https://stephen.band/form-elements/rotary-input/"><code><rotary-input></code></a>
<a class="block" href="https://stephen.band/form-elements/range-input/"><code><range-input></code></a>
<a class="block" href="https://stephen.band/form-elements/y-input/"><code><y-input></code></a>
<a class="block" href="https://stephen.band/form-elements/xy-input/"><code><xy-input></code></a>
<a class="block" href="https://stephen.band/form-elements/number-control/"><code><number-control></code></a>
<a class="block" href="https://stephen.band/form-elements/select-control/"><code><select-control></code></a>
<a class="block" href="https://stephen.band/literal/element-template/"><code><element-template></code></a>
<a class="block" href="https://stephen.band/literal/literal-include/"><code><literal-include></code></a>
</div>
<div class="x1 4x @1-2x @1-x3 @2-x4 x-stretch y-start">
<h3>Tools</h3>
<a class="block" href="https://stephen.band/font-size/">Font-size calculator</a>
</div>
</footer>
<script type="module" src="https://stephen.band/literal/documentation/build/module.js"></script>
<!-- Not needed because details-toggle is part of the documentation imports -->
<!--script type="module">
import DetailsToggle from './module.js';
</script-->
</body>