Skip to content

Commit

Permalink
fix(transitions): add missing type definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
dackmin committed Sep 27, 2023
1 parent 7358b8d commit bd52355
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 22 deletions.
35 changes: 35 additions & 0 deletions packages/transitions/lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Key, ReactNode } from 'react';

declare function AnimationHandler(
menuOrModal: ReactNode | JSX.Element,
opts?: {
opened?: boolean;
key?: Key;
[props: string]: any;
}
): ReactNode | JSX.Element;

export function animateMenu(
name: string,
opts?: {
time?: number;
key?: Key;
[props: string]: any;
}
): typeof AnimationHandler;

export const slideInUpMenu: typeof AnimationHandler;
export const slideInDownMenu: typeof AnimationHandler;

export function animateModal(
name: string,
opts?: {
time?: number;
key?: Key;
[props: string]: any;
}
): typeof AnimationHandler;

export const slideInUpModal: typeof AnimationHandler;
export const slideInLeftModal: typeof AnimationHandler;
export const appearBounceModal: typeof AnimationHandler;
1 change: 1 addition & 0 deletions packages/transitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"esnext": "src/index.js",
"unpkg": "dist/junipero-transitions.min.js",
"cdn": "dist/junipero-transitions.min.js",
"types": "dist/junipero-transitions.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/p3ol/junipero.git",
Expand Down
51 changes: 29 additions & 22 deletions packages/transitions/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import terser from '@rollup/plugin-terser';
import alias from '@rollup/plugin-alias';
import dts from 'rollup-plugin-dts';

const input = './lib/index.js';
const output = './dist';
Expand Down Expand Up @@ -37,26 +38,32 @@ const defaultPlugins = [
terser(),
];

export default formats.map(f => ({
input,
plugins: [
...defaultPlugins,
],
external: defaultExternals,
output: {
...(f === 'esm' ? {
dir: `${output}/esm`,
chunkFileNames: '[name].js',
} : {
file: `${output}/${name}.${f}.js`,
}),
format: f,
name,
sourcemap: true,
globals: defaultGlobals,
...(f === 'esm' ? {
manualChunks: id =>
id.includes('node_modules') ? 'vendor' : path.parse(id).name,
} : {}),
export default [
...formats.map(f => ({
input,
plugins: [
...defaultPlugins,
],
external: defaultExternals,
output: {
...(f === 'esm' ? {
dir: `${output}/esm`,
chunkFileNames: '[name].js',
} : {
file: `${output}/${name}.${f}.js`,
}),
format: f,
name,
sourcemap: true,
globals: defaultGlobals,
...(f === 'esm' ? {
manualChunks: id =>
id.includes('node_modules') ? 'vendor' : path.parse(id).name,
} : {}),
},
})), {
input: './lib/index.d.ts',
output: [{ file: `dist/${name}.d.ts`, format: 'es' }],
plugins: [dts()],
},
}));
];

0 comments on commit bd52355

Please sign in to comment.