@santi020k/lumen-core 0.1.0

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Santiago Molina
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # @santi020k/lumen-core
2
+
3
+ Shared metadata, token constants, and tiny utilities used by the Lumen package family.
4
+
5
+ Most consumers should install a framework package such as `@santi020k/lumen-astro`, `@santi020k/lumen-react`, or `@santi020k/lumen-elements`.
6
+
7
+ The package exports `lumenColors` and `lumenGlass` for consumers that need to mirror Lumen theme
8
+ tokens outside the shared stylesheet.
9
+
10
+ It also exports the Lucide-backed icon map (`lumenIcons`, `lumenIconNames`) and helpers such as
11
+ `renderLumenIconSvg` so framework adapters can render icons by name.
12
+
13
+ ## Icon Credits
14
+
15
+ Icons are provided by [Lucide](https://lucide.dev/) and its open-source contributors. Lucide is
16
+ licensed under the ISC License, with Feather-derived icons covered by the MIT License. See
17
+ [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) for the complete notices.
18
+
19
+ ## Theme Builder Helpers
20
+
21
+ Use the ThemeBuilder helpers when an adapter or app needs the same token generation and export
22
+ contract as the Astro runtime.
23
+
24
+ ```ts
25
+ import {
26
+ createThemeBuilderTokens,
27
+ exportThemeBuilderValue
28
+ } from '@santi020k/lumen-core'
29
+
30
+ const theme = createThemeBuilderTokens({
31
+ accentHue: 140,
32
+ hue: 260,
33
+ scheme: 'dark'
34
+ })
35
+
36
+ exportThemeBuilderValue(theme.tokens, theme.scheme, 'css')
37
+ ```
38
+
39
+ ## Figma and Design Tokens
40
+
41
+ Use the Figma helpers when a design workflow needs the same semantic colors as Lumen's CSS tokens.
42
+
43
+ ```ts
44
+ import {
45
+ createThemePalette,
46
+ exportThemeDesignTokens,
47
+ exportThemeFigmaVariables
48
+ } from '@santi020k/lumen-core'
49
+
50
+ const theme = createThemePalette('221 83% 53%', '168 76% 36%')
51
+
52
+ exportThemeFigmaVariables(theme, {
53
+ collectionName: 'Acme theme',
54
+ modeName: 'Light'
55
+ })
56
+
57
+ exportThemeDesignTokens(theme)
58
+ ```
59
+
60
+ `exportThemeFigmaVariables` returns Figma variable-friendly color values (`r`, `g`, `b`, `a`) and
61
+ hierarchical names such as `color/surface/muted`. `exportThemeDesignTokens` returns standard design
62
+ token JSON that importers can map into Figma variables or other design tools.
@@ -0,0 +1,66 @@
1
+ # Third-Party Notices
2
+
3
+ `@santi020k/lumen-core` uses the Lucide icon library. The following notices are reproduced from
4
+ Lucide's license.
5
+
6
+ ## Lucide Icons
7
+
8
+ ISC License
9
+
10
+ Copyright (c) 2026 Lucide Icons and Contributors
11
+
12
+ Permission to use, copy, modify, and/or distribute this software for any
13
+ purpose with or without fee is hereby granted, provided that the above
14
+ copyright notice and this permission notice appear in all copies.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
17
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
18
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19
+ SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
21
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
22
+ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23
+
24
+ ## Feather-Derived Icons
25
+
26
+ The following Lucide icons are derived from the Feather project:
27
+
28
+ airplay, alert-circle, alert-octagon, alert-triangle, aperture, arrow-down-circle,
29
+ arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left,
30
+ arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right,
31
+ arrow-up, at-sign, calendar, cast, check, chevron-down, chevron-left,
32
+ chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right,
33
+ chevrons-up, circle, clipboard, clock, code, columns, command, compass,
34
+ corner-down-left, corner-down-right, corner-left-down, corner-left-up,
35
+ corner-right-down, corner-right-up, corner-up-left, corner-up-right,
36
+ crosshair, database, divide-circle, divide-square, dollar-sign, download,
37
+ external-link, feather, frown, hash, headphones, help-circle, info, italic,
38
+ key, layout, life-buoy, link-2, link, loader, lock, log-in, log-out, maximize,
39
+ meh, minimize, minimize-2, minus-circle, minus-square, minus, monitor, moon,
40
+ more-horizontal, more-vertical, move, music, navigation-2, navigation,
41
+ octagon, pause-circle, percent, plus-circle, plus-square, plus, power, radio,
42
+ rss, search, server, share, shopping-bag, sidebar, smartphone, smile, square,
43
+ table-2, tablet, target, terminal, trash-2, trash, triangle, tv, type, upload,
44
+ x-circle, x-octagon, x-square, x, zoom-in, zoom-out
45
+
46
+ The MIT License (MIT) (for the icons listed above)
47
+
48
+ Copyright (c) 2013-present Cole Bemis
49
+
50
+ Permission is hereby granted, free of charge, to any person obtaining a copy
51
+ of this software and associated documentation files (the "Software"), to deal
52
+ in the Software without restriction, including without limitation the rights
53
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
54
+ copies of the Software, and to permit persons to whom the Software is
55
+ furnished to do so, subject to the following conditions:
56
+
57
+ The above copyright notice and this permission notice shall be included in all
58
+ copies or substantial portions of the Software.
59
+
60
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
61
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
62
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
63
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
64
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
65
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
66
+ SOFTWARE.
package/dist/code.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ export type LumenCodeTokenKind = 'accent' | 'comment' | 'keyword' | 'string' | 'symbol' | 'type';
2
+ export interface LumenCodeToken {
3
+ kind?: LumenCodeTokenKind;
4
+ start: number;
5
+ value: string;
6
+ }
7
+ export declare const lumenCodeTokenClassNames: {
8
+ readonly accent: "ui-code__token--accent";
9
+ readonly comment: "ui-code__token--comment";
10
+ readonly keyword: "ui-code__token--keyword";
11
+ readonly string: "ui-code__token--string";
12
+ readonly symbol: "ui-code__token--symbol";
13
+ readonly type: "ui-code__token--type";
14
+ };
15
+ export declare const normalizeLumenCode: (code: string) => string;
16
+ export declare const tokenizeLumenCode: (code: string, language?: string) => LumenCodeToken[];
17
+ export declare const renderLumenCodeHtml: (code: string, language?: string) => string;
18
+ //# sourceMappingURL=code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../src/code.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAA;AAEhG,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,kBAAkB,CAAA;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,eAAO,MAAM,wBAAwB;;;;;;;CAOkB,CAAA;AA0EvD,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,WAc9C,CAAA;AAoBD,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,EAAE,iBAAa,KAAG,cAAc,EA0B7E,CAAA;AAgBD,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,EAAE,iBAAa,WACW,CAAA"}
package/dist/code.js ADDED
@@ -0,0 +1,136 @@
1
+ export const lumenCodeTokenClassNames = {
2
+ accent: 'ui-code__token--accent',
3
+ comment: 'ui-code__token--comment',
4
+ keyword: 'ui-code__token--keyword',
5
+ string: 'ui-code__token--string',
6
+ symbol: 'ui-code__token--symbol',
7
+ type: 'ui-code__token--type'
8
+ };
9
+ const jsLikeLanguages = new Set([
10
+ 'js',
11
+ 'jsx',
12
+ 'javascript',
13
+ 'mjs',
14
+ 'ts',
15
+ 'tsx',
16
+ 'typescript'
17
+ ]);
18
+ const jsKeywords = new Set([
19
+ 'as',
20
+ 'async',
21
+ 'await',
22
+ 'break',
23
+ 'case',
24
+ 'catch',
25
+ 'class',
26
+ 'const',
27
+ 'continue',
28
+ 'default',
29
+ 'else',
30
+ 'export',
31
+ 'extends',
32
+ 'false',
33
+ 'finally',
34
+ 'for',
35
+ 'from',
36
+ 'function',
37
+ 'if',
38
+ 'import',
39
+ 'in',
40
+ 'interface',
41
+ 'let',
42
+ 'new',
43
+ 'null',
44
+ 'of',
45
+ 'return',
46
+ 'throw',
47
+ 'true',
48
+ 'try',
49
+ 'type',
50
+ 'undefined',
51
+ 'var',
52
+ 'while'
53
+ ]);
54
+ const jsTypes = new Set([
55
+ 'Array',
56
+ 'Boolean',
57
+ 'Date',
58
+ 'Map',
59
+ 'Number',
60
+ 'Promise',
61
+ 'Record',
62
+ 'Set',
63
+ 'String',
64
+ 'boolean',
65
+ 'number',
66
+ 'string',
67
+ 'unknown',
68
+ 'void'
69
+ ]);
70
+ const jsTokenPattern = /\/\/[^\n]*|\/\*[\s\S]*?\*\/|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`|\b\d[\d._]*\b|\b[A-Za-z_$][\w$]*\b|[=+\-*%<>!?:.,;()[\]{}|&/]+/g;
71
+ const leadingWhitespacePattern = /^[\t ]*/;
72
+ const normalizeLanguage = (language = '') => language.trim().toLowerCase();
73
+ const startsWithIdentifierPattern = /^[A-Za-z_$]/;
74
+ const startsWithNumberPattern = /^\d/;
75
+ const startsWithCommentPattern = /^\/[/*]/;
76
+ const startsWithStringPattern = /^["'`]/;
77
+ export const normalizeLumenCode = (code) => {
78
+ const lines = code.replaceAll(/\r\n?/g, '\n').split('\n');
79
+ while (lines[0]?.trim() === '')
80
+ lines.shift();
81
+ while (lines.at(-1)?.trim() === '')
82
+ lines.pop();
83
+ const indentation = lines
84
+ .filter(line => line.trim() !== '')
85
+ .map(line => leadingWhitespacePattern.exec(line)?.[0].length ?? 0);
86
+ const trimBy = indentation.length > 0 ? Math.min(...indentation) : 0;
87
+ return lines.map(line => line.slice(trimBy)).join('\n');
88
+ };
89
+ const getTokenKind = (value) => {
90
+ if (startsWithCommentPattern.exec(value))
91
+ return 'comment';
92
+ if (startsWithStringPattern.exec(value))
93
+ return 'string';
94
+ if (startsWithNumberPattern.exec(value))
95
+ return 'accent';
96
+ if (startsWithIdentifierPattern.exec(value)) {
97
+ if (jsKeywords.has(value))
98
+ return 'keyword';
99
+ if (jsTypes.has(value))
100
+ return 'type';
101
+ return undefined;
102
+ }
103
+ return 'symbol';
104
+ };
105
+ export const tokenizeLumenCode = (code, language = '') => {
106
+ const source = normalizeLumenCode(code);
107
+ const tokens = [];
108
+ const shouldTokenizeJs = jsLikeLanguages.has(normalizeLanguage(language));
109
+ let offset = 0;
110
+ const push = (value, start, kind) => {
111
+ if (value)
112
+ tokens.push(kind ? { kind, start, value } : { start, value });
113
+ };
114
+ if (!shouldTokenizeJs)
115
+ return source ? [{ start: 0, value: source }] : [];
116
+ for (const match of source.matchAll(jsTokenPattern)) {
117
+ const index = match.index;
118
+ const value = match[0];
119
+ push(source.slice(offset, index), offset);
120
+ push(value, index, getTokenKind(value));
121
+ offset = index + value.length;
122
+ }
123
+ push(source.slice(offset), offset);
124
+ return tokens;
125
+ };
126
+ const escapeLumenCodeHtml = (value) => value
127
+ .replaceAll('&', '&amp;')
128
+ .replaceAll('<', '&lt;')
129
+ .replaceAll('>', '&gt;');
130
+ const renderLumenCodeTokenHtml = (token) => {
131
+ const value = escapeLumenCodeHtml(token.value);
132
+ if (!token.kind)
133
+ return value;
134
+ return `<span class="${lumenCodeTokenClassNames[token.kind]}">${value}</span>`;
135
+ };
136
+ export const renderLumenCodeHtml = (code, language = '') => tokenizeLumenCode(code, language).map(renderLumenCodeTokenHtml).join('');
@@ -0,0 +1,29 @@
1
+ export declare const lumenComponentNames: readonly ["Accordion", "Alert", "AlertDialog", "Agenda", "AspectRatio", "Attachment", "Autocomplete", "Avatar", "BackToTop", "Badge", "Breadcrumb", "Bubble", "Button", "ButtonGroup", "Calendar", "Callout", "Card", "Carousel", "Chart", "Checkbox", "Collapsible", "Code", "Combobox", "Command", "ContextMenu", "ColorPicker", "DataTable", "DatePicker", "DateRangePicker", "Dialog", "Direction", "Drawer", "DropdownMenu", "Empty", "Eyebrow", "Field", "FloatingBadge", "FormattedDate", "HoverCard", "Icon", "Image", "Input", "InputGroup", "InputOTP", "Item", "Kbd", "Label", "Link", "Marker", "Menubar", "Message", "MessageScroller", "NativeSelect", "NavigationMenu", "NumberField", "Pagination", "PhoneInput", "Pill", "Popover", "Progress", "Prose", "RadioGroup", "Resizable", "RichTextEditor", "ScrollArea", "Schedule", "SearchField", "Select", "Separator", "Sheet", "Sidebar", "Skeleton", "SkipLink", "Slider", "Sonner", "Spinner", "Switch", "Table", "Tabs", "TagGroup", "Textarea", "ThemeBuilder", "ThemeToggle", "TimeField", "Toast", "Toggle", "ToggleGroup", "Tooltip", "Tree", "TreeGrid", "Typography", "VirtualList", "LanguageToggle", "Particles", "AnimatedNumber", "RevealGroup", "ScrollReveal", "Stat", "Meter", "Note", "Rating", "Timeline", "AnimatedLogo", "AnimatedPortrait", "ButtonLink", "CoverImage", "GradientDivider", "Stepper", "FileUpload", "Tour", "Anchor", "Segmented", "Toolbar", "Descriptions", "Popconfirm", "Transfer", "Cascader", "TreeSelect", "Mentions", "QRCode", "Watermark", "Affix", "SpeedDial"];
2
+ export type LumenComponentName = typeof lumenComponentNames[number];
3
+ export interface LumenPackageTarget {
4
+ name: string;
5
+ packageName: string;
6
+ runtime: 'astro' | 'core' | 'elements' | 'react' | 'umbrella';
7
+ }
8
+ export declare const lumenPackages: readonly [{
9
+ readonly name: "Lumen";
10
+ readonly packageName: "@santi020k/lumen";
11
+ readonly runtime: "umbrella";
12
+ }, {
13
+ readonly name: "Lumen Core";
14
+ readonly packageName: "@santi020k/lumen-core";
15
+ readonly runtime: "core";
16
+ }, {
17
+ readonly name: "Lumen Astro";
18
+ readonly packageName: "@santi020k/lumen-astro";
19
+ readonly runtime: "astro";
20
+ }, {
21
+ readonly name: "Lumen React";
22
+ readonly packageName: "@santi020k/lumen-react";
23
+ readonly runtime: "react";
24
+ }, {
25
+ readonly name: "Lumen Elements";
26
+ readonly packageName: "@santi020k/lumen-elements";
27
+ readonly runtime: "elements";
28
+ }];
29
+ //# sourceMappingURL=components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,k/CA4HtB,CAAA;AAEV,MAAM,MAAM,kBAAkB,GAAG,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAA;AAEnE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,CAAA;CAC9D;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;EAMwB,CAAA"}
@@ -0,0 +1,132 @@
1
+ export const lumenComponentNames = [
2
+ 'Accordion',
3
+ 'Alert',
4
+ 'AlertDialog',
5
+ 'Agenda',
6
+ 'AspectRatio',
7
+ 'Attachment',
8
+ 'Autocomplete',
9
+ 'Avatar',
10
+ 'BackToTop',
11
+ 'Badge',
12
+ 'Breadcrumb',
13
+ 'Bubble',
14
+ 'Button',
15
+ 'ButtonGroup',
16
+ 'Calendar',
17
+ 'Callout',
18
+ 'Card',
19
+ 'Carousel',
20
+ 'Chart',
21
+ 'Checkbox',
22
+ 'Collapsible',
23
+ 'Code',
24
+ 'Combobox',
25
+ 'Command',
26
+ 'ContextMenu',
27
+ 'ColorPicker',
28
+ 'DataTable',
29
+ 'DatePicker',
30
+ 'DateRangePicker',
31
+ 'Dialog',
32
+ 'Direction',
33
+ 'Drawer',
34
+ 'DropdownMenu',
35
+ 'Empty',
36
+ 'Eyebrow',
37
+ 'Field',
38
+ 'FloatingBadge',
39
+ 'FormattedDate',
40
+ 'HoverCard',
41
+ 'Icon',
42
+ 'Image',
43
+ 'Input',
44
+ 'InputGroup',
45
+ 'InputOTP',
46
+ 'Item',
47
+ 'Kbd',
48
+ 'Label',
49
+ 'Link',
50
+ 'Marker',
51
+ 'Menubar',
52
+ 'Message',
53
+ 'MessageScroller',
54
+ 'NativeSelect',
55
+ 'NavigationMenu',
56
+ 'NumberField',
57
+ 'Pagination',
58
+ 'PhoneInput',
59
+ 'Pill',
60
+ 'Popover',
61
+ 'Progress',
62
+ 'Prose',
63
+ 'RadioGroup',
64
+ 'Resizable',
65
+ 'RichTextEditor',
66
+ 'ScrollArea',
67
+ 'Schedule',
68
+ 'SearchField',
69
+ 'Select',
70
+ 'Separator',
71
+ 'Sheet',
72
+ 'Sidebar',
73
+ 'Skeleton',
74
+ 'SkipLink',
75
+ 'Slider',
76
+ 'Sonner',
77
+ 'Spinner',
78
+ 'Switch',
79
+ 'Table',
80
+ 'Tabs',
81
+ 'TagGroup',
82
+ 'Textarea',
83
+ 'ThemeBuilder',
84
+ 'ThemeToggle',
85
+ 'TimeField',
86
+ 'Toast',
87
+ 'Toggle',
88
+ 'ToggleGroup',
89
+ 'Tooltip',
90
+ 'Tree',
91
+ 'TreeGrid',
92
+ 'Typography',
93
+ 'VirtualList',
94
+ 'LanguageToggle',
95
+ 'Particles',
96
+ 'AnimatedNumber',
97
+ 'RevealGroup',
98
+ 'ScrollReveal',
99
+ 'Stat',
100
+ 'Meter',
101
+ 'Note',
102
+ 'Rating',
103
+ 'Timeline',
104
+ 'AnimatedLogo',
105
+ 'AnimatedPortrait',
106
+ 'ButtonLink',
107
+ 'CoverImage',
108
+ 'GradientDivider',
109
+ 'Stepper',
110
+ 'FileUpload',
111
+ 'Tour',
112
+ 'Anchor',
113
+ 'Segmented',
114
+ 'Toolbar',
115
+ 'Descriptions',
116
+ 'Popconfirm',
117
+ 'Transfer',
118
+ 'Cascader',
119
+ 'TreeSelect',
120
+ 'Mentions',
121
+ 'QRCode',
122
+ 'Watermark',
123
+ 'Affix',
124
+ 'SpeedDial'
125
+ ];
126
+ export const lumenPackages = [
127
+ { name: 'Lumen', packageName: '@santi020k/lumen', runtime: 'umbrella' },
128
+ { name: 'Lumen Core', packageName: '@santi020k/lumen-core', runtime: 'core' },
129
+ { name: 'Lumen Astro', packageName: '@santi020k/lumen-astro', runtime: 'astro' },
130
+ { name: 'Lumen React', packageName: '@santi020k/lumen-react', runtime: 'react' },
131
+ { name: 'Lumen Elements', packageName: '@santi020k/lumen-elements', runtime: 'elements' }
132
+ ];
package/dist/data.d.ts ADDED
@@ -0,0 +1,58 @@
1
+ export type LumenSortDirection = 'asc' | 'desc';
2
+ export interface LumenDataViewState {
3
+ filters: Record<string, string>;
4
+ page: number;
5
+ pageSize: number;
6
+ pinnedColumns: string[];
7
+ query: string;
8
+ selectedIds: string[];
9
+ sort?: {
10
+ direction: LumenSortDirection;
11
+ key: string;
12
+ };
13
+ }
14
+ export type LumenDataRecord = Record<string, number | string | undefined>;
15
+ export interface LumenKeyValueReader {
16
+ getItem: (key: string) => null | string;
17
+ }
18
+ export interface LumenKeyValueWriter {
19
+ setItem: (key: string, value: string) => void;
20
+ }
21
+ export interface LumenKeyValueStorage extends LumenKeyValueReader, LumenKeyValueWriter {
22
+ }
23
+ export interface LumenDataViewServerRequest {
24
+ query: string;
25
+ state: LumenDataViewState;
26
+ url: string;
27
+ }
28
+ export declare const createDataViewState: (state?: Partial<LumenDataViewState>) => LumenDataViewState;
29
+ export declare const serializeDataViewState: (state: LumenDataViewState) => string;
30
+ export declare const parseDataViewState: (value: string) => LumenDataViewState;
31
+ export declare const getVirtualRange: (scrollOffset: number, viewportSize: number, itemSize: number, itemCount: number, overscan?: number) => {
32
+ endIndex: number;
33
+ startIndex: number;
34
+ };
35
+ export declare const filterDataRecords: <T extends LumenDataRecord>(records: readonly T[], state: Pick<LumenDataViewState, "filters" | "query">) => T[];
36
+ export declare const sortDataRecords: <T extends LumenDataRecord>(records: readonly T[], sort: LumenDataViewState["sort"]) => T[];
37
+ export declare const paginateDataRecords: <T>(records: readonly T[], page: number, pageSize: number) => {
38
+ items: T[];
39
+ page: number;
40
+ pageCount: number;
41
+ total: number;
42
+ };
43
+ export declare const applyDataViewState: <T extends LumenDataRecord>(records: readonly T[], state: LumenDataViewState) => {
44
+ items: T[];
45
+ page: number;
46
+ pageCount: number;
47
+ total: number;
48
+ };
49
+ export declare const createDataViewStorageKey: (name: string) => string;
50
+ export declare const saveDataViewState: (storage: LumenKeyValueWriter, key: string, state: LumenDataViewState) => void;
51
+ export declare const loadDataViewState: (storage: LumenKeyValueReader, key: string) => LumenDataViewState | undefined;
52
+ export declare const pinDataViewColumn: (state: LumenDataViewState, column: string) => LumenDataViewState;
53
+ export declare const unpinDataViewColumn: (state: LumenDataViewState, column: string) => LumenDataViewState;
54
+ export declare const toggleDataViewSelection: (state: LumenDataViewState, id: string, selected?: boolean) => LumenDataViewState;
55
+ export declare const createDataViewSearchParams: (state: LumenDataViewState) => URLSearchParams;
56
+ export declare const createDataViewRequestUrl: (endpoint: string, state: LumenDataViewState) => string;
57
+ export declare const createDataViewServerRequest: (endpoint: string, state: LumenDataViewState) => LumenDataViewServerRequest;
58
+ //# sourceMappingURL=data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,MAAM,CAAA;AAE/C,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,IAAI,CAAC,EAAE;QACL,SAAS,EAAE,kBAAkB,CAAA;QAC7B,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;CACF;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAA;AAEzE,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,CAAA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