@widgetic/editor 3.11.4 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +245 -0
- package/dist/assets/fonts.json +331 -0
- package/dist/assets/icons/ic-browser/audio.svg +7 -0
- package/dist/assets/icons/ic-browser/document.svg +11 -0
- package/dist/assets/icons/ic-browser/error.svg +5 -0
- package/dist/assets/icons/ic-browser/folder.svg +28 -0
- package/dist/assets/icons/ic-browser/player-pause.svg +1 -0
- package/dist/assets/icons/ic-browser/player-play.svg +1 -0
- package/dist/assets/icons/ic-browser/trash.svg +1 -0
- package/dist/assets/icons/ic-fixed-position/background-deselected.svg +3 -0
- package/dist/assets/icons/ic-fixed-position/background-selected.svg +3 -0
- package/dist/assets/icons/ic-fixed-position/bottom-left-background-deselected.svg +3 -0
- package/dist/assets/icons/ic-fixed-position/bottom-left-background-selected.svg +3 -0
- package/dist/assets/icons/ic-fixed-position/bottom-left-icon.svg +4 -0
- package/dist/assets/icons/ic-fixed-position/bottom-right-background-deselected.svg +3 -0
- package/dist/assets/icons/ic-fixed-position/bottom-right-background-selected.svg +3 -0
- package/dist/assets/icons/ic-fixed-position/bottom-right-icon.svg +4 -0
- package/dist/assets/icons/ic-fixed-position/center-bottom-icon.svg +5 -0
- package/dist/assets/icons/ic-fixed-position/center-center-icon.svg +3 -0
- package/dist/assets/icons/ic-fixed-position/center-left-icon.svg +5 -0
- package/dist/assets/icons/ic-fixed-position/center-right-icon.svg +5 -0
- package/dist/assets/icons/ic-fixed-position/center-top-icon.svg +5 -0
- package/dist/assets/icons/ic-fixed-position/top-left-background-deselected.svg +3 -0
- package/dist/assets/icons/ic-fixed-position/top-left-background-selected.svg +3 -0
- package/dist/assets/icons/ic-fixed-position/top-left-icon.svg +4 -0
- package/dist/assets/icons/ic-fixed-position/top-right-background-deselected.svg +3 -0
- package/dist/assets/icons/ic-fixed-position/top-right-background-selected.svg +3 -0
- package/dist/assets/icons/ic-fixed-position/top-right-icon.svg +4 -0
- package/dist/assets/icons/trash.svg +1 -0
- package/dist/components/MockWidget.svelte +108 -0
- package/dist/components/MockWidget.svelte.d.ts +22 -0
- package/dist/components/WidgetPreview.svelte +852 -0
- package/dist/components/WidgetPreview.svelte.d.ts +100 -0
- package/dist/components/color-select/ColorSelect.svelte +258 -0
- package/dist/components/color-select/ColorSelect.svelte.d.ts +42 -0
- package/dist/components/color-select/color.d.ts +25 -0
- package/dist/components/color-select/color.js +21 -0
- package/dist/components/color-select/constants.d.ts +5 -0
- package/dist/components/color-select/constants.js +5 -0
- package/dist/components/color-select/render.d.ts +5 -0
- package/dist/components/color-select/render.js +77 -0
- package/dist/components/color-select/shaders.d.ts +3 -0
- package/dist/components/color-select/shaders.js +8 -0
- package/dist/components/editors/EmbedEditor.svelte +700 -0
- package/dist/components/editors/EmbedEditor.svelte.d.ts +50 -0
- package/dist/components/editors/PropsEditor.svelte +4009 -0
- package/dist/components/editors/PropsEditor.svelte.d.ts +62 -0
- package/dist/components/editors/props-editor.css +73 -0
- package/dist/components/ic/AngleInputController.svelte +276 -0
- package/dist/components/ic/AngleInputController.svelte.d.ts +26 -0
- package/dist/components/ic/BrowserInputController.svelte +731 -0
- package/dist/components/ic/BrowserInputController.svelte.d.ts +39 -0
- package/dist/components/ic/CheckboxInputController.svelte +203 -0
- package/dist/components/ic/CheckboxInputController.svelte.d.ts +41 -0
- package/dist/components/ic/ColorPickerInputController.svelte +1584 -0
- package/dist/components/ic/ColorPickerInputController.svelte.d.ts +50 -0
- package/dist/components/ic/DateFieldInputController.svelte +453 -0
- package/dist/components/ic/DateFieldInputController.svelte.d.ts +35 -0
- package/dist/components/ic/DatePickerInputController.svelte +364 -0
- package/dist/components/ic/DatePickerInputController.svelte.d.ts +28 -0
- package/dist/components/ic/DropdownInputController.svelte +226 -0
- package/dist/components/ic/DropdownInputController.svelte.d.ts +43 -0
- package/dist/components/ic/FixedPositionInputController.svelte +353 -0
- package/dist/components/ic/FixedPositionInputController.svelte.d.ts +23 -0
- package/dist/components/ic/FontInputController.svelte +2098 -0
- package/dist/components/ic/FontInputController.svelte.d.ts +47 -0
- package/dist/components/ic/InputControllerHeader.svelte +147 -0
- package/dist/components/ic/InputControllerHeader.svelte.d.ts +23 -0
- package/dist/components/ic/NumberControls.svelte +299 -0
- package/dist/components/ic/NumberControls.svelte.d.ts +30 -0
- package/dist/components/ic/NumberInputController.svelte +397 -0
- package/dist/components/ic/NumberInputController.svelte.d.ts +30 -0
- package/dist/components/ic/PositionInputController.svelte +252 -0
- package/dist/components/ic/PositionInputController.svelte.d.ts +37 -0
- package/dist/components/ic/RadioGroupInputController.svelte +162 -0
- package/dist/components/ic/RadioGroupInputController.svelte.d.ts +38 -0
- package/dist/components/ic/RangeCalendarInputController.svelte +262 -0
- package/dist/components/ic/RangeCalendarInputController.svelte.d.ts +32 -0
- package/dist/components/ic/RoundedCornersInputController.svelte +469 -0
- package/dist/components/ic/RoundedCornersInputController.svelte.d.ts +37 -0
- package/dist/components/ic/SliderInputController.svelte +411 -0
- package/dist/components/ic/SliderInputController.svelte.d.ts +46 -0
- package/dist/components/ic/SliderRangeInputController.svelte +155 -0
- package/dist/components/ic/SliderRangeInputController.svelte.d.ts +33 -0
- package/dist/components/ic/SwitchInputController.svelte +107 -0
- package/dist/components/ic/SwitchInputController.svelte.d.ts +24 -0
- package/dist/components/ic/TagsInputController.svelte +125 -0
- package/dist/components/ic/TagsInputController.svelte.d.ts +27 -0
- package/dist/components/ic/TextAreaInputController.svelte +1932 -0
- package/dist/components/ic/TextAreaInputController.svelte.d.ts +14 -0
- package/dist/components/ic/TextAreaPreviewInputController.svelte +478 -0
- package/dist/components/ic/TextAreaPreviewInputController.svelte.d.ts +28 -0
- package/dist/components/ic/TextInputController.svelte +70 -0
- package/dist/components/ic/TextInputController.svelte.d.ts +30 -0
- package/dist/components/ic/TimeInputController.svelte +434 -0
- package/dist/components/ic/TimeInputController.svelte.d.ts +25 -0
- package/dist/components/ic/VectorInputController.svelte +1826 -0
- package/dist/components/ic/VectorInputController.svelte.d.ts +47 -0
- package/dist/components/ic/index.d.ts +39 -0
- package/dist/components/ic/index.js +24 -0
- package/dist/components/ic/shared/CategoryTabs.svelte +40 -0
- package/dist/components/ic/shared/CategoryTabs.svelte.d.ts +25 -0
- package/dist/components/ic/shared/ItemGrid.svelte +181 -0
- package/dist/components/ic/shared/ItemGrid.svelte.d.ts +35 -0
- package/dist/components/ic/shared/RecentItemsSection.svelte +260 -0
- package/dist/components/ic/shared/RecentItemsSection.svelte.d.ts +35 -0
- package/dist/components/ic/shared/index.d.ts +8 -0
- package/dist/components/ic/shared/index.js +9 -0
- package/dist/components/icons/addnew.svelte +21 -0
- package/dist/components/icons/addnew.svelte.d.ts +20 -0
- package/dist/components/icons/drag.svelte +29 -0
- package/dist/components/icons/drag.svelte.d.ts +20 -0
- package/dist/components/icons/drag.svg +1 -0
- package/dist/components/icons/locked.svelte +4 -0
- package/dist/components/icons/locked.svelte.d.ts +26 -0
- package/dist/components/icons/locked.svg +4 -0
- package/dist/components/icons/ok.svelte +20 -0
- package/dist/components/icons/ok.svelte.d.ts +20 -0
- package/dist/components/icons/ok.svg +11 -0
- package/dist/components/icons/unlocked.svelte +4 -0
- package/dist/components/icons/unlocked.svelte.d.ts +26 -0
- package/dist/components/icons/unlocked.svg +4 -0
- package/dist/components/icons/x.svelte +14 -0
- package/dist/components/icons/x.svelte.d.ts +20 -0
- package/dist/components/icons/x.svg +5 -0
- package/dist/components/ui/arrows/OpacitySliderArrows.svelte +43 -0
- package/dist/components/ui/arrows/OpacitySliderArrows.svelte.d.ts +23 -0
- package/dist/components/ui/checkerboard-background/CheckerboardBackground.svelte +15 -0
- package/dist/components/ui/checkerboard-background/CheckerboardBackground.svelte.d.ts +20 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.js +31 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +9 -0
- package/dist/stores/userSession.d.ts +7 -0
- package/dist/stores/userSession.js +28 -0
- package/dist/utils/FontManager.d.ts +278 -0
- package/dist/utils/FontManager.js +1302 -0
- package/dist/utils/MediaManager.d.ts +35 -0
- package/dist/utils/MediaManager.js +59 -0
- package/dist/utils/VectorManager.d.ts +190 -0
- package/dist/utils/VectorManager.js +754 -0
- package/dist/utils/colorAutocomplete.d.ts +10 -0
- package/dist/utils/colorAutocomplete.js +28 -0
- package/dist/utils/colorNames.d.ts +3 -0
- package/dist/utils/colorNames.js +152 -0
- package/dist/utils/colorTransparency.d.ts +52 -0
- package/dist/utils/colorTransparency.js +114 -0
- package/dist/utils/fontUtils.d.ts +34 -0
- package/dist/utils/fontUtils.js +132 -0
- package/dist/utils/passiveEvents.js +20 -0
- package/dist/utils/recentColors.d.ts +10 -0
- package/dist/utils/recentColors.js +63 -0
- package/dist/utils/skipFonts.d.ts +3 -0
- package/dist/utils/skipFonts.js +49 -0
- package/dist/utils/vectorUtils.d.ts +34 -0
- package/dist/utils/vectorUtils.js +71 -0
- package/dist/utils.d.ts +11 -0
- package/dist/utils.js +38 -0
- package/package.json +134 -74
- package/.babelrc +0 -10
- package/.bowerrc +0 -4
- package/.nvmrc +0 -1
- package/Gruntfile.coffee +0 -69
- package/bower.json +0 -28
- package/css/browser/entries/activateable.styl +0 -29
- package/css/browser/entries/audio.styl +0 -39
- package/css/browser/entries/folder.styl +0 -79
- package/css/browser/entries/image.styl +0 -26
- package/css/browser/entries/index.styl +0 -66
- package/css/browser/entries/rss.styl +0 -11
- package/css/browser/entries/video.styl +0 -11
- package/css/browser/index.styl +0 -86
- package/css/browser/intent/index.styl +0 -61
- package/css/browser/nav/index.styl +0 -73
- package/css/browser/social-browser.styl +0 -23
- package/css/controls/clock.styl +0 -110
- package/css/controls/config.styl +0 -6
- package/css/controls/control-audio-details.styl +0 -63
- package/css/controls/control-audio.styl +0 -28
- package/css/controls/control-browser.styl +0 -48
- package/css/controls/control-color.styl +0 -423
- package/css/controls/control-date_time.styl +0 -191
- package/css/controls/control-dropdown.styl +0 -79
- package/css/controls/control-font.styl +0 -147
- package/css/controls/control-image-details.styl +0 -35
- package/css/controls/control-image.styl +0 -43
- package/css/controls/control-order-picker.styl +0 -29
- package/css/controls/control-position.styl +0 -390
- package/css/controls/control-range.styl +0 -68
- package/css/controls/control-scale.styl +0 -30
- package/css/controls/control-slider.styl +0 -38
- package/css/controls/control-spinner.styl +0 -39
- package/css/controls/control-textarea.styl +0 -52
- package/css/controls/control-toggle.styl +0 -34
- package/css/controls/control-url.styl +0 -32
- package/css/controls/control-video-details.styl +0 -85
- package/css/controls/control-video.styl +0 -43
- package/css/controls/general.styl +0 -98
- package/css/controls/index.styl +0 -25
- package/css/editor/colors.styl +0 -7
- package/css/editor/content/directinput.styl +0 -47
- package/css/editor/content/index.styl +0 -111
- package/css/editor/content/message.styl +0 -53
- package/css/editor/content/tabs.styl +0 -75
- package/css/editor/copied-from-old-style.styl +0 -197
- package/css/editor/details/bulk-editor.styl +0 -104
- package/css/editor/details/index.styl +0 -21
- package/css/editor/details/item.styl +0 -153
- package/css/editor/embed.styl +0 -106
- package/css/editor/footer.styl +0 -180
- package/css/editor/full-editor.styl +0 -16
- package/css/editor/index.styl +0 -124
- package/css/editor/login-popup.styl +0 -13
- package/css/editor/preview.styl +0 -257
- package/css/editor/skin/editor/index.styl +0 -54
- package/css/editor/skin/editor/tabs.styl +0 -111
- package/css/editor/skin/index.styl +0 -138
- package/css/editor/skin/popup.styl +0 -152
- package/css/editor/skin/presets/dropdown.styl +0 -61
- package/css/editor/skin/presets/index.styl +0 -86
- package/css/editor/skin/presets/list.styl +0 -244
- package/css/editor/tooltips.styl +0 -85
- package/css/fonts.styl +0 -47
- package/css/icons/BlogvioEditor.dev.svg +0 -112
- package/css/icons.styl +0 -16
- package/css/img/arrow-right-rounded-v-small.png +0 -0
- package/css/img/browser-folder-separator.png +0 -0
- package/css/img/calendar-input-icons.png +0 -0
- package/css/img/check.png +0 -0
- package/css/img/close.png +0 -0
- package/css/img/composition/edit-icon.png +0 -0
- package/css/img/content/audio-icon.png +0 -0
- package/css/img/content/folder-icon.png +0 -0
- package/css/img/content/messages/error-background.png +0 -0
- package/css/img/content/messages/error-icon.png +0 -0
- package/css/img/content/messages/notification-background.png +0 -0
- package/css/img/content/messages/notification-icon.png +0 -0
- package/css/img/content/no-files-audio.png +0 -0
- package/css/img/content/no-files-image.png +0 -0
- package/css/img/content/no-files-video.png +0 -0
- package/css/img/content/no-files.png +0 -0
- package/css/img/content/rss-icon.png +0 -0
- package/css/img/content/selected.png +0 -0
- package/css/img/content/video-icon.png +0 -0
- package/css/img/content/with-control-text.png +0 -0
- package/css/img/control-dropdown-arrow.png +0 -0
- package/css/img/control-image-valid.png +0 -0
- package/css/img/control-position-icon.png +0 -0
- package/css/img/control-scale-lock-icon.png +0 -0
- package/css/img/control-slider-arrows-hover.png +0 -0
- package/css/img/control-slider-arrows.png +0 -0
- package/css/img/control-spinner-buttons-hover.png +0 -0
- package/css/img/control-spinner-buttons.png +0 -0
- package/css/img/control-textarea-bold-active.png +0 -0
- package/css/img/control-textarea-bold.png +0 -0
- package/css/img/control-textarea-italic-active.png +0 -0
- package/css/img/control-textarea-italic.png +0 -0
- package/css/img/control-textarea-underline-active.png +0 -0
- package/css/img/control-textarea-underline.png +0 -0
- package/css/img/custom-checkbox-sprite.png +0 -0
- package/css/img/details/item-collapse-icon.png +0 -0
- package/css/img/details/item-expand-icon.png +0 -0
- package/css/img/details/item-sort-icon.png +0 -0
- package/css/img/done-arrow.png +0 -0
- package/css/img/fb-logo-icon-w.png +0 -0
- package/css/img/grid-icons.png +0 -0
- package/css/img/icon-reference.png +0 -0
- package/css/img/indicator.png +0 -0
- package/css/img/loader.gif +0 -0
- package/css/img/loaders/audio-white.png +0 -0
- package/css/img/loaders/audio.png +0 -0
- package/css/img/loaders/photo-white.png +0 -0
- package/css/img/loaders/photo.png +0 -0
- package/css/img/loaders/util-white.png +0 -0
- package/css/img/loaders/util.png +0 -0
- package/css/img/loaders/video-white.png +0 -0
- package/css/img/loaders/video.png +0 -0
- package/css/img/maximize.png +0 -0
- package/css/img/minimize.png +0 -0
- package/css/img/next-btn.png +0 -0
- package/css/img/search-icon-sprite.png +0 -0
- package/css/img/services/blogvio.png +0 -0
- package/css/img/services/drive.png +0 -0
- package/css/img/services/dropbox-login.png +0 -0
- package/css/img/services/dropbox.png +0 -0
- package/css/img/services/facebook-login.png +0 -0
- package/css/img/services/facebook.png +0 -0
- package/css/img/services/flickr-login.png +0 -0
- package/css/img/services/flickr.png +0 -0
- package/css/img/services/instagram-login.png +0 -0
- package/css/img/services/instagram.png +0 -0
- package/css/img/services/text.png +0 -0
- package/css/img/services/uploads.png +0 -0
- package/css/img/services/uploads.svg +0 -689
- package/css/img/services/webaddress-bw.png +0 -0
- package/css/img/services/webaddress.png +0 -0
- package/css/img/services/webadress.png +0 -0
- package/css/img/services/websearch.png +0 -0
- package/css/img/services/wix.png +0 -0
- package/css/img/skin/item-active-indicator.png +0 -0
- package/css/img/skin/item-hover-icon.png +0 -0
- package/css/img/skin/overwrite.png +0 -0
- package/css/img/skin/popup-name-icon.png +0 -0
- package/css/img/skin/popup-save.png +0 -0
- package/css/img/skin/preset.png +0 -0
- package/css/img/skin/presets-arrow-purple.png +0 -0
- package/css/img/tw-icon-w.png +0 -0
- package/css/img/warning.png +0 -0
- package/css/img/white-rounded-check.png +0 -0
- package/css/index.styl +0 -9
- package/css/mixins.styl +0 -62
- package/css/scrollable.styl +0 -101
- package/karma.conf.js +0 -73
- package/lib/control.js +0 -1
- package/lib/controls.js +0 -1
- package/lib/core.editor.js +0 -4
- package/lib/core.js +0 -1
- package/lib/core.vendor.js +0 -3
- package/lib/dev/control.js +0 -845
- package/lib/dev/controls.js +0 -7774
- package/lib/dev/core.editor.js +0 -6439
- package/lib/dev/core.js +0 -1486
- package/lib/dev/core.vendor.js +0 -10708
- package/lib/dev/editor.css +0 -166
- package/lib/dev/editor.js +0 -29710
- package/lib/dev/editor.vendor.js +0 -15119
- package/lib/dev/jquery.nanoscroller.js.map +0 -10
- package/lib/editor.css +0 -167
- package/lib/editor.js +0 -49
- package/lib/editor.vendor.js +0 -11
- package/src/api/index.coffee +0 -23
- package/src/api/mixin.coffee +0 -89
- package/src/browser/controller/entry/audio.coffee +0 -38
- package/src/browser/controller/entry/button.coffee +0 -16
- package/src/browser/controller/entry/file.coffee +0 -35
- package/src/browser/controller/entry/folder.coffee +0 -14
- package/src/browser/controller/entry/image.coffee +0 -24
- package/src/browser/controller/entry/index.coffee +0 -18
- package/src/browser/controller/entry/rss.coffee +0 -5
- package/src/browser/controller/entry/video.coffee +0 -4
- package/src/browser/controller/index.coffee +0 -289
- package/src/browser/controller/instagram.coffee +0 -129
- package/src/browser/controller/navbar.coffee +0 -48
- package/src/browser/controller/social.coffee +0 -213
- package/src/browser/model/entry.coffee +0 -18
- package/src/browser/model/index.coffee +0 -34
- package/src/core/controller/font-loader.coffee +0 -65
- package/src/core/controller/lazyload.coffee +0 -14
- package/src/core/controller/overlay.coffee +0 -146
- package/src/core/controller/popup.coffee +0 -36
- package/src/core/controller/scrollable.coffee +0 -68
- package/src/core/controls/audio.coffee +0 -56
- package/src/core/controls/browser.coffee +0 -271
- package/src/core/controls/color.coffee +0 -121
- package/src/core/controls/date-time/calendar/index.coffee +0 -99
- package/src/core/controls/date-time/calendar/months.coffee +0 -52
- package/src/core/controls/date-time/calendar/years.coffee +0 -58
- package/src/core/controls/date-time/clock.coffee +0 -62
- package/src/core/controls/date-time/helper.coffee +0 -31
- package/src/core/controls/date-time/index.coffee +0 -62
- package/src/core/controls/date-time/popup.coffee +0 -56
- package/src/core/controls/details/audio.coffee +0 -33
- package/src/core/controls/details/image.coffee +0 -19
- package/src/core/controls/details/video.coffee +0 -14
- package/src/core/controls/dropdown.coffee +0 -100
- package/src/core/controls/font/font-item.coffee +0 -22
- package/src/core/controls/font/font-list.coffee +0 -108
- package/src/core/controls/font/fonts-popup.coffee +0 -91
- package/src/core/controls/font/index.coffee +0 -66
- package/src/core/controls/image.coffee +0 -37
- package/src/core/controls/index.coffee +0 -88
- package/src/core/controls/orderPicker.coffee +0 -93
- package/src/core/controls/position/grid-panel.coffee +0 -75
- package/src/core/controls/position/index.coffee +0 -98
- package/src/core/controls/position/panel.coffee +0 -68
- package/src/core/controls/position/pixel-panel.coffee +0 -54
- package/src/core/controls/position/popup.coffee +0 -63
- package/src/core/controls/position/reference-panel.coffee +0 -26
- package/src/core/controls/range.coffee +0 -191
- package/src/core/controls/rss.coffee +0 -16
- package/src/core/controls/scale.coffee +0 -78
- package/src/core/controls/slider.coffee +0 -122
- package/src/core/controls/stepper.coffee +0 -97
- package/src/core/controls/text.coffee +0 -54
- package/src/core/controls/textarea.coffee +0 -78
- package/src/core/controls/toggle.coffee +0 -29
- package/src/core/controls/url.coffee +0 -88
- package/src/core/controls/video.coffee +0 -9
- package/src/core/embed/api.js +0 -178
- package/src/core/embed/controller.js +0 -331
- package/src/core/models/composition.coffee +0 -178
- package/src/core/models/content.coffee +0 -79
- package/src/core/models/skin.coffee +0 -91
- package/src/core/models/user.coffee +0 -6
- package/src/core/models/widget.coffee +0 -88
- package/src/core/router/index.coffee +0 -44
- package/src/core/services/container/index.js +0 -18
- package/src/core/services/container/instance.js +0 -3
- package/src/core/services/content.js +0 -80
- package/src/core/services/instagram.coffee +0 -47
- package/src/core/services/mixin/events.js +0 -17
- package/src/core/services/service.js +0 -1
- package/src/core/services/sounds.js +0 -81
- package/src/core/services/uploads.js +0 -299
- package/src/core/utils/popup.coffee +0 -67
- package/src/core/utils/should-show.coffee +0 -12
- package/src/core/views/audio-details.pug +0 -9
- package/src/core/views/audio.pug +0 -7
- package/src/core/views/browser.pug +0 -4
- package/src/core/views/color.pug +0 -8
- package/src/core/views/date-time/calendar.pug +0 -3
- package/src/core/views/date-time/clock.pug +0 -12
- package/src/core/views/date-time/grid.pug +0 -6
- package/src/core/views/date-time/input.pug +0 -4
- package/src/core/views/date-time/table.pug +0 -6
- package/src/core/views/dropdown.pug +0 -9
- package/src/core/views/font/font-item.pug +0 -3
- package/src/core/views/font/fonts-list.pug +0 -7
- package/src/core/views/font/fonts-popup.pug +0 -5
- package/src/core/views/font/index.pug +0 -7
- package/src/core/views/image-details.pug +0 -6
- package/src/core/views/image.pug +0 -5
- package/src/core/views/input-layout.pug +0 -15
- package/src/core/views/order-items.pug +0 -7
- package/src/core/views/order-picker.pug +0 -7
- package/src/core/views/pixelpanel.pug +0 -69
- package/src/core/views/position.pug +0 -10
- package/src/core/views/range.pug +0 -9
- package/src/core/views/scale.pug +0 -7
- package/src/core/views/slider.pug +0 -6
- package/src/core/views/stepper.pug +0 -6
- package/src/core/views/text.pug +0 -4
- package/src/core/views/textarea.pug +0 -8
- package/src/core/views/toggle.pug +0 -5
- package/src/core/views/video-details.pug +0 -7
- package/src/core/views/video.pug +0 -4
- package/src/core/widget/index.coffee +0 -66
- package/src/editor/content/browser/dropzone.html +0 -268
- package/src/editor/content/browser/file.html +0 -124
- package/src/editor/content/browser/scroll-pane.html +0 -32
- package/src/editor/content/browser/service.html +0 -53
- package/src/editor/content/browser/upload.coffee +0 -44
- package/src/editor/content/browser/upload.html +0 -439
- package/src/editor/content/index.coffee +0 -294
- package/src/editor/content/input/field.coffee +0 -45
- package/src/editor/content/input/index.coffee +0 -115
- package/src/editor/content/service/base/photoitem.coffee +0 -49
- package/src/editor/content/service/cache.coffee +0 -20
- package/src/editor/content/service/default.coffee +0 -59
- package/src/editor/content/service/dropbox.coffee +0 -71
- package/src/editor/content/service/facebook.coffee +0 -143
- package/src/editor/content/service/flickr.coffee +0 -85
- package/src/editor/content/service/google-drive-sdk.coffee +0 -18
- package/src/editor/content/service/google-drive.coffee +0 -144
- package/src/editor/content/service/instagram-social.coffee +0 -84
- package/src/editor/content/service/instagram.coffee +0 -168
- package/src/editor/content/service/share-popup.coffee +0 -15
- package/src/editor/content/service/soundcloud.coffee +0 -163
- package/src/editor/content/tab.coffee +0 -27
- package/src/editor/details/bulk-editor/attributes-panel.coffee +0 -11
- package/src/editor/details/bulk-editor/index.coffee +0 -86
- package/src/editor/details/index.coffee +0 -156
- package/src/editor/details/item/attributes.coffee +0 -45
- package/src/editor/details/item/index.coffee +0 -82
- package/src/editor/editor.coffee +0 -274
- package/src/editor/footer/breadcrumb.coffee +0 -17
- package/src/editor/footer/index.coffee +0 -36
- package/src/editor/index.coffee +0 -79
- package/src/editor/listeners/embed-listener.coffee +0 -143
- package/src/editor/login-popup.coffee +0 -29
- package/src/editor/notification-controller.coffee +0 -35
- package/src/editor/popup.coffee +0 -68
- package/src/editor/remote-preview.coffee +0 -68
- package/src/editor/save/index.coffee +0 -62
- package/src/editor/skin/delete.coffee +0 -33
- package/src/editor/skin/editor/index.coffee +0 -188
- package/src/editor/skin/editor/panel.coffee +0 -37
- package/src/editor/skin/index.coffee +0 -126
- package/src/editor/skin/save.coffee +0 -58
- package/src/editor/skin/selector/index.coffee +0 -59
- package/src/editor/skin/selector/item.coffee +0 -123
- package/src/editor/skin/selector/list.coffee +0 -97
- package/src/editor/views/embed.pug +0 -10
- package/src/editor/views/loginbutton.pug +0 -8
- package/src/editor/views/popup.pug +0 -17
- package/src/editor/views/presets.pug +0 -8
- package/src/editor/views/presetslist-header.pug +0 -8
- package/src/editor/views/skinitem.pug +0 -13
- package/src/modules/control.js +0 -3
- package/src/modules/controls.js +0 -29
- package/src/modules/core.js +0 -19
- package/src/modules/editor.js +0 -80
- package/test/config.js +0 -3
- package/test/core/models/skin-spec.js +0 -209
- package/webpack.config.js +0 -46
- package/webpack.config.prod.js +0 -9
- /package/{src/core/views/date-time/popup.pug → dist/utils/passiveEvents.d.ts} +0 -0
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* NumberInputController Component
|
|
4
|
+
* A specialized input controller for numeric values with increment/decrement buttons.
|
|
5
|
+
* Features:
|
|
6
|
+
* - Increment/decrement buttons with auto-repeat
|
|
7
|
+
* - Value validation and bounds checking
|
|
8
|
+
* - Support for negative numbers
|
|
9
|
+
* - Keyboard navigation and shortcuts
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// Svelte imports
|
|
13
|
+
import { onDestroy } from 'svelte';
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// Component config
|
|
17
|
+
import type { InputControllerConfig } from './index';
|
|
18
|
+
import InputControllerHeader from './InputControllerHeader.svelte';
|
|
19
|
+
import NumberControls from './NumberControls.svelte';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Component Props
|
|
23
|
+
* External properties that configure the number input's behavior
|
|
24
|
+
*/
|
|
25
|
+
export let label: string; // Display label
|
|
26
|
+
export let value: number = 0; // Current numeric value
|
|
27
|
+
export let onChange: (newValue: number) => void; // Value change callback
|
|
28
|
+
export let config: InputControllerConfig = {}; // Additional configuration
|
|
29
|
+
export let helpText: string | undefined = undefined; // Help text for the input
|
|
30
|
+
export let description: string | undefined = undefined;
|
|
31
|
+
export let onFocus: () => void = () => {}; // Focus callback
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Configuration Options
|
|
35
|
+
* Derived from config prop with fallbacks.
|
|
36
|
+
* When both min and max are unspecified, the input is unbounded (not locked).
|
|
37
|
+
*/
|
|
38
|
+
const bothBoundsUndefined = config.min === undefined && config.max === undefined;
|
|
39
|
+
$: min = config.min ?? 0;
|
|
40
|
+
$: max = bothBoundsUndefined ? Number.MAX_SAFE_INTEGER : (config.max ?? 0);
|
|
41
|
+
$: step = config.step || 1;
|
|
42
|
+
$: isLocked = !bothBoundsUndefined && min === max;
|
|
43
|
+
$: isAtMin = value <= min;
|
|
44
|
+
$: isAtMax = value >= max;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Reactive Statements
|
|
48
|
+
* Handle min/max validation and value constraints
|
|
49
|
+
*/
|
|
50
|
+
$: {
|
|
51
|
+
if (min !== undefined && max !== undefined && min > max) {
|
|
52
|
+
[min, max] = [max, min];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const minValue = min ?? 0;
|
|
56
|
+
const maxValue = max ?? Number.MAX_SAFE_INTEGER;
|
|
57
|
+
|
|
58
|
+
if (!isEditing && !bothBoundsUndefined) {
|
|
59
|
+
if (value < minValue || value > maxValue) {
|
|
60
|
+
console.log('Value out of bounds, adjusting:', {
|
|
61
|
+
value, minValue, maxValue, isEditing
|
|
62
|
+
});
|
|
63
|
+
const clampedValue = Math.max(minValue, Math.min(maxValue, value));
|
|
64
|
+
value = clampedValue;
|
|
65
|
+
if (typeof onChange === 'function') {
|
|
66
|
+
setTimeout(() => onChange(clampedValue), 0);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Step Validation
|
|
74
|
+
* Ensures step value is always positive
|
|
75
|
+
*/
|
|
76
|
+
$: {
|
|
77
|
+
if (step < 0) {
|
|
78
|
+
console.warn('Step value should be positive. Converting negative step to positive.');
|
|
79
|
+
step = Math.abs(step);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Internal State
|
|
85
|
+
* Manages component behavior and auto-repeat functionality
|
|
86
|
+
*/
|
|
87
|
+
let autoRepeatTimer: ReturnType<typeof setTimeout> | undefined;
|
|
88
|
+
let autoRepeatInterval: ReturnType<typeof setInterval> | undefined;
|
|
89
|
+
let isPressed = false;
|
|
90
|
+
let isEditing = false; // Tracks if user is currently editing the input
|
|
91
|
+
let disabledOpacity = 60;
|
|
92
|
+
const HOLD_DELAY = 400;
|
|
93
|
+
const REPEAT_INTERVAL = 80;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Value Change Handler
|
|
97
|
+
* Processes increment/decrement operations with bounds checking
|
|
98
|
+
*/
|
|
99
|
+
function handleValueChange(adjustment: number) {
|
|
100
|
+
try {
|
|
101
|
+
console.log('🔄 handleValueChange:', { currentValue: value, adjustment, min, max });
|
|
102
|
+
const newValue = value + adjustment;
|
|
103
|
+
|
|
104
|
+
if (min !== undefined && newValue < min) {
|
|
105
|
+
console.log('⚠️ Value would go below min, clamping to:', min);
|
|
106
|
+
value = min;
|
|
107
|
+
if (onChange) onChange(min);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (max !== undefined && newValue > max) {
|
|
112
|
+
console.log('⚠️ Value would exceed max, clamping to:', max);
|
|
113
|
+
value = max;
|
|
114
|
+
if (onChange) onChange(max);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
console.log('✅ Setting new value:', newValue);
|
|
119
|
+
value = newValue;
|
|
120
|
+
if (onChange) onChange(newValue);
|
|
121
|
+
} catch (error) {
|
|
122
|
+
console.error('❌ Error in handleValueChange:', error);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Input Event Handler
|
|
128
|
+
* Manages direct user input with validation
|
|
129
|
+
*/
|
|
130
|
+
function handleInput(e: Event) {
|
|
131
|
+
try {
|
|
132
|
+
const input = e.currentTarget as HTMLInputElement;
|
|
133
|
+
const inputValue = input.value;
|
|
134
|
+
|
|
135
|
+
console.log('handleInput start:', {
|
|
136
|
+
inputValue,
|
|
137
|
+
isEditing,
|
|
138
|
+
currentValue: value,
|
|
139
|
+
min,
|
|
140
|
+
max
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// Handle empty input
|
|
144
|
+
if (inputValue === '') {
|
|
145
|
+
console.log('Empty input detected - allowing editing');
|
|
146
|
+
isEditing = true;
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Prevent multiple minus signs
|
|
151
|
+
if (inputValue.split('-').length > 2) {
|
|
152
|
+
console.log('Multiple minus signs detected, preventing');
|
|
153
|
+
input.value = inputValue.charAt(0) === '-' ?
|
|
154
|
+
'-' + inputValue.replace(/-/g, '') :
|
|
155
|
+
inputValue.replace(/-/g, '');
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Allow single minus sign for negative numbers
|
|
160
|
+
if (inputValue === '-' && min! < 0) {
|
|
161
|
+
console.log('Single minus sign detected');
|
|
162
|
+
isEditing = true;
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Validate numeric input
|
|
167
|
+
if (!/^-?\d*$/.test(inputValue)) {
|
|
168
|
+
console.log('Invalid character detected');
|
|
169
|
+
input.value = inputValue.replace(/[^\d-]/g, '');
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const numValue = parseFloat(inputValue);
|
|
174
|
+
if (!isNaN(numValue)) {
|
|
175
|
+
if (max !== undefined && numValue > max) {
|
|
176
|
+
console.log('Number exceeds max:', { numValue, max });
|
|
177
|
+
input.value = String(max);
|
|
178
|
+
value = max;
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
value = numValue;
|
|
182
|
+
}
|
|
183
|
+
} catch (error) {
|
|
184
|
+
console.error('Error in handleInput:', error);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Blur Event Handler
|
|
190
|
+
* Validates and normalizes input when focus is lost
|
|
191
|
+
*/
|
|
192
|
+
function handleBlur() {
|
|
193
|
+
console.log('handleBlur:', { value, isEditing, min, max });
|
|
194
|
+
|
|
195
|
+
isEditing = false;
|
|
196
|
+
const input = document.getElementById('number-input') as HTMLInputElement;
|
|
197
|
+
|
|
198
|
+
// Handle empty or invalid input
|
|
199
|
+
if (input.value === '' || input.value === '-') {
|
|
200
|
+
value = min!;
|
|
201
|
+
input.value = String(min!);
|
|
202
|
+
if (onChange) onChange(min!);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Validate and clamp final value
|
|
207
|
+
const finalValue = parseFloat(input.value);
|
|
208
|
+
if (isNaN(finalValue)) {
|
|
209
|
+
value = min!;
|
|
210
|
+
input.value = String(min!);
|
|
211
|
+
if (onChange) onChange(min!);
|
|
212
|
+
} else if (finalValue < min!) {
|
|
213
|
+
value = min!;
|
|
214
|
+
input.value = String(min!);
|
|
215
|
+
if (onChange) onChange(min!);
|
|
216
|
+
} else if (finalValue > max!) {
|
|
217
|
+
value = max!;
|
|
218
|
+
input.value = String(max!);
|
|
219
|
+
if (onChange) onChange(max!);
|
|
220
|
+
} else {
|
|
221
|
+
value = finalValue;
|
|
222
|
+
if (onChange) onChange(finalValue);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Auto-Repeat Functionality
|
|
228
|
+
* Handles continuous increment/decrement while button is held
|
|
229
|
+
*/
|
|
230
|
+
function startAutoRepeat(operation: 'increment' | 'decrement', event: MouseEvent) {
|
|
231
|
+
console.log('🎯 startAutoRepeat called:', { operation });
|
|
232
|
+
event.preventDefault();
|
|
233
|
+
event.stopPropagation();
|
|
234
|
+
|
|
235
|
+
// Clear any existing timers first
|
|
236
|
+
stopAutoRepeat();
|
|
237
|
+
|
|
238
|
+
const adjustment = operation === 'increment' ? step : -step;
|
|
239
|
+
isPressed = true;
|
|
240
|
+
|
|
241
|
+
// Handle initial click
|
|
242
|
+
console.log('👆 Initial click, applying adjustment:', adjustment);
|
|
243
|
+
handleValueChange(adjustment);
|
|
244
|
+
|
|
245
|
+
// Set up auto-repeat
|
|
246
|
+
console.log('⏳ Setting up auto-repeat timer for', HOLD_DELAY, 'ms');
|
|
247
|
+
|
|
248
|
+
// Start auto-repeat after hold delay
|
|
249
|
+
autoRepeatTimer = setTimeout(() => {
|
|
250
|
+
console.log('⌛ Hold delay completed, isPressed:', isPressed);
|
|
251
|
+
if (isPressed) {
|
|
252
|
+
console.log('🔄 Starting interval timer with delay:', REPEAT_INTERVAL);
|
|
253
|
+
autoRepeatInterval = setInterval(() => {
|
|
254
|
+
if (isPressed) {
|
|
255
|
+
console.log('⚡ Interval tick - applying adjustment:', adjustment);
|
|
256
|
+
handleValueChange(adjustment);
|
|
257
|
+
}
|
|
258
|
+
}, REPEAT_INTERVAL);
|
|
259
|
+
}
|
|
260
|
+
}, HOLD_DELAY);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Stop Auto-Repeat
|
|
265
|
+
* Cleans up auto-repeat timer and interval
|
|
266
|
+
*/
|
|
267
|
+
function stopAutoRepeat(event?: MouseEvent | FocusEvent) {
|
|
268
|
+
if (event) {
|
|
269
|
+
event.preventDefault();
|
|
270
|
+
event.stopPropagation();
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
console.log('🛑 stopAutoRepeat called');
|
|
274
|
+
|
|
275
|
+
if (autoRepeatTimer) {
|
|
276
|
+
console.log('🧹 Clearing auto-repeat timer');
|
|
277
|
+
clearTimeout(autoRepeatTimer);
|
|
278
|
+
autoRepeatTimer = undefined;
|
|
279
|
+
}
|
|
280
|
+
if (autoRepeatInterval) {
|
|
281
|
+
console.log('🧹 Clearing auto-repeat interval');
|
|
282
|
+
clearInterval(autoRepeatInterval);
|
|
283
|
+
autoRepeatInterval = undefined;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
isPressed = false;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Cleanup
|
|
291
|
+
* Ensures auto-repeat timer is cleared when component is destroyed
|
|
292
|
+
*/
|
|
293
|
+
onDestroy(() => {
|
|
294
|
+
console.log('♻️ Component destroying, cleaning up timers');
|
|
295
|
+
stopAutoRepeat();
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Input Validation
|
|
300
|
+
* Validates numeric input format
|
|
301
|
+
*/
|
|
302
|
+
function isValidNumber(value: string): boolean {
|
|
303
|
+
// Allow empty string during typing
|
|
304
|
+
if (value === '') return true;
|
|
305
|
+
// Allow single minus sign during typing if negatives are allowed
|
|
306
|
+
if (value === '-' && (min === undefined || min < 0)) return true;
|
|
307
|
+
|
|
308
|
+
// Strict number format validation
|
|
309
|
+
const numberRegex = /^-?\d*\.?\d*$/;
|
|
310
|
+
if (!numberRegex.test(value)) return false;
|
|
311
|
+
// Prevent multiple decimal points
|
|
312
|
+
if ((value.match(/\./g) || []).length > 1) return false;
|
|
313
|
+
// Prevent multiple minus signs
|
|
314
|
+
if ((value.match(/-/g) || []).length > 1) return false;
|
|
315
|
+
|
|
316
|
+
return true;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Keyboard Event Handler
|
|
321
|
+
* Manages keyboard interactions and shortcuts
|
|
322
|
+
*/
|
|
323
|
+
function handleKeyDown(e: KeyboardEvent) {
|
|
324
|
+
console.log('handleKeyDown:', {
|
|
325
|
+
key: e.key,
|
|
326
|
+
metaKey: e.metaKey,
|
|
327
|
+
ctrlKey: e.ctrlKey,
|
|
328
|
+
isEditing
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
// Handle selection shortcuts
|
|
332
|
+
if ((e.metaKey || e.ctrlKey) && e.key === 'a') {
|
|
333
|
+
console.log('CMD+A detected, setting editing mode');
|
|
334
|
+
isEditing = true;
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// Allow navigation keys
|
|
339
|
+
if (e.key === 'Backspace' || e.key === 'Delete' ||
|
|
340
|
+
e.key === 'ArrowLeft' || e.key === 'ArrowRight' ||
|
|
341
|
+
e.key === 'Tab') {
|
|
342
|
+
isEditing = true;
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// Allow copy/paste operations
|
|
347
|
+
if (e.metaKey || e.ctrlKey) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
</script>
|
|
352
|
+
|
|
353
|
+
<!-- Number Input Container -->
|
|
354
|
+
<div class="flex flex-col gap-2 widgetic-colors">
|
|
355
|
+
<div class="flex items-center w-full relative">
|
|
356
|
+
<div class="flex-1 min-w-0">
|
|
357
|
+
<InputControllerHeader {label} helpText={helpText} />
|
|
358
|
+
</div>
|
|
359
|
+
|
|
360
|
+
<div class="absolute right-0">
|
|
361
|
+
<NumberControls
|
|
362
|
+
{value}
|
|
363
|
+
{onChange}
|
|
364
|
+
{min}
|
|
365
|
+
{max}
|
|
366
|
+
{step}
|
|
367
|
+
{isLocked}
|
|
368
|
+
{onFocus}
|
|
369
|
+
/>
|
|
370
|
+
</div>
|
|
371
|
+
</div>
|
|
372
|
+
|
|
373
|
+
{#if description}
|
|
374
|
+
<p class="subtext text-grey5">{description}</p>
|
|
375
|
+
{/if}
|
|
376
|
+
</div>
|
|
377
|
+
|
|
378
|
+
<style>
|
|
379
|
+
:global(#number-input) {
|
|
380
|
+
text-align: left;
|
|
381
|
+
appearance: textfield;
|
|
382
|
+
-moz-appearance: textfield;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
:global(#number-input::-webkit-outer-spin-button),
|
|
386
|
+
:global(#number-input::-webkit-inner-spin-button) {
|
|
387
|
+
-webkit-appearance: none;
|
|
388
|
+
appearance: none;
|
|
389
|
+
margin: 0;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/* Remove focus ring from buttons */
|
|
393
|
+
:global(.number-input-button:focus-visible) {
|
|
394
|
+
outline: none !important;
|
|
395
|
+
box-shadow: none !important;
|
|
396
|
+
}
|
|
397
|
+
</style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { InputControllerConfig } from './index';
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const NumberInputController: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
/**
|
|
17
|
+
* Component Props
|
|
18
|
+
* External properties that configure the number input's behavior
|
|
19
|
+
*/ label: string;
|
|
20
|
+
value?: number;
|
|
21
|
+
onChange: (newValue: number) => void;
|
|
22
|
+
config?: InputControllerConfig;
|
|
23
|
+
helpText?: string | undefined;
|
|
24
|
+
description?: string | undefined;
|
|
25
|
+
onFocus?: () => void;
|
|
26
|
+
}, {
|
|
27
|
+
[evt: string]: CustomEvent<any>;
|
|
28
|
+
}, {}, {}, string>;
|
|
29
|
+
type NumberInputController = InstanceType<typeof NumberInputController>;
|
|
30
|
+
export default NumberInputController;
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* PositionInputController
|
|
3
|
+
*
|
|
4
|
+
* A dual-axis position controller that provides an intuitive drag-and-drop interface
|
|
5
|
+
* for setting X and Y coordinates as percentages.
|
|
6
|
+
*
|
|
7
|
+
* Key Features:
|
|
8
|
+
* - Interactive 2D position selection via joystick
|
|
9
|
+
* - Real-time position updates and visual feedback
|
|
10
|
+
* - Touch and mouse support
|
|
11
|
+
* - Dynamic indicator positioning
|
|
12
|
+
*
|
|
13
|
+
* Edge Cases:
|
|
14
|
+
* - Handles coordinate boundary constraints (0-100%)
|
|
15
|
+
* - Manages concurrent touch/mouse events
|
|
16
|
+
* - Prevents text selection during dragging
|
|
17
|
+
* - Maintains consistent state across input methods
|
|
18
|
+
-->
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
// Svelte imports
|
|
22
|
+
import { onMount, onDestroy } from 'svelte';
|
|
23
|
+
|
|
24
|
+
// Component config
|
|
25
|
+
import type { InputControllerConfig } from './index';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Core state and configuration props
|
|
29
|
+
* value: Current position coordinates
|
|
30
|
+
* onChange: Callback for position updates
|
|
31
|
+
* config: Additional configuration options
|
|
32
|
+
* onFocus: Focus event handler
|
|
33
|
+
* onDragStateChange: Callback for dragging state changes
|
|
34
|
+
*/
|
|
35
|
+
export let value: { x: number; y: number } | undefined = undefined;
|
|
36
|
+
export let onChange: (newValue: { x: number; y: number }) => void;
|
|
37
|
+
export let onFocus: () => void = () => {};
|
|
38
|
+
export let maskThumb: boolean = true;
|
|
39
|
+
export let onDragStateChange: (isDragging: boolean) => void = () => {};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* DOM references and state
|
|
43
|
+
* Used for position calculations and drag handling
|
|
44
|
+
*/
|
|
45
|
+
let joystickContainer: HTMLDivElement;
|
|
46
|
+
let joystickHandle: HTMLDivElement;
|
|
47
|
+
let isDragging = false;
|
|
48
|
+
let isHovering = false;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Reactive position state
|
|
52
|
+
* Defaults to center (50,50) if no value provided
|
|
53
|
+
*/
|
|
54
|
+
$: position = value || { x: 50, y: 50 };
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Formatted display values with fixed precision
|
|
58
|
+
* Handles null/undefined gracefully
|
|
59
|
+
*/
|
|
60
|
+
$: formattedX = (position?.x ?? 0).toFixed(0);
|
|
61
|
+
$: formattedY = (position?.y ?? 0).toFixed(0);
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Reactive indicator position
|
|
65
|
+
* Moves indicators to top when thumb is in lower half
|
|
66
|
+
*/
|
|
67
|
+
$: shouldShowAtTop = position.y > 50;
|
|
68
|
+
|
|
69
|
+
// Compute whether to mask the thumb based on interaction state
|
|
70
|
+
$: shouldMaskThumb = maskThumb && !isDragging && !isHovering;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Updates position based on cursor/touch coordinates
|
|
74
|
+
* Converts screen coordinates to percentage values
|
|
75
|
+
* Enforces boundaries (0-100%)
|
|
76
|
+
* @param clientX - Screen X coordinate
|
|
77
|
+
* @param clientY - Screen Y coordinate
|
|
78
|
+
*/
|
|
79
|
+
function updatePosition(clientX: number, clientY: number) {
|
|
80
|
+
if (!joystickContainer) return;
|
|
81
|
+
|
|
82
|
+
const rect = joystickContainer.getBoundingClientRect();
|
|
83
|
+
|
|
84
|
+
// Convert pixel coordinates to percentages
|
|
85
|
+
let x = ((clientX - rect.left) / rect.width) * 100;
|
|
86
|
+
let y = ((clientY - rect.top) / rect.height) * 100;
|
|
87
|
+
|
|
88
|
+
// Clamp values to valid range
|
|
89
|
+
x = Math.max(0, Math.min(100, x));
|
|
90
|
+
y = Math.max(0, Math.min(100, y));
|
|
91
|
+
|
|
92
|
+
position = { x, y };
|
|
93
|
+
onChange(position);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Mouse event handlers
|
|
98
|
+
* Manages dragging state and cursor appearance
|
|
99
|
+
* Prevents text selection during drag
|
|
100
|
+
*/
|
|
101
|
+
function handleMouseEnter() {
|
|
102
|
+
isHovering = true;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function handleMouseLeave() {
|
|
106
|
+
isHovering = false;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function handleMouseDown(event: MouseEvent) {
|
|
110
|
+
isDragging = true;
|
|
111
|
+
onDragStateChange(true);
|
|
112
|
+
onFocus();
|
|
113
|
+
updatePosition(event.clientX, event.clientY);
|
|
114
|
+
document.addEventListener('mousemove', handleMouseMove);
|
|
115
|
+
document.addEventListener('mouseup', handleMouseUp);
|
|
116
|
+
document.body.style.cursor = 'grabbing';
|
|
117
|
+
document.body.classList.add('position-dragging');
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function handleMouseMove(event: MouseEvent) {
|
|
121
|
+
if (!isDragging) return;
|
|
122
|
+
updatePosition(event.clientX, event.clientY);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function handleMouseUp() {
|
|
126
|
+
isDragging = false;
|
|
127
|
+
onDragStateChange(false);
|
|
128
|
+
document.removeEventListener('mousemove', handleMouseMove);
|
|
129
|
+
document.removeEventListener('mouseup', handleMouseUp);
|
|
130
|
+
document.body.style.cursor = '';
|
|
131
|
+
document.body.classList.remove('position-dragging');
|
|
132
|
+
document.body.style.userSelect = '';
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Touch event handlers
|
|
137
|
+
* Provides touch support with similar behavior to mouse events
|
|
138
|
+
*/
|
|
139
|
+
function handleTouchStart(event: TouchEvent) {
|
|
140
|
+
isDragging = true;
|
|
141
|
+
onDragStateChange(true);
|
|
142
|
+
onFocus();
|
|
143
|
+
updatePosition(event.touches[0].clientX, event.touches[0].clientY);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function handleTouchMove(event: TouchEvent) {
|
|
147
|
+
if (!isDragging) return;
|
|
148
|
+
updatePosition(event.touches[0].clientX, event.touches[0].clientY);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function handleTouchEnd() {
|
|
152
|
+
isDragging = false;
|
|
153
|
+
onDragStateChange(false);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Lifecycle hooks
|
|
158
|
+
* Setup and cleanup of event listeners
|
|
159
|
+
*/
|
|
160
|
+
onMount(() => {
|
|
161
|
+
return () => {
|
|
162
|
+
document.removeEventListener('mousemove', handleMouseMove);
|
|
163
|
+
document.removeEventListener('mouseup', handleMouseUp);
|
|
164
|
+
};
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
onDestroy(() => {
|
|
168
|
+
document.body.classList.remove('position-dragging');
|
|
169
|
+
document.body.style.cursor = '';
|
|
170
|
+
document.body.style.userSelect = '';
|
|
171
|
+
});
|
|
172
|
+
</script>
|
|
173
|
+
|
|
174
|
+
<div class="position-input-controller widgetic-colors">
|
|
175
|
+
<!-- Joystick UI -->
|
|
176
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
177
|
+
<div
|
|
178
|
+
bind:this={joystickContainer}
|
|
179
|
+
class="relative w-[185px] h-[185px] bg-grey1 rounded-large border border-grey2 joystick-container transition-colors duration-200 hover:border-forest-green"
|
|
180
|
+
class:overflow-hidden={shouldMaskThumb}
|
|
181
|
+
on:mouseenter={handleMouseEnter}
|
|
182
|
+
on:mouseleave={handleMouseLeave}
|
|
183
|
+
on:mousedown={handleMouseDown}
|
|
184
|
+
on:touchstart={handleTouchStart}
|
|
185
|
+
on:touchmove={handleTouchMove}
|
|
186
|
+
on:touchend={handleTouchEnd}
|
|
187
|
+
>
|
|
188
|
+
<!-- Grid lines -->
|
|
189
|
+
<div class="absolute inset-0 grid-background"></div>
|
|
190
|
+
|
|
191
|
+
<!-- Position indicator thumb -->
|
|
192
|
+
<!-- svelte-ignore element_invalid_self_closing_tag -->
|
|
193
|
+
<div
|
|
194
|
+
bind:this={joystickHandle}
|
|
195
|
+
class="absolute w-[24px] h-[24px] bg-white rounded-full -translate-x-1/2 -translate-y-1/2 border-2 border-grey5 z-10 {isDragging ? 'border-grey7 scale-110' : 'hover:border-grey7 hover:scale-110 transition-all duration-150'}"
|
|
196
|
+
style="left: {position.x}%; top: {position.y}%"
|
|
197
|
+
/>
|
|
198
|
+
|
|
199
|
+
<!-- Percentage display with dynamic positioning -->
|
|
200
|
+
<div
|
|
201
|
+
class="absolute left-4 right-4 flex justify-between items-center transition-all duration-300 ease-in-out"
|
|
202
|
+
class:bottom-2={!shouldShowAtTop}
|
|
203
|
+
class:top-2={shouldShowAtTop}
|
|
204
|
+
style="opacity: {isDragging ? 0.5 : 1}"
|
|
205
|
+
>
|
|
206
|
+
<div class="flex items-center gap-2 w-[50px]">
|
|
207
|
+
<span class="caption text-grey7 w-[12px]">X:</span>
|
|
208
|
+
<span class="subtext text-grey7 w-[32px]">{formattedX}%</span>
|
|
209
|
+
</div>
|
|
210
|
+
<div class="flex items-center gap-2 w-[50px]">
|
|
211
|
+
<span class="caption text-grey7 w-[12px]">Y:</span>
|
|
212
|
+
<span class="subtext text-grey7 w-[32px]">{formattedY}%</span>
|
|
213
|
+
</div>
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
216
|
+
</div>
|
|
217
|
+
|
|
218
|
+
<style>
|
|
219
|
+
/* Make the selector more specific by targeting only elements within position-input-controller */
|
|
220
|
+
:global(body.position-dragging .position-input-controller *) {
|
|
221
|
+
cursor: grabbing !important;
|
|
222
|
+
user-select: none !important;
|
|
223
|
+
-webkit-user-select: none !important;
|
|
224
|
+
-moz-user-select: none !important;
|
|
225
|
+
-ms-user-select: none !important;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* Add pointer cursor for interactive areas */
|
|
229
|
+
.joystick-container {
|
|
230
|
+
cursor: grab !important;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.joystick-container:active {
|
|
234
|
+
cursor: grabbing !important;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/* Remove default focus outline */
|
|
238
|
+
.joystick-container:focus {
|
|
239
|
+
outline: none !important;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/* Grid background using gradients */
|
|
243
|
+
.grid-background {
|
|
244
|
+
background-image:
|
|
245
|
+
linear-gradient(to right, transparent 24.99%, hsl(var(--forest-green) / 0.5) 25%, hsl(var(--forest-green) / 0.5) calc(25% + 1px), transparent calc(25% + 1px)),
|
|
246
|
+
linear-gradient(to right, transparent 49.99%, hsl(var(--forest-green) / 0.5) 50%, hsl(var(--forest-green) / 0.5) calc(50% + 1px), transparent calc(50% + 1px)),
|
|
247
|
+
linear-gradient(to right, transparent 74.99%, hsl(var(--forest-green) / 0.5) 75%, hsl(var(--forest-green) / 0.5) calc(75% + 1px), transparent calc(75% + 1px)),
|
|
248
|
+
linear-gradient(to bottom, transparent 24.99%, hsl(var(--forest-green) / 0.5) 25%, hsl(var(--forest-green) / 0.5) calc(25% + 1px), transparent calc(25% + 1px)),
|
|
249
|
+
linear-gradient(to bottom, transparent 49.99%, hsl(var(--forest-green) / 0.5) 50%, hsl(var(--forest-green) / 0.5) calc(50% + 1px), transparent calc(50% + 1px)),
|
|
250
|
+
linear-gradient(to bottom, transparent 74.99%, hsl(var(--forest-green) / 0.5) 75%, hsl(var(--forest-green) / 0.5) calc(75% + 1px), transparent calc(75% + 1px));
|
|
251
|
+
}
|
|
252
|
+
</style>
|