masua 0.11.1 → 0.11.3
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/README.md +1 -1
- package/index.ts +3 -2
- package/package.json +47 -5
- package/react.tsx +1 -0
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Simple masonry layout library in TypeScript. Initially forked from [minimasonry]
|
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
|
-
⚠️ This plugin is published as TypeScript and JSX (for the React plugin) see [this post on 𝕏](https://twitter.com/matthiasgiger/status/1766443368567971946) for the reasoning. Make sure to add the necessary types listed below if they are missing in your project and align your
|
|
14
|
+
⚠️ This plugin is published as TypeScript and JSX (for the React plugin) see [this post on 𝕏](https://twitter.com/matthiasgiger/status/1766443368567971946) for the reasoning. Make sure to add the necessary types listed below if they are missing in your project and align your `tsconfig.json` with `{ compilerOptions: { lib: ['DOM', 'ES2020'], module: 'Preserve', jsx: 'react-jsx' }}` as used for this project. React is only required when the `masua/react` export is used.
|
|
15
15
|
|
|
16
16
|
```sh
|
|
17
17
|
bun install masua
|
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
|
|
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
|
-
|
|
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.
|
|
4
|
+
"version": "0.11.3",
|
|
5
5
|
"repository": "github:tobua/masua",
|
|
6
6
|
"homepage": "https://tobua.github.io/masua",
|
|
7
7
|
"license": "MIT",
|
|
@@ -15,10 +15,11 @@
|
|
|
15
15
|
"types": "tsc --noEmit"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@biomejs/biome": "^1.
|
|
19
|
-
"@types/bun": "^1.0
|
|
20
|
-
"@types/react": "^18.2.
|
|
21
|
-
"typescript": "^5.4.5"
|
|
18
|
+
"@biomejs/biome": "^1.7.1",
|
|
19
|
+
"@types/bun": "^1.1.0",
|
|
20
|
+
"@types/react": "^18.2.79",
|
|
21
|
+
"typescript": "^5.4.5",
|
|
22
|
+
"zero-configuration": "^0.3.1"
|
|
22
23
|
},
|
|
23
24
|
"peerDependencies": {
|
|
24
25
|
"react": ">= 18",
|
|
@@ -29,6 +30,9 @@
|
|
|
29
30
|
"optional": true
|
|
30
31
|
}
|
|
31
32
|
},
|
|
33
|
+
"trustedDependencies": [
|
|
34
|
+
"zero-configuration"
|
|
35
|
+
],
|
|
32
36
|
"type": "module",
|
|
33
37
|
"sideEffects": false,
|
|
34
38
|
"main": "./index.ts",
|
|
@@ -58,5 +62,43 @@
|
|
|
58
62
|
},
|
|
59
63
|
"engines": {
|
|
60
64
|
"node": ">= 18"
|
|
65
|
+
},
|
|
66
|
+
"configuration": {
|
|
67
|
+
"gitignore": "recommended",
|
|
68
|
+
"vscode": "recommended",
|
|
69
|
+
"typescript": {
|
|
70
|
+
"compilerOptions": {
|
|
71
|
+
"strict": true,
|
|
72
|
+
"skipLibCheck": true,
|
|
73
|
+
"lib": [
|
|
74
|
+
"DOM",
|
|
75
|
+
"ES2020"
|
|
76
|
+
],
|
|
77
|
+
"module": "Preserve",
|
|
78
|
+
"jsx": "react-jsx"
|
|
79
|
+
},
|
|
80
|
+
"files": [
|
|
81
|
+
"index.ts",
|
|
82
|
+
"react.tsx"
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
"biome": {
|
|
86
|
+
"extends": "recommended",
|
|
87
|
+
"linter": {
|
|
88
|
+
"rules": {
|
|
89
|
+
"nursery": {
|
|
90
|
+
"all": true
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"ignore": [
|
|
94
|
+
"demo"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
"formatter": {
|
|
98
|
+
"ignore": [
|
|
99
|
+
"demo"
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
}
|
|
61
103
|
}
|
|
62
104
|
}
|
package/react.tsx
CHANGED