@svelte-put/async-stack
Advanced tools
Comparing version 1.0.0-next.4 to 1.0.0
{ | ||
"name": "@svelte-put/async-stack", | ||
"version": "1.0.0-next.4", | ||
"version": "1.0.0", | ||
"description": "type-safe and headless builder for async component stack", | ||
@@ -59,3 +59,3 @@ "type": "module", | ||
"peerDependencies": { | ||
"svelte": "^5.0.0-next.262" | ||
"svelte": "^5.1.0" | ||
}, | ||
@@ -62,0 +62,0 @@ "volta": { |
@@ -1,2 +0,2 @@ | ||
import { mount } from 'svelte'; | ||
import { mount, tick } from 'svelte'; | ||
@@ -46,3 +46,14 @@ import { MissingComponentInCustomPush, NotFoundVariantConfig } from './errors.js'; | ||
}); | ||
return {}; | ||
tick().then(() => { | ||
const detail = { item }; | ||
const event = new CustomEvent('stackitemmount', { detail }); | ||
node.dispatchEvent(event); | ||
}); | ||
return { | ||
destroy: () => { | ||
const detail = { item }; | ||
const event = new CustomEvent('stackitemunmount', { detail }); | ||
node.dispatchEvent(event); | ||
}, | ||
}; | ||
}, | ||
@@ -49,0 +60,0 @@ }; |
@@ -8,6 +8,3 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
export type StackItemCommonConfig< | ||
Variant extends string, | ||
UserComponent extends Component<any>, | ||
> = { | ||
export type StackItemCommonConfig<Variant extends string, UserComponent extends Component<any>> = { | ||
/** | ||
@@ -28,5 +25,3 @@ * milliseconds to wait and automatically pop the stack item. | ||
| 'uuid' | ||
| (( | ||
config: Required<Omit<StackItemInstanceConfig<Variant, UserComponent>, 'id'>>, | ||
) => string); | ||
| ((config: Required<Omit<StackItemInstanceConfig<Variant, UserComponent>, 'id'>>) => string); | ||
}; | ||
@@ -61,9 +56,10 @@ | ||
UserComponent extends Component<any>, | ||
> = StackItemCommonConfig< Variant, UserComponent> & { | ||
> = StackItemCommonConfig<Variant, UserComponent> & { | ||
props?: Omit<ComponentProps<UserComponent>, 'item'>; | ||
}; | ||
export type StackItemCustomPushConfig< | ||
UserComponent extends Component<any>, | ||
> = StackItemCommonConfig<'custom', UserComponent> & { | ||
export type StackItemCustomPushConfig<UserComponent extends Component<any>> = StackItemCommonConfig< | ||
'custom', | ||
UserComponent | ||
> & { | ||
component: UserComponent; | ||
@@ -73,5 +69,3 @@ props?: Omit<ComponentProps<UserComponent>, 'item'>; | ||
export type StackItemPopVerboseInput < | ||
UserComponent extends Component<any>, | ||
>= { | ||
export type StackItemPopVerboseInput<UserComponent extends Component<any>> = { | ||
id?: string; | ||
@@ -81,3 +75,9 @@ resolved?: ComponentResolved<UserComponent>; | ||
export type StackItemRenderActionReturn = ActionReturn<StackItem<any>>; | ||
export interface StackItemRenderActionAttributes { | ||
onstackitemmount?: (event: CustomEvent<{ item: StackItem<any> }>) => void; | ||
onstackitemunmount?: (event: CustomEvent<{ item: StackItem<any> }>) => void; | ||
} | ||
export type StackItemRenderActionReturn = ActionReturn< | ||
StackItem<any>, | ||
StackItemRenderActionAttributes | ||
>; |
@@ -80,6 +80,3 @@ declare module '@svelte-put/async-stack' { | ||
: any; | ||
type StackItemCommonConfig< | ||
Variant extends string, | ||
UserComponent extends Component<any>, | ||
> = { | ||
type StackItemCommonConfig<Variant extends string, UserComponent extends Component<any>> = { | ||
/** | ||
@@ -100,5 +97,3 @@ * milliseconds to wait and automatically pop the stack item. | ||
| 'uuid' | ||
| (( | ||
config: Required<Omit<StackItemInstanceConfig<Variant, UserComponent>, 'id'>>, | ||
) => string); | ||
| ((config: Required<Omit<StackItemInstanceConfig<Variant, UserComponent>, 'id'>>) => string); | ||
}; | ||
@@ -133,9 +128,10 @@ | ||
UserComponent extends Component<any>, | ||
> = StackItemCommonConfig< Variant, UserComponent> & { | ||
> = StackItemCommonConfig<Variant, UserComponent> & { | ||
props?: Omit<ComponentProps<UserComponent>, 'item'>; | ||
}; | ||
type StackItemCustomPushConfig< | ||
UserComponent extends Component<any>, | ||
> = StackItemCommonConfig<'custom', UserComponent> & { | ||
type StackItemCustomPushConfig<UserComponent extends Component<any>> = StackItemCommonConfig< | ||
'custom', | ||
UserComponent | ||
> & { | ||
component: UserComponent; | ||
@@ -145,5 +141,3 @@ props?: Omit<ComponentProps<UserComponent>, 'item'>; | ||
type StackItemPopVerboseInput < | ||
UserComponent extends Component<any>, | ||
>= { | ||
type StackItemPopVerboseInput<UserComponent extends Component<any>> = { | ||
id?: string; | ||
@@ -153,3 +147,10 @@ resolved?: ComponentResolved<UserComponent>; | ||
type StackItemRenderActionReturn = ActionReturn<StackItem<any>>; | ||
interface StackItemRenderActionAttributes { | ||
onstackitemmount?: (event: CustomEvent<{ item: StackItem<any> }>) => void; | ||
onstackitemunmount?: (event: CustomEvent<{ item: StackItem<any> }>) => void; | ||
} | ||
type StackItemRenderActionReturn = ActionReturn< | ||
StackItem<any>, | ||
StackItemRenderActionAttributes | ||
>; | ||
@@ -156,0 +157,0 @@ export {}; |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
27234
570
0