@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 +21 -0
- package/README.md +62 -0
- package/THIRD_PARTY_NOTICES.md +66 -0
- package/dist/code.d.ts +18 -0
- package/dist/code.d.ts.map +1 -0
- package/dist/code.js +136 -0
- package/dist/components.d.ts +29 -0
- package/dist/components.d.ts.map +1 -0
- package/dist/components.js +132 -0
- package/dist/data.d.ts +58 -0
- package/dist/data.d.ts.map +1 -0
- package/dist/data.js +144 -0
- package/dist/figma.d.ts +54 -0
- package/dist/figma.d.ts.map +1 -0
- package/dist/figma.js +192 -0
- package/dist/icons.d.ts +13 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/icons.js +61 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/props.d.ts +10 -0
- package/dist/props.d.ts.map +1 -0
- package/dist/props.js +5 -0
- package/dist/rich-text.d.ts +21 -0
- package/dist/rich-text.d.ts.map +1 -0
- package/dist/rich-text.js +30 -0
- package/dist/schedule.d.ts +49 -0
- package/dist/schedule.d.ts.map +1 -0
- package/dist/schedule.js +98 -0
- package/dist/theme-builder.d.ts +32 -0
- package/dist/theme-builder.d.ts.map +1 -0
- package/dist/theme-builder.js +97 -0
- package/dist/theme.d.ts +53 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +328 -0
- package/dist/tokens.d.ts +55 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +54 -0
- package/package.json +97 -0
package/dist/data.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
export const createDataViewState = (state = {}) => ({
|
|
2
|
+
filters: state.filters ?? {},
|
|
3
|
+
page: state.page ?? 1,
|
|
4
|
+
pageSize: state.pageSize ?? 25,
|
|
5
|
+
pinnedColumns: state.pinnedColumns ?? [],
|
|
6
|
+
query: state.query ?? '',
|
|
7
|
+
selectedIds: state.selectedIds ?? [],
|
|
8
|
+
...(state.sort ? { sort: state.sort } : {})
|
|
9
|
+
});
|
|
10
|
+
export const serializeDataViewState = (state) => {
|
|
11
|
+
const params = new URLSearchParams();
|
|
12
|
+
params.set('page', String(state.page));
|
|
13
|
+
params.set('pageSize', String(state.pageSize));
|
|
14
|
+
if (state.query)
|
|
15
|
+
params.set('q', state.query);
|
|
16
|
+
if (state.sort)
|
|
17
|
+
params.set('sort', `${state.sort.key}:${state.sort.direction}`);
|
|
18
|
+
for (const [key, value] of Object.entries(state.filters)) {
|
|
19
|
+
if (value)
|
|
20
|
+
params.set(`filter.${key}`, value);
|
|
21
|
+
}
|
|
22
|
+
if (state.pinnedColumns.length)
|
|
23
|
+
params.set('pinned', state.pinnedColumns.join(','));
|
|
24
|
+
if (state.selectedIds.length)
|
|
25
|
+
params.set('selected', state.selectedIds.join(','));
|
|
26
|
+
return params.toString();
|
|
27
|
+
};
|
|
28
|
+
const parseDataViewFilters = (params) => {
|
|
29
|
+
const filters = {};
|
|
30
|
+
for (const [key, filterValue] of params.entries()) {
|
|
31
|
+
if (key.startsWith('filter.')) {
|
|
32
|
+
filters[key.slice('filter.'.length)] = filterValue;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return filters;
|
|
36
|
+
};
|
|
37
|
+
const parseDataViewSort = (sort) => {
|
|
38
|
+
if (!sort)
|
|
39
|
+
return undefined;
|
|
40
|
+
return {
|
|
41
|
+
direction: sort.endsWith(':desc') ? 'desc' : 'asc',
|
|
42
|
+
key: sort.split(':')[0] ?? ''
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export const parseDataViewState = (value) => {
|
|
46
|
+
const params = new URLSearchParams(value);
|
|
47
|
+
const sort = params.get('sort');
|
|
48
|
+
const parsedSort = parseDataViewSort(sort);
|
|
49
|
+
return createDataViewState({
|
|
50
|
+
filters: parseDataViewFilters(params),
|
|
51
|
+
page: Number(params.get('page') ?? 1),
|
|
52
|
+
pageSize: Number(params.get('pageSize') ?? 25),
|
|
53
|
+
pinnedColumns: params.get('pinned')?.split(',').filter(Boolean) ?? [],
|
|
54
|
+
query: params.get('q') ?? '',
|
|
55
|
+
selectedIds: params.get('selected')?.split(',').filter(Boolean) ?? [],
|
|
56
|
+
...(parsedSort ? { sort: parsedSort } : {})
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
export const getVirtualRange = (scrollOffset, viewportSize, itemSize, itemCount, overscan = 4) => {
|
|
60
|
+
const startIndex = Math.max(0, Math.floor(scrollOffset / itemSize) - overscan);
|
|
61
|
+
const visibleCount = Math.ceil(viewportSize / itemSize) + overscan * 2;
|
|
62
|
+
const endIndex = Math.min(itemCount - 1, startIndex + visibleCount);
|
|
63
|
+
return {
|
|
64
|
+
endIndex,
|
|
65
|
+
startIndex
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
const recordMatchesQuery = (record, query) => {
|
|
69
|
+
if (!query)
|
|
70
|
+
return true;
|
|
71
|
+
return Object.values(record)
|
|
72
|
+
.some(value => String(value ?? '').toLowerCase().includes(query));
|
|
73
|
+
};
|
|
74
|
+
const recordMatchesFilters = (record, filters) => Object.entries(filters)
|
|
75
|
+
.every(([key, value]) => !value || String(record[key] ?? '') === value);
|
|
76
|
+
export const filterDataRecords = (records, state) => {
|
|
77
|
+
const query = state.query.trim().toLowerCase();
|
|
78
|
+
return records.filter(record => recordMatchesQuery(record, query) && recordMatchesFilters(record, state.filters));
|
|
79
|
+
};
|
|
80
|
+
export const sortDataRecords = (records, sort) => {
|
|
81
|
+
if (!sort)
|
|
82
|
+
return [...records];
|
|
83
|
+
const direction = sort.direction === 'desc' ? -1 : 1;
|
|
84
|
+
return [...records].sort((a, b) => {
|
|
85
|
+
const valueA = a[sort.key];
|
|
86
|
+
const valueB = b[sort.key];
|
|
87
|
+
if (typeof valueA === 'number' && typeof valueB === 'number') {
|
|
88
|
+
return (valueA - valueB) * direction;
|
|
89
|
+
}
|
|
90
|
+
return String(valueA ?? '').localeCompare(String(valueB ?? '')) * direction;
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
export const paginateDataRecords = (records, page, pageSize) => {
|
|
94
|
+
const safePage = Math.max(1, page);
|
|
95
|
+
const start = (safePage - 1) * pageSize;
|
|
96
|
+
return {
|
|
97
|
+
items: records.slice(start, start + pageSize),
|
|
98
|
+
page: safePage,
|
|
99
|
+
pageCount: Math.max(1, Math.ceil(records.length / pageSize)),
|
|
100
|
+
total: records.length
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
export const applyDataViewState = (records, state) => paginateDataRecords(sortDataRecords(filterDataRecords(records, state), state.sort), state.page, state.pageSize);
|
|
104
|
+
export const createDataViewStorageKey = (name) => `lumen:data-view:${name.trim().toLowerCase().replaceAll(/\s+/g, '-')}`;
|
|
105
|
+
export const saveDataViewState = (storage, key, state) => {
|
|
106
|
+
storage.setItem(key, serializeDataViewState(state));
|
|
107
|
+
};
|
|
108
|
+
export const loadDataViewState = (storage, key) => {
|
|
109
|
+
const value = storage.getItem(key);
|
|
110
|
+
return value ? parseDataViewState(value) : undefined;
|
|
111
|
+
};
|
|
112
|
+
export const pinDataViewColumn = (state, column) => createDataViewState({
|
|
113
|
+
...state,
|
|
114
|
+
pinnedColumns: [column, ...state.pinnedColumns.filter(pinned => pinned !== column)]
|
|
115
|
+
});
|
|
116
|
+
export const unpinDataViewColumn = (state, column) => createDataViewState({
|
|
117
|
+
...state,
|
|
118
|
+
pinnedColumns: state.pinnedColumns.filter(pinned => pinned !== column)
|
|
119
|
+
});
|
|
120
|
+
export const toggleDataViewSelection = (state, id, selected) => {
|
|
121
|
+
const isSelected = state.selectedIds.includes(id);
|
|
122
|
+
const nextSelected = selected ?? !isSelected;
|
|
123
|
+
return createDataViewState({
|
|
124
|
+
...state,
|
|
125
|
+
selectedIds: nextSelected
|
|
126
|
+
? [...new Set([...state.selectedIds, id])]
|
|
127
|
+
: state.selectedIds.filter(selectedId => selectedId !== id)
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
export const createDataViewSearchParams = (state) => new URLSearchParams(serializeDataViewState(state));
|
|
131
|
+
export const createDataViewRequestUrl = (endpoint, state) => {
|
|
132
|
+
const query = serializeDataViewState(state);
|
|
133
|
+
if (!query)
|
|
134
|
+
return endpoint;
|
|
135
|
+
return `${endpoint}${endpoint.includes('?') ? '&' : '?'}${query}`;
|
|
136
|
+
};
|
|
137
|
+
export const createDataViewServerRequest = (endpoint, state) => {
|
|
138
|
+
const query = serializeDataViewState(state);
|
|
139
|
+
return {
|
|
140
|
+
query,
|
|
141
|
+
state,
|
|
142
|
+
url: createDataViewRequestUrl(endpoint, state)
|
|
143
|
+
};
|
|
144
|
+
};
|
package/dist/figma.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { LumenColorTokenName, LumenGlassEffectTokenName, LumenStructureTokenName, LumenThemeTokens } from './theme.js';
|
|
2
|
+
export interface LumenFigmaColorValue {
|
|
3
|
+
a: number;
|
|
4
|
+
b: number;
|
|
5
|
+
g: number;
|
|
6
|
+
r: number;
|
|
7
|
+
}
|
|
8
|
+
export interface LumenFigmaVariable {
|
|
9
|
+
cssValue: string;
|
|
10
|
+
description: string;
|
|
11
|
+
name: string;
|
|
12
|
+
type: 'COLOR';
|
|
13
|
+
value: LumenFigmaColorValue;
|
|
14
|
+
}
|
|
15
|
+
export interface LumenFigmaVariableMode {
|
|
16
|
+
name: string;
|
|
17
|
+
variables: LumenFigmaVariable[];
|
|
18
|
+
}
|
|
19
|
+
export interface LumenFigmaVariableCollection {
|
|
20
|
+
collectionName: string;
|
|
21
|
+
modes: LumenFigmaVariableMode[];
|
|
22
|
+
}
|
|
23
|
+
export interface LumenFigmaVariableExportOptions {
|
|
24
|
+
collectionName?: string;
|
|
25
|
+
modeName?: string;
|
|
26
|
+
variablePrefix?: string;
|
|
27
|
+
}
|
|
28
|
+
export type LumenDesignTokenType = 'color' | 'cubicBezier' | 'dimension' | 'duration' | 'fontFamily' | 'number' | 'shadow';
|
|
29
|
+
export interface LumenDesignToken {
|
|
30
|
+
$description: string;
|
|
31
|
+
$type: 'color';
|
|
32
|
+
$value: string;
|
|
33
|
+
}
|
|
34
|
+
export interface LumenEffectDesignToken {
|
|
35
|
+
$description: string;
|
|
36
|
+
$type: Exclude<LumenDesignTokenType, 'color'>;
|
|
37
|
+
$value: number | string;
|
|
38
|
+
}
|
|
39
|
+
export interface LumenStructureDesignToken {
|
|
40
|
+
$description: string;
|
|
41
|
+
$type: Exclude<LumenDesignTokenType, 'color'>;
|
|
42
|
+
$value: string;
|
|
43
|
+
}
|
|
44
|
+
export interface LumenDesignTokenExport {
|
|
45
|
+
color: Partial<Record<LumenColorTokenName, LumenDesignToken>>;
|
|
46
|
+
effect?: Partial<Record<LumenGlassEffectTokenName, LumenEffectDesignToken>>;
|
|
47
|
+
structure?: Partial<Record<LumenStructureTokenName, LumenStructureDesignToken>>;
|
|
48
|
+
}
|
|
49
|
+
export declare const hslTokenToFigmaColor: (value: string) => LumenFigmaColorValue;
|
|
50
|
+
export declare const hslTokenToHexColor: (value: string) => string;
|
|
51
|
+
export declare const createFigmaVariableName: (token: LumenColorTokenName, prefix?: string) => string;
|
|
52
|
+
export declare const exportThemeFigmaVariables: (tokens: LumenThemeTokens, options?: LumenFigmaVariableExportOptions) => LumenFigmaVariableCollection;
|
|
53
|
+
export declare const exportThemeDesignTokens: (tokens: LumenThemeTokens) => LumenDesignTokenExport;
|
|
54
|
+
//# sourceMappingURL=figma.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figma.d.ts","sourceRoot":"","sources":["../src/figma.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,EAEvB,gBAAgB,EACjB,MAAM,YAAY,CAAA;AAOnB,MAAM,WAAW,oBAAoB;IACnC,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT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B,CAAC,CAAC,CAAA;IAC7D,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,yBAAyB,EAAE,sBAAsB,CAAC,CAAC,CAAA;IAC3E,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,yBAAyB,CAAC,CAAC,CAAA;CAChF;AAyGD,eAAO,MAAM,oBAAoB,GAAI,OAAO,MAAM,KAAG,oBAUpD,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,OAAO,MAAM,KAAG,MAMlD,CAAA;AAED,eAAO,MAAM,uBAAuB,GAClC,OAAO,mBAAmB,EAC1B,eAAgB,KACf,MAAmD,CAAA;AAEtD,eAAO,MAAM,yBAAyB,GACpC,QAAQ,gBAAgB,EACxB,UAAS,+BAAoC,KAC5C,4BAwBF,CAAA;AAuCD,eAAO,MAAM,uBAAuB,GAClC,QAAQ,gBAAgB,KACvB,sBAyCD,CAAA"}
|
package/dist/figma.js
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { lumenColorTokenNames, lumenGlassEffectTokenNames, lumenStructureTokenNames } from './theme.js';
|
|
2
|
+
const lumenTokenDescriptions = {
|
|
3
|
+
accent: 'Secondary action and emphasis color.',
|
|
4
|
+
brand: 'Primary brand color for accents and active states.',
|
|
5
|
+
'brand-soft': 'Soft brand tint for selected or decorative surfaces.',
|
|
6
|
+
'brand-solid': 'Solid brand fill for high-emphasis controls.',
|
|
7
|
+
canvas: 'Base app or page background.',
|
|
8
|
+
danger: 'Destructive, error, or critical status color.',
|
|
9
|
+
'glass-bg': 'Default translucent glass fill.',
|
|
10
|
+
'glass-bg-strong': 'Stronger translucent glass fill for floating surfaces.',
|
|
11
|
+
'glass-bg-subtle': 'Subtle translucent glass fill for nested surfaces.',
|
|
12
|
+
'glass-blur': 'Backdrop blur amount for glass surfaces.',
|
|
13
|
+
'glass-border': 'Translucent glass border color.',
|
|
14
|
+
'glass-brightness': 'Backdrop brightness multiplier for glass surfaces.',
|
|
15
|
+
'glass-edge': 'Specular top edge color for glass surfaces.',
|
|
16
|
+
'glass-edge-soft': 'Soft inner edge color for glass surfaces.',
|
|
17
|
+
'glass-highlight': 'Glass highlight overlay color.',
|
|
18
|
+
'glass-refraction': 'Tint used for glass refraction glow.',
|
|
19
|
+
'glass-saturate': 'Backdrop saturation multiplier for glass surfaces.',
|
|
20
|
+
'glass-shade': 'Inner glass shade color.',
|
|
21
|
+
'glass-shadow': 'Layered depth shadow for glass surfaces.',
|
|
22
|
+
ink: 'Primary readable foreground color.',
|
|
23
|
+
'ink-muted': 'Muted foreground color for secondary content.',
|
|
24
|
+
'ink-soft': 'Soft foreground color for tertiary content.',
|
|
25
|
+
line: 'Borders, dividers, and structural lines.',
|
|
26
|
+
success: 'Positive or complete status color.',
|
|
27
|
+
surface: 'Default component surface.',
|
|
28
|
+
'surface-muted': 'Subtle component surface.',
|
|
29
|
+
'surface-strong': 'Raised or stronger component surface.',
|
|
30
|
+
'ui-duration': 'Base transition duration for interactive states.',
|
|
31
|
+
'ui-duration-fast': 'Fast transition duration for small state changes.',
|
|
32
|
+
'ui-duration-slow': 'Slow transition duration for larger movements.',
|
|
33
|
+
'ui-ease': 'Standard easing curve for interface motion.',
|
|
34
|
+
'ui-ease-emphasized': 'Emphasized easing curve for entrances and overlays.',
|
|
35
|
+
'ui-font': 'Default interface font family stack.',
|
|
36
|
+
'ui-radius': 'Base corner radius for controls and surfaces.',
|
|
37
|
+
'ui-radius-lg': 'Large corner radius for cards and floating surfaces.',
|
|
38
|
+
'ui-radius-sm': 'Small corner radius for compact controls.',
|
|
39
|
+
'ui-shadow-lg': 'High-elevation shadow for overlays and popovers.',
|
|
40
|
+
'ui-shadow-md': 'Medium-elevation shadow for raised surfaces.',
|
|
41
|
+
'ui-shadow-sm': 'Low-elevation shadow for resting surfaces.',
|
|
42
|
+
warning: 'Cautionary status color.'
|
|
43
|
+
};
|
|
44
|
+
const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
45
|
+
const parseHslToken = (value) => {
|
|
46
|
+
const [color = '', alpha = '1'] = value.split('/').map(part => part.trim());
|
|
47
|
+
const [hue, saturation, lightness] = color
|
|
48
|
+
.replaceAll('%', '')
|
|
49
|
+
.split(/\s+/)
|
|
50
|
+
.filter(Boolean)
|
|
51
|
+
.map(Number);
|
|
52
|
+
const opacity = Number(alpha);
|
|
53
|
+
if (hue === undefined ||
|
|
54
|
+
saturation === undefined ||
|
|
55
|
+
lightness === undefined ||
|
|
56
|
+
Number.isNaN(hue) ||
|
|
57
|
+
Number.isNaN(saturation) ||
|
|
58
|
+
Number.isNaN(lightness)) {
|
|
59
|
+
throw new Error(`Expected an HSL token value, received "${value}".`);
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
alpha: Number.isNaN(opacity) ? 1 : clamp(opacity, 0, 1),
|
|
63
|
+
hue: ((hue % 360) + 360) % 360,
|
|
64
|
+
lightness: clamp(lightness, 0, 100),
|
|
65
|
+
saturation: clamp(saturation, 0, 100)
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
const hslTokenToRgb = (value) => {
|
|
69
|
+
const { hue, lightness, saturation } = parseHslToken(value);
|
|
70
|
+
const s = saturation / 100;
|
|
71
|
+
const l = lightness / 100;
|
|
72
|
+
const c = (1 - Math.abs(2 * l - 1)) * s;
|
|
73
|
+
const x = c * (1 - Math.abs(((hue / 60) % 2) - 1));
|
|
74
|
+
const m = l - c / 2;
|
|
75
|
+
let rgb = [c, 0, x];
|
|
76
|
+
if (hue < 60) {
|
|
77
|
+
rgb = [c, x, 0];
|
|
78
|
+
}
|
|
79
|
+
else if (hue < 120) {
|
|
80
|
+
rgb = [x, c, 0];
|
|
81
|
+
}
|
|
82
|
+
else if (hue < 180) {
|
|
83
|
+
rgb = [0, c, x];
|
|
84
|
+
}
|
|
85
|
+
else if (hue < 240) {
|
|
86
|
+
rgb = [0, x, c];
|
|
87
|
+
}
|
|
88
|
+
else if (hue < 300) {
|
|
89
|
+
rgb = [x, 0, c];
|
|
90
|
+
}
|
|
91
|
+
return rgb.map(channel => Math.round((channel + m) * 255));
|
|
92
|
+
};
|
|
93
|
+
const channelToHex = (channel) => clamp(Math.round(channel), 0, 255).toString(16).padStart(2, '0');
|
|
94
|
+
export const hslTokenToFigmaColor = (value) => {
|
|
95
|
+
const [r, g, b] = hslTokenToRgb(value);
|
|
96
|
+
const { alpha } = parseHslToken(value);
|
|
97
|
+
return {
|
|
98
|
+
a: alpha,
|
|
99
|
+
b: b / 255,
|
|
100
|
+
g: g / 255,
|
|
101
|
+
r: r / 255
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
export const hslTokenToHexColor = (value) => {
|
|
105
|
+
const [r, g, b] = hslTokenToRgb(value);
|
|
106
|
+
const { alpha } = parseHslToken(value);
|
|
107
|
+
const hex = `#${channelToHex(r)}${channelToHex(g)}${channelToHex(b)}`;
|
|
108
|
+
return alpha < 1 ? `${hex}${channelToHex(alpha * 255)}` : hex;
|
|
109
|
+
};
|
|
110
|
+
export const createFigmaVariableName = (token, prefix = 'color') => `${prefix}/${token.replaceAll('-', '/')}`;
|
|
111
|
+
export const exportThemeFigmaVariables = (tokens, options = {}) => {
|
|
112
|
+
const collectionName = options.collectionName ?? 'Lumen theme';
|
|
113
|
+
const modeName = options.modeName ?? 'Light';
|
|
114
|
+
const variablePrefix = options.variablePrefix ?? 'color';
|
|
115
|
+
const variables = [];
|
|
116
|
+
for (const token of lumenColorTokenNames) {
|
|
117
|
+
const value = tokens[token];
|
|
118
|
+
if (!value)
|
|
119
|
+
continue;
|
|
120
|
+
variables.push({
|
|
121
|
+
cssValue: `hsl(${value})`,
|
|
122
|
+
description: lumenTokenDescriptions[token],
|
|
123
|
+
name: createFigmaVariableName(token, variablePrefix),
|
|
124
|
+
type: 'COLOR',
|
|
125
|
+
value: hslTokenToFigmaColor(value)
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
collectionName,
|
|
130
|
+
modes: [{ name: modeName, variables }]
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
const getEffectDesignTokenType = (token) => {
|
|
134
|
+
if (token === 'glass-blur')
|
|
135
|
+
return 'dimension';
|
|
136
|
+
if (token === 'glass-shadow')
|
|
137
|
+
return 'shadow';
|
|
138
|
+
return 'number';
|
|
139
|
+
};
|
|
140
|
+
const getEffectDesignTokenValue = (token, value) => {
|
|
141
|
+
if (token === 'glass-saturate' || token === 'glass-brightness') {
|
|
142
|
+
const number = Number(value);
|
|
143
|
+
return Number.isFinite(number) ? number : value;
|
|
144
|
+
}
|
|
145
|
+
return value;
|
|
146
|
+
};
|
|
147
|
+
const getStructureDesignTokenType = (token) => {
|
|
148
|
+
if (token === 'ui-font')
|
|
149
|
+
return 'fontFamily';
|
|
150
|
+
if (token.startsWith('ui-radius'))
|
|
151
|
+
return 'dimension';
|
|
152
|
+
if (token.startsWith('ui-shadow'))
|
|
153
|
+
return 'shadow';
|
|
154
|
+
if (token.startsWith('ui-duration'))
|
|
155
|
+
return 'duration';
|
|
156
|
+
return 'cubicBezier';
|
|
157
|
+
};
|
|
158
|
+
export const exportThemeDesignTokens = (tokens) => ({
|
|
159
|
+
color: Object.fromEntries(lumenColorTokenNames
|
|
160
|
+
.filter(token => tokens[token])
|
|
161
|
+
.map(token => [
|
|
162
|
+
token,
|
|
163
|
+
{
|
|
164
|
+
$description: lumenTokenDescriptions[token],
|
|
165
|
+
$type: 'color',
|
|
166
|
+
$value: hslTokenToHexColor(tokens[token] ?? '')
|
|
167
|
+
}
|
|
168
|
+
])),
|
|
169
|
+
effect: Object.fromEntries(lumenGlassEffectTokenNames
|
|
170
|
+
.filter(token => tokens[token])
|
|
171
|
+
.map(token => {
|
|
172
|
+
const value = tokens[token] ?? '';
|
|
173
|
+
return [
|
|
174
|
+
token,
|
|
175
|
+
{
|
|
176
|
+
$description: lumenTokenDescriptions[token],
|
|
177
|
+
$type: getEffectDesignTokenType(token),
|
|
178
|
+
$value: getEffectDesignTokenValue(token, value)
|
|
179
|
+
}
|
|
180
|
+
];
|
|
181
|
+
})),
|
|
182
|
+
structure: Object.fromEntries(lumenStructureTokenNames
|
|
183
|
+
.filter(token => tokens[token])
|
|
184
|
+
.map(token => [
|
|
185
|
+
token,
|
|
186
|
+
{
|
|
187
|
+
$description: lumenTokenDescriptions[token],
|
|
188
|
+
$type: getStructureDesignTokenType(token),
|
|
189
|
+
$value: tokens[token] ?? ''
|
|
190
|
+
}
|
|
191
|
+
]))
|
|
192
|
+
});
|
package/dist/icons.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type LucideIconData, type LucideIconNode } from '@lucide/icons';
|
|
2
|
+
export type LumenIconNode = LucideIconNode;
|
|
3
|
+
export type LumenIconData = LucideIconData;
|
|
4
|
+
export type LumenIconName = string;
|
|
5
|
+
export declare const lumenIcons: Readonly<Record<string, LumenIconData>>;
|
|
6
|
+
export declare const lumenIconNames: readonly string[];
|
|
7
|
+
export declare const resolveLumenIconName: (name: string) => LumenIconName | undefined;
|
|
8
|
+
export declare const getLumenIcon: (name: string) => LumenIconData | undefined;
|
|
9
|
+
export interface LumenIconSvgOptions {
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const renderLumenIconSvg: (name: string, options?: LumenIconSvgOptions) => string;
|
|
13
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../src/icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,eAAe,CAAA;AAEtB,MAAM,MAAM,aAAa,GAAG,cAAc,CAAA;AAC1C,MAAM,MAAM,aAAa,GAAG,cAAc,CAAA;AAC1C,MAAM,MAAM,aAAa,GAAG,MAAM,CAAA;AAwBlC,eAAO,MAAM,UAAU,EAElB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAA;AAE5C,eAAO,MAAM,cAAc,mBAAgD,CAAA;AAwB3E,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,KAAG,aAAa,GAAG,SAInE,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,aAAa,GAAG,SAI3D,CAAA;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,UAAS,mBAAwB,WAqBjF,CAAA"}
|
package/dist/icons.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { icons as lucideIcons } from '@lucide/icons';
|
|
2
|
+
const toKebabCase = (value) => value.trim()
|
|
3
|
+
.replaceAll(/([a-z0-9])([A-Z])/g, '$1-$2')
|
|
4
|
+
.replaceAll(/[\s_]+/g, '-')
|
|
5
|
+
.toLowerCase();
|
|
6
|
+
const lucideIconEntries = Object.entries(lucideIcons);
|
|
7
|
+
const createLumenIconEntries = () => {
|
|
8
|
+
const entries = [];
|
|
9
|
+
for (const [exportName, icon] of lucideIconEntries) {
|
|
10
|
+
entries.push([toKebabCase(exportName), icon], [icon.name, icon]);
|
|
11
|
+
for (const alias of icon.aliases ?? []) {
|
|
12
|
+
entries.push([toKebabCase(alias), icon]);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return entries;
|
|
16
|
+
};
|
|
17
|
+
export const lumenIcons = Object.freeze(Object.fromEntries(createLumenIconEntries()));
|
|
18
|
+
export const lumenIconNames = Object.freeze(Object.keys(lumenIcons).sort());
|
|
19
|
+
const escapeHtmlAttribute = (value) => value.replaceAll('&', '&')
|
|
20
|
+
.replaceAll('"', '"')
|
|
21
|
+
.replaceAll('<', '<')
|
|
22
|
+
.replaceAll('>', '>');
|
|
23
|
+
const renderAttributes = (attributes) => Object.entries(attributes)
|
|
24
|
+
.map(([name, value]) => `${name}="${escapeHtmlAttribute(value)}"`)
|
|
25
|
+
.join(' ');
|
|
26
|
+
const renderIconNode = ([tagName, attributes, children]) => {
|
|
27
|
+
const renderedAttributes = renderAttributes(attributes);
|
|
28
|
+
const openingTag = renderedAttributes ? `<${tagName} ${renderedAttributes}` : `<${tagName}`;
|
|
29
|
+
if (!children?.length) {
|
|
30
|
+
return `${openingTag} />`;
|
|
31
|
+
}
|
|
32
|
+
return `${openingTag}>${children.map(renderIconNode).join('')}</${tagName}>`;
|
|
33
|
+
};
|
|
34
|
+
export const resolveLumenIconName = (name) => {
|
|
35
|
+
const normalized = toKebabCase(name);
|
|
36
|
+
return lumenIcons[normalized] ? normalized : undefined;
|
|
37
|
+
};
|
|
38
|
+
export const getLumenIcon = (name) => {
|
|
39
|
+
const resolvedName = resolveLumenIconName(name);
|
|
40
|
+
return resolvedName ? lumenIcons[resolvedName] : undefined;
|
|
41
|
+
};
|
|
42
|
+
export const renderLumenIconSvg = (name, options = {}) => {
|
|
43
|
+
const icon = getLumenIcon(name);
|
|
44
|
+
if (!icon)
|
|
45
|
+
return '';
|
|
46
|
+
const className = ['ui-icon__svg', `lucide-${icon.name}`, options.className].filter(Boolean).join(' ');
|
|
47
|
+
return `<svg ${renderAttributes({
|
|
48
|
+
'aria-hidden': 'true',
|
|
49
|
+
class: className,
|
|
50
|
+
fill: 'none',
|
|
51
|
+
focusable: 'false',
|
|
52
|
+
height: '1em',
|
|
53
|
+
stroke: 'currentColor',
|
|
54
|
+
'stroke-linecap': 'round',
|
|
55
|
+
'stroke-linejoin': 'round',
|
|
56
|
+
'stroke-width': '2',
|
|
57
|
+
viewBox: '0 0 24 24',
|
|
58
|
+
width: '1em',
|
|
59
|
+
xmlns: 'http://www.w3.org/2000/svg'
|
|
60
|
+
})}>${icon.node.map(renderIconNode).join('')}</svg>`;
|
|
61
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { type LumenCodeToken, lumenCodeTokenClassNames, type LumenCodeTokenKind, normalizeLumenCode, renderLumenCodeHtml, tokenizeLumenCode } from './code.js';
|
|
2
|
+
export { type LumenComponentName, lumenComponentNames, lumenPackages, type LumenPackageTarget } from './components.js';
|
|
3
|
+
export { applyDataViewState, createDataViewRequestUrl, createDataViewSearchParams, createDataViewServerRequest, createDataViewState, createDataViewStorageKey, filterDataRecords, getVirtualRange, loadDataViewState, type LumenDataRecord, type LumenDataViewServerRequest, type LumenDataViewState, type LumenKeyValueReader, type LumenKeyValueStorage, type LumenKeyValueWriter, type LumenSortDirection, paginateDataRecords, parseDataViewState, pinDataViewColumn, saveDataViewState, serializeDataViewState, sortDataRecords, toggleDataViewSelection, unpinDataViewColumn } from './data.js';
|
|
4
|
+
export { createFigmaVariableName, exportThemeDesignTokens, exportThemeFigmaVariables, hslTokenToFigmaColor, hslTokenToHexColor, type LumenDesignToken, type LumenDesignTokenExport, type LumenDesignTokenType, type LumenEffectDesignToken, type LumenFigmaColorValue, type LumenFigmaVariable, type LumenFigmaVariableCollection, type LumenFigmaVariableExportOptions, type LumenFigmaVariableMode, type LumenStructureDesignToken } from './figma.js';
|
|
5
|
+
export { getLumenIcon, type LumenIconData, type LumenIconName, lumenIconNames, type LumenIconNode, lumenIcons, renderLumenIconSvg, resolveLumenIconName } from './icons.js';
|
|
6
|
+
export { type LumenAstroPropsResult, type LumenClassValue, type LumenGlass, type LumenSurfaceAlias, resolveLumenAstroProps, resolveLumenGlass } from './props.js';
|
|
7
|
+
export { getLumenRichTextShortcut, isLumenRichTextToggleCommand, type LumenRichTextChangeDetail, type LumenRichTextCommandDetail, type LumenRichTextShortcutEvent, type LumenRichTextToggleCommand, lumenRichTextToggleCommands } from './rich-text.js';
|
|
8
|
+
export { canPlaceScheduleEvent, createScheduleSlots, createScheduleStorageKey, expandRecurringScheduleEvent, getScheduleConflicts, loadScheduleEvents, type LumenScheduleConflict, type LumenScheduleEvent, type LumenScheduleKeyValueReader, type LumenScheduleKeyValueStorage, type LumenScheduleKeyValueWriter, type LumenScheduleResizeEdge, type LumenScheduleResizeOptions, type LumenScheduleResource, type LumenScheduleSlot, moveScheduleEvent, parseScheduleEvents, resizeScheduleEvent, resizeScheduleEvents, saveScheduleEvents, scheduleEventsOverlap, serializeScheduleEvents } from './schedule.js';
|
|
9
|
+
export { createThemeFromHue, createThemePalette, exportThemeCss, getContrastRatio, type LumenColorTokenName, lumenColorTokenNames, type LumenContrastScore, type LumenGlassColorTokenName, lumenGlassColorTokenNames, type LumenGlassEffectTokenName, lumenGlassEffectTokenNames, type LumenGlassTokenName, lumenGlassTokenNames, type LumenMotionTokenName, lumenMotionTokenNames, type LumenRadiusTokenName, lumenRadiusTokenNames, type LumenSemanticColorTokenName, lumenSemanticColorTokenNames, type LumenShadowTokenName, lumenShadowTokenNames, type LumenStructureTokenName, lumenStructureTokenNames, type LumenThemeContrastSuggestion, type LumenThemeFromHueOptions, type LumenThemeTokenName, type LumenThemeTokens, lumenTokenNames, type LumenTypographyTokenName, lumenTypographyTokenNames, mergeThemeTokens, parseThemeCss, scoreThemeContrast, suggestReadableInk, tuneThemeContrast } from './theme.js';
|
|
10
|
+
export { coerceThemeBuilderExportFormat, coerceThemeBuilderMode, coerceThemeBuilderScheme, createThemeBuilderTokens, exportThemeBuilderCss, exportThemeBuilderValue, type LumenThemeBuilderExportFormat, type LumenThemeBuilderMode, type LumenThemeBuilderOptions, type LumenThemeBuilderResult, type LumenThemeBuilderScheme, normalizeThemeBuilderHex, normalizeThemeBuilderHue, themeBuilderHexToHsl } from './theme-builder.js';
|
|
11
|
+
export { composeClassName, lumenColors, lumenDarkTheme, lumenFont, lumenGlass, lumenLightTheme, lumenMotion, lumenRadius, lumenShadow, lumenThemeAttribute } from './tokens.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,wBAAwB,EACxB,KAAK,kBAAkB,EAC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xB,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,KAAK,6BAA6B,EAClC,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,EACrB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,SAAS,EACT,UAAU,EACV,eAAe,EACf,WAAW,EACX,WAAW,EACX,WAAW,EACX,mBAAmB,EACpB,MAAM,aAAa,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { lumenCodeTokenClassNames, normalizeLumenCode, renderLumenCodeHtml, tokenizeLumenCode } from './code.js';
|
|
2
|
+
export { lumenComponentNames, lumenPackages } from './components.js';
|
|
3
|
+
export { applyDataViewState, createDataViewRequestUrl, createDataViewSearchParams, createDataViewServerRequest, createDataViewState, createDataViewStorageKey, filterDataRecords, getVirtualRange, loadDataViewState, paginateDataRecords, parseDataViewState, pinDataViewColumn, saveDataViewState, serializeDataViewState, sortDataRecords, toggleDataViewSelection, unpinDataViewColumn } from './data.js';
|
|
4
|
+
export { createFigmaVariableName, exportThemeDesignTokens, exportThemeFigmaVariables, hslTokenToFigmaColor, hslTokenToHexColor } from './figma.js';
|
|
5
|
+
export { getLumenIcon, lumenIconNames, lumenIcons, renderLumenIconSvg, resolveLumenIconName } from './icons.js';
|
|
6
|
+
export { resolveLumenAstroProps, resolveLumenGlass } from './props.js';
|
|
7
|
+
export { getLumenRichTextShortcut, isLumenRichTextToggleCommand, lumenRichTextToggleCommands } from './rich-text.js';
|
|
8
|
+
export { canPlaceScheduleEvent, createScheduleSlots, createScheduleStorageKey, expandRecurringScheduleEvent, getScheduleConflicts, loadScheduleEvents, moveScheduleEvent, parseScheduleEvents, resizeScheduleEvent, resizeScheduleEvents, saveScheduleEvents, scheduleEventsOverlap, serializeScheduleEvents } from './schedule.js';
|
|
9
|
+
export { createThemeFromHue, createThemePalette, exportThemeCss, getContrastRatio, lumenColorTokenNames, lumenGlassColorTokenNames, lumenGlassEffectTokenNames, lumenGlassTokenNames, lumenMotionTokenNames, lumenRadiusTokenNames, lumenSemanticColorTokenNames, lumenShadowTokenNames, lumenStructureTokenNames, lumenTokenNames, lumenTypographyTokenNames, mergeThemeTokens, parseThemeCss, scoreThemeContrast, suggestReadableInk, tuneThemeContrast } from './theme.js';
|
|
10
|
+
export { coerceThemeBuilderExportFormat, coerceThemeBuilderMode, coerceThemeBuilderScheme, createThemeBuilderTokens, exportThemeBuilderCss, exportThemeBuilderValue, normalizeThemeBuilderHex, normalizeThemeBuilderHue, themeBuilderHexToHsl } from './theme-builder.js';
|
|
11
|
+
export { composeClassName, lumenColors, lumenDarkTheme, lumenFont, lumenGlass, lumenLightTheme, lumenMotion, lumenRadius, lumenShadow, lumenThemeAttribute } from './tokens.js';
|
package/dist/props.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type LumenClassValue = boolean | null | string | undefined;
|
|
2
|
+
export type LumenGlass = boolean | 'strong' | 'subtle';
|
|
3
|
+
export type LumenSurfaceAlias = 'default' | 'glass';
|
|
4
|
+
export interface LumenAstroPropsResult {
|
|
5
|
+
classList: LumenClassValue[];
|
|
6
|
+
passthrough: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
export declare const resolveLumenAstroProps: (rest: Record<string, unknown>, classList: LumenClassValue[], classProp?: string, className?: string) => LumenAstroPropsResult;
|
|
9
|
+
export declare const resolveLumenGlass: (glass?: LumenGlass, surface?: LumenSurfaceAlias) => LumenGlass;
|
|
10
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../src/props.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAAA;AAEjE,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEtD,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,OAAO,CAAA;AAEnD,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,eAAe,EAAE,CAAA;IAC5B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACrC;AAED,eAAO,MAAM,sBAAsB,GACjC,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,WAAW,eAAe,EAAE,EAC5B,kBAAc,EACd,kBAAc,KACb,qBAGD,CAAA;AAEF,eAAO,MAAM,iBAAiB,GAC5B,QAAO,UAAkB,EACzB,UAAS,iBAA6B,KACrC,UAA0C,CAAA"}
|
package/dist/props.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const resolveLumenAstroProps = (rest, classList, classProp = '', className = '') => ({
|
|
2
|
+
classList: [...classList, classProp, className],
|
|
3
|
+
passthrough: rest
|
|
4
|
+
});
|
|
5
|
+
export const resolveLumenGlass = (glass = false, surface = 'default') => glass || surface === 'glass';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const lumenRichTextToggleCommands: readonly ["bold", "italic", "strikeThrough", "subscript", "superscript", "underline", "insertOrderedList", "insertUnorderedList"];
|
|
2
|
+
export type LumenRichTextToggleCommand = typeof lumenRichTextToggleCommands[number];
|
|
3
|
+
export interface LumenRichTextCommandDetail {
|
|
4
|
+
command: string;
|
|
5
|
+
executed: boolean;
|
|
6
|
+
value?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface LumenRichTextChangeDetail {
|
|
9
|
+
html: string;
|
|
10
|
+
text: string;
|
|
11
|
+
}
|
|
12
|
+
export interface LumenRichTextShortcutEvent {
|
|
13
|
+
altKey: boolean;
|
|
14
|
+
ctrlKey: boolean;
|
|
15
|
+
key: string;
|
|
16
|
+
metaKey: boolean;
|
|
17
|
+
shiftKey: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const isLumenRichTextToggleCommand: (command: string) => command is LumenRichTextToggleCommand;
|
|
20
|
+
export declare const getLumenRichTextShortcut: (event: LumenRichTextShortcutEvent) => string | undefined;
|
|
21
|
+
//# sourceMappingURL=rich-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rich-text.d.ts","sourceRoot":"","sources":["../src/rich-text.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,mIAS7B,CAAA;AAEX,MAAM,MAAM,0BAA0B,GAAG,OAAO,2BAA2B,CAAC,MAAM,CAAC,CAAA;AAEnF,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,OAAO,CAAA;CAClB;AAkBD,eAAO,MAAM,4BAA4B,GACvC,SAAS,MAAM,KACd,OAAO,IAAI,0BAAyD,CAAA;AAEvE,eAAO,MAAM,wBAAwB,GACnC,OAAO,0BAA0B,KAChC,MAAM,GAAG,SAMX,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const lumenRichTextToggleCommands = Object.freeze([
|
|
2
|
+
'bold',
|
|
3
|
+
'italic',
|
|
4
|
+
'strikeThrough',
|
|
5
|
+
'subscript',
|
|
6
|
+
'superscript',
|
|
7
|
+
'underline',
|
|
8
|
+
'insertOrderedList',
|
|
9
|
+
'insertUnorderedList'
|
|
10
|
+
]);
|
|
11
|
+
const toggleCommands = new Set(lumenRichTextToggleCommands);
|
|
12
|
+
const shortcuts = {
|
|
13
|
+
b: 'bold',
|
|
14
|
+
i: 'italic',
|
|
15
|
+
u: 'underline',
|
|
16
|
+
z: 'undo'
|
|
17
|
+
};
|
|
18
|
+
const shiftedShortcuts = {
|
|
19
|
+
7: 'insertOrderedList',
|
|
20
|
+
8: 'insertUnorderedList',
|
|
21
|
+
x: 'strikeThrough',
|
|
22
|
+
z: 'redo'
|
|
23
|
+
};
|
|
24
|
+
export const isLumenRichTextToggleCommand = (command) => toggleCommands.has(command);
|
|
25
|
+
export const getLumenRichTextShortcut = (event) => {
|
|
26
|
+
if ((!event.ctrlKey && !event.metaKey) || event.altKey)
|
|
27
|
+
return undefined;
|
|
28
|
+
const key = event.key.toLowerCase();
|
|
29
|
+
return event.shiftKey ? shiftedShortcuts[key] : shortcuts[key];
|
|
30
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface LumenScheduleEvent {
|
|
2
|
+
end: string;
|
|
3
|
+
id: string;
|
|
4
|
+
resourceId?: string;
|
|
5
|
+
start: string;
|
|
6
|
+
title: string;
|
|
7
|
+
}
|
|
8
|
+
export interface LumenScheduleResource {
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
}
|
|
12
|
+
export interface LumenScheduleSlot {
|
|
13
|
+
date: string;
|
|
14
|
+
events: LumenScheduleEvent[];
|
|
15
|
+
resource?: LumenScheduleResource;
|
|
16
|
+
}
|
|
17
|
+
export interface LumenScheduleConflict {
|
|
18
|
+
a: LumenScheduleEvent;
|
|
19
|
+
b: LumenScheduleEvent;
|
|
20
|
+
}
|
|
21
|
+
export type LumenScheduleResizeEdge = 'end' | 'start';
|
|
22
|
+
export interface LumenScheduleResizeOptions {
|
|
23
|
+
edge?: LumenScheduleResizeEdge;
|
|
24
|
+
max?: string;
|
|
25
|
+
min?: string;
|
|
26
|
+
snapMinutes?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface LumenScheduleKeyValueReader {
|
|
29
|
+
getItem: (key: string) => null | string;
|
|
30
|
+
}
|
|
31
|
+
export interface LumenScheduleKeyValueWriter {
|
|
32
|
+
setItem: (key: string, value: string) => void;
|
|
33
|
+
}
|
|
34
|
+
export interface LumenScheduleKeyValueStorage extends LumenScheduleKeyValueReader, LumenScheduleKeyValueWriter {
|
|
35
|
+
}
|
|
36
|
+
export declare const createScheduleSlots: (dates: readonly string[], events: readonly LumenScheduleEvent[], resources?: readonly LumenScheduleResource[]) => LumenScheduleSlot[];
|
|
37
|
+
export declare const moveScheduleEvent: (events: readonly LumenScheduleEvent[], eventId: string, nextStart: string, nextEnd: string, resourceId?: string) => LumenScheduleEvent[];
|
|
38
|
+
export declare const expandRecurringScheduleEvent: (event: LumenScheduleEvent, count: number, intervalDays?: number) => LumenScheduleEvent[];
|
|
39
|
+
export declare const scheduleEventsOverlap: (a: LumenScheduleEvent, b: LumenScheduleEvent) => boolean;
|
|
40
|
+
export declare const getScheduleConflicts: (events: readonly LumenScheduleEvent[]) => LumenScheduleConflict[];
|
|
41
|
+
export declare const canPlaceScheduleEvent: (events: readonly LumenScheduleEvent[], event: LumenScheduleEvent) => boolean;
|
|
42
|
+
export declare const resizeScheduleEvent: (event: LumenScheduleEvent, nextDateTime: string, options?: LumenScheduleResizeOptions) => LumenScheduleEvent;
|
|
43
|
+
export declare const resizeScheduleEvents: (events: readonly LumenScheduleEvent[], eventId: string, nextDateTime: string, options?: LumenScheduleResizeOptions) => LumenScheduleEvent[];
|
|
44
|
+
export declare const serializeScheduleEvents: (events: readonly LumenScheduleEvent[]) => string;
|
|
45
|
+
export declare const parseScheduleEvents: (value: string) => LumenScheduleEvent[];
|
|
46
|
+
export declare const createScheduleStorageKey: (name: string) => string;
|
|
47
|
+
export declare const saveScheduleEvents: (storage: LumenScheduleKeyValueWriter, key: string, events: readonly LumenScheduleEvent[]) => void;
|
|
48
|
+
export declare const loadScheduleEvents: (storage: LumenScheduleKeyValueReader, key: string) => LumenScheduleE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