@hprint/print 0.0.1-alpha.0
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/index.js +441 -0
- package/dist/index.mjs +19041 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.d.ts.map +1 -0
- package/package.json +39 -0
- package/src/index.ts +28 -0
- package/tsconfig.json +11 -0
- package/vite.config.ts +30 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as Editor, IPluginOption } from '@hprint/core';
|
|
2
|
+
import { SelectEvent, SelectMode } from '@hprint/plugins';
|
|
3
|
+
import { fabric, LengthConvert } from '@hprint/shared';
|
|
4
|
+
declare const usePlugins: (editor: Editor, options?: {
|
|
5
|
+
excludes: string[];
|
|
6
|
+
options: Record<string, IPluginOption>;
|
|
7
|
+
}) => void;
|
|
8
|
+
export { usePlugins, fabric, Editor, LengthConvert, SelectEvent, SelectMode };
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAe,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEvD,QAAA,MAAM,UAAU,GAAI,QAAQ,MAAM,EAAE,UAAU;IAC1C,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CACzC,SAUA,CAAC;AAEF,OAAO,EACH,UAAU,EACV,MAAM,EACN,MAAM,EACN,aAAa,EAEb,WAAW,EACX,UAAU,EACb,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hprint/print",
|
|
3
|
+
"version": "0.0.1-alpha.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "vite build",
|
|
17
|
+
"clean": "node -e \"require('fs').rmSync('dist', {recursive: true, force: true})\"",
|
|
18
|
+
"type-check": "tsc --noEmit",
|
|
19
|
+
"watch": "vite build --watch",
|
|
20
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@hprint/shared": "workspace:*",
|
|
24
|
+
"@hprint/core": "workspace:*",
|
|
25
|
+
"@hprint/plugins": "workspace:*"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [],
|
|
28
|
+
"author": "george-hong",
|
|
29
|
+
"license": "ISC",
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"packageManager": "pnpm@10.20.0",
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"rimraf": "^6.1.2",
|
|
36
|
+
"vite": "^7.2.4",
|
|
37
|
+
"vite-plugin-dts": "^4.5.4"
|
|
38
|
+
}
|
|
39
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Editor, { IPluginOption } from '@hprint/core';
|
|
2
|
+
import { pluginsList, SelectEvent, SelectMode } from '@hprint/plugins';
|
|
3
|
+
import { fabric, LengthConvert } from '@hprint/shared';
|
|
4
|
+
|
|
5
|
+
const usePlugins = (editor: Editor, options?: {
|
|
6
|
+
excludes: string[]
|
|
7
|
+
options: Record<string, IPluginOption>
|
|
8
|
+
}) => {
|
|
9
|
+
const excludesMap = options?.excludes?.reduce((total, cur) => {
|
|
10
|
+
total[cur] = 1;
|
|
11
|
+
return total;
|
|
12
|
+
}, {} as Record<string, 1>) || {};
|
|
13
|
+
pluginsList.forEach((plugin) => {
|
|
14
|
+
// 排除部分插件
|
|
15
|
+
if (excludesMap[plugin.pluginName]) return;
|
|
16
|
+
editor.use(plugin, options?.options?.[plugin.pluginName])
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
usePlugins,
|
|
22
|
+
fabric,
|
|
23
|
+
Editor,
|
|
24
|
+
LengthConvert,
|
|
25
|
+
// plugin packages
|
|
26
|
+
SelectEvent,
|
|
27
|
+
SelectMode
|
|
28
|
+
};
|
package/tsconfig.json
ADDED
package/vite.config.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import { resolve } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import dts from 'vite-plugin-dts';
|
|
5
|
+
|
|
6
|
+
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
7
|
+
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
plugins: [
|
|
10
|
+
dts({
|
|
11
|
+
outDir: 'dist',
|
|
12
|
+
include: ['src/**/*'],
|
|
13
|
+
}),
|
|
14
|
+
],
|
|
15
|
+
build: {
|
|
16
|
+
lib: {
|
|
17
|
+
entry: resolve(__dirname, 'src/index.ts'),
|
|
18
|
+
name: '@hprint/print',
|
|
19
|
+
fileName: 'index',
|
|
20
|
+
formats: ['es', 'cjs'],
|
|
21
|
+
},
|
|
22
|
+
rollupOptions: {
|
|
23
|
+
external: ['@hprint/core', '@hprint/plugins'],
|
|
24
|
+
output: {
|
|
25
|
+
globals: {},
|
|
26
|
+
preserveModules: false,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
});
|