@valiantys/atlassian-app 3.2.0-alpha-9 → 3.2.0-alpha-10
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 +110 -30
- package/package.json +1 -1
- package/util-adf/atlassian-app-util-adf.api.json +46 -0
- package/util-adf/atlassian-app.api.md +3 -0
- package/util-adf/index.cjs.js +1 -1
- package/util-adf/index.d.ts +2 -0
- package/util-adf/index.es.js +5 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(t,n){var e,r;for(const a of t)if(a.text!==void 0&&a.text.includes(n)||(r=(e=a.attrs)==null?void 0:e.text)!=null&&r.includes(n)||a.content&&o(a.content,n))return!0;return!1}function p(t,n){return o(t.content,n)}function i(t,n,e){return t.map(r=>{var a;return r.text!==void 0?{...r,text:r.text.replaceAll(n,e)}:((a=r.attrs)==null?void 0:a.text)!==void 0?{...r,attrs:{...r.attrs,text:r.attrs.text.replaceAll(n,e)}}:r.content?{...r,content:i(r.content,n,e)}:r})}function f(t,n,e){return{...t,content:i(t.content,n,e)}}function $(t,n){const e={type:"text",text:n};return{...t,content:[...t.content,{type:"paragraph",content:[e]}]}}function s(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}function g(t,n){return n?n.reduce((e,r)=>{var a,c,l;switch(r.type){case"strong":return`<strong>${e}</strong>`;case"em":return`<em>${e}</em>`;case"code":return`<code>${e}</code>`;case"strike":return`<s>${e}</s>`;case"underline":return`<u>${e}</u>`;case"link":return`<a href="${s(String(((a=r.attrs)==null?void 0:a.href)??""))}">${e}</a>`;case"textColor":return`<span style="color:${s(String(((c=r.attrs)==null?void 0:c.color)??""))}">${e}</span>`;case"subsup":return((l=r.attrs)==null?void 0:l.type)==="sub"?`<sub>${e}</sub>`:`<sup>${e}</sup>`;default:return e}},t):t}function u(t){return(t==null?void 0:t.map(b).join(""))??""}function b(t){var n,e,r,a;switch(t.type){case"text":return g(s(t.text??""),t.marks);case"hardBreak":return"<br>";case"rule":return"<hr>";case"paragraph":return`<p>${u(t.content)}</p>`;case"heading":{const c=Number(((n=t.attrs)==null?void 0:n.level)??1);return`<h${c}>${u(t.content)}</h${c}>`}case"blockquote":return`<blockquote>${u(t.content)}</blockquote>`;case"bulletList":return`<ul>${u(t.content)}</ul>`;case"orderedList":return`<ol>${u(t.content)}</ol>`;case"listItem":return`<li>${u(t.content)}</li>`;case"codeBlock":return`<pre${(e=t.attrs)!=null&&e.language?` data-language="${s(String(t.attrs.language))}"`:""}><code>${u(t.content)}</code></pre>`;case"emoji":case"mention":case"status":return s(String(((r=t.attrs)==null?void 0:r.text)??""));case"inlineCard":{const c=s(String(((a=t.attrs)==null?void 0:a.url)??""));return`<a href="${c}">${c}</a>`}case"table":return`<table>${u(t.content)}</table>`;case"tableRow":return`<tr>${u(t.content)}</tr>`;case"tableHeader":return`<th>${u(t.content)}</th>`;case"tableCell":return`<td>${u(t.content)}</td>`;default:return u(t.content)}}function h(t){return u(t.content)}function x(t){return{type:"doc",version:1,content:[{type:"paragraph",content:[{type:"text",text:t}]}]}}exports.adfToHtml=h;exports.appendParagraph=$;exports.replaceInAdf=f;exports.searchAdf=p;exports.toAdfDoc=x;
|
|
@@ -1,42 +1,121 @@
|
|
|
1
|
-
function
|
|
2
|
-
var
|
|
3
|
-
for (const
|
|
4
|
-
if (
|
|
1
|
+
function o(t, n) {
|
|
2
|
+
var e, r;
|
|
3
|
+
for (const u of t)
|
|
4
|
+
if (u.text !== void 0 && u.text.includes(n) || (r = (e = u.attrs) == null ? void 0 : e.text) != null && r.includes(n) || u.content && o(u.content, n))
|
|
5
5
|
return !0;
|
|
6
6
|
return !1;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
return
|
|
8
|
+
function $(t, n) {
|
|
9
|
+
return o(t.content, n);
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
return
|
|
13
|
-
var
|
|
14
|
-
return
|
|
15
|
-
...
|
|
11
|
+
function i(t, n, e) {
|
|
12
|
+
return t.map((r) => {
|
|
13
|
+
var u;
|
|
14
|
+
return r.text !== void 0 ? { ...r, text: r.text.replaceAll(n, e) } : ((u = r.attrs) == null ? void 0 : u.text) !== void 0 ? {
|
|
15
|
+
...r,
|
|
16
16
|
attrs: {
|
|
17
|
-
...
|
|
18
|
-
text:
|
|
17
|
+
...r.attrs,
|
|
18
|
+
text: r.attrs.text.replaceAll(n, e)
|
|
19
19
|
}
|
|
20
|
-
} :
|
|
21
|
-
...
|
|
22
|
-
content:
|
|
23
|
-
} :
|
|
20
|
+
} : r.content ? {
|
|
21
|
+
...r,
|
|
22
|
+
content: i(r.content, n, e)
|
|
23
|
+
} : r;
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function g(t, n, e) {
|
|
27
27
|
return {
|
|
28
|
-
...
|
|
29
|
-
content:
|
|
28
|
+
...t,
|
|
29
|
+
content: i(t.content, n, e)
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
const
|
|
32
|
+
function b(t, n) {
|
|
33
|
+
const e = { type: "text", text: n };
|
|
34
34
|
return {
|
|
35
|
-
...
|
|
36
|
-
content: [...
|
|
35
|
+
...t,
|
|
36
|
+
content: [...t.content, { type: "paragraph", content: [e] }]
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function s(t) {
|
|
40
|
+
return t.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
41
|
+
}
|
|
42
|
+
function p(t, n) {
|
|
43
|
+
return n ? n.reduce((e, r) => {
|
|
44
|
+
var u, c, l;
|
|
45
|
+
switch (r.type) {
|
|
46
|
+
case "strong":
|
|
47
|
+
return `<strong>${e}</strong>`;
|
|
48
|
+
case "em":
|
|
49
|
+
return `<em>${e}</em>`;
|
|
50
|
+
case "code":
|
|
51
|
+
return `<code>${e}</code>`;
|
|
52
|
+
case "strike":
|
|
53
|
+
return `<s>${e}</s>`;
|
|
54
|
+
case "underline":
|
|
55
|
+
return `<u>${e}</u>`;
|
|
56
|
+
case "link":
|
|
57
|
+
return `<a href="${s(String(((u = r.attrs) == null ? void 0 : u.href) ?? ""))}">${e}</a>`;
|
|
58
|
+
case "textColor":
|
|
59
|
+
return `<span style="color:${s(String(((c = r.attrs) == null ? void 0 : c.color) ?? ""))}">${e}</span>`;
|
|
60
|
+
case "subsup":
|
|
61
|
+
return ((l = r.attrs) == null ? void 0 : l.type) === "sub" ? `<sub>${e}</sub>` : `<sup>${e}</sup>`;
|
|
62
|
+
default:
|
|
63
|
+
return e;
|
|
64
|
+
}
|
|
65
|
+
}, t) : t;
|
|
66
|
+
}
|
|
67
|
+
function a(t) {
|
|
68
|
+
return (t == null ? void 0 : t.map(f).join("")) ?? "";
|
|
69
|
+
}
|
|
70
|
+
function f(t) {
|
|
71
|
+
var n, e, r, u;
|
|
72
|
+
switch (t.type) {
|
|
73
|
+
case "text":
|
|
74
|
+
return p(s(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 c = Number(((n = t.attrs) == null ? void 0 : n.level) ?? 1);
|
|
83
|
+
return `<h${c}>${a(t.content)}</h${c}>`;
|
|
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${(e = t.attrs) != null && e.language ? ` data-language="${s(String(t.attrs.language))}"` : ""}><code>${a(t.content)}</code></pre>`;
|
|
95
|
+
case "emoji":
|
|
96
|
+
case "mention":
|
|
97
|
+
case "status":
|
|
98
|
+
return s(String(((r = t.attrs) == null ? void 0 : r.text) ?? ""));
|
|
99
|
+
case "inlineCard": {
|
|
100
|
+
const c = s(String(((u = t.attrs) == null ? void 0 : u.url) ?? ""));
|
|
101
|
+
return `<a href="${c}">${c}</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 x(t) {
|
|
116
|
+
return a(t.content);
|
|
117
|
+
}
|
|
118
|
+
function h(t) {
|
|
40
119
|
return {
|
|
41
120
|
type: "doc",
|
|
42
121
|
version: 1,
|
|
@@ -45,15 +124,16 @@ function p(e) {
|
|
|
45
124
|
type: "paragraph",
|
|
46
125
|
content: [{
|
|
47
126
|
type: "text",
|
|
48
|
-
text:
|
|
127
|
+
text: t
|
|
49
128
|
}]
|
|
50
129
|
}
|
|
51
130
|
]
|
|
52
131
|
};
|
|
53
132
|
}
|
|
54
133
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
134
|
+
x as adfToHtml,
|
|
135
|
+
b as appendParagraph,
|
|
136
|
+
g as replaceInAdf,
|
|
137
|
+
$ as searchAdf,
|
|
138
|
+
h as toAdfDoc
|
|
59
139
|
};
|
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-10",
|
|
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)",
|
|
@@ -56,6 +56,9 @@ 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
|
|
package/util-adf/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../atlassian/shared/util-adf/src/lib/adf/index.cjs.js");exports.adfToHtml=a.adfToHtml;exports.appendParagraph=a.appendParagraph;exports.replaceInAdf=a.replaceInAdf;exports.searchAdf=a.searchAdf;exports.toAdfDoc=a.toAdfDoc;
|
package/util-adf/index.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ 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
|
|
|
51
53
|
export declare function replaceInAdf(doc: AdfDoc, searchText: string, replacement: string): AdfDoc;
|
package/util-adf/index.es.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { appendParagraph as e, replaceInAdf as
|
|
1
|
+
import { adfToHtml as d, appendParagraph as e, replaceInAdf as f, searchAdf as o, toAdfDoc as p } from "../atlassian/shared/util-adf/src/lib/adf/index.es.js";
|
|
2
2
|
export {
|
|
3
|
+
d as adfToHtml,
|
|
3
4
|
e as appendParagraph,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
f as replaceInAdf,
|
|
6
|
+
o as searchAdf,
|
|
7
|
+
p as toAdfDoc
|
|
7
8
|
};
|