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.
Files changed (225) hide show
  1. package/package.json +24 -11
  2. package/src/animation/Animation.ts +10 -6
  3. package/src/animation/public.ts +47 -10
  4. package/src/chnobli.ts +20 -11
  5. package/src/property/BasicProperty.ts +3 -3
  6. package/src/property/ClassProperty.ts +2 -2
  7. package/src/property/Property.ts +7 -5
  8. package/src/property/StyleProperty.ts +7 -7
  9. package/src/property/TransformProperty.ts +4 -4
  10. package/src/property/TransformXYProperty.ts +3 -3
  11. package/src/responsive/TestEvent.ts +1 -1
  12. package/src/scroll/Scroll.ts +174 -90
  13. package/src/scroll/index.ts +8 -0
  14. package/src/scroll/public.ts +23 -12
  15. package/src/stagger/stagger.ts +34 -14
  16. package/src/target/BaseTarget.old.ts +2 -2
  17. package/src/target/DomTarget.ts +3 -3
  18. package/src/target/ObjectTarget.ts +124 -0
  19. package/src/target/Target.ts +16 -3
  20. package/src/tests/properties.test.ts +54 -4
  21. package/src/tests/timeline.test.ts +3 -3
  22. package/src/tests/timing.test.ts +1 -1
  23. package/src/tests/usecases.test.ts +5 -5
  24. package/src/tests/values.test.ts +4 -4
  25. package/src/timeline/Nested.ts +7 -7
  26. package/src/timeline/{TimeLine.ts → Timeline.ts} +29 -9
  27. package/src/timeline/public.ts +198 -58
  28. package/src/timing/AnimationFrameTicker.ts +2 -2
  29. package/src/timing/TestTicker.ts +2 -2
  30. package/src/timing/Ticker.ts +1 -1
  31. package/src/timing/Timing.ts +38 -4
  32. package/src/utils/internal.ts +6 -3
  33. package/src/utils/utils.ts +18 -9
  34. package/src/values/ColorValue.ts +1 -1
  35. package/src/values/StyleValue.ts +15 -3
  36. package/tsconfig.build.json +2 -2
  37. package/tsconfig.json +2 -3
  38. package/.editorconfig +0 -11
  39. package/.github/workflows/ci.yaml +0 -34
  40. package/.prettierignore +0 -4
  41. package/.prettierrc +0 -6
  42. package/.vscode/settings.json +0 -4
  43. package/LICENSE.md +0 -21
  44. package/README.md +0 -5
  45. package/auto-docs/easing.js.html +0 -342
  46. package/auto-docs/fonts/OpenSans-Bold-webfont.eot +0 -0
  47. package/auto-docs/fonts/OpenSans-Bold-webfont.svg +0 -1830
  48. package/auto-docs/fonts/OpenSans-Bold-webfont.woff +0 -0
  49. package/auto-docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  50. package/auto-docs/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
  51. package/auto-docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  52. package/auto-docs/fonts/OpenSans-Italic-webfont.eot +0 -0
  53. package/auto-docs/fonts/OpenSans-Italic-webfont.svg +0 -1830
  54. package/auto-docs/fonts/OpenSans-Italic-webfont.woff +0 -0
  55. package/auto-docs/fonts/OpenSans-Light-webfont.eot +0 -0
  56. package/auto-docs/fonts/OpenSans-Light-webfont.svg +0 -1831
  57. package/auto-docs/fonts/OpenSans-Light-webfont.woff +0 -0
  58. package/auto-docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  59. package/auto-docs/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
  60. package/auto-docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  61. package/auto-docs/fonts/OpenSans-Regular-webfont.eot +0 -0
  62. package/auto-docs/fonts/OpenSans-Regular-webfont.svg +0 -1831
  63. package/auto-docs/fonts/OpenSans-Regular-webfont.woff +0 -0
  64. package/auto-docs/global.html +0 -4810
  65. package/auto-docs/index.html +0 -65
  66. package/auto-docs/scripts/linenumber.js +0 -25
  67. package/auto-docs/scripts/prettify/Apache-License-2.0.txt +0 -202
  68. package/auto-docs/scripts/prettify/lang-css.js +0 -2
  69. package/auto-docs/scripts/prettify/prettify.js +0 -28
  70. package/auto-docs/styles/jsdoc-default.css +0 -358
  71. package/auto-docs/styles/prettify-jsdoc.css +0 -111
  72. package/auto-docs/styles/prettify-tomorrow.css +0 -132
  73. package/dist/animation/Animation.d.ts +0 -36
  74. package/dist/animation/Animation.d.ts.map +0 -1
  75. package/dist/animation/Animation.js +0 -230
  76. package/dist/animation/Animation.js.map +0 -1
  77. package/dist/animation/animation.d.ts +0 -36
  78. package/dist/animation/animation.d.ts.map +0 -1
  79. package/dist/animation/animation.js +0 -230
  80. package/dist/animation/animation.js.map +0 -1
  81. package/dist/animation/public.d.ts +0 -55
  82. package/dist/animation/public.d.ts.map +0 -1
  83. package/dist/animation/public.js +0 -104
  84. package/dist/animation/public.js.map +0 -1
  85. package/dist/chnobli.d.ts +0 -15
  86. package/dist/chnobli.d.ts.map +0 -1
  87. package/dist/chnobli.js +0 -63
  88. package/dist/chnobli.js.map +0 -1
  89. package/dist/property/BasicProperty.d.ts +0 -38
  90. package/dist/property/BasicProperty.d.ts.map +0 -1
  91. package/dist/property/BasicProperty.js +0 -72
  92. package/dist/property/BasicProperty.js.map +0 -1
  93. package/dist/property/ClassProperty.d.ts +0 -32
  94. package/dist/property/ClassProperty.d.ts.map +0 -1
  95. package/dist/property/ClassProperty.js +0 -108
  96. package/dist/property/ClassProperty.js.map +0 -1
  97. package/dist/property/Property.d.ts +0 -13
  98. package/dist/property/Property.d.ts.map +0 -1
  99. package/dist/property/Property.js +0 -20
  100. package/dist/property/Property.js.map +0 -1
  101. package/dist/property/StyleProperty.d.ts +0 -25
  102. package/dist/property/StyleProperty.d.ts.map +0 -1
  103. package/dist/property/StyleProperty.js +0 -221
  104. package/dist/property/StyleProperty.js.map +0 -1
  105. package/dist/property/TransformProperty.d.ts +0 -15
  106. package/dist/property/TransformProperty.d.ts.map +0 -1
  107. package/dist/property/TransformProperty.js +0 -43
  108. package/dist/property/TransformProperty.js.map +0 -1
  109. package/dist/property/TransformXYProperty.d.ts +0 -28
  110. package/dist/property/TransformXYProperty.d.ts.map +0 -1
  111. package/dist/property/TransformXYProperty.js +0 -65
  112. package/dist/property/TransformXYProperty.js.map +0 -1
  113. package/dist/responsive/ResponsiveEvent.d.ts +0 -17
  114. package/dist/responsive/ResponsiveEvent.d.ts.map +0 -1
  115. package/dist/responsive/ResponsiveEvent.js +0 -45
  116. package/dist/responsive/ResponsiveEvent.js.map +0 -1
  117. package/dist/responsive/TestEvent.d.ts +0 -11
  118. package/dist/responsive/TestEvent.d.ts.map +0 -1
  119. package/dist/responsive/TestEvent.js +0 -26
  120. package/dist/responsive/TestEvent.js.map +0 -1
  121. package/dist/responsive/event.d.ts +0 -10
  122. package/dist/responsive/event.d.ts.map +0 -1
  123. package/dist/responsive/event.js +0 -39
  124. package/dist/responsive/event.js.map +0 -1
  125. package/dist/scroll/Scroll.d.ts +0 -27
  126. package/dist/scroll/Scroll.d.ts.map +0 -1
  127. package/dist/scroll/Scroll.js +0 -132
  128. package/dist/scroll/Scroll.js.map +0 -1
  129. package/dist/scroll/ScrollEvent.d.ts +0 -17
  130. package/dist/scroll/ScrollEvent.d.ts.map +0 -1
  131. package/dist/scroll/ScrollEvent.js +0 -39
  132. package/dist/scroll/ScrollEvent.js.map +0 -1
  133. package/dist/scroll/public.d.ts +0 -7
  134. package/dist/scroll/public.d.ts.map +0 -1
  135. package/dist/scroll/public.js +0 -17
  136. package/dist/scroll/public.js.map +0 -1
  137. package/dist/stagger/stagger.d.ts +0 -13
  138. package/dist/stagger/stagger.d.ts.map +0 -1
  139. package/dist/stagger/stagger.js +0 -35
  140. package/dist/stagger/stagger.js.map +0 -1
  141. package/dist/target/BaseTarget.old.d.ts +0 -33
  142. package/dist/target/BaseTarget.old.d.ts.map +0 -1
  143. package/dist/target/BaseTarget.old.js +0 -73
  144. package/dist/target/BaseTarget.old.js.map +0 -1
  145. package/dist/target/DomTarget.d.ts +0 -41
  146. package/dist/target/DomTarget.d.ts.map +0 -1
  147. package/dist/target/DomTarget.js +0 -230
  148. package/dist/target/DomTarget.js.map +0 -1
  149. package/dist/target/Target.d.ts +0 -22
  150. package/dist/target/Target.d.ts.map +0 -1
  151. package/dist/target/Target.js +0 -21
  152. package/dist/target/Target.js.map +0 -1
  153. package/dist/target/TestDomNode.d.ts +0 -14
  154. package/dist/target/TestDomNode.d.ts.map +0 -1
  155. package/dist/target/TestDomNode.js +0 -55
  156. package/dist/target/TestDomNode.js.map +0 -1
  157. package/dist/timeline/Nested.d.ts +0 -30
  158. package/dist/timeline/Nested.d.ts.map +0 -1
  159. package/dist/timeline/Nested.js +0 -51
  160. package/dist/timeline/Nested.js.map +0 -1
  161. package/dist/timeline/TimeLine.d.ts +0 -32
  162. package/dist/timeline/TimeLine.d.ts.map +0 -1
  163. package/dist/timeline/TimeLine.js +0 -288
  164. package/dist/timeline/TimeLine.js.map +0 -1
  165. package/dist/timeline/public.d.ts +0 -120
  166. package/dist/timeline/public.d.ts.map +0 -1
  167. package/dist/timeline/public.js +0 -301
  168. package/dist/timeline/public.js.map +0 -1
  169. package/dist/timing/AnimationFrameTicker.d.ts +0 -32
  170. package/dist/timing/AnimationFrameTicker.d.ts.map +0 -1
  171. package/dist/timing/AnimationFrameTicker.js +0 -134
  172. package/dist/timing/AnimationFrameTicker.js.map +0 -1
  173. package/dist/timing/Ease.d.ts +0 -6
  174. package/dist/timing/Ease.d.ts.map +0 -1
  175. package/dist/timing/Ease.js +0 -15
  176. package/dist/timing/Ease.js.map +0 -1
  177. package/dist/timing/TestTicker.d.ts +0 -19
  178. package/dist/timing/TestTicker.d.ts.map +0 -1
  179. package/dist/timing/TestTicker.js +0 -81
  180. package/dist/timing/TestTicker.js.map +0 -1
  181. package/dist/timing/Ticker.d.ts +0 -14
  182. package/dist/timing/Ticker.d.ts.map +0 -1
  183. package/dist/timing/Ticker.js +0 -2
  184. package/dist/timing/Ticker.js.map +0 -1
  185. package/dist/timing/Timing.d.ts +0 -62
  186. package/dist/timing/Timing.d.ts.map +0 -1
  187. package/dist/timing/Timing.js +0 -257
  188. package/dist/timing/Timing.js.map +0 -1
  189. package/dist/timing/easing.d.ts +0 -158
  190. package/dist/timing/easing.d.ts.map +0 -1
  191. package/dist/timing/easing.js +0 -273
  192. package/dist/timing/easing.js.map +0 -1
  193. package/dist/utils/Events.d.ts +0 -9
  194. package/dist/utils/Events.d.ts.map +0 -1
  195. package/dist/utils/Events.js +0 -35
  196. package/dist/utils/Events.js.map +0 -1
  197. package/dist/utils/internal.d.ts +0 -2
  198. package/dist/utils/internal.d.ts.map +0 -1
  199. package/dist/utils/internal.js +0 -6
  200. package/dist/utils/internal.js.map +0 -1
  201. package/dist/utils/motionpath.d.ts +0 -16
  202. package/dist/utils/motionpath.d.ts.map +0 -1
  203. package/dist/utils/motionpath.js +0 -41
  204. package/dist/utils/motionpath.js.map +0 -1
  205. package/dist/utils/utils.d.ts +0 -43
  206. package/dist/utils/utils.d.ts.map +0 -1
  207. package/dist/utils/utils.js +0 -93
  208. package/dist/utils/utils.js.map +0 -1
  209. package/dist/values/ColorValue.d.ts +0 -12
  210. package/dist/values/ColorValue.d.ts.map +0 -1
  211. package/dist/values/ColorValue.js +0 -133
  212. package/dist/values/ColorValue.js.map +0 -1
  213. package/dist/values/StyleValue.d.ts +0 -40
  214. package/dist/values/StyleValue.d.ts.map +0 -1
  215. package/dist/values/StyleValue.js +0 -149
  216. package/dist/values/StyleValue.js.map +0 -1
  217. package/dist/values/Value.d.ts +0 -13
  218. package/dist/values/Value.d.ts.map +0 -1
  219. package/dist/values/Value.js +0 -38
  220. package/dist/values/Value.js.map +0 -1
  221. package/dist/values/defaultcolors.d.ts +0 -2
  222. package/dist/values/defaultcolors.d.ts.map +0 -1
  223. package/dist/values/defaultcolors.js +0 -149
  224. package/dist/values/defaultcolors.js.map +0 -1
  225. package/docs/INDEX.md +0 -15
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "chnobli",
3
- "version": "0.1.7",
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 ./node_modules/.bin/vitest",
11
- "test:once": "node --expose-gc ./node_modules/.bin/vitest run",
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": "./dist/timing/easing.js",
22
- "./utils": "./dist/utils/utils.js",
23
- ".": "./dist/chnobli.js"
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-alpha.11"
48
+ "fire": "npm:fire-lib-js@^0.3.0"
36
49
  }
37
50
  }
@@ -1,8 +1,12 @@
1
- import Timing, { newTiming, STATE_BEFORE, STATE_AFTER } from '../timing/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
- // todo this access to target can't be
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);
@@ -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: any, props: Record<string, any> = {}) {
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', null);
21
- const duration = takeProp(props, 'duration', null);
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
- on(event: string, fn: (...args: any[]) => void) {
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 Scroll from './scroll/public';
4
- import Stagger from './stagger/stagger';
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(targets: any, props: Record<string, any> = {}) {
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: any) {
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
  /**
@@ -1,5 +1,5 @@
1
- import { Target } from '../target/Target';
2
- import Property, { type ParseableValue } from './Property';
1
+ import { Target } from '../target/Target.js';
2
+ import Property, { type ParseableValue } from './Property.js';
3
3
 
4
4
  export type Interpolated = {
5
5
  add: string[];
@@ -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;
@@ -1,4 +1,4 @@
1
- import { Callback } from './ResponsiveEvent';
1
+ import { Callback } from './ResponsiveEvent.js';
2
2
 
3
3
  export default class TestResponsiveEvent {
4
4
  private _listeners: Set<Callback>;