chnobli 0.1.7 → 0.1.9
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/package.json +24 -11
- package/src/animation/Animation.ts +10 -6
- package/src/animation/public.ts +47 -10
- package/src/chnobli.ts +20 -11
- package/src/property/BasicProperty.ts +3 -3
- package/src/property/ClassProperty.ts +2 -2
- package/src/property/Property.ts +7 -5
- package/src/property/StyleProperty.ts +7 -7
- package/src/property/TransformProperty.ts +4 -4
- package/src/property/TransformXYProperty.ts +3 -3
- package/src/responsive/TestEvent.ts +1 -1
- package/src/scroll/Scroll.ts +174 -90
- package/src/scroll/index.ts +8 -0
- package/src/scroll/public.ts +23 -12
- package/src/stagger/stagger.ts +34 -14
- package/src/target/BaseTarget.old.ts +2 -2
- package/src/target/DomTarget.ts +3 -3
- package/src/target/ObjectTarget.ts +124 -0
- package/src/target/Target.ts +16 -3
- package/src/tests/properties.test.ts +54 -4
- package/src/tests/timeline.test.ts +3 -3
- package/src/tests/timing.test.ts +1 -1
- package/src/tests/usecases.test.ts +5 -5
- package/src/tests/values.test.ts +4 -4
- package/src/timeline/Nested.ts +7 -7
- package/src/timeline/{TimeLine.ts → Timeline.ts} +29 -9
- package/src/timeline/public.ts +198 -58
- package/src/timing/AnimationFrameTicker.ts +2 -2
- package/src/timing/TestTicker.ts +2 -2
- package/src/timing/Ticker.ts +1 -1
- package/src/timing/Timing.ts +38 -4
- package/src/utils/internal.ts +6 -3
- package/src/utils/utils.ts +18 -9
- package/src/values/ColorValue.ts +1 -1
- package/src/values/StyleValue.ts +15 -3
- package/tsconfig.build.json +2 -2
- package/tsconfig.json +2 -3
- package/.editorconfig +0 -11
- package/.github/workflows/ci.yaml +0 -34
- package/.prettierignore +0 -4
- package/.prettierrc +0 -6
- package/.vscode/settings.json +0 -4
- package/LICENSE.md +0 -21
- package/README.md +0 -5
- package/auto-docs/easing.js.html +0 -342
- package/auto-docs/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/auto-docs/fonts/OpenSans-Bold-webfont.svg +0 -1830
- package/auto-docs/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/auto-docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/auto-docs/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
- package/auto-docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/auto-docs/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/auto-docs/fonts/OpenSans-Italic-webfont.svg +0 -1830
- package/auto-docs/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/auto-docs/fonts/OpenSans-Light-webfont.eot +0 -0
- package/auto-docs/fonts/OpenSans-Light-webfont.svg +0 -1831
- package/auto-docs/fonts/OpenSans-Light-webfont.woff +0 -0
- package/auto-docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/auto-docs/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
- package/auto-docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/auto-docs/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/auto-docs/fonts/OpenSans-Regular-webfont.svg +0 -1831
- package/auto-docs/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/auto-docs/global.html +0 -4810
- package/auto-docs/index.html +0 -65
- package/auto-docs/scripts/linenumber.js +0 -25
- package/auto-docs/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/auto-docs/scripts/prettify/lang-css.js +0 -2
- package/auto-docs/scripts/prettify/prettify.js +0 -28
- package/auto-docs/styles/jsdoc-default.css +0 -358
- package/auto-docs/styles/prettify-jsdoc.css +0 -111
- package/auto-docs/styles/prettify-tomorrow.css +0 -132
- package/dist/animation/Animation.d.ts +0 -36
- package/dist/animation/Animation.d.ts.map +0 -1
- package/dist/animation/Animation.js +0 -230
- package/dist/animation/Animation.js.map +0 -1
- package/dist/animation/animation.d.ts +0 -36
- package/dist/animation/animation.d.ts.map +0 -1
- package/dist/animation/animation.js +0 -230
- package/dist/animation/animation.js.map +0 -1
- package/dist/animation/public.d.ts +0 -55
- package/dist/animation/public.d.ts.map +0 -1
- package/dist/animation/public.js +0 -104
- package/dist/animation/public.js.map +0 -1
- package/dist/chnobli.d.ts +0 -15
- package/dist/chnobli.d.ts.map +0 -1
- package/dist/chnobli.js +0 -63
- package/dist/chnobli.js.map +0 -1
- package/dist/property/BasicProperty.d.ts +0 -38
- package/dist/property/BasicProperty.d.ts.map +0 -1
- package/dist/property/BasicProperty.js +0 -72
- package/dist/property/BasicProperty.js.map +0 -1
- package/dist/property/ClassProperty.d.ts +0 -32
- package/dist/property/ClassProperty.d.ts.map +0 -1
- package/dist/property/ClassProperty.js +0 -108
- package/dist/property/ClassProperty.js.map +0 -1
- package/dist/property/Property.d.ts +0 -13
- package/dist/property/Property.d.ts.map +0 -1
- package/dist/property/Property.js +0 -20
- package/dist/property/Property.js.map +0 -1
- package/dist/property/StyleProperty.d.ts +0 -25
- package/dist/property/StyleProperty.d.ts.map +0 -1
- package/dist/property/StyleProperty.js +0 -221
- package/dist/property/StyleProperty.js.map +0 -1
- package/dist/property/TransformProperty.d.ts +0 -15
- package/dist/property/TransformProperty.d.ts.map +0 -1
- package/dist/property/TransformProperty.js +0 -43
- package/dist/property/TransformProperty.js.map +0 -1
- package/dist/property/TransformXYProperty.d.ts +0 -28
- package/dist/property/TransformXYProperty.d.ts.map +0 -1
- package/dist/property/TransformXYProperty.js +0 -65
- package/dist/property/TransformXYProperty.js.map +0 -1
- package/dist/responsive/ResponsiveEvent.d.ts +0 -17
- package/dist/responsive/ResponsiveEvent.d.ts.map +0 -1
- package/dist/responsive/ResponsiveEvent.js +0 -45
- package/dist/responsive/ResponsiveEvent.js.map +0 -1
- package/dist/responsive/TestEvent.d.ts +0 -11
- package/dist/responsive/TestEvent.d.ts.map +0 -1
- package/dist/responsive/TestEvent.js +0 -26
- package/dist/responsive/TestEvent.js.map +0 -1
- package/dist/responsive/event.d.ts +0 -10
- package/dist/responsive/event.d.ts.map +0 -1
- package/dist/responsive/event.js +0 -39
- package/dist/responsive/event.js.map +0 -1
- package/dist/scroll/Scroll.d.ts +0 -27
- package/dist/scroll/Scroll.d.ts.map +0 -1
- package/dist/scroll/Scroll.js +0 -132
- package/dist/scroll/Scroll.js.map +0 -1
- package/dist/scroll/ScrollEvent.d.ts +0 -17
- package/dist/scroll/ScrollEvent.d.ts.map +0 -1
- package/dist/scroll/ScrollEvent.js +0 -39
- package/dist/scroll/ScrollEvent.js.map +0 -1
- package/dist/scroll/public.d.ts +0 -7
- package/dist/scroll/public.d.ts.map +0 -1
- package/dist/scroll/public.js +0 -17
- package/dist/scroll/public.js.map +0 -1
- package/dist/stagger/stagger.d.ts +0 -13
- package/dist/stagger/stagger.d.ts.map +0 -1
- package/dist/stagger/stagger.js +0 -35
- package/dist/stagger/stagger.js.map +0 -1
- package/dist/target/BaseTarget.old.d.ts +0 -33
- package/dist/target/BaseTarget.old.d.ts.map +0 -1
- package/dist/target/BaseTarget.old.js +0 -73
- package/dist/target/BaseTarget.old.js.map +0 -1
- package/dist/target/DomTarget.d.ts +0 -41
- package/dist/target/DomTarget.d.ts.map +0 -1
- package/dist/target/DomTarget.js +0 -230
- package/dist/target/DomTarget.js.map +0 -1
- package/dist/target/Target.d.ts +0 -22
- package/dist/target/Target.d.ts.map +0 -1
- package/dist/target/Target.js +0 -21
- package/dist/target/Target.js.map +0 -1
- package/dist/target/TestDomNode.d.ts +0 -14
- package/dist/target/TestDomNode.d.ts.map +0 -1
- package/dist/target/TestDomNode.js +0 -55
- package/dist/target/TestDomNode.js.map +0 -1
- package/dist/timeline/Nested.d.ts +0 -30
- package/dist/timeline/Nested.d.ts.map +0 -1
- package/dist/timeline/Nested.js +0 -51
- package/dist/timeline/Nested.js.map +0 -1
- package/dist/timeline/TimeLine.d.ts +0 -32
- package/dist/timeline/TimeLine.d.ts.map +0 -1
- package/dist/timeline/TimeLine.js +0 -288
- package/dist/timeline/TimeLine.js.map +0 -1
- package/dist/timeline/public.d.ts +0 -120
- package/dist/timeline/public.d.ts.map +0 -1
- package/dist/timeline/public.js +0 -301
- package/dist/timeline/public.js.map +0 -1
- package/dist/timing/AnimationFrameTicker.d.ts +0 -32
- package/dist/timing/AnimationFrameTicker.d.ts.map +0 -1
- package/dist/timing/AnimationFrameTicker.js +0 -134
- package/dist/timing/AnimationFrameTicker.js.map +0 -1
- package/dist/timing/Ease.d.ts +0 -6
- package/dist/timing/Ease.d.ts.map +0 -1
- package/dist/timing/Ease.js +0 -15
- package/dist/timing/Ease.js.map +0 -1
- package/dist/timing/TestTicker.d.ts +0 -19
- package/dist/timing/TestTicker.d.ts.map +0 -1
- package/dist/timing/TestTicker.js +0 -81
- package/dist/timing/TestTicker.js.map +0 -1
- package/dist/timing/Ticker.d.ts +0 -14
- package/dist/timing/Ticker.d.ts.map +0 -1
- package/dist/timing/Ticker.js +0 -2
- package/dist/timing/Ticker.js.map +0 -1
- package/dist/timing/Timing.d.ts +0 -62
- package/dist/timing/Timing.d.ts.map +0 -1
- package/dist/timing/Timing.js +0 -257
- package/dist/timing/Timing.js.map +0 -1
- package/dist/timing/easing.d.ts +0 -158
- package/dist/timing/easing.d.ts.map +0 -1
- package/dist/timing/easing.js +0 -273
- package/dist/timing/easing.js.map +0 -1
- package/dist/utils/Events.d.ts +0 -9
- package/dist/utils/Events.d.ts.map +0 -1
- package/dist/utils/Events.js +0 -35
- package/dist/utils/Events.js.map +0 -1
- package/dist/utils/internal.d.ts +0 -2
- package/dist/utils/internal.d.ts.map +0 -1
- package/dist/utils/internal.js +0 -6
- package/dist/utils/internal.js.map +0 -1
- package/dist/utils/motionpath.d.ts +0 -16
- package/dist/utils/motionpath.d.ts.map +0 -1
- package/dist/utils/motionpath.js +0 -41
- package/dist/utils/motionpath.js.map +0 -1
- package/dist/utils/utils.d.ts +0 -43
- package/dist/utils/utils.d.ts.map +0 -1
- package/dist/utils/utils.js +0 -93
- package/dist/utils/utils.js.map +0 -1
- package/dist/values/ColorValue.d.ts +0 -12
- package/dist/values/ColorValue.d.ts.map +0 -1
- package/dist/values/ColorValue.js +0 -133
- package/dist/values/ColorValue.js.map +0 -1
- package/dist/values/StyleValue.d.ts +0 -40
- package/dist/values/StyleValue.d.ts.map +0 -1
- package/dist/values/StyleValue.js +0 -149
- package/dist/values/StyleValue.js.map +0 -1
- package/dist/values/Value.d.ts +0 -13
- package/dist/values/Value.d.ts.map +0 -1
- package/dist/values/Value.js +0 -38
- package/dist/values/Value.js.map +0 -1
- package/dist/values/defaultcolors.d.ts +0 -2
- package/dist/values/defaultcolors.d.ts.map +0 -1
- package/dist/values/defaultcolors.js +0 -149
- package/dist/values/defaultcolors.js.map +0 -1
- package/docs/INDEX.md +0 -15
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chnobli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"author": "Sören Meier <info@soerenmeier.ch>",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"docs": "jsdoc -c jsdoc.conf.json",
|
|
8
8
|
"check": "tsc",
|
|
9
9
|
"lint": "eslint ./src",
|
|
10
|
-
"test": "node --expose-gc
|
|
11
|
-
"test:
|
|
10
|
+
"test": "node --expose-gc ../node_modules/.bin/vitest run",
|
|
11
|
+
"test:watch": "node --expose-gc ../node_modules/.bin/vitest",
|
|
12
12
|
"build": "tsc -p tsconfig.build.json",
|
|
13
|
-
"watch": "tsc -w"
|
|
13
|
+
"watch": "tsc -w -p tsconfig.build.json"
|
|
14
14
|
},
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
@@ -18,20 +18,33 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"exports": {
|
|
21
|
-
"./easing":
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
"./easing": {
|
|
22
|
+
"import": "./dist/timing/easing.js",
|
|
23
|
+
"types": "./dist/timing/easing.d.ts"
|
|
24
|
+
},
|
|
25
|
+
"./utils": {
|
|
26
|
+
"import": "./dist/utils/utils.js",
|
|
27
|
+
"types": "./dist/utils/utils.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"./scroll": {
|
|
30
|
+
"import": "./dist/scroll/index.js",
|
|
31
|
+
"types": "./dist/scroll/index.d.ts"
|
|
32
|
+
},
|
|
33
|
+
".": {
|
|
34
|
+
"import": "./dist/chnobli.js",
|
|
35
|
+
"types": "./dist/chnobli.d.ts"
|
|
36
|
+
}
|
|
24
37
|
},
|
|
25
38
|
"devDependencies": {
|
|
26
39
|
"eslint": "^8.45.0",
|
|
27
40
|
"jsdoc": "^4.0.2",
|
|
28
|
-
"typescript": "^5.1.6",
|
|
29
|
-
"vitest": "^1.1.3",
|
|
30
41
|
"prettier": "^3.2.4",
|
|
31
|
-
"tslib": "^2.6.2"
|
|
42
|
+
"tslib": "^2.6.2",
|
|
43
|
+
"typescript": "^5.1.6",
|
|
44
|
+
"vitest": "^1.1.3"
|
|
32
45
|
},
|
|
33
46
|
"dependencies": {
|
|
34
47
|
"bezier-easing": "^2.1.0",
|
|
35
|
-
"fire": "npm:fire-lib-js@^0.3.0
|
|
48
|
+
"fire": "npm:fire-lib-js@^0.3.0"
|
|
36
49
|
}
|
|
37
50
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import Timing, {
|
|
1
|
+
import Timing, {
|
|
2
|
+
newTiming,
|
|
3
|
+
STATE_BEFORE,
|
|
4
|
+
STATE_AFTER,
|
|
5
|
+
} from '../timing/Timing.js';
|
|
2
6
|
|
|
3
|
-
import Property, { ParseableValue, newProperty } from '../property/Property';
|
|
4
|
-
import Ticker from '../timing/Ticker';
|
|
5
|
-
import { Target } from '../target/Target';
|
|
7
|
+
import Property, { ParseableValue, newProperty } from '../property/Property.js';
|
|
8
|
+
import Ticker from '../timing/Ticker.js';
|
|
9
|
+
import { Target } from '../target/Target.js';
|
|
6
10
|
|
|
7
11
|
export default class Animation {
|
|
8
12
|
timing: Timing;
|
|
@@ -112,6 +116,7 @@ class PropertyAnimation<V> {
|
|
|
112
116
|
private valueFn: ((pos: number) => ParseableValue) | null;
|
|
113
117
|
|
|
114
118
|
private iniResponsive: any;
|
|
119
|
+
// todo i don't think the types match here?
|
|
115
120
|
private iniFrom: V | null;
|
|
116
121
|
private iniTo: V | null;
|
|
117
122
|
|
|
@@ -162,8 +167,7 @@ class PropertyAnimation<V> {
|
|
|
162
167
|
|
|
163
168
|
// init via responsive fn
|
|
164
169
|
if (this.iniResponsive) {
|
|
165
|
-
|
|
166
|
-
const value = this.iniResponsive((target as any).target);
|
|
170
|
+
const value = this.iniResponsive(target.inner());
|
|
167
171
|
|
|
168
172
|
if (typeof value === 'object') {
|
|
169
173
|
if ('from' in value) from = this.prop.parseValue(value.from);
|
package/src/animation/public.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
import { takeProp } from '../utils/internal';
|
|
2
|
-
import Timeline from '../timeline/public';
|
|
3
|
-
import { staggerMap } from '../stagger/stagger';
|
|
1
|
+
import { takeProp } from '../utils/internal.js';
|
|
2
|
+
import Timeline from '../timeline/public.js';
|
|
3
|
+
import Stagger, { staggerMap } from '../stagger/stagger.js';
|
|
4
|
+
import { Targets } from '../chnobli.js';
|
|
5
|
+
|
|
6
|
+
export type AnimationProps = {
|
|
7
|
+
autoplay?: boolean;
|
|
8
|
+
delay?: number | string | Stagger<number | string>;
|
|
9
|
+
|
|
10
|
+
ease?: (t: number) => number;
|
|
11
|
+
|
|
12
|
+
onStart?: () => void;
|
|
13
|
+
onEnd?: () => void;
|
|
14
|
+
|
|
15
|
+
// other properties
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
};
|
|
4
18
|
|
|
5
19
|
/**
|
|
6
20
|
* The animation consist of a timeline with just one animation
|
|
@@ -12,16 +26,36 @@ import { staggerMap } from '../stagger/stagger';
|
|
|
12
26
|
export default class PublicAnimation {
|
|
13
27
|
private _tl: Timeline;
|
|
14
28
|
|
|
15
|
-
constructor(targets:
|
|
29
|
+
constructor(targets: Targets, props: AnimationProps = {}) {
|
|
16
30
|
const autoplay = parseAutoplay(takeProp(props, 'autoplay', true));
|
|
17
|
-
const delay = takeProp(props, 'delay', 0);
|
|
31
|
+
const delay = takeProp<number>(props, 'delay', 0);
|
|
18
32
|
|
|
19
33
|
// we don't wan't the ease and duration on the timeline
|
|
20
|
-
const ease = takeProp(props, 'ease',
|
|
21
|
-
const duration = takeProp
|
|
34
|
+
const ease = takeProp<AnimationProps['ease']>(props, 'ease', undefined);
|
|
35
|
+
const duration = takeProp<number | undefined>(
|
|
36
|
+
props,
|
|
37
|
+
'duration',
|
|
38
|
+
undefined,
|
|
39
|
+
);
|
|
22
40
|
|
|
23
41
|
this._tl = new Timeline(props);
|
|
24
42
|
|
|
43
|
+
// events
|
|
44
|
+
const onStart = takeProp<AnimationProps['onStart']>(
|
|
45
|
+
props,
|
|
46
|
+
'onStart',
|
|
47
|
+
undefined,
|
|
48
|
+
);
|
|
49
|
+
if (onStart) this._tl.on('start', onStart);
|
|
50
|
+
|
|
51
|
+
// events
|
|
52
|
+
const onEnd = takeProp<AnimationProps['onEnd']>(
|
|
53
|
+
props,
|
|
54
|
+
'onEnd',
|
|
55
|
+
undefined,
|
|
56
|
+
);
|
|
57
|
+
if (onEnd) this._tl.on('end', onEnd);
|
|
58
|
+
|
|
25
59
|
props.ease = ease;
|
|
26
60
|
props.duration = duration;
|
|
27
61
|
|
|
@@ -83,7 +117,7 @@ export default class PublicAnimation {
|
|
|
83
117
|
/**
|
|
84
118
|
* Returns wether the timeline is set to reversed
|
|
85
119
|
*/
|
|
86
|
-
isReversed() {
|
|
120
|
+
isReversed(): boolean {
|
|
87
121
|
return this._tl.isReversed();
|
|
88
122
|
}
|
|
89
123
|
|
|
@@ -101,12 +135,15 @@ export default class PublicAnimation {
|
|
|
101
135
|
this._tl.reverse();
|
|
102
136
|
}
|
|
103
137
|
|
|
104
|
-
|
|
138
|
+
/**
|
|
139
|
+
* @returns a function to call to unregister the event
|
|
140
|
+
*/
|
|
141
|
+
on(event: string, fn: (...args: any[]) => void): () => void {
|
|
105
142
|
return this._tl.on(event, fn);
|
|
106
143
|
}
|
|
107
144
|
|
|
108
145
|
// not wroking
|
|
109
|
-
onPromise(event: string) {
|
|
146
|
+
onPromise(event: string): Promise<unknown> {
|
|
110
147
|
return this._tl.onPromise(event);
|
|
111
148
|
}
|
|
112
149
|
|
package/src/chnobli.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import Animation from './animation/public';
|
|
2
|
-
import Timeline from './timeline/public';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import Animation, { AnimationProps } from './animation/public.js';
|
|
2
|
+
import Timeline from './timeline/public.js';
|
|
3
|
+
import Stagger, { type StaggerValue } from './stagger/stagger.js';
|
|
4
|
+
import type { Targets, AnimationTarget } from './target/Target.js';
|
|
5
|
+
|
|
6
|
+
export type {
|
|
7
|
+
Animation,
|
|
8
|
+
Timeline,
|
|
9
|
+
Stagger,
|
|
10
|
+
Targets,
|
|
11
|
+
AnimationTarget,
|
|
12
|
+
StaggerValue,
|
|
13
|
+
AnimationProps,
|
|
14
|
+
};
|
|
5
15
|
|
|
6
16
|
// todo maybe add, to, from and fromTo to the animate function
|
|
7
17
|
|
|
@@ -11,22 +21,21 @@ import Stagger from './stagger/stagger';
|
|
|
11
21
|
* ## Properties
|
|
12
22
|
*
|
|
13
23
|
*/
|
|
14
|
-
export function animate(
|
|
24
|
+
export function animate(
|
|
25
|
+
targets: Targets,
|
|
26
|
+
props: AnimationProps = {},
|
|
27
|
+
): Animation {
|
|
15
28
|
return new Animation(targets, props);
|
|
16
29
|
}
|
|
17
30
|
|
|
18
|
-
export function timeline(props: Record<string, any> = {}) {
|
|
31
|
+
export function timeline(props: Record<string, any> = {}): Timeline {
|
|
19
32
|
return new Timeline(props);
|
|
20
33
|
}
|
|
21
34
|
|
|
22
|
-
export function stagger(value:
|
|
35
|
+
export function stagger<O>(value: StaggerValue<O>): Stagger<O> {
|
|
23
36
|
return new Stagger(value);
|
|
24
37
|
}
|
|
25
38
|
|
|
26
|
-
export function scroll(props: Record<string, any> = {}) {
|
|
27
|
-
return new Scroll(props);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
39
|
/*
|
|
31
40
|
|
|
32
41
|
animate(target, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Value from '../values/Value';
|
|
2
|
-
import Property, { ParseableValue } from './Property';
|
|
3
|
-
import { Target } from '../target/Target';
|
|
1
|
+
import Value from '../values/Value.js';
|
|
2
|
+
import Property, { ParseableValue } from './Property.js';
|
|
3
|
+
import { Target } from '../target/Target.js';
|
|
4
4
|
|
|
5
5
|
export default class BasicProperty implements Property<Value> {
|
|
6
6
|
/**
|
package/src/property/Property.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Target } from '../target/Target';
|
|
2
|
-
import TransformProperty, { TRANSFORM_PROPS } from './TransformProperty';
|
|
3
|
-
import TransformXYProperty from './TransformXYProperty';
|
|
4
|
-
import StyleProperty, { STYLE_PROPS } from './StyleProperty';
|
|
5
|
-
import ClassProperty from './ClassProperty';
|
|
1
|
+
import { Target } from '../target/Target.js';
|
|
2
|
+
import TransformProperty, { TRANSFORM_PROPS } from './TransformProperty.js';
|
|
3
|
+
import TransformXYProperty from './TransformXYProperty.js';
|
|
4
|
+
import StyleProperty, { STYLE_PROPS } from './StyleProperty.js';
|
|
5
|
+
import ClassProperty from './ClassProperty.js';
|
|
6
6
|
|
|
7
7
|
export type ParseableValue = string | number | (string | number)[];
|
|
8
8
|
|
|
@@ -20,6 +20,8 @@ export default interface Property<V, I = V> {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export function newProperty(prop: string, targetType = ''): Property<any> {
|
|
23
|
+
if (targetType === 'object') return new StyleProperty(prop, false);
|
|
24
|
+
|
|
23
25
|
if (targetType !== 'dom')
|
|
24
26
|
throw new Error('only dom is supported as target');
|
|
25
27
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import StyleValue from '../values/StyleValue';
|
|
2
|
-
import Property, { ParseableValue } from './Property';
|
|
3
|
-
import Value from '../values/Value';
|
|
4
|
-
import { Target } from '../target/Target';
|
|
5
|
-
import ColorValue, { RGBA } from '../values/ColorValue';
|
|
1
|
+
import StyleValue from '../values/StyleValue.js';
|
|
2
|
+
import Property, { ParseableValue } from './Property.js';
|
|
3
|
+
import Value from '../values/Value.js';
|
|
4
|
+
import { Target } from '../target/Target.js';
|
|
5
|
+
import ColorValue, { RGBA } from '../values/ColorValue.js';
|
|
6
6
|
|
|
7
7
|
export const STYLE_PROPS: Record<string, string | [number, string | null]> = {
|
|
8
8
|
position: 'static',
|
|
@@ -41,13 +41,13 @@ export default class StyleProperty
|
|
|
41
41
|
|
|
42
42
|
private _defaultValue: StyleValue | null;
|
|
43
43
|
|
|
44
|
-
constructor(name: string) {
|
|
44
|
+
constructor(name: string, useDefaults: boolean = true) {
|
|
45
45
|
this.name = name;
|
|
46
46
|
|
|
47
47
|
this.from = null;
|
|
48
48
|
this.to = null;
|
|
49
49
|
|
|
50
|
-
const def = STYLE_PROPS[name];
|
|
50
|
+
const def = useDefaults ? STYLE_PROPS[name] : undefined;
|
|
51
51
|
if (Array.isArray(def)) {
|
|
52
52
|
this._defaultValue = new StyleValue([new Value(def[0], def[1])]);
|
|
53
53
|
this.unit = def[1];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import Value from '../values/Value';
|
|
2
|
-
import BasicProperty from './BasicProperty';
|
|
3
|
-
import { ParseableValue } from './Property';
|
|
4
|
-
import { Target } from '../target/Target';
|
|
1
|
+
import Value from '../values/Value.js';
|
|
2
|
+
import BasicProperty from './BasicProperty.js';
|
|
3
|
+
import { ParseableValue } from './Property.js';
|
|
4
|
+
import { Target } from '../target/Target.js';
|
|
5
5
|
|
|
6
6
|
export const TRANSFORM_PROPS: Record<string, [number, string | null]> = {
|
|
7
7
|
x: [0, 'px'],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Value from '../values/Value';
|
|
2
|
-
import Property, { ParseableValue } from './Property';
|
|
3
|
-
import { Target } from '../target/Target';
|
|
1
|
+
import Value from '../values/Value.js';
|
|
2
|
+
import Property, { ParseableValue } from './Property.js';
|
|
3
|
+
import { Target } from '../target/Target.js';
|
|
4
4
|
|
|
5
5
|
export type XYValue = {
|
|
6
6
|
x: Value;
|