@zywave/customelement-manifest-element 1.1.0 → 1.2.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.
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
section + section {
|
|
24
|
-
margin-top:
|
|
24
|
+
margin-top: 2.5rem;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
h1 {
|
|
@@ -48,7 +48,7 @@ table span {
|
|
|
48
48
|
}
|
|
49
49
|
table thead th,
|
|
50
50
|
table tbody td {
|
|
51
|
-
padding:
|
|
51
|
+
padding: 0.9375rem;
|
|
52
52
|
}
|
|
53
53
|
table thead th:first-child,
|
|
54
54
|
table tbody td:first-child {
|
|
@@ -68,7 +68,8 @@ table tbody tr:last-child > td {
|
|
|
68
68
|
border-bottom: 0;
|
|
69
69
|
}
|
|
70
70
|
table tbody td {
|
|
71
|
-
|
|
71
|
+
vertical-align: top;
|
|
72
|
+
padding: 0.9375rem;
|
|
72
73
|
border-bottom: 1px solid hsla(var(--schema-primary-color-h), var(--schema-primary-color-s), var(--schema-primary-color-l), 0.1);
|
|
73
74
|
}
|
|
74
75
|
table tbody td:first-child {
|
|
@@ -81,13 +82,25 @@ table tbody td.name, table tbody td.type, table tbody td.default {
|
|
|
81
82
|
width: 16.667%;
|
|
82
83
|
}
|
|
83
84
|
table tbody td.name span, table tbody td.type span, table tbody td.default span {
|
|
84
|
-
padding:
|
|
85
|
+
padding: 0.3125rem 0.625rem;
|
|
85
86
|
}
|
|
86
|
-
table tbody td.name span, table tbody td.type span {
|
|
87
|
+
table tbody td.name span, table tbody td.type span, table tbody td.signature span {
|
|
87
88
|
font-family: monospace;
|
|
88
89
|
background-color: hsla(var(--schema-primary-color-h), var(--schema-primary-color-s), var(--schema-primary-color-l), 0.1);
|
|
89
90
|
color: var(--schema-primary-color);
|
|
90
91
|
}
|
|
92
|
+
table tbody td.signature span {
|
|
93
|
+
padding: 0.3125rem 0.625rem;
|
|
94
|
+
}
|
|
95
|
+
table tbody td.signature .expanded-details {
|
|
96
|
+
margin-left: 1.5625rem;
|
|
97
|
+
}
|
|
98
|
+
table tbody td.signature .param-container {
|
|
99
|
+
margin-top: 0.3125rem;
|
|
100
|
+
}
|
|
101
|
+
table tbody td.signature .param-description {
|
|
102
|
+
margin-left: 0.9375rem;
|
|
103
|
+
}
|
|
91
104
|
table tbody td.summary {
|
|
92
105
|
width: 50%;
|
|
93
106
|
}
|
|
@@ -111,7 +124,7 @@ a:hover {
|
|
|
111
124
|
}
|
|
112
125
|
a:focus {
|
|
113
126
|
outline: 1px solid var(--schema-accent-color);
|
|
114
|
-
outline-offset:
|
|
127
|
+
outline-offset: 0.25rem;
|
|
115
128
|
text-decoration: none;
|
|
116
129
|
}
|
|
117
130
|
a:active {
|
|
@@ -126,11 +139,11 @@ code {
|
|
|
126
139
|
|
|
127
140
|
select {
|
|
128
141
|
display: inline-block;
|
|
129
|
-
height:
|
|
142
|
+
height: 2.25rem;
|
|
130
143
|
padding: 0 1em;
|
|
131
|
-
padding-right:
|
|
144
|
+
padding-right: 2.1875rem;
|
|
132
145
|
border: 1px solid #cbcbd2;
|
|
133
|
-
border-radius:
|
|
146
|
+
border-radius: 0.25rem;
|
|
134
147
|
outline: none;
|
|
135
148
|
font: inherit;
|
|
136
149
|
cursor: pointer;
|
|
@@ -33,7 +33,7 @@ function buildTable(items, columns) {
|
|
|
33
33
|
<tbody> ${rows} </tbody>
|
|
34
34
|
</table>`;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function renderDescription(str) {
|
|
37
37
|
if (!str) {
|
|
38
38
|
return str;
|
|
39
39
|
}
|
|
@@ -47,6 +47,37 @@ function renderDescripton(str) {
|
|
|
47
47
|
}
|
|
48
48
|
return result;
|
|
49
49
|
}
|
|
50
|
+
function renderMethodSignature(obj) {
|
|
51
|
+
const methodReturn = () => {
|
|
52
|
+
const returnType = obj.return?.type?.text;
|
|
53
|
+
if (returnType?.length === 0) {
|
|
54
|
+
return 'void';
|
|
55
|
+
}
|
|
56
|
+
return returnType ?? 'unknown';
|
|
57
|
+
};
|
|
58
|
+
if (obj.parameters) {
|
|
59
|
+
const methodSignatureSummary = obj.parameters?.map(param => param.name + (param.optional ? '?' : '')).join(', ');
|
|
60
|
+
const methodParametersDetailed = obj.parameters?.map(param => {
|
|
61
|
+
const argumentType = `: ${param?.type?.text}${param.default ? ` = ${param.default}` : ''}`;
|
|
62
|
+
const argumentHtml = param.name + (param.optional ? '?' : '') + argumentType;
|
|
63
|
+
return html `
|
|
64
|
+
<div class="param-container">
|
|
65
|
+
<div class="param">${argumentHtml}</div>
|
|
66
|
+
${param.description
|
|
67
|
+
? html `<div class="param-description">${renderDescription(param.description)}</div>`
|
|
68
|
+
: nothing}
|
|
69
|
+
</div>
|
|
70
|
+
`;
|
|
71
|
+
});
|
|
72
|
+
return html `<details>
|
|
73
|
+
<summary>${obj.name}(${methodSignatureSummary}): ${methodReturn()}</summary>
|
|
74
|
+
<div class="expanded-details">${methodParametersDetailed}</div>
|
|
75
|
+
</details>`;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
return html `${obj.name}(): ${methodReturn()}`;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
50
81
|
function prettify(str) {
|
|
51
82
|
let regexMatch;
|
|
52
83
|
const linkRegex = /^https?:\/\//;
|
|
@@ -162,7 +193,7 @@ let CustomElementManifestElement = class CustomElementManifestElement extends Li
|
|
|
162
193
|
return this.#activeElement
|
|
163
194
|
? html `<article>
|
|
164
195
|
<div class="header-row"><${getHeaderTag(this.initialHeaderLevel)}>${this.#activeElementName}</${getHeaderTag(this.initialHeaderLevel)}>${this.#renderElementChooser()}</div>
|
|
165
|
-
<div>${
|
|
196
|
+
<div>${renderDescription(this.#activeElement.description)}</div>
|
|
166
197
|
${this.#renderAttributes()} ${this.#renderProperties()} ${this.#renderCssProperties()}
|
|
167
198
|
${this.#renderCssShadowParts()} ${this.#renderEvents()} ${this.#renderMethods()} ${this.#renderSlots()} </article
|
|
168
199
|
>`
|
|
@@ -196,7 +227,7 @@ let CustomElementManifestElement = class CustomElementManifestElement extends Li
|
|
|
196
227
|
header: "Description",
|
|
197
228
|
type: "summary",
|
|
198
229
|
valueAccessor(item) {
|
|
199
|
-
return
|
|
230
|
+
return renderDescription(item.description);
|
|
200
231
|
},
|
|
201
232
|
},
|
|
202
233
|
{
|
|
@@ -239,7 +270,7 @@ let CustomElementManifestElement = class CustomElementManifestElement extends Li
|
|
|
239
270
|
{
|
|
240
271
|
header: "Description",
|
|
241
272
|
valueAccessor(item) {
|
|
242
|
-
return
|
|
273
|
+
return renderDescription(item.description);
|
|
243
274
|
},
|
|
244
275
|
type: "summary",
|
|
245
276
|
},
|
|
@@ -281,7 +312,7 @@ let CustomElementManifestElement = class CustomElementManifestElement extends Li
|
|
|
281
312
|
{
|
|
282
313
|
header: "Description",
|
|
283
314
|
valueAccessor(item) {
|
|
284
|
-
return
|
|
315
|
+
return renderDescription(item.description);
|
|
285
316
|
},
|
|
286
317
|
type: "summary",
|
|
287
318
|
},
|
|
@@ -316,7 +347,7 @@ let CustomElementManifestElement = class CustomElementManifestElement extends Li
|
|
|
316
347
|
{
|
|
317
348
|
header: "Description",
|
|
318
349
|
valueAccessor(item) {
|
|
319
|
-
return
|
|
350
|
+
return renderDescription(item.description);
|
|
320
351
|
},
|
|
321
352
|
type: "summary",
|
|
322
353
|
},
|
|
@@ -344,7 +375,7 @@ let CustomElementManifestElement = class CustomElementManifestElement extends Li
|
|
|
344
375
|
{
|
|
345
376
|
header: "Description",
|
|
346
377
|
valueAccessor(item) {
|
|
347
|
-
return
|
|
378
|
+
return renderDescription(item.description);
|
|
348
379
|
},
|
|
349
380
|
type: "summary",
|
|
350
381
|
},
|
|
@@ -379,10 +410,17 @@ let CustomElementManifestElement = class CustomElementManifestElement extends Li
|
|
|
379
410
|
{
|
|
380
411
|
header: "Description",
|
|
381
412
|
valueAccessor(item) {
|
|
382
|
-
return
|
|
413
|
+
return renderDescription(item.description);
|
|
383
414
|
},
|
|
384
415
|
type: "summary",
|
|
385
416
|
},
|
|
417
|
+
{
|
|
418
|
+
header: "Signature",
|
|
419
|
+
valueAccessor(item) {
|
|
420
|
+
return renderMethodSignature(item);
|
|
421
|
+
},
|
|
422
|
+
type: "signature",
|
|
423
|
+
},
|
|
386
424
|
]);
|
|
387
425
|
return html `
|
|
388
426
|
<section part="methods">
|
|
@@ -411,7 +449,7 @@ let CustomElementManifestElement = class CustomElementManifestElement extends Li
|
|
|
411
449
|
{
|
|
412
450
|
header: "Description",
|
|
413
451
|
valueAccessor(item) {
|
|
414
|
-
return
|
|
452
|
+
return renderDescription(item.description);
|
|
415
453
|
},
|
|
416
454
|
type: "summary",
|
|
417
455
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zywave/customelement-manifest-element",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"@web/test-runner": "^0.13.18",
|
|
32
32
|
"@web/test-runner-junit-reporter": "^0.4.7",
|
|
33
33
|
"@web/test-runner-playwright": "^0.8.6",
|
|
34
|
+
"@zywave/zui-sass-scripts": "^4.0.14",
|
|
34
35
|
"custom-elements-manifest": "^1.0.0",
|
|
35
36
|
"es-dev-server": "^2.1.0",
|
|
36
37
|
"eslint": "^7.30.0",
|