@rokkit/core 1.0.0-next.13 → 1.0.0-next.131
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 +25 -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 +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/theme.ts +192 -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/items/Pill.svelte
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { createEventDispatcher } from 'svelte'
|
|
3
|
-
import { defaultStateIcons } from '../constants'
|
|
4
|
-
|
|
5
|
-
const dispatch = createEventDispatcher()
|
|
6
|
-
|
|
7
|
-
export let item
|
|
8
|
-
export let fields
|
|
9
|
-
|
|
10
|
-
function handleClick() {
|
|
11
|
-
dispatch('remove', item)
|
|
12
|
-
}
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<pill class="flex flex-row items-center">
|
|
16
|
-
{item[fields.text]}
|
|
17
|
-
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
18
|
-
<icon class={defaultStateIcons.item.remove} on:click={handleClick} />
|
|
19
|
-
</pill>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<span class="my-4 flex flex-grow separator" />
|
package/src/items/Summary.svelte
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { defaultFields } from '../constants'
|
|
3
|
-
import Text from './Text.svelte'
|
|
4
|
-
|
|
5
|
-
export let content
|
|
6
|
-
export let fields = {}
|
|
7
|
-
export let using = {}
|
|
8
|
-
|
|
9
|
-
$: fields = { ...defaultFields, ...fields }
|
|
10
|
-
$: using = { default: Text, ...using }
|
|
11
|
-
$: hasItems = content[fields.children] && content[fields.children].length > 0
|
|
12
|
-
$: component = using[content[fields.component] ?? 'default']
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<summary
|
|
16
|
-
class="flex flex-row flex-shrink-0 items-center w-full cursor-pointer"
|
|
17
|
-
tabindex="-1"
|
|
18
|
-
>
|
|
19
|
-
<svelte:component this={component} bind:content {fields} />
|
|
20
|
-
{#if hasItems}
|
|
21
|
-
{#if content[fields.isOpen]}
|
|
22
|
-
<icon class="sm accordion-opened" aria-label="expand" />
|
|
23
|
-
{:else}
|
|
24
|
-
<icon class="sm accordion-closed" aria-label="collapse" />
|
|
25
|
-
{/if}
|
|
26
|
-
{/if}
|
|
27
|
-
</summary>
|
package/src/items/Text.svelte
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { defaultFields } from '../constants'
|
|
3
|
-
|
|
4
|
-
export let content
|
|
5
|
-
export let fields = defaultFields
|
|
6
|
-
|
|
7
|
-
$: isObject = typeof content == 'object'
|
|
8
|
-
$: text = isObject ? content[fields.text] : content
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
{#if isObject && content[fields.image]}
|
|
12
|
-
<img
|
|
13
|
-
class="h-8 w-8 rounded-full object-cover"
|
|
14
|
-
alt={content[fields.text]}
|
|
15
|
-
src={content[fields.image]}
|
|
16
|
-
/>
|
|
17
|
-
{/if}
|
|
18
|
-
{#if isObject && content[fields.icon]}
|
|
19
|
-
<icon class={content[fields.icon]} />
|
|
20
|
-
{/if}
|
|
21
|
-
<p class="flex flex-grow">{text}</p>
|
package/src/items/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { default as Text } from './Text.svelte'
|
|
2
|
-
export { default as Link } from './Link.svelte'
|
|
3
|
-
export { default as Node } from './Node.svelte'
|
|
4
|
-
export { default as Pill } from './Pill.svelte'
|
|
5
|
-
export { default as Collapsible } from './Collapsible.svelte'
|
|
6
|
-
export { default as Connector } from './Connector.svelte'
|
|
7
|
-
export { default as Separator } from './Separator.svelte'
|
|
8
|
-
export { default as Summary } from './Summary.svelte'
|
package/src/list.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export function getComponent(item, fields) {
|
|
2
|
-
if (item && typeof item === 'object') {
|
|
3
|
-
return item[fields.component] || fields.default
|
|
4
|
-
}
|
|
5
|
-
return fields.default
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// update position based on externally supplied value
|
|
9
|
-
export function updateCursor(cursor, value, items) {
|
|
10
|
-
if (cursor.length > 0 && value != items[cursor[0]]) {
|
|
11
|
-
let index = items.findIndex((x) => x == value)
|
|
12
|
-
cursor = index > -1 ? [index] : []
|
|
13
|
-
}
|
|
14
|
-
}
|
package/src/mocks/Custom.svelte
DELETED
package/src/mocks/index.js
DELETED
package/src/stores/alerts.js
DELETED
package/src/stores/index.js
DELETED
package/src/stores/persist.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
export const PARSE_ERROR_MESSAGE =
|
|
2
|
-
'Unable to parse value from local storage for key: '
|
|
3
|
-
|
|
4
|
-
if (typeof window === 'undefined') {
|
|
5
|
-
global.localStorage = {
|
|
6
|
-
getItem: () => '{}',
|
|
7
|
-
setItem: () => {}
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export function persistable(key, store) {
|
|
11
|
-
let value
|
|
12
|
-
const storageEventListener = (event) => {
|
|
13
|
-
if (event.key === key) {
|
|
14
|
-
event.stopPropagation()
|
|
15
|
-
event.preventDefault()
|
|
16
|
-
try {
|
|
17
|
-
const newValue = JSON.parse(event.newValue)
|
|
18
|
-
set(newValue)
|
|
19
|
-
} catch (e) {
|
|
20
|
-
console.error(PARSE_ERROR_MESSAGE, key)
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
value = JSON.parse(localStorage.getItem(key))
|
|
27
|
-
// console.log(value)
|
|
28
|
-
store.set(value)
|
|
29
|
-
} catch {
|
|
30
|
-
console.error(PARSE_ERROR_MESSAGE, key)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const set = (newValue) => {
|
|
34
|
-
if (value !== newValue) {
|
|
35
|
-
value = newValue
|
|
36
|
-
localStorage.setItem(key, JSON.stringify(value))
|
|
37
|
-
store.set(value)
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const update = (fn) => {
|
|
42
|
-
store.update((currentValue) => {
|
|
43
|
-
const value = fn(currentValue)
|
|
44
|
-
localStorage.setItem(key, JSON.stringify(value))
|
|
45
|
-
return value
|
|
46
|
-
})
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (typeof window !== 'undefined') {
|
|
50
|
-
window.addEventListener('storage', storageEventListener)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return {
|
|
54
|
-
subscribe: store.subscribe,
|
|
55
|
-
set,
|
|
56
|
-
update,
|
|
57
|
-
destroy() {
|
|
58
|
-
if (typeof window !== 'undefined') {
|
|
59
|
-
window.removeEventListener('storage', storageEventListener)
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
package/src/stores/theme.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { writable } from 'svelte/store'
|
|
2
|
-
import { persistable } from './persist'
|
|
3
|
-
|
|
4
|
-
const THEME_STORE_KEY = 'app-theme'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @typedef {Object} Theme
|
|
8
|
-
* @property {string} name
|
|
9
|
-
* @property {string} mode
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Custom store that takes an object with two properties, name and mode.
|
|
14
|
-
* @returns {import('svelte/store').Writable<Theme>}
|
|
15
|
-
*/
|
|
16
|
-
export function ThemeStore() {
|
|
17
|
-
const store = writable({ name: 'rokkit', mode: 'dark' })
|
|
18
|
-
|
|
19
|
-
const set = (value) => {
|
|
20
|
-
const { name, mode } = value ?? {}
|
|
21
|
-
if (typeof name === 'string' && typeof mode === 'string') {
|
|
22
|
-
store.set(value)
|
|
23
|
-
} else if (value) {
|
|
24
|
-
console.error('Both "name" and "mode" must be strings', value)
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
...store,
|
|
30
|
-
set
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const theme = persistable(THEME_STORE_KEY, ThemeStore())
|