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
|
@@ -256,480 +256,1113 @@ import { BRACKET_DEFAULT_MATCH_GAP, BRACKET_DEFAULT_MATCH_HEIGHT, BRACKET_DEFAUL
|
|
|
256
256
|
import { BRACKET_ROUND_SIDE } from "../../enums/Bracket/bracket-round.enum";
|
|
257
257
|
import { BRACKET_VARIANT } from "../../enums/Bracket/bracket.enum";
|
|
258
258
|
import { DIRECTION } from "../../enums/Commons/direction.enum";
|
|
259
|
-
import {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
resolveBracketBorderWidth,
|
|
264
|
-
resolveBracketForeground
|
|
265
|
-
} from "../../utils/Bracket/bracket-surface.util";
|
|
259
|
+
import { bracketDashArray, bracketSurfaceVars, resolveBracketBorderColor, resolveBracketBorderWidth, resolveBracketForeground } from "../../utils/Bracket/bracket-surface.util";
|
|
260
|
+
/*********************************************************
|
|
261
|
+
* Global
|
|
262
|
+
********************************************************/
|
|
266
263
|
const props = defineProps({
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
264
|
+
rounds: {
|
|
265
|
+
type: Array,
|
|
266
|
+
required: true
|
|
267
|
+
},
|
|
268
|
+
variant: {
|
|
269
|
+
type: null,
|
|
270
|
+
required: false,
|
|
271
|
+
default: BRACKET_VARIANT.SINGLE_ELIMINATION
|
|
272
|
+
},
|
|
273
|
+
direction: {
|
|
274
|
+
type: String,
|
|
275
|
+
required: false,
|
|
276
|
+
default: DIRECTION.HORIZONTAL
|
|
277
|
+
},
|
|
278
|
+
showRoundTitles: {
|
|
279
|
+
type: Boolean,
|
|
280
|
+
required: false,
|
|
281
|
+
default: true
|
|
282
|
+
},
|
|
283
|
+
showScores: {
|
|
284
|
+
type: Boolean,
|
|
285
|
+
required: false,
|
|
286
|
+
default: true
|
|
287
|
+
},
|
|
288
|
+
showSeed: {
|
|
289
|
+
type: Boolean,
|
|
290
|
+
required: false,
|
|
291
|
+
default: false
|
|
292
|
+
},
|
|
293
|
+
interactive: {
|
|
294
|
+
type: Boolean,
|
|
295
|
+
required: false,
|
|
296
|
+
default: true
|
|
297
|
+
},
|
|
298
|
+
winnersLabel: {
|
|
299
|
+
type: String,
|
|
300
|
+
required: false,
|
|
301
|
+
default: undefined
|
|
302
|
+
},
|
|
303
|
+
losersLabel: {
|
|
304
|
+
type: String,
|
|
305
|
+
required: false,
|
|
306
|
+
default: undefined
|
|
307
|
+
},
|
|
308
|
+
id: {
|
|
309
|
+
type: String,
|
|
310
|
+
required: false
|
|
311
|
+
},
|
|
312
|
+
class: {
|
|
313
|
+
type: [
|
|
314
|
+
String,
|
|
315
|
+
Array,
|
|
316
|
+
Object
|
|
317
|
+
],
|
|
318
|
+
required: false
|
|
319
|
+
},
|
|
320
|
+
style: {
|
|
321
|
+
type: [
|
|
322
|
+
String,
|
|
323
|
+
Array,
|
|
324
|
+
Object,
|
|
325
|
+
Boolean,
|
|
326
|
+
null
|
|
327
|
+
],
|
|
328
|
+
required: false,
|
|
329
|
+
skipCheck: true
|
|
330
|
+
},
|
|
331
|
+
tag: {
|
|
332
|
+
type: String,
|
|
333
|
+
required: false,
|
|
334
|
+
default: "div"
|
|
335
|
+
},
|
|
336
|
+
density: {
|
|
337
|
+
type: null,
|
|
338
|
+
required: false
|
|
339
|
+
},
|
|
340
|
+
rounded: {
|
|
341
|
+
type: [
|
|
342
|
+
Boolean,
|
|
343
|
+
Number,
|
|
344
|
+
String,
|
|
345
|
+
null
|
|
346
|
+
],
|
|
347
|
+
required: false,
|
|
348
|
+
skipCheck: true
|
|
349
|
+
},
|
|
350
|
+
roundedTopRight: {
|
|
351
|
+
type: [
|
|
352
|
+
Boolean,
|
|
353
|
+
Number,
|
|
354
|
+
String
|
|
355
|
+
],
|
|
356
|
+
required: false
|
|
357
|
+
},
|
|
358
|
+
roundedTopLeft: {
|
|
359
|
+
type: [
|
|
360
|
+
Boolean,
|
|
361
|
+
Number,
|
|
362
|
+
String
|
|
363
|
+
],
|
|
364
|
+
required: false
|
|
365
|
+
},
|
|
366
|
+
roundedBottomLeft: {
|
|
367
|
+
type: [
|
|
368
|
+
Boolean,
|
|
369
|
+
Number,
|
|
370
|
+
String
|
|
371
|
+
],
|
|
372
|
+
required: false
|
|
373
|
+
},
|
|
374
|
+
roundedBottomRight: {
|
|
375
|
+
type: [
|
|
376
|
+
Boolean,
|
|
377
|
+
Number,
|
|
378
|
+
String
|
|
379
|
+
],
|
|
380
|
+
required: false
|
|
381
|
+
},
|
|
382
|
+
color: {
|
|
383
|
+
type: [
|
|
384
|
+
String,
|
|
385
|
+
Object,
|
|
386
|
+
Boolean,
|
|
387
|
+
null
|
|
388
|
+
],
|
|
389
|
+
required: false,
|
|
390
|
+
skipCheck: true,
|
|
391
|
+
default: "primary"
|
|
392
|
+
},
|
|
393
|
+
bgColor: {
|
|
394
|
+
type: [
|
|
395
|
+
String,
|
|
396
|
+
Object,
|
|
397
|
+
Boolean,
|
|
398
|
+
null
|
|
399
|
+
],
|
|
400
|
+
required: false,
|
|
401
|
+
skipCheck: true
|
|
402
|
+
},
|
|
403
|
+
border: {
|
|
404
|
+
type: [
|
|
405
|
+
Boolean,
|
|
406
|
+
Number,
|
|
407
|
+
String,
|
|
408
|
+
Array
|
|
409
|
+
],
|
|
410
|
+
required: false,
|
|
411
|
+
skipCheck: true
|
|
412
|
+
},
|
|
413
|
+
borderTop: {
|
|
414
|
+
type: [
|
|
415
|
+
Boolean,
|
|
416
|
+
Number,
|
|
417
|
+
String
|
|
418
|
+
],
|
|
419
|
+
required: false
|
|
420
|
+
},
|
|
421
|
+
borderLeft: {
|
|
422
|
+
type: [
|
|
423
|
+
Boolean,
|
|
424
|
+
Number,
|
|
425
|
+
String
|
|
426
|
+
],
|
|
427
|
+
required: false
|
|
428
|
+
},
|
|
429
|
+
borderBottom: {
|
|
430
|
+
type: [
|
|
431
|
+
Boolean,
|
|
432
|
+
Number,
|
|
433
|
+
String
|
|
434
|
+
],
|
|
435
|
+
required: false
|
|
436
|
+
},
|
|
437
|
+
borderRight: {
|
|
438
|
+
type: [
|
|
439
|
+
Boolean,
|
|
440
|
+
Number,
|
|
441
|
+
String
|
|
442
|
+
],
|
|
443
|
+
required: false
|
|
444
|
+
},
|
|
445
|
+
borderBlock: {
|
|
446
|
+
type: [
|
|
447
|
+
Boolean,
|
|
448
|
+
Number,
|
|
449
|
+
String
|
|
450
|
+
],
|
|
451
|
+
required: false
|
|
452
|
+
},
|
|
453
|
+
borderInline: {
|
|
454
|
+
type: [
|
|
455
|
+
Boolean,
|
|
456
|
+
Number,
|
|
457
|
+
String
|
|
458
|
+
],
|
|
459
|
+
required: false
|
|
460
|
+
},
|
|
461
|
+
borderBlockStart: {
|
|
462
|
+
type: [
|
|
463
|
+
Boolean,
|
|
464
|
+
Number,
|
|
465
|
+
String
|
|
466
|
+
],
|
|
467
|
+
required: false
|
|
468
|
+
},
|
|
469
|
+
borderBlockEnd: {
|
|
470
|
+
type: [
|
|
471
|
+
Boolean,
|
|
472
|
+
Number,
|
|
473
|
+
String
|
|
474
|
+
],
|
|
475
|
+
required: false
|
|
476
|
+
},
|
|
477
|
+
borderColor: {
|
|
478
|
+
type: String,
|
|
479
|
+
required: false
|
|
480
|
+
},
|
|
481
|
+
borderStyle: {
|
|
482
|
+
type: String,
|
|
483
|
+
required: false
|
|
484
|
+
},
|
|
485
|
+
borderTopColor: {
|
|
486
|
+
type: [
|
|
487
|
+
String,
|
|
488
|
+
Object,
|
|
489
|
+
Boolean,
|
|
490
|
+
null
|
|
491
|
+
],
|
|
492
|
+
required: false,
|
|
493
|
+
skipCheck: true
|
|
494
|
+
},
|
|
495
|
+
borderRightColor: {
|
|
496
|
+
type: [
|
|
497
|
+
String,
|
|
498
|
+
Object,
|
|
499
|
+
Boolean,
|
|
500
|
+
null
|
|
501
|
+
],
|
|
502
|
+
required: false,
|
|
503
|
+
skipCheck: true
|
|
504
|
+
},
|
|
505
|
+
borderBottomColor: {
|
|
506
|
+
type: [
|
|
507
|
+
String,
|
|
508
|
+
Object,
|
|
509
|
+
Boolean,
|
|
510
|
+
null
|
|
511
|
+
],
|
|
512
|
+
required: false,
|
|
513
|
+
skipCheck: true
|
|
514
|
+
},
|
|
515
|
+
borderLeftColor: {
|
|
516
|
+
type: [
|
|
517
|
+
String,
|
|
518
|
+
Object,
|
|
519
|
+
Boolean,
|
|
520
|
+
null
|
|
521
|
+
],
|
|
522
|
+
required: false,
|
|
523
|
+
skipCheck: true
|
|
524
|
+
},
|
|
525
|
+
borderBlockStartColor: {
|
|
526
|
+
type: [
|
|
527
|
+
String,
|
|
528
|
+
Object,
|
|
529
|
+
Boolean,
|
|
530
|
+
null
|
|
531
|
+
],
|
|
532
|
+
required: false,
|
|
533
|
+
skipCheck: true
|
|
534
|
+
},
|
|
535
|
+
borderBlockEndColor: {
|
|
536
|
+
type: [
|
|
537
|
+
String,
|
|
538
|
+
Object,
|
|
539
|
+
Boolean,
|
|
540
|
+
null
|
|
541
|
+
],
|
|
542
|
+
required: false,
|
|
543
|
+
skipCheck: true
|
|
544
|
+
},
|
|
545
|
+
height: {
|
|
546
|
+
type: [Number, String],
|
|
547
|
+
required: false
|
|
548
|
+
},
|
|
549
|
+
maxHeight: {
|
|
550
|
+
type: [Number, String],
|
|
551
|
+
required: false
|
|
552
|
+
},
|
|
553
|
+
maxWidth: {
|
|
554
|
+
type: [Number, String],
|
|
555
|
+
required: false
|
|
556
|
+
},
|
|
557
|
+
minHeight: {
|
|
558
|
+
type: [Number, String],
|
|
559
|
+
required: false
|
|
560
|
+
},
|
|
561
|
+
minWidth: {
|
|
562
|
+
type: [Number, String],
|
|
563
|
+
required: false
|
|
564
|
+
},
|
|
565
|
+
width: {
|
|
566
|
+
type: [Number, String],
|
|
567
|
+
required: false
|
|
568
|
+
},
|
|
569
|
+
elevation: {
|
|
570
|
+
type: [Number, String],
|
|
571
|
+
required: false
|
|
572
|
+
},
|
|
573
|
+
margin: {
|
|
574
|
+
type: [
|
|
575
|
+
Boolean,
|
|
576
|
+
Number,
|
|
577
|
+
String
|
|
578
|
+
],
|
|
579
|
+
required: false
|
|
580
|
+
},
|
|
581
|
+
marginTop: {
|
|
582
|
+
type: [
|
|
583
|
+
Boolean,
|
|
584
|
+
Number,
|
|
585
|
+
String
|
|
586
|
+
],
|
|
587
|
+
required: false
|
|
588
|
+
},
|
|
589
|
+
marginLeft: {
|
|
590
|
+
type: [
|
|
591
|
+
Boolean,
|
|
592
|
+
Number,
|
|
593
|
+
String
|
|
594
|
+
],
|
|
595
|
+
required: false
|
|
596
|
+
},
|
|
597
|
+
marginBottom: {
|
|
598
|
+
type: [
|
|
599
|
+
Boolean,
|
|
600
|
+
Number,
|
|
601
|
+
String
|
|
602
|
+
],
|
|
603
|
+
required: false
|
|
604
|
+
},
|
|
605
|
+
marginRight: {
|
|
606
|
+
type: [
|
|
607
|
+
Boolean,
|
|
608
|
+
Number,
|
|
609
|
+
String
|
|
610
|
+
],
|
|
611
|
+
required: false
|
|
612
|
+
},
|
|
613
|
+
marginBlock: {
|
|
614
|
+
type: [
|
|
615
|
+
Boolean,
|
|
616
|
+
Number,
|
|
617
|
+
String
|
|
618
|
+
],
|
|
619
|
+
required: false
|
|
620
|
+
},
|
|
621
|
+
marginInline: {
|
|
622
|
+
type: [
|
|
623
|
+
Boolean,
|
|
624
|
+
Number,
|
|
625
|
+
String
|
|
626
|
+
],
|
|
627
|
+
required: false
|
|
628
|
+
},
|
|
629
|
+
marginInlineStart: {
|
|
630
|
+
type: [
|
|
631
|
+
Boolean,
|
|
632
|
+
Number,
|
|
633
|
+
String
|
|
634
|
+
],
|
|
635
|
+
required: false
|
|
636
|
+
},
|
|
637
|
+
marginInlineEnd: {
|
|
638
|
+
type: [
|
|
639
|
+
Boolean,
|
|
640
|
+
Number,
|
|
641
|
+
String
|
|
642
|
+
],
|
|
643
|
+
required: false
|
|
644
|
+
},
|
|
645
|
+
marginBlockStart: {
|
|
646
|
+
type: [
|
|
647
|
+
Boolean,
|
|
648
|
+
Number,
|
|
649
|
+
String
|
|
650
|
+
],
|
|
651
|
+
required: false
|
|
652
|
+
},
|
|
653
|
+
marginBlockEnd: {
|
|
654
|
+
type: [
|
|
655
|
+
Boolean,
|
|
656
|
+
Number,
|
|
657
|
+
String
|
|
658
|
+
],
|
|
659
|
+
required: false
|
|
660
|
+
},
|
|
661
|
+
padding: {
|
|
662
|
+
type: [
|
|
663
|
+
Boolean,
|
|
664
|
+
Number,
|
|
665
|
+
String
|
|
666
|
+
],
|
|
667
|
+
required: false
|
|
668
|
+
},
|
|
669
|
+
paddingTop: {
|
|
670
|
+
type: [
|
|
671
|
+
Boolean,
|
|
672
|
+
Number,
|
|
673
|
+
String
|
|
674
|
+
],
|
|
675
|
+
required: false
|
|
676
|
+
},
|
|
677
|
+
paddingLeft: {
|
|
678
|
+
type: [
|
|
679
|
+
Boolean,
|
|
680
|
+
Number,
|
|
681
|
+
String
|
|
682
|
+
],
|
|
683
|
+
required: false
|
|
684
|
+
},
|
|
685
|
+
paddingBottom: {
|
|
686
|
+
type: [
|
|
687
|
+
Boolean,
|
|
688
|
+
Number,
|
|
689
|
+
String
|
|
690
|
+
],
|
|
691
|
+
required: false
|
|
692
|
+
},
|
|
693
|
+
paddingRight: {
|
|
694
|
+
type: [
|
|
695
|
+
Boolean,
|
|
696
|
+
Number,
|
|
697
|
+
String
|
|
698
|
+
],
|
|
699
|
+
required: false
|
|
700
|
+
},
|
|
701
|
+
paddingBlock: {
|
|
702
|
+
type: [
|
|
703
|
+
Boolean,
|
|
704
|
+
Number,
|
|
705
|
+
String
|
|
706
|
+
],
|
|
707
|
+
required: false
|
|
708
|
+
},
|
|
709
|
+
paddingInline: {
|
|
710
|
+
type: [
|
|
711
|
+
Boolean,
|
|
712
|
+
Number,
|
|
713
|
+
String
|
|
714
|
+
],
|
|
715
|
+
required: false
|
|
716
|
+
},
|
|
717
|
+
paddingInlineStart: {
|
|
718
|
+
type: [
|
|
719
|
+
Boolean,
|
|
720
|
+
Number,
|
|
721
|
+
String
|
|
722
|
+
],
|
|
723
|
+
required: false
|
|
724
|
+
},
|
|
725
|
+
paddingInlineEnd: {
|
|
726
|
+
type: [
|
|
727
|
+
Boolean,
|
|
728
|
+
Number,
|
|
729
|
+
String
|
|
730
|
+
],
|
|
731
|
+
required: false
|
|
732
|
+
},
|
|
733
|
+
paddingBlockStart: {
|
|
734
|
+
type: [
|
|
735
|
+
Boolean,
|
|
736
|
+
Number,
|
|
737
|
+
String
|
|
738
|
+
],
|
|
739
|
+
required: false
|
|
740
|
+
},
|
|
741
|
+
paddingBlockEnd: {
|
|
742
|
+
type: [
|
|
743
|
+
Boolean,
|
|
744
|
+
Number,
|
|
745
|
+
String
|
|
746
|
+
],
|
|
747
|
+
required: false
|
|
748
|
+
},
|
|
749
|
+
fontSize: {
|
|
750
|
+
type: null,
|
|
751
|
+
required: false
|
|
752
|
+
},
|
|
753
|
+
fontWeight: {
|
|
754
|
+
type: null,
|
|
755
|
+
required: false
|
|
756
|
+
},
|
|
757
|
+
letterSpacing: {
|
|
758
|
+
type: null,
|
|
759
|
+
required: false
|
|
760
|
+
}
|
|
337
761
|
});
|
|
338
|
-
const emit = defineEmits([
|
|
762
|
+
const emit = defineEmits([
|
|
763
|
+
"match-click",
|
|
764
|
+
"winner-click",
|
|
765
|
+
"competitor-click"
|
|
766
|
+
]);
|
|
339
767
|
defineSlots();
|
|
340
768
|
const { filterProps } = useProps(props);
|
|
341
769
|
const resolvedId = computed(() => props.id ?? "origam-bracket");
|
|
770
|
+
/*********************************************************
|
|
771
|
+
* Libelles — critere C8
|
|
772
|
+
*
|
|
773
|
+
* @description
|
|
774
|
+
* `ariaLabel` etait une chaine anglaise en dur, et `winnersLabel` /
|
|
775
|
+
* `losersLabel` portaient leur traduction anglaise comme VALEUR PAR
|
|
776
|
+
* DEFAUT de prop — un cas que les conventions du depot couvrent
|
|
777
|
+
* explicitement. Toute la famille Bracket etait intraduisible : aucun
|
|
778
|
+
* de ses quatre composants n'appelait `useLocale`.
|
|
779
|
+
* @description
|
|
780
|
+
* Le defaut passe a `undefined` et la traduction est resolue dans un
|
|
781
|
+
* `computed` : c'est NON CASSANT — un consommateur qui passait deja sa
|
|
782
|
+
* propre chaine continue de gagner, exactement comme avant. Faire
|
|
783
|
+
* porter une CLE i18n a la prop aurait, lui, casse ces consommateurs.
|
|
784
|
+
* @description
|
|
785
|
+
* La resolution est differee dans un `computed` et non figee au corps
|
|
786
|
+
* de `setup()` : le resolveur de theme (ADR-005) ecrit dans
|
|
787
|
+
* `beforeCreate`, donc APRES `setup()`. Une lecture eager de
|
|
788
|
+
* `props.winnersLabel` ne verrait jamais la valeur d'un theme.
|
|
789
|
+
********************************************************/
|
|
342
790
|
const { t } = useLocale();
|
|
343
791
|
const ariaLabel = computed(() => t("origam.bracket.aria_label"));
|
|
344
792
|
const resolvedWinnersLabel = computed(() => props.winnersLabel ?? t("origam.bracket.winners_label"));
|
|
345
793
|
const resolvedLosersLabel = computed(() => props.losersLabel ?? t("origam.bracket.losers_label"));
|
|
794
|
+
/*********************************************************
|
|
795
|
+
* roundColor (#428)
|
|
796
|
+
*
|
|
797
|
+
* @description
|
|
798
|
+
* `withDefaults` gives `props.color` a hard default (`'primary'`), so
|
|
799
|
+
* reading it directly here ALWAYS produced a concrete value — never
|
|
800
|
+
* `undefined` — even when THIS component's own consumer never set
|
|
801
|
+
* `color` at all. Forwarded unconditionally onto every
|
|
802
|
+
* `<origam-bracket-round>` below, that concrete value permanently
|
|
803
|
+
* outranked any `theme.components['origam-bracket-round'].color`
|
|
804
|
+
* (the resolver's own precedence: an explicit passed value always
|
|
805
|
+
* wins — see ADR-005 / #411). Measured: mounting a Round standalone
|
|
806
|
+
* under a theme naming `origam-bracket-round: { color: 'danger' }`
|
|
807
|
+
* resolved `'danger'`; the SAME Round nested inside `<origam-bracket>`
|
|
808
|
+
* resolved `'primary'` instead — forced by this binding.
|
|
809
|
+
* `usePassedProps` distinguishes "the consumer of THIS Bracket wrote
|
|
810
|
+
* `color=…`" from "Bracket's own default resolved it" — only the
|
|
811
|
+
* former forwards down, letting Round's own theme/default apply
|
|
812
|
+
* otherwise. Same guard already used by `OrigamBottomNav` /
|
|
813
|
+
* `OrigamRadioGroup` / `OrigamChipGroup` / `OrigamBtnGroup` for the
|
|
814
|
+
* identical class of problem.
|
|
815
|
+
* @description
|
|
816
|
+
* `IBracketRoundProps.color` expects `TIntent | undefined` but
|
|
817
|
+
* `IBracketProps` inherits `color` from `IColorProps` (`TColor`).
|
|
818
|
+
* Cast to the narrower type expected by child round components —
|
|
819
|
+
* type-only, no runtime change.
|
|
820
|
+
********************************************************/
|
|
346
821
|
const wasPropPassed = usePassedProps(props);
|
|
347
822
|
const roundColor = computed(() => {
|
|
348
|
-
|
|
823
|
+
return wasPropPassed("color") ? props.color : undefined;
|
|
349
824
|
});
|
|
825
|
+
/*********************************************************
|
|
826
|
+
* Display rounds
|
|
827
|
+
*
|
|
828
|
+
* @description
|
|
829
|
+
* Single-elimination and round-robin pass straight through.
|
|
830
|
+
* Double-elimination sorts rounds into Winner Bracket, then
|
|
831
|
+
* Loser Bracket, then Grand Final — preserving the input
|
|
832
|
+
* order within each group.
|
|
833
|
+
********************************************************/
|
|
350
834
|
const displayRounds = computed(() => {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
835
|
+
if (props.variant !== BRACKET_VARIANT.DOUBLE_ELIMINATION) return props.rounds;
|
|
836
|
+
const winners = props.rounds.filter((r) => r.side === BRACKET_ROUND_SIDE.WINNER || r.side === undefined);
|
|
837
|
+
const losers = props.rounds.filter((r) => r.side === BRACKET_ROUND_SIDE.LOSER);
|
|
838
|
+
const grandFinals = props.rounds.filter((r) => r.side === BRACKET_ROUND_SIDE.GRAND_FINAL);
|
|
839
|
+
return [
|
|
840
|
+
...winners,
|
|
841
|
+
...losers,
|
|
842
|
+
...grandFinals
|
|
843
|
+
];
|
|
356
844
|
});
|
|
357
|
-
|
|
845
|
+
/*********************************************************
|
|
846
|
+
* Double-elimination sections
|
|
847
|
+
*
|
|
848
|
+
* @description
|
|
849
|
+
* A real double-elimination is two independent trees — the
|
|
850
|
+
* Winner Bracket and the Loser Bracket — that converge on a
|
|
851
|
+
* single Grand Final. The Winner Bracket champion carries a
|
|
852
|
+
* one-round head start into that match (set via the match's
|
|
853
|
+
* `advantage`, rendered as a `+N` badge on its competitor row).
|
|
854
|
+
* Each section is rendered as its own tree; empty sections are
|
|
855
|
+
* dropped.
|
|
856
|
+
********************************************************/
|
|
857
|
+
const winnerRounds = computed(() => props.rounds.filter((r) => r.side === BRACKET_ROUND_SIDE.WINNER || r.side === undefined));
|
|
358
858
|
const loserRounds = computed(() => props.rounds.filter((r) => r.side === BRACKET_ROUND_SIDE.LOSER));
|
|
359
859
|
const grandFinalRounds = computed(() => props.rounds.filter((r) => r.side === BRACKET_ROUND_SIDE.GRAND_FINAL));
|
|
360
860
|
const doubleSections = computed(() => {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
861
|
+
const all = [
|
|
862
|
+
{
|
|
863
|
+
key: "winners",
|
|
864
|
+
label: resolvedWinnersLabel.value,
|
|
865
|
+
rounds: winnerRounds.value
|
|
866
|
+
},
|
|
867
|
+
{
|
|
868
|
+
key: "losers",
|
|
869
|
+
label: resolvedLosersLabel.value,
|
|
870
|
+
rounds: loserRounds.value
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
key: "grand-final",
|
|
874
|
+
label: "",
|
|
875
|
+
rounds: grandFinalRounds.value
|
|
876
|
+
}
|
|
877
|
+
];
|
|
878
|
+
return all.filter((section) => section.rounds.length > 0);
|
|
367
879
|
});
|
|
880
|
+
/*********************************************************
|
|
881
|
+
* Round-robin computed
|
|
882
|
+
*
|
|
883
|
+
* @description
|
|
884
|
+
* For round-robin we ignore the round axis and collapse
|
|
885
|
+
* every match into a competitor x competitor lookup.
|
|
886
|
+
********************************************************/
|
|
368
887
|
const roundRobinCompetitors = computed(() => {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
888
|
+
const seen = new Map();
|
|
889
|
+
for (const round of props.rounds) {
|
|
890
|
+
for (const match of round.matches) {
|
|
891
|
+
if (match.competitorA && !seen.has(match.competitorA.id)) {
|
|
892
|
+
seen.set(match.competitorA.id, match.competitorA);
|
|
893
|
+
}
|
|
894
|
+
if (match.competitorB && !seen.has(match.competitorB.id)) {
|
|
895
|
+
seen.set(match.competitorB.id, match.competitorB);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
return Array.from(seen.values());
|
|
381
900
|
});
|
|
382
901
|
const roundRobinMap = computed(() => {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
902
|
+
const out = new Map();
|
|
903
|
+
for (const round of props.rounds) {
|
|
904
|
+
for (const match of round.matches) {
|
|
905
|
+
if (!match.competitorA || !match.competitorB) continue;
|
|
906
|
+
const aId = match.competitorA.id;
|
|
907
|
+
const bId = match.competitorB.id;
|
|
908
|
+
out.set(`${aId}|${bId}`, match);
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
return out;
|
|
393
912
|
});
|
|
394
913
|
const findRoundRobinMatch = (rowId, colId) => {
|
|
395
|
-
|
|
914
|
+
return roundRobinMap.value.get(`${rowId}|${colId}`) ?? roundRobinMap.value.get(`${colId}|${rowId}`);
|
|
396
915
|
};
|
|
397
916
|
const roundRobinScore = (row, col) => {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
917
|
+
const match = findRoundRobinMatch(row.id, col.id);
|
|
918
|
+
if (!match) return "";
|
|
919
|
+
const isOrderedNormal = match.competitorA?.id === row.id;
|
|
920
|
+
const rowScore = isOrderedNormal ? match.scoreA : match.scoreB;
|
|
921
|
+
const colScore = isOrderedNormal ? match.scoreB : match.scoreA;
|
|
922
|
+
if (rowScore == null && colScore == null) return "";
|
|
923
|
+
return `${rowScore ?? "—"} – ${colScore ?? "—"}`;
|
|
405
924
|
};
|
|
406
925
|
const roundRobinCellClasses = (row, col) => {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
"origam-bracket__rr-cell--clickable": !isDiag && match && props.interactive
|
|
416
|
-
}
|
|
417
|
-
];
|
|
926
|
+
const isDiag = row.id === col.id;
|
|
927
|
+
const match = findRoundRobinMatch(row.id, col.id);
|
|
928
|
+
const isWinner = match?.winnerId === row.id;
|
|
929
|
+
return ["origam-bracket__rr-cell", {
|
|
930
|
+
"origam-bracket__rr-cell--diag": isDiag,
|
|
931
|
+
"origam-bracket__rr-cell--winner": isWinner,
|
|
932
|
+
"origam-bracket__rr-cell--clickable": !isDiag && match && props.interactive
|
|
933
|
+
}];
|
|
418
934
|
};
|
|
935
|
+
/*********************************************************
|
|
936
|
+
* describeRoundRobinCell — critere C8
|
|
937
|
+
*
|
|
938
|
+
* @description
|
|
939
|
+
* Trois libelles d'aria-label ecrits en dur en anglais, non couverts
|
|
940
|
+
* par le correctif #388 (portait uniquement sur l'aria-label racine,
|
|
941
|
+
* `winnersLabel` / `losersLabel`, `OrigamBracketMatch` et
|
|
942
|
+
* `OrigamBracketCompetitor`). Trouve en reparant, absent du classeur.
|
|
943
|
+
* @description
|
|
944
|
+
* Le suffixe de score reutilise `origam.bracket.score_aria_suffix`,
|
|
945
|
+
* deja declare pour le meme usage sur `OrigamBracketCompetitor` — pas
|
|
946
|
+
* de cle dupliquee pour un concept identique.
|
|
947
|
+
********************************************************/
|
|
419
948
|
const describeRoundRobinCell = (row, col) => {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
949
|
+
if (row.id === col.id) return t("origam.bracket.round_robin.cell_self", row.name);
|
|
950
|
+
const match = findRoundRobinMatch(row.id, col.id);
|
|
951
|
+
if (!match) return t("origam.bracket.round_robin.cell_no_match", row.name, col.name);
|
|
952
|
+
const score = roundRobinScore(row, col);
|
|
953
|
+
const base = t("origam.bracket.round_robin.cell_match", row.name, col.name);
|
|
954
|
+
return score ? `${base}${t("origam.bracket.score_aria_suffix", score)}` : base;
|
|
426
955
|
};
|
|
427
956
|
const onRoundRobinCellClick = (row, col, event) => {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
957
|
+
if (row.id === col.id) return;
|
|
958
|
+
const match = findRoundRobinMatch(row.id, col.id);
|
|
959
|
+
if (!match) return;
|
|
960
|
+
const round = props.rounds.find((r) => r.matches.some((m) => m.id === match.id));
|
|
961
|
+
if (!round) return;
|
|
962
|
+
emit("match-click", match, round, event);
|
|
434
963
|
};
|
|
964
|
+
/*********************************************************
|
|
965
|
+
* Connector layout
|
|
966
|
+
*
|
|
967
|
+
* @description
|
|
968
|
+
* Pure-function path computation. Each round occupies one
|
|
969
|
+
* column of width `matchWidth`. Matches inside a round are
|
|
970
|
+
* evenly spaced — the spacing doubles at each round so the
|
|
971
|
+
* tree branches classically.
|
|
972
|
+
*
|
|
973
|
+
* Connector path = horizontal exit (16px) + vertical
|
|
974
|
+
* traversal to the centre of the target match + horizontal
|
|
975
|
+
* entry (16px).
|
|
976
|
+
********************************************************/
|
|
435
977
|
const matchWidth = BRACKET_DEFAULT_MATCH_WIDTH;
|
|
436
978
|
const matchHeight = BRACKET_DEFAULT_MATCH_HEIGHT;
|
|
437
979
|
const baseGap = BRACKET_DEFAULT_MATCH_GAP;
|
|
438
980
|
const roundGap = BRACKET_DEFAULT_ROUND_GAP;
|
|
439
981
|
const isHorizontal = computed(() => props.direction === DIRECTION.HORIZONTAL);
|
|
982
|
+
/*********************************************************
|
|
983
|
+
* Round thickness — direction-aware
|
|
984
|
+
*
|
|
985
|
+
* @description
|
|
986
|
+
* In horizontal mode each round is a column of width `matchWidth`
|
|
987
|
+
* (~240 px). In vertical mode each round is a row whose thickness
|
|
988
|
+
* controls how compact the bracket is vertically AND where the SVG
|
|
989
|
+
* connectors anchor. Using `matchWidth` (240) leaves a lot of empty
|
|
990
|
+
* space below every match card; using a tighter value keeps the
|
|
991
|
+
* connectors aligned with the cards while shrinking the layout.
|
|
992
|
+
********************************************************/
|
|
440
993
|
const verticalRoundThickness = 120;
|
|
441
994
|
const showConnectors = computed(() => {
|
|
442
|
-
|
|
443
|
-
|
|
995
|
+
if (props.variant === BRACKET_VARIANT.ROUND_ROBIN) return false;
|
|
996
|
+
return displayRounds.value.length > 1;
|
|
444
997
|
});
|
|
445
998
|
const maxMatchesInRound = computed(() => {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
999
|
+
let max = 1;
|
|
1000
|
+
for (const r of displayRounds.value) {
|
|
1001
|
+
if (r.matches.length > max) max = r.matches.length;
|
|
1002
|
+
}
|
|
1003
|
+
return max;
|
|
451
1004
|
});
|
|
452
1005
|
const totalHeight = computed(() => {
|
|
453
|
-
|
|
1006
|
+
return maxMatchesInRound.value * (matchHeight + baseGap);
|
|
454
1007
|
});
|
|
455
1008
|
const treeRef = ref(null);
|
|
456
1009
|
const doubleRef = ref(null);
|
|
457
1010
|
const connectorViewBox = ref("0 0 0 0");
|
|
1011
|
+
/*********************************************************
|
|
1012
|
+
* Connector measurement (real DOM positions)
|
|
1013
|
+
*
|
|
1014
|
+
* @description
|
|
1015
|
+
* Connectors are drawn from the *measured* centre of each
|
|
1016
|
+
* match card rather than a computed grid. The flex layout
|
|
1017
|
+
* (space-around + gap) and the per-round title offset move
|
|
1018
|
+
* cards away from any formula-predicted position, so a
|
|
1019
|
+
* formula produced visibly off-centre, unbalanced links.
|
|
1020
|
+
* Measuring the live rects keeps every link anchored to the
|
|
1021
|
+
* exact middle of the card it leaves / enters, whatever the
|
|
1022
|
+
* title, density, scores or gap.
|
|
1023
|
+
********************************************************/
|
|
458
1024
|
const connectorPaths = ref([]);
|
|
1025
|
+
/*********************************************************
|
|
1026
|
+
* Double-elimination connectors (id-driven)
|
|
1027
|
+
*
|
|
1028
|
+
* @description
|
|
1029
|
+
* The two trees + grand final converge in arbitrary positions,
|
|
1030
|
+
* so connectors are driven purely by `nextMatchId`: every match
|
|
1031
|
+
* that declares a downstream id draws a link to it, wherever that
|
|
1032
|
+
* card lands. Measured against the whole double-elim container so
|
|
1033
|
+
* WB-final → GF and LB-final → GF both resolve across the trees.
|
|
1034
|
+
********************************************************/
|
|
459
1035
|
const measureDoubleConnectors = () => {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
1036
|
+
const rootEl = doubleRef.value;
|
|
1037
|
+
if (!rootEl || !showConnectors.value) {
|
|
1038
|
+
connectorPaths.value = [];
|
|
1039
|
+
return;
|
|
1040
|
+
}
|
|
1041
|
+
const rootRect = rootEl.getBoundingClientRect();
|
|
1042
|
+
connectorViewBox.value = `0 0 ${rootRect.width} ${rootRect.height}`;
|
|
1043
|
+
const rectById = new Map();
|
|
1044
|
+
rootEl.querySelectorAll("[data-match-id]").forEach((card) => {
|
|
1045
|
+
rectById.set(String(card.dataset.matchId), card.getBoundingClientRect());
|
|
1046
|
+
});
|
|
1047
|
+
const paths = [];
|
|
1048
|
+
for (const round of props.rounds) {
|
|
1049
|
+
for (const match of round.matches) {
|
|
1050
|
+
if (match.nextMatchId == null) continue;
|
|
1051
|
+
const fromRect = rectById.get(String(match.id));
|
|
1052
|
+
const toRect = rectById.get(String(match.nextMatchId));
|
|
1053
|
+
if (!fromRect || !toRect) continue;
|
|
1054
|
+
const fromCenterY = fromRect.top - rootRect.top + fromRect.height / 2;
|
|
1055
|
+
const toCenterY = toRect.top - rootRect.top + toRect.height / 2;
|
|
1056
|
+
const startX = fromRect.right - rootRect.left;
|
|
1057
|
+
const endX = toRect.left - rootRect.left;
|
|
1058
|
+
const midX = (startX + endX) / 2;
|
|
1059
|
+
paths.push({
|
|
1060
|
+
key: `${match.id}-${match.nextMatchId}`,
|
|
1061
|
+
d: `M ${startX},${fromCenterY} L ${midX},${fromCenterY} L ${midX},${toCenterY} L ${endX},${toCenterY}`,
|
|
1062
|
+
from: {
|
|
1063
|
+
matchId: match.id,
|
|
1064
|
+
x: startX,
|
|
1065
|
+
y: fromCenterY
|
|
1066
|
+
},
|
|
1067
|
+
to: {
|
|
1068
|
+
matchId: match.nextMatchId,
|
|
1069
|
+
x: endX,
|
|
1070
|
+
y: toCenterY
|
|
1071
|
+
},
|
|
1072
|
+
winner: match.winnerId != null
|
|
1073
|
+
});
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
connectorPaths.value = paths;
|
|
493
1077
|
};
|
|
494
1078
|
const measureSingleConnectors = () => {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
1079
|
+
const treeEl = treeRef.value;
|
|
1080
|
+
if (!treeEl || !showConnectors.value) {
|
|
1081
|
+
connectorPaths.value = [];
|
|
1082
|
+
return;
|
|
1083
|
+
}
|
|
1084
|
+
const treeRect = treeEl.getBoundingClientRect();
|
|
1085
|
+
connectorViewBox.value = `0 0 ${treeRect.width} ${treeRect.height}`;
|
|
1086
|
+
const roundEls = Array.from(treeEl.querySelectorAll(".origam-bracket__round"));
|
|
1087
|
+
const cardsPerRound = roundEls.map((roundEl) => {
|
|
1088
|
+
const matchesEl = roundEl.querySelector(".origam-bracket-round__matches");
|
|
1089
|
+
return matchesEl ? Array.from(matchesEl.children).map((card) => card.getBoundingClientRect()) : [];
|
|
1090
|
+
});
|
|
1091
|
+
const horiz = isHorizontal.value;
|
|
1092
|
+
const paths = [];
|
|
1093
|
+
for (let r = 0; r < displayRounds.value.length - 1; r += 1) {
|
|
1094
|
+
const round = displayRounds.value[r];
|
|
1095
|
+
const nextRound = displayRounds.value[r + 1];
|
|
1096
|
+
const fromCards = cardsPerRound[r] ?? [];
|
|
1097
|
+
const toCards = cardsPerRound[r + 1] ?? [];
|
|
1098
|
+
for (let i = 0; i < round.matches.length; i += 1) {
|
|
1099
|
+
const match = round.matches[i];
|
|
1100
|
+
let nextIndex = -1;
|
|
1101
|
+
if (match.nextMatchId != null) {
|
|
1102
|
+
nextIndex = nextRound.matches.findIndex((m) => m.id === match.nextMatchId);
|
|
1103
|
+
}
|
|
1104
|
+
if (nextIndex === -1) nextIndex = Math.floor(i / 2);
|
|
1105
|
+
const nextMatch = nextRound.matches[nextIndex];
|
|
1106
|
+
const fromRect = fromCards[i];
|
|
1107
|
+
const toRect = toCards[nextIndex];
|
|
1108
|
+
if (!nextMatch || !fromRect || !toRect) continue;
|
|
1109
|
+
const fromCenterX = fromRect.left - treeRect.left + fromRect.width / 2;
|
|
1110
|
+
const fromCenterY = fromRect.top - treeRect.top + fromRect.height / 2;
|
|
1111
|
+
const toCenterX = toRect.left - treeRect.left + toRect.width / 2;
|
|
1112
|
+
const toCenterY = toRect.top - treeRect.top + toRect.height / 2;
|
|
1113
|
+
let d;
|
|
1114
|
+
let from;
|
|
1115
|
+
let to;
|
|
1116
|
+
if (horiz) {
|
|
1117
|
+
const startX = fromRect.right - treeRect.left;
|
|
1118
|
+
const endX = toRect.left - treeRect.left;
|
|
1119
|
+
const midX = (startX + endX) / 2;
|
|
1120
|
+
d = `M ${startX},${fromCenterY} L ${midX},${fromCenterY} L ${midX},${toCenterY} L ${endX},${toCenterY}`;
|
|
1121
|
+
from = {
|
|
1122
|
+
matchId: match.id,
|
|
1123
|
+
x: startX,
|
|
1124
|
+
y: fromCenterY
|
|
1125
|
+
};
|
|
1126
|
+
to = {
|
|
1127
|
+
matchId: nextMatch.id,
|
|
1128
|
+
x: endX,
|
|
1129
|
+
y: toCenterY
|
|
1130
|
+
};
|
|
1131
|
+
} else {
|
|
1132
|
+
const startY = fromRect.bottom - treeRect.top;
|
|
1133
|
+
const endY = toRect.top - treeRect.top;
|
|
1134
|
+
const midY = (startY + endY) / 2;
|
|
1135
|
+
d = `M ${fromCenterX},${startY} L ${fromCenterX},${midY} L ${toCenterX},${midY} L ${toCenterX},${endY}`;
|
|
1136
|
+
from = {
|
|
1137
|
+
matchId: match.id,
|
|
1138
|
+
x: fromCenterX,
|
|
1139
|
+
y: startY
|
|
1140
|
+
};
|
|
1141
|
+
to = {
|
|
1142
|
+
matchId: nextMatch.id,
|
|
1143
|
+
x: toCenterX,
|
|
1144
|
+
y: endY
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1147
|
+
paths.push({
|
|
1148
|
+
key: `${match.id}-${nextMatch.id}`,
|
|
1149
|
+
d,
|
|
1150
|
+
from,
|
|
1151
|
+
to,
|
|
1152
|
+
winner: match.winnerId != null
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
connectorPaths.value = paths;
|
|
557
1157
|
};
|
|
558
1158
|
const measureConnectors = () => {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
1159
|
+
if (props.variant === BRACKET_VARIANT.DOUBLE_ELIMINATION) {
|
|
1160
|
+
measureDoubleConnectors();
|
|
1161
|
+
return;
|
|
1162
|
+
}
|
|
1163
|
+
if (props.variant === BRACKET_VARIANT.ROUND_ROBIN) {
|
|
1164
|
+
connectorPaths.value = [];
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1167
|
+
measureSingleConnectors();
|
|
568
1168
|
};
|
|
569
1169
|
const connectorContainer = () => {
|
|
570
|
-
|
|
1170
|
+
return props.variant === BRACKET_VARIANT.DOUBLE_ELIMINATION ? doubleRef.value : treeRef.value;
|
|
571
1171
|
};
|
|
572
1172
|
let connectorResizeObserver = null;
|
|
573
1173
|
const attachConnectorObserver = () => {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
1174
|
+
connectorResizeObserver?.disconnect();
|
|
1175
|
+
const el = connectorContainer();
|
|
1176
|
+
if (typeof ResizeObserver !== "undefined" && el) {
|
|
1177
|
+
connectorResizeObserver = new ResizeObserver(() => measureConnectors());
|
|
1178
|
+
connectorResizeObserver.observe(el);
|
|
1179
|
+
}
|
|
580
1180
|
};
|
|
581
1181
|
onMounted(() => {
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
1182
|
+
nextTick(() => {
|
|
1183
|
+
attachConnectorObserver();
|
|
1184
|
+
measureConnectors();
|
|
1185
|
+
});
|
|
586
1186
|
});
|
|
587
1187
|
onBeforeUnmount(() => {
|
|
588
|
-
|
|
589
|
-
|
|
1188
|
+
connectorResizeObserver?.disconnect();
|
|
1189
|
+
connectorResizeObserver = null;
|
|
590
1190
|
});
|
|
591
|
-
watch(
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
)
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
() => props.showScores,
|
|
604
|
-
() => props.showSeed,
|
|
605
|
-
() => props.density,
|
|
606
|
-
() => props.showRoundTitles
|
|
607
|
-
],
|
|
608
|
-
() => nextTick(measureConnectors),
|
|
609
|
-
{ flush: "post" }
|
|
610
|
-
);
|
|
1191
|
+
watch(() => props.variant, () => nextTick(() => {
|
|
1192
|
+
attachConnectorObserver();
|
|
1193
|
+
measureConnectors();
|
|
1194
|
+
}), { flush: "post" });
|
|
1195
|
+
watch([
|
|
1196
|
+
displayRounds,
|
|
1197
|
+
isHorizontal,
|
|
1198
|
+
() => props.showScores,
|
|
1199
|
+
() => props.showSeed,
|
|
1200
|
+
() => props.density,
|
|
1201
|
+
() => props.showRoundTitles
|
|
1202
|
+
], () => nextTick(measureConnectors), { flush: "post" });
|
|
611
1203
|
const roundStyleFor = (_index) => {
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
1204
|
+
const minHeight = `${totalHeight.value}px`;
|
|
1205
|
+
if (isHorizontal.value) {
|
|
1206
|
+
return {
|
|
1207
|
+
minHeight,
|
|
1208
|
+
width: `${matchWidth}px`,
|
|
1209
|
+
flex: "0 0 auto"
|
|
1210
|
+
};
|
|
1211
|
+
}
|
|
1212
|
+
return {
|
|
1213
|
+
minWidth: `${totalHeight.value}px`,
|
|
1214
|
+
height: `${verticalRoundThickness}px`,
|
|
1215
|
+
flex: "0 0 auto"
|
|
1216
|
+
};
|
|
625
1217
|
};
|
|
1218
|
+
/*********************************************************
|
|
1219
|
+
* Event proxies
|
|
1220
|
+
********************************************************/
|
|
626
1221
|
const onMatchClick = (match, event) => {
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
1222
|
+
const round = displayRounds.value.find((r) => r.matches.some((m) => m.id === match.id));
|
|
1223
|
+
if (!round) return;
|
|
1224
|
+
emit("match-click", match, round, event);
|
|
630
1225
|
};
|
|
631
1226
|
const onWinnerClick = (competitor, match, event) => {
|
|
632
|
-
|
|
1227
|
+
emit("winner-click", competitor, match, event);
|
|
633
1228
|
};
|
|
634
1229
|
const onCompetitorClick = (competitor, match, _side, event) => {
|
|
635
|
-
|
|
1230
|
+
emit("competitor-click", competitor, match, event);
|
|
636
1231
|
};
|
|
1232
|
+
// Legible text for a painted surface. The intent → foreground tokens
|
|
1233
|
+
// always pair white, which only contrasts a *dark* fill; on a light
|
|
1234
|
+
// intent (warning, success, …) white is unreadable. Since the surface
|
|
1235
|
+
// resolves to a theme var we cannot WCAG-test it in JS — so we measure
|
|
1236
|
+
// the painted match card at runtime and pick the better of black /
|
|
1237
|
+
// white. Reactive: re-measured on mount, on bgColor / variant change.
|
|
637
1238
|
const autoTextColor = ref(null);
|
|
638
1239
|
const measureContrast = () => {
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
1240
|
+
if (!props.bgColor) {
|
|
1241
|
+
autoTextColor.value = null;
|
|
1242
|
+
return;
|
|
1243
|
+
}
|
|
1244
|
+
const card = connectorContainer()?.querySelector(".origam-bracket-match");
|
|
1245
|
+
if (!card) {
|
|
1246
|
+
autoTextColor.value = null;
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
const channels = getComputedStyle(card).backgroundColor.match(/\d+(?:\.\d+)?/g);
|
|
1250
|
+
if (!channels || channels.length < 3) {
|
|
1251
|
+
autoTextColor.value = null;
|
|
1252
|
+
return;
|
|
1253
|
+
}
|
|
1254
|
+
// Pick the black / white that maximises the WCAG ratio against the
|
|
1255
|
+
// rendered surface. Crossover is at a gamma-corrected relative
|
|
1256
|
+
// luminance of ~0.179: darker fills (primary) take white, lighter
|
|
1257
|
+
// ones (warning, success, info) take black.
|
|
1258
|
+
const linear = (channel) => {
|
|
1259
|
+
const c = channel / 255;
|
|
1260
|
+
return c <= .03928 ? c / 12.92 : ((c + .055) / 1.055) ** 2.4;
|
|
1261
|
+
};
|
|
1262
|
+
const luminance = .2126 * linear(+channels[0]) + .7152 * linear(+channels[1]) + .0722 * linear(+channels[2]);
|
|
1263
|
+
autoTextColor.value = luminance < .179 ? "#ffffff" : "#000000";
|
|
659
1264
|
};
|
|
1265
|
+
/*********************************************************
|
|
1266
|
+
* Color / shape / border → CSS custom properties
|
|
1267
|
+
*
|
|
1268
|
+
* @description
|
|
1269
|
+
* `bgColor` / `rounded` / `elevation` / `border*` paint EACH match via
|
|
1270
|
+
* the shared `bracketSurfaceVars` resolver (single source of truth with
|
|
1271
|
+
* OrigamBracketMatch). `color` drives the match text (auto-contrast wins
|
|
1272
|
+
* when a surface is painted). The connector links follow the match
|
|
1273
|
+
* border (width + style + colour) so trees and links read as one.
|
|
1274
|
+
********************************************************/
|
|
660
1275
|
const colorVars = computed(() => {
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
1276
|
+
const vars = bracketSurfaceVars(props);
|
|
1277
|
+
// Text foreground: a painted surface (`bgColor`) takes the measured
|
|
1278
|
+
// black / white that actually passes WCAG against it; with no
|
|
1279
|
+
// surface, `color` drives the text on the neutral background.
|
|
1280
|
+
const foreground = autoTextColor.value ?? resolveBracketForeground(props.color);
|
|
1281
|
+
if (foreground) vars["--origam-bracket---color"] = foreground;
|
|
1282
|
+
// Connector links mirror the match border. stroke-width is set
|
|
1283
|
+
// explicitly (not just via the SCSS fallback) because a global
|
|
1284
|
+
// `:root` default for it would otherwise always win.
|
|
1285
|
+
const borderColor = resolveBracketBorderColor(props.borderColor);
|
|
1286
|
+
if (borderColor) {
|
|
1287
|
+
vars["--origam-bracket-connector---stroke-color"] = borderColor;
|
|
1288
|
+
vars["--origam-bracket-connector---stroke-color-winner"] = borderColor;
|
|
1289
|
+
}
|
|
1290
|
+
const borderWidth = resolveBracketBorderWidth(props.border);
|
|
1291
|
+
if (borderWidth) vars["--origam-bracket-connector---stroke-width"] = borderWidth;
|
|
1292
|
+
const dash = bracketDashArray(props.borderStyle);
|
|
1293
|
+
if (dash.dasharray) vars["--origam-bracket-connector---stroke-dasharray"] = dash.dasharray;
|
|
1294
|
+
if (dash.linecap) vars["--origam-bracket-connector---stroke-linecap"] = dash.linecap;
|
|
1295
|
+
return vars;
|
|
675
1296
|
});
|
|
1297
|
+
// Read the SETTLED surface: the match card animates its background
|
|
1298
|
+
// (`transition: background-color 120ms`), so an immediate read sees the
|
|
1299
|
+
// mid-transition colour and locks the wrong black / white. Wait past
|
|
1300
|
+
// the transition before measuring.
|
|
676
1301
|
const CONTRAST_SETTLE_MS = 200;
|
|
677
1302
|
let contrastTimer = null;
|
|
678
1303
|
const scheduleContrast = () => {
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
1304
|
+
if (typeof window === "undefined") return;
|
|
1305
|
+
if (contrastTimer) clearTimeout(contrastTimer);
|
|
1306
|
+
contrastTimer = setTimeout(measureContrast, CONTRAST_SETTLE_MS);
|
|
682
1307
|
};
|
|
683
|
-
watch(
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
);
|
|
1308
|
+
watch([
|
|
1309
|
+
() => props.bgColor,
|
|
1310
|
+
() => props.variant,
|
|
1311
|
+
displayRounds
|
|
1312
|
+
], scheduleContrast, { flush: "post" });
|
|
688
1313
|
onMounted(scheduleContrast);
|
|
689
1314
|
onBeforeUnmount(() => {
|
|
690
|
-
|
|
691
|
-
|
|
1315
|
+
if (contrastTimer) clearTimeout(contrastTimer);
|
|
1316
|
+
contrastTimer = null;
|
|
692
1317
|
});
|
|
1318
|
+
/*********************************************************
|
|
1319
|
+
* Class & Style
|
|
1320
|
+
*
|
|
1321
|
+
* @description
|
|
1322
|
+
* `rounded`, `elevation` and `border*` are applied PER-MATCH via
|
|
1323
|
+
* `colorVars` (CSS custom properties the match cards consume), not on
|
|
1324
|
+
* the bracket root — so each card is shaped / elevated / bordered.
|
|
1325
|
+
********************************************************/
|
|
693
1326
|
const { dimensionStyles } = useDimension(props);
|
|
694
1327
|
const { marginClasses, marginStyles } = useMargin(props);
|
|
695
1328
|
const { paddingClasses, paddingStyles } = usePadding(props);
|
|
696
1329
|
const { typographyStyles } = useTypography(props, "bracket-double-label");
|
|
697
1330
|
const rootStyles = computed(() => {
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
1331
|
+
return [
|
|
1332
|
+
dimensionStyles.value,
|
|
1333
|
+
marginStyles.value,
|
|
1334
|
+
paddingStyles.value,
|
|
1335
|
+
{
|
|
1336
|
+
"--origam-bracket---round-gap": `${roundGap}px`,
|
|
1337
|
+
"--origam-bracket---match-gap": `${baseGap}px`,
|
|
1338
|
+
...colorVars.value
|
|
1339
|
+
},
|
|
1340
|
+
props.style
|
|
1341
|
+
];
|
|
709
1342
|
});
|
|
710
1343
|
const rootClasses = computed(() => {
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
1344
|
+
return [
|
|
1345
|
+
"origam-bracket",
|
|
1346
|
+
`origam-bracket--variant-${props.variant}`,
|
|
1347
|
+
`origam-bracket--direction-${props.direction}`,
|
|
1348
|
+
`origam-bracket--density-${props.density ?? "default"}`,
|
|
1349
|
+
`origam-bracket--color-${props.color}`,
|
|
1350
|
+
marginClasses.value,
|
|
1351
|
+
paddingClasses.value,
|
|
1352
|
+
props.class
|
|
1353
|
+
];
|
|
721
1354
|
});
|
|
722
1355
|
const treeClasses = computed(() => {
|
|
723
|
-
|
|
724
|
-
"origam-bracket__tree",
|
|
725
|
-
`origam-bracket__tree--direction-${props.direction}`
|
|
726
|
-
];
|
|
1356
|
+
return ["origam-bracket__tree", `origam-bracket__tree--direction-${props.direction}`];
|
|
727
1357
|
});
|
|
1358
|
+
/*********************************************************
|
|
1359
|
+
* Expose
|
|
1360
|
+
********************************************************/
|
|
728
1361
|
defineExpose({
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
1362
|
+
filterProps,
|
|
1363
|
+
displayRounds,
|
|
1364
|
+
connectorPaths,
|
|
1365
|
+
roundRobinCompetitors
|
|
733
1366
|
});
|
|
734
1367
|
</script>
|
|
735
1368
|
|