@contember/react-binding 1.3.0-alpha.2 → 1.3.0-alpha.21
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/dist/development/MarkerTreeGenerator.cjs +2 -2
- package/dist/development/MarkerTreeGenerator.cjs.map +1 -1
- package/dist/development/MarkerTreeGenerator.js +2 -2
- package/dist/development/MarkerTreeGenerator.js.map +1 -1
- package/dist/development/accessorPropagation/BindingOperationsContext.cjs.map +1 -1
- package/dist/development/accessorPropagation/BindingOperationsContext.js.map +1 -1
- package/dist/development/accessorPropagation/EnvironmentContext.cjs +4 -4
- package/dist/development/accessorPropagation/EnvironmentContext.cjs.map +1 -1
- package/dist/development/accessorPropagation/EnvironmentContext.js +4 -4
- package/dist/development/accessorPropagation/EnvironmentContext.js.map +1 -1
- package/dist/development/accessorPropagation/useEntityListSubTreeLoader.cjs +47 -0
- package/dist/development/accessorPropagation/useEntityListSubTreeLoader.cjs.map +1 -0
- package/dist/development/accessorPropagation/useEntityListSubTreeLoader.js +47 -0
- package/dist/development/accessorPropagation/useEntityListSubTreeLoader.js.map +1 -0
- package/dist/development/accessorPropagation/useExtendTree.cjs.map +1 -1
- package/dist/development/accessorPropagation/useExtendTree.js.map +1 -1
- package/dist/development/accessorSorting/SetOrderFieldOnCreate.cjs +9 -9
- package/dist/development/accessorSorting/SetOrderFieldOnCreate.cjs.map +1 -1
- package/dist/development/accessorSorting/SetOrderFieldOnCreate.js +9 -9
- package/dist/development/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
- package/dist/development/accessorSorting/errors.cjs.map +1 -1
- package/dist/development/accessorSorting/errors.js.map +1 -1
- package/dist/development/accessorSorting/sortEntities.cjs +1 -4
- package/dist/development/accessorSorting/sortEntities.cjs.map +1 -1
- package/dist/development/accessorSorting/sortEntities.js +1 -4
- package/dist/development/accessorSorting/sortEntities.js.map +1 -1
- package/dist/development/accessorTree/AccessorTree.cjs +5 -5
- package/dist/development/accessorTree/AccessorTree.cjs.map +1 -1
- package/dist/development/accessorTree/AccessorTree.js +5 -5
- package/dist/development/accessorTree/AccessorTree.js.map +1 -1
- package/dist/development/accessorTree/useDataBinding.cjs.map +1 -1
- package/dist/development/accessorTree/useDataBinding.js.map +1 -1
- package/dist/development/coreComponents/Component.cjs.map +1 -1
- package/dist/development/coreComponents/Component.js.map +1 -1
- package/dist/development/coreComponents/Entity.cjs +1 -1
- package/dist/development/coreComponents/Entity.cjs.map +1 -1
- package/dist/development/coreComponents/Entity.js +1 -1
- package/dist/development/coreComponents/Entity.js.map +1 -1
- package/dist/development/coreComponents/EntityList.cjs +3 -3
- package/dist/development/coreComponents/EntityList.cjs.map +1 -1
- package/dist/development/coreComponents/EntityList.js +3 -3
- package/dist/development/coreComponents/EntityList.js.map +1 -1
- package/dist/development/coreComponents/EntityListSubTree.cjs +3 -3
- package/dist/development/coreComponents/EntityListSubTree.cjs.map +1 -1
- package/dist/development/coreComponents/EntityListSubTree.js +3 -3
- package/dist/development/coreComponents/EntityListSubTree.js.map +1 -1
- package/dist/development/coreComponents/EntitySubTree.cjs +5 -5
- package/dist/development/coreComponents/EntitySubTree.cjs.map +1 -1
- package/dist/development/coreComponents/EntitySubTree.js +5 -5
- package/dist/development/coreComponents/EntitySubTree.js.map +1 -1
- package/dist/development/coreComponents/Field.cjs +2 -2
- package/dist/development/coreComponents/Field.cjs.map +1 -1
- package/dist/development/coreComponents/Field.js +2 -2
- package/dist/development/coreComponents/Field.js.map +1 -1
- package/dist/development/coreComponents/HasMany.cjs +3 -3
- package/dist/development/coreComponents/HasMany.cjs.map +1 -1
- package/dist/development/coreComponents/HasMany.js +3 -3
- package/dist/development/coreComponents/HasMany.js.map +1 -1
- package/dist/development/coreComponents/HasOne.cjs +3 -3
- package/dist/development/coreComponents/HasOne.cjs.map +1 -1
- package/dist/development/coreComponents/HasOne.js +3 -3
- package/dist/development/coreComponents/HasOne.js.map +1 -1
- package/dist/development/coreComponents/ParentEntity.cjs +1 -1
- package/dist/development/coreComponents/ParentEntity.cjs.map +1 -1
- package/dist/development/coreComponents/ParentEntity.js +1 -1
- package/dist/development/coreComponents/ParentEntity.js.map +1 -1
- package/dist/development/helperComponents/DeferredSubTrees.cjs +4 -4
- package/dist/development/helperComponents/DeferredSubTrees.cjs.map +1 -1
- package/dist/development/helperComponents/DeferredSubTrees.js +4 -4
- package/dist/development/helperComponents/DeferredSubTrees.js.map +1 -1
- package/dist/development/helperComponents/FieldView.cjs +3 -3
- package/dist/development/helperComponents/FieldView.cjs.map +1 -1
- package/dist/development/helperComponents/FieldView.js +3 -3
- package/dist/development/helperComponents/FieldView.js.map +1 -1
- package/dist/development/helperComponents/If.cjs +8 -8
- package/dist/development/helperComponents/If.cjs.map +1 -1
- package/dist/development/helperComponents/If.js +8 -8
- package/dist/development/helperComponents/If.js.map +1 -1
- package/dist/development/helperComponents/LabelMiddleware.cjs +1 -1
- package/dist/development/helperComponents/LabelMiddleware.cjs.map +1 -1
- package/dist/development/helperComponents/LabelMiddleware.js +1 -1
- package/dist/development/helperComponents/LabelMiddleware.js.map +1 -1
- package/dist/development/helperComponents/StaticRender.cjs +1 -1
- package/dist/development/helperComponents/StaticRender.cjs.map +1 -1
- package/dist/development/helperComponents/StaticRender.js +1 -1
- package/dist/development/helperComponents/StaticRender.js.map +1 -1
- package/dist/development/helperComponents/SugaredField.cjs +2 -2
- package/dist/development/helperComponents/SugaredField.cjs.map +1 -1
- package/dist/development/helperComponents/SugaredField.js +2 -2
- package/dist/development/helperComponents/SugaredField.js.map +1 -1
- package/dist/development/helperComponents/helpers/FilterFieldsCollector.cjs.map +1 -1
- package/dist/development/helperComponents/helpers/FilterFieldsCollector.js.map +1 -1
- package/dist/development/index.cjs +3 -1
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +2 -0
- package/dist/development/index.js.map +1 -1
- package/dist/production/MarkerTreeGenerator.cjs +2 -2
- package/dist/production/MarkerTreeGenerator.cjs.map +1 -1
- package/dist/production/MarkerTreeGenerator.js +2 -2
- package/dist/production/MarkerTreeGenerator.js.map +1 -1
- package/dist/production/accessorPropagation/BindingOperationsContext.cjs.map +1 -1
- package/dist/production/accessorPropagation/BindingOperationsContext.js.map +1 -1
- package/dist/production/accessorPropagation/EnvironmentContext.cjs.map +1 -1
- package/dist/production/accessorPropagation/EnvironmentContext.js.map +1 -1
- package/dist/production/accessorPropagation/useEntityListSubTreeLoader.cjs +47 -0
- package/dist/production/accessorPropagation/useEntityListSubTreeLoader.cjs.map +1 -0
- package/dist/production/accessorPropagation/useEntityListSubTreeLoader.js +47 -0
- package/dist/production/accessorPropagation/useEntityListSubTreeLoader.js.map +1 -0
- package/dist/production/accessorPropagation/useExtendTree.cjs.map +1 -1
- package/dist/production/accessorPropagation/useExtendTree.js.map +1 -1
- package/dist/production/accessorSorting/errors.cjs.map +1 -1
- package/dist/production/accessorSorting/errors.js.map +1 -1
- package/dist/production/accessorSorting/sortEntities.cjs +1 -4
- package/dist/production/accessorSorting/sortEntities.cjs.map +1 -1
- package/dist/production/accessorSorting/sortEntities.js +1 -4
- package/dist/production/accessorSorting/sortEntities.js.map +1 -1
- package/dist/production/accessorTree/useDataBinding.cjs.map +1 -1
- package/dist/production/accessorTree/useDataBinding.js.map +1 -1
- package/dist/production/coreComponents/Component.cjs.map +1 -1
- package/dist/production/coreComponents/Component.js.map +1 -1
- package/dist/production/helperComponents/helpers/FilterFieldsCollector.cjs.map +1 -1
- package/dist/production/helperComponents/helpers/FilterFieldsCollector.js.map +1 -1
- package/dist/production/index.cjs +3 -1
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +2 -0
- package/dist/production/index.js.map +1 -1
- package/dist/types/accessorPropagation/AccessorProvider.d.ts +1 -1
- package/dist/types/accessorPropagation/AccessorProvider.d.ts.map +1 -1
- package/dist/types/accessorPropagation/BindingOperationsProvider.d.ts +1 -1
- package/dist/types/accessorPropagation/BindingOperationsProvider.d.ts.map +1 -1
- package/dist/types/accessorPropagation/EntityKeyProvider.d.ts +1 -1
- package/dist/types/accessorPropagation/EntityKeyProvider.d.ts.map +1 -1
- package/dist/types/accessorPropagation/EnvironmentContext.d.ts +3 -3
- package/dist/types/accessorPropagation/EnvironmentContext.d.ts.map +1 -1
- package/dist/types/accessorPropagation/TreeRootIdProvider.d.ts +1 -1
- package/dist/types/accessorPropagation/TreeRootIdProvider.d.ts.map +1 -1
- package/dist/types/accessorPropagation/index.d.ts +1 -0
- package/dist/types/accessorPropagation/index.d.ts.map +1 -1
- package/dist/types/accessorPropagation/useEntityListSubTreeLoader.d.ts +10 -0
- package/dist/types/accessorPropagation/useEntityListSubTreeLoader.d.ts.map +1 -0
- package/dist/types/accessorSorting/sortEntities.d.ts.map +1 -1
- package/dist/types/accessorTree/AccessorTree.d.ts +1 -1
- package/dist/types/coreComponents/Component.d.ts +3 -3
- package/dist/types/coreComponents/Component.d.ts.map +1 -1
- package/dist/types/coreComponents/MarkerProvider.d.ts +2 -2
- package/dist/types/coreComponents/MarkerProvider.d.ts.map +1 -1
- package/dist/types/helperComponents/EntityView.d.ts +1 -1
- package/dist/types/helperComponents/EntityView.d.ts.map +1 -1
- package/dist/types/helperComponents/LabelMiddleware.d.ts +1 -1
- package/dist/types/helperComponents/LabelMiddleware.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -11
- package/src/accessorPropagation/EnvironmentContext.tsx +2 -2
- package/src/accessorPropagation/index.ts +1 -0
- package/src/accessorPropagation/useEntityListSubTreeLoader.ts +69 -0
- package/src/accessorSorting/sortEntities.ts +1 -4
- package/src/coreComponents/Component.tsx +4 -7
- package/src/coreComponents/MarkerProvider.ts +2 -2
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const react = require("react");
|
|
4
|
+
const useExtendTree = require("./useExtendTree.cjs");
|
|
5
|
+
const EntityListSubTree = require("../coreComponents/EntityListSubTree.cjs");
|
|
6
|
+
const useEntityListSubTreeLoader = (entities, children, state) => {
|
|
7
|
+
const [displayedState, setDisplayedState] = react.useState({
|
|
8
|
+
entities: void 0,
|
|
9
|
+
treeRootId: void 0,
|
|
10
|
+
state: void 0
|
|
11
|
+
});
|
|
12
|
+
const currentlyLoading = react.useRef();
|
|
13
|
+
const [loadingState, setLoadingState] = react.useState("initial");
|
|
14
|
+
const extendTree = useExtendTree.useExtendTree();
|
|
15
|
+
react.useEffect(() => {
|
|
16
|
+
(async () => {
|
|
17
|
+
if (!entities || displayedState.state === state && displayedState.entities === entities || currentlyLoading.current?.entities === entities && currentlyLoading.current?.state === state) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
currentlyLoading.current = {
|
|
21
|
+
entities,
|
|
22
|
+
state
|
|
23
|
+
};
|
|
24
|
+
if (displayedState.entities) {
|
|
25
|
+
setLoadingState("refreshing");
|
|
26
|
+
}
|
|
27
|
+
const newTreeRootId = await extendTree(
|
|
28
|
+
react.createElement(EntityListSubTree.EntityListSubTree, {
|
|
29
|
+
...entities,
|
|
30
|
+
children
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
currentlyLoading.current = void 0;
|
|
34
|
+
if (newTreeRootId) {
|
|
35
|
+
setDisplayedState({
|
|
36
|
+
entities,
|
|
37
|
+
treeRootId: newTreeRootId,
|
|
38
|
+
state
|
|
39
|
+
});
|
|
40
|
+
setLoadingState("loaded");
|
|
41
|
+
}
|
|
42
|
+
})();
|
|
43
|
+
}, [displayedState, extendTree, entities, children, state]);
|
|
44
|
+
return [displayedState, loadingState];
|
|
45
|
+
};
|
|
46
|
+
exports.useEntityListSubTreeLoader = useEntityListSubTreeLoader;
|
|
47
|
+
//# sourceMappingURL=useEntityListSubTreeLoader.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEntityListSubTreeLoader.cjs","sources":["../../../src/accessorPropagation/useEntityListSubTreeLoader.ts"],"sourcesContent":["import { createElement, ReactNode, useEffect, useRef, useState } from 'react'\nimport { SugaredQualifiedEntityList, TreeRootId } from '@contember/binding'\nimport { useExtendTree } from './useExtendTree'\nimport { EntityListSubTree } from '../coreComponents'\n\nexport type UseEntityListSubTreeLoaderResult<State> = {\n\tentities: SugaredQualifiedEntityList | undefined\n\ttreeRootId: TreeRootId | undefined\n\tstate: State | undefined\n}\n\nexport type EntityListSubTreeLoaderState =\n\t| 'initial'\n\t| 'refreshing'\n\t| 'loaded'\n\nexport const useEntityListSubTreeLoader = <State>(entities: SugaredQualifiedEntityList | undefined, children: ReactNode, state?: State): [UseEntityListSubTreeLoaderResult<State>, EntityListSubTreeLoaderState] => {\n\tconst [displayedState, setDisplayedState] = useState<UseEntityListSubTreeLoaderResult<State>>({\n\t\tentities: undefined,\n\t\ttreeRootId: undefined,\n\t\tstate: undefined,\n\t})\n\tconst currentlyLoading = useRef<{\n\t\tentities: SugaredQualifiedEntityList\n\t\tstate?: State\n\t}>()\n\n\tconst [loadingState, setLoadingState] = useState<EntityListSubTreeLoaderState>('initial')\n\tconst extendTree = useExtendTree()\n\n\tuseEffect(() => {\n\t\t(async () => {\n\t\t\tif (\n\t\t\t\t!entities\n\t\t\t\t|| displayedState.state === state && displayedState.entities === entities\n\t\t\t\t|| currentlyLoading.current?.entities === entities && currentlyLoading.current?.state === state\n\t\t\t) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcurrentlyLoading.current = {\n\t\t\t\tentities,\n\t\t\t\tstate,\n\t\t\t}\n\n\t\t\tif (displayedState.entities) {\n\t\t\t\tsetLoadingState('refreshing')\n\t\t\t}\n\n\t\t\tconst newTreeRootId = await extendTree(\n\t\t\t\tcreateElement(EntityListSubTree, {\n\t\t\t\t\t...entities,\n\t\t\t\t\tchildren,\n\t\t\t\t}),\n\t\t\t)\n\t\t\tcurrentlyLoading.current = undefined\n\t\t\tif (newTreeRootId) {\n\t\t\t\tsetDisplayedState({\n\t\t\t\t\tentities: entities,\n\t\t\t\t\ttreeRootId: newTreeRootId,\n\t\t\t\t\tstate: state,\n\t\t\t\t})\n\t\t\t\tsetLoadingState('loaded')\n\t\t\t}\n\t\t})()\n\t}, [displayedState, extendTree, entities, children, state])\n\n\treturn [displayedState, loadingState]\n}\n"],"names":["useState","useRef","useExtendTree","useEffect","createElement","EntityListSubTree"],"mappings":";;;;;AAgBO,MAAM,6BAA6B,CAAQ,UAAkD,UAAqB,UAA2F;AACnN,QAAM,CAAC,gBAAgB,iBAAiB,IAAIA,eAAkD;AAAA,IAC7F,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,OAAO;AAAA,EAAA,CACP;AACD,QAAM,mBAAmBC,MAAAA;AAKzB,QAAM,CAAC,cAAc,eAAe,IAAID,eAAuC,SAAS;AACxF,QAAM,aAAaE,cAAAA;AAEnBC,QAAAA,UAAU,MAAM;AACf,KAAC,YAAY;AACZ,UACC,CAAC,YACE,eAAe,UAAU,SAAS,eAAe,aAAa,YAC9D,iBAAiB,SAAS,aAAa,YAAY,iBAAiB,SAAS,UAAU,OACzF;AACD;AAAA,MACD;AAEA,uBAAiB,UAAU;AAAA,QAC1B;AAAA,QACA;AAAA,MAAA;AAGD,UAAI,eAAe,UAAU;AAC5B,wBAAgB,YAAY;AAAA,MAC7B;AAEA,YAAM,gBAAgB,MAAM;AAAA,QAC3BC,MAAAA,cAAcC,kBAAAA,mBAAmB;AAAA,UAChC,GAAG;AAAA,UACH;AAAA,QAAA,CACA;AAAA,MAAA;AAEF,uBAAiB,UAAU;AAC3B,UAAI,eAAe;AACA,0BAAA;AAAA,UACjB;AAAA,UACA,YAAY;AAAA,UACZ;AAAA,QAAA,CACA;AACD,wBAAgB,QAAQ;AAAA,MACzB;AAAA,IAAA;EACE,GACD,CAAC,gBAAgB,YAAY,UAAU,UAAU,KAAK,CAAC;AAEnD,SAAA,CAAC,gBAAgB,YAAY;AACrC;;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useState, useRef, useEffect, createElement } from "react";
|
|
2
|
+
import { useExtendTree } from "./useExtendTree.js";
|
|
3
|
+
import { EntityListSubTree } from "../coreComponents/EntityListSubTree.js";
|
|
4
|
+
const useEntityListSubTreeLoader = (entities, children, state) => {
|
|
5
|
+
const [displayedState, setDisplayedState] = useState({
|
|
6
|
+
entities: void 0,
|
|
7
|
+
treeRootId: void 0,
|
|
8
|
+
state: void 0
|
|
9
|
+
});
|
|
10
|
+
const currentlyLoading = useRef();
|
|
11
|
+
const [loadingState, setLoadingState] = useState("initial");
|
|
12
|
+
const extendTree = useExtendTree();
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
(async () => {
|
|
15
|
+
if (!entities || displayedState.state === state && displayedState.entities === entities || currentlyLoading.current?.entities === entities && currentlyLoading.current?.state === state) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
currentlyLoading.current = {
|
|
19
|
+
entities,
|
|
20
|
+
state
|
|
21
|
+
};
|
|
22
|
+
if (displayedState.entities) {
|
|
23
|
+
setLoadingState("refreshing");
|
|
24
|
+
}
|
|
25
|
+
const newTreeRootId = await extendTree(
|
|
26
|
+
createElement(EntityListSubTree, {
|
|
27
|
+
...entities,
|
|
28
|
+
children
|
|
29
|
+
})
|
|
30
|
+
);
|
|
31
|
+
currentlyLoading.current = void 0;
|
|
32
|
+
if (newTreeRootId) {
|
|
33
|
+
setDisplayedState({
|
|
34
|
+
entities,
|
|
35
|
+
treeRootId: newTreeRootId,
|
|
36
|
+
state
|
|
37
|
+
});
|
|
38
|
+
setLoadingState("loaded");
|
|
39
|
+
}
|
|
40
|
+
})();
|
|
41
|
+
}, [displayedState, extendTree, entities, children, state]);
|
|
42
|
+
return [displayedState, loadingState];
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
useEntityListSubTreeLoader
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=useEntityListSubTreeLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEntityListSubTreeLoader.js","sources":["../../../src/accessorPropagation/useEntityListSubTreeLoader.ts"],"sourcesContent":["import { createElement, ReactNode, useEffect, useRef, useState } from 'react'\nimport { SugaredQualifiedEntityList, TreeRootId } from '@contember/binding'\nimport { useExtendTree } from './useExtendTree'\nimport { EntityListSubTree } from '../coreComponents'\n\nexport type UseEntityListSubTreeLoaderResult<State> = {\n\tentities: SugaredQualifiedEntityList | undefined\n\ttreeRootId: TreeRootId | undefined\n\tstate: State | undefined\n}\n\nexport type EntityListSubTreeLoaderState =\n\t| 'initial'\n\t| 'refreshing'\n\t| 'loaded'\n\nexport const useEntityListSubTreeLoader = <State>(entities: SugaredQualifiedEntityList | undefined, children: ReactNode, state?: State): [UseEntityListSubTreeLoaderResult<State>, EntityListSubTreeLoaderState] => {\n\tconst [displayedState, setDisplayedState] = useState<UseEntityListSubTreeLoaderResult<State>>({\n\t\tentities: undefined,\n\t\ttreeRootId: undefined,\n\t\tstate: undefined,\n\t})\n\tconst currentlyLoading = useRef<{\n\t\tentities: SugaredQualifiedEntityList\n\t\tstate?: State\n\t}>()\n\n\tconst [loadingState, setLoadingState] = useState<EntityListSubTreeLoaderState>('initial')\n\tconst extendTree = useExtendTree()\n\n\tuseEffect(() => {\n\t\t(async () => {\n\t\t\tif (\n\t\t\t\t!entities\n\t\t\t\t|| displayedState.state === state && displayedState.entities === entities\n\t\t\t\t|| currentlyLoading.current?.entities === entities && currentlyLoading.current?.state === state\n\t\t\t) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcurrentlyLoading.current = {\n\t\t\t\tentities,\n\t\t\t\tstate,\n\t\t\t}\n\n\t\t\tif (displayedState.entities) {\n\t\t\t\tsetLoadingState('refreshing')\n\t\t\t}\n\n\t\t\tconst newTreeRootId = await extendTree(\n\t\t\t\tcreateElement(EntityListSubTree, {\n\t\t\t\t\t...entities,\n\t\t\t\t\tchildren,\n\t\t\t\t}),\n\t\t\t)\n\t\t\tcurrentlyLoading.current = undefined\n\t\t\tif (newTreeRootId) {\n\t\t\t\tsetDisplayedState({\n\t\t\t\t\tentities: entities,\n\t\t\t\t\ttreeRootId: newTreeRootId,\n\t\t\t\t\tstate: state,\n\t\t\t\t})\n\t\t\t\tsetLoadingState('loaded')\n\t\t\t}\n\t\t})()\n\t}, [displayedState, extendTree, entities, children, state])\n\n\treturn [displayedState, loadingState]\n}\n"],"names":[],"mappings":";;;AAgBO,MAAM,6BAA6B,CAAQ,UAAkD,UAAqB,UAA2F;AACnN,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAkD;AAAA,IAC7F,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,OAAO;AAAA,EAAA,CACP;AACD,QAAM,mBAAmB;AAKzB,QAAM,CAAC,cAAc,eAAe,IAAI,SAAuC,SAAS;AACxF,QAAM,aAAa;AAEnB,YAAU,MAAM;AACf,KAAC,YAAY;AACZ,UACC,CAAC,YACE,eAAe,UAAU,SAAS,eAAe,aAAa,YAC9D,iBAAiB,SAAS,aAAa,YAAY,iBAAiB,SAAS,UAAU,OACzF;AACD;AAAA,MACD;AAEA,uBAAiB,UAAU;AAAA,QAC1B;AAAA,QACA;AAAA,MAAA;AAGD,UAAI,eAAe,UAAU;AAC5B,wBAAgB,YAAY;AAAA,MAC7B;AAEA,YAAM,gBAAgB,MAAM;AAAA,QAC3B,cAAc,mBAAmB;AAAA,UAChC,GAAG;AAAA,UACH;AAAA,QAAA,CACA;AAAA,MAAA;AAEF,uBAAiB,UAAU;AAC3B,UAAI,eAAe;AACA,0BAAA;AAAA,UACjB;AAAA,UACA,YAAY;AAAA,UACZ;AAAA,QAAA,CACA;AACD,wBAAgB,QAAQ;AAAA,MACzB;AAAA,IAAA;EACE,GACD,CAAC,gBAAgB,YAAY,UAAU,UAAU,KAAK,CAAC;AAEnD,SAAA,CAAC,gBAAgB,YAAY;AACrC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExtendTree.cjs","sources":["../../../src/accessorPropagation/useExtendTree.ts"],"sourcesContent":["import { ReactNode, useCallback } from 'react'\nimport { useAbortController, useIsMounted } from '@contember/react-utils'\nimport { useBindingOperations } from './useBindingOperations'\nimport { TreeRootId } from '@contember/binding'\nimport { ExtendTreeOptions } from '@contember/binding'\nimport { DataBindingExtendAborted } from '@contember/binding'\nimport { useEnvironment } from './useEnvironment'\n\nexport const useExtendTree = () => {\n\tconst abort = useAbortController()\n\tconst { extendTree } = useBindingOperations()\n\tconst isMountedRef = useIsMounted()\n\tconst environment = useEnvironment()\n\treturn useCallback(async (newFragment: ReactNode, options?: Omit<ExtendTreeOptions, 'signal'>): Promise<TreeRootId | undefined> => {\n\t\ttry {\n\t\t\tconst newTreeRootId = await extendTree(newFragment,\n\t\t\t\t{ environment, ...options, signal: abort() },\n\t\t\t)\n\t\t\tif (!isMountedRef.current) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\treturn newTreeRootId\n\t\t} catch (e) {\n\t\t\tif (e === DataBindingExtendAborted) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthrow e\n\t\t}\n\t}, [abort, environment, extendTree, isMountedRef])\n}\n"],"names":["useAbortController","useBindingOperations","useIsMounted","useEnvironment","useCallback","DataBindingExtendAborted"],"mappings":";;;;;;;AAQO,MAAM,gBAAgB,MAAM;AAClC,QAAM,QAAQA,WAAAA;AACR,QAAA,EAAE,eAAeC,qBAAAA;AACvB,QAAM,eAAeC,WAAAA;AACrB,QAAM,cAAcC,eAAAA;AACb,SAAAC,MAAA,YAAY,OAAO,aAAwB,YAAiF;AAC9H,QAAA;AACH,YAAM,gBAAgB,MAAM;AAAA,QAAW;AAAA,QACtC,EAAE,aAAa,GAAG,SAAS,QAAQ,QAAQ;AAAA,MAAA;AAExC,UAAA,CAAC,aAAa,SAAS;AAC1B;AAAA,MACD;AACO,aAAA;AAAA,aACC;
|
|
1
|
+
{"version":3,"file":"useExtendTree.cjs","sources":["../../../src/accessorPropagation/useExtendTree.ts"],"sourcesContent":["import { ReactNode, useCallback } from 'react'\nimport { useAbortController, useIsMounted } from '@contember/react-utils'\nimport { useBindingOperations } from './useBindingOperations'\nimport { TreeRootId } from '@contember/binding'\nimport { ExtendTreeOptions } from '@contember/binding'\nimport { DataBindingExtendAborted } from '@contember/binding'\nimport { useEnvironment } from './useEnvironment'\n\nexport const useExtendTree = () => {\n\tconst abort = useAbortController()\n\tconst { extendTree } = useBindingOperations()\n\tconst isMountedRef = useIsMounted()\n\tconst environment = useEnvironment()\n\treturn useCallback(async (newFragment: ReactNode, options?: Omit<ExtendTreeOptions, 'signal'>): Promise<TreeRootId | undefined> => {\n\t\ttry {\n\t\t\tconst newTreeRootId = await extendTree(newFragment,\n\t\t\t\t{ environment, ...options, signal: abort() },\n\t\t\t)\n\t\t\tif (!isMountedRef.current) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\treturn newTreeRootId\n\t\t} catch (e) {\n\t\t\tif (e === DataBindingExtendAborted) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthrow e\n\t\t}\n\t}, [abort, environment, extendTree, isMountedRef])\n}\n"],"names":["useAbortController","useBindingOperations","useIsMounted","useEnvironment","useCallback","DataBindingExtendAborted"],"mappings":";;;;;;;AAQO,MAAM,gBAAgB,MAAM;AAClC,QAAM,QAAQA,WAAAA;AACR,QAAA,EAAE,eAAeC,qBAAAA;AACvB,QAAM,eAAeC,WAAAA;AACrB,QAAM,cAAcC,eAAAA;AACb,SAAAC,MAAA,YAAY,OAAO,aAAwB,YAAiF;AAC9H,QAAA;AACH,YAAM,gBAAgB,MAAM;AAAA,QAAW;AAAA,QACtC,EAAE,aAAa,GAAG,SAAS,QAAQ,QAAQ;AAAA,MAAA;AAExC,UAAA,CAAC,aAAa,SAAS;AAC1B;AAAA,MACD;AACO,aAAA;AAAA,aACC,GAAG;AACX,UAAI,MAAMC,QAAAA,0BAA0B;AACnC;AAAA,MACD;AACM,YAAA;AAAA,IACP;AAAA,KACE,CAAC,OAAO,aAAa,YAAY,YAAY,CAAC;AAClD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExtendTree.js","sources":["../../../src/accessorPropagation/useExtendTree.ts"],"sourcesContent":["import { ReactNode, useCallback } from 'react'\nimport { useAbortController, useIsMounted } from '@contember/react-utils'\nimport { useBindingOperations } from './useBindingOperations'\nimport { TreeRootId } from '@contember/binding'\nimport { ExtendTreeOptions } from '@contember/binding'\nimport { DataBindingExtendAborted } from '@contember/binding'\nimport { useEnvironment } from './useEnvironment'\n\nexport const useExtendTree = () => {\n\tconst abort = useAbortController()\n\tconst { extendTree } = useBindingOperations()\n\tconst isMountedRef = useIsMounted()\n\tconst environment = useEnvironment()\n\treturn useCallback(async (newFragment: ReactNode, options?: Omit<ExtendTreeOptions, 'signal'>): Promise<TreeRootId | undefined> => {\n\t\ttry {\n\t\t\tconst newTreeRootId = await extendTree(newFragment,\n\t\t\t\t{ environment, ...options, signal: abort() },\n\t\t\t)\n\t\t\tif (!isMountedRef.current) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\treturn newTreeRootId\n\t\t} catch (e) {\n\t\t\tif (e === DataBindingExtendAborted) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthrow e\n\t\t}\n\t}, [abort, environment, extendTree, isMountedRef])\n}\n"],"names":[],"mappings":";;;;;AAQO,MAAM,gBAAgB,MAAM;AAClC,QAAM,QAAQ;AACR,QAAA,EAAE,eAAe;AACvB,QAAM,eAAe;AACrB,QAAM,cAAc;AACb,SAAA,YAAY,OAAO,aAAwB,YAAiF;AAC9H,QAAA;AACH,YAAM,gBAAgB,MAAM;AAAA,QAAW;AAAA,QACtC,EAAE,aAAa,GAAG,SAAS,QAAQ,QAAQ;AAAA,MAAA;AAExC,UAAA,CAAC,aAAa,SAAS;AAC1B;AAAA,MACD;AACO,aAAA;AAAA,aACC;
|
|
1
|
+
{"version":3,"file":"useExtendTree.js","sources":["../../../src/accessorPropagation/useExtendTree.ts"],"sourcesContent":["import { ReactNode, useCallback } from 'react'\nimport { useAbortController, useIsMounted } from '@contember/react-utils'\nimport { useBindingOperations } from './useBindingOperations'\nimport { TreeRootId } from '@contember/binding'\nimport { ExtendTreeOptions } from '@contember/binding'\nimport { DataBindingExtendAborted } from '@contember/binding'\nimport { useEnvironment } from './useEnvironment'\n\nexport const useExtendTree = () => {\n\tconst abort = useAbortController()\n\tconst { extendTree } = useBindingOperations()\n\tconst isMountedRef = useIsMounted()\n\tconst environment = useEnvironment()\n\treturn useCallback(async (newFragment: ReactNode, options?: Omit<ExtendTreeOptions, 'signal'>): Promise<TreeRootId | undefined> => {\n\t\ttry {\n\t\t\tconst newTreeRootId = await extendTree(newFragment,\n\t\t\t\t{ environment, ...options, signal: abort() },\n\t\t\t)\n\t\t\tif (!isMountedRef.current) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\treturn newTreeRootId\n\t\t} catch (e) {\n\t\t\tif (e === DataBindingExtendAborted) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthrow e\n\t\t}\n\t}, [abort, environment, extendTree, isMountedRef])\n}\n"],"names":[],"mappings":";;;;;AAQO,MAAM,gBAAgB,MAAM;AAClC,QAAM,QAAQ;AACR,QAAA,EAAE,eAAe;AACvB,QAAM,eAAe;AACrB,QAAM,cAAc;AACb,SAAA,YAAY,OAAO,aAAwB,YAAiF;AAC9H,QAAA;AACH,YAAM,gBAAgB,MAAM;AAAA,QAAW;AAAA,QACtC,EAAE,aAAa,GAAG,SAAS,QAAQ,QAAQ;AAAA,MAAA;AAExC,UAAA,CAAC,aAAa,SAAS;AAC1B;AAAA,MACD;AACO,aAAA;AAAA,aACC,GAAG;AACX,UAAI,MAAM,0BAA0B;AACnC;AAAA,MACD;AACM,YAAA;AAAA,IACP;AAAA,KACE,CAAC,OAAO,aAAa,YAAY,YAAY,CAAC;AAClD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.cjs","sources":["../../../src/accessorSorting/errors.ts"],"sourcesContent":["import { BindingError } from '@contember/binding'\nimport type { SortedEntities } from './SortedEntities'\n\nexport const throwNoopError = (callbackName: keyof SortedEntities) => {\n\tthrow new BindingError(\n\t\t`Cannot invoke '${callbackName}' in non-sortable mode. The 'sortByField' parameter of the 'useSortedEntities' ` +\n\t\t\t`hook is undefined.`,\n\t)\n}\n"],"names":["BindingError"],"mappings":";;;AAGa,MAAA,iBAAiB,CAAC,iBAAuC;AACrE,QAAM,IAAIA,QAAA;AAAA,IACT,kBAAkB;AAAA,EAAA;
|
|
1
|
+
{"version":3,"file":"errors.cjs","sources":["../../../src/accessorSorting/errors.ts"],"sourcesContent":["import { BindingError } from '@contember/binding'\nimport type { SortedEntities } from './SortedEntities'\n\nexport const throwNoopError = (callbackName: keyof SortedEntities) => {\n\tthrow new BindingError(\n\t\t`Cannot invoke '${callbackName}' in non-sortable mode. The 'sortByField' parameter of the 'useSortedEntities' ` +\n\t\t\t`hook is undefined.`,\n\t)\n}\n"],"names":["BindingError"],"mappings":";;;AAGa,MAAA,iBAAiB,CAAC,iBAAuC;AACrE,QAAM,IAAIA,QAAA;AAAA,IACT,kBAAkB,YAAY;AAAA,EAAA;AAGhC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sources":["../../../src/accessorSorting/errors.ts"],"sourcesContent":["import { BindingError } from '@contember/binding'\nimport type { SortedEntities } from './SortedEntities'\n\nexport const throwNoopError = (callbackName: keyof SortedEntities) => {\n\tthrow new BindingError(\n\t\t`Cannot invoke '${callbackName}' in non-sortable mode. The 'sortByField' parameter of the 'useSortedEntities' ` +\n\t\t\t`hook is undefined.`,\n\t)\n}\n"],"names":[],"mappings":";AAGa,MAAA,iBAAiB,CAAC,iBAAuC;AACrE,QAAM,IAAI;AAAA,IACT,kBAAkB;AAAA,EAAA;
|
|
1
|
+
{"version":3,"file":"errors.js","sources":["../../../src/accessorSorting/errors.ts"],"sourcesContent":["import { BindingError } from '@contember/binding'\nimport type { SortedEntities } from './SortedEntities'\n\nexport const throwNoopError = (callbackName: keyof SortedEntities) => {\n\tthrow new BindingError(\n\t\t`Cannot invoke '${callbackName}' in non-sortable mode. The 'sortByField' parameter of the 'useSortedEntities' ` +\n\t\t\t`hook is undefined.`,\n\t)\n}\n"],"names":[],"mappings":";AAGa,MAAA,iBAAiB,CAAC,iBAAuC;AACrE,QAAM,IAAI;AAAA,IACT,kBAAkB,YAAY;AAAA,EAAA;AAGhC;"}
|
|
@@ -7,10 +7,7 @@ const sortEntities = (entities, sortByField) => {
|
|
|
7
7
|
return entities.sort((a, b) => {
|
|
8
8
|
const aField = a.getRelativeSingleField(sortByField);
|
|
9
9
|
const bField = b.getRelativeSingleField(sortByField);
|
|
10
|
-
|
|
11
|
-
return aField.value - bField.value;
|
|
12
|
-
}
|
|
13
|
-
return 0;
|
|
10
|
+
return (aField.value ?? Number.MAX_SAFE_INTEGER) - (bField.value ?? Number.MAX_SAFE_INTEGER);
|
|
14
11
|
});
|
|
15
12
|
};
|
|
16
13
|
exports.sortEntities = sortEntities;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortEntities.cjs","sources":["../../../src/accessorSorting/sortEntities.ts"],"sourcesContent":["import { EntityAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const sortEntities = (\n\tentities: EntityAccessor[],\n\tsortByField: RelativeSingleField | undefined,\n): EntityAccessor[] => {\n\tif (!sortByField) {\n\t\treturn entities\n\t}\n\treturn entities.sort((a, b) => {\n\t\tconst aField = a.getRelativeSingleField<number>(sortByField)\n\t\tconst bField = b.getRelativeSingleField<number>(sortByField)\n\n\t\
|
|
1
|
+
{"version":3,"file":"sortEntities.cjs","sources":["../../../src/accessorSorting/sortEntities.ts"],"sourcesContent":["import { EntityAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const sortEntities = (\n\tentities: EntityAccessor[],\n\tsortByField: RelativeSingleField | undefined,\n): EntityAccessor[] => {\n\tif (!sortByField) {\n\t\treturn entities\n\t}\n\treturn entities.sort((a, b) => {\n\t\tconst aField = a.getRelativeSingleField<number>(sortByField)\n\t\tconst bField = b.getRelativeSingleField<number>(sortByField)\n\n\t\treturn (aField.value ?? Number.MAX_SAFE_INTEGER) - (bField.value ?? Number.MAX_SAFE_INTEGER)\n\t})\n}\n"],"names":[],"mappings":";;AAEa,MAAA,eAAe,CAC3B,UACA,gBACsB;AACtB,MAAI,CAAC,aAAa;AACV,WAAA;AAAA,EACR;AACA,SAAO,SAAS,KAAK,CAAC,GAAG,MAAM;AACxB,UAAA,SAAS,EAAE,uBAA+B,WAAW;AACrD,UAAA,SAAS,EAAE,uBAA+B,WAAW;AAE3D,YAAQ,OAAO,SAAS,OAAO,qBAAqB,OAAO,SAAS,OAAO;AAAA,EAAA,CAC3E;AACF;;"}
|
|
@@ -5,10 +5,7 @@ const sortEntities = (entities, sortByField) => {
|
|
|
5
5
|
return entities.sort((a, b) => {
|
|
6
6
|
const aField = a.getRelativeSingleField(sortByField);
|
|
7
7
|
const bField = b.getRelativeSingleField(sortByField);
|
|
8
|
-
|
|
9
|
-
return aField.value - bField.value;
|
|
10
|
-
}
|
|
11
|
-
return 0;
|
|
8
|
+
return (aField.value ?? Number.MAX_SAFE_INTEGER) - (bField.value ?? Number.MAX_SAFE_INTEGER);
|
|
12
9
|
});
|
|
13
10
|
};
|
|
14
11
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortEntities.js","sources":["../../../src/accessorSorting/sortEntities.ts"],"sourcesContent":["import { EntityAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const sortEntities = (\n\tentities: EntityAccessor[],\n\tsortByField: RelativeSingleField | undefined,\n): EntityAccessor[] => {\n\tif (!sortByField) {\n\t\treturn entities\n\t}\n\treturn entities.sort((a, b) => {\n\t\tconst aField = a.getRelativeSingleField<number>(sortByField)\n\t\tconst bField = b.getRelativeSingleField<number>(sortByField)\n\n\t\
|
|
1
|
+
{"version":3,"file":"sortEntities.js","sources":["../../../src/accessorSorting/sortEntities.ts"],"sourcesContent":["import { EntityAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const sortEntities = (\n\tentities: EntityAccessor[],\n\tsortByField: RelativeSingleField | undefined,\n): EntityAccessor[] => {\n\tif (!sortByField) {\n\t\treturn entities\n\t}\n\treturn entities.sort((a, b) => {\n\t\tconst aField = a.getRelativeSingleField<number>(sortByField)\n\t\tconst bField = b.getRelativeSingleField<number>(sortByField)\n\n\t\treturn (aField.value ?? Number.MAX_SAFE_INTEGER) - (bField.value ?? Number.MAX_SAFE_INTEGER)\n\t})\n}\n"],"names":[],"mappings":"AAEa,MAAA,eAAe,CAC3B,UACA,gBACsB;AACtB,MAAI,CAAC,aAAa;AACV,WAAA;AAAA,EACR;AACA,SAAO,SAAS,KAAK,CAAC,GAAG,MAAM;AACxB,UAAA,SAAS,EAAE,uBAA+B,WAAW;AACrD,UAAA,SAAS,EAAE,uBAA+B,WAAW;AAE3D,YAAQ,OAAO,SAAS,OAAO,qBAAqB,OAAO,SAAS,OAAO;AAAA,EAAA,CAC3E;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataBinding.cjs","sources":["../../../src/accessorTree/useDataBinding.ts"],"sourcesContent":["import {\n\tGraphQlClientError,\n\tuseCurrentContentGraphQlClient,\n\tuseCurrentSystemGraphQlClient,\n\tuseTenantGraphQlClient,\n} from '@contember/react-client'\nimport { ReactNode, useCallback, useEffect, useReducer, useRef, useState } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { TreeRootAccessor } from '@contember/binding'\nimport { DataBinding, Environment, Schema, SchemaLoader, TreeStore } from '@contember/binding'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport type { AccessorTreeStateOptions } from './AccessorTreeStateOptions'\nimport { accessorTreeStateReducer } from './accessorTreeStateReducer'\nimport { useIsMounted } from '@contember/react-utils'\nimport { MarkerTreeGenerator } from '../MarkerTreeGenerator'\nimport ReactDOM from 'react-dom'\n\nexport const useDataBinding = ({\n\tchildren,\n\trefreshOnPersist,\n\tskipStateUpdateAfterPersist,\n}: AccessorTreeStateOptions): AccessorTreeState => {\n\tconst contentClient = useCurrentContentGraphQlClient()\n\tconst systemClient = useCurrentSystemGraphQlClient()\n\tconst tenantClient = useTenantGraphQlClient()\n\tconst environment = useEnvironment()\n\tconst currentTreeStore = useRef<TreeStore>()\n\tconst isMountedRef = useIsMounted()\n\tconst [schema, setSchema] = useState<Schema>()\n\n\tconst resetDataBinding = useCallback((environment: Environment, newStore: boolean) => {\n\t\tconst onUpdate = (data: TreeRootAccessor<ReactNode>, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tdispatch({ type: 'setData', data, binding })\n\t\t\t}\n\t\t}\n\n\t\tconst onError = (error: GraphQlClientError, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tdispatch({ type: 'failWithError', error, binding })\n\t\t\t}\n\t\t}\n\n\t\tconst onPersistSuccess = () => {\n\t\t\tif (isMountedRef.current && refreshOnPersist) {\n\t\t\t\tresetDataBinding(environment, true)\n\t\t\t}\n\t\t}\n\n\t\tif (currentTreeStore.current === undefined || newStore) {\n\t\t\tcurrentTreeStore.current = new TreeStore(environment.getSchema())\n\t\t}\n\n\t\tconst binding = new DataBinding(\n\t\t\tcontentClient,\n\t\t\tsystemClient,\n\t\t\ttenantClient,\n\t\t\tcurrentTreeStore.current,\n\t\t\tenvironment,\n\t\t\t(node, env) => {\n\t\t\t\tconst gen = new MarkerTreeGenerator(node, env)\n\t\t\t\treturn gen.generate()\n\t\t\t},\n\t\t\tReactDOM.unstable_batchedUpdates,\n\t\t\tonUpdate,\n\t\t\tonError,\n\t\t\tonPersistSuccess,\n\t\t\t{\n\t\t\t\tskipStateUpdateAfterPersist: skipStateUpdateAfterPersist ?? false,\n\t\t\t},\n\t\t)\n\t\tdispatch({ type: 'reset', binding, environment })\n\t}, [contentClient, systemClient, tenantClient, isMountedRef, refreshOnPersist, skipStateUpdateAfterPersist])\n\n\tconst [state, dispatch] = useReducer(accessorTreeStateReducer, {\n\t\tname: 'initializing',\n\t\tenvironment,\n\t})\n\n\tuseEffect(() => {\n\t\tif (schema !== undefined) {\n\t\t\treturn\n\t\t}\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tsetSchema(await SchemaLoader.loadSchema(contentClient))\n\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof GraphQlClientError) {\n\t\t\t\t\tif (e.type === 'aborted') {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tdispatch({\n\t\t\t\t\t\ttype: 'failWithError',\n\t\t\t\t\t\terror: e,\n\t\t\t\t\t\tbinding: state.binding!,\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tthrow e\n\t\t\t\t}\n\t\t\t}\n\t\t})()\n\t}, [contentClient, isMountedRef, schema, state.binding])\n\n\tuseEffect(() => {\n\t\tif (schema) {\n\t\t\tresetDataBinding(environment.withSchema(schema), false)\n\t\t}\n\t}, [resetDataBinding, schema, environment])\n\n\tuseEffect(() => {\n\t\tstate.binding?.extendTree(children)\n\t}, [children, state.binding])\n\n\treturn state\n}\n"],"names":["useCurrentContentGraphQlClient","useCurrentSystemGraphQlClient","useTenantGraphQlClient","useEnvironment","useRef","useIsMounted","useState","useCallback","environment","binding","TreeStore","DataBinding","MarkerTreeGenerator","useReducer","accessorTreeStateReducer","useEffect","SchemaLoader","GraphQlClientError"],"mappings":";;;;;;;;;;AAiBO,MAAM,iBAAiB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACD,MAAmD;AAClD,QAAM,gBAAgBA,YAAAA;AACtB,QAAM,eAAeC,YAAAA;AACrB,QAAM,eAAeC,YAAAA;AACrB,QAAM,cAAcC,eAAAA;AACpB,QAAM,mBAAmBC,MAAAA;AACzB,QAAM,eAAeC,WAAAA;AACrB,QAAM,CAAC,QAAQ,SAAS,IAAIC,MAAiB,SAAA;AAE7C,QAAM,mBAAmBC,MAAAA,YAAY,CAACC,cAA0B,aAAsB;AAC/E,UAAA,WAAW,CAAC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ataBinding.cjs","sources":["../../../src/accessorTree/useDataBinding.ts"],"sourcesContent":["import {\n\tGraphQlClientError,\n\tuseCurrentContentGraphQlClient,\n\tuseCurrentSystemGraphQlClient,\n\tuseTenantGraphQlClient,\n} from '@contember/react-client'\nimport { ReactNode, useCallback, useEffect, useReducer, useRef, useState } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { TreeRootAccessor } from '@contember/binding'\nimport { DataBinding, Environment, Schema, SchemaLoader, TreeStore } from '@contember/binding'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport type { AccessorTreeStateOptions } from './AccessorTreeStateOptions'\nimport { accessorTreeStateReducer } from './accessorTreeStateReducer'\nimport { useIsMounted } from '@contember/react-utils'\nimport { MarkerTreeGenerator } from '../MarkerTreeGenerator'\nimport ReactDOM from 'react-dom'\n\nexport const useDataBinding = ({\n\tchildren,\n\trefreshOnPersist,\n\tskipStateUpdateAfterPersist,\n}: AccessorTreeStateOptions): AccessorTreeState => {\n\tconst contentClient = useCurrentContentGraphQlClient()\n\tconst systemClient = useCurrentSystemGraphQlClient()\n\tconst tenantClient = useTenantGraphQlClient()\n\tconst environment = useEnvironment()\n\tconst currentTreeStore = useRef<TreeStore>()\n\tconst isMountedRef = useIsMounted()\n\tconst [schema, setSchema] = useState<Schema>()\n\n\tconst resetDataBinding = useCallback((environment: Environment, newStore: boolean) => {\n\t\tconst onUpdate = (data: TreeRootAccessor<ReactNode>, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tdispatch({ type: 'setData', data, binding })\n\t\t\t}\n\t\t}\n\n\t\tconst onError = (error: GraphQlClientError, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tdispatch({ type: 'failWithError', error, binding })\n\t\t\t}\n\t\t}\n\n\t\tconst onPersistSuccess = () => {\n\t\t\tif (isMountedRef.current && refreshOnPersist) {\n\t\t\t\tresetDataBinding(environment, true)\n\t\t\t}\n\t\t}\n\n\t\tif (currentTreeStore.current === undefined || newStore) {\n\t\t\tcurrentTreeStore.current = new TreeStore(environment.getSchema())\n\t\t}\n\n\t\tconst binding = new DataBinding(\n\t\t\tcontentClient,\n\t\t\tsystemClient,\n\t\t\ttenantClient,\n\t\t\tcurrentTreeStore.current,\n\t\t\tenvironment,\n\t\t\t(node, env) => {\n\t\t\t\tconst gen = new MarkerTreeGenerator(node, env)\n\t\t\t\treturn gen.generate()\n\t\t\t},\n\t\t\tReactDOM.unstable_batchedUpdates,\n\t\t\tonUpdate,\n\t\t\tonError,\n\t\t\tonPersistSuccess,\n\t\t\t{\n\t\t\t\tskipStateUpdateAfterPersist: skipStateUpdateAfterPersist ?? false,\n\t\t\t},\n\t\t)\n\t\tdispatch({ type: 'reset', binding, environment })\n\t}, [contentClient, systemClient, tenantClient, isMountedRef, refreshOnPersist, skipStateUpdateAfterPersist])\n\n\tconst [state, dispatch] = useReducer(accessorTreeStateReducer, {\n\t\tname: 'initializing',\n\t\tenvironment,\n\t})\n\n\tuseEffect(() => {\n\t\tif (schema !== undefined) {\n\t\t\treturn\n\t\t}\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tsetSchema(await SchemaLoader.loadSchema(contentClient))\n\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof GraphQlClientError) {\n\t\t\t\t\tif (e.type === 'aborted') {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tdispatch({\n\t\t\t\t\t\ttype: 'failWithError',\n\t\t\t\t\t\terror: e,\n\t\t\t\t\t\tbinding: state.binding!,\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tthrow e\n\t\t\t\t}\n\t\t\t}\n\t\t})()\n\t}, [contentClient, isMountedRef, schema, state.binding])\n\n\tuseEffect(() => {\n\t\tif (schema) {\n\t\t\tresetDataBinding(environment.withSchema(schema), false)\n\t\t}\n\t}, [resetDataBinding, schema, environment])\n\n\tuseEffect(() => {\n\t\tstate.binding?.extendTree(children)\n\t}, [children, state.binding])\n\n\treturn state\n}\n"],"names":["useCurrentContentGraphQlClient","useCurrentSystemGraphQlClient","useTenantGraphQlClient","useEnvironment","useRef","useIsMounted","useState","useCallback","environment","binding","TreeStore","DataBinding","MarkerTreeGenerator","useReducer","accessorTreeStateReducer","useEffect","SchemaLoader","GraphQlClientError"],"mappings":";;;;;;;;;;AAiBO,MAAM,iBAAiB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACD,MAAmD;AAClD,QAAM,gBAAgBA,YAAAA;AACtB,QAAM,eAAeC,YAAAA;AACrB,QAAM,eAAeC,YAAAA;AACrB,QAAM,cAAcC,eAAAA;AACpB,QAAM,mBAAmBC,MAAAA;AACzB,QAAM,eAAeC,WAAAA;AACrB,QAAM,CAAC,QAAQ,SAAS,IAAIC,MAAiB,SAAA;AAE7C,QAAM,mBAAmBC,MAAAA,YAAY,CAACC,cAA0B,aAAsB;AAC/E,UAAA,WAAW,CAAC,MAAmCC,aAAoC;AACxF,UAAI,aAAa,SAAS;AACzB,iBAAS,EAAE,MAAM,WAAW,MAAM,SAAAA,UAAS;AAAA,MAC5C;AAAA,IAAA;AAGK,UAAA,UAAU,CAAC,OAA2BA,aAAoC;AAC/E,UAAI,aAAa,SAAS;AACzB,iBAAS,EAAE,MAAM,iBAAiB,OAAO,SAAAA,UAAS;AAAA,MACnD;AAAA,IAAA;AAGD,UAAM,mBAAmB,MAAM;AAC1B,UAAA,aAAa,WAAW,kBAAkB;AAC7C,yBAAiBD,cAAa,IAAI;AAAA,MACnC;AAAA,IAAA;AAGG,QAAA,iBAAiB,YAAY,UAAa,UAAU;AACvD,uBAAiB,UAAU,IAAIE,QAAAA,UAAUF,aAAY,UAAW,CAAA;AAAA,IACjE;AAEA,UAAMC,YAAU,IAAIE,QAAA;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA,iBAAiB;AAAA,MACjBH;AAAAA,MACA,CAAC,MAAM,QAAQ;AACd,cAAM,MAAM,IAAII,o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["import {\n\tGraphQlClientError,\n\tuseCurrentContentGraphQlClient,\n\tuseCurrentSystemGraphQlClient,\n\tuseTenantGraphQlClient,\n} from '@contember/react-client'\nimport { ReactNode, useCallback, useEffect, useReducer, useRef, useState } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { TreeRootAccessor } from '@contember/binding'\nimport { DataBinding, Environment, Schema, SchemaLoader, TreeStore } from '@contember/binding'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport type { AccessorTreeStateOptions } from './AccessorTreeStateOptions'\nimport { accessorTreeStateReducer } from './accessorTreeStateReducer'\nimport { useIsMounted } from '@contember/react-utils'\nimport { MarkerTreeGenerator } from '../MarkerTreeGenerator'\nimport ReactDOM from 'react-dom'\n\nexport const useDataBinding = ({\n\tchildren,\n\trefreshOnPersist,\n\tskipStateUpdateAfterPersist,\n}: AccessorTreeStateOptions): AccessorTreeState => {\n\tconst contentClient = useCurrentContentGraphQlClient()\n\tconst systemClient = useCurrentSystemGraphQlClient()\n\tconst tenantClient = useTenantGraphQlClient()\n\tconst environment = useEnvironment()\n\tconst currentTreeStore = useRef<TreeStore>()\n\tconst isMountedRef = useIsMounted()\n\tconst [schema, setSchema] = useState<Schema>()\n\n\tconst resetDataBinding = useCallback((environment: Environment, newStore: boolean) => {\n\t\tconst onUpdate = (data: TreeRootAccessor<ReactNode>, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tdispatch({ type: 'setData', data, binding })\n\t\t\t}\n\t\t}\n\n\t\tconst onError = (error: GraphQlClientError, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tdispatch({ type: 'failWithError', error, binding })\n\t\t\t}\n\t\t}\n\n\t\tconst onPersistSuccess = () => {\n\t\t\tif (isMountedRef.current && refreshOnPersist) {\n\t\t\t\tresetDataBinding(environment, true)\n\t\t\t}\n\t\t}\n\n\t\tif (currentTreeStore.current === undefined || newStore) {\n\t\t\tcurrentTreeStore.current = new TreeStore(environment.getSchema())\n\t\t}\n\n\t\tconst binding = new DataBinding(\n\t\t\tcontentClient,\n\t\t\tsystemClient,\n\t\t\ttenantClient,\n\t\t\tcurrentTreeStore.current,\n\t\t\tenvironment,\n\t\t\t(node, env) => {\n\t\t\t\tconst gen = new MarkerTreeGenerator(node, env)\n\t\t\t\treturn gen.generate()\n\t\t\t},\n\t\t\tReactDOM.unstable_batchedUpdates,\n\t\t\tonUpdate,\n\t\t\tonError,\n\t\t\tonPersistSuccess,\n\t\t\t{\n\t\t\t\tskipStateUpdateAfterPersist: skipStateUpdateAfterPersist ?? false,\n\t\t\t},\n\t\t)\n\t\tdispatch({ type: 'reset', binding, environment })\n\t}, [contentClient, systemClient, tenantClient, isMountedRef, refreshOnPersist, skipStateUpdateAfterPersist])\n\n\tconst [state, dispatch] = useReducer(accessorTreeStateReducer, {\n\t\tname: 'initializing',\n\t\tenvironment,\n\t})\n\n\tuseEffect(() => {\n\t\tif (schema !== undefined) {\n\t\t\treturn\n\t\t}\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tsetSchema(await SchemaLoader.loadSchema(contentClient))\n\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof GraphQlClientError) {\n\t\t\t\t\tif (e.type === 'aborted') {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tdispatch({\n\t\t\t\t\t\ttype: 'failWithError',\n\t\t\t\t\t\terror: e,\n\t\t\t\t\t\tbinding: state.binding!,\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tthrow e\n\t\t\t\t}\n\t\t\t}\n\t\t})()\n\t}, [contentClient, isMountedRef, schema, state.binding])\n\n\tuseEffect(() => {\n\t\tif (schema) {\n\t\t\tresetDataBinding(environment.withSchema(schema), false)\n\t\t}\n\t}, [resetDataBinding, schema, environment])\n\n\tuseEffect(() => {\n\t\tstate.binding?.extendTree(children)\n\t}, [children, state.binding])\n\n\treturn state\n}\n"],"names":["environment","binding"],"mapp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,OAAO,QAAQ,IAAI,WAAW,0BAA0B;AAAA,IAC9D,MAAM;AAAA,IACN;AAAA,EAAA,CACA;AAED,YAAU,MAAM;AACf,QAAI,WAAW,QAAW;AACzB;AAAA,IACD;AAEA,KAAC,YAAY;AACR,UAAA;AACH,kBAAU,MAAM,aAAa,WAAW,aAAa,CAAC;AAAA,eAE9C;
|
|
1
|
+
{"version":3,"file":"useDataBinding.js","sources":["../../../src/accessorTree/useDataBinding.ts"],"sourcesContent":["import {\n\tGraphQlClientError,\n\tuseCurrentContentGraphQlClient,\n\tuseCurrentSystemGraphQlClient,\n\tuseTenantGraphQlClient,\n} from '@contember/react-client'\nimport { ReactNode, useCallback, useEffect, useReducer, useRef, useState } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { TreeRootAccessor } from '@contember/binding'\nimport { DataBinding, Environment, Schema, SchemaLoader, TreeStore } from '@contember/binding'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport type { AccessorTreeStateOptions } from './AccessorTreeStateOptions'\nimport { accessorTreeStateReducer } from './accessorTreeStateReducer'\nimport { useIsMounted } from '@contember/react-utils'\nimport { MarkerTreeGenerator } from '../MarkerTreeGenerator'\nimport ReactDOM from 'react-dom'\n\nexport const useDataBinding = ({\n\tchildren,\n\trefreshOnPersist,\n\tskipStateUpdateAfterPersist,\n}: AccessorTreeStateOptions): AccessorTreeState => {\n\tconst contentClient = useCurrentContentGraphQlClient()\n\tconst systemClient = useCurrentSystemGraphQlClient()\n\tconst tenantClient = useTenantGraphQlClient()\n\tconst environment = useEnvironment()\n\tconst currentTreeStore = useRef<TreeStore>()\n\tconst isMountedRef = useIsMounted()\n\tconst [schema, setSchema] = useState<Schema>()\n\n\tconst resetDataBinding = useCallback((environment: Environment, newStore: boolean) => {\n\t\tconst onUpdate = (data: TreeRootAccessor<ReactNode>, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tdispatch({ type: 'setData', data, binding })\n\t\t\t}\n\t\t}\n\n\t\tconst onError = (error: GraphQlClientError, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tdispatch({ type: 'failWithError', error, binding })\n\t\t\t}\n\t\t}\n\n\t\tconst onPersistSuccess = () => {\n\t\t\tif (isMountedRef.current && refreshOnPersist) {\n\t\t\t\tresetDataBinding(environment, true)\n\t\t\t}\n\t\t}\n\n\t\tif (currentTreeStore.current === undefined || newStore) {\n\t\t\tcurrentTreeStore.current = new TreeStore(environment.getSchema())\n\t\t}\n\n\t\tconst binding = new DataBinding(\n\t\t\tcontentClient,\n\t\t\tsystemClient,\n\t\t\ttenantClient,\n\t\t\tcurrentTreeStore.current,\n\t\t\tenvironment,\n\t\t\t(node, env) => {\n\t\t\t\tconst gen = new MarkerTreeGenerator(node, env)\n\t\t\t\treturn gen.generate()\n\t\t\t},\n\t\t\tReactDOM.unstable_batchedUpdates,\n\t\t\tonUpdate,\n\t\t\tonError,\n\t\t\tonPersistSuccess,\n\t\t\t{\n\t\t\t\tskipStateUpdateAfterPersist: skipStateUpdateAfterPersist ?? false,\n\t\t\t},\n\t\t)\n\t\tdispatch({ type: 'reset', binding, environment })\n\t}, [contentClient, systemClient, tenantClient, isMountedRef, refreshOnPersist, skipStateUpdateAfterPersist])\n\n\tconst [state, dispatch] = useReducer(accessorTreeStateReducer, {\n\t\tname: 'initializing',\n\t\tenvironment,\n\t})\n\n\tuseEffect(() => {\n\t\tif (schema !== undefined) {\n\t\t\treturn\n\t\t}\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tsetSchema(await SchemaLoader.loadSchema(contentClient))\n\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof GraphQlClientError) {\n\t\t\t\t\tif (e.type === 'aborted') {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tdispatch({\n\t\t\t\t\t\ttype: 'failWithError',\n\t\t\t\t\t\terror: e,\n\t\t\t\t\t\tbinding: state.binding!,\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tthrow e\n\t\t\t\t}\n\t\t\t}\n\t\t})()\n\t}, [contentClient, isMountedRef, schema, state.binding])\n\n\tuseEffect(() => {\n\t\tif (schema) {\n\t\t\tresetDataBinding(environment.withSchema(schema), false)\n\t\t}\n\t}, [resetDataBinding, schema, environment])\n\n\tuseEffect(() => {\n\t\tstate.binding?.extendTree(children)\n\t}, [children, state.binding])\n\n\treturn state\n}\n"],"names":["environment","binding"],"mappings":";;;;;;;;AAiBO,MAAM,iBAAiB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACD,MAAmD;AAClD,QAAM,gBAAgB;AACtB,QAAM,eAAe;AACrB,QAAM,eAAe;AACrB,QAAM,cAAc;AACpB,QAAM,mBAAmB;AACzB,QAAM,eAAe;AACrB,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAiB;AAE7C,QAAM,mBAAmB,YAAY,CAACA,cAA0B,aAAsB;AAC/E,UAAA,WAAW,CAAC,MAAmCC,aAAoC;AACxF,UAAI,aAAa,SAAS;AACzB,iBAAS,EAAE,MAAM,WAAW,MAAM,SAAAA,UAAS;AAAA,MAC5C;AAAA,IAAA;AAGK,UAAA,UAAU,CAAC,OAA2BA,aAAoC;AAC/E,UAAI,aAAa,SAAS;AACzB,iBAAS,EAAE,MAAM,iBAAiB,OAAO,SAAAA,UAAS;AAAA,MACnD;AAAA,IAAA;AAGD,UAAM,mBAAmB,MAAM;AAC1B,UAAA,aAAa,WAAW,kBAAkB;AAC7C,yBAAiBD,cAAa,IAAI;AAAA,MACnC;AAAA,IAAA;AAGG,QAAA,iBAAiB,YAAY,UAAa,UAAU;AACvD,uBAAiB,UAAU,IAAI,UAAUA,aAAY,UAAW,CAAA;AAAA,IACjE;AAEA,UAAM,UAAU,IAAI;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA,iBAAiB;AAAA,MACjBA;AAAAA,MACA,CAAC,MAAM,QAAQ;AACd,cAAM,MAAM,IAAI,oBAAoB,MAAM,GAAG;AAC7C,eAAO,IAAI;MACZ;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,QACC,6BAA6B,+BAA+B;AAAA,MAC7D;AAAA,IAAA;AAED,aAAS,EAAE,MAAM,SAAS,SAAS,aAAAA,cAAa;AAAA,EAAA,GAC9C,CAAC,eAAe,cAAc,cAAc,cAAc,kBAAkB,2BAA2B,CAAC;AAE3G,QAAM,CAAC,OAAO,QAAQ,IAAI,WAAW,0BAA0B;AAAA,IAC9D,MAAM;AAAA,IACN;AAAA,EAAA,CACA;AAED,YAAU,MAAM;AACf,QAAI,WAAW,QAAW;AACzB;AAAA,IACD;AAEA,KAAC,YAAY;AACR,UAAA;AACH,kBAAU,MAAM,aAAa,WAAW,aAAa,CAAC;AAAA,eAE9C,GAAG;AACX,YAAI,aAAa,oBAAoB;AAChC,cAAA,EAAE,SAAS,WAAW;AACzB;AAAA,UACD;AACS,mBAAA;AAAA,YACR,MAAM;AAAA,YACN,OAAO;AAAA,YACP,SAAS,MAAM;AAAA,UAAA,CACf;AAAA,QAAA,OACK;AACA,gBAAA;AAAA,QACP;AAAA,MACD;AAAA,IAAA;EACE,GACD,CAAC,eAAe,cAAc,QAAQ,MAAM,OAAO,CAAC;AAEvD,YAAU,MAAM;AACf,QAAI,QAAQ;AACX,uBAAiB,YAAY,WAAW,MAAM,GAAG,KAAK;AAAA,IACvD;AAAA,EACE,GAAA,CAAC,kBAAkB,QAAQ,WAAW,CAAC;AAE1C,YAAU,MAAM;AACT,UAAA,SAAS,WAAW,QAAQ;AAAA,EAChC,GAAA,CAAC,UAAU,MAAM,OAAO,CAAC;AAErB,SAAA;AACR;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.cjs","sources":["../../../src/coreComponents/Component.tsx"],"sourcesContent":["import { memo, NamedExoticComponent, PropsWithChildren, ReactElement } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { Environment } from '@contember/binding'\nimport type { MarkerProvider, StaticRenderProvider, StaticRenderProviderProps } from './MarkerProvider'\nimport { assertNever } from '@contember/utilities'\n\ninterface EnvironmentAwareFunctionComponent<P> {\n\t(props: PropsWithChildren<P>, environment: Environment):
|
|
1
|
+
{"version":3,"file":"Component.cjs","sources":["../../../src/coreComponents/Component.tsx"],"sourcesContent":["import { memo, NamedExoticComponent, PropsWithChildren, ReactElement, ReactNode } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { Environment } from '@contember/binding'\nimport type { MarkerProvider, StaticRenderProvider, StaticRenderProviderProps } from './MarkerProvider'\nimport { assertNever } from '@contember/utilities'\n\ninterface EnvironmentAwareFunctionComponent<P> {\n\t(props: PropsWithChildren<P>, environment: Environment): ReactNode;\n\tdisplayName?: string | undefined;\n}\n\nfunction Component<Props extends {}>(\n\tstatelessRender: EnvironmentAwareFunctionComponent<Props>,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\n\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\tstatefulRender: EnvironmentAwareFunctionComponent<Props>,\n\tstaticRender: (props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) => ReactNode,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\n\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\tstatefulRender: EnvironmentAwareFunctionComponent<Props>,\n\tmarkerProvisions: MarkerProvider<Props, NonStaticPropNames>,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\n\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\trender: EnvironmentAwareFunctionComponent<Props>,\n\tdecider?:\n\t\t| string\n\t\t| ((props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) => ReactNode)\n\t\t| MarkerProvider<Props, NonStaticPropNames>,\n\tdisplayName?: string,\n) {\n\tconst RenderWithEnv = (props: Props) => render(props, useEnvironment())\n\tconst renderWithEnv = typeof render !== 'function' || render.length < 2 ? render : RenderWithEnv\n\n\tif (decider === undefined || typeof decider === 'string') {\n\t\trender.displayName = decider\n\t\tconst augmentedRender: NamedExoticComponent<Props> & MarkerProvider<Props> = memo<Props>(renderWithEnv)\n\t\taugmentedRender.staticRender = render as StaticRenderProvider<Props>['staticRender']\n\t\taugmentedRender.displayName = decider\n\n\t\treturn augmentedRender\n\t}\n\n\trender.displayName = displayName\n\tconst augmentedRender: NamedExoticComponent<Props> & MarkerProvider<Props, NonStaticPropNames> = memo<Props>(renderWithEnv)\n\taugmentedRender.displayName = displayName\n\n\tif (typeof decider === 'function') {\n\t\taugmentedRender.staticRender = decider\n\n\t\treturn augmentedRender\n\t}\n\tif (typeof decider === 'object') {\n\t\tfor (const provisionName in decider) {\n\t\t\tconst methodName = provisionName as keyof MarkerProvider<Props, NonStaticPropNames>\n\t\t\t;(augmentedRender[methodName] as MarkerProvider<Props, NonStaticPropNames>[typeof methodName]) =\n\t\t\t\tdecider[methodName]\n\t\t}\n\n\t\treturn augmentedRender\n\t}\n\tassertNever(decider)\n}\n\nexport type { EnvironmentAwareFunctionComponent }\nexport { Component }\n"],"names":["useEnvironment","augmentedRender","memo","assertNever"],"mappings":";;;;;AA4BA,SAAS,UACR,QACA,SAIA,aACC;AACD,QAAM,gBAAgB,CAAC,UAAiB,OAAO,OAAOA,+BAAgB;AACtE,QAAM,gBAAgB,OAAO,WAAW,cAAc,OAAO,SAAS,IAAI,SAAS;AAEnF,MAAI,YAAY,UAAa,OAAO,YAAY,UAAU;AACzD,WAAO,cAAc;AACfC,UAAAA,mBAAuEC,WAAY,aAAa;AACtGD,qBAAgB,eAAe;AAC/BA,qBAAgB,cAAc;AAEvBA,WAAAA;AAAAA,EACR;AAEA,SAAO,cAAc;AACf,QAAA,kBAA2FC,WAAY,aAAa;AAC1H,kBAAgB,cAAc;AAE1B,MAAA,OAAO,YAAY,YAAY;AAClC,oBAAgB,eAAe;AAExB,WAAA;AAAA,EACR;AACI,MAAA,OAAO,YAAY,UAAU;AAChC,eAAW,iBAAiB,SAAS;AACpC,YAAM,aAAa;AACjB,sBAAgB,UAAU,IAC3B,QAAQ,UAAU;AAAA,IACpB;AAEO,WAAA;AAAA,EACR;AACAC,YAAA,YAAY,OAAO;AACpB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../../../src/coreComponents/Component.tsx"],"sourcesContent":["import { memo, NamedExoticComponent, PropsWithChildren, ReactElement } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { Environment } from '@contember/binding'\nimport type { MarkerProvider, StaticRenderProvider, StaticRenderProviderProps } from './MarkerProvider'\nimport { assertNever } from '@contember/utilities'\n\ninterface EnvironmentAwareFunctionComponent<P> {\n\t(props: PropsWithChildren<P>, environment: Environment):
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../../../src/coreComponents/Component.tsx"],"sourcesContent":["import { memo, NamedExoticComponent, PropsWithChildren, ReactElement, ReactNode } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { Environment } from '@contember/binding'\nimport type { MarkerProvider, StaticRenderProvider, StaticRenderProviderProps } from './MarkerProvider'\nimport { assertNever } from '@contember/utilities'\n\ninterface EnvironmentAwareFunctionComponent<P> {\n\t(props: PropsWithChildren<P>, environment: Environment): ReactNode;\n\tdisplayName?: string | undefined;\n}\n\nfunction Component<Props extends {}>(\n\tstatelessRender: EnvironmentAwareFunctionComponent<Props>,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\n\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\tstatefulRender: EnvironmentAwareFunctionComponent<Props>,\n\tstaticRender: (props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) => ReactNode,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\n\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\tstatefulRender: EnvironmentAwareFunctionComponent<Props>,\n\tmarkerProvisions: MarkerProvider<Props, NonStaticPropNames>,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\n\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\trender: EnvironmentAwareFunctionComponent<Props>,\n\tdecider?:\n\t\t| string\n\t\t| ((props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) => ReactNode)\n\t\t| MarkerProvider<Props, NonStaticPropNames>,\n\tdisplayName?: string,\n) {\n\tconst RenderWithEnv = (props: Props) => render(props, useEnvironment())\n\tconst renderWithEnv = typeof render !== 'function' || render.length < 2 ? render : RenderWithEnv\n\n\tif (decider === undefined || typeof decider === 'string') {\n\t\trender.displayName = decider\n\t\tconst augmentedRender: NamedExoticComponent<Props> & MarkerProvider<Props> = memo<Props>(renderWithEnv)\n\t\taugmentedRender.staticRender = render as StaticRenderProvider<Props>['staticRender']\n\t\taugmentedRender.displayName = decider\n\n\t\treturn augmentedRender\n\t}\n\n\trender.displayName = displayName\n\tconst augmentedRender: NamedExoticComponent<Props> & MarkerProvider<Props, NonStaticPropNames> = memo<Props>(renderWithEnv)\n\taugmentedRender.displayName = displayName\n\n\tif (typeof decider === 'function') {\n\t\taugmentedRender.staticRender = decider\n\n\t\treturn augmentedRender\n\t}\n\tif (typeof decider === 'object') {\n\t\tfor (const provisionName in decider) {\n\t\t\tconst methodName = provisionName as keyof MarkerProvider<Props, NonStaticPropNames>\n\t\t\t;(augmentedRender[methodName] as MarkerProvider<Props, NonStaticPropNames>[typeof methodName]) =\n\t\t\t\tdecider[methodName]\n\t\t}\n\n\t\treturn augmentedRender\n\t}\n\tassertNever(decider)\n}\n\nexport type { EnvironmentAwareFunctionComponent }\nexport { Component }\n"],"names":["augmentedRender"],"mappings":";;;AA4BA,SAAS,UACR,QACA,SAIA,aACC;AACD,QAAM,gBAAgB,CAAC,UAAiB,OAAO,OAAO,gBAAgB;AACtE,QAAM,gBAAgB,OAAO,WAAW,cAAc,OAAO,SAAS,IAAI,SAAS;AAEnF,MAAI,YAAY,UAAa,OAAO,YAAY,UAAU;AACzD,WAAO,cAAc;AACfA,UAAAA,mBAAuE,KAAY,aAAa;AACtGA,qBAAgB,eAAe;AAC/BA,qBAAgB,cAAc;AAEvBA,WAAAA;AAAAA,EACR;AAEA,SAAO,cAAc;AACf,QAAA,kBAA2F,KAAY,aAAa;AAC1H,kBAAgB,cAAc;AAE1B,MAAA,OAAO,YAAY,YAAY;AAClC,oBAAgB,eAAe;AAExB,WAAA;AAAA,EACR;AACI,MAAA,OAAO,YAAY,UAAU;AAChC,eAAW,iBAAiB,SAAS;AACpC,YAAM,aAAa;AACjB,sBAAgB,UAAU,IAC3B,QAAQ,UAAU;AAAA,IACpB;AAEO,WAAA;AAAA,EACR;AACA,cAAY,OAAO;AACpB;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterFieldsCollector.cjs","sources":["../../../../src/helperComponents/helpers/FilterFieldsCollector.ts"],"sourcesContent":["import { Schema, SchemaEntity } from '@contember/binding'\nimport { Filter } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nexport class FilterFieldsCollector {\n\tconstructor(\n\t\tprivate readonly schema: Schema,\n\t\tprivate readonly rootFilter: Filter,\n\t) {\n\t}\n\n\n\tcollectFields(entity: SchemaEntity): Set<string> {\n\t\tconst result = new Set<string>()\n\t\tthis.collectFieldsInternal(this.rootFilter, entity, [], result)\n\t\treturn result\n\t}\n\n\tprivate collectFieldsInternal(filter: Filter, entity: SchemaEntity, path: string[], result: Set<string>): void {\n\t\tfor (const [key, value] of Object.entries(filter)) {\n\t\t\tif (key === 'and' || key === 'or') {\n\t\t\t\t\tif (!Array.isArray(value)) {\n\t\t\t\t\t\tthrow new BindingError()\n\t\t\t\t\t}\n\t\t\t\t\tvalue?.forEach(it => this.collectFieldsInternal(it, entity, path, result))\n\n\t\t\t} else if (key === 'not') {\n\t\t\t\t\tthis.collectFieldsInternal(value as Filter, entity, path, result)\n\n\t\t\t} else {\n\t\t\t\tconst field = entity.fields.get(key)\n\t\t\t\tif (!field) {\n\t\t\t\t\tthrow new BindingError(`Invalid field: the name \"${key}\" does not exist on entity \"${entity.name}\" `\n\t\t\t\t\t\t+ `in a ${path.length === 0 ? 'root' : `path \"${path.join('.')}\"`} of a following filter:\\n`\n\t\t\t\t\t\t+ JSON.stringify(this.rootFilter, null, ' '))\n\t\t\t\t}\n\t\t\t\tif (field.__typename === '_Column') {\n\t\t\t\t\tresult.add([...path, key].join('.'))\n\t\t\t\t} else {\n\t\t\t\t\tconst entity = this.schema.getEntity(field.targetEntity)\n\t\t\t\t\tthis.collectFieldsInternal(value as Filter, entity, [...path, key], result)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":["BindingError","entity"],"mappings":";;;AAIO,MAAM,sBAAsB;AAAA,EAClC,YACkB,QACA,YAChB;AAFgB,SAAA,SAAA;AACA,SAAA,aAAA;AAAA,EAElB;AAAA,EAGA,cAAc,QAAmC;AAC1C,UAAA,6BAAa;AACnB,SAAK,sBAAsB,KAAK,YAAY,QAAQ,CAAA,GAAI,MAAM;AACvD,WAAA;AAAA,EACR;AAAA,EAEQ,sBAAsB,QAAgB,QAAsB,MAAgB,QAA2B;AAC9G,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AAC9C,UAAA,QAAQ,SAAS,QAAQ,MAAM;AACjC,YAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AAC1B,gBAAM,IAAIA,QAAa,aAAA;AAAA,QACxB;AACO,eAAA,QAAQ,QAAM,KAAK,sBAAsB,IAAI,QAAQ,MAAM,MAAM,CAAC;AAAA,MAAA,WAEhE,QAAQ,OAAO;AACxB,aAAK,sBAAsB,OAAiB,QAAQ,MAAM,MAAM;AAAA,MAAA,OAE3D;AACN,cAAM,QAAQ,OAAO,OAAO,IAAI,GAAG;AACnC,YAAI,CAAC,OAAO;AACX,gBAAM,IAAIA,QAAAA,aAAa,4BAA4B,
|
|
1
|
+
{"version":3,"file":"FilterFieldsCollector.cjs","sources":["../../../../src/helperComponents/helpers/FilterFieldsCollector.ts"],"sourcesContent":["import { Schema, SchemaEntity } from '@contember/binding'\nimport { Filter } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nexport class FilterFieldsCollector {\n\tconstructor(\n\t\tprivate readonly schema: Schema,\n\t\tprivate readonly rootFilter: Filter,\n\t) {\n\t}\n\n\n\tcollectFields(entity: SchemaEntity): Set<string> {\n\t\tconst result = new Set<string>()\n\t\tthis.collectFieldsInternal(this.rootFilter, entity, [], result)\n\t\treturn result\n\t}\n\n\tprivate collectFieldsInternal(filter: Filter, entity: SchemaEntity, path: string[], result: Set<string>): void {\n\t\tfor (const [key, value] of Object.entries(filter)) {\n\t\t\tif (key === 'and' || key === 'or') {\n\t\t\t\t\tif (!Array.isArray(value)) {\n\t\t\t\t\t\tthrow new BindingError()\n\t\t\t\t\t}\n\t\t\t\t\tvalue?.forEach(it => this.collectFieldsInternal(it, entity, path, result))\n\n\t\t\t} else if (key === 'not') {\n\t\t\t\t\tthis.collectFieldsInternal(value as Filter, entity, path, result)\n\n\t\t\t} else {\n\t\t\t\tconst field = entity.fields.get(key)\n\t\t\t\tif (!field) {\n\t\t\t\t\tthrow new BindingError(`Invalid field: the name \"${key}\" does not exist on entity \"${entity.name}\" `\n\t\t\t\t\t\t+ `in a ${path.length === 0 ? 'root' : `path \"${path.join('.')}\"`} of a following filter:\\n`\n\t\t\t\t\t\t+ JSON.stringify(this.rootFilter, null, ' '))\n\t\t\t\t}\n\t\t\t\tif (field.__typename === '_Column') {\n\t\t\t\t\tresult.add([...path, key].join('.'))\n\t\t\t\t} else {\n\t\t\t\t\tconst entity = this.schema.getEntity(field.targetEntity)\n\t\t\t\t\tthis.collectFieldsInternal(value as Filter, entity, [...path, key], result)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":["BindingError","entity"],"mappings":";;;AAIO,MAAM,sBAAsB;AAAA,EAClC,YACkB,QACA,YAChB;AAFgB,SAAA,SAAA;AACA,SAAA,a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Schema, SchemaEntity } from '@contember/binding'\nimport { Filter } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nexport class FilterFieldsCollector {\n\tconstructor(\n\t\tprivate readonly schema: Schema,\n\t\tprivate readonly rootFilter: Filter,\n\t) {\n\t}\n\n\n\tcollectFields(entity: SchemaEntity): Set<string> {\n\t\tconst result = new Set<string>()\n\t\tthis.collectFieldsInternal(this.rootFilter, entity, [], result)\n\t\treturn result\n\t}\n\n\tprivate collectFieldsInternal(filter: Filter, entity: SchemaEntity, path: string[], result: Set<string>): void {\n\t\tfor (const [key, value] of Object.entries(filter)) {\n\t\t\tif (key === 'and' || key === 'or') {\n\t\t\t\t\tif (!Array.isArray(value)) {\n\t\t\t\t\t\tthrow new BindingError()\n\t\t\t\t\t}\n\t\t\t\t\tvalue?.forEach(it => this.collectFieldsInternal(it, entity, path, result))\n\n\t\t\t} else if (key === 'not') {\n\t\t\t\t\tthis.collectFieldsInternal(value as Filter, entity, path, result)\n\n\t\t\t} else {\n\t\t\t\tconst field = entity.fields.get(key)\n\t\t\t\tif (!field) {\n\t\t\t\t\tthrow new BindingError(`Invalid field: the name \"${key}\" does not exist on entity \"${entity.name}\" `\n\t\t\t\t\t\t+ `in a ${path.length === 0 ? 'root' : `path \"${path.join('.')}\"`} of a following filter:\\n`\n\t\t\t\t\t\t+ JSON.stringify(this.rootFilter, null, ' '))\n\t\t\t\t}\n\t\t\t\tif (field.__typename === '_Column') {\n\t\t\t\t\tresult.add([...path, key].join('.'))\n\t\t\t\t} else {\n\t\t\t\t\tconst entity = this.schema.getEntity(field.targetEntity)\n\t\t\t\t\tthis.collectFieldsInternal(value as Filter, entity, [...path, key], result)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":["entity"],"mappings":";AAIO,MAAM,sBAAsB;AAAA,EAClC,YACkB,QACA,YAChB;AAFgB,SAAA,SAAA;AACA,SAAA,aAAA;AAAA,EAElB;AAAA,EAGA,cAAc,QAAmC;AAC1C,UAAA,6BAAa;AACnB,SAAK,sBAAsB,KAAK,YAAY,QAAQ,CAAA,GAAI,MAAM;AACvD,WAAA;AAAA,EACR;AAAA,EAEQ,sBAAsB,QAAgB,QAAsB,MAAgB,QAA2B;AAC9G,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AAC9C,UAAA,QAAQ,SAAS,QAAQ,MAAM;AACjC,YAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AAC1B,gBAAM,IAAI,aAAa;AAAA,QACxB;AACO,eAAA,QAAQ,QAAM,KAAK,sBAAsB,IAAI,QAAQ,MAAM,MAAM,CAAC;AAAA,MAAA,WAEhE,QAAQ,OAAO;AACxB,aAAK,sBAAsB,OAAiB,QAAQ,MAAM,MAAM;AAAA,MAAA,OAE3D;AACN,cAAM,QAAQ,OAAO,OAAO,IAAI,GAAG;AACnC,YAAI,CAAC,OAAO;AACX,gBAAM,IAAI,aAAa,4BAA4B,
|
|
1
|
+
{"version":3,"file":"FilterFieldsCollector.js","sources":["../../../../src/helperComponents/helpers/FilterFieldsCollector.ts"],"sourcesContent":["import { Schema, SchemaEntity } from '@contember/binding'\nimport { Filter } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nexport class FilterFieldsCollector {\n\tconstructor(\n\t\tprivate readonly schema: Schema,\n\t\tprivate readonly rootFilter: Filter,\n\t) {\n\t}\n\n\n\tcollectFields(entity: SchemaEntity): Set<string> {\n\t\tconst result = new Set<string>()\n\t\tthis.collectFieldsInternal(this.rootFilter, entity, [], result)\n\t\treturn result\n\t}\n\n\tprivate collectFieldsInternal(filter: Filter, entity: SchemaEntity, path: string[], result: Set<string>): void {\n\t\tfor (const [key, value] of Object.entries(filter)) {\n\t\t\tif (key === 'and' || key === 'or') {\n\t\t\t\t\tif (!Array.isArray(value)) {\n\t\t\t\t\t\tthrow new BindingError()\n\t\t\t\t\t}\n\t\t\t\t\tvalue?.forEach(it => this.collectFieldsInternal(it, entity, path, result))\n\n\t\t\t} else if (key === 'not') {\n\t\t\t\t\tthis.collectFieldsInternal(value as Filter, entity, path, result)\n\n\t\t\t} else {\n\t\t\t\tconst field = entity.fields.get(key)\n\t\t\t\tif (!field) {\n\t\t\t\t\tthrow new BindingError(`Invalid field: the name \"${key}\" does not exist on entity \"${entity.name}\" `\n\t\t\t\t\t\t+ `in a ${path.length === 0 ? 'root' : `path \"${path.join('.')}\"`} of a following filter:\\n`\n\t\t\t\t\t\t+ JSON.stringify(this.rootFilter, null, ' '))\n\t\t\t\t}\n\t\t\t\tif (field.__typename === '_Column') {\n\t\t\t\t\tresult.add([...path, key].join('.'))\n\t\t\t\t} else {\n\t\t\t\t\tconst entity = this.schema.getEntity(field.targetEntity)\n\t\t\t\t\tthis.collectFieldsInternal(value as Filter, entity, [...path, key], result)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":["entity"],"mappings":";AAIO,MAAM,sBAAsB;AAAA,EAClC,YACkB,QACA,YAChB;AAFgB,SAAA,SAAA;AACA,SAAA,aAAA;AAAA,EAElB;AAAA,EAGA,cAAc,QAAmC;AAC1C,UAAA,6BAAa;AACnB,SAAK,sBAAsB,KAAK,YAAY,QAAQ,CAAA,GAAI,MAAM;AACvD,WAAA;AAAA,EACR;AAAA,EAEQ,sBAAsB,QAAgB,QAAsB,MAAgB,QAA2B;AAC9G,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AAC9C,UAAA,QAAQ,SAAS,QAAQ,MAAM;AACjC,YAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AAC1B,gBAAM,IAAI,aAAa;AAAA,QACxB;AACO,eAAA,QAAQ,QAAM,KAAK,sBAAsB,IAAI,QAAQ,MAAM,MAAM,CAAC;AAAA,MAAA,WAEhE,QAAQ,OAAO;AACxB,aAAK,sBAAsB,OAAiB,QAAQ,MAAM,MAAM;AAAA,MAAA,OAE3D;AACN,cAAM,QAAQ,OAAO,OAAO,IAAI,GAAG;AACnC,YAAI,CAAC,OAAO;AACX,gBAAM,IAAI,aAAa,4BAA4B,GAAG,+BAA+B,OAAO,IAAI,UACrF,KAAK,WAAW,IAAI,SAAS,SAAS,KAAK,KAAK,GAAG,CAAC,GAAG;AAAA,IAC/D,KAAK,UAAU,KAAK,YAAY,MAAM,IAAI,CAAC;AAAA,QAC/C;AACI,YAAA,MAAM,eAAe,WAAW;AAC5B,iBAAA,IAAI,CAAC,GAAG,MAAM,GAAG,EAAE,KAAK,GAAG,CAAC;AAAA,QAAA,OAC7B;AACN,gBAAMA,UAAS,KAAK,OAAO,UAAU,MAAM,YAAY;AAClD,eAAA,sBAAsB,OAAiBA,SAAQ,CAAC,GAAG,MAAM,GAAG,GAAG,MAAM;AAAA,QAC3E;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;"}
|
|
@@ -26,6 +26,7 @@ const useHasEntity = require("./accessorPropagation/useHasEntity.cjs");
|
|
|
26
26
|
const useEntityList = require("./accessorPropagation/useEntityList.cjs");
|
|
27
27
|
const useEntityListSubTree = require("./accessorPropagation/useEntityListSubTree.cjs");
|
|
28
28
|
const useEntityListSubTreeParameters = require("./accessorPropagation/useEntityListSubTreeParameters.cjs");
|
|
29
|
+
const useEntityListSubTreeLoader = require("./accessorPropagation/useEntityListSubTreeLoader.cjs");
|
|
29
30
|
const useEntitySubTree = require("./accessorPropagation/useEntitySubTree.cjs");
|
|
30
31
|
const useEntitySubTreeParameters = require("./accessorPropagation/useEntitySubTreeParameters.cjs");
|
|
31
32
|
const useEnvironment = require("./accessorPropagation/useEnvironment.cjs");
|
|
@@ -94,6 +95,7 @@ exports.useHasEntity = useHasEntity.useHasEntity;
|
|
|
94
95
|
exports.useEntityList = useEntityList.useEntityList;
|
|
95
96
|
exports.useEntityListSubTree = useEntityListSubTree.useEntityListSubTree;
|
|
96
97
|
exports.useEntityListSubTreeParameters = useEntityListSubTreeParameters.useEntityListSubTreeParameters;
|
|
98
|
+
exports.useEntityListSubTreeLoader = useEntityListSubTreeLoader.useEntityListSubTreeLoader;
|
|
97
99
|
exports.useEntitySubTree = useEntitySubTree.useEntitySubTree;
|
|
98
100
|
exports.useEntitySubTreeParameters = useEntitySubTreeParameters.useEntitySubTreeParameters;
|
|
99
101
|
exports.useEnvironment = useEnvironment.useEnvironment;
|
|
@@ -139,7 +141,7 @@ exports.useLabelMiddleware = LabelMiddleware.useLabelMiddleware;
|
|
|
139
141
|
exports.StaticRender = StaticRender.StaticRender;
|
|
140
142
|
exports.SugaredField = SugaredField.SugaredField;
|
|
141
143
|
Object.keys(binding).forEach((k) => {
|
|
142
|
-
if (k !== "default" && !
|
|
144
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k))
|
|
143
145
|
Object.defineProperty(exports, k, {
|
|
144
146
|
enumerable: true,
|
|
145
147
|
get: () => binding[k]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/production/index.js
CHANGED
|
@@ -24,6 +24,7 @@ import { useHasEntity } from "./accessorPropagation/useHasEntity.js";
|
|
|
24
24
|
import { useEntityList } from "./accessorPropagation/useEntityList.js";
|
|
25
25
|
import { useEntityListSubTree } from "./accessorPropagation/useEntityListSubTree.js";
|
|
26
26
|
import { useEntityListSubTreeParameters } from "./accessorPropagation/useEntityListSubTreeParameters.js";
|
|
27
|
+
import { useEntityListSubTreeLoader } from "./accessorPropagation/useEntityListSubTreeLoader.js";
|
|
27
28
|
import { useEntitySubTree } from "./accessorPropagation/useEntitySubTree.js";
|
|
28
29
|
import { useEntitySubTreeParameters } from "./accessorPropagation/useEntitySubTreeParameters.js";
|
|
29
30
|
import { useEnvironment } from "./accessorPropagation/useEnvironment.js";
|
|
@@ -118,6 +119,7 @@ export {
|
|
|
118
119
|
useEntityKey,
|
|
119
120
|
useEntityList,
|
|
120
121
|
useEntityListSubTree,
|
|
122
|
+
useEntityListSubTreeLoader,
|
|
121
123
|
useEntityListSubTreeParameters,
|
|
122
124
|
useEntityPersistError,
|
|
123
125
|
useEntityPersistSuccess,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -4,5 +4,5 @@ export interface EntityProviderProps {
|
|
|
4
4
|
accessor: EntityAccessor;
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
}
|
|
7
|
-
export declare function AccessorProvider(props: EntityProviderProps): JSX.Element;
|
|
7
|
+
export declare function AccessorProvider(props: EntityProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
//# sourceMappingURL=AccessorProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccessorProvider.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/AccessorProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAIxD,MAAM,WAAW,mBAAmB;IACnC,QAAQ,EAAE,cAAc,CAAA;IACxB,QAAQ,EAAE,SAAS,CAAA;CACnB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"AccessorProvider.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/AccessorProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAIxD,MAAM,WAAW,mBAAmB;IACnC,QAAQ,EAAE,cAAc,CAAA;IACxB,QAAQ,EAAE,SAAS,CAAA;CACnB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,mBAAmB,2CAM1D"}
|
|
@@ -4,5 +4,5 @@ export interface BindingOperationsProviderProps {
|
|
|
4
4
|
bindingOperations: BindingOperations<ReactNode> | undefined;
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
}
|
|
7
|
-
export declare function BindingOperationsProvider(props: BindingOperationsProviderProps): JSX.Element;
|
|
7
|
+
export declare function BindingOperationsProvider(props: BindingOperationsProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
//# sourceMappingURL=BindingOperationsProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BindingOperationsProvider.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/BindingOperationsProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAG3D,MAAM,WAAW,8BAA8B;IAC9C,iBAAiB,EAAE,iBAAiB,CAAC,SAAS,CAAC,GAAG,SAAS,CAAA;IAC3D,QAAQ,EAAE,SAAS,CAAA;CACnB;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,8BAA8B,
|
|
1
|
+
{"version":3,"file":"BindingOperationsProvider.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/BindingOperationsProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAG3D,MAAM,WAAW,8BAA8B;IAC9C,iBAAiB,EAAE,iBAAiB,CAAC,SAAS,CAAC,GAAG,SAAS,CAAA;IAC3D,QAAQ,EAAE,SAAS,CAAA;CACnB;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,8BAA8B,2CAM9E"}
|
|
@@ -3,5 +3,5 @@ export interface EntityKeyProviderProps {
|
|
|
3
3
|
entityKey: string;
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
}
|
|
6
|
-
export declare function EntityKeyProvider(props: EntityKeyProviderProps): JSX.Element;
|
|
6
|
+
export declare function EntityKeyProvider(props: EntityKeyProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
//# sourceMappingURL=EntityKeyProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityKeyProvider.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/EntityKeyProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,MAAM,WAAW,sBAAsB;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,SAAS,CAAA;CACnB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"EntityKeyProvider.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/EntityKeyProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,MAAM,WAAW,sBAAsB;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,SAAS,CAAA;CACnB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,2CAE9D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { Environment } from '@contember/binding';
|
|
3
|
-
export declare const EnvironmentContext: import("react").Context<Environment
|
|
3
|
+
export declare const EnvironmentContext: import("react").Context<Environment<Environment.AnyNode | undefined>>;
|
|
4
4
|
export interface EnvironmentMiddlewareProps {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
create: (env: Environment) => Environment;
|
|
@@ -11,5 +11,5 @@ export interface EnvironmentWithExtensionProps<S, R> {
|
|
|
11
11
|
extension: Environment.Extension<S, R>;
|
|
12
12
|
state: S;
|
|
13
13
|
}
|
|
14
|
-
export declare const EnvironmentExtensionProvider: <S, R>(props: EnvironmentWithExtensionProps<S, R>) =>
|
|
14
|
+
export declare const EnvironmentExtensionProvider: <S, R>(props: EnvironmentWithExtensionProps<S, R>) => ReactNode;
|
|
15
15
|
//# sourceMappingURL=EnvironmentContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvironmentContext.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/EnvironmentContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,
|
|
1
|
+
{"version":3,"file":"EnvironmentContext.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/EnvironmentContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAe,MAAM,OAAO,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAIhD,eAAO,MAAM,kBAAkB,uEAAmD,CAAA;AAGlF,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,EAAE,SAAS,CAAA;IACnB,MAAM,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,WAAW,CAAA;CACzC;AAED,eAAO,MAAM,qBAAqB,kEAajC,CAAA;AAED,MAAM,WAAW,6BAA6B,CAAC,CAAC,EAAE,CAAC;IAClD,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IACtC,KAAK,EAAE,CAAC,CAAA;CACR;AAED,eAAO,MAAM,4BAA4B,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,6BAA6B,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,SAShG,CAAA"}
|
|
@@ -4,5 +4,5 @@ export interface TreeRootIdProviderProps {
|
|
|
4
4
|
treeRootId: TreeRootId | undefined;
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
}
|
|
7
|
-
export declare function TreeRootIdProvider(props: TreeRootIdProviderProps): JSX.Element;
|
|
7
|
+
export declare function TreeRootIdProvider(props: TreeRootIdProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
//# sourceMappingURL=TreeRootIdProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeRootIdProvider.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/TreeRootIdProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAGpD,MAAM,WAAW,uBAAuB;IACvC,UAAU,EAAE,UAAU,GAAG,SAAS,CAAA;IAClC,QAAQ,EAAE,SAAS,CAAA;CACnB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"TreeRootIdProvider.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/TreeRootIdProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAGpD,MAAM,WAAW,uBAAuB;IACvC,UAAU,EAAE,UAAU,GAAG,SAAS,CAAA;IAClC,QAAQ,EAAE,SAAS,CAAA;CACnB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CAEhE"}
|
|
@@ -14,6 +14,7 @@ export * from './useHasEntity';
|
|
|
14
14
|
export * from './useEntityList';
|
|
15
15
|
export * from './useEntityListSubTree';
|
|
16
16
|
export * from './useEntityListSubTreeParameters';
|
|
17
|
+
export * from './useEntityListSubTreeLoader';
|
|
17
18
|
export * from './useEntitySubTree';
|
|
18
19
|
export * from './useEntitySubTreeParameters';
|
|
19
20
|
export * from './useEnvironment';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/index.ts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAA;AAClC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,wBAAwB,CAAA;AACtC,cAAc,kCAAkC,CAAA;AAChD,cAAc,oCAAoC,CAAA;AAClD,cAAc,mCAAmC,CAAA;AACjD,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,kCAAkC,CAAA;AAChD,cAAc,oBAAoB,CAAA;AAClC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/index.ts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAA;AAClC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,wBAAwB,CAAA;AACtC,cAAc,kCAAkC,CAAA;AAChD,cAAc,oCAAoC,CAAA;AAClD,cAAc,mCAAmC,CAAA;AACjD,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,kCAAkC,CAAA;AAChD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA;AAClC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SugaredQualifiedEntityList, TreeRootId } from '@contember/binding';
|
|
3
|
+
export type UseEntityListSubTreeLoaderResult<State> = {
|
|
4
|
+
entities: SugaredQualifiedEntityList | undefined;
|
|
5
|
+
treeRootId: TreeRootId | undefined;
|
|
6
|
+
state: State | undefined;
|
|
7
|
+
};
|
|
8
|
+
export type EntityListSubTreeLoaderState = 'initial' | 'refreshing' | 'loaded';
|
|
9
|
+
export declare const useEntityListSubTreeLoader: <State>(entities: SugaredQualifiedEntityList | undefined, children: ReactNode, state?: State | undefined) => [UseEntityListSubTreeLoaderResult<State>, EntityListSubTreeLoaderState];
|
|
10
|
+
//# sourceMappingURL=useEntityListSubTreeLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEntityListSubTreeLoader.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/useEntityListSubTreeLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAA+B,MAAM,OAAO,CAAA;AAC7E,OAAO,EAAE,0BAA0B,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAI3E,MAAM,MAAM,gCAAgC,CAAC,KAAK,IAAI;IACrD,QAAQ,EAAE,0BAA0B,GAAG,SAAS,CAAA;IAChD,UAAU,EAAE,UAAU,GAAG,SAAS,CAAA;IAClC,KAAK,EAAE,KAAK,GAAG,SAAS,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,4BAA4B,GACrC,SAAS,GACT,YAAY,GACZ,QAAQ,CAAA;AAEX,eAAO,MAAM,0BAA0B,oBAAqB,0BAA0B,GAAG,SAAS,YAAY,SAAS,uGAoDtH,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortEntities.d.ts","sourceRoot":"","sources":["../../../src/accessorSorting/sortEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAExE,eAAO,MAAM,YAAY,aACd,cAAc,EAAE,eACb,mBAAmB,GAAG,SAAS,KAC1C,cAAc,
|
|
1
|
+
{"version":3,"file":"sortEntities.d.ts","sourceRoot":"","sources":["../../../src/accessorSorting/sortEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAExE,eAAO,MAAM,YAAY,aACd,cAAc,EAAE,eACb,mBAAmB,GAAG,SAAS,KAC1C,cAAc,EAUhB,CAAA"}
|
|
@@ -8,7 +8,7 @@ export interface AccessorTreeProps {
|
|
|
8
8
|
* @group Data binding
|
|
9
9
|
*/
|
|
10
10
|
export declare const AccessorTree: {
|
|
11
|
-
({ state, children }: AccessorTreeProps): JSX.Element;
|
|
11
|
+
({ state, children }: AccessorTreeProps): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
displayName: string;
|
|
13
13
|
};
|
|
14
14
|
//# sourceMappingURL=AccessorTree.d.ts.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { NamedExoticComponent, PropsWithChildren,
|
|
1
|
+
import { NamedExoticComponent, PropsWithChildren, ReactNode } from 'react';
|
|
2
2
|
import type { Environment } from '@contember/binding';
|
|
3
3
|
import type { MarkerProvider, StaticRenderProviderProps } from './MarkerProvider';
|
|
4
4
|
interface EnvironmentAwareFunctionComponent<P> {
|
|
5
|
-
(props: PropsWithChildren<P>, environment: Environment):
|
|
5
|
+
(props: PropsWithChildren<P>, environment: Environment): ReactNode;
|
|
6
6
|
displayName?: string | undefined;
|
|
7
7
|
}
|
|
8
8
|
declare function Component<Props extends {}>(statelessRender: EnvironmentAwareFunctionComponent<Props>, displayName?: string): NamedExoticComponent<Props>;
|
|
9
|
-
declare function Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(statefulRender: EnvironmentAwareFunctionComponent<Props>, staticRender: (props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) =>
|
|
9
|
+
declare function Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(statefulRender: EnvironmentAwareFunctionComponent<Props>, staticRender: (props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) => ReactNode, displayName?: string): NamedExoticComponent<Props>;
|
|
10
10
|
declare function Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(statefulRender: EnvironmentAwareFunctionComponent<Props>, markerProvisions: MarkerProvider<Props, NonStaticPropNames>, displayName?: string): NamedExoticComponent<Props>;
|
|
11
11
|
export type { EnvironmentAwareFunctionComponent };
|
|
12
12
|
export { Component };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.d.ts","sourceRoot":"","sources":["../../../src/coreComponents/Component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,oBAAoB,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"Component.d.ts","s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,SAAS,EAAE,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
2
|
import type { Environment } from '@contember/binding';
|
|
3
3
|
import type { EntityFieldMarkersContainer, EntityFieldsWithHoistablesMarker, FieldMarker, HasManyRelationMarker, HasOneRelationMarker } from '@contember/binding';
|
|
4
4
|
export interface EnvironmentDeltaProvider<Props extends {} = any> {
|
|
@@ -14,7 +14,7 @@ export type StaticRenderProviderProps<Props extends {} = any, NonStaticPropNames
|
|
|
14
14
|
NonStaticPropNames
|
|
15
15
|
] extends [never] ? Props : Omit<Props, NonStaticPropNames>;
|
|
16
16
|
export interface StaticRenderProvider<Props extends {} = any, NonStaticPropNames extends keyof Props = never> {
|
|
17
|
-
staticRender: (props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) =>
|
|
17
|
+
staticRender: (props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) => ReactNode;
|
|
18
18
|
}
|
|
19
19
|
export type CompleteMarkerProvider<Props extends {} = any, NonStaticPropNames extends keyof Props = never> = EnvironmentDeltaProvider<Props> & LeafMarkerProvider<Props> & BranchMarkerProvider<Props> & StaticRenderProvider<Props, NonStaticPropNames>;
|
|
20
20
|
export type MarkerProvider<Props extends {} = any, NonStaticPropNames extends keyof Props = never> = Partial<CompleteMarkerProvider<Props, NonStaticPropNames>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkerProvider.d.ts","sourceRoot":"","sources":["../../../src/coreComponents/MarkerProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"MarkerProvider.d.ts","sourceRoot":"","sources":["../../../src/coreComponents/MarkerProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO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