@zenfg/inspector 0.1.0-beta.3 → 0.1.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 (172) hide show
  1. package/GUIDE.md +182 -0
  2. package/README.md +61 -89
  3. package/THEMING.md +124 -0
  4. package/dist/FrameGraphInspector.d.ts +23 -4
  5. package/dist/FrameGraphInspector.d.ts.map +1 -1
  6. package/dist/FrameGraphInspector.js +137 -29
  7. package/dist/FrameGraphInspector.js.map +1 -1
  8. package/dist/capture.d.ts +5 -0
  9. package/dist/capture.d.ts.map +1 -0
  10. package/dist/capture.js +2 -0
  11. package/dist/capture.js.map +1 -0
  12. package/dist/debugCaptureModel.d.ts +19 -0
  13. package/dist/debugCaptureModel.d.ts.map +1 -1
  14. package/dist/debugCaptureModel.js +36 -2
  15. package/dist/debugCaptureModel.js.map +1 -1
  16. package/dist/index.d.ts +2 -0
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js.map +1 -1
  19. package/dist/panelAliasAnalysis.d.ts +1 -0
  20. package/dist/panelAliasAnalysis.d.ts.map +1 -1
  21. package/dist/panelAliasAnalysis.js +23 -54
  22. package/dist/panelAliasAnalysis.js.map +1 -1
  23. package/dist/panelCytoscapeGraphRenderer.d.ts +15 -2
  24. package/dist/panelCytoscapeGraphRenderer.d.ts.map +1 -1
  25. package/dist/panelCytoscapeGraphRenderer.js +145 -23
  26. package/dist/panelCytoscapeGraphRenderer.js.map +1 -1
  27. package/dist/panelDetailLayout.d.ts +27 -0
  28. package/dist/panelDetailLayout.d.ts.map +1 -0
  29. package/dist/panelDetailLayout.js +174 -0
  30. package/dist/panelDetailLayout.js.map +1 -0
  31. package/dist/panelDetailStyles.d.ts +2 -0
  32. package/dist/panelDetailStyles.d.ts.map +1 -0
  33. package/dist/panelDetailStyles.js +57 -0
  34. package/dist/panelDetailStyles.js.map +1 -0
  35. package/dist/panelDiagnosticsView.d.ts +10 -1
  36. package/dist/panelDiagnosticsView.d.ts.map +1 -1
  37. package/dist/panelDiagnosticsView.js +166 -57
  38. package/dist/panelDiagnosticsView.js.map +1 -1
  39. package/dist/panelDomHelpers.d.ts.map +1 -1
  40. package/dist/panelDomHelpers.js +6 -5
  41. package/dist/panelDomHelpers.js.map +1 -1
  42. package/dist/panelGraphLayout.d.ts +3 -2
  43. package/dist/panelGraphLayout.d.ts.map +1 -1
  44. package/dist/panelGraphLayout.js +6 -5
  45. package/dist/panelGraphLayout.js.map +1 -1
  46. package/dist/panelGraphRenderer.d.ts +10 -0
  47. package/dist/panelGraphRenderer.d.ts.map +1 -1
  48. package/dist/panelGraphRenderer.js.map +1 -1
  49. package/dist/panelGraphScene.d.ts +1 -0
  50. package/dist/panelGraphScene.d.ts.map +1 -1
  51. package/dist/panelGraphScene.js +69 -32
  52. package/dist/panelGraphScene.js.map +1 -1
  53. package/dist/panelGraphSearch.d.ts +16 -0
  54. package/dist/panelGraphSearch.d.ts.map +1 -0
  55. package/dist/panelGraphSearch.js +93 -0
  56. package/dist/panelGraphSearch.js.map +1 -0
  57. package/dist/panelGraphView.d.ts +82 -0
  58. package/dist/panelGraphView.d.ts.map +1 -1
  59. package/dist/panelGraphView.js +15 -4
  60. package/dist/panelGraphView.js.map +1 -1
  61. package/dist/panelGraphVisuals.d.ts +14 -6
  62. package/dist/panelGraphVisuals.d.ts.map +1 -1
  63. package/dist/panelGraphVisuals.js +126 -51
  64. package/dist/panelGraphVisuals.js.map +1 -1
  65. package/dist/panelInspectorView.d.ts +8 -0
  66. package/dist/panelInspectorView.d.ts.map +1 -1
  67. package/dist/panelInspectorView.js +242 -48
  68. package/dist/panelInspectorView.js.map +1 -1
  69. package/dist/panelListStyles.d.ts +3 -0
  70. package/dist/panelListStyles.d.ts.map +1 -0
  71. package/dist/panelListStyles.js +155 -0
  72. package/dist/panelListStyles.js.map +1 -0
  73. package/dist/panelMemoryStyles.d.ts +3 -0
  74. package/dist/panelMemoryStyles.d.ts.map +1 -0
  75. package/dist/panelMemoryStyles.js +42 -0
  76. package/dist/panelMemoryStyles.js.map +1 -0
  77. package/dist/panelMemoryView.d.ts +13 -1
  78. package/dist/panelMemoryView.d.ts.map +1 -1
  79. package/dist/panelMemoryView.js +161 -41
  80. package/dist/panelMemoryView.js.map +1 -1
  81. package/dist/panelPassesView.d.ts +15 -0
  82. package/dist/panelPassesView.d.ts.map +1 -1
  83. package/dist/panelPassesView.js +202 -72
  84. package/dist/panelPassesView.js.map +1 -1
  85. package/dist/panelRawView.d.ts +15 -0
  86. package/dist/panelRawView.d.ts.map +1 -0
  87. package/dist/panelRawView.js +105 -0
  88. package/dist/panelRawView.js.map +1 -0
  89. package/dist/panelResourcesView.d.ts +8 -0
  90. package/dist/panelResourcesView.d.ts.map +1 -1
  91. package/dist/panelResourcesView.js +62 -31
  92. package/dist/panelResourcesView.js.map +1 -1
  93. package/dist/panelSelection.d.ts +9 -1
  94. package/dist/panelSelection.d.ts.map +1 -1
  95. package/dist/panelSelection.js +34 -4
  96. package/dist/panelSelection.js.map +1 -1
  97. package/dist/panelTheme.d.ts +13 -0
  98. package/dist/panelTheme.d.ts.map +1 -0
  99. package/dist/panelTheme.js +104 -0
  100. package/dist/panelTheme.js.map +1 -0
  101. package/dist/panelTypes.d.ts +10 -1
  102. package/dist/panelTypes.d.ts.map +1 -1
  103. package/dist/panelTypes.js.map +1 -1
  104. package/dist/panelVisualTheme.d.ts +147 -50
  105. package/dist/panelVisualTheme.d.ts.map +1 -1
  106. package/dist/panelVisualTheme.js +34 -44
  107. package/dist/panelVisualTheme.js.map +1 -1
  108. package/dist/panelWorkbenchHelpers.d.ts +12 -1
  109. package/dist/panelWorkbenchHelpers.d.ts.map +1 -1
  110. package/dist/panelWorkbenchHelpers.js +62 -1
  111. package/dist/panelWorkbenchHelpers.js.map +1 -1
  112. package/dist/panelWorkbenchStyles.d.ts +2 -0
  113. package/dist/panelWorkbenchStyles.d.ts.map +1 -0
  114. package/dist/panelWorkbenchStyles.js +101 -0
  115. package/dist/panelWorkbenchStyles.js.map +1 -0
  116. package/dist/panelWorkbenchView.d.ts +16 -0
  117. package/dist/panelWorkbenchView.d.ts.map +1 -1
  118. package/dist/panelWorkbenchView.js +228 -50
  119. package/dist/panelWorkbenchView.js.map +1 -1
  120. package/dist/query.js.map +1 -1
  121. package/dist/styles.d.ts.map +1 -1
  122. package/dist/styles.js +147 -195
  123. package/dist/styles.js.map +1 -1
  124. package/dist/theme.d.ts +22 -0
  125. package/dist/theme.d.ts.map +1 -0
  126. package/dist/theme.js +10 -0
  127. package/dist/theme.js.map +1 -0
  128. package/dist/themeDefinitions.d.ts +251 -0
  129. package/dist/themeDefinitions.d.ts.map +1 -0
  130. package/dist/themeDefinitions.js +96 -0
  131. package/dist/themeDefinitions.js.map +1 -0
  132. package/dist/themePalette.d.ts +66 -0
  133. package/dist/themePalette.d.ts.map +1 -0
  134. package/dist/themePalette.js +37 -0
  135. package/dist/themePalette.js.map +1 -0
  136. package/dist/themes.css +165 -0
  137. package/package.json +44 -10
  138. package/src/FrameGraphInspector.ts +130 -31
  139. package/src/capture.ts +4 -0
  140. package/src/debugCaptureModel.ts +53 -2
  141. package/src/index.ts +6 -2
  142. package/src/panelAliasAnalysis.ts +24 -70
  143. package/src/panelCytoscapeGraphRenderer.ts +140 -23
  144. package/src/panelDetailLayout.ts +155 -0
  145. package/src/panelDetailStyles.ts +56 -0
  146. package/src/panelDiagnosticsView.ts +166 -85
  147. package/src/panelDomHelpers.ts +4 -5
  148. package/src/panelGraphLayout.ts +6 -5
  149. package/src/panelGraphRenderer.ts +7 -0
  150. package/src/panelGraphScene.ts +68 -30
  151. package/src/panelGraphSearch.ts +96 -0
  152. package/src/panelGraphView.ts +14 -4
  153. package/src/panelGraphVisuals.ts +122 -52
  154. package/src/panelInspectorView.ts +227 -48
  155. package/src/panelListStyles.ts +154 -0
  156. package/src/panelMemoryStyles.ts +41 -0
  157. package/src/panelMemoryView.ts +178 -53
  158. package/src/panelPassesView.ts +190 -137
  159. package/src/panelRawView.ts +99 -0
  160. package/src/panelResourcesView.ts +69 -56
  161. package/src/panelSelection.ts +37 -5
  162. package/src/panelTheme.ts +85 -0
  163. package/src/panelTypes.ts +7 -1
  164. package/src/panelVisualTheme.ts +38 -49
  165. package/src/panelWorkbenchHelpers.ts +60 -2
  166. package/src/panelWorkbenchStyles.ts +100 -0
  167. package/src/panelWorkbenchView.ts +201 -52
  168. package/src/query.ts +11 -11
  169. package/src/styles.ts +148 -195
  170. package/src/theme.ts +24 -0
  171. package/src/themeDefinitions.ts +103 -0
  172. package/src/themePalette.ts +44 -0
package/src/theme.ts ADDED
@@ -0,0 +1,24 @@
1
+ /** Pure theme data for CSS and JavaScript hosts; safe to import without a DOM.
2
+ * @packageDocumentation
3
+ */
4
+ import { stormVariables, lightVariables } from './themeDefinitions.ts';
5
+
6
+ export { visualThemes, visualMetrics } from './themePalette.ts';
7
+ export type { ThemeMode, VisualPalette } from './themePalette.ts';
8
+
9
+ /** Public CSS custom properties. Missing values inherit from the host or use Storm defaults. */
10
+ export type InspectorThemeVariables = { readonly [Key in keyof typeof stormVariables]: string };
11
+
12
+ /** A partial or complete theme; no name, registration, or base preset is required. */
13
+ export interface InspectorTheme {
14
+ /** Browser appearance for native controls; mapped to `--zfgi-color-scheme`. Does not select a palette. */
15
+ readonly colorScheme?: 'dark' | 'light';
16
+ /** CSS values keyed by the documented `--zfgi-*` custom property names. */
17
+ readonly variables?: Readonly<Partial<InspectorThemeVariables>>;
18
+ }
19
+
20
+ /** Complete Tokyo Night Storm preset; also the component's CSS fallback appearance. */
21
+ export const tokyoNightStorm: InspectorTheme = Object.freeze({ colorScheme: 'dark', variables: Object.freeze(stormVariables) });
22
+
23
+ /** Complete Tokyo Night Light preset, including the graph and native control appearance. */
24
+ export const tokyoNightLight: InspectorTheme = Object.freeze({ colorScheme: 'light', variables: Object.freeze(lightVariables) });
@@ -0,0 +1,103 @@
1
+ import { visualThemes, visualMetrics, type ThemeMode } from './themePalette.ts';
2
+
3
+ export const graphCategories = ['render', 'compute', 'copy', 'clear', 'command', 'external', 'declaration', 'output', 'texture', 'buffer'] as const;
4
+
5
+ export function createThemeVariables(mode: ThemeMode) {
6
+ const p = visualThemes[mode];
7
+ const dark = mode === 'dark';
8
+ const tint = dark ? '18%' : '8%';
9
+ const categoryVariables = Object.fromEntries(graphCategories.flatMap(kind => [
10
+ [`--zfgi-graph-${kind}-stroke`, p[kind]],
11
+ [`--zfgi-graph-${kind}-fill`, `color-mix(in srgb, var(--zfgi-graph-${kind}-stroke, ${p[kind]}) var(--zfgi-graph-tint, ${tint}), var(--zfgi-canvas, ${p.canvas}))`],
12
+ ])) as Record<`--zfgi-graph-${typeof graphCategories[number]}-${'stroke' | 'fill'}`, string>;
13
+ return {
14
+ '--zfgi-canvas': p.canvas,
15
+ '--zfgi-background': p.panel,
16
+ '--zfgi-surface': p.inset,
17
+ '--zfgi-surface-raised': p.panel,
18
+ '--zfgi-surface-hover': p.hover,
19
+ '--zfgi-border': p.border,
20
+ '--zfgi-border-subtle': p.divider,
21
+ '--zfgi-border-strong': p.border,
22
+ '--zfgi-text': p.text,
23
+ '--zfgi-text-secondary': p.secondary,
24
+ '--zfgi-muted': p.muted,
25
+ '--zfgi-accent': p.accent,
26
+ '--zfgi-accent-soft': p.accentSoft,
27
+ '--zfgi-accent-hover': p.hover,
28
+ '--zfgi-success': p.success,
29
+ '--zfgi-warning': p.warning,
30
+ '--zfgi-danger': p.danger,
31
+ '--zfgi-shadow': dark ? '0 8px 24px #0006' : '0 8px 24px #343b5826',
32
+ '--zfgi-backdrop': dark ? '#13172899' : '#343b5840',
33
+ '--zfgi-font-ui': visualMetrics.fontUi,
34
+ '--zfgi-font-mono': visualMetrics.fontMono,
35
+ '--zfgi-font-size': '13px',
36
+ '--zfgi-font-size-small': '12px',
37
+ '--zfgi-control-height': '32px',
38
+ '--zfgi-row-height': '36px',
39
+ '--zfgi-radius-sm': '6px',
40
+ '--zfgi-radius-md': '10px',
41
+ '--zfgi-space-1': '4px',
42
+ '--zfgi-space-2': '8px',
43
+ '--zfgi-space-3': '12px',
44
+ '--zfgi-space-4': '16px',
45
+ '--zfgi-graph-tint': tint,
46
+ '--zfgi-graph-text': dark ? '#d5ddff' : p.text,
47
+ '--zfgi-graph-muted': p.muted,
48
+ '--zfgi-graph-font-family': `var(--zfgi-font-mono, ${visualMetrics.fontMono})`,
49
+ '--zfgi-graph-font-size': '13px',
50
+ '--zfgi-graph-node-border-width': '1.25px',
51
+ '--zfgi-graph-group-border-width': '1.5px',
52
+ '--zfgi-graph-edge-width': '1.5px',
53
+ '--zfgi-graph-edge-opacity': '1',
54
+ '--zfgi-graph-ordering-opacity': '1',
55
+ '--zfgi-graph-group-opacity': '1',
56
+ '--zfgi-graph-arrow-scale': '0.8',
57
+ '--zfgi-graph-hover-width': '2.5px',
58
+ '--zfgi-graph-selected-width': '3px',
59
+ '--zfgi-graph-selected': `var(--zfgi-accent, ${p.accent})`,
60
+ '--zfgi-graph-hover': dark ? '#d5ddff' : '#343b58',
61
+ '--zfgi-graph-active-bg': `var(--zfgi-graph-text, ${dark ? '#d5ddff' : p.text})`,
62
+ '--zfgi-graph-active-bg-opacity': '0.08',
63
+ '--zfgi-graph-active-bg-size': '12px',
64
+ '--zfgi-graph-group-stroke': p.group,
65
+ '--zfgi-graph-group-fill': dark ? '#292e42' : '#eceef5',
66
+ '--zfgi-graph-group-alternate-fill': dark ? '#30364b' : '#e5e9f3',
67
+ '--zfgi-graph-value': p.edge,
68
+ '--zfgi-graph-ordering': p.edge,
69
+ '--zfgi-graph-read': p.buffer,
70
+ '--zfgi-graph-write': p.warning,
71
+ '--zfgi-graph-culled-stroke': p.muted,
72
+ '--zfgi-graph-culled-fill': p.inset,
73
+ ...categoryVariables,
74
+ };
75
+ }
76
+
77
+ export const stormVariables = createThemeVariables('dark');
78
+ export const lightVariables = createThemeVariables('light');
79
+
80
+ // Existing public aliases only. Internal layout variables are deliberately excluded.
81
+ export const legacyThemeAliases: Record<string, string> = Object.fromEntries([
82
+ 'background', 'surface', 'surface-raised', 'surface-hover', 'border', 'border-subtle',
83
+ 'border-strong', 'text', 'text-secondary', 'muted', 'accent', 'accent-soft', 'accent-hover',
84
+ 'success', 'warning', 'danger', 'font-ui', 'font-mono', 'radius-sm', 'radius-md',
85
+ ].map(name => [`--zfgi-${name}`, `--zenfg-inspector-${name}`]));
86
+
87
+ export function internalThemeProperty(property: string): string {
88
+ return property === '--zfgi-background' ? '--fgd-panel' : property.replace('--zfgi-', '--fgd-');
89
+ }
90
+
91
+ export function themeFallback(property: string, value: string): string {
92
+ const legacy = legacyThemeAliases[property];
93
+ return `var(${property}, ${legacy ? `var(${legacy}, ${value})` : value})`;
94
+ }
95
+
96
+ export const themeDefaultsCss = Object.entries(stormVariables)
97
+ .map(([property, value]) => `${internalThemeProperty(property)}: ${themeFallback(property, value)};`).join('\n');
98
+
99
+ export function themePresetCss(): string {
100
+ return '/* Generated from Inspector theme definitions. */\n' + ([
101
+ ['tokyo-night-storm', 'dark', stormVariables], ['tokyo-night-light', 'light', lightVariables],
102
+ ] as const).map(([name, scheme, variables]) => `[data-zfgi-theme="${name}"] {\n --zfgi-color-scheme: ${scheme};\n${Object.entries(variables).map(([key, value]) => ` ${key}: ${value};`).join('\n')}\n}`).join('\n');
103
+ }
@@ -0,0 +1,44 @@
1
+ /** Appearance of the shared Tokyo Night application palette. */
2
+ export type ThemeMode = 'dark' | 'light';
3
+
4
+ const dark = {
5
+ canvas: '#24283b', sidebar: '#1f2335', panel: '#292e42', inset: '#202437',
6
+ hover: '#30374e', border: '#454d6c', divider: '#353c55',
7
+ text: '#c0caf5', secondary: '#a9b1d6', muted: '#9aa5ce',
8
+ accent: '#7aa2f7', accentSoft: '#2c3855', onAccent: '#1f2335',
9
+ purple: '#bb9af7', cyan: '#7dcfff', success: '#9ece6a', warning: '#e0af68', danger: '#f7768e',
10
+ render: '#9ece6a', compute: '#a6afff', copy: '#e0af68', clear: '#c4cf89',
11
+ command: '#bb9af7', external: '#ff9e64', declaration: '#cfc9c2', output: '#f5a2c0',
12
+ texture: '#f5a2c0', buffer: '#73daca', edge: '#9aa5ce', group: '#8592bd',
13
+ comment: '#9aa5ce', keyword: '#bb9af7', string: '#9ece6a', number: '#ff9e64',
14
+ function: '#7aa2f7', type: '#7dcfff', property: '#73daca',
15
+ } as const;
16
+
17
+ /** Semantic colors shared by the Inspector and its hosts. */
18
+ export type VisualPalette = { readonly [Key in keyof typeof dark]: string };
19
+
20
+ /** Tokyo Night Storm and Light semantic palettes. */
21
+ export const visualThemes: Readonly<Record<ThemeMode, VisualPalette>> = {
22
+ dark,
23
+ light: {
24
+ canvas: '#f5f6fa', sidebar: '#eceef5', panel: '#ffffff', inset: '#eef0f7',
25
+ hover: '#e2e6f1', border: '#909ab0', divider: '#d8ddea',
26
+ text: '#343b58', secondary: '#59627d', muted: '#5e667e',
27
+ accent: '#2959aa', accentSoft: '#e1e9f8', onAccent: '#ffffff',
28
+ purple: '#5a3e8e', cyan: '#006c86', success: '#385f0d', warning: '#8f5e15', danger: '#a03b50',
29
+ render: '#385f0d', compute: '#5155a6', copy: '#8f5e15', clear: '#566423',
30
+ command: '#5a3e8e', external: '#965027', declaration: '#65553e', output: '#963c67',
31
+ texture: '#963c67', buffer: '#236b62', edge: '#606982', group: '#606982',
32
+ comment: '#606982', keyword: '#5a3e8e', string: '#385f0d', number: '#965027',
33
+ function: '#2959aa', type: '#006c86', property: '#236b62',
34
+ },
35
+ };
36
+
37
+ /** Shared typography, spacing, and corner dimensions. */
38
+ export const visualMetrics = {
39
+ fontUi: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif',
40
+ fontMono: 'ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", "Microsoft YaHei", monospace',
41
+ fontBody: '14px', fontControl: '13px', fontTitle: '28px', fontCode: '14px',
42
+ space1: '4px', space2: '8px', space3: '12px', space4: '16px', space6: '24px', space8: '32px',
43
+ radiusSmall: '6px', radiusPanel: '10px',
44
+ } as const;