@playcanvas/inspector 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +147 -5
  2. package/package.json +1 -1
  3. package/src/asset-view.js +24 -17
  4. package/src/camera-view.js +5 -3
  5. package/src/context-menu.js +231 -0
  6. package/src/copy-json.js +692 -0
  7. package/src/describe.js +20 -1
  8. package/src/entity-inspector-script.js +10 -0
  9. package/src/frame-graph-view.js +41 -9
  10. package/src/hierarchy-view.js +29 -3
  11. package/src/inspector.js +958 -80
  12. package/src/list-view.js +118 -12
  13. package/src/material-view.js +7 -6
  14. package/src/memory-view.js +224 -66
  15. package/src/mesh-view.js +6 -5
  16. package/src/model.js +24 -2
  17. package/src/node-model.js +81 -11
  18. package/src/perf-capture.js +2034 -0
  19. package/src/perf-chart.js +3989 -0
  20. package/src/perf-copy.js +367 -0
  21. package/src/perf-view.js +1224 -0
  22. package/src/property-view.js +162 -5
  23. package/src/render-target-view.js +3 -3
  24. package/src/script-view.js +21 -12
  25. package/src/styles.js +374 -2
  26. package/src/texture-view.js +4 -4
  27. package/src/transform-tool.js +185 -0
  28. package/types/asset-view.d.ts +3 -1
  29. package/types/camera-view.d.ts +4 -0
  30. package/types/context-menu.d.ts +90 -0
  31. package/types/copy-json.d.ts +69 -0
  32. package/types/describe.d.ts +1 -1
  33. package/types/entity-inspector-script.d.ts +8 -0
  34. package/types/frame-graph-view.d.ts +7 -0
  35. package/types/hierarchy-view.d.ts +13 -0
  36. package/types/inspector.d.ts +339 -25
  37. package/types/list-view.d.ts +44 -3
  38. package/types/material-view.d.ts +3 -1
  39. package/types/memory-view.d.ts +24 -25
  40. package/types/mesh-view.d.ts +3 -1
  41. package/types/model.d.ts +16 -1
  42. package/types/node-model.d.ts +17 -1
  43. package/types/perf-capture.d.ts +871 -0
  44. package/types/perf-chart.d.ts +1407 -0
  45. package/types/perf-copy.d.ts +61 -0
  46. package/types/perf-view.d.ts +231 -0
  47. package/types/property-view.d.ts +41 -0
  48. package/types/script-view.d.ts +3 -1
  49. package/types/transform-tool.d.ts +92 -0
@@ -0,0 +1,90 @@
1
+ /**
2
+ * An entry of a context menu.
3
+ */
4
+ export type MenuItem = object;
5
+ export type MenuButton = object;
6
+ /**
7
+ * A menu opened where the pointer is, and a note shown briefly at the bottom of the panel, such as
8
+ * for what was copied. Both live in the panel, so they move with it into a popped-out window. The
9
+ * menu closes on a choice, a press anywhere outside it, Escape, scrolling and leaving the window.
10
+ *
11
+ * @ignore
12
+ */
13
+ export class ContextMenu {
14
+ /**
15
+ * @param {HTMLElement} panel - The panel to show the menu and notes in.
16
+ */
17
+ constructor(panel: HTMLElement);
18
+ /**
19
+ * @type {HTMLElement}
20
+ * @private
21
+ */
22
+ private _panel;
23
+ /**
24
+ * @type {HTMLElement}
25
+ * @private
26
+ */
27
+ private _menu;
28
+ /**
29
+ * @type {HTMLElement}
30
+ * @private
31
+ */
32
+ private _note;
33
+ /**
34
+ * @type {number}
35
+ * @private
36
+ */
37
+ private _noteTimer;
38
+ /**
39
+ * The document the closing listeners are on while the menu is open.
40
+ *
41
+ * @type {Document|null}
42
+ * @private
43
+ */
44
+ private _doc;
45
+ /**
46
+ * Whether the menu is open.
47
+ *
48
+ * @type {boolean}
49
+ */
50
+ get open(): boolean;
51
+ /**
52
+ * Opens the menu at a point, in place of any menu already open.
53
+ *
54
+ * @param {number} x - The point, in client pixels.
55
+ * @param {number} y - The point, in client pixels.
56
+ * @param {string} title - What the menu acts on.
57
+ * @param {MenuItem[]} items - The entries.
58
+ */
59
+ show(x: number, y: number, title: string, items: MenuItem[]): void;
60
+ /**
61
+ * Closes the menu, if it is open.
62
+ */
63
+ hide: () => void;
64
+ /**
65
+ * Shows a note at the bottom of the panel for a moment.
66
+ *
67
+ * @param {string} text - The note.
68
+ */
69
+ note(text: string): void;
70
+ /**
71
+ * Closes the menu and removes its elements.
72
+ */
73
+ destroy(): void;
74
+ /**
75
+ * @param {MenuItem} item - An entry.
76
+ * @returns {HTMLElement} Its element.
77
+ * @private
78
+ */
79
+ private _entry;
80
+ /**
81
+ * @param {PointerEvent} e - The event.
82
+ * @private
83
+ */
84
+ private _onPointerDown;
85
+ /**
86
+ * @param {KeyboardEvent} e - The event.
87
+ * @private
88
+ */
89
+ private _onKeyDown;
90
+ }
@@ -0,0 +1,69 @@
1
+ /**
2
+ * How far a copy follows the links of what it copies.
3
+ */
4
+ export type CopyOptions = object;
5
+ export type CopyResult = object;
6
+ /**
7
+ * Copies a group of a list, under its title. See {@link JsonCopy#group}.
8
+ *
9
+ * @param {ListRow[]} rows - The rows of the list.
10
+ * @param {string} key - The key of the group's header.
11
+ * @param {CopyOptions} options - How far to follow links from each entry.
12
+ * @returns {CopyResult} The copy, empty when the group is gone.
13
+ */
14
+ export function copyGroup(rows: ListRow[], key: string, options: CopyOptions): CopyResult;
15
+ /**
16
+ * Copies a list, such as everything a tab lists, under its name. See {@link JsonCopy#listRows}.
17
+ *
18
+ * @param {string} title - The name of the list.
19
+ * @param {ListRow[]} rows - Its rows, all of them, whatever its filter shows.
20
+ * @param {CopyOptions} options - How far to follow links from each entry.
21
+ * @returns {CopyResult} The copy.
22
+ */
23
+ export function copyList(title: string, rows: ListRow[], options: CopyOptions): CopyResult;
24
+ /**
25
+ * Copies the figures of a row of a list that selects nothing, such as the size of a pool.
26
+ *
27
+ * @param {ListRow} row - The row.
28
+ * @returns {CopyResult} The copy.
29
+ */
30
+ export function copyListRow(row: ListRow): CopyResult;
31
+ /**
32
+ * Copies a row. A row standing for an object copies the object, counting the links followed from
33
+ * it; a list copies its entries the same way, each as if it was copied on its own. Anything else
34
+ * is copied under its label.
35
+ *
36
+ * @param {PropertyRow} row - The row.
37
+ * @param {CopyOptions} options - How far to follow links.
38
+ * @returns {CopyResult} The copy.
39
+ */
40
+ export function copyRow(row: PropertyRow, options: CopyOptions): CopyResult;
41
+ /**
42
+ * Copies a section of the subject, under its title.
43
+ *
44
+ * @param {PropertySection} section - The section.
45
+ * @param {CopyOptions} options - How far to follow links.
46
+ * @returns {CopyResult} The copy.
47
+ */
48
+ export function copySection(section: PropertySection, options: CopyOptions): CopyResult;
49
+ /**
50
+ * Copies the subject of the panel, which is where the links followed are counted from.
51
+ *
52
+ * @param {object} subject - The subject.
53
+ * @param {PropertySection[]} sections - What the panel shows for it.
54
+ * @param {CopyOptions} options - How far to follow links.
55
+ * @returns {CopyResult} The copy.
56
+ */
57
+ export function copySubject(subject: object, sections: PropertySection[], options: CopyOptions): CopyResult;
58
+ /**
59
+ * Prints a copy as indented JSON, the way `JSON.stringify` does, except that a list of plain
60
+ * values stays on one line, so a vector reads as `[0, 1, 0]` rather than taking five lines.
61
+ *
62
+ * @param {*} json - The copy.
63
+ * @param {string} [indent] - The indentation of the line the value starts on.
64
+ * @returns {string} The text.
65
+ */
66
+ export function stringifyCopy(json: any, indent?: string): string;
67
+ import type { ListRow } from './list-view.js';
68
+ import type { PropertyRow } from './model.js';
69
+ import type { PropertySection } from './model.js';
@@ -22,7 +22,7 @@ export function collectProperties(obj: object, stopPrototypes: object[], skip?:
22
22
  *
23
23
  * @param {*} value - The value to describe.
24
24
  * @param {number} [depth] - The nesting depth. Nested values are kept to a short type name.
25
- * @returns {Described} The description.
25
+ * @returns {Described} The description, carrying the value as `raw`.
26
26
  */
27
27
  export function describeValue(value: any, depth?: number): Described;
28
28
  /**
@@ -70,6 +70,14 @@ export class EntityInspector extends Script {
70
70
  * @type {string}
71
71
  */
72
72
  stepKey: string;
73
+ /**
74
+ * Whether to start recording frames for the Performance tab as soon as the panel is created,
75
+ * capturing the first frames of the scene.
76
+ *
77
+ * @attribute
78
+ * @type {boolean}
79
+ */
80
+ record: boolean;
73
81
  /**
74
82
  * @type {Inspector|null}
75
83
  * @private
@@ -151,6 +151,13 @@ export function captureFrameGraph(app: AppBase): FrameSnapshot;
151
151
  * @returns {ListRow[]} The rows.
152
152
  */
153
153
  export function passRows(frame: FrameSnapshot, device: GraphicsDevice): ListRow[];
154
+ /**
155
+ * Mirrors how the GPU profiler keys its per-pass timings.
156
+ *
157
+ * @param {FramePass} pass - The pass.
158
+ * @returns {string} The profiler name.
159
+ */
160
+ export function profilerName(pass: FramePass): string;
154
161
  import { RenderPassForward } from 'playcanvas';
155
162
  import { FramePass } from 'playcanvas';
156
163
  import type { PropertySection } from './model.js';
@@ -41,6 +41,13 @@ export class HierarchyView {
41
41
  * @type {(node: GraphNode) => boolean}
42
42
  */
43
43
  isLocked: (node: GraphNode) => boolean;
44
+ /**
45
+ * Decides which nodes are left out of the tree, with everything below them, such as the
46
+ * entity of a gizmo the panel adds to the hierarchy. Defaults to none.
47
+ *
48
+ * @type {(node: GraphNode) => boolean}
49
+ */
50
+ isHidden: (node: GraphNode) => boolean;
44
51
  /**
45
52
  * The root of the rendered hierarchy.
46
53
  *
@@ -118,6 +125,12 @@ export class HierarchyView {
118
125
  * Synchronizes the rendered tree with the hierarchy.
119
126
  */
120
127
  refresh(): void;
128
+ /**
129
+ * @param {Node} element - An element, such as the target of a context menu event.
130
+ * @returns {GraphNode|null} The node whose row it is in, or null when it is in none. The rows
131
+ * of a node's children are nested under its element, so only the row itself is matched.
132
+ */
133
+ nodeAt(element: Node): GraphNode | null;
121
134
  /**
122
135
  * Selects a node, expanding its ancestors and scrolling it into view.
123
136
  *