masua 0.11.7 → 0.12.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/LICENSE.md +1 -1
- package/index.ts +1 -0
- package/package.json +39 -22
- package/react.tsx +4 -3
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026 Matthias Giger, 2017 Spope
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/index.ts
CHANGED
|
@@ -40,6 +40,7 @@ interface NumberConfiguration extends Configuration {
|
|
|
40
40
|
singleColumnGutter: number
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
// biome-ignore lint/suspicious/noConsole: User feedback.
|
|
43
44
|
const log = (message: string, type: 'log' | 'error' = 'log') => console[type](`masua: ${message}.`)
|
|
44
45
|
|
|
45
46
|
function getCount(state: State) {
|
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.
|
|
4
|
+
"version": "0.12.0",
|
|
5
5
|
"repository": "github:tobua/masua",
|
|
6
6
|
"homepage": "https://tobua.github.io/masua",
|
|
7
7
|
"license": "MIT",
|
|
@@ -11,18 +11,22 @@
|
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
13
|
"check": "biome check --write .",
|
|
14
|
-
"types": "tsc"
|
|
14
|
+
"types": "tsc && tsc --project ./test/tsconfig.json"
|
|
15
15
|
},
|
|
16
|
+
"workspaces": [
|
|
17
|
+
"demo"
|
|
18
|
+
],
|
|
16
19
|
"devDependencies": {
|
|
17
|
-
"@biomejs/biome": "^1.
|
|
18
|
-
"@
|
|
19
|
-
"@types/
|
|
20
|
-
"
|
|
21
|
-
"
|
|
20
|
+
"@biomejs/biome": "^2.1.4",
|
|
21
|
+
"@happy-dom/global-registrator": "^20.8.9",
|
|
22
|
+
"@types/bun": "^1.2.19",
|
|
23
|
+
"@types/react": "^19.1.9",
|
|
24
|
+
"typescript": "^5.9.2",
|
|
25
|
+
"zero-configuration": "^1.0.5"
|
|
22
26
|
},
|
|
23
27
|
"peerDependencies": {
|
|
24
28
|
"react": ">= 18",
|
|
25
|
-
"typescript": ">=
|
|
29
|
+
"typescript": ">= 6"
|
|
26
30
|
},
|
|
27
31
|
"peerDependenciesMeta": {
|
|
28
32
|
"react": {
|
|
@@ -32,9 +36,6 @@
|
|
|
32
36
|
"trustedDependencies": [
|
|
33
37
|
"zero-configuration"
|
|
34
38
|
],
|
|
35
|
-
"workspaces": [
|
|
36
|
-
"demo"
|
|
37
|
-
],
|
|
38
39
|
"type": "module",
|
|
39
40
|
"sideEffects": false,
|
|
40
41
|
"main": "./index.ts",
|
|
@@ -77,21 +78,37 @@
|
|
|
77
78
|
}
|
|
78
79
|
]
|
|
79
80
|
},
|
|
80
|
-
"typescript":
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
"
|
|
81
|
+
"typescript": [
|
|
82
|
+
{
|
|
83
|
+
"extends": "plugin",
|
|
84
|
+
"compilerOptions": {
|
|
85
|
+
"jsx": "react-jsx"
|
|
86
|
+
},
|
|
87
|
+
"files": [
|
|
88
|
+
"index.ts",
|
|
89
|
+
"react.tsx"
|
|
90
|
+
]
|
|
84
91
|
},
|
|
85
|
-
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
92
|
+
{
|
|
93
|
+
"extends": "web",
|
|
94
|
+
"folder": "test",
|
|
95
|
+
"compilerOptions": {
|
|
96
|
+
"types": [
|
|
97
|
+
"bun",
|
|
98
|
+
"react"
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
"includes": [
|
|
102
|
+
"*.test.tsx"
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
],
|
|
90
106
|
"biome": {
|
|
91
107
|
"extends": "recommended",
|
|
92
108
|
"files": {
|
|
93
|
-
"
|
|
94
|
-
"
|
|
109
|
+
"includes": [
|
|
110
|
+
"**/*",
|
|
111
|
+
"!demo/**"
|
|
95
112
|
]
|
|
96
113
|
}
|
|
97
114
|
}
|
package/react.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Configuration, grid } from 'masua'
|
|
2
|
-
import
|
|
2
|
+
import type React from 'react'
|
|
3
|
+
import { useEffect, useRef } from 'react'
|
|
3
4
|
|
|
4
5
|
interface ReactConfiguration extends Configuration {
|
|
5
6
|
disabled: boolean
|
|
@@ -17,11 +18,11 @@ const configurationProperties = [
|
|
|
17
18
|
'wedge',
|
|
18
19
|
]
|
|
19
20
|
|
|
20
|
-
export function Grid({ disabled = false, children, ...props }: JSX.IntrinsicElements['div'] & Partial<ReactConfiguration>) {
|
|
21
|
+
export function Grid({ disabled = false, children, ...props }: React.JSX.IntrinsicElements['div'] & Partial<ReactConfiguration>) {
|
|
21
22
|
const gridRef = useRef(null)
|
|
22
23
|
const instance = useRef<ReturnType<typeof grid> | null>(null)
|
|
23
24
|
// TODO props changes on every render, cannot be memoized, should do deep compare.
|
|
24
|
-
const configurationProps = Object.entries(props).reduce((result: { [
|
|
25
|
+
const configurationProps = Object.entries(props).reduce((result: { [resultKey: string]: string }, [key, value]) => {
|
|
25
26
|
if (configurationProperties.includes(key)) {
|
|
26
27
|
result[key] = value
|
|
27
28
|
// @ts-ignore
|