panelset 0.5.0 → 0.5.2
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/dist/index.d.ts +4 -1
- package/dist/panelset.js +25 -12
- package/dist/panelset.js.map +1 -1
- package/package.json +5 -6
- package/src/docs/assets/scripts/copybutton.js +0 -44
- package/src/docs/assets/scripts/example-async.js +0 -161
- package/src/docs/assets/scripts/example-closable.js +0 -27
- package/src/docs/assets/scripts/example-megamenu.js +0 -84
- package/src/docs/assets/scripts/example.js +0 -29
- package/src/docs/assets/scripts/main.js +0 -7
- package/src/docs/assets/styles/_base.scss +0 -13
- package/src/docs/assets/styles/_code.scss +0 -121
- package/src/docs/assets/styles/_demos.scss +0 -180
- package/src/docs/assets/styles/_landingpage.scss +0 -41
- package/src/docs/assets/styles/_layout.scss +0 -80
- package/src/docs/assets/styles/_sidebar.scss +0 -67
- package/src/docs/assets/styles/_typography.scss +0 -116
- package/src/docs/assets/styles/_variables.scss +0 -32
- package/src/docs/assets/styles/docs.scss +0 -64
- package/src/docs/views/api-reference.pug +0 -474
- package/src/docs/views/configuration.pug +0 -173
- package/src/docs/views/events.pug +0 -222
- package/src/docs/views/examples/async.pug +0 -268
- package/src/docs/views/examples/basic.pug +0 -155
- package/src/docs/views/examples/closable.pug +0 -97
- package/src/docs/views/getting-started.pug +0 -99
- package/src/docs/views/index.pug +0 -38
- package/src/docs/views/templates/includes/_head.pug +0 -11
- package/src/docs/views/templates/includes/_mixins.pug +0 -100
- package/src/docs/views/templates/includes/_scripts.pug +0 -14
- package/src/docs/views/templates/includes/_sidebar.pug +0 -18
- package/src/docs/views/templates/layouts/_base.pug +0 -36
- package/src/docs/views/transitions.pug +0 -141
- package/src/lib/index.ts +0 -685
- package/src/lib/styles/_base.scss +0 -99
- package/src/lib/styles/_loading.scss +0 -47
- package/src/lib/styles/_variables.scss +0 -19
- package/src/lib/styles/panelset.scss +0 -3
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
extends /docs/views/templates/layouts/_base
|
|
2
|
-
|
|
3
|
-
append variables
|
|
4
|
-
- pagetitle = "Closable panels"
|
|
5
|
-
|
|
6
|
-
block content
|
|
7
|
-
.lane
|
|
8
|
-
.container
|
|
9
|
-
.page-header
|
|
10
|
-
h1 Closable panels
|
|
11
|
-
|
|
12
|
-
.lane
|
|
13
|
-
.container
|
|
14
|
-
.title-text
|
|
15
|
-
p If you want to be able to close the PanelSet, the main container needs a <code>data-closable</code> attribute. Furthermore, you need to add controls that will trigger the open/close/toggle actions. Below is an example of a script that uses some arbitrary data-attributes to handle these actions. In the end, all they do is call the respective methods on the instance. You may choose your own attributes and code for it. These can then be combined in the markup of your page to create buttons that control the PanelSet.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
.example
|
|
19
|
-
.demo
|
|
20
|
-
.demo-controls
|
|
21
|
-
button(data-panel="demo-closable-panel-1") Panel 1
|
|
22
|
-
button(data-panel="demo-closable-panel-2") Panel 2
|
|
23
|
-
button(data-panel="demo-closable-panel-3") Panel3
|
|
24
|
-
button.secondary(data-panelset-close="#demo-closable") Close
|
|
25
|
-
button.secondary(data-panelset-open="#demo-closable") Open
|
|
26
|
-
button.secondary(data-panelset-toggle="#demo-closable") Toggle
|
|
27
|
-
|
|
28
|
-
+examplepanelset('demo-closable')(data-closable)
|
|
29
|
-
|
|
30
|
-
h2 Markup
|
|
31
|
-
+codeblock('HTML')
|
|
32
|
-
.demo-controls
|
|
33
|
-
button(data-panel="demo-closable-panel-1") Panel 1
|
|
34
|
-
button(data-panel="demo-closable-panel-2") Panel 2
|
|
35
|
-
button(data-panel="demo-closable-panel-3") Panel3
|
|
36
|
-
button.secondary(data-panelset-close="#demo-closable") Close
|
|
37
|
-
button.secondary(data-panelset-open="#demo-closable") Open
|
|
38
|
-
button.secondary(data-panelset-toggle="#demo-closable") Toggle
|
|
39
|
-
|
|
40
|
-
#demo-closable(data-panelset data-closable)
|
|
41
|
-
// Panels here
|
|
42
|
-
|
|
43
|
-
.title-text
|
|
44
|
-
h2 JavaScript
|
|
45
|
-
p The panel switching JavaScript is the same as in the other examples:
|
|
46
|
-
|
|
47
|
-
+codeblock('JS').
|
|
48
|
-
document.addEventListener('click', e => {
|
|
49
|
-
const button = e.target.closest('button[data-panel]');
|
|
50
|
-
if (!button) return;
|
|
51
|
-
const panelId = button.dataset.panel;
|
|
52
|
-
const container = document.getElementById(panelId)?.closest('[data-panelset]');
|
|
53
|
-
container?.panelSet?.show(panelId, true, { trigger: button });
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
p The buttons to open, close or toggle the panelset could be handled like this:
|
|
57
|
-
+codeblock('JS').
|
|
58
|
-
document.addEventListener('click', e => {
|
|
59
|
-
const actions = ['close', 'open', 'toggle'];
|
|
60
|
-
|
|
61
|
-
for (const action of actions) {
|
|
62
|
-
const btn = e.target.closest(`[data-panelset-${action}]`);
|
|
63
|
-
if (btn) {
|
|
64
|
-
const selector = btn.getAttribute(`data-panelset-${action}`);
|
|
65
|
-
const container = document.querySelector(selector);
|
|
66
|
-
|
|
67
|
-
if (container?.panelSet) {
|
|
68
|
-
const withTransition = !btn.hasAttribute('data-no-transition');
|
|
69
|
-
container.panelSet[action](withTransition);
|
|
70
|
-
}
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
append scripts
|
|
84
|
-
if isProd
|
|
85
|
-
script(type="module", vite-ignore).
|
|
86
|
-
import { PanelSet } from '/lib/panelset.js';
|
|
87
|
-
PanelSet.init();
|
|
88
|
-
else
|
|
89
|
-
script(type="module").
|
|
90
|
-
import { PanelSet } from '/src/lib/index.js';
|
|
91
|
-
import '/src/lib/styles/panelset.scss';
|
|
92
|
-
PanelSet.init({debug: true});
|
|
93
|
-
|
|
94
|
-
if isProd
|
|
95
|
-
script(src="/assets/scripts/example-closable.js" type="module" vite-ignore)
|
|
96
|
-
else
|
|
97
|
-
script(type="module" src="/src/docs/assets/scripts/example-closable.js")
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
extends /docs/views/templates/layouts/_base
|
|
2
|
-
|
|
3
|
-
append variables
|
|
4
|
-
- pagetitle = "Getting started"
|
|
5
|
-
|
|
6
|
-
block content
|
|
7
|
-
.lane
|
|
8
|
-
.container
|
|
9
|
-
.page-header
|
|
10
|
-
h1 Getting Started with PanelSet
|
|
11
|
-
p.lead Lightweight panel management with smooth transitions
|
|
12
|
-
|
|
13
|
-
.lane
|
|
14
|
-
.container
|
|
15
|
-
h2 Installation
|
|
16
|
-
.code-block
|
|
17
|
-
.code-header Terminal
|
|
18
|
-
pre
|
|
19
|
-
code npm install panelset
|
|
20
|
-
.lane
|
|
21
|
-
.container
|
|
22
|
-
.title-text
|
|
23
|
-
h2 Quick Start
|
|
24
|
-
p Import the npm package and create your first panelset:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
+codeblock('JS').
|
|
28
|
-
import { PanelSet } from 'panelset';
|
|
29
|
-
import 'panelset/dist/panelset.css';
|
|
30
|
-
.lane
|
|
31
|
-
.container
|
|
32
|
-
.title-text
|
|
33
|
-
h2 Initializing PanelSet
|
|
34
|
-
p You can initialize PanelSet via the static init() method. This will scan the document for all panelset containers (with a <code>data-panelset</code> attribute) and initialize all of them. You can also pass a selector to target only a single panelset container. In both cases, you can also pass an options object:
|
|
35
|
-
|
|
36
|
-
+codeblock('JS').
|
|
37
|
-
// Default selector, no options
|
|
38
|
-
PanelSet.init();
|
|
39
|
-
|
|
40
|
-
// With options only
|
|
41
|
-
PanelSet.init({debug: true});
|
|
42
|
-
|
|
43
|
-
// Custom selector, no options
|
|
44
|
-
PanelSet.init('#demo-panelset');
|
|
45
|
-
|
|
46
|
-
// Both selector and options
|
|
47
|
-
PanelSet.init('#demo-panelset', {debug: true});
|
|
48
|
-
|
|
49
|
-
// Or you can create a named instance directly:
|
|
50
|
-
const demoPanelSet = new PanelSet('#demo-panelset', {debug: true});
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
.lane
|
|
54
|
-
.container
|
|
55
|
-
.title-text
|
|
56
|
-
h2 Markup
|
|
57
|
-
p The main container of your panelset needs a <code>data-panelset</code> attribute. Each panel should have a unique ID and the <code>role="tabpanel"</code> attribute. The active panel should also have the <code>.active</code> class, while inactive panels should have the <code>hidden</code> attribute. You also need to wrap your panels in a <code>.panel-wrapper</code> element for better styling and layout control, but this is auto-generated if missing.
|
|
58
|
-
|
|
59
|
-
.example
|
|
60
|
-
|
|
61
|
-
.demo
|
|
62
|
-
|
|
63
|
-
.demo-controls
|
|
64
|
-
button(data-panel="demo-panel-1") Panel 1
|
|
65
|
-
button(data-panel="demo-panel-2") Panel 2
|
|
66
|
-
button(data-panel="demo-panel-3") Panel3
|
|
67
|
-
+examplepanelset('demo')(data-closable)
|
|
68
|
-
+codeblock('HTML')
|
|
69
|
-
+examplepanelset('demo')(data-closable)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
p To actually control the panelset, you use the #[code show()] method. In this example, we add click event listeners to buttons that activate the corresponding panels when clicked. PanelSet does not tell you how to handle user interactions, so you can implement your own controls as needed, as long as they use the #[code show()] API.
|
|
73
|
-
|
|
74
|
-
+codeblock('JS').
|
|
75
|
-
document.addEventListener('click', event => {
|
|
76
|
-
const button = event.target.closest('button[data-panel]');
|
|
77
|
-
if (!button) return;
|
|
78
|
-
const panelId = button.dataset.panel;
|
|
79
|
-
const container = document.querySelector('[data-panelset]');
|
|
80
|
-
container?.panelSet?.show(panelId, true, { trigger: button });
|
|
81
|
-
});
|
|
82
|
-
//-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
append scripts
|
|
86
|
-
if isProd
|
|
87
|
-
script(type="module", vite-ignore).
|
|
88
|
-
import { PanelSet } from '/lib/panelset.js';
|
|
89
|
-
PanelSet.init({debug: true});
|
|
90
|
-
else
|
|
91
|
-
script(type="module").
|
|
92
|
-
import { PanelSet } from '/src/lib/index.js';
|
|
93
|
-
import '/src/lib/styles/panelset.scss';
|
|
94
|
-
PanelSet.init();
|
|
95
|
-
|
|
96
|
-
if isProd
|
|
97
|
-
script(src="/assets/scripts/example.js" type="module" vite-ignore)
|
|
98
|
-
else
|
|
99
|
-
script(type="module" src="/src/docs/assets/scripts/example.js")
|
package/src/docs/views/index.pug
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
extends /docs/views/templates/layouts/_base
|
|
2
|
-
|
|
3
|
-
append variables
|
|
4
|
-
- pagetitle = "Intro"
|
|
5
|
-
- page.class = 'intro'
|
|
6
|
-
|
|
7
|
-
block content
|
|
8
|
-
.container
|
|
9
|
-
|
|
10
|
-
h1 PanelSet
|
|
11
|
-
p.lead Flexible panel management with smooth transitions. ~2.4 KB gzipped.
|
|
12
|
-
|
|
13
|
-
.example
|
|
14
|
-
.demo-controls.center
|
|
15
|
-
button(data-panel="demo-panel-1") Short panel
|
|
16
|
-
button(data-panel="demo-panel-2") Medium panel
|
|
17
|
-
button(data-panel="demo-panel-3") Tall panel
|
|
18
|
-
+examplepanelset('demo')(data-closable)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
footer
|
|
22
|
-
p #[a(href="https://github.com/martinomagnifico") Martinomagnifico] • Open source • MIT License • TypeScript Ready
|
|
23
|
-
|
|
24
|
-
append scripts
|
|
25
|
-
if isProd
|
|
26
|
-
script(type="module", vite-ignore).
|
|
27
|
-
import { PanelSet } from '/lib/panelset.js';
|
|
28
|
-
PanelSet.init();
|
|
29
|
-
else
|
|
30
|
-
script(type="module").
|
|
31
|
-
import { PanelSet } from '/src/lib/index.js';
|
|
32
|
-
import '/src/lib/styles/panelset.scss';
|
|
33
|
-
PanelSet.init({debug: true });
|
|
34
|
-
|
|
35
|
-
if isProd
|
|
36
|
-
script(type="module" src="/assets/scripts/example.js" vite-ignore)
|
|
37
|
-
else
|
|
38
|
-
script(type="module" src="/src/docs/assets/scripts/example.js")
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
head
|
|
2
|
-
block head
|
|
3
|
-
meta(charset="utf-8")
|
|
4
|
-
meta(name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no")
|
|
5
|
-
meta(http-equiv="X-UA-Compatible" content="IE=edge,chrome=1")
|
|
6
|
-
link(rel="icon", href="data:,")
|
|
7
|
-
block styles
|
|
8
|
-
link(rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/default.min.css")
|
|
9
|
-
link(rel="stylesheet" href="/src/docs/assets/styles/docs.scss")
|
|
10
|
-
if isProd
|
|
11
|
-
link(rel="stylesheet", href="/lib/panelset.css")
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
mixin html
|
|
2
|
-
doctype html
|
|
3
|
-
html(class=page.class, lang=page.language)
|
|
4
|
-
if block
|
|
5
|
-
block
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
mixin badge(pluginname, extraclass)
|
|
9
|
-
a.github-corner(class=extraclass, href=plugin.homepage target="blank" title='View source on GitHub')
|
|
10
|
-
svg(xmlns='http://www.w3.org/2000/svg' viewBox='0 0 55 55')
|
|
11
|
-
path(fill='currentColor' d='M27.5 11.2a16.3 16.3 0 0 0-5.1 31.7c.8.2 1.1-.3 1.1-.7v-2.8c-4.5 1-5.5-2.2-5.5-2.2-.7-1.9-1.8-2.4-1.8-2.4-1.5-1 .1-1 .1-1 1.6.1 2.5 1.7 2.5 1.7 1.5 2.5 3.8 1.8 4.7 1.4.2-1 .6-1.8 1-2.2-3.5-.4-7.3-1.8-7.3-8 0-1.8.6-3.3 1.6-4.4-.1-.5-.7-2.1.2-4.4 0 0 1.4-.4 4.5 1.7a15.6 15.6 0 0 1 8.1 0c3.1-2 4.5-1.7 4.5-1.7.9 2.3.3 4 .2 4.4 1 1 1.6 2.6 1.6 4.3 0 6.3-3.8 7.7-7.4 8 .6.6 1.1 1.6 1.1 3v4.6c0 .4.3.9 1.1.7a16.3 16.3 0 0 0-5.2-31.7')
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
mixin examplepanelset(id)
|
|
15
|
-
div(id=id data-panelset)&attributes(attributes)
|
|
16
|
-
.panel-wrapper
|
|
17
|
-
.active(role="tabpanel", id=`${id}-panel-1`)
|
|
18
|
-
h3 Key Features
|
|
19
|
-
ul
|
|
20
|
-
li This is out most important feature ever!
|
|
21
|
-
|
|
22
|
-
div(role="tabpanel", id=`${id}-panel-2`, hidden)
|
|
23
|
-
h3 Pricing Plans
|
|
24
|
-
ul
|
|
25
|
-
li Starter Plan: Whenever you do not want to pay a lot.
|
|
26
|
-
li Professional Plan: Ideal for managers who like to spend money!
|
|
27
|
-
|
|
28
|
-
div(role="tabpanel", id=`${id}-panel-3`, hidden)
|
|
29
|
-
h3 Support Options
|
|
30
|
-
ul
|
|
31
|
-
li If you send us an email, we will probably ignore it.
|
|
32
|
-
li We don’t even have a community forum.
|
|
33
|
-
li Opening an issue on GitHub is your next best option. Or even better: PR’s! You do the work!
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
mixin revealsrc(kind, thesource)
|
|
38
|
-
- let isProd = process.env.NODE_ENV === 'production';
|
|
39
|
-
if isProd
|
|
40
|
-
if kind === 'script'
|
|
41
|
-
script(src=`${thesource}`)
|
|
42
|
-
else
|
|
43
|
-
link(rel="stylesheet", href=`${thesource}`)
|
|
44
|
-
else
|
|
45
|
-
if kind === 'script'
|
|
46
|
-
script(src=`/node_modules/reveal.js/${thesource}`)
|
|
47
|
-
else
|
|
48
|
-
link(rel="stylesheet", href=`/node_modules/reveal.js/${thesource}`)
|
|
49
|
-
|
|
50
|
-
-
|
|
51
|
-
const reindentCode = (code) => {
|
|
52
|
-
const lines = code.split('\n');
|
|
53
|
-
let minIndent = Infinity;
|
|
54
|
-
|
|
55
|
-
for (const line of lines) {
|
|
56
|
-
if (line.trim().length > 0) {
|
|
57
|
-
const match = line.match(/^(\s*)/);
|
|
58
|
-
if (match && match[1].length < minIndent) {
|
|
59
|
-
minIndent = match[1].length;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (minIndent === Infinity) {
|
|
65
|
-
minIndent = 0;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const deindentedLines = lines.map(line => line.substring(minIndent));
|
|
69
|
-
return deindentedLines.join('\n').trim();
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
mixin escape()
|
|
74
|
-
- var oldBuf = pug_html;
|
|
75
|
-
- pug_html = '';
|
|
76
|
-
block
|
|
77
|
-
- pug_html = oldBuf + pug.escape(pug_html);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
mixin reindent_block_html()
|
|
81
|
-
- var oldBuf = pug_html;
|
|
82
|
-
- pug_html = '';
|
|
83
|
-
block
|
|
84
|
-
- var rawPugSource = pug_html;
|
|
85
|
-
- pug_html = oldBuf;
|
|
86
|
-
- var deindentedCode = reindentCode(rawPugSource)
|
|
87
|
-
- pug_html += deindentedCode
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
mixin codeblock(type)
|
|
91
|
-
.code-block
|
|
92
|
-
.code-header
|
|
93
|
-
| #{type}
|
|
94
|
-
button.copy Copy
|
|
95
|
-
pre
|
|
96
|
-
code(class=`language-${type}`)
|
|
97
|
-
if block
|
|
98
|
-
+escape()
|
|
99
|
-
+reindent_block_html()
|
|
100
|
-
block
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
block scripts
|
|
2
|
-
script(src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js")
|
|
3
|
-
script(src="https://cdnjs.cloudflare.com/ajax/libs/highlightjs-line-numbers.js/2.6.0/highlightjs-line-numbers.min.js")
|
|
4
|
-
|
|
5
|
-
if isProd
|
|
6
|
-
script(src="/assets/scripts/copybutton.js" type="module" vite-ignore)
|
|
7
|
-
|
|
8
|
-
else
|
|
9
|
-
script(type="module" src="/src/docs/assets/scripts/copybutton.js")
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
script.
|
|
13
|
-
hljs.highlightAll();
|
|
14
|
-
hljs.initLineNumbersOnLoad();
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
aside.docs-sidebar
|
|
2
|
-
.logo PanelSet
|
|
3
|
-
|
|
4
|
-
nav
|
|
5
|
-
ul
|
|
6
|
-
each link in sidebar.mainLinks
|
|
7
|
-
- let active = (link.text === pagetitle);
|
|
8
|
-
li
|
|
9
|
-
a(class=(active ? "active" : "") href=link.href) #{link.text}
|
|
10
|
-
|
|
11
|
-
each section in sidebar.sections
|
|
12
|
-
.nav-section
|
|
13
|
-
h4=section.title
|
|
14
|
-
ul
|
|
15
|
-
each link in section.links
|
|
16
|
-
- let active = (link.text === pagetitle);
|
|
17
|
-
li
|
|
18
|
-
a(class=(active ? "active" : "") href=link.href) #{link.text}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
include ../includes/_mixins
|
|
2
|
-
|
|
3
|
-
block variables
|
|
4
|
-
- let page = {title: "Title", language: "en", author: "Author"}
|
|
5
|
-
-
|
|
6
|
-
const sidebar = {
|
|
7
|
-
"mainLinks": [
|
|
8
|
-
{ text: "Intro", href: "/index.html" },
|
|
9
|
-
{ text: "Getting started", href: "/getting-started.html", active: true },
|
|
10
|
-
{ text: "Configuration", href: "/configuration.html" },
|
|
11
|
-
{ text: "Transitions", href: "/transitions.html" },
|
|
12
|
-
{ text: "Events", href: "/events.html" },
|
|
13
|
-
{ text: "API reference", href: "/api-reference.html" }
|
|
14
|
-
],
|
|
15
|
-
"sections": [
|
|
16
|
-
{
|
|
17
|
-
title: "Examples",
|
|
18
|
-
links: [
|
|
19
|
-
{ text: "Basic tabs", href: "/examples/basic.html" },
|
|
20
|
-
{ text: "Async panels", href: "/examples/async.html" },
|
|
21
|
-
{ text: "Closable panels", href: "/examples/closable.html" }
|
|
22
|
-
]
|
|
23
|
-
}
|
|
24
|
-
]
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
+html
|
|
30
|
-
include ../includes/_head
|
|
31
|
-
body
|
|
32
|
-
.docs-layout
|
|
33
|
-
include /docs/views/templates/includes/_sidebar.pug
|
|
34
|
-
main.docs-content
|
|
35
|
-
block content
|
|
36
|
-
include ../includes/_scripts
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
extends /docs/views/templates/layouts/_base
|
|
2
|
-
|
|
3
|
-
append variables
|
|
4
|
-
- pagetitle = "Transitions"
|
|
5
|
-
|
|
6
|
-
block content
|
|
7
|
-
|
|
8
|
-
.lane
|
|
9
|
-
.container
|
|
10
|
-
.page-header
|
|
11
|
-
h1 Transitions
|
|
12
|
-
p.lead There is not much to style. Only transitions.
|
|
13
|
-
|
|
14
|
-
.lane
|
|
15
|
-
.container
|
|
16
|
-
.title-text
|
|
17
|
-
h2 Built-in transitions
|
|
18
|
-
p PanelSet only uses CSS transitions. You can customize the transition speeds, delays and timing functions using CSS variables on the <code>[data-panelset]</code> element. The values below are default, but you can easily override them if you include your own CSS.
|
|
19
|
-
.example
|
|
20
|
-
.demo
|
|
21
|
-
.demo-controls
|
|
22
|
-
button(data-panel="demo-panel-1") Short Panel
|
|
23
|
-
button(data-panel="demo-panel-2") Medium Panel
|
|
24
|
-
button(data-panel="demo-panel-3") Tall Panel
|
|
25
|
-
|
|
26
|
-
+examplepanelset('demo')
|
|
27
|
-
|
|
28
|
-
+codeblock('CSS').
|
|
29
|
-
[data-panelset] {
|
|
30
|
-
--fadeout-speed: 0.33s;
|
|
31
|
-
--fadein-speed: 0.33s;
|
|
32
|
-
--fadein-delay: 0.33s;
|
|
33
|
-
--height-duration-ratio: 1;
|
|
34
|
-
--transition-timing: ease-in-out;
|
|
35
|
-
--loading-panel-opacity: 0.1;
|
|
36
|
-
--close-speed: 0.33s;
|
|
37
|
-
--open-speed: 0.33s;
|
|
38
|
-
--open-timing: ease-in-out;
|
|
39
|
-
--close-timing: ease-in-out;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
dl.horizontal
|
|
45
|
-
dt #[code --fadeout-speed]
|
|
46
|
-
dd Duration of the fade-out transition when closing a panel. Default is <code>0.33s</code>.
|
|
47
|
-
dt #[code --fadein-speed]
|
|
48
|
-
dd Duration of the fade-in transition when opening a panel. Default is <code>0.33s</code>.
|
|
49
|
-
dt #[code --fadein-delay]
|
|
50
|
-
dd Delay before starting the fade-in transition when opening a panel. Default is <code>0.33s</code>.
|
|
51
|
-
dt #[code --height-duration-ratio]
|
|
52
|
-
dd Ratio between height transition duration and fade-in speed. A value of 1 means the height transition will have the same duration as the fade-in speed. Default is <code>1</code>.
|
|
53
|
-
dt #[code --transition-timing]
|
|
54
|
-
dd Timing function for both fade-in and fade-out transitions. Default is <code>ease-in-out</code>.
|
|
55
|
-
dt #[code --loading-panel-opacity]
|
|
56
|
-
dd Opacity of the panel that is being closed while the new panel is loading. Default is <code>0.1</code>.
|
|
57
|
-
dt #[code --close-speed]
|
|
58
|
-
dd Duration of the height transition when closing a panel. Default is <code>0.33s</code>.
|
|
59
|
-
dt #[code --open-speed]
|
|
60
|
-
dd Duration of the height transition when opening a panel. Default is <code>0.33s</code>.
|
|
61
|
-
dt #[code --open-timing]
|
|
62
|
-
dd Timing function for the height transition when opening a panel. Default is <code>ease-in-out</code>.
|
|
63
|
-
dt #[code --close-timing]
|
|
64
|
-
dd Timing function for the height transition when closing a panel. Default is <code>ease-in-out</code>.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
.lane
|
|
69
|
-
.container
|
|
70
|
-
.title-text
|
|
71
|
-
h2 Slower transitions
|
|
72
|
-
p The example below slows things down to better show the transitions. Fade-out and fade-in are both set to 1 second, and they actually start at the same time, but because fade-in has a delay of 1 second, it fades in after the original panel fades out. The total transition time is thus 2 seconds.
|
|
73
|
-
.example
|
|
74
|
-
.demo
|
|
75
|
-
.demo-controls
|
|
76
|
-
button(data-panel="slowdemo-panel-1") Short Panel
|
|
77
|
-
button(data-panel="slowdemo-panel-2") Medium Panel
|
|
78
|
-
button(data-panel="slowdemo-panel-3") Tall Panel
|
|
79
|
-
|
|
80
|
-
+examplepanelset('slowdemo')
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
+codeblock('CSS').
|
|
84
|
-
#slowdemo {
|
|
85
|
-
--fadeout-speed: 1s;
|
|
86
|
-
--fadein-speed: 1s;
|
|
87
|
-
--fadein-delay: 1s;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.lane
|
|
91
|
-
.container
|
|
92
|
-
.title-text
|
|
93
|
-
h2 Slower transitions, crossfading
|
|
94
|
-
p This example has crossfading panels, because of the delay of the incoming panel that is set to 0s. It could also be set to a value in between.
|
|
95
|
-
|
|
96
|
-
.example
|
|
97
|
-
.demo
|
|
98
|
-
.demo-controls
|
|
99
|
-
button(data-panel="crossfade-panel-1") Short Panel
|
|
100
|
-
button(data-panel="crossfade-panel-2") Medium Panel
|
|
101
|
-
button(data-panel="crossfade-panel-3") Tall Panel
|
|
102
|
-
+examplepanelset('crossfade')
|
|
103
|
-
+codeblock('CSS').
|
|
104
|
-
#crossfade {
|
|
105
|
-
--fadeout-speed: 1s;
|
|
106
|
-
--fadein-speed: 1s;
|
|
107
|
-
--fadein-delay: 1s;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
append scripts
|
|
113
|
-
if isProd
|
|
114
|
-
script(type="module", vite-ignore).
|
|
115
|
-
import { PanelSet } from '/lib/panelset.js';
|
|
116
|
-
PanelSet.init();
|
|
117
|
-
else
|
|
118
|
-
script(type="module").
|
|
119
|
-
import { PanelSet } from '/src/lib/index.js';
|
|
120
|
-
import '/src/lib/styles/panelset.scss';
|
|
121
|
-
PanelSet.init({debug: true});
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if isProd
|
|
125
|
-
script(src="/assets/scripts/example.js" type="module" vite-ignore)
|
|
126
|
-
else
|
|
127
|
-
script(type="module" src="/src/docs/assets/scripts/example.js")
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
append styles
|
|
131
|
-
style.
|
|
132
|
-
#slowdemo {
|
|
133
|
-
--fadeout-speed: 1s;
|
|
134
|
-
--fadein-speed: 1s;
|
|
135
|
-
--fadein-delay: 1s;
|
|
136
|
-
}
|
|
137
|
-
#crossfade {
|
|
138
|
-
--fadeout-speed: 1s;
|
|
139
|
-
--fadein-speed: 1s;
|
|
140
|
-
--fadein-delay: 0s;
|
|
141
|
-
}
|