@twick/visualizer 0.15.26 → 0.15.28
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/project.css +1 -1
- package/dist/project.js +49 -49
- package/package.json +9 -9
- package/src/components/track.tsx +8 -6
- package/src/controllers/element.controller.ts +2 -0
- package/src/elements/emoji.element.tsx +45 -0
- package/src/helpers/constants.ts +2 -18
- package/src/helpers/filters.ts +4 -0
- package/src/index.ts +2 -0
- /package/dist/{Bangers-Regular.ttf → fonts/Bangers-Regular.ttf} +0 -0
- /package/dist/{Birthstone-Regular.ttf → fonts/Birthstone-Regular.ttf} +0 -0
- /package/dist/{Corinthia-Bold.ttf → fonts/Corinthia-Bold.ttf} +0 -0
- /package/dist/{Corinthia-Regular.ttf → fonts/Corinthia-Regular.ttf} +0 -0
- /package/dist/{ImperialScript-Regular.ttf → fonts/ImperialScript-Regular.ttf} +0 -0
- /package/dist/{Kapakana.ttf → fonts/Kapakana.ttf} +0 -0
- /package/dist/{KumarOneOutline-Regular.ttf → fonts/KumarOneOutline-Regular.ttf} +0 -0
- /package/dist/{LondrinaOutline-Regular.ttf → fonts/LondrinaOutline-Regular.ttf} +0 -0
- /package/dist/{LuckiestGuy-Regular.ttf → fonts/LuckiestGuy-Regular.ttf} +0 -0
- /package/dist/{Lumanosimo-Regular.ttf → fonts/Lumanosimo-Regular.ttf} +0 -0
- /package/dist/{MarckScript-Regular.ttf → fonts/MarckScript-Regular.ttf} +0 -0
- /package/dist/{Montserrat-VariableFont_wght.ttf → fonts/Montserrat-VariableFont_wght.ttf} +0 -0
- /package/dist/{Mulish-VariableFont_wght.ttf → fonts/Mulish-VariableFont_wght.ttf} +0 -0
- /package/dist/{Pattaya-Regular.woff2 → fonts/Pattaya-Regular.woff2} +0 -0
- /package/dist/{Peralta-Regular.ttf → fonts/Peralta-Regular.ttf} +0 -0
- /package/dist/{PlayfairDisplay-VariableFont_wght.ttf → fonts/PlayfairDisplay-VariableFont_wght.ttf} +0 -0
- /package/dist/{Poppins-Regular.ttf → fonts/Poppins-Regular.ttf} +0 -0
- /package/dist/{Roboto-VariableFont_wdth_wght.ttf → fonts/Roboto-VariableFont_wdth_wght.ttf} +0 -0
- /package/dist/{Rubik.ttf → fonts/Rubik.ttf} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twick/visualizer",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.28",
|
|
4
4
|
"license": "https://github.com/ncounterspecialist/twick/blob/main/LICENSE.md",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "twick editor --projectFile ./src/live.tsx",
|
|
@@ -23,19 +23,19 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@preact/signals": "^1.2.1",
|
|
26
|
-
"@twick/2d": "^0.15.
|
|
27
|
-
"@twick/core": "^0.15.
|
|
28
|
-
"@twick/effects": "0.15.
|
|
29
|
-
"@twick/media-utils": "0.15.
|
|
30
|
-
"@twick/renderer": "^0.15.
|
|
31
|
-
"@twick/vite-plugin": "^0.15.
|
|
26
|
+
"@twick/2d": "^0.15.28",
|
|
27
|
+
"@twick/core": "^0.15.28",
|
|
28
|
+
"@twick/effects": "0.15.28",
|
|
29
|
+
"@twick/media-utils": "0.15.28",
|
|
30
|
+
"@twick/renderer": "^0.15.28",
|
|
31
|
+
"@twick/vite-plugin": "^0.15.28",
|
|
32
32
|
"crelt": "^1.0.6",
|
|
33
33
|
"date-fns": "^4.1.0",
|
|
34
34
|
"preact": "^10.19.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@twick/cli": "^0.15.
|
|
38
|
-
"@twick/ui": "^0.15.
|
|
37
|
+
"@twick/cli": "^0.15.28",
|
|
38
|
+
"@twick/ui": "^0.15.28",
|
|
39
39
|
"typescript": "5.4.2",
|
|
40
40
|
"typedoc": "^0.25.8",
|
|
41
41
|
"typedoc-plugin-markdown": "^3.17.1",
|
package/src/components/track.tsx
CHANGED
|
@@ -101,8 +101,10 @@ export function* makeCaptionTrack({
|
|
|
101
101
|
// wordsMs belongs to caption timing only – keep it out of visual style merging.
|
|
102
102
|
const { wordsMs, ...elementPropsWithoutWords } = eProps as any;
|
|
103
103
|
|
|
104
|
-
const
|
|
105
|
-
|
|
104
|
+
const useTrackDefaults = (elementPropsWithoutWords as any)?.useTrackDefaults ?? true;
|
|
105
|
+
const resolvedCapStyle = useTrackDefaults
|
|
106
|
+
? (tProps?.capStyle ?? defaultCapStyle)
|
|
107
|
+
: ((elementPropsWithoutWords as any)?.capStyle ?? tProps?.capStyle ?? defaultCapStyle);
|
|
106
108
|
|
|
107
109
|
const styleConfig = CAPTION_STYLE[resolvedCapStyle] || CAPTION_STYLE[defaultCapStyle] || {};
|
|
108
110
|
const trackDefaultProps = (styleConfig as any).word || {};
|
|
@@ -116,12 +118,12 @@ export function* makeCaptionTrack({
|
|
|
116
118
|
};
|
|
117
119
|
|
|
118
120
|
// Resolve colors with priority: element.props.colors > track.props.colors > defaults.
|
|
119
|
-
const elementColors = (elementPropsWithoutWords as any)?.colors;
|
|
121
|
+
const elementColors = useTrackDefaults ? undefined : (elementPropsWithoutWords as any)?.colors;
|
|
120
122
|
const trackColors = tProps?.colors;
|
|
121
123
|
const phraseColors = elementColors ?? trackColors ?? DEFAULT_CAPTION_COLORS;
|
|
122
124
|
|
|
123
125
|
// Resolve font with priority: element.props.font > track.props.font > defaults.
|
|
124
|
-
const elementFont = (elementPropsWithoutWords as any)?.font;
|
|
126
|
+
const elementFont = useTrackDefaults ? undefined : (elementPropsWithoutWords as any)?.font;
|
|
125
127
|
const trackFont = tProps?.font;
|
|
126
128
|
const resolvedFont = elementFont ?? trackFont ?? DEFAULT_CAPTION_FONT;
|
|
127
129
|
|
|
@@ -129,7 +131,7 @@ export function* makeCaptionTrack({
|
|
|
129
131
|
const basePhraseStyle = {
|
|
130
132
|
...trackDefaultProps,
|
|
131
133
|
...tProps,
|
|
132
|
-
...elementPropsWithoutWords,
|
|
134
|
+
...(useTrackDefaults ? {} : elementPropsWithoutWords),
|
|
133
135
|
};
|
|
134
136
|
|
|
135
137
|
const bgOpacityFromBase = (basePhraseStyle as any)?.bgOpacity;
|
|
@@ -183,7 +185,7 @@ export function* makeCaptionTrack({
|
|
|
183
185
|
caption: {
|
|
184
186
|
...element,
|
|
185
187
|
t: element.t ?? "",
|
|
186
|
-
capStyle: eProps?.capStyle ?? tProps?.capStyle,
|
|
188
|
+
capStyle: useTrackDefaults ? tProps?.capStyle : (eProps?.capStyle ?? tProps?.capStyle),
|
|
187
189
|
props: captionPropsForElement,
|
|
188
190
|
},
|
|
189
191
|
view,
|
|
@@ -8,6 +8,7 @@ import { LineElement } from "../elements/line.element";
|
|
|
8
8
|
import { SceneElement } from "../elements/scene.element";
|
|
9
9
|
import { TextElement } from "../elements/text.element";
|
|
10
10
|
import { VideoElement } from "../elements/video.element";
|
|
11
|
+
import { EmojiElement } from "../elements/emoji.element";
|
|
11
12
|
import { Element } from "../helpers/types";
|
|
12
13
|
|
|
13
14
|
export class ElementController {
|
|
@@ -32,6 +33,7 @@ export class ElementController {
|
|
|
32
33
|
elementController.register(SceneElement);
|
|
33
34
|
elementController.register(ImageElement);
|
|
34
35
|
elementController.register(TextElement);
|
|
36
|
+
elementController.register(EmojiElement);
|
|
35
37
|
elementController.register(AudioElement);
|
|
36
38
|
elementController.register(CircleElement);
|
|
37
39
|
elementController.register(RectElement);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ElementParams } from "../helpers/types";
|
|
2
|
+
import { all, createRef, waitFor } from "@twick/core";
|
|
3
|
+
import { Img, Rect } from "@twick/2d";
|
|
4
|
+
import { addAnimation, fitElement } from "../helpers/element.utils";
|
|
5
|
+
|
|
6
|
+
export const EmojiElement = {
|
|
7
|
+
name: "emoji",
|
|
8
|
+
|
|
9
|
+
*create({ containerRef, element, view }: ElementParams) {
|
|
10
|
+
yield* waitFor(element?.s);
|
|
11
|
+
const frameContainerRef = createRef<any>();
|
|
12
|
+
const frameElementRef = createRef<any>();
|
|
13
|
+
|
|
14
|
+
yield containerRef().add(
|
|
15
|
+
<Rect ref={frameContainerRef} key={element.id} {...element.frame}>
|
|
16
|
+
<Img
|
|
17
|
+
ref={frameElementRef}
|
|
18
|
+
key={`child-${element.id}`}
|
|
19
|
+
{...element.props}
|
|
20
|
+
/>
|
|
21
|
+
</Rect>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
if (frameContainerRef()) {
|
|
25
|
+
yield fitElement({
|
|
26
|
+
elementRef: frameElementRef,
|
|
27
|
+
containerSize: frameContainerRef().size(),
|
|
28
|
+
elementSize: frameElementRef().size(),
|
|
29
|
+
objectFit: element.objectFit,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
yield* all(
|
|
33
|
+
addAnimation({
|
|
34
|
+
elementRef: frameElementRef,
|
|
35
|
+
containerRef: frameContainerRef,
|
|
36
|
+
element: element,
|
|
37
|
+
view,
|
|
38
|
+
}),
|
|
39
|
+
waitFor(Math.max(0, element.e - element.s))
|
|
40
|
+
);
|
|
41
|
+
yield frameElementRef().remove();
|
|
42
|
+
yield frameContainerRef().remove();
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
};
|
package/src/helpers/constants.ts
CHANGED
|
@@ -247,6 +247,7 @@ export const ELEMENT_TYPES = {
|
|
|
247
247
|
RECT: "rect",
|
|
248
248
|
CIRCLE: "circle",
|
|
249
249
|
ICON: "icon",
|
|
250
|
+
EMOJI: "emoji",
|
|
250
251
|
};
|
|
251
252
|
|
|
252
253
|
export const OBJECT_FIT = {
|
|
@@ -256,24 +257,7 @@ export const OBJECT_FIT = {
|
|
|
256
257
|
NONE: "none",
|
|
257
258
|
};
|
|
258
259
|
|
|
259
|
-
export
|
|
260
|
-
SATURATED: "saturated",
|
|
261
|
-
BRIGHT: "bright",
|
|
262
|
-
VIBRANT: "vibrant",
|
|
263
|
-
RETRO: "retro",
|
|
264
|
-
BLACK_WHITE: "blackWhite",
|
|
265
|
-
SEPIA: "sepia",
|
|
266
|
-
COOL: "cool",
|
|
267
|
-
WARM: "warm",
|
|
268
|
-
CINEMATIC: "cinematic",
|
|
269
|
-
SOFT_GLOW: "softGlow",
|
|
270
|
-
MOODY: "moody",
|
|
271
|
-
DREAMY: "dreamy",
|
|
272
|
-
INVERTED: "inverted",
|
|
273
|
-
VINTAGE: "vintage",
|
|
274
|
-
DRAMATIC: "dramatic",
|
|
275
|
-
FADED: "faded",
|
|
276
|
-
};
|
|
260
|
+
export { COLOR_FILTERS } from "@twick/media-utils";
|
|
277
261
|
|
|
278
262
|
export const EVENT_TYPES = {
|
|
279
263
|
PLAYER_UPDATE: "twick:playerUpdate",
|
package/src/helpers/filters.ts
CHANGED
|
@@ -65,6 +65,10 @@ export const applyColorFilter = (ref: Reference<any>, filterType: string) => {
|
|
|
65
65
|
ref().filters.contrast(1.25);
|
|
66
66
|
ref().filters.brightness(1.05);
|
|
67
67
|
break;
|
|
68
|
+
case COLOR_FILTERS.SEPIA:
|
|
69
|
+
ref().filters.sepia(1);
|
|
70
|
+
ref().filters.contrast(1.08);
|
|
71
|
+
break;
|
|
68
72
|
case COLOR_FILTERS.COOL:
|
|
69
73
|
ref().filters.hue(15);
|
|
70
74
|
ref().filters.brightness(1.1);
|
package/src/index.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/{PlayfairDisplay-VariableFont_wght.ttf → fonts/PlayfairDisplay-VariableFont_wght.ttf}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|