@witchcraft/ui 0.3.11 → 0.3.13

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.
Files changed (32) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/assets/utils.css +1 -1
  3. package/dist/runtime/components/LibColorInput/LibColorInput.d.vue.ts +2 -2
  4. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +2 -2
  5. package/dist/runtime/components/LibColorPicker/LibColorPicker.d.vue.ts +3 -3
  6. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +3 -3
  7. package/dist/runtime/components/LibFileInput/LibFileInput.d.vue.ts +5 -3
  8. package/dist/runtime/components/LibFileInput/LibFileInput.vue +141 -84
  9. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +5 -3
  10. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.d.vue.ts +3 -3
  11. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +3 -3
  12. package/dist/runtime/components/LibNotifications/LibNotification.vue +16 -1
  13. package/dist/runtime/components/LibNotifications/LibNotificationTestMessageComponent.d.vue.ts +6 -0
  14. package/dist/runtime/components/LibNotifications/LibNotificationTestMessageComponent.vue +29 -0
  15. package/dist/runtime/components/LibNotifications/LibNotificationTestMessageComponent.vue.d.ts +6 -0
  16. package/dist/runtime/components/LibPopup/LibPopup.d.vue.ts +1 -1
  17. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +1 -1
  18. package/dist/runtime/helpers/NotificationHandler.d.ts +5 -2
  19. package/dist/runtime/helpers/NotificationHandler.js +2 -1
  20. package/dist/runtime/types/index.d.ts +4 -0
  21. package/dist/runtime/utils/notifyIfError.d.ts +3 -1
  22. package/dist/runtime/utils/notifyIfError.js +4 -2
  23. package/package.json +2 -2
  24. package/src/runtime/assets/utils.css +4 -4
  25. package/src/runtime/components/LibFileInput/LibFileInput.stories.ts +13 -3
  26. package/src/runtime/components/LibFileInput/LibFileInput.vue +154 -92
  27. package/src/runtime/components/LibNotifications/LibNotification.stories.ts +22 -1
  28. package/src/runtime/components/LibNotifications/LibNotification.vue +16 -1
  29. package/src/runtime/components/LibNotifications/LibNotificationTestMessageComponent.vue +27 -0
  30. package/src/runtime/helpers/NotificationHandler.ts +6 -2
  31. package/src/runtime/types/index.ts +5 -0
  32. package/src/runtime/utils/notifyIfError.ts +6 -2
@@ -1,6 +1,7 @@
1
1
  import { TypedError } from "@alanscodelog/utils/TypedError"
2
2
 
3
3
  import { useNotificationHandler } from "../composables/useNotificationHandler.js"
4
+ import type { NotificationEntry } from "../helpers/NotificationHandler.js"
4
5
 
5
6
  /**
6
7
  * Notifies the user if the given value is an error. Useful for making non-critical errors don't go unnoticed.
@@ -13,13 +14,15 @@ export function notifyIfError<T>(
13
14
  err: T, {
14
15
  logger,
15
16
  ns,
16
- force = false
17
+ force = false,
18
+ entry
17
19
  }: {
18
20
  logger?: { debug: (...args: any[]) => void }
19
21
  /* Logger namespace. */
20
22
  ns?: string
21
23
  /* force interpret as error, for catch blocks */
22
24
  force?: boolean
25
+ entry?: Partial<NotificationEntry<any>>
23
26
  } = {}): T {
24
27
  if (force || err instanceof Error) {
25
28
  const errMessage = {
@@ -38,7 +41,8 @@ export function notifyIfError<T>(
38
41
  ...errMessage,
39
42
  options: ["Ok"],
40
43
  cancellable: "Ok",
41
- timeout: true
44
+ timeout: true,
45
+ ...entry
42
46
  })
43
47
  }
44
48
  return err