@ethlete/query-devtools 1.0.0-next.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/CHANGELOG.md +12 -0
- package/README.md +42 -0
- package/fesm2022/ethlete-query-devtools-lazy.mjs +95 -0
- package/fesm2022/ethlete-query-devtools-lazy.mjs.map +1 -0
- package/fesm2022/ethlete-query-devtools-toggle.mjs +79 -0
- package/fesm2022/ethlete-query-devtools-toggle.mjs.map +1 -0
- package/fesm2022/ethlete-query-devtools.mjs +6680 -0
- package/fesm2022/ethlete-query-devtools.mjs.map +1 -0
- package/package.json +45 -0
- package/types/ethlete-query-devtools-lazy.d.ts +39 -0
- package/types/ethlete-query-devtools-toggle.d.ts +37 -0
- package/types/ethlete-query-devtools.d.ts +1777 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0-next.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#3055](https://github.com/ethlete-io/ethdk/pull/3055) [`7245dc7`](https://github.com/ethlete-io/ethdk/commit/7245dc788ddab057e39b8ac8aeb1e7c019baa2dc) Thanks [@github-actions](https://github.com/apps/github-actions)! - The devtools panel moved out of `@ethlete/components` into its own package, `@ethlete/query-devtools`, where `<et-query-devtools-lazy>` loads it on first open instead of shipping it - 125 kB gz an application no longer pays.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#3055](https://github.com/ethlete-io/ethdk/pull/3055) [`bbb294f`](https://github.com/ethlete-io/ethdk/commit/bbb294fd9d99d8f7d0ab0036af819fb734d0e136) Thanks [@github-actions](https://github.com/apps/github-actions)! - Mark `@analogjs/vitest-angular` an optional peer dependency, so installing the devtools no longer
|
|
12
|
+
asks consumers for a test runner the package only needs to run its own specs.
|
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# @ethlete/query-devtools
|
|
2
|
+
|
|
3
|
+
The in-app inspector for [`@ethlete/query`](https://www.npmjs.com/package/@ethlete/query): queries,
|
|
4
|
+
stacks, sequences, auth providers, sockets, the cache, an event log, plus armed faults, mocks and
|
|
5
|
+
response overrides.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
yarn add -D @ethlete/query-devtools
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Instrumentation is turned on separately, by `provideQueryDevtools()` from `@ethlete/query`. Mount
|
|
16
|
+
the panel through `<et-query-devtools-lazy>`, which renders only the floating toggle button and
|
|
17
|
+
downloads the panel the first time it is opened.
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { provideQueryDevtools } from '@ethlete/query';
|
|
21
|
+
|
|
22
|
+
bootstrapApplication(AppComponent, {
|
|
23
|
+
providers: [provideQueryDevtools()],
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { QueryDevtoolsLazyComponent } from '@ethlete/query-devtools/lazy';
|
|
29
|
+
|
|
30
|
+
@Component({
|
|
31
|
+
selector: 'app-root',
|
|
32
|
+
imports: [QueryDevtoolsLazyComponent],
|
|
33
|
+
template: `<et-query-devtools-lazy />`,
|
|
34
|
+
})
|
|
35
|
+
export class AppComponent {}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`<et-query-devtools>` from `@ethlete/query-devtools` is the same panel loaded eagerly.
|
|
39
|
+
|
|
40
|
+
## Documentation
|
|
41
|
+
|
|
42
|
+
https://ethlete-sdk-docs.web.app/query-devtools/
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { DOCUMENT } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, signal, computed, ViewEncapsulation, Component } from '@angular/core';
|
|
4
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
|
+
import { queryDevtoolsFaults, queryDevtoolsTokenTtls, queryDevtoolsArmedMocks, queryDevtoolsEntries } from '@ethlete/query';
|
|
6
|
+
import { fromEvent, filter, tap } from 'rxjs';
|
|
7
|
+
import { wasQueryDevtoolsOpen, QueryDevtoolsToggleComponent } from '@ethlete/query-devtools/toggle';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The query devtools behind a deferred load: renders only the floating toggle button until the panel is
|
|
11
|
+
* first asked for, then downloads `<et-query-devtools>` as its own chunk and hands over. Use it instead
|
|
12
|
+
* of `<et-query-devtools>` to keep the panel out of the bundle an application ships to its users.
|
|
13
|
+
*
|
|
14
|
+
* Everything else is identical - the same toggle, the same `Ctrl/Cmd + Alt + Q` shortcut, and a panel
|
|
15
|
+
* that was open when the tab last stored its state comes back open without a click.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```html
|
|
19
|
+
* <et-query-devtools-lazy />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
class QueryDevtoolsLazyComponent {
|
|
23
|
+
constructor() {
|
|
24
|
+
this.document = inject(DOCUMENT);
|
|
25
|
+
/**
|
|
26
|
+
* Whether the panel was already open in this tab. It has to be answered before the panel exists, which
|
|
27
|
+
* is why the stored view state is read here rather than asked of the panel.
|
|
28
|
+
*/
|
|
29
|
+
this.restoredOpen = wasQueryDevtoolsOpen();
|
|
30
|
+
this.load = signal(this.restoredOpen, /* @ts-ignore */
|
|
31
|
+
...(ngDevMode ? [{ debugName: "load" }] : /* istanbul ignore next */ []));
|
|
32
|
+
/** A restored panel opens because it was open; one that was clicked open has to be told to. */
|
|
33
|
+
this.openOnLoad = signal(false, /* @ts-ignore */
|
|
34
|
+
...(ngDevMode ? [{ debugName: "openOnLoad" }] : /* istanbul ignore next */ []));
|
|
35
|
+
/**
|
|
36
|
+
* Whether anything armed is changing what the app does, for the dot on the closed toggle. The panel's
|
|
37
|
+
* own badge is per-query and finer-grained; this covers what can already be armed before the panel has
|
|
38
|
+
* ever been loaded - overrides and mocks restored from a previous page load, and anything an app or a
|
|
39
|
+
* test armed through the API.
|
|
40
|
+
*/
|
|
41
|
+
this.tampered = computed(() => Object.keys(queryDevtoolsFaults()).length > 0 ||
|
|
42
|
+
Object.keys(queryDevtoolsTokenTtls()).length > 0 ||
|
|
43
|
+
queryDevtoolsArmedMocks().size > 0 ||
|
|
44
|
+
queryDevtoolsEntries().some((entry) => (entry.overrides?.list().length ?? 0) > 0), /* @ts-ignore */
|
|
45
|
+
...(ngDevMode ? [{ debugName: "tampered" }] : /* istanbul ignore next */ []));
|
|
46
|
+
// The same shortcut the panel installs, for the one press that has to happen before it exists. Once
|
|
47
|
+
// the panel is loaded it owns the key, so this stops at the first press it handles.
|
|
48
|
+
fromEvent(this.document, 'keydown')
|
|
49
|
+
.pipe(filter(() => !this.load()), filter((e) => (e.ctrlKey || e.metaKey) && e.altKey && (e.code === 'KeyQ' || e.key.toLowerCase() === 'q')), tap((e) => {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
this.open();
|
|
52
|
+
}), takeUntilDestroyed())
|
|
53
|
+
.subscribe();
|
|
54
|
+
}
|
|
55
|
+
open() {
|
|
56
|
+
this.openOnLoad.set(true);
|
|
57
|
+
this.load.set(true);
|
|
58
|
+
}
|
|
59
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: QueryDevtoolsLazyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
60
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.7", type: QueryDevtoolsLazyComponent, isStandalone: true, selector: "et-query-devtools-lazy", ngImport: i0, template: `
|
|
61
|
+
@defer (when load()) {
|
|
62
|
+
<et-query-devtools [startOpen]="openOnLoad()" />
|
|
63
|
+
} @placeholder {
|
|
64
|
+
<et-query-devtools-toggle [tampered]="tampered()" (openChange)="open()" />
|
|
65
|
+
} @loading {
|
|
66
|
+
<et-query-devtools-toggle [tampered]="tampered()" />
|
|
67
|
+
}
|
|
68
|
+
`, isInline: true, dependencies: [{ kind: "component", type: QueryDevtoolsToggleComponent, selector: "et-query-devtools-toggle", inputs: ["tampered"], outputs: ["openChange"] }], encapsulation: i0.ViewEncapsulation.None, deferBlockDependencies: [() => [/* @ts-ignore */
|
|
69
|
+
import('@ethlete/query-devtools').then(m => m.QueryDevtoolsComponent)]] }); }
|
|
70
|
+
}
|
|
71
|
+
i0.ɵɵngDeclareClassMetadataAsync({ minVersion: "18.0.0", version: "22.0.7", ngImport: i0, type: QueryDevtoolsLazyComponent, resolveDeferredDeps: () => [/* @ts-ignore */
|
|
72
|
+
import('@ethlete/query-devtools').then(m => m.QueryDevtoolsComponent)], resolveMetadata: QueryDevtoolsComponent => ({ decorators: [{
|
|
73
|
+
type: Component,
|
|
74
|
+
args: [{
|
|
75
|
+
selector: 'et-query-devtools-lazy',
|
|
76
|
+
template: `
|
|
77
|
+
@defer (when load()) {
|
|
78
|
+
<et-query-devtools [startOpen]="openOnLoad()" />
|
|
79
|
+
} @placeholder {
|
|
80
|
+
<et-query-devtools-toggle [tampered]="tampered()" (openChange)="open()" />
|
|
81
|
+
} @loading {
|
|
82
|
+
<et-query-devtools-toggle [tampered]="tampered()" />
|
|
83
|
+
}
|
|
84
|
+
`,
|
|
85
|
+
encapsulation: ViewEncapsulation.None,
|
|
86
|
+
imports: [QueryDevtoolsComponent, QueryDevtoolsToggleComponent],
|
|
87
|
+
}]
|
|
88
|
+
}], ctorParameters: () => [], propDecorators: null }) });
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Generated bundle index. Do not edit.
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
export { QueryDevtoolsLazyComponent };
|
|
95
|
+
//# sourceMappingURL=ethlete-query-devtools-lazy.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ethlete-query-devtools-lazy.mjs","sources":["../../../../libs/query-devtools/lazy/query-devtools-lazy.component.ts","../../../../libs/query-devtools/lazy/ethlete-query-devtools-lazy.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport { Component, computed, inject, signal, ViewEncapsulation } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport {\n queryDevtoolsArmedMocks,\n queryDevtoolsEntries,\n queryDevtoolsFaults,\n queryDevtoolsTokenTtls,\n} from '@ethlete/query';\nimport { filter, fromEvent, tap } from 'rxjs';\nimport { QueryDevtoolsComponent } from '@ethlete/query-devtools';\nimport { QueryDevtoolsToggleComponent, wasQueryDevtoolsOpen } from '@ethlete/query-devtools/toggle';\n\n/**\n * The query devtools behind a deferred load: renders only the floating toggle button until the panel is\n * first asked for, then downloads `<et-query-devtools>` as its own chunk and hands over. Use it instead\n * of `<et-query-devtools>` to keep the panel out of the bundle an application ships to its users.\n *\n * Everything else is identical - the same toggle, the same `Ctrl/Cmd + Alt + Q` shortcut, and a panel\n * that was open when the tab last stored its state comes back open without a click.\n *\n * @example\n * ```html\n * <et-query-devtools-lazy />\n * ```\n */\n@Component({\n selector: 'et-query-devtools-lazy',\n template: `\n @defer (when load()) {\n <et-query-devtools [startOpen]=\"openOnLoad()\" />\n } @placeholder {\n <et-query-devtools-toggle [tampered]=\"tampered()\" (openChange)=\"open()\" />\n } @loading {\n <et-query-devtools-toggle [tampered]=\"tampered()\" />\n }\n `,\n encapsulation: ViewEncapsulation.None,\n imports: [QueryDevtoolsComponent, QueryDevtoolsToggleComponent],\n})\nexport class QueryDevtoolsLazyComponent {\n private document = inject(DOCUMENT);\n\n /**\n * Whether the panel was already open in this tab. It has to be answered before the panel exists, which\n * is why the stored view state is read here rather than asked of the panel.\n */\n private restoredOpen = wasQueryDevtoolsOpen();\n\n protected load = signal(this.restoredOpen);\n\n /** A restored panel opens because it was open; one that was clicked open has to be told to. */\n protected openOnLoad = signal(false);\n\n /**\n * Whether anything armed is changing what the app does, for the dot on the closed toggle. The panel's\n * own badge is per-query and finer-grained; this covers what can already be armed before the panel has\n * ever been loaded - overrides and mocks restored from a previous page load, and anything an app or a\n * test armed through the API.\n */\n protected tampered = computed(\n () =>\n Object.keys(queryDevtoolsFaults()).length > 0 ||\n Object.keys(queryDevtoolsTokenTtls()).length > 0 ||\n queryDevtoolsArmedMocks().size > 0 ||\n queryDevtoolsEntries().some((entry) => (entry.overrides?.list().length ?? 0) > 0),\n );\n\n constructor() {\n // The same shortcut the panel installs, for the one press that has to happen before it exists. Once\n // the panel is loaded it owns the key, so this stops at the first press it handles.\n fromEvent<KeyboardEvent>(this.document, 'keydown')\n .pipe(\n filter(() => !this.load()),\n filter((e) => (e.ctrlKey || e.metaKey) && e.altKey && (e.code === 'KeyQ' || e.key.toLowerCase() === 'q')),\n tap((e) => {\n e.preventDefault();\n this.open();\n }),\n takeUntilDestroyed(),\n )\n .subscribe();\n }\n\n protected open() {\n this.openOnLoad.set(true);\n this.load.set(true);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAaA;;;;;;;;;;;;AAYG;MAeU,0BAA0B,CAAA;AA4BrC,IAAA,WAAA,GAAA;AA3BQ,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAEnC;;;AAGG;QACK,IAAA,CAAA,YAAY,GAAG,oBAAoB,EAAE;AAEnC,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY;iFAAC;;QAGhC,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,KAAK;uFAAC;AAEpC;;;;;AAKG;AACO,QAAA,IAAA,CAAA,QAAQ,GAAG,QAAQ,CAC3B,MACE,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC;YAC7C,MAAM,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAAC,MAAM,GAAG,CA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,QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAEiC,4BAA4B,EAAA,QAAA,EAAA,0BAAA,EAAA,MAAA,EAAA,CAAA,UAAA,CAAA,EAAA,OAAA,EAAA,CAAA,YAAA,CAAA,EAAA,CAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,sBAAA,EAAA,CAAA,MAAA;;;gGAEnD,0BAA0B,EAAA,mBAAA,EAAA,MAAA;;sBAdtC,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA;AACT,wBAAA,QAAQ,EAAE,wBAAwB;AAClC,wBAAA,QAAQ,EAAE;;;;;;;;AAQT,EAAA,CAAA;wBACD,aAAa,EAAE,iBAAiB,CAAC,IAAI;AACrC,wBAAA,OAAO,EAAE,CAAC,sBAAsB,EAAE,4BAA4B,CAAC;AAChE,qBAAA;;;ACvCD;;AAEG;;;;"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { detectKbdPlatform } from '@ethlete/components';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { input, output, ViewEncapsulation, Component } from '@angular/core';
|
|
4
|
+
import { readQueryDevtoolsStore, queryDevtoolsSettings } from '@ethlete/query';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The global devtools toggle shortcut, rendered for the current platform (`⌘⌥Q` on Apple, where the
|
|
8
|
+
* symbols are the convention, `Ctrl+Alt+Q` everywhere else). Shown on both the floating toggle and
|
|
9
|
+
* the panel's close button so the shortcut is discoverable without reading the docs.
|
|
10
|
+
*/
|
|
11
|
+
const queryDevtoolsShortcutLabel = () => (detectKbdPlatform() === 'apple' ? '⌘⌥Q' : 'Ctrl+Alt+Q');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The floating toggle button for the query devtools. Rendered with `ShadowDom` encapsulation so the
|
|
15
|
+
* host application's global CSS (Tailwind resets, button styles, …) can never touch it and its own
|
|
16
|
+
* styles can never leak out. Uses px (not rem) internally so it doesn't depend on the host's root
|
|
17
|
+
* font-size; theme accent colour is read from an inherited custom property with a fallback.
|
|
18
|
+
*/
|
|
19
|
+
class QueryDevtoolsToggleComponent {
|
|
20
|
+
constructor() {
|
|
21
|
+
this.tampered = input(false, /* @ts-ignore */
|
|
22
|
+
...(ngDevMode ? [{ debugName: "tampered" }] : /* istanbul ignore next */ []));
|
|
23
|
+
this.openChange = output();
|
|
24
|
+
this.shortcut = queryDevtoolsShortcutLabel();
|
|
25
|
+
}
|
|
26
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: QueryDevtoolsToggleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
27
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.7", type: QueryDevtoolsToggleComponent, isStandalone: true, selector: "et-query-devtools-toggle", inputs: { tampered: { classPropertyName: "tampered", publicName: "tampered", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { openChange: "openChange" }, ngImport: i0, template: `
|
|
28
|
+
<button (click)="openChange.emit()" type="button" title="Open query devtools ({{ shortcut }})">
|
|
29
|
+
<svg viewBox="0 0 24 24" aria-hidden="true">
|
|
30
|
+
<ellipse cx="12" cy="6" rx="7.5" ry="3" />
|
|
31
|
+
<path d="M4.5 6v6c0 1.66 3.36 3 7.5 3s7.5-1.34 7.5-3V6" />
|
|
32
|
+
<path d="M4.5 12v6c0 1.66 3.36 3 7.5 3s7.5-1.34 7.5-3v-6" />
|
|
33
|
+
</svg>
|
|
34
|
+
<span class="label">Query</span>
|
|
35
|
+
<kbd>{{ shortcut }}</kbd>
|
|
36
|
+
@if (tampered()) {
|
|
37
|
+
<span class="tamper-dot" title="A query is showing an armed override or a devtools fault"></span>
|
|
38
|
+
}
|
|
39
|
+
</button>
|
|
40
|
+
`, isInline: true, styles: [":host{position:fixed;inset-block-end:16px;inset-inline-end:16px;z-index:2147483001}button{--_accent: var(--et-theme-color-primary-solid, #60a5fa);position:relative;display:inline-flex;align-items:center;gap:8px;padding:10px 12px 10px 14px;border:none;border-radius:999px;background:linear-gradient(135deg,#1f1f23,#2a2a30);color:#fafafa;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;font-weight:600;letter-spacing:.02em;cursor:pointer;box-shadow:0 6px 20px #00000059,inset 0 0 0 1px #ffffff14;transition:transform .15s ease,box-shadow .2s ease}button:before{content:\"\";position:absolute;inset:0;border-radius:inherit;padding:1px;background:linear-gradient(135deg,var(--_accent),transparent 60%);-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask-composite:exclude;opacity:.7;transition:opacity .2s ease}button:hover{transform:translateY(-2px);box-shadow:0 10px 28px #0006,0 0 0 4px color-mix(in srgb,var(--_accent) 22%,transparent),inset 0 0 0 1px #ffffff1a}button:hover:before{opacity:1}svg{inline-size:16px;block-size:16px;fill:none;stroke:var(--_accent);stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}.label{line-height:1}kbd{padding:3px 6px;border-radius:5px;background:#ffffff12;box-shadow:inset 0 0 0 1px #ffffff1f;color:#d4d4d8;font:inherit;font-size:11px;font-weight:500;line-height:1;white-space:nowrap}.tamper-dot{position:absolute;inset-block-start:-3px;inset-inline-end:-3px;inline-size:10px;block-size:10px;border-radius:50%;background:#f87171;box-shadow:0 0 0 2px #1f1f23}\n"], encapsulation: i0.ViewEncapsulation.ShadowDom }); }
|
|
41
|
+
}
|
|
42
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: QueryDevtoolsToggleComponent, decorators: [{
|
|
43
|
+
type: Component,
|
|
44
|
+
args: [{ selector: 'et-query-devtools-toggle', template: `
|
|
45
|
+
<button (click)="openChange.emit()" type="button" title="Open query devtools ({{ shortcut }})">
|
|
46
|
+
<svg viewBox="0 0 24 24" aria-hidden="true">
|
|
47
|
+
<ellipse cx="12" cy="6" rx="7.5" ry="3" />
|
|
48
|
+
<path d="M4.5 6v6c0 1.66 3.36 3 7.5 3s7.5-1.34 7.5-3V6" />
|
|
49
|
+
<path d="M4.5 12v6c0 1.66 3.36 3 7.5 3s7.5-1.34 7.5-3v-6" />
|
|
50
|
+
</svg>
|
|
51
|
+
<span class="label">Query</span>
|
|
52
|
+
<kbd>{{ shortcut }}</kbd>
|
|
53
|
+
@if (tampered()) {
|
|
54
|
+
<span class="tamper-dot" title="A query is showing an armed override or a devtools fault"></span>
|
|
55
|
+
}
|
|
56
|
+
</button>
|
|
57
|
+
`, encapsulation: ViewEncapsulation.ShadowDom, styles: [":host{position:fixed;inset-block-end:16px;inset-inline-end:16px;z-index:2147483001}button{--_accent: var(--et-theme-color-primary-solid, #60a5fa);position:relative;display:inline-flex;align-items:center;gap:8px;padding:10px 12px 10px 14px;border:none;border-radius:999px;background:linear-gradient(135deg,#1f1f23,#2a2a30);color:#fafafa;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;font-weight:600;letter-spacing:.02em;cursor:pointer;box-shadow:0 6px 20px #00000059,inset 0 0 0 1px #ffffff14;transition:transform .15s ease,box-shadow .2s ease}button:before{content:\"\";position:absolute;inset:0;border-radius:inherit;padding:1px;background:linear-gradient(135deg,var(--_accent),transparent 60%);-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask-composite:exclude;opacity:.7;transition:opacity .2s ease}button:hover{transform:translateY(-2px);box-shadow:0 10px 28px #0006,0 0 0 4px color-mix(in srgb,var(--_accent) 22%,transparent),inset 0 0 0 1px #ffffff1a}button:hover:before{opacity:1}svg{inline-size:16px;block-size:16px;fill:none;stroke:var(--_accent);stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}.label{line-height:1}kbd{padding:3px 6px;border-radius:5px;background:#ffffff12;box-shadow:inset 0 0 0 1px #ffffff1f;color:#d4d4d8;font:inherit;font-size:11px;font-weight:500;line-height:1;white-space:nowrap}.tamper-dot{position:absolute;inset-block-start:-3px;inset-inline-end:-3px;inline-size:10px;block-size:10px;border-radius:50%;background:#f87171;box-shadow:0 0 0 2px #1f1f23}\n"] }]
|
|
58
|
+
}], propDecorators: { tampered: [{ type: i0.Input, args: [{ isSignal: true, alias: "tampered", required: false }] }], openChange: [{ type: i0.Output, args: ["openChange"] }] } });
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Where the panel's own view state lives - open/closed, dock, sizes, selection, filters. Bumped
|
|
62
|
+
* whenever a shape change would make an older stored state restore into something wrong.
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
const QUERY_DEVTOOLS_VIEW_STATE_KEY = 'ethlete:query:devtools:v4';
|
|
66
|
+
/**
|
|
67
|
+
* Whether the panel was open when this tab last stored its view state. Read by
|
|
68
|
+
* `<et-query-devtools-lazy>`, which has to load the panel before it can ask the panel anything.
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
const wasQueryDevtoolsOpen = () => readQueryDevtoolsStore(queryDevtoolsSettings().viewState, QUERY_DEVTOOLS_VIEW_STATE_KEY)?.open ===
|
|
72
|
+
true;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Generated bundle index. Do not edit.
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
export { QUERY_DEVTOOLS_VIEW_STATE_KEY, QueryDevtoolsToggleComponent, queryDevtoolsShortcutLabel, wasQueryDevtoolsOpen };
|
|
79
|
+
//# sourceMappingURL=ethlete-query-devtools-toggle.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ethlete-query-devtools-toggle.mjs","sources":["../../../../libs/query-devtools/toggle/query-devtools-shortcut.ts","../../../../libs/query-devtools/toggle/query-devtools-toggle.component.ts","../../../../libs/query-devtools/toggle/query-devtools-view-state.ts","../../../../libs/query-devtools/toggle/ethlete-query-devtools-toggle.ts"],"sourcesContent":["import { detectKbdPlatform } from '@ethlete/components';\n\n/**\n * The global devtools toggle shortcut, rendered for the current platform (`⌘⌥Q` on Apple, where the\n * symbols are the convention, `Ctrl+Alt+Q` everywhere else). Shown on both the floating toggle and\n * the panel's close button so the shortcut is discoverable without reading the docs.\n */\nexport const queryDevtoolsShortcutLabel = () => (detectKbdPlatform() === 'apple' ? '⌘⌥Q' : 'Ctrl+Alt+Q');\n","import { Component, input, output, ViewEncapsulation } from '@angular/core';\nimport { queryDevtoolsShortcutLabel } from './query-devtools-shortcut';\n\n/**\n * The floating toggle button for the query devtools. Rendered with `ShadowDom` encapsulation so the\n * host application's global CSS (Tailwind resets, button styles, …) can never touch it and its own\n * styles can never leak out. Uses px (not rem) internally so it doesn't depend on the host's root\n * font-size; theme accent colour is read from an inherited custom property with a fallback.\n */\n@Component({\n selector: 'et-query-devtools-toggle',\n template: `\n <button (click)=\"openChange.emit()\" type=\"button\" title=\"Open query devtools ({{ shortcut }})\">\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <ellipse cx=\"12\" cy=\"6\" rx=\"7.5\" ry=\"3\" />\n <path d=\"M4.5 6v6c0 1.66 3.36 3 7.5 3s7.5-1.34 7.5-3V6\" />\n <path d=\"M4.5 12v6c0 1.66 3.36 3 7.5 3s7.5-1.34 7.5-3v-6\" />\n </svg>\n <span class=\"label\">Query</span>\n <kbd>{{ shortcut }}</kbd>\n @if (tampered()) {\n <span class=\"tamper-dot\" title=\"A query is showing an armed override or a devtools fault\"></span>\n }\n </button>\n `,\n // Shadow DOM is intentional: this always-visible floating button must be fully isolated from the\n // host app's global CSS (resets, Tailwind, button styles), which the rest of the panel can't be.\n // eslint-disable-next-line ethlete/require-view-encapsulation-none\n encapsulation: ViewEncapsulation.ShadowDom,\n styles: `\n :host {\n position: fixed;\n inset-block-end: 16px;\n inset-inline-end: 16px;\n z-index: 2147483001;\n }\n\n button {\n --_accent: var(--et-theme-color-primary-solid, #60a5fa);\n\n position: relative;\n display: inline-flex;\n align-items: center;\n gap: 8px;\n padding: 10px 12px 10px 14px;\n border: none;\n border-radius: 999px;\n background: linear-gradient(135deg, #1f1f23, #2a2a30);\n color: #fafafa;\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n font-size: 13px;\n font-weight: 600;\n letter-spacing: 0.02em;\n cursor: pointer;\n box-shadow:\n 0 6px 20px rgb(0 0 0 / 0.35),\n inset 0 0 0 1px rgb(255 255 255 / 0.08);\n transition:\n transform 0.15s ease,\n box-shadow 0.2s ease;\n }\n\n /* Gradient accent ring via a masked pseudo-element. */\n button::before {\n content: '';\n position: absolute;\n inset: 0;\n border-radius: inherit;\n padding: 1px;\n background: linear-gradient(135deg, var(--_accent), transparent 60%);\n -webkit-mask:\n linear-gradient(#000 0 0) content-box,\n linear-gradient(#000 0 0);\n -webkit-mask-composite: xor;\n mask-composite: exclude;\n opacity: 0.7;\n transition: opacity 0.2s ease;\n }\n\n button:hover {\n transform: translateY(-2px);\n box-shadow:\n 0 10px 28px rgb(0 0 0 / 0.4),\n 0 0 0 4px color-mix(in srgb, var(--_accent) 22%, transparent),\n inset 0 0 0 1px rgb(255 255 255 / 0.1);\n }\n\n button:hover::before {\n opacity: 1;\n }\n\n svg {\n inline-size: 16px;\n block-size: 16px;\n fill: none;\n stroke: var(--_accent);\n stroke-width: 1.6;\n stroke-linecap: round;\n stroke-linejoin: round;\n }\n\n .label {\n line-height: 1;\n }\n\n kbd {\n padding: 3px 6px;\n border-radius: 5px;\n background: rgb(255 255 255 / 0.07);\n box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12);\n color: #d4d4d8;\n font: inherit;\n font-size: 11px;\n font-weight: 500;\n line-height: 1;\n /* The Apple glyphs need no separator; the \"Ctrl+Alt+Q\" spelling is wider, hence the nowrap. */\n white-space: nowrap;\n }\n\n /* Visible with the panel closed, which is the point - a query being tampered with is a fact about\n the running app, not just about whatever the panel happens to have open. */\n .tamper-dot {\n position: absolute;\n inset-block-start: -3px;\n inset-inline-end: -3px;\n inline-size: 10px;\n block-size: 10px;\n border-radius: 50%;\n background: #f87171;\n box-shadow: 0 0 0 2px #1f1f23;\n }\n `,\n})\nexport class QueryDevtoolsToggleComponent {\n public tampered = input(false);\n public openChange = output<void>();\n\n protected shortcut = queryDevtoolsShortcutLabel();\n}\n","import { queryDevtoolsSettings, readQueryDevtoolsStore } from '@ethlete/query';\n\n/**\n * Where the panel's own view state lives - open/closed, dock, sizes, selection, filters. Bumped\n * whenever a shape change would make an older stored state restore into something wrong.\n * @internal\n */\nexport const QUERY_DEVTOOLS_VIEW_STATE_KEY = 'ethlete:query:devtools:v4';\n\n/**\n * Whether the panel was open when this tab last stored its view state. Read by\n * `<et-query-devtools-lazy>`, which has to load the panel before it can ask the panel anything.\n * @internal\n */\nexport const wasQueryDevtoolsOpen = () =>\n readQueryDevtoolsStore<{ open?: boolean }>(queryDevtoolsSettings().viewState, QUERY_DEVTOOLS_VIEW_STATE_KEY)?.open ===\n true;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAEA;;;;AAIG;MACU,0BAA0B,GAAG,OAAO,iBAAiB,EAAE,KAAK,OAAO,GAAG,KAAK,GAAG,YAAY;;ACJvG;;;;;AAKG;MA6HU,4BAA4B,CAAA;AA5HzC,IAAA,WAAA,GAAA;QA6HS,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,KAAK;qFAAC;QACvB,IAAA,CAAA,UAAU,GAAG,MAAM,EAAQ;QAExB,IAAA,CAAA,QAAQ,GAAG,0BAA0B,EAAE;AAClD,IAAA;8GALY,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAA5B,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,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