@txstate-mws/svelte-components 1.1.0 → 1.1.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/actions/buttonify.d.ts +8 -0
- package/actions/buttonify.js +26 -0
- package/actions/glue.d.ts +16 -0
- package/actions/glue.js +82 -0
- package/actions/index.d.ts +7 -0
- package/actions/index.js +7 -0
- package/actions/offset.d.ts +15 -0
- package/actions/offset.js +35 -0
- package/actions/portal.d.ts +4 -0
- package/actions/portal.js +13 -0
- package/actions/resize.d.ts +20 -0
- package/actions/resize.js +57 -0
- package/actions/sticky.d.ts +33 -0
- package/actions/sticky.js +85 -0
- package/actions/stickyfixed.d.ts +25 -0
- package/actions/stickyfixed.js +157 -0
- package/components/Card.svelte +23 -0
- package/components/Card.svelte.d.ts +18 -0
- package/components/CardLayout.svelte +197 -0
- package/components/CardLayout.svelte.d.ts +21 -0
- package/{src/lib/components → components}/CollapsingTable.svelte +63 -65
- package/components/CollapsingTable.svelte.d.ts +59 -0
- package/{src/lib/components → components}/ConditionalWrapper.svelte +6 -7
- package/components/ConditionalWrapper.svelte.d.ts +23 -0
- package/components/FocusLock.svelte +107 -0
- package/components/FocusLock.svelte.d.ts +26 -0
- package/{src/lib/components → components}/Modal.svelte +22 -24
- package/components/Modal.svelte.d.ts +27 -0
- package/components/MultiSelect.svelte +179 -0
- package/components/MultiSelect.svelte.d.ts +35 -0
- package/components/PopupMenu.svelte +287 -0
- package/components/PopupMenu.svelte.d.ts +45 -0
- package/{src/lib/components → components}/ScreenReaderOnly.svelte +3 -4
- package/components/ScreenReaderOnly.svelte.d.ts +20 -0
- package/components/index.d.ts +9 -0
- package/components/index.js +9 -0
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/package.json +34 -13
- package/types/CardLayout.d.ts +14 -0
- package/types/CardLayout.js +1 -0
- package/types/CollapsingTable.d.ts +8 -0
- package/types/CollapsingTable.js +1 -0
- package/types/PopupMenu.d.ts +5 -0
- package/types/PopupMenu.js +1 -0
- package/types/index.d.ts +3 -0
- package/types/index.js +3 -0
- package/util/bodyoffset.d.ts +14 -0
- package/util/bodyoffset.js +72 -0
- package/util/index.d.ts +3 -0
- package/util/index.js +3 -0
- package/util/repositioned.d.ts +12 -0
- package/util/repositioned.js +81 -0
- package/util/util.d.ts +5 -0
- package/util/util.js +33 -0
- package/.eslintrc.cjs +0 -37
- package/docs/CollapsingTable.md +0 -79
- package/docs/ConditionalWrapper.md +0 -35
- package/docs/Modal.md +0 -63
- package/docs/PopupMenu.md +0 -31
- package/docs/ScreenReaderOnly.md +0 -10
- package/docs/actions.md +0 -84
- package/docs/stores.md +0 -203
- package/playwright.config.js +0 -112
- package/src/app.html +0 -14
- package/src/global.d.ts +0 -1
- package/src/lib/actions/buttonify.ts +0 -27
- package/src/lib/actions/glue.ts +0 -96
- package/src/lib/actions/index.ts +0 -7
- package/src/lib/actions/offset.ts +0 -43
- package/src/lib/actions/portal.ts +0 -13
- package/src/lib/actions/resize.ts +0 -72
- package/src/lib/actions/sticky.ts +0 -105
- package/src/lib/actions/stickyfixed.ts +0 -160
- package/src/lib/components/Card.svelte +0 -25
- package/src/lib/components/CardLayout.svelte +0 -188
- package/src/lib/components/FocusLock.svelte +0 -102
- package/src/lib/components/MultiSelect.svelte +0 -174
- package/src/lib/components/PopupMenu.svelte +0 -285
- package/src/lib/components/index.ts +0 -9
- package/src/lib/index.ts +0 -4
- package/src/lib/types/CardLayout.ts +0 -14
- package/src/lib/types/CollapsingTable.ts +0 -8
- package/src/lib/types/PopupMenu.ts +0 -5
- package/src/lib/types/index.ts +0 -3
- package/src/lib/util/bodyoffset.ts +0 -77
- package/src/lib/util/index.ts +0 -3
- package/src/lib/util/repositioned.ts +0 -91
- package/src/lib/util/util.ts +0 -36
- package/src/routes/__layout.svelte +0 -125
- package/src/routes/actions/index.svelte +0 -1
- package/src/routes/actions/offset.svelte +0 -4
- package/src/routes/actions/offsetdebounce.svelte +0 -4
- package/src/routes/actions/resize.svelte +0 -4
- package/src/routes/actions/resizedebounce.svelte +0 -4
- package/src/routes/actions/sticky.svelte +0 -4
- package/src/routes/cards/index.svelte +0 -4
- package/src/routes/cards/preserve.svelte +0 -4
- package/src/routes/collapsingtable/index.svelte +0 -4
- package/src/routes/collapsingtable/stickyheader.svelte +0 -4
- package/src/routes/index.svelte +0 -2
- package/src/routes/modal.svelte +0 -4
- package/src/routes/multiselect.svelte +0 -4
- package/src/routes/popupmenu/body.svelte +0 -4
- package/src/routes/popupmenu/complex.svelte +0 -4
- package/src/routes/popupmenu/empty.svelte +0 -5
- package/src/routes/popupmenu/index.svelte +0 -4
- package/src/routes/popupmenu/parent.svelte +0 -4
- package/src/routes/popupmenu/scrollable.svelte +0 -27
- package/src/routes/popupmenu/showselected.svelte +0 -4
- package/src/test/Cards.svelte +0 -64
- package/src/test/CollapsingTableTest.svelte +0 -36
- package/src/test/ModalTest.svelte +0 -58
- package/src/test/MultiSelectTest.svelte +0 -26
- package/src/test/Offset.svelte +0 -32
- package/src/test/PopupMenuBody.svelte +0 -34
- package/src/test/PopupMenuButtonIsParent.svelte +0 -36
- package/src/test/PopupMenuComplex.svelte +0 -34
- package/src/test/PopupMenuSimple.svelte +0 -36
- package/src/test/Resize.svelte +0 -29
- package/src/test/Sticky.svelte +0 -65
- package/static/layout.css +0 -263
- package/svelte.config.js +0 -15
- package/tests/.eslintrc.cjs +0 -19
- package/tests/CardLayout.test.js +0 -41
- package/tests/CollapsingTable.test.js +0 -37
- package/tests/Modal.test.js +0 -18
- package/tests/MultiSelect.test.js +0 -58
- package/tests/PopupMenu.test.js +0 -55
- package/tests/common.js +0 -4
- package/tsconfig.json +0 -31
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { hashify } from 'txstate-utils'
|
|
3
|
-
import PopupMenu from '$lib/components/PopupMenu.svelte'
|
|
4
|
-
|
|
5
|
-
export let showSelected = false
|
|
6
|
-
export let items = [
|
|
7
|
-
{ value: '0', label: 'Sunday', disabled: true },
|
|
8
|
-
{ value: '1', label: 'Monday' },
|
|
9
|
-
{ value: '2', label: 'Tuesday' },
|
|
10
|
-
{ value: '3', label: 'Wednesday' },
|
|
11
|
-
{ value: '4', label: 'Thursday', disabled: true },
|
|
12
|
-
{ value: '5', label: 'Friday' },
|
|
13
|
-
{ value: '6', label: 'Saturday', disabled: true }
|
|
14
|
-
]
|
|
15
|
-
|
|
16
|
-
let button: HTMLElement
|
|
17
|
-
let value: string
|
|
18
|
-
$: itemsByValue = hashify(items, 'value')
|
|
19
|
-
$: selected = itemsByValue[value]
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<div class="topspacer"></div>
|
|
23
|
-
<div class="container">
|
|
24
|
-
<button id="test-button" class="ui gold button" bind:this={button}>Popup Menu</button>
|
|
25
|
-
<div>selected: {#if selected}{selected.value}, {selected.label}{:else}none{/if}</div>
|
|
26
|
-
<PopupMenu bind:value buttonelement={button} {items} {showSelected}></PopupMenu>
|
|
27
|
-
</div>
|
|
28
|
-
|
|
29
|
-
<style>
|
|
30
|
-
.topspacer {
|
|
31
|
-
height: 20px;
|
|
32
|
-
}
|
|
33
|
-
.container {
|
|
34
|
-
position: relative;
|
|
35
|
-
}
|
|
36
|
-
</style>
|
package/src/test/Resize.svelte
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { resize, ResizeStore } from '$lib'
|
|
3
|
-
export let debounce = false
|
|
4
|
-
const mysize = new ResizeStore()
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<div use:resize={{ store: mysize, debounce }} class='resizable'>resize this div</div>
|
|
8
|
-
<div class="display">
|
|
9
|
-
Above div's size...<br>
|
|
10
|
-
Width: {$mysize.offsetWidth}<br>
|
|
11
|
-
Height: {$mysize.offsetHeight}
|
|
12
|
-
</div>
|
|
13
|
-
debounce: {debounce}
|
|
14
|
-
|
|
15
|
-
<style>
|
|
16
|
-
div {
|
|
17
|
-
max-width: 300px;
|
|
18
|
-
}
|
|
19
|
-
.resizable {
|
|
20
|
-
resize: both;
|
|
21
|
-
overflow: auto;
|
|
22
|
-
min-height: 100px;
|
|
23
|
-
background: lightblue;
|
|
24
|
-
border: 1px solid black;
|
|
25
|
-
}
|
|
26
|
-
.display {
|
|
27
|
-
text-align: center;
|
|
28
|
-
}
|
|
29
|
-
</style>
|
package/src/test/Sticky.svelte
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { sticky, stickyfixed } from '$lib'
|
|
3
|
-
let target: HTMLElement
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
<div class='above'>above</div>
|
|
7
|
-
<table>
|
|
8
|
-
<thead>
|
|
9
|
-
<tr use:sticky><th>Name</th><th>Bedtime</th></tr>
|
|
10
|
-
</thead>
|
|
11
|
-
<tbody>
|
|
12
|
-
<tr><td>Bobby</td><td>10pm</td></tr>
|
|
13
|
-
<tr><td>Sue</td><td>3am</td></tr>
|
|
14
|
-
<tr><td>Billy</td><td>11pm</td></tr>
|
|
15
|
-
<tr><td>Mary</td><td>7pm</td></tr>
|
|
16
|
-
<tr><td>Kevin</td><td>9:30pm</td></tr>
|
|
17
|
-
<tr><td>Jess</td><td>12am</td></tr>
|
|
18
|
-
<tr><td>Randy</td><td>1am</td></tr>
|
|
19
|
-
<tr><td>Daniel</td><td>11pm</td></tr>
|
|
20
|
-
<tr><td>Elizabetd</td><td>8pm</td></tr>
|
|
21
|
-
<tr><td>Catderine</td><td>4pm</td></tr>
|
|
22
|
-
<tr><td>Mandy</td><td>8:30pm</td></tr>
|
|
23
|
-
<tr><td>Chris</td><td>9pm</td></tr>
|
|
24
|
-
<tr><td>Sean</td><td>10:45pm</td></tr>
|
|
25
|
-
<tr><td>Jack</td><td>2am</td></tr>
|
|
26
|
-
<tr><td>Morgan</td><td>3pm</td></tr>
|
|
27
|
-
<tr><td>Chuck</td><td>8pm</td></tr>
|
|
28
|
-
</tbody>
|
|
29
|
-
</table>
|
|
30
|
-
<div class="extendedcontainer" bind:this={target}>
|
|
31
|
-
<table>
|
|
32
|
-
<thead use:stickyfixed={{ target }}>
|
|
33
|
-
<tr><th>Person</th><th>Calories</th><th>Fat</th><th>Protein</th></tr>
|
|
34
|
-
</thead>
|
|
35
|
-
<tbody>
|
|
36
|
-
<tr><td>Mirna</td><td>1</td><td>28g</td><td>29g</td></tr>
|
|
37
|
-
<tr><td>Fernando</td><td>38</td><td>2g</td><td>48g</td></tr>
|
|
38
|
-
<tr><td>Lisette</td><td>18</td><td>9g</td><td>23g</td></tr>
|
|
39
|
-
<tr><td>Ahmad</td><td>42</td><td>26g</td><td>49g</td></tr>
|
|
40
|
-
<tr><td>Laquanda</td><td>27</td><td>27g</td><td>49g</td></tr>
|
|
41
|
-
</tbody>
|
|
42
|
-
</table>
|
|
43
|
-
sticky header should continue to the bottom of this container
|
|
44
|
-
</div>
|
|
45
|
-
<div class='below'>below</div>
|
|
46
|
-
|
|
47
|
-
<style>
|
|
48
|
-
.above { height: 400px; }
|
|
49
|
-
.below { height: 1000px; }
|
|
50
|
-
.extendedcontainer { padding-bottom: 50px; border: 1px solid black; }
|
|
51
|
-
table {
|
|
52
|
-
position: relative;
|
|
53
|
-
box-sizing: border-box;
|
|
54
|
-
}
|
|
55
|
-
table th {
|
|
56
|
-
background: lightgray;
|
|
57
|
-
border: 2px solid black;
|
|
58
|
-
}
|
|
59
|
-
th:first-child, td:first-child {
|
|
60
|
-
width: 20em;
|
|
61
|
-
}
|
|
62
|
-
th:last-child, td:last-child {
|
|
63
|
-
width: 8em;
|
|
64
|
-
}
|
|
65
|
-
</style>
|
package/static/layout.css
DELETED
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--menu-width: 12rem;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.pure-img-responsive {
|
|
6
|
-
max-width: 100%;
|
|
7
|
-
height: auto;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/*
|
|
11
|
-
Add transition to containers so they can push in and out.
|
|
12
|
-
*/
|
|
13
|
-
#layout,
|
|
14
|
-
#menu,
|
|
15
|
-
.menu-link {
|
|
16
|
-
-webkit-transition: all 0.2s ease-out;
|
|
17
|
-
-moz-transition: all 0.2s ease-out;
|
|
18
|
-
-ms-transition: all 0.2s ease-out;
|
|
19
|
-
-o-transition: all 0.2s ease-out;
|
|
20
|
-
transition: all 0.2s ease-out;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/*
|
|
24
|
-
This is the parent `<div>` that contains the menu and the content area.
|
|
25
|
-
*/
|
|
26
|
-
#layout {
|
|
27
|
-
position: relative;
|
|
28
|
-
left: 0;
|
|
29
|
-
padding-left: 0;
|
|
30
|
-
}
|
|
31
|
-
#layout.active #menu {
|
|
32
|
-
left: var(--menu-width);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
#layout.active .menu-link {
|
|
36
|
-
left: var(--menu-width);
|
|
37
|
-
}
|
|
38
|
-
/*
|
|
39
|
-
The content `<div>` is where all your content goes.
|
|
40
|
-
*/
|
|
41
|
-
.content {
|
|
42
|
-
margin: 2em auto;
|
|
43
|
-
padding: 0 2em;
|
|
44
|
-
max-width: 1200px;
|
|
45
|
-
margin-bottom: 50px;
|
|
46
|
-
line-height: 1.6em;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.header {
|
|
50
|
-
margin: 0;
|
|
51
|
-
color: #333;
|
|
52
|
-
text-align: center;
|
|
53
|
-
padding: 2.5em 2em 0;
|
|
54
|
-
border-bottom: 1px solid #eee;
|
|
55
|
-
}
|
|
56
|
-
.header h1 {
|
|
57
|
-
margin: 0.2em 0;
|
|
58
|
-
font-size: 3em;
|
|
59
|
-
font-weight: 300;
|
|
60
|
-
}
|
|
61
|
-
.header h2 {
|
|
62
|
-
font-weight: 300;
|
|
63
|
-
color: #ccc;
|
|
64
|
-
padding: 0;
|
|
65
|
-
margin-top: 0;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.content-subhead {
|
|
69
|
-
margin: 50px 0 20px 0;
|
|
70
|
-
font-weight: 300;
|
|
71
|
-
color: #888;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
/*
|
|
77
|
-
The `#menu` `<div>` is the parent `<div>` that contains the `.pure-menu` that
|
|
78
|
-
appears on the left side of the page.
|
|
79
|
-
*/
|
|
80
|
-
|
|
81
|
-
#menu {
|
|
82
|
-
margin-left: calc(-1 * var(--menu-width));
|
|
83
|
-
width: var(--menu-width);
|
|
84
|
-
position: fixed;
|
|
85
|
-
top: 0;
|
|
86
|
-
left: 0;
|
|
87
|
-
bottom: 0;
|
|
88
|
-
z-index: 1000; /* so the menu or its navicon stays above all content */
|
|
89
|
-
background: #191818;
|
|
90
|
-
overflow-y: auto;
|
|
91
|
-
}
|
|
92
|
-
/*
|
|
93
|
-
All anchors inside the menu should be styled like this.
|
|
94
|
-
*/
|
|
95
|
-
#menu a {
|
|
96
|
-
color: #999;
|
|
97
|
-
border: none;
|
|
98
|
-
padding: 0.6em;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/*
|
|
102
|
-
Remove all background/borders, since we are applying them to #menu.
|
|
103
|
-
*/
|
|
104
|
-
#menu .pure-menu,
|
|
105
|
-
#menu .pure-menu ul {
|
|
106
|
-
border: none;
|
|
107
|
-
background: transparent;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/*
|
|
111
|
-
Add that light border to separate items into groups.
|
|
112
|
-
*/
|
|
113
|
-
#menu .pure-menu ul,
|
|
114
|
-
#menu .pure-menu .menu-item-divided {
|
|
115
|
-
border-top: 1px solid #666;
|
|
116
|
-
}
|
|
117
|
-
/*
|
|
118
|
-
Change color of the anchor links on hover/focus.
|
|
119
|
-
*/
|
|
120
|
-
#menu .pure-menu li a:hover,
|
|
121
|
-
#menu .pure-menu li a:focus {
|
|
122
|
-
background: #333;
|
|
123
|
-
}
|
|
124
|
-
#menu .pure-menu li.pure-menu-selected a:hover,
|
|
125
|
-
#menu .pure-menu li.pure-menu-selected a:focus,
|
|
126
|
-
#menu .pure-menu li.pure-menu-subselected a:hover,
|
|
127
|
-
#menu .pure-menu li.pure-menu-subselected a:focus {
|
|
128
|
-
background: inherit;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
#menu .pure-menu-parent {
|
|
133
|
-
border-top: 1px solid #666;
|
|
134
|
-
}
|
|
135
|
-
#menu .pure-menu-parent a {
|
|
136
|
-
color: #fff;
|
|
137
|
-
}
|
|
138
|
-
/*
|
|
139
|
-
This styles the selected menu item `<li>`.
|
|
140
|
-
*/
|
|
141
|
-
#menu .pure-menu-selected {
|
|
142
|
-
background: #1f8dd6;
|
|
143
|
-
}
|
|
144
|
-
/*
|
|
145
|
-
This styles a link within a selected menu item `<li>`.
|
|
146
|
-
*/
|
|
147
|
-
#menu .pure-menu-selected a {
|
|
148
|
-
color: #fff;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
#menu .pure-menu-parent.pure-menu-subselected {
|
|
152
|
-
background: #8bb6d3;
|
|
153
|
-
}
|
|
154
|
-
#menu .pure-menu-parent.pure-menu-subselected a {
|
|
155
|
-
color: black;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/*
|
|
159
|
-
This styles the menu heading.
|
|
160
|
-
*/
|
|
161
|
-
#menu .pure-menu-heading {
|
|
162
|
-
font-size: 110%;
|
|
163
|
-
color: #fff;
|
|
164
|
-
margin: 0;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/* -- Dynamic Button For Responsive Menu -------------------------------------*/
|
|
168
|
-
|
|
169
|
-
/*
|
|
170
|
-
The button to open/close the Menu is custom-made and not part of Pure. Here's
|
|
171
|
-
how it works:
|
|
172
|
-
*/
|
|
173
|
-
|
|
174
|
-
/*
|
|
175
|
-
`.menu-link` represents the responsive menu toggle that shows/hides on
|
|
176
|
-
small screens.
|
|
177
|
-
*/
|
|
178
|
-
.menu-link {
|
|
179
|
-
position: fixed;
|
|
180
|
-
display: block; /* show this only on small screens */
|
|
181
|
-
top: 0;
|
|
182
|
-
left: 0; /* "#menu width" */
|
|
183
|
-
background: #000;
|
|
184
|
-
background: rgba(0,0,0,0.7);
|
|
185
|
-
font-size: 10px; /* change this value to increase/decrease button size */
|
|
186
|
-
z-index: 10;
|
|
187
|
-
width: 3em;
|
|
188
|
-
height: 2em;
|
|
189
|
-
padding: 2.1em 1.6em;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.menu-link:hover,
|
|
193
|
-
.menu-link:focus {
|
|
194
|
-
background: #000;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
.menu-link span {
|
|
198
|
-
display: block;
|
|
199
|
-
position: absolute;
|
|
200
|
-
top: 50%;
|
|
201
|
-
left: 50%;
|
|
202
|
-
transform: translate(-50%, -50%);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.menu-link span,
|
|
206
|
-
.menu-link span:before,
|
|
207
|
-
.menu-link span:after {
|
|
208
|
-
background-color: #fff;
|
|
209
|
-
pointer-events: none;
|
|
210
|
-
width: 2em;
|
|
211
|
-
height: 0.2em;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.menu-link span:before,
|
|
215
|
-
.menu-link span:after {
|
|
216
|
-
position: absolute;
|
|
217
|
-
margin-top: -0.6em;
|
|
218
|
-
content: " ";
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
.menu-link span:after {
|
|
222
|
-
margin-top: 0.6em;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
/* -- Responsive Styles (Media Queries) ------------------------------------- */
|
|
227
|
-
|
|
228
|
-
/*
|
|
229
|
-
Hides the menu at `48em`, but modify this based on your app's needs.
|
|
230
|
-
*/
|
|
231
|
-
@media (min-width: 48em) {
|
|
232
|
-
|
|
233
|
-
.header,
|
|
234
|
-
.content {
|
|
235
|
-
padding-left: 2em;
|
|
236
|
-
padding-right: 2em;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
#layout {
|
|
240
|
-
padding-left: var(--menu-width); /* left col width "#menu" */
|
|
241
|
-
left: 0;
|
|
242
|
-
}
|
|
243
|
-
#menu {
|
|
244
|
-
left: var(--menu-width);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
.menu-link {
|
|
248
|
-
display: none;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
@media (max-width: 48em) {
|
|
253
|
-
/* Only apply this when the window is small. Otherwise, the following
|
|
254
|
-
case results in extra padding on the left:
|
|
255
|
-
* Make the window small.
|
|
256
|
-
* Tap the menu to trigger the active state.
|
|
257
|
-
* Make the window large again.
|
|
258
|
-
*/
|
|
259
|
-
#layout.active {
|
|
260
|
-
position: relative;
|
|
261
|
-
left: var(--menu-width);
|
|
262
|
-
}
|
|
263
|
-
}
|
package/svelte.config.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import adapter from '@sveltejs/adapter-auto';
|
|
2
|
-
import preprocess from 'svelte-preprocess';
|
|
3
|
-
|
|
4
|
-
/** @type {import('@sveltejs/kit').Config} */
|
|
5
|
-
const config = {
|
|
6
|
-
// Consult https://github.com/sveltejs/svelte-preprocess
|
|
7
|
-
// for more information about preprocessors
|
|
8
|
-
preprocess: preprocess(),
|
|
9
|
-
|
|
10
|
-
kit: {
|
|
11
|
-
adapter: adapter()
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default config;
|
package/tests/.eslintrc.cjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
root: true,
|
|
3
|
-
parser: undefined,
|
|
4
|
-
extends: 'standard',
|
|
5
|
-
plugins: [],
|
|
6
|
-
ignorePatterns: [],
|
|
7
|
-
overrides: [],
|
|
8
|
-
settings: {},
|
|
9
|
-
rules: {
|
|
10
|
-
},
|
|
11
|
-
parserOptions: {
|
|
12
|
-
sourceType: 'module'
|
|
13
|
-
},
|
|
14
|
-
env: {
|
|
15
|
-
browser: true,
|
|
16
|
-
es2017: true,
|
|
17
|
-
node: true
|
|
18
|
-
}
|
|
19
|
-
}
|
package/tests/CardLayout.test.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { test, expect } from '@playwright/test'
|
|
2
|
-
import { goto } from './common.js'
|
|
3
|
-
|
|
4
|
-
test.describe('Image Layout', () => {
|
|
5
|
-
test.beforeEach(async ({ page }) => {
|
|
6
|
-
await goto(page, '/cards')
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
test('should show all 9 cards', async ({ page }) => {
|
|
10
|
-
const cards = page.locator('.cardlayout-card')
|
|
11
|
-
await expect(cards).toHaveCount(9)
|
|
12
|
-
})
|
|
13
|
-
test('should place each card further from the top than the last', async ({ page }) => {
|
|
14
|
-
const cards = page.locator('.cardlayout-card')
|
|
15
|
-
await expect(cards).toHaveCount(9)
|
|
16
|
-
|
|
17
|
-
let lastoffset = 0
|
|
18
|
-
for (let i = 0; i < 9; i++) {
|
|
19
|
-
const top = (await cards.nth(i).boundingBox()).y
|
|
20
|
-
expect(top).toBeGreaterThanOrEqual(lastoffset)
|
|
21
|
-
lastoffset = top
|
|
22
|
-
}
|
|
23
|
-
expect(lastoffset).toBeGreaterThan(0)
|
|
24
|
-
})
|
|
25
|
-
})
|
|
26
|
-
test.describe('Preserve Order Layout', () => {
|
|
27
|
-
test.beforeEach(async ({ page }) => {
|
|
28
|
-
await goto(page, '/cards/preserve')
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
test('should preserve card order when instructed', async ({ page }) => {
|
|
32
|
-
const cards = page.locator('.cardlayout-card')
|
|
33
|
-
await expect(cards).toHaveCount(9)
|
|
34
|
-
let lastleft = 0
|
|
35
|
-
for (let i = 0; i < 9; i++) {
|
|
36
|
-
const left = (await cards.nth(i).boundingBox()).x
|
|
37
|
-
expect(left).toBeGreaterThanOrEqual(lastleft)
|
|
38
|
-
lastleft = left
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
})
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { test, expect } from '@playwright/test'
|
|
2
|
-
import { goto } from './common.js'
|
|
3
|
-
|
|
4
|
-
test.beforeEach(async ({ page }) => {
|
|
5
|
-
await goto(page, '/collapsingtable')
|
|
6
|
-
})
|
|
7
|
-
|
|
8
|
-
test('has two rows in tbody', async ({ page }) => {
|
|
9
|
-
await expect(page.locator('text=John Smith')).toHaveCount(1)
|
|
10
|
-
await expect(page.locator('text=Mary Sue')).toHaveCount(1)
|
|
11
|
-
})
|
|
12
|
-
test('hides the numerated columns on a small screen', async ({ page }) => {
|
|
13
|
-
await page.setViewportSize({ width: 400, height: 1024 })
|
|
14
|
-
await expect(page.locator('text="one"')).toHaveCount(0)
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
test('menu toggles when button is clicked', async ({ page }) => {
|
|
18
|
-
await page.setViewportSize({ width: 400, height: 1024 })
|
|
19
|
-
const button = page.locator('th').last()
|
|
20
|
-
const menuitemtwo = page.locator('text="two"')
|
|
21
|
-
await expect(menuitemtwo).toHaveCount(0)
|
|
22
|
-
button.click()
|
|
23
|
-
await expect(menuitemtwo).toHaveCount(1)
|
|
24
|
-
button.click()
|
|
25
|
-
await expect(menuitemtwo).toHaveCount(0)
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
test('able to activate a new row', async ({ page }) => {
|
|
29
|
-
await page.setViewportSize({ width: 400, height: 1024 })
|
|
30
|
-
const button = page.locator('th').last()
|
|
31
|
-
const menuitemtwo = page.locator('text="two"')
|
|
32
|
-
await expect(menuitemtwo).toHaveCount(0)
|
|
33
|
-
button.click()
|
|
34
|
-
await expect(menuitemtwo).toHaveCount(1)
|
|
35
|
-
menuitemtwo.click()
|
|
36
|
-
await expect(page.locator('text="2"')).toHaveCount(3)
|
|
37
|
-
})
|
package/tests/Modal.test.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { test, expect } from '@playwright/test'
|
|
2
|
-
import { goto } from './common.js'
|
|
3
|
-
|
|
4
|
-
test.beforeEach(async ({ page }) => {
|
|
5
|
-
await goto(page, '/modal')
|
|
6
|
-
})
|
|
7
|
-
|
|
8
|
-
test('modal is active on first render, escape dismisses, hitting enter on the button brings it back, escaping puts focus on the button', async ({ page }) => {
|
|
9
|
-
const button = page.locator('#test-button')
|
|
10
|
-
const nameInput = page.locator('#firstname')
|
|
11
|
-
await expect(nameInput).toHaveCount(1)
|
|
12
|
-
await nameInput.press('Escape')
|
|
13
|
-
await expect(nameInput).toHaveCount(0)
|
|
14
|
-
await button.press('Enter')
|
|
15
|
-
await expect(nameInput).toHaveCount(1)
|
|
16
|
-
await nameInput.press('Escape')
|
|
17
|
-
await expect(page.locator('#test-button')).toBeFocused()
|
|
18
|
-
})
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { test, expect } from '@playwright/test'
|
|
2
|
-
import { goto } from './common.js'
|
|
3
|
-
|
|
4
|
-
test.beforeEach(async ({ page }) => {
|
|
5
|
-
await goto(page, '/multiselect')
|
|
6
|
-
})
|
|
7
|
-
|
|
8
|
-
test('menus open on focus', async ({ page }) => {
|
|
9
|
-
const firstselect = page.locator('[name="test1"]')
|
|
10
|
-
const secondselect = page.locator('[name="test2"]')
|
|
11
|
-
const appleInSecond = page.locator('text="Apple"')
|
|
12
|
-
const bananaInFirst = page.locator('text="banana"')
|
|
13
|
-
await expect(appleInSecond).toHaveCount(0)
|
|
14
|
-
await expect(bananaInFirst).toHaveCount(0)
|
|
15
|
-
firstselect.focus()
|
|
16
|
-
await expect(bananaInFirst).toHaveCount(1)
|
|
17
|
-
secondselect.focus()
|
|
18
|
-
await expect(bananaInFirst).toHaveCount(0)
|
|
19
|
-
await expect(appleInSecond).toHaveCount(1)
|
|
20
|
-
secondselect.press('Escape')
|
|
21
|
-
await expect(appleInSecond).toHaveCount(0)
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
test('able to add and remove items', async ({ page }) => {
|
|
25
|
-
const firstselect = page.locator('[name="test1"]')
|
|
26
|
-
const secondselect = page.locator('[name="test2"]')
|
|
27
|
-
const bananaInFirst = page.locator('text="banana"')
|
|
28
|
-
const orangeInFirst = page.locator('text="orange"')
|
|
29
|
-
const appleInSecond = page.locator('text="Apple"')
|
|
30
|
-
const bananaInSecond = page.locator('text="Banana"')
|
|
31
|
-
const orangeInSecond = page.locator('text="Orange"')
|
|
32
|
-
await expect(bananaInFirst).toHaveCount(0)
|
|
33
|
-
firstselect.focus()
|
|
34
|
-
await expect(bananaInFirst).toHaveCount(1)
|
|
35
|
-
bananaInFirst.click()
|
|
36
|
-
await expect(orangeInFirst).toHaveCount(0)
|
|
37
|
-
await expect(bananaInFirst).toHaveCount(1)
|
|
38
|
-
bananaInFirst.click()
|
|
39
|
-
await expect(bananaInFirst).toHaveCount(0)
|
|
40
|
-
|
|
41
|
-
await expect(appleInSecond).toHaveCount(0)
|
|
42
|
-
await expect(bananaInSecond).toHaveCount(1)
|
|
43
|
-
secondselect.press('Backspace')
|
|
44
|
-
secondselect.press('Escape')
|
|
45
|
-
await expect(bananaInSecond).toHaveCount(0)
|
|
46
|
-
secondselect.press('ArrowLeft')
|
|
47
|
-
await expect(orangeInSecond).toHaveCount(1)
|
|
48
|
-
await expect(orangeInSecond).toHaveClass(/hilited/)
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
test('typing in the input reduces the options in the menu', async ({ page }) => {
|
|
52
|
-
const firstselect = page.locator('[name="test1"]')
|
|
53
|
-
const bananaInFirst = page.locator('text="banana"')
|
|
54
|
-
const orangeInFirst = page.locator('text="orange"')
|
|
55
|
-
firstselect.type('ora')
|
|
56
|
-
await expect(bananaInFirst).toHaveCount(0)
|
|
57
|
-
await expect(orangeInFirst).toHaveCount(1)
|
|
58
|
-
})
|
package/tests/PopupMenu.test.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { test, expect } from '@playwright/test'
|
|
2
|
-
import { goto } from './common.js'
|
|
3
|
-
|
|
4
|
-
test.beforeEach(async ({ page }) => {
|
|
5
|
-
await goto(page, '/popupmenu')
|
|
6
|
-
})
|
|
7
|
-
|
|
8
|
-
test('menu toggles when button is clicked', async ({ page }) => {
|
|
9
|
-
const button = page.locator('#test-button')
|
|
10
|
-
const monday = page.locator('text="Monday"')
|
|
11
|
-
await expect(button).toHaveCount(1)
|
|
12
|
-
await expect(monday).toHaveCount(0)
|
|
13
|
-
button.click()
|
|
14
|
-
await expect(monday).toHaveCount(1)
|
|
15
|
-
button.click()
|
|
16
|
-
await expect(monday).toHaveCount(0)
|
|
17
|
-
button.press('Enter')
|
|
18
|
-
await expect(monday).toHaveCount(1)
|
|
19
|
-
button.press('Enter')
|
|
20
|
-
await expect(monday).toHaveCount(0)
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
test('has five menu items', async ({ page }) => {
|
|
24
|
-
const button = page.locator('#test-button')
|
|
25
|
-
await expect(button).toHaveCount(1)
|
|
26
|
-
button.click()
|
|
27
|
-
await expect(page.locator('text="Monday"')).toHaveCount(1)
|
|
28
|
-
await expect(page.locator('text="Tuesday"')).toHaveCount(1)
|
|
29
|
-
await expect(page.locator('text="Wednesday"')).toHaveCount(1)
|
|
30
|
-
await expect(page.locator('text="Thursday"')).toHaveCount(1)
|
|
31
|
-
await expect(page.locator('text="Friday"')).toHaveCount(1)
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
test('clicking a menu option selects it', async ({ page }) => {
|
|
35
|
-
const button = page.locator('#test-button')
|
|
36
|
-
await expect(button).toHaveCount(1)
|
|
37
|
-
button.click()
|
|
38
|
-
const option = page.locator('text="Monday"')
|
|
39
|
-
await expect(option).toHaveCount(1)
|
|
40
|
-
await expect(page.locator('text=selected: 1')).toHaveCount(0)
|
|
41
|
-
option.click()
|
|
42
|
-
await expect(page.locator('text=selected: 1')).toHaveCount(1)
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
test('may select a menu option with the keyboard', async ({ page }) => {
|
|
46
|
-
const button = page.locator('#test-button')
|
|
47
|
-
await expect(button).toHaveCount(1)
|
|
48
|
-
button.click()
|
|
49
|
-
const option = page.locator('text="Monday"')
|
|
50
|
-
await expect(option).toHaveCount(1)
|
|
51
|
-
await expect(page.locator('text=selected: 1')).toHaveCount(0)
|
|
52
|
-
await button.press('ArrowDown')
|
|
53
|
-
await button.press('Enter')
|
|
54
|
-
await expect(page.locator('text=selected: 1')).toHaveCount(1)
|
|
55
|
-
})
|
package/tests/common.js
DELETED
package/tsconfig.json
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"moduleResolution": "node",
|
|
4
|
-
"module": "es2020",
|
|
5
|
-
"lib": ["es2020", "DOM"],
|
|
6
|
-
"target": "es2020",
|
|
7
|
-
/**
|
|
8
|
-
svelte-preprocess cannot figure out whether you have a value or a type, so tell TypeScript
|
|
9
|
-
to enforce using \`import type\` instead of \`import\` for Types.
|
|
10
|
-
*/
|
|
11
|
-
"importsNotUsedAsValues": "error",
|
|
12
|
-
"isolatedModules": true,
|
|
13
|
-
"resolveJsonModule": true,
|
|
14
|
-
/**
|
|
15
|
-
To have warnings/errors of the Svelte compiler at the correct position,
|
|
16
|
-
enable source maps by default.
|
|
17
|
-
*/
|
|
18
|
-
"sourceMap": true,
|
|
19
|
-
"esModuleInterop": true,
|
|
20
|
-
"skipLibCheck": true,
|
|
21
|
-
"forceConsistentCasingInFileNames": true,
|
|
22
|
-
"baseUrl": ".",
|
|
23
|
-
"allowJs": true,
|
|
24
|
-
"checkJs": true,
|
|
25
|
-
"paths": {
|
|
26
|
-
"$lib": ["src/lib"],
|
|
27
|
-
"$lib/*": ["src/lib/*"]
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"]
|
|
31
|
-
}
|