@enact/limestone 1.3.0
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/.github/PULL_REQUEST_TEMPLATE.md +28 -0
- package/.github/workflows/update-copyright-years.yml +25 -0
- package/.travis.yml +40 -0
- package/ActionGuide/ActionGuide.d.ts +73 -0
- package/ActionGuide/ActionGuide.js +164 -0
- package/ActionGuide/ActionGuide.module.css +73 -0
- package/ActionGuide/package.json +3 -0
- package/ActionGuide/tests/ActionGuide-specs.js +51 -0
- package/Alert/Alert.d.ts +155 -0
- package/Alert/Alert.js +313 -0
- package/Alert/Alert.module.css +190 -0
- package/Alert/AlertImage.js +102 -0
- package/Alert/AlertImage.module.css +15 -0
- package/Alert/package.json +3 -0
- package/Alert/tests/Alert-specs.js +204 -0
- package/BodyText/BodyText.d.ts +74 -0
- package/BodyText/BodyText.js +170 -0
- package/BodyText/BodyText.module.css +95 -0
- package/BodyText/package.json +3 -0
- package/BodyText/tests/BodyText-specs.js +55 -0
- package/Button/Button.d.ts +131 -0
- package/Button/Button.js +351 -0
- package/Button/Button.module.css +2518 -0
- package/Button/package.json +3 -0
- package/Button/tests/Button-specs.js +252 -0
- package/CHANGELOG.md +170 -0
- package/Card/Card.d.ts +138 -0
- package/Card/Card.js +396 -0
- package/Card/Card.module.css +1296 -0
- package/Card/package.json +3 -0
- package/Card/tests/Card-specs.js +65 -0
- package/Checkbox/Checkbox.d.ts +99 -0
- package/Checkbox/Checkbox.js +222 -0
- package/Checkbox/Checkbox.module.css +1395 -0
- package/Checkbox/package.json +3 -0
- package/Checkbox/tests/Checkbox-specs.js +79 -0
- package/CheckboxItem/CheckboxItem.d.ts +99 -0
- package/CheckboxItem/CheckboxItem.js +210 -0
- package/CheckboxItem/CheckboxItem.module.css +50 -0
- package/CheckboxItem/package.json +3 -0
- package/CheckboxItem/tests/CheckboxItem-specs.js +52 -0
- package/Chips/Chip.js +252 -0
- package/Chips/Chip.module.css +30 -0
- package/Chips/Chips.js +215 -0
- package/Chips/Chips.module.css +8 -0
- package/Chips/index.js +86 -0
- package/Chips/tests/Chip-specs.js +186 -0
- package/Chips/tests/Chips-specs.js +312 -0
- package/ColorPicker/ColorPicker.js +416 -0
- package/ColorPicker/ColorPicker.module.css +78 -0
- package/ColorPicker/package.json +3 -0
- package/ColorPicker/tests/ColorPicker-specs.js +225 -0
- package/ColorPicker/utils.js +135 -0
- package/ContextualMenuDecorator/ContextualMenuDecorator.d.ts +106 -0
- package/ContextualMenuDecorator/ContextualMenuDecorator.js +264 -0
- package/ContextualMenuDecorator/ContextualMenuDecorator.module.css +42 -0
- package/ContextualMenuDecorator/package.json +3 -0
- package/ContextualMenuDecorator/tests/ContextualMenuDecorator-specs.js +136 -0
- package/ContextualPopupDecorator/ContextualPopup.js +200 -0
- package/ContextualPopupDecorator/ContextualPopup.module.css +270 -0
- package/ContextualPopupDecorator/ContextualPopupDecorator.d.ts +182 -0
- package/ContextualPopupDecorator/ContextualPopupDecorator.js +867 -0
- package/ContextualPopupDecorator/ContextualPopupDecorator.module.css +3 -0
- package/ContextualPopupDecorator/HolePunchScrim.js +69 -0
- package/ContextualPopupDecorator/HolePunchScrim.module.css +38 -0
- package/ContextualPopupDecorator/package.json +3 -0
- package/ContextualPopupDecorator/tests/ContextualPopupDecorator-specs.js +621 -0
- package/DatePicker/DatePicker.d.ts +173 -0
- package/DatePicker/DatePicker.js +175 -0
- package/DatePicker/DatePicker.module.css +5 -0
- package/DatePicker/DatePickerBase.js +348 -0
- package/DatePicker/package.json +3 -0
- package/DatePicker/tests/DatePicker-specs.js +247 -0
- package/DayPicker/DayPicker.d.ts +92 -0
- package/DayPicker/DayPicker.js +188 -0
- package/DayPicker/DayPicker.module.css +35 -0
- package/DayPicker/DaySelectorDecorator.js +301 -0
- package/DayPicker/package.json +3 -0
- package/DayPicker/tests/DayPicker-specs.js +138 -0
- package/Dropdown/Dropdown.d.ts +135 -0
- package/Dropdown/Dropdown.js +460 -0
- package/Dropdown/Dropdown.module.css +160 -0
- package/Dropdown/DropdownList.js +360 -0
- package/Dropdown/package.json +3 -0
- package/Dropdown/tests/Dropdown-specs.js +267 -0
- package/FixedPopupPanels/FixedPopupPanels.d.ts +72 -0
- package/FixedPopupPanels/FixedPopupPanels.js +170 -0
- package/FixedPopupPanels/FixedPopupPanels.module.css +146 -0
- package/FixedPopupPanels/package.json +3 -0
- package/FixedPopupPanels/tests/FixedPopupPanels-specs.js +142 -0
- package/FlexiblePopupPanels/FlexiblePopupPanels.js +177 -0
- package/FlexiblePopupPanels/FlexiblePopupPanels.module.css +291 -0
- package/FlexiblePopupPanels/Header.js +110 -0
- package/FlexiblePopupPanels/Panel.js +256 -0
- package/FlexiblePopupPanels/index.d.ts +145 -0
- package/FlexiblePopupPanels/index.js +68 -0
- package/FlexiblePopupPanels/package.json +3 -0
- package/FlexiblePopupPanels/tests/FlexiblePopupPanels-specs.js +305 -0
- package/FlexiblePopupPanels/useNavButtonFocus.js +65 -0
- package/FormCheckboxItem/FormCheckboxItem.d.ts +87 -0
- package/FormCheckboxItem/FormCheckboxItem.js +200 -0
- package/FormCheckboxItem/FormCheckboxItem.module.css +374 -0
- package/FormCheckboxItem/package.json +3 -0
- package/FormCheckboxItem/tests/FormCheckboxItem-specs.js +164 -0
- package/Heading/Heading.d.ts +104 -0
- package/Heading/Heading.js +203 -0
- package/Heading/Heading.module.css +217 -0
- package/Heading/package.json +3 -0
- package/Heading/tests/Heading-specs.js +57 -0
- package/Icon/Icon.d.ts +377 -0
- package/Icon/Icon.js +503 -0
- package/Icon/Icon.module.css +121 -0
- package/Icon/IconList.js +611 -0
- package/Icon/package.json +3 -0
- package/Icon/tests/Icon-specs.js +131 -0
- package/IconItem/IconItem.d.ts +137 -0
- package/IconItem/IconItem.js +360 -0
- package/IconItem/IconItem.module.css +414 -0
- package/IconItem/package.json +3 -0
- package/IconItem/tests/IconItem-specs.js +106 -0
- package/Image/Image.d.ts +60 -0
- package/Image/Image.js +165 -0
- package/Image/Image.module.css +5 -0
- package/Image/package.json +3 -0
- package/Image/tests/Image-specs.js +62 -0
- package/ImageItem/ImageItem.d.ts +134 -0
- package/ImageItem/ImageItem.js +377 -0
- package/ImageItem/ImageItem.module.css +1079 -0
- package/ImageItem/package.json +3 -0
- package/ImageItem/tests/ImageItem-specs.js +223 -0
- package/Input/Input.js +715 -0
- package/Input/Input.module.css +699 -0
- package/Input/InputField.js +487 -0
- package/Input/InputField.module.css +763 -0
- package/Input/InputFieldDecoratorIcon.js +66 -0
- package/Input/InputFieldSpotlightDecorator.js +380 -0
- package/Input/Keypad.js +111 -0
- package/Input/NumberField.js +311 -0
- package/Input/index.d.ts +423 -0
- package/Input/index.js +87 -0
- package/Input/package.json +3 -0
- package/Input/pointer.js +103 -0
- package/Input/tests/Input-specs.js +537 -0
- package/Input/tests/InputField-specs.js +292 -0
- package/Input/tests/InputPopup-specs.js +56 -0
- package/Input/util.js +130 -0
- package/Item/Item.d.ts +108 -0
- package/Item/Item.js +360 -0
- package/Item/Item.module.css +665 -0
- package/Item/package.json +3 -0
- package/Item/tests/Item-specs.js +108 -0
- package/KeyGuide/KeyGuide.d.ts +103 -0
- package/KeyGuide/KeyGuide.js +254 -0
- package/KeyGuide/KeyGuide.module.css +431 -0
- package/KeyGuide/package.json +3 -0
- package/KeyGuide/tests/KeyGuide-specs.js +168 -0
- package/LICENSE +201 -0
- package/Marquee/Marquee.d.ts +42 -0
- package/Marquee/Marquee.js +45 -0
- package/Marquee/package.json +3 -0
- package/MediaOverlay/MediaOverlay.d.ts +134 -0
- package/MediaOverlay/MediaOverlay.js +304 -0
- package/MediaOverlay/MediaOverlay.module.css +292 -0
- package/MediaOverlay/package.json +3 -0
- package/MediaOverlay/tests/MediaOverlay-specs.js +127 -0
- package/MediaPlayer/MediaControls.js +934 -0
- package/MediaPlayer/MediaControls.module.css +86 -0
- package/MediaPlayer/MediaKnob.js +61 -0
- package/MediaPlayer/MediaSlider.js +131 -0
- package/MediaPlayer/MediaSlider.module.css +319 -0
- package/MediaPlayer/MediaSliderDecorator.js +245 -0
- package/MediaPlayer/Times.js +152 -0
- package/MediaPlayer/Times.module.css +34 -0
- package/MediaPlayer/index.d.ts +223 -0
- package/MediaPlayer/index.js +34 -0
- package/MediaPlayer/package.json +3 -0
- package/MediaPlayer/tests/MediaSlider-specs.js +126 -0
- package/MediaPlayer/tests/util-specs.js +114 -0
- package/MediaPlayer/util.js +83 -0
- package/PageViews/Page.js +77 -0
- package/PageViews/Page.module.css +3 -0
- package/PageViews/PageViews.js +440 -0
- package/PageViews/PageViews.module.css +175 -0
- package/PageViews/PageViewsRouter.js +150 -0
- package/PageViews/index.js +45 -0
- package/PageViews/tests/PageViews-specs.js +192 -0
- package/Panels/Header.js +599 -0
- package/Panels/Header.module.css +243 -0
- package/Panels/Panel.js +347 -0
- package/Panels/Panel.module.css +33 -0
- package/Panels/Panels.js +258 -0
- package/Panels/Panels.module.css +12 -0
- package/Panels/index.d.ts +376 -0
- package/Panels/index.js +66 -0
- package/Panels/package.json +3 -0
- package/Panels/tests/Header-specs.js +146 -0
- package/Panels/tests/Panels-specs.js +257 -0
- package/Picker/Picker.d.ts +193 -0
- package/Picker/Picker.js +389 -0
- package/Picker/Picker.module.css +46 -0
- package/Picker/package.json +3 -0
- package/Picker/tests/Picker-specs.js +91 -0
- package/Popup/Popup.d.ts +169 -0
- package/Popup/Popup.js +690 -0
- package/Popup/Popup.module.css +180 -0
- package/Popup/package.json +3 -0
- package/Popup/tests/Popup-specs.js +475 -0
- package/PopupTabLayout/PopupTabLayout.d.ts +196 -0
- package/PopupTabLayout/PopupTabLayout.js +605 -0
- package/PopupTabLayout/PopupTabLayout.module.css +226 -0
- package/PopupTabLayout/package.json +3 -0
- package/PopupTabLayout/tests/PopupTabLayout-specs.js +285 -0
- package/ProgressBar/ProgressBar.d.ts +171 -0
- package/ProgressBar/ProgressBar.js +223 -0
- package/ProgressBar/ProgressBar.module.css +264 -0
- package/ProgressBar/ProgressBarTooltip.js +359 -0
- package/ProgressBar/ProgressBarTooltip.module.css +86 -0
- package/ProgressBar/package.json +3 -0
- package/ProgressBar/tests/ProgressBar-specs.js +400 -0
- package/ProgressButton/ProgressButton.d.ts +57 -0
- package/ProgressButton/ProgressButton.js +143 -0
- package/ProgressButton/ProgressButton.module.css +147 -0
- package/ProgressButton/package.json +3 -0
- package/ProgressButton/tests/ProgressButton-specs.js +71 -0
- package/QuickGuidePanels/Panel.js +90 -0
- package/QuickGuidePanels/QuickGuidePanels.js +463 -0
- package/QuickGuidePanels/QuickGuidePanels.module.css +26 -0
- package/QuickGuidePanels/index.js +52 -0
- package/QuickGuidePanels/tests/QuickGuidePanels-specs.js +250 -0
- package/README.md +59 -0
- package/RadioItem/RadioItem.d.ts +59 -0
- package/RadioItem/RadioItem.js +146 -0
- package/RadioItem/RadioItem.module.css +233 -0
- package/RadioItem/package.json +3 -0
- package/RadioItem/tests/RadioItem-specs.js +62 -0
- package/RangePicker/RangePicker.d.ts +174 -0
- package/RangePicker/RangePicker.js +372 -0
- package/RangePicker/RangePicker.module.css +55 -0
- package/RangePicker/package.json +3 -0
- package/RangePicker/tests/RangePicker-specs.js +122 -0
- package/Region/Region.d.ts +33 -0
- package/Region/Region.js +91 -0
- package/Region/package.json +3 -0
- package/Region/tests/Region-specs.js +28 -0
- package/Scroller/ContentContainerDecorator.js +24 -0
- package/Scroller/EditableWrapper.js +1036 -0
- package/Scroller/EditableWrapper.module.css +22 -0
- package/Scroller/Scroller.d.ts +270 -0
- package/Scroller/Scroller.js +470 -0
- package/Scroller/Scroller.module.css +41 -0
- package/Scroller/package.json +3 -0
- package/Scroller/tests/ContentContainerDecorator-specs.js +20 -0
- package/Scroller/tests/EditableWrapper-specs.js +133 -0
- package/Scroller/tests/Scroller-specs.js +159 -0
- package/Scroller/useEvent.js +39 -0
- package/Scroller/useThemeScroller.js +410 -0
- package/Skinnable/Skinnable.d.ts +27 -0
- package/Skinnable/Skinnable.js +65 -0
- package/Skinnable/package.json +3 -0
- package/Slider/Slider.d.ts +218 -0
- package/Slider/Slider.js +441 -0
- package/Slider/Slider.module.css +880 -0
- package/Slider/SliderBehaviorDecorator.js +184 -0
- package/Slider/package.json +3 -0
- package/Slider/tests/Slider-specs.js +573 -0
- package/Slider/utils.js +114 -0
- package/Spinner/Spinner.d.ts +64 -0
- package/Spinner/Spinner.js +254 -0
- package/Spinner/Spinner.module.css +368 -0
- package/Spinner/package.json +3 -0
- package/Spinner/tests/Spinner-specs.js +70 -0
- package/Sprite/Sprite.d.ts +100 -0
- package/Sprite/Sprite.js +345 -0
- package/Sprite/Sprite.module.css +32 -0
- package/Sprite/package.json +3 -0
- package/Sprite/tests/Sprite-specs.js +59 -0
- package/Steps/Steps.d.ts +119 -0
- package/Steps/Steps.js +303 -0
- package/Steps/Steps.module.css +130 -0
- package/Steps/package.json +3 -0
- package/Steps/tests/Steps-specs.js +175 -0
- package/Switch/Switch.d.ts +54 -0
- package/Switch/Switch.js +143 -0
- package/Switch/Switch.module.css +714 -0
- package/Switch/package.json +3 -0
- package/Switch/tests/Switch-specs.js +54 -0
- package/SwitchItem/SwitchItem.d.ts +56 -0
- package/SwitchItem/SwitchItem.js +144 -0
- package/SwitchItem/SwitchItem.module.css +31 -0
- package/SwitchItem/package.json +3 -0
- package/SwitchItem/tests/SwitchItem-specs.js +49 -0
- package/TabLayout/RefocusDecorator.js +142 -0
- package/TabLayout/Tab.js +84 -0
- package/TabLayout/TabGroup.js +377 -0
- package/TabLayout/TabGroup.module.css +280 -0
- package/TabLayout/TabLayout.d.ts +161 -0
- package/TabLayout/TabLayout.js +661 -0
- package/TabLayout/TabLayout.module.css +101 -0
- package/TabLayout/package.json +3 -0
- package/TabLayout/tests/TabGroup-specs.js +214 -0
- package/TabLayout/tests/TabLayout-specs.js +740 -0
- package/ThemeDecorator/AccessibilityDecorator.js +151 -0
- package/ThemeDecorator/I18nFontDecorator.js +33 -0
- package/ThemeDecorator/ThemeDecorator.d.ts +143 -0
- package/ThemeDecorator/ThemeDecorator.js +307 -0
- package/ThemeDecorator/ThemeDecorator.module.css +1250 -0
- package/ThemeDecorator/fontGenerator.js +76 -0
- package/ThemeDecorator/package.json +3 -0
- package/ThemeDecorator/screenTypes.json +10 -0
- package/ThemeDecorator/tests/ThemeDecorator-specs.js +151 -0
- package/TimePicker/TimePicker.d.ts +147 -0
- package/TimePicker/TimePicker.js +255 -0
- package/TimePicker/TimePicker.module.css +61 -0
- package/TimePicker/TimePickerBase.js +396 -0
- package/TimePicker/package.json +3 -0
- package/TimePicker/tests/TimePicker-specs.js +248 -0
- package/TooltipDecorator/Tooltip.js +252 -0
- package/TooltipDecorator/Tooltip.module.css +496 -0
- package/TooltipDecorator/TooltipDecorator.d.ts +229 -0
- package/TooltipDecorator/TooltipDecorator.js +260 -0
- package/TooltipDecorator/TooltipLabel.js +117 -0
- package/TooltipDecorator/package.json +3 -0
- package/TooltipDecorator/tests/TooltipDecorator-specs.js +224 -0
- package/TooltipDecorator/tests/useTooltip-specs.js +266 -0
- package/TooltipDecorator/useTooltip.js +278 -0
- package/TooltipDecorator/util.js +273 -0
- package/VideoPlayer/Feedback.js +110 -0
- package/VideoPlayer/Feedback.module.css +55 -0
- package/VideoPlayer/FeedbackContent.js +99 -0
- package/VideoPlayer/FeedbackIcon.js +67 -0
- package/VideoPlayer/FeedbackIcons.js +76 -0
- package/VideoPlayer/FeedbackTooltip.js +242 -0
- package/VideoPlayer/FeedbackTooltip.module.css +160 -0
- package/VideoPlayer/MediaTitle.js +143 -0
- package/VideoPlayer/MediaTitle.module.css +95 -0
- package/VideoPlayer/Overlay.js +51 -0
- package/VideoPlayer/Video.js +345 -0
- package/VideoPlayer/VideoPlayer.d.ts +582 -0
- package/VideoPlayer/VideoPlayer.js +2116 -0
- package/VideoPlayer/VideoPlayer.module.css +164 -0
- package/VideoPlayer/package.json +3 -0
- package/VideoPlayer/tests/Video-specs.js +235 -0
- package/VideoPlayer/tests/VideoPlayer-specs.js +180 -0
- package/VirtualList/VirtualList.d.ts +411 -0
- package/VirtualList/VirtualList.js +931 -0
- package/VirtualList/VirtualList.module.css +52 -0
- package/VirtualList/package.json +3 -0
- package/VirtualList/tests/VirtualGridList-specs.js +289 -0
- package/VirtualList/tests/VirtualGridList-translate-specs.js +711 -0
- package/VirtualList/tests/VirtualList-specs.js +288 -0
- package/VirtualList/tests/VirtualList-translate-specs.js +704 -0
- package/VirtualList/tests/useEvent-specs.js +172 -0
- package/VirtualList/tests/useEvent-translate-specs.js +309 -0
- package/VirtualList/useEvent.js +324 -0
- package/VirtualList/usePreventScroll.js +31 -0
- package/VirtualList/useSpotlight.js +157 -0
- package/VirtualList/useThemeVirtualList.js +471 -0
- package/VirtualList/useThemeVirtualList.module.css +34 -0
- package/WizardPanels/Panel.js +99 -0
- package/WizardPanels/WizardPanels.js +501 -0
- package/WizardPanels/WizardPanels.module.css +15 -0
- package/WizardPanels/index.d.ts +182 -0
- package/WizardPanels/index.js +50 -0
- package/WizardPanels/package.json +3 -0
- package/WizardPanels/tests/WizardPanels-specs.js +713 -0
- package/codecov.yml +13 -0
- package/fonts/Limestone_Icons.ttf +0 -0
- package/fonts/Miso/LICENSE.txt +75 -0
- package/fonts/Miso/Miso-Bold.ttf +0 -0
- package/fonts/Miso/Miso-Light.ttf +0 -0
- package/fonts/Miso/Miso-Regular.ttf +0 -0
- package/fonts/MuseoSans/LICENSE.txt +75 -0
- package/fonts/MuseoSans/MuseoSans-Black.ttf +0 -0
- package/fonts/MuseoSans/MuseoSans-BlackItalic.ttf +0 -0
- package/fonts/MuseoSans/MuseoSans-Bold.ttf +0 -0
- package/fonts/MuseoSans/MuseoSans-BoldItalic.ttf +0 -0
- package/fonts/MuseoSans/MuseoSans-Light.ttf +0 -0
- package/fonts/MuseoSans/MuseoSans-Medium.ttf +0 -0
- package/fonts/MuseoSans/MuseoSans-MediumItalic.ttf +0 -0
- package/fonts/MuseoSans/MuseoSans-Thin.ttf +0 -0
- package/index.js +2 -0
- package/internal/$L/$L.d.ts +21 -0
- package/internal/$L/$L.js +97 -0
- package/internal/$L/package.json +3 -0
- package/internal/AsyncRenderChildren/AsyncRenderChildren.js +74 -0
- package/internal/AsyncRenderChildren/package.json +3 -0
- package/internal/AsyncRenderChildren/tests/AsyncRenderChildren-specs.js +49 -0
- package/internal/DateComponentPicker/DateComponentPicker.js +165 -0
- package/internal/DateComponentPicker/DateComponentPicker.module.css +53 -0
- package/internal/DateComponentPicker/DateComponentRangePicker.js +132 -0
- package/internal/DateComponentPicker/index.js +31 -0
- package/internal/DateComponentPicker/package.json +3 -0
- package/internal/DateTime/DateTime.js +83 -0
- package/internal/DateTime/DateTime.module.css +51 -0
- package/internal/DateTime/DateTimeDecorator.js +268 -0
- package/internal/DateTime/index.js +37 -0
- package/internal/DateTime/package.json +3 -0
- package/internal/DateTime/tests/DateTimeDecorator-specs.js +33 -0
- package/internal/DebounceDecorator/DebounceDecorator.js +125 -0
- package/internal/DebounceDecorator/package.json +3 -0
- package/internal/DebounceDecorator/tests/DebounceDecorator-specs.js +151 -0
- package/internal/Panels/Arrangers.js +248 -0
- package/internal/Panels/CancelDecorator.js +43 -0
- package/internal/Panels/FloatingLayerIdProvider.js +27 -0
- package/internal/Panels/NavigationButton.js +64 -0
- package/internal/Panels/NavigationButton.module.css +69 -0
- package/internal/Panels/PanelsRouter.js +223 -0
- package/internal/Panels/PopupDecorator.js +287 -0
- package/internal/Panels/TransitionDecorator.js +99 -0
- package/internal/Panels/Viewport.js +313 -0
- package/internal/Panels/Viewport.module.css +25 -0
- package/internal/Panels/captureKeys.js +48 -0
- package/internal/Panels/index.js +101 -0
- package/internal/Panels/package.json +3 -0
- package/internal/Panels/useAutoFocus.js +95 -0
- package/internal/Panels/useFocusOnTransition.js +45 -0
- package/internal/Panels/useToggleRole.js +30 -0
- package/internal/Panels/util.js +64 -0
- package/internal/Picker/Picker.js +942 -0
- package/internal/Picker/Picker.module.css +1145 -0
- package/internal/Picker/PickerButton.js +97 -0
- package/internal/Picker/PickerItem.js +38 -0
- package/internal/Picker/SpottablePicker.js +63 -0
- package/internal/Picker/package.json +3 -0
- package/internal/Picker/tests/Picker-specs.js +968 -0
- package/internal/SharedStateDecorator/SharedStateDecorator.js +167 -0
- package/internal/SharedStateDecorator/package.json +3 -0
- package/internal/SharedStateDecorator/tests/SharedStateDecorator-specs.js +277 -0
- package/internal/WindowEventable/WindowEventable.js +114 -0
- package/internal/WindowEventable/package.json +3 -0
- package/internal/util/package.json +3 -0
- package/internal/util/util.js +79 -0
- package/internal/validators/package.json +4 -0
- package/internal/validators/tests/validators-specs.js +80 -0
- package/internal/validators/validators.js +136 -0
- package/package.json +69 -0
- package/resources/ilibmanifest.json +3 -0
- package/styles/color-mixins.less +230 -0
- package/styles/colors-game-green.less +25 -0
- package/styles/colors-game-orange.less +25 -0
- package/styles/colors-game.less +56 -0
- package/styles/colors-highcontrast.less +21 -0
- package/styles/colors.less +435 -0
- package/styles/mixins.less +337 -0
- package/styles/skin.less +54 -0
- package/styles/variables-base.less +32 -0
- package/styles/variables-game.less +25 -0
- package/styles/variables.less +1182 -0
- package/useScroll/HoverToScroll.js +265 -0
- package/useScroll/HoverToScroll.module.css +38 -0
- package/useScroll/OverscrollEffect.module.css +14 -0
- package/useScroll/Scrollbar.js +171 -0
- package/useScroll/Scrollbar.module.css +19 -0
- package/useScroll/ScrollbarPlaceholder.js +64 -0
- package/useScroll/ScrollbarTrack.js +209 -0
- package/useScroll/ScrollbarTrack.module.css +136 -0
- package/useScroll/package.json +3 -0
- package/useScroll/useEvent.js +693 -0
- package/useScroll/useOverscrollEffect.js +105 -0
- package/useScroll/useScroll.js +523 -0
- package/useScroll/useScroll.module.css +49 -0
- package/useScroll/useSpotlight.js +32 -0
- package/useScroll/useThemeScrollContentHandle.js +32 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.SharedStateDecorator = exports.SharedState = void 0;
|
|
7
|
+
var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
15
|
+
function _objectDestructuringEmpty(t) { if (null == t) throw new TypeError("Cannot destructure " + t); }
|
|
16
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
17
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
18
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
19
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
20
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
21
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
22
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
23
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
24
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
25
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
26
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
27
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
28
|
+
var SharedState = exports.SharedState = /*#__PURE__*/(0, _react.createContext)(null);
|
|
29
|
+
var defaultConfig = {
|
|
30
|
+
idProp: 'id',
|
|
31
|
+
updateOnMount: false
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Adds shared state to a component.
|
|
36
|
+
*
|
|
37
|
+
* The purpose of shared state is to store framework component state at significant container
|
|
38
|
+
* boundaries in order to restore it when the "same" component is mounted later.
|
|
39
|
+
*
|
|
40
|
+
* "Sameness" is determined by the `idProp` config member (defaults to "id"). If multiple
|
|
41
|
+
* descendants have the same `idProp` within the subtree, SharedStateDecorator will not distinguish
|
|
42
|
+
* between them and will allow each to read from and write over each other's data.
|
|
43
|
+
*
|
|
44
|
+
* For example, Panels and Panel are considered "significant container boundaries" since they are
|
|
45
|
+
* key building blocks for limestone applications. When components are rendered within a Panel, we
|
|
46
|
+
* may want to store those components state on unmount so that we can restore it when returning to
|
|
47
|
+
* the panel. Panel can (and does) use SharedStateDecorator to establish a shared state which can be
|
|
48
|
+
* used by contained components.
|
|
49
|
+
*
|
|
50
|
+
* It's important to note that SharedStateDecorator doesn't prescribe how or what is stored nor how
|
|
51
|
+
* the data is managed. That is left to the consuming component to determine. Also, unlike React
|
|
52
|
+
* state or third-party state management solutions like Redux, updating shared state will not
|
|
53
|
+
* initiate an update cycle in React. The intent is only to restore state on mount.
|
|
54
|
+
*
|
|
55
|
+
* If shared state is used in the render method for a component, it may be necessary to use the
|
|
56
|
+
* `updateOnMount` config member which will initiate an update cycle within React once the data is
|
|
57
|
+
* available from an upstream shared state.
|
|
58
|
+
*
|
|
59
|
+
* @hoc
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
62
|
+
var SharedStateDecorator = exports.SharedStateDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
63
|
+
var _Class;
|
|
64
|
+
var idProp = config.idProp,
|
|
65
|
+
updateOnMount = config.updateOnMount;
|
|
66
|
+
return _Class = /*#__PURE__*/function (_Component) {
|
|
67
|
+
function _Class(props) {
|
|
68
|
+
var _this;
|
|
69
|
+
_classCallCheck(this, _Class);
|
|
70
|
+
_this = _callSuper(this, _Class, [props]);
|
|
71
|
+
_this.data = {};
|
|
72
|
+
_this.sharedState = _this.initSharedState();
|
|
73
|
+
_this.state = {
|
|
74
|
+
updateOnMount: false
|
|
75
|
+
};
|
|
76
|
+
return _this;
|
|
77
|
+
}
|
|
78
|
+
_inherits(_Class, _Component);
|
|
79
|
+
return _createClass(_Class, [{
|
|
80
|
+
key: "componentDidMount",
|
|
81
|
+
value: function componentDidMount() {
|
|
82
|
+
this.loadFromContext();
|
|
83
|
+
}
|
|
84
|
+
}, {
|
|
85
|
+
key: "componentDidUpdate",
|
|
86
|
+
value: function componentDidUpdate(prevProps) {
|
|
87
|
+
if (!prevProps.noSharedState && this.props.noSharedState) {
|
|
88
|
+
this.data = {};
|
|
89
|
+
} else if (prevProps.noSharedState && !this.props.noSharedState) {
|
|
90
|
+
this.loadFromContext();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
key: "isUpdateable",
|
|
95
|
+
value: function isUpdateable() {
|
|
96
|
+
var _this$props = this.props,
|
|
97
|
+
id = _this$props[idProp],
|
|
98
|
+
noSharedState = _this$props.noSharedState;
|
|
99
|
+
return !noSharedState && (id || id === 0);
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
key: "initSharedState",
|
|
103
|
+
value: function initSharedState() {
|
|
104
|
+
var _this2 = this;
|
|
105
|
+
return {
|
|
106
|
+
set: function set(key, value) {
|
|
107
|
+
var id = _this2.props[idProp];
|
|
108
|
+
if (_this2.isUpdateable()) {
|
|
109
|
+
_this2.data[id] = _this2.data[id] || {};
|
|
110
|
+
_this2.data[id][key] = value;
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
get: function get(key) {
|
|
114
|
+
var id = _this2.props[idProp];
|
|
115
|
+
return _this2.isUpdateable() && _this2.data[id] ? _this2.data[id][key] : null;
|
|
116
|
+
},
|
|
117
|
+
"delete": function _delete(key) {
|
|
118
|
+
var id = _this2.props[idProp];
|
|
119
|
+
if (_this2.isUpdateable() && _this2.data[id]) {
|
|
120
|
+
delete _this2.data[id][key];
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}, {
|
|
126
|
+
key: "loadFromContext",
|
|
127
|
+
value: function loadFromContext() {
|
|
128
|
+
var _this$props2 = this.props,
|
|
129
|
+
id = _this$props2[idProp],
|
|
130
|
+
noSharedState = _this$props2.noSharedState;
|
|
131
|
+
if (!noSharedState && this.context && this.context.get) {
|
|
132
|
+
var data = this.context.get(id);
|
|
133
|
+
if (data) {
|
|
134
|
+
this.data = data;
|
|
135
|
+
} else {
|
|
136
|
+
this.context.set(id, this.data);
|
|
137
|
+
}
|
|
138
|
+
if (updateOnMount) {
|
|
139
|
+
this.setState({
|
|
140
|
+
updateOnMount: true
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}, {
|
|
146
|
+
key: "render",
|
|
147
|
+
value: function render() {
|
|
148
|
+
var props = Object.assign({}, (_objectDestructuringEmpty(this.props), this.props));
|
|
149
|
+
delete props.noSharedState;
|
|
150
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(SharedState, {
|
|
151
|
+
value: this.sharedState,
|
|
152
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapped, _objectSpread({}, props))
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}]);
|
|
156
|
+
}(_react.Component), _Class.displayName = 'SharedStateDecorator', _Class.contextType = SharedState, _Class.propTypes = {
|
|
157
|
+
/**
|
|
158
|
+
* Prevents the component from setting or restoring any framework shared state.
|
|
159
|
+
*
|
|
160
|
+
* @type {Boolean}
|
|
161
|
+
* @default false
|
|
162
|
+
* @public
|
|
163
|
+
*/
|
|
164
|
+
noSharedState: _propTypes["default"].bool
|
|
165
|
+
}, _Class;
|
|
166
|
+
});
|
|
167
|
+
var _default = exports["default"] = SharedStateDecorator;
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("@testing-library/jest-dom");
|
|
4
|
+
var _react = require("@testing-library/react");
|
|
5
|
+
var _react2 = require("react");
|
|
6
|
+
var _SharedStateDecorator = _interopRequireWildcard(require("../SharedStateDecorator"));
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
var _excluded = ["children"],
|
|
9
|
+
_excluded2 = ["children", "value"];
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
11
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
12
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
13
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
14
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
15
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
16
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
17
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
18
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
19
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
20
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
21
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
24
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
25
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
26
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
27
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
28
|
+
describe('SharedStateDecorator Specs', function () {
|
|
29
|
+
test('should provide a set method via context', function () {
|
|
30
|
+
var fn = jest.fn();
|
|
31
|
+
var ComponentSet = (0, _SharedStateDecorator["default"])(function () {
|
|
32
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SharedStateDecorator.SharedState.Consumer, {
|
|
33
|
+
children: function children(value) {
|
|
34
|
+
fn(value.set);
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(ComponentSet, {}));
|
|
40
|
+
var expected = 'function';
|
|
41
|
+
var actual = typeof fn.mock.calls[0][0];
|
|
42
|
+
expect(actual).toBe(expected);
|
|
43
|
+
});
|
|
44
|
+
test('should provide a get method via context', function () {
|
|
45
|
+
var fn = jest.fn();
|
|
46
|
+
var ComponentGet = (0, _SharedStateDecorator["default"])(function () {
|
|
47
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SharedStateDecorator.SharedState.Consumer, {
|
|
48
|
+
children: function children(value) {
|
|
49
|
+
fn(value.get);
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(ComponentGet, {}));
|
|
55
|
+
var expected = 'function';
|
|
56
|
+
var actual = typeof fn.mock.calls[0][0];
|
|
57
|
+
expect(actual).toBe(expected);
|
|
58
|
+
});
|
|
59
|
+
test('should provide a delete method via context', function () {
|
|
60
|
+
var fn = jest.fn();
|
|
61
|
+
var ComponentDelete = (0, _SharedStateDecorator["default"])(function () {
|
|
62
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SharedStateDecorator.SharedState.Consumer, {
|
|
63
|
+
children: function children(value) {
|
|
64
|
+
fn(value["delete"]);
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(ComponentDelete, {}));
|
|
70
|
+
var expected = 'function';
|
|
71
|
+
var actual = typeof fn.mock.calls[0][0];
|
|
72
|
+
expect(actual).toBe(expected);
|
|
73
|
+
});
|
|
74
|
+
test('should supporting setting and getting a value by key when {id} is set', function () {
|
|
75
|
+
var Component = (0, _SharedStateDecorator["default"])(function () {
|
|
76
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SharedStateDecorator.SharedState.Consumer, {
|
|
77
|
+
children: function children(value) {
|
|
78
|
+
value.set('key', 'value');
|
|
79
|
+
return value.get('key');
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
84
|
+
id: "outer"
|
|
85
|
+
}));
|
|
86
|
+
var actual = _react.screen.getByText('value');
|
|
87
|
+
expect(actual).toBeInTheDocument();
|
|
88
|
+
});
|
|
89
|
+
test('should supporting setting and getting a value by key when {id} is set to a non-zero value', function () {
|
|
90
|
+
var Component = (0, _SharedStateDecorator["default"])(function () {
|
|
91
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SharedStateDecorator.SharedState.Consumer, {
|
|
92
|
+
children: function children(value) {
|
|
93
|
+
value.set('key', 'value');
|
|
94
|
+
return value.get('key');
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
99
|
+
id: -1
|
|
100
|
+
}));
|
|
101
|
+
var actual = _react.screen.getByText('value');
|
|
102
|
+
expect(actual).toBeInTheDocument();
|
|
103
|
+
});
|
|
104
|
+
test('should supporting setting and getting a value by key when {id} is set to zero', function () {
|
|
105
|
+
var Component = (0, _SharedStateDecorator["default"])(function () {
|
|
106
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SharedStateDecorator.SharedState.Consumer, {
|
|
107
|
+
children: function children(value) {
|
|
108
|
+
value.set('key', 'value');
|
|
109
|
+
return value.get('key');
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
114
|
+
id: 0
|
|
115
|
+
}));
|
|
116
|
+
var actual = _react.screen.getByText('value');
|
|
117
|
+
expect(actual).toBeInTheDocument();
|
|
118
|
+
});
|
|
119
|
+
test('should not set or return values when {id} is not set', function () {
|
|
120
|
+
var Component = (0, _SharedStateDecorator["default"])(function () {
|
|
121
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SharedStateDecorator.SharedState.Consumer, {
|
|
122
|
+
children: function children(value) {
|
|
123
|
+
value.set('key', 'value');
|
|
124
|
+
return value.get('key');
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {}));
|
|
129
|
+
var actual = _react.screen.queryByText('value');
|
|
130
|
+
expect(actual).toBeNull();
|
|
131
|
+
});
|
|
132
|
+
test('should not set or return values when {id} is set to an empty string', function () {
|
|
133
|
+
var Component = (0, _SharedStateDecorator["default"])(function () {
|
|
134
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SharedStateDecorator.SharedState.Consumer, {
|
|
135
|
+
children: function children(value) {
|
|
136
|
+
value.set('key', 'value');
|
|
137
|
+
return value.get('key');
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
142
|
+
id: ""
|
|
143
|
+
}));
|
|
144
|
+
var actual = _react.screen.queryByText('value');
|
|
145
|
+
expect(actual).toBeNull();
|
|
146
|
+
});
|
|
147
|
+
test('should not set or return values when {id} is set to null', function () {
|
|
148
|
+
var Component = (0, _SharedStateDecorator["default"])(function () {
|
|
149
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SharedStateDecorator.SharedState.Consumer, {
|
|
150
|
+
children: function children(value) {
|
|
151
|
+
value.set('key', 'value');
|
|
152
|
+
return value.get('key');
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
157
|
+
id: null
|
|
158
|
+
}));
|
|
159
|
+
var actual = _react.screen.queryByText('value');
|
|
160
|
+
expect(actual).toBeNull();
|
|
161
|
+
});
|
|
162
|
+
test('should not set or return values when {id} and {noSharedState} are set', function () {
|
|
163
|
+
var Component = (0, _SharedStateDecorator["default"])(function () {
|
|
164
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SharedStateDecorator.SharedState.Consumer, {
|
|
165
|
+
children: function children(value) {
|
|
166
|
+
value.set('key', 'value');
|
|
167
|
+
return value.get('key');
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
172
|
+
id: "outer",
|
|
173
|
+
noSharedState: true
|
|
174
|
+
}));
|
|
175
|
+
var actual = _react.screen.queryByText('value');
|
|
176
|
+
expect(actual).toBeNull();
|
|
177
|
+
});
|
|
178
|
+
test('should supporting deleting a value by key when {id} is set', function () {
|
|
179
|
+
var Component = (0, _SharedStateDecorator["default"])(function () {
|
|
180
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SharedStateDecorator.SharedState.Consumer, {
|
|
181
|
+
children: function children(value) {
|
|
182
|
+
value.set('key', 'value');
|
|
183
|
+
value["delete"]('key');
|
|
184
|
+
return value.get('key');
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
189
|
+
id: "outer"
|
|
190
|
+
}));
|
|
191
|
+
var actual = _react.screen.queryByText('value');
|
|
192
|
+
expect(actual).toBeNull();
|
|
193
|
+
});
|
|
194
|
+
test('should share data upstream when inside another SharedStateDecorator', function () {
|
|
195
|
+
var Component = (0, _SharedStateDecorator["default"])(function (_ref) {
|
|
196
|
+
var _children = _ref.children,
|
|
197
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
198
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SharedStateDecorator.SharedState.Consumer, {
|
|
199
|
+
children: function children(value) {
|
|
200
|
+
value.set('key', 'value');
|
|
201
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({}, rest), {}, {
|
|
202
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
203
|
+
children: value.get('key')
|
|
204
|
+
}), _children]
|
|
205
|
+
}));
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
210
|
+
id: "outer",
|
|
211
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
212
|
+
id: "inner"
|
|
213
|
+
})
|
|
214
|
+
}));
|
|
215
|
+
var expected = '<div id="outer"><span>value</span><div id="inner"><span>value</span></div></div>';
|
|
216
|
+
var actual = _react.screen.getAllByText('value')[0].parentElement.parentElement.innerHTML;
|
|
217
|
+
expect(actual).toEqual(expected);
|
|
218
|
+
});
|
|
219
|
+
test('should restore shared state from ancestor', function () {
|
|
220
|
+
var Base = /*#__PURE__*/function (_ReactComponent) {
|
|
221
|
+
function Base() {
|
|
222
|
+
_classCallCheck(this, Base);
|
|
223
|
+
return _callSuper(this, Base, arguments);
|
|
224
|
+
}
|
|
225
|
+
_inherits(Base, _ReactComponent);
|
|
226
|
+
return _createClass(Base, [{
|
|
227
|
+
key: "render",
|
|
228
|
+
value: function render() {
|
|
229
|
+
var _this$props = this.props,
|
|
230
|
+
children = _this$props.children,
|
|
231
|
+
propValue = _this$props.value,
|
|
232
|
+
rest = _objectWithoutProperties(_this$props, _excluded2);
|
|
233
|
+
if (propValue) {
|
|
234
|
+
this.context.set('key', propValue);
|
|
235
|
+
}
|
|
236
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({}, rest), {}, {
|
|
237
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
238
|
+
children: this.context.get('key')
|
|
239
|
+
}), children]
|
|
240
|
+
}));
|
|
241
|
+
}
|
|
242
|
+
}]);
|
|
243
|
+
}(_react2.Component);
|
|
244
|
+
Base.contextType = _SharedStateDecorator.SharedState;
|
|
245
|
+
var Component = (0, _SharedStateDecorator["default"])({
|
|
246
|
+
updateOnMount: true
|
|
247
|
+
}, Base);
|
|
248
|
+
var _render = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
249
|
+
id: "outer",
|
|
250
|
+
value: "value",
|
|
251
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
252
|
+
id: "inner",
|
|
253
|
+
value: "from-prop"
|
|
254
|
+
})
|
|
255
|
+
})),
|
|
256
|
+
rerender = _render.rerender;
|
|
257
|
+
|
|
258
|
+
// remove the children which drops inner's shared state
|
|
259
|
+
rerender(/*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
260
|
+
id: "outer",
|
|
261
|
+
value: "value"
|
|
262
|
+
}));
|
|
263
|
+
|
|
264
|
+
// recreate it with the same id but no initial value to validate the previous state is
|
|
265
|
+
// restored. updateOnMount is used above to coerce a re-render on mount since the shared
|
|
266
|
+
// state value is used in the render method and isn't available on first render otherwise.
|
|
267
|
+
rerender(/*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
268
|
+
id: "outer",
|
|
269
|
+
value: "value",
|
|
270
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
271
|
+
id: "inner"
|
|
272
|
+
})
|
|
273
|
+
}));
|
|
274
|
+
var actual = _react.screen.getByText('from-prop');
|
|
275
|
+
expect(actual).toBeInTheDocument();
|
|
276
|
+
});
|
|
277
|
+
});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
|
|
8
|
+
var _handle = require("@enact/core/handle");
|
|
9
|
+
var _dispatcher = require("@enact/core/dispatcher");
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
var _excluded = ["globalNode"]; //
|
|
13
|
+
// WindowEventable (Eventful?)
|
|
14
|
+
//
|
|
15
|
+
// DEV NOTE: These docs are just plain docs since this component is still under consideration for
|
|
16
|
+
// inclusion outside Input's specific use-case. True jsDoc comments will be added at a later time.
|
|
17
|
+
//
|
|
18
|
+
/*
|
|
19
|
+
* Easily create and add events to the window, document, or other global node.
|
|
20
|
+
*
|
|
21
|
+
* This accepts an arbitrary number of events, in either function or string (referring to an
|
|
22
|
+
* incoming prop) as the callback values.
|
|
23
|
+
*
|
|
24
|
+
* It is recommended to use {@link core/handle} to maintain a consistent event callback signature.
|
|
25
|
+
*/
|
|
26
|
+
/*
|
|
27
|
+
* Use the `globalNode` key in the config to change which node the relevant events are attached to.
|
|
28
|
+
*/
|
|
29
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
30
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
31
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
32
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
33
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
34
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
35
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
36
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
37
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
38
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
39
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
40
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
41
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
42
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
43
|
+
var defaultConfig = {
|
|
44
|
+
globalNode: 'window'
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// In config, extract all the config stuff we know about. Everything else is an event.
|
|
48
|
+
var WindowEventable = (0, _hoc["default"])(defaultConfig, function (_ref, Wrapped) {
|
|
49
|
+
var globalNode = _ref.globalNode,
|
|
50
|
+
events = _objectWithoutProperties(_ref, _excluded);
|
|
51
|
+
// eslint-disable-next-line no-shadow
|
|
52
|
+
var WindowEventable = function WindowEventable(props) {
|
|
53
|
+
(0, _react.useEffect)(function () {
|
|
54
|
+
switch (globalNode) {
|
|
55
|
+
case 'window':
|
|
56
|
+
globalNode = window;
|
|
57
|
+
break;
|
|
58
|
+
case 'document':
|
|
59
|
+
globalNode = document;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
var localEvents = {};
|
|
63
|
+
var _loop = function _loop() {
|
|
64
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
65
|
+
eventName = _Object$entries$_i[0],
|
|
66
|
+
fn = _Object$entries$_i[1];
|
|
67
|
+
// Tailored event names (convert from React style to browser style naming)
|
|
68
|
+
if (eventName.indexOf('on') === 0) {
|
|
69
|
+
eventName = eventName.substring(2).toLowerCase();
|
|
70
|
+
}
|
|
71
|
+
if (typeof fn === 'function') {
|
|
72
|
+
// Support functions passed directly into the config
|
|
73
|
+
localEvents[eventName] = (0, _handle.handle)(function (eventPayload) {
|
|
74
|
+
return fn(eventPayload, props);
|
|
75
|
+
});
|
|
76
|
+
} else if (typeof fn === 'string') {
|
|
77
|
+
// Support strings, representing a callback in the props list
|
|
78
|
+
localEvents[eventName] = (0, _handle.handle)((0, _handle.forward)(fn, props));
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
for (var _i = 0, _Object$entries = Object.entries(events); _i < _Object$entries.length; _i++) {
|
|
82
|
+
_loop();
|
|
83
|
+
}
|
|
84
|
+
if (typeof globalNode === 'object') {
|
|
85
|
+
for (var _i2 = 0, _Object$entries2 = Object.entries(localEvents); _i2 < _Object$entries2.length; _i2++) {
|
|
86
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
|
|
87
|
+
eventName = _Object$entries2$_i[0],
|
|
88
|
+
fn = _Object$entries2$_i[1];
|
|
89
|
+
(0, _dispatcher.on)(eventName, fn, globalNode);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return function () {
|
|
93
|
+
if (typeof globalNode === 'object') {
|
|
94
|
+
for (var _i3 = 0, _Object$entries3 = Object.entries(localEvents); _i3 < _Object$entries3.length; _i3++) {
|
|
95
|
+
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2),
|
|
96
|
+
_eventName = _Object$entries3$_i[0],
|
|
97
|
+
_fn = _Object$entries3$_i[1];
|
|
98
|
+
(0, _dispatcher.off)(_eventName, _fn, globalNode);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
103
|
+
|
|
104
|
+
var rest = Object.assign({}, props);
|
|
105
|
+
for (var _i4 = 0, _Object$keys = Object.keys(events); _i4 < _Object$keys.length; _i4++) {
|
|
106
|
+
var eventName = _Object$keys[_i4];
|
|
107
|
+
delete rest[eventName];
|
|
108
|
+
}
|
|
109
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapped, _objectSpread({}, rest));
|
|
110
|
+
};
|
|
111
|
+
WindowEventable.displayName = 'WindowEventable';
|
|
112
|
+
return WindowEventable;
|
|
113
|
+
});
|
|
114
|
+
var _default = exports["default"] = WindowEventable;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.onlyUpdateForProps = exports.extractVoiceProps = exports.compareChildren = void 0;
|
|
7
|
+
var _equals = _interopRequireDefault(require("ramda/src/equals"));
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
|
+
/**
|
|
11
|
+
* Removes voice control related props from `props` and returns them in a new object.
|
|
12
|
+
*
|
|
13
|
+
* @function
|
|
14
|
+
* @param {Object} props Props object
|
|
15
|
+
*
|
|
16
|
+
* @returns {Object} voice control related props
|
|
17
|
+
* @memberof limestone/internal/util
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
var extractVoiceProps = exports.extractVoiceProps = function extractVoiceProps(props) {
|
|
21
|
+
var obj = {};
|
|
22
|
+
Object.keys(props).forEach(function (key) {
|
|
23
|
+
if (key.indexOf('data-webos-voice-') === 0) {
|
|
24
|
+
obj[key] = props[key];
|
|
25
|
+
delete props[key];
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return obj;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Compares two children and returns true if they are equivalent, false otherwise.
|
|
33
|
+
*
|
|
34
|
+
* @function
|
|
35
|
+
* @param {children} a children props
|
|
36
|
+
* @param {children} b children props
|
|
37
|
+
*
|
|
38
|
+
* @returns {Boolean} `true` if same
|
|
39
|
+
* @memberof limestone/internal/util
|
|
40
|
+
* @private
|
|
41
|
+
*/
|
|
42
|
+
var compareChildren = exports.compareChildren = function compareChildren(a, b) {
|
|
43
|
+
if (!a || !b || a.length !== b.length) return false;
|
|
44
|
+
var type = null;
|
|
45
|
+
for (var i = 0; i < a.length; i++) {
|
|
46
|
+
type = type || typeof a[i];
|
|
47
|
+
if (type === 'string') {
|
|
48
|
+
if (a[i] !== b[i]) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
} else if (!(0, _equals["default"])(a[i], b[i])) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Updates component only when given props are not shallowly equivalent, not updating otherwise.
|
|
60
|
+
*
|
|
61
|
+
* @function
|
|
62
|
+
* @param {any} wrapped A component
|
|
63
|
+
* @param {Array} propKeys Prop keys to compare
|
|
64
|
+
*
|
|
65
|
+
* @returns {any} Conditionally memoized component
|
|
66
|
+
* @memberof limestone/internal/util
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
var onlyUpdateForProps = exports.onlyUpdateForProps = function onlyUpdateForProps(wrapped, propKeys) {
|
|
70
|
+
return /*#__PURE__*/(0, _react.memo)(wrapped, function (prevProps, nextProps) {
|
|
71
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
|
72
|
+
if (Array.isArray(propKeys)) {
|
|
73
|
+
return propKeys.every(function (key) {
|
|
74
|
+
return hasOwn.call(prevProps, key) && hasOwn.call(nextProps, key) && Object.is(prevProps[key], nextProps[key]);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
});
|
|
79
|
+
};
|