@tailor-cms/ce-html-raw-server 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/dist/index.cjs +108 -0
- package/dist/index.d.cts +33 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +73 -0
- package/package.json +54 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/index.ts
|
|
20
|
+
var index_exports = {};
|
|
21
|
+
__export(index_exports, {
|
|
22
|
+
afterLoaded: () => afterLoaded,
|
|
23
|
+
afterRetrieve: () => afterRetrieve,
|
|
24
|
+
afterSave: () => afterSave,
|
|
25
|
+
beforeDisplay: () => beforeDisplay,
|
|
26
|
+
beforeSave: () => beforeSave,
|
|
27
|
+
default: () => index_default,
|
|
28
|
+
hookMap: () => hookMap,
|
|
29
|
+
initState: () => initState,
|
|
30
|
+
mocks: () => mocks,
|
|
31
|
+
onUserInteraction: () => onUserInteraction,
|
|
32
|
+
type: () => type
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(index_exports);
|
|
35
|
+
|
|
36
|
+
// ../manifest/dist/index.js
|
|
37
|
+
var type = "HTML_RAW";
|
|
38
|
+
var initState = () => ({
|
|
39
|
+
content: ""
|
|
40
|
+
});
|
|
41
|
+
var mocks = {
|
|
42
|
+
displayContexts: [
|
|
43
|
+
{ name: "Test preset 1", data: { state: "I have a value" } },
|
|
44
|
+
{ name: "Test preset 2", data: { state: "I have a different value" } }
|
|
45
|
+
]
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// src/index.ts
|
|
49
|
+
var IS_CEK = process.env.CEK_RUNTIME;
|
|
50
|
+
var USER_STATE = {};
|
|
51
|
+
function beforeSave(element, _services) {
|
|
52
|
+
return element;
|
|
53
|
+
}
|
|
54
|
+
function afterSave(element, _services) {
|
|
55
|
+
return element;
|
|
56
|
+
}
|
|
57
|
+
function afterLoaded(element, _services, _runtime) {
|
|
58
|
+
return element;
|
|
59
|
+
}
|
|
60
|
+
function afterRetrieve(element, _services, _runtime) {
|
|
61
|
+
return element;
|
|
62
|
+
}
|
|
63
|
+
function beforeDisplay(_element, context) {
|
|
64
|
+
return { ...context, ...USER_STATE };
|
|
65
|
+
}
|
|
66
|
+
function onUserInteraction(_element, context, payload) {
|
|
67
|
+
if (IS_CEK) {
|
|
68
|
+
USER_STATE.interactionTimestamp = (/* @__PURE__ */ new Date()).getTime();
|
|
69
|
+
context.contextTimestamp = USER_STATE.interactionTimestamp;
|
|
70
|
+
Object.assign(USER_STATE, payload);
|
|
71
|
+
}
|
|
72
|
+
return { updateDisplayState: true };
|
|
73
|
+
}
|
|
74
|
+
var hookMap = new Map(
|
|
75
|
+
Object.entries({
|
|
76
|
+
beforeSave,
|
|
77
|
+
afterSave,
|
|
78
|
+
afterLoaded,
|
|
79
|
+
afterRetrieve,
|
|
80
|
+
onUserInteraction,
|
|
81
|
+
beforeDisplay
|
|
82
|
+
})
|
|
83
|
+
);
|
|
84
|
+
var index_default = {
|
|
85
|
+
type,
|
|
86
|
+
hookMap,
|
|
87
|
+
initState,
|
|
88
|
+
beforeSave,
|
|
89
|
+
afterSave,
|
|
90
|
+
afterLoaded,
|
|
91
|
+
afterRetrieve,
|
|
92
|
+
onUserInteraction,
|
|
93
|
+
beforeDisplay,
|
|
94
|
+
mocks
|
|
95
|
+
};
|
|
96
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
97
|
+
0 && (module.exports = {
|
|
98
|
+
afterLoaded,
|
|
99
|
+
afterRetrieve,
|
|
100
|
+
afterSave,
|
|
101
|
+
beforeDisplay,
|
|
102
|
+
beforeSave,
|
|
103
|
+
hookMap,
|
|
104
|
+
initState,
|
|
105
|
+
mocks,
|
|
106
|
+
onUserInteraction,
|
|
107
|
+
type
|
|
108
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as _tailor_cms_ce_html_raw_manifest from '@tailor-cms/ce-html-raw-manifest';
|
|
2
|
+
import { Element } from '@tailor-cms/ce-html-raw-manifest';
|
|
3
|
+
export { initState, mocks, type } from '@tailor-cms/ce-html-raw-manifest';
|
|
4
|
+
import { HookServices, ServerRuntime } from '@tailor-cms/cek-common';
|
|
5
|
+
|
|
6
|
+
declare function beforeSave(element: Element, _services: HookServices): Element;
|
|
7
|
+
declare function afterSave(element: Element, _services: HookServices): Element;
|
|
8
|
+
declare function afterLoaded(element: Element, _services: HookServices, _runtime: ServerRuntime): Element;
|
|
9
|
+
declare function afterRetrieve(element: Element, _services: HookServices, _runtime: ServerRuntime): Element;
|
|
10
|
+
declare function beforeDisplay(_element: Element, context: any): any;
|
|
11
|
+
declare function onUserInteraction(_element: Element, context: any, payload: any): any;
|
|
12
|
+
declare const hookMap: Map<string, typeof beforeSave | typeof afterSave | typeof afterLoaded | typeof afterRetrieve | typeof onUserInteraction | typeof beforeDisplay>;
|
|
13
|
+
declare const _default: {
|
|
14
|
+
type: string;
|
|
15
|
+
hookMap: Map<string, typeof beforeSave | typeof afterSave | typeof afterLoaded | typeof afterRetrieve | typeof onUserInteraction | typeof beforeDisplay>;
|
|
16
|
+
initState: _tailor_cms_ce_html_raw_manifest.DataInitializer;
|
|
17
|
+
beforeSave: typeof beforeSave;
|
|
18
|
+
afterSave: typeof afterSave;
|
|
19
|
+
afterLoaded: typeof afterLoaded;
|
|
20
|
+
afterRetrieve: typeof afterRetrieve;
|
|
21
|
+
onUserInteraction: typeof onUserInteraction;
|
|
22
|
+
beforeDisplay: typeof beforeDisplay;
|
|
23
|
+
mocks: {
|
|
24
|
+
displayContexts: {
|
|
25
|
+
name: string;
|
|
26
|
+
data: {
|
|
27
|
+
state: string;
|
|
28
|
+
};
|
|
29
|
+
}[];
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { afterLoaded, afterRetrieve, afterSave, beforeDisplay, beforeSave, _default as default, hookMap, onUserInteraction };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as _tailor_cms_ce_html_raw_manifest from '@tailor-cms/ce-html-raw-manifest';
|
|
2
|
+
import { Element } from '@tailor-cms/ce-html-raw-manifest';
|
|
3
|
+
export { initState, mocks, type } from '@tailor-cms/ce-html-raw-manifest';
|
|
4
|
+
import { HookServices, ServerRuntime } from '@tailor-cms/cek-common';
|
|
5
|
+
|
|
6
|
+
declare function beforeSave(element: Element, _services: HookServices): Element;
|
|
7
|
+
declare function afterSave(element: Element, _services: HookServices): Element;
|
|
8
|
+
declare function afterLoaded(element: Element, _services: HookServices, _runtime: ServerRuntime): Element;
|
|
9
|
+
declare function afterRetrieve(element: Element, _services: HookServices, _runtime: ServerRuntime): Element;
|
|
10
|
+
declare function beforeDisplay(_element: Element, context: any): any;
|
|
11
|
+
declare function onUserInteraction(_element: Element, context: any, payload: any): any;
|
|
12
|
+
declare const hookMap: Map<string, typeof beforeSave | typeof afterSave | typeof afterLoaded | typeof afterRetrieve | typeof onUserInteraction | typeof beforeDisplay>;
|
|
13
|
+
declare const _default: {
|
|
14
|
+
type: string;
|
|
15
|
+
hookMap: Map<string, typeof beforeSave | typeof afterSave | typeof afterLoaded | typeof afterRetrieve | typeof onUserInteraction | typeof beforeDisplay>;
|
|
16
|
+
initState: _tailor_cms_ce_html_raw_manifest.DataInitializer;
|
|
17
|
+
beforeSave: typeof beforeSave;
|
|
18
|
+
afterSave: typeof afterSave;
|
|
19
|
+
afterLoaded: typeof afterLoaded;
|
|
20
|
+
afterRetrieve: typeof afterRetrieve;
|
|
21
|
+
onUserInteraction: typeof onUserInteraction;
|
|
22
|
+
beforeDisplay: typeof beforeDisplay;
|
|
23
|
+
mocks: {
|
|
24
|
+
displayContexts: {
|
|
25
|
+
name: string;
|
|
26
|
+
data: {
|
|
27
|
+
state: string;
|
|
28
|
+
};
|
|
29
|
+
}[];
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { afterLoaded, afterRetrieve, afterSave, beforeDisplay, beforeSave, _default as default, hookMap, onUserInteraction };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// ../manifest/dist/index.js
|
|
2
|
+
var type = "HTML_RAW";
|
|
3
|
+
var initState = () => ({
|
|
4
|
+
content: ""
|
|
5
|
+
});
|
|
6
|
+
var mocks = {
|
|
7
|
+
displayContexts: [
|
|
8
|
+
{ name: "Test preset 1", data: { state: "I have a value" } },
|
|
9
|
+
{ name: "Test preset 2", data: { state: "I have a different value" } }
|
|
10
|
+
]
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// src/index.ts
|
|
14
|
+
var IS_CEK = process.env.CEK_RUNTIME;
|
|
15
|
+
var USER_STATE = {};
|
|
16
|
+
function beforeSave(element, _services) {
|
|
17
|
+
return element;
|
|
18
|
+
}
|
|
19
|
+
function afterSave(element, _services) {
|
|
20
|
+
return element;
|
|
21
|
+
}
|
|
22
|
+
function afterLoaded(element, _services, _runtime) {
|
|
23
|
+
return element;
|
|
24
|
+
}
|
|
25
|
+
function afterRetrieve(element, _services, _runtime) {
|
|
26
|
+
return element;
|
|
27
|
+
}
|
|
28
|
+
function beforeDisplay(_element, context) {
|
|
29
|
+
return { ...context, ...USER_STATE };
|
|
30
|
+
}
|
|
31
|
+
function onUserInteraction(_element, context, payload) {
|
|
32
|
+
if (IS_CEK) {
|
|
33
|
+
USER_STATE.interactionTimestamp = (/* @__PURE__ */ new Date()).getTime();
|
|
34
|
+
context.contextTimestamp = USER_STATE.interactionTimestamp;
|
|
35
|
+
Object.assign(USER_STATE, payload);
|
|
36
|
+
}
|
|
37
|
+
return { updateDisplayState: true };
|
|
38
|
+
}
|
|
39
|
+
var hookMap = new Map(
|
|
40
|
+
Object.entries({
|
|
41
|
+
beforeSave,
|
|
42
|
+
afterSave,
|
|
43
|
+
afterLoaded,
|
|
44
|
+
afterRetrieve,
|
|
45
|
+
onUserInteraction,
|
|
46
|
+
beforeDisplay
|
|
47
|
+
})
|
|
48
|
+
);
|
|
49
|
+
var index_default = {
|
|
50
|
+
type,
|
|
51
|
+
hookMap,
|
|
52
|
+
initState,
|
|
53
|
+
beforeSave,
|
|
54
|
+
afterSave,
|
|
55
|
+
afterLoaded,
|
|
56
|
+
afterRetrieve,
|
|
57
|
+
onUserInteraction,
|
|
58
|
+
beforeDisplay,
|
|
59
|
+
mocks
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
afterLoaded,
|
|
63
|
+
afterRetrieve,
|
|
64
|
+
afterSave,
|
|
65
|
+
beforeDisplay,
|
|
66
|
+
beforeSave,
|
|
67
|
+
index_default as default,
|
|
68
|
+
hookMap,
|
|
69
|
+
initState,
|
|
70
|
+
mocks,
|
|
71
|
+
onUserInteraction,
|
|
72
|
+
type
|
|
73
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tailor-cms/ce-html-raw-server",
|
|
3
|
+
"description": "Raw HTML editor component server package",
|
|
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": "./dist/index.d.ts",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@tailor-cms/cek-common": "^1.3.2",
|
|
20
|
+
"@tailor-cms/eslint-config": "1.1.2",
|
|
21
|
+
"tsup": "^8.5.0",
|
|
22
|
+
"typescript": "^5.8.3",
|
|
23
|
+
"@tailor-cms/ce-html-raw-manifest": "0.0.1"
|
|
24
|
+
},
|
|
25
|
+
"tsup": {
|
|
26
|
+
"entry": [
|
|
27
|
+
"src/index.ts"
|
|
28
|
+
],
|
|
29
|
+
"target": [
|
|
30
|
+
"node14",
|
|
31
|
+
"es2022"
|
|
32
|
+
],
|
|
33
|
+
"format": [
|
|
34
|
+
"cjs",
|
|
35
|
+
"esm"
|
|
36
|
+
],
|
|
37
|
+
"bundle": true,
|
|
38
|
+
"minify": false,
|
|
39
|
+
"clean": false,
|
|
40
|
+
"dts": true
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"dev": "tsup --watch src --watch ../manifest/dist",
|
|
47
|
+
"build": "pnpm nuke:dist && tsup",
|
|
48
|
+
"lint": "eslint .",
|
|
49
|
+
"lint:fix": "pnpm lint --fix",
|
|
50
|
+
"nuke": "pnpm dlx del-cli dist node_modules",
|
|
51
|
+
"nuke:dist": "pnpm dlx del-cli dist",
|
|
52
|
+
"prepublish": "pnpm build"
|
|
53
|
+
}
|
|
54
|
+
}
|