@agnos-ui/react-headless 0.10.0-next.1 → 0.10.0-next.3
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/generated/index.d.ts +1 -0
- package/generated/services/pointerdownPosition.cjs +9 -0
- package/generated/services/pointerdownPosition.d.ts +1 -0
- package/generated/services/pointerdownPosition.js +1 -0
- package/index.cjs +7 -0
- package/index.js +1 -0
- package/package.json +2 -2
- package/slot.cjs +4 -18
- package/slot.d.ts +1 -1
- package/slot.js +4 -18
package/generated/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './services/siblingsInert';
|
|
2
2
|
export * from './services/resizeObserver';
|
|
3
3
|
export * from './services/portal';
|
|
4
|
+
export * from './services/pointerdownPosition';
|
|
4
5
|
export * from './services/navManager';
|
|
5
6
|
export * from './services/matchMedia';
|
|
6
7
|
export * from './services/intersection';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const pointerdownPosition = require("@agnos-ui/core/services/pointerdownPosition");
|
|
4
|
+
Object.keys(pointerdownPosition).forEach((k) => {
|
|
5
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: () => pointerdownPosition[k]
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/services/pointerdownPosition';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@agnos-ui/core/services/pointerdownPosition";
|
package/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const siblingsInert = require("@agnos-ui/core/services/siblingsInert");
|
|
4
4
|
const resizeObserver = require("@agnos-ui/core/services/resizeObserver");
|
|
5
5
|
const portal = require("@agnos-ui/core/services/portal");
|
|
6
|
+
const pointerdownPosition = require("@agnos-ui/core/services/pointerdownPosition");
|
|
6
7
|
const navManager = require("@agnos-ui/core/services/navManager");
|
|
7
8
|
const matchMedia = require("@agnos-ui/core/services/matchMedia");
|
|
8
9
|
const intersection = require("@agnos-ui/core/services/intersection");
|
|
@@ -78,6 +79,12 @@ Object.keys(portal).forEach((k) => {
|
|
|
78
79
|
get: () => portal[k]
|
|
79
80
|
});
|
|
80
81
|
});
|
|
82
|
+
Object.keys(pointerdownPosition).forEach((k) => {
|
|
83
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
get: () => pointerdownPosition[k]
|
|
86
|
+
});
|
|
87
|
+
});
|
|
81
88
|
Object.keys(navManager).forEach((k) => {
|
|
82
89
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
83
90
|
enumerable: true,
|
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "@agnos-ui/core/services/siblingsInert";
|
|
2
2
|
export * from "@agnos-ui/core/services/resizeObserver";
|
|
3
3
|
export * from "@agnos-ui/core/services/portal";
|
|
4
|
+
export * from "@agnos-ui/core/services/pointerdownPosition";
|
|
4
5
|
export * from "@agnos-ui/core/services/navManager";
|
|
5
6
|
export * from "@agnos-ui/core/services/matchMedia";
|
|
6
7
|
export * from "@agnos-ui/core/services/intersection";
|
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.10.0-next.
|
|
4
|
+
"version": "0.10.0-next.3",
|
|
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.10.0-next.
|
|
52
|
+
"@agnos-ui/core": "0.10.0-next.3"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@amadeus-it-group/tansu": "^2.0.0",
|
package/slot.cjs
CHANGED
|
@@ -2,26 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const react = require("react");
|
|
5
|
-
const slotWrapperCache = /* @__PURE__ */ new WeakMap();
|
|
6
|
-
const slotWrapperFactory = (slotContent) => {
|
|
7
|
-
const SlotWrapper = (props) => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: slotContent(props) });
|
|
8
|
-
return SlotWrapper;
|
|
9
|
-
};
|
|
10
|
-
const slotWrapper = (slotContent) => {
|
|
11
|
-
let res = slotWrapperCache.get(slotContent);
|
|
12
|
-
if (!res) {
|
|
13
|
-
res = slotWrapperFactory(slotContent);
|
|
14
|
-
slotWrapperCache.set(slotContent, res);
|
|
15
|
-
}
|
|
16
|
-
return res;
|
|
17
|
-
};
|
|
18
5
|
const isReactComponent = (item) => item.prototype instanceof react.Component;
|
|
19
|
-
const Slot = ({ slotContent, props }) => {
|
|
20
|
-
const isFunction = typeof
|
|
6
|
+
const Slot = ({ slotContent: SlotContent, props }) => {
|
|
7
|
+
const isFunction = typeof SlotContent === "function";
|
|
21
8
|
if (isFunction) {
|
|
22
|
-
|
|
23
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SlotComponent, { ...props });
|
|
9
|
+
return isReactComponent(SlotContent) ? /* @__PURE__ */ jsxRuntime.jsx(SlotContent, { ...props }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: SlotContent(props) });
|
|
24
10
|
}
|
|
25
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children:
|
|
11
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: SlotContent });
|
|
26
12
|
};
|
|
27
13
|
exports.Slot = Slot;
|
package/slot.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { SlotContent } from './types';
|
|
|
9
9
|
* @param parameter.props - the react component props
|
|
10
10
|
* @returns the slot component
|
|
11
11
|
*/
|
|
12
|
-
export declare const Slot: <Props extends object>({ slotContent, props }: {
|
|
12
|
+
export declare const Slot: <Props extends object>({ slotContent: SlotContent, props }: {
|
|
13
13
|
slotContent: SlotContent<Props>;
|
|
14
14
|
props: Props;
|
|
15
15
|
}) => import("react/jsx-runtime").JSX.Element;
|
package/slot.js
CHANGED
|
@@ -1,26 +1,12 @@
|
|
|
1
1
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Component } from "react";
|
|
3
|
-
const slotWrapperCache = /* @__PURE__ */ new WeakMap();
|
|
4
|
-
const slotWrapperFactory = (slotContent) => {
|
|
5
|
-
const SlotWrapper = (props) => /* @__PURE__ */ jsx(Fragment, { children: slotContent(props) });
|
|
6
|
-
return SlotWrapper;
|
|
7
|
-
};
|
|
8
|
-
const slotWrapper = (slotContent) => {
|
|
9
|
-
let res = slotWrapperCache.get(slotContent);
|
|
10
|
-
if (!res) {
|
|
11
|
-
res = slotWrapperFactory(slotContent);
|
|
12
|
-
slotWrapperCache.set(slotContent, res);
|
|
13
|
-
}
|
|
14
|
-
return res;
|
|
15
|
-
};
|
|
16
3
|
const isReactComponent = (item) => item.prototype instanceof Component;
|
|
17
|
-
const Slot = ({ slotContent, props }) => {
|
|
18
|
-
const isFunction = typeof
|
|
4
|
+
const Slot = ({ slotContent: SlotContent, props }) => {
|
|
5
|
+
const isFunction = typeof SlotContent === "function";
|
|
19
6
|
if (isFunction) {
|
|
20
|
-
|
|
21
|
-
return /* @__PURE__ */ jsx(SlotComponent, { ...props });
|
|
7
|
+
return isReactComponent(SlotContent) ? /* @__PURE__ */ jsx(SlotContent, { ...props }) : /* @__PURE__ */ jsx(Fragment, { children: SlotContent(props) });
|
|
22
8
|
}
|
|
23
|
-
return /* @__PURE__ */ jsx(Fragment, { children:
|
|
9
|
+
return /* @__PURE__ */ jsx(Fragment, { children: SlotContent });
|
|
24
10
|
};
|
|
25
11
|
export {
|
|
26
12
|
Slot
|