@byloth/vuert
Version:
The headless alerts, modals, notifications & popups library for Vue.js craftsmen. ℹ
1 lines • 27.8 kB
Source Map (JSON)
{"version":3,"file":"vuert.cjs","names":[],"sources":["../src/core.ts","../src/exceptions.ts","../src/vuert.ts","../src/functions.ts","../src/models/action.ts","../src/models/alert.ts","../src/models/context.ts","../src/components/AlertHandler.vue","../src/components/AlertHandler.vue","../src/index.ts"],"sourcesContent":["import type { InjectionKey } from \"vue\";\n\nimport type Vuert from \"./vuert.js\";\n\nexport const InjectionKeys = { $vuert: Symbol(\"[vuert]: vuert\") as InjectionKey<Vuert> };\n","import { RuntimeException } from \"@byloth/core\";\n\nimport type { AlertOptions } from \"./types/alert/index.js\";\n\nexport class AlertThrottledException<R = void, P extends Record<string, unknown> = never> extends RuntimeException\n{\n public readonly alert: AlertOptions<R, P>;\n\n public constructor(\n alert: AlertOptions<R, P>,\n message?: string,\n cause?: unknown,\n name = \"AlertThrottledException\"\n )\n {\n if (message === undefined)\n {\n message = \"The alert has been throttled to prevent spamming the user with too many alerts.\";\n }\n\n super(message, cause, name);\n\n this.alert = alert;\n }\n}\n","import { RuntimeException } from \"@byloth/core\";\n\nimport { AlertThrottledException } from \"./exceptions.js\";\nimport type { Context } from \"./models/index.js\";\n\nimport type { Duration } from \"./types/index.js\";\nimport type { AlertOptions } from \"./types/alert/index.js\";\nimport type { BlockingAlert, DismissibleAlert } from \"./types/alert/simple.js\";\nimport type { BlockingCustomAlert, DismissibleCustomAlert } from \"./types/alert/custom.js\";\n\nexport interface VuertOptions\n{\n useThrottling: boolean;\n throttlingDuration: number;\n transitionDuration: number | Duration;\n}\nexport type VuertSubscriber<R = void, P extends Record<string, unknown> = never> =\n (alert: AlertOptions<R, P>) => Context<R, P> | void;\n\nexport default class Vuert\n{\n public static readonly VERSION: string = \"1.4.5\";\n\n public static get DEFAULT_OPTS(): VuertOptions\n {\n return {\n useThrottling: true,\n throttlingDuration: 100,\n transitionDuration: 200\n };\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n protected _subscribers: VuertSubscriber<any, any>[];\n protected _throttlers: Map<symbol, number>;\n\n protected _options: VuertOptions;\n public get options(): VuertOptions\n {\n return { ...this._options };\n }\n\n protected _throttle: <R, P extends Record<string, unknown>>(alert: AlertOptions<R, P>) => boolean;\n\n public constructor(options?: Partial<VuertOptions>)\n {\n this._subscribers = [];\n this._throttlers = new Map();\n\n this._options = { ...Vuert.DEFAULT_OPTS, ...options };\n\n if (this._options.useThrottling)\n {\n this._throttle = <R, P extends Record<string, unknown>>(alert: AlertOptions<R, P>): boolean =>\n {\n if (!(alert.id)) { return false; }\n\n const now = Date.now();\n const last = this._throttlers.get(alert.id) ?? 0;\n\n if ((now - last) > this._options.throttlingDuration)\n {\n this._throttlers.set(alert.id, now);\n\n return false;\n }\n\n return true;\n };\n }\n else\n {\n this._throttle = () => false;\n }\n }\n\n public emit<R = void, P extends Record<string, unknown> = never>(\n alert: BlockingAlert<R, P>\n ): Context<R, P>;\n public emit<R = void, P extends Record<string, unknown> = never>(\n alert: DismissibleAlert<R, P>\n ): Context<R | void, P>;\n public emit<R = void, P extends Record<string, unknown> = never>(\n alert: BlockingCustomAlert<R, P>\n ): Context<R, P>;\n public emit<R = void, P extends Record<string, unknown> = never>(\n alert: DismissibleCustomAlert<R, P>\n ): Context<R | void, P>;\n public emit<R = void, P extends Record<string, unknown> = never>(\n alert: AlertOptions<R, P>\n ): Context<R | void, P>;\n public emit<R = void, P extends Record<string, unknown> = never>(\n alert: AlertOptions<R, P>\n ): Context<R | void, P>\n {\n if (this._throttle(alert)) { throw new AlertThrottledException(alert); }\n\n const subscribers = this._subscribers.slice();\n const contexts = subscribers.map((subscriber) => subscriber(alert));\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const results = contexts.filter((context) => !!(context)) as Context<any, any>[];\n\n if (!(results.length))\n {\n throw new RuntimeException(\n \"Unable to handle the emitted alert properly. \" +\n \"There wasn't found any supported subscribers.\"\n );\n }\n if (results.length > 1)\n {\n throw new RuntimeException(\n \"Unable to handle the emitted alert properly. \" +\n \"There were found too many supported subscribers.\"\n );\n }\n\n return results[0];\n }\n\n public subscribe<R = void, P extends Record<string, unknown> = never>(\n subscriber: VuertSubscriber<R, P>\n ): () => VuertSubscriber<R, P>\n {\n this._subscribers.push(subscriber);\n\n return (): VuertSubscriber<R, P> =>\n {\n const index = this._subscribers.indexOf(subscriber);\n\n return this._subscribers.splice(index, 1)[0];\n };\n }\n}\n","import { inject, getCurrentScope, markRaw } from \"vue\";\nimport type { App, ObjectPlugin } from \"vue\";\n\nimport { RuntimeException } from \"@byloth/core\";\n\nimport { InjectionKeys } from \"./core.js\";\n\nimport Vuert from \"./vuert.js\";\nimport type { VuertOptions } from \"./vuert.js\";\n\nlet _activeVuert: Vuert | undefined = undefined;\n\nconst _setActiveVuert = (vuert: Vuert): void => { _activeVuert = vuert; };\nconst _getActiveVuert = (): Vuert | undefined =>\n{\n if (getCurrentScope())\n {\n return inject(InjectionKeys.$vuert);\n }\n\n return _activeVuert;\n};\n\nexport type PluginOptions = Partial<VuertOptions>;\nexport const createVuert = (options?: PluginOptions): ObjectPlugin<[]> => markRaw({\n install: ({ config, provide }: App): void =>\n {\n const $vuert = new Vuert(options);\n\n _setActiveVuert($vuert);\n\n config.globalProperties.$vuert = $vuert;\n provide(InjectionKeys.$vuert, $vuert);\n }\n});\nexport const useVuert = (): Vuert =>\n{\n const $vuert = _getActiveVuert();\n if (!($vuert))\n {\n throw new RuntimeException(\n \"`useVuert()` was called but there was not active Vuert. \" +\n \"Did you forget to install `Vuert` plugin in your App?\"\n );\n }\n\n return $vuert;\n};\n","import type { IAction, ActionCallback, ActionOptions } from \"../types/action/index.js\";\n\nexport default class Action<R = void> implements IAction<R>\n{\n public readonly id: symbol;\n public readonly type: \"primary\" | \"secondary\" | \"alternative\";\n\n public readonly icon?: string | undefined;\n public readonly label: string;\n\n public readonly callback: ActionCallback<R | undefined>;\n\n public constructor(options: ActionOptions<R>)\n {\n this.id = options.id ?? Symbol();\n this.type = options.type ?? \"secondary\";\n\n this.icon = options.icon;\n this.label = options.label;\n\n this.callback = options.callback ?? (() => options.value);\n }\n}\n","import { ValueException } from \"@byloth/core\";\n\nimport type { IAlert, AlertOptions } from \"../types/alert/index.js\";\n\nimport Action from \"./action.js\";\n\nexport default class Alert<R = void, P extends Record<string, unknown> = never> implements IAlert<R, P>\n{\n public readonly id: symbol;\n\n public readonly type: \"info\" | \"success\" | \"warning\" | \"error\" | \"question\";\n public readonly priority: \"high\" | \"normal\" | \"low\";\n\n public readonly icon?: string;\n public readonly title?: string;\n public readonly subtitle?: string;\n\n public readonly message?: string;\n public readonly payload?: P;\n\n public readonly actions: Action<R>[];\n\n public readonly dismissible: boolean;\n public readonly timeout: number;\n\n public constructor(options: AlertOptions<R, P>)\n {\n this.id = options.id ?? Symbol();\n\n this.type = options.type ?? \"info\";\n this.priority = options.priority ?? \"normal\";\n\n this.icon = options.icon;\n this.title = options.title;\n this.subtitle = options.subtitle;\n\n if ((options.message !== undefined) && (options.component !== undefined))\n {\n throw new ValueException(\n \"The `message` and `component` properties\" +\n \" cannot both be valued at the same time.\"\n );\n }\n\n this.message = options.message;\n this.payload = options.payload;\n\n this.actions = options.actions?.map((a) => new Action(a)) ?? [];\n\n this.dismissible = (options.dismissible || false);\n\n if (options.timeout !== undefined)\n {\n if (options.timeout <= 0)\n {\n throw new ValueException(\n \"The `timeout` property must be a positive\" +\n \" integer or -at least- `undefined`.\"\n );\n }\n\n this.timeout = options.timeout;\n }\n else\n {\n this.timeout = 0;\n }\n }\n}\n","import { computed, ref } from \"vue\";\nimport type { Component, ComputedRef, Ref } from \"vue\";\n\nimport { delay, DeferredPromise, Publisher } from \"@byloth/core\";\nimport type { MaybePromise, Timeout } from \"@byloth/core\";\n\nimport type { Duration } from \"../types/index.js\";\nimport type { ActionCallback } from \"../types/action/index.js\";\nimport type { AlertOptions } from \"../types/alert/index.js\";\n\nimport Action from \"./action.js\";\nimport Alert from \"./alert.js\";\n\nexport type ContextResult<R> = Action<R> | ActionCallback<R | undefined> | MaybePromise<R | undefined>;\n\ninterface ContextEventMap\n{\n opening: () => void;\n opened: () => void;\n closing: () => void;\n closed: () => void;\n}\n\nexport default class Context<T = void, P extends Record<string, unknown> = never> extends DeferredPromise<T>\n{\n protected _duration: Duration;\n protected _timeoutId?: Timeout;\n\n protected _publisher: Publisher<ContextEventMap>;\n\n protected readonly _isOpen: Ref<boolean>;\n\n public readonly alert: Alert<T, P>;\n public readonly isOpen: ComputedRef<boolean>;\n public readonly component?: Component;\n\n public constructor(options: AlertOptions<T, P>, duration: number | Duration)\n {\n const _close = async (): Promise<void> =>\n {\n if (!(this._isOpen.value))\n {\n throw new Error(\"Unable to close the alert. It has already been closed or not even opened yet.\");\n }\n\n this._isOpen.value = false;\n\n if (this._timeoutId !== undefined)\n {\n clearTimeout(this._timeoutId);\n\n this._timeoutId = undefined;\n }\n\n this._publisher.publish(\"closing\");\n await delay(this._duration.leave);\n this._publisher.publish(\"closed\");\n };\n\n const _onFulfilled = (result?: MaybePromise<ContextResult<T>>): T =>\n {\n _close();\n\n if (result instanceof Action)\n {\n return result.callback() as T;\n }\n else if (result instanceof Function)\n {\n return result() as T;\n }\n else\n {\n return result as T;\n }\n };\n const _onRejected = (reason: unknown): never =>\n {\n _close();\n\n throw reason;\n };\n\n super(_onFulfilled, _onRejected);\n\n if (typeof duration === \"object\")\n {\n this._duration = {\n enter: Number(duration.enter),\n leave: Number(duration.leave)\n };\n }\n else\n {\n const _duration = Number(duration);\n this._duration = {\n enter: _duration,\n leave: _duration\n };\n }\n\n this._publisher = new Publisher();\n this.alert = new Alert(options);\n\n this._isOpen = ref(false);\n this.isOpen = computed((): boolean => this._isOpen.value);\n\n this.component = options.component;\n }\n\n public async open(): Promise<void>\n {\n if (this._isOpen.value)\n {\n throw new Error(\"Unable to open the alert. It has already been opened.\");\n }\n\n this._isOpen.value = true;\n\n this._publisher.publish(\"opening\");\n await delay(this._duration.enter);\n this._publisher.publish(\"opened\");\n\n if (this.alert.timeout)\n {\n this._timeoutId = setTimeout(this.resolve, this.alert.timeout);\n }\n }\n\n public onOpening(subscriber: () => void): void\n {\n this._publisher.subscribe(\"opening\", subscriber);\n }\n public onOpened(subscriber: () => void): void\n {\n this._publisher.subscribe(\"opened\", subscriber);\n }\n public onClosing(subscriber: () => void): void\n {\n this._publisher.subscribe(\"closing\", subscriber);\n }\n public onClosed(subscriber: () => void): void\n {\n this._publisher.subscribe(\"closed\", subscriber);\n }\n}\n","<script lang=\"ts\" setup>\n import { nextTick, onBeforeUnmount, onMounted, ref, shallowRef } from \"vue\";\n import type { Component, PropType } from \"vue\";\n\n import type { MaybePromise } from \"@byloth/core\";\n\n import { useVuert } from \"../functions.js\";\n import { Alert, Context } from \"../models/index.js\";\n\n import type { Duration } from \"../types/index.js\";\n import type { AlertOptions } from \"../types/alert/index.js\";\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n type AnyContext = Context<any, any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n type AnyContextResolver = (result?: MaybePromise<any>) => void;\n\n const props = defineProps({\n is: {\n default: \"div\",\n type: [String, Object] as PropType<string | Component>\n },\n filter: {\n default: () => true,\n type: Function as PropType<(options: AlertOptions<unknown, Record<string, unknown>>) => boolean>\n },\n transitionDuration: {\n default: () => useVuert().options.transitionDuration,\n type: [Number, Object] as PropType<number | Duration>,\n\n validator: (value: unknown): boolean =>\n {\n if (value instanceof Object)\n {\n if ((\"enter\" in value) && (\"leave\" in value))\n {\n return isFinite(Number(value[\"enter\"])) && isFinite(Number(value[\"leave\"]));\n }\n\n return false;\n }\n\n return isFinite(Number(value));\n }\n }\n });\n\n const emit = defineEmits({\n opening: <R, P extends Record<string, unknown>>(alert: Alert<R, P>) => (alert instanceof Alert),\n opened: <R, P extends Record<string, unknown>>(alert: Alert<R, P>) => (alert instanceof Alert),\n closing: <R, P extends Record<string, unknown>>(alert: Alert<R, P>) => (alert instanceof Alert),\n closed: <R, P extends Record<string, unknown>>(alert: Alert<R, P>) => (alert instanceof Alert)\n });\n\n const contexts: AnyContext[] = [];\n\n const queue = ref<number>(0);\n const context = shallowRef<AnyContext>();\n\n const open = async (): Promise<void> =>\n {\n const ctx = contexts[0];\n\n ctx.onOpening(() => emit(\"opening\", ctx.alert));\n ctx.onOpened(() => emit(\"opened\", ctx.alert));\n ctx.onClosing(() => emit(\"closing\", ctx.alert));\n ctx.onClosed(async () =>\n {\n emit(\"closed\", ctx.alert);\n\n contexts.shift();\n context.value = undefined;\n\n queue.value -= 1;\n\n await nextTick();\n\n if (contexts.length > 0) { open(); }\n });\n\n context.value = ctx;\n\n await ctx.open();\n };\n\n const register = <R, P extends Record<string, unknown>>(options: AlertOptions<R, P>): Context<R, P> =>\n {\n const ctx = new Context<R, P>(options, props.transitionDuration);\n\n contexts.push(ctx);\n if (contexts.length === 1) { open(); }\n\n queue.value += 1;\n\n return ctx;\n };\n\n let _unsubscribe: () => void;\n onMounted(() =>\n {\n _unsubscribe = useVuert()\n .subscribe((options) =>\n {\n if (props.filter(options)) { return register(options); }\n\n return;\n });\n });\n onBeforeUnmount(() => _unsubscribe());\n</script>\n\n<template>\n <Component :is=\"is\">\n <slot v-if=\"context\"\n :alert=\"context.alert\"\n :custom-component=\"context.component\"\n :is-open=\"context.isOpen.value\"\n :queue=\"queue\"\n :resolve=\"context.resolve as AnyContextResolver\"\n :reject=\"context.reject\"></slot>\n </Component>\n</template>\n","<script lang=\"ts\" setup>\n import { nextTick, onBeforeUnmount, onMounted, ref, shallowRef } from \"vue\";\n import type { Component, PropType } from \"vue\";\n\n import type { MaybePromise } from \"@byloth/core\";\n\n import { useVuert } from \"../functions.js\";\n import { Alert, Context } from \"../models/index.js\";\n\n import type { Duration } from \"../types/index.js\";\n import type { AlertOptions } from \"../types/alert/index.js\";\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n type AnyContext = Context<any, any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n type AnyContextResolver = (result?: MaybePromise<any>) => void;\n\n const props = defineProps({\n is: {\n default: \"div\",\n type: [String, Object] as PropType<string | Component>\n },\n filter: {\n default: () => true,\n type: Function as PropType<(options: AlertOptions<unknown, Record<string, unknown>>) => boolean>\n },\n transitionDuration: {\n default: () => useVuert().options.transitionDuration,\n type: [Number, Object] as PropType<number | Duration>,\n\n validator: (value: unknown): boolean =>\n {\n if (value instanceof Object)\n {\n if ((\"enter\" in value) && (\"leave\" in value))\n {\n return isFinite(Number(value[\"enter\"])) && isFinite(Number(value[\"leave\"]));\n }\n\n return false;\n }\n\n return isFinite(Number(value));\n }\n }\n });\n\n const emit = defineEmits({\n opening: <R, P extends Record<string, unknown>>(alert: Alert<R, P>) => (alert instanceof Alert),\n opened: <R, P extends Record<string, unknown>>(alert: Alert<R, P>) => (alert instanceof Alert),\n closing: <R, P extends Record<string, unknown>>(alert: Alert<R, P>) => (alert instanceof Alert),\n closed: <R, P extends Record<string, unknown>>(alert: Alert<R, P>) => (alert instanceof Alert)\n });\n\n const contexts: AnyContext[] = [];\n\n const queue = ref<number>(0);\n const context = shallowRef<AnyContext>();\n\n const open = async (): Promise<void> =>\n {\n const ctx = contexts[0];\n\n ctx.onOpening(() => emit(\"opening\", ctx.alert));\n ctx.onOpened(() => emit(\"opened\", ctx.alert));\n ctx.onClosing(() => emit(\"closing\", ctx.alert));\n ctx.onClosed(async () =>\n {\n emit(\"closed\", ctx.alert);\n\n contexts.shift();\n context.value = undefined;\n\n queue.value -= 1;\n\n await nextTick();\n\n if (contexts.length > 0) { open(); }\n });\n\n context.value = ctx;\n\n await ctx.open();\n };\n\n const register = <R, P extends Record<string, unknown>>(options: AlertOptions<R, P>): Context<R, P> =>\n {\n const ctx = new Context<R, P>(options, props.transitionDuration);\n\n contexts.push(ctx);\n if (contexts.length === 1) { open(); }\n\n queue.value += 1;\n\n return ctx;\n };\n\n let _unsubscribe: () => void;\n onMounted(() =>\n {\n _unsubscribe = useVuert()\n .subscribe((options) =>\n {\n if (props.filter(options)) { return register(options); }\n\n return;\n });\n });\n onBeforeUnmount(() => _unsubscribe());\n</script>\n\n<template>\n <Component :is=\"is\">\n <slot v-if=\"context\"\n :alert=\"context.alert\"\n :custom-component=\"context.component\"\n :is-open=\"context.isOpen.value\"\n :queue=\"queue\"\n :resolve=\"context.resolve as AnyContextResolver\"\n :reject=\"context.reject\"></slot>\n </Component>\n</template>\n","export { default as AlertHandler } from \"./components/AlertHandler.vue\";\nimport Vuert from \"./vuert.js\";\n\nexport { createVuert, useVuert } from \"./functions.js\";\nexport { AlertThrottledException } from \"./exceptions.js\";\nexport { Action, Alert, Context } from \"./models/index.js\";\n\nexport type { VuertOptions, VuertSubscriber } from \"./vuert.js\";\n\nexport type { IAction, ActionCallback, ActionOptions } from \"./types/action/index.js\";\nexport type { CallbackAction } from \"./types/action/callback.js\";\nexport type { ValueAction } from \"./types/action/value.js\";\n\nexport type { IAlert, AlertOptions } from \"./types/alert/index.js\";\nexport type { AlertCustomOptions } from \"./custom.js\";\nexport type { SimpleAlert, BlockingAlert, DismissibleAlert } from \"./types/alert/simple.js\";\nexport type { CustomAlert, BlockingCustomAlert, DismissibleCustomAlert } from \"./types/alert/custom.js\";\nexport type { PluginOptions } from \"./functions.js\";\n\nexport default Vuert;\n\ndeclare module \"@vue/runtime-core\"\n{\n interface ComponentCustomProperties\n {\n $vuert: Vuert;\n }\n}\n"],"mappings":"8IAIA,IAAa,EAAgB,CAAE,OAAQ,OAAO,gBAAgB,CAAyB,ECA1E,EAAb,cAAkG,EAAA,gBAClG,CACI,MAEA,YACI,EACA,EACA,EACA,EAAO,0BAEX,CACQ,IAAY,IAAA,KAEZ,EAAU,mFAGd,MAAM,EAAS,EAAO,CAAI,EAE1B,KAAK,MAAQ,CACjB,CACJ,ECLqB,EAArB,MAAqB,CACrB,CACI,OAAuB,QAAkB,QAEzC,WAAkB,cAClB,CACI,MAAO,CACH,cAAe,GACf,mBAAoB,IACpB,mBAAoB,GACxB,CACJ,CAGA,aACA,YAEA,SACA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