@mobilewright/inspector 0.0.59 → 0.0.61

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 (43) hide show
  1. package/dist/index.d.ts +4 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +42 -8
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/device-manager.d.ts +24 -9
  6. package/dist/lib/device-manager.d.ts.map +1 -1
  7. package/dist/lib/device-manager.js +95 -14
  8. package/dist/lib/device-manager.js.map +1 -1
  9. package/dist/lib/inspect-screen.d.ts +47 -0
  10. package/dist/lib/inspect-screen.d.ts.map +1 -0
  11. package/dist/lib/inspect-screen.js +104 -0
  12. package/dist/lib/inspect-screen.js.map +1 -0
  13. package/dist/lib/locator-derivation.d.ts +20 -5
  14. package/dist/lib/locator-derivation.d.ts.map +1 -1
  15. package/dist/lib/locator-derivation.js +64 -7
  16. package/dist/lib/locator-derivation.js.map +1 -1
  17. package/dist/lib/timeout.d.ts +3 -0
  18. package/dist/lib/timeout.d.ts.map +1 -0
  19. package/dist/lib/timeout.js +9 -0
  20. package/dist/lib/timeout.js.map +1 -0
  21. package/dist/routes/device-actions.d.ts +7 -0
  22. package/dist/routes/device-actions.d.ts.map +1 -0
  23. package/dist/routes/device-actions.js +79 -0
  24. package/dist/routes/device-actions.js.map +1 -0
  25. package/dist/routes/devices.d.ts +1 -1
  26. package/dist/routes/devices.d.ts.map +1 -1
  27. package/dist/routes/devices.js +10 -11
  28. package/dist/routes/devices.js.map +1 -1
  29. package/dist/routes/inspect.d.ts.map +1 -1
  30. package/dist/routes/inspect.js +22 -92
  31. package/dist/routes/inspect.js.map +1 -1
  32. package/package.json +4 -4
  33. package/public/codegen.html +119 -0
  34. package/public/css/app.css +276 -6
  35. package/public/favicon.ico +0 -0
  36. package/public/fonts/codicon-LICENSE.txt +21 -0
  37. package/public/fonts/codicon.ttf +0 -0
  38. package/public/index.html +5 -2
  39. package/public/js/app.js +253 -51
  40. package/public/js/codegen.js +301 -0
  41. package/public/js/inspect.js +7 -0
  42. package/public/js/view-tree.js +182 -0
  43. package/public/logo.png +0 -0
@@ -169,6 +169,9 @@ header {
169
169
  }
170
170
 
171
171
  header h1 {
172
+ display: flex;
173
+ align-items: center;
174
+ gap: 8px;
172
175
  font-size: 14px;
173
176
  font-weight: 600;
174
177
  margin: 0;
@@ -256,15 +259,33 @@ main {
256
259
  overflow: hidden;
257
260
  }
258
261
 
262
+ /* ---- Splitters ---- */
263
+
264
+ .splitter {
265
+ flex: 0 0 7px;
266
+ cursor: col-resize;
267
+ touch-action: none;
268
+ background: linear-gradient(var(--c-border), var(--c-border)) center / 1px 100% no-repeat;
269
+ }
270
+
271
+ .splitter:hover,
272
+ .splitter:focus-visible,
273
+ .splitter.dragging {
274
+ outline: none;
275
+ background: linear-gradient(var(--c-accent), var(--c-accent)) center / 3px 100% no-repeat;
276
+ }
277
+
278
+ .splitter:has(+ [hidden]) { display: none; }
279
+
259
280
  /* ---- Screenshot pane ---- */
260
281
 
261
282
  #screenshot-pane {
262
283
  flex: 0 0 auto;
284
+ width: var(--screenshot-width, auto);
263
285
  min-width: 300px;
264
286
  max-width: 50%;
265
287
  position: relative;
266
288
  overflow: hidden;
267
- border-right: 1px solid var(--c-border);
268
289
  background: var(--c-pane-bg);
269
290
  display: flex;
270
291
  align-items: flex-start;
@@ -468,10 +489,11 @@ main {
468
489
  /* ---- Detail pane ---- */
469
490
 
470
491
  #detail-pane {
471
- flex: 0 0 320px;
492
+ flex: 0 0 var(--detail-width, 320px);
493
+ min-width: 240px;
494
+ max-width: 60%;
472
495
  overflow-y: auto;
473
496
  background: var(--c-surface);
474
- border-left: 1px solid var(--c-border);
475
497
  display: flex;
476
498
  flex-direction: column;
477
499
  animation: slide-in 0.15s ease-out;
@@ -479,7 +501,7 @@ main {
479
501
 
480
502
  @keyframes slide-in {
481
503
  from { flex-basis: 0; opacity: 0; }
482
- to { flex-basis: 320px; opacity: 1; }
504
+ to { flex-basis: var(--detail-width, 320px); opacity: 1; }
483
505
  }
484
506
 
485
507
  #detail-header {
@@ -674,15 +696,263 @@ main {
674
696
  main {
675
697
  flex-direction: column;
676
698
  }
699
+ .splitter { display: none; }
677
700
  #screenshot-pane {
701
+ width: auto;
678
702
  max-width: 100%;
679
- border-right: none;
680
703
  border-bottom: 1px solid var(--c-border);
681
704
  }
682
705
  #detail-pane {
683
706
  flex: 1;
684
707
  width: 100%;
685
- border-left: none;
708
+ max-width: 100%;
686
709
  border-top: 1px solid var(--c-border);
687
710
  }
688
711
  }
712
+
713
+ /* ---- Codegen ---- */
714
+
715
+ /* Icon font copied from Playwright (vscode codicons, MIT, see fonts/codicon-LICENSE.txt). */
716
+ @font-face {
717
+ font-family: "codicon";
718
+ src: url("../fonts/codicon.ttf") format("truetype");
719
+ }
720
+
721
+ .codicon {
722
+ font: normal normal normal 16px/1 codicon;
723
+ display: inline-block;
724
+ -webkit-font-smoothing: antialiased;
725
+ user-select: none;
726
+ }
727
+
728
+ .codicon-circle-large-filled::before { content: '\ebb4'; }
729
+ .codicon-whole-word::before { content: '\eb7e'; }
730
+ .codicon-symbol-constant::before { content: '\eb5d'; }
731
+ .codicon-gist::before { content: '\eafb'; }
732
+ .codicon-home::before { content: '\eb06'; }
733
+ .codicon-multiple-windows::before { content: '\eb23'; }
734
+ .codicon-arrow-left::before { content: '\ea9b'; }
735
+ .codicon-list-tree::before { content: '\eb86'; }
736
+ .codicon-files::before { content: '\eaf0'; }
737
+ .codicon-check::before { content: '\eab2'; }
738
+ .codicon-location::before { content: '\eb1a'; }
739
+ .codicon-chevron-down::before { content: '\eab4'; }
740
+ .codicon-chevron-right::before { content: '\eab6'; }
741
+
742
+ .codegen #screenshot-img { cursor: crosshair; }
743
+
744
+ .codegen #screenshot-pane {
745
+ flex-direction: column;
746
+ align-items: center;
747
+ justify-content: flex-start; /* keep the device buttons at the top, whatever the image height */
748
+ gap: 8px;
749
+ }
750
+
751
+ #device-toolbar {
752
+ display: flex;
753
+ gap: 4px;
754
+ }
755
+
756
+ /* The image is hidden whenever a placeholder shows (no device, connecting, no screenshot yet). */
757
+ #screenshot-pane:has(#screenshot-img[hidden]) #device-toolbar { display: none; }
758
+
759
+ /* The element under the pointer; clicks pass through to the screenshot. */
760
+ .hover-rect {
761
+ fill: var(--c-accent);
762
+ fill-opacity: 0.5;
763
+ stroke: var(--c-accent);
764
+ stroke-width: 2;
765
+ pointer-events: none;
766
+ }
767
+
768
+ #editor-pane {
769
+ flex: 1;
770
+ display: flex;
771
+ flex-direction: column;
772
+ min-width: 0;
773
+ background: var(--c-surface2);
774
+ }
775
+
776
+ #recorder-toolbar {
777
+ display: flex;
778
+ align-items: center;
779
+ gap: 4px;
780
+ padding: 4px 8px;
781
+ background: var(--c-surface);
782
+ border-bottom: 1px solid var(--c-border);
783
+ }
784
+
785
+ .tool-btn {
786
+ display: inline-flex;
787
+ align-items: center;
788
+ gap: 6px;
789
+ background: none;
790
+ color: var(--c-text);
791
+ border: 1px solid transparent;
792
+ border-radius: 4px;
793
+ padding: 4px 8px;
794
+ font-size: 12px;
795
+ cursor: pointer;
796
+ }
797
+
798
+ .tool-btn:hover:not(:disabled) { background: var(--c-row-hover); }
799
+ .tool-btn:focus-visible { outline: none; border-color: var(--c-accent); }
800
+ .tool-btn:disabled { opacity: 0.4; cursor: default; }
801
+
802
+ #record-btn .codicon { color: var(--c-text-muted); }
803
+ .assert-btn[aria-pressed="true"] { background: var(--c-accent-dim); border-color: var(--c-accent); }
804
+
805
+ /* In assert modes the hover box turns the "selected" color, so it's clear a click won't tap. */
806
+ [data-click-mode="assertText"] .hover-rect,
807
+ [data-click-mode="assertValue"] .hover-rect {
808
+ fill: var(--c-selected);
809
+ stroke: var(--c-selected);
810
+ }
811
+ #record-btn[aria-pressed="true"] .codicon { color: var(--c-status-error); }
812
+
813
+ .tool-separator {
814
+ width: 1px;
815
+ height: 16px;
816
+ margin: 0 4px;
817
+ background: var(--c-border);
818
+ }
819
+
820
+ #code-editor {
821
+ flex: 1;
822
+ resize: none;
823
+ border: none;
824
+ outline: none;
825
+ padding: 12px 16px;
826
+ background: var(--c-pane-bg);
827
+ color: var(--c-text);
828
+ font: 13px/1.5 'SF Mono', Menlo, Monaco, monospace;
829
+ tab-size: 2;
830
+ }
831
+
832
+ /* ---- View tree ---- */
833
+
834
+ #tree-pane {
835
+ flex: 0 0 var(--tree-width, 360px);
836
+ min-width: 240px;
837
+ max-width: 60%;
838
+ display: flex;
839
+ flex-direction: column;
840
+ overflow: hidden;
841
+ background: var(--c-surface2);
842
+ }
843
+
844
+ #view-tree {
845
+ flex: 1;
846
+ min-height: 0;
847
+ overflow: auto;
848
+ padding: 4px 0;
849
+ font: 12px/22px 'SF Mono', Menlo, Monaco, monospace;
850
+ }
851
+
852
+ .tree-row {
853
+ display: flex;
854
+ align-items: center;
855
+ padding-right: 8px;
856
+ white-space: nowrap;
857
+ cursor: pointer;
858
+ }
859
+
860
+ .tree-row:hover { background: var(--c-row-hover); }
861
+ .tree-row.offscreen { opacity: 0.5; }
862
+
863
+ .tree-twisty {
864
+ flex: none;
865
+ width: 18px;
866
+ background: none;
867
+ border: none;
868
+ color: var(--c-text-muted);
869
+ cursor: pointer;
870
+ padding: 0;
871
+ }
872
+
873
+ .tree-type { color: var(--c-text); }
874
+ .tree-name { color: var(--c-text-muted); overflow: hidden; text-overflow: ellipsis; }
875
+
876
+ /* ---- Set location popover ---- */
877
+
878
+ #geo-popover {
879
+ padding: 16px;
880
+ border: 1px solid var(--c-border);
881
+ border-radius: 8px;
882
+ background: var(--c-surface);
883
+ color: var(--c-text);
884
+ box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
885
+ }
886
+
887
+ #geo-popover[popover]:popover-open {
888
+ display: flex;
889
+ flex-direction: column;
890
+ gap: 10px;
891
+ }
892
+
893
+ #geo-popover::backdrop { background: rgba(0, 0, 0, 0.3); }
894
+
895
+ #geo-popover label {
896
+ display: flex;
897
+ justify-content: space-between;
898
+ align-items: center;
899
+ gap: 12px;
900
+ font-size: 12px;
901
+ color: var(--c-text-muted);
902
+ }
903
+
904
+ #geo-popover input {
905
+ width: 140px;
906
+ background: var(--c-bg);
907
+ color: var(--c-text);
908
+ border: 1px solid var(--c-border);
909
+ border-radius: 4px;
910
+ padding: 4px 8px;
911
+ font: 12px 'SF Mono', Menlo, Monaco, monospace;
912
+ }
913
+
914
+ #geo-popover input:focus { outline: none; border-color: var(--c-accent); }
915
+
916
+ .geo-actions {
917
+ display: flex;
918
+ justify-content: space-between;
919
+ gap: 8px;
920
+ }
921
+
922
+ .geo-set-btn { border-color: var(--c-accent); color: var(--c-accent); }
923
+
924
+ .tree-row.selected { background: var(--c-selected-bg); }
925
+
926
+ /* ---- Element details under the view tree (codegen) ---- */
927
+
928
+ #tree-pane #detail-pane {
929
+ flex: 0 0 var(--detail-height, 40%);
930
+ min-height: 80px;
931
+ max-height: 85%;
932
+ min-width: 0;
933
+ max-width: none;
934
+ }
935
+
936
+ .splitter.horizontal {
937
+ cursor: row-resize;
938
+ background: linear-gradient(var(--c-border), var(--c-border)) center / 100% 1px no-repeat;
939
+ }
940
+
941
+ .splitter.horizontal:hover,
942
+ .splitter.horizontal:focus-visible,
943
+ .splitter.horizontal.dragging {
944
+ background: linear-gradient(var(--c-accent), var(--c-accent)) center / 100% 3px no-repeat;
945
+ }
946
+
947
+ #detail-actions {
948
+ display: flex;
949
+ gap: 6px;
950
+ }
951
+
952
+ .gesture-btn {
953
+ flex: 1;
954
+ justify-content: center;
955
+ border-color: var(--c-border);
956
+ background: var(--c-surface2);
957
+ }
958
+
Binary file
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2015 - present Microsoft Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
Binary file
package/public/index.html CHANGED
@@ -7,7 +7,7 @@
7
7
  </head>
8
8
  <body>
9
9
  <header>
10
- <h1>Mobilewright Inspector</h1>
10
+ <h1><img src="/logo.png" alt="" width="22" height="18" />Mobilewright Inspector</h1>
11
11
  <div id="device-picker">
12
12
  <select id="device-select" aria-label="Device">
13
13
  <option value="">No devices found</option>
@@ -20,6 +20,7 @@
20
20
  Auto-refresh
21
21
  </label>
22
22
  <select id="auto-refresh-interval" aria-label="Auto-refresh interval" disabled>
23
+ <option value="1000">1 s</option>
23
24
  <option value="5000">5 s</option>
24
25
  <option value="10000">10 s</option>
25
26
  <option value="20000">20 s</option>
@@ -57,9 +58,11 @@
57
58
  <svg id="highlight-overlay" hidden></svg>
58
59
  </div>
59
60
  </section>
61
+ <div class="splitter" id="screenshot-splitter" role="separator" aria-orientation="vertical" aria-label="Resize device pane" tabindex="0"></div>
60
62
  <section id="elements-pane">
61
63
  <div id="elements-list"></div>
62
64
  </section>
65
+ <div class="splitter" id="detail-splitter" role="separator" aria-orientation="vertical" aria-label="Resize inspector pane" tabindex="0"></div>
63
66
  <section id="detail-pane" hidden>
64
67
  <div id="detail-header">
65
68
  <span id="detail-type"></span>
@@ -73,6 +76,6 @@
73
76
  </section>
74
77
  </main>
75
78
 
76
- <script src="/js/app.js" type="module"></script>
79
+ <script src="/js/inspect.js" type="module"></script>
77
80
  </body>
78
81
  </html>