@x33025/sveltely 0.1.24 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/LoaderOverlay.svelte +10 -3
- package/dist/components/Library/Accordion/Accordion.demo.svelte +21 -0
- package/dist/components/Library/Accordion/Accordion.demo.svelte.d.ts +9 -0
- package/dist/components/Library/Accordion/Accordion.svelte +78 -0
- package/dist/components/Library/Accordion/Accordion.svelte.d.ts +14 -0
- package/dist/components/Library/Accordion/Content.svelte +57 -0
- package/dist/components/Library/Accordion/Content.svelte.d.ts +8 -0
- package/dist/components/Library/Accordion/Header.svelte +98 -0
- package/dist/components/Library/Accordion/Header.svelte.d.ts +10 -0
- package/dist/components/Library/Accordion/context.d.ts +9 -0
- package/dist/components/Library/Accordion/context.js +6 -0
- package/dist/components/Library/Accordion/index.d.ts +9 -0
- package/dist/components/Library/Accordion/index.js +7 -0
- package/dist/components/Library/AnimatedNumber/AnimatedNumber.demo.svelte +1 -1
- package/dist/components/Library/ArticleEditor/ArticleEditor.svelte +1 -2
- package/dist/components/Library/ArticleEditor/Blocks/Table.svelte +1 -1
- package/dist/components/Library/ChipInput/ChipInput.demo.svelte +1 -1
- package/dist/components/Library/Dropdown/Dropdown.demo.svelte +5 -3
- package/dist/components/Library/Grid/Grid.demo.svelte +58 -0
- package/dist/components/Library/Grid/Grid.demo.svelte.d.ts +25 -0
- package/dist/components/Library/Grid/Grid.svelte +120 -26
- package/dist/components/Library/Grid/Grid.svelte.d.ts +38 -10
- package/dist/components/Library/Grid/GridItem.svelte +8 -13
- package/dist/components/Library/ImageMask/ImageMask.demo.svelte +1 -1
- package/dist/components/Library/Label/Label.demo.svelte +1 -1
- package/dist/components/Library/Label/Label.svelte +5 -13
- package/dist/components/Library/Notifications/Notifications.demo.svelte +63 -0
- package/dist/components/Library/Notifications/Notifications.demo.svelte.d.ts +9 -0
- package/dist/components/Library/Notifications/Notifications.svelte +155 -0
- package/dist/components/Library/Notifications/Notifications.svelte.d.ts +35 -0
- package/dist/components/Library/Notifications/index.d.ts +2 -0
- package/dist/components/Library/Notifications/index.js +1 -0
- package/dist/components/Library/Notifications/types.d.ts +8 -0
- package/dist/components/Library/Notifications/types.js +1 -0
- package/dist/components/Library/NumberField/NumberField.svelte +25 -19
- package/dist/components/Library/Pagination/Pagination.svelte +6 -18
- package/dist/components/Library/ScrollView/ScrollView.svelte +76 -4
- package/dist/components/Library/ScrollView/ScrollView.svelte.d.ts +9 -2
- package/dist/components/Library/ScrollView/index.d.ts +1 -1
- package/dist/components/Library/SearchField/SearchField.demo.svelte +1 -1
- package/dist/components/Library/SegmentedPicker/SegmentedPicker.demo.svelte +1 -1
- package/dist/components/Library/Slider/Slider.demo.svelte +1 -1
- package/dist/components/Library/Table/Table.demo.svelte +9 -1
- package/dist/components/Library/Table/Table.svelte +315 -112
- package/dist/components/Library/Table/Table.svelte.d.ts +7 -1
- package/dist/components/Library/TextField/TextField.svelte +20 -14
- package/dist/components/Library/TokenSearchField/TokenSearchField.demo.svelte +1 -1
- package/dist/components/Local/ColorStyleControls.svelte +25 -64
- package/dist/components/Local/ComponentGrid.svelte +103 -22
- package/dist/components/Local/ComponentGrid.svelte.d.ts +2 -1
- package/dist/components/Local/ComponentPage.svelte +74 -0
- package/dist/components/Local/ComponentPage.svelte.d.ts +13 -0
- package/dist/components/Local/HeroCard.svelte +10 -5
- package/dist/components/Local/LayoutStyleControls.svelte +6 -6
- package/dist/index.d.ts +8 -3
- package/dist/index.js +4 -1
- package/dist/style/index.css +1 -2
- package/dist/style/layout.d.ts +11 -26
- package/dist/style/layout.js +31 -53
- package/dist/style.css +4 -1
- package/dist/viewport/geometry.d.ts +8 -0
- package/dist/viewport/geometry.js +43 -0
- package/dist/viewport/index.d.ts +4 -0
- package/dist/viewport/index.js +4 -0
- package/dist/viewport/layout.d.ts +4 -0
- package/dist/viewport/layout.js +138 -0
- package/dist/viewport/placement.d.ts +4 -0
- package/dist/viewport/placement.js +14 -0
- package/dist/viewport/types.d.ts +81 -0
- package/dist/viewport/types.js +1 -0
- package/package.json +1 -1
package/dist/style/layout.js
CHANGED
|
@@ -1,55 +1,41 @@
|
|
|
1
|
+
export const Axis = {
|
|
2
|
+
X: 'x',
|
|
3
|
+
Y: 'y'
|
|
4
|
+
};
|
|
1
5
|
export const LayoutDimension = {
|
|
2
6
|
infinity: 'infinity'
|
|
3
7
|
};
|
|
4
|
-
|
|
5
|
-
start: 'start',
|
|
6
|
-
center: 'center',
|
|
7
|
-
end: 'end',
|
|
8
|
-
stretch: 'stretch',
|
|
9
|
-
baseline: 'baseline'
|
|
10
|
-
};
|
|
11
|
-
export const LayoutJustification = {
|
|
12
|
-
start: 'start',
|
|
13
|
-
center: 'center',
|
|
14
|
-
end: 'end'
|
|
15
|
-
};
|
|
16
|
-
const LAYOUT_PROP_KEYS = new Set([
|
|
17
|
-
'width',
|
|
18
|
-
'height',
|
|
19
|
-
'minWidth',
|
|
20
|
-
'minHeight',
|
|
21
|
-
'maxWidth',
|
|
22
|
-
'maxHeight',
|
|
23
|
-
'align',
|
|
24
|
-
'justify'
|
|
25
|
-
]);
|
|
8
|
+
const LAYOUT_PROP_KEYS = new Set(['grow', 'fit', 'width', 'height']);
|
|
26
9
|
const toRem = (value) => value === undefined ? undefined : typeof value === 'number' ? `${value}rem` : value;
|
|
27
10
|
const toDimension = (value) => {
|
|
28
11
|
if (value === 'infinity')
|
|
29
12
|
return '100%';
|
|
30
13
|
return toRem(value);
|
|
31
14
|
};
|
|
32
|
-
const
|
|
15
|
+
const axisHas = (value, axis) => {
|
|
16
|
+
if (value === undefined || value === false)
|
|
17
|
+
return false;
|
|
18
|
+
if (value === true)
|
|
19
|
+
return true;
|
|
20
|
+
if (Array.isArray(value))
|
|
21
|
+
return value.includes(axis);
|
|
22
|
+
return value === axis;
|
|
23
|
+
};
|
|
24
|
+
const pushAxisDeclarations = (declarations, styles, axis, properties) => {
|
|
25
|
+
if (axisHas(styles.grow, axis)) {
|
|
26
|
+
declarations.push(`${properties.size}: 100%;`);
|
|
27
|
+
declarations.push(`${properties.minSize}: 0;`);
|
|
28
|
+
}
|
|
29
|
+
if (axisHas(styles.fit, axis)) {
|
|
30
|
+
declarations.push(`${properties.size}: fit-content;`);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
33
|
const pushDeclaration = (declarations, name, value) => {
|
|
34
|
-
if (typeof value === 'string' && blockedIntrinsicSizes.has(value))
|
|
35
|
-
return;
|
|
36
34
|
const resolved = toDimension(value);
|
|
37
35
|
if (resolved === undefined)
|
|
38
36
|
return;
|
|
39
37
|
declarations.push(`${name}: ${resolved};`);
|
|
40
38
|
};
|
|
41
|
-
const alignValues = {
|
|
42
|
-
start: 'flex-start',
|
|
43
|
-
center: 'center',
|
|
44
|
-
end: 'flex-end',
|
|
45
|
-
stretch: 'stretch',
|
|
46
|
-
baseline: 'baseline'
|
|
47
|
-
};
|
|
48
|
-
const justifyValues = {
|
|
49
|
-
start: 'flex-start',
|
|
50
|
-
center: 'center',
|
|
51
|
-
end: 'flex-end'
|
|
52
|
-
};
|
|
53
39
|
export const extractLayoutProps = (props) => {
|
|
54
40
|
const layoutProps = {};
|
|
55
41
|
const restProps = {};
|
|
@@ -69,23 +55,15 @@ export const layoutStyle = (styles) => {
|
|
|
69
55
|
if (!styles)
|
|
70
56
|
return '';
|
|
71
57
|
const declarations = [];
|
|
58
|
+
pushAxisDeclarations(declarations, styles, Axis.X, {
|
|
59
|
+
size: 'width',
|
|
60
|
+
minSize: 'min-width'
|
|
61
|
+
});
|
|
62
|
+
pushAxisDeclarations(declarations, styles, Axis.Y, {
|
|
63
|
+
size: 'height',
|
|
64
|
+
minSize: 'min-height'
|
|
65
|
+
});
|
|
72
66
|
pushDeclaration(declarations, 'width', styles.width);
|
|
73
67
|
pushDeclaration(declarations, 'height', styles.height);
|
|
74
|
-
pushDeclaration(declarations, 'min-width', styles.minWidth);
|
|
75
|
-
pushDeclaration(declarations, 'min-height', styles.minHeight);
|
|
76
|
-
pushDeclaration(declarations, 'max-width', styles.maxWidth);
|
|
77
|
-
pushDeclaration(declarations, 'max-height', styles.maxHeight);
|
|
78
|
-
if (styles.maxWidth === 'infinity' && styles.width === undefined) {
|
|
79
|
-
declarations.push('width: 100%;');
|
|
80
|
-
}
|
|
81
|
-
if (styles.maxHeight === 'infinity' && styles.height === undefined) {
|
|
82
|
-
declarations.push('height: 100%;');
|
|
83
|
-
}
|
|
84
|
-
if (styles.align !== undefined) {
|
|
85
|
-
declarations.push(`align-items: ${alignValues[styles.align]};`);
|
|
86
|
-
}
|
|
87
|
-
if (styles.justify !== undefined) {
|
|
88
|
-
declarations.push(`justify-content: ${justifyValues[styles.justify]};`);
|
|
89
|
-
}
|
|
90
68
|
return declarations.join(' ');
|
|
91
69
|
};
|
package/dist/style.css
CHANGED
|
@@ -317,6 +317,9 @@
|
|
|
317
317
|
.shrink-0 {
|
|
318
318
|
flex-shrink: 0;
|
|
319
319
|
}
|
|
320
|
+
.grow {
|
|
321
|
+
flex-grow: 1;
|
|
322
|
+
}
|
|
320
323
|
.border-collapse {
|
|
321
324
|
border-collapse: collapse;
|
|
322
325
|
}
|
|
@@ -814,7 +817,7 @@
|
|
|
814
817
|
flex-shrink: 0;
|
|
815
818
|
}
|
|
816
819
|
}
|
|
817
|
-
.overflow-auto > .vstack, .overflow-auto > .hstack
|
|
820
|
+
.overflow-auto > .vstack, .overflow-auto > .hstack {
|
|
818
821
|
flex-shrink: 0;
|
|
819
822
|
}
|
|
820
823
|
@property --tw-rotate-x {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { LayoutRange, ViewportGeometry, ViewportOverscan, ViewportRect, ViewportSize } from './types';
|
|
2
|
+
export declare const clamp: (value: number, min: number, max: number) => number;
|
|
3
|
+
export declare const range: (start: number, end: number) => LayoutRange;
|
|
4
|
+
export declare const rectsIntersect: (first: ViewportRect, second: ViewportRect) => boolean;
|
|
5
|
+
export declare const overscanRect: (geometry: ViewportGeometry, overscan?: ViewportOverscan) => ViewportRect;
|
|
6
|
+
export declare const fixedRange: (offset: number, viewportSize: number, itemSize: number, count: number, gap?: number, overscan?: number) => LayoutRange;
|
|
7
|
+
export declare const sumSizes: (sizes: number[], gap?: number) => number;
|
|
8
|
+
export declare const emptySize: ViewportSize;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
2
|
+
export const range = (start, end) => ({
|
|
3
|
+
start: Math.max(0, start),
|
|
4
|
+
end: Math.max(start, end)
|
|
5
|
+
});
|
|
6
|
+
export const rectsIntersect = (first, second) => first.x < second.x + second.width &&
|
|
7
|
+
first.x + first.width > second.x &&
|
|
8
|
+
first.y < second.y + second.height &&
|
|
9
|
+
first.y + first.height > second.y;
|
|
10
|
+
export const overscanRect = (geometry, overscan = 0) => {
|
|
11
|
+
const resolved = typeof overscan === 'number'
|
|
12
|
+
? {
|
|
13
|
+
top: overscan,
|
|
14
|
+
right: overscan,
|
|
15
|
+
bottom: overscan,
|
|
16
|
+
left: overscan
|
|
17
|
+
}
|
|
18
|
+
: {
|
|
19
|
+
top: overscan.top ?? overscan.y ?? 0,
|
|
20
|
+
right: overscan.right ?? overscan.x ?? 0,
|
|
21
|
+
bottom: overscan.bottom ?? overscan.y ?? 0,
|
|
22
|
+
left: overscan.left ?? overscan.x ?? 0
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
x: Math.max(0, geometry.offset.x - resolved.left),
|
|
26
|
+
y: Math.max(0, geometry.offset.y - resolved.top),
|
|
27
|
+
width: geometry.viewport.width + resolved.left + resolved.right,
|
|
28
|
+
height: geometry.viewport.height + resolved.top + resolved.bottom
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export const fixedRange = (offset, viewportSize, itemSize, count, gap = 0, overscan = 0) => {
|
|
32
|
+
if (count <= 0 || itemSize <= 0)
|
|
33
|
+
return range(0, 0);
|
|
34
|
+
const stride = itemSize + gap;
|
|
35
|
+
const start = clamp(Math.floor((offset - overscan) / stride), 0, count);
|
|
36
|
+
const end = clamp(Math.ceil((offset + viewportSize + overscan) / stride), start, count);
|
|
37
|
+
return range(start, end);
|
|
38
|
+
};
|
|
39
|
+
export const sumSizes = (sizes, gap = 0) => sizes.reduce((total, size) => total + size, 0) + Math.max(0, sizes.length - 1) * gap;
|
|
40
|
+
export const emptySize = {
|
|
41
|
+
width: 0,
|
|
42
|
+
height: 0
|
|
43
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FixedGridLayoutOptions, FixedListLayoutOptions, LayoutResult, TableViewportLayout, TableViewportLayoutOptions } from './types';
|
|
2
|
+
export declare const fixedListLayout: <T>({ items, viewport, itemSize, gap, overscan, key }: FixedListLayoutOptions<T>) => LayoutResult<T>;
|
|
3
|
+
export declare const fixedGridLayout: <T>({ items, viewport, columnWidth, rowHeight, columns, columnGap, rowGap, overscan, key }: FixedGridLayoutOptions<T>) => LayoutResult<T>;
|
|
4
|
+
export declare const tableViewportLayout: <T>({ rows, columns, viewport, rowHeight, headerHeight, overscan, rowKey }: TableViewportLayoutOptions<T>) => TableViewportLayout<T>;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { fixedRange, rectsIntersect, sumSizes, overscanRect } from './geometry';
|
|
2
|
+
const defaultKey = (_item, index) => index;
|
|
3
|
+
const itemKey = (item, index, key) => String((key ?? defaultKey)(item, index));
|
|
4
|
+
export const fixedListLayout = ({ items, viewport, itemSize, gap = 0, overscan = 0, key }) => {
|
|
5
|
+
const visibleRange = fixedRange(viewport.offset.y, viewport.viewport.height, itemSize, items.length, gap, typeof overscan === 'number' ? overscan : (overscan.y ?? overscan.top ?? 0));
|
|
6
|
+
const contentHeight = items.length * itemSize + Math.max(0, items.length - 1) * gap;
|
|
7
|
+
const visible = [];
|
|
8
|
+
for (let index = visibleRange.start; index < visibleRange.end; index += 1) {
|
|
9
|
+
const item = items[index];
|
|
10
|
+
visible.push({
|
|
11
|
+
key: itemKey(item, index, key),
|
|
12
|
+
item,
|
|
13
|
+
index,
|
|
14
|
+
rect: {
|
|
15
|
+
x: 0,
|
|
16
|
+
y: index * (itemSize + gap),
|
|
17
|
+
width: viewport.viewport.width,
|
|
18
|
+
height: itemSize
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
content: {
|
|
24
|
+
width: viewport.viewport.width,
|
|
25
|
+
height: contentHeight
|
|
26
|
+
},
|
|
27
|
+
visible
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export const fixedGridLayout = ({ items, viewport, columnWidth, rowHeight, columns, columnGap = 0, rowGap = 0, overscan = 0, key }) => {
|
|
31
|
+
const columnCount = Math.max(1, columns);
|
|
32
|
+
const rowCount = Math.ceil(items.length / columnCount);
|
|
33
|
+
const visibleRows = fixedRange(viewport.offset.y, viewport.viewport.height, rowHeight, rowCount, rowGap, typeof overscan === 'number' ? overscan : (overscan.y ?? overscan.top ?? 0));
|
|
34
|
+
const visibleRect = overscanRect(viewport, overscan);
|
|
35
|
+
const visible = [];
|
|
36
|
+
for (let row = visibleRows.start; row < visibleRows.end; row += 1) {
|
|
37
|
+
for (let column = 0; column < columnCount; column += 1) {
|
|
38
|
+
const index = row * columnCount + column;
|
|
39
|
+
const item = items[index];
|
|
40
|
+
if (item === undefined)
|
|
41
|
+
continue;
|
|
42
|
+
const rect = {
|
|
43
|
+
x: column * (columnWidth + columnGap),
|
|
44
|
+
y: row * (rowHeight + rowGap),
|
|
45
|
+
width: columnWidth,
|
|
46
|
+
height: rowHeight
|
|
47
|
+
};
|
|
48
|
+
if (!rectsIntersect(rect, visibleRect))
|
|
49
|
+
continue;
|
|
50
|
+
visible.push({
|
|
51
|
+
key: itemKey(item, index, key),
|
|
52
|
+
item,
|
|
53
|
+
index,
|
|
54
|
+
rect
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
content: {
|
|
60
|
+
width: columnCount * columnWidth + Math.max(0, columnCount - 1) * columnGap,
|
|
61
|
+
height: rowCount * rowHeight + Math.max(0, rowCount - 1) * rowGap
|
|
62
|
+
},
|
|
63
|
+
visible
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export const tableViewportLayout = ({ rows, columns, viewport, rowHeight, headerHeight = 0, overscan = 0, rowKey }) => {
|
|
67
|
+
const columnWidths = columns.map((column) => column.width);
|
|
68
|
+
const columnOffsets = columns.map((_, index) => index === 0 ? 0 : sumSizes(columnWidths.slice(0, index)));
|
|
69
|
+
const contentWidth = sumSizes(columnWidths);
|
|
70
|
+
const contentHeight = headerHeight + rows.length * rowHeight;
|
|
71
|
+
const visibleRect = overscanRect(viewport, overscan);
|
|
72
|
+
const rowRange = fixedRange(Math.max(0, viewport.offset.y - headerHeight), viewport.viewport.height, rowHeight, rows.length, 0, typeof overscan === 'number' ? overscan : (overscan.y ?? overscan.top ?? 0));
|
|
73
|
+
const header = [];
|
|
74
|
+
const visibleRows = [];
|
|
75
|
+
const cells = [];
|
|
76
|
+
for (const [columnIndex, column] of columns.entries()) {
|
|
77
|
+
const rect = {
|
|
78
|
+
x: columnOffsets[columnIndex],
|
|
79
|
+
y: 0,
|
|
80
|
+
width: column.width,
|
|
81
|
+
height: headerHeight
|
|
82
|
+
};
|
|
83
|
+
if (headerHeight > 0 && rectsIntersect(rect, visibleRect)) {
|
|
84
|
+
header.push({
|
|
85
|
+
key: column.key,
|
|
86
|
+
item: column,
|
|
87
|
+
index: columnIndex,
|
|
88
|
+
rect
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
for (let rowIndex = rowRange.start; rowIndex < rowRange.end; rowIndex += 1) {
|
|
93
|
+
const row = rows[rowIndex];
|
|
94
|
+
const rowRect = {
|
|
95
|
+
x: 0,
|
|
96
|
+
y: headerHeight + rowIndex * rowHeight,
|
|
97
|
+
width: contentWidth,
|
|
98
|
+
height: rowHeight
|
|
99
|
+
};
|
|
100
|
+
const resolvedRowKey = itemKey(row, rowIndex, rowKey);
|
|
101
|
+
visibleRows.push({
|
|
102
|
+
key: resolvedRowKey,
|
|
103
|
+
item: row,
|
|
104
|
+
index: rowIndex,
|
|
105
|
+
rect: rowRect
|
|
106
|
+
});
|
|
107
|
+
for (const [columnIndex, column] of columns.entries()) {
|
|
108
|
+
const rect = {
|
|
109
|
+
x: columnOffsets[columnIndex],
|
|
110
|
+
y: rowRect.y,
|
|
111
|
+
width: column.width,
|
|
112
|
+
height: rowHeight
|
|
113
|
+
};
|
|
114
|
+
if (!rectsIntersect(rect, visibleRect))
|
|
115
|
+
continue;
|
|
116
|
+
cells.push({
|
|
117
|
+
key: `${resolvedRowKey}:${column.key}`,
|
|
118
|
+
index: cells.length,
|
|
119
|
+
item: {
|
|
120
|
+
row,
|
|
121
|
+
column,
|
|
122
|
+
rowIndex,
|
|
123
|
+
columnIndex
|
|
124
|
+
},
|
|
125
|
+
rect
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
content: {
|
|
131
|
+
width: contentWidth,
|
|
132
|
+
height: contentHeight
|
|
133
|
+
},
|
|
134
|
+
header,
|
|
135
|
+
rows: visibleRows,
|
|
136
|
+
cells
|
|
137
|
+
};
|
|
138
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const px = (value) => `${Math.max(0, value)}px`;
|
|
2
|
+
export const placementStyle = (rect) => [
|
|
3
|
+
'position: absolute;',
|
|
4
|
+
`width: ${px(rect.width)};`,
|
|
5
|
+
`height: ${px(rect.height)};`,
|
|
6
|
+
`transform: translate3d(${rect.x}px, ${rect.y}px, 0);`
|
|
7
|
+
].join(' ');
|
|
8
|
+
export const contentStyle = (size) => [
|
|
9
|
+
'position: relative;',
|
|
10
|
+
`width: ${px(size.width)};`,
|
|
11
|
+
`height: ${px(size.height)};`,
|
|
12
|
+
'min-width: 100%;',
|
|
13
|
+
'min-height: 100%;'
|
|
14
|
+
].join(' ');
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export type ViewportPoint = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
};
|
|
5
|
+
export type ViewportSize = {
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
};
|
|
9
|
+
export type ViewportRect = ViewportPoint & ViewportSize;
|
|
10
|
+
export type ViewportGeometry = {
|
|
11
|
+
offset: ViewportPoint;
|
|
12
|
+
viewport: ViewportSize;
|
|
13
|
+
};
|
|
14
|
+
export type ViewportOverscan = number | {
|
|
15
|
+
x?: number;
|
|
16
|
+
y?: number;
|
|
17
|
+
top?: number;
|
|
18
|
+
right?: number;
|
|
19
|
+
bottom?: number;
|
|
20
|
+
left?: number;
|
|
21
|
+
};
|
|
22
|
+
export type LayoutContentSize = ViewportSize;
|
|
23
|
+
export type PlacedItem<T> = {
|
|
24
|
+
key: string;
|
|
25
|
+
item: T;
|
|
26
|
+
rect: ViewportRect;
|
|
27
|
+
index: number;
|
|
28
|
+
};
|
|
29
|
+
export type LayoutResult<T> = {
|
|
30
|
+
content: LayoutContentSize;
|
|
31
|
+
visible: PlacedItem<T>[];
|
|
32
|
+
};
|
|
33
|
+
export type LayoutKey<T> = (item: T, index: number) => string | number;
|
|
34
|
+
export type LayoutRange = {
|
|
35
|
+
start: number;
|
|
36
|
+
end: number;
|
|
37
|
+
};
|
|
38
|
+
export type FixedListLayoutOptions<T> = {
|
|
39
|
+
items: T[];
|
|
40
|
+
viewport: ViewportGeometry;
|
|
41
|
+
itemSize: number;
|
|
42
|
+
gap?: number;
|
|
43
|
+
overscan?: ViewportOverscan;
|
|
44
|
+
key?: LayoutKey<T>;
|
|
45
|
+
};
|
|
46
|
+
export type FixedGridLayoutOptions<T> = {
|
|
47
|
+
items: T[];
|
|
48
|
+
viewport: ViewportGeometry;
|
|
49
|
+
columnWidth: number;
|
|
50
|
+
rowHeight: number;
|
|
51
|
+
columns: number;
|
|
52
|
+
columnGap?: number;
|
|
53
|
+
rowGap?: number;
|
|
54
|
+
overscan?: ViewportOverscan;
|
|
55
|
+
key?: LayoutKey<T>;
|
|
56
|
+
};
|
|
57
|
+
export type TableColumnLayout = {
|
|
58
|
+
key: string;
|
|
59
|
+
width: number;
|
|
60
|
+
};
|
|
61
|
+
export type TableCellPlacement<T> = {
|
|
62
|
+
row: T;
|
|
63
|
+
column: TableColumnLayout;
|
|
64
|
+
rowIndex: number;
|
|
65
|
+
columnIndex: number;
|
|
66
|
+
};
|
|
67
|
+
export type TableViewportLayoutOptions<T> = {
|
|
68
|
+
rows: T[];
|
|
69
|
+
columns: TableColumnLayout[];
|
|
70
|
+
viewport: ViewportGeometry;
|
|
71
|
+
rowHeight: number;
|
|
72
|
+
headerHeight?: number;
|
|
73
|
+
overscan?: ViewportOverscan;
|
|
74
|
+
rowKey?: LayoutKey<T>;
|
|
75
|
+
};
|
|
76
|
+
export type TableViewportLayout<T> = {
|
|
77
|
+
content: LayoutContentSize;
|
|
78
|
+
header: PlacedItem<TableColumnLayout>[];
|
|
79
|
+
rows: PlacedItem<T>[];
|
|
80
|
+
cells: PlacedItem<TableCellPlacement<T>>[];
|
|
81
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|