@veridid/workflow-ui 0.0.0-stage → 0.1.0
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/LICENSE +202 -0
- package/README.md +202 -2
- package/build/module/WorkflowFontScaleContext.js +67 -0
- package/build/module/WorkflowFontScaleContext.js.map +1 -0
- package/build/module/adapter/WalletAdapter.js +152 -0
- package/build/module/adapter/WalletAdapter.js.map +1 -0
- package/build/module/components/FallbackVideoPlayer.js +8 -0
- package/build/module/components/FallbackVideoPlayer.js.map +1 -0
- package/build/module/components/FallbackVideoPlayer.native.js +10 -0
- package/build/module/components/FallbackVideoPlayer.native.js.map +1 -0
- package/build/module/components/FallbackVideoPlayer.web.js +35 -0
- package/build/module/components/FallbackVideoPlayer.web.js.map +1 -0
- package/build/module/components/WorkflowButtonLabel.js +32 -0
- package/build/module/components/WorkflowButtonLabel.js.map +1 -0
- package/build/module/components/WorkflowCalendarIcon.js +73 -0
- package/build/module/components/WorkflowCalendarIcon.js.map +1 -0
- package/build/module/components/WorkflowText.js +92 -0
- package/build/module/components/WorkflowText.js.map +1 -0
- package/build/module/content/BadgeContent.js +73 -0
- package/build/module/content/BadgeContent.js.map +1 -0
- package/build/module/content/BarChartContent.js +97 -0
- package/build/module/content/BarChartContent.js.map +1 -0
- package/build/module/content/BarcodeContent.js +78 -0
- package/build/module/content/BarcodeContent.js.map +1 -0
- package/build/module/content/BasicTableContent.js +145 -0
- package/build/module/content/BasicTableContent.js.map +1 -0
- package/build/module/content/ButtonContent.js +130 -0
- package/build/module/content/ButtonContent.js.map +1 -0
- package/build/module/content/CalendarContent.js +173 -0
- package/build/module/content/CalendarContent.js.map +1 -0
- package/build/module/content/CardContent.js +114 -0
- package/build/module/content/CardContent.js.map +1 -0
- package/build/module/content/CarouselContent.js +173 -0
- package/build/module/content/CarouselContent.js.map +1 -0
- package/build/module/content/ChipContent.js +214 -0
- package/build/module/content/ChipContent.js.map +1 -0
- package/build/module/content/ChipRowContent.js +127 -0
- package/build/module/content/ChipRowContent.js.map +1 -0
- package/build/module/content/CredentialOfferContent.js +312 -0
- package/build/module/content/CredentialOfferContent.js.map +1 -0
- package/build/module/content/DialContent.js +101 -0
- package/build/module/content/DialContent.js.map +1 -0
- package/build/module/content/DividerContent.js +26 -0
- package/build/module/content/DividerContent.js.map +1 -0
- package/build/module/content/DonutChartContent.js +118 -0
- package/build/module/content/DonutChartContent.js.map +1 -0
- package/build/module/content/FormContent.js +141 -0
- package/build/module/content/FormContent.js.map +1 -0
- package/build/module/content/FormFieldBridge.js +157 -0
- package/build/module/content/FormFieldBridge.js.map +1 -0
- package/build/module/content/GaugeContent.js +77 -0
- package/build/module/content/GaugeContent.js.map +1 -0
- package/build/module/content/GridLayoutContent.js +227 -0
- package/build/module/content/GridLayoutContent.js.map +1 -0
- package/build/module/content/ImageContent.js +190 -0
- package/build/module/content/ImageContent.js.map +1 -0
- package/build/module/content/ListContent.js +107 -0
- package/build/module/content/ListContent.js.map +1 -0
- package/build/module/content/LocationContent.js +148 -0
- package/build/module/content/LocationContent.js.map +1 -0
- package/build/module/content/MapContent.js +213 -0
- package/build/module/content/MapContent.js.map +1 -0
- package/build/module/content/MultipleChoiceContent.js +91 -0
- package/build/module/content/MultipleChoiceContent.js.map +1 -0
- package/build/module/content/OpenBadgePreviewContent.js +141 -0
- package/build/module/content/OpenBadgePreviewContent.js.map +1 -0
- package/build/module/content/PhotoContent.js +154 -0
- package/build/module/content/PhotoContent.js.map +1 -0
- package/build/module/content/PieChartContent.js +129 -0
- package/build/module/content/PieChartContent.js.map +1 -0
- package/build/module/content/ProofPresentationContent.js +154 -0
- package/build/module/content/ProofPresentationContent.js.map +1 -0
- package/build/module/content/RadioButtonContent.js +136 -0
- package/build/module/content/RadioButtonContent.js.map +1 -0
- package/build/module/content/RowContent.js +539 -0
- package/build/module/content/RowContent.js.map +1 -0
- package/build/module/content/SectionContent.js +123 -0
- package/build/module/content/SectionContent.js.map +1 -0
- package/build/module/content/ShareEntryContent.js +111 -0
- package/build/module/content/ShareEntryContent.js.map +1 -0
- package/build/module/content/SimulatedHint.js +33 -0
- package/build/module/content/SimulatedHint.js.map +1 -0
- package/build/module/content/SliderContent.js +46 -0
- package/build/module/content/SliderContent.js.map +1 -0
- package/build/module/content/SpacerContent.js +21 -0
- package/build/module/content/SpacerContent.js.map +1 -0
- package/build/module/content/SpinnerContent.js +33 -0
- package/build/module/content/SpinnerContent.js.map +1 -0
- package/build/module/content/SubmitButtonContent.js +281 -0
- package/build/module/content/SubmitButtonContent.js.map +1 -0
- package/build/module/content/TextContent.js +127 -0
- package/build/module/content/TextContent.js.map +1 -0
- package/build/module/content/TileContent.js +237 -0
- package/build/module/content/TileContent.js.map +1 -0
- package/build/module/content/TimelineContent.js +120 -0
- package/build/module/content/TimelineContent.js.map +1 -0
- package/build/module/content/TitleContent.js +55 -0
- package/build/module/content/TitleContent.js.map +1 -0
- package/build/module/content/VideoContent.js +142 -0
- package/build/module/content/VideoContent.js.map +1 -0
- package/build/module/content/WebLinkContent.js +95 -0
- package/build/module/content/WebLinkContent.js.map +1 -0
- package/build/module/content/index.js +48 -0
- package/build/module/content/index.js.map +1 -0
- package/build/module/form-fields/CheckboxField.js +47 -0
- package/build/module/form-fields/CheckboxField.js.map +1 -0
- package/build/module/form-fields/DateField.js +8 -0
- package/build/module/form-fields/DateField.js.map +1 -0
- package/build/module/form-fields/DateField.native.js +141 -0
- package/build/module/form-fields/DateField.native.js.map +1 -0
- package/build/module/form-fields/DateField.web.js +45 -0
- package/build/module/form-fields/DateField.web.js.map +1 -0
- package/build/module/form-fields/DropdownField.js +172 -0
- package/build/module/form-fields/DropdownField.js.map +1 -0
- package/build/module/form-fields/MCQField.js +100 -0
- package/build/module/form-fields/MCQField.js.map +1 -0
- package/build/module/form-fields/RadioField.js +56 -0
- package/build/module/form-fields/RadioField.js.map +1 -0
- package/build/module/form-fields/SliderField.js +8 -0
- package/build/module/form-fields/SliderField.js.map +1 -0
- package/build/module/form-fields/SliderField.native.js +77 -0
- package/build/module/form-fields/SliderField.native.js.map +1 -0
- package/build/module/form-fields/SliderField.web.js +82 -0
- package/build/module/form-fields/SliderField.web.js.map +1 -0
- package/build/module/form-fields/SubmitButtonField.js +42 -0
- package/build/module/form-fields/SubmitButtonField.js.map +1 -0
- package/build/module/form-fields/TextField.js +56 -0
- package/build/module/form-fields/TextField.js.map +1 -0
- package/build/module/form-fields/index.js +15 -0
- package/build/module/form-fields/index.js.map +1 -0
- package/build/module/i18n/WorkflowI18n.js +94 -0
- package/build/module/i18n/WorkflowI18n.js.map +1 -0
- package/build/module/icons/WorkflowIcon.js +50 -0
- package/build/module/icons/WorkflowIcon.js.map +1 -0
- package/build/module/imageUriCache.js +25 -0
- package/build/module/imageUriCache.js.map +1 -0
- package/build/module/index.js +49 -0
- package/build/module/index.js.map +1 -0
- package/build/module/modal/WorkflowModal.js +115 -0
- package/build/module/modal/WorkflowModal.js.map +1 -0
- package/build/module/package.json +1 -0
- package/build/module/platform/platformName.js +10 -0
- package/build/module/platform/platformName.js.map +1 -0
- package/build/module/platform/platformName.web.js +5 -0
- package/build/module/platform/platformName.web.js.map +1 -0
- package/build/module/protocol/controlSnapshotStore.js +19 -0
- package/build/module/protocol/controlSnapshotStore.js.map +1 -0
- package/build/module/protocol/useProtocolExchange.js +168 -0
- package/build/module/protocol/useProtocolExchange.js.map +1 -0
- package/build/module/registries/ContentRegistry.js +53 -0
- package/build/module/registries/ContentRegistry.js.map +1 -0
- package/build/module/registries/FormFieldRegistry.js +56 -0
- package/build/module/registries/FormFieldRegistry.js.map +1 -0
- package/build/module/render/NodeBoundary.js +73 -0
- package/build/module/render/NodeBoundary.js.map +1 -0
- package/build/module/render/RenderTree.js +52 -0
- package/build/module/render/RenderTree.js.map +1 -0
- package/build/module/render/WorkflowRenderContext.js +34 -0
- package/build/module/render/WorkflowRenderContext.js.map +1 -0
- package/build/module/render/nodes.js +103 -0
- package/build/module/render/nodes.js.map +1 -0
- package/build/module/responsive/ResponsiveProvider.js +63 -0
- package/build/module/responsive/ResponsiveProvider.js.map +1 -0
- package/build/module/responsive/index.js +4 -0
- package/build/module/responsive/index.js.map +1 -0
- package/build/module/responsive/responsive.js +56 -0
- package/build/module/responsive/responsive.js.map +1 -0
- package/build/module/style/resolveDisplayHintStyle.js +145 -0
- package/build/module/style/resolveDisplayHintStyle.js.map +1 -0
- package/build/module/theme/WorkflowTheme.js +200 -0
- package/build/module/theme/WorkflowTheme.js.map +1 -0
- package/build/module/utils/testable.js +12 -0
- package/build/module/utils/testable.js.map +1 -0
- package/build/typescript/WorkflowFontScaleContext.d.ts +7 -0
- package/build/typescript/WorkflowFontScaleContext.d.ts.map +1 -0
- package/build/typescript/adapter/WalletAdapter.d.ts +145 -0
- package/build/typescript/adapter/WalletAdapter.d.ts.map +1 -0
- package/build/typescript/components/FallbackVideoPlayer.d.ts +6 -0
- package/build/typescript/components/FallbackVideoPlayer.d.ts.map +1 -0
- package/build/typescript/components/FallbackVideoPlayer.native.d.ts +7 -0
- package/build/typescript/components/FallbackVideoPlayer.native.d.ts.map +1 -0
- package/build/typescript/components/FallbackVideoPlayer.web.d.ts +9 -0
- package/build/typescript/components/FallbackVideoPlayer.web.d.ts.map +1 -0
- package/build/typescript/components/WorkflowButtonLabel.d.ts +11 -0
- package/build/typescript/components/WorkflowButtonLabel.d.ts.map +1 -0
- package/build/typescript/components/WorkflowCalendarIcon.d.ts +11 -0
- package/build/typescript/components/WorkflowCalendarIcon.d.ts.map +1 -0
- package/build/typescript/components/WorkflowText.d.ts +13 -0
- package/build/typescript/components/WorkflowText.d.ts.map +1 -0
- package/build/typescript/content/BadgeContent.d.ts +5 -0
- package/build/typescript/content/BadgeContent.d.ts.map +1 -0
- package/build/typescript/content/BarChartContent.d.ts +5 -0
- package/build/typescript/content/BarChartContent.d.ts.map +1 -0
- package/build/typescript/content/BarcodeContent.d.ts +11 -0
- package/build/typescript/content/BarcodeContent.d.ts.map +1 -0
- package/build/typescript/content/BasicTableContent.d.ts +5 -0
- package/build/typescript/content/BasicTableContent.d.ts.map +1 -0
- package/build/typescript/content/ButtonContent.d.ts +5 -0
- package/build/typescript/content/ButtonContent.d.ts.map +1 -0
- package/build/typescript/content/CalendarContent.d.ts +19 -0
- package/build/typescript/content/CalendarContent.d.ts.map +1 -0
- package/build/typescript/content/CardContent.d.ts +5 -0
- package/build/typescript/content/CardContent.d.ts.map +1 -0
- package/build/typescript/content/CarouselContent.d.ts +5 -0
- package/build/typescript/content/CarouselContent.d.ts.map +1 -0
- package/build/typescript/content/ChipContent.d.ts +5 -0
- package/build/typescript/content/ChipContent.d.ts.map +1 -0
- package/build/typescript/content/ChipRowContent.d.ts +8 -0
- package/build/typescript/content/ChipRowContent.d.ts.map +1 -0
- package/build/typescript/content/CredentialOfferContent.d.ts +98 -0
- package/build/typescript/content/CredentialOfferContent.d.ts.map +1 -0
- package/build/typescript/content/DialContent.d.ts +5 -0
- package/build/typescript/content/DialContent.d.ts.map +1 -0
- package/build/typescript/content/DividerContent.d.ts +5 -0
- package/build/typescript/content/DividerContent.d.ts.map +1 -0
- package/build/typescript/content/DonutChartContent.d.ts +5 -0
- package/build/typescript/content/DonutChartContent.d.ts.map +1 -0
- package/build/typescript/content/FormContent.d.ts +19 -0
- package/build/typescript/content/FormContent.d.ts.map +1 -0
- package/build/typescript/content/FormFieldBridge.d.ts +2 -0
- package/build/typescript/content/FormFieldBridge.d.ts.map +1 -0
- package/build/typescript/content/GaugeContent.d.ts +5 -0
- package/build/typescript/content/GaugeContent.d.ts.map +1 -0
- package/build/typescript/content/GridLayoutContent.d.ts +5 -0
- package/build/typescript/content/GridLayoutContent.d.ts.map +1 -0
- package/build/typescript/content/ImageContent.d.ts +5 -0
- package/build/typescript/content/ImageContent.d.ts.map +1 -0
- package/build/typescript/content/ListContent.d.ts +5 -0
- package/build/typescript/content/ListContent.d.ts.map +1 -0
- package/build/typescript/content/LocationContent.d.ts +32 -0
- package/build/typescript/content/LocationContent.d.ts.map +1 -0
- package/build/typescript/content/MapContent.d.ts +11 -0
- package/build/typescript/content/MapContent.d.ts.map +1 -0
- package/build/typescript/content/MultipleChoiceContent.d.ts +5 -0
- package/build/typescript/content/MultipleChoiceContent.d.ts.map +1 -0
- package/build/typescript/content/OpenBadgePreviewContent.d.ts +14 -0
- package/build/typescript/content/OpenBadgePreviewContent.d.ts.map +1 -0
- package/build/typescript/content/PhotoContent.d.ts +57 -0
- package/build/typescript/content/PhotoContent.d.ts.map +1 -0
- package/build/typescript/content/PieChartContent.d.ts +5 -0
- package/build/typescript/content/PieChartContent.d.ts.map +1 -0
- package/build/typescript/content/ProofPresentationContent.d.ts +14 -0
- package/build/typescript/content/ProofPresentationContent.d.ts.map +1 -0
- package/build/typescript/content/RadioButtonContent.d.ts +5 -0
- package/build/typescript/content/RadioButtonContent.d.ts.map +1 -0
- package/build/typescript/content/RowContent.d.ts +5 -0
- package/build/typescript/content/RowContent.d.ts.map +1 -0
- package/build/typescript/content/SectionContent.d.ts +5 -0
- package/build/typescript/content/SectionContent.d.ts.map +1 -0
- package/build/typescript/content/ShareEntryContent.d.ts +15 -0
- package/build/typescript/content/ShareEntryContent.d.ts.map +1 -0
- package/build/typescript/content/SimulatedHint.d.ts +9 -0
- package/build/typescript/content/SimulatedHint.d.ts.map +1 -0
- package/build/typescript/content/SliderContent.d.ts +10 -0
- package/build/typescript/content/SliderContent.d.ts.map +1 -0
- package/build/typescript/content/SpacerContent.d.ts +5 -0
- package/build/typescript/content/SpacerContent.d.ts.map +1 -0
- package/build/typescript/content/SpinnerContent.d.ts +5 -0
- package/build/typescript/content/SpinnerContent.d.ts.map +1 -0
- package/build/typescript/content/SubmitButtonContent.d.ts +9 -0
- package/build/typescript/content/SubmitButtonContent.d.ts.map +1 -0
- package/build/typescript/content/TextContent.d.ts +5 -0
- package/build/typescript/content/TextContent.d.ts.map +1 -0
- package/build/typescript/content/TileContent.d.ts +5 -0
- package/build/typescript/content/TileContent.d.ts.map +1 -0
- package/build/typescript/content/TimelineContent.d.ts +5 -0
- package/build/typescript/content/TimelineContent.d.ts.map +1 -0
- package/build/typescript/content/TitleContent.d.ts +5 -0
- package/build/typescript/content/TitleContent.d.ts.map +1 -0
- package/build/typescript/content/VideoContent.d.ts +10 -0
- package/build/typescript/content/VideoContent.d.ts.map +1 -0
- package/build/typescript/content/WebLinkContent.d.ts +5 -0
- package/build/typescript/content/WebLinkContent.d.ts.map +1 -0
- package/build/typescript/content/index.d.ts +46 -0
- package/build/typescript/content/index.d.ts.map +1 -0
- package/build/typescript/form-fields/CheckboxField.d.ts +5 -0
- package/build/typescript/form-fields/CheckboxField.d.ts.map +1 -0
- package/build/typescript/form-fields/DateField.d.ts +6 -0
- package/build/typescript/form-fields/DateField.d.ts.map +1 -0
- package/build/typescript/form-fields/DateField.native.d.ts +5 -0
- package/build/typescript/form-fields/DateField.native.d.ts.map +1 -0
- package/build/typescript/form-fields/DateField.web.d.ts +9 -0
- package/build/typescript/form-fields/DateField.web.d.ts.map +1 -0
- package/build/typescript/form-fields/DropdownField.d.ts +5 -0
- package/build/typescript/form-fields/DropdownField.d.ts.map +1 -0
- package/build/typescript/form-fields/MCQField.d.ts +5 -0
- package/build/typescript/form-fields/MCQField.d.ts.map +1 -0
- package/build/typescript/form-fields/RadioField.d.ts +5 -0
- package/build/typescript/form-fields/RadioField.d.ts.map +1 -0
- package/build/typescript/form-fields/SliderField.d.ts +6 -0
- package/build/typescript/form-fields/SliderField.d.ts.map +1 -0
- package/build/typescript/form-fields/SliderField.native.d.ts +5 -0
- package/build/typescript/form-fields/SliderField.native.d.ts.map +1 -0
- package/build/typescript/form-fields/SliderField.web.d.ts +11 -0
- package/build/typescript/form-fields/SliderField.web.d.ts.map +1 -0
- package/build/typescript/form-fields/SubmitButtonField.d.ts +5 -0
- package/build/typescript/form-fields/SubmitButtonField.d.ts.map +1 -0
- package/build/typescript/form-fields/TextField.d.ts +5 -0
- package/build/typescript/form-fields/TextField.d.ts.map +1 -0
- package/build/typescript/form-fields/index.d.ts +13 -0
- package/build/typescript/form-fields/index.d.ts.map +1 -0
- package/build/typescript/i18n/WorkflowI18n.d.ts +75 -0
- package/build/typescript/i18n/WorkflowI18n.d.ts.map +1 -0
- package/build/typescript/icons/WorkflowIcon.d.ts +27 -0
- package/build/typescript/icons/WorkflowIcon.d.ts.map +1 -0
- package/build/typescript/imageUriCache.d.ts +7 -0
- package/build/typescript/imageUriCache.d.ts.map +1 -0
- package/build/typescript/index.d.ts +47 -0
- package/build/typescript/index.d.ts.map +1 -0
- package/build/typescript/modal/WorkflowModal.d.ts +33 -0
- package/build/typescript/modal/WorkflowModal.d.ts.map +1 -0
- package/build/typescript/package.json +1 -0
- package/build/typescript/platform/platformName.d.ts +8 -0
- package/build/typescript/platform/platformName.d.ts.map +1 -0
- package/build/typescript/platform/platformName.web.d.ts +3 -0
- package/build/typescript/platform/platformName.web.d.ts.map +1 -0
- package/build/typescript/protocol/controlSnapshotStore.d.ts +12 -0
- package/build/typescript/protocol/controlSnapshotStore.d.ts.map +1 -0
- package/build/typescript/protocol/useProtocolExchange.d.ts +40 -0
- package/build/typescript/protocol/useProtocolExchange.d.ts.map +1 -0
- package/build/typescript/registries/ContentRegistry.d.ts +57 -0
- package/build/typescript/registries/ContentRegistry.d.ts.map +1 -0
- package/build/typescript/registries/FormFieldRegistry.d.ts +37 -0
- package/build/typescript/registries/FormFieldRegistry.d.ts.map +1 -0
- package/build/typescript/render/NodeBoundary.d.ts +25 -0
- package/build/typescript/render/NodeBoundary.d.ts.map +1 -0
- package/build/typescript/render/RenderTree.d.ts +23 -0
- package/build/typescript/render/RenderTree.d.ts.map +1 -0
- package/build/typescript/render/WorkflowRenderContext.d.ts +57 -0
- package/build/typescript/render/WorkflowRenderContext.d.ts.map +1 -0
- package/build/typescript/render/nodes.d.ts +49 -0
- package/build/typescript/render/nodes.d.ts.map +1 -0
- package/build/typescript/responsive/ResponsiveProvider.d.ts +39 -0
- package/build/typescript/responsive/ResponsiveProvider.d.ts.map +1 -0
- package/build/typescript/responsive/index.d.ts +3 -0
- package/build/typescript/responsive/index.d.ts.map +1 -0
- package/build/typescript/responsive/responsive.d.ts +24 -0
- package/build/typescript/responsive/responsive.d.ts.map +1 -0
- package/build/typescript/style/resolveDisplayHintStyle.d.ts +23 -0
- package/build/typescript/style/resolveDisplayHintStyle.d.ts.map +1 -0
- package/build/typescript/theme/WorkflowTheme.d.ts +177 -0
- package/build/typescript/theme/WorkflowTheme.d.ts.map +1 -0
- package/build/typescript/utils/testable.d.ts +8 -0
- package/build/typescript/utils/testable.d.ts.map +1 -0
- package/package.json +101 -3
- package/src/WorkflowFontScaleContext.tsx +74 -0
- package/src/adapter/WalletAdapter.tsx +225 -0
- package/src/components/FallbackVideoPlayer.native.tsx +9 -0
- package/src/components/FallbackVideoPlayer.tsx +5 -0
- package/src/components/FallbackVideoPlayer.web.tsx +24 -0
- package/src/components/WorkflowButtonLabel.tsx +41 -0
- package/src/components/WorkflowCalendarIcon.tsx +52 -0
- package/src/components/WorkflowText.tsx +121 -0
- package/src/content/BadgeContent.tsx +57 -0
- package/src/content/BarChartContent.tsx +76 -0
- package/src/content/BarcodeContent.tsx +59 -0
- package/src/content/BasicTableContent.tsx +139 -0
- package/src/content/ButtonContent.tsx +124 -0
- package/src/content/CalendarContent.tsx +178 -0
- package/src/content/CardContent.tsx +137 -0
- package/src/content/CarouselContent.tsx +197 -0
- package/src/content/ChipContent.tsx +209 -0
- package/src/content/ChipRowContent.tsx +133 -0
- package/src/content/CredentialOfferContent.tsx +229 -0
- package/src/content/DialContent.tsx +96 -0
- package/src/content/DividerContent.tsx +33 -0
- package/src/content/DonutChartContent.tsx +110 -0
- package/src/content/FormContent.tsx +158 -0
- package/src/content/FormFieldBridge.tsx +144 -0
- package/src/content/GaugeContent.tsx +66 -0
- package/src/content/GridLayoutContent.tsx +285 -0
- package/src/content/ImageContent.tsx +222 -0
- package/src/content/ListContent.tsx +98 -0
- package/src/content/LocationContent.tsx +135 -0
- package/src/content/MapContent.tsx +232 -0
- package/src/content/MultipleChoiceContent.tsx +74 -0
- package/src/content/OpenBadgePreviewContent.tsx +93 -0
- package/src/content/PhotoContent.tsx +110 -0
- package/src/content/PieChartContent.tsx +121 -0
- package/src/content/ProofPresentationContent.tsx +127 -0
- package/src/content/RadioButtonContent.tsx +129 -0
- package/src/content/RowContent.tsx +627 -0
- package/src/content/SectionContent.tsx +133 -0
- package/src/content/ShareEntryContent.tsx +109 -0
- package/src/content/SimulatedHint.tsx +20 -0
- package/src/content/SliderContent.tsx +56 -0
- package/src/content/SpacerContent.tsx +15 -0
- package/src/content/SpinnerContent.tsx +24 -0
- package/src/content/SubmitButtonContent.tsx +256 -0
- package/src/content/TextContent.tsx +140 -0
- package/src/content/TileContent.tsx +216 -0
- package/src/content/TimelineContent.tsx +91 -0
- package/src/content/TitleContent.tsx +49 -0
- package/src/content/VideoContent.tsx +131 -0
- package/src/content/WebLinkContent.tsx +87 -0
- package/src/content/index.ts +45 -0
- package/src/form-fields/CheckboxField.tsx +29 -0
- package/src/form-fields/DateField.native.tsx +123 -0
- package/src/form-fields/DateField.tsx +5 -0
- package/src/form-fields/DateField.web.tsx +32 -0
- package/src/form-fields/DropdownField.tsx +137 -0
- package/src/form-fields/MCQField.tsx +68 -0
- package/src/form-fields/RadioField.tsx +53 -0
- package/src/form-fields/SliderField.native.tsx +53 -0
- package/src/form-fields/SliderField.tsx +5 -0
- package/src/form-fields/SliderField.web.tsx +58 -0
- package/src/form-fields/SubmitButtonField.tsx +33 -0
- package/src/form-fields/TextField.tsx +49 -0
- package/src/form-fields/index.ts +12 -0
- package/src/i18n/WorkflowI18n.tsx +100 -0
- package/src/icons/WorkflowIcon.tsx +43 -0
- package/src/imageUriCache.ts +27 -0
- package/src/index.ts +96 -0
- package/src/modal/WorkflowModal.tsx +119 -0
- package/src/platform/platformName.ts +7 -0
- package/src/platform/platformName.web.ts +2 -0
- package/src/protocol/controlSnapshotStore.ts +25 -0
- package/src/protocol/useProtocolExchange.ts +185 -0
- package/src/registries/ContentRegistry.tsx +130 -0
- package/src/registries/FormFieldRegistry.tsx +83 -0
- package/src/render/NodeBoundary.tsx +69 -0
- package/src/render/RenderTree.tsx +63 -0
- package/src/render/WorkflowRenderContext.tsx +71 -0
- package/src/render/nodes.ts +104 -0
- package/src/responsive/ResponsiveProvider.tsx +103 -0
- package/src/responsive/index.ts +7 -0
- package/src/responsive/responsive.ts +67 -0
- package/src/style/resolveDisplayHintStyle.ts +153 -0
- package/src/theme/WorkflowTheme.tsx +162 -0
- package/src/utils/testable.ts +10 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["snapshots","Map","getControlSnapshot","key","get","undefined","saveControlSnapshot","snapshot","set","clearControlSnapshots","clear"],"sourceRoot":"../../../src","sources":["protocol/controlSnapshotStore.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,MAAMA,SAAS,GAAG,IAAIC,GAAG,CAA0B,CAAC;AAEpD,OAAO,MAAMC,kBAAkB,GAAIC,GAAY,IAAmCA,GAAG,GAAGH,SAAS,CAACI,GAAG,CAACD,GAAG,CAAC,GAAGE,SAAU;AAEvH,OAAO,MAAMC,mBAAmB,GAAGA,CAACH,GAAuB,EAAEI,QAAyB,KAAW;EAC/F,IAAIJ,GAAG,EAAEH,SAAS,CAACQ,GAAG,CAACL,GAAG,EAAEI,QAAQ,CAAC;AACvC,CAAC;;AAED;AACA,OAAO,MAAME,qBAAqB,GAAGA,CAAA,KAAYT,SAAS,CAACU,KAAK,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { getControlSnapshot, saveControlSnapshot } from "./controlSnapshotStore.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* - `ready`: the action buttons show (credential offer / proof request card).
|
|
8
|
+
* - `awaiting`: the user consented; waiting for the offer or request to arrive.
|
|
9
|
+
* - `working`: accepting the offer / presenting the proof.
|
|
10
|
+
* - `done`, `declined`, `error`: final.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// Grace window when matching an arriving record to this control: records
|
|
14
|
+
// created more than this long before the control mounted belong to some other
|
|
15
|
+
// flow and must not be silently consumed here.
|
|
16
|
+
const ARM_SKEW_MS = 60 * 1000;
|
|
17
|
+
const pick = (value, fallback) => typeof value === 'string' && value.trim() || fallback;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The shared lifecycle of the credential-offer and proof-presentation
|
|
21
|
+
* controls, moved from the wallet with credo replaced by the adapter.
|
|
22
|
+
*
|
|
23
|
+
* The watcher is armed from mount because the CrMS coordinator usually sends
|
|
24
|
+
* the offer / request as soon as the state is entered (before any tap).
|
|
25
|
+
* Pressing the primary button consents: an arrived record is accepted
|
|
26
|
+
* directly; otherwise the control waits for it and, for event-driven
|
|
27
|
+
* templates only, fires the workflow event to request it. Firing the event
|
|
28
|
+
* when the coordinator also auto-fires would duplicate the exchange, which
|
|
29
|
+
* this control must never do. Outcomes (`accepted`, `error`, decline) go back
|
|
30
|
+
* through `onOutcome` when the host provides it.
|
|
31
|
+
*
|
|
32
|
+
* The phase is kept in the snapshot store under `persistKey`, so leaving and
|
|
33
|
+
* re-entering the screen cannot bring the buttons back.
|
|
34
|
+
*/
|
|
35
|
+
export function useProtocolExchange({
|
|
36
|
+
kind,
|
|
37
|
+
adapter,
|
|
38
|
+
item,
|
|
39
|
+
onAction,
|
|
40
|
+
onOutcome,
|
|
41
|
+
connectionId,
|
|
42
|
+
persistKey,
|
|
43
|
+
autoFireCheck,
|
|
44
|
+
defaultEvent
|
|
45
|
+
}) {
|
|
46
|
+
const primaryEvent = pick(item.event, defaultEvent);
|
|
47
|
+
const declineEvent = pick(item['decline-event'], 'decline');
|
|
48
|
+
const acceptedEvent = pick(item['accepted-event'], 'accepted');
|
|
49
|
+
const errorEvent = pick(item['error-event'], 'error');
|
|
50
|
+
const idKey = kind === 'credential' ? 'credentialId' : 'proofId';
|
|
51
|
+
const snapshot = getControlSnapshot(persistKey);
|
|
52
|
+
const [phase, setPhase] = useState(snapshot ? toPhase(snapshot.phase) : 'ready');
|
|
53
|
+
const [recordId, setRecordId] = useState(snapshot?.recordId ?? null);
|
|
54
|
+
const armedAtRef = useRef(snapshot?.armedAt ?? Date.now());
|
|
55
|
+
const handledIdsRef = useRef(new Set(snapshot?.handledIds ?? []));
|
|
56
|
+
const outcomeSentRef = useRef(snapshot?.outcomeSent ?? false);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
saveControlSnapshot(persistKey, {
|
|
59
|
+
phase,
|
|
60
|
+
recordId,
|
|
61
|
+
armedAt: armedAtRef.current,
|
|
62
|
+
handledIds: [...handledIdsRef.current],
|
|
63
|
+
outcomeSent: outcomeSentRef.current
|
|
64
|
+
});
|
|
65
|
+
}, [persistKey, phase, recordId]);
|
|
66
|
+
const records = adapter.useExchanges(kind);
|
|
67
|
+
// The wallet always knows the connection; the simulated adapter may not.
|
|
68
|
+
const canWatch = Boolean(connectionId) || adapter.simulated;
|
|
69
|
+
const fireOutcome = useCallback((event, data) => {
|
|
70
|
+
if (outcomeSentRef.current) return;
|
|
71
|
+
outcomeSentRef.current = true;
|
|
72
|
+
(onOutcome ?? onAction)(event, data);
|
|
73
|
+
}, [onAction, onOutcome]);
|
|
74
|
+
const acceptRecord = useCallback(id => {
|
|
75
|
+
handledIdsRef.current.add(id);
|
|
76
|
+
setRecordId(id);
|
|
77
|
+
setPhase('working');
|
|
78
|
+
adapter.acceptExchange(kind, id).catch(error => {
|
|
79
|
+
setPhase('error');
|
|
80
|
+
fireOutcome(errorEvent, {
|
|
81
|
+
message: error instanceof Error ? error.message : String(error)
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
}, [adapter, kind, errorEvent, fireOutcome]);
|
|
85
|
+
|
|
86
|
+
// Watch for the record on this workflow's connection. Before consent it is
|
|
87
|
+
// only remembered; after consent it is accepted immediately.
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (phase !== 'ready' && phase !== 'awaiting' || !canWatch) return;
|
|
90
|
+
const armedAt = armedAtRef.current ?? 0;
|
|
91
|
+
const pending = records.find(r => r.status === 'pending' && r.connectionId === connectionId && !handledIdsRef.current.has(r.id) && r.createdAt >= armedAt - ARM_SKEW_MS);
|
|
92
|
+
if (!pending) return;
|
|
93
|
+
if (phase === 'awaiting') acceptRecord(pending.id);else if (recordId !== pending.id) setRecordId(pending.id);
|
|
94
|
+
}, [phase, canWatch, connectionId, records, recordId, acceptRecord]);
|
|
95
|
+
|
|
96
|
+
// Final states of the accepted record → workflow outcome events.
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
if (!recordId || phase !== 'working') return;
|
|
99
|
+
const record = records.find(r => r.id === recordId);
|
|
100
|
+
if (record?.status === 'success') {
|
|
101
|
+
setPhase('done');
|
|
102
|
+
fireOutcome(acceptedEvent, {
|
|
103
|
+
[idKey]: recordId
|
|
104
|
+
});
|
|
105
|
+
} else if (record?.status === 'declined') {
|
|
106
|
+
setPhase('declined');
|
|
107
|
+
fireOutcome(declineEvent, {
|
|
108
|
+
[idKey]: recordId
|
|
109
|
+
});
|
|
110
|
+
} else if (record?.status === 'failed') {
|
|
111
|
+
setPhase('error');
|
|
112
|
+
fireOutcome(errorEvent, {
|
|
113
|
+
[idKey]: recordId
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}, [recordId, phase, records, acceptedEvent, declineEvent, errorEvent, idKey, fireOutcome]);
|
|
117
|
+
const consent = () => {
|
|
118
|
+
if (recordId && !handledIdsRef.current.has(recordId)) {
|
|
119
|
+
// Already arrived (the coordinator sent it): accept directly.
|
|
120
|
+
acceptRecord(recordId);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
setPhase('awaiting');
|
|
124
|
+
adapter.expectExchange?.(kind, connectionId);
|
|
125
|
+
if (!autoFireCheck?.(primaryEvent)) onAction(primaryEvent);
|
|
126
|
+
};
|
|
127
|
+
const decline = () => {
|
|
128
|
+
setPhase('declined');
|
|
129
|
+
if (recordId && !handledIdsRef.current.has(recordId)) {
|
|
130
|
+
handledIdsRef.current.add(recordId);
|
|
131
|
+
adapter.declineExchange(kind, recordId).catch(() => undefined);
|
|
132
|
+
}
|
|
133
|
+
// Many templates have no decline transition: the outcome channel keeps
|
|
134
|
+
// that from surfacing as an error.
|
|
135
|
+
;
|
|
136
|
+
(onOutcome ?? onAction)(declineEvent);
|
|
137
|
+
};
|
|
138
|
+
const record = recordId ? records.find(r => r.id === recordId) : undefined;
|
|
139
|
+
return {
|
|
140
|
+
phase,
|
|
141
|
+
recordId,
|
|
142
|
+
record,
|
|
143
|
+
consent,
|
|
144
|
+
decline
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Snapshots written by the wallet's own controls used their phase names.
|
|
149
|
+
const toPhase = saved => {
|
|
150
|
+
switch (saved) {
|
|
151
|
+
case 'offer':
|
|
152
|
+
case 'request':
|
|
153
|
+
return 'ready';
|
|
154
|
+
case 'accepting':
|
|
155
|
+
case 'presenting':
|
|
156
|
+
return 'working';
|
|
157
|
+
case 'awaiting':
|
|
158
|
+
case 'done':
|
|
159
|
+
case 'declined':
|
|
160
|
+
case 'error':
|
|
161
|
+
case 'ready':
|
|
162
|
+
case 'working':
|
|
163
|
+
return saved;
|
|
164
|
+
default:
|
|
165
|
+
return 'ready';
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
//# sourceMappingURL=useProtocolExchange.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useRef","useState","getControlSnapshot","saveControlSnapshot","ARM_SKEW_MS","pick","value","fallback","trim","useProtocolExchange","kind","adapter","item","onAction","onOutcome","connectionId","persistKey","autoFireCheck","defaultEvent","primaryEvent","event","declineEvent","acceptedEvent","errorEvent","idKey","snapshot","phase","setPhase","toPhase","recordId","setRecordId","armedAtRef","armedAt","Date","now","handledIdsRef","Set","handledIds","outcomeSentRef","outcomeSent","current","records","useExchanges","canWatch","Boolean","simulated","fireOutcome","data","acceptRecord","id","add","acceptExchange","catch","error","message","Error","String","pending","find","r","status","has","createdAt","record","consent","expectExchange","decline","declineExchange","undefined","saved"],"sourceRoot":"../../../src","sources":["protocol/useProtocolExchange.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAGhE,SAASC,kBAAkB,EAAEC,mBAAmB,QAAQ,2BAAwB;;AAEhF;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA,MAAMC,WAAW,GAAG,EAAE,GAAG,IAAI;AAY7B,MAAMC,IAAI,GAAGA,CAACC,KAAc,EAAEC,QAAgB,KAAM,OAAOD,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACE,IAAI,CAAC,CAAC,IAAKD,QAAQ;;AAE1G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,mBAAmBA,CAAC;EAClCC,IAAI;EACJC,OAAO;EACPC,IAAI;EACJC,QAAQ;EACRC,SAAS;EACTC,YAAY;EACZC,UAAU;EACVC,aAAa;EACbC;AACO,CAAC,EAAE;EACV,MAAMC,YAAY,GAAGd,IAAI,CAACO,IAAI,CAACQ,KAAK,EAAEF,YAAY,CAAC;EACnD,MAAMG,YAAY,GAAGhB,IAAI,CAACO,IAAI,CAAC,eAAe,CAAC,EAAE,SAAS,CAAC;EAC3D,MAAMU,aAAa,GAAGjB,IAAI,CAACO,IAAI,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC;EAC9D,MAAMW,UAAU,GAAGlB,IAAI,CAACO,IAAI,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;EACrD,MAAMY,KAAK,GAAGd,IAAI,KAAK,YAAY,GAAG,cAAc,GAAG,SAAS;EAEhE,MAAMe,QAAQ,GAAGvB,kB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React from 'react';
|
|
5
|
+
import { NodeBoundary } from "../render/NodeBoundary.js";
|
|
6
|
+
|
|
7
|
+
// Base props all content types receive
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
class ContentRegistryClass {
|
|
10
|
+
renderers = new Map();
|
|
11
|
+
register(type, renderer) {
|
|
12
|
+
this.renderers.set(type, renderer);
|
|
13
|
+
}
|
|
14
|
+
get(type) {
|
|
15
|
+
return this.renderers.get(type);
|
|
16
|
+
}
|
|
17
|
+
has(type) {
|
|
18
|
+
return this.renderers.has(type);
|
|
19
|
+
}
|
|
20
|
+
render(type, props) {
|
|
21
|
+
const Renderer = this.renderers.get(type);
|
|
22
|
+
if (!Renderer || !props.item) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Every node passes through NodeBoundary: `disabled` from the item,
|
|
27
|
+
// client-side expressions and the designer wrapper (see render/).
|
|
28
|
+
return /*#__PURE__*/_jsx(NodeBoundary, {
|
|
29
|
+
node: props.item,
|
|
30
|
+
kind: "content",
|
|
31
|
+
formData: props.formData,
|
|
32
|
+
disabled: props.disabled,
|
|
33
|
+
render: (item, disabled, theme) => /*#__PURE__*/_jsx(Renderer, {
|
|
34
|
+
...props,
|
|
35
|
+
item: item,
|
|
36
|
+
disabled: disabled,
|
|
37
|
+
colors: props.colors ? {
|
|
38
|
+
...theme.colors,
|
|
39
|
+
...props.colors
|
|
40
|
+
} : theme.colors,
|
|
41
|
+
styles: props.styles ? {
|
|
42
|
+
...theme.styles,
|
|
43
|
+
...props.styles
|
|
44
|
+
} : theme.styles
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
getTypes() {
|
|
49
|
+
return Array.from(this.renderers.keys());
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export const ContentRegistry = new ContentRegistryClass();
|
|
53
|
+
//# sourceMappingURL=ContentRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","NodeBoundary","jsx","_jsx","ContentRegistryClass","renderers","Map","register","type","renderer","set","get","has","render","props","Renderer","item","node","kind","formData","disabled","theme","colors","styles","getTypes","Array","from","keys","ContentRegistry"],"sourceRoot":"../../../src","sources":["registries/ContentRegistry.tsx"],"mappings":";;AAAA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,QAAQ,2BAAwB;;AAErD;AAAA,SAAAC,GAAA,IAAAC,IAAA;AA8EA,MAAMC,oBAAoB,CAAC;EACjBC,SAAS,GAAG,IAAIC,GAAG,CAA0B,CAAC;EAEtDC,QAAQA,CAACC,IAAY,EAAEC,QAAyB,EAAE;IAChD,IAAI,CAACJ,SAAS,CAACK,GAAG,CAACF,IAAI,EAAEC,QAAQ,CAAC;EACpC;EAEAE,GAAGA,CAACH,IAAY,EAA+B;IAC7C,OAAO,IAAI,CAACH,SAAS,CAACM,GAAG,CAACH,IAAI,CAAC;EACjC;EAEAI,GAAGA,CAACJ,IAAY,EAAW;IACzB,OAAO,IAAI,CAACH,SAAS,CAACO,GAAG,CAACJ,IAAI,CAAC;EACjC;EAEAK,MAAMA,CAACL,IAAY,EAAEM,KAAmB,EAAmB;IACzD,MAAMC,QAAQ,GAAG,IAAI,CAACV,SAAS,CAACM,GAAG,CAACH,IAAI,CAAC;IACzC,IAAI,CAACO,QAAQ,IAAI,CAACD,KAAK,CAACE,IAAI,EAAE;MAC5B,OAAO,IAAI;IACb;;IAEA;IACA;IACA,oBACEb,IAAA,CAACF,YAAY;MACXgB,IAAI,EAAEH,KAAK,CAACE,IAAK;MACjBE,IAAI,EAAC,SAAS;MACdC,QAAQ,EAAEL,KAAK,CAACK,QAAS;MACzBC,QAAQ,EAAEN,KAAK,CAACM,QAAS;MACzBP,MAAM,EAAEA,CAACG,IAAI,EAAEI,QAAQ,EAAEC,KAAK,kBAC5BlB,IAAA,CAACY,QAAQ;QAAA,GACHD,KAAK;QACTE,IAAI,EAAEA,IAA6B;QACnCI,QAAQ,EAAEA,QAAS;QACnBE,MAAM,EAAER,KAAK,CAACQ,MAAM,GAAG;UAAE,GAAGD,KAAK,CAACC,MAAM;UAAE,GAAGR,KAAK,CAACQ;QAAO,CAAC,GAAGD,KAAK,CAACC,MAAO;QAC3EC,MAAM,EAAET,KAAK,CAACS,MAAM,GAAG;UAAE,GAAGF,KAAK,CAACE,MAAM;UAAE,GAAGT,KAAK,CAACS;QAAO,CAAC,GAAGF,KAAK,CAACE;MAAO,CAC5E;IACD,CACH,CAAC;EAEN;EAEAC,QAAQA,CAAA,EAAa;IACnB,OAAOC,KAAK,CAACC,IAAI,CAAC,IAAI,CAACrB,SAAS,CAACsB,IAAI,CAAC,CAAC,CAAC;EAC1C;AACF;AAEA,OAAO,MAAMC,eAAe,GAAG,IAAIxB,oBAAoB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable no-console */
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { NodeBoundary } from "../render/NodeBoundary.js";
|
|
6
|
+
|
|
7
|
+
// Base props all form fields receive
|
|
8
|
+
|
|
9
|
+
// Renderer function type
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
// The registry
|
|
12
|
+
class FormFieldRegistryClass {
|
|
13
|
+
renderers = new Map();
|
|
14
|
+
register(type, renderer) {
|
|
15
|
+
this.renderers.set(type, renderer);
|
|
16
|
+
}
|
|
17
|
+
get(type) {
|
|
18
|
+
return this.renderers.get(type);
|
|
19
|
+
}
|
|
20
|
+
has(type) {
|
|
21
|
+
return this.renderers.has(type);
|
|
22
|
+
}
|
|
23
|
+
render(type, props) {
|
|
24
|
+
const Renderer = this.renderers.get(type);
|
|
25
|
+
if (!Renderer) {
|
|
26
|
+
// biome-ignore lint/suspicious/noConsole: developer warning for a template using an unregistered form field type
|
|
27
|
+
console.warn(`Unknown form field type: ${type}`);
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Same boundary as content: `showWhen` / `{{ }}` against the form's live values, designer wrapper.
|
|
32
|
+
return /*#__PURE__*/_jsx(NodeBoundary, {
|
|
33
|
+
node: props.field,
|
|
34
|
+
kind: "field",
|
|
35
|
+
render: (field, _disabled, theme) => /*#__PURE__*/_jsx(Renderer, {
|
|
36
|
+
...props,
|
|
37
|
+
field: field,
|
|
38
|
+
colors: props.colors ? {
|
|
39
|
+
...theme.colors,
|
|
40
|
+
...props.colors
|
|
41
|
+
} : theme.colors,
|
|
42
|
+
styles: props.styles ? {
|
|
43
|
+
...theme.styles,
|
|
44
|
+
...props.styles
|
|
45
|
+
} : theme.styles
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Get all registered types (useful for validation)
|
|
51
|
+
getTypes() {
|
|
52
|
+
return Array.from(this.renderers.keys());
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export const FormFieldRegistry = new FormFieldRegistryClass();
|
|
56
|
+
//# sourceMappingURL=FormFieldRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","NodeBoundary","jsx","_jsx","FormFieldRegistryClass","renderers","Map","register","type","renderer","set","get","has","render","props","Renderer","console","warn","node","field","kind","_disabled","theme","colors","styles","getTypes","Array","from","keys","FormFieldRegistry"],"sourceRoot":"../../../src","sources":["registries/FormFieldRegistry.tsx"],"mappings":";;AAAA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,QAAQ,2BAAwB;;AAErD;;AA4BA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGA;AACA,MAAMC,sBAAsB,CAAC;EACnBC,SAAS,GAAG,IAAIC,GAAG,CAA4B,CAAC;EAExDC,QAAQA,CAACC,IAAY,EAAEC,QAA2B,EAAE;IAClD,IAAI,CAACJ,SAAS,CAACK,GAAG,CAACF,IAAI,EAAEC,QAAQ,C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1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useContext, useMemo } from 'react';
|
|
4
|
+
import { useWorkflowTheme } from "../theme/WorkflowTheme.js";
|
|
5
|
+
import { lookupPath, resolveNode, sourceNode } from "./nodes.js";
|
|
6
|
+
import { LiveInputContext, PathMapContext, RenderOptionsContext } from "./WorkflowRenderContext.js";
|
|
7
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
8
|
+
/**
|
|
9
|
+
* Sits around every control the registries render, so each node gets the same
|
|
10
|
+
* treatment wherever it appears (top level, inside a card, a row, a form…):
|
|
11
|
+
*
|
|
12
|
+
* - `disabled: true` on the item disables the control. The engine sets it from
|
|
13
|
+
* `enabledWhen`; before, only chips read it.
|
|
14
|
+
* - Under a `WorkflowRenderProvider` with an `env`: `showWhen`, `enabledWhen`
|
|
15
|
+
* and `{{ }}` are evaluated with workflow-core, with form values as `input`.
|
|
16
|
+
* - Under a `RenderTree` with `renderNodeWrapper`: the designer's wrapper.
|
|
17
|
+
* - `colors` and `styles` default to the `WorkflowThemeProvider` theme.
|
|
18
|
+
*/
|
|
19
|
+
export function NodeBoundary({
|
|
20
|
+
node,
|
|
21
|
+
kind,
|
|
22
|
+
formData,
|
|
23
|
+
disabled,
|
|
24
|
+
render
|
|
25
|
+
}) {
|
|
26
|
+
const options = useContext(RenderOptionsContext);
|
|
27
|
+
const paths = useContext(PathMapContext);
|
|
28
|
+
const contextInput = useContext(LiveInputContext);
|
|
29
|
+
const theme = useWorkflowTheme();
|
|
30
|
+
const input = formData ?? contextInput;
|
|
31
|
+
const baseEnv = options?.env;
|
|
32
|
+
const env = useMemo(() => baseEnv && input ? {
|
|
33
|
+
...baseEnv,
|
|
34
|
+
input: {
|
|
35
|
+
...baseEnv.input,
|
|
36
|
+
...input
|
|
37
|
+
}
|
|
38
|
+
} : baseEnv, [baseEnv, input]);
|
|
39
|
+
const resolved = useMemo(() => env ? resolveNode(node, env) : {
|
|
40
|
+
item: node,
|
|
41
|
+
hidden: false
|
|
42
|
+
}, [node, env]);
|
|
43
|
+
if (resolved.hidden && !options?.keepHidden) return null;
|
|
44
|
+
const {
|
|
45
|
+
item
|
|
46
|
+
} = resolved;
|
|
47
|
+
const isDisabled = disabled || item.disabled === true ? true : disabled;
|
|
48
|
+
let element = render(item, isDisabled, theme);
|
|
49
|
+
|
|
50
|
+
// Fields inside a form read the form's values from here.
|
|
51
|
+
if (kind === 'content' && formData && formData !== contextInput) {
|
|
52
|
+
element = /*#__PURE__*/_jsx(LiveInputContext.Provider, {
|
|
53
|
+
value: formData,
|
|
54
|
+
children: element
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const path = options?.renderNodeWrapper ? lookupPath(paths, node) : undefined;
|
|
58
|
+
if (options?.renderNodeWrapper && path) {
|
|
59
|
+
element = options.renderNodeWrapper(element, {
|
|
60
|
+
type: node.type,
|
|
61
|
+
kind,
|
|
62
|
+
path,
|
|
63
|
+
item,
|
|
64
|
+
source: sourceNode(node),
|
|
65
|
+
hidden: resolved.hidden,
|
|
66
|
+
disabled: isDisabled === true
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
70
|
+
children: element
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=NodeBoundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useContext","useMemo","useWorkflowTheme","lookupPath","resolveNode","sourceNode","LiveInputContext","PathMapContext","RenderOptionsContext","jsx","_jsx","Fragment","_Fragment","NodeBoundary","node","kind","formData","disabled","render","options","paths","contextInput","theme","input","baseEnv","env","resolved","item","hidden","keepHidden","isDisabled","element","Provider","value","children","path","renderNodeWrapper","undefined","type","source"],"sourceRoot":"../../../src","sources":["render/NodeBoundary.tsx"],"mappings":";;AACA,SAAyBA,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAC3D,SAASC,gBAAgB,QAA4B,2BAAwB;AAC7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AU,GAAGb,QAAQ,IAAIU,IAAI,CAACV,QAAQ,KAAK,IAAI,GAAG,IAAI,GAAGA,QAAQ;EACvE,IAAIc,OAAO,GAAGb,MAAM,CAACS,IAAI,EAAEG,UAAU,EAAER,KAAK,CAAC;;EAE7C;EACA,IAAIP,IAAI,KAAK,SAAS,IAAIC,QAAQ,IAAIA,QAAQ,KAAKK,YAAY,EAAE;IAC/DU,OAAO,gBAAGrB,IAAA,CAACJ,gBAAgB,CAAC0B,QAAQ;MAACC,KAAK,EAAEjB,QAAS;MAAAkB,QAAA,EAAEH;IAAO,CAA4B,CAAC;EAC7F;EAEA,MAAMI,IAAI,GAAGhB,OAAO,EAAEiB,iBAAiB,GAAGjC,UAAU,CAACiB,KAAK,EAAEN,IAAI,CAAC,GAAGuB,SAAS;EAC7E,IAAIlB,OAAO,EAAEiB,iBAAiB,IAAID,IAAI,EAAE;IACtCJ,OAAO,GAAGZ,OAAO,CAACiB,iBAAiB,CAACL,OAAO,EAAE;MAC3CO,IAAI,EAAExB,IAAI,CAACwB,IAAI;MACfvB,IAAI;MACJoB,IAAI;MACJR,IAAI;MACJY,MAAM,EAAElC,UAAU,CAACS,IAAI,CAAC;MACxBc,MAAM,EAAEF,QAAQ,CAACE,MAAM;MACvBX,QAAQ,EAAEa,UAAU,KAAK;IAC3B,CAAC,CAAC;EACJ;EACA,oBAAOpB,IAAA,CAAAE,SAAA;IAAAsB,QAAA,EAAGH;EAAO,CAAG,CAAC;AACvB","ignoreList":[]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Fragment, useContext, useMemo } from 'react';
|
|
4
|
+
import { ContentRegistry } from "../registries/ContentRegistry.js";
|
|
5
|
+
import { NodeBoundary } from "./NodeBoundary.js";
|
|
6
|
+
import { buildPathMap, isNode } from "./nodes.js";
|
|
7
|
+
import { PathMapContext, RenderOptionsContext } from "./WorkflowRenderContext.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
/**
|
|
10
|
+
* Renders a list of display-hint items through the content registry, giving
|
|
11
|
+
* every node (including nested children) a path for `renderNodeWrapper`.
|
|
12
|
+
* Adds no layout of its own: each item renders as a sibling in the host's
|
|
13
|
+
* container.
|
|
14
|
+
*
|
|
15
|
+
* Items whose type has no component render nothing, or `renderUnknown` from
|
|
16
|
+
* the `WorkflowRenderProvider` (the designer shows a placeholder).
|
|
17
|
+
*/
|
|
18
|
+
export function RenderTree({
|
|
19
|
+
items,
|
|
20
|
+
basePath,
|
|
21
|
+
...shared
|
|
22
|
+
}) {
|
|
23
|
+
const options = useContext(RenderOptionsContext);
|
|
24
|
+
const baseKey = basePath?.join('.') ?? '';
|
|
25
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: basePath is compared by value (baseKey)
|
|
26
|
+
const paths = useMemo(() => buildPathMap(items, basePath), [items, baseKey]);
|
|
27
|
+
if (!items?.length) return null;
|
|
28
|
+
return /*#__PURE__*/_jsx(PathMapContext.Provider, {
|
|
29
|
+
value: paths,
|
|
30
|
+
children: items.map((item, index) => {
|
|
31
|
+
if (!isNode(item)) return null;
|
|
32
|
+
if (ContentRegistry.has(item.type)) {
|
|
33
|
+
return /*#__PURE__*/_jsx(Fragment, {
|
|
34
|
+
children: ContentRegistry.render(item.type, {
|
|
35
|
+
...shared,
|
|
36
|
+
item: item
|
|
37
|
+
})
|
|
38
|
+
}, `${index}-${item.type}`);
|
|
39
|
+
}
|
|
40
|
+
const renderUnknown = options?.renderUnknown;
|
|
41
|
+
if (!renderUnknown) return null;
|
|
42
|
+
return /*#__PURE__*/_jsx(NodeBoundary, {
|
|
43
|
+
node: item,
|
|
44
|
+
kind: "content",
|
|
45
|
+
formData: shared.formData,
|
|
46
|
+
disabled: shared.disabled,
|
|
47
|
+
render: resolved => renderUnknown(resolved)
|
|
48
|
+
}, `${index}-${item.type}`);
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=RenderTree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Fragment","useContext","useMemo","ContentRegistry","NodeBoundary","buildPathMap","isNode","PathMapContext","RenderOptionsContext","jsx","_jsx","RenderTree","items","basePath","shared","options","baseKey","join","paths","length","Provider","value","children","map","item","index","has","type","render","renderUnknown","node","kind","formData","disabled","resolved"],"sourceRoot":"../../../src","sources":["render/RenderTree.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,UAAU,EAAEC,OAAO,QAAQ,OAAO;AACrD,SAA4BC,eAAe,QAAQ,kCAA+B;AAClF,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,YAAY,EAAEC,MAAM,QAA+B,YAAS;AACrE,SAASC,cAAc,EAAEC,oBAAoB,QAAQ,4BAAyB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAa9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAAC;EAAEC,KAAK;EAAEC,QAAQ;EAAE,GAAGC;AAAwB,CAAC,EAAE;EAC1E,MAAMC,OAAO,GAAGd,UAAU,CAACO,oBAAoB,CAAC;EAChD,MAAMQ,OAAO,GAAGH,QAAQ,EAAEI,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE;EACzC;EACA,MAAMC,KAAK,GAAGhB,OAAO,CAAC,MAAMG,YAAY,CAACO,KAAK,EAAEC,QAAQ,CAAC,EAAE,CAACD,KAAK,EAAEI,OAAO,CAAC,CAAC;EAE5E,IAAI,CAACJ,KAAK,EAAEO,MAAM,EAAE,OAAO,IAAI;EAC/B,oBACET,IAAA,CAACH,cAAc,CAACa,QAAQ;IAACC,KAAK,EAAEH,KAAM;IAAAI,QAAA,EACnCV,KAAK,CAACW,GAAG,CAAC,CAACC,IAAI,EAAEC,KAAK,KAAK;MAC1B,IAAI,CAACnB,MAAM,CAACkB,IAAI,CAAC,EAAE,OAAO,IAAI;MAC9B,IAAIrB,eAAe,CAACuB,GAAG,CAACF,IAAI,CAACG,IAAI,CAAC,EAAE;QAClC,oBACEjB,IAAA,CAACV,QAAQ;UAAAsB,QAAA,EACNnB,eAAe,CAACyB,MAAM,CAACJ,IAAI,CAACG,IAAI,EAAE;YACjC,GAAIb,MAAqC;YACzCU,IAAI,EAAEA;UACR,CAAC;QAAC,GAJW,GAAGC,KAAK,IAAID,IAAI,CAACG,IAAI,EAK1B,CAAC;MAEf;MACA,MAAME,aAAa,GAAGd,OAAO,EAAEc,aAAa;MAC5C,IAAI,CAACA,aAAa,EAAE,OAAO,IAAI;MAC/B,oBACEnB,IAAA,CAACN,YAAY;QAEX0B,IAAI,EAAEN,IAAK;QACXO,IAAI,EAAC,SAAS;QACdC,QAAQ,EAAElB,MAAM,CAACkB,QAAS;QAC1BC,QAAQ,EAAEnB,MAAM,CAACmB,QAAS;QAC1BL,MAAM,EAAGM,QAAQ,IAAKL,aAAa,CAACK,QAAQ;MAAE,GALzC,GAAGT,KAAK,IAAID,IAAI,CAACG,IAAI,EAM3B,CAAC;IAEN,CAAC;EAAC,CACqB,CAAC;AAE9B","ignoreList":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createContext, useMemo } from 'react';
|
|
4
|
+
|
|
5
|
+
/** What a `renderNodeWrapper` gets to know about the node it wraps. */
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
export const RenderOptionsContext = /*#__PURE__*/createContext(null);
|
|
8
|
+
export const PathMapContext = /*#__PURE__*/createContext(null);
|
|
9
|
+
/** Form values of the nearest enclosing control, for fields inside a form. */
|
|
10
|
+
export const LiveInputContext = /*#__PURE__*/createContext(undefined);
|
|
11
|
+
/**
|
|
12
|
+
* Optional. Turns on client-side expression checks and the designer hooks for
|
|
13
|
+
* every workflow component below it. Without it, components render exactly the
|
|
14
|
+
* items they are given.
|
|
15
|
+
*/
|
|
16
|
+
export function WorkflowRenderProvider({
|
|
17
|
+
env,
|
|
18
|
+
renderNodeWrapper,
|
|
19
|
+
renderUnknown,
|
|
20
|
+
keepHidden,
|
|
21
|
+
children
|
|
22
|
+
}) {
|
|
23
|
+
const value = useMemo(() => ({
|
|
24
|
+
env,
|
|
25
|
+
renderNodeWrapper,
|
|
26
|
+
renderUnknown,
|
|
27
|
+
keepHidden
|
|
28
|
+
}), [env, renderNodeWrapper, renderUnknown, keepHidden]);
|
|
29
|
+
return /*#__PURE__*/_jsx(RenderOptionsContext.Provider, {
|
|
30
|
+
value: value,
|
|
31
|
+
children: children
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=WorkflowRenderContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","useMemo","jsx","_jsx","RenderOptionsContext","PathMapContext","LiveInputContext","undefined","WorkflowRenderProvider","env","renderNodeWrapper","renderUnknown","keepHidden","children","value","Provider"],"sourceRoot":"../../../src","sources":["render/WorkflowRenderContext.tsx"],"mappings":";;AACA,SAASA,aAAa,EAAkBC,OAAO,QAAQ,OAAO;;AAG9D;AAAA,SAAAC,GAAA,IAAAC,IAAA;AA0CA,OAAO,MAAMC,oBAAoB,gBAAGJ,aAAa,CAA+B,IAAI,CAAC;AACrF,OAAO,MAAMK,cAAc,gBAAGL,aAAa,CAAqB,IAAI,CAAC;AACrE;AACA,OAAO,MAAMM,gBAAgB,gBAAGN,aAAa,CAAsCO,SAAS,CAAC;AAI7F;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CAAC;EACrCC,GAAG;EACHC,iBAAiB;EACjBC,aAAa;EACbC,UAAU;EACVC;AAC2B,CAAC,EAAE;EAC9B,MAAMC,KAAK,GAAGb,OAAO,CACnB,OAAO;IAAEQ,GAAG;IAAEC,iBAAiB;IAAEC,aAAa;IAAEC;EAAW,CAAC,CAAC,EAC7D,CAACH,GAAG,EAAEC,iBAAiB,EAAEC,aAAa,EAAEC,UAAU,CACpD,CAAC;EACD,oBAAOT,IAAA,CAACC,oBAAoB,CAACW,QAAQ;IAACD,KAAK,EAAEA,KAAM;IAAAD,QAAA,EAAEA;EAAQ,CAAgC,CAAC;AAChG","ignoreList":[]}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { INTERPOLATION_RESERVED_KEYS, interpolate, isEnabled, isVisible } from '@veridid/workflow-core';
|
|
4
|
+
|
|
5
|
+
/** A display-hint item as rendered: `{ type, ...props }`. */
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Where a node sits in the items given to `RenderTree`, e.g. `[2, 'children', 0]`
|
|
9
|
+
* is the first child of the third top-level item.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** A node is an object with a string `type`. */
|
|
13
|
+
export const isNode = value => !!value && typeof value === 'object' && !Array.isArray(value) && typeof value.type === 'string';
|
|
14
|
+
|
|
15
|
+
// Copies made by containers (e.g. `{ ...child, align: 'end' }`) point back to
|
|
16
|
+
// the node they were made from, so they keep its path.
|
|
17
|
+
const derivedFrom = new WeakMap();
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Copies `node` with `overrides` and remembers where the copy came from, so a
|
|
21
|
+
* container that adjusts a child before rendering it keeps that child's path
|
|
22
|
+
* (selection in the designer still works).
|
|
23
|
+
*/
|
|
24
|
+
export function deriveNode(node, overrides) {
|
|
25
|
+
const copy = {
|
|
26
|
+
...node,
|
|
27
|
+
...overrides
|
|
28
|
+
};
|
|
29
|
+
derivedFrom.set(copy, derivedFrom.get(node) ?? node);
|
|
30
|
+
return copy;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The original node a (possibly derived) node was made from. */
|
|
34
|
+
export const sourceNode = node => derivedFrom.get(node) ?? node;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Records the path of every node in `items` (top-level items, and any node in
|
|
38
|
+
* an array property such as `children`, `items`, `content` or `fields`).
|
|
39
|
+
* `row_template` is skipped: it is a template, not something on screen.
|
|
40
|
+
*/
|
|
41
|
+
export function buildPathMap(items, base = []) {
|
|
42
|
+
const map = new WeakMap();
|
|
43
|
+
const walk = (node, path) => {
|
|
44
|
+
map.set(node, path);
|
|
45
|
+
for (const [key, value] of Object.entries(node)) {
|
|
46
|
+
if (key === 'row_template' || !Array.isArray(value)) continue;
|
|
47
|
+
value.forEach((child, index) => {
|
|
48
|
+
if (isNode(child)) walk(child, [...path, key, index]);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
items?.forEach((item, index) => {
|
|
53
|
+
if (isNode(item)) walk(item, [...base, index]);
|
|
54
|
+
});
|
|
55
|
+
return map;
|
|
56
|
+
}
|
|
57
|
+
export const lookupPath = (map, node) => map ? map.get(node) ?? map.get(sourceNode(node)) : undefined;
|
|
58
|
+
const hasTemplate = value => {
|
|
59
|
+
if (typeof value === 'string') return value.includes('{{');
|
|
60
|
+
if (Array.isArray(value)) return value.some(v => !isNode(v) && hasTemplate(v));
|
|
61
|
+
if (value && typeof value === 'object') return !isNode(value) && Object.values(value).some(hasTemplate);
|
|
62
|
+
return false;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Resolves `{{ }}` in a node's own props. Nested nodes (children) are left as
|
|
67
|
+
* they are, same object, because each one is resolved when it renders.
|
|
68
|
+
* Returns `node` itself when there is nothing to resolve.
|
|
69
|
+
*/
|
|
70
|
+
export function interpolateOwnProps(node, env) {
|
|
71
|
+
let out;
|
|
72
|
+
for (const [key, value] of Object.entries(node)) {
|
|
73
|
+
if (INTERPOLATION_RESERVED_KEYS.has(key) || key === 'row_template' || !hasTemplate(value)) continue;
|
|
74
|
+
out ??= deriveNode(node, {});
|
|
75
|
+
out[key] = Array.isArray(value) ? value.map(v => isNode(v) ? v : interpolate(v, env)) : interpolate(value, env);
|
|
76
|
+
}
|
|
77
|
+
return out ?? node;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The client-side half of `filterAndBindUi` for one node: `showWhen`,
|
|
81
|
+
* `enabledWhen` and `{{ }}`. Same rules as the engine, so a node evaluated here
|
|
82
|
+
* with the engine's env gives the same answer; with live form values under
|
|
83
|
+
* `env.input` it updates as the user types.
|
|
84
|
+
*/
|
|
85
|
+
export function resolveNode(node, env) {
|
|
86
|
+
const hidden = !isVisible({
|
|
87
|
+
showWhen: node.showWhen
|
|
88
|
+
}, env);
|
|
89
|
+
let item = interpolateOwnProps(node, env);
|
|
90
|
+
if (node.enabledWhen) {
|
|
91
|
+
const disabled = !isEnabled({
|
|
92
|
+
enabledWhen: node.enabledWhen
|
|
93
|
+
}, env);
|
|
94
|
+
if (item.disabled !== disabled) item = deriveNode(item, {
|
|
95
|
+
disabled
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
item,
|
|
100
|
+
hidden
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=nodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["INTERPOLATION_RESERVED_KEYS","interpolate","isEnabled","isVisible","isNode","value","Array","isArray","type","derivedFrom","WeakMap","deriveNode","node","overrides","copy","set","get","sourceNode","buildPathMap","items","base","map","walk","path","key","Object","entries","forEach","child","index","item","lookupPath","undefined","hasTemplate","includes","some","v","values","interpolateOwnProps","env","out","has","resolveNode","hidden","showWhen","enabledWhen","disabled"],"sourceRoot":"../../../src","sources":["render/nodes.ts"],"mappings":";;AAAA,SAASA,2BAA2B,EAAEC,WAAW,EAAEC,SAAS,EAAEC,SAAS,QAAoB,wBAAwB;;AAEnH;;AAGA;AACA;AACA;AACA;;AAKA;AACA,OAAO,MAAMC,MAAM,GAAIC,KAAc,IACnC,CAAC,CAACA,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,IAAI,OAAQA,KAAK,CAAkBG,IAAI,K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