@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.
Files changed (109) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE +21 -0
  3. package/README.md +75 -0
  4. package/dist/index.css +2383 -0
  5. package/dist/index.js +2665 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/index.min.css +1 -0
  8. package/dist/index.min.js +1 -0
  9. package/es/components/LGrid.d.ts +3 -0
  10. package/es/components/LGrid.d.ts.map +1 -0
  11. package/es/components/LGrid.js +91 -0
  12. package/es/components/LGrid.js.map +1 -0
  13. package/es/components/LGridItem.d.ts +52 -0
  14. package/es/components/LGridItem.d.ts.map +1 -0
  15. package/es/components/LGridItem.js +52 -0
  16. package/es/components/LGridItem.js.map +1 -0
  17. package/es/components/LLayoutEditor.d.ts +49 -0
  18. package/es/components/LLayoutEditor.d.ts.map +1 -0
  19. package/es/components/LLayoutEditor.js +81 -0
  20. package/es/components/LLayoutEditor.js.map +1 -0
  21. package/es/components/LLayoutWorkspace.js +17 -0
  22. package/es/components/LLayoutWorkspace.js.map +1 -0
  23. package/es/components/LLayoutWorkspace.vue_vue_type_script_setup_true_lang.js +2217 -0
  24. package/es/components/LLayoutWorkspace.vue_vue_type_script_setup_true_lang.js.map +1 -0
  25. package/es/components/LMaterialDragSource.d.ts +55 -0
  26. package/es/components/LMaterialDragSource.d.ts.map +1 -0
  27. package/es/components/LMaterialDragSource.js +92 -0
  28. package/es/components/LMaterialDragSource.js.map +1 -0
  29. package/es/components/LMaterialRenderer.d.ts +63 -0
  30. package/es/components/LMaterialRenderer.d.ts.map +1 -0
  31. package/es/components/LMaterialRenderer.js +48 -0
  32. package/es/components/LMaterialRenderer.js.map +1 -0
  33. package/es/components/LMetricCard.d.ts +29 -0
  34. package/es/components/LMetricCard.d.ts.map +1 -0
  35. package/es/components/LMetricCard.js +39 -0
  36. package/es/components/LMetricCard.js.map +1 -0
  37. package/es/components/LTrendCard.d.ts +17 -0
  38. package/es/components/LTrendCard.d.ts.map +1 -0
  39. package/es/components/LTrendCard.js +36 -0
  40. package/es/components/LTrendCard.js.map +1 -0
  41. package/es/components/index.d.ts +10 -0
  42. package/es/components/index.d.ts.map +1 -0
  43. package/es/components/index.js +19 -0
  44. package/es/components/material-renderer.d.ts +26 -0
  45. package/es/components/material-renderer.d.ts.map +1 -0
  46. package/es/components/material-renderer.js +96 -0
  47. package/es/components/material-renderer.js.map +1 -0
  48. package/es/composables/index.d.ts +2 -0
  49. package/es/composables/index.d.ts.map +1 -0
  50. package/es/composables/index.js +12 -0
  51. package/es/composables/useLayoutEditor.d.ts +3 -0
  52. package/es/composables/useLayoutEditor.d.ts.map +1 -0
  53. package/es/composables/useLayoutEditor.js +22 -0
  54. package/es/composables/useLayoutEditor.js.map +1 -0
  55. package/es/index.d.ts +7 -0
  56. package/es/index.d.ts.map +1 -0
  57. package/es/index.js +22 -0
  58. package/es/style/css.js +1 -0
  59. package/es/style/index.js +1 -0
  60. package/es/style/index.less +1 -0
  61. package/es/style/workspace.css +2370 -0
  62. package/es/types.d.ts +26 -0
  63. package/es/types.d.ts.map +1 -0
  64. package/es/types.js +10 -0
  65. package/lib/components/LGrid.cjs +92 -0
  66. package/lib/components/LGrid.cjs.map +1 -0
  67. package/lib/components/LGrid.d.ts +3 -0
  68. package/lib/components/LGridItem.cjs +53 -0
  69. package/lib/components/LGridItem.cjs.map +1 -0
  70. package/lib/components/LGridItem.d.ts +52 -0
  71. package/lib/components/LLayoutEditor.cjs +82 -0
  72. package/lib/components/LLayoutEditor.cjs.map +1 -0
  73. package/lib/components/LLayoutEditor.d.ts +49 -0
  74. package/lib/components/LLayoutWorkspace.cjs +21 -0
  75. package/lib/components/LLayoutWorkspace.cjs.map +1 -0
  76. package/lib/components/LLayoutWorkspace.vue_vue_type_script_setup_true_lang.cjs +2217 -0
  77. package/lib/components/LLayoutWorkspace.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
  78. package/lib/components/LMaterialDragSource.cjs +93 -0
  79. package/lib/components/LMaterialDragSource.cjs.map +1 -0
  80. package/lib/components/LMaterialDragSource.d.ts +55 -0
  81. package/lib/components/LMaterialRenderer.cjs +49 -0
  82. package/lib/components/LMaterialRenderer.cjs.map +1 -0
  83. package/lib/components/LMaterialRenderer.d.ts +63 -0
  84. package/lib/components/LMetricCard.cjs +40 -0
  85. package/lib/components/LMetricCard.cjs.map +1 -0
  86. package/lib/components/LMetricCard.d.ts +29 -0
  87. package/lib/components/LTrendCard.cjs +37 -0
  88. package/lib/components/LTrendCard.cjs.map +1 -0
  89. package/lib/components/LTrendCard.d.ts +17 -0
  90. package/lib/components/index.cjs +27 -0
  91. package/lib/components/index.d.ts +10 -0
  92. package/lib/components/material-renderer.cjs +99 -0
  93. package/lib/components/material-renderer.cjs.map +1 -0
  94. package/lib/components/material-renderer.d.ts +26 -0
  95. package/lib/composables/index.cjs +13 -0
  96. package/lib/composables/index.d.ts +2 -0
  97. package/lib/composables/useLayoutEditor.cjs +23 -0
  98. package/lib/composables/useLayoutEditor.cjs.map +1 -0
  99. package/lib/composables/useLayoutEditor.d.ts +3 -0
  100. package/lib/index.cjs +29 -0
  101. package/lib/index.d.ts +7 -0
  102. package/lib/package.json +3 -0
  103. package/lib/style/css.js +1 -0
  104. package/lib/style/index.css +2 -0
  105. package/lib/style/index.js +1 -0
  106. package/lib/style/workspace.css +2378 -0
  107. package/lib/types.cjs +11 -0
  108. package/lib/types.d.ts +26 -0
  109. package/package.json +117 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LMaterialRenderer.js","names":[],"sources":["../../src/components/LMaterialRenderer.ts"],"sourcesContent":["import { defineComponent, h, type PropType } from 'vue'\nimport type { LayoutNode, LayoutPlacement } from '@composy/layout-core'\nimport {\n renderMaterialForTarget,\n type LayoutRenderTarget,\n type VueMaterialSource,\n} from './material-renderer'\n\n/**\n * A target-aware renderer for one registered layout material.\n *\n * `LGrid` owns the placement shell; this component owns the renderer lookup.\n * Consumers can therefore use the same item renderer in an editor, a preview,\n * a modal or their own grid implementation without duplicating framework\n * branching logic.\n */\nexport const LMaterialRenderer = defineComponent({\n name: 'LMaterialRenderer',\n props: {\n item: { type: Object as PropType<LayoutNode>, required: true },\n materials: {\n type: [Object, Array] as PropType<VueMaterialSource>,\n default: undefined,\n },\n target: {\n type: String as PropType<LayoutRenderTarget>,\n default: 'vue',\n },\n placement: {\n type: Object as PropType<LayoutPlacement>,\n default: undefined,\n },\n breakpointId: { type: String, default: 'desktop' },\n },\n setup(props, { attrs }) {\n return () => {\n const rendered = renderMaterialForTarget(\n props.materials,\n props.item,\n props.target,\n props.placement,\n props.breakpointId\n )\n if (!rendered) return null\n return h(rendered, attrs)\n }\n },\n})\n\nexport type { LayoutRenderTarget }\n"],"mappings":";;;;;;;;;;;;AAgBO,MAAM,oBAAoB,gBAAgB;CAC/C,MAAM;CACN,OAAO;EACL,MAAM;GAAE,MAAM;GAAgC,UAAU;EAAK;EAC7D,WAAW;GACT,MAAM,CAAC,QAAQ,KAAK;GACpB,SAAS,KAAA;EACX;EACA,QAAQ;GACN,MAAM;GACN,SAAS;EACX;EACA,WAAW;GACT,MAAM;GACN,SAAS,KAAA;EACX;EACA,cAAc;GAAE,MAAM;GAAQ,SAAS;EAAU;CACnD;CACA,MAAM,OAAO,EAAE,SAAS;EACtB,aAAa;GACX,MAAM,WAAW,wBACf,MAAM,WACN,MAAM,MACN,MAAM,QACN,MAAM,WACN,MAAM,YACR;GACA,IAAI,CAAC,UAAU,OAAO;GACtB,OAAO,EAAE,UAAU,KAAK;EAC1B;CACF;AACF,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Reference Vue material used by the layout examples and as a small,
3
+ * framework-native registration contract for consumers.
4
+ */
5
+ export declare const LMetricCard: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
6
+ title: {
7
+ type: StringConstructor;
8
+ default: string;
9
+ };
10
+ value: {
11
+ type: (StringConstructor | NumberConstructor)[];
12
+ default: any;
13
+ };
14
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
15
+ [key: string]: any;
16
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
17
+ title: {
18
+ type: StringConstructor;
19
+ default: string;
20
+ };
21
+ value: {
22
+ type: (StringConstructor | NumberConstructor)[];
23
+ default: any;
24
+ };
25
+ }>> & Readonly<{}>, {
26
+ title: string;
27
+ value: string | number;
28
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
29
+ //# sourceMappingURL=LMetricCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LMetricCard.d.ts","sourceRoot":"","sources":["../../src/components/LMetricCard.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;4EA2BtB,CAAA"}
@@ -0,0 +1,39 @@
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
+ import { defineComponent, h } from "vue";
11
+ //#region src/components/LMetricCard.ts
12
+ const LMetricCard = defineComponent({
13
+ name: "LMetricCard",
14
+ props: {
15
+ title: {
16
+ type: String,
17
+ default: "数据指标"
18
+ },
19
+ value: {
20
+ type: [String, Number],
21
+ default: void 0
22
+ }
23
+ },
24
+ setup(props) {
25
+ return () => h("article", {
26
+ class: "layout-card",
27
+ "data-layout-card": ""
28
+ }, [
29
+ h("div", { class: "layout-card__meta" }, [h("span", { class: "layout-card__type" }, "数据指标"), h("span", { class: "layout-card__status" }, "已配置")]),
30
+ h("h3", { class: "layout-card__title" }, props.title),
31
+ props.value === void 0 ? null : h("strong", { class: "layout-card__value" }, Number(props.value).toLocaleString("zh-CN")),
32
+ h("div", { class: "layout-card__footer" }, [h("span", null, "实时数据"), h("span", { class: "layout-card__spark" }, "趋势稳定")])
33
+ ]);
34
+ }
35
+ });
36
+ //#endregion
37
+ export { LMetricCard };
38
+ /*! End of @composy/layout-vue | Powered by @composy/builder */
39
+ //# sourceMappingURL=LMetricCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LMetricCard.js","names":[],"sources":["../../src/components/LMetricCard.ts"],"sourcesContent":["import { defineComponent, h } from 'vue'\n\n/**\n * Reference Vue material used by the layout examples and as a small,\n * framework-native registration contract for consumers.\n */\nexport const LMetricCard = defineComponent({\n name: 'LMetricCard',\n props: {\n title: { type: String, default: '数据指标' },\n value: { type: [String, Number], default: undefined },\n },\n setup(props) {\n return () =>\n h('article', { class: 'layout-card', 'data-layout-card': '' }, [\n h('div', { class: 'layout-card__meta' }, [\n h('span', { class: 'layout-card__type' }, '数据指标'),\n h('span', { class: 'layout-card__status' }, '已配置'),\n ]),\n h('h3', { class: 'layout-card__title' }, props.title),\n props.value === undefined\n ? null\n : h(\n 'strong',\n { class: 'layout-card__value' },\n Number(props.value).toLocaleString('zh-CN')\n ),\n h('div', { class: 'layout-card__footer' }, [\n h('span', null, '实时数据'),\n h('span', { class: 'layout-card__spark' }, '趋势稳定'),\n ]),\n ])\n },\n})\n"],"mappings":";;;;;;;;;;;AAMO,MAAM,cAAc,gBAAgB;CACzC,MAAM;CACN,OAAO;EACL,OAAO;GAAE,MAAM;GAAQ,SAAS;EAAO;EACvC,OAAO;GAAE,MAAM,CAAC,QAAQ,MAAM;GAAG,SAAS,KAAA;EAAU;CACtD;CACA,MAAM,OAAO;EACX,aACE,EAAE,WAAW;GAAE,OAAO;GAAe,oBAAoB;EAAG,GAAG;GAC7D,EAAE,OAAO,EAAE,OAAO,oBAAoB,GAAG,CACvC,EAAE,QAAQ,EAAE,OAAO,oBAAoB,GAAG,MAAM,GAChD,EAAE,QAAQ,EAAE,OAAO,sBAAsB,GAAG,KAAK,CACnD,CAAC;GACD,EAAE,MAAM,EAAE,OAAO,qBAAqB,GAAG,MAAM,KAAK;GACpD,MAAM,UAAU,KAAA,IACZ,OACA,EACE,UACA,EAAE,OAAO,qBAAqB,GAC9B,OAAO,MAAM,KAAK,CAAA,CAAE,eAAe,OAAO,CAC5C;GACJ,EAAE,OAAO,EAAE,OAAO,sBAAsB,GAAG,CACzC,EAAE,QAAQ,MAAM,MAAM,GACtB,EAAE,QAAQ,EAAE,OAAO,qBAAqB,GAAG,MAAM,CACnD,CAAC;EACH,CAAC;CACL;AACF,CAAC"}
@@ -0,0 +1,17 @@
1
+ /** Reference Vue chart material for renderer registration examples. */
2
+ export declare const LTrendCard: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
+ title: {
4
+ type: StringConstructor;
5
+ default: string;
6
+ };
7
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
8
+ [key: string]: any;
9
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
10
+ title: {
11
+ type: StringConstructor;
12
+ default: string;
13
+ };
14
+ }>> & Readonly<{}>, {
15
+ title: string;
16
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
17
+ //# sourceMappingURL=LTrendCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LTrendCard.d.ts","sourceRoot":"","sources":["../../src/components/LTrendCard.ts"],"names":[],"mappings":"AAEA,uEAAuE;AACvE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;4EAwBrB,CAAA"}
@@ -0,0 +1,36 @@
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
+ import { defineComponent, h } from "vue";
11
+ //#region src/components/LTrendCard.ts
12
+ const LTrendCard = defineComponent({
13
+ name: "LTrendCard",
14
+ props: { title: {
15
+ type: String,
16
+ default: "趋势图表"
17
+ } },
18
+ setup(props) {
19
+ return () => h("article", {
20
+ class: "layout-card",
21
+ "data-layout-card": ""
22
+ }, [
23
+ h("div", { class: "layout-card__meta" }, [h("span", { class: "layout-card__type" }, "趋势图表"), h("span", { class: "layout-card__status" }, "已配置")]),
24
+ h("h3", { class: "layout-card__title" }, props.title),
25
+ h("span", {
26
+ class: "layout-card__chart",
27
+ "aria-hidden": "true"
28
+ }, Array.from({ length: 5 }, (_, index) => h("i", { key: index }))),
29
+ h("div", { class: "layout-card__footer" }, [h("span", null, "实时数据"), h("span", { class: "layout-card__spark" }, "趋势稳定")])
30
+ ]);
31
+ }
32
+ });
33
+ //#endregion
34
+ export { LTrendCard };
35
+ /*! End of @composy/layout-vue | Powered by @composy/builder */
36
+ //# sourceMappingURL=LTrendCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LTrendCard.js","names":[],"sources":["../../src/components/LTrendCard.ts"],"sourcesContent":["import { defineComponent, h } from 'vue'\n\n/** Reference Vue chart material for renderer registration examples. */\nexport const LTrendCard = defineComponent({\n name: 'LTrendCard',\n props: {\n title: { type: String, default: '趋势图表' },\n },\n setup(props) {\n return () =>\n h('article', { class: 'layout-card', 'data-layout-card': '' }, [\n h('div', { class: 'layout-card__meta' }, [\n h('span', { class: 'layout-card__type' }, '趋势图表'),\n h('span', { class: 'layout-card__status' }, '已配置'),\n ]),\n h('h3', { class: 'layout-card__title' }, props.title),\n h(\n 'span',\n { class: 'layout-card__chart', 'aria-hidden': 'true' },\n Array.from({ length: 5 }, (_, index) => h('i', { key: index }))\n ),\n h('div', { class: 'layout-card__footer' }, [\n h('span', null, '实时数据'),\n h('span', { class: 'layout-card__spark' }, '趋势稳定'),\n ]),\n ])\n },\n})\n"],"mappings":";;;;;;;;;;;AAGO,MAAM,aAAa,gBAAgB;CACxC,MAAM;CACN,OAAO,EACL,OAAO;EAAE,MAAM;EAAQ,SAAS;CAAO,EACzC;CACA,MAAM,OAAO;EACX,aACE,EAAE,WAAW;GAAE,OAAO;GAAe,oBAAoB;EAAG,GAAG;GAC7D,EAAE,OAAO,EAAE,OAAO,oBAAoB,GAAG,CACvC,EAAE,QAAQ,EAAE,OAAO,oBAAoB,GAAG,MAAM,GAChD,EAAE,QAAQ,EAAE,OAAO,sBAAsB,GAAG,KAAK,CACnD,CAAC;GACD,EAAE,MAAM,EAAE,OAAO,qBAAqB,GAAG,MAAM,KAAK;GACpD,EACE,QACA;IAAE,OAAO;IAAsB,eAAe;GAAO,GACrD,MAAM,KAAK,EAAE,QAAQ,EAAE,IAAI,GAAG,UAAU,EAAE,KAAK,EAAE,KAAK,MAAM,CAAC,CAAC,CAChE;GACA,EAAE,OAAO,EAAE,OAAO,sBAAsB,GAAG,CACzC,EAAE,QAAQ,MAAM,MAAM,GACtB,EAAE,QAAQ,EAAE,OAAO,qBAAqB,GAAG,MAAM,CACnD,CAAC;EACH,CAAC;CACL;AACF,CAAC"}
@@ -0,0 +1,10 @@
1
+ export { LGrid } from './LGrid';
2
+ export { LGridItem } from './LGridItem';
3
+ export { LMaterialRenderer } from './LMaterialRenderer';
4
+ export { LLayoutEditor } from './LLayoutEditor';
5
+ export { default as LLayoutWorkspace } from './LLayoutWorkspace.vue';
6
+ export { LMaterialDragSource } from './LMaterialDragSource';
7
+ export { LMetricCard } from './LMetricCard';
8
+ export { LTrendCard } from './LTrendCard';
9
+ export type { LayoutRenderTarget, VueMaterialSource } from './material-renderer';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA"}
@@ -0,0 +1,19 @@
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
+ import { LGrid } from "./LGrid.js";
11
+ import { LGridItem } from "./LGridItem.js";
12
+ import { LMaterialRenderer } from "./LMaterialRenderer.js";
13
+ import { LLayoutEditor } from "./LLayoutEditor.js";
14
+ import { LMetricCard } from "./LMetricCard.js";
15
+ import { LTrendCard } from "./LTrendCard.js";
16
+ import LLayoutWorkspace_default from "./LLayoutWorkspace.js";
17
+ import { LMaterialDragSource } from "./LMaterialDragSource.js";
18
+ export { LGrid, LGridItem, LLayoutEditor, LLayoutWorkspace_default as LLayoutWorkspace, LMaterialDragSource, LMaterialRenderer, LMetricCard, LTrendCard };
19
+ /*! End of @composy/layout-vue | Powered by @composy/builder */
@@ -0,0 +1,26 @@
1
+ import { type VNode } from 'vue';
2
+ import { type LayoutNode, type LayoutPlacement, type MaterialDefinition, type MaterialRegistry } from '@composy/layout-core';
3
+ export type VueMaterialSource = MaterialRegistry | readonly MaterialDefinition[] | undefined;
4
+ /**
5
+ * The runtime target used by the layout renderer. It intentionally contains
6
+ * only the two targets supported by the workspace today: a Vue component or a
7
+ * registered native custom element.
8
+ */
9
+ export type LayoutRenderTarget = 'vue' | 'webcomponent';
10
+ export declare function resolveMaterialDefinition(materials: VueMaterialSource, type: string): MaterialDefinition | undefined;
11
+ /**
12
+ * Render the framework-specific fallback declared by a material.
13
+ * A host-provided item slot always takes precedence over this helper.
14
+ */
15
+ export declare function renderMaterialFallback(materials: VueMaterialSource, item: LayoutNode, placement: LayoutPlacement, breakpointId: string): VNode | undefined;
16
+ /**
17
+ * Render the registered renderer for a concrete target.
18
+ *
19
+ * Keeping this decision in one place is important: grid items, preview
20
+ * surfaces and integrations must not each invent their own component lookup.
21
+ * A material can still provide the legacy html renderer as a final fallback,
22
+ * but a Vue target never silently prefers a web component when its Vue
23
+ * renderer is present (and vice versa).
24
+ */
25
+ export declare function renderMaterialForTarget(materials: VueMaterialSource, item: LayoutNode, target: LayoutRenderTarget, placement?: LayoutPlacement, breakpointId?: string): VNode | undefined;
26
+ //# sourceMappingURL=material-renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"material-renderer.d.ts","sourceRoot":"","sources":["../../src/components/material-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,KAAK,KAAK,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAA;AAC7B,MAAM,MAAM,iBAAiB,GAC3B,gBAAgB,GAAG,SAAS,kBAAkB,EAAE,GAAG,SAAS,CAAA;AAE9D;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,cAAc,CAAA;AAUvD,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,iBAAiB,EAC5B,IAAI,EAAE,MAAM,GACX,kBAAkB,GAAG,SAAS,CAEhC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,iBAAiB,EAC5B,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,eAAe,EAC1B,YAAY,EAAE,MAAM,GACnB,KAAK,GAAG,SAAS,CA0BnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,iBAAiB,EAC5B,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,kBAAkB,EAC1B,SAAS,CAAC,EAAE,eAAe,EAC3B,YAAY,SAAY,GACvB,KAAK,GAAG,SAAS,CAoDnB"}
@@ -0,0 +1,96 @@
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
+ import { h } from "vue";
11
+ import { createMaterialRegistry } from "@composy/layout-core";
12
+ //#region src/components/material-renderer.ts
13
+ function resolveRegistry(source) {
14
+ if (!source) return void 0;
15
+ if (Array.isArray(source)) return createMaterialRegistry(source);
16
+ return source;
17
+ }
18
+ function resolveMaterialDefinition(materials, type) {
19
+ return resolveRegistry(materials)?.get(type);
20
+ }
21
+ function renderMaterialFallback(materials, item, placement, breakpointId) {
22
+ const material = resolveMaterialDefinition(materials, item.type);
23
+ const context = {
24
+ item,
25
+ placement,
26
+ breakpointId
27
+ };
28
+ const vueRenderer = material?.renderers?.vue;
29
+ if (vueRenderer?.component) return h(vueRenderer.component, {
30
+ ...item.props ?? {},
31
+ ...vueRenderer.tagName ? { is: vueRenderer.tagName } : {}
32
+ });
33
+ const webComponentRenderer = material?.renderers?.webcomponent;
34
+ if (webComponentRenderer?.tagName) return h(webComponentRenderer.tagName, {
35
+ ...item.props ?? {},
36
+ materialProps: { ...item.props ?? {} }
37
+ });
38
+ const htmlRenderer = material?.renderers?.html;
39
+ if (htmlRenderer?.render) {
40
+ const rendered = htmlRenderer.render(context);
41
+ if (typeof rendered === "string") return h("div", { innerHTML: sanitizeMarkup(rendered) });
42
+ return rendered;
43
+ }
44
+ if (htmlRenderer?.tagName) return h(htmlRenderer.tagName, { ...item.props ?? {} });
45
+ }
46
+ function renderMaterialForTarget(materials, item, target, placement, breakpointId = "desktop") {
47
+ const material = resolveMaterialDefinition(materials, item.type);
48
+ const props = { ...item.props ?? {} };
49
+ if (target === "vue") {
50
+ const renderer = material?.renderers?.vue;
51
+ if (renderer?.component) return h(renderer.component, props);
52
+ } else {
53
+ const renderer = material?.renderers?.webcomponent;
54
+ if (renderer?.tagName) return h(renderer.tagName, {
55
+ ...props,
56
+ materialProps: props,
57
+ onVnodeMounted: (vnode) => {
58
+ const el = vnode.el;
59
+ if (el && "materialProps" in el) el.materialProps = props;
60
+ },
61
+ onVnodeUpdated: (vnode) => {
62
+ const el = vnode.el;
63
+ if (el && "materialProps" in el) el.materialProps = props;
64
+ }
65
+ });
66
+ }
67
+ const htmlRenderer = material?.renderers?.html;
68
+ if (htmlRenderer?.render) {
69
+ const rendered = htmlRenderer.render({
70
+ item,
71
+ placement: placement ?? item.layout[breakpointId] ?? {
72
+ x: 0,
73
+ y: 0,
74
+ w: 1,
75
+ h: 1
76
+ },
77
+ breakpointId
78
+ });
79
+ if (typeof rendered === "string") return h("div", { innerHTML: sanitizeMarkup(rendered) });
80
+ return rendered;
81
+ }
82
+ if (htmlRenderer?.tagName) return h(htmlRenderer.tagName, props);
83
+ return renderMaterialFallback(materials, item, placement ?? item.layout[breakpointId] ?? {
84
+ x: 0,
85
+ y: 0,
86
+ w: 1,
87
+ h: 1
88
+ }, breakpointId);
89
+ }
90
+ function sanitizeMarkup(value) {
91
+ 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*("|')\s*javascript:[^"']*\1/gi, "");
92
+ }
93
+ //#endregion
94
+ export { renderMaterialFallback, renderMaterialForTarget, resolveMaterialDefinition };
95
+ /*! End of @composy/layout-vue | Powered by @composy/builder */
96
+ //# sourceMappingURL=material-renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"material-renderer.js","names":[],"sources":["../../src/components/material-renderer.ts"],"sourcesContent":["import { h, type VNode } from 'vue'\nimport {\n createMaterialRegistry,\n type LayoutNode,\n type LayoutPlacement,\n type MaterialDefinition,\n type MaterialRegistry,\n} from '@composy/layout-core'\nexport type VueMaterialSource =\n MaterialRegistry | readonly MaterialDefinition[] | undefined\n\n/**\n * The runtime target used by the layout renderer. It intentionally contains\n * only the two targets supported by the workspace today: a Vue component or a\n * registered native custom element.\n */\nexport type LayoutRenderTarget = 'vue' | 'webcomponent'\n\nfunction resolveRegistry(\n source: VueMaterialSource\n): MaterialRegistry | undefined {\n if (!source) return undefined\n if (Array.isArray(source)) return createMaterialRegistry(source)\n return source as MaterialRegistry\n}\n\nexport function resolveMaterialDefinition(\n materials: VueMaterialSource,\n type: string\n): MaterialDefinition | undefined {\n return resolveRegistry(materials)?.get(type)\n}\n\n/**\n * Render the framework-specific fallback declared by a material.\n * A host-provided item slot always takes precedence over this helper.\n */\nexport function renderMaterialFallback(\n materials: VueMaterialSource,\n item: LayoutNode,\n placement: LayoutPlacement,\n breakpointId: string\n): VNode | undefined {\n const material = resolveMaterialDefinition(materials, item.type)\n const context = { item, placement, breakpointId }\n const vueRenderer = material?.renderers?.vue\n if (vueRenderer?.component) {\n return h(vueRenderer.component as never, {\n ...(item.props ?? {}),\n ...(vueRenderer.tagName ? { is: vueRenderer.tagName } : {}),\n })\n }\n const webComponentRenderer = material?.renderers?.webcomponent\n if (webComponentRenderer?.tagName)\n return h(webComponentRenderer.tagName, {\n ...(item.props ?? {}),\n materialProps: { ...(item.props ?? {}) },\n })\n const htmlRenderer = material?.renderers?.html\n if (htmlRenderer?.render) {\n const rendered = htmlRenderer.render(context)\n if (typeof rendered === 'string')\n return h('div', { innerHTML: sanitizeMarkup(rendered) })\n return rendered as VNode | undefined\n }\n if (htmlRenderer?.tagName)\n return h(htmlRenderer.tagName, { ...(item.props ?? {}) })\n return undefined\n}\n\n/**\n * Render the registered renderer for a concrete target.\n *\n * Keeping this decision in one place is important: grid items, preview\n * surfaces and integrations must not each invent their own component lookup.\n * A material can still provide the legacy html renderer as a final fallback,\n * but a Vue target never silently prefers a web component when its Vue\n * renderer is present (and vice versa).\n */\nexport function renderMaterialForTarget(\n materials: VueMaterialSource,\n item: LayoutNode,\n target: LayoutRenderTarget,\n placement?: LayoutPlacement,\n breakpointId = 'desktop'\n): VNode | undefined {\n const material = resolveMaterialDefinition(materials, item.type)\n const props = { ...(item.props ?? {}) }\n\n if (target === 'vue') {\n const renderer = material?.renderers?.vue\n if (renderer?.component) return h(renderer.component as never, props)\n } else {\n const renderer = material?.renderers?.webcomponent\n if (renderer?.tagName)\n return h(renderer.tagName, {\n ...props,\n // Workspace-provided custom elements use this property to render the\n // same registered material props as the editor/runtime adapters.\n materialProps: props,\n onVnodeMounted: vnode => {\n const el = vnode.el as unknown as Element & {\n materialProps?: Record<string, unknown>\n }\n if (el && 'materialProps' in el) el.materialProps = props\n },\n onVnodeUpdated: vnode => {\n const el = vnode.el as unknown as Element & {\n materialProps?: Record<string, unknown>\n }\n if (el && 'materialProps' in el) el.materialProps = props\n },\n })\n }\n\n const htmlRenderer = material?.renderers?.html\n if (htmlRenderer?.render) {\n const rendered = htmlRenderer.render({\n item,\n placement: placement ??\n item.layout[breakpointId] ?? { x: 0, y: 0, w: 1, h: 1 },\n breakpointId,\n })\n if (typeof rendered === 'string')\n return h('div', { innerHTML: sanitizeMarkup(rendered) })\n return rendered as VNode | undefined\n }\n if (htmlRenderer?.tagName) return h(htmlRenderer.tagName, props)\n\n // Preserve the historical behavior for incomplete third-party definitions\n // so registering only one renderer does not make an item disappear.\n return renderMaterialFallback(\n materials,\n item,\n placement ?? item.layout[breakpointId] ?? { x: 0, y: 0, w: 1, h: 1 },\n breakpointId\n )\n}\n\nfunction sanitizeMarkup(value: string): string {\n return value\n .replace(/<script\\b[^>]*>[\\s\\S]*?<\\/script\\s*>/gi, '')\n .replace(/\\s+on[a-z]+\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s>]+)/gi, '')\n .replace(/\\s+(?:href|src)\\s*=\\s*(\"|')\\s*javascript:[^\"']*\\1/gi, '')\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,SAAS,gBACP,QAC8B;CAC9B,IAAI,CAAC,QAAQ,OAAO,KAAA;CACpB,IAAI,MAAM,QAAQ,MAAM,GAAG,OAAO,uBAAuB,MAAM;CAC/D,OAAO;AACT;AAEO,SAAS,0BACd,WACA,MACgC;CAChC,OAAO,gBAAgB,SAAS,CAAA,EAAG,IAAI,IAAI;AAC7C;AAMO,SAAS,uBACd,WACA,MACA,WACA,cACmB;CACnB,MAAM,WAAW,0BAA0B,WAAW,KAAK,IAAI;CAC/D,MAAM,UAAU;EAAE;EAAM;EAAW;CAAa;CAChD,MAAM,cAAc,UAAU,WAAW;CACzC,IAAI,aAAa,WACf,OAAO,EAAE,YAAY,WAAoB;EACvC,GAAI,KAAK,SAAS,CAAC;EACnB,GAAI,YAAY,UAAU,EAAE,IAAI,YAAY,QAAQ,IAAI,CAAC;CAC3D,CAAC;CAEH,MAAM,uBAAuB,UAAU,WAAW;CAClD,IAAI,sBAAsB,SACxB,OAAO,EAAE,qBAAqB,SAAS;EACrC,GAAI,KAAK,SAAS,CAAC;EACnB,eAAe,EAAE,GAAI,KAAK,SAAS,CAAC,EAAG;CACzC,CAAC;CACH,MAAM,eAAe,UAAU,WAAW;CAC1C,IAAI,cAAc,QAAQ;EACxB,MAAM,WAAW,aAAa,OAAO,OAAO;EAC5C,IAAI,OAAO,aAAa,UACtB,OAAO,EAAE,OAAO,EAAE,WAAW,eAAe,QAAQ,EAAE,CAAC;EACzD,OAAO;CACT;CACA,IAAI,cAAc,SAChB,OAAO,EAAE,aAAa,SAAS,EAAE,GAAI,KAAK,SAAS,CAAC,EAAG,CAAC;AAE5D;AAWO,SAAS,wBACd,WACA,MACA,QACA,WACA,eAAe,WACI;CACnB,MAAM,WAAW,0BAA0B,WAAW,KAAK,IAAI;CAC/D,MAAM,QAAQ,EAAE,GAAI,KAAK,SAAS,CAAC,EAAG;CAEtC,IAAI,WAAW,OAAO;EACpB,MAAM,WAAW,UAAU,WAAW;EACtC,IAAI,UAAU,WAAW,OAAO,EAAE,SAAS,WAAoB,KAAK;CACtE,OAAO;EACL,MAAM,WAAW,UAAU,WAAW;EACtC,IAAI,UAAU,SACZ,OAAO,EAAE,SAAS,SAAS;GACzB,GAAG;GAGH,eAAe;GACf,iBAAgB,UAAS;IACvB,MAAM,KAAK,MAAM;IAGjB,IAAI,MAAM,mBAAmB,IAAI,GAAG,gBAAgB;GACtD;GACA,iBAAgB,UAAS;IACvB,MAAM,KAAK,MAAM;IAGjB,IAAI,MAAM,mBAAmB,IAAI,GAAG,gBAAgB;GACtD;EACF,CAAC;CACL;CAEA,MAAM,eAAe,UAAU,WAAW;CAC1C,IAAI,cAAc,QAAQ;EACxB,MAAM,WAAW,aAAa,OAAO;GACnC;GACA,WAAW,aACT,KAAK,OAAO,iBAAiB;IAAE,GAAG;IAAG,GAAG;IAAG,GAAG;IAAG,GAAG;GAAE;GACxD;EACF,CAAC;EACD,IAAI,OAAO,aAAa,UACtB,OAAO,EAAE,OAAO,EAAE,WAAW,eAAe,QAAQ,EAAE,CAAC;EACzD,OAAO;CACT;CACA,IAAI,cAAc,SAAS,OAAO,EAAE,aAAa,SAAS,KAAK;CAI/D,OAAO,uBACL,WACA,MACA,aAAa,KAAK,OAAO,iBAAiB;EAAE,GAAG;EAAG,GAAG;EAAG,GAAG;EAAG,GAAG;CAAE,GACnE,YACF;AACF;AAEA,SAAS,eAAe,OAAuB;CAC7C,OAAO,MACJ,QAAQ,0CAA0C,EAAE,CAAA,CACpD,QAAQ,mDAAmD,EAAE,CAAA,CAC7D,QAAQ,uDAAuD,EAAE;AACtE"}
@@ -0,0 +1,2 @@
1
+ export { useLayoutEditor } from './useLayoutEditor';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
@@ -0,0 +1,12 @@
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
+ import { useLayoutEditor } from "./useLayoutEditor.js";
11
+ export { useLayoutEditor };
12
+ /*! End of @composy/layout-vue | Powered by @composy/builder */
@@ -0,0 +1,3 @@
1
+ import type { LayoutEditorOptions } from '@composy/layout-editor';
2
+ export declare function useLayoutEditor(options: LayoutEditorOptions): import("vue").ShallowRef<import("@composy/layout-editor").LayoutEditor, import("@composy/layout-editor").LayoutEditor>;
3
+ //# sourceMappingURL=useLayoutEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLayoutEditor.d.ts","sourceRoot":"","sources":["../../src/composables/useLayoutEditor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAEjE,wBAAgB,eAAe,CAAC,OAAO,EAAE,mBAAmB,0HAK3D"}
@@ -0,0 +1,22 @@
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
+ import { onBeforeUnmount, onMounted, shallowRef } from "vue";
11
+ import { createLayoutEditor } from "@composy/layout-editor";
12
+ //#region src/composables/useLayoutEditor.ts
13
+ function useLayoutEditor(options) {
14
+ const editor = shallowRef(createLayoutEditor(options));
15
+ onMounted(() => editor.value.mount());
16
+ onBeforeUnmount(() => editor.value.destroy());
17
+ return editor;
18
+ }
19
+ //#endregion
20
+ export { useLayoutEditor };
21
+ /*! End of @composy/layout-vue | Powered by @composy/builder */
22
+ //# sourceMappingURL=useLayoutEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLayoutEditor.js","names":[],"sources":["../../src/composables/useLayoutEditor.ts"],"sourcesContent":["import { onBeforeUnmount, onMounted, shallowRef } from 'vue'\nimport { createLayoutEditor } from '@composy/layout-editor'\nimport type { LayoutEditorOptions } from '@composy/layout-editor'\n\nexport function useLayoutEditor(options: LayoutEditorOptions) {\n const editor = shallowRef(createLayoutEditor(options))\n onMounted(() => editor.value.mount())\n onBeforeUnmount(() => editor.value.destroy())\n return editor\n}\n"],"mappings":";;;;;;;;;;;;AAIO,SAAS,gBAAgB,SAA8B;CAC5D,MAAM,SAAS,WAAW,mBAAmB,OAAO,CAAC;CACrD,gBAAgB,OAAO,MAAM,MAAM,CAAC;CACpC,sBAAsB,OAAO,MAAM,QAAQ,CAAC;CAC5C,OAAO;AACT"}
package/es/index.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export { LGrid, LGridItem, LMaterialRenderer, LLayoutEditor, LLayoutWorkspace, LMaterialDragSource, LMetricCard, LTrendCard, } from './components';
2
+ export { useLayoutEditor } from './composables';
3
+ export type * from './types';
4
+ export type { LayoutRenderTarget, VueMaterialSource, } from './components/material-renderer';
5
+ export type { LayoutDocument, LayoutNode, LayoutPlacement, MaterialDefinition, } from '@composy/layout-core';
6
+ export type { LayoutEditor, LayoutEditorEngine, LayoutEditorOptions, } from '@composy/layout-editor';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,UAAU,GACX,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,mBAAmB,SAAS,CAAA;AAC5B,YAAY,EACV,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,gCAAgC,CAAA;AACvC,YAAY,EACV,cAAc,EACd,UAAU,EACV,eAAe,EACf,kBAAkB,GACnB,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,wBAAwB,CAAA"}
package/es/index.js ADDED
@@ -0,0 +1,22 @@
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
+ import { LGrid } from "./components/LGrid.js";
11
+ import { LGridItem } from "./components/LGridItem.js";
12
+ import { LMaterialRenderer } from "./components/LMaterialRenderer.js";
13
+ import { LLayoutEditor } from "./components/LLayoutEditor.js";
14
+ import { LMetricCard } from "./components/LMetricCard.js";
15
+ import { LTrendCard } from "./components/LTrendCard.js";
16
+ import LLayoutWorkspace_default from "./components/LLayoutWorkspace.js";
17
+ import { LMaterialDragSource } from "./components/LMaterialDragSource.js";
18
+ import "./components/index.js";
19
+ import { useLayoutEditor } from "./composables/useLayoutEditor.js";
20
+ import "./composables/index.js";
21
+ export { LGrid, LGridItem, LLayoutEditor, LLayoutWorkspace_default as LLayoutWorkspace, LMaterialDragSource, LMaterialRenderer, LMetricCard, LTrendCard, useLayoutEditor };
22
+ /*! End of @composy/layout-vue | Powered by @composy/builder */
@@ -0,0 +1 @@
1
+ import './index.less';
@@ -0,0 +1 @@
1
+ import './index.less';
@@ -0,0 +1 @@
1
+ // @ldesign styles