@legalplace/prerenderx 3.8.24-staging.0 → 3.9.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/CHANGELOG.md +28 -0
- package/package.json +10 -9
- package/tests/Prerender.documentMultiple.test.ts +5 -3
- package/.yalc/@legalplace/models-v3-types/.eslintrc +0 -3
- package/.yalc/@legalplace/models-v3-types/.gitlab-ci.yml +0 -30
- package/.yalc/@legalplace/models-v3-types/CHANGELOG.md +0 -1503
- package/.yalc/@legalplace/models-v3-types/README +0 -6
- package/.yalc/@legalplace/models-v3-types/index.ts +0 -915
- package/.yalc/@legalplace/models-v3-types/package.json +0 -16
- package/.yalc/@legalplace/models-v3-types/schema.json +0 -2918
- package/.yalc/@legalplace/models-v3-types/tsconfig.json +0 -22
- package/.yalc/@legalplace/models-v3-types/yalc.sig +0 -1
- package/dist/libs/outputTableRendering.d.ts +0 -16
- package/dist/libs/outputTableRendering.js +0 -130
- package/dist/libs/regionHelpers.d.ts +0 -5
- package/dist/libs/regionHelpers.js +0 -22
- package/yalc.lock +0 -10
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "commonjs",
|
|
4
|
-
"lib": [
|
|
5
|
-
"es6"
|
|
6
|
-
],
|
|
7
|
-
"noImplicitAny": true,
|
|
8
|
-
"noImplicitThis": true,
|
|
9
|
-
"strictFunctionTypes": true,
|
|
10
|
-
"strictNullChecks": true,
|
|
11
|
-
"baseUrl": "../",
|
|
12
|
-
"typeRoots": [
|
|
13
|
-
"../"
|
|
14
|
-
],
|
|
15
|
-
"types": [],
|
|
16
|
-
"noEmit": true,
|
|
17
|
-
"forceConsistentCasingInFileNames": true
|
|
18
|
-
},
|
|
19
|
-
"files": [
|
|
20
|
-
"index.ts"
|
|
21
|
-
]
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
8dafcafb8397571e5cb7e2f8266c3326
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { OptionV3 } from "@legalplace/models-v3-types";
|
|
2
|
-
export type OutputTableCellStyle = Record<string, string>;
|
|
3
|
-
export type OutputTableStyle = {
|
|
4
|
-
columnWidths?: number[];
|
|
5
|
-
width?: number;
|
|
6
|
-
borderStyle?: string;
|
|
7
|
-
borderColor?: string;
|
|
8
|
-
borderWidth?: number;
|
|
9
|
-
};
|
|
10
|
-
export declare const expandOutputTableCellStyle: (styles: OutputTableCellStyle) => OutputTableCellStyle;
|
|
11
|
-
export declare const serializeInlineStyle: (styles: OutputTableCellStyle) => string;
|
|
12
|
-
export declare const buildOutputTableStyleAttr: (tableStyle?: OutputTableStyle) => string;
|
|
13
|
-
export declare const buildOutputTableCellStyleAttr: (cellStyle?: OutputTableCellStyle | null) => string;
|
|
14
|
-
export declare const getOutputTableCellStyle: (option: OptionV3) => OutputTableCellStyle | undefined;
|
|
15
|
-
export declare const replaceOutputTableMarkers: (html: string, renderTable: (tableId: number) => string) => string;
|
|
16
|
-
export declare const stripOutputTableMarkers: (html: string) => string;
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.stripOutputTableMarkers = exports.replaceOutputTableMarkers = exports.getOutputTableCellStyle = exports.buildOutputTableCellStyleAttr = exports.buildOutputTableStyleAttr = exports.serializeInlineStyle = exports.expandOutputTableCellStyle = void 0;
|
|
15
|
-
var DEFAULT_OUTPUT_TABLE_CELL_STYLE = {
|
|
16
|
-
paddingTop: "4px",
|
|
17
|
-
paddingRight: "4px",
|
|
18
|
-
paddingBottom: "4px",
|
|
19
|
-
paddingLeft: "4px",
|
|
20
|
-
borderTopWidth: "1px",
|
|
21
|
-
borderTopStyle: "solid",
|
|
22
|
-
borderTopColor: "#000000",
|
|
23
|
-
borderRightWidth: "1px",
|
|
24
|
-
borderRightStyle: "solid",
|
|
25
|
-
borderRightColor: "#000000",
|
|
26
|
-
borderBottomWidth: "1px",
|
|
27
|
-
borderBottomStyle: "solid",
|
|
28
|
-
borderBottomColor: "#000000",
|
|
29
|
-
borderLeftWidth: "1px",
|
|
30
|
-
borderLeftStyle: "solid",
|
|
31
|
-
borderLeftColor: "#000000",
|
|
32
|
-
};
|
|
33
|
-
var BORDER_SIDES = ["Top", "Right", "Bottom", "Left"];
|
|
34
|
-
var parseBoxShorthand = function (parts) {
|
|
35
|
-
var first = parts[0], second = parts[1], third = parts[2], fourth = parts[3];
|
|
36
|
-
if (parts.length === 1) {
|
|
37
|
-
return [first, first, first, first];
|
|
38
|
-
}
|
|
39
|
-
if (parts.length === 2) {
|
|
40
|
-
return [first, second, first, second];
|
|
41
|
-
}
|
|
42
|
-
if (parts.length === 3) {
|
|
43
|
-
return [first, second, third, second];
|
|
44
|
-
}
|
|
45
|
-
return [first, second, third, fourth];
|
|
46
|
-
};
|
|
47
|
-
var parseBorderShorthand = function (border) {
|
|
48
|
-
var parts = border.trim().split(/\s+/);
|
|
49
|
-
var width = parts.find(function (part) { return /^[0-9.]+(px|pt|em|rem|%)?$/i.test(part); }) || "1px";
|
|
50
|
-
var style = parts.find(function (part) {
|
|
51
|
-
return ["solid", "dashed", "dotted", "double", "none"].includes(part.toLowerCase());
|
|
52
|
-
}) || "solid";
|
|
53
|
-
var color = parts.find(function (part) { return part.startsWith("#") || part.startsWith("rgb"); }) ||
|
|
54
|
-
"#000000";
|
|
55
|
-
return { width: width, style: style, color: color };
|
|
56
|
-
};
|
|
57
|
-
var expandOutputTableCellStyle = function (styles) {
|
|
58
|
-
var expanded = __assign({}, styles);
|
|
59
|
-
if (expanded.padding) {
|
|
60
|
-
var _a = parseBoxShorthand(expanded.padding.trim().split(/\s+/)), top_1 = _a[0], right = _a[1], bottom = _a[2], left = _a[3];
|
|
61
|
-
delete expanded.padding;
|
|
62
|
-
expanded.paddingTop = expanded.paddingTop || top_1;
|
|
63
|
-
expanded.paddingRight = expanded.paddingRight || right;
|
|
64
|
-
expanded.paddingBottom = expanded.paddingBottom || bottom;
|
|
65
|
-
expanded.paddingLeft = expanded.paddingLeft || left;
|
|
66
|
-
}
|
|
67
|
-
if (expanded.border) {
|
|
68
|
-
var _b = parseBorderShorthand(expanded.border), width_1 = _b.width, style_1 = _b.style, color_1 = _b.color;
|
|
69
|
-
delete expanded.border;
|
|
70
|
-
BORDER_SIDES.forEach(function (side) {
|
|
71
|
-
var widthKey = "border".concat(side, "Width");
|
|
72
|
-
var styleKey = "border".concat(side, "Style");
|
|
73
|
-
var colorKey = "border".concat(side, "Color");
|
|
74
|
-
expanded[widthKey] = expanded[widthKey] || width_1;
|
|
75
|
-
expanded[styleKey] = expanded[styleKey] || style_1;
|
|
76
|
-
expanded[colorKey] = expanded[colorKey] || color_1;
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
return expanded;
|
|
80
|
-
};
|
|
81
|
-
exports.expandOutputTableCellStyle = expandOutputTableCellStyle;
|
|
82
|
-
var camelToKebab = function (property) {
|
|
83
|
-
return property.replace(/[A-Z]/g, function (match) { return "-".concat(match.toLowerCase()); });
|
|
84
|
-
};
|
|
85
|
-
var serializeInlineStyle = function (styles) {
|
|
86
|
-
return Object.entries(styles)
|
|
87
|
-
.filter(function (_a) {
|
|
88
|
-
var value = _a[1];
|
|
89
|
-
return value !== undefined && value !== "";
|
|
90
|
-
})
|
|
91
|
-
.map(function (_a) {
|
|
92
|
-
var property = _a[0], value = _a[1];
|
|
93
|
-
return "".concat(camelToKebab(property), ":").concat(value);
|
|
94
|
-
})
|
|
95
|
-
.join(";");
|
|
96
|
-
};
|
|
97
|
-
exports.serializeInlineStyle = serializeInlineStyle;
|
|
98
|
-
var buildOutputTableStyleAttr = function (tableStyle) {
|
|
99
|
-
var styles = [
|
|
100
|
-
"table-layout:fixed",
|
|
101
|
-
"border-spacing:0",
|
|
102
|
-
"border-collapse:collapse",
|
|
103
|
-
];
|
|
104
|
-
if (typeof (tableStyle === null || tableStyle === void 0 ? void 0 : tableStyle.width) === "number") {
|
|
105
|
-
styles.push("width:".concat(tableStyle.width, "%"));
|
|
106
|
-
}
|
|
107
|
-
return " style=\"".concat(styles.join(";"), "\"");
|
|
108
|
-
};
|
|
109
|
-
exports.buildOutputTableStyleAttr = buildOutputTableStyleAttr;
|
|
110
|
-
var buildOutputTableCellStyleAttr = function (cellStyle) {
|
|
111
|
-
var styles = (0, exports.expandOutputTableCellStyle)(__assign(__assign({}, DEFAULT_OUTPUT_TABLE_CELL_STYLE), (cellStyle || {})));
|
|
112
|
-
var serialized = (0, exports.serializeInlineStyle)(styles);
|
|
113
|
-
return serialized.length > 0 ? " style=\"".concat(serialized, "\"") : "";
|
|
114
|
-
};
|
|
115
|
-
exports.buildOutputTableCellStyleAttr = buildOutputTableCellStyleAttr;
|
|
116
|
-
var getOutputTableCellStyle = function (option) {
|
|
117
|
-
return option.meta.cellStyle;
|
|
118
|
-
};
|
|
119
|
-
exports.getOutputTableCellStyle = getOutputTableCellStyle;
|
|
120
|
-
var OUTPUT_TABLE_MARKER_REGEX = /<output-table\s+data-id="(\d+)"\s*><\/output-table>/gi;
|
|
121
|
-
var replaceOutputTableMarkers = function (html, renderTable) {
|
|
122
|
-
return html.replace(OUTPUT_TABLE_MARKER_REGEX, function (_match, tableId) {
|
|
123
|
-
return renderTable(parseInt(tableId, 10));
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
exports.replaceOutputTableMarkers = replaceOutputTableMarkers;
|
|
127
|
-
var stripOutputTableMarkers = function (html) {
|
|
128
|
-
return html.replace(OUTPUT_TABLE_MARKER_REGEX, "");
|
|
129
|
-
};
|
|
130
|
-
exports.stripOutputTableMarkers = stripOutputTableMarkers;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { SectionRoleV3, SectionV3 } from "@legalplace/models-v3-types";
|
|
2
|
-
export type OutputRegionRole = SectionRoleV3;
|
|
3
|
-
export declare const isBodySection: (section: SectionV3) => boolean;
|
|
4
|
-
export declare const isRegionSection: (section: SectionV3, role: OutputRegionRole) => boolean;
|
|
5
|
-
export declare const getSectionIdsForRole: (sections: Record<string, SectionV3>, role: OutputRegionRole) => number[];
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSectionIdsForRole = exports.isRegionSection = exports.isBodySection = void 0;
|
|
4
|
-
var isBodySection = function (section) {
|
|
5
|
-
return !section.role || section.role === "body";
|
|
6
|
-
};
|
|
7
|
-
exports.isBodySection = isBodySection;
|
|
8
|
-
var isRegionSection = function (section, role) {
|
|
9
|
-
if (role === "body")
|
|
10
|
-
return (0, exports.isBodySection)(section);
|
|
11
|
-
return section.role === role;
|
|
12
|
-
};
|
|
13
|
-
exports.isRegionSection = isRegionSection;
|
|
14
|
-
var getSectionIdsForRole = function (sections, role) {
|
|
15
|
-
return Object.keys(sections)
|
|
16
|
-
.map(function (sectionId) { return parseInt(sectionId, 10); })
|
|
17
|
-
.filter(function (sectionId) {
|
|
18
|
-
var section = sections[sectionId];
|
|
19
|
-
return section && (0, exports.isRegionSection)(section, role);
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
exports.getSectionIdsForRole = getSectionIdsForRole;
|