@composy/layout-vue 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/CHANGELOG.md +6 -0
- package/LICENSE +21 -0
- package/README.md +75 -0
- package/dist/index.css +2383 -0
- package/dist/index.js +2665 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.css +1 -0
- package/dist/index.min.js +1 -0
- package/es/components/LGrid.d.ts +3 -0
- package/es/components/LGrid.d.ts.map +1 -0
- package/es/components/LGrid.js +91 -0
- package/es/components/LGrid.js.map +1 -0
- package/es/components/LGridItem.d.ts +52 -0
- package/es/components/LGridItem.d.ts.map +1 -0
- package/es/components/LGridItem.js +52 -0
- package/es/components/LGridItem.js.map +1 -0
- package/es/components/LLayoutEditor.d.ts +49 -0
- package/es/components/LLayoutEditor.d.ts.map +1 -0
- package/es/components/LLayoutEditor.js +81 -0
- package/es/components/LLayoutEditor.js.map +1 -0
- package/es/components/LLayoutWorkspace.js +17 -0
- package/es/components/LLayoutWorkspace.js.map +1 -0
- package/es/components/LLayoutWorkspace.vue_vue_type_script_setup_true_lang.js +2217 -0
- package/es/components/LLayoutWorkspace.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/es/components/LMaterialDragSource.d.ts +55 -0
- package/es/components/LMaterialDragSource.d.ts.map +1 -0
- package/es/components/LMaterialDragSource.js +92 -0
- package/es/components/LMaterialDragSource.js.map +1 -0
- package/es/components/LMaterialRenderer.d.ts +63 -0
- package/es/components/LMaterialRenderer.d.ts.map +1 -0
- package/es/components/LMaterialRenderer.js +48 -0
- package/es/components/LMaterialRenderer.js.map +1 -0
- package/es/components/LMetricCard.d.ts +29 -0
- package/es/components/LMetricCard.d.ts.map +1 -0
- package/es/components/LMetricCard.js +39 -0
- package/es/components/LMetricCard.js.map +1 -0
- package/es/components/LTrendCard.d.ts +17 -0
- package/es/components/LTrendCard.d.ts.map +1 -0
- package/es/components/LTrendCard.js +36 -0
- package/es/components/LTrendCard.js.map +1 -0
- package/es/components/index.d.ts +10 -0
- package/es/components/index.d.ts.map +1 -0
- package/es/components/index.js +19 -0
- package/es/components/material-renderer.d.ts +26 -0
- package/es/components/material-renderer.d.ts.map +1 -0
- package/es/components/material-renderer.js +96 -0
- package/es/components/material-renderer.js.map +1 -0
- package/es/composables/index.d.ts +2 -0
- package/es/composables/index.d.ts.map +1 -0
- package/es/composables/index.js +12 -0
- package/es/composables/useLayoutEditor.d.ts +3 -0
- package/es/composables/useLayoutEditor.d.ts.map +1 -0
- package/es/composables/useLayoutEditor.js +22 -0
- package/es/composables/useLayoutEditor.js.map +1 -0
- package/es/index.d.ts +7 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +22 -0
- package/es/style/css.js +1 -0
- package/es/style/index.js +1 -0
- package/es/style/index.less +1 -0
- package/es/style/workspace.css +2370 -0
- package/es/types.d.ts +26 -0
- package/es/types.d.ts.map +1 -0
- package/es/types.js +10 -0
- package/lib/components/LGrid.cjs +92 -0
- package/lib/components/LGrid.cjs.map +1 -0
- package/lib/components/LGrid.d.ts +3 -0
- package/lib/components/LGridItem.cjs +53 -0
- package/lib/components/LGridItem.cjs.map +1 -0
- package/lib/components/LGridItem.d.ts +52 -0
- package/lib/components/LLayoutEditor.cjs +82 -0
- package/lib/components/LLayoutEditor.cjs.map +1 -0
- package/lib/components/LLayoutEditor.d.ts +49 -0
- package/lib/components/LLayoutWorkspace.cjs +21 -0
- package/lib/components/LLayoutWorkspace.cjs.map +1 -0
- package/lib/components/LLayoutWorkspace.vue_vue_type_script_setup_true_lang.cjs +2217 -0
- package/lib/components/LLayoutWorkspace.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/lib/components/LMaterialDragSource.cjs +93 -0
- package/lib/components/LMaterialDragSource.cjs.map +1 -0
- package/lib/components/LMaterialDragSource.d.ts +55 -0
- package/lib/components/LMaterialRenderer.cjs +49 -0
- package/lib/components/LMaterialRenderer.cjs.map +1 -0
- package/lib/components/LMaterialRenderer.d.ts +63 -0
- package/lib/components/LMetricCard.cjs +40 -0
- package/lib/components/LMetricCard.cjs.map +1 -0
- package/lib/components/LMetricCard.d.ts +29 -0
- package/lib/components/LTrendCard.cjs +37 -0
- package/lib/components/LTrendCard.cjs.map +1 -0
- package/lib/components/LTrendCard.d.ts +17 -0
- package/lib/components/index.cjs +27 -0
- package/lib/components/index.d.ts +10 -0
- package/lib/components/material-renderer.cjs +99 -0
- package/lib/components/material-renderer.cjs.map +1 -0
- package/lib/components/material-renderer.d.ts +26 -0
- package/lib/composables/index.cjs +13 -0
- package/lib/composables/index.d.ts +2 -0
- package/lib/composables/useLayoutEditor.cjs +23 -0
- package/lib/composables/useLayoutEditor.cjs.map +1 -0
- package/lib/composables/useLayoutEditor.d.ts +3 -0
- package/lib/index.cjs +29 -0
- package/lib/index.d.ts +7 -0
- package/lib/package.json +3 -0
- package/lib/style/css.js +1 -0
- package/lib/style/index.css +2 -0
- package/lib/style/index.js +1 -0
- package/lib/style/workspace.css +2378 -0
- package/lib/types.cjs +11 -0
- package/lib/types.d.ts +26 -0
- package/package.json +117 -0
package/es/types.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { LayoutDocument, LayoutNode, LayoutPlacement, MaterialDefinition, MaterialRegistry } from '@composy/layout-core';
|
|
2
|
+
import type { LayoutEditor, LayoutEditorEngine, LayoutEditorOptions } from '@composy/layout-editor';
|
|
3
|
+
import type { LayoutRenderTarget } from './components/material-renderer';
|
|
4
|
+
export interface LayoutItemSlotContext {
|
|
5
|
+
item: LayoutNode;
|
|
6
|
+
placement: LayoutPlacement;
|
|
7
|
+
breakpointId: string;
|
|
8
|
+
}
|
|
9
|
+
export interface LGridProps {
|
|
10
|
+
document: LayoutDocument;
|
|
11
|
+
breakpoint?: string;
|
|
12
|
+
readonly?: boolean;
|
|
13
|
+
materials?: MaterialRegistry | readonly MaterialDefinition[];
|
|
14
|
+
target?: LayoutRenderTarget;
|
|
15
|
+
}
|
|
16
|
+
export interface LLayoutEditorProps {
|
|
17
|
+
document: LayoutDocument;
|
|
18
|
+
engine: LayoutEditorEngine;
|
|
19
|
+
mode?: 'edit' | 'preview' | 'readonly';
|
|
20
|
+
preview?: LayoutEditorOptions['preview'];
|
|
21
|
+
materials?: MaterialRegistry | readonly MaterialDefinition[];
|
|
22
|
+
}
|
|
23
|
+
export interface LLayoutEditorExpose {
|
|
24
|
+
editor: LayoutEditor;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAExE,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,eAAe,CAAA;IAC1B,YAAY,EAAE,MAAM,CAAA;CACrB;AACD,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,cAAc,CAAA;IACxB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,gBAAgB,GAAG,SAAS,kBAAkB,EAAE,CAAA;IAC5D,MAAM,CAAC,EAAE,kBAAkB,CAAA;CAC5B;AACD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,cAAc,CAAA;IACxB,MAAM,EAAE,kBAAkB,CAAA;IAC1B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAA;IACtC,OAAO,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAA;IACxC,SAAS,CAAC,EAAE,gBAAgB,GAAG,SAAS,kBAAkB,EAAE,CAAA;CAC7D;AACD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,YAAY,CAAA;CACrB"}
|
package/es/types.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/layout-vue v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:47:09 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
/*! End of @composy/layout-vue | Powered by @composy/builder */
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/layout-vue v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:47:09 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
11
|
+
const require_material_renderer = require("./material-renderer.cjs");
|
|
12
|
+
let vue = require("vue");
|
|
13
|
+
let _composy_layout_runtime = require("@composy/layout-runtime");
|
|
14
|
+
//#region src/components/LGrid.ts
|
|
15
|
+
const LGrid = (0, vue.defineComponent)({
|
|
16
|
+
name: "LGrid",
|
|
17
|
+
props: {
|
|
18
|
+
document: {
|
|
19
|
+
type: Object,
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
22
|
+
breakpoint: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: void 0
|
|
25
|
+
},
|
|
26
|
+
readonly: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false
|
|
29
|
+
},
|
|
30
|
+
materials: {
|
|
31
|
+
type: [Object, Array],
|
|
32
|
+
default: void 0
|
|
33
|
+
},
|
|
34
|
+
target: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: "vue"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
setup(props, { slots, expose }) {
|
|
40
|
+
const root = (0, vue.ref)();
|
|
41
|
+
const activeBreakpoint = (0, vue.ref)(props.breakpoint ?? props.document.defaultBreakpointId);
|
|
42
|
+
const resolved = (0, vue.computed)(() => props.document.breakpoints.find((bp) => bp.id === activeBreakpoint.value) ?? props.document.breakpoints[0]);
|
|
43
|
+
const gridStyle = (0, vue.computed)(() => (0, _composy_layout_runtime.resolveGridStyle)(props.document, resolved.value.id));
|
|
44
|
+
const resize = () => {
|
|
45
|
+
if (props.breakpoint || !root.value) return;
|
|
46
|
+
const width = root.value.getBoundingClientRect().width;
|
|
47
|
+
const match = props.document.breakpoints.find((bp) => (bp.minWidth === void 0 || width >= bp.minWidth) && (bp.maxWidth === void 0 || width < bp.maxWidth));
|
|
48
|
+
activeBreakpoint.value = match?.id ?? props.document.defaultBreakpointId;
|
|
49
|
+
};
|
|
50
|
+
let observer;
|
|
51
|
+
(0, vue.onMounted)(() => {
|
|
52
|
+
if (typeof ResizeObserver !== "undefined" && root.value) {
|
|
53
|
+
observer = new ResizeObserver(resize);
|
|
54
|
+
observer.observe(root.value);
|
|
55
|
+
}
|
|
56
|
+
resize();
|
|
57
|
+
});
|
|
58
|
+
(0, vue.onBeforeUnmount)(() => observer?.disconnect());
|
|
59
|
+
(0, vue.watch)(() => props.breakpoint, (value) => {
|
|
60
|
+
activeBreakpoint.value = value ?? props.document.defaultBreakpointId;
|
|
61
|
+
});
|
|
62
|
+
expose({ getBreakpoint: () => activeBreakpoint.value });
|
|
63
|
+
return () => (0, vue.h)("div", {
|
|
64
|
+
ref: root,
|
|
65
|
+
class: "ldesign-layout-grid",
|
|
66
|
+
style: gridStyle.value,
|
|
67
|
+
dir: gridStyle.value.direction
|
|
68
|
+
}, props.document.items.map((item) => {
|
|
69
|
+
const placement = item.layout[activeBreakpoint.value];
|
|
70
|
+
if (!placement || placement.hidden) return null;
|
|
71
|
+
return (0, vue.h)("div", {
|
|
72
|
+
class: "ldesign-layout-item",
|
|
73
|
+
"data-layout-item-id": item.id,
|
|
74
|
+
"data-layout-type": item.type,
|
|
75
|
+
style: (0, _composy_layout_runtime.resolveItemStyle)(item, activeBreakpoint.value),
|
|
76
|
+
tabindex: props.readonly ? void 0 : 0
|
|
77
|
+
}, slots.item?.({
|
|
78
|
+
item,
|
|
79
|
+
placement,
|
|
80
|
+
breakpointId: activeBreakpoint.value
|
|
81
|
+
}) ?? slots.default?.({
|
|
82
|
+
item,
|
|
83
|
+
placement,
|
|
84
|
+
breakpointId: activeBreakpoint.value
|
|
85
|
+
}) ?? require_material_renderer.renderMaterialForTarget(props.materials, item, props.target, placement, activeBreakpoint.value));
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
//#endregion
|
|
90
|
+
exports.LGrid = LGrid;
|
|
91
|
+
/*! End of @composy/layout-vue | Powered by @composy/builder */
|
|
92
|
+
//# sourceMappingURL=LGrid.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LGrid.cjs","names":[],"sources":["../../src/components/LGrid.ts"],"sourcesContent":["import {\n computed,\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n ref,\n type PropType,\n watch,\n} from 'vue'\nimport { resolveGridStyle, resolveItemStyle } from '@composy/layout-runtime'\nimport type { LGridProps } from '../types'\nimport {\n renderMaterialForTarget,\n type VueMaterialSource,\n} from './material-renderer'\n\nexport const LGrid = defineComponent<LGridProps>({\n name: 'LGrid',\n props: {\n document: { type: Object, required: true },\n breakpoint: { type: String, default: undefined },\n readonly: { type: Boolean, default: false },\n materials: {\n type: [Object, Array] as PropType<VueMaterialSource>,\n default: undefined,\n },\n target: { type: String, default: 'vue' },\n },\n setup(props, { slots, expose }) {\n const root = ref<HTMLElement>()\n const activeBreakpoint = ref(\n props.breakpoint ?? props.document.defaultBreakpointId\n )\n const resolved = computed(\n () =>\n props.document.breakpoints.find(\n bp => bp.id === activeBreakpoint.value\n ) ?? props.document.breakpoints[0]\n )\n const gridStyle = computed(() =>\n resolveGridStyle(props.document, resolved.value.id)\n )\n const resize = () => {\n if (props.breakpoint || !root.value) return\n const width = root.value.getBoundingClientRect().width\n const match = props.document.breakpoints.find(\n bp =>\n (bp.minWidth === undefined || width >= bp.minWidth) &&\n (bp.maxWidth === undefined || width < bp.maxWidth)\n )\n activeBreakpoint.value = match?.id ?? props.document.defaultBreakpointId\n }\n let observer: ResizeObserver | undefined\n onMounted(() => {\n if (typeof ResizeObserver !== 'undefined' && root.value) {\n observer = new ResizeObserver(resize)\n observer.observe(root.value)\n }\n resize()\n })\n onBeforeUnmount(() => observer?.disconnect())\n watch(\n () => props.breakpoint,\n value => {\n activeBreakpoint.value = value ?? props.document.defaultBreakpointId\n }\n )\n expose({ getBreakpoint: () => activeBreakpoint.value })\n return () =>\n h(\n 'div',\n {\n ref: root,\n class: 'ldesign-layout-grid',\n style: gridStyle.value,\n dir: gridStyle.value.direction,\n },\n props.document.items.map(item => {\n const placement = item.layout[activeBreakpoint.value]\n if (!placement || placement.hidden) return null\n return h(\n 'div',\n {\n class: 'ldesign-layout-item',\n 'data-layout-item-id': item.id,\n 'data-layout-type': item.type,\n style: resolveItemStyle(item, activeBreakpoint.value),\n tabindex: props.readonly ? undefined : 0,\n },\n slots.item?.({\n item,\n placement,\n breakpointId: activeBreakpoint.value,\n }) ??\n slots.default?.({\n item,\n placement,\n breakpointId: activeBreakpoint.value,\n }) ??\n renderMaterialForTarget(\n props.materials as VueMaterialSource,\n item,\n props.target as 'vue' | 'webcomponent',\n placement,\n activeBreakpoint.value\n )\n )\n })\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;AAiBO,MAAM,SAAA,GAAA,IAAA,gBAAA,CAAoC;CAC/C,MAAM;CACN,OAAO;EACL,UAAU;GAAE,MAAM;GAAQ,UAAU;EAAK;EACzC,YAAY;GAAE,MAAM;GAA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AiB,MAAM,CAAC;EACtD,cAAA,GAAA,IAAA,EAAA,CAEI,OACA;GACE,KAAK;GACL,OAAO;GACP,OAAO,UAAU;GACjB,KAAK,UAAU,MAAM;EACvB,GACA,MAAM,SAAS,MAAM,KAAI,SAAQ;GAC/B,MAAM,YAAY,KAAK,OAAO,iBAAiB;GAC/C,IAAI,CAAC,aAAa,UAAU,QAAQ,OAAO;GAC3C,QAAA,GAAA,IAAA,EAAA,CACE,OACA;IACE,OAAO;IACP,uBAAuB,KAAK;IAC5B,oBAAoB,KAAK;IACzB,QAAA,GAAA,wBAAA,iBAAA,CAAwB,MAAM,iBAAiB,KAAK;IACpD,UAAU,MAAM,WAAW,KAAA,IAAY;GACzC,GACA,MAAM,OAAO;IACX;IACA;IACA,cAAc,iBAAiB;GACjC,CAAC,KACC,MAAM,UAAU;IACd;IACA;IACA,cAAc,iBAAiB;GACjC,CAAC,KACD,0BAAA,wBACE,MAAM,WACN,MACA,MAAM,QACN,WACA,iBAAiB,KACnB,CACJ;EACF,CAAC,CACH;CACJ;AACF,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { LGridProps } from '../types';
|
|
2
|
+
export declare const LGrid: import("vue").DefineComponent<LGridProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<LGridProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
//# sourceMappingURL=LGrid.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/layout-vue v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:47:09 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
11
|
+
const require_material_renderer = require("./material-renderer.cjs");
|
|
12
|
+
let vue = require("vue");
|
|
13
|
+
//#region src/components/LGridItem.ts
|
|
14
|
+
const LGridItem = (0, vue.defineComponent)({
|
|
15
|
+
name: "LGridItem",
|
|
16
|
+
props: {
|
|
17
|
+
item: {
|
|
18
|
+
type: Object,
|
|
19
|
+
required: true
|
|
20
|
+
},
|
|
21
|
+
placement: {
|
|
22
|
+
type: Object,
|
|
23
|
+
required: true
|
|
24
|
+
},
|
|
25
|
+
breakpointId: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: true
|
|
28
|
+
},
|
|
29
|
+
materials: {
|
|
30
|
+
type: [Object, Array],
|
|
31
|
+
default: void 0
|
|
32
|
+
},
|
|
33
|
+
target: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: "vue"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
setup(props, { slots }) {
|
|
39
|
+
return () => (0, vue.h)("div", {
|
|
40
|
+
class: "ldesign-layout-item",
|
|
41
|
+
"data-layout-item-id": props.item.id,
|
|
42
|
+
"data-layout-type": props.item.type
|
|
43
|
+
}, slots.default?.({
|
|
44
|
+
item: props.item,
|
|
45
|
+
placement: props.placement,
|
|
46
|
+
breakpointId: props.breakpointId
|
|
47
|
+
}) ?? require_material_renderer.renderMaterialForTarget(props.materials, props.item, props.target, props.placement, props.breakpointId));
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
//#endregion
|
|
51
|
+
exports.LGridItem = LGridItem;
|
|
52
|
+
/*! End of @composy/layout-vue | Powered by @composy/builder */
|
|
53
|
+
//# sourceMappingURL=LGridItem.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LGridItem.cjs","names":[],"sources":["../../src/components/LGridItem.ts"],"sourcesContent":["import { defineComponent, h, type PropType } from 'vue'\nimport type { LayoutNode, LayoutPlacement } from '@composy/layout-core'\nimport {\n renderMaterialForTarget,\n type VueMaterialSource,\n} from './material-renderer'\n\nexport const LGridItem = defineComponent({\n name: 'LGridItem',\n props: {\n item: { type: Object as () => LayoutNode, required: true },\n placement: { type: Object as () => LayoutPlacement, required: true },\n breakpointId: { type: String, required: true },\n materials: {\n type: [Object, Array] as PropType<VueMaterialSource>,\n default: undefined,\n },\n target: { type: String, default: 'vue' },\n },\n setup(props, { slots }) {\n return () =>\n h(\n 'div',\n {\n class: 'ldesign-layout-item',\n 'data-layout-item-id': props.item.id,\n 'data-layout-type': props.item.type,\n },\n slots.default?.({\n item: props.item,\n placement: props.placement,\n breakpointId: props.breakpointId,\n }) ??\n renderMaterialForTarget(\n props.materials as VueMaterialSource,\n props.item,\n props.target as 'vue' | 'webcomponent',\n props.placement,\n props.breakpointId\n )\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;AAOO,MAAM,aAAA,GAAA,IAAA,gBAAA,CAA4B;CACvC,MAAM;CACN,OAAO;EACL,MAAM;GAAE,MAAM;GAA4B,UAAU;EAAK;EACzD,WAAW;GAAE,MAAM;GAAiC,UAAU;EAAK;EACnE,cAAc;GAAE,MAAM;GAAQ,UAAU;EAAK;EAC7C,WAAW;GACT,MAAM,CAAC,QAAQ,KAAK;GACpB,SAAS,KAAA;EACX;EACA,QAAQ;GAAE,MAAM;GAAQ,SAAS;EAAM;CACzC;CACA,MAAM,OAAO,EAAE,SAAS;EACtB,cAAA,GAAA,IAAA,EAAA,CAEI,OACA;GACE,OAAO;GACP,uBAAuB,MAAM,KAAK;GAClC,oBAAoB,MAAM,KAAK;EACjC,GACA,MAAM,UAAU;GACd,MAAM,MAAM;GACZ,WAAW,MAAM;GACjB,cAAc,MAAM;EACtB,CAAC,KACC,0BAAA,wBACE,MAAM,WACN,MAAM,MACN,MAAM,QACN,MAAM,WACN,MAAM,YACR,CACJ;CACJ;AACF,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import type { LayoutNode, LayoutPlacement } from '@composy/layout-core';
|
|
3
|
+
import { type VueMaterialSource } from './material-renderer';
|
|
4
|
+
export declare const LGridItem: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
item: {
|
|
6
|
+
type: () => LayoutNode;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
placement: {
|
|
10
|
+
type: () => LayoutPlacement;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
breakpointId: {
|
|
14
|
+
type: StringConstructor;
|
|
15
|
+
required: true;
|
|
16
|
+
};
|
|
17
|
+
materials: {
|
|
18
|
+
type: PropType<VueMaterialSource>;
|
|
19
|
+
default: any;
|
|
20
|
+
};
|
|
21
|
+
target: {
|
|
22
|
+
type: StringConstructor;
|
|
23
|
+
default: string;
|
|
24
|
+
};
|
|
25
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
28
|
+
item: {
|
|
29
|
+
type: () => LayoutNode;
|
|
30
|
+
required: true;
|
|
31
|
+
};
|
|
32
|
+
placement: {
|
|
33
|
+
type: () => LayoutPlacement;
|
|
34
|
+
required: true;
|
|
35
|
+
};
|
|
36
|
+
breakpointId: {
|
|
37
|
+
type: StringConstructor;
|
|
38
|
+
required: true;
|
|
39
|
+
};
|
|
40
|
+
materials: {
|
|
41
|
+
type: PropType<VueMaterialSource>;
|
|
42
|
+
default: any;
|
|
43
|
+
};
|
|
44
|
+
target: {
|
|
45
|
+
type: StringConstructor;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
48
|
+
}>> & Readonly<{}>, {
|
|
49
|
+
materials: VueMaterialSource;
|
|
50
|
+
target: string;
|
|
51
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
52
|
+
//# sourceMappingURL=LGridItem.d.ts.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/layout-vue v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:47:09 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
11
|
+
let vue = require("vue");
|
|
12
|
+
let _composy_layout_editor = require("@composy/layout-editor");
|
|
13
|
+
//#region src/components/LLayoutEditor.ts
|
|
14
|
+
const LLayoutEditor = (0, vue.defineComponent)({
|
|
15
|
+
name: "LLayoutEditor",
|
|
16
|
+
props: {
|
|
17
|
+
document: {
|
|
18
|
+
type: Object,
|
|
19
|
+
required: true
|
|
20
|
+
},
|
|
21
|
+
engine: {
|
|
22
|
+
type: Object,
|
|
23
|
+
required: true
|
|
24
|
+
},
|
|
25
|
+
mode: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: "edit"
|
|
28
|
+
},
|
|
29
|
+
preview: Object,
|
|
30
|
+
materials: {
|
|
31
|
+
type: Object,
|
|
32
|
+
default: void 0
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
emits: [
|
|
36
|
+
"update:document",
|
|
37
|
+
"change",
|
|
38
|
+
"ready"
|
|
39
|
+
],
|
|
40
|
+
setup(props, { slots, emit, expose }) {
|
|
41
|
+
const editor = (0, vue.shallowRef)((0, _composy_layout_editor.createLayoutEditor)({
|
|
42
|
+
document: props.document,
|
|
43
|
+
engine: props.engine,
|
|
44
|
+
materials: props.materials,
|
|
45
|
+
preview: props.preview
|
|
46
|
+
}));
|
|
47
|
+
let lastEmittedDocument = JSON.stringify(props.document);
|
|
48
|
+
(0, vue.onMounted)(() => {
|
|
49
|
+
editor.value.on("document:change", (event) => {
|
|
50
|
+
lastEmittedDocument = JSON.stringify(event.document);
|
|
51
|
+
emit("update:document", event.document);
|
|
52
|
+
emit("change", event);
|
|
53
|
+
});
|
|
54
|
+
editor.value.mount();
|
|
55
|
+
editor.value.setMode(props.mode);
|
|
56
|
+
emit("ready", editor.value);
|
|
57
|
+
});
|
|
58
|
+
(0, vue.watch)(() => props.document, (value) => {
|
|
59
|
+
const next = JSON.stringify(value);
|
|
60
|
+
if (next !== lastEmittedDocument) {
|
|
61
|
+
editor.value.load(value);
|
|
62
|
+
lastEmittedDocument = next;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
(0, vue.watch)(() => props.mode, (value) => editor.value.setMode(value));
|
|
66
|
+
const onKeydown = (event) => {
|
|
67
|
+
editor.value.handleKeyboard(event);
|
|
68
|
+
};
|
|
69
|
+
(0, vue.onBeforeUnmount)(() => editor.value.destroy());
|
|
70
|
+
expose({ editor });
|
|
71
|
+
return () => (0, vue.h)("div", {
|
|
72
|
+
class: "ldesign-layout-editor",
|
|
73
|
+
"data-layout-mode": props.mode,
|
|
74
|
+
"aria-keyshortcuts": "ArrowLeft ArrowRight ArrowUp ArrowDown Delete Control+C Control+V Control+X Control+D",
|
|
75
|
+
onKeydown
|
|
76
|
+
}, slots.default?.({ editor: editor.value }));
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
//#endregion
|
|
80
|
+
exports.LLayoutEditor = LLayoutEditor;
|
|
81
|
+
/*! End of @composy/layout-vue | Powered by @composy/builder */
|
|
82
|
+
//# sourceMappingURL=LLayoutEditor.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LLayoutEditor.cjs","names":[],"sources":["../../src/components/LLayoutEditor.ts"],"sourcesContent":["import {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n shallowRef,\n watch,\n} from 'vue'\nimport { createLayoutEditor } from '@composy/layout-editor'\nimport type {\n LayoutDocument,\n MaterialDefinition,\n MaterialRegistry,\n} from '@composy/layout-core'\nimport type {\n LayoutEditorEngine,\n LayoutEditorOptions,\n} from '@composy/layout-editor'\n\nexport const LLayoutEditor = defineComponent({\n name: 'LLayoutEditor',\n props: {\n document: { type: Object as () => LayoutDocument, required: true },\n engine: { type: Object as () => LayoutEditorEngine, required: true },\n mode: {\n type: String as () => 'edit' | 'preview' | 'readonly',\n default: 'edit',\n },\n preview: Object as () => LayoutEditorOptions['preview'],\n materials: { type: Object, default: undefined },\n },\n emits: ['update:document', 'change', 'ready'],\n setup(props, { slots, emit, expose }) {\n const editor = shallowRef(\n createLayoutEditor({\n document: props.document,\n engine: props.engine,\n materials: props.materials as\n MaterialRegistry | readonly MaterialDefinition[] | undefined,\n preview: props.preview,\n })\n )\n let lastEmittedDocument = JSON.stringify(props.document)\n onMounted(() => {\n editor.value.on('document:change', event => {\n lastEmittedDocument = JSON.stringify(event.document)\n emit('update:document', event.document)\n emit('change', event)\n })\n editor.value.mount()\n editor.value.setMode(props.mode)\n emit('ready', editor.value)\n })\n watch(\n () => props.document,\n value => {\n const next = JSON.stringify(value)\n if (next !== lastEmittedDocument) {\n editor.value.load(value)\n lastEmittedDocument = next\n }\n }\n )\n watch(\n () => props.mode,\n value => editor.value.setMode(value)\n )\n const onKeydown = (event: KeyboardEvent) => {\n editor.value.handleKeyboard(event)\n }\n onBeforeUnmount(() => editor.value.destroy())\n expose({ editor })\n return () =>\n h(\n 'div',\n {\n class: 'ldesign-layout-editor',\n 'data-layout-mode': props.mode,\n 'aria-keyshortcuts':\n 'ArrowLeft ArrowRight ArrowUp ArrowDown Delete Control+C Control+V Control+X Control+D',\n onKeydown,\n },\n slots.default?.({ editor: editor.value })\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;AAmBO,MAAM,iBAAA,GAAA,IAAA,gBAAA,CAAgC;CAC3C,MAAM;CACN,OAAO;EACL,UAAU;GAAE,MAAM;GAAgC,UAAU;EAAK;EACjE,QAAQ;GAAE,MAAM;GAAoC,UAAU;EAAK;EACnE,MAAM;GACJ,MAAM;GACN,SAAS;EACX;EACA,SAAS;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|
|
|
1
|
+
import type { LayoutDocument } from '@composy/layout-core';
|
|
2
|
+
import type { LayoutEditorEngine, LayoutEditorOptions } from '@composy/layout-editor';
|
|
3
|
+
export declare const LLayoutEditor: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
document: {
|
|
5
|
+
type: () => LayoutDocument;
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
engine: {
|
|
9
|
+
type: () => LayoutEditorEngine;
|
|
10
|
+
required: true;
|
|
11
|
+
};
|
|
12
|
+
mode: {
|
|
13
|
+
type: () => "edit" | "preview" | "readonly";
|
|
14
|
+
default: string;
|
|
15
|
+
};
|
|
16
|
+
preview: () => LayoutEditorOptions["preview"];
|
|
17
|
+
materials: {
|
|
18
|
+
type: ObjectConstructor;
|
|
19
|
+
default: any;
|
|
20
|
+
};
|
|
21
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:document" | "ready")[], "change" | "update:document" | "ready", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
24
|
+
document: {
|
|
25
|
+
type: () => LayoutDocument;
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
28
|
+
engine: {
|
|
29
|
+
type: () => LayoutEditorEngine;
|
|
30
|
+
required: true;
|
|
31
|
+
};
|
|
32
|
+
mode: {
|
|
33
|
+
type: () => "edit" | "preview" | "readonly";
|
|
34
|
+
default: string;
|
|
35
|
+
};
|
|
36
|
+
preview: () => LayoutEditorOptions["preview"];
|
|
37
|
+
materials: {
|
|
38
|
+
type: ObjectConstructor;
|
|
39
|
+
default: any;
|
|
40
|
+
};
|
|
41
|
+
}>> & Readonly<{
|
|
42
|
+
onChange?: (...args: any[]) => any;
|
|
43
|
+
"onUpdate:document"?: (...args: any[]) => any;
|
|
44
|
+
onReady?: (...args: any[]) => any;
|
|
45
|
+
}>, {
|
|
46
|
+
mode: "edit" | "preview" | "readonly";
|
|
47
|
+
materials: Record<string, any>;
|
|
48
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
49
|
+
//# sourceMappingURL=LLayoutEditor.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/layout-vue v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:47:09 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperties(exports, {
|
|
11
|
+
__esModule: { value: true },
|
|
12
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
13
|
+
});
|
|
14
|
+
const require_LLayoutWorkspace_vue_vue_type_script_setup_true_lang = require("./LLayoutWorkspace.vue_vue_type_script_setup_true_lang.cjs");
|
|
15
|
+
//#region src/components/LLayoutWorkspace.vue
|
|
16
|
+
require_LLayoutWorkspace_vue_vue_type_script_setup_true_lang.default.__file = "src/components/LLayoutWorkspace.vue";
|
|
17
|
+
var LLayoutWorkspace_default = require_LLayoutWorkspace_vue_vue_type_script_setup_true_lang.default;
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.default = LLayoutWorkspace_default;
|
|
20
|
+
/*! End of @composy/layout-vue | Powered by @composy/builder */
|
|
21
|
+
//# sourceMappingURL=LLayoutWorkspace.cjs.map
|