@cratis/event-models 0.0.0-stage → 0.105.6
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/README.md +44 -2
- package/dist/Board/BoardActions.d.ts +37 -0
- package/dist/Board/BoardCanvas.d.ts +6 -0
- package/dist/Board/BoardCanvasChrome.d.ts +9 -0
- package/dist/Board/BoardCollectionView.d.ts +22 -0
- package/dist/Board/BoardCollections.d.ts +17 -0
- package/dist/Board/BoardContextValue.d.ts +8 -0
- package/dist/Board/BoardEditing.d.ts +22 -0
- package/dist/Board/BoardInteraction.d.ts +10 -0
- package/dist/Board/BoardInteractionContext.d.ts +3 -0
- package/dist/Board/BoardInteractionProvider.d.ts +6 -0
- package/dist/Board/BoardNavigation.d.ts +4 -0
- package/dist/Board/BoardProvider.d.ts +7 -0
- package/dist/Board/BoardReadOnlyContext.d.ts +1 -0
- package/dist/Board/BoardSelection.d.ts +5 -0
- package/dist/Board/BoardToolbar.d.ts +7 -0
- package/dist/Board/EventModelBoard.d.ts +13 -0
- package/dist/Board/EventModelBoardEditor.d.ts +16 -0
- package/dist/Board/EventModelBoardHandle.d.ts +5 -0
- package/dist/Board/HostedEventModelBoard.d.ts +18 -0
- package/dist/Board/boardMinimap.d.ts +20 -0
- package/dist/Board/index.d.ts +19 -0
- package/dist/Board/isLargeBoard.d.ts +4 -0
- package/dist/Board/useBoard.d.ts +2 -0
- package/dist/Cards/ArtifactCard.d.ts +17 -0
- package/dist/Cards/ArtifactCardKind.d.ts +5 -0
- package/dist/Cards/Card.d.ts +18 -0
- package/dist/Cards/CardAction.d.ts +12 -0
- package/dist/Cards/CardActionButton.d.ts +9 -0
- package/dist/Cards/CardCorner.d.ts +4 -0
- package/dist/Cards/CardNameInput.d.ts +11 -0
- package/dist/Cards/CardSurface.d.ts +6 -0
- package/dist/Cards/EventTags.d.ts +8 -0
- package/dist/Cards/autoFitTitle.d.ts +29 -0
- package/dist/Cards/cardColors.d.ts +30 -0
- package/dist/Cards/index.d.ts +12 -0
- package/dist/Cards/pascalCaseBreak.d.ts +20 -0
- package/dist/Cards/useAutoFitTitle.d.ts +21 -0
- package/dist/Collections/CollectionGrid.d.ts +28 -0
- package/dist/Collections/CollectionGridEditor.d.ts +16 -0
- package/dist/Collections/CollectionGridFeature.d.ts +19 -0
- package/dist/Collections/CollectionGridFeatureColumn.d.ts +26 -0
- package/dist/Collections/CollectionGridFeatureHeaderControls.d.ts +13 -0
- package/dist/Collections/CollectionGridModule.d.ts +23 -0
- package/dist/Collections/CollectionGridModuleHeaderControls.d.ts +8 -0
- package/dist/Collections/CollectionGridSlice.d.ts +19 -0
- package/dist/Collections/CollectionGridSliceHeaderControls.d.ts +14 -0
- package/dist/Collections/CollectionGridSlots.d.ts +20 -0
- package/dist/Collections/CollectionGridTemplate.d.ts +6 -0
- package/dist/Collections/CollectionMoveHandle.d.ts +12 -0
- package/dist/Collections/CollectionMoved.d.ts +4 -0
- package/dist/Collections/CollectionViewport.d.ts +27 -0
- package/dist/Collections/collectionGridLayout.d.ts +11 -0
- package/dist/Collections/collectionState.d.ts +24 -0
- package/dist/Collections/estimateCollectionSize.d.ts +7 -0
- package/dist/Collections/index.d.ts +13 -0
- package/dist/Collections/useCollectionMove.d.ts +10 -0
- package/dist/Collections/useCollectionsArea.d.ts +27 -0
- package/dist/Connections/Connectors.d.ts +23 -0
- package/dist/Connections/FlowNodeActor.d.ts +13 -0
- package/dist/Connections/SliceConnections.d.ts +7 -0
- package/dist/Connections/SliceConnectionsContext.d.ts +11 -0
- package/dist/Connections/computeSliceConnections.d.ts +23 -0
- package/dist/Connections/flowNodeOrder.d.ts +3 -0
- package/dist/Connections/index.d.ts +7 -0
- package/dist/Connections/useConnectionHighlight.d.ts +7 -0
- package/dist/Features/FeatureAddMenu.d.ts +10 -0
- package/dist/Features/FeatureColumnFrame.d.ts +10 -0
- package/dist/Features/FeatureGridSurface.d.ts +15 -0
- package/dist/Features/FeatureHeader.d.ts +21 -0
- package/dist/Features/FeatureHeaderAction.d.ts +12 -0
- package/dist/Features/FeatureHeaderCell.d.ts +10 -0
- package/dist/Features/FeatureHeaderMenu.d.ts +10 -0
- package/dist/Features/FeatureHeaderMenuAction.d.ts +14 -0
- package/dist/Features/FeatureHeaderSuggestion.d.ts +9 -0
- package/dist/Features/FeatureSuggestions.d.ts +4 -0
- package/dist/Features/FeaturesArea.d.ts +42 -0
- package/dist/Features/FeaturesReordered.d.ts +2 -0
- package/dist/Features/featureAreaState.d.ts +27 -0
- package/dist/Features/featureDropEdge.d.ts +2 -0
- package/dist/Features/featureHeaderMenuItems.d.ts +4 -0
- package/dist/Features/index.d.ts +12 -0
- package/dist/Features/useFeatureDrag.d.ts +16 -0
- package/dist/Features/useFeatureSlotTargets.d.ts +11 -0
- package/dist/Geometry/CurveAxis.d.ts +5 -0
- package/dist/Geometry/connectionCurve.d.ts +13 -0
- package/dist/Geometry/index.d.ts +5 -0
- package/dist/Geometry/linkGeometry.d.ts +62 -0
- package/dist/Geometry/pillLabelWidth.d.ts +38 -0
- package/dist/Geometry/rowLabelWidth.d.ts +1 -0
- package/dist/HeaderDragging/HeaderDragGhost.d.ts +6 -0
- package/dist/HeaderDragging/HeaderDragStart.d.ts +8 -0
- package/dist/HeaderDragging/HeaderDragState.d.ts +8 -0
- package/dist/HeaderDragging/createHeaderDragGhost.d.ts +1 -0
- package/dist/HeaderDragging/headerDropIndex.d.ts +5 -0
- package/dist/HeaderDragging/index.d.ts +8 -0
- package/dist/HeaderDragging/reorderedIds.d.ts +2 -0
- package/dist/HeaderDragging/useHeaderDragIntent.d.ts +8 -0
- package/dist/HeaderDragging/zoomOfAncestor.d.ts +1 -0
- package/dist/Headers/CollapseButton.d.ts +6 -0
- package/dist/Headers/DetailsToggle.d.ts +5 -0
- package/dist/Headers/EditableLabel.d.ts +10 -0
- package/dist/Headers/EntityErrorIndicator.d.ts +10 -0
- package/dist/Headers/EntityErrorKind.d.ts +6 -0
- package/dist/Headers/ErroredEntity.d.ts +17 -0
- package/dist/Headers/PillHeader.d.ts +25 -0
- package/dist/Headers/index.d.ts +7 -0
- package/dist/Icons/CogWheel.d.ts +1 -0
- package/dist/Icons/index.d.ts +1 -0
- package/dist/Layout/boardMetrics.d.ts +20 -0
- package/dist/Layout/index.d.ts +3 -0
- package/dist/Layout/sliceLayout.d.ts +14 -0
- package/dist/Layout/sliceRows.d.ts +7 -0
- package/dist/Links/ModuleCollectionLinks.d.ts +19 -0
- package/dist/Links/drawableLinks.d.ts +8 -0
- package/dist/Links/index.d.ts +2 -0
- package/dist/Links/linkState.d.ts +17 -0
- package/dist/Menus/MenuDropdown.d.ts +29 -0
- package/dist/Menus/index.d.ts +1 -0
- package/dist/Messages/EventModelMessages.d.ts +153 -0
- package/dist/Messages/EventModelMessagesContext.d.ts +3 -0
- package/dist/Messages/EventModelMessagesProvider.d.ts +7 -0
- package/dist/Messages/defaultEventModelMessages.d.ts +2 -0
- package/dist/Messages/index.d.ts +4 -0
- package/dist/Model/Actor.d.ts +9 -0
- package/dist/Model/ActorType.d.ts +5 -0
- package/dist/Model/Assignee.d.ts +8 -0
- package/dist/Model/AssigneeKind.d.ts +5 -0
- package/dist/Model/AutomationTrigger.d.ts +9 -0
- package/dist/Model/AutomationTriggerSchedule.d.ts +8 -0
- package/dist/Model/AutomationTriggerType.d.ts +6 -0
- package/dist/Model/CommandConcurrency.d.ts +9 -0
- package/dist/Model/CommandItem.d.ts +13 -0
- package/dist/Model/CommandPropertyRules.d.ts +5 -0
- package/dist/Model/CommandRule.d.ts +4 -0
- package/dist/Model/ConcurrencyBinding.d.ts +5 -0
- package/dist/Model/ConcurrencyValueSource.d.ts +5 -0
- package/dist/Model/EventConstraint.d.ts +4 -0
- package/dist/Model/EventConstraints.d.ts +5 -0
- package/dist/Model/EventItem.d.ts +11 -0
- package/dist/Model/EventModel.d.ts +11 -0
- package/dist/Model/ExternalEventItem.d.ts +6 -0
- package/dist/Model/Feature.d.ts +14 -0
- package/dist/Model/Module.d.ts +12 -0
- package/dist/Model/ModuleCollection.d.ts +10 -0
- package/dist/Model/ModuleCollectionLink.d.ts +6 -0
- package/dist/Model/PersonaReference.d.ts +5 -0
- package/dist/Model/Position.d.ts +4 -0
- package/dist/Model/QueryItem.d.ts +7 -0
- package/dist/Model/QueryParameter.d.ts +5 -0
- package/dist/Model/QueryParameterType.d.ts +8 -0
- package/dist/Model/ReadModelItem.d.ts +8 -0
- package/dist/Model/ScreenTemplate.d.ts +4 -0
- package/dist/Model/Slice.d.ts +31 -0
- package/dist/Model/SliceSpecification.d.ts +19 -0
- package/dist/Model/SliceStatus.d.ts +9 -0
- package/dist/Model/SliceType.d.ts +6 -0
- package/dist/Model/SpecificationCommand.d.ts +7 -0
- package/dist/Model/SpecificationError.d.ts +7 -0
- package/dist/Model/SpecificationErrorRuleKind.d.ts +5 -0
- package/dist/Model/SpecificationErrorRuleReference.d.ts +8 -0
- package/dist/Model/SpecificationGivenEvent.d.ts +7 -0
- package/dist/Model/SpecificationReadModel.d.ts +6 -0
- package/dist/Model/SpecificationRunOutcome.d.ts +5 -0
- package/dist/Model/SpecificationThenEvent.d.ts +7 -0
- package/dist/Model/StickyNote.d.ts +8 -0
- package/dist/Model/UserExperienceActor.d.ts +10 -0
- package/dist/Model/index.d.ts +43 -0
- package/dist/Modules/ModuleColumnFrame.d.ts +11 -0
- package/dist/Modules/ModuleDropIndicator.d.ts +1 -0
- package/dist/Modules/ModuleHeader.d.ts +20 -0
- package/dist/Modules/ModuleHeaderAction.d.ts +14 -0
- package/dist/Modules/ModuleHeaderCell.d.ts +7 -0
- package/dist/Modules/ModuleHeaderMenu.d.ts +10 -0
- package/dist/Modules/ModulePlaceholder.d.ts +6 -0
- package/dist/Modules/ModuleSurface.d.ts +15 -0
- package/dist/Modules/ModulesArea.d.ts +23 -0
- package/dist/Modules/ModulesReordered.d.ts +2 -0
- package/dist/Modules/index.d.ts +12 -0
- package/dist/Modules/moduleAreaState.d.ts +27 -0
- package/dist/Modules/moduleWidth.d.ts +2 -0
- package/dist/Modules/persistModuleChange.d.ts +1 -0
- package/dist/Modules/useModuleDrag.d.ts +15 -0
- package/dist/Pickers/EventReferencePicker.d.ts +10 -0
- package/dist/Pickers/PickerPanel.d.ts +16 -0
- package/dist/Pickers/index.d.ts +2 -0
- package/dist/Pickers/useDismissOnOutsidePointer.d.ts +2 -0
- package/dist/Presentation/DetailLevel.d.ts +20 -0
- package/dist/Presentation/EventModelPresentation.d.ts +8 -0
- package/dist/Presentation/EventModelPresentationContext.d.ts +3 -0
- package/dist/Presentation/EventModelPresentationProvider.d.ts +7 -0
- package/dist/Presentation/VisualizationMode.d.ts +1 -0
- package/dist/Presentation/defaultEventModelPresentation.d.ts +2 -0
- package/dist/Presentation/detailsVisibility.d.ts +12 -0
- package/dist/Presentation/index.d.ts +7 -0
- package/dist/Properties/SchemaTooltipProperties.d.ts +9 -0
- package/dist/Properties/TypeBadge.d.ts +10 -0
- package/dist/Properties/index.d.ts +3 -0
- package/dist/Properties/schemaProperties.d.ts +6 -0
- package/dist/Reading/DocumentNode.d.ts +22 -0
- package/dist/Reading/InvalidEventModelDocument.d.ts +4 -0
- package/dist/Reading/index.d.ts +4 -0
- package/dist/Reading/isKnownValue.d.ts +1 -0
- package/dist/Reading/readActors.d.ts +4 -0
- package/dist/Reading/readBoardItems.d.ts +5 -0
- package/dist/Reading/readEventModelDocument.d.ts +2 -0
- package/dist/Reading/readJsonSchema.d.ts +2 -0
- package/dist/Reading/readModules.d.ts +3 -0
- package/dist/Reading/readSlice.d.ts +3 -0
- package/dist/Reading/readSliceItems.d.ts +7 -0
- package/dist/Reading/readSpecification.d.ts +3 -0
- package/dist/References/EventNavigateButton.d.ts +5 -0
- package/dist/References/ExternalEventCard.d.ts +14 -0
- package/dist/References/index.d.ts +3 -0
- package/dist/References/useReferenceHover.d.ts +12 -0
- package/dist/RowLabels/ActorRowDragGhost.d.ts +5 -0
- package/dist/RowLabels/ActorRowDropIndicator.d.ts +1 -0
- package/dist/RowLabels/ActorsReordered.d.ts +3 -0
- package/dist/RowLabels/RowLabel.d.ts +19 -0
- package/dist/RowLabels/RowLabelAction.d.ts +8 -0
- package/dist/RowLabels/RowLabelBadge.d.ts +8 -0
- package/dist/RowLabels/RowLabelsColumn.d.ts +20 -0
- package/dist/RowLabels/RowLabelsColumnFrame.d.ts +7 -0
- package/dist/RowLabels/actorKinds.d.ts +8 -0
- package/dist/RowLabels/actorRows.d.ts +4 -0
- package/dist/RowLabels/index.d.ts +12 -0
- package/dist/RowLabels/rowTypeName.d.ts +3 -0
- package/dist/RowLabels/useActorRowDrag.d.ts +30 -0
- package/dist/Rows/CellAction.d.ts +8 -0
- package/dist/Rows/CellActionButton.d.ts +6 -0
- package/dist/Rows/CellCorner.d.ts +7 -0
- package/dist/Rows/CellCornerAction.d.ts +7 -0
- package/dist/Rows/CellCornerPlacement.d.ts +4 -0
- package/dist/Rows/Chat/ChatCell.d.ts +9 -0
- package/dist/Rows/Chat/index.d.ts +1 -0
- package/dist/Rows/Events/EventCard.d.ts +9 -0
- package/dist/Rows/Events/EventReferenceCard.d.ts +7 -0
- package/dist/Rows/Events/EventsCell.d.ts +12 -0
- package/dist/Rows/Events/SliceEvents.d.ts +11 -0
- package/dist/Rows/Events/index.d.ts +5 -0
- package/dist/Rows/Events/referenceableEvents.d.ts +2 -0
- package/dist/Rows/Interaction/InteractionCard.d.ts +14 -0
- package/dist/Rows/Interaction/InteractionCell.d.ts +31 -0
- package/dist/Rows/Interaction/InteractionMiniCard.d.ts +4 -0
- package/dist/Rows/Interaction/OptionalReadModel.d.ts +6 -0
- package/dist/Rows/Interaction/SliceInteraction.d.ts +11 -0
- package/dist/Rows/Interaction/index.d.ts +5 -0
- package/dist/Rows/RowType.d.ts +7 -0
- package/dist/Rows/System/SystemCell.d.ts +12 -0
- package/dist/Rows/System/TriggerControl.d.ts +8 -0
- package/dist/Rows/System/TriggerKind.d.ts +5 -0
- package/dist/Rows/System/index.d.ts +4 -0
- package/dist/Rows/System/triggerBadges.d.ts +4 -0
- package/dist/Rows/UserExperience/AddPrototypeButton.d.ts +7 -0
- package/dist/Rows/UserExperience/PrototypeTemplate.d.ts +6 -0
- package/dist/Rows/UserExperience/UiCell.d.ts +17 -0
- package/dist/Rows/UserExperience/addPrototypeMenuItems.d.ts +8 -0
- package/dist/Rows/UserExperience/index.d.ts +4 -0
- package/dist/Rows/eventRowAffordances.d.ts +5 -0
- package/dist/Rows/index.d.ts +12 -0
- package/dist/SliceDragging/SliceDragGestureVerdict.d.ts +5 -0
- package/dist/SliceDragging/SliceDragGhost.d.ts +6 -0
- package/dist/SliceDragging/SliceDropIndicator.d.ts +5 -0
- package/dist/SliceDragging/SliceDropTarget.d.ts +14 -0
- package/dist/SliceDragging/SliceDropVerdict.d.ts +4 -0
- package/dist/SliceDragging/SliceMoved.d.ts +2 -0
- package/dist/SliceDragging/ValidateSliceDrop.d.ts +3 -0
- package/dist/SliceDragging/dropIndicatorClassName.d.ts +1 -0
- package/dist/SliceDragging/index.d.ts +14 -0
- package/dist/SliceDragging/readSliceDragGesture.d.ts +5 -0
- package/dist/SliceDragging/readSlicePress.d.ts +20 -0
- package/dist/SliceDragging/sliceMove.d.ts +10 -0
- package/dist/SliceDragging/snapshotSlice.d.ts +8 -0
- package/dist/SliceDragging/useSliceDrag.d.ts +30 -0
- package/dist/SliceDragging/useSliceDragIntent.d.ts +10 -0
- package/dist/SliceTypes/SliceTypeIcon.d.ts +5 -0
- package/dist/SliceTypes/SliceTypeMenu.d.ts +6 -0
- package/dist/SliceTypes/index.d.ts +3 -0
- package/dist/SliceTypes/sliceTypeMenuItems.d.ts +7 -0
- package/dist/Slices/SliceColumn.d.ts +18 -0
- package/dist/Slices/SliceColumnFrame.d.ts +20 -0
- package/dist/Slices/SliceContext.d.ts +2 -0
- package/dist/Slices/SliceContextValue.d.ts +7 -0
- package/dist/Slices/SliceHeader.d.ts +14 -0
- package/dist/Slices/SliceHeaderAction.d.ts +10 -0
- package/dist/Slices/SliceHeaderSlice.d.ts +2 -0
- package/dist/Slices/SliceNames.d.ts +6 -0
- package/dist/Slices/SlicePlaceholder.d.ts +15 -0
- package/dist/Slices/SliceProvider.d.ts +10 -0
- package/dist/Slices/SliceRows.d.ts +28 -0
- package/dist/Slices/SlicesArea.d.ts +38 -0
- package/dist/Slices/createOptimisticSlice.d.ts +3 -0
- package/dist/Slices/index.d.ts +15 -0
- package/dist/Slices/resolveSliceReadOnly.d.ts +3 -0
- package/dist/Slices/sliceAreaState.d.ts +43 -0
- package/dist/Slices/useSlice.d.ts +3 -0
- package/dist/Specifications/GivenSection.d.ts +12 -0
- package/dist/Specifications/SpecificationAction.d.ts +19 -0
- package/dist/Specifications/SpecificationAddPicker.d.ts +11 -0
- package/dist/Specifications/SpecificationCollection.d.ts +16 -0
- package/dist/Specifications/SpecificationEditing.d.ts +20 -0
- package/dist/Specifications/SpecificationErrorCard.d.ts +5 -0
- package/dist/Specifications/SpecificationHeader.d.ts +14 -0
- package/dist/Specifications/SpecificationItemCard.d.ts +7 -0
- package/dist/Specifications/SpecificationItemKind.d.ts +5 -0
- package/dist/Specifications/SpecificationItemToOpen.d.ts +14 -0
- package/dist/Specifications/SpecificationRow.d.ts +8 -0
- package/dist/Specifications/SpecificationRunButton.d.ts +7 -0
- package/dist/Specifications/SpecificationRunState.d.ts +23 -0
- package/dist/Specifications/SpecificationSection.d.ts +8 -0
- package/dist/Specifications/SpecificationStatus.d.ts +14 -0
- package/dist/Specifications/ThenSection.d.ts +15 -0
- package/dist/Specifications/WhenSection.d.ts +12 -0
- package/dist/Specifications/index.d.ts +10 -0
- package/dist/Specifications/itemValues.d.ts +7 -0
- package/dist/Specifications/ruleErrors.d.ts +8 -0
- package/dist/Specifications/specificationCollectionState.d.ts +7 -0
- package/dist/Specifications/specificationEvents.d.ts +3 -0
- package/dist/Statuses/SliceStatusIcon.d.ts +5 -0
- package/dist/Statuses/SliceStatusPicker.d.ts +8 -0
- package/dist/Statuses/changeSliceStatus.d.ts +2 -0
- package/dist/Statuses/index.d.ts +4 -0
- package/dist/Statuses/sliceStatuses.d.ts +6 -0
- package/dist/StickyNotes/StickyNoteBounds.d.ts +6 -0
- package/dist/StickyNotes/StickyNoteChanges.d.ts +9 -0
- package/dist/StickyNotes/StickyNoteHandle.d.ts +4 -0
- package/dist/StickyNotes/StickyNoteState.d.ts +16 -0
- package/dist/StickyNotes/StickyNotes.d.ts +6 -0
- package/dist/StickyNotes/index.d.ts +6 -0
- package/dist/StickyNotes/isEditableTarget.d.ts +1 -0
- package/dist/Tooltips/AnchoredOverlay.d.ts +27 -0
- package/dist/Tooltips/GridTooltip.d.ts +21 -0
- package/dist/Tooltips/index.d.ts +2 -0
- package/dist/Viewport/index.d.ts +2 -0
- package/dist/Viewport/useInViewport.d.ts +3 -0
- package/dist/Viewport/viewportFlushScheduler.d.ts +7 -0
- package/dist/event-model-document.schema.json +827 -0
- package/dist/event-models.css +2 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +7682 -0
- package/dist/index.js.map +1 -0
- package/dist/theme.css +53 -0
- package/package.json +66 -3
package/README.md
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- Copyright (c) Cratis. All rights reserved. -->
|
|
2
|
+
<!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
# @cratis/event-models
|
|
5
|
+
|
|
6
|
+
The Cratis event model board as a React component. It is the same board Cratis Studio draws, both the editor and the read-only viewer.
|
|
7
|
+
|
|
8
|
+
The package is on `0.x`, so its API can still change between minor versions. Pin a minor version, for example `~0.2.0`.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @cratis/event-models @cratis/scene @cratis/components @cratis/fundamentals primeicons pixi.js react react-dom
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Everything except the board itself is a peer dependency, so your application decides the versions.
|
|
17
|
+
|
|
18
|
+
## Render a board
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { EventModelBoard, readEventModelDocument } from '@cratis/event-models';
|
|
22
|
+
import '@cratis/components/styles';
|
|
23
|
+
import '@cratis/event-models/theme';
|
|
24
|
+
import '@cratis/event-models/styles';
|
|
25
|
+
import '@cratis/scene/styles';
|
|
26
|
+
import 'primeicons/primeicons.css';
|
|
27
|
+
|
|
28
|
+
const model = readEventModelDocument(json);
|
|
29
|
+
|
|
30
|
+
export const Board = () => (
|
|
31
|
+
<div style={{ height: '100vh' }}>
|
|
32
|
+
<EventModelBoard document={model} readOnly />
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- `readEventModelDocument` reads a document shaped like the published JSON Schema (`@cratis/event-models/schema`) into an `EventModel`.
|
|
38
|
+
- The board fills its parent, so give the parent a height.
|
|
39
|
+
- `readOnly` draws the board without any editing gestures. Leave it off and pass `editor` to receive the board's edits as callbacks. The package never persists anything by itself.
|
|
40
|
+
|
|
41
|
+
## Styling
|
|
42
|
+
|
|
43
|
+
`@cratis/event-models/styles` holds the board's own CSS. The board paints itself from design tokens: card sizes and colors, and a PrimeReact-style surface and text palette. If your application does not already define them, import `@cratis/event-models/theme` for the values Cratis Studio uses. Every value in it has zero specificity, so anything your application sets on `:root` wins.
|
|
44
|
+
|
|
45
|
+
The colors follow the page's `color-scheme` (`light-dark()`), and text uses the page's font, so set both on your page.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { CardSurface } from '../Cards/CardSurface';
|
|
2
|
+
import type { CellAction } from '../Rows/CellAction';
|
|
3
|
+
import type { PrototypeTemplate } from '../Rows/UserExperience/PrototypeTemplate';
|
|
4
|
+
import type { SpecificationAction, SpecificationCollectionAction, SpecificationGenerationAction } from '../Specifications/SpecificationAction';
|
|
5
|
+
import type { SliceHeaderAction } from '../Slices/SliceHeaderAction';
|
|
6
|
+
import type { FeatureHeaderAction } from '../Features/FeatureHeaderAction';
|
|
7
|
+
import type { FeatureHeaderMenuAction } from '../Features/FeatureHeaderMenuAction';
|
|
8
|
+
import type { FeatureHeaderSuggestion } from '../Features/FeatureHeaderSuggestion';
|
|
9
|
+
import type { ModuleHeaderAction } from '../Modules/ModuleHeaderAction';
|
|
10
|
+
import type { StickyNote } from '../Model';
|
|
11
|
+
export interface BoardActions {
|
|
12
|
+
stickyNoteCreated?: (note: StickyNote) => void;
|
|
13
|
+
stickyNoteCreatingChanged?: (busy: boolean) => void;
|
|
14
|
+
stickyNoteError?: (error: unknown) => void;
|
|
15
|
+
moduleHeaderLeading?: readonly ModuleHeaderAction[];
|
|
16
|
+
moduleHeaderMenu?: readonly ModuleHeaderAction[];
|
|
17
|
+
moduleHeaderAfterMenu?: readonly ModuleHeaderAction[];
|
|
18
|
+
moduleHeaderAdd?: readonly ModuleHeaderAction[];
|
|
19
|
+
moduleHeaderSuggestions?: readonly FeatureHeaderSuggestion[];
|
|
20
|
+
sliceHeader?: readonly SliceHeaderAction[];
|
|
21
|
+
featureHeader?: readonly FeatureHeaderAction[];
|
|
22
|
+
featureHeaderLeading?: readonly FeatureHeaderAction[];
|
|
23
|
+
featureHeaderAfterMenu?: readonly FeatureHeaderAction[];
|
|
24
|
+
featureHeaderMenu?: readonly FeatureHeaderMenuAction[];
|
|
25
|
+
featureHeaderAdd?: readonly FeatureHeaderMenuAction[];
|
|
26
|
+
featureHeaderSuggestions?: readonly FeatureHeaderSuggestion[];
|
|
27
|
+
eventCard?: CardSurface;
|
|
28
|
+
commandCard?: CardSurface;
|
|
29
|
+
readModelCard?: CardSurface;
|
|
30
|
+
eventsRow?: readonly CellAction[];
|
|
31
|
+
prototypeTemplates?: readonly PrototypeTemplate[];
|
|
32
|
+
interactionRow?: readonly CellAction[];
|
|
33
|
+
specificationRun?: SpecificationAction;
|
|
34
|
+
specificationStop?: SpecificationAction;
|
|
35
|
+
specificationsRunAll?: SpecificationCollectionAction;
|
|
36
|
+
specificationsGenerate?: SpecificationGenerationAction;
|
|
37
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type CanvasProps } from '@cratis/components/Canvas';
|
|
2
|
+
import type { BoardCanvasChrome } from './BoardCanvasChrome';
|
|
3
|
+
export interface BoardCanvasProps extends Omit<CanvasProps, 'controlsLabels' | 'controlsIcons' | 'controlsGlassSurface' | 'captureAttributes' | 'controlsFollowViewportInsets' | 'readOnly'> {
|
|
4
|
+
chrome?: BoardCanvasChrome;
|
|
5
|
+
}
|
|
6
|
+
export declare const BoardCanvas: ({ chrome, onHelp, helpTitle, ...props }: BoardCanvasProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { CanvasCaptureAttributes, CanvasControlsIcons, CanvasControlsLabels } from '@cratis/components/Canvas';
|
|
3
|
+
export interface BoardCanvasChrome {
|
|
4
|
+
controlsLabels?: CanvasControlsLabels;
|
|
5
|
+
controlsIcons?: CanvasControlsIcons;
|
|
6
|
+
controlsSurface?: ReactNode;
|
|
7
|
+
captureAttributes?: CanvasCaptureAttributes;
|
|
8
|
+
controlsFollowViewportInsets?: boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { Guid } from '@cratis/fundamentals';
|
|
3
|
+
import { type CollectionSizeEstimate } from '../Collections';
|
|
4
|
+
import type { BoardCollection, CollectionGridRenderer } from './BoardCollections';
|
|
5
|
+
export interface BoardCollectionViewProps {
|
|
6
|
+
collection: BoardCollection;
|
|
7
|
+
estimatedSize: CollectionSizeEstimate;
|
|
8
|
+
measuredSize?: {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
};
|
|
12
|
+
onSize: (id: Guid, width: number, height: number) => void;
|
|
13
|
+
getZoom: () => number;
|
|
14
|
+
canMove: boolean;
|
|
15
|
+
onCollectionMoving?: (id: Guid, deltaX: number, deltaY: number) => void;
|
|
16
|
+
onCollectionMoved?: (id: Guid, position: {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
}) => void;
|
|
20
|
+
content: (grid: CollectionGridRenderer) => ReactNode;
|
|
21
|
+
}
|
|
22
|
+
export declare const BoardCollectionView: import("react").MemoExoticComponent<({ collection, estimatedSize, measuredSize, onSize, getZoom, canMove, onCollectionMoving, onCollectionMoved, content }: BoardCollectionViewProps) => import("react").JSX.Element>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { Guid } from '@cratis/fundamentals';
|
|
3
|
+
import type { CollectionGridProps, CollectionItem, CollectionsArea, CollectionsAreaOptions, CollectionSizeEstimate } from '../Collections';
|
|
4
|
+
export interface BoardCollection extends CollectionItem {
|
|
5
|
+
modules: {
|
|
6
|
+
id: Guid;
|
|
7
|
+
name: string;
|
|
8
|
+
}[];
|
|
9
|
+
}
|
|
10
|
+
export type CollectionGridContent = Omit<CollectionGridProps, 'getZoom' | 'canMove' | 'onCollectionMoving' | 'onCollectionMoved'>;
|
|
11
|
+
export type CollectionGridRenderer = (content: CollectionGridContent) => ReactElement;
|
|
12
|
+
export interface BoardCollections<T extends BoardCollection> extends CollectionsAreaOptions<T> {
|
|
13
|
+
estimateSize: (collection: T) => CollectionSizeEstimate;
|
|
14
|
+
countSlices: (collection: T) => number;
|
|
15
|
+
renderCollection: (collection: T, grid: CollectionGridRenderer) => ReactNode;
|
|
16
|
+
area?: (area: CollectionsArea<T>, children: ReactNode) => ReactNode;
|
|
17
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EventModelMessages } from '../Messages';
|
|
2
|
+
import type { EventModelPresentation } from '../Presentation';
|
|
3
|
+
import type { BoardInteraction } from './BoardInteraction';
|
|
4
|
+
export interface BoardContextValue extends BoardInteraction {
|
|
5
|
+
readOnly: boolean;
|
|
6
|
+
presentation: EventModelPresentation;
|
|
7
|
+
messages: EventModelMessages;
|
|
8
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Guid } from '@cratis/fundamentals';
|
|
2
|
+
import type { EventItem, SliceStatus, SliceType } from '../Model';
|
|
3
|
+
import type { TriggerKind } from '../Rows/System/TriggerKind';
|
|
4
|
+
import type { SpecificationEditing } from '../Specifications/SpecificationEditing';
|
|
5
|
+
import type { StickyNoteChanges } from '../StickyNotes/StickyNoteChanges';
|
|
6
|
+
export interface BoardEditing extends SpecificationEditing, StickyNoteChanges {
|
|
7
|
+
onSliceOpenStateSet?: (sliceId: Guid, isOpen: boolean) => void;
|
|
8
|
+
onSliceRenamed?: (sliceId: Guid, name: string) => void;
|
|
9
|
+
onSliceStatusChanged?: (sliceId: Guid, status: SliceStatus) => Promise<boolean | void> | void;
|
|
10
|
+
onSliceAdded?: (afterSliceId: Guid, sliceType: SliceType) => void;
|
|
11
|
+
onEventAdded?: (sliceId: Guid) => void;
|
|
12
|
+
onEventReferenced?: (sliceId: Guid, source: EventItem) => void;
|
|
13
|
+
onEventRenamed?: (sliceId: Guid, eventId: Guid, name: string) => string | void;
|
|
14
|
+
onCommandRenamed?: (sliceId: Guid, commandId: Guid, name: string) => void;
|
|
15
|
+
onReadModelRenamed?: (sliceId: Guid, readModelId: Guid, name: string) => void;
|
|
16
|
+
onReadModelAdded?: (sliceId: Guid, host: DOMRect) => void;
|
|
17
|
+
onTriggerKindChosen?: (sliceId: Guid, kind: TriggerKind) => void;
|
|
18
|
+
onTriggerOpened?: (sliceId: Guid) => void;
|
|
19
|
+
onPrototypeOpened?: (sliceId: Guid, actorId: string, host: DOMRect) => void;
|
|
20
|
+
onPrototypeAdded?: (sliceId: Guid, actorId: string, host: DOMRect) => void;
|
|
21
|
+
onExternalEventAdded?: (sliceId: Guid, source: EventItem) => void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BoardActions } from './BoardActions';
|
|
2
|
+
import type { BoardEditing } from './BoardEditing';
|
|
3
|
+
import type { BoardNavigation } from './BoardNavigation';
|
|
4
|
+
import type { BoardSelection } from './BoardSelection';
|
|
5
|
+
export interface BoardInteraction {
|
|
6
|
+
editing: BoardEditing;
|
|
7
|
+
actions: BoardActions;
|
|
8
|
+
selection: BoardSelection;
|
|
9
|
+
navigation: BoardNavigation;
|
|
10
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BoardInteraction } from './BoardInteraction';
|
|
3
|
+
export type BoardInteractionProviderProps = Partial<BoardInteraction> & {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
};
|
|
6
|
+
export declare const BoardInteractionProvider: ({ editing, actions, selection, navigation, children }: BoardInteractionProviderProps) => React.JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BoardInteraction } from './BoardInteraction';
|
|
3
|
+
export interface BoardProviderProps extends Partial<BoardInteraction> {
|
|
4
|
+
readOnly?: boolean;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const BoardProvider: ({ readOnly, editing, actions, selection, navigation, children }: BoardProviderProps) => React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BoardReadOnlyContext: import("react").Context<boolean>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface BoardToolbarProps {
|
|
3
|
+
slotName: string;
|
|
4
|
+
order?: number;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const BoardToolbar: ({ slotName, order, children }: BoardToolbarProps) => import("react").JSX.Element | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Ref } from 'react';
|
|
2
|
+
import type { EventModel } from '../Model';
|
|
3
|
+
import type { EventModelBoardCanvas, EventModelBoardEditor } from './EventModelBoardEditor';
|
|
4
|
+
import type { EventModelBoardHandle } from './EventModelBoardHandle';
|
|
5
|
+
export interface EventModelBoardProps {
|
|
6
|
+
document: EventModel;
|
|
7
|
+
readOnly?: boolean;
|
|
8
|
+
editor?: EventModelBoardEditor;
|
|
9
|
+
canvas?: EventModelBoardCanvas;
|
|
10
|
+
showMinimap?: boolean;
|
|
11
|
+
handle?: Ref<EventModelBoardHandle>;
|
|
12
|
+
}
|
|
13
|
+
export declare const EventModelBoard: ({ document, readOnly, editor, canvas, showMinimap, handle }: EventModelBoardProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ModuleCollection } from '../Model';
|
|
3
|
+
import type { CollectionGridProps } from '../Collections';
|
|
4
|
+
import type { CollectionsAreaOptions } from '../Collections';
|
|
5
|
+
import type { ModuleCollectionLinksProps } from '../Links';
|
|
6
|
+
import type { BoardCanvasProps } from './BoardCanvas';
|
|
7
|
+
import type { BoardInteraction } from './BoardInteraction';
|
|
8
|
+
export type EventModelBoardCanvas = Omit<BoardCanvasProps, 'children' | 'minimapItems' | 'minimapWorldWidth' | 'minimapWorldHeight' | 'showMinimap'>;
|
|
9
|
+
export interface EventModelBoardInteractions extends Partial<BoardInteraction> {
|
|
10
|
+
links?: Pick<ModuleCollectionLinksProps, 'onCollectionsLinked' | 'onCollectionsUnlinked' | 'onPersistenceError'>;
|
|
11
|
+
}
|
|
12
|
+
export interface EventModelBoardEditor extends EventModelBoardInteractions {
|
|
13
|
+
collections?: Pick<CollectionsAreaOptions<ModuleCollection>, 'onAddCollection' | 'onCollectionMoved' | 'onCollectionsChange' | 'onPersistenceError'>;
|
|
14
|
+
collectionBoundary?: (collection: ModuleCollection, children: ReactNode) => ReactNode;
|
|
15
|
+
collection?: (collection: ModuleCollection) => Omit<CollectionGridProps, 'collection' | 'getZoom' | 'onCollectionMoving' | 'onCollectionMoved' | 'canMove'>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Ref } from 'react';
|
|
2
|
+
import type { Guid } from '@cratis/fundamentals';
|
|
3
|
+
import type { ModuleCollectionLink, StickyNote } from '../Model';
|
|
4
|
+
import type { BoardCollection, BoardCollections } from './BoardCollections';
|
|
5
|
+
import type { EventModelBoardCanvas, EventModelBoardInteractions } from './EventModelBoardEditor';
|
|
6
|
+
import type { EventModelBoardHandle } from './EventModelBoardHandle';
|
|
7
|
+
export interface HostedEventModelBoardProps<T extends BoardCollection> {
|
|
8
|
+
id: Guid;
|
|
9
|
+
collections: BoardCollections<T>;
|
|
10
|
+
links: ModuleCollectionLink[];
|
|
11
|
+
stickyNotes: readonly StickyNote[];
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
editor?: EventModelBoardInteractions;
|
|
14
|
+
canvas?: EventModelBoardCanvas;
|
|
15
|
+
showMinimap?: boolean;
|
|
16
|
+
handle?: Ref<EventModelBoardHandle>;
|
|
17
|
+
}
|
|
18
|
+
export declare const HostedEventModelBoard: <T extends BoardCollection>({ id, readOnly, showMinimap, editor, ...props }: HostedEventModelBoardProps<T>) => import("react").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Position } from '../Model';
|
|
2
|
+
export interface BoardMinimapItem {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
color: string;
|
|
8
|
+
}
|
|
9
|
+
export interface BoardMinimap {
|
|
10
|
+
items: BoardMinimapItem[];
|
|
11
|
+
worldWidth: number;
|
|
12
|
+
worldHeight: number;
|
|
13
|
+
}
|
|
14
|
+
export declare const boardMinimap: (collections: readonly {
|
|
15
|
+
position?: Position;
|
|
16
|
+
size: {
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
};
|
|
20
|
+
}[]) => BoardMinimap;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export * from './BoardContextValue';
|
|
2
|
+
export * from './BoardActions';
|
|
3
|
+
export * from './BoardEditing';
|
|
4
|
+
export * from './BoardInteraction';
|
|
5
|
+
export * from './BoardInteractionProvider';
|
|
6
|
+
export * from './BoardNavigation';
|
|
7
|
+
export * from './BoardSelection';
|
|
8
|
+
export * from './BoardProvider';
|
|
9
|
+
export * from './useBoard';
|
|
10
|
+
export * from './BoardCanvas';
|
|
11
|
+
export * from './EventModelBoard';
|
|
12
|
+
export * from './EventModelBoardEditor';
|
|
13
|
+
export * from './EventModelBoardHandle';
|
|
14
|
+
export * from './BoardCollections';
|
|
15
|
+
export * from './HostedEventModelBoard';
|
|
16
|
+
export * from './boardMinimap';
|
|
17
|
+
export * from './isLargeBoard';
|
|
18
|
+
export * from './BoardCanvasChrome';
|
|
19
|
+
export * from './BoardToolbar';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { JsonSchema } from '@cratis/components/SchemaEditor';
|
|
3
|
+
import type { Guid } from '@cratis/fundamentals';
|
|
4
|
+
import { ArtifactCardKind } from './ArtifactCardKind';
|
|
5
|
+
import { type CardProps } from './Card';
|
|
6
|
+
import type { CardAction } from './CardAction';
|
|
7
|
+
export interface ArtifactCardProps extends Omit<CardProps, 'backgroundColor' | 'textColor' | 'extraContent'> {
|
|
8
|
+
kind: ArtifactCardKind;
|
|
9
|
+
artifactId?: Guid;
|
|
10
|
+
summary?: string;
|
|
11
|
+
tags?: readonly string[];
|
|
12
|
+
schema?: string | JsonSchema;
|
|
13
|
+
showDetails?: boolean;
|
|
14
|
+
actions?: readonly CardAction[];
|
|
15
|
+
onActivate?: (artifactId: Guid, host: DOMRect) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const ArtifactCard: ({ kind, artifactId, summary, tags, schema, showDetails, actions, onActivate, onSelected, ...cardProps }: ArtifactCardProps) => React.JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface CardProps {
|
|
3
|
+
name: string;
|
|
4
|
+
backgroundColor: string;
|
|
5
|
+
textColor: string;
|
|
6
|
+
isSelected?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
onSelected?: () => void;
|
|
9
|
+
onStartEdit?: () => void;
|
|
10
|
+
extraContent?: React.ReactNode;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
ariaLabel?: string;
|
|
13
|
+
ariaPressed?: boolean;
|
|
14
|
+
'data-event-id'?: string;
|
|
15
|
+
'data-card-id'?: string;
|
|
16
|
+
'data-slice-id'?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const Card: React.FC<CardProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Guid } from '@cratis/fundamentals';
|
|
2
|
+
import type { CardCorner } from './CardCorner';
|
|
3
|
+
export interface CardAction {
|
|
4
|
+
icon: string;
|
|
5
|
+
tooltip: string;
|
|
6
|
+
corner?: CardCorner;
|
|
7
|
+
when?: (artifactId: Guid) => boolean;
|
|
8
|
+
active?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
busy?: boolean;
|
|
11
|
+
onActivate: (artifactId: Guid, host: DOMRect) => void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CardAction } from './CardAction';
|
|
2
|
+
import { CardCorner } from './CardCorner';
|
|
3
|
+
export interface CardActionButtonProps {
|
|
4
|
+
action: CardAction;
|
|
5
|
+
corner: CardCorner;
|
|
6
|
+
slot: number;
|
|
7
|
+
onActivate: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const CardActionButton: ({ action, corner, slot, onActivate }: CardActionButtonProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface CardNameInputProps {
|
|
3
|
+
value: string;
|
|
4
|
+
backgroundColor: string;
|
|
5
|
+
textColor: string;
|
|
6
|
+
nameError?: string;
|
|
7
|
+
onChange: (value: string) => void;
|
|
8
|
+
onCommit: () => void;
|
|
9
|
+
onCancel: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const CardNameInput: React.FC<CardNameInputProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface EventTagsProps {
|
|
2
|
+
/** The tags to render. */
|
|
3
|
+
tags?: readonly string[];
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Renders the tags of an event type as a row of chips on the event card.
|
|
7
|
+
*/
|
|
8
|
+
export declare const EventTags: ({ tags }: EventTagsProps) => import("react").JSX.Element | null;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** The default largest font size a card title renders at — matches the existing card face font size. */
|
|
2
|
+
export declare const DEFAULT_MAX_TITLE_FONT_SIZE_PX = 13;
|
|
3
|
+
/** The default smallest single-line font size before a title switches to wrapping across two lines. */
|
|
4
|
+
export declare const DEFAULT_MIN_TITLE_FONT_SIZE_PX = 10;
|
|
5
|
+
/** Measures the rendered pixel width of `text` at `fontSizePx`. Implemented with real font metrics by
|
|
6
|
+
* {@link useAutoFitTitle}; injected here so {@link computeAutoFitTitle} stays a pure, spec-able function. */
|
|
7
|
+
export type MeasureTextWidth = (text: string, fontSizePx: number) => number;
|
|
8
|
+
export interface AutoFitTitleOptions {
|
|
9
|
+
/** The largest font size to try, in pixels. */
|
|
10
|
+
maxFontSizePx: number;
|
|
11
|
+
/** The smallest single-line font size to try before falling back to a two-line wrap, in pixels. */
|
|
12
|
+
minFontSizePx: number;
|
|
13
|
+
/** The width available to the title, in pixels. */
|
|
14
|
+
availableWidthPx: number;
|
|
15
|
+
}
|
|
16
|
+
export interface AutoFitTitleResult {
|
|
17
|
+
/** The font size to render the title at, in pixels. */
|
|
18
|
+
fontSizePx: number;
|
|
19
|
+
/** The line(s) to render. A single entry when the title fits on one line; two when it was wrapped. */
|
|
20
|
+
lines: string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Finds the largest font size (within `options`) at which `text` fits on a single line within
|
|
24
|
+
* `availableWidthPx`, shrinking from `maxFontSizePx` down to `minFontSizePx`. When even `minFontSizePx`
|
|
25
|
+
* does not fit on one line, wraps the text across two lines at the nearest PascalCase word boundary
|
|
26
|
+
* (see {@link splitAtPascalCaseBreak}) and renders those at `minFontSizePx`, rather than shrinking the
|
|
27
|
+
* font further into unreadable territory.
|
|
28
|
+
*/
|
|
29
|
+
export declare function computeAutoFitTitle(text: string, options: AutoFitTitleOptions, measure: MeasureTextWidth): AutoFitTitleResult;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raw hex values for card colors.
|
|
3
|
+
*
|
|
4
|
+
* These MUST match the CSS custom properties defined in .frontend/index.css
|
|
5
|
+
* (--card-event-bg, --card-command-bg, etc.) so that both JS-driven inline
|
|
6
|
+
* styles and CSS class rules resolve to the same palette.
|
|
7
|
+
*/
|
|
8
|
+
/** Background and text colors for event-modeling card types. */
|
|
9
|
+
export interface CardColors {
|
|
10
|
+
/** Card face background color. */
|
|
11
|
+
background: string;
|
|
12
|
+
/** Card face text color. */
|
|
13
|
+
text: string;
|
|
14
|
+
}
|
|
15
|
+
/** Event (domain event) card colors — warm orange. */
|
|
16
|
+
export declare const eventCardColors: CardColors;
|
|
17
|
+
/** Command card colors — sky blue. */
|
|
18
|
+
export declare const commandCardColors: CardColors;
|
|
19
|
+
/** Read model card colors — lime green. */
|
|
20
|
+
export declare const readModelCardColors: CardColors;
|
|
21
|
+
/** External event (event from another module the Translator translates from) card colors — yellow, the event-modeling convention for external events. */
|
|
22
|
+
export declare const externalEventCardColors: CardColors;
|
|
23
|
+
/**
|
|
24
|
+
* Concept card colors — violet, the color the event-model board already gives to the structural
|
|
25
|
+
* (feature) level rather than to any of the event/command/read-model artifacts. A concept is neither of
|
|
26
|
+
* those, so it gets its own place in the same palette instead of borrowing one of theirs.
|
|
27
|
+
*/
|
|
28
|
+
export declare const conceptCardColors: CardColors;
|
|
29
|
+
/** Error card colors — red. */
|
|
30
|
+
export declare const errorCardColors: CardColors;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './Card';
|
|
2
|
+
export * from './cardColors';
|
|
3
|
+
export * from './pascalCaseBreak';
|
|
4
|
+
export * from './autoFitTitle';
|
|
5
|
+
export * from './useAutoFitTitle';
|
|
6
|
+
export * from './ArtifactCard';
|
|
7
|
+
export * from './ArtifactCardKind';
|
|
8
|
+
export * from './CardAction';
|
|
9
|
+
export * from './CardCorner';
|
|
10
|
+
export * from './EventTags';
|
|
11
|
+
export * from './CardSurface';
|
|
12
|
+
export * from './CardNameInput';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finds the index of the best place to break a PascalCase name (e.g. an event or command type name like
|
|
3
|
+
* `CustomerAddressUpdated`) into two lines, so a wrapped card title breaks at a word boundary rather than
|
|
4
|
+
* mid-word. Candidates are ranked in two tiers, closest-to-the-middle first within each tier:
|
|
5
|
+
*
|
|
6
|
+
* 1. A "word start" — an uppercase letter directly preceded by a lowercase letter (`...ss|Up...` in
|
|
7
|
+
* `AddressUpdated`). This is the overwhelmingly common case for Cratis event/command names.
|
|
8
|
+
* 2. Any other uppercase letter (index > 0) — a fallback for names built from acronym runs
|
|
9
|
+
* (`HTTPServer`) where tier 1 finds nothing, since there is no lowercase-to-uppercase transition.
|
|
10
|
+
*
|
|
11
|
+
* Returns `null` when the text has no uppercase letter to break before (e.g. a single lowercase word, or
|
|
12
|
+
* text too short to usefully split) — callers fall back to a plain midpoint split in that case.
|
|
13
|
+
*/
|
|
14
|
+
export declare function nearestPascalCaseBreakIndex(text: string): number | null;
|
|
15
|
+
/**
|
|
16
|
+
* Splits a PascalCase name into two lines at the {@link nearestPascalCaseBreakIndex}. Falls back to an
|
|
17
|
+
* even midpoint split when no uppercase boundary exists, so every name can still be wrapped rather than
|
|
18
|
+
* truncated with an ellipsis.
|
|
19
|
+
*/
|
|
20
|
+
export declare function splitAtPascalCaseBreak(text: string): [string, string];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { AutoFitTitleResult } from './autoFitTitle';
|
|
3
|
+
export interface UseAutoFitTitleOptions {
|
|
4
|
+
/** The CSS font-family the title renders with — must match the element's actual styling for accurate measurement. */
|
|
5
|
+
fontFamily: string;
|
|
6
|
+
/** The CSS font-weight the title renders with. */
|
|
7
|
+
fontWeight: string | number;
|
|
8
|
+
/** The largest font size to try, in pixels. Defaults to {@link DEFAULT_MAX_TITLE_FONT_SIZE_PX}. */
|
|
9
|
+
maxFontSizePx?: number;
|
|
10
|
+
/** The smallest single-line font size before wrapping, in pixels. Defaults to {@link DEFAULT_MIN_TITLE_FONT_SIZE_PX}. */
|
|
11
|
+
minFontSizePx?: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Measures `text` against the width of the element attached to the returned ref and shrinks/wraps it to
|
|
15
|
+
* fit, via {@link computeAutoFitTitle}. Re-measures whenever the text or font options change.
|
|
16
|
+
*
|
|
17
|
+
* The element the ref attaches to must already be laid out at its final width when this runs (a block
|
|
18
|
+
* element that doesn't grow with its own text content, e.g. `white-space: nowrap; overflow: hidden`) —
|
|
19
|
+
* its `clientWidth` at effect time is taken as the space available to the title.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useAutoFitTitle<T extends HTMLElement>(text: string, options: UseAutoFitTitleOptions): [RefObject<T | null>, AutoFitTitleResult];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { Guid } from '@cratis/fundamentals';
|
|
3
|
+
import { type RowLabelsColumnProps } from '../RowLabels';
|
|
4
|
+
import type { Feature, Module, ModuleCollection } from '../Model';
|
|
5
|
+
import type { CollectionGridSlots } from './CollectionGridSlots';
|
|
6
|
+
import type { CollectionGridEditor } from './CollectionGridEditor';
|
|
7
|
+
export interface CollectionGridProps extends CollectionGridEditor {
|
|
8
|
+
collection: ModuleCollection;
|
|
9
|
+
getZoom?: () => number;
|
|
10
|
+
slots?: CollectionGridSlots;
|
|
11
|
+
onDeselect?: () => void;
|
|
12
|
+
onCollectionMoving?: (id: Guid, deltaX: number, deltaY: number) => void;
|
|
13
|
+
onCollectionMoved?: (id: Guid, position: {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
}) => void;
|
|
17
|
+
canMove?: boolean;
|
|
18
|
+
onAddModule?: () => Promise<Module | undefined>;
|
|
19
|
+
onModulesReordered?: (ids: Guid[]) => Promise<boolean>;
|
|
20
|
+
onCollapseChanged?: (id: Guid, collapsed: boolean) => Promise<boolean>;
|
|
21
|
+
onRenameModule?: (id: Guid, name: string) => Promise<boolean>;
|
|
22
|
+
onModulesChanged?: (modules: Module[]) => void;
|
|
23
|
+
onFeaturesChanged?: (moduleId: Guid, features: Feature[]) => void;
|
|
24
|
+
onPersistenceError?: (error: unknown) => void;
|
|
25
|
+
rowLabels?: (props: RowLabelsColumnProps) => ReactNode;
|
|
26
|
+
onActorsReordered?: RowLabelsColumnProps['onActorsReordered'];
|
|
27
|
+
}
|
|
28
|
+
export declare const CollectionGrid: ({ collection, getZoom, slots, onDeselect, onCollectionMoving, onCollectionMoved, canMove, onAddModule, onModulesReordered, onCollapseChanged, onRenameModule, onModulesChanged, onFeaturesChanged, onPersistenceError, rowLabels, onActorsReordered, onAddFeature, onRenameFeature, onFeatureCollapseChanged, onFeaturesReordered, onAddSlice, onReorderSlices, onMoveSlice, validateSliceDrop, onSliceCollapseChanged, onSliceRenamed, onSliceDuplicated }: CollectionGridProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Guid } from '@cratis/fundamentals';
|
|
2
|
+
import type { Feature, Slice } from '../Model';
|
|
3
|
+
import type { ValidateSliceDrop } from '../SliceDragging';
|
|
4
|
+
export interface CollectionGridEditor {
|
|
5
|
+
onAddFeature?: (moduleId: Guid, name?: string, parentId?: Guid) => Promise<Feature | undefined>;
|
|
6
|
+
onRenameFeature?: (featureId: Guid, name: string) => Promise<void>;
|
|
7
|
+
onFeatureCollapseChanged?: (featureId: Guid, collapsed: boolean) => void;
|
|
8
|
+
onFeaturesReordered?: (moduleId: Guid, features: Feature[]) => void;
|
|
9
|
+
onAddSlice?: (featureId: Guid, slice: Slice, afterSliceId?: Guid) => Promise<Guid | undefined>;
|
|
10
|
+
onReorderSlices?: (featureId: Guid, sliceIds: Guid[]) => Promise<boolean>;
|
|
11
|
+
onMoveSlice?: (slice: Slice, sourceFeatureId: Guid, targetFeatureId: Guid, targetIndex: number) => Promise<boolean>;
|
|
12
|
+
validateSliceDrop?: ValidateSliceDrop;
|
|
13
|
+
onSliceCollapseChanged?: (featureId: Guid, sliceId: Guid, collapsed: boolean) => void;
|
|
14
|
+
onSliceRenamed?: (featureId: Guid, sliceId: Guid, name: string) => void;
|
|
15
|
+
onSliceDuplicated?: (featureId: Guid, sourceSliceId: Guid, newSliceId: Guid) => void;
|
|
16
|
+
}
|