@pb33f/cowboy-components 0.6.7 → 0.7.1
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/assets/equalizer.worker-DyLD5JTU.js +1 -0
- package/dist/assets/search-problems.worker-BAF8L2rX.js +1 -0
- package/dist/components/changelog/changelog.js +1 -1
- package/dist/components/charts/beefy-chart.d.ts +21 -0
- package/dist/components/charts/beefy-chart.js +159 -0
- package/dist/components/charts/chart-colors.d.ts +27 -0
- package/dist/components/charts/chart-colors.js +76 -0
- package/dist/components/charts/config.d.ts +15 -0
- package/dist/components/charts/config.js +35 -0
- package/dist/components/charts/doughnut-chart.d.ts +22 -0
- package/dist/components/charts/doughnut-chart.js +128 -0
- package/dist/components/editor/editor.d.ts +9 -3
- package/dist/components/editor/editor.js +115 -60
- package/dist/components/editor/init.d.ts +0 -0
- package/dist/components/editor/init.js +28 -0
- package/dist/components/editor/schemas/openapi3.json +1651 -0
- package/dist/components/editor/schemas/openapi31.json +1449 -0
- package/dist/components/model-icon/model-icon.js +3 -0
- package/dist/components/model-renderer/callback.js +2 -1
- package/dist/components/model-renderer/change.css.d.ts +2 -0
- package/dist/components/model-renderer/change.css.js +254 -0
- package/dist/components/model-renderer/changes.d.ts +19 -0
- package/dist/components/model-renderer/changes.js +306 -0
- package/dist/components/model-renderer/clickable-ref.d.ts +10 -6
- package/dist/components/model-renderer/clickable-ref.js +9 -0
- package/dist/components/model-renderer/components.js +1 -0
- package/dist/components/model-renderer/contact.js +2 -1
- package/dist/components/model-renderer/document.js +11 -9
- package/dist/components/model-renderer/encoding.js +1 -0
- package/dist/components/model-renderer/example.js +1 -0
- package/dist/components/model-renderer/external-docs.js +1 -0
- package/dist/components/model-renderer/has-changes.d.ts +8 -0
- package/dist/components/model-renderer/has-changes.js +50 -0
- package/dist/components/model-renderer/header.js +1 -0
- package/dist/components/model-renderer/info.js +3 -1
- package/dist/components/model-renderer/license.js +3 -3
- package/dist/components/model-renderer/link.js +1 -1
- package/dist/components/model-renderer/media-type.js +1 -1
- package/dist/components/model-renderer/oauth-flows.js +2 -1
- package/dist/components/model-renderer/operation.js +2 -1
- package/dist/components/model-renderer/parameter.js +1 -0
- package/dist/components/model-renderer/path-item.js +1 -0
- package/dist/components/model-renderer/paths.js +1 -0
- package/dist/components/model-renderer/rendered-node.js +20 -20
- package/dist/components/model-renderer/rendered-property.css.js +4 -0
- package/dist/components/model-renderer/rendered-property.js +5 -2
- package/dist/components/model-renderer/request-body.js +1 -1
- package/dist/components/model-renderer/response.js +1 -1
- package/dist/components/model-renderer/schema.js +57 -54
- package/dist/components/model-renderer/security-scheme.js +1 -1
- package/dist/components/model-renderer/server.js +1 -0
- package/dist/components/model-renderer/tag.js +3 -1
- package/dist/components/model-tree/tree.d.ts +7 -4
- package/dist/components/model-tree/tree.js +54 -25
- package/dist/components/paginator/paginator.css.js +5 -2
- package/dist/components/problem-list/problem-mainview.js +8 -1
- package/dist/components/rodeo/npm/download-statistic.d.ts +41 -0
- package/dist/components/rodeo/npm/download-statistic.js +634 -0
- package/dist/components/rodeo/rodeo-nav.js +1 -0
- package/dist/components/rodeo/rodeo.d.ts +1 -0
- package/dist/components/rodeo/rodeo.js +9 -2
- package/dist/components/rodeo/statistic.css.js +17 -0
- package/dist/components/rodeo/statistic.d.ts +4 -2
- package/dist/components/rodeo/statistic.js +15 -4
- package/dist/components/the-doctor/settings.css.d.ts +2 -0
- package/dist/components/the-doctor/settings.css.js +28 -0
- package/dist/components/the-doctor/settings.d.ts +13 -0
- package/dist/components/the-doctor/settings.js +83 -2
- package/dist/components/the-doctor/the-doctor.css.js +80 -47
- package/dist/components/the-doctor/the-doctor.d.ts +24 -6
- package/dist/components/the-doctor/the-doctor.js +345 -110
- package/dist/components/the-doctor/upload-archive.js +1 -1
- package/dist/components/theme-switcher/theme-switcher.d.ts +1 -1
- package/dist/components/theme-switcher/theme-switcher.js +5 -2
- package/dist/components/time-vortex/change-list-item.css.d.ts +2 -0
- package/dist/components/time-vortex/change-list-item.css.js +96 -0
- package/dist/components/time-vortex/change-list-item.d.ts +10 -0
- package/dist/components/time-vortex/change-list-item.js +58 -0
- package/dist/components/time-vortex/history-picker.css.d.ts +2 -0
- package/dist/components/time-vortex/history-picker.css.js +90 -0
- package/dist/components/time-vortex/history-picker.d.ts +18 -0
- package/dist/components/time-vortex/history-picker.js +143 -0
- package/dist/components/time-vortex/spec-summary-timeline-item.css.d.ts +2 -0
- package/dist/components/time-vortex/spec-summary-timeline-item.css.js +144 -0
- package/dist/components/time-vortex/spec-summary-timeline-item.d.ts +11 -0
- package/dist/components/time-vortex/spec-summary-timeline-item.js +153 -0
- package/dist/components/time-vortex/tardis-control.css.d.ts +2 -0
- package/dist/components/time-vortex/tardis-control.css.js +103 -0
- package/dist/components/time-vortex/tardis-control.d.ts +31 -0
- package/dist/components/time-vortex/tardis-control.js +286 -0
- package/dist/components/time-vortex/time-vortex.d.ts +17 -0
- package/dist/components/time-vortex/time-vortex.js +75 -0
- package/dist/components/time-vortex/timeline-view.css.d.ts +2 -0
- package/dist/components/time-vortex/timeline-view.css.js +28 -0
- package/dist/components/time-vortex/timeline-view.d.ts +32 -0
- package/dist/components/time-vortex/timeline-view.js +233 -0
- package/dist/components/timeline/timeline-item.css.js +95 -48
- package/dist/components/timeline/timeline-item.d.ts +1 -0
- package/dist/components/timeline/timeline-item.js +20 -1
- package/dist/components/timeline/timeline.css.js +46 -40
- package/dist/components/timeline/timeline.d.ts +1 -0
- package/dist/components/timeline/timeline.js +9 -5
- package/dist/components/toast/toast-component.css.js +4 -0
- package/dist/components/visualizer/equalizer.d.ts +2 -0
- package/dist/components/visualizer/equalizer.js +13 -5
- package/dist/components/visualizer/explorer.d.ts +5 -0
- package/dist/components/visualizer/explorer.js +41 -37
- package/dist/components/visualizer/foreign-object.js +3 -0
- package/dist/components/visualizer/nodes/callback.js +3 -1
- package/dist/components/visualizer/nodes/changes.css.d.ts +2 -0
- package/dist/components/visualizer/nodes/changes.css.js +33 -0
- package/dist/components/visualizer/nodes/components.js +3 -1
- package/dist/components/visualizer/nodes/contact.js +3 -1
- package/dist/components/visualizer/nodes/document.js +1 -0
- package/dist/components/visualizer/nodes/graph-node.d.ts +8 -7
- package/dist/components/visualizer/nodes/graph-node.js +55 -1
- package/dist/components/visualizer/nodes/header.js +3 -1
- package/dist/components/visualizer/nodes/info.js +3 -1
- package/dist/components/visualizer/nodes/license.js +8 -1
- package/dist/components/visualizer/nodes/link.js +3 -1
- package/dist/components/visualizer/nodes/media-type.js +3 -1
- package/dist/components/visualizer/nodes/operation.js +4 -1
- package/dist/components/visualizer/nodes/parameter.js +3 -1
- package/dist/components/visualizer/nodes/path-item.js +3 -1
- package/dist/components/visualizer/nodes/request-body.js +3 -1
- package/dist/components/visualizer/nodes/response.js +3 -1
- package/dist/components/visualizer/nodes/schema.js +3 -1
- package/dist/components/visualizer/nodes/security-scheme.js +3 -1
- package/dist/components/visualizer/nodes/server.js +3 -1
- package/dist/components/visualizer/nodes/tag.js +3 -1
- package/dist/components/visualizer/nodes/xml.js +3 -1
- package/dist/components/visualizer/orientation-controls.d.ts +1 -0
- package/dist/components/visualizer/orientation-controls.js +31 -16
- package/dist/components/visualizer/search.js +4 -3
- package/dist/components/warning-stripe/warning-stripe.d.ts +20 -0
- package/dist/components/warning-stripe/warning-stripe.js +124 -0
- package/dist/cowboy-components.umd.cjs +3840 -2216
- package/dist/css/panels.css.d.ts +2 -0
- package/dist/css/panels.css.js +44 -0
- package/dist/css/pb33f-theme.css +8 -1
- package/dist/css/scrollbar.css.d.ts +2 -0
- package/dist/css/scrollbar.css.js +16 -0
- package/dist/css/tabs.css.js +1 -1
- package/dist/events/doctor.d.ts +15 -1
- package/dist/events/doctor.js +5 -0
- package/dist/model/api-response.d.ts +6 -0
- package/dist/model/api-response.js +2 -0
- package/dist/model/chart-data.d.ts +15 -0
- package/dist/model/chart-data.js +1 -0
- package/dist/model/diagnostic-report.d.ts +5 -0
- package/dist/model/diagnostic-report.js +3 -0
- package/dist/model/document.d.ts +1 -0
- package/dist/model/graph.d.ts +26 -0
- package/dist/model/media-type.d.ts +2 -0
- package/dist/model/media-type.js +7 -0
- package/dist/model/node_type.d.ts +2 -0
- package/dist/model/node_type.js +2 -0
- package/dist/model/settings.d.ts +5 -0
- package/dist/model/settings.js +1 -0
- package/dist/model/timeline.d.ts +33 -0
- package/dist/model/timeline.js +1 -0
- package/dist/monacoeditorwork/css.worker.bundle.js +53460 -0
- package/dist/monacoeditorwork/editor.worker.bundle.js +13517 -0
- package/dist/monacoeditorwork/html.worker.bundle.js +29660 -0
- package/dist/monacoeditorwork/json.worker.bundle.js +21318 -0
- package/dist/monacoeditorwork/yaml.worker..bundle.js +37321 -0
- package/dist/services/color-service.d.ts +1 -0
- package/dist/services/color-service.js +13 -0
- package/dist/services/linting-service.d.ts +1 -3
- package/dist/services/linting-service.js +21 -29
- package/dist/services/model-service.d.ts +1 -1
- package/dist/services/model-service.js +35 -8
- package/dist/services/rodeo-service.d.ts +6 -0
- package/dist/services/rodeo-service.js +134 -0
- package/dist/services/timeline-service.d.ts +8 -0
- package/dist/services/timeline-service.js +85 -0
- package/dist/style.css +1 -1
- package/dist/workers/equalizer.worker.js +1 -1
- package/dist/workers/search-problems.worker.js +1 -1
- package/package.json +6 -1
- package/dist/assets/css.worker-Byh--afc.js +0 -84
- package/dist/assets/editor.worker-CYC0jP-p.js +0 -12
- package/dist/assets/equalizer.worker-CdIiiqfH.js +0 -1
- package/dist/assets/html.worker-DArWg-Dy.js +0 -461
- package/dist/assets/json.worker-heCfXoJw.js +0 -49
- package/dist/assets/search-problems.worker-VJi4P9Gj.js +0 -1
|
@@ -153,6 +153,7 @@ let ModelIconComponent = ModelIconComponent_1 = class ModelIconComponent extends
|
|
|
153
153
|
case NodeType.VERSION:
|
|
154
154
|
return 'award';
|
|
155
155
|
case NodeType.EXTENSIONS:
|
|
156
|
+
case NodeType.EXTENSION:
|
|
156
157
|
return "plug";
|
|
157
158
|
case NodeType.WEBHOOK:
|
|
158
159
|
case NodeType.WEBHOOKS:
|
|
@@ -181,6 +182,8 @@ let ModelIconComponent = ModelIconComponent_1 = class ModelIconComponent extends
|
|
|
181
182
|
return 'markdown';
|
|
182
183
|
case NodeType.JAVA:
|
|
183
184
|
return 'filetype-java';
|
|
185
|
+
case NodeType.EXTERNAL_DOCS:
|
|
186
|
+
return 'journals';
|
|
184
187
|
case NodeType.RB:
|
|
185
188
|
return 'filetype-rb';
|
|
186
189
|
default:
|
|
@@ -37,7 +37,8 @@ let RenderedCallbackNodeComponent = class RenderedCallbackNodeComponent extends
|
|
|
37
37
|
`;
|
|
38
38
|
}
|
|
39
39
|
return html `
|
|
40
|
-
${callback}
|
|
40
|
+
${callback}
|
|
41
|
+
${super.renderChanges()}`;
|
|
41
42
|
}
|
|
42
43
|
};
|
|
43
44
|
RenderedCallbackNodeComponent.styles = [sharedCss, modelSharedCss, listsCss, formattingCss];
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
export default css `
|
|
3
|
+
.props {
|
|
4
|
+
border-top: 1px dashed var(--secondary-color);
|
|
5
|
+
padding: 5px 0 5px 0;
|
|
6
|
+
position: relative;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.orig, .new {
|
|
10
|
+
width: 100%;
|
|
11
|
+
|
|
12
|
+
word-break: break-all;
|
|
13
|
+
word-wrap: break-word;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.orig {
|
|
17
|
+
width: 95%;
|
|
18
|
+
padding: 5px 5px 0 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.original-value {
|
|
22
|
+
color: var(--font-color-sub1)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.new {
|
|
26
|
+
padding: 0 5px 0 0;
|
|
27
|
+
display: flex;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.new-arrow {
|
|
31
|
+
width: 35px;
|
|
32
|
+
text-align: center;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.what-changed {
|
|
36
|
+
width: 100%;
|
|
37
|
+
// display: flex;
|
|
38
|
+
font-size: 0.8rem;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.change {
|
|
42
|
+
|
|
43
|
+
padding-bottom: 10px;
|
|
44
|
+
margin-bottom: 10px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.change-details {
|
|
48
|
+
width: calc(100% - 60px);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.change-item {
|
|
52
|
+
display: flex;
|
|
53
|
+
width: 100%;
|
|
54
|
+
border-bottom: 1px dashed var(--font-color-sub3);
|
|
55
|
+
margin-bottom: 10px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.change-icon {
|
|
59
|
+
width: 30px;
|
|
60
|
+
padding-left: 20px;
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.change-title {
|
|
65
|
+
font-size: 0.9rem;
|
|
66
|
+
background-color: var(--primary-color);
|
|
67
|
+
color: var(--background-color);
|
|
68
|
+
padding: 5px;
|
|
69
|
+
font-family: var(--font-stack-bold), sans-serif;
|
|
70
|
+
margin-bottom: 20px;
|
|
71
|
+
margin-top: 20px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.change-count {
|
|
75
|
+
border: 1px solid var(--background-color);
|
|
76
|
+
padding: 1px;
|
|
77
|
+
min-width: 20px;
|
|
78
|
+
display: inline-block;
|
|
79
|
+
color: var(--background-color);
|
|
80
|
+
text-align: center;
|
|
81
|
+
font-size: 0.8rem;
|
|
82
|
+
font-family: var(--font-stack-bold), sans-serif;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.added {
|
|
86
|
+
color: var(--terminal-text);
|
|
87
|
+
vertical-align: text-top;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.added-icon, .removed-icon, .modified-icon{
|
|
91
|
+
font-size: 1.3rem;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
.removed {
|
|
96
|
+
color: var(--error-color);
|
|
97
|
+
vertical-align: text-top;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.breaking-value {
|
|
101
|
+
color: var(--error-color);
|
|
102
|
+
font-family: var(--font-stack-bold), sans-serif;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.breaking {
|
|
106
|
+
color: var(--error-color);
|
|
107
|
+
font-family: var(--font-stack-bold), sans-serif;
|
|
108
|
+
padding: 1px 3px 1px 3px;
|
|
109
|
+
border: 1px solid var(--error-color);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
.breaking > sl-icon {
|
|
114
|
+
vertical-align: middle;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.modified {
|
|
118
|
+
color: var(--font-color-sub1);
|
|
119
|
+
vertical-align: middle;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.change-type {
|
|
123
|
+
font-family: var(--font-stack-italic), sans-serif;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.breaking-background {
|
|
127
|
+
background-color: var(--error-color-verylowalpha);
|
|
128
|
+
border: 1px dotted var(--error-color);
|
|
129
|
+
padding-top: 0;
|
|
130
|
+
padding-bottom: 0;
|
|
131
|
+
margin-bottom: 20px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.breaking-background > div {
|
|
135
|
+
padding-left: 5px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.breaking-background > .props {
|
|
139
|
+
border-top-color: var(--error-color);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.json-path {
|
|
143
|
+
padding-top: 10px;
|
|
144
|
+
padding-bottom: 5px;
|
|
145
|
+
border-bottom: 1px dashed var(--font-color-sub4);
|
|
146
|
+
margin-bottom: 5px;
|
|
147
|
+
word-break: break-word;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.change-property {
|
|
151
|
+
font-family: var(--font-stack-bold), sans-serif;
|
|
152
|
+
font-size: 1rem;
|
|
153
|
+
color: var(--primary-color);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.change-arrow {
|
|
157
|
+
font-size: 1rem;
|
|
158
|
+
padding-top: 10px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.property-container {
|
|
162
|
+
padding: 0 0 10px 0;
|
|
163
|
+
position: relative;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.breaking-background .context-container {
|
|
167
|
+
top: -1px;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.context-container {
|
|
171
|
+
position: absolute;
|
|
172
|
+
right: 10px;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.context {
|
|
176
|
+
color: var(--font-color-sub2);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.context-bold {
|
|
180
|
+
color: var(--font-color-sub1);
|
|
181
|
+
font-family: var(--font-stack-bold), sans-serif;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.change-header {
|
|
185
|
+
padding: 0 0 5px 0;
|
|
186
|
+
color: var(--font-color-sub2);
|
|
187
|
+
border-bottom: 1px dotted var(--secondary-color-dimmer);
|
|
188
|
+
margin-bottom: 5px;
|
|
189
|
+
font-family: var(--font-stack-italic), sans-serif;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.changed-value {
|
|
193
|
+
color: var(--font-color);
|
|
194
|
+
font-family: var(--font-stack-bold), sans-serif;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.changed-value > pre {
|
|
198
|
+
font-family: var(--font-stack-bold), sans-serif;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
.new-value {
|
|
203
|
+
width: 100%;
|
|
204
|
+
padding-top: 10px;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
pre {
|
|
208
|
+
white-space: pre-wrap;
|
|
209
|
+
word-wrap: break-word;
|
|
210
|
+
margin: 0;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.breaking-bar-top {
|
|
214
|
+
margin-bottom: 5px;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.breaking-bar-bottom {
|
|
218
|
+
margin-top: 5px;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
/* Line numbers */
|
|
223
|
+
|
|
224
|
+
.monaco-editor {
|
|
225
|
+
font-family: var(--font-stack), serif !important;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.diff-item {
|
|
229
|
+
padding: 1px 0 1px 0;
|
|
230
|
+
display: inline-block;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.diff-insert {
|
|
234
|
+
background-color: var(--secondary-color);
|
|
235
|
+
color: var(--background-color);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.diff-delete {
|
|
239
|
+
background-color: var(--error-color-lowalpha);
|
|
240
|
+
color: var(--font-color);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.toggle-highlight {
|
|
244
|
+
vertical-align: middle;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
sl-badge::part(base) {
|
|
248
|
+
border-radius: 0;
|
|
249
|
+
background-color: var(--background-color);
|
|
250
|
+
border: 1px solid var(--secondary-color);
|
|
251
|
+
color: var(--secondary-color);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TemplateResult } from "lit";
|
|
2
|
+
import DiffMatchPatch from 'diff-match-patch';
|
|
3
|
+
import { HasChanges } from "./has-changes.js";
|
|
4
|
+
import { Change } from "../../model/graph.js";
|
|
5
|
+
import '../warning-stripe/warning-stripe.js';
|
|
6
|
+
export declare class ChangesComponent extends HasChanges {
|
|
7
|
+
static styles: import("lit").CSSResult[];
|
|
8
|
+
changes: Change[];
|
|
9
|
+
addPadding: boolean;
|
|
10
|
+
renderBreakingBar: boolean;
|
|
11
|
+
renderMeta: boolean;
|
|
12
|
+
showDiff: boolean;
|
|
13
|
+
renderChangeCountBar: boolean;
|
|
14
|
+
diff: DiffMatchPatch;
|
|
15
|
+
constructor(changes?: Change[]);
|
|
16
|
+
toggleDiff(): void;
|
|
17
|
+
renderChange(change: Change): TemplateResult;
|
|
18
|
+
render(): TemplateResult<1>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html } from "lit";
|
|
8
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
9
|
+
import DiffMatchPatch from 'diff-match-patch';
|
|
10
|
+
import { HasChanges } from "./has-changes.js";
|
|
11
|
+
import changeCss from "./change.css.js";
|
|
12
|
+
import tooltipCss from "../../css/tooltip.css.js";
|
|
13
|
+
import '../warning-stripe/warning-stripe.js';
|
|
14
|
+
let ChangesComponent = class ChangesComponent extends HasChanges {
|
|
15
|
+
constructor(changes) {
|
|
16
|
+
super();
|
|
17
|
+
this.diff = new DiffMatchPatch();
|
|
18
|
+
this.showDiff = true;
|
|
19
|
+
if (changes) {
|
|
20
|
+
this.changes = changes;
|
|
21
|
+
}
|
|
22
|
+
this.renderChangeCountBar = true;
|
|
23
|
+
this.addPadding = false;
|
|
24
|
+
this.renderBreakingBar = true;
|
|
25
|
+
this.renderMeta = false;
|
|
26
|
+
}
|
|
27
|
+
toggleDiff() {
|
|
28
|
+
this.showDiff = !this.showDiff;
|
|
29
|
+
}
|
|
30
|
+
renderChange(change) {
|
|
31
|
+
let context = html ``;
|
|
32
|
+
if (change.context) {
|
|
33
|
+
// TODO: make this jumpable.
|
|
34
|
+
if (change.context.originalLine && change.context.originalLine === change.context.newLine) {
|
|
35
|
+
context = html `<span class="context">
|
|
36
|
+
${change.change == 1 ? html `<span class="toggle-highlight">
|
|
37
|
+
<sl-tooltip content="toggle diff highlighting" placement="left">
|
|
38
|
+
<sl-icon-button name="plus-slash-minus" @click="${this.toggleDiff}"></sl-icon-button>
|
|
39
|
+
</sl-tooltip>
|
|
40
|
+
</span>` : ''}
|
|
41
|
+
line: <span class="context-bold"><sl-format-number
|
|
42
|
+
value="${change.context.originalLine}"></sl-format-number></span>,
|
|
43
|
+
|
|
44
|
+
column: <span class="context-bold"><sl-format-number
|
|
45
|
+
value="${change.context.originalColumn}"></sl-format-number></span>
|
|
46
|
+
</span>`;
|
|
47
|
+
}
|
|
48
|
+
if (change.context.originalLine && change.context.originalLine !== change.context.newLine) {
|
|
49
|
+
context = html `<span class="context">
|
|
50
|
+
${change.change == 1 ? html `<span class="toggle-highlight">
|
|
51
|
+
<sl-tooltip content="toggle diff highlighting" placement="left">
|
|
52
|
+
<sl-icon-button name="plus-slash-minus" @click="${this.toggleDiff}"></sl-icon-button>
|
|
53
|
+
</sl-tooltip>
|
|
54
|
+
</span>` : ''}
|
|
55
|
+
line: <span class="context-bold"><sl-format-number
|
|
56
|
+
value="${change.context.originalLine}"></sl-format-number></span>,
|
|
57
|
+
|
|
58
|
+
col: <span class="context-bold"><sl-format-number
|
|
59
|
+
value="${change.context.originalColumn}"></sl-format-number></span>
|
|
60
|
+
</span>`;
|
|
61
|
+
}
|
|
62
|
+
if (!change.context.originalLine && change.context.newLine) {
|
|
63
|
+
context = html `
|
|
64
|
+
${change.change == 1 ? html `<span class="toggle-highlight">
|
|
65
|
+
<sl-tooltip content="toggle diff highlighting" placement="left">
|
|
66
|
+
<sl-icon-button name="plus-slash-minus" @click="${this.toggleDiff}"></sl-icon-button>
|
|
67
|
+
</sl-tooltip>
|
|
68
|
+
</span>` : ''}
|
|
69
|
+
<span class="context">
|
|
70
|
+
line: <span class="context-bold"><sl-format-number
|
|
71
|
+
value="${change.context.newLine}"></sl-format-number></span>,
|
|
72
|
+
|
|
73
|
+
col: <span class="context-bold"><sl-format-number
|
|
74
|
+
value="${change.context.newColumn}"></sl-format-number></span>
|
|
75
|
+
</span>`;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Prepare HTML outputs for left and right strings
|
|
79
|
+
let leftHtml = [html ``];
|
|
80
|
+
let rightHtml = [html ``];
|
|
81
|
+
if (change.original && change.new && !change.breaking) {
|
|
82
|
+
let diff = this.diff.diff_main(change.original, change.new);
|
|
83
|
+
this.diff.diff_cleanupSemantic(diff);
|
|
84
|
+
diff.forEach((part) => {
|
|
85
|
+
var op = part[0]; // Operation: -1 (delete), 1 (insert), 0 (equal)
|
|
86
|
+
var text = part[1];
|
|
87
|
+
if (op === 1) {
|
|
88
|
+
// Text inserted in the right string
|
|
89
|
+
rightHtml.push(html `<span class="diff-item ${this.showDiff ? 'diff-insert' : ''}">${text}</span>`);
|
|
90
|
+
}
|
|
91
|
+
else if (op === -1) {
|
|
92
|
+
// Text deleted from the left string
|
|
93
|
+
leftHtml.push(html `<span class="diff-item ${this.showDiff ? 'diff-delete' : ''}">${text}</span>`);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
// Unchanged text
|
|
97
|
+
leftHtml.push(html `<span class="diff-item">${text}</span>`);
|
|
98
|
+
rightHtml.push(html `<span class="diff-item">${text}</span>`);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
if (change.original) {
|
|
104
|
+
leftHtml.push(html `<span class="diff-item">${change.original}</span>`);
|
|
105
|
+
}
|
|
106
|
+
if (change.new) {
|
|
107
|
+
rightHtml.push(html `<span class="diff-item">${change.new}</span>`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
let props = html `
|
|
111
|
+
<div class="props">
|
|
112
|
+
<div class="orig">
|
|
113
|
+
<span class="original-value"><pre>${leftHtml}</pre></span>
|
|
114
|
+
</div>
|
|
115
|
+
<div class="new">
|
|
116
|
+
<div class="new-arrow">
|
|
117
|
+
<sl-icon name="arrow-return-right" class="change-arrow"></sl-icon>
|
|
118
|
+
</div>
|
|
119
|
+
<div class="new-value">
|
|
120
|
+
|
|
121
|
+
<span class="changed-value"><pre>${change.breaking ? html `<span
|
|
122
|
+
class="breaking-value">${rightHtml}</span>` : rightHtml}</pre></span>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
`;
|
|
127
|
+
if (leftHtml.length === 1 && rightHtml.length === 1) {
|
|
128
|
+
// the API did not expose change.
|
|
129
|
+
props = html ``;
|
|
130
|
+
}
|
|
131
|
+
const modified = html `
|
|
132
|
+
<div class="change ${change.breaking ? 'breaking-background' : ''}">
|
|
133
|
+
|
|
134
|
+
${change.breaking && this.renderBreakingBar ? html `
|
|
135
|
+
<pb33f-warning-stripe class="breaking-bar-top" height="5" animateStripe speed=4
|
|
136
|
+
danger></pb33f-warning-stripe>` : html `<div style="height: 5px"></div>`}
|
|
137
|
+
|
|
138
|
+
<div class="property-container">
|
|
139
|
+
<div class="context-container">
|
|
140
|
+
${context}
|
|
141
|
+
</div>
|
|
142
|
+
|
|
143
|
+
<span class="change-property">${change.property}</span>
|
|
144
|
+
${this.renderChangeType(change)} ${this.renderBreaking(change.breaking)}
|
|
145
|
+
</div>
|
|
146
|
+
${props}
|
|
147
|
+
<div style="height: 5px"></div>
|
|
148
|
+
|
|
149
|
+
</div>`;
|
|
150
|
+
let addedVal = change.new;
|
|
151
|
+
if (addedVal === '') {
|
|
152
|
+
addedVal = change.original;
|
|
153
|
+
}
|
|
154
|
+
let addedBlock = html `
|
|
155
|
+
<div class="props">
|
|
156
|
+
<div class="orig">
|
|
157
|
+
<span class="changed-value"><pre>${addedVal}</pre></span>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
<div style="height: 5px"></div>
|
|
162
|
+
</div>
|
|
163
|
+
`;
|
|
164
|
+
const added = html `
|
|
165
|
+
<div class="change ${change.breaking ? 'breaking-background' : ''}">
|
|
166
|
+
${change.breaking && this.renderBreakingBar ? html `
|
|
167
|
+
<pb33f-warning-stripe class="breaking-bar-top" height="5" animateStripe speed=4
|
|
168
|
+
danger></pb33f-warning-stripe>` : html `<div style="height: 5px"></div>`}
|
|
169
|
+
<div class="property-container">
|
|
170
|
+
<div class="context-container">
|
|
171
|
+
${context}
|
|
172
|
+
</div>
|
|
173
|
+
|
|
174
|
+
<span class="change-property">${change.property}</span>
|
|
175
|
+
${this.renderChangeType(change)} ${this.renderBreaking(change.breaking)}
|
|
176
|
+
</div>
|
|
177
|
+
${change.new ? html `${addedBlock}` : ''}
|
|
178
|
+
</div>`;
|
|
179
|
+
let removedVal = change.new;
|
|
180
|
+
if (!change.new) {
|
|
181
|
+
removedVal = change.original;
|
|
182
|
+
}
|
|
183
|
+
let removedBlock = html `
|
|
184
|
+
<div class="props">
|
|
185
|
+
<div class="new-value">
|
|
186
|
+
<span class="changed-value"><pre>${removedVal}</pre></span>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
<div style="height: 5px"></div>
|
|
191
|
+
</div>
|
|
192
|
+
`;
|
|
193
|
+
// if there is nothing (because an object was removed, then don't render the block.
|
|
194
|
+
if (!removedVal) {
|
|
195
|
+
removedBlock = html ``;
|
|
196
|
+
}
|
|
197
|
+
const removed = html `
|
|
198
|
+
<div class="change ${change.breaking ? 'breaking-background' : ''}"">
|
|
199
|
+
|
|
200
|
+
${change.breaking && this.renderBreakingBar ? html `
|
|
201
|
+
<pb33f-warning-stripe class="breaking-bar-top" height="5" animateStripe speed=4
|
|
202
|
+
danger></pb33f-warning-stripe>` : html `<div style="height: 5px"></div>`}
|
|
203
|
+
|
|
204
|
+
<div class="property-container">
|
|
205
|
+
<div class="context-container">
|
|
206
|
+
${context}
|
|
207
|
+
</div>
|
|
208
|
+
<span class="change-property">${change.property}</span>
|
|
209
|
+
${this.renderChangeType(change)} ${this.renderBreaking(change.breaking)}
|
|
210
|
+
</div>
|
|
211
|
+
${removedBlock}`;
|
|
212
|
+
let changeMeta = html `
|
|
213
|
+
<div class="object-icon">
|
|
214
|
+
<pb33f-model-icon icon="${change.type}"></pb33f-model-icon>
|
|
215
|
+
<sl-badge>${change.type?.replace(/([a-z])([A-Z])/g, '$1 $2').toLowerCase()}</sl-badge>
|
|
216
|
+
<div class="json-path">
|
|
217
|
+
$.<pb33f-render-json-path path="${change.path}"></pb33f-render-json-path>
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
`;
|
|
221
|
+
if (!this.renderMeta) {
|
|
222
|
+
changeMeta = html ``;
|
|
223
|
+
}
|
|
224
|
+
const wrappedMod = html `
|
|
225
|
+
<div class="change-item">
|
|
226
|
+
<div class="change-icon">${this.renderChangeIcon(change)}</div>
|
|
227
|
+
<div class="change-details">
|
|
228
|
+
${changeMeta}
|
|
229
|
+
${modified}
|
|
230
|
+
</div>
|
|
231
|
+
</div>
|
|
232
|
+
`;
|
|
233
|
+
const wrappedRemoved = html `
|
|
234
|
+
<div class="change-item">
|
|
235
|
+
<div class="change-icon">${this.renderChangeIcon(change)}</div>
|
|
236
|
+
<div class="change-details">
|
|
237
|
+
${changeMeta}
|
|
238
|
+
${removed}
|
|
239
|
+
</div>
|
|
240
|
+
</div>
|
|
241
|
+
`;
|
|
242
|
+
const wrappedAdd = html `
|
|
243
|
+
<div class="change-item">
|
|
244
|
+
<div class="change-icon">${this.renderChangeIcon(change)}</div>
|
|
245
|
+
<div class="change-details">
|
|
246
|
+
${changeMeta}
|
|
247
|
+
${added}
|
|
248
|
+
</div>
|
|
249
|
+
</div>
|
|
250
|
+
`;
|
|
251
|
+
switch (change.change) {
|
|
252
|
+
case 1:
|
|
253
|
+
return wrappedMod;
|
|
254
|
+
case 2:
|
|
255
|
+
case 3:
|
|
256
|
+
return wrappedAdd;
|
|
257
|
+
case 4:
|
|
258
|
+
case 5:
|
|
259
|
+
return wrappedRemoved;
|
|
260
|
+
}
|
|
261
|
+
return html ``;
|
|
262
|
+
}
|
|
263
|
+
render() {
|
|
264
|
+
let changeTitle = html `
|
|
265
|
+
<header>
|
|
266
|
+
<div class="change-title">
|
|
267
|
+
<span class="change-count">${this.changes.length}</span>
|
|
268
|
+
${this.changes.length <= 1 ? 'Change made' : 'Changes made'}
|
|
269
|
+
</div>
|
|
270
|
+
</header>`;
|
|
271
|
+
if (!this.renderChangeCountBar) {
|
|
272
|
+
changeTitle = null;
|
|
273
|
+
}
|
|
274
|
+
let op = html ` ${this.changes.map((change) => {
|
|
275
|
+
return this.renderChange(change);
|
|
276
|
+
})}`;
|
|
277
|
+
return html `
|
|
278
|
+
${changeTitle}
|
|
279
|
+
<div class="what-changed" style="${this.addPadding ? 'padding-top: 10px' : ''}">
|
|
280
|
+
${op}
|
|
281
|
+
</div>`;
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
ChangesComponent.styles = [changeCss, tooltipCss];
|
|
285
|
+
__decorate([
|
|
286
|
+
property()
|
|
287
|
+
], ChangesComponent.prototype, "changes", void 0);
|
|
288
|
+
__decorate([
|
|
289
|
+
property({ type: Boolean })
|
|
290
|
+
], ChangesComponent.prototype, "addPadding", void 0);
|
|
291
|
+
__decorate([
|
|
292
|
+
property({ type: Boolean })
|
|
293
|
+
], ChangesComponent.prototype, "renderBreakingBar", void 0);
|
|
294
|
+
__decorate([
|
|
295
|
+
property({ type: Boolean })
|
|
296
|
+
], ChangesComponent.prototype, "renderMeta", void 0);
|
|
297
|
+
__decorate([
|
|
298
|
+
state()
|
|
299
|
+
], ChangesComponent.prototype, "showDiff", void 0);
|
|
300
|
+
__decorate([
|
|
301
|
+
state()
|
|
302
|
+
], ChangesComponent.prototype, "renderChangeCountBar", void 0);
|
|
303
|
+
ChangesComponent = __decorate([
|
|
304
|
+
customElement('pb33f-changes-component')
|
|
305
|
+
], ChangesComponent);
|
|
306
|
+
export { ChangesComponent };
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import './example.js';
|
|
2
|
-
import { LitElement } from "lit";
|
|
2
|
+
import { LitElement, TemplateResult } from "lit";
|
|
3
3
|
import { ExampleContainer } from "../../model/example.js";
|
|
4
4
|
import { Schema } from "../../model/schema.js";
|
|
5
|
+
import { Change } from "../../model/graph";
|
|
5
6
|
export declare class ClickableRef extends LitElement {
|
|
6
7
|
constructor();
|
|
8
|
+
private changesComponent;
|
|
9
|
+
changes: Change[];
|
|
7
10
|
clickedRef(ref: string | undefined): void;
|
|
8
11
|
encodeToSelectorID(text: string): string;
|
|
9
|
-
renderOperation(method: string, sectionId: string, operationId?: string):
|
|
10
|
-
renderSection(title: string, sectionId: string, expanded?: boolean):
|
|
11
|
-
renderSectionToggle(sectionId: string, expanded?: boolean):
|
|
12
|
+
renderOperation(method: string, sectionId: string, operationId?: string): TemplateResult<1>;
|
|
13
|
+
renderSection(title: string, sectionId: string, expanded?: boolean): TemplateResult<1>;
|
|
14
|
+
renderSectionToggle(sectionId: string, expanded?: boolean): TemplateResult<1>;
|
|
12
15
|
toggleSection(sectionId: string): void;
|
|
16
|
+
renderChanges(): TemplateResult;
|
|
13
17
|
}
|
|
14
18
|
export declare class HasExamples extends ClickableRef {
|
|
15
19
|
constructor();
|
|
16
|
-
renderNoExample(schema: Schema):
|
|
17
|
-
renderExamples(examples: ExampleContainer, example: ExampleContainer):
|
|
20
|
+
renderNoExample(schema: Schema): TemplateResult<1>;
|
|
21
|
+
renderExamples(examples: ExampleContainer, example: ExampleContainer): TemplateResult<1>;
|
|
18
22
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import './example.js';
|
|
2
2
|
import { html, LitElement } from "lit";
|
|
3
3
|
import { NodeReferenceClicked } from "../../events/doctor.js";
|
|
4
|
+
import { ChangesComponent } from "./changes.js";
|
|
4
5
|
export class ClickableRef extends LitElement {
|
|
5
6
|
constructor() {
|
|
6
7
|
super();
|
|
8
|
+
this.changesComponent = new ChangesComponent();
|
|
7
9
|
}
|
|
8
10
|
clickedRef(ref) {
|
|
9
11
|
if (ref) {
|
|
@@ -46,6 +48,13 @@ export class ClickableRef extends LitElement {
|
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
}
|
|
51
|
+
renderChanges() {
|
|
52
|
+
if (this.changes && this.changes.length > 0) {
|
|
53
|
+
this.changesComponent.changes = this.changes;
|
|
54
|
+
return html `${this.changesComponent}`;
|
|
55
|
+
}
|
|
56
|
+
return html ``;
|
|
57
|
+
}
|
|
49
58
|
}
|
|
50
59
|
export class HasExamples extends ClickableRef {
|
|
51
60
|
constructor() {
|
|
@@ -55,7 +55,8 @@ let RenderedContactNodeComponent = class RenderedContactNodeComponent extends Cl
|
|
|
55
55
|
${name}
|
|
56
56
|
${email}
|
|
57
57
|
${url}
|
|
58
|
-
${ext}
|
|
58
|
+
${ext}
|
|
59
|
+
${super.renderChanges()}`;
|
|
59
60
|
}
|
|
60
61
|
};
|
|
61
62
|
RenderedContactNodeComponent.styles = [sharedCss, modelSharedCss, formattingCss];
|