@threlte/flex 2.0.1 → 2.0.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/dist/Flex/Flex.svelte
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">import { loadYoga } from 'yoga-layout/load';
|
|
2
2
|
import InnerFlex from './InnerFlex.svelte';
|
|
3
3
|
let { children: innerChildren, ref = $bindable(), ...props } = $props();
|
|
4
|
-
let yoga = $state(
|
|
4
|
+
let yoga = $state();
|
|
5
5
|
const initialize = async () => {
|
|
6
6
|
yoga = await loadYoga();
|
|
7
7
|
};
|
|
@@ -111,7 +111,8 @@ const rootNode = yoga.Node.create();
|
|
|
111
111
|
createNodeContext(rootNode);
|
|
112
112
|
const { mainAxis, crossAxis, depthAxis } = flexContext;
|
|
113
113
|
$effect.pre(() => {
|
|
114
|
-
rootNode.setWidth(width * scaleFactor)
|
|
114
|
+
rootNode.setWidth(width * scaleFactor);
|
|
115
|
+
rootNode.setHeight(height * scaleFactor);
|
|
115
116
|
});
|
|
116
117
|
flexContext.updateNodeProps(rootNode, { ...classParser?.(_class, {}), ...props }, true);
|
|
117
118
|
$effect.pre(() => {
|
|
@@ -164,10 +164,11 @@ export const tailwindParser = createClassParser((string, props) => {
|
|
|
164
164
|
case 'flex-nowrap':
|
|
165
165
|
props.flexWrap = 'NoWrap';
|
|
166
166
|
break;
|
|
167
|
-
default:
|
|
167
|
+
default: {
|
|
168
168
|
// flex shorthand
|
|
169
169
|
const [, value] = className.split('-');
|
|
170
170
|
props.flex = Number(value);
|
|
171
|
+
}
|
|
171
172
|
}
|
|
172
173
|
return;
|
|
173
174
|
}
|
|
@@ -319,10 +320,11 @@ export const tailwindParser = createClassParser((string, props) => {
|
|
|
319
320
|
case 'aspect-portrait':
|
|
320
321
|
props.aspectRatio = 9 / 16;
|
|
321
322
|
break;
|
|
322
|
-
default:
|
|
323
|
+
default: {
|
|
323
324
|
const [, value] = className.split('-');
|
|
324
325
|
const [width, height] = value.split('/');
|
|
325
326
|
props.aspectRatio = Number(width) / Number(height);
|
|
327
|
+
}
|
|
326
328
|
}
|
|
327
329
|
}
|
|
328
330
|
});
|
package/package.json
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@threlte/flex",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"author": "Grischa Erbe <hello@legrisch.com> (https://legrisch.com)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Components to easily use the flexbox spec with Threlte",
|
|
7
7
|
"devDependencies": {
|
|
8
|
+
"@eslint/js": "^9.26.0",
|
|
8
9
|
"@sveltejs/adapter-auto": "^3.3.1",
|
|
9
10
|
"@sveltejs/kit": "^2.7.7",
|
|
10
11
|
"@sveltejs/package": "^2.3.7",
|
|
11
12
|
"@sveltejs/vite-plugin-svelte": "^4.0.0",
|
|
12
13
|
"@types/node": "^20.12.7",
|
|
13
14
|
"@types/three": "^0.175.0",
|
|
14
|
-
"@typescript-eslint/eslint-plugin": "^7.6.0",
|
|
15
|
-
"@typescript-eslint/parser": "^7.6.0",
|
|
16
15
|
"@yushijinhun/three-minifier-rollup": "^0.4.0",
|
|
17
|
-
"eslint": "^9.
|
|
18
|
-
"eslint-
|
|
19
|
-
"
|
|
16
|
+
"eslint": "^9.26.0",
|
|
17
|
+
"eslint-plugin-svelte": "^3.5.1",
|
|
18
|
+
"globals": "^16.1.0",
|
|
20
19
|
"prettier": "^3.2.5",
|
|
21
20
|
"prettier-plugin-svelte": "^3.2.2",
|
|
22
21
|
"publint": "^0.2.7",
|
|
23
22
|
"rimraf": "^5.0.5",
|
|
24
23
|
"svelte": "^5.26.2",
|
|
25
|
-
"svelte-check": "^
|
|
24
|
+
"svelte-check": "^4.1.7",
|
|
26
25
|
"svelte-preprocess": "^5.1.3",
|
|
27
26
|
"svelte2tsx": "^0.7.6",
|
|
28
27
|
"three": "^0.175.0",
|
|
29
28
|
"tslib": "^2.6.2",
|
|
30
29
|
"typescript": "^5.6.3",
|
|
30
|
+
"typescript-eslint": "^8.32.0",
|
|
31
31
|
"vite": "^5.2.8",
|
|
32
|
-
"@threlte/core": "8.0.
|
|
33
|
-
"@threlte/extras": "9.1
|
|
32
|
+
"@threlte/core": "8.0.4",
|
|
33
|
+
"@threlte/extras": "9.2.1"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"mitt": "^3.0.1",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"package": "svelte-kit sync && svelte-package && node ./scripts/cleanupPackage.js && publint",
|
|
75
75
|
"check": "svelte-check --tsconfig ./tsconfig.json",
|
|
76
76
|
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
|
77
|
-
"lint": "prettier --check .",
|
|
77
|
+
"lint": "prettier --check . && eslint .",
|
|
78
78
|
"format": "prettier --write .",
|
|
79
79
|
"cleanup": "rimraf node_modules .svelte-kit dist"
|
|
80
80
|
}
|
package/dist/stores/yoga.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const yoga: import("@threlte/core").CurrentWritable<any>;
|
package/dist/stores/yoga.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { currentWritable } from '@threlte/core';
|
|
2
|
-
import { loadYoga } from 'yoga-layout';
|
|
3
|
-
let loading = false;
|
|
4
|
-
let loaded = false;
|
|
5
|
-
export const yoga = currentWritable(undefined);
|
|
6
|
-
const load = async () => {
|
|
7
|
-
if (loading || loaded)
|
|
8
|
-
return;
|
|
9
|
-
const yogaInstance = await loadYoga();
|
|
10
|
-
yoga.set(yogaInstance);
|
|
11
|
-
};
|
|
12
|
-
load();
|