@widgetic/editor 3.11.4 → 4.0.1
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 +3952 -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 +724 -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 +2062 -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 +1804 -0
- package/dist/components/ic/TextAreaInputController.svelte.d.ts +13 -0
- package/dist/components/ic/TextAreaPreviewInputController.svelte +476 -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 +5 -0
- package/dist/config.js +19 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +8 -0
- package/dist/stores/userSession.d.ts +7 -0
- package/dist/stores/userSession.js +28 -0
- package/dist/utils/FontManager.d.ts +276 -0
- package/dist/utils/FontManager.js +1283 -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,411 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* SliderInputController Component
|
|
4
|
+
* A customizable slider input with numeric input field and extended range controls.
|
|
5
|
+
* Features include:
|
|
6
|
+
* - Draggable slider with min/max extensions
|
|
7
|
+
* - Numeric input field for precise values
|
|
8
|
+
* - Focus management and keyboard navigation
|
|
9
|
+
* - Value clamping and validation
|
|
10
|
+
* - Smart click positioning: center thumb at clicked position on track
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// Svelte imports
|
|
14
|
+
import { onMount, onDestroy } from 'svelte';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Shadcn UI components from Widgetic design-system package
|
|
18
|
+
*/
|
|
19
|
+
import { Slider, type SliderProps } from '@widgetic/design-system/components';
|
|
20
|
+
import { InputControllerHeader } from './index';
|
|
21
|
+
|
|
22
|
+
// Component config
|
|
23
|
+
import type { InputControllerConfig } from './index';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Component Props
|
|
27
|
+
* External properties that configure the slider's behavior
|
|
28
|
+
*/
|
|
29
|
+
let className = '';
|
|
30
|
+
export { className as class };
|
|
31
|
+
export let height = 48; // pixels
|
|
32
|
+
export let elementsGap = 8; // pixels
|
|
33
|
+
export let thumbSize = 24; // pixels
|
|
34
|
+
export let sliderType: SliderProps['type'] = "single";
|
|
35
|
+
export let barHeight = 8; // pixels
|
|
36
|
+
export let label: string = ''; // Display label
|
|
37
|
+
export let value: number | number[]; // Current slider value
|
|
38
|
+
export let onChange: (newValue: number | number[]) => void; // Value change callback
|
|
39
|
+
export let config: InputControllerConfig = {}; // Additional configuration
|
|
40
|
+
export let helpText: string | undefined = undefined; // Help text for the input
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Configuration Options
|
|
44
|
+
* Derived from config prop with fallbacks
|
|
45
|
+
*/
|
|
46
|
+
export let min: number = config.min || 0; // Minimum allowed value
|
|
47
|
+
export let max: number = config.max || 100; // Maximum allowed value
|
|
48
|
+
export let step: number = config.step || 1; // Step increment
|
|
49
|
+
export let onFocus: () => void = () => {}; // Focus callback
|
|
50
|
+
export let autofocus: boolean = false; // Auto-focus on mount
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Internal State
|
|
54
|
+
* Tracks component state for focus and value management
|
|
55
|
+
*/
|
|
56
|
+
let sliderContainer: HTMLDivElement; // Reference to container element
|
|
57
|
+
let sliderTrack: HTMLDivElement; // Reference to slider track element
|
|
58
|
+
let lastValue = value; // Previous value for change detection
|
|
59
|
+
let isCurrentlyFocused = false; // Current focus state
|
|
60
|
+
let isClickHandled = false; // Prevents double handling of clicks
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Layout Constants
|
|
64
|
+
* Define dimensions for slider components
|
|
65
|
+
*/
|
|
66
|
+
const valueDisplayWidth = 26; // pixels
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Component Initialization
|
|
71
|
+
* Sets up focus handling and event listeners
|
|
72
|
+
*/
|
|
73
|
+
onMount(() => {
|
|
74
|
+
// console.log('SliderIC sliderType:', sliderType, sliderValue);
|
|
75
|
+
// Handle autofocus if enabled
|
|
76
|
+
if (autofocus && sliderContainer) {
|
|
77
|
+
const thumbElement = sliderContainer.querySelector('[role="slider"]');
|
|
78
|
+
if (thumbElement instanceof HTMLElement) {
|
|
79
|
+
thumbElement.focus();
|
|
80
|
+
handleFocus();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Add mousedown handler to the slider component for track click positioning
|
|
85
|
+
const sliderElement = sliderContainer.querySelector('.slider-component');
|
|
86
|
+
if (sliderElement) {
|
|
87
|
+
sliderElement.addEventListener('mousedown', handleSliderMouseDown);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Blur Event Handler
|
|
92
|
+
* Resets focus state when focus leaves the component
|
|
93
|
+
*/
|
|
94
|
+
const handleBlur = (e: FocusEvent) => {
|
|
95
|
+
if (!sliderContainer.contains(e.relatedTarget as Node)) {
|
|
96
|
+
isCurrentlyFocused = false;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
sliderContainer.addEventListener('blur', handleBlur, true);
|
|
101
|
+
|
|
102
|
+
// Add global mouse up handler to reset click state
|
|
103
|
+
const handleGlobalMouseUp = () => {
|
|
104
|
+
isClickHandled = false;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
document.addEventListener('mouseup', handleGlobalMouseUp);
|
|
108
|
+
|
|
109
|
+
return () => {
|
|
110
|
+
sliderContainer.removeEventListener('blur', handleBlur, true);
|
|
111
|
+
document.removeEventListener('mouseup', handleGlobalMouseUp);
|
|
112
|
+
|
|
113
|
+
// Clean up slider mousedown listener
|
|
114
|
+
if (sliderElement) {
|
|
115
|
+
sliderElement.removeEventListener('mousedown', handleSliderMouseDown);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
onDestroy(() => {
|
|
121
|
+
isClickHandled = false;
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Value Change Handler
|
|
126
|
+
* Updates value and manages focus state
|
|
127
|
+
* @param newValue - New slider value(s)
|
|
128
|
+
*/
|
|
129
|
+
function handleChange(newValue: number | number[]) {
|
|
130
|
+
// Only trigger focus if value actually changed and we're not already focused
|
|
131
|
+
if ((newValue !== lastValue) && !isCurrentlyFocused) {
|
|
132
|
+
handleFocus();
|
|
133
|
+
isCurrentlyFocused = true;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// call the onChange callback
|
|
137
|
+
onChange(newValue);
|
|
138
|
+
|
|
139
|
+
// update the lastValue
|
|
140
|
+
lastValue = newValue;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Custom Track Click Handler
|
|
145
|
+
* Positions the thumb so that the clicked point becomes the center of the thumb
|
|
146
|
+
* @param event - Mouse event (cast to MouseEvent internally)
|
|
147
|
+
*/
|
|
148
|
+
function handleSliderMouseDown(event: Event) {
|
|
149
|
+
if (isClickHandled) return;
|
|
150
|
+
|
|
151
|
+
// Cast event to MouseEvent
|
|
152
|
+
const mouseEvent = event as MouseEvent;
|
|
153
|
+
|
|
154
|
+
// Check if click was on the thumb itself
|
|
155
|
+
const target = mouseEvent.target as HTMLElement;
|
|
156
|
+
if (target.getAttribute('role') === 'slider') {
|
|
157
|
+
// Click was on thumb, let it handle normally
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// This was a click on the track, so we'll position the thumb
|
|
162
|
+
const sliderElement = sliderContainer.querySelector('.slider-component');
|
|
163
|
+
if (!sliderElement) return;
|
|
164
|
+
|
|
165
|
+
const rect = sliderElement.getBoundingClientRect();
|
|
166
|
+
const clickX = mouseEvent.clientX - rect.left;
|
|
167
|
+
const trackWidth = rect.width;
|
|
168
|
+
|
|
169
|
+
// Calculate the percentage position of the click
|
|
170
|
+
let percentage = (clickX / trackWidth) * 100;
|
|
171
|
+
|
|
172
|
+
// Clamp to valid range
|
|
173
|
+
percentage = Math.max(0, Math.min(100, percentage));
|
|
174
|
+
|
|
175
|
+
// Convert percentage to value
|
|
176
|
+
const rawValue = min + (percentage / 100) * (max - min);
|
|
177
|
+
|
|
178
|
+
// Round to nearest step
|
|
179
|
+
const steppedValue = Math.round((rawValue - min) / step) * step + min;
|
|
180
|
+
|
|
181
|
+
// Ensure value is within bounds
|
|
182
|
+
const clampedValue = Math.max(min, Math.min(max, steppedValue));
|
|
183
|
+
|
|
184
|
+
// Handle different slider types
|
|
185
|
+
if (sliderType === 'single') {
|
|
186
|
+
handleChange(clampedValue);
|
|
187
|
+
} else if (sliderType === 'multiple' && Array.isArray(value)) {
|
|
188
|
+
// For range sliders, determine which thumb to move based on proximity
|
|
189
|
+
const currentValue = value as [number, number];
|
|
190
|
+
const distanceToStart = Math.abs(clampedValue - currentValue[0]);
|
|
191
|
+
const distanceToEnd = Math.abs(clampedValue - currentValue[1]);
|
|
192
|
+
|
|
193
|
+
if (distanceToStart < distanceToEnd) {
|
|
194
|
+
// Move start thumb
|
|
195
|
+
handleChange([clampedValue, currentValue[1]]);
|
|
196
|
+
} else {
|
|
197
|
+
// Move end thumb
|
|
198
|
+
handleChange([currentValue[0], clampedValue]);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Mark click as handled
|
|
203
|
+
isClickHandled = true;
|
|
204
|
+
|
|
205
|
+
// Focus the slider
|
|
206
|
+
handleFocus();
|
|
207
|
+
|
|
208
|
+
// Allow the event to continue to the slider component for drag handling
|
|
209
|
+
// Don't prevent default or stop propagation
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Value Formatting
|
|
214
|
+
* Formats numeric values for display
|
|
215
|
+
* @param val - Number to format
|
|
216
|
+
* @returns Formatted string representation
|
|
217
|
+
*/
|
|
218
|
+
function formatValue(val: number | undefined): string {
|
|
219
|
+
if (val === undefined) return '';
|
|
220
|
+
return val % 1 === 0 ? val.toFixed(0) : val.toFixed(1);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Focus Handler
|
|
225
|
+
* Manages focus state and triggers focus callback
|
|
226
|
+
*/
|
|
227
|
+
function handleFocus() {
|
|
228
|
+
if (!isCurrentlyFocused) {
|
|
229
|
+
// console.log('Slider focused through interaction, value:', lastValue);
|
|
230
|
+
onFocus();
|
|
231
|
+
isCurrentlyFocused = true;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Reactive slider value derived from prop or min value
|
|
236
|
+
$: sliderValue = sliderType === 'single'
|
|
237
|
+
? (typeof value === 'number' ? value : min)
|
|
238
|
+
: (Array.isArray(value) ? value : [min, max]);
|
|
239
|
+
|
|
240
|
+
// Helper function to safely get array value
|
|
241
|
+
function getArrayValue(arr: number | number[], index: number): number {
|
|
242
|
+
if (Array.isArray(arr)) {
|
|
243
|
+
return arr[index] ?? min;
|
|
244
|
+
}
|
|
245
|
+
return arr;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Update lastValue when prop changes
|
|
249
|
+
$: if (value !== undefined) {
|
|
250
|
+
lastValue = value;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Input Field Handlers
|
|
255
|
+
* Manage direct numeric input
|
|
256
|
+
*/
|
|
257
|
+
function handleInputChange(event: Event) {
|
|
258
|
+
const input = event.target as HTMLInputElement;
|
|
259
|
+
let newValue = parseFloat(input.value);
|
|
260
|
+
|
|
261
|
+
// Validate input
|
|
262
|
+
if (input.value === '' || isNaN(newValue)) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Clamp value within bounds
|
|
267
|
+
newValue = Math.min(Math.max(newValue, min), max);
|
|
268
|
+
|
|
269
|
+
// update the input value
|
|
270
|
+
input.value = newValue.toString();
|
|
271
|
+
|
|
272
|
+
// call the onChange callback
|
|
273
|
+
handleChange(newValue);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Input Blur Handler
|
|
278
|
+
* Validates and normalizes input on blur
|
|
279
|
+
*/
|
|
280
|
+
function handleInputBlur(event: Event) {
|
|
281
|
+
const input = event.target as HTMLInputElement;
|
|
282
|
+
|
|
283
|
+
if (input.value === '') {
|
|
284
|
+
input.value = value?.toString() || min.toString();
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
let newValue = parseFloat(input.value);
|
|
289
|
+
if (isNaN(newValue)) {
|
|
290
|
+
input.value = value?.toString() || min.toString();
|
|
291
|
+
} else {
|
|
292
|
+
newValue = Math.min(Math.max(newValue, min), max);
|
|
293
|
+
input.value = newValue.toString();
|
|
294
|
+
|
|
295
|
+
// call the handleChange function
|
|
296
|
+
handleChange(newValue);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
</script>
|
|
300
|
+
|
|
301
|
+
<!-- Slider Input Controller -->
|
|
302
|
+
<div class="slider-input-controller{className ? className + ' ' : ''} w-full flex flex-col widgetic-colors" style="gap: {elementsGap}px;">
|
|
303
|
+
<!-- Header -->
|
|
304
|
+
{#if label}
|
|
305
|
+
<InputControllerHeader class="flex-1 min-w-0" style="height: {height}px;" {label} helpText={helpText} />
|
|
306
|
+
{/if}
|
|
307
|
+
|
|
308
|
+
<!-- Main Container with subcomponents -->
|
|
309
|
+
<div
|
|
310
|
+
class="slider-main-container flex items-center justify-between rounded-large transition-colors duration-200"
|
|
311
|
+
style="height: {height}px; padding-left: 16px; padding-right: 16px; gap: {elementsGap}px; border: 1px solid hsl(var(--grey2)); background: hsl(var(--grey1));"
|
|
312
|
+
onfocusin={onFocus}
|
|
313
|
+
bind:this={sliderContainer}
|
|
314
|
+
>
|
|
315
|
+
<!-- Min Value Display -->
|
|
316
|
+
{#if sliderType === 'multiple'}
|
|
317
|
+
<span style="width: {valueDisplayWidth}px; color: hsl(var(--grey7));" class="value-display flex-none subtext text-center">
|
|
318
|
+
{formatValue(getArrayValue(sliderValue, 0))}
|
|
319
|
+
</span>
|
|
320
|
+
{/if}
|
|
321
|
+
|
|
322
|
+
<!-- Slider Container with Extensions -->
|
|
323
|
+
<div
|
|
324
|
+
class="slider-container relative h-full flex items-center"
|
|
325
|
+
style="width: calc(100% - {(sliderType === 'multiple' ? 2 : 1) * (valueDisplayWidth + elementsGap)}px);"
|
|
326
|
+
bind:this={sliderTrack}
|
|
327
|
+
>
|
|
328
|
+
<!-- Slider Component -->
|
|
329
|
+
<svelte:component
|
|
330
|
+
this={Slider}
|
|
331
|
+
{...{
|
|
332
|
+
type: sliderType,
|
|
333
|
+
value: sliderValue,
|
|
334
|
+
onValueChange: handleChange,
|
|
335
|
+
min,
|
|
336
|
+
max,
|
|
337
|
+
step,
|
|
338
|
+
class: "slider-component relative",
|
|
339
|
+
style: `--thumb-size: ${thumbSize}px; --bar-height: ${barHeight}px; z-index: 3;`,
|
|
340
|
+
tabindex: -1,
|
|
341
|
+
} as SliderProps}
|
|
342
|
+
/>
|
|
343
|
+
</div>
|
|
344
|
+
|
|
345
|
+
<!-- Max Value Display -->
|
|
346
|
+
<span style="width: {valueDisplayWidth}px; color: hsl(var(--grey7));" class="value-display flex-none subtext text-center">
|
|
347
|
+
{formatValue(getArrayValue(sliderValue, sliderType === 'multiple' ? 1 : 0))}
|
|
348
|
+
</span>
|
|
349
|
+
|
|
350
|
+
</div>
|
|
351
|
+
</div>
|
|
352
|
+
|
|
353
|
+
<style>
|
|
354
|
+
.slider-main-container:hover {
|
|
355
|
+
border-color: hsl(var(--forest-green));
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.value-display {
|
|
359
|
+
user-select: none;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/* THUMB Styles */
|
|
363
|
+
:global(.slider-component [role="slider"]) {
|
|
364
|
+
outline: none !important;
|
|
365
|
+
cursor: grab;
|
|
366
|
+
width: var(--thumb-size) !important;
|
|
367
|
+
height: var(--thumb-size) !important;
|
|
368
|
+
background-color: white !important;
|
|
369
|
+
border: 2px solid hsl(var(--grey5)) !important;
|
|
370
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
|
|
371
|
+
pointer-events: auto !important;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
:global(.slider-component [role="slider"]:active) {
|
|
375
|
+
cursor: grabbing;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
:global(.slider-component [role="slider"]:hover) {
|
|
379
|
+
border-color: hsl(var(--grey7)) !important;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/* Remove focus outline while maintaining accessibility */
|
|
383
|
+
:global(.slider-component [role="slider"]:focus),
|
|
384
|
+
:global(.slider-component [role="slider"]:focus-visible) {
|
|
385
|
+
outline: none !important;
|
|
386
|
+
box-shadow: none !important;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/* TRACK BAR Styles */
|
|
390
|
+
:global(.slider-component .bg-secondary) {
|
|
391
|
+
background-color: hsl(var(--grey5)) !important;
|
|
392
|
+
height: var(--bar-height) !important;
|
|
393
|
+
border-radius: var(--bar-height) !important; /* rounded ends */
|
|
394
|
+
cursor: pointer !important;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/* PROGRESS BAR Styles */
|
|
398
|
+
:global(.slider-component [data-slider-range]) {
|
|
399
|
+
background-color: hsl(var(--grey7)) !important;
|
|
400
|
+
cursor: pointer !important;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/* Thumb should override track cursor when hovering */
|
|
404
|
+
:global(.slider-component [role="slider"]:hover) {
|
|
405
|
+
cursor: grab !important;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
:global(.slider-component [role="slider"]:active) {
|
|
409
|
+
cursor: grabbing !important;
|
|
410
|
+
}
|
|
411
|
+
</style>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shadcn UI components from Widgetic design-system package
|
|
3
|
+
*/
|
|
4
|
+
import { type SliderProps } from '@widgetic/design-system/components';
|
|
5
|
+
import type { InputControllerConfig } from './index';
|
|
6
|
+
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> {
|
|
7
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
8
|
+
$$bindings?: Bindings;
|
|
9
|
+
} & Exports;
|
|
10
|
+
(internal: unknown, props: Props & {
|
|
11
|
+
$$events?: Events;
|
|
12
|
+
$$slots?: Slots;
|
|
13
|
+
}): Exports & {
|
|
14
|
+
$set?: any;
|
|
15
|
+
$on?: any;
|
|
16
|
+
};
|
|
17
|
+
z_$$bindings?: Bindings;
|
|
18
|
+
}
|
|
19
|
+
declare const SliderInputController: $$__sveltets_2_IsomorphicComponent<{
|
|
20
|
+
/**
|
|
21
|
+
* Component Props
|
|
22
|
+
* External properties that configure the slider's behavior
|
|
23
|
+
*/ class?: string;
|
|
24
|
+
height?: number;
|
|
25
|
+
elementsGap?: number;
|
|
26
|
+
thumbSize?: number;
|
|
27
|
+
sliderType?: SliderProps["type"];
|
|
28
|
+
barHeight?: number;
|
|
29
|
+
label?: string;
|
|
30
|
+
value: number | number[];
|
|
31
|
+
onChange: (newValue: number | number[]) => void;
|
|
32
|
+
config?: InputControllerConfig;
|
|
33
|
+
helpText?: string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Configuration Options
|
|
36
|
+
* Derived from config prop with fallbacks
|
|
37
|
+
*/ min?: number;
|
|
38
|
+
max?: number;
|
|
39
|
+
step?: number;
|
|
40
|
+
onFocus?: () => void;
|
|
41
|
+
autofocus?: boolean;
|
|
42
|
+
}, {
|
|
43
|
+
[evt: string]: CustomEvent<any>;
|
|
44
|
+
}, {}, {}, string>;
|
|
45
|
+
type SliderInputController = InstanceType<typeof SliderInputController>;
|
|
46
|
+
export default SliderInputController;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* SliderRangeInputController
|
|
3
|
+
*
|
|
4
|
+
* A dual-thumb slider component for selecting numeric ranges with precise input controls.
|
|
5
|
+
* Combines visual slider interaction with direct numeric input capabilities.
|
|
6
|
+
*
|
|
7
|
+
* Key Features:
|
|
8
|
+
* - Dual thumb range selection
|
|
9
|
+
* - Direct numeric input with validation
|
|
10
|
+
* - Extension tracks for quick min/max selection
|
|
11
|
+
* - Focus state management
|
|
12
|
+
*
|
|
13
|
+
* Edge Cases:
|
|
14
|
+
* - Maintains value constraints between thumbs
|
|
15
|
+
* - Handles invalid numeric inputs
|
|
16
|
+
* - Preserves precision based on step value
|
|
17
|
+
* - Manages focus states across multiple inputs
|
|
18
|
+
-->
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
// Svelte imports
|
|
22
|
+
import { onMount, tick } from 'svelte';
|
|
23
|
+
|
|
24
|
+
// local components imports
|
|
25
|
+
import SliderInputController from './SliderInputController.svelte';
|
|
26
|
+
|
|
27
|
+
// Component config
|
|
28
|
+
import type { InputControllerConfig } from './index';
|
|
29
|
+
|
|
30
|
+
// Component props
|
|
31
|
+
let className = '';
|
|
32
|
+
export { className as class };
|
|
33
|
+
export let label: string;
|
|
34
|
+
export let value: [number, number] = [0, 100];
|
|
35
|
+
export let onChange: (newValue: [number, number]) => void;
|
|
36
|
+
export let config: InputControllerConfig = {};
|
|
37
|
+
export let helpText: string | undefined = undefined;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Configuration Options
|
|
41
|
+
* Derived from config prop with fallbacks
|
|
42
|
+
*/
|
|
43
|
+
export let min: number = config.min || 0;
|
|
44
|
+
export let max: number = config.max || 100;
|
|
45
|
+
export let step: number = config.step || 1;
|
|
46
|
+
export let onFocus: () => void = () => {};
|
|
47
|
+
// export let autofocus: boolean = false;
|
|
48
|
+
|
|
49
|
+
// Store initial scroll position
|
|
50
|
+
let initialScrollPos = { x: 0, y: 0 };
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Validate and adjust values against min/max constraints
|
|
54
|
+
* @param val - Input array of two numbers
|
|
55
|
+
* @returns Validated and adjusted array of two numbers
|
|
56
|
+
*/
|
|
57
|
+
function validateAndAdjustValue(val: [number, number]): [number, number] {
|
|
58
|
+
// Ensure values are numbers and within bounds
|
|
59
|
+
const validStart = Math.max(min, Math.min(max, Number(val[0]) || min));
|
|
60
|
+
const validEnd = Math.max(min, Math.min(max, Number(val[1]) || max));
|
|
61
|
+
|
|
62
|
+
// Round to nearest step
|
|
63
|
+
const roundedStart = Math.round((validStart - min) / step) * step + min;
|
|
64
|
+
const roundedEnd = Math.round((validEnd - min) / step) * step + min;
|
|
65
|
+
|
|
66
|
+
// Ensure start is not greater than end
|
|
67
|
+
return roundedStart <= roundedEnd
|
|
68
|
+
? [roundedStart, roundedEnd]
|
|
69
|
+
: [roundedEnd, roundedStart];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Component Initialization
|
|
74
|
+
*/
|
|
75
|
+
onMount(async () => {
|
|
76
|
+
try {
|
|
77
|
+
// Store initial scroll position
|
|
78
|
+
initialScrollPos = {
|
|
79
|
+
x: window.scrollX,
|
|
80
|
+
y: window.scrollY
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// Validate and adjust initial value
|
|
84
|
+
const adjustedValue = validateAndAdjustValue(value);
|
|
85
|
+
|
|
86
|
+
if (adjustedValue[0] !== value[0] || adjustedValue[1] !== value[1]) {
|
|
87
|
+
console.log('Adjusting initial range values to match constraints:', { original: value, adjusted: adjustedValue });
|
|
88
|
+
value = adjustedValue;
|
|
89
|
+
|
|
90
|
+
// Wait for next tick to prevent scroll jump
|
|
91
|
+
await tick();
|
|
92
|
+
onChange(adjustedValue);
|
|
93
|
+
|
|
94
|
+
// Restore scroll position
|
|
95
|
+
window.scrollTo(initialScrollPos.x, initialScrollPos.y);
|
|
96
|
+
}
|
|
97
|
+
} catch (error) {
|
|
98
|
+
console.error('Error in SliderRangeInputController.onMount:', error);
|
|
99
|
+
// Set a safe default value
|
|
100
|
+
const safeValue: [number, number] = [min, max];
|
|
101
|
+
value = safeValue;
|
|
102
|
+
onChange(safeValue);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Handle value changes
|
|
108
|
+
*/
|
|
109
|
+
async function handleChange(newValue: number | number[]) {
|
|
110
|
+
try {
|
|
111
|
+
// Store current scroll position
|
|
112
|
+
const scrollPos = {
|
|
113
|
+
x: window.scrollX,
|
|
114
|
+
y: window.scrollY
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// Always validate and adjust the value
|
|
118
|
+
// For single number, convert to array format
|
|
119
|
+
const valueToValidate: [number, number] = Array.isArray(newValue)
|
|
120
|
+
? newValue as [number, number]
|
|
121
|
+
: [newValue, max];
|
|
122
|
+
|
|
123
|
+
const adjustedValue = validateAndAdjustValue(valueToValidate);
|
|
124
|
+
|
|
125
|
+
// Wait for next tick to prevent scroll jump
|
|
126
|
+
await tick();
|
|
127
|
+
onChange(adjustedValue);
|
|
128
|
+
|
|
129
|
+
// Restore scroll position
|
|
130
|
+
window.scrollTo(scrollPos.x, scrollPos.y);
|
|
131
|
+
} catch (error) {
|
|
132
|
+
console.error('Error in SliderRangeInputController.handleChange:', error);
|
|
133
|
+
// Fallback to a safe default value
|
|
134
|
+
const safeValue: [number, number] = [min, max];
|
|
135
|
+
onChange(safeValue);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
</script>
|
|
139
|
+
|
|
140
|
+
<!-- Range Slider Container -->
|
|
141
|
+
<SliderInputController
|
|
142
|
+
class={className}
|
|
143
|
+
label={label}
|
|
144
|
+
sliderType="multiple"
|
|
145
|
+
value={value}
|
|
146
|
+
min={min}
|
|
147
|
+
max={max}
|
|
148
|
+
step={step}
|
|
149
|
+
onChange={handleChange}
|
|
150
|
+
onFocus={onFocus}
|
|
151
|
+
config={config}
|
|
152
|
+
helpText={helpText}
|
|
153
|
+
autofocus={false}
|
|
154
|
+
/>
|
|
155
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
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 SliderRangeInputController: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
class?: string;
|
|
17
|
+
label: string;
|
|
18
|
+
value?: [number, number];
|
|
19
|
+
onChange: (newValue: [number, number]) => void;
|
|
20
|
+
config?: InputControllerConfig;
|
|
21
|
+
helpText?: string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Configuration Options
|
|
24
|
+
* Derived from config prop with fallbacks
|
|
25
|
+
*/ min?: number;
|
|
26
|
+
max?: number;
|
|
27
|
+
step?: number;
|
|
28
|
+
onFocus?: () => void;
|
|
29
|
+
}, {
|
|
30
|
+
[evt: string]: CustomEvent<any>;
|
|
31
|
+
}, {}, {}, string>;
|
|
32
|
+
type SliderRangeInputController = InstanceType<typeof SliderRangeInputController>;
|
|
33
|
+
export default SliderRangeInputController;
|