@api-client/ui 0.2.2 → 0.2.4
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/.vscode/settings.json +3 -3
- package/build/src/elements/authorization/ui/ApiKeyAuthorization.d.ts +1 -1
- package/build/src/elements/authorization/ui/ApiKeyAuthorization.d.ts.map +1 -1
- package/build/src/elements/authorization/ui/ApiKeyAuthorization.js +7 -7
- package/build/src/elements/authorization/ui/ApiKeyAuthorization.js.map +1 -1
- package/build/src/elements/authorization/ui/Authorization.styles.js +4 -4
- package/build/src/elements/authorization/ui/Authorization.styles.js.map +1 -1
- package/build/src/elements/authorization/ui/BasicAuthorization.d.ts +1 -1
- package/build/src/elements/authorization/ui/BasicAuthorization.d.ts.map +1 -1
- package/build/src/elements/authorization/ui/BasicAuthorization.js +5 -5
- package/build/src/elements/authorization/ui/BasicAuthorization.js.map +1 -1
- package/build/src/elements/authorization/ui/BearerAuthorization.d.ts +1 -1
- package/build/src/elements/authorization/ui/BearerAuthorization.d.ts.map +1 -1
- package/build/src/elements/authorization/ui/BearerAuthorization.js +3 -3
- package/build/src/elements/authorization/ui/BearerAuthorization.js.map +1 -1
- package/build/src/elements/authorization/ui/NtlmAuthorization.d.ts +1 -1
- package/build/src/elements/authorization/ui/NtlmAuthorization.d.ts.map +1 -1
- package/build/src/elements/authorization/ui/NtlmAuthorization.js +7 -7
- package/build/src/elements/authorization/ui/NtlmAuthorization.js.map +1 -1
- package/build/src/elements/authorization/ui/OAuth2Authorization.d.ts +1 -1
- package/build/src/elements/authorization/ui/OAuth2Authorization.d.ts.map +1 -1
- package/build/src/elements/authorization/ui/OAuth2Authorization.js +32 -27
- package/build/src/elements/authorization/ui/OAuth2Authorization.js.map +1 -1
- package/build/src/elements/authorization/ui/OidcAuthorization.js +4 -4
- package/build/src/elements/authorization/ui/OidcAuthorization.js.map +1 -1
- package/build/src/elements/autocomplete/autocomplete-input.d.ts +10 -0
- package/build/src/elements/autocomplete/autocomplete-input.d.ts.map +1 -0
- package/build/src/{md/text-field/ui-text-field.js → elements/autocomplete/autocomplete-input.js} +9 -9
- package/build/src/elements/autocomplete/autocomplete-input.js.map +1 -0
- package/build/src/elements/autocomplete/internals/autocomplete.d.ts +209 -0
- package/build/src/elements/autocomplete/internals/autocomplete.d.ts.map +1 -0
- package/build/src/elements/autocomplete/internals/autocomplete.js +493 -0
- package/build/src/elements/autocomplete/internals/autocomplete.js.map +1 -0
- package/build/src/elements/autocomplete/internals/autocomplete.styles.d.ts +3 -0
- package/build/src/elements/autocomplete/internals/autocomplete.styles.d.ts.map +1 -0
- package/build/src/elements/autocomplete/internals/autocomplete.styles.js +25 -0
- package/build/src/elements/autocomplete/internals/autocomplete.styles.js.map +1 -0
- package/build/src/elements/dialog/internals/DeleteCookieAction.element.d.ts +1 -1
- package/build/src/elements/dialog/internals/DeleteCookieAction.element.d.ts.map +1 -1
- package/build/src/elements/dialog/internals/DeleteCookieAction.element.js +5 -5
- package/build/src/elements/dialog/internals/DeleteCookieAction.element.js.map +1 -1
- package/build/src/elements/dialog/internals/Rename.d.ts +1 -1
- package/build/src/elements/dialog/internals/Rename.d.ts.map +1 -1
- package/build/src/elements/dialog/internals/Rename.js +3 -3
- package/build/src/elements/dialog/internals/Rename.js.map +1 -1
- package/build/src/elements/dialog/internals/SetCookieAction.element.d.ts +1 -1
- package/build/src/elements/dialog/internals/SetCookieAction.element.d.ts.map +1 -1
- package/build/src/elements/dialog/internals/SetCookieAction.element.js +9 -9
- package/build/src/elements/dialog/internals/SetCookieAction.element.js.map +1 -1
- package/build/src/elements/environment/EnvironmentEditor.d.ts +1 -1
- package/build/src/elements/environment/EnvironmentEditor.d.ts.map +1 -1
- package/build/src/elements/environment/EnvironmentEditor.js +3 -3
- package/build/src/elements/environment/EnvironmentEditor.js.map +1 -1
- package/build/src/elements/environment/EnvironmentEditor.styles.js +1 -1
- package/build/src/elements/environment/EnvironmentEditor.styles.js.map +1 -1
- package/build/src/elements/environment/ServerEditor.d.ts +1 -1
- package/build/src/elements/environment/ServerEditor.d.ts.map +1 -1
- package/build/src/elements/environment/ServerEditor.js +7 -7
- package/build/src/elements/environment/ServerEditor.js.map +1 -1
- package/build/src/elements/environment/ServerEditor.styles.js +1 -1
- package/build/src/elements/environment/ServerEditor.styles.js.map +1 -1
- package/build/src/elements/http/BodyMultipartEditor.d.ts.map +1 -1
- package/build/src/elements/http/BodyMultipartEditor.js +4 -0
- package/build/src/elements/http/BodyMultipartEditor.js.map +1 -1
- package/build/src/elements/http/CertificateAdd.element.d.ts +1 -1
- package/build/src/elements/http/CertificateAdd.element.d.ts.map +1 -1
- package/build/src/elements/http/CertificateAdd.element.js +8 -8
- package/build/src/elements/http/CertificateAdd.element.js.map +1 -1
- package/build/src/elements/http/CertificateAdd.styles.js +1 -1
- package/build/src/elements/http/CertificateAdd.styles.js.map +1 -1
- package/build/src/elements/http/HttpAssertions.element.js +3 -3
- package/build/src/elements/http/HttpAssertions.element.js.map +1 -1
- package/build/src/elements/http/HttpFlows.element.js +3 -3
- package/build/src/elements/http/HttpFlows.element.js.map +1 -1
- package/build/src/elements/http/HttpFlowsUi.d.ts +1 -1
- package/build/src/elements/http/HttpFlowsUi.d.ts.map +1 -1
- package/build/src/elements/http/HttpFlowsUi.js +31 -31
- package/build/src/elements/http/HttpFlowsUi.js.map +1 -1
- package/build/src/elements/http/RequestConfigElement.d.ts +1 -1
- package/build/src/elements/http/RequestConfigElement.d.ts.map +1 -1
- package/build/src/elements/http/RequestConfigElement.js +7 -7
- package/build/src/elements/http/RequestConfigElement.js.map +1 -1
- package/build/src/elements/http/UrlParamsForm.d.ts +1 -1
- package/build/src/elements/http/UrlParamsForm.d.ts.map +1 -1
- package/build/src/elements/http/UrlParamsForm.js +1 -1
- package/build/src/elements/http/UrlParamsForm.js.map +1 -1
- package/build/src/elements/project/ProjectRunner.d.ts +1 -1
- package/build/src/elements/project/ProjectRunner.d.ts.map +1 -1
- package/build/src/elements/project/ProjectRunner.js +5 -5
- package/build/src/elements/project/ProjectRunner.js.map +1 -1
- package/build/src/md/input/Input.d.ts +0 -15
- package/build/src/md/input/Input.d.ts.map +1 -1
- package/build/src/md/input/Input.js +7 -42
- package/build/src/md/input/Input.js.map +1 -1
- package/build/src/md/list/internals/List.d.ts +7 -2
- package/build/src/md/list/internals/List.d.ts.map +1 -1
- package/build/src/md/list/internals/List.js +6 -0
- package/build/src/md/list/internals/List.js.map +1 -1
- package/build/src/md/list/internals/ListItem.styles.d.ts.map +1 -1
- package/build/src/md/list/internals/ListItem.styles.js +8 -0
- package/build/src/md/list/internals/ListItem.styles.js.map +1 -1
- package/build/src/md/listbox/internals/Listbox.d.ts +2 -2
- package/build/src/md/listbox/internals/Listbox.d.ts.map +1 -1
- package/build/src/md/listbox/internals/Listbox.js.map +1 -1
- package/build/src/md/text-area/internals/TextAreaElement.d.ts.map +1 -1
- package/build/src/md/text-area/internals/TextAreaElement.js +0 -5
- package/build/src/md/text-area/internals/TextAreaElement.js.map +1 -1
- package/build/src/md/text-area/ui-text-area.d.ts.map +1 -1
- package/build/src/md/text-area/ui-text-area.js +3 -2
- package/build/src/md/text-area/ui-text-area.js.map +1 -1
- package/build/src/md/text-field/internals/{TextFieldElement.d.ts → TextField.d.ts} +2 -2
- package/build/src/md/text-field/internals/TextField.d.ts.map +1 -0
- package/build/src/md/text-field/internals/{TextFieldElement.js → TextField.js} +2 -5
- package/build/src/md/text-field/internals/TextField.js.map +1 -0
- package/build/src/{visualization/elements/WorkspaceStyles.d.ts → md/text-field/internals/common.styles.d.ts} +1 -1
- package/build/src/md/text-field/internals/common.styles.d.ts.map +1 -0
- package/build/src/md/text-field/internals/{TextField.styles.js → common.styles.js} +8 -94
- package/build/src/md/text-field/internals/common.styles.js.map +1 -0
- package/build/src/md/text-field/internals/{TextField.styles.d.ts → filled.styles.d.ts} +1 -1
- package/build/src/md/text-field/internals/filled.styles.d.ts.map +1 -0
- package/build/src/md/text-field/internals/filled.styles.js +107 -0
- package/build/src/md/text-field/internals/filled.styles.js.map +1 -0
- package/build/src/md/text-field/internals/outlined.styles.d.ts +3 -0
- package/build/src/md/text-field/internals/outlined.styles.d.ts.map +1 -0
- package/build/src/md/text-field/internals/outlined.styles.js +43 -0
- package/build/src/md/text-field/internals/outlined.styles.js.map +1 -0
- package/build/src/md/text-field/ui-filled-text-field.d.ts +11 -0
- package/build/src/md/text-field/ui-filled-text-field.d.ts.map +1 -0
- package/build/src/md/text-field/ui-filled-text-field.js +28 -0
- package/build/src/md/text-field/ui-filled-text-field.js.map +1 -0
- package/build/src/md/text-field/ui-outlined-text-field.d.ts +11 -0
- package/build/src/md/text-field/ui-outlined-text-field.d.ts.map +1 -0
- package/build/src/md/text-field/ui-outlined-text-field.js +28 -0
- package/build/src/md/text-field/ui-outlined-text-field.js.map +1 -0
- package/build/src/types/input.d.ts +1 -1
- package/build/src/types/input.d.ts.map +1 -1
- package/build/src/types/input.js.map +1 -1
- package/demo/elements/authorization/oauth-authorize.html +4 -4
- package/demo/elements/authorization/oauth-authorize.ts +1 -1
- package/demo/elements/autocomplete/index.html +24 -0
- package/demo/elements/autocomplete/index.ts +123 -0
- package/demo/elements/http/body-editor.ts +3 -3
- package/demo/elements/index.html +15 -11
- package/demo/md/index.html +1 -1
- package/demo/md/inputs/input.html +10 -15
- package/demo/md/inputs/input.ts +389 -101
- package/demo/page.css +4 -0
- package/package.json +7 -2
- package/src/elements/authorization/ui/ApiKeyAuthorization.ts +7 -7
- package/src/elements/authorization/ui/Authorization.styles.ts +4 -4
- package/src/elements/authorization/ui/BasicAuthorization.ts +5 -5
- package/src/elements/authorization/ui/BearerAuthorization.ts +3 -3
- package/src/elements/authorization/ui/NtlmAuthorization.ts +7 -7
- package/src/elements/authorization/ui/OAuth2Authorization.ts +32 -27
- package/src/elements/authorization/ui/OidcAuthorization.ts +4 -4
- package/src/elements/autocomplete/autocomplete-input.ts +14 -0
- package/src/elements/autocomplete/internals/autocomplete.styles.ts +25 -0
- package/src/elements/autocomplete/internals/autocomplete.ts +490 -0
- package/src/elements/dialog/internals/DeleteCookieAction.element.ts +5 -5
- package/src/elements/dialog/internals/Rename.ts +3 -3
- package/src/elements/dialog/internals/SetCookieAction.element.ts +9 -9
- package/src/elements/environment/EnvironmentEditor.styles.ts +1 -1
- package/src/elements/environment/EnvironmentEditor.ts +3 -3
- package/src/elements/environment/ServerEditor.styles.ts +1 -1
- package/src/elements/environment/ServerEditor.ts +7 -7
- package/src/elements/http/BodyMultipartEditor.ts +4 -0
- package/src/elements/http/CertificateAdd.element.ts +8 -8
- package/src/elements/http/CertificateAdd.styles.ts +1 -1
- package/src/elements/http/HttpAssertions.element.ts +3 -3
- package/src/elements/http/HttpFlows.element.ts +3 -3
- package/src/elements/http/HttpFlowsUi.ts +31 -31
- package/src/elements/http/RequestConfigElement.ts +7 -7
- package/src/elements/http/UrlParamsForm.ts +1 -1
- package/src/elements/project/ProjectRunner.ts +5 -5
- package/src/md/input/Input.ts +6 -21
- package/src/md/list/internals/List.ts +14 -2
- package/src/md/list/internals/ListItem.styles.ts +8 -0
- package/src/md/listbox/internals/Listbox.ts +2 -2
- package/src/md/text-area/internals/TextAreaElement.ts +0 -5
- package/src/md/text-area/ui-text-area.ts +3 -2
- package/src/md/text-field/internals/{TextFieldElement.ts → TextField.ts} +1 -4
- package/src/md/text-field/internals/{TextField.styles.ts → common.styles.ts} +7 -93
- package/src/md/text-field/internals/filled.styles.ts +107 -0
- package/src/md/text-field/internals/outlined.styles.ts +43 -0
- package/src/md/text-field/ui-filled-text-field.ts +16 -0
- package/src/md/text-field/ui-outlined-text-field.ts +16 -0
- package/src/types/input.ts +0 -1
- package/test/elements/authorization/basic-method.test.ts +3 -3
- package/test/elements/authorization/bearer-method.test.ts +2 -2
- package/test/elements/authorization/ntlm-method.test.ts +4 -4
- package/test/elements/autocomplete/autocomplete-input.spec.ts +448 -0
- package/test/elements/http/BodyMultipartEditorElement.test.ts +15 -16
- package/test/elements/http/CertificateAdd.test.ts +11 -11
- package/test/elements/http/HttpAssertions.test.ts +9 -9
- package/test/elements/http/HttpFlows.test.ts +4 -4
- package/test/env.ts +15 -0
- package/test/tsconfig.json +1 -7
- package/web-test-runner.config.js +5 -1
- package/build/src/md/text-field/internals/TextField.styles.d.ts.map +0 -1
- package/build/src/md/text-field/internals/TextField.styles.js.map +0 -1
- package/build/src/md/text-field/internals/TextFieldElement.d.ts.map +0 -1
- package/build/src/md/text-field/internals/TextFieldElement.js.map +0 -1
- package/build/src/md/text-field/ui-text-field.d.ts +0 -11
- package/build/src/md/text-field/ui-text-field.d.ts.map +0 -1
- package/build/src/md/text-field/ui-text-field.js.map +0 -1
- package/build/src/visualization/elements/VizAssociationElement.d.ts +0 -4
- package/build/src/visualization/elements/VizAssociationElement.d.ts.map +0 -1
- package/build/src/visualization/elements/VizAssociationElement.js +0 -4
- package/build/src/visualization/elements/VizAssociationElement.js.map +0 -1
- package/build/src/visualization/elements/VizWorkspaceElement.d.ts +0 -110
- package/build/src/visualization/elements/VizWorkspaceElement.d.ts.map +0 -1
- package/build/src/visualization/elements/VizWorkspaceElement.js +0 -321
- package/build/src/visualization/elements/VizWorkspaceElement.js.map +0 -1
- package/build/src/visualization/elements/WorkspaceStyles.d.ts.map +0 -1
- package/build/src/visualization/elements/WorkspaceStyles.js +0 -168
- package/build/src/visualization/elements/WorkspaceStyles.js.map +0 -1
- package/build/src/visualization/lib/AnchorFinder.d.ts +0 -64
- package/build/src/visualization/lib/AnchorFinder.d.ts.map +0 -1
- package/build/src/visualization/lib/AnchorFinder.js +0 -107
- package/build/src/visualization/lib/AnchorFinder.js.map +0 -1
- package/build/src/visualization/lib/AnchorUtils.d.ts +0 -10
- package/build/src/visualization/lib/AnchorUtils.d.ts.map +0 -1
- package/build/src/visualization/lib/AnchorUtils.js +0 -44
- package/build/src/visualization/lib/AnchorUtils.js.map +0 -1
- package/build/src/visualization/lib/AssociationAnchors.d.ts +0 -134
- package/build/src/visualization/lib/AssociationAnchors.d.ts.map +0 -1
- package/build/src/visualization/lib/AssociationAnchors.js +0 -351
- package/build/src/visualization/lib/AssociationAnchors.js.map +0 -1
- package/build/src/visualization/lib/LabelSketch.d.ts +0 -16
- package/build/src/visualization/lib/LabelSketch.d.ts.map +0 -1
- package/build/src/visualization/lib/LabelSketch.js +0 -53
- package/build/src/visualization/lib/LabelSketch.js.map +0 -1
- package/build/src/visualization/lib/LineSketch.d.ts +0 -26
- package/build/src/visualization/lib/LineSketch.d.ts.map +0 -1
- package/build/src/visualization/lib/LineSketch.js +0 -55
- package/build/src/visualization/lib/LineSketch.js.map +0 -1
- package/build/src/visualization/lib/Point.d.ts +0 -74
- package/build/src/visualization/lib/Point.d.ts.map +0 -1
- package/build/src/visualization/lib/Point.js +0 -121
- package/build/src/visualization/lib/Point.js.map +0 -1
- package/build/src/visualization/lib/PositionUtils.d.ts +0 -65
- package/build/src/visualization/lib/PositionUtils.d.ts.map +0 -1
- package/build/src/visualization/lib/PositionUtils.js +0 -205
- package/build/src/visualization/lib/PositionUtils.js.map +0 -1
- package/build/src/visualization/lib/SelectionManager.d.ts +0 -183
- package/build/src/visualization/lib/SelectionManager.d.ts.map +0 -1
- package/build/src/visualization/lib/SelectionManager.js +0 -481
- package/build/src/visualization/lib/SelectionManager.js.map +0 -1
- package/build/src/visualization/lib/ShapeArtist.d.ts +0 -45
- package/build/src/visualization/lib/ShapeArtist.d.ts.map +0 -1
- package/build/src/visualization/lib/ShapeArtist.js +0 -209
- package/build/src/visualization/lib/ShapeArtist.js.map +0 -1
- package/build/src/visualization/lib/SvgMarkers.d.ts +0 -14
- package/build/src/visualization/lib/SvgMarkers.d.ts.map +0 -1
- package/build/src/visualization/lib/SvgMarkers.js +0 -77
- package/build/src/visualization/lib/SvgMarkers.js.map +0 -1
- package/build/src/visualization/lib/TipSketch.d.ts +0 -26
- package/build/src/visualization/lib/TipSketch.d.ts.map +0 -1
- package/build/src/visualization/lib/TipSketch.js +0 -77
- package/build/src/visualization/lib/TipSketch.js.map +0 -1
- package/build/src/visualization/lib/TouchSupport.d.ts +0 -14
- package/build/src/visualization/lib/TouchSupport.d.ts.map +0 -1
- package/build/src/visualization/lib/TouchSupport.js +0 -55
- package/build/src/visualization/lib/TouchSupport.js.map +0 -1
- package/build/src/visualization/lib/Utils.d.ts +0 -25
- package/build/src/visualization/lib/Utils.d.ts.map +0 -1
- package/build/src/visualization/lib/Utils.js +0 -59
- package/build/src/visualization/lib/Utils.js.map +0 -1
- package/build/src/visualization/lib/VisualizationTypes.d.ts +0 -216
- package/build/src/visualization/lib/VisualizationTypes.d.ts.map +0 -1
- package/build/src/visualization/lib/VisualizationTypes.js +0 -3
- package/build/src/visualization/lib/VisualizationTypes.js.map +0 -1
- package/build/src/visualization/lib/WorkspaceAlignment.d.ts +0 -51
- package/build/src/visualization/lib/WorkspaceAlignment.d.ts.map +0 -1
- package/build/src/visualization/lib/WorkspaceAlignment.js +0 -243
- package/build/src/visualization/lib/WorkspaceAlignment.js.map +0 -1
- package/build/src/visualization/lib/WorkspaceDebugging.d.ts +0 -104
- package/build/src/visualization/lib/WorkspaceDebugging.d.ts.map +0 -1
- package/build/src/visualization/lib/WorkspaceDebugging.js +0 -286
- package/build/src/visualization/lib/WorkspaceDebugging.js.map +0 -1
- package/build/src/visualization/lib/WorkspaceEdges.d.ts +0 -293
- package/build/src/visualization/lib/WorkspaceEdges.d.ts.map +0 -1
- package/build/src/visualization/lib/WorkspaceEdges.js +0 -1073
- package/build/src/visualization/lib/WorkspaceEdges.js.map +0 -1
- package/build/src/visualization/lib/WorkspaceGestures.d.ts +0 -119
- package/build/src/visualization/lib/WorkspaceGestures.d.ts.map +0 -1
- package/build/src/visualization/lib/WorkspaceGestures.js +0 -376
- package/build/src/visualization/lib/WorkspaceGestures.js.map +0 -1
- package/build/src/visualization/lib/WorkspaceSizing.d.ts +0 -66
- package/build/src/visualization/lib/WorkspaceSizing.d.ts.map +0 -1
- package/build/src/visualization/lib/WorkspaceSizing.js +0 -168
- package/build/src/visualization/lib/WorkspaceSizing.js.map +0 -1
- package/build/src/visualization/lib/lines/RectilinearLine.d.ts +0 -114
- package/build/src/visualization/lib/lines/RectilinearLine.d.ts.map +0 -1
- package/build/src/visualization/lib/lines/RectilinearLine.js +0 -605
- package/build/src/visualization/lib/lines/RectilinearLine.js.map +0 -1
- package/build/src/visualization/lib/tips/RectilinearTip.d.ts +0 -26
- package/build/src/visualization/lib/tips/RectilinearTip.d.ts.map +0 -1
- package/build/src/visualization/lib/tips/RectilinearTip.js +0 -149
- package/build/src/visualization/lib/tips/RectilinearTip.js.map +0 -1
- package/build/src/visualization/lib/tips/TipArtist.d.ts +0 -22
- package/build/src/visualization/lib/tips/TipArtist.d.ts.map +0 -1
- package/build/src/visualization/lib/tips/TipArtist.js +0 -31
- package/build/src/visualization/lib/tips/TipArtist.js.map +0 -1
- package/build/src/visualization/lib/types.d.ts +0 -164
- package/build/src/visualization/lib/types.d.ts.map +0 -1
- package/build/src/visualization/lib/types.js +0 -2
- package/build/src/visualization/lib/types.js.map +0 -1
- package/build/src/visualization/plugin/dnd/DragAndDropPlugin.d.ts +0 -126
- package/build/src/visualization/plugin/dnd/DragAndDropPlugin.d.ts.map +0 -1
- package/build/src/visualization/plugin/dnd/DragAndDropPlugin.js +0 -260
- package/build/src/visualization/plugin/dnd/DragAndDropPlugin.js.map +0 -1
- package/build/src/visualization/plugin/group-selection/GroupSelection.d.ts +0 -93
- package/build/src/visualization/plugin/group-selection/GroupSelection.d.ts.map +0 -1
- package/build/src/visualization/plugin/group-selection/GroupSelection.js +0 -250
- package/build/src/visualization/plugin/group-selection/GroupSelection.js.map +0 -1
- package/build/src/visualization/plugin/positioning/DataModelLayout.d.ts +0 -10
- package/build/src/visualization/plugin/positioning/DataModelLayout.d.ts.map +0 -1
- package/build/src/visualization/plugin/positioning/DataModelLayout.js +0 -105
- package/build/src/visualization/plugin/positioning/DataModelLayout.js.map +0 -1
- package/build/src/visualization/plugin/positioning/WorkspaceLayout.d.ts +0 -93
- package/build/src/visualization/plugin/positioning/WorkspaceLayout.d.ts.map +0 -1
- package/build/src/visualization/plugin/positioning/WorkspaceLayout.js +0 -96
- package/build/src/visualization/plugin/positioning/WorkspaceLayout.js.map +0 -1
- package/build/src/visualization/viz-association.d.ts +0 -7
- package/build/src/visualization/viz-association.d.ts.map +0 -1
- package/build/src/visualization/viz-association.js +0 -3
- package/build/src/visualization/viz-association.js.map +0 -1
- package/build/src/visualization/viz-workspace.d.ts +0 -7
- package/build/src/visualization/viz-workspace.d.ts.map +0 -1
- package/build/src/visualization/viz-workspace.js +0 -3
- package/build/src/visualization/viz-workspace.js.map +0 -1
- package/src/md/text-field/ui-text-field.ts +0 -15
- package/src/visualization/elements/VizAssociationElement.ts +0 -3
- package/src/visualization/elements/VizWorkspaceElement.ts +0 -302
- package/src/visualization/elements/WorkspaceStyles.ts +0 -168
- package/src/visualization/lib/AnchorFinder.ts +0 -112
- package/src/visualization/lib/AnchorUtils.ts +0 -53
- package/src/visualization/lib/AssociationAnchors.ts +0 -418
- package/src/visualization/lib/LabelSketch.ts +0 -67
- package/src/visualization/lib/LineSketch.ts +0 -62
- package/src/visualization/lib/Point.ts +0 -134
- package/src/visualization/lib/PositionUtils.ts +0 -218
- package/src/visualization/lib/SelectionManager.ts +0 -513
- package/src/visualization/lib/ShapeArtist.ts +0 -222
- package/src/visualization/lib/SvgMarkers.ts +0 -80
- package/src/visualization/lib/TipSketch.ts +0 -91
- package/src/visualization/lib/TouchSupport.ts +0 -72
- package/src/visualization/lib/Utils.ts +0 -63
- package/src/visualization/lib/VisualizationTypes.ts +0 -232
- package/src/visualization/lib/WorkspaceAlignment.ts +0 -261
- package/src/visualization/lib/WorkspaceDebugging.ts +0 -313
- package/src/visualization/lib/WorkspaceEdges.ts +0 -1153
- package/src/visualization/lib/WorkspaceGestures.ts +0 -400
- package/src/visualization/lib/WorkspaceSizing.ts +0 -181
- package/src/visualization/lib/lines/RectilinearLine.ts +0 -589
- package/src/visualization/lib/tips/RectilinearTip.ts +0 -156
- package/src/visualization/lib/tips/TipArtist.ts +0 -34
- package/src/visualization/lib/types.ts +0 -173
- package/src/visualization/plugin/dnd/DragAndDropPlugin.ts +0 -294
- package/src/visualization/plugin/group-selection/GroupSelection.ts +0 -271
- package/src/visualization/plugin/positioning/DataModelLayout.ts +0 -114
- package/src/visualization/plugin/positioning/WorkspaceLayout.ts +0 -149
- package/src/visualization/viz-association.ts +0 -9
- package/src/visualization/viz-workspace.ts +0 -9
- package/test/env.d.ts +0 -9
- package/test/env.js +0 -7
- package/test/visualization/lib/AnchorFinder.test.ts +0 -313
- package/test/visualization/lib/AnchorUtils.test.ts +0 -178
- package/test/visualization/lib/PositionUtils.test.ts +0 -406
- package/test/visualization/lib/test-styles.css +0 -80
|
@@ -1,418 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
|
-
import { getRelativeClickPoint } from './PositionUtils.js'
|
|
3
|
-
import { anchorToPoint } from './AnchorUtils.js'
|
|
4
|
-
import { LineSketch } from './LineSketch.js'
|
|
5
|
-
import VizWorkspaceElement from '../elements/VizWorkspaceElement.js'
|
|
6
|
-
import { Point } from './Point.js'
|
|
7
|
-
|
|
8
|
-
const SvgNS = 'http://www.w3.org/2000/svg'
|
|
9
|
-
|
|
10
|
-
export const connectedValue = Symbol('connectedValue')
|
|
11
|
-
export const mouseDownHandler = Symbol('mouseDownHandler')
|
|
12
|
-
export const mouseMoveHandler = Symbol('mouseMoveHandler')
|
|
13
|
-
export const mouseUpHandler = Symbol('mouseUpHandler')
|
|
14
|
-
export const keydownHandler = Symbol('keydownHandler')
|
|
15
|
-
|
|
16
|
-
export interface EdgeCreateInfo {
|
|
17
|
-
/**
|
|
18
|
-
* The slot name of the source object.
|
|
19
|
-
*/
|
|
20
|
-
slot: string
|
|
21
|
-
/**
|
|
22
|
-
* The workspace coordinates of the staring point
|
|
23
|
-
*/
|
|
24
|
-
point: Point
|
|
25
|
-
/**
|
|
26
|
-
* The domain element that is the source of the association.
|
|
27
|
-
*/
|
|
28
|
-
source: HTMLElement
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface IEdgeUpdateInfo {
|
|
32
|
-
/**
|
|
33
|
-
* The name of the tip that is being dragged.
|
|
34
|
-
* It's either `start` or `end`.
|
|
35
|
-
*/
|
|
36
|
-
direction: string
|
|
37
|
-
/**
|
|
38
|
-
* The association domain id.
|
|
39
|
-
*/
|
|
40
|
-
id: string
|
|
41
|
-
/**
|
|
42
|
-
* The start point of the line
|
|
43
|
-
*/
|
|
44
|
-
sp: Point
|
|
45
|
-
/**
|
|
46
|
-
* The end point of the line
|
|
47
|
-
*/
|
|
48
|
-
ep: Point
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* A helper that allows to manually draw a line from one visualization object to another.
|
|
53
|
-
* The visualization object has to have the `data-association-slots` attribute set on the element
|
|
54
|
-
* and the mouse event target having the `data-association-slot` attribute with the index of the slot.
|
|
55
|
-
*
|
|
56
|
-
* The association line can be drawn to another object that has both attributes.
|
|
57
|
-
*
|
|
58
|
-
* After the user finish a DOM event is dispatched from the visualization workspace.
|
|
59
|
-
*/
|
|
60
|
-
export class AssociationAnchors {
|
|
61
|
-
[connectedValue] = false
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Whether a line is being constructed.
|
|
65
|
-
*/
|
|
66
|
-
drawing = false
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* A reference to the currently injected SVG element.
|
|
70
|
-
*/
|
|
71
|
-
lineElement?: SVGElement
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Whether an association position is being updated.
|
|
75
|
-
* In such case it dispatches different event at the end.
|
|
76
|
-
*/
|
|
77
|
-
updating = false
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* The processor used to draw lines
|
|
81
|
-
*/
|
|
82
|
-
lineProcessor = new LineSketch()
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Set when a new association is being created
|
|
86
|
-
*/
|
|
87
|
-
createInfo?: EdgeCreateInfo
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Set when an association update is performed
|
|
91
|
-
*/
|
|
92
|
-
updateInfo?: IEdgeUpdateInfo
|
|
93
|
-
|
|
94
|
-
constructor(public workspace: VizWorkspaceElement) {
|
|
95
|
-
this.workspace = workspace
|
|
96
|
-
this[mouseDownHandler] = this[mouseDownHandler].bind(this)
|
|
97
|
-
this[mouseMoveHandler] = this[mouseMoveHandler].bind(this)
|
|
98
|
-
this[mouseUpHandler] = this[mouseUpHandler].bind(this)
|
|
99
|
-
this[keydownHandler] = this[keydownHandler].bind(this)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Starts listening for the user events
|
|
104
|
-
*/
|
|
105
|
-
connect(): void {
|
|
106
|
-
if (this[connectedValue]) {
|
|
107
|
-
return
|
|
108
|
-
}
|
|
109
|
-
this[connectedValue] = true
|
|
110
|
-
const { workspace } = this
|
|
111
|
-
// const { canvas } = workspace;
|
|
112
|
-
workspace.addEventListener('mousedown', this[mouseDownHandler], true)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Stops listening for the user events
|
|
117
|
-
*/
|
|
118
|
-
disconnect(): void {
|
|
119
|
-
this[connectedValue] = false
|
|
120
|
-
const { workspace } = this
|
|
121
|
-
// const { canvas } = workspace;
|
|
122
|
-
workspace.removeEventListener('mousedown', this[mouseDownHandler], true)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
findSlotParent(path: Node[]): Element {
|
|
126
|
-
const element = path.find((node) => {
|
|
127
|
-
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
128
|
-
return false
|
|
129
|
-
}
|
|
130
|
-
const typed = node as Element
|
|
131
|
-
return typed.hasAttribute('data-association-slots')
|
|
132
|
-
})
|
|
133
|
-
return element as Element
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
[mouseDownHandler](e: MouseEvent): void {
|
|
137
|
-
if (e.button !== 0) {
|
|
138
|
-
return
|
|
139
|
-
}
|
|
140
|
-
let node = e.target as HTMLElement
|
|
141
|
-
if (!e.composed || node.nodeType !== Node.ELEMENT_NODE) {
|
|
142
|
-
return
|
|
143
|
-
}
|
|
144
|
-
const [source] = e.composedPath() as HTMLElement[]
|
|
145
|
-
if (node === source) {
|
|
146
|
-
const parent = this.findSlotParent(e.composedPath() as Node[])
|
|
147
|
-
if (!parent) {
|
|
148
|
-
return
|
|
149
|
-
}
|
|
150
|
-
node = parent as HTMLElement
|
|
151
|
-
}
|
|
152
|
-
const { dataset } = source
|
|
153
|
-
const isSvgDraggable = source.classList && source.classList.contains('association-draggable')
|
|
154
|
-
if (isSvgDraggable) {
|
|
155
|
-
e.preventDefault()
|
|
156
|
-
e.stopPropagation()
|
|
157
|
-
this.startUpdate(dataset.key!, dataset.dir!)
|
|
158
|
-
return
|
|
159
|
-
}
|
|
160
|
-
if (!node.hasAttribute('data-association-slots')) {
|
|
161
|
-
return
|
|
162
|
-
}
|
|
163
|
-
if (source.nodeType !== Node.ELEMENT_NODE) {
|
|
164
|
-
return
|
|
165
|
-
}
|
|
166
|
-
if (!dataset.associationSlot) {
|
|
167
|
-
return
|
|
168
|
-
}
|
|
169
|
-
e.preventDefault()
|
|
170
|
-
e.stopPropagation()
|
|
171
|
-
const startPoint = anchorToPoint(source, this.workspace)
|
|
172
|
-
this.start(node, dataset.associationSlot, startPoint)
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
[mouseMoveHandler](e: MouseEvent): void {
|
|
176
|
-
if (!this.drawing) {
|
|
177
|
-
return
|
|
178
|
-
}
|
|
179
|
-
const { clientX, clientY } = e
|
|
180
|
-
const pos = getRelativeClickPoint(clientX, clientY, this.workspace)
|
|
181
|
-
this.updateLinePosition(pos)
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
[mouseUpHandler](e: MouseEvent): void {
|
|
185
|
-
if (!this.drawing) {
|
|
186
|
-
return
|
|
187
|
-
}
|
|
188
|
-
this.drawing = false
|
|
189
|
-
this.cancel()
|
|
190
|
-
let node = e.target as HTMLElement
|
|
191
|
-
if (!e.composed || node.nodeType !== Node.ELEMENT_NODE) {
|
|
192
|
-
this.cleanup()
|
|
193
|
-
return
|
|
194
|
-
}
|
|
195
|
-
if (!node.hasAttribute('data-association-slots')) {
|
|
196
|
-
const parent = this.findSlotParent(e.composedPath() as Node[])
|
|
197
|
-
if (!parent) {
|
|
198
|
-
return
|
|
199
|
-
}
|
|
200
|
-
node = parent as HTMLElement
|
|
201
|
-
}
|
|
202
|
-
if (!node.hasAttribute('data-association-slots')) {
|
|
203
|
-
this.cleanup()
|
|
204
|
-
return
|
|
205
|
-
}
|
|
206
|
-
const [source] = e.composedPath() as HTMLElement[]
|
|
207
|
-
if (source.nodeType !== Node.ELEMENT_NODE) {
|
|
208
|
-
this.cleanup()
|
|
209
|
-
return
|
|
210
|
-
}
|
|
211
|
-
const { dataset } = source
|
|
212
|
-
if (!dataset.associationSlot) {
|
|
213
|
-
this.cleanup()
|
|
214
|
-
return
|
|
215
|
-
}
|
|
216
|
-
const { clientX, clientY } = e
|
|
217
|
-
const endPoint = getRelativeClickPoint(clientX, clientY, this.workspace)
|
|
218
|
-
if (this.updating) {
|
|
219
|
-
this.endUpdate(node.dataset.key!, dataset.associationSlot, endPoint)
|
|
220
|
-
} else {
|
|
221
|
-
this.end(node.dataset.key!, dataset.associationSlot, endPoint)
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
[keydownHandler](e: KeyboardEvent): void {
|
|
226
|
-
if (e.code !== 'Escape') {
|
|
227
|
-
return
|
|
228
|
-
}
|
|
229
|
-
this.cancel()
|
|
230
|
-
this.cleanup()
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Cancels the operation.
|
|
235
|
-
*/
|
|
236
|
-
cancel(): void {
|
|
237
|
-
this.unlistenDargEvents()
|
|
238
|
-
this.removeLine()
|
|
239
|
-
if (this.updating) {
|
|
240
|
-
const model = this.workspace.edges.get(this.updateInfo!.id)!
|
|
241
|
-
model.shape.selection!.hidden = false
|
|
242
|
-
this.workspace.requestUpdate()
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Clears variables set in the `start()` function.
|
|
248
|
-
*/
|
|
249
|
-
cleanup(): void {
|
|
250
|
-
this.createInfo = undefined
|
|
251
|
-
this.updateInfo = undefined
|
|
252
|
-
this.updating = false
|
|
253
|
-
this.drawing = false
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
start(domainObject: HTMLElement, slot: string, startPoint: Point): void {
|
|
257
|
-
this.drawing = true
|
|
258
|
-
this.createInfo = {
|
|
259
|
-
slot,
|
|
260
|
-
point: startPoint,
|
|
261
|
-
source: domainObject,
|
|
262
|
-
}
|
|
263
|
-
this.addLine(startPoint, startPoint)
|
|
264
|
-
this.listenDargEvents()
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* @param key The domain id of the association being updated
|
|
269
|
-
* @param dir The name of the tip that is being dragged.
|
|
270
|
-
*/
|
|
271
|
-
startUpdate(key: string, dir: string): void {
|
|
272
|
-
const model = this.workspace.edges.get(key)
|
|
273
|
-
if (!model) {
|
|
274
|
-
throw new Error(`The edge is not prepared.`)
|
|
275
|
-
}
|
|
276
|
-
model.shape.selection!.hidden = true
|
|
277
|
-
const { coordinates } = model.shape.line
|
|
278
|
-
const [sp] = coordinates!
|
|
279
|
-
const ep = coordinates![coordinates!.length - 1]
|
|
280
|
-
const startPoint = dir === 'end' ? sp : ep
|
|
281
|
-
const endPoint = dir === 'end' ? ep : sp
|
|
282
|
-
this.updating = true
|
|
283
|
-
this.updateInfo = {
|
|
284
|
-
direction: dir,
|
|
285
|
-
ep: endPoint,
|
|
286
|
-
sp: startPoint,
|
|
287
|
-
id: key,
|
|
288
|
-
}
|
|
289
|
-
this.drawing = true
|
|
290
|
-
this.addLine(startPoint, endPoint)
|
|
291
|
-
this.listenDargEvents()
|
|
292
|
-
this.workspace.requestUpdate()
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
end(id: string, slot: string, endPoint: Point): void {
|
|
296
|
-
const { createInfo } = this
|
|
297
|
-
if (!createInfo) {
|
|
298
|
-
throw new Error(`updateInfo is not set.`)
|
|
299
|
-
}
|
|
300
|
-
const detail = {
|
|
301
|
-
source: {
|
|
302
|
-
id: createInfo.source.dataset.key,
|
|
303
|
-
point: createInfo.point,
|
|
304
|
-
slot: createInfo.slot,
|
|
305
|
-
},
|
|
306
|
-
target: {
|
|
307
|
-
id, // : domainObject.dataset.key,
|
|
308
|
-
point: endPoint,
|
|
309
|
-
slot,
|
|
310
|
-
},
|
|
311
|
-
}
|
|
312
|
-
createInfo.source.dispatchEvent(
|
|
313
|
-
new CustomEvent('anchorassociationcreate', {
|
|
314
|
-
composed: true,
|
|
315
|
-
cancelable: true,
|
|
316
|
-
bubbles: true,
|
|
317
|
-
detail,
|
|
318
|
-
})
|
|
319
|
-
)
|
|
320
|
-
this.cleanup()
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
endUpdate(id: string, slot: string, endPoint: Point): void {
|
|
324
|
-
const { updateInfo } = this
|
|
325
|
-
if (!updateInfo) {
|
|
326
|
-
throw new Error(`updateInfo is not set.`)
|
|
327
|
-
}
|
|
328
|
-
const detail = {
|
|
329
|
-
source: {
|
|
330
|
-
associationId: updateInfo.id,
|
|
331
|
-
direction: updateInfo.direction,
|
|
332
|
-
},
|
|
333
|
-
target: {
|
|
334
|
-
id, // : domainObject.dataset.key,
|
|
335
|
-
point: endPoint,
|
|
336
|
-
slot,
|
|
337
|
-
},
|
|
338
|
-
}
|
|
339
|
-
const model = this.workspace.edges.get(updateInfo.id)!
|
|
340
|
-
const eventTarget = this.workspace.querySelector(`[data-key="${model.source}"]`)!
|
|
341
|
-
this.cleanup()
|
|
342
|
-
eventTarget.dispatchEvent(
|
|
343
|
-
new CustomEvent('anchorassociationupdate', {
|
|
344
|
-
composed: true,
|
|
345
|
-
cancelable: true,
|
|
346
|
-
bubbles: true,
|
|
347
|
-
detail,
|
|
348
|
-
})
|
|
349
|
-
)
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* Insets a child with a line definition into the workspace's SVG element.
|
|
354
|
-
* @param start The starting point of the line
|
|
355
|
-
* @param end The ending point of the line
|
|
356
|
-
*/
|
|
357
|
-
addLine(start: Point, end: Point): void {
|
|
358
|
-
const line = document.createElementNS(SvgNS, 'line')
|
|
359
|
-
line.setAttribute('x1', `${start.x}`)
|
|
360
|
-
line.setAttribute('y1', `${start.y}`)
|
|
361
|
-
line.setAttribute('x2', `${end.x}`)
|
|
362
|
-
line.setAttribute('y2', `${end.y}`)
|
|
363
|
-
line.classList.add('association-line')
|
|
364
|
-
const { associationSvg } = this.workspace
|
|
365
|
-
associationSvg.append(line)
|
|
366
|
-
this.lineElement = line
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
* Removes the previously added line from the SVG
|
|
371
|
-
*/
|
|
372
|
-
removeLine(): void {
|
|
373
|
-
const { lineElement } = this
|
|
374
|
-
if (!lineElement) {
|
|
375
|
-
return
|
|
376
|
-
}
|
|
377
|
-
const { associationSvg } = this.workspace
|
|
378
|
-
associationSvg.removeChild(lineElement)
|
|
379
|
-
this.lineElement = undefined
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* Updates the end position of the line.
|
|
384
|
-
* @param {Point} point
|
|
385
|
-
*/
|
|
386
|
-
updateLinePosition(point: Point): void {
|
|
387
|
-
const { lineElement } = this
|
|
388
|
-
|
|
389
|
-
if (!lineElement) {
|
|
390
|
-
return
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
// lineElement.setAttribute('d', definition.path);
|
|
394
|
-
lineElement.setAttribute('x2', `${point.x}`)
|
|
395
|
-
lineElement.setAttribute('y2', `${point.y}`)
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
/**
|
|
399
|
-
* Listens for the mouse move and mouse up events to draw the line and finish the operation.
|
|
400
|
-
* This is only initialized when starting drawing a line.
|
|
401
|
-
*/
|
|
402
|
-
listenDargEvents(): void {
|
|
403
|
-
const { workspace } = this
|
|
404
|
-
workspace.addEventListener('mousemove', this[mouseMoveHandler])
|
|
405
|
-
workspace.addEventListener('mouseup', this[mouseUpHandler])
|
|
406
|
-
window.addEventListener('keydown', this[keydownHandler])
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* Removes previously registered events.
|
|
411
|
-
*/
|
|
412
|
-
unlistenDargEvents(): void {
|
|
413
|
-
const { workspace } = this
|
|
414
|
-
workspace.removeEventListener('mousemove', this[mouseMoveHandler])
|
|
415
|
-
workspace.removeEventListener('mouseup', this[mouseUpHandler])
|
|
416
|
-
window.removeEventListener('keydown', this[keydownHandler])
|
|
417
|
-
}
|
|
418
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
|
-
|
|
3
|
-
import { IEdgeDirections } from './types.js'
|
|
4
|
-
import {
|
|
5
|
-
IAssociationLabelShape,
|
|
6
|
-
IVisualizationAssociationShape,
|
|
7
|
-
IVisualizationRectilinearLineShape,
|
|
8
|
-
} from './VisualizationTypes.js'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* A class that specializes in sketching a label (association label) on the workspace.
|
|
12
|
-
*/
|
|
13
|
-
export class LabelSketch {
|
|
14
|
-
/**
|
|
15
|
-
* Computes sketch of the label.
|
|
16
|
-
*/
|
|
17
|
-
sketch(
|
|
18
|
-
lineShape: IVisualizationAssociationShape,
|
|
19
|
-
value: string,
|
|
20
|
-
directions: IEdgeDirections
|
|
21
|
-
): IAssociationLabelShape | null {
|
|
22
|
-
switch (lineShape.type) {
|
|
23
|
-
case 'rectilinear':
|
|
24
|
-
return this.sketchRectilinear(lineShape as IVisualizationRectilinearLineShape, value, directions)
|
|
25
|
-
default:
|
|
26
|
-
return null
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Computes sketch of the label on a rectilinear shape.
|
|
32
|
-
*/
|
|
33
|
-
sketchRectilinear(
|
|
34
|
-
lineShape: IVisualizationRectilinearLineShape,
|
|
35
|
-
value: string,
|
|
36
|
-
directions: IEdgeDirections
|
|
37
|
-
): IAssociationLabelShape | null {
|
|
38
|
-
const [position] = lineShape.coordinates!
|
|
39
|
-
const point = position.copy()
|
|
40
|
-
const transformOrigin = `${position.x}px ${position.y}px`
|
|
41
|
-
const { start } = directions
|
|
42
|
-
let anchor = 'start'
|
|
43
|
-
if (start === 'south') {
|
|
44
|
-
point.x += 8
|
|
45
|
-
point.y += 20
|
|
46
|
-
} else if (start === 'east') {
|
|
47
|
-
point.x += 8
|
|
48
|
-
point.y -= 8
|
|
49
|
-
} else if (start === 'north') {
|
|
50
|
-
point.x += 8
|
|
51
|
-
point.y -= 24
|
|
52
|
-
} else {
|
|
53
|
-
point.x -= 8
|
|
54
|
-
point.y -= 8
|
|
55
|
-
anchor = 'end'
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
x: point.x,
|
|
60
|
-
y: point.y,
|
|
61
|
-
value,
|
|
62
|
-
transformOrigin,
|
|
63
|
-
rotate: 0,
|
|
64
|
-
anchor,
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
|
-
import { RectilinearLine } from './lines/RectilinearLine.js'
|
|
3
|
-
import {
|
|
4
|
-
ILineSketchOptions,
|
|
5
|
-
IVisualizationAssociationShape,
|
|
6
|
-
IVisualizationRectilinearLineShape,
|
|
7
|
-
} from './VisualizationTypes.js'
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A class that is responsible for sketching different kind of lines.
|
|
11
|
-
* It computes list of points and other properties so the visualization workspace can
|
|
12
|
-
* use this definition in the SVG drawing.
|
|
13
|
-
*/
|
|
14
|
-
export class LineSketch {
|
|
15
|
-
/**
|
|
16
|
-
* Creates an association line for the given configuration.
|
|
17
|
-
* @param config The line building options
|
|
18
|
-
* @returns Computed model for the association.
|
|
19
|
-
*/
|
|
20
|
-
sketch(config: ILineSketchOptions): IVisualizationAssociationShape | null {
|
|
21
|
-
const { type } = config
|
|
22
|
-
switch (type) {
|
|
23
|
-
case 'linear':
|
|
24
|
-
return this.computeLine(config)
|
|
25
|
-
case 'rectilinear':
|
|
26
|
-
return this.computeRectilinearLine(config)
|
|
27
|
-
default:
|
|
28
|
-
return null
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Sketches a regular line.
|
|
34
|
-
* @returns Computed model for the association.
|
|
35
|
-
*/
|
|
36
|
-
computeLine(config: ILineSketchOptions): IVisualizationAssociationShape | null {
|
|
37
|
-
const { startPoint, endPoint, type } = config
|
|
38
|
-
if (!startPoint.validate() || !endPoint.validate()) {
|
|
39
|
-
return null
|
|
40
|
-
}
|
|
41
|
-
const coordinates = [startPoint, endPoint]
|
|
42
|
-
const transformOrigin = `${startPoint.x}px ${endPoint.y}px`
|
|
43
|
-
return {
|
|
44
|
-
transformOrigin,
|
|
45
|
-
coordinates,
|
|
46
|
-
rotate: 0,
|
|
47
|
-
type: type!,
|
|
48
|
-
startPoint,
|
|
49
|
-
endPoint,
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Sketches a regular line.
|
|
55
|
-
*
|
|
56
|
-
* @returns Computed model for the association.
|
|
57
|
-
*/
|
|
58
|
-
computeRectilinearLine(config: ILineSketchOptions): IVisualizationRectilinearLineShape | null {
|
|
59
|
-
const artist = new RectilinearLine(config)
|
|
60
|
-
return artist.sketch()
|
|
61
|
-
}
|
|
62
|
-
}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
|
-
import { xPositionOrCoord } from './types.js'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* An object representing a point in a 2-d space (Euclidean space)
|
|
6
|
-
*/
|
|
7
|
-
export class Point {
|
|
8
|
-
x: number
|
|
9
|
-
|
|
10
|
-
y: number
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @param x The x coordinate or the array with x and y position values
|
|
14
|
-
* @param y Optional when the `x` is an array. The y position of the point
|
|
15
|
-
*/
|
|
16
|
-
constructor(x: xPositionOrCoord, y?: number) {
|
|
17
|
-
let xValue
|
|
18
|
-
let yValue
|
|
19
|
-
if (Array.isArray(x)) {
|
|
20
|
-
;[xValue, yValue] = x
|
|
21
|
-
} else {
|
|
22
|
-
xValue = x
|
|
23
|
-
yValue = y
|
|
24
|
-
}
|
|
25
|
-
this.x = xValue
|
|
26
|
-
this.y = yValue!
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Copies the current point as new object
|
|
31
|
-
* @return A copy of the object
|
|
32
|
-
*/
|
|
33
|
-
copy(): Point {
|
|
34
|
-
return new Point(this.x, this.y)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Validates the point value.
|
|
39
|
-
* @return True if the point has valid values.
|
|
40
|
-
*/
|
|
41
|
-
validate(): boolean {
|
|
42
|
-
const { x, y } = this
|
|
43
|
-
return !Number.isNaN(x) && !Number.isNaN(y)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Adds another point to this point and returns a new point.
|
|
48
|
-
* @param v Point or a number to add.
|
|
49
|
-
* @returns Created new point
|
|
50
|
-
*/
|
|
51
|
-
add(v: Point | number): Point {
|
|
52
|
-
if (v instanceof Point) {
|
|
53
|
-
return new Point(this.x + v.x, this.y + v.y)
|
|
54
|
-
}
|
|
55
|
-
return new Point(this.x + v, this.y + v)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Subtracts another point from this point and returns a new point.
|
|
60
|
-
* @param v Point or a number to add.
|
|
61
|
-
* @returns Created new point
|
|
62
|
-
*/
|
|
63
|
-
subtract(v: Point | number): Point {
|
|
64
|
-
if (v instanceof Point) {
|
|
65
|
-
return new Point(this.x - v.x, this.y - v.y)
|
|
66
|
-
}
|
|
67
|
-
return new Point(this.x - v, this.y - v)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Multiplies this point by another point or a number and returns a new point.
|
|
72
|
-
* @param v Point or a number to add.
|
|
73
|
-
* @returns Created new point
|
|
74
|
-
*/
|
|
75
|
-
multiply(v: Point | number): Point {
|
|
76
|
-
if (v instanceof Point) {
|
|
77
|
-
return new Point(this.x * v.x, this.y * v.y)
|
|
78
|
-
}
|
|
79
|
-
return new Point(this.x * v, this.y * v)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Divides this point by another point or a number and returns a new point.
|
|
84
|
-
* @param v Point or a number to add.
|
|
85
|
-
* @returns Created new point
|
|
86
|
-
*/
|
|
87
|
-
divide(v: Point | number): Point {
|
|
88
|
-
if (v instanceof Point) {
|
|
89
|
-
return new Point(this.x / v.x, this.y / v.y)
|
|
90
|
-
}
|
|
91
|
-
return new Point(this.x / v, this.y / v)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Subtracts another point to this point and returns a new point.
|
|
96
|
-
* @param v Point or a number to add.
|
|
97
|
-
* @returns True when points are equal
|
|
98
|
-
*/
|
|
99
|
-
equals(v: Point): boolean {
|
|
100
|
-
return this.x === v.x && this.y === v.y
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Computes an angle to another point in radians.
|
|
105
|
-
* @param v Point or a number to add.
|
|
106
|
-
* @returns True when points are equal
|
|
107
|
-
*/
|
|
108
|
-
angle(v: Point): number {
|
|
109
|
-
return Math.atan2(v.y - this.y, v.x - this.x)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Computes an angle to another point in degrees.
|
|
114
|
-
* @param v Point or a number to add.
|
|
115
|
-
* @returns True when points are equal
|
|
116
|
-
*/
|
|
117
|
-
degrees(v: Point): number {
|
|
118
|
-
return (this.angle(v) * 180) / Math.PI
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Computes the distance to the other point.
|
|
123
|
-
*/
|
|
124
|
-
distance(other: Point): number {
|
|
125
|
-
return Math.sqrt((this.x - other.x) ** 2 + (this.y - other.y) ** 2)
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Computes the distance between two points.
|
|
130
|
-
*/
|
|
131
|
-
static distance(p1: Point, p2: Point): number {
|
|
132
|
-
return p1.distance(p2)
|
|
133
|
-
}
|
|
134
|
-
}
|