@threlte/flex 2.0.6 → 2.1.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/README.md CHANGED
@@ -50,10 +50,6 @@ Contributions are what make the open source community such an amazing place to l
50
50
  - **Filing Issues** - if you have feature requestions or you think you spotted a bug, [submit an issue](https://github.com/threlte/threlte/issues/new).
51
51
  - **Contributing Code** - if you would like to drop us a PR, read the [contribution guide](https://github.com/threlte/threlte/blob/main/CONTRIBUTING.md) first.
52
52
 
53
- ## Sponsors
54
-
55
- [![Powered by Vercel](./assets/vercel/powered-by-vercel.svg)](https://vercel.com/?utm_source=threlte&utm_campaign=oss)
56
-
57
53
  ---
58
54
 
59
55
  ### License
@@ -2,11 +2,11 @@
2
2
  import { T } from '@threlte/core'
3
3
  import { onDestroy } from 'svelte'
4
4
  import { Group, Object3D } from 'three'
5
- import { useFlex } from '../Flex/context'
6
- import { createUseDimensionsContext } from '../hooks/useDimensions'
7
- import type { NodeProps } from '../lib/props'
8
- import { createNodeContext } from '../nodes/context'
9
- import type { BoxProps } from './types'
5
+ import { useFlex } from '../Flex/context.js'
6
+ import { createUseDimensionsContext } from '../hooks/useDimensions.js'
7
+ import type { NodeProps } from '../lib/props.js'
8
+ import { createNodeContext } from '../nodes/context.js'
9
+ import type { BoxProps } from './types.js'
10
10
 
11
11
  let { order, class: _class = '', onreflow, children, ...props }: BoxProps = $props()
12
12
 
@@ -1,4 +1,4 @@
1
- import type { BoxProps } from './types';
1
+ import type { BoxProps } from './types.js';
2
2
  declare const Box: import("svelte").Component<BoxProps, {}, "">;
3
3
  type Box = ReturnType<typeof Box>;
4
4
  export default Box;
@@ -1,5 +1,5 @@
1
1
  import type { Snippet } from 'svelte';
2
- import type { NodeProps } from '../lib/props';
2
+ import type { NodeProps } from '../lib/props.js';
3
3
  export type BoxProps = NodeProps & {
4
4
  order?: number | undefined;
5
5
  class?: string;
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { loadYoga, type Yoga } from 'yoga-layout/load'
3
3
  import InnerFlex from './InnerFlex.svelte'
4
- import type { FlexProps } from './types'
4
+ import type { FlexProps } from './types.js'
5
5
 
6
6
  let { children: innerChildren, ref = $bindable(), ...props }: FlexProps = $props()
7
7
 
@@ -1,4 +1,4 @@
1
- import type { FlexProps } from './types';
1
+ import type { FlexProps } from './types.js';
2
2
  declare const Flex: import("svelte").Component<FlexProps, {}, "ref">;
3
3
  type Flex = ReturnType<typeof Flex>;
4
4
  export default Flex;
@@ -3,15 +3,15 @@
3
3
  import { onDestroy } from 'svelte'
4
4
  import { Box3, Group, Vector3 } from 'three'
5
5
  import { Direction } from 'yoga-layout'
6
- import { createUseDimensionsContext } from '../hooks/useDimensions'
7
- import { getDepthAxis } from '../lib/getDepthAxis'
8
- import { getOrientedBoundingBoxSize } from '../lib/getOrientedBoundingBoxSize'
9
- import { getRootShift } from '../lib/getRootShift'
10
- import { applyNodeProps, type Axis, type NodeProps } from '../lib/props'
11
- import { propsChanged } from '../lib/propsChanged'
12
- import { createNodeContext } from '../nodes/context'
13
- import { createFlexContext } from './context'
14
- import type { InnerFlexProps } from './types'
6
+ import { createUseDimensionsContext } from '../hooks/useDimensions.js'
7
+ import { getDepthAxis } from '../lib/getDepthAxis.js'
8
+ import { getOrientedBoundingBoxSize } from '../lib/getOrientedBoundingBoxSize.js'
9
+ import { getRootShift } from '../lib/getRootShift.js'
10
+ import { applyNodeProps, type Axis, type NodeProps } from '../lib/props.js'
11
+ import { propsChanged } from '../lib/propsChanged.js'
12
+ import { createNodeContext } from '../nodes/context.js'
13
+ import { createFlexContext } from './context.js'
14
+ import type { InnerFlexProps } from './types.js'
15
15
 
16
16
  let {
17
17
  yoga,
@@ -1,4 +1,4 @@
1
- import type { InnerFlexProps } from './types';
1
+ import type { InnerFlexProps } from './types.js';
2
2
  declare const InnerFlex: import("svelte").Component<InnerFlexProps, {}, "ref">;
3
3
  type InnerFlex = ReturnType<typeof InnerFlex>;
4
4
  export default InnerFlex;
@@ -1,9 +1,9 @@
1
1
  import type { CurrentWritable } from '@threlte/core';
2
- import { type Emitter } from 'mitt';
2
+ import type { Emitter } from 'mitt';
3
3
  import type { Group } from 'three';
4
4
  import type { Node } from 'yoga-layout';
5
5
  import type Yoga from 'yoga-layout';
6
- import type { Axis, ClassParser, NodeProps } from '../lib/props';
6
+ import type { Axis, ClassParser, NodeProps } from '../lib/props.js';
7
7
  type FlexContextEvents = {
8
8
  'reflow:before': void;
9
9
  'reflow:after': void;
@@ -1,4 +1,7 @@
1
- import mitt, {} from 'mitt';
1
+ // We need to cast here because TypeScript with "moduleResolution": "NodeNext"
2
+ // fails to resolve the default export otherwise.
3
+ import mittModule from 'mitt';
4
+ const mitt = mittModule;
2
5
  import { getContext, onDestroy, setContext } from 'svelte';
3
6
  export const flexContextName = '__threlte-flex';
4
7
  export const createFlexContext = (data) => {
@@ -3,7 +3,7 @@ import type { Snippet } from 'svelte';
3
3
  import type { Group } from 'three';
4
4
  import type Yoga from 'yoga-layout';
5
5
  import type { Direction } from 'yoga-layout';
6
- import type { ClassParser, FlexPlane, NodeProps } from '../lib/props';
6
+ import type { ClassParser, FlexPlane, NodeProps } from '../lib/props.js';
7
7
  export type InnerFlexProps = NodeProps & {
8
8
  yoga: typeof Yoga;
9
9
  width?: number;
@@ -1,5 +1,5 @@
1
1
  import { getContext } from 'svelte';
2
- import { flexContextName } from '../Flex/context';
2
+ import { flexContextName } from '../Flex/context.js';
3
3
  /**
4
4
  * The hook useReflow allows you to manually request a [layout
5
5
  * reflow](https://threlte.xyz/docs/reference/flex/flex#layout-reflow), for
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { default as Box } from './Box/Box.svelte';
2
2
  export { default as Flex } from './Flex/Flex.svelte';
3
- export type { NodeProps } from './lib/props';
4
- export { createClassParser } from './parsers/createClassParser';
5
- export { tailwindParser } from './parsers/tailwindParser';
6
- export { useReflow } from './hooks/useReflow';
7
- export { useDimensions } from './hooks/useDimensions';
3
+ export type { NodeProps } from './lib/props.js';
4
+ export { createClassParser } from './parsers/createClassParser.js';
5
+ export { tailwindParser } from './parsers/tailwindParser.js';
6
+ export { useReflow } from './hooks/useReflow.js';
7
+ export { useDimensions } from './hooks/useDimensions.js';
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export { default as Box } from './Box/Box.svelte';
2
2
  export { default as Flex } from './Flex/Flex.svelte';
3
3
  // parsers
4
- export { createClassParser } from './parsers/createClassParser';
5
- export { tailwindParser } from './parsers/tailwindParser';
4
+ export { createClassParser } from './parsers/createClassParser.js';
5
+ export { tailwindParser } from './parsers/tailwindParser.js';
6
6
  // hooks
7
- export { useReflow } from './hooks/useReflow';
8
- export { useDimensions } from './hooks/useDimensions';
7
+ export { useReflow } from './hooks/useReflow.js';
8
+ export { useDimensions } from './hooks/useDimensions.js';
@@ -1,4 +1,4 @@
1
- import type { NodeProps } from './props';
1
+ import type { NodeProps } from './props.js';
2
2
  /**
3
3
  * This function will align the flex props to the web-standard.
4
4
  *
@@ -1,2 +1,2 @@
1
- import type { FlexPlane } from './props';
1
+ import type { FlexPlane } from './props.js';
2
2
  export declare function getDepthAxis(plane: FlexPlane): "x" | "y" | "z";
@@ -1,2 +1,2 @@
1
- import type { FlexPlane } from './props';
1
+ import type { FlexPlane } from './props.js';
2
2
  export declare function getFlex2DSize(sizes: [number, number, number], plane: FlexPlane): number[];
@@ -1,4 +1,4 @@
1
- import { isTopLevelChildNode } from './isTopLevelChildNode';
1
+ import { isTopLevelChildNode } from './isTopLevelChildNode.js';
2
2
  /** @returns [mainAxisShift, crossAxisShift] */
3
3
  export const getRootShift = (rootWidth, rootHeight, node) => {
4
4
  if (!isTopLevelChildNode(node)) {
package/dist/lib/props.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as Yoga from 'yoga-layout';
2
- import { alignFlexProps } from './alignFlexProps';
2
+ import { alignFlexProps } from './alignFlexProps.js';
3
3
  // prettier-ignore
4
4
  /**
5
5
  * This map provides the prop setters as well as the types for the props. The
@@ -1,5 +1,5 @@
1
1
  import type { Node } from 'yoga-layout';
2
- import type { NodeProps } from './props';
2
+ import type { NodeProps } from './props.js';
3
3
  /**
4
4
  * Because all NodeProps are primitive types, we can make a simple comparison
5
5
  * and only request a reflow when necessary. We do that by checking the length
@@ -1,5 +1,5 @@
1
1
  import { getContext, setContext } from 'svelte';
2
- import { useReflow } from '..';
2
+ import { useReflow } from '../hooks/useReflow.js';
3
3
  export const nodeContextName = '__threlte-node';
4
4
  export const createNodeContext = (node) => {
5
5
  const reflow = useReflow();
@@ -1,4 +1,4 @@
1
- import type { ClassParser } from '../lib/props';
1
+ import type { ClassParser } from '../lib/props.js';
2
2
  /**
3
3
  * This function is a type helper for creating a class parser. A class parser is
4
4
  * a function that takes a class name and returns a NodeProps object. This can
@@ -1 +1 @@
1
- export declare const tailwindParser: import("../lib/props").ClassParser;
1
+ export declare const tailwindParser: import("../lib/props.js").ClassParser;
@@ -1,4 +1,4 @@
1
- import { createClassParser } from './createClassParser';
1
+ import { createClassParser } from './createClassParser.js';
2
2
  const parseNumericOrAutoOrPercentageValue = (value) => {
3
3
  if (value === 'auto') {
4
4
  return value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threlte/flex",
3
- "version": "2.0.6",
3
+ "version": "2.1.0",
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",
@@ -28,8 +28,8 @@
28
28
  "typescript": "5.9.2",
29
29
  "typescript-eslint": "^8.32.0",
30
30
  "vite": "^7.1.4",
31
- "@threlte/core": "8.1.5",
32
- "@threlte/extras": "9.5.4"
31
+ "@threlte/core": "8.3.0",
32
+ "@threlte/extras": "9.7.0"
33
33
  },
34
34
  "dependencies": {
35
35
  "mitt": "^3.0.1",