@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.
Files changed (186) hide show
  1. package/dist/assets/equalizer.worker-DyLD5JTU.js +1 -0
  2. package/dist/assets/search-problems.worker-BAF8L2rX.js +1 -0
  3. package/dist/components/changelog/changelog.js +1 -1
  4. package/dist/components/charts/beefy-chart.d.ts +21 -0
  5. package/dist/components/charts/beefy-chart.js +159 -0
  6. package/dist/components/charts/chart-colors.d.ts +27 -0
  7. package/dist/components/charts/chart-colors.js +76 -0
  8. package/dist/components/charts/config.d.ts +15 -0
  9. package/dist/components/charts/config.js +35 -0
  10. package/dist/components/charts/doughnut-chart.d.ts +22 -0
  11. package/dist/components/charts/doughnut-chart.js +128 -0
  12. package/dist/components/editor/editor.d.ts +9 -3
  13. package/dist/components/editor/editor.js +115 -60
  14. package/dist/components/editor/init.d.ts +0 -0
  15. package/dist/components/editor/init.js +28 -0
  16. package/dist/components/editor/schemas/openapi3.json +1651 -0
  17. package/dist/components/editor/schemas/openapi31.json +1449 -0
  18. package/dist/components/model-icon/model-icon.js +3 -0
  19. package/dist/components/model-renderer/callback.js +2 -1
  20. package/dist/components/model-renderer/change.css.d.ts +2 -0
  21. package/dist/components/model-renderer/change.css.js +254 -0
  22. package/dist/components/model-renderer/changes.d.ts +19 -0
  23. package/dist/components/model-renderer/changes.js +306 -0
  24. package/dist/components/model-renderer/clickable-ref.d.ts +10 -6
  25. package/dist/components/model-renderer/clickable-ref.js +9 -0
  26. package/dist/components/model-renderer/components.js +1 -0
  27. package/dist/components/model-renderer/contact.js +2 -1
  28. package/dist/components/model-renderer/document.js +11 -9
  29. package/dist/components/model-renderer/encoding.js +1 -0
  30. package/dist/components/model-renderer/example.js +1 -0
  31. package/dist/components/model-renderer/external-docs.js +1 -0
  32. package/dist/components/model-renderer/has-changes.d.ts +8 -0
  33. package/dist/components/model-renderer/has-changes.js +50 -0
  34. package/dist/components/model-renderer/header.js +1 -0
  35. package/dist/components/model-renderer/info.js +3 -1
  36. package/dist/components/model-renderer/license.js +3 -3
  37. package/dist/components/model-renderer/link.js +1 -1
  38. package/dist/components/model-renderer/media-type.js +1 -1
  39. package/dist/components/model-renderer/oauth-flows.js +2 -1
  40. package/dist/components/model-renderer/operation.js +2 -1
  41. package/dist/components/model-renderer/parameter.js +1 -0
  42. package/dist/components/model-renderer/path-item.js +1 -0
  43. package/dist/components/model-renderer/paths.js +1 -0
  44. package/dist/components/model-renderer/rendered-node.js +20 -20
  45. package/dist/components/model-renderer/rendered-property.css.js +4 -0
  46. package/dist/components/model-renderer/rendered-property.js +5 -2
  47. package/dist/components/model-renderer/request-body.js +1 -1
  48. package/dist/components/model-renderer/response.js +1 -1
  49. package/dist/components/model-renderer/schema.js +57 -54
  50. package/dist/components/model-renderer/security-scheme.js +1 -1
  51. package/dist/components/model-renderer/server.js +1 -0
  52. package/dist/components/model-renderer/tag.js +3 -1
  53. package/dist/components/model-tree/tree.d.ts +7 -4
  54. package/dist/components/model-tree/tree.js +54 -25
  55. package/dist/components/paginator/paginator.css.js +5 -2
  56. package/dist/components/problem-list/problem-mainview.js +8 -1
  57. package/dist/components/rodeo/npm/download-statistic.d.ts +41 -0
  58. package/dist/components/rodeo/npm/download-statistic.js +634 -0
  59. package/dist/components/rodeo/rodeo-nav.js +1 -0
  60. package/dist/components/rodeo/rodeo.d.ts +1 -0
  61. package/dist/components/rodeo/rodeo.js +9 -2
  62. package/dist/components/rodeo/statistic.css.js +17 -0
  63. package/dist/components/rodeo/statistic.d.ts +4 -2
  64. package/dist/components/rodeo/statistic.js +15 -4
  65. package/dist/components/the-doctor/settings.css.d.ts +2 -0
  66. package/dist/components/the-doctor/settings.css.js +28 -0
  67. package/dist/components/the-doctor/settings.d.ts +13 -0
  68. package/dist/components/the-doctor/settings.js +83 -2
  69. package/dist/components/the-doctor/the-doctor.css.js +80 -47
  70. package/dist/components/the-doctor/the-doctor.d.ts +24 -6
  71. package/dist/components/the-doctor/the-doctor.js +345 -110
  72. package/dist/components/the-doctor/upload-archive.js +1 -1
  73. package/dist/components/theme-switcher/theme-switcher.d.ts +1 -1
  74. package/dist/components/theme-switcher/theme-switcher.js +5 -2
  75. package/dist/components/time-vortex/change-list-item.css.d.ts +2 -0
  76. package/dist/components/time-vortex/change-list-item.css.js +96 -0
  77. package/dist/components/time-vortex/change-list-item.d.ts +10 -0
  78. package/dist/components/time-vortex/change-list-item.js +58 -0
  79. package/dist/components/time-vortex/history-picker.css.d.ts +2 -0
  80. package/dist/components/time-vortex/history-picker.css.js +90 -0
  81. package/dist/components/time-vortex/history-picker.d.ts +18 -0
  82. package/dist/components/time-vortex/history-picker.js +143 -0
  83. package/dist/components/time-vortex/spec-summary-timeline-item.css.d.ts +2 -0
  84. package/dist/components/time-vortex/spec-summary-timeline-item.css.js +144 -0
  85. package/dist/components/time-vortex/spec-summary-timeline-item.d.ts +11 -0
  86. package/dist/components/time-vortex/spec-summary-timeline-item.js +153 -0
  87. package/dist/components/time-vortex/tardis-control.css.d.ts +2 -0
  88. package/dist/components/time-vortex/tardis-control.css.js +103 -0
  89. package/dist/components/time-vortex/tardis-control.d.ts +31 -0
  90. package/dist/components/time-vortex/tardis-control.js +286 -0
  91. package/dist/components/time-vortex/time-vortex.d.ts +17 -0
  92. package/dist/components/time-vortex/time-vortex.js +75 -0
  93. package/dist/components/time-vortex/timeline-view.css.d.ts +2 -0
  94. package/dist/components/time-vortex/timeline-view.css.js +28 -0
  95. package/dist/components/time-vortex/timeline-view.d.ts +32 -0
  96. package/dist/components/time-vortex/timeline-view.js +233 -0
  97. package/dist/components/timeline/timeline-item.css.js +95 -48
  98. package/dist/components/timeline/timeline-item.d.ts +1 -0
  99. package/dist/components/timeline/timeline-item.js +20 -1
  100. package/dist/components/timeline/timeline.css.js +46 -40
  101. package/dist/components/timeline/timeline.d.ts +1 -0
  102. package/dist/components/timeline/timeline.js +9 -5
  103. package/dist/components/toast/toast-component.css.js +4 -0
  104. package/dist/components/visualizer/equalizer.d.ts +2 -0
  105. package/dist/components/visualizer/equalizer.js +13 -5
  106. package/dist/components/visualizer/explorer.d.ts +5 -0
  107. package/dist/components/visualizer/explorer.js +41 -37
  108. package/dist/components/visualizer/foreign-object.js +3 -0
  109. package/dist/components/visualizer/nodes/callback.js +3 -1
  110. package/dist/components/visualizer/nodes/changes.css.d.ts +2 -0
  111. package/dist/components/visualizer/nodes/changes.css.js +33 -0
  112. package/dist/components/visualizer/nodes/components.js +3 -1
  113. package/dist/components/visualizer/nodes/contact.js +3 -1
  114. package/dist/components/visualizer/nodes/document.js +1 -0
  115. package/dist/components/visualizer/nodes/graph-node.d.ts +8 -7
  116. package/dist/components/visualizer/nodes/graph-node.js +55 -1
  117. package/dist/components/visualizer/nodes/header.js +3 -1
  118. package/dist/components/visualizer/nodes/info.js +3 -1
  119. package/dist/components/visualizer/nodes/license.js +8 -1
  120. package/dist/components/visualizer/nodes/link.js +3 -1
  121. package/dist/components/visualizer/nodes/media-type.js +3 -1
  122. package/dist/components/visualizer/nodes/operation.js +4 -1
  123. package/dist/components/visualizer/nodes/parameter.js +3 -1
  124. package/dist/components/visualizer/nodes/path-item.js +3 -1
  125. package/dist/components/visualizer/nodes/request-body.js +3 -1
  126. package/dist/components/visualizer/nodes/response.js +3 -1
  127. package/dist/components/visualizer/nodes/schema.js +3 -1
  128. package/dist/components/visualizer/nodes/security-scheme.js +3 -1
  129. package/dist/components/visualizer/nodes/server.js +3 -1
  130. package/dist/components/visualizer/nodes/tag.js +3 -1
  131. package/dist/components/visualizer/nodes/xml.js +3 -1
  132. package/dist/components/visualizer/orientation-controls.d.ts +1 -0
  133. package/dist/components/visualizer/orientation-controls.js +31 -16
  134. package/dist/components/visualizer/search.js +4 -3
  135. package/dist/components/warning-stripe/warning-stripe.d.ts +20 -0
  136. package/dist/components/warning-stripe/warning-stripe.js +124 -0
  137. package/dist/cowboy-components.umd.cjs +3840 -2216
  138. package/dist/css/panels.css.d.ts +2 -0
  139. package/dist/css/panels.css.js +44 -0
  140. package/dist/css/pb33f-theme.css +8 -1
  141. package/dist/css/scrollbar.css.d.ts +2 -0
  142. package/dist/css/scrollbar.css.js +16 -0
  143. package/dist/css/tabs.css.js +1 -1
  144. package/dist/events/doctor.d.ts +15 -1
  145. package/dist/events/doctor.js +5 -0
  146. package/dist/model/api-response.d.ts +6 -0
  147. package/dist/model/api-response.js +2 -0
  148. package/dist/model/chart-data.d.ts +15 -0
  149. package/dist/model/chart-data.js +1 -0
  150. package/dist/model/diagnostic-report.d.ts +5 -0
  151. package/dist/model/diagnostic-report.js +3 -0
  152. package/dist/model/document.d.ts +1 -0
  153. package/dist/model/graph.d.ts +26 -0
  154. package/dist/model/media-type.d.ts +2 -0
  155. package/dist/model/media-type.js +7 -0
  156. package/dist/model/node_type.d.ts +2 -0
  157. package/dist/model/node_type.js +2 -0
  158. package/dist/model/settings.d.ts +5 -0
  159. package/dist/model/settings.js +1 -0
  160. package/dist/model/timeline.d.ts +33 -0
  161. package/dist/model/timeline.js +1 -0
  162. package/dist/monacoeditorwork/css.worker.bundle.js +53460 -0
  163. package/dist/monacoeditorwork/editor.worker.bundle.js +13517 -0
  164. package/dist/monacoeditorwork/html.worker.bundle.js +29660 -0
  165. package/dist/monacoeditorwork/json.worker.bundle.js +21318 -0
  166. package/dist/monacoeditorwork/yaml.worker..bundle.js +37321 -0
  167. package/dist/services/color-service.d.ts +1 -0
  168. package/dist/services/color-service.js +13 -0
  169. package/dist/services/linting-service.d.ts +1 -3
  170. package/dist/services/linting-service.js +21 -29
  171. package/dist/services/model-service.d.ts +1 -1
  172. package/dist/services/model-service.js +35 -8
  173. package/dist/services/rodeo-service.d.ts +6 -0
  174. package/dist/services/rodeo-service.js +134 -0
  175. package/dist/services/timeline-service.d.ts +8 -0
  176. package/dist/services/timeline-service.js +85 -0
  177. package/dist/style.css +1 -1
  178. package/dist/workers/equalizer.worker.js +1 -1
  179. package/dist/workers/search-problems.worker.js +1 -1
  180. package/package.json +6 -1
  181. package/dist/assets/css.worker-Byh--afc.js +0 -84
  182. package/dist/assets/editor.worker-CYC0jP-p.js +0 -12
  183. package/dist/assets/equalizer.worker-CdIiiqfH.js +0 -1
  184. package/dist/assets/html.worker-DArWg-Dy.js +0 -461
  185. package/dist/assets/json.worker-heCfXoJw.js +0 -49
  186. package/dist/assets/search-problems.worker-VJi4P9Gj.js +0 -1
@@ -16,7 +16,7 @@ import '@shoelace-style/shoelace/dist/components/avatar/avatar.js';
16
16
  import { customElement, property, query, state } from "lit/decorators.js";
17
17
  import { html, LitElement } from "lit";
18
18
  import { SpecEditor } from "../editor/editor.js";
19
- import { ActiveView, AddToast, ArchiveURLRequested, BuiltInRulesetChanged, CustomRulesetEnabled, DocumentReferenceClicked, EditorClicked, EditorUpdated, ExplorerEqualizerChanged, ExplorerEqualizerFiltered, ExplorerNodeClicked, ExportRuleset, ModelTreeNodeClicked, NodeReferenceClicked, OpenProblemDrawer, ProblemClicked, ProblemRuleFilterChangedManual, RolodexRootFileSelected, RolodexTreeNodeClicked, RuleClicked, RulesetSaved, RuleViolationClicked, NukeWorkspaceEvent } from "../../events/doctor.js";
19
+ import { ActiveView, AddToast, ArchiveURLRequested, BuiltInRulesetChanged, CustomRulesetEnabled, DocumentReferenceClicked, EditorClicked, EditorUpdated, ExplorerEqualizerChanged, ExplorerEqualizerFiltered, ExplorerNodeClicked, ExportRuleset, LoadRenderedNodeIntoInspector, ModelTreeNodeClicked, NodeReferenceClicked, NukeWorkspaceEvent, OpenProblemDrawer, OpenSettings, ProblemClicked, ProblemRuleFilterChangedManual, RolodexRootFileSelected, RolodexTreeNodeClicked, RuleClicked, RulesetSaved, RuleViolationClicked, } from "../../events/doctor.js";
20
20
  import { ProblemDetailsDrawer, ProblemDrawerEventType } from "../problem-list/details-drawer.js";
21
21
  import { CreateBagManager } from "@pb33f/saddlebag";
22
22
  import { LintingService } from "../../services/linting-service.js";
@@ -46,16 +46,20 @@ import { ExplorerComponent } from "../visualizer/explorer.js";
46
46
  import { RenderedNodeComponent } from "../model-renderer/rendered-node.js";
47
47
  import tabsCss from "../../css/tabs.css.js";
48
48
  import { CreateBus } from "@pb33f/ranch";
49
- import { Command, CreditStreamChannel, DoctorServiceChannel, isBrokerResponse, QueuePrefix, SpecStreamChannel } from "../../model/channels";
50
- import formsCss from "../../css/forms.css";
51
- import spinnerCss from "../../css/spinner.css";
52
- import { UploadArchiveComponent } from "./upload-archive";
53
- import { NodeType } from "../../model/node_type";
54
- import tooltipCss from "../../css/tooltip.css";
55
- import { NukeWorkspaceComponent } from "./nuke-workspace";
56
- import { CreditTicker } from "../credit-ticker/credit-ticker";
57
- import { AuthController } from "../../controllers/auth";
58
- import { AuthService } from "../../services/auth-service";
49
+ import { Command, CreditStreamChannel, DoctorServiceChannel, isBrokerResponse, QueuePrefix, SpecStreamChannel } from "../../model/channels.js";
50
+ import formsCss from "../../css/forms.css.js";
51
+ import spinnerCss from "../../css/spinner.css.js";
52
+ import { UploadArchiveComponent } from "./upload-archive.js";
53
+ import { NodeType } from "../../model/node_type.js";
54
+ import tooltipCss from "../../css/tooltip.css.js";
55
+ import { NukeWorkspaceComponent } from "./nuke-workspace.js";
56
+ import { CreditTicker } from "../credit-ticker/credit-ticker.js";
57
+ import { AuthController } from "../../controllers/auth.js";
58
+ import { AuthService } from "../../services/auth-service.js";
59
+ import { TimeVortex } from "../time-vortex/time-vortex.js";
60
+ import { TimelineService } from "../../services/timeline-service.js";
61
+ import { DoctorSettings } from "./settings.js";
62
+ import panelsCss from "../../css/panels.css.js";
59
63
  export const GraphBag = "pb33f-doctor-graph";
60
64
  export const PanelStateBag = "pb33f-doctor-panel-state";
61
65
  export const RolodexResponseBag = "pb33f-doctor-rolodex-response";
@@ -76,19 +80,35 @@ export const FunctionsSchemaBag = "pb33f-doctor-function-schema";
76
80
  export const CustomRulesetBag = "pb33f-doctor-custom-ruleset";
77
81
  export const RuleConfigurationBag = "pb33f-doctor-rule-configuration";
78
82
  export const SessionRulesetMapBag = "pb33f-doctor-session-rulesetmap";
83
+ export const SettingsBag = "pb33f-doctor-settings";
79
84
  export const DefaultDocument = "pb33f-doctor-document";
80
85
  export const DocumentProblems = "pb33f-doctor-problems";
81
86
  export const DoctorEndpoint = "doctor-endpoint";
82
87
  let TheDoctor = class TheDoctor extends LitElement {
83
88
  constructor(doctorEndpoint = "https://doctor.pb33f.io") {
84
89
  super();
85
- this.debounceTime = 400;
90
+ this.debounceTime = 1000;
86
91
  this.debounceTimeRuleset = 900;
87
92
  this.bounceId = 0;
88
93
  this.useTLS = false;
89
94
  // rolodex divider state (because it may not exist)
90
95
  this.rolodexDividerPosition = 40;
91
96
  this._firstRun = true;
97
+ // extract the doctor endpoint from session storage.
98
+ const sessionEndpoint = sessionStorage.getItem(DoctorEndpoint);
99
+ if (sessionEndpoint) {
100
+ this.doctorEndpoint = sessionEndpoint;
101
+ }
102
+ else {
103
+ this.doctorEndpoint = doctorEndpoint;
104
+ }
105
+ LintingService.doctorEndpoint = this.doctorEndpoint;
106
+ FeedbackService.doctorEndpoint = this.doctorEndpoint;
107
+ RulesetService.doctorEndpoint = this.doctorEndpoint;
108
+ ModelService.doctorEndpoint = this.doctorEndpoint;
109
+ AuthService.doctorEndpoint = this.doctorEndpoint;
110
+ TimelineService.doctorEndpoint = this.doctorEndpoint;
111
+ this.timeVortex = new TimeVortex();
92
112
  //this.authController = new AuthController(this)
93
113
  // bus it up
94
114
  this.bus = CreateBus();
@@ -120,6 +140,7 @@ let TheDoctor = class TheDoctor extends LitElement {
120
140
  this.manageRuleset = new ManageRuleset();
121
141
  this.toastManager = new ToastManager();
122
142
  this.creditTicker = new CreditTicker();
143
+ this.settingsComponent = new DoctorSettings();
123
144
  this.editorMap = new Map();
124
145
  this.editorMap.set("spec", this.editor);
125
146
  this.editorMap.set("ruleset-editor", this.rulesetEditor);
@@ -133,6 +154,8 @@ let TheDoctor = class TheDoctor extends LitElement {
133
154
  this.rolodexRootPath = "";
134
155
  this.importDisabled = false;
135
156
  this.pendingLine = 0;
157
+ this.autoDiagnose = true;
158
+ this.skipTimeline = false;
136
159
  this.nodeMap = new Map();
137
160
  this.nodeIdMap = new Map();
138
161
  this.nodeIdHashMap = new Map();
@@ -146,21 +169,9 @@ let TheDoctor = class TheDoctor extends LitElement {
146
169
  this.references = [];
147
170
  this.minimapVisible = true;
148
171
  this.minimapIconVisible = true;
172
+ this.showDiagnosisButton = false;
149
173
  this.nodeLimit = 150;
150
174
  this.randomTicker = 0;
151
- // extract the doctor endpoint from session storage.
152
- const sessionEndpoint = sessionStorage.getItem(DoctorEndpoint);
153
- if (sessionEndpoint) {
154
- this.doctorEndpoint = sessionEndpoint;
155
- }
156
- else {
157
- this.doctorEndpoint = doctorEndpoint;
158
- }
159
- LintingService.doctorEndpoint = this.doctorEndpoint;
160
- FeedbackService.doctorEndpoint = this.doctorEndpoint;
161
- RulesetService.doctorEndpoint = this.doctorEndpoint;
162
- ModelService.doctorEndpoint = this.doctorEndpoint;
163
- AuthService.doctorEndpoint = this.doctorEndpoint;
164
175
  // session call back for when we're online.
165
176
  const sessionCallback = (session) => {
166
177
  if (session.creditsRemaining) {
@@ -214,6 +225,9 @@ let TheDoctor = class TheDoctor extends LitElement {
214
225
  //@ts-ignore
215
226
  this.explorer.equalizer.addEventListener(ExplorerEqualizerFiltered, this.filterTreeModel.bind(this));
216
227
  this.nukeWorkspace.addEventListener(NukeWorkspaceEvent, this.nukeWorkspaceHandler.bind(this));
228
+ this.timeVortex.historyPicker.addEventListener(OpenSettings, this.openSettings.bind(this));
229
+ //@ts-ignore
230
+ this.addEventListener(LoadRenderedNodeIntoInspector, this.loadRenderedNodeIntoInspector.bind(this));
217
231
  // extract port from session storage.
218
232
  this.busPort = sessionStorage.getItem("pb33f-doctor-port");
219
233
  this.busHost = sessionStorage.getItem("pb33f-doctor-host");
@@ -250,11 +264,45 @@ let TheDoctor = class TheDoctor extends LitElement {
250
264
  }
251
265
  });
252
266
  }
267
+ openSettings() {
268
+ this.settingsComponent.open();
269
+ }
270
+ settingsChanged(_, config) {
271
+ if (config) {
272
+ this.autoDiagnose = config.autoDiagnose;
273
+ this.skipTimeline = config.skipTimeline;
274
+ this.showDiagnosisButton = !config.autoDiagnose;
275
+ // if the time vortex is not available, enable skipsState
276
+ this.timeVortex.historyPicker.skipChanges = config.skipTimeline;
277
+ if (config.applicationVersion == this.currentVersion) {
278
+ return;
279
+ }
280
+ if (this.currentVersion && this.currentVersion != 'bootstrap' &&
281
+ config.applicationVersion &&
282
+ config.applicationVersion != 'bootstrap' &&
283
+ this.currentVersion != config.applicationVersion) {
284
+ console.warn('version changed, reloading', this.currentVersion, config.applicationVersion);
285
+ this.nukeWorkspaceHandler();
286
+ }
287
+ else {
288
+ config.applicationVersion = this.currentVersion;
289
+ this.settingsBag?.set(SettingsBag, config);
290
+ }
291
+ }
292
+ }
293
+ loadRenderedNodeIntoInspector(evt) {
294
+ const rn = new RenderedNodeComponent();
295
+ rn.node = evt.detail.renderedNode;
296
+ this.renderedNode = rn;
297
+ this.requestUpdate();
298
+ this.viewerPanel.click();
299
+ }
253
300
  tickRandomly() {
254
301
  this.randomTicker = Math.floor(Math.random() * 9999999);
255
302
  }
256
303
  nukeWorkspaceHandler() {
257
304
  this.bagManager.resetBags();
305
+ localStorage.removeItem("pb33f-doctor-version");
258
306
  ModelService.resetWorkspace().then(() => {
259
307
  window.location.reload();
260
308
  });
@@ -305,8 +353,22 @@ let TheDoctor = class TheDoctor extends LitElement {
305
353
  if (isBrokerResponse(msg.payload.payload)) {
306
354
  this.brokerConnectionId = msg.payload.payload.broker;
307
355
  this.authController.associateBroker(this.brokerConnectionId).then(() => {
308
- console.log('broker connection', this.brokerConnectionId);
309
- console.log("💊 Welcome to the clinic, the %cdoctor %cis ready to see you.", 'color: #62C4FFFF; font-weight: bold', 'color: default');
356
+ // check version from the server
357
+ const version = msg.payload.payload.version;
358
+ if (version !== "") {
359
+ this.currentVersion = version;
360
+ }
361
+ const memVersion = localStorage.getItem("pb33f-doctor-version");
362
+ if (memVersion) {
363
+ if (this.currentVersion != memVersion) {
364
+ this.nukeWorkspaceHandler();
365
+ return;
366
+ }
367
+ }
368
+ else {
369
+ localStorage.setItem("pb33f-doctor-version", this.currentVersion);
370
+ }
371
+ console.log("💊 Welcome to the clinic, the %cdoctor %cis ready to see you. [" + "v" + version + "]", 'color: #62C4FFFF; font-weight: bold', 'color: default');
310
372
  this.startTheDoctor();
311
373
  });
312
374
  }
@@ -319,7 +381,6 @@ let TheDoctor = class TheDoctor extends LitElement {
319
381
  this.bus.mapChannelToBrokerDestination(QueuePrefix + SpecStreamChannel, SpecStreamChannel);
320
382
  this.bus.mapChannelToBrokerDestination(QueuePrefix + CreditStreamChannel, CreditStreamChannel);
321
383
  this.boostrap();
322
- this.loadingOverlay.hide();
323
384
  }
324
385
  specStreamHandler() {
325
386
  return (msg) => {
@@ -344,7 +405,7 @@ let TheDoctor = class TheDoctor extends LitElement {
344
405
  filterTreeModel(event) {
345
406
  this.filteredNodes = new Map();
346
407
  event.detail.graph.nodes.forEach((node) => {
347
- this.filteredNodes.set(node.idHash, node);
408
+ this.filteredNodes.set(node.id, node);
348
409
  });
349
410
  this.modelTree.filteredNodes = this.filteredNodes;
350
411
  this.modelTree.renderedNodes = this.renderedNodeMap;
@@ -374,10 +435,10 @@ let TheDoctor = class TheDoctor extends LitElement {
374
435
  const node = this.nodeIdMap.get(path);
375
436
  if (node) {
376
437
  if (this.nodeIdHashMap.has(node.idHash)) {
377
- const renderedNode = this.renderedNodeMap.get(node.idHash);
438
+ const renderedNode = this.renderedNodeMap.get(node.id);
378
439
  if (renderedNode) {
379
440
  this.renderedNode.node = renderedNode;
380
- this.modelTree.explorerClicked(node.idHash);
441
+ this.modelTree.explorerClicked(node.id);
381
442
  // add a ref click
382
443
  if (!evt.detail.noState) {
383
444
  this.addRefTrack(evt.detail.jsonPath);
@@ -421,15 +482,15 @@ let TheDoctor = class TheDoctor extends LitElement {
421
482
  }
422
483
  }
423
484
  explorerReferenceClicked(evt) {
424
- let hashId = '';
485
+ let nodeId = '';
425
486
  this.explorer.nodeComponents.forEach((node) => {
426
487
  if (node.body.node.nodePath === evt.detail.nodePath) {
427
- const renderedNode = this.renderedNodeMap.get(node.body.node.idHash);
488
+ const renderedNode = this.renderedNodeMap.get(node.body.node.id);
428
489
  if (renderedNode) {
429
490
  this.editor.editor?.setPosition({ lineNumber: renderedNode.keyLine, column: 0 });
430
491
  this.editor.editor?.revealLineInCenter(renderedNode.keyLine);
431
492
  this.renderedNode.node = renderedNode;
432
- hashId = node.body.node.idHash;
493
+ nodeId = node.body.node.id;
433
494
  this.explorer.moveToNode(node.body.node);
434
495
  this.activeNode = node.body.node;
435
496
  this.explorer.activeNode = node.body.node;
@@ -441,8 +502,8 @@ let TheDoctor = class TheDoctor extends LitElement {
441
502
  node.body.active = false;
442
503
  }
443
504
  });
444
- if (hashId) {
445
- this.modelTree.explorerClicked(hashId);
505
+ if (nodeId) {
506
+ this.modelTree.explorerClicked(nodeId);
446
507
  this.explorer.requestUpdate();
447
508
  this.viewerPanel.click();
448
509
  }
@@ -610,7 +671,10 @@ let TheDoctor = class TheDoctor extends LitElement {
610
671
  }
611
672
  }
612
673
  modelTreeNodeClicked(evt) {
613
- const node = this.nodeIdHashMap.get(evt.detail.nodeHashId);
674
+ let node = this.nodeIdMap.get(evt.detail.nodeId);
675
+ if (!node) {
676
+ node = this.nodeIdHashMap.get(evt.detail.nodeId);
677
+ }
614
678
  if (node) {
615
679
  if (node.origin && node.origin != this.rolodexActivePath && (node.origin != '/root.yaml' && node.origin != 'root.yaml')) {
616
680
  // extract the rolodex id using the path
@@ -630,23 +694,36 @@ let TheDoctor = class TheDoctor extends LitElement {
630
694
  }));
631
695
  return;
632
696
  }
633
- this.editor.editor?.setPosition({ lineNumber: node.keyLine, column: 0 });
634
- this.editor.editor?.revealLineInCenter(node.keyLine);
697
+ // don't jump to the root in the editor if the root is selected
698
+ if (node.idHash !== 'root') {
699
+ this.editor.editor?.setPosition({ lineNumber: node.keyLine, column: 0 });
700
+ this.editor.editor?.revealLineInCenter(node.keyLine);
701
+ }
635
702
  if (this.explorerVisible) {
636
703
  this.explorer.moveToNode(node, evt.detail.first);
637
704
  }
638
705
  this.activeNode = node;
706
+ // add changes to active node.
707
+ if (evt.detail.changes) {
708
+ node.timeline = evt.detail.changes;
709
+ }
639
710
  this.explorer.activeNode = node;
640
711
  this.explorer.equalizer.activeNode = node;
641
- const renderedNode = this.renderedNodeMap.get(node.idHash);
712
+ const renderedNode = structuredClone(this.renderedNodeMap.get(node.id));
642
713
  if (renderedNode) {
714
+ if (evt.detail.changes) {
715
+ renderedNode.timeline = evt.detail.changes;
716
+ }
643
717
  this.renderedNode.node = renderedNode;
644
718
  }
719
+ else {
720
+ alert('no id found');
721
+ }
645
722
  if (!evt.detail.noState) {
646
723
  this.addClickTrack(node);
647
724
  evt.detail.noState = true;
648
725
  }
649
- this.explorerNodeClicked(evt);
726
+ this.explorerNodeClicked(evt, false);
650
727
  if (this._firstRun) {
651
728
  this._firstRun = false;
652
729
  }
@@ -654,22 +731,36 @@ let TheDoctor = class TheDoctor extends LitElement {
654
731
  this.viewerPanel.click();
655
732
  }
656
733
  }
734
+ else {
735
+ this.sendToast({
736
+ id: crypto.randomUUID(),
737
+ title: 'Unable to load change model',
738
+ type: ToastType.WARNING,
739
+ body: 'There is no-longer a model with the path `' + evt.detail.nodeId + '` in the document',
740
+ });
741
+ console.error('cannot navigate to node, path not found', evt.detail.nodeId);
742
+ }
657
743
  }
658
- explorerNodeClicked(evt) {
744
+ explorerNodeClicked(evt, replaceRenderedNode = true) {
659
745
  let found = false;
660
746
  let foundRenderedNode;
661
747
  this.explorer.nodeComponents.forEach((node) => {
662
- if (node.id === evt.detail.nodeHashId) {
663
- const renderedNode = this.renderedNodeMap.get(node.id);
664
- if (renderedNode && !this._firstRun) {
665
- this.renderedNode.node = renderedNode;
748
+ if (node.id === evt.detail.nodeId) {
749
+ let renderedNode;
750
+ if (replaceRenderedNode) {
751
+ renderedNode = this.renderedNodeMap.get(node.id);
752
+ if (renderedNode && !this._firstRun) {
753
+ this.renderedNode.node = renderedNode;
754
+ }
666
755
  }
667
756
  this.selectedNodeHashId = node.body.node.idHash;
668
757
  node.body.active = true;
669
758
  this.activeNode = node.body.node;
670
759
  this.explorer.activeNode = node.body.node;
671
760
  found = true;
672
- foundRenderedNode = renderedNode;
761
+ if (replaceRenderedNode) {
762
+ foundRenderedNode = renderedNode;
763
+ }
673
764
  if (!evt.detail.noState) {
674
765
  this.addClickTrack(node.body.node);
675
766
  }
@@ -680,9 +771,9 @@ let TheDoctor = class TheDoctor extends LitElement {
680
771
  });
681
772
  if (!found) {
682
773
  // might be filtered, check the filtered nodes
683
- const node = this.nodeIdHashMap.get(evt.detail.nodeHashId);
774
+ const node = this.nodeIdMap.get(evt.detail.nodeId);
684
775
  if (node) {
685
- this.selectedNodeHashId = evt.detail.nodeHashId;
776
+ this.selectedNodeHashId = node.idHash;
686
777
  this.activeNode = node;
687
778
  this.explorer.activeNode = node;
688
779
  this.explorer.equalizer.activeNode = node;
@@ -692,7 +783,7 @@ let TheDoctor = class TheDoctor extends LitElement {
692
783
  // when jumping back to the spec view, we need to set the line
693
784
  this.pendingLine = foundRenderedNode.keyLine;
694
785
  }
695
- this.modelTree.explorerClicked(evt.detail.nodeHashId);
786
+ this.modelTree.explorerClicked(evt.detail.nodeId);
696
787
  if (!this._firstRun) {
697
788
  this.viewerPanel.click();
698
789
  }
@@ -810,6 +901,7 @@ let TheDoctor = class TheDoctor extends LitElement {
810
901
  }
811
902
  }
812
903
  buildRolodexResultMap(results) {
904
+ // TODO: optimize this, it's a bit slow.
813
905
  this.rolodexProblemMap.clear();
814
906
  results.forEach((problem) => {
815
907
  // check if the source location is '/root.yaml'
@@ -839,10 +931,24 @@ let TheDoctor = class TheDoctor extends LitElement {
839
931
  }
840
932
  else {
841
933
  if (!this.rolodexRootPath) {
842
- this.rolodexProblemMap.set("root", [problem]);
934
+ const currProblems = this.rolodexProblemMap.get("root");
935
+ if (currProblems) {
936
+ currProblems.push(problem);
937
+ this.rolodexProblemMap.set("root", currProblems);
938
+ }
939
+ else {
940
+ this.rolodexProblemMap.set("root", [problem]);
941
+ }
843
942
  }
844
943
  else {
845
- this.rolodexProblemMap.set(this.rolodexRootPath, [problem]);
944
+ const currProblems = this.rolodexProblemMap.get(this.rolodexRootPath);
945
+ if (currProblems) {
946
+ currProblems.push(problem);
947
+ this.rolodexProblemMap.set(this.rolodexRootPath, currProblems);
948
+ }
949
+ else {
950
+ this.rolodexProblemMap.set(this.rolodexRootPath, [problem]);
951
+ }
846
952
  }
847
953
  }
848
954
  }
@@ -915,7 +1021,7 @@ let TheDoctor = class TheDoctor extends LitElement {
915
1021
  }
916
1022
  }
917
1023
  let revive = true;
918
- LintingService.lintFile(value, this.brokerConnectionId, url, currentPath).then((result) => {
1024
+ LintingService.lintFile(value, this.brokerConnectionId, url, currentPath, this.skipTimeline).then((result) => {
919
1025
  //if (replaceResults) {
920
1026
  this.activitySpinner.hide();
921
1027
  const map = this.buildRolodexResultMap(result);
@@ -1024,7 +1130,7 @@ let TheDoctor = class TheDoctor extends LitElement {
1024
1130
  }
1025
1131
  // fetch graph
1026
1132
  if ((this.rolodexRootPath == this.rolodexActivePath || this.rolodexActivePath == 'root') || url) {
1027
- ModelService.createGraph().then((result) => {
1133
+ ModelService.fetchLatestGraph().then((result) => {
1028
1134
  this.extractGraph(result);
1029
1135
  });
1030
1136
  }
@@ -1059,6 +1165,7 @@ let TheDoctor = class TheDoctor extends LitElement {
1059
1165
  }
1060
1166
  else {
1061
1167
  this.fetchRefMap(currentPath);
1168
+ this.timeVortex.tardisControl.fetchHistory();
1062
1169
  }
1063
1170
  // update the overview statistics
1064
1171
  LintingService.fetchStatistics().then((result) => {
@@ -1106,6 +1213,7 @@ let TheDoctor = class TheDoctor extends LitElement {
1106
1213
  this.explorerBooted = true;
1107
1214
  }
1108
1215
  }).catch((e) => {
1216
+ this.activitySpinner.hide();
1109
1217
  if (!url) {
1110
1218
  //this.platformUnavailable(e);
1111
1219
  console.error("so sorry, the doctor cannot see you right now, the clinic is closed.");
@@ -1121,6 +1229,14 @@ let TheDoctor = class TheDoctor extends LitElement {
1121
1229
  title: "Credit exhausted!",
1122
1230
  });
1123
1231
  }
1232
+ else {
1233
+ this.sendToast({
1234
+ id: crypto.randomUUID(),
1235
+ type: ToastType.ERROR,
1236
+ body: e.detail,
1237
+ title: "Platform Error",
1238
+ });
1239
+ }
1124
1240
  }
1125
1241
  }
1126
1242
  else {
@@ -1293,6 +1409,14 @@ let TheDoctor = class TheDoctor extends LitElement {
1293
1409
  this.referenceMapBag = this.bagManager.getBag(ReferenceMapBag);
1294
1410
  this.docExpirationBag = this.bagManager.getBag(DocumentationExpirationBag);
1295
1411
  this.panelStateBag = this.bagManager.getBag(PanelStateBag);
1412
+ this.settingsBag = this.bagManager.getBag(SettingsBag);
1413
+ // register a handler for settings bag changes.
1414
+ this.settingsBag?.onAllChanges(this.settingsChanged.bind(this));
1415
+ this.settingsComponent.settingsBag = this.settingsBag;
1416
+ if (this.settingsBag) {
1417
+ this.settingsChanged('', this.settingsBag.get(SettingsBag));
1418
+ }
1419
+ this.settingsComponent.bootstrap();
1296
1420
  // load the rolodex
1297
1421
  if (this.rolodexResponseBag) {
1298
1422
  const response = this.rolodexResponseBag.get(RolodexResponseBag);
@@ -1545,20 +1669,26 @@ let TheDoctor = class TheDoctor extends LitElement {
1545
1669
  const renderedNodes = new Map();
1546
1670
  graph?.nodesRendered?.forEach((node) => {
1547
1671
  this.explorer.renderedNodeMap.set(node.id, node);
1548
- renderedNodes.set(node.idHash, node);
1672
+ renderedNodes.set(node.id, node);
1549
1673
  });
1550
1674
  for (let i = 0; i < graph?.nodesRendered?.length; i++) {
1551
- this.renderedNodeMap.set(graph.nodesRendered[i].idHash, graph.nodesRendered[i]);
1675
+ this.renderedNodeMap.set(graph.nodesRendered[i].id, graph.nodesRendered[i]);
1552
1676
  }
1553
1677
  graph?.nodes?.forEach((node) => {
1554
- this.nodeMap.set('model-' + node.idHash, node);
1555
- this.nodeIdMap.set(node.id, node);
1556
- this.nodeIdHashMap.set(node.idHash, node);
1678
+ this.nodeMap.set(node.id, node);
1679
+ if (node.idHash.includes('root')) {
1680
+ this.nodeIdMap.set('root', node);
1681
+ this.nodeIdHashMap.set(node.id, node);
1682
+ }
1683
+ else {
1684
+ this.nodeIdMap.set(node.id, node);
1685
+ this.nodeIdHashMap.set(node.idHash, node);
1686
+ }
1557
1687
  if (node.filtered) {
1558
- this.filteredNodes.set(node.idHash, node);
1688
+ this.filteredNodes.set(node.id, node);
1559
1689
  }
1560
- const renderedNode = this.renderedNodeMap.get(node.idHash);
1561
- if (this.activeNode?.id === node.id && this.renderedNodeMap.get(node.idHash)) {
1690
+ const renderedNode = this.renderedNodeMap.get(node.id);
1691
+ if (this.activeNode?.id === node.id && this.renderedNodeMap.get(node.id)) {
1562
1692
  if (this.renderedNode && renderedNode) {
1563
1693
  this.renderedNode.node = renderedNode;
1564
1694
  }
@@ -1567,7 +1697,7 @@ let TheDoctor = class TheDoctor extends LitElement {
1567
1697
  this.graphBag?.set(GraphBag, graph);
1568
1698
  this.explorer.updateGraphResponse(graph);
1569
1699
  if (graph && graph.nodes) {
1570
- this.modelTree.node = graph?.nodes[0]; // update tree
1700
+ this.modelTree.node = graph?.nodesRendered[0]; // update tree
1571
1701
  }
1572
1702
  if (!this.explorer.equalizer.isInitialized()) {
1573
1703
  this.explorer.equalizer.initializeEqualizer();
@@ -1575,6 +1705,8 @@ let TheDoctor = class TheDoctor extends LitElement {
1575
1705
  else {
1576
1706
  this.explorer.equalizer.runEQ(true);
1577
1707
  }
1708
+ // sync timeline
1709
+ this.timeVortex.checkHistory();
1578
1710
  }
1579
1711
  customRulesetEnabled(event) {
1580
1712
  const customRS = { rules: new Map() };
@@ -1713,7 +1845,6 @@ let TheDoctor = class TheDoctor extends LitElement {
1713
1845
  this.ruleDocsWorker.addEventListener("message", (event) => {
1714
1846
  const data = event.data;
1715
1847
  if (data) {
1716
- this.docExpirationBag?.set(DocumentationExpirationBag, new Date().toISOString());
1717
1848
  data.forEach((doc) => {
1718
1849
  if (doc.ruleId) {
1719
1850
  this.ruleDocsBag?.set(doc.ruleId, doc);
@@ -1725,20 +1856,20 @@ let TheDoctor = class TheDoctor extends LitElement {
1725
1856
  this.activitySpinner.hide();
1726
1857
  }
1727
1858
  });
1728
- let ruleDocs = [];
1729
- let functionDocs = [];
1730
- if (this.ruleDocsBag) {
1731
- ruleDocs = Array.from(this.ruleDocsBag.export().keys());
1732
- }
1733
- if (this.functionDocsBag) {
1734
- functionDocs = Array.from(this.functionDocsBag.export().keys());
1735
- }
1859
+ // let ruleDocs: string[] = [];
1860
+ // let functionDocs: string[] = [];
1861
+ // if (this.ruleDocsBag) {
1862
+ // ruleDocs = Array.from(this.ruleDocsBag.export().keys());
1863
+ // }
1864
+ // if (this.functionDocsBag) {
1865
+ // functionDocs = Array.from(this.functionDocsBag.export().keys());
1866
+ // }
1736
1867
  const fetchDocs = () => {
1737
1868
  this.ruleDocsWorker.postMessage({
1738
1869
  start: true,
1739
1870
  endpoint: this.doctorEndpoint,
1740
- existingRules: ruleDocs,
1741
- existingFunctions: functionDocs
1871
+ existingRules: [],
1872
+ existingFunctions: []
1742
1873
  });
1743
1874
  };
1744
1875
  // check expiration
@@ -1748,12 +1879,12 @@ let TheDoctor = class TheDoctor extends LitElement {
1748
1879
  if (expiration) {
1749
1880
  const now = new Date().getTime();
1750
1881
  const then = new Date(expiration).getTime();
1751
- if (now - then > 1296000000) {
1752
- fetchDocs();
1753
- }
1754
- else {
1755
- this.activitySpinner.hide();
1756
- }
1882
+ // if (now - then > 1296000000) {
1883
+ // fetchDocs();
1884
+ // } else {
1885
+ // this.activitySpinner.hide();
1886
+ // }
1887
+ fetchDocs(); // always fetch for now.
1757
1888
  }
1758
1889
  else {
1759
1890
  fetchDocs();
@@ -1877,10 +2008,17 @@ let TheDoctor = class TheDoctor extends LitElement {
1877
2008
  if (this.docBag) {
1878
2009
  this.docBag.set(DefaultDocument, event.detail.content);
1879
2010
  }
1880
- clearTimeout(this.bounceId);
1881
- this.bounceId = window.setTimeout(() => {
1882
- this.lintSpec(event.detail.content);
1883
- }, this.debounceTime);
2011
+ if (this.autoDiagnose) {
2012
+ clearTimeout(this.bounceId);
2013
+ this.bounceId = window.setTimeout(() => {
2014
+ this.lintSpec(event.detail.content);
2015
+ }, this.debounceTime);
2016
+ }
2017
+ }
2018
+ runDiagnostics() {
2019
+ if (!this.autoDiagnose) {
2020
+ this.lintSpec(this.editor.getValue());
2021
+ }
1884
2022
  }
1885
2023
  boostrap() {
1886
2024
  // if the url is set in the query string, fetch it and run a lint with the URL
@@ -1892,18 +2030,25 @@ let TheDoctor = class TheDoctor extends LitElement {
1892
2030
  this.lintSpec('', urlParam);
1893
2031
  return;
1894
2032
  }
1895
- if (this.editor.getValue() === '' || !this.problems) {
1896
- LintingService.bootstrapEditor().then((result) => {
1897
- this.editor.setValue(result, true);
1898
- this.rolodexActivePath = "";
1899
- this.specChanged(new CustomEvent(EditorUpdated, {
1900
- detail: {
1901
- content: result,
1902
- id: "spec"
1903
- }
1904
- }));
1905
- });
1906
- }
2033
+ setTimeout(() => {
2034
+ this.loadingOverlay.hide();
2035
+ // check for a history
2036
+ this.timeVortex.doctor = this;
2037
+ this.timeVortex.checkHistory();
2038
+ const editorValue = this.docBag?.get(DefaultDocument);
2039
+ if (!editorValue) {
2040
+ LintingService.bootstrapEditor().then((result) => {
2041
+ this.editor.setValue(result, true);
2042
+ this.rolodexActivePath = "";
2043
+ this.specChanged(new CustomEvent(EditorUpdated, {
2044
+ detail: {
2045
+ content: result,
2046
+ id: "spec"
2047
+ }
2048
+ }));
2049
+ });
2050
+ }
2051
+ }, 200);
1907
2052
  }
1908
2053
  exportJSON() {
1909
2054
  let jsonRS;
@@ -1959,10 +2104,10 @@ let TheDoctor = class TheDoctor extends LitElement {
1959
2104
  switch (event.detail.name) {
1960
2105
  case ActiveView.Problems:
1961
2106
  case ActiveView.Overview:
1962
- if (this.selectedEditorTab != "spec") {
1963
- this.selectedEditorTab = "spec";
1964
- this.editorTabGroup.show("spec");
1965
- }
2107
+ // if (this.selectedEditorTab != "spec") {
2108
+ // this.selectedEditorTab = "spec";
2109
+ // this.editorTabGroup.show("spec");
2110
+ // }
1966
2111
  break;
1967
2112
  case ActiveView.Ruleset:
1968
2113
  if (this.selectedEditorTab != ActiveView.Ruleset) {
@@ -2000,12 +2145,18 @@ let TheDoctor = class TheDoctor extends LitElement {
2000
2145
  }
2001
2146
  this.sidebarClosed = !this.sidebarClosed;
2002
2147
  }
2148
+ showHistory() {
2149
+ this.closeExplorer();
2150
+ this.hideMinimapIcon();
2151
+ this.requestUpdate();
2152
+ }
2003
2153
  toggleExplorer() {
2004
2154
  this.explorerVisible = !this.explorerVisible;
2005
2155
  if (this.explorerVisible && this.activeNode) {
2006
2156
  this.explorer.moveToNode(this.activeNode);
2007
2157
  }
2008
2158
  this.hideMinimapIcon();
2159
+ this.showDiagnosisButton = false;
2009
2160
  this.explorerBooted = true;
2010
2161
  // check if ths is safari and fire a warning toast!
2011
2162
  const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
@@ -2019,16 +2170,23 @@ let TheDoctor = class TheDoctor extends LitElement {
2019
2170
  }
2020
2171
  }
2021
2172
  hideMinimapIcon() {
2022
- console.log('hiding minimap icon');
2023
2173
  this.minimapIconVisible = false;
2024
2174
  }
2175
+ hideDiagnosisButton() {
2176
+ this.showDiagnosisButton = false;
2177
+ }
2178
+ enableDiagnosisButton() {
2179
+ if (!this.autoDiagnose) {
2180
+ this.showDiagnosisButton = true;
2181
+ }
2182
+ }
2025
2183
  showMinimapIcon() {
2026
- console.log('showing minimap icon');
2027
2184
  this.minimapIconVisible = true;
2028
2185
  }
2029
2186
  closeExplorer() {
2030
2187
  this.explorerVisible = false;
2031
2188
  this.showMinimapIcon();
2189
+ this.showDiagnosisButton = true;
2032
2190
  setTimeout(() => {
2033
2191
  if (this.pendingLine > 0) {
2034
2192
  this.editor.editor?.setPosition({ lineNumber: this.pendingLine, column: 1 });
@@ -2098,6 +2256,25 @@ let TheDoctor = class TheDoctor extends LitElement {
2098
2256
  </div>
2099
2257
  </sl-split-panel>`;
2100
2258
  }
2259
+ // if the timeVortex is on and the picker is visible, we need to wrap the model tree in a tab view.
2260
+ if (this.timeVortex.pickerVisible) {
2261
+ modelTree = html `
2262
+ <sl-tab-group class="tab-group timevortex" @sl-tab-show="${this.selectEditorTab}">
2263
+ <sl-tab slot="nav" panel="model-tree" class="tab" id="model-tree">
2264
+ Document
2265
+ </sl-tab>
2266
+ <sl-tab slot="nav" panel="timeline" class="tab" id="timeline-view">
2267
+ Timeline
2268
+ </sl-tab>
2269
+ <sl-tab-panel name="model-tree" class="tab-panel model-tree-panel">
2270
+ ${modelTree}
2271
+ </sl-tab-panel>
2272
+ <sl-tab-panel name="timeline" class="tab-panel">
2273
+ ${this.timeVortex.historyPicker}
2274
+ </sl-tab-panel>
2275
+ </sl-tab-group>
2276
+ `;
2277
+ }
2101
2278
  return html `
2102
2279
  ${this.uploadArchive}
2103
2280
  ${this.nukeWorkspace}
@@ -2165,33 +2342,73 @@ let TheDoctor = class TheDoctor extends LitElement {
2165
2342
  class="divider-vert"></sl-icon>
2166
2343
  <div class="editor" slot="start">
2167
2344
 
2168
- <sl-tooltip class="minimap-tip" content="Toggle source mini-map" hoist style="${!this.minimapIconVisible ? 'display: none' : ''}">
2345
+ ${this.settingsComponent}
2346
+
2347
+ <sl-tooltip class="minimap-tip" content="Toggle source mini-map" hoist
2348
+ style="${!this.minimapIconVisible ? 'display: none' : ''}">
2169
2349
  <sl-icon-button @click="${this.minimapToggled}"
2170
2350
  name="map"
2171
- class="minimap-toggle ${this.minimapVisible ? 'active' : ''}"
2351
+ class="minimap-toggle ${this.minimapVisible ? 'active' : ''}"
2172
2352
  style="${!this.minimapIconVisible ? 'display: none' : ''}"></sl-icon-button>
2173
2353
  </sl-tooltip>
2174
2354
 
2355
+ <sl-tooltip class="settings-tip" content="Open settings for the doctor" hoist>
2356
+ <sl-icon-button @click="${() => {
2357
+ this.settingsComponent.open();
2358
+ }}"
2359
+ name="gear"
2360
+ class="settings-toggle ${!this.settingsComponent.opened ? 'active' : ''}"></sl-icon-button>
2361
+ </sl-tooltip>
2362
+
2363
+ <sl-button class="diagnose-button" @click="${this.runDiagnostics}"
2364
+ size="small"
2365
+ style="${(this.autoDiagnose || !this.showDiagnosisButton) ? 'display: none' : ''}">
2366
+ make diagnosis
2367
+ </sl-button>
2368
+
2369
+
2175
2370
  ${this.detailsDrawer}
2176
2371
  <sl-tab-group class="tab-group" @sl-tab-show="${this.selectEditorTab}"
2177
2372
  id="editor-controls">
2178
2373
 
2179
2374
  <sl-tab slot="nav" panel="spec" class="tab" id="spec"
2180
- @click="${this.closeExplorer}">
2375
+ @click="${() => {
2376
+ this.closeExplorer();
2377
+ this.enableDiagnosisButton();
2378
+ }}">
2181
2379
  OpenAPI Spec
2182
2380
  </sl-tab>
2183
2381
  <sl-tab slot="nav" panel="explorer" class="tab" id="explorer"
2184
- @click="${this.toggleExplorer}">Explorer
2382
+ @click="${() => {
2383
+ this.toggleExplorer();
2384
+ this.hideDiagnosisButton();
2385
+ }}">Explorer
2386
+ </sl-tab>
2387
+
2388
+
2389
+ <sl-tab slot="nav" panel="tardis" class="tab" id="history"
2390
+ @click="${() => {
2391
+ this.showHistory();
2392
+ this.hideDiagnosisButton();
2393
+ }}">History
2185
2394
  </sl-tab>
2395
+
2186
2396
  <sl-tab slot="nav" panel="ruleset" class="tab" id="ruleset"
2187
- @click="${this.closeExplorer}">
2397
+ @click="${() => {
2398
+ this.closeExplorer();
2399
+ this.hideDiagnosisButton();
2400
+ }}">
2188
2401
  Ruleset ${rulesetPulsePill}
2189
2402
  </sl-tab>
2190
2403
 
2191
- <sl-tab slot="nav" panel="docs" class="tab" id="docs" @click="${this.hideMinimapIcon}">
2404
+ <sl-tab slot="nav" panel="docs" class="tab" id="docs"
2405
+ @click="${() => {
2406
+ this.hideMinimapIcon();
2407
+ this.hideDiagnosisButton();
2408
+ }}">
2192
2409
  API Docs
2193
2410
  </sl-tab>
2194
-
2411
+
2195
2412
 
2196
2413
  <sl-tab-panel name="spec" class="tab-panel">
2197
2414
  <div class="main-view">
@@ -2231,6 +2448,10 @@ let TheDoctor = class TheDoctor extends LitElement {
2231
2448
  @mouseleave="${this.ungrabExplorer}">${this.explorer}
2232
2449
  </sl-tab-panel>
2233
2450
 
2451
+ <sl-tab-panel name="tardis" class="tab-panel">
2452
+ ${this.timeVortex.tardisControl}
2453
+ </sl-tab-panel>
2454
+
2234
2455
  <sl-tab-panel name="docs" class="tab-panel" style="height: calc(100vh - 100px)">
2235
2456
  <iframe src="${this.doctorEndpoint}/model/scalar-template?z=${this.randomTicker}" width="100%" height="100%" style="border: none"></iframe>
2236
2457
  </sl-tab-panel>
@@ -2244,6 +2465,7 @@ let TheDoctor = class TheDoctor extends LitElement {
2244
2465
 
2245
2466
  </div>`;
2246
2467
  }
2468
+ // <iframe src="${this.doctorEndpoint}/model/scalar-template?z=${this.randomTicker}" width="100%" height="100%" style="border: none"></iframe>
2247
2469
  fetchUrl(event) {
2248
2470
  this.activeURL = event.detail.url;
2249
2471
  this.rolodexNeedsReset = true;
@@ -2268,8 +2490,12 @@ let TheDoctor = class TheDoctor extends LitElement {
2268
2490
  ungrabExplorer() {
2269
2491
  this.explorer.grabbed = false;
2270
2492
  }
2493
+ selectTardis() {
2494
+ this.closeExplorer();
2495
+ this.historyPanel.click();
2496
+ }
2271
2497
  };
2272
- TheDoctor.styles = [theDoctorCss, linksCss, dialogCss, buttonCss, radioGroupsCss, tabsCss, formsCss, spinnerCss, tooltipCss];
2498
+ TheDoctor.styles = [theDoctorCss, linksCss, dialogCss, buttonCss, radioGroupsCss, tabsCss, formsCss, spinnerCss, tooltipCss, panelsCss];
2273
2499
  __decorate([
2274
2500
  query('#overviewPanel')
2275
2501
  ], TheDoctor.prototype, "overviewPanel", void 0);
@@ -2282,6 +2508,9 @@ __decorate([
2282
2508
  __decorate([
2283
2509
  query('#explorer')
2284
2510
  ], TheDoctor.prototype, "explorerPanel", void 0);
2511
+ __decorate([
2512
+ query('#history')
2513
+ ], TheDoctor.prototype, "historyPanel", void 0);
2285
2514
  __decorate([
2286
2515
  query('sl-tab-group#manager-controls')
2287
2516
  ], TheDoctor.prototype, "controlTabGroup", void 0);
@@ -2366,6 +2595,12 @@ __decorate([
2366
2595
  __decorate([
2367
2596
  state()
2368
2597
  ], TheDoctor.prototype, "rolodexNeedsReset", void 0);
2598
+ __decorate([
2599
+ state()
2600
+ ], TheDoctor.prototype, "autoDiagnose", void 0);
2601
+ __decorate([
2602
+ state()
2603
+ ], TheDoctor.prototype, "showDiagnosisButton", void 0);
2369
2604
  TheDoctor = __decorate([
2370
2605
  customElement("pb33f-doctor")
2371
2606
  ], TheDoctor);