masua 0.11.1 → 0.11.2

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 (3) hide show
  1. package/index.ts +3 -2
  2. package/package.json +2 -2
  3. package/react.tsx +1 -0
package/index.ts CHANGED
@@ -39,7 +39,7 @@ interface NumberConfiguration extends Configuration {
39
39
  singleColumnGutter: number
40
40
  }
41
41
 
42
- const log = (message: string) => console.log(`masua: ${message}.`)
42
+ const log = (message: string, type: 'log' | 'error' = 'log') => console[type](`masua: ${message}.`)
43
43
 
44
44
  function getCount(state: State) {
45
45
  if (state.surroundingGutter) {
@@ -113,7 +113,7 @@ function computeWidth(state: State) {
113
113
  // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: TODO decrease complexity
114
114
  function layout(state: State) {
115
115
  if (!state.container) {
116
- console.error('Container not found')
116
+ log('Container not found', 'error')
117
117
  return
118
118
  }
119
119
  reset(state)
@@ -177,6 +177,7 @@ function layout(state: State) {
177
177
  const y = state.columns[nextColumn]
178
178
  const child = children[index] as HTMLElement
179
179
  child.style.transform = `translate3d(${Math.round(x)}px,${Math.round(y)}px,0)`
180
+ child.style.position = 'absolute'
180
181
 
181
182
  state.columns[nextColumn] += state.sizes[index] + (state.count > 1 ? state.gutterY : state.singleColumnGutter) // margin-bottom
182
183
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "masua",
3
3
  "description": "Simple masonry layout library in TypeScript.",
4
- "version": "0.11.1",
4
+ "version": "0.11.2",
5
5
  "repository": "github:tobua/masua",
6
6
  "homepage": "https://tobua.github.io/masua",
7
7
  "license": "MIT",
@@ -17,7 +17,7 @@
17
17
  "devDependencies": {
18
18
  "@biomejs/biome": "^1.6.4",
19
19
  "@types/bun": "^1.0.12",
20
- "@types/react": "^18.2.76",
20
+ "@types/react": "^18.2.78",
21
21
  "typescript": "^5.4.5"
22
22
  },
23
23
  "peerDependencies": {
package/react.tsx CHANGED
@@ -1,3 +1,4 @@
1
+ // biome-ignore lint/nursery/noUndeclaredDependencies: This is a reference to the local package.
1
2
  import { type Configuration, grid } from 'masua'
2
3
  import { type JSX, useEffect, useMemo, useRef } from 'react'
3
4