@rokkit/states 1.1.17 → 1.1.18
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/alerts.svelte.d.ts +27 -0
- package/dist/commands.svelte.d.ts +59 -0
- package/dist/constants.d.ts +28 -0
- package/dist/index.d.ts +11 -0
- package/dist/lazy-wrapper.svelte.d.ts +18 -0
- package/dist/media.svelte.d.ts +5 -0
- package/dist/messages.svelte.d.ts +57 -0
- package/dist/proxy-item.svelte.d.ts +117 -0
- package/dist/proxy-table-tree.svelte.d.ts +4 -0
- package/dist/proxy-table.svelte.d.ts +60 -0
- package/dist/proxy-tree.svelte.d.ts +35 -0
- package/dist/tabular.svelte.d.ts +5 -0
- package/dist/vibe.svelte.d.ts +58 -0
- package/dist/wrapper.svelte.d.ts +111 -0
- package/package.json +5 -3
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const alerts: AlertsStore;
|
|
2
|
+
declare class AlertsStore {
|
|
3
|
+
get current(): {
|
|
4
|
+
id: string;
|
|
5
|
+
type: string;
|
|
6
|
+
text?: string;
|
|
7
|
+
dismissible: boolean;
|
|
8
|
+
timeout: number;
|
|
9
|
+
actions?: unknown;
|
|
10
|
+
}[];
|
|
11
|
+
push({ type, text, dismissible, timeout, actions }?: {
|
|
12
|
+
type?: string | undefined;
|
|
13
|
+
dismissible?: boolean | undefined;
|
|
14
|
+
timeout?: number | undefined;
|
|
15
|
+
}): `${string}-${string}-${string}-${string}-${string}`;
|
|
16
|
+
/**
|
|
17
|
+
* Dismiss an alert by id, cancelling its timer if any.
|
|
18
|
+
* @param {string} id
|
|
19
|
+
*/
|
|
20
|
+
dismiss(id: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Clear all alerts and cancel all timers.
|
|
23
|
+
*/
|
|
24
|
+
clear(): void;
|
|
25
|
+
#private;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** Canonicalize a shortcut string: resolve `mod`, sort modifiers, lowercase the key. */
|
|
2
|
+
export function normalizeShortcut(shortcut: any): string;
|
|
3
|
+
/** Build the canonical shortcut string from a KeyboardEvent. */
|
|
4
|
+
export function eventToShortcut(event: any): string;
|
|
5
|
+
export const commands: CommandRegistry;
|
|
6
|
+
/**
|
|
7
|
+
* App command registry — keyboard shortcuts + actions in one place.
|
|
8
|
+
* Singleton, like `vibe`/`messages`. See docs/design/19-command-system.md.
|
|
9
|
+
*/
|
|
10
|
+
export type Command = {
|
|
11
|
+
/**
|
|
12
|
+
* Unique id; re-registering the same id replaces (warns).
|
|
13
|
+
*/
|
|
14
|
+
id: string;
|
|
15
|
+
/**
|
|
16
|
+
* Display text (consumer-localized).
|
|
17
|
+
*/
|
|
18
|
+
label: string;
|
|
19
|
+
/**
|
|
20
|
+
* Executed on shortcut match or palette select.
|
|
21
|
+
*/
|
|
22
|
+
run: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* e.g. 'mod+k' | 'mod+shift+p' | '?'. `mod` = Cmd on macOS / Ctrl elsewhere.
|
|
25
|
+
*/
|
|
26
|
+
shortcut?: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Palette category.
|
|
29
|
+
*/
|
|
30
|
+
group?: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Fire even while a text input is focused (default false).
|
|
33
|
+
*/
|
|
34
|
+
global?: boolean | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Optional dynamic gate.
|
|
37
|
+
*/
|
|
38
|
+
enabled?: (() => boolean) | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Extra palette search terms.
|
|
41
|
+
*/
|
|
42
|
+
keywords?: string[] | undefined;
|
|
43
|
+
};
|
|
44
|
+
declare class CommandRegistry {
|
|
45
|
+
/** @returns {Command[]} */
|
|
46
|
+
get all(): Command[];
|
|
47
|
+
/** @param {Command} cmd @returns {() => void} unregister */
|
|
48
|
+
register(cmd: Command): () => void;
|
|
49
|
+
/** @param {Command[]} cmds @returns {() => void} */
|
|
50
|
+
registerMany(cmds: Command[]): () => void;
|
|
51
|
+
/** @param {string} id */
|
|
52
|
+
unregister(id: string): void;
|
|
53
|
+
/** @param {string} id */
|
|
54
|
+
execute(id: string): void;
|
|
55
|
+
/** @param {KeyboardEvent} event @returns {Command | null} */
|
|
56
|
+
resolve(event: KeyboardEvent): Command | null;
|
|
57
|
+
#private;
|
|
58
|
+
}
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export namespace DEFAULT_EVENTS {
|
|
2
|
+
export { noop as move };
|
|
3
|
+
export { noop as select };
|
|
4
|
+
export { noop as expand };
|
|
5
|
+
export { noop as collapse };
|
|
6
|
+
}
|
|
7
|
+
export const VALID_DENSITIES: string[];
|
|
8
|
+
export const VALID_MODES: string[];
|
|
9
|
+
export const VALID_DIRECTIONS: string[];
|
|
10
|
+
/** @type {string[]} */
|
|
11
|
+
export const DEFAULT_STYLES: string[];
|
|
12
|
+
export namespace DEFAULT_VIBE_OPTIONS {
|
|
13
|
+
export { DEFAULT_STYLES as allowed };
|
|
14
|
+
export let style: string;
|
|
15
|
+
export let mode: string;
|
|
16
|
+
export let density: string;
|
|
17
|
+
}
|
|
18
|
+
export namespace DEFAULT_VIBE_PALETTE {
|
|
19
|
+
let primary: string;
|
|
20
|
+
let secondary: string;
|
|
21
|
+
let success: string;
|
|
22
|
+
let info: string;
|
|
23
|
+
let warning: string;
|
|
24
|
+
let danger: string;
|
|
25
|
+
let light: string;
|
|
26
|
+
let dark: string;
|
|
27
|
+
}
|
|
28
|
+
import { noop } from '@rokkit/core';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { alerts } from "./alerts.svelte.js";
|
|
2
|
+
export { vibe } from "./vibe.svelte.js";
|
|
3
|
+
export { messages } from "./messages.svelte.js";
|
|
4
|
+
export { ProxyTree } from "./proxy-tree.svelte.js";
|
|
5
|
+
export { ProxyTable } from "./proxy-table.svelte.js";
|
|
6
|
+
export { ProxyTableTree } from "./proxy-table-tree.svelte.js";
|
|
7
|
+
export { Wrapper } from "./wrapper.svelte.js";
|
|
8
|
+
export { LazyWrapper } from "./lazy-wrapper.svelte.js";
|
|
9
|
+
export { commands, normalizeShortcut, eventToShortcut } from "./commands.svelte.js";
|
|
10
|
+
export { ProxyItem, LazyProxyItem, BASE_FIELDS } from "./proxy-item.svelte.js";
|
|
11
|
+
export { watchMedia, defaultBreakpoints } from "./media.svelte.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export class LazyWrapper extends Wrapper {
|
|
2
|
+
/**
|
|
3
|
+
* @param {import('./proxy-tree.svelte.js').ProxyTree} proxyTree
|
|
4
|
+
* @param {{ onselect?: Function, onchange?: Function, onlazyload?: Function }} [options]
|
|
5
|
+
*/
|
|
6
|
+
constructor(proxyTree: import("./proxy-tree.svelte.js").ProxyTree, options?: {
|
|
7
|
+
onselect?: Function;
|
|
8
|
+
onchange?: Function;
|
|
9
|
+
onlazyload?: Function;
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* Load more root-level items via the onlazyload callback.
|
|
13
|
+
* Appends results to the proxy tree.
|
|
14
|
+
*/
|
|
15
|
+
loadMore(): Promise<void>;
|
|
16
|
+
#private;
|
|
17
|
+
}
|
|
18
|
+
import { Wrapper } from './wrapper.svelte.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** @param {Record<string, string>} breakpoints */
|
|
2
|
+
export function watchMedia(breakpoints?: Record<string, string>): Record<string, MediaQuery>;
|
|
3
|
+
/** @type {Record<string, string>} */
|
|
4
|
+
export const defaultBreakpoints: Record<string, string>;
|
|
5
|
+
import { MediaQuery } from 'svelte/reactivity';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactive messages store. Access strings directly: `messages.select`, `messages.tree.expand`.
|
|
3
|
+
* Configure locale: `messages.register('de', {...})` + `messages.setLocale('de')`.
|
|
4
|
+
*/
|
|
5
|
+
export const messages: MessagesStore;
|
|
6
|
+
declare class MessagesStore {
|
|
7
|
+
emptyList: any;
|
|
8
|
+
emptyTree: any;
|
|
9
|
+
loading: any;
|
|
10
|
+
noResults: any;
|
|
11
|
+
select: any;
|
|
12
|
+
search: any;
|
|
13
|
+
list: any;
|
|
14
|
+
tree: any;
|
|
15
|
+
toolbar: any;
|
|
16
|
+
menu: any;
|
|
17
|
+
toggle: any;
|
|
18
|
+
rating: any;
|
|
19
|
+
stepper: any;
|
|
20
|
+
breadcrumbs: any;
|
|
21
|
+
carousel: any;
|
|
22
|
+
tabs: any;
|
|
23
|
+
table: any;
|
|
24
|
+
code: any;
|
|
25
|
+
range: any;
|
|
26
|
+
search_: any;
|
|
27
|
+
filter: any;
|
|
28
|
+
grid: any;
|
|
29
|
+
uploadProgress: any;
|
|
30
|
+
floatingNav: any;
|
|
31
|
+
mode: any;
|
|
32
|
+
command: any;
|
|
33
|
+
/** Currently active locale tag (read-only). */
|
|
34
|
+
get locale(): string;
|
|
35
|
+
/**
|
|
36
|
+
* Register translation overrides for a locale. Unspecified keys fall back to English defaults.
|
|
37
|
+
* @param {string} locale — BCP 47 tag or any identifier (e.g. 'de', 'fr-CA')
|
|
38
|
+
* @param {Partial<import('./types').Messages>} overrides
|
|
39
|
+
*/
|
|
40
|
+
register(locale: string, overrides: Partial<any>): void;
|
|
41
|
+
/**
|
|
42
|
+
* Switch to a previously registered locale. Use 'en' to restore English defaults.
|
|
43
|
+
* @param {string} locale
|
|
44
|
+
*/
|
|
45
|
+
setLocale(locale: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Apply one-off overrides without naming a locale (convenience / backward compat).
|
|
48
|
+
* @param {Partial<import('./types').Messages>} overrides
|
|
49
|
+
*/
|
|
50
|
+
set(overrides: Partial<any>): void;
|
|
51
|
+
/**
|
|
52
|
+
* Reset to English defaults and clear all registered locales.
|
|
53
|
+
*/
|
|
54
|
+
reset(): void;
|
|
55
|
+
#private;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
export { BASE_FIELDS };
|
|
2
|
+
export class ProxyItem {
|
|
3
|
+
constructor(raw: any, fields?: {}, key?: string, level?: number);
|
|
4
|
+
/**
|
|
5
|
+
* Factory method for creating child proxies. Override in subclasses
|
|
6
|
+
* to produce specialised children (e.g. LazyProxyItem).
|
|
7
|
+
* @param {*} raw
|
|
8
|
+
* @param {Partial<typeof BASE_FIELDS>} fields
|
|
9
|
+
* @param {string} key
|
|
10
|
+
* @param {number} level
|
|
11
|
+
* @returns {ProxyItem}
|
|
12
|
+
*/
|
|
13
|
+
_createChild(raw: any, fields: Partial<typeof BASE_FIELDS>, key: string, level: number): ProxyItem;
|
|
14
|
+
get key(): string;
|
|
15
|
+
get level(): number;
|
|
16
|
+
/** Stable unique identifier — from item's id field, or auto-generated. */
|
|
17
|
+
get id(): any;
|
|
18
|
+
/** The original input passed to the constructor — never mutated. */
|
|
19
|
+
get original(): any;
|
|
20
|
+
/** The merged field-mapping configuration. */
|
|
21
|
+
get fields(): {
|
|
22
|
+
id: string;
|
|
23
|
+
value: string;
|
|
24
|
+
label: string;
|
|
25
|
+
icon: string;
|
|
26
|
+
avatar: string;
|
|
27
|
+
subtext: string;
|
|
28
|
+
tooltip: string;
|
|
29
|
+
badge: string;
|
|
30
|
+
shortcut: string;
|
|
31
|
+
children: string;
|
|
32
|
+
type: string;
|
|
33
|
+
snippet: string;
|
|
34
|
+
href: string;
|
|
35
|
+
hrefTarget: string;
|
|
36
|
+
disabled: string;
|
|
37
|
+
expanded: string;
|
|
38
|
+
selected: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* @param {string} fieldName Semantic name, e.g. 'icon', 'href', 'description'
|
|
42
|
+
* @returns {*}
|
|
43
|
+
*/
|
|
44
|
+
get(fieldName: string): any;
|
|
45
|
+
/**
|
|
46
|
+
* Write a value back to the underlying item through the field mapping.
|
|
47
|
+
* For object items, this modifies the original raw item (since #item === #raw).
|
|
48
|
+
* Increments the version counter so $derived(#buildChildren()) re-computes.
|
|
49
|
+
*
|
|
50
|
+
* @param {string} fieldName Semantic name, e.g. 'children', 'text'
|
|
51
|
+
* @param {*} value
|
|
52
|
+
*/
|
|
53
|
+
set(fieldName: string, value: any): void;
|
|
54
|
+
/**
|
|
55
|
+
* Write directly to the original raw item, bypassing field mapping.
|
|
56
|
+
* Advanced operation for when the caller needs to update the source data.
|
|
57
|
+
* Accepts either (field, value) or an object for batch updates.
|
|
58
|
+
* Increments version so $derived(#buildChildren()) re-computes.
|
|
59
|
+
*
|
|
60
|
+
* @param {string|object} fieldOrBatch Raw key name, or { key: value, … }
|
|
61
|
+
* @param {*} [value]
|
|
62
|
+
*/
|
|
63
|
+
mutate(fieldOrBatch: string | object, value?: any): void;
|
|
64
|
+
get label(): any;
|
|
65
|
+
get value(): any;
|
|
66
|
+
get disabled(): boolean;
|
|
67
|
+
/** True only for object items with a non-empty children array. */
|
|
68
|
+
get hasChildren(): boolean;
|
|
69
|
+
/** Returns wrapped ProxyItem children (empty array for primitives and leaf items). */
|
|
70
|
+
get children(): ProxyItem[];
|
|
71
|
+
get type(): any;
|
|
72
|
+
set expanded(v: boolean);
|
|
73
|
+
get expanded(): boolean;
|
|
74
|
+
set selected(v: boolean);
|
|
75
|
+
get selected(): boolean;
|
|
76
|
+
#private;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* LazyProxyItem
|
|
80
|
+
*
|
|
81
|
+
* Extends ProxyItem with lazy-loading support. When a lazyLoad function
|
|
82
|
+
* is provided, children are fetched on demand via fetch().
|
|
83
|
+
*
|
|
84
|
+
* #lazyLoad — async function (value, raw) => children[] — null when not lazy
|
|
85
|
+
* #loaded — true when: lazyLoad is null, or node already has children array,
|
|
86
|
+
* or after successful fetch(). false only for sentinel nodes
|
|
87
|
+
* (children === true) that need fetching.
|
|
88
|
+
* #loading — true during async fetch(), false otherwise. Used for spinner UI.
|
|
89
|
+
*
|
|
90
|
+
* After fetch(), uses set('children', result) to update the underlying item
|
|
91
|
+
* and trigger #children recomputation via the version counter.
|
|
92
|
+
*
|
|
93
|
+
* The lazyLoad function is propagated to all children automatically via
|
|
94
|
+
* _createChild override.
|
|
95
|
+
*/
|
|
96
|
+
export class LazyProxyItem extends ProxyItem {
|
|
97
|
+
/**
|
|
98
|
+
* @param {*} raw
|
|
99
|
+
* @param {Partial<typeof BASE_FIELDS>} [fields]
|
|
100
|
+
* @param {string} [key]
|
|
101
|
+
* @param {number} [level]
|
|
102
|
+
* @param {((value: unknown, raw: unknown) => Promise<unknown[]>) | null} [lazyLoad]
|
|
103
|
+
*/
|
|
104
|
+
constructor(raw: any, fields?: Partial<typeof BASE_FIELDS>, key?: string, level?: number, lazyLoad?: ((value: unknown, raw: unknown) => Promise<unknown[]>) | null);
|
|
105
|
+
get loaded(): boolean;
|
|
106
|
+
get loading(): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Fetch children via the lazyLoad function.
|
|
109
|
+
* No-op if lazyLoad is null, already loaded, or currently loading.
|
|
110
|
+
* After fetching, writes children to the underlying item via set().
|
|
111
|
+
*/
|
|
112
|
+
fetch(): Promise<void>;
|
|
113
|
+
/** @override — propagate lazyLoad to children */
|
|
114
|
+
override _createChild(raw: any, fields: any, key: any, level: any): LazyProxyItem;
|
|
115
|
+
#private;
|
|
116
|
+
}
|
|
117
|
+
import { BASE_FIELDS } from '@rokkit/core';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export class ProxyTable extends ProxyTree {
|
|
2
|
+
/**
|
|
3
|
+
* @param {Array<Record<string, unknown>>} [data]
|
|
4
|
+
* @param {{ columns?: Array, fields?: object, onsort?: Function }} [options]
|
|
5
|
+
*/
|
|
6
|
+
constructor(data?: Array<Record<string, unknown>>, options?: {
|
|
7
|
+
columns?: any[];
|
|
8
|
+
fields?: object;
|
|
9
|
+
onsort?: Function;
|
|
10
|
+
});
|
|
11
|
+
columns: any[];
|
|
12
|
+
sortState: any[];
|
|
13
|
+
/**
|
|
14
|
+
* Replace underlying data. Re-applies any active sort so the visible
|
|
15
|
+
* rows stay in their sorted order.
|
|
16
|
+
* @param {Array<Record<string, unknown>>} data
|
|
17
|
+
*/
|
|
18
|
+
update(data: Array<Record<string, unknown>>): void;
|
|
19
|
+
/**
|
|
20
|
+
* Protected accessor for subclasses that need to re-sort the underlying
|
|
21
|
+
* data (e.g. ProxyTableTree on column-update).
|
|
22
|
+
*/
|
|
23
|
+
get _rawData(): Record<string, unknown>[];
|
|
24
|
+
/**
|
|
25
|
+
* Replace column definitions. Preserves any existing sort indicators
|
|
26
|
+
* for columns that survive the rename.
|
|
27
|
+
* @param {Array} columns
|
|
28
|
+
*/
|
|
29
|
+
updateColumns(columns: any[]): void;
|
|
30
|
+
/**
|
|
31
|
+
* Toggle sort on a column. Direction cycle: none → ascending → descending → none.
|
|
32
|
+
* Pass `extend=true` (Shift+click) to push onto the multi-column stack.
|
|
33
|
+
* Fires the `onsort` callback after applying.
|
|
34
|
+
*
|
|
35
|
+
* @param {string} columnName
|
|
36
|
+
* @param {boolean} [extend]
|
|
37
|
+
*/
|
|
38
|
+
sortBy(columnName: string, extend?: boolean): void;
|
|
39
|
+
/** Clear all sort state and restore the original data order. */
|
|
40
|
+
clearSort(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Apply the current sortState to a row array. Subclasses (ProxyTableTree)
|
|
43
|
+
* override to walk hierarchical structures.
|
|
44
|
+
*
|
|
45
|
+
* @param {Array<Record<string, unknown>>} rows
|
|
46
|
+
* @returns {Array<Record<string, unknown>>}
|
|
47
|
+
*/
|
|
48
|
+
_sortedData(rows: Array<Record<string, unknown>>): Array<Record<string, unknown>>;
|
|
49
|
+
/**
|
|
50
|
+
* Compare two rows under the current sortState. Used by `_sortedData()`
|
|
51
|
+
* and by subclasses that sort over a hierarchical row tree.
|
|
52
|
+
*
|
|
53
|
+
* @param {Record<string, unknown>} a
|
|
54
|
+
* @param {Record<string, unknown>} b
|
|
55
|
+
* @returns {number}
|
|
56
|
+
*/
|
|
57
|
+
_compareRows(a: Record<string, unknown>, b: Record<string, unknown>): number;
|
|
58
|
+
#private;
|
|
59
|
+
}
|
|
60
|
+
import { ProxyTree } from './proxy-tree.svelte.js';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export class ProxyTree {
|
|
2
|
+
constructor(items?: any[], fields?: {}, options?: {});
|
|
3
|
+
flatView: any[];
|
|
4
|
+
/** @returns {ProxyItem[]} Root proxy array */
|
|
5
|
+
get roots(): ProxyItem[];
|
|
6
|
+
/** @returns {Map<string, ProxyItem>} Lookup map of all proxies by key */
|
|
7
|
+
get lookup(): Map<string, ProxyItem>;
|
|
8
|
+
/**
|
|
9
|
+
* Append new root items. Creates proxies with keys continuing from
|
|
10
|
+
* the current length. Reassigns #rootProxies to trigger $derived.
|
|
11
|
+
*
|
|
12
|
+
* @param {unknown[]} items Raw items to append as roots
|
|
13
|
+
*/
|
|
14
|
+
append(items: unknown[]): void;
|
|
15
|
+
/**
|
|
16
|
+
* Replace all root items. Reassigns #rootProxies to trigger $derived.
|
|
17
|
+
* Keys are regenerated from the new item positions — focusedKey
|
|
18
|
+
* continuity across replace is the caller's concern.
|
|
19
|
+
*
|
|
20
|
+
* @param {unknown[]} items Raw items to use as new roots
|
|
21
|
+
*/
|
|
22
|
+
replace(items: unknown[]): void;
|
|
23
|
+
/**
|
|
24
|
+
* Add children to an existing proxy node.
|
|
25
|
+
* Uses proxy.set('children', rawItems) so ProxyItem's version counter
|
|
26
|
+
* triggers #buildChildren() recomputation. The flatView and lookup
|
|
27
|
+
* derive from proxy.children reactively.
|
|
28
|
+
*
|
|
29
|
+
* @param {ProxyItem} proxy The proxy to add children to
|
|
30
|
+
* @param {unknown[]} items Raw child items
|
|
31
|
+
*/
|
|
32
|
+
addChildren(proxy: ProxyItem, items: unknown[]): void;
|
|
33
|
+
#private;
|
|
34
|
+
}
|
|
35
|
+
import { ProxyItem } from './proxy-item.svelte.js';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export const vibe: Vibe;
|
|
2
|
+
export type ThemeMode = "light" | "dark";
|
|
3
|
+
export type Density = "cozy" | "compact" | "comfortable";
|
|
4
|
+
export type Direction = "ltr" | "rtl";
|
|
5
|
+
/**
|
|
6
|
+
* Vibe - Theme management
|
|
7
|
+
*/
|
|
8
|
+
declare class Vibe {
|
|
9
|
+
/**
|
|
10
|
+
* Private constructor to enforce singleton pattern
|
|
11
|
+
* @param {VibeOptions} [options={}]
|
|
12
|
+
*/
|
|
13
|
+
constructor(options?: VibeOptions);
|
|
14
|
+
set mode(value: string);
|
|
15
|
+
get mode(): string;
|
|
16
|
+
set style(value: string);
|
|
17
|
+
get style(): string;
|
|
18
|
+
set density(value: string);
|
|
19
|
+
get density(): string;
|
|
20
|
+
set colorMap(value: typeof DEFAULT_THEME_MAPPING);
|
|
21
|
+
get colorMap(): typeof DEFAULT_THEME_MAPPING;
|
|
22
|
+
set colors(value: any);
|
|
23
|
+
get colors(): any;
|
|
24
|
+
set allowedStyles(input: string[]);
|
|
25
|
+
get allowedStyles(): string[];
|
|
26
|
+
set allowedSkins(input: string[]);
|
|
27
|
+
get allowedSkins(): string[];
|
|
28
|
+
set skin(value: string);
|
|
29
|
+
get skin(): string;
|
|
30
|
+
set direction(value: "ltr" | "rtl");
|
|
31
|
+
get direction(): "ltr" | "rtl";
|
|
32
|
+
/** @returns {boolean} */
|
|
33
|
+
get isRTL(): boolean;
|
|
34
|
+
get palette(): {};
|
|
35
|
+
/**
|
|
36
|
+
* Load theme from storage
|
|
37
|
+
* @param {string} key
|
|
38
|
+
*/
|
|
39
|
+
load(key: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* Save current theme to storage
|
|
42
|
+
* @param {string} key
|
|
43
|
+
*/
|
|
44
|
+
save(key: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* Update theme with new values
|
|
47
|
+
* @param {Partial<Theme>} value
|
|
48
|
+
*/
|
|
49
|
+
update(value: Partial<Theme>): void;
|
|
50
|
+
/**
|
|
51
|
+
* Re-detect direction from document
|
|
52
|
+
* Useful when lang attribute changes dynamically
|
|
53
|
+
*/
|
|
54
|
+
detectDirection(): void;
|
|
55
|
+
#private;
|
|
56
|
+
}
|
|
57
|
+
import { DEFAULT_THEME_MAPPING } from '@rokkit/core';
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export class Wrapper {
|
|
2
|
+
/**
|
|
3
|
+
* @param {import('./proxy-tree.svelte.js').ProxyTree} proxyTree
|
|
4
|
+
* @param {{ onselect?: Function, onchange?: Function, collapsible?: boolean, multiselect?: boolean }} [options]
|
|
5
|
+
*/
|
|
6
|
+
constructor(proxyTree: import("./proxy-tree.svelte.js").ProxyTree, options?: {
|
|
7
|
+
onselect?: Function;
|
|
8
|
+
onchange?: Function;
|
|
9
|
+
collapsible?: boolean;
|
|
10
|
+
multiselect?: boolean;
|
|
11
|
+
});
|
|
12
|
+
flatView: any[];
|
|
13
|
+
get focusedKey(): null;
|
|
14
|
+
/** Move focus to the next navigable item; clamp at end. */
|
|
15
|
+
next(_path: any): void;
|
|
16
|
+
/** Move focus to the previous navigable item; clamp at start. */
|
|
17
|
+
prev(_path: any): void;
|
|
18
|
+
/** Move focus to the first navigable item. */
|
|
19
|
+
first(_path: any): void;
|
|
20
|
+
/** Move focus to the last navigable item. */
|
|
21
|
+
last(_path: any): void;
|
|
22
|
+
/**
|
|
23
|
+
* Expand focused group, or move focus into it if already open.
|
|
24
|
+
* No-op on leaf items. When collapsible=false groups are always open,
|
|
25
|
+
* so this only ever moves focus into the first child.
|
|
26
|
+
*/
|
|
27
|
+
expand(_path: any): void;
|
|
28
|
+
/**
|
|
29
|
+
* Collapse focused group, or move focus to parent if already collapsed / leaf.
|
|
30
|
+
* At root level with no parent: no-op.
|
|
31
|
+
* When collapsible=false, skips closing the group but still moves focus to parent.
|
|
32
|
+
*/
|
|
33
|
+
collapse(_path: any): void;
|
|
34
|
+
select(path: any): void;
|
|
35
|
+
/**
|
|
36
|
+
* Toggle expansion of group at path — called by Navigator for accordion-trigger clicks.
|
|
37
|
+
* Unlike select(), this only applies to groups and never fires onselect.
|
|
38
|
+
* No-op when collapsible=false.
|
|
39
|
+
*/
|
|
40
|
+
toggle(path: any): void;
|
|
41
|
+
/**
|
|
42
|
+
* Sync focused state to path — called by Navigator on focusin and typeahead match.
|
|
43
|
+
*/
|
|
44
|
+
moveTo(path: any): void;
|
|
45
|
+
/**
|
|
46
|
+
* Sync focused key to the item matching this semantic value.
|
|
47
|
+
* Used by controlled components (Toggle, Select) to keep navigation
|
|
48
|
+
* in sync when the bound value changes externally.
|
|
49
|
+
*
|
|
50
|
+
* @param {unknown} v
|
|
51
|
+
*/
|
|
52
|
+
moveToValue(v: unknown): void;
|
|
53
|
+
/** Persistent list: no dropdown to close. Override in dropdown wrappers. */
|
|
54
|
+
cancel(_path: any): void;
|
|
55
|
+
/** Persistent list: no-op. Override in dropdown wrappers to close + restore trigger focus. */
|
|
56
|
+
blur(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Multi-select toggle — Ctrl/Cmd-click or Ctrl/Cmd-Space.
|
|
59
|
+
* When `multiselect: false` (default) this is a no-op so single-select
|
|
60
|
+
* consumers see the same behavior as before.
|
|
61
|
+
*
|
|
62
|
+
* Toggles `path` in `selectedKeys`, sets anchor for subsequent range select,
|
|
63
|
+
* and fires `onselect` for leaf targets. Group targets update focus + anchor
|
|
64
|
+
* but do not toggle into selectedKeys (groups aren't selectable values).
|
|
65
|
+
*
|
|
66
|
+
* @param {string|null} path
|
|
67
|
+
*/
|
|
68
|
+
extend(path: string | null): void;
|
|
69
|
+
/**
|
|
70
|
+
* Multi-select range — Shift-click or Shift-Space.
|
|
71
|
+
* Selects every navigable item from the anchor (last single-click target,
|
|
72
|
+
* or the focused item if no anchor) to `path`, inclusive. Replaces any
|
|
73
|
+
* existing selection.
|
|
74
|
+
*
|
|
75
|
+
* When `multiselect: false` (default) this is a no-op.
|
|
76
|
+
*
|
|
77
|
+
* @param {string|null} path
|
|
78
|
+
*/
|
|
79
|
+
range(path: string | null): void;
|
|
80
|
+
/**
|
|
81
|
+
* Return the key of the first navigable item whose text starts with query
|
|
82
|
+
* (case-insensitive). Wraps around. startAfterKey enables cycling.
|
|
83
|
+
* Returns null if no match.
|
|
84
|
+
*
|
|
85
|
+
* @param {string} query
|
|
86
|
+
* @param {string|null} [startAfterKey]
|
|
87
|
+
* @returns {string|null}
|
|
88
|
+
*/
|
|
89
|
+
findByText(query: string, startAfterKey?: string | null): string | null;
|
|
90
|
+
/** @returns {Map<string, import('./proxy-item.svelte.js').ProxyItem>} */
|
|
91
|
+
get lookup(): Map<string, import("./proxy-item.svelte.js").ProxyItem>;
|
|
92
|
+
/** @returns {import('./proxy-tree.svelte.js').ProxyTree} */
|
|
93
|
+
get proxyTree(): import("./proxy-tree.svelte.js").ProxyTree;
|
|
94
|
+
/**
|
|
95
|
+
* Reactive set of selected keys. Tracks meaningfully only when
|
|
96
|
+
* `multiselect: true` — in single-select mode it mirrors the most
|
|
97
|
+
* recent `select()` target (one key at a time).
|
|
98
|
+
*
|
|
99
|
+
* @returns {SvelteSet<string>}
|
|
100
|
+
*/
|
|
101
|
+
get selectedKeys(): SvelteSet<string>;
|
|
102
|
+
/**
|
|
103
|
+
* In multi-select mode: array of selected leaf values (in selectedKeys order).
|
|
104
|
+
* In single-select mode: the last selected value (back-compat with `select()`).
|
|
105
|
+
*
|
|
106
|
+
* @returns {unknown[] | unknown}
|
|
107
|
+
*/
|
|
108
|
+
get selected(): unknown[] | unknown;
|
|
109
|
+
#private;
|
|
110
|
+
}
|
|
111
|
+
import { SvelteSet } from 'svelte/reactivity';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rokkit/states",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.18",
|
|
4
4
|
"description": "Contains generic data manipulation functions that can be used in various components.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
"files": [
|
|
25
25
|
"src/**/*.js",
|
|
26
26
|
"src/**/*.svelte",
|
|
27
|
+
"dist/**/*.d.ts",
|
|
27
28
|
"README.md",
|
|
29
|
+
"package.json",
|
|
28
30
|
"LICENSE"
|
|
29
31
|
],
|
|
30
32
|
"exports": {
|
|
@@ -37,8 +39,8 @@
|
|
|
37
39
|
}
|
|
38
40
|
},
|
|
39
41
|
"dependencies": {
|
|
40
|
-
"@rokkit/core": "1.1.
|
|
41
|
-
"@rokkit/data": "1.1.
|
|
42
|
+
"@rokkit/core": "1.1.18",
|
|
43
|
+
"@rokkit/data": "1.1.18",
|
|
42
44
|
"d3-array": "^3.2.4",
|
|
43
45
|
"ramda": "^0.32.0",
|
|
44
46
|
"svelte": "^5.53.5"
|