@rokkit/core 1.0.0-next.14 → 1.0.0-next.140
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 +1 -1
- package/README.md +121 -1
- package/dist/calendar.d.ts +10 -0
- package/dist/colors/index.d.ts +47 -0
- package/dist/connector.d.ts +8 -0
- package/dist/constants.d.ts +88 -0
- package/dist/events.d.ts +12 -0
- package/dist/field-mapper.d.ts +60 -0
- package/dist/index.d.ts +13 -0
- package/dist/key-event-map.d.ts +18 -0
- package/dist/mapped-items.d.ts +14 -0
- package/dist/mapping.d.ts +14 -0
- package/dist/nested.d.ts +9 -0
- package/dist/string.d.ts +59 -0
- package/dist/theme.d.ts +96 -0
- package/dist/ticks.d.ts +10 -0
- package/dist/types.d.ts +300 -0
- package/dist/utils.d.ts +93 -0
- package/dist/vite/icon-collections.d.ts +32 -0
- package/dist/vite/index.d.ts +1 -0
- package/package.json +31 -39
- package/src/calendar.js +44 -0
- package/src/colors/extra.json +16 -0
- package/src/colors/index.ts +24 -0
- package/src/colors/syntax.json +42 -0
- package/src/colors/tailwind.json +275 -0
- package/src/connector.js +34 -0
- package/src/constants.js +186 -107
- package/src/events.js +32 -0
- package/src/field-mapper.js +147 -0
- package/src/index.js +19 -27
- package/src/key-event-map.js +35 -0
- package/src/mapped-items.js +22 -0
- package/src/mapping.js +21 -0
- package/src/nested.js +28 -0
- package/src/string.js +97 -0
- package/src/theme.ts +206 -0
- package/src/ticks.js +26 -0
- package/src/types.js +160 -0
- package/src/utils.js +255 -0
- package/src/vite/icon-collections.js +73 -0
- package/src/vite/index.js +1 -0
- package/src/Accordion.svelte +0 -80
- package/src/Alerts.svelte +0 -39
- package/src/DropDown.svelte +0 -82
- package/src/DropSearch.svelte +0 -67
- package/src/EditableTabs.svelte +0 -31
- package/src/Icon.svelte +0 -15
- package/src/List-Discard.svelte +0 -48
- package/src/List.svelte +0 -65
- package/src/ListActions.svelte +0 -35
- package/src/NavTabs.svelte +0 -0
- package/src/NestedList.svelte +0 -77
- package/src/Overlay.svelte +0 -4
- package/src/PageNavigator.svelte +0 -94
- package/src/ResponsiveGrid.svelte +0 -73
- package/src/Scrollable.svelte +0 -8
- package/src/Searchable.svelte +0 -19
- package/src/Sidebar.svelte +0 -5
- package/src/Slider.svelte +0 -17
- package/src/SpinList.svelte +0 -48
- package/src/SplitPane.svelte +0 -109
- package/src/SplitView.svelte +0 -44
- package/src/Splitter.svelte +0 -95
- package/src/TabItem.svelte +0 -27
- package/src/TabItems.svelte +0 -34
- package/src/Tabs.svelte +0 -49
- package/src/Tree.svelte +0 -45
- package/src/actions/dismissable.js +0 -24
- package/src/actions/fillable.js +0 -114
- package/src/actions/hierarchy.js +0 -180
- package/src/actions/index.js +0 -7
- package/src/actions/navigable.js +0 -43
- package/src/actions/navigator.js +0 -179
- package/src/actions/pannable.js +0 -50
- package/src/actions/swipeable.js +0 -56
- package/src/actions/themeable.js +0 -23
- package/src/items/Collapsible.svelte +0 -51
- package/src/items/Connector.svelte +0 -26
- package/src/items/Link.svelte +0 -18
- package/src/items/Node.svelte +0 -52
- package/src/items/Pill.svelte +0 -19
- package/src/items/Separator.svelte +0 -1
- package/src/items/Summary.svelte +0 -27
- package/src/items/Text.svelte +0 -21
- package/src/items/index.js +0 -8
- package/src/list.js +0 -14
- package/src/mocks/Custom.svelte +0 -7
- package/src/mocks/index.js +0 -10
- package/src/stores/alerts.js +0 -3
- package/src/stores/index.js +0 -6
- package/src/stores/persist.js +0 -63
- package/src/stores/theme.js +0 -34
package/src/DropSearch.svelte
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { defaultFields } from './constants.js'
|
|
3
|
-
import List from './List.svelte'
|
|
4
|
-
import Slider from './Slider.svelte'
|
|
5
|
-
import { Text } from './items'
|
|
6
|
-
|
|
7
|
-
export let data
|
|
8
|
-
export let value = null
|
|
9
|
-
export let fields = defaultFields
|
|
10
|
-
export let using = { default: Text }
|
|
11
|
-
|
|
12
|
-
$: using = { default: Text, ...using }
|
|
13
|
-
$: fields = { ...defaultFields, ...fields }
|
|
14
|
-
|
|
15
|
-
let opened = false
|
|
16
|
-
let search
|
|
17
|
-
let searchBox
|
|
18
|
-
|
|
19
|
-
// on search change filter list
|
|
20
|
-
function handleSelect(event) {
|
|
21
|
-
console.log('selected', event)
|
|
22
|
-
value = event.detail
|
|
23
|
-
search = event.detail[fields.text]
|
|
24
|
-
}
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
|
28
|
-
<div
|
|
29
|
-
class="flex flex-col outline-none w-full h-12 relative dropdown"
|
|
30
|
-
tabindex={0}
|
|
31
|
-
>
|
|
32
|
-
<div class="flex flex-shrink-0 h-12 items-center pl-4 selected-item">
|
|
33
|
-
<span class="flex flex-grow">
|
|
34
|
-
<input
|
|
35
|
-
type="text"
|
|
36
|
-
class="p-0 border-none bg-transparent w-full"
|
|
37
|
-
bind:value={search}
|
|
38
|
-
bind:this={searchBox}
|
|
39
|
-
on:focus={() => {
|
|
40
|
-
opened = true
|
|
41
|
-
searchBox.select()
|
|
42
|
-
}}
|
|
43
|
-
on:blur={() => {
|
|
44
|
-
opened = false
|
|
45
|
-
}}
|
|
46
|
-
/>
|
|
47
|
-
</span>
|
|
48
|
-
{#if opened}
|
|
49
|
-
<icon class="selector-opened" />
|
|
50
|
-
{:else}
|
|
51
|
-
<icon class="selector-closed" />
|
|
52
|
-
{/if}
|
|
53
|
-
</div>
|
|
54
|
-
|
|
55
|
-
{#if opened}
|
|
56
|
-
<Slider>
|
|
57
|
-
<List
|
|
58
|
-
bind:items={data}
|
|
59
|
-
bind:value
|
|
60
|
-
{fields}
|
|
61
|
-
{using}
|
|
62
|
-
on:select={handleSelect}
|
|
63
|
-
on:change
|
|
64
|
-
/>
|
|
65
|
-
</Slider>
|
|
66
|
-
{/if}
|
|
67
|
-
</div>
|
package/src/EditableTabs.svelte
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import TabItems from './TabItems.svelte'
|
|
3
|
-
import TabItem from './TabItem.svelte'
|
|
4
|
-
|
|
5
|
-
let className = ''
|
|
6
|
-
export { className as class }
|
|
7
|
-
export let items = []
|
|
8
|
-
export let fields = {}
|
|
9
|
-
export let title = null
|
|
10
|
-
export let allowAdd = false
|
|
11
|
-
export let allowClose = false
|
|
12
|
-
export let value = items[0]
|
|
13
|
-
|
|
14
|
-
function addTab() {
|
|
15
|
-
items = [...items, {}]
|
|
16
|
-
value = items[items.length - 1]
|
|
17
|
-
}
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<tab-view class="flex flex-col w-full flex-grow {className}">
|
|
21
|
-
<tabs class="flex flex-row flex-shrink-0 w-full select-none cursor-pointer">
|
|
22
|
-
{#if title}
|
|
23
|
-
<p>{title}</p>
|
|
24
|
-
{/if}
|
|
25
|
-
<TabItems {items} {fields} {allowClose} bind:value on:close />
|
|
26
|
-
{#if allowAdd}
|
|
27
|
-
<TabItem label="+" on:click={addTab} />
|
|
28
|
-
{/if}
|
|
29
|
-
</tabs>
|
|
30
|
-
<content class="flex flex-col flex-grow"><slot /></content>
|
|
31
|
-
</tab-view>
|
package/src/Icon.svelte
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
let className = ''
|
|
3
|
-
export { className as class }
|
|
4
|
-
|
|
5
|
-
export let name = ''
|
|
6
|
-
let h
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<square-icon
|
|
10
|
-
class="flex flex-col flex-shrink-0 h-full items-center justify-center {className}"
|
|
11
|
-
bind:clientHeight={h}
|
|
12
|
-
style:width="{h}px"
|
|
13
|
-
>
|
|
14
|
-
<icon class={name} aria-hidden="true" />
|
|
15
|
-
</square-icon>
|
package/src/List-Discard.svelte
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import ListActions from './ListActions.svelte'
|
|
3
|
-
import ListItems from './List.svelte'
|
|
4
|
-
|
|
5
|
-
let className = 'list'
|
|
6
|
-
export { className as class }
|
|
7
|
-
export let items = []
|
|
8
|
-
export let fields = {}
|
|
9
|
-
export let using = {}
|
|
10
|
-
export let value = null
|
|
11
|
-
export let searchable = false
|
|
12
|
-
export let editable = false
|
|
13
|
-
|
|
14
|
-
let search
|
|
15
|
-
let filtered
|
|
16
|
-
|
|
17
|
-
function addItem() {
|
|
18
|
-
items = [...items, {}]
|
|
19
|
-
value = items[items.length - 1]
|
|
20
|
-
}
|
|
21
|
-
function deleteSelection() {
|
|
22
|
-
if (value) value.isDeleted = true
|
|
23
|
-
}
|
|
24
|
-
function clearSelection() {
|
|
25
|
-
value = null
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
$: filtered =
|
|
29
|
-
searchable && search && search.length
|
|
30
|
-
? items.filter((item) => item[fields.text].includes(search))
|
|
31
|
-
: items
|
|
32
|
-
</script>
|
|
33
|
-
|
|
34
|
-
<list class="flex flex-col w-full {className}">
|
|
35
|
-
{#if searchable || editable}
|
|
36
|
-
<ListActions
|
|
37
|
-
bind:search
|
|
38
|
-
{searchable}
|
|
39
|
-
{editable}
|
|
40
|
-
on:delete={deleteSelection}
|
|
41
|
-
on:clear={clearSelection}
|
|
42
|
-
on:add={addItem}
|
|
43
|
-
/>
|
|
44
|
-
{/if}
|
|
45
|
-
<scroll class="flex flex-col h-full overflow-scroll">
|
|
46
|
-
<ListItems bind:items={filtered} {fields} {using} bind:value on:select />
|
|
47
|
-
</scroll>
|
|
48
|
-
</list>
|
package/src/List.svelte
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { navigator } from './actions'
|
|
3
|
-
import { createEventDispatcher } from 'svelte'
|
|
4
|
-
import { defaultFields } from './constants'
|
|
5
|
-
import { Text } from './items'
|
|
6
|
-
|
|
7
|
-
const dispatch = createEventDispatcher()
|
|
8
|
-
|
|
9
|
-
let className = 'list'
|
|
10
|
-
export { className as class }
|
|
11
|
-
export let items = []
|
|
12
|
-
export let fields = {}
|
|
13
|
-
export let using = {}
|
|
14
|
-
export let value = null
|
|
15
|
-
export let tabindex = 0
|
|
16
|
-
export let hierarchy = []
|
|
17
|
-
let cursor = []
|
|
18
|
-
|
|
19
|
-
function handleNav(event) {
|
|
20
|
-
value = event.detail.node
|
|
21
|
-
cursor = event.detail.path
|
|
22
|
-
|
|
23
|
-
dispatch('select', { item: value, indices: cursor })
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
$: fields = { ...defaultFields, ...fields }
|
|
27
|
-
$: using = { default: Text, ...using }
|
|
28
|
-
$: filtered = items.filter((item) => !item[fields.isDeleted])
|
|
29
|
-
</script>
|
|
30
|
-
|
|
31
|
-
<list
|
|
32
|
-
class="flex flex-col w-full flex-shrink-0 select-none {className}"
|
|
33
|
-
role="listbox"
|
|
34
|
-
use:navigator={{
|
|
35
|
-
items,
|
|
36
|
-
fields,
|
|
37
|
-
enabled: hierarchy.length == 0,
|
|
38
|
-
indices: cursor
|
|
39
|
-
}}
|
|
40
|
-
on:move={handleNav}
|
|
41
|
-
on:select={handleNav}
|
|
42
|
-
{tabindex}
|
|
43
|
-
>
|
|
44
|
-
<slot />
|
|
45
|
-
{#each filtered as item, index}
|
|
46
|
-
{@const component = item[fields.component]
|
|
47
|
-
? using[item[fields.component]] || using.default
|
|
48
|
-
: using.default}
|
|
49
|
-
{@const path = [...hierarchy, index].join(',')}
|
|
50
|
-
<item
|
|
51
|
-
class="flex flex-shrink-0 flex-grow-0 items-center cursor-pointer w-full gap-2 select-none item"
|
|
52
|
-
role="option"
|
|
53
|
-
aria-selected={value === item}
|
|
54
|
-
class:is-selected={value === item}
|
|
55
|
-
data-path={path}
|
|
56
|
-
>
|
|
57
|
-
<svelte:component
|
|
58
|
-
this={component}
|
|
59
|
-
bind:content={item}
|
|
60
|
-
{fields}
|
|
61
|
-
on:change
|
|
62
|
-
/>
|
|
63
|
-
</item>
|
|
64
|
-
{/each}
|
|
65
|
-
</list>
|
package/src/ListActions.svelte
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
// import Icon from '../layout/Icon.svelte'
|
|
3
|
-
import { createEventDispatcher } from 'svelte'
|
|
4
|
-
import { defaultStateIcons } from './constants'
|
|
5
|
-
|
|
6
|
-
const dispatch = createEventDispatcher()
|
|
7
|
-
|
|
8
|
-
export let search
|
|
9
|
-
export let searchable = true
|
|
10
|
-
export let editable = false
|
|
11
|
-
|
|
12
|
-
const actionIcons = defaultStateIcons.action
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<toolbar class="flex flex-row w-full items-center">
|
|
16
|
-
{#if searchable}
|
|
17
|
-
<search class="flex flex-row flex-grow">
|
|
18
|
-
<icon class={actionIcons.search} />
|
|
19
|
-
<input
|
|
20
|
-
type="search"
|
|
21
|
-
bind:value={search}
|
|
22
|
-
class="rounded-r-full px-3 leading-loose"
|
|
23
|
-
placeholder="search"
|
|
24
|
-
/>
|
|
25
|
-
</search>
|
|
26
|
-
{/if}
|
|
27
|
-
{#if editable}
|
|
28
|
-
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
29
|
-
<icon class={actionIcons.clear} on:click={() => dispatch('clear')} />
|
|
30
|
-
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
31
|
-
<icon class={actionIcons.remove} on:click={() => dispatch('remove')} />
|
|
32
|
-
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
33
|
-
<icon class={actionIcons.add} on:click={() => dispatch('add')} />
|
|
34
|
-
{/if}
|
|
35
|
-
</toolbar>
|
package/src/NavTabs.svelte
DELETED
|
File without changes
|
package/src/NestedList.svelte
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { Node, Text } from './items'
|
|
3
|
-
import { defaultFields } from './constants'
|
|
4
|
-
import { createEventDispatcher } from 'svelte'
|
|
5
|
-
// import { navigator } from './actions/navigator'
|
|
6
|
-
|
|
7
|
-
// const dispatch = createEventDispatcher()
|
|
8
|
-
|
|
9
|
-
export let items = []
|
|
10
|
-
export let fields = defaultFields
|
|
11
|
-
export let using = {}
|
|
12
|
-
export let types = []
|
|
13
|
-
export let value = null
|
|
14
|
-
export let linesVisible = true
|
|
15
|
-
export let rtl = false
|
|
16
|
-
export let hierarchy = []
|
|
17
|
-
|
|
18
|
-
// let indices = []
|
|
19
|
-
|
|
20
|
-
// function handle(event) {
|
|
21
|
-
// value = event.detail.node
|
|
22
|
-
// indices = event.detail.path
|
|
23
|
-
// if (['collapse', 'expand'].includes(event.type)) {
|
|
24
|
-
// items = items
|
|
25
|
-
// }
|
|
26
|
-
// dispatch(event.type, value)
|
|
27
|
-
// }
|
|
28
|
-
|
|
29
|
-
$: using = { default: Text, ...using }
|
|
30
|
-
$: fields = { ...defaultFields, ...fields }
|
|
31
|
-
$: nodeTypes = items.map((_, index) =>
|
|
32
|
-
index === items.length - 1 ? 'last' : 'middle'
|
|
33
|
-
)
|
|
34
|
-
</script>
|
|
35
|
-
|
|
36
|
-
<nested-list
|
|
37
|
-
class="flex flex-col w-full"
|
|
38
|
-
role="listbox"
|
|
39
|
-
class:rtl
|
|
40
|
-
tabindex="-1"
|
|
41
|
-
>
|
|
42
|
-
<!-- tabindex={hierarchy.length == 0 ? 0 : -1}
|
|
43
|
-
use:navigator={{ items, fields, indices, enabled: hierarchy.length == 0 }}
|
|
44
|
-
on:select={handle}
|
|
45
|
-
on:move={handle}
|
|
46
|
-
on:expand={handle}
|
|
47
|
-
on:collapse={handle}
|
|
48
|
-
> -->
|
|
49
|
-
{#each items as content, index}
|
|
50
|
-
{@const type = nodeTypes[index] === 'middle' ? 'line' : 'empty'}
|
|
51
|
-
{@const hasChildren = fields.children in content}
|
|
52
|
-
{@const connectors = types.slice(0, -1)}
|
|
53
|
-
{@const path = [...hierarchy, index]}
|
|
54
|
-
|
|
55
|
-
<Node
|
|
56
|
-
bind:content
|
|
57
|
-
{fields}
|
|
58
|
-
{using}
|
|
59
|
-
types={[...connectors, nodeTypes[index]]}
|
|
60
|
-
{linesVisible}
|
|
61
|
-
{rtl}
|
|
62
|
-
{path}
|
|
63
|
-
selected={value === content}
|
|
64
|
-
/>
|
|
65
|
-
{#if hasChildren && content[fields.isOpen]}
|
|
66
|
-
<svelte:self
|
|
67
|
-
items={content[fields.children]}
|
|
68
|
-
bind:value
|
|
69
|
-
{fields}
|
|
70
|
-
{using}
|
|
71
|
-
types={[...connectors, type, nodeTypes[index]]}
|
|
72
|
-
{linesVisible}
|
|
73
|
-
hierarchy={path}
|
|
74
|
-
/>
|
|
75
|
-
{/if}
|
|
76
|
-
{/each}
|
|
77
|
-
</nested-list>
|
package/src/Overlay.svelte
DELETED
package/src/PageNavigator.svelte
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { createEventDispatcher } from 'svelte'
|
|
3
|
-
import { defaultFields, defaultStateIcons } from './constants'
|
|
4
|
-
import Icon from './Icon.svelte'
|
|
5
|
-
|
|
6
|
-
const dispatch = createEventDispatcher()
|
|
7
|
-
|
|
8
|
-
let className = ''
|
|
9
|
-
export { className as class }
|
|
10
|
-
|
|
11
|
-
export let items = []
|
|
12
|
-
export let value = items[0]
|
|
13
|
-
export let fields = {}
|
|
14
|
-
export let numbers = false
|
|
15
|
-
|
|
16
|
-
const navigate = defaultStateIcons.navigate
|
|
17
|
-
|
|
18
|
-
let previous
|
|
19
|
-
let next
|
|
20
|
-
|
|
21
|
-
function updateOnChange(value, items) {
|
|
22
|
-
let index = items.findIndex((x) => x == value)
|
|
23
|
-
if (index == -1) value = items[0]
|
|
24
|
-
// } else {
|
|
25
|
-
previous = index > 0 ? items[index - 1] : null
|
|
26
|
-
next = index < items.length - 1 ? items[index + 1] : null
|
|
27
|
-
// }
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function handleClick(item) {
|
|
31
|
-
if (item) {
|
|
32
|
-
value = item
|
|
33
|
-
dispatch('select', value)
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
$: fields = { ...defaultFields, ...fields }
|
|
38
|
-
$: updateOnChange(value, items)
|
|
39
|
-
|
|
40
|
-
// $: value = items.findIndex((x) => x == value) ? value : items[0]
|
|
41
|
-
</script>
|
|
42
|
-
|
|
43
|
-
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
|
44
|
-
<nav-pages class="grid grid-cols-3 select-none {className}" tabindex="0">
|
|
45
|
-
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
46
|
-
<span
|
|
47
|
-
class="flex items-center cursor-pointer"
|
|
48
|
-
on:click={() => handleClick(previous)}
|
|
49
|
-
tabIndex={previous ? 0 : -1}
|
|
50
|
-
>
|
|
51
|
-
{#if previous}
|
|
52
|
-
<Icon name={navigate.left} />
|
|
53
|
-
<p>
|
|
54
|
-
{#if previous[fields.text]}
|
|
55
|
-
{previous[fields.text]}
|
|
56
|
-
{/if}
|
|
57
|
-
</p>
|
|
58
|
-
{/if}
|
|
59
|
-
</span>
|
|
60
|
-
<span class="flex items-center justify-center">
|
|
61
|
-
<block class="flex items-center">
|
|
62
|
-
{#each items as item, index}
|
|
63
|
-
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
64
|
-
<pg
|
|
65
|
-
class:numbers
|
|
66
|
-
class:dot={!numbers}
|
|
67
|
-
class:is-selected={value == item}
|
|
68
|
-
on:click={() => handleClick(item)}
|
|
69
|
-
tabindex="0"
|
|
70
|
-
class="cursor-pointer"
|
|
71
|
-
>
|
|
72
|
-
{#if numbers}
|
|
73
|
-
{index + 1}
|
|
74
|
-
{/if}
|
|
75
|
-
</pg>
|
|
76
|
-
{/each}
|
|
77
|
-
</block>
|
|
78
|
-
</span>
|
|
79
|
-
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
80
|
-
<span
|
|
81
|
-
class="flex items-center cursor-pointer justify-end"
|
|
82
|
-
on:click={() => handleClick(next)}
|
|
83
|
-
tabIndex={next ? 0 : -1}
|
|
84
|
-
>
|
|
85
|
-
{#if next}
|
|
86
|
-
<p class="text-right">
|
|
87
|
-
{#if next[fields.text]}
|
|
88
|
-
{next[fields.text]}
|
|
89
|
-
{/if}
|
|
90
|
-
</p>
|
|
91
|
-
<Icon name={navigate.right} />
|
|
92
|
-
{/if}
|
|
93
|
-
</span>
|
|
94
|
-
</nav-pages>
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { swipeable } from './actions/swipeable'
|
|
3
|
-
import { navigable } from './actions/navigable'
|
|
4
|
-
import { fly, fade } from 'svelte/transition'
|
|
5
|
-
import { cubicInOut } from 'svelte/easing'
|
|
6
|
-
|
|
7
|
-
let className = 'three-col'
|
|
8
|
-
export { className as class }
|
|
9
|
-
export let items
|
|
10
|
-
export let small = true
|
|
11
|
-
export let duration = 400
|
|
12
|
-
export let easing = cubicInOut
|
|
13
|
-
export let value
|
|
14
|
-
|
|
15
|
-
let previous = -1
|
|
16
|
-
let activeIndex = 0
|
|
17
|
-
let direction = 1
|
|
18
|
-
let width
|
|
19
|
-
|
|
20
|
-
function handleNext() {
|
|
21
|
-
if (activeIndex < items.length - 1) value = items[activeIndex + 1]
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function handlePrevious() {
|
|
25
|
-
if (activeIndex > 0) value = items[activeIndex - 1]
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function activeIndexFromPage(value) {
|
|
29
|
-
const index = items.findIndex((item) => item === value)
|
|
30
|
-
return index > -1 ? index : 0
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
$: activeIndex = activeIndexFromPage(value)
|
|
34
|
-
$: {
|
|
35
|
-
direction = Math.sign(activeIndex - previous)
|
|
36
|
-
previous = activeIndex
|
|
37
|
-
}
|
|
38
|
-
</script>
|
|
39
|
-
|
|
40
|
-
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
|
41
|
-
<container
|
|
42
|
-
use:swipeable={{ enabled: small }}
|
|
43
|
-
on:swipeLeft={handleNext}
|
|
44
|
-
on:swipeRight={handlePrevious}
|
|
45
|
-
use:navigable={{ enabled: small }}
|
|
46
|
-
on:previous={handlePrevious}
|
|
47
|
-
on:next={handleNext}
|
|
48
|
-
tabindex={0}
|
|
49
|
-
class="overflow-hidden {className}"
|
|
50
|
-
bind:clientWidth={width}
|
|
51
|
-
>
|
|
52
|
-
{#each items as item, index}
|
|
53
|
-
{@const segmentClass = 'col-' + (index + 1)}
|
|
54
|
-
{@const props = item.props ?? {}}
|
|
55
|
-
{#if small && index === activeIndex}
|
|
56
|
-
<segment
|
|
57
|
-
class="absolute w-full h-full {segmentClass}"
|
|
58
|
-
out:fade={{
|
|
59
|
-
x: -1 * direction * width,
|
|
60
|
-
duration,
|
|
61
|
-
easing
|
|
62
|
-
}}
|
|
63
|
-
in:fly={{ x: direction * width, duration, easing }}
|
|
64
|
-
>
|
|
65
|
-
<svelte:component this={item.component} {...props} />
|
|
66
|
-
</segment>
|
|
67
|
-
{:else if !small}
|
|
68
|
-
<segment class={segmentClass}>
|
|
69
|
-
<svelte:component this={item.component} {...props} />
|
|
70
|
-
</segment>
|
|
71
|
-
{/if}
|
|
72
|
-
{/each}
|
|
73
|
-
</container>
|
package/src/Scrollable.svelte
DELETED
package/src/Searchable.svelte
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import Scrollable from './Scrollable.svelte'
|
|
3
|
-
|
|
4
|
-
export let search = ''
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<div class="flex flex-col overflow-hidden h-full w-full searchable">
|
|
8
|
-
<div class="flex flex-col flex-shrink-0 flex-grow px-4 py-2 quick-search">
|
|
9
|
-
<input
|
|
10
|
-
type="search"
|
|
11
|
-
bind:value={search}
|
|
12
|
-
class="rounded-full px-3 leading-loose"
|
|
13
|
-
placeholder="search"
|
|
14
|
-
/>
|
|
15
|
-
</div>
|
|
16
|
-
<Scrollable>
|
|
17
|
-
<slot />
|
|
18
|
-
</Scrollable>
|
|
19
|
-
</div>
|
package/src/Sidebar.svelte
DELETED
package/src/Slider.svelte
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { slide, fade } from 'svelte/transition'
|
|
3
|
-
|
|
4
|
-
let className = 'menu'
|
|
5
|
-
export { className as class }
|
|
6
|
-
export let top
|
|
7
|
-
export let offset = -top
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<scroll
|
|
11
|
-
in:slide={{ duration: 50, y: offset }}
|
|
12
|
-
out:fade={{ duration: 50 }}
|
|
13
|
-
style:top="{top}px"
|
|
14
|
-
class="flex flex-col absolute w-full z-10 overflow-scroll {className}"
|
|
15
|
-
>
|
|
16
|
-
<slot />
|
|
17
|
-
</scroll>
|
package/src/SpinList.svelte
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { createEventDispatcher } from 'svelte'
|
|
3
|
-
import { defaultFields } from './constants'
|
|
4
|
-
import { Text } from './items'
|
|
5
|
-
import { navigable } from './actions'
|
|
6
|
-
import { getComponent } from './list'
|
|
7
|
-
|
|
8
|
-
const dispatch = createEventDispatcher()
|
|
9
|
-
|
|
10
|
-
let className = ''
|
|
11
|
-
export { className as class }
|
|
12
|
-
export let items = []
|
|
13
|
-
export let fields = {}
|
|
14
|
-
export let using = {}
|
|
15
|
-
export let value
|
|
16
|
-
let index = -1
|
|
17
|
-
|
|
18
|
-
function moveNext() {
|
|
19
|
-
index = index < items.length - 1 ? index + 1 : 0
|
|
20
|
-
dispatch('select', items[index])
|
|
21
|
-
}
|
|
22
|
-
function moveBack() {
|
|
23
|
-
index = index > 0 ? index - 1 : items.length - 1
|
|
24
|
-
dispatch('select', items[index])
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
$: using = { default: Text, ...using }
|
|
28
|
-
$: fields = { ...defaultFields, ...fields }
|
|
29
|
-
$: value = index >= 0 ? items[index] : null
|
|
30
|
-
$: component = getComponent(value, fields)
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
|
-
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
|
34
|
-
<spin-list class="flex flex-row w-full {className}" tabindex={0}>
|
|
35
|
-
<input
|
|
36
|
-
type="text"
|
|
37
|
-
class="flex flex-grow"
|
|
38
|
-
bind:value
|
|
39
|
-
readonly
|
|
40
|
-
use:navigable
|
|
41
|
-
on:next={moveNext}
|
|
42
|
-
on:previous={moveBack}
|
|
43
|
-
/>
|
|
44
|
-
<!-- <svelte:component this={component} bind:content={value} {fields} on:change /> -->
|
|
45
|
-
<square class="h-full position-absolute right-0">
|
|
46
|
-
<icon class="i-carbon-chevron-sort" />
|
|
47
|
-
</square>
|
|
48
|
-
</spin-list>
|