@contember/react-binding 2.0.0-alpha.24 → 2.0.0-alpha.26

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.
Files changed (86) hide show
  1. package/dist/development/index.cjs +5 -0
  2. package/dist/development/index.cjs.map +1 -1
  3. package/dist/development/index.js +5 -0
  4. package/dist/development/index.js.map +1 -1
  5. package/dist/development/src/accessorPropagation/EntityKeyContext.cjs.map +1 -1
  6. package/dist/development/src/accessorPropagation/EntityKeyContext.js.map +1 -1
  7. package/dist/development/src/accessorPropagation/EnvironmentContext.cjs +12 -8
  8. package/dist/development/src/accessorPropagation/EnvironmentContext.cjs.map +1 -1
  9. package/dist/development/src/accessorPropagation/EnvironmentContext.js +12 -8
  10. package/dist/development/src/accessorPropagation/EnvironmentContext.js.map +1 -1
  11. package/dist/development/src/accessorPropagation/useEntityListSubTreeLoader.cjs +27 -12
  12. package/dist/development/src/accessorPropagation/useEntityListSubTreeLoader.cjs.map +1 -1
  13. package/dist/development/src/accessorPropagation/useEntityListSubTreeLoader.js +27 -12
  14. package/dist/development/src/accessorPropagation/useEntityListSubTreeLoader.js.map +1 -1
  15. package/dist/development/src/accessorPropagation/useEntitySubTreeLoader.cjs +33 -15
  16. package/dist/development/src/accessorPropagation/useEntitySubTreeLoader.cjs.map +1 -1
  17. package/dist/development/src/accessorPropagation/useEntitySubTreeLoader.js +33 -15
  18. package/dist/development/src/accessorPropagation/useEntitySubTreeLoader.js.map +1 -1
  19. package/dist/development/src/helperComponents/RecursionTerminator.cjs +55 -0
  20. package/dist/development/src/helperComponents/RecursionTerminator.cjs.map +1 -0
  21. package/dist/development/src/helperComponents/RecursionTerminator.js +55 -0
  22. package/dist/development/src/helperComponents/RecursionTerminator.js.map +1 -0
  23. package/dist/development/src/helperComponents/RecursionTerminatorPortal.cjs +39 -0
  24. package/dist/development/src/helperComponents/RecursionTerminatorPortal.cjs.map +1 -0
  25. package/dist/development/src/helperComponents/RecursionTerminatorPortal.js +39 -0
  26. package/dist/development/src/helperComponents/RecursionTerminatorPortal.js.map +1 -0
  27. package/dist/development/src/markers/MarkerStaticAnalyzer.cjs +4 -1
  28. package/dist/development/src/markers/MarkerStaticAnalyzer.cjs.map +1 -1
  29. package/dist/development/src/markers/MarkerStaticAnalyzer.js +4 -1
  30. package/dist/development/src/markers/MarkerStaticAnalyzer.js.map +1 -1
  31. package/dist/production/index.cjs +5 -0
  32. package/dist/production/index.cjs.map +1 -1
  33. package/dist/production/index.js +5 -0
  34. package/dist/production/index.js.map +1 -1
  35. package/dist/production/src/accessorPropagation/EntityKeyContext.cjs.map +1 -1
  36. package/dist/production/src/accessorPropagation/EntityKeyContext.js.map +1 -1
  37. package/dist/production/src/accessorPropagation/EnvironmentContext.cjs +8 -4
  38. package/dist/production/src/accessorPropagation/EnvironmentContext.cjs.map +1 -1
  39. package/dist/production/src/accessorPropagation/EnvironmentContext.js +8 -4
  40. package/dist/production/src/accessorPropagation/EnvironmentContext.js.map +1 -1
  41. package/dist/production/src/accessorPropagation/useEntityListSubTreeLoader.cjs +27 -12
  42. package/dist/production/src/accessorPropagation/useEntityListSubTreeLoader.cjs.map +1 -1
  43. package/dist/production/src/accessorPropagation/useEntityListSubTreeLoader.js +27 -12
  44. package/dist/production/src/accessorPropagation/useEntityListSubTreeLoader.js.map +1 -1
  45. package/dist/production/src/accessorPropagation/useEntitySubTreeLoader.cjs +33 -15
  46. package/dist/production/src/accessorPropagation/useEntitySubTreeLoader.cjs.map +1 -1
  47. package/dist/production/src/accessorPropagation/useEntitySubTreeLoader.js +33 -15
  48. package/dist/production/src/accessorPropagation/useEntitySubTreeLoader.js.map +1 -1
  49. package/dist/production/src/helperComponents/RecursionTerminator.cjs +55 -0
  50. package/dist/production/src/helperComponents/RecursionTerminator.cjs.map +1 -0
  51. package/dist/production/src/helperComponents/RecursionTerminator.js +55 -0
  52. package/dist/production/src/helperComponents/RecursionTerminator.js.map +1 -0
  53. package/dist/production/src/helperComponents/RecursionTerminatorPortal.cjs +35 -0
  54. package/dist/production/src/helperComponents/RecursionTerminatorPortal.cjs.map +1 -0
  55. package/dist/production/src/helperComponents/RecursionTerminatorPortal.js +35 -0
  56. package/dist/production/src/helperComponents/RecursionTerminatorPortal.js.map +1 -0
  57. package/dist/production/src/markers/MarkerStaticAnalyzer.cjs +4 -1
  58. package/dist/production/src/markers/MarkerStaticAnalyzer.cjs.map +1 -1
  59. package/dist/production/src/markers/MarkerStaticAnalyzer.js +4 -1
  60. package/dist/production/src/markers/MarkerStaticAnalyzer.js.map +1 -1
  61. package/dist/types/accessorPropagation/EntityKeyContext.d.ts +1 -1
  62. package/dist/types/accessorPropagation/EntityKeyContext.d.ts.map +1 -1
  63. package/dist/types/accessorPropagation/EnvironmentContext.d.ts +4 -3
  64. package/dist/types/accessorPropagation/EnvironmentContext.d.ts.map +1 -1
  65. package/dist/types/accessorPropagation/useEntityListSubTreeLoader.d.ts +9 -1
  66. package/dist/types/accessorPropagation/useEntityListSubTreeLoader.d.ts.map +1 -1
  67. package/dist/types/accessorPropagation/useEntitySubTreeLoader.d.ts +9 -1
  68. package/dist/types/accessorPropagation/useEntitySubTreeLoader.d.ts.map +1 -1
  69. package/dist/types/helperComponents/RecursionTerminator.d.ts +22 -0
  70. package/dist/types/helperComponents/RecursionTerminator.d.ts.map +1 -0
  71. package/dist/types/helperComponents/RecursionTerminatorPortal.d.ts +3 -0
  72. package/dist/types/helperComponents/RecursionTerminatorPortal.d.ts.map +1 -0
  73. package/dist/types/helperComponents/index.d.ts +2 -0
  74. package/dist/types/helperComponents/index.d.ts.map +1 -1
  75. package/dist/types/markers/MarkerStaticAnalyzer.d.ts.map +1 -1
  76. package/dist/types/tsconfig.tsbuildinfo +1 -1
  77. package/package.json +7 -8
  78. package/src/accessorPropagation/EntityKeyContext.ts +1 -1
  79. package/src/accessorPropagation/EnvironmentContext.tsx +14 -9
  80. package/src/accessorPropagation/useEntityListSubTreeLoader.ts +41 -12
  81. package/src/accessorPropagation/useEntitySubTreeLoader.ts +49 -16
  82. package/src/helperComponents/RecursionTerminator.tsx +73 -0
  83. package/src/helperComponents/RecursionTerminatorPortal.tsx +35 -0
  84. package/src/helperComponents/index.ts +2 -0
  85. package/src/markers/MarkerStaticAnalyzer.ts +5 -1
  86. package/src/tsconfig.json +0 -1
@@ -63,6 +63,8 @@ const EntityView = require("./src/helperComponents/EntityView.cjs");
63
63
  const If = require("./src/helperComponents/If.cjs");
64
64
  const FieldView = require("./src/helperComponents/FieldView.cjs");
65
65
  const LabelMiddleware = require("./src/helperComponents/LabelMiddleware.cjs");
66
+ const RecursionTerminator = require("./src/helperComponents/RecursionTerminator.cjs");
67
+ const RecursionTerminatorPortal = require("./src/helperComponents/RecursionTerminatorPortal.cjs");
66
68
  const StaticRender = require("./src/helperComponents/StaticRender.cjs");
67
69
  const SugaredField = require("./src/helperComponents/SugaredField.cjs");
68
70
  const Variable = require("./src/helperComponents/Variable.cjs");
@@ -133,6 +135,9 @@ exports.FieldView = FieldView.FieldView;
133
135
  exports.LabelMiddlewareContext = LabelMiddleware.LabelMiddlewareContext;
134
136
  exports.LabelMiddlewareProvider = LabelMiddleware.LabelMiddlewareProvider;
135
137
  exports.useLabelMiddleware = LabelMiddleware.useLabelMiddleware;
138
+ exports.RecursionTerminator = RecursionTerminator.RecursionTerminator;
139
+ exports.recursionTerminatorEnvironmentExtension = RecursionTerminator.recursionTerminatorEnvironmentExtension;
140
+ exports.RecursionTerminatorPortal = RecursionTerminatorPortal.RecursionTerminatorPortal;
136
141
  exports.StaticRender = StaticRender.StaticRender;
137
142
  exports.SugaredField = SugaredField.SugaredField;
138
143
  exports.Variable = Variable.Variable;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -61,6 +61,8 @@ import { EntityView } from "./src/helperComponents/EntityView.js";
61
61
  import { If } from "./src/helperComponents/If.js";
62
62
  import { FieldView } from "./src/helperComponents/FieldView.js";
63
63
  import { LabelMiddlewareContext, LabelMiddlewareProvider, useLabelMiddleware } from "./src/helperComponents/LabelMiddleware.js";
64
+ import { RecursionTerminator, recursionTerminatorEnvironmentExtension } from "./src/helperComponents/RecursionTerminator.js";
65
+ import { RecursionTerminatorPortal } from "./src/helperComponents/RecursionTerminatorPortal.js";
64
66
  import { StaticRender } from "./src/helperComponents/StaticRender.js";
65
67
  import { SugaredField } from "./src/helperComponents/SugaredField.js";
66
68
  import { Variable } from "./src/helperComponents/Variable.js";
@@ -93,12 +95,15 @@ export {
93
95
  MarkerTreeGenerator,
94
96
  MutationStateContext,
95
97
  ParentEntity,
98
+ RecursionTerminator,
99
+ RecursionTerminatorPortal,
96
100
  SetOrderFieldOnCreate,
97
101
  StaticRender,
98
102
  SugaredField,
99
103
  TreeRootIdProvider,
100
104
  Variable,
101
105
  addEntityAtIndex,
106
+ recursionTerminatorEnvironmentExtension,
102
107
  repairEntitiesOrder,
103
108
  sortEntities,
104
109
  useAccessorTreeState,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityKeyContext.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/EntityKeyContext.ts"],"sourcesContent":["import { EntityAccessor } from '@contember/binding-common'\nimport { createContext } from 'react'\n\nexport const EntityKeyContext = createContext<undefined | string | (() => EntityAccessor)>(undefined)\nEntityKeyContext.displayName = 'EntityKeyContext'\n"],"names":["createContext"],"mappings":";;;AAGa,MAAA,mBAAmBA,MAAAA,cAA2D,MAAS;AACpG,iBAAiB,cAAc;;"}
1
+ {"version":3,"file":"EntityKeyContext.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/EntityKeyContext.ts"],"sourcesContent":["import { EntityAccessor } from '@contember/binding'\nimport { createContext } from 'react'\n\nexport const EntityKeyContext = createContext<undefined | string | (() => EntityAccessor)>(undefined)\nEntityKeyContext.displayName = 'EntityKeyContext'\n"],"names":["createContext"],"mappings":";;;AAGa,MAAA,mBAAmBA,MAAAA,cAA2D,MAAS;AACpG,iBAAiB,cAAc;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityKeyContext.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/EntityKeyContext.ts"],"sourcesContent":["import { EntityAccessor } from '@contember/binding-common'\nimport { createContext } from 'react'\n\nexport const EntityKeyContext = createContext<undefined | string | (() => EntityAccessor)>(undefined)\nEntityKeyContext.displayName = 'EntityKeyContext'\n"],"names":[],"mappings":";AAGa,MAAA,mBAAmB,cAA2D,MAAS;AACpG,iBAAiB,cAAc;"}
1
+ {"version":3,"file":"EntityKeyContext.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/EntityKeyContext.ts"],"sourcesContent":["import { EntityAccessor } from '@contember/binding'\nimport { createContext } from 'react'\n\nexport const EntityKeyContext = createContext<undefined | string | (() => EntityAccessor)>(undefined)\nEntityKeyContext.displayName = 'EntityKeyContext'\n"],"names":[],"mappings":";AAGa,MAAA,mBAAmB,cAA2D,MAAS;AACpG,iBAAiB,cAAc;"}
@@ -8,12 +8,16 @@ const Component = require("../coreComponents/Component.cjs");
8
8
  const EnvironmentContext = React.createContext(binding.Environment.create());
9
9
  EnvironmentContext.displayName = "EnvironmentContext";
10
10
  const EnvironmentMiddleware = Component.Component(
11
- ({ children, create }) => {
11
+ ({ children, create, args }) => {
12
12
  const env = useEnvironment.useEnvironment();
13
- const envWithExtension = React.useMemo(() => create(env), [env, create]);
13
+ const envWithExtension = React.useMemo(
14
+ () => create(env, args ?? []),
15
+ // eslint-disable-next-line react-hooks/exhaustive-deps
16
+ [env, create, ...args ?? []]
17
+ );
14
18
  return /* @__PURE__ */ jsxDevRuntime.jsxDEV(EnvironmentContext.Provider, { value: envWithExtension, children }, void 0, false, {
15
19
  fileName: "/home/runner/work/contember/contember/packages/react-binding/src/accessorPropagation/EnvironmentContext.tsx",
16
- lineNumber: 19,
20
+ lineNumber: 24,
17
21
  columnNumber: 10
18
22
  }, void 0);
19
23
  },
@@ -21,12 +25,12 @@ const EnvironmentMiddleware = Component.Component(
21
25
  staticRender: ({ children }) => {
22
26
  return /* @__PURE__ */ jsxDevRuntime.jsxDEV(jsxDevRuntime.Fragment, { children }, void 0, false, {
23
27
  fileName: "/home/runner/work/contember/contember/packages/react-binding/src/accessorPropagation/EnvironmentContext.tsx",
24
- lineNumber: 23,
28
+ lineNumber: 28,
25
29
  columnNumber: 11
26
30
  }, void 0);
27
31
  },
28
- generateEnvironment: ({ create }, env) => {
29
- return create(env);
32
+ generateEnvironment: ({ create, args }, env) => {
33
+ return create(env, args ?? []);
30
34
  }
31
35
  }
32
36
  );
@@ -35,7 +39,7 @@ const EnvironmentExtensionProvider = Component.Component(
35
39
  const create = React.useCallback((env) => env.withExtension(extension, state), [extension, state]);
36
40
  return /* @__PURE__ */ jsxDevRuntime.jsxDEV(EnvironmentMiddleware, { create, children }, void 0, false, {
37
41
  fileName: "/home/runner/work/contember/contember/packages/react-binding/src/accessorPropagation/EnvironmentContext.tsx",
38
- lineNumber: 40,
42
+ lineNumber: 45,
39
43
  columnNumber: 10
40
44
  }, void 0);
41
45
  },
@@ -43,7 +47,7 @@ const EnvironmentExtensionProvider = Component.Component(
43
47
  const create = (env) => env.withExtension(extension, state);
44
48
  return /* @__PURE__ */ jsxDevRuntime.jsxDEV(EnvironmentMiddleware, { create, children }, void 0, false, {
45
49
  fileName: "/home/runner/work/contember/contember/packages/react-binding/src/accessorPropagation/EnvironmentContext.tsx",
46
- lineNumber: 44,
50
+ lineNumber: 49,
47
51
  columnNumber: 10
48
52
  }, void 0);
49
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"EnvironmentContext.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/EnvironmentContext.tsx"],"sourcesContent":["import { createContext, ReactNode, useCallback, useMemo } from 'react'\nimport { Environment } from '@contember/binding'\nimport { useEnvironment } from './useEnvironment'\nimport { Component } from '../coreComponents'\n\nexport const EnvironmentContext = createContext<Environment>(Environment.create())\nEnvironmentContext.displayName = 'EnvironmentContext'\n\nexport interface EnvironmentMiddlewareProps {\n\tchildren: ReactNode\n\tcreate: (env: Environment) => Environment\n}\n\nexport const EnvironmentMiddleware = Component(\n\t({ children, create }: EnvironmentMiddlewareProps) => {\n\t\tconst env = useEnvironment()\n\t\tconst envWithExtension = useMemo(() => create(env), [env, create])\n\n\t\treturn <EnvironmentContext.Provider value={envWithExtension}>{children}</EnvironmentContext.Provider>\n\t},\n\t{\n\t\tstaticRender: ({ children }) => {\n\t\t\treturn <>{children}</>\n\t\t},\n\t\tgenerateEnvironment: ({ create }, env) => {\n\t\t\treturn create(env)\n\t\t},\n\t},\n)\n\nexport interface EnvironmentWithExtensionProps<S, R> {\n\tchildren: ReactNode\n\textension: Environment.Extension<S, R>\n\tstate: S\n}\n\nexport const EnvironmentExtensionProvider: <S, R>(props: EnvironmentWithExtensionProps<S, R>) => ReactNode = Component(\n\t({ children, extension, state }) => {\n\t\tconst create = useCallback((env: Environment) => env.withExtension(extension, state), [extension, state])\n\t\treturn <EnvironmentMiddleware create={create}>{children}</EnvironmentMiddleware>\n\t},\n\t({ children, extension, state }) => {\n\t\tconst create = (env: Environment) => env.withExtension(extension, state)\n\t\treturn <EnvironmentMiddleware create={create}>{children}</EnvironmentMiddleware>\n\t},\n)\n"],"names":["createContext","Environment","Component","useEnvironment","useMemo","this","useCallback","jsxDEV"],"mappings":";;;;;;;AAKO,MAAM,qBAAqBA,MAAA,cAA2BC,oBAAY,QAAQ;AACjF,mBAAmB,cAAc;AAO1B,MAAM,wBAAwBC,UAAA;AAAA,EACpC,CAAC,EAAE,UAAU,aAAyC;AACrD,UAAM,MAAMC,eAAAA;AACN,UAAA,mBAAmBC,cAAQ,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,MAAM,CAAC;AAEjE,gDAAQ,mBAAmB,UAAnB,EAA4B,OAAO,kBAAmB,SAAvD,GAAA,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAgE,GAAAC,MAAA;AAAA,EACxE;AAAA,EACA;AAAA,IACC,cAAc,CAAC,EAAE,eAAe;AAC/B,4EAAU,SAAH,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAY,GAAAA,MAAA;AAAA,IACpB;AAAA,IACA,qBAAqB,CAAC,EAAE,UAAU,QAAQ;AACzC,aAAO,OAAO,GAAG;AAAA,IAClB;AAAA,EACD;AACD;AAQO,MAAM,+BAAgGH,UAAA;AAAA,EAC5G,CAAC,EAAE,UAAU,WAAW,YAAY;AACnC,UAAM,SAASI,MAAAA,YAAY,CAAC,QAAqB,IAAI,cAAc,WAAW,KAAK,GAAG,CAAC,WAAW,KAAK,CAAC;AACjG,WAAAC,8BAAAA,OAAC,uBAAsB,EAAA,QAAiB,YAAxC,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAiD,GAAAF,MAAA;AAAA,EACzD;AAAA,EACA,CAAC,EAAE,UAAU,WAAW,YAAY;AACnC,UAAM,SAAS,CAAC,QAAqB,IAAI,cAAc,WAAW,KAAK;AAChE,WAAAE,8BAAAA,OAAC,uBAAsB,EAAA,QAAiB,YAAxC,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAiD,GAAAF,MAAA;AAAA,EACzD;AACD;;;;"}
1
+ {"version":3,"file":"EnvironmentContext.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/EnvironmentContext.tsx"],"sourcesContent":["import { ComponentType, createContext, ReactNode, useCallback, useMemo } from 'react'\nimport { Environment } from '@contember/binding'\nimport { useEnvironment } from './useEnvironment'\nimport { Component } from '../coreComponents'\n\nexport const EnvironmentContext = createContext<Environment>(Environment.create())\nEnvironmentContext.displayName = 'EnvironmentContext'\n\nexport interface EnvironmentMiddlewareProps<T extends unknown[]> {\n\tchildren: ReactNode\n\tcreate: (env: Environment, args: T) => Environment\n\targs?: T\n}\n\nexport const EnvironmentMiddleware = Component<EnvironmentMiddlewareProps<unknown[]>>(\n\t({ children, create, args }) => {\n\t\tconst env = useEnvironment()\n\t\tconst envWithExtension = useMemo(\n\t\t\t() => create(env, args ?? []),\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t\t[env, create, ...(args ?? [])],\n\t\t)\n\n\t\treturn <EnvironmentContext.Provider value={envWithExtension}>{children}</EnvironmentContext.Provider>\n\t},\n\t{\n\t\tstaticRender: ({ children }) => {\n\t\t\treturn <>{children}</>\n\t\t},\n\t\tgenerateEnvironment: ({ create, args }, env) => {\n\t\t\treturn create(env, args ?? [])\n\t\t},\n\t},\n) as <T extends unknown[]>(props: EnvironmentMiddlewareProps<T>) => ReactNode\n\nexport interface EnvironmentWithExtensionProps<S, R> {\n\tchildren: ReactNode\n\textension: Environment.Extension<S, R>\n\tstate: S\n}\n\nexport const EnvironmentExtensionProvider: <S, R>(props: EnvironmentWithExtensionProps<S, R>) => ReactNode = Component(\n\t({ children, extension, state }) => {\n\t\tconst create = useCallback((env: Environment) => env.withExtension(extension, state), [extension, state])\n\t\treturn <EnvironmentMiddleware create={create}>{children}</EnvironmentMiddleware>\n\t},\n\t({ children, extension, state }) => {\n\t\tconst create = (env: Environment) => env.withExtension(extension, state)\n\t\treturn <EnvironmentMiddleware create={create}>{children}</EnvironmentMiddleware>\n\t},\n)\n"],"names":["createContext","Environment","Component","useEnvironment","useMemo","this","useCallback","jsxDEV"],"mappings":";;;;;;;AAKO,MAAM,qBAAqBA,MAAA,cAA2BC,oBAAY,QAAQ;AACjF,mBAAmB,cAAc;AAQ1B,MAAM,wBAAwBC,UAAA;AAAA,EACpC,CAAC,EAAE,UAAU,QAAQ,WAAW;AAC/B,UAAM,MAAMC,eAAAA;AACZ,UAAM,mBAAmBC,MAAA;AAAA,MACxB,MAAM,OAAO,KAAK,QAAQ,EAAE;AAAA;AAAA,MAE5B,CAAC,KAAK,QAAQ,GAAI,QAAQ,CAAA,CAAG;AAAA,IAAA;AAG9B,gDAAQ,mBAAmB,UAAnB,EAA4B,OAAO,kBAAmB,SAAvD,GAAA,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAgE,GAAAC,MAAA;AAAA,EACxE;AAAA,EACA;AAAA,IACC,cAAc,CAAC,EAAE,eAAe;AAC/B,4EAAU,SAAH,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAY,GAAAA,MAAA;AAAA,IACpB;AAAA,IACA,qBAAqB,CAAC,EAAE,QAAQ,KAAA,GAAQ,QAAQ;AAC/C,aAAO,OAAO,KAAK,QAAQ,CAAE,CAAA;AAAA,IAC9B;AAAA,EACD;AACD;AAQO,MAAM,+BAAgGH,UAAA;AAAA,EAC5G,CAAC,EAAE,UAAU,WAAW,YAAY;AACnC,UAAM,SAASI,MAAAA,YAAY,CAAC,QAAqB,IAAI,cAAc,WAAW,KAAK,GAAG,CAAC,WAAW,KAAK,CAAC;AACjG,WAAAC,8BAAAA,OAAC,uBAAsB,EAAA,QAAiB,YAAxC,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAiD,GAAAF,MAAA;AAAA,EACzD;AAAA,EACA,CAAC,EAAE,UAAU,WAAW,YAAY;AACnC,UAAM,SAAS,CAAC,QAAqB,IAAI,cAAc,WAAW,KAAK;AAChE,WAAAE,8BAAAA,OAAC,uBAAsB,EAAA,QAAiB,YAAxC,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAiD,GAAAF,MAAA;AAAA,EACzD;AACD;;;;"}
@@ -6,12 +6,16 @@ import { Component } from "../coreComponents/Component.js";
6
6
  const EnvironmentContext = createContext(Environment.create());
7
7
  EnvironmentContext.displayName = "EnvironmentContext";
8
8
  const EnvironmentMiddleware = Component(
9
- ({ children, create }) => {
9
+ ({ children, create, args }) => {
10
10
  const env = useEnvironment();
11
- const envWithExtension = useMemo(() => create(env), [env, create]);
11
+ const envWithExtension = useMemo(
12
+ () => create(env, args ?? []),
13
+ // eslint-disable-next-line react-hooks/exhaustive-deps
14
+ [env, create, ...args ?? []]
15
+ );
12
16
  return /* @__PURE__ */ jsxDEV(EnvironmentContext.Provider, { value: envWithExtension, children }, void 0, false, {
13
17
  fileName: "/home/runner/work/contember/contember/packages/react-binding/src/accessorPropagation/EnvironmentContext.tsx",
14
- lineNumber: 19,
18
+ lineNumber: 24,
15
19
  columnNumber: 10
16
20
  }, void 0);
17
21
  },
@@ -19,12 +23,12 @@ const EnvironmentMiddleware = Component(
19
23
  staticRender: ({ children }) => {
20
24
  return /* @__PURE__ */ jsxDEV(Fragment, { children }, void 0, false, {
21
25
  fileName: "/home/runner/work/contember/contember/packages/react-binding/src/accessorPropagation/EnvironmentContext.tsx",
22
- lineNumber: 23,
26
+ lineNumber: 28,
23
27
  columnNumber: 11
24
28
  }, void 0);
25
29
  },
26
- generateEnvironment: ({ create }, env) => {
27
- return create(env);
30
+ generateEnvironment: ({ create, args }, env) => {
31
+ return create(env, args ?? []);
28
32
  }
29
33
  }
30
34
  );
@@ -33,7 +37,7 @@ const EnvironmentExtensionProvider = Component(
33
37
  const create = useCallback((env) => env.withExtension(extension, state), [extension, state]);
34
38
  return /* @__PURE__ */ jsxDEV(EnvironmentMiddleware, { create, children }, void 0, false, {
35
39
  fileName: "/home/runner/work/contember/contember/packages/react-binding/src/accessorPropagation/EnvironmentContext.tsx",
36
- lineNumber: 40,
40
+ lineNumber: 45,
37
41
  columnNumber: 10
38
42
  }, void 0);
39
43
  },
@@ -41,7 +45,7 @@ const EnvironmentExtensionProvider = Component(
41
45
  const create = (env) => env.withExtension(extension, state);
42
46
  return /* @__PURE__ */ jsxDEV(EnvironmentMiddleware, { create, children }, void 0, false, {
43
47
  fileName: "/home/runner/work/contember/contember/packages/react-binding/src/accessorPropagation/EnvironmentContext.tsx",
44
- lineNumber: 44,
48
+ lineNumber: 49,
45
49
  columnNumber: 10
46
50
  }, void 0);
47
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"EnvironmentContext.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/EnvironmentContext.tsx"],"sourcesContent":["import { createContext, ReactNode, useCallback, useMemo } from 'react'\nimport { Environment } from '@contember/binding'\nimport { useEnvironment } from './useEnvironment'\nimport { Component } from '../coreComponents'\n\nexport const EnvironmentContext = createContext<Environment>(Environment.create())\nEnvironmentContext.displayName = 'EnvironmentContext'\n\nexport interface EnvironmentMiddlewareProps {\n\tchildren: ReactNode\n\tcreate: (env: Environment) => Environment\n}\n\nexport const EnvironmentMiddleware = Component(\n\t({ children, create }: EnvironmentMiddlewareProps) => {\n\t\tconst env = useEnvironment()\n\t\tconst envWithExtension = useMemo(() => create(env), [env, create])\n\n\t\treturn <EnvironmentContext.Provider value={envWithExtension}>{children}</EnvironmentContext.Provider>\n\t},\n\t{\n\t\tstaticRender: ({ children }) => {\n\t\t\treturn <>{children}</>\n\t\t},\n\t\tgenerateEnvironment: ({ create }, env) => {\n\t\t\treturn create(env)\n\t\t},\n\t},\n)\n\nexport interface EnvironmentWithExtensionProps<S, R> {\n\tchildren: ReactNode\n\textension: Environment.Extension<S, R>\n\tstate: S\n}\n\nexport const EnvironmentExtensionProvider: <S, R>(props: EnvironmentWithExtensionProps<S, R>) => ReactNode = Component(\n\t({ children, extension, state }) => {\n\t\tconst create = useCallback((env: Environment) => env.withExtension(extension, state), [extension, state])\n\t\treturn <EnvironmentMiddleware create={create}>{children}</EnvironmentMiddleware>\n\t},\n\t({ children, extension, state }) => {\n\t\tconst create = (env: Environment) => env.withExtension(extension, state)\n\t\treturn <EnvironmentMiddleware create={create}>{children}</EnvironmentMiddleware>\n\t},\n)\n"],"names":["this"],"mappings":";;;;;AAKO,MAAM,qBAAqB,cAA2B,YAAY,QAAQ;AACjF,mBAAmB,cAAc;AAO1B,MAAM,wBAAwB;AAAA,EACpC,CAAC,EAAE,UAAU,aAAyC;AACrD,UAAM,MAAM;AACN,UAAA,mBAAmB,QAAQ,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,MAAM,CAAC;AAEjE,kCAAQ,mBAAmB,UAAnB,EAA4B,OAAO,kBAAmB,SAAvD,GAAA,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAgE,GAAAA,MAAA;AAAA,EACxE;AAAA,EACA;AAAA,IACC,cAAc,CAAC,EAAE,eAAe;AAC/B,gDAAU,SAAH,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAY,GAAAA,MAAA;AAAA,IACpB;AAAA,IACA,qBAAqB,CAAC,EAAE,UAAU,QAAQ;AACzC,aAAO,OAAO,GAAG;AAAA,IAClB;AAAA,EACD;AACD;AAQO,MAAM,+BAAgG;AAAA,EAC5G,CAAC,EAAE,UAAU,WAAW,YAAY;AACnC,UAAM,SAAS,YAAY,CAAC,QAAqB,IAAI,cAAc,WAAW,KAAK,GAAG,CAAC,WAAW,KAAK,CAAC;AACjG,WAAA,uBAAC,uBAAsB,EAAA,QAAiB,YAAxC,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAiD,GAAAA,MAAA;AAAA,EACzD;AAAA,EACA,CAAC,EAAE,UAAU,WAAW,YAAY;AACnC,UAAM,SAAS,CAAC,QAAqB,IAAI,cAAc,WAAW,KAAK;AAChE,WAAA,uBAAC,uBAAsB,EAAA,QAAiB,YAAxC,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAiD,GAAAA,MAAA;AAAA,EACzD;AACD;"}
1
+ {"version":3,"file":"EnvironmentContext.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/EnvironmentContext.tsx"],"sourcesContent":["import { ComponentType, createContext, ReactNode, useCallback, useMemo } from 'react'\nimport { Environment } from '@contember/binding'\nimport { useEnvironment } from './useEnvironment'\nimport { Component } from '../coreComponents'\n\nexport const EnvironmentContext = createContext<Environment>(Environment.create())\nEnvironmentContext.displayName = 'EnvironmentContext'\n\nexport interface EnvironmentMiddlewareProps<T extends unknown[]> {\n\tchildren: ReactNode\n\tcreate: (env: Environment, args: T) => Environment\n\targs?: T\n}\n\nexport const EnvironmentMiddleware = Component<EnvironmentMiddlewareProps<unknown[]>>(\n\t({ children, create, args }) => {\n\t\tconst env = useEnvironment()\n\t\tconst envWithExtension = useMemo(\n\t\t\t() => create(env, args ?? []),\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t\t[env, create, ...(args ?? [])],\n\t\t)\n\n\t\treturn <EnvironmentContext.Provider value={envWithExtension}>{children}</EnvironmentContext.Provider>\n\t},\n\t{\n\t\tstaticRender: ({ children }) => {\n\t\t\treturn <>{children}</>\n\t\t},\n\t\tgenerateEnvironment: ({ create, args }, env) => {\n\t\t\treturn create(env, args ?? [])\n\t\t},\n\t},\n) as <T extends unknown[]>(props: EnvironmentMiddlewareProps<T>) => ReactNode\n\nexport interface EnvironmentWithExtensionProps<S, R> {\n\tchildren: ReactNode\n\textension: Environment.Extension<S, R>\n\tstate: S\n}\n\nexport const EnvironmentExtensionProvider: <S, R>(props: EnvironmentWithExtensionProps<S, R>) => ReactNode = Component(\n\t({ children, extension, state }) => {\n\t\tconst create = useCallback((env: Environment) => env.withExtension(extension, state), [extension, state])\n\t\treturn <EnvironmentMiddleware create={create}>{children}</EnvironmentMiddleware>\n\t},\n\t({ children, extension, state }) => {\n\t\tconst create = (env: Environment) => env.withExtension(extension, state)\n\t\treturn <EnvironmentMiddleware create={create}>{children}</EnvironmentMiddleware>\n\t},\n)\n"],"names":["this"],"mappings":";;;;;AAKO,MAAM,qBAAqB,cAA2B,YAAY,QAAQ;AACjF,mBAAmB,cAAc;AAQ1B,MAAM,wBAAwB;AAAA,EACpC,CAAC,EAAE,UAAU,QAAQ,WAAW;AAC/B,UAAM,MAAM;AACZ,UAAM,mBAAmB;AAAA,MACxB,MAAM,OAAO,KAAK,QAAQ,EAAE;AAAA;AAAA,MAE5B,CAAC,KAAK,QAAQ,GAAI,QAAQ,CAAA,CAAG;AAAA,IAAA;AAG9B,kCAAQ,mBAAmB,UAAnB,EAA4B,OAAO,kBAAmB,SAAvD,GAAA,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAgE,GAAAA,MAAA;AAAA,EACxE;AAAA,EACA;AAAA,IACC,cAAc,CAAC,EAAE,eAAe;AAC/B,gDAAU,SAAH,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAY,GAAAA,MAAA;AAAA,IACpB;AAAA,IACA,qBAAqB,CAAC,EAAE,QAAQ,KAAA,GAAQ,QAAQ;AAC/C,aAAO,OAAO,KAAK,QAAQ,CAAE,CAAA;AAAA,IAC9B;AAAA,EACD;AACD;AAQO,MAAM,+BAAgG;AAAA,EAC5G,CAAC,EAAE,UAAU,WAAW,YAAY;AACnC,UAAM,SAAS,YAAY,CAAC,QAAqB,IAAI,cAAc,WAAW,KAAK,GAAG,CAAC,WAAW,KAAK,CAAC;AACjG,WAAA,uBAAC,uBAAsB,EAAA,QAAiB,YAAxC,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAiD,GAAAA,MAAA;AAAA,EACzD;AAAA,EACA,CAAC,EAAE,UAAU,WAAW,YAAY;AACnC,UAAM,SAAS,CAAC,QAAqB,IAAI,cAAc,WAAW,KAAK;AAChE,WAAA,uBAAC,uBAAsB,EAAA,QAAiB,YAAxC,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAiD,GAAAA,MAAA;AAAA,EACzD;AACD;"}
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const React = require("react");
4
4
  const useExtendTree = require("./useExtendTree.cjs");
5
+ const reactUtils = require("@contember/react-utils");
5
6
  const EntityListSubTree = require("../coreComponents/EntityListSubTree.cjs");
7
+ const emptyObject = {};
6
8
  const useEntityListSubTreeLoader = (entities, children, state) => {
7
9
  const [displayedState, setDisplayedState] = React.useState({
8
10
  state: "initial",
@@ -14,17 +16,19 @@ const useEntityListSubTreeLoader = (entities, children, state) => {
14
16
  const currentlyLoading = React.useRef();
15
17
  const extendTree = useExtendTree.useExtendTree();
16
18
  const [reloadTrigger, setReloadTrigger] = React.useState(null);
19
+ const memoizedEntities = reactUtils.useObjectMemo(entities ?? emptyObject);
20
+ const resolvedEntities = entities ? memoizedEntities : void 0;
17
21
  React.useEffect(() => {
18
22
  (async () => {
19
- if (!entities) {
23
+ if (!resolvedEntities) {
20
24
  return;
21
25
  }
22
26
  currentlyLoading.current = {
23
- entities,
27
+ entities: resolvedEntities,
24
28
  state
25
29
  };
26
30
  setDisplayedState((it) => {
27
- if (it.state === "initial" || it.state === "loading") {
31
+ if (it.state === "initial" || it.state === "loading" || it.state === "failed") {
28
32
  return {
29
33
  ...it,
30
34
  isLoading: true,
@@ -40,26 +44,37 @@ const useEntityListSubTreeLoader = (entities, children, state) => {
40
44
  });
41
45
  const newTreeRootId = await extendTree(
42
46
  React.createElement(EntityListSubTree.EntityListSubTree, {
43
- ...entities,
47
+ ...resolvedEntities,
44
48
  children
45
49
  }),
46
- { force: reloadTrigger !== null }
50
+ {
51
+ force: reloadTrigger !== null,
52
+ onError: (e) => {
53
+ console.error(e);
54
+ currentlyLoading.current = void 0;
55
+ setDisplayedState({
56
+ state: "failed",
57
+ error: e,
58
+ entities: void 0,
59
+ treeRootId: void 0,
60
+ customState: void 0,
61
+ isLoading: false
62
+ });
63
+ }
64
+ }
47
65
  );
48
- if (currentlyLoading.current?.entities !== entities || currentlyLoading.current?.state !== state) {
49
- return;
50
- }
51
- currentlyLoading.current = void 0;
52
66
  if (newTreeRootId) {
67
+ currentlyLoading.current = void 0;
53
68
  setDisplayedState({
54
- entities,
55
- treeRootId: newTreeRootId,
56
69
  state: "loaded",
70
+ entities: resolvedEntities,
71
+ treeRootId: newTreeRootId,
57
72
  customState: state,
58
73
  isLoading: false
59
74
  });
60
75
  }
61
76
  })();
62
- }, [extendTree, entities, children, state, reloadTrigger]);
77
+ }, [extendTree, resolvedEntities, children, state, reloadTrigger]);
63
78
  return [
64
79
  displayedState,
65
80
  {
@@ -1 +1 @@
1
- {"version":3,"file":"useEntityListSubTreeLoader.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityListSubTreeLoader.ts"],"sourcesContent":["import { createElement, ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport { SugaredQualifiedEntityList, TreeRootId } from '@contember/binding'\nimport { useExtendTree } from './useExtendTree'\nimport { EntityListSubTree } from '../coreComponents'\nimport { useEnvironment } from './useEnvironment'\n\nexport type UseEntityListSubTreeLoaderStateInitial = {\n\tstate: 'initial'\n\tentities: undefined\n\ttreeRootId: undefined\n\tcustomState: undefined\n\tisLoading: false\n}\n\nexport type UseEntityListSubTreeLoaderStateLoading = {\n\tstate: 'loading'\n\tentities: undefined\n\ttreeRootId: undefined\n\tcustomState: undefined\n\tisLoading: true\n}\n\nexport type UseEntityListSubTreeLoaderStateRefreshing<State> = {\n\tstate: 'refreshing'\n\tentities: SugaredQualifiedEntityList\n\ttreeRootId: TreeRootId | undefined\n\tcustomState: State\n\tisLoading: true\n}\n\n\nexport type UseEntityListSubTreeLoaderStateLoaded<State> = {\n\tstate: 'loaded'\n\tentities: SugaredQualifiedEntityList\n\ttreeRootId: TreeRootId | undefined\n\tcustomState: State\n\tisLoading: false\n}\n\n\nexport type UseEntityListSubTreeLoaderState<State> =\n\t| UseEntityListSubTreeLoaderStateInitial\n\t| UseEntityListSubTreeLoaderStateLoading\n\t| UseEntityListSubTreeLoaderStateRefreshing<State>\n\t| UseEntityListSubTreeLoaderStateLoaded<State>\n\nexport type UseEntityListSubTreeLoaderStateMethods = {\n\treload: () => void\n}\n\nexport const useEntityListSubTreeLoader = <State>(entities: SugaredQualifiedEntityList | undefined, children: ReactNode, state?: State): [UseEntityListSubTreeLoaderState<State>, UseEntityListSubTreeLoaderStateMethods] => {\n\tconst [displayedState, setDisplayedState] = useState<UseEntityListSubTreeLoaderState<State>>({\n\t\tstate: 'initial',\n\t\tisLoading: false,\n\t\tentities: undefined,\n\t\ttreeRootId: undefined,\n\t\tcustomState: undefined,\n\t})\n\tconst currentlyLoading = useRef<{\n\t\tentities: SugaredQualifiedEntityList\n\t\tstate?: State\n\t}>()\n\n\tconst extendTree = useExtendTree()\n\tconst [reloadTrigger, setReloadTrigger] = useState<object | null>(null)\n\n\tuseEffect(() => {\n\t\t(async () => {\n\t\t\tif (!entities) {\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\tsetDisplayedState(it => {\n\t\t\t\tif (it.state === 'initial' || it.state === 'loading') {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...it,\n\t\t\t\t\t\tisLoading: true,\n\t\t\t\t\t\tstate: 'loading',\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...it,\n\t\t\t\t\t\tisLoading: true,\n\t\t\t\t\t\tstate: 'refreshing',\n\t\t\t\t\t}\n\t\t\t\t}\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\t{ force: reloadTrigger !== null },\n\t\t\t)\n\t\t\tif (currentlyLoading.current?.entities !== entities || currentlyLoading.current?.state !== state) {\n\t\t\t\treturn\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: 'loaded',\n\t\t\t\t\tcustomState: state as State,\n\t\t\t\t\tisLoading: false,\n\t\t\t\t})\n\t\t\t}\n\t\t})()\n\t}, [extendTree, entities, children, state, reloadTrigger])\n\n\treturn [\n\t\tdisplayedState,\n\t\t{\n\t\t\treload: useCallback(() => setReloadTrigger({}), []),\n\t\t},\n\t]\n}\n"],"names":["useState","useRef","useExtendTree","useEffect","createElement","EntityListSubTree","useCallback"],"mappings":";;;;;AAkDO,MAAM,6BAA6B,CAAQ,UAAkD,UAAqB,UAAoG;AAC5N,QAAM,CAAC,gBAAgB,iBAAiB,IAAIA,eAAiD;AAAA,IAC5F,OAAO;AAAA,IACP,WAAW;AAAA,IACX,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,aAAa;AAAA,EAAA,CACb;AACD,QAAM,mBAAmBC,MAAAA;AAKzB,QAAM,aAAaC,cAAAA;AACnB,QAAM,CAAC,eAAe,gBAAgB,IAAIF,eAAwB,IAAI;AAEtEG,QAAAA,UAAU,MAAM;AACf,KAAC,YAAY;AACZ,UAAI,CAAC,UAAU;AACd;AAAA,MACD;AAEA,uBAAiB,UAAU;AAAA,QAC1B;AAAA,QACA;AAAA,MAAA;AAGD,wBAAkB,CAAM,OAAA;AACvB,YAAI,GAAG,UAAU,aAAa,GAAG,UAAU,WAAW;AAC9C,iBAAA;AAAA,YACN,GAAG;AAAA,YACH,WAAW;AAAA,YACX,OAAO;AAAA,UAAA;AAAA,QACR,OACM;AACC,iBAAA;AAAA,YACN,GAAG;AAAA,YACH,WAAW;AAAA,YACX,OAAO;AAAA,UAAA;AAAA,QAET;AAAA,MAAA,CACA;AAED,YAAM,gBAAgB,MAAM;AAAA,QAC3BC,MAAAA,cAAcC,kBAAAA,mBAAmB;AAAA,UAChC,GAAG;AAAA,UACH;AAAA,QAAA,CACA;AAAA,QACD,EAAE,OAAO,kBAAkB,KAAK;AAAA,MAAA;AAEjC,UAAI,iBAAiB,SAAS,aAAa,YAAY,iBAAiB,SAAS,UAAU,OAAO;AACjG;AAAA,MACD;AACA,uBAAiB,UAAU;AAC3B,UAAI,eAAe;AACA,0BAAA;AAAA,UACjB;AAAA,UACA,YAAY;AAAA,UACZ,OAAO;AAAA,UACP,aAAa;AAAA,UACb,WAAW;AAAA,QAAA,CACX;AAAA,MACF;AAAA,IAAA;EACE,GACD,CAAC,YAAY,UAAU,UAAU,OAAO,aAAa,CAAC;AAElD,SAAA;AAAA,IACN;AAAA,IACA;AAAA,MACC,QAAQC,MAAAA,YAAY,MAAM,iBAAiB,CAAE,CAAA,GAAG,CAAA,CAAE;AAAA,IACnD;AAAA,EAAA;AAEF;;"}
1
+ {"version":3,"file":"useEntityListSubTreeLoader.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityListSubTreeLoader.ts"],"sourcesContent":["import { createElement, ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport { SugaredQualifiedEntityList, TreeRootId } from '@contember/binding'\nimport { useExtendTree } from './useExtendTree'\nimport { EntityListSubTree } from '../coreComponents'\nimport { useEnvironment } from './useEnvironment'\nimport { useObjectMemo } from '@contember/react-utils'\n\nexport type UseEntityListSubTreeLoaderStateInitial = {\n\tstate: 'initial'\n\tentities: undefined\n\ttreeRootId: undefined\n\tcustomState: undefined\n\tisLoading: false\n}\n\nexport type UseEntityListSubTreeLoaderStateLoading = {\n\tstate: 'loading'\n\tentities: undefined\n\ttreeRootId: undefined\n\tcustomState: undefined\n\tisLoading: true\n}\n\nexport type UseEntityListSubTreeLoaderStateRefreshing<State> = {\n\tstate: 'refreshing'\n\tentities: SugaredQualifiedEntityList\n\ttreeRootId: TreeRootId | undefined\n\tcustomState: State\n\tisLoading: true\n}\n\n\nexport type UseEntityListSubTreeLoaderStateLoaded<State> = {\n\tstate: 'loaded'\n\tentities: SugaredQualifiedEntityList\n\ttreeRootId: TreeRootId | undefined\n\tcustomState: State\n\tisLoading: false\n}\n\nexport type UseEntityListSubTreeLoaderStateFailed = {\n\tstate: 'failed'\n\terror: unknown\n\tentities: undefined\n\ttreeRootId: undefined\n\tcustomState: undefined\n\tisLoading: false\n}\n\n\nexport type UseEntityListSubTreeLoaderState<State> =\n\t| UseEntityListSubTreeLoaderStateInitial\n\t| UseEntityListSubTreeLoaderStateLoading\n\t| UseEntityListSubTreeLoaderStateRefreshing<State>\n\t| UseEntityListSubTreeLoaderStateLoaded<State>\n\t| UseEntityListSubTreeLoaderStateFailed\n\nexport type UseEntityListSubTreeLoaderStateMethods = {\n\treload: () => void\n}\n\nconst emptyObject = {} as SugaredQualifiedEntityList\n\nexport const useEntityListSubTreeLoader = <State>(entities: SugaredQualifiedEntityList | undefined, children: ReactNode, state?: State): [UseEntityListSubTreeLoaderState<State>, UseEntityListSubTreeLoaderStateMethods] => {\n\tconst [displayedState, setDisplayedState] = useState<UseEntityListSubTreeLoaderState<State>>({\n\t\tstate: 'initial',\n\t\tisLoading: false,\n\t\tentities: undefined,\n\t\ttreeRootId: undefined,\n\t\tcustomState: undefined,\n\t})\n\tconst currentlyLoading = useRef<{\n\t\tentities: SugaredQualifiedEntityList\n\t\tstate?: State\n\t}>()\n\n\tconst extendTree = useExtendTree()\n\tconst [reloadTrigger, setReloadTrigger] = useState<object | null>(null)\n\tconst memoizedEntities = useObjectMemo(entities ?? emptyObject)\n\tconst resolvedEntities = entities ? memoizedEntities : undefined\n\n\tuseEffect(() => {\n\t\t(async () => {\n\t\t\tif (!resolvedEntities) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcurrentlyLoading.current = {\n\t\t\t\tentities: resolvedEntities,\n\t\t\t\tstate,\n\t\t\t}\n\n\t\t\tsetDisplayedState(it => {\n\t\t\t\tif (it.state === 'initial' || it.state === 'loading' || it.state === 'failed') {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...it,\n\t\t\t\t\t\tisLoading: true,\n\t\t\t\t\t\tstate: 'loading',\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...it,\n\t\t\t\t\t\tisLoading: true,\n\t\t\t\t\t\tstate: 'refreshing',\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tconst newTreeRootId = await extendTree(\n\t\t\t\tcreateElement(EntityListSubTree, {\n\t\t\t\t\t...resolvedEntities,\n\t\t\t\t\tchildren,\n\t\t\t\t}),\n\t\t\t\t{\n\t\t\t\t\tforce: reloadTrigger !== null,\n\t\t\t\t\tonError: e => {\n\t\t\t\t\t\tconsole.error(e)\n\n\t\t\t\t\t\tcurrentlyLoading.current = undefined\n\n\t\t\t\t\t\tsetDisplayedState({\n\t\t\t\t\t\t\tstate: 'failed',\n\t\t\t\t\t\t\terror: e,\n\t\t\t\t\t\t\tentities: undefined,\n\t\t\t\t\t\t\ttreeRootId: undefined,\n\t\t\t\t\t\t\tcustomState: undefined,\n\t\t\t\t\t\t\tisLoading: false,\n\t\t\t\t\t\t})\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tif (newTreeRootId) {\n\t\t\t\tcurrentlyLoading.current = undefined\n\t\t\t\tsetDisplayedState({\n\t\t\t\t\tstate: 'loaded',\n\t\t\t\t\tentities: resolvedEntities,\n\t\t\t\t\ttreeRootId: newTreeRootId,\n\t\t\t\t\tcustomState: state as State,\n\t\t\t\t\tisLoading: false,\n\t\t\t\t})\n\t\t\t}\n\t\t})()\n\t}, [extendTree, resolvedEntities, children, state, reloadTrigger])\n\n\treturn [\n\t\tdisplayedState,\n\t\t{\n\t\t\treload: useCallback(() => setReloadTrigger({}), []),\n\t\t},\n\t]\n}\n"],"names":["useState","useRef","useExtendTree","useObjectMemo","useEffect","createElement","EntityListSubTree","useCallback"],"mappings":";;;;;;AA6DA,MAAM,cAAc,CAAA;AAEb,MAAM,6BAA6B,CAAQ,UAAkD,UAAqB,UAAoG;AAC5N,QAAM,CAAC,gBAAgB,iBAAiB,IAAIA,eAAiD;AAAA,IAC5F,OAAO;AAAA,IACP,WAAW;AAAA,IACX,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,aAAa;AAAA,EAAA,CACb;AACD,QAAM,mBAAmBC,MAAAA;AAKzB,QAAM,aAAaC,cAAAA;AACnB,QAAM,CAAC,eAAe,gBAAgB,IAAIF,eAAwB,IAAI;AAChE,QAAA,mBAAmBG,WAAAA,cAAc,YAAY,WAAW;AACxD,QAAA,mBAAmB,WAAW,mBAAmB;AAEvDC,QAAAA,UAAU,MAAM;AACf,KAAC,YAAY;AACZ,UAAI,CAAC,kBAAkB;AACtB;AAAA,MACD;AAEA,uBAAiB,UAAU;AAAA,QAC1B,UAAU;AAAA,QACV;AAAA,MAAA;AAGD,wBAAkB,CAAM,OAAA;AACnB,YAAA,GAAG,UAAU,aAAa,GAAG,UAAU,aAAa,GAAG,UAAU,UAAU;AACvE,iBAAA;AAAA,YACN,GAAG;AAAA,YACH,WAAW;AAAA,YACX,OAAO;AAAA,UAAA;AAAA,QACR,OACM;AACC,iBAAA;AAAA,YACN,GAAG;AAAA,YACH,WAAW;AAAA,YACX,OAAO;AAAA,UAAA;AAAA,QAET;AAAA,MAAA,CACA;AAED,YAAM,gBAAgB,MAAM;AAAA,QAC3BC,MAAAA,cAAcC,kBAAAA,mBAAmB;AAAA,UAChC,GAAG;AAAA,UACH;AAAA,QAAA,CACA;AAAA,QACD;AAAA,UACC,OAAO,kBAAkB;AAAA,UACzB,SAAS,CAAK,MAAA;AACb,oBAAQ,MAAM,CAAC;AAEf,6BAAiB,UAAU;AAET,8BAAA;AAAA,cACjB,OAAO;AAAA,cACP,OAAO;AAAA,cACP,UAAU;AAAA,cACV,YAAY;AAAA,cACZ,aAAa;AAAA,cACb,WAAW;AAAA,YAAA,CACX;AAAA,UACF;AAAA,QACD;AAAA,MAAA;AAGD,UAAI,eAAe;AAClB,yBAAiB,UAAU;AACT,0BAAA;AAAA,UACjB,OAAO;AAAA,UACP,UAAU;AAAA,UACV,YAAY;AAAA,UACZ,aAAa;AAAA,UACb,WAAW;AAAA,QAAA,CACX;AAAA,MACF;AAAA,IAAA;EACE,GACD,CAAC,YAAY,kBAAkB,UAAU,OAAO,aAAa,CAAC;AAE1D,SAAA;AAAA,IACN;AAAA,IACA;AAAA,MACC,QAAQC,MAAAA,YAAY,MAAM,iBAAiB,CAAE,CAAA,GAAG,CAAA,CAAE;AAAA,IACnD;AAAA,EAAA;AAEF;;"}
@@ -1,6 +1,8 @@
1
1
  import { useState, useRef, useEffect, createElement, useCallback } from "react";
2
2
  import { useExtendTree } from "./useExtendTree.js";
3
+ import { useObjectMemo } from "@contember/react-utils";
3
4
  import { EntityListSubTree } from "../coreComponents/EntityListSubTree.js";
5
+ const emptyObject = {};
4
6
  const useEntityListSubTreeLoader = (entities, children, state) => {
5
7
  const [displayedState, setDisplayedState] = useState({
6
8
  state: "initial",
@@ -12,17 +14,19 @@ const useEntityListSubTreeLoader = (entities, children, state) => {
12
14
  const currentlyLoading = useRef();
13
15
  const extendTree = useExtendTree();
14
16
  const [reloadTrigger, setReloadTrigger] = useState(null);
17
+ const memoizedEntities = useObjectMemo(entities ?? emptyObject);
18
+ const resolvedEntities = entities ? memoizedEntities : void 0;
15
19
  useEffect(() => {
16
20
  (async () => {
17
- if (!entities) {
21
+ if (!resolvedEntities) {
18
22
  return;
19
23
  }
20
24
  currentlyLoading.current = {
21
- entities,
25
+ entities: resolvedEntities,
22
26
  state
23
27
  };
24
28
  setDisplayedState((it) => {
25
- if (it.state === "initial" || it.state === "loading") {
29
+ if (it.state === "initial" || it.state === "loading" || it.state === "failed") {
26
30
  return {
27
31
  ...it,
28
32
  isLoading: true,
@@ -38,26 +42,37 @@ const useEntityListSubTreeLoader = (entities, children, state) => {
38
42
  });
39
43
  const newTreeRootId = await extendTree(
40
44
  createElement(EntityListSubTree, {
41
- ...entities,
45
+ ...resolvedEntities,
42
46
  children
43
47
  }),
44
- { force: reloadTrigger !== null }
48
+ {
49
+ force: reloadTrigger !== null,
50
+ onError: (e) => {
51
+ console.error(e);
52
+ currentlyLoading.current = void 0;
53
+ setDisplayedState({
54
+ state: "failed",
55
+ error: e,
56
+ entities: void 0,
57
+ treeRootId: void 0,
58
+ customState: void 0,
59
+ isLoading: false
60
+ });
61
+ }
62
+ }
45
63
  );
46
- if (currentlyLoading.current?.entities !== entities || currentlyLoading.current?.state !== state) {
47
- return;
48
- }
49
- currentlyLoading.current = void 0;
50
64
  if (newTreeRootId) {
65
+ currentlyLoading.current = void 0;
51
66
  setDisplayedState({
52
- entities,
53
- treeRootId: newTreeRootId,
54
67
  state: "loaded",
68
+ entities: resolvedEntities,
69
+ treeRootId: newTreeRootId,
55
70
  customState: state,
56
71
  isLoading: false
57
72
  });
58
73
  }
59
74
  })();
60
- }, [extendTree, entities, children, state, reloadTrigger]);
75
+ }, [extendTree, resolvedEntities, children, state, reloadTrigger]);
61
76
  return [
62
77
  displayedState,
63
78
  {
@@ -1 +1 @@
1
- {"version":3,"file":"useEntityListSubTreeLoader.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityListSubTreeLoader.ts"],"sourcesContent":["import { createElement, ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport { SugaredQualifiedEntityList, TreeRootId } from '@contember/binding'\nimport { useExtendTree } from './useExtendTree'\nimport { EntityListSubTree } from '../coreComponents'\nimport { useEnvironment } from './useEnvironment'\n\nexport type UseEntityListSubTreeLoaderStateInitial = {\n\tstate: 'initial'\n\tentities: undefined\n\ttreeRootId: undefined\n\tcustomState: undefined\n\tisLoading: false\n}\n\nexport type UseEntityListSubTreeLoaderStateLoading = {\n\tstate: 'loading'\n\tentities: undefined\n\ttreeRootId: undefined\n\tcustomState: undefined\n\tisLoading: true\n}\n\nexport type UseEntityListSubTreeLoaderStateRefreshing<State> = {\n\tstate: 'refreshing'\n\tentities: SugaredQualifiedEntityList\n\ttreeRootId: TreeRootId | undefined\n\tcustomState: State\n\tisLoading: true\n}\n\n\nexport type UseEntityListSubTreeLoaderStateLoaded<State> = {\n\tstate: 'loaded'\n\tentities: SugaredQualifiedEntityList\n\ttreeRootId: TreeRootId | undefined\n\tcustomState: State\n\tisLoading: false\n}\n\n\nexport type UseEntityListSubTreeLoaderState<State> =\n\t| UseEntityListSubTreeLoaderStateInitial\n\t| UseEntityListSubTreeLoaderStateLoading\n\t| UseEntityListSubTreeLoaderStateRefreshing<State>\n\t| UseEntityListSubTreeLoaderStateLoaded<State>\n\nexport type UseEntityListSubTreeLoaderStateMethods = {\n\treload: () => void\n}\n\nexport const useEntityListSubTreeLoader = <State>(entities: SugaredQualifiedEntityList | undefined, children: ReactNode, state?: State): [UseEntityListSubTreeLoaderState<State>, UseEntityListSubTreeLoaderStateMethods] => {\n\tconst [displayedState, setDisplayedState] = useState<UseEntityListSubTreeLoaderState<State>>({\n\t\tstate: 'initial',\n\t\tisLoading: false,\n\t\tentities: undefined,\n\t\ttreeRootId: undefined,\n\t\tcustomState: undefined,\n\t})\n\tconst currentlyLoading = useRef<{\n\t\tentities: SugaredQualifiedEntityList\n\t\tstate?: State\n\t}>()\n\n\tconst extendTree = useExtendTree()\n\tconst [reloadTrigger, setReloadTrigger] = useState<object | null>(null)\n\n\tuseEffect(() => {\n\t\t(async () => {\n\t\t\tif (!entities) {\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\tsetDisplayedState(it => {\n\t\t\t\tif (it.state === 'initial' || it.state === 'loading') {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...it,\n\t\t\t\t\t\tisLoading: true,\n\t\t\t\t\t\tstate: 'loading',\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...it,\n\t\t\t\t\t\tisLoading: true,\n\t\t\t\t\t\tstate: 'refreshing',\n\t\t\t\t\t}\n\t\t\t\t}\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\t{ force: reloadTrigger !== null },\n\t\t\t)\n\t\t\tif (currentlyLoading.current?.entities !== entities || currentlyLoading.current?.state !== state) {\n\t\t\t\treturn\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: 'loaded',\n\t\t\t\t\tcustomState: state as State,\n\t\t\t\t\tisLoading: false,\n\t\t\t\t})\n\t\t\t}\n\t\t})()\n\t}, [extendTree, entities, children, state, reloadTrigger])\n\n\treturn [\n\t\tdisplayedState,\n\t\t{\n\t\t\treload: useCallback(() => setReloadTrigger({}), []),\n\t\t},\n\t]\n}\n"],"names":[],"mappings":";;;AAkDO,MAAM,6BAA6B,CAAQ,UAAkD,UAAqB,UAAoG;AAC5N,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAiD;AAAA,IAC5F,OAAO;AAAA,IACP,WAAW;AAAA,IACX,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,aAAa;AAAA,EAAA,CACb;AACD,QAAM,mBAAmB;AAKzB,QAAM,aAAa;AACnB,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAwB,IAAI;AAEtE,YAAU,MAAM;AACf,KAAC,YAAY;AACZ,UAAI,CAAC,UAAU;AACd;AAAA,MACD;AAEA,uBAAiB,UAAU;AAAA,QAC1B;AAAA,QACA;AAAA,MAAA;AAGD,wBAAkB,CAAM,OAAA;AACvB,YAAI,GAAG,UAAU,aAAa,GAAG,UAAU,WAAW;AAC9C,iBAAA;AAAA,YACN,GAAG;AAAA,YACH,WAAW;AAAA,YACX,OAAO;AAAA,UAAA;AAAA,QACR,OACM;AACC,iBAAA;AAAA,YACN,GAAG;AAAA,YACH,WAAW;AAAA,YACX,OAAO;AAAA,UAAA;AAAA,QAET;AAAA,MAAA,CACA;AAED,YAAM,gBAAgB,MAAM;AAAA,QAC3B,cAAc,mBAAmB;AAAA,UAChC,GAAG;AAAA,UACH;AAAA,QAAA,CACA;AAAA,QACD,EAAE,OAAO,kBAAkB,KAAK;AAAA,MAAA;AAEjC,UAAI,iBAAiB,SAAS,aAAa,YAAY,iBAAiB,SAAS,UAAU,OAAO;AACjG;AAAA,MACD;AACA,uBAAiB,UAAU;AAC3B,UAAI,eAAe;AACA,0BAAA;AAAA,UACjB;AAAA,UACA,YAAY;AAAA,UACZ,OAAO;AAAA,UACP,aAAa;AAAA,UACb,WAAW;AAAA,QAAA,CACX;AAAA,MACF;AAAA,IAAA;EACE,GACD,CAAC,YAAY,UAAU,UAAU,OAAO,aAAa,CAAC;AAElD,SAAA;AAAA,IACN;AAAA,IACA;AAAA,MACC,QAAQ,YAAY,MAAM,iBAAiB,CAAE,CAAA,GAAG,CAAA,CAAE;AAAA,IACnD;AAAA,EAAA;AAEF;"}
1
+ {"version":3,"file":"useEntityListSubTreeLoader.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityListSubTreeLoader.ts"],"sourcesContent":["import { createElement, ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport { SugaredQualifiedEntityList, TreeRootId } from '@contember/binding'\nimport { useExtendTree } from './useExtendTree'\nimport { EntityListSubTree } from '../coreComponents'\nimport { useEnvironment } from './useEnvironment'\nimport { useObjectMemo } from '@contember/react-utils'\n\nexport type UseEntityListSubTreeLoaderStateInitial = {\n\tstate: 'initial'\n\tentities: undefined\n\ttreeRootId: undefined\n\tcustomState: undefined\n\tisLoading: false\n}\n\nexport type UseEntityListSubTreeLoaderStateLoading = {\n\tstate: 'loading'\n\tentities: undefined\n\ttreeRootId: undefined\n\tcustomState: undefined\n\tisLoading: true\n}\n\nexport type UseEntityListSubTreeLoaderStateRefreshing<State> = {\n\tstate: 'refreshing'\n\tentities: SugaredQualifiedEntityList\n\ttreeRootId: TreeRootId | undefined\n\tcustomState: State\n\tisLoading: true\n}\n\n\nexport type UseEntityListSubTreeLoaderStateLoaded<State> = {\n\tstate: 'loaded'\n\tentities: SugaredQualifiedEntityList\n\ttreeRootId: TreeRootId | undefined\n\tcustomState: State\n\tisLoading: false\n}\n\nexport type UseEntityListSubTreeLoaderStateFailed = {\n\tstate: 'failed'\n\terror: unknown\n\tentities: undefined\n\ttreeRootId: undefined\n\tcustomState: undefined\n\tisLoading: false\n}\n\n\nexport type UseEntityListSubTreeLoaderState<State> =\n\t| UseEntityListSubTreeLoaderStateInitial\n\t| UseEntityListSubTreeLoaderStateLoading\n\t| UseEntityListSubTreeLoaderStateRefreshing<State>\n\t| UseEntityListSubTreeLoaderStateLoaded<State>\n\t| UseEntityListSubTreeLoaderStateFailed\n\nexport type UseEntityListSubTreeLoaderStateMethods = {\n\treload: () => void\n}\n\nconst emptyObject = {} as SugaredQualifiedEntityList\n\nexport const useEntityListSubTreeLoader = <State>(entities: SugaredQualifiedEntityList | undefined, children: ReactNode, state?: State): [UseEntityListSubTreeLoaderState<State>, UseEntityListSubTreeLoaderStateMethods] => {\n\tconst [displayedState, setDisplayedState] = useState<UseEntityListSubTreeLoaderState<State>>({\n\t\tstate: 'initial',\n\t\tisLoading: false,\n\t\tentities: undefined,\n\t\ttreeRootId: undefined,\n\t\tcustomState: undefined,\n\t})\n\tconst currentlyLoading = useRef<{\n\t\tentities: SugaredQualifiedEntityList\n\t\tstate?: State\n\t}>()\n\n\tconst extendTree = useExtendTree()\n\tconst [reloadTrigger, setReloadTrigger] = useState<object | null>(null)\n\tconst memoizedEntities = useObjectMemo(entities ?? emptyObject)\n\tconst resolvedEntities = entities ? memoizedEntities : undefined\n\n\tuseEffect(() => {\n\t\t(async () => {\n\t\t\tif (!resolvedEntities) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcurrentlyLoading.current = {\n\t\t\t\tentities: resolvedEntities,\n\t\t\t\tstate,\n\t\t\t}\n\n\t\t\tsetDisplayedState(it => {\n\t\t\t\tif (it.state === 'initial' || it.state === 'loading' || it.state === 'failed') {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...it,\n\t\t\t\t\t\tisLoading: true,\n\t\t\t\t\t\tstate: 'loading',\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...it,\n\t\t\t\t\t\tisLoading: true,\n\t\t\t\t\t\tstate: 'refreshing',\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tconst newTreeRootId = await extendTree(\n\t\t\t\tcreateElement(EntityListSubTree, {\n\t\t\t\t\t...resolvedEntities,\n\t\t\t\t\tchildren,\n\t\t\t\t}),\n\t\t\t\t{\n\t\t\t\t\tforce: reloadTrigger !== null,\n\t\t\t\t\tonError: e => {\n\t\t\t\t\t\tconsole.error(e)\n\n\t\t\t\t\t\tcurrentlyLoading.current = undefined\n\n\t\t\t\t\t\tsetDisplayedState({\n\t\t\t\t\t\t\tstate: 'failed',\n\t\t\t\t\t\t\terror: e,\n\t\t\t\t\t\t\tentities: undefined,\n\t\t\t\t\t\t\ttreeRootId: undefined,\n\t\t\t\t\t\t\tcustomState: undefined,\n\t\t\t\t\t\t\tisLoading: false,\n\t\t\t\t\t\t})\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tif (newTreeRootId) {\n\t\t\t\tcurrentlyLoading.current = undefined\n\t\t\t\tsetDisplayedState({\n\t\t\t\t\tstate: 'loaded',\n\t\t\t\t\tentities: resolvedEntities,\n\t\t\t\t\ttreeRootId: newTreeRootId,\n\t\t\t\t\tcustomState: state as State,\n\t\t\t\t\tisLoading: false,\n\t\t\t\t})\n\t\t\t}\n\t\t})()\n\t}, [extendTree, resolvedEntities, children, state, reloadTrigger])\n\n\treturn [\n\t\tdisplayedState,\n\t\t{\n\t\t\treload: useCallback(() => setReloadTrigger({}), []),\n\t\t},\n\t]\n}\n"],"names":[],"mappings":";;;;AA6DA,MAAM,cAAc,CAAA;AAEb,MAAM,6BAA6B,CAAQ,UAAkD,UAAqB,UAAoG;AAC5N,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAiD;AAAA,IAC5F,OAAO;AAAA,IACP,WAAW;AAAA,IACX,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,aAAa;AAAA,EAAA,CACb;AACD,QAAM,mBAAmB;AAKzB,QAAM,aAAa;AACnB,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAwB,IAAI;AAChE,QAAA,mBAAmB,cAAc,YAAY,WAAW;AACxD,QAAA,mBAAmB,WAAW,mBAAmB;AAEvD,YAAU,MAAM;AACf,KAAC,YAAY;AACZ,UAAI,CAAC,kBAAkB;AACtB;AAAA,MACD;AAEA,uBAAiB,UAAU;AAAA,QAC1B,UAAU;AAAA,QACV;AAAA,MAAA;AAGD,wBAAkB,CAAM,OAAA;AACnB,YAAA,GAAG,UAAU,aAAa,GAAG,UAAU,aAAa,GAAG,UAAU,UAAU;AACvE,iBAAA;AAAA,YACN,GAAG;AAAA,YACH,WAAW;AAAA,YACX,OAAO;AAAA,UAAA;AAAA,QACR,OACM;AACC,iBAAA;AAAA,YACN,GAAG;AAAA,YACH,WAAW;AAAA,YACX,OAAO;AAAA,UAAA;AAAA,QAET;AAAA,MAAA,CACA;AAED,YAAM,gBAAgB,MAAM;AAAA,QAC3B,cAAc,mBAAmB;AAAA,UAChC,GAAG;AAAA,UACH;AAAA,QAAA,CACA;AAAA,QACD;AAAA,UACC,OAAO,kBAAkB;AAAA,UACzB,SAAS,CAAK,MAAA;AACb,oBAAQ,MAAM,CAAC;AAEf,6BAAiB,UAAU;AAET,8BAAA;AAAA,cACjB,OAAO;AAAA,cACP,OAAO;AAAA,cACP,UAAU;AAAA,cACV,YAAY;AAAA,cACZ,aAAa;AAAA,cACb,WAAW;AAAA,YAAA,CACX;AAAA,UACF;AAAA,QACD;AAAA,MAAA;AAGD,UAAI,eAAe;AAClB,yBAAiB,UAAU;AACT,0BAAA;AAAA,UACjB,OAAO;AAAA,UACP,UAAU;AAAA,UACV,YAAY;AAAA,UACZ,aAAa;AAAA,UACb,WAAW;AAAA,QAAA,CACX;AAAA,MACF;AAAA,IAAA;EACE,GACD,CAAC,YAAY,kBAAkB,UAAU,OAAO,aAAa,CAAC;AAE1D,SAAA;AAAA,IACN;AAAA,IACA;AAAA,MACC,QAAQ,YAAY,MAAM,iBAAiB,CAAE,CAAA,GAAG,CAAA,CAAE;AAAA,IACnD;AAAA,EAAA;AAEF;"}
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const React = require("react");
4
4
  const useExtendTree = require("./useExtendTree.cjs");
5
+ const reactUtils = require("@contember/react-utils");
5
6
  const EntitySubTree = require("../coreComponents/EntitySubTree.cjs");
7
+ const emptyObject = {};
6
8
  const useEntitySubTreeLoader = (entity, children, state) => {
7
9
  const [displayedState, setDisplayedState] = React.useState({
8
10
  state: "initial",
@@ -14,17 +16,19 @@ const useEntitySubTreeLoader = (entity, children, state) => {
14
16
  const currentlyLoading = React.useRef();
15
17
  const extendTree = useExtendTree.useExtendTree();
16
18
  const [reloadTrigger, setReloadTrigger] = React.useState(null);
19
+ const memoizedEntity = reactUtils.useObjectMemo(entity ?? emptyObject);
20
+ const resolvedEntity = entity ? memoizedEntity : void 0;
17
21
  React.useEffect(() => {
18
22
  (async () => {
19
- if (!entity) {
23
+ if (!resolvedEntity) {
20
24
  return;
21
25
  }
22
26
  currentlyLoading.current = {
23
- entity,
27
+ entity: resolvedEntity,
24
28
  state
25
29
  };
26
30
  setDisplayedState((it) => {
27
- if (it.state === "initial" || it.state === "loading") {
31
+ if (it.state === "initial" || it.state === "loading" || it.state === "failed") {
28
32
  return {
29
33
  ...it,
30
34
  isLoading: true,
@@ -40,29 +44,43 @@ const useEntitySubTreeLoader = (entity, children, state) => {
40
44
  });
41
45
  const newTreeRootId = await extendTree(
42
46
  React.createElement(EntitySubTree.EntitySubTree, {
43
- ...entity,
47
+ ...resolvedEntity,
44
48
  children
45
49
  }),
46
- { force: reloadTrigger !== null }
50
+ {
51
+ force: reloadTrigger !== null,
52
+ onError: (e) => {
53
+ console.error(e);
54
+ currentlyLoading.current = void 0;
55
+ setDisplayedState({
56
+ state: "failed",
57
+ error: e,
58
+ entity: void 0,
59
+ treeRootId: void 0,
60
+ customState: void 0,
61
+ isLoading: false
62
+ });
63
+ }
64
+ }
47
65
  );
48
- if (currentlyLoading.current?.entity !== entity || currentlyLoading.current?.state !== state) {
49
- return;
50
- }
51
- currentlyLoading.current = void 0;
52
66
  if (newTreeRootId) {
67
+ currentlyLoading.current = void 0;
53
68
  setDisplayedState({
54
- entity,
55
- treeRootId: newTreeRootId,
56
69
  state: "loaded",
70
+ entity: resolvedEntity,
71
+ treeRootId: newTreeRootId,
57
72
  customState: state,
58
73
  isLoading: false
59
74
  });
60
75
  }
61
76
  })();
62
- }, [extendTree, entity, children, state, reloadTrigger]);
63
- return [displayedState, {
64
- reload: React.useCallback(() => setReloadTrigger({}), [])
65
- }];
77
+ }, [extendTree, resolvedEntity, children, state, reloadTrigger]);
78
+ return [
79
+ displayedState,
80
+ {
81
+ reload: React.useCallback(() => setReloadTrigger({}), [])
82
+ }
83
+ ];
66
84
  };
67
85
  exports.useEntitySubTreeLoader = useEntitySubTreeLoader;
68
86
  //# sourceMappingURL=useEntitySubTreeLoader.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEntitySubTreeLoader.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntitySubTreeLoader.ts"],"sourcesContent":["import { createElement, ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport { SugaredQualifiedSingleEntity, TreeRootId } from '@contember/binding'\nimport { useExtendTree } from './useExtendTree'\nimport { EntitySubTree } from '../coreComponents'\n\nexport type UseEntitySubTreeLoaderStateInitial = {\n\tstate: 'initial'\n\tentity: undefined\n\ttreeRootId: undefined\n\tcustomState: undefined\n\tisLoading: false\n}\n\nexport type UseEntitySubTreeLoaderStateLoading = {\n\tstate: 'loading'\n\tentity: undefined\n\ttreeRootId: undefined\n\tcustomState: undefined\n\tisLoading: true\n}\n\nexport type UseEntitySubTreeLoaderStateRefreshing<State> = {\n\tstate: 'refreshing'\n\tentity: SugaredQualifiedSingleEntity\n\ttreeRootId: TreeRootId | undefined\n\tcustomState: State\n\tisLoading: true\n}\n\n\nexport type UseEntitySubTreeLoaderStateLoaded<State> = {\n\tstate: 'loaded'\n\tentity: SugaredQualifiedSingleEntity\n\ttreeRootId: TreeRootId | undefined\n\tcustomState: State\n\tisLoading: false\n}\n\n\nexport type UseEntitySubTreeLoaderState<State> =\n\t| UseEntitySubTreeLoaderStateInitial\n\t| UseEntitySubTreeLoaderStateLoading\n\t| UseEntitySubTreeLoaderStateRefreshing<State>\n\t| UseEntitySubTreeLoaderStateLoaded<State>\n\nexport type EntityListSubTreeLoaderState = UseEntitySubTreeLoaderState<any>['state']\n\nexport type UseEntitySubTreeLoaderStateMethods = {\n\treload: () => void\n}\n\nexport const useEntitySubTreeLoader = <State>(entity: SugaredQualifiedSingleEntity | undefined, children: ReactNode, state?: State): [UseEntitySubTreeLoaderState<State>, UseEntitySubTreeLoaderStateMethods] => {\n\tconst [displayedState, setDisplayedState] = useState<UseEntitySubTreeLoaderState<State>>({\n\t\tstate: 'initial',\n\t\tisLoading: false,\n\t\tentity: undefined,\n\t\ttreeRootId: undefined,\n\t\tcustomState: undefined,\n\t})\n\tconst currentlyLoading = useRef<{\n\t\tentity: SugaredQualifiedSingleEntity\n\t\tstate?: State\n\t}>()\n\n\tconst extendTree = useExtendTree()\n\tconst [reloadTrigger, setReloadTrigger] = useState<object | null>(null)\n\n\tuseEffect(() => {\n\t\t(async () => {\n\t\t\tif (!entity) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcurrentlyLoading.current = {\n\t\t\t\tentity,\n\t\t\t\tstate,\n\t\t\t}\n\n\t\t\tsetDisplayedState(it => {\n\t\t\t\tif (it.state === 'initial' || it.state === 'loading') {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...it,\n\t\t\t\t\t\tisLoading: true,\n\t\t\t\t\t\tstate: 'loading',\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...it,\n\t\t\t\t\t\tisLoading: true,\n\t\t\t\t\t\tstate: 'refreshing',\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tconst newTreeRootId = await extendTree(\n\t\t\t\tcreateElement(EntitySubTree, {\n\t\t\t\t\t...entity,\n\t\t\t\t\tchildren,\n\t\t\t\t}),\n\t\t\t\t{ force: reloadTrigger !== null },\n\t\t\t)\n\t\t\tif (currentlyLoading.current?.entity !== entity || currentlyLoading.current?.state !== state) {\n\t\t\t\treturn\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\tentity: entity,\n\t\t\t\t\ttreeRootId: newTreeRootId,\n\t\t\t\t\tstate: 'loaded',\n\t\t\t\t\tcustomState: state as State,\n\t\t\t\t\tisLoading: false,\n\t\t\t\t})\n\t\t\t}\n\t\t})()\n\t}, [extendTree, entity, children, state, reloadTrigger])\n\n\treturn [displayedState, {\n\t\treload: useCallback(() => setReloadTrigger({}), []),\n\t}]\n}\n"],"names":["useState","useRef","useExtendTree","useEffect","createElement","EntitySubTree","useCallback"],"mappings":";;;;;AAmDO,MAAM,yBAAyB,CAAQ,QAAkD,UAAqB,UAA4F;AAChN,QAAM,CAAC,gBAAgB,iBAAiB,IAAIA,eAA6C;AAAA,IACxF,OAAO;AAAA,IACP,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,aAAa;AAAA,EAAA,CACb;AACD,QAAM,mBAAmBC,MAAAA;AAKzB,QAAM,aAAaC,cAAAA;AACnB,QAAM,CAAC,eAAe,gBAAgB,IAAIF,eAAwB,IAAI;AAEtEG,QAAAA,UAAU,MAAM;AACf,KAAC,YAAY;AACZ,UAAI,CAAC,QAAQ;AACZ;AAAA,MACD;AAEA,uBAAiB,UAAU;AAAA,QAC1B;AAAA,QACA;AAAA,MAAA;AAGD,wBAAkB,CAAM,OAAA;AACvB,YAAI,GAAG,UAAU,aAAa,GAAG,UAAU,WAAW;AAC9C,iBAAA;AAAA,YACN,GAAG;AAAA,YACH,WAAW;AAAA,YACX,OAAO;AAAA,UAAA;AAAA,QACR,OACM;AACC,iBAAA;AAAA,YACN,GAAG;AAAA,YACH,WAAW;AAAA,YACX,OAAO;AAAA,UAAA;AAAA,QAET;AAAA,MAAA,CACA;AAED,YAAM,gBAAgB,MAAM;AAAA,QAC3BC,MAAAA,cAAcC,cAAAA,eAAe;AAAA,UAC5B,GAAG;AAAA,UACH;AAAA,QAAA,CACA;AAAA,QACD,EAAE,OAAO,kBAAkB,KAAK;AAAA,MAAA;AAEjC,UAAI,iBAAiB,SAAS,WAAW,UAAU,iBAAiB,SAAS,UAAU,OAAO;AAC7F;AAAA,MACD;AACA,uBAAiB,UAAU;AAC3B,UAAI,eAAe;AACA,0BAAA;AAAA,UACjB;AAAA,UACA,YAAY;AAAA,UACZ,OAAO;AAAA,UACP,aAAa;AAAA,UACb,WAAW;AAAA,QAAA,CACX;AAAA,MACF;AAAA,IAAA;EACE,GACD,CAAC,YAAY,QAAQ,UAAU,OAAO,aAAa,CAAC;AAEvD,SAAO,CAAC,gBAAgB;AAAA,IACvB,QAAQC,MAAAA,YAAY,MAAM,iBAAiB,CAAE,CAAA,GAAG,CAAA,CAAE;AAAA,EAAA,CAClD;AACF;;"}
1
+ {"version":3,"file":"useEntitySubTreeLoader.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntitySubTreeLoader.ts"],"sourcesContent":["import { createElement, ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport { SugaredQualifiedSingleEntity, TreeRootId } from '@contember/binding'\nimport { useExtendTree } from './useExtendTree'\nimport { EntitySubTree } from '../coreComponents'\nimport { useObjectMemo } from '@contember/react-utils'\n\nexport type UseEntitySubTreeLoaderStateInitial = {\n\tstate: 'initial'\n\tentity: undefined\n\ttreeRootId: undefined\n\tcustomState: undefined\n\tisLoading: false\n}\n\nexport type UseEntitySubTreeLoaderStateLoading = {\n\tstate: 'loading'\n\tentity: undefined\n\ttreeRootId: undefined\n\tcustomState: undefined\n\tisLoading: true\n}\n\nexport type UseEntitySubTreeLoaderStateRefreshing<State> = {\n\tstate: 'refreshing'\n\tentity: SugaredQualifiedSingleEntity\n\ttreeRootId: TreeRootId | undefined\n\tcustomState: State\n\tisLoading: true\n}\n\n\nexport type UseEntitySubTreeLoaderStateLoaded<State> = {\n\tstate: 'loaded'\n\tentity: SugaredQualifiedSingleEntity\n\ttreeRootId: TreeRootId | undefined\n\tcustomState: State\n\tisLoading: false\n}\n\nexport type UseEntitySubTreeLoaderStateFailed = {\n\tstate: 'failed'\n\terror: unknown\n\tentity: undefined\n\ttreeRootId: undefined\n\tcustomState: undefined\n\tisLoading: false\n}\n\n\nexport type UseEntitySubTreeLoaderState<State> =\n\t| UseEntitySubTreeLoaderStateInitial\n\t| UseEntitySubTreeLoaderStateLoading\n\t| UseEntitySubTreeLoaderStateRefreshing<State>\n\t| UseEntitySubTreeLoaderStateLoaded<State>\n\t| UseEntitySubTreeLoaderStateFailed\n\nexport type EntityListSubTreeLoaderState = UseEntitySubTreeLoaderState<any>['state']\n\nexport type UseEntitySubTreeLoaderStateMethods = {\n\treload: () => void\n}\n\nconst emptyObject = {} as SugaredQualifiedSingleEntity\n\nexport const useEntitySubTreeLoader = <State>(entity: SugaredQualifiedSingleEntity | undefined, children: ReactNode, state?: State): [UseEntitySubTreeLoaderState<State>, UseEntitySubTreeLoaderStateMethods] => {\n\tconst [displayedState, setDisplayedState] = useState<UseEntitySubTreeLoaderState<State>>({\n\t\tstate: 'initial',\n\t\tisLoading: false,\n\t\tentity: undefined,\n\t\ttreeRootId: undefined,\n\t\tcustomState: undefined,\n\t})\n\tconst currentlyLoading = useRef<{\n\t\tentity: SugaredQualifiedSingleEntity\n\t\tstate?: State\n\t}>()\n\n\tconst extendTree = useExtendTree()\n\tconst [reloadTrigger, setReloadTrigger] = useState<object | null>(null)\n\tconst memoizedEntity = useObjectMemo(entity ?? emptyObject)\n\tconst resolvedEntity = entity ? memoizedEntity : undefined\n\n\tuseEffect(() => {\n\t\t(async () => {\n\t\t\tif (!resolvedEntity) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcurrentlyLoading.current = {\n\t\t\t\tentity: resolvedEntity,\n\t\t\t\tstate,\n\t\t\t}\n\n\t\t\tsetDisplayedState(it => {\n\t\t\t\tif (it.state === 'initial' || it.state === 'loading' || it.state === 'failed') {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...it,\n\t\t\t\t\t\tisLoading: true,\n\t\t\t\t\t\tstate: 'loading',\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...it,\n\t\t\t\t\t\tisLoading: true,\n\t\t\t\t\t\tstate: 'refreshing',\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tconst newTreeRootId = await extendTree(\n\t\t\t\tcreateElement(EntitySubTree, {\n\t\t\t\t\t...resolvedEntity,\n\t\t\t\t\tchildren,\n\t\t\t\t}),\n\t\t\t\t{\n\t\t\t\t\tforce: reloadTrigger !== null,\n\t\t\t\t\tonError: e => {\n\t\t\t\t\t\tconsole.error(e)\n\n\t\t\t\t\t\tcurrentlyLoading.current = undefined\n\n\t\t\t\t\t\tsetDisplayedState({\n\t\t\t\t\t\t\tstate: 'failed',\n\t\t\t\t\t\t\terror: e,\n\t\t\t\t\t\t\tentity: undefined,\n\t\t\t\t\t\t\ttreeRootId: undefined,\n\t\t\t\t\t\t\tcustomState: undefined,\n\t\t\t\t\t\t\tisLoading: false,\n\t\t\t\t\t\t})\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t)\n\n\n\t\t\tif (newTreeRootId) {\n\t\t\t\tcurrentlyLoading.current = undefined\n\t\t\t\tsetDisplayedState({\n\t\t\t\t\tstate: 'loaded',\n\t\t\t\t\tentity: resolvedEntity,\n\t\t\t\t\ttreeRootId: newTreeRootId,\n\t\t\t\t\tcustomState: state as State,\n\t\t\t\t\tisLoading: false,\n\t\t\t\t})\n\t\t\t}\n\t\t})()\n\t}, [extendTree, resolvedEntity, children, state, reloadTrigger])\n\n\treturn [\n\t\tdisplayedState,\n\t\t{\n\t\t\treload: useCallback(() => setReloadTrigger({}), []),\n\t\t},\n\t]\n}\n"],"names":["useState","useRef","useExtendTree","useObjectMemo","useEffect","createElement","EntitySubTree","useCallback"],"mappings":";;;;;;AA8DA,MAAM,cAAc,CAAA;AAEb,MAAM,yBAAyB,CAAQ,QAAkD,UAAqB,UAA4F;AAChN,QAAM,CAAC,gBAAgB,iBAAiB,IAAIA,eAA6C;AAAA,IACxF,OAAO;AAAA,IACP,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,aAAa;AAAA,EAAA,CACb;AACD,QAAM,mBAAmBC,MAAAA;AAKzB,QAAM,aAAaC,cAAAA;AACnB,QAAM,CAAC,eAAe,gBAAgB,IAAIF,eAAwB,IAAI;AAChE,QAAA,iBAAiBG,WAAAA,cAAc,UAAU,WAAW;AACpD,QAAA,iBAAiB,SAAS,iBAAiB;AAEjDC,QAAAA,UAAU,MAAM;AACf,KAAC,YAAY;AACZ,UAAI,CAAC,gBAAgB;AACpB;AAAA,MACD;AAEA,uBAAiB,UAAU;AAAA,QAC1B,QAAQ;AAAA,QACR;AAAA,MAAA;AAGD,wBAAkB,CAAM,OAAA;AACnB,YAAA,GAAG,UAAU,aAAa,GAAG,UAAU,aAAa,GAAG,UAAU,UAAU;AACvE,iBAAA;AAAA,YACN,GAAG;AAAA,YACH,WAAW;AAAA,YACX,OAAO;AAAA,UAAA;AAAA,QACR,OACM;AACC,iBAAA;AAAA,YACN,GAAG;AAAA,YACH,WAAW;AAAA,YACX,OAAO;AAAA,UAAA;AAAA,QAET;AAAA,MAAA,CACA;AAED,YAAM,gBAAgB,MAAM;AAAA,QAC3BC,MAAAA,cAAcC,cAAAA,eAAe;AAAA,UAC5B,GAAG;AAAA,UACH;AAAA,QAAA,CACA;AAAA,QACD;AAAA,UACC,OAAO,kBAAkB;AAAA,UACzB,SAAS,CAAK,MAAA;AACb,oBAAQ,MAAM,CAAC;AAEf,6BAAiB,UAAU;AAET,8BAAA;AAAA,cACjB,OAAO;AAAA,cACP,OAAO;AAAA,cACP,QAAQ;AAAA,cACR,YAAY;AAAA,cACZ,aAAa;AAAA,cACb,WAAW;AAAA,YAAA,CACX;AAAA,UACF;AAAA,QACD;AAAA,MAAA;AAID,UAAI,eAAe;AAClB,yBAAiB,UAAU;AACT,0BAAA;AAAA,UACjB,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,YAAY;AAAA,UACZ,aAAa;AAAA,UACb,WAAW;AAAA,QAAA,CACX;AAAA,MACF;AAAA,IAAA;EACE,GACD,CAAC,YAAY,gBAAgB,UAAU,OAAO,aAAa,CAAC;AAExD,SAAA;AAAA,IACN;AAAA,IACA;AAAA,MACC,QAAQC,MAAAA,YAAY,MAAM,iBAAiB,CAAE,CAAA,GAAG,CAAA,CAAE;AAAA,IACnD;AAAA,EAAA;AAEF;;"}