@wow-two-beta/fe 0.0.44 → 0.0.46
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/foundation/collections/SlidingWindow.d.ts +28 -0
- package/dist/foundation/collections/SlidingWindow.js +22 -0
- package/dist/foundation/collections/SlidingWindow.js.map +1 -0
- package/dist/foundation/collections/index.d.ts +1 -0
- package/dist/foundation/collections/index.js +2 -0
- package/dist/foundation/collections/index.js.map +1 -1
- package/dist/index.js +557 -553
- package/dist/index.js.map +1 -1
- package/dist/presentation/display/dataTable/DataTable.vue.js.map +1 -1
- package/dist/presentation/display/dotsIndicator/DotsIndicator.vue.d.ts +14 -0
- package/dist/presentation/display/dotsIndicator/DotsIndicator.vue.js +63 -0
- package/dist/presentation/display/dotsIndicator/DotsIndicator.vue.js.map +1 -0
- package/dist/presentation/display/dotsIndicator/DotsIndicator2.vue.js +5 -0
- package/dist/presentation/display/dotsIndicator/DotsIndicator2.vue.js.map +1 -0
- package/dist/presentation/display/dotsIndicator/DotsIndicatorWindow.d.ts +16 -0
- package/dist/presentation/display/dotsIndicator/DotsIndicatorWindow.js +15 -0
- package/dist/presentation/display/dotsIndicator/DotsIndicatorWindow.js.map +1 -0
- package/dist/presentation/display/dotsIndicator/index.d.ts +2 -0
- package/dist/presentation/display/index.d.ts +1 -0
- package/dist/presentation/display/index.js +162 -158
- package/dist/presentation/display/index.js.map +1 -1
- package/dist/presentation/layout/appFrame/AppFrame.vue.d.ts +38 -2
- package/dist/presentation/layout/appFrame/AppFrame.vue.js +57 -19
- package/dist/presentation/layout/appFrame/AppFrame.vue.js.map +1 -1
- package/dist/presentation/layout/appShell/AppShell.vue.d.ts +3 -0
- package/dist/presentation/layout/appShell/AppShell.vue.js +3 -2
- package/dist/presentation/layout/appShell/AppShell.vue.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** A window over a series of items: which ones it covers, and where the current one sits among them. */
|
|
2
|
+
export interface SlidingWindow {
|
|
3
|
+
/** The index of the window's first item. */
|
|
4
|
+
readonly start: number;
|
|
5
|
+
/** How many items the window covers: the requested size, or the whole series when it is shorter. */
|
|
6
|
+
readonly size: number;
|
|
7
|
+
/** The current item's index, clamped into the series. */
|
|
8
|
+
readonly current: number;
|
|
9
|
+
/** Where the current item sits inside the window, counted from its first item. */
|
|
10
|
+
readonly offset: number;
|
|
11
|
+
/** Whether items of the series lie before the window. */
|
|
12
|
+
readonly hasBefore: boolean;
|
|
13
|
+
/** Whether items of the series lie after the window. */
|
|
14
|
+
readonly hasAfter: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Chooses the window of `size` items that follows the current item through a series of `count`. The window keeps the
|
|
18
|
+
* current item in its middle while it can; at either end of the series it stops moving and the current item drifts
|
|
19
|
+
* toward that edge. An even `size` puts the current item one place before the middle. A `size` larger than the series
|
|
20
|
+
* covers all of it. A pure function of three numbers: the same input always gives the same window, nothing is held
|
|
21
|
+
* between calls, and a non-finite or out-of-range input is clamped instead of thrown.
|
|
22
|
+
*
|
|
23
|
+
* With 10 items and the third current, a window of 3 covers items 2 to 4 with the current one in the middle, and a
|
|
24
|
+
* window of 5 covers items 1 to 5 with the current one in the middle; with the first current, the window covers the
|
|
25
|
+
* first items and the current one is its first. Dots, thumbnail strips, breadcrumbs and any "a few around here"
|
|
26
|
+
* display can draw the answer without redoing the edge cases.
|
|
27
|
+
*/
|
|
28
|
+
export declare function slidingWindowOf(count: number, index: number, size: number): SlidingWindow;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function wholeOf(value, fallback) {
|
|
2
|
+
return Number.isFinite(value) ? Math.floor(value) : fallback;
|
|
3
|
+
}
|
|
4
|
+
function slidingWindowOf(count, index, size) {
|
|
5
|
+
const total = Math.max(0, wholeOf(count, 0));
|
|
6
|
+
if (total === 0) return { start: 0, size: 0, current: 0, offset: 0, hasBefore: false, hasAfter: false };
|
|
7
|
+
const covered = Math.min(total, Math.max(1, wholeOf(size, 1)));
|
|
8
|
+
const current = Math.min(total - 1, Math.max(0, wholeOf(index, 0)));
|
|
9
|
+
const start = Math.min(total - covered, Math.max(0, current - Math.floor((covered - 1) / 2)));
|
|
10
|
+
return {
|
|
11
|
+
start,
|
|
12
|
+
size: covered,
|
|
13
|
+
current,
|
|
14
|
+
offset: current - start,
|
|
15
|
+
hasBefore: start > 0,
|
|
16
|
+
hasAfter: start + covered < total
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
slidingWindowOf
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=SlidingWindow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlidingWindow.js","sources":["../../../src/foundation/collections/SlidingWindow.ts"],"sourcesContent":["/** A window over a series of items: which ones it covers, and where the current one sits among them. */\nexport interface SlidingWindow {\n /** The index of the window's first item. */\n readonly start: number;\n\n /** How many items the window covers: the requested size, or the whole series when it is shorter. */\n readonly size: number;\n\n /** The current item's index, clamped into the series. */\n readonly current: number;\n\n /** Where the current item sits inside the window, counted from its first item. */\n readonly offset: number;\n\n /** Whether items of the series lie before the window. */\n readonly hasBefore: boolean;\n\n /** Whether items of the series lie after the window. */\n readonly hasAfter: boolean;\n}\n\n/** Reads a whole number, or the fallback when the value is not finite. */\nfunction wholeOf(value: number, fallback: number): number {\n return Number.isFinite(value) ? Math.floor(value) : fallback;\n}\n\n/**\n * Chooses the window of `size` items that follows the current item through a series of `count`. The window keeps the\n * current item in its middle while it can; at either end of the series it stops moving and the current item drifts\n * toward that edge. An even `size` puts the current item one place before the middle. A `size` larger than the series\n * covers all of it. A pure function of three numbers: the same input always gives the same window, nothing is held\n * between calls, and a non-finite or out-of-range input is clamped instead of thrown.\n *\n * With 10 items and the third current, a window of 3 covers items 2 to 4 with the current one in the middle, and a\n * window of 5 covers items 1 to 5 with the current one in the middle; with the first current, the window covers the\n * first items and the current one is its first. Dots, thumbnail strips, breadcrumbs and any \"a few around here\"\n * display can draw the answer without redoing the edge cases.\n */\nexport function slidingWindowOf(count: number, index: number, size: number): SlidingWindow {\n const total = Math.max(0, wholeOf(count, 0));\n if (total === 0) return { start: 0, size: 0, current: 0, offset: 0, hasBefore: false, hasAfter: false };\n const covered = Math.min(total, Math.max(1, wholeOf(size, 1)));\n const current = Math.min(total - 1, Math.max(0, wholeOf(index, 0)));\n const start = Math.min(total - covered, Math.max(0, current - Math.floor((covered - 1) / 2)));\n return {\n start,\n size: covered,\n current,\n offset: current - start,\n hasBefore: start > 0,\n hasAfter: start + covered < total,\n };\n}\n"],"names":[],"mappings":"AAsBA,SAAS,QAAQ,OAAe,UAA0B;AACxD,SAAO,OAAO,SAAS,KAAK,IAAI,KAAK,MAAM,KAAK,IAAI;AACtD;AAcO,SAAS,gBAAgB,OAAe,OAAe,MAA6B;AACzF,QAAM,QAAQ,KAAK,IAAI,GAAG,QAAQ,OAAO,CAAC,CAAC;AAC3C,MAAI,UAAU,EAAG,QAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,OAAO,UAAU,MAAA;AAChG,QAAM,UAAU,KAAK,IAAI,OAAO,KAAK,IAAI,GAAG,QAAQ,MAAM,CAAC,CAAC,CAAC;AAC7D,QAAM,UAAU,KAAK,IAAI,QAAQ,GAAG,KAAK,IAAI,GAAG,QAAQ,OAAO,CAAC,CAAC,CAAC;AAClE,QAAM,QAAQ,KAAK,IAAI,QAAQ,SAAS,KAAK,IAAI,GAAG,UAAU,KAAK,OAAO,UAAU,KAAK,CAAC,CAAC,CAAC;AAC5F,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA,QAAQ,UAAU;AAAA,IAClB,WAAW,QAAQ;AAAA,IACnB,UAAU,QAAQ,UAAU;AAAA,EAAA;AAEhC;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { chunk, groupBy, insertAt, move, partition, range, removeAt, replaceAt, toggleItem, unique, unzip, zip, } from './Arrays';
|
|
2
|
+
export { slidingWindowOf, type SlidingWindow } from './SlidingWindow';
|
|
2
3
|
export { difference, intersection, symmetricDifference, union } from './SetOps';
|
|
3
4
|
export { entriesToRecord, invertRecord, keyBy, mapValues, omitKeys, pickKeys, recordToEntries } from './Records';
|
|
4
5
|
export { arrayShallowEqual, deepEqual, shallowEqual } from './Comparison';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { chunk, groupBy, insertAt, move, partition, range, removeAt, replaceAt, toggleItem, unique, unzip, zip } from "./Arrays.js";
|
|
2
|
+
import { slidingWindowOf } from "./SlidingWindow.js";
|
|
2
3
|
import { difference, intersection, symmetricDifference, union } from "./SetOps.js";
|
|
3
4
|
import { entriesToRecord, invertRecord, keyBy, mapValues, omitKeys, pickKeys, recordToEntries } from "./Records.js";
|
|
4
5
|
import { arrayShallowEqual, deepEqual, shallowEqual } from "./Comparison.js";
|
|
@@ -30,6 +31,7 @@ export {
|
|
|
30
31
|
removeAt,
|
|
31
32
|
replaceAt,
|
|
32
33
|
shallowEqual,
|
|
34
|
+
slidingWindowOf,
|
|
33
35
|
symmetricDifference,
|
|
34
36
|
toggleItem,
|
|
35
37
|
union,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|