@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.
Files changed (93) hide show
  1. package/dist/calendar.d.ts +10 -0
  2. package/dist/colors/index.d.ts +47 -0
  3. package/dist/connector.d.ts +8 -0
  4. package/dist/constants.d.ts +88 -0
  5. package/dist/events.d.ts +12 -0
  6. package/dist/field-mapper.d.ts +60 -0
  7. package/dist/index.d.ts +13 -0
  8. package/dist/key-event-map.d.ts +18 -0
  9. package/dist/mapped-items.d.ts +14 -0
  10. package/dist/mapping.d.ts +14 -0
  11. package/dist/nested.d.ts +9 -0
  12. package/dist/string.d.ts +59 -0
  13. package/dist/theme.d.ts +96 -0
  14. package/dist/ticks.d.ts +10 -0
  15. package/dist/types.d.ts +300 -0
  16. package/dist/utils.d.ts +107 -0
  17. package/dist/vite/icon-collections.d.ts +32 -0
  18. package/dist/vite/index.d.ts +1 -0
  19. package/package.json +25 -39
  20. package/src/calendar.js +44 -0
  21. package/src/colors/extra.json +16 -0
  22. package/src/colors/index.ts +24 -0
  23. package/src/colors/syntax.json +42 -0
  24. package/src/colors/tailwind.json +275 -0
  25. package/src/connector.js +34 -0
  26. package/src/constants.js +181 -107
  27. package/src/events.js +32 -0
  28. package/src/field-mapper.js +147 -0
  29. package/src/index.js +19 -27
  30. package/src/key-event-map.js +36 -0
  31. package/src/mapped-items.js +22 -0
  32. package/src/mapping.js +21 -0
  33. package/src/nested.js +28 -0
  34. package/src/string.js +97 -0
  35. package/src/theme.ts +192 -0
  36. package/src/ticks.js +26 -0
  37. package/src/types.js +160 -0
  38. package/src/utils.js +250 -0
  39. package/src/vite/icon-collections.js +73 -0
  40. package/src/vite/index.js +1 -0
  41. package/LICENSE +0 -21
  42. package/README.md +0 -1
  43. package/src/Accordion.svelte +0 -80
  44. package/src/Alerts.svelte +0 -39
  45. package/src/DropDown.svelte +0 -82
  46. package/src/DropSearch.svelte +0 -67
  47. package/src/EditableTabs.svelte +0 -31
  48. package/src/Icon.svelte +0 -15
  49. package/src/List-Discard.svelte +0 -48
  50. package/src/List.svelte +0 -65
  51. package/src/ListActions.svelte +0 -35
  52. package/src/NavTabs.svelte +0 -0
  53. package/src/NestedList.svelte +0 -77
  54. package/src/Overlay.svelte +0 -4
  55. package/src/PageNavigator.svelte +0 -94
  56. package/src/ResponsiveGrid.svelte +0 -73
  57. package/src/Scrollable.svelte +0 -8
  58. package/src/Searchable.svelte +0 -19
  59. package/src/Sidebar.svelte +0 -5
  60. package/src/Slider.svelte +0 -17
  61. package/src/SpinList.svelte +0 -48
  62. package/src/SplitPane.svelte +0 -109
  63. package/src/SplitView.svelte +0 -44
  64. package/src/Splitter.svelte +0 -95
  65. package/src/TabItem.svelte +0 -27
  66. package/src/TabItems.svelte +0 -34
  67. package/src/Tabs.svelte +0 -49
  68. package/src/Tree.svelte +0 -45
  69. package/src/actions/dismissable.js +0 -24
  70. package/src/actions/fillable.js +0 -114
  71. package/src/actions/hierarchy.js +0 -189
  72. package/src/actions/index.js +0 -7
  73. package/src/actions/navigable.js +0 -43
  74. package/src/actions/navigator.js +0 -179
  75. package/src/actions/pannable.js +0 -50
  76. package/src/actions/swipeable.js +0 -56
  77. package/src/actions/themeable.js +0 -23
  78. package/src/items/Collapsible.svelte +0 -51
  79. package/src/items/Connector.svelte +0 -26
  80. package/src/items/Link.svelte +0 -18
  81. package/src/items/Node.svelte +0 -52
  82. package/src/items/Pill.svelte +0 -19
  83. package/src/items/Separator.svelte +0 -1
  84. package/src/items/Summary.svelte +0 -27
  85. package/src/items/Text.svelte +0 -21
  86. package/src/items/index.js +0 -8
  87. package/src/list.js +0 -14
  88. package/src/mocks/Custom.svelte +0 -7
  89. package/src/mocks/index.js +0 -10
  90. package/src/stores/alerts.js +0 -3
  91. package/src/stores/index.js +0 -6
  92. package/src/stores/persist.js +0 -63
  93. package/src/stores/theme.js +0 -34
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Get the days in the month.
3
+ *
4
+ * @param {Date} value
5
+ * @param {Array} holidays
6
+ * @param {boolean} fixed
7
+ * @returns {import('./types').CalendarDay[]}
8
+ */
9
+ export function getCalendarDays(value: Date, holidays?: any[], fixed?: boolean): import("./types").CalendarDay[];
10
+ export const weekdays: string[];
@@ -0,0 +1,47 @@
1
+ import type { PresetMiniColors } from '@unocss/preset-mini/colors';
2
+ import extraColors from './extra.json';
3
+ export declare const shades: number[];
4
+ export declare const defaultPalette: string[];
5
+ export declare const syntaxColors: {
6
+ "one-dark": {
7
+ dark: {
8
+ "--tab-size": string;
9
+ "--code-fill": string;
10
+ "--code-normal": string;
11
+ "--code-string": string;
12
+ "--code-number": string;
13
+ "--code-atrule": string;
14
+ "--code-keyword": string;
15
+ "--code-comment": string;
16
+ "--code-property": string;
17
+ "--code-selector": string;
18
+ "--code-operator": string;
19
+ "--code-function": string;
20
+ "--code-gutter-marker": string;
21
+ "--code-gutter-z2": string;
22
+ "--code-cursor": string;
23
+ "--code-cursor-block": string;
24
+ "--code-linenumbers": string;
25
+ };
26
+ light: {
27
+ "--tab-size": string;
28
+ "--code-fill": string;
29
+ "--code-normal": string;
30
+ "--code-string": string;
31
+ "--code-number": string;
32
+ "--code-atrule": string;
33
+ "--code-keyword": string;
34
+ "--code-comment": string;
35
+ "--code-property": string;
36
+ "--code-selector": string;
37
+ "--code-operator": string;
38
+ "--code-function": string;
39
+ "--code-gutter-marker": string;
40
+ "--code-gutter-z2": string;
41
+ "--code-cursor": string;
42
+ "--code-cursor-block": string;
43
+ "--code-linenumbers": string;
44
+ };
45
+ };
46
+ };
47
+ export declare const defaultColors: PresetMiniColors & typeof extraColors;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Constructs an array of line types for tree visualization
3
+ * @param {boolean} hasChildren - Whether the node has children
4
+ * @param {import('./types').LineType[]} parentTypes - Types from parent nodes
5
+ * @param {import('./types').LineType} position - Current position type
6
+ * @returns {import('./types').LineType[]} Array of line types
7
+ */
8
+ export function getLineTypes(hasChildren?: boolean, parentTypes?: import("./types").LineType[], position?: import("./types").LineType): import("./types").LineType[];
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Remap legacy field-override keys to their BASE_FIELDS semantic equivalents.
3
+ * e.g. { text: 'name' } → { label: 'name' }
4
+ *
5
+ * @param {Record<string, string> | null | undefined} fields
6
+ * @returns {Record<string, string>}
7
+ */
8
+ export function normalizeFields(fields: Record<string, string> | null | undefined): Record<string, string>;
9
+ /**
10
+ * Generate a state icon mapping from a list of icon names
11
+ *
12
+ * @param {string[]} icons
13
+ * @returns {import('./types').StateIcons}
14
+ */
15
+ export function stateIconsFromNames(icons: string[]): import("./types").StateIcons;
16
+ export const DATA_IMAGE_REGEX: RegExp;
17
+ export const ITEM_SNIPPET: "itemContent";
18
+ export const GROUP_SNIPPET: "groupContent";
19
+ /**
20
+ * @deprecated Use BASE_FIELDS from @rokkit/core instead.
21
+ * Retained for legacy ListController/FieldMapper/Proxy consumers (Toolbar, Table).
22
+ * Will be removed when those components migrate to Wrapper+Navigator.
23
+ * @type {import('./types).FieldMapping} Fields
24
+ */
25
+ export const DEFAULT_FIELDS: any;
26
+ export namespace BASE_FIELDS {
27
+ let id: string;
28
+ let value: string;
29
+ let label: string;
30
+ let icon: string;
31
+ let avatar: string;
32
+ let subtext: string;
33
+ let tooltip: string;
34
+ let badge: string;
35
+ let shortcut: string;
36
+ let children: string;
37
+ let type: string;
38
+ let snippet: string;
39
+ let href: string;
40
+ let hrefTarget: string;
41
+ let disabled: string;
42
+ let expanded: string;
43
+ let selected: string;
44
+ }
45
+ export const DEFAULT_ICONS: string[];
46
+ export namespace DEFAULT_OPTIONS {
47
+ let id_1: string;
48
+ export { id_1 as id };
49
+ let label_1: string;
50
+ export { label_1 as label };
51
+ let value_1: string;
52
+ export { value_1 as value };
53
+ export let checked: string;
54
+ }
55
+ export namespace DEFAULT_KEYMAP {
56
+ let ArrowRight: string;
57
+ let ArrowLeft: string;
58
+ let ArrowDown: string;
59
+ let ArrowUp: string;
60
+ let Enter: string;
61
+ let Escape: string;
62
+ }
63
+ export namespace DEFAULT_THEME_MAPPING {
64
+ let surface: string;
65
+ let primary: string;
66
+ let secondary: string;
67
+ let accent: string;
68
+ let success: string;
69
+ let warning: string;
70
+ let danger: string;
71
+ let error: string;
72
+ let info: string;
73
+ }
74
+ export namespace TONE_MAP {
75
+ let z0: number;
76
+ let z1: number;
77
+ let z2: number;
78
+ let z3: number;
79
+ let z4: number;
80
+ let z5: number;
81
+ let z6: number;
82
+ let z7: number;
83
+ let z8: number;
84
+ let z9: number;
85
+ let z10: number;
86
+ }
87
+ export const DEFAULT_STATE_ICONS: any;
88
+ export { defaultColors, syntaxColors, shades, defaultPalette } from "./colors/index";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Creates an emitter object from the given properties.
3
+ *
4
+ * - Filters attributes that start with 'on' and are functions,
5
+ * - Returns an object with keys that are the event names (without the 'on' prefix)
6
+ * - If a default event is not present in the props, it will be set to a no-op function.
7
+ *
8
+ * @param {Object} props - The properties object to filter.
9
+ * @param {Array<string>} defaults - An array of default events.
10
+ * @returns {import('./types.js').EventHandlers} The emitter object.
11
+ */
12
+ export function createEmitter(props: Object, defaults?: Array<string>): import("./types.js").EventHandlers;
@@ -0,0 +1,60 @@
1
+ export class FieldMapper {
2
+ constructor(fields?: any);
3
+ hasIcon: ((obj: unknown) => obj is {
4
+ [x: string]: unknown;
5
+ }) | undefined;
6
+ hasImage: ((obj: unknown) => obj is {
7
+ [x: string]: unknown;
8
+ }) | undefined;
9
+ hasValue: ((obj: unknown) => obj is {
10
+ [x: string]: unknown;
11
+ }) | undefined;
12
+ hasLabel: ((obj: unknown) => obj is {
13
+ [x: string]: unknown;
14
+ }) | undefined;
15
+ hasComponent: ((obj: unknown) => obj is {
16
+ [x: string]: unknown;
17
+ }) | undefined;
18
+ hasCurrency: ((obj: unknown) => obj is {
19
+ [x: string]: unknown;
20
+ }) | undefined;
21
+ withPrefix: ((x: any) => string) | undefined;
22
+ excludeFlags: (<U extends Partial<Record<any, any>>>(obj: any extends keyof U ? U : never) => any extends keyof U ? Omit<U, any> : never) | undefined;
23
+ getChildMapper(): null;
24
+ /**
25
+ * @private
26
+ */
27
+ private prop;
28
+ /**
29
+ * Gets a mapped attribute from the original item
30
+ *
31
+ * @param {string} fieldName - Name of the field to get
32
+ * @returns {any|null} - The attribute value or null if not found
33
+ */
34
+ get(fieldName: string, value: any, defaultValue?: null): any | null;
35
+ set fields(fields: any);
36
+ get fields(): any;
37
+ getIcon(value: any): string | null;
38
+ getValue(value: any): any;
39
+ getFormattedText(value: any, formatter: any): any;
40
+ hasChildren(item: any): item is never;
41
+ isNested(items: any): boolean;
42
+ getChildren(item: any): never[];
43
+ /**
44
+ * Finds children by an index path
45
+ *
46
+ * @param {Array<Object>} items
47
+ * @param {Array<number>} path
48
+ * @returns {Array<Object>}
49
+ */
50
+ getChildrenByPath(items: Array<Object>, path?: Array<number>): Array<Object>;
51
+ /**
52
+ * Finds an item by an index path
53
+ *
54
+ * @param {Array<Object>} items
55
+ * @param {Array<number>} path
56
+ * @returns {Object|null}
57
+ */
58
+ getItemByPath(items: Array<Object>, path?: Array<number>): Object | null;
59
+ #private;
60
+ }
@@ -0,0 +1,13 @@
1
+ export * from "./types.js";
2
+ export * from "./constants.js";
3
+ export * from "./utils.js";
4
+ export * from "./nested.js";
5
+ export * from "./string.js";
6
+ export * from "./theme.js";
7
+ export { FieldMapper } from "./field-mapper.js";
8
+ export { createEmitter } from "./events.js";
9
+ export { getLineTypes } from "./connector.js";
10
+ export { generateTicks } from "./ticks.js";
11
+ export { getNestedFields } from "./mapping.js";
12
+ export { getItemAtIndex, getIndexForItem } from "./mapped-items.js";
13
+ export { weekdays, getCalendarDays } from "./calendar.js";
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Class to manage key event mappings.
3
+ */
4
+ export class KeyEventMap {
5
+ mapping: {};
6
+ /**
7
+ * Add a new key mapping.
8
+ * @param {string} eventName - The event name.
9
+ * @param {Array<string>|RegExp} keys - The keys to match.
10
+ */
11
+ add(eventName: string, keys: Array<string> | RegExp): void;
12
+ /**
13
+ * Get the event name for a given key.
14
+ * @param {string} key - The key to match.
15
+ * @returns {string|null} - The event name or null if no match is found.
16
+ */
17
+ getEventForKey(key: string): string | null;
18
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Get an item at a specific index
3
+ * @param {Array<any>} items
4
+ * @param {any} index
5
+ * @returns
6
+ */
7
+ export function getItemAtIndex(items: Array<any>, index: any): any;
8
+ /**
9
+ * Get the index for an item in an array
10
+ * @param {Array<any} items
11
+ * @param {any} item
12
+ * @returns
13
+ */
14
+ export function getIndexForItem(items: Array<any>, item: any): number;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Gets the attribute from the node
3
+ * @param {*} node
4
+ * @param {string} attr
5
+ * @returns {*}
6
+ */
7
+ export function getAttribute(node: any, attr: string): any;
8
+ /**
9
+ * Fetches the fieldmapping for a child node
10
+ *
11
+ * @param {import('./types').FieldMapping} fields
12
+ * @returns {import('./types').FieldMapping}
13
+ */
14
+ export function getNestedFields(fields: import("./types").FieldMapping): import("./types").FieldMapping;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Flattens a nested list of items
3
+ *
4
+ * @param {Array} items
5
+ * @param {import('./types).FieldMapping} fields
6
+ * @param {number} level
7
+ * @returns {Array}
8
+ */
9
+ export function flattenNestedList(items: any[], fields?: any, level?: number): any[];
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Capitalizes the first letter of input string
3
+ *
4
+ * @param {String} str
5
+ * @returns {String}
6
+ */
7
+ export function toInitCapCase(text: any): string;
8
+ /**
9
+ * Convert a hyphen separated string to PascalCase
10
+ *
11
+ * @param {String} text
12
+ * @returns
13
+ */
14
+ export function toPascalCase(text: string): string;
15
+ /**
16
+ * Convert a PascalCase string to snake case with separator as hyphen
17
+ *
18
+ * @param {string} text
19
+ * @returns {string}
20
+ */
21
+ export function toHyphenCase(text: string): string;
22
+ /**
23
+ * Simple comparison for two strings
24
+ *
25
+ * @param {String} a
26
+ * @param {String} b
27
+ * @returns
28
+ */
29
+ export function compareStrings(a: string, b: string): 1 | 0 | -1;
30
+ /**
31
+ * Sort by splitting hyphen separated strings while keeping strings with same number of parts together
32
+ *
33
+ * @param {String} a hyphen separates string
34
+ * @param {String} b hyphen separates string
35
+ * @param {string} separator - separator to split the string
36
+ * @returns {Number} -1, 0, 1 based on comparison
37
+ */
38
+ export function sortByParts(a: string, b: string, separator?: string): number;
39
+ /**
40
+ * Generates a unique id from current timestamp
41
+ *
42
+ * @returns {String} timestamp based unique id
43
+ */
44
+ export function uniqueId(prefix?: string, separator?: string): string;
45
+ /**
46
+ * Removes undefined and null values from the input object.
47
+ *
48
+ * @param {Object} obj
49
+ * @returns {Object}
50
+ */
51
+ export function compact(obj: Object): Object;
52
+ /**
53
+ * Converts an input number into it's hexadecimal representation, with optional left padded zeroes based on the `size`
54
+ *
55
+ * @param {number} value
56
+ * @param {number} size
57
+ * @returns
58
+ */
59
+ export function toHexString(value: number, size?: number): string;
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Generate shades for a color using css varuable
3
+ *
4
+ * @param {string} name
5
+ * @param {string} modifier
6
+ * @returns
7
+ */
8
+ export declare function shadesOf(name: any, modifier?: string): {
9
+ DEFAULT: any;
10
+ };
11
+ /**
12
+ * Constructs and returns the light and dark theme variants based on provided color mapping and color definitions.
13
+ *
14
+ * @param {Object} [mapping=DEFAULT_THEME_MAPPING] - An object mapping variant names to color property names.
15
+ * @param {Object} [colors=defaultColors] - The object containing default color definitions.
16
+ * @returns {Array<Array>} An array containing two arrays, one for the light theme variant and another for the dark theme.
17
+ */
18
+ export declare function themeRules(mapping?: {
19
+ surface: string;
20
+ primary: string;
21
+ secondary: string;
22
+ accent: string;
23
+ success: string;
24
+ warning: string;
25
+ danger: string;
26
+ error: string;
27
+ info: string;
28
+ }, colors?: any): {};
29
+ /**
30
+ * Generates UnoCSS shortcut definitions for semantic tones with bg, border, text.
31
+ * @param {string} name - Color name (e.g., 'primary')
32
+ * @returns {Array} Array of shortcut definitions
33
+ */
34
+ export declare function semanticShortcuts(name: any): {}[][];
35
+ /**
36
+ * Generates "on-color" text shortcuts for readable text on colored backgrounds.
37
+ *
38
+ * - `text-on-{name}` → high contrast text for use on z5+ backgrounds (always light text)
39
+ * - `text-on-{name}-muted` → slightly muted but still readable on z5+ backgrounds
40
+ *
41
+ * @param {string} name - Color name (e.g., 'primary', 'surface')
42
+ * @returns {Array} Array of shortcut definitions
43
+ */
44
+ export declare function contrastShortcuts(name: any): string[][];
45
+ /**
46
+ * Theme class for managing color palettes, mappings, and semantic shortcuts.
47
+ */
48
+ export declare class Theme {
49
+ #private;
50
+ /**
51
+ *
52
+ * @param {import('./types.js').ColorTheme} param0
53
+ */
54
+ constructor({ colors, mapping }?: {
55
+ colors?: any;
56
+ mapping?: {
57
+ surface: string;
58
+ primary: string;
59
+ secondary: string;
60
+ accent: string;
61
+ success: string;
62
+ warning: string;
63
+ danger: string;
64
+ error: string;
65
+ info: string;
66
+ } | undefined;
67
+ });
68
+ get colors(): any;
69
+ set colors(colors: any);
70
+ get mapping(): {
71
+ surface: string;
72
+ primary: string;
73
+ secondary: string;
74
+ accent: string;
75
+ success: string;
76
+ warning: string;
77
+ danger: string;
78
+ error: string;
79
+ info: string;
80
+ };
81
+ set mapping(mapping: {
82
+ surface: string;
83
+ primary: string;
84
+ secondary: string;
85
+ accent: string;
86
+ success: string;
87
+ warning: string;
88
+ danger: string;
89
+ error: string;
90
+ info: string;
91
+ });
92
+ mapVariant(color: any, variant: any): {};
93
+ getColorRules(mapping?: null): {};
94
+ getPalette(mapping?: null): {};
95
+ getShortcuts(name: any): {}[][];
96
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Generates an array of tick marks for a range of values.
3
+ *
4
+ * @param {number} lowerBound - The lower bound of the range.
5
+ * @param {number} upperBound - The upper bound of the range.
6
+ * @param {number} [minorTickStep=upperBound-lowerBound] - The step size for minor ticks.
7
+ * @param {number} [majorTickStep=1] - The step size for major ticks.
8
+ * @returns {import('./types').TickMark[]>} An array of tick mark objects.
9
+ */
10
+ export function generateTicks(lowerBound: number, upperBound: number, minorTickStep?: number, majorTickStep?: number): import("./types").TickMark[];