@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,222 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-extraneous-class */
|
|
3
|
-
import { svg, SVGTemplateResult } from 'lit'
|
|
4
|
-
import { classMap } from 'lit/directives/class-map.js'
|
|
5
|
-
import { styleMap } from 'lit/directives/style-map.js'
|
|
6
|
-
import { ifDefined } from 'lit/directives/if-defined.js'
|
|
7
|
-
import { IEdgeDirections, IWorkspaceEdge } from './types.js'
|
|
8
|
-
import {
|
|
9
|
-
IAssociationLabelShape,
|
|
10
|
-
AssociationShapeType,
|
|
11
|
-
IAssociationTip,
|
|
12
|
-
IVisualizationRectilinearLineShape,
|
|
13
|
-
} from './VisualizationTypes.js'
|
|
14
|
-
import { Point } from './Point.js'
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* A class that builds templates for lines, tips, and labels.
|
|
18
|
-
*/
|
|
19
|
-
export class ShapeArtist {
|
|
20
|
-
/**
|
|
21
|
-
* @param info The definition of the line to visualize
|
|
22
|
-
* @param debug Whether debugging is enabled.
|
|
23
|
-
* @return The template for an association line
|
|
24
|
-
*/
|
|
25
|
-
static line(info: IWorkspaceEdge, debug = false): SVGTemplateResult | string {
|
|
26
|
-
const { line } = info.shape
|
|
27
|
-
switch (line.type) {
|
|
28
|
-
case 'rectilinear':
|
|
29
|
-
return ShapeArtist.rectilinearLine(info, debug)
|
|
30
|
-
default:
|
|
31
|
-
return ''
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @param info The line to visualize
|
|
37
|
-
* @param debug Whether debugging is enabled.
|
|
38
|
-
* @returns The template for an association line
|
|
39
|
-
*/
|
|
40
|
-
static rectilinearLine(info: IWorkspaceEdge, debug: boolean): SVGTemplateResult {
|
|
41
|
-
const { id, shape, directions, positionChange } = info
|
|
42
|
-
const { line, label, tips, selection = {}, style } = shape
|
|
43
|
-
const { transformOrigin, coordinates, path, controlPoints, type } = line as IVisualizationRectilinearLineShape
|
|
44
|
-
const groupStyle = {
|
|
45
|
-
transformOrigin,
|
|
46
|
-
}
|
|
47
|
-
const groupClass: Record<string, boolean> = {
|
|
48
|
-
'selected': !!selection.primary,
|
|
49
|
-
'selectedSecondary': !!selection.secondary,
|
|
50
|
-
'hovered': !!selection.hover,
|
|
51
|
-
'hidden': !!selection.hidden,
|
|
52
|
-
'association-group': true,
|
|
53
|
-
}
|
|
54
|
-
if (style) {
|
|
55
|
-
groupClass[style] = true
|
|
56
|
-
}
|
|
57
|
-
const [startPoint] = coordinates!
|
|
58
|
-
const endPoint = coordinates![coordinates!.length - 1]
|
|
59
|
-
return svg`
|
|
60
|
-
<g
|
|
61
|
-
data-id="${id}"
|
|
62
|
-
data-type="association"
|
|
63
|
-
class="${classMap(groupClass)}"
|
|
64
|
-
style="${styleMap(groupStyle)}"
|
|
65
|
-
>
|
|
66
|
-
<circle cx="${startPoint.x}" cy="${startPoint.y}" r="4" class="edge-vertex"/>
|
|
67
|
-
<circle cx="${endPoint.x}" cy="${endPoint.y}" r="4" class="edge-vertex"/>
|
|
68
|
-
<polyline
|
|
69
|
-
points="${path}"
|
|
70
|
-
class="association-line-area"
|
|
71
|
-
data-type="association"
|
|
72
|
-
data-id="${id}"
|
|
73
|
-
/>
|
|
74
|
-
<polyline
|
|
75
|
-
points="${path}"
|
|
76
|
-
class="association-line"
|
|
77
|
-
data-type="association"
|
|
78
|
-
data-id="${id}"
|
|
79
|
-
/>
|
|
80
|
-
${tips && tips.start ? ShapeArtist.edgeTipTemplate(tips.start) : ''}
|
|
81
|
-
${tips && tips.end ? ShapeArtist.edgeTipTemplate(tips.end) : ''}
|
|
82
|
-
${selection.primary && positionChange ? ShapeArtist.associationDraggable(id, startPoint, endPoint, directions) : ''}
|
|
83
|
-
${debug ? ShapeArtist.controlPointsDebugTemplate(type, startPoint, endPoint, controlPoints) : ''}
|
|
84
|
-
${ShapeArtist.edgeLabelTemplate(label!, id)}
|
|
85
|
-
</g>`
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* @param tip The parent line to visualize
|
|
90
|
-
* @returns The template for the parent line tip
|
|
91
|
-
*/
|
|
92
|
-
static edgeTipTemplate(tip: IAssociationTip): SVGTemplateResult {
|
|
93
|
-
const { rotate, path, style, transformOrigin, svg: elementType } = tip
|
|
94
|
-
const transform = `rotate(${rotate}deg)`
|
|
95
|
-
const styles = {
|
|
96
|
-
transform,
|
|
97
|
-
transformOrigin,
|
|
98
|
-
}
|
|
99
|
-
if (elementType === 'polyline') {
|
|
100
|
-
return svg`
|
|
101
|
-
<polyline
|
|
102
|
-
points="${path}"
|
|
103
|
-
class="edge-tip ${style}"
|
|
104
|
-
style="${styleMap(styles)}"
|
|
105
|
-
/>
|
|
106
|
-
`
|
|
107
|
-
}
|
|
108
|
-
return svg`
|
|
109
|
-
<polygon
|
|
110
|
-
points="${path}"
|
|
111
|
-
class="edge-tip ${style}"
|
|
112
|
-
style="${styleMap(styles)}"
|
|
113
|
-
/>
|
|
114
|
-
`
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* @param id The key of the association.
|
|
119
|
-
* @returns The template for the association drag handlers on the tips.
|
|
120
|
-
*/
|
|
121
|
-
static associationDraggable(id: string, start: Point, end: Point, directions: IEdgeDirections): SVGTemplateResult {
|
|
122
|
-
const size = 12
|
|
123
|
-
const half = size / 2
|
|
124
|
-
const padding = 4
|
|
125
|
-
let sx = start.x
|
|
126
|
-
let sy = start.y
|
|
127
|
-
let ex = end.x
|
|
128
|
-
let ey = end.y
|
|
129
|
-
if (directions.start === 'west') {
|
|
130
|
-
sx -= size + padding
|
|
131
|
-
sy -= half
|
|
132
|
-
} else if (directions.start === 'north') {
|
|
133
|
-
sx -= half
|
|
134
|
-
sy -= size + padding
|
|
135
|
-
} else if (directions.start === 'east') {
|
|
136
|
-
sx += padding
|
|
137
|
-
sy -= half
|
|
138
|
-
} else {
|
|
139
|
-
sx -= half
|
|
140
|
-
sy += padding
|
|
141
|
-
}
|
|
142
|
-
if (directions.end === 'west') {
|
|
143
|
-
ex += padding
|
|
144
|
-
ey -= half
|
|
145
|
-
} else if (directions.end === 'north') {
|
|
146
|
-
ex -= half
|
|
147
|
-
ey -= size + padding
|
|
148
|
-
} else if (directions.end === 'east') {
|
|
149
|
-
ex -= size + padding
|
|
150
|
-
ey -= half
|
|
151
|
-
} else {
|
|
152
|
-
ex -= half
|
|
153
|
-
ey += padding
|
|
154
|
-
}
|
|
155
|
-
return svg`
|
|
156
|
-
<rect x="${sx}" y="${sy}" width="${size}" height="${size}" rx="3" data-key="${id}" data-dir="start" class="association-draggable"/>
|
|
157
|
-
<rect x="${ex}" y="${ey}" width="${size}" height="${size}" rx="3" data-key="${id}" data-dir="end" class="association-draggable"/>
|
|
158
|
-
`
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* @param parentId The association key
|
|
163
|
-
* @returns The template for a text label for an association
|
|
164
|
-
*/
|
|
165
|
-
static edgeLabelTemplate(label: IAssociationLabelShape, parentId: string): SVGTemplateResult | string {
|
|
166
|
-
if (!label || !label.value) {
|
|
167
|
-
return ''
|
|
168
|
-
}
|
|
169
|
-
const { value, transformOrigin, rotate, x, y, anchor } = label
|
|
170
|
-
const transform = `rotate(${rotate}deg)`
|
|
171
|
-
const textStyles = {
|
|
172
|
-
transform,
|
|
173
|
-
transformOrigin,
|
|
174
|
-
}
|
|
175
|
-
return svg`
|
|
176
|
-
<text
|
|
177
|
-
x="${x}"
|
|
178
|
-
y="${y}"
|
|
179
|
-
data-id="${parentId}"
|
|
180
|
-
style="${styleMap(textStyles)}"
|
|
181
|
-
class="association-label"
|
|
182
|
-
text-anchor=${ifDefined(anchor)}
|
|
183
|
-
>${value}</text>
|
|
184
|
-
`
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Draws a debug control points positions for the given line type.
|
|
189
|
-
* @param start The start of the line
|
|
190
|
-
* @param end The end of the line
|
|
191
|
-
* @param cp Control points on the line
|
|
192
|
-
*/
|
|
193
|
-
static controlPointsDebugTemplate(
|
|
194
|
-
type: AssociationShapeType,
|
|
195
|
-
start: Point,
|
|
196
|
-
end: Point,
|
|
197
|
-
cp: Point[]
|
|
198
|
-
): SVGTemplateResult | string {
|
|
199
|
-
switch (type) {
|
|
200
|
-
case 'rectilinear':
|
|
201
|
-
return ShapeArtist.rectilinearPathDebugTemplate(start, end, cp)
|
|
202
|
-
default:
|
|
203
|
-
return ''
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
static rectilinearPathDebugTemplate(start: Point, end: Point, controlPoints: Point[]): SVGTemplateResult | string {
|
|
208
|
-
if (!controlPoints || !controlPoints.length) {
|
|
209
|
-
return ''
|
|
210
|
-
}
|
|
211
|
-
const [firstCp] = controlPoints
|
|
212
|
-
const lastCp = controlPoints[controlPoints.length - 1]
|
|
213
|
-
return svg`
|
|
214
|
-
${controlPoints.map((cp, i) => svg`<circle cx="${cp.x}" cy="${cp.y}" r="4" fill="red" title="CP ${i}"/>`)}
|
|
215
|
-
<line x1="${firstCp.x}" y1="${firstCp.y}" x2="${start.x}" y2="${start.y}" style="stroke:red;stroke-width:2;stroke-dasharray: 6;" />
|
|
216
|
-
<line x1="${lastCp.x}" y1="${lastCp.y}" x2="${end.x}" y2="${end.y}" style="stroke:red;stroke-width:2;stroke-dasharray: 6;" />
|
|
217
|
-
|
|
218
|
-
<circle cx="${start.x}" cy="${start.y}" r="4" fill="yellow"/>
|
|
219
|
-
<circle cx="${end.x}" cy="${end.y}" r="4" fill="yellow"/>
|
|
220
|
-
`
|
|
221
|
-
}
|
|
222
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { svg, css } from 'lit'
|
|
2
|
-
|
|
3
|
-
export const markerStyles = css`
|
|
4
|
-
.parent-marker {
|
|
5
|
-
fill: #90a4ae;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.parameter-in polyline {
|
|
9
|
-
stroke: #ff9e91;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.parameter-in-marker {
|
|
13
|
-
fill: #ff9e91;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.parameter-out polyline {
|
|
17
|
-
stroke: #fbc02d;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.parameter-out-marker {
|
|
21
|
-
fill: #fbc02d;
|
|
22
|
-
}
|
|
23
|
-
`
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* A template for the parent entity marker
|
|
27
|
-
*/
|
|
28
|
-
export const parentEntityMaker = svg`
|
|
29
|
-
<marker
|
|
30
|
-
id="parent"
|
|
31
|
-
class="parent-marker"
|
|
32
|
-
viewBox="0 0 20 20"
|
|
33
|
-
refX="10"
|
|
34
|
-
refY="5"
|
|
35
|
-
markerWidth="32"
|
|
36
|
-
markerHeight="32"
|
|
37
|
-
orient="auto-start-reverse"
|
|
38
|
-
markerUnits="userSpaceOnUse"
|
|
39
|
-
>
|
|
40
|
-
<path d="M 0 0 L 10 5 L 0 10 z" />
|
|
41
|
-
</marker>
|
|
42
|
-
`
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* A template for the operation parameter in marker
|
|
46
|
-
*/
|
|
47
|
-
export const parameterInMaker = svg`
|
|
48
|
-
<marker
|
|
49
|
-
id="parameterIn"
|
|
50
|
-
class="parameter-in-marker"
|
|
51
|
-
viewBox="0 0 20 20"
|
|
52
|
-
refX="10"
|
|
53
|
-
refY="5"
|
|
54
|
-
markerWidth="32"
|
|
55
|
-
markerHeight="32"
|
|
56
|
-
orient="auto-start-reverse"
|
|
57
|
-
markerUnits="userSpaceOnUse"
|
|
58
|
-
>
|
|
59
|
-
<path d="M 0 0 L 10 5 L 0 10 z" />
|
|
60
|
-
</marker>
|
|
61
|
-
`
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* A template for the operation parameter out marker
|
|
65
|
-
*/
|
|
66
|
-
export const parameterOutMaker = svg`
|
|
67
|
-
<marker
|
|
68
|
-
id="parameterOut"
|
|
69
|
-
class="parameter-out-marker"
|
|
70
|
-
viewBox="0 0 20 20"
|
|
71
|
-
refX="10"
|
|
72
|
-
refY="5"
|
|
73
|
-
markerWidth="32"
|
|
74
|
-
markerHeight="32"
|
|
75
|
-
orient="auto-start-reverse"
|
|
76
|
-
markerUnits="userSpaceOnUse"
|
|
77
|
-
>
|
|
78
|
-
<path d="M 0 0 L 10 5 L 0 10 z" />
|
|
79
|
-
</marker>
|
|
80
|
-
`
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { RectilinearTip } from './tips/RectilinearTip.js'
|
|
2
|
-
import { TipArtist } from './tips/TipArtist.js'
|
|
3
|
-
import { IEdgeDirections } from './types.js'
|
|
4
|
-
import {
|
|
5
|
-
IAssociationTip,
|
|
6
|
-
IVisualizationAssociationShape,
|
|
7
|
-
IVisualizationRectilinearLineShape,
|
|
8
|
-
} from './VisualizationTypes.js'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* A class that is responsible for sketching different kind of line tips.
|
|
12
|
-
*/
|
|
13
|
-
export class TipSketch {
|
|
14
|
-
/**
|
|
15
|
-
* Builds a tip at the **end** of the line (at the target position).
|
|
16
|
-
*
|
|
17
|
-
* @param type The type of the tip to construct.
|
|
18
|
-
* @param line The definition of the line that the tip is attached to
|
|
19
|
-
* @param directions Computed line directions
|
|
20
|
-
* @returns The definition of a tip pointing at the parent (the other end)
|
|
21
|
-
*/
|
|
22
|
-
endMarker(
|
|
23
|
-
type: string | 'parent' | 'parameterIn' | 'parameterOut' | 'association',
|
|
24
|
-
line: IVisualizationAssociationShape,
|
|
25
|
-
directions: IEdgeDirections
|
|
26
|
-
): IAssociationTip {
|
|
27
|
-
let artist: TipArtist
|
|
28
|
-
if (line.type === 'rectilinear') {
|
|
29
|
-
artist = new RectilinearTip('end', line as IVisualizationRectilinearLineShape, directions)
|
|
30
|
-
} else {
|
|
31
|
-
throw new Error(`Unknown tip type: ${line.type}`)
|
|
32
|
-
}
|
|
33
|
-
let shape: IAssociationTip
|
|
34
|
-
switch (type) {
|
|
35
|
-
case 'parent':
|
|
36
|
-
shape = artist.parent()
|
|
37
|
-
break
|
|
38
|
-
case 'direction':
|
|
39
|
-
shape = artist.direction()
|
|
40
|
-
break
|
|
41
|
-
case 'association':
|
|
42
|
-
shape = artist.association()
|
|
43
|
-
break
|
|
44
|
-
default:
|
|
45
|
-
throw new Error(`Unsupported association shape: ${type}.`)
|
|
46
|
-
}
|
|
47
|
-
if (!shape) {
|
|
48
|
-
throw new Error(`Unable to create a tip shape.`)
|
|
49
|
-
}
|
|
50
|
-
return shape
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Builds a tip at the **start** of the line (at the source position).
|
|
55
|
-
*
|
|
56
|
-
* @param type The type of the tip to construct.
|
|
57
|
-
* @param line The definition of the line that the tip is attached to
|
|
58
|
-
* @param directions Computed line directions
|
|
59
|
-
* @returns The definition of a tip pointing at the parent (the other end)
|
|
60
|
-
*/
|
|
61
|
-
startMarker(
|
|
62
|
-
type: string | 'parent' | 'parameterIn' | 'parameterOut',
|
|
63
|
-
line: IVisualizationAssociationShape,
|
|
64
|
-
directions: IEdgeDirections
|
|
65
|
-
): IAssociationTip {
|
|
66
|
-
let artist: TipArtist
|
|
67
|
-
if (line.type === 'rectilinear') {
|
|
68
|
-
artist = new RectilinearTip('start', line as IVisualizationRectilinearLineShape, directions)
|
|
69
|
-
} else {
|
|
70
|
-
throw new Error(`Unknown tip type: ${line.type}`)
|
|
71
|
-
}
|
|
72
|
-
let shape: IAssociationTip
|
|
73
|
-
switch (type) {
|
|
74
|
-
case 'parent':
|
|
75
|
-
shape = artist.parent()
|
|
76
|
-
break
|
|
77
|
-
case 'direction':
|
|
78
|
-
shape = artist.direction()
|
|
79
|
-
break
|
|
80
|
-
case 'association':
|
|
81
|
-
shape = artist.association()
|
|
82
|
-
break
|
|
83
|
-
default:
|
|
84
|
-
throw new Error(`Unsupported association shape: ${type}.`)
|
|
85
|
-
}
|
|
86
|
-
if (!shape) {
|
|
87
|
-
throw new Error(`Unable to create a tip shape.`)
|
|
88
|
-
}
|
|
89
|
-
return shape
|
|
90
|
-
}
|
|
91
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/prefer-for-of */
|
|
2
|
-
export declare interface TouchCopy {
|
|
3
|
-
identifier: number
|
|
4
|
-
pageX: number
|
|
5
|
-
pageY: number
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export declare interface TouchMoveResult {
|
|
9
|
-
identifier: number
|
|
10
|
-
dx: number
|
|
11
|
-
dy: number
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const cache: TouchCopy[] = []
|
|
15
|
-
|
|
16
|
-
function copyTouch({ identifier, pageX, pageY }: Touch): TouchCopy {
|
|
17
|
-
return { identifier, pageX, pageY }
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function getTouchById(id: number): number {
|
|
21
|
-
for (let i = 0; i < cache.length; i++) {
|
|
22
|
-
const { identifier } = cache[i]
|
|
23
|
-
if (id === identifier) {
|
|
24
|
-
return i
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return -1
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function add(event: TouchEvent): void {
|
|
31
|
-
const touches = event.changedTouches
|
|
32
|
-
for (let i = 0; i < touches.length; i++) {
|
|
33
|
-
cache.push(copyTouch(touches[i]))
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function move(event: TouchEvent): TouchMoveResult[] {
|
|
38
|
-
if (event.cancelable) {
|
|
39
|
-
event.preventDefault()
|
|
40
|
-
}
|
|
41
|
-
const touches = event.changedTouches
|
|
42
|
-
const result = []
|
|
43
|
-
for (let i = 0; i < touches.length; i++) {
|
|
44
|
-
const touch = touches[i]
|
|
45
|
-
const index = getTouchById(touch.identifier)
|
|
46
|
-
if (index === -1) {
|
|
47
|
-
continue
|
|
48
|
-
}
|
|
49
|
-
const copy = copyTouch(touch)
|
|
50
|
-
const { pageX: opx, pageY: opy } = cache[index]
|
|
51
|
-
const { identifier, pageX, pageY } = copy
|
|
52
|
-
cache.splice(index, 1, copy)
|
|
53
|
-
result.push({
|
|
54
|
-
identifier,
|
|
55
|
-
dx: -(pageX - opx),
|
|
56
|
-
dy: -(pageY - opy),
|
|
57
|
-
})
|
|
58
|
-
}
|
|
59
|
-
return result
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export function end(event: TouchEvent): void {
|
|
63
|
-
const touches = event.changedTouches
|
|
64
|
-
for (let i = 0; i < touches.length; i++) {
|
|
65
|
-
const touch = touches[i]
|
|
66
|
-
const index = getTouchById(touch.identifier)
|
|
67
|
-
if (index === -1) {
|
|
68
|
-
continue
|
|
69
|
-
}
|
|
70
|
-
cache.splice(index, 1)
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stops an event and cancels it.
|
|
3
|
-
* @param e The event to stop
|
|
4
|
-
*/
|
|
5
|
-
export function cancelEvent(e: Event): void {
|
|
6
|
-
e.preventDefault()
|
|
7
|
-
e.stopPropagation()
|
|
8
|
-
e.stopImmediatePropagation()
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Get the contrasting color for any hex color
|
|
13
|
-
* (c) 2019 Chris Ferdinandi, MIT License, https://gomakethings.com
|
|
14
|
-
* Derived from work by Brian Suda, https://24ways.org/2010/calculating-color-contrast/
|
|
15
|
-
*
|
|
16
|
-
* See https://gomakethings.com/dynamically-changing-the-text-color-based-on-background-color-contrast-with-vanilla-js/
|
|
17
|
-
*
|
|
18
|
-
* @param hexcolor A hexcolor value
|
|
19
|
-
* @returns The contrasting color (black or white)
|
|
20
|
-
*/
|
|
21
|
-
export function getContrast(hexcolor: string): string {
|
|
22
|
-
let color = hexcolor
|
|
23
|
-
// If a leading # is provided, remove it
|
|
24
|
-
if (color.slice(0, 1) === '#') {
|
|
25
|
-
color = color.slice(1)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// If a three-character hexcode, make six-character
|
|
29
|
-
if (color.length === 3) {
|
|
30
|
-
color = color
|
|
31
|
-
.split('')
|
|
32
|
-
.map((hex) => hex + hex)
|
|
33
|
-
.join('')
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Convert to RGB value
|
|
37
|
-
const r = parseInt(color.substring(0, 2), 16)
|
|
38
|
-
const g = parseInt(color.substring(2, 2), 16)
|
|
39
|
-
const b = parseInt(color.substring(4, 2), 16)
|
|
40
|
-
|
|
41
|
-
// Get YIQ ratio
|
|
42
|
-
const yiq = (r * 299 + g * 587 + b * 114) / 1000
|
|
43
|
-
|
|
44
|
-
// Check contrast
|
|
45
|
-
return yiq >= 128 ? 'black' : 'white'
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Awaits for a specified amount odf time.
|
|
50
|
-
* Zero or negative will result in the next microtask.
|
|
51
|
-
* A positive number will result in the next microtask + the set timeout.
|
|
52
|
-
*
|
|
53
|
-
* @param timeout The number of milliseconds to wait.
|
|
54
|
-
*/
|
|
55
|
-
export async function aTimeout(timeout = 0): Promise<void> {
|
|
56
|
-
return new Promise((resolve) => {
|
|
57
|
-
if (timeout <= 0) {
|
|
58
|
-
resolve()
|
|
59
|
-
} else {
|
|
60
|
-
setTimeout(() => resolve(), timeout)
|
|
61
|
-
}
|
|
62
|
-
})
|
|
63
|
-
}
|