@pixui-dev/pxw 0.1.16
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/bin/pxw.js +217 -0
- package/bin/wpbuild.js +10 -0
- package/config/default.conf +21 -0
- package/config/devops.js +358 -0
- package/config/h5es.js +10 -0
- package/config/index.html +181 -0
- package/config/pfbs.js +207 -0
- package/config/testhelp.js +0 -0
- package/config/util.js +140 -0
- package/config/webpack.js +291 -0
- package/lib/assets/border.png +0 -0
- package/lib/assets/check.html +62 -0
- package/lib/assets/pixui.png +0 -0
- package/lib/assets/preact.js +4354 -0
- package/lib/assets/preact.png +0 -0
- package/lib/check/main.less +63 -0
- package/lib/check/main.tsx +41 -0
- package/lib/check/tool.js +3 -0
- package/lib/check/util.tsx +110 -0
- package/lib/grpc-web/dist/ChunkParser.js +117 -0
- package/lib/grpc-web/dist/ChunkParser.js.map +1 -0
- package/lib/grpc-web/dist/Code.js +58 -0
- package/lib/grpc-web/dist/Code.js.map +1 -0
- package/lib/grpc-web/dist/client.js +299 -0
- package/lib/grpc-web/dist/client.js.map +1 -0
- package/lib/grpc-web/dist/debug.js +16 -0
- package/lib/grpc-web/dist/debug.js.map +1 -0
- package/lib/grpc-web/dist/detach.js +7 -0
- package/lib/grpc-web/dist/detach.js.map +1 -0
- package/lib/grpc-web/dist/index.js +29 -0
- package/lib/grpc-web/dist/index.js.map +1 -0
- package/lib/grpc-web/dist/invoke.js +32 -0
- package/lib/grpc-web/dist/invoke.js.map +1 -0
- package/lib/grpc-web/dist/message.js +3 -0
- package/lib/grpc-web/dist/message.js.map +1 -0
- package/lib/grpc-web/dist/metadata.js +5 -0
- package/lib/grpc-web/dist/metadata.js.map +1 -0
- package/lib/grpc-web/dist/service.js +3 -0
- package/lib/grpc-web/dist/service.js.map +1 -0
- package/lib/grpc-web/dist/transports/Transport.js +15 -0
- package/lib/grpc-web/dist/transports/Transport.js.map +1 -0
- package/lib/grpc-web/dist/transports/http/fetch.js +117 -0
- package/lib/grpc-web/dist/transports/http/fetch.js.map +1 -0
- package/lib/grpc-web/dist/transports/http/http.js +15 -0
- package/lib/grpc-web/dist/transports/http/http.js.map +1 -0
- package/lib/grpc-web/dist/transports/http/xhr.js +136 -0
- package/lib/grpc-web/dist/transports/http/xhr.js.map +1 -0
- package/lib/grpc-web/dist/transports/http/xhrUtil.js +36 -0
- package/lib/grpc-web/dist/transports/http/xhrUtil.js.map +1 -0
- package/lib/grpc-web/dist/transports/websocket/websocket.js +95 -0
- package/lib/grpc-web/dist/transports/websocket/websocket.js.map +1 -0
- package/lib/grpc-web/dist/typings/ChunkParser.d.ts +17 -0
- package/lib/grpc-web/dist/typings/Code.d.ts +20 -0
- package/lib/grpc-web/dist/typings/client.d.ts +25 -0
- package/lib/grpc-web/dist/typings/debug.d.ts +1 -0
- package/lib/grpc-web/dist/typings/detach.d.ts +1 -0
- package/lib/grpc-web/dist/typings/index.d.ts +45 -0
- package/lib/grpc-web/dist/typings/invoke.d.ts +20 -0
- package/lib/grpc-web/dist/typings/message.d.ts +8 -0
- package/lib/grpc-web/dist/typings/metadata.d.ts +2 -0
- package/lib/grpc-web/dist/typings/service.d.ts +16 -0
- package/lib/grpc-web/dist/typings/transports/Transport.d.ts +22 -0
- package/lib/grpc-web/dist/typings/transports/http/fetch.d.ts +6 -0
- package/lib/grpc-web/dist/typings/transports/http/http.d.ts +5 -0
- package/lib/grpc-web/dist/typings/transports/http/xhr.d.ts +27 -0
- package/lib/grpc-web/dist/typings/transports/http/xhrUtil.d.ts +3 -0
- package/lib/grpc-web/dist/typings/transports/websocket/websocket.d.ts +2 -0
- package/lib/grpc-web/dist/typings/unary.d.ts +23 -0
- package/lib/grpc-web/dist/typings/util.d.ts +2 -0
- package/lib/grpc-web/dist/unary.js +44 -0
- package/lib/grpc-web/dist/unary.js.map +1 -0
- package/lib/grpc-web/dist/util.js +11 -0
- package/lib/grpc-web/dist/util.js.map +1 -0
- package/lib/grpcTransport/PixHttp2Transport.ts +107 -0
- package/lib/grpcTransport/PixLuaTransport.ts +82 -0
- package/lib/h5es-types/v1.9.2/h5es.d.ts +1698 -0
- package/lib/h5es-types/v3.5.0/h5es.d.ts +1788 -0
- package/lib/pi_component/tinyList/tinyList.js +483 -0
- package/lib/pi_component/tinyList/tinyList.tsx +517 -0
- package/lib/pika-svelte/compiler.js +29829 -0
- package/lib/pika-svelte/easing/index.js +158 -0
- package/lib/pika-svelte/index.js +72 -0
- package/lib/pika-svelte/internal/index.js +1926 -0
- package/lib/pika-svelte/motion/index.js +210 -0
- package/lib/pika-svelte/package.json +145 -0
- package/lib/pika-svelte/register.js +57 -0
- package/lib/pika-svelte/rollup.config.js +126 -0
- package/lib/pika-svelte/store/index.js +123 -0
- package/lib/pika-svelte/transition/index.js +185 -0
- package/lib/preact-router.js +395 -0
- package/lib/preact.js +4355 -0
- package/lib/preact.tq.js +4385 -0
- package/lib/react-window/src/FixedSizeGrid.js +172 -0
- package/lib/react-window/src/FixedSizeList.js +91 -0
- package/lib/react-window/src/VariableSizeGrid.js +329 -0
- package/lib/react-window/src/VariableSizeList.js +231 -0
- package/lib/react-window/src/__tests__/FixedSizeGrid.js +942 -0
- package/lib/react-window/src/__tests__/FixedSizeList.js +749 -0
- package/lib/react-window/src/__tests__/VariableSizeGrid.js +598 -0
- package/lib/react-window/src/__tests__/VariableSizeList.js +345 -0
- package/lib/react-window/src/__tests__/__snapshots__/FixedSizeGrid.js.snap +912 -0
- package/lib/react-window/src/__tests__/__snapshots__/FixedSizeList.js.snap +568 -0
- package/lib/react-window/src/__tests__/__snapshots__/VariableSizeGrid.js.snap +542 -0
- package/lib/react-window/src/__tests__/__snapshots__/VariableSizeList.js.snap +331 -0
- package/lib/react-window/src/__tests__/areEqual.js +28 -0
- package/lib/react-window/src/__tests__/shouldComponentUpdate.js +32 -0
- package/lib/react-window/src/areEqual.js +13 -0
- package/lib/react-window/src/createGridComponent.js +657 -0
- package/lib/react-window/src/createListComponent.js +574 -0
- package/lib/react-window/src/domHelpers.js +69 -0
- package/lib/react-window/src/index.js +9 -0
- package/lib/react-window/src/shallowDiffers.js +17 -0
- package/lib/react-window/src/shouldComponentUpdate.js +11 -0
- package/lib/react-window/src/test.js.flow +382 -0
- package/lib/react-window/src/timer.js +36 -0
- package/lib/svelte-tab/Tab.svelte +31 -0
- package/lib/svelte-tab/TabList.svelte +10 -0
- package/lib/svelte-tab/TabPanel.svelte +13 -0
- package/lib/svelte-tab/Tabs.svelte +68 -0
- package/lib/svelte-tab/tabs.js +4 -0
- package/lib/types/css.d.ts +7476 -0
- package/lib/types/dom.ts +17 -0
- package/lib/types/ext.d.ts +81 -0
- package/lib/types/internal.d.ts +94 -0
- package/lib/types/jsx.d.ts +309 -0
- package/lib/types/preact.d.ts +340 -0
- package/package.json +111 -0
- package/tsconfig.json +30 -0
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import {
|
|
5
|
+
FixedSizeList,
|
|
6
|
+
VariableSizeList,
|
|
7
|
+
FixedSizeGrid,
|
|
8
|
+
VariableSizeGrid,
|
|
9
|
+
} from './';
|
|
10
|
+
|
|
11
|
+
type ItemData = {|
|
|
12
|
+
num: number,
|
|
13
|
+
str: string,
|
|
14
|
+
|};
|
|
15
|
+
|
|
16
|
+
const assertVoid = (value: void) => {};
|
|
17
|
+
const assertEmpty = (value: empty) => {};
|
|
18
|
+
const assertNumber = (value: number) => {};
|
|
19
|
+
const assertString = (value: string) => {};
|
|
20
|
+
const assertCustomType = (value: ItemData) => {};
|
|
21
|
+
|
|
22
|
+
/* FixedSizeList */
|
|
23
|
+
|
|
24
|
+
{
|
|
25
|
+
const Item = ({ index, style }) => {
|
|
26
|
+
(index: number);
|
|
27
|
+
(style: Object);
|
|
28
|
+
return null;
|
|
29
|
+
};
|
|
30
|
+
<FixedSizeList width={0} height={0} itemSize={0} itemCount={0}>
|
|
31
|
+
{Item}
|
|
32
|
+
</FixedSizeList>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
{
|
|
36
|
+
const Item = ({ data }) => {
|
|
37
|
+
assertNumber(data);
|
|
38
|
+
// $FlowFixMe number is passed to FixedSizeList
|
|
39
|
+
assertString(data);
|
|
40
|
+
return null;
|
|
41
|
+
};
|
|
42
|
+
const itemKey = (index, data) => {
|
|
43
|
+
assertNumber(data);
|
|
44
|
+
// $FlowFixMe expected
|
|
45
|
+
assertString(data);
|
|
46
|
+
return index;
|
|
47
|
+
};
|
|
48
|
+
<FixedSizeList width={0} height={0} itemSize={0} itemCount={0} itemData={1} itemKey={itemKey}>
|
|
49
|
+
{Item}
|
|
50
|
+
</FixedSizeList>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
{
|
|
54
|
+
const Item = ({ data }) => {
|
|
55
|
+
assertCustomType(data);
|
|
56
|
+
// $FlowFixMe ItemData is passed to FixedSizeList
|
|
57
|
+
assertString(data);
|
|
58
|
+
return null;
|
|
59
|
+
};
|
|
60
|
+
const itemKey = (index, data) => {
|
|
61
|
+
assertCustomType(data);
|
|
62
|
+
// $FlowFixMe expected
|
|
63
|
+
assertString(data);
|
|
64
|
+
return index;
|
|
65
|
+
};
|
|
66
|
+
<FixedSizeList
|
|
67
|
+
width={0}
|
|
68
|
+
height={0}
|
|
69
|
+
itemSize={0}
|
|
70
|
+
itemCount={0}
|
|
71
|
+
itemData={{
|
|
72
|
+
num: 123,
|
|
73
|
+
str: 'abc',
|
|
74
|
+
}}
|
|
75
|
+
itemKey={itemKey}
|
|
76
|
+
>
|
|
77
|
+
{Item}
|
|
78
|
+
</FixedSizeList>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
{
|
|
82
|
+
const Item = ({ data }) => {
|
|
83
|
+
assertVoid(data);
|
|
84
|
+
// $FlowFixMe itemData is undefined by default
|
|
85
|
+
assertEmpty(data);
|
|
86
|
+
|
|
87
|
+
return null;
|
|
88
|
+
};
|
|
89
|
+
const itemKey = (index, data) => {
|
|
90
|
+
assertVoid(data);
|
|
91
|
+
// $FlowFixMe expected
|
|
92
|
+
assertString(data);
|
|
93
|
+
return index;
|
|
94
|
+
};
|
|
95
|
+
<FixedSizeList width={0} height={0} itemSize={0} itemCount={0} itemKey={itemKey}>
|
|
96
|
+
{Item}
|
|
97
|
+
</FixedSizeList>;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* VariableSizeList */
|
|
101
|
+
|
|
102
|
+
{
|
|
103
|
+
const Item = ({ data }) => {
|
|
104
|
+
assertNumber(data);
|
|
105
|
+
// $FlowFixMe number is passed to VariableSizeList
|
|
106
|
+
assertString(data);
|
|
107
|
+
return null;
|
|
108
|
+
};
|
|
109
|
+
const itemKey = (index, data) => {
|
|
110
|
+
assertNumber(data);
|
|
111
|
+
// $FlowFixMe expected
|
|
112
|
+
assertString(data);
|
|
113
|
+
return index;
|
|
114
|
+
};
|
|
115
|
+
<VariableSizeList
|
|
116
|
+
width={0}
|
|
117
|
+
height={0}
|
|
118
|
+
itemSize={0}
|
|
119
|
+
itemCount={0}
|
|
120
|
+
itemData={1}
|
|
121
|
+
itemKey={itemKey}
|
|
122
|
+
>
|
|
123
|
+
{Item}
|
|
124
|
+
</VariableSizeList>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
{
|
|
128
|
+
const Item = ({ data }) => {
|
|
129
|
+
assertCustomType(data);
|
|
130
|
+
// $FlowFixMe ItemData is passed to VariableSizeList
|
|
131
|
+
assertString(data);
|
|
132
|
+
return null;
|
|
133
|
+
};
|
|
134
|
+
const itemKey = (index, data) => {
|
|
135
|
+
assertCustomType(data);
|
|
136
|
+
// $FlowFixMe expected
|
|
137
|
+
assertString(data);
|
|
138
|
+
return index;
|
|
139
|
+
};
|
|
140
|
+
<VariableSizeList
|
|
141
|
+
width={0}
|
|
142
|
+
height={0}
|
|
143
|
+
itemSize={0}
|
|
144
|
+
itemCount={0}
|
|
145
|
+
itemData={{
|
|
146
|
+
num: 123,
|
|
147
|
+
str: 'abc',
|
|
148
|
+
}}
|
|
149
|
+
itemKey={itemKey}
|
|
150
|
+
>
|
|
151
|
+
{Item}
|
|
152
|
+
</VariableSizeList>;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
{
|
|
156
|
+
const Item = ({ data }) => {
|
|
157
|
+
assertVoid(data);
|
|
158
|
+
// $FlowFixMe itemData is undefined by default
|
|
159
|
+
assertEmpty(data);
|
|
160
|
+
return null;
|
|
161
|
+
};
|
|
162
|
+
const itemKey = (index, data) => {
|
|
163
|
+
assertVoid(data);
|
|
164
|
+
// $FlowFixMe expected
|
|
165
|
+
assertString(data);
|
|
166
|
+
return index;
|
|
167
|
+
};
|
|
168
|
+
<VariableSizeList width={0} height={0} itemSize={0} itemCount={0} itemKey={itemKey}>
|
|
169
|
+
{Item}
|
|
170
|
+
</VariableSizeList>;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
{
|
|
174
|
+
class Item extends React.PureComponent<{ data: void }> {
|
|
175
|
+
render() {
|
|
176
|
+
const { data } = this.props;
|
|
177
|
+
assertVoid(data);
|
|
178
|
+
// $FlowFixMe itemData is undefined by default
|
|
179
|
+
assertEmpty(data);
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
const itemKey = (index, data) => {
|
|
184
|
+
assertVoid(data);
|
|
185
|
+
// $FlowFixMe expected
|
|
186
|
+
assertString(data);
|
|
187
|
+
return index;
|
|
188
|
+
};
|
|
189
|
+
<VariableSizeList width={0} height={0} itemSize={0} itemCount={0} itemKey={itemKey}>
|
|
190
|
+
{Item}
|
|
191
|
+
</VariableSizeList>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* FixedSizeGrid */
|
|
195
|
+
|
|
196
|
+
{
|
|
197
|
+
const Item = ({ columnIndex, rowIndex, style }) => {
|
|
198
|
+
(columnIndex: number);
|
|
199
|
+
(rowIndex: number);
|
|
200
|
+
(style: Object);
|
|
201
|
+
return null;
|
|
202
|
+
};
|
|
203
|
+
<FixedSizeGrid
|
|
204
|
+
width={0}
|
|
205
|
+
height={0}
|
|
206
|
+
rowHeight={0}
|
|
207
|
+
rowCount={0}
|
|
208
|
+
columnWidth={0}
|
|
209
|
+
columnCount={0}
|
|
210
|
+
>
|
|
211
|
+
{Item}
|
|
212
|
+
</FixedSizeGrid>;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
{
|
|
216
|
+
const Item = ({ data }) => {
|
|
217
|
+
assertNumber(data);
|
|
218
|
+
// $FlowFixMe number is passed to FixedSizeGrid
|
|
219
|
+
assertString(data);
|
|
220
|
+
return null;
|
|
221
|
+
};
|
|
222
|
+
const itemKey = ({ columnIndex, data, rowIndex }) => {
|
|
223
|
+
assertNumber(data);
|
|
224
|
+
// $FlowFixMe expected
|
|
225
|
+
assertString(data);
|
|
226
|
+
return `${columnIndex}:${rowIndex}`;
|
|
227
|
+
};
|
|
228
|
+
<FixedSizeGrid
|
|
229
|
+
width={0}
|
|
230
|
+
height={0}
|
|
231
|
+
rowHeight={0}
|
|
232
|
+
rowCount={0}
|
|
233
|
+
columnWidth={0}
|
|
234
|
+
columnCount={0}
|
|
235
|
+
itemData={1}
|
|
236
|
+
itemKey={itemKey}
|
|
237
|
+
>
|
|
238
|
+
{Item}
|
|
239
|
+
</FixedSizeGrid>;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
{
|
|
243
|
+
const Item = ({ data }) => {
|
|
244
|
+
assertCustomType(data);
|
|
245
|
+
// $FlowFixMe ItemData is passed to FixedSizeGrid
|
|
246
|
+
assertString(data);
|
|
247
|
+
return null;
|
|
248
|
+
};
|
|
249
|
+
const itemKey = ({ columnIndex, data, rowIndex }) => {
|
|
250
|
+
assertCustomType(data);
|
|
251
|
+
// $FlowFixMe expected
|
|
252
|
+
assertString(data);
|
|
253
|
+
return `${columnIndex}:${rowIndex}`;
|
|
254
|
+
};
|
|
255
|
+
<FixedSizeGrid
|
|
256
|
+
width={0}
|
|
257
|
+
height={0}
|
|
258
|
+
rowHeight={0}
|
|
259
|
+
rowCount={0}
|
|
260
|
+
columnWidth={0}
|
|
261
|
+
columnCount={0}
|
|
262
|
+
itemData={{
|
|
263
|
+
num: 123,
|
|
264
|
+
str: 'abc',
|
|
265
|
+
}}
|
|
266
|
+
itemKey={itemKey}
|
|
267
|
+
>
|
|
268
|
+
{Item}
|
|
269
|
+
</FixedSizeGrid>;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
{
|
|
273
|
+
const Item = ({ data }) => {
|
|
274
|
+
assertVoid(data);
|
|
275
|
+
// $FlowFixMe itemData is undefined by default
|
|
276
|
+
assertEmpty(data);
|
|
277
|
+
return null;
|
|
278
|
+
};
|
|
279
|
+
const itemKey = ({ columnIndex, data, rowIndex }) => {
|
|
280
|
+
assertVoid(data);
|
|
281
|
+
// $FlowFixMe expected
|
|
282
|
+
assertString(data);
|
|
283
|
+
return `${columnIndex}:${rowIndex}`;
|
|
284
|
+
};
|
|
285
|
+
<FixedSizeGrid
|
|
286
|
+
width={0}
|
|
287
|
+
height={0}
|
|
288
|
+
rowHeight={0}
|
|
289
|
+
rowCount={0}
|
|
290
|
+
columnWidth={0}
|
|
291
|
+
columnCount={0}
|
|
292
|
+
itemKey={itemKey}
|
|
293
|
+
>
|
|
294
|
+
{Item}
|
|
295
|
+
</FixedSizeGrid>;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/* VariableSizeGrid */
|
|
299
|
+
|
|
300
|
+
{
|
|
301
|
+
const Item = ({ data }) => {
|
|
302
|
+
assertNumber(data);
|
|
303
|
+
// $FlowFixMe number is passed to VariableSizeGrid
|
|
304
|
+
assertString(data);
|
|
305
|
+
return null;
|
|
306
|
+
};
|
|
307
|
+
<VariableSizeGrid
|
|
308
|
+
width={0}
|
|
309
|
+
height={0}
|
|
310
|
+
rowHeight={0}
|
|
311
|
+
rowCount={0}
|
|
312
|
+
columnWidth={0}
|
|
313
|
+
columnCount={0}
|
|
314
|
+
itemData={1}
|
|
315
|
+
>
|
|
316
|
+
{Item}
|
|
317
|
+
</VariableSizeGrid>;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
{
|
|
321
|
+
const Item = ({ data }) => {
|
|
322
|
+
assertCustomType(data);
|
|
323
|
+
// $FlowFixMe ItemData is passed to VariableSizeGrid
|
|
324
|
+
assertString(data);
|
|
325
|
+
return null;
|
|
326
|
+
};
|
|
327
|
+
<VariableSizeGrid
|
|
328
|
+
width={0}
|
|
329
|
+
height={0}
|
|
330
|
+
rowHeight={0}
|
|
331
|
+
rowCount={0}
|
|
332
|
+
columnWidth={0}
|
|
333
|
+
columnCount={0}
|
|
334
|
+
itemData={{
|
|
335
|
+
num: 123,
|
|
336
|
+
str: 'abc',
|
|
337
|
+
}}
|
|
338
|
+
>
|
|
339
|
+
{Item}
|
|
340
|
+
</VariableSizeGrid>;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
{
|
|
344
|
+
const Item = ({ data }) => {
|
|
345
|
+
assertVoid(data);
|
|
346
|
+
// $FlowFixMe itemData is undefined by default
|
|
347
|
+
assertEmpty(data);
|
|
348
|
+
return null;
|
|
349
|
+
};
|
|
350
|
+
<VariableSizeGrid
|
|
351
|
+
width={0}
|
|
352
|
+
height={0}
|
|
353
|
+
rowHeight={0}
|
|
354
|
+
rowCount={0}
|
|
355
|
+
columnWidth={0}
|
|
356
|
+
columnCount={0}
|
|
357
|
+
>
|
|
358
|
+
{Item}
|
|
359
|
+
</VariableSizeGrid>;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
{
|
|
363
|
+
class Item extends React.PureComponent<{ data: void }> {
|
|
364
|
+
render() {
|
|
365
|
+
const { data } = this.props;
|
|
366
|
+
assertVoid(data);
|
|
367
|
+
// $FlowFixMe itemData is undefined by default
|
|
368
|
+
assertEmpty(data);
|
|
369
|
+
return null;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
<VariableSizeGrid
|
|
373
|
+
width={0}
|
|
374
|
+
height={0}
|
|
375
|
+
rowHeight={0}
|
|
376
|
+
rowCount={0}
|
|
377
|
+
columnWidth={0}
|
|
378
|
+
columnCount={0}
|
|
379
|
+
>
|
|
380
|
+
{Item}
|
|
381
|
+
</VariableSizeGrid>;
|
|
382
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
// Animation frame based implementation of setTimeout.
|
|
4
|
+
// Inspired by Joe Lambert, https://gist.github.com/joelambert/1002116#file-requesttimeout-js
|
|
5
|
+
|
|
6
|
+
const hasNativePerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
|
|
7
|
+
|
|
8
|
+
const now = hasNativePerformanceNow ? () => performance.now() : () => Date.now();
|
|
9
|
+
|
|
10
|
+
export type TimeoutID = {|
|
|
11
|
+
id: AnimationFrameID,
|
|
12
|
+
|};
|
|
13
|
+
|
|
14
|
+
export function cancelTimeout(timeoutID: TimeoutID) {
|
|
15
|
+
cancelAnimationFrame(timeoutID.id);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function requestTimeout(callback: Function, delay: number): TimeoutID {
|
|
19
|
+
const start = now();
|
|
20
|
+
|
|
21
|
+
function tick() {
|
|
22
|
+
let n = now();
|
|
23
|
+
// console.log('requestTimeout', n, start, n - start, delay);
|
|
24
|
+
if (n - start >= delay) {
|
|
25
|
+
callback.call(null);
|
|
26
|
+
} else {
|
|
27
|
+
timeoutID.id = requestAnimationFrame(tick);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const timeoutID: TimeoutID = {
|
|
32
|
+
id: requestAnimationFrame(tick),
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return timeoutID;
|
|
36
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { getContext } from 'svelte';
|
|
3
|
+
import { TABS } from './Tabs.svelte';
|
|
4
|
+
|
|
5
|
+
const tab = {};
|
|
6
|
+
const { registerTab, selectTab, selectedTab } = getContext(TABS);
|
|
7
|
+
|
|
8
|
+
registerTab(tab);
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<style>
|
|
12
|
+
button {
|
|
13
|
+
background: none;
|
|
14
|
+
border: none;
|
|
15
|
+
border-bottom: 2px solid white;
|
|
16
|
+
border-radius: 0;
|
|
17
|
+
margin: 5px;
|
|
18
|
+
color: #ccc;
|
|
19
|
+
font-size: 25px;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.selected {
|
|
24
|
+
/* border-bottom: 2px solid teal; */
|
|
25
|
+
color: #333;
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
28
|
+
|
|
29
|
+
<button class:selected="{$selectedTab === tab}" on:click="{() => selectTab(tab)}">
|
|
30
|
+
<slot></slot>
|
|
31
|
+
</button>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { getContext } from 'svelte';
|
|
3
|
+
import { TABS } from './Tabs.svelte';
|
|
4
|
+
|
|
5
|
+
const panel = {};
|
|
6
|
+
const { registerPanel, selectedPanel } = getContext(TABS);
|
|
7
|
+
|
|
8
|
+
registerPanel(panel);
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
{#if $selectedPanel === panel}
|
|
12
|
+
<slot></slot>
|
|
13
|
+
{/if}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script context="module">
|
|
2
|
+
export const TABS = {};
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
import { setContext, onDestroy } from "svelte";
|
|
7
|
+
import { writable } from "svelte/store";
|
|
8
|
+
|
|
9
|
+
const tabs = [];
|
|
10
|
+
const panels = [];
|
|
11
|
+
const selectedTab = writable(null);
|
|
12
|
+
const selectedPanel = writable(null);
|
|
13
|
+
|
|
14
|
+
export let onChange = undefined;
|
|
15
|
+
export let selectedIndex = writable(null);
|
|
16
|
+
|
|
17
|
+
setContext(TABS, {
|
|
18
|
+
registerTab: (tab) => {
|
|
19
|
+
tabs.push(tab);
|
|
20
|
+
selectedTab.update((current) => current || tab);
|
|
21
|
+
|
|
22
|
+
onDestroy(() => {
|
|
23
|
+
const i = tabs.indexOf(tab);
|
|
24
|
+
tabs.splice(i, 1);
|
|
25
|
+
selectedTab.update((current) =>
|
|
26
|
+
current === tab ? tabs[i] || tabs[tabs.length - 1] : current
|
|
27
|
+
);
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
registerPanel: (panel) => {
|
|
32
|
+
panels.push(panel);
|
|
33
|
+
selectedPanel.update((current) => current || panel);
|
|
34
|
+
|
|
35
|
+
onDestroy(() => {
|
|
36
|
+
const i = panels.indexOf(panel);
|
|
37
|
+
panels.splice(i, 1);
|
|
38
|
+
selectedPanel.update((current) =>
|
|
39
|
+
current === panel
|
|
40
|
+
? panels[i] || panels[panels.length - 1]
|
|
41
|
+
: current
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
selectTab: (tab) => {
|
|
47
|
+
const i = tabs.indexOf(tab);
|
|
48
|
+
selectedTab.set(tab);
|
|
49
|
+
selectedPanel.set(panels[i]);
|
|
50
|
+
selectedIndex.set(i);
|
|
51
|
+
if (onChange) onChange(i);
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
selectedTab,
|
|
55
|
+
selectedPanel,
|
|
56
|
+
});
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<div class="tabs">
|
|
60
|
+
<slot />
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<style>
|
|
64
|
+
.tabs {
|
|
65
|
+
align-self: stretch;
|
|
66
|
+
/* border: 1px solid black; */
|
|
67
|
+
}
|
|
68
|
+
</style>
|