@rokkit/core 1.0.0-next.32 → 1.0.0-next.34
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/package.json +13 -11
- package/src/ListActions.svelte +1 -1
- package/src/NestedPaginator.svelte +3 -4
- package/src/PageNavigator.svelte +2 -2
- package/src/ResponsiveGrid.svelte +1 -2
- package/src/SpinList.svelte +5 -5
- package/src/SplitPane.svelte +1 -1
- package/src/Splitter.svelte +1 -1
- package/src/TabItems.svelte +1 -1
- package/src/index.js +15 -15
- package/src/Accordion.svelte +0 -80
- package/src/Alerts.svelte +0 -39
- package/src/BreadCrumbs.svelte +0 -34
- package/src/DropDown.svelte +0 -82
- package/src/DropSearch.svelte +0 -67
- package/src/Icon.svelte +0 -38
- package/src/List.svelte +0 -66
- package/src/NestedList.svelte +0 -59
- package/src/Slider.svelte +0 -17
- package/src/Switch.svelte +0 -69
- package/src/Tabs.svelte +0 -82
- package/src/Tree.svelte +0 -52
- 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 -42
- package/src/actions/navigator.js +0 -179
- package/src/actions/pannable.js +0 -57
- package/src/actions/swipeable.js +0 -55
- package/src/actions/themeable.js +0 -23
- package/src/constants.js +0 -95
- package/src/items/Connector.svelte +0 -28
- package/src/items/Item.svelte +0 -29
- package/src/items/ItemWrapper.svelte +0 -47
- package/src/items/Link.svelte +0 -18
- package/src/items/Node.svelte +0 -47
- package/src/items/Separator.svelte +0 -1
- package/src/items/Summary.svelte +0 -27
- package/src/items/index.js +0 -7
- package/src/lib/connector.js +0 -12
- package/src/lib/index.js +0 -7
- package/src/lib/nested.js +0 -45
- package/src/list.js +0 -14
- package/src/mocks/Custom.svelte +0 -6
- package/src/mocks/index.js +0 -17
- package/src/stores/alerts.js +0 -2
- package/src/stores/index.js +0 -6
- package/src/stores/persist.js +0 -63
- package/src/stores/theme.js +0 -34
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
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { vi } from 'vitest'
|
|
2
|
-
|
|
3
|
-
export function createEvent(x, y) {
|
|
4
|
-
return {
|
|
5
|
-
clientX: x,
|
|
6
|
-
clientY: y,
|
|
7
|
-
stopPropagation: vi.fn(),
|
|
8
|
-
preventDefault: vi.fn()
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
export function createTouchEvent(clientX, clientY) {
|
|
12
|
-
return {
|
|
13
|
-
touches: [{ clientX, clientY }],
|
|
14
|
-
preventDefault: vi.fn(),
|
|
15
|
-
stopPropagation: vi.fn()
|
|
16
|
-
}
|
|
17
|
-
}
|
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 && 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())
|