Skip to content

Commit

Permalink
fixed build
Browse files Browse the repository at this point in the history
  • Loading branch information
rjct committed Dec 12, 2023
1 parent 2943d35 commit ca1c1ac
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 8 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "auto-clippath",
"version": "1.0.0",
"version": "1.0.1",
"description": "The TypeScript-based library for clip-path generation",
"type": "module",
"main": "./dist/auto-clippath.js",
"main": "./dist/auto-clippath.esm.js",
"module": "./dist/auto-clippath.esm.js",
"types": "./types/core.d.ts",
"exports": {
"node": {
"import": "./dist/auto-clippath.esm-node.js",
"require": "./dist/auto-clippath.node.cjs"
"import": "./dist/auto-clippath.esm.js",
"require": "./dist/auto-clippath.esm.cjs"
},
"default": "./dist/auto-clippath.esm.js"
},
Expand Down
2 changes: 1 addition & 1 deletion src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface Coordinates {
y: number;
}

export async function generateClipPath(
export default async function autoClipPath(
image: HTMLImageElement,
imageSize: Size2D,
options?: {
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { generateClipPath } from "./core";
import autoClipPath from "./core";

declare global {
interface Window {
autoClipPath: typeof generateClipPath;
autoClipPath: typeof autoClipPath;
}
}

window.autoClipPath = window.autoClipPath || generateClipPath;
window.autoClipPath = window.autoClipPath || autoClipPath;
16 changes: 16 additions & 0 deletions types/core.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export interface Size2D {
width: number;
height: number;
}
export interface Coordinates {
x: number;
y: number;
}
export default function autoClipPath(image: HTMLImageElement, imageSize: Size2D, options?: {
shift: Coordinates;
gap: number;
distance: number;
}): Promise<{
clipPath: Coordinates[];
time: number;
}>;
1 change: 1 addition & 0 deletions types/index-es6.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./core";
6 changes: 6 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import autoClipPath from "./core";
declare global {
interface Window {
autoClipPath: typeof autoClipPath;
}
}

0 comments on commit ca1c1ac

Please sign in to comment.