From 335df330a7f50563254a77b2a1940859399ede33 Mon Sep 17 00:00:00 2001 From: Julian Benegas Date: Thu, 27 Jul 2023 10:32:08 -0300 Subject: [PATCH 1/4] default disabled to false --- .../src/components/animation/index.tsx | 20 +++--- .../src/components/parallax/index.tsx | 2 +- scrollytelling/src/primitive.tsx | 2 +- website/src/app/debug/page.tsx | 62 +++++++++++++++++++ 4 files changed, 76 insertions(+), 10 deletions(-) create mode 100644 website/src/app/debug/page.tsx diff --git a/scrollytelling/src/components/animation/index.tsx b/scrollytelling/src/components/animation/index.tsx index 2937405..2e5420d 100644 --- a/scrollytelling/src/components/animation/index.tsx +++ b/scrollytelling/src/components/animation/index.tsx @@ -36,7 +36,11 @@ export function Animation(props: { disabled?: boolean; }): React.ReactElement; -export function Animation(props: AnimationProps): React.ReactElement | null { +export function Animation({ + tween, + children, + disabled = false, +}: AnimationProps): React.ReactElement | null { const ref = React.useRef(null); const id = React.useId(); @@ -44,7 +48,7 @@ export function Animation(props: AnimationProps): React.ReactElement | null { const { getTimelineSpace } = useDispatcher(); React.useEffect(() => { - if (!timeline || !props.tween || props.disabled) return; + if (!timeline || !tween || disabled) return; const addTweenToTimeline = ( tween: TweenWithChildrenDef | TweenWithTargetDef @@ -75,8 +79,8 @@ export function Animation(props: AnimationProps): React.ReactElement | null { } else return () => undefined; }; - if (Array.isArray(props.tween)) { - const cleanupTweens = props.tween.map((tween) => { + if (Array.isArray(tween)) { + const cleanupTweens = tween.map((tween) => { const cleanup = addTweenToTimeline(tween); return cleanup; }); @@ -84,15 +88,15 @@ export function Animation(props: AnimationProps): React.ReactElement | null { cleanupTweens.forEach((cleanup) => cleanup?.()); }; } else { - const cleanup = addTweenToTimeline(props.tween); + const cleanup = addTweenToTimeline(tween); return () => { cleanup?.(); }; } - }, [getTimelineSpace, id, props.tween, timeline, props.disabled]); + }, [getTimelineSpace, id, tween, timeline, disabled]); - if (props.children) { - return {props.children}; + if (children) { + return {children}; } return null; } diff --git a/scrollytelling/src/components/parallax/index.tsx b/scrollytelling/src/components/parallax/index.tsx index 8c0a311..a9b1d7c 100644 --- a/scrollytelling/src/components/parallax/index.tsx +++ b/scrollytelling/src/components/parallax/index.tsx @@ -34,7 +34,7 @@ interface ParallaxProps { export const Parallax: React.FC = ({ children, tween, - disabled, + disabled = false, }): JSX.Element => { if (!tween.movementY && !tween.movementX) { throw new Error( diff --git a/scrollytelling/src/primitive.tsx b/scrollytelling/src/primitive.tsx index fb68f5e..a55dcb7 100644 --- a/scrollytelling/src/primitive.tsx +++ b/scrollytelling/src/primitive.tsx @@ -35,7 +35,7 @@ const Scrollytelling = ({ scrub, defaults, toggleActions, - disabled, + disabled = false, }: { children?: React.ReactNode; debug?: boolean; diff --git a/website/src/app/debug/page.tsx b/website/src/app/debug/page.tsx new file mode 100644 index 0000000..ec2de3e --- /dev/null +++ b/website/src/app/debug/page.tsx @@ -0,0 +1,62 @@ +"use client"; + +import { useState } from "react"; +import * as Scrollytelling from "~/lib/scrollytelling-client"; + +const texts = ["one", "two", "three"]; + +export default function Page() { + const [isDisabled, setIsDisabled] = useState(undefined); + + return ( +
+
+ +

Disabled: {JSON.stringify(isDisabled)}

+
+
+ {texts.map((text, i) => { + return ( + +
+
+ +

+ {text} +

+
+
+
+
+ ); + })} +
+
+ ); +} From 56586af62ad26d75e108e5ad54571c8bc715e0ab Mon Sep 17 00:00:00 2001 From: Julian Benegas Date: Thu, 27 Jul 2023 10:33:57 -0300 Subject: [PATCH 2/4] Enter prerelease mode and version packages --- .changeset/pre.json | 13 +++++++++++++ .changeset/two-cheetahs-jam.md | 5 +++++ scrollytelling/CHANGELOG.md | 6 ++++++ scrollytelling/package.json | 2 +- website/CHANGELOG.md | 8 ++++++++ website/package.json | 4 ++-- 6 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 .changeset/pre.json create mode 100644 .changeset/two-cheetahs-jam.md create mode 100644 website/CHANGELOG.md diff --git a/.changeset/pre.json b/.changeset/pre.json new file mode 100644 index 0000000..8ce3250 --- /dev/null +++ b/.changeset/pre.json @@ -0,0 +1,13 @@ +{ + "mode": "pre", + "tag": "next", + "initialVersions": { + "eslint-config-custom": "1.0.0", + "tsconfig": "1.0.0", + "@bsmnt/scrollytelling": "0.2.3", + "website": "0.1.0" + }, + "changesets": [ + "two-cheetahs-jam" + ] +} diff --git a/.changeset/two-cheetahs-jam.md b/.changeset/two-cheetahs-jam.md new file mode 100644 index 0000000..38d36f5 --- /dev/null +++ b/.changeset/two-cheetahs-jam.md @@ -0,0 +1,5 @@ +--- +"@bsmnt/scrollytelling": patch +--- + +Default disabled value to false diff --git a/scrollytelling/CHANGELOG.md b/scrollytelling/CHANGELOG.md index 9263410..f0341d4 100644 --- a/scrollytelling/CHANGELOG.md +++ b/scrollytelling/CHANGELOG.md @@ -1,5 +1,11 @@ # @bsmnt/scrollytelling +## 0.2.4-next.0 + +### Patch Changes + +- Default disabled value to false + ## 0.2.3 ### Patch Changes diff --git a/scrollytelling/package.json b/scrollytelling/package.json index 6485025..f457877 100644 --- a/scrollytelling/package.json +++ b/scrollytelling/package.json @@ -1,7 +1,7 @@ { "name": "@bsmnt/scrollytelling", "author": "JB ", - "version": "0.2.3", + "version": "0.2.4-next.0", "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", diff --git a/website/CHANGELOG.md b/website/CHANGELOG.md new file mode 100644 index 0000000..a593cc4 --- /dev/null +++ b/website/CHANGELOG.md @@ -0,0 +1,8 @@ +# website + +## 0.1.1-next.0 + +### Patch Changes + +- Updated dependencies + - @bsmnt/scrollytelling@0.2.4-next.0 diff --git a/website/package.json b/website/package.json index fc8c9c4..b22794b 100644 --- a/website/package.json +++ b/website/package.json @@ -1,7 +1,7 @@ { "name": "website", "private": true, - "version": "0.1.0", + "version": "0.1.1-next.0", "scripts": { "dev": "next dev", "build": "next build", @@ -10,7 +10,7 @@ "lint": "next lint" }, "dependencies": { - "@bsmnt/scrollytelling": "*", + "@bsmnt/scrollytelling": "0.2.4-next.0", "@react-three/drei": "^9.65.3", "@react-three/fiber": "^8.12.0", "@types/three": "^0.150.1", From abe6bb90723ef5062e51a691045a27fb67f8d4e6 Mon Sep 17 00:00:00 2001 From: Julian Benegas Date: Thu, 27 Jul 2023 10:46:02 -0300 Subject: [PATCH 3/4] tweak value --- .changeset/pre.json | 3 ++- .changeset/wicked-zebras-visit.md | 5 +++++ scrollytelling/CHANGELOG.md | 6 ++++++ scrollytelling/package.json | 2 +- website/CHANGELOG.md | 7 +++++++ website/package.json | 4 ++-- 6 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 .changeset/wicked-zebras-visit.md diff --git a/.changeset/pre.json b/.changeset/pre.json index 8ce3250..1460c8d 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -8,6 +8,7 @@ "website": "0.1.0" }, "changesets": [ - "two-cheetahs-jam" + "two-cheetahs-jam", + "wicked-zebras-visit" ] } diff --git a/.changeset/wicked-zebras-visit.md b/.changeset/wicked-zebras-visit.md new file mode 100644 index 0000000..0514429 --- /dev/null +++ b/.changeset/wicked-zebras-visit.md @@ -0,0 +1,5 @@ +--- +"@bsmnt/scrollytelling": patch +--- + +Tweak disabled diff --git a/scrollytelling/CHANGELOG.md b/scrollytelling/CHANGELOG.md index f0341d4..82e17ca 100644 --- a/scrollytelling/CHANGELOG.md +++ b/scrollytelling/CHANGELOG.md @@ -1,5 +1,11 @@ # @bsmnt/scrollytelling +## 0.2.4-next.1 + +### Patch Changes + +- Tweak disabled + ## 0.2.4-next.0 ### Patch Changes diff --git a/scrollytelling/package.json b/scrollytelling/package.json index f457877..89cd605 100644 --- a/scrollytelling/package.json +++ b/scrollytelling/package.json @@ -1,7 +1,7 @@ { "name": "@bsmnt/scrollytelling", "author": "JB ", - "version": "0.2.4-next.0", + "version": "0.2.4-next.1", "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", diff --git a/website/CHANGELOG.md b/website/CHANGELOG.md index a593cc4..a245ff4 100644 --- a/website/CHANGELOG.md +++ b/website/CHANGELOG.md @@ -1,5 +1,12 @@ # website +## 0.1.1-next.1 + +### Patch Changes + +- Updated dependencies + - @bsmnt/scrollytelling@0.2.4-next.1 + ## 0.1.1-next.0 ### Patch Changes diff --git a/website/package.json b/website/package.json index b22794b..7cf0acc 100644 --- a/website/package.json +++ b/website/package.json @@ -1,7 +1,7 @@ { "name": "website", "private": true, - "version": "0.1.1-next.0", + "version": "0.1.1-next.1", "scripts": { "dev": "next dev", "build": "next build", @@ -10,7 +10,7 @@ "lint": "next lint" }, "dependencies": { - "@bsmnt/scrollytelling": "0.2.4-next.0", + "@bsmnt/scrollytelling": "0.2.4-next.1", "@react-three/drei": "^9.65.3", "@react-three/fiber": "^8.12.0", "@types/three": "^0.150.1", From cdfb587c613105b2ea83fdf4da716e4695f2ae59 Mon Sep 17 00:00:00 2001 From: Julian Benegas Date: Thu, 27 Jul 2023 10:47:27 -0300 Subject: [PATCH 4/4] version --- .changeset/pre.json | 14 -------------- .changeset/two-cheetahs-jam.md | 5 ----- .changeset/wicked-zebras-visit.md | 5 ----- scrollytelling/CHANGELOG.md | 7 +++++++ scrollytelling/package.json | 2 +- website/CHANGELOG.md | 8 ++++++++ website/package.json | 4 ++-- 7 files changed, 18 insertions(+), 27 deletions(-) delete mode 100644 .changeset/pre.json delete mode 100644 .changeset/two-cheetahs-jam.md delete mode 100644 .changeset/wicked-zebras-visit.md diff --git a/.changeset/pre.json b/.changeset/pre.json deleted file mode 100644 index 1460c8d..0000000 --- a/.changeset/pre.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "mode": "pre", - "tag": "next", - "initialVersions": { - "eslint-config-custom": "1.0.0", - "tsconfig": "1.0.0", - "@bsmnt/scrollytelling": "0.2.3", - "website": "0.1.0" - }, - "changesets": [ - "two-cheetahs-jam", - "wicked-zebras-visit" - ] -} diff --git a/.changeset/two-cheetahs-jam.md b/.changeset/two-cheetahs-jam.md deleted file mode 100644 index 38d36f5..0000000 --- a/.changeset/two-cheetahs-jam.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@bsmnt/scrollytelling": patch ---- - -Default disabled value to false diff --git a/.changeset/wicked-zebras-visit.md b/.changeset/wicked-zebras-visit.md deleted file mode 100644 index 0514429..0000000 --- a/.changeset/wicked-zebras-visit.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@bsmnt/scrollytelling": patch ---- - -Tweak disabled diff --git a/scrollytelling/CHANGELOG.md b/scrollytelling/CHANGELOG.md index 82e17ca..a88bf3f 100644 --- a/scrollytelling/CHANGELOG.md +++ b/scrollytelling/CHANGELOG.md @@ -1,5 +1,12 @@ # @bsmnt/scrollytelling +## 0.2.4 + +### Patch Changes + +- 56586af: Default disabled value to false +- abe6bb9: Tweak disabled + ## 0.2.4-next.1 ### Patch Changes diff --git a/scrollytelling/package.json b/scrollytelling/package.json index 89cd605..883405c 100644 --- a/scrollytelling/package.json +++ b/scrollytelling/package.json @@ -1,7 +1,7 @@ { "name": "@bsmnt/scrollytelling", "author": "JB ", - "version": "0.2.4-next.1", + "version": "0.2.4", "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", diff --git a/website/CHANGELOG.md b/website/CHANGELOG.md index a245ff4..fb37b27 100644 --- a/website/CHANGELOG.md +++ b/website/CHANGELOG.md @@ -1,5 +1,13 @@ # website +## 0.1.1 + +### Patch Changes + +- Updated dependencies [56586af] +- Updated dependencies [abe6bb9] + - @bsmnt/scrollytelling@0.2.4 + ## 0.1.1-next.1 ### Patch Changes diff --git a/website/package.json b/website/package.json index 7cf0acc..cd3c1d1 100644 --- a/website/package.json +++ b/website/package.json @@ -1,7 +1,7 @@ { "name": "website", "private": true, - "version": "0.1.1-next.1", + "version": "0.1.1", "scripts": { "dev": "next dev", "build": "next build", @@ -10,7 +10,7 @@ "lint": "next lint" }, "dependencies": { - "@bsmnt/scrollytelling": "0.2.4-next.1", + "@bsmnt/scrollytelling": "0.2.4", "@react-three/drei": "^9.65.3", "@react-three/fiber": "^8.12.0", "@types/three": "^0.150.1",