@webskill/sdk 0.21.0 → 0.22.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/dist/abnfDiagram-O67JEVCF-DtYFjfqO.js +109 -0
- package/dist/agent.d.ts +3 -3
- package/dist/agent.js +1012 -130
- package/dist/{approval-DwN2o2QG.js → approval-DWQlDPbY.js} +102 -16
- package/dist/arc-8U_6NQWm.js +130 -0
- package/dist/architecture-7GRP2DOG-RTw1wpAq.js +4 -0
- package/dist/architectureDiagram-NJMV4G6O-XmmXrJAK.js +7473 -0
- package/dist/array-DQfpQNY8.js +8 -0
- package/dist/blockDiagram-BEXU5L5S-D4yjnCD1.js +2582 -0
- package/dist/browser.d.ts +444 -48
- package/dist/browser.js +1771 -91
- package/dist/c4Diagram-YGBWAQC7-BLmA_JSd.js +3668 -0
- package/dist/channel-CZxxLrG7.js +9 -0
- package/dist/chunk-2Q5K7J3B-Ck03gkFR.js +21 -0
- package/dist/chunk-3FUC2YCW-tr6jmbQf.js +530 -0
- package/dist/chunk-5DYCD2WN-Bt97YGTd.js +58 -0
- package/dist/chunk-5VM5RSS4-BBxa48HL.js +21 -0
- package/dist/chunk-6AEJRKK7-JXK89I-O.js +14 -0
- package/dist/chunk-742MDFTN-CPmgCGwC.js +466 -0
- package/dist/chunk-7INBJB4K-C9jq9o66.js +6552 -0
- package/dist/chunk-7M6MHVWA-BrKCWcR1.js +4894 -0
- package/dist/chunk-7PRAP22T-BHED6GVs.js +95 -0
- package/dist/chunk-DUW6YSOI-DoZj78PO.js +19 -0
- package/dist/chunk-FOHPRMQF-Dkbp819z.js +27189 -0
- package/dist/chunk-GNY47TPC-Bpvq1T49.js +87 -0
- package/dist/chunk-GTNCS2PH-CLmh4I2c.js +686 -0
- package/dist/chunk-GWA4HPMP-B6vN3fkL.js +95 -0
- package/dist/chunk-J5ZVWO5B-Bi_Pcobw.js +26 -0
- package/dist/chunk-JWPE2WC7-D1rC79GS.js +12 -0
- package/dist/chunk-LNGE3PJU-D5OIoe3Z.js +2582 -0
- package/dist/chunk-MBY4JIJT-C34L7a4f.js +2276 -0
- package/dist/chunk-NETBCI7D-Cg84k8N8.js +321 -0
- package/dist/chunk-O7XYJQB3-B6K0KOSL.js +8846 -0
- package/dist/chunk-UA2S7LBM-DxHM29_K.js +612 -0
- package/dist/chunk-WEXAMYUT-Ba6jFWhB.js +33 -0
- package/dist/chunk-XXDRQBXY-DPbSy4kg.js +12 -0
- package/dist/chunk-Y2CYZVJY-U3QOMqrW.js +15 -0
- package/dist/chunk-Z7XXMR3K-oLg1h8F3.js +1038 -0
- package/dist/chunk-ZIGJFQKS-DqEFBuHR.js +2215 -0
- package/dist/classDiagram-v2-NBCMYWYE-BqnOWIUt.js +3845 -0
- package/dist/cose-bilkent-JH36ORCC-C0dTAHVK.js +4270 -0
- package/dist/cynefin-OW5HDTMX-B2QvgEQj.js +4 -0
- package/dist/cynefinDiagram-VND7K2PF-yAWc6Z3W.js +479 -0
- package/dist/cytoscape.esm-C64mRh9B.js +28325 -0
- package/dist/dagre-6A5THRUB-D0w2W27v.js +4816 -0
- package/dist/defaultLocale-B_EoOkSF.js +249 -0
- package/dist/diagram-22UHCM2B-DvgzhUzP.js +6115 -0
- package/dist/diagram-3UASUU5V-DWgUB-ef.js +795 -0
- package/dist/diagram-ATOU4E4O-P1olqwIs.js +553 -0
- package/dist/diagram-CDSNMT55-BUlZuLUe.js +402 -0
- package/dist/diagram-MLGK6HIB-6w5qmkGt.js +186 -0
- package/dist/diagram-MPIPVDR6-DEFiSo8o.js +289 -0
- package/dist/dist-UajCDt3n.js +92 -0
- package/dist/ebnfDiagram-ZINNZB2B-CI8liCfR.js +123 -0
- package/dist/elk-276RUBZZ-3SvW6OAK.js +90034 -0
- package/dist/erDiagram-OPXOYQCR-CPTbKhwP.js +2301 -0
- package/dist/eventmodeling-NTZA5JFV-BlyuqGp0.js +4 -0
- package/dist/flowDiagram-KWPJA3E3-CcUJ6HbV.js +18 -0
- package/dist/ganttDiagram-FUAMR5RP-31UjY0KK.js +3939 -0
- package/dist/{toolSource-C9oNuKmr.js → geometry-wx5ZTYzi.js} +162 -12
- package/dist/gitGraph-4MIJSDKK-ChdVlrk7.js +4 -0
- package/dist/gitGraphDiagram-X574FWY7-DKuxJymB.js +1153 -0
- package/dist/governance.d.ts +3 -3
- package/dist/graphlib-tk9gQYuN.js +4194 -0
- package/dist/{index-B8Tgmpwh.d.ts → index-BiO9_XRk.d.ts} +2 -2
- package/dist/{index-CYLt5u4L.d.ts → index-CjwdZQOS.d.ts} +700 -12
- package/dist/{index-DHopiH_m.d.ts → index-YPd8ZSEa.d.ts} +156 -9
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -6
- package/dist/info-A6RAGUB7-CxRAt9S9.js +4 -0
- package/dist/infoDiagram-VRGFBTTK-pRspGfjZ.js +25 -0
- package/dist/init-CMOIWdg-.js +16 -0
- package/dist/ishikawaDiagram-OU5B5YK6-DKerAPAg.js +975 -0
- package/dist/journeyDiagram-ZHPQQLJL-C4MK-YO5.js +1227 -0
- package/dist/kanban-definition-PNTS6WVX-BqsZpMXx.js +1244 -0
- package/dist/katex-BcRRvyh_.js +26465 -0
- package/dist/{kind-DaKqLX2F.js → kind-Dc8x0HWz.js} +54 -7
- package/dist/line-LgV8iVMV.js +48 -0
- package/dist/linear-BWKR0Tqd.js +393 -0
- package/dist/linkedDocument-CIuh_Yp0.js +416 -0
- package/dist/mcp.d.ts +2 -2
- package/dist/{memoryArtifactStore-D6dLeY55.js → memoryArtifactStore-Bs7glPqm.js} +14 -0
- package/dist/mermaid-parser.core-pYR5siSx.js +754 -0
- package/dist/mermaid.core-DMtwGCHy.js +1756 -0
- package/dist/mindmap-definition-NLK3R4M7-CXbD-myG.js +1312 -0
- package/dist/node.d.ts +3 -3
- package/dist/node.js +2 -2
- package/dist/{openUiLibrary-b0i7F_oZ.js → openUiLibrary-B7j3rLrm.js} +1 -1
- package/dist/{openUiSpecLang-CLXJEeRU.js → openUiSpecLang-BSYYnjay.js} +1 -1
- package/dist/ordinal-CxA6GHQS.js +84 -0
- package/dist/packet-AYTQ26CC-BOm08cxl.js +4 -0
- package/dist/path-C27Z2Bjv.js +106 -0
- package/dist/pegDiagram-GJSIUBJH-BLGJOewQ.js +115 -0
- package/dist/pie-WAS4IAKB-Dvg7glpk.js +4 -0
- package/dist/pieDiagram-5QR66LMP-laoaV_PB.js +298 -0
- package/dist/quadrantDiagram-O4NWA36T-Db_wFBkT.js +2236 -0
- package/dist/radar-RG4KPBEZ-BZDaTu06.js +4 -0
- package/dist/railroad-74A4TZTK-C-UhjkOy.js +4 -0
- package/dist/railroad-abnf-HS5TGJTU-dUKVA4OS.js +4 -0
- package/dist/railroad-ebnf-LZEXJU2U-DzQumk18.js +4 -0
- package/dist/railroad-peg-WCYAUIDC-B3vvTWed.js +4 -0
- package/dist/railroadDiagram-XR7U4H2S-BY0sTM4X.js +89 -0
- package/dist/requirementDiagram-PLB6GJNP-3rkQfEhs.js +2474 -0
- package/dist/rough.cjs-AmDd_NQk.js +1395 -0
- package/dist/sankeyDiagram-IPEJSGJF-CGAJhyG2.js +3578 -0
- package/dist/sequenceDiagram-PO4LG4MO-9FJjFX06.js +5522 -0
- package/dist/sizeCapture-INFHLROL-D8PWxdOn.js +56 -0
- package/dist/{skillVersionStore-B24Jjjry-BkOk9wI_.d.ts → skillVersionStore-B24Jjjry-BY1H7Krp.d.ts} +1 -1
- package/dist/src-NkhI3UMl.js +2653 -0
- package/dist/stateDiagram-v2-GCMORJYK-B0O3wc1-.js +2715 -0
- package/dist/swimlanes-2SLR337P-D4EOnrpu.js +6637 -0
- package/dist/swimlanesDiagram-TC7HE7FX-BUx29EJ9.js +30 -0
- package/dist/testing.d.ts +2 -1
- package/dist/testing.js +1 -1
- package/dist/timeline-definition-EJHVYXUP-CrgiiB4C.js +1513 -0
- package/dist/treeView-Q6P3EWNA-C1by-Gzc.js +4 -0
- package/dist/treemap-WGGIJYW6-mC2NZ6ad.js +4 -0
- package/dist/{types-BvTV_05--BW8zDuEk.d.ts → types-CpDRZ0rA-BM5FI9oN.d.ts} +59 -8
- package/dist/ui-react.d.ts +3 -3
- package/dist/ui-react.js +3718 -77
- package/dist/ui-vue.d.ts +1 -1
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +2 -2
- package/dist/usecaseDiagram-POWQR4AR-BUt_TQOY.js +14397 -0
- package/dist/vennDiagram-UO4OBE2U-CwXr0wjA.js +2808 -0
- package/dist/wardley-WFR3VGLG-CVSYjq_S.js +4 -0
- package/dist/wardleyDiagram-VNRHLVJA-Cpfd47dQ.js +874 -0
- package/dist/{webSkillApi-Cib6G-94.js → webSkillApi-Dy-Zjv0y.js} +1 -1
- package/dist/{webskillLitCatalog-W06npwej.js → webskillLitCatalog-D5BCiMCU.js} +1 -1
- package/dist/xychartDiagram-PMCCYNJV-e1TeVoc6.js +2704 -0
- package/package.json +1 -1
- package/dist/linkedDocument-C0gj1sMq.js +0 -245
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
import { n as __name } from "./chunk-Y2CYZVJY-U3QOMqrW.js";
|
|
2
|
+
import { m as log } from "./src-NkhI3UMl.js";
|
|
3
|
+
import { b as getConfig, z as sanitizeText } from "./chunk-O7XYJQB3-B6K0KOSL.js";
|
|
4
|
+
|
|
5
|
+
//#region ../../node_modules/.pnpm/@iconify+utils@3.1.7/node_modules/@iconify/utils/lib/icon/defaults.js
|
|
6
|
+
/** Default values for dimensions */
|
|
7
|
+
const defaultIconDimensions = Object.freeze({
|
|
8
|
+
left: 0,
|
|
9
|
+
top: 0,
|
|
10
|
+
width: 16,
|
|
11
|
+
height: 16
|
|
12
|
+
});
|
|
13
|
+
/** Default values for transformations */
|
|
14
|
+
const defaultIconTransformations = Object.freeze({
|
|
15
|
+
rotate: 0,
|
|
16
|
+
vFlip: false,
|
|
17
|
+
hFlip: false
|
|
18
|
+
});
|
|
19
|
+
/** Default values for all optional IconifyIcon properties */
|
|
20
|
+
const defaultIconProps = Object.freeze({
|
|
21
|
+
...defaultIconDimensions,
|
|
22
|
+
...defaultIconTransformations
|
|
23
|
+
});
|
|
24
|
+
/** Default values for all properties used in ExtendedIconifyIcon */
|
|
25
|
+
const defaultExtendedIconProps = Object.freeze({
|
|
26
|
+
...defaultIconProps,
|
|
27
|
+
body: "",
|
|
28
|
+
hidden: false
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region ../../node_modules/.pnpm/@iconify+utils@3.1.7/node_modules/@iconify/utils/lib/customisations/defaults.js
|
|
33
|
+
/**
|
|
34
|
+
* Default icon customisations values
|
|
35
|
+
*/
|
|
36
|
+
const defaultIconSizeCustomisations = Object.freeze({
|
|
37
|
+
width: null,
|
|
38
|
+
height: null
|
|
39
|
+
});
|
|
40
|
+
const defaultIconCustomisations = Object.freeze({
|
|
41
|
+
...defaultIconSizeCustomisations,
|
|
42
|
+
...defaultIconTransformations
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region ../../node_modules/.pnpm/@iconify+utils@3.1.7/node_modules/@iconify/utils/lib/icon/name.js
|
|
47
|
+
/**
|
|
48
|
+
* Convert string icon name to IconifyIconName object.
|
|
49
|
+
*/
|
|
50
|
+
const stringToIcon = (value, validate, allowSimpleName, provider = "") => {
|
|
51
|
+
const colonSeparated = value.split(":");
|
|
52
|
+
if (value.slice(0, 1) === "@") {
|
|
53
|
+
if (colonSeparated.length < 2 || colonSeparated.length > 3) return null;
|
|
54
|
+
provider = colonSeparated.shift().slice(1);
|
|
55
|
+
}
|
|
56
|
+
if (colonSeparated.length > 3 || !colonSeparated.length) return null;
|
|
57
|
+
if (colonSeparated.length > 1) {
|
|
58
|
+
const name = colonSeparated.pop();
|
|
59
|
+
const prefix = colonSeparated.pop();
|
|
60
|
+
const result = {
|
|
61
|
+
provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,
|
|
62
|
+
prefix,
|
|
63
|
+
name
|
|
64
|
+
};
|
|
65
|
+
return validate && !validateIconName(result) ? null : result;
|
|
66
|
+
}
|
|
67
|
+
const name = colonSeparated[0];
|
|
68
|
+
const dashSeparated = name.split("-");
|
|
69
|
+
if (dashSeparated.length > 1) {
|
|
70
|
+
const result = {
|
|
71
|
+
provider,
|
|
72
|
+
prefix: dashSeparated.shift(),
|
|
73
|
+
name: dashSeparated.join("-")
|
|
74
|
+
};
|
|
75
|
+
return validate && !validateIconName(result) ? null : result;
|
|
76
|
+
}
|
|
77
|
+
if (allowSimpleName && provider === "") {
|
|
78
|
+
const result = {
|
|
79
|
+
provider,
|
|
80
|
+
prefix: "",
|
|
81
|
+
name
|
|
82
|
+
};
|
|
83
|
+
return validate && !validateIconName(result, allowSimpleName) ? null : result;
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Check if icon is valid.
|
|
89
|
+
*
|
|
90
|
+
* This function is not part of stringToIcon because validation is not needed for most code.
|
|
91
|
+
*/
|
|
92
|
+
const validateIconName = (icon, allowSimpleName) => {
|
|
93
|
+
if (!icon) return false;
|
|
94
|
+
return !!((allowSimpleName && icon.prefix === "" || !!icon.prefix) && !!icon.name);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region ../../node_modules/.pnpm/@iconify+utils@3.1.7/node_modules/@iconify/utils/lib/icon/transformations.js
|
|
99
|
+
/**
|
|
100
|
+
* Merge transformations
|
|
101
|
+
*/
|
|
102
|
+
function mergeIconTransformations(obj1, obj2) {
|
|
103
|
+
const result = {};
|
|
104
|
+
if (!obj1.hFlip !== !obj2.hFlip) result.hFlip = true;
|
|
105
|
+
if (!obj1.vFlip !== !obj2.vFlip) result.vFlip = true;
|
|
106
|
+
const rotate = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4;
|
|
107
|
+
if (rotate) result.rotate = rotate;
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region ../../node_modules/.pnpm/@iconify+utils@3.1.7/node_modules/@iconify/utils/lib/icon/merge.js
|
|
113
|
+
/**
|
|
114
|
+
* Merge icon and alias
|
|
115
|
+
*
|
|
116
|
+
* Can also be used to merge default values and icon
|
|
117
|
+
*/
|
|
118
|
+
function mergeIconData(parent, child) {
|
|
119
|
+
const result = mergeIconTransformations(parent, child);
|
|
120
|
+
for (const key in defaultExtendedIconProps) if (key in defaultIconTransformations) {
|
|
121
|
+
if (key in parent && !(key in result)) result[key] = defaultIconTransformations[key];
|
|
122
|
+
} else if (key in child) result[key] = child[key];
|
|
123
|
+
else if (key in parent) result[key] = parent[key];
|
|
124
|
+
return result;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region ../../node_modules/.pnpm/@iconify+utils@3.1.7/node_modules/@iconify/utils/lib/icon-set/tree.js
|
|
129
|
+
/**
|
|
130
|
+
* Resolve icon set icons
|
|
131
|
+
*
|
|
132
|
+
* Returns parent icon for each icon
|
|
133
|
+
*/
|
|
134
|
+
function getIconsTree(data, names) {
|
|
135
|
+
const icons = data.icons;
|
|
136
|
+
const aliases = data.aliases || Object.create(null);
|
|
137
|
+
const resolved = Object.create(null);
|
|
138
|
+
function resolve(name) {
|
|
139
|
+
if (icons[name]) return resolved[name] = [];
|
|
140
|
+
if (!(name in resolved)) {
|
|
141
|
+
resolved[name] = null;
|
|
142
|
+
const parent = aliases[name] && aliases[name].parent;
|
|
143
|
+
const value = parent && resolve(parent);
|
|
144
|
+
if (value) resolved[name] = [parent].concat(value);
|
|
145
|
+
}
|
|
146
|
+
return resolved[name];
|
|
147
|
+
}
|
|
148
|
+
(names || Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve);
|
|
149
|
+
return resolved;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region ../../node_modules/.pnpm/@iconify+utils@3.1.7/node_modules/@iconify/utils/lib/icon-set/get-icon.js
|
|
154
|
+
/**
|
|
155
|
+
* Get icon data, using prepared aliases tree
|
|
156
|
+
*/
|
|
157
|
+
function internalGetIconData(data, name, tree) {
|
|
158
|
+
const icons = data.icons;
|
|
159
|
+
const aliases = data.aliases || Object.create(null);
|
|
160
|
+
let currentProps = {};
|
|
161
|
+
function parse(name) {
|
|
162
|
+
currentProps = mergeIconData(icons[name] || aliases[name], currentProps);
|
|
163
|
+
}
|
|
164
|
+
parse(name);
|
|
165
|
+
tree.forEach(parse);
|
|
166
|
+
return mergeIconData(data, currentProps);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Get data for icon
|
|
170
|
+
*/
|
|
171
|
+
function getIconData(data, name) {
|
|
172
|
+
if (data.icons[name]) return internalGetIconData(data, name, []);
|
|
173
|
+
const tree = getIconsTree(data, [name])[name];
|
|
174
|
+
return tree ? internalGetIconData(data, name, tree) : null;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region ../../node_modules/.pnpm/@iconify+utils@3.1.7/node_modules/@iconify/utils/lib/svg/size.js
|
|
179
|
+
/**
|
|
180
|
+
* Regular expressions for calculating dimensions
|
|
181
|
+
*/
|
|
182
|
+
const unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
|
|
183
|
+
const unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
|
|
184
|
+
function calculateSize(size, ratio, precision) {
|
|
185
|
+
if (ratio === 1) return size;
|
|
186
|
+
precision = precision || 100;
|
|
187
|
+
if (typeof size === "number") return Math.ceil(size * ratio * precision) / precision;
|
|
188
|
+
if (typeof size !== "string") return size;
|
|
189
|
+
const oldParts = size.split(unitsSplit);
|
|
190
|
+
if (oldParts === null || !oldParts.length) return size;
|
|
191
|
+
const newParts = [];
|
|
192
|
+
let code = oldParts.shift();
|
|
193
|
+
let isNumber = unitsTest.test(code);
|
|
194
|
+
while (true) {
|
|
195
|
+
if (isNumber) {
|
|
196
|
+
const num = parseFloat(code);
|
|
197
|
+
if (isNaN(num)) newParts.push(code);
|
|
198
|
+
else newParts.push(Math.ceil(num * ratio * precision) / precision);
|
|
199
|
+
} else newParts.push(code);
|
|
200
|
+
code = oldParts.shift();
|
|
201
|
+
if (code === void 0) return newParts.join("");
|
|
202
|
+
isNumber = !isNumber;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region ../../node_modules/.pnpm/@iconify+utils@3.1.7/node_modules/@iconify/utils/lib/svg/defs.js
|
|
208
|
+
function splitSVGDefs(content, tag = "defs") {
|
|
209
|
+
let defs = "";
|
|
210
|
+
const index = content.indexOf("<" + tag);
|
|
211
|
+
while (index >= 0) {
|
|
212
|
+
const start = content.indexOf(">", index);
|
|
213
|
+
const end = content.indexOf("</" + tag);
|
|
214
|
+
if (start === -1 || end === -1) break;
|
|
215
|
+
const endEnd = content.indexOf(">", end);
|
|
216
|
+
if (endEnd === -1) break;
|
|
217
|
+
defs += content.slice(start + 1, end).trim();
|
|
218
|
+
content = content.slice(0, index).trim() + content.slice(endEnd + 1);
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
defs,
|
|
222
|
+
content
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Merge defs and content
|
|
227
|
+
*/
|
|
228
|
+
function mergeDefsAndContent(defs, content) {
|
|
229
|
+
return defs ? "<defs>" + defs + "</defs>" + content : content;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Wrap SVG content, without wrapping definitions
|
|
233
|
+
*/
|
|
234
|
+
function wrapSVGContent(body, start, end) {
|
|
235
|
+
const split = splitSVGDefs(body);
|
|
236
|
+
return mergeDefsAndContent(split.defs, start + split.content + end);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region ../../node_modules/.pnpm/@iconify+utils@3.1.7/node_modules/@iconify/utils/lib/svg/build.js
|
|
241
|
+
/**
|
|
242
|
+
* Check if value should be unset. Allows multiple keywords
|
|
243
|
+
*/
|
|
244
|
+
const isUnsetKeyword = (value) => value === "unset" || value === "undefined" || value === "none";
|
|
245
|
+
/**
|
|
246
|
+
* Get SVG attributes and content from icon + customisations
|
|
247
|
+
*
|
|
248
|
+
* Does not generate style to make it compatible with frameworks that use objects for style, such as React.
|
|
249
|
+
* Instead, it generates 'inline' value. If true, rendering engine should add verticalAlign: -0.125em to icon.
|
|
250
|
+
*
|
|
251
|
+
* Customisations should be normalised by platform specific parser.
|
|
252
|
+
* Result should be converted to <svg> by platform specific parser.
|
|
253
|
+
* Use replaceIDs to generate unique IDs for body.
|
|
254
|
+
*/
|
|
255
|
+
function iconToSVG(icon, customisations) {
|
|
256
|
+
const fullIcon = {
|
|
257
|
+
...defaultIconProps,
|
|
258
|
+
...icon
|
|
259
|
+
};
|
|
260
|
+
const fullCustomisations = {
|
|
261
|
+
...defaultIconCustomisations,
|
|
262
|
+
...customisations
|
|
263
|
+
};
|
|
264
|
+
const box = {
|
|
265
|
+
left: fullIcon.left,
|
|
266
|
+
top: fullIcon.top,
|
|
267
|
+
width: fullIcon.width,
|
|
268
|
+
height: fullIcon.height
|
|
269
|
+
};
|
|
270
|
+
let body = fullIcon.body;
|
|
271
|
+
[fullIcon, fullCustomisations].forEach((props) => {
|
|
272
|
+
const transformations = [];
|
|
273
|
+
const hFlip = props.hFlip;
|
|
274
|
+
const vFlip = props.vFlip;
|
|
275
|
+
let rotation = props.rotate;
|
|
276
|
+
if (hFlip) if (vFlip) rotation += 2;
|
|
277
|
+
else {
|
|
278
|
+
transformations.push("translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")");
|
|
279
|
+
transformations.push("scale(-1 1)");
|
|
280
|
+
box.top = box.left = 0;
|
|
281
|
+
}
|
|
282
|
+
else if (vFlip) {
|
|
283
|
+
transformations.push("translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")");
|
|
284
|
+
transformations.push("scale(1 -1)");
|
|
285
|
+
box.top = box.left = 0;
|
|
286
|
+
}
|
|
287
|
+
let tempValue;
|
|
288
|
+
if (rotation < 0) rotation -= Math.floor(rotation / 4) * 4;
|
|
289
|
+
rotation = rotation % 4;
|
|
290
|
+
switch (rotation) {
|
|
291
|
+
case 1:
|
|
292
|
+
tempValue = box.height / 2 + box.top;
|
|
293
|
+
transformations.unshift("rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")");
|
|
294
|
+
break;
|
|
295
|
+
case 2:
|
|
296
|
+
transformations.unshift("rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")");
|
|
297
|
+
break;
|
|
298
|
+
case 3:
|
|
299
|
+
tempValue = box.width / 2 + box.left;
|
|
300
|
+
transformations.unshift("rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")");
|
|
301
|
+
}
|
|
302
|
+
if (rotation % 2 === 1) {
|
|
303
|
+
if (box.left !== box.top) {
|
|
304
|
+
tempValue = box.left;
|
|
305
|
+
box.left = box.top;
|
|
306
|
+
box.top = tempValue;
|
|
307
|
+
}
|
|
308
|
+
if (box.width !== box.height) {
|
|
309
|
+
tempValue = box.width;
|
|
310
|
+
box.width = box.height;
|
|
311
|
+
box.height = tempValue;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (transformations.length) body = wrapSVGContent(body, "<g transform=\"" + transformations.join(" ") + "\">", "</g>");
|
|
315
|
+
});
|
|
316
|
+
const customisationsWidth = fullCustomisations.width;
|
|
317
|
+
const customisationsHeight = fullCustomisations.height;
|
|
318
|
+
const boxWidth = box.width;
|
|
319
|
+
const boxHeight = box.height;
|
|
320
|
+
let width;
|
|
321
|
+
let height;
|
|
322
|
+
if (customisationsWidth === null) {
|
|
323
|
+
height = customisationsHeight === null ? "1em" : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
|
|
324
|
+
width = calculateSize(height, boxWidth / boxHeight);
|
|
325
|
+
} else {
|
|
326
|
+
width = customisationsWidth === "auto" ? boxWidth : customisationsWidth;
|
|
327
|
+
height = customisationsHeight === null ? calculateSize(width, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
|
|
328
|
+
}
|
|
329
|
+
const attributes = {};
|
|
330
|
+
const setAttr = (prop, value) => {
|
|
331
|
+
if (!isUnsetKeyword(value)) attributes[prop] = value.toString();
|
|
332
|
+
};
|
|
333
|
+
setAttr("width", width);
|
|
334
|
+
setAttr("height", height);
|
|
335
|
+
const viewBox = [
|
|
336
|
+
box.left,
|
|
337
|
+
box.top,
|
|
338
|
+
boxWidth,
|
|
339
|
+
boxHeight
|
|
340
|
+
];
|
|
341
|
+
attributes.viewBox = viewBox.join(" ");
|
|
342
|
+
return {
|
|
343
|
+
attributes,
|
|
344
|
+
viewBox,
|
|
345
|
+
body
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region ../../node_modules/.pnpm/@iconify+utils@3.1.7/node_modules/@iconify/utils/lib/svg/id.js
|
|
351
|
+
/**
|
|
352
|
+
* Regular expression for finding ids
|
|
353
|
+
*/
|
|
354
|
+
const regex = /\sid="(\S+)"/g;
|
|
355
|
+
/**
|
|
356
|
+
* Counters
|
|
357
|
+
*/
|
|
358
|
+
const counters = /* @__PURE__ */ new Map();
|
|
359
|
+
/**
|
|
360
|
+
* Get unique new ID
|
|
361
|
+
*/
|
|
362
|
+
function nextID(id) {
|
|
363
|
+
id = id.replace(/[0-9]+$/, "") || "a";
|
|
364
|
+
const count = counters.get(id) || 0;
|
|
365
|
+
counters.set(id, count + 1);
|
|
366
|
+
return count ? `${id}${count}` : id;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Replace IDs in SVG output with unique IDs
|
|
370
|
+
*/
|
|
371
|
+
function replaceIDs(body) {
|
|
372
|
+
const ids = [];
|
|
373
|
+
let match;
|
|
374
|
+
while (match = regex.exec(body)) ids.push(match[1]);
|
|
375
|
+
if (!ids.length) return body;
|
|
376
|
+
const suffix = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
|
|
377
|
+
ids.forEach((id) => {
|
|
378
|
+
const newID = nextID(id);
|
|
379
|
+
const escapedID = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
380
|
+
body = body.replace(new RegExp("([#;\"])(" + escapedID + ")([\")]|\\.[a-z])", "g"), "$1" + newID + suffix + "$3");
|
|
381
|
+
});
|
|
382
|
+
body = body.replace(new RegExp(suffix, "g"), "");
|
|
383
|
+
return body;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
//#endregion
|
|
387
|
+
//#region ../../node_modules/.pnpm/@iconify+utils@3.1.7/node_modules/@iconify/utils/lib/svg/html.js
|
|
388
|
+
/**
|
|
389
|
+
* Generate <svg>
|
|
390
|
+
*/
|
|
391
|
+
function iconToHTML(body, attributes) {
|
|
392
|
+
let renderAttribsHTML = body.indexOf("xlink:") === -1 ? "" : " xmlns:xlink=\"http://www.w3.org/1999/xlink\"";
|
|
393
|
+
for (const attr in attributes) renderAttribsHTML += " " + attr + "=\"" + attributes[attr] + "\"";
|
|
394
|
+
return "<svg xmlns=\"http://www.w3.org/2000/svg\"" + renderAttribsHTML + ">" + body + "</svg>";
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
//#endregion
|
|
398
|
+
//#region ../../node_modules/.pnpm/mermaid@12.0.0/node_modules/mermaid/dist/chunks/mermaid.core/chunk-742MDFTN.mjs
|
|
399
|
+
var unknownIcon = {
|
|
400
|
+
body: "<g><rect width=\"80\" height=\"80\" style=\"fill: #087ebf; stroke-width: 0px;\"/><text transform=\"translate(21.16 64.67)\" style=\"fill: #fff; font-family: ArialMT, Arial; font-size: 67.75px;\"><tspan x=\"0\" y=\"0\">?</tspan></text></g>",
|
|
401
|
+
height: 80,
|
|
402
|
+
width: 80
|
|
403
|
+
};
|
|
404
|
+
var iconsStore = /* @__PURE__ */ new Map();
|
|
405
|
+
var loaderStore = /* @__PURE__ */ new Map();
|
|
406
|
+
var registerIconPacks = /* @__PURE__ */ __name((iconLoaders) => {
|
|
407
|
+
for (const iconLoader of iconLoaders) {
|
|
408
|
+
if (!iconLoader.name) throw new Error("Invalid icon loader. Must have a \"name\" property with non-empty string value.");
|
|
409
|
+
log.debug("Registering icon pack:", iconLoader.name);
|
|
410
|
+
if ("loader" in iconLoader) loaderStore.set(iconLoader.name, iconLoader.loader);
|
|
411
|
+
else if ("icons" in iconLoader) iconsStore.set(iconLoader.name, iconLoader.icons);
|
|
412
|
+
else {
|
|
413
|
+
log.error("Invalid icon loader:", iconLoader);
|
|
414
|
+
throw new Error("Invalid icon loader. Must have either \"icons\" or \"loader\" property.");
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}, "registerIconPacks");
|
|
418
|
+
var getRegisteredIconData = /* @__PURE__ */ __name(async (iconName, fallbackPrefix) => {
|
|
419
|
+
const data = stringToIcon(iconName, true, fallbackPrefix !== void 0);
|
|
420
|
+
if (!data) throw new Error(`Invalid icon name: ${iconName}`);
|
|
421
|
+
const prefix = data.prefix || fallbackPrefix;
|
|
422
|
+
if (!prefix) throw new Error(`Icon name must contain a prefix: ${iconName}`);
|
|
423
|
+
let icons = iconsStore.get(prefix);
|
|
424
|
+
if (!icons) {
|
|
425
|
+
const loader = loaderStore.get(prefix);
|
|
426
|
+
if (!loader) throw new Error(`Icon set not found: ${data.prefix}`);
|
|
427
|
+
try {
|
|
428
|
+
icons = {
|
|
429
|
+
...await loader(),
|
|
430
|
+
prefix
|
|
431
|
+
};
|
|
432
|
+
iconsStore.set(prefix, icons);
|
|
433
|
+
} catch (e) {
|
|
434
|
+
log.error(e);
|
|
435
|
+
throw new Error(`Failed to load icon set: ${data.prefix}`);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
const iconData = getIconData(icons, data.name);
|
|
439
|
+
if (!iconData) throw new Error(`Icon not found: ${iconName}`);
|
|
440
|
+
return iconData;
|
|
441
|
+
}, "getRegisteredIconData");
|
|
442
|
+
var isIconAvailable = /* @__PURE__ */ __name(async (iconName) => {
|
|
443
|
+
try {
|
|
444
|
+
await getRegisteredIconData(iconName);
|
|
445
|
+
return true;
|
|
446
|
+
} catch {
|
|
447
|
+
return false;
|
|
448
|
+
}
|
|
449
|
+
}, "isIconAvailable");
|
|
450
|
+
var getIconSVG = /* @__PURE__ */ __name(async (iconName, customisations, extraAttributes) => {
|
|
451
|
+
let iconData;
|
|
452
|
+
try {
|
|
453
|
+
iconData = await getRegisteredIconData(iconName, customisations?.fallbackPrefix);
|
|
454
|
+
} catch (e) {
|
|
455
|
+
log.error(e);
|
|
456
|
+
iconData = unknownIcon;
|
|
457
|
+
}
|
|
458
|
+
const renderData = iconToSVG(iconData, customisations);
|
|
459
|
+
return sanitizeText(iconToHTML(replaceIDs(renderData.body), {
|
|
460
|
+
...renderData.attributes,
|
|
461
|
+
...extraAttributes
|
|
462
|
+
}), getConfig());
|
|
463
|
+
}, "getIconSVG");
|
|
464
|
+
|
|
465
|
+
//#endregion
|
|
466
|
+
export { unknownIcon as i, isIconAvailable as n, registerIconPacks as r, getIconSVG as t };
|