origam 2.38.0 → 2.38.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/dist/src/assets/locales/en.json +1 -1
- package/dist/src/assets/locales/fr.json +2 -2
- package/dist/src/components/Alert/OrigamAlert.vue +739 -165
- package/dist/src/components/App/OrigamApp.vue +95 -19
- package/dist/src/components/App/OrigamAppBar.vue +751 -158
- package/dist/src/components/Audio/OrigamAudio.vue +1288 -346
- package/dist/src/components/Audio/OrigamAudioWaveform.vue +63 -7
- package/dist/src/components/Avatar/OrigamAvatar.vue +678 -126
- package/dist/src/components/Avatar/OrigamAvatarGroup.vue +700 -153
- package/dist/src/components/Badge/OrigamBadge.vue +548 -135
- package/dist/src/components/Blockquote/OrigamBlockquote.vue +698 -140
- package/dist/src/components/BottomNav/OrigamBottomNav.vue +864 -156
- package/dist/src/components/Bracket/OrigamBracket.vue +1013 -380
- package/dist/src/components/Bracket/OrigamBracketCompetitor.vue +674 -154
- package/dist/src/components/Bracket/OrigamBracketMatch.vue +663 -163
- package/dist/src/components/Bracket/OrigamBracketRound.vue +116 -34
- package/dist/src/components/Breadcrumb/OrigamBreadcrumb.vue +654 -119
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbDivider.vue +292 -54
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbItem.vue +657 -126
- package/dist/src/components/Btn/OrigamBtn.vue +928 -249
- package/dist/src/components/Btn/OrigamBtnGroup.vue +658 -141
- package/dist/src/components/Btn/OrigamBtnToggle.vue +578 -91
- package/dist/src/components/Calendar/OrigamCalendar.vue +1142 -484
- package/dist/src/components/Card/OrigamCard.vue +938 -194
- package/dist/src/components/Card/OrigamCardHeader.vue +593 -104
- package/dist/src/components/Card/OrigamCardText.vue +536 -84
- package/dist/src/components/Carousel/OrigamCarousel.vue +778 -202
- package/dist/src/components/Carousel/OrigamCarouselItem.vue +660 -109
- package/dist/src/components/Chart/OrigamChart.vue +942 -452
- package/dist/src/components/Chart/OrigamChartAxis.vue +111 -19
- package/dist/src/components/Chart/OrigamChartBoxPlot.vue +713 -297
- package/dist/src/components/Chart/OrigamChartBullet.vue +701 -286
- package/dist/src/components/Chart/OrigamChartCandlestick.vue +663 -243
- package/dist/src/components/Chart/OrigamChartCartesian.vue +1055 -487
- package/dist/src/components/Chart/OrigamChartGauge.vue +563 -164
- package/dist/src/components/Chart/OrigamChartHeatmap.vue +677 -251
- package/dist/src/components/Chart/OrigamChartHoneycomb.vue +700 -288
- package/dist/src/components/Chart/OrigamChartLegend.vue +108 -16
- package/dist/src/components/Chart/OrigamChartMap.vue +723 -299
- package/dist/src/components/Chart/OrigamChartPareto.vue +721 -276
- package/dist/src/components/Chart/OrigamChartPictorial.vue +777 -355
- package/dist/src/components/Chart/OrigamChartPolar.vue +603 -210
- package/dist/src/components/Chart/OrigamChartPolarBar.vue +674 -271
- package/dist/src/components/Chart/OrigamChartPyramid.vue +685 -250
- package/dist/src/components/Chart/OrigamChartRadar.vue +515 -165
- package/dist/src/components/Chart/OrigamChartRangeSelector.vue +50 -25
- package/dist/src/components/Chart/OrigamChartSankey.vue +913 -467
- package/dist/src/components/Chart/OrigamChartSparkline.vue +711 -268
- package/dist/src/components/Chart/OrigamChartStreamgraph.vue +810 -368
- package/dist/src/components/Chart/OrigamChartSunburst.vue +779 -368
- package/dist/src/components/Chart/OrigamChartTooltip.vue +78 -19
- package/dist/src/components/Chart/OrigamChartTreemap.vue +750 -288
- package/dist/src/components/Chart/OrigamChartVariwide.vue +679 -251
- package/dist/src/components/Chart/OrigamChartWordCloud.vue +674 -265
- package/dist/src/components/Checkbox/OrigamCheckbox.vue +781 -136
- package/dist/src/components/Checkbox/OrigamCheckboxBtn.vue +465 -81
- package/dist/src/components/Checkbox/OrigamCheckboxGroup.vue +824 -137
- package/dist/src/components/Chip/OrigamChip.vue +867 -202
- package/dist/src/components/Chip/OrigamChipGroup.vue +633 -121
- package/dist/src/components/ClientOnly/OrigamClientOnly.vue +30 -4
- package/dist/src/components/Clipboard/OrigamClipboard.vue +624 -105
- package/dist/src/components/Code/OrigamCode.vue +844 -206
- package/dist/src/components/CodeGroup/OrigamCodeGroup.vue +494 -83
- package/dist/src/components/ColorPicker/OrigamColorPicker.vue +777 -159
- package/dist/src/components/ColorPicker/OrigamColorPickerCanvas.vue +295 -181
- package/dist/src/components/ColorPicker/OrigamColorPickerEdit.vue +108 -45
- package/dist/src/components/ColorPicker/OrigamColorPickerPreview.vue +131 -46
- package/dist/src/components/ColorPicker/OrigamColorPickerSwatches.vue +128 -39
- package/dist/src/components/ColorPickerField/OrigamColorPickerField.vue +1123 -258
- package/dist/src/components/CommandPalette/OrigamCommandPalette.vue +415 -162
- package/dist/src/components/ConfirmWrapper/OrigamConfirmWrapper.vue +389 -145
- package/dist/src/components/ContextualMenu/OrigamContextualMenu.vue +852 -147
- package/dist/src/components/Counter/OrigamCounter.vue +588 -96
- package/dist/src/components/DataList/OrigamDataList.vue +619 -113
- package/dist/src/components/DataList/OrigamDataText.vue +295 -65
- package/dist/src/components/DataList/OrigamDataTitle.vue +295 -65
- package/dist/src/components/DataTable/OrigamDataTable.vue +934 -222
- package/dist/src/components/DataTable/OrigamDataTableColumnCell.vue +196 -51
- package/dist/src/components/DataTable/OrigamDataTableFooter.vue +319 -78
- package/dist/src/components/DataTable/OrigamDataTableGroupHeaderRow.vue +124 -44
- package/dist/src/components/DataTable/OrigamDataTableHeaderCell.vue +181 -70
- package/dist/src/components/DataTable/OrigamDataTableHeaders.vue +155 -46
- package/dist/src/components/DataTable/OrigamDataTableHeadersCell.vue +145 -27
- package/dist/src/components/DataTable/OrigamDataTableHeadersCellMobile.vue +126 -43
- package/dist/src/components/DataTable/OrigamDataTableRow.vue +151 -73
- package/dist/src/components/DataTable/OrigamDataTableRows.vue +261 -106
- package/dist/src/components/DatePicker/OrigamDatePicker.vue +1048 -261
- package/dist/src/components/DatePicker/OrigamDatePickerControls.vue +155 -51
- package/dist/src/components/DatePicker/OrigamDatePickerHeader.vue +147 -46
- package/dist/src/components/DatePicker/OrigamDatePickerMonth.vue +312 -134
- package/dist/src/components/DatePicker/OrigamDatePickerMonths.vue +151 -61
- package/dist/src/components/DatePicker/OrigamDatePickerYears.vue +154 -67
- package/dist/src/components/DatePickerField/OrigamDatePickerField.vue +1147 -306
- package/dist/src/components/DefaultsProvider/OrigamDefaultsProvider.vue +74 -14
- package/dist/src/components/Dialog/OrigamDialog.vue +953 -196
- package/dist/src/components/Dialog/OrigamDialogConfirmation.vue +886 -148
- package/dist/src/components/Divider/OrigamDivider.vue +210 -50
- package/dist/src/components/Drawer/OrigamDrawer.vue +909 -207
- package/dist/src/components/EmptyState/OrigamEmptyState.vue +146 -35
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanel.vue +746 -159
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelContent.vue +591 -95
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelHeader.vue +663 -143
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanels.vue +675 -134
- package/dist/src/components/Field/OrigamField.vue +1118 -306
- package/dist/src/components/FileField/OrigamFileField.vue +1188 -311
- package/dist/src/components/FileField/OrigamFileFieldDragNDropItem.vue +155 -36
- package/dist/src/components/FileField/OrigamFileFieldListItem.vue +155 -36
- package/dist/src/components/Form/OrigamForm.vue +197 -74
- package/dist/src/components/Grid/OrigamGrid.vue +707 -147
- package/dist/src/components/Grid/OrigamGridItem.vue +110 -37
- package/dist/src/components/Grids/OrigamCol.vue +593 -110
- package/dist/src/components/Grids/OrigamContainer.vue +461 -80
- package/dist/src/components/Grids/OrigamRow.vue +573 -112
- package/dist/src/components/Grids/OrigamSpacer.vue +54 -17
- package/dist/src/components/Icon/OrigamClassIcon.vue +573 -98
- package/dist/src/components/Icon/OrigamComponentIcon.vue +561 -101
- package/dist/src/components/Icon/OrigamIcon.vue +561 -98
- package/dist/src/components/Icon/OrigamLigatureIcon.vue +558 -98
- package/dist/src/components/Icon/OrigamSvgIcon.vue +593 -100
- package/dist/src/components/Img/OrigamImg.vue +869 -228
- package/dist/src/components/InfiniteScroll/OrigamInfiniteScroll.vue +319 -111
- package/dist/src/components/InfiniteScroll/OrigamInfiniteScrollIntersect.vue +80 -17
- package/dist/src/components/InlineEdit/OrigamInlineEdit.vue +476 -140
- package/dist/src/components/Input/OrigamInput.vue +747 -180
- package/dist/src/components/ItemGroup/OrigamItemGroup.vue +112 -36
- package/dist/src/components/ItemGroup/OrigamItemGroupItem.vue +80 -29
- package/dist/src/components/Kbd/OrigamKbd.vue +450 -75
- package/dist/src/components/Label/OrigamLabel.vue +584 -95
- package/dist/src/components/Layout/OrigamLayout.vue +563 -94
- package/dist/src/components/Lazy/OrigamLazy.vue +131 -34
- package/dist/src/components/List/OrigamList.vue +755 -170
- package/dist/src/components/List/OrigamListChildren.vue +59 -19
- package/dist/src/components/List/OrigamListGroup.vue +631 -134
- package/dist/src/components/List/OrigamListGroupActivator.vue +45 -17
- package/dist/src/components/List/OrigamListItem.vue +890 -224
- package/dist/src/components/List/OrigamListItemWrapper.vue +20 -10
- package/dist/src/components/List/OrigamListSubheader.vue +542 -93
- package/dist/src/components/Loader/OrigamLoader.vue +110 -25
- package/dist/src/components/Main/OrigamMain.vue +565 -96
- package/dist/src/components/Masonry/OrigamMasonry.vue +799 -187
- package/dist/src/components/Media/OrigamMediaController.vue +465 -182
- package/dist/src/components/Media/OrigamMediaScrubber.vue +389 -152
- package/dist/src/components/Media/OrigamMediaVolumeControl.vue +174 -44
- package/dist/src/components/Menu/OrigamMenu.vue +1079 -255
- package/dist/src/components/Messages/OrigamMessages.vue +606 -97
- package/dist/src/components/NumberField/OrigamNumberField.vue +1208 -333
- package/dist/src/components/NumberFormat/OrigamNumberFormat.vue +177 -57
- package/dist/src/components/OtpInputField/OrigamOtpInputField.vue +1016 -272
- package/dist/src/components/Overlay/OrigamOverlay.vue +446 -158
- package/dist/src/components/Overlay/OrigamOverlayScrim.vue +122 -30
- package/dist/src/components/Pagination/OrigamPagination.vue +982 -313
- package/dist/src/components/Parallax/OrigamParallax.vue +800 -259
- package/dist/src/components/Parallax/OrigamParallaxElement.vue +694 -178
- package/dist/src/components/Parallax/OrigamParallaxLayer.vue +132 -47
- package/dist/src/components/PasswordField/OrigamPasswordField.vue +1098 -265
- package/dist/src/components/Picker/OrigamPicker.vue +655 -108
- package/dist/src/components/Picker/OrigamPickerTitle.vue +108 -26
- package/dist/src/components/Progress/OrigamProgress.vue +436 -70
- package/dist/src/components/Progress/OrigamProgressCircular.vue +399 -82
- package/dist/src/components/Progress/OrigamProgressLinear.vue +468 -115
- package/dist/src/components/QrCode/OrigamQrCode.vue +642 -126
- package/dist/src/components/Radio/OrigamRadio.vue +772 -132
- package/dist/src/components/Radio/OrigamRadioBtn.vue +446 -71
- package/dist/src/components/Radio/OrigamRadioGroup.vue +808 -135
- package/dist/src/components/RatingField/OrigamRatingField.vue +963 -194
- package/dist/src/components/RatingField/OrigamRatingFieldItem.vue +657 -106
- package/dist/src/components/Responsive/OrigamResponsive.vue +548 -91
- package/dist/src/components/Select/OrigamSelect.vue +1639 -567
- package/dist/src/components/SelectionControl/OrigamSelectionControl.vue +564 -151
- package/dist/src/components/SelectionControl/OrigamSelectionControlGroup.vue +178 -62
- package/dist/src/components/Sheet/OrigamSheet.vue +773 -199
- package/dist/src/components/Skeleton/OrigamSkeleton.vue +249 -46
- package/dist/src/components/Skeleton/OrigamSkeletonGroup.vue +66 -11
- package/dist/src/components/Slide/OrigamSlideGroup.vue +772 -257
- package/dist/src/components/SliderField/OrigamSliderField.vue +1157 -335
- package/dist/src/components/SliderField/OrigamSliderFieldTrack.vue +236 -112
- package/dist/src/components/Snackbar/OrigamSnackbar.vue +871 -214
- package/dist/src/components/Snackbar/OrigamSnackbarGroup.vue +218 -51
- package/dist/src/components/Snackbar/OrigamSnackbarItem.vue +175 -43
- package/dist/src/components/Stepper/OrigamStepper.vue +618 -126
- package/dist/src/components/Stepper/OrigamStepperItem.vue +98 -37
- package/dist/src/components/Switch/OrigamSwitch.vue +879 -156
- package/dist/src/components/Switch/OrigamSwitchTrack.vue +431 -78
- package/dist/src/components/SystemBar/OrigamSystemBar.vue +517 -87
- package/dist/src/components/Table/OrigamTable.vue +585 -124
- package/dist/src/components/Tabs/OrigamTab.vue +239 -73
- package/dist/src/components/Tabs/OrigamTabPanel.vue +125 -39
- package/dist/src/components/Tabs/OrigamTabPanels.vue +148 -57
- package/dist/src/components/Tabs/OrigamTabs.vue +381 -109
- package/dist/src/components/TextField/OrigamTextField.vue +1077 -258
- package/dist/src/components/TextMask/OrigamTextMask.vue +150 -43
- package/dist/src/components/TextareaField/OrigamTextareaField.vue +1162 -310
- package/dist/src/components/TextareaField/OrigamTextareaFieldRichToolbar.vue +77 -79
- package/dist/src/components/ThemeProvider/OrigamThemeProvider.vue +44 -9
- package/dist/src/components/Timeline/OrigamTimeline.vue +113 -43
- package/dist/src/components/Timeline/OrigamTimelineItem.vue +163 -76
- package/dist/src/components/Title/OrigamTitle.vue +505 -82
- package/dist/src/components/Toolbar/OrigamToolbar.vue +679 -142
- package/dist/src/components/Tooltip/OrigamTooltip.vue +288 -72
- package/dist/src/components/Transition/OrigamExpandX.vue +219 -106
- package/dist/src/components/Transition/OrigamExpandY.vue +219 -106
- package/dist/src/components/Transition/OrigamFade.vue +47 -9
- package/dist/src/components/Transition/OrigamReverseTranslatePicker.vue +52 -10
- package/dist/src/components/Transition/OrigamScaleRotate.vue +52 -10
- package/dist/src/components/Transition/OrigamSlideX.vue +52 -10
- package/dist/src/components/Transition/OrigamSlideY.vue +52 -10
- package/dist/src/components/Transition/OrigamSnack.vue +52 -10
- package/dist/src/components/Transition/OrigamTransition.vue +40 -12
- package/dist/src/components/Transition/OrigamTranslateBottom.vue +52 -10
- package/dist/src/components/Transition/OrigamTranslatePicker.vue +52 -10
- package/dist/src/components/Transition/OrigamTranslateScale.vue +209 -97
- package/dist/src/components/Transition/OrigamWindowXReverseTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowXTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowYReverseTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowYTranslate.vue +40 -7
- package/dist/src/components/Treeview/OrigamTreeview.vue +258 -118
- package/dist/src/components/Treeview/OrigamTreeviewNode.vue +126 -88
- package/dist/src/components/Video/OrigamVideo.vue +1178 -331
- package/dist/src/components/VirtualScroll/OrigamVirtualScroll.vue +147 -55
- package/dist/src/components/VirtualScroll/OrigamVirtualScrollItem.vue +94 -19
- package/dist/src/components/Watermark/OrigamWatermark.vue +224 -124
- package/dist/src/components/Window/OrigamWindow.vue +745 -175
- package/dist/src/components/Window/OrigamWindowItem.vue +162 -69
- package/dist/src/composables/Commons/display.composable.cjs +2 -0
- package/dist/src/composables/Commons/display.composable.js +1 -1
- package/dist/src/interfaces/Pagination/pagination.interface.d.ts +1 -1
- package/package.json +8 -8
|
@@ -28,16 +28,26 @@
|
|
|
28
28
|
</template>
|
|
29
29
|
|
|
30
30
|
<script lang="ts" setup>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
/*********************************************************
|
|
32
|
+
* Rendu des enfants — `<component :is="child" />`
|
|
33
|
+
*
|
|
34
|
+
* @description
|
|
35
|
+
* Le template rend le vnode extrait DIRECTEMENT. `<component :is>`
|
|
36
|
+
* sur un VNode emprunte la branche `isVNode(type)` de `createVNode`,
|
|
37
|
+
* qui le clone et renvoie le clone — sans composant enveloppe.
|
|
38
|
+
*
|
|
39
|
+
* @description
|
|
40
|
+
* Il lisait auparavant `:is="{ render: () => child }"`. Cet objet
|
|
41
|
+
* litteral est reconstruit a CHAQUE passe de rendu, donc Vue voyait
|
|
42
|
+
* un type de composant different a chaque fois et detruisait /
|
|
43
|
+
* recreait tout le sous-arbre enfant au lieu de le patcher. Mesure
|
|
44
|
+
* dans Chromium sur un seul redimensionnement : 117 noeuds ajoutes,
|
|
45
|
+
* 117 retires, et 0 des 9 enfants de slot conservant son noeud DOM.
|
|
46
|
+
* Chaque enfant perdait donc focus, position de scroll, lecture
|
|
47
|
+
* media, etat de transition CSS et etat de composant, et rejouait
|
|
48
|
+
* ses effets `onMounted`, a chaque relayout. Voir #733.
|
|
49
|
+
********************************************************/
|
|
50
|
+
import { computed, onBeforeUnmount, onMounted, ref, StyleValue, toRef, useSlots, watch } from "vue";
|
|
41
51
|
import { useBorder } from "../../composables/Commons/border.composable";
|
|
42
52
|
import { useBothColor } from "../../composables/Commons/bothColor.composable";
|
|
43
53
|
import { useCssSupport } from "../../composables/Commons/cssSupport.composable";
|
|
@@ -51,176 +61,765 @@ import { useRounded } from "../../composables/Commons/rounded.composable";
|
|
|
51
61
|
import { useTheme } from "../../composables/Commons/theme.composable";
|
|
52
62
|
import { GRID_GAP_SIZE_VAR } from "../../consts/Grid/grid.const";
|
|
53
63
|
import { MASONRY_ALIGN } from "../../enums/Masonry/masonry.enum";
|
|
64
|
+
/*********************************************************
|
|
65
|
+
* Global
|
|
66
|
+
*
|
|
67
|
+
* @description
|
|
68
|
+
* Props + defaults for `<OrigamMasonry>`. The component decides at
|
|
69
|
+
* mount time between a CSS-only path (when `grid-template-rows: masonry`
|
|
70
|
+
* is supported AND `align === 'top'`) and a JS bucket-fill fallback
|
|
71
|
+
* driven by `useMasonry`. The runtime branch is invisible to the
|
|
72
|
+
* consumer.
|
|
73
|
+
********************************************************/
|
|
54
74
|
const props = defineProps({
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
75
|
+
columns: {
|
|
76
|
+
type: Number,
|
|
77
|
+
required: false,
|
|
78
|
+
default: 3
|
|
79
|
+
},
|
|
80
|
+
columnBreakpoints: {
|
|
81
|
+
type: Object,
|
|
82
|
+
required: false,
|
|
83
|
+
default: undefined
|
|
84
|
+
},
|
|
85
|
+
gap: {
|
|
86
|
+
type: null,
|
|
87
|
+
required: false,
|
|
88
|
+
default: "md"
|
|
89
|
+
},
|
|
90
|
+
animated: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
required: false,
|
|
93
|
+
default: true
|
|
94
|
+
},
|
|
95
|
+
align: {
|
|
96
|
+
type: null,
|
|
97
|
+
required: false,
|
|
98
|
+
default: "top"
|
|
99
|
+
},
|
|
100
|
+
id: {
|
|
101
|
+
type: String,
|
|
102
|
+
required: false
|
|
103
|
+
},
|
|
104
|
+
class: {
|
|
105
|
+
type: [
|
|
106
|
+
String,
|
|
107
|
+
Array,
|
|
108
|
+
Object
|
|
109
|
+
],
|
|
110
|
+
required: false
|
|
111
|
+
},
|
|
112
|
+
style: {
|
|
113
|
+
type: [
|
|
114
|
+
String,
|
|
115
|
+
Array,
|
|
116
|
+
Object,
|
|
117
|
+
Boolean,
|
|
118
|
+
null
|
|
119
|
+
],
|
|
120
|
+
required: false,
|
|
121
|
+
skipCheck: true
|
|
122
|
+
},
|
|
123
|
+
tag: {
|
|
124
|
+
type: String,
|
|
125
|
+
required: false,
|
|
126
|
+
default: "div"
|
|
127
|
+
},
|
|
128
|
+
height: {
|
|
129
|
+
type: [Number, String],
|
|
130
|
+
required: false
|
|
131
|
+
},
|
|
132
|
+
maxHeight: {
|
|
133
|
+
type: [Number, String],
|
|
134
|
+
required: false
|
|
135
|
+
},
|
|
136
|
+
maxWidth: {
|
|
137
|
+
type: [Number, String],
|
|
138
|
+
required: false
|
|
139
|
+
},
|
|
140
|
+
minHeight: {
|
|
141
|
+
type: [Number, String],
|
|
142
|
+
required: false
|
|
143
|
+
},
|
|
144
|
+
minWidth: {
|
|
145
|
+
type: [Number, String],
|
|
146
|
+
required: false
|
|
147
|
+
},
|
|
148
|
+
width: {
|
|
149
|
+
type: [Number, String],
|
|
150
|
+
required: false
|
|
151
|
+
},
|
|
152
|
+
margin: {
|
|
153
|
+
type: [
|
|
154
|
+
Boolean,
|
|
155
|
+
Number,
|
|
156
|
+
String
|
|
157
|
+
],
|
|
158
|
+
required: false
|
|
159
|
+
},
|
|
160
|
+
marginTop: {
|
|
161
|
+
type: [
|
|
162
|
+
Boolean,
|
|
163
|
+
Number,
|
|
164
|
+
String
|
|
165
|
+
],
|
|
166
|
+
required: false
|
|
167
|
+
},
|
|
168
|
+
marginLeft: {
|
|
169
|
+
type: [
|
|
170
|
+
Boolean,
|
|
171
|
+
Number,
|
|
172
|
+
String
|
|
173
|
+
],
|
|
174
|
+
required: false
|
|
175
|
+
},
|
|
176
|
+
marginBottom: {
|
|
177
|
+
type: [
|
|
178
|
+
Boolean,
|
|
179
|
+
Number,
|
|
180
|
+
String
|
|
181
|
+
],
|
|
182
|
+
required: false
|
|
183
|
+
},
|
|
184
|
+
marginRight: {
|
|
185
|
+
type: [
|
|
186
|
+
Boolean,
|
|
187
|
+
Number,
|
|
188
|
+
String
|
|
189
|
+
],
|
|
190
|
+
required: false
|
|
191
|
+
},
|
|
192
|
+
marginBlock: {
|
|
193
|
+
type: [
|
|
194
|
+
Boolean,
|
|
195
|
+
Number,
|
|
196
|
+
String
|
|
197
|
+
],
|
|
198
|
+
required: false
|
|
199
|
+
},
|
|
200
|
+
marginInline: {
|
|
201
|
+
type: [
|
|
202
|
+
Boolean,
|
|
203
|
+
Number,
|
|
204
|
+
String
|
|
205
|
+
],
|
|
206
|
+
required: false
|
|
207
|
+
},
|
|
208
|
+
marginInlineStart: {
|
|
209
|
+
type: [
|
|
210
|
+
Boolean,
|
|
211
|
+
Number,
|
|
212
|
+
String
|
|
213
|
+
],
|
|
214
|
+
required: false
|
|
215
|
+
},
|
|
216
|
+
marginInlineEnd: {
|
|
217
|
+
type: [
|
|
218
|
+
Boolean,
|
|
219
|
+
Number,
|
|
220
|
+
String
|
|
221
|
+
],
|
|
222
|
+
required: false
|
|
223
|
+
},
|
|
224
|
+
marginBlockStart: {
|
|
225
|
+
type: [
|
|
226
|
+
Boolean,
|
|
227
|
+
Number,
|
|
228
|
+
String
|
|
229
|
+
],
|
|
230
|
+
required: false
|
|
231
|
+
},
|
|
232
|
+
marginBlockEnd: {
|
|
233
|
+
type: [
|
|
234
|
+
Boolean,
|
|
235
|
+
Number,
|
|
236
|
+
String
|
|
237
|
+
],
|
|
238
|
+
required: false
|
|
239
|
+
},
|
|
240
|
+
padding: {
|
|
241
|
+
type: [
|
|
242
|
+
Boolean,
|
|
243
|
+
Number,
|
|
244
|
+
String
|
|
245
|
+
],
|
|
246
|
+
required: false
|
|
247
|
+
},
|
|
248
|
+
paddingTop: {
|
|
249
|
+
type: [
|
|
250
|
+
Boolean,
|
|
251
|
+
Number,
|
|
252
|
+
String
|
|
253
|
+
],
|
|
254
|
+
required: false
|
|
255
|
+
},
|
|
256
|
+
paddingLeft: {
|
|
257
|
+
type: [
|
|
258
|
+
Boolean,
|
|
259
|
+
Number,
|
|
260
|
+
String
|
|
261
|
+
],
|
|
262
|
+
required: false
|
|
263
|
+
},
|
|
264
|
+
paddingBottom: {
|
|
265
|
+
type: [
|
|
266
|
+
Boolean,
|
|
267
|
+
Number,
|
|
268
|
+
String
|
|
269
|
+
],
|
|
270
|
+
required: false
|
|
271
|
+
},
|
|
272
|
+
paddingRight: {
|
|
273
|
+
type: [
|
|
274
|
+
Boolean,
|
|
275
|
+
Number,
|
|
276
|
+
String
|
|
277
|
+
],
|
|
278
|
+
required: false
|
|
279
|
+
},
|
|
280
|
+
paddingBlock: {
|
|
281
|
+
type: [
|
|
282
|
+
Boolean,
|
|
283
|
+
Number,
|
|
284
|
+
String
|
|
285
|
+
],
|
|
286
|
+
required: false
|
|
287
|
+
},
|
|
288
|
+
paddingInline: {
|
|
289
|
+
type: [
|
|
290
|
+
Boolean,
|
|
291
|
+
Number,
|
|
292
|
+
String
|
|
293
|
+
],
|
|
294
|
+
required: false
|
|
295
|
+
},
|
|
296
|
+
paddingInlineStart: {
|
|
297
|
+
type: [
|
|
298
|
+
Boolean,
|
|
299
|
+
Number,
|
|
300
|
+
String
|
|
301
|
+
],
|
|
302
|
+
required: false
|
|
303
|
+
},
|
|
304
|
+
paddingInlineEnd: {
|
|
305
|
+
type: [
|
|
306
|
+
Boolean,
|
|
307
|
+
Number,
|
|
308
|
+
String
|
|
309
|
+
],
|
|
310
|
+
required: false
|
|
311
|
+
},
|
|
312
|
+
paddingBlockStart: {
|
|
313
|
+
type: [
|
|
314
|
+
Boolean,
|
|
315
|
+
Number,
|
|
316
|
+
String
|
|
317
|
+
],
|
|
318
|
+
required: false
|
|
319
|
+
},
|
|
320
|
+
paddingBlockEnd: {
|
|
321
|
+
type: [
|
|
322
|
+
Boolean,
|
|
323
|
+
Number,
|
|
324
|
+
String
|
|
325
|
+
],
|
|
326
|
+
required: false
|
|
327
|
+
},
|
|
328
|
+
rounded: {
|
|
329
|
+
type: [
|
|
330
|
+
Boolean,
|
|
331
|
+
Number,
|
|
332
|
+
String,
|
|
333
|
+
null
|
|
334
|
+
],
|
|
335
|
+
required: false,
|
|
336
|
+
skipCheck: true
|
|
337
|
+
},
|
|
338
|
+
roundedTopRight: {
|
|
339
|
+
type: [
|
|
340
|
+
Boolean,
|
|
341
|
+
Number,
|
|
342
|
+
String
|
|
343
|
+
],
|
|
344
|
+
required: false
|
|
345
|
+
},
|
|
346
|
+
roundedTopLeft: {
|
|
347
|
+
type: [
|
|
348
|
+
Boolean,
|
|
349
|
+
Number,
|
|
350
|
+
String
|
|
351
|
+
],
|
|
352
|
+
required: false
|
|
353
|
+
},
|
|
354
|
+
roundedBottomLeft: {
|
|
355
|
+
type: [
|
|
356
|
+
Boolean,
|
|
357
|
+
Number,
|
|
358
|
+
String
|
|
359
|
+
],
|
|
360
|
+
required: false
|
|
361
|
+
},
|
|
362
|
+
roundedBottomRight: {
|
|
363
|
+
type: [
|
|
364
|
+
Boolean,
|
|
365
|
+
Number,
|
|
366
|
+
String
|
|
367
|
+
],
|
|
368
|
+
required: false
|
|
369
|
+
},
|
|
370
|
+
roundedStartStart: {
|
|
371
|
+
type: [
|
|
372
|
+
Boolean,
|
|
373
|
+
Number,
|
|
374
|
+
String
|
|
375
|
+
],
|
|
376
|
+
required: false
|
|
377
|
+
},
|
|
378
|
+
roundedStartEnd: {
|
|
379
|
+
type: [
|
|
380
|
+
Boolean,
|
|
381
|
+
Number,
|
|
382
|
+
String
|
|
383
|
+
],
|
|
384
|
+
required: false
|
|
385
|
+
},
|
|
386
|
+
roundedEndStart: {
|
|
387
|
+
type: [
|
|
388
|
+
Boolean,
|
|
389
|
+
Number,
|
|
390
|
+
String
|
|
391
|
+
],
|
|
392
|
+
required: false
|
|
393
|
+
},
|
|
394
|
+
roundedEndEnd: {
|
|
395
|
+
type: [
|
|
396
|
+
Boolean,
|
|
397
|
+
Number,
|
|
398
|
+
String
|
|
399
|
+
],
|
|
400
|
+
required: false
|
|
401
|
+
},
|
|
402
|
+
elevation: {
|
|
403
|
+
type: [Number, String],
|
|
404
|
+
required: false
|
|
405
|
+
},
|
|
406
|
+
bgColor: {
|
|
407
|
+
type: [
|
|
408
|
+
String,
|
|
409
|
+
Object,
|
|
410
|
+
Boolean,
|
|
411
|
+
null
|
|
412
|
+
],
|
|
413
|
+
required: false,
|
|
414
|
+
skipCheck: true
|
|
415
|
+
},
|
|
416
|
+
color: {
|
|
417
|
+
type: [
|
|
418
|
+
String,
|
|
419
|
+
Object,
|
|
420
|
+
Boolean,
|
|
421
|
+
null
|
|
422
|
+
],
|
|
423
|
+
required: false,
|
|
424
|
+
skipCheck: true
|
|
425
|
+
},
|
|
426
|
+
border: {
|
|
427
|
+
type: [
|
|
428
|
+
Boolean,
|
|
429
|
+
Number,
|
|
430
|
+
String,
|
|
431
|
+
Array
|
|
432
|
+
],
|
|
433
|
+
required: false,
|
|
434
|
+
skipCheck: true
|
|
435
|
+
},
|
|
436
|
+
borderTop: {
|
|
437
|
+
type: [
|
|
438
|
+
Boolean,
|
|
439
|
+
Number,
|
|
440
|
+
String
|
|
441
|
+
],
|
|
442
|
+
required: false
|
|
443
|
+
},
|
|
444
|
+
borderLeft: {
|
|
445
|
+
type: [
|
|
446
|
+
Boolean,
|
|
447
|
+
Number,
|
|
448
|
+
String
|
|
449
|
+
],
|
|
450
|
+
required: false
|
|
451
|
+
},
|
|
452
|
+
borderBottom: {
|
|
453
|
+
type: [
|
|
454
|
+
Boolean,
|
|
455
|
+
Number,
|
|
456
|
+
String
|
|
457
|
+
],
|
|
458
|
+
required: false
|
|
459
|
+
},
|
|
460
|
+
borderRight: {
|
|
461
|
+
type: [
|
|
462
|
+
Boolean,
|
|
463
|
+
Number,
|
|
464
|
+
String
|
|
465
|
+
],
|
|
466
|
+
required: false
|
|
467
|
+
},
|
|
468
|
+
borderBlock: {
|
|
469
|
+
type: [
|
|
470
|
+
Boolean,
|
|
471
|
+
Number,
|
|
472
|
+
String
|
|
473
|
+
],
|
|
474
|
+
required: false
|
|
475
|
+
},
|
|
476
|
+
borderInline: {
|
|
477
|
+
type: [
|
|
478
|
+
Boolean,
|
|
479
|
+
Number,
|
|
480
|
+
String
|
|
481
|
+
],
|
|
482
|
+
required: false
|
|
483
|
+
},
|
|
484
|
+
borderInlineStart: {
|
|
485
|
+
type: [
|
|
486
|
+
Boolean,
|
|
487
|
+
Number,
|
|
488
|
+
String
|
|
489
|
+
],
|
|
490
|
+
required: false
|
|
491
|
+
},
|
|
492
|
+
borderInlineEnd: {
|
|
493
|
+
type: [
|
|
494
|
+
Boolean,
|
|
495
|
+
Number,
|
|
496
|
+
String
|
|
497
|
+
],
|
|
498
|
+
required: false
|
|
499
|
+
},
|
|
500
|
+
borderBlockStart: {
|
|
501
|
+
type: [
|
|
502
|
+
Boolean,
|
|
503
|
+
Number,
|
|
504
|
+
String
|
|
505
|
+
],
|
|
506
|
+
required: false
|
|
507
|
+
},
|
|
508
|
+
borderBlockEnd: {
|
|
509
|
+
type: [
|
|
510
|
+
Boolean,
|
|
511
|
+
Number,
|
|
512
|
+
String
|
|
513
|
+
],
|
|
514
|
+
required: false
|
|
515
|
+
},
|
|
516
|
+
borderColor: {
|
|
517
|
+
type: String,
|
|
518
|
+
required: false
|
|
519
|
+
},
|
|
520
|
+
borderStyle: {
|
|
521
|
+
type: String,
|
|
522
|
+
required: false
|
|
523
|
+
},
|
|
524
|
+
borderTopColor: {
|
|
525
|
+
type: [
|
|
526
|
+
String,
|
|
527
|
+
Object,
|
|
528
|
+
Boolean,
|
|
529
|
+
null
|
|
530
|
+
],
|
|
531
|
+
required: false,
|
|
532
|
+
skipCheck: true
|
|
533
|
+
},
|
|
534
|
+
borderRightColor: {
|
|
535
|
+
type: [
|
|
536
|
+
String,
|
|
537
|
+
Object,
|
|
538
|
+
Boolean,
|
|
539
|
+
null
|
|
540
|
+
],
|
|
541
|
+
required: false,
|
|
542
|
+
skipCheck: true
|
|
543
|
+
},
|
|
544
|
+
borderBottomColor: {
|
|
545
|
+
type: [
|
|
546
|
+
String,
|
|
547
|
+
Object,
|
|
548
|
+
Boolean,
|
|
549
|
+
null
|
|
550
|
+
],
|
|
551
|
+
required: false,
|
|
552
|
+
skipCheck: true
|
|
553
|
+
},
|
|
554
|
+
borderLeftColor: {
|
|
555
|
+
type: [
|
|
556
|
+
String,
|
|
557
|
+
Object,
|
|
558
|
+
Boolean,
|
|
559
|
+
null
|
|
560
|
+
],
|
|
561
|
+
required: false,
|
|
562
|
+
skipCheck: true
|
|
563
|
+
},
|
|
564
|
+
borderInlineStartColor: {
|
|
565
|
+
type: [
|
|
566
|
+
String,
|
|
567
|
+
Object,
|
|
568
|
+
Boolean,
|
|
569
|
+
null
|
|
570
|
+
],
|
|
571
|
+
required: false,
|
|
572
|
+
skipCheck: true
|
|
573
|
+
},
|
|
574
|
+
borderInlineEndColor: {
|
|
575
|
+
type: [
|
|
576
|
+
String,
|
|
577
|
+
Object,
|
|
578
|
+
Boolean,
|
|
579
|
+
null
|
|
580
|
+
],
|
|
581
|
+
required: false,
|
|
582
|
+
skipCheck: true
|
|
583
|
+
},
|
|
584
|
+
borderBlockStartColor: {
|
|
585
|
+
type: [
|
|
586
|
+
String,
|
|
587
|
+
Object,
|
|
588
|
+
Boolean,
|
|
589
|
+
null
|
|
590
|
+
],
|
|
591
|
+
required: false,
|
|
592
|
+
skipCheck: true
|
|
593
|
+
},
|
|
594
|
+
borderBlockEndColor: {
|
|
595
|
+
type: [
|
|
596
|
+
String,
|
|
597
|
+
Object,
|
|
598
|
+
Boolean,
|
|
599
|
+
null
|
|
600
|
+
],
|
|
601
|
+
required: false,
|
|
602
|
+
skipCheck: true
|
|
603
|
+
}
|
|
125
604
|
});
|
|
126
605
|
const { filterProps } = useProps(props);
|
|
127
606
|
defineEmits([]);
|
|
128
607
|
defineSlots();
|
|
129
608
|
const slots = useSlots();
|
|
130
609
|
const rootEl = ref(null);
|
|
610
|
+
/*********************************************************
|
|
611
|
+
* CSS support gate
|
|
612
|
+
*
|
|
613
|
+
* @description
|
|
614
|
+
* `grid-template-rows: masonry` is currently behind a flag in Firefox
|
|
615
|
+
* (about:config layout.css.grid-template-masonry-value.enabled) and
|
|
616
|
+
* shipping experimentally in Chrome 117+ under the
|
|
617
|
+
* `enable-experimental-web-platform-features` flag. We detect support
|
|
618
|
+
* at runtime via the central registry. When unavailable, we render
|
|
619
|
+
* the JS bucket-fill path instead. `align: 'center'` is not
|
|
620
|
+
* expressible in the CSS path either, so we force the JS path in
|
|
621
|
+
* that case.
|
|
622
|
+
********************************************************/
|
|
131
623
|
const { css } = useCssSupport();
|
|
132
|
-
const supportsCssMasonry = computed(
|
|
133
|
-
|
|
134
|
-
)
|
|
624
|
+
const supportsCssMasonry = computed(() => css.value.masonry && props.align === MASONRY_ALIGN.TOP);
|
|
625
|
+
/*********************************************************
|
|
626
|
+
* Gap serialisation (token / number / raw CSS)
|
|
627
|
+
*
|
|
628
|
+
* @description
|
|
629
|
+
* Reuses the `GRID_GAP_SIZE_VAR` map for visual parity with
|
|
630
|
+
* `<OrigamGrid>`. Numbers become px; arbitrary strings pass through.
|
|
631
|
+
* The result is consumed both by the CSS `gap` declaration AND by the
|
|
632
|
+
* JS bucket-fill (which needs a numeric pixel value).
|
|
633
|
+
********************************************************/
|
|
135
634
|
const serialiseGap = (value) => {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
635
|
+
if (value == null) return GRID_GAP_SIZE_VAR.md;
|
|
636
|
+
if (typeof value === "number") {
|
|
637
|
+
if (!Number.isFinite(value)) return GRID_GAP_SIZE_VAR.md;
|
|
638
|
+
return `${value}px`;
|
|
639
|
+
}
|
|
640
|
+
if (typeof value === "string") {
|
|
641
|
+
if (value in GRID_GAP_SIZE_VAR) return GRID_GAP_SIZE_VAR[value];
|
|
642
|
+
return value;
|
|
643
|
+
}
|
|
644
|
+
return GRID_GAP_SIZE_VAR.md;
|
|
146
645
|
};
|
|
147
646
|
const gapCss = computed(() => serialiseGap(props.gap));
|
|
647
|
+
/*********************************************************
|
|
648
|
+
* Numeric gap for the JS fallback
|
|
649
|
+
*
|
|
650
|
+
* @description
|
|
651
|
+
* The bucket-fill algo needs a concrete px value. We read the
|
|
652
|
+
* resolved computed style at mount + on every prop change. SSR-safe
|
|
653
|
+
* — defaults to 16 px if we can't reach the DOM yet.
|
|
654
|
+
********************************************************/
|
|
148
655
|
const gapPx = ref(16);
|
|
149
656
|
const resolveGapPx = () => {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
657
|
+
const el = rootEl.value;
|
|
658
|
+
if (!el) return;
|
|
659
|
+
// Read the painted value rather than the raw token so we honour
|
|
660
|
+
// theme overrides (a brand theme might pump the gap up).
|
|
661
|
+
const v = getComputedStyle(el).getPropertyValue("--origam-masonry---resolved-gap").trim();
|
|
662
|
+
const numeric = parseFloat(v);
|
|
663
|
+
if (Number.isFinite(numeric)) gapPx.value = numeric;
|
|
155
664
|
};
|
|
665
|
+
/*********************************************************
|
|
666
|
+
* useMasonry — JS bucket-fill
|
|
667
|
+
*
|
|
668
|
+
* @description
|
|
669
|
+
* Always instantiated so the composable's lifecycle hooks fire in a
|
|
670
|
+
* predictable order. When `supportsCssMasonry` is true the layout
|
|
671
|
+
* data is computed but the template ignores it (the CSS path takes
|
|
672
|
+
* over). The cost of running the algo on a non-CSS-masonry browser
|
|
673
|
+
* is one pass per resize, well within frame budget for <200 items.
|
|
674
|
+
********************************************************/
|
|
156
675
|
const { containerRef, setItem, layout, relayout } = useMasonry({
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
676
|
+
columnsRef: toRef(props, "columns"),
|
|
677
|
+
gapRef: gapPx,
|
|
678
|
+
breakpointsRef: toRef(props, "columnBreakpoints"),
|
|
679
|
+
alignRef: toRef(props, "align")
|
|
161
680
|
});
|
|
162
|
-
|
|
681
|
+
/*********************************************************
|
|
682
|
+
* scheduleFrame — rAF bound to the component's lifetime (#719)
|
|
683
|
+
*
|
|
684
|
+
* @description
|
|
685
|
+
* Two frames were armed here and nothing cancelled either: the first
|
|
686
|
+
* relayout, and the gap re-resolution on a prop/theme swap. Both end
|
|
687
|
+
* in `getComputedStyle` — `resolveGapPx` reads the painted value, and
|
|
688
|
+
* `relayout()` measures the container. A frame landing after the
|
|
689
|
+
* environment is destroyed throws `ReferenceError` and fails a whole
|
|
690
|
+
* Vitest run with zero red tests: the #706 family.
|
|
691
|
+
*
|
|
692
|
+
* @description
|
|
693
|
+
* This is the COMPONENT half of the defect whose composable half is
|
|
694
|
+
* fixed in `useMasonry`. Same mechanism, deliberately the same shape:
|
|
695
|
+
* `onBeforeUnmount` cancels the armed frame and flips `disposed`, so
|
|
696
|
+
* a later scheduling attempt is a no-op too.
|
|
697
|
+
*
|
|
698
|
+
* @description
|
|
699
|
+
* Every armed id is tracked, NOT just the latest. Collapsing them into
|
|
700
|
+
* a single handle would make a later call supersede an earlier one —
|
|
701
|
+
* a coalescing semantic this component never had, and one no failing
|
|
702
|
+
* test asks for. The fix adds cancellation at unmount and nothing else.
|
|
703
|
+
********************************************************/
|
|
704
|
+
const frames = new Set();
|
|
163
705
|
let disposed = false;
|
|
164
706
|
const scheduleFrame = (cb) => {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
707
|
+
if (disposed || typeof window === "undefined") return;
|
|
708
|
+
const id = window.requestAnimationFrame(() => {
|
|
709
|
+
frames.delete(id);
|
|
710
|
+
cb();
|
|
711
|
+
});
|
|
712
|
+
frames.add(id);
|
|
171
713
|
};
|
|
172
714
|
onBeforeUnmount(() => {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
715
|
+
disposed = true;
|
|
716
|
+
for (const id of frames) window.cancelAnimationFrame(id);
|
|
717
|
+
frames.clear();
|
|
176
718
|
});
|
|
719
|
+
/*********************************************************
|
|
720
|
+
* Container bridge
|
|
721
|
+
*
|
|
722
|
+
* @description
|
|
723
|
+
* Bridge the composable's `containerRef` to our own template ref so
|
|
724
|
+
* this component can read `rootEl` (gap resolution) AND the
|
|
725
|
+
* composable observes the same element. The first relayout is
|
|
726
|
+
* deferred one frame so `resolveGapPx` has applied.
|
|
727
|
+
********************************************************/
|
|
177
728
|
onMounted(() => {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
729
|
+
containerRef.value = rootEl.value;
|
|
730
|
+
resolveGapPx();
|
|
731
|
+
scheduleFrame(() => relayout());
|
|
181
732
|
});
|
|
733
|
+
// Re-resolve gap when the prop changes (token rename, raw value).
|
|
734
|
+
//
|
|
735
|
+
// `theme` and `mode` are watched ALONGSIDE the prop, and that is required,
|
|
736
|
+
// not defensive. `gap` is named by the theme's `components` block, so its
|
|
737
|
+
// slot on `instance.props` is an accessor installed by the theme-props
|
|
738
|
+
// resolver AFTER `setup()` has run — a watcher created here therefore holds
|
|
739
|
+
// no dependency on the theme, and a brand/mode swap that changes `gap`
|
|
740
|
+
// would never re-run it. Watching the theme refs closes that path with no
|
|
741
|
+
// extra machinery. Measured: prop alone never fires on a swap; prop+theme
|
|
742
|
+
// fires with the correct value.
|
|
182
743
|
const { theme, mode } = useTheme();
|
|
183
|
-
|
|
184
|
-
|
|
744
|
+
/*********************************************************
|
|
745
|
+
* Gap re-resolution
|
|
746
|
+
*
|
|
747
|
+
* @description
|
|
748
|
+
* The CSS var is already updated synchronously, but `getComputedStyle`
|
|
749
|
+
* reads through layout — one frame is safer.
|
|
750
|
+
********************************************************/
|
|
751
|
+
watch([
|
|
752
|
+
() => props.gap,
|
|
753
|
+
theme,
|
|
754
|
+
mode
|
|
755
|
+
], () => {
|
|
756
|
+
scheduleFrame(resolveGapPx);
|
|
185
757
|
});
|
|
758
|
+
/*********************************************************
|
|
759
|
+
* Slot extraction (JS path only)
|
|
760
|
+
*
|
|
761
|
+
* @description
|
|
762
|
+
* The bucket-fill path needs to wrap each child in a positioned
|
|
763
|
+
* container. We pull the default slot's vnodes, filter out
|
|
764
|
+
* whitespace-only text nodes (Vue inserts them between elements in
|
|
765
|
+
* the source template), and render each into a positioned wrapper.
|
|
766
|
+
********************************************************/
|
|
186
767
|
const childrenVNodes = computed(() => {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
768
|
+
const raw = slots.default?.() ?? [];
|
|
769
|
+
const out = [];
|
|
770
|
+
const visit = (nodes) => {
|
|
771
|
+
for (const node of nodes) {
|
|
772
|
+
// Fragment vnodes (e.g. produced by `v-for` inside the slot)
|
|
773
|
+
// have a `Symbol` `type` AND an `Array` `children` payload.
|
|
774
|
+
// We unwrap them recursively so the masonry layout sees the
|
|
775
|
+
// actual leaf elements rather than discarding the fragment.
|
|
776
|
+
if (typeof node.type === "symbol" && Array.isArray(node.children)) {
|
|
777
|
+
visit(node.children);
|
|
778
|
+
continue;
|
|
779
|
+
}
|
|
780
|
+
// Comment / whitespace text nodes carry no visible content —
|
|
781
|
+
// drop them so they don't claim a column slot.
|
|
782
|
+
if (typeof node.type === "symbol") continue;
|
|
783
|
+
if (typeof node.children === "string" && node.children.trim() === "") continue;
|
|
784
|
+
out.push(node);
|
|
785
|
+
}
|
|
786
|
+
};
|
|
787
|
+
visit(raw);
|
|
788
|
+
return out;
|
|
202
789
|
});
|
|
790
|
+
/*********************************************************
|
|
791
|
+
* Per-item style binding (JS path)
|
|
792
|
+
*
|
|
793
|
+
* @description
|
|
794
|
+
* Reads from `layout.value.items` by index. Until the first measure
|
|
795
|
+
* pass returns data, we hide items (visibility: hidden) so the
|
|
796
|
+
* un-positioned flow doesn't flash. Once positioned, we toggle them
|
|
797
|
+
* back on.
|
|
798
|
+
********************************************************/
|
|
203
799
|
const getItemStyle = (idx) => {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
800
|
+
const item = layout.value.items[idx];
|
|
801
|
+
if (!item) {
|
|
802
|
+
return {
|
|
803
|
+
position: "absolute",
|
|
804
|
+
visibility: "hidden",
|
|
805
|
+
left: "0px",
|
|
806
|
+
top: "0px"
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
return {
|
|
810
|
+
position: "absolute",
|
|
811
|
+
visibility: "visible",
|
|
812
|
+
left: `${item.left}px`,
|
|
813
|
+
top: `${item.top}px`,
|
|
814
|
+
width: `${item.width}px`
|
|
815
|
+
};
|
|
220
816
|
};
|
|
221
817
|
const bindItemRef = (idx, el) => {
|
|
222
|
-
|
|
818
|
+
setItem(idx, el && el.nodeType === 1 ? el : null);
|
|
223
819
|
};
|
|
820
|
+
/*********************************************************
|
|
821
|
+
* Composables
|
|
822
|
+
********************************************************/
|
|
224
823
|
const { colorClasses, colorStyles } = useBothColor(toRef(props, "bgColor"), toRef(props, "color"));
|
|
225
824
|
const { borderClasses, borderStyles } = useBorder(props);
|
|
226
825
|
const { roundedClasses, roundedStyles } = useRounded(props);
|
|
@@ -228,50 +827,63 @@ const { elevationClasses } = useElevation(props);
|
|
|
228
827
|
const { dimensionStyles } = useDimension(props);
|
|
229
828
|
const { paddingClasses, paddingStyles } = usePadding(props);
|
|
230
829
|
const { marginClasses, marginStyles } = useMargin(props);
|
|
830
|
+
/*********************************************************
|
|
831
|
+
* Container CSS (both paths)
|
|
832
|
+
*
|
|
833
|
+
* @description
|
|
834
|
+
* - CSS path: emits `--origam-masonry---template-columns` + relies on
|
|
835
|
+
* `grid-template-rows: masonry`.
|
|
836
|
+
* - JS path: emits `--origam-masonry---container-height` so the
|
|
837
|
+
* absolute-positioned children don't collapse the container.
|
|
838
|
+
*
|
|
839
|
+
* `--origam-masonry---resolved-gap` is the bridge between the CSS
|
|
840
|
+
* variable system (where tokens live) and the JS measurer.
|
|
841
|
+
********************************************************/
|
|
231
842
|
const useCssPath = computed(() => supportsCssMasonry.value);
|
|
232
843
|
const masonryStyles = computed(() => {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
props.style
|
|
250
|
-
];
|
|
844
|
+
const style = { "--origam-masonry---resolved-gap": gapCss.value };
|
|
845
|
+
if (useCssPath.value) {
|
|
846
|
+
style["--origam-masonry---template-columns"] = `repeat(${Math.max(1, Math.floor(props.columns))}, 1fr)`;
|
|
847
|
+
} else {
|
|
848
|
+
style["--origam-masonry---container-height"] = `${layout.value.containerHeight}px`;
|
|
849
|
+
}
|
|
850
|
+
return [
|
|
851
|
+
style,
|
|
852
|
+
colorStyles.value,
|
|
853
|
+
borderStyles.value,
|
|
854
|
+
roundedStyles.value,
|
|
855
|
+
dimensionStyles.value,
|
|
856
|
+
paddingStyles.value,
|
|
857
|
+
marginStyles.value,
|
|
858
|
+
props.style
|
|
859
|
+
];
|
|
251
860
|
});
|
|
252
861
|
const masonryClasses = computed(() => {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
862
|
+
return [
|
|
863
|
+
"origam-masonry",
|
|
864
|
+
{
|
|
865
|
+
"origam-masonry--css": useCssPath.value,
|
|
866
|
+
"origam-masonry--js": !useCssPath.value,
|
|
867
|
+
"origam-masonry--animated": props.animated
|
|
868
|
+
},
|
|
869
|
+
colorClasses.value,
|
|
870
|
+
borderClasses.value,
|
|
871
|
+
roundedClasses.value,
|
|
872
|
+
elevationClasses.value,
|
|
873
|
+
paddingClasses.value,
|
|
874
|
+
marginClasses.value,
|
|
875
|
+
props.class
|
|
876
|
+
];
|
|
268
877
|
});
|
|
878
|
+
/*********************************************************
|
|
879
|
+
* Expose
|
|
880
|
+
********************************************************/
|
|
269
881
|
defineExpose({
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
882
|
+
filterProps,
|
|
883
|
+
layout,
|
|
884
|
+
relayout,
|
|
885
|
+
useCssPath,
|
|
886
|
+
gapPx
|
|
275
887
|
});
|
|
276
888
|
</script>
|
|
277
889
|
|