@twinfinity/printing 6.0.1-ci.28952-beta → 6.0.2-beta
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 -3
- package/dist/BuildInfo.js +3 -3
- package/dist/BuildInfo.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/layout/analyzeTemplate.js.map +1 -1
- package/dist/layout/clipUtils.js.map +1 -1
- package/dist/layout/colorConstants.js.map +1 -1
- package/dist/layout/elementKinds.js.map +1 -1
- package/dist/layout/exportDrawing.js.map +1 -1
- package/dist/layout/filters.js.map +1 -1
- package/dist/layout/geometryConstants.js.map +1 -1
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/itemBuilders.js.map +1 -1
- package/dist/layout/labelsRender.js.map +1 -1
- package/dist/layout/legendConstants.js.map +1 -1
- package/dist/layout/legendRender.js.map +1 -1
- package/dist/layout/legendRows.js.map +1 -1
- package/dist/layout/legendUtils.js.map +1 -1
- package/dist/layout/metadata.js.map +1 -1
- package/dist/layout/model.js.map +1 -1
- package/dist/layout/options.js.map +1 -1
- package/dist/layout/presets.js.map +1 -1
- package/dist/layout/qrRender.js.map +1 -1
- package/dist/layout/renderDrawing.js.map +1 -1
- package/dist/layout/renderUtils.js.map +1 -1
- package/dist/layout/sectionValidation.js.map +1 -1
- package/dist/layout/templateVariables.js.map +1 -1
- package/dist/layout/typeGuards.js.map +1 -1
- package/dist/layout/types.js.map +1 -1
- package/dist/layout/utils.js.map +1 -1
- package/dist/layout/validation.js.map +1 -1
- package/dist/layout/validationHelpers.js.map +1 -1
- package/dist/layout/validationUtils.js.map +1 -1
- package/dist/layout/viewportPrep.js.map +1 -1
- package/dist/layout/viewportRender.js.map +1 -1
- package/dist/layout/viewportUtils.js.map +1 -1
- package/dist/layout/warnings.js.map +1 -1
- package/dist/printToPdf.js.map +1 -1
- package/dist/printToSvg.js.map +1 -1
- package/dist/sections.js.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
- package/src/BuildInfo.ts +41 -41
- package/src/index.ts +10 -10
- package/src/layout/analyzeTemplate.ts +218 -218
- package/src/layout/clipUtils.ts +193 -193
- package/src/layout/colorConstants.ts +16 -16
- package/src/layout/elementKinds.ts +35 -35
- package/src/layout/exportDrawing.ts +206 -206
- package/src/layout/filters.ts +80 -80
- package/src/layout/geometryConstants.ts +11 -11
- package/src/layout/index.ts +671 -671
- package/src/layout/itemBuilders.ts +159 -159
- package/src/layout/labelsRender.ts +170 -170
- package/src/layout/legendConstants.ts +11 -11
- package/src/layout/legendRender.ts +543 -543
- package/src/layout/legendRows.ts +62 -62
- package/src/layout/legendUtils.ts +144 -144
- package/src/layout/metadata.ts +210 -210
- package/src/layout/model.ts +372 -372
- package/src/layout/options.ts +17 -17
- package/src/layout/presets.ts +51 -51
- package/src/layout/qrRender.ts +126 -126
- package/src/layout/qrcode.d.ts +2 -2
- package/src/layout/renderDrawing.ts +710 -710
- package/src/layout/renderUtils.ts +138 -138
- package/src/layout/sectionValidation.ts +2 -2
- package/src/layout/templateVariables.ts +317 -317
- package/src/layout/typeGuards.ts +9 -9
- package/src/layout/types.ts +835 -835
- package/src/layout/utils.ts +85 -85
- package/src/layout/validation.ts +392 -392
- package/src/layout/validationHelpers.ts +59 -59
- package/src/layout/validationUtils.ts +6 -6
- package/src/layout/viewportPrep.ts +351 -351
- package/src/layout/viewportRender.ts +442 -442
- package/src/layout/viewportUtils.ts +50 -50
- package/src/layout/warnings.ts +3 -3
- package/src/printToPdf.ts +108 -108
- package/src/printToSvg.ts +188 -188
- package/src/sections.ts +1019 -1019
- package/src/types.ts +49 -49
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { isNonEmptyString } from './validationUtils';
|
|
2
|
-
import { ValidationIssue } from './types';
|
|
3
|
-
|
|
4
|
-
import { isRecord, getProp } from './typeGuards';
|
|
5
|
-
export { isRecord, getProp };
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Check if path is a valid short path: SetName.propertyName (e.g., "Pset_SpaceCommon.Reference")
|
|
9
|
-
* This is the only accepted format for template paths.
|
|
10
|
-
*/
|
|
11
|
-
export const isShortPath = (path: string): boolean =>
|
|
12
|
-
typeof path === 'string' && /^[A-Za-z_][A-Za-z0-9_]*\.[A-Za-z_][A-Za-z0-9_]*$/.test(path.trim());
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Push a "must use short path" error to the errors array.
|
|
16
|
-
*/
|
|
17
|
-
export const pushShortPathError = (errors: ValidationIssue[], path: string, context: string): void => {
|
|
18
|
-
errors.push({
|
|
19
|
-
path,
|
|
20
|
-
message: `${context} must use short format: SetName.propName (e.g., "Pset_SpaceCommon.Reference")`
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const validateFilterPaths = (
|
|
25
|
-
filters: unknown,
|
|
26
|
-
basePath: string,
|
|
27
|
-
errors: ValidationIssue[],
|
|
28
|
-
context: string
|
|
29
|
-
): void => {
|
|
30
|
-
if (Array.isArray(filters)) {
|
|
31
|
-
filters.forEach((f: unknown, idx: number) => {
|
|
32
|
-
const path = getProp(f, 'path');
|
|
33
|
-
if (isRecord(f) && isNonEmptyString(path) && !isShortPath(path as string)) {
|
|
34
|
-
errors.push({
|
|
35
|
-
path: `${basePath}[${idx}].path`,
|
|
36
|
-
message: `${context} path must use short format: SetName.propName (e.g., "Pset_SpaceCommon.Reference")`
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const validatePathShape = (
|
|
44
|
-
path: string | undefined,
|
|
45
|
-
errors: ValidationIssue[],
|
|
46
|
-
fieldPath: string,
|
|
47
|
-
context: string
|
|
48
|
-
): void => {
|
|
49
|
-
if (!path || !path.trim().length) {
|
|
50
|
-
errors.push({ path: fieldPath, message: `${context} path is required.` });
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
if (!isShortPath(path)) {
|
|
54
|
-
errors.push({
|
|
55
|
-
path: fieldPath,
|
|
56
|
-
message: `${context} path must use short format: SetName.propName (e.g., "Pset_SpaceCommon.Reference")`
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
};
|
|
1
|
+
import { isNonEmptyString } from './validationUtils';
|
|
2
|
+
import { ValidationIssue } from './types';
|
|
3
|
+
|
|
4
|
+
import { isRecord, getProp } from './typeGuards';
|
|
5
|
+
export { isRecord, getProp };
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Check if path is a valid short path: SetName.propertyName (e.g., "Pset_SpaceCommon.Reference")
|
|
9
|
+
* This is the only accepted format for template paths.
|
|
10
|
+
*/
|
|
11
|
+
export const isShortPath = (path: string): boolean =>
|
|
12
|
+
typeof path === 'string' && /^[A-Za-z_][A-Za-z0-9_]*\.[A-Za-z_][A-Za-z0-9_]*$/.test(path.trim());
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Push a "must use short path" error to the errors array.
|
|
16
|
+
*/
|
|
17
|
+
export const pushShortPathError = (errors: ValidationIssue[], path: string, context: string): void => {
|
|
18
|
+
errors.push({
|
|
19
|
+
path,
|
|
20
|
+
message: `${context} must use short format: SetName.propName (e.g., "Pset_SpaceCommon.Reference")`
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const validateFilterPaths = (
|
|
25
|
+
filters: unknown,
|
|
26
|
+
basePath: string,
|
|
27
|
+
errors: ValidationIssue[],
|
|
28
|
+
context: string
|
|
29
|
+
): void => {
|
|
30
|
+
if (Array.isArray(filters)) {
|
|
31
|
+
filters.forEach((f: unknown, idx: number) => {
|
|
32
|
+
const path = getProp(f, 'path');
|
|
33
|
+
if (isRecord(f) && isNonEmptyString(path) && !isShortPath(path as string)) {
|
|
34
|
+
errors.push({
|
|
35
|
+
path: `${basePath}[${idx}].path`,
|
|
36
|
+
message: `${context} path must use short format: SetName.propName (e.g., "Pset_SpaceCommon.Reference")`
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const validatePathShape = (
|
|
44
|
+
path: string | undefined,
|
|
45
|
+
errors: ValidationIssue[],
|
|
46
|
+
fieldPath: string,
|
|
47
|
+
context: string
|
|
48
|
+
): void => {
|
|
49
|
+
if (!path || !path.trim().length) {
|
|
50
|
+
errors.push({ path: fieldPath, message: `${context} path is required.` });
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (!isShortPath(path)) {
|
|
54
|
+
errors.push({
|
|
55
|
+
path: fieldPath,
|
|
56
|
+
message: `${context} path must use short format: SetName.propName (e.g., "Pset_SpaceCommon.Reference")`
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const isNonEmptyString = (value: unknown): value is string =>
|
|
2
|
-
typeof value === 'string' && value.trim().length > 0;
|
|
3
|
-
export const isPositiveNumber = (value: unknown): value is number =>
|
|
4
|
-
typeof value === 'number' && Number.isFinite(value) && value > 0;
|
|
5
|
-
export const isRemoteUrl = (value: string): boolean => /^https?:\/\//i.test(value);
|
|
6
|
-
export const isDataUrl = (value: string): boolean => /^data:/i.test(value);
|
|
1
|
+
export const isNonEmptyString = (value: unknown): value is string =>
|
|
2
|
+
typeof value === 'string' && value.trim().length > 0;
|
|
3
|
+
export const isPositiveNumber = (value: unknown): value is number =>
|
|
4
|
+
typeof value === 'number' && Number.isFinite(value) && value > 0;
|
|
5
|
+
export const isRemoteUrl = (value: string): boolean => /^https?:\/\//i.test(value);
|
|
6
|
+
export const isDataUrl = (value: string): boolean => /^data:/i.test(value);
|