@akcelik/strct 4.3.0 → 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.3.0",
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). */
@@ -5889,4 +5962,4 @@ declare class StrctHeatmap {
5889
5962
  }
5890
5963
 
5891
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 };
5892
- 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 };