@agnos-ui/react-headless 0.5.0 → 0.6.0-next.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/tree/index.d.ts +1 -0
- package/components/tree/tree.d.ts +1 -0
- package/config.cjs +8 -4
- package/config.js +9 -5
- package/generated/components/tree/index.cjs +9 -0
- package/generated/components/tree/index.d.ts +1 -0
- package/generated/components/tree/index.js +1 -0
- package/generated/index.d.ts +1 -0
- package/index.cjs +7 -0
- package/index.js +1 -0
- package/package.json +2 -2
- package/utils/directive.d.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tree';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/components/tree';
|
package/config.cjs
CHANGED
|
@@ -10,20 +10,24 @@ const widgetsConfigFactory = (widgetsConfigContext2 = react.createContext(void 0
|
|
|
10
10
|
const useWidgetContext2 = (widgetName, defaultConfig) => {
|
|
11
11
|
const widgetsConfig = react.useContext(widgetsConfigContext2);
|
|
12
12
|
const defaultConfig$ = stores.usePropsAsStore(defaultConfig);
|
|
13
|
-
return react.useMemo(
|
|
13
|
+
return react.useMemo(
|
|
14
|
+
() => tansu.computed(() => ({ ...defaultConfig$(), ...widgetName ? widgetsConfig == null ? void 0 : widgetsConfig()[widgetName] : void 0 })),
|
|
15
|
+
[defaultConfig$, widgetName, widgetsConfig]
|
|
16
|
+
);
|
|
14
17
|
};
|
|
15
18
|
const useWidgetWithConfig2 = (factory, props, widgetName, defaultProps) => widget.useWidget(factory, props, { config: useWidgetContext2(widgetName, defaultProps) });
|
|
16
19
|
const WidgetsDefaultConfig2 = ({ children, adaptParentConfig, ...props }) => {
|
|
17
20
|
const config$ = react.useContext(widgetsConfigContext2);
|
|
18
|
-
|
|
21
|
+
const storeRecreated = react.useRef(false);
|
|
22
|
+
storeRecreated.current = false;
|
|
19
23
|
const store$ = react.useMemo(() => {
|
|
20
24
|
const store = config.createWidgetsConfig(config$, adaptParentConfig);
|
|
21
25
|
store.set(props);
|
|
22
|
-
storeRecreated = true;
|
|
26
|
+
storeRecreated.current = true;
|
|
23
27
|
return store;
|
|
24
28
|
}, [config$, adaptParentConfig]);
|
|
25
29
|
react.useEffect(() => {
|
|
26
|
-
if (!storeRecreated) {
|
|
30
|
+
if (!storeRecreated.current) {
|
|
27
31
|
store$.set(props);
|
|
28
32
|
}
|
|
29
33
|
}, [props]);
|
package/config.js
CHANGED
|
@@ -2,27 +2,31 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { createWidgetsConfig } from "@agnos-ui/core/config";
|
|
3
3
|
export * from "@agnos-ui/core/config";
|
|
4
4
|
import { computed } from "@amadeus-it-group/tansu";
|
|
5
|
-
import { createContext, useContext, useMemo, useEffect } from "react";
|
|
5
|
+
import { createContext, useContext, useMemo, useRef, useEffect } from "react";
|
|
6
6
|
import { u as useWidget } from "./widget-DaA-pe23.js";
|
|
7
7
|
import { b as usePropsAsStore } from "./stores-B90XF8Sy.js";
|
|
8
8
|
const widgetsConfigFactory = (widgetsConfigContext2 = createContext(void 0)) => {
|
|
9
9
|
const useWidgetContext2 = (widgetName, defaultConfig) => {
|
|
10
10
|
const widgetsConfig = useContext(widgetsConfigContext2);
|
|
11
11
|
const defaultConfig$ = usePropsAsStore(defaultConfig);
|
|
12
|
-
return useMemo(
|
|
12
|
+
return useMemo(
|
|
13
|
+
() => computed(() => ({ ...defaultConfig$(), ...widgetName ? widgetsConfig == null ? void 0 : widgetsConfig()[widgetName] : void 0 })),
|
|
14
|
+
[defaultConfig$, widgetName, widgetsConfig]
|
|
15
|
+
);
|
|
13
16
|
};
|
|
14
17
|
const useWidgetWithConfig2 = (factory, props, widgetName, defaultProps) => useWidget(factory, props, { config: useWidgetContext2(widgetName, defaultProps) });
|
|
15
18
|
const WidgetsDefaultConfig2 = ({ children, adaptParentConfig, ...props }) => {
|
|
16
19
|
const config$ = useContext(widgetsConfigContext2);
|
|
17
|
-
|
|
20
|
+
const storeRecreated = useRef(false);
|
|
21
|
+
storeRecreated.current = false;
|
|
18
22
|
const store$ = useMemo(() => {
|
|
19
23
|
const store = createWidgetsConfig(config$, adaptParentConfig);
|
|
20
24
|
store.set(props);
|
|
21
|
-
storeRecreated = true;
|
|
25
|
+
storeRecreated.current = true;
|
|
22
26
|
return store;
|
|
23
27
|
}, [config$, adaptParentConfig]);
|
|
24
28
|
useEffect(() => {
|
|
25
|
-
if (!storeRecreated) {
|
|
29
|
+
if (!storeRecreated.current) {
|
|
26
30
|
store$.set(props);
|
|
27
31
|
}
|
|
28
32
|
}, [props]);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const tree = require("@agnos-ui/core/components/tree");
|
|
4
|
+
Object.keys(tree).forEach((k) => {
|
|
5
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: () => tree[k]
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/components/tree';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@agnos-ui/core/components/tree";
|
package/generated/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export * from './config';
|
|
|
20
20
|
export * from './utils/widget';
|
|
21
21
|
export * from './utils/portal';
|
|
22
22
|
export * from './slot';
|
|
23
|
+
export * from './components/tree/index';
|
|
23
24
|
export * from './components/toast/index';
|
|
24
25
|
export * from './components/slider/index';
|
|
25
26
|
export * from './components/select/index';
|
package/index.cjs
CHANGED
|
@@ -25,6 +25,7 @@ const config = require("./config.cjs");
|
|
|
25
25
|
const widget = require("./widget-e5vBb0i4.cjs");
|
|
26
26
|
const portal$1 = require("./portal-B0Q5KLrA.cjs");
|
|
27
27
|
const slot = require("./slot.cjs");
|
|
28
|
+
const tree = require("@agnos-ui/core/components/tree");
|
|
28
29
|
const toast = require("@agnos-ui/core/components/toast");
|
|
29
30
|
const slider = require("@agnos-ui/core/components/slider");
|
|
30
31
|
const select = require("@agnos-ui/core/components/select");
|
|
@@ -163,6 +164,12 @@ Object.keys(config$1).forEach((k) => {
|
|
|
163
164
|
get: () => config$1[k]
|
|
164
165
|
});
|
|
165
166
|
});
|
|
167
|
+
Object.keys(tree).forEach((k) => {
|
|
168
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
169
|
+
enumerable: true,
|
|
170
|
+
get: () => tree[k]
|
|
171
|
+
});
|
|
172
|
+
});
|
|
166
173
|
Object.keys(toast).forEach((k) => {
|
|
167
174
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
168
175
|
enumerable: true,
|
package/index.js
CHANGED
|
@@ -23,6 +23,7 @@ import { WidgetsDefaultConfig, useWidgetContext, useWidgetWithConfig, widgetsCon
|
|
|
23
23
|
import { u as u3 } from "./widget-DaA-pe23.js";
|
|
24
24
|
import { P } from "./portal-CX8X69NK.js";
|
|
25
25
|
import { Slot } from "./slot.js";
|
|
26
|
+
export * from "@agnos-ui/core/components/tree";
|
|
26
27
|
export * from "@agnos-ui/core/components/toast";
|
|
27
28
|
export * from "@agnos-ui/core/components/slider";
|
|
28
29
|
export * from "@agnos-ui/core/components/select";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agnos-ui/react-headless",
|
|
3
3
|
"description": "Headless component library for React.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.0-next.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.cjs",
|
|
7
7
|
"module": "./index.js",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@agnos-ui/core": "0.
|
|
52
|
+
"@agnos-ui/core": "0.6.0-next.0",
|
|
53
53
|
"classnames": "^2.5.1"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
package/utils/directive.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from '@agnos-ui/core/utils/directive';
|
|
|
4
4
|
/**
|
|
5
5
|
* Returns an object with the key/value attributes for JSX, derived from a list of directives.
|
|
6
6
|
*
|
|
7
|
+
* @template T — An array type representing the parameters for the directives.
|
|
7
8
|
* @param directives - List of directives to generate attributes from. Each parameter can be the directive or an array with the directive and its parameter
|
|
8
9
|
* @returns JSON object with key/value pairs to be applied on a JSX node.
|
|
9
10
|
*/
|