@hprint/print 0.0.1-alpha.3 → 0.0.1
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/package.json +4 -4
- package/src/index.ts +27 -27
- package/tsconfig.json +11 -11
- package/vite.config.ts +30 -30
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hprint/print",
|
|
3
|
-
"version": "0.0.1
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@hprint/
|
|
17
|
-
"@hprint/core": "0.0.1
|
|
18
|
-
"@hprint/
|
|
16
|
+
"@hprint/shared": "0.0.1",
|
|
17
|
+
"@hprint/core": "0.0.1",
|
|
18
|
+
"@hprint/plugins": "0.0.1"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [],
|
|
21
21
|
"author": "george-hong",
|
package/src/index.ts
CHANGED
|
@@ -1,28 +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
|
|
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
28
|
};
|
package/tsconfig.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "./dist",
|
|
5
|
-
"rootDir": "./",
|
|
6
|
-
"composite": true
|
|
7
|
-
},
|
|
8
|
-
"include": ["**/*.ts"],
|
|
9
|
-
"exclude": ["node_modules", "dist"],
|
|
10
|
-
"references": [{ "path": "../core" }]
|
|
11
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "./dist",
|
|
5
|
+
"rootDir": "./",
|
|
6
|
+
"composite": true
|
|
7
|
+
},
|
|
8
|
+
"include": ["**/*.ts"],
|
|
9
|
+
"exclude": ["node_modules", "dist"],
|
|
10
|
+
"references": [{ "path": "../core" }]
|
|
11
|
+
}
|
package/vite.config.ts
CHANGED
|
@@ -1,30 +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
|
-
});
|
|
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
|
+
});
|