@prismicio/editor-support
Advanced tools
Comparing version 0.4.49-alpha.feat-onboarding-guide.5 to 0.4.49-alpha.feat-onboarding-guide.6
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react");var y={};Object.defineProperty(y,"__esModule",{value:!0});var M=y.confetti=D,x=["#a864fd","#29cdff","#78ff44","#ff718d","#fdff6a"];function F(e,i,t,r,s){return Array.from({length:i}).map(function(l,a){var n=document.createElement("div"),c=t[a%t.length];return n.style["background-color"]=c,n.style.width=r,n.style.height=s,n.style.position="absolute",n.style.willChange="transform, opacity",n.style.visibility="hidden",e.appendChild(n),n})}function P(e,i,t,r){var s=e*(Math.PI/180),l=i*(Math.PI/180);return{x:0,y:0,z:0,wobble:r()*10,wobbleSpeed:.1+r()*.1,velocity:t*.5+r()*t,angle2D:-s+(.5*l-r()*l),angle3D:-(Math.PI/4)+r()*(Math.PI/2),tiltAngle:r()*Math.PI,tiltAngleSpeed:.1+r()*.3}}function A(e,i,t,r){e.physics.x+=Math.cos(e.physics.angle2D)*e.physics.velocity,e.physics.y+=Math.sin(e.physics.angle2D)*e.physics.velocity,e.physics.z+=Math.sin(e.physics.angle3D)*e.physics.velocity,e.physics.wobble+=e.physics.wobbleSpeed,r?e.physics.velocity*=r:e.physics.velocity-=e.physics.velocity*t,e.physics.y+=3,e.physics.tiltAngle+=e.physics.tiltAngleSpeed;var s=e.physics,l=s.x,a=s.y,n=s.z,c=s.tiltAngle,o=s.wobble,p=l+10*Math.cos(o),h=a+10*Math.sin(o),u="translate3d("+p+"px, "+h+"px, "+n+"px) rotate3d(1, 1, 1, "+c+"rad)";e.element.style.visibility="visible",e.element.style.transform=u,e.element.style.opacity=1-i}function E(e,i,t,r,s,l){var a=void 0;return new Promise(function(n){function c(o){a||(a=o);var p=o-a,h=a===o?0:(o-a)/s;i.slice(0,Math.ceil(p/l)).forEach(function(u){A(u,h,t,r)}),o-a<s?requestAnimationFrame(c):(i.forEach(function(u){if(u.element.parentNode===e)return e.removeChild(u.element)}),n())}requestAnimationFrame(c)})}var S={angle:90,spread:45,startVelocity:45,elementCount:50,width:"10px",height:"10px",perspective:"",colors:x,duration:3e3,stagger:0,dragFriction:.1,random:Math.random};function _(e){return!e.stagger&&e.delay&&(e.stagger=e.delay),e}function D(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=Object.assign({},S,_(i)),r=t.elementCount,s=t.colors,l=t.width,a=t.height,n=t.perspective,c=t.angle,o=t.spread,p=t.startVelocity,h=t.decay,u=t.dragFriction,f=t.duration,v=t.stagger,m=t.random;e.style.perspective=n;var b=F(e,r,s,l,a),C=b.map(function(w){return{element:w,physics:P(c,o,p,m)}});return E(e,C,u,h,f,v)}const g={colors:["var(--purple10, #8E44EC)","var(--purple5, #E8C7FF)","var(--indigo8, #59B5F8)","var(--indigo5, #C3EEFE)"],elementCount:300,width:"8px",height:"8px",stagger:.2,startVelocity:35,spread:90,duration:3e3};function I(e){const{config:i,onAnimationEnd:t}=e??{},r=d.useRef(null),s=d.useRef(null);return{throwConfetti:d.useCallback(()=>{const a=r.current,n=s.current;if(a){const c={...g,...i};if(n||t){const o=n&&n.style.overflow;n&&(n.style.overflow="hidden"),setTimeout(()=>{n&&o&&(n.style.overflow=o),t==null||t()},c.duration)}M(a,i)}},[i]),confettiCannonRef:r,confettiContainerRef:s}}exports.defaultConfettiConfig=g;exports.useConfetti=I; | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react");var y={};Object.defineProperty(y,"__esModule",{value:!0});var M=y.confetti=D,x=["#a864fd","#29cdff","#78ff44","#ff718d","#fdff6a"];function F(e,a,t,r,s){return Array.from({length:a}).map(function(c,i){var n=document.createElement("div"),l=t[i%t.length];return n.style["background-color"]=l,n.style.width=r,n.style.height=s,n.style.position="absolute",n.style.willChange="transform, opacity",n.style.visibility="hidden",e.appendChild(n),n})}function P(e,a,t,r){var s=e*(Math.PI/180),c=a*(Math.PI/180);return{x:0,y:0,z:0,wobble:r()*10,wobbleSpeed:.1+r()*.1,velocity:t*.5+r()*t,angle2D:-s+(.5*c-r()*c),angle3D:-(Math.PI/4)+r()*(Math.PI/2),tiltAngle:r()*Math.PI,tiltAngleSpeed:.1+r()*.3}}function A(e,a,t,r){e.physics.x+=Math.cos(e.physics.angle2D)*e.physics.velocity,e.physics.y+=Math.sin(e.physics.angle2D)*e.physics.velocity,e.physics.z+=Math.sin(e.physics.angle3D)*e.physics.velocity,e.physics.wobble+=e.physics.wobbleSpeed,r?e.physics.velocity*=r:e.physics.velocity-=e.physics.velocity*t,e.physics.y+=3,e.physics.tiltAngle+=e.physics.tiltAngleSpeed;var s=e.physics,c=s.x,i=s.y,n=s.z,l=s.tiltAngle,o=s.wobble,p=c+10*Math.cos(o),h=i+10*Math.sin(o),u="translate3d("+p+"px, "+h+"px, "+n+"px) rotate3d(1, 1, 1, "+l+"rad)";e.element.style.visibility="visible",e.element.style.transform=u,e.element.style.opacity=1-a}function E(e,a,t,r,s,c){var i=void 0;return new Promise(function(n){function l(o){i||(i=o);var p=o-i,h=i===o?0:(o-i)/s;a.slice(0,Math.ceil(p/c)).forEach(function(u){A(u,h,t,r)}),o-i<s?requestAnimationFrame(l):(a.forEach(function(u){if(u.element.parentNode===e)return e.removeChild(u.element)}),n())}requestAnimationFrame(l)})}var S={angle:90,spread:45,startVelocity:45,elementCount:50,width:"10px",height:"10px",perspective:"",colors:x,duration:3e3,stagger:0,dragFriction:.1,random:Math.random};function _(e){return!e.stagger&&e.delay&&(e.stagger=e.delay),e}function D(e){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=Object.assign({},S,_(a)),r=t.elementCount,s=t.colors,c=t.width,i=t.height,n=t.perspective,l=t.angle,o=t.spread,p=t.startVelocity,h=t.decay,u=t.dragFriction,f=t.duration,v=t.stagger,m=t.random;e.style.perspective=n;var b=F(e,r,s,c,i),C=b.map(function(w){return{element:w,physics:P(l,o,p,m)}});return E(e,C,u,h,f,v)}const g={colors:["var(--purple10, #8E44EC)","var(--purple5, #E8C7FF)","var(--indigo8, #59B5F8)","var(--indigo5, #C3EEFE)"],elementCount:300,width:"8px",height:"8px",stagger:.2,startVelocity:35,spread:90,duration:3e3};function I(e){const{config:a,onAnimationEnd:t}=e??{},r=d.useRef(null),s=d.useRef(null);return{throwConfetti:d.useCallback(()=>{const i=r.current,n=s.current,l={...g,...a};if(i){if(n||t){const o=n&&n.style.overflow;n&&(n.style.overflow="hidden"),setTimeout(()=>{n&&o&&(n.style.overflow=o),t==null||t()},l.duration)}M(i,l)}},[a]),confettiCannonRef:r,confettiContainerRef:s}}exports.defaultConfettiConfig=g;exports.useConfetti=I; |
@@ -8,9 +8,9 @@ import { useRef as y, useCallback as C } from "react"; | ||
function F(e, i, t, r, s) { | ||
return Array.from({ length: i }).map(function(l, a) { | ||
var n = document.createElement("div"), c = t[a % t.length]; | ||
return n.style["background-color"] = c, n.style.width = r, n.style.height = s, n.style.position = "absolute", n.style.willChange = "transform, opacity", n.style.visibility = "hidden", e.appendChild(n), n; | ||
return Array.from({ length: i }).map(function(c, a) { | ||
var n = document.createElement("div"), l = t[a % t.length]; | ||
return n.style["background-color"] = l, n.style.width = r, n.style.height = s, n.style.position = "absolute", n.style.willChange = "transform, opacity", n.style.visibility = "hidden", e.appendChild(n), n; | ||
}); | ||
} | ||
function A(e, i, t, r) { | ||
var s = e * (Math.PI / 180), l = i * (Math.PI / 180); | ||
var s = e * (Math.PI / 180), c = i * (Math.PI / 180); | ||
return { | ||
@@ -23,3 +23,3 @@ x: 0, | ||
velocity: t * 0.5 + r() * t, | ||
angle2D: -s + (0.5 * l - r() * l), | ||
angle2D: -s + (0.5 * c - r() * c), | ||
angle3D: -(Math.PI / 4) + r() * (Math.PI / 2), | ||
@@ -32,14 +32,14 @@ tiltAngle: r() * Math.PI, | ||
e.physics.x += Math.cos(e.physics.angle2D) * e.physics.velocity, e.physics.y += Math.sin(e.physics.angle2D) * e.physics.velocity, e.physics.z += Math.sin(e.physics.angle3D) * e.physics.velocity, e.physics.wobble += e.physics.wobbleSpeed, r ? e.physics.velocity *= r : e.physics.velocity -= e.physics.velocity * t, e.physics.y += 3, e.physics.tiltAngle += e.physics.tiltAngleSpeed; | ||
var s = e.physics, l = s.x, a = s.y, n = s.z, c = s.tiltAngle, o = s.wobble, h = l + 10 * Math.cos(o), u = a + 10 * Math.sin(o), p = "translate3d(" + h + "px, " + u + "px, " + n + "px) rotate3d(1, 1, 1, " + c + "rad)"; | ||
var s = e.physics, c = s.x, a = s.y, n = s.z, l = s.tiltAngle, o = s.wobble, h = c + 10 * Math.cos(o), u = a + 10 * Math.sin(o), p = "translate3d(" + h + "px, " + u + "px, " + n + "px) rotate3d(1, 1, 1, " + l + "rad)"; | ||
e.element.style.visibility = "visible", e.element.style.transform = p, e.element.style.opacity = 1 - i; | ||
} | ||
function P(e, i, t, r, s, l) { | ||
function P(e, i, t, r, s, c) { | ||
var a = void 0; | ||
return new Promise(function(n) { | ||
function c(o) { | ||
function l(o) { | ||
a || (a = o); | ||
var h = o - a, u = a === o ? 0 : (o - a) / s; | ||
i.slice(0, Math.ceil(h / l)).forEach(function(p) { | ||
i.slice(0, Math.ceil(h / c)).forEach(function(p) { | ||
E(p, u, t, r); | ||
}), o - a < s ? requestAnimationFrame(c) : (i.forEach(function(p) { | ||
}), o - a < s ? requestAnimationFrame(l) : (i.forEach(function(p) { | ||
if (p.element.parentNode === e) | ||
@@ -49,3 +49,3 @@ return e.removeChild(p.element); | ||
} | ||
requestAnimationFrame(c); | ||
requestAnimationFrame(l); | ||
}); | ||
@@ -71,8 +71,8 @@ } | ||
function I(e) { | ||
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t = Object.assign({}, _, D(i)), r = t.elementCount, s = t.colors, l = t.width, a = t.height, n = t.perspective, c = t.angle, o = t.spread, h = t.startVelocity, u = t.decay, p = t.dragFriction, g = t.duration, v = t.stagger, f = t.random; | ||
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t = Object.assign({}, _, D(i)), r = t.elementCount, s = t.colors, c = t.width, a = t.height, n = t.perspective, l = t.angle, o = t.spread, h = t.startVelocity, u = t.decay, p = t.dragFriction, g = t.duration, v = t.stagger, f = t.random; | ||
e.style.perspective = n; | ||
var m = F(e, r, s, l, a), b = m.map(function(w) { | ||
var m = F(e, r, s, c, a), b = m.map(function(w) { | ||
return { | ||
element: w, | ||
physics: A(c, o, h, f) | ||
physics: A(l, o, h, f) | ||
}; | ||
@@ -101,5 +101,4 @@ }); | ||
throwConfetti: C(() => { | ||
const a = r.current, n = s.current; | ||
const a = r.current, n = s.current, l = { ...S, ...i }; | ||
if (a) { | ||
const c = { ...S, ...i }; | ||
if (n || t) { | ||
@@ -109,5 +108,5 @@ const o = n && n.style.overflow; | ||
n && o && (n.style.overflow = o), t == null || t(); | ||
}, c.duration); | ||
}, l.duration); | ||
} | ||
M(a, i); | ||
M(a, l); | ||
} | ||
@@ -114,0 +113,0 @@ }, [i]), |
@@ -68,3 +68,3 @@ { | ||
}, | ||
"version": "0.4.49-alpha.feat-onboarding-guide.5" | ||
"version": "0.4.49-alpha.feat-onboarding-guide.6" | ||
} |
70278
1630