@contember/react-binding 2.0.0-alpha.16 → 2.0.0-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/development/index.cjs +2 -9
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +1 -8
- package/dist/development/index.js.map +1 -1
- package/dist/development/src/accessorPropagation/AccessorProvider.cjs +1 -1
- package/dist/development/src/accessorPropagation/AccessorProvider.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/AccessorProvider.js +1 -1
- package/dist/development/src/accessorPropagation/AccessorProvider.js.map +1 -1
- package/dist/development/src/accessorPropagation/BindingOperationsContext.cjs +2 -1
- package/dist/development/src/accessorPropagation/BindingOperationsContext.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/BindingOperationsContext.js +2 -1
- package/dist/development/src/accessorPropagation/BindingOperationsContext.js.map +1 -1
- package/dist/development/src/accessorPropagation/EntityKeyContext.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/EntityKeyContext.js.map +1 -1
- package/dist/development/src/accessorPropagation/EntityKeyProvider.cjs +1 -1
- package/dist/development/src/accessorPropagation/EntityKeyProvider.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/EntityKeyProvider.js +1 -1
- package/dist/development/src/accessorPropagation/EntityKeyProvider.js.map +1 -1
- package/dist/development/src/accessorPropagation/useAccessorUpdateSubscription.cjs +14 -37
- package/dist/development/src/accessorPropagation/useAccessorUpdateSubscription.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useAccessorUpdateSubscription.js +15 -38
- package/dist/development/src/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
- package/dist/development/src/accessorPropagation/useEntity.cjs +4 -4
- package/dist/development/src/accessorPropagation/useEntity.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useEntity.js +4 -4
- package/dist/development/src/accessorPropagation/useEntity.js.map +1 -1
- package/dist/development/src/accessorPropagation/useEntityKey.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useEntityKey.js.map +1 -1
- package/dist/development/src/accessorPropagation/useEntityList.cjs +3 -3
- package/dist/development/src/accessorPropagation/useEntityList.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useEntityList.js +3 -3
- package/dist/development/src/accessorPropagation/useEntityList.js.map +1 -1
- package/dist/development/src/accessorPropagation/useEntityListSubTree.cjs +1 -1
- package/dist/development/src/accessorPropagation/useEntityListSubTree.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useEntityListSubTree.js +1 -1
- package/dist/development/src/accessorPropagation/useEntityListSubTree.js.map +1 -1
- package/dist/development/src/accessorPropagation/useEntitySubTree.cjs +1 -1
- package/dist/development/src/accessorPropagation/useEntitySubTree.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useEntitySubTree.js +1 -1
- package/dist/development/src/accessorPropagation/useEntitySubTree.js.map +1 -1
- package/dist/development/src/accessorPropagation/useField.cjs +3 -3
- package/dist/development/src/accessorPropagation/useField.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useField.js +3 -3
- package/dist/development/src/accessorPropagation/useField.js.map +1 -1
- package/dist/development/src/accessorSorting/SetOrderFieldOnCreate.cjs +2 -2
- package/dist/development/src/accessorSorting/SetOrderFieldOnCreate.cjs.map +1 -1
- package/dist/development/src/accessorSorting/SetOrderFieldOnCreate.js +2 -2
- package/dist/development/src/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
- package/dist/development/src/accessorSorting/addEntityAtIndex.cjs +1 -1
- package/dist/development/src/accessorSorting/addEntityAtIndex.cjs.map +1 -1
- package/dist/development/src/accessorSorting/addEntityAtIndex.js +1 -1
- package/dist/development/src/accessorSorting/addEntityAtIndex.js.map +1 -1
- package/dist/development/src/accessorSorting/repairEntitiesOrder.cjs +1 -1
- package/dist/development/src/accessorSorting/repairEntitiesOrder.cjs.map +1 -1
- package/dist/development/src/accessorSorting/repairEntitiesOrder.js +1 -1
- package/dist/development/src/accessorSorting/repairEntitiesOrder.js.map +1 -1
- package/dist/development/src/accessorSorting/sortEntities.cjs +2 -2
- package/dist/development/src/accessorSorting/sortEntities.cjs.map +1 -1
- package/dist/development/src/accessorSorting/sortEntities.js +2 -2
- package/dist/development/src/accessorSorting/sortEntities.js.map +1 -1
- package/dist/development/src/accessorTree/AccessorTree.cjs +16 -6
- package/dist/development/src/accessorTree/AccessorTree.cjs.map +1 -1
- package/dist/development/src/accessorTree/AccessorTree.js +16 -6
- package/dist/development/src/accessorTree/AccessorTree.js.map +1 -1
- package/dist/development/src/accessorTree/useDataBinding.cjs +23 -36
- package/dist/development/src/accessorTree/useDataBinding.cjs.map +1 -1
- package/dist/development/src/accessorTree/useDataBinding.js +26 -39
- package/dist/development/src/accessorTree/useDataBinding.js.map +1 -1
- package/dist/development/src/accessorTree/useEnvironmentWithSchema.cjs +31 -0
- package/dist/development/src/accessorTree/useEnvironmentWithSchema.cjs.map +1 -0
- package/dist/development/src/accessorTree/useEnvironmentWithSchema.js +31 -0
- package/dist/development/src/accessorTree/useEnvironmentWithSchema.js.map +1 -0
- package/dist/development/src/coreComponents/Component.cjs.map +1 -1
- package/dist/development/src/coreComponents/Component.js.map +1 -1
- package/dist/development/src/coreComponents/DataBindingProvider.cjs +4 -14
- package/dist/development/src/coreComponents/DataBindingProvider.cjs.map +1 -1
- package/dist/development/src/coreComponents/DataBindingProvider.js +4 -14
- package/dist/development/src/coreComponents/DataBindingProvider.js.map +1 -1
- package/dist/development/src/coreComponents/EntityListSubTree.cjs +5 -14
- package/dist/development/src/coreComponents/EntityListSubTree.cjs.map +1 -1
- package/dist/development/src/coreComponents/EntityListSubTree.js +5 -14
- package/dist/development/src/coreComponents/EntityListSubTree.js.map +1 -1
- package/dist/development/src/coreComponents/EntitySubTree.cjs +7 -16
- package/dist/development/src/coreComponents/EntitySubTree.cjs.map +1 -1
- package/dist/development/src/coreComponents/EntitySubTree.js +7 -16
- package/dist/development/src/coreComponents/EntitySubTree.js.map +1 -1
- package/dist/development/src/entityEvents/useDerivedField.cjs +3 -3
- package/dist/development/src/entityEvents/useDerivedField.cjs.map +1 -1
- package/dist/development/src/entityEvents/useDerivedField.js +3 -3
- package/dist/development/src/entityEvents/useDerivedField.js.map +1 -1
- package/dist/development/src/helperComponents/DeferredSubTrees.cjs +2 -3
- package/dist/development/src/helperComponents/DeferredSubTrees.cjs.map +1 -1
- package/dist/development/src/helperComponents/DeferredSubTrees.js +3 -4
- package/dist/development/src/helperComponents/DeferredSubTrees.js.map +1 -1
- package/dist/development/src/helperComponents/FieldView.cjs +1 -1
- package/dist/development/src/helperComponents/FieldView.cjs.map +1 -1
- package/dist/development/src/helperComponents/FieldView.js +1 -1
- package/dist/development/src/helperComponents/FieldView.js.map +1 -1
- package/dist/development/src/markers/IncrementalMarkerBuilder.cjs +56 -0
- package/dist/development/src/markers/IncrementalMarkerBuilder.cjs.map +1 -0
- package/dist/development/src/markers/IncrementalMarkerBuilder.js +56 -0
- package/dist/development/src/markers/IncrementalMarkerBuilder.js.map +1 -0
- package/dist/development/src/markers/MarkerStaticAnalyzer.cjs +110 -0
- package/dist/development/src/markers/MarkerStaticAnalyzer.cjs.map +1 -0
- package/dist/development/src/markers/MarkerStaticAnalyzer.js +110 -0
- package/dist/development/src/markers/MarkerStaticAnalyzer.js.map +1 -0
- package/dist/development/src/markers/MarkerTreeGenerator.cjs +52 -0
- package/dist/development/src/markers/MarkerTreeGenerator.cjs.map +1 -0
- package/dist/development/src/markers/MarkerTreeGenerator.js +52 -0
- package/dist/development/src/markers/MarkerTreeGenerator.js.map +1 -0
- package/dist/production/index.cjs +2 -9
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +1 -8
- package/dist/production/index.js.map +1 -1
- package/dist/production/src/accessorPropagation/AccessorProvider.cjs +1 -1
- package/dist/production/src/accessorPropagation/AccessorProvider.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/AccessorProvider.js +1 -1
- package/dist/production/src/accessorPropagation/AccessorProvider.js.map +1 -1
- package/dist/production/src/accessorPropagation/BindingOperationsContext.cjs +2 -1
- package/dist/production/src/accessorPropagation/BindingOperationsContext.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/BindingOperationsContext.js +2 -1
- package/dist/production/src/accessorPropagation/BindingOperationsContext.js.map +1 -1
- package/dist/production/src/accessorPropagation/EntityKeyContext.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/EntityKeyContext.js.map +1 -1
- package/dist/production/src/accessorPropagation/EntityKeyProvider.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/EntityKeyProvider.js.map +1 -1
- package/dist/production/src/accessorPropagation/useAccessorUpdateSubscription.cjs +14 -37
- package/dist/production/src/accessorPropagation/useAccessorUpdateSubscription.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useAccessorUpdateSubscription.js +15 -38
- package/dist/production/src/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
- package/dist/production/src/accessorPropagation/useEntity.cjs +4 -4
- package/dist/production/src/accessorPropagation/useEntity.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useEntity.js +4 -4
- package/dist/production/src/accessorPropagation/useEntity.js.map +1 -1
- package/dist/production/src/accessorPropagation/useEntityKey.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useEntityKey.js.map +1 -1
- package/dist/production/src/accessorPropagation/useEntityList.cjs +3 -3
- package/dist/production/src/accessorPropagation/useEntityList.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useEntityList.js +3 -3
- package/dist/production/src/accessorPropagation/useEntityList.js.map +1 -1
- package/dist/production/src/accessorPropagation/useEntityListSubTree.cjs +1 -1
- package/dist/production/src/accessorPropagation/useEntityListSubTree.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useEntityListSubTree.js +1 -1
- package/dist/production/src/accessorPropagation/useEntityListSubTree.js.map +1 -1
- package/dist/production/src/accessorPropagation/useEntitySubTree.cjs +1 -1
- package/dist/production/src/accessorPropagation/useEntitySubTree.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useEntitySubTree.js +1 -1
- package/dist/production/src/accessorPropagation/useEntitySubTree.js.map +1 -1
- package/dist/production/src/accessorPropagation/useField.cjs +3 -3
- package/dist/production/src/accessorPropagation/useField.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useField.js +3 -3
- package/dist/production/src/accessorPropagation/useField.js.map +1 -1
- package/dist/production/src/accessorSorting/SetOrderFieldOnCreate.cjs +2 -2
- package/dist/production/src/accessorSorting/SetOrderFieldOnCreate.cjs.map +1 -1
- package/dist/production/src/accessorSorting/SetOrderFieldOnCreate.js +2 -2
- package/dist/production/src/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
- package/dist/production/src/accessorSorting/addEntityAtIndex.cjs +1 -1
- package/dist/production/src/accessorSorting/addEntityAtIndex.cjs.map +1 -1
- package/dist/production/src/accessorSorting/addEntityAtIndex.js +1 -1
- package/dist/production/src/accessorSorting/addEntityAtIndex.js.map +1 -1
- package/dist/production/src/accessorSorting/repairEntitiesOrder.cjs +1 -1
- package/dist/production/src/accessorSorting/repairEntitiesOrder.cjs.map +1 -1
- package/dist/production/src/accessorSorting/repairEntitiesOrder.js +1 -1
- package/dist/production/src/accessorSorting/repairEntitiesOrder.js.map +1 -1
- package/dist/production/src/accessorSorting/sortEntities.cjs +2 -2
- package/dist/production/src/accessorSorting/sortEntities.cjs.map +1 -1
- package/dist/production/src/accessorSorting/sortEntities.js +2 -2
- package/dist/production/src/accessorSorting/sortEntities.js.map +1 -1
- package/dist/production/src/accessorTree/AccessorTree.cjs +3 -1
- package/dist/production/src/accessorTree/AccessorTree.cjs.map +1 -1
- package/dist/production/src/accessorTree/AccessorTree.js +3 -1
- package/dist/production/src/accessorTree/AccessorTree.js.map +1 -1
- package/dist/production/src/accessorTree/useDataBinding.cjs +23 -36
- package/dist/production/src/accessorTree/useDataBinding.cjs.map +1 -1
- package/dist/production/src/accessorTree/useDataBinding.js +26 -39
- package/dist/production/src/accessorTree/useDataBinding.js.map +1 -1
- package/dist/production/src/accessorTree/useEnvironmentWithSchema.cjs +31 -0
- package/dist/production/src/accessorTree/useEnvironmentWithSchema.cjs.map +1 -0
- package/dist/production/src/accessorTree/useEnvironmentWithSchema.js +31 -0
- package/dist/production/src/accessorTree/useEnvironmentWithSchema.js.map +1 -0
- package/dist/production/src/coreComponents/Component.cjs.map +1 -1
- package/dist/production/src/coreComponents/Component.js.map +1 -1
- package/dist/production/src/coreComponents/DataBindingProvider.cjs +3 -5
- package/dist/production/src/coreComponents/DataBindingProvider.cjs.map +1 -1
- package/dist/production/src/coreComponents/DataBindingProvider.js +3 -5
- package/dist/production/src/coreComponents/DataBindingProvider.js.map +1 -1
- package/dist/production/src/coreComponents/EntityListSubTree.cjs +2 -11
- package/dist/production/src/coreComponents/EntityListSubTree.cjs.map +1 -1
- package/dist/production/src/coreComponents/EntityListSubTree.js +2 -11
- package/dist/production/src/coreComponents/EntityListSubTree.js.map +1 -1
- package/dist/production/src/coreComponents/EntitySubTree.cjs +2 -11
- package/dist/production/src/coreComponents/EntitySubTree.cjs.map +1 -1
- package/dist/production/src/coreComponents/EntitySubTree.js +2 -11
- package/dist/production/src/coreComponents/EntitySubTree.js.map +1 -1
- package/dist/production/src/entityEvents/useDerivedField.cjs +3 -3
- package/dist/production/src/entityEvents/useDerivedField.cjs.map +1 -1
- package/dist/production/src/entityEvents/useDerivedField.js +3 -3
- package/dist/production/src/entityEvents/useDerivedField.js.map +1 -1
- package/dist/production/src/helperComponents/DeferredSubTrees.cjs +2 -3
- package/dist/production/src/helperComponents/DeferredSubTrees.cjs.map +1 -1
- package/dist/production/src/helperComponents/DeferredSubTrees.js +3 -4
- package/dist/production/src/helperComponents/DeferredSubTrees.js.map +1 -1
- package/dist/production/src/helperComponents/FieldView.cjs +1 -1
- package/dist/production/src/helperComponents/FieldView.cjs.map +1 -1
- package/dist/production/src/helperComponents/FieldView.js +1 -1
- package/dist/production/src/helperComponents/FieldView.js.map +1 -1
- package/dist/production/src/markers/IncrementalMarkerBuilder.cjs +56 -0
- package/dist/production/src/markers/IncrementalMarkerBuilder.cjs.map +1 -0
- package/dist/production/src/markers/IncrementalMarkerBuilder.js +56 -0
- package/dist/production/src/markers/IncrementalMarkerBuilder.js.map +1 -0
- package/dist/production/src/markers/MarkerStaticAnalyzer.cjs +110 -0
- package/dist/production/src/markers/MarkerStaticAnalyzer.cjs.map +1 -0
- package/dist/production/src/markers/MarkerStaticAnalyzer.js +110 -0
- package/dist/production/src/markers/MarkerStaticAnalyzer.js.map +1 -0
- package/dist/production/src/markers/MarkerTreeGenerator.cjs +52 -0
- package/dist/production/src/markers/MarkerTreeGenerator.cjs.map +1 -0
- package/dist/production/src/markers/MarkerTreeGenerator.js +52 -0
- package/dist/production/src/markers/MarkerTreeGenerator.js.map +1 -0
- package/dist/types/accessorPropagation/BindingOperationsContext.d.ts +1 -1
- package/dist/types/accessorPropagation/BindingOperationsContext.d.ts.map +1 -1
- package/dist/types/accessorPropagation/EntityKeyContext.d.ts +2 -1
- package/dist/types/accessorPropagation/EntityKeyContext.d.ts.map +1 -1
- package/dist/types/accessorPropagation/EntityKeyProvider.d.ts +2 -1
- package/dist/types/accessorPropagation/EntityKeyProvider.d.ts.map +1 -1
- package/dist/types/accessorPropagation/EnvironmentContext.d.ts +2 -2
- package/dist/types/accessorPropagation/EnvironmentContext.d.ts.map +1 -1
- package/dist/types/accessorPropagation/TreeRootIdContext.d.ts +1 -1
- package/dist/types/accessorPropagation/TreeRootIdContext.d.ts.map +1 -1
- package/dist/types/accessorPropagation/useAccessorUpdateSubscription.d.ts +7 -12
- package/dist/types/accessorPropagation/useAccessorUpdateSubscription.d.ts.map +1 -1
- package/dist/types/accessorPropagation/useEntityKey.d.ts +2 -1
- package/dist/types/accessorPropagation/useEntityKey.d.ts.map +1 -1
- package/dist/types/accessorPropagation/useEntitySubTree.d.ts +1 -2
- package/dist/types/accessorPropagation/useEntitySubTree.d.ts.map +1 -1
- package/dist/types/accessorSorting/SetOrderFieldOnCreate.d.ts +1 -1
- package/dist/types/accessorSorting/SetOrderFieldOnCreate.d.ts.map +1 -1
- package/dist/types/accessorSorting/index.d.ts +0 -2
- package/dist/types/accessorSorting/index.d.ts.map +1 -1
- package/dist/types/accessorTree/AccessorTree.d.ts.map +1 -1
- package/dist/types/accessorTree/AccessorTreeState.d.ts +1 -4
- package/dist/types/accessorTree/AccessorTreeState.d.ts.map +1 -1
- package/dist/types/accessorTree/AccessorTreeStateContext.d.ts +1 -1
- package/dist/types/accessorTree/AccessorTreeStateContext.d.ts.map +1 -1
- package/dist/types/accessorTree/AccessorTreeStateOptions.d.ts +0 -2
- package/dist/types/accessorTree/AccessorTreeStateOptions.d.ts.map +1 -1
- package/dist/types/accessorTree/DirtinessContext.d.ts +1 -1
- package/dist/types/accessorTree/DirtinessContext.d.ts.map +1 -1
- package/dist/types/accessorTree/MutationStateContext.d.ts +1 -1
- package/dist/types/accessorTree/MutationStateContext.d.ts.map +1 -1
- package/dist/types/accessorTree/index.d.ts +0 -1
- package/dist/types/accessorTree/index.d.ts.map +1 -1
- package/dist/types/accessorTree/useDataBinding.d.ts +6 -2
- package/dist/types/accessorTree/useDataBinding.d.ts.map +1 -1
- package/dist/types/accessorTree/useEnvironmentWithSchema.d.ts +3 -0
- package/dist/types/accessorTree/useEnvironmentWithSchema.d.ts.map +1 -0
- package/dist/types/coreComponents/Component.d.ts +1 -1
- package/dist/types/coreComponents/Component.d.ts.map +1 -1
- package/dist/types/coreComponents/DataBindingProvider.d.ts +8 -8
- package/dist/types/coreComponents/DataBindingProvider.d.ts.map +1 -1
- package/dist/types/coreComponents/Entity.d.ts +1 -1
- package/dist/types/coreComponents/Entity.d.ts.map +1 -1
- package/dist/types/coreComponents/EntityListSubTree.d.ts +1 -1
- package/dist/types/coreComponents/EntityListSubTree.d.ts.map +1 -1
- package/dist/types/coreComponents/EntitySubTree.d.ts +1 -1
- package/dist/types/coreComponents/EntitySubTree.d.ts.map +1 -1
- package/dist/types/coreComponents/ParentEntity.d.ts +1 -1
- package/dist/types/coreComponents/ParentEntity.d.ts.map +1 -1
- package/dist/types/coreComponents/index.d.ts +0 -1
- package/dist/types/coreComponents/index.d.ts.map +1 -1
- package/dist/types/helperComponents/DeferredSubTrees.d.ts +1 -1
- package/dist/types/helperComponents/DeferredSubTrees.d.ts.map +1 -1
- package/dist/types/helperComponents/If.d.ts +1 -1
- package/dist/types/helperComponents/If.d.ts.map +1 -1
- package/dist/types/helperComponents/LabelMiddleware.d.ts +1 -1
- package/dist/types/helperComponents/LabelMiddleware.d.ts.map +1 -1
- package/dist/types/helperComponents/StaticRender.d.ts +1 -1
- package/dist/types/helperComponents/StaticRender.d.ts.map +1 -1
- package/dist/types/helperComponents/Variable.d.ts +1 -1
- package/dist/types/helperComponents/Variable.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/markers/IncrementalMarkerBuilder.d.ts +5 -0
- package/dist/types/markers/IncrementalMarkerBuilder.d.ts.map +1 -0
- package/dist/types/{coreComponents → markers}/MarkerProvider.d.ts +1 -2
- package/dist/types/markers/MarkerProvider.d.ts.map +1 -0
- package/dist/types/markers/MarkerStaticAnalyzer.d.ts +14 -0
- package/dist/types/markers/MarkerStaticAnalyzer.d.ts.map +1 -0
- package/dist/types/markers/MarkerTreeGenerator.d.ts +10 -0
- package/dist/types/markers/MarkerTreeGenerator.d.ts.map +1 -0
- package/dist/types/markers/index.d.ts +3 -0
- package/dist/types/markers/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -7
- package/src/accessorPropagation/AccessorProvider.tsx +1 -1
- package/src/accessorPropagation/BindingOperationsContext.ts +1 -0
- package/src/accessorPropagation/EntityKeyContext.ts +2 -1
- package/src/accessorPropagation/EntityKeyProvider.tsx +2 -1
- package/src/accessorPropagation/useAccessorUpdateSubscription.ts +19 -87
- package/src/accessorPropagation/useEntity.ts +4 -4
- package/src/accessorPropagation/useEntityKey.ts +2 -2
- package/src/accessorPropagation/useEntityList.ts +3 -3
- package/src/accessorPropagation/useEntityListSubTree.ts +1 -1
- package/src/accessorPropagation/useEntitySubTree.ts +3 -4
- package/src/accessorPropagation/useField.ts +3 -3
- package/src/accessorSorting/SetOrderFieldOnCreate.tsx +2 -2
- package/src/accessorSorting/addEntityAtIndex.ts +1 -1
- package/src/accessorSorting/index.ts +0 -2
- package/src/accessorSorting/repairEntitiesOrder.ts +1 -1
- package/src/accessorSorting/sortEntities.ts +2 -2
- package/src/accessorTree/AccessorTree.tsx +17 -12
- package/src/accessorTree/AccessorTreeState.ts +1 -4
- package/src/accessorTree/AccessorTreeStateOptions.ts +0 -2
- package/src/accessorTree/index.ts +0 -1
- package/src/accessorTree/useDataBinding.ts +35 -44
- package/src/accessorTree/useEnvironmentWithSchema.ts +31 -0
- package/src/coreComponents/Component.tsx +2 -2
- package/src/coreComponents/DataBindingProvider.tsx +22 -35
- package/src/coreComponents/EntityListSubTree.tsx +4 -18
- package/src/coreComponents/EntitySubTree.tsx +5 -20
- package/src/coreComponents/index.ts +0 -1
- package/src/entityEvents/useDerivedField.ts +3 -3
- package/src/helperComponents/DeferredSubTrees.tsx +1 -5
- package/src/helperComponents/FieldView.tsx +1 -1
- package/src/index.ts +1 -1
- package/src/markers/IncrementalMarkerBuilder.ts +60 -0
- package/src/{coreComponents → markers}/MarkerProvider.ts +2 -2
- package/src/markers/MarkerStaticAnalyzer.ts +132 -0
- package/src/markers/MarkerTreeGenerator.ts +72 -0
- package/src/markers/index.ts +2 -0
- package/src/tsconfig.json +2 -1
- package/src/typings/react-fix.d.ts +12 -0
- package/tests/cases/unit/model/markerTreeGenerator.spec.tsx +44 -9
- package/tests/lib/bindingFactory.ts +1 -1
- package/dist/development/src/MarkerTreeGenerator.cjs +0 -89
- package/dist/development/src/MarkerTreeGenerator.cjs.map +0 -1
- package/dist/development/src/MarkerTreeGenerator.js +0 -89
- package/dist/development/src/MarkerTreeGenerator.js.map +0 -1
- package/dist/development/src/accessorSorting/errors.cjs +0 -10
- package/dist/development/src/accessorSorting/errors.cjs.map +0 -1
- package/dist/development/src/accessorSorting/errors.js +0 -10
- package/dist/development/src/accessorSorting/errors.js.map +0 -1
- package/dist/development/src/accessorSorting/moveEntity.cjs +0 -42
- package/dist/development/src/accessorSorting/moveEntity.cjs.map +0 -1
- package/dist/development/src/accessorSorting/moveEntity.js +0 -42
- package/dist/development/src/accessorSorting/moveEntity.js.map +0 -1
- package/dist/development/src/accessorSorting/useSortedEntities.cjs +0 -80
- package/dist/development/src/accessorSorting/useSortedEntities.cjs.map +0 -1
- package/dist/development/src/accessorSorting/useSortedEntities.js +0 -80
- package/dist/development/src/accessorSorting/useSortedEntities.js.map +0 -1
- package/dist/development/src/accessorTree/accessorTreeStateReducer.cjs +0 -34
- package/dist/development/src/accessorTree/accessorTreeStateReducer.cjs.map +0 -1
- package/dist/development/src/accessorTree/accessorTreeStateReducer.js +0 -34
- package/dist/development/src/accessorTree/accessorTreeStateReducer.js.map +0 -1
- package/dist/development/src/core/IncrementalMarkerBuilder.cjs +0 -63
- package/dist/development/src/core/IncrementalMarkerBuilder.cjs.map +0 -1
- package/dist/development/src/core/IncrementalMarkerBuilder.js +0 -63
- package/dist/development/src/core/IncrementalMarkerBuilder.js.map +0 -1
- package/dist/production/src/MarkerTreeGenerator.cjs +0 -89
- package/dist/production/src/MarkerTreeGenerator.cjs.map +0 -1
- package/dist/production/src/MarkerTreeGenerator.js +0 -89
- package/dist/production/src/MarkerTreeGenerator.js.map +0 -1
- package/dist/production/src/accessorSorting/errors.cjs +0 -10
- package/dist/production/src/accessorSorting/errors.cjs.map +0 -1
- package/dist/production/src/accessorSorting/errors.js +0 -10
- package/dist/production/src/accessorSorting/errors.js.map +0 -1
- package/dist/production/src/accessorSorting/moveEntity.cjs +0 -42
- package/dist/production/src/accessorSorting/moveEntity.cjs.map +0 -1
- package/dist/production/src/accessorSorting/moveEntity.js +0 -42
- package/dist/production/src/accessorSorting/moveEntity.js.map +0 -1
- package/dist/production/src/accessorSorting/useSortedEntities.cjs +0 -80
- package/dist/production/src/accessorSorting/useSortedEntities.cjs.map +0 -1
- package/dist/production/src/accessorSorting/useSortedEntities.js +0 -80
- package/dist/production/src/accessorSorting/useSortedEntities.js.map +0 -1
- package/dist/production/src/accessorTree/accessorTreeStateReducer.cjs +0 -34
- package/dist/production/src/accessorTree/accessorTreeStateReducer.cjs.map +0 -1
- package/dist/production/src/accessorTree/accessorTreeStateReducer.js +0 -34
- package/dist/production/src/accessorTree/accessorTreeStateReducer.js.map +0 -1
- package/dist/production/src/core/IncrementalMarkerBuilder.cjs +0 -63
- package/dist/production/src/core/IncrementalMarkerBuilder.cjs.map +0 -1
- package/dist/production/src/core/IncrementalMarkerBuilder.js +0 -63
- package/dist/production/src/core/IncrementalMarkerBuilder.js.map +0 -1
- package/dist/types/MarkerTreeGenerator.d.ts +0 -14
- package/dist/types/MarkerTreeGenerator.d.ts.map +0 -1
- package/dist/types/accessorSorting/errors.d.ts +0 -3
- package/dist/types/accessorSorting/errors.d.ts.map +0 -1
- package/dist/types/accessorSorting/moveEntity.d.ts +0 -4
- package/dist/types/accessorSorting/moveEntity.d.ts.map +0 -1
- package/dist/types/accessorSorting/useSortedEntities.d.ts +0 -5
- package/dist/types/accessorSorting/useSortedEntities.d.ts.map +0 -1
- package/dist/types/accessorTree/accessorTreeStateReducer.d.ts +0 -4
- package/dist/types/accessorTree/accessorTreeStateReducer.d.ts.map +0 -1
- package/dist/types/core/IncrementalMarkerBuilder.d.ts +0 -7
- package/dist/types/core/IncrementalMarkerBuilder.d.ts.map +0 -1
- package/dist/types/coreComponents/MarkerProvider.d.ts.map +0 -1
- package/src/MarkerTreeGenerator.ts +0 -121
- package/src/accessorSorting/errors.ts +0 -9
- package/src/accessorSorting/moveEntity.ts +0 -65
- package/src/accessorSorting/useSortedEntities.ts +0 -102
- package/src/accessorTree/accessorTreeStateReducer.ts +0 -36
- package/src/core/IncrementalMarkerBuilder.ts +0 -64
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { EntityFieldMarkersContainer, MarkerMerger, EntityFieldsWithHoistablesMarker, TreeParameterMerger, MarkerFactory } from "@contember/binding";
|
|
2
|
+
class IncrementalMarkerBuilder {
|
|
3
|
+
static build(markers) {
|
|
4
|
+
return markers.reduce((acc, addition) => {
|
|
5
|
+
if (addition instanceof EntityFieldMarkersContainer) {
|
|
6
|
+
if (acc instanceof EntityFieldMarkersContainer) {
|
|
7
|
+
return MarkerMerger.mergeEntityFieldsContainers(acc, addition);
|
|
8
|
+
} else {
|
|
9
|
+
return new EntityFieldsWithHoistablesMarker(
|
|
10
|
+
MarkerMerger.mergeEntityFieldsContainers(acc.fields, addition),
|
|
11
|
+
acc.subTrees,
|
|
12
|
+
acc.parentReference
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
} else if (addition instanceof EntityFieldsWithHoistablesMarker) {
|
|
16
|
+
if (acc instanceof EntityFieldMarkersContainer) {
|
|
17
|
+
return new EntityFieldsWithHoistablesMarker(
|
|
18
|
+
MarkerMerger.mergeEntityFieldsContainers(acc, addition.fields),
|
|
19
|
+
addition.subTrees,
|
|
20
|
+
addition.parentReference
|
|
21
|
+
);
|
|
22
|
+
} else {
|
|
23
|
+
return new EntityFieldsWithHoistablesMarker(
|
|
24
|
+
MarkerMerger.mergeEntityFieldsContainers(acc.fields, addition.fields),
|
|
25
|
+
MarkerMerger.mergeSubTreeMarkers(acc.subTrees, addition.subTrees),
|
|
26
|
+
TreeParameterMerger.mergeParentEntityParameters(acc.parentReference, addition.parentReference)
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
if (acc instanceof EntityFieldMarkersContainer) {
|
|
31
|
+
return MarkerMerger.mergeEntityFieldsContainers(
|
|
32
|
+
acc,
|
|
33
|
+
MarkerFactory.createEntityFieldMarkersContainer(addition)
|
|
34
|
+
);
|
|
35
|
+
} else {
|
|
36
|
+
return new EntityFieldsWithHoistablesMarker(
|
|
37
|
+
MarkerMerger.mergeEntityFieldsContainers(
|
|
38
|
+
acc.fields,
|
|
39
|
+
MarkerFactory.createEntityFieldMarkersContainer(addition)
|
|
40
|
+
),
|
|
41
|
+
acc.subTrees,
|
|
42
|
+
acc.parentReference
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}, new EntityFieldMarkersContainer(
|
|
47
|
+
false,
|
|
48
|
+
/* @__PURE__ */ new Map(),
|
|
49
|
+
/* @__PURE__ */ new Map()
|
|
50
|
+
));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
IncrementalMarkerBuilder
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=IncrementalMarkerBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IncrementalMarkerBuilder.js","sources":["../../../../../packages/react-binding/src/markers/IncrementalMarkerBuilder.ts"],"sourcesContent":["import {\n\tEntityFieldMarker,\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tMarkerFactory,\n\tMarkerMerger,\n\tTreeParameterMerger,\n} from '@contember/binding'\n\nexport class IncrementalMarkerBuilder {\n\tpublic static build(markers: (EntityFieldMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker)[]): EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer {\n\t\treturn markers.reduce<EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer>((acc, addition) => {\n\t\t\tif (addition instanceof EntityFieldMarkersContainer) {\n\t\t\t\tif (acc instanceof EntityFieldMarkersContainer) {\n\t\t\t\t\treturn MarkerMerger.mergeEntityFieldsContainers(acc, addition)\n\t\t\t\t} else {\n\t\t\t\t\treturn new EntityFieldsWithHoistablesMarker(\n\t\t\t\t\t\tMarkerMerger.mergeEntityFieldsContainers(acc.fields, addition),\n\t\t\t\t\t\tacc.subTrees,\n\t\t\t\t\t\tacc.parentReference,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t} else if (addition instanceof EntityFieldsWithHoistablesMarker) {\n\t\t\t\tif (acc instanceof EntityFieldMarkersContainer) {\n\t\t\t\t\treturn new EntityFieldsWithHoistablesMarker(\n\t\t\t\t\t\tMarkerMerger.mergeEntityFieldsContainers(acc, addition.fields),\n\t\t\t\t\t\taddition.subTrees,\n\t\t\t\t\t\taddition.parentReference,\n\t\t\t\t\t)\n\t\t\t\t} else {\n\t\t\t\t\treturn new EntityFieldsWithHoistablesMarker(\n\t\t\t\t\t\tMarkerMerger.mergeEntityFieldsContainers(acc.fields, addition.fields),\n\t\t\t\t\t\tMarkerMerger.mergeSubTreeMarkers(acc.subTrees, addition.subTrees),\n\t\t\t\t\t\tTreeParameterMerger.mergeParentEntityParameters(acc.parentReference, addition.parentReference),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (acc instanceof EntityFieldMarkersContainer) {\n\t\t\t\t\treturn MarkerMerger.mergeEntityFieldsContainers(\n\t\t\t\t\t\tacc,\n\t\t\t\t\t\tMarkerFactory.createEntityFieldMarkersContainer(addition),\n\t\t\t\t\t)\n\t\t\t\t} else {\n\t\t\t\t\treturn new EntityFieldsWithHoistablesMarker(\n\t\t\t\t\t\tMarkerMerger.mergeEntityFieldsContainers(\n\t\t\t\t\t\t\tacc.fields,\n\t\t\t\t\t\t\tMarkerFactory.createEntityFieldMarkersContainer(addition),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tacc.subTrees,\n\t\t\t\t\t\tacc.parentReference,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}, new EntityFieldMarkersContainer(\n\t\t\tfalse,\n\t\t\tnew Map(),\n\t\t\tnew Map(),\n\t\t))\n\t}\n}\n"],"names":[],"mappings":";AASO,MAAM,yBAAyB;AAAA,EACrC,OAAc,MAAM,SAAiK;AACpL,WAAO,QAAQ,OAAuE,CAAC,KAAK,aAAa;AACxG,UAAI,oBAAoB,6BAA6B;AACpD,YAAI,eAAe,6BAA6B;AACxC,iBAAA,aAAa,4BAA4B,KAAK,QAAQ;AAAA,QAAA,OACvD;AACN,iBAAO,IAAI;AAAA,YACV,aAAa,4BAA4B,IAAI,QAAQ,QAAQ;AAAA,YAC7D,IAAI;AAAA,YACJ,IAAI;AAAA,UAAA;AAAA,QAEN;AAAA,MAAA,WACU,oBAAoB,kCAAkC;AAChE,YAAI,eAAe,6BAA6B;AAC/C,iBAAO,IAAI;AAAA,YACV,aAAa,4BAA4B,KAAK,SAAS,MAAM;AAAA,YAC7D,SAAS;AAAA,YACT,SAAS;AAAA,UAAA;AAAA,QACV,OACM;AACN,iBAAO,IAAI;AAAA,YACV,aAAa,4BAA4B,IAAI,QAAQ,SAAS,MAAM;AAAA,YACpE,aAAa,oBAAoB,IAAI,UAAU,SAAS,QAAQ;AAAA,YAChE,oBAAoB,4BAA4B,IAAI,iBAAiB,SAAS,eAAe;AAAA,UAAA;AAAA,QAE/F;AAAA,MAAA,OACM;AACN,YAAI,eAAe,6BAA6B;AAC/C,iBAAO,aAAa;AAAA,YACnB;AAAA,YACA,cAAc,kCAAkC,QAAQ;AAAA,UAAA;AAAA,QACzD,OACM;AACN,iBAAO,IAAI;AAAA,YACV,aAAa;AAAA,cACZ,IAAI;AAAA,cACJ,cAAc,kCAAkC,QAAQ;AAAA,YACzD;AAAA,YACA,IAAI;AAAA,YACJ,IAAI;AAAA,UAAA;AAAA,QAEN;AAAA,MACD;AAAA,OACE,IAAI;AAAA,MACN;AAAA,0BACI,IAAI;AAAA,0BACJ,IAAI;AAAA,IAAA,CACR;AAAA,EACF;AACD;"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const IncrementalMarkerBuilder = require("./IncrementalMarkerBuilder.cjs");
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
8
|
+
class MarkerStaticAnalyzer {
|
|
9
|
+
processChildren(children, env) {
|
|
10
|
+
return IncrementalMarkerBuilder.IncrementalMarkerBuilder.build(this.processNode(children, env, []));
|
|
11
|
+
}
|
|
12
|
+
processNode(node, env, componentPath) {
|
|
13
|
+
if (node === false || node === void 0 || node === null || typeof node === "string" || typeof node === "number" || typeof node === "boolean") {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
if (typeof node === "function") {
|
|
17
|
+
throw new ChildrenAnalyzerError(`Render props (functions as React component children) are not supported within the schema. You have likely used a bare custom component as opposed to wrapping in with \`Component\` from the \`@contember/admin\` package. Please refer to the documentation.`);
|
|
18
|
+
}
|
|
19
|
+
if (Array.isArray(node)) {
|
|
20
|
+
return node.flatMap((subNode) => this.processNode(subNode, env, componentPath));
|
|
21
|
+
}
|
|
22
|
+
if (!("type" in node)) {
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
if (typeof node.type === "symbol" || typeof node.type === "string") {
|
|
26
|
+
return this.processNode(node.props.children, env, componentPath);
|
|
27
|
+
}
|
|
28
|
+
componentPath = [...componentPath, node];
|
|
29
|
+
const nodeDisplayName = "displayName" in node.type ? node.type.displayName : "???";
|
|
30
|
+
try {
|
|
31
|
+
if ("generateEnvironment" in node.type) {
|
|
32
|
+
env = node.type.generateEnvironment(node.props, env);
|
|
33
|
+
}
|
|
34
|
+
} catch (e) {
|
|
35
|
+
wrapError(e, nodeDisplayName, "static context factory", componentPath);
|
|
36
|
+
}
|
|
37
|
+
if ("generateLeafMarker" in node.type) {
|
|
38
|
+
return [node.type.generateLeafMarker(node.props, env)];
|
|
39
|
+
}
|
|
40
|
+
let children = node.props.children;
|
|
41
|
+
try {
|
|
42
|
+
if ("staticRender" in node.type) {
|
|
43
|
+
children = node.type.staticRender(node.props, env);
|
|
44
|
+
}
|
|
45
|
+
} catch (e) {
|
|
46
|
+
wrapError(e, nodeDisplayName, "static render", componentPath);
|
|
47
|
+
}
|
|
48
|
+
const processedChildren = this.processNode(children, env, componentPath);
|
|
49
|
+
if ("generateBranchMarker" in node.type) {
|
|
50
|
+
const marker = IncrementalMarkerBuilder.IncrementalMarkerBuilder.build(processedChildren);
|
|
51
|
+
return [node.type.generateBranchMarker(node.props, marker, env)];
|
|
52
|
+
}
|
|
53
|
+
return processedChildren;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
class ChildrenAnalyzerError extends Error {
|
|
57
|
+
constructor(message, options) {
|
|
58
|
+
super(message, options);
|
|
59
|
+
__publicField(this, "details");
|
|
60
|
+
this.details = options?.details;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const wrapError = (e, currentComponentName, methodName, path) => {
|
|
64
|
+
if (!(e instanceof Error)) {
|
|
65
|
+
throw e;
|
|
66
|
+
}
|
|
67
|
+
const componentPath = path.map((it, index) => {
|
|
68
|
+
const { children, ...props } = it.props;
|
|
69
|
+
const printProps = (props2) => {
|
|
70
|
+
let result = "";
|
|
71
|
+
for (const [key, value] of Object.entries(props2)) {
|
|
72
|
+
if (value === void 0) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
const valuePrinted = JSON.stringify(
|
|
77
|
+
value,
|
|
78
|
+
(key2, value2) => {
|
|
79
|
+
if (typeof value2 === "function") {
|
|
80
|
+
return "(function)";
|
|
81
|
+
}
|
|
82
|
+
if (React.isValidElement(value2)) {
|
|
83
|
+
return "(react element)";
|
|
84
|
+
}
|
|
85
|
+
return value2;
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
result += ` ${key}=${valuePrinted}`;
|
|
89
|
+
} catch {
|
|
90
|
+
result += ` ${key}=(failed to print a value)`;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
};
|
|
95
|
+
const componentName = typeof it.type === "object" && "displayName" in it.type ? it.type.displayName : null;
|
|
96
|
+
const propsPrinted = printProps(props);
|
|
97
|
+
const indent = " ".repeat(index);
|
|
98
|
+
return `${indent}<${componentName ?? "???"}${propsPrinted}>`;
|
|
99
|
+
});
|
|
100
|
+
const errorMessage = `Error during static render of ${currentComponentName} in ${methodName}:
|
|
101
|
+
${e.message || "unknown error"}`;
|
|
102
|
+
throw new ChildrenAnalyzerError(errorMessage, {
|
|
103
|
+
cause: e,
|
|
104
|
+
details: `Component path:
|
|
105
|
+
${componentPath.join("\n")}`
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
exports.ChildrenAnalyzerError = ChildrenAnalyzerError;
|
|
109
|
+
exports.MarkerStaticAnalyzer = MarkerStaticAnalyzer;
|
|
110
|
+
//# sourceMappingURL=MarkerStaticAnalyzer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkerStaticAnalyzer.cjs","sources":["../../../../../packages/react-binding/src/markers/MarkerStaticAnalyzer.ts"],"sourcesContent":["import React, { ReactElement, ReactNode } from 'react'\nimport { BranchMarkerProvider, EnvironmentDeltaProvider, LeafMarkerProvider, StaticRenderProvider } from './MarkerProvider'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEnvironment,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n} from '@contember/binding'\nimport { IncrementalMarkerBuilder } from './IncrementalMarkerBuilder'\n\ntype Markers = FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker | HasManyRelationMarker\n\nexport class MarkerStaticAnalyzer {\n\tpublic processChildren(\n\t\tchildren: ReactNode,\n\t\tenv: Environment,\n\t): EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer {\n\t\treturn IncrementalMarkerBuilder.build(this.processNode(children, env, []))\n\t}\n\n\tprivate processNode(\n\t\tnode: ReactNode,\n\t\tenv: Environment,\n\t\tcomponentPath: ReactElement[],\n\t): Markers[] {\n\t\tif (node === false || node === undefined || node === null || typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean') {\n\t\t\treturn []\n\t\t}\n\t\tif (typeof node === 'function') {\n\t\t\tthrow new ChildrenAnalyzerError(`Render props (functions as React component children) are not supported within the schema. ` +\n\t\t\t\t`You have likely used a bare custom component as opposed to wrapping in with \\`Component\\` ` +\n\t\t\t\t`from the \\`@contember/admin\\` package. Please refer to the documentation.`)\n\t\t}\n\n\t\tif (Array.isArray(node)) {\n\t\t\treturn node.flatMap(subNode => this.processNode(subNode, env, componentPath))\n\t\t}\n\n\t\tif (!('type' in node)) {\n\t\t\treturn []\n\t\t}\n\n\t\tif (typeof node.type === 'symbol' || typeof node.type === 'string') {\n\t\t\t// Fragment, Portal or other non-component\n\t\t\treturn this.processNode(node.props.children, env, componentPath)\n\t\t}\n\n\t\tcomponentPath = [...componentPath, node]\n\n\t\tconst nodeDisplayName = 'displayName' in node.type ? (node.type.displayName as string) : '???'\n\n\t\ttry {\n\t\t\tif ('generateEnvironment' in node.type) {\n\t\t\t\tenv = (node.type as EnvironmentDeltaProvider).generateEnvironment(node.props, env)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\twrapError(e, nodeDisplayName, 'static context factory', componentPath)\n\t\t}\n\t\tif ('generateLeafMarker' in node.type) {\n\t\t\treturn [(node.type as LeafMarkerProvider).generateLeafMarker(node.props, env)]\n\t\t}\n\t\tlet children: ReactNode = node.props.children\n\t\ttry {\n\t\t\tif ('staticRender' in node.type) {\n\t\t\t\tchildren = (node.type as StaticRenderProvider).staticRender(node.props, env)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\twrapError(e, nodeDisplayName, 'static render', componentPath)\n\t\t}\n\t\tconst processedChildren = this.processNode(children, env, componentPath)\n\t\tif ('generateBranchMarker' in node.type) {\n\t\t\tconst marker = IncrementalMarkerBuilder.build(processedChildren)\n\t\t\treturn [(node.type as BranchMarkerProvider).generateBranchMarker(node.props, marker, env)]\n\t\t}\n\t\treturn processedChildren\n\t}\n}\n\nexport class ChildrenAnalyzerError extends Error {\n\tpublic details?: string\n\n\tconstructor(message: string, options?: { cause: Error; details?: string }) {\n\t\tsuper(message, options)\n\t\tthis.details = options?.details\n\t}\n}\n\nconst wrapError = (e: unknown, currentComponentName: string, methodName: string, path: ReactElement[]): never => {\n\tif (!(e instanceof Error)) {\n\t\tthrow e\n\t}\n\n\tconst componentPath = path.map((it, index) => {\n\t\tconst { children, ...props } = it.props\n\t\tconst printProps = (props: any) => {\n\t\t\tlet result = ''\n\t\t\tfor (const [key, value] of Object.entries(props)) {\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst valuePrinted = JSON.stringify(value, (key, value) => {\n\t\t\t\t\t\tif (typeof value === 'function') {\n\t\t\t\t\t\t\treturn '(function)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (React.isValidElement(value)) {\n\t\t\t\t\t\t\treturn '(react element)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn value\n\t\t\t\t\t},\n\t\t\t\t\t)\n\t\t\t\t\tresult += ` ${key}=${valuePrinted}`\n\t\t\t\t} catch {\n\t\t\t\t\tresult += ` ${key}=(failed to print a value)`\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result\n\t\t}\n\t\tconst componentName = typeof it.type === 'object' && 'displayName' in it.type ? (it.type as any).displayName : null\n\t\tconst propsPrinted = printProps(props)\n\t\tconst indent = ' '.repeat(index)\n\t\treturn `${indent}<${componentName ?? '???'}${propsPrinted}>`\n\t})\n\tconst errorMessage = `Error during static render of ${currentComponentName} in ${methodName}:\\n${e.message || 'unknown error'}`\n\n\tthrow new ChildrenAnalyzerError(errorMessage, {\n\t\tcause: e,\n\t\tdetails: `Component path:\\n${componentPath.join('\\n')}`,\n\t})\n}\n"],"names":["IncrementalMarkerBuilder","props","key","value"],"mappings":"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"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React__default from "react";
|
|
2
|
+
import { IncrementalMarkerBuilder } from "./IncrementalMarkerBuilder.js";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
6
|
+
class MarkerStaticAnalyzer {
|
|
7
|
+
processChildren(children, env) {
|
|
8
|
+
return IncrementalMarkerBuilder.build(this.processNode(children, env, []));
|
|
9
|
+
}
|
|
10
|
+
processNode(node, env, componentPath) {
|
|
11
|
+
if (node === false || node === void 0 || node === null || typeof node === "string" || typeof node === "number" || typeof node === "boolean") {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
if (typeof node === "function") {
|
|
15
|
+
throw new ChildrenAnalyzerError(`Render props (functions as React component children) are not supported within the schema. You have likely used a bare custom component as opposed to wrapping in with \`Component\` from the \`@contember/admin\` package. Please refer to the documentation.`);
|
|
16
|
+
}
|
|
17
|
+
if (Array.isArray(node)) {
|
|
18
|
+
return node.flatMap((subNode) => this.processNode(subNode, env, componentPath));
|
|
19
|
+
}
|
|
20
|
+
if (!("type" in node)) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
if (typeof node.type === "symbol" || typeof node.type === "string") {
|
|
24
|
+
return this.processNode(node.props.children, env, componentPath);
|
|
25
|
+
}
|
|
26
|
+
componentPath = [...componentPath, node];
|
|
27
|
+
const nodeDisplayName = "displayName" in node.type ? node.type.displayName : "???";
|
|
28
|
+
try {
|
|
29
|
+
if ("generateEnvironment" in node.type) {
|
|
30
|
+
env = node.type.generateEnvironment(node.props, env);
|
|
31
|
+
}
|
|
32
|
+
} catch (e) {
|
|
33
|
+
wrapError(e, nodeDisplayName, "static context factory", componentPath);
|
|
34
|
+
}
|
|
35
|
+
if ("generateLeafMarker" in node.type) {
|
|
36
|
+
return [node.type.generateLeafMarker(node.props, env)];
|
|
37
|
+
}
|
|
38
|
+
let children = node.props.children;
|
|
39
|
+
try {
|
|
40
|
+
if ("staticRender" in node.type) {
|
|
41
|
+
children = node.type.staticRender(node.props, env);
|
|
42
|
+
}
|
|
43
|
+
} catch (e) {
|
|
44
|
+
wrapError(e, nodeDisplayName, "static render", componentPath);
|
|
45
|
+
}
|
|
46
|
+
const processedChildren = this.processNode(children, env, componentPath);
|
|
47
|
+
if ("generateBranchMarker" in node.type) {
|
|
48
|
+
const marker = IncrementalMarkerBuilder.build(processedChildren);
|
|
49
|
+
return [node.type.generateBranchMarker(node.props, marker, env)];
|
|
50
|
+
}
|
|
51
|
+
return processedChildren;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
class ChildrenAnalyzerError extends Error {
|
|
55
|
+
constructor(message, options) {
|
|
56
|
+
super(message, options);
|
|
57
|
+
__publicField(this, "details");
|
|
58
|
+
this.details = options?.details;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const wrapError = (e, currentComponentName, methodName, path) => {
|
|
62
|
+
if (!(e instanceof Error)) {
|
|
63
|
+
throw e;
|
|
64
|
+
}
|
|
65
|
+
const componentPath = path.map((it, index) => {
|
|
66
|
+
const { children, ...props } = it.props;
|
|
67
|
+
const printProps = (props2) => {
|
|
68
|
+
let result = "";
|
|
69
|
+
for (const [key, value] of Object.entries(props2)) {
|
|
70
|
+
if (value === void 0) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
const valuePrinted = JSON.stringify(
|
|
75
|
+
value,
|
|
76
|
+
(key2, value2) => {
|
|
77
|
+
if (typeof value2 === "function") {
|
|
78
|
+
return "(function)";
|
|
79
|
+
}
|
|
80
|
+
if (React__default.isValidElement(value2)) {
|
|
81
|
+
return "(react element)";
|
|
82
|
+
}
|
|
83
|
+
return value2;
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
result += ` ${key}=${valuePrinted}`;
|
|
87
|
+
} catch {
|
|
88
|
+
result += ` ${key}=(failed to print a value)`;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return result;
|
|
92
|
+
};
|
|
93
|
+
const componentName = typeof it.type === "object" && "displayName" in it.type ? it.type.displayName : null;
|
|
94
|
+
const propsPrinted = printProps(props);
|
|
95
|
+
const indent = " ".repeat(index);
|
|
96
|
+
return `${indent}<${componentName ?? "???"}${propsPrinted}>`;
|
|
97
|
+
});
|
|
98
|
+
const errorMessage = `Error during static render of ${currentComponentName} in ${methodName}:
|
|
99
|
+
${e.message || "unknown error"}`;
|
|
100
|
+
throw new ChildrenAnalyzerError(errorMessage, {
|
|
101
|
+
cause: e,
|
|
102
|
+
details: `Component path:
|
|
103
|
+
${componentPath.join("\n")}`
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
export {
|
|
107
|
+
ChildrenAnalyzerError,
|
|
108
|
+
MarkerStaticAnalyzer
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=MarkerStaticAnalyzer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkerStaticAnalyzer.js","sources":["../../../../../packages/react-binding/src/markers/MarkerStaticAnalyzer.ts"],"sourcesContent":["import React, { ReactElement, ReactNode } from 'react'\nimport { BranchMarkerProvider, EnvironmentDeltaProvider, LeafMarkerProvider, StaticRenderProvider } from './MarkerProvider'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEnvironment,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n} from '@contember/binding'\nimport { IncrementalMarkerBuilder } from './IncrementalMarkerBuilder'\n\ntype Markers = FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker | HasManyRelationMarker\n\nexport class MarkerStaticAnalyzer {\n\tpublic processChildren(\n\t\tchildren: ReactNode,\n\t\tenv: Environment,\n\t): EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer {\n\t\treturn IncrementalMarkerBuilder.build(this.processNode(children, env, []))\n\t}\n\n\tprivate processNode(\n\t\tnode: ReactNode,\n\t\tenv: Environment,\n\t\tcomponentPath: ReactElement[],\n\t): Markers[] {\n\t\tif (node === false || node === undefined || node === null || typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean') {\n\t\t\treturn []\n\t\t}\n\t\tif (typeof node === 'function') {\n\t\t\tthrow new ChildrenAnalyzerError(`Render props (functions as React component children) are not supported within the schema. ` +\n\t\t\t\t`You have likely used a bare custom component as opposed to wrapping in with \\`Component\\` ` +\n\t\t\t\t`from the \\`@contember/admin\\` package. Please refer to the documentation.`)\n\t\t}\n\n\t\tif (Array.isArray(node)) {\n\t\t\treturn node.flatMap(subNode => this.processNode(subNode, env, componentPath))\n\t\t}\n\n\t\tif (!('type' in node)) {\n\t\t\treturn []\n\t\t}\n\n\t\tif (typeof node.type === 'symbol' || typeof node.type === 'string') {\n\t\t\t// Fragment, Portal or other non-component\n\t\t\treturn this.processNode(node.props.children, env, componentPath)\n\t\t}\n\n\t\tcomponentPath = [...componentPath, node]\n\n\t\tconst nodeDisplayName = 'displayName' in node.type ? (node.type.displayName as string) : '???'\n\n\t\ttry {\n\t\t\tif ('generateEnvironment' in node.type) {\n\t\t\t\tenv = (node.type as EnvironmentDeltaProvider).generateEnvironment(node.props, env)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\twrapError(e, nodeDisplayName, 'static context factory', componentPath)\n\t\t}\n\t\tif ('generateLeafMarker' in node.type) {\n\t\t\treturn [(node.type as LeafMarkerProvider).generateLeafMarker(node.props, env)]\n\t\t}\n\t\tlet children: ReactNode = node.props.children\n\t\ttry {\n\t\t\tif ('staticRender' in node.type) {\n\t\t\t\tchildren = (node.type as StaticRenderProvider).staticRender(node.props, env)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\twrapError(e, nodeDisplayName, 'static render', componentPath)\n\t\t}\n\t\tconst processedChildren = this.processNode(children, env, componentPath)\n\t\tif ('generateBranchMarker' in node.type) {\n\t\t\tconst marker = IncrementalMarkerBuilder.build(processedChildren)\n\t\t\treturn [(node.type as BranchMarkerProvider).generateBranchMarker(node.props, marker, env)]\n\t\t}\n\t\treturn processedChildren\n\t}\n}\n\nexport class ChildrenAnalyzerError extends Error {\n\tpublic details?: string\n\n\tconstructor(message: string, options?: { cause: Error; details?: string }) {\n\t\tsuper(message, options)\n\t\tthis.details = options?.details\n\t}\n}\n\nconst wrapError = (e: unknown, currentComponentName: string, methodName: string, path: ReactElement[]): never => {\n\tif (!(e instanceof Error)) {\n\t\tthrow e\n\t}\n\n\tconst componentPath = path.map((it, index) => {\n\t\tconst { children, ...props } = it.props\n\t\tconst printProps = (props: any) => {\n\t\t\tlet result = ''\n\t\t\tfor (const [key, value] of Object.entries(props)) {\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst valuePrinted = JSON.stringify(value, (key, value) => {\n\t\t\t\t\t\tif (typeof value === 'function') {\n\t\t\t\t\t\t\treturn '(function)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (React.isValidElement(value)) {\n\t\t\t\t\t\t\treturn '(react element)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn value\n\t\t\t\t\t},\n\t\t\t\t\t)\n\t\t\t\t\tresult += ` ${key}=${valuePrinted}`\n\t\t\t\t} catch {\n\t\t\t\t\tresult += ` ${key}=(failed to print a value)`\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result\n\t\t}\n\t\tconst componentName = typeof it.type === 'object' && 'displayName' in it.type ? (it.type as any).displayName : null\n\t\tconst propsPrinted = printProps(props)\n\t\tconst indent = ' '.repeat(index)\n\t\treturn `${indent}<${componentName ?? '???'}${propsPrinted}>`\n\t})\n\tconst errorMessage = `Error during static render of ${currentComponentName} in ${methodName}:\\n${e.message || 'unknown error'}`\n\n\tthrow new ChildrenAnalyzerError(errorMessage, {\n\t\tcause: e,\n\t\tdetails: `Component path:\\n${componentPath.join('\\n')}`,\n\t})\n}\n"],"names":["props","key","value","React"],"mappings":"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"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const binding = require("@contember/binding");
|
|
4
|
+
const MarkerStaticAnalyzer = require("./MarkerStaticAnalyzer.cjs");
|
|
5
|
+
class MarkerTreeGenerator {
|
|
6
|
+
constructor(sourceTree, environment = binding.Environment.create()) {
|
|
7
|
+
this.sourceTree = sourceTree;
|
|
8
|
+
this.environment = environment;
|
|
9
|
+
}
|
|
10
|
+
generate() {
|
|
11
|
+
const analyzer = new MarkerStaticAnalyzer.MarkerStaticAnalyzer();
|
|
12
|
+
const collectedMarkers = analyzer.processChildren(this.sourceTree, this.environment);
|
|
13
|
+
if (collectedMarkers instanceof binding.EntityFieldMarkersContainer) {
|
|
14
|
+
throw new binding.BindingError();
|
|
15
|
+
}
|
|
16
|
+
if (collectedMarkers.fields.markers.size) {
|
|
17
|
+
throw new binding.BindingError();
|
|
18
|
+
}
|
|
19
|
+
if (collectedMarkers.parentReference !== void 0) {
|
|
20
|
+
throw new binding.BindingError();
|
|
21
|
+
}
|
|
22
|
+
if (collectedMarkers.subTrees === void 0) {
|
|
23
|
+
throw new binding.BindingError();
|
|
24
|
+
}
|
|
25
|
+
const subTrees = collectedMarkers.subTrees;
|
|
26
|
+
return new binding.MarkerTreeRoot(subTrees, this.generatePlaceholdersByAliases(subTrees));
|
|
27
|
+
}
|
|
28
|
+
generatePlaceholdersByAliases(hoistedSubTrees) {
|
|
29
|
+
const placeholders = /* @__PURE__ */ new Map();
|
|
30
|
+
for (const [placeholderName, subTree] of hoistedSubTrees) {
|
|
31
|
+
const aliases = subTree.parameters.alias;
|
|
32
|
+
if (aliases === void 0 || aliases.size === 0) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
for (const alias of aliases) {
|
|
36
|
+
const existingPlaceholder = placeholders.get(alias);
|
|
37
|
+
if (existingPlaceholder !== void 0) {
|
|
38
|
+
if (existingPlaceholder === placeholderName) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
throw new binding.BindingError(
|
|
42
|
+
`Detected the same sub-tree alias '${alias}' referring to sub-trees with different parameters!`
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
placeholders.set(alias, placeholderName);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return placeholders;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.MarkerTreeGenerator = MarkerTreeGenerator;
|
|
52
|
+
//# sourceMappingURL=MarkerTreeGenerator.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkerTreeGenerator.cjs","sources":["../../../../../packages/react-binding/src/markers/MarkerTreeGenerator.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Alias } from '@contember/binding'\nimport {\n\tBindingError,\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tEnvironment,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n} from '@contember/binding'\nimport { MarkerStaticAnalyzer } from './MarkerStaticAnalyzer'\n\ntype Markers = FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker | HasManyRelationMarker\n\nexport class MarkerTreeGenerator {\n\n\tpublic constructor(private sourceTree: ReactNode, private environment: Environment = Environment.create()) {}\n\n\tpublic generate(): MarkerTreeRoot {\n\t\tconst analyzer = new MarkerStaticAnalyzer()\n\t\tconst collectedMarkers = analyzer.processChildren(this.sourceTree, this.environment)\n\n\t\tif (collectedMarkers instanceof EntityFieldMarkersContainer) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.fields.markers.size) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.parentReference !== undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.subTrees === undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\n\t\tconst subTrees = collectedMarkers.subTrees\n\n\t\treturn new MarkerTreeRoot(subTrees, this.generatePlaceholdersByAliases(subTrees))\n\t}\n\n\tprivate generatePlaceholdersByAliases(\n\t\thoistedSubTrees: ReadonlyMap<string, EntitySubTreeMarker | EntityListSubTreeMarker>,\n\t): Map<Alias, string> {\n\t\tconst placeholders = new Map<Alias, string>()\n\n\t\tfor (const [placeholderName, subTree] of hoistedSubTrees) {\n\t\t\tconst aliases = subTree.parameters.alias\n\t\t\tif (aliases === undefined || aliases.size === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor (const alias of aliases) {\n\t\t\t\tconst existingPlaceholder = placeholders.get(alias)\n\t\t\t\tif (existingPlaceholder !== undefined) {\n\t\t\t\t\tif (existingPlaceholder === placeholderName) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Detected the same sub-tree alias '${alias}' referring to sub-trees with different parameters!`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tplaceholders.set(alias, placeholderName)\n\t\t\t}\n\t\t}\n\n\t\treturn placeholders\n\t}\n\n}\n"],"names":["Environment","MarkerStaticAnalyzer","EntityFieldMarkersContainer","BindingError","MarkerTreeRoot"],"mappings":";;;;AAkBO,MAAM,oBAAoB;AAAA,EAEzB,YAAoB,YAA+B,cAA2BA,QAAA,YAAY,UAAU;AAAhF,SAAA,aAAA;AAA+B,SAAA,cAAA;AAAA,EAAkD;AAAA,EAErG,WAA2B;AAC3B,UAAA,WAAW,IAAIC,qBAAAA;AACrB,UAAM,mBAAmB,SAAS,gBAAgB,KAAK,YAAY,KAAK,WAAW;AAEnF,QAAI,4BAA4BC,QAAAA,6BAA6B;AAC5D,YAAM,IAAIC,QAAa,aAAA;AAAA,IACxB;AACI,QAAA,iBAAiB,OAAO,QAAQ,MAAM;AACzC,YAAM,IAAIA,QAAa,aAAA;AAAA,IACxB;AACI,QAAA,iBAAiB,oBAAoB,QAAW;AACnD,YAAM,IAAIA,QAAa,aAAA;AAAA,IACxB;AACI,QAAA,iBAAiB,aAAa,QAAW;AAC5C,YAAM,IAAIA,QAAa,aAAA;AAAA,IACxB;AAEA,UAAM,WAAW,iBAAiB;AAElC,WAAO,IAAIC,QAAe,eAAA,UAAU,KAAK,8BAA8B,QAAQ,CAAC;AAAA,EACjF;AAAA,EAEQ,8BACP,iBACqB;AACf,UAAA,mCAAmB;AAEzB,eAAW,CAAC,iBAAiB,OAAO,KAAK,iBAAiB;AACnD,YAAA,UAAU,QAAQ,WAAW;AACnC,UAAI,YAAY,UAAa,QAAQ,SAAS,GAAG;AAChD;AAAA,MACD;AACA,iBAAW,SAAS,SAAS;AACtB,cAAA,sBAAsB,aAAa,IAAI,KAAK;AAClD,YAAI,wBAAwB,QAAW;AACtC,cAAI,wBAAwB,iBAAiB;AAC5C;AAAA,UACD;AACA,gBAAM,IAAID,QAAA;AAAA,YACT,qCAAqC,KAAK;AAAA,UAAA;AAAA,QAE5C;AACa,qBAAA,IAAI,OAAO,eAAe;AAAA,MACxC;AAAA,IACD;AAEO,WAAA;AAAA,EACR;AAED;;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Environment, EntityFieldMarkersContainer, BindingError, MarkerTreeRoot } from "@contember/binding";
|
|
2
|
+
import { MarkerStaticAnalyzer } from "./MarkerStaticAnalyzer.js";
|
|
3
|
+
class MarkerTreeGenerator {
|
|
4
|
+
constructor(sourceTree, environment = Environment.create()) {
|
|
5
|
+
this.sourceTree = sourceTree;
|
|
6
|
+
this.environment = environment;
|
|
7
|
+
}
|
|
8
|
+
generate() {
|
|
9
|
+
const analyzer = new MarkerStaticAnalyzer();
|
|
10
|
+
const collectedMarkers = analyzer.processChildren(this.sourceTree, this.environment);
|
|
11
|
+
if (collectedMarkers instanceof EntityFieldMarkersContainer) {
|
|
12
|
+
throw new BindingError();
|
|
13
|
+
}
|
|
14
|
+
if (collectedMarkers.fields.markers.size) {
|
|
15
|
+
throw new BindingError();
|
|
16
|
+
}
|
|
17
|
+
if (collectedMarkers.parentReference !== void 0) {
|
|
18
|
+
throw new BindingError();
|
|
19
|
+
}
|
|
20
|
+
if (collectedMarkers.subTrees === void 0) {
|
|
21
|
+
throw new BindingError();
|
|
22
|
+
}
|
|
23
|
+
const subTrees = collectedMarkers.subTrees;
|
|
24
|
+
return new MarkerTreeRoot(subTrees, this.generatePlaceholdersByAliases(subTrees));
|
|
25
|
+
}
|
|
26
|
+
generatePlaceholdersByAliases(hoistedSubTrees) {
|
|
27
|
+
const placeholders = /* @__PURE__ */ new Map();
|
|
28
|
+
for (const [placeholderName, subTree] of hoistedSubTrees) {
|
|
29
|
+
const aliases = subTree.parameters.alias;
|
|
30
|
+
if (aliases === void 0 || aliases.size === 0) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
for (const alias of aliases) {
|
|
34
|
+
const existingPlaceholder = placeholders.get(alias);
|
|
35
|
+
if (existingPlaceholder !== void 0) {
|
|
36
|
+
if (existingPlaceholder === placeholderName) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
throw new BindingError(
|
|
40
|
+
`Detected the same sub-tree alias '${alias}' referring to sub-trees with different parameters!`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
placeholders.set(alias, placeholderName);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return placeholders;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
MarkerTreeGenerator
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=MarkerTreeGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkerTreeGenerator.js","sources":["../../../../../packages/react-binding/src/markers/MarkerTreeGenerator.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Alias } from '@contember/binding'\nimport {\n\tBindingError,\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tEnvironment,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n} from '@contember/binding'\nimport { MarkerStaticAnalyzer } from './MarkerStaticAnalyzer'\n\ntype Markers = FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker | HasManyRelationMarker\n\nexport class MarkerTreeGenerator {\n\n\tpublic constructor(private sourceTree: ReactNode, private environment: Environment = Environment.create()) {}\n\n\tpublic generate(): MarkerTreeRoot {\n\t\tconst analyzer = new MarkerStaticAnalyzer()\n\t\tconst collectedMarkers = analyzer.processChildren(this.sourceTree, this.environment)\n\n\t\tif (collectedMarkers instanceof EntityFieldMarkersContainer) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.fields.markers.size) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.parentReference !== undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.subTrees === undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\n\t\tconst subTrees = collectedMarkers.subTrees\n\n\t\treturn new MarkerTreeRoot(subTrees, this.generatePlaceholdersByAliases(subTrees))\n\t}\n\n\tprivate generatePlaceholdersByAliases(\n\t\thoistedSubTrees: ReadonlyMap<string, EntitySubTreeMarker | EntityListSubTreeMarker>,\n\t): Map<Alias, string> {\n\t\tconst placeholders = new Map<Alias, string>()\n\n\t\tfor (const [placeholderName, subTree] of hoistedSubTrees) {\n\t\t\tconst aliases = subTree.parameters.alias\n\t\t\tif (aliases === undefined || aliases.size === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor (const alias of aliases) {\n\t\t\t\tconst existingPlaceholder = placeholders.get(alias)\n\t\t\t\tif (existingPlaceholder !== undefined) {\n\t\t\t\t\tif (existingPlaceholder === placeholderName) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Detected the same sub-tree alias '${alias}' referring to sub-trees with different parameters!`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tplaceholders.set(alias, placeholderName)\n\t\t\t}\n\t\t}\n\n\t\treturn placeholders\n\t}\n\n}\n"],"names":[],"mappings":";;AAkBO,MAAM,oBAAoB;AAAA,EAEzB,YAAoB,YAA+B,cAA2B,YAAY,UAAU;AAAhF,SAAA,aAAA;AAA+B,SAAA,cAAA;AAAA,EAAkD;AAAA,EAErG,WAA2B;AAC3B,UAAA,WAAW,IAAI;AACrB,UAAM,mBAAmB,SAAS,gBAAgB,KAAK,YAAY,KAAK,WAAW;AAEnF,QAAI,4BAA4B,6BAA6B;AAC5D,YAAM,IAAI,aAAa;AAAA,IACxB;AACI,QAAA,iBAAiB,OAAO,QAAQ,MAAM;AACzC,YAAM,IAAI,aAAa;AAAA,IACxB;AACI,QAAA,iBAAiB,oBAAoB,QAAW;AACnD,YAAM,IAAI,aAAa;AAAA,IACxB;AACI,QAAA,iBAAiB,aAAa,QAAW;AAC5C,YAAM,IAAI,aAAa;AAAA,IACxB;AAEA,UAAM,WAAW,iBAAiB;AAElC,WAAO,IAAI,eAAe,UAAU,KAAK,8BAA8B,QAAQ,CAAC;AAAA,EACjF;AAAA,EAEQ,8BACP,iBACqB;AACf,UAAA,mCAAmB;AAEzB,eAAW,CAAC,iBAAiB,OAAO,KAAK,iBAAiB;AACnD,YAAA,UAAU,QAAQ,WAAW;AACnC,UAAI,YAAY,UAAa,QAAQ,SAAS,GAAG;AAChD;AAAA,MACD;AACA,iBAAW,SAAS,SAAS;AACtB,cAAA,sBAAsB,aAAa,IAAI,KAAK;AAClD,YAAI,wBAAwB,QAAW;AACtC,cAAI,wBAAwB,iBAAiB;AAC5C;AAAA,UACD;AACA,gBAAM,IAAI;AAAA,YACT,qCAAqC,KAAK;AAAA,UAAA;AAAA,QAE5C;AACa,qBAAA,IAAI,OAAO,eAAe;AAAA,MACxC;AAAA,IACD;AAEO,WAAA;AAAA,EACR;AAED;"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const MarkerTreeGenerator = require("./src/MarkerTreeGenerator.cjs");
|
|
4
3
|
const binding = require("@contember/binding");
|
|
5
4
|
const AccessorTree = require("./src/accessorTree/AccessorTree.cjs");
|
|
6
|
-
const accessorTreeStateReducer = require("./src/accessorTree/accessorTreeStateReducer.cjs");
|
|
7
5
|
const DirtinessContext = require("./src/accessorTree/DirtinessContext.cjs");
|
|
8
6
|
const MutationStateContext = require("./src/accessorTree/MutationStateContext.cjs");
|
|
9
7
|
const useAccessorTreeState = require("./src/accessorTree/useAccessorTreeState.cjs");
|
|
@@ -40,11 +38,9 @@ const useGetTreeFilters = require("./src/accessorPropagation/useGetTreeFilters.c
|
|
|
40
38
|
const usePersist = require("./src/accessorPropagation/usePersist.cjs");
|
|
41
39
|
const useTreeRootId = require("./src/accessorPropagation/useTreeRootId.cjs");
|
|
42
40
|
const addEntityAtIndex = require("./src/accessorSorting/addEntityAtIndex.cjs");
|
|
43
|
-
const moveEntity = require("./src/accessorSorting/moveEntity.cjs");
|
|
44
41
|
const repairEntitiesOrder = require("./src/accessorSorting/repairEntitiesOrder.cjs");
|
|
45
42
|
const SetOrderFieldOnCreate = require("./src/accessorSorting/SetOrderFieldOnCreate.cjs");
|
|
46
43
|
const sortEntities = require("./src/accessorSorting/sortEntities.cjs");
|
|
47
|
-
const useSortedEntities = require("./src/accessorSorting/useSortedEntities.cjs");
|
|
48
44
|
const Component = require("./src/coreComponents/Component.cjs");
|
|
49
45
|
const DataBindingProvider = require("./src/coreComponents/DataBindingProvider.cjs");
|
|
50
46
|
const Entity = require("./src/coreComponents/Entity.cjs");
|
|
@@ -71,9 +67,8 @@ const LabelMiddleware = require("./src/helperComponents/LabelMiddleware.cjs");
|
|
|
71
67
|
const StaticRender = require("./src/helperComponents/StaticRender.cjs");
|
|
72
68
|
const SugaredField = require("./src/helperComponents/SugaredField.cjs");
|
|
73
69
|
const Variable = require("./src/helperComponents/Variable.cjs");
|
|
74
|
-
|
|
70
|
+
const MarkerTreeGenerator = require("./src/markers/MarkerTreeGenerator.cjs");
|
|
75
71
|
exports.AccessorTree = AccessorTree.AccessorTree;
|
|
76
|
-
exports.accessorTreeStateReducer = accessorTreeStateReducer.accessorTreeStateReducer;
|
|
77
72
|
exports.DirtinessContext = DirtinessContext.DirtinessContext;
|
|
78
73
|
exports.MutationStateContext = MutationStateContext.MutationStateContext;
|
|
79
74
|
exports.useAccessorTreeState = useAccessorTreeState.useAccessorTreeState;
|
|
@@ -112,12 +107,9 @@ exports.useGetTreeFilters = useGetTreeFilters.useGetTreeFilters;
|
|
|
112
107
|
exports.usePersist = usePersist.usePersist;
|
|
113
108
|
exports.useTreeRootId = useTreeRootId.useTreeRootId;
|
|
114
109
|
exports.addEntityAtIndex = addEntityAtIndex.addEntityAtIndex;
|
|
115
|
-
exports.moveEntity = moveEntity.moveEntity;
|
|
116
|
-
exports.moveEntityInArray = moveEntity.moveEntityInArray;
|
|
117
110
|
exports.repairEntitiesOrder = repairEntitiesOrder.repairEntitiesOrder;
|
|
118
111
|
exports.SetOrderFieldOnCreate = SetOrderFieldOnCreate.SetOrderFieldOnCreate;
|
|
119
112
|
exports.sortEntities = sortEntities.sortEntities;
|
|
120
|
-
exports.useSortedEntities = useSortedEntities.useSortedEntities;
|
|
121
113
|
exports.Component = Component.Component;
|
|
122
114
|
exports.DataBindingProvider = DataBindingProvider.DataBindingProvider;
|
|
123
115
|
exports.Entity = Entity.Entity;
|
|
@@ -146,6 +138,7 @@ exports.useLabelMiddleware = LabelMiddleware.useLabelMiddleware;
|
|
|
146
138
|
exports.StaticRender = StaticRender.StaticRender;
|
|
147
139
|
exports.SugaredField = SugaredField.SugaredField;
|
|
148
140
|
exports.Variable = Variable.Variable;
|
|
141
|
+
exports.MarkerTreeGenerator = MarkerTreeGenerator.MarkerTreeGenerator;
|
|
149
142
|
Object.keys(binding).forEach((k) => {
|
|
150
143
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
151
144
|
enumerable: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/production/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { MarkerTreeGenerator } from "./src/MarkerTreeGenerator.js";
|
|
2
1
|
export * from "@contember/binding";
|
|
3
2
|
import { AccessorTree } from "./src/accessorTree/AccessorTree.js";
|
|
4
|
-
import { accessorTreeStateReducer } from "./src/accessorTree/accessorTreeStateReducer.js";
|
|
5
3
|
import { DirtinessContext } from "./src/accessorTree/DirtinessContext.js";
|
|
6
4
|
import { MutationStateContext } from "./src/accessorTree/MutationStateContext.js";
|
|
7
5
|
import { useAccessorTreeState } from "./src/accessorTree/useAccessorTreeState.js";
|
|
@@ -38,11 +36,9 @@ import { useGetTreeFilters } from "./src/accessorPropagation/useGetTreeFilters.j
|
|
|
38
36
|
import { usePersist } from "./src/accessorPropagation/usePersist.js";
|
|
39
37
|
import { useTreeRootId } from "./src/accessorPropagation/useTreeRootId.js";
|
|
40
38
|
import { addEntityAtIndex } from "./src/accessorSorting/addEntityAtIndex.js";
|
|
41
|
-
import { moveEntity, moveEntityInArray } from "./src/accessorSorting/moveEntity.js";
|
|
42
39
|
import { repairEntitiesOrder } from "./src/accessorSorting/repairEntitiesOrder.js";
|
|
43
40
|
import { SetOrderFieldOnCreate } from "./src/accessorSorting/SetOrderFieldOnCreate.js";
|
|
44
41
|
import { sortEntities } from "./src/accessorSorting/sortEntities.js";
|
|
45
|
-
import { useSortedEntities } from "./src/accessorSorting/useSortedEntities.js";
|
|
46
42
|
import { Component } from "./src/coreComponents/Component.js";
|
|
47
43
|
import { DataBindingProvider } from "./src/coreComponents/DataBindingProvider.js";
|
|
48
44
|
import { Entity } from "./src/coreComponents/Entity.js";
|
|
@@ -69,6 +65,7 @@ import { LabelMiddlewareContext, LabelMiddlewareProvider, useLabelMiddleware } f
|
|
|
69
65
|
import { StaticRender } from "./src/helperComponents/StaticRender.js";
|
|
70
66
|
import { SugaredField } from "./src/helperComponents/SugaredField.js";
|
|
71
67
|
import { Variable } from "./src/helperComponents/Variable.js";
|
|
68
|
+
import { MarkerTreeGenerator } from "./src/markers/MarkerTreeGenerator.js";
|
|
72
69
|
export {
|
|
73
70
|
AccessorProvider,
|
|
74
71
|
AccessorTree,
|
|
@@ -102,10 +99,7 @@ export {
|
|
|
102
99
|
SugaredField,
|
|
103
100
|
TreeRootIdProvider,
|
|
104
101
|
Variable,
|
|
105
|
-
accessorTreeStateReducer,
|
|
106
102
|
addEntityAtIndex,
|
|
107
|
-
moveEntity,
|
|
108
|
-
moveEntityInArray,
|
|
109
103
|
repairEntitiesOrder,
|
|
110
104
|
sortEntities,
|
|
111
105
|
useAccessorTreeState,
|
|
@@ -143,7 +137,6 @@ export {
|
|
|
143
137
|
useMutationState,
|
|
144
138
|
useOnConnectionUpdate,
|
|
145
139
|
usePersist,
|
|
146
|
-
useSortedEntities,
|
|
147
140
|
useTreeRootId
|
|
148
141
|
};
|
|
149
142
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -4,7 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const EntityKeyContext = require("./EntityKeyContext.cjs");
|
|
5
5
|
const EnvironmentContext = require("./EnvironmentContext.cjs");
|
|
6
6
|
function AccessorProvider(props) {
|
|
7
|
-
return /* @__PURE__ */ jsxRuntime.jsx(EntityKeyContext.EntityKeyContext.Provider, { value: props.accessor.key, children: /* @__PURE__ */ jsxRuntime.jsx(EnvironmentContext.EnvironmentContext.Provider, { value: props.accessor.environment, children: props.children }) });
|
|
7
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EntityKeyContext.EntityKeyContext.Provider, { value: props.accessor.key ?? props.accessor.getAccessor, children: /* @__PURE__ */ jsxRuntime.jsx(EnvironmentContext.EnvironmentContext.Provider, { value: props.accessor.environment, children: props.children }) });
|
|
8
8
|
}
|
|
9
9
|
exports.AccessorProvider = AccessorProvider;
|
|
10
10
|
//# sourceMappingURL=AccessorProvider.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccessorProvider.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/AccessorProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { EntityAccessor } from '@contember/binding'\nimport { EntityKeyContext } from './EntityKeyContext'\nimport { EnvironmentContext } from './EnvironmentContext'\n\nexport interface EntityProviderProps {\n\taccessor: EntityAccessor\n\tchildren: ReactNode\n}\n\nexport function AccessorProvider(props: EntityProviderProps) {\n\treturn (\n\t\t<EntityKeyContext.Provider value={props.accessor.key}>\n\t\t\t<EnvironmentContext.Provider value={props.accessor.environment}>{props.children}</EnvironmentContext.Provider>\n\t\t</EntityKeyContext.Provider>\n\t)\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"AccessorProvider.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/AccessorProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { EntityAccessor } from '@contember/binding'\nimport { EntityKeyContext } from './EntityKeyContext'\nimport { EnvironmentContext } from './EnvironmentContext'\n\nexport interface EntityProviderProps {\n\taccessor: EntityAccessor\n\tchildren: ReactNode\n}\n\nexport function AccessorProvider(props: EntityProviderProps) {\n\treturn (\n\t\t<EntityKeyContext.Provider value={props.accessor.key ?? props.accessor.getAccessor}>\n\t\t\t<EnvironmentContext.Provider value={props.accessor.environment}>{props.children}</EnvironmentContext.Provider>\n\t\t</EntityKeyContext.Provider>\n\t)\n}\n"],"names":["jsx","EntityKeyContext","EnvironmentContext"],"mappings":";;;;;AAUO,SAAS,iBAAiB,OAA4B;AAE3D,SAAAA,+BAACC,iBAAAA,iBAAiB,UAAjB,EAA0B,OAAO,MAAM,SAAS,OAAO,MAAM,SAAS,aACtE,UAACD,+BAAAE,mBAAAA,mBAAmB,UAAnB,EAA4B,OAAO,MAAM,SAAS,aAAc,UAAM,MAAA,SAAS,CAAA,EACjF,CAAA;AAEF;;"}
|
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { EntityKeyContext } from "./EntityKeyContext.js";
|
|
3
3
|
import { EnvironmentContext } from "./EnvironmentContext.js";
|
|
4
4
|
function AccessorProvider(props) {
|
|
5
|
-
return /* @__PURE__ */ jsx(EntityKeyContext.Provider, { value: props.accessor.key, children: /* @__PURE__ */ jsx(EnvironmentContext.Provider, { value: props.accessor.environment, children: props.children }) });
|
|
5
|
+
return /* @__PURE__ */ jsx(EntityKeyContext.Provider, { value: props.accessor.key ?? props.accessor.getAccessor, children: /* @__PURE__ */ jsx(EnvironmentContext.Provider, { value: props.accessor.environment, children: props.children }) });
|
|
6
6
|
}
|
|
7
7
|
export {
|
|
8
8
|
AccessorProvider
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccessorProvider.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/AccessorProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { EntityAccessor } from '@contember/binding'\nimport { EntityKeyContext } from './EntityKeyContext'\nimport { EnvironmentContext } from './EnvironmentContext'\n\nexport interface EntityProviderProps {\n\taccessor: EntityAccessor\n\tchildren: ReactNode\n}\n\nexport function AccessorProvider(props: EntityProviderProps) {\n\treturn (\n\t\t<EntityKeyContext.Provider value={props.accessor.key}>\n\t\t\t<EnvironmentContext.Provider value={props.accessor.environment}>{props.children}</EnvironmentContext.Provider>\n\t\t</EntityKeyContext.Provider>\n\t)\n}\n"],"names":[],"mappings":";;;AAUO,SAAS,iBAAiB,OAA4B;
|
|
1
|
+
{"version":3,"file":"AccessorProvider.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/AccessorProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { EntityAccessor } from '@contember/binding'\nimport { EntityKeyContext } from './EntityKeyContext'\nimport { EnvironmentContext } from './EnvironmentContext'\n\nexport interface EntityProviderProps {\n\taccessor: EntityAccessor\n\tchildren: ReactNode\n}\n\nexport function AccessorProvider(props: EntityProviderProps) {\n\treturn (\n\t\t<EntityKeyContext.Provider value={props.accessor.key ?? props.accessor.getAccessor}>\n\t\t\t<EnvironmentContext.Provider value={props.accessor.environment}>{props.children}</EnvironmentContext.Provider>\n\t\t</EntityKeyContext.Provider>\n\t)\n}\n"],"names":[],"mappings":";;;AAUO,SAAS,iBAAiB,OAA4B;AAE3D,SAAA,oBAAC,iBAAiB,UAAjB,EAA0B,OAAO,MAAM,SAAS,OAAO,MAAM,SAAS,aACtE,UAAC,oBAAA,mBAAmB,UAAnB,EAA4B,OAAO,MAAM,SAAS,aAAc,UAAM,MAAA,SAAS,CAAA,EACjF,CAAA;AAEF;"}
|
|
@@ -23,7 +23,8 @@ const defaultBindingOperations = Object.freeze({
|
|
|
23
23
|
getTreeFilters: getRejecter("retrieve tree filters"),
|
|
24
24
|
batchDeferredUpdates: getRejecter("batch deferred updates"),
|
|
25
25
|
extendTree: getRejecter("extendTree"),
|
|
26
|
-
persist: getRejecter("persist")
|
|
26
|
+
persist: getRejecter("persist"),
|
|
27
|
+
fetchData: getRejecter("fetchData")
|
|
27
28
|
});
|
|
28
29
|
const BindingOperationsContext = React.createContext(defaultBindingOperations);
|
|
29
30
|
exports.BindingOperationsContext = BindingOperationsContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BindingOperationsContext.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/BindingOperationsContext.ts"],"sourcesContent":["import { createContext, ReactNode } from 'react'\nimport type { BindingOperations } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nconst getRejecter = (operation: string) => () => {\n\tthrow new BindingError(\n\t\t`Trying to ${operation} but data binding is unavailable. You likely used a bound component outside ` +\n\t\t\t`<DataBindingProvider /> or it tried to reach its accessor whilst the tree was in an non-interactive state ` +\n\t\t\t`(e.g. still loading).`,\n\t)\n}\n\nexport const defaultBindingOperations = Object.freeze<BindingOperations<ReactNode>>({\n\tget contentClient() {\n\t\treturn getRejecter('retrieve the content api client')()\n\t},\n\tget systemClient() {\n\t\treturn getRejecter('retrieve the system api client')()\n\t},\n\tget tenantClient() {\n\t\treturn getRejecter('retrieve the tenant api client')()\n\t},\n\tgetEntityListSubTree: getRejecter('retrieve an entity list sub tree'),\n\tgetEntitySubTree: getRejecter('retrieve a single entity sub tree'),\n\tgetEntityByKey: getRejecter('retrieve an entity by key'),\n\tgetTreeFilters: getRejecter('retrieve tree filters'),\n\tbatchDeferredUpdates: getRejecter('batch deferred updates'),\n\textendTree: getRejecter('extendTree'),\n\tpersist: getRejecter('persist'),\n})\n\nexport const BindingOperationsContext = createContext<BindingOperations<ReactNode>>(defaultBindingOperations)\n"],"names":["BindingError","createContext"],"mappings":";;;;AAIA,MAAM,cAAc,CAAC,cAAsB,MAAM;AAChD,QAAM,IAAIA,QAAA;AAAA,IACT,aAAa,SAAS;AAAA,EAAA;AAIxB;AAEa,MAAA,2BAA2B,OAAO,OAAqC;AAAA,EACnF,IAAI,gBAAgB;AACZ,WAAA,YAAY,iCAAiC;EACrD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,sBAAsB,YAAY,kCAAkC;AAAA,EACpE,kBAAkB,YAAY,mCAAmC;AAAA,EACjE,gBAAgB,YAAY,2BAA2B;AAAA,EACvD,gBAAgB,YAAY,uBAAuB;AAAA,EACnD,sBAAsB,YAAY,wBAAwB;AAAA,EAC1D,YAAY,YAAY,YAAY;AAAA,EACpC,SAAS,YAAY,SAAS;
|
|
1
|
+
{"version":3,"file":"BindingOperationsContext.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/BindingOperationsContext.ts"],"sourcesContent":["import { createContext, ReactNode } from 'react'\nimport type { BindingOperations } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nconst getRejecter = (operation: string) => () => {\n\tthrow new BindingError(\n\t\t`Trying to ${operation} but data binding is unavailable. You likely used a bound component outside ` +\n\t\t\t`<DataBindingProvider /> or it tried to reach its accessor whilst the tree was in an non-interactive state ` +\n\t\t\t`(e.g. still loading).`,\n\t)\n}\n\nexport const defaultBindingOperations = Object.freeze<BindingOperations<ReactNode>>({\n\tget contentClient() {\n\t\treturn getRejecter('retrieve the content api client')()\n\t},\n\tget systemClient() {\n\t\treturn getRejecter('retrieve the system api client')()\n\t},\n\tget tenantClient() {\n\t\treturn getRejecter('retrieve the tenant api client')()\n\t},\n\tgetEntityListSubTree: getRejecter('retrieve an entity list sub tree'),\n\tgetEntitySubTree: getRejecter('retrieve a single entity sub tree'),\n\tgetEntityByKey: getRejecter('retrieve an entity by key'),\n\tgetTreeFilters: getRejecter('retrieve tree filters'),\n\tbatchDeferredUpdates: getRejecter('batch deferred updates'),\n\textendTree: getRejecter('extendTree'),\n\tpersist: getRejecter('persist'),\n\tfetchData: getRejecter('fetchData'),\n})\n\nexport const BindingOperationsContext = createContext<BindingOperations<ReactNode>>(defaultBindingOperations)\n"],"names":["BindingError","createContext"],"mappings":";;;;AAIA,MAAM,cAAc,CAAC,cAAsB,MAAM;AAChD,QAAM,IAAIA,QAAA;AAAA,IACT,aAAa,SAAS;AAAA,EAAA;AAIxB;AAEa,MAAA,2BAA2B,OAAO,OAAqC;AAAA,EACnF,IAAI,gBAAgB;AACZ,WAAA,YAAY,iCAAiC;EACrD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,sBAAsB,YAAY,kCAAkC;AAAA,EACpE,kBAAkB,YAAY,mCAAmC;AAAA,EACjE,gBAAgB,YAAY,2BAA2B;AAAA,EACvD,gBAAgB,YAAY,uBAAuB;AAAA,EACnD,sBAAsB,YAAY,wBAAwB;AAAA,EAC1D,YAAY,YAAY,YAAY;AAAA,EACpC,SAAS,YAAY,SAAS;AAAA,EAC9B,WAAW,YAAY,WAAW;AACnC,CAAC;AAEY,MAAA,2BAA2BC,oBAA4C,wBAAwB;;;"}
|
|
@@ -21,7 +21,8 @@ const defaultBindingOperations = Object.freeze({
|
|
|
21
21
|
getTreeFilters: getRejecter("retrieve tree filters"),
|
|
22
22
|
batchDeferredUpdates: getRejecter("batch deferred updates"),
|
|
23
23
|
extendTree: getRejecter("extendTree"),
|
|
24
|
-
persist: getRejecter("persist")
|
|
24
|
+
persist: getRejecter("persist"),
|
|
25
|
+
fetchData: getRejecter("fetchData")
|
|
25
26
|
});
|
|
26
27
|
const BindingOperationsContext = createContext(defaultBindingOperations);
|
|
27
28
|
export {
|