@agnos-ui/svelte-headless 0.1.1 → 0.3.0
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/components/accordion/accordion.d.ts +0 -11
- package/components/accordion/accordion.js +0 -2
- package/components/alert/alert.d.ts +0 -6
- package/components/alert/alert.js +0 -2
- package/components/modal/modal.d.ts +0 -7
- package/components/modal/modal.js +0 -2
- package/components/pagination/pagination.d.ts +0 -8
- package/components/pagination/pagination.js +0 -2
- package/components/progressbar/progressbar.d.ts +0 -6
- package/components/progressbar/progressbar.js +0 -2
- package/components/rating/rating.d.ts +0 -6
- package/components/rating/rating.js +0 -2
- package/components/select/select.d.ts +0 -6
- package/components/select/select.js +0 -2
- package/components/toast/index.d.ts +1 -0
- package/components/toast/index.js +1 -0
- package/components/toast/toast.d.ts +1 -0
- package/components/toast/toast.js +1 -0
- package/config.d.ts +2 -2
- package/generated/index.d.ts +3 -1
- package/generated/index.js +3 -1
- package/generated/services/hash.d.ts +1 -0
- package/generated/services/hash.js +1 -0
- package/generated/services/matchMedia.d.ts +1 -0
- package/generated/services/matchMedia.js +1 -0
- package/generated/services/resizeObserver.d.ts +1 -0
- package/generated/services/resizeObserver.js +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +10 -8
- package/types.d.ts +1 -0
- package/utils/widget.d.ts +7 -7
- package/utils/widget.js +9 -5
- package/generated/services/transitions/bootstrap.d.ts +0 -1
- package/generated/services/transitions/bootstrap.js +0 -1
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import type { AdaptSlotContentProps, AdaptWidgetSlots, WidgetFactory, WidgetProps, WidgetState, WidgetPropsSlots } from '../../types';
|
|
2
1
|
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>;
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import type { AdaptWidgetSlots, WidgetPropsSlots, WidgetFactory, WidgetProps, WidgetState } from '../../types';
|
|
2
1
|
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>;
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
import type { AdaptSlotContentProps, AdaptWidgetSlots, WidgetPropsSlots, PropsConfig, WidgetProps, WidgetState } from '../../types';
|
|
2
1
|
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>;
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
import type { AdaptSlotContentProps, AdaptWidgetSlots, WidgetPropsSlots, WidgetFactory, WidgetProps, WidgetState } from '../../types';
|
|
2
1
|
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>;
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import type { AdaptWidgetSlots, WidgetPropsSlots, WidgetFactory, WidgetProps, WidgetState } from '../../types';
|
|
2
1
|
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>;
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import type { AdaptWidgetSlots, WidgetPropsSlots, WidgetFactory, WidgetProps, WidgetState } from '../../types';
|
|
2
1
|
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>;
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import type { AdaptWidgetSlots, WidgetPropsSlots, PropsConfig, WidgetProps, WidgetState } from '../../types';
|
|
2
1
|
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 './toast';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './toast';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/components/toast';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/components/toast';
|
package/config.d.ts
CHANGED
|
@@ -10,9 +10,9 @@ type WidgetFactoryInput<Config extends {
|
|
|
10
10
|
}, W extends Widget> = {
|
|
11
11
|
factory: WidgetFactory<W>;
|
|
12
12
|
widgetName?: null | keyof Config;
|
|
13
|
-
$$slots
|
|
13
|
+
$$slots?: SlotsPresent<WidgetProps<W>>;
|
|
14
14
|
defaultConfig?: Partial<WidgetProps<W>> | ReadableSignal<Partial<WidgetProps<W>> | undefined>;
|
|
15
|
-
events
|
|
15
|
+
events?: Pick<WidgetProps<W>, keyof WidgetProps<W> & `on${string}Change`>;
|
|
16
16
|
$$props: Partial<WidgetProps<W>>;
|
|
17
17
|
};
|
|
18
18
|
type AdaptParentConfig<Config> = (config: Partial2Levels<Config>) => Partial2Levels<Config>;
|
package/generated/index.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
export * from './services/siblingsInert';
|
|
2
|
+
export * from './services/resizeObserver';
|
|
2
3
|
export * from './services/portal';
|
|
3
4
|
export * from './services/navManager';
|
|
5
|
+
export * from './services/matchMedia';
|
|
4
6
|
export * from './services/intersection';
|
|
7
|
+
export * from './services/hash';
|
|
5
8
|
export * from './services/focustrack';
|
|
6
9
|
export * from './services/floatingUI';
|
|
7
10
|
export * from './services/extendWidget';
|
|
8
11
|
export * from './services/transitions/simpleClassTransition';
|
|
9
12
|
export * from './services/transitions/cssTransitions';
|
|
10
13
|
export * from './services/transitions/collapse';
|
|
11
|
-
export * from './services/transitions/bootstrap';
|
|
12
14
|
export * from './services/transitions/baseTransitions';
|
|
13
15
|
export * from './utils/writables';
|
|
14
16
|
export * from './utils/stores';
|
package/generated/index.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
export * from './services/siblingsInert';
|
|
2
|
+
export * from './services/resizeObserver';
|
|
2
3
|
export * from './services/portal';
|
|
3
4
|
export * from './services/navManager';
|
|
5
|
+
export * from './services/matchMedia';
|
|
4
6
|
export * from './services/intersection';
|
|
7
|
+
export * from './services/hash';
|
|
5
8
|
export * from './services/focustrack';
|
|
6
9
|
export * from './services/floatingUI';
|
|
7
10
|
export * from './services/extendWidget';
|
|
8
11
|
export * from './services/transitions/simpleClassTransition';
|
|
9
12
|
export * from './services/transitions/cssTransitions';
|
|
10
13
|
export * from './services/transitions/collapse';
|
|
11
|
-
export * from './services/transitions/bootstrap';
|
|
12
14
|
export * from './services/transitions/baseTransitions';
|
|
13
15
|
export * from './utils/writables';
|
|
14
16
|
export * from './utils/stores';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/hash';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/hash';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/matchMedia';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/matchMedia';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/resizeObserver';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/resizeObserver';
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agnos-ui/svelte-headless",
|
|
3
3
|
"description": "Headless widget library for Svelte.",
|
|
4
|
+
"version": "0.3.0",
|
|
4
5
|
"type": "module",
|
|
5
6
|
"main": "./index.js",
|
|
6
7
|
"module": "./index.js",
|
|
@@ -48,32 +49,33 @@
|
|
|
48
49
|
}
|
|
49
50
|
},
|
|
50
51
|
"dependencies": {
|
|
51
|
-
"@agnos-ui/core": "0.
|
|
52
|
-
"@amadeus-it-group/tansu": "1.0.0"
|
|
52
|
+
"@agnos-ui/core": "0.3.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
+
"@amadeus-it-group/tansu": "*",
|
|
55
56
|
"svelte": "*"
|
|
56
57
|
},
|
|
57
58
|
"sideEffects": false,
|
|
58
|
-
"version": "0.1.1",
|
|
59
59
|
"homepage": "https://amadeusitgroup.github.io/AgnosUI/latest/",
|
|
60
60
|
"bugs": "https://github.com/AmadeusITGroup/AgnosUI/issues",
|
|
61
61
|
"license": "MIT",
|
|
62
62
|
"repository": {
|
|
63
63
|
"type": "git",
|
|
64
|
-
"url": "https://github.com/AmadeusITGroup/AgnosUI.git",
|
|
64
|
+
"url": "git+https://github.com/AmadeusITGroup/AgnosUI.git",
|
|
65
65
|
"directory": "svelte/headless"
|
|
66
66
|
},
|
|
67
67
|
"keywords": [
|
|
68
68
|
"svelte",
|
|
69
|
-
"
|
|
70
|
-
"components",
|
|
71
|
-
"widgets",
|
|
69
|
+
"AgnosUI",
|
|
72
70
|
"accordion",
|
|
73
71
|
"alert",
|
|
72
|
+
"components",
|
|
74
73
|
"modal",
|
|
75
74
|
"pagination",
|
|
75
|
+
"progressbar",
|
|
76
76
|
"rating",
|
|
77
|
-
"slider"
|
|
77
|
+
"slider",
|
|
78
|
+
"toast",
|
|
79
|
+
"widgets"
|
|
78
80
|
]
|
|
79
81
|
}
|
package/types.d.ts
CHANGED
|
@@ -18,3 +18,4 @@ export type AdaptWidgetFactories<T> = {
|
|
|
18
18
|
[K in keyof T]: T[K] extends WidgetFactory<infer U> ? WidgetFactory<AdaptWidgetSlots<U>> : T[K];
|
|
19
19
|
};
|
|
20
20
|
export type AdaptWidgetSlots<W extends Widget> = Widget<AdaptPropsSlots<WidgetProps<W>>, AdaptPropsSlots<WidgetState<W>>, AdaptWidgetFactories<W['api']>, W['actions'], W['directives']>;
|
|
21
|
+
export type PropType<Props, K extends keyof Props> = Props[K];
|
package/utils/widget.d.ts
CHANGED
|
@@ -14,13 +14,13 @@ import type { SlotContent, SlotSvelteComponent, SlotsPresent, WidgetFactory, Wid
|
|
|
14
14
|
*/
|
|
15
15
|
export declare const callWidgetFactoryWithConfig: <W extends Widget>({ factory, $$slots, defaultConfig, widgetConfig, events, $$props, }: {
|
|
16
16
|
factory: WidgetFactory<W>;
|
|
17
|
-
$$slots
|
|
18
|
-
defaultConfig?:
|
|
19
|
-
widgetConfig?:
|
|
20
|
-
events
|
|
21
|
-
$$props: WidgetProps<W
|
|
17
|
+
$$slots?: SlotsPresent<WidgetProps<W>>;
|
|
18
|
+
defaultConfig?: Partial<WidgetProps<W>> | ReadableSignal<Partial<WidgetProps<W>> | undefined>;
|
|
19
|
+
widgetConfig?: null | undefined | ReadableSignal<Partial<WidgetProps<W>> | undefined>;
|
|
20
|
+
events?: Pick<WidgetProps<W>, keyof WidgetProps<W> & `on${string}Change`>;
|
|
21
|
+
$$props: Partial<WidgetProps<W>>;
|
|
22
22
|
}) => W & {
|
|
23
|
-
patchChangedProps: W[
|
|
23
|
+
patchChangedProps: W['patch'];
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
26
|
* A type guard checking if a provided slot content is a Svelte component.
|
|
@@ -28,4 +28,4 @@ export declare const callWidgetFactoryWithConfig: <W extends Widget>({ factory,
|
|
|
28
28
|
* @param content - the slot content
|
|
29
29
|
* @returns true if the slot content is a svelte component
|
|
30
30
|
*/
|
|
31
|
-
export declare const isSvelteComponent: <Props extends object>(content:
|
|
31
|
+
export declare const isSvelteComponent: <Props extends object>(content: SlotContent<Props>) => content is SlotSvelteComponent<Props>;
|
package/utils/widget.js
CHANGED
|
@@ -51,14 +51,18 @@ const eventStore = (event, prop) => {
|
|
|
51
51
|
export const callWidgetFactoryWithConfig = ({ factory, $$slots, defaultConfig, widgetConfig, events, $$props, }) => {
|
|
52
52
|
const defaultConfig$ = toReadableStore(defaultConfig);
|
|
53
53
|
const processedSlots = {};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
if ($$slots) {
|
|
55
|
+
for (const [name, present] of Object.entries($$slots)) {
|
|
56
|
+
if (present) {
|
|
57
|
+
processedSlots[`slot${name[0].toUpperCase()}${name.substring(1)}`] = useSvelteSlot;
|
|
58
|
+
}
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
const props = { ...$$props };
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
if (events) {
|
|
63
|
+
for (const event of Object.keys(events)) {
|
|
64
|
+
props[event] = eventStore(events[event], $$props[event]);
|
|
65
|
+
}
|
|
62
66
|
}
|
|
63
67
|
const widget = factory({
|
|
64
68
|
config: computed(() => ({ ...defaultConfig$(), ...widgetConfig?.(), ...processedSlots })),
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@agnos-ui/core/services/transitions/bootstrap';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@agnos-ui/core/services/transitions/bootstrap';
|