@contember/binding 1.2.0-alpha.0 → 1.2.0-alpha.1

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 (101) hide show
  1. package/dist/development/accessorTree/AccessorTree.js +2 -2
  2. package/dist/development/accessorTree/AccessorTree.js.map +1 -1
  3. package/dist/development/coreComponents/DataBindingProvider.js.map +1 -1
  4. package/dist/development/coreComponents/Entity.js.map +1 -1
  5. package/dist/development/coreComponents/EntityList.js.map +1 -1
  6. package/dist/development/coreComponents/EntityListSubTree.js.map +1 -1
  7. package/dist/development/coreComponents/EntitySubTree.js.map +1 -1
  8. package/dist/development/coreComponents/Field.js.map +1 -1
  9. package/dist/development/coreComponents/HasMany.js.map +1 -1
  10. package/dist/development/coreComponents/HasOne.js.map +1 -1
  11. package/dist/development/coreComponents/ParentEntity.js.map +1 -1
  12. package/dist/development/helperComponents/DeferredSubTrees.js.map +1 -1
  13. package/dist/development/helperComponents/EntityView.js.map +1 -1
  14. package/dist/development/helperComponents/FieldView.js.map +1 -1
  15. package/dist/development/helperComponents/If.js.map +1 -1
  16. package/dist/development/helperComponents/StaticRender.js.map +1 -1
  17. package/dist/development/helperComponents/SugaredField.js.map +1 -1
  18. package/dist/development/helperComponents/helpers/evaluateCondition.js.map +1 -1
  19. package/dist/development/treeParameters/LeafField.js.map +1 -1
  20. package/dist/production/accessorTree/AccessorTree.js +2 -2
  21. package/dist/production/accessorTree/AccessorTree.js.map +1 -1
  22. package/dist/production/coreComponents/DataBindingProvider.js.map +1 -1
  23. package/dist/production/coreComponents/Entity.js.map +1 -1
  24. package/dist/production/coreComponents/EntityList.js.map +1 -1
  25. package/dist/production/coreComponents/EntityListSubTree.js.map +1 -1
  26. package/dist/production/coreComponents/EntitySubTree.js.map +1 -1
  27. package/dist/production/coreComponents/Field.js.map +1 -1
  28. package/dist/production/coreComponents/HasMany.js.map +1 -1
  29. package/dist/production/coreComponents/HasOne.js.map +1 -1
  30. package/dist/production/coreComponents/ParentEntity.js.map +1 -1
  31. package/dist/production/helperComponents/DeferredSubTrees.js.map +1 -1
  32. package/dist/production/helperComponents/EntityView.js.map +1 -1
  33. package/dist/production/helperComponents/FieldView.js.map +1 -1
  34. package/dist/production/helperComponents/If.js.map +1 -1
  35. package/dist/production/helperComponents/StaticRender.js.map +1 -1
  36. package/dist/production/helperComponents/SugaredField.js.map +1 -1
  37. package/dist/production/helperComponents/helpers/evaluateCondition.js.map +1 -1
  38. package/dist/production/treeParameters/LeafField.js.map +1 -1
  39. package/dist/types/accessorTree/AccessorTree.d.ts +7 -4
  40. package/dist/types/accessorTree/AccessorTree.d.ts.map +1 -1
  41. package/dist/types/coreComponents/DataBindingProvider.d.ts +10 -0
  42. package/dist/types/coreComponents/DataBindingProvider.d.ts.map +1 -1
  43. package/dist/types/coreComponents/Entity.d.ts +3 -0
  44. package/dist/types/coreComponents/Entity.d.ts.map +1 -1
  45. package/dist/types/coreComponents/EntityList.d.ts +3 -0
  46. package/dist/types/coreComponents/EntityList.d.ts.map +1 -1
  47. package/dist/types/coreComponents/EntityListSubTree.d.ts +10 -0
  48. package/dist/types/coreComponents/EntityListSubTree.d.ts.map +1 -1
  49. package/dist/types/coreComponents/EntitySubTree.d.ts +10 -0
  50. package/dist/types/coreComponents/EntitySubTree.d.ts.map +1 -1
  51. package/dist/types/coreComponents/Field.d.ts +3 -0
  52. package/dist/types/coreComponents/Field.d.ts.map +1 -1
  53. package/dist/types/coreComponents/HasMany.d.ts +3 -0
  54. package/dist/types/coreComponents/HasMany.d.ts.map +1 -1
  55. package/dist/types/coreComponents/HasOne.d.ts +3 -0
  56. package/dist/types/coreComponents/HasOne.d.ts.map +1 -1
  57. package/dist/types/coreComponents/ParentEntity.d.ts +3 -0
  58. package/dist/types/coreComponents/ParentEntity.d.ts.map +1 -1
  59. package/dist/types/helperComponents/DeferredSubTrees.d.ts +3 -0
  60. package/dist/types/helperComponents/DeferredSubTrees.d.ts.map +1 -1
  61. package/dist/types/helperComponents/EntityView.d.ts +3 -0
  62. package/dist/types/helperComponents/EntityView.d.ts.map +1 -1
  63. package/dist/types/helperComponents/FieldView.d.ts +13 -0
  64. package/dist/types/helperComponents/FieldView.d.ts.map +1 -1
  65. package/dist/types/helperComponents/If.d.ts +3 -0
  66. package/dist/types/helperComponents/If.d.ts.map +1 -1
  67. package/dist/types/helperComponents/StaticRender.d.ts +3 -0
  68. package/dist/types/helperComponents/StaticRender.d.ts.map +1 -1
  69. package/dist/types/helperComponents/SugaredField.d.ts +3 -0
  70. package/dist/types/helperComponents/SugaredField.d.ts.map +1 -1
  71. package/dist/types/treeParameters/FieldEventListeners.d.ts +5 -2
  72. package/dist/types/treeParameters/FieldEventListeners.d.ts.map +1 -1
  73. package/dist/types/treeParameters/LeafField.d.ts +2 -2
  74. package/dist/types/treeParameters/LeafField.d.ts.map +1 -1
  75. package/dist/types/treeParameters/QualifiedFieldList.d.ts +7 -8
  76. package/dist/types/treeParameters/QualifiedFieldList.d.ts.map +1 -1
  77. package/dist/types/treeParameters/RelativeSingleField.d.ts +8 -8
  78. package/dist/types/treeParameters/RelativeSingleField.d.ts.map +1 -1
  79. package/dist/types/tsconfig.tsbuildinfo +1 -1
  80. package/package.json +5 -5
  81. package/src/accessorTree/AccessorTree.tsx +4 -1
  82. package/src/coreComponents/DataBindingProvider.tsx +10 -0
  83. package/src/coreComponents/Entity.tsx +3 -0
  84. package/src/coreComponents/EntityList.tsx +3 -0
  85. package/src/coreComponents/EntityListSubTree.tsx +10 -0
  86. package/src/coreComponents/EntitySubTree.tsx +10 -0
  87. package/src/coreComponents/Field.tsx +3 -0
  88. package/src/coreComponents/HasMany.tsx +3 -0
  89. package/src/coreComponents/HasOne.tsx +3 -0
  90. package/src/coreComponents/ParentEntity.tsx +3 -0
  91. package/src/helperComponents/DeferredSubTrees.tsx +3 -0
  92. package/src/helperComponents/EntityView.tsx +3 -0
  93. package/src/helperComponents/FieldView.tsx +13 -0
  94. package/src/helperComponents/If.tsx +3 -0
  95. package/src/helperComponents/StaticRender.tsx +3 -0
  96. package/src/helperComponents/SugaredField.tsx +3 -0
  97. package/src/helperComponents/helpers/evaluateCondition.ts +1 -1
  98. package/src/treeParameters/FieldEventListeners.ts +15 -5
  99. package/src/treeParameters/LeafField.ts +6 -4
  100. package/src/treeParameters/QualifiedFieldList.ts +24 -17
  101. package/src/treeParameters/RelativeSingleField.ts +19 -12
@@ -4,14 +4,14 @@ import { DirtinessContext } from "./DirtinessContext.js";
4
4
  import { MutationStateContext } from "./MutationStateContext.js";
5
5
  import { EnvironmentContext } from "../accessorPropagation/EnvironmentContext.js";
6
6
  import { BindingOperationsProvider } from "../accessorPropagation/BindingOperationsProvider.js";
7
- function AccessorTree({ state, children }) {
7
+ const AccessorTree = ({ state, children }) => {
8
8
  const stateData = state.name === "initialized" ? state.data : {
9
9
  hasUnpersistedChanges: false,
10
10
  isMutating: false,
11
11
  bindingOperations: void 0
12
12
  };
13
13
  return /* @__PURE__ */ jsx(EnvironmentContext.Provider, { value: state.environment, children: /* @__PURE__ */ jsx(AccessorTreeStateContext.Provider, { value: state, children: /* @__PURE__ */ jsx(DirtinessContext.Provider, { value: stateData.hasUnpersistedChanges, children: /* @__PURE__ */ jsx(MutationStateContext.Provider, { value: stateData.isMutating, children: /* @__PURE__ */ jsx(BindingOperationsProvider, { bindingOperations: stateData.bindingOperations, children }) }) }) }) });
14
- }
14
+ };
15
15
  AccessorTree.displayName = "AccessorTree";
16
16
  export {
17
17
  AccessorTree
@@ -1 +1 @@
1
- {"version":3,"file":"AccessorTree.js","sources":["../../../src/accessorTree/AccessorTree.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { BindingOperationsProvider, EnvironmentContext } from '../accessorPropagation'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport { AccessorTreeStateContext } from './AccessorTreeStateContext'\nimport { DirtinessContext } from './DirtinessContext'\nimport { MutationStateContext } from './MutationStateContext'\n\nexport interface AccessorTreeProps {\n\tstate: AccessorTreeState\n\tchildren: ReactNode\n}\n\nexport function AccessorTree({ state, children }: AccessorTreeProps) {\n\tconst stateData = state.name === 'initialized' ? state.data : {\n\t\thasUnpersistedChanges: false,\n\t\tisMutating: false,\n\t\tbindingOperations: undefined,\n\t}\n\treturn (\n\t\t<EnvironmentContext.Provider value={state.environment}>\n\t\t\t<AccessorTreeStateContext.Provider value={state}>\n\t\t\t\t<DirtinessContext.Provider value={stateData.hasUnpersistedChanges}>\n\t\t\t\t\t<MutationStateContext.Provider value={stateData.isMutating}>\n\t\t\t\t\t\t<BindingOperationsProvider bindingOperations={stateData.bindingOperations}>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</BindingOperationsProvider>\n\t\t\t\t\t</MutationStateContext.Provider>\n\t\t\t\t</DirtinessContext.Provider>\n\t\t\t</AccessorTreeStateContext.Provider>\n\t\t</EnvironmentContext.Provider>\n\t)\n}\n\nAccessorTree.displayName = 'AccessorTree'\n"],"names":[],"mappings":";;;;;;AAYO,SAAS,aAAa,EAAE,OAAO,YAA+B;AACpE,QAAM,YAAY,MAAM,SAAS,gBAAgB,MAAM,OAAO;AAAA,IAC7D,uBAAuB;AAAA,IACvB,YAAY;AAAA,IACZ,mBAAmB;AAAA,EAAA;AAEpB,6BACE,mBAAmB,UAAnB,EAA4B,OAAO,MAAM,aACzC,UAAA,oBAAC,yBAAyB,UAAzB,EAAkC,OAAO,OACzC,UAAC,oBAAA,iBAAiB,UAAjB,EAA0B,OAAO,UAAU,uBAC3C,8BAAC,qBAAqB,UAArB,EAA8B,OAAO,UAAU,YAC/C,UAAA,oBAAC,2BAA0B,EAAA,mBAAmB,UAAU,mBACtD,SAAA,CACF,EACD,CAAA,EACD,CAAA,GACD,EACD,CAAA;AAEF;AAEA,aAAa,cAAc;"}
1
+ {"version":3,"file":"AccessorTree.js","sources":["../../../src/accessorTree/AccessorTree.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { BindingOperationsProvider, EnvironmentContext } from '../accessorPropagation'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport { AccessorTreeStateContext } from './AccessorTreeStateContext'\nimport { DirtinessContext } from './DirtinessContext'\nimport { MutationStateContext } from './MutationStateContext'\n\nexport interface AccessorTreeProps {\n\tstate: AccessorTreeState\n\tchildren: ReactNode\n}\n\n/**\n * @group Data binding\n */\nexport const AccessorTree = ({ state, children }: AccessorTreeProps) => {\n\tconst stateData = state.name === 'initialized' ? state.data : {\n\t\thasUnpersistedChanges: false,\n\t\tisMutating: false,\n\t\tbindingOperations: undefined,\n\t}\n\treturn (\n\t\t<EnvironmentContext.Provider value={state.environment}>\n\t\t\t<AccessorTreeStateContext.Provider value={state}>\n\t\t\t\t<DirtinessContext.Provider value={stateData.hasUnpersistedChanges}>\n\t\t\t\t\t<MutationStateContext.Provider value={stateData.isMutating}>\n\t\t\t\t\t\t<BindingOperationsProvider bindingOperations={stateData.bindingOperations}>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</BindingOperationsProvider>\n\t\t\t\t\t</MutationStateContext.Provider>\n\t\t\t\t</DirtinessContext.Provider>\n\t\t\t</AccessorTreeStateContext.Provider>\n\t\t</EnvironmentContext.Provider>\n\t)\n}\n\nAccessorTree.displayName = 'AccessorTree'\n"],"names":[],"mappings":";;;;;;AAeO,MAAM,eAAe,CAAC,EAAE,OAAO,eAAkC;AACvE,QAAM,YAAY,MAAM,SAAS,gBAAgB,MAAM,OAAO;AAAA,IAC7D,uBAAuB;AAAA,IACvB,YAAY;AAAA,IACZ,mBAAmB;AAAA,EAAA;AAEpB,6BACE,mBAAmB,UAAnB,EAA4B,OAAO,MAAM,aACzC,UAAA,oBAAC,yBAAyB,UAAzB,EAAkC,OAAO,OACzC,UAAC,oBAAA,iBAAiB,UAAjB,EAA0B,OAAO,UAAU,uBAC3C,8BAAC,qBAAqB,UAArB,EAA8B,OAAO,UAAU,YAC/C,UAAA,oBAAC,2BAA0B,EAAA,mBAAmB,UAAU,mBACtD,SAAA,CACF,EACD,CAAA,EACD,CAAA,GACD,EACD,CAAA;AAEF;AAEA,aAAa,cAAc;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DataBindingProvider.js","sources":["../../../src/coreComponents/DataBindingProvider.tsx"],"sourcesContent":["import { ComponentType, createElement, memo, ReactElement, ReactNode } from 'react'\nimport { AccessorTree, AccessorTreeState, AccessorTreeStateOptions, useDataBinding } from '../accessorTree'\n\nexport type DataBindingProviderBaseProps =\n\t& AccessorTreeStateOptions\n\nexport interface DataBindingStateComponentProps {\n\taccessorTreeState: AccessorTreeState\n\tchildren?: ReactNode\n}\n\nexport type DataBindingProviderProps<StateProps> = DataBindingProviderBaseProps &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tstateComponent: ComponentType<StateProps & DataBindingStateComponentProps>\n\t\t\t\tstateProps?: StateProps\n\t\t }\n\t)\n\nexport const DataBindingProvider = memo(function DataBindingProvider<StateProps extends DataBindingStateComponentProps>(\n\tprops: DataBindingProviderProps<StateProps>,\n) {\n\tconst accessorTreeState = useDataBinding(props)\n\n\tconst children =\n\t\t'stateComponent' in props && props.stateComponent\n\t\t\t? createElement(\n\t\t\t\t\tprops.stateComponent,\n\t\t\t\t\t{\n\t\t\t\t\t\t...props.stateProps!,\n\t\t\t\t\t\taccessorTreeState: accessorTreeState,\n\t\t\t\t\t},\n\t\t\t\t\tprops.children,\n\t\t\t )\n\t\t\t: props.children\n\treturn <AccessorTree state={accessorTreeState}>{children}</AccessorTree>\n}) as <StateProps>(props: DataBindingProviderProps<StateProps>) => ReactElement\n"],"names":["DataBindingProvider"],"mappings":";;;;AAoBO,MAAM,sBAAsB,KAAK,SAASA,qBAChD,OACC;AACK,QAAA,oBAAoB,eAAe,KAAK;AAE9C,QAAM,WACL,oBAAoB,SAAS,MAAM,iBAChC;AAAA,IACA,MAAM;AAAA,IACN;AAAA,MACC,GAAG,MAAM;AAAA,MACT;AAAA,IACD;AAAA,IACA,MAAM;AAAA,EAAA,IAEN,MAAM;AACV,SAAQ,oBAAA,cAAA,EAAa,OAAO,mBAAoB,SAAS,CAAA;AAC1D,CAAC;"}
1
+ {"version":3,"file":"DataBindingProvider.js","sources":["../../../src/coreComponents/DataBindingProvider.tsx"],"sourcesContent":["import { ComponentType, createElement, memo, ReactElement, ReactNode } from 'react'\nimport { AccessorTree, AccessorTreeState, AccessorTreeStateOptions, useDataBinding } from '../accessorTree'\n\nexport type DataBindingProviderBaseProps =\n\t& AccessorTreeStateOptions\n\nexport interface DataBindingStateComponentProps {\n\taccessorTreeState: AccessorTreeState\n\tchildren?: ReactNode\n}\n\nexport type DataBindingProviderProps<StateProps> = DataBindingProviderBaseProps &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tstateComponent: ComponentType<StateProps & DataBindingStateComponentProps>\n\t\t\t\tstateProps?: StateProps\n\t\t }\n\t)\n\n/**\n * The `DataBindingProvider` is a root component for all other data binding related components.\n *\n * @example\n * ```\n * <DataBindingProvider stateComponent={FeedbackRenderer} />\n * ```\n *\n * @group Data binding\n */\nexport const DataBindingProvider = memo(function DataBindingProvider<StateProps extends DataBindingStateComponentProps>(\n\tprops: DataBindingProviderProps<StateProps>,\n) {\n\tconst accessorTreeState = useDataBinding(props)\n\n\tconst children =\n\t\t'stateComponent' in props && props.stateComponent\n\t\t\t? createElement(\n\t\t\t\t\tprops.stateComponent,\n\t\t\t\t\t{\n\t\t\t\t\t\t...props.stateProps!,\n\t\t\t\t\t\taccessorTreeState: accessorTreeState,\n\t\t\t\t\t},\n\t\t\t\t\tprops.children,\n\t\t\t )\n\t\t\t: props.children\n\treturn <AccessorTree state={accessorTreeState}>{children}</AccessorTree>\n}) as <StateProps>(props: DataBindingProviderProps<StateProps>) => ReactElement\n"],"names":["DataBindingProvider"],"mappings":";;;;AA8BO,MAAM,sBAAsB,KAAK,SAASA,qBAChD,OACC;AACK,QAAA,oBAAoB,eAAe,KAAK;AAE9C,QAAM,WACL,oBAAoB,SAAS,MAAM,iBAChC;AAAA,IACA,MAAM;AAAA,IACN;AAAA,MACC,GAAG,MAAM;AAAA,MACT;AAAA,IACD;AAAA,IACA,MAAM;AAAA,EAAA,IAEN,MAAM;AACV,SAAQ,oBAAA,cAAA,EAAa,OAAO,mBAAoB,SAAS,CAAA;AAC1D,CAAC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Entity.js","sources":["../../../src/coreComponents/Entity.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { AccessorProvider } from '../accessorPropagation'\nimport type { EntityAccessor } from '../accessors'\nimport { Component } from './Component'\n\nexport interface EntityBaseProps {\n\taccessor: EntityAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityProps = EntityBaseProps\n\nexport const Entity = Component(\n\t({ children, accessor }: EntityProps) => {\n\treturn (\n\t\t// HACK: the ?. is actually important, despite the typings.\n\t\t<AccessorProvider accessor={accessor} key={accessor?.key}>\n\t\t\t{children}\n\t\t</AccessorProvider>\n\t)\n\t},\n\t'Entity',\n)\n"],"names":[],"mappings":";;;AAYO,MAAM,SAAS;AAAA,EACrB,CAAC,EAAE,UAAU,eAA4B;AACzC;AAAA;AAAA,MAEE,oBAAA,kBAAA,EAAiB,UAChB,SAAA,GADyC,UAAU,GAErD;AAAA;AAAA,EAED;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"Entity.js","sources":["../../../src/coreComponents/Entity.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { AccessorProvider } from '../accessorPropagation'\nimport type { EntityAccessor } from '../accessors'\nimport { Component } from './Component'\n\nexport interface EntityBaseProps {\n\taccessor: EntityAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityProps = EntityBaseProps\n\n/**\n * @group Data binding\n */\nexport const Entity = Component(\n\t({ children, accessor }: EntityProps) => {\n\treturn (\n\t\t// HACK: the ?. is actually important, despite the typings.\n\t\t<AccessorProvider accessor={accessor} key={accessor?.key}>\n\t\t\t{children}\n\t\t</AccessorProvider>\n\t)\n\t},\n\t'Entity',\n)\n"],"names":[],"mappings":";;;AAeO,MAAM,SAAS;AAAA,EACrB,CAAC,EAAE,UAAU,eAA4B;AACzC;AAAA;AAAA,MAEE,oBAAA,kBAAA,EAAiB,UAChB,SAAA,GADyC,UAAU,GAErD;AAAA;AAAA,EAED;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityList.js","sources":["../../../src/coreComponents/EntityList.tsx"],"sourcesContent":["import { ComponentType, createElement, ReactElement, ReactNode } from 'react'\nimport type { EntityListAccessor } from '../accessors'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\n\nexport interface EntityListBaseProps {\n\taccessor: EntityListAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityListProps<ListProps> = EntityListBaseProps &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\nexport const EntityList = Component(\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: props.accessor,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{Array.from(props.accessor, entity => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Entity key={entity.key} accessor={entity}>\n\t\t\t\t\t\t\t{props.children}\n\t\t\t\t\t\t</Entity>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</>\n\t\t)\n\t},\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: undefined as any,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn <>{props.children}</>\n\t},\n\t'EntityList',\n) as <ListProps>(props: EntityListProps<ListProps>) => ReactElement\n"],"names":[],"mappings":";;;;AAmBO,MAAM,aAAa;AAAA,EACzB,CAAuB,UAAsC;AACxD,QAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,aAAA,cAAc,MAAM,eAAe;AAAA,QACzC,GAAG,MAAM;AAAA,QACT,UAAU,MAAM;AAAA,QAChB,UAAU,MAAM;AAAA,MAAA,CAChB;AAAA,IACF;AACA,WAEG,oBAAA,UAAA,EAAA,UAAA,MAAM,KAAK,MAAM,UAAU,CAAU,WAAA;AACrC,iCACE,QAAwB,EAAA,UAAU,QACjC,UAAM,MAAA,SAAA,GADK,OAAO,GAEpB;AAAA,IAED,CAAA,EACF,CAAA;AAAA,EAEF;AAAA,EACA,CAAuB,UAAsC;AACxD,QAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,aAAA,cAAc,MAAM,eAAe;AAAA,QACzC,GAAG,MAAM;AAAA,QACT,UAAU;AAAA,QACV,UAAU,MAAM;AAAA,MAAA,CAChB;AAAA,IACF;AACO,WAAA,oBAAA,UAAA,EAAG,gBAAM,SAAS,CAAA;AAAA,EAC1B;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"EntityList.js","sources":["../../../src/coreComponents/EntityList.tsx"],"sourcesContent":["import { ComponentType, createElement, ReactElement, ReactNode } from 'react'\nimport type { EntityListAccessor } from '../accessors'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\n\nexport interface EntityListBaseProps {\n\taccessor: EntityListAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityListProps<ListProps> = EntityListBaseProps &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\n/**\n * @group Data binding\n */\nexport const EntityList = Component(\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: props.accessor,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{Array.from(props.accessor, entity => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Entity key={entity.key} accessor={entity}>\n\t\t\t\t\t\t\t{props.children}\n\t\t\t\t\t\t</Entity>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</>\n\t\t)\n\t},\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: undefined as any,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn <>{props.children}</>\n\t},\n\t'EntityList',\n) as <ListProps>(props: EntityListProps<ListProps>) => ReactElement\n"],"names":[],"mappings":";;;;AAsBO,MAAM,aAAa;AAAA,EACzB,CAAuB,UAAsC;AACxD,QAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,aAAA,cAAc,MAAM,eAAe;AAAA,QACzC,GAAG,MAAM;AAAA,QACT,UAAU,MAAM;AAAA,QAChB,UAAU,MAAM;AAAA,MAAA,CAChB;AAAA,IACF;AACA,WAEG,oBAAA,UAAA,EAAA,UAAA,MAAM,KAAK,MAAM,UAAU,CAAU,WAAA;AACrC,iCACE,QAAwB,EAAA,UAAU,QACjC,UAAM,MAAA,SAAA,GADK,OAAO,GAEpB;AAAA,IAED,CAAA,EACF,CAAA;AAAA,EAEF;AAAA,EACA,CAAuB,UAAsC;AACxD,QAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,aAAA,cAAc,MAAM,eAAe;AAAA,QACzC,GAAG,MAAM;AAAA,QACT,UAAU;AAAA,QACV,UAAU,MAAM;AAAA,MAAA,CAChB;AAAA,IACF;AACO,WAAA,oBAAA,UAAA,EAAG,gBAAM,SAAS,CAAA;AAAA,EAC1B;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityListSubTree.js","sources":["../../../src/coreComponents/EntityListSubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ComponentType, ReactElement, ReactNode, useCallback } from 'react'\nimport {\n\tuseAccessorUpdateSubscription,\n\tuseEntityListSubTreeParameters,\n\tuseGetEntityListSubTree,\n} from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList, TreeRootId } from '../treeParameters'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface EntityListSubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntityListSubTreeProps<ListProps, EntityProps> = {\n\ttreeRootId?: TreeRootId\n\tchildren?: ReactNode\n} & EntityListSubTreeAdditionalProps &\n\t(SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList) &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\nexport const EntityListSubTree = Component(\n\t<ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntityListSubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntityListSubTree()\n\t\tconst parameters = useEntityListSubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ?\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne\n\t\t// ) :\n\t\t// \tprops.children\n\t\t// )\n\t\treturn <EntityList {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntityListSubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntityListSubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<EntityList {...props} accessor={0 as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</EntityList>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntityListSubtree(environment, props)\n\t\t},\n\t},\n\t'EntityListSubTree',\n) as <ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;;;;;AAiCO,MAAM,oBAAoB;AAAA,EAChC,CAAyB,UAA0D;AACxD,8BAAA,MAAM,YAAY,6CAA6C;AAEzF,UAAM,aAAa;AACb,UAAA,aAAa,+BAA+B,KAAK;AACvD,UAAM,cAAc;AAAA,MACnB,MAAM,WAAW,YAAY,MAAM,UAAU;AAAA,MAC7C,CAAC,YAAY,YAAY,MAAM,UAAU;AAAA,IAAA;AAEpC,UAAA,WAAW,8BAA8B,WAAW;AAQ1D,WAAQ,oBAAA,YAAA,EAAY,GAAG,OAAO,SAAoB,CAAA;AAAA,EACnD;AAAA,EACA;AAAA,IACC,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACjD,UAAA,gBAAgB,SAAS,MAAM,YAAY;AAC9C,eAAO,cAAc,2CAA2C,OAAO,QAAQ,WAAW;AAAA,MAC3F;AACA,aAAO,cAAc,8BAA8B,OAAO,QAAQ,WAAW;AAAA,IAC9E;AAAA,IACA,cAAc,CACb,UAAA,qBAAC,cAAY,GAAG,OAAO,UAAU,GAChC,UAAA;AAAA,MAAC,oBAAA,OAAA,EAAM,OAAO,iBAAkB,CAAA;AAAA,MAC/B,MAAM;AAAA,IAAA,GACR;AAAA,IAED,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,sCAAsC,aAAa,KAAK;AAAA,IAC3F;AAAA,EACD;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"EntityListSubTree.js","sources":["../../../src/coreComponents/EntityListSubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ComponentType, ReactElement, ReactNode, useCallback } from 'react'\nimport {\n\tuseAccessorUpdateSubscription,\n\tuseEntityListSubTreeParameters,\n\tuseGetEntityListSubTree,\n} from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList, TreeRootId } from '../treeParameters'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface EntityListSubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntityListSubTreeProps<ListProps, EntityProps> = {\n\ttreeRootId?: TreeRootId\n\tchildren?: ReactNode\n} & EntityListSubTreeAdditionalProps &\n\t(SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList) &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\n/**\n * Creates a subtree with list of entities in current data binding context.\n *\n * @example\n * ```\n * <EntityListSubTree entities=\"Post\" />\n * ```\n *\n * @group Data binding\n */\nexport const EntityListSubTree = Component(\n\t<ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntityListSubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntityListSubTree()\n\t\tconst parameters = useEntityListSubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ?\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne\n\t\t// ) :\n\t\t// \tprops.children\n\t\t// )\n\t\treturn <EntityList {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntityListSubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntityListSubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<EntityList {...props} accessor={0 as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</EntityList>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntityListSubtree(environment, props)\n\t\t},\n\t},\n\t'EntityListSubTree',\n) as <ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;;;;;AA2CO,MAAM,oBAAoB;AAAA,EAChC,CAAyB,UAA0D;AACxD,8BAAA,MAAM,YAAY,6CAA6C;AAEzF,UAAM,aAAa;AACb,UAAA,aAAa,+BAA+B,KAAK;AACvD,UAAM,cAAc;AAAA,MACnB,MAAM,WAAW,YAAY,MAAM,UAAU;AAAA,MAC7C,CAAC,YAAY,YAAY,MAAM,UAAU;AAAA,IAAA;AAEpC,UAAA,WAAW,8BAA8B,WAAW;AAQ1D,WAAQ,oBAAA,YAAA,EAAY,GAAG,OAAO,SAAoB,CAAA;AAAA,EACnD;AAAA,EACA;AAAA,IACC,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACjD,UAAA,gBAAgB,SAAS,MAAM,YAAY;AAC9C,eAAO,cAAc,2CAA2C,OAAO,QAAQ,WAAW;AAAA,MAC3F;AACA,aAAO,cAAc,8BAA8B,OAAO,QAAQ,WAAW;AAAA,IAC9E;AAAA,IACA,cAAc,CACb,UAAA,qBAAC,cAAY,GAAG,OAAO,UAAU,GAChC,UAAA;AAAA,MAAC,oBAAA,OAAA,EAAM,OAAO,iBAAkB,CAAA;AAAA,MAC/B,MAAM;AAAA,IAAA,GACR;AAAA,IAED,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,sCAAsC,aAAa,KAAK;AAAA,IAC3F;AAAA,EACD;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntitySubTree.js","sources":["../../../src/coreComponents/EntitySubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode, useCallback } from 'react'\nimport { useAccessorUpdateSubscription, useEntitySubTreeParameters, useGetEntitySubTree } from '../accessorPropagation'\nimport { SetOrderFieldOnCreate, SetOrderFieldOnCreateOwnProps } from '../accessorSorting'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type {\n\tSugaredQualifiedSingleEntity,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tTreeRootId,\n} from '../treeParameters'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface EntitySubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntitySubTreeAdditionalCreationProps = {} | SetOrderFieldOnCreateOwnProps\n\nexport type EntitySubTreeProps<EntityProps> =\n\t& {\n\t\ttreeRootId?: TreeRootId\n\t\tchildren?: ReactNode\n\t}\n\t& EntitySubTreeAdditionalProps\n\t& (\n\t\t| SugaredQualifiedSingleEntity\n\t\t| (SugaredUnconstrainedQualifiedSingleEntity & EntitySubTreeAdditionalCreationProps)\n\t)\n\nexport const EntitySubTree = Component(\n\t<EntityProps extends {}>(props: EntitySubTreeProps<EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntitySubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntitySubTree()\n\t\tconst parameters = useEntitySubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top-level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ? (\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne>\n\t\t// ) : (\n\t\t// \tprops.children\n\t\t// )}\n\t\treturn <Entity {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntitySubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntitySubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<>\n\t\t\t\t<Entity {...props} accessor={0 as any}>\n\t\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t\t{props.children}\n\t\t\t\t</Entity>\n\t\t\t\t{props.isCreating && 'orderField' in props && (\n\t\t\t\t\t<SetOrderFieldOnCreate\n\t\t\t\t\t\torderField={props.orderField}\n\t\t\t\t\t\tnewOrderFieldValue={props.newOrderFieldValue}\n\t\t\t\t\t\tentity={props.entity}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntitySubtree(environment, props)\n\t\t},\n\t},\n\t'EntitySubTree',\n) as <EntityProps>(pros: EntitySubTreeProps<EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;;;;;;AAkCO,MAAM,gBAAgB;AAAA,EAC5B,CAAyB,UAA2C;AACzC,8BAAA,MAAM,YAAY,yCAAyC;AAErF,UAAM,aAAa;AACb,UAAA,aAAa,2BAA2B,KAAK;AACnD,UAAM,cAAc;AAAA,MACnB,MAAM,WAAW,YAAY,MAAM,UAAU;AAAA,MAC7C,CAAC,YAAY,YAAY,MAAM,UAAU;AAAA,IAAA;AAEpC,UAAA,WAAW,8BAA8B,WAAW;AAQ1D,WAAQ,oBAAA,QAAA,EAAQ,GAAG,OAAO,SAAoB,CAAA;AAAA,EAC/C;AAAA,EACA;AAAA,IACC,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACjD,UAAA,gBAAgB,SAAS,MAAM,YAAY;AAC9C,eAAO,cAAc,uCAAuC,OAAO,QAAQ,WAAW;AAAA,MACvF;AACA,aAAO,cAAc,0BAA0B,OAAO,QAAQ,WAAW;AAAA,IAC1E;AAAA,IACA,cAAc,WAEZ,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAA,qBAAC,QAAQ,EAAA,GAAG,OAAO,UAAU,GAC5B,UAAA;AAAA,QAAC,oBAAA,OAAA,EAAM,OAAO,iBAAkB,CAAA;AAAA,QAC/B,MAAM;AAAA,MAAA,GACR;AAAA,MACC,MAAM,cAAc,gBAAgB,SACpC;AAAA,QAAC;AAAA,QAAA;AAAA,UACA,YAAY,MAAM;AAAA,UAClB,oBAAoB,MAAM;AAAA,UAC1B,QAAQ,MAAM;AAAA,QAAA;AAAA,MACf;AAAA,IAAA,GAEF;AAAA,IAED,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,kCAAkC,aAAa,KAAK;AAAA,IACvF;AAAA,EACD;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"EntitySubTree.js","sources":["../../../src/coreComponents/EntitySubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode, useCallback } from 'react'\nimport { useAccessorUpdateSubscription, useEntitySubTreeParameters, useGetEntitySubTree } from '../accessorPropagation'\nimport { SetOrderFieldOnCreate, SetOrderFieldOnCreateOwnProps } from '../accessorSorting'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type {\n\tSugaredQualifiedSingleEntity,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tTreeRootId,\n} from '../treeParameters'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface EntitySubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntitySubTreeAdditionalCreationProps = {} | SetOrderFieldOnCreateOwnProps\n\nexport type EntitySubTreeProps<EntityProps> =\n\t& {\n\t\ttreeRootId?: TreeRootId\n\t\tchildren?: ReactNode\n\t}\n\t& EntitySubTreeAdditionalProps\n\t& (\n\t\t| SugaredQualifiedSingleEntity\n\t\t| (SugaredUnconstrainedQualifiedSingleEntity & EntitySubTreeAdditionalCreationProps)\n\t)\n\n/**\n * Creates a single entity subtree in current data binding context.\n *\n * @example\n * ```\n * <EntitySubTree entity=\"Post(id = $id)\" />\n * ```\n *\n * @group Data binding\n */\nexport const EntitySubTree = Component(\n\t<EntityProps extends {}>(props: EntitySubTreeProps<EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntitySubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntitySubTree()\n\t\tconst parameters = useEntitySubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top-level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ? (\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne>\n\t\t// ) : (\n\t\t// \tprops.children\n\t\t// )}\n\t\treturn <Entity {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntitySubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntitySubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<>\n\t\t\t\t<Entity {...props} accessor={0 as any}>\n\t\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t\t{props.children}\n\t\t\t\t</Entity>\n\t\t\t\t{props.isCreating && 'orderField' in props && (\n\t\t\t\t\t<SetOrderFieldOnCreate\n\t\t\t\t\t\torderField={props.orderField}\n\t\t\t\t\t\tnewOrderFieldValue={props.newOrderFieldValue}\n\t\t\t\t\t\tentity={props.entity}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntitySubtree(environment, props)\n\t\t},\n\t},\n\t'EntitySubTree',\n) as <EntityProps>(pros: EntitySubTreeProps<EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;;;;;;AA4CO,MAAM,gBAAgB;AAAA,EAC5B,CAAyB,UAA2C;AACzC,8BAAA,MAAM,YAAY,yCAAyC;AAErF,UAAM,aAAa;AACb,UAAA,aAAa,2BAA2B,KAAK;AACnD,UAAM,cAAc;AAAA,MACnB,MAAM,WAAW,YAAY,MAAM,UAAU;AAAA,MAC7C,CAAC,YAAY,YAAY,MAAM,UAAU;AAAA,IAAA;AAEpC,UAAA,WAAW,8BAA8B,WAAW;AAQ1D,WAAQ,oBAAA,QAAA,EAAQ,GAAG,OAAO,SAAoB,CAAA;AAAA,EAC/C;AAAA,EACA;AAAA,IACC,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACjD,UAAA,gBAAgB,SAAS,MAAM,YAAY;AAC9C,eAAO,cAAc,uCAAuC,OAAO,QAAQ,WAAW;AAAA,MACvF;AACA,aAAO,cAAc,0BAA0B,OAAO,QAAQ,WAAW;AAAA,IAC1E;AAAA,IACA,cAAc,WAEZ,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAA,qBAAC,QAAQ,EAAA,GAAG,OAAO,UAAU,GAC5B,UAAA;AAAA,QAAC,oBAAA,OAAA,EAAM,OAAO,iBAAkB,CAAA;AAAA,QAC/B,MAAM;AAAA,MAAA,GACR;AAAA,MACC,MAAM,cAAc,gBAAgB,SACpC;AAAA,QAAC;AAAA,QAAA;AAAA,UACA,YAAY,MAAM;AAAA,UAClB,oBAAoB,MAAM;AAAA,UAC1B,QAAQ,MAAM;AAAA,QAAA;AAAA,MACf;AAAA,IAAA,GAEF;AAAA,IAED,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,kCAAkC,aAAa,KAAK;AAAA,IACvF;AAAA,EACD;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","sources":["../../../src/coreComponents/Field.tsx"],"sourcesContent":["import { GraphQlBuilder } from '@contember/client'\nimport type { ReactElement, ReactNode } from 'react'\nimport { useField } from '../accessorPropagation'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { FieldValue, SugaredRelativeSingleField } from '../treeParameters'\nimport { Component } from './Component'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface FieldBasicProps extends SugaredRelativeSingleField {}\n\nexport interface FieldRuntimeProps<Persisted extends FieldValue = FieldValue> {\n\tformat?: (value: Persisted | null) => ReactNode\n}\n\nexport interface FieldProps<Persisted extends FieldValue = FieldValue>\n\textends FieldBasicProps,\n\t\tFieldRuntimeProps<Persisted> {}\n\nexport const Field = Component(\n\t<Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => {\n\t\tconst field = useField<Persisted>(props)\n\n\t\tif (props.format !== undefined) {\n\t\t\treturn <>{props.format(field.value)}</>\n\t\t}\n\n\t\tif (\n\t\t\tfield.value instanceof GraphQlBuilder.GraphQlLiteral ||\n\t\t\tfield.value === null ||\n\t\t\ttypeof field.value === 'boolean'\n\t\t) {\n\t\t\treturn null\n\t\t}\n\t\treturn <>{field.value}</>\n\t},\n\t{\n\t\tgenerateLeafMarker: (props, environment) => MarkerFactory.createFieldMarker(props, environment),\n\t\tgenerateEnvironment: (props, environment) => {\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForField(environment, props)\n\t\t},\n\t},\n\t'Field',\n) as <Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => ReactElement\n"],"names":[],"mappings":";;;;;;AAkBO,MAAM,QAAQ;AAAA,EACpB,CAA4C,UAAiC;AACtE,UAAA,QAAQ,SAAoB,KAAK;AAEnC,QAAA,MAAM,WAAW,QAAW;AAC/B,aAAU,oBAAA,UAAA,EAAA,UAAA,MAAM,OAAO,MAAM,KAAK,EAAE,CAAA;AAAA,IACrC;AAGC,QAAA,MAAM,iBAAiB,eAAe,kBACtC,MAAM,UAAU,QAChB,OAAO,MAAM,UAAU,WACtB;AACM,aAAA;AAAA,IACR;AACO,WAAA,oBAAA,UAAA,EAAG,gBAAM,MAAM,CAAA;AAAA,EACvB;AAAA,EACA;AAAA,IACC,oBAAoB,CAAC,OAAO,gBAAgB,cAAc,kBAAkB,OAAO,WAAW;AAAA,IAC9F,qBAAqB,CAAC,OAAO,gBAAgB;AACrC,aAAA,2BAA2B,0BAA0B,aAAa,KAAK;AAAA,IAC/E;AAAA,EACD;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"Field.js","sources":["../../../src/coreComponents/Field.tsx"],"sourcesContent":["import { GraphQlBuilder } from '@contember/client'\nimport type { ReactElement, ReactNode } from 'react'\nimport { useField } from '../accessorPropagation'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { FieldValue, SugaredRelativeSingleField } from '../treeParameters'\nimport { Component } from './Component'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface FieldBasicProps extends SugaredRelativeSingleField {}\n\nexport interface FieldRuntimeProps<Persisted extends FieldValue = FieldValue> {\n\tformat?: (value: Persisted | null) => ReactNode\n}\n\nexport interface FieldProps<Persisted extends FieldValue = FieldValue>\n\textends FieldBasicProps,\n\t\tFieldRuntimeProps<Persisted> {}\n\n/**\n * @group Data binding\n */\nexport const Field = Component(\n\t<Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => {\n\t\tconst field = useField<Persisted>(props)\n\n\t\tif (props.format !== undefined) {\n\t\t\treturn <>{props.format(field.value)}</>\n\t\t}\n\n\t\tif (\n\t\t\tfield.value instanceof GraphQlBuilder.GraphQlLiteral ||\n\t\t\tfield.value === null ||\n\t\t\ttypeof field.value === 'boolean'\n\t\t) {\n\t\t\treturn null\n\t\t}\n\t\treturn <>{field.value}</>\n\t},\n\t{\n\t\tgenerateLeafMarker: (props, environment) => MarkerFactory.createFieldMarker(props, environment),\n\t\tgenerateEnvironment: (props, environment) => {\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForField(environment, props)\n\t\t},\n\t},\n\t'Field',\n) as <Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => ReactElement\n"],"names":[],"mappings":";;;;;;AAqBO,MAAM,QAAQ;AAAA,EACpB,CAA4C,UAAiC;AACtE,UAAA,QAAQ,SAAoB,KAAK;AAEnC,QAAA,MAAM,WAAW,QAAW;AAC/B,aAAU,oBAAA,UAAA,EAAA,UAAA,MAAM,OAAO,MAAM,KAAK,EAAE,CAAA;AAAA,IACrC;AAGC,QAAA,MAAM,iBAAiB,eAAe,kBACtC,MAAM,UAAU,QAChB,OAAO,MAAM,UAAU,WACtB;AACM,aAAA;AAAA,IACR;AACO,WAAA,oBAAA,UAAA,EAAG,gBAAM,MAAM,CAAA;AAAA,EACvB;AAAA,EACA;AAAA,IACC,oBAAoB,CAAC,OAAO,gBAAgB,cAAc,kBAAkB,OAAO,WAAW;AAAA,IAC9F,qBAAqB,CAAC,OAAO,gBAAgB;AACrC,aAAA,2BAA2B,0BAA0B,aAAa,KAAK;AAAA,IAC/E;AAAA,EACD;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"HasMany.js","sources":["../../../src/coreComponents/HasMany.tsx"],"sourcesContent":["import type { ComponentType, ReactElement, ReactNode } from 'react'\nimport { useEntityList } from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredRelativeEntityList } from '../treeParameters'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport type HasManyProps<ListProps = never, EntityProps = never> = SugaredRelativeEntityList & {\n\tchildren?: ReactNode\n\tvariables?: Environment.ValuesMapWithFactory\n} & (\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\nexport const HasMany = Component(\n\t<ListProps, EntityProps>(props: HasManyProps<ListProps, EntityProps>) => {\n\t\tconst entityList = useEntityList(props)\n\n\t\treturn <EntityList {...props} accessor={entityList} />\n\t},\n\t{\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntityList(environment, props)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<EntityList {...props} accessor={undefined as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</EntityList>\n\t\t),\n\t\tgenerateBranchMarker: (props, fields, environment) =>\n\t\t\tMarkerFactory.createRelativeEntityListFields(props, environment, fields),\n\t},\n\t'HasMany',\n) as <ListProps, EntityProps>(props: HasManyProps<ListProps, EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;AAsBO,MAAM,UAAU;AAAA,EACtB,CAAyB,UAAgD;AAClE,UAAA,aAAa,cAAc,KAAK;AAEtC,WAAQ,oBAAA,YAAA,EAAY,GAAG,OAAO,UAAU,WAAY,CAAA;AAAA,EACrD;AAAA,EACA;AAAA,IACC,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,+BAA+B,aAAa,KAAK;AAAA,IACpF;AAAA,IACA,cAAc,CACb,UAAA,qBAAC,cAAY,GAAG,OAAO,UAAU,QAChC,UAAA;AAAA,MAAC,oBAAA,OAAA,EAAM,OAAO,iBAAkB,CAAA;AAAA,MAC/B,MAAM;AAAA,IAAA,GACR;AAAA,IAED,sBAAsB,CAAC,OAAO,QAAQ,gBACrC,cAAc,+BAA+B,OAAO,aAAa,MAAM;AAAA,EACzE;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"HasMany.js","sources":["../../../src/coreComponents/HasMany.tsx"],"sourcesContent":["import type { ComponentType, ReactElement, ReactNode } from 'react'\nimport { useEntityList } from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredRelativeEntityList } from '../treeParameters'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport type HasManyProps<ListProps = never, EntityProps = never> = SugaredRelativeEntityList & {\n\tchildren?: ReactNode\n\tvariables?: Environment.ValuesMapWithFactory\n} & (\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\n/**\n * @group Data binding\n */\nexport const HasMany = Component(\n\t<ListProps, EntityProps>(props: HasManyProps<ListProps, EntityProps>) => {\n\t\tconst entityList = useEntityList(props)\n\n\t\treturn <EntityList {...props} accessor={entityList} />\n\t},\n\t{\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntityList(environment, props)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<EntityList {...props} accessor={undefined as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</EntityList>\n\t\t),\n\t\tgenerateBranchMarker: (props, fields, environment) =>\n\t\t\tMarkerFactory.createRelativeEntityListFields(props, environment, fields),\n\t},\n\t'HasMany',\n) as <ListProps, EntityProps>(props: HasManyProps<ListProps, EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;AAyBO,MAAM,UAAU;AAAA,EACtB,CAAyB,UAAgD;AAClE,UAAA,aAAa,cAAc,KAAK;AAEtC,WAAQ,oBAAA,YAAA,EAAY,GAAG,OAAO,UAAU,WAAY,CAAA;AAAA,EACrD;AAAA,EACA;AAAA,IACC,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,+BAA+B,aAAa,KAAK;AAAA,IACpF;AAAA,IACA,cAAc,CACb,UAAA,qBAAC,cAAY,GAAG,OAAO,UAAU,QAChC,UAAA;AAAA,MAAC,oBAAA,OAAA,EAAM,OAAO,iBAAkB,CAAA;AAAA,MAC/B,MAAM;AAAA,IAAA,GACR;AAAA,IAED,sBAAsB,CAAC,OAAO,QAAQ,gBACrC,cAAc,+BAA+B,OAAO,aAAa,MAAM;AAAA,EACzE;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"HasOne.js","sources":["../../../src/coreComponents/HasOne.tsx"],"sourcesContent":["import type { ReactElement, ReactNode } from 'react'\nimport { useEntity } from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredRelativeSingleEntity } from '../treeParameters'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport type HasOneProps<EntityProps = never> = SugaredRelativeSingleEntity & {\n\tchildren?: ReactNode\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport const HasOne = Component(\n\t<EntityProps extends {}>(props: HasOneProps<EntityProps>) => {\n\t\tconst entity = useEntity(props)\n\n\t\treturn <Entity {...props} accessor={entity} />\n\t},\n\t{\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntity(environment, props)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<Entity {...props} accessor={undefined as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</Entity>\n\t\t),\n\t\tgenerateBranchMarker: (props, fields, environment) =>\n\t\t\tMarkerFactory.createRelativeSingleEntityFields(props, environment, fields),\n\t},\n\t'HasOne',\n) as <EntityProps extends {}>(props: HasOneProps<EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;AAgBO,MAAM,SAAS;AAAA,EACrB,CAAyB,UAAoC;AACtD,UAAA,SAAS,UAAU,KAAK;AAE9B,WAAQ,oBAAA,QAAA,EAAQ,GAAG,OAAO,UAAU,OAAQ,CAAA;AAAA,EAC7C;AAAA,EACA;AAAA,IACC,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,2BAA2B,aAAa,KAAK;AAAA,IAChF;AAAA,IACA,cAAc,CACb,UAAA,qBAAC,UAAQ,GAAG,OAAO,UAAU,QAC5B,UAAA;AAAA,MAAC,oBAAA,OAAA,EAAM,OAAO,iBAAkB,CAAA;AAAA,MAC/B,MAAM;AAAA,IAAA,GACR;AAAA,IAED,sBAAsB,CAAC,OAAO,QAAQ,gBACrC,cAAc,iCAAiC,OAAO,aAAa,MAAM;AAAA,EAC3E;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"HasOne.js","sources":["../../../src/coreComponents/HasOne.tsx"],"sourcesContent":["import type { ReactElement, ReactNode } from 'react'\nimport { useEntity } from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredRelativeSingleEntity } from '../treeParameters'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport type HasOneProps<EntityProps = never> = SugaredRelativeSingleEntity & {\n\tchildren?: ReactNode\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\n/**\n * @group Data binding\n */\nexport const HasOne = Component(\n\t<EntityProps extends {}>(props: HasOneProps<EntityProps>) => {\n\t\tconst entity = useEntity(props)\n\n\t\treturn <Entity {...props} accessor={entity} />\n\t},\n\t{\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntity(environment, props)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<Entity {...props} accessor={undefined as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</Entity>\n\t\t),\n\t\tgenerateBranchMarker: (props, fields, environment) =>\n\t\t\tMarkerFactory.createRelativeSingleEntityFields(props, environment, fields),\n\t},\n\t'HasOne',\n) as <EntityProps extends {}>(props: HasOneProps<EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;AAmBO,MAAM,SAAS;AAAA,EACrB,CAAyB,UAAoC;AACtD,UAAA,SAAS,UAAU,KAAK;AAE9B,WAAQ,oBAAA,QAAA,EAAQ,GAAG,OAAO,UAAU,OAAQ,CAAA;AAAA,EAC7C;AAAA,EACA;AAAA,IACC,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,2BAA2B,aAAa,KAAK;AAAA,IAChF;AAAA,IACA,cAAc,CACb,UAAA,qBAAC,UAAQ,GAAG,OAAO,UAAU,QAC5B,UAAA;AAAA,MAAC,oBAAA,OAAA,EAAM,OAAO,iBAAkB,CAAA;AAAA,MAC/B,MAAM;AAAA,IAAA,GACR;AAAA,IAED,sBAAsB,CAAC,OAAO,QAAQ,gBACrC,cAAc,iCAAiC,OAAO,aAAa,MAAM;AAAA,EAC3E;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ParentEntity.js","sources":["../../../src/coreComponents/ParentEntity.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredParentEntityParameters } from '../treeParameters'\nimport { Component } from './Component'\n\nexport interface ParentEntityProps extends SugaredParentEntityParameters {\n\tchildren?: ReactNode\n}\n\nexport const ParentEntity = Component<ParentEntityProps>(\n\tprops => <>{props.children}</>,\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) =>\n\t\t\tMarkerFactory.createParentEntityMarker(props, fields, environment),\n\t},\n\t'ParentEntity',\n)\n"],"names":[],"mappings":";;;AASO,MAAM,eAAe;AAAA,EAC3B,CAAA,UAAY,oBAAA,UAAA,EAAA,UAAA,MAAM,UAAS;AAAA,EAC3B;AAAA,IACC,sBAAsB,CAAC,OAAO,QAAQ,gBACrC,cAAc,yBAAyB,OAAO,QAAQ,WAAW;AAAA,EACnE;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"ParentEntity.js","sources":["../../../src/coreComponents/ParentEntity.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredParentEntityParameters } from '../treeParameters'\nimport { Component } from './Component'\n\nexport interface ParentEntityProps extends SugaredParentEntityParameters {\n\tchildren?: ReactNode\n}\n\n/**\n * @group Data binding\n */\nexport const ParentEntity = Component<ParentEntityProps>(\n\tprops => <>{props.children}</>,\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) =>\n\t\t\tMarkerFactory.createParentEntityMarker(props, fields, environment),\n\t},\n\t'ParentEntity',\n)\n"],"names":[],"mappings":";;;AAYO,MAAM,eAAe;AAAA,EAC3B,CAAA,UAAY,oBAAA,UAAA,EAAA,UAAA,MAAM,UAAS;AAAA,EAC3B;AAAA,IACC,sBAAsB,CAAC,OAAO,QAAQ,gBACrC,cAAc,yBAAyB,OAAO,QAAQ,WAAW;AAAA,EACnE;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DeferredSubTrees.js","sources":["../../../src/helperComponents/DeferredSubTrees.tsx"],"sourcesContent":["import { ReactNode, useCallback, useEffect, useState } from 'react'\nimport { TreeRootIdProvider, useBindingOperations, useHasEntity, useEnvironment } from '../accessorPropagation'\nimport { useMutationState } from '../accessorTree'\nimport { Component } from '../coreComponents'\nimport { useEntityBeforePersist } from '../entityEvents'\nimport { EntityFieldMarkersContainer, EntityFieldsWithHoistablesMarker } from '../markers'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { TreeRootId } from '../treeParameters'\nimport { useConstantValueInvariant } from '@contember/react-utils'\nimport { EntityAccessor } from '../accessors'\n\nexport interface DeferredSubTreesProps {\n\tfallback: ReactNode\n\tchildren: ReactNode\n}\n\ntype LoadState =\n\t| { name: 'initial' }\n\t| { name: 'loading' }\n\t| {\n\t\t\tname: 'success'\n\t\t\ttreeRootId: TreeRootId | undefined\n\t }\n\nexport const DeferredSubTrees = Component<DeferredSubTreesProps>(\n\tprops => {\n\t\tconst { extendTree } = useBindingOperations()\n\t\tconst isMutating = useMutationState()\n\n\t\tconst [loadState, setLoadState] = useState<LoadState>({ name: 'initial' })\n\n\t\tconst [abortController] = useState(() => new AbortController())\n\t\tconst signal = abortController.signal\n\n\t\tconst hasEntity = useHasEntity()\n\t\tuseConstantValueInvariant(hasEntity)\n\t\tif (hasEntity) {\n\t\t\tuseEntityBeforePersist(\n\t\t\t\tuseCallback((getAccessor: EntityAccessor.GetEntityAccessor) => {\n\t\t\t\t\t// This is a hack. We're really just circumventing the change of ids after a creation so that nested\n\t\t\t\t\t// components don't error.\n\t\t\t\t\tif (getAccessor().existsOnServer) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tsetLoadState({ name: 'initial' })\n\t\t\t\t}, []),\n\t\t\t)\n\t\t}\n\n\t\tuseEffect(() => {\n\t\t\treturn () => {\n\t\t\t\tabortController.abort()\n\t\t\t}\n\t\t}, [abortController])\n\n\t\tconst environment = useEnvironment()\n\t\tuseEffect(() => {\n\t\t\tif (isMutating || loadState.name !== 'initial' || signal.aborted) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetLoadState({ name: 'loading' })\n\n\t\t\tconst newFragment = <OnlyKeepSubTrees>{props.children}</OnlyKeepSubTrees>\n\n\t\t\textendTree(newFragment, { signal, environment })\n\t\t\t\t.then(treeRootId => !signal.aborted && setLoadState({ name: 'success', treeRootId }))\n\t\t\t\t.catch(error => {\n\t\t\t\t\tif (signal.aborted) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t})\n\t\t}, [environment, extendTree, isMutating, loadState.name, props.children, signal])\n\n\t\tswitch (loadState.name) {\n\t\t\tcase 'initial':\n\t\t\tcase 'loading':\n\t\t\t\treturn <>{props.fallback}</>\n\t\t\tcase 'success':\n\t\t\t\t// This is tricky. The relations & fields within children will just render normally as if this\n\t\t\t\t// component didn't exist. The sub trees, however, will read the new treeRootId and draw their data\n\t\t\t\t// from the newly loaded batch provided by this component. That way the sub trees (and only the sub trees!)\n\t\t\t\t// effectively get lazy loaded.\n\t\t\t\treturn <TreeRootIdProvider treeRootId={loadState.treeRootId}>{props.children}</TreeRootIdProvider>\n\t\t}\n\t},\n\t{\n\t\tstaticRender: props => (\n\t\t\t<>\n\t\t\t\t{props.children}\n\t\t\t\t{props.fallback}\n\t\t\t</>\n\t\t),\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tconst fieldsWithHoistablesMarker = MarkerFactory.createEntityFieldsWithHoistablesMarker(fields, environment)\n\n\t\t\t// We want to get rid of the subTrees but leave whatever relations and fields are present.\n\t\t\t//\n\t\t\t// Mutating from here is fine since we've literally just created it and no other code could possibly possess\n\t\t\t// a reference to this.\n\t\t\tfieldsWithHoistablesMarker.subTrees?.clear()\n\n\t\t\treturn fieldsWithHoistablesMarker\n\t\t},\n\t},\n\t'DeferredSubTree',\n)\n\nconst OnlyKeepSubTrees = Component<{ children: ReactNode }>(\n\t() => null,\n\t{\n\t\tgenerateBranchMarker: (props, fields) => {\n\t\t\t// This is the complement of the equivalent method above: this time we're only keeping the sub trees.\n\t\t\tconst emptyFields = MarkerFactory.createEntityFieldMarkersContainer(undefined)\n\n\t\t\tif (fields instanceof EntityFieldMarkersContainer) {\n\t\t\t\treturn emptyFields\n\t\t\t}\n\t\t\treturn new EntityFieldsWithHoistablesMarker(emptyFields, fields.subTrees, undefined)\n\t\t},\n\t},\n\t'OnlyKeepSubTrees',\n)\n"],"names":[],"mappings":";;;;;;;;;;;;;AAwBO,MAAM,mBAAmB;AAAA,EAC/B,CAAS,UAAA;AACF,UAAA,EAAE,eAAe;AACvB,UAAM,aAAa;AAEb,UAAA,CAAC,WAAW,YAAY,IAAI,SAAoB,EAAE,MAAM,WAAW;AAEzE,UAAM,CAAC,eAAe,IAAI,SAAS,MAAM,IAAI,gBAAiB,CAAA;AAC9D,UAAM,SAAS,gBAAgB;AAE/B,UAAM,YAAY;AAClB,8BAA0B,SAAS;AACnC,QAAI,WAAW;AACd;AAAA,QACC,YAAY,CAAC,gBAAkD;AAG1D,cAAA,cAAc,gBAAgB;AACjC;AAAA,UACD;AACa,uBAAA,EAAE,MAAM,UAAA,CAAW;AAAA,QACjC,GAAG,EAAE;AAAA,MAAA;AAAA,IAEP;AAEA,cAAU,MAAM;AACf,aAAO,MAAM;AACZ,wBAAgB,MAAM;AAAA,MAAA;AAAA,IACvB,GACE,CAAC,eAAe,CAAC;AAEpB,UAAM,cAAc;AACpB,cAAU,MAAM;AACf,UAAI,cAAc,UAAU,SAAS,aAAa,OAAO,SAAS;AACjE;AAAA,MACD;AACa,mBAAA,EAAE,MAAM,UAAA,CAAW;AAEhC,YAAM,cAAc,oBAAC,kBAAkB,EAAA,UAAA,MAAM,SAAS,CAAA;AAE3C,iBAAA,aAAa,EAAE,QAAQ,YAAa,CAAA,EAC7C,KAAK,gBAAc,CAAC,OAAO,WAAW,aAAa,EAAE,MAAM,WAAW,WAAA,CAAY,CAAC,EACnF,MAAM,CAAS,UAAA;AACf,YAAI,OAAO,SAAS;AACnB;AAAA,QACD;AACM,cAAA;AAAA,MAAA,CACN;AAAA,IAAA,GACA,CAAC,aAAa,YAAY,YAAY,UAAU,MAAM,MAAM,UAAU,MAAM,CAAC;AAEhF,YAAQ,UAAU,MAAM;AAAA,MACvB,KAAK;AAAA,MACL,KAAK;AACG,eAAA,oBAAA,UAAA,EAAG,gBAAM,SAAS,CAAA;AAAA,MAC1B,KAAK;AAKJ,mCAAQ,oBAAmB,EAAA,YAAY,UAAU,YAAa,gBAAM,SAAS,CAAA;AAAA,IAC/E;AAAA,EACD;AAAA,EACA;AAAA,IACC,cAAc,WAEX,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAM,MAAA;AAAA,MACN,MAAM;AAAA,IAAA,GACR;AAAA,IAED,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACrD,YAAM,6BAA6B,cAAc,uCAAuC,QAAQ,WAAW;AAM3G,iCAA2B,UAAU;AAE9B,aAAA;AAAA,IACR;AAAA,EACD;AAAA,EACA;AACD;AAEA,MAAM,mBAAmB;AAAA,EACxB,MAAM;AAAA,EACN;AAAA,IACC,sBAAsB,CAAC,OAAO,WAAW;AAElC,YAAA,cAAc,cAAc,kCAAkC,MAAS;AAE7E,UAAI,kBAAkB,6BAA6B;AAC3C,eAAA;AAAA,MACR;AACA,aAAO,IAAI,iCAAiC,aAAa,OAAO,UAAU,MAAS;AAAA,IACpF;AAAA,EACD;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"DeferredSubTrees.js","sources":["../../../src/helperComponents/DeferredSubTrees.tsx"],"sourcesContent":["import { ReactNode, useCallback, useEffect, useState } from 'react'\nimport { TreeRootIdProvider, useBindingOperations, useHasEntity, useEnvironment } from '../accessorPropagation'\nimport { useMutationState } from '../accessorTree'\nimport { Component } from '../coreComponents'\nimport { useEntityBeforePersist } from '../entityEvents'\nimport { EntityFieldMarkersContainer, EntityFieldsWithHoistablesMarker } from '../markers'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { TreeRootId } from '../treeParameters'\nimport { useConstantValueInvariant } from '@contember/react-utils'\nimport { EntityAccessor } from '../accessors'\n\nexport interface DeferredSubTreesProps {\n\tfallback: ReactNode\n\tchildren: ReactNode\n}\n\ntype LoadState =\n\t| { name: 'initial' }\n\t| { name: 'loading' }\n\t| {\n\t\t\tname: 'success'\n\t\t\ttreeRootId: TreeRootId | undefined\n\t }\n\n/**\n * @group Data binding\n */\nexport const DeferredSubTrees = Component<DeferredSubTreesProps>(\n\tprops => {\n\t\tconst { extendTree } = useBindingOperations()\n\t\tconst isMutating = useMutationState()\n\n\t\tconst [loadState, setLoadState] = useState<LoadState>({ name: 'initial' })\n\n\t\tconst [abortController] = useState(() => new AbortController())\n\t\tconst signal = abortController.signal\n\n\t\tconst hasEntity = useHasEntity()\n\t\tuseConstantValueInvariant(hasEntity)\n\t\tif (hasEntity) {\n\t\t\tuseEntityBeforePersist(\n\t\t\t\tuseCallback((getAccessor: EntityAccessor.GetEntityAccessor) => {\n\t\t\t\t\t// This is a hack. We're really just circumventing the change of ids after a creation so that nested\n\t\t\t\t\t// components don't error.\n\t\t\t\t\tif (getAccessor().existsOnServer) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tsetLoadState({ name: 'initial' })\n\t\t\t\t}, []),\n\t\t\t)\n\t\t}\n\n\t\tuseEffect(() => {\n\t\t\treturn () => {\n\t\t\t\tabortController.abort()\n\t\t\t}\n\t\t}, [abortController])\n\n\t\tconst environment = useEnvironment()\n\t\tuseEffect(() => {\n\t\t\tif (isMutating || loadState.name !== 'initial' || signal.aborted) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetLoadState({ name: 'loading' })\n\n\t\t\tconst newFragment = <OnlyKeepSubTrees>{props.children}</OnlyKeepSubTrees>\n\n\t\t\textendTree(newFragment, { signal, environment })\n\t\t\t\t.then(treeRootId => !signal.aborted && setLoadState({ name: 'success', treeRootId }))\n\t\t\t\t.catch(error => {\n\t\t\t\t\tif (signal.aborted) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t})\n\t\t}, [environment, extendTree, isMutating, loadState.name, props.children, signal])\n\n\t\tswitch (loadState.name) {\n\t\t\tcase 'initial':\n\t\t\tcase 'loading':\n\t\t\t\treturn <>{props.fallback}</>\n\t\t\tcase 'success':\n\t\t\t\t// This is tricky. The relations & fields within children will just render normally as if this\n\t\t\t\t// component didn't exist. The sub trees, however, will read the new treeRootId and draw their data\n\t\t\t\t// from the newly loaded batch provided by this component. That way the sub trees (and only the sub trees!)\n\t\t\t\t// effectively get lazy loaded.\n\t\t\t\treturn <TreeRootIdProvider treeRootId={loadState.treeRootId}>{props.children}</TreeRootIdProvider>\n\t\t}\n\t},\n\t{\n\t\tstaticRender: props => (\n\t\t\t<>\n\t\t\t\t{props.children}\n\t\t\t\t{props.fallback}\n\t\t\t</>\n\t\t),\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tconst fieldsWithHoistablesMarker = MarkerFactory.createEntityFieldsWithHoistablesMarker(fields, environment)\n\n\t\t\t// We want to get rid of the subTrees but leave whatever relations and fields are present.\n\t\t\t//\n\t\t\t// Mutating from here is fine since we've literally just created it and no other code could possibly possess\n\t\t\t// a reference to this.\n\t\t\tfieldsWithHoistablesMarker.subTrees?.clear()\n\n\t\t\treturn fieldsWithHoistablesMarker\n\t\t},\n\t},\n\t'DeferredSubTree',\n)\n\nconst OnlyKeepSubTrees = Component<{ children: ReactNode }>(\n\t() => null,\n\t{\n\t\tgenerateBranchMarker: (props, fields) => {\n\t\t\t// This is the complement of the equivalent method above: this time we're only keeping the sub trees.\n\t\t\tconst emptyFields = MarkerFactory.createEntityFieldMarkersContainer(undefined)\n\n\t\t\tif (fields instanceof EntityFieldMarkersContainer) {\n\t\t\t\treturn emptyFields\n\t\t\t}\n\t\t\treturn new EntityFieldsWithHoistablesMarker(emptyFields, fields.subTrees, undefined)\n\t\t},\n\t},\n\t'OnlyKeepSubTrees',\n)\n"],"names":[],"mappings":";;;;;;;;;;;;;AA2BO,MAAM,mBAAmB;AAAA,EAC/B,CAAS,UAAA;AACF,UAAA,EAAE,eAAe;AACvB,UAAM,aAAa;AAEb,UAAA,CAAC,WAAW,YAAY,IAAI,SAAoB,EAAE,MAAM,WAAW;AAEzE,UAAM,CAAC,eAAe,IAAI,SAAS,MAAM,IAAI,gBAAiB,CAAA;AAC9D,UAAM,SAAS,gBAAgB;AAE/B,UAAM,YAAY;AAClB,8BAA0B,SAAS;AACnC,QAAI,WAAW;AACd;AAAA,QACC,YAAY,CAAC,gBAAkD;AAG1D,cAAA,cAAc,gBAAgB;AACjC;AAAA,UACD;AACa,uBAAA,EAAE,MAAM,UAAA,CAAW;AAAA,QACjC,GAAG,EAAE;AAAA,MAAA;AAAA,IAEP;AAEA,cAAU,MAAM;AACf,aAAO,MAAM;AACZ,wBAAgB,MAAM;AAAA,MAAA;AAAA,IACvB,GACE,CAAC,eAAe,CAAC;AAEpB,UAAM,cAAc;AACpB,cAAU,MAAM;AACf,UAAI,cAAc,UAAU,SAAS,aAAa,OAAO,SAAS;AACjE;AAAA,MACD;AACa,mBAAA,EAAE,MAAM,UAAA,CAAW;AAEhC,YAAM,cAAc,oBAAC,kBAAkB,EAAA,UAAA,MAAM,SAAS,CAAA;AAE3C,iBAAA,aAAa,EAAE,QAAQ,YAAa,CAAA,EAC7C,KAAK,gBAAc,CAAC,OAAO,WAAW,aAAa,EAAE,MAAM,WAAW,WAAA,CAAY,CAAC,EACnF,MAAM,CAAS,UAAA;AACf,YAAI,OAAO,SAAS;AACnB;AAAA,QACD;AACM,cAAA;AAAA,MAAA,CACN;AAAA,IAAA,GACA,CAAC,aAAa,YAAY,YAAY,UAAU,MAAM,MAAM,UAAU,MAAM,CAAC;AAEhF,YAAQ,UAAU,MAAM;AAAA,MACvB,KAAK;AAAA,MACL,KAAK;AACG,eAAA,oBAAA,UAAA,EAAG,gBAAM,SAAS,CAAA;AAAA,MAC1B,KAAK;AAKJ,mCAAQ,oBAAmB,EAAA,YAAY,UAAU,YAAa,gBAAM,SAAS,CAAA;AAAA,IAC/E;AAAA,EACD;AAAA,EACA;AAAA,IACC,cAAc,WAEX,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAM,MAAA;AAAA,MACN,MAAM;AAAA,IAAA,GACR;AAAA,IAED,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACrD,YAAM,6BAA6B,cAAc,uCAAuC,QAAQ,WAAW;AAM3G,iCAA2B,UAAU;AAE9B,aAAA;AAAA,IACR;AAAA,EACD;AAAA,EACA;AACD;AAEA,MAAM,mBAAmB;AAAA,EACxB,MAAM;AAAA,EACN;AAAA,IACC,sBAAsB,CAAC,OAAO,WAAW;AAElC,YAAA,cAAc,cAAc,kCAAkC,MAAS;AAE7E,UAAI,kBAAkB,6BAA6B;AAC3C,eAAA;AAAA,MACR;AACA,aAAO,IAAI,iCAAiC,aAAa,OAAO,UAAU,MAAS;AAAA,IACpF;AAAA,EACD;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityView.js","sources":["../../../src/helperComponents/EntityView.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useEntity } from '../accessorPropagation'\nimport type { EntityAccessor } from '../accessors'\nimport type { SugaredRelativeSingleEntity } from '../treeParameters'\n\nexport interface EntityViewProps {\n\trender: (entity: EntityAccessor) => ReactNode\n\tfield?: string | SugaredRelativeSingleEntity\n}\n\nexport function EntityView(props: EntityViewProps) {\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst entity = 'field' in props ? useEntity(props.field)! : useEntity()\n\n\treturn <>{props.render(entity)}</>\n}\n"],"names":[],"mappings":";;AAUO,SAAS,WAAW,OAAwB;AAElD,QAAM,SAAS,WAAW,QAAQ,UAAU,MAAM,KAAK,IAAK;AAE5D,SAAU,oBAAA,UAAA,EAAA,UAAA,MAAM,OAAO,MAAM,EAAE,CAAA;AAChC;"}
1
+ {"version":3,"file":"EntityView.js","sources":["../../../src/helperComponents/EntityView.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useEntity } from '../accessorPropagation'\nimport type { EntityAccessor } from '../accessors'\nimport type { SugaredRelativeSingleEntity } from '../treeParameters'\n\nexport interface EntityViewProps {\n\trender: (entity: EntityAccessor) => ReactNode\n\tfield?: string | SugaredRelativeSingleEntity\n}\n\n/**\n * @group Data binding\n */\nexport function EntityView(props: EntityViewProps) {\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst entity = 'field' in props ? useEntity(props.field)! : useEntity()\n\n\treturn <>{props.render(entity)}</>\n}\n"],"names":[],"mappings":";;AAaO,SAAS,WAAW,OAAwB;AAElD,QAAM,SAAS,WAAW,QAAQ,UAAU,MAAM,KAAK,IAAK;AAE5D,SAAU,oBAAA,UAAA,EAAA,UAAA,MAAM,OAAO,MAAM,EAAE,CAAA;AAChC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"FieldView.js","sources":["../../../src/helperComponents/FieldView.tsx"],"sourcesContent":["import { useArrayMapMemo, useConstantLengthInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode, useCallback, useMemo } from 'react'\nimport { useEntity } from '../accessorPropagation'\nimport type { FieldAccessor } from '../accessors'\nimport { throwBindingError } from '../BindingError'\nimport { Component } from '../coreComponents'\nimport { QueryLanguage } from '../queryLanguage'\nimport type { FieldValue, RelativeSingleField, SugaredRelativeSingleField } from '../treeParameters'\nimport { SugaredField } from './SugaredField'\n\ninterface FieldViewCommonProps {\n\tfallbackIfUnpersisted?: ReactNode\n}\n\ntype FieldViewProps = FieldViewCommonProps &\n\t(\n\t\t| {\n\t\t\t\trender: (...accessors: FieldAccessor[]) => ReactNode\n\t\t\t\tfield: string | SugaredRelativeSingleField\n\t\t }\n\t\t| {\n\t\t\t\trender: (...accessors: FieldAccessor[]) => ReactNode\n\t\t\t\tfields: Array<string | SugaredRelativeSingleField>\n\t\t }\n\t)\n\n// Just short type aliases so that we can type the overloads in a tractable fashion.\ntype FV = FieldValue\ntype SRSF = string | SugaredRelativeSingleField\ntype CP = FieldViewCommonProps\ntype RN = ReactNode\ntype REN = ReactElement | null\n\nexport const FieldView = Component<FieldViewProps>(\n\tprops => {\n\t\tconst { fallbackIfUnpersisted, render } = props\n\t\tconst fields =\n\t\t\t'fields' in props && Array.isArray(props.fields)\n\t\t\t\t? props.fields\n\t\t\t\t: 'field' in props && props.field\n\t\t\t\t? [props.field]\n\t\t\t\t: throwBindingError(`FieldView: failed to supply either the 'field' or the 'fields' prop.`)\n\n\t\tuseConstantLengthInvariant(\n\t\t\tfields,\n\t\t\t`The number of fields in the 'fields' prop of the 'FieldView' must remain constant between renders!`,\n\t\t)\n\n\t\t// TODO over-subscribe less\n\t\tconst entityAccessor = useEntity()\n\t\tconst environment = entityAccessor.environment\n\n\t\tconst desugarField = useCallback(\n\t\t\t(rsf: SRSF) => QueryLanguage.desugarRelativeSingleField(rsf, environment),\n\t\t\t[environment],\n\t\t)\n\t\tconst desugaredFields = useArrayMapMemo(fields, desugarField)\n\n\t\tconst retrieveField = useCallback(\n\t\t\t(desugaredRsf: RelativeSingleField) => entityAccessor.getRelativeSingleField(desugaredRsf),\n\t\t\t[entityAccessor],\n\t\t)\n\t\tconst accessors = useArrayMapMemo(desugaredFields, retrieveField)\n\n\t\t// TODO we probably want something like useDeferredValue from here.\n\t\t// Will probably just wait for Concurrent React though.\n\t\tconst output = useMemo(() => {\n\t\t\tif (!entityAccessor.existsOnServer && fallbackIfUnpersisted !== undefined) {\n\t\t\t\treturn fallbackIfUnpersisted\n\t\t\t}\n\t\t\treturn render(...accessors)\n\t\t}, [accessors, entityAccessor.existsOnServer, fallbackIfUnpersisted, render])\n\n\t\treturn <>{output}</>\n\t},\n\tprops => {\n\t\tconst fields =\n\t\t\t'fields' in props && Array.isArray(props.fields)\n\t\t\t\t? props.fields\n\t\t\t\t: 'field' in props && props.field\n\t\t\t\t? [props.field]\n\t\t\t\t: throwBindingError(`FieldView: failed to supply either the 'field' or the 'fields' prop.`)\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{props.fallbackIfUnpersisted}\n\t\t\t\t{fields.map((field, i) => (\n\t\t\t\t\t<SugaredField key={i} field={field} />\n\t\t\t\t))}\n\t\t\t</>\n\t\t)\n\t},\n\t'FieldView',\n) as {\n\t<FV1 extends FV>(props: CP & { field: SRSF; render: (field1: FieldAccessor<FV1>) => RN }): REN\n\t<FV1 extends FV>(props: CP & { fields: [SRSF]; render: (field1: FieldAccessor<FV1>) => RN }): REN\n\t<FV1 extends FV, FV2 extends FV>(\n\t\tprops: CP & { fields: [SRSF, SRSF]; render: (field1: FieldAccessor<FV1>, field2: FieldAccessor<FV2>) => RN },\n\t): REN\n\t<FV1 extends FV, FV2 extends FV, FV3 extends FV>(\n\t\tprops: CP & {\n\t\t\tfields: [SRSF, SRSF, SRSF]\n\t\t\trender: (field1: FieldAccessor<FV1>, field2: FieldAccessor<FV2>, field3: FieldAccessor<FV3>) => RN\n\t\t},\n\t): REN\n\t<FV1 extends FV, FV2 extends FV, FV3 extends FV, FV4 extends FV>(\n\t\tprops: CP & {\n\t\t\tfields: [SRSF, SRSF, SRSF, SRSF]\n\t\t\trender: (\n\t\t\t\tfield1: FieldAccessor<FV1>,\n\t\t\t\tfield2: FieldAccessor<FV2>,\n\t\t\t\tfield3: FieldAccessor<FV3>,\n\t\t\t\tfield4: FieldAccessor<FV4>,\n\t\t\t) => RN\n\t\t},\n\t): REN\n\t<FV1 extends FV, FV2 extends FV, FV3 extends FV, FV4 extends FV, FV5 extends FV>(\n\t\tprops: CP & {\n\t\t\tfields: [SRSF, SRSF, SRSF, SRSF, SRSF]\n\t\t\trender: (\n\t\t\t\tfield1: FieldAccessor<FV1>,\n\t\t\t\tfield2: FieldAccessor<FV2>,\n\t\t\t\tfield3: FieldAccessor<FV3>,\n\t\t\t\tfield4: FieldAccessor<FV4>,\n\t\t\t\tfield5: FieldAccessor<FV5>,\n\t\t\t) => RN\n\t\t},\n\t): REN\n\t(props: FieldViewProps): REN\n}\n"],"names":[],"mappings":";;;;;;;;AAiCO,MAAM,YAAY;AAAA,EACxB,CAAS,UAAA;AACF,UAAA,EAAE,uBAAuB,OAAW,IAAA;AAC1C,UAAM,SACL,YAAY,SAAS,MAAM,QAAQ,MAAM,MAAM,IAC5C,MAAM,SACN,WAAW,SAAS,MAAM,QAC1B,CAAC,MAAM,KAAK,IACZ,kBAAkB,sEAAsE;AAE5F;AAAA,MACC;AAAA,MACA;AAAA,IAAA;AAID,UAAM,iBAAiB;AACvB,UAAM,cAAc,eAAe;AAEnC,UAAM,eAAe;AAAA,MACpB,CAAC,QAAc,cAAc,2BAA2B,KAAK,WAAW;AAAA,MACxE,CAAC,WAAW;AAAA,IAAA;AAEP,UAAA,kBAAkB,gBAAgB,QAAQ,YAAY;AAE5D,UAAM,gBAAgB;AAAA,MACrB,CAAC,iBAAsC,eAAe,uBAAuB,YAAY;AAAA,MACzF,CAAC,cAAc;AAAA,IAAA;AAEV,UAAA,YAAY,gBAAgB,iBAAiB,aAAa;AAI1D,UAAA,SAAS,QAAQ,MAAM;AAC5B,UAAI,CAAC,eAAe,kBAAkB,0BAA0B,QAAW;AACnE,eAAA;AAAA,MACR;AACO,aAAA,OAAO,GAAG,SAAS;AAAA,IAAA,GACxB,CAAC,WAAW,eAAe,gBAAgB,uBAAuB,MAAM,CAAC;AAE5E,2CAAU,UAAO,OAAA,CAAA;AAAA,EAClB;AAAA,EACA,CAAS,UAAA;AACR,UAAM,SACL,YAAY,SAAS,MAAM,QAAQ,MAAM,MAAM,IAC5C,MAAM,SACN,WAAW,SAAS,MAAM,QAC1B,CAAC,MAAM,KAAK,IACZ,kBAAkB,sEAAsE;AAC5F,WAEG,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAM,MAAA;AAAA,MACN,OAAO,IAAI,CAAC,OAAO,MAClB,oBAAA,cAAA,EAAqB,SAAH,CAAiB,CACpC;AAAA,IACF,EAAA,CAAA;AAAA,EAEF;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"FieldView.js","sources":["../../../src/helperComponents/FieldView.tsx"],"sourcesContent":["import { useArrayMapMemo, useConstantLengthInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode, useCallback, useMemo } from 'react'\nimport { useEntity } from '../accessorPropagation'\nimport type { FieldAccessor } from '../accessors'\nimport { throwBindingError } from '../BindingError'\nimport { Component } from '../coreComponents'\nimport { QueryLanguage } from '../queryLanguage'\nimport type { FieldValue, RelativeSingleField, SugaredRelativeSingleField } from '../treeParameters'\nimport { SugaredField } from './SugaredField'\n\ninterface FieldViewCommonProps {\n\tfallbackIfUnpersisted?: ReactNode\n}\n\ntype FieldViewProps = FieldViewCommonProps &\n\t(\n\t\t| {\n\t\t\t\trender: (...accessors: FieldAccessor[]) => ReactNode\n\t\t\t\tfield: string | SugaredRelativeSingleField\n\t\t }\n\t\t| {\n\t\t\t\trender: (...accessors: FieldAccessor[]) => ReactNode\n\t\t\t\tfields: Array<string | SugaredRelativeSingleField>\n\t\t }\n\t)\n\n// Just short type aliases so that we can type the overloads in a tractable fashion.\ntype FV = FieldValue\ntype SRSF = string | SugaredRelativeSingleField\ntype CP = FieldViewCommonProps\ntype RN = ReactNode\ntype REN = ReactElement | null\n\n/**\n * Base field view component with no default formatting.\n *\n * @example\n * ```\n * <FieldView\n * field=\"startsAt\"\n * render={(accessor) => <>{accessor.value}</>}\n * />\n * ```\n *\n * @group Field Views\n */\nexport const FieldView = Component<FieldViewProps>(\n\tprops => {\n\t\tconst { fallbackIfUnpersisted, render } = props\n\t\tconst fields =\n\t\t\t'fields' in props && Array.isArray(props.fields)\n\t\t\t\t? props.fields\n\t\t\t\t: 'field' in props && props.field\n\t\t\t\t? [props.field]\n\t\t\t\t: throwBindingError(`FieldView: failed to supply either the 'field' or the 'fields' prop.`)\n\n\t\tuseConstantLengthInvariant(\n\t\t\tfields,\n\t\t\t`The number of fields in the 'fields' prop of the 'FieldView' must remain constant between renders!`,\n\t\t)\n\n\t\t// TODO over-subscribe less\n\t\tconst entityAccessor = useEntity()\n\t\tconst environment = entityAccessor.environment\n\n\t\tconst desugarField = useCallback(\n\t\t\t(rsf: SRSF) => QueryLanguage.desugarRelativeSingleField(rsf, environment),\n\t\t\t[environment],\n\t\t)\n\t\tconst desugaredFields = useArrayMapMemo(fields, desugarField)\n\n\t\tconst retrieveField = useCallback(\n\t\t\t(desugaredRsf: RelativeSingleField) => entityAccessor.getRelativeSingleField(desugaredRsf),\n\t\t\t[entityAccessor],\n\t\t)\n\t\tconst accessors = useArrayMapMemo(desugaredFields, retrieveField)\n\n\t\t// TODO we probably want something like useDeferredValue from here.\n\t\t// Will probably just wait for Concurrent React though.\n\t\tconst output = useMemo(() => {\n\t\t\tif (!entityAccessor.existsOnServer && fallbackIfUnpersisted !== undefined) {\n\t\t\t\treturn fallbackIfUnpersisted\n\t\t\t}\n\t\t\treturn render(...accessors)\n\t\t}, [accessors, entityAccessor.existsOnServer, fallbackIfUnpersisted, render])\n\n\t\treturn <>{output}</>\n\t},\n\tprops => {\n\t\tconst fields =\n\t\t\t'fields' in props && Array.isArray(props.fields)\n\t\t\t\t? props.fields\n\t\t\t\t: 'field' in props && props.field\n\t\t\t\t? [props.field]\n\t\t\t\t: throwBindingError(`FieldView: failed to supply either the 'field' or the 'fields' prop.`)\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{props.fallbackIfUnpersisted}\n\t\t\t\t{fields.map((field, i) => (\n\t\t\t\t\t<SugaredField key={i} field={field} />\n\t\t\t\t))}\n\t\t\t</>\n\t\t)\n\t},\n\t'FieldView',\n) as {\n\t<FV1 extends FV>(props: CP & { field: SRSF; render: (field1: FieldAccessor<FV1>) => RN }): REN\n\t<FV1 extends FV>(props: CP & { fields: [SRSF]; render: (field1: FieldAccessor<FV1>) => RN }): REN\n\t<FV1 extends FV, FV2 extends FV>(\n\t\tprops: CP & { fields: [SRSF, SRSF]; render: (field1: FieldAccessor<FV1>, field2: FieldAccessor<FV2>) => RN },\n\t): REN\n\t<FV1 extends FV, FV2 extends FV, FV3 extends FV>(\n\t\tprops: CP & {\n\t\t\tfields: [SRSF, SRSF, SRSF]\n\t\t\trender: (field1: FieldAccessor<FV1>, field2: FieldAccessor<FV2>, field3: FieldAccessor<FV3>) => RN\n\t\t},\n\t): REN\n\t<FV1 extends FV, FV2 extends FV, FV3 extends FV, FV4 extends FV>(\n\t\tprops: CP & {\n\t\t\tfields: [SRSF, SRSF, SRSF, SRSF]\n\t\t\trender: (\n\t\t\t\tfield1: FieldAccessor<FV1>,\n\t\t\t\tfield2: FieldAccessor<FV2>,\n\t\t\t\tfield3: FieldAccessor<FV3>,\n\t\t\t\tfield4: FieldAccessor<FV4>,\n\t\t\t) => RN\n\t\t},\n\t): REN\n\t<FV1 extends FV, FV2 extends FV, FV3 extends FV, FV4 extends FV, FV5 extends FV>(\n\t\tprops: CP & {\n\t\t\tfields: [SRSF, SRSF, SRSF, SRSF, SRSF]\n\t\t\trender: (\n\t\t\t\tfield1: FieldAccessor<FV1>,\n\t\t\t\tfield2: FieldAccessor<FV2>,\n\t\t\t\tfield3: FieldAccessor<FV3>,\n\t\t\t\tfield4: FieldAccessor<FV4>,\n\t\t\t\tfield5: FieldAccessor<FV5>,\n\t\t\t) => RN\n\t\t},\n\t): REN\n\t(props: FieldViewProps): REN\n}\n"],"names":[],"mappings":";;;;;;;;AA8CO,MAAM,YAAY;AAAA,EACxB,CAAS,UAAA;AACF,UAAA,EAAE,uBAAuB,OAAW,IAAA;AAC1C,UAAM,SACL,YAAY,SAAS,MAAM,QAAQ,MAAM,MAAM,IAC5C,MAAM,SACN,WAAW,SAAS,MAAM,QAC1B,CAAC,MAAM,KAAK,IACZ,kBAAkB,sEAAsE;AAE5F;AAAA,MACC;AAAA,MACA;AAAA,IAAA;AAID,UAAM,iBAAiB;AACvB,UAAM,cAAc,eAAe;AAEnC,UAAM,eAAe;AAAA,MACpB,CAAC,QAAc,cAAc,2BAA2B,KAAK,WAAW;AAAA,MACxE,CAAC,WAAW;AAAA,IAAA;AAEP,UAAA,kBAAkB,gBAAgB,QAAQ,YAAY;AAE5D,UAAM,gBAAgB;AAAA,MACrB,CAAC,iBAAsC,eAAe,uBAAuB,YAAY;AAAA,MACzF,CAAC,cAAc;AAAA,IAAA;AAEV,UAAA,YAAY,gBAAgB,iBAAiB,aAAa;AAI1D,UAAA,SAAS,QAAQ,MAAM;AAC5B,UAAI,CAAC,eAAe,kBAAkB,0BAA0B,QAAW;AACnE,eAAA;AAAA,MACR;AACO,aAAA,OAAO,GAAG,SAAS;AAAA,IAAA,GACxB,CAAC,WAAW,eAAe,gBAAgB,uBAAuB,MAAM,CAAC;AAE5E,2CAAU,UAAO,OAAA,CAAA;AAAA,EAClB;AAAA,EACA,CAAS,UAAA;AACR,UAAM,SACL,YAAY,SAAS,MAAM,QAAQ,MAAM,MAAM,IAC5C,MAAM,SACN,WAAW,SAAS,MAAM,QAC1B,CAAC,MAAM,KAAK,IACZ,kBAAkB,sEAAsE;AAC5F,WAEG,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAM,MAAA;AAAA,MACN,OAAO,IAAI,CAAC,OAAO,MAClB,oBAAA,cAAA,EAAqB,SAAH,CAAiB,CACpC;AAAA,IACF,EAAA,CAAA;AAAA,EAEF;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"If.js","sources":["../../../src/helperComponents/If.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useMemo } from 'react'\nimport { Component, Field } from '../coreComponents'\nimport { EntityAccessor } from '../accessors'\nimport { QueryLanguage } from '../queryLanguage'\nimport { useEntity, useEnvironment } from '../accessorPropagation'\nimport { Filter } from '../treeParameters'\nimport { FilterFieldsCollector } from './helpers/FilterFieldsCollector'\nimport { FilterEvaluator } from './helpers/FilterEvaluator'\n\nexport type IfProps =\n\t| IfFilterProps\n\t| IfCallbackProps\n\nexport interface IfFilterProps {\n\tcondition: string | Filter\n\tchildren?: ReactNode\n}\n\nexport interface IfCallbackProps {\n\tcondition: (accessor: EntityAccessor) => boolean\n\tchildren?: ReactNode\n}\n\nexport const If = Component<IfProps>(props => {\n\t\treturn typeof props.condition !== 'function'\n\t\t\t? <IfFilter condition={props.condition}>{props.children}</IfFilter>\n\t\t\t: <IfCallback condition={props.condition}>{props.children}</IfCallback>\n\t},\n\t'If',\n)\n\nconst IfCallback = Component<IfCallbackProps>(\n\t({ children, condition }) => {\n\t\tconst entity = useEntity()\n\t\tconst evaluated = useMemo(() => condition(entity), [condition, entity])\n\n\t\treturn evaluated ? <>{children}</> : null\n\t},\n\t({ children }) => {\n\t\treturn <>{children}</>\n\t},\n\t'IfCallback',\n)\n\nconst IfFilter = Component<IfFilterProps>(\n\t({ children, condition }) => {\n\t\tconst env = useEnvironment()\n\t\tconst entity = useEntity()\n\n\t\tconst schema = env.getSchema()\n\t\tconst evaluated = useMemo(\n\t\t\t() => new FilterEvaluator(schema).evaluateFilter(entity, QueryLanguage.desugarFilter(condition, env)),\n\t\t\t[condition, entity, env, schema],\n\t\t)\n\n\t\treturn evaluated ? <>{children}</> : null\n\t},\n\t({ children, condition }, env) => {\n\t\tconst desugaredFilter = QueryLanguage.desugarFilter(condition, env)\n\t\tconst collectedFields = new FilterFieldsCollector(env.getSchema(), desugaredFilter).collectFields(env.getSubTreeNode().entity)\n\t\tconst additionalFields = <>{Array.from(collectedFields).map(it => <Field field={it} key={it} />)}</>\n\n\t\treturn <>\n\t\t\t{additionalFields}\n\t\t\t{children}\n\t\t</>\n\t},\n\t'IfFilter',\n)\n\n"],"names":[],"mappings":";;;;;;;;;AAwBO,MAAM,KAAK;AAAA,EAAmB,CAAS,UAAA;AAC5C,WAAO,OAAO,MAAM,cAAc,aAC9B,oBAAA,UAAA,EAAS,WAAW,MAAM,WAAY,UAAM,MAAA,SAAA,CAAS,IACrD,oBAAA,YAAA,EAAW,WAAW,MAAM,WAAY,gBAAM,SAAS,CAAA;AAAA,EAC5D;AAAA,EACA;AACD;AAEA,MAAM,aAAa;AAAA,EAClB,CAAC,EAAE,UAAU,gBAAgB;AAC5B,UAAM,SAAS;AACT,UAAA,YAAY,QAAQ,MAAM,UAAU,MAAM,GAAG,CAAC,WAAW,MAAM,CAAC;AAE/D,WAAA,YAAe,oBAAA,UAAA,EAAA,SAAA,CAAS,IAAM;AAAA,EACtC;AAAA,EACA,CAAC,EAAE,SAAA,MAAe;AACjB,2CAAU,SAAS,CAAA;AAAA,EACpB;AAAA,EACA;AACD;AAEA,MAAM,WAAW;AAAA,EAChB,CAAC,EAAE,UAAU,gBAAgB;AAC5B,UAAM,MAAM;AACZ,UAAM,SAAS;AAET,UAAA,SAAS,IAAI;AACnB,UAAM,YAAY;AAAA,MACjB,MAAM,IAAI,gBAAgB,MAAM,EAAE,eAAe,QAAQ,cAAc,cAAc,WAAW,GAAG,CAAC;AAAA,MACpG,CAAC,WAAW,QAAQ,KAAK,MAAM;AAAA,IAAA;AAGzB,WAAA,YAAe,oBAAA,UAAA,EAAA,SAAA,CAAS,IAAM;AAAA,EACtC;AAAA,EACA,CAAC,EAAE,UAAU,aAAa,QAAQ;AACjC,UAAM,kBAAkB,cAAc,cAAc,WAAW,GAAG;AAClE,UAAM,kBAAkB,IAAI,sBAAsB,IAAI,UAAU,GAAG,eAAe,EAAE,cAAc,IAAI,eAAe,EAAE,MAAM;AAC7H,UAAM,mBAAmB,oBAAA,UAAA,EAAG,UAAM,MAAA,KAAK,eAAe,EAAE,IAAI,CAAM,OAAA,oBAAC,OAAM,EAAA,OAAO,MAAS,EAAI,CAAE,EAAE,CAAA;AAEjG,WACE,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAA;AAAA,MACA;AAAA,IACF,EAAA,CAAA;AAAA,EACD;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"If.js","sources":["../../../src/helperComponents/If.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useMemo } from 'react'\nimport { Component, Field } from '../coreComponents'\nimport { EntityAccessor } from '../accessors'\nimport { QueryLanguage } from '../queryLanguage'\nimport { useEntity, useEnvironment } from '../accessorPropagation'\nimport { Filter } from '../treeParameters'\nimport { FilterFieldsCollector } from './helpers/FilterFieldsCollector'\nimport { FilterEvaluator } from './helpers/FilterEvaluator'\n\nexport type IfProps =\n\t| IfFilterProps\n\t| IfCallbackProps\n\nexport interface IfFilterProps {\n\tcondition: string | Filter\n\tchildren?: ReactNode\n}\n\nexport interface IfCallbackProps {\n\tcondition: (accessor: EntityAccessor) => boolean\n\tchildren?: ReactNode\n}\n\n/**\n * @group Logic Components\n */\nexport const If = Component<IfProps>(props => {\n\t\treturn typeof props.condition !== 'function'\n\t\t\t? <IfFilter condition={props.condition}>{props.children}</IfFilter>\n\t\t\t: <IfCallback condition={props.condition}>{props.children}</IfCallback>\n\t},\n\t'If',\n)\n\nconst IfCallback = Component<IfCallbackProps>(\n\t({ children, condition }) => {\n\t\tconst entity = useEntity()\n\t\tconst evaluated = useMemo(() => condition(entity), [condition, entity])\n\n\t\treturn evaluated ? <>{children}</> : null\n\t},\n\t({ children }) => {\n\t\treturn <>{children}</>\n\t},\n\t'IfCallback',\n)\n\nconst IfFilter = Component<IfFilterProps>(\n\t({ children, condition }) => {\n\t\tconst env = useEnvironment()\n\t\tconst entity = useEntity()\n\n\t\tconst schema = env.getSchema()\n\t\tconst evaluated = useMemo(\n\t\t\t() => new FilterEvaluator(schema).evaluateFilter(entity, QueryLanguage.desugarFilter(condition, env)),\n\t\t\t[condition, entity, env, schema],\n\t\t)\n\n\t\treturn evaluated ? <>{children}</> : null\n\t},\n\t({ children, condition }, env) => {\n\t\tconst desugaredFilter = QueryLanguage.desugarFilter(condition, env)\n\t\tconst collectedFields = new FilterFieldsCollector(env.getSchema(), desugaredFilter).collectFields(env.getSubTreeNode().entity)\n\t\tconst additionalFields = <>{Array.from(collectedFields).map(it => <Field field={it} key={it} />)}</>\n\n\t\treturn <>\n\t\t\t{additionalFields}\n\t\t\t{children}\n\t\t</>\n\t},\n\t'IfFilter',\n)\n\n"],"names":[],"mappings":";;;;;;;;;AA2BO,MAAM,KAAK;AAAA,EAAmB,CAAS,UAAA;AAC5C,WAAO,OAAO,MAAM,cAAc,aAC9B,oBAAA,UAAA,EAAS,WAAW,MAAM,WAAY,UAAM,MAAA,SAAA,CAAS,IACrD,oBAAA,YAAA,EAAW,WAAW,MAAM,WAAY,gBAAM,SAAS,CAAA;AAAA,EAC5D;AAAA,EACA;AACD;AAEA,MAAM,aAAa;AAAA,EAClB,CAAC,EAAE,UAAU,gBAAgB;AAC5B,UAAM,SAAS;AACT,UAAA,YAAY,QAAQ,MAAM,UAAU,MAAM,GAAG,CAAC,WAAW,MAAM,CAAC;AAE/D,WAAA,YAAe,oBAAA,UAAA,EAAA,SAAA,CAAS,IAAM;AAAA,EACtC;AAAA,EACA,CAAC,EAAE,SAAA,MAAe;AACjB,2CAAU,SAAS,CAAA;AAAA,EACpB;AAAA,EACA;AACD;AAEA,MAAM,WAAW;AAAA,EAChB,CAAC,EAAE,UAAU,gBAAgB;AAC5B,UAAM,MAAM;AACZ,UAAM,SAAS;AAET,UAAA,SAAS,IAAI;AACnB,UAAM,YAAY;AAAA,MACjB,MAAM,IAAI,gBAAgB,MAAM,EAAE,eAAe,QAAQ,cAAc,cAAc,WAAW,GAAG,CAAC;AAAA,MACpG,CAAC,WAAW,QAAQ,KAAK,MAAM;AAAA,IAAA;AAGzB,WAAA,YAAe,oBAAA,UAAA,EAAA,SAAA,CAAS,IAAM;AAAA,EACtC;AAAA,EACA,CAAC,EAAE,UAAU,aAAa,QAAQ;AACjC,UAAM,kBAAkB,cAAc,cAAc,WAAW,GAAG;AAClE,UAAM,kBAAkB,IAAI,sBAAsB,IAAI,UAAU,GAAG,eAAe,EAAE,cAAc,IAAI,eAAe,EAAE,MAAM;AAC7H,UAAM,mBAAmB,oBAAA,UAAA,EAAG,UAAM,MAAA,KAAK,eAAe,EAAE,IAAI,CAAM,OAAA,oBAAC,OAAM,EAAA,OAAO,MAAS,EAAI,CAAE,EAAE,CAAA;AAEjG,WACE,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAA;AAAA,MACA;AAAA,IACF,EAAA,CAAA;AAAA,EACD;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"StaticRender.js","sources":["../../../src/helperComponents/StaticRender.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { Component } from '../coreComponents'\n\nexport interface StaticRenderProps {\n\tchildren?: ReactNode\n}\n\nexport const StaticRender = Component<StaticRenderProps>(\n\t() => null,\n\t({ children }) => <>{children}</>,\n\t'StaticRender',\n)\n"],"names":[],"mappings":";;AAOO,MAAM,eAAe;AAAA,EAC3B,MAAM;AAAA,EACN,CAAC,EAAE,SAAS,sCAAS,SAAS,CAAA;AAAA,EAC9B;AACD;"}
1
+ {"version":3,"file":"StaticRender.js","sources":["../../../src/helperComponents/StaticRender.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { Component } from '../coreComponents'\n\nexport interface StaticRenderProps {\n\tchildren?: ReactNode\n}\n\n/**\n * @group Data binding\n */\nexport const StaticRender = Component<StaticRenderProps>(\n\t() => null,\n\t({ children }) => <>{children}</>,\n\t'StaticRender',\n)\n"],"names":[],"mappings":";;AAUO,MAAM,eAAe;AAAA,EAC3B,MAAM;AAAA,EACN,CAAC,EAAE,SAAS,sCAAS,SAAS,CAAA;AAAA,EAC9B;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SugaredField.js","sources":["../../../src/helperComponents/SugaredField.tsx"],"sourcesContent":["import { Component, Field, FieldProps } from '../coreComponents'\nimport type { SugaredRelativeSingleField } from '../treeParameters'\nimport { FieldValue } from '../treeParameters'\nimport { ReactElement } from 'react'\n\nexport interface SugaredFieldProps<Persisted extends FieldValue = FieldValue> extends Omit<FieldProps<Persisted>, 'field'> {\n\tfield: string | SugaredRelativeSingleField\n}\n\nexport const SugaredField = Component(<Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => {\n\tif (typeof props.field === 'string') {\n\t\treturn <Field {...props} field={props.field} />\n\t}\n\treturn <Field {...props} {...props.field} />\n}, 'SugaredField') as <Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => ReactElement\n"],"names":[],"mappings":";;;AASa,MAAA,eAAe,UAAU,CAA4C,UAAwC;AACrH,MAAA,OAAO,MAAM,UAAU,UAAU;AACpC,+BAAQ,OAAO,EAAA,GAAG,OAAO,OAAO,MAAM,MAAO,CAAA;AAAA,EAC9C;AACA,6BAAQ,OAAO,EAAA,GAAG,OAAQ,GAAG,MAAM,MAAO,CAAA;AAC3C,GAAG,cAAc;"}
1
+ {"version":3,"file":"SugaredField.js","sources":["../../../src/helperComponents/SugaredField.tsx"],"sourcesContent":["import { Component, Field, FieldProps } from '../coreComponents'\nimport type { SugaredRelativeSingleField } from '../treeParameters'\nimport { FieldValue } from '../treeParameters'\nimport { ReactElement } from 'react'\n\nexport interface SugaredFieldProps<Persisted extends FieldValue = FieldValue> extends Omit<FieldProps<Persisted>, 'field'> {\n\tfield: string | SugaredRelativeSingleField\n}\n\n/**\n * @group Data binding\n */\nexport const SugaredField = Component(<Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => {\n\tif (typeof props.field === 'string') {\n\t\treturn <Field {...props} field={props.field} />\n\t}\n\treturn <Field {...props} {...props.field} />\n}, 'SugaredField') as <Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => ReactElement\n"],"names":[],"mappings":";;;AAYa,MAAA,eAAe,UAAU,CAA4C,UAAwC;AACrH,MAAA,OAAO,MAAM,UAAU,UAAU;AACpC,+BAAQ,OAAO,EAAA,GAAG,OAAO,OAAO,MAAM,MAAO,CAAA;AAAA,EAC9C;AACA,6BAAQ,OAAO,EAAA,GAAG,OAAQ,GAAG,MAAM,MAAO,CAAA;AAC3C,GAAG,cAAc;"}
@@ -1 +1 @@
1
- {"version":3,"file":"evaluateCondition.js","sources":["../../../../src/helperComponents/helpers/evaluateCondition.ts"],"sourcesContent":["import { GraphQlLiteral, Input } from '@contember/client'\nimport { FieldValue } from '../../treeParameters'\nimport { BindingError } from '../../BindingError'\n\nconst unwrapGraphqlLiteral = (value: Input.ColumnValue<GraphQlLiteral>): any => {\n\tif (value instanceof GraphQlLiteral) {\n\t\treturn value.value\n\t}\n\treturn value\n}\n\nexport const evaluateCondition = (value: FieldValue | null, condition: Input.Condition<Input.ColumnValue<GraphQlLiteral>>) => {\n\t\tconst handlers: {\n\t\t\t[K in keyof Required<Input.Condition<any>>]: (\n\t\t\t\tparam: Exclude<Input.Condition<any>[K], undefined>,\n\t\t\t) => boolean\n\t\t} = {\n\t\t\tand: expr => expr.every(it => evaluateCondition(value, it)),\n\t\t\tor: expr => expr.some(it => evaluateCondition(value, it)),\n\t\t\tnot: expr => !evaluateCondition(value, expr),\n\t\t\teq: expr => value === unwrapGraphqlLiteral(expr),\n\t\t\tnotEq: expr => value !== unwrapGraphqlLiteral(expr),\n\t\t\tisNull: expr => (value === null) === expr,\n\t\t\tin: expr => expr.map(unwrapGraphqlLiteral).includes(value),\n\t\t\tnotIn: expr => !expr.map(unwrapGraphqlLiteral).includes(value),\n\t\t\tlt: expr => value !== null && value < unwrapGraphqlLiteral(expr),\n\t\t\tlte: expr => value !== null && value <= unwrapGraphqlLiteral(expr),\n\t\t\tgt: expr => value !== null && value > unwrapGraphqlLiteral(expr),\n\t\t\tgte: expr => value !== null && value >= unwrapGraphqlLiteral(expr),\n\t\t\tcontains: expr => typeof value === 'string' && value.includes(unwrapGraphqlLiteral(expr)),\n\t\t\tstartsWith: expr => typeof value === 'string' && value.startsWith(unwrapGraphqlLiteral(expr)),\n\t\t\tendsWith: expr => typeof value === 'string' && value.endsWith(unwrapGraphqlLiteral(expr)),\n\t\t\tcontainsCI: expr => typeof value === 'string' && value.toLowerCase().includes(unwrapGraphqlLiteral(expr).toLowerCase()),\n\t\t\tstartsWithCI: expr => typeof value === 'string' && value.toLowerCase().startsWith(unwrapGraphqlLiteral(expr).toLowerCase()),\n\t\t\tendsWithCI: expr => typeof value === 'string' && value.toLowerCase().endsWith(unwrapGraphqlLiteral(expr).toLowerCase()),\n\t\t\tnever: () => false,\n\t\t\talways: () => true,\n\t\t\t// deprecated\n\t\t\tnull: expr => (value === null) === expr,\n\t\t}\n\t\treturn Object.entries(condition).every(([operator, argument]) => {\n\t\t\tif (value === undefined) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tconst handlerKey = operator as keyof typeof handlers\n\t\t\tconst handler = handlers[handlerKey]\n\t\t\tif (!handler) {\n\t\t\t\tthrow new BindingError()\n\t\t\t}\n\t\t\treturn handler(argument)\n\t\t})\n\t}\n"],"names":[],"mappings":";;AAIA,MAAM,uBAAuB,CAAC,UAAkD;AAC/E,MAAI,iBAAiB,gBAAgB;AACpC,WAAO,MAAM;AAAA,EACd;AACO,SAAA;AACR;AAEa,MAAA,oBAAoB,CAAC,OAA0B,cAAkE;AAC5H,QAAM,WAIF;AAAA,IACH,KAAK,UAAQ,KAAK,MAAM,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IAC1D,IAAI,UAAQ,KAAK,KAAK,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IACxD,KAAK,CAAA,SAAQ,CAAC,kBAAkB,OAAO,IAAI;AAAA,IAC3C,IAAI,CAAA,SAAQ,UAAU,qBAAqB,IAAI;AAAA,IAC/C,OAAO,CAAA,SAAQ,UAAU,qBAAqB,IAAI;AAAA,IAClD,QAAQ,CAAS,SAAA,UAAU,SAAU;AAAA,IACrC,IAAI,CAAQ,SAAA,KAAK,IAAI,oBAAoB,EAAE,SAAS,KAAK;AAAA,IACzD,OAAO,UAAQ,CAAC,KAAK,IAAI,oBAAoB,EAAE,SAAS,KAAK;AAAA,IAC7D,IAAI,CAAQ,SAAA,UAAU,QAAQ,QAAQ,qBAAqB,IAAI;AAAA,IAC/D,KAAK,CAAQ,SAAA,UAAU,QAAQ,SAAS,qBAAqB,IAAI;AAAA,IACjE,IAAI,CAAQ,SAAA,UAAU,QAAQ,QAAQ,qBAAqB,IAAI;AAAA,IAC/D,KAAK,CAAQ,SAAA,UAAU,QAAQ,SAAS,qBAAqB,IAAI;AAAA,IACjE,UAAU,UAAQ,OAAO,UAAU,YAAY,MAAM,SAAS,qBAAqB,IAAI,CAAC;AAAA,IACxF,YAAY,UAAQ,OAAO,UAAU,YAAY,MAAM,WAAW,qBAAqB,IAAI,CAAC;AAAA,IAC5F,UAAU,UAAQ,OAAO,UAAU,YAAY,MAAM,SAAS,qBAAqB,IAAI,CAAC;AAAA,IACxF,YAAY,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,YAAY,EAAE,SAAS,qBAAqB,IAAI,EAAE,aAAa;AAAA,IACtH,cAAc,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,YAAY,EAAE,WAAW,qBAAqB,IAAI,EAAE,aAAa;AAAA,IAC1H,YAAY,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,YAAY,EAAE,SAAS,qBAAqB,IAAI,EAAE,aAAa;AAAA,IACtH,OAAO,MAAM;AAAA,IACb,QAAQ,MAAM;AAAA;AAAA,IAEd,MAAM,CAAS,SAAA,UAAU,SAAU;AAAA,EAAA;AAE7B,SAAA,OAAO,QAAQ,SAAS,EAAE,MAAM,CAAC,CAAC,UAAU,QAAQ,MAAM;AAChE,QAAI,UAAU,QAAW;AACjB,aAAA;AAAA,IACR;AACA,UAAM,aAAa;AACb,UAAA,UAAU,SAAS,UAAU;AACnC,QAAI,CAAC,SAAS;AACb,YAAM,IAAI,aAAa;AAAA,IACxB;AACA,WAAO,QAAQ,QAAQ;AAAA,EAAA,CACvB;AACF;"}
1
+ {"version":3,"file":"evaluateCondition.js","sources":["../../../../src/helperComponents/helpers/evaluateCondition.ts"],"sourcesContent":["import { GraphQlLiteral, Input } from '@contember/client'\nimport { FieldValue } from '../../treeParameters'\nimport { BindingError } from '../../BindingError'\n\nconst unwrapGraphqlLiteral = (value: Input.ColumnValue<GraphQlLiteral>): any => {\n\tif (value instanceof GraphQlLiteral) {\n\t\treturn value.value\n\t}\n\treturn value\n}\n\nexport const evaluateCondition = (value: FieldValue | null, condition: Input.Condition<Input.ColumnValue<GraphQlLiteral>>) => {\n\t\tconst handlers: {\n\t\t\t[K in keyof Required<Input.Condition<any>>]: (\n\t\t\t\tparam: Exclude<Input.Condition<any>[K], undefined>,\n\t\t\t) => boolean\n\t\t} = {\n\t\t\tand: expr => expr.every(it => evaluateCondition(value, it)),\n\t\t\tor: expr => expr.some(it => evaluateCondition(value, it)),\n\t\t\tnot: expr => !evaluateCondition(value, expr),\n\t\t\teq: expr => value === unwrapGraphqlLiteral(expr),\n\t\t\tnotEq: expr => value !== unwrapGraphqlLiteral(expr),\n\t\t\tisNull: expr => (value === null) === expr,\n\t\t\tin: expr => expr.map(unwrapGraphqlLiteral).includes(value),\n\t\t\tnotIn: expr => !expr.map(unwrapGraphqlLiteral).includes(value),\n\t\t\tlt: expr => value !== null && value < unwrapGraphqlLiteral(expr),\n\t\t\tlte: expr => value !== null && value <= unwrapGraphqlLiteral(expr),\n\t\t\tgt: expr => value !== null && value > unwrapGraphqlLiteral(expr),\n\t\t\tgte: expr => value !== null && value >= unwrapGraphqlLiteral(expr),\n\t\t\tcontains: expr => typeof value === 'string' && value.includes(unwrapGraphqlLiteral(expr)),\n\t\t\tstartsWith: expr => typeof value === 'string' && value.startsWith(unwrapGraphqlLiteral(expr)),\n\t\t\tendsWith: expr => typeof value === 'string' && value.endsWith(unwrapGraphqlLiteral(expr)),\n\t\t\tcontainsCI: expr => typeof value === 'string' && value.toLowerCase().includes(unwrapGraphqlLiteral(expr).toLowerCase()),\n\t\t\tstartsWithCI: expr => typeof value === 'string' && value.toLowerCase().startsWith(unwrapGraphqlLiteral(expr).toLowerCase()),\n\t\t\tendsWithCI: expr => typeof value === 'string' && value.toLowerCase().endsWith(unwrapGraphqlLiteral(expr).toLowerCase()),\n\t\t\tnever: () => false,\n\t\t\talways: () => true,\n\t\t\t// deprecated\n\t\t\tnull: expr => (value === null) === expr,\n\t\t}\n\t\treturn Object.entries(condition).every(([operator, argument]) => {\n\t\t\tif (value === undefined) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tconst handlerKey = operator as keyof typeof handlers\n\t\t\tconst handler = handlers[handlerKey]\n\t\t\tif (!handler) {\n\t\t\t\tthrow new BindingError()\n\t\t\t}\n\t\t\treturn (handler as any)(argument)\n\t\t})\n\t}\n"],"names":[],"mappings":";;AAIA,MAAM,uBAAuB,CAAC,UAAkD;AAC/E,MAAI,iBAAiB,gBAAgB;AACpC,WAAO,MAAM;AAAA,EACd;AACO,SAAA;AACR;AAEa,MAAA,oBAAoB,CAAC,OAA0B,cAAkE;AAC5H,QAAM,WAIF;AAAA,IACH,KAAK,UAAQ,KAAK,MAAM,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IAC1D,IAAI,UAAQ,KAAK,KAAK,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IACxD,KAAK,CAAA,SAAQ,CAAC,kBAAkB,OAAO,IAAI;AAAA,IAC3C,IAAI,CAAA,SAAQ,UAAU,qBAAqB,IAAI;AAAA,IAC/C,OAAO,CAAA,SAAQ,UAAU,qBAAqB,IAAI;AAAA,IAClD,QAAQ,CAAS,SAAA,UAAU,SAAU;AAAA,IACrC,IAAI,CAAQ,SAAA,KAAK,IAAI,oBAAoB,EAAE,SAAS,KAAK;AAAA,IACzD,OAAO,UAAQ,CAAC,KAAK,IAAI,oBAAoB,EAAE,SAAS,KAAK;AAAA,IAC7D,IAAI,CAAQ,SAAA,UAAU,QAAQ,QAAQ,qBAAqB,IAAI;AAAA,IAC/D,KAAK,CAAQ,SAAA,UAAU,QAAQ,SAAS,qBAAqB,IAAI;AAAA,IACjE,IAAI,CAAQ,SAAA,UAAU,QAAQ,QAAQ,qBAAqB,IAAI;AAAA,IAC/D,KAAK,CAAQ,SAAA,UAAU,QAAQ,SAAS,qBAAqB,IAAI;AAAA,IACjE,UAAU,UAAQ,OAAO,UAAU,YAAY,MAAM,SAAS,qBAAqB,IAAI,CAAC;AAAA,IACxF,YAAY,UAAQ,OAAO,UAAU,YAAY,MAAM,WAAW,qBAAqB,IAAI,CAAC;AAAA,IAC5F,UAAU,UAAQ,OAAO,UAAU,YAAY,MAAM,SAAS,qBAAqB,IAAI,CAAC;AAAA,IACxF,YAAY,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,YAAY,EAAE,SAAS,qBAAqB,IAAI,EAAE,aAAa;AAAA,IACtH,cAAc,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,YAAY,EAAE,WAAW,qBAAqB,IAAI,EAAE,aAAa;AAAA,IAC1H,YAAY,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,YAAY,EAAE,SAAS,qBAAqB,IAAI,EAAE,aAAa;AAAA,IACtH,OAAO,MAAM;AAAA,IACb,QAAQ,MAAM;AAAA;AAAA,IAEd,MAAM,CAAS,SAAA,UAAU,SAAU;AAAA,EAAA;AAE7B,SAAA,OAAO,QAAQ,SAAS,EAAE,MAAM,CAAC,CAAC,UAAU,QAAQ,MAAM;AAChE,QAAI,UAAU,QAAW;AACjB,aAAA;AAAA,IACR;AACA,UAAM,aAAa;AACb,UAAA,UAAU,SAAS,UAAU;AACnC,QAAI,CAAC,SAAS;AACb,YAAM,IAAI,aAAa;AAAA,IACxB;AACA,WAAQ,QAAgB,QAAQ;AAAA,EAAA,CAChC;AACF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LeafField.js","sources":["../../../src/treeParameters/LeafField.ts"],"sourcesContent":["import type { FieldEventListeners, UnsugarableFieldEventListeners } from './FieldEventListeners'\nimport type { FieldValue, OptionallyVariableFieldValue } from './primitives'\n\n// These are specific to leaf fields. Common but required parameters are in AnyField.\n\nexport const LeafFieldDefaults = {\n\tisNonbearing: false,\n} as const\n\nexport interface LeafField extends FieldEventListeners {\n\tisNonbearing: boolean\n\tdefaultValue: FieldValue | undefined\n}\n\nexport interface UnsugarableLeafField extends UnsugarableFieldEventListeners {\n\tisNonbearing?: boolean\n\tdefaultValue?: OptionallyVariableFieldValue\n}\n"],"names":[],"mappings":"AAKO,MAAM,oBAAoB;AAAA,EAChC,cAAc;AACf;"}
1
+ {"version":3,"file":"LeafField.js","sources":["../../../src/treeParameters/LeafField.ts"],"sourcesContent":["import type { FieldEventListeners, UnsugarableFieldEventListeners } from './FieldEventListeners'\nimport type { FieldValue, OptionallyVariableFieldValue } from './primitives'\n\n// These are specific to leaf fields. Common but required parameters are in AnyField.\n\nexport const LeafFieldDefaults = {\n\tisNonbearing: false,\n} as const\n\nexport interface LeafField extends FieldEventListeners {\n\tisNonbearing: boolean\n\tdefaultValue: FieldValue | undefined\n}\n\nexport type UnsugarableLeafField =\n\t& UnsugarableFieldEventListeners\n\t& {\n\t\tisNonbearing?: boolean\n\t\tdefaultValue?: OptionallyVariableFieldValue\n\t}\n"],"names":[],"mappings":"AAKO,MAAM,oBAAoB;AAAA,EAChC,cAAc;AACf;"}
@@ -4,14 +4,14 @@ import { DirtinessContext } from "./DirtinessContext.js";
4
4
  import { MutationStateContext } from "./MutationStateContext.js";
5
5
  import { EnvironmentContext } from "../accessorPropagation/EnvironmentContext.js";
6
6
  import { BindingOperationsProvider } from "../accessorPropagation/BindingOperationsProvider.js";
7
- function AccessorTree({ state, children }) {
7
+ const AccessorTree = ({ state, children }) => {
8
8
  const stateData = state.name === "initialized" ? state.data : {
9
9
  hasUnpersistedChanges: false,
10
10
  isMutating: false,
11
11
  bindingOperations: void 0
12
12
  };
13
13
  return /* @__PURE__ */ jsx(EnvironmentContext.Provider, { value: state.environment, children: /* @__PURE__ */ jsx(AccessorTreeStateContext.Provider, { value: state, children: /* @__PURE__ */ jsx(DirtinessContext.Provider, { value: stateData.hasUnpersistedChanges, children: /* @__PURE__ */ jsx(MutationStateContext.Provider, { value: stateData.isMutating, children: /* @__PURE__ */ jsx(BindingOperationsProvider, { bindingOperations: stateData.bindingOperations, children }) }) }) }) });
14
- }
14
+ };
15
15
  AccessorTree.displayName = "AccessorTree";
16
16
  export {
17
17
  AccessorTree
@@ -1 +1 @@
1
- {"version":3,"file":"AccessorTree.js","sources":["../../../src/accessorTree/AccessorTree.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { BindingOperationsProvider, EnvironmentContext } from '../accessorPropagation'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport { AccessorTreeStateContext } from './AccessorTreeStateContext'\nimport { DirtinessContext } from './DirtinessContext'\nimport { MutationStateContext } from './MutationStateContext'\n\nexport interface AccessorTreeProps {\n\tstate: AccessorTreeState\n\tchildren: ReactNode\n}\n\nexport function AccessorTree({ state, children }: AccessorTreeProps) {\n\tconst stateData = state.name === 'initialized' ? state.data : {\n\t\thasUnpersistedChanges: false,\n\t\tisMutating: false,\n\t\tbindingOperations: undefined,\n\t}\n\treturn (\n\t\t<EnvironmentContext.Provider value={state.environment}>\n\t\t\t<AccessorTreeStateContext.Provider value={state}>\n\t\t\t\t<DirtinessContext.Provider value={stateData.hasUnpersistedChanges}>\n\t\t\t\t\t<MutationStateContext.Provider value={stateData.isMutating}>\n\t\t\t\t\t\t<BindingOperationsProvider bindingOperations={stateData.bindingOperations}>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</BindingOperationsProvider>\n\t\t\t\t\t</MutationStateContext.Provider>\n\t\t\t\t</DirtinessContext.Provider>\n\t\t\t</AccessorTreeStateContext.Provider>\n\t\t</EnvironmentContext.Provider>\n\t)\n}\n\nAccessorTree.displayName = 'AccessorTree'\n"],"names":[],"mappings":";;;;;;AAYO,SAAS,aAAa,EAAE,OAAO,YAA+B;AACpE,QAAM,YAAY,MAAM,SAAS,gBAAgB,MAAM,OAAO;AAAA,IAC7D,uBAAuB;AAAA,IACvB,YAAY;AAAA,IACZ,mBAAmB;AAAA,EAAA;AAEpB,6BACE,mBAAmB,UAAnB,EAA4B,OAAO,MAAM,aACzC,UAAA,oBAAC,yBAAyB,UAAzB,EAAkC,OAAO,OACzC,UAAC,oBAAA,iBAAiB,UAAjB,EAA0B,OAAO,UAAU,uBAC3C,8BAAC,qBAAqB,UAArB,EAA8B,OAAO,UAAU,YAC/C,UAAA,oBAAC,2BAA0B,EAAA,mBAAmB,UAAU,mBACtD,SAAA,CACF,EACD,CAAA,EACD,CAAA,GACD,EACD,CAAA;AAEF;AAEA,aAAa,cAAc;"}
1
+ {"version":3,"file":"AccessorTree.js","sources":["../../../src/accessorTree/AccessorTree.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { BindingOperationsProvider, EnvironmentContext } from '../accessorPropagation'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport { AccessorTreeStateContext } from './AccessorTreeStateContext'\nimport { DirtinessContext } from './DirtinessContext'\nimport { MutationStateContext } from './MutationStateContext'\n\nexport interface AccessorTreeProps {\n\tstate: AccessorTreeState\n\tchildren: ReactNode\n}\n\n/**\n * @group Data binding\n */\nexport const AccessorTree = ({ state, children }: AccessorTreeProps) => {\n\tconst stateData = state.name === 'initialized' ? state.data : {\n\t\thasUnpersistedChanges: false,\n\t\tisMutating: false,\n\t\tbindingOperations: undefined,\n\t}\n\treturn (\n\t\t<EnvironmentContext.Provider value={state.environment}>\n\t\t\t<AccessorTreeStateContext.Provider value={state}>\n\t\t\t\t<DirtinessContext.Provider value={stateData.hasUnpersistedChanges}>\n\t\t\t\t\t<MutationStateContext.Provider value={stateData.isMutating}>\n\t\t\t\t\t\t<BindingOperationsProvider bindingOperations={stateData.bindingOperations}>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</BindingOperationsProvider>\n\t\t\t\t\t</MutationStateContext.Provider>\n\t\t\t\t</DirtinessContext.Provider>\n\t\t\t</AccessorTreeStateContext.Provider>\n\t\t</EnvironmentContext.Provider>\n\t)\n}\n\nAccessorTree.displayName = 'AccessorTree'\n"],"names":[],"mappings":";;;;;;AAeO,MAAM,eAAe,CAAC,EAAE,OAAO,eAAkC;AACvE,QAAM,YAAY,MAAM,SAAS,gBAAgB,MAAM,OAAO;AAAA,IAC7D,uBAAuB;AAAA,IACvB,YAAY;AAAA,IACZ,mBAAmB;AAAA,EAAA;AAEpB,6BACE,mBAAmB,UAAnB,EAA4B,OAAO,MAAM,aACzC,UAAA,oBAAC,yBAAyB,UAAzB,EAAkC,OAAO,OACzC,UAAC,oBAAA,iBAAiB,UAAjB,EAA0B,OAAO,UAAU,uBAC3C,8BAAC,qBAAqB,UAArB,EAA8B,OAAO,UAAU,YAC/C,UAAA,oBAAC,2BAA0B,EAAA,mBAAmB,UAAU,mBACtD,SAAA,CACF,EACD,CAAA,EACD,CAAA,GACD,EACD,CAAA;AAEF;AAEA,aAAa,cAAc;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DataBindingProvider.js","sources":["../../../src/coreComponents/DataBindingProvider.tsx"],"sourcesContent":["import { ComponentType, createElement, memo, ReactElement, ReactNode } from 'react'\nimport { AccessorTree, AccessorTreeState, AccessorTreeStateOptions, useDataBinding } from '../accessorTree'\n\nexport type DataBindingProviderBaseProps =\n\t& AccessorTreeStateOptions\n\nexport interface DataBindingStateComponentProps {\n\taccessorTreeState: AccessorTreeState\n\tchildren?: ReactNode\n}\n\nexport type DataBindingProviderProps<StateProps> = DataBindingProviderBaseProps &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tstateComponent: ComponentType<StateProps & DataBindingStateComponentProps>\n\t\t\t\tstateProps?: StateProps\n\t\t }\n\t)\n\nexport const DataBindingProvider = memo(function DataBindingProvider<StateProps extends DataBindingStateComponentProps>(\n\tprops: DataBindingProviderProps<StateProps>,\n) {\n\tconst accessorTreeState = useDataBinding(props)\n\n\tconst children =\n\t\t'stateComponent' in props && props.stateComponent\n\t\t\t? createElement(\n\t\t\t\t\tprops.stateComponent,\n\t\t\t\t\t{\n\t\t\t\t\t\t...props.stateProps!,\n\t\t\t\t\t\taccessorTreeState: accessorTreeState,\n\t\t\t\t\t},\n\t\t\t\t\tprops.children,\n\t\t\t )\n\t\t\t: props.children\n\treturn <AccessorTree state={accessorTreeState}>{children}</AccessorTree>\n}) as <StateProps>(props: DataBindingProviderProps<StateProps>) => ReactElement\n"],"names":["DataBindingProvider"],"mappings":";;;;AAoBO,MAAM,sBAAsB,KAAK,SAASA,qBAChD,OACC;AACK,QAAA,oBAAoB,eAAe,KAAK;AAE9C,QAAM,WACL,oBAAoB,SAAS,MAAM,iBAChC;AAAA,IACA,MAAM;AAAA,IACN;AAAA,MACC,GAAG,MAAM;AAAA,MACT;AAAA,IACD;AAAA,IACA,MAAM;AAAA,EAAA,IAEN,MAAM;AACV,SAAQ,oBAAA,cAAA,EAAa,OAAO,mBAAoB,SAAS,CAAA;AAC1D,CAAC;"}
1
+ {"version":3,"file":"DataBindingProvider.js","sources":["../../../src/coreComponents/DataBindingProvider.tsx"],"sourcesContent":["import { ComponentType, createElement, memo, ReactElement, ReactNode } from 'react'\nimport { AccessorTree, AccessorTreeState, AccessorTreeStateOptions, useDataBinding } from '../accessorTree'\n\nexport type DataBindingProviderBaseProps =\n\t& AccessorTreeStateOptions\n\nexport interface DataBindingStateComponentProps {\n\taccessorTreeState: AccessorTreeState\n\tchildren?: ReactNode\n}\n\nexport type DataBindingProviderProps<StateProps> = DataBindingProviderBaseProps &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tstateComponent: ComponentType<StateProps & DataBindingStateComponentProps>\n\t\t\t\tstateProps?: StateProps\n\t\t }\n\t)\n\n/**\n * The `DataBindingProvider` is a root component for all other data binding related components.\n *\n * @example\n * ```\n * <DataBindingProvider stateComponent={FeedbackRenderer} />\n * ```\n *\n * @group Data binding\n */\nexport const DataBindingProvider = memo(function DataBindingProvider<StateProps extends DataBindingStateComponentProps>(\n\tprops: DataBindingProviderProps<StateProps>,\n) {\n\tconst accessorTreeState = useDataBinding(props)\n\n\tconst children =\n\t\t'stateComponent' in props && props.stateComponent\n\t\t\t? createElement(\n\t\t\t\t\tprops.stateComponent,\n\t\t\t\t\t{\n\t\t\t\t\t\t...props.stateProps!,\n\t\t\t\t\t\taccessorTreeState: accessorTreeState,\n\t\t\t\t\t},\n\t\t\t\t\tprops.children,\n\t\t\t )\n\t\t\t: props.children\n\treturn <AccessorTree state={accessorTreeState}>{children}</AccessorTree>\n}) as <StateProps>(props: DataBindingProviderProps<StateProps>) => ReactElement\n"],"names":["DataBindingProvider"],"mappings":";;;;AA8BO,MAAM,sBAAsB,KAAK,SAASA,qBAChD,OACC;AACK,QAAA,oBAAoB,eAAe,KAAK;AAE9C,QAAM,WACL,oBAAoB,SAAS,MAAM,iBAChC;AAAA,IACA,MAAM;AAAA,IACN;AAAA,MACC,GAAG,MAAM;AAAA,MACT;AAAA,IACD;AAAA,IACA,MAAM;AAAA,EAAA,IAEN,MAAM;AACV,SAAQ,oBAAA,cAAA,EAAa,OAAO,mBAAoB,SAAS,CAAA;AAC1D,CAAC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Entity.js","sources":["../../../src/coreComponents/Entity.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { AccessorProvider } from '../accessorPropagation'\nimport type { EntityAccessor } from '../accessors'\nimport { Component } from './Component'\n\nexport interface EntityBaseProps {\n\taccessor: EntityAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityProps = EntityBaseProps\n\nexport const Entity = Component(\n\t({ children, accessor }: EntityProps) => {\n\treturn (\n\t\t// HACK: the ?. is actually important, despite the typings.\n\t\t<AccessorProvider accessor={accessor} key={accessor?.key}>\n\t\t\t{children}\n\t\t</AccessorProvider>\n\t)\n\t},\n\t'Entity',\n)\n"],"names":[],"mappings":";;;AAYO,MAAM,SAAS;AAAA,EACrB,CAAC,EAAE,UAAU,eAA4B;AACzC;AAAA;AAAA,MAEE,oBAAA,kBAAA,EAAiB,UAChB,SAAA,GADyC,UAAU,GAErD;AAAA;AAAA,EAED;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"Entity.js","sources":["../../../src/coreComponents/Entity.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { AccessorProvider } from '../accessorPropagation'\nimport type { EntityAccessor } from '../accessors'\nimport { Component } from './Component'\n\nexport interface EntityBaseProps {\n\taccessor: EntityAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityProps = EntityBaseProps\n\n/**\n * @group Data binding\n */\nexport const Entity = Component(\n\t({ children, accessor }: EntityProps) => {\n\treturn (\n\t\t// HACK: the ?. is actually important, despite the typings.\n\t\t<AccessorProvider accessor={accessor} key={accessor?.key}>\n\t\t\t{children}\n\t\t</AccessorProvider>\n\t)\n\t},\n\t'Entity',\n)\n"],"names":[],"mappings":";;;AAeO,MAAM,SAAS;AAAA,EACrB,CAAC,EAAE,UAAU,eAA4B;AACzC;AAAA;AAAA,MAEE,oBAAA,kBAAA,EAAiB,UAChB,SAAA,GADyC,UAAU,GAErD;AAAA;AAAA,EAED;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityList.js","sources":["../../../src/coreComponents/EntityList.tsx"],"sourcesContent":["import { ComponentType, createElement, ReactElement, ReactNode } from 'react'\nimport type { EntityListAccessor } from '../accessors'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\n\nexport interface EntityListBaseProps {\n\taccessor: EntityListAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityListProps<ListProps> = EntityListBaseProps &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\nexport const EntityList = Component(\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: props.accessor,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{Array.from(props.accessor, entity => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Entity key={entity.key} accessor={entity}>\n\t\t\t\t\t\t\t{props.children}\n\t\t\t\t\t\t</Entity>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</>\n\t\t)\n\t},\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: undefined as any,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn <>{props.children}</>\n\t},\n\t'EntityList',\n) as <ListProps>(props: EntityListProps<ListProps>) => ReactElement\n"],"names":[],"mappings":";;;;AAmBO,MAAM,aAAa;AAAA,EACzB,CAAuB,UAAsC;AACxD,QAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,aAAA,cAAc,MAAM,eAAe;AAAA,QACzC,GAAG,MAAM;AAAA,QACT,UAAU,MAAM;AAAA,QAChB,UAAU,MAAM;AAAA,MAAA,CAChB;AAAA,IACF;AACA,WAEG,oBAAA,UAAA,EAAA,UAAA,MAAM,KAAK,MAAM,UAAU,CAAU,WAAA;AACrC,iCACE,QAAwB,EAAA,UAAU,QACjC,UAAM,MAAA,SAAA,GADK,OAAO,GAEpB;AAAA,IAED,CAAA,EACF,CAAA;AAAA,EAEF;AAAA,EACA,CAAuB,UAAsC;AACxD,QAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,aAAA,cAAc,MAAM,eAAe;AAAA,QACzC,GAAG,MAAM;AAAA,QACT,UAAU;AAAA,QACV,UAAU,MAAM;AAAA,MAAA,CAChB;AAAA,IACF;AACO,WAAA,oBAAA,UAAA,EAAG,gBAAM,SAAS,CAAA;AAAA,EAC1B;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"EntityList.js","sources":["../../../src/coreComponents/EntityList.tsx"],"sourcesContent":["import { ComponentType, createElement, ReactElement, ReactNode } from 'react'\nimport type { EntityListAccessor } from '../accessors'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\n\nexport interface EntityListBaseProps {\n\taccessor: EntityListAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityListProps<ListProps> = EntityListBaseProps &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\n/**\n * @group Data binding\n */\nexport const EntityList = Component(\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: props.accessor,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{Array.from(props.accessor, entity => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Entity key={entity.key} accessor={entity}>\n\t\t\t\t\t\t\t{props.children}\n\t\t\t\t\t\t</Entity>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</>\n\t\t)\n\t},\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: undefined as any,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn <>{props.children}</>\n\t},\n\t'EntityList',\n) as <ListProps>(props: EntityListProps<ListProps>) => ReactElement\n"],"names":[],"mappings":";;;;AAsBO,MAAM,aAAa;AAAA,EACzB,CAAuB,UAAsC;AACxD,QAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,aAAA,cAAc,MAAM,eAAe;AAAA,QACzC,GAAG,MAAM;AAAA,QACT,UAAU,MAAM;AAAA,QAChB,UAAU,MAAM;AAAA,MAAA,CAChB;AAAA,IACF;AACA,WAEG,oBAAA,UAAA,EAAA,UAAA,MAAM,KAAK,MAAM,UAAU,CAAU,WAAA;AACrC,iCACE,QAAwB,EAAA,UAAU,QACjC,UAAM,MAAA,SAAA,GADK,OAAO,GAEpB;AAAA,IAED,CAAA,EACF,CAAA;AAAA,EAEF;AAAA,EACA,CAAuB,UAAsC;AACxD,QAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,aAAA,cAAc,MAAM,eAAe;AAAA,QACzC,GAAG,MAAM;AAAA,QACT,UAAU;AAAA,QACV,UAAU,MAAM;AAAA,MAAA,CAChB;AAAA,IACF;AACO,WAAA,oBAAA,UAAA,EAAG,gBAAM,SAAS,CAAA;AAAA,EAC1B;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityListSubTree.js","sources":["../../../src/coreComponents/EntityListSubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ComponentType, ReactElement, ReactNode, useCallback } from 'react'\nimport {\n\tuseAccessorUpdateSubscription,\n\tuseEntityListSubTreeParameters,\n\tuseGetEntityListSubTree,\n} from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList, TreeRootId } from '../treeParameters'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface EntityListSubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntityListSubTreeProps<ListProps, EntityProps> = {\n\ttreeRootId?: TreeRootId\n\tchildren?: ReactNode\n} & EntityListSubTreeAdditionalProps &\n\t(SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList) &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\nexport const EntityListSubTree = Component(\n\t<ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntityListSubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntityListSubTree()\n\t\tconst parameters = useEntityListSubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ?\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne\n\t\t// ) :\n\t\t// \tprops.children\n\t\t// )\n\t\treturn <EntityList {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntityListSubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntityListSubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<EntityList {...props} accessor={0 as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</EntityList>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntityListSubtree(environment, props)\n\t\t},\n\t},\n\t'EntityListSubTree',\n) as <ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;;;;;AAiCO,MAAM,oBAAoB;AAAA,EAChC,CAAyB,UAA0D;AACxD,8BAAA,MAAM,YAAY,6CAA6C;AAEzF,UAAM,aAAa;AACb,UAAA,aAAa,+BAA+B,KAAK;AACvD,UAAM,cAAc;AAAA,MACnB,MAAM,WAAW,YAAY,MAAM,UAAU;AAAA,MAC7C,CAAC,YAAY,YAAY,MAAM,UAAU;AAAA,IAAA;AAEpC,UAAA,WAAW,8BAA8B,WAAW;AAQ1D,WAAQ,oBAAA,YAAA,EAAY,GAAG,OAAO,SAAoB,CAAA;AAAA,EACnD;AAAA,EACA;AAAA,IACC,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACjD,UAAA,gBAAgB,SAAS,MAAM,YAAY;AAC9C,eAAO,cAAc,2CAA2C,OAAO,QAAQ,WAAW;AAAA,MAC3F;AACA,aAAO,cAAc,8BAA8B,OAAO,QAAQ,WAAW;AAAA,IAC9E;AAAA,IACA,cAAc,CACb,UAAA,qBAAC,cAAY,GAAG,OAAO,UAAU,GAChC,UAAA;AAAA,MAAC,oBAAA,OAAA,EAAM,OAAO,iBAAkB,CAAA;AAAA,MAC/B,MAAM;AAAA,IAAA,GACR;AAAA,IAED,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,sCAAsC,aAAa,KAAK;AAAA,IAC3F;AAAA,EACD;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"EntityListSubTree.js","sources":["../../../src/coreComponents/EntityListSubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ComponentType, ReactElement, ReactNode, useCallback } from 'react'\nimport {\n\tuseAccessorUpdateSubscription,\n\tuseEntityListSubTreeParameters,\n\tuseGetEntityListSubTree,\n} from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList, TreeRootId } from '../treeParameters'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface EntityListSubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntityListSubTreeProps<ListProps, EntityProps> = {\n\ttreeRootId?: TreeRootId\n\tchildren?: ReactNode\n} & EntityListSubTreeAdditionalProps &\n\t(SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList) &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\n/**\n * Creates a subtree with list of entities in current data binding context.\n *\n * @example\n * ```\n * <EntityListSubTree entities=\"Post\" />\n * ```\n *\n * @group Data binding\n */\nexport const EntityListSubTree = Component(\n\t<ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntityListSubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntityListSubTree()\n\t\tconst parameters = useEntityListSubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ?\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne\n\t\t// ) :\n\t\t// \tprops.children\n\t\t// )\n\t\treturn <EntityList {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntityListSubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntityListSubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<EntityList {...props} accessor={0 as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</EntityList>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntityListSubtree(environment, props)\n\t\t},\n\t},\n\t'EntityListSubTree',\n) as <ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;;;;;AA2CO,MAAM,oBAAoB;AAAA,EAChC,CAAyB,UAA0D;AACxD,8BAAA,MAAM,YAAY,6CAA6C;AAEzF,UAAM,aAAa;AACb,UAAA,aAAa,+BAA+B,KAAK;AACvD,UAAM,cAAc;AAAA,MACnB,MAAM,WAAW,YAAY,MAAM,UAAU;AAAA,MAC7C,CAAC,YAAY,YAAY,MAAM,UAAU;AAAA,IAAA;AAEpC,UAAA,WAAW,8BAA8B,WAAW;AAQ1D,WAAQ,oBAAA,YAAA,EAAY,GAAG,OAAO,SAAoB,CAAA;AAAA,EACnD;AAAA,EACA;AAAA,IACC,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACjD,UAAA,gBAAgB,SAAS,MAAM,YAAY;AAC9C,eAAO,cAAc,2CAA2C,OAAO,QAAQ,WAAW;AAAA,MAC3F;AACA,aAAO,cAAc,8BAA8B,OAAO,QAAQ,WAAW;AAAA,IAC9E;AAAA,IACA,cAAc,CACb,UAAA,qBAAC,cAAY,GAAG,OAAO,UAAU,GAChC,UAAA;AAAA,MAAC,oBAAA,OAAA,EAAM,OAAO,iBAAkB,CAAA;AAAA,MAC/B,MAAM;AAAA,IAAA,GACR;AAAA,IAED,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,sCAAsC,aAAa,KAAK;AAAA,IAC3F;AAAA,EACD;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntitySubTree.js","sources":["../../../src/coreComponents/EntitySubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode, useCallback } from 'react'\nimport { useAccessorUpdateSubscription, useEntitySubTreeParameters, useGetEntitySubTree } from '../accessorPropagation'\nimport { SetOrderFieldOnCreate, SetOrderFieldOnCreateOwnProps } from '../accessorSorting'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type {\n\tSugaredQualifiedSingleEntity,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tTreeRootId,\n} from '../treeParameters'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface EntitySubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntitySubTreeAdditionalCreationProps = {} | SetOrderFieldOnCreateOwnProps\n\nexport type EntitySubTreeProps<EntityProps> =\n\t& {\n\t\ttreeRootId?: TreeRootId\n\t\tchildren?: ReactNode\n\t}\n\t& EntitySubTreeAdditionalProps\n\t& (\n\t\t| SugaredQualifiedSingleEntity\n\t\t| (SugaredUnconstrainedQualifiedSingleEntity & EntitySubTreeAdditionalCreationProps)\n\t)\n\nexport const EntitySubTree = Component(\n\t<EntityProps extends {}>(props: EntitySubTreeProps<EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntitySubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntitySubTree()\n\t\tconst parameters = useEntitySubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top-level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ? (\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne>\n\t\t// ) : (\n\t\t// \tprops.children\n\t\t// )}\n\t\treturn <Entity {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntitySubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntitySubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<>\n\t\t\t\t<Entity {...props} accessor={0 as any}>\n\t\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t\t{props.children}\n\t\t\t\t</Entity>\n\t\t\t\t{props.isCreating && 'orderField' in props && (\n\t\t\t\t\t<SetOrderFieldOnCreate\n\t\t\t\t\t\torderField={props.orderField}\n\t\t\t\t\t\tnewOrderFieldValue={props.newOrderFieldValue}\n\t\t\t\t\t\tentity={props.entity}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntitySubtree(environment, props)\n\t\t},\n\t},\n\t'EntitySubTree',\n) as <EntityProps>(pros: EntitySubTreeProps<EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;;;;;;AAkCO,MAAM,gBAAgB;AAAA,EAC5B,CAAyB,UAA2C;AACzC,8BAAA,MAAM,YAAY,yCAAyC;AAErF,UAAM,aAAa;AACb,UAAA,aAAa,2BAA2B,KAAK;AACnD,UAAM,cAAc;AAAA,MACnB,MAAM,WAAW,YAAY,MAAM,UAAU;AAAA,MAC7C,CAAC,YAAY,YAAY,MAAM,UAAU;AAAA,IAAA;AAEpC,UAAA,WAAW,8BAA8B,WAAW;AAQ1D,WAAQ,oBAAA,QAAA,EAAQ,GAAG,OAAO,SAAoB,CAAA;AAAA,EAC/C;AAAA,EACA;AAAA,IACC,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACjD,UAAA,gBAAgB,SAAS,MAAM,YAAY;AAC9C,eAAO,cAAc,uCAAuC,OAAO,QAAQ,WAAW;AAAA,MACvF;AACA,aAAO,cAAc,0BAA0B,OAAO,QAAQ,WAAW;AAAA,IAC1E;AAAA,IACA,cAAc,WAEZ,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAA,qBAAC,QAAQ,EAAA,GAAG,OAAO,UAAU,GAC5B,UAAA;AAAA,QAAC,oBAAA,OAAA,EAAM,OAAO,iBAAkB,CAAA;AAAA,QAC/B,MAAM;AAAA,MAAA,GACR;AAAA,MACC,MAAM,cAAc,gBAAgB,SACpC;AAAA,QAAC;AAAA,QAAA;AAAA,UACA,YAAY,MAAM;AAAA,UAClB,oBAAoB,MAAM;AAAA,UAC1B,QAAQ,MAAM;AAAA,QAAA;AAAA,MACf;AAAA,IAAA,GAEF;AAAA,IAED,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,kCAAkC,aAAa,KAAK;AAAA,IACvF;AAAA,EACD;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"EntitySubTree.js","sources":["../../../src/coreComponents/EntitySubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode, useCallback } from 'react'\nimport { useAccessorUpdateSubscription, useEntitySubTreeParameters, useGetEntitySubTree } from '../accessorPropagation'\nimport { SetOrderFieldOnCreate, SetOrderFieldOnCreateOwnProps } from '../accessorSorting'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type {\n\tSugaredQualifiedSingleEntity,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tTreeRootId,\n} from '../treeParameters'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface EntitySubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntitySubTreeAdditionalCreationProps = {} | SetOrderFieldOnCreateOwnProps\n\nexport type EntitySubTreeProps<EntityProps> =\n\t& {\n\t\ttreeRootId?: TreeRootId\n\t\tchildren?: ReactNode\n\t}\n\t& EntitySubTreeAdditionalProps\n\t& (\n\t\t| SugaredQualifiedSingleEntity\n\t\t| (SugaredUnconstrainedQualifiedSingleEntity & EntitySubTreeAdditionalCreationProps)\n\t)\n\n/**\n * Creates a single entity subtree in current data binding context.\n *\n * @example\n * ```\n * <EntitySubTree entity=\"Post(id = $id)\" />\n * ```\n *\n * @group Data binding\n */\nexport const EntitySubTree = Component(\n\t<EntityProps extends {}>(props: EntitySubTreeProps<EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntitySubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntitySubTree()\n\t\tconst parameters = useEntitySubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top-level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ? (\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne>\n\t\t// ) : (\n\t\t// \tprops.children\n\t\t// )}\n\t\treturn <Entity {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntitySubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntitySubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<>\n\t\t\t\t<Entity {...props} accessor={0 as any}>\n\t\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t\t{props.children}\n\t\t\t\t</Entity>\n\t\t\t\t{props.isCreating && 'orderField' in props && (\n\t\t\t\t\t<SetOrderFieldOnCreate\n\t\t\t\t\t\torderField={props.orderField}\n\t\t\t\t\t\tnewOrderFieldValue={props.newOrderFieldValue}\n\t\t\t\t\t\tentity={props.entity}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntitySubtree(environment, props)\n\t\t},\n\t},\n\t'EntitySubTree',\n) as <EntityProps>(pros: EntitySubTreeProps<EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;;;;;;AA4CO,MAAM,gBAAgB;AAAA,EAC5B,CAAyB,UAA2C;AACzC,8BAAA,MAAM,YAAY,yCAAyC;AAErF,UAAM,aAAa;AACb,UAAA,aAAa,2BAA2B,KAAK;AACnD,UAAM,cAAc;AAAA,MACnB,MAAM,WAAW,YAAY,MAAM,UAAU;AAAA,MAC7C,CAAC,YAAY,YAAY,MAAM,UAAU;AAAA,IAAA;AAEpC,UAAA,WAAW,8BAA8B,WAAW;AAQ1D,WAAQ,oBAAA,QAAA,EAAQ,GAAG,OAAO,SAAoB,CAAA;AAAA,EAC/C;AAAA,EACA;AAAA,IACC,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACjD,UAAA,gBAAgB,SAAS,MAAM,YAAY;AAC9C,eAAO,cAAc,uCAAuC,OAAO,QAAQ,WAAW;AAAA,MACvF;AACA,aAAO,cAAc,0BAA0B,OAAO,QAAQ,WAAW;AAAA,IAC1E;AAAA,IACA,cAAc,WAEZ,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAA,qBAAC,QAAQ,EAAA,GAAG,OAAO,UAAU,GAC5B,UAAA;AAAA,QAAC,oBAAA,OAAA,EAAM,OAAO,iBAAkB,CAAA;AAAA,QAC/B,MAAM;AAAA,MAAA,GACR;AAAA,MACC,MAAM,cAAc,gBAAgB,SACpC;AAAA,QAAC;AAAA,QAAA;AAAA,UACA,YAAY,MAAM;AAAA,UAClB,oBAAoB,MAAM;AAAA,UAC1B,QAAQ,MAAM;AAAA,QAAA;AAAA,MACf;AAAA,IAAA,GAEF;AAAA,IAED,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,kCAAkC,aAAa,KAAK;AAAA,IACvF;AAAA,EACD;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","sources":["../../../src/coreComponents/Field.tsx"],"sourcesContent":["import { GraphQlBuilder } from '@contember/client'\nimport type { ReactElement, ReactNode } from 'react'\nimport { useField } from '../accessorPropagation'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { FieldValue, SugaredRelativeSingleField } from '../treeParameters'\nimport { Component } from './Component'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface FieldBasicProps extends SugaredRelativeSingleField {}\n\nexport interface FieldRuntimeProps<Persisted extends FieldValue = FieldValue> {\n\tformat?: (value: Persisted | null) => ReactNode\n}\n\nexport interface FieldProps<Persisted extends FieldValue = FieldValue>\n\textends FieldBasicProps,\n\t\tFieldRuntimeProps<Persisted> {}\n\nexport const Field = Component(\n\t<Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => {\n\t\tconst field = useField<Persisted>(props)\n\n\t\tif (props.format !== undefined) {\n\t\t\treturn <>{props.format(field.value)}</>\n\t\t}\n\n\t\tif (\n\t\t\tfield.value instanceof GraphQlBuilder.GraphQlLiteral ||\n\t\t\tfield.value === null ||\n\t\t\ttypeof field.value === 'boolean'\n\t\t) {\n\t\t\treturn null\n\t\t}\n\t\treturn <>{field.value}</>\n\t},\n\t{\n\t\tgenerateLeafMarker: (props, environment) => MarkerFactory.createFieldMarker(props, environment),\n\t\tgenerateEnvironment: (props, environment) => {\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForField(environment, props)\n\t\t},\n\t},\n\t'Field',\n) as <Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => ReactElement\n"],"names":[],"mappings":";;;;;;AAkBO,MAAM,QAAQ;AAAA,EACpB,CAA4C,UAAiC;AACtE,UAAA,QAAQ,SAAoB,KAAK;AAEnC,QAAA,MAAM,WAAW,QAAW;AAC/B,aAAU,oBAAA,UAAA,EAAA,UAAA,MAAM,OAAO,MAAM,KAAK,EAAE,CAAA;AAAA,IACrC;AAGC,QAAA,MAAM,iBAAiB,eAAe,kBACtC,MAAM,UAAU,QAChB,OAAO,MAAM,UAAU,WACtB;AACM,aAAA;AAAA,IACR;AACO,WAAA,oBAAA,UAAA,EAAG,gBAAM,MAAM,CAAA;AAAA,EACvB;AAAA,EACA;AAAA,IACC,oBAAoB,CAAC,OAAO,gBAAgB,cAAc,kBAAkB,OAAO,WAAW;AAAA,IAC9F,qBAAqB,CAAC,OAAO,gBAAgB;AACrC,aAAA,2BAA2B,0BAA0B,aAAa,KAAK;AAAA,IAC/E;AAAA,EACD;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"Field.js","sources":["../../../src/coreComponents/Field.tsx"],"sourcesContent":["import { GraphQlBuilder } from '@contember/client'\nimport type { ReactElement, ReactNode } from 'react'\nimport { useField } from '../accessorPropagation'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { FieldValue, SugaredRelativeSingleField } from '../treeParameters'\nimport { Component } from './Component'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface FieldBasicProps extends SugaredRelativeSingleField {}\n\nexport interface FieldRuntimeProps<Persisted extends FieldValue = FieldValue> {\n\tformat?: (value: Persisted | null) => ReactNode\n}\n\nexport interface FieldProps<Persisted extends FieldValue = FieldValue>\n\textends FieldBasicProps,\n\t\tFieldRuntimeProps<Persisted> {}\n\n/**\n * @group Data binding\n */\nexport const Field = Component(\n\t<Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => {\n\t\tconst field = useField<Persisted>(props)\n\n\t\tif (props.format !== undefined) {\n\t\t\treturn <>{props.format(field.value)}</>\n\t\t}\n\n\t\tif (\n\t\t\tfield.value instanceof GraphQlBuilder.GraphQlLiteral ||\n\t\t\tfield.value === null ||\n\t\t\ttypeof field.value === 'boolean'\n\t\t) {\n\t\t\treturn null\n\t\t}\n\t\treturn <>{field.value}</>\n\t},\n\t{\n\t\tgenerateLeafMarker: (props, environment) => MarkerFactory.createFieldMarker(props, environment),\n\t\tgenerateEnvironment: (props, environment) => {\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForField(environment, props)\n\t\t},\n\t},\n\t'Field',\n) as <Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => ReactElement\n"],"names":[],"mappings":";;;;;;AAqBO,MAAM,QAAQ;AAAA,EACpB,CAA4C,UAAiC;AACtE,UAAA,QAAQ,SAAoB,KAAK;AAEnC,QAAA,MAAM,WAAW,QAAW;AAC/B,aAAU,oBAAA,UAAA,EAAA,UAAA,MAAM,OAAO,MAAM,KAAK,EAAE,CAAA;AAAA,IACrC;AAGC,QAAA,MAAM,iBAAiB,eAAe,kBACtC,MAAM,UAAU,QAChB,OAAO,MAAM,UAAU,WACtB;AACM,aAAA;AAAA,IACR;AACO,WAAA,oBAAA,UAAA,EAAG,gBAAM,MAAM,CAAA;AAAA,EACvB;AAAA,EACA;AAAA,IACC,oBAAoB,CAAC,OAAO,gBAAgB,cAAc,kBAAkB,OAAO,WAAW;AAAA,IAC9F,qBAAqB,CAAC,OAAO,gBAAgB;AACrC,aAAA,2BAA2B,0BAA0B,aAAa,KAAK;AAAA,IAC/E;AAAA,EACD;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"HasMany.js","sources":["../../../src/coreComponents/HasMany.tsx"],"sourcesContent":["import type { ComponentType, ReactElement, ReactNode } from 'react'\nimport { useEntityList } from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredRelativeEntityList } from '../treeParameters'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport type HasManyProps<ListProps = never, EntityProps = never> = SugaredRelativeEntityList & {\n\tchildren?: ReactNode\n\tvariables?: Environment.ValuesMapWithFactory\n} & (\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\nexport const HasMany = Component(\n\t<ListProps, EntityProps>(props: HasManyProps<ListProps, EntityProps>) => {\n\t\tconst entityList = useEntityList(props)\n\n\t\treturn <EntityList {...props} accessor={entityList} />\n\t},\n\t{\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntityList(environment, props)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<EntityList {...props} accessor={undefined as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</EntityList>\n\t\t),\n\t\tgenerateBranchMarker: (props, fields, environment) =>\n\t\t\tMarkerFactory.createRelativeEntityListFields(props, environment, fields),\n\t},\n\t'HasMany',\n) as <ListProps, EntityProps>(props: HasManyProps<ListProps, EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;AAsBO,MAAM,UAAU;AAAA,EACtB,CAAyB,UAAgD;AAClE,UAAA,aAAa,cAAc,KAAK;AAEtC,WAAQ,oBAAA,YAAA,EAAY,GAAG,OAAO,UAAU,WAAY,CAAA;AAAA,EACrD;AAAA,EACA;AAAA,IACC,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,+BAA+B,aAAa,KAAK;AAAA,IACpF;AAAA,IACA,cAAc,CACb,UAAA,qBAAC,cAAY,GAAG,OAAO,UAAU,QAChC,UAAA;AAAA,MAAC,oBAAA,OAAA,EAAM,OAAO,iBAAkB,CAAA;AAAA,MAC/B,MAAM;AAAA,IAAA,GACR;AAAA,IAED,sBAAsB,CAAC,OAAO,QAAQ,gBACrC,cAAc,+BAA+B,OAAO,aAAa,MAAM;AAAA,EACzE;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"HasMany.js","sources":["../../../src/coreComponents/HasMany.tsx"],"sourcesContent":["import type { ComponentType, ReactElement, ReactNode } from 'react'\nimport { useEntityList } from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredRelativeEntityList } from '../treeParameters'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport type HasManyProps<ListProps = never, EntityProps = never> = SugaredRelativeEntityList & {\n\tchildren?: ReactNode\n\tvariables?: Environment.ValuesMapWithFactory\n} & (\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\n/**\n * @group Data binding\n */\nexport const HasMany = Component(\n\t<ListProps, EntityProps>(props: HasManyProps<ListProps, EntityProps>) => {\n\t\tconst entityList = useEntityList(props)\n\n\t\treturn <EntityList {...props} accessor={entityList} />\n\t},\n\t{\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntityList(environment, props)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<EntityList {...props} accessor={undefined as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</EntityList>\n\t\t),\n\t\tgenerateBranchMarker: (props, fields, environment) =>\n\t\t\tMarkerFactory.createRelativeEntityListFields(props, environment, fields),\n\t},\n\t'HasMany',\n) as <ListProps, EntityProps>(props: HasManyProps<ListProps, EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;AAyBO,MAAM,UAAU;AAAA,EACtB,CAAyB,UAAgD;AAClE,UAAA,aAAa,cAAc,KAAK;AAEtC,WAAQ,oBAAA,YAAA,EAAY,GAAG,OAAO,UAAU,WAAY,CAAA;AAAA,EACrD;AAAA,EACA;AAAA,IACC,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,+BAA+B,aAAa,KAAK;AAAA,IACpF;AAAA,IACA,cAAc,CACb,UAAA,qBAAC,cAAY,GAAG,OAAO,UAAU,QAChC,UAAA;AAAA,MAAC,oBAAA,OAAA,EAAM,OAAO,iBAAkB,CAAA;AAAA,MAC/B,MAAM;AAAA,IAAA,GACR;AAAA,IAED,sBAAsB,CAAC,OAAO,QAAQ,gBACrC,cAAc,+BAA+B,OAAO,aAAa,MAAM;AAAA,EACzE;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"HasOne.js","sources":["../../../src/coreComponents/HasOne.tsx"],"sourcesContent":["import type { ReactElement, ReactNode } from 'react'\nimport { useEntity } from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredRelativeSingleEntity } from '../treeParameters'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport type HasOneProps<EntityProps = never> = SugaredRelativeSingleEntity & {\n\tchildren?: ReactNode\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport const HasOne = Component(\n\t<EntityProps extends {}>(props: HasOneProps<EntityProps>) => {\n\t\tconst entity = useEntity(props)\n\n\t\treturn <Entity {...props} accessor={entity} />\n\t},\n\t{\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntity(environment, props)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<Entity {...props} accessor={undefined as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</Entity>\n\t\t),\n\t\tgenerateBranchMarker: (props, fields, environment) =>\n\t\t\tMarkerFactory.createRelativeSingleEntityFields(props, environment, fields),\n\t},\n\t'HasOne',\n) as <EntityProps extends {}>(props: HasOneProps<EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;AAgBO,MAAM,SAAS;AAAA,EACrB,CAAyB,UAAoC;AACtD,UAAA,SAAS,UAAU,KAAK;AAE9B,WAAQ,oBAAA,QAAA,EAAQ,GAAG,OAAO,UAAU,OAAQ,CAAA;AAAA,EAC7C;AAAA,EACA;AAAA,IACC,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,2BAA2B,aAAa,KAAK;AAAA,IAChF;AAAA,IACA,cAAc,CACb,UAAA,qBAAC,UAAQ,GAAG,OAAO,UAAU,QAC5B,UAAA;AAAA,MAAC,oBAAA,OAAA,EAAM,OAAO,iBAAkB,CAAA;AAAA,MAC/B,MAAM;AAAA,IAAA,GACR;AAAA,IAED,sBAAsB,CAAC,OAAO,QAAQ,gBACrC,cAAc,iCAAiC,OAAO,aAAa,MAAM;AAAA,EAC3E;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"HasOne.js","sources":["../../../src/coreComponents/HasOne.tsx"],"sourcesContent":["import type { ReactElement, ReactNode } from 'react'\nimport { useEntity } from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredRelativeSingleEntity } from '../treeParameters'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport type HasOneProps<EntityProps = never> = SugaredRelativeSingleEntity & {\n\tchildren?: ReactNode\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\n/**\n * @group Data binding\n */\nexport const HasOne = Component(\n\t<EntityProps extends {}>(props: HasOneProps<EntityProps>) => {\n\t\tconst entity = useEntity(props)\n\n\t\treturn <Entity {...props} accessor={entity} />\n\t},\n\t{\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntity(environment, props)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<Entity {...props} accessor={undefined as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</Entity>\n\t\t),\n\t\tgenerateBranchMarker: (props, fields, environment) =>\n\t\t\tMarkerFactory.createRelativeSingleEntityFields(props, environment, fields),\n\t},\n\t'HasOne',\n) as <EntityProps extends {}>(props: HasOneProps<EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;AAmBO,MAAM,SAAS;AAAA,EACrB,CAAyB,UAAoC;AACtD,UAAA,SAAS,UAAU,KAAK;AAE9B,WAAQ,oBAAA,QAAA,EAAQ,GAAG,OAAO,UAAU,OAAQ,CAAA;AAAA,EAC7C;AAAA,EACA;AAAA,IACC,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,2BAA2B,aAAa,KAAK;AAAA,IAChF;AAAA,IACA,cAAc,CACb,UAAA,qBAAC,UAAQ,GAAG,OAAO,UAAU,QAC5B,UAAA;AAAA,MAAC,oBAAA,OAAA,EAAM,OAAO,iBAAkB,CAAA;AAAA,MAC/B,MAAM;AAAA,IAAA,GACR;AAAA,IAED,sBAAsB,CAAC,OAAO,QAAQ,gBACrC,cAAc,iCAAiC,OAAO,aAAa,MAAM;AAAA,EAC3E;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ParentEntity.js","sources":["../../../src/coreComponents/ParentEntity.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredParentEntityParameters } from '../treeParameters'\nimport { Component } from './Component'\n\nexport interface ParentEntityProps extends SugaredParentEntityParameters {\n\tchildren?: ReactNode\n}\n\nexport const ParentEntity = Component<ParentEntityProps>(\n\tprops => <>{props.children}</>,\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) =>\n\t\t\tMarkerFactory.createParentEntityMarker(props, fields, environment),\n\t},\n\t'ParentEntity',\n)\n"],"names":[],"mappings":";;;AASO,MAAM,eAAe;AAAA,EAC3B,CAAA,UAAY,oBAAA,UAAA,EAAA,UAAA,MAAM,UAAS;AAAA,EAC3B;AAAA,IACC,sBAAsB,CAAC,OAAO,QAAQ,gBACrC,cAAc,yBAAyB,OAAO,QAAQ,WAAW;AAAA,EACnE;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"ParentEntity.js","sources":["../../../src/coreComponents/ParentEntity.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredParentEntityParameters } from '../treeParameters'\nimport { Component } from './Component'\n\nexport interface ParentEntityProps extends SugaredParentEntityParameters {\n\tchildren?: ReactNode\n}\n\n/**\n * @group Data binding\n */\nexport const ParentEntity = Component<ParentEntityProps>(\n\tprops => <>{props.children}</>,\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) =>\n\t\t\tMarkerFactory.createParentEntityMarker(props, fields, environment),\n\t},\n\t'ParentEntity',\n)\n"],"names":[],"mappings":";;;AAYO,MAAM,eAAe;AAAA,EAC3B,CAAA,UAAY,oBAAA,UAAA,EAAA,UAAA,MAAM,UAAS;AAAA,EAC3B;AAAA,IACC,sBAAsB,CAAC,OAAO,QAAQ,gBACrC,cAAc,yBAAyB,OAAO,QAAQ,WAAW;AAAA,EACnE;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DeferredSubTrees.js","sources":["../../../src/helperComponents/DeferredSubTrees.tsx"],"sourcesContent":["import { ReactNode, useCallback, useEffect, useState } from 'react'\nimport { TreeRootIdProvider, useBindingOperations, useHasEntity, useEnvironment } from '../accessorPropagation'\nimport { useMutationState } from '../accessorTree'\nimport { Component } from '../coreComponents'\nimport { useEntityBeforePersist } from '../entityEvents'\nimport { EntityFieldMarkersContainer, EntityFieldsWithHoistablesMarker } from '../markers'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { TreeRootId } from '../treeParameters'\nimport { useConstantValueInvariant } from '@contember/react-utils'\nimport { EntityAccessor } from '../accessors'\n\nexport interface DeferredSubTreesProps {\n\tfallback: ReactNode\n\tchildren: ReactNode\n}\n\ntype LoadState =\n\t| { name: 'initial' }\n\t| { name: 'loading' }\n\t| {\n\t\t\tname: 'success'\n\t\t\ttreeRootId: TreeRootId | undefined\n\t }\n\nexport const DeferredSubTrees = Component<DeferredSubTreesProps>(\n\tprops => {\n\t\tconst { extendTree } = useBindingOperations()\n\t\tconst isMutating = useMutationState()\n\n\t\tconst [loadState, setLoadState] = useState<LoadState>({ name: 'initial' })\n\n\t\tconst [abortController] = useState(() => new AbortController())\n\t\tconst signal = abortController.signal\n\n\t\tconst hasEntity = useHasEntity()\n\t\tuseConstantValueInvariant(hasEntity)\n\t\tif (hasEntity) {\n\t\t\tuseEntityBeforePersist(\n\t\t\t\tuseCallback((getAccessor: EntityAccessor.GetEntityAccessor) => {\n\t\t\t\t\t// This is a hack. We're really just circumventing the change of ids after a creation so that nested\n\t\t\t\t\t// components don't error.\n\t\t\t\t\tif (getAccessor().existsOnServer) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tsetLoadState({ name: 'initial' })\n\t\t\t\t}, []),\n\t\t\t)\n\t\t}\n\n\t\tuseEffect(() => {\n\t\t\treturn () => {\n\t\t\t\tabortController.abort()\n\t\t\t}\n\t\t}, [abortController])\n\n\t\tconst environment = useEnvironment()\n\t\tuseEffect(() => {\n\t\t\tif (isMutating || loadState.name !== 'initial' || signal.aborted) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetLoadState({ name: 'loading' })\n\n\t\t\tconst newFragment = <OnlyKeepSubTrees>{props.children}</OnlyKeepSubTrees>\n\n\t\t\textendTree(newFragment, { signal, environment })\n\t\t\t\t.then(treeRootId => !signal.aborted && setLoadState({ name: 'success', treeRootId }))\n\t\t\t\t.catch(error => {\n\t\t\t\t\tif (signal.aborted) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t})\n\t\t}, [environment, extendTree, isMutating, loadState.name, props.children, signal])\n\n\t\tswitch (loadState.name) {\n\t\t\tcase 'initial':\n\t\t\tcase 'loading':\n\t\t\t\treturn <>{props.fallback}</>\n\t\t\tcase 'success':\n\t\t\t\t// This is tricky. The relations & fields within children will just render normally as if this\n\t\t\t\t// component didn't exist. The sub trees, however, will read the new treeRootId and draw their data\n\t\t\t\t// from the newly loaded batch provided by this component. That way the sub trees (and only the sub trees!)\n\t\t\t\t// effectively get lazy loaded.\n\t\t\t\treturn <TreeRootIdProvider treeRootId={loadState.treeRootId}>{props.children}</TreeRootIdProvider>\n\t\t}\n\t},\n\t{\n\t\tstaticRender: props => (\n\t\t\t<>\n\t\t\t\t{props.children}\n\t\t\t\t{props.fallback}\n\t\t\t</>\n\t\t),\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tconst fieldsWithHoistablesMarker = MarkerFactory.createEntityFieldsWithHoistablesMarker(fields, environment)\n\n\t\t\t// We want to get rid of the subTrees but leave whatever relations and fields are present.\n\t\t\t//\n\t\t\t// Mutating from here is fine since we've literally just created it and no other code could possibly possess\n\t\t\t// a reference to this.\n\t\t\tfieldsWithHoistablesMarker.subTrees?.clear()\n\n\t\t\treturn fieldsWithHoistablesMarker\n\t\t},\n\t},\n\t'DeferredSubTree',\n)\n\nconst OnlyKeepSubTrees = Component<{ children: ReactNode }>(\n\t() => null,\n\t{\n\t\tgenerateBranchMarker: (props, fields) => {\n\t\t\t// This is the complement of the equivalent method above: this time we're only keeping the sub trees.\n\t\t\tconst emptyFields = MarkerFactory.createEntityFieldMarkersContainer(undefined)\n\n\t\t\tif (fields instanceof EntityFieldMarkersContainer) {\n\t\t\t\treturn emptyFields\n\t\t\t}\n\t\t\treturn new EntityFieldsWithHoistablesMarker(emptyFields, fields.subTrees, undefined)\n\t\t},\n\t},\n\t'OnlyKeepSubTrees',\n)\n"],"names":[],"mappings":";;;;;;;;;;;;;AAwBO,MAAM,mBAAmB;AAAA,EAC/B,CAAS,UAAA;AACF,UAAA,EAAE,eAAe;AACvB,UAAM,aAAa;AAEb,UAAA,CAAC,WAAW,YAAY,IAAI,SAAoB,EAAE,MAAM,WAAW;AAEzE,UAAM,CAAC,eAAe,IAAI,SAAS,MAAM,IAAI,gBAAiB,CAAA;AAC9D,UAAM,SAAS,gBAAgB;AAE/B,UAAM,YAAY;AAClB,8BAA0B,SAAS;AACnC,QAAI,WAAW;AACd;AAAA,QACC,YAAY,CAAC,gBAAkD;AAG1D,cAAA,cAAc,gBAAgB;AACjC;AAAA,UACD;AACa,uBAAA,EAAE,MAAM,UAAA,CAAW;AAAA,QACjC,GAAG,EAAE;AAAA,MAAA;AAAA,IAEP;AAEA,cAAU,MAAM;AACf,aAAO,MAAM;AACZ,wBAAgB,MAAM;AAAA,MAAA;AAAA,IACvB,GACE,CAAC,eAAe,CAAC;AAEpB,UAAM,cAAc;AACpB,cAAU,MAAM;AACf,UAAI,cAAc,UAAU,SAAS,aAAa,OAAO,SAAS;AACjE;AAAA,MACD;AACa,mBAAA,EAAE,MAAM,UAAA,CAAW;AAEhC,YAAM,cAAc,oBAAC,kBAAkB,EAAA,UAAA,MAAM,SAAS,CAAA;AAE3C,iBAAA,aAAa,EAAE,QAAQ,YAAa,CAAA,EAC7C,KAAK,gBAAc,CAAC,OAAO,WAAW,aAAa,EAAE,MAAM,WAAW,WAAA,CAAY,CAAC,EACnF,MAAM,CAAS,UAAA;AACf,YAAI,OAAO,SAAS;AACnB;AAAA,QACD;AACM,cAAA;AAAA,MAAA,CACN;AAAA,IAAA,GACA,CAAC,aAAa,YAAY,YAAY,UAAU,MAAM,MAAM,UAAU,MAAM,CAAC;AAEhF,YAAQ,UAAU,MAAM;AAAA,MACvB,KAAK;AAAA,MACL,KAAK;AACG,eAAA,oBAAA,UAAA,EAAG,gBAAM,SAAS,CAAA;AAAA,MAC1B,KAAK;AAKJ,mCAAQ,oBAAmB,EAAA,YAAY,UAAU,YAAa,gBAAM,SAAS,CAAA;AAAA,IAC/E;AAAA,EACD;AAAA,EACA;AAAA,IACC,cAAc,WAEX,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAM,MAAA;AAAA,MACN,MAAM;AAAA,IAAA,GACR;AAAA,IAED,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACrD,YAAM,6BAA6B,cAAc,uCAAuC,QAAQ,WAAW;AAM3G,iCAA2B,UAAU;AAE9B,aAAA;AAAA,IACR;AAAA,EACD;AAAA,EACA;AACD;AAEA,MAAM,mBAAmB;AAAA,EACxB,MAAM;AAAA,EACN;AAAA,IACC,sBAAsB,CAAC,OAAO,WAAW;AAElC,YAAA,cAAc,cAAc,kCAAkC,MAAS;AAE7E,UAAI,kBAAkB,6BAA6B;AAC3C,eAAA;AAAA,MACR;AACA,aAAO,IAAI,iCAAiC,aAAa,OAAO,UAAU,MAAS;AAAA,IACpF;AAAA,EACD;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"DeferredSubTrees.js","sources":["../../../src/helperComponents/DeferredSubTrees.tsx"],"sourcesContent":["import { ReactNode, useCallback, useEffect, useState } from 'react'\nimport { TreeRootIdProvider, useBindingOperations, useHasEntity, useEnvironment } from '../accessorPropagation'\nimport { useMutationState } from '../accessorTree'\nimport { Component } from '../coreComponents'\nimport { useEntityBeforePersist } from '../entityEvents'\nimport { EntityFieldMarkersContainer, EntityFieldsWithHoistablesMarker } from '../markers'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { TreeRootId } from '../treeParameters'\nimport { useConstantValueInvariant } from '@contember/react-utils'\nimport { EntityAccessor } from '../accessors'\n\nexport interface DeferredSubTreesProps {\n\tfallback: ReactNode\n\tchildren: ReactNode\n}\n\ntype LoadState =\n\t| { name: 'initial' }\n\t| { name: 'loading' }\n\t| {\n\t\t\tname: 'success'\n\t\t\ttreeRootId: TreeRootId | undefined\n\t }\n\n/**\n * @group Data binding\n */\nexport const DeferredSubTrees = Component<DeferredSubTreesProps>(\n\tprops => {\n\t\tconst { extendTree } = useBindingOperations()\n\t\tconst isMutating = useMutationState()\n\n\t\tconst [loadState, setLoadState] = useState<LoadState>({ name: 'initial' })\n\n\t\tconst [abortController] = useState(() => new AbortController())\n\t\tconst signal = abortController.signal\n\n\t\tconst hasEntity = useHasEntity()\n\t\tuseConstantValueInvariant(hasEntity)\n\t\tif (hasEntity) {\n\t\t\tuseEntityBeforePersist(\n\t\t\t\tuseCallback((getAccessor: EntityAccessor.GetEntityAccessor) => {\n\t\t\t\t\t// This is a hack. We're really just circumventing the change of ids after a creation so that nested\n\t\t\t\t\t// components don't error.\n\t\t\t\t\tif (getAccessor().existsOnServer) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tsetLoadState({ name: 'initial' })\n\t\t\t\t}, []),\n\t\t\t)\n\t\t}\n\n\t\tuseEffect(() => {\n\t\t\treturn () => {\n\t\t\t\tabortController.abort()\n\t\t\t}\n\t\t}, [abortController])\n\n\t\tconst environment = useEnvironment()\n\t\tuseEffect(() => {\n\t\t\tif (isMutating || loadState.name !== 'initial' || signal.aborted) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetLoadState({ name: 'loading' })\n\n\t\t\tconst newFragment = <OnlyKeepSubTrees>{props.children}</OnlyKeepSubTrees>\n\n\t\t\textendTree(newFragment, { signal, environment })\n\t\t\t\t.then(treeRootId => !signal.aborted && setLoadState({ name: 'success', treeRootId }))\n\t\t\t\t.catch(error => {\n\t\t\t\t\tif (signal.aborted) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t})\n\t\t}, [environment, extendTree, isMutating, loadState.name, props.children, signal])\n\n\t\tswitch (loadState.name) {\n\t\t\tcase 'initial':\n\t\t\tcase 'loading':\n\t\t\t\treturn <>{props.fallback}</>\n\t\t\tcase 'success':\n\t\t\t\t// This is tricky. The relations & fields within children will just render normally as if this\n\t\t\t\t// component didn't exist. The sub trees, however, will read the new treeRootId and draw their data\n\t\t\t\t// from the newly loaded batch provided by this component. That way the sub trees (and only the sub trees!)\n\t\t\t\t// effectively get lazy loaded.\n\t\t\t\treturn <TreeRootIdProvider treeRootId={loadState.treeRootId}>{props.children}</TreeRootIdProvider>\n\t\t}\n\t},\n\t{\n\t\tstaticRender: props => (\n\t\t\t<>\n\t\t\t\t{props.children}\n\t\t\t\t{props.fallback}\n\t\t\t</>\n\t\t),\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tconst fieldsWithHoistablesMarker = MarkerFactory.createEntityFieldsWithHoistablesMarker(fields, environment)\n\n\t\t\t// We want to get rid of the subTrees but leave whatever relations and fields are present.\n\t\t\t//\n\t\t\t// Mutating from here is fine since we've literally just created it and no other code could possibly possess\n\t\t\t// a reference to this.\n\t\t\tfieldsWithHoistablesMarker.subTrees?.clear()\n\n\t\t\treturn fieldsWithHoistablesMarker\n\t\t},\n\t},\n\t'DeferredSubTree',\n)\n\nconst OnlyKeepSubTrees = Component<{ children: ReactNode }>(\n\t() => null,\n\t{\n\t\tgenerateBranchMarker: (props, fields) => {\n\t\t\t// This is the complement of the equivalent method above: this time we're only keeping the sub trees.\n\t\t\tconst emptyFields = MarkerFactory.createEntityFieldMarkersContainer(undefined)\n\n\t\t\tif (fields instanceof EntityFieldMarkersContainer) {\n\t\t\t\treturn emptyFields\n\t\t\t}\n\t\t\treturn new EntityFieldsWithHoistablesMarker(emptyFields, fields.subTrees, undefined)\n\t\t},\n\t},\n\t'OnlyKeepSubTrees',\n)\n"],"names":[],"mappings":";;;;;;;;;;;;;AA2BO,MAAM,mBAAmB;AAAA,EAC/B,CAAS,UAAA;AACF,UAAA,EAAE,eAAe;AACvB,UAAM,aAAa;AAEb,UAAA,CAAC,WAAW,YAAY,IAAI,SAAoB,EAAE,MAAM,WAAW;AAEzE,UAAM,CAAC,eAAe,IAAI,SAAS,MAAM,IAAI,gBAAiB,CAAA;AAC9D,UAAM,SAAS,gBAAgB;AAE/B,UAAM,YAAY;AAClB,8BAA0B,SAAS;AACnC,QAAI,WAAW;AACd;AAAA,QACC,YAAY,CAAC,gBAAkD;AAG1D,cAAA,cAAc,gBAAgB;AACjC;AAAA,UACD;AACa,uBAAA,EAAE,MAAM,UAAA,CAAW;AAAA,QACjC,GAAG,EAAE;AAAA,MAAA;AAAA,IAEP;AAEA,cAAU,MAAM;AACf,aAAO,MAAM;AACZ,wBAAgB,MAAM;AAAA,MAAA;AAAA,IACvB,GACE,CAAC,eAAe,CAAC;AAEpB,UAAM,cAAc;AACpB,cAAU,MAAM;AACf,UAAI,cAAc,UAAU,SAAS,aAAa,OAAO,SAAS;AACjE;AAAA,MACD;AACa,mBAAA,EAAE,MAAM,UAAA,CAAW;AAEhC,YAAM,cAAc,oBAAC,kBAAkB,EAAA,UAAA,MAAM,SAAS,CAAA;AAE3C,iBAAA,aAAa,EAAE,QAAQ,YAAa,CAAA,EAC7C,KAAK,gBAAc,CAAC,OAAO,WAAW,aAAa,EAAE,MAAM,WAAW,WAAA,CAAY,CAAC,EACnF,MAAM,CAAS,UAAA;AACf,YAAI,OAAO,SAAS;AACnB;AAAA,QACD;AACM,cAAA;AAAA,MAAA,CACN;AAAA,IAAA,GACA,CAAC,aAAa,YAAY,YAAY,UAAU,MAAM,MAAM,UAAU,MAAM,CAAC;AAEhF,YAAQ,UAAU,MAAM;AAAA,MACvB,KAAK;AAAA,MACL,KAAK;AACG,eAAA,oBAAA,UAAA,EAAG,gBAAM,SAAS,CAAA;AAAA,MAC1B,KAAK;AAKJ,mCAAQ,oBAAmB,EAAA,YAAY,UAAU,YAAa,gBAAM,SAAS,CAAA;AAAA,IAC/E;AAAA,EACD;AAAA,EACA;AAAA,IACC,cAAc,WAEX,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAM,MAAA;AAAA,MACN,MAAM;AAAA,IAAA,GACR;AAAA,IAED,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACrD,YAAM,6BAA6B,cAAc,uCAAuC,QAAQ,WAAW;AAM3G,iCAA2B,UAAU;AAE9B,aAAA;AAAA,IACR;AAAA,EACD;AAAA,EACA;AACD;AAEA,MAAM,mBAAmB;AAAA,EACxB,MAAM;AAAA,EACN;AAAA,IACC,sBAAsB,CAAC,OAAO,WAAW;AAElC,YAAA,cAAc,cAAc,kCAAkC,MAAS;AAE7E,UAAI,kBAAkB,6BAA6B;AAC3C,eAAA;AAAA,MACR;AACA,aAAO,IAAI,iCAAiC,aAAa,OAAO,UAAU,MAAS;AAAA,IACpF;AAAA,EACD;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityView.js","sources":["../../../src/helperComponents/EntityView.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useEntity } from '../accessorPropagation'\nimport type { EntityAccessor } from '../accessors'\nimport type { SugaredRelativeSingleEntity } from '../treeParameters'\n\nexport interface EntityViewProps {\n\trender: (entity: EntityAccessor) => ReactNode\n\tfield?: string | SugaredRelativeSingleEntity\n}\n\nexport function EntityView(props: EntityViewProps) {\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst entity = 'field' in props ? useEntity(props.field)! : useEntity()\n\n\treturn <>{props.render(entity)}</>\n}\n"],"names":[],"mappings":";;AAUO,SAAS,WAAW,OAAwB;AAElD,QAAM,SAAS,WAAW,QAAQ,UAAU,MAAM,KAAK,IAAK;AAE5D,SAAU,oBAAA,UAAA,EAAA,UAAA,MAAM,OAAO,MAAM,EAAE,CAAA;AAChC;"}
1
+ {"version":3,"file":"EntityView.js","sources":["../../../src/helperComponents/EntityView.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useEntity } from '../accessorPropagation'\nimport type { EntityAccessor } from '../accessors'\nimport type { SugaredRelativeSingleEntity } from '../treeParameters'\n\nexport interface EntityViewProps {\n\trender: (entity: EntityAccessor) => ReactNode\n\tfield?: string | SugaredRelativeSingleEntity\n}\n\n/**\n * @group Data binding\n */\nexport function EntityView(props: EntityViewProps) {\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst entity = 'field' in props ? useEntity(props.field)! : useEntity()\n\n\treturn <>{props.render(entity)}</>\n}\n"],"names":[],"mappings":";;AAaO,SAAS,WAAW,OAAwB;AAElD,QAAM,SAAS,WAAW,QAAQ,UAAU,MAAM,KAAK,IAAK;AAE5D,SAAU,oBAAA,UAAA,EAAA,UAAA,MAAM,OAAO,MAAM,EAAE,CAAA;AAChC;"}