@widgetic/editor 3.11.3 → 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,364 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* DatePickerInputController
|
|
3
|
+
*
|
|
4
|
+
* A sophisticated date picker component that provides a user-friendly interface for date selection.
|
|
5
|
+
* Integrates with the shadcn UI library and handles complex date management and user interactions.
|
|
6
|
+
*
|
|
7
|
+
* Key Features:
|
|
8
|
+
* - Calendar-based date selection
|
|
9
|
+
* - Internationalized date handling
|
|
10
|
+
* - Dropdown management
|
|
11
|
+
* - Accessibility support
|
|
12
|
+
*
|
|
13
|
+
* Edge Cases:
|
|
14
|
+
* - Handles undefined dates
|
|
15
|
+
* - Manages focus states
|
|
16
|
+
* - Prevents scroll-related UI issues
|
|
17
|
+
* - Maintains dropdown state consistency
|
|
18
|
+
-->
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
// Svelte imports
|
|
22
|
+
import { onMount, onDestroy } from 'svelte';
|
|
23
|
+
|
|
24
|
+
// Shadcn UI Components
|
|
25
|
+
import { Button, Select } from '@widgetic/design-system/components';
|
|
26
|
+
import { Popover } from '@widgetic/design-system/components';
|
|
27
|
+
import { InputControllerHeader } from './index';
|
|
28
|
+
import { Calendar } from '@widgetic/design-system/components';
|
|
29
|
+
|
|
30
|
+
// Internationalized date imports
|
|
31
|
+
import { CalendarDate, getLocalTimeZone, today, DateFormatter } from "@internationalized/date";
|
|
32
|
+
import type { DateValue } from "@internationalized/date";
|
|
33
|
+
|
|
34
|
+
// Lucide Icons
|
|
35
|
+
import { IconCalendar } from '@widgetic/design-system/icons';
|
|
36
|
+
|
|
37
|
+
// Component props with TypeScript types
|
|
38
|
+
export let label: string;
|
|
39
|
+
export let value: any;
|
|
40
|
+
export let onChange: (newValue: CalendarDate) => void;
|
|
41
|
+
export let description: string | undefined = undefined;
|
|
42
|
+
export let controllerId: string;
|
|
43
|
+
export let openDropdowns: any;
|
|
44
|
+
export let toggleDropdown: (id: string) => void;
|
|
45
|
+
export let onFocus: () => void = () => {};
|
|
46
|
+
|
|
47
|
+
// Default to today's date in local timezone for placeholder
|
|
48
|
+
let placeholder = today(getLocalTimeZone());
|
|
49
|
+
let currentValue: CalendarDate | undefined;
|
|
50
|
+
|
|
51
|
+
// Month and year options setup
|
|
52
|
+
const monthFmt = new DateFormatter('en-US', { month: 'long' });
|
|
53
|
+
const monthOptions = [
|
|
54
|
+
"January", "February", "March", "April", "May", "June",
|
|
55
|
+
"July", "August", "September", "October", "November", "December"
|
|
56
|
+
].map((month, i) => ({ value: String(i + 1), label: month }));
|
|
57
|
+
|
|
58
|
+
const yearOptions = Array.from({ length: 100 }, (_, i) => {
|
|
59
|
+
const year = String(new Date().getFullYear() - i);
|
|
60
|
+
return { label: year, value: year };
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
$: defaultYear = placeholder ? {
|
|
64
|
+
value: String(placeholder.year),
|
|
65
|
+
label: String(placeholder.year)
|
|
66
|
+
} : undefined;
|
|
67
|
+
|
|
68
|
+
$: defaultMonth = placeholder ? {
|
|
69
|
+
value: String(placeholder.month),
|
|
70
|
+
label: monthFmt.format(placeholder.toDate(getLocalTimeZone()))
|
|
71
|
+
} : undefined;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Updates the current value when the external value changes
|
|
75
|
+
* Handles initialization and updates of the date state
|
|
76
|
+
* Creates a new CalendarDate instance to prevent reference issues
|
|
77
|
+
*/
|
|
78
|
+
function updateCurrentValue() {
|
|
79
|
+
console.log('🔄 [DatePicker] updateCurrentValue called with:', { value, type: typeof value });
|
|
80
|
+
|
|
81
|
+
if (!value) {
|
|
82
|
+
currentValue = undefined;
|
|
83
|
+
placeholder = today(getLocalTimeZone());
|
|
84
|
+
console.log('✅ [DatePicker] Set to undefined, placeholder:', placeholder);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (value instanceof CalendarDate) {
|
|
89
|
+
currentValue = value;
|
|
90
|
+
console.log('✅ [DatePicker] Already CalendarDate:', currentValue);
|
|
91
|
+
} else if (typeof value === 'object' && value !== null && 'year' in value && 'month' in value && 'day' in value) {
|
|
92
|
+
try {
|
|
93
|
+
currentValue = new CalendarDate(value.year, value.month, value.day);
|
|
94
|
+
console.log('✅ [DatePicker] Created CalendarDate from object:', { original: value, created: currentValue });
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.error('❌ [DatePicker] Failed to create CalendarDate from object:', { value, error });
|
|
97
|
+
currentValue = undefined;
|
|
98
|
+
}
|
|
99
|
+
} else {
|
|
100
|
+
console.warn('⚠️ [DatePicker] Invalid date value provided:', value);
|
|
101
|
+
currentValue = undefined;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
placeholder = currentValue ?? today(getLocalTimeZone());
|
|
105
|
+
console.log('🎯 [DatePicker] Final state:', { currentValue, placeholder });
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Watch for value changes and update internal state
|
|
109
|
+
$: value, updateCurrentValue();
|
|
110
|
+
|
|
111
|
+
// Track dropdown state through store subscription
|
|
112
|
+
$: open = $openDropdowns?.has(controllerId) || false;
|
|
113
|
+
|
|
114
|
+
// Computed values for Calendar component with extra safety
|
|
115
|
+
$: calendarValue = currentValue;
|
|
116
|
+
$: calendarDefaultMonth = placeholder;
|
|
117
|
+
$: isCalendarReady = placeholder instanceof CalendarDate;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Formats a CalendarDate for display
|
|
121
|
+
* Handles undefined dates and invalid objects
|
|
122
|
+
* Returns a user-friendly date string
|
|
123
|
+
* @param date - The date to format
|
|
124
|
+
* @returns Formatted date string
|
|
125
|
+
*/
|
|
126
|
+
function formatDate(date: CalendarDate | undefined): string {
|
|
127
|
+
if (!date || !(date instanceof CalendarDate)) return 'Pick a date';
|
|
128
|
+
try {
|
|
129
|
+
// Convert to JavaScript Date for localized formatting
|
|
130
|
+
const jsDate = new Date(date.year, date.month - 1, date.day);
|
|
131
|
+
return jsDate.toLocaleDateString('en-US', { dateStyle: 'long' });
|
|
132
|
+
} catch (error) {
|
|
133
|
+
console.error('Error formatting date:', error);
|
|
134
|
+
return 'Pick a date';
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Handles date selection from the calendar
|
|
140
|
+
* Validates the selected date and updates state
|
|
141
|
+
* Closes the dropdown after selection
|
|
142
|
+
* @param newValue - The newly selected date
|
|
143
|
+
*/
|
|
144
|
+
function handleSelect(newValue: DateValue | undefined) {
|
|
145
|
+
if (newValue instanceof CalendarDate) {
|
|
146
|
+
onChange(newValue);
|
|
147
|
+
toggleDropdown(controllerId);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Toggles the date picker dropdown visibility
|
|
153
|
+
* Manages dropdown state through the provided toggle function
|
|
154
|
+
*/
|
|
155
|
+
function handleToggle() {
|
|
156
|
+
toggleDropdown(controllerId);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Closes the dropdown if it's currently open
|
|
161
|
+
* Used for cleanup and external close triggers
|
|
162
|
+
*/
|
|
163
|
+
function closeDropdown() {
|
|
164
|
+
if (open) {
|
|
165
|
+
toggleDropdown(controllerId);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Handles scroll events to prevent UI issues
|
|
171
|
+
* Closes the dropdown when scrolling occurs outside the dropdowns
|
|
172
|
+
*/
|
|
173
|
+
function handleScroll(event: Event) {
|
|
174
|
+
// Ensure target is an HTMLElement
|
|
175
|
+
if (!(event.target instanceof HTMLElement)) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const target = event.target;
|
|
180
|
+
|
|
181
|
+
// Check if scroll happened inside our dropdowns
|
|
182
|
+
const isInsideDropdown = target.closest('.month-year-dropdown-content');
|
|
183
|
+
|
|
184
|
+
// If scrolling is inside our dropdowns, don't close
|
|
185
|
+
if (isInsideDropdown) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// If scrolling outside our dropdowns, close
|
|
190
|
+
if (open) {
|
|
191
|
+
closeDropdown();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Setup scroll event listener on mount
|
|
196
|
+
onMount(() => {
|
|
197
|
+
window.addEventListener('scroll', handleScroll, { capture: true });
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
// Cleanup scroll event listener on destroy
|
|
201
|
+
onDestroy(() => {
|
|
202
|
+
window.removeEventListener('scroll', handleScroll, true);
|
|
203
|
+
});
|
|
204
|
+
</script>
|
|
205
|
+
|
|
206
|
+
<!-- Date Picker Container -->
|
|
207
|
+
<div class="flex flex-col gap-2 widgetic-colors">
|
|
208
|
+
<div class="flex items-center w-full relative">
|
|
209
|
+
<div class="flex-1 min-w-0">
|
|
210
|
+
<InputControllerHeader {label} />
|
|
211
|
+
</div>
|
|
212
|
+
|
|
213
|
+
<div class="absolute right-0">
|
|
214
|
+
<div
|
|
215
|
+
class="h-[48px] w-[185px] rounded-large border border-grey2 flex items-center bg-grey1 transition-colors duration-200 hover:border-forest-green"
|
|
216
|
+
on:focusin={onFocus}
|
|
217
|
+
>
|
|
218
|
+
<Popover.Root {open} onOpenChange={handleToggle}>
|
|
219
|
+
<Popover.Trigger class="w-full h-full">
|
|
220
|
+
<div class="w-full h-full px-[16px] flex items-center">
|
|
221
|
+
<Button
|
|
222
|
+
id="date-picker"
|
|
223
|
+
variant="ghost"
|
|
224
|
+
class="w-full h-full justify-between text-left border-0 bg-transparent hover:bg-transparent focus:bg-transparent p-0 group"
|
|
225
|
+
>
|
|
226
|
+
<span class="subtext text-grey7 {!currentValue ? 'text-grey3' : ''}">{formatDate(currentValue)}</span>
|
|
227
|
+
<IconCalendar class="w-[20px] h-[20px] text-grey5 transition-colors duration-200 group-hover:text-grey7" />
|
|
228
|
+
</Button>
|
|
229
|
+
</div>
|
|
230
|
+
</Popover.Trigger>
|
|
231
|
+
|
|
232
|
+
<Popover.Content class="w-auto p-0 z-50" sideOffset={4}>
|
|
233
|
+
<div class="rounded-md border p-3">
|
|
234
|
+
<div class="flex w-full items-center justify-between gap-2 mb-3">
|
|
235
|
+
<Select.Root
|
|
236
|
+
type="single"
|
|
237
|
+
value={defaultMonth?.value}
|
|
238
|
+
onValueChange={(value: string) => {
|
|
239
|
+
if (!value || !placeholder) return;
|
|
240
|
+
const monthValue = parseInt(value, 10);
|
|
241
|
+
if (monthValue === placeholder?.month) return;
|
|
242
|
+
// Re-create placeholder/currValue using explicit CalendarDate constructor to ensure
|
|
243
|
+
// we pass a plain CalendarDate instance that the Calendar component can recognise.
|
|
244
|
+
placeholder = new CalendarDate(
|
|
245
|
+
placeholder.year,
|
|
246
|
+
monthValue,
|
|
247
|
+
placeholder.day
|
|
248
|
+
);
|
|
249
|
+
if (currentValue) {
|
|
250
|
+
const newValue = new CalendarDate(
|
|
251
|
+
currentValue.year,
|
|
252
|
+
monthValue,
|
|
253
|
+
currentValue.day
|
|
254
|
+
);
|
|
255
|
+
currentValue = newValue;
|
|
256
|
+
onChange(newValue);
|
|
257
|
+
}
|
|
258
|
+
}}
|
|
259
|
+
>
|
|
260
|
+
<Select.Trigger aria-label="Select month" class="w-[60%] month-year-dropdown-content">
|
|
261
|
+
<span class="text-sm">{defaultMonth?.label || "Select month"}</span>
|
|
262
|
+
</Select.Trigger>
|
|
263
|
+
<Select.Content class="max-h-[200px] overflow-y-auto month-year-dropdown-content">
|
|
264
|
+
{#each monthOptions as { value, label }}
|
|
265
|
+
<Select.Item {value} {label}>
|
|
266
|
+
{label}
|
|
267
|
+
</Select.Item>
|
|
268
|
+
{/each}
|
|
269
|
+
</Select.Content>
|
|
270
|
+
</Select.Root>
|
|
271
|
+
<Select.Root
|
|
272
|
+
type="single"
|
|
273
|
+
value={defaultYear?.value}
|
|
274
|
+
onValueChange={(value: string) => {
|
|
275
|
+
if (!value || !placeholder) return;
|
|
276
|
+
const yearValue = parseInt(value, 10);
|
|
277
|
+
if (yearValue === placeholder?.year) return;
|
|
278
|
+
// Same fix as above – ensure a clean CalendarDate instance.
|
|
279
|
+
placeholder = new CalendarDate(
|
|
280
|
+
yearValue,
|
|
281
|
+
placeholder.month,
|
|
282
|
+
placeholder.day
|
|
283
|
+
);
|
|
284
|
+
if (currentValue) {
|
|
285
|
+
const newValue = new CalendarDate(
|
|
286
|
+
yearValue,
|
|
287
|
+
currentValue.month,
|
|
288
|
+
currentValue.day
|
|
289
|
+
);
|
|
290
|
+
currentValue = newValue;
|
|
291
|
+
onChange(newValue);
|
|
292
|
+
}
|
|
293
|
+
}}
|
|
294
|
+
>
|
|
295
|
+
<Select.Trigger aria-label="Select year" class="w-[40%] month-year-dropdown-content">
|
|
296
|
+
<span class="text-sm">{defaultYear?.label || "Select year"}</span>
|
|
297
|
+
</Select.Trigger>
|
|
298
|
+
<Select.Content class="max-h-[200px] overflow-y-auto month-year-dropdown-content">
|
|
299
|
+
{#each yearOptions as { value, label }}
|
|
300
|
+
<Select.Item {value} {label}>
|
|
301
|
+
{label}
|
|
302
|
+
</Select.Item>
|
|
303
|
+
{/each}
|
|
304
|
+
</Select.Content>
|
|
305
|
+
</Select.Root>
|
|
306
|
+
</div>
|
|
307
|
+
<div class="calendar-no-header">
|
|
308
|
+
<Calendar
|
|
309
|
+
mode="single"
|
|
310
|
+
onValueChange={(date: DateValue | undefined) => {
|
|
311
|
+
console.log('📅 [DatePicker] Calendar onValueChange:', { date, isCalendarDate: date instanceof CalendarDate });
|
|
312
|
+
if (date instanceof CalendarDate) {
|
|
313
|
+
currentValue = date;
|
|
314
|
+
placeholder = date;
|
|
315
|
+
onChange(date);
|
|
316
|
+
closeDropdown();
|
|
317
|
+
}
|
|
318
|
+
}}
|
|
319
|
+
fixedWeeks
|
|
320
|
+
/>
|
|
321
|
+
</div>
|
|
322
|
+
</div>
|
|
323
|
+
</Popover.Content>
|
|
324
|
+
</Popover.Root>
|
|
325
|
+
</div>
|
|
326
|
+
</div>
|
|
327
|
+
</div>
|
|
328
|
+
|
|
329
|
+
{#if description}
|
|
330
|
+
<p class="subtext text-grey5">{description}</p>
|
|
331
|
+
{/if}
|
|
332
|
+
</div>
|
|
333
|
+
|
|
334
|
+
<style>
|
|
335
|
+
/* Remove focus ring from trigger */
|
|
336
|
+
:global(.date-picker-trigger:focus-visible) {
|
|
337
|
+
outline: none !important;
|
|
338
|
+
box-shadow: none !important;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/* Style the calendar content */
|
|
342
|
+
:global(.calendar-content) {
|
|
343
|
+
border: 1px solid hsl(var(--grey2)) !important;
|
|
344
|
+
background: white !important;
|
|
345
|
+
border-radius: var(--radius) !important;
|
|
346
|
+
margin-top: 4px !important;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/* Remove button styles */
|
|
350
|
+
:global(button.bg-transparent) {
|
|
351
|
+
outline: none !important;
|
|
352
|
+
box-shadow: none !important;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
:global(button.bg-transparent:hover),
|
|
356
|
+
:global(button.bg-transparent:focus) {
|
|
357
|
+
background-color: transparent !important;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/* Hide calendar header */
|
|
361
|
+
:global(.calendar-no-header header) {
|
|
362
|
+
display: none !important;
|
|
363
|
+
}
|
|
364
|
+
</style>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CalendarDate } from "@internationalized/date";
|
|
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 DatePickerInputController: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
label: string;
|
|
17
|
+
value: any;
|
|
18
|
+
onChange: (newValue: CalendarDate) => void;
|
|
19
|
+
description?: string | undefined;
|
|
20
|
+
controllerId: string;
|
|
21
|
+
openDropdowns: any;
|
|
22
|
+
toggleDropdown: (id: string) => void;
|
|
23
|
+
onFocus?: () => void;
|
|
24
|
+
}, {
|
|
25
|
+
[evt: string]: CustomEvent<any>;
|
|
26
|
+
}, {}, {}, string>;
|
|
27
|
+
type DatePickerInputController = InstanceType<typeof DatePickerInputController>;
|
|
28
|
+
export default DatePickerInputController;
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* DropdownInputController Component
|
|
4
|
+
* A reusable dropdown/select input component that handles selection from a list of options.
|
|
5
|
+
* Supports custom styling, external state management, and accessibility features.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Svelte Lifecycle Imports
|
|
10
|
+
* Required for component setup and cleanup
|
|
11
|
+
*/
|
|
12
|
+
import { onMount, onDestroy } from 'svelte';
|
|
13
|
+
import type { InputControllerConfig } from './index';
|
|
14
|
+
|
|
15
|
+
// Local Components imports
|
|
16
|
+
import { InputControllerHeader } from './index';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* UI Components Imports
|
|
20
|
+
* Shadcn UI select components for consistent styling and behavior
|
|
21
|
+
*/
|
|
22
|
+
import { Select } from '@widgetic/design-system/components';
|
|
23
|
+
|
|
24
|
+
// Icons imports
|
|
25
|
+
import { IconCaretDownFilled } from '@widgetic/design-system/icons';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Component Props
|
|
29
|
+
* External properties that configure the dropdown's behavior and appearance
|
|
30
|
+
*/
|
|
31
|
+
export let label: string; // Display label for the dropdown
|
|
32
|
+
export let defaultSelectedLabel: string = "Select an option"; // Default value for the dropdown
|
|
33
|
+
export let value: string | { value: string; label: string }; // Currently selected value
|
|
34
|
+
export let onChange: (newValue: string) => void; // Callback for value changes
|
|
35
|
+
export let config: InputControllerConfig = {}; // Additional configuration options
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Configuration Options
|
|
39
|
+
* Derived from config prop with fallbacks
|
|
40
|
+
*/
|
|
41
|
+
export let options: { value: string; label: string }[] = config.options || []; // Available options
|
|
42
|
+
export let description: string | undefined = undefined; // Optional help text
|
|
43
|
+
export let controllerId: string; // Unique identifier for the controller
|
|
44
|
+
export let openDropdowns: any; // External store tracking open dropdowns
|
|
45
|
+
export let toggleDropdown: (id: string) => void; // Function to toggle dropdown state
|
|
46
|
+
export let onFocus: () => void = () => {}; // Focus event handler
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Reactive State
|
|
50
|
+
* Tracks whether this dropdown is currently open
|
|
51
|
+
*/
|
|
52
|
+
$: open = $openDropdowns?.has(controllerId) || false;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Closes the dropdown if it's currently open
|
|
56
|
+
* Used for cleanup and external close triggers
|
|
57
|
+
*/
|
|
58
|
+
function closeDropdown() {
|
|
59
|
+
if (open) {
|
|
60
|
+
toggleDropdown(controllerId);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Scroll Event Handler
|
|
66
|
+
* Closes dropdown when scrolling occurs to prevent floating UI issues
|
|
67
|
+
*/
|
|
68
|
+
function handleScroll() {
|
|
69
|
+
closeDropdown();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Lifecycle Hooks
|
|
74
|
+
* Setup and cleanup of scroll event listeners
|
|
75
|
+
*/
|
|
76
|
+
onMount(() => {
|
|
77
|
+
// console.log('DropdownInputController: onMount:', value);
|
|
78
|
+
window.addEventListener('scroll', handleScroll, true);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
onDestroy(() => {
|
|
82
|
+
window.removeEventListener('scroll', handleScroll, true);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Value Change Handler
|
|
87
|
+
* Updates parent component and closes dropdown after selection
|
|
88
|
+
* @param newValue - The newly selected value
|
|
89
|
+
*/
|
|
90
|
+
function handleValueChange(newValue: string) {
|
|
91
|
+
console.log('DropdownInputController: handleValueChange', newValue);
|
|
92
|
+
onChange(newValue);
|
|
93
|
+
closeDropdown();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Open State Change Handler
|
|
98
|
+
* Ensures dropdown open state stays in sync with external store
|
|
99
|
+
* @param isOpen - Whether the dropdown should be open
|
|
100
|
+
*/
|
|
101
|
+
function handleOpenChange(isOpen: boolean) {
|
|
102
|
+
if (isOpen !== open) {
|
|
103
|
+
toggleDropdown(controllerId);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
$: triggerContent = options.find((o) => o.value === (value.value || value))?.label ?? defaultSelectedLabel;
|
|
108
|
+
</script>
|
|
109
|
+
|
|
110
|
+
<!-- Dropdown Container -->
|
|
111
|
+
<div class="dropdown-ic flex flex-col gap-2 widgetic-colors">
|
|
112
|
+
<div class="flex items-center w-full relative">
|
|
113
|
+
<div class="flex-1 min-w-0">
|
|
114
|
+
<InputControllerHeader {label} />
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
<div class="absolute right-0">
|
|
118
|
+
<div
|
|
119
|
+
class="dropdown-main-container rounded-large flex items-center transition-colors duration-200 group"
|
|
120
|
+
style="height: 48px; width: 185px; border: 1px solid hsl(var(--grey2)); background: hsl(var(--grey1));"
|
|
121
|
+
onfocusin={onFocus}
|
|
122
|
+
>
|
|
123
|
+
<Select.Root
|
|
124
|
+
type="single"
|
|
125
|
+
value={value.value || value}
|
|
126
|
+
onValueChange={handleValueChange}
|
|
127
|
+
open={open}
|
|
128
|
+
onOpenChange={handleOpenChange}
|
|
129
|
+
>
|
|
130
|
+
<Select.Trigger
|
|
131
|
+
class="dropdown-ic-trigger h-full w-full border-0 bg-transparent subtext hover:bg-transparent focus:bg-transparent data-[state=open]:bg-transparent"
|
|
132
|
+
style="padding-left: 16px; padding-right: 16px; color: hsl(var(--grey7));"
|
|
133
|
+
id={controllerId}
|
|
134
|
+
>
|
|
135
|
+
<span class="truncate flex-1 text-left subtext" style="color: hsl(var(--grey7));">
|
|
136
|
+
{triggerContent}
|
|
137
|
+
</span>
|
|
138
|
+
<IconCaretDownFilled class="dropdown-ic-trigger-icon" style="width: 20px; height: 20px; color: hsl(var(--grey5));"/>
|
|
139
|
+
</Select.Trigger>
|
|
140
|
+
|
|
141
|
+
<Select.Content
|
|
142
|
+
class="dropdown-ic-content widgetic-colors shadow-md"
|
|
143
|
+
style="min-width: 185px; background: white; border: 1px solid hsl(var(--grey2)); border-radius: var(--radius);"
|
|
144
|
+
strategy="fixed"
|
|
145
|
+
sideOffset={4}
|
|
146
|
+
>
|
|
147
|
+
{#each options as option}
|
|
148
|
+
<Select.Item
|
|
149
|
+
value={option.value}
|
|
150
|
+
label={option.label}
|
|
151
|
+
class="dropdown-ic-item h6 px-4 py-2 cursor-pointer"
|
|
152
|
+
style="color: hsl(var(--grey5)); gap: 20px;"
|
|
153
|
+
>
|
|
154
|
+
{option.label}
|
|
155
|
+
</Select.Item>
|
|
156
|
+
{/each}
|
|
157
|
+
</Select.Content>
|
|
158
|
+
</Select.Root>
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
{#if description}
|
|
164
|
+
<p class="subtext" style="color: hsl(var(--grey5));">{description}</p>
|
|
165
|
+
{/if}
|
|
166
|
+
</div>
|
|
167
|
+
|
|
168
|
+
<style>
|
|
169
|
+
.dropdown-main-container:hover {
|
|
170
|
+
border-color: hsl(var(--forest-green)) !important;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/* Remove focus ring from trigger */
|
|
174
|
+
:global(.dropdown-input-controller [data-radix-select-trigger]) {
|
|
175
|
+
outline: none !important;
|
|
176
|
+
box-shadow: none !important;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* Style the dropdown content */
|
|
180
|
+
:global(.dropdown-input-controller [role="listbox"]) {
|
|
181
|
+
border: 1px solid hsl(var(--grey2)) !important;
|
|
182
|
+
background: white !important;
|
|
183
|
+
border-radius: var(--radius) !important;
|
|
184
|
+
margin-top: 0 !important;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* Style the dropdown items */
|
|
188
|
+
:global(.dropdown-input-controller [role="option"]) {
|
|
189
|
+
padding: 8px 16px !important;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
:global(.dropdown-input-controller [role="option"][data-highlighted]) {
|
|
193
|
+
background: white !important;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
:global(.dropdown-input-controller [role="option"][aria-selected="true"]) {
|
|
197
|
+
color: hsl(var(--sage-green)) !important;
|
|
198
|
+
background: hsl(var(--light-green)) !important;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/* Dropdown Item */
|
|
202
|
+
:global(.dropdown-ic-item[data-selected]) {
|
|
203
|
+
background-color: hsl(var(--sage-green)) !important;
|
|
204
|
+
color: hsl(var(--light-green)) !important;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* set position relative to the check icon parent */
|
|
208
|
+
:global(.dropdown-ic-item > span) {
|
|
209
|
+
position: relative !important;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/* Remove checkmark icon
|
|
213
|
+
:global(.dropdown-ic-item > span > .lucide-check) {
|
|
214
|
+
display: none !important;
|
|
215
|
+
}*/
|
|
216
|
+
|
|
217
|
+
:global(.dropdown-ic-trigger .lucide-chevron-down) {
|
|
218
|
+
display: none;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/* Override bits-ui floating wrapper z-index (default 50 is too low).
|
|
222
|
+
The wrapper is portaled to body by bits-ui, so we target it globally. */
|
|
223
|
+
:global([data-bits-floating-content-wrapper]) {
|
|
224
|
+
z-index: 99999 !important;
|
|
225
|
+
}
|
|
226
|
+
</style>
|
|
@@ -0,0 +1,43 @@
|
|
|
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 DropdownInputController: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
/**
|
|
17
|
+
* Component Props
|
|
18
|
+
* External properties that configure the dropdown's behavior and appearance
|
|
19
|
+
*/ label: string;
|
|
20
|
+
defaultSelectedLabel?: string;
|
|
21
|
+
value: string | {
|
|
22
|
+
value: string;
|
|
23
|
+
label: string;
|
|
24
|
+
};
|
|
25
|
+
onChange: (newValue: string) => void;
|
|
26
|
+
config?: InputControllerConfig;
|
|
27
|
+
/**
|
|
28
|
+
* Configuration Options
|
|
29
|
+
* Derived from config prop with fallbacks
|
|
30
|
+
*/ options?: {
|
|
31
|
+
value: string;
|
|
32
|
+
label: string;
|
|
33
|
+
}[];
|
|
34
|
+
description?: string | undefined;
|
|
35
|
+
controllerId: string;
|
|
36
|
+
openDropdowns: any;
|
|
37
|
+
toggleDropdown: (id: string) => void;
|
|
38
|
+
onFocus?: () => void;
|
|
39
|
+
}, {
|
|
40
|
+
[evt: string]: CustomEvent<any>;
|
|
41
|
+
}, {}, {}, string>;
|
|
42
|
+
type DropdownInputController = InstanceType<typeof DropdownInputController>;
|
|
43
|
+
export default DropdownInputController;
|