@valiantys/atlassian-app 3.2.0-alpha-9 → 3.2.0-alpha-11
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/atlassian/shared/util-adf/src/lib/adf/index.cjs.js +1 -1
- package/atlassian/shared/util-adf/src/lib/adf/index.es.js +118 -24
- package/package.json +1 -1
- package/util-adf/atlassian-app-util-adf.api.json +109 -0
- package/util-adf/atlassian-app.api.md +6 -0
- package/util-adf/index.cjs.js +1 -1
- package/util-adf/index.d.ts +4 -0
- package/util-adf/index.es.js +7 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function i(t,e){var r,n;for(const u of t)if(u.text!==void 0&&u.text.includes(e)||(n=(r=u.attrs)==null?void 0:r.text)!=null&&n.includes(e)||u.content&&i(u.content,e))return!0;return!1}function g(t,e){return i(t.content,e)}function f(t,e,r){return t.map(n=>{var u;return n.text!==void 0?{...n,text:n.text.replaceAll(e,r)}:((u=n.attrs)==null?void 0:u.text)!==void 0?{...n,attrs:{...n.attrs,text:n.attrs.text.replaceAll(e,r)}}:n.content?{...n,content:f(n.content,e,r)}:n})}function y(t,e,r){return{...t,content:f(t.content,e,r)}}function $(t,e){const r={type:"text",text:e};return{...t,content:[...t.content,{type:"paragraph",content:[r]}]}}function l(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}function A(t,e){return e?e.reduce((r,n)=>{var u,s,c;switch(n.type){case"strong":return`<strong>${r}</strong>`;case"em":return`<em>${r}</em>`;case"code":return`<code>${r}</code>`;case"strike":return`<s>${r}</s>`;case"underline":return`<u>${r}</u>`;case"link":return`<a href="${l(String(((u=n.attrs)==null?void 0:u.href)??""))}">${r}</a>`;case"textColor":return`<span style="color:${l(String(((s=n.attrs)==null?void 0:s.color)??""))}">${r}</span>`;case"subsup":return((c=n.attrs)==null?void 0:c.type)==="sub"?`<sub>${r}</sub>`:`<sup>${r}</sup>`;default:return r}},t):t}function a(t){return(t==null?void 0:t.map(b).join(""))??""}function b(t){var e,r,n,u;switch(t.type){case"text":return A(l(t.text??""),t.marks);case"hardBreak":return"<br>";case"rule":return"<hr>";case"paragraph":return`<p>${a(t.content)}</p>`;case"heading":{const s=Number(((e=t.attrs)==null?void 0:e.level)??1);return`<h${s}>${a(t.content)}</h${s}>`}case"blockquote":return`<blockquote>${a(t.content)}</blockquote>`;case"bulletList":return`<ul>${a(t.content)}</ul>`;case"orderedList":return`<ol>${a(t.content)}</ol>`;case"listItem":return`<li>${a(t.content)}</li>`;case"codeBlock":return`<pre${(r=t.attrs)!=null&&r.language?` data-language="${l(String(t.attrs.language))}"`:""}><code>${a(t.content)}</code></pre>`;case"emoji":case"mention":case"status":return l(String(((n=t.attrs)==null?void 0:n.text)??""));case"inlineCard":{const s=l(String(((u=t.attrs)==null?void 0:u.url)??""));return`<a href="${s}">${s}</a>`}case"table":return`<table>${a(t.content)}</table>`;case"tableRow":return`<tr>${a(t.content)}</tr>`;case"tableHeader":return`<th>${a(t.content)}</th>`;case"tableCell":return`<td>${a(t.content)}</td>`;default:return a(t.content)}}function o(t,e){if(t===e)return!0;if(t===null||e===null||typeof t!="object"||typeof e!="object"||Array.isArray(t)!==Array.isArray(e))return!1;if(Array.isArray(t)&&Array.isArray(e))return t.length!==e.length?!1:t.every((c,p)=>o(c,e[p]));const r=t,n=e,u=Object.keys(r),s=Object.keys(n);return u.length!==s.length?!1:u.every(c=>o(r[c],n[c]))}function h(t,e){return e.content.every(r=>t.content.some(n=>o(r,n)))}function d(t){return a(t.content)}function x(t){return{type:"doc",version:1,content:[{type:"paragraph",content:[{type:"text",text:t}]}]}}exports.adfToHtml=d;exports.appendParagraph=$;exports.isAdfSubset=h;exports.replaceInAdf=y;exports.searchAdf=g;exports.toAdfDoc=x;
|
|
@@ -1,42 +1,134 @@
|
|
|
1
|
-
function
|
|
1
|
+
function i(t, e) {
|
|
2
2
|
var r, n;
|
|
3
|
-
for (const
|
|
4
|
-
if (
|
|
3
|
+
for (const u of t)
|
|
4
|
+
if (u.text !== void 0 && u.text.includes(e) || (n = (r = u.attrs) == null ? void 0 : r.text) != null && n.includes(e) || u.content && i(u.content, e))
|
|
5
5
|
return !0;
|
|
6
6
|
return !1;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
return
|
|
8
|
+
function y(t, e) {
|
|
9
|
+
return i(t.content, e);
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
return
|
|
13
|
-
var
|
|
14
|
-
return n.text !== void 0 ? { ...n, text: n.text.replaceAll(
|
|
11
|
+
function f(t, e, r) {
|
|
12
|
+
return t.map((n) => {
|
|
13
|
+
var u;
|
|
14
|
+
return n.text !== void 0 ? { ...n, text: n.text.replaceAll(e, r) } : ((u = n.attrs) == null ? void 0 : u.text) !== void 0 ? {
|
|
15
15
|
...n,
|
|
16
16
|
attrs: {
|
|
17
17
|
...n.attrs,
|
|
18
|
-
text: n.attrs.text.replaceAll(
|
|
18
|
+
text: n.attrs.text.replaceAll(e, r)
|
|
19
19
|
}
|
|
20
20
|
} : n.content ? {
|
|
21
21
|
...n,
|
|
22
|
-
content:
|
|
22
|
+
content: f(n.content, e, r)
|
|
23
23
|
} : n;
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function b(t, e, r) {
|
|
27
27
|
return {
|
|
28
|
-
...
|
|
29
|
-
content:
|
|
28
|
+
...t,
|
|
29
|
+
content: f(t.content, e, r)
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
const r = { type: "text", text:
|
|
32
|
+
function A(t, e) {
|
|
33
|
+
const r = { type: "text", text: e };
|
|
34
34
|
return {
|
|
35
|
-
...
|
|
36
|
-
content: [...
|
|
35
|
+
...t,
|
|
36
|
+
content: [...t.content, { type: "paragraph", content: [r] }]
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function l(t) {
|
|
40
|
+
return t.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
41
|
+
}
|
|
42
|
+
function $(t, e) {
|
|
43
|
+
return e ? e.reduce((r, n) => {
|
|
44
|
+
var u, s, c;
|
|
45
|
+
switch (n.type) {
|
|
46
|
+
case "strong":
|
|
47
|
+
return `<strong>${r}</strong>`;
|
|
48
|
+
case "em":
|
|
49
|
+
return `<em>${r}</em>`;
|
|
50
|
+
case "code":
|
|
51
|
+
return `<code>${r}</code>`;
|
|
52
|
+
case "strike":
|
|
53
|
+
return `<s>${r}</s>`;
|
|
54
|
+
case "underline":
|
|
55
|
+
return `<u>${r}</u>`;
|
|
56
|
+
case "link":
|
|
57
|
+
return `<a href="${l(String(((u = n.attrs) == null ? void 0 : u.href) ?? ""))}">${r}</a>`;
|
|
58
|
+
case "textColor":
|
|
59
|
+
return `<span style="color:${l(String(((s = n.attrs) == null ? void 0 : s.color) ?? ""))}">${r}</span>`;
|
|
60
|
+
case "subsup":
|
|
61
|
+
return ((c = n.attrs) == null ? void 0 : c.type) === "sub" ? `<sub>${r}</sub>` : `<sup>${r}</sup>`;
|
|
62
|
+
default:
|
|
63
|
+
return r;
|
|
64
|
+
}
|
|
65
|
+
}, t) : t;
|
|
66
|
+
}
|
|
67
|
+
function a(t) {
|
|
68
|
+
return (t == null ? void 0 : t.map(g).join("")) ?? "";
|
|
69
|
+
}
|
|
70
|
+
function g(t) {
|
|
71
|
+
var e, r, n, u;
|
|
72
|
+
switch (t.type) {
|
|
73
|
+
case "text":
|
|
74
|
+
return $(l(t.text ?? ""), t.marks);
|
|
75
|
+
case "hardBreak":
|
|
76
|
+
return "<br>";
|
|
77
|
+
case "rule":
|
|
78
|
+
return "<hr>";
|
|
79
|
+
case "paragraph":
|
|
80
|
+
return `<p>${a(t.content)}</p>`;
|
|
81
|
+
case "heading": {
|
|
82
|
+
const s = Number(((e = t.attrs) == null ? void 0 : e.level) ?? 1);
|
|
83
|
+
return `<h${s}>${a(t.content)}</h${s}>`;
|
|
84
|
+
}
|
|
85
|
+
case "blockquote":
|
|
86
|
+
return `<blockquote>${a(t.content)}</blockquote>`;
|
|
87
|
+
case "bulletList":
|
|
88
|
+
return `<ul>${a(t.content)}</ul>`;
|
|
89
|
+
case "orderedList":
|
|
90
|
+
return `<ol>${a(t.content)}</ol>`;
|
|
91
|
+
case "listItem":
|
|
92
|
+
return `<li>${a(t.content)}</li>`;
|
|
93
|
+
case "codeBlock":
|
|
94
|
+
return `<pre${(r = t.attrs) != null && r.language ? ` data-language="${l(String(t.attrs.language))}"` : ""}><code>${a(t.content)}</code></pre>`;
|
|
95
|
+
case "emoji":
|
|
96
|
+
case "mention":
|
|
97
|
+
case "status":
|
|
98
|
+
return l(String(((n = t.attrs) == null ? void 0 : n.text) ?? ""));
|
|
99
|
+
case "inlineCard": {
|
|
100
|
+
const s = l(String(((u = t.attrs) == null ? void 0 : u.url) ?? ""));
|
|
101
|
+
return `<a href="${s}">${s}</a>`;
|
|
102
|
+
}
|
|
103
|
+
case "table":
|
|
104
|
+
return `<table>${a(t.content)}</table>`;
|
|
105
|
+
case "tableRow":
|
|
106
|
+
return `<tr>${a(t.content)}</tr>`;
|
|
107
|
+
case "tableHeader":
|
|
108
|
+
return `<th>${a(t.content)}</th>`;
|
|
109
|
+
case "tableCell":
|
|
110
|
+
return `<td>${a(t.content)}</td>`;
|
|
111
|
+
default:
|
|
112
|
+
return a(t.content);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function o(t, e) {
|
|
116
|
+
if (t === e) return !0;
|
|
117
|
+
if (t === null || e === null || typeof t != "object" || typeof e != "object" || Array.isArray(t) !== Array.isArray(e)) return !1;
|
|
118
|
+
if (Array.isArray(t) && Array.isArray(e))
|
|
119
|
+
return t.length !== e.length ? !1 : t.every((c, p) => o(c, e[p]));
|
|
120
|
+
const r = t, n = e, u = Object.keys(r), s = Object.keys(n);
|
|
121
|
+
return u.length !== s.length ? !1 : u.every((c) => o(r[c], n[c]));
|
|
122
|
+
}
|
|
123
|
+
function h(t, e) {
|
|
124
|
+
return e.content.every(
|
|
125
|
+
(r) => t.content.some((n) => o(r, n))
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
function x(t) {
|
|
129
|
+
return a(t.content);
|
|
130
|
+
}
|
|
131
|
+
function v(t) {
|
|
40
132
|
return {
|
|
41
133
|
type: "doc",
|
|
42
134
|
version: 1,
|
|
@@ -45,15 +137,17 @@ function p(e) {
|
|
|
45
137
|
type: "paragraph",
|
|
46
138
|
content: [{
|
|
47
139
|
type: "text",
|
|
48
|
-
text:
|
|
140
|
+
text: t
|
|
49
141
|
}]
|
|
50
142
|
}
|
|
51
143
|
]
|
|
52
144
|
};
|
|
53
145
|
}
|
|
54
146
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
147
|
+
x as adfToHtml,
|
|
148
|
+
A as appendParagraph,
|
|
149
|
+
h as isAdfSubset,
|
|
150
|
+
b as replaceInAdf,
|
|
151
|
+
y as searchAdf,
|
|
152
|
+
v as toAdfDoc
|
|
59
153
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valiantys/atlassian-app",
|
|
3
|
-
"version": "3.2.0-alpha-
|
|
3
|
+
"version": "3.2.0-alpha-11",
|
|
4
4
|
"description": "This library provides Atlassian Forge components, wrappers, and utilities to support writing Forge apps that can run deployed or in standalone mode",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./frontend-app": {
|
|
@@ -746,6 +746,52 @@
|
|
|
746
746
|
}
|
|
747
747
|
]
|
|
748
748
|
},
|
|
749
|
+
{
|
|
750
|
+
"kind": "Function",
|
|
751
|
+
"canonicalReference": "@valiantys/atlassian-app!adfToHtml:function(1)",
|
|
752
|
+
"docComment": "",
|
|
753
|
+
"excerptTokens": [
|
|
754
|
+
{
|
|
755
|
+
"kind": "Content",
|
|
756
|
+
"text": "export declare function adfToHtml(doc: "
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
"kind": "Reference",
|
|
760
|
+
"text": "AdfDoc",
|
|
761
|
+
"canonicalReference": "@valiantys/atlassian-app!AdfDoc:interface"
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
"kind": "Content",
|
|
765
|
+
"text": "): "
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
"kind": "Content",
|
|
769
|
+
"text": "string"
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
"kind": "Content",
|
|
773
|
+
"text": ";"
|
|
774
|
+
}
|
|
775
|
+
],
|
|
776
|
+
"fileUrlPath": "../../shared/util-adf/src/lib/adf.d.ts",
|
|
777
|
+
"returnTypeTokenRange": {
|
|
778
|
+
"startIndex": 3,
|
|
779
|
+
"endIndex": 4
|
|
780
|
+
},
|
|
781
|
+
"releaseTag": "Public",
|
|
782
|
+
"overloadIndex": 1,
|
|
783
|
+
"parameters": [
|
|
784
|
+
{
|
|
785
|
+
"parameterName": "doc",
|
|
786
|
+
"parameterTypeTokenRange": {
|
|
787
|
+
"startIndex": 1,
|
|
788
|
+
"endIndex": 2
|
|
789
|
+
},
|
|
790
|
+
"isOptional": false
|
|
791
|
+
}
|
|
792
|
+
],
|
|
793
|
+
"name": "adfToHtml"
|
|
794
|
+
},
|
|
749
795
|
{
|
|
750
796
|
"kind": "Function",
|
|
751
797
|
"canonicalReference": "@valiantys/atlassian-app!appendParagraph:function(1)",
|
|
@@ -809,6 +855,69 @@
|
|
|
809
855
|
],
|
|
810
856
|
"name": "appendParagraph"
|
|
811
857
|
},
|
|
858
|
+
{
|
|
859
|
+
"kind": "Function",
|
|
860
|
+
"canonicalReference": "@valiantys/atlassian-app!isAdfSubset:function(1)",
|
|
861
|
+
"docComment": "",
|
|
862
|
+
"excerptTokens": [
|
|
863
|
+
{
|
|
864
|
+
"kind": "Content",
|
|
865
|
+
"text": "export declare function isAdfSubset(superset: "
|
|
866
|
+
},
|
|
867
|
+
{
|
|
868
|
+
"kind": "Reference",
|
|
869
|
+
"text": "AdfDoc",
|
|
870
|
+
"canonicalReference": "@valiantys/atlassian-app!AdfDoc:interface"
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
"kind": "Content",
|
|
874
|
+
"text": ", subset: "
|
|
875
|
+
},
|
|
876
|
+
{
|
|
877
|
+
"kind": "Reference",
|
|
878
|
+
"text": "AdfDoc",
|
|
879
|
+
"canonicalReference": "@valiantys/atlassian-app!AdfDoc:interface"
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
"kind": "Content",
|
|
883
|
+
"text": "): "
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
"kind": "Content",
|
|
887
|
+
"text": "boolean"
|
|
888
|
+
},
|
|
889
|
+
{
|
|
890
|
+
"kind": "Content",
|
|
891
|
+
"text": ";"
|
|
892
|
+
}
|
|
893
|
+
],
|
|
894
|
+
"fileUrlPath": "../../shared/util-adf/src/lib/adf.d.ts",
|
|
895
|
+
"returnTypeTokenRange": {
|
|
896
|
+
"startIndex": 5,
|
|
897
|
+
"endIndex": 6
|
|
898
|
+
},
|
|
899
|
+
"releaseTag": "Public",
|
|
900
|
+
"overloadIndex": 1,
|
|
901
|
+
"parameters": [
|
|
902
|
+
{
|
|
903
|
+
"parameterName": "superset",
|
|
904
|
+
"parameterTypeTokenRange": {
|
|
905
|
+
"startIndex": 1,
|
|
906
|
+
"endIndex": 2
|
|
907
|
+
},
|
|
908
|
+
"isOptional": false
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
"parameterName": "subset",
|
|
912
|
+
"parameterTypeTokenRange": {
|
|
913
|
+
"startIndex": 3,
|
|
914
|
+
"endIndex": 4
|
|
915
|
+
},
|
|
916
|
+
"isOptional": false
|
|
917
|
+
}
|
|
918
|
+
],
|
|
919
|
+
"name": "isAdfSubset"
|
|
920
|
+
},
|
|
812
921
|
{
|
|
813
922
|
"kind": "Function",
|
|
814
923
|
"canonicalReference": "@valiantys/atlassian-app!replaceInAdf:function(1)",
|
|
@@ -56,9 +56,15 @@ export interface AdfTextNode extends AdfNode {
|
|
|
56
56
|
type: 'text';
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
// @public (undocumented)
|
|
60
|
+
export function adfToHtml(doc: AdfDoc): string;
|
|
61
|
+
|
|
59
62
|
// @public (undocumented)
|
|
60
63
|
export function appendParagraph(doc: AdfDoc, value: string): AdfDoc;
|
|
61
64
|
|
|
65
|
+
// @public (undocumented)
|
|
66
|
+
export function isAdfSubset(superset: AdfDoc, subset: AdfDoc): boolean;
|
|
67
|
+
|
|
62
68
|
// @public (undocumented)
|
|
63
69
|
export function replaceInAdf(doc: AdfDoc, searchText: string, replacement: string): AdfDoc;
|
|
64
70
|
|
package/util-adf/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../atlassian/shared/util-adf/src/lib/adf/index.cjs.js");exports.appendParagraph=e.appendParagraph;exports.replaceInAdf=e.replaceInAdf;exports.searchAdf=e.searchAdf;exports.toAdfDoc=e.toAdfDoc;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../atlassian/shared/util-adf/src/lib/adf/index.cjs.js");exports.adfToHtml=e.adfToHtml;exports.appendParagraph=e.appendParagraph;exports.isAdfSubset=e.isAdfSubset;exports.replaceInAdf=e.replaceInAdf;exports.searchAdf=e.searchAdf;exports.toAdfDoc=e.toAdfDoc;
|
package/util-adf/index.d.ts
CHANGED
|
@@ -46,8 +46,12 @@ export declare interface AdfTextNode extends AdfNode {
|
|
|
46
46
|
attrs?: never;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
export declare function adfToHtml(doc: AdfDoc): string;
|
|
50
|
+
|
|
49
51
|
export declare function appendParagraph(doc: AdfDoc, value: string): AdfDoc;
|
|
50
52
|
|
|
53
|
+
export declare function isAdfSubset(superset: AdfDoc, subset: AdfDoc): boolean;
|
|
54
|
+
|
|
51
55
|
export declare function replaceInAdf(doc: AdfDoc, searchText: string, replacement: string): AdfDoc;
|
|
52
56
|
|
|
53
57
|
export declare function searchAdf(doc: AdfDoc, searchText: string): boolean;
|
package/util-adf/index.es.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { adfToHtml as e, appendParagraph as f, isAdfSubset as r, replaceInAdf as o, searchAdf as p, toAdfDoc as t } from "../atlassian/shared/util-adf/src/lib/adf/index.es.js";
|
|
2
2
|
export {
|
|
3
|
-
e as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
e as adfToHtml,
|
|
4
|
+
f as appendParagraph,
|
|
5
|
+
r as isAdfSubset,
|
|
6
|
+
o as replaceInAdf,
|
|
7
|
+
p as searchAdf,
|
|
8
|
+
t as toAdfDoc
|
|
7
9
|
};
|