gridstack 12.4.0 → 12.4.1

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.
Files changed (96) hide show
  1. package/dist/angular/esm2020/lib/base-widget.mjs +2 -2
  2. package/dist/angular/esm2020/lib/gridstack-item.component.mjs +2 -2
  3. package/dist/angular/esm2020/lib/gridstack.component.mjs +2 -2
  4. package/dist/angular/esm2020/lib/gridstack.module.mjs +2 -2
  5. package/dist/angular/esm2020/lib/types.mjs +2 -2
  6. package/dist/angular/fesm2015/gridstack-angular.mjs +4 -4
  7. package/dist/angular/fesm2015/gridstack-angular.mjs.map +1 -1
  8. package/dist/angular/fesm2020/gridstack-angular.mjs +5 -5
  9. package/dist/angular/fesm2020/gridstack-angular.mjs.map +1 -1
  10. package/dist/angular/lib/gridstack-item.component.d.ts +1 -1
  11. package/dist/angular/lib/gridstack.component.d.ts +1 -1
  12. package/dist/angular/lib/types.d.ts +1 -1
  13. package/dist/angular/package.json +1 -1
  14. package/dist/angular/src/base-widget.ts +1 -1
  15. package/dist/angular/src/gridstack-item.component.ts +1 -1
  16. package/dist/angular/src/gridstack.component.ts +1 -1
  17. package/dist/angular/src/gridstack.module.ts +1 -1
  18. package/dist/angular/src/types.ts +1 -1
  19. package/dist/{src/dd-base-impl.d.ts → dd-base-impl.d.ts} +1 -1
  20. package/dist/{src/dd-base-impl.js → dd-base-impl.js} +1 -1
  21. package/dist/dd-base-impl.js.map +1 -0
  22. package/dist/{src/dd-draggable.d.ts → dd-draggable.d.ts} +1 -1
  23. package/dist/{src/dd-draggable.js → dd-draggable.js} +1 -1
  24. package/dist/dd-draggable.js.map +1 -0
  25. package/dist/{src/dd-droppable.d.ts → dd-droppable.d.ts} +1 -1
  26. package/dist/{src/dd-droppable.js → dd-droppable.js} +1 -1
  27. package/dist/dd-droppable.js.map +1 -0
  28. package/dist/{src/dd-element.d.ts → dd-element.d.ts} +1 -1
  29. package/dist/{src/dd-element.js → dd-element.js} +1 -1
  30. package/dist/dd-element.js.map +1 -0
  31. package/dist/{src/dd-gridstack.d.ts → dd-gridstack.d.ts} +1 -1
  32. package/dist/{src/dd-gridstack.js → dd-gridstack.js} +1 -1
  33. package/dist/dd-gridstack.js.map +1 -0
  34. package/dist/{src/dd-manager.d.ts → dd-manager.d.ts} +1 -1
  35. package/dist/{src/dd-manager.js → dd-manager.js} +1 -1
  36. package/dist/dd-manager.js.map +1 -0
  37. package/dist/{src/dd-resizable-handle.d.ts → dd-resizable-handle.d.ts} +1 -1
  38. package/dist/{src/dd-resizable-handle.js → dd-resizable-handle.js} +1 -1
  39. package/dist/dd-resizable-handle.js.map +1 -0
  40. package/dist/{src/dd-resizable.d.ts → dd-resizable.d.ts} +1 -1
  41. package/dist/{src/dd-resizable.js → dd-resizable.js} +1 -1
  42. package/dist/dd-resizable.js.map +1 -0
  43. package/dist/{src/dd-touch.d.ts → dd-touch.d.ts} +1 -1
  44. package/dist/{src/dd-touch.js → dd-touch.js} +1 -1
  45. package/dist/dd-touch.js.map +1 -0
  46. package/dist/gridstack-all.js +1 -1
  47. package/dist/gridstack-all.js.LICENSE.txt +1 -1
  48. package/dist/gridstack-all.js.map +1 -1
  49. package/dist/{src/gridstack-engine.d.ts → gridstack-engine.d.ts} +1 -1
  50. package/dist/{src/gridstack-engine.js → gridstack-engine.js} +1 -1
  51. package/dist/gridstack-engine.js.map +1 -0
  52. package/dist/gridstack.css +1 -1
  53. package/dist/{src/gridstack.d.ts → gridstack.d.ts} +1 -1
  54. package/dist/{src/gridstack.js → gridstack.js} +2 -2
  55. package/dist/gridstack.js.map +1 -0
  56. package/dist/{src/types.d.ts → types.d.ts} +1 -1
  57. package/dist/{src/types.js → types.js} +1 -1
  58. package/dist/types.js.map +1 -0
  59. package/dist/utils.d.ts +283 -0
  60. package/dist/{src/utils.js → utils.js} +39 -39
  61. package/dist/utils.js.map +1 -0
  62. package/doc/API.md +1 -1
  63. package/package.json +1 -1
  64. package/dist/angular/projects/lib/src/index.d.ts +0 -5
  65. package/dist/angular/projects/lib/src/index.js +0 -9
  66. package/dist/angular/projects/lib/src/index.js.map +0 -1
  67. package/dist/angular/projects/lib/src/lib/base-widget.d.ts +0 -56
  68. package/dist/angular/projects/lib/src/lib/base-widget.js +0 -94
  69. package/dist/angular/projects/lib/src/lib/base-widget.js.map +0 -1
  70. package/dist/angular/projects/lib/src/lib/gridstack-item.component.d.ts +0 -76
  71. package/dist/angular/projects/lib/src/lib/gridstack-item.component.js +0 -112
  72. package/dist/angular/projects/lib/src/lib/gridstack-item.component.js.map +0 -1
  73. package/dist/angular/projects/lib/src/lib/gridstack.component.d.ts +0 -233
  74. package/dist/angular/projects/lib/src/lib/gridstack.component.js +0 -457
  75. package/dist/angular/projects/lib/src/lib/gridstack.component.js.map +0 -1
  76. package/dist/angular/projects/lib/src/lib/gridstack.module.d.ts +0 -29
  77. package/dist/angular/projects/lib/src/lib/gridstack.module.js +0 -52
  78. package/dist/angular/projects/lib/src/lib/gridstack.module.js.map +0 -1
  79. package/dist/angular/projects/lib/src/lib/types.d.ts +0 -51
  80. package/dist/angular/projects/lib/src/lib/types.js +0 -6
  81. package/dist/angular/projects/lib/src/lib/types.js.map +0 -1
  82. package/dist/src/dd-base-impl.js.map +0 -1
  83. package/dist/src/dd-draggable.js.map +0 -1
  84. package/dist/src/dd-droppable.js.map +0 -1
  85. package/dist/src/dd-element.js.map +0 -1
  86. package/dist/src/dd-gridstack.js.map +0 -1
  87. package/dist/src/dd-manager.js.map +0 -1
  88. package/dist/src/dd-resizable-handle.js.map +0 -1
  89. package/dist/src/dd-resizable.js.map +0 -1
  90. package/dist/src/dd-touch.js.map +0 -1
  91. package/dist/src/gridstack-engine.js.map +0 -1
  92. package/dist/src/gridstack.js.map +0 -1
  93. package/dist/src/gridstack.scss +0 -157
  94. package/dist/src/types.js.map +0 -1
  95. package/dist/src/utils.d.ts +0 -14
  96. package/dist/src/utils.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAqB;IAC5C,sBAAsB,EAAE,QAAQ;IAChC,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,IAAI;IACV,UAAU,EAAE,MAAM;IAClB,kBAAkB,EAAE,GAAG;IACvB,cAAc,EAAE,IAAI;IACpB,MAAM,EAAE,EAAE;IACV,SAAS,EAAE,EAAE,MAAM,EAAE,0BAA0B,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE;IACjF,MAAM,EAAE,0BAA0B;IAClC,SAAS,EAAE,iBAAiB;IAC5B,MAAM,EAAE,EAAE;IACV,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,gBAAgB,EAAE,wBAAwB;IAC1C,eAAe,EAAE,EAAE;IACnB,gBAAgB,EAAE,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,0BAA0B,EAAC;IACnF,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC5B,GAAG,EAAE,MAAM;IAEX,kCAAkC;IAClC,sBAAsB;IACtB,wBAAwB;IACxB,gBAAgB;IAChB,qBAAqB;IACrB,oBAAoB;IACpB,qBAAqB;IACrB,WAAW;CACZ,CAAC","sourcesContent":["/**\r\n * types.ts 12.4.1\r\n * Copyright (c) 2021-2025 Alain Dumesny - see GridStack root license\r\n */\r\n\r\nimport { GridStack } from './gridstack';\r\nimport { GridStackEngine } from './gridstack-engine';\r\n\r\n/**\r\n * Default values for grid options - used during initialization and when saving out grid configuration.\r\n * These values are applied when options are not explicitly provided.\r\n */\r\nexport const gridDefaults: GridStackOptions = {\r\n alwaysShowResizeHandle: 'mobile',\r\n animate: true,\r\n auto: true,\r\n cellHeight: 'auto',\r\n cellHeightThrottle: 100,\r\n cellHeightUnit: 'px',\r\n column: 12,\r\n draggable: { handle: '.grid-stack-item-content', appendTo: 'body', scroll: true },\r\n handle: '.grid-stack-item-content',\r\n itemClass: 'grid-stack-item',\r\n margin: 10,\r\n marginUnit: 'px',\r\n maxRow: 0,\r\n minRow: 0,\r\n placeholderClass: 'grid-stack-placeholder',\r\n placeholderText: '',\r\n removableOptions: { accept: 'grid-stack-item', decline: 'grid-stack-non-removable'},\r\n resizable: { handles: 'se' },\r\n rtl: 'auto',\r\n\r\n // **** same as not being set ****\r\n // disableDrag: false,\r\n // disableResize: false,\r\n // float: false,\r\n // handleClass: null,\r\n // removable: false,\r\n // staticGrid: false,\r\n //removable\r\n};\r\n\r\n/**\r\n * Different layout options when changing the number of columns.\r\n *\r\n * These options control how widgets are repositioned when the grid column count changes.\r\n * Note: The new list may be partially filled if there's a cached layout for that size.\r\n *\r\n * Options:\r\n * - `'list'`: Treat items as a sorted list, keeping them sequentially without resizing (unless too big)\r\n * - `'compact'`: Similar to list, but uses compact() method to fill empty slots by reordering\r\n * - `'moveScale'`: Scale and move items by the ratio of newColumnCount / oldColumnCount\r\n * - `'move'`: Only move items, keep their sizes\r\n * - `'scale'`: Only scale items, keep their positions\r\n * - `'none'`: Leave items unchanged unless they don't fit in the new column count\r\n * - Custom function: Provide your own layout logic\r\n */\r\nexport type ColumnOptions = 'list' | 'compact' | 'moveScale' | 'move' | 'scale' | 'none' |\r\n ((column: number, oldColumn: number, nodes: GridStackNode[], oldNodes: GridStackNode[]) => void);\r\n/**\r\n * Options for the compact() method to reclaim empty space.\r\n * - `'list'`: Keep items in order, move them up sequentially\r\n * - `'compact'`: Find truly empty spaces, may reorder items for optimal fit\r\n */\r\nexport type CompactOptions = 'list' | 'compact';\r\n/**\r\n * Type representing values that can be either numbers or strings (e.g., dimensions with units).\r\n * Used for properties like width, height, margins that accept both numeric and string values.\r\n */\r\nexport type numberOrString = number | string;\r\n/**\r\n * Extended HTMLElement interface for grid items.\r\n * All grid item DOM elements implement this interface to provide access to their grid data.\r\n */\r\nexport interface GridItemHTMLElement extends HTMLElement {\r\n /** Pointer to the associated grid node instance containing position, size, and other widget data */\r\n gridstackNode?: GridStackNode;\r\n /** @internal Original node data (used for restoring during drag operations) */\r\n _gridstackNodeOrig?: GridStackNode;\r\n}\r\n\r\n/**\r\n * Type representing various ways to specify grid elements.\r\n * Can be a CSS selector string, GridItemHTMLElement (HTML element with GS variables when loaded).\r\n */\r\nexport type GridStackElement = string | GridItemHTMLElement;\r\n\r\n/**\r\n * Event handler function types for the .on() method.\r\n * Different handlers receive different parameters based on the event type.\r\n */\r\n\r\n/** General event handler that receives only the event */\r\nexport type GridStackEventHandler = (event: Event) => void;\r\n\r\n/** Element-specific event handler that receives event and affected element */\r\nexport type GridStackElementHandler = (event: Event, el: GridItemHTMLElement) => void;\r\n\r\n/** Node-based event handler that receives event and array of affected nodes */\r\nexport type GridStackNodesHandler = (event: Event, nodes: GridStackNode[]) => void;\r\n\r\n/** Drop event handler that receives previous and new node states */\r\nexport type GridStackDroppedHandler = (event: Event, previousNode: GridStackNode, newNode: GridStackNode) => void;\r\n\r\n/** Union type of all possible event handler types */\r\nexport type GridStackEventHandlerCallback = GridStackEventHandler | GridStackElementHandler | GridStackNodesHandler | GridStackDroppedHandler;\r\n\r\n/**\r\n * Optional callback function called during load() operations.\r\n * Allows custom handling of widget addition/removal for framework integration.\r\n *\r\n * @param parent - The parent HTML element\r\n * @param w - The widget definition\r\n * @param add - True if adding, false if removing\r\n * @param grid - True if this is a grid operation\r\n * @returns The created/modified HTML element, or undefined\r\n */\r\nexport type AddRemoveFcn = (parent: HTMLElement, w: GridStackWidget, add: boolean, grid: boolean) => HTMLElement | undefined;\r\n\r\n/**\r\n * Optional callback function called during save() operations.\r\n * Allows adding custom data to the saved widget structure.\r\n *\r\n * @param node - The internal grid node\r\n * @param w - The widget structure being saved (can be modified)\r\n */\r\nexport type SaveFcn = (node: GridStackNode, w: GridStackWidget) => void;\r\n\r\n/**\r\n * Optional callback function for custom widget content rendering.\r\n * Called during load()/addWidget() to create custom content beyond plain text.\r\n *\r\n * @param el - The widget's content container element\r\n * @param w - The widget definition with content and other properties\r\n */\r\nexport type RenderFcn = (el: HTMLElement, w: GridStackWidget) => void;\r\n\r\n/**\r\n * Optional callback function for custom resize-to-content behavior.\r\n * Called when a widget needs to resize to fit its content.\r\n *\r\n * @param el - The grid item element to resize\r\n */\r\nexport type ResizeToContentFcn = (el: GridItemHTMLElement) => void;\r\n\r\n/**\r\n * Configuration for responsive grid behavior.\r\n *\r\n * Defines how the grid responds to different screen sizes by changing column counts.\r\n * NOTE: Make sure to include the appropriate CSS (gridstack-extra.css) to support responsive behavior.\r\n */\r\nexport interface Responsive {\r\n /** wanted width to maintain (+-50%) to dynamically pick a column count. NOTE: make sure to have correct extra CSS to support this. */\r\n columnWidth?: number;\r\n /** maximum number of columns allowed (default: 12). NOTE: make sure to have correct extra CSS to support this. */\r\n columnMax?: number;\r\n /** explicit width:column breakpoints instead of automatic 'columnWidth'. NOTE: make sure to have correct extra CSS to support this. */\r\n breakpoints?: Breakpoint[];\r\n /** specify if breakpoints are for window size or grid size (default:false = grid) */\r\n breakpointForWindow?: boolean;\r\n /** global re-layout mode when changing columns */\r\n layout?: ColumnOptions;\r\n}\r\n\r\n/**\r\n * Defines a responsive breakpoint for automatic column count changes.\r\n * Used with the responsive.breakpoints option.\r\n */\r\nexport interface Breakpoint {\r\n /** Maximum width (in pixels) for this breakpoint to be active */\r\n w?: number;\r\n /** Number of columns to use when this breakpoint is active */\r\n c: number;\r\n /** Layout mode for this specific breakpoint (overrides global responsive.layout) */\r\n layout?: ColumnOptions;\r\n /** TODO: Future feature - specific children layout for this breakpoint */\r\n // children?: GridStackWidget[];\r\n}\r\n\r\n/**\r\n * Defines the options for a Grid\r\n */\r\nexport interface GridStackOptions {\r\n /**\r\n * Accept widgets dragged from other grids or from outside (default: `false`). Can be:\r\n * - `true`: will accept HTML elements having 'grid-stack-item' as class attribute\r\n * - `false`: will not accept any external widgets\r\n * - string: explicit class name to accept instead of default\r\n * - function: callback called before an item will be accepted when entering a grid\r\n *\r\n * @example\r\n * // Accept all grid items\r\n * acceptWidgets: true\r\n *\r\n * // Accept only items with specific class\r\n * acceptWidgets: 'my-draggable-item'\r\n *\r\n * // Custom validation function\r\n * acceptWidgets: (el) => {\r\n * return el.getAttribute('data-accept') === 'true';\r\n * }\r\n *\r\n * @see {@link http://gridstack.github.io/gridstack.js/demo/two.html} for complete example\r\n */\r\n acceptWidgets?: boolean | string | ((element: Element) => boolean);\r\n\r\n /** possible values (default: `mobile`) - does not apply to non-resizable widgets\r\n * `false` the resizing handles are only shown while hovering over a widget\r\n * `true` the resizing handles are always shown\r\n * 'mobile' if running on a mobile device, default to `true` (since there is no hovering per say), else `false`.\r\n See [example](http://gridstack.github.io/gridstack.js/demo/mobile.html) */\r\n alwaysShowResizeHandle?: true | false | 'mobile';\r\n\r\n /** turns animation on (default?: true) */\r\n animate?: boolean;\r\n\r\n /** if false gridstack will not initialize existing items (default?: true) */\r\n auto?: boolean;\r\n\r\n /**\r\n * One cell height (default: 'auto'). Can be:\r\n * - an integer (px): fixed pixel height\r\n * - a string (ex: '100px', '10em', '10rem'): CSS length value\r\n * - 0: library will not generate styles for rows (define your own CSS)\r\n * - 'auto': height calculated for square cells (width / column) and updated live on window resize\r\n * - 'initial': similar to 'auto' but stays fixed size during window resizing\r\n *\r\n * Note: % values don't work correctly - see demo/cell-height.html\r\n *\r\n * @example\r\n * // Fixed 100px height\r\n * cellHeight: 100\r\n *\r\n * // CSS units\r\n * cellHeight: '5rem'\r\n * cellHeight: '100px'\r\n *\r\n * // Auto-sizing for square cells\r\n * cellHeight: 'auto'\r\n *\r\n * // No CSS generation (custom styles)\r\n * cellHeight: 0\r\n */\r\n cellHeight?: numberOrString;\r\n\r\n /** throttle time delay (in ms) used when cellHeight='auto' to improve performance vs usability (default?: 100).\r\n * A value of 0 will make it instant at a cost of re-creating the CSS file at ever window resize event!\r\n * */\r\n cellHeightThrottle?: number;\r\n\r\n /** (internal) unit for cellHeight (default? 'px') which is set when a string cellHeight with a unit is passed (ex: '10rem') */\r\n cellHeightUnit?: string;\r\n\r\n /** list of children item to create when calling load() or addGrid() */\r\n children?: GridStackWidget[];\r\n\r\n /** number of columns (default?: 12). Note: IF you change this, CSS also have to change. See https://github.com/gridstack/gridstack.js#change-grid-columns.\r\n * Note: for nested grids, it is recommended to use 'auto' which will always match the container grid-item current width (in column) to keep inside and outside\r\n * items always the same. flag is NOT supported for regular non-nested grids.\r\n */\r\n column?: number | 'auto';\r\n\r\n /** responsive column layout for width:column behavior */\r\n columnOpts?: Responsive;\r\n\r\n /** additional class on top of '.grid-stack' (which is required for our CSS) to differentiate this instance.\r\n Note: only used by addGrid(), else your element should have the needed class */\r\n class?: string;\r\n\r\n /** disallows dragging of widgets (default?: false) */\r\n disableDrag?: boolean;\r\n\r\n /** disallows resizing of widgets (default?: false). */\r\n disableResize?: boolean;\r\n\r\n /** allows to override UI draggable options. (default?: { handle?: '.grid-stack-item-content', appendTo?: 'body' }) */\r\n draggable?: DDDragOpt;\r\n\r\n /** let user drag nested grid items out of a parent or not (default true - not supported yet) */\r\n //dragOut?: boolean;\r\n\r\n /** the type of engine to create (so you can subclass) default to GridStackEngine */\r\n engineClass?: typeof GridStackEngine;\r\n\r\n /** enable floating widgets (default?: false) See example (http://gridstack.github.io/gridstack.js/demo/float.html) */\r\n float?: boolean;\r\n\r\n /** draggable handle selector (default?: '.grid-stack-item-content') */\r\n handle?: string;\r\n\r\n /** draggable handle class (e.g. 'grid-stack-item-content'). If set 'handle' is ignored (default?: null) */\r\n handleClass?: string;\r\n\r\n /** additional widget class (default?: 'grid-stack-item') */\r\n itemClass?: string;\r\n\r\n /** re-layout mode when we're a subgrid and we are being resized. default to 'list' */\r\n layout?: ColumnOptions;\r\n\r\n /** true when widgets are only created when they scroll into view (visible) */\r\n lazyLoad?: boolean;\r\n\r\n /**\r\n * gap between grid item and content (default?: 10). This will set all 4 sides and support the CSS formats below\r\n * an integer (px)\r\n * a string with possible units (ex: '2em', '20px', '2rem')\r\n * string with space separated values (ex: '5px 10px 0 20px' for all 4 sides, or '5em 10em' for top/bottom and left/right pairs like CSS).\r\n * Note: all sides must have same units (last one wins, default px)\r\n */\r\n margin?: numberOrString;\r\n\r\n /** OLD way to optionally set each side - use margin: '5px 10px 0 20px' instead. Used internally to store each side. */\r\n marginTop?: numberOrString;\r\n marginRight?: numberOrString;\r\n marginBottom?: numberOrString;\r\n marginLeft?: numberOrString;\r\n\r\n /** (internal) unit for margin (default? 'px') set when `margin` is set as string with unit (ex: 2rem') */\r\n marginUnit?: string;\r\n\r\n /** maximum rows amount. Default? is 0 which means no maximum rows */\r\n maxRow?: number;\r\n\r\n /** minimum rows amount which is handy to prevent grid from collapsing when empty. Default is `0`.\r\n * When no set the `min-height` CSS attribute on the grid div (in pixels) can be used, which will round to the closest row.\r\n */\r\n minRow?: number;\r\n\r\n /** If you are using a nonce-based Content Security Policy, pass your nonce here and\r\n * GridStack will add it to the `<style>` elements it creates. */\r\n nonce?: string;\r\n\r\n /** class for placeholder (default?: 'grid-stack-placeholder') */\r\n placeholderClass?: string;\r\n\r\n /** placeholder default content (default?: '') */\r\n placeholderText?: string;\r\n\r\n /** allows to override UI resizable options. default is { handles: 'se', autoHide: true on desktop, false on mobile } */\r\n resizable?: DDResizeOpt;\r\n\r\n /**\r\n * if true widgets could be removed by dragging outside of the grid. It could also be a selector string (ex: \".trash\"),\r\n * in this case widgets will be removed by dropping them there (default?: false)\r\n * See example (http://gridstack.github.io/gridstack.js/demo/two.html)\r\n */\r\n removable?: boolean | string;\r\n\r\n /** allows to override UI removable options. (default?: { accept: '.grid-stack-item' }) */\r\n removableOptions?: DDRemoveOpt;\r\n\r\n /** fix grid number of rows. This is a shortcut of writing `minRow:N, maxRow:N`. (default `0` no constrain) */\r\n row?: number;\r\n\r\n /**\r\n * if true turns grid to RTL. Possible values are true, false, 'auto' (default?: 'auto')\r\n * See [example](http://gridstack.github.io/gridstack.js/demo/right-to-left(rtl).html)\r\n */\r\n rtl?: boolean | 'auto';\r\n\r\n /** set to true if all grid items (by default, but item can also override) height should be based on content size instead of WidgetItem.h to avoid v-scrollbars.\r\n * Note: this is still row based, not pixels, so it will use ceil(getBoundingClientRect().height / getCellHeight())\r\n */\r\n sizeToContent?: boolean;\r\n\r\n /**\r\n * makes grid static (default?: false). If `true` widgets are not movable/resizable.\r\n * You don't even need draggable/resizable. A CSS class\r\n * 'grid-stack-static' is also added to the element.\r\n */\r\n staticGrid?: boolean;\r\n\r\n /**\r\n * @deprecated Not used anymore, styles are now implemented with local CSS variables\r\n */\r\n styleInHead?: boolean;\r\n\r\n /** list of differences in options for automatically created sub-grids under us (inside our grid-items) */\r\n subGridOpts?: GridStackOptions;\r\n\r\n /** enable/disable the creation of sub-grids on the fly by dragging items completely\r\n * over others (nest) vs partially (push). Forces `DDDragOpt.pause=true` to accomplish that. */\r\n subGridDynamic?: boolean;\r\n}\r\n\r\n/** options used during GridStackEngine.moveNode() */\r\nexport interface GridStackMoveOpts extends GridStackPosition {\r\n /** node to skip collision */\r\n skip?: GridStackNode;\r\n /** do we pack (default true) */\r\n pack?: boolean;\r\n /** true if we are calling this recursively to prevent simple swap or coverage collision - default false*/\r\n nested?: boolean;\r\n /** vars to calculate other cells coordinates */\r\n cellWidth?: number;\r\n cellHeight?: number;\r\n marginTop?: number;\r\n marginBottom?: number;\r\n marginLeft?: number;\r\n marginRight?: number;\r\n /** position in pixels of the currently dragged items (for overlap check) */\r\n rect?: GridStackPosition;\r\n /** true if we're live resizing */\r\n resizing?: boolean;\r\n /** best node (most coverage) we collied with */\r\n collide?: GridStackNode;\r\n /** for collision check even if we don't move */\r\n forceCollide?: boolean;\r\n}\r\n\r\nexport interface GridStackPosition {\r\n /** widget position x (default?: 0) */\r\n x?: number;\r\n /** widget position y (default?: 0) */\r\n y?: number;\r\n /** widget dimension width (default?: 1) */\r\n w?: number;\r\n /** widget dimension height (default?: 1) */\r\n h?: number;\r\n}\r\n\r\n/**\r\n * GridStack Widget creation options\r\n */\r\nexport interface GridStackWidget extends GridStackPosition {\r\n /** if true then x, y parameters will be ignored and widget will be places on the first available position (default?: false) */\r\n autoPosition?: boolean;\r\n /** minimum width allowed during resize/creation (default?: undefined = un-constrained) */\r\n minW?: number;\r\n /** maximum width allowed during resize/creation (default?: undefined = un-constrained) */\r\n maxW?: number;\r\n /** minimum height allowed during resize/creation (default?: undefined = un-constrained) */\r\n minH?: number;\r\n /** maximum height allowed during resize/creation (default?: undefined = un-constrained) */\r\n maxH?: number;\r\n /** prevent direct resizing by the user (default?: undefined = un-constrained) */\r\n noResize?: boolean;\r\n /** prevents direct moving by the user (default?: undefined = un-constrained) */\r\n noMove?: boolean;\r\n /** prevents being pushed by other widgets or api (default?: undefined = un-constrained), which is different from `noMove` (user action only) */\r\n locked?: boolean;\r\n /** value for `gs-id` stored on the widget (default?: undefined) */\r\n id?: string;\r\n /** html to append inside as content */\r\n content?: string;\r\n /** true when widgets are only created when they scroll into view (visible) */\r\n lazyLoad?: boolean;\r\n /** local (vs grid) override - see GridStackOptions.\r\n * Note: This also allow you to set a maximum h value (but user changeable during normal resizing) to prevent unlimited content from taking too much space (get scrollbar) */\r\n sizeToContent?: boolean | number;\r\n /** local override of GridStack.resizeToContentParent that specify the class to use for the parent (actual) vs child (wanted) height */\r\n resizeToContentParent?: string;\r\n /** optional nested grid options and list of children, which then turns into actual instance at runtime to get options from */\r\n subGridOpts?: GridStackOptions;\r\n}\r\n\r\n/** Drag&Drop resize options */\r\nexport interface DDResizeOpt {\r\n /** do resize handle hide by default until mouse over. default: true on desktop, false on mobile */\r\n autoHide?: boolean;\r\n /**\r\n * sides where you can resize from (ex: 'e, se, s, sw, w') - default 'se' (south-east)\r\n * Note: it is not recommended to resize from the top sides as weird side effect may occur.\r\n */\r\n handles?: string;\r\n /**\r\n * Custom element or query inside the widget node that is used instead of the\r\n * generated resize handle.\r\n */\r\n element?: string | HTMLElement\r\n}\r\n\r\n/** Drag&Drop remove options */\r\nexport interface DDRemoveOpt {\r\n /** class that can be removed (default?: opts.itemClass) */\r\n accept?: string;\r\n /** class that cannot be removed (default: 'grid-stack-non-removable') */\r\n decline?: string;\r\n}\r\n\r\n/** Drag&Drop dragging options */\r\nexport interface DDDragOpt {\r\n /** class selector of items that can be dragged. default to '.grid-stack-item-content' */\r\n handle?: string;\r\n /** default to 'body' */\r\n appendTo?: string;\r\n /** if set (true | msec), dragging placement (collision) will only happen after a pause by the user. Note: this is Global */\r\n pause?: boolean | number;\r\n /** default to `true` */\r\n scroll?: boolean;\r\n /** prevents dragging from starting on specified elements, listed as comma separated selectors (eg: '.no-drag'). default built in is 'input,textarea,button,select,option' */\r\n cancel?: string;\r\n /** helper function when dropping: 'clone' or your own method */\r\n helper?: 'clone' | ((el: HTMLElement) => HTMLElement);\r\n /** callbacks */\r\n start?: (event: Event, ui: DDUIData) => void;\r\n stop?: (event: Event) => void;\r\n drag?: (event: Event, ui: DDUIData) => void;\r\n}\r\nexport interface Size {\r\n width: number;\r\n height: number;\r\n}\r\nexport interface Position {\r\n top: number;\r\n left: number;\r\n}\r\nexport interface Rect extends Size, Position {}\r\n\r\n/** data that is passed during drag and resizing callbacks */\r\nexport interface DDUIData {\r\n position?: Position;\r\n size?: Size;\r\n draggable?: HTMLElement;\r\n /* fields not used by GridStack but sent by jq ? leave in case we go back to them...\r\n originalPosition? : Position;\r\n offset?: Position;\r\n originalSize?: Size;\r\n element?: HTMLElement[];\r\n helper?: HTMLElement[];\r\n originalElement?: HTMLElement[];\r\n */\r\n}\r\n\r\n/**\r\n * internal runtime descriptions describing the widgets in the grid\r\n */\r\nexport interface GridStackNode extends GridStackWidget {\r\n /** pointer back to HTML element */\r\n el?: GridItemHTMLElement;\r\n /** pointer back to parent Grid instance */\r\n grid?: GridStack;\r\n /** actual sub-grid instance */\r\n subGrid?: GridStack;\r\n /** allow delay creation when visible */\r\n visibleObservable?: IntersectionObserver;\r\n /** @internal internal id used to match when cloning engines or saving column layouts */\r\n _id?: number;\r\n /** @internal does the node attr ned to be updated due to changed x,y,w,h values */\r\n _dirty?: boolean;\r\n /** @internal */\r\n _updating?: boolean;\r\n /** @internal true when over trash/another grid so we don't bother removing drag CSS style that would animate back to old position */\r\n _isAboutToRemove?: boolean;\r\n /** @internal true if item came from outside of the grid -> actual item need to be moved over */\r\n _isExternal?: boolean;\r\n /** @internal Mouse event that's causing moving|resizing */\r\n _event?: MouseEvent;\r\n /** @internal moving vs resizing */\r\n _moving?: boolean;\r\n /** @internal is resizing? */\r\n _resizing?: boolean;\r\n /** @internal true if we jumped down past item below (one time jump so we don't have to totally pass it) */\r\n _skipDown?: boolean;\r\n /** @internal original values before a drag/size */\r\n _orig?: GridStackPosition;\r\n /** @internal position in pixels used during collision check */\r\n _rect?: GridStackPosition;\r\n /** @internal top/left pixel location before a drag so we can detect direction of move from last position*/\r\n _lastUiPosition?: Position;\r\n /** @internal set on the item being dragged/resized remember the last positions we've tried (but failed) so we don't try again during drag/resize */\r\n _lastTried?: GridStackPosition;\r\n /** @internal position willItFit() will use to position the item */\r\n _willFitPos?: GridStackPosition;\r\n /** @internal last drag Y pixel position used to incrementally update V scroll bar */\r\n _prevYPix?: number;\r\n /** @internal true if we've remove the item from ourself (dragging out) but might revert it back (release on nothing -> goes back) */\r\n _temporaryRemoved?: boolean;\r\n /** @internal true if we should remove DOM element on _notify() rather than clearing _id (old way) */\r\n _removeDOM?: boolean;\r\n /** @internal original position/size of item if dragged from sidebar */\r\n _sidebarOrig?: GridStackPosition;\r\n /** @internal had drag&drop been initialized */\r\n _initDD?: boolean;\r\n}\r\n"]}
@@ -0,0 +1,283 @@
1
+ /**
2
+ * utils.ts 12.4.1
3
+ * Copyright (c) 2021-2025 Alain Dumesny - see GridStack root license
4
+ */
5
+ import { GridStackElement, GridStackNode, numberOrString, GridStackPosition, GridStackWidget } from './types';
6
+ export interface HeightData {
7
+ h: number;
8
+ unit: string;
9
+ }
10
+ export interface DragTransform {
11
+ xScale: number;
12
+ yScale: number;
13
+ xOffset: number;
14
+ yOffset: number;
15
+ }
16
+ /**
17
+ * Collection of utility methods used throughout GridStack.
18
+ * These are general-purpose helper functions for DOM manipulation,
19
+ * positioning calculations, object operations, and more.
20
+ */
21
+ export declare class Utils {
22
+ /**
23
+ * Convert a potential selector into an actual list of HTML elements.
24
+ * Supports CSS selectors, element references, and special ID handling.
25
+ *
26
+ * @param els selector string, HTMLElement, or array of elements
27
+ * @param root optional root element to search within (defaults to document, useful for shadow DOM)
28
+ * @returns array of HTML elements matching the selector
29
+ *
30
+ * @example
31
+ * const elements = Utils.getElements('.grid-item');
32
+ * const byId = Utils.getElements('#myWidget');
33
+ * const fromShadow = Utils.getElements('.item', shadowRoot);
34
+ */
35
+ static getElements(els: GridStackElement, root?: HTMLElement | Document): HTMLElement[];
36
+ /**
37
+ * Convert a potential selector into a single HTML element.
38
+ * Similar to getElements() but returns only the first match.
39
+ *
40
+ * @param els selector string or HTMLElement
41
+ * @param root optional root element to search within (defaults to document)
42
+ * @returns the first HTML element matching the selector, or null if not found
43
+ *
44
+ * @example
45
+ * const element = Utils.getElement('#myWidget');
46
+ * const first = Utils.getElement('.grid-item');
47
+ */
48
+ static getElement(els: GridStackElement, root?: HTMLElement | Document): HTMLElement;
49
+ /**
50
+ * Check if a widget should be lazy loaded based on node or grid settings.
51
+ *
52
+ * @param n the grid node to check
53
+ * @returns true if the item should be lazy loaded
54
+ *
55
+ * @example
56
+ * if (Utils.lazyLoad(node)) {
57
+ * // Set up intersection observer for lazy loading
58
+ * }
59
+ */
60
+ static lazyLoad(n: GridStackNode): boolean;
61
+ /**
62
+ * Create a div element with the specified CSS classes.
63
+ *
64
+ * @param classes array of CSS class names to add
65
+ * @param parent optional parent element to append the div to
66
+ * @returns the created div element
67
+ *
68
+ * @example
69
+ * const div = Utils.createDiv(['grid-item', 'draggable']);
70
+ * const nested = Utils.createDiv(['content'], parentDiv);
71
+ */
72
+ static createDiv(classes: string[], parent?: HTMLElement): HTMLElement;
73
+ /**
74
+ * Check if a widget should resize to fit its content.
75
+ *
76
+ * @param n the grid node to check (can be undefined)
77
+ * @param strict if true, only returns true for explicit sizeToContent:true (not numbers)
78
+ * @returns true if the widget should resize to content
79
+ *
80
+ * @example
81
+ * if (Utils.shouldSizeToContent(node)) {
82
+ * // Trigger content-based resizing
83
+ * }
84
+ */
85
+ static shouldSizeToContent(n: GridStackNode | undefined, strict?: boolean): boolean;
86
+ /**
87
+ * Check if two grid positions overlap/intersect.
88
+ *
89
+ * @param a first position with x, y, w, h properties
90
+ * @param b second position with x, y, w, h properties
91
+ * @returns true if the positions overlap
92
+ *
93
+ * @example
94
+ * const overlaps = Utils.isIntercepted(
95
+ * {x: 0, y: 0, w: 2, h: 1},
96
+ * {x: 1, y: 0, w: 2, h: 1}
97
+ * ); // true - they overlap
98
+ */
99
+ static isIntercepted(a: GridStackPosition, b: GridStackPosition): boolean;
100
+ /**
101
+ * Check if two grid positions are touching (edges or corners).
102
+ *
103
+ * @param a first position
104
+ * @param b second position
105
+ * @returns true if the positions are touching
106
+ *
107
+ * @example
108
+ * const touching = Utils.isTouching(
109
+ * {x: 0, y: 0, w: 2, h: 1},
110
+ * {x: 2, y: 0, w: 1, h: 1}
111
+ * ); // true - they share an edge
112
+ */
113
+ static isTouching(a: GridStackPosition, b: GridStackPosition): boolean;
114
+ /**
115
+ * Calculate the overlapping area between two grid positions.
116
+ *
117
+ * @param a first position
118
+ * @param b second position
119
+ * @returns the area of overlap (0 if no overlap)
120
+ *
121
+ * @example
122
+ * const overlap = Utils.areaIntercept(
123
+ * {x: 0, y: 0, w: 3, h: 2},
124
+ * {x: 1, y: 0, w: 3, h: 2}
125
+ * ); // returns 4 (2x2 overlap)
126
+ */
127
+ static areaIntercept(a: GridStackPosition, b: GridStackPosition): number;
128
+ /**
129
+ * Calculate the total area of a grid position.
130
+ *
131
+ * @param a position with width and height
132
+ * @returns the total area (width * height)
133
+ *
134
+ * @example
135
+ * const area = Utils.area({x: 0, y: 0, w: 3, h: 2}); // returns 6
136
+ */
137
+ static area(a: GridStackPosition): number;
138
+ /**
139
+ * Sort an array of grid nodes by position (y first, then x).
140
+ *
141
+ * @param nodes array of nodes to sort
142
+ * @param dir sort direction: 1 for ascending (top-left first), -1 for descending
143
+ * @returns the sorted array (modifies original)
144
+ *
145
+ * @example
146
+ * const sorted = Utils.sort(nodes); // Sort top-left to bottom-right
147
+ * const reverse = Utils.sort(nodes, -1); // Sort bottom-right to top-left
148
+ */
149
+ static sort(nodes: GridStackNode[], dir?: 1 | -1): GridStackNode[];
150
+ /**
151
+ * Find a grid node by its ID.
152
+ *
153
+ * @param nodes array of nodes to search
154
+ * @param id the ID to search for
155
+ * @returns the node with matching ID, or undefined if not found
156
+ *
157
+ * @example
158
+ * const node = Utils.find(nodes, 'widget-1');
159
+ * if (node) console.log('Found node at:', node.x, node.y);
160
+ */
161
+ static find(nodes: GridStackNode[], id: string): GridStackNode | undefined;
162
+ /**
163
+ * Convert various value types to boolean.
164
+ * Handles strings like 'false', 'no', '0' as false.
165
+ *
166
+ * @param v value to convert
167
+ * @returns boolean representation
168
+ *
169
+ * @example
170
+ * Utils.toBool('true'); // true
171
+ * Utils.toBool('false'); // false
172
+ * Utils.toBool('no'); // false
173
+ * Utils.toBool('1'); // true
174
+ */
175
+ static toBool(v: unknown): boolean;
176
+ /**
177
+ * Convert a string value to a number, handling null and empty strings.
178
+ *
179
+ * @param value string or null value to convert
180
+ * @returns number value, or undefined for null/empty strings
181
+ *
182
+ * @example
183
+ * Utils.toNumber('42'); // 42
184
+ * Utils.toNumber(''); // undefined
185
+ * Utils.toNumber(null); // undefined
186
+ */
187
+ static toNumber(value: null | string): number;
188
+ /**
189
+ * Parse a height value with units into numeric value and unit string.
190
+ * Supports px, em, rem, vh, vw, %, cm, mm units.
191
+ *
192
+ * @param val height value as number or string with units
193
+ * @returns object with h (height) and unit properties
194
+ *
195
+ * @example
196
+ * Utils.parseHeight('100px'); // {h: 100, unit: 'px'}
197
+ * Utils.parseHeight('2rem'); // {h: 2, unit: 'rem'}
198
+ * Utils.parseHeight(50); // {h: 50, unit: 'px'}
199
+ */
200
+ static parseHeight(val: numberOrString): HeightData;
201
+ /**
202
+ * Copy unset fields from source objects to target object (shallow merge with defaults).
203
+ * Similar to Object.assign but only sets undefined/null fields.
204
+ *
205
+ * @param target the object to copy defaults into
206
+ * @param sources one or more source objects to copy defaults from
207
+ * @returns the modified target object
208
+ *
209
+ * @example
210
+ * const config = { width: 100 };
211
+ * Utils.defaults(config, { width: 200, height: 50 });
212
+ * // config is now { width: 100, height: 50 }
213
+ */
214
+ static defaults(target: any, ...sources: any[]): {};
215
+ /**
216
+ * Compare two objects for equality (shallow comparison).
217
+ * Checks if objects have the same fields and values at one level deep.
218
+ *
219
+ * @param a first object to compare
220
+ * @param b second object to compare
221
+ * @returns true if objects have the same values
222
+ *
223
+ * @example
224
+ * Utils.same({x: 1, y: 2}, {x: 1, y: 2}); // true
225
+ * Utils.same({x: 1}, {x: 1, y: 2}); // false
226
+ */
227
+ static same(a: unknown, b: unknown): boolean;
228
+ /**
229
+ * Copy position and size properties from one widget to another.
230
+ * Copies x, y, w, h and optionally min/max constraints.
231
+ *
232
+ * @param a target widget to copy to
233
+ * @param b source widget to copy from
234
+ * @param doMinMax if true, also copy min/max width/height constraints
235
+ * @returns the target widget (a)
236
+ *
237
+ * @example
238
+ * Utils.copyPos(widget1, widget2); // Copy position/size
239
+ * Utils.copyPos(widget1, widget2, true); // Also copy constraints
240
+ */
241
+ static copyPos(a: GridStackWidget, b: GridStackWidget, doMinMax?: boolean): GridStackWidget;
242
+ /** true if a and b has same size & position */
243
+ static samePos(a: GridStackPosition, b: GridStackPosition): boolean;
244
+ /** given a node, makes sure it's min/max are valid */
245
+ static sanitizeMinMax(node: GridStackNode): void;
246
+ /** removes field from the first object if same as the second objects (like diffing) and internal '_' for saving */
247
+ static removeInternalAndSame(a: unknown, b: unknown): void;
248
+ /** removes internal fields '_' and default values for saving */
249
+ static removeInternalForSave(n: GridStackNode, removeEl?: boolean): void;
250
+ /** return the closest parent (or itself) matching the given class */
251
+ /** delay calling the given function for given delay, preventing new calls from happening while waiting */
252
+ static throttle(func: () => void, delay: number): () => void;
253
+ static removePositioningStyles(el: HTMLElement): void;
254
+ /** single level clone, returning a new object with same top fields. This will share sub objects and arrays */
255
+ static clone<T>(obj: T): T;
256
+ /**
257
+ * Recursive clone version that returns a full copy, checking for nested objects and arrays ONLY.
258
+ * Note: this will use as-is any key starting with double __ (and not copy inside) some lib have circular dependencies.
259
+ */
260
+ static cloneDeep<T>(obj: T): T;
261
+ /** deep clone the given HTML node, removing teh unique id field */
262
+ static cloneNode(el: HTMLElement): HTMLElement;
263
+ static appendTo(el: HTMLElement, parent: string | HTMLElement): void;
264
+ static addElStyles(el: HTMLElement, styles: {
265
+ [prop: string]: string | string[];
266
+ }): void;
267
+ static initEvent<T>(e: DragEvent | MouseEvent, info: {
268
+ type: string;
269
+ target?: EventTarget;
270
+ }): T;
271
+ /** copies the MouseEvent (or convert Touch) properties and sends it as another event to the given target */
272
+ static simulateMouseEvent(e: MouseEvent | Touch, simulatedType: string, target?: EventTarget): void;
273
+ /**
274
+ * defines an element that is used to get the offset and scale from grid transforms
275
+ * returns the scale and offsets from said element
276
+ */
277
+ static getValuesFromTransformedElement(parent: HTMLElement): DragTransform;
278
+ /** swap the given object 2 field values */
279
+ static swap(o: unknown, a: string, b: string): void;
280
+ /** returns true if event is inside the given element rectangle */
281
+ /** true if the item can be rotated (checking for prop, not space available) */
282
+ static canBeRotated(n: GridStackNode): boolean;
283
+ }
@@ -1,18 +1,18 @@
1
1
  /**
2
- * utils.ts 12.4.0
2
+ * utils.ts 12.4.1
3
3
  * Copyright (c) 2021-2025 Alain Dumesny - see GridStack root license
4
4
  */
5
- /**
6
- * @internal Checks for obsolete method names and provides deprecation warnings.
7
- * Creates a wrapper function that logs a deprecation warning when called.
8
- *
9
- * @param self the object context to apply the function to
10
- * @param f the new function to call
11
- * @param oldName the deprecated method name
12
- * @param newName the new method name to use instead
13
- * @param rev the version when the deprecation was introduced
14
- * @returns a wrapper function that warns about deprecation
15
- */
5
+ // /**
6
+ // * Checks for obsolete method names and provides deprecation warnings.
7
+ // * Creates a wrapper function that logs a deprecation warning when called.
8
+ // *
9
+ // * @param self the object context to apply the function to
10
+ // * @param f the new function to call
11
+ // * @param oldName the deprecated method name
12
+ // * @param newName the new method name to use instead
13
+ // * @param rev the version when the deprecation was introduced
14
+ // * @returns a wrapper function that warns about deprecation
15
+ // */
16
16
  // eslint-disable-next-line
17
17
  // export function obsolete(self, f, oldName: string, newName: string, rev: string): (...args: any[]) => any {
18
18
  // const wrapper = (...args) => {
@@ -23,15 +23,15 @@
23
23
  // wrapper.prototype = f.prototype;
24
24
  // return wrapper;
25
25
  // }
26
- /**
27
- * @internal Checks for obsolete grid options and migrates them to new names.
28
- * Automatically copies old option values to new option names and shows deprecation warnings.
29
- *
30
- * @param opts the options object to check and migrate
31
- * @param oldName the deprecated option name
32
- * @param newName the new option name to use instead
33
- * @param rev the version when the deprecation was introduced
34
- */
26
+ // /**
27
+ // * Checks for obsolete grid options and migrates them to new names.
28
+ // * Automatically copies old option values to new option names and shows deprecation warnings.
29
+ // *
30
+ // * @param opts the options object to check and migrate
31
+ // * @param oldName the deprecated option name
32
+ // * @param newName the new option name to use instead
33
+ // * @param rev the version when the deprecation was introduced
34
+ // */
35
35
  // export function obsoleteOpts(opts: GridStackOptions, oldName: string, newName: string, rev: string): void {
36
36
  // if (opts[oldName] !== undefined) {
37
37
  // opts[newName] = opts[oldName];
@@ -39,29 +39,29 @@
39
39
  // newName + '`. It will be **removed** in a future release');
40
40
  // }
41
41
  // }
42
- /**
43
- * @internal Checks for obsolete grid options that have been completely removed.
44
- * Shows deprecation warnings for options that are no longer supported.
45
- *
46
- * @param opts the options object to check
47
- * @param oldName the removed option name
48
- * @param rev the version when the option was removed
49
- * @param info additional information about the removal
50
- */
42
+ // /**
43
+ // * Checks for obsolete grid options that have been completely removed.
44
+ // * Shows deprecation warnings for options that are no longer supported.
45
+ // *
46
+ // * @param opts the options object to check
47
+ // * @param oldName the removed option name
48
+ // * @param rev the version when the option was removed
49
+ // * @param info additional information about the removal
50
+ // */
51
51
  // export function obsoleteOptsDel(opts: GridStackOptions, oldName: string, rev: string, info: string): void {
52
52
  // if (opts[oldName] !== undefined) {
53
53
  // console.warn('gridstack.js: Option `' + oldName + '` is deprecated in ' + rev + info);
54
54
  // }
55
55
  // }
56
- /**
57
- * @internal Checks for obsolete HTML element attributes and migrates them.
58
- * Automatically copies old attribute values to new attribute names and shows deprecation warnings.
59
- *
60
- * @param el the HTML element to check and migrate
61
- * @param oldName the deprecated attribute name
62
- * @param newName the new attribute name to use instead
63
- * @param rev the version when the deprecation was introduced
64
- */
56
+ // /**
57
+ // * Checks for obsolete HTML element attributes and migrates them.
58
+ // * Automatically copies old attribute values to new attribute names and shows deprecation warnings.
59
+ // *
60
+ // * @param el the HTML element to check and migrate
61
+ // * @param oldName the deprecated attribute name
62
+ // * @param newName the new attribute name to use instead
63
+ // * @param rev the version when the deprecation was introduced
64
+ // */
65
65
  // export function obsoleteAttr(el: HTMLElement, oldName: string, newName: string, rev: string): void {
66
66
  // const oldAttr = el.getAttribute(oldName);
67
67
  // if (oldAttr !== null) {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgBH,MAAM;AACN,yEAAyE;AACzE,6EAA6E;AAC7E,KAAK;AACL,6DAA6D;AAC7D,uCAAuC;AACvC,+CAA+C;AAC/C,uDAAuD;AACvD,gEAAgE;AAChE,8DAA8D;AAC9D,MAAM;AACN,2BAA2B;AAC3B,8GAA8G;AAC9G,mCAAmC;AACnC,oHAAoH;AACpH,6EAA6E;AAC7E,kCAAkC;AAClC,MAAM;AACN,qCAAqC;AACrC,oBAAoB;AACpB,IAAI;AAEJ,MAAM;AACN,sEAAsE;AACtE,gGAAgG;AAChG,KAAK;AACL,yDAAyD;AACzD,+CAA+C;AAC/C,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CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACxJ,CAAC;CACF","sourcesContent":["/**\r\n * utils.ts 12.4.1\r\n * Copyright (c) 2021-2025 Alain Dumesny - see GridStack root license\r\n */\r\n\r\nimport { GridStackElement, GridStackNode, numberOrString, GridStackPosition, GridStackWidget } from './types';\r\n\r\nexport interface HeightData {\r\n h: number;\r\n unit: string;\r\n}\r\n\r\nexport interface DragTransform {\r\n xScale: number;\r\n yScale: number;\r\n xOffset: number;\r\n yOffset: number;\r\n}\r\n\r\n// /**\r\n// * Checks for obsolete method names and provides deprecation warnings.\r\n// * Creates a wrapper function that logs a deprecation warning when called.\r\n// *\r\n// * @param self the object context to apply the function to\r\n// * @param f the new function to call\r\n// * @param oldName the deprecated method name\r\n// * @param newName the new method name to use instead\r\n// * @param rev the version when the deprecation was introduced\r\n// * @returns a wrapper function that warns about deprecation\r\n// */\r\n// eslint-disable-next-line\r\n// export function obsolete(self, f, oldName: string, newName: string, rev: string): (...args: any[]) => any {\r\n// const wrapper = (...args) => {\r\n// console.warn('gridstack.js: Function `' + oldName + '` is deprecated in ' + rev + ' and has been replaced ' +\r\n// 'with `' + newName + '`. It will be **removed** in a future release');\r\n// return f.apply(self, args);\r\n// }\r\n// wrapper.prototype = f.prototype;\r\n// return wrapper;\r\n// }\r\n\r\n// /**\r\n// * Checks for obsolete grid options and migrates them to new names.\r\n// * Automatically copies old option values to new option names and shows deprecation warnings.\r\n// *\r\n// * @param opts the options object to check and migrate\r\n// * @param oldName the deprecated option name\r\n// * @param newName the new option name to use instead\r\n// * @param rev the version when the deprecation was introduced\r\n// */\r\n// export function obsoleteOpts(opts: GridStackOptions, oldName: string, newName: string, rev: string): void {\r\n// if (opts[oldName] !== undefined) {\r\n// opts[newName] = opts[oldName];\r\n// console.warn('gridstack.js: Option `' + oldName + '` is deprecated in ' + rev + ' and has been replaced with `' +\r\n// newName + '`. It will be **removed** in a future release');\r\n// }\r\n// }\r\n\r\n// /**\r\n// * Checks for obsolete grid options that have been completely removed.\r\n// * Shows deprecation warnings for options that are no longer supported.\r\n// *\r\n// * @param opts the options object to check\r\n// * @param oldName the removed option name\r\n// * @param rev the version when the option was removed\r\n// * @param info additional information about the removal\r\n// */\r\n// export function obsoleteOptsDel(opts: GridStackOptions, oldName: string, rev: string, info: string): void {\r\n// if (opts[oldName] !== undefined) {\r\n// console.warn('gridstack.js: Option `' + oldName + '` is deprecated in ' + rev + info);\r\n// }\r\n// }\r\n\r\n// /**\r\n// * Checks for obsolete HTML element attributes and migrates them.\r\n// * Automatically copies old attribute values to new attribute names and shows deprecation warnings.\r\n// *\r\n// * @param el the HTML element to check and migrate\r\n// * @param oldName the deprecated attribute name\r\n// * @param newName the new attribute name to use instead\r\n// * @param rev the version when the deprecation was introduced\r\n// */\r\n// export function obsoleteAttr(el: HTMLElement, oldName: string, newName: string, rev: string): void {\r\n// const oldAttr = el.getAttribute(oldName);\r\n// if (oldAttr !== null) {\r\n// el.setAttribute(newName, oldAttr);\r\n// console.warn('gridstack.js: attribute `' + oldName + '`=' + oldAttr + ' is deprecated on this object in ' + rev + ' and has been replaced with `' +\r\n// newName + '`. It will be **removed** in a future release');\r\n// }\r\n// }\r\n\r\n/**\r\n * Collection of utility methods used throughout GridStack.\r\n * These are general-purpose helper functions for DOM manipulation,\r\n * positioning calculations, object operations, and more.\r\n */\r\nexport class Utils {\r\n\r\n /**\r\n * Convert a potential selector into an actual list of HTML elements.\r\n * Supports CSS selectors, element references, and special ID handling.\r\n *\r\n * @param els selector string, HTMLElement, or array of elements\r\n * @param root optional root element to search within (defaults to document, useful for shadow DOM)\r\n * @returns array of HTML elements matching the selector\r\n *\r\n * @example\r\n * const elements = Utils.getElements('.grid-item');\r\n * const byId = Utils.getElements('#myWidget');\r\n * const fromShadow = Utils.getElements('.item', shadowRoot);\r\n */\r\n static getElements(els: GridStackElement, root: HTMLElement | Document = document): HTMLElement[] {\r\n if (typeof els === 'string') {\r\n const doc = ('getElementById' in root) ? root as Document : undefined;\r\n\r\n // Note: very common for people use to id='1,2,3' which is only legal as HTML5 id, but not CSS selectors\r\n // so if we start with a number, assume it's an id and just return that one item...\r\n // see https://github.com/gridstack/gridstack.js/issues/2234#issuecomment-1523796562\r\n if (doc && !isNaN(+els[0])) { // start with digit\r\n const el = doc.getElementById(els);\r\n return el ? [el] : [];\r\n }\r\n\r\n let list = root.querySelectorAll(els);\r\n if (!list.length && els[0] !== '.' && els[0] !== '#') {\r\n // see if mean to be a class\r\n list = root.querySelectorAll('.' + els);\r\n\r\n // else if mean to be an id\r\n if (!list.length) list = root.querySelectorAll('#' + els);\r\n\r\n // else see if gs-id attribute\r\n if (!list.length) {\r\n const el = root.querySelector<HTMLElement>(`[gs-id=\"${els}\"]`);\r\n return el ? [el] : [];\r\n }\r\n }\r\n return Array.from(list) as HTMLElement[];\r\n }\r\n return [els];\r\n }\r\n\r\n /**\r\n * Convert a potential selector into a single HTML element.\r\n * Similar to getElements() but returns only the first match.\r\n *\r\n * @param els selector string or HTMLElement\r\n * @param root optional root element to search within (defaults to document)\r\n * @returns the first HTML element matching the selector, or null if not found\r\n *\r\n * @example\r\n * const element = Utils.getElement('#myWidget');\r\n * const first = Utils.getElement('.grid-item');\r\n */\r\n static getElement(els: GridStackElement, root: HTMLElement | Document = document): HTMLElement {\r\n if (typeof els === 'string') {\r\n const doc = ('getElementById' in root) ? root as Document : undefined;\r\n if (!els.length) return null;\r\n if (doc && els[0] === '#') {\r\n return doc.getElementById(els.substring(1));\r\n }\r\n if (els[0] === '#' || els[0] === '.' || els[0] === '[') {\r\n return root.querySelector(els);\r\n }\r\n\r\n // if we start with a digit, assume it's an id (error calling querySelector('#1')) as class are not valid CSS\r\n if (doc && !isNaN(+els[0])) { // start with digit\r\n return doc.getElementById(els);\r\n }\r\n\r\n // finally try string, then id, then class\r\n let el = root.querySelector(els);\r\n if (doc && !el) { el = doc.getElementById(els) }\r\n if (!el) { el = root.querySelector('.' + els) }\r\n return el as HTMLElement;\r\n }\r\n return els;\r\n }\r\n\r\n /**\r\n * Check if a widget should be lazy loaded based on node or grid settings.\r\n *\r\n * @param n the grid node to check\r\n * @returns true if the item should be lazy loaded\r\n *\r\n * @example\r\n * if (Utils.lazyLoad(node)) {\r\n * // Set up intersection observer for lazy loading\r\n * }\r\n */\r\n static lazyLoad(n: GridStackNode): boolean {\r\n return n.lazyLoad || n.grid?.opts?.lazyLoad && n.lazyLoad !== false;\r\n }\r\n\r\n /**\r\n * Create a div element with the specified CSS classes.\r\n *\r\n * @param classes array of CSS class names to add\r\n * @param parent optional parent element to append the div to\r\n * @returns the created div element\r\n *\r\n * @example\r\n * const div = Utils.createDiv(['grid-item', 'draggable']);\r\n * const nested = Utils.createDiv(['content'], parentDiv);\r\n */\r\n static createDiv(classes: string[], parent?: HTMLElement): HTMLElement {\r\n const el = document.createElement('div');\r\n classes.forEach(c => {if (c) el.classList.add(c)});\r\n parent?.appendChild(el);\r\n return el;\r\n }\r\n\r\n /**\r\n * Check if a widget should resize to fit its content.\r\n *\r\n * @param n the grid node to check (can be undefined)\r\n * @param strict if true, only returns true for explicit sizeToContent:true (not numbers)\r\n * @returns true if the widget should resize to content\r\n *\r\n * @example\r\n * if (Utils.shouldSizeToContent(node)) {\r\n * // Trigger content-based resizing\r\n * }\r\n */\r\n static shouldSizeToContent(n: GridStackNode | undefined, strict = false): boolean {\r\n return n?.grid && (strict ?\r\n (n.sizeToContent === true || (n.grid.opts.sizeToContent === true && n.sizeToContent === undefined)) :\r\n (!!n.sizeToContent || (n.grid.opts.sizeToContent && n.sizeToContent !== false)));\r\n }\r\n\r\n /**\r\n * Check if two grid positions overlap/intersect.\r\n *\r\n * @param a first position with x, y, w, h properties\r\n * @param b second position with x, y, w, h properties\r\n * @returns true if the positions overlap\r\n *\r\n * @example\r\n * const overlaps = Utils.isIntercepted(\r\n * {x: 0, y: 0, w: 2, h: 1},\r\n * {x: 1, y: 0, w: 2, h: 1}\r\n * ); // true - they overlap\r\n */\r\n static isIntercepted(a: GridStackPosition, b: GridStackPosition): boolean {\r\n return !(a.y >= b.y + b.h || a.y + a.h <= b.y || a.x + a.w <= b.x || a.x >= b.x + b.w);\r\n }\r\n\r\n /**\r\n * Check if two grid positions are touching (edges or corners).\r\n *\r\n * @param a first position\r\n * @param b second position\r\n * @returns true if the positions are touching\r\n *\r\n * @example\r\n * const touching = Utils.isTouching(\r\n * {x: 0, y: 0, w: 2, h: 1},\r\n * {x: 2, y: 0, w: 1, h: 1}\r\n * ); // true - they share an edge\r\n */\r\n static isTouching(a: GridStackPosition, b: GridStackPosition): boolean {\r\n return Utils.isIntercepted(a, {x: b.x-0.5, y: b.y-0.5, w: b.w+1, h: b.h+1})\r\n }\r\n\r\n /**\r\n * Calculate the overlapping area between two grid positions.\r\n *\r\n * @param a first position\r\n * @param b second position\r\n * @returns the area of overlap (0 if no overlap)\r\n *\r\n * @example\r\n * const overlap = Utils.areaIntercept(\r\n * {x: 0, y: 0, w: 3, h: 2},\r\n * {x: 1, y: 0, w: 3, h: 2}\r\n * ); // returns 4 (2x2 overlap)\r\n */\r\n static areaIntercept(a: GridStackPosition, b: GridStackPosition): number {\r\n const x0 = (a.x > b.x) ? a.x : b.x;\r\n const x1 = (a.x+a.w < b.x+b.w) ? a.x+a.w : b.x+b.w;\r\n if (x1 <= x0) return 0; // no overlap\r\n const y0 = (a.y > b.y) ? a.y : b.y;\r\n const y1 = (a.y+a.h < b.y+b.h) ? a.y+a.h : b.y+b.h;\r\n if (y1 <= y0) return 0; // no overlap\r\n return (x1-x0) * (y1-y0);\r\n }\r\n\r\n /**\r\n * Calculate the total area of a grid position.\r\n *\r\n * @param a position with width and height\r\n * @returns the total area (width * height)\r\n *\r\n * @example\r\n * const area = Utils.area({x: 0, y: 0, w: 3, h: 2}); // returns 6\r\n */\r\n static area(a: GridStackPosition): number {\r\n return a.w * a.h;\r\n }\r\n\r\n /**\r\n * Sort an array of grid nodes by position (y first, then x).\r\n *\r\n * @param nodes array of nodes to sort\r\n * @param dir sort direction: 1 for ascending (top-left first), -1 for descending\r\n * @returns the sorted array (modifies original)\r\n *\r\n * @example\r\n * const sorted = Utils.sort(nodes); // Sort top-left to bottom-right\r\n * const reverse = Utils.sort(nodes, -1); // Sort bottom-right to top-left\r\n */\r\n static sort(nodes: GridStackNode[], dir: 1 | -1 = 1): GridStackNode[] {\r\n const und = 10000;\r\n return nodes.sort((a, b) => {\r\n const diffY = dir * ((a.y ?? und) - (b.y ?? und));\r\n if (diffY === 0) return dir * ((a.x ?? und) - (b.x ?? und));\r\n return diffY;\r\n });\r\n }\r\n\r\n /**\r\n * Find a grid node by its ID.\r\n *\r\n * @param nodes array of nodes to search\r\n * @param id the ID to search for\r\n * @returns the node with matching ID, or undefined if not found\r\n *\r\n * @example\r\n * const node = Utils.find(nodes, 'widget-1');\r\n * if (node) console.log('Found node at:', node.x, node.y);\r\n */\r\n static find(nodes: GridStackNode[], id: string): GridStackNode | undefined {\r\n return id ? nodes.find(n => n.id === id) : undefined;\r\n }\r\n\r\n /**\r\n * Convert various value types to boolean.\r\n * Handles strings like 'false', 'no', '0' as false.\r\n *\r\n * @param v value to convert\r\n * @returns boolean representation\r\n *\r\n * @example\r\n * Utils.toBool('true'); // true\r\n * Utils.toBool('false'); // false\r\n * Utils.toBool('no'); // false\r\n * Utils.toBool('1'); // true\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n static toBool(v: unknown): boolean {\r\n if (typeof v === 'boolean') {\r\n return v;\r\n }\r\n if (typeof v === 'string') {\r\n v = v.toLowerCase();\r\n return !(v === '' || v === 'no' || v === 'false' || v === '0');\r\n }\r\n return Boolean(v);\r\n }\r\n\r\n /**\r\n * Convert a string value to a number, handling null and empty strings.\r\n *\r\n * @param value string or null value to convert\r\n * @returns number value, or undefined for null/empty strings\r\n *\r\n * @example\r\n * Utils.toNumber('42'); // 42\r\n * Utils.toNumber(''); // undefined\r\n * Utils.toNumber(null); // undefined\r\n */\r\n static toNumber(value: null | string): number {\r\n return (value === null || value.length === 0) ? undefined : Number(value);\r\n }\r\n\r\n /**\r\n * Parse a height value with units into numeric value and unit string.\r\n * Supports px, em, rem, vh, vw, %, cm, mm units.\r\n *\r\n * @param val height value as number or string with units\r\n * @returns object with h (height) and unit properties\r\n *\r\n * @example\r\n * Utils.parseHeight('100px'); // {h: 100, unit: 'px'}\r\n * Utils.parseHeight('2rem'); // {h: 2, unit: 'rem'}\r\n * Utils.parseHeight(50); // {h: 50, unit: 'px'}\r\n */\r\n static parseHeight(val: numberOrString): HeightData {\r\n let h: number;\r\n let unit = 'px';\r\n if (typeof val === 'string') {\r\n if (val === 'auto' || val === '') h = 0;\r\n else {\r\n const match = val.match(/^(-[0-9]+\\.[0-9]+|[0-9]*\\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);\r\n if (!match) {\r\n throw new Error(`Invalid height val = ${val}`);\r\n }\r\n unit = match[2] || 'px';\r\n h = parseFloat(match[1]);\r\n }\r\n } else {\r\n h = val;\r\n }\r\n return { h, unit };\r\n }\r\n\r\n /**\r\n * Copy unset fields from source objects to target object (shallow merge with defaults).\r\n * Similar to Object.assign but only sets undefined/null fields.\r\n *\r\n * @param target the object to copy defaults into\r\n * @param sources one or more source objects to copy defaults from\r\n * @returns the modified target object\r\n *\r\n * @example\r\n * const config = { width: 100 };\r\n * Utils.defaults(config, { width: 200, height: 50 });\r\n * // config is now { width: 100, height: 50 }\r\n */\r\n // eslint-disable-next-line\r\n static defaults(target, ...sources): {} {\r\n\r\n sources.forEach(source => {\r\n for (const key in source) {\r\n if (!source.hasOwnProperty(key)) return;\r\n if (target[key] === null || target[key] === undefined) {\r\n target[key] = source[key];\r\n } else if (typeof source[key] === 'object' && typeof target[key] === 'object') {\r\n // property is an object, recursively add it's field over... #1373\r\n Utils.defaults(target[key], source[key]);\r\n }\r\n }\r\n });\r\n\r\n return target;\r\n }\r\n\r\n /**\r\n * Compare two objects for equality (shallow comparison).\r\n * Checks if objects have the same fields and values at one level deep.\r\n *\r\n * @param a first object to compare\r\n * @param b second object to compare\r\n * @returns true if objects have the same values\r\n *\r\n * @example\r\n * Utils.same({x: 1, y: 2}, {x: 1, y: 2}); // true\r\n * Utils.same({x: 1}, {x: 1, y: 2}); // false\r\n */\r\n static same(a: unknown, b: unknown): boolean {\r\n if (typeof a !== 'object') return a == b;\r\n if (typeof a !== typeof b) return false;\r\n // else we have object, check just 1 level deep for being same things...\r\n if (Object.keys(a).length !== Object.keys(b).length) return false;\r\n for (const key in a) {\r\n if (a[key] !== b[key]) return false;\r\n }\r\n return true;\r\n }\r\n\r\n /**\r\n * Copy position and size properties from one widget to another.\r\n * Copies x, y, w, h and optionally min/max constraints.\r\n *\r\n * @param a target widget to copy to\r\n * @param b source widget to copy from\r\n * @param doMinMax if true, also copy min/max width/height constraints\r\n * @returns the target widget (a)\r\n *\r\n * @example\r\n * Utils.copyPos(widget1, widget2); // Copy position/size\r\n * Utils.copyPos(widget1, widget2, true); // Also copy constraints\r\n */\r\n static copyPos(a: GridStackWidget, b: GridStackWidget, doMinMax = false): GridStackWidget {\r\n if (b.x !== undefined) a.x = b.x;\r\n if (b.y !== undefined) a.y = b.y;\r\n if (b.w !== undefined) a.w = b.w;\r\n if (b.h !== undefined) a.h = b.h;\r\n if (doMinMax) {\r\n if (b.minW) a.minW = b.minW;\r\n if (b.minH) a.minH = b.minH;\r\n if (b.maxW) a.maxW = b.maxW;\r\n if (b.maxH) a.maxH = b.maxH;\r\n }\r\n return a;\r\n }\r\n\r\n /** true if a and b has same size & position */\r\n static samePos(a: GridStackPosition, b: GridStackPosition): boolean {\r\n return a && b && a.x === b.x && a.y === b.y && (a.w || 1) === (b.w || 1) && (a.h || 1) === (b.h || 1);\r\n }\r\n\r\n /** given a node, makes sure it's min/max are valid */\r\n static sanitizeMinMax(node: GridStackNode) {\r\n // remove 0, undefine, null\r\n if (!node.minW) { delete node.minW; }\r\n if (!node.minH) { delete node.minH; }\r\n if (!node.maxW) { delete node.maxW; }\r\n if (!node.maxH) { delete node.maxH; }\r\n }\r\n\r\n /** removes field from the first object if same as the second objects (like diffing) and internal '_' for saving */\r\n static removeInternalAndSame(a: unknown, b: unknown):void {\r\n if (typeof a !== 'object' || typeof b !== 'object') return;\r\n // skip arrays as we don't know how to hydrate them (unlike object spread operator)\r\n if (Array.isArray(a) || Array.isArray(b)) return;\r\n for (let key in a) {\r\n const aVal = a[key];\r\n const bVal = b[key];\r\n if (key[0] === '_' || aVal === bVal) {\r\n delete a[key]\r\n } else if (aVal && typeof aVal === 'object' && bVal !== undefined) {\r\n Utils.removeInternalAndSame(aVal, bVal);\r\n if (!Object.keys(aVal).length) { delete a[key] }\r\n }\r\n }\r\n }\r\n\r\n /** removes internal fields '_' and default values for saving */\r\n static removeInternalForSave(n: GridStackNode, removeEl = true): void {\r\n for (let key in n) { if (key[0] === '_' || n[key] === null || n[key] === undefined ) delete n[key]; }\r\n delete n.grid;\r\n if (removeEl) delete n.el;\r\n // delete default values (will be re-created on read)\r\n if (!n.autoPosition) delete n.autoPosition;\r\n if (!n.noResize) delete n.noResize;\r\n if (!n.noMove) delete n.noMove;\r\n if (!n.locked) delete n.locked;\r\n if (n.w === 1 || n.w === n.minW) delete n.w;\r\n if (n.h === 1 || n.h === n.minH) delete n.h;\r\n }\r\n\r\n /** return the closest parent (or itself) matching the given class */\r\n // static closestUpByClass(el: HTMLElement, name: string): HTMLElement {\r\n // while (el) {\r\n // if (el.classList.contains(name)) return el;\r\n // el = el.parentElement\r\n // }\r\n // return null;\r\n // }\r\n\r\n /** delay calling the given function for given delay, preventing new calls from happening while waiting */\r\n static throttle(func: () => void, delay: number): () => void {\r\n let isWaiting = false;\r\n return (...args) => {\r\n if (!isWaiting) {\r\n isWaiting = true;\r\n setTimeout(() => { func(...args); isWaiting = false; }, delay);\r\n }\r\n }\r\n }\r\n\r\n static removePositioningStyles(el: HTMLElement): void {\r\n const style = el.style;\r\n if (style.position) {\r\n style.removeProperty('position');\r\n }\r\n if (style.left) {\r\n style.removeProperty('left');\r\n }\r\n if (style.top) {\r\n style.removeProperty('top');\r\n }\r\n if (style.width) {\r\n style.removeProperty('width');\r\n }\r\n if (style.height) {\r\n style.removeProperty('height');\r\n }\r\n }\r\n\r\n /** @internal returns the passed element if scrollable, else the closest parent that will, up to the entire document scrolling element */\r\n static getScrollElement(el?: HTMLElement): HTMLElement {\r\n if (!el) return document.scrollingElement as HTMLElement || document.documentElement; // IE support\r\n const style = getComputedStyle(el);\r\n const overflowRegex = /(auto|scroll)/;\r\n\r\n if (overflowRegex.test(style.overflow + style.overflowY)) {\r\n return el;\r\n } else {\r\n return Utils.getScrollElement(el.parentElement);\r\n }\r\n }\r\n\r\n /** @internal */\r\n static updateScrollPosition(el: HTMLElement, position: {top: number}, distance: number): void {\r\n const scrollEl = Utils.getScrollElement(el);\r\n if (!scrollEl) return;\r\n\r\n const elRect = el.getBoundingClientRect();\r\n const scrollRect = scrollEl.getBoundingClientRect();\r\n const innerHeightOrClientHeight = (window.innerHeight || document.documentElement.clientHeight);\r\n\r\n const offsetDiffDown = elRect.bottom - Math.min(scrollRect.bottom, innerHeightOrClientHeight);\r\n const offsetDiffUp = elRect.top - Math.max(scrollRect.top, 0);\r\n const prevScroll = scrollEl.scrollTop;\r\n\r\n if (offsetDiffUp < 0 && distance < 0) {\r\n // scroll up\r\n if (el.offsetHeight > scrollRect.height) {\r\n scrollEl.scrollTop += distance;\r\n } else {\r\n scrollEl.scrollTop += Math.abs(offsetDiffUp) > Math.abs(distance) ? distance : offsetDiffUp;\r\n }\r\n } else if (offsetDiffDown > 0 && distance > 0) {\r\n // scroll down\r\n if (el.offsetHeight > scrollRect.height) {\r\n scrollEl.scrollTop += distance;\r\n } else {\r\n scrollEl.scrollTop += offsetDiffDown > distance ? distance : offsetDiffDown;\r\n }\r\n }\r\n\r\n position.top += scrollEl.scrollTop - prevScroll;\r\n }\r\n\r\n /**\r\n * @internal Function used to scroll the page.\r\n *\r\n * @param event `MouseEvent` that triggers the resize\r\n * @param el `HTMLElement` that's being resized\r\n * @param distance Distance from the V edges to start scrolling\r\n */\r\n static updateScrollResize(event: MouseEvent, el: HTMLElement, distance: number): void {\r\n const scrollEl = Utils.getScrollElement(el);\r\n const height = scrollEl.clientHeight;\r\n // #1727 event.clientY is relative to viewport, so must compare this against position of scrollEl getBoundingClientRect().top\r\n // #1745 Special situation if scrollEl is document 'html': here browser spec states that\r\n // clientHeight is height of viewport, but getBoundingClientRect() is rectangle of html element;\r\n // this discrepancy arises because in reality scrollbar is attached to viewport, not html element itself.\r\n const offsetTop = (scrollEl === Utils.getScrollElement()) ? 0 : scrollEl.getBoundingClientRect().top;\r\n const pointerPosY = event.clientY - offsetTop;\r\n const top = pointerPosY < distance;\r\n const bottom = pointerPosY > height - distance;\r\n\r\n if (top) {\r\n // This also can be done with a timeout to keep scrolling while the mouse is\r\n // in the scrolling zone. (will have smoother behavior)\r\n scrollEl.scrollBy({ behavior: 'smooth', top: pointerPosY - distance});\r\n } else if (bottom) {\r\n scrollEl.scrollBy({ behavior: 'smooth', top: distance - (height - pointerPosY)});\r\n }\r\n }\r\n\r\n /** single level clone, returning a new object with same top fields. This will share sub objects and arrays */\r\n static clone<T>(obj: T): T {\r\n if (obj === null || obj === undefined || typeof(obj) !== 'object') {\r\n return obj;\r\n }\r\n // return Object.assign({}, obj);\r\n if (obj instanceof Array) {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n return [...obj] as any;\r\n }\r\n return {...obj};\r\n }\r\n\r\n /**\r\n * Recursive clone version that returns a full copy, checking for nested objects and arrays ONLY.\r\n * Note: this will use as-is any key starting with double __ (and not copy inside) some lib have circular dependencies.\r\n */\r\n static cloneDeep<T>(obj: T): T {\r\n // list of fields we will skip during cloneDeep (nested objects, other internal)\r\n const skipFields = ['parentGrid', 'el', 'grid', 'subGrid', 'engine'];\r\n // return JSON.parse(JSON.stringify(obj)); // doesn't work with date format ?\r\n const ret = Utils.clone(obj);\r\n for (const key in ret) {\r\n // NOTE: we don't support function/circular dependencies so skip those properties for now...\r\n if (ret.hasOwnProperty(key) && typeof(ret[key]) === 'object' && key.substring(0, 2) !== '__' && !skipFields.find(k => k === key)) {\r\n ret[key] = Utils.cloneDeep(obj[key]);\r\n }\r\n }\r\n return ret;\r\n }\r\n\r\n /** deep clone the given HTML node, removing teh unique id field */\r\n public static cloneNode(el: HTMLElement): HTMLElement {\r\n const node = el.cloneNode(true) as HTMLElement;\r\n node.removeAttribute('id');\r\n return node;\r\n }\r\n\r\n public static appendTo(el: HTMLElement, parent: string | HTMLElement): void {\r\n let parentNode: HTMLElement;\r\n if (typeof parent === 'string') {\r\n parentNode = Utils.getElement(parent);\r\n } else {\r\n parentNode = parent;\r\n }\r\n if (parentNode) {\r\n parentNode.appendChild(el);\r\n }\r\n }\r\n\r\n // public static setPositionRelative(el: HTMLElement): void {\r\n // if (!(/^(?:r|a|f)/).test(getComputedStyle(el).position)) {\r\n // el.style.position = \"relative\";\r\n // }\r\n // }\r\n\r\n public static addElStyles(el: HTMLElement, styles: { [prop: string]: string | string[] }): void {\r\n if (styles instanceof Object) {\r\n for (const s in styles) {\r\n if (styles.hasOwnProperty(s)) {\r\n if (Array.isArray(styles[s])) {\r\n // support fallback value\r\n (styles[s] as string[]).forEach(val => {\r\n el.style[s] = val;\r\n });\r\n } else {\r\n el.style[s] = styles[s];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n public static initEvent<T>(e: DragEvent | MouseEvent, info: { type: string; target?: EventTarget }): T {\r\n const evt = { type: info.type };\r\n const obj = {\r\n button: 0,\r\n which: 0,\r\n buttons: 1,\r\n bubbles: true,\r\n cancelable: true,\r\n target: info.target ? info.target : e.target\r\n };\r\n ['altKey','ctrlKey','metaKey','shiftKey'].forEach(p => evt[p] = e[p]); // keys\r\n ['pageX','pageY','clientX','clientY','screenX','screenY'].forEach(p => evt[p] = e[p]); // point info\r\n return {...evt, ...obj} as unknown as T;\r\n }\r\n\r\n /** copies the MouseEvent (or convert Touch) properties and sends it as another event to the given target */\r\n public static simulateMouseEvent(e: MouseEvent | Touch, simulatedType: string, target?: EventTarget): void {\r\n const me = e as MouseEvent;\r\n const simulatedEvent = new MouseEvent(simulatedType, {\r\n bubbles: true,\r\n composed: true,\r\n cancelable: true,\r\n view: window,\r\n detail: 1,\r\n screenX: e.screenX,\r\n screenY: e.screenY,\r\n clientX: e.clientX,\r\n clientY: e.clientY,\r\n ctrlKey: me.ctrlKey??false,\r\n altKey: me.altKey??false,\r\n shiftKey: me.shiftKey??false,\r\n metaKey: me.metaKey??false,\r\n button: 0,\r\n relatedTarget: e.target\r\n });\r\n\r\n (target || e.target).dispatchEvent(simulatedEvent);\r\n }\r\n\r\n /**\r\n * defines an element that is used to get the offset and scale from grid transforms\r\n * returns the scale and offsets from said element\r\n */\r\n public static getValuesFromTransformedElement(parent: HTMLElement): DragTransform {\r\n const transformReference = document.createElement('div');\r\n Utils.addElStyles(transformReference, {\r\n opacity: '0',\r\n position: 'fixed',\r\n top: 0 + 'px',\r\n left: 0 + 'px',\r\n width: '1px',\r\n height: '1px',\r\n zIndex: '-999999',\r\n });\r\n parent.appendChild(transformReference);\r\n const transformValues = transformReference.getBoundingClientRect();\r\n parent.removeChild(transformReference);\r\n transformReference.remove();\r\n return {\r\n xScale: 1 / transformValues.width,\r\n yScale: 1 / transformValues.height,\r\n xOffset: transformValues.left,\r\n yOffset: transformValues.top,\r\n }\r\n }\r\n\r\n /** swap the given object 2 field values */\r\n public static swap(o: unknown, a: string, b: string): void {\r\n if (!o) return;\r\n const tmp = o[a]; o[a] = o[b]; o[b] = tmp;\r\n }\r\n\r\n /** returns true if event is inside the given element rectangle */\r\n // Note: Safari Mac has null event.relatedTarget which causes #1684 so check if DragEvent is inside the coordinates instead\r\n // Utils.el.contains(event.relatedTarget as HTMLElement)\r\n // public static inside(e: MouseEvent, el: HTMLElement): boolean {\r\n // // srcElement, toElement, target: all set to placeholder when leaving simple grid, so we can't use that (Chrome)\r\n // const target: HTMLElement = e.relatedTarget || (e as any).fromElement;\r\n // if (!target) {\r\n // const { bottom, left, right, top } = el.getBoundingClientRect();\r\n // return (e.x < right && e.x > left && e.y < bottom && e.y > top);\r\n // }\r\n // return el.contains(target);\r\n // }\r\n\r\n /** true if the item can be rotated (checking for prop, not space available) */\r\n public static canBeRotated(n: GridStackNode): boolean {\r\n return !(!n || n.w === n.h || n.locked || n.noResize || n.grid?.opts.disableResize || (n.minW && n.minW === n.maxW) || (n.minH && n.minH === n.maxH));\r\n }\r\n}"]}
package/doc/API.md CHANGED
@@ -1,4 +1,4 @@
1
- # gridstack v12.4.0
1
+ # gridstack v12.4.1
2
2
 
3
3
  ## Classes
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gridstack",
3
- "version": "12.4.0",
3
+ "version": "12.4.1",
4
4
  "license": "MIT",
5
5
  "author": "Alain Dumesny <alaind831+github@gmail.com> (https://github.com/adumesny)",
6
6
  "contributors": [
@@ -1,5 +0,0 @@
1
- export * from './lib/types';
2
- export * from './lib/base-widget';
3
- export * from './lib/gridstack-item.component';
4
- export * from './lib/gridstack.component';
5
- export * from './lib/gridstack.module';
@@ -1,9 +0,0 @@
1
- /*
2
- * Public API Surface of gridstack-angular
3
- */
4
- export * from './lib/types';
5
- export * from './lib/base-widget';
6
- export * from './lib/gridstack-item.component';
7
- export * from './lib/gridstack.component';
8
- export * from './lib/gridstack.module';
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../angular/projects/lib/src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC","sourcesContent":["/*\n * Public API Surface of gridstack-angular\n */\n\nexport * from './lib/types';\nexport * from './lib/base-widget';\nexport * from './lib/gridstack-item.component';\nexport * from './lib/gridstack.component';\nexport * from './lib/gridstack.module';\n"]}