@smoove/core 0.1.4 → 0.1.7
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/engine/sequence.d.ts.map +1 -1
- package/dist/engine/sequence.js +2 -1
- package/dist/engine/sequence.js.map +1 -1
- package/dist/layout/text/font.d.ts +11 -1
- package/dist/layout/text/font.d.ts.map +1 -1
- package/dist/layout/text/font.js +14 -2
- package/dist/layout/text/font.js.map +1 -1
- package/package.json +1 -1
- package/dist/audio/asset.d.ts +0 -21
- package/dist/audio/asset.d.ts.map +0 -1
- package/dist/audio/asset.js +0 -2
- package/dist/audio/asset.js.map +0 -1
- package/dist/audio/audio-driver.d.ts +0 -34
- package/dist/audio/audio-driver.d.ts.map +0 -1
- package/dist/audio/audio-driver.js +0 -2
- package/dist/audio/audio-driver.js.map +0 -1
- package/dist/audio/audio-for-preview.d.ts +0 -12
- package/dist/audio/audio-for-preview.d.ts.map +0 -1
- package/dist/audio/audio-for-preview.js +0 -70
- package/dist/audio/audio-for-preview.js.map +0 -1
- package/dist/audio/audio-for-rendering.d.ts +0 -16
- package/dist/audio/audio-for-rendering.d.ts.map +0 -1
- package/dist/audio/audio-for-rendering.js +0 -32
- package/dist/audio/audio-for-rendering.js.map +0 -1
- package/dist/audio/audio-source-browser.d.ts +0 -30
- package/dist/audio/audio-source-browser.d.ts.map +0 -1
- package/dist/audio/audio-source-browser.js +0 -139
- package/dist/audio/audio-source-browser.js.map +0 -1
- package/dist/audio/audio-source.d.ts +0 -38
- package/dist/audio/audio-source.d.ts.map +0 -1
- package/dist/audio/audio-source.js +0 -2
- package/dist/audio/audio-source.js.map +0 -1
- package/dist/audio/index.d.ts +0 -45
- package/dist/audio/index.d.ts.map +0 -1
- package/dist/audio/index.js +0 -143
- package/dist/audio/index.js.map +0 -1
- package/dist/audio/mixer.d.ts +0 -43
- package/dist/audio/mixer.d.ts.map +0 -1
- package/dist/audio/mixer.js +0 -51
- package/dist/audio/mixer.js.map +0 -1
- package/dist/audio/types.d.ts +0 -31
- package/dist/audio/types.d.ts.map +0 -1
- package/dist/audio/types.js +0 -2
- package/dist/audio/types.js.map +0 -1
- package/dist/block.d.ts +0 -16
- package/dist/block.d.ts.map +0 -1
- package/dist/block.js +0 -173
- package/dist/block.js.map +0 -1
- package/dist/composition.d.ts.map +0 -1
- package/dist/composition.js.map +0 -1
- package/dist/easing.d.ts +0 -22
- package/dist/easing.d.ts.map +0 -1
- package/dist/easing.js +0 -59
- package/dist/easing.js.map +0 -1
- package/dist/emitter.d.ts +0 -7
- package/dist/emitter.d.ts.map +0 -1
- package/dist/emitter.js +0 -29
- package/dist/emitter.js.map +0 -1
- package/dist/environment.d.ts.map +0 -1
- package/dist/environment.js.map +0 -1
- package/dist/flex-engine.d.ts +0 -31
- package/dist/flex-engine.d.ts.map +0 -1
- package/dist/flex-engine.js +0 -186
- package/dist/flex-engine.js.map +0 -1
- package/dist/flex-types.d.ts +0 -165
- package/dist/flex-types.d.ts.map +0 -1
- package/dist/flex-types.js +0 -2
- package/dist/flex-types.js.map +0 -1
- package/dist/flex.d.ts +0 -26
- package/dist/flex.d.ts.map +0 -1
- package/dist/flex.js +0 -179
- package/dist/flex.js.map +0 -1
- package/dist/image.d.ts +0 -10
- package/dist/image.d.ts.map +0 -1
- package/dist/image.js +0 -156
- package/dist/image.js.map +0 -1
- package/dist/interpolate-colors.d.ts +0 -7
- package/dist/interpolate-colors.d.ts.map +0 -1
- package/dist/interpolate-colors.js +0 -240
- package/dist/interpolate-colors.js.map +0 -1
- package/dist/interpolate.d.ts +0 -12
- package/dist/interpolate.d.ts.map +0 -1
- package/dist/interpolate.js +0 -65
- package/dist/interpolate.js.map +0 -1
- package/dist/media-marker.d.ts +0 -19
- package/dist/media-marker.d.ts.map +0 -1
- package/dist/media-marker.js +0 -19
- package/dist/media-marker.js.map +0 -1
- package/dist/media-time.d.ts +0 -17
- package/dist/media-time.d.ts.map +0 -1
- package/dist/media-time.js +0 -17
- package/dist/media-time.js.map +0 -1
- package/dist/signal.d.ts +0 -10
- package/dist/signal.d.ts.map +0 -1
- package/dist/signal.js +0 -39
- package/dist/signal.js.map +0 -1
- package/dist/text.d.ts +0 -91
- package/dist/text.d.ts.map +0 -1
- package/dist/text.js +0 -704
- package/dist/text.js.map +0 -1
- package/dist/video/driver.d.ts +0 -31
- package/dist/video/driver.d.ts.map +0 -1
- package/dist/video/driver.js +0 -3
- package/dist/video/driver.js.map +0 -1
- package/dist/video/index.d.ts +0 -45
- package/dist/video/index.d.ts.map +0 -1
- package/dist/video/index.js +0 -276
- package/dist/video/index.js.map +0 -1
- package/dist/video/types.d.ts +0 -35
- package/dist/video/types.d.ts.map +0 -1
- package/dist/video/types.js +0 -2
- package/dist/video/types.js.map +0 -1
- package/dist/video/video-for-preview.d.ts +0 -12
- package/dist/video/video-for-preview.d.ts.map +0 -1
- package/dist/video/video-for-preview.js +0 -73
- package/dist/video/video-for-preview.js.map +0 -1
- package/dist/video/video-for-rendering.d.ts +0 -16
- package/dist/video/video-for-rendering.d.ts.map +0 -1
- package/dist/video/video-for-rendering.js +0 -45
- package/dist/video/video-for-rendering.js.map +0 -1
- package/dist/video/video-source-browser.d.ts +0 -37
- package/dist/video/video-source-browser.d.ts.map +0 -1
- package/dist/video/video-source-browser.js +0 -171
- package/dist/video/video-source-browser.js.map +0 -1
- package/dist/video/video-source.d.ts +0 -48
- package/dist/video/video-source.d.ts.map +0 -1
- package/dist/video/video-source.js +0 -2
- package/dist/video/video-source.js.map +0 -1
package/dist/flex.js
DELETED
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { DIRECTION_LTR } from "flexily/classic";
|
|
2
|
-
import Konva from "konva";
|
|
3
|
-
import { Block } from "./block.js";
|
|
4
|
-
import { FlexilyNode, applyChildProps, applyContainerProps, applySize, parseSize, setImageMeasure, setTextMeasure, setTextWrapperMeasure, } from "./flex-engine.js";
|
|
5
|
-
import { Image as KMImage } from "./image.js";
|
|
6
|
-
import { Text as KMText } from "./text.js";
|
|
7
|
-
const FLEX_KEYS = [
|
|
8
|
-
"flexDirection",
|
|
9
|
-
"justifyContent",
|
|
10
|
-
"alignItems",
|
|
11
|
-
"gap",
|
|
12
|
-
"padding",
|
|
13
|
-
"flexGrow",
|
|
14
|
-
"flexShrink",
|
|
15
|
-
"flexBasis",
|
|
16
|
-
"alignSelf",
|
|
17
|
-
"margin",
|
|
18
|
-
];
|
|
19
|
-
function pickKonvaConfig(config) {
|
|
20
|
-
const out = { ...config };
|
|
21
|
-
for (const k of FLEX_KEYS)
|
|
22
|
-
delete out[k];
|
|
23
|
-
const w = parseSize(config.width);
|
|
24
|
-
const h = parseSize(config.height);
|
|
25
|
-
out.width = w?.kind === "px" ? w.value : undefined;
|
|
26
|
-
out.height = h?.kind === "px" ? h.value : undefined;
|
|
27
|
-
return out;
|
|
28
|
-
}
|
|
29
|
-
export class Flex extends Konva.Group {
|
|
30
|
-
constructor(config) {
|
|
31
|
-
super(pickKonvaConfig(config));
|
|
32
|
-
this.setAttrs({
|
|
33
|
-
flexDirection: config.flexDirection,
|
|
34
|
-
justifyContent: config.justifyContent,
|
|
35
|
-
alignItems: config.alignItems,
|
|
36
|
-
gap: config.gap,
|
|
37
|
-
padding: config.padding,
|
|
38
|
-
flexGrow: config.flexGrow,
|
|
39
|
-
flexShrink: config.flexShrink,
|
|
40
|
-
flexBasis: config.flexBasis,
|
|
41
|
-
alignSelf: config.alignSelf,
|
|
42
|
-
margin: config.margin,
|
|
43
|
-
flexWidth: config.width,
|
|
44
|
-
flexHeight: config.height,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
computeLayout() {
|
|
48
|
-
layoutRoot(this, false);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Lay out a Konva.Group as a Flexily root: build the layout tree from the
|
|
53
|
-
* group's attrs + children, compute, and write positions/sizes back.
|
|
54
|
-
*
|
|
55
|
-
* When `alwaysSetSize` is true the group's own width/height are always pulled
|
|
56
|
-
* from the computed content size — needed for a hug-content root that draws a
|
|
57
|
-
* background (Block) so the background isn't 0×0. Flex passes false, preserving
|
|
58
|
-
* its behavior of only writing self-size when an explicit px size is given.
|
|
59
|
-
*/
|
|
60
|
-
export function layoutRoot(group, alwaysSetSize) {
|
|
61
|
-
const w = readPixelSize(group.attrs.flexWidth);
|
|
62
|
-
const h = readPixelSize(group.attrs.flexHeight);
|
|
63
|
-
const root = FlexilyNode.create();
|
|
64
|
-
applyContainerProps(root, group.attrs);
|
|
65
|
-
if (w > 0)
|
|
66
|
-
root.setWidth(w);
|
|
67
|
-
if (h > 0)
|
|
68
|
-
root.setHeight(h);
|
|
69
|
-
const pairs = [];
|
|
70
|
-
buildChildren(group.getChildren(), root, pairs, group.attrs.flexDirection ?? "row");
|
|
71
|
-
root.calculateLayout(w > 0 ? w : undefined, h > 0 ? h : undefined, DIRECTION_LTR);
|
|
72
|
-
if (alwaysSetSize || w > 0)
|
|
73
|
-
group.width(root.getComputedWidth());
|
|
74
|
-
if (alwaysSetSize || h > 0)
|
|
75
|
-
group.height(root.getComputedHeight());
|
|
76
|
-
writeBack(pairs);
|
|
77
|
-
root.freeRecursive();
|
|
78
|
-
}
|
|
79
|
-
function readPixelSize(sizeAttr) {
|
|
80
|
-
const parsed = parseSize(sizeAttr);
|
|
81
|
-
if (parsed?.kind === "px")
|
|
82
|
-
return parsed.value;
|
|
83
|
-
// No explicit px size → hug content. Return 0 (not the node's current Konva
|
|
84
|
-
// size): falling back to the last-computed size would pin a hug-content root
|
|
85
|
-
// to its first-tick height and stop it re-growing as children change size.
|
|
86
|
-
return 0;
|
|
87
|
-
}
|
|
88
|
-
export function buildChildren(children, parentFlex, pairs, parentDirection = "row") {
|
|
89
|
-
// Skip the Block background rect and any hidden child (display:none semantics —
|
|
90
|
-
// an invisible node takes no layout space, so staggered/toggled children don't
|
|
91
|
-
// leave gaps).
|
|
92
|
-
const laidOut = children.filter((c) => !c.attrs.__blockBg && c.visible() !== false);
|
|
93
|
-
const parentIsColumn = parentDirection.startsWith("column");
|
|
94
|
-
laidOut.forEach((child, i) => {
|
|
95
|
-
const node = FlexilyNode.create();
|
|
96
|
-
applyChildProps(node, child.attrs);
|
|
97
|
-
if (child instanceof Flex || child instanceof Block) {
|
|
98
|
-
const props = child.attrs;
|
|
99
|
-
applyContainerProps(node, props);
|
|
100
|
-
applySize(node, child.attrs.flexWidth, child.attrs.flexHeight);
|
|
101
|
-
buildChildren(child.getChildren(), node, pairs, props.flexDirection ?? "row");
|
|
102
|
-
pairs.push({ konva: child, flex: node, isContainer: true });
|
|
103
|
-
}
|
|
104
|
-
else if (child instanceof KMImage) {
|
|
105
|
-
applySize(node, child.attrs.flexWidth, child.attrs.flexHeight);
|
|
106
|
-
pairs.push({ konva: child, flex: node, isContainer: true });
|
|
107
|
-
}
|
|
108
|
-
else if (child instanceof KMText) {
|
|
109
|
-
// Wrapper text: intrinsic size comes from measuring (fit/clamp aware).
|
|
110
|
-
if (child.attrs.flexWidth === undefined &&
|
|
111
|
-
child.attrs.maxWidth === undefined &&
|
|
112
|
-
parentIsColumn) {
|
|
113
|
-
node.setWidthPercent(100);
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
applySize(node, child.attrs.flexWidth, undefined);
|
|
117
|
-
}
|
|
118
|
-
setTextWrapperMeasure(node, child, parentIsColumn);
|
|
119
|
-
pairs.push({ konva: child, flex: node, isContainer: true });
|
|
120
|
-
}
|
|
121
|
-
else if (child instanceof Konva.Text) {
|
|
122
|
-
if (child.attrs.flexWidth === undefined && parentIsColumn)
|
|
123
|
-
node.setWidthPercent(100);
|
|
124
|
-
else
|
|
125
|
-
applySize(node, child.attrs.flexWidth, undefined);
|
|
126
|
-
setTextMeasure(node, child, parentIsColumn);
|
|
127
|
-
pairs.push({ konva: child, flex: node, isContainer: false });
|
|
128
|
-
}
|
|
129
|
-
else if (child instanceof Konva.Image) {
|
|
130
|
-
applySize(node, child.attrs.flexWidth, child.attrs.flexHeight);
|
|
131
|
-
if (child.attrs.flexWidth === undefined && child.attrs.flexHeight === undefined) {
|
|
132
|
-
setImageMeasure(node, child);
|
|
133
|
-
}
|
|
134
|
-
pairs.push({ konva: child, flex: node, isContainer: false });
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
const w = child.attrs.width;
|
|
138
|
-
const h = child.attrs.height;
|
|
139
|
-
if (typeof w === "number" && w > 0)
|
|
140
|
-
node.setWidth(w);
|
|
141
|
-
if (typeof h === "number" && h > 0)
|
|
142
|
-
node.setHeight(h);
|
|
143
|
-
pairs.push({ konva: child, flex: node, isContainer: false });
|
|
144
|
-
}
|
|
145
|
-
parentFlex.insertChild(node, i);
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
export function writeBack(pairs) {
|
|
149
|
-
for (const { konva, flex, isContainer } of pairs) {
|
|
150
|
-
konva.x(flex.getComputedLeft());
|
|
151
|
-
konva.y(flex.getComputedTop());
|
|
152
|
-
const w = flex.getComputedWidth();
|
|
153
|
-
const h = flex.getComputedHeight();
|
|
154
|
-
if (isContainer) {
|
|
155
|
-
konva.width(w);
|
|
156
|
-
konva.height(h);
|
|
157
|
-
if (konva instanceof Block)
|
|
158
|
-
konva._layoutBackground();
|
|
159
|
-
else if (konva instanceof KMImage)
|
|
160
|
-
konva._layoutImage();
|
|
161
|
-
else if (konva instanceof KMText)
|
|
162
|
-
konva._layoutText();
|
|
163
|
-
}
|
|
164
|
-
else if (konva instanceof Konva.Text) {
|
|
165
|
-
if (konva.attrs.wrap === undefined)
|
|
166
|
-
konva.wrap("word");
|
|
167
|
-
konva.width(w);
|
|
168
|
-
}
|
|
169
|
-
else if (!(konva instanceof Konva.Image)) {
|
|
170
|
-
konva.width(w);
|
|
171
|
-
konva.height(h);
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
konva.width(w);
|
|
175
|
-
konva.height(h);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
//# sourceMappingURL=flex.js.map
|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YAAY,EAAE,CAAC;iBACnD,IAAI,KAAK,YAAY,MAAM;gBAAE,KAAK,CAAC,WAAW,EAAE,CAAC;QACxD,CAAC;aAAM,IAAI,KAAK,YAAY,KAAK,CAAC,IAAI,EAAE,CAAC;YACvC,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS;gBAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACvD,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;aAAM,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3C,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACf,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACf,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/image.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import Konva from "konva";
|
|
2
|
-
import type { ImageConfig } from "./flex-types.js";
|
|
3
|
-
export declare class Image extends Konva.Group {
|
|
4
|
-
private readonly _img;
|
|
5
|
-
private _source;
|
|
6
|
-
constructor(config: ImageConfig);
|
|
7
|
-
/** @internal */
|
|
8
|
-
_layoutImage(): void;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=image.d.ts.map
|
package/dist/image.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../src/image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAwC,MAAM,iBAAiB,CAAC;AAkCzF,qBAAa,KAAM,SAAQ,KAAK,CAAC,KAAK;IACpC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAc;IACnC,OAAO,CAAC,OAAO,CAAiC;gBAEpC,MAAM,EAAE,WAAW;IAyC/B,gBAAgB;IAChB,YAAY,IAAI,IAAI;CA0CrB"}
|
package/dist/image.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import Konva from "konva";
|
|
2
|
-
import { parseSize } from "./flex-engine.js";
|
|
3
|
-
const IMG_KEYS = [
|
|
4
|
-
"src",
|
|
5
|
-
"objectFit",
|
|
6
|
-
"objectPosition",
|
|
7
|
-
"flexGrow",
|
|
8
|
-
"flexShrink",
|
|
9
|
-
"flexBasis",
|
|
10
|
-
"alignSelf",
|
|
11
|
-
"margin",
|
|
12
|
-
];
|
|
13
|
-
function pickKonvaConfig(config) {
|
|
14
|
-
const out = { ...config };
|
|
15
|
-
for (const k of IMG_KEYS)
|
|
16
|
-
delete out[k];
|
|
17
|
-
const w = parseSize(config.width);
|
|
18
|
-
const h = parseSize(config.height);
|
|
19
|
-
out.width = w?.kind === "px" ? w.value : undefined;
|
|
20
|
-
out.height = h?.kind === "px" ? h.value : undefined;
|
|
21
|
-
out.cornerRadius = undefined;
|
|
22
|
-
return out;
|
|
23
|
-
}
|
|
24
|
-
function loadImage(src) {
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
const img = document.createElement("img");
|
|
27
|
-
img.crossOrigin = "anonymous";
|
|
28
|
-
img.onload = () => resolve(img);
|
|
29
|
-
img.onerror = reject;
|
|
30
|
-
img.src = src;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
export class Image extends Konva.Group {
|
|
34
|
-
_img;
|
|
35
|
-
_source = null;
|
|
36
|
-
constructor(config) {
|
|
37
|
-
super(pickKonvaConfig(config));
|
|
38
|
-
this._img = new Konva.Image({ image: undefined, listening: false });
|
|
39
|
-
super.add(this._img);
|
|
40
|
-
this.setAttrs({
|
|
41
|
-
flexGrow: config.flexGrow,
|
|
42
|
-
flexShrink: config.flexShrink,
|
|
43
|
-
flexBasis: config.flexBasis,
|
|
44
|
-
alignSelf: config.alignSelf,
|
|
45
|
-
margin: config.margin,
|
|
46
|
-
objectFit: config.objectFit ?? "cover",
|
|
47
|
-
objectPosition: config.objectPosition ?? "center",
|
|
48
|
-
cornerRadius: config.cornerRadius,
|
|
49
|
-
flexWidth: config.width,
|
|
50
|
-
flexHeight: config.height,
|
|
51
|
-
});
|
|
52
|
-
if (config.cornerRadius !== undefined) {
|
|
53
|
-
const cr = normalizeCorners(config.cornerRadius);
|
|
54
|
-
this.clipFunc((ctx) => roundRectPath(ctx, 0, 0, this.width(), this.height(), cr));
|
|
55
|
-
}
|
|
56
|
-
this.on("widthChange heightChange", () => this._layoutImage());
|
|
57
|
-
if (typeof config.src === "string") {
|
|
58
|
-
loadImage(config.src).then((img) => {
|
|
59
|
-
this._source = img;
|
|
60
|
-
this._img.image(img);
|
|
61
|
-
this._layoutImage();
|
|
62
|
-
this.getLayer()?.batchDraw();
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
this._source = config.src;
|
|
67
|
-
this._img.image(config.src);
|
|
68
|
-
}
|
|
69
|
-
this._layoutImage();
|
|
70
|
-
}
|
|
71
|
-
/** @internal */
|
|
72
|
-
_layoutImage() {
|
|
73
|
-
const w = this.width();
|
|
74
|
-
const h = this.height();
|
|
75
|
-
if (w <= 0 || h <= 0)
|
|
76
|
-
return;
|
|
77
|
-
const src = this._source;
|
|
78
|
-
const fit = (this.attrs.objectFit ?? "cover");
|
|
79
|
-
const pos = (this.attrs.objectPosition ?? "center");
|
|
80
|
-
if (!src || src.naturalWidth === 0 || src.naturalHeight === 0)
|
|
81
|
-
return;
|
|
82
|
-
const nw = src.naturalWidth;
|
|
83
|
-
const nh = src.naturalHeight;
|
|
84
|
-
if (fit === "fill") {
|
|
85
|
-
this._img.position({ x: 0, y: 0 });
|
|
86
|
-
this._img.size({ width: w, height: h });
|
|
87
|
-
this._img.crop({ x: 0, y: 0, width: nw, height: nh });
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
if (fit === "none") {
|
|
91
|
-
const { x, y } = positionOffset(pos, w - nw, h - nh);
|
|
92
|
-
this._img.position({ x, y });
|
|
93
|
-
this._img.size({ width: nw, height: nh });
|
|
94
|
-
this._img.crop({ x: 0, y: 0, width: nw, height: nh });
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
if (fit === "contain") {
|
|
98
|
-
const scale = Math.min(w / nw, h / nh);
|
|
99
|
-
const dw = nw * scale;
|
|
100
|
-
const dh = nh * scale;
|
|
101
|
-
const { x, y } = positionOffset(pos, w - dw, h - dh);
|
|
102
|
-
this._img.position({ x, y });
|
|
103
|
-
this._img.size({ width: dw, height: dh });
|
|
104
|
-
this._img.crop({ x: 0, y: 0, width: nw, height: nh });
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
const scale = Math.max(w / nw, h / nh);
|
|
108
|
-
const cropW = w / scale;
|
|
109
|
-
const cropH = h / scale;
|
|
110
|
-
const { x: cx, y: cy } = positionOffset(pos, nw - cropW, nh - cropH);
|
|
111
|
-
this._img.position({ x: 0, y: 0 });
|
|
112
|
-
this._img.size({ width: w, height: h });
|
|
113
|
-
this._img.crop({ x: cx, y: cy, width: cropW, height: cropH });
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
function positionOffset(pos, freeX, freeY) {
|
|
117
|
-
let fx = 0.5;
|
|
118
|
-
let fy = 0.5;
|
|
119
|
-
if (pos.includes("left"))
|
|
120
|
-
fx = 0;
|
|
121
|
-
else if (pos.includes("right"))
|
|
122
|
-
fx = 1;
|
|
123
|
-
if (pos.includes("top"))
|
|
124
|
-
fy = 0;
|
|
125
|
-
else if (pos.includes("bottom"))
|
|
126
|
-
fy = 1;
|
|
127
|
-
if (pos === "center") {
|
|
128
|
-
fx = 0.5;
|
|
129
|
-
fy = 0.5;
|
|
130
|
-
}
|
|
131
|
-
return { x: freeX * fx, y: freeY * fy };
|
|
132
|
-
}
|
|
133
|
-
function normalizeCorners(c) {
|
|
134
|
-
if (typeof c === "number")
|
|
135
|
-
return [c, c, c, c];
|
|
136
|
-
if (c.length === 1)
|
|
137
|
-
return [c[0] ?? 0, c[0] ?? 0, c[0] ?? 0, c[0] ?? 0];
|
|
138
|
-
if (c.length === 2)
|
|
139
|
-
return [c[0] ?? 0, c[1] ?? 0, c[0] ?? 0, c[1] ?? 0];
|
|
140
|
-
return [c[0] ?? 0, c[1] ?? 0, c[2] ?? 0, c[3] ?? 0];
|
|
141
|
-
}
|
|
142
|
-
function roundRectPath(ctx, x, y, w, h, r) {
|
|
143
|
-
const [tl, tr, br, bl] = r;
|
|
144
|
-
ctx.beginPath();
|
|
145
|
-
ctx.moveTo(x + (tl ?? 0), y);
|
|
146
|
-
ctx.lineTo(x + w - (tr ?? 0), y);
|
|
147
|
-
ctx.quadraticCurveTo(x + w, y, x + w, y + (tr ?? 0));
|
|
148
|
-
ctx.lineTo(x + w, y + h - (br ?? 0));
|
|
149
|
-
ctx.quadraticCurveTo(x + w, y + h, x + w - (br ?? 0), y + h);
|
|
150
|
-
ctx.lineTo(x + (bl ?? 0), y + h);
|
|
151
|
-
ctx.quadraticCurveTo(x, y + h, x, y + h - (bl ?? 0));
|
|
152
|
-
ctx.lineTo(x, y + (tl ?? 0));
|
|
153
|
-
ctx.quadraticCurveTo(x, y, x + (tl ?? 0), y);
|
|
154
|
-
ctx.closePath();
|
|
155
|
-
}
|
|
156
|
-
//# sourceMappingURL=image.js.map
|
package/dist/image.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image.js","sourceRoot":"","sources":["../src/image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG7C,MAAM,QAAQ,GAAG;IACf,KAAK;IACL,WAAW;IACX,gBAAgB;IAChB,UAAU;IACV,YAAY;IACZ,WAAW;IACX,WAAW;IACX,QAAQ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CAAC,CAAC,CAAC;IAC7B,GAAG,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7C,GAAG,CAAC,SAAS,EAAE,CAAC;AAClB,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interpolates between a list of colors. API-compatible with Remotion's
|
|
3
|
-
* `interpolateColors`. Returns an `rgba(r, g, b, a)` string. Extrapolation
|
|
4
|
-
* is clamped on both sides.
|
|
5
|
-
*/
|
|
6
|
-
export declare const interpolateColors: (input: number, inputRange: readonly number[], outputRange: readonly string[]) => string;
|
|
7
|
-
//# sourceMappingURL=interpolate-colors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interpolate-colors.d.ts","sourceRoot":"","sources":["../src/interpolate-colors.ts"],"names":[],"mappings":"AAwOA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,OAAO,MAAM,EACb,YAAY,SAAS,MAAM,EAAE,EAC7B,aAAa,SAAS,MAAM,EAAE,KAC7B,MAuCF,CAAC"}
|
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import { interpolate } from "./interpolate.js";
|
|
2
|
-
// CSS named colors (CSS Color Module Level 4).
|
|
3
|
-
const NAMED_COLORS = {
|
|
4
|
-
aliceblue: "#f0f8ff",
|
|
5
|
-
antiquewhite: "#faebd7",
|
|
6
|
-
aqua: "#00ffff",
|
|
7
|
-
aquamarine: "#7fffd4",
|
|
8
|
-
azure: "#f0ffff",
|
|
9
|
-
beige: "#f5f5dc",
|
|
10
|
-
bisque: "#ffe4c4",
|
|
11
|
-
black: "#000000",
|
|
12
|
-
blanchedalmond: "#ffebcd",
|
|
13
|
-
blue: "#0000ff",
|
|
14
|
-
blueviolet: "#8a2be2",
|
|
15
|
-
brown: "#a52a2a",
|
|
16
|
-
burlywood: "#deb887",
|
|
17
|
-
cadetblue: "#5f9ea0",
|
|
18
|
-
chartreuse: "#7fff00",
|
|
19
|
-
chocolate: "#d2691e",
|
|
20
|
-
coral: "#ff7f50",
|
|
21
|
-
cornflowerblue: "#6495ed",
|
|
22
|
-
cornsilk: "#fff8dc",
|
|
23
|
-
crimson: "#dc143c",
|
|
24
|
-
cyan: "#00ffff",
|
|
25
|
-
darkblue: "#00008b",
|
|
26
|
-
darkcyan: "#008b8b",
|
|
27
|
-
darkgoldenrod: "#b8860b",
|
|
28
|
-
darkgray: "#a9a9a9",
|
|
29
|
-
darkgreen: "#006400",
|
|
30
|
-
darkgrey: "#a9a9a9",
|
|
31
|
-
darkkhaki: "#bdb76b",
|
|
32
|
-
darkmagenta: "#8b008b",
|
|
33
|
-
darkolivegreen: "#556b2f",
|
|
34
|
-
darkorange: "#ff8c00",
|
|
35
|
-
darkorchid: "#9932cc",
|
|
36
|
-
darkred: "#8b0000",
|
|
37
|
-
darksalmon: "#e9967a",
|
|
38
|
-
darkseagreen: "#8fbc8f",
|
|
39
|
-
darkslateblue: "#483d8b",
|
|
40
|
-
darkslategray: "#2f4f4f",
|
|
41
|
-
darkslategrey: "#2f4f4f",
|
|
42
|
-
darkturquoise: "#00ced1",
|
|
43
|
-
darkviolet: "#9400d3",
|
|
44
|
-
deeppink: "#ff1493",
|
|
45
|
-
deepskyblue: "#00bfff",
|
|
46
|
-
dimgray: "#696969",
|
|
47
|
-
dimgrey: "#696969",
|
|
48
|
-
dodgerblue: "#1e90ff",
|
|
49
|
-
firebrick: "#b22222",
|
|
50
|
-
floralwhite: "#fffaf0",
|
|
51
|
-
forestgreen: "#228b22",
|
|
52
|
-
fuchsia: "#ff00ff",
|
|
53
|
-
gainsboro: "#dcdcdc",
|
|
54
|
-
ghostwhite: "#f8f8ff",
|
|
55
|
-
gold: "#ffd700",
|
|
56
|
-
goldenrod: "#daa520",
|
|
57
|
-
gray: "#808080",
|
|
58
|
-
green: "#008000",
|
|
59
|
-
greenyellow: "#adff2f",
|
|
60
|
-
grey: "#808080",
|
|
61
|
-
honeydew: "#f0fff0",
|
|
62
|
-
hotpink: "#ff69b4",
|
|
63
|
-
indianred: "#cd5c5c",
|
|
64
|
-
indigo: "#4b0082",
|
|
65
|
-
ivory: "#fffff0",
|
|
66
|
-
khaki: "#f0e68c",
|
|
67
|
-
lavender: "#e6e6fa",
|
|
68
|
-
lavenderblush: "#fff0f5",
|
|
69
|
-
lawngreen: "#7cfc00",
|
|
70
|
-
lemonchiffon: "#fffacd",
|
|
71
|
-
lightblue: "#add8e6",
|
|
72
|
-
lightcoral: "#f08080",
|
|
73
|
-
lightcyan: "#e0ffff",
|
|
74
|
-
lightgoldenrodyellow: "#fafad2",
|
|
75
|
-
lightgray: "#d3d3d3",
|
|
76
|
-
lightgreen: "#90ee90",
|
|
77
|
-
lightgrey: "#d3d3d3",
|
|
78
|
-
lightpink: "#ffb6c1",
|
|
79
|
-
lightsalmon: "#ffa07a",
|
|
80
|
-
lightseagreen: "#20b2aa",
|
|
81
|
-
lightskyblue: "#87cefa",
|
|
82
|
-
lightslategray: "#778899",
|
|
83
|
-
lightslategrey: "#778899",
|
|
84
|
-
lightsteelblue: "#b0c4de",
|
|
85
|
-
lightyellow: "#ffffe0",
|
|
86
|
-
lime: "#00ff00",
|
|
87
|
-
limegreen: "#32cd32",
|
|
88
|
-
linen: "#faf0e6",
|
|
89
|
-
magenta: "#ff00ff",
|
|
90
|
-
maroon: "#800000",
|
|
91
|
-
mediumaquamarine: "#66cdaa",
|
|
92
|
-
mediumblue: "#0000cd",
|
|
93
|
-
mediumorchid: "#ba55d3",
|
|
94
|
-
mediumpurple: "#9370db",
|
|
95
|
-
mediumseagreen: "#3cb371",
|
|
96
|
-
mediumslateblue: "#7b68ee",
|
|
97
|
-
mediumspringgreen: "#00fa9a",
|
|
98
|
-
mediumturquoise: "#48d1cc",
|
|
99
|
-
mediumvioletred: "#c71585",
|
|
100
|
-
midnightblue: "#191970",
|
|
101
|
-
mintcream: "#f5fffa",
|
|
102
|
-
mistyrose: "#ffe4e1",
|
|
103
|
-
moccasin: "#ffe4b5",
|
|
104
|
-
navajowhite: "#ffdead",
|
|
105
|
-
navy: "#000080",
|
|
106
|
-
oldlace: "#fdf5e6",
|
|
107
|
-
olive: "#808000",
|
|
108
|
-
olivedrab: "#6b8e23",
|
|
109
|
-
orange: "#ffa500",
|
|
110
|
-
orangered: "#ff4500",
|
|
111
|
-
orchid: "#da70d6",
|
|
112
|
-
palegoldenrod: "#eee8aa",
|
|
113
|
-
palegreen: "#98fb98",
|
|
114
|
-
paleturquoise: "#afeeee",
|
|
115
|
-
palevioletred: "#db7093",
|
|
116
|
-
papayawhip: "#ffefd5",
|
|
117
|
-
peachpuff: "#ffdab9",
|
|
118
|
-
peru: "#cd853f",
|
|
119
|
-
pink: "#ffc0cb",
|
|
120
|
-
plum: "#dda0dd",
|
|
121
|
-
powderblue: "#b0e0e6",
|
|
122
|
-
purple: "#800080",
|
|
123
|
-
rebeccapurple: "#663399",
|
|
124
|
-
red: "#ff0000",
|
|
125
|
-
rosybrown: "#bc8f8f",
|
|
126
|
-
royalblue: "#4169e1",
|
|
127
|
-
saddlebrown: "#8b4513",
|
|
128
|
-
salmon: "#fa8072",
|
|
129
|
-
sandybrown: "#f4a460",
|
|
130
|
-
seagreen: "#2e8b57",
|
|
131
|
-
seashell: "#fff5ee",
|
|
132
|
-
sienna: "#a0522d",
|
|
133
|
-
silver: "#c0c0c0",
|
|
134
|
-
skyblue: "#87ceeb",
|
|
135
|
-
slateblue: "#6a5acd",
|
|
136
|
-
slategray: "#708090",
|
|
137
|
-
slategrey: "#708090",
|
|
138
|
-
snow: "#fffafa",
|
|
139
|
-
springgreen: "#00ff7f",
|
|
140
|
-
steelblue: "#4682b4",
|
|
141
|
-
tan: "#d2b48c",
|
|
142
|
-
teal: "#008080",
|
|
143
|
-
thistle: "#d8bfd8",
|
|
144
|
-
tomato: "#ff6347",
|
|
145
|
-
transparent: "#00000000",
|
|
146
|
-
turquoise: "#40e0d0",
|
|
147
|
-
violet: "#ee82ee",
|
|
148
|
-
wheat: "#f5deb3",
|
|
149
|
-
white: "#ffffff",
|
|
150
|
-
whitesmoke: "#f5f5f5",
|
|
151
|
-
yellow: "#ffff00",
|
|
152
|
-
yellowgreen: "#9acd32",
|
|
153
|
-
};
|
|
154
|
-
const hueToRgb = (p, q, t) => {
|
|
155
|
-
let h = t;
|
|
156
|
-
if (h < 0)
|
|
157
|
-
h += 1;
|
|
158
|
-
if (h > 1)
|
|
159
|
-
h -= 1;
|
|
160
|
-
if (h < 1 / 6)
|
|
161
|
-
return p + (q - p) * 6 * h;
|
|
162
|
-
if (h < 1 / 2)
|
|
163
|
-
return q;
|
|
164
|
-
if (h < 2 / 3)
|
|
165
|
-
return p + (q - p) * (2 / 3 - h) * 6;
|
|
166
|
-
return p;
|
|
167
|
-
};
|
|
168
|
-
const hslToRgb = (h, s, l) => {
|
|
169
|
-
if (s === 0) {
|
|
170
|
-
const v = Math.round(l * 255);
|
|
171
|
-
return [v, v, v];
|
|
172
|
-
}
|
|
173
|
-
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
174
|
-
const p = 2 * l - q;
|
|
175
|
-
return [
|
|
176
|
-
Math.round(hueToRgb(p, q, h + 1 / 3) * 255),
|
|
177
|
-
Math.round(hueToRgb(p, q, h) * 255),
|
|
178
|
-
Math.round(hueToRgb(p, q, h - 1 / 3) * 255),
|
|
179
|
-
];
|
|
180
|
-
};
|
|
181
|
-
const parseColor = (input) => {
|
|
182
|
-
let color = input.trim().toLowerCase();
|
|
183
|
-
const named = NAMED_COLORS[color];
|
|
184
|
-
if (named)
|
|
185
|
-
color = named;
|
|
186
|
-
if (color.startsWith("#")) {
|
|
187
|
-
const hex = color.slice(1);
|
|
188
|
-
if (hex.length === 3 || hex.length === 4) {
|
|
189
|
-
const r = Number.parseInt(hex.charAt(0) + hex.charAt(0), 16);
|
|
190
|
-
const g = Number.parseInt(hex.charAt(1) + hex.charAt(1), 16);
|
|
191
|
-
const b = Number.parseInt(hex.charAt(2) + hex.charAt(2), 16);
|
|
192
|
-
const a = hex.length === 4 ? Number.parseInt(hex.charAt(3) + hex.charAt(3), 16) / 255 : 1;
|
|
193
|
-
return { r, g, b, a };
|
|
194
|
-
}
|
|
195
|
-
if (hex.length === 6 || hex.length === 8) {
|
|
196
|
-
const r = Number.parseInt(hex.slice(0, 2), 16);
|
|
197
|
-
const g = Number.parseInt(hex.slice(2, 4), 16);
|
|
198
|
-
const b = Number.parseInt(hex.slice(4, 6), 16);
|
|
199
|
-
const a = hex.length === 8 ? Number.parseInt(hex.slice(6, 8), 16) / 255 : 1;
|
|
200
|
-
return { r, g, b, a };
|
|
201
|
-
}
|
|
202
|
-
throw new Error(`interpolateColors(): invalid hex color "${input}"`);
|
|
203
|
-
}
|
|
204
|
-
const rgbMatch = color.match(/^rgba?\(\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)\s*(?:,\s*(-?\d+(?:\.\d+)?)\s*)?\)$/);
|
|
205
|
-
if (rgbMatch) {
|
|
206
|
-
return {
|
|
207
|
-
r: Number(rgbMatch[1]),
|
|
208
|
-
g: Number(rgbMatch[2]),
|
|
209
|
-
b: Number(rgbMatch[3]),
|
|
210
|
-
a: rgbMatch[4] !== undefined ? Number(rgbMatch[4]) : 1,
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
const hslMatch = color.match(/^hsla?\(\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*(?:,\s*(-?\d+(?:\.\d+)?)\s*)?\)$/);
|
|
214
|
-
if (hslMatch) {
|
|
215
|
-
const h = (((Number(hslMatch[1]) % 360) + 360) % 360) / 360;
|
|
216
|
-
const s = Number(hslMatch[2]) / 100;
|
|
217
|
-
const l = Number(hslMatch[3]) / 100;
|
|
218
|
-
const [r, g, b] = hslToRgb(h, s, l);
|
|
219
|
-
const a = hslMatch[4] !== undefined ? Number(hslMatch[4]) : 1;
|
|
220
|
-
return { r, g, b, a };
|
|
221
|
-
}
|
|
222
|
-
throw new Error(`interpolateColors(): unsupported color format "${input}"`);
|
|
223
|
-
};
|
|
224
|
-
/**
|
|
225
|
-
* Interpolates between a list of colors. API-compatible with Remotion's
|
|
226
|
-
* `interpolateColors`. Returns an `rgba(r, g, b, a)` string. Extrapolation
|
|
227
|
-
* is clamped on both sides.
|
|
228
|
-
*/
|
|
229
|
-
export const interpolateColors = (input, inputRange, outputRange) => {
|
|
230
|
-
if (inputRange.length !== outputRange.length) {
|
|
231
|
-
throw new Error("interpolateColors(): inputRange and outputRange must have the same length");
|
|
232
|
-
}
|
|
233
|
-
const parsed = outputRange.map(parseColor);
|
|
234
|
-
const r = Math.round(interpolate(input, inputRange, parsed.map((c) => c.r), { extrapolateLeft: "clamp", extrapolateRight: "clamp" }));
|
|
235
|
-
const g = Math.round(interpolate(input, inputRange, parsed.map((c) => c.g), { extrapolateLeft: "clamp", extrapolateRight: "clamp" }));
|
|
236
|
-
const b = Math.round(interpolate(input, inputRange, parsed.map((c) => c.b), { extrapolateLeft: "clamp", extrapolateRight: "clamp" }));
|
|
237
|
-
const a = interpolate(input, inputRange, parsed.map((c) => c.a), { extrapolateLeft: "clamp", extrapolateRight: "clamp" });
|
|
238
|
-
return `rgba(${r}, ${g}, ${b}, ${a})`;
|
|
239
|
-
};
|
|
240
|
-
//# sourceMappingURL=interpolate-colors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interpolate-colors.js","sourceRoot":"","sources":["../src/interpolate-colors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/C,+CAA+C;AAC/C,MAAM,YAAY,GAA2B;IAC3C,SAAS,EAAE,SAAS;IACpB,YAAY,EAAE,SAAS;IACvB,IAAI,EAAE,SAAS;IACf,UAAU,EAAE,SAAS;IAC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AAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAE3C,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAClB,WAAW,CACT,KAAK,EACL,UAAU,EACV,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EACtB,EAAE,eAAe,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,CACxD,CACF,CAAC;IACF,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAClB,WAAW,CACT,KAAK,EACL,UAAU,EACV,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EACtB,EAAE,eAAe,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,CACxD,CACF,CAAC;IACF,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAClB,WAAW,CACT,KAAK,EACL,UAAU,EACV,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EACtB,EAAE,eAAe,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,CACxD,CACF,CAAC;IACF,MAAM,CAAC,GAAG,WAAW,CACnB,KAAK,EACL,UAAU,EACV,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EACtB,EAAE,eAAe,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,CACxD,CAAC;IAEF,OAAO,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;AACxC,CAAC,CAAC"}
|
package/dist/interpolate.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export type ExtrapolateType = "extend" | "identity" | "clamp" | "wrap";
|
|
2
|
-
export type InterpolateOptions = {
|
|
3
|
-
easing?: (input: number) => number;
|
|
4
|
-
extrapolateLeft?: ExtrapolateType;
|
|
5
|
-
extrapolateRight?: ExtrapolateType;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Maps `input` from `inputRange` onto `outputRange`. API-compatible with
|
|
9
|
-
* Remotion's `interpolate`.
|
|
10
|
-
*/
|
|
11
|
-
export declare const interpolate: (input: number, inputRange: readonly number[], outputRange: readonly number[], options?: InterpolateOptions) => number;
|
|
12
|
-
//# sourceMappingURL=interpolate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interpolate.d.ts","sourceRoot":"","sources":["../src/interpolate.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;AAEvE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACnC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,gBAAgB,CAAC,EAAE,eAAe,CAAC;CACpC,CAAC;AAgDF;;;GAGG;AACH,eAAO,MAAM,WAAW,GACtB,OAAO,MAAM,EACb,YAAY,SAAS,MAAM,EAAE,EAC7B,aAAa,SAAS,MAAM,EAAE,EAC9B,UAAU,kBAAkB,KAC3B,MAiCF,CAAC"}
|