@tailor-cms/ce-html-raw-display 0.0.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Display.vue.d.ts +2 -6
- package/dist/index.cjs +84 -68
- package/dist/index.css +1 -1
- package/dist/index.js +80 -69
- package/package.json +13 -8
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { Element } from '@tailor-cms/ce-html-raw-manifest';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
element: Element;
|
|
4
|
-
userState: any;
|
|
5
4
|
};
|
|
6
|
-
declare const
|
|
7
|
-
|
|
8
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
-
onInteraction?: ((...args: any[]) => any) | undefined;
|
|
10
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
11
7
|
export default _default;
|
package/dist/index.cjs
CHANGED
|
@@ -1,79 +1,95 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
require('./index.css');let vue = require("vue");
|
|
6
|
+
//#region ../manifest/dist/index.mjs
|
|
5
7
|
var type = "HTML_RAW";
|
|
6
8
|
var name = "Raw HTML";
|
|
7
|
-
var initState = () => ({
|
|
8
|
-
content: ""
|
|
9
|
-
});
|
|
9
|
+
var initState = () => ({ content: "" });
|
|
10
10
|
var ui = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// Does element support only full width or can be used within layouts
|
|
14
|
-
// (e.g. 50/50 layout)
|
|
15
|
-
forceFullWidth: true
|
|
11
|
+
icon: "mdi-code-tags",
|
|
12
|
+
forceFullWidth: true
|
|
16
13
|
};
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
var ai = {
|
|
15
|
+
Schema: {
|
|
16
|
+
type: "json_schema",
|
|
17
|
+
name: "ce_html_raw",
|
|
18
|
+
schema: {
|
|
19
|
+
type: "object",
|
|
20
|
+
properties: { content: { type: "string" } },
|
|
21
|
+
required: ["content"],
|
|
22
|
+
additionalProperties: false
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
getPrompt: () => `
|
|
26
|
+
Generate a raw HTML snippet as an object with the following properties:
|
|
27
|
+
{ "content": "" }
|
|
28
|
+
where:
|
|
29
|
+
- 'content' is a self-contained HTML snippet intended to be rendered inside
|
|
30
|
+
a sandboxed iframe. Do not include <style> tags, inline style attributes,
|
|
31
|
+
or <html>/<head>/<body> wrappers.
|
|
32
|
+
`,
|
|
33
|
+
processResponse: (val) => val
|
|
22
34
|
};
|
|
35
|
+
var isEmpty = (data) => !data.content;
|
|
23
36
|
var manifest$1 = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
type,
|
|
38
|
+
version: "1.0",
|
|
39
|
+
name,
|
|
40
|
+
ssr: false,
|
|
41
|
+
initState,
|
|
42
|
+
isEmpty,
|
|
43
|
+
ui,
|
|
44
|
+
ai
|
|
31
45
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, null, 512);
|
|
63
|
-
};
|
|
64
|
-
}
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/components/Display.vue?vue&type=script&setup=true&lang.ts
|
|
48
|
+
var Display_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
49
|
+
__name: "Display",
|
|
50
|
+
props: { element: {} },
|
|
51
|
+
setup(__props) {
|
|
52
|
+
const props = __props;
|
|
53
|
+
const displayFrame = (0, vue.useTemplateRef)("displayFrame");
|
|
54
|
+
function updateFrameContent(iframe, content) {
|
|
55
|
+
iframe.contentDocument.body.innerHTML = content;
|
|
56
|
+
updateHeight(displayFrame.value);
|
|
57
|
+
setTimeout(() => updateHeight(displayFrame.value), 1e3);
|
|
58
|
+
}
|
|
59
|
+
function updateHeight(frame) {
|
|
60
|
+
const height = frame.contentWindow.document.body.scrollHeight;
|
|
61
|
+
frame.height = height > 180 ? height : 180;
|
|
62
|
+
}
|
|
63
|
+
(0, vue.onMounted)(() => {
|
|
64
|
+
updateFrameContent(displayFrame.value, props.element.data.content || "");
|
|
65
|
+
});
|
|
66
|
+
return (_ctx, _cache) => {
|
|
67
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("iframe", {
|
|
68
|
+
ref_key: "displayFrame",
|
|
69
|
+
ref: displayFrame,
|
|
70
|
+
class: "mt-4",
|
|
71
|
+
title: "Preview",
|
|
72
|
+
width: "100%"
|
|
73
|
+
}, null, 512);
|
|
74
|
+
};
|
|
75
|
+
}
|
|
65
76
|
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region \0plugin-vue:export-helper
|
|
79
|
+
var _plugin_vue_export_helper_default = (sfc, props) => {
|
|
80
|
+
const target = sfc.__vccOpts || sfc;
|
|
81
|
+
for (const [key, val] of props) target[key] = val;
|
|
82
|
+
return target;
|
|
72
83
|
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/components/Display.vue
|
|
86
|
+
var Display_default = /* @__PURE__ */ _plugin_vue_export_helper_default(Display_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-2cd3c044"]]);
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/index.ts
|
|
89
|
+
var manifest = {
|
|
90
|
+
...manifest$1,
|
|
91
|
+
Display: Display_default
|
|
77
92
|
};
|
|
78
|
-
|
|
93
|
+
//#endregion
|
|
94
|
+
exports.Display = Display_default;
|
|
79
95
|
exports.default = manifest;
|
package/dist/index.css
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,79 +1,90 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import
|
|
1
|
+
import { createElementBlock, defineComponent, onMounted, openBlock, useTemplateRef } from "vue";
|
|
2
|
+
import './index.css';//#region ../manifest/dist/index.mjs
|
|
3
3
|
var type = "HTML_RAW";
|
|
4
4
|
var name = "Raw HTML";
|
|
5
|
-
var initState = () => ({
|
|
6
|
-
content: ""
|
|
7
|
-
});
|
|
5
|
+
var initState = () => ({ content: "" });
|
|
8
6
|
var ui = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
// Does element support only full width or can be used within layouts
|
|
12
|
-
// (e.g. 50/50 layout)
|
|
13
|
-
forceFullWidth: true
|
|
7
|
+
icon: "mdi-code-tags",
|
|
8
|
+
forceFullWidth: true
|
|
14
9
|
};
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
var ai = {
|
|
11
|
+
Schema: {
|
|
12
|
+
type: "json_schema",
|
|
13
|
+
name: "ce_html_raw",
|
|
14
|
+
schema: {
|
|
15
|
+
type: "object",
|
|
16
|
+
properties: { content: { type: "string" } },
|
|
17
|
+
required: ["content"],
|
|
18
|
+
additionalProperties: false
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
getPrompt: () => `
|
|
22
|
+
Generate a raw HTML snippet as an object with the following properties:
|
|
23
|
+
{ "content": "" }
|
|
24
|
+
where:
|
|
25
|
+
- 'content' is a self-contained HTML snippet intended to be rendered inside
|
|
26
|
+
a sandboxed iframe. Do not include <style> tags, inline style attributes,
|
|
27
|
+
or <html>/<head>/<body> wrappers.
|
|
28
|
+
`,
|
|
29
|
+
processResponse: (val) => val
|
|
20
30
|
};
|
|
31
|
+
var isEmpty = (data) => !data.content;
|
|
21
32
|
var manifest$1 = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
type,
|
|
34
|
+
version: "1.0",
|
|
35
|
+
name,
|
|
36
|
+
ssr: false,
|
|
37
|
+
initState,
|
|
38
|
+
isEmpty,
|
|
39
|
+
ui,
|
|
40
|
+
ai
|
|
29
41
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}, null, 512);
|
|
61
|
-
};
|
|
62
|
-
}
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/components/Display.vue?vue&type=script&setup=true&lang.ts
|
|
44
|
+
var Display_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
45
|
+
__name: "Display",
|
|
46
|
+
props: { element: {} },
|
|
47
|
+
setup(__props) {
|
|
48
|
+
const props = __props;
|
|
49
|
+
const displayFrame = useTemplateRef("displayFrame");
|
|
50
|
+
function updateFrameContent(iframe, content) {
|
|
51
|
+
iframe.contentDocument.body.innerHTML = content;
|
|
52
|
+
updateHeight(displayFrame.value);
|
|
53
|
+
setTimeout(() => updateHeight(displayFrame.value), 1e3);
|
|
54
|
+
}
|
|
55
|
+
function updateHeight(frame) {
|
|
56
|
+
const height = frame.contentWindow.document.body.scrollHeight;
|
|
57
|
+
frame.height = height > 180 ? height : 180;
|
|
58
|
+
}
|
|
59
|
+
onMounted(() => {
|
|
60
|
+
updateFrameContent(displayFrame.value, props.element.data.content || "");
|
|
61
|
+
});
|
|
62
|
+
return (_ctx, _cache) => {
|
|
63
|
+
return openBlock(), createElementBlock("iframe", {
|
|
64
|
+
ref_key: "displayFrame",
|
|
65
|
+
ref: displayFrame,
|
|
66
|
+
class: "mt-4",
|
|
67
|
+
title: "Preview",
|
|
68
|
+
width: "100%"
|
|
69
|
+
}, null, 512);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
63
72
|
});
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
};
|
|
71
|
-
const Display = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-9c52b481"]]);
|
|
72
|
-
const manifest = {
|
|
73
|
-
...index_default,
|
|
74
|
-
Display
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region \0plugin-vue:export-helper
|
|
75
|
+
var _plugin_vue_export_helper_default = (sfc, props) => {
|
|
76
|
+
const target = sfc.__vccOpts || sfc;
|
|
77
|
+
for (const [key, val] of props) target[key] = val;
|
|
78
|
+
return target;
|
|
75
79
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/components/Display.vue
|
|
82
|
+
var Display_default = /* @__PURE__ */ _plugin_vue_export_helper_default(Display_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-2cd3c044"]]);
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/index.ts
|
|
85
|
+
var manifest = {
|
|
86
|
+
...manifest$1,
|
|
87
|
+
Display: Display_default
|
|
79
88
|
};
|
|
89
|
+
//#endregion
|
|
90
|
+
export { Display_default as Display, manifest as default };
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Raw HTML display component",
|
|
4
4
|
"author": "Studion <info@gostudion.com> (https://github.com/tailor-cms)",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "0.0
|
|
6
|
+
"version": "2.0.0",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"import": "./dist/index.js",
|
|
@@ -16,19 +16,24 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"vue": "^3.5.
|
|
19
|
+
"vue": "^3.5.29"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@tailor-cms/eslint-config": "
|
|
23
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
24
|
-
"typescript": "^
|
|
25
|
-
"vite": "^
|
|
26
|
-
"
|
|
27
|
-
"
|
|
22
|
+
"@tailor-cms/eslint-config": "2.0.1",
|
|
23
|
+
"@vitejs/plugin-vue": "^6.0.6",
|
|
24
|
+
"typescript": "^6.0.3",
|
|
25
|
+
"vite": "^8.0.10",
|
|
26
|
+
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
27
|
+
"vue-tsc": "^3.2.7",
|
|
28
|
+
"vuetify": "^4.0.6",
|
|
29
|
+
"@tailor-cms/ce-html-raw-manifest": "2.0.0"
|
|
28
30
|
},
|
|
29
31
|
"publishConfig": {
|
|
30
32
|
"access": "public"
|
|
31
33
|
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=24"
|
|
36
|
+
},
|
|
32
37
|
"scripts": {
|
|
33
38
|
"dev": "vite build --watch",
|
|
34
39
|
"build": "pnpm nuke:dist && vue-tsc && vite build",
|