@molecule/app-ide-panel-logic 0.0.0-stage → 1.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.
- package/LICENSE +202 -0
- package/README.md +2927 -2
- package/dist/chatTimelineOrdering.d.ts +50 -0
- package/dist/chatTimelineOrdering.d.ts.map +1 -0
- package/dist/chatTimelineOrdering.js +46 -0
- package/dist/chatTimelineOrdering.js.map +1 -0
- package/dist/command-metadata.d.ts +117 -0
- package/dist/command-metadata.d.ts.map +1 -0
- package/dist/command-metadata.js +271 -0
- package/dist/command-metadata.js.map +1 -0
- package/dist/components/activity-utilities.d.ts +107 -0
- package/dist/components/activity-utilities.d.ts.map +1 -0
- package/dist/components/activity-utilities.js +154 -0
- package/dist/components/activity-utilities.js.map +1 -0
- package/dist/components/chat-autocommit-utilities.d.ts +172 -0
- package/dist/components/chat-autocommit-utilities.d.ts.map +1 -0
- package/dist/components/chat-autocommit-utilities.js +185 -0
- package/dist/components/chat-autocommit-utilities.js.map +1 -0
- package/dist/components/chat-card-style.d.ts +81 -0
- package/dist/components/chat-card-style.d.ts.map +1 -0
- package/dist/components/chat-card-style.js +78 -0
- package/dist/components/chat-card-style.js.map +1 -0
- package/dist/components/chat-commands.d.ts +17 -0
- package/dist/components/chat-commands.d.ts.map +1 -0
- package/dist/components/chat-commands.js +17 -0
- package/dist/components/chat-commands.js.map +1 -0
- package/dist/components/chat-commit-utilities.d.ts +29 -0
- package/dist/components/chat-commit-utilities.d.ts.map +1 -0
- package/dist/components/chat-commit-utilities.js +31 -0
- package/dist/components/chat-commit-utilities.js.map +1 -0
- package/dist/components/chat-cost-utilities.d.ts +62 -0
- package/dist/components/chat-cost-utilities.d.ts.map +1 -0
- package/dist/components/chat-cost-utilities.js +66 -0
- package/dist/components/chat-cost-utilities.js.map +1 -0
- package/dist/components/chat-effort-utilities.d.ts +104 -0
- package/dist/components/chat-effort-utilities.d.ts.map +1 -0
- package/dist/components/chat-effort-utilities.js +99 -0
- package/dist/components/chat-effort-utilities.js.map +1 -0
- package/dist/components/chat-help-utilities.d.ts +89 -0
- package/dist/components/chat-help-utilities.d.ts.map +1 -0
- package/dist/components/chat-help-utilities.js +131 -0
- package/dist/components/chat-help-utilities.js.map +1 -0
- package/dist/components/chat-model-mode-utilities.d.ts +169 -0
- package/dist/components/chat-model-mode-utilities.d.ts.map +1 -0
- package/dist/components/chat-model-mode-utilities.js +221 -0
- package/dist/components/chat-model-mode-utilities.js.map +1 -0
- package/dist/components/chat-models-utilities.d.ts +162 -0
- package/dist/components/chat-models-utilities.d.ts.map +1 -0
- package/dist/components/chat-models-utilities.js +302 -0
- package/dist/components/chat-models-utilities.js.map +1 -0
- package/dist/components/chat-report-utilities.d.ts +149 -0
- package/dist/components/chat-report-utilities.d.ts.map +1 -0
- package/dist/components/chat-report-utilities.js +151 -0
- package/dist/components/chat-report-utilities.js.map +1 -0
- package/dist/components/chat-scripts-utilities.d.ts +185 -0
- package/dist/components/chat-scripts-utilities.d.ts.map +1 -0
- package/dist/components/chat-scripts-utilities.js +199 -0
- package/dist/components/chat-scripts-utilities.js.map +1 -0
- package/dist/components/chat-settings-utilities.d.ts +72 -0
- package/dist/components/chat-settings-utilities.d.ts.map +1 -0
- package/dist/components/chat-settings-utilities.js +56 -0
- package/dist/components/chat-settings-utilities.js.map +1 -0
- package/dist/components/chat-share-utilities.d.ts +110 -0
- package/dist/components/chat-share-utilities.d.ts.map +1 -0
- package/dist/components/chat-share-utilities.js +90 -0
- package/dist/components/chat-share-utilities.js.map +1 -0
- package/dist/components/chat-skills-utilities.d.ts +242 -0
- package/dist/components/chat-skills-utilities.d.ts.map +1 -0
- package/dist/components/chat-skills-utilities.js +433 -0
- package/dist/components/chat-skills-utilities.js.map +1 -0
- package/dist/components/chat-stream-utilities.d.ts +74 -0
- package/dist/components/chat-stream-utilities.d.ts.map +1 -0
- package/dist/components/chat-stream-utilities.js +103 -0
- package/dist/components/chat-stream-utilities.js.map +1 -0
- package/dist/components/chat-timestamps-utilities.d.ts +123 -0
- package/dist/components/chat-timestamps-utilities.d.ts.map +1 -0
- package/dist/components/chat-timestamps-utilities.js +177 -0
- package/dist/components/chat-timestamps-utilities.js.map +1 -0
- package/dist/components/chat-tips-utilities.d.ts +108 -0
- package/dist/components/chat-tips-utilities.d.ts.map +1 -0
- package/dist/components/chat-tips-utilities.js +137 -0
- package/dist/components/chat-tips-utilities.js.map +1 -0
- package/dist/components/device-cycle.d.ts +84 -0
- package/dist/components/device-cycle.d.ts.map +1 -0
- package/dist/components/device-cycle.js +77 -0
- package/dist/components/device-cycle.js.map +1 -0
- package/dist/components/fileExplorerPersistence.d.ts +50 -0
- package/dist/components/fileExplorerPersistence.d.ts.map +1 -0
- package/dist/components/fileExplorerPersistence.js +63 -0
- package/dist/components/fileExplorerPersistence.js.map +1 -0
- package/dist/components/search-utilities.d.ts +15 -0
- package/dist/components/search-utilities.d.ts.map +1 -0
- package/dist/components/search-utilities.js +26 -0
- package/dist/components/search-utilities.js.map +1 -0
- package/dist/components/tests-bar-utilities.d.ts +106 -0
- package/dist/components/tests-bar-utilities.d.ts.map +1 -0
- package/dist/components/tests-bar-utilities.js +167 -0
- package/dist/components/tests-bar-utilities.js.map +1 -0
- package/dist/components/tests-card-utilities.d.ts +280 -0
- package/dist/components/tests-card-utilities.d.ts.map +1 -0
- package/dist/components/tests-card-utilities.js +591 -0
- package/dist/components/tests-card-utilities.js.map +1 -0
- package/dist/components/tool-call-utilities.d.ts +262 -0
- package/dist/components/tool-call-utilities.d.ts.map +1 -0
- package/dist/components/tool-call-utilities.js +1007 -0
- package/dist/components/tool-call-utilities.js.map +1 -0
- package/dist/components/user-avatar-utilities.d.ts +41 -0
- package/dist/components/user-avatar-utilities.d.ts.map +1 -0
- package/dist/components/user-avatar-utilities.js +56 -0
- package/dist/components/user-avatar-utilities.js.map +1 -0
- package/dist/components/workspace-layout-utilities.d.ts +37 -0
- package/dist/components/workspace-layout-utilities.d.ts.map +1 -0
- package/dist/components/workspace-layout-utilities.js +58 -0
- package/dist/components/workspace-layout-utilities.js.map +1 -0
- package/dist/customEventCards.d.ts +147 -0
- package/dist/customEventCards.d.ts.map +1 -0
- package/dist/customEventCards.js +36 -0
- package/dist/customEventCards.js.map +1 -0
- package/dist/icon-names.d.ts +26 -0
- package/dist/icon-names.d.ts.map +1 -0
- package/dist/icon-names.js +14 -0
- package/dist/icon-names.js.map +1 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/keyboard-shortcut-utilities.d.ts +63 -0
- package/dist/keyboard-shortcut-utilities.d.ts.map +1 -0
- package/dist/keyboard-shortcut-utilities.js +100 -0
- package/dist/keyboard-shortcut-utilities.js.map +1 -0
- package/dist/panels.d.ts +26 -0
- package/dist/panels.d.ts.map +1 -0
- package/dist/panels.js +26 -0
- package/dist/panels.js.map +1 -0
- package/dist/settings-metadata.d.ts +78 -0
- package/dist/settings-metadata.d.ts.map +1 -0
- package/dist/settings-metadata.js +137 -0
- package/dist/settings-metadata.js.map +1 -0
- package/dist/types.d.ts +588 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/dist/viewport-queries.d.ts +19 -0
- package/dist/viewport-queries.d.ts.map +1 -0
- package/dist/viewport-queries.js +19 -0
- package/dist/viewport-queries.js.map +1 -0
- package/package.json +74 -4
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device-frame data + helpers for the preview panel.
|
|
3
|
+
*
|
|
4
|
+
* The preview header exposes a {@link DeviceFrameSelector} dropdown that lists
|
|
5
|
+
* every device frame, plus a "Rotate" control that swaps a fixed-frame device
|
|
6
|
+
* between portrait and landscape. The frame order, the icon + human label for
|
|
7
|
+
* each frame, the fixed pixel DIMENSIONS used to size the preview iframe, and
|
|
8
|
+
* the orientation-aware size resolver all live here as pure data/functions so
|
|
9
|
+
* they can be unit tested and reused.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* The device frames the selector dropdown lists, in display order.
|
|
15
|
+
* `none` = responsive (no fixed frame, full width).
|
|
16
|
+
*/
|
|
17
|
+
export const DEVICE_FRAMES = ['none', 'desktop', 'tablet', 'mobile'];
|
|
18
|
+
/**
|
|
19
|
+
* Per-frame display metadata: the icon-set glyph name and the i18n label
|
|
20
|
+
* (key + English default) shown in the dropdown trigger + menu items.
|
|
21
|
+
*/
|
|
22
|
+
export const DEVICE_META = {
|
|
23
|
+
none: { icon: 'browser', labelKey: 'ide.device.responsive', label: 'Responsive' },
|
|
24
|
+
desktop: { icon: 'device-desktop', labelKey: 'ide.device.desktop', label: 'Desktop' },
|
|
25
|
+
tablet: { icon: 'device-tablet', labelKey: 'ide.device.tablet', label: 'Tablet' },
|
|
26
|
+
mobile: { icon: 'device-mobile', labelKey: 'ide.device.mobile', label: 'Mobile' },
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The fixed pixel frame each device renders the preview iframe at. `none`
|
|
30
|
+
* (responsive) and `desktop` are fluid — full width, full height, nothing to
|
|
31
|
+
* rotate. `tablet` (768×1024) and `mobile` (375×667) are fixed frames that can
|
|
32
|
+
* be rotated to landscape (swapping width/height).
|
|
33
|
+
*/
|
|
34
|
+
export const DEVICE_DIMENSIONS = {
|
|
35
|
+
none: { width: '100%', height: null, rotatable: false },
|
|
36
|
+
desktop: { width: '100%', height: null, rotatable: false },
|
|
37
|
+
tablet: { width: '768px', height: '1024px', rotatable: true },
|
|
38
|
+
mobile: { width: '375px', height: '667px', rotatable: true },
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Whether a device frame can be rotated (true only for fixed-frame devices —
|
|
42
|
+
* tablet and mobile). Responsive and desktop are full-width with nothing to
|
|
43
|
+
* rotate, so the "Rotate" control is enabled only "where possible".
|
|
44
|
+
* @param device - The device frame.
|
|
45
|
+
* @returns `true` if the frame has a fixed size that can be rotated.
|
|
46
|
+
*/
|
|
47
|
+
export function isDeviceRotatable(device) {
|
|
48
|
+
return DEVICE_DIMENSIONS[device].rotatable;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Resolves the concrete iframe `width`/`height` for a device frame at a given
|
|
52
|
+
* orientation. Fluid frames (responsive/desktop) ignore orientation and fill
|
|
53
|
+
* the preview area (`width` from dims, `height: '100%'`). Fixed frames render
|
|
54
|
+
* at their pixel size in portrait and at the swapped size in landscape.
|
|
55
|
+
* @param device - The device frame.
|
|
56
|
+
* @param orientation - The preview orientation.
|
|
57
|
+
* @returns The CSS `width` and `height` to apply to the preview iframe.
|
|
58
|
+
*/
|
|
59
|
+
export function resolveDeviceSize(device, orientation) {
|
|
60
|
+
const dims = DEVICE_DIMENSIONS[device];
|
|
61
|
+
if (!dims.rotatable || dims.height === null) {
|
|
62
|
+
// Fluid frame — fill the available preview area; nothing to rotate.
|
|
63
|
+
return { width: dims.width, height: '100%' };
|
|
64
|
+
}
|
|
65
|
+
return orientation === 'landscape'
|
|
66
|
+
? { width: dims.height, height: dims.width }
|
|
67
|
+
: { width: dims.width, height: dims.height };
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Returns the icon-set glyph name for a device frame.
|
|
71
|
+
* @param device - The device frame.
|
|
72
|
+
* @returns The icon name registered in the bonded icon set.
|
|
73
|
+
*/
|
|
74
|
+
export function deviceIconName(device) {
|
|
75
|
+
return DEVICE_META[device].icon;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=device-cycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-cycle.js","sourceRoot":"","sources":["../../src/components/device-cycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAA2B,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;AAE5F;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,KAAK,IAAI,EAAE,CAAC;QAC5C,oEAAoE;QACpE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;IAC9C,CAAC;IACD,OAAO,WAAW,KAAK,WAAW;QAChC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE;QAC5C,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAA;AAChD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,MAAmB;IAChD,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,IAAI,CAAA;AACjC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File-explorer expand/collapse persistence.
|
|
3
|
+
*
|
|
4
|
+
* The explorer's open directories are a per-device preference read DURING
|
|
5
|
+
* render, so they persist through `getPreferenceStore()` — the synchronous
|
|
6
|
+
* snapshot over the app's bonded `@molecule/app-storage` provider — rather than
|
|
7
|
+
* reaching for `localStorage`. Swapping the bonded provider (native, memory, a
|
|
8
|
+
* test host) then redirects the tree's state too, and an absent, corrupt or
|
|
9
|
+
* unreadable value reads as "nothing saved".
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
/** The persisted set of explicitly opened and closed directory paths. */
|
|
14
|
+
export interface ExpandState {
|
|
15
|
+
/** Directories the user opened (they default to open only at the root). */
|
|
16
|
+
expanded: Set<string>;
|
|
17
|
+
/** Directories the user explicitly closed. */
|
|
18
|
+
collapsed: Set<string>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Loads persisted expand/collapse state from the bonded storage provider.
|
|
22
|
+
* @param persistKey - The storage key to read from.
|
|
23
|
+
* @returns The stored state, or a fresh empty state when none is saved or the
|
|
24
|
+
* stored value is unreadable.
|
|
25
|
+
*/
|
|
26
|
+
export declare function loadExpandState(persistKey: string): ExpandState;
|
|
27
|
+
/**
|
|
28
|
+
* Persists expand/collapse state through the bonded storage provider.
|
|
29
|
+
*
|
|
30
|
+
* Best-effort by contract: an unavailable or full store drops the write and the
|
|
31
|
+
* tree simply reopens with its defaults.
|
|
32
|
+
* @param persistKey - The storage key to write to.
|
|
33
|
+
* @param state - The expand state to store.
|
|
34
|
+
*/
|
|
35
|
+
export declare function saveExpandState(persistKey: string, state: ExpandState): void;
|
|
36
|
+
/**
|
|
37
|
+
* Keeps a mounted explorer's state live for one storage key.
|
|
38
|
+
*
|
|
39
|
+
* A synchronous provider is already reflected in the initial `loadExpandState`
|
|
40
|
+
* read; an asynchronous one hydrates later, and this subscription applies that
|
|
41
|
+
* value to the SAME mounted tree (no remount, no permanent empty tree). Later
|
|
42
|
+
* changes — another tab, another writer — arrive the same way. A read that
|
|
43
|
+
* started BEFORE a user toggle is discarded by the preference store, so a slow
|
|
44
|
+
* hydration can never re-collapse directories the user just opened.
|
|
45
|
+
* @param persistKey - The storage key to follow.
|
|
46
|
+
* @param apply - Called with the current state after the key changes.
|
|
47
|
+
* @returns A function that stops following the key.
|
|
48
|
+
*/
|
|
49
|
+
export declare function watchExpandState(persistKey: string, apply: (state: ExpandState) => void): () => void;
|
|
50
|
+
//# sourceMappingURL=fileExplorerPersistence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileExplorerPersistence.d.ts","sourceRoot":"","sources":["../../src/components/fileExplorerPersistence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,yEAAyE;AACzE,MAAM,WAAW,WAAW;IAC1B,2EAA2E;IAC3E,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACrB,8CAA8C;IAC9C,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW,CAS/D;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAK5E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,GAClC,MAAM,IAAI,CAKZ"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File-explorer expand/collapse persistence.
|
|
3
|
+
*
|
|
4
|
+
* The explorer's open directories are a per-device preference read DURING
|
|
5
|
+
* render, so they persist through `getPreferenceStore()` — the synchronous
|
|
6
|
+
* snapshot over the app's bonded `@molecule/app-storage` provider — rather than
|
|
7
|
+
* reaching for `localStorage`. Swapping the bonded provider (native, memory, a
|
|
8
|
+
* test host) then redirects the tree's state too, and an absent, corrupt or
|
|
9
|
+
* unreadable value reads as "nothing saved".
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
import { getPreferenceStore } from '@molecule/app-storage';
|
|
14
|
+
/**
|
|
15
|
+
* Loads persisted expand/collapse state from the bonded storage provider.
|
|
16
|
+
* @param persistKey - The storage key to read from.
|
|
17
|
+
* @returns The stored state, or a fresh empty state when none is saved or the
|
|
18
|
+
* stored value is unreadable.
|
|
19
|
+
*/
|
|
20
|
+
export function loadExpandState(persistKey) {
|
|
21
|
+
const parsed = getPreferenceStore().get(persistKey);
|
|
22
|
+
if (parsed && typeof parsed === 'object') {
|
|
23
|
+
return {
|
|
24
|
+
expanded: new Set(parsed.expanded ?? []),
|
|
25
|
+
collapsed: new Set(parsed.collapsed ?? []),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return { expanded: new Set(), collapsed: new Set() };
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Persists expand/collapse state through the bonded storage provider.
|
|
32
|
+
*
|
|
33
|
+
* Best-effort by contract: an unavailable or full store drops the write and the
|
|
34
|
+
* tree simply reopens with its defaults.
|
|
35
|
+
* @param persistKey - The storage key to write to.
|
|
36
|
+
* @param state - The expand state to store.
|
|
37
|
+
*/
|
|
38
|
+
export function saveExpandState(persistKey, state) {
|
|
39
|
+
getPreferenceStore().set(persistKey, {
|
|
40
|
+
expanded: [...state.expanded],
|
|
41
|
+
collapsed: [...state.collapsed],
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Keeps a mounted explorer's state live for one storage key.
|
|
46
|
+
*
|
|
47
|
+
* A synchronous provider is already reflected in the initial `loadExpandState`
|
|
48
|
+
* read; an asynchronous one hydrates later, and this subscription applies that
|
|
49
|
+
* value to the SAME mounted tree (no remount, no permanent empty tree). Later
|
|
50
|
+
* changes — another tab, another writer — arrive the same way. A read that
|
|
51
|
+
* started BEFORE a user toggle is discarded by the preference store, so a slow
|
|
52
|
+
* hydration can never re-collapse directories the user just opened.
|
|
53
|
+
* @param persistKey - The storage key to follow.
|
|
54
|
+
* @param apply - Called with the current state after the key changes.
|
|
55
|
+
* @returns A function that stops following the key.
|
|
56
|
+
*/
|
|
57
|
+
export function watchExpandState(persistKey, apply) {
|
|
58
|
+
const store = getPreferenceStore();
|
|
59
|
+
const stop = store.subscribe(persistKey, () => apply(loadExpandState(persistKey)));
|
|
60
|
+
void store.hydrate([persistKey]);
|
|
61
|
+
return stop;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=fileExplorerPersistence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileExplorerPersistence.js","sourceRoot":"","sources":["../../src/components/fileExplorerPersistence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAU1D;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,UAAkB;IAChD,MAAM,MAAM,GAAG,kBAAkB,EAAE,CAAC,GAAG,CAAgD,UAAU,CAAC,CAAA;IAClG,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QACzC,OAAO;YACL,QAAQ,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC;YACxC,SAAS,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;SAC3C,CAAA;IACH,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,GAAG,EAAE,EAAE,CAAA;AACtD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,UAAkB,EAAE,KAAkB;IACpE,kBAAkB,EAAE,CAAC,GAAG,CAAC,UAAU,EAAE;QACnC,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC7B,SAAS,EAAE,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;KAChC,CAAC,CAAA;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAC9B,UAAkB,EAClB,KAAmC;IAEnC,MAAM,KAAK,GAAG,kBAAkB,EAAE,CAAA;IAClC,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;IAClF,KAAK,KAAK,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,CAAC,CAAA;IAChC,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search defaults the panel and its host share.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Default search-excluded directory names shown when the host supplies none —
|
|
8
|
+
* VS Code's `search.exclude`/`files.exclude` defaults plus the platform's
|
|
9
|
+
* vendored/build dirs. MUST stay in sync with the API-side list in
|
|
10
|
+
* `@molecule/api-ai-tools` (utilities.ts) — the cross-stack import boundary
|
|
11
|
+
* forces the duplication; `molecule/scripts/__tests__/search-excluded-dirs-sync.test.mjs` fails
|
|
12
|
+
* when the two differ.
|
|
13
|
+
*/
|
|
14
|
+
export declare const DEFAULT_SEARCH_EXCLUDED_DIRS: readonly ["node_modules", "bower_components", ".git", ".svn", ".hg", "CVS", "dist", ".next", ".vite", "molecule"];
|
|
15
|
+
//# sourceMappingURL=search-utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-utilities.d.ts","sourceRoot":"","sources":["../../src/components/search-utilities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,mHAW/B,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search defaults the panel and its host share.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Default search-excluded directory names shown when the host supplies none —
|
|
8
|
+
* VS Code's `search.exclude`/`files.exclude` defaults plus the platform's
|
|
9
|
+
* vendored/build dirs. MUST stay in sync with the API-side list in
|
|
10
|
+
* `@molecule/api-ai-tools` (utilities.ts) — the cross-stack import boundary
|
|
11
|
+
* forces the duplication; `molecule/scripts/__tests__/search-excluded-dirs-sync.test.mjs` fails
|
|
12
|
+
* when the two differ.
|
|
13
|
+
*/
|
|
14
|
+
export const DEFAULT_SEARCH_EXCLUDED_DIRS = [
|
|
15
|
+
'node_modules',
|
|
16
|
+
'bower_components',
|
|
17
|
+
'.git',
|
|
18
|
+
'.svn',
|
|
19
|
+
'.hg',
|
|
20
|
+
'CVS',
|
|
21
|
+
'dist',
|
|
22
|
+
'.next',
|
|
23
|
+
'.vite',
|
|
24
|
+
'molecule',
|
|
25
|
+
];
|
|
26
|
+
//# sourceMappingURL=search-utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-utilities.js","sourceRoot":"","sources":["../../src/components/search-utilities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,cAAc;IACd,kBAAkB;IAClB,MAAM;IACN,MAAM;IACN,KAAK;IACL,KAAK;IACL,MAAM;IACN,OAAO;IACP,OAAO;IACP,UAAU;CACF,CAAA"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tests status bar — its visibility preference and the pure summary the bar
|
|
3
|
+
* renders. The component is `TestStatusBar.tsx`; the hook is
|
|
4
|
+
* `hooks/useTestsBarVisible.ts`.
|
|
5
|
+
*
|
|
6
|
+
* Visibility is a PER-DEVICE, per-user display preference in localStorage, the
|
|
7
|
+
* same shape as `/timestamps` and `/sounds` — never project settings, so a
|
|
8
|
+
* viewer can hide the bar without changing what a teammate sees. It defaults to
|
|
9
|
+
* SHOWN: a run drives the project's preview as it goes, and a preview that moves
|
|
10
|
+
* on its own with nothing on screen to explain it is the problem this bar
|
|
11
|
+
* exists to remove.
|
|
12
|
+
*
|
|
13
|
+
* Shown, however, still means "once the project HAS tests" — see
|
|
14
|
+
* {@link shouldShowTestsBar}. The preference decides whether the person wants
|
|
15
|
+
* the bar; that predicate decides whether there is anything for it to say.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
import type { TestItem } from '../types.js';
|
|
20
|
+
import type { TestsRunState } from './tests-card-utilities.js';
|
|
21
|
+
/** localStorage key holding `'true'` / `'false'`. Absent = the default (shown). */
|
|
22
|
+
export declare const TESTS_BAR_STORAGE_KEY = "mol_chat_show_tests_bar";
|
|
23
|
+
/** Window event dispatched (same tab) whenever the preference changes. */
|
|
24
|
+
export declare const TESTS_BAR_EVENT = "mol:tests-bar-changed";
|
|
25
|
+
/**
|
|
26
|
+
* Parses the stored preference. Only an explicit `'false'` hides the bar, so a
|
|
27
|
+
* missing or unreadable value keeps the default (shown).
|
|
28
|
+
*
|
|
29
|
+
* @param raw - The raw localStorage value.
|
|
30
|
+
* @returns Whether the tests bar is visible.
|
|
31
|
+
*/
|
|
32
|
+
export declare function parseTestsBarVisible(raw: string | null): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Reads this device's preference.
|
|
35
|
+
*
|
|
36
|
+
* @returns Whether the tests bar is visible (default `true`).
|
|
37
|
+
*/
|
|
38
|
+
export declare function getTestsBarVisible(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Writes this device's preference and tells every mounted chat in this tab.
|
|
41
|
+
*
|
|
42
|
+
* @param visible - Whether the bar should be shown.
|
|
43
|
+
*/
|
|
44
|
+
export declare function setTestsBarVisible(visible: boolean): void;
|
|
45
|
+
/**
|
|
46
|
+
* What `/test on|off|toggle` means. Anything else is not a visibility request —
|
|
47
|
+
* bare `/test` opens the tests browser, which is a different thing entirely.
|
|
48
|
+
*
|
|
49
|
+
* @param args - The text after `/test`.
|
|
50
|
+
* @param current - The current visibility, for `toggle`.
|
|
51
|
+
* @returns The requested visibility, or null when the argument is not one.
|
|
52
|
+
*/
|
|
53
|
+
export declare function parseTestsBarArg(args: string, current: boolean): boolean | null;
|
|
54
|
+
/**
|
|
55
|
+
* Whether there is anything for the bar to report.
|
|
56
|
+
*
|
|
57
|
+
* A project with no tests yet gets NO bar. The strip earns its slot above the
|
|
58
|
+
* composer by accounting for something — a suite's verdict, a run driving the
|
|
59
|
+
* preview — and a project that has not been given tests has neither; an empty
|
|
60
|
+
* strip saying "0 tests not run yet" is noise in exactly the projects that are
|
|
61
|
+
* least ready for it. It appears on its own the moment discovery finds a spec.
|
|
62
|
+
*
|
|
63
|
+
* The run clauses come second on purpose: a run in flight, a run-level error or
|
|
64
|
+
* a finished outcome all mean tests EXIST, whatever the discovered list happens
|
|
65
|
+
* to hold at that moment (a list can be empty because discovery has not
|
|
66
|
+
* answered yet, not because the project is bare).
|
|
67
|
+
*
|
|
68
|
+
* @param run - The live run state.
|
|
69
|
+
* @param tests - The discovered tests.
|
|
70
|
+
* @returns Whether the bar should render at all.
|
|
71
|
+
*/
|
|
72
|
+
export declare function shouldShowTestsBar(run: TestsRunState, tests: TestItem[]): boolean;
|
|
73
|
+
/** The bar's overall state, which decides its colour and its wording. */
|
|
74
|
+
export type TestsBarTone = 'idle' | 'running' | 'passing' | 'failing' | 'stopped' | 'error';
|
|
75
|
+
/** Everything the bar renders, derived from the run state in one place. */
|
|
76
|
+
export interface TestsBarSummary {
|
|
77
|
+
tone: TestsBarTone;
|
|
78
|
+
/** Files that finished with every test passing. */
|
|
79
|
+
passed: number;
|
|
80
|
+
/** Files that finished with at least one failing test. */
|
|
81
|
+
failed: number;
|
|
82
|
+
/** Files that were skipped, by the runner or by the person. */
|
|
83
|
+
skipped: number;
|
|
84
|
+
/** Files this run still has to reach, when it is running. */
|
|
85
|
+
remaining: number;
|
|
86
|
+
/** Discovered files with no result yet — what the idle line counts. */
|
|
87
|
+
notRun: number;
|
|
88
|
+
/** The file running right now, when the host says which. */
|
|
89
|
+
currentFile: string | null;
|
|
90
|
+
/** The individual test running right now, when the runner names it. */
|
|
91
|
+
currentTest: string | null;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Derive everything the bar shows from the run state.
|
|
95
|
+
*
|
|
96
|
+
* The tone is deliberately NOT "whatever the last file did": a single failing
|
|
97
|
+
* file among twenty passing ones is a failing suite, because that is the thing
|
|
98
|
+
* the person has to act on. Running always wins, since a count that is still
|
|
99
|
+
* moving is not a verdict.
|
|
100
|
+
*
|
|
101
|
+
* @param run - The chat panel's live run state.
|
|
102
|
+
* @param tests - The discovered tests, used to name the file running now.
|
|
103
|
+
* @returns The summary the bar renders.
|
|
104
|
+
*/
|
|
105
|
+
export declare function summariseTestsBar(run: TestsRunState, tests: TestItem[]): TestsBarSummary;
|
|
106
|
+
//# sourceMappingURL=tests-bar-utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tests-bar-utilities.d.ts","sourceRoot":"","sources":["../../src/components/tests-bar-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE9D,mFAAmF;AACnF,eAAO,MAAM,qBAAqB,4BAA4B,CAAA;AAE9D,0EAA0E;AAC1E,eAAO,MAAM,eAAe,0BAA0B,CAAA;AAEtD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAEhE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAO5C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAWzD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAM/E;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,CAIjF;AAED,yEAAyE;AACzE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;AAE3F,2EAA2E;AAC3E,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,YAAY,CAAA;IAClB,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAA;IACd,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAA;IACd,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAA;IACf,6DAA6D;IAC7D,SAAS,EAAE,MAAM,CAAA;IACjB,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAA;IACd,4DAA4D;IAC5D,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,uEAAuE;IACvE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,eAAe,CA8CxF"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tests status bar — its visibility preference and the pure summary the bar
|
|
3
|
+
* renders. The component is `TestStatusBar.tsx`; the hook is
|
|
4
|
+
* `hooks/useTestsBarVisible.ts`.
|
|
5
|
+
*
|
|
6
|
+
* Visibility is a PER-DEVICE, per-user display preference in localStorage, the
|
|
7
|
+
* same shape as `/timestamps` and `/sounds` — never project settings, so a
|
|
8
|
+
* viewer can hide the bar without changing what a teammate sees. It defaults to
|
|
9
|
+
* SHOWN: a run drives the project's preview as it goes, and a preview that moves
|
|
10
|
+
* on its own with nothing on screen to explain it is the problem this bar
|
|
11
|
+
* exists to remove.
|
|
12
|
+
*
|
|
13
|
+
* Shown, however, still means "once the project HAS tests" — see
|
|
14
|
+
* {@link shouldShowTestsBar}. The preference decides whether the person wants
|
|
15
|
+
* the bar; that predicate decides whether there is anything for it to say.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
/** localStorage key holding `'true'` / `'false'`. Absent = the default (shown). */
|
|
20
|
+
export const TESTS_BAR_STORAGE_KEY = 'mol_chat_show_tests_bar';
|
|
21
|
+
/** Window event dispatched (same tab) whenever the preference changes. */
|
|
22
|
+
export const TESTS_BAR_EVENT = 'mol:tests-bar-changed';
|
|
23
|
+
/**
|
|
24
|
+
* Parses the stored preference. Only an explicit `'false'` hides the bar, so a
|
|
25
|
+
* missing or unreadable value keeps the default (shown).
|
|
26
|
+
*
|
|
27
|
+
* @param raw - The raw localStorage value.
|
|
28
|
+
* @returns Whether the tests bar is visible.
|
|
29
|
+
*/
|
|
30
|
+
export function parseTestsBarVisible(raw) {
|
|
31
|
+
return raw !== 'false';
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Reads this device's preference.
|
|
35
|
+
*
|
|
36
|
+
* @returns Whether the tests bar is visible (default `true`).
|
|
37
|
+
*/
|
|
38
|
+
export function getTestsBarVisible() {
|
|
39
|
+
try {
|
|
40
|
+
return parseTestsBarVisible(localStorage.getItem(TESTS_BAR_STORAGE_KEY));
|
|
41
|
+
}
|
|
42
|
+
catch (_error) {
|
|
43
|
+
// localStorage unavailable (private mode, SSR) — fall back to the default.
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Writes this device's preference and tells every mounted chat in this tab.
|
|
49
|
+
*
|
|
50
|
+
* @param visible - Whether the bar should be shown.
|
|
51
|
+
*/
|
|
52
|
+
export function setTestsBarVisible(visible) {
|
|
53
|
+
try {
|
|
54
|
+
localStorage.setItem(TESTS_BAR_STORAGE_KEY, visible ? 'true' : 'false');
|
|
55
|
+
}
|
|
56
|
+
catch (_error) {
|
|
57
|
+
// Unwritable storage still fires the event, so the current tab follows.
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
window.dispatchEvent(new CustomEvent(TESTS_BAR_EVENT, { detail: { visible } }));
|
|
61
|
+
}
|
|
62
|
+
catch (_error) {
|
|
63
|
+
// No window (SSR) — nothing is mounted to notify.
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* What `/test on|off|toggle` means. Anything else is not a visibility request —
|
|
68
|
+
* bare `/test` opens the tests browser, which is a different thing entirely.
|
|
69
|
+
*
|
|
70
|
+
* @param args - The text after `/test`.
|
|
71
|
+
* @param current - The current visibility, for `toggle`.
|
|
72
|
+
* @returns The requested visibility, or null when the argument is not one.
|
|
73
|
+
*/
|
|
74
|
+
export function parseTestsBarArg(args, current) {
|
|
75
|
+
const word = args.trim().toLowerCase();
|
|
76
|
+
if (word === 'on' || word === 'show' || word === 'bar on')
|
|
77
|
+
return true;
|
|
78
|
+
if (word === 'off' || word === 'hide' || word === 'bar off')
|
|
79
|
+
return false;
|
|
80
|
+
if (word === 'toggle' || word === 'bar')
|
|
81
|
+
return !current;
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Whether there is anything for the bar to report.
|
|
86
|
+
*
|
|
87
|
+
* A project with no tests yet gets NO bar. The strip earns its slot above the
|
|
88
|
+
* composer by accounting for something — a suite's verdict, a run driving the
|
|
89
|
+
* preview — and a project that has not been given tests has neither; an empty
|
|
90
|
+
* strip saying "0 tests not run yet" is noise in exactly the projects that are
|
|
91
|
+
* least ready for it. It appears on its own the moment discovery finds a spec.
|
|
92
|
+
*
|
|
93
|
+
* The run clauses come second on purpose: a run in flight, a run-level error or
|
|
94
|
+
* a finished outcome all mean tests EXIST, whatever the discovered list happens
|
|
95
|
+
* to hold at that moment (a list can be empty because discovery has not
|
|
96
|
+
* answered yet, not because the project is bare).
|
|
97
|
+
*
|
|
98
|
+
* @param run - The live run state.
|
|
99
|
+
* @param tests - The discovered tests.
|
|
100
|
+
* @returns Whether the bar should render at all.
|
|
101
|
+
*/
|
|
102
|
+
export function shouldShowTestsBar(run, tests) {
|
|
103
|
+
if (tests.length > 0)
|
|
104
|
+
return true;
|
|
105
|
+
if (run.running || run.error != null || run.outcome != null)
|
|
106
|
+
return true;
|
|
107
|
+
return Object.keys(run.results).length > 0;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Derive everything the bar shows from the run state.
|
|
111
|
+
*
|
|
112
|
+
* The tone is deliberately NOT "whatever the last file did": a single failing
|
|
113
|
+
* file among twenty passing ones is a failing suite, because that is the thing
|
|
114
|
+
* the person has to act on. Running always wins, since a count that is still
|
|
115
|
+
* moving is not a verdict.
|
|
116
|
+
*
|
|
117
|
+
* @param run - The chat panel's live run state.
|
|
118
|
+
* @param tests - The discovered tests, used to name the file running now.
|
|
119
|
+
* @returns The summary the bar renders.
|
|
120
|
+
*/
|
|
121
|
+
export function summariseTestsBar(run, tests) {
|
|
122
|
+
let passed = 0;
|
|
123
|
+
let failed = 0;
|
|
124
|
+
let skipped = 0;
|
|
125
|
+
for (const entry of Object.values(run.results)) {
|
|
126
|
+
if (entry.status === 'passed')
|
|
127
|
+
passed++;
|
|
128
|
+
else if (entry.status === 'failed')
|
|
129
|
+
failed++;
|
|
130
|
+
else if (entry.status === 'skipped')
|
|
131
|
+
skipped++;
|
|
132
|
+
}
|
|
133
|
+
const byId = new Map(tests.map((test) => [test.id, test]));
|
|
134
|
+
const current = run.currentId ? (byId.get(run.currentId) ?? null) : null;
|
|
135
|
+
const progress = run.currentId ? run.cases[run.currentId] : undefined;
|
|
136
|
+
const currentCase = progress?.current ?? null;
|
|
137
|
+
const currentTest = currentCase
|
|
138
|
+
? currentCase.describe
|
|
139
|
+
? `${currentCase.describe} › ${currentCase.title}`
|
|
140
|
+
: currentCase.title
|
|
141
|
+
: null;
|
|
142
|
+
const done = passed + failed + skipped;
|
|
143
|
+
const remaining = run.running ? Math.max(0, run.queued.length - done) : 0;
|
|
144
|
+
const notRun = tests.filter((test) => run.results[test.id] == null).length;
|
|
145
|
+
const tone = run.running
|
|
146
|
+
? 'running'
|
|
147
|
+
: run.error
|
|
148
|
+
? 'error'
|
|
149
|
+
: run.outcome === 'cancelled' || run.outcome === 'skipped-by-user'
|
|
150
|
+
? 'stopped'
|
|
151
|
+
: failed > 0
|
|
152
|
+
? 'failing'
|
|
153
|
+
: passed > 0
|
|
154
|
+
? 'passing'
|
|
155
|
+
: 'idle';
|
|
156
|
+
return {
|
|
157
|
+
tone,
|
|
158
|
+
passed,
|
|
159
|
+
failed,
|
|
160
|
+
skipped,
|
|
161
|
+
remaining,
|
|
162
|
+
notRun,
|
|
163
|
+
currentFile: current?.title ?? current?.file ?? null,
|
|
164
|
+
currentTest,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=tests-bar-utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tests-bar-utilities.js","sourceRoot":"","sources":["../../src/components/tests-bar-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,mFAAmF;AACnF,MAAM,CAAC,MAAM,qBAAqB,GAAG,yBAAyB,CAAA;AAE9D,0EAA0E;AAC1E,MAAM,CAAC,MAAM,eAAe,GAAG,uBAAuB,CAAA;AAEtD;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAkB;IACrD,OAAO,GAAG,KAAK,OAAO,CAAA;AACxB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IAChC,IAAI,CAAC;QACH,OAAO,oBAAoB,CAAC,YAAY,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAA;IAC1E,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,2EAA2E;QAC3E,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAgB;IACjD,IAAI,CAAC;QACH,YAAY,CAAC,OAAO,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IACzE,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,wEAAwE;IAC1E,CAAC;IACD,IAAI,CAAC;QACH,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,eAAe,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;IACjF,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,kDAAkD;IACpD,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAA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