@tailor-cms/ce-html-raw-display 0.0.2 → 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.
@@ -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 _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
- interaction: (...args: any[]) => void;
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
- "use strict";
2
- var import_index = require("./index.css");
3
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
4
- const vue = require("vue");
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
- // Display icon, https://pictogrammers.com/library/mdi/
12
- icon: "mdi-code-tags",
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 mocks = {
18
- displayContexts: [
19
- { name: "Test preset 1", data: { state: "I have a value" } },
20
- { name: "Test preset 2", data: { state: "I have a different value" } }
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
- type,
25
- version: "1.0",
26
- name,
27
- ssr: false,
28
- initState,
29
- ui,
30
- mocks
37
+ type,
38
+ version: "1.0",
39
+ name,
40
+ ssr: false,
41
+ initState,
42
+ isEmpty,
43
+ ui,
44
+ ai
31
45
  };
32
- var index_default = manifest$1;
33
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
34
- __name: "Display",
35
- props: {
36
- element: {},
37
- userState: {}
38
- },
39
- emits: ["interaction"],
40
- setup(__props) {
41
- const props = __props;
42
- const displayFrame = vue.useTemplateRef("displayFrame");
43
- function updateFrameContent(iframe, content) {
44
- iframe.contentDocument.body.innerHTML = content;
45
- updateHeight(displayFrame.value);
46
- setTimeout(() => updateHeight(displayFrame.value), 1e3);
47
- }
48
- function updateHeight(frame) {
49
- const height = frame.contentWindow.document.body.scrollHeight;
50
- frame.height = height > 180 ? height : 180;
51
- }
52
- vue.onMounted(() => {
53
- updateFrameContent(displayFrame.value, props.element.data.content || "");
54
- });
55
- return (_ctx, _cache) => {
56
- return vue.openBlock(), vue.createElementBlock("iframe", {
57
- ref_key: "displayFrame",
58
- ref: displayFrame,
59
- class: "mt-4",
60
- title: "Preview",
61
- width: "100%"
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
- const _export_sfc = (sfc, props) => {
67
- const target = sfc.__vccOpts || sfc;
68
- for (const [key, val] of props) {
69
- target[key] = val;
70
- }
71
- return target;
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
- const Display = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-9c52b481"]]);
74
- const manifest = {
75
- ...index_default,
76
- Display
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
- exports.Display = Display;
93
+ //#endregion
94
+ exports.Display = Display_default;
79
95
  exports.default = manifest;
package/dist/index.css CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
- iframe[data-v-9c52b481] {
2
+ iframe[data-v-2cd3c044] {
3
3
  border: none;
4
4
  }
package/dist/index.js CHANGED
@@ -1,79 +1,90 @@
1
- import "./index.css";
2
- import { defineComponent, useTemplateRef, onMounted, createElementBlock, openBlock } from "vue";
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
- // Display icon, https://pictogrammers.com/library/mdi/
10
- icon: "mdi-code-tags",
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 mocks = {
16
- displayContexts: [
17
- { name: "Test preset 1", data: { state: "I have a value" } },
18
- { name: "Test preset 2", data: { state: "I have a different value" } }
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
- type,
23
- version: "1.0",
24
- name,
25
- ssr: false,
26
- initState,
27
- ui,
28
- mocks
33
+ type,
34
+ version: "1.0",
35
+ name,
36
+ ssr: false,
37
+ initState,
38
+ isEmpty,
39
+ ui,
40
+ ai
29
41
  };
30
- var index_default = manifest$1;
31
- const _sfc_main = /* @__PURE__ */ defineComponent({
32
- __name: "Display",
33
- props: {
34
- element: {},
35
- userState: {}
36
- },
37
- emits: ["interaction"],
38
- setup(__props) {
39
- const props = __props;
40
- const displayFrame = useTemplateRef("displayFrame");
41
- function updateFrameContent(iframe, content) {
42
- iframe.contentDocument.body.innerHTML = content;
43
- updateHeight(displayFrame.value);
44
- setTimeout(() => updateHeight(displayFrame.value), 1e3);
45
- }
46
- function updateHeight(frame) {
47
- const height = frame.contentWindow.document.body.scrollHeight;
48
- frame.height = height > 180 ? height : 180;
49
- }
50
- onMounted(() => {
51
- updateFrameContent(displayFrame.value, props.element.data.content || "");
52
- });
53
- return (_ctx, _cache) => {
54
- return openBlock(), createElementBlock("iframe", {
55
- ref_key: "displayFrame",
56
- ref: displayFrame,
57
- class: "mt-4",
58
- title: "Preview",
59
- width: "100%"
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
- const _export_sfc = (sfc, props) => {
65
- const target = sfc.__vccOpts || sfc;
66
- for (const [key, val] of props) {
67
- target[key] = val;
68
- }
69
- return target;
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
- export {
77
- Display,
78
- manifest as default
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.2",
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.13"
19
+ "vue": "^3.5.29"
20
20
  },
21
21
  "devDependencies": {
22
- "@tailor-cms/eslint-config": "1.1.2",
23
- "@vitejs/plugin-vue": "^6.0.0",
24
- "typescript": "^5.8.3",
25
- "vite": "^7.0.3",
26
- "vue-tsc": "^3.0.1",
27
- "@tailor-cms/ce-html-raw-manifest": "0.0.2"
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",