@knime/utils 1.11.0 → 1.11.2
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/CHANGELOG.md +12 -0
- package/README.md +67 -14
- package/dist/globals.d.ts +8 -0
- package/dist/index.js +714 -0
- package/dist/index.js.map +1 -0
- package/dist/src/capitalize.d.ts +20 -0
- package/dist/src/capitalize.d.ts.map +1 -0
- package/dist/src/dateMinMaxCheck.d.ts +19 -0
- package/dist/src/dateMinMaxCheck.d.ts.map +1 -0
- package/dist/src/debounce.d.ts +4 -0
- package/dist/src/debounce.d.ts.map +1 -0
- package/dist/src/fileExtensions.d.ts +33 -0
- package/dist/src/fileExtensions.d.ts.map +1 -0
- package/dist/src/filters.d.ts +13 -0
- package/dist/src/filters.d.ts.map +1 -0
- package/dist/src/format.d.ts +39 -0
- package/dist/src/format.d.ts.map +1 -0
- package/dist/src/formatHotkeys.d.ts +17 -0
- package/dist/src/formatHotkeys.d.ts.map +1 -0
- package/dist/src/getDeepActiveElement.d.ts +3 -0
- package/dist/src/getDeepActiveElement.d.ts.map +1 -0
- package/{src/getWrappedAroundIndex.ts → dist/src/getWrappedAroundIndex.d.ts} +3 -2
- package/dist/src/getWrappedAroundIndex.d.ts.map +1 -0
- package/{src/hotkeys.ts → dist/src/hotkeys.d.ts} +4 -17
- package/dist/src/hotkeys.d.ts.map +1 -0
- package/dist/src/index.d.ts +29 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/intervalUtils.d.ts +114 -0
- package/dist/src/intervalUtils.d.ts.map +1 -0
- package/{src/localTimezone.ts → dist/src/localTimezone.d.ts} +3 -2
- package/dist/src/localTimezone.d.ts.map +1 -0
- package/dist/src/navigator.d.ts +11 -0
- package/dist/src/navigator.d.ts.map +1 -0
- package/{src/numIntegerDigits.ts → dist/src/numIntegerDigits.d.ts} +3 -2
- package/dist/src/numIntegerDigits.d.ts.map +1 -0
- package/dist/src/promise/createAbortablePromise.d.ts +32 -0
- package/dist/src/promise/createAbortablePromise.d.ts.map +1 -0
- package/dist/src/promise/createUnwrappedPromise.d.ts +7 -0
- package/dist/src/promise/createUnwrappedPromise.d.ts.map +1 -0
- package/dist/src/promise/index.d.ts +4 -0
- package/dist/src/promise/index.d.ts.map +1 -0
- package/dist/src/promise/retryPromise.d.ts +16 -0
- package/dist/src/promise/retryPromise.d.ts.map +1 -0
- package/dist/src/sanitization.d.ts +8 -0
- package/dist/src/sanitization.d.ts.map +1 -0
- package/dist/src/sleep.d.ts +5 -0
- package/dist/src/sleep.d.ts.map +1 -0
- package/dist/src/truncateString.d.ts +3 -0
- package/dist/src/truncateString.d.ts.map +1 -0
- package/dist/src/updateDate.d.ts +11 -0
- package/dist/src/updateDate.d.ts.map +1 -0
- package/{src/updateTime.ts → dist/src/updateTime.d.ts} +3 -11
- package/dist/src/updateTime.d.ts.map +1 -0
- package/dist/test-utils/index.d.ts +3 -0
- package/dist/test-utils/index.d.ts.map +1 -0
- package/dist/test-utils/index.js +40 -0
- package/dist/test-utils/index.js.map +1 -0
- package/dist/test-utils/muteConsole.d.ts +8 -0
- package/dist/test-utils/muteConsole.d.ts.map +1 -0
- package/package.json +51 -33
- package/src/capitalize.ts +0 -45
- package/src/dateMinMaxCheck.ts +0 -68
- package/src/debounce.ts +0 -28
- package/src/fileExtensions.ts +0 -87
- package/src/filters.ts +0 -114
- package/src/format.ts +0 -113
- package/src/formatHotkeys.ts +0 -98
- package/src/getDeepActiveElement.ts +0 -9
- package/src/index.ts +0 -76
- package/src/intervalUtils.ts +0 -434
- package/src/navigator.ts +0 -13
- package/src/promise/createAbortablePromise.ts +0 -56
- package/src/promise/createUnwrappedPromise.ts +0 -17
- package/src/promise/index.ts +0 -3
- package/src/promise/retryPromise.ts +0 -45
- package/src/sanitization.ts +0 -72
- package/src/sleep.ts +0 -6
- package/src/truncateString.ts +0 -7
- package/src/updateDate.ts +0 -23
- package/src/uploadManager/index.ts +0 -370
- package/test-utils/index.ts +0 -3
- package/test-utils/muteConsole.ts +0 -54
- /package/{src/audit → audit}/README.md +0 -0
- /package/{src/audit → audit}/bulkAudit.js +0 -0
- /package/{src/audit → audit}/cli.js +0 -0
- /package/{src/config/globals.d.ts → globals.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @knime/utils
|
|
2
2
|
|
|
3
|
+
## 1.11.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6f1aed0: `@knime/utils`: migrated the package into the KNIME Design System monorepo. The package now builds to `dist` (compiled ESM + type declarations) like the other published packages.
|
|
8
|
+
|
|
9
|
+
## 1.11.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 7b602bf: update dompurify
|
|
14
|
+
|
|
3
15
|
## 1.11.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -1,29 +1,82 @@
|
|
|
1
|
-
#
|
|
1
|
+
# KNIME® Frontend – Utils
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package is maintained by the [UI Core Team](mailto:team-ui-core@knime.com).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
It contains framework-agnostic utility functions and constants shared across KNIME projects — date/time formatting, hotkey helpers, string and number utilities, HTML sanitization, file-size and file-extension helpers, promise helpers, and an upload manager. It has no Vue dependency and can be used from any TypeScript/JavaScript project.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
It's published as npm package: [@knime/utils]
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
## Why is this not a `@knime/kds-*` package?
|
|
10
|
+
|
|
11
|
+
`@knime/utils` predates the design system and is consumed beyond it. It keeps its original name and is **versioned independently** (currently `1.x`) — it is _not_ part of the `@knime/kds-*` Changesets group. It is also pure TypeScript (no Vue, no styles), so its build does not need the Vue/CSS toolchain the component packages use.
|
|
12
|
+
|
|
13
|
+
## Development
|
|
14
|
+
|
|
15
|
+
This package is part of the [KNIME Design System monorepo](../../README.md). For setup instructions, see the **[root README](../../README.md)**.
|
|
16
|
+
|
|
17
|
+
### Testing
|
|
18
|
+
|
|
19
|
+
Unit tests are based on [Vitest]. Run from the monorepo root:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
pnpm run test:unit # Run all unit tests (packages/*)
|
|
23
|
+
pnpm run coverage # Generate coverage reports
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Date/time tests assert against a fixed timezone (`Europe/Berlin`), configured in [`vite.config.ts`](vite.config.ts).
|
|
27
|
+
|
|
28
|
+
### Logging
|
|
29
|
+
|
|
30
|
+
You can log using the global `consola` variable (which the embedding application needs to provide).
|
|
31
|
+
|
|
32
|
+
See https://github.com/nuxt/consola for details.
|
|
33
|
+
|
|
34
|
+
## Building
|
|
35
|
+
|
|
36
|
+
To build the package as an ES library:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
pnpm run build # Build only this package
|
|
11
40
|
```
|
|
12
41
|
|
|
13
|
-
|
|
42
|
+
Results are saved to `dist/` (compiled ESM plus type declarations under `dist/src`).
|
|
43
|
+
|
|
44
|
+
## Using the utilities in an application
|
|
45
|
+
|
|
46
|
+
Install the [@knime/utils] npm package as a dependency:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
pnpm add @knime/utils
|
|
50
|
+
```
|
|
14
51
|
|
|
15
|
-
|
|
52
|
+
```ts
|
|
53
|
+
import { capitalize, formatFileSize, sleep } from "@knime/utils";
|
|
16
54
|
|
|
17
|
-
|
|
18
|
-
|
|
55
|
+
capitalize("hello"); // "Hello"
|
|
56
|
+
formatFileSize(1024); // "1 KiB"
|
|
57
|
+
await sleep(100);
|
|
19
58
|
```
|
|
20
59
|
|
|
60
|
+
### Subpath exports
|
|
61
|
+
|
|
62
|
+
| Entry | Description |
|
|
63
|
+
| --------------------------- | ---------------------------------------------------------------- |
|
|
64
|
+
| `@knime/utils` | The utility functions and constants |
|
|
65
|
+
| `@knime/utils/test-utils` | Test helpers (e.g. `muteConsole`) |
|
|
66
|
+
| `@knime/utils/globals.d.ts` | Ambient `consola` global declaration (reference from a `*.d.ts`) |
|
|
67
|
+
| `@knime/utils/audit` | Programmatic API for the bulk advisory audit |
|
|
68
|
+
|
|
69
|
+
### Requirements
|
|
70
|
+
|
|
71
|
+
The embedding app must provide:
|
|
72
|
+
|
|
73
|
+
- A `consola` instance compatible with the version defined in [`package.json`](package.json)
|
|
74
|
+
|
|
21
75
|
## Audit tool
|
|
22
76
|
|
|
23
77
|
This package also ships a CLI tool (`pnpm-bulk-audit`) that audits dependencies
|
|
24
78
|
using the npm bulk advisory API — a drop-in workaround while `pnpm audit` is
|
|
25
|
-
broken. See [
|
|
26
|
-
|
|
27
|
-
# Join the Community!
|
|
79
|
+
broken. See [audit/README.md](audit/README.md) for details.
|
|
28
80
|
|
|
29
|
-
|
|
81
|
+
[Vitest]: https://vitest.dev/
|
|
82
|
+
[@knime/utils]: https://www.npmjs.com/package/@knime/utils
|