@agnos-ui/svelte-headless 0.0.1-alpha.4 → 0.0.1-alpha.5
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/Slot.svelte +3 -3
- package/Slot.svelte.d.ts +19 -20
- package/components/accordion/accordion.d.ts +12 -0
- package/components/accordion/accordion.js +3 -0
- package/components/alert/alert.d.ts +7 -0
- package/components/alert/alert.js +3 -0
- package/components/modal/modal.d.ts +8 -0
- package/components/modal/modal.js +3 -0
- package/components/pagination/pagination.d.ts +9 -0
- package/components/pagination/pagination.js +3 -0
- package/components/progressbar/progressbar.d.ts +7 -0
- package/components/progressbar/progressbar.js +3 -0
- package/components/rating/rating.d.ts +7 -0
- package/components/rating/rating.js +3 -0
- package/components/select/select.d.ts +7 -0
- package/components/select/select.js +3 -0
- package/components/slider/slider.d.ts +1 -0
- package/components/slider/slider.js +1 -0
- package/config.d.ts +20 -35
- package/config.js +5 -3
- package/generated/Slot.svelte.d.ts +1 -0
- package/generated/config.d.ts +1 -0
- package/generated/config.js +1 -0
- package/generated/index.d.ts +20 -0
- package/generated/index.js +20 -0
- package/generated/services/extendWidget.d.ts +1 -0
- package/generated/services/extendWidget.js +1 -0
- package/generated/services/floatingUI.d.ts +1 -0
- package/generated/services/floatingUI.js +1 -0
- package/generated/services/focustrack.d.ts +1 -0
- package/generated/services/focustrack.js +1 -0
- package/generated/services/intersection.d.ts +1 -0
- package/generated/services/intersection.js +1 -0
- package/generated/services/navManager.d.ts +1 -0
- package/generated/services/navManager.js +1 -0
- package/generated/services/portal.d.ts +1 -0
- package/generated/services/portal.js +1 -0
- package/generated/services/siblingsInert.d.ts +1 -0
- package/generated/services/siblingsInert.js +1 -0
- package/generated/services/transitions/baseTransitions.d.ts +1 -0
- package/generated/services/transitions/baseTransitions.js +1 -0
- package/generated/services/transitions/bootstrap.d.ts +1 -0
- package/generated/services/transitions/bootstrap.js +1 -0
- package/generated/services/transitions/collapse.d.ts +1 -0
- package/generated/services/transitions/collapse.js +1 -0
- package/generated/services/transitions/cssTransitions.d.ts +1 -0
- package/generated/services/transitions/cssTransitions.js +1 -0
- package/generated/services/transitions/simpleClassTransition.d.ts +1 -0
- package/generated/services/transitions/simpleClassTransition.js +1 -0
- package/generated/slot.d.ts +1 -0
- package/generated/slot.js +1 -0
- package/generated/types.d.ts +1 -0
- package/generated/types.js +1 -0
- package/generated/utils/directive.d.ts +1 -0
- package/generated/utils/directive.js +1 -0
- package/generated/utils/stores.d.ts +1 -0
- package/generated/utils/stores.js +1 -0
- package/generated/utils/widget.d.ts +1 -0
- package/generated/utils/widget.js +1 -0
- package/generated/utils/writables.d.ts +1 -0
- package/generated/utils/writables.js +1 -0
- package/index.d.ts +9 -53
- package/index.js +9 -20
- package/package.json +40 -4
- package/slot.d.ts +2 -0
- package/slot.js +2 -0
- package/{slotTypes.d.ts → types.d.ts} +2 -5
- package/{slotTypes.js → types.js} +1 -0
- package/utils/widget.d.ts +13 -0
- package/{utils.js → utils/widget.js} +35 -10
- package/utils.d.ts +0 -16
package/Slot.svelte
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {SlotContent, SlotSvelteComponent} from './
|
|
3
|
-
import {isSvelteComponent} from './utils';
|
|
4
|
-
import {useSvelteSlot} from './
|
|
2
|
+
import type {SlotContent, SlotSvelteComponent} from './types';
|
|
3
|
+
import {isSvelteComponent} from './utils/widget';
|
|
4
|
+
import {useSvelteSlot} from './types';
|
|
5
5
|
type Props = $$Generic<object>; // eslint-disable-line no-undef
|
|
6
6
|
// cf https://github.com/ota-meshi/eslint-plugin-svelte/issues/348
|
|
7
7
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
package/Slot.svelte.d.ts
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { SlotContent
|
|
1
|
+
import {SvelteComponentTyped} from 'svelte';
|
|
2
|
+
import type {SlotSvelteComponent, SlotContent} from './types';
|
|
3
3
|
declare class __sveltets_Render<Props extends object> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
props(): {
|
|
5
|
+
slotContent?: SlotContent<Props>;
|
|
6
|
+
props: Props;
|
|
7
|
+
};
|
|
8
|
+
events(): {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots(): {
|
|
12
|
+
default: {
|
|
13
|
+
component: SlotSvelteComponent<Props>;
|
|
14
|
+
props: Props;
|
|
15
|
+
};
|
|
16
|
+
slot: {
|
|
17
|
+
props: Props;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
20
|
}
|
|
21
21
|
export type SlotProps<Props extends object> = ReturnType<__sveltets_Render<Props>['props']>;
|
|
22
22
|
export type SlotEvents<Props extends object> = ReturnType<__sveltets_Render<Props>['events']>;
|
|
23
23
|
export type SlotSlots<Props extends object> = ReturnType<__sveltets_Render<Props>['slots']>;
|
|
24
|
-
export default class Slot<Props extends object> extends SvelteComponentTyped<SlotProps<Props>, SlotEvents<Props>, SlotSlots<Props>> {
|
|
25
|
-
}
|
|
24
|
+
export default class Slot<Props extends object> extends SvelteComponentTyped<SlotProps<Props>, SlotEvents<Props>, SlotSlots<Props>> {}
|
|
26
25
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AdaptSlotContentProps, AdaptWidgetSlots, WidgetFactory, WidgetProps, WidgetState, WidgetPropsSlots } from '../../types';
|
|
2
|
+
export * from '@agnos-ui/core/components/accordion';
|
|
3
|
+
export type AccordionWidget = AdaptWidgetSlots<import('@agnos-ui/core/components/accordion').AccordionWidget>;
|
|
4
|
+
export type AccordionProps = WidgetProps<AccordionWidget>;
|
|
5
|
+
export type AccordionState = WidgetState<AccordionWidget>;
|
|
6
|
+
export type AccordionApi = AccordionWidget['api'];
|
|
7
|
+
export type AccordionSlots = WidgetPropsSlots<AccordionProps>;
|
|
8
|
+
export type AccordionItemWidget = AdaptWidgetSlots<import('@agnos-ui/core/components/accordion').AccordionItemWidget>;
|
|
9
|
+
export type AccordionItemProps = WidgetProps<AccordionItemWidget>;
|
|
10
|
+
export type AccordionItemState = WidgetState<AccordionItemWidget>;
|
|
11
|
+
export type AccordionItemContext = AdaptSlotContentProps<import('@agnos-ui/core/components/accordion').AccordionItemContext>;
|
|
12
|
+
export declare const createAccordion: WidgetFactory<AccordionWidget>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AdaptWidgetSlots, WidgetPropsSlots, WidgetFactory, WidgetProps, WidgetState } from '../../types';
|
|
2
|
+
export * from '@agnos-ui/core/components/alert';
|
|
3
|
+
export type AlertWidget = AdaptWidgetSlots<import('@agnos-ui/core/components/alert').AlertWidget>;
|
|
4
|
+
export type AlertProps = WidgetProps<AlertWidget>;
|
|
5
|
+
export type AlertState = WidgetState<AlertWidget>;
|
|
6
|
+
export type AlertSlots = WidgetPropsSlots<AlertProps>;
|
|
7
|
+
export declare const createAlert: WidgetFactory<AlertWidget>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AdaptSlotContentProps, AdaptWidgetSlots, WidgetPropsSlots, PropsConfig, WidgetProps, WidgetState } from '../../types';
|
|
2
|
+
export * from '@agnos-ui/core/components/modal';
|
|
3
|
+
export type ModalWidget<Data> = AdaptWidgetSlots<import('@agnos-ui/core/components/modal').ModalWidget<Data>>;
|
|
4
|
+
export type ModalProps<Data> = WidgetProps<ModalWidget<Data>>;
|
|
5
|
+
export type ModalState<Data> = WidgetState<ModalWidget<Data>>;
|
|
6
|
+
export type ModalContext<Data> = AdaptSlotContentProps<import('@agnos-ui/core/components/modal').ModalContext<Data>>;
|
|
7
|
+
export type ModalSlots<Data> = WidgetPropsSlots<ModalProps<Data>>;
|
|
8
|
+
export declare const createModal: <Data>(propsConfig?: PropsConfig<ModalProps<Data>>) => ModalWidget<Data>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AdaptSlotContentProps, AdaptWidgetSlots, WidgetPropsSlots, WidgetFactory, WidgetProps, WidgetState } from '../../types';
|
|
2
|
+
export * from '@agnos-ui/core/components/pagination';
|
|
3
|
+
export type PaginationWidget = AdaptWidgetSlots<import('@agnos-ui/core/components/pagination').PaginationWidget>;
|
|
4
|
+
export type PaginationProps = WidgetProps<PaginationWidget>;
|
|
5
|
+
export type PaginationState = WidgetState<PaginationWidget>;
|
|
6
|
+
export type PaginationContext = AdaptSlotContentProps<import('@agnos-ui/core/components/pagination').PaginationContext>;
|
|
7
|
+
export type PaginationNumberContext = AdaptSlotContentProps<import('@agnos-ui/core/components/pagination').PaginationNumberContext>;
|
|
8
|
+
export type PaginationSlots = WidgetPropsSlots<PaginationProps>;
|
|
9
|
+
export declare const createPagination: WidgetFactory<PaginationWidget>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AdaptWidgetSlots, WidgetPropsSlots, WidgetFactory, WidgetProps, WidgetState } from '../../types';
|
|
2
|
+
export * from '@agnos-ui/core/components/progressbar';
|
|
3
|
+
export type ProgressbarWidget = AdaptWidgetSlots<import('@agnos-ui/core/components/progressbar').ProgressbarWidget>;
|
|
4
|
+
export type ProgressbarProps = WidgetProps<ProgressbarWidget>;
|
|
5
|
+
export type ProgressbarState = WidgetState<ProgressbarWidget>;
|
|
6
|
+
export type ProgressbarSlots = WidgetPropsSlots<ProgressbarProps>;
|
|
7
|
+
export declare const createProgressbar: WidgetFactory<ProgressbarWidget>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AdaptWidgetSlots, WidgetPropsSlots, WidgetFactory, WidgetProps, WidgetState } from '../../types';
|
|
2
|
+
export * from '@agnos-ui/core/components/rating';
|
|
3
|
+
export type RatingWidget = AdaptWidgetSlots<import('@agnos-ui/core/components/rating').RatingWidget>;
|
|
4
|
+
export type RatingProps = WidgetProps<RatingWidget>;
|
|
5
|
+
export type RatingState = WidgetState<RatingWidget>;
|
|
6
|
+
export type RatingSlots = WidgetPropsSlots<RatingProps>;
|
|
7
|
+
export declare const createRating: WidgetFactory<RatingWidget>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AdaptWidgetSlots, WidgetPropsSlots, PropsConfig, WidgetProps, WidgetState } from '../../types';
|
|
2
|
+
export * from '@agnos-ui/core/components/select';
|
|
3
|
+
export type SelectWidget<Item> = AdaptWidgetSlots<import('@agnos-ui/core/components/select').SelectWidget<Item>>;
|
|
4
|
+
export type SelectProps<Item> = WidgetProps<SelectWidget<Item>>;
|
|
5
|
+
export type SelectState<Item> = WidgetState<SelectWidget<Item>>;
|
|
6
|
+
export type SelectSlots<Item> = WidgetPropsSlots<SelectProps<Item>>;
|
|
7
|
+
export declare const createSelect: <Item>(propsConfig?: PropsConfig<SelectProps<Item>>) => SelectWidget<Item>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/components/slider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/components/slider';
|
package/config.d.ts
CHANGED
|
@@ -1,9 +1,24 @@
|
|
|
1
|
-
import type { WidgetsConfig as CoreWidgetsConfig, Partial2Levels,
|
|
1
|
+
import type { WidgetsConfig as CoreWidgetsConfig, Partial2Levels, WidgetsConfigStore } from '@agnos-ui/core/config';
|
|
2
2
|
import type { ReadableSignal } from '@amadeus-it-group/tansu';
|
|
3
|
-
import type { AdaptPropsSlots, SlotsPresent } from './
|
|
3
|
+
import type { AdaptPropsSlots, SlotsPresent, Widget, WidgetProps, WidgetFactory } from './types';
|
|
4
|
+
export * from '@agnos-ui/core/config';
|
|
4
5
|
export type WidgetsConfig = {
|
|
5
6
|
[WidgetName in keyof CoreWidgetsConfig]: AdaptPropsSlots<CoreWidgetsConfig[WidgetName]>;
|
|
6
7
|
};
|
|
8
|
+
type WidgetFactoryInput<Config extends {
|
|
9
|
+
[widgetName: string]: object;
|
|
10
|
+
}, W extends Widget> = {
|
|
11
|
+
factory: WidgetFactory<W>;
|
|
12
|
+
widgetName?: null | keyof Config;
|
|
13
|
+
$$slots: SlotsPresent<WidgetProps<W>>;
|
|
14
|
+
defaultConfig?: Partial<WidgetProps<W>> | ReadableSignal<Partial<WidgetProps<W>> | undefined>;
|
|
15
|
+
events: Pick<WidgetProps<W>, keyof WidgetProps<W> & `on${string}Change`>;
|
|
16
|
+
$$props: Partial<WidgetProps<W>>;
|
|
17
|
+
};
|
|
18
|
+
type AdaptParentConfig<Config> = (config: Partial2Levels<Config>) => Partial2Levels<Config>;
|
|
19
|
+
type CreateWidgetsDefaultConfig<Config extends {
|
|
20
|
+
[widgetName: string]: object;
|
|
21
|
+
}> = (adaptParentConfig?: AdaptParentConfig<Config>) => WidgetsConfigStore<Config>;
|
|
7
22
|
export declare const widgetsConfigFactory: <Config extends {
|
|
8
23
|
[widgetName: string]: object;
|
|
9
24
|
} = WidgetsConfig>(widgetsDefaultConfigKey?: symbol) => {
|
|
@@ -11,42 +26,12 @@ export declare const widgetsConfigFactory: <Config extends {
|
|
|
11
26
|
* Key used in the Svelte context to get or set the widgets default configuration store.
|
|
12
27
|
*/
|
|
13
28
|
widgetsDefaultConfigKey: symbol;
|
|
14
|
-
createWidgetsDefaultConfig:
|
|
29
|
+
createWidgetsDefaultConfig: CreateWidgetsDefaultConfig<Config>;
|
|
15
30
|
getContextWidgetConfig: <N extends keyof Config>(widgetName: N) => ReadableSignal<Partial<Config[N]> | undefined>;
|
|
16
|
-
callWidgetFactory: <W extends Widget
|
|
17
|
-
factory: WidgetFactory<W>;
|
|
18
|
-
widgetName?: keyof Config | null | undefined;
|
|
19
|
-
$$slots: SlotsPresent<WidgetProps<W>>;
|
|
20
|
-
defaultConfig?: Partial<WidgetProps<W>> | ReadableSignal<Partial<WidgetProps<W>> | undefined> | undefined;
|
|
21
|
-
events: Pick<WidgetProps<W>, keyof WidgetProps<W> & `on${string}`>;
|
|
22
|
-
}) => W & {
|
|
31
|
+
callWidgetFactory: <W extends Widget>({ factory, widgetName, $$slots, defaultConfig, events, $$props, }: WidgetFactoryInput<Config, W>) => W & {
|
|
23
32
|
patchChangedProps: W["patch"];
|
|
24
33
|
};
|
|
25
34
|
};
|
|
26
|
-
export declare const widgetsDefaultConfigKey: symbol, createWidgetsDefaultConfig:
|
|
27
|
-
pagination: Partial<AdaptPropsSlots<import("@agnos-ui/core").PaginationProps>>;
|
|
28
|
-
rating: Partial<AdaptPropsSlots<import("@agnos-ui/core").RatingProps>>;
|
|
29
|
-
select: Partial<AdaptPropsSlots<import("@agnos-ui/core").SelectProps<any>>>;
|
|
30
|
-
modal: Partial<AdaptPropsSlots<import("@agnos-ui/core").ModalProps>>;
|
|
31
|
-
alert: Partial<AdaptPropsSlots<import("@agnos-ui/core").AlertProps>>;
|
|
32
|
-
accordion: Partial<AdaptPropsSlots<import("@agnos-ui/core").AccordionProps>>;
|
|
33
|
-
progressbar: Partial<AdaptPropsSlots<import("@agnos-ui/core").ProgressbarProps>>;
|
|
34
|
-
slider: Partial<AdaptPropsSlots<import("@agnos-ui/core").SliderProps>>;
|
|
35
|
-
}>) => Partial<{
|
|
36
|
-
pagination: Partial<AdaptPropsSlots<import("@agnos-ui/core").PaginationProps>>;
|
|
37
|
-
rating: Partial<AdaptPropsSlots<import("@agnos-ui/core").RatingProps>>;
|
|
38
|
-
select: Partial<AdaptPropsSlots<import("@agnos-ui/core").SelectProps<any>>>;
|
|
39
|
-
modal: Partial<AdaptPropsSlots<import("@agnos-ui/core").ModalProps>>;
|
|
40
|
-
alert: Partial<AdaptPropsSlots<import("@agnos-ui/core").AlertProps>>;
|
|
41
|
-
accordion: Partial<AdaptPropsSlots<import("@agnos-ui/core").AccordionProps>>;
|
|
42
|
-
progressbar: Partial<AdaptPropsSlots<import("@agnos-ui/core").ProgressbarProps>>;
|
|
43
|
-
slider: Partial<AdaptPropsSlots<import("@agnos-ui/core").SliderProps>>;
|
|
44
|
-
}>) | undefined) => WidgetsConfigStore<WidgetsConfig>, getContextWidgetConfig: <N extends keyof CoreWidgetsConfig>(widgetName: N) => ReadableSignal<Partial<WidgetsConfig[N]> | undefined>, callWidgetFactory: <W extends Widget<object, object, object, object, object>>({ factory, widgetName, $$slots, defaultConfig, events, }: {
|
|
45
|
-
factory: WidgetFactory<W>;
|
|
46
|
-
widgetName?: keyof CoreWidgetsConfig | null | undefined;
|
|
47
|
-
$$slots: SlotsPresent<WidgetProps<W>>;
|
|
48
|
-
defaultConfig?: Partial<WidgetProps<W>> | ReadableSignal<Partial<WidgetProps<W>> | undefined> | undefined;
|
|
49
|
-
events: Pick<WidgetProps<W>, keyof WidgetProps<W> & `on${string}`>;
|
|
50
|
-
}) => W & {
|
|
35
|
+
export declare const widgetsDefaultConfigKey: symbol, createWidgetsDefaultConfig: CreateWidgetsDefaultConfig<WidgetsConfig>, getContextWidgetConfig: <N extends string | number | symbol>(widgetName: N) => ReadableSignal<Partial<WidgetsConfig[N]> | undefined>, callWidgetFactory: <W extends Widget>({ factory, widgetName, $$slots, defaultConfig, events, $$props, }: WidgetFactoryInput<WidgetsConfig, W>) => W & {
|
|
51
36
|
patchChangedProps: W["patch"];
|
|
52
37
|
};
|
package/config.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { createWidgetsConfig } from '@agnos-ui/core';
|
|
1
|
+
import { createWidgetsConfig } from '@agnos-ui/core/config';
|
|
2
2
|
import { computed } from '@amadeus-it-group/tansu';
|
|
3
3
|
import { getContext, setContext } from 'svelte';
|
|
4
|
-
import { callWidgetFactoryWithConfig } from '
|
|
4
|
+
import { callWidgetFactoryWithConfig } from './utils/widget';
|
|
5
|
+
export * from '@agnos-ui/core/config';
|
|
5
6
|
export const widgetsConfigFactory = (widgetsDefaultConfigKey = Symbol('widgetsConfig')) => {
|
|
6
7
|
/**
|
|
7
8
|
* Creates in the Svelte context hierarchy a new widgets default configuration store that inherits from any widgets default configuration
|
|
@@ -51,12 +52,13 @@ export const widgetsConfigFactory = (widgetsDefaultConfigKey = Symbol('widgetsCo
|
|
|
51
52
|
const widgetsConfig = getContext(widgetsDefaultConfigKey);
|
|
52
53
|
return computed(() => widgetsConfig?.()[widgetName]);
|
|
53
54
|
};
|
|
54
|
-
const callWidgetFactory = ({ factory, widgetName = null, $$slots, defaultConfig = {}, events, }) => callWidgetFactoryWithConfig({
|
|
55
|
+
const callWidgetFactory = ({ factory, widgetName = null, $$slots, defaultConfig = {}, events, $$props, }) => callWidgetFactoryWithConfig({
|
|
55
56
|
factory,
|
|
56
57
|
$$slots,
|
|
57
58
|
defaultConfig,
|
|
58
59
|
widgetConfig: widgetName ? getContextWidgetConfig(widgetName) : null,
|
|
59
60
|
events,
|
|
61
|
+
$$props,
|
|
60
62
|
});
|
|
61
63
|
return {
|
|
62
64
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './../Slot.svelte.d';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './../config';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './../config';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from './services/siblingsInert';
|
|
2
|
+
export * from './services/portal';
|
|
3
|
+
export * from './services/navManager';
|
|
4
|
+
export * from './services/intersection';
|
|
5
|
+
export * from './services/focustrack';
|
|
6
|
+
export * from './services/floatingUI';
|
|
7
|
+
export * from './services/extendWidget';
|
|
8
|
+
export * from './services/transitions/simpleClassTransition';
|
|
9
|
+
export * from './services/transitions/cssTransitions';
|
|
10
|
+
export * from './services/transitions/collapse';
|
|
11
|
+
export * from './services/transitions/bootstrap';
|
|
12
|
+
export * from './services/transitions/baseTransitions';
|
|
13
|
+
export * from './types';
|
|
14
|
+
export * from './config';
|
|
15
|
+
export * from './utils/writables';
|
|
16
|
+
export * from './utils/stores';
|
|
17
|
+
export * from './utils/directive';
|
|
18
|
+
export * from './utils/widget';
|
|
19
|
+
export * from './slot';
|
|
20
|
+
export * from './Slot.svelte.d';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from './services/siblingsInert';
|
|
2
|
+
export * from './services/portal';
|
|
3
|
+
export * from './services/navManager';
|
|
4
|
+
export * from './services/intersection';
|
|
5
|
+
export * from './services/focustrack';
|
|
6
|
+
export * from './services/floatingUI';
|
|
7
|
+
export * from './services/extendWidget';
|
|
8
|
+
export * from './services/transitions/simpleClassTransition';
|
|
9
|
+
export * from './services/transitions/cssTransitions';
|
|
10
|
+
export * from './services/transitions/collapse';
|
|
11
|
+
export * from './services/transitions/bootstrap';
|
|
12
|
+
export * from './services/transitions/baseTransitions';
|
|
13
|
+
export * from './types';
|
|
14
|
+
export * from './config';
|
|
15
|
+
export * from './utils/writables';
|
|
16
|
+
export * from './utils/stores';
|
|
17
|
+
export * from './utils/directive';
|
|
18
|
+
export * from './utils/widget';
|
|
19
|
+
export * from './slot';
|
|
20
|
+
export * from './Slot.svelte.d';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/extendWidget';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/extendWidget';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/floatingUI';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/floatingUI';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/focustrack';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/focustrack';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/intersection';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/intersection';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/navManager';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/navManager';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/portal';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/portal';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/siblingsInert';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/siblingsInert';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/transitions/baseTransitions';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/transitions/baseTransitions';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/transitions/bootstrap';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/transitions/bootstrap';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/transitions/collapse';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/transitions/collapse';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/transitions/cssTransitions';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/transitions/cssTransitions';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/transitions/simpleClassTransition';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/transitions/simpleClassTransition';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './../slot';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './../slot';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './../types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './../types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/utils/directive';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/utils/directive';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/utils/stores';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/utils/stores';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './../../utils/widget';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './../../utils/widget';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/utils/writables';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/utils/writables';
|
package/index.d.ts
CHANGED
|
@@ -1,53 +1,9 @@
|
|
|
1
|
-
export * from '
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
import type { AdaptSlotContentProps, AdaptWidgetSlots, WidgetPropsSlots } from './slotTypes';
|
|
11
|
-
export type AccordionWidget = AdaptWidgetSlots<import('@agnos-ui/core').AccordionWidget>;
|
|
12
|
-
export type AccordionProps = WidgetProps<AccordionWidget>;
|
|
13
|
-
export type AccordionState = WidgetState<AccordionWidget>;
|
|
14
|
-
export type AccordionApi = AccordionWidget['api'];
|
|
15
|
-
export type AccordionSlots = WidgetPropsSlots<AccordionProps>;
|
|
16
|
-
export type AccordionItemWidget = AdaptWidgetSlots<import('@agnos-ui/core').AccordionItemWidget>;
|
|
17
|
-
export type AccordionItemProps = WidgetProps<AccordionItemWidget>;
|
|
18
|
-
export type AccordionItemState = WidgetState<AccordionItemWidget>;
|
|
19
|
-
export type AccordionItemContext = AdaptSlotContentProps<import('@agnos-ui/core').AccordionItemContext>;
|
|
20
|
-
export declare const createAccordion: WidgetFactory<AccordionWidget>;
|
|
21
|
-
export type AlertWidget = AdaptWidgetSlots<import('@agnos-ui/core').AlertWidget>;
|
|
22
|
-
export type AlertProps = WidgetProps<AlertWidget>;
|
|
23
|
-
export type AlertState = WidgetState<AlertWidget>;
|
|
24
|
-
export type AlertSlots = WidgetPropsSlots<AlertProps>;
|
|
25
|
-
export declare const createAlert: WidgetFactory<AlertWidget>;
|
|
26
|
-
export type ModalWidget = AdaptWidgetSlots<import('@agnos-ui/core').ModalWidget>;
|
|
27
|
-
export type ModalProps = WidgetProps<ModalWidget>;
|
|
28
|
-
export type ModalState = WidgetState<ModalWidget>;
|
|
29
|
-
export type ModalContext = AdaptSlotContentProps<import('@agnos-ui/core').ModalContext>;
|
|
30
|
-
export type ModalSlots = WidgetPropsSlots<ModalProps>;
|
|
31
|
-
export declare const createModal: WidgetFactory<ModalWidget>;
|
|
32
|
-
export type PaginationWidget = AdaptWidgetSlots<import('@agnos-ui/core').PaginationWidget>;
|
|
33
|
-
export type PaginationProps = WidgetProps<PaginationWidget>;
|
|
34
|
-
export type PaginationState = WidgetState<PaginationWidget>;
|
|
35
|
-
export type PaginationContext = AdaptSlotContentProps<import('@agnos-ui/core').PaginationContext>;
|
|
36
|
-
export type PaginationNumberContext = AdaptSlotContentProps<import('@agnos-ui/core').PaginationNumberContext>;
|
|
37
|
-
export type PaginationSlots = WidgetPropsSlots<PaginationProps>;
|
|
38
|
-
export declare const createPagination: WidgetFactory<PaginationWidget>;
|
|
39
|
-
export type RatingWidget = AdaptWidgetSlots<import('@agnos-ui/core').RatingWidget>;
|
|
40
|
-
export type RatingProps = WidgetProps<RatingWidget>;
|
|
41
|
-
export type RatingState = WidgetState<RatingWidget>;
|
|
42
|
-
export type RatingSlots = WidgetPropsSlots<RatingProps>;
|
|
43
|
-
export declare const createRating: WidgetFactory<RatingWidget>;
|
|
44
|
-
export type SelectWidget<Item> = AdaptWidgetSlots<import('@agnos-ui/core').SelectWidget<Item>>;
|
|
45
|
-
export type SelectProps<Item> = WidgetProps<SelectWidget<Item>>;
|
|
46
|
-
export type SelectState<Item> = WidgetState<SelectWidget<Item>>;
|
|
47
|
-
export type SelectSlots<Item> = WidgetPropsSlots<SelectProps<Item>>;
|
|
48
|
-
export declare const createSelect: <Item>(propsConfig?: PropsConfig<SelectProps<Item>>) => SelectWidget<Item>;
|
|
49
|
-
export type ProgressbarWidget = AdaptWidgetSlots<import('@agnos-ui/core').ProgressbarWidget>;
|
|
50
|
-
export type ProgressbarProps = WidgetProps<ProgressbarWidget>;
|
|
51
|
-
export type ProgressbarState = WidgetState<ProgressbarWidget>;
|
|
52
|
-
export type ProgressbarSlots = WidgetPropsSlots<ProgressbarProps>;
|
|
53
|
-
export declare const createProgressbar: WidgetFactory<ProgressbarWidget>;
|
|
1
|
+
export * from './components/accordion/accordion';
|
|
2
|
+
export * from './components/alert/alert';
|
|
3
|
+
export * from './components/modal/modal';
|
|
4
|
+
export * from './components/pagination/pagination';
|
|
5
|
+
export * from './components/progressbar/progressbar';
|
|
6
|
+
export * from './components/rating/rating';
|
|
7
|
+
export * from './components/select/select';
|
|
8
|
+
export * from './components/slider/slider';
|
|
9
|
+
export * from './generated';
|
package/index.js
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
export * from '
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
export const createAlert = coreCreateAlert;
|
|
11
|
-
import { createModal as coreCreateModal } from '@agnos-ui/core';
|
|
12
|
-
export const createModal = coreCreateModal;
|
|
13
|
-
import { createPagination as coreCreatePagination } from '@agnos-ui/core';
|
|
14
|
-
export const createPagination = coreCreatePagination;
|
|
15
|
-
import { createRating as coreCreateRating } from '@agnos-ui/core';
|
|
16
|
-
export const createRating = coreCreateRating;
|
|
17
|
-
import { createSelect as coreCreateSelect } from '@agnos-ui/core';
|
|
18
|
-
export const createSelect = coreCreateSelect;
|
|
19
|
-
import { createProgressbar as coreCreateProgressbar } from '@agnos-ui/core';
|
|
20
|
-
export const createProgressbar = coreCreateProgressbar;
|
|
1
|
+
export * from './components/accordion/accordion';
|
|
2
|
+
export * from './components/alert/alert';
|
|
3
|
+
export * from './components/modal/modal';
|
|
4
|
+
export * from './components/pagination/pagination';
|
|
5
|
+
export * from './components/progressbar/progressbar';
|
|
6
|
+
export * from './components/rating/rating';
|
|
7
|
+
export * from './components/select/select';
|
|
8
|
+
export * from './components/slider/slider';
|
|
9
|
+
export * from './generated';
|
package/package.json
CHANGED
|
@@ -8,18 +8,54 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./index.d.ts",
|
|
11
|
-
"svelte": "./index.
|
|
11
|
+
"svelte": "./index.d.ts",
|
|
12
|
+
"default": "./index.js"
|
|
13
|
+
},
|
|
14
|
+
"./components/*": {
|
|
15
|
+
"types": "./components/*/*.d.ts",
|
|
16
|
+
"svelte": "./components/*/*.js",
|
|
17
|
+
"default": "./components/*/*.js"
|
|
18
|
+
},
|
|
19
|
+
"./config": {
|
|
20
|
+
"types": "./config.d.ts",
|
|
21
|
+
"svelte": "./config.js",
|
|
22
|
+
"default": "./config.js"
|
|
23
|
+
},
|
|
24
|
+
"./slot": {
|
|
25
|
+
"types": "./slot.d.ts",
|
|
26
|
+
"svelte": "./slot.js",
|
|
27
|
+
"default": "./slot.js"
|
|
28
|
+
},
|
|
29
|
+
"./types": {
|
|
30
|
+
"types": "./types.d.ts",
|
|
31
|
+
"svelte": "./types.js",
|
|
32
|
+
"default": "./types.js"
|
|
33
|
+
},
|
|
34
|
+
"./services/*": {
|
|
35
|
+
"types": "./generated/services/*.d.ts",
|
|
36
|
+
"svelte": "./generated/services/*.js",
|
|
37
|
+
"default": "./generated/services/*.js"
|
|
38
|
+
},
|
|
39
|
+
"./services/transitions/*": {
|
|
40
|
+
"types": "./generated/services/transitions/*.d.ts",
|
|
41
|
+
"svelte": "./generated/services/transitions/*.js",
|
|
42
|
+
"default": "./generated/services/transitions/*.js"
|
|
43
|
+
},
|
|
44
|
+
"./utils/*": {
|
|
45
|
+
"types": "./generated/utils/*.d.ts",
|
|
46
|
+
"svelte": "./generated/utils/*.js",
|
|
47
|
+
"default": "./generated/utils/*.js"
|
|
12
48
|
}
|
|
13
49
|
},
|
|
14
50
|
"dependencies": {
|
|
15
|
-
"@agnos-ui/core": "0.0.1-alpha.
|
|
16
|
-
"@amadeus-it-group/tansu": "0.0.
|
|
51
|
+
"@agnos-ui/core": "0.0.1-alpha.5",
|
|
52
|
+
"@amadeus-it-group/tansu": "0.0.24"
|
|
17
53
|
},
|
|
18
54
|
"peerDependencies": {
|
|
19
55
|
"svelte": "*"
|
|
20
56
|
},
|
|
21
57
|
"sideEffects": false,
|
|
22
|
-
"version": "0.0.1-alpha.
|
|
58
|
+
"version": "0.0.1-alpha.5",
|
|
23
59
|
"homepage": "https://amadeusitgroup.github.io/AgnosUI/latest/",
|
|
24
60
|
"bugs": "https://github.com/AmadeusITGroup/AgnosUI/issues",
|
|
25
61
|
"license": "MIT",
|
package/slot.d.ts
ADDED
package/slot.js
ADDED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
export * from '@agnos-ui/core/types';
|
|
2
|
+
import type { SlotContent as CoreSlotContent, Widget, WidgetFactory, WidgetProps, WidgetSlotContext, WidgetState } from '@agnos-ui/core/types';
|
|
2
3
|
import type { ComponentType, SvelteComponent } from 'svelte';
|
|
3
4
|
export declare const useSvelteSlot: unique symbol;
|
|
4
|
-
export type WidgetPropsProps<Props extends object> = Partial<Omit<Props, `on${string}`>>;
|
|
5
|
-
export type WidgetPropsEvents<Props extends object> = {
|
|
6
|
-
[K in keyof Props & `on${string}` as K extends `on${infer U}` ? Uncapitalize<U> : never]: NonNullable<Props[K]> extends (arg: infer U) => void ? CustomEvent<U> : never;
|
|
7
|
-
};
|
|
8
5
|
export type WidgetPropsSlots<Props extends object> = {
|
|
9
6
|
[K in keyof Props & `slot${string}` as K extends `slot${infer U}` ? Uncapitalize<U> : never]: Props[K] extends SlotContent<infer U> ? U : never;
|
|
10
7
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReadableSignal } from '@amadeus-it-group/tansu';
|
|
2
|
+
import type { SlotContent, SlotSvelteComponent, SlotsPresent, WidgetFactory, WidgetProps } from '../types';
|
|
3
|
+
export declare const callWidgetFactoryWithConfig: <W extends Widget>({ factory, $$slots, defaultConfig, widgetConfig, events, $$props, }: {
|
|
4
|
+
factory: WidgetFactory<W>;
|
|
5
|
+
$$slots: SlotsPresent<WidgetProps<W>>;
|
|
6
|
+
defaultConfig?: any;
|
|
7
|
+
widgetConfig?: ReadableSignal<any> | null | undefined;
|
|
8
|
+
events: Pick<WidgetProps<W>, `on${string}Change`>;
|
|
9
|
+
$$props: WidgetProps<W>;
|
|
10
|
+
}) => W & {
|
|
11
|
+
patchChangedProps: W["patch"];
|
|
12
|
+
};
|
|
13
|
+
export declare const isSvelteComponent: <Props extends object>(content: any) => content is SlotSvelteComponent<Props>;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { findChangedProperties, toReadableStore } from '@agnos-ui/core';
|
|
2
|
-
import { computed } from '@amadeus-it-group/tansu';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export function createPatchChangedProps(patchFn) {
|
|
6
|
-
let previousProps = {};
|
|
1
|
+
import { findChangedProperties, toReadableStore } from '@agnos-ui/core/utils/stores';
|
|
2
|
+
import { asWritable, computed, writable } from '@amadeus-it-group/tansu';
|
|
3
|
+
import { useSvelteSlot } from '../types';
|
|
4
|
+
function createPatchChangedProps(previousProps, patchFn) {
|
|
7
5
|
return (props) => {
|
|
8
6
|
const changedProps = findChangedProperties(previousProps, props);
|
|
9
7
|
previousProps = props;
|
|
@@ -12,8 +10,31 @@ export function createPatchChangedProps(patchFn) {
|
|
|
12
10
|
}
|
|
13
11
|
};
|
|
14
12
|
}
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Merges two functions.
|
|
15
|
+
* @param fn1 - first function
|
|
16
|
+
* @param fn2 - second function (or undefined or null)
|
|
17
|
+
* @returns a function that successively calls fn1 and fn2 (if defined)
|
|
18
|
+
*/
|
|
19
|
+
const mergeEventFns = (fn1, fn2) => fn2
|
|
20
|
+
? (...args) => {
|
|
21
|
+
fn1(...args);
|
|
22
|
+
fn2(...args);
|
|
23
|
+
}
|
|
24
|
+
: fn1;
|
|
25
|
+
/**
|
|
26
|
+
* Creates a writable store to be used for an event handler.
|
|
27
|
+
* @param event - function that will be merged with the value of the store so that it is always called first when the event handler is called
|
|
28
|
+
* @returns a writable store to be used for an event handler
|
|
29
|
+
*/
|
|
30
|
+
const eventStore = (event, prop) => {
|
|
31
|
+
const store$ = writable(prop, { equal: Object.is });
|
|
32
|
+
return asWritable(computed(() => mergeEventFns(event, store$())), {
|
|
33
|
+
set: store$.set,
|
|
34
|
+
update: store$.update,
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
export const callWidgetFactoryWithConfig = ({ factory, $$slots, defaultConfig, widgetConfig, events, $$props, }) => {
|
|
17
38
|
const defaultConfig$ = toReadableStore(defaultConfig);
|
|
18
39
|
const processedSlots = {};
|
|
19
40
|
for (const [name, present] of Object.entries($$slots)) {
|
|
@@ -21,11 +42,15 @@ export const callWidgetFactoryWithConfig = ({ factory, $$slots, defaultConfig, w
|
|
|
21
42
|
processedSlots[`slot${name[0].toUpperCase()}${name.substring(1)}`] = useSvelteSlot;
|
|
22
43
|
}
|
|
23
44
|
}
|
|
45
|
+
const props = { ...$$props };
|
|
46
|
+
for (const event of Object.keys(events)) {
|
|
47
|
+
props[event] = eventStore(events[event], $$props[event]);
|
|
48
|
+
}
|
|
24
49
|
const widget = factory({
|
|
25
50
|
config: computed(() => ({ ...defaultConfig$(), ...widgetConfig?.(), ...processedSlots })),
|
|
51
|
+
props,
|
|
26
52
|
});
|
|
27
|
-
widget.patch
|
|
28
|
-
return { ...widget, patchChangedProps: createPatchChangedProps(widget.patch) };
|
|
53
|
+
return { ...widget, patchChangedProps: createPatchChangedProps($$props, widget.patch) };
|
|
29
54
|
};
|
|
30
55
|
export const isSvelteComponent = (content) => {
|
|
31
56
|
// in prod mode, a svelte component has $set on its prototype
|
package/utils.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/// <reference types="svelte" />
|
|
2
|
-
import type { Widget, WidgetFactory, WidgetProps } from '@agnos-ui/core';
|
|
3
|
-
import type { ReadableSignal } from '@amadeus-it-group/tansu';
|
|
4
|
-
import type { SlotContent, SlotSvelteComponent, SlotsPresent } from './slotTypes';
|
|
5
|
-
export declare function createPatchChangedProps<T extends object>(patchFn: (arg: Partial<T>) => void): (props: Partial<T>) => void;
|
|
6
|
-
export declare const createEventDispatcher: <T extends object>() => import("svelte").EventDispatcher<{ [K in keyof T]: T[K] extends CustomEvent<infer U> ? U : never; }>;
|
|
7
|
-
export declare const callWidgetFactoryWithConfig: <W extends Widget<object, object, object, object, object>>({ factory, $$slots, defaultConfig, widgetConfig, events, }: {
|
|
8
|
-
factory: WidgetFactory<W>;
|
|
9
|
-
$$slots: SlotsPresent<WidgetProps<W>>;
|
|
10
|
-
defaultConfig?: Partial<WidgetProps<W>> | ReadableSignal<Partial<WidgetProps<W>> | undefined> | undefined;
|
|
11
|
-
widgetConfig?: ReadableSignal<Partial<WidgetProps<W>> | undefined> | null | undefined;
|
|
12
|
-
events: Pick<WidgetProps<W>, keyof WidgetProps<W> & `on${string}`>;
|
|
13
|
-
}) => W & {
|
|
14
|
-
patchChangedProps: W["patch"];
|
|
15
|
-
};
|
|
16
|
-
export declare const isSvelteComponent: <Props extends object>(content: SlotContent<Props>) => content is SlotSvelteComponent<Props>;
|