@tailor-cms/ce-modal-manifest 0.0.2 → 0.1.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/index.cjs +51 -6
- package/dist/index.d.cts +26 -47
- package/dist/index.d.ts +26 -47
- package/dist/index.js +47 -3
- package/package.json +14 -7
package/dist/index.cjs
CHANGED
|
@@ -17,15 +17,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
19
|
// src/index.ts
|
|
20
|
-
var
|
|
21
|
-
__export(
|
|
22
|
-
|
|
20
|
+
var index_exports = {};
|
|
21
|
+
__export(index_exports, {
|
|
22
|
+
ai: () => ai,
|
|
23
|
+
default: () => index_default,
|
|
23
24
|
initState: () => initState,
|
|
24
25
|
name: () => name,
|
|
25
26
|
type: () => type,
|
|
26
27
|
version: () => version
|
|
27
28
|
});
|
|
28
|
-
module.exports = __toCommonJS(
|
|
29
|
+
module.exports = __toCommonJS(index_exports);
|
|
30
|
+
var import_uuid = require("uuid");
|
|
29
31
|
var type = "MODAL";
|
|
30
32
|
var name = "Modal";
|
|
31
33
|
var initState = () => ({
|
|
@@ -40,6 +42,47 @@ var ui = {
|
|
|
40
42
|
// (e.g. 50/50 layout)
|
|
41
43
|
forceFullWidth: false
|
|
42
44
|
};
|
|
45
|
+
var ai = {
|
|
46
|
+
Schema: {
|
|
47
|
+
type: "json_schema",
|
|
48
|
+
name: "ce_modal",
|
|
49
|
+
schema: {
|
|
50
|
+
type: "object",
|
|
51
|
+
properties: {
|
|
52
|
+
title: { type: "string" },
|
|
53
|
+
content: { type: "string" }
|
|
54
|
+
},
|
|
55
|
+
required: ["title", "content"],
|
|
56
|
+
additionalProperties: false
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
getPrompt: () => `
|
|
60
|
+
Generate a modal content element as an object with the following
|
|
61
|
+
properties:
|
|
62
|
+
{
|
|
63
|
+
"title": "",
|
|
64
|
+
"content": "",
|
|
65
|
+
}
|
|
66
|
+
where:
|
|
67
|
+
- 'title' is the title of the modal. Do not use more than 3 words.
|
|
68
|
+
- 'content' is the text to be displayed in the modal. Create few
|
|
69
|
+
paragraphs about the topic.
|
|
70
|
+
`,
|
|
71
|
+
processResponse: (val) => {
|
|
72
|
+
const embedId = (0, import_uuid.v4)();
|
|
73
|
+
const embed = {
|
|
74
|
+
id: embedId,
|
|
75
|
+
data: { content: val.content },
|
|
76
|
+
embedded: true,
|
|
77
|
+
position: 1,
|
|
78
|
+
type: "TIPTAP_HTML"
|
|
79
|
+
};
|
|
80
|
+
return {
|
|
81
|
+
title: val.title,
|
|
82
|
+
embeds: { [embedId]: embed }
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
};
|
|
43
86
|
var manifest = {
|
|
44
87
|
type,
|
|
45
88
|
version: "1.0",
|
|
@@ -47,11 +90,13 @@ var manifest = {
|
|
|
47
90
|
ssr: false,
|
|
48
91
|
isComposite: true,
|
|
49
92
|
initState,
|
|
50
|
-
ui
|
|
93
|
+
ui,
|
|
94
|
+
ai
|
|
51
95
|
};
|
|
52
|
-
var
|
|
96
|
+
var index_default = manifest;
|
|
53
97
|
// Annotate the CommonJS export names for ESM import in node:
|
|
54
98
|
0 && (module.exports = {
|
|
99
|
+
ai,
|
|
55
100
|
initState,
|
|
56
101
|
name,
|
|
57
102
|
type,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,57 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
import * as common from '@tailor-cms/cek-common';
|
|
2
|
+
import { OpenAISchema } from '@tailor-cms/cek-common';
|
|
3
|
+
|
|
4
|
+
interface ElementData extends common.ElementConfig {
|
|
2
5
|
title: string | null;
|
|
3
6
|
embeds: Record<string, any>;
|
|
4
7
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
activityId: number;
|
|
9
|
-
repositoryId: number;
|
|
10
|
-
contentId: string;
|
|
11
|
-
contentSignature: string;
|
|
12
|
-
type: string;
|
|
13
|
-
position: number;
|
|
14
|
-
data: ElementData;
|
|
15
|
-
meta: {
|
|
16
|
-
[key: string]: unknown;
|
|
17
|
-
};
|
|
18
|
-
refs: {
|
|
19
|
-
[key: string]: unknown;
|
|
20
|
-
};
|
|
21
|
-
linked: boolean;
|
|
22
|
-
detached: boolean;
|
|
23
|
-
createdAt: string;
|
|
24
|
-
updatedAt: string;
|
|
25
|
-
deletedAt: string | null;
|
|
26
|
-
}
|
|
27
|
-
type DataInitializer = () => ElementData;
|
|
28
|
-
interface ElementManifest {
|
|
29
|
-
type: string;
|
|
30
|
-
version: string;
|
|
31
|
-
name: string;
|
|
32
|
-
ssr: boolean;
|
|
33
|
-
isComposite: boolean;
|
|
34
|
-
initState: DataInitializer;
|
|
35
|
-
Edit?: object;
|
|
36
|
-
TopToolbar?: object;
|
|
37
|
-
SideToolbar?: object;
|
|
38
|
-
Display?: object;
|
|
39
|
-
ui: {
|
|
40
|
-
icon: string;
|
|
41
|
-
forceFullWidth: boolean;
|
|
42
|
-
};
|
|
43
|
-
mocks?: {
|
|
44
|
-
displayContexts: Array<{
|
|
45
|
-
name: string;
|
|
46
|
-
data: any;
|
|
47
|
-
}>;
|
|
48
|
-
};
|
|
49
|
-
}
|
|
8
|
+
type DataInitializer = common.DataInitializer<ElementData>;
|
|
9
|
+
type Element = common.Element<ElementData>;
|
|
10
|
+
type ElementManifest = common.ElementManifest<ElementData>;
|
|
50
11
|
|
|
51
12
|
declare const type = "MODAL";
|
|
52
13
|
declare const name = "Modal";
|
|
53
14
|
declare const initState: DataInitializer;
|
|
54
15
|
declare const version = "1.0";
|
|
16
|
+
declare const ai: {
|
|
17
|
+
Schema: OpenAISchema;
|
|
18
|
+
getPrompt: () => string;
|
|
19
|
+
processResponse: (val: any) => {
|
|
20
|
+
title: any;
|
|
21
|
+
embeds: {
|
|
22
|
+
[x: string]: {
|
|
23
|
+
id: string;
|
|
24
|
+
data: {
|
|
25
|
+
content: any;
|
|
26
|
+
};
|
|
27
|
+
embedded: boolean;
|
|
28
|
+
position: number;
|
|
29
|
+
type: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
55
34
|
declare const manifest: ElementManifest;
|
|
56
35
|
|
|
57
|
-
export { type DataInitializer, type Element, type ElementData, type ElementManifest, manifest as default, initState, name, type, version };
|
|
36
|
+
export { type DataInitializer, type Element, type ElementData, type ElementManifest, ai, manifest as default, initState, name, type, version };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,57 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
import * as common from '@tailor-cms/cek-common';
|
|
2
|
+
import { OpenAISchema } from '@tailor-cms/cek-common';
|
|
3
|
+
|
|
4
|
+
interface ElementData extends common.ElementConfig {
|
|
2
5
|
title: string | null;
|
|
3
6
|
embeds: Record<string, any>;
|
|
4
7
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
activityId: number;
|
|
9
|
-
repositoryId: number;
|
|
10
|
-
contentId: string;
|
|
11
|
-
contentSignature: string;
|
|
12
|
-
type: string;
|
|
13
|
-
position: number;
|
|
14
|
-
data: ElementData;
|
|
15
|
-
meta: {
|
|
16
|
-
[key: string]: unknown;
|
|
17
|
-
};
|
|
18
|
-
refs: {
|
|
19
|
-
[key: string]: unknown;
|
|
20
|
-
};
|
|
21
|
-
linked: boolean;
|
|
22
|
-
detached: boolean;
|
|
23
|
-
createdAt: string;
|
|
24
|
-
updatedAt: string;
|
|
25
|
-
deletedAt: string | null;
|
|
26
|
-
}
|
|
27
|
-
type DataInitializer = () => ElementData;
|
|
28
|
-
interface ElementManifest {
|
|
29
|
-
type: string;
|
|
30
|
-
version: string;
|
|
31
|
-
name: string;
|
|
32
|
-
ssr: boolean;
|
|
33
|
-
isComposite: boolean;
|
|
34
|
-
initState: DataInitializer;
|
|
35
|
-
Edit?: object;
|
|
36
|
-
TopToolbar?: object;
|
|
37
|
-
SideToolbar?: object;
|
|
38
|
-
Display?: object;
|
|
39
|
-
ui: {
|
|
40
|
-
icon: string;
|
|
41
|
-
forceFullWidth: boolean;
|
|
42
|
-
};
|
|
43
|
-
mocks?: {
|
|
44
|
-
displayContexts: Array<{
|
|
45
|
-
name: string;
|
|
46
|
-
data: any;
|
|
47
|
-
}>;
|
|
48
|
-
};
|
|
49
|
-
}
|
|
8
|
+
type DataInitializer = common.DataInitializer<ElementData>;
|
|
9
|
+
type Element = common.Element<ElementData>;
|
|
10
|
+
type ElementManifest = common.ElementManifest<ElementData>;
|
|
50
11
|
|
|
51
12
|
declare const type = "MODAL";
|
|
52
13
|
declare const name = "Modal";
|
|
53
14
|
declare const initState: DataInitializer;
|
|
54
15
|
declare const version = "1.0";
|
|
16
|
+
declare const ai: {
|
|
17
|
+
Schema: OpenAISchema;
|
|
18
|
+
getPrompt: () => string;
|
|
19
|
+
processResponse: (val: any) => {
|
|
20
|
+
title: any;
|
|
21
|
+
embeds: {
|
|
22
|
+
[x: string]: {
|
|
23
|
+
id: string;
|
|
24
|
+
data: {
|
|
25
|
+
content: any;
|
|
26
|
+
};
|
|
27
|
+
embedded: boolean;
|
|
28
|
+
position: number;
|
|
29
|
+
type: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
55
34
|
declare const manifest: ElementManifest;
|
|
56
35
|
|
|
57
|
-
export { type DataInitializer, type Element, type ElementData, type ElementManifest, manifest as default, initState, name, type, version };
|
|
36
|
+
export { type DataInitializer, type Element, type ElementData, type ElementManifest, ai, manifest as default, initState, name, type, version };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
+
import { v4 as uuid } from "uuid";
|
|
2
3
|
var type = "MODAL";
|
|
3
4
|
var name = "Modal";
|
|
4
5
|
var initState = () => ({
|
|
@@ -13,6 +14,47 @@ var ui = {
|
|
|
13
14
|
// (e.g. 50/50 layout)
|
|
14
15
|
forceFullWidth: false
|
|
15
16
|
};
|
|
17
|
+
var ai = {
|
|
18
|
+
Schema: {
|
|
19
|
+
type: "json_schema",
|
|
20
|
+
name: "ce_modal",
|
|
21
|
+
schema: {
|
|
22
|
+
type: "object",
|
|
23
|
+
properties: {
|
|
24
|
+
title: { type: "string" },
|
|
25
|
+
content: { type: "string" }
|
|
26
|
+
},
|
|
27
|
+
required: ["title", "content"],
|
|
28
|
+
additionalProperties: false
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
getPrompt: () => `
|
|
32
|
+
Generate a modal content element as an object with the following
|
|
33
|
+
properties:
|
|
34
|
+
{
|
|
35
|
+
"title": "",
|
|
36
|
+
"content": "",
|
|
37
|
+
}
|
|
38
|
+
where:
|
|
39
|
+
- 'title' is the title of the modal. Do not use more than 3 words.
|
|
40
|
+
- 'content' is the text to be displayed in the modal. Create few
|
|
41
|
+
paragraphs about the topic.
|
|
42
|
+
`,
|
|
43
|
+
processResponse: (val) => {
|
|
44
|
+
const embedId = uuid();
|
|
45
|
+
const embed = {
|
|
46
|
+
id: embedId,
|
|
47
|
+
data: { content: val.content },
|
|
48
|
+
embedded: true,
|
|
49
|
+
position: 1,
|
|
50
|
+
type: "TIPTAP_HTML"
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
title: val.title,
|
|
54
|
+
embeds: { [embedId]: embed }
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
};
|
|
16
58
|
var manifest = {
|
|
17
59
|
type,
|
|
18
60
|
version: "1.0",
|
|
@@ -20,11 +62,13 @@ var manifest = {
|
|
|
20
62
|
ssr: false,
|
|
21
63
|
isComposite: true,
|
|
22
64
|
initState,
|
|
23
|
-
ui
|
|
65
|
+
ui,
|
|
66
|
+
ai
|
|
24
67
|
};
|
|
25
|
-
var
|
|
68
|
+
var index_default = manifest;
|
|
26
69
|
export {
|
|
27
|
-
|
|
70
|
+
ai,
|
|
71
|
+
index_default as default,
|
|
28
72
|
initState,
|
|
29
73
|
name,
|
|
30
74
|
type,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Tailor CMS modal manifest",
|
|
4
4
|
"author": "Studion <info@gostudion.com> (https://github.com/tailor-cms)",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "0.0
|
|
6
|
+
"version": "0.1.0",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"import": "./dist/index.js",
|
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@tailor-cms/
|
|
20
|
-
"
|
|
21
|
-
"
|
|
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"
|
|
22
23
|
},
|
|
23
24
|
"tsup": {
|
|
24
25
|
"entry": [
|
|
@@ -40,10 +41,16 @@
|
|
|
40
41
|
"publishConfig": {
|
|
41
42
|
"access": "public"
|
|
42
43
|
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"uuid": "^11.1.0"
|
|
46
|
+
},
|
|
43
47
|
"scripts": {
|
|
44
48
|
"dev": "tsup --watch",
|
|
45
|
-
"build": "tsup",
|
|
46
|
-
"lint": "eslint
|
|
47
|
-
"lint:fix": "pnpm lint --fix"
|
|
49
|
+
"build": "pnpm nuke:dist && tsup",
|
|
50
|
+
"lint": "eslint .",
|
|
51
|
+
"lint:fix": "pnpm lint --fix",
|
|
52
|
+
"nuke": "pnpm dlx del-cli dist node_modules",
|
|
53
|
+
"nuke:dist": "pnpm dlx del-cli dist",
|
|
54
|
+
"prepublish": "pnpm build"
|
|
48
55
|
}
|
|
49
56
|
}
|