@openframe-org/criteria-set-protocol 2.6.6-beta.4 → 2.6.6-beta.6

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.
@@ -1,25 +1,44 @@
1
- import { Color, CriteriaTree, CriteriaTreeElement, Theme, Criterion, Task, TaskGroup, TaskItem, ThemeOptions, CriterionOptions, TaskOptions, CertificationDefinition, TaskItemValue, TaskItemData, ElementData, TreeResult } from "./types";
2
- interface ApplyTextFormattingPlaceholdersForThemeFunction {
3
- (options: ThemeOptions, element: Pick<Task, "title" | "code">): string;
4
- }
5
- interface ApplyTextFormattingPlaceholdersForCriterionFunction {
6
- (options: CriterionOptions, element: Pick<Task, "title" | "code">): string;
7
- }
8
- interface ApplyTextFormattingPlaceholdersForTaskFunction {
9
- (options: TaskOptions, element: Pick<Task, "title" | "code">): string;
10
- }
1
+ import { Color, CriteriaTree, CriteriaTreeElement, Theme, Criterion, Task, TaskGroup, TaskItem, CertificationDefinition, TaskItemValue, TaskItemData, ElementData, TreeResult } from "./types";
11
2
  interface ApplyBreadcrumbTextFormattingPlaceholdersFunction {
12
- (options: ThemeOptions, element: Pick<Criterion, "title" | "code">): string;
13
- (options: CriterionOptions, element: Pick<Criterion, "title" | "code">): string;
14
- (options: TaskOptions, element: Pick<Task, "title" | "code">): string;
3
+ (options: {
4
+ breadcrumbTextFormat: string | undefined;
5
+ }, element: Pick<Criterion, "title" | "code">): string;
6
+ (options: {
7
+ breadcrumbTextFormat: string | undefined;
8
+ }, element: Pick<Criterion, "title" | "code">): string;
9
+ (options: {
10
+ breadcrumbTextFormat: string | undefined;
11
+ }, element: Pick<Task, "title" | "code">): string;
15
12
  }
16
- interface ApplyDocumentTreeFolderTextFormattingPlaceholdersFunction extends ApplyTextFormattingPlaceholdersForThemeFunction, ApplyTextFormattingPlaceholdersForCriterionFunction, ApplyTextFormattingPlaceholdersForTaskFunction {
13
+ interface ApplyDocumentTreeFolderTextFormattingPlaceholdersFunction {
14
+ (options: {
15
+ documentTreeFolderTextFormat: string | undefined;
16
+ }, element: Pick<Criterion, "title" | "code">): string;
17
+ (options: {
18
+ documentTreeFolderTextFormat: string | undefined;
19
+ }, element: Pick<Criterion, "title" | "code">): string;
20
+ (options: {
21
+ documentTreeFolderTextFormat: string | undefined;
22
+ }, element: Pick<Task, "title" | "code">): string;
17
23
  }
18
24
  interface ApplyCriteriaTreeElementTextFormatFormattingPlaceholdersFunction {
19
- (options: Pick<CriterionOptions, 'criteriaTreeElementTextFormat'>, element: Pick<Criterion, "title" | "code">): string;
20
- (options: Pick<TaskOptions, 'criteriaTreeElementTextFormat'>, element: Pick<Task, "title" | "code">): string;
25
+ (options: {
26
+ criteriaTreeElementTextFormat: string | undefined;
27
+ }, element: Pick<Criterion, "title" | "code">): string;
28
+ (options: {
29
+ criteriaTreeElementTextFormat: string | undefined;
30
+ }, element: Pick<Task, "title" | "code">): string;
21
31
  }
22
- interface ApplyReportTitleTextFormatFormattingPlaceholdersFunction extends ApplyTextFormattingPlaceholdersForThemeFunction, ApplyTextFormattingPlaceholdersForCriterionFunction, ApplyTextFormattingPlaceholdersForTaskFunction {
32
+ interface ApplyReportTitleTextFormatFormattingPlaceholdersFunction {
33
+ (options: {
34
+ reportTitleTextFormat: string | undefined;
35
+ }, element: Pick<Criterion, "title" | "code">): string;
36
+ (options: {
37
+ reportTitleTextFormat: string | undefined;
38
+ }, element: Pick<Criterion, "title" | "code">): string;
39
+ (options: {
40
+ reportTitleTextFormat: string | undefined;
41
+ }, element: Pick<Task, "title" | "code">): string;
23
42
  }
24
43
  export declare const isTheme: (element: CriteriaTreeElement) => element is Theme;
25
44
  export declare const isCriterion: (element: CriteriaTreeElement) => element is Criterion;
package/dist/v1/utils.js CHANGED
@@ -45,14 +45,14 @@ exports.findInTree = findInTree;
45
45
  /**
46
46
  * Apply the text formatting used in document tree folder naming
47
47
  */
48
- const applyBreadcrumbTextFormattingPlaceholders = (options, { title, code }) => ("breadcrumbTextFormat" in options ? options.breadcrumbTextFormat : ":code:")
48
+ const applyBreadcrumbTextFormattingPlaceholders = ({ breadcrumbTextFormat = ':code:' }, { title, code }) => breadcrumbTextFormat
49
49
  .replace(/:code:/g, code)
50
50
  .replace(/:title:/g, title);
51
51
  exports.applyBreadcrumbTextFormattingPlaceholders = applyBreadcrumbTextFormattingPlaceholders;
52
52
  /**
53
53
  * Apply the text formatting used in the document tree
54
54
  */
55
- const applyDocumentTreeFolderTextFormattingPlaceholders = (options, { title, code }) => ("documentTreeFolderTextFormat" in options ? options.documentTreeFolderTextFormat : ":code:")
55
+ const applyDocumentTreeFolderTextFormattingPlaceholders = ({ documentTreeFolderTextFormat = ':code:' }, { title, code }) => documentTreeFolderTextFormat
56
56
  .replace(/:code:/g, code)
57
57
  .replace(/:title:/g, title);
58
58
  exports.applyDocumentTreeFolderTextFormattingPlaceholders = applyDocumentTreeFolderTextFormattingPlaceholders;
@@ -66,7 +66,7 @@ exports.applyCriteriaTreeElementTextFormatFormattingPlaceholders = applyCriteria
66
66
  /**
67
67
  * Apply the text formatting used in the report title
68
68
  */
69
- const applyReportTitleTextFormatFormattingPlaceholders = ({ reportTitleTextFormat }, { title, code }) => (reportTitleTextFormat !== null && reportTitleTextFormat !== void 0 ? reportTitleTextFormat : ":title:")
69
+ const applyReportTitleTextFormatFormattingPlaceholders = ({ reportTitleTextFormat = ':title:' }, { title, code }) => reportTitleTextFormat
70
70
  .replace(/:code:/g, code)
71
71
  .replace(/:title:/g, title);
72
72
  exports.applyReportTitleTextFormatFormattingPlaceholders = applyReportTitleTextFormatFormattingPlaceholders;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openframe-org/criteria-set-protocol",
3
- "version": "2.6.6-beta.4",
3
+ "version": "2.6.6-beta.6",
4
4
  "description": "A protocol and tools for defining and working with criteria sets",
5
5
  "private": false,
6
6
  "author": "Andrés Angulo <aa@openframe.org>",