@revideo/2d 0.10.2 → 0.10.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/editor/editor/tsconfig.build.tsbuildinfo +1 -1
- package/lib/components/Txt.d.ts +2 -1
- package/lib/components/Txt.d.ts.map +1 -1
- package/lib/components/Txt.js +5 -2
- package/lib/components/TxtLeaf.d.ts +2 -1
- package/lib/components/TxtLeaf.d.ts.map +1 -1
- package/lib/components/TxtLeaf.js +9 -2
- package/lib/jsx-runtime.d.ts +1 -1
- package/lib/jsx-runtime.d.ts.map +1 -1
- package/lib/jsx-runtime.js +2 -2
- package/lib/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/lib/components/Txt.ts +3 -1
- package/src/lib/components/TxtLeaf.ts +11 -1
- package/src/lib/jsx-runtime.ts +2 -1
|
@@ -11,7 +11,7 @@ import {is} from '../utils';
|
|
|
11
11
|
import type {Node} from './Node';
|
|
12
12
|
import type {ShapeProps} from './Shape';
|
|
13
13
|
import {Shape} from './Shape';
|
|
14
|
-
import {TxtLeaf} from './TxtLeaf';
|
|
14
|
+
import {TXT_TYPE, TxtLeaf} from './TxtLeaf';
|
|
15
15
|
import type {ComponentChildren} from './types';
|
|
16
16
|
|
|
17
17
|
type TxtChildren = string | Node | (string | Node)[];
|
|
@@ -24,6 +24,8 @@ export interface TxtProps extends ShapeProps {
|
|
|
24
24
|
|
|
25
25
|
@nodeName('Txt')
|
|
26
26
|
export class Txt extends Shape {
|
|
27
|
+
public readonly [TXT_TYPE] = true;
|
|
28
|
+
|
|
27
29
|
/**
|
|
28
30
|
* Create a bold text node.
|
|
29
31
|
*
|
|
@@ -15,6 +15,8 @@ export interface TxtLeafProps extends ShapeProps {
|
|
|
15
15
|
text?: SignalValue<string>;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
export const TXT_TYPE = Symbol('Txt');
|
|
19
|
+
|
|
18
20
|
@nodeName('TxtLeaf')
|
|
19
21
|
export class TxtLeaf extends Shape {
|
|
20
22
|
@lazy(() => {
|
|
@@ -43,7 +45,15 @@ export class TxtLeaf extends Shape {
|
|
|
43
45
|
@computed()
|
|
44
46
|
protected parentTxt() {
|
|
45
47
|
const parent = this.parent();
|
|
46
|
-
|
|
48
|
+
if (!parent) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!(TXT_TYPE in parent)) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return parent;
|
|
47
57
|
}
|
|
48
58
|
|
|
49
59
|
protected override async draw(context: CanvasRenderingContext2D) {
|
package/src/lib/jsx-runtime.ts
CHANGED
|
@@ -21,7 +21,8 @@ function isClassComponent(
|
|
|
21
21
|
return !!fn.prototype?.isClass;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export const Fragment =
|
|
24
|
+
export const Fragment: FunctionComponent = ({children}) => children;
|
|
25
|
+
|
|
25
26
|
export function jsx(
|
|
26
27
|
type: NodeConstructor | FunctionComponent | typeof Fragment,
|
|
27
28
|
config: JSXProps,
|