@akcelik/strct 4.2.1 → 4.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akcelik/strct",
3
- "version": "4.2.1",
3
+ "version": "4.4.0",
4
4
  "description": "UIStruct — a standalone Angular component library with a tokenised, multi-palette theme system, built for datacenter / infrastructure management UIs.",
5
5
  "author": "Serkan Akcelik <serkan.akcelik@gmail.com>",
6
6
  "license": "MIT",
@@ -1021,6 +1021,16 @@ interface StrctTreeNodeData {
1021
1021
  }
1022
1022
  /** Per-node menu resolver for the data-driven tree — returns the items for one node. */
1023
1023
  type StrctTreeNodeMenuFn = (node: StrctTreeNodeData) => StrctMenuItem[];
1024
+ /** Payload of (nodeDrop): the dragged node and the node it was dropped on. */
1025
+ interface StrctTreeDropEvent {
1026
+ source: StrctTreeNodeData;
1027
+ target: StrctTreeNodeData;
1028
+ /**
1029
+ * Where the drop landed. Only `'into'` today — the field exists so
1030
+ * before/after reordering can be added without changing the event's shape.
1031
+ */
1032
+ position: 'into';
1033
+ }
1024
1034
  /** Payload of (nodeMenuSelect). */
1025
1035
  interface StrctTreeMenuEvent {
1026
1036
  node: StrctTreeNodeData;
@@ -1057,6 +1067,16 @@ declare class StrctTreeNode {
1057
1067
  readonly nodeActivated: _angular_core.OutputEmitterRef<StrctTreeNodeData>;
1058
1068
  /** Data-mode right-click menu selection (bubbles to the tree). */
1059
1069
  readonly nodeMenuSelect: _angular_core.OutputEmitterRef<StrctTreeMenuEvent>;
1070
+ /** Whether this row can be picked up — the tree asks the consumer's `canDrag`.
1071
+ * Reads `nodes()` too, so a refresh that makes a node movable is honoured. */
1072
+ protected readonly isDraggable: _angular_core.Signal<boolean>;
1073
+ protected readonly isDragSource: _angular_core.Signal<boolean>;
1074
+ protected readonly isDropTarget: _angular_core.Signal<boolean>;
1075
+ protected onDragStart(event: DragEvent): void;
1076
+ protected onDragEnd(): void;
1077
+ protected onDragOver(event: DragEvent): void;
1078
+ protected onDragLeave(): void;
1079
+ protected onDrop(event: DragEvent): void;
1060
1080
  /** Right-click menu items for this node ([] when no resolver / not data mode). */
1061
1081
  protected readonly menuItems: _angular_core.Signal<StrctMenuItem[]>;
1062
1082
  /** The owning `<strct-tree>` (null only for standalone nodes outside a tree). */
@@ -1125,6 +1145,26 @@ declare class StrctTree {
1125
1145
  readonly density: _angular_core.InputSignal<"compact" | "comfortable">;
1126
1146
  /** Per-node right-click menu resolver. */
1127
1147
  readonly nodeMenu: _angular_core.InputSignal<StrctTreeNodeMenuFn | null>;
1148
+ /**
1149
+ * Which nodes can be picked up. Default: none, so a tree without this input
1150
+ * behaves exactly as before. Asked again whenever `nodes` changes, because
1151
+ * a refresh can make a node movable.
1152
+ */
1153
+ readonly canDrag: _angular_core.InputSignal<((node: StrctTreeNodeData) => boolean) | null>;
1154
+ /**
1155
+ * Where the dragged node may land, asked during `dragover`. A browser does
1156
+ * not let `dragover` read the drag's data, so the tree keeps the source node
1157
+ * and hands it to you here. Without this input nothing accepts a drop — the
1158
+ * gesture belongs to the tree, the rule belongs to you.
1159
+ *
1160
+ * Two rules are built in whatever this returns: a node is never dropped on
1161
+ * itself, and never into its own subtree (that would be a cycle).
1162
+ */
1163
+ readonly canDrop: _angular_core.InputSignal<((source: StrctTreeNodeData, target: StrctTreeNodeData) => boolean) | null>;
1164
+ /** How long a collapsed node must be hovered mid-drag before it expands (ms). */
1165
+ readonly dragExpandDelay: _angular_core.InputSignal<number>;
1166
+ /** Emitted for an accepted drop only. */
1167
+ readonly nodeDrop: _angular_core.OutputEmitterRef<StrctTreeDropEvent>;
1128
1168
  /** Accessible label of each node's chevron toggle; receives the expanded state and the node label. */
1129
1169
  readonly chevronAriaLabel: _angular_core.InputSignal<(expanded: boolean, label: string) => string>;
1130
1170
  /** Emitted when any data-driven node is clicked. */
@@ -1186,10 +1226,43 @@ declare class StrctTree {
1186
1226
  * different characters accumulate into a search string (reset after a pause).
1187
1227
  */
1188
1228
  typeahead(from: StrctTreeNode, key: string): void;
1229
+ private readonly announcer;
1230
+ private readonly hostEl;
1231
+ private readonly dragSourceNode;
1232
+ private readonly dropTargetNode;
1233
+ /** Pending hover-expand for a collapsed target. */
1234
+ private expandTimer;
1235
+ private expandTimerKey;
1236
+ /** Edge auto-scroll while a drag is in flight. */
1237
+ private scrollFrame;
1238
+ private scrollStep;
1239
+ canDragNode(node: StrctTreeNodeData): boolean;
1240
+ isDragSource(node: StrctTreeNodeData): boolean;
1241
+ isDropTarget(node: StrctTreeNodeData): boolean;
1242
+ /** Whether the current drag may land on `target`: the built-in guards first,
1243
+ * then the consumer's rule. */
1244
+ acceptsDrop(target: StrctTreeNodeData): boolean;
1245
+ /** Whether `node` is somewhere inside `root`'s subtree. */
1246
+ private containsNode;
1247
+ beginDrag(node: StrctTreeNodeData): void;
1248
+ /** Called from every `dragover` on a row: highlight, hover-expand, scroll. */
1249
+ dragOver(target: StrctTreeNodeData, clientY: number): void;
1250
+ dragLeave(target: StrctTreeNodeData): void;
1251
+ dropOn(target: StrctTreeNodeData): void;
1252
+ /** Always runs, including when the drop lands outside the tree (dragend). */
1253
+ endDrag(): void;
1254
+ /** A collapsed node hovered long enough opens, so a target that is not yet
1255
+ * visible can be reached at all — the normal case in a big inventory. */
1256
+ private scheduleHoverExpand;
1257
+ private clearExpandTimer;
1258
+ /** Nearest scrolling ancestor, so a long tree can be traversed mid-drag. */
1259
+ private scrollParent;
1260
+ private edgeScroll;
1261
+ private stopEdgeScroll;
1189
1262
  /** Toggle a node's expansion, updating state and emitting outputs. */
1190
1263
  toggleNode(node: StrctTreeNodeData): void;
1191
1264
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<StrctTree, never>;
1192
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<StrctTree, "strct-tree", never, { "nodes": { "alias": "nodes"; "required": false; "isSignal": true; }; "density": { "alias": "density"; "required": false; "isSignal": true; }; "nodeMenu": { "alias": "nodeMenu"; "required": false; "isSignal": true; }; "chevronAriaLabel": { "alias": "chevronAriaLabel"; "required": false; "isSignal": true; }; "expandedIds": { "alias": "expandedIds"; "required": false; "isSignal": true; }; }, { "nodeActivated": "nodeActivated"; "nodeMenuSelect": "nodeMenuSelect"; "expandedIds": "expandedIdsChange"; "expandedChange": "expandedChange"; "nodeToggled": "nodeToggled"; }, ["projectedNodes"], ["*"], true, never>;
1265
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<StrctTree, "strct-tree", never, { "nodes": { "alias": "nodes"; "required": false; "isSignal": true; }; "density": { "alias": "density"; "required": false; "isSignal": true; }; "nodeMenu": { "alias": "nodeMenu"; "required": false; "isSignal": true; }; "canDrag": { "alias": "canDrag"; "required": false; "isSignal": true; }; "canDrop": { "alias": "canDrop"; "required": false; "isSignal": true; }; "dragExpandDelay": { "alias": "dragExpandDelay"; "required": false; "isSignal": true; }; "chevronAriaLabel": { "alias": "chevronAriaLabel"; "required": false; "isSignal": true; }; "expandedIds": { "alias": "expandedIds"; "required": false; "isSignal": true; }; }, { "nodeDrop": "nodeDrop"; "nodeActivated": "nodeActivated"; "nodeMenuSelect": "nodeMenuSelect"; "expandedIds": "expandedIdsChange"; "expandedChange": "expandedChange"; "nodeToggled": "nodeToggled"; }, ["projectedNodes"], ["*"], true, never>;
1193
1266
  }
1194
1267
 
1195
1268
  /** Fixed modal width presets: sm 480 · md 640 · lg 860 · xl 1080 (px). */
@@ -5811,6 +5884,30 @@ declare class StrctHeatmap {
5811
5884
  readonly cols: _angular_core.InputSignal<string[] | null>;
5812
5885
  /** Scale ceiling — the value that maps to full intensity. Auto (data max) when null. */
5813
5886
  readonly max: _angular_core.InputSignal<number | null>;
5887
+ /**
5888
+ * Label every n-th column (1 = every column, today's behaviour). 24 hourly
5889
+ * columns in a narrow card cannot all carry a readable label; labelling every
5890
+ * third keeps "14:00" legible instead of forcing it down to "14".
5891
+ */
5892
+ readonly colLabelEvery: _angular_core.InputSignal<number>;
5893
+ /**
5894
+ * Column label text, so a column can be keyed by an ISO time and shown as
5895
+ * "14:00". Return '' to drop a label. Applied after `colLabelEvery`.
5896
+ */
5897
+ readonly colLabel: _angular_core.InputSignal<((col: string, index: number) => string) | null>;
5898
+ /**
5899
+ * Cell tooltip text. Without it a cell reads `row × col: value`, which for a
5900
+ * utilisation grid has no unit — `hv-05 · 14:00 — 47% CPU` is the readable form.
5901
+ */
5902
+ readonly valueFormat: _angular_core.InputSignal<((value: number, row: string, col: string) => string) | null>;
5903
+ /**
5904
+ * Colour by band instead of one hue: `status` (accent by default) below
5905
+ * `warning`, the warning hue from there, the critical hue from `critical`.
5906
+ * Intensity is scaled by the value's position WITHIN its band, so a 96% cell
5907
+ * reads darker than an 81% one and both read as critical/warning at a glance.
5908
+ * Unset: today's single-hue ramp across the whole range.
5909
+ */
5910
+ readonly thresholds: _angular_core.InputSignal<StrctThresholds | null>;
5814
5911
  /** Base color of the intensity ramp. */
5815
5912
  readonly status: _angular_core.InputSignal<StrctChartStatus>;
5816
5913
  /** Shown when there is no data (localizable). */
@@ -5846,16 +5943,23 @@ declare class StrctHeatmap {
5846
5943
  protected readonly cells: _angular_core.Signal<CellRender[]>;
5847
5944
  protected readonly rowLabels: _angular_core.Signal<LabelRender[]>;
5848
5945
  protected readonly colLabels: _angular_core.Signal<LabelRender[]>;
5946
+ private tipFor;
5849
5947
  /** Screen-reader summary of the whole grid (role="img" name). */
5850
5948
  protected readonly aria: _angular_core.Signal<string>;
5851
5949
  /**
5852
5950
  * Intensity ramp: 8% of the status hue for the smallest non-zero value up
5853
5951
  * to 100% at the ceiling; zero stays on the empty-cell surface.
5952
+ *
5953
+ * With `thresholds`, the hue comes from the value's band and the intensity
5954
+ * from its position inside that band, floored at 45% — a band has to be
5955
+ * recognisable as itself, and a pale cell must not read as "no data".
5854
5956
  */
5855
5957
  private fillFor;
5958
+ /** The band a value falls in: its hue and the range intensity scales over. */
5959
+ private bandFor;
5856
5960
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<StrctHeatmap, never>;
5857
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<StrctHeatmap, "strct-heatmap", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "rows": { "alias": "rows"; "required": false; "isSignal": true; }; "cols": { "alias": "cols"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "status": { "alias": "status"; "required": false; "isSignal": true; }; "emptyText": { "alias": "emptyText"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "summaryFormat": { "alias": "summaryFormat"; "required": false; "isSignal": true; }; "cellHeight": { "alias": "cellHeight"; "required": false; "isSignal": true; }; "gap": { "alias": "gap"; "required": false; "isSignal": true; }; "rowLabelWidth": { "alias": "rowLabelWidth"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
5961
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<StrctHeatmap, "strct-heatmap", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "rows": { "alias": "rows"; "required": false; "isSignal": true; }; "cols": { "alias": "cols"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "colLabelEvery": { "alias": "colLabelEvery"; "required": false; "isSignal": true; }; "colLabel": { "alias": "colLabel"; "required": false; "isSignal": true; }; "valueFormat": { "alias": "valueFormat"; "required": false; "isSignal": true; }; "thresholds": { "alias": "thresholds"; "required": false; "isSignal": true; }; "status": { "alias": "status"; "required": false; "isSignal": true; }; "emptyText": { "alias": "emptyText"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "summaryFormat": { "alias": "summaryFormat"; "required": false; "isSignal": true; }; "cellHeight": { "alias": "cellHeight"; "required": false; "isSignal": true; }; "gap": { "alias": "gap"; "required": false; "isSignal": true; }; "rowLabelWidth": { "alias": "rowLabelWidth"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
5858
5962
  }
5859
5963
 
5860
5964
  export { FOCUSABLE_SELECTOR, STRCT_DP_DOW, STRCT_DP_DOW_FULL, STRCT_DP_MONTHS, STRCT_ICONS, STRCT_ICON_GROUPS, STRCT_ICON_NAMES, STRCT_MASKS, STRCT_NOTIFICATION_HISTORY_LIMIT, STRCT_PALETTES, STRCT_RAW_ICONS, STRCT_TIME_RANGE_PRESETS, STRCT_WIZARD_DEFAULTS, StrctAccordion, StrctAccordionPanel, StrctAlert, StrctAnnouncer, StrctAvatar, StrctBadge, StrctBreadcrumb, StrctBreadcrumbItem, StrctButton, StrctButtonGroup, StrctBytesPipe, StrctCard, StrctCardBlock, StrctCardFooter, StrctCardHeader, StrctCascadeColumn, StrctCascadeHost, StrctCascadeSelect, StrctCellDef, StrctCellStatus, StrctChart, StrctCheckbox, StrctChips, StrctCode, StrctColorPicker, StrctCombobox, StrctCommandPalette, StrctConfirmOutlet, StrctConfirmService, StrctContextMenu, StrctContextMenuTrigger, StrctCopy, StrctDatagrid, StrctDatagridActionBar, StrctDatepicker, StrctDatetimePicker, StrctDesc, StrctDescriptionList, StrctDiff, StrctDivider, StrctDonut, StrctDrawer, StrctDrawerFooter, StrctDropdown, StrctDropdownDivider, StrctDropdownItem, StrctDropdownTrigger, StrctDurationPipe, StrctEmptyState, StrctField, StrctFile, StrctFilterBar, StrctFlow, StrctFooter, StrctGauge, StrctHeader, StrctHeatmap, StrctHero, StrctHotkeysHelp, StrctHotkeysService, StrctIcon, StrctInlineEdit, StrctInput, StrctInputMask, StrctInputOtp, StrctKbd, StrctKnob, StrctLogViewer, StrctLogin, StrctMenuPanel, StrctMenuService, StrctMenubar, StrctMetricTile, StrctModal, StrctModalContent, StrctNav, StrctNavItem, StrctNotificationCenter, StrctNumber, StrctOverlay, StrctPageHeader, StrctPageHeaderActions, StrctPageHeaderCrumbs, StrctPagination, StrctPassword, StrctPopover, StrctPopoverTrigger, StrctProgress, StrctRadio, StrctRadioGroup, StrctRail, StrctRange, StrctRatePipe, StrctRating, StrctReorder, StrctReorderItem, StrctRowDetailDef, StrctSearchbox, StrctSectionMenu, StrctSegmented, StrctSelect, StrctShell, StrctShellService, StrctSiPipe, StrctSignpost, StrctSignpostTrigger, StrctSkeleton, StrctSparkline, StrctSpeedDial, StrctSpinner, StrctSplitButton, StrctSplitter, StrctStack, StrctStackItem, StrctStatusDot, StrctStep, StrctSubmenu, StrctTab, StrctTable, StrctTabs, StrctTag, StrctThemeService, StrctThemeSwitcher, StrctTimeRangePicker, StrctTimeline, StrctTimelineItem, StrctToastOutlet, StrctToastService, StrctToggle, StrctToolbar, StrctToolbarSpacer, StrctTooltip, StrctTour, StrctTransfer, StrctTree, StrctTreeNode, StrctTreeSelect, StrctVerticalNav, StrctWatermark, StrctWizard, StrctWizardAside, focusFirstIn, keepTabInside, lockBodyScroll, parseAnsi, provideStrctWizardDefaults, registerStrctIcon, restoreFocus, saveFocusedElement, strctComputeDiff, strctDpPad, strctFormatBytes, strctFormatDuration, strctFormatRate, strctFormatSi, strctValidationIcon, strctValidationTone, unlockBodyScroll };
5861
- export type { StrctAlertType, StrctAvatarSize, StrctAvatarStatus, StrctBadgeStatus, StrctButtonSize, StrctButtonVariant, StrctCascadeOption, StrctCellContext, StrctChartAnnotation, StrctChartColor, StrctChartCurve, StrctChartSeries, StrctChartSlot, StrctChartStatus, StrctChartSummaryInfo, StrctChartThreshold, StrctChartType, StrctColumn, StrctCommandItem, StrctConfirmOptions, StrctConfirmTone, StrctDatagridColumn, StrctDatagridColumnState, StrctDatagridFilters, StrctDatagridLabels, StrctDatagridLazyState, StrctDescAlign, StrctDescItem, StrctDiffRow, StrctDonutSegment, StrctDrawerSide, StrctDrawerSize, StrctEmptyVariant, StrctFilterChip, StrctFlowDirection, StrctFlowNode, StrctFlowOrientation, StrctHeatmapCell, StrctHeatmapSummaryInfo, StrctHotkey, StrctIconBadge, StrctIconName, StrctKnobStatus, StrctLogLine, StrctMenuItem, StrctMenuLink, StrctMenuOpenOptions, StrctMenuSection, StrctMenubarItem, StrctMetricStatus, StrctModalSize, StrctMode, StrctNotification, StrctOption, StrctOverlayPlacement, StrctPalette, StrctPaletteInfo, StrctProgressStatus, StrctRailItem, StrctRailStatus, StrctReorderEvent, StrctRow, StrctRowId, StrctSegmentedOption, StrctSegmentedSize, StrctSignpostPosition, StrctSpeedDialDirection, StrctSpinnerSize, StrctStatus, StrctStatusDotSize, StrctTagStatus, StrctThresholds, StrctTimeRange, StrctTimeRangePreset, StrctTimelineState, StrctToast, StrctToastOptions, StrctToastType, StrctTooltipPosition, StrctTourStep, StrctTransferItem, StrctTreeMenuEvent, StrctTreeNodeData, StrctTreeNodeMenuFn, StrctValidationState, StrctValidationStatus, StrctWizardDefaults };
5965
+ export type { StrctAlertType, StrctAvatarSize, StrctAvatarStatus, StrctBadgeStatus, StrctButtonSize, StrctButtonVariant, StrctCascadeOption, StrctCellContext, StrctChartAnnotation, StrctChartColor, StrctChartCurve, StrctChartSeries, StrctChartSlot, StrctChartStatus, StrctChartSummaryInfo, StrctChartThreshold, StrctChartType, StrctColumn, StrctCommandItem, StrctConfirmOptions, StrctConfirmTone, StrctDatagridColumn, StrctDatagridColumnState, StrctDatagridFilters, StrctDatagridLabels, StrctDatagridLazyState, StrctDescAlign, StrctDescItem, StrctDiffRow, StrctDonutSegment, StrctDrawerSide, StrctDrawerSize, StrctEmptyVariant, StrctFilterChip, StrctFlowDirection, StrctFlowNode, StrctFlowOrientation, StrctHeatmapCell, StrctHeatmapSummaryInfo, StrctHotkey, StrctIconBadge, StrctIconName, StrctKnobStatus, StrctLogLine, StrctMenuItem, StrctMenuLink, StrctMenuOpenOptions, StrctMenuSection, StrctMenubarItem, StrctMetricStatus, StrctModalSize, StrctMode, StrctNotification, StrctOption, StrctOverlayPlacement, StrctPalette, StrctPaletteInfo, StrctProgressStatus, StrctRailItem, StrctRailStatus, StrctReorderEvent, StrctRow, StrctRowId, StrctSegmentedOption, StrctSegmentedSize, StrctSignpostPosition, StrctSpeedDialDirection, StrctSpinnerSize, StrctStatus, StrctStatusDotSize, StrctTagStatus, StrctThresholds, StrctTimeRange, StrctTimeRangePreset, StrctTimelineState, StrctToast, StrctToastOptions, StrctToastType, StrctTooltipPosition, StrctTourStep, StrctTransferItem, StrctTreeDropEvent, StrctTreeMenuEvent, StrctTreeNodeData, StrctTreeNodeMenuFn, StrctValidationState, StrctValidationStatus, StrctWizardDefaults };