svelte-common 6.9.9 → 6.10.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/package.json +15 -8
- package/src/module.mjs +5 -0
- package/types/filter.d.mts +6 -0
- package/types/module.d.mts +5 -0
- package/types/pagination.d.mts +65 -0
- package/types/service-worker.d.mts +7 -0
- package/types/sorting.d.mts +32 -0
- package/types/util.d.mts +15 -0
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-common",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.10.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
7
7
|
},
|
|
8
|
+
"types": "./types/module.d.mjs",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": {
|
|
11
|
+
"types": "./types/module.d.mjs",
|
|
12
|
+
"default": "./src/module.mjs",
|
|
10
13
|
"svelte": "./src/index.svelte"
|
|
11
14
|
},
|
|
12
15
|
"./css": "./src/common.css"
|
|
@@ -29,7 +32,9 @@
|
|
|
29
32
|
],
|
|
30
33
|
"license": "BSD-2-Clause",
|
|
31
34
|
"scripts": {
|
|
32
|
-
"prepare": "vite
|
|
35
|
+
"prepare": "npm run prepare:vite && npm run prepare:typescript",
|
|
36
|
+
"prepare:vite": "vite build",
|
|
37
|
+
"prepare:typescript": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types -t esnext -m esnext --module nodenext --moduleResolution nodenext --rootDir src ./src**/*.mjs",
|
|
33
38
|
"start": "vite",
|
|
34
39
|
"test": "npm run test:ava && npm run test:cafe",
|
|
35
40
|
"test:cafe": "testcafe $BROWSER:headless tests/cafe/*-cafe.mjs -s build/test --page-request-timeout 5000 --app-init-delay 8000 --app vite",
|
|
@@ -51,22 +56,23 @@
|
|
|
51
56
|
"@semantic-release/exec": "^6.0.3",
|
|
52
57
|
"@semantic-release/release-notes-generator": "^12.1.0",
|
|
53
58
|
"@sveltejs/vite-plugin-svelte": "^3.0.2",
|
|
54
|
-
"ava": "^6.1.
|
|
59
|
+
"ava": "^6.1.2",
|
|
55
60
|
"c8": "^9.1.0",
|
|
56
61
|
"documentation": "^14.0.3",
|
|
57
62
|
"mf-styling": "^3.1.5",
|
|
58
|
-
"npm-pkgbuild": "^13.
|
|
63
|
+
"npm-pkgbuild": "^13.3.1",
|
|
59
64
|
"semantic-release": "^23.0.2",
|
|
60
65
|
"stylelint": "^16.2.1",
|
|
61
66
|
"stylelint-config-standard": "^36.0.0",
|
|
62
67
|
"svelte": "^4.2.12",
|
|
63
68
|
"testcafe": "^3.5.0",
|
|
64
|
-
"
|
|
65
|
-
"vite
|
|
69
|
+
"typescript": "^5.3.3",
|
|
70
|
+
"vite": "^5.1.5",
|
|
71
|
+
"vite-plugin-compression2": "^1.0.0"
|
|
66
72
|
},
|
|
67
73
|
"optionalDependencies": {
|
|
68
74
|
"mf-hosting-cloudflare": "^1.0.6",
|
|
69
|
-
"mf-hosting-frontend": "^2.2.
|
|
75
|
+
"mf-hosting-frontend": "^2.2.6"
|
|
70
76
|
},
|
|
71
77
|
"repository": {
|
|
72
78
|
"type": "git",
|
|
@@ -141,7 +147,8 @@
|
|
|
141
147
|
"arlac77/template-cloudflare",
|
|
142
148
|
"arlac77/template-css",
|
|
143
149
|
"arlac77/template-npm-pkgbuild",
|
|
144
|
-
"arlac77/template-svelte-component"
|
|
150
|
+
"arlac77/template-svelte-component",
|
|
151
|
+
"arlac77/template-typescript"
|
|
145
152
|
]
|
|
146
153
|
}
|
|
147
154
|
}
|
package/src/module.mjs
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export function pageNavigation(elem: any, pg: any): void;
|
|
2
|
+
/**
|
|
3
|
+
* Generade actual sequence of page numbers to navigate to.
|
|
4
|
+
* @param {number} numberOfPages
|
|
5
|
+
* @param {number} currentPage
|
|
6
|
+
* @param {number} numberOfItems
|
|
7
|
+
* @return {Iterator<number>}
|
|
8
|
+
*/
|
|
9
|
+
export function navigationItems(numberOfPages: number, currentPage: number, numberOfItems?: number): Iterator<number>;
|
|
10
|
+
/**
|
|
11
|
+
* Pagination support store.
|
|
12
|
+
* Pages go from 1 ... numberOfPages
|
|
13
|
+
* @param {Map|Set|Array|Store} data
|
|
14
|
+
* @param {Object} options
|
|
15
|
+
* @param {number} [options.itemsPerPage]
|
|
16
|
+
* @param {Function} [options.sorter]
|
|
17
|
+
* @param {Function} [options.filter]
|
|
18
|
+
*/
|
|
19
|
+
export class Pagination {
|
|
20
|
+
constructor(data: any, options: any);
|
|
21
|
+
set data(data: any);
|
|
22
|
+
fireSubscriptions(): void;
|
|
23
|
+
set filter(filter: any);
|
|
24
|
+
get filter(): any;
|
|
25
|
+
set sorter(sorter: any);
|
|
26
|
+
get sorter(): any;
|
|
27
|
+
/**
|
|
28
|
+
* Enshure that current page lies inside 1 ... numberOfPages
|
|
29
|
+
*/
|
|
30
|
+
recalibrateCurrentPage(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Set current page
|
|
33
|
+
* @param {number} n
|
|
34
|
+
*/
|
|
35
|
+
set page(n: number);
|
|
36
|
+
/**
|
|
37
|
+
* @return {number} current page
|
|
38
|
+
*/
|
|
39
|
+
get page(): number;
|
|
40
|
+
set itemsPerPage(n: number);
|
|
41
|
+
get itemsPerPage(): number;
|
|
42
|
+
subscribe(s: any): () => boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Total number of items (filtered).
|
|
45
|
+
* @return {number}
|
|
46
|
+
*/
|
|
47
|
+
get numberOfItems(): number;
|
|
48
|
+
/**
|
|
49
|
+
* @return {number}
|
|
50
|
+
*/
|
|
51
|
+
get numberOfPages(): number;
|
|
52
|
+
/**
|
|
53
|
+
* Deliver items per page.
|
|
54
|
+
* @see {itemsPerPage}
|
|
55
|
+
* @return {number}
|
|
56
|
+
*/
|
|
57
|
+
get length(): number;
|
|
58
|
+
/**
|
|
59
|
+
* @see @link https://getbootstrap.com/docs/4.0/components/pagination
|
|
60
|
+
* @see @link https://a11y-style-guide.com/style-guide/section-navigation.html#kssref-navigation-pagination
|
|
61
|
+
*/
|
|
62
|
+
get pageNavigationElement(): HTMLElement;
|
|
63
|
+
[Symbol.iterator](): Generator<any, void, any>;
|
|
64
|
+
#private;
|
|
65
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a store holding a service worker
|
|
3
|
+
* @param {string} script The URL of the service worker script
|
|
4
|
+
* @param {Object} options An object containing registration options
|
|
5
|
+
* @return {Object} store holding the service worker
|
|
6
|
+
*/
|
|
7
|
+
export function initializeServiceWorker(script: string, options: any): any;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deliver next value in the order by cycle.
|
|
3
|
+
* SORT_NONE -> SORT_ASCENDING -> SORT_DESCENDING -> SORT_NONE ...
|
|
4
|
+
* @param {string} orderBy
|
|
5
|
+
* @returns {string} new order either SORT_NONE, SORT_ASCENDING or SORT_DESCENDING
|
|
6
|
+
*/
|
|
7
|
+
export function toggleOrderBy(orderBy: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Add sortable toggle button to a th node.
|
|
10
|
+
* Synchronizes store value with the nodes "aria-sort" attribute.
|
|
11
|
+
* @param {Element} th the header node
|
|
12
|
+
* @param {WritableStore} store keep in sync with sorting properties
|
|
13
|
+
*/
|
|
14
|
+
export function sortable(th: Element, store: WritableStore): {
|
|
15
|
+
destroy(): void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Generate a sort function for a given sort-by set.
|
|
19
|
+
* @param {Object|undefined} [sortBy]
|
|
20
|
+
* @param {Object} [getters]
|
|
21
|
+
* @return {Function|undefined} sorter
|
|
22
|
+
*/
|
|
23
|
+
export function sorter(sortBy?: any | undefined, getters?: any): Function | undefined;
|
|
24
|
+
export const SORT_NONE: "none";
|
|
25
|
+
export const SORT_ASCENDING: "ascending";
|
|
26
|
+
export const SORT_DESCENDING: "descending";
|
|
27
|
+
export const SORT_OTHER: "other";
|
|
28
|
+
export namespace orderByCycle {
|
|
29
|
+
export { SORT_ASCENDING as none };
|
|
30
|
+
export { SORT_DESCENDING as ascending };
|
|
31
|
+
export { SORT_ASCENDING as descending };
|
|
32
|
+
}
|
package/types/util.d.mts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function formatBytes(bytes: any, decimals?: number): string;
|
|
2
|
+
export function formatDurationISO(seconds: any): string;
|
|
3
|
+
export function formatDuration(seconds: any): string;
|
|
4
|
+
export function formatSecondsSinceEpoch(sse: any): string;
|
|
5
|
+
/**
|
|
6
|
+
* Create a derived store where all the object keys are prefixed.
|
|
7
|
+
* ```
|
|
8
|
+
* { a: 1, b: 2 } -> { foo_a: 1 foo_b: 2 } // prefix: foo_
|
|
9
|
+
* ```
|
|
10
|
+
* @param {WriteableStore} store we derive from
|
|
11
|
+
* @param {string} prefix for each key
|
|
12
|
+
* @returns {WriteableStore}
|
|
13
|
+
*/
|
|
14
|
+
export function keyPrefixStore(store: WriteableStore, prefix: string): WriteableStore;
|
|
15
|
+
export const dateFormatter: Intl.DateTimeFormat;
|