@tailor-cms/ce-table-manifest 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 +3 -0
- package/dist/index.cjs +113 -0
- package/dist/index.d.cts +76 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.js +75 -0
- package/package.json +54 -0
package/README.md
ADDED
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name2 in all)
|
|
9
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/index.ts
|
|
30
|
+
var src_exports = {};
|
|
31
|
+
__export(src_exports, {
|
|
32
|
+
Direction: () => Direction,
|
|
33
|
+
default: () => src_default,
|
|
34
|
+
initState: () => initState,
|
|
35
|
+
name: () => name,
|
|
36
|
+
type: () => type,
|
|
37
|
+
version: () => version
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(src_exports);
|
|
40
|
+
var import_times = __toESM(require("lodash/times"), 1);
|
|
41
|
+
var import_uuid = require("uuid");
|
|
42
|
+
|
|
43
|
+
// src/utils.ts
|
|
44
|
+
var import_find = __toESM(require("lodash/find"), 1);
|
|
45
|
+
function addCell(row, cell) {
|
|
46
|
+
if (!row.cells)
|
|
47
|
+
row.cells = {};
|
|
48
|
+
row.cells[cell.id] = cell;
|
|
49
|
+
return cell;
|
|
50
|
+
}
|
|
51
|
+
function addEmbed(embeds, cellId, tableId) {
|
|
52
|
+
const embed = {
|
|
53
|
+
id: cellId,
|
|
54
|
+
type: "TIPTAP_HTML",
|
|
55
|
+
embedded: true,
|
|
56
|
+
data: { tableId, cellId }
|
|
57
|
+
};
|
|
58
|
+
embeds[cellId] = embed;
|
|
59
|
+
return embed;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// src/interfaces.ts
|
|
63
|
+
var Direction = /* @__PURE__ */ ((Direction2) => {
|
|
64
|
+
Direction2[Direction2["Before"] = -1] = "Before";
|
|
65
|
+
Direction2[Direction2["After"] = 1] = "After";
|
|
66
|
+
return Direction2;
|
|
67
|
+
})(Direction || {});
|
|
68
|
+
|
|
69
|
+
// src/index.ts
|
|
70
|
+
var type = "TABLE";
|
|
71
|
+
var name = "Table";
|
|
72
|
+
var initState = () => {
|
|
73
|
+
const tableId = (0, import_uuid.v4)();
|
|
74
|
+
const embeds = {};
|
|
75
|
+
const rows = {};
|
|
76
|
+
(0, import_times.default)(2, (position) => {
|
|
77
|
+
const rowId = (0, import_uuid.v4)();
|
|
78
|
+
const row = { id: rowId, position, cells: {} };
|
|
79
|
+
rows[rowId] = row;
|
|
80
|
+
(0, import_times.default)(3, (position2) => {
|
|
81
|
+
const cellId = (0, import_uuid.v4)();
|
|
82
|
+
addCell(row, { id: cellId, position: position2, data: {} });
|
|
83
|
+
addEmbed(embeds, cellId, tableId);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
return { tableId, embeds, rows };
|
|
87
|
+
};
|
|
88
|
+
var version = "1.0";
|
|
89
|
+
var ui = {
|
|
90
|
+
// Display icon, https://pictogrammers.com/library/mdi/
|
|
91
|
+
icon: "mdi-table",
|
|
92
|
+
// Does element support only full width or can be used within layouts
|
|
93
|
+
// (e.g. 50/50 layout)
|
|
94
|
+
forceFullWidth: true
|
|
95
|
+
};
|
|
96
|
+
var manifest = {
|
|
97
|
+
type,
|
|
98
|
+
version: "1.0",
|
|
99
|
+
name,
|
|
100
|
+
ssr: false,
|
|
101
|
+
isComposite: true,
|
|
102
|
+
initState,
|
|
103
|
+
ui
|
|
104
|
+
};
|
|
105
|
+
var src_default = manifest;
|
|
106
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
107
|
+
0 && (module.exports = {
|
|
108
|
+
Direction,
|
|
109
|
+
initState,
|
|
110
|
+
name,
|
|
111
|
+
type,
|
|
112
|
+
version
|
|
113
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
declare enum Direction {
|
|
2
|
+
Before = -1,
|
|
3
|
+
After = 1
|
|
4
|
+
}
|
|
5
|
+
type Embed = any;
|
|
6
|
+
type Embeds = Record<string, Embed>;
|
|
7
|
+
interface Cell {
|
|
8
|
+
id: string;
|
|
9
|
+
data: Record<string, any>;
|
|
10
|
+
position: number;
|
|
11
|
+
}
|
|
12
|
+
type Cells = Record<string, Cell>;
|
|
13
|
+
interface Row {
|
|
14
|
+
id: string;
|
|
15
|
+
position: number;
|
|
16
|
+
cells: Cells;
|
|
17
|
+
}
|
|
18
|
+
type Rows = Record<string, Row>;
|
|
19
|
+
interface ElementData {
|
|
20
|
+
tableId: string;
|
|
21
|
+
embeds: Embeds;
|
|
22
|
+
rows: Rows;
|
|
23
|
+
}
|
|
24
|
+
interface Element {
|
|
25
|
+
id: number;
|
|
26
|
+
uid: string;
|
|
27
|
+
activityId: number;
|
|
28
|
+
repositoryId: number;
|
|
29
|
+
contentId: string;
|
|
30
|
+
contentSignature: string;
|
|
31
|
+
type: string;
|
|
32
|
+
position: number;
|
|
33
|
+
data: ElementData;
|
|
34
|
+
meta: {
|
|
35
|
+
[key: string]: unknown;
|
|
36
|
+
};
|
|
37
|
+
refs: {
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
};
|
|
40
|
+
linked: boolean;
|
|
41
|
+
detached: boolean;
|
|
42
|
+
createdAt: string;
|
|
43
|
+
updatedAt: string;
|
|
44
|
+
deletedAt: string | null;
|
|
45
|
+
}
|
|
46
|
+
type DataInitializer = () => ElementData;
|
|
47
|
+
interface ElementManifest {
|
|
48
|
+
type: string;
|
|
49
|
+
version: string;
|
|
50
|
+
name: string;
|
|
51
|
+
ssr: boolean;
|
|
52
|
+
isComposite?: boolean;
|
|
53
|
+
initState: DataInitializer;
|
|
54
|
+
Edit?: object;
|
|
55
|
+
TopToolbar?: object;
|
|
56
|
+
SideToolbar?: object;
|
|
57
|
+
Display?: object;
|
|
58
|
+
ui: {
|
|
59
|
+
icon: string;
|
|
60
|
+
forceFullWidth: boolean;
|
|
61
|
+
};
|
|
62
|
+
mocks?: {
|
|
63
|
+
displayContexts: Array<{
|
|
64
|
+
name: string;
|
|
65
|
+
data: any;
|
|
66
|
+
}>;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
declare const type = "TABLE";
|
|
71
|
+
declare const name = "Table";
|
|
72
|
+
declare const initState: DataInitializer;
|
|
73
|
+
declare const version = "1.0";
|
|
74
|
+
declare const manifest: ElementManifest;
|
|
75
|
+
|
|
76
|
+
export { type Cell, type Cells, type DataInitializer, Direction, type Element, type ElementData, type ElementManifest, type Embed, type Embeds, type Row, type Rows, manifest as default, initState, name, type, version };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
declare enum Direction {
|
|
2
|
+
Before = -1,
|
|
3
|
+
After = 1
|
|
4
|
+
}
|
|
5
|
+
type Embed = any;
|
|
6
|
+
type Embeds = Record<string, Embed>;
|
|
7
|
+
interface Cell {
|
|
8
|
+
id: string;
|
|
9
|
+
data: Record<string, any>;
|
|
10
|
+
position: number;
|
|
11
|
+
}
|
|
12
|
+
type Cells = Record<string, Cell>;
|
|
13
|
+
interface Row {
|
|
14
|
+
id: string;
|
|
15
|
+
position: number;
|
|
16
|
+
cells: Cells;
|
|
17
|
+
}
|
|
18
|
+
type Rows = Record<string, Row>;
|
|
19
|
+
interface ElementData {
|
|
20
|
+
tableId: string;
|
|
21
|
+
embeds: Embeds;
|
|
22
|
+
rows: Rows;
|
|
23
|
+
}
|
|
24
|
+
interface Element {
|
|
25
|
+
id: number;
|
|
26
|
+
uid: string;
|
|
27
|
+
activityId: number;
|
|
28
|
+
repositoryId: number;
|
|
29
|
+
contentId: string;
|
|
30
|
+
contentSignature: string;
|
|
31
|
+
type: string;
|
|
32
|
+
position: number;
|
|
33
|
+
data: ElementData;
|
|
34
|
+
meta: {
|
|
35
|
+
[key: string]: unknown;
|
|
36
|
+
};
|
|
37
|
+
refs: {
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
};
|
|
40
|
+
linked: boolean;
|
|
41
|
+
detached: boolean;
|
|
42
|
+
createdAt: string;
|
|
43
|
+
updatedAt: string;
|
|
44
|
+
deletedAt: string | null;
|
|
45
|
+
}
|
|
46
|
+
type DataInitializer = () => ElementData;
|
|
47
|
+
interface ElementManifest {
|
|
48
|
+
type: string;
|
|
49
|
+
version: string;
|
|
50
|
+
name: string;
|
|
51
|
+
ssr: boolean;
|
|
52
|
+
isComposite?: boolean;
|
|
53
|
+
initState: DataInitializer;
|
|
54
|
+
Edit?: object;
|
|
55
|
+
TopToolbar?: object;
|
|
56
|
+
SideToolbar?: object;
|
|
57
|
+
Display?: object;
|
|
58
|
+
ui: {
|
|
59
|
+
icon: string;
|
|
60
|
+
forceFullWidth: boolean;
|
|
61
|
+
};
|
|
62
|
+
mocks?: {
|
|
63
|
+
displayContexts: Array<{
|
|
64
|
+
name: string;
|
|
65
|
+
data: any;
|
|
66
|
+
}>;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
declare const type = "TABLE";
|
|
71
|
+
declare const name = "Table";
|
|
72
|
+
declare const initState: DataInitializer;
|
|
73
|
+
declare const version = "1.0";
|
|
74
|
+
declare const manifest: ElementManifest;
|
|
75
|
+
|
|
76
|
+
export { type Cell, type Cells, type DataInitializer, Direction, type Element, type ElementData, type ElementManifest, type Embed, type Embeds, type Row, type Rows, manifest as default, initState, name, type, version };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import times from "lodash/times";
|
|
3
|
+
import { v4 as uuid } from "uuid";
|
|
4
|
+
|
|
5
|
+
// src/utils.ts
|
|
6
|
+
import find from "lodash/find";
|
|
7
|
+
function addCell(row, cell) {
|
|
8
|
+
if (!row.cells)
|
|
9
|
+
row.cells = {};
|
|
10
|
+
row.cells[cell.id] = cell;
|
|
11
|
+
return cell;
|
|
12
|
+
}
|
|
13
|
+
function addEmbed(embeds, cellId, tableId) {
|
|
14
|
+
const embed = {
|
|
15
|
+
id: cellId,
|
|
16
|
+
type: "TIPTAP_HTML",
|
|
17
|
+
embedded: true,
|
|
18
|
+
data: { tableId, cellId }
|
|
19
|
+
};
|
|
20
|
+
embeds[cellId] = embed;
|
|
21
|
+
return embed;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// src/interfaces.ts
|
|
25
|
+
var Direction = /* @__PURE__ */ ((Direction2) => {
|
|
26
|
+
Direction2[Direction2["Before"] = -1] = "Before";
|
|
27
|
+
Direction2[Direction2["After"] = 1] = "After";
|
|
28
|
+
return Direction2;
|
|
29
|
+
})(Direction || {});
|
|
30
|
+
|
|
31
|
+
// src/index.ts
|
|
32
|
+
var type = "TABLE";
|
|
33
|
+
var name = "Table";
|
|
34
|
+
var initState = () => {
|
|
35
|
+
const tableId = uuid();
|
|
36
|
+
const embeds = {};
|
|
37
|
+
const rows = {};
|
|
38
|
+
times(2, (position) => {
|
|
39
|
+
const rowId = uuid();
|
|
40
|
+
const row = { id: rowId, position, cells: {} };
|
|
41
|
+
rows[rowId] = row;
|
|
42
|
+
times(3, (position2) => {
|
|
43
|
+
const cellId = uuid();
|
|
44
|
+
addCell(row, { id: cellId, position: position2, data: {} });
|
|
45
|
+
addEmbed(embeds, cellId, tableId);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
return { tableId, embeds, rows };
|
|
49
|
+
};
|
|
50
|
+
var version = "1.0";
|
|
51
|
+
var ui = {
|
|
52
|
+
// Display icon, https://pictogrammers.com/library/mdi/
|
|
53
|
+
icon: "mdi-table",
|
|
54
|
+
// Does element support only full width or can be used within layouts
|
|
55
|
+
// (e.g. 50/50 layout)
|
|
56
|
+
forceFullWidth: true
|
|
57
|
+
};
|
|
58
|
+
var manifest = {
|
|
59
|
+
type,
|
|
60
|
+
version: "1.0",
|
|
61
|
+
name,
|
|
62
|
+
ssr: false,
|
|
63
|
+
isComposite: true,
|
|
64
|
+
initState,
|
|
65
|
+
ui
|
|
66
|
+
};
|
|
67
|
+
var src_default = manifest;
|
|
68
|
+
export {
|
|
69
|
+
Direction,
|
|
70
|
+
src_default as default,
|
|
71
|
+
initState,
|
|
72
|
+
name,
|
|
73
|
+
type,
|
|
74
|
+
version
|
|
75
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tailor-cms/ce-table-manifest",
|
|
3
|
+
"description": "Tailor CMS table manifest",
|
|
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/eslint-config": "0.0.2",
|
|
20
|
+
"@types/lodash": "^4.17.14",
|
|
21
|
+
"tsup": "^7.2.0",
|
|
22
|
+
"typescript": "^5.1.6"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"lodash": "^4.17.21",
|
|
26
|
+
"uuid": "^11.0.5"
|
|
27
|
+
},
|
|
28
|
+
"tsup": {
|
|
29
|
+
"entry": [
|
|
30
|
+
"src/index.ts"
|
|
31
|
+
],
|
|
32
|
+
"target": [
|
|
33
|
+
"node14",
|
|
34
|
+
"es2022"
|
|
35
|
+
],
|
|
36
|
+
"format": [
|
|
37
|
+
"cjs",
|
|
38
|
+
"esm"
|
|
39
|
+
],
|
|
40
|
+
"bundle": true,
|
|
41
|
+
"minify": false,
|
|
42
|
+
"clean": false,
|
|
43
|
+
"dts": true
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"dev": "tsup --watch",
|
|
50
|
+
"build": "tsup",
|
|
51
|
+
"lint": "eslint --ext .js,.ts .",
|
|
52
|
+
"lint:fix": "pnpm lint --fix"
|
|
53
|
+
}
|
|
54
|
+
}
|