@hatiolab/things-scene 9.0.0-beta.36 → 9.0.0-beta.37
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/package.json +1 -1
- package/things-scene-min.js +11 -11
- package/things-scene-min.js.map +1 -1
- package/things-scene.mjs +11 -11
- package/things-scene.mjs.map +1 -1
- package/.cursorignore +0 -62
- package/.prettierrc +0 -21
- package/assets/icon-audio.png +0 -0
- package/assets/icon-gif-viewer.png +0 -0
- package/assets/images/spinner.png +0 -0
- package/babel.config.js +0 -23
- package/db.sqlite +0 -0
- package/dist/animation/animate.js +0 -63
- package/dist/animation/animate.js.map +0 -1
- package/dist/animation/animations/animation.js +0 -122
- package/dist/animation/animations/animation.js.map +0 -1
- package/dist/animation/animations/fade.js +0 -28
- package/dist/animation/animations/fade.js.map +0 -1
- package/dist/animation/animations/heartbeat.js +0 -28
- package/dist/animation/animations/heartbeat.js.map +0 -1
- package/dist/animation/animations/moving.js +0 -24
- package/dist/animation/animations/moving.js.map +0 -1
- package/dist/animation/animations/outline.js +0 -47
- package/dist/animation/animations/outline.js.map +0 -1
- package/dist/animation/animations/rotation.js +0 -22
- package/dist/animation/animations/rotation.js.map +0 -1
- package/dist/animation/animations/vibration.js +0 -31
- package/dist/animation/animations/vibration.js.map +0 -1
- package/dist/animation/compile.js +0 -31
- package/dist/animation/compile.js.map +0 -1
- package/dist/animation/delta.js +0 -51
- package/dist/animation/delta.js.map +0 -1
- package/dist/animation/index.js +0 -14
- package/dist/animation/index.js.map +0 -1
- package/dist/command/command-change.js +0 -33
- package/dist/command/command-change.js.map +0 -1
- package/dist/command/command-migrate.js +0 -103
- package/dist/command/command-migrate.js.map +0 -1
- package/dist/command/command.js +0 -18
- package/dist/command/command.js.map +0 -1
- package/dist/command/snapshot-commander.js +0 -84
- package/dist/command/snapshot-commander.js.map +0 -1
- package/dist/components/anchor/anchor.js +0 -105
- package/dist/components/anchor/anchor.js.map +0 -1
- package/dist/components/anchor/ellipse-anchors.js +0 -53
- package/dist/components/anchor/ellipse-anchors.js.map +0 -1
- package/dist/components/anchor/rect-anchors.js +0 -53
- package/dist/components/anchor/rect-anchors.js.map +0 -1
- package/dist/components/audio.js +0 -154
- package/dist/components/audio.js.map +0 -1
- package/dist/components/cloud.js +0 -44
- package/dist/components/cloud.js.map +0 -1
- package/dist/components/component.js +0 -1086
- package/dist/components/component.js.map +0 -1
- package/dist/components/container-abstract.js +0 -387
- package/dist/components/container-abstract.js.map +0 -1
- package/dist/components/container.js +0 -331
- package/dist/components/container.js.map +0 -1
- package/dist/components/data/data-mapping.js +0 -82
- package/dist/components/data/data-mapping.js.map +0 -1
- package/dist/components/data/data.js +0 -166
- package/dist/components/data/data.js.map +0 -1
- package/dist/components/data/evaluator.js +0 -103
- package/dist/components/data/evaluator.js.map +0 -1
- package/dist/components/donut.js +0 -104
- package/dist/components/donut.js.map +0 -1
- package/dist/components/drawer/draw-image-pendable.js +0 -20
- package/dist/components/drawer/draw-image-pendable.js.map +0 -1
- package/dist/components/drawer/effect.js +0 -19
- package/dist/components/drawer/effect.js.map +0 -1
- package/dist/components/drawer/fill.js +0 -228
- package/dist/components/drawer/fill.js.map +0 -1
- package/dist/components/drawer/format.js +0 -115
- package/dist/components/drawer/format.js.map +0 -1
- package/dist/components/drawer/line.js +0 -191
- package/dist/components/drawer/line.js.map +0 -1
- package/dist/components/drawer/stroke.js +0 -62
- package/dist/components/drawer/stroke.js.map +0 -1
- package/dist/components/drawer/text-wrapper.js +0 -51
- package/dist/components/drawer/text-wrapper.js.map +0 -1
- package/dist/components/drawer/text.js +0 -269
- package/dist/components/drawer/text.js.map +0 -1
- package/dist/components/ellipse.js +0 -110
- package/dist/components/ellipse.js.map +0 -1
- package/dist/components/file/ondropfile.js +0 -19
- package/dist/components/file/ondropfile.js.map +0 -1
- package/dist/components/fit/fit.js +0 -137
- package/dist/components/fit/fit.js.map +0 -1
- package/dist/components/geometry/transcoord.js +0 -339
- package/dist/components/geometry/transcoord.js.map +0 -1
- package/dist/components/geometry/union.js +0 -35
- package/dist/components/geometry/union.js.map +0 -1
- package/dist/components/gif-view.js +0 -128
- package/dist/components/gif-view.js.map +0 -1
- package/dist/components/global-ref.js +0 -154
- package/dist/components/global-ref.js.map +0 -1
- package/dist/components/group.js +0 -171
- package/dist/components/group.js.map +0 -1
- package/dist/components/html/elements.js +0 -24
- package/dist/components/html/elements.js.map +0 -1
- package/dist/components/html/fill.js +0 -126
- package/dist/components/html/fill.js.map +0 -1
- package/dist/components/html/reposition.js +0 -119
- package/dist/components/html/reposition.js.map +0 -1
- package/dist/components/html/shadow.js +0 -24
- package/dist/components/html/shadow.js.map +0 -1
- package/dist/components/html-overlay-container.js +0 -27
- package/dist/components/html-overlay-container.js.map +0 -1
- package/dist/components/html-overlay-element.js +0 -22
- package/dist/components/html-overlay-element.js.map +0 -1
- package/dist/components/image-view.js +0 -193
- package/dist/components/image-view.js.map +0 -1
- package/dist/components/index.js +0 -231
- package/dist/components/index.js.map +0 -1
- package/dist/components/info-window.js +0 -416
- package/dist/components/info-window.js.map +0 -1
- package/dist/components/line.js +0 -374
- package/dist/components/line.js.map +0 -1
- package/dist/components/local-ref.js +0 -114
- package/dist/components/local-ref.js.map +0 -1
- package/dist/components/mixins/connectable.js +0 -128
- package/dist/components/mixins/connectable.js.map +0 -1
- package/dist/components/mixins/data-source.js +0 -34
- package/dist/components/mixins/data-source.js.map +0 -1
- package/dist/components/mixins/html-element.js +0 -107
- package/dist/components/mixins/html-element.js.map +0 -1
- package/dist/components/mixins/move-handle.js +0 -73
- package/dist/components/mixins/move-handle.js.map +0 -1
- package/dist/components/mixins/rect-path.js +0 -113
- package/dist/components/mixins/rect-path.js.map +0 -1
- package/dist/components/mixins/value-holder.js +0 -81
- package/dist/components/mixins/value-holder.js.map +0 -1
- package/dist/components/mutater/bounds.js +0 -68
- package/dist/components/mutater/bounds.js.map +0 -1
- package/dist/components/mutater/path.js +0 -73
- package/dist/components/mutater/path.js.map +0 -1
- package/dist/components/ortholine.js +0 -763
- package/dist/components/ortholine.js.map +0 -1
- package/dist/components/outline/ellipse-outline.js +0 -23
- package/dist/components/outline/ellipse-outline.js.map +0 -1
- package/dist/components/outline/path-outline.js +0 -48
- package/dist/components/outline/path-outline.js.map +0 -1
- package/dist/components/path.js +0 -49
- package/dist/components/path.js.map +0 -1
- package/dist/components/polygon.js +0 -91
- package/dist/components/polygon.js.map +0 -1
- package/dist/components/polyline.js +0 -114
- package/dist/components/polyline.js.map +0 -1
- package/dist/components/popup.js +0 -160
- package/dist/components/popup.js.map +0 -1
- package/dist/components/rect.js +0 -72
- package/dist/components/rect.js.map +0 -1
- package/dist/components/retention/retention-manager.js +0 -81
- package/dist/components/retention/retention-manager.js.map +0 -1
- package/dist/components/root-container.js +0 -519
- package/dist/components/root-container.js.map +0 -1
- package/dist/components/ruler.js +0 -103
- package/dist/components/ruler.js.map +0 -1
- package/dist/components/shape.js +0 -97
- package/dist/components/shape.js.map +0 -1
- package/dist/components/star.js +0 -103
- package/dist/components/star.js.map +0 -1
- package/dist/components/text/substitutor.js +0 -92
- package/dist/components/text/substitutor.js.map +0 -1
- package/dist/components/text.js +0 -21
- package/dist/components/text.js.map +0 -1
- package/dist/components/triangle.js +0 -92
- package/dist/components/triangle.js.map +0 -1
- package/dist/const.js +0 -71
- package/dist/const.js.map +0 -1
- package/dist/core/collection.js +0 -28
- package/dist/core/collection.js.map +0 -1
- package/dist/core/debug.js +0 -12
- package/dist/core/debug.js.map +0 -1
- package/dist/core/deep-equals.js +0 -112
- package/dist/core/deep-equals.js.map +0 -1
- package/dist/core/dom-to-image.js +0 -617
- package/dist/core/dom-to-image.js.map +0 -1
- package/dist/core/event.js +0 -205
- package/dist/core/event.js.map +0 -1
- package/dist/core/index.js +0 -21
- package/dist/core/index.js.map +0 -1
- package/dist/core/list.js +0 -87
- package/dist/core/list.js.map +0 -1
- package/dist/core/logger.js +0 -29
- package/dist/core/logger.js.map +0 -1
- package/dist/core/memoize.js +0 -40
- package/dist/core/memoize.js.map +0 -1
- package/dist/core/mixin.js +0 -26
- package/dist/core/mixin.js.map +0 -1
- package/dist/core/obj-accessor.js +0 -26
- package/dist/core/obj-accessor.js.map +0 -1
- package/dist/core/reference-map.js +0 -147
- package/dist/core/reference-map.js.map +0 -1
- package/dist/core/round-rect.js +0 -62
- package/dist/core/round-rect.js.map +0 -1
- package/dist/core/safe-round.js +0 -10
- package/dist/core/safe-round.js.map +0 -1
- package/dist/core/script-loader.js +0 -148
- package/dist/core/script-loader.js.map +0 -1
- package/dist/core/snapshot-taker.js +0 -59
- package/dist/core/snapshot-taker.js.map +0 -1
- package/dist/core/stack.js +0 -18
- package/dist/core/stack.js.map +0 -1
- package/dist/core/timecapsule.js +0 -88
- package/dist/core/timecapsule.js.map +0 -1
- package/dist/core/utils.js +0 -309
- package/dist/core/utils.js.map +0 -1
- package/dist/decorator/anchors-decorator.js +0 -53
- package/dist/decorator/anchors-decorator.js.map +0 -1
- package/dist/decorator/bouncing-arrow-decorator.js +0 -52
- package/dist/decorator/bouncing-arrow-decorator.js.map +0 -1
- package/dist/decorator/data-spread-decorator.js +0 -69
- package/dist/decorator/data-spread-decorator.js.map +0 -1
- package/dist/decorator/decotag-decorator.js +0 -33
- package/dist/decorator/decotag-decorator.js.map +0 -1
- package/dist/decorator/index.js +0 -31
- package/dist/decorator/index.js.map +0 -1
- package/dist/decorator/link-decorator.js +0 -66
- package/dist/decorator/link-decorator.js.map +0 -1
- package/dist/effect/gradation.js +0 -37
- package/dist/effect/gradation.js.map +0 -1
- package/dist/effect/index.js +0 -23
- package/dist/effect/index.js.map +0 -1
- package/dist/effect/shadow.js +0 -33
- package/dist/effect/shadow.js.map +0 -1
- package/dist/effect/turn.js +0 -25
- package/dist/effect/turn.js.map +0 -1
- package/dist/event/event-engine.js +0 -76
- package/dist/event/event-engine.js.map +0 -1
- package/dist/event/event-pump.js +0 -92
- package/dist/event/event-pump.js.map +0 -1
- package/dist/event/event-tracker.js +0 -97
- package/dist/event/event-tracker.js.map +0 -1
- package/dist/event/index.js +0 -21
- package/dist/event/index.js.map +0 -1
- package/dist/event/ua-event-handler.js +0 -453
- package/dist/event/ua-event-handler.js.map +0 -1
- package/dist/event-map/animator-handler.js +0 -225
- package/dist/event-map/animator-handler.js.map +0 -1
- package/dist/event-map/animators/animated-icon.js +0 -265
- package/dist/event-map/animators/animated-icon.js.map +0 -1
- package/dist/event-map/animators/border-highlighting.js +0 -476
- package/dist/event-map/animators/border-highlighting.js.map +0 -1
- package/dist/event-map/animators/bouncing-arrow.js +0 -226
- package/dist/event-map/animators/bouncing-arrow.js.map +0 -1
- package/dist/event-map/event-map.js +0 -36
- package/dist/event-map/event-map.js.map +0 -1
- package/dist/event-map/index.js +0 -20
- package/dist/event-map/index.js.map +0 -1
- package/dist/event-map/move-handler.js +0 -233
- package/dist/event-map/move-handler.js.map +0 -1
- package/dist/event-map/paste-handler.js +0 -176
- package/dist/event-map/paste-handler.js.map +0 -1
- package/dist/event-map/shift-handler.js +0 -55
- package/dist/event-map/shift-handler.js.map +0 -1
- package/dist/event-map/text-editor-lite.js +0 -276
- package/dist/event-map/text-editor-lite.js.map +0 -1
- package/dist/event-map/zoom-handler.js +0 -49
- package/dist/event-map/zoom-handler.js.map +0 -1
- package/dist/index.js +0 -20
- package/dist/index.js.map +0 -1
- package/dist/layer/action/emphasize.js +0 -42
- package/dist/layer/action/emphasize.js.map +0 -1
- package/dist/layer/action/popup.js +0 -461
- package/dist/layer/action/popup.js.map +0 -1
- package/dist/layer/action/pressed.js +0 -31
- package/dist/layer/action/pressed.js.map +0 -1
- package/dist/layer/add-layer.js +0 -180
- package/dist/layer/add-layer.js.map +0 -1
- package/dist/layer/decotag-layer.js +0 -121
- package/dist/layer/decotag-layer.js.map +0 -1
- package/dist/layer/guide-layer.js +0 -292
- package/dist/layer/guide-layer.js.map +0 -1
- package/dist/layer/index.js +0 -70
- package/dist/layer/index.js.map +0 -1
- package/dist/layer/layer.js +0 -230
- package/dist/layer/layer.js.map +0 -1
- package/dist/layer/minimap-layer.js +0 -84
- package/dist/layer/minimap-layer.js.map +0 -1
- package/dist/layer/model-layer.js +0 -465
- package/dist/layer/model-layer.js.map +0 -1
- package/dist/layer/modeler/anchor-handler.js +0 -193
- package/dist/layer/modeler/anchor-handler.js.map +0 -1
- package/dist/layer/modeler/control-handler.js +0 -95
- package/dist/layer/modeler/control-handler.js.map +0 -1
- package/dist/layer/modeler/focus-outline.js +0 -41
- package/dist/layer/modeler/focus-outline.js.map +0 -1
- package/dist/layer/modeler/group-outline.js +0 -30
- package/dist/layer/modeler/group-outline.js.map +0 -1
- package/dist/layer/modeler/index.js +0 -56
- package/dist/layer/modeler/index.js.map +0 -1
- package/dist/layer/modeler/path-handler.js +0 -300
- package/dist/layer/modeler/path-handler.js.map +0 -1
- package/dist/layer/modeler/resizer.js +0 -333
- package/dist/layer/modeler/resizer.js.map +0 -1
- package/dist/layer/modeler/rotator.js +0 -134
- package/dist/layer/modeler/rotator.js.map +0 -1
- package/dist/layer/modeling-layer.js +0 -491
- package/dist/layer/modeling-layer.js.map +0 -1
- package/dist/layer/reaction-layer.js +0 -111
- package/dist/layer/reaction-layer.js.map +0 -1
- package/dist/layer/scroll-layer.js +0 -191
- package/dist/layer/scroll-layer.js.map +0 -1
- package/dist/layer/selection/selected-finder.js +0 -96
- package/dist/layer/selection/selected-finder.js.map +0 -1
- package/dist/layer/selection-layer.js +0 -373
- package/dist/layer/selection-layer.js.map +0 -1
- package/dist/layer/shift-layer.js +0 -83
- package/dist/layer/shift-layer.js.map +0 -1
- package/dist/layout/absolute.js +0 -30
- package/dist/layout/absolute.js.map +0 -1
- package/dist/layout/card.js +0 -52
- package/dist/layout/card.js.map +0 -1
- package/dist/layout/html-absolute.js +0 -32
- package/dist/layout/html-absolute.js.map +0 -1
- package/dist/layout/index.js +0 -56
- package/dist/layout/index.js.map +0 -1
- package/dist/layout/layout.js +0 -36
- package/dist/layout/layout.js.map +0 -1
- package/dist/layout/linear-horizontal.js +0 -56
- package/dist/layout/linear-horizontal.js.map +0 -1
- package/dist/layout/linear-vertical.js +0 -56
- package/dist/layout/linear-vertical.js.map +0 -1
- package/dist/layout/table.js +0 -106
- package/dist/layout/table.js.map +0 -1
- package/dist/license/license.js +0 -170
- package/dist/license/license.js.map +0 -1
- package/dist/model/compile.js +0 -40
- package/dist/model/compile.js.map +0 -1
- package/dist/model/duplicate.js +0 -19
- package/dist/model/duplicate.js.map +0 -1
- package/dist/model/index.js +0 -34
- package/dist/model/index.js.map +0 -1
- package/dist/model/selector.js +0 -104
- package/dist/model/selector.js.map +0 -1
- package/dist/style/compile.js +0 -14
- package/dist/style/compile.js.map +0 -1
- package/dist/style/index.js +0 -14
- package/dist/style/index.js.map +0 -1
- package/dist/things-scene/api/add-start.js +0 -18
- package/dist/things-scene/api/add-start.js.map +0 -1
- package/dist/things-scene/api/add.js +0 -71
- package/dist/things-scene/api/add.js.map +0 -1
- package/dist/things-scene/api/align.js +0 -116
- package/dist/things-scene/api/align.js.map +0 -1
- package/dist/things-scene/api/center-to.js +0 -50
- package/dist/things-scene/api/center-to.js.map +0 -1
- package/dist/things-scene/api/change.js +0 -27
- package/dist/things-scene/api/change.js.map +0 -1
- package/dist/things-scene/api/clipboard.js +0 -45
- package/dist/things-scene/api/clipboard.js.map +0 -1
- package/dist/things-scene/api/distribute.js +0 -57
- package/dist/things-scene/api/distribute.js.map +0 -1
- package/dist/things-scene/api/duplicate.js +0 -47
- package/dist/things-scene/api/duplicate.js.map +0 -1
- package/dist/things-scene/api/fullscreen.js +0 -26
- package/dist/things-scene/api/fullscreen.js.map +0 -1
- package/dist/things-scene/api/group.js +0 -91
- package/dist/things-scene/api/group.js.map +0 -1
- package/dist/things-scene/api/ids.js +0 -28
- package/dist/things-scene/api/ids.js.map +0 -1
- package/dist/things-scene/api/index.js +0 -192
- package/dist/things-scene/api/index.js.map +0 -1
- package/dist/things-scene/api/listener.js +0 -69
- package/dist/things-scene/api/listener.js.map +0 -1
- package/dist/things-scene/api/paste-start.js +0 -27
- package/dist/things-scene/api/paste-start.js.map +0 -1
- package/dist/things-scene/api/place.js +0 -98
- package/dist/things-scene/api/place.js.map +0 -1
- package/dist/things-scene/api/remove.js +0 -57
- package/dist/things-scene/api/remove.js.map +0 -1
- package/dist/things-scene/api/symmetry.js +0 -47
- package/dist/things-scene/api/symmetry.js.map +0 -1
- package/dist/things-scene/api/to-data-url.js +0 -76
- package/dist/things-scene/api/to-data-url.js.map +0 -1
- package/dist/things-scene/api/zorder.js +0 -68
- package/dist/things-scene/api/zorder.js.map +0 -1
- package/dist/things-scene/application-context.js +0 -168
- package/dist/things-scene/application-context.js.map +0 -1
- package/dist/things-scene/config.js +0 -18
- package/dist/things-scene/config.js.map +0 -1
- package/dist/things-scene/create.js +0 -67
- package/dist/things-scene/create.js.map +0 -1
- package/dist/things-scene/fps.js +0 -26
- package/dist/things-scene/fps.js.map +0 -1
- package/dist/things-scene/index.js +0 -152
- package/dist/things-scene/index.js.map +0 -1
- package/dist/things-scene/polyfill.js +0 -111
- package/dist/things-scene/polyfill.js.map +0 -1
- package/dist/things-scene/scene.js +0 -442
- package/dist/things-scene/scene.js.map +0 -1
- package/dist/things-scene/version.js +0 -12
- package/dist/things-scene/version.js.map +0 -1
- package/rollup.config.js +0 -67
- package/schema.graphql +0 -4606
- package/tsconfig.json +0 -31
package/dist/core/utils.js
DELETED
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "clone", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _clone.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "debounce", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _debounce.default;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "isEmpty", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _isEmpty.default;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
exports.merge = merge;
|
|
25
|
-
exports.objToVal = objToVal;
|
|
26
|
-
Object.defineProperty(exports, "once", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
get: function () {
|
|
29
|
-
return _once.default;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
exports.push = push;
|
|
33
|
-
Object.defineProperty(exports, "throttle", {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
get: function () {
|
|
36
|
-
return _throttle.default;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
exports.uniqueId = uniqueId;
|
|
40
|
-
var _clone = _interopRequireDefault(require("lodash-es/clone.js"));
|
|
41
|
-
var _debounce = _interopRequireDefault(require("lodash-es/debounce.js"));
|
|
42
|
-
var _throttle = _interopRequireDefault(require("lodash-es/throttle.js"));
|
|
43
|
-
var _once = _interopRequireDefault(require("lodash-es/once.js"));
|
|
44
|
-
var _isEmpty = _interopRequireDefault(require("lodash-es/isEmpty.js"));
|
|
45
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
46
|
-
/*
|
|
47
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
const DEFAULT_INTERVAL = 100;
|
|
51
|
-
var idCounter = 0;
|
|
52
|
-
// export function clone(src) {
|
|
53
|
-
// /*
|
|
54
|
-
// * function 이 포함된 Object는 복제되지 않는다는 점을 주의할 것
|
|
55
|
-
// * JSON을 활용하는 방법이 매우 빠르다.
|
|
56
|
-
// */
|
|
57
|
-
// return JSON.parse(JSON.stringify(src))
|
|
58
|
-
|
|
59
|
-
// value가 undefined인 key는 제거되는 문제가 있으므로, lodash clone을 이용한다.
|
|
60
|
-
|
|
61
|
-
// return clone(src)
|
|
62
|
-
// }
|
|
63
|
-
|
|
64
|
-
// returns new object representing multiple objects merged together
|
|
65
|
-
// optional final argument is boolean which specifies if merge is recursive
|
|
66
|
-
// original objects are unmodified
|
|
67
|
-
//
|
|
68
|
-
// usage:
|
|
69
|
-
// var base = {a:2, b:6};
|
|
70
|
-
// var extra = {b:3, c:4};
|
|
71
|
-
// merge(base, extra); //{a:2, b:3, c:4}
|
|
72
|
-
// base; //{a:2, b:6}
|
|
73
|
-
//
|
|
74
|
-
// var base = {a:2, b:6};
|
|
75
|
-
// var extra = {b:3, c:4};
|
|
76
|
-
// var extraExtra = {a:4, d:9};
|
|
77
|
-
// merge(base, extra, extraExtra); //{a:4, b:3, c:4. d: 9}
|
|
78
|
-
// base; //{a:2, b:6}
|
|
79
|
-
//
|
|
80
|
-
// var base = {a:2, b:{bb:4, cc:5}};
|
|
81
|
-
// var extra = {a:4, b:{cc:7, dd:1}};
|
|
82
|
-
// merge(base, extra, true); //{a:4, b:{bb:4, cc:7, dd:1}}
|
|
83
|
-
// base; //{a:4, b:{bb:4, cc:7, dd:1}}
|
|
84
|
-
//
|
|
85
|
-
function merge(target = {}, ...extenders) {
|
|
86
|
-
if (typeof target != 'object') target = {};
|
|
87
|
-
extenders.forEach(other => {
|
|
88
|
-
for (let key in other) {
|
|
89
|
-
if (typeof other[key] != 'object') {
|
|
90
|
-
target[key] = other[key];
|
|
91
|
-
} else if (other[key].length > 0) {
|
|
92
|
-
target[key] = other[key].map(item => {
|
|
93
|
-
let v;
|
|
94
|
-
if (typeof other[key] != 'object') v = item;else v = merge({}, item);
|
|
95
|
-
return v;
|
|
96
|
-
});
|
|
97
|
-
} else {
|
|
98
|
-
target[key] = merge(target[key], other[key]);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
return target;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// updates base in place by copying properties of extra to it
|
|
106
|
-
// optionally clobber protected
|
|
107
|
-
// usage:
|
|
108
|
-
// var base = {a:2, b:6};
|
|
109
|
-
// var extra = {c:4};
|
|
110
|
-
// push(base, extra); //{a:2, b:6, c:4}
|
|
111
|
-
// base; //{a:2, b:6, c:4}
|
|
112
|
-
//
|
|
113
|
-
// var base = {a:2, b:6};
|
|
114
|
-
// var extra = {b: 4 c:4};
|
|
115
|
-
// push(base, extra, true); //Error ("utils.push attempted to overwrite 'b' while running in protected mode")
|
|
116
|
-
// base; //{a:2, b:6}
|
|
117
|
-
//
|
|
118
|
-
// objects with the same key will merge recursively when protect is false
|
|
119
|
-
// eg:
|
|
120
|
-
// var base = {a:16, b:{bb:4, cc:10}};
|
|
121
|
-
// var extra = {b:{cc:25, dd:19}, c:5};
|
|
122
|
-
// push(base, extra); //{a:16, {bb:4, cc:25, dd:19}, c:5}
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
function push(base, extra, protect) {
|
|
126
|
-
if (!base || !extra) return base;
|
|
127
|
-
for (let key in extra) {
|
|
128
|
-
if (base[key] && protect) throw new Error(`utils.push attempted to overwrite "${key}" while running in protected mode`);
|
|
129
|
-
if (typeof base[key] == 'object' && typeof extra[key] == 'object') push(base[key], extra[key]);else base[key] = extra[key];
|
|
130
|
-
}
|
|
131
|
-
return base;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/*
|
|
135
|
-
* debounce는 넘겨진 func을 마지막 debounce함수가 호출된 이후 wait 시간이 지난 후에
|
|
136
|
-
* 꼭 한번만 실행하는 것을 보장하는 함수이다.
|
|
137
|
-
*/
|
|
138
|
-
// export function debounce(func, wait, immediate) {
|
|
139
|
-
// if(typeof wait !== 'number')
|
|
140
|
-
// wait = DEFAULT_INTERVAL
|
|
141
|
-
|
|
142
|
-
// var timeout = 0, result = null
|
|
143
|
-
|
|
144
|
-
// return function() {
|
|
145
|
-
// var context = this
|
|
146
|
-
// var args = arguments
|
|
147
|
-
|
|
148
|
-
// function later() {
|
|
149
|
-
// timeout = null
|
|
150
|
-
// if(!immediate)
|
|
151
|
-
// result = func.apply(context, args)
|
|
152
|
-
// }
|
|
153
|
-
|
|
154
|
-
// var callNow = immediate && !timeout
|
|
155
|
-
// clearTimeout(timeout)
|
|
156
|
-
// timeout = setTimeout(later, wait)
|
|
157
|
-
|
|
158
|
-
// if(callNow)
|
|
159
|
-
// result = func.apply(context, args)
|
|
160
|
-
|
|
161
|
-
// return result
|
|
162
|
-
// }
|
|
163
|
-
// }
|
|
164
|
-
|
|
165
|
-
/*
|
|
166
|
-
* throttle은 넘겨진 func의 실행을 wait 시간이 지난 후까지
|
|
167
|
-
* 꼭 한번만 실행하는 것을 보장하는 함수이다.
|
|
168
|
-
*/
|
|
169
|
-
// export function throttle(func, wait) {
|
|
170
|
-
|
|
171
|
-
// if(typeof wait !== 'number')
|
|
172
|
-
// wait = DEFAULT_INTERVAL
|
|
173
|
-
|
|
174
|
-
// var context = null, args = null, throttling = null,
|
|
175
|
-
// more = null, result = null, timeout = 0
|
|
176
|
-
|
|
177
|
-
// var whenDone = debounce(function() {
|
|
178
|
-
// more = throttling = false
|
|
179
|
-
// }, wait)
|
|
180
|
-
|
|
181
|
-
// return function() {
|
|
182
|
-
// context = this
|
|
183
|
-
// args = arguments
|
|
184
|
-
|
|
185
|
-
// var later = function() {
|
|
186
|
-
// timeout = null
|
|
187
|
-
// if(more)
|
|
188
|
-
// result = func.apply(context, args)
|
|
189
|
-
// return whenDone
|
|
190
|
-
// }
|
|
191
|
-
|
|
192
|
-
// if(!timeout)
|
|
193
|
-
// timeout = setTimeout(later, wait)
|
|
194
|
-
|
|
195
|
-
// if(throttling)
|
|
196
|
-
// more = true
|
|
197
|
-
// else {
|
|
198
|
-
// throttling = true
|
|
199
|
-
// result = func.apply(context, args)
|
|
200
|
-
// }
|
|
201
|
-
|
|
202
|
-
// whenDone()
|
|
203
|
-
// return result
|
|
204
|
-
// }
|
|
205
|
-
// }
|
|
206
|
-
|
|
207
|
-
// countThen: (num, base) ->
|
|
208
|
-
// -> base.apply this, arguments if !--num
|
|
209
|
-
|
|
210
|
-
// delegate: (rules) ->
|
|
211
|
-
// (e, data) ->
|
|
212
|
-
// target = $(e.target)
|
|
213
|
-
// parent = null
|
|
214
|
-
|
|
215
|
-
// for own selector of rules
|
|
216
|
-
// if !e.isPropagationStopped() and (parent = target.closest(selector)).length
|
|
217
|
-
// data = data || {}
|
|
218
|
-
// data.el = parent[0]
|
|
219
|
-
// return rules[selector].apply this, [e, data]
|
|
220
|
-
|
|
221
|
-
// ensures that a function will only be called once.
|
|
222
|
-
// usage:
|
|
223
|
-
// will only create the application once
|
|
224
|
-
// var initialize = utils.once(createApplication)
|
|
225
|
-
// initialize();
|
|
226
|
-
// initialize();
|
|
227
|
-
//
|
|
228
|
-
// will only delete a record once
|
|
229
|
-
// var myHanlder = function () {
|
|
230
|
-
// $.ajax({type: 'DELETE', url: 'someurl.com', data: {id: 1}});
|
|
231
|
-
// };
|
|
232
|
-
// this.on('click', utils.once(myHandler));
|
|
233
|
-
//
|
|
234
|
-
|
|
235
|
-
// export function once(func) {
|
|
236
|
-
// var ran = false
|
|
237
|
-
// var result = null
|
|
238
|
-
|
|
239
|
-
// return function(...params) {
|
|
240
|
-
// if(ran)
|
|
241
|
-
// return result;
|
|
242
|
-
|
|
243
|
-
// result = func(...params)
|
|
244
|
-
// ran = true;
|
|
245
|
-
|
|
246
|
-
// return result
|
|
247
|
-
// }
|
|
248
|
-
// }
|
|
249
|
-
|
|
250
|
-
// Generate a unique integer id (unique within the entire client session).
|
|
251
|
-
// Useful for temporary ids.
|
|
252
|
-
function uniqueId(prefix) {
|
|
253
|
-
return `${prefix || ''}${++idCounter}`;
|
|
254
|
-
}
|
|
255
|
-
// export function isEmpty(val) {
|
|
256
|
-
|
|
257
|
-
// // test results
|
|
258
|
-
// //---------------
|
|
259
|
-
// // [] true, empty array
|
|
260
|
-
// // {} true, empty object
|
|
261
|
-
// // null true
|
|
262
|
-
// // undefined true
|
|
263
|
-
// // "" true, empty string
|
|
264
|
-
// // '' true, empty string
|
|
265
|
-
// // 0 false, number
|
|
266
|
-
// // true false, boolean
|
|
267
|
-
// // false false, boolean
|
|
268
|
-
// // Date false
|
|
269
|
-
// // function false
|
|
270
|
-
|
|
271
|
-
// if (val === undefined)
|
|
272
|
-
// return true;
|
|
273
|
-
|
|
274
|
-
// if (typeof (val) == 'function' || typeof (val) == 'number' || typeof (val) == 'boolean' || Object.prototype.toString.call(val) === '[object Date]')
|
|
275
|
-
// return false;
|
|
276
|
-
|
|
277
|
-
// if (val == null || val.length === 0) // null or 0 length array
|
|
278
|
-
// return true;
|
|
279
|
-
|
|
280
|
-
// if (typeof (val) == "object") {
|
|
281
|
-
// // empty object
|
|
282
|
-
|
|
283
|
-
// var r = true;
|
|
284
|
-
|
|
285
|
-
// for (var f in val)
|
|
286
|
-
// r = false;
|
|
287
|
-
|
|
288
|
-
// return r;
|
|
289
|
-
// }
|
|
290
|
-
|
|
291
|
-
// return false;
|
|
292
|
-
// }
|
|
293
|
-
|
|
294
|
-
function objToVal(value) {
|
|
295
|
-
while (value && typeof value === 'object') {
|
|
296
|
-
let backup = value;
|
|
297
|
-
for (let p in value) {
|
|
298
|
-
value = value[p];
|
|
299
|
-
break;
|
|
300
|
-
}
|
|
301
|
-
if (value === backup) {
|
|
302
|
-
// No properties case
|
|
303
|
-
value = undefined;
|
|
304
|
-
break;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
return value;
|
|
308
|
-
}
|
|
309
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/core/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["_clone","_interopRequireDefault","require","_debounce","_throttle","_once","_isEmpty","e","__esModule","default","DEFAULT_INTERVAL","idCounter","merge","target","extenders","forEach","other","key","length","map","item","v","push","base","extra","protect","Error","uniqueId","prefix","objToVal","value","backup","p","undefined"],"sources":["../../src/core/utils.js"],"sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nconst DEFAULT_INTERVAL = 100\nvar idCounter = 0\nexport { default as clone } from 'lodash-es/clone.js'\n\n// export function clone(src) {\n// /*\n// * function 이 포함된 Object는 복제되지 않는다는 점을 주의할 것\n// * JSON을 활용하는 방법이 매우 빠르다.\n// */\n// return JSON.parse(JSON.stringify(src))\n\n// value가 undefined인 key는 제거되는 문제가 있으므로, lodash clone을 이용한다.\n\n// return clone(src)\n// }\n\n// returns new object representing multiple objects merged together\n// optional final argument is boolean which specifies if merge is recursive\n// original objects are unmodified\n//\n// usage:\n// var base = {a:2, b:6};\n// var extra = {b:3, c:4};\n// merge(base, extra); //{a:2, b:3, c:4}\n// base; //{a:2, b:6}\n//\n// var base = {a:2, b:6};\n// var extra = {b:3, c:4};\n// var extraExtra = {a:4, d:9};\n// merge(base, extra, extraExtra); //{a:4, b:3, c:4. d: 9}\n// base; //{a:2, b:6}\n//\n// var base = {a:2, b:{bb:4, cc:5}};\n// var extra = {a:4, b:{cc:7, dd:1}};\n// merge(base, extra, true); //{a:4, b:{bb:4, cc:7, dd:1}}\n// base; //{a:4, b:{bb:4, cc:7, dd:1}}\n//\nexport function merge(target = {}, ...extenders) {\n if (typeof target != 'object') target = {}\n\n extenders.forEach(other => {\n for (let key in other) {\n if (typeof other[key] != 'object') {\n target[key] = other[key]\n } else if (other[key].length > 0) {\n target[key] = other[key].map(item => {\n let v\n if (typeof other[key] != 'object') v = item\n else v = merge({}, item)\n\n return v\n })\n } else {\n target[key] = merge(target[key], other[key])\n }\n }\n })\n\n return target\n}\n\n// updates base in place by copying properties of extra to it\n// optionally clobber protected\n// usage:\n// var base = {a:2, b:6};\n// var extra = {c:4};\n// push(base, extra); //{a:2, b:6, c:4}\n// base; //{a:2, b:6, c:4}\n//\n// var base = {a:2, b:6};\n// var extra = {b: 4 c:4};\n// push(base, extra, true); //Error (\"utils.push attempted to overwrite 'b' while running in protected mode\")\n// base; //{a:2, b:6}\n//\n// objects with the same key will merge recursively when protect is false\n// eg:\n// var base = {a:16, b:{bb:4, cc:10}};\n// var extra = {b:{cc:25, dd:19}, c:5};\n// push(base, extra); //{a:16, {bb:4, cc:25, dd:19}, c:5}\n//\n\nexport function push(base, extra, protect) {\n if (!base || !extra) return base\n\n for (let key in extra) {\n if (base[key] && protect)\n throw new Error(`utils.push attempted to overwrite \"${key}\" while running in protected mode`)\n\n if (typeof base[key] == 'object' && typeof extra[key] == 'object') push(base[key], extra[key])\n else base[key] = extra[key]\n }\n\n return base\n}\n\nexport { default as debounce } from 'lodash-es/debounce.js'\n/*\n * debounce는 넘겨진 func을 마지막 debounce함수가 호출된 이후 wait 시간이 지난 후에\n * 꼭 한번만 실행하는 것을 보장하는 함수이다.\n */\n// export function debounce(func, wait, immediate) {\n// if(typeof wait !== 'number')\n// wait = DEFAULT_INTERVAL\n\n// var timeout = 0, result = null\n\n// return function() {\n// var context = this\n// var args = arguments\n\n// function later() {\n// timeout = null\n// if(!immediate)\n// result = func.apply(context, args)\n// }\n\n// var callNow = immediate && !timeout\n// clearTimeout(timeout)\n// timeout = setTimeout(later, wait)\n\n// if(callNow)\n// result = func.apply(context, args)\n\n// return result\n// }\n// }\n\nexport { default as throttle } from 'lodash-es/throttle.js'\n/*\n * throttle은 넘겨진 func의 실행을 wait 시간이 지난 후까지\n * 꼭 한번만 실행하는 것을 보장하는 함수이다.\n */\n// export function throttle(func, wait) {\n\n// if(typeof wait !== 'number')\n// wait = DEFAULT_INTERVAL\n\n// var context = null, args = null, throttling = null,\n// more = null, result = null, timeout = 0\n\n// var whenDone = debounce(function() {\n// more = throttling = false\n// }, wait)\n\n// return function() {\n// context = this\n// args = arguments\n\n// var later = function() {\n// timeout = null\n// if(more)\n// result = func.apply(context, args)\n// return whenDone\n// }\n\n// if(!timeout)\n// timeout = setTimeout(later, wait)\n\n// if(throttling)\n// more = true\n// else {\n// throttling = true\n// result = func.apply(context, args)\n// }\n\n// whenDone()\n// return result\n// }\n// }\n\n// countThen: (num, base) ->\n// -> base.apply this, arguments if !--num\n\n// delegate: (rules) ->\n// (e, data) ->\n// target = $(e.target)\n// parent = null\n\n// for own selector of rules\n// if !e.isPropagationStopped() and (parent = target.closest(selector)).length\n// data = data || {}\n// data.el = parent[0]\n// return rules[selector].apply this, [e, data]\n\n// ensures that a function will only be called once.\n// usage:\n// will only create the application once\n// var initialize = utils.once(createApplication)\n// initialize();\n// initialize();\n//\n// will only delete a record once\n// var myHanlder = function () {\n// $.ajax({type: 'DELETE', url: 'someurl.com', data: {id: 1}});\n// };\n// this.on('click', utils.once(myHandler));\n//\nexport { default as once } from 'lodash-es/once.js'\n// export function once(func) {\n// var ran = false\n// var result = null\n\n// return function(...params) {\n// if(ran)\n// return result;\n\n// result = func(...params)\n// ran = true;\n\n// return result\n// }\n// }\n\n// Generate a unique integer id (unique within the entire client session).\n// Useful for temporary ids.\nexport function uniqueId(prefix) {\n return `${prefix || ''}${++idCounter}`\n}\n\nexport { default as isEmpty } from 'lodash-es/isEmpty.js'\n// export function isEmpty(val) {\n\n// // test results\n// //---------------\n// // [] true, empty array\n// // {} true, empty object\n// // null true\n// // undefined true\n// // \"\" true, empty string\n// // '' true, empty string\n// // 0 false, number\n// // true false, boolean\n// // false false, boolean\n// // Date false\n// // function false\n\n// if (val === undefined)\n// return true;\n\n// if (typeof (val) == 'function' || typeof (val) == 'number' || typeof (val) == 'boolean' || Object.prototype.toString.call(val) === '[object Date]')\n// return false;\n\n// if (val == null || val.length === 0) // null or 0 length array\n// return true;\n\n// if (typeof (val) == \"object\") {\n// // empty object\n\n// var r = true;\n\n// for (var f in val)\n// r = false;\n\n// return r;\n// }\n\n// return false;\n// }\n\nexport function objToVal(value) {\n while (value && typeof value === 'object') {\n let backup = value\n for (let p in value) {\n value = value[p]\n break\n }\n if (value === backup) {\n // No properties case\n value = undefined\n break\n }\n }\n return value\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AA6FA,IAAAC,SAAA,GAAAF,sBAAA,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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACO,SAASI,QAAQA,CAACC,MAAM,EAAE;EAC/B,OAAO,GAAGA,MAAM,IAAI,EAAE,GAAG,EAAEjB,SAAS,EAAE;AACxC;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEO,SAASkB,QAAQA,CAACC,KAAK,EAAE;EAC9B,OAAOA,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IACzC,IAAIC,MAAM,GAAGD,KAAK;IAClB,KAAK,IAAIE,CAAC,IAAIF,KAAK,EAAE;MACnBA,KAAK,GAAGA,KAAK,CAACE,CAAC,CAAC;MAChB;IACF;IACA,IAAIF,KAAK,KAAKC,MAAM,EAAE;MACpB;MACAD,KAAK,GAAGG,SAAS;MACjB;IACF;EACF;EACA,OAAOH,KAAK;AACd","ignoreList":[]}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = anchorsDecorator;
|
|
7
|
-
var _roundRect = require("../core/round-rect.js");
|
|
8
|
-
/**
|
|
9
|
-
* Anchor definition
|
|
10
|
-
* @typedef {Object} Anchor
|
|
11
|
-
* @property {string} name - name of the anchor
|
|
12
|
-
* @property {string} type - type of the anchor
|
|
13
|
-
* @property {string} inout - inout direction of the anchor 'in', 'out', 'inout'
|
|
14
|
-
* @property {Position} position - position of the anchor
|
|
15
|
-
* @property {Bounds} bounds - bounds of the anchor
|
|
16
|
-
* @property {boolean} multiplicity - multiplicity
|
|
17
|
-
* @property {anchorDrawFunction} draw
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
function anchorsDecorator(component, context, delta /* 1 to 0 */) {
|
|
21
|
-
if (!component.app.isEditMode) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
var rendered = false;
|
|
25
|
-
component.anchors && component.anchors.forEach(anchor => {
|
|
26
|
-
const {
|
|
27
|
-
name,
|
|
28
|
-
position
|
|
29
|
-
} = anchor;
|
|
30
|
-
var {
|
|
31
|
-
x,
|
|
32
|
-
y
|
|
33
|
-
} = position || {};
|
|
34
|
-
if (!name) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
var {
|
|
38
|
-
x,
|
|
39
|
-
y
|
|
40
|
-
} = component.transcoordS2C(x, y, component.rootModel);
|
|
41
|
-
x += 4;
|
|
42
|
-
y += 4;
|
|
43
|
-
context.font = '12px Arial';
|
|
44
|
-
let metrics = context.measureText(name);
|
|
45
|
-
context.fillStyle = '#FF0000';
|
|
46
|
-
(0, _roundRect.roundRect)(context, x, y, metrics.width + 6, 16, 3, true, false);
|
|
47
|
-
context.fillStyle = 'white';
|
|
48
|
-
context.fillText(name, x + 3, y + 13);
|
|
49
|
-
rendered = true;
|
|
50
|
-
});
|
|
51
|
-
return rendered;
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=anchors-decorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"anchors-decorator.js","names":["_roundRect","require","anchorsDecorator","component","context","delta","app","isEditMode","rendered","anchors","forEach","anchor","name","position","x","y","transcoordS2C","rootModel","font","metrics","measureText","fillStyle","roundRect","width","fillText"],"sources":["../../src/decorator/anchors-decorator.js"],"sourcesContent":["/**\n * Anchor definition\n * @typedef {Object} Anchor\n * @property {string} name - name of the anchor\n * @property {string} type - type of the anchor\n * @property {string} inout - inout direction of the anchor 'in', 'out', 'inout'\n * @property {Position} position - position of the anchor\n * @property {Bounds} bounds - bounds of the anchor\n * @property {boolean} multiplicity - multiplicity\n * @property {anchorDrawFunction} draw\n */\n\nimport { roundRect } from '../core/round-rect.js'\n\nexport default function anchorsDecorator(component, context, delta /* 1 to 0 */) {\n if (!component.app.isEditMode) {\n return\n }\n\n var rendered = false\n\n component.anchors &&\n component.anchors.forEach(anchor => {\n const { name, position } = anchor\n var { x, y } = position || {}\n\n if (!name) {\n return\n }\n\n var { x, y } = component.transcoordS2C(x, y, component.rootModel)\n x += 4\n y += 4\n\n context.font = '12px Arial'\n let metrics = context.measureText(name)\n\n context.fillStyle = '#FF0000'\n roundRect(context, x, y, metrics.width + 6, 16, 3, true, false)\n\n context.fillStyle = 'white'\n\n context.fillText(name, x + 3, y + 13)\n\n rendered = true\n })\n\n return rendered\n}\n"],"mappings":";;;;;;AAYA,IAAAA,UAAA,GAAAC,OAAA;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIe,SAASC,gBAAgBA,CAACC,SAAS,EAAEC,OAAO,EAAEC,KAAK,CAAC,cAAc;EAC/E,IAAI,CAACF,SAAS,CAACG,GAAG,CAACC,UAAU,EAAE;IAC7B;EACF;EAEA,IAAIC,QAAQ,GAAG,KAAK;EAEpBL,SAAS,CAACM,OAAO,IACfN,SAAS,CAACM,OAAO,CAACC,OAAO,CAACC,MAAM,IAAI;IAClC,MAAM;MAAEC,IAAI;MAAEC;IAAS,CAAC,GAAGF,MAAM;IACjC,IAAI;MAAEG,CAAC;MAAEC;IAAE,CAAC,GAAGF,QAAQ,IAAI,CAAC,CAAC;IAE7B,IAAI,CAACD,IAAI,EAAE;MACT;IACF;IAEA,IAAI;MAAEE,CAAC;MAAEC;IAAE,CAAC,GAAGZ,SAAS,CAACa,aAAa,CAACF,CAAC,EAAEC,CAAC,EAAEZ,SAAS,CAACc,SAAS,CAAC;IACjEH,CAAC,IAAI,CAAC;IACNC,CAAC,IAAI,CAAC;IAENX,OAAO,CAACc,IAAI,GAAG,YAAY;IAC3B,IAAIC,OAAO,GAAGf,OAAO,CAACgB,WAAW,CAACR,IAAI,CAAC;IAEvCR,OAAO,CAACiB,SAAS,GAAG,SAAS;IAC7B,IAAAC,oBAAS,EAAClB,OAAO,EAAEU,CAAC,EAAEC,CAAC,EAAEI,OAAO,CAACI,KAAK,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC;IAE/DnB,OAAO,CAACiB,SAAS,GAAG,OAAO;IAE3BjB,OAAO,CAACoB,QAAQ,CAACZ,IAAI,EAAEE,CAAC,GAAG,CAAC,EAAEC,CAAC,GAAG,EAAE,CAAC;IAErCP,QAAQ,GAAG,IAAI;EACjB,CAAC,CAAC;EAEJ,OAAOA,QAAQ;AACjB","ignoreList":[]}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = bouncingArrowDecorator;
|
|
7
|
-
function bounce(delta) {
|
|
8
|
-
const progress = (1 - delta) * 100;
|
|
9
|
-
const round = progress / 10;
|
|
10
|
-
const bounce = progress % 10; /* 10회 바운스 */
|
|
11
|
-
|
|
12
|
-
return bounce < 5 ? bounce : 10 - bounce;
|
|
13
|
-
}
|
|
14
|
-
function bouncingArrowDecorator(component, context, delta /* 1 ~ 0 */) {
|
|
15
|
-
let {
|
|
16
|
-
left,
|
|
17
|
-
top,
|
|
18
|
-
width
|
|
19
|
-
} = component.bounds;
|
|
20
|
-
let id = component.state.id;
|
|
21
|
-
let {
|
|
22
|
-
x,
|
|
23
|
-
y
|
|
24
|
-
} = component.transcoordS2C(left + width / 2, top, component.rootModel);
|
|
25
|
-
const BOUNCE = bounce(delta || 0) * 2;
|
|
26
|
-
x = Math.max(x, 20);
|
|
27
|
-
y = Math.max(y, 20);
|
|
28
|
-
context.beginPath();
|
|
29
|
-
context.moveTo(x - 10, y - 16 + BOUNCE);
|
|
30
|
-
context.lineTo(x + 10, y - 16 + BOUNCE);
|
|
31
|
-
context.lineTo(x + 10, y - 8 + BOUNCE);
|
|
32
|
-
context.lineTo(x + 16, y - 8 + BOUNCE);
|
|
33
|
-
context.lineTo(x, y + BOUNCE);
|
|
34
|
-
context.lineTo(x - 16, y - 8 + BOUNCE);
|
|
35
|
-
context.lineTo(x - 10, y - 8 + BOUNCE);
|
|
36
|
-
context.lineTo(x - 10, y - 16 + BOUNCE);
|
|
37
|
-
context.lineTo(x - 10, y - 16 + BOUNCE);
|
|
38
|
-
context.fillStyle = '#FF0000';
|
|
39
|
-
context.fill();
|
|
40
|
-
if (id) {
|
|
41
|
-
context.beginPath();
|
|
42
|
-
context.font = '12px Arial';
|
|
43
|
-
let metrics = context.measureText(id);
|
|
44
|
-
context.fillStyle = '#FF0000';
|
|
45
|
-
context.roundRect(x - metrics.actualBoundingBoxLeft - 3 + 20, y - metrics.actualBoundingBoxAscent - 3 - 6 + BOUNCE, metrics.actualBoundingBoxLeft + metrics.actualBoundingBoxRight + 3 * 2, metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent + 3 * 2, 3 /* round */);
|
|
46
|
-
context.fill();
|
|
47
|
-
context.fillStyle = 'white';
|
|
48
|
-
context.fillText(id, x + 20, y - 6 + BOUNCE);
|
|
49
|
-
}
|
|
50
|
-
return true; /* need animation */
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=bouncing-arrow-decorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bouncing-arrow-decorator.js","names":["bounce","delta","progress","round","bouncingArrowDecorator","component","context","left","top","width","bounds","id","state","x","y","transcoordS2C","rootModel","BOUNCE","Math","max","beginPath","moveTo","lineTo","fillStyle","fill","font","metrics","measureText","roundRect","actualBoundingBoxLeft","actualBoundingBoxAscent","actualBoundingBoxRight","actualBoundingBoxDescent","fillText"],"sources":["../../src/decorator/bouncing-arrow-decorator.js"],"sourcesContent":["function bounce(delta) {\n const progress = (1 - delta) * 100\n const round = progress / 10\n const bounce = progress % 10 /* 10회 바운스 */\n\n return bounce < 5 ? bounce : 10 - bounce\n}\n\nexport default function bouncingArrowDecorator(component, context, delta /* 1 ~ 0 */) {\n let { left, top, width } = component.bounds\n let id = component.state.id\n let { x, y } = component.transcoordS2C(left + width / 2, top, component.rootModel)\n\n const BOUNCE = bounce(delta || 0) * 2\n\n x = Math.max(x, 20)\n y = Math.max(y, 20)\n\n context.beginPath()\n\n context.moveTo(x - 10, y - 16 + BOUNCE)\n context.lineTo(x + 10, y - 16 + BOUNCE)\n context.lineTo(x + 10, y - 8 + BOUNCE)\n context.lineTo(x + 16, y - 8 + BOUNCE)\n context.lineTo(x, y + BOUNCE)\n context.lineTo(x - 16, y - 8 + BOUNCE)\n context.lineTo(x - 10, y - 8 + BOUNCE)\n context.lineTo(x - 10, y - 16 + BOUNCE)\n context.lineTo(x - 10, y - 16 + BOUNCE)\n\n context.fillStyle = '#FF0000'\n\n context.fill()\n\n if (id) {\n context.beginPath()\n\n context.font = '12px Arial'\n let metrics = context.measureText(id)\n\n context.fillStyle = '#FF0000'\n context.roundRect(\n x - metrics.actualBoundingBoxLeft - 3 + 20,\n y - metrics.actualBoundingBoxAscent - 3 - 6 + BOUNCE,\n metrics.actualBoundingBoxLeft + metrics.actualBoundingBoxRight + 3 * 2,\n metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent + 3 * 2,\n 3 /* round */\n )\n\n context.fill()\n\n context.fillStyle = 'white'\n context.fillText(id, x + 20, y - 6 + BOUNCE)\n }\n\n return true /* need animation */\n}\n"],"mappings":";;;;;;AAAA,SAASA,MAAMA,CAACC,KAAK,EAAE;EACrB,MAAMC,QAAQ,GAAG,CAAC,CAAC,GAAGD,KAAK,IAAI,GAAG;EAClC,MAAME,KAAK,GAAGD,QAAQ,GAAG,EAAE;EAC3B,MAAMF,MAAM,GAAGE,QAAQ,GAAG,EAAE,EAAC;;EAE7B,OAAOF,MAAM,GAAG,CAAC,GAAGA,MAAM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ule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = dataSpreadDecorator;
|
|
7
|
-
const degreesInRadians225 = 210 * Math.PI / 180;
|
|
8
|
-
const degreesInRadians135 = 150 * Math.PI / 180;
|
|
9
|
-
function drawArrow(context, p0, p1, headLength = 10) {
|
|
10
|
-
// constants (could be declared as globals outside this function)
|
|
11
|
-
// calc the angle of the line
|
|
12
|
-
var dx = p1.x - p0.x;
|
|
13
|
-
var dy = p1.y - p0.y;
|
|
14
|
-
var angle = Math.atan2(dy, dx);
|
|
15
|
-
|
|
16
|
-
// calc arrowhead points
|
|
17
|
-
var x225 = p1.x + headLength * Math.cos(angle + degreesInRadians225);
|
|
18
|
-
var y225 = p1.y + headLength * Math.sin(angle + degreesInRadians225);
|
|
19
|
-
var x135 = p1.x + headLength * Math.cos(angle + degreesInRadians135);
|
|
20
|
-
var y135 = p1.y + headLength * Math.sin(angle + degreesInRadians135);
|
|
21
|
-
|
|
22
|
-
// draw line plus arrowhead
|
|
23
|
-
context.beginPath();
|
|
24
|
-
// draw the line from p0 to p1
|
|
25
|
-
context.moveTo(p0.x, p0.y);
|
|
26
|
-
context.lineTo(p1.x, p1.y);
|
|
27
|
-
// draw partial arrowhead at 225 degrees
|
|
28
|
-
context.moveTo(p1.x, p1.y);
|
|
29
|
-
context.lineTo(x225, y225);
|
|
30
|
-
// draw partial arrowhead at 135 degrees
|
|
31
|
-
context.moveTo(p1.x, p1.y);
|
|
32
|
-
context.lineTo(x135, y135);
|
|
33
|
-
// stroke the line and arrowhead
|
|
34
|
-
context.stroke();
|
|
35
|
-
}
|
|
36
|
-
function dataSpreadDecorator(component, context, delta /* 1 to 0 */) {
|
|
37
|
-
if (!component.app.isEditMode) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
var rendered = false;
|
|
41
|
-
|
|
42
|
-
// context.lineWidth = 2
|
|
43
|
-
// context.strokeStyle = 'orange'
|
|
44
|
-
|
|
45
|
-
// TODO To draw to-this Arrow
|
|
46
|
-
|
|
47
|
-
component.mappings && component.mappings.forEach(mapping => {
|
|
48
|
-
const root = component.root;
|
|
49
|
-
let tos = root.findAll(mapping.target, component);
|
|
50
|
-
if (tos) {
|
|
51
|
-
context.lineWidth = 2;
|
|
52
|
-
tos.forEach(to => {
|
|
53
|
-
let _from = component.center;
|
|
54
|
-
let _to = to.center;
|
|
55
|
-
_from = component.transcoordS2C(_from.x, _from.y, component.rootModel);
|
|
56
|
-
_to = to.transcoordS2C(_to.x, _to.y, to.rootModel);
|
|
57
|
-
context.beginPath();
|
|
58
|
-
const gradient = context.createLinearGradient(_from.x, _from.y, _to.x, _to.y);
|
|
59
|
-
['#FFA50033', '#FFA500'].forEach((color, idx) => gradient.addColorStop(idx, color));
|
|
60
|
-
context.strokeStyle = gradient;
|
|
61
|
-
context.fillStyle = gradient;
|
|
62
|
-
drawArrow(context, _from, _to);
|
|
63
|
-
rendered = true;
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
return rendered;
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=data-spread-decorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-spread-decorator.js","names":["degreesInRadians225","Math","PI","degreesInRadians135","drawArrow","context","p0","p1","headLength","dx","x","dy","y","angle","atan2","x225","cos","y225","sin","x135","y135","beginPath","moveTo","lineTo","stroke","dataSpreadDecorator","component","delta","app","isEditMode","rendered","mappings","forEach","mapping","root","tos","findAll","target","lineWidth","to","_from","center","_to","transcoordS2C","rootModel","gradient","createLinearGradient","color","idx","addColorStop","strokeStyle","fillStyle"],"sources":["../../src/decorator/data-spread-decorator.js"],"sourcesContent":["const degreesInRadians225 = (210 * Math.PI) / 180\nconst degreesInRadians135 = (150 * Math.PI) / 180\n\nfunction drawArrow(context, p0, p1, headLength = 10) {\n // constants (could be declared as globals outside this function)\n // calc the angle of the line\n var dx = p1.x - p0.x\n var dy = p1.y - p0.y\n var angle = Math.atan2(dy, dx)\n\n // calc arrowhead points\n var x225 = p1.x + headLength * Math.cos(angle + degreesInRadians225)\n var y225 = p1.y + headLength * Math.sin(angle + degreesInRadians225)\n var x135 = p1.x + headLength * Math.cos(angle + degreesInRadians135)\n var y135 = p1.y + headLength * Math.sin(angle + degreesInRadians135)\n\n // draw line plus arrowhead\n context.beginPath()\n // draw the line from p0 to p1\n context.moveTo(p0.x, p0.y)\n context.lineTo(p1.x, p1.y)\n // draw partial arrowhead at 225 degrees\n context.moveTo(p1.x, p1.y)\n context.lineTo(x225, y225)\n // draw partial arrowhead at 135 degrees\n context.moveTo(p1.x, p1.y)\n context.lineTo(x135, y135)\n // stroke the line and arrowhead\n context.stroke()\n}\n\nexport default function dataSpreadDecorator(component, context, delta /* 1 to 0 */) {\n if (!component.app.isEditMode) {\n return\n }\n\n var rendered = false\n\n // context.lineWidth = 2\n // context.strokeStyle = 'orange'\n\n // TODO To draw to-this Arrow\n\n component.mappings &&\n component.mappings.forEach(mapping => {\n const root = component.root\n let tos = root.findAll(mapping.target, component)\n\n if (tos) {\n context.lineWidth = 2\n\n tos.forEach(to => {\n let _from = component.center\n let _to = to.center\n\n _from = component.transcoordS2C(_from.x, _from.y, component.rootModel)\n _to = to.transcoordS2C(_to.x, _to.y, to.rootModel)\n\n context.beginPath()\n\n const gradient = context.createLinearGradient(_from.x, _from.y, _to.x, _to.y)\n ;['#FFA50033', '#FFA500'].forEach((color, idx) => gradient.addColorStop(idx, color))\n\n context.strokeStyle = gradient\n context.fillStyle = gradient\n\n drawArrow(context, _from, _to)\n rendered = true\n })\n }\n })\n\n return rendered\n}\n"],"mappings":";;;;;;AAAA,MAAMA,mBAAmB,GAAI,GAAG,GAAGC,IAAI,CAACC,EAAE,GAAI,GAAG;AACjD,MAAMC,mBAAmB,GAAI,GAAG,GAAGF,IAAI,CAACC,EAAE,GAAI,GAAG;AAEjD,SAASE,SAASA,CAACC,OAAO,EAAEC,EAAE,EAAEC,EAAE,EAAEC,UAA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AAQ,CAACI,YAAY,CAACD,GAAG,EAAED,KAAK,CAAC,CAAC;QAEpF1C,OAAO,CAAC6C,WAAW,GAAGL,QAAQ;QAC9BxC,OAAO,CAAC8C,SAAS,GAAGN,QAAQ;QAE5BzC,SAAS,CAACC,OAAO,EAAEmC,KAAK,EAAEE,GAAG,CAAC;QAC9BZ,QAAQ,GAAG,IAAI;MACjB,CAAC,CAAC;IACJ;EACF,CAAC,CAAC;EAEJ,OAAOA,QAAQ;AACjB","ignoreList":[]}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = decoTagDecorator;
|
|
7
|
-
function decoTagDecorator(component, context, delta /* 1 to 0 */) {
|
|
8
|
-
const decotag = component.decotag;
|
|
9
|
-
if (decotag) {
|
|
10
|
-
let {
|
|
11
|
-
left,
|
|
12
|
-
top
|
|
13
|
-
} = component.bounds;
|
|
14
|
-
let {
|
|
15
|
-
x,
|
|
16
|
-
y
|
|
17
|
-
} = component.transcoordS2C(left, top, component.rootModel);
|
|
18
|
-
x = Math.max(x + 3, 5);
|
|
19
|
-
y = Math.max(y - 8, 15);
|
|
20
|
-
context.font = '12px Arial';
|
|
21
|
-
let metrics = context.measureText(decotag);
|
|
22
|
-
context.beginPath();
|
|
23
|
-
context.fillStyle = '#FF0000';
|
|
24
|
-
context.roundRect(x - metrics.actualBoundingBoxLeft - 3, y - metrics.actualBoundingBoxAscent - 3, metrics.actualBoundingBoxLeft + metrics.actualBoundingBoxRight + 3 * 2, metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent + 3 * 2, 3 /* round */);
|
|
25
|
-
context.fill();
|
|
26
|
-
context.beginPath();
|
|
27
|
-
context.fillStyle = 'white';
|
|
28
|
-
context.fillText(decotag, x, y);
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=decotag-decorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decotag-decorator.js","names":["decoTagDecorator","component","context","delta","decotag","left","top","bounds","x","y","transcoordS2C","rootModel","Math","max","font","metrics","measureText","beginPath","fillStyle","roundRect","actualBoundingBoxLeft","actualBoundingBoxAscent","actualBoundingBoxRight","actualBoundingBoxDescent","fill","fillText"],"sources":["../../src/decorator/decotag-decorator.js"],"sourcesContent":["export default function decoTagDecorator(component, context, delta /* 1 to 0 */) {\n const decotag = component.decotag\n\n if (decotag) {\n let { left, top } = component.bounds\n let { x, y } = component.transcoordS2C(left, top, component.rootModel)\n\n x = Math.max(x + 3, 5)\n y = Math.max(y - 8, 15)\n\n context.font = '12px Arial'\n let metrics = context.measureText(decotag)\n\n context.beginPath()\n\n context.fillStyle = '#FF0000'\n\n context.roundRect(\n x - metrics.actualBoundingBoxLeft - 3,\n y - metrics.actualBoundingBoxAscent - 3,\n metrics.actualBoundingBoxLeft + metrics.actualBoundingBoxRight + 3 * 2,\n metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent + 3 * 2,\n 3 /* round */\n )\n\n context.fill()\n\n context.beginPath()\n\n context.fillStyle = 'white'\n context.fillText(decotag, x, y)\n\n return true\n }\n\n return false\n}\n"],"mappings":";;;;;;AAAe,SAASA,gBAAgBA,CAACC,SAAS,EAAEC,OAAO,EAAEC,KAAK,CAAC,cAAc;EAC/E,MAAMC,OAAO,GAAGH,SAAS,CAACG,OAAO;EAEjC,IAAIA,OAAO,EAAE;IACX,IAAI;MAAEC,IAAI;MAAEC;IAAI,CAAC,GAAGL,SAAS,CAACM,MAAM;IACpC,IAAI;MAAEC,CAAC;MAAEC;IAAE,CAAC,GAAGR,SAAS,CAACS,aAAa,CAACL,IAAI,EAAEC,GAAG,EAAEL,SAAS,CAACU,SAAS,CAAC;IAEtEH,CAAC,GAAGI,IAAI,CAACC,GAAG,CAACL,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACtBC,CAAC,GAAGG,IAAI,CAACC,GAAG,CAACJ,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;IAEvBP,OAAO,CAACY,IAAI,GAAG,YAAY;IAC3B,IAAIC,OAAO,GAAGb,OAAO,CAACc,WAAW,CAACZ,OAAO,CAAC;IAE1CF,OAAO,CAACe,SAAS,CAAC,CAAC;IAEnBf,OAAO,CAACgB,SAAS,GAAG,SAAS;IAE7BhB,OAAO,CAACiB,SAAS,CACfX,CAAC,GAAGO,OAAO,CAACK,qBAAqB,GAAG,CAAC,EACrCX,CAAC,GAAGM,OAAO,CAACM,uBAAuB,GAAG,CAAC,EACvCN,OAAO,CAACK,qBAAqB,GAAGL,OAAO,CAACO,sBAAsB,GAAG,CAAC,GAAG,CAAC,EACtEP,OAAO,CAACM,uBAAuB,GAAGN,OAAO,CAACQ,wBAAwB,GAAG,CAAC,GAAG,CAAC,EAC1E,CAAC,CAAC,WACJ,CAAC;IAEDrB,OAAO,CAACsB,IAAI,CAAC,CAAC;IAEdtB,OAAO,CAACe,SAAS,CAAC,CAAC;IAEnBf,OAAO,CAACgB,SAAS,GAAG,OAAO;IAC3BhB,OAAO,CAACuB,QAAQ,CAACrB,OAAO,EAAEI,CAAC,EAAEC,CAAC,CAAC;IAE/B,OAAO,IAAI;EACb;EAEA,OAAO,KAAK;AACd","ignoreList":[]}
|
package/dist/decorator/index.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getDecorator = getDecorator;
|
|
7
|
-
exports.registerDecorator = registerDecorator;
|
|
8
|
-
var _dataSpreadDecorator = _interopRequireDefault(require("./data-spread-decorator.js"));
|
|
9
|
-
var _bouncingArrowDecorator = _interopRequireDefault(require("./bouncing-arrow-decorator.js"));
|
|
10
|
-
var _decotagDecorator = _interopRequireDefault(require("./decotag-decorator.js"));
|
|
11
|
-
var _anchorsDecorator = _interopRequireDefault(require("./anchors-decorator.js"));
|
|
12
|
-
var _linkDecorator = _interopRequireDefault(require("./link-decorator.js"));
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
/*
|
|
15
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
var registry = {
|
|
19
|
-
'data-spread': _dataSpreadDecorator.default,
|
|
20
|
-
'bouncing-arrow': _bouncingArrowDecorator.default,
|
|
21
|
-
decotag: _decotagDecorator.default,
|
|
22
|
-
anchors: _anchorsDecorator.default,
|
|
23
|
-
link: _linkDecorator.default
|
|
24
|
-
};
|
|
25
|
-
function registerDecorator(name, decorator) {
|
|
26
|
-
registry[name] = decorator;
|
|
27
|
-
}
|
|
28
|
-
function getDecorator(name) {
|
|
29
|
-
return registry[name];
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_dataSpreadDecorator","_interopRequireDefault","require","_bouncingArrowDecorator","_decotagDecorator","_anchorsDecorator","_linkDecorator","e","__esModule","default","registry","dataSpread","bouncingArrow","decotag","anchors","link","registerDecorator","name","decorator","getDecorator"],"sources":["../../src/decorator/index.js"],"sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport dataSpread from './data-spread-decorator.js'\nimport bouncingArrow from './bouncing-arrow-decorator.js'\nimport decotag from './decotag-decorator.js'\nimport anchors from './anchors-decorator.js'\nimport link from './link-decorator.js'\n\nvar registry = {\n 'data-spread': dataSpread,\n 'bouncing-arrow': bouncingArrow,\n decotag,\n anchors,\n link\n}\n\nexport function registerDecorator(name, decorator) {\n registry[name] = decorator\n}\n\nexport function getDecorator(name) {\n return registry[name]\n}\n"],"mappings":";;;;;;;AAIA,IAAAA,oBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,iBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,cAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAsC,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AARtC;AACA;AACA;;AAQA,IAAIG,QAAQ,GAAG;EACb,aAAa,EAAEC,4BAAU;EACzB,gBAAgB,EAAEC,+BAAa;EAC/BC,OAAO,EAAPA,yBAAO;EACPC,OAAO,EAAPA,yBAAO;EACPC,IAAI,EAAJA;AACF,CAAC;AAEM,SAASC,iBAAiBA,CAACC,IAAI,EAAEC,SAAS,EAAE;EACjDR,QAAQ,CAACO,IAAI,CAAC,GAAGC,SAAS;AAC5B;AAEO,SAASC,YAAYA,CAACF,IAAI,EAAE;EACjC,OAAOP,QAAQ,CAACO,IAAI,CAAC;AACvB","ignoreList":[]}
|