origam 2.41.0 → 2.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +103 -0
- package/dist/src/assets/locales/en.json +10 -1
- package/dist/src/assets/locales/fr.json +10 -1
- package/dist/src/components/Alert/OrigamAlert.vue +1 -2
- package/dist/src/components/Audio/OrigamAudio.vue +15 -14
- package/dist/src/components/Badge/OrigamBadge.vue +6 -1
- package/dist/src/components/Bracket/OrigamBracket.vue +5 -5
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbDivider.vue +1 -2
- package/dist/src/components/Btn/OrigamBtn.vue +71 -27
- package/dist/src/components/Card/OrigamCard.vue +2 -1
- package/dist/src/components/Carousel/OrigamCarousel.vue +14 -13
- package/dist/src/components/Chart/OrigamChartBullet.vue +4 -1
- package/dist/src/components/Chart/OrigamChartPictorial.vue +3 -6
- package/dist/src/components/Chart/OrigamChartPolar.vue +2 -1
- package/dist/src/components/Chart/OrigamChartPolarBar.vue +3 -1
- package/dist/src/components/Chart/OrigamChartSankey.vue +9 -167
- package/dist/src/components/Chart/OrigamChartStreamgraph.vue +14 -12
- package/dist/src/components/Chart/OrigamChartSunburst.vue +10 -2
- package/dist/src/components/Chart/OrigamChartWordCloud.vue +39 -36
- package/dist/src/components/Checkbox/OrigamCheckboxBtn.vue +3 -4
- package/dist/src/components/Chip/OrigamChip.vue +14 -15
- package/dist/src/components/Chip/OrigamChipGroup.vue +2 -3
- package/dist/src/components/Clipboard/OrigamClipboard.vue +1 -1
- package/dist/src/components/Code/OrigamCode.vue +4 -2
- package/dist/src/components/ColorPicker/OrigamColorPicker.vue +5 -1
- package/dist/src/components/ColorPicker/OrigamColorPickerEdit.vue +1 -2
- package/dist/src/components/ColorPicker/OrigamColorPickerPreview.vue +1 -2
- package/dist/src/components/ColorPicker/OrigamColorPickerSwatches.vue +1 -2
- package/dist/src/components/CommandPalette/OrigamCommandPalette.vue +6 -2
- package/dist/src/components/ConfirmWrapper/OrigamConfirmWrapper.vue +2 -4
- package/dist/src/components/Counter/OrigamCounter.vue +1 -0
- package/dist/src/components/DataTable/OrigamDataTable.vue +2 -3
- package/dist/src/components/DataTable/OrigamDataTableGroupHeaderRow.vue +1 -2
- package/dist/src/components/DataTable/OrigamDataTableHeadersCellMobile.vue +3 -2
- package/dist/src/components/DataTable/OrigamDataTableRow.vue +2 -3
- package/dist/src/components/DataTable/OrigamDataTableRows.vue +43 -39
- package/dist/src/components/DatePicker/OrigamDatePickerControls.vue +3 -4
- package/dist/src/components/DatePicker/OrigamDatePickerMonth.vue +1 -1
- package/dist/src/components/DatePickerField/OrigamDatePickerField.vue +1 -2
- package/dist/src/components/Dialog/OrigamDialog.vue +1 -2
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelHeader.vue +2 -3
- package/dist/src/components/Field/OrigamField.vue +2 -6
- package/dist/src/components/FileField/OrigamFileField.vue +23 -6
- package/dist/src/components/FileField/OrigamFileFieldDragNDropItem.vue +3 -4
- package/dist/src/components/FileField/OrigamFileFieldListItem.vue +3 -4
- package/dist/src/components/Form/OrigamForm.vue +0 -2
- package/dist/src/components/InlineEdit/OrigamInlineEdit.vue +7 -7
- package/dist/src/components/Input/OrigamInput.vue +3 -11
- package/dist/src/components/List/OrigamListGroup.vue +2 -3
- package/dist/src/components/List/OrigamListItem.vue +11 -5
- package/dist/src/components/Media/OrigamMediaController.vue +12 -13
- package/dist/src/components/Media/OrigamMediaScrubber.vue +15 -12
- package/dist/src/components/Media/OrigamMediaVolumeControl.vue +4 -5
- package/dist/src/components/Menu/OrigamMenu.vue +1 -2
- package/dist/src/components/NumberField/OrigamNumberField.vue +7 -10
- package/dist/src/components/NumberFormat/OrigamNumberFormat.vue +7 -1
- package/dist/src/components/OtpInputField/OrigamOtpInputField.vue +1 -1
- package/dist/src/components/Pagination/OrigamPagination.vue +4 -5
- package/dist/src/components/Parallax/OrigamParallaxElement.vue +1 -4
- package/dist/src/components/PasswordField/OrigamPasswordField.vue +37 -15
- package/dist/src/components/Progress/OrigamProgressLinear.vue +7 -6
- package/dist/src/components/Radio/OrigamRadio.vue +5 -2
- package/dist/src/components/Radio/OrigamRadioBtn.vue +7 -5
- package/dist/src/components/RatingField/OrigamRatingField.vue +1 -2
- package/dist/src/components/RatingField/OrigamRatingFieldItem.vue +2 -3
- package/dist/src/components/Select/OrigamSelect.vue +174 -107
- package/dist/src/components/SelectionControl/OrigamSelectionControl.vue +7 -2
- package/dist/src/components/Slide/OrigamSlideGroup.vue +7 -10
- package/dist/src/components/SliderField/OrigamSliderField.vue +1 -2
- package/dist/src/components/Snackbar/OrigamSnackbarItem.vue +9 -10
- package/dist/src/components/Stepper/OrigamStepper.vue +7 -11
- package/dist/src/components/Stepper/OrigamStepperItem.vue +2 -3
- package/dist/src/components/Switch/OrigamSwitch.vue +0 -9
- package/dist/src/components/Tabs/OrigamTabs.vue +1 -1
- package/dist/src/components/TextField/OrigamTextField.vue +2 -5
- package/dist/src/components/TextareaField/OrigamTextareaField.vue +3 -2
- package/dist/src/components/TextareaField/OrigamTextareaFieldRichToolbar.vue +13 -14
- package/dist/src/components/Transition/OrigamExpandX.vue +4 -10
- package/dist/src/components/Transition/OrigamExpandY.vue +4 -10
- package/dist/src/components/Transition/OrigamSnack.vue +2 -8
- package/dist/src/components/Treeview/OrigamTreeviewNode.vue +24 -18
- package/dist/src/components/Video/OrigamVideo.vue +14 -19
- package/dist/src/components/Window/OrigamWindow.vue +2 -3
- package/dist/src/composables/Audio/use-waveform.composable.cjs +24 -19
- package/dist/src/composables/Audio/use-waveform.composable.js +24 -19
- package/dist/src/composables/Calendar/calendar.composable.cjs +11 -11
- package/dist/src/composables/Calendar/calendar.composable.js +1 -1
- package/dist/src/composables/Chart/chart.composable.cjs +541 -415
- package/dist/src/composables/Chart/chart.composable.d.ts +2 -5
- package/dist/src/composables/Chart/chart.composable.js +392 -338
- package/dist/src/composables/Code/code.composable.cjs +4 -4
- package/dist/src/composables/Code/code.composable.js +1 -1
- package/dist/src/composables/Commons/color.composable.cjs +106 -48
- package/dist/src/composables/Commons/color.composable.js +55 -48
- package/dist/src/composables/Commons/display.composable.cjs +7 -1
- package/dist/src/composables/Commons/display.composable.js +2 -2
- package/dist/src/composables/Commons/dragResizer.composable.cjs +11 -10
- package/dist/src/composables/Commons/dragResizer.composable.js +2 -1
- package/dist/src/composables/Commons/group.composable.cjs +17 -14
- package/dist/src/composables/Commons/group.composable.js +19 -15
- package/dist/src/composables/Commons/nested.composable.cjs +16 -16
- package/dist/src/composables/Commons/nested.composable.d.ts +1 -1
- package/dist/src/composables/Commons/nested.composable.js +1 -1
- package/dist/src/composables/Commons/nestedItem.composable.cjs +3 -3
- package/dist/src/composables/Commons/nestedItem.composable.d.ts +1 -1
- package/dist/src/composables/Commons/nestedItem.composable.js +1 -1
- package/dist/src/composables/Commons/size.composable.cjs +1 -1
- package/dist/src/composables/Commons/size.composable.js +1 -1
- package/dist/src/composables/Commons/stateEffect.composable.cjs +54 -32
- package/dist/src/composables/Commons/stateEffect.composable.js +43 -33
- package/dist/src/composables/Commons/teleport.composable.cjs +2 -1
- package/dist/src/composables/Commons/teleport.composable.js +4 -1
- package/dist/src/composables/Commons/touch.composable.cjs +77 -33
- package/dist/src/composables/Commons/touch.composable.js +77 -33
- package/dist/src/composables/Commons/vModel.composable.cjs +1 -1
- package/dist/src/composables/Commons/vModel.composable.js +1 -1
- package/dist/src/composables/Commons/validation.composable.cjs +1 -1
- package/dist/src/composables/Commons/validation.composable.js +1 -1
- package/dist/src/composables/Commons/velocity.composable.cjs +5 -1
- package/dist/src/composables/Commons/velocity.composable.js +5 -1
- package/dist/src/composables/DataTable/headers.composable.cjs +36 -30
- package/dist/src/composables/DataTable/headers.composable.d.ts +1 -1
- package/dist/src/composables/DataTable/headers.composable.js +29 -23
- package/dist/src/composables/DataTable/headersCell.composable.cjs +2 -2
- package/dist/src/composables/DataTable/headersCell.composable.js +1 -1
- package/dist/src/composables/DataTable/select.composable.cjs +4 -4
- package/dist/src/composables/DataTable/select.composable.js +1 -1
- package/dist/src/composables/DataTable/sort.composable.cjs +6 -6
- package/dist/src/composables/DataTable/sort.composable.js +1 -1
- package/dist/src/composables/Form/form.composable.cjs +1 -1
- package/dist/src/composables/Form/form.composable.js +3 -1
- package/dist/src/composables/Masonry/masonry.composable.cjs +29 -20
- package/dist/src/composables/Masonry/masonry.composable.d.ts +0 -14
- package/dist/src/composables/Masonry/masonry.composable.js +29 -20
- package/dist/src/composables/NumberFormat/number-format.composable.cjs +28 -23
- package/dist/src/composables/NumberFormat/number-format.composable.js +28 -23
- package/dist/src/composables/Parallax/parallax.composable.cjs +9 -9
- package/dist/src/composables/Parallax/parallax.composable.js +3 -3
- package/dist/src/composables/Parallax/transform.composable.cjs +14 -13
- package/dist/src/composables/Parallax/transform.composable.js +2 -1
- package/dist/src/composables/PasswordField/passwordStrength.composable.cjs +2 -2
- package/dist/src/composables/PasswordField/passwordStrength.composable.js +1 -1
- package/dist/src/composables/QrCode/qr-code.composable.cjs +1 -1
- package/dist/src/composables/QrCode/qr-code.composable.js +1 -1
- package/dist/src/composables/Sheet/sheetSwipe.composable.cjs +3 -4
- package/dist/src/composables/Sheet/sheetSwipe.composable.js +4 -4
- package/dist/src/composables/TextareaField/textarea-field-rich.composable.cjs +31 -31
- package/dist/src/composables/TextareaField/textarea-field-rich.composable.js +1 -1
- package/dist/src/composables/Watermark/watermark.composable.cjs +1 -1
- package/dist/src/composables/Watermark/watermark.composable.js +1 -1
- package/dist/src/consts/Audio/audio.const.cjs +5 -4
- package/dist/src/consts/Audio/audio.const.d.ts +2 -1
- package/dist/src/consts/Audio/audio.const.js +2 -1
- package/dist/src/consts/Blockquote/blockquote.const.cjs +3 -3
- package/dist/src/consts/Blockquote/blockquote.const.js +1 -1
- package/dist/src/consts/Bracket/bracket.const.cjs +4 -3
- package/dist/src/consts/Bracket/bracket.const.js +2 -1
- package/dist/src/consts/Code/code.const.cjs +3 -3
- package/dist/src/consts/Code/code.const.d.ts +1 -1
- package/dist/src/consts/Code/code.const.js +1 -1
- package/dist/src/consts/Commons/autocomplete.const.cjs +2 -2
- package/dist/src/consts/Commons/autocomplete.const.d.ts +1 -1
- package/dist/src/consts/Commons/autocomplete.const.js +1 -1
- package/dist/src/consts/Commons/display.const.cjs +2 -2
- package/dist/src/consts/Commons/display.const.js +1 -1
- package/dist/src/consts/Commons/hotkey.const.cjs +2 -2
- package/dist/src/consts/Commons/hotkey.const.js +1 -1
- package/dist/src/consts/Commons/margin.const.cjs +1 -1
- package/dist/src/consts/Commons/margin.const.js +1 -1
- package/dist/src/consts/Commons/padding.const.cjs +1 -1
- package/dist/src/consts/Commons/padding.const.js +1 -1
- package/dist/src/consts/Commons/rounded.const.cjs +6 -2
- package/dist/src/consts/Commons/rounded.const.js +6 -2
- package/dist/src/consts/EmptyState/empty-state.const.cjs +12 -12
- package/dist/src/consts/EmptyState/empty-state.const.js +6 -6
- package/dist/src/consts/PasswordField/password-field.const.cjs +20 -11
- package/dist/src/consts/PasswordField/password-field.const.d.ts +10 -5
- package/dist/src/consts/PasswordField/password-field.const.js +17 -10
- package/dist/src/consts/QrCode/qr-code.const.cjs +2 -2
- package/dist/src/consts/QrCode/qr-code.const.js +1 -1
- package/dist/src/consts/TextField/text-field.const.cjs +21 -21
- package/dist/src/consts/TextField/text-field.const.js +1 -1
- package/dist/src/consts/TextareaField/textarea-field.const.cjs +32 -4
- package/dist/src/consts/TextareaField/textarea-field.const.d.ts +1 -0
- package/dist/src/consts/TextareaField/textarea-field.const.js +29 -1
- package/dist/src/directives/Contrast/contrast.directive.cjs +5 -3
- package/dist/src/directives/Contrast/contrast.directive.js +5 -3
- package/dist/src/directives/Intersect/intersect.directive.cjs +2 -1
- package/dist/src/directives/Intersect/intersect.directive.js +2 -1
- package/dist/src/interfaces/Chart/chart.interface.d.ts +70 -1
- package/dist/src/interfaces/ColorPicker/color-picker.interface.d.ts +1 -1
- package/dist/src/interfaces/Commons/border.interface.d.ts +11 -10
- package/dist/src/interfaces/Commons/filters.interface.d.ts +7 -0
- package/dist/src/interfaces/Commons/margin.interface.d.ts +12 -11
- package/dist/src/interfaces/Commons/padding.interface.d.ts +12 -11
- package/dist/src/interfaces/Commons/ripple.interface.d.ts +1 -3
- package/dist/src/interfaces/Commons/rounded.interface.d.ts +10 -9
- package/dist/src/interfaces/DataTable/sort.interface.d.ts +6 -0
- package/dist/src/interfaces/Grid/grid.interface.d.ts +4 -4
- package/dist/src/interfaces/PasswordField/password-field.interface.d.ts +5 -1
- package/dist/src/interfaces/PasswordField/password-requirement.interface.d.ts +8 -0
- package/dist/src/interfaces/Radio/radio-btn.interface.d.ts +2 -2
- package/dist/src/interfaces/Radio/radio.interface.d.ts +2 -1
- package/dist/src/interfaces/Select/select.interface.d.ts +1 -0
- package/dist/src/interfaces/SelectionControl/selection-control.interface.d.ts +5 -1
- package/dist/src/interfaces/SliderField/slider-field.interface.d.ts +4 -4
- package/dist/src/origam-core.cjs +51 -33
- package/dist/src/origam-core.js +21 -27
- package/dist/src/types/Commons/box-value.type.cjs +1 -0
- package/dist/src/types/Commons/box-value.type.d.ts +1 -0
- package/dist/src/types/Commons/box-value.type.js +0 -0
- package/dist/src/types/Commons/location.type.d.ts +13 -0
- package/dist/src/types/Commons/point.type.d.ts +1 -1
- package/dist/src/types/DataTable/data-table.type.d.ts +1 -0
- package/dist/src/types/Grid/grid.type.d.ts +7 -0
- package/dist/src/types/SliderField/slider-field.type.d.ts +8 -0
- package/dist/src/utils/Bracket/bracket-surface.util.cjs +9 -2
- package/dist/src/utils/Bracket/bracket-surface.util.js +9 -2
- package/dist/src/utils/Calendar/rrule.util.cjs +12 -7
- package/dist/src/utils/Calendar/rrule.util.js +12 -7
- package/dist/src/utils/Chart/chart-point.util.cjs +15 -0
- package/dist/src/utils/Chart/chart-point.util.d.ts +11 -0
- package/dist/src/utils/Chart/chart-point.util.js +8 -0
- package/dist/src/utils/Chart/sankey-layout.util.cjs +144 -0
- package/dist/src/utils/Chart/sankey-layout.util.d.ts +27 -0
- package/dist/src/utils/Chart/sankey-layout.util.js +130 -0
- package/dist/src/utils/Code/parse-highlight-lines.util.cjs +17 -14
- package/dist/src/utils/Code/parse-highlight-lines.util.js +17 -14
- package/dist/src/utils/CommandPalette/fuzzy-match.util.cjs +13 -9
- package/dist/src/utils/CommandPalette/fuzzy-match.util.js +13 -9
- package/dist/src/utils/Commons/anchor.util.cjs +6 -1
- package/dist/src/utils/Commons/anchor.util.js +6 -1
- package/dist/src/utils/Commons/apply-mask.util.cjs +11 -14
- package/dist/src/utils/Commons/apply-mask.util.js +7 -10
- package/dist/src/utils/Commons/apply-theme.util.cjs +6 -4
- package/dist/src/utils/Commons/apply-theme.util.js +6 -4
- package/dist/src/utils/Commons/bindProps.util.cjs +3 -5
- package/dist/src/utils/Commons/bindProps.util.js +3 -5
- package/dist/src/utils/Commons/color.util.cjs +43 -36
- package/dist/src/utils/Commons/color.util.js +44 -31
- package/dist/src/utils/Commons/commons.util.cjs +3 -3
- package/dist/src/utils/Commons/commons.util.js +3 -3
- package/dist/src/utils/Commons/console.util.cjs +6 -0
- package/dist/src/utils/Commons/console.util.d.ts +11 -0
- package/dist/src/utils/Commons/console.util.js +5 -0
- package/dist/src/utils/Commons/date.util.cjs +2 -27
- package/dist/src/utils/Commons/date.util.js +2 -27
- package/dist/src/utils/Commons/display.util.cjs +10 -1
- package/dist/src/utils/Commons/display.util.d.ts +8 -1
- package/dist/src/utils/Commons/display.util.js +9 -1
- package/dist/src/utils/Commons/eventListener.util.cjs +1 -2
- package/dist/src/utils/Commons/eventListener.util.js +1 -2
- package/dist/src/utils/Commons/filters.util.cjs +48 -34
- package/dist/src/utils/Commons/filters.util.d.ts +3 -8
- package/dist/src/utils/Commons/filters.util.js +47 -34
- package/dist/src/utils/Commons/forwardRefs.util.cjs +44 -40
- package/dist/src/utils/Commons/forwardRefs.util.js +44 -40
- package/dist/src/utils/Commons/group.util.cjs +1 -1
- package/dist/src/utils/Commons/group.util.js +1 -1
- package/dist/src/utils/Commons/hotkey.util.cjs +65 -61
- package/dist/src/utils/Commons/hotkey.util.js +56 -53
- package/dist/src/utils/Commons/hover.util.cjs +2 -2
- package/dist/src/utils/Commons/hover.util.js +2 -2
- package/dist/src/utils/Commons/locale.util.cjs +1 -1
- package/dist/src/utils/Commons/locale.util.js +1 -1
- package/dist/src/utils/Commons/location.util.cjs +87 -92
- package/dist/src/utils/Commons/location.util.js +75 -83
- package/dist/src/utils/Commons/nested.util.cjs +11 -11
- package/dist/src/utils/Commons/nested.util.js +1 -1
- package/dist/src/utils/Commons/point.util.cjs +16 -14
- package/dist/src/utils/Commons/point.util.js +13 -8
- package/dist/src/utils/Commons/ripple.util.cjs +4 -4
- package/dist/src/utils/Commons/ripple.util.js +4 -4
- package/dist/src/utils/Commons/scroll.util.cjs +9 -6
- package/dist/src/utils/Commons/scroll.util.js +9 -6
- package/dist/src/utils/Commons/token-name.util.cjs +22 -21
- package/dist/src/utils/Commons/token-name.util.js +22 -21
- package/dist/src/utils/Commons/validate-pattern.util.cjs +6 -6
- package/dist/src/utils/Commons/validate-pattern.util.js +1 -1
- package/dist/src/utils/DataTable/headers.util.cjs +20 -26
- package/dist/src/utils/DataTable/headers.util.js +18 -26
- package/dist/src/utils/DataTable/sort.util.cjs +41 -47
- package/dist/src/utils/DataTable/sort.util.d.ts +2 -7
- package/dist/src/utils/DataTable/sort.util.js +49 -47
- package/dist/src/utils/List/list-item.util.cjs +6 -1
- package/dist/src/utils/List/list-item.util.js +6 -1
- package/dist/src/utils/Parallax/parallax-element.util.cjs +13 -14
- package/dist/src/utils/Parallax/parallax-element.util.js +10 -11
- package/dist/src/utils/Slide/slide-group.util.cjs +4 -4
- package/dist/src/utils/Slide/slide-group.util.js +4 -4
- package/dist/src/utils/TextareaField/html-to-markdown.util.cjs +5 -36
- package/dist/src/utils/TextareaField/html-to-markdown.util.js +5 -36
- package/dist/src/utils/TextareaField/sanitize-html.util.cjs +18 -22
- package/dist/src/utils/TextareaField/sanitize-html.util.js +19 -23
- package/dist/src/utils/index.cjs +11 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.js +1 -0
- package/package.json +1 -1
|
@@ -48,3 +48,10 @@ export type TGridPlaceContent = TJustify | Extract<TAlign, 'stretch'>;
|
|
|
48
48
|
* radius).
|
|
49
49
|
*/
|
|
50
50
|
export type TGridGapSize = Exclude<TRoundedToken, 'none' | 'full'>;
|
|
51
|
+
/*********************************************************
|
|
52
|
+
* TGridGap
|
|
53
|
+
*
|
|
54
|
+
* @description
|
|
55
|
+
* A gap: a size token, any CSS length string, or a number of pixels.
|
|
56
|
+
********************************************************/
|
|
57
|
+
export type TGridGap = TGridGapSize | string | number;
|
|
@@ -9,7 +9,15 @@ import OrigamSliderField from '../../components/SliderField/OrigamSliderField.vu
|
|
|
9
9
|
* Default is `'field'` (no behavioural break vs. Phase 1).
|
|
10
10
|
*/
|
|
11
11
|
export type TSliderFieldVariant = `${SLIDER_FIELD_VARIANT}`;
|
|
12
|
+
/*********************************************************
|
|
13
|
+
* TSliderFieldNumeric
|
|
14
|
+
*
|
|
15
|
+
* @description
|
|
16
|
+
* Raw numeric prop as received (`min` / `max` / `step`): a number, a numeric string, or nothing.
|
|
17
|
+
********************************************************/
|
|
18
|
+
export type TSliderFieldNumeric = string | number | null | undefined;
|
|
12
19
|
export type TAlways = boolean | 'always';
|
|
20
|
+
export type TSliderFieldValue = number | string | Array<number> | Array<string>;
|
|
13
21
|
export type TSliderData = {
|
|
14
22
|
value: number;
|
|
15
23
|
};
|
|
@@ -55,11 +55,18 @@ function resolveBracketRadius(value) {
|
|
|
55
55
|
if (value === true) return "var(--origam-radius---md)";
|
|
56
56
|
return (0, _commons.convertToUnit)(value) ?? null;
|
|
57
57
|
}
|
|
58
|
+
function shadowVarForElevation(value) {
|
|
59
|
+
if (value <= 0) return "var(--origam-shadow---none)";
|
|
60
|
+
if (value <= 2) return "var(--origam-shadow---xs)";
|
|
61
|
+
if (value <= 4) return "var(--origam-shadow---sm)";
|
|
62
|
+
if (value <= 8) return "var(--origam-shadow---md)";
|
|
63
|
+
if (value <= 16) return "var(--origam-shadow---lg)";
|
|
64
|
+
return "var(--origam-shadow---xl)";
|
|
65
|
+
}
|
|
58
66
|
function resolveBracketShadow(value) {
|
|
59
67
|
if (value == null || value === false) return null;
|
|
60
68
|
if (typeof value === "number") {
|
|
61
|
-
|
|
62
|
-
return `var(--origam-shadow---${rung})`;
|
|
69
|
+
return shadowVarForElevation(value);
|
|
63
70
|
}
|
|
64
71
|
if (typeof value === "string" && SHADOW_RUNGS.includes(value)) return `var(--origam-shadow---${value})`;
|
|
65
72
|
if (value === true) return "var(--origam-shadow---md)";
|
|
@@ -42,11 +42,18 @@ export function resolveBracketRadius(value) {
|
|
|
42
42
|
if (value === true) return "var(--origam-radius---md)";
|
|
43
43
|
return convertToUnit(value) ?? null;
|
|
44
44
|
}
|
|
45
|
+
function shadowVarForElevation(value) {
|
|
46
|
+
if (value <= 0) return "var(--origam-shadow---none)";
|
|
47
|
+
if (value <= 2) return "var(--origam-shadow---xs)";
|
|
48
|
+
if (value <= 4) return "var(--origam-shadow---sm)";
|
|
49
|
+
if (value <= 8) return "var(--origam-shadow---md)";
|
|
50
|
+
if (value <= 16) return "var(--origam-shadow---lg)";
|
|
51
|
+
return "var(--origam-shadow---xl)";
|
|
52
|
+
}
|
|
45
53
|
export function resolveBracketShadow(value) {
|
|
46
54
|
if (value == null || value === false) return null;
|
|
47
55
|
if (typeof value === "number") {
|
|
48
|
-
|
|
49
|
-
return `var(--origam-shadow---${rung})`;
|
|
56
|
+
return shadowVarForElevation(value);
|
|
50
57
|
}
|
|
51
58
|
if (typeof value === "string" && SHADOW_RUNGS.includes(value)) return `var(--origam-shadow---${value})`;
|
|
52
59
|
if (value === true) return "var(--origam-shadow---md)";
|
|
@@ -17,7 +17,7 @@ const BY_DAY_MAP = {
|
|
|
17
17
|
};
|
|
18
18
|
function parseUntil(value) {
|
|
19
19
|
if (!value) return null;
|
|
20
|
-
const m =
|
|
20
|
+
const m = /^(\d{4})(\d{2})(\d{2})(?:T(\d{2})(\d{2})(\d{2})Z?)?$/.exec(value);
|
|
21
21
|
if (!m) return null;
|
|
22
22
|
const [, yy, mm, dd, hh, mi, ss] = m;
|
|
23
23
|
const y = Number(yy);
|
|
@@ -67,15 +67,20 @@ function cloneOccurrence(template, occurrenceStart, durationMin) {
|
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
const MAX_OCCURRENCES = 366 * 3;
|
|
70
|
+
function isInRange(event, start, range) {
|
|
71
|
+
if (start.getTime() > range.end.getTime()) return false;
|
|
72
|
+
const eventEnd = event.end ? (0, _date.toDate)(event.end) : null;
|
|
73
|
+
if (eventEnd) return !(eventEnd.getTime() < range.start.getTime());
|
|
74
|
+
return !(start.getTime() < range.start.getTime());
|
|
75
|
+
}
|
|
76
|
+
function canEmitMore(cursor, rule, range, emitted) {
|
|
77
|
+
return cursor.getTime() <= range.end.getTime() && (!rule.until || cursor.getTime() <= rule.until.getTime()) && (rule.count == null || emitted < rule.count) && emitted < MAX_OCCURRENCES;
|
|
78
|
+
}
|
|
70
79
|
function expandRecurrence(event, range) {
|
|
71
80
|
const start = (0, _date.toDate)(event.start);
|
|
72
81
|
if (!start) return [];
|
|
73
82
|
if (!event.rrule) {
|
|
74
|
-
|
|
75
|
-
const eventEnd = event.end ? (0, _date.toDate)(event.end) : null;
|
|
76
|
-
if (eventEnd && eventEnd.getTime() < range.start.getTime()) return [];
|
|
77
|
-
if (!eventEnd && start.getTime() < range.start.getTime()) return [];
|
|
78
|
-
return [event];
|
|
83
|
+
return isInRange(event, start, range) ? [event] : [];
|
|
79
84
|
}
|
|
80
85
|
const rule = parseRRule(event.rrule);
|
|
81
86
|
if (!rule) return event.rrule ? [event] : [];
|
|
@@ -83,7 +88,7 @@ function expandRecurrence(event, range) {
|
|
|
83
88
|
const occurrences = [];
|
|
84
89
|
let cursor = new Date(start.getTime());
|
|
85
90
|
let emitted = 0;
|
|
86
|
-
while (
|
|
91
|
+
while (canEmitMore(cursor, rule, range, emitted)) {
|
|
87
92
|
const passesByDay = rule.freq === "WEEKLY" && rule.byDay ? rule.byDay.includes(cursor.getDay()) : true;
|
|
88
93
|
if (passesByDay && cursor.getTime() >= range.start.getTime() - duration * 6e4) {
|
|
89
94
|
occurrences.push(cloneOccurrence(event, new Date(cursor.getTime()), duration));
|
|
@@ -10,7 +10,7 @@ const BY_DAY_MAP = {
|
|
|
10
10
|
};
|
|
11
11
|
function parseUntil(value) {
|
|
12
12
|
if (!value) return null;
|
|
13
|
-
const m =
|
|
13
|
+
const m = /^(\d{4})(\d{2})(\d{2})(?:T(\d{2})(\d{2})(\d{2})Z?)?$/.exec(value);
|
|
14
14
|
if (!m) return null;
|
|
15
15
|
const [, yy, mm, dd, hh, mi, ss] = m;
|
|
16
16
|
const y = Number(yy);
|
|
@@ -54,15 +54,20 @@ function cloneOccurrence(template, occurrenceStart, durationMin) {
|
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
const MAX_OCCURRENCES = 366 * 3;
|
|
57
|
+
function isInRange(event, start, range) {
|
|
58
|
+
if (start.getTime() > range.end.getTime()) return false;
|
|
59
|
+
const eventEnd = event.end ? toDate(event.end) : null;
|
|
60
|
+
if (eventEnd) return !(eventEnd.getTime() < range.start.getTime());
|
|
61
|
+
return !(start.getTime() < range.start.getTime());
|
|
62
|
+
}
|
|
63
|
+
function canEmitMore(cursor, rule, range, emitted) {
|
|
64
|
+
return cursor.getTime() <= range.end.getTime() && (!rule.until || cursor.getTime() <= rule.until.getTime()) && (rule.count == null || emitted < rule.count) && emitted < MAX_OCCURRENCES;
|
|
65
|
+
}
|
|
57
66
|
export function expandRecurrence(event, range) {
|
|
58
67
|
const start = toDate(event.start);
|
|
59
68
|
if (!start) return [];
|
|
60
69
|
if (!event.rrule) {
|
|
61
|
-
|
|
62
|
-
const eventEnd = event.end ? toDate(event.end) : null;
|
|
63
|
-
if (eventEnd && eventEnd.getTime() < range.start.getTime()) return [];
|
|
64
|
-
if (!eventEnd && start.getTime() < range.start.getTime()) return [];
|
|
65
|
-
return [event];
|
|
70
|
+
return isInRange(event, start, range) ? [event] : [];
|
|
66
71
|
}
|
|
67
72
|
const rule = parseRRule(event.rrule);
|
|
68
73
|
if (!rule) return event.rrule ? [event] : [];
|
|
@@ -70,7 +75,7 @@ export function expandRecurrence(event, range) {
|
|
|
70
75
|
const occurrences = [];
|
|
71
76
|
let cursor = new Date(start.getTime());
|
|
72
77
|
let emitted = 0;
|
|
73
|
-
while (
|
|
78
|
+
while (canEmitMore(cursor, rule, range, emitted)) {
|
|
74
79
|
const passesByDay = rule.freq === "WEEKLY" && rule.byDay ? rule.byDay.includes(cursor.getDay()) : true;
|
|
75
80
|
if (passesByDay && cursor.getTime() >= range.start.getTime() - duration * 6e4) {
|
|
76
81
|
occurrences.push(cloneOccurrence(event, new Date(cursor.getTime()), duration));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.chartPointValue = chartPointValue;
|
|
7
|
+
exports.chartSafeValue = chartSafeValue;
|
|
8
|
+
function chartPointValue(raw) {
|
|
9
|
+
if (raw == null) return 0;
|
|
10
|
+
return typeof raw === "number" ? raw : raw.y;
|
|
11
|
+
}
|
|
12
|
+
function chartSafeValue(raw) {
|
|
13
|
+
const value = chartPointValue(raw);
|
|
14
|
+
return Number.isFinite(value) && value >= 0 ? value : 0;
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*********************************************************
|
|
2
|
+
* chartPointValue / chartSafeValue (#1398)
|
|
3
|
+
*
|
|
4
|
+
* @description
|
|
5
|
+
* Numeric value of a series entry that is either a bare number or an
|
|
6
|
+
* `{ y }` point. `chartPointValue` keeps the raw number (`null` / `undefined`
|
|
7
|
+
* → 0); `chartSafeValue` additionally clamps non-finite / negative values
|
|
8
|
+
* to 0 (the shape the pictorial chart sizes its icons from).
|
|
9
|
+
********************************************************/
|
|
10
|
+
export declare function chartPointValue(raw: unknown): number;
|
|
11
|
+
export declare function chartSafeValue(raw: unknown): number;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.buildSankeyLinkSpecs = buildSankeyLinkSpecs;
|
|
7
|
+
exports.groupSankeyColumns = groupSankeyColumns;
|
|
8
|
+
exports.orderSankeyColumns = orderSankeyColumns;
|
|
9
|
+
exports.sankeyNodeHeight = sankeyNodeHeight;
|
|
10
|
+
exports.sankeyRibbonPath = sankeyRibbonPath;
|
|
11
|
+
exports.stackSankeyBands = stackSankeyBands;
|
|
12
|
+
exports.sumSankeyFlows = sumSankeyFlows;
|
|
13
|
+
function pushToGroup(map, key, item) {
|
|
14
|
+
const group = map.get(key);
|
|
15
|
+
if (group) group.push(item);else map.set(key, [item]);
|
|
16
|
+
}
|
|
17
|
+
function sumSankeyFlows(data, names) {
|
|
18
|
+
const incomingSum = /* @__PURE__ */new Map();
|
|
19
|
+
const outgoingSum = /* @__PURE__ */new Map();
|
|
20
|
+
for (const name of names) {
|
|
21
|
+
incomingSum.set(name, 0);
|
|
22
|
+
outgoingSum.set(name, 0);
|
|
23
|
+
}
|
|
24
|
+
for (const d of data) {
|
|
25
|
+
outgoingSum.set(d.from, (outgoingSum.get(d.from) ?? 0) + d.value);
|
|
26
|
+
incomingSum.set(d.to, (incomingSum.get(d.to) ?? 0) + d.value);
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
incomingSum,
|
|
30
|
+
outgoingSum
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function groupSankeyColumns(columns) {
|
|
34
|
+
const byColumn = /* @__PURE__ */new Map();
|
|
35
|
+
for (const [name, col] of columns.entries()) {
|
|
36
|
+
pushToGroup(byColumn, col, name);
|
|
37
|
+
}
|
|
38
|
+
return byColumn;
|
|
39
|
+
}
|
|
40
|
+
function orderSankeyColumns(byColumn, edges, nodeNames) {
|
|
41
|
+
const orderIndex = /* @__PURE__ */new Map();
|
|
42
|
+
const sortedColumns = Array.from(byColumn.keys()).sort((a, b) => a - b);
|
|
43
|
+
for (const col of sortedColumns) {
|
|
44
|
+
byColumn.get(col).forEach((n, i) => orderIndex.set(n, i));
|
|
45
|
+
}
|
|
46
|
+
const predecessors = /* @__PURE__ */new Map();
|
|
47
|
+
const successors = /* @__PURE__ */new Map();
|
|
48
|
+
for (const name of nodeNames) {
|
|
49
|
+
predecessors.set(name, []);
|
|
50
|
+
successors.set(name, []);
|
|
51
|
+
}
|
|
52
|
+
for (const {
|
|
53
|
+
from,
|
|
54
|
+
to
|
|
55
|
+
} of edges) {
|
|
56
|
+
successors.get(from).push(to);
|
|
57
|
+
predecessors.get(to).push(from);
|
|
58
|
+
}
|
|
59
|
+
const barycenter = neighbours => {
|
|
60
|
+
if (!neighbours.length) return Number.POSITIVE_INFINITY;
|
|
61
|
+
let sum = 0;
|
|
62
|
+
let count = 0;
|
|
63
|
+
for (const n of neighbours) {
|
|
64
|
+
const idx = orderIndex.get(n);
|
|
65
|
+
if (idx !== void 0) {
|
|
66
|
+
sum += idx;
|
|
67
|
+
count++;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return count ? sum / count : Number.POSITIVE_INFINITY;
|
|
71
|
+
};
|
|
72
|
+
const sweep = direction => {
|
|
73
|
+
const cols = direction === "down" ? sortedColumns : [...sortedColumns].reverse();
|
|
74
|
+
const neighbours = direction === "down" ? predecessors : successors;
|
|
75
|
+
for (const col of cols) {
|
|
76
|
+
const names = byColumn.get(col);
|
|
77
|
+
if (names.length < 2) continue;
|
|
78
|
+
names.sort((a, b) => barycenter(neighbours.get(a)) - barycenter(neighbours.get(b)));
|
|
79
|
+
names.forEach((n, i) => orderIndex.set(n, i));
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
for (let pass = 0; pass < 2; pass++) {
|
|
83
|
+
sweep("down");
|
|
84
|
+
sweep("up");
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function sankeyNodeHeight(value, columnTotal, availableHeight, nodeCount) {
|
|
88
|
+
return columnTotal > 0 ? value / columnTotal * availableHeight : availableHeight / nodeCount;
|
|
89
|
+
}
|
|
90
|
+
function bandHeight(value, total, nodeHeight) {
|
|
91
|
+
return total > 0 ? value / total * nodeHeight : 0;
|
|
92
|
+
}
|
|
93
|
+
function buildSankeyLinkSpecs(data, nodeMap, sums, resolveColor) {
|
|
94
|
+
const specs = [];
|
|
95
|
+
for (let i = 0; i < data.length; i++) {
|
|
96
|
+
const d = data[i];
|
|
97
|
+
const sourceNode = nodeMap.get(d.from);
|
|
98
|
+
const targetNode = nodeMap.get(d.to);
|
|
99
|
+
if (!sourceNode || !targetNode) continue;
|
|
100
|
+
const srcOutTotal = sums.outgoingSum.get(d.from) ?? 1;
|
|
101
|
+
const tgtInTotal = sums.incomingSum.get(d.to) ?? 1;
|
|
102
|
+
specs.push({
|
|
103
|
+
index: i,
|
|
104
|
+
from: d.from,
|
|
105
|
+
to: d.to,
|
|
106
|
+
value: d.value,
|
|
107
|
+
color: d.color ? resolveColor(d.color) : sourceNode.color ?? "currentColor",
|
|
108
|
+
srcBandH: bandHeight(d.value, srcOutTotal, sourceNode.height),
|
|
109
|
+
tgtBandH: bandHeight(d.value, tgtInTotal, targetNode.height),
|
|
110
|
+
srcY: sourceNode.y,
|
|
111
|
+
tgtY: targetNode.y
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return specs;
|
|
115
|
+
}
|
|
116
|
+
function stackSankeyBands(specs, nodeMap, side) {
|
|
117
|
+
const isSource = side === "source";
|
|
118
|
+
const groups = /* @__PURE__ */new Map();
|
|
119
|
+
for (const s of specs) {
|
|
120
|
+
pushToGroup(groups, isSource ? s.from : s.to, s);
|
|
121
|
+
}
|
|
122
|
+
const offsets = /* @__PURE__ */new Map();
|
|
123
|
+
for (const [name, group] of groups.entries()) {
|
|
124
|
+
group.sort((a, b) => isSource ? a.tgtY - b.tgtY : a.srcY - b.srcY);
|
|
125
|
+
let acc = nodeMap.get(name).y;
|
|
126
|
+
for (const link of group) {
|
|
127
|
+
const bandH = isSource ? link.srcBandH : link.tgtBandH;
|
|
128
|
+
offsets.set(link.index, {
|
|
129
|
+
yTop: acc,
|
|
130
|
+
bandH
|
|
131
|
+
});
|
|
132
|
+
acc += bandH;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return offsets;
|
|
136
|
+
}
|
|
137
|
+
function sankeyRibbonPath(x0, x1, source, target) {
|
|
138
|
+
const y0Top = source.yTop;
|
|
139
|
+
const y0Bot = source.yTop + source.bandH;
|
|
140
|
+
const y1Top = target.yTop;
|
|
141
|
+
const y1Bot = target.yTop + target.bandH;
|
|
142
|
+
const cp = (x1 - x0) * 0.5;
|
|
143
|
+
return [`M ${x0},${y0Top}`, `C ${x0 + cp},${y0Top} ${x1 - cp},${y1Top} ${x1},${y1Top}`, `L ${x1},${y1Bot}`, `C ${x1 - cp},${y1Bot} ${x0 + cp},${y0Bot} ${x0},${y0Bot}`, "Z"].join(" ");
|
|
144
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { IChartSankeyDatum, IChartSankeyNode } from '../../interfaces/Chart/chart-sankey.interface';
|
|
2
|
+
import type { TChartSankeyLinkSpec } from '../../types/Chart/chart-sankey.type';
|
|
3
|
+
export declare function sumSankeyFlows(data: ReadonlyArray<Pick<IChartSankeyDatum, 'from' | 'to' | 'value'>>, names: Iterable<string>): {
|
|
4
|
+
incomingSum: Map<string, number>;
|
|
5
|
+
outgoingSum: Map<string, number>;
|
|
6
|
+
};
|
|
7
|
+
export declare function groupSankeyColumns(columns: Map<string, number>): Map<number, Array<string>>;
|
|
8
|
+
export declare function orderSankeyColumns(byColumn: Map<number, Array<string>>, edges: ReadonlyArray<{
|
|
9
|
+
from: string;
|
|
10
|
+
to: string;
|
|
11
|
+
}>, nodeNames: ReadonlyArray<string>): void;
|
|
12
|
+
export declare function sankeyNodeHeight(value: number, columnTotal: number, availableHeight: number, nodeCount: number): number;
|
|
13
|
+
export declare function buildSankeyLinkSpecs(data: ReadonlyArray<IChartSankeyDatum>, nodeMap: Map<string, IChartSankeyNode>, sums: {
|
|
14
|
+
incomingSum: Map<string, number>;
|
|
15
|
+
outgoingSum: Map<string, number>;
|
|
16
|
+
}, resolveColor: (raw: IChartSankeyDatum['color']) => string): Array<TChartSankeyLinkSpec>;
|
|
17
|
+
export declare function stackSankeyBands(specs: ReadonlyArray<TChartSankeyLinkSpec>, nodeMap: Map<string, IChartSankeyNode>, side: 'source' | 'target'): Map<number, {
|
|
18
|
+
yTop: number;
|
|
19
|
+
bandH: number;
|
|
20
|
+
}>;
|
|
21
|
+
export declare function sankeyRibbonPath(x0: number, x1: number, source: {
|
|
22
|
+
yTop: number;
|
|
23
|
+
bandH: number;
|
|
24
|
+
}, target: {
|
|
25
|
+
yTop: number;
|
|
26
|
+
bandH: number;
|
|
27
|
+
}): string;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
function pushToGroup(map, key, item) {
|
|
2
|
+
const group = map.get(key);
|
|
3
|
+
if (group) group.push(item);
|
|
4
|
+
else map.set(key, [item]);
|
|
5
|
+
}
|
|
6
|
+
export function sumSankeyFlows(data, names) {
|
|
7
|
+
const incomingSum = /* @__PURE__ */ new Map();
|
|
8
|
+
const outgoingSum = /* @__PURE__ */ new Map();
|
|
9
|
+
for (const name of names) {
|
|
10
|
+
incomingSum.set(name, 0);
|
|
11
|
+
outgoingSum.set(name, 0);
|
|
12
|
+
}
|
|
13
|
+
for (const d of data) {
|
|
14
|
+
outgoingSum.set(d.from, (outgoingSum.get(d.from) ?? 0) + d.value);
|
|
15
|
+
incomingSum.set(d.to, (incomingSum.get(d.to) ?? 0) + d.value);
|
|
16
|
+
}
|
|
17
|
+
return { incomingSum, outgoingSum };
|
|
18
|
+
}
|
|
19
|
+
export function groupSankeyColumns(columns) {
|
|
20
|
+
const byColumn = /* @__PURE__ */ new Map();
|
|
21
|
+
for (const [name, col] of columns.entries()) {
|
|
22
|
+
pushToGroup(byColumn, col, name);
|
|
23
|
+
}
|
|
24
|
+
return byColumn;
|
|
25
|
+
}
|
|
26
|
+
export function orderSankeyColumns(byColumn, edges, nodeNames) {
|
|
27
|
+
const orderIndex = /* @__PURE__ */ new Map();
|
|
28
|
+
const sortedColumns = Array.from(byColumn.keys()).sort((a, b) => a - b);
|
|
29
|
+
for (const col of sortedColumns) {
|
|
30
|
+
byColumn.get(col).forEach((n, i) => orderIndex.set(n, i));
|
|
31
|
+
}
|
|
32
|
+
const predecessors = /* @__PURE__ */ new Map();
|
|
33
|
+
const successors = /* @__PURE__ */ new Map();
|
|
34
|
+
for (const name of nodeNames) {
|
|
35
|
+
predecessors.set(name, []);
|
|
36
|
+
successors.set(name, []);
|
|
37
|
+
}
|
|
38
|
+
for (const { from, to } of edges) {
|
|
39
|
+
successors.get(from).push(to);
|
|
40
|
+
predecessors.get(to).push(from);
|
|
41
|
+
}
|
|
42
|
+
const barycenter = (neighbours) => {
|
|
43
|
+
if (!neighbours.length) return Number.POSITIVE_INFINITY;
|
|
44
|
+
let sum = 0;
|
|
45
|
+
let count = 0;
|
|
46
|
+
for (const n of neighbours) {
|
|
47
|
+
const idx = orderIndex.get(n);
|
|
48
|
+
if (idx !== void 0) {
|
|
49
|
+
sum += idx;
|
|
50
|
+
count++;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return count ? sum / count : Number.POSITIVE_INFINITY;
|
|
54
|
+
};
|
|
55
|
+
const sweep = (direction) => {
|
|
56
|
+
const cols = direction === "down" ? sortedColumns : [...sortedColumns].reverse();
|
|
57
|
+
const neighbours = direction === "down" ? predecessors : successors;
|
|
58
|
+
for (const col of cols) {
|
|
59
|
+
const names = byColumn.get(col);
|
|
60
|
+
if (names.length < 2) continue;
|
|
61
|
+
names.sort((a, b) => barycenter(neighbours.get(a)) - barycenter(neighbours.get(b)));
|
|
62
|
+
names.forEach((n, i) => orderIndex.set(n, i));
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
for (let pass = 0; pass < 2; pass++) {
|
|
66
|
+
sweep("down");
|
|
67
|
+
sweep("up");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export function sankeyNodeHeight(value, columnTotal, availableHeight, nodeCount) {
|
|
71
|
+
return columnTotal > 0 ? value / columnTotal * availableHeight : availableHeight / nodeCount;
|
|
72
|
+
}
|
|
73
|
+
function bandHeight(value, total, nodeHeight) {
|
|
74
|
+
return total > 0 ? value / total * nodeHeight : 0;
|
|
75
|
+
}
|
|
76
|
+
export function buildSankeyLinkSpecs(data, nodeMap, sums, resolveColor) {
|
|
77
|
+
const specs = [];
|
|
78
|
+
for (let i = 0; i < data.length; i++) {
|
|
79
|
+
const d = data[i];
|
|
80
|
+
const sourceNode = nodeMap.get(d.from);
|
|
81
|
+
const targetNode = nodeMap.get(d.to);
|
|
82
|
+
if (!sourceNode || !targetNode) continue;
|
|
83
|
+
const srcOutTotal = sums.outgoingSum.get(d.from) ?? 1;
|
|
84
|
+
const tgtInTotal = sums.incomingSum.get(d.to) ?? 1;
|
|
85
|
+
specs.push({
|
|
86
|
+
index: i,
|
|
87
|
+
from: d.from,
|
|
88
|
+
to: d.to,
|
|
89
|
+
value: d.value,
|
|
90
|
+
color: d.color ? resolveColor(d.color) : sourceNode.color ?? "currentColor",
|
|
91
|
+
srcBandH: bandHeight(d.value, srcOutTotal, sourceNode.height),
|
|
92
|
+
tgtBandH: bandHeight(d.value, tgtInTotal, targetNode.height),
|
|
93
|
+
srcY: sourceNode.y,
|
|
94
|
+
tgtY: targetNode.y
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return specs;
|
|
98
|
+
}
|
|
99
|
+
export function stackSankeyBands(specs, nodeMap, side) {
|
|
100
|
+
const isSource = side === "source";
|
|
101
|
+
const groups = /* @__PURE__ */ new Map();
|
|
102
|
+
for (const s of specs) {
|
|
103
|
+
pushToGroup(groups, isSource ? s.from : s.to, s);
|
|
104
|
+
}
|
|
105
|
+
const offsets = /* @__PURE__ */ new Map();
|
|
106
|
+
for (const [name, group] of groups.entries()) {
|
|
107
|
+
group.sort((a, b) => isSource ? a.tgtY - b.tgtY : a.srcY - b.srcY);
|
|
108
|
+
let acc = nodeMap.get(name).y;
|
|
109
|
+
for (const link of group) {
|
|
110
|
+
const bandH = isSource ? link.srcBandH : link.tgtBandH;
|
|
111
|
+
offsets.set(link.index, { yTop: acc, bandH });
|
|
112
|
+
acc += bandH;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return offsets;
|
|
116
|
+
}
|
|
117
|
+
export function sankeyRibbonPath(x0, x1, source, target) {
|
|
118
|
+
const y0Top = source.yTop;
|
|
119
|
+
const y0Bot = source.yTop + source.bandH;
|
|
120
|
+
const y1Top = target.yTop;
|
|
121
|
+
const y1Bot = target.yTop + target.bandH;
|
|
122
|
+
const cp = (x1 - x0) * 0.5;
|
|
123
|
+
return [
|
|
124
|
+
`M ${x0},${y0Top}`,
|
|
125
|
+
`C ${x0 + cp},${y0Top} ${x1 - cp},${y1Top} ${x1},${y1Top}`,
|
|
126
|
+
`L ${x1},${y1Bot}`,
|
|
127
|
+
`C ${x1 - cp},${y1Bot} ${x0 + cp},${y0Bot} ${x0},${y0Bot}`,
|
|
128
|
+
"Z"
|
|
129
|
+
].join(" ");
|
|
130
|
+
}
|
|
@@ -4,6 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.parseHighlightLines = parseHighlightLines;
|
|
7
|
+
function parseSegment(segment) {
|
|
8
|
+
if (!segment) return [];
|
|
9
|
+
if (segment.includes("-")) {
|
|
10
|
+
const [rawStart, rawEnd] = segment.split("-").map(s => s.trim());
|
|
11
|
+
const start = Number.parseInt(rawStart, 10);
|
|
12
|
+
const end = Number.parseInt(rawEnd, 10);
|
|
13
|
+
if (!Number.isFinite(start) || !Number.isFinite(end)) return [];
|
|
14
|
+
if (start < 1 || end < 1) return [];
|
|
15
|
+
const [lo, hi] = start <= end ? [start, end] : [end, start];
|
|
16
|
+
const range = [];
|
|
17
|
+
for (let i = lo; i <= hi; i++) range.push(i);
|
|
18
|
+
return range;
|
|
19
|
+
}
|
|
20
|
+
const single = Number.parseInt(segment, 10);
|
|
21
|
+
return Number.isFinite(single) && single >= 1 ? [single] : [];
|
|
22
|
+
}
|
|
7
23
|
function parseHighlightLines(input) {
|
|
8
24
|
if (input == null) return [];
|
|
9
25
|
if (Array.isArray(input)) {
|
|
@@ -15,20 +31,7 @@ function parseHighlightLines(input) {
|
|
|
15
31
|
if (!trimmed) return [];
|
|
16
32
|
const out = /* @__PURE__ */new Set();
|
|
17
33
|
for (const rawSegment of trimmed.split(",")) {
|
|
18
|
-
const
|
|
19
|
-
if (!segment) continue;
|
|
20
|
-
if (segment.includes("-")) {
|
|
21
|
-
const [rawStart, rawEnd] = segment.split("-").map(s => s.trim());
|
|
22
|
-
const start = Number.parseInt(rawStart, 10);
|
|
23
|
-
const end = Number.parseInt(rawEnd, 10);
|
|
24
|
-
if (!Number.isFinite(start) || !Number.isFinite(end)) continue;
|
|
25
|
-
if (start < 1 || end < 1) continue;
|
|
26
|
-
const [lo, hi] = start <= end ? [start, end] : [end, start];
|
|
27
|
-
for (let i = lo; i <= hi; i++) out.add(i);
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
const single = Number.parseInt(segment, 10);
|
|
31
|
-
if (Number.isFinite(single) && single >= 1) out.add(single);
|
|
34
|
+
for (const line of parseSegment(rawSegment.trim())) out.add(line);
|
|
32
35
|
}
|
|
33
36
|
return Array.from(out).sort((a, b) => a - b);
|
|
34
37
|
}
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
function parseSegment(segment) {
|
|
2
|
+
if (!segment) return [];
|
|
3
|
+
if (segment.includes("-")) {
|
|
4
|
+
const [rawStart, rawEnd] = segment.split("-").map((s) => s.trim());
|
|
5
|
+
const start = Number.parseInt(rawStart, 10);
|
|
6
|
+
const end = Number.parseInt(rawEnd, 10);
|
|
7
|
+
if (!Number.isFinite(start) || !Number.isFinite(end)) return [];
|
|
8
|
+
if (start < 1 || end < 1) return [];
|
|
9
|
+
const [lo, hi] = start <= end ? [start, end] : [end, start];
|
|
10
|
+
const range = [];
|
|
11
|
+
for (let i = lo; i <= hi; i++) range.push(i);
|
|
12
|
+
return range;
|
|
13
|
+
}
|
|
14
|
+
const single = Number.parseInt(segment, 10);
|
|
15
|
+
return Number.isFinite(single) && single >= 1 ? [single] : [];
|
|
16
|
+
}
|
|
1
17
|
export function parseHighlightLines(input) {
|
|
2
18
|
if (input == null) return [];
|
|
3
19
|
if (Array.isArray(input)) {
|
|
@@ -9,20 +25,7 @@ export function parseHighlightLines(input) {
|
|
|
9
25
|
if (!trimmed) return [];
|
|
10
26
|
const out = /* @__PURE__ */ new Set();
|
|
11
27
|
for (const rawSegment of trimmed.split(",")) {
|
|
12
|
-
const
|
|
13
|
-
if (!segment) continue;
|
|
14
|
-
if (segment.includes("-")) {
|
|
15
|
-
const [rawStart, rawEnd] = segment.split("-").map((s) => s.trim());
|
|
16
|
-
const start = Number.parseInt(rawStart, 10);
|
|
17
|
-
const end = Number.parseInt(rawEnd, 10);
|
|
18
|
-
if (!Number.isFinite(start) || !Number.isFinite(end)) continue;
|
|
19
|
-
if (start < 1 || end < 1) continue;
|
|
20
|
-
const [lo, hi] = start <= end ? [start, end] : [end, start];
|
|
21
|
-
for (let i = lo; i <= hi; i++) out.add(i);
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
const single = Number.parseInt(segment, 10);
|
|
25
|
-
if (Number.isFinite(single) && single >= 1) out.add(single);
|
|
28
|
+
for (const line of parseSegment(rawSegment.trim())) out.add(line);
|
|
26
29
|
}
|
|
27
30
|
return Array.from(out).sort((a, b) => a - b);
|
|
28
31
|
}
|
|
@@ -20,8 +20,7 @@ const isSubsequence = (query, haystack) => {
|
|
|
20
20
|
}
|
|
21
21
|
return false;
|
|
22
22
|
};
|
|
23
|
-
const
|
|
24
|
-
if (query.length === 0) return 0;
|
|
23
|
+
const longestConsecutiveRun = (query, haystack) => {
|
|
25
24
|
let qi = 0;
|
|
26
25
|
let consecutive = 0;
|
|
27
26
|
let bestConsecutive = 0;
|
|
@@ -39,15 +38,20 @@ const scoreOne = (query, label, haystack) => {
|
|
|
39
38
|
if (qi === query.length) break;
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
|
-
|
|
41
|
+
return bestConsecutive;
|
|
42
|
+
};
|
|
43
|
+
const labelBonus = (query, label) => {
|
|
43
44
|
const firstLabelHit = label.indexOf(query.charAt(0));
|
|
44
|
-
if (firstLabelHit
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
45
|
+
if (firstLabelHit === -1) return 0;
|
|
46
|
+
let bonus = Math.max(0, SCORE_FIRST_LABEL_POS - firstLabelHit);
|
|
47
|
+
if (label.startsWith(query)) {
|
|
48
|
+
bonus += SCORE_LABEL_PREFIX;
|
|
49
49
|
}
|
|
50
|
-
return
|
|
50
|
+
return bonus;
|
|
51
|
+
};
|
|
52
|
+
const scoreOne = (query, label, haystack) => {
|
|
53
|
+
if (query.length === 0) return 0;
|
|
54
|
+
return longestConsecutiveRun(query, haystack) * SCORE_CONSECUTIVE + labelBonus(query, label);
|
|
51
55
|
};
|
|
52
56
|
function fuzzyMatch(items, query, getHaystack) {
|
|
53
57
|
const q = lower(query.trim());
|
|
@@ -14,8 +14,7 @@ const isSubsequence = (query, haystack) => {
|
|
|
14
14
|
}
|
|
15
15
|
return false;
|
|
16
16
|
};
|
|
17
|
-
const
|
|
18
|
-
if (query.length === 0) return 0;
|
|
17
|
+
const longestConsecutiveRun = (query, haystack) => {
|
|
19
18
|
let qi = 0;
|
|
20
19
|
let consecutive = 0;
|
|
21
20
|
let bestConsecutive = 0;
|
|
@@ -33,15 +32,20 @@ const scoreOne = (query, label, haystack) => {
|
|
|
33
32
|
if (qi === query.length) break;
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
|
-
|
|
35
|
+
return bestConsecutive;
|
|
36
|
+
};
|
|
37
|
+
const labelBonus = (query, label) => {
|
|
37
38
|
const firstLabelHit = label.indexOf(query.charAt(0));
|
|
38
|
-
if (firstLabelHit
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
39
|
+
if (firstLabelHit === -1) return 0;
|
|
40
|
+
let bonus = Math.max(0, SCORE_FIRST_LABEL_POS - firstLabelHit);
|
|
41
|
+
if (label.startsWith(query)) {
|
|
42
|
+
bonus += SCORE_LABEL_PREFIX;
|
|
43
43
|
}
|
|
44
|
-
return
|
|
44
|
+
return bonus;
|
|
45
|
+
};
|
|
46
|
+
const scoreOne = (query, label, haystack) => {
|
|
47
|
+
if (query.length === 0) return 0;
|
|
48
|
+
return longestConsecutiveRun(query, haystack) * SCORE_CONSECUTIVE + labelBonus(query, label);
|
|
45
49
|
};
|
|
46
50
|
export function fuzzyMatch(items, query, getHaystack) {
|
|
47
51
|
const q = lower(query.trim());
|