@tailor-cms/ce-html-raw-display 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/README.md +1 -0
- package/dist/components/Display.vue.d.ts +11 -0
- package/dist/index.cjs +79 -0
- package/dist/index.css +4 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +79 -0
- package/package.json +41 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Content element `Display` component
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Element } from '@tailor-cms/ce-html-raw-manifest';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
element: Element;
|
|
4
|
+
userState: any;
|
|
5
|
+
};
|
|
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>;
|
|
11
|
+
export default _default;
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
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");
|
|
5
|
+
var type = "HTML_RAW";
|
|
6
|
+
var name = "Raw HTML";
|
|
7
|
+
var initState = () => ({
|
|
8
|
+
content: ""
|
|
9
|
+
});
|
|
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
|
|
16
|
+
};
|
|
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
|
+
]
|
|
22
|
+
};
|
|
23
|
+
var manifest$1 = {
|
|
24
|
+
type,
|
|
25
|
+
version: "1.0",
|
|
26
|
+
name,
|
|
27
|
+
ssr: false,
|
|
28
|
+
initState,
|
|
29
|
+
ui,
|
|
30
|
+
mocks
|
|
31
|
+
};
|
|
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
|
+
}
|
|
65
|
+
});
|
|
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;
|
|
72
|
+
};
|
|
73
|
+
const Display = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-9c52b481"]]);
|
|
74
|
+
const manifest = {
|
|
75
|
+
...index_default,
|
|
76
|
+
Display
|
|
77
|
+
};
|
|
78
|
+
exports.Display = Display;
|
|
79
|
+
exports.default = manifest;
|
package/dist/index.css
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import "./index.css";
|
|
2
|
+
import { defineComponent, useTemplateRef, onMounted, createElementBlock, openBlock } from "vue";
|
|
3
|
+
var type = "HTML_RAW";
|
|
4
|
+
var name = "Raw HTML";
|
|
5
|
+
var initState = () => ({
|
|
6
|
+
content: ""
|
|
7
|
+
});
|
|
8
|
+
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
|
|
14
|
+
};
|
|
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
|
+
]
|
|
20
|
+
};
|
|
21
|
+
var manifest$1 = {
|
|
22
|
+
type,
|
|
23
|
+
version: "1.0",
|
|
24
|
+
name,
|
|
25
|
+
ssr: false,
|
|
26
|
+
initState,
|
|
27
|
+
ui,
|
|
28
|
+
mocks
|
|
29
|
+
};
|
|
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
|
+
}
|
|
63
|
+
});
|
|
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
|
|
75
|
+
};
|
|
76
|
+
export {
|
|
77
|
+
Display,
|
|
78
|
+
manifest as default
|
|
79
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tailor-cms/ce-html-raw-display",
|
|
3
|
+
"description": "Raw HTML display component",
|
|
4
|
+
"author": "Studion <info@gostudion.com> (https://github.com/tailor-cms)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"version": "0.0.1",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"require": "./dist/index.cjs"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"main": "./dist/index.cjs",
|
|
14
|
+
"types": "./types/index.d.ts",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"vue": "^3.5.13"
|
|
20
|
+
},
|
|
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.1"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"dev": "vite build --watch",
|
|
34
|
+
"build": "pnpm nuke:dist && vue-tsc && vite build",
|
|
35
|
+
"lint": "eslint ./src",
|
|
36
|
+
"lint:fix": "pnpm lint --fix",
|
|
37
|
+
"nuke": "pnpm dlx del-cli dist node_modules",
|
|
38
|
+
"nuke:dist": "pnpm dlx del-cli dist",
|
|
39
|
+
"prepublish": "pnpm build"
|
|
40
|
+
}
|
|
41
|
+
}
|