@agnos-ui/svelte-headless 0.0.1-alpha.5 → 0.0.1-alpha.7

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.
@@ -0,0 +1 @@
1
+ export * from './accordion';
@@ -0,0 +1 @@
1
+ export * from './accordion';
@@ -0,0 +1 @@
1
+ export * from './alert';
@@ -0,0 +1 @@
1
+ export * from './alert';
@@ -0,0 +1 @@
1
+ export * from './modal';
@@ -0,0 +1 @@
1
+ export * from './modal';
@@ -0,0 +1 @@
1
+ export * from './pagination';
@@ -0,0 +1 @@
1
+ export * from './pagination';
@@ -0,0 +1 @@
1
+ export * from './progressbar';
@@ -0,0 +1 @@
1
+ export * from './progressbar';
@@ -0,0 +1 @@
1
+ export * from './rating';
@@ -0,0 +1 @@
1
+ export * from './rating';
@@ -0,0 +1 @@
1
+ export * from './select';
@@ -0,0 +1 @@
1
+ export * from './select';
@@ -0,0 +1 @@
1
+ export * from './slider';
@@ -0,0 +1 @@
1
+ export * from './slider';
package/config.d.ts CHANGED
@@ -19,6 +19,14 @@ type AdaptParentConfig<Config> = (config: Partial2Levels<Config>) => Partial2Lev
19
19
  type CreateWidgetsDefaultConfig<Config extends {
20
20
  [widgetName: string]: object;
21
21
  }> = (adaptParentConfig?: AdaptParentConfig<Config>) => WidgetsConfigStore<Config>;
22
+ /**
23
+ * A factory to create the utilities to allow widgets to be context-aware.
24
+ *
25
+ * It can be used when extending the core and creating new widgets.
26
+ *
27
+ * @param widgetsDefaultConfigKey - the widgets config key
28
+ * @returns the utilities to create / manage widgets and contexts
29
+ */
22
30
  export declare const widgetsConfigFactory: <Config extends {
23
31
  [widgetName: string]: object;
24
32
  } = WidgetsConfig>(widgetsDefaultConfigKey?: symbol) => {
package/config.js CHANGED
@@ -3,6 +3,14 @@ import { computed } from '@amadeus-it-group/tansu';
3
3
  import { getContext, setContext } from 'svelte';
4
4
  import { callWidgetFactoryWithConfig } from './utils/widget';
5
5
  export * from '@agnos-ui/core/config';
6
+ /**
7
+ * A factory to create the utilities to allow widgets to be context-aware.
8
+ *
9
+ * It can be used when extending the core and creating new widgets.
10
+ *
11
+ * @param widgetsDefaultConfigKey - the widgets config key
12
+ * @returns the utilities to create / manage widgets and contexts
13
+ */
6
14
  export const widgetsConfigFactory = (widgetsDefaultConfigKey = Symbol('widgetsConfig')) => {
7
15
  /**
8
16
  * Creates in the Svelte context hierarchy a new widgets default configuration store that inherits from any widgets default configuration
@@ -10,11 +10,11 @@ export * from './services/transitions/cssTransitions';
10
10
  export * from './services/transitions/collapse';
11
11
  export * from './services/transitions/bootstrap';
12
12
  export * from './services/transitions/baseTransitions';
13
- export * from './types';
14
- export * from './config';
15
13
  export * from './utils/writables';
16
14
  export * from './utils/stores';
17
15
  export * from './utils/directive';
16
+ export * from './types';
17
+ export * from './config';
18
18
  export * from './utils/widget';
19
19
  export * from './slot';
20
20
  export * from './Slot.svelte.d';
@@ -10,11 +10,11 @@ export * from './services/transitions/cssTransitions';
10
10
  export * from './services/transitions/collapse';
11
11
  export * from './services/transitions/bootstrap';
12
12
  export * from './services/transitions/baseTransitions';
13
- export * from './types';
14
- export * from './config';
15
13
  export * from './utils/writables';
16
14
  export * from './utils/stores';
17
15
  export * from './utils/directive';
16
+ export * from './types';
17
+ export * from './config';
18
18
  export * from './utils/widget';
19
19
  export * from './slot';
20
20
  export * from './Slot.svelte.d';
package/package.json CHANGED
@@ -48,14 +48,14 @@
48
48
  }
49
49
  },
50
50
  "dependencies": {
51
- "@agnos-ui/core": "0.0.1-alpha.5",
52
- "@amadeus-it-group/tansu": "0.0.24"
51
+ "@agnos-ui/core": "0.0.1-alpha.7",
52
+ "@amadeus-it-group/tansu": "1.0.0"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "svelte": "*"
56
56
  },
57
57
  "sideEffects": false,
58
- "version": "0.0.1-alpha.5",
58
+ "version": "0.0.1-alpha.7",
59
59
  "homepage": "https://amadeusitgroup.github.io/AgnosUI/latest/",
60
60
  "bugs": "https://github.com/AmadeusITGroup/AgnosUI/issues",
61
61
  "license": "MIT",
package/utils/widget.d.ts CHANGED
@@ -1,5 +1,17 @@
1
1
  import type { ReadableSignal } from '@amadeus-it-group/tansu';
2
2
  import type { SlotContent, SlotSvelteComponent, SlotsPresent, WidgetFactory, WidgetProps } from '../types';
3
+ /**
4
+ * Call a widget factory using provided configs.
5
+ *
6
+ * @param parameter - the parameter
7
+ * @param parameter.factory - the widget factory to call
8
+ * @param parameter.$$slots - the slots of the widget
9
+ * @param parameter.defaultConfig - the default config of the widget
10
+ * @param parameter.widgetConfig - the config of the widget, overriding the defaultConfig
11
+ * @param parameter.events - the events of the widget
12
+ * @param parameter.$$props - the props of the widget
13
+ * @returns the widget
14
+ */
3
15
  export declare const callWidgetFactoryWithConfig: <W extends Widget>({ factory, $$slots, defaultConfig, widgetConfig, events, $$props, }: {
4
16
  factory: WidgetFactory<W>;
5
17
  $$slots: SlotsPresent<WidgetProps<W>>;
@@ -10,4 +22,10 @@ export declare const callWidgetFactoryWithConfig: <W extends Widget>({ factory,
10
22
  }) => W & {
11
23
  patchChangedProps: W["patch"];
12
24
  };
25
+ /**
26
+ * A type guard checking if a provided slot content is a Svelte component.
27
+ *
28
+ * @param content - the slot content
29
+ * @returns true if the slot content is a svelte component
30
+ */
13
31
  export declare const isSvelteComponent: <Props extends object>(content: any) => content is SlotSvelteComponent<Props>;
package/utils/widget.js CHANGED
@@ -24,7 +24,9 @@ const mergeEventFns = (fn1, fn2) => fn2
24
24
  : fn1;
25
25
  /**
26
26
  * Creates a writable store to be used for an event handler.
27
+ *
27
28
  * @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
29
+ * @param prop - the initial value of the store
28
30
  * @returns a writable store to be used for an event handler
29
31
  */
30
32
  const eventStore = (event, prop) => {
@@ -34,6 +36,18 @@ const eventStore = (event, prop) => {
34
36
  update: store$.update,
35
37
  });
36
38
  };
39
+ /**
40
+ * Call a widget factory using provided configs.
41
+ *
42
+ * @param parameter - the parameter
43
+ * @param parameter.factory - the widget factory to call
44
+ * @param parameter.$$slots - the slots of the widget
45
+ * @param parameter.defaultConfig - the default config of the widget
46
+ * @param parameter.widgetConfig - the config of the widget, overriding the defaultConfig
47
+ * @param parameter.events - the events of the widget
48
+ * @param parameter.$$props - the props of the widget
49
+ * @returns the widget
50
+ */
37
51
  export const callWidgetFactoryWithConfig = ({ factory, $$slots, defaultConfig, widgetConfig, events, $$props, }) => {
38
52
  const defaultConfig$ = toReadableStore(defaultConfig);
39
53
  const processedSlots = {};
@@ -52,6 +66,12 @@ export const callWidgetFactoryWithConfig = ({ factory, $$slots, defaultConfig, w
52
66
  });
53
67
  return { ...widget, patchChangedProps: createPatchChangedProps($$props, widget.patch) };
54
68
  };
69
+ /**
70
+ * A type guard checking if a provided slot content is a Svelte component.
71
+ *
72
+ * @param content - the slot content
73
+ * @returns true if the slot content is a svelte component
74
+ */
55
75
  export const isSvelteComponent = (content) => {
56
76
  // in prod mode, a svelte component has $set on its prototype
57
77
  // in dev mode with hmr (hot module reload), a svelte component has nothing on its prototype, but its name starts with Proxy<