@rokkit/core 1.0.0-next.100 → 1.0.0-next.102

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Jerry Thomas
3
+ Copyright (c) 2025 Jerry Thomas
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,333 @@
1
+ export const shades: number[];
2
+ export const defaultPalette: string[];
3
+ export const syntaxColors: {
4
+ "one-dark": {
5
+ dark: {
6
+ "--tab-size": string;
7
+ "--code-fill": string;
8
+ "--code-normal": string;
9
+ "--code-string": string;
10
+ "--code-number": string;
11
+ "--code-atrule": string;
12
+ "--code-keyword": string;
13
+ "--code-comment": string;
14
+ "--code-property": string;
15
+ "--code-selector": string;
16
+ "--code-operator": string;
17
+ "--code-function": string;
18
+ "--code-gutter-marker": string;
19
+ "--code-gutter-subtle": string;
20
+ "--code-cursor": string;
21
+ "--code-cursor-block": string;
22
+ "--code-linenumbers": string;
23
+ };
24
+ light: {
25
+ "--tab-size": string;
26
+ "--code-fill": string;
27
+ "--code-normal": string;
28
+ "--code-string": string;
29
+ "--code-number": string;
30
+ "--code-atrule": string;
31
+ "--code-keyword": string;
32
+ "--code-comment": string;
33
+ "--code-property": string;
34
+ "--code-selector": string;
35
+ "--code-operator": string;
36
+ "--code-function": string;
37
+ "--code-gutter-marker": string;
38
+ "--code-gutter-subtle": string;
39
+ "--code-cursor": string;
40
+ "--code-cursor-block": string;
41
+ "--code-linenumbers": string;
42
+ };
43
+ };
44
+ };
45
+ export const defaultColors: {
46
+ amber: {
47
+ "50": string;
48
+ "100": string;
49
+ "200": string;
50
+ "300": string;
51
+ "400": string;
52
+ "500": string;
53
+ "600": string;
54
+ "700": string;
55
+ "800": string;
56
+ "900": string;
57
+ "950": string;
58
+ };
59
+ blue: {
60
+ "50": string;
61
+ "100": string;
62
+ "200": string;
63
+ "300": string;
64
+ "400": string;
65
+ "500": string;
66
+ "600": string;
67
+ "700": string;
68
+ "800": string;
69
+ "900": string;
70
+ "950": string;
71
+ };
72
+ cyan: {
73
+ "50": string;
74
+ "100": string;
75
+ "200": string;
76
+ "300": string;
77
+ "400": string;
78
+ "500": string;
79
+ "600": string;
80
+ "700": string;
81
+ "800": string;
82
+ "900": string;
83
+ "950": string;
84
+ };
85
+ emerald: {
86
+ "50": string;
87
+ "100": string;
88
+ "200": string;
89
+ "300": string;
90
+ "400": string;
91
+ "500": string;
92
+ "600": string;
93
+ "700": string;
94
+ "800": string;
95
+ "900": string;
96
+ "950": string;
97
+ };
98
+ fuscia: {
99
+ "50": string;
100
+ "100": string;
101
+ "200": string;
102
+ "300": string;
103
+ "400": string;
104
+ "500": string;
105
+ "600": string;
106
+ "700": string;
107
+ "800": string;
108
+ "900": string;
109
+ "950": string;
110
+ };
111
+ gray: {
112
+ "50": string;
113
+ "100": string;
114
+ "200": string;
115
+ "300": string;
116
+ "400": string;
117
+ "500": string;
118
+ "600": string;
119
+ "700": string;
120
+ "800": string;
121
+ "900": string;
122
+ "950": string;
123
+ };
124
+ green: {
125
+ "50": string;
126
+ "100": string;
127
+ "200": string;
128
+ "300": string;
129
+ "400": string;
130
+ "500": string;
131
+ "600": string;
132
+ "700": string;
133
+ "800": string;
134
+ "900": string;
135
+ "950": string;
136
+ };
137
+ indigo: {
138
+ "50": string;
139
+ "100": string;
140
+ "200": string;
141
+ "300": string;
142
+ "400": string;
143
+ "500": string;
144
+ "600": string;
145
+ "700": string;
146
+ "800": string;
147
+ "900": string;
148
+ "950": string;
149
+ };
150
+ lime: {
151
+ "50": string;
152
+ "100": string;
153
+ "200": string;
154
+ "300": string;
155
+ "400": string;
156
+ "500": string;
157
+ "600": string;
158
+ "700": string;
159
+ "800": string;
160
+ "900": string;
161
+ "950": string;
162
+ };
163
+ orange: {
164
+ "50": string;
165
+ "100": string;
166
+ "200": string;
167
+ "300": string;
168
+ "400": string;
169
+ "500": string;
170
+ "600": string;
171
+ "700": string;
172
+ "800": string;
173
+ "900": string;
174
+ "950": string;
175
+ };
176
+ pink: {
177
+ "50": string;
178
+ "100": string;
179
+ "200": string;
180
+ "300": string;
181
+ "400": string;
182
+ "500": string;
183
+ "600": string;
184
+ "700": string;
185
+ "800": string;
186
+ "900": string;
187
+ "950": string;
188
+ };
189
+ purple: {
190
+ "50": string;
191
+ "100": string;
192
+ "200": string;
193
+ "300": string;
194
+ "400": string;
195
+ "500": string;
196
+ "600": string;
197
+ "700": string;
198
+ "800": string;
199
+ "900": string;
200
+ "950": string;
201
+ };
202
+ red: {
203
+ "50": string;
204
+ "100": string;
205
+ "200": string;
206
+ "300": string;
207
+ "400": string;
208
+ "500": string;
209
+ "600": string;
210
+ "700": string;
211
+ "800": string;
212
+ "900": string;
213
+ "950": string;
214
+ };
215
+ rose: {
216
+ "50": string;
217
+ "100": string;
218
+ "200": string;
219
+ "300": string;
220
+ "400": string;
221
+ "500": string;
222
+ "600": string;
223
+ "700": string;
224
+ "800": string;
225
+ "900": string;
226
+ "950": string;
227
+ };
228
+ sky: {
229
+ "50": string;
230
+ "100": string;
231
+ "200": string;
232
+ "300": string;
233
+ "400": string;
234
+ "500": string;
235
+ "600": string;
236
+ "700": string;
237
+ "800": string;
238
+ "900": string;
239
+ "950": string;
240
+ };
241
+ slate: {
242
+ "50": string;
243
+ "100": string;
244
+ "200": string;
245
+ "300": string;
246
+ "400": string;
247
+ "500": string;
248
+ "600": string;
249
+ "700": string;
250
+ "800": string;
251
+ "900": string;
252
+ "950": string;
253
+ };
254
+ stone: {
255
+ "50": string;
256
+ "100": string;
257
+ "200": string;
258
+ "300": string;
259
+ "400": string;
260
+ "500": string;
261
+ "600": string;
262
+ "700": string;
263
+ "800": string;
264
+ "900": string;
265
+ "950": string;
266
+ };
267
+ teal: {
268
+ "50": string;
269
+ "100": string;
270
+ "200": string;
271
+ "300": string;
272
+ "400": string;
273
+ "500": string;
274
+ "600": string;
275
+ "700": string;
276
+ "800": string;
277
+ "900": string;
278
+ "950": string;
279
+ };
280
+ violet: {
281
+ "50": string;
282
+ "100": string;
283
+ "200": string;
284
+ "300": string;
285
+ "400": string;
286
+ "500": string;
287
+ "600": string;
288
+ "700": string;
289
+ "800": string;
290
+ "900": string;
291
+ "950": string;
292
+ };
293
+ yellow: {
294
+ "50": string;
295
+ "100": string;
296
+ "200": string;
297
+ "300": string;
298
+ "400": string;
299
+ "500": string;
300
+ "600": string;
301
+ "700": string;
302
+ "800": string;
303
+ "900": string;
304
+ "950": string;
305
+ };
306
+ zinc: {
307
+ "50": string;
308
+ "100": string;
309
+ "200": string;
310
+ "300": string;
311
+ "400": string;
312
+ "500": string;
313
+ "600": string;
314
+ "700": string;
315
+ "800": string;
316
+ "900": string;
317
+ "950": string;
318
+ };
319
+ shark: {
320
+ DEFAULT: string;
321
+ "50": string;
322
+ "100": string;
323
+ "200": string;
324
+ "300": string;
325
+ "400": string;
326
+ "500": string;
327
+ "600": string;
328
+ "700": string;
329
+ "800": string;
330
+ "900": string;
331
+ "950": string;
332
+ };
333
+ };
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Generate a state icon mapping from a list of icon names
3
+ *
4
+ * @param {string[]} icons
5
+ * @returns {import('./types').StateIcons}
6
+ */
7
+ export function stateIconsFromNames(icons: string[]): import("./types").StateIcons;
8
+ /**
9
+ * @type {import('./types).FieldMapping} Fields
10
+ */
11
+ export const defaultFields: any;
12
+ export const defaultIcons: string[];
13
+ export namespace defaultOptions {
14
+ let id: string;
15
+ let label: string;
16
+ let value: string;
17
+ let checked: string;
18
+ }
19
+ export namespace defaultKeyMap {
20
+ let ArrowRight: string;
21
+ let ArrowLeft: string;
22
+ let ArrowDown: string;
23
+ let ArrowUp: string;
24
+ let Enter: string;
25
+ let Escape: string;
26
+ }
27
+ export namespace defaultThemeMapping {
28
+ let neutral: string;
29
+ let primary: string;
30
+ let secondary: string;
31
+ let accent: string;
32
+ let success: string;
33
+ let warning: string;
34
+ let danger: string;
35
+ let error: string;
36
+ let info: string;
37
+ }
38
+ export const defaultStateIcons: any;
39
+ export { defaultColors, syntaxColors, shades, defaultPalette } from "./colors/index.js";
@@ -0,0 +1,20 @@
1
+ export class FieldMapper {
2
+ constructor(fields?: any, using?: {});
3
+ _fields: {};
4
+ _using: {};
5
+ set fields(fields: {});
6
+ get fields(): {};
7
+ set using(using: {});
8
+ get using(): {};
9
+ getComponent(value: any): import("svelte").SvelteComponent<Record<string, any>, any, any>;
10
+ getIcon(value: any): string;
11
+ getValue(node: any): any;
12
+ getText(node: any): string;
13
+ getAttribute(node: any, attr: any): any;
14
+ getFormattedText(node: any, formatter: any): Function;
15
+ hasChildren(item: any): boolean;
16
+ isExpanded(item: any): boolean;
17
+ isNested(items: any): boolean;
18
+ hasImage(item: any): any;
19
+ hasIcon(item: any): any;
20
+ }
@@ -0,0 +1,6 @@
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 { FieldMapper } from "./field-mapper.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,68 @@
1
+ /**
2
+ * Get the component to be used to render the item.
3
+ * If the component is null or undefined, it will return the default component.
4
+ *
5
+ * @param {object|string} value
6
+ * @param {import('./types.js').FieldMapping} fields
7
+ * @param {import('./types.js').ComponentMap} using
8
+ */
9
+ export function getComponent(value: object | string, fields: import("./types.js").FieldMapping, using: import("./types.js").ComponentMap): import("svelte").SvelteComponent<Record<string, any>, any, any>;
10
+ /**
11
+ * Get the icon for the item. If the icon is an object, it will use the state to determine which icon to use.
12
+ *
13
+ * @param {object|string} value
14
+ * @param {import('./types.js').FieldMapping} fields
15
+ * @returns {string}
16
+ */
17
+ export function getIcon(value: object | string, fields?: import("./types.js").FieldMapping): string;
18
+ /**
19
+ * Get the value for the item. If the value is an object,
20
+ * it will use the field mapping to determine which attribute to get.
21
+ *
22
+ * @param {*} node
23
+ * @param {import('./types').FieldMapping} fields
24
+ * @returns {*}
25
+ */
26
+ export function getValue(node: any, fields?: import("./types").FieldMapping): any;
27
+ /**
28
+ * Get the text for the item. If the text is an object,
29
+ * it will use the field mapping to determine which attribute to get.
30
+ *
31
+ * @param {*} node
32
+ * @param {import('./types').FieldMapping} fields
33
+ * @returns {string}
34
+ */
35
+ export function getText(node: any, fields?: import("./types").FieldMapping): string;
36
+ /**
37
+ * Gets the attribute from the node
38
+ * @param {*} node
39
+ * @param {string} attr
40
+ * @returns {*}
41
+ */
42
+ export function getAttribute(node: any, attr: string): any;
43
+ /**
44
+ * Get the formatted text for the item. If the text is an object, use the field mapping to determine
45
+ * which attribute to get currency. Use the formatter or identity function to format the text.
46
+ *
47
+ * @param {*} node
48
+ * @param {import('./types').FieldMapping} fields
49
+ * @param {Function} formatter
50
+ * @returns {Function}
51
+ */
52
+ export function getFormattedText(node: any, fields?: import("./types").FieldMapping, formatter?: Function): Function;
53
+ /**
54
+ * Check if the current item is a parent
55
+ *
56
+ * @param {*} item
57
+ * @param {import('./types').FieldMapping} fields
58
+ * @returns {boolean}
59
+ */
60
+ export function hasChildren(item: any, fields: import("./types").FieldMapping): boolean;
61
+ /**
62
+ * Check if the current item is a parent and is expanded
63
+ *
64
+ * @param {*} item
65
+ * @param {import('./types').FieldMapping} fields
66
+ * @returns {boolean}
67
+ */
68
+ export function isExpanded(item: any, fields: import("./types").FieldMapping): boolean;
@@ -0,0 +1,18 @@
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[];
10
+ /**
11
+ * Matches a path slug to a value in the menu
12
+ *
13
+ * @param {string} slug
14
+ * @param {Array} data
15
+ * @param {import('./types').FieldMapping} fields
16
+ * @returns {any}
17
+ */
18
+ export function findValueFromPath(slug: string, data: any[], fields: import("./types").FieldMapping): 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): 0 | 1 | -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;