@proyecto-viviana/solidaria-components 0.5.0 → 0.7.0-rc.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/LICENSE-APACHE-2.0 +201 -0
- package/NOTICE +91 -0
- package/README.md +4 -7
- package/dist/ActionBar.d.ts +2 -10
- package/dist/ActionBar.d.ts.map +1 -1
- package/dist/ActionBar.js +95 -59
- package/dist/ActionBar.js.map +1 -1
- package/dist/ActionBar.jsx +42 -15
- package/dist/ActionBar.jsx.map +1 -1
- package/dist/ActionGroup.d.ts +1 -12
- package/dist/ActionGroup.d.ts.map +1 -1
- package/dist/ActionGroup.js +66 -44
- package/dist/ActionGroup.js.map +1 -1
- package/dist/ActionGroup.jsx +25 -10
- package/dist/ActionGroup.jsx.map +1 -1
- package/dist/Alert.d.ts +4 -1
- package/dist/Alert.d.ts.map +1 -1
- package/dist/Alert.js +25 -17
- package/dist/Alert.js.map +1 -1
- package/dist/Alert.jsx +9 -5
- package/dist/Alert.jsx.map +1 -1
- package/dist/Autocomplete.d.ts +2 -9
- package/dist/Autocomplete.d.ts.map +1 -1
- package/dist/Autocomplete.js +18 -5
- package/dist/Autocomplete.js.map +1 -1
- package/dist/Autocomplete.jsx +20 -7
- package/dist/Autocomplete.jsx.map +1 -1
- package/dist/Breadcrumbs.d.ts +2 -7
- package/dist/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs.js +71 -51
- package/dist/Breadcrumbs.js.map +1 -1
- package/dist/Breadcrumbs.jsx +25 -12
- package/dist/Breadcrumbs.jsx.map +1 -1
- package/dist/Button.d.ts +1 -7
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +125 -72
- package/dist/Button.js.map +1 -1
- package/dist/Button.jsx +105 -43
- package/dist/Button.jsx.map +1 -1
- package/dist/Calendar.d.ts +1 -7
- package/dist/Calendar.d.ts.map +1 -1
- package/dist/Calendar.js +297 -221
- package/dist/Calendar.js.map +1 -1
- package/dist/Calendar.jsx +52 -32
- package/dist/Calendar.jsx.map +1 -1
- package/dist/CalendarPicker.d.ts +1 -10
- package/dist/CalendarPicker.d.ts.map +1 -1
- package/dist/CalendarPicker.js +12 -0
- package/dist/CalendarPicker.js.map +1 -1
- package/dist/CalendarPicker.jsx +12 -0
- package/dist/CalendarPicker.jsx.map +1 -1
- package/dist/Checkbox.d.ts +2 -7
- package/dist/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox.js +332 -270
- package/dist/Checkbox.js.map +1 -1
- package/dist/Checkbox.jsx +70 -77
- package/dist/Checkbox.jsx.map +1 -1
- package/dist/Collection.d.ts +33 -7
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +128 -74
- package/dist/Collection.js.map +1 -1
- package/dist/Collection.jsx +46 -7
- package/dist/Collection.jsx.map +1 -1
- package/dist/Color.d.ts +15 -20
- package/dist/Color.d.ts.map +1 -1
- package/dist/Color.js +572 -334
- package/dist/Color.js.map +1 -1
- package/dist/Color.jsx +205 -85
- package/dist/Color.jsx.map +1 -1
- package/dist/ColorEditor.d.ts +3 -1
- package/dist/ColorEditor.d.ts.map +1 -1
- package/dist/ColorEditor.js +147 -124
- package/dist/ColorEditor.js.map +1 -1
- package/dist/ColorEditor.jsx +4 -1
- package/dist/ColorEditor.jsx.map +1 -1
- package/dist/ComboBox.d.ts +31 -10
- package/dist/ComboBox.d.ts.map +1 -1
- package/dist/ComboBox.js +539 -274
- package/dist/ComboBox.js.map +1 -1
- package/dist/ComboBox.jsx +213 -70
- package/dist/ComboBox.jsx.map +1 -1
- package/dist/ContextualHelpTrigger.d.ts +1 -7
- package/dist/ContextualHelpTrigger.d.ts.map +1 -1
- package/dist/ContextualHelpTrigger.js +102 -72
- package/dist/ContextualHelpTrigger.js.map +1 -1
- package/dist/ContextualHelpTrigger.jsx +36 -16
- package/dist/ContextualHelpTrigger.jsx.map +1 -1
- package/dist/DateField.d.ts +2 -7
- package/dist/DateField.d.ts.map +1 -1
- package/dist/DateField.js +0 -2
- package/dist/DateField.jsx +0 -2
- package/dist/DateField2.js +194 -179
- package/dist/DateField2.js.map +1 -1
- package/dist/DateField2.jsx +58 -55
- package/dist/DateField2.jsx.map +1 -1
- package/dist/DatePicker.d.ts +7 -7
- package/dist/DatePicker.d.ts.map +1 -1
- package/dist/DatePicker.js +2 -2
- package/dist/DatePicker.jsx +2 -2
- package/dist/DatePicker2.js +357 -435
- package/dist/DatePicker2.js.map +1 -1
- package/dist/DatePicker2.jsx +109 -178
- package/dist/DatePicker2.jsx.map +1 -1
- package/dist/DateRangePickerContext.d.ts +7 -0
- package/dist/DateRangePickerContext.d.ts.map +1 -1
- package/dist/Dialog.d.ts +4 -9
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Dialog.js +168 -101
- package/dist/Dialog.js.map +1 -1
- package/dist/Dialog.jsx +75 -27
- package/dist/Dialog.jsx.map +1 -1
- package/dist/Disclosure.d.ts +1 -9
- package/dist/Disclosure.d.ts.map +1 -1
- package/dist/Disclosure.js +121 -79
- package/dist/Disclosure.js.map +1 -1
- package/dist/Disclosure.jsx +32 -19
- package/dist/Disclosure.jsx.map +1 -1
- package/dist/DragAndDrop.d.ts +9 -6
- package/dist/DragAndDrop.d.ts.map +1 -1
- package/dist/DragAndDrop.js +37 -22
- package/dist/DragAndDrop.js.map +1 -1
- package/dist/DragAndDrop.jsx +20 -4
- package/dist/DragAndDrop.jsx.map +1 -1
- package/dist/DragPreview.d.ts +1 -1
- package/dist/DragPreview.d.ts.map +1 -1
- package/dist/DropZone.d.ts +1 -7
- package/dist/DropZone.d.ts.map +1 -1
- package/dist/DropZone.js +74 -40
- package/dist/DropZone.js.map +1 -1
- package/dist/DropZone.jsx +24 -8
- package/dist/DropZone.jsx.map +1 -1
- package/dist/ElementTag.d.ts +9 -20
- package/dist/ElementTag.d.ts.map +1 -1
- package/dist/ElementTag.js +8 -210
- package/dist/ElementTag.js.map +1 -1
- package/dist/ElementTag.jsx +8 -57
- package/dist/ElementTag.jsx.map +1 -1
- package/dist/FieldError.d.ts +8 -7
- package/dist/FieldError.d.ts.map +1 -1
- package/dist/FieldError.js +33 -13
- package/dist/FieldError.js.map +1 -1
- package/dist/FieldError.jsx +20 -5
- package/dist/FieldError.jsx.map +1 -1
- package/dist/FileTrigger.d.ts +1 -7
- package/dist/FileTrigger.d.ts.map +1 -1
- package/dist/FileTrigger.js +30 -12
- package/dist/FileTrigger.js.map +1 -1
- package/dist/FileTrigger.jsx +15 -2
- package/dist/FileTrigger.jsx.map +1 -1
- package/dist/Focusable.d.ts +2 -8
- package/dist/Focusable.d.ts.map +1 -1
- package/dist/Focusable.js +23 -6
- package/dist/Focusable.js.map +1 -1
- package/dist/Focusable.jsx +22 -5
- package/dist/Focusable.jsx.map +1 -1
- package/dist/Form.d.ts +9 -8
- package/dist/Form.d.ts.map +1 -1
- package/dist/Form.js +66 -43
- package/dist/Form.js.map +1 -1
- package/dist/Form.jsx +36 -16
- package/dist/Form.jsx.map +1 -1
- package/dist/GridList.d.ts +5 -10
- package/dist/GridList.d.ts.map +1 -1
- package/dist/GridList.js +372 -243
- package/dist/GridList.js.map +1 -1
- package/dist/GridList.jsx +177 -99
- package/dist/GridList.jsx.map +1 -1
- package/dist/HiddenDateInput.d.ts +1 -7
- package/dist/HiddenDateInput.d.ts.map +1 -1
- package/dist/Icon.d.ts +4 -1
- package/dist/Icon.d.ts.map +1 -1
- package/dist/Icon.js +41 -37
- package/dist/Icon.js.map +1 -1
- package/dist/Icon.jsx +7 -3
- package/dist/Icon.jsx.map +1 -1
- package/dist/Keyboard.d.ts +1 -7
- package/dist/Keyboard.d.ts.map +1 -1
- package/dist/Keyboard.js +24 -11
- package/dist/Keyboard.js.map +1 -1
- package/dist/Keyboard.jsx +15 -2
- package/dist/Keyboard.jsx.map +1 -1
- package/dist/Label.d.ts +20 -0
- package/dist/Label.d.ts.map +1 -0
- package/dist/Label.js +60 -0
- package/dist/Label.js.map +1 -0
- package/dist/Label.jsx +47 -0
- package/dist/Label.jsx.map +1 -0
- package/dist/Landmark.d.ts +4 -1
- package/dist/Landmark.d.ts.map +1 -1
- package/dist/Landmark.js +10 -4
- package/dist/Landmark.js.map +1 -1
- package/dist/Landmark.jsx +5 -1
- package/dist/Landmark.jsx.map +1 -1
- package/dist/Link.d.ts +2 -7
- package/dist/Link.d.ts.map +1 -1
- package/dist/Link.js +56 -36
- package/dist/Link.js.map +1 -1
- package/dist/Link.jsx +52 -10
- package/dist/Link.jsx.map +1 -1
- package/dist/ListBox.d.ts +17 -13
- package/dist/ListBox.d.ts.map +1 -1
- package/dist/ListBox.js +647 -348
- package/dist/ListBox.js.map +1 -1
- package/dist/ListBox.jsx +339 -236
- package/dist/ListBox.jsx.map +1 -1
- package/dist/ListDropTargetDelegate.d.ts +3 -0
- package/dist/ListDropTargetDelegate.d.ts.map +1 -1
- package/dist/Menu.d.ts +39 -30
- package/dist/Menu.d.ts.map +1 -1
- package/dist/Menu.js +547 -368
- package/dist/Menu.js.map +1 -1
- package/dist/Menu.jsx +328 -230
- package/dist/Menu.jsx.map +1 -1
- package/dist/Meter.d.ts +6 -13
- package/dist/Meter.d.ts.map +1 -1
- package/dist/Meter.js +55 -18
- package/dist/Meter.js.map +1 -1
- package/dist/Meter.jsx +33 -8
- package/dist/Meter.jsx.map +1 -1
- package/dist/Modal.d.ts +1 -7
- package/dist/Modal.d.ts.map +1 -1
- package/dist/Modal.js +104 -56
- package/dist/Modal.js.map +1 -1
- package/dist/Modal.jsx +68 -38
- package/dist/Modal.jsx.map +1 -1
- package/dist/NumberField.d.ts +4 -7
- package/dist/NumberField.d.ts.map +1 -1
- package/dist/NumberField.js +243 -124
- package/dist/NumberField.js.map +1 -1
- package/dist/NumberField.jsx +115 -26
- package/dist/NumberField.jsx.map +1 -1
- package/dist/Popover.d.ts +15 -7
- package/dist/Popover.d.ts.map +1 -1
- package/dist/Popover.js +370 -181
- package/dist/Popover.js.map +1 -1
- package/dist/Popover.jsx +215 -82
- package/dist/Popover.jsx.map +1 -1
- package/dist/Pressable.d.ts +2 -8
- package/dist/Pressable.d.ts.map +1 -1
- package/dist/Pressable.js +23 -6
- package/dist/Pressable.js.map +1 -1
- package/dist/Pressable.jsx +22 -5
- package/dist/Pressable.jsx.map +1 -1
- package/dist/PreviewTrigger.d.ts +24 -0
- package/dist/PreviewTrigger.d.ts.map +1 -0
- package/dist/PreviewTrigger.js +128 -0
- package/dist/PreviewTrigger.js.map +1 -0
- package/dist/PreviewTrigger.jsx +117 -0
- package/dist/PreviewTrigger.jsx.map +1 -0
- package/dist/ProgressBar.d.ts +1 -7
- package/dist/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar.js +34 -14
- package/dist/ProgressBar.js.map +1 -1
- package/dist/ProgressBar.jsx +17 -3
- package/dist/ProgressBar.jsx.map +1 -1
- package/dist/RadioGroup.d.ts +2 -7
- package/dist/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup.js +388 -269
- package/dist/RadioGroup.js.map +1 -1
- package/dist/RadioGroup.jsx +110 -99
- package/dist/RadioGroup.jsx.map +1 -1
- package/dist/RangeCalendar.d.ts +3 -7
- package/dist/RangeCalendar.d.ts.map +1 -1
- package/dist/RangeCalendar.js +271 -202
- package/dist/RangeCalendar.js.map +1 -1
- package/dist/RangeCalendar.jsx +56 -37
- package/dist/RangeCalendar.jsx.map +1 -1
- package/dist/RouterProvider.d.ts +3 -9
- package/dist/RouterProvider.d.ts.map +1 -1
- package/dist/RouterProvider.js +15 -14
- package/dist/RouterProvider.js.map +1 -1
- package/dist/RouterProvider.jsx +14 -13
- package/dist/RouterProvider.jsx.map +1 -1
- package/dist/SearchField.d.ts +4 -7
- package/dist/SearchField.d.ts.map +1 -1
- package/dist/SearchField.js +191 -164
- package/dist/SearchField.js.map +1 -1
- package/dist/SearchField.jsx +69 -62
- package/dist/SearchField.jsx.map +1 -1
- package/dist/Select.d.ts +5 -10
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +565 -359
- package/dist/Select.js.map +1 -1
- package/dist/Select.jsx +281 -161
- package/dist/Select.jsx.map +1 -1
- package/dist/SelectionIndicator.d.ts +1 -4
- package/dist/SelectionIndicator.d.ts.map +1 -1
- package/dist/SelectionIndicator.js +29 -13
- package/dist/SelectionIndicator.js.map +1 -1
- package/dist/SelectionIndicator.jsx +18 -4
- package/dist/SelectionIndicator.jsx.map +1 -1
- package/dist/Separator.d.ts +1 -7
- package/dist/Separator.d.ts.map +1 -1
- package/dist/Separator.js +22 -6
- package/dist/Separator.js.map +1 -1
- package/dist/Separator.jsx +16 -3
- package/dist/Separator.jsx.map +1 -1
- package/dist/SharedElementTransition.d.ts +1 -10
- package/dist/SharedElementTransition.d.ts.map +1 -1
- package/dist/SharedElementTransition.js +68 -40
- package/dist/SharedElementTransition.js.map +1 -1
- package/dist/SharedElementTransition.jsx +49 -25
- package/dist/SharedElementTransition.jsx.map +1 -1
- package/dist/Slider.d.ts +2 -8
- package/dist/Slider.d.ts.map +1 -1
- package/dist/Slider.js +155 -97
- package/dist/Slider.js.map +1 -1
- package/dist/Slider.jsx +25 -12
- package/dist/Slider.jsx.map +1 -1
- package/dist/StepList.d.ts +1 -7
- package/dist/StepList.d.ts.map +1 -1
- package/dist/StepList.js +112 -68
- package/dist/StepList.js.map +1 -1
- package/dist/StepList.jsx +58 -20
- package/dist/StepList.jsx.map +1 -1
- package/dist/Switch.d.ts +2 -9
- package/dist/Switch.d.ts.map +1 -1
- package/dist/Switch.js +164 -114
- package/dist/Switch.js.map +1 -1
- package/dist/Switch.jsx +26 -13
- package/dist/Switch.jsx.map +1 -1
- package/dist/Table.d.ts +2 -1
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +689 -592
- package/dist/Table.js.map +1 -1
- package/dist/Table.jsx +317 -237
- package/dist/Table.jsx.map +1 -1
- package/dist/Tabs.d.ts +2 -7
- package/dist/Tabs.d.ts.map +1 -1
- package/dist/Tabs.js +278 -293
- package/dist/Tabs.js.map +1 -1
- package/dist/Tabs.jsx +68 -66
- package/dist/Tabs.jsx.map +1 -1
- package/dist/TagGroup.d.ts +4 -11
- package/dist/TagGroup.d.ts.map +1 -1
- package/dist/TagGroup.js +153 -115
- package/dist/TagGroup.js.map +1 -1
- package/dist/TagGroup.jsx +37 -24
- package/dist/TagGroup.jsx.map +1 -1
- package/dist/Text.d.ts +3 -3
- package/dist/Text.d.ts.map +1 -1
- package/dist/Text.js +24 -7
- package/dist/Text.js.map +1 -1
- package/dist/Text.jsx +17 -5
- package/dist/Text.jsx.map +1 -1
- package/dist/TextField.d.ts +3 -16
- package/dist/TextField.d.ts.map +1 -1
- package/dist/TextField.js +104 -129
- package/dist/TextField.js.map +1 -1
- package/dist/TextField.jsx +76 -102
- package/dist/TextField.jsx.map +1 -1
- package/dist/TimeField.d.ts +2 -15
- package/dist/TimeField.d.ts.map +1 -1
- package/dist/TimeField.js +86 -102
- package/dist/TimeField.js.map +1 -1
- package/dist/TimeField.jsx +32 -49
- package/dist/TimeField.jsx.map +1 -1
- package/dist/Toast.d.ts +10 -13
- package/dist/Toast.d.ts.map +1 -1
- package/dist/Toast.js +209 -108
- package/dist/Toast.js.map +1 -1
- package/dist/Toast.jsx +127 -22
- package/dist/Toast.jsx.map +1 -1
- package/dist/ToggleButton.d.ts +1 -7
- package/dist/ToggleButton.d.ts.map +1 -1
- package/dist/ToggleButton.js +57 -35
- package/dist/ToggleButton.js.map +1 -1
- package/dist/ToggleButton.jsx +26 -12
- package/dist/ToggleButton.jsx.map +1 -1
- package/dist/ToggleButtonGroup.d.ts +1 -7
- package/dist/ToggleButtonGroup.d.ts.map +1 -1
- package/dist/ToggleButtonGroup.js +59 -44
- package/dist/ToggleButtonGroup.js.map +1 -1
- package/dist/ToggleButtonGroup.jsx +25 -12
- package/dist/ToggleButtonGroup.jsx.map +1 -1
- package/dist/TokenField.d.ts +52 -0
- package/dist/TokenField.d.ts.map +1 -0
- package/dist/TokenField.js +301 -0
- package/dist/TokenField.js.map +1 -0
- package/dist/TokenField.jsx +197 -0
- package/dist/TokenField.jsx.map +1 -0
- package/dist/Toolbar.d.ts +2 -7
- package/dist/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar.js +35 -16
- package/dist/Toolbar.js.map +1 -1
- package/dist/Toolbar.jsx +15 -2
- package/dist/Toolbar.jsx.map +1 -1
- package/dist/Tooltip.d.ts +2 -7
- package/dist/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip.js +105 -68
- package/dist/Tooltip.js.map +1 -1
- package/dist/Tooltip.jsx +60 -36
- package/dist/Tooltip.jsx.map +1 -1
- package/dist/Tree.d.ts +8 -11
- package/dist/Tree.d.ts.map +1 -1
- package/dist/Tree.js +486 -339
- package/dist/Tree.js.map +1 -1
- package/dist/Tree.jsx +155 -107
- package/dist/Tree.jsx.map +1 -1
- package/dist/Virtualizer.d.ts +39 -9
- package/dist/Virtualizer.d.ts.map +1 -1
- package/dist/Virtualizer.js +2 -2
- package/dist/Virtualizer.jsx +2 -2
- package/dist/Virtualizer2.js +491 -136
- package/dist/Virtualizer2.js.map +1 -1
- package/dist/Virtualizer2.jsx +455 -122
- package/dist/Virtualizer2.jsx.map +1 -1
- package/dist/VirtualizerLayouts.d.ts +55 -2
- package/dist/VirtualizerLayouts.d.ts.map +1 -1
- package/dist/VisuallyHidden.d.ts +4 -3
- package/dist/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden.js +18 -11
- package/dist/VisuallyHidden.js.map +1 -1
- package/dist/VisuallyHidden.jsx +15 -9
- package/dist/VisuallyHidden.jsx.map +1 -1
- package/dist/contexts.d.ts +25 -0
- package/dist/contexts.d.ts.map +1 -1
- package/dist/contexts.js +3 -0
- package/dist/contexts.js.map +1 -1
- package/dist/contexts.jsx +3 -0
- package/dist/contexts.jsx.map +1 -1
- package/dist/index.d.ts +11 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -11
- package/dist/index.jsx +14 -11
- package/dist/intl/index.d.ts +16 -0
- package/dist/intl/index.d.ts.map +1 -0
- package/dist/intl.js +212 -0
- package/dist/intl.js.map +1 -0
- package/dist/intl.jsx +212 -0
- package/dist/intl.jsx.map +1 -0
- package/dist/useDragAndDrop.d.ts +4 -2
- package/dist/useDragAndDrop.d.ts.map +1 -1
- package/dist/useDragAndDrop2.js +39 -21
- package/dist/useDragAndDrop2.js.map +1 -1
- package/dist/useDragAndDrop2.jsx +39 -21
- package/dist/useDragAndDrop2.jsx.map +1 -1
- package/dist/utils.d.ts +28 -9
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +96 -24
- package/dist/utils.js.map +1 -1
- package/dist/utils.jsx +81 -24
- package/dist/utils.jsx.map +1 -1
- package/dist/virtualizer/Layout.d.ts +9 -0
- package/dist/virtualizer/Layout.d.ts.map +1 -1
- package/dist/virtualizer/Layout.js +23 -2
- package/dist/virtualizer/Layout.js.map +1 -1
- package/dist/virtualizer/Layout.jsx +23 -2
- package/dist/virtualizer/Layout.jsx.map +1 -1
- package/package.json +29 -10
- package/src/ActionBar.tsx +50 -24
- package/src/ActionGroup.tsx +31 -19
- package/src/Alert.tsx +10 -4
- package/src/Autocomplete.tsx +24 -15
- package/src/Breadcrumbs.tsx +32 -16
- package/src/Button.tsx +182 -67
- package/src/Calendar.tsx +65 -47
- package/src/CalendarPicker.tsx +16 -1
- package/src/Checkbox.tsx +84 -116
- package/src/Collection.tsx +84 -3
- package/src/Color.tsx +282 -104
- package/src/ColorEditor.tsx +5 -1
- package/src/ComboBox.tsx +384 -109
- package/src/ContextualHelpTrigger.tsx +47 -41
- package/src/DateField.tsx +74 -106
- package/src/DatePicker.tsx +156 -352
- package/src/DateRangePickerContext.tsx +8 -0
- package/src/Dialog.tsx +105 -38
- package/src/Disclosure.tsx +29 -19
- package/src/DragAndDrop.tsx +43 -8
- package/src/DragPreview.tsx +20 -1
- package/src/DropZone.tsx +32 -18
- package/src/ElementTag.tsx +14 -104
- package/src/FieldError.tsx +39 -7
- package/src/FileTrigger.tsx +18 -3
- package/src/Focusable.tsx +27 -6
- package/src/Form.tsx +57 -11
- package/src/GridList.tsx +233 -141
- package/src/HiddenDateInput.tsx +19 -3
- package/src/Icon.tsx +8 -2
- package/src/Keyboard.tsx +18 -2
- package/src/Label.tsx +77 -0
- package/src/Landmark.tsx +6 -1
- package/src/Link.tsx +65 -19
- package/src/ListBox.tsx +645 -468
- package/src/ListDropTargetDelegate.ts +4 -0
- package/src/Menu.tsx +512 -349
- package/src/Meter.tsx +42 -8
- package/src/Modal.tsx +85 -42
- package/src/NumberField.tsx +161 -48
- package/src/Popover.tsx +424 -148
- package/src/Pressable.tsx +27 -6
- package/src/PreviewTrigger.tsx +171 -0
- package/src/ProgressBar.tsx +25 -3
- package/src/RadioGroup.tsx +230 -161
- package/src/RangeCalendar.tsx +75 -63
- package/src/RouterProvider.tsx +24 -14
- package/src/SearchField.tsx +118 -121
- package/src/Select.tsx +454 -274
- package/src/SelectionIndicator.tsx +21 -3
- package/src/Separator.tsx +17 -1
- package/src/SharedElementTransition.tsx +115 -97
- package/src/Slider.tsx +35 -17
- package/src/StepList.tsx +71 -32
- package/src/Switch.tsx +45 -29
- package/src/Table.tsx +446 -380
- package/src/Tabs.tsx +132 -155
- package/src/TagGroup.tsx +53 -40
- package/src/Text.tsx +23 -6
- package/src/TextField.tsx +118 -159
- package/src/TimeField.tsx +34 -95
- package/src/Toast.tsx +141 -67
- package/src/ToggleButton.tsx +33 -15
- package/src/ToggleButtonGroup.tsx +27 -9
- package/src/TokenField.tsx +379 -0
- package/src/Toolbar.tsx +19 -9
- package/src/Tooltip.tsx +126 -84
- package/src/Tree.tsx +233 -173
- package/src/Virtualizer.tsx +400 -138
- package/src/VirtualizerLayouts.ts +211 -26
- package/src/VisuallyHidden.tsx +22 -8
- package/src/contexts.ts +13 -0
- package/src/index.ts +32 -11
- package/src/intl/ar-AE.json +6 -0
- package/src/intl/bg-BG.json +6 -0
- package/src/intl/cs-CZ.json +6 -0
- package/src/intl/da-DK.json +6 -0
- package/src/intl/de-DE.json +6 -0
- package/src/intl/el-GR.json +6 -0
- package/src/intl/en-US.json +6 -0
- package/src/intl/es-ES.json +6 -0
- package/src/intl/et-EE.json +6 -0
- package/src/intl/fi-FI.json +6 -0
- package/src/intl/fr-FR.json +6 -0
- package/src/intl/he-IL.json +6 -0
- package/src/intl/hr-HR.json +6 -0
- package/src/intl/hu-HU.json +6 -0
- package/src/intl/index.ts +125 -0
- package/src/intl/it-IT.json +6 -0
- package/src/intl/ja-JP.json +6 -0
- package/src/intl/ko-KR.json +6 -0
- package/src/intl/lt-LT.json +6 -0
- package/src/intl/lv-LV.json +6 -0
- package/src/intl/nb-NO.json +6 -0
- package/src/intl/nl-NL.json +6 -0
- package/src/intl/pl-PL.json +6 -0
- package/src/intl/pt-BR.json +6 -0
- package/src/intl/pt-PT.json +6 -0
- package/src/intl/ro-RO.json +6 -0
- package/src/intl/ru-RU.json +6 -0
- package/src/intl/sk-SK.json +6 -0
- package/src/intl/sl-SI.json +6 -0
- package/src/intl/sr-SP.json +6 -0
- package/src/intl/sv-SE.json +6 -0
- package/src/intl/tr-TR.json +6 -0
- package/src/intl/uk-UA.json +6 -0
- package/src/intl/zh-CN.json +6 -0
- package/src/intl/zh-TW.json +6 -0
- package/src/useDragAndDrop.ts +30 -32
- package/src/utils.tsx +124 -68
- package/src/virtualizer/Layout.ts +29 -0
package/dist/Separator.js
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Separator.tsx
|
|
1
13
|
import { filterDOMProps } from "./utils.js";
|
|
2
14
|
import { ElementTag } from "./ElementTag.js";
|
|
3
|
-
import { createComponent, mergeProps } from "
|
|
4
|
-
import { createContext, createMemo
|
|
15
|
+
import { createComponent, mergeProps } from "@solidjs/web";
|
|
16
|
+
import { createContext, createMemo } from "solid-js";
|
|
5
17
|
import { createSeparator } from "@proyecto-viviana/solidaria";
|
|
18
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
6
19
|
//#region src/Separator.tsx
|
|
7
20
|
/**
|
|
8
21
|
* Separator component for solidaria-components
|
|
@@ -10,7 +23,7 @@ import { createSeparator } from "@proyecto-viviana/solidaria";
|
|
|
10
23
|
* Pre-wired headless separator component that combines aria hooks.
|
|
11
24
|
* Port of react-aria-components/src/Separator.tsx
|
|
12
25
|
*/
|
|
13
|
-
function assignRef(ref, el) {
|
|
26
|
+
function assignRef$1(ref, el) {
|
|
14
27
|
if (!ref) return;
|
|
15
28
|
if (typeof ref === "function") ref(el);
|
|
16
29
|
else ref.current = el;
|
|
@@ -77,11 +90,14 @@ function Separator(props) {
|
|
|
77
90
|
if (typeof style === "function") return style(renderValues());
|
|
78
91
|
return style;
|
|
79
92
|
});
|
|
93
|
+
const domProps = createMemo(() => filterDOMProps(ariaProps, { global: true }));
|
|
80
94
|
return createComponent(ElementTag, mergeProps({ get tag() {
|
|
81
95
|
return elementType();
|
|
82
|
-
} },
|
|
83
|
-
|
|
84
|
-
|
|
96
|
+
} }, domProps, () => {
|
|
97
|
+
return separatorAria.separatorProps;
|
|
98
|
+
}, {
|
|
99
|
+
ref: (el) => assignRef$1(local.ref, el),
|
|
100
|
+
get "class"() {
|
|
85
101
|
return resolvedClass();
|
|
86
102
|
},
|
|
87
103
|
get style() {
|
package/dist/Separator.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Separator.js","names":["
|
|
1
|
+
{"version":3,"file":"Separator.js","names":["<ElementTag\n tag={elementType()}\n {...domProps()}\n {...separatorAria.separatorProps}\n ref={(el: HTMLElement) => assignRef(local.ref, el)}\n class={resolvedClass()}\n style={resolvedStyle()}\n slot={local.slot}\n />","ref={(el: HTMLElement) => assignRef(local.ref, el)}"],"sources":["../src/Separator.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Separator.tsx\n\n/**\n * Separator component for solidaria-components\n *\n * Pre-wired headless separator component that combines aria hooks.\n * Port of react-aria-components/src/Separator.tsx\n */\n\nimport { createContext, createMemo } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport { ElementTag } from \"./ElementTag\";\nimport {\n createSeparator,\n type AriaSeparatorProps,\n type Orientation,\n} from \"@proyecto-viviana/solidaria\";\nimport { type SlotProps, filterDOMProps } from \"./utils\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\n\ntype RefLike<T> = ((el: T) => void) | { current?: T | null } | undefined;\n\nfunction assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) return;\n if (typeof ref === \"function\") {\n ref(el);\n } else {\n ref.current = el;\n }\n}\n\nexport interface SeparatorRenderProps {\n /** The orientation of the separator. */\n orientation: Orientation;\n}\n\nexport interface SeparatorProps extends AriaSeparatorProps, SlotProps {\n /** The CSS className for the element. A function may be provided to receive render props. */\n class?: string | ((renderProps: SeparatorRenderProps) => string);\n /** The inline style for the element. A function may be provided to receive render props. */\n style?: JSX.CSSProperties | ((renderProps: SeparatorRenderProps) => JSX.CSSProperties);\n /** Ref for the underlying separator element. */\n ref?: RefLike<HTMLElement>;\n}\n\nexport const SeparatorContext = createContext<SeparatorProps | null>(null);\n\n/**\n * A separator is a visual divider between two groups of content,\n * e.g. groups of menu items or sections of a page.\n *\n * @example\n * ```tsx\n * <Separator />\n *\n * // Vertical separator\n * <Separator orientation=\"vertical\" />\n *\n * // Custom element type\n * <Separator elementType=\"div\" />\n * ```\n */\nexport function Separator(props: SeparatorProps): JSX.Element {\n const [local, ariaProps] = splitProps(props, [\"class\", \"style\", \"ref\", \"slot\"]);\n\n const elementType = createMemo(() => {\n let element = ariaProps.elementType || \"hr\";\n // If vertical and using hr, switch to div since hr is inherently horizontal\n if (element === \"hr\" && ariaProps.orientation === \"vertical\") {\n element = \"div\";\n }\n return element;\n });\n\n const separatorAria = createSeparator({\n get orientation() {\n return ariaProps.orientation;\n },\n get elementType() {\n return ariaProps.elementType;\n },\n get \"aria-label\"() {\n return ariaProps[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return ariaProps[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return ariaProps[\"aria-describedby\"];\n },\n get \"aria-details\"() {\n return ariaProps[\"aria-details\"];\n },\n get id() {\n return ariaProps.id;\n },\n });\n\n const renderValues = createMemo<SeparatorRenderProps>(() => ({\n orientation: ariaProps.orientation ?? \"horizontal\",\n }));\n\n const resolvedClass = createMemo(() => {\n const cls = local.class;\n if (typeof cls === \"function\") {\n return cls(renderValues());\n }\n return cls ?? \"solidaria-Separator\";\n });\n\n const resolvedStyle = createMemo(() => {\n const style = local.style;\n if (typeof style === \"function\") {\n return style(renderValues());\n }\n return style;\n });\n\n const domProps = createMemo(() => filterDOMProps(ariaProps, { global: true }));\n\n return (\n <ElementTag\n tag={elementType()}\n {...domProps()}\n {...separatorAria.separatorProps}\n ref={(el: HTMLElement) => assignRef(local.ref, el)}\n class={resolvedClass()}\n style={resolvedStyle()}\n sl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A,YAAAA,WAAAA,EACE,IAAA,MAAA;EAAK,OAAA,YAAY;CAAC,EAOnB,GANK,gBACJ;EAAI,OAAA,cAAc;CAAc,GAHlC;EAIEC,MAAM,OAAoB,YAAU,MAAM,KAAK,EAAE;EACjD,IAAA,UAAA;GAAO,OAAA,cAAc;EAAC;EACtB,IAAA,QAAA;GAAO,OAAA,cAAc;EAAC;EACtB,IAAA,OAAA;GAAM,OAAA,MAAM;EAAI;CACjB,CAAA,CAAA;AAEL"}
|
package/dist/Separator.jsx
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Separator.tsx
|
|
1
13
|
import { filterDOMProps } from "./utils.jsx";
|
|
2
14
|
import { ElementTag } from "./ElementTag.jsx";
|
|
3
|
-
import { createContext, createMemo
|
|
15
|
+
import { createContext, createMemo } from "solid-js";
|
|
4
16
|
import { createSeparator } from "@proyecto-viviana/solidaria";
|
|
17
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
5
18
|
//#region src/Separator.tsx
|
|
6
19
|
/**
|
|
7
20
|
* Separator component for solidaria-components
|
|
@@ -9,7 +22,7 @@ import { createSeparator } from "@proyecto-viviana/solidaria";
|
|
|
9
22
|
* Pre-wired headless separator component that combines aria hooks.
|
|
10
23
|
* Port of react-aria-components/src/Separator.tsx
|
|
11
24
|
*/
|
|
12
|
-
function assignRef(ref, el) {
|
|
25
|
+
function assignRef$1(ref, el) {
|
|
13
26
|
if (!ref) return;
|
|
14
27
|
if (typeof ref === "function") ref(el);
|
|
15
28
|
else ref.current = el;
|
|
@@ -77,7 +90,7 @@ function Separator(props) {
|
|
|
77
90
|
return style;
|
|
78
91
|
});
|
|
79
92
|
const domProps = createMemo(() => filterDOMProps(ariaProps, { global: true }));
|
|
80
|
-
return <ElementTag tag={elementType()} {...domProps()} {...separatorAria.separatorProps} ref={(el) => assignRef(local.ref, el)} class={resolvedClass()} style={resolvedStyle()} slot={local.slot} />;
|
|
93
|
+
return <ElementTag tag={elementType()} {...domProps()} {...separatorAria.separatorProps} ref={(el) => assignRef$1(local.ref, el)} class={resolvedClass()} style={resolvedStyle()} slot={local.slot} />;
|
|
81
94
|
}
|
|
82
95
|
//#endregion
|
|
83
96
|
export { Separator, SeparatorContext };
|
package/dist/Separator.jsx.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Separator.jsx","names":[],"sources":["../src/Separator.tsx"],"sourcesContent":["/**\n * Separator component for solidaria-components\n *\n * Pre-wired headless separator component that combines aria hooks.\n * Port of react-aria-components/src/Separator.tsx\n */\n\nimport {
|
|
1
|
+
{"version":3,"file":"Separator.jsx","names":["assignRef"],"sources":["../src/Separator.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/Separator.tsx\n\n/**\n * Separator component for solidaria-components\n *\n * Pre-wired headless separator component that combines aria hooks.\n * Port of react-aria-components/src/Separator.tsx\n */\n\nimport { createContext, createMemo } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport { ElementTag } from \"./ElementTag\";\nimport {\n createSeparator,\n type AriaSeparatorProps,\n type Orientation,\n} from \"@proyecto-viviana/solidaria\";\nimport { type SlotProps, filterDOMProps } from \"./utils\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\n\ntype RefLike<T> = ((el: T) => void) | { current?: T | null } | undefined;\n\nfunction assignRef<T>(ref: RefLike<T>, el: T): void {\n if (!ref) return;\n if (typeof ref === \"function\") {\n ref(el);\n } else {\n ref.current = el;\n }\n}\n\nexport interface SeparatorRenderProps {\n /** The orientation of the separator. */\n orientation: Orientation;\n}\n\nexport interface SeparatorProps extends AriaSeparatorProps, SlotProps {\n /** The CSS className for the element. A function may be provided to receive render props. */\n class?: string | ((renderProps: SeparatorRenderProps) => string);\n /** The inline style for the element. A function may be provided to receive render props. */\n style?: JSX.CSSProperties | ((renderProps: SeparatorRenderProps) => JSX.CSSProperties);\n /** Ref for the underlying separator element. */\n ref?: RefLike<HTMLElement>;\n}\n\nexport const SeparatorContext = createContext<SeparatorProps | null>(null);\n\n/**\n * A separator is a visual divider between two groups of content,\n * e.g. groups of menu items or sections of a page.\n *\n * @example\n * ```tsx\n * <Separator />\n *\n * // Vertical separator\n * <Separator orientation=\"vertical\" />\n *\n * // Custom element type\n * <Separator elementType=\"div\" />\n * ```\n */\nexport function Separator(props: SeparatorProps): JSX.Element {\n const [local, ariaProps] = splitProps(props, [\"class\", \"style\", \"ref\", \"slot\"]);\n\n const elementType = createMemo(() => {\n let element = ariaProps.elementType || \"hr\";\n // If vertical and using hr, switch to div since hr is inherently horizontal\n if (element === \"hr\" && ariaProps.orientation === \"vertical\") {\n element = \"div\";\n }\n return element;\n });\n\n const separatorAria = createSeparator({\n get orientation() {\n return ariaProps.orientation;\n },\n get elementType() {\n return ariaProps.elementType;\n },\n get \"aria-label\"() {\n return ariaProps[\"aria-label\"];\n },\n get \"aria-labelledby\"() {\n return ariaProps[\"aria-labelledby\"];\n },\n get \"aria-describedby\"() {\n return ariaProps[\"aria-describedby\"];\n },\n get \"aria-details\"() {\n return ariaProps[\"aria-details\"];\n },\n get id() {\n return ariaProps.id;\n },\n });\n\n const renderValues = createMemo<SeparatorRenderProps>(() => ({\n orientation: ariaProps.orientation ?? \"horizontal\",\n }));\n\n const resolvedClass = createMemo(() => {\n const cls = local.class;\n if (typeof cls === \"function\") {\n return cls(renderValues());\n }\n return cls ?? \"solidaria-Separator\";\n });\n\n const resolvedStyle = createMemo(() => {\n const style = local.style;\n if (typeof style === \"function\") {\n return style(renderValues());\n }\n return style;\n });\n\n const domProps = createMemo(() => filterDOMProps(ariaProps, { global: true }));\n\n return (\n <ElementTag\n tag={elementType()}\n {...domProps()}\n {...separatorAria.separatorProps}\n ref={(el: HTMLElement) => assignRef(local.ref, el)}\n class={resolvedClass()}\n style={resolvedStyle()}\n slot={local.slot}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAASA,YAAa,KAAiB,IAAa;CAClD,IAAI,CAAC,KAAK;CACV,IAAI,OAAO,QAAQ,YACjB,IAAI,EAAE;MAEN,IAAI,UAAU;AAElB;AAgBA,MAAa,mBAAmB,cAAqC,IAAI;;;;;;;;;;;;;;;;AAiBzE,SAAgB,UAAU,OAAoC;CAC5D,MAAM,CAAC,OAAO,aAAa,WAAW,OAAO;EAAC;EAAS;EAAS;EAAO;CAAM,CAAC;CAE9E,MAAM,cAAc,iBAAiB;EACnC,IAAI,UAAU,UAAU,eAAe;EAEvC,IAAI,YAAY,QAAQ,UAAU,gBAAgB,YAChD,UAAU;EAEZ,OAAO;CACT,CAAC;CAED,MAAM,gBAAgB,gBAAgB;EACpC,IAAI,cAAc;GAChB,OAAO,UAAU;EACnB;EACA,IAAI,cAAc;GAChB,OAAO,UAAU;EACnB;EACA,IAAI,eAAe;GACjB,OAAO,UAAU;EACnB;EACA,IAAI,oBAAoB;GACtB,OAAO,UAAU;EACnB;EACA,IAAI,qBAAqB;GACvB,OAAO,UAAU;EACnB;EACA,IAAI,iBAAiB;GACnB,OAAO,UAAU;EACnB;EACA,IAAI,KAAK;GACP,OAAO,UAAU;EACnB;CACF,CAAC;CAED,MAAM,eAAe,kBAAwC,EAC3D,aAAa,UAAU,eAAe,aACxC,EAAE;CAEF,MAAM,gBAAgB,iBAAiB;EACrC,MAAM,MAAM,MAAM;EAClB,IAAI,OAAO,QAAQ,YACjB,OAAO,IAAI,aAAa,CAAC;EAE3B,OAAO,OAAO;CAChB,CAAC;CAED,MAAM,gBAAgB,iBAAiB;EACrC,MAAM,QAAQ,MAAM;EACpB,IAAI,OAAO,UAAU,YACnB,OAAO,MAAM,aAAa,CAAC;EAE7B,OAAO;CACT,CAAC;CAED,MAAM,WAAW,iBAAiB,eAAe,WAAW,EAAE,QAAQ,KAAK,CAAC,CAAC;CAE7E,OACE,CAAC,WACC,KAAK,YAAY,OACb,SAAS,OACT,cAAc,gBAClB,MAAM,OAAoBA,YAAU,MAAM,KAAK,EAAE,GACjD,OAAO,cAAc,GACrB,OAAO,cAAc,GACrB,MAAM,MAAM;AAGlB"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* SharedElementTransition primitives for solidaria-components.
|
|
3
|
-
*
|
|
4
|
-
* Provides FLIP-based shared element animations when elements move between
|
|
5
|
-
* parents within a scope. Captures geometry snapshots on unmount and applies
|
|
6
|
-
* transition animations on mount.
|
|
7
|
-
*
|
|
8
|
-
* Parity target: react-aria-components/src/SharedElementTransition.tsx
|
|
9
|
-
*/
|
|
10
|
-
import { type JSX } from "solid-js";
|
|
1
|
+
import type { JSX } from "@solidjs/web";
|
|
11
2
|
import { type ClassNameOrFunction, type StyleOrFunction, type RenderChildren } from "./utils";
|
|
12
3
|
export declare function useHasSharedElementTransitionScope(): boolean;
|
|
13
4
|
export interface SharedElementTransitionProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedElementTransition.d.ts","sourceRoot":"","sources":["../src/SharedElementTransition.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SharedElementTransition.d.ts","sourceRoot":"","sources":["../src/SharedElementTransition.tsx"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,cAAc,EAIpB,MAAM,SAAS,CAAC;AAoBjB,wBAAgB,kCAAkC,IAAI,OAAO,CAE5D;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,GAAG,GAAG,CAAC,OAAO,CAMxF;AAED,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAClD,GAAG,CAAC,cAAc,CAAC,cAAc,CAAC,EAClC,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CACvC;IACC,QAAQ,CAAC,EAAE,cAAc,CAAC,wBAAwB,CAAC,CAAC;IACpD,KAAK,CAAC,EAAE,mBAAmB,CAAC,wBAAwB,CAAC,CAAC;IACtD,KAAK,CAAC,EAAE,eAAe,CAAC,wBAAwB,CAAC,CAAC;CACnD;AAED,MAAM,WAAW,kBAAmB,SAAQ,sBAAsB;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,cAAc,KAAK,IAAI,CAAC,GAAG;QAAE,OAAO,CAAC,EAAE,cAAc,CAAA;KAAE,CAAC;CACrE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAwO3E"}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/SharedElementTransition.tsx
|
|
13
|
+
import { dataAttr, filterDOMProps, useRenderProps } from "./utils.js";
|
|
14
|
+
import { createComponent, getNextElement, insert, ref, runHydrationEvents, scope, spread, template } from "@solidjs/web";
|
|
15
|
+
import { Show, createContext, createEffect, createMemo, createRenderEffect, createSignal, onCleanup, untrack, useContext } from "solid-js";
|
|
16
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
4
17
|
//#region src/SharedElementTransition.tsx
|
|
5
18
|
/**
|
|
6
19
|
* SharedElementTransition primitives for solidaria-components.
|
|
@@ -9,9 +22,9 @@ import { Show, createContext, createEffect, createMemo, createRenderEffect, crea
|
|
|
9
22
|
* parents within a scope. Captures geometry snapshots on unmount and applies
|
|
10
23
|
* transition animations on mount.
|
|
11
24
|
*
|
|
12
|
-
*
|
|
25
|
+
* Based on packages/react-aria-components/src/SharedElementTransition.tsx.
|
|
13
26
|
*/
|
|
14
|
-
var _tmpl$ =
|
|
27
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
15
28
|
/** Safe wrapper — jsdom doesn't implement the Web Animations API. */
|
|
16
29
|
function getAnimations(el) {
|
|
17
30
|
return typeof el.getAnimations === "function" ? el.getAnimations() : [];
|
|
@@ -24,7 +37,7 @@ function useHasSharedElementTransitionScope() {
|
|
|
24
37
|
* A scope for SharedElements, which animate between parents.
|
|
25
38
|
*/
|
|
26
39
|
function SharedElementTransition(props) {
|
|
27
|
-
return createComponent(SharedElementContext
|
|
40
|
+
return createComponent(SharedElementContext, {
|
|
28
41
|
value: { snapshots: {} },
|
|
29
42
|
get children() {
|
|
30
43
|
return props.children;
|
|
@@ -36,8 +49,8 @@ function SharedElementTransition(props) {
|
|
|
36
49
|
* between parents within a SharedElementTransition scope.
|
|
37
50
|
*/
|
|
38
51
|
function SharedElement(props) {
|
|
39
|
-
const scope = useContext(SharedElementContext);
|
|
40
|
-
if (!scope) throw new Error("<SharedElement> must be rendered inside a <SharedElementTransition>");
|
|
52
|
+
const scope$1 = useContext(SharedElementContext);
|
|
53
|
+
if (!scope$1) throw new Error("<SharedElement> must be rendered inside a <SharedElementTransition>");
|
|
41
54
|
const [local, domProps] = splitProps(props, [
|
|
42
55
|
"name",
|
|
43
56
|
"isVisible",
|
|
@@ -46,8 +59,9 @@ function SharedElement(props) {
|
|
|
46
59
|
"style",
|
|
47
60
|
"ref"
|
|
48
61
|
]);
|
|
49
|
-
const [lifecycle, setLifecycle] = createSignal(local.isVisible === false ? "hidden" : "visible");
|
|
50
|
-
|
|
62
|
+
const [lifecycle, setLifecycle] = createSignal(untrack(() => local.isVisible === false ? "hidden" : "visible"));
|
|
63
|
+
let pendingFreshEnter = false;
|
|
64
|
+
const [element, setElement] = createSignal(void 0, { ownedWrite: true });
|
|
51
65
|
let frame;
|
|
52
66
|
const setRef = (el) => {
|
|
53
67
|
setElement(el);
|
|
@@ -61,30 +75,39 @@ function SharedElement(props) {
|
|
|
61
75
|
const style = window.getComputedStyle(el);
|
|
62
76
|
if (style.transitionProperty !== "none") {
|
|
63
77
|
const transitionProperty = style.transitionProperty.split(/\s*,\s*/);
|
|
64
|
-
scope.snapshots[local.name] = {
|
|
78
|
+
scope$1.snapshots[local.name] = {
|
|
65
79
|
rect: el.getBoundingClientRect(),
|
|
66
80
|
style: transitionProperty.map((property) => [property, style.getPropertyValue(property)])
|
|
67
81
|
};
|
|
68
82
|
}
|
|
69
83
|
}
|
|
70
84
|
};
|
|
71
|
-
createRenderEffect(
|
|
72
|
-
if (isVisible && untrack(lifecycle) === "hidden")
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
createRenderEffect(() => local.isVisible !== false, (isVisible) => {
|
|
86
|
+
if (isVisible && untrack(lifecycle) === "hidden") {
|
|
87
|
+
pendingFreshEnter = true;
|
|
88
|
+
setLifecycle("visible");
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
createRenderEffect(() => local.isVisible !== false, (isVisible) => {
|
|
92
|
+
return () => {
|
|
76
93
|
if (isVisible) storeSnapshot();
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
createEffect(
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
createEffect(() => {
|
|
97
|
+
return {
|
|
98
|
+
isVisible: local.isVisible !== false,
|
|
99
|
+
el: element()
|
|
100
|
+
};
|
|
101
|
+
}, ({ isVisible, el }) => {
|
|
80
102
|
const name = local.name;
|
|
81
103
|
if (frame != null) {
|
|
82
104
|
cancelAnimationFrame(frame);
|
|
83
105
|
frame = void 0;
|
|
84
106
|
}
|
|
85
107
|
if (isVisible && el) {
|
|
86
|
-
const prevSnapshot = scope.snapshots[name];
|
|
108
|
+
const prevSnapshot = scope$1.snapshots[name];
|
|
87
109
|
if (prevSnapshot) {
|
|
110
|
+
pendingFreshEnter = false;
|
|
88
111
|
setLifecycle("visible");
|
|
89
112
|
const animations = getAnimations(el);
|
|
90
113
|
const values = prevSnapshot.style.map(([property, prevValue]) => {
|
|
@@ -103,22 +126,23 @@ function SharedElement(props) {
|
|
|
103
126
|
frame = void 0;
|
|
104
127
|
for (const [property, value] of values) el.style.setProperty(property, value);
|
|
105
128
|
});
|
|
106
|
-
delete scope.snapshots[name];
|
|
107
|
-
} else {
|
|
108
|
-
|
|
129
|
+
delete scope$1.snapshots[name];
|
|
130
|
+
} else if (pendingFreshEnter) {
|
|
131
|
+
pendingFreshEnter = false;
|
|
132
|
+
setLifecycle("entering");
|
|
109
133
|
frame = requestAnimationFrame(() => {
|
|
110
134
|
frame = void 0;
|
|
111
135
|
setLifecycle("visible");
|
|
112
136
|
});
|
|
113
137
|
}
|
|
114
|
-
} else if (!isVisible
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
})
|
|
138
|
+
} else if (!isVisible) {
|
|
139
|
+
setLifecycle("hidden");
|
|
140
|
+
const snapshotName = name;
|
|
141
|
+
queueMicrotask(() => {
|
|
142
|
+
if (scope$1.snapshots[snapshotName]) delete scope$1.snapshots[snapshotName];
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
});
|
|
122
146
|
onCleanup(() => {
|
|
123
147
|
if (frame != null) cancelAnimationFrame(frame);
|
|
124
148
|
});
|
|
@@ -140,22 +164,26 @@ function SharedElement(props) {
|
|
|
140
164
|
},
|
|
141
165
|
get children() {
|
|
142
166
|
var _el$ = getNextElement(_tmpl$);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
167
|
+
ref(() => {
|
|
168
|
+
return setRef;
|
|
169
|
+
}, _el$);
|
|
170
|
+
spread(_el$, [filteredDomProps, {
|
|
171
|
+
get "class"() {
|
|
146
172
|
return renderProps.class();
|
|
147
173
|
},
|
|
148
174
|
get style() {
|
|
149
175
|
return renderProps.style();
|
|
150
176
|
},
|
|
151
|
-
get
|
|
152
|
-
return lifecycle() === "entering"
|
|
177
|
+
get "data-entering"() {
|
|
178
|
+
return dataAttr(lifecycle() === "entering");
|
|
153
179
|
},
|
|
154
|
-
get
|
|
155
|
-
return lifecycle() === "exiting"
|
|
180
|
+
get "data-exiting"() {
|
|
181
|
+
return dataAttr(lifecycle() === "exiting");
|
|
156
182
|
}
|
|
157
|
-
}
|
|
158
|
-
insert(_el$, () =>
|
|
183
|
+
}], true);
|
|
184
|
+
insert(_el$, scope(() => {
|
|
185
|
+
return renderProps.renderChildren();
|
|
186
|
+
}));
|
|
159
187
|
runHydrationEvents();
|
|
160
188
|
return _el$;
|
|
161
189
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedElementTransition.js","names":["JSX","createContext","createEffect","createMemo","createRenderEffect","createSignal","onCleanup","splitProps","untrack","useContext","Show","on","ClassNameOrFunction","StyleOrFunction","RenderChildren","useRenderProps","filterDOMProps","SharedElementLifecycle","getAnimations","el","HTMLElement","Animation","Snapshot","rect","DOMRect","style","SharedElementScope","snapshots","name","SharedElementContext","useHasSharedElementTransitionScope","SharedElementTransitionProps","children","Element","SharedElementTransition","props","scope","_$createComponent","Provider","value","SharedElementRenderProps","isEntering","isExiting","SharedElementPropsBase","Omit","HTMLAttributes","HTMLDivElement","class","SharedElementProps","isVisible","ref","current","SharedElement","Error","local","domProps","lifecycle","setLifecycle","element","setElement","frame","setRef","userRef","undefined","storeSnapshot","isConnected","hasAttribute","window","getComputedStyle","transitionProperty","split","getBoundingClientRect","map","property","getPropertyValue","const","cancelAnimationFrame","prevSnapshot","animations","values","prevValue","prevRect","currentRect","deltaX","left","deltaY","top","setProperty","a","includes","cancel","requestAnimationFrame","queueMicrotask","Promise","all","finished","then","catch","renderProps","defaultClassName","filteredDomProps","global","when","_el$","_$getNextElement","_tmpl$","_$use","_$spread","_$mergeProps","data-entering","data-exiting","_$insert","renderChildren","_$runHydrationEvents"],"sources":["../src/SharedElementTransition.tsx"],"sourcesContent":["/**\n * SharedElementTransition primitives for solidaria-components.\n *\n * Provides FLIP-based shared element animations when elements move between\n * parents within a scope. Captures geometry snapshots on unmount and applies\n * transition animations on mount.\n *\n * Parity target: react-aria-components/src/SharedElementTransition.tsx\n */\n\nimport {\n type JSX,\n createContext,\n createEffect,\n createMemo,\n createRenderEffect,\n createSignal,\n onCleanup,\n splitProps,\n untrack,\n useContext,\n Show,\n on,\n} from \"solid-js\";\nimport {\n type ClassNameOrFunction,\n type StyleOrFunction,\n type RenderChildren,\n useRenderProps,\n filterDOMProps,\n} from \"./utils\";\n\ntype SharedElementLifecycle = \"hidden\" | \"entering\" | \"visible\" | \"exiting\";\n\n/** Safe wrapper — jsdom doesn't implement the Web Animations API. */\nfunction getAnimations(el: HTMLElement): Animation[] {\n return typeof el.getAnimations === \"function\" ? el.getAnimations() : [];\n}\n\ninterface Snapshot {\n rect: DOMRect;\n style: [string, string][];\n}\n\ninterface SharedElementScope {\n snapshots: { [name: string]: Snapshot };\n}\n\nconst SharedElementContext = createContext<SharedElementScope | null>(null);\n\nexport function useHasSharedElementTransitionScope(): boolean {\n return useContext(SharedElementContext) != null;\n}\n\nexport interface SharedElementTransitionProps {\n children?: JSX.Element;\n}\n\n/**\n * A scope for SharedElements, which animate between parents.\n */\nexport function SharedElementTransition(props: SharedElementTransitionProps): JSX.Element {\n const scope: SharedElementScope = {\n snapshots: {},\n };\n\n return (\n <SharedElementContext.Provider value={scope}>{props.children}</SharedElementContext.Provider>\n );\n}\n\nexport interface SharedElementRenderProps {\n isEntering: boolean;\n isExiting: boolean;\n}\n\nexport interface SharedElementPropsBase extends Omit<\n JSX.HTMLAttributes<HTMLDivElement>,\n \"children\" | \"class\" | \"style\" | \"ref\"\n> {\n children?: RenderChildren<SharedElementRenderProps>;\n class?: ClassNameOrFunction<SharedElementRenderProps>;\n style?: StyleOrFunction<SharedElementRenderProps>;\n}\n\nexport interface SharedElementProps extends SharedElementPropsBase {\n name: string;\n isVisible?: boolean;\n ref?: ((el: HTMLDivElement) => void) | { current?: HTMLDivElement };\n}\n\n/**\n * An element that animates between its old and new position when moving\n * between parents within a SharedElementTransition scope.\n */\nexport function SharedElement(props: SharedElementProps): JSX.Element | null {\n const scope = useContext(SharedElementContext);\n if (!scope) {\n throw new Error(\"<SharedElement> must be rendered inside a <SharedElementTransition>\");\n }\n\n const [local, domProps] = splitProps(props, [\n \"name\",\n \"isVisible\",\n \"children\",\n \"class\",\n \"style\",\n \"ref\",\n ]);\n\n const [lifecycle, setLifecycle] = createSignal<SharedElementLifecycle>(\n local.isVisible === false ? \"hidden\" : \"visible\",\n );\n\n // The mounted div, tracked as a signal so the FLIP-read effect below REACTS to\n // it appearing. React guarantees `ref.current` is committed before the layout\n // effect body runs; Solid gives no such ordering between the `<Show>`'s\n // insertion render-effect and a plain createEffect, so we make the read depend\n // on the element instead of racing its mount (see READ PHASE).\n const [element, setElement] = createSignal<HTMLDivElement | undefined>();\n let frame: number | undefined;\n\n const setRef = (el: HTMLDivElement) => {\n setElement(el);\n // Forward ref to consumer\n const userRef = local.ref;\n if (typeof userRef === \"function\") {\n userRef(el);\n } else if (userRef !== undefined) {\n userRef.current = el;\n }\n };\n\n // Store a geometry + transition-style snapshot of the currently-mounted\n // element, so a sibling SharedElement with the same `name` can FLIP from it.\n // Mirrors upstream's layout-effect *cleanup*\n // (react-aria-components/src/SharedElementTransition.tsx), which runs for\n // every `isVisible` flip — not only on unmount.\n const storeSnapshot = () => {\n const el = untrack(element);\n if (el && el.isConnected && !el.hasAttribute(\"data-exiting\")) {\n // Store a snapshot of the rectangle and computed style for transitioning properties.\n const style = window.getComputedStyle(el);\n if (style.transitionProperty !== \"none\") {\n const transitionProperty = style.transitionProperty.split(/\\s*,\\s*/);\n scope.snapshots[local.name] = {\n rect: el.getBoundingClientRect(),\n style: transitionProperty.map((property) => [property, style.getPropertyValue(property)]),\n };\n }\n }\n };\n\n // MOUNT-IN-RENDER — mirrors upstream's render-phase\n // `if (isVisible && state === 'hidden') setState('visible')`. Promoting a\n // hidden element to visible in the render phase mounts its div (via the\n // `<Show>` below) BEFORE the FLIP-read createEffect runs, so the incoming\n // element is in the DOM to be measured and translated. Without this the\n // incoming element's ref is still null when the read effect fires and it can\n // only enter fresh — never FLIP. Keyed on `isVisible` (untracked lifecycle\n // read) so it cannot loop.\n createRenderEffect(\n on(\n () => local.isVisible !== false,\n (isVisible) => {\n if (isVisible && untrack(lifecycle) === \"hidden\") {\n setLifecycle(\"visible\");\n }\n },\n ),\n );\n\n // STORE PHASE — a render effect runs before user effects within a Solid\n // batch, exactly as React runs all layout-effect destroys before any create.\n // The cleanup registered here fires on the *next* `isVisible` change (and on\n // disposal), capturing the outgoing snapshot BEFORE any sibling's FLIP-read\n // createEffect below runs — React's two-phase commit. Only the cleanup\n // registered while VISIBLE stores (an outgoing element); an incoming\n // element's prior cleanup was registered while hidden and must not clobber\n // the outgoing snapshot. This mirrors React closing over `element =\n // ref.current`, which is null while hidden.\n createRenderEffect(\n on(\n () => local.isVisible !== false,\n (isVisible) => {\n onCleanup(() => {\n if (isVisible) {\n storeSnapshot();\n }\n });\n },\n ),\n );\n\n // READ PHASE — mirrors upstream's layout-effect body, which reads the freshly\n // committed `ref.current`. Keying on the `element` signal (not just isVisible)\n // makes this run only once the incoming div is actually mounted: when isVisible\n // flips true the mount-in-render effect above mounts the div, `setRef` sets the\n // signal, and this effect runs with `el` present — never against a null ref.\n // (Solid batches, so an isVisible flip + the resulting mount coalesce into one\n // run with the mounted element.) There is therefore no \"element not yet in DOM\"\n // fresh-enter branch: with no committed div there is nothing to measure, so we\n // wait — exactly as React never runs the body before commit.\n createEffect(\n on(\n [() => local.isVisible !== false, element] as const,\n ([isVisible, el]) => {\n const name = local.name;\n\n if (frame != null) {\n cancelAnimationFrame(frame);\n frame = undefined;\n }\n\n if (isVisible && el) {\n const prevSnapshot = scope.snapshots[name];\n\n if (prevSnapshot) {\n // FLIP: Element is transitioning from a previous instance.\n setLifecycle(\"visible\");\n const animations = getAnimations(el);\n\n // Set properties to animate from.\n const values = prevSnapshot.style.map(([property, prevValue]) => {\n const value = el.style.getPropertyValue(property);\n if (property === \"translate\") {\n const prevRect = prevSnapshot.rect;\n const currentRect = el.getBoundingClientRect();\n const deltaX = prevRect.left - currentRect.left;\n const deltaY = prevRect.top - currentRect.top;\n el.style.setProperty(\"translate\", `${deltaX}px ${deltaY}px`);\n } else {\n el.style.setProperty(property, prevValue);\n }\n return [property, value] as [string, string];\n });\n\n // Cancel any new animations triggered by these properties.\n for (const a of getAnimations(el)) {\n if (!animations.includes(a)) {\n a.cancel();\n }\n }\n\n // Remove overrides after one frame to animate to the current values.\n frame = requestAnimationFrame(() => {\n frame = undefined;\n for (const [property, value] of values) {\n el.style.setProperty(property, value);\n }\n });\n\n delete scope.snapshots[name];\n } else {\n // No previous instance exists, apply the entering state.\n queueMicrotask(() => setLifecycle(\"entering\"));\n frame = requestAnimationFrame(() => {\n frame = undefined;\n setLifecycle(\"visible\");\n });\n }\n } else if (!isVisible && el) {\n // Wait a microtask to check if a snapshot still exists (meaning no new\n // SharedElement consumed it), then enter exiting state.\n queueMicrotask(() => {\n if (scope.snapshots[name]) {\n delete scope.snapshots[name];\n setLifecycle(\"exiting\");\n // Wait for animations to finish before hiding.\n Promise.all(getAnimations(el).map((a) => a.finished))\n .then(() => setLifecycle(\"hidden\"))\n .catch(() => {});\n } else {\n // Snapshot was consumed by another instance, unmount immediately.\n setLifecycle(\"hidden\");\n }\n });\n }\n },\n ),\n );\n\n // Cancel any pending FLIP frame on disposal. The snapshot store lives in the\n // render-effect cleanup above, which also fires on disposal.\n onCleanup(() => {\n if (frame != null) {\n cancelAnimationFrame(frame);\n }\n });\n\n const renderProps = useRenderProps(\n {\n get children() {\n return local.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-SharedElement\",\n },\n () => ({\n isEntering: lifecycle() === \"entering\",\n isExiting: lifecycle() === \"exiting\",\n }),\n );\n\n const filteredDomProps = createMemo(() => filterDOMProps(domProps, { global: true }));\n\n return (\n <Show when={lifecycle() !== \"hidden\"}>\n <div\n ref={setRef}\n {...filteredDomProps()}\n class={renderProps.class()}\n style={renderProps.style()}\n data-entering={lifecycle() === \"entering\" || undefined}\n data-exiting={lifecycle() === \"exiting\" || undefined}\n >\n {renderProps.renderChildren()}\n </div>\n </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmCA,SAASkB,cAAcC,IAA8B;CACnD,OAAO,OAAOA,GAAGD,kBAAkB,aAAaC,GAAGD,cAAc,IAAI,CAAA;AACvE;AAWA,MAAMW,uBAAuB5B,cAAyC,IAAI;AAE1E,SAAgB6B,qCAA8C;CAC5D,OAAOrB,WAAWoB,oBAAoB,KAAK;AAC7C;;;;AASA,SAAgBK,wBAAwBC,OAAkD;CAKxF,OAAAE,gBACGR,qBAAqBS,UAAQ;EAACC,OAAOH,EAJtCT,WAAW,CAAC,EAI0BS;EAAK,IAAAJ,WAAA;GAAA,OAAGG,MAAMH;EAAQ;CAAA,CAAA;AAEhE;;;;;AA0BA,SAAgBoB,cAAcjB,OAA+C;CAC3E,MAAMC,QAAQ3B,WAAWoB,oBAAoB;CAC7C,IAAI,CAACO,OACH,MAAM,IAAIiB,MAAM,qEAAqE;CAGvF,MAAM,CAACC,OAAOC,YAAYhD,WAAW4B,OAAO;EAC1C;EACA;EACA;EACA;EACA;EACA;CAAK,CACN;CAED,MAAM,CAACqB,WAAWC,gBAAgBpD,aAChCiD,MAAML,cAAc,QAAQ,WAAW,SACzC;CAOA,MAAM,CAACS,SAASC,cAActD,aAAyC;CACvE,IAAIuD;CAEJ,MAAMC,UAAU1C,OAAuB;EACrCwC,WAAWxC,EAAE;EAEb,MAAM2C,UAAUR,MAAMJ;EACtB,IAAI,OAAOY,YAAY,YACrBA,QAAQ3C,EAAE;OACL,IAAI2C,YAAYC,KAAAA,GACrBD,QAAQX,UAAUhC;CAEtB;CAOA,MAAM6C,sBAAsB;EAC1B,MAAM7C,KAAKX,QAAQkD,OAAO;EAC1B,IAAIvC,MAAMA,GAAG8C,eAAe,CAAC9C,GAAG+C,aAAa,cAAc,GAAG;GAE5D,MAAMzC,QAAQ0C,OAAO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pF,OAAAhE,gBACG3B,MAAI;EAAA,IAAC4F,OAAI;GAAA,OAAE9C,UAAU,MAAM;EAAQ;EAAA,IAAAxB,WAAA;GAAA,IAAAuE,OAAAC,eAAAC,MAAA;GAAAC,IAE3B7C,QAAM0C,IAAA;GAAAI,OAAAJ,MAAAK,WACPR,kBAAgB;IAAA,KAAA,WAAA;KAAA,OACbF,YAAYnD,MAAM;IAAC;IAAA,IAC1BtB,QAAK;KAAA,OAAEyE,YAAYzE,MAAM;IAAC;IAAA,KAAA,mBAAA;KAAA,OACX+B,UAAU,MAAM,cAAcO,KAAAA;IAAS;IAAA,KAAA,kBAAA;KAAA,OACxCP,UAAU,MAAM,aAAaO,KAAAA;IAAS;GAAA,CAAA,GAAA,OAAA,IAAA;GAAAgD,OAAAR,YAEnDL,YAAYc,eAAe,CAAC;GAAAC,mBAAA;GAAA,OAAAV;EAAA;CAAA,CAAA;AAIrC"}
|
|
1
|
+
{"version":3,"file":"SharedElementTransition.js","names":["<SharedElementContext value={scope}>{props.children}</SharedElementContext>","value={scope}","<Show when={lifecycle() !== \"hidden\"}>\n <div\n ref={setRef}\n {...filteredDomProps()}\n class={renderProps.class()}\n style={renderProps.style()}\n data-entering={dataAttr(lifecycle() === \"entering\")}\n data-exiting={dataAttr(lifecycle() === \"exiting\")}\n >\n {renderProps.renderChildren()}\n </div>\n </Show>","ref={setRef}","{renderProps.renderChildren()}","<div\n ref={setRef}\n {...filteredDomProps()}\n class={renderProps.class()}\n style={renderProps.style()}\n data-entering={dataAttr(lifecycle() === \"entering\")}\n data-exiting={dataAttr(lifecycle() === \"exiting\")}\n >\n {renderProps.renderChildren()}\n </div>"],"sources":["../src/SharedElementTransition.tsx"],"sourcesContent":["/*\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/SharedElementTransition.tsx\n\n/**\n * SharedElementTransition primitives for solidaria-components.\n *\n * Provides FLIP-based shared element animations when elements move between\n * parents within a scope. Captures geometry snapshots on unmount and applies\n * transition animations on mount.\n *\n * Based on packages/react-aria-components/src/SharedElementTransition.tsx.\n */\n\nimport {\n createContext,\n createEffect,\n createMemo,\n createRenderEffect,\n createSignal,\n onCleanup,\n untrack,\n useContext,\n Show,\n} from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport { splitProps } from \"@proyecto-viviana/solidaria/utils\";\nimport {\n type ClassNameOrFunction,\n type StyleOrFunction,\n type RenderChildren,\n useRenderProps,\n filterDOMProps,\n dataAttr,\n} from \"./utils\";\n\ntype SharedElementLifecycle = \"hidden\" | \"entering\" | \"visible\" | \"exiting\";\n\n/** Safe wrapper — jsdom doesn't implement the Web Animations API. */\nfunction getAnimations(el: HTMLElement): Animation[] {\n return typeof el.getAnimations === \"function\" ? el.getAnimations() : [];\n}\n\ninterface Snapshot {\n rect: DOMRect;\n style: [string, string][];\n}\n\ninterface SharedElementScope {\n snapshots: { [name: string]: Snapshot };\n}\n\nconst SharedElementContext = createContext<SharedElementScope | null>(null);\n\nexport function useHasSharedElementTransitionScope(): boolean {\n return useContext(SharedElementContext) != null;\n}\n\nexport interface SharedElementTransitionProps {\n children?: JSX.Element;\n}\n\n/**\n * A scope for SharedElements, which animate between parents.\n */\nexport function SharedElementTransition(props: SharedElementTransitionProps): JSX.Element {\n const scope: SharedElementScope = {\n snapshots: {},\n };\n\n return <SharedElementContext value={scope}>{props.children}</SharedElementContext>;\n}\n\nexport interface SharedElementRenderProps {\n isEntering: boolean;\n isExiting: boolean;\n}\n\nexport interface SharedElementPropsBase extends Omit<\n JSX.HTMLAttributes<HTMLDivElement>,\n \"children\" | \"class\" | \"style\" | \"ref\"\n> {\n children?: RenderChildren<SharedElementRenderProps>;\n class?: ClassNameOrFunction<SharedElementRenderProps>;\n style?: StyleOrFunction<SharedElementRenderProps>;\n}\n\nexport interface SharedElementProps extends SharedElementPropsBase {\n name: string;\n isVisible?: boolean;\n ref?: ((el: HTMLDivElement) => void) | { current?: HTMLDivElement };\n}\n\n/**\n * An element that animates between its old and new position when moving\n * between parents within a SharedElementTransition scope.\n */\nexport function SharedElement(props: SharedElementProps): JSX.Element | null {\n const scope = useContext(SharedElementContext);\n if (!scope) {\n throw new Error(\"<SharedElement> must be rendered inside a <SharedElementTransition>\");\n }\n\n const [local, domProps] = splitProps(props, [\n \"name\",\n \"isVisible\",\n \"children\",\n \"class\",\n \"style\",\n \"ref\",\n ]);\n\n const [lifecycle, setLifecycle] = createSignal<SharedElementLifecycle>(\n untrack(() => (local.isVisible === false ? \"hidden\" : \"visible\")),\n );\n // Fresh-enter (data-entering) is only for elements that were hidden and then\n // shown. An element that starts visible must not queue the enter microtask on\n // first mount — that microtask would otherwise fire after a later hide and\n // resurrect the outgoing node as `data-entering`.\n let pendingFreshEnter = false;\n\n // The mounted div, tracked as a signal so the FLIP-read effect below REACTS to\n // it appearing. React guarantees `ref.current` is committed before the layout\n // effect body runs; Solid gives no such ordering between the `<Show>`'s\n // insertion render-effect and a plain createEffect, so we make the read depend\n // on the element instead of racing its mount (see READ PHASE).\n const [element, setElement] = createSignal<HTMLDivElement | undefined>(undefined, {\n ownedWrite: true,\n });\n let frame: number | undefined;\n\n const setRef = (el: HTMLDivElement) => {\n setElement(el);\n // Forward ref to consumer\n const userRef = local.ref;\n if (typeof userRef === \"function\") {\n userRef(el);\n } else if (userRef !== undefined) {\n userRef.current = el;\n }\n };\n\n // Store a geometry + transition-style snapshot of the currently-mounted\n // element, so a sibling SharedElement with the same `name` can FLIP from it.\n // Mirrors upstream's layout-effect *cleanup*\n // (react-aria-components/src/SharedElementTransition.tsx), which runs for\n // every `isVisible` flip — not only on unmount.\n const storeSnapshot = () => {\n const el = untrack(element);\n if (el && el.isConnected && !el.hasAttribute(\"data-exiting\")) {\n // Store a snapshot of the rectangle and computed style for transitioning properties.\n const style = window.getComputedStyle(el);\n if (style.transitionProperty !== \"none\") {\n const transitionProperty = style.transitionProperty.split(/\\s*,\\s*/);\n scope.snapshots[local.name] = {\n rect: el.getBoundingClientRect(),\n style: transitionProperty.map((property) => [property, style.getPropertyValue(property)]),\n };\n }\n }\n };\n\n // MOUNT-IN-RENDER — mirrors upstream's render-phase\n // `if (isVisible && state === 'hidden') setState('visible')`. Promoting a\n // hidden element to visible in the render phase mounts its div (via the\n // `<Show>` below) BEFORE the FLIP-read createEffect runs, so the incoming\n // element is in the DOM to be measured and translated. Without this the\n // incoming element's ref is still null when the read effect fires and it can\n // only enter fresh — never FLIP. Keyed on `isVisible` (untracked lifecycle\n // read) so it cannot loop.\n createRenderEffect(\n () => local.isVisible !== false,\n (isVisible) => {\n if (isVisible && untrack(lifecycle) === \"hidden\") {\n pendingFreshEnter = true;\n setLifecycle(\"visible\");\n }\n },\n );\n\n // STORE PHASE — a render effect runs before user effects within a Solid\n // batch, exactly as React runs all layout-effect destroys before any create.\n // The cleanup registered here fires on the *next* `isVisible` change (and on\n // disposal), capturing the outgoing snapshot BEFORE any sibling's FLIP-read\n // createEffect below runs — React's two-phase commit. Only the cleanup\n // registered while VISIBLE stores (an outgoing element); an incoming\n // element's prior cleanup was registered while hidden and must not clobber\n // the outgoing snapshot. This mirrors React closing over `element =\n // ref.current`, which is null while hidden.\n createRenderEffect(\n () => local.isVisible !== false,\n (isVisible) => {\n return () => {\n if (isVisible) {\n storeSnapshot();\n }\n };\n },\n );\n\n // READ PHASE — mirrors upstream's layout-effect body, which reads the freshly\n // committed `ref.current`. Keying on the `element` signal (not just isVisible)\n // makes this run only once the incoming div is actually mounted: when isVisible\n // flips true the mount-in-render effect above mounts the div, `setRef` sets the\n // signal, and this effect runs with `el` present — never against a null ref.\n // (Solid batches, so an isVisible flip + the resulting mount coalesce into one\n // run with the mounted element.) There is therefore no \"element not yet in DOM\"\n // fresh-enter branch: with no committed div there is nothing to measure, so we\n // wait — exactly as React never runs the body before commit.\n createEffect(\n () => {\n const isVisible = local.isVisible !== false;\n const el = element();\n return { isVisible, el };\n },\n ({ isVisible, el }) => {\n const name = local.name;\n\n if (frame != null) {\n cancelAnimationFrame(frame);\n frame = undefined;\n }\n\n if (isVisible && el) {\n const prevSnapshot = scope.snapshots[name];\n\n if (prevSnapshot) {\n // FLIP: Element is transitioning from a previous instance.\n pendingFreshEnter = false;\n setLifecycle(\"visible\");\n const animations = getAnimations(el);\n\n // Set properties to animate from.\n const values = prevSnapshot.style.map(([property, prevValue]) => {\n const value = el.style.getPropertyValue(property);\n if (property === \"translate\") {\n const prevRect = prevSnapshot.rect;\n const currentRect = el.getBoundingClientRect();\n const deltaX = prevRect.left - currentRect.left;\n const deltaY = prevRect.top - currentRect.top;\n el.style.setProperty(\"translate\", `${deltaX}px ${deltaY}px`);\n } else {\n el.style.setProperty(property, prevValue);\n }\n return [property, value] as [string, string];\n });\n\n // Cancel any new animations triggered by these properties.\n for (const a of getAnimations(el)) {\n if (!animations.includes(a)) {\n a.cancel();\n }\n }\n\n // Remove overrides after one frame to animate to the current values.\n frame = requestAnimationFrame(() => {\n frame = undefined;\n for (const [property, value] of values) {\n el.style.setProperty(property, value);\n }\n });\n\n delete scope.snapshots[name];\n } else if (pendingFreshEnter) {\n // No previous instance exists, apply the entering state.\n pendingFreshEnter = false;\n setLifecycle(\"entering\");\n frame = requestAnimationFrame(() => {\n frame = undefined;\n setLifecycle(\"visible\");\n });\n }\n } else if (!isVisible) {\n // Unmount immediately. The outgoing snapshot was stored in the\n // store-phase cleanup before this user effect, so a sibling FLIP in\n // the same flush can still consume it. Deferring hide to a microtask\n // left the outgoing node mounted after flush() (React unmounts when\n // isVisible is false). Drop an unconsumed snapshot after the flush so\n // a later same-name mount does not FLIP from a stale rect.\n setLifecycle(\"hidden\");\n const snapshotName = name;\n queueMicrotask(() => {\n if (scope.snapshots[snapshotName]) {\n delete scope.snapshots[snapshotName];\n }\n });\n }\n },\n );\n\n // Cancel any pending FLIP frame on disposal. The snapshot store lives in the\n // render-effect cleanup above, which also fires on disposal.\n onCleanup(() => {\n if (frame != null) {\n cancelAnimationFrame(frame);\n }\n });\n\n const renderProps = useRenderProps(\n {\n get children() {\n return local.children;\n },\n class: local.class,\n style: local.style,\n defaultClassName: \"solidaria-SharedElement\",\n },\n () => ({\n isEntering: lifecycle() === \"entering\",\n isExiting: lifecycle() === \"exiting\",\n }),\n );\n\n const filteredDomProps = createMemo(() => filterDOMProps(domProps, { global: true }));\n\n return (\n <Show when={lifecycle() !== \"hidden\"}>\n <div\n ref={setRef}\n {...filteredDomProps()}\n class={renderProps.class()}\n style={renderProps.style()}\n data-entering={dataAttr(lifecycle() === \"entering\")}\n data-exiting={dataAttr(lifecycle() === \"exiting\")}\n >\n {renderProps.renderChildren()}\n </div>\n </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,SAAS,cAAc,IAA8B;CACnD,OAAO,OAAO,GAAG,kBAAkB,aAAa,GAAG,cAAc,IAAI,CAAC;AACxE;AAWA,MAAM,uBAAuB,cAAyC,IAAI;AAE1E,SAAgB,qCAA8C;CAC5D,OAAO,WAAW,oBAAoB,KAAK;AAC7C;;;;AASA,SAAgB,wBAAwB,OAAkD;CAKxF,OAAOA,gBAAAA,sBAAAA;EAAsBC,OAAO,EAHlC,WAAW,CAAC,EAGsB;EAA7B,IAAA,WAAA;GAAqC,OAAA,MAAM;EAA+B;;AACnF;;;;;AA0BA,SAAgB,cAAc,OAA+C;CAC3E,MAAM,UAAQ,WAAW,oBAAoB;CAC7C,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,qEAAqE;CAGvF,MAAM,CAAC,OAAO,YAAY,WAAW,OAAO;EAC1C;EACA;EACA;EACA;EACA;EACA;CACF,C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AC7B,EACF;CAEA,MAAM,mBAAmB,iBAAiB,eAAe,UAAU,EAAE,QAAQ,KAAK,CAAC,CAAC;CAEpF,OACEC,gBAAAA,MAAAA;EAAM,IAAA,OAAA;GAAM,OAAA,UAAU,MAAM;EAAQ;EAApC,IAAA,WAAA;GACE,IAAA,OAAA,eAAA,MASK;GARH,UAAA;IAAK,OAAA;GAAM,GAAXC,IAAW;GACP,OAAA,MAAA,CAAA,kBAAA;IACJ,IAAA,UAAA;KAAO,OAAA,YAAY,MAAM;IAAC;IAC1B,IAAA,QAAA;KAAO,OAAA,YAAY,MAAM;IAAC;IAC1B,IAAA,kBAAA;KAAe,OAAA,SAAS,UAAU,MAAM,UAAU;IAAC;IACnD,IAAA,iBAAA;KAAc,OAAA,SAAS,UAAU,MAAM,SAAS;IAAC;;GANnD,OAAA,MAQEC,YAAAA;IAAC,OAAA,YAAY,eAAe;GAAC,CAAA,CAC1B;GATL,mBASK;GAVP,OACEC;EAUI;;AAEV"}
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/SharedElementTransition.tsx
|
|
13
|
+
import { dataAttr, filterDOMProps, useRenderProps } from "./utils.jsx";
|
|
14
|
+
import { Show, createContext, createEffect, createMemo, createRenderEffect, createSignal, onCleanup, untrack, useContext } from "solid-js";
|
|
15
|
+
import { splitProps } from "@proyecto-viviana/solidaria/utils";
|
|
3
16
|
//#region src/SharedElementTransition.tsx
|
|
4
17
|
/**
|
|
5
18
|
* SharedElementTransition primitives for solidaria-components.
|
|
@@ -8,7 +21,7 @@ import { Show, createContext, createEffect, createMemo, createRenderEffect, crea
|
|
|
8
21
|
* parents within a scope. Captures geometry snapshots on unmount and applies
|
|
9
22
|
* transition animations on mount.
|
|
10
23
|
*
|
|
11
|
-
*
|
|
24
|
+
* Based on packages/react-aria-components/src/SharedElementTransition.tsx.
|
|
12
25
|
*/
|
|
13
26
|
/** Safe wrapper — jsdom doesn't implement the Web Animations API. */
|
|
14
27
|
function getAnimations(el) {
|
|
@@ -23,7 +36,7 @@ function useHasSharedElementTransitionScope() {
|
|
|
23
36
|
*/
|
|
24
37
|
function SharedElementTransition(props) {
|
|
25
38
|
const scope = { snapshots: {} };
|
|
26
|
-
return <SharedElementContext
|
|
39
|
+
return <SharedElementContext value={scope}>{props.children}</SharedElementContext>;
|
|
27
40
|
}
|
|
28
41
|
/**
|
|
29
42
|
* An element that animates between its old and new position when moving
|
|
@@ -40,8 +53,9 @@ function SharedElement(props) {
|
|
|
40
53
|
"style",
|
|
41
54
|
"ref"
|
|
42
55
|
]);
|
|
43
|
-
const [lifecycle, setLifecycle] = createSignal(local.isVisible === false ? "hidden" : "visible");
|
|
44
|
-
|
|
56
|
+
const [lifecycle, setLifecycle] = createSignal(untrack(() => local.isVisible === false ? "hidden" : "visible"));
|
|
57
|
+
let pendingFreshEnter = false;
|
|
58
|
+
const [element, setElement] = createSignal(void 0, { ownedWrite: true });
|
|
45
59
|
let frame;
|
|
46
60
|
const setRef = (el) => {
|
|
47
61
|
setElement(el);
|
|
@@ -62,15 +76,23 @@ function SharedElement(props) {
|
|
|
62
76
|
}
|
|
63
77
|
}
|
|
64
78
|
};
|
|
65
|
-
createRenderEffect(
|
|
66
|
-
if (isVisible && untrack(lifecycle) === "hidden")
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
79
|
+
createRenderEffect(() => local.isVisible !== false, (isVisible) => {
|
|
80
|
+
if (isVisible && untrack(lifecycle) === "hidden") {
|
|
81
|
+
pendingFreshEnter = true;
|
|
82
|
+
setLifecycle("visible");
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
createRenderEffect(() => local.isVisible !== false, (isVisible) => {
|
|
86
|
+
return () => {
|
|
70
87
|
if (isVisible) storeSnapshot();
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
createEffect(
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
createEffect(() => {
|
|
91
|
+
return {
|
|
92
|
+
isVisible: local.isVisible !== false,
|
|
93
|
+
el: element()
|
|
94
|
+
};
|
|
95
|
+
}, ({ isVisible, el }) => {
|
|
74
96
|
const name = local.name;
|
|
75
97
|
if (frame != null) {
|
|
76
98
|
cancelAnimationFrame(frame);
|
|
@@ -79,6 +101,7 @@ function SharedElement(props) {
|
|
|
79
101
|
if (isVisible && el) {
|
|
80
102
|
const prevSnapshot = scope.snapshots[name];
|
|
81
103
|
if (prevSnapshot) {
|
|
104
|
+
pendingFreshEnter = false;
|
|
82
105
|
setLifecycle("visible");
|
|
83
106
|
const animations = getAnimations(el);
|
|
84
107
|
const values = prevSnapshot.style.map(([property, prevValue]) => {
|
|
@@ -98,21 +121,22 @@ function SharedElement(props) {
|
|
|
98
121
|
for (const [property, value] of values) el.style.setProperty(property, value);
|
|
99
122
|
});
|
|
100
123
|
delete scope.snapshots[name];
|
|
101
|
-
} else {
|
|
102
|
-
|
|
124
|
+
} else if (pendingFreshEnter) {
|
|
125
|
+
pendingFreshEnter = false;
|
|
126
|
+
setLifecycle("entering");
|
|
103
127
|
frame = requestAnimationFrame(() => {
|
|
104
128
|
frame = void 0;
|
|
105
129
|
setLifecycle("visible");
|
|
106
130
|
});
|
|
107
131
|
}
|
|
108
|
-
} else if (!isVisible
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
})
|
|
132
|
+
} else if (!isVisible) {
|
|
133
|
+
setLifecycle("hidden");
|
|
134
|
+
const snapshotName = name;
|
|
135
|
+
queueMicrotask(() => {
|
|
136
|
+
if (scope.snapshots[snapshotName]) delete scope.snapshots[snapshotName];
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
});
|
|
116
140
|
onCleanup(() => {
|
|
117
141
|
if (frame != null) cancelAnimationFrame(frame);
|
|
118
142
|
});
|
|
@@ -129,7 +153,7 @@ function SharedElement(props) {
|
|
|
129
153
|
}));
|
|
130
154
|
const filteredDomProps = createMemo(() => filterDOMProps(domProps, { global: true }));
|
|
131
155
|
return <Show when={lifecycle() !== "hidden"}>
|
|
132
|
-
<div ref={setRef} {...filteredDomProps()} class={renderProps.class()} style={renderProps.style()} data-entering={lifecycle() === "entering"
|
|
156
|
+
<div ref={setRef} {...filteredDomProps()} class={renderProps.class()} style={renderProps.style()} data-entering={dataAttr(lifecycle() === "entering")} data-exiting={dataAttr(lifecycle() === "exiting")}>
|
|
133
157
|
{renderProps.renderChildren()}
|
|
134
158
|
</div>
|
|
135
159
|
</Show>;
|