@rokkit/core 1.0.0-next.13 → 1.0.0-next.130
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/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 +107 -0
- package/dist/vite/icon-collections.d.ts +32 -0
- package/dist/vite/index.d.ts +1 -0
- package/package.json +24 -39
- package/src/calendar.js +44 -0
- package/src/colors/extra.json +16 -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 +181 -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 +36 -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/ticks.js +26 -0
- package/src/types.js +160 -0
- package/src/utils.js +250 -0
- package/src/vite/icon-collections.js +73 -0
- package/src/vite/index.js +1 -0
- package/LICENSE +0 -21
- package/README.md +0 -1
- 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 -189
- 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/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>
|
package/src/SplitPane.svelte
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { createEventDispatcher } from 'svelte'
|
|
3
|
-
import { pannable } from './actions'
|
|
4
|
-
|
|
5
|
-
const dispatch = createEventDispatcher()
|
|
6
|
-
|
|
7
|
-
export let vertical = false
|
|
8
|
-
export let limits = [50, 30]
|
|
9
|
-
export let pos = 70
|
|
10
|
-
export let styles = ['', '']
|
|
11
|
-
|
|
12
|
-
let refs = {}
|
|
13
|
-
|
|
14
|
-
function clamp(min, max, value) {
|
|
15
|
-
return min > value ? min : max < value ? max : value
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function handlePanMove(event) {
|
|
19
|
-
const { top, bottom, left, right } = refs.wrapper.getBoundingClientRect()
|
|
20
|
-
const extents = horizontal ? [left, right] : [top, bottom]
|
|
21
|
-
let px = clamp(
|
|
22
|
-
extents[0],
|
|
23
|
-
extents[1],
|
|
24
|
-
horizontal ? event.detail.x : event.detail.y
|
|
25
|
-
)
|
|
26
|
-
pos = clamp(
|
|
27
|
-
limits[0],
|
|
28
|
-
100 - limits[1],
|
|
29
|
-
(100 * (px - extents[0])) / (extents[1] - extents[0])
|
|
30
|
-
)
|
|
31
|
-
dispatch('change', { pos })
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
$: horizontal = !vertical
|
|
35
|
-
$: side = horizontal ? 'left' : 'top'
|
|
36
|
-
$: dimension = horizontal ? 'width' : 'height'
|
|
37
|
-
$: direction = vertical ? 'vertical' : 'horizontal'
|
|
38
|
-
</script>
|
|
39
|
-
|
|
40
|
-
<div class="wrapper {direction}" bind:this={refs.wrapper}>
|
|
41
|
-
<div class={styles[0]} style="{dimension}: {pos}%;">
|
|
42
|
-
<slot name="a" />
|
|
43
|
-
</div>
|
|
44
|
-
<div class={styles[1]} style="{dimension}: {100 - pos}%;">
|
|
45
|
-
<slot name="b" />
|
|
46
|
-
</div>
|
|
47
|
-
<span
|
|
48
|
-
class="wall"
|
|
49
|
-
use:pannable
|
|
50
|
-
on:panmove={handlePanMove}
|
|
51
|
-
style="{side}: calc({pos}% - 8px)"
|
|
52
|
-
/>
|
|
53
|
-
</div>
|
|
54
|
-
|
|
55
|
-
<style>
|
|
56
|
-
.wrapper {
|
|
57
|
-
position: relative;
|
|
58
|
-
display: flex;
|
|
59
|
-
height: 100%;
|
|
60
|
-
width: 100%;
|
|
61
|
-
}
|
|
62
|
-
.wrapper div {
|
|
63
|
-
flex: 1 1 auto;
|
|
64
|
-
height: 100%;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.horizontal {
|
|
68
|
-
flex-direction: row;
|
|
69
|
-
}
|
|
70
|
-
.vertical {
|
|
71
|
-
flex-direction: column;
|
|
72
|
-
}
|
|
73
|
-
.wall {
|
|
74
|
-
position: absolute;
|
|
75
|
-
z-index: 10;
|
|
76
|
-
}
|
|
77
|
-
.wall::after {
|
|
78
|
-
content: '';
|
|
79
|
-
position: absolute;
|
|
80
|
-
background-color: var(--bg-800);
|
|
81
|
-
}
|
|
82
|
-
.wall:hover {
|
|
83
|
-
cursor: ew-resize;
|
|
84
|
-
}
|
|
85
|
-
.horizontal .wall {
|
|
86
|
-
padding: 0 8px;
|
|
87
|
-
width: 0;
|
|
88
|
-
height: 100%;
|
|
89
|
-
cursor: ew-resize;
|
|
90
|
-
}
|
|
91
|
-
.horizontal .wall::after {
|
|
92
|
-
left: 8px;
|
|
93
|
-
top: 0;
|
|
94
|
-
width: 1px;
|
|
95
|
-
height: 100%;
|
|
96
|
-
}
|
|
97
|
-
.vertical .wall {
|
|
98
|
-
padding: 8px 0;
|
|
99
|
-
width: 100%;
|
|
100
|
-
height: 0;
|
|
101
|
-
cursor: ns-resize;
|
|
102
|
-
}
|
|
103
|
-
.vertical .wall::after {
|
|
104
|
-
top: 8px;
|
|
105
|
-
left: 0;
|
|
106
|
-
width: 100%;
|
|
107
|
-
height: 1px;
|
|
108
|
-
}
|
|
109
|
-
</style>
|
package/src/SplitView.svelte
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import Splitter from './Splitter.svelte'
|
|
3
|
-
|
|
4
|
-
export let vertical = false
|
|
5
|
-
export let min = 30
|
|
6
|
-
export let max = 70
|
|
7
|
-
export let pos = 30
|
|
8
|
-
|
|
9
|
-
$: sizes = [pos, 100 - pos]
|
|
10
|
-
|
|
11
|
-
$: direction = { direction: vertical ? 'flex-col' : 'flex-row' }
|
|
12
|
-
$: sizeA = {
|
|
13
|
-
width: vertical ? 100 : sizes[0],
|
|
14
|
-
height: vertical ? sizes[0] : 100
|
|
15
|
-
}
|
|
16
|
-
$: sizeB = {
|
|
17
|
-
width: vertical ? 100 : sizes[1],
|
|
18
|
-
height: vertical ? sizes[1] : 100
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function onSplitterChange(e) {
|
|
22
|
-
pos = e.detail.pos - e.detail.offset
|
|
23
|
-
}
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<div class="relative flex w-full h-full" style:--direction={direction}>
|
|
27
|
-
<section style:--sizeA={sizeA} class="flex flex-grow flex-shrink select-none">
|
|
28
|
-
<slot name="a" />
|
|
29
|
-
</section>
|
|
30
|
-
<section style:--sizeB={sizeB} class="flex flex-grow flex-shrink select-none">
|
|
31
|
-
<slot name="b" />
|
|
32
|
-
</section>
|
|
33
|
-
<Splitter {vertical} {min} {max} {pos} on:change={onSplitterChange} />
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<style>
|
|
37
|
-
div {
|
|
38
|
-
flex-direction: var(--direction);
|
|
39
|
-
}
|
|
40
|
-
section {
|
|
41
|
-
width: calc(var(--width) * 1%);
|
|
42
|
-
height: calc(var(--height) * 1%);
|
|
43
|
-
}
|
|
44
|
-
</style>
|