@composy/layout-vue 0.0.1 → 0.0.2
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/CHANGELOG.md +57 -0
- package/README.md +82 -75
- package/dist/index.css +9 -3
- package/dist/index.js +22 -11
- package/dist/index.js.map +1 -1
- package/dist/index.min.css +1 -1
- package/dist/index.min.js +2038 -1
- package/dist/index.min.js.map +1 -0
- package/es/.dts-output-manifest.json +1 -0
- package/es/.dts.tsbuildinfo +1 -0
- package/es/components/LGrid.d.ts +0 -1
- package/es/components/LGrid.js +3 -3
- package/es/components/LGrid.js.map +1 -1
- package/es/components/LGridItem.d.ts +0 -1
- package/es/components/LGridItem.d.ts.map +1 -1
- package/es/components/LGridItem.js +4 -2
- package/es/components/LGridItem.js.map +1 -1
- package/es/components/LLayoutEditor.d.ts +5 -5
- package/es/components/LLayoutEditor.d.ts.map +1 -1
- package/es/components/LLayoutEditor.js +2 -2
- package/es/components/LLayoutEditor.js.map +1 -1
- package/es/components/LLayoutWorkspace.js +1 -1
- package/es/components/LLayoutWorkspace.js.map +1 -1
- package/es/components/LLayoutWorkspace.vue_vue_type_script_setup_true_lang.js +8 -5
- package/es/components/LLayoutWorkspace.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/es/components/LMaterialDragSource.d.ts +0 -1
- package/es/components/LMaterialDragSource.js +1 -1
- package/es/components/LMaterialRenderer.d.ts +0 -1
- package/es/components/LMaterialRenderer.js +1 -1
- package/es/components/LMetricCard.d.ts +0 -1
- package/es/components/LMetricCard.js +1 -1
- package/es/components/LTrendCard.d.ts +0 -1
- package/es/components/LTrendCard.js +1 -1
- package/es/components/index.d.ts +0 -1
- package/es/components/index.js +3 -3
- package/es/components/material-renderer.d.ts +0 -1
- package/es/components/material-renderer.d.ts.map +1 -1
- package/es/components/material-renderer.js +10 -3
- package/es/components/material-renderer.js.map +1 -1
- package/es/composables/index.d.ts +0 -1
- package/es/composables/index.js +1 -1
- package/es/composables/useLayoutEditor.d.ts +0 -1
- package/es/composables/useLayoutEditor.js +1 -1
- package/es/index.d.ts +0 -1
- package/es/index.js +3 -5
- package/es/style/css.js +1 -1
- package/es/style/index.css +1 -0
- package/es/style/index.js +1 -1
- package/es/style/workspace.css +18 -2
- package/es/types.d.ts +0 -1
- package/es/types.js +1 -1
- package/esm/components/LGrid.d.ts.map +1 -0
- package/esm/components/LGrid.js +91 -0
- package/esm/components/LGrid.js.map +1 -0
- package/esm/components/LGridItem.d.ts.map +1 -0
- package/esm/components/LGridItem.js +54 -0
- package/esm/components/LGridItem.js.map +1 -0
- package/esm/components/LLayoutEditor.d.ts +50 -0
- package/esm/components/LLayoutEditor.d.ts.map +1 -0
- package/esm/components/LLayoutEditor.js +81 -0
- package/esm/components/LLayoutEditor.js.map +1 -0
- package/esm/components/LLayoutWorkspace.js +17 -0
- package/esm/components/LLayoutWorkspace.js.map +1 -0
- package/esm/components/LLayoutWorkspace.vue_vue_type_script_setup_true_lang.js +2220 -0
- package/esm/components/LLayoutWorkspace.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/esm/components/LMaterialDragSource.d.ts.map +1 -0
- package/esm/components/LMaterialDragSource.js +92 -0
- package/esm/components/LMaterialDragSource.js.map +1 -0
- package/esm/components/LMaterialRenderer.d.ts.map +1 -0
- package/esm/components/LMaterialRenderer.js +48 -0
- package/esm/components/LMaterialRenderer.js.map +1 -0
- package/esm/components/LMetricCard.d.ts.map +1 -0
- package/esm/components/LMetricCard.js +39 -0
- package/esm/components/LMetricCard.js.map +1 -0
- package/esm/components/LTrendCard.d.ts.map +1 -0
- package/esm/components/LTrendCard.js +36 -0
- package/esm/components/LTrendCard.js.map +1 -0
- package/esm/components/index.d.ts.map +1 -0
- package/esm/components/index.js +19 -0
- package/esm/components/material-renderer.d.ts.map +1 -0
- package/esm/components/material-renderer.js +103 -0
- package/esm/components/material-renderer.js.map +1 -0
- package/esm/composables/index.d.ts.map +1 -0
- package/esm/composables/index.js +12 -0
- package/esm/composables/useLayoutEditor.d.ts.map +1 -0
- package/esm/composables/useLayoutEditor.js +22 -0
- package/esm/composables/useLayoutEditor.js.map +1 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +22 -0
- package/esm/style/css.js +1 -0
- package/esm/style/index.js +1 -0
- package/{es → esm}/style/index.less +1 -1
- package/esm/style/workspace.css +2379 -0
- package/esm/types.d.ts.map +1 -0
- package/esm/types.js +10 -0
- package/lib/components/LGrid.cjs +3 -3
- package/lib/components/LGrid.cjs.map +1 -1
- package/lib/components/LGrid.d.cts +2 -0
- package/lib/components/LGrid.d.cts.map +1 -0
- package/lib/components/LGridItem.cjs +4 -2
- package/lib/components/LGridItem.cjs.map +1 -1
- package/lib/components/LGridItem.d.cts +51 -0
- package/lib/components/LGridItem.d.cts.map +1 -0
- package/lib/components/LLayoutEditor.cjs +2 -2
- package/lib/components/LLayoutEditor.cjs.map +1 -1
- package/lib/components/{LLayoutEditor.d.ts → LLayoutEditor.d.cts} +5 -5
- package/lib/components/LLayoutEditor.d.cts.map +1 -0
- package/lib/components/LLayoutWorkspace.cjs +1 -1
- package/lib/components/LLayoutWorkspace.cjs.map +1 -1
- package/lib/components/LLayoutWorkspace.vue_vue_type_script_setup_true_lang.cjs +8 -5
- package/lib/components/LLayoutWorkspace.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/lib/components/LMaterialDragSource.cjs +1 -1
- package/lib/components/LMaterialDragSource.d.cts +54 -0
- package/lib/components/LMaterialDragSource.d.cts.map +1 -0
- package/lib/components/LMaterialRenderer.cjs +1 -1
- package/lib/components/LMaterialRenderer.d.cts +62 -0
- package/lib/components/LMaterialRenderer.d.cts.map +1 -0
- package/lib/components/LMetricCard.cjs +1 -1
- package/lib/components/LMetricCard.d.cts +28 -0
- package/lib/components/LMetricCard.d.cts.map +1 -0
- package/lib/components/LTrendCard.cjs +1 -1
- package/lib/components/LTrendCard.d.cts +16 -0
- package/lib/components/LTrendCard.d.cts.map +1 -0
- package/lib/components/index.cjs +1 -1
- package/lib/components/index.d.cts +9 -0
- package/lib/components/index.d.cts.map +1 -0
- package/lib/components/material-renderer.cjs +10 -3
- package/lib/components/material-renderer.cjs.map +1 -1
- package/lib/components/material-renderer.d.cts +25 -0
- package/lib/components/material-renderer.d.cts.map +1 -0
- package/lib/composables/index.cjs +1 -1
- package/lib/composables/index.d.cts +1 -0
- package/lib/composables/index.d.cts.map +1 -0
- package/lib/composables/useLayoutEditor.cjs +1 -1
- package/lib/composables/useLayoutEditor.d.cts +2 -0
- package/lib/composables/useLayoutEditor.d.cts.map +1 -0
- package/lib/index.cjs +1 -1
- package/lib/index.d.cts +6 -0
- package/lib/index.d.cts.map +1 -0
- package/lib/style/index.css +0 -1
- package/lib/style/workspace.css +9 -1
- package/lib/types.cjs +1 -1
- package/lib/types.d.cts +25 -0
- package/lib/types.d.cts.map +1 -0
- package/package.json +25 -18
- /package/{lib → esm}/components/LGrid.d.ts +0 -0
- /package/{lib → esm}/components/LGridItem.d.ts +0 -0
- /package/{lib → esm}/components/LMaterialDragSource.d.ts +0 -0
- /package/{lib → esm}/components/LMaterialRenderer.d.ts +0 -0
- /package/{lib → esm}/components/LMetricCard.d.ts +0 -0
- /package/{lib → esm}/components/LTrendCard.d.ts +0 -0
- /package/{lib → esm}/components/index.d.ts +0 -0
- /package/{lib → esm}/components/material-renderer.d.ts +0 -0
- /package/{lib → esm}/composables/index.d.ts +0 -0
- /package/{lib → esm}/composables/useLayoutEditor.d.ts +0 -0
- /package/{lib → esm}/index.d.ts +0 -0
- /package/{lib → esm}/types.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.2] - 2026-10-12
|
|
4
|
+
|
|
5
|
+
### ✨ 新功能
|
|
6
|
+
|
|
7
|
+
- **layout**: 添加 LDesign 项目配置文件 ([f61ae51](https://gitee.com/swimly/ldesign-layout/commit/f61ae51279dff52720216e15e7dffc6fd0b8c579)) - @swimly
|
|
8
|
+
- auto-generated playground + README for layout sub-packages ([8fb976a](https://gitee.com/swimly/ldesign-layout/commit/8fb976a2cff047f1a34c495478858049c29f661b)) - @swimly
|
|
9
|
+
- 初始化网格布局系统核心库、Vue适配器及演示项目 ([85c7432](https://gitee.com/swimly/ldesign-layout/commit/85c74320349e725a0f0ac4bd113d88e97130bd7b)) - @swimly
|
|
10
|
+
|
|
11
|
+
### ♻️ 代码重构
|
|
12
|
+
|
|
13
|
+
- 重构项目为pnpm monorepo并初始化全量布局包 ([d6dda52](https://gitee.com/swimly/ldesign-layout/commit/d6dda528e132eff6f316f9dcb37c4dd11d4e98c7)) - @swimly
|
|
14
|
+
|
|
15
|
+
### 📝 文档更新
|
|
16
|
+
|
|
17
|
+
- 添加源码JSDoc注释并修复vue构建配置 ([774fff5](https://gitee.com/swimly/ldesign-layout/commit/774fff5694124791568c34f11cc8ffcf46e874df)) - @swimly
|
|
18
|
+
|
|
19
|
+
### 💄 代码样式
|
|
20
|
+
|
|
21
|
+
- **packages/vue**: 修复 package.json 缺失的末尾换行 ([fe7e61c](https://gitee.com/swimly/ldesign-layout/commit/fe7e61ca4e98fd50945ed8085a050b140a93cda2)) - @swimly
|
|
22
|
+
|
|
23
|
+
### 📦 构建系统
|
|
24
|
+
|
|
25
|
+
- 更新依赖版本、修复本地包路径与调整workspace配置 ([96dc8ee](https://gitee.com/swimly/ldesign-layout/commit/96dc8eeff5802eba4b8adf01847305169f39718c)) - @swimly
|
|
26
|
+
- **vue**: 调整vue包构建输出路径并新增布局注入类型定义 ([b1783c3](https://gitee.com/swimly/ldesign-layout/commit/b1783c351fbf80c597414c5ca9a93108d4919bc8)) - @swimly
|
|
27
|
+
- 切换为本地链接依赖并更新构建配置 ([52984e3](https://gitee.com/swimly/ldesign-layout/commit/52984e34075b228343fa95f852413cafae6b6557)) - @swimly
|
|
28
|
+
- 优化 core 和 vue 包的 tsconfig 配置 ([30edcbf](https://gitee.com/swimly/ldesign-layout/commit/30edcbfc73e08faea200c9b7cacded2586c595fc)) - @swimly
|
|
29
|
+
- 标准化库构建配置并添加UMD输出 ([a686bb2](https://gitee.com/swimly/ldesign-layout/commit/a686bb28ec4e03bdfee843c0ffb3f1207c729347)) - @swimly
|
|
30
|
+
- **vue**: 在 package.json 的 files 字段中添加 lib 目录 ([41bd2e0](https://gitee.com/swimly/ldesign-layout/commit/41bd2e091f72f5edfe990e7cfed8e2e47ae77f19)) - @swimly
|
|
31
|
+
|
|
32
|
+
### 🔧 其他
|
|
33
|
+
|
|
34
|
+
- **layout**: 更新项目配置及依赖版本 ([5344532](https://gitee.com/swimly/ldesign-layout/commit/534453298534e85a3f6776f908290bffdb15b8a6)) - @swimly
|
|
35
|
+
- **layout**: 统一构建配置与文档体系,新增 Playground 示例 ([d8691a0](https://gitee.com/swimly/ldesign-layout/commit/d8691a0721bdf088b6c5585ac2826b1b851d746d)) - @swimly
|
|
36
|
+
- 修复多个package.json文件末尾缺失换行符的问题 ([df9b977](https://gitee.com/swimly/ldesign-layout/commit/df9b977cca8d88cb4df00583f6eea31fd0e8c51b)) - @swimly
|
|
37
|
+
- 更新各包依赖版本 ([1ce08a9](https://gitee.com/swimly/ldesign-layout/commit/1ce08a9e677780eb38298c4cabe92e5693424fc2)) - @swimly
|
|
38
|
+
- update layout (92 files) ([9c28da2](https://gitee.com/swimly/ldesign-layout/commit/9c28da243aebea0d2c1c20ccb4c996aae9f031fc)) - @swimly
|
|
39
|
+
- **types**: 删除不再使用的 shims-vue.d.ts 文件 ([775e7f8](https://gitee.com/swimly/ldesign-layout/commit/775e7f85a2c15b25bb8726885e99de951441aaae)) - @swimly
|
|
40
|
+
- normalize versions, clean artifacts, update gitignore ([eda7040](https://gitee.com/swimly/ldesign-layout/commit/eda7040c38687acedd22db31f9576143e029f3d1)) - @swimly
|
|
41
|
+
- update - docs: 添加源码JSDoc注释并修复vue构建配 ([1668904](https://gitee.com/swimly/ldesign-layout/commit/1668904bb55a1903727f67ee98df6f088a599164)) - @swimly
|
|
42
|
+
- 批量更新 - 规范 .gitignore 清理源码 ([854d7ef](https://gitee.com/swimly/ldesign-layout/commit/854d7efc32d60f608bc638e219cb16763216dfd0)) - @swimly
|
|
43
|
+
- unified build config and structure ([c0ae01c](https://gitee.com/swimly/ldesign-layout/commit/c0ae01c844cebc0b5bd7d4a2dc8ef16e5c8186ee)) - @swimly
|
|
44
|
+
- 添加代码质量工具配置和脚本 ([083653a](https://gitee.com/swimly/ldesign-layout/commit/083653a0ad7c4e34249737fd7af9d3257fda548d)) - @swimly
|
|
45
|
+
- **vue**: 更新 Vue 依赖版本至 3.5.32 ([2815698](https://gitee.com/swimly/ldesign-layout/commit/28156980c94d5b588a073d0d85794fd7af2823b8)) - @swimly
|
|
46
|
+
- add build config, tsconfig, README ([7d4bb6e](https://gitee.com/swimly/ldesign-layout/commit/7d4bb6e0cee6ae778bd7073a3e2315696ffcabf3)) - @swimly
|
|
47
|
+
- clean up project structure - keep only packages/core/src and packages/vue/src ([92fbacb](https://gitee.com/swimly/ldesign-layout/commit/92fbacb2a9a061723c70d2410da75a763f0a742e)) - @swimly
|
|
48
|
+
- batch commit submodule changes ([fa38ca9](https://gitee.com/swimly/ldesign-layout/commit/fa38ca997fe9336fafec6d0fdd8eff2c4940edfe)) - @swimly
|
|
49
|
+
- set versions to 0.0.1 and pin @ldesign deps ([6656c50](https://gitee.com/swimly/ldesign-layout/commit/6656c50f4c8a112148932298ebe9cff5469009dc)) - @swimly
|
|
50
|
+
|
|
51
|
+
### 👥 Contributors
|
|
52
|
+
|
|
53
|
+
swimly
|
|
54
|
+
|
|
55
|
+
### 📊 Statistics
|
|
56
|
+
|
|
57
|
+
- Total Commits: **28**
|
|
58
|
+
- Contributors: **1**
|
|
59
|
+
|
|
3
60
|
## 1.0.0-alpha.0
|
|
4
61
|
|
|
5
62
|
- Added Vue 3 runtime, editor, grid, item, and material drag-source adapters.
|
package/README.md
CHANGED
|
@@ -1,75 +1,82 @@
|
|
|
1
|
-
# @composy/layout-vue
|
|
2
|
-
|
|
3
|
-
Vue 3 adapters for the document-first LDesign Layout packages.
|
|
4
|
-
|
|
5
|
-
```vue
|
|
6
|
-
<LGrid :document="document">
|
|
7
|
-
<template #item="{ item }">
|
|
8
|
-
<WidgetRenderer :type="item.type" :props="item.props" />
|
|
9
|
-
</template>
|
|
10
|
-
</LGrid>
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
传入 `materials` 后,插槽仍然拥有最高优先级;没有插槽时会按物料的 `vue`、Web Component 或 HTML
|
|
14
|
-
renderer descriptor 自动渲染:
|
|
15
|
-
|
|
16
|
-
```vue
|
|
17
|
-
<LGrid :document="document" :materials="materials" />
|
|
18
|
-
<LMaterialDragSource :editor="editor" :material="materials.get('analytics/metric')" />
|
|
19
|
-
|
|
20
|
-
<!-- 在自定义 grid-item 中复用同一套注册表解析 -->
|
|
21
|
-
<LMaterialRenderer
|
|
22
|
-
:item="item"
|
|
23
|
-
:materials="materials"
|
|
24
|
-
target="vue"
|
|
25
|
-
:breakpoint-id="breakpointId"
|
|
26
|
-
class="layout-item-content"
|
|
27
|
-
/>
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
物料定义可以使用 `category`、`keywords` 和 `size`
|
|
31
|
-
驱动物料面板的分类、搜索和宽高配置;拖入后编辑器会在所有断点补齐 `defaultLayout`,并继承
|
|
32
|
-
`constraints`。
|
|
33
|
-
|
|
34
|
-
The package exports `LGrid`, `LGridItem`, `LMaterialRenderer`, `LLayoutEditor`,
|
|
35
|
-
`LMaterialDragSource`, `LMetricCard`, `LTrendCard`, and `useLayoutEditor`. `LMetricCard` and
|
|
36
|
-
`LTrendCard` are small reference materials showing the Vue renderer contract; application packages
|
|
37
|
-
can register their own component objects in exactly the same way. Document updates are emitted only
|
|
38
|
-
after a committed editor transaction.
|
|
39
|
-
|
|
40
|
-
`LLayoutEditor` also accepts the optional `preview` object from the framework-neutral editor. Pass a
|
|
41
|
-
separate container to switch between the GridStack editor layer and CSS Grid preview while keeping
|
|
42
|
-
the document, selection, and active breakpoint:
|
|
43
|
-
|
|
44
|
-
```vue
|
|
45
|
-
<LLayoutEditor :document="document" :engine="engine" :preview="{ container: previewElement }" />
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## 工作台
|
|
49
|
-
|
|
50
|
-
`LLayoutWorkspace`
|
|
51
|
-
是可直接挂载的完整布局工作台,包含物料注册、搜索与分类筛选、全局开发目标切换(原生 Web Component /
|
|
52
|
-
Vue
|
|
53
|
-
3)、GridStack 拖拽编辑、断点与横竖屏、缩放平移、代码输出、高亮、复制下载和真实预览弹窗。工作台内部只通过公开的 core/editor/runtime/compiler 契约工作,应用只需提供可选的
|
|
54
|
-
`document` 与 `materials`:
|
|
55
|
-
|
|
56
|
-
```ts
|
|
57
|
-
import { LLayoutWorkspace } from '@composy/layout-vue'
|
|
58
|
-
import '@composy/layout-vue/style/workspace.css'
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
```vue
|
|
62
|
-
<LLayoutWorkspace v-model:document="document" :materials="materials" @change="handleLayoutChange" />
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
组件会在每次已提交的编辑事务后触发 `update:document` 与 `change`,因此可以直接使用
|
|
66
|
-
`v-model:document` 保存布局。
|
|
67
|
-
|
|
68
|
-
`LMaterialRenderer` 是物料渲染的唯一目标选择入口:`target="vue"` 使用注册表中
|
|
69
|
-
`renderers.vue.component` 的真实 Vue 组件,`target="webcomponent"` 使用
|
|
70
|
-
`renderers.webcomponent.tagName` 的自定义元素。它不会把 Vue 组件实例写入布局文档,适合在 `LGrid`
|
|
71
|
-
插槽、预览弹窗和第三方 grid-item 中复用。
|
|
72
|
-
|
|
73
|
-
右侧代码检查器只展示当前头部开发目标:原生目标是 HTML/CSS Grid 与 Web
|
|
74
|
-
Component 标签,Vue 目标是引用注册物料组件的 Vue SFC。两种输出都只使用 CSS
|
|
75
|
-
Grid 与注册物料 renderer,不包含 GridStack 运行时依赖;“预览”保留工作区上下文,“实时预览”打开同一文档的目标运行时弹窗。
|
|
1
|
+
# @composy/layout-vue
|
|
2
|
+
|
|
3
|
+
Vue 3 adapters for the document-first LDesign Layout packages.
|
|
4
|
+
|
|
5
|
+
```vue
|
|
6
|
+
<LGrid :document="document">
|
|
7
|
+
<template #item="{ item }">
|
|
8
|
+
<WidgetRenderer :type="item.type" :props="item.props" />
|
|
9
|
+
</template>
|
|
10
|
+
</LGrid>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
传入 `materials` 后,插槽仍然拥有最高优先级;没有插槽时会按物料的 `vue`、Web Component 或 HTML
|
|
14
|
+
renderer descriptor 自动渲染:
|
|
15
|
+
|
|
16
|
+
```vue
|
|
17
|
+
<LGrid :document="document" :materials="materials" />
|
|
18
|
+
<LMaterialDragSource :editor="editor" :material="materials.get('analytics/metric')" />
|
|
19
|
+
|
|
20
|
+
<!-- 在自定义 grid-item 中复用同一套注册表解析 -->
|
|
21
|
+
<LMaterialRenderer
|
|
22
|
+
:item="item"
|
|
23
|
+
:materials="materials"
|
|
24
|
+
target="vue"
|
|
25
|
+
:breakpoint-id="breakpointId"
|
|
26
|
+
class="layout-item-content"
|
|
27
|
+
/>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
物料定义可以使用 `category`、`keywords` 和 `size`
|
|
31
|
+
驱动物料面板的分类、搜索和宽高配置;拖入后编辑器会在所有断点补齐 `defaultLayout`,并继承
|
|
32
|
+
`constraints`。
|
|
33
|
+
|
|
34
|
+
The package exports `LGrid`, `LGridItem`, `LMaterialRenderer`, `LLayoutEditor`,
|
|
35
|
+
`LMaterialDragSource`, `LMetricCard`, `LTrendCard`, and `useLayoutEditor`. `LMetricCard` and
|
|
36
|
+
`LTrendCard` are small reference materials showing the Vue renderer contract; application packages
|
|
37
|
+
can register their own component objects in exactly the same way. Document updates are emitted only
|
|
38
|
+
after a committed editor transaction.
|
|
39
|
+
|
|
40
|
+
`LLayoutEditor` also accepts the optional `preview` object from the framework-neutral editor. Pass a
|
|
41
|
+
separate container to switch between the GridStack editor layer and CSS Grid preview while keeping
|
|
42
|
+
the document, selection, and active breakpoint:
|
|
43
|
+
|
|
44
|
+
```vue
|
|
45
|
+
<LLayoutEditor :document="document" :engine="engine" :preview="{ container: previewElement }" />
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 工作台
|
|
49
|
+
|
|
50
|
+
`LLayoutWorkspace`
|
|
51
|
+
是可直接挂载的完整布局工作台,包含物料注册、搜索与分类筛选、全局开发目标切换(原生 Web Component /
|
|
52
|
+
Vue
|
|
53
|
+
3)、GridStack 拖拽编辑、断点与横竖屏、缩放平移、代码输出、高亮、复制下载和真实预览弹窗。工作台内部只通过公开的 core/editor/runtime/compiler 契约工作,应用只需提供可选的
|
|
54
|
+
`document` 与 `materials`:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { LLayoutWorkspace } from '@composy/layout-vue'
|
|
58
|
+
import '@composy/layout-vue/style/workspace.css'
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```vue
|
|
62
|
+
<LLayoutWorkspace v-model:document="document" :materials="materials" @change="handleLayoutChange" />
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
组件会在每次已提交的编辑事务后触发 `update:document` 与 `change`,因此可以直接使用
|
|
66
|
+
`v-model:document` 保存布局。
|
|
67
|
+
|
|
68
|
+
`LMaterialRenderer` 是物料渲染的唯一目标选择入口:`target="vue"` 使用注册表中
|
|
69
|
+
`renderers.vue.component` 的真实 Vue 组件,`target="webcomponent"` 使用
|
|
70
|
+
`renderers.webcomponent.tagName` 的自定义元素。它不会把 Vue 组件实例写入布局文档,适合在 `LGrid`
|
|
71
|
+
插槽、预览弹窗和第三方 grid-item 中复用。
|
|
72
|
+
|
|
73
|
+
右侧代码检查器只展示当前头部开发目标:原生目标是 HTML/CSS Grid 与 Web
|
|
74
|
+
Component 标签,Vue 目标是引用注册物料组件的 Vue SFC。两种输出都只使用 CSS
|
|
75
|
+
Grid 与注册物料 renderer,不包含 GridStack 运行时依赖;“预览”保留工作区上下文,“实时预览”打开同一文档的目标运行时弹窗。
|
|
76
|
+
|
|
77
|
+
## Build outputs
|
|
78
|
+
|
|
79
|
+
Run `pnpm run build` from this package to build with `@composy/builder` and `rolldown`. The command
|
|
80
|
+
emits the standard `dist`, `es`, `esm`, and `lib` directories and then removes only CSS
|
|
81
|
+
`sourceMappingURL` comments whose referenced map file is missing. JavaScript source maps remain
|
|
82
|
+
enabled; the cleanup prevents browser warnings from the builder's preserved CSS module paths.
|
package/dist/index.css
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/* style/index.less */
|
|
2
2
|
|
|
3
|
-
/*# sourceMappingURL=src/style/index.less.map */
|
|
4
|
-
|
|
5
3
|
/* style/workspace.css */
|
|
6
4
|
:root {
|
|
7
5
|
color: #172033;
|
|
@@ -1390,6 +1388,15 @@ body > .ui-draggable-dragging[data-layout-material] {
|
|
|
1390
1388
|
flex: 1 0 auto;
|
|
1391
1389
|
}
|
|
1392
1390
|
|
|
1391
|
+
/* The editor keeps a native runtime container mounted for fast framework
|
|
1392
|
+
* switching. Vue mode renders the adapter grid in the same stage, so the
|
|
1393
|
+
* native container must stay out of layout flow until Web Component mode is
|
|
1394
|
+
* selected. */
|
|
1395
|
+
.runtime-preview-stage[data-preview-framework="vue"] > .runtime-preview-grid,
|
|
1396
|
+
.vanilla-runtime-stage[data-preview-framework="vue"] > .runtime-preview-grid {
|
|
1397
|
+
display: none !important;
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1393
1400
|
.layout-item-shell,
|
|
1394
1401
|
.layout-card {
|
|
1395
1402
|
position: relative;
|
|
@@ -2380,4 +2387,3 @@ body > .ui-draggable-dragging[data-layout-material] {
|
|
|
2380
2387
|
color: #c5ceff !important;
|
|
2381
2388
|
}
|
|
2382
2389
|
|
|
2383
|
-
/*# sourceMappingURL=src/style/workspace.css.map */
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ***********************************
|
|
3
3
|
* @composy/layout-vue v0.0.1 *
|
|
4
4
|
* Built with rollup *
|
|
5
|
-
* Build time: 2024-
|
|
5
|
+
* Build time: 2024-10-12 17:52:50 *
|
|
6
6
|
* Build mode: production *
|
|
7
7
|
* Minified: No *
|
|
8
8
|
* ***********************************
|
|
@@ -24,9 +24,16 @@
|
|
|
24
24
|
})(this, function(exports, vue, _composy_layout_runtime, _composy_layout_core, _composy_layout_editor, gridstack, gridstack_dist_gridstack_min_css, lucide, lucide_vue_next, _composy_layout_compiler, _composy_layout_gridstack) {
|
|
25
25
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
26
26
|
//#region src/components/material-renderer.ts
|
|
27
|
+
const registryCache = /* @__PURE__ */ new WeakMap();
|
|
27
28
|
function resolveRegistry(source) {
|
|
28
29
|
if (!source) return void 0;
|
|
29
|
-
if (Array.isArray(source))
|
|
30
|
+
if (Array.isArray(source)) {
|
|
31
|
+
const cached = registryCache.get(source);
|
|
32
|
+
if (cached) return cached;
|
|
33
|
+
const registry = (0, _composy_layout_core.createMaterialRegistry)(source);
|
|
34
|
+
registryCache.set(source, registry);
|
|
35
|
+
return registry;
|
|
36
|
+
}
|
|
30
37
|
return source;
|
|
31
38
|
}
|
|
32
39
|
function resolveMaterialDefinition(materials, type) {
|
|
@@ -102,7 +109,7 @@
|
|
|
102
109
|
}, breakpointId);
|
|
103
110
|
}
|
|
104
111
|
function sanitizeMarkup(value) {
|
|
105
|
-
return value.replace(/<script\b[^>]*>[\s\S]*?<\/script\s*>/gi, "").replace(/\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, "").replace(/\s+(?:href|src)\s*=\s*("|'
|
|
112
|
+
return value.replace(/<(?:script|style|iframe|object|embed|foreignObject)\b[^>]*>[\s\S]*?<\/(?:script|style|iframe|object|embed|foreignObject)\s*>/gi, "").replace(/<(?:script|style|iframe|object|embed|foreignObject)\b[^>]*>/gi, "").replace(/\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, "").replace(/\s+(?:href|src|xlink:href|formaction|srcdoc)\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, (match) => /javascript:|data:text\/html/i.test(match) ? "" : match);
|
|
106
113
|
}
|
|
107
114
|
//#endregion
|
|
108
115
|
//#region src/components/LGrid.ts
|
|
@@ -150,8 +157,8 @@
|
|
|
150
157
|
resize();
|
|
151
158
|
});
|
|
152
159
|
(0, vue.onBeforeUnmount)(() => observer?.disconnect());
|
|
153
|
-
(0, vue.watch)(() => props.breakpoint, (value) => {
|
|
154
|
-
activeBreakpoint.value = value ??
|
|
160
|
+
(0, vue.watch)(() => [props.breakpoint, props.document.defaultBreakpointId], ([value, defaultBreakpoint]) => {
|
|
161
|
+
activeBreakpoint.value = value ?? defaultBreakpoint;
|
|
155
162
|
});
|
|
156
163
|
expose({ getBreakpoint: () => activeBreakpoint.value });
|
|
157
164
|
return () => (0, vue.h)("div", {
|
|
@@ -210,7 +217,8 @@
|
|
|
210
217
|
return () => (0, vue.h)("div", {
|
|
211
218
|
class: "ldesign-layout-item",
|
|
212
219
|
"data-layout-item-id": props.item.id,
|
|
213
|
-
"data-layout-type": props.item.type
|
|
220
|
+
"data-layout-type": props.item.type,
|
|
221
|
+
style: (0, _composy_layout_runtime.resolveItemStyle)(props.item, props.breakpointId)
|
|
214
222
|
}, slots.default?.({
|
|
215
223
|
item: props.item,
|
|
216
224
|
placement: props.placement,
|
|
@@ -271,7 +279,7 @@
|
|
|
271
279
|
},
|
|
272
280
|
preview: Object,
|
|
273
281
|
materials: {
|
|
274
|
-
type: Object,
|
|
282
|
+
type: [Object, Array],
|
|
275
283
|
default: void 0
|
|
276
284
|
}
|
|
277
285
|
},
|
|
@@ -665,7 +673,7 @@
|
|
|
665
673
|
}
|
|
666
674
|
function formatCss(value) {
|
|
667
675
|
let depth = 0;
|
|
668
|
-
return value.replace(/\s*\{\s*/g, " {\n").replace(/\s*;\s*/g, ";\n").replace(/\s
|
|
676
|
+
return value.replace(/\s*\{\s*/g, " {\n").replace(/\s*;\s*/g, ";\n").replace(/\s*\}\s*/g, "\n}\n").split("\n").map((line) => line.trim()).filter(Boolean).map((line) => {
|
|
669
677
|
if (line.startsWith("}")) depth = Math.max(0, depth - 1);
|
|
670
678
|
const formatted = `${" ".repeat(depth)}${line}`;
|
|
671
679
|
if (line.endsWith("{")) depth += 1;
|
|
@@ -717,6 +725,9 @@
|
|
|
717
725
|
static get observedAttributes() {
|
|
718
726
|
return ["title", "value"];
|
|
719
727
|
}
|
|
728
|
+
get materialProps() {
|
|
729
|
+
return { ...this.props };
|
|
730
|
+
}
|
|
720
731
|
set materialProps(value) {
|
|
721
732
|
this.props = { ...value ?? {} };
|
|
722
733
|
this.render();
|
|
@@ -1280,8 +1291,8 @@ ${bindings}
|
|
|
1280
1291
|
code = code.replace(/(".*?"|'.*?'|`.*?`)/g, (match) => stash(match, "string"));
|
|
1281
1292
|
code = code.replace(/(\/\/[^\n]*|\/\*[\s\S]*?\*\/)/g, (match) => stash(match, "comment"));
|
|
1282
1293
|
code = code.replace(/(^|[;{\n]\s*)([A-Za-z_$][\w$-]*)(?=\s*:)/g, (_, prefix, name) => `${prefix}${stash(name, "property")}`);
|
|
1283
|
-
code = code.replace(/\b(import|from|const|let|function|return|export|as|type|class|extends|new|true|false|null|undefined)\b/g, (match) => stash(match, /^(true|false|null|undefined)$/.test(match) ? "constant" : "keyword"));
|
|
1284
|
-
code = code.replace(/(<\/?[A-Za-z][^&]
|
|
1294
|
+
code = code.replace(/\b(import|from|const|let|function|return|export|as|type|class|extends|new|true|false|null|undefined)\b/g, (match) => stash(match, /^(?:true|false|null|undefined)$/.test(match) ? "constant" : "keyword"));
|
|
1295
|
+
code = code.replace(/(<\/?[A-Za-z][^&]*>)/g, (match) => stash(match, "tag"));
|
|
1285
1296
|
let previous = "";
|
|
1286
1297
|
while (previous !== code && /__LDS_TOKEN_\d+__/.test(code)) {
|
|
1287
1298
|
previous = code;
|
|
@@ -2181,7 +2192,7 @@ ${bindings}
|
|
|
2181
2192
|
class: "custom-select__option",
|
|
2182
2193
|
type: "button",
|
|
2183
2194
|
"aria-selected": activeBreakpoint.value === breakpoint.id,
|
|
2184
|
-
"aria-label": breakpointLabel(breakpoint.id)
|
|
2195
|
+
"aria-label": `${breakpointLabel(breakpoint.id)} / ${breakpoint.columns} \u5217`,
|
|
2185
2196
|
onClick: ($event) => selectBreakpoint(breakpoint.id)
|
|
2186
2197
|
}, [
|
|
2187
2198
|
((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(breakpointIcons[breakpoint.id] ?? (0, vue.unref)(lucide_vue_next.Monitor)), {
|