@plasmicpkgs/react-awesome-reveal 3.8.92 → 3.8.93
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/dist/react-awesome-reveal.cjs.development.js +5 -13
- package/dist/react-awesome-reveal.cjs.development.js.map +1 -1
- package/dist/react-awesome-reveal.cjs.production.min.js.map +1 -1
- package/dist/react-awesome-reveal.esm.js +5 -13
- package/dist/react-awesome-reveal.esm.js.map +1 -1
- package/package.json +3 -3
|
@@ -13,13 +13,11 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
13
13
|
var target = {};
|
|
14
14
|
var sourceKeys = Object.keys(source);
|
|
15
15
|
var key, i;
|
|
16
|
-
|
|
17
16
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
18
17
|
key = sourceKeys[i];
|
|
19
18
|
if (excluded.indexOf(key) >= 0) continue;
|
|
20
19
|
target[key] = source[key];
|
|
21
20
|
}
|
|
22
|
-
|
|
23
21
|
return target;
|
|
24
22
|
}
|
|
25
23
|
|
|
@@ -38,19 +36,16 @@ var effectNameToComponent = {
|
|
|
38
36
|
var effects = /*#__PURE__*/Object.keys(effectNameToComponent);
|
|
39
37
|
function Reveal(_ref) {
|
|
40
38
|
var _ref$effect = _ref.effect,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
effect = _ref$effect === void 0 ? "fade" : _ref$effect,
|
|
40
|
+
className = _ref.className,
|
|
41
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
45
42
|
var Comp = effectNameToComponent[effect];
|
|
46
|
-
|
|
47
43
|
if (!Comp) {
|
|
48
44
|
throw new Error("Please specify a valid effect: " + effects.join(", "));
|
|
49
|
-
}
|
|
45
|
+
}
|
|
46
|
+
// Rendering plain strings seems to result in an infinite loop from
|
|
50
47
|
// "react-awesome-reveal" (except for when `cascading` is set).
|
|
51
48
|
// So we create a wrapper `div`.
|
|
52
|
-
|
|
53
|
-
|
|
54
49
|
var children = props.cascade || !["string", "number", "boolean"].includes(typeof props.children) ? props.children : React.createElement("div", null, " ", props.children, " ");
|
|
55
50
|
return React.createElement(Comp, Object.assign({
|
|
56
51
|
className: className
|
|
@@ -101,11 +96,9 @@ var revealMeta = {
|
|
|
101
96
|
type: "choice",
|
|
102
97
|
options: function options(props) {
|
|
103
98
|
var effect = props.effect || "fade";
|
|
104
|
-
|
|
105
99
|
var maybeAddOptions = function maybeAddOptions(effects, options) {
|
|
106
100
|
return effects.includes(effect) ? options : [];
|
|
107
101
|
};
|
|
108
|
-
|
|
109
102
|
return [].concat(maybeAddOptions(["flip"], ["horizontal", "vertical"])).concat(maybeAddOptions(["bounce", "fade", "slide", "zoom"], ["down", "left", "right", "up"])).concat(maybeAddOptions(["fade", "rotate"], ["bottom-left", "bottom-right", "top-left", "top-right"]));
|
|
110
103
|
},
|
|
111
104
|
hidden: function hidden(props) {
|
|
@@ -131,7 +124,6 @@ var revealMeta = {
|
|
|
131
124
|
defaultValueHint: "fade"
|
|
132
125
|
},
|
|
133
126
|
// `fraction` seems not to be working properly as of `react-awesome-reveal@3.8.1`
|
|
134
|
-
|
|
135
127
|
/* fraction: {
|
|
136
128
|
type: "number",
|
|
137
129
|
displayName: "Fraction",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-awesome-reveal.cjs.development.js","sources":["../src/index.tsx"],"sourcesContent":["import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\nimport {\n Bounce,\n Fade,\n Flip,\n Hinge,\n JackInTheBox,\n Roll,\n Rotate,\n Slide,\n Zoom,\n} from \"react-awesome-reveal\";\n\nconst effectNameToComponent = {\n bounce: Bounce,\n fade: Fade,\n flip: Flip,\n hinge: Hinge,\n jackinthebox: JackInTheBox,\n roll: Roll,\n rotate: Rotate,\n slide: Slide,\n zoom: Zoom,\n} as const;\n\ntype Effect = keyof typeof effectNameToComponent;\n\nconst effects = Object.keys(effectNameToComponent);\n\nexport interface RevealProps extends React.ComponentProps<typeof Fade> {\n className?: string;\n effect?: Effect;\n}\n\nexport function Reveal({ effect = \"fade\", className, ...props }: RevealProps) {\n const Comp = effectNameToComponent[effect] as any;\n if (!Comp) {\n throw new Error(`Please specify a valid effect: ${effects.join(\", \")}`);\n }\n // Rendering plain strings seems to result in an infinite loop from\n // \"react-awesome-reveal\" (except for when `cascading` is set).\n // So we create a wrapper `div`.\n const children =\n props.cascade ||\n ![\"string\", \"number\", \"boolean\"].includes(typeof props.children) ? (\n props.children\n ) : (\n <div> {props.children} </div>\n );\n return <Comp className={className} {...props} children={children} />;\n}\n\nexport const revealMeta: ComponentMeta<RevealProps> = {\n name: \"hostless-reveal\",\n importName: \"Reveal\",\n displayName: \"Reveal\",\n importPath: \"@plasmicpkgs/react-awesome-reveal\",\n isAttachment: true,\n props: {\n big: {\n type: \"boolean\",\n displayName: \"Big\",\n description: `Causes the animation to start farther`,\n hidden: (props) =>\n (props.effect || \"fade\") !== \"fade\" ||\n ![\"down\", \"left\", \"up\", \"right\"].includes(props.direction as string),\n },\n cascade: {\n type: \"boolean\",\n displayName: \"Cascade\",\n description: \"Stagger its children animations\",\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"img\",\n src: \"https://placekitten.com/300/200\",\n },\n ],\n },\n damping: {\n type: \"number\",\n displayName: \"Damping\",\n description:\n \"Factor that affects the delay that each animated element in a cascade animation will be assigned\",\n defaultValueHint: 0.5\n },\n delay: {\n type: \"number\",\n displayName: \"Delay\",\n description: \"Initial delay, in milliseconds\",\n defaultValueHint: 0,\n },\n direction: {\n type: \"choice\",\n options: (props) => {\n const effect = props.effect || \"fade\";\n const maybeAddOptions = (effects: Effect[], options: string[]) =>\n effects.includes(effect) ? options : [];\n return ([] as string[])\n .concat(maybeAddOptions([\"flip\"], [\"horizontal\", \"vertical\"]))\n .concat(\n maybeAddOptions(\n [\"bounce\", \"fade\", \"slide\", \"zoom\"],\n [\"down\", \"left\", \"right\", \"up\"]\n )\n )\n .concat(\n maybeAddOptions(\n [\"fade\", \"rotate\"],\n [\"bottom-left\", \"bottom-right\", \"top-left\", \"top-right\"]\n )\n );\n },\n hidden: (props) => {\n const effect = props.effect || \"fade\";\n return [\"hinge\", \"jackinthebox\", \"roll\"].includes(effect);\n },\n displayName: \"Direction\",\n description:\n \"Origin of the animation (the valid values depend on the chosen Effect)\",\n },\n duration: {\n type: \"number\",\n displayName: \"Duration\",\n description: \"Animation duration, in milliseconds\",\n defaultValueHint: 1000,\n },\n effect: {\n type: \"choice\",\n options: effects.map((v) => v),\n displayName: \"Effect\",\n description: \"The Reveal animation effect to be applied\",\n defaultValueHint: \"fade\"\n },\n // `fraction` seems not to be working properly as of `react-awesome-reveal@3.8.1`\n /* fraction: {\n type: \"number\",\n displayName: \"Fraction\",\n description:\n \"Float number between 0 and 1 indicating how much the element should be in viewport before the animation is triggered\",\n }, */\n reverse: {\n type: \"boolean\",\n displayName: \"Reverse\",\n description: `Whether the animation should make element(s) disappear`,\n hidden: (props) =>\n [\"hinge\", \"jackinthebox\"].includes(props.effect || \"fade\"),\n },\n triggerOnce: {\n type: \"boolean\",\n displayName: \"Trigger Once\",\n description:\n \"Whether the animation should run only once, instead of everytime the element enters, exits and re-enters the viewport\",\n // Some effects don't work correctly when `false`\n defaultValue: true,\n },\n },\n};\n\nexport function registerReveal(\n loader?: { registerComponent: typeof registerComponent },\n customRevealMeta?: ComponentMeta<RevealProps>\n) {\n if (loader) {\n loader.registerComponent(Reveal, customRevealMeta ?? revealMeta);\n } else {\n registerComponent(Reveal, customRevealMeta ?? revealMeta);\n }\n}\n"],"names":["effectNameToComponent","bounce","Bounce","fade","Fade","flip","Flip","hinge","Hinge","jackinthebox","JackInTheBox","roll","Roll","rotate","Rotate","slide","Slide","zoom","Zoom","effects","Object","keys","Reveal","effect","className","props","Comp","Error","join","children","cascade","includes","React","revealMeta","name","importName","displayName","importPath","isAttachment","big","type","description","hidden","direction","defaultValue","src","damping","defaultValueHint","delay","options","maybeAddOptions","concat","duration","map","v","reverse","triggerOnce","registerReveal","loader","customRevealMeta","registerComponent"],"mappings":"
|
|
1
|
+
{"version":3,"file":"react-awesome-reveal.cjs.development.js","sources":["../src/index.tsx"],"sourcesContent":["import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\nimport {\n Bounce,\n Fade,\n Flip,\n Hinge,\n JackInTheBox,\n Roll,\n Rotate,\n Slide,\n Zoom,\n} from \"react-awesome-reveal\";\n\nconst effectNameToComponent = {\n bounce: Bounce,\n fade: Fade,\n flip: Flip,\n hinge: Hinge,\n jackinthebox: JackInTheBox,\n roll: Roll,\n rotate: Rotate,\n slide: Slide,\n zoom: Zoom,\n} as const;\n\ntype Effect = keyof typeof effectNameToComponent;\n\nconst effects = Object.keys(effectNameToComponent);\n\nexport interface RevealProps extends React.ComponentProps<typeof Fade> {\n className?: string;\n effect?: Effect;\n}\n\nexport function Reveal({ effect = \"fade\", className, ...props }: RevealProps) {\n const Comp = effectNameToComponent[effect] as any;\n if (!Comp) {\n throw new Error(`Please specify a valid effect: ${effects.join(\", \")}`);\n }\n // Rendering plain strings seems to result in an infinite loop from\n // \"react-awesome-reveal\" (except for when `cascading` is set).\n // So we create a wrapper `div`.\n const children =\n props.cascade ||\n ![\"string\", \"number\", \"boolean\"].includes(typeof props.children) ? (\n props.children\n ) : (\n <div> {props.children} </div>\n );\n return <Comp className={className} {...props} children={children} />;\n}\n\nexport const revealMeta: ComponentMeta<RevealProps> = {\n name: \"hostless-reveal\",\n importName: \"Reveal\",\n displayName: \"Reveal\",\n importPath: \"@plasmicpkgs/react-awesome-reveal\",\n isAttachment: true,\n props: {\n big: {\n type: \"boolean\",\n displayName: \"Big\",\n description: `Causes the animation to start farther`,\n hidden: (props) =>\n (props.effect || \"fade\") !== \"fade\" ||\n ![\"down\", \"left\", \"up\", \"right\"].includes(props.direction as string),\n },\n cascade: {\n type: \"boolean\",\n displayName: \"Cascade\",\n description: \"Stagger its children animations\",\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"img\",\n src: \"https://placekitten.com/300/200\",\n },\n ],\n },\n damping: {\n type: \"number\",\n displayName: \"Damping\",\n description:\n \"Factor that affects the delay that each animated element in a cascade animation will be assigned\",\n defaultValueHint: 0.5\n },\n delay: {\n type: \"number\",\n displayName: \"Delay\",\n description: \"Initial delay, in milliseconds\",\n defaultValueHint: 0,\n },\n direction: {\n type: \"choice\",\n options: (props) => {\n const effect = props.effect || \"fade\";\n const maybeAddOptions = (effects: Effect[], options: string[]) =>\n effects.includes(effect) ? options : [];\n return ([] as string[])\n .concat(maybeAddOptions([\"flip\"], [\"horizontal\", \"vertical\"]))\n .concat(\n maybeAddOptions(\n [\"bounce\", \"fade\", \"slide\", \"zoom\"],\n [\"down\", \"left\", \"right\", \"up\"]\n )\n )\n .concat(\n maybeAddOptions(\n [\"fade\", \"rotate\"],\n [\"bottom-left\", \"bottom-right\", \"top-left\", \"top-right\"]\n )\n );\n },\n hidden: (props) => {\n const effect = props.effect || \"fade\";\n return [\"hinge\", \"jackinthebox\", \"roll\"].includes(effect);\n },\n displayName: \"Direction\",\n description:\n \"Origin of the animation (the valid values depend on the chosen Effect)\",\n },\n duration: {\n type: \"number\",\n displayName: \"Duration\",\n description: \"Animation duration, in milliseconds\",\n defaultValueHint: 1000,\n },\n effect: {\n type: \"choice\",\n options: effects.map((v) => v),\n displayName: \"Effect\",\n description: \"The Reveal animation effect to be applied\",\n defaultValueHint: \"fade\"\n },\n // `fraction` seems not to be working properly as of `react-awesome-reveal@3.8.1`\n /* fraction: {\n type: \"number\",\n displayName: \"Fraction\",\n description:\n \"Float number between 0 and 1 indicating how much the element should be in viewport before the animation is triggered\",\n }, */\n reverse: {\n type: \"boolean\",\n displayName: \"Reverse\",\n description: `Whether the animation should make element(s) disappear`,\n hidden: (props) =>\n [\"hinge\", \"jackinthebox\"].includes(props.effect || \"fade\"),\n },\n triggerOnce: {\n type: \"boolean\",\n displayName: \"Trigger Once\",\n description:\n \"Whether the animation should run only once, instead of everytime the element enters, exits and re-enters the viewport\",\n // Some effects don't work correctly when `false`\n defaultValue: true,\n },\n },\n};\n\nexport function registerReveal(\n loader?: { registerComponent: typeof registerComponent },\n customRevealMeta?: ComponentMeta<RevealProps>\n) {\n if (loader) {\n loader.registerComponent(Reveal, customRevealMeta ?? revealMeta);\n } else {\n registerComponent(Reveal, customRevealMeta ?? revealMeta);\n }\n}\n"],"names":["effectNameToComponent","bounce","Bounce","fade","Fade","flip","Flip","hinge","Hinge","jackinthebox","JackInTheBox","roll","Roll","rotate","Rotate","slide","Slide","zoom","Zoom","effects","Object","keys","Reveal","effect","className","props","Comp","Error","join","children","cascade","includes","React","revealMeta","name","importName","displayName","importPath","isAttachment","big","type","description","hidden","direction","defaultValue","src","damping","defaultValueHint","delay","options","maybeAddOptions","concat","duration","map","v","reverse","triggerOnce","registerReveal","loader","customRevealMeta","registerComponent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgBA,IAAMA,qBAAqB,GAAG;EAC5BC,MAAM,EAAEC,yBAAM;EACdC,IAAI,EAAEC,uBAAI;EACVC,IAAI,EAAEC,uBAAI;EACVC,KAAK,EAAEC,wBAAK;EACZC,YAAY,EAAEC,+BAAY;EAC1BC,IAAI,EAAEC,uBAAI;EACVC,MAAM,EAAEC,yBAAM;EACdC,KAAK,EAAEC,wBAAK;EACZC,IAAI,EAAEC;CACE;AAIV,IAAMC,OAAO,gBAAGC,MAAM,CAACC,IAAI,CAACrB,qBAAqB,CAAC;SAOlCsB,MAAM;yBAAGC,MAAM;IAANA,MAAM,4BAAG,MAAM;IAAEC,SAAS,QAATA,SAAS;IAAKC,KAAK;EAC3D,IAAMC,IAAI,GAAG1B,qBAAqB,CAACuB,MAAM,CAAQ;EACjD,IAAI,CAACG,IAAI,EAAE;IACT,MAAM,IAAIC,KAAK,qCAAmCR,OAAO,CAACS,IAAI,CAAC,IAAI,CAAC,CAAG;;;;;EA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ACrBK,WAAW,EAAE,2CAA2C;MACxDM,gBAAgB,EAAE;KACnB;;;;;;;;IAQDQ,OAAO,EAAE;MACPf,IAAI,EAAE,SAAS;MACfJ,WAAW,EAAE,SAAS;MACtBK,WAAW,0DAA0D;MACrEC,MAAM,EAAE,gBAACjB,KAAK;QAAA,OACZ,CAAC,OAAO,EAAE,cAAc,CAAC,CAACM,QAAQ,CAACN,KAAK,CAACF,MAAM,IAAI,MAAM,CAAC;;KAC7D;IACDiC,WAAW,EAAE;MACXhB,IAAI,EAAE,SAAS;MACfJ,WAAW,EAAE,cAAc;MAC3BK,WAAW,EACT,uHAAuH;;MAEzHG,YAAY,EAAE;;;;SAKJa,cAAc,CAC5BC,MAAwD,EACxDC,gBAA6C;EAE7C,IAAID,MAAM,EAAE;IACVA,MAAM,CAACE,iBAAiB,CAACtC,MAAM,EAAEqC,gBAAgB,WAAhBA,gBAAgB,GAAI1B,UAAU,CAAC;GACjE,MAAM;IACL2B,iBAAiB,CAACtC,MAAM,EAAEqC,gBAAgB,WAAhBA,gBAAgB,GAAI1B,UAAU,CAAC;;AAE7D;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-awesome-reveal.cjs.production.min.js","sources":["../src/index.tsx"],"sourcesContent":["import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\nimport {\n Bounce,\n Fade,\n Flip,\n Hinge,\n JackInTheBox,\n Roll,\n Rotate,\n Slide,\n Zoom,\n} from \"react-awesome-reveal\";\n\nconst effectNameToComponent = {\n bounce: Bounce,\n fade: Fade,\n flip: Flip,\n hinge: Hinge,\n jackinthebox: JackInTheBox,\n roll: Roll,\n rotate: Rotate,\n slide: Slide,\n zoom: Zoom,\n} as const;\n\ntype Effect = keyof typeof effectNameToComponent;\n\nconst effects = Object.keys(effectNameToComponent);\n\nexport interface RevealProps extends React.ComponentProps<typeof Fade> {\n className?: string;\n effect?: Effect;\n}\n\nexport function Reveal({ effect = \"fade\", className, ...props }: RevealProps) {\n const Comp = effectNameToComponent[effect] as any;\n if (!Comp) {\n throw new Error(`Please specify a valid effect: ${effects.join(\", \")}`);\n }\n // Rendering plain strings seems to result in an infinite loop from\n // \"react-awesome-reveal\" (except for when `cascading` is set).\n // So we create a wrapper `div`.\n const children =\n props.cascade ||\n ![\"string\", \"number\", \"boolean\"].includes(typeof props.children) ? (\n props.children\n ) : (\n <div> {props.children} </div>\n );\n return <Comp className={className} {...props} children={children} />;\n}\n\nexport const revealMeta: ComponentMeta<RevealProps> = {\n name: \"hostless-reveal\",\n importName: \"Reveal\",\n displayName: \"Reveal\",\n importPath: \"@plasmicpkgs/react-awesome-reveal\",\n isAttachment: true,\n props: {\n big: {\n type: \"boolean\",\n displayName: \"Big\",\n description: `Causes the animation to start farther`,\n hidden: (props) =>\n (props.effect || \"fade\") !== \"fade\" ||\n ![\"down\", \"left\", \"up\", \"right\"].includes(props.direction as string),\n },\n cascade: {\n type: \"boolean\",\n displayName: \"Cascade\",\n description: \"Stagger its children animations\",\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"img\",\n src: \"https://placekitten.com/300/200\",\n },\n ],\n },\n damping: {\n type: \"number\",\n displayName: \"Damping\",\n description:\n \"Factor that affects the delay that each animated element in a cascade animation will be assigned\",\n defaultValueHint: 0.5\n },\n delay: {\n type: \"number\",\n displayName: \"Delay\",\n description: \"Initial delay, in milliseconds\",\n defaultValueHint: 0,\n },\n direction: {\n type: \"choice\",\n options: (props) => {\n const effect = props.effect || \"fade\";\n const maybeAddOptions = (effects: Effect[], options: string[]) =>\n effects.includes(effect) ? options : [];\n return ([] as string[])\n .concat(maybeAddOptions([\"flip\"], [\"horizontal\", \"vertical\"]))\n .concat(\n maybeAddOptions(\n [\"bounce\", \"fade\", \"slide\", \"zoom\"],\n [\"down\", \"left\", \"right\", \"up\"]\n )\n )\n .concat(\n maybeAddOptions(\n [\"fade\", \"rotate\"],\n [\"bottom-left\", \"bottom-right\", \"top-left\", \"top-right\"]\n )\n );\n },\n hidden: (props) => {\n const effect = props.effect || \"fade\";\n return [\"hinge\", \"jackinthebox\", \"roll\"].includes(effect);\n },\n displayName: \"Direction\",\n description:\n \"Origin of the animation (the valid values depend on the chosen Effect)\",\n },\n duration: {\n type: \"number\",\n displayName: \"Duration\",\n description: \"Animation duration, in milliseconds\",\n defaultValueHint: 1000,\n },\n effect: {\n type: \"choice\",\n options: effects.map((v) => v),\n displayName: \"Effect\",\n description: \"The Reveal animation effect to be applied\",\n defaultValueHint: \"fade\"\n },\n // `fraction` seems not to be working properly as of `react-awesome-reveal@3.8.1`\n /* fraction: {\n type: \"number\",\n displayName: \"Fraction\",\n description:\n \"Float number between 0 and 1 indicating how much the element should be in viewport before the animation is triggered\",\n }, */\n reverse: {\n type: \"boolean\",\n displayName: \"Reverse\",\n description: `Whether the animation should make element(s) disappear`,\n hidden: (props) =>\n [\"hinge\", \"jackinthebox\"].includes(props.effect || \"fade\"),\n },\n triggerOnce: {\n type: \"boolean\",\n displayName: \"Trigger Once\",\n description:\n \"Whether the animation should run only once, instead of everytime the element enters, exits and re-enters the viewport\",\n // Some effects don't work correctly when `false`\n defaultValue: true,\n },\n },\n};\n\nexport function registerReveal(\n loader?: { registerComponent: typeof registerComponent },\n customRevealMeta?: ComponentMeta<RevealProps>\n) {\n if (loader) {\n loader.registerComponent(Reveal, customRevealMeta ?? revealMeta);\n } else {\n registerComponent(Reveal, customRevealMeta ?? revealMeta);\n }\n}\n"],"names":["effectNameToComponent","bounce","Bounce","fade","Fade","flip","Flip","hinge","Hinge","jackinthebox","JackInTheBox","roll","Roll","rotate","Rotate","slide","Slide","zoom","Zoom","effects","Object","keys","Reveal","effect","className","props","Comp","Error","join","children","cascade","includes","React","revealMeta","name","importName","displayName","importPath","isAttachment","big","type","description","hidden","direction","defaultValue","src","damping","defaultValueHint","delay","options","maybeAddOptions","concat","duration","map","v","reverse","triggerOnce","loader","customRevealMeta","registerComponent"],"mappings":"kRAgBMA,EAAwB,CAC5BC,OAAQC,SACRC,KAAMC,OACNC,KAAMC,OACNC,MAAOC,QACPC,aAAcC,eACdC,KAAMC,OACNC,OAAQC,SACRC,MAAOC,QACPC,KAAMC,QAKFC,EAAUC,OAAOC,KAAKrB,YAOZsB,aAASC,OAAAA,aAAS,SAAQC,IAAAA,UAAcC,0IAChDC,EAAO1B,EAAsBuB,
|
|
1
|
+
{"version":3,"file":"react-awesome-reveal.cjs.production.min.js","sources":["../src/index.tsx"],"sourcesContent":["import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\nimport {\n Bounce,\n Fade,\n Flip,\n Hinge,\n JackInTheBox,\n Roll,\n Rotate,\n Slide,\n Zoom,\n} from \"react-awesome-reveal\";\n\nconst effectNameToComponent = {\n bounce: Bounce,\n fade: Fade,\n flip: Flip,\n hinge: Hinge,\n jackinthebox: JackInTheBox,\n roll: Roll,\n rotate: Rotate,\n slide: Slide,\n zoom: Zoom,\n} as const;\n\ntype Effect = keyof typeof effectNameToComponent;\n\nconst effects = Object.keys(effectNameToComponent);\n\nexport interface RevealProps extends React.ComponentProps<typeof Fade> {\n className?: string;\n effect?: Effect;\n}\n\nexport function Reveal({ effect = \"fade\", className, ...props }: RevealProps) {\n const Comp = effectNameToComponent[effect] as any;\n if (!Comp) {\n throw new Error(`Please specify a valid effect: ${effects.join(\", \")}`);\n }\n // Rendering plain strings seems to result in an infinite loop from\n // \"react-awesome-reveal\" (except for when `cascading` is set).\n // So we create a wrapper `div`.\n const children =\n props.cascade ||\n ![\"string\", \"number\", \"boolean\"].includes(typeof props.children) ? (\n props.children\n ) : (\n <div> {props.children} </div>\n );\n return <Comp className={className} {...props} children={children} />;\n}\n\nexport const revealMeta: ComponentMeta<RevealProps> = {\n name: \"hostless-reveal\",\n importName: \"Reveal\",\n displayName: \"Reveal\",\n importPath: \"@plasmicpkgs/react-awesome-reveal\",\n isAttachment: true,\n props: {\n big: {\n type: \"boolean\",\n displayName: \"Big\",\n description: `Causes the animation to start farther`,\n hidden: (props) =>\n (props.effect || \"fade\") !== \"fade\" ||\n ![\"down\", \"left\", \"up\", \"right\"].includes(props.direction as string),\n },\n cascade: {\n type: \"boolean\",\n displayName: \"Cascade\",\n description: \"Stagger its children animations\",\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"img\",\n src: \"https://placekitten.com/300/200\",\n },\n ],\n },\n damping: {\n type: \"number\",\n displayName: \"Damping\",\n description:\n \"Factor that affects the delay that each animated element in a cascade animation will be assigned\",\n defaultValueHint: 0.5\n },\n delay: {\n type: \"number\",\n displayName: \"Delay\",\n description: \"Initial delay, in milliseconds\",\n defaultValueHint: 0,\n },\n direction: {\n type: \"choice\",\n options: (props) => {\n const effect = props.effect || \"fade\";\n const maybeAddOptions = (effects: Effect[], options: string[]) =>\n effects.includes(effect) ? options : [];\n return ([] as string[])\n .concat(maybeAddOptions([\"flip\"], [\"horizontal\", \"vertical\"]))\n .concat(\n maybeAddOptions(\n [\"bounce\", \"fade\", \"slide\", \"zoom\"],\n [\"down\", \"left\", \"right\", \"up\"]\n )\n )\n .concat(\n maybeAddOptions(\n [\"fade\", \"rotate\"],\n [\"bottom-left\", \"bottom-right\", \"top-left\", \"top-right\"]\n )\n );\n },\n hidden: (props) => {\n const effect = props.effect || \"fade\";\n return [\"hinge\", \"jackinthebox\", \"roll\"].includes(effect);\n },\n displayName: \"Direction\",\n description:\n \"Origin of the animation (the valid values depend on the chosen Effect)\",\n },\n duration: {\n type: \"number\",\n displayName: \"Duration\",\n description: \"Animation duration, in milliseconds\",\n defaultValueHint: 1000,\n },\n effect: {\n type: \"choice\",\n options: effects.map((v) => v),\n displayName: \"Effect\",\n description: \"The Reveal animation effect to be applied\",\n defaultValueHint: \"fade\"\n },\n // `fraction` seems not to be working properly as of `react-awesome-reveal@3.8.1`\n /* fraction: {\n type: \"number\",\n displayName: \"Fraction\",\n description:\n \"Float number between 0 and 1 indicating how much the element should be in viewport before the animation is triggered\",\n }, */\n reverse: {\n type: \"boolean\",\n displayName: \"Reverse\",\n description: `Whether the animation should make element(s) disappear`,\n hidden: (props) =>\n [\"hinge\", \"jackinthebox\"].includes(props.effect || \"fade\"),\n },\n triggerOnce: {\n type: \"boolean\",\n displayName: \"Trigger Once\",\n description:\n \"Whether the animation should run only once, instead of everytime the element enters, exits and re-enters the viewport\",\n // Some effects don't work correctly when `false`\n defaultValue: true,\n },\n },\n};\n\nexport function registerReveal(\n loader?: { registerComponent: typeof registerComponent },\n customRevealMeta?: ComponentMeta<RevealProps>\n) {\n if (loader) {\n loader.registerComponent(Reveal, customRevealMeta ?? revealMeta);\n } else {\n registerComponent(Reveal, customRevealMeta ?? revealMeta);\n }\n}\n"],"names":["effectNameToComponent","bounce","Bounce","fade","Fade","flip","Flip","hinge","Hinge","jackinthebox","JackInTheBox","roll","Roll","rotate","Rotate","slide","Slide","zoom","Zoom","effects","Object","keys","Reveal","effect","className","props","Comp","Error","join","children","cascade","includes","React","revealMeta","name","importName","displayName","importPath","isAttachment","big","type","description","hidden","direction","defaultValue","src","damping","defaultValueHint","delay","options","maybeAddOptions","concat","duration","map","v","reverse","triggerOnce","loader","customRevealMeta","registerComponent"],"mappings":"kRAgBMA,EAAwB,CAC5BC,OAAQC,SACRC,KAAMC,OACNC,KAAMC,OACNC,MAAOC,QACPC,aAAcC,eACdC,KAAMC,OACNC,OAAQC,SACRC,MAAOC,QACPC,KAAMC,QAKFC,EAAUC,OAAOC,KAAKrB,YAOZsB,aAASC,OAAAA,aAAS,SAAQC,IAAAA,UAAcC,0IAChDC,EAAO1B,EAAsBuB,GACnC,IAAKG,EACH,MAAM,IAAIC,wCAAwCR,EAAQS,KAAK,OAKjE,IAAMC,EACJJ,EAAMK,UACL,CAAC,SAAU,SAAU,WAAWC,gBAAgBN,EAAMI,UACrDJ,EAAMI,SAENG,+BAAOP,EAAMI,cAEjB,OAAOG,gBAACN,iBAAKF,UAAWA,GAAeC,GAAOI,SAAUA,SAG7CI,EAAyC,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AAgBM,SAASN,EAAMF,QAAU,UAEvDiC,YAAa,CACXhB,KAAM,UACNJ,YAAa,eACbK,YACE,wHAEFG,cAAc,sDAMlBa,EACAC,GAEID,EACFA,EAAOE,kBAAkBrC,QAAQoC,EAAAA,EAAoBzB,GAErD0B,EAAkBrC,QAAQoC,EAAAA,EAAoBzB"}
|
|
@@ -7,13 +7,11 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
7
7
|
var target = {};
|
|
8
8
|
var sourceKeys = Object.keys(source);
|
|
9
9
|
var key, i;
|
|
10
|
-
|
|
11
10
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
12
11
|
key = sourceKeys[i];
|
|
13
12
|
if (excluded.indexOf(key) >= 0) continue;
|
|
14
13
|
target[key] = source[key];
|
|
15
14
|
}
|
|
16
|
-
|
|
17
15
|
return target;
|
|
18
16
|
}
|
|
19
17
|
|
|
@@ -32,19 +30,16 @@ var effectNameToComponent = {
|
|
|
32
30
|
var effects = /*#__PURE__*/Object.keys(effectNameToComponent);
|
|
33
31
|
function Reveal(_ref) {
|
|
34
32
|
var _ref$effect = _ref.effect,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
effect = _ref$effect === void 0 ? "fade" : _ref$effect,
|
|
34
|
+
className = _ref.className,
|
|
35
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
39
36
|
var Comp = effectNameToComponent[effect];
|
|
40
|
-
|
|
41
37
|
if (!Comp) {
|
|
42
38
|
throw new Error("Please specify a valid effect: " + effects.join(", "));
|
|
43
|
-
}
|
|
39
|
+
}
|
|
40
|
+
// Rendering plain strings seems to result in an infinite loop from
|
|
44
41
|
// "react-awesome-reveal" (except for when `cascading` is set).
|
|
45
42
|
// So we create a wrapper `div`.
|
|
46
|
-
|
|
47
|
-
|
|
48
43
|
var children = props.cascade || !["string", "number", "boolean"].includes(typeof props.children) ? props.children : React.createElement("div", null, " ", props.children, " ");
|
|
49
44
|
return React.createElement(Comp, Object.assign({
|
|
50
45
|
className: className
|
|
@@ -95,11 +90,9 @@ var revealMeta = {
|
|
|
95
90
|
type: "choice",
|
|
96
91
|
options: function options(props) {
|
|
97
92
|
var effect = props.effect || "fade";
|
|
98
|
-
|
|
99
93
|
var maybeAddOptions = function maybeAddOptions(effects, options) {
|
|
100
94
|
return effects.includes(effect) ? options : [];
|
|
101
95
|
};
|
|
102
|
-
|
|
103
96
|
return [].concat(maybeAddOptions(["flip"], ["horizontal", "vertical"])).concat(maybeAddOptions(["bounce", "fade", "slide", "zoom"], ["down", "left", "right", "up"])).concat(maybeAddOptions(["fade", "rotate"], ["bottom-left", "bottom-right", "top-left", "top-right"]));
|
|
104
97
|
},
|
|
105
98
|
hidden: function hidden(props) {
|
|
@@ -125,7 +118,6 @@ var revealMeta = {
|
|
|
125
118
|
defaultValueHint: "fade"
|
|
126
119
|
},
|
|
127
120
|
// `fraction` seems not to be working properly as of `react-awesome-reveal@3.8.1`
|
|
128
|
-
|
|
129
121
|
/* fraction: {
|
|
130
122
|
type: "number",
|
|
131
123
|
displayName: "Fraction",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-awesome-reveal.esm.js","sources":["../src/index.tsx"],"sourcesContent":["import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\nimport {\n Bounce,\n Fade,\n Flip,\n Hinge,\n JackInTheBox,\n Roll,\n Rotate,\n Slide,\n Zoom,\n} from \"react-awesome-reveal\";\n\nconst effectNameToComponent = {\n bounce: Bounce,\n fade: Fade,\n flip: Flip,\n hinge: Hinge,\n jackinthebox: JackInTheBox,\n roll: Roll,\n rotate: Rotate,\n slide: Slide,\n zoom: Zoom,\n} as const;\n\ntype Effect = keyof typeof effectNameToComponent;\n\nconst effects = Object.keys(effectNameToComponent);\n\nexport interface RevealProps extends React.ComponentProps<typeof Fade> {\n className?: string;\n effect?: Effect;\n}\n\nexport function Reveal({ effect = \"fade\", className, ...props }: RevealProps) {\n const Comp = effectNameToComponent[effect] as any;\n if (!Comp) {\n throw new Error(`Please specify a valid effect: ${effects.join(\", \")}`);\n }\n // Rendering plain strings seems to result in an infinite loop from\n // \"react-awesome-reveal\" (except for when `cascading` is set).\n // So we create a wrapper `div`.\n const children =\n props.cascade ||\n ![\"string\", \"number\", \"boolean\"].includes(typeof props.children) ? (\n props.children\n ) : (\n <div> {props.children} </div>\n );\n return <Comp className={className} {...props} children={children} />;\n}\n\nexport const revealMeta: ComponentMeta<RevealProps> = {\n name: \"hostless-reveal\",\n importName: \"Reveal\",\n displayName: \"Reveal\",\n importPath: \"@plasmicpkgs/react-awesome-reveal\",\n isAttachment: true,\n props: {\n big: {\n type: \"boolean\",\n displayName: \"Big\",\n description: `Causes the animation to start farther`,\n hidden: (props) =>\n (props.effect || \"fade\") !== \"fade\" ||\n ![\"down\", \"left\", \"up\", \"right\"].includes(props.direction as string),\n },\n cascade: {\n type: \"boolean\",\n displayName: \"Cascade\",\n description: \"Stagger its children animations\",\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"img\",\n src: \"https://placekitten.com/300/200\",\n },\n ],\n },\n damping: {\n type: \"number\",\n displayName: \"Damping\",\n description:\n \"Factor that affects the delay that each animated element in a cascade animation will be assigned\",\n defaultValueHint: 0.5\n },\n delay: {\n type: \"number\",\n displayName: \"Delay\",\n description: \"Initial delay, in milliseconds\",\n defaultValueHint: 0,\n },\n direction: {\n type: \"choice\",\n options: (props) => {\n const effect = props.effect || \"fade\";\n const maybeAddOptions = (effects: Effect[], options: string[]) =>\n effects.includes(effect) ? options : [];\n return ([] as string[])\n .concat(maybeAddOptions([\"flip\"], [\"horizontal\", \"vertical\"]))\n .concat(\n maybeAddOptions(\n [\"bounce\", \"fade\", \"slide\", \"zoom\"],\n [\"down\", \"left\", \"right\", \"up\"]\n )\n )\n .concat(\n maybeAddOptions(\n [\"fade\", \"rotate\"],\n [\"bottom-left\", \"bottom-right\", \"top-left\", \"top-right\"]\n )\n );\n },\n hidden: (props) => {\n const effect = props.effect || \"fade\";\n return [\"hinge\", \"jackinthebox\", \"roll\"].includes(effect);\n },\n displayName: \"Direction\",\n description:\n \"Origin of the animation (the valid values depend on the chosen Effect)\",\n },\n duration: {\n type: \"number\",\n displayName: \"Duration\",\n description: \"Animation duration, in milliseconds\",\n defaultValueHint: 1000,\n },\n effect: {\n type: \"choice\",\n options: effects.map((v) => v),\n displayName: \"Effect\",\n description: \"The Reveal animation effect to be applied\",\n defaultValueHint: \"fade\"\n },\n // `fraction` seems not to be working properly as of `react-awesome-reveal@3.8.1`\n /* fraction: {\n type: \"number\",\n displayName: \"Fraction\",\n description:\n \"Float number between 0 and 1 indicating how much the element should be in viewport before the animation is triggered\",\n }, */\n reverse: {\n type: \"boolean\",\n displayName: \"Reverse\",\n description: `Whether the animation should make element(s) disappear`,\n hidden: (props) =>\n [\"hinge\", \"jackinthebox\"].includes(props.effect || \"fade\"),\n },\n triggerOnce: {\n type: \"boolean\",\n displayName: \"Trigger Once\",\n description:\n \"Whether the animation should run only once, instead of everytime the element enters, exits and re-enters the viewport\",\n // Some effects don't work correctly when `false`\n defaultValue: true,\n },\n },\n};\n\nexport function registerReveal(\n loader?: { registerComponent: typeof registerComponent },\n customRevealMeta?: ComponentMeta<RevealProps>\n) {\n if (loader) {\n loader.registerComponent(Reveal, customRevealMeta ?? revealMeta);\n } else {\n registerComponent(Reveal, customRevealMeta ?? revealMeta);\n }\n}\n"],"names":["effectNameToComponent","bounce","Bounce","fade","Fade","flip","Flip","hinge","Hinge","jackinthebox","JackInTheBox","roll","Roll","rotate","Rotate","slide","Slide","zoom","Zoom","effects","Object","keys","Reveal","effect","className","props","Comp","Error","join","children","cascade","includes","React","revealMeta","name","importName","displayName","importPath","isAttachment","big","type","description","hidden","direction","defaultValue","src","damping","defaultValueHint","delay","options","maybeAddOptions","concat","duration","map","v","reverse","triggerOnce","registerReveal","loader","customRevealMeta","registerComponent"],"mappings":"
|
|
1
|
+
{"version":3,"file":"react-awesome-reveal.esm.js","sources":["../src/index.tsx"],"sourcesContent":["import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\nimport {\n Bounce,\n Fade,\n Flip,\n Hinge,\n JackInTheBox,\n Roll,\n Rotate,\n Slide,\n Zoom,\n} from \"react-awesome-reveal\";\n\nconst effectNameToComponent = {\n bounce: Bounce,\n fade: Fade,\n flip: Flip,\n hinge: Hinge,\n jackinthebox: JackInTheBox,\n roll: Roll,\n rotate: Rotate,\n slide: Slide,\n zoom: Zoom,\n} as const;\n\ntype Effect = keyof typeof effectNameToComponent;\n\nconst effects = Object.keys(effectNameToComponent);\n\nexport interface RevealProps extends React.ComponentProps<typeof Fade> {\n className?: string;\n effect?: Effect;\n}\n\nexport function Reveal({ effect = \"fade\", className, ...props }: RevealProps) {\n const Comp = effectNameToComponent[effect] as any;\n if (!Comp) {\n throw new Error(`Please specify a valid effect: ${effects.join(\", \")}`);\n }\n // Rendering plain strings seems to result in an infinite loop from\n // \"react-awesome-reveal\" (except for when `cascading` is set).\n // So we create a wrapper `div`.\n const children =\n props.cascade ||\n ![\"string\", \"number\", \"boolean\"].includes(typeof props.children) ? (\n props.children\n ) : (\n <div> {props.children} </div>\n );\n return <Comp className={className} {...props} children={children} />;\n}\n\nexport const revealMeta: ComponentMeta<RevealProps> = {\n name: \"hostless-reveal\",\n importName: \"Reveal\",\n displayName: \"Reveal\",\n importPath: \"@plasmicpkgs/react-awesome-reveal\",\n isAttachment: true,\n props: {\n big: {\n type: \"boolean\",\n displayName: \"Big\",\n description: `Causes the animation to start farther`,\n hidden: (props) =>\n (props.effect || \"fade\") !== \"fade\" ||\n ![\"down\", \"left\", \"up\", \"right\"].includes(props.direction as string),\n },\n cascade: {\n type: \"boolean\",\n displayName: \"Cascade\",\n description: \"Stagger its children animations\",\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"img\",\n src: \"https://placekitten.com/300/200\",\n },\n ],\n },\n damping: {\n type: \"number\",\n displayName: \"Damping\",\n description:\n \"Factor that affects the delay that each animated element in a cascade animation will be assigned\",\n defaultValueHint: 0.5\n },\n delay: {\n type: \"number\",\n displayName: \"Delay\",\n description: \"Initial delay, in milliseconds\",\n defaultValueHint: 0,\n },\n direction: {\n type: \"choice\",\n options: (props) => {\n const effect = props.effect || \"fade\";\n const maybeAddOptions = (effects: Effect[], options: string[]) =>\n effects.includes(effect) ? options : [];\n return ([] as string[])\n .concat(maybeAddOptions([\"flip\"], [\"horizontal\", \"vertical\"]))\n .concat(\n maybeAddOptions(\n [\"bounce\", \"fade\", \"slide\", \"zoom\"],\n [\"down\", \"left\", \"right\", \"up\"]\n )\n )\n .concat(\n maybeAddOptions(\n [\"fade\", \"rotate\"],\n [\"bottom-left\", \"bottom-right\", \"top-left\", \"top-right\"]\n )\n );\n },\n hidden: (props) => {\n const effect = props.effect || \"fade\";\n return [\"hinge\", \"jackinthebox\", \"roll\"].includes(effect);\n },\n displayName: \"Direction\",\n description:\n \"Origin of the animation (the valid values depend on the chosen Effect)\",\n },\n duration: {\n type: \"number\",\n displayName: \"Duration\",\n description: \"Animation duration, in milliseconds\",\n defaultValueHint: 1000,\n },\n effect: {\n type: \"choice\",\n options: effects.map((v) => v),\n displayName: \"Effect\",\n description: \"The Reveal animation effect to be applied\",\n defaultValueHint: \"fade\"\n },\n // `fraction` seems not to be working properly as of `react-awesome-reveal@3.8.1`\n /* fraction: {\n type: \"number\",\n displayName: \"Fraction\",\n description:\n \"Float number between 0 and 1 indicating how much the element should be in viewport before the animation is triggered\",\n }, */\n reverse: {\n type: \"boolean\",\n displayName: \"Reverse\",\n description: `Whether the animation should make element(s) disappear`,\n hidden: (props) =>\n [\"hinge\", \"jackinthebox\"].includes(props.effect || \"fade\"),\n },\n triggerOnce: {\n type: \"boolean\",\n displayName: \"Trigger Once\",\n description:\n \"Whether the animation should run only once, instead of everytime the element enters, exits and re-enters the viewport\",\n // Some effects don't work correctly when `false`\n defaultValue: true,\n },\n },\n};\n\nexport function registerReveal(\n loader?: { registerComponent: typeof registerComponent },\n customRevealMeta?: ComponentMeta<RevealProps>\n) {\n if (loader) {\n loader.registerComponent(Reveal, customRevealMeta ?? revealMeta);\n } else {\n registerComponent(Reveal, customRevealMeta ?? revealMeta);\n }\n}\n"],"names":["effectNameToComponent","bounce","Bounce","fade","Fade","flip","Flip","hinge","Hinge","jackinthebox","JackInTheBox","roll","Roll","rotate","Rotate","slide","Slide","zoom","Zoom","effects","Object","keys","Reveal","effect","className","props","Comp","Error","join","children","cascade","includes","React","revealMeta","name","importName","displayName","importPath","isAttachment","big","type","description","hidden","direction","defaultValue","src","damping","defaultValueHint","delay","options","maybeAddOptions","concat","duration","map","v","reverse","triggerOnce","registerReveal","loader","customRevealMeta","registerComponent"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,IAAMA,qBAAqB,GAAG;EAC5BC,MAAM,EAAEC,MAAM;EACdC,IAAI,EAAEC,IAAI;EACVC,IAAI,EAAEC,IAAI;EACVC,KAAK,EAAEC,KAAK;EACZC,YAAY,EAAEC,YAAY;EAC1BC,IAAI,EAAEC,IAAI;EACVC,MAAM,EAAEC,MAAM;EACdC,KAAK,EAAEC,KAAK;EACZC,IAAI,EAAEC;CACE;AAIV,IAAMC,OAAO,gBAAGC,MAAM,CAACC,IAAI,CAACrB,qBAAqB,CAAC;SAOlCsB,MAAM;yBAAGC,MAAM;IAANA,MAAM,4BAAG,MAAM;IAAEC,SAAS,QAATA,SAAS;IAAKC,KAAK;EAC3D,IAAMC,IAAI,GAAG1B,qBAAqB,CAACuB,MAAM,CAAQ;EACjD,IAAI,CAACG,IAAI,EAAE;IACT,MAAM,IAAIC,KAAK,qCAAmCR,OAAO,CAACS,IAAI,CAAC,IAAI,CAAC,CAAG;;;;;EAKzE,IAAMC,QAAQ,GACZJ,KAAK,CAACK,OAAO,IACb,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAACC,QAAQ,CAAC,OAAON,K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SAAS;MACtBK,WAAW,0DAA0D;MACrEC,MAAM,EAAE,gBAACjB,KAAK;QAAA,OACZ,CAAC,OAAO,EAAE,cAAc,CAAC,CAACM,QAAQ,CAACN,KAAK,CAACF,MAAM,IAAI,MAAM,CAAC;;KAC7D;IACDiC,WAAW,EAAE;MACXhB,IAAI,EAAE,SAAS;MACfJ,WAAW,EAAE,cAAc;MAC3BK,WAAW,EACT,uHAAuH;;MAEzHG,YAAY,EAAE;;;;SAKJa,cAAc,CAC5BC,MAAwD,EACxDC,gBAA6C;EAE7C,IAAID,MAAM,EAAE;IACVA,MAAM,CAACE,iBAAiB,CAACtC,MAAM,EAAEqC,gBAAgB,WAAhBA,gBAAgB,GAAI1B,UAAU,CAAC;GACjE,MAAM;IACL2B,iBAAiB,CAACtC,MAAM,EAAEqC,gBAAgB,WAAhBA,gBAAgB,GAAI1B,UAAU,CAAC;;AAE7D;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicpkgs/react-awesome-reveal",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.93",
|
|
4
4
|
"description": "Plasmic registration call for react-awesome-reveal",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"analyze": "size-limit --why"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@plasmicapp/host": "1.0.
|
|
31
|
+
"@plasmicapp/host": "1.0.93",
|
|
32
32
|
"@size-limit/preset-small-lib": "^4.11.0",
|
|
33
33
|
"@types/node": "^14.0.26",
|
|
34
34
|
"size-limit": "^4.11.0",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"react": ">=16.8.0",
|
|
45
45
|
"react-dom": ">=16.8.0"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "e282c9cca3a168a822b34a1a5e6de3a6a072c00f"
|
|
48
48
|
}
|