@arronqzy/abuilder-vue 0.1.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/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # @arronqzy/abuilder-vue
2
+
3
+ Vue 3 版 Abuilder 入口包,对应 React 版的 `@arronqzy/abuilder`。安装后即可通过 `<App />` 渲染完整编辑器。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ pnpm add @arronqzy/abuilder-vue vue ant-design-vue
9
+ ```
10
+
11
+ ## 使用
12
+
13
+ ```ts
14
+ import { createApp } from "vue";
15
+ import Antd from "ant-design-vue";
16
+ import "ant-design-vue/dist/reset.css";
17
+ import { App } from "@arronqzy/abuilder-vue";
18
+
19
+ createApp(App).use(Antd).mount("#app");
20
+ ```
21
+
22
+ ### 可选配置
23
+
24
+ ```vue
25
+ <App class="h-screen" :initial-zoom="1" default-theme="dark" />
26
+ ```
27
+
28
+ | Prop | 说明 | 默认 |
29
+ |------|------|------|
30
+ | `class` | 根容器 class | — |
31
+ | `initialZoom` | 画布初始缩放 | `1` |
32
+ | `defaultTheme` | `light` / `dark` | `dark` |
33
+ | `previewSearch` | 覆盖预览 URL 查询串 | 当前 `location.search` |
34
+
35
+ ### 在线预览 URL
36
+
37
+ 当 URL 含 `?preview=online&projectId=<id>` 时,自动渲染 `VueViewOnlinePreview`(从 IndexedDB 加载工作区并执行蓝图生命周期)。
38
+
39
+ ## 依赖包
40
+
41
+ - `@arronqzy/vue-view` — 视图编辑器(画布、工作区、配置侧栏)
42
+ - `ant-design-vue` — UI 组件
43
+ - `vue` — peer dependency
44
+
45
+ ## 许可证
46
+
47
+ MIT
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@arronqzy/abuilder-vue",
3
+ "version": "0.1.0",
4
+ "description": "Abuilder Vue 3 可视化编辑器入口包",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "files": [
8
+ "src",
9
+ "dist"
10
+ ],
11
+ "exports": {
12
+ ".": "./src/index.ts"
13
+ },
14
+ "dependencies": {
15
+ "ant-design-vue": "^4.2.6",
16
+ "vue": "^3.5.13",
17
+ "@arronqzy/vue-view": "0.1.0"
18
+ },
19
+ "peerDependencies": {
20
+ "vue": "^3.4.0"
21
+ },
22
+ "devDependencies": {
23
+ "@vitejs/plugin-vue": "^5.2.1",
24
+ "eslint": "^8.57.0",
25
+ "typescript": "^5.5.4",
26
+ "vue-tsc": "^2.2.0",
27
+ "@arronqzy/typescript-config": "1.0.0",
28
+ "@arronqzy/eslint-config": "0.0.0"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "scripts": {
34
+ "lint": "eslint \"src/**/*.{ts,vue}\"",
35
+ "typecheck": "vue-tsc -p tsconfig.json --noEmit",
36
+ "build": "pnpm run typecheck"
37
+ }
38
+ }
package/src/App.vue ADDED
@@ -0,0 +1,42 @@
1
+ <script setup lang="ts">
2
+ import { computed } from "vue";
3
+ import { ConfigProvider, theme } from "ant-design-vue";
4
+ import {
5
+ VueViewPanel,
6
+ VueViewOnlinePreview,
7
+ parseOnlinePreviewSearchParams,
8
+ } from "@arronqzy/vue-view";
9
+ import type { AbuilderVueAppProps } from "./types";
10
+
11
+ const props = withDefaults(defineProps<AbuilderVueAppProps>(), {
12
+ initialZoom: 1,
13
+ defaultTheme: "dark",
14
+ });
15
+
16
+ const search =
17
+ props.previewSearch ??
18
+ (typeof window !== "undefined" ? window.location.search : "");
19
+
20
+ const previewParams = computed(() => parseOnlinePreviewSearchParams(search));
21
+
22
+ const isDark = computed(() => props.defaultTheme === "dark");
23
+ </script>
24
+
25
+ <template>
26
+ <ConfigProvider
27
+ :theme="{
28
+ algorithm: isDark ? theme.darkAlgorithm : theme.defaultAlgorithm,
29
+ }"
30
+ >
31
+ <VueViewOnlinePreview
32
+ v-if="previewParams"
33
+ :project-id="previewParams.projectId"
34
+ :preview-instance-id="previewParams.previewInstanceId"
35
+ />
36
+ <VueViewPanel
37
+ v-else
38
+ :class="props.class"
39
+ :initial-zoom="props.initialZoom"
40
+ />
41
+ </ConfigProvider>
42
+ </template>
package/src/env.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ declare module "*.vue" {
4
+ import type { DefineComponent } from "vue";
5
+ const component: DefineComponent<Record<string, unknown>, Record<string, unknown>, unknown>;
6
+ export default component;
7
+ }
package/src/index.ts ADDED
@@ -0,0 +1,8 @@
1
+ export { default as App } from "./App.vue";
2
+ export type { AbuilderVueAppProps } from "./types";
3
+
4
+ export {
5
+ VueViewPanel,
6
+ VueViewOnlinePreview,
7
+ parseOnlinePreviewSearchParams,
8
+ } from "@arronqzy/vue-view";
package/src/types.ts ADDED
@@ -0,0 +1,6 @@
1
+ export type AbuilderVueAppProps = {
2
+ class?: string;
3
+ initialZoom?: number;
4
+ defaultTheme?: "dark" | "light";
5
+ previewSearch?: string;
6
+ };