diff --git a/docs/animate/api/index.md b/docs/animate/api/index.md index 1f8c990..0aab042 100644 --- a/docs/animate/api/index.md +++ b/docs/animate/api/index.md @@ -198,7 +198,7 @@ Use pre-made effects in `@okikio/animate`, for example, the `animate.css` effect ### Stagger and Random -### Timeline Class +### Queues Class ### Methods & properties diff --git a/docs/animate/api/queues-class.md b/docs/animate/api/queues-class.md new file mode 100644 index 0000000..c3104b1 --- /dev/null +++ b/docs/animate/api/queues-class.md @@ -0,0 +1 @@ +## Queues Class \ No newline at end of file diff --git a/docs/animate/api/timeline-class.md b/docs/animate/api/timeline-class.md deleted file mode 100644 index 287891e..0000000 --- a/docs/animate/api/timeline-class.md +++ /dev/null @@ -1 +0,0 @@ -## Timeline Class \ No newline at end of file diff --git a/docs/animate/index.md b/docs/animate/index.md index 7074f6b..a542bba 100644 --- a/docs/animate/index.md +++ b/docs/animate/index.md @@ -2,9 +2,9 @@ [NPM](https://www.npmjs.com/package/@okikio/animate) | [Github](https://github.com/okikio/native/tree/beta/packages/animate#readme) | [API Guide](/docs/animate/api/index.md) | [Licence](/packages/animate/LICENSE) -[@okikio/animate](/docs/animate/index.md) is a js animation library for the modern web. It was inspired by [animateplus](https://github.com/bendc/animateplus) and [animejs](https://animejs.com/), and is focused on performance and ease of use. It utilizes the Web Animation API (WAAPI) to deliver fluid animations at a *semi-small* size, in total it weighs **~11.27 KB** (minified and gzipped). Most devs will only really be using a few of `@okiko/animate`'s features once at a time, so the actual minimum usable [treeshakeable](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking) file size is **~7.07 KB** (minified and gzipped). +[@okikio/animate](/docs/animate/index.md) is a js animation library for the modern web. It was inspired by [animateplus](https://github.com/bendc/animateplus) and [animejs](https://animejs.com/), it is focused on performance and ease of use. It utilizes the Web Animation API (WAAPI) to deliver fluid animations at a *semi-small* size, in total it weighs **~11.27 KB** (minified and gzipped). Most devs will only really be using a few of `@okiko/animate`'s features at a time, so the actual minimum usable [treeshakeable](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking) file size is [**~7.07 KB** (minified and gzipped)](https://bundle.js.org/?q=@okikio/animate&treeshake=animate). -> _**A quick note on size**: [CustomEasing](/docs/animate/api/custom-easing.md), [staggers](/docs/animate/api/stagger-and-random.md), and [timelines](/docs/animate/api/timeline-class.md) are now supported. After these additions the total library size doubled, so when I mean minimum usable size, I mean when you are only using the `animate` function or the `Animate` class._ +> _**A quick note on size**: [CustomEasing](/docs/animate/api/custom-easing.md), [staggers](/docs/animate/api/stagger-and-random.md), and [Queues](/docs/animate/api/queues-class.md) are now supported. After these additions the total library size doubled, so when I mean minimum usable size, I mean when you are only using the `animate` function or the `Animate` class._ I suggest reading the in depth [CSS-Tricks article](https://css-tricks.com/how-i-used-the-waapi-to-build-an-animation-library/) I made on `@okikio/animate`, it will help you determine if `@okikio/animate` is right for your project. @@ -14,7 +14,25 @@ I suggest reading the in depth [CSS-Tricks article](https://css-tricks.com/how-i ## Installation -You can install [@okikio/animate](/docs/animate/index.md) from [npm](https://www.npmjs.com/package/@okikio/animate) via `npm i @okikio/animate`, `pnpm i @okikio/animate` or `yarn add @okikio/animate`. +You can install [@okikio/animate](/docs/animate/index.md) from [npm](https://www.npmjs.com/package/@okikio/animate) via + +```bash +npm i @okikio/animate +``` + +
+Others + +```bash +yarn add @okikio/animate +``` +or +```bash +pnpm i @okikio/animate +``` +
+ +
You can use `@okikio/animate` on the web via diff --git a/docs/emitter/index.md b/docs/emitter/index.md index dfd741a..1d76629 100644 --- a/docs/emitter/index.md +++ b/docs/emitter/index.md @@ -6,7 +6,26 @@ A small Event Emitter written in typescript with performance and ease of use in ## Installation -You can install [@okikio/emitter](/docs/emitter/index.md) from [npm](https://www.npmjs.com/package/@okikio/emitter) via `npm i @okikio/emitter`, `pnpm i @okikio/emitter` or `yarn add @okikio/emitter`. +You can install [@okikio/emitter](/docs/emitter/index.md) from [npm](https://www.npmjs.com/package/@okikio/emitter) via + + +```bash +npm i @okikio/emitter +``` + +
+Others + +```bash +yarn add @okikio/emitter +``` +or +```bash +pnpm i @okikio/emitter +``` +
+ +
You can use `@okikio/emitter` on the web via: diff --git a/docs/manager/api.md b/docs/manager/api.md index 474cc06..d39d098 100644 --- a/docs/manager/api.md +++ b/docs/manager/api.md @@ -10,7 +10,7 @@ Returns a specified element from a Map object. If the value that is associated t Adds or updates an element with a specified key and a value to a Map object. Returns the Manager class (it is chainable). -***Note**: techincally the values being returned are different from a normal Map. The Map `.set()` method returns the Map class while the `Manager` `.set()` method return the `Manager` class, this shouldn't leave much of an effect on use, but should be kept in mind.* +> ***Note**: techincally the values being returned are different from a normal Map. The Map `.set()` method returns the Map class while the `Manager` `.set()` method return the `Manager` class, this shouldn't leave much of an effect on use, but should be kept in mind.* `Manager.prototype.size: number` diff --git a/docs/manager/index.md b/docs/manager/index.md index 22ce000..8ab5694 100644 --- a/docs/manager/index.md +++ b/docs/manager/index.md @@ -13,7 +13,26 @@ The `Manager` class makes Maps easier to use, as well as adding 7 methods, **get ### Installation -You can install [@okikio/manager](/docs/manager/index.md) from [npm](https://www.npmjs.com/package/@okikio/manager) via `npm i @okikio/manager`, `pnpm i @okikio/animate` or `yarn add @okikio/manager`. +You can install [@okikio/manager](/docs/manager/index.md) from [npm](https://www.npmjs.com/package/@okikio/manager) via + + +```bash +npm i @okikio/manager +``` + +
+Others + +```bash +yarn add @okikio/manager +``` +or +```bash +pnpm i @okikio/manager +``` +
+ +
You can use `@okikio/manager` on the web via: @@ -44,9 +63,9 @@ const { default: Manager, methodCall } = window.manager; ## Usage -`@okikio/manager` is used the same way `Map` is used. Like this, +`@okikio/manager` is used the same way `Map` is used. -in `typescript`, +Like this, in `typescript`, ```ts import { Manager } from "@okikio/manager"; diff --git a/docs/native/index.md b/docs/native/index.md index de9fd60..3096a6c 100644 --- a/docs/native/index.md +++ b/docs/native/index.md @@ -21,7 +21,27 @@ The `@okikio/native` package achieves performance, high efficiency, and a natura ## Installation -You can install [@okikio/native](/docs/native/index.md) from [npm](https://www.npmjs.com/package/@okikio/native) via `npm i @okikio/native`, `pnpm i @okikio/native` or `yarn add @okikio/native`. +You can install [@okikio/native](/docs/native/index.md) from [npm](https://www.npmjs.com/package/@okikio/native) via + + +```bash +npm i @okikio/native +``` + +
+Others + +```bash +yarn add @okikio/native +``` +or +```bash +pnpm i @okikio/native +``` +
+ +
+ You can use `@okikio/native` on the web via: diff --git a/package.json b/package.json index 21b95ca..015b461 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "globby": "^12.0.2", "hastscript": "^7.0.2", "minimist": "^1.2.5", - "pnpm": "^6.15.1", + "pnpm": "^6.15.2", "rehype-add-classes": "^1.0.0", "rehype-autolink-headings": "^6.1.0", "rehype-external-links": "^1.0.0", @@ -59,7 +59,7 @@ "rollup-plugin-esbuild": "^4.5.0", "rollup-plugin-terser": "^7.0.2", "sass": "^1.42.1", - "tailwindcss": "^2.2.15", + "tailwindcss": "^2.2.16", "typedoc": "0.22.4", "typedoc-plugin-mdn-links": "^1.0.4", "typescript": "~4.4.3", diff --git a/packages/animate/src/animate.ts b/packages/animate/src/animate.ts index 0c03298..abb76ac 100644 --- a/packages/animate/src/animate.ts +++ b/packages/animate/src/animate.ts @@ -744,7 +744,7 @@ export class Animate { }, getOption("extend") ?? {}); }; - // This sets good defaults for situations where no targets are given e.g. Timeline's mainAnimateInstance + // This sets good defaults for situations where no targets are given e.g. Queue's mainAnimateInstance // If the total number of targets is zero or less, it means there not values in `arrOfComputedOptions` // So, set the values for `totalDuration`, `minDelay`, `maxSpeed`, etc... to the options directly if (this.targets.size == 0) { @@ -792,9 +792,7 @@ export class Animate { if (computedOptions.iterations === true) computedOptions.iterations = Infinity; - // Add timelineOffset to delay, this is future proofing; - // if you want to create a custom timeline similar to animejs this will help you - // I don't intend to make a timeline function for this project + // Add timelineOffset to delay, this is future proofing, it's what allows the Queue class to act like animejs's timeline functions let { timelineOffset, speed, diff --git a/packages/animate/src/api.ts b/packages/animate/src/api.ts index c192f31..299d417 100644 --- a/packages/animate/src/api.ts +++ b/packages/animate/src/api.ts @@ -8,4 +8,4 @@ export * from "./custom-easing"; export * from "./animate"; export * from "./empty-tween"; export * from "./stagger-and-random"; -export * from "./timeline"; \ No newline at end of file +export * from "./queue"; \ No newline at end of file diff --git a/packages/animate/src/timeline.ts b/packages/animate/src/queue.ts similarity index 86% rename from packages/animate/src/timeline.ts rename to packages/animate/src/queue.ts index c1e27b5..0ca8b22 100644 --- a/packages/animate/src/timeline.ts +++ b/packages/animate/src/queue.ts @@ -20,24 +20,23 @@ export const relativeTo = (input: string | number, base: number) => { } /** - * Timeline acts as a playback manager for a set of Animate instances. + * Queues acts as a playback manager for a set of Animate instances. * It is responsible for controlling the chronological order of Animate instances, as well as the general playback state of all Animate instances. * * It's used like this, * ```ts - * import { Timeline, Animate, CustomEasing } from "@okikio/animate"; + * import { Queue, Animate, CustomEasing } from "@okikio/animate"; * - * new Timeline({ - * // These options are passed to each Animate instance that is added to the timeline, + * new Queue({ + * // These options are passed to each Animate instance that is added to the Queue, * // this is the only way to pass animation options to the Animate instance. * target: ".div", * - * // You don't set the timeline options at all, you set the animation options for each Animate instance attached to the timeline, - * // you use the `.updateTimings()` method when you update an Animate instance. + * // You don't set the Queue options at all, you set the animation options for each Animate instance, the Queue then automatically sets the Queues totalDuration, minDelay, etc... based on this, using the `.updateTimings()` method. * duration: 1000, * }) * - * // You add Animate instances to a timeline using the `.add(AnimationOptions, TimelineOffset)` method (`.add()` is chainable) + * // You add Animate instances to a Queue using the `.add(AnimationOptions, TimelineOffset)` method (`.add()` is chainable) * .add({ * // You can set the animation options for each Animate instance, * // these options are passed to the Animate instance when it's created. @@ -53,11 +52,10 @@ export const relativeTo = (input: string | number, base: number) => { * }), * * // The timeline offset states where relative to the other Animate instances to place the new Animate instance on the chronological timeline, - * // by default you can use string and numbers as relative timeline offsets, to use absolute timeline offsests you need to use this format "= number" as, - * // you timeline offset, e.g. `new Timeline(...).add({ ... }, "= 0")`, start at absolute `0` (the beginning) of the timeline + * // by default you can use string and numbers as relative timeline offsets, to use absolute timeline offsests you need to use this format "= number" e.g. `new Queue(...).add({ ... }, "= 0")`, start at absolute `0` (the beginning) of the Queue * // NOTE: if you can use negative "relative" and "absolute" timeline offsets, so, "-50" and "= -50" are viable timeline offsets * - * // Start at relative "50" (add "50") to the position of the last Animate instance in the timelines chronologial order + * // Start at relative "50" (add "50") to the position of the last Animate instance in the Queues chronologial order * 50) * * // You can also pass a function that returns an Animate instance @@ -68,23 +66,23 @@ export const relativeTo = (input: string | number, base: number) => { * }; * * return new Animate(options); - * })(), "= 50"); // Start at absolute "50" of the timeline (add "50" to the start of the timeline) + * })(), "= 50"); // Start at absolute "50" of the Queue (add "50" to the start of the Queue) * ``` * - * _**NOTE**: `Timeline` does not in any way replace the {@link IAnimationOptions.timeline}, it supplements it, with a format similar to [animejs's timeline](https://animejs.com/documentation/#timelineBasics). + * _**NOTE**: `Queues` do not in any way replace the {@link IAnimationOptions.timeline}, it supplements it, with a format similar to [animejs's timeline](https://animejs.com/documentation/#timelineBasics). * As of the writing this documentations, devs are not yet able to interact with [AnimationTimeline](https://developer.mozilla.org/en-US/docs/Web/API/AnimationTimeline), in a way that create timeline like effects, aside from [ScrollTimeline](https://drafts.csswg.org/scroll-animations-1/#scroll-driven-animations), thus, - * this the `Timeline` class should tide us over until such a day, that devs can use `AnimationTimeline` to create cool animations_ + * this the `Queue` class should tide us over until such a day, that devs can use `AnimationTimeline` to create cool animations_ * * @beta WIP */ -export class Timeline { +export class Queue { /** * The main Animate instance, it controls playback, speed, and generally cause the Timeline to move. */ public mainInstance: Animate; /** - * Stores all Animate instances that are attached to the Timeline + * Stores all Animate instances that are attached to the Queue */ public animateInstances: Manager = new Manager(); @@ -152,12 +150,12 @@ export class Timeline { } /** - * Allows a user to add a new Animate instances to an Timeline + * Allows a user to add a new Animate instance to a Queue * @param options - you can add an Animate instance by either using animation options or by adding a pre-existing Animate Instance. * @param timelineOffset - by default the timelineOffset is 0, which means the Animation will play in chronological order of when it was defined; a different value, specifies how many miliseconds off from the chronological order before it starts playing the Animation. You can also use absolute values, for exmple, if you want your animation to start at 0ms, setting timelineOffset to 0, or "0" will use relative offsets, while using "= 0" will use absolute offsets. Read more on {@link relativeTo} */ public add(options: IAnimationOptions | Animate = {}, timelineOffset: string | number = 0) { - let newInst: Animate | Timeline; + let newInst: Animate | Queue; let insParams: IAnimationOptions = Object.assign({}, DefaultAnimationOptions, this.initialOptions, options instanceof Animate ? options.initialOptions : parseOptions(options)); @@ -175,7 +173,7 @@ export class Timeline { return this; } - /** Update the timeline's duration, endDelay, etc... based on the `animateInstances` */ + /** Update the Queue's duration, endDelay, etc... based on the `animateInstances` */ public updateTiming() { let timings = this.animateInstances.values(); let duration = Math.max(...timings.map(x => x.totalDuration)); @@ -190,7 +188,7 @@ export class Timeline { } /** - * Remove an Animate instance from the Timeline using it's index in animateInstances + * Remove an Animate instance from the Queue using it's index in animateInstances */ public remove(index: number): Animate | null { let len = this.animateInstances.size; @@ -410,11 +408,11 @@ export class Timeline { * It is accessed internally by the Object.prototype.toString() method. */ get [Symbol.toStringTag]() { - return `Timeline`; + return `Queue`; } } /** - * Creates a new {@link Timeline} instance, and passes the options to the constructor + * Creates a new {@link Queue} instance, and passes the options to the constructor */ -export const timeline = (options: IAnimationOptions = {}) => new Timeline(options); \ No newline at end of file +export const queue = (options: IAnimationOptions = {}) => new Queue(options); \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b75e150..4bc6214 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,7 +20,7 @@ importers: globby: ^12.0.2 hastscript: ^7.0.2 minimist: ^1.2.5 - pnpm: ^6.15.1 + pnpm: ^6.15.2 polymorph-js: ^1.0.2 rehype-add-classes: ^1.0.0 rehype-autolink-headings: ^6.1.0 @@ -41,7 +41,7 @@ importers: rollup-plugin-esbuild: ^4.5.0 rollup-plugin-terser: ^7.0.2 sass: ^1.42.1 - tailwindcss: ^2.2.15 + tailwindcss: ^2.2.16 typedoc: 0.22.4 typedoc-plugin-mdn-links: ^1.0.4 typescript: ~4.4.3 @@ -68,7 +68,7 @@ importers: globby: 12.0.2 hastscript: 7.0.2 minimist: 1.2.5 - pnpm: 6.15.1 + pnpm: 6.15.2 rehype-add-classes: 1.0.0 rehype-autolink-headings: 6.1.0 rehype-external-links: 1.0.0 @@ -88,7 +88,7 @@ importers: rollup-plugin-esbuild: 4.5.0_esbuild@0.13.2+rollup@2.57.0 rollup-plugin-terser: 7.0.2_rollup@2.57.0 sass: 1.42.1 - tailwindcss: 2.2.15 + tailwindcss: 2.2.16 typedoc: 0.22.4_typescript@4.4.3 typedoc-plugin-mdn-links: 1.0.4_typedoc@0.22.4 typescript: 4.4.3 @@ -242,8 +242,8 @@ packages: engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dependencies: '@snowpack/plugin-vue': 2.6.2_rollup@2.57.0 - '@vue/server-renderer': 3.2.18_vue@3.2.18 - vue: 3.2.18 + '@vue/server-renderer': 3.2.19_vue@3.2.19 + vue: 3.2.19 transitivePeerDependencies: - rollup dev: true @@ -1496,7 +1496,7 @@ packages: resolution: {integrity: sha512-RdfDvor9EI+YjwqOXXb7SrQHMrnhZsfbAqndkLA3F0oDzcGcLt+/Mog2CkiedfmWx/WOI4F2x8MkSIjTcJsjww==} dependencies: '@rollup/plugin-replace': 2.4.2_rollup@2.57.0 - '@vue/compiler-sfc': 3.2.18 + '@vue/compiler-sfc': 3.2.19 hash-sum: 2.0.0 transitivePeerDependencies: - rollup @@ -1740,87 +1740,87 @@ packages: '@types/yargs-parser': 20.2.1 dev: true - /@vue/compiler-core/3.2.18: - resolution: {integrity: sha512-zNKVUx2gN/46xjKy+fNRB3+PJVO2WoGUUdpQo9w5GylWj8vs/r7pMuzQralP8J02YDp6YgJ61v1Yjq7nW5xK6Q==} + /@vue/compiler-core/3.2.19: + resolution: {integrity: sha512-8dOPX0YOtaXol0Zf2cfLQ4NU/yHYl2H7DCKsLEZ7gdvPK6ZSEwGLJ7IdghhY2YEshEpC5RB9QKdC5I07z8Dtjg==} dependencies: '@babel/parser': 7.15.7 - '@vue/shared': 3.2.18 + '@vue/shared': 3.2.19 estree-walker: 2.0.2 source-map: 0.6.1 dev: true - /@vue/compiler-dom/3.2.18: - resolution: {integrity: sha512-AqCND7Q0vYFlsBcwWnbcmOiVS/J/70qTZOCPxJnktvH+w4Y7F9omKDyuhsd/ZsJCmSvvpzqBNf2hgtMnoTjNiw==} + /@vue/compiler-dom/3.2.19: + resolution: {integrity: sha512-WzQoE8rfkFjPtIioc7SSgTsnz9g2oG61DU8KHnzPrRS7fW/lji6H2uCYJfp4Z6kZE8GjnHc1Ljwl3/gxDes0cw==} dependencies: - '@vue/compiler-core': 3.2.18 - '@vue/shared': 3.2.18 + '@vue/compiler-core': 3.2.19 + '@vue/shared': 3.2.19 dev: true - /@vue/compiler-sfc/3.2.18: - resolution: {integrity: sha512-ui+w1WtVjxlSlnvR4uYgVbbYcN75SrADyMuStnhRqhQM8E2MzJ99W/7Qm3UDs+GxzCEDyQA1CmUvtCg5tlwOMw==} + /@vue/compiler-sfc/3.2.19: + resolution: {integrity: sha512-pLlbgkO1UHTO02MSpa/sFOXUwIDxSMiKZ1ozE5n71CY4DM+YmI+G3gT/ZHZ46WBId7f3VTF/D8pGwMygcQbrQA==} dependencies: '@babel/parser': 7.15.7 - '@vue/compiler-core': 3.2.18 - '@vue/compiler-dom': 3.2.18 - '@vue/compiler-ssr': 3.2.18 - '@vue/ref-transform': 3.2.18 - '@vue/shared': 3.2.18 + '@vue/compiler-core': 3.2.19 + '@vue/compiler-dom': 3.2.19 + '@vue/compiler-ssr': 3.2.19 + '@vue/ref-transform': 3.2.19 + '@vue/shared': 3.2.19 estree-walker: 2.0.2 magic-string: 0.25.7 postcss: 8.3.8 source-map: 0.6.1 dev: true - /@vue/compiler-ssr/3.2.18: - resolution: {integrity: sha512-qncqUn+y00o2X8h75XUmekzpxjlQOtZkR2XzEDkBFyRfe+jruG2l0MBFKq88wMeiHRzAfysRNqRQd2KXopHPFQ==} + /@vue/compiler-ssr/3.2.19: + resolution: {integrity: sha512-oLon0Cn3O7WEYzzmzZavGoqXH+199LT+smdjBT3Uf3UX4HwDNuBFCmvL0TsqV9SQnIgKvBRbQ7lhbpnd4lqM3w==} dependencies: - '@vue/compiler-dom': 3.2.18 - '@vue/shared': 3.2.18 + '@vue/compiler-dom': 3.2.19 + '@vue/shared': 3.2.19 dev: true - /@vue/reactivity/3.2.18: - resolution: {integrity: sha512-NTGsS2uQqWO4HIhGKmXXUZZvu/R+GW2e+i08ZYJVnR6vScN8WGlg+GU3HiG4UvhNrTAdhMFPoy+no5t3iXnvVw==} + /@vue/reactivity/3.2.19: + resolution: {integrity: sha512-FtachoYs2SnyrWup5UikP54xDX6ZJ1s5VgHcJp4rkGoutU3Ry61jhs+nCX7J64zjX992Mh9gGUC0LqTs8q9vCA==} dependencies: - '@vue/shared': 3.2.18 + '@vue/shared': 3.2.19 dev: true - /@vue/ref-transform/3.2.18: - resolution: {integrity: sha512-STPcQbA8u3DftZjZW/dS+0mGIABKgbXCxOJTyEYxP+rxa66tqa/QSkeuz54h0zk2wgPfe4vo2QPtcFGl3kl45A==} + /@vue/ref-transform/3.2.19: + resolution: {integrity: sha512-03wwUnoIAeKti5IGGx6Vk/HEBJ+zUcm5wrUM3+PQsGf7IYnXTbeIfHHpx4HeSeWhnLAjqZjADQwW8uA4rBmVbg==} dependencies: '@babel/parser': 7.15.7 - '@vue/compiler-core': 3.2.18 - '@vue/shared': 3.2.18 + '@vue/compiler-core': 3.2.19 + '@vue/shared': 3.2.19 estree-walker: 2.0.2 magic-string: 0.25.7 dev: true - /@vue/runtime-core/3.2.18: - resolution: {integrity: sha512-wGRUSRE8grf90TdXJeWusdDG+mn+40L7wBH08neNM4L/f6qW9arlymvrYLOiMz7PoH28aMlI3w6l9tvGSlMbjA==} + /@vue/runtime-core/3.2.19: + resolution: {integrity: sha512-qArZSWKxWsgKfxk9BelZ32nY0MZ31CAW2kUUyVJyxh4cTfHaXGbjiQB5JgsvKc49ROMNffv9t3/qjasQqAH+RQ==} dependencies: - '@vue/reactivity': 3.2.18 - '@vue/shared': 3.2.18 + '@vue/reactivity': 3.2.19 + '@vue/shared': 3.2.19 dev: true - /@vue/runtime-dom/3.2.18: - resolution: {integrity: sha512-iP6AP0zANe0OfHWV7VDiR9eH2WGJuLHBHEsyIfOteZUuowM8VkIVgn+10HGnVEV+nfpaVAVPItQDc/TwmR73Rw==} + /@vue/runtime-dom/3.2.19: + resolution: {integrity: sha512-hIRboxXwafeHhbZEkZYNV0MiJXPNf4fP0X6hM2TJb0vssz8BKhD9cF92BkRgZztTQevecbhk0gu4uAPJ3dxL9A==} dependencies: - '@vue/runtime-core': 3.2.18 - '@vue/shared': 3.2.18 + '@vue/runtime-core': 3.2.19 + '@vue/shared': 3.2.19 csstype: 2.6.18 dev: true - /@vue/server-renderer/3.2.18_vue@3.2.18: - resolution: {integrity: sha512-UUndtVq2z3IN3PmK+siu1W6lFvP9lb2hyKFw2CxZug3A4jKrUuYadvtItIRxt2rNsLIoLydnxBa2pyUM6+8S4g==} + /@vue/server-renderer/3.2.19_vue@3.2.19: + resolution: {integrity: sha512-A9FNT7fgQJXItwdzWREntAgWKVtKYuXHBKGev/H4+ByTu8vB7gQXGcim01QxaJshdNg4dYuH2tEBZXCNCNx+/w==} peerDependencies: - vue: 3.2.18 + vue: 3.2.19 dependencies: - '@vue/compiler-ssr': 3.2.18 - '@vue/shared': 3.2.18 - vue: 3.2.18 + '@vue/compiler-ssr': 3.2.19 + '@vue/shared': 3.2.19 + vue: 3.2.19 dev: true - /@vue/shared/3.2.18: - resolution: {integrity: sha512-vFa2annVlbI082ICC3BH239UFO66nn2Syxy9shI7N2haPrc4rFRyNuDjWKJRe3sX7py4yhYL7fopB5tWGwGVyA==} + /@vue/shared/3.2.19: + resolution: {integrity: sha512-Knqhx7WieLdVgwCAZgTVrDCXZ50uItuecLh9JdLC8O+a5ayaSyIQYveUK3hCRNC7ws5zalHmZwfdLMGaS8r4Ew==} dev: true /abab/2.0.5: @@ -2107,7 +2107,7 @@ packages: '@types/send': 0.17.1 acorn: 7.4.1 astring: 1.7.5 - autoprefixer: 10.3.5_postcss@8.3.8 + autoprefixer: 10.3.6_postcss@8.3.8 babel-plugin-module-resolver: 4.1.0 camel-case: 4.1.2 cheerio: 1.0.0-rc.10 @@ -2147,7 +2147,7 @@ packages: supports-esm: 1.0.0 tiny-glob: 0.2.9 yargs-parser: 20.2.9 - zod: 3.8.2 + zod: 3.9.1 transitivePeerDependencies: - coffeescript - less @@ -2171,8 +2171,8 @@ packages: hasBin: true dev: true - /autoprefixer/10.3.5_postcss@8.3.8: - resolution: {integrity: sha512-2H5kQSsyoOMdIehTzIt/sC9ZDIgWqlkG/dbevm9B9xQZ1TDPBHpNUDW5ENqqQQzuaBWEo75JkV0LJe+o5Lnr5g==} + /autoprefixer/10.3.6_postcss@8.3.8: + resolution: {integrity: sha512-3bDjTfF0MfZntwVCSd18XAT2Zndufh3Mep+mafbzdIQEeWbncVRUVDjH8/EPANV9Hq40seJ24QcYAyhUsFz7gQ==} engines: {node: ^10 || ^12 || >=14} hasBin: true peerDependencies: @@ -2181,7 +2181,7 @@ packages: browserslist: 4.17.1 caniuse-lite: 1.0.30001260 fraction.js: 4.1.1 - nanocolors: 0.1.12 + nanocolors: 0.2.9 normalize-range: 0.1.2 postcss: 8.3.8 postcss-value-parser: 4.1.0 @@ -2500,8 +2500,9 @@ packages: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} dev: true - /bufferutil/4.0.3: - resolution: {integrity: sha512-yEYTwGndELGvfXsImMBLop58eaGW+YdONi1fNjTINSY98tmMmFijBG6WXgdkfuLNt4imzQNtIE+eBp1PVpMCSw==} + /bufferutil/4.0.4: + resolution: {integrity: sha512-VNxjXUCrF3LvbLgwfkTb5LsFvk6pGIn7OBb9x+3o+iJ6mKw0JTUp4chBFc88hi1aspeZGeZG9jAIbpFYPQSLZw==} + engines: {node: '>=6.14.2'} requiresBuild: true dependencies: node-gyp-build: 4.3.0 @@ -2749,7 +2750,7 @@ packages: braces: 3.0.2 glob-parent: 5.1.2 is-binary-path: 2.1.0 - is-glob: 4.0.1 + is-glob: 4.0.2 normalize-path: 3.0.0 readdirp: 3.6.0 optionalDependencies: @@ -3216,7 +3217,7 @@ packages: dependencies: globby: 11.0.4 graceful-fs: 4.2.8 - is-glob: 4.0.1 + is-glob: 4.0.2 is-path-cwd: 2.2.0 is-path-inside: 3.0.3 p-map: 4.0.0 @@ -4196,14 +4197,14 @@ packages: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} dependencies: - is-glob: 4.0.1 + is-glob: 4.0.2 dev: true /glob-parent/6.0.1: resolution: {integrity: sha512-kEVjS71mQazDBHKcsq4E9u/vUzaLcw1A8EtUeydawvIWQCJM0qQ08G1H7/XTjFUulla6XQiDOG6MXSaG0HDKog==} engines: {node: '>=10.13.0'} dependencies: - is-glob: 4.0.1 + is-glob: 4.0.2 dev: true /glob/7.2.0: @@ -4989,8 +4990,8 @@ packages: engines: {node: '>=6'} dev: true - /is-glob/4.0.1: - resolution: {integrity: sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==} + /is-glob/4.0.2: + resolution: {integrity: sha512-ZZTOjRcDjuAAAv2cTBQP/lL59ZTArx77+7UzHdWW/XB1mrfp7DEaVpKmZ0XIzx+M7AxfhKcqV+nMetUQmFifwg==} engines: {node: '>=0.10.0'} dependencies: is-extglob: 2.1.1 @@ -6849,12 +6850,12 @@ packages: resolution: {integrity: sha512-2nMHqg1x5PU+unxX7PGY7AuYxl2qDx7PSrTRjizr8sxdd3l/3hBuWWaki62qmtYm2U5i4Z5E7GbjlyDFhs9/EQ==} dev: true - /nanocolors/0.2.6: - resolution: {integrity: sha512-lP8hjPSXTQ7qpYl5hFPVTBXGdd7+Rn3oi8GqIPNZP63L09tewRzWYFxAy26B1BYOOYaPWgmVF/BFIhDAHihwUQ==} + /nanocolors/0.2.9: + resolution: {integrity: sha512-aymgS4Xe0LMqHOHl7jSUEkFh/6O/pcF0j61dBtreQZ1nmbyYdYjSYSJzz0iPLbKPkMtSmdRgyBGywNZGjKOEfw==} dev: true - /nanoid/3.1.25: - resolution: {integrity: sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==} + /nanoid/3.1.28: + resolution: {integrity: sha512-gSu9VZ2HtmoKYe/lmyPFES5nknFrHa+/DT9muUFWFMi6Jh9E1I7bkvlQ8xxf1Kos9pi9o8lBnIOkatMhKX/YUw==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true dev: true @@ -7479,8 +7480,8 @@ packages: find-up: 3.0.0 dev: true - /pnpm/6.15.1: - resolution: {integrity: sha512-hYGK8xlLdMj/sFhOLJ+x8IotsOkBp01c2mdWdLeKlUdA6EOl/RNWRp+7dUWs3Si2E1zgdTiHsEgNGYffv0PyLQ==} + /pnpm/6.15.2: + resolution: {integrity: sha512-zDvVALUM2r4DfU9lTP/zkUbkRlrVy/Ihn9vojfrrqOJfkUXoYlT/hfe2TfAELMmOsG21h7b3qms5DV6gzpVX9w==} engines: {node: '>=12.17'} hasBin: true dev: true @@ -7619,8 +7620,8 @@ packages: resolution: {integrity: sha512-GT5bTjjZnwDifajzczOC+r3FI3Cu+PgPvrsjhQdRqa2kTJ4968/X9CUce9xttIB0xOs5c6xf0TCWZo/y9lF6bA==} engines: {node: ^10 || ^12 || >=14} dependencies: - nanocolors: 0.2.6 - nanoid: 3.1.25 + nanocolors: 0.2.9 + nanoid: 3.1.28 source-map-js: 0.6.2 dev: true @@ -8634,7 +8635,7 @@ packages: hasBin: true dependencies: '@npmcli/arborist': 2.8.3 - bufferutil: 4.0.3 + bufferutil: 4.0.4 cachedir: 2.3.0 cheerio: 1.0.0-rc.10 chokidar: 3.5.2 @@ -8681,8 +8682,8 @@ packages: source-map: 0.7.3 strip-ansi: 6.0.1 strip-comments: 2.0.1 - utf-8-validate: 5.0.5 - ws: 7.5.5_72ef9f06cb99540da679cbf1bf7a3256 + utf-8-validate: 5.0.6 + ws: 7.5.5_b2e6c579793e9551e64081320e3d8aea yargs-parser: 20.2.9 optionalDependencies: fsevents: 2.3.2 @@ -9124,8 +9125,8 @@ packages: resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} dev: true - /tailwindcss/2.2.15: - resolution: {integrity: sha512-WgV41xTMbnSoTNMNnJvShQZ+8GmY86DmXTrCgnsveNZJdlybfwCItV8kAqjYmU49YiFr+ofzmT1JlAKajBZboQ==} + /tailwindcss/2.2.16: + resolution: {integrity: sha512-EireCtpQyyJ4Xz8NYzHafBoy4baCOO96flM0+HgtsFcIQ9KFy/YBK3GEtlnD+rXen0e4xm8t3WiUcKBJmN6yjg==} engines: {node: '>=12.13.0'} hasBin: true peerDependencies: @@ -9146,7 +9147,7 @@ packages: glob-parent: 6.0.1 html-tags: 3.1.0 is-color-stop: 1.1.0 - is-glob: 4.0.1 + is-glob: 4.0.2 lodash: 4.17.21 lodash.topath: 4.5.2 modern-normalize: 1.1.0 @@ -9679,8 +9680,9 @@ packages: engines: {node: '>=0.10.0'} dev: true - /utf-8-validate/5.0.5: - resolution: {integrity: sha512-+pnxRYsS/axEpkrrEpzYfNZGXp0IjC/9RIxwM5gntY4Koi8SHmUGSfxfWqxZdRxrtaoVstuOzUp/rbs3JSPELQ==} + /utf-8-validate/5.0.6: + resolution: {integrity: sha512-hoY0gOf9EkCw+nimK21FVKHUIG1BMqSiRwxB/q3A9yKZOrOI99PP77BxmarDqWz6rG3vVYiBWfhG8z2Tl+7fZA==} + engines: {node: '>=6.14.2'} requiresBuild: true dependencies: node-gyp-build: 4.3.0 @@ -9782,14 +9784,14 @@ packages: resolution: {integrity: sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==} dev: true - /vue/3.2.18: - resolution: {integrity: sha512-5HjXmnntBcFOdjqXzi4fxPENcl8MOrfUycr/iY+Th/NNNaZfa5BLPHk9Gc28fWCGbZT1U6XkkiEYysxY49lGuQ==} + /vue/3.2.19: + resolution: {integrity: sha512-6KAMdIfAtlK+qohTIUE4urwAv4A3YRuo8uAbByApUmiB0CziGAAPs6qVugN6oHPia8YIafHB/37K0O6KZ7sGmA==} dependencies: - '@vue/compiler-dom': 3.2.18 - '@vue/compiler-sfc': 3.2.18 - '@vue/runtime-dom': 3.2.18 - '@vue/server-renderer': 3.2.18_vue@3.2.18 - '@vue/shared': 3.2.18 + '@vue/compiler-dom': 3.2.19 + '@vue/compiler-sfc': 3.2.19 + '@vue/runtime-dom': 3.2.19 + '@vue/server-renderer': 3.2.19_vue@3.2.19 + '@vue/shared': 3.2.19 dev: true /w3c-hr-time/1.0.2: @@ -9962,7 +9964,7 @@ packages: optional: true dev: true - /ws/7.5.5_72ef9f06cb99540da679cbf1bf7a3256: + /ws/7.5.5_b2e6c579793e9551e64081320e3d8aea: resolution: {integrity: sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w==} engines: {node: '>=8.3.0'} peerDependencies: @@ -9974,8 +9976,8 @@ packages: utf-8-validate: optional: true dependencies: - bufferutil: 4.0.3 - utf-8-validate: 5.0.5 + bufferutil: 4.0.4 + utf-8-validate: 5.0.6 dev: true /xml-name-validator/3.0.0: @@ -10073,8 +10075,8 @@ packages: engines: {node: '>=10'} dev: true - /zod/3.8.2: - resolution: {integrity: sha512-kpwVRACazsOhELVt5h4R2pC2OndrqaBK4+z134TWOsnzn7n2uOYnSyvx0QAn410pl28CgVtkSi5ew7e/AgO0oA==} + /zod/3.9.1: + resolution: {integrity: sha512-4h+26dlguuEScIYIEt8icqxVYXDbDAnOMgV2r/RO/0qpb0jJyK/VosUQWi/EF/2MB1HrtBZZxiRQrTbIqVLKeQ==} dev: true /zwitch/1.0.5: diff --git a/snowpack.config.mjs b/snowpack.config.mjs index ac23ca5..24a11f7 100644 --- a/snowpack.config.mjs +++ b/snowpack.config.mjs @@ -4,8 +4,8 @@ /** @type {import("snowpack").SnowpackUserConfig } */ export default { mount: { - docs: "/docs", - packages: "/packages" + // docs: "/docs", + // packages: "/packages" /* ... */ }, alias: { @@ -19,6 +19,7 @@ export default { /* ... */ ], packageOptions: { + // external: ["@okikio/animate", "@okikio/native"] /* ... */ }, devOptions: { diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index 2a5c0f9..918520c 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -28,9 +28,7 @@ -
- -
+ diff --git a/demo/ts/animate.ts b/src/pages/demo/animate.ts similarity index 84% rename from demo/ts/animate.ts rename to src/pages/demo/animate.ts index 85e649c..614fe90 100644 --- a/demo/ts/animate.ts +++ b/src/pages/demo/animate.ts @@ -1,12 +1,13 @@ -import { animate, tweenAttr, random, timeline, AnimateAttributes } from "@okikio/animate"; +import { animate, tweenAttr, random, queue, AnimateAttributes } from "@okikio/animate"; import { interpolate } from "polymorph-js"; -import type { IAnimationOptions, TypePlayStates, Timeline, Animate } from "@okikio/animate"; +import type { IAnimationOptions, TypePlayStates, Queue, Animate } from "@okikio/animate"; // Based on an example by animateplus -(() => { +/** +( () => { let containerSel = ".morph-demo"; - let timelineInst = timeline({ + let queueInst = queue({ duration: 1800, easing: "ease", loop: 4, @@ -14,7 +15,7 @@ import type { IAnimationOptions, TypePlayStates, Timeline, Animate } from "@okik direction: "alternate" }); - timelineInst.add(((): IAnimationOptions => { + queueInst.add(((): IAnimationOptions => { let usingDPathEl = document.querySelector(`${containerSel} #using-d`); let InitialStyle = window.getComputedStyle(usingDPathEl); @@ -31,7 +32,7 @@ import type { IAnimationOptions, TypePlayStates, Timeline, Animate } from "@okik } })(), "= 0"); - timelineInst.add(((): IAnimationOptions => { + queueInst.add(((): IAnimationOptions => { let usingPolymorphPathEl = document.querySelector(`${containerSel} #using-polymorph-js`); let InitialStyle = window.getComputedStyle(usingPolymorphPathEl); @@ -52,7 +53,7 @@ import type { IAnimationOptions, TypePlayStates, Timeline, Animate } from "@okik }; })(), "= 0"); - timelineInst.add(((): AnimateAttributes => { + queueInst.add(((): AnimateAttributes => { let usingPolymorphPathEl = document.querySelector(`${containerSel} #using-polymorph-js`); let startPath = usingPolymorphPathEl.getAttribute("d"); let endPath = @@ -72,14 +73,14 @@ import type { IAnimationOptions, TypePlayStates, Timeline, Animate } from "@okik }); })(), "= 0"); - playbackFn(containerSel, timelineInst); + playbackFn(containerSel, queueInst); })(); (() => { let containerSel = ".playback-demo"; - let timelineInst = timeline(); + let queueInst = queue(); - timelineInst.add(((): Animate => { + queueInst.add(((): Animate => { let DOMNodes = document.querySelectorAll(`${containerSel} .el`); let anim = animate({ target: DOMNodes, @@ -116,7 +117,7 @@ import type { IAnimationOptions, TypePlayStates, Timeline, Animate } from "@okik loop: 2, speed: (i) => 1.5 - (i * 0.125), - // You can't use `fillMode` if you want to have a timeline of animations on the same target, + // You can't use `fillMode` if you want to have a queue of animations on the same target, // instead you can use `onfinish: () => {}` // fillMode: "both", @@ -197,12 +198,12 @@ import type { IAnimationOptions, TypePlayStates, Timeline, Animate } from "@okik return anim; })(), "= 0"); - playbackFn(containerSel, timelineInst); + playbackFn(containerSel, queueInst); })(); (() => { let containerSel = ".motion-path-demo"; - let timelineInst = timeline({ + let queueInst = queue({ padEndDelay: true, easing: "linear", duration: 2000, @@ -210,7 +211,7 @@ import type { IAnimationOptions, TypePlayStates, Timeline, Animate } from "@okik speed: 1, }); - timelineInst.add(((): IAnimationOptions => { + queueInst.add(((): IAnimationOptions => { let el = document.querySelector('.motion-path .el-1') as HTMLElement; // To support older browsers I can't use partial keyframes @@ -220,7 +221,7 @@ import type { IAnimationOptions, TypePlayStates, Timeline, Animate } from "@okik }; })(), "= 0"); - timelineInst.add(((): IAnimationOptions => { + queueInst.add(((): IAnimationOptions => { let path = document.querySelector('.motion-path path') as SVGPathElement; let el2 = document.querySelector('.motion-path .el-2') as HTMLElement; @@ -247,11 +248,11 @@ import type { IAnimationOptions, TypePlayStates, Timeline, Animate } from "@okik }; })(), "= 0"); - playbackFn(containerSel, timelineInst); + playbackFn(containerSel, queueInst); })(); // I added extra code to the demo to support Chrome 77 and below -function playbackFn(containerSel: string, timelineInst: Timeline) { +function playbackFn(containerSel: string, queueInst: Queue) { let container = document.querySelector(containerSel); let playstateEl = container.querySelector(`#playstate-toggle`) as HTMLInputElement; @@ -261,34 +262,34 @@ function playbackFn(containerSel: string, timelineInst: Timeline) { let oldState: "pending" | TypePlayStates; let updatePlayState = () => { - oldState = timelineInst.getPlayState() as TypePlayStates | "pending"; + oldState = queueInst.getPlayState() as TypePlayStates | "pending"; if (oldState == "idle") oldState = "paused"; else if (oldState == "pending") oldState = "running"; playstateEl.setAttribute("data-playstate", oldState); }; const clickFn = () => { - if (timelineInst.is("running")) - timelineInst.pause(); - else if (timelineInst.is("finished")) - timelineInst.reset(); + if (queueInst.is("running")) + queueInst.pause(); + else if (queueInst.is("finished")) + queueInst.reset(); else - timelineInst.play(); + queueInst.play(); updatePlayState(); }; const inputFn = () => { let percent = Number(progressEl.value); - timelineInst.pause(); - timelineInst.setProgress(percent); + queueInst.pause(); + queueInst.setProgress(percent); }; const changeFn = () => { if (oldState !== "paused") - timelineInst.play(); + queueInst.play(); else - timelineInst.pause(); + queueInst.pause(); updatePlayState(); }; @@ -297,7 +298,7 @@ function playbackFn(containerSel: string, timelineInst: Timeline) { progressEl.addEventListener("input", inputFn); progressEl.addEventListener("change", changeFn); - timelineInst + queueInst .on("finish begin", updatePlayState) .on({ update: (progress: number) => { @@ -311,7 +312,28 @@ function playbackFn(containerSel: string, timelineInst: Timeline) { playstateEl.removeEventListener("click", clickFn); progressEl.removeEventListener("input", inputFn); progressEl.removeEventListener("change", changeFn); - timelineInst = null; + queueInst = null; } }); -} \ No newline at end of file +} +*/ + +(() => { + let queueInst = queue({ + padEndDelay: true, + easing: "ease", + duration: 2000, + loop: 4, + speed: 1, + }); + + queueInst.add(((): IAnimationOptions => { + let el = document.querySelector('#block') as HTMLElement; + + // To support older browsers I can't use partial keyframes + return { + target: el, + "translate-x": [0, 600] + }; + })(), "= 0"); +})(); \ No newline at end of file diff --git a/src/pages/demo/index.astro b/src/pages/demo/index.astro new file mode 100644 index 0000000..0c9005f --- /dev/null +++ b/src/pages/demo/index.astro @@ -0,0 +1,18 @@ +--- +// import { Markdown } from 'astro/components'; +import Markdown from "~/components/Markdown"; +import BaseLayout from "~/layouts/BaseLayout"; +--- + + +
+

+ Home / +

+ +
+
+ + +
+
\ No newline at end of file diff --git a/src/pages/index.astro b/src/pages/index.astro index 199f01a..d380fe6 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -4,8 +4,6 @@ import Markdown from "~/components/Markdown"; import BaseLayout from "~/layouts/BaseLayout"; const content = Astro.fetchContent('../../README.md')[0].astro.source; -// let pathArr = Astro.request.url.pathname.split("/"); -// console.log(content) ---