@hansenexus/hud 0.1.0 → 0.2.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/README.md +42 -23
- package/dist/index.d.ts +39 -0
- package/dist/index.js +399 -0
- package/package.json +45 -136
- package/chunk-0cj8dkk7.js +0 -127
- package/chunk-1atxwdhw.js +0 -48
- package/chunk-24vrg16w.js +0 -39
- package/chunk-3j9sm249.js +0 -26
- package/chunk-50pq4sg6.js +0 -41
- package/chunk-5gtx3pza.js +0 -9
- package/chunk-6gw4x08j.js +0 -264
- package/chunk-6jt8yg4m.js +0 -117
- package/chunk-71se605m.js +0 -85
- package/chunk-82nm9wcg.js +0 -316
- package/chunk-8tam7r3h.js +0 -68
- package/chunk-babjpqkb.js +0 -52
- package/chunk-c5y856ad.js +0 -98
- package/chunk-ghxh8926.js +0 -172
- package/chunk-hc2g0n35.js +0 -24
- package/chunk-k0vr8dsy.js +0 -179
- package/chunk-k50yfp5d.js +0 -166
- package/chunk-kyeb6qeq.js +0 -95
- package/chunk-msqkkqw7.js +0 -140
- package/chunk-nm82wr8r.js +0 -58
- package/chunk-r06bpmy6.js +0 -79
- package/chunk-t9eh4t0b.js +0 -89
- package/chunk-tf774c4w.js +0 -115
- package/chunk-v086j53b.js +0 -19
- package/chunk-wspz08q7.js +0 -67
- package/chunk-xezxydm3.js +0 -47
- package/chunk-xjn0896g.js +0 -574
- package/chunk-xztw0xyt.js +0 -113
- package/chunk-zzrpd92r.js +0 -172
- package/core/access.d.mts +0 -53
- package/core/access.js +0 -27
- package/core/api-types.d.mts +0 -146
- package/core/api-types.js +0 -9
- package/core/capabilities.d.mts +0 -27
- package/core/capabilities.js +0 -14
- package/core/capture-buffer.d.mts +0 -37
- package/core/capture-buffer.js +0 -9
- package/core/force-state.d.mts +0 -68
- package/core/force-state.js +0 -21
- package/core/mock-cookie.d.mts +0 -30
- package/core/mock-cookie.js +0 -15
- package/core/types.d.mts +0 -59
- package/core/types.js +0 -9
- package/hud-provider.d.mts +0 -38
- package/hud-provider.js +0 -15
- package/hud.d.mts +0 -15
- package/hud.js +0 -18
- package/index.d.mts +0 -94
- package/index.js +0 -170
- package/lazy-panel.d.mts +0 -28
- package/lazy-panel.js +0 -11
- package/panels/cicd-panel.d.mts +0 -9
- package/panels/cicd-panel.js +0 -13
- package/panels/debug-info-panel.d.mts +0 -21
- package/panels/debug-info-panel.js +0 -9
- package/panels/dispatch-panel.d.mts +0 -10
- package/panels/dispatch-panel.js +0 -14
- package/panels/env-info-panel.d.mts +0 -9
- package/panels/env-info-panel.js +0 -12
- package/panels/feature-flags-panel.d.mts +0 -26
- package/panels/feature-flags-panel.js +0 -9
- package/panels/force-state-panel.d.mts +0 -11
- package/panels/force-state-panel.js +0 -113
- package/panels/info-row.d.mts +0 -21
- package/panels/info-row.js +0 -14
- package/panels/mock-seed-panel.d.mts +0 -15
- package/panels/mock-seed-panel.js +0 -14
- package/panels/network-console-panel.d.mts +0 -6
- package/panels/network-console-panel.js +0 -9
- package/panels/role-switcher-panel.d.mts +0 -28
- package/panels/role-switcher-panel.js +0 -9
- package/panels/sessions-panel.d.mts +0 -6
- package/panels/sessions-panel.js +0 -13
- package/panels/tokens-panel.d.mts +0 -38
- package/panels/tokens-panel.js +0 -9
- package/panels/unlock-panel.d.mts +0 -33
- package/panels/unlock-panel.js +0 -14
- package/panels/variants-panel.d.mts +0 -51
- package/panels/variants-panel.js +0 -12
- package/panels/vitals-panel.d.mts +0 -11
- package/panels/vitals-panel.js +0 -15
- package/server/guard.d.mts +0 -42
- package/server/guard.js +0 -12
- package/server/unlock.d.mts +0 -28
- package/server/unlock.js +0 -108
- package/state-boundary.d.mts +0 -25
- package/state-boundary.js +0 -54
package/state-boundary.d.mts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
import { ForcedState } from './core/force-state.mjs';
|
|
4
|
-
|
|
5
|
-
interface StateBoundaryProps {
|
|
6
|
-
/** Stable, page-unique id; the HUD force-state panel lists boundaries by it. */
|
|
7
|
-
id: string;
|
|
8
|
-
/** Renders the boundary; `forced` is the state to show instead of the real one, or null. */
|
|
9
|
-
children: (forced: ForcedState | null) => ReactNode;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Registers a loading/empty/error boundary with the HUD force-state panel and
|
|
13
|
-
* `?__state=`. Wrap the part of a page that branches on a query result:
|
|
14
|
-
*
|
|
15
|
-
* ```tsx
|
|
16
|
-
* <StateBoundary id="blog-post">
|
|
17
|
-
* {(forced) => forced === "loading" || post === undefined ? <Skeleton /> : …}
|
|
18
|
-
* </StateBoundary>
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* In production it renders `children(null)` and nothing else.
|
|
22
|
-
*/
|
|
23
|
-
declare function StateBoundary({ id, children }: StateBoundaryProps): string | number | bigint | boolean | react.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
|
|
24
|
-
|
|
25
|
-
export { StateBoundary, type StateBoundaryProps };
|
package/state-boundary.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getForceStateStore,
|
|
3
|
-
resolveForcedState
|
|
4
|
-
} from "./chunk-c5y856ad.js";
|
|
5
|
-
import"./chunk-5gtx3pza.js";
|
|
6
|
-
|
|
7
|
-
// state-boundary.tsx
|
|
8
|
-
import { createContext, useContext, useEffect, useSyncExternalStore } from "react";
|
|
9
|
-
import { jsx } from "react/jsx-runtime";
|
|
10
|
-
"use client";
|
|
11
|
-
var FORCE_STATE_ENABLED = false;
|
|
12
|
-
function StateBoundary({ id, children }) {
|
|
13
|
-
if (!FORCE_STATE_ENABLED)
|
|
14
|
-
return children(null);
|
|
15
|
-
return /* @__PURE__ */ jsx(DevStateBoundary, {
|
|
16
|
-
id,
|
|
17
|
-
children
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
var ParentBoundary = /* @__PURE__ */ createContext(null);
|
|
21
|
-
var SERVER_SNAPSHOT = { boundaries: [], overrides: {}, param: null };
|
|
22
|
-
function subscribe(listener) {
|
|
23
|
-
const store = getForceStateStore();
|
|
24
|
-
const onPopState = () => store.syncSearch(window.location.search);
|
|
25
|
-
window.addEventListener("popstate", onPopState);
|
|
26
|
-
const unsubscribe = store.subscribe(listener);
|
|
27
|
-
return () => {
|
|
28
|
-
window.removeEventListener("popstate", onPopState);
|
|
29
|
-
unsubscribe();
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
function getSnapshot() {
|
|
33
|
-
return getForceStateStore().getSnapshot();
|
|
34
|
-
}
|
|
35
|
-
function getServerSnapshot() {
|
|
36
|
-
return SERVER_SNAPSHOT;
|
|
37
|
-
}
|
|
38
|
-
function DevStateBoundary({ id, children }) {
|
|
39
|
-
const parentId = useContext(ParentBoundary);
|
|
40
|
-
const snapshot = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
const store = getForceStateStore();
|
|
43
|
-
store.syncSearch(window.location.search);
|
|
44
|
-
return store.register(id, parentId);
|
|
45
|
-
}, [id, parentId]);
|
|
46
|
-
const forced = resolveForcedState(snapshot, { id, parentId });
|
|
47
|
-
return /* @__PURE__ */ jsx(ParentBoundary.Provider, {
|
|
48
|
-
value: id,
|
|
49
|
-
children: children(forced)
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
export {
|
|
53
|
-
StateBoundary
|
|
54
|
-
};
|