@threlte/flex 2.0.0-next.10 → 2.0.0-next.11
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/Box/Box.svelte.d.ts +4 -21
- package/dist/Box/types.d.ts +17 -0
- package/dist/Box/types.js +1 -0
- package/dist/Flex/Flex.svelte +2 -1
- package/dist/Flex/Flex.svelte.d.ts +4 -7
- package/dist/Flex/InnerFlex.svelte.d.ts +4 -32
- package/dist/Flex/context.d.ts +3 -2
- package/dist/Flex/types.d.ts +30 -0
- package/dist/Flex/types.js +1 -0
- package/package.json +2 -2
package/dist/Box/Box.svelte.d.ts
CHANGED
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
order?: number | undefined
|
|
6
|
-
class?: string
|
|
7
|
-
|
|
8
|
-
children?: Snippet<
|
|
9
|
-
[
|
|
10
|
-
{
|
|
11
|
-
reflow: () => void
|
|
12
|
-
width: number
|
|
13
|
-
height: number
|
|
14
|
-
}
|
|
15
|
-
]
|
|
16
|
-
>
|
|
17
|
-
|
|
18
|
-
onreflow?: (event: { width: number; height: number }) => void
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default class Box extends SvelteComponent<BoxProps> {}
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
|
+
import type { BoxProps } from './types';
|
|
3
|
+
declare const Box: import("svelte").Component<BoxProps, {}, "">;
|
|
4
|
+
export default Box;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
import type { NodeProps } from '../lib/props';
|
|
3
|
+
export type BoxProps = NodeProps & {
|
|
4
|
+
order?: number | undefined;
|
|
5
|
+
class?: string;
|
|
6
|
+
children?: Snippet<[
|
|
7
|
+
{
|
|
8
|
+
reflow: () => void;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}
|
|
12
|
+
]>;
|
|
13
|
+
onreflow?: (event: {
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
}) => void;
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Flex/Flex.svelte
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">import { loadYoga } from 'yoga-layout/load';
|
|
2
2
|
import InnerFlex from './InnerFlex.svelte';
|
|
3
|
-
let { children: innerChildren, ...props } = $props();
|
|
3
|
+
let { children: innerChildren, ref = $bindable(), ...props } = $props();
|
|
4
4
|
let yoga = $state(undefined);
|
|
5
5
|
const initialize = async () => {
|
|
6
6
|
yoga = await loadYoga();
|
|
@@ -11,6 +11,7 @@ initialize();
|
|
|
11
11
|
{#if yoga}
|
|
12
12
|
<InnerFlex
|
|
13
13
|
{yoga}
|
|
14
|
+
bind:ref
|
|
14
15
|
{...props}
|
|
15
16
|
>
|
|
16
17
|
{#snippet children({ reflow, width, height })}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type FlexProps = Omit<ComponentProps<InnerFlex>, 'yoga'>
|
|
6
|
-
|
|
7
|
-
export default class Flex extends SvelteComponent<FlexProps> {}
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
|
+
import type { FlexProps } from './types';
|
|
3
|
+
declare const Flex: import("svelte").Component<FlexProps, {}, "ref">;
|
|
4
|
+
export default Flex;
|
|
@@ -1,32 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import type { Group } from 'three'
|
|
6
|
-
|
|
7
|
-
type InnerFlexProps = NodeProps & {
|
|
8
|
-
yoga: Yoga
|
|
9
|
-
width?: number
|
|
10
|
-
height?: number
|
|
11
|
-
plane?: FlexPlane
|
|
12
|
-
direction?: keyof typeof Direction
|
|
13
|
-
scaleFactor?: number
|
|
14
|
-
class?: string
|
|
15
|
-
classParser?: ClassParser
|
|
16
|
-
reflowStage?: Stage
|
|
17
|
-
ref?: Group
|
|
18
|
-
|
|
19
|
-
children?: Snippet<
|
|
20
|
-
[
|
|
21
|
-
{
|
|
22
|
-
reflow: () => void
|
|
23
|
-
width: number
|
|
24
|
-
height: number
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
>
|
|
28
|
-
|
|
29
|
-
onreflow?: (event: { width: number; height: number }) => void
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export default class InnerFlex extends SvelteComponent<InnerFlexProps> {}
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
|
+
import type { InnerFlexProps } from './types';
|
|
3
|
+
declare const InnerFlex: import("svelte").Component<InnerFlexProps, {}, "ref">;
|
|
4
|
+
export default InnerFlex;
|
package/dist/Flex/context.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { CurrentWritable } from '@threlte/core';
|
|
2
2
|
import { type Emitter } from 'mitt';
|
|
3
3
|
import type { Group } from 'three';
|
|
4
|
-
import type { Node
|
|
4
|
+
import type { Node } from 'yoga-layout';
|
|
5
|
+
import type Yoga from 'yoga-layout';
|
|
5
6
|
import type { Axis, ClassParser, NodeProps } from '../lib/props';
|
|
6
7
|
type FlexContextEvents = {
|
|
7
8
|
'reflow:before': void;
|
|
@@ -13,7 +14,7 @@ type FlexContextNode = {
|
|
|
13
14
|
props: NodeProps;
|
|
14
15
|
};
|
|
15
16
|
export type FlexContextData = {
|
|
16
|
-
yoga: Yoga;
|
|
17
|
+
yoga: typeof Yoga;
|
|
17
18
|
nodes: Map<Node, FlexContextNode>;
|
|
18
19
|
addNode: (node: Node, group: Group, props: NodeProps) => void;
|
|
19
20
|
updateNodeProps: (node: Node, props: NodeProps, force?: boolean) => void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Stage } from '@threlte/core';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { Group } from 'three';
|
|
4
|
+
import type Yoga from 'yoga-layout';
|
|
5
|
+
import type { Direction } from 'yoga-layout';
|
|
6
|
+
import type { ClassParser, FlexPlane, NodeProps } from '../lib/props';
|
|
7
|
+
export type InnerFlexProps = NodeProps & {
|
|
8
|
+
yoga: typeof Yoga;
|
|
9
|
+
width?: number;
|
|
10
|
+
height?: number;
|
|
11
|
+
plane?: FlexPlane;
|
|
12
|
+
direction?: keyof typeof Direction;
|
|
13
|
+
scaleFactor?: number;
|
|
14
|
+
class?: string;
|
|
15
|
+
classParser?: ClassParser;
|
|
16
|
+
reflowStage?: Stage;
|
|
17
|
+
ref?: Group;
|
|
18
|
+
children?: Snippet<[
|
|
19
|
+
{
|
|
20
|
+
reflow: () => void;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
}
|
|
24
|
+
]>;
|
|
25
|
+
onreflow?: (event: {
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
}) => void;
|
|
29
|
+
};
|
|
30
|
+
export type FlexProps = Omit<InnerFlexProps, 'yoga'>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@threlte/flex",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.11",
|
|
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",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"typescript": "^5.4.5",
|
|
31
31
|
"vite": "^5.2.8",
|
|
32
32
|
"@threlte/core": "8.0.0-next.23",
|
|
33
|
-
"@threlte/extras": "9.0.0-next.
|
|
33
|
+
"@threlte/extras": "9.0.0-next.33"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"mitt": "^3.0.1",
|