@appnest/masonry-layout
Advanced tools
Comparing version 0.0.16 to 0.0.17
@@ -18,3 +18,3 @@ import { MasonryCols } from "./masonry-helpers"; | ||
private cancelNextResizeEvent; | ||
private itemCache; | ||
private layoutCache; | ||
/** | ||
@@ -61,3 +61,4 @@ * The maximum width of each column if cols are set to auto. | ||
/** | ||
* All of the elements in the slot that are not text nodes. | ||
* All of the elements in the slot that are an Node.ELEMENT_NODE. | ||
* https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType | ||
*/ | ||
@@ -64,0 +65,0 @@ private readonly $items; |
@@ -46,3 +46,3 @@ import { createEmptyColHeightMap, debounce, DEFAULT_COLS, DEFAULT_DEBOUNCE_MS, DEFAULT_MAX_COL_WIDTH, DEFAULT_SPACING, DISTRIBUTED_ATTR, getBooleanAttribute, getColCount, getColWidth, getNumberAttribute, getShortestCol, itemPosition, setBooleanAttribute, tallestColHeight } from "./masonry-helpers"; | ||
this.cancelNextResizeEvent = false; | ||
this.itemCache = new WeakMap(); | ||
this.layoutCache = new WeakMap(); | ||
// Bind the relevant functions to the element | ||
@@ -137,7 +137,8 @@ this.scheduleLayout = this.scheduleLayout.bind(this); | ||
/** | ||
* All of the elements in the slot that are not text nodes. | ||
* All of the elements in the slot that are an Node.ELEMENT_NODE. | ||
* https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType | ||
*/ | ||
get $items() { | ||
return this.$slot.assignedNodes().filter(node => { | ||
return node.nodeName !== "#text"; | ||
return node.nodeType === 1; | ||
}); | ||
@@ -229,3 +230,3 @@ } | ||
// Find the shortest col (we need to prioritize filling that one) or used the existing (locked) one | ||
const currentLayout = this.itemCache.get($item); | ||
const currentLayout = this.layoutCache.get($item); | ||
const col = colLock && !reorderCols && currentLayout != null ? currentLayout.col : getShortestCol(colHeightMap); | ||
@@ -237,3 +238,3 @@ // Compute the position for the item | ||
(currentLayout.colWidth !== colWidth || currentLayout.left !== left || currentLayout.top !== top || currentLayout.col !== col)) { | ||
this.itemCache.set($item, { left, top, col, colWidth }); | ||
this.layoutCache.set($item, { left, top, col, colWidth }); | ||
// WRITE: Assign the new position. | ||
@@ -240,0 +241,0 @@ Object.assign($item.style, { |
{ | ||
"name": "@appnest/masonry-layout", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"license": "MIT", | ||
@@ -44,5 +44,5 @@ "module": "index.js", | ||
"postversion": "npm run readme && npm run b:lib", | ||
"publish:patch": "np patch --contents=dist", | ||
"publish:minor": "np minor --contents=dist", | ||
"publish:major": "np major --contents=dist" | ||
"publish:patch": "np patch --contents=dist --no-cleanup", | ||
"publish:minor": "np minor --contents=dist --no-cleanup", | ||
"publish:major": "np major --contents=dist --no-cleanup" | ||
}, | ||
@@ -49,0 +49,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36386
564