svelte-common 6.10.2 → 6.10.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-common",
3
- "version": "6.10.2",
3
+ "version": "6.10.4",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -34,45 +34,46 @@
34
34
  "scripts": {
35
35
  "prepare": "npm run prepare:vite && npm run prepare:typescript",
36
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",
37
+ "prepare:typescript": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types --resolveJsonModule -t esnext -m esnext --module nodenext --moduleResolution nodenext --rootDir src ./src**/*.mjs",
38
38
  "start": "vite",
39
39
  "test": "npm run test:ava && npm run test:cafe",
40
40
  "test:cafe": "testcafe $BROWSER:headless tests/cafe/*-cafe.mjs -s build/test --page-request-timeout 5000 --app-init-delay 8000 --app vite",
41
41
  "test:ava": "ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
42
42
  "cover": "c8 -x 'tests/**/*' --temp-directory build/tmp ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs && c8 report -r lcov -o build/coverage --temp-directory build/tmp",
43
43
  "docs": "documentation readme --section=API ./src/**/*.mjs",
44
- "lint": "npm run lint:css && npm run lint:docs",
44
+ "lint": "npm run lint:css && npm run lint:docs && npm run lint:typescript",
45
45
  "lint:docs": "documentation lint ./src/**/*.mjs",
46
46
  "lint:css": "stylelint ./src/*.css",
47
+ "lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs",
47
48
  "preview": "vite preview"
48
49
  },
49
50
  "dependencies": {
50
- "pacc": "^3.1.5",
51
+ "pacc": "^3.1.6",
51
52
  "svelte-command": "^1.1.50",
52
- "svelte-entitlement": "^1.2.72"
53
+ "svelte-entitlement": "^1.2.76"
53
54
  },
54
55
  "devDependencies": {
55
- "@semantic-release/commit-analyzer": "^11.1.0",
56
+ "@semantic-release/commit-analyzer": "^12.0.0",
56
57
  "@semantic-release/exec": "^6.0.3",
57
- "@semantic-release/release-notes-generator": "^12.1.0",
58
- "@sveltejs/vite-plugin-svelte": "^3.0.2",
58
+ "@semantic-release/release-notes-generator": "^13.0.0",
59
+ "@sveltejs/vite-plugin-svelte": "^3.1.0",
59
60
  "ava": "^6.1.2",
60
61
  "c8": "^9.1.0",
61
62
  "documentation": "^14.0.3",
62
- "mf-styling": "^3.1.5",
63
- "npm-pkgbuild": "^13.4.0",
64
- "semantic-release": "^23.0.2",
65
- "stylelint": "^16.2.1",
63
+ "mf-styling": "^3.1.6",
64
+ "npm-pkgbuild": "^15.3.0",
65
+ "semantic-release": "^23.0.8",
66
+ "stylelint": "^16.3.1",
66
67
  "stylelint-config-standard": "^36.0.0",
67
- "svelte": "^4.2.12",
68
+ "svelte": "^4.2.15",
68
69
  "testcafe": "^3.5.0",
69
- "typescript": "^5.3.3",
70
- "vite": "^5.1.5",
71
- "vite-plugin-compression2": "^1.0.0"
70
+ "typescript": "^5.4.5",
71
+ "vite": "^5.2.9",
72
+ "vite-plugin-compression2": "^1.1.0"
72
73
  },
73
74
  "optionalDependencies": {
74
75
  "mf-hosting-cloudflare": "^1.0.6",
75
- "mf-hosting-frontend": "^2.2.6"
76
+ "mf-hosting-frontend": "^3.0.3"
76
77
  },
77
78
  "repository": {
78
79
  "type": "git",
@@ -100,7 +101,7 @@
100
101
  [
101
102
  "@semantic-release/exec",
102
103
  {
103
- "publishCmd": "npx npm-pkgbuild --available --continue --publish dist"
104
+ "publishCmd": "npx npm-pkgbuild --publish dist"
104
105
  }
105
106
  ],
106
107
  [
@@ -1,9 +1,12 @@
1
+ import { readable } from "svelte/store";
2
+
1
3
  /**
2
4
  * Pagination support store.
3
5
  * Pages go from 1 ... numberOfPages
4
- * @param {Map|Set|Array|Store} data
6
+ * @param {Map|Set|Array|readable} data
5
7
  * @param {Object} options
6
8
  * @param {number} [options.itemsPerPage]
9
+ * @param {number} [options.page]
7
10
  * @param {Function} [options.sorter]
8
11
  * @param {Function} [options.filter]
9
12
  */
@@ -164,8 +167,8 @@ export class Pagination {
164
167
  }
165
168
 
166
169
  /**
167
- * @see @link https://getbootstrap.com/docs/4.0/components/pagination
168
- * @see @link https://a11y-style-guide.com/style-guide/section-navigation.html#kssref-navigation-pagination
170
+ * @see https://getbootstrap.com/docs/4.0/components/pagination
171
+ * @see https://a11y-style-guide.com/style-guide/section-navigation.html#kssref-navigation-pagination
169
172
  */
170
173
  get pageNavigationElement() {
171
174
  const nav = document.createElement("nav");
package/src/sorting.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import { getAttribute } from "pacc";
2
+ import { writable } from "svelte/store";
2
3
 
3
4
  export const SORT_NONE = "none";
4
5
  export const SORT_ASCENDING = "ascending";
@@ -27,7 +28,7 @@ export function toggleOrderBy(orderBy) {
27
28
  * Add sortable toggle button to a th node.
28
29
  * Synchronizes store value with the nodes "aria-sort" attribute.
29
30
  * @param {Element} th the header node
30
- * @param {WritableStore} store keep in sync with sorting properties
31
+ * @param {writable} store keep in sync with sorting properties
31
32
  */
32
33
  export function sortable(th, store) {
33
34
  const unsubscribe = store.subscribe(orderBy =>
package/src/util.mjs CHANGED
@@ -1,3 +1,5 @@
1
+ import { writable } from "svelte/store";
2
+
1
3
  export const dateFormatter = new Intl.DateTimeFormat("default", {
2
4
  year: "numeric",
3
5
  month: "numeric",
@@ -39,10 +41,10 @@ export function formatDurationISO(seconds) {
39
41
  t = true;
40
42
  }
41
43
 
42
- const n = Math.floor(seconds / d[0]);
44
+ const n = Math.floor(seconds / Number(d[0]));
43
45
  if (n > 0) {
44
46
  out += `${n}${d[1]}`;
45
- seconds -= n * d[0];
47
+ seconds -= n * Number(d[0]);
46
48
  }
47
49
  }
48
50
 
@@ -60,10 +62,10 @@ const durations = [
60
62
  export function formatDuration(seconds) {
61
63
  const out = [];
62
64
  for (const d of durations) {
63
- const n = Math.floor(seconds / d[0]);
65
+ const n = Math.floor(seconds / Number(d[0]));
64
66
  if (n > 0) {
65
67
  out.push(`${n}${d[1]}`);
66
- seconds -= n * d[0];
68
+ seconds -= n * Number(d[0]);
67
69
  }
68
70
  }
69
71
 
@@ -100,9 +102,9 @@ function liveDuration(seconds) {
100
102
  * ```
101
103
  * { a: 1, b: 2 } -> { foo_a: 1 foo_b: 2 } // prefix: foo_
102
104
  * ```
103
- * @param {WriteableStore} store we derive from
105
+ * @param {writable} store we derive from
104
106
  * @param {string} prefix for each key
105
- * @returns {WriteableStore}
107
+ * @returns {writable}
106
108
  */
107
109
  export function keyPrefixStore(store, prefix) {
108
110
  const subscriptions = new Set();
@@ -10,9 +10,10 @@ export function navigationItems(numberOfPages: number, currentPage: number, numb
10
10
  /**
11
11
  * Pagination support store.
12
12
  * Pages go from 1 ... numberOfPages
13
- * @param {Map|Set|Array|Store} data
13
+ * @param {Map|Set|Array|readable} data
14
14
  * @param {Object} options
15
15
  * @param {number} [options.itemsPerPage]
16
+ * @param {number} [options.page]
16
17
  * @param {Function} [options.sorter]
17
18
  * @param {Function} [options.filter]
18
19
  */
@@ -56,8 +57,8 @@ export class Pagination {
56
57
  */
57
58
  get length(): number;
58
59
  /**
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
60
+ * @see https://getbootstrap.com/docs/4.0/components/pagination
61
+ * @see https://a11y-style-guide.com/style-guide/section-navigation.html#kssref-navigation-pagination
61
62
  */
62
63
  get pageNavigationElement(): HTMLElement;
63
64
  [Symbol.iterator](): Generator<any, void, any>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="svelte" />
1
2
  /**
2
3
  * Deliver next value in the order by cycle.
3
4
  * SORT_NONE -> SORT_ASCENDING -> SORT_DESCENDING -> SORT_NONE ...
@@ -9,9 +10,9 @@ export function toggleOrderBy(orderBy: string): string;
9
10
  * Add sortable toggle button to a th node.
10
11
  * Synchronizes store value with the nodes "aria-sort" attribute.
11
12
  * @param {Element} th the header node
12
- * @param {WritableStore} store keep in sync with sorting properties
13
+ * @param {writable} store keep in sync with sorting properties
13
14
  */
14
- export function sortable(th: Element, store: WritableStore): {
15
+ export function sortable(th: Element, store: typeof writable): {
15
16
  destroy(): void;
16
17
  };
17
18
  /**
@@ -30,3 +31,4 @@ export namespace orderByCycle {
30
31
  export { SORT_DESCENDING as ascending };
31
32
  export { SORT_ASCENDING as descending };
32
33
  }
34
+ import { writable } from "svelte/store";
package/types/util.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="svelte" />
1
2
  export function formatBytes(bytes: any, decimals?: number): string;
2
3
  export function formatDurationISO(seconds: any): string;
3
4
  export function formatDuration(seconds: any): string;
@@ -7,9 +8,10 @@ export function formatSecondsSinceEpoch(sse: any): string;
7
8
  * ```
8
9
  * { a: 1, b: 2 } -> { foo_a: 1 foo_b: 2 } // prefix: foo_
9
10
  * ```
10
- * @param {WriteableStore} store we derive from
11
+ * @param {writable} store we derive from
11
12
  * @param {string} prefix for each key
12
- * @returns {WriteableStore}
13
+ * @returns {writable}
13
14
  */
14
- export function keyPrefixStore(store: WriteableStore, prefix: string): WriteableStore;
15
+ export function keyPrefixStore(store: typeof writable, prefix: string): typeof writable;
15
16
  export const dateFormatter: Intl.DateTimeFormat;
17
+ import { writable } from "svelte/store";