@hueest/xray 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/dist/{serialize-Bq6yJnNV.js → breakpoints-CMoFUUOv.js} +426 -104
- package/dist/client.d.ts +38 -3
- package/dist/client.js +716 -27
- package/dist/core.d.ts +8 -3
- package/dist/core.js +12 -6
- package/dist/css-escape-N7bOusGW.js +52 -0
- package/dist/hud.js +46 -0
- package/dist/index.d.ts +231 -5
- package/dist/index.js +753 -71
- package/dist/{plate-DboxMKg-.d.ts → plate-Bv6W-GkA.d.ts} +142 -0
- package/dist/plate-DoE1HEXp.js +152 -0
- package/dist/react.core-BzMG_cDy.d.ts +79 -0
- package/dist/react.core-IyFy2b_8.js +267 -0
- package/dist/react.d.ts +2 -8
- package/dist/react.dev.d.ts +2 -9
- package/dist/react.dev.js +153 -23
- package/dist/react.js +24 -12
- package/dist/serialize-B--oY2bV.d.ts +143 -0
- package/package.json +7 -7
- package/virtual.d.ts +6 -0
- package/dist/breakpoints-CBNlh7lQ.js +0 -47
- package/dist/plate-BuzRMPx4.js +0 -94
- package/dist/react.core-CqnDjfAJ.js +0 -59
- package/dist/react.core-fgWG_svU.d.ts +0 -21
- package/dist/serialize.d.ts +0 -88
- package/dist/serialize.js +0 -2
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { a as ROOT_ATTR, o as ROOT_CLASS, t as BASE_CSS } from "./plate-BuzRMPx4.js";
|
|
2
|
-
import { Fragment } from "react";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
//#region src/react.core.tsx
|
|
5
|
-
/** Layout-neutral wrapper for an HTML island sitting beside React stitch nodes —
|
|
6
|
-
* its children participate in the grandparent's flow, so grid/flex item counts
|
|
7
|
-
* are unchanged. */
|
|
8
|
-
const DISPLAY_CONTENTS = { display: "contents" };
|
|
9
|
-
/**
|
|
10
|
-
* Render a shipped plate's skeleton. `resolveStitch` turns a child plate name
|
|
11
|
-
* into the node that mounts it (static `refs` in prod, a store-subscribed
|
|
12
|
-
* component in dev). `nested` is true for a stitch-mounted child, which skips
|
|
13
|
-
* BASE_CSS — the outermost view already emitted it (ADR 0007). Returns null
|
|
14
|
-
* when the plate has no capture yet; the caller renders the fallback.
|
|
15
|
-
*/
|
|
16
|
-
function renderPlate(plate, resolveStitch, nested) {
|
|
17
|
-
if (!plate.chunks) return null;
|
|
18
|
-
const className = plate.rootCls ? `${ROOT_CLASS} ${plate.rootCls}` : ROOT_CLASS;
|
|
19
|
-
const rootAttrs = {
|
|
20
|
-
[ROOT_ATTR]: plate.name,
|
|
21
|
-
className,
|
|
22
|
-
"aria-hidden": true,
|
|
23
|
-
"aria-busy": true
|
|
24
|
-
};
|
|
25
|
-
const css = nested ? plate.css : `${BASE_CSS}\n${plate.css}`;
|
|
26
|
-
const chunks = plate.chunks;
|
|
27
|
-
if (chunks.length === 1 && typeof chunks[0] === "string") {
|
|
28
|
-
const html = `<style>${css}</style>${chunks[0]}`;
|
|
29
|
-
return /* @__PURE__ */ jsx("div", {
|
|
30
|
-
...rootAttrs,
|
|
31
|
-
dangerouslySetInnerHTML: { __html: html }
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
35
|
-
...rootAttrs,
|
|
36
|
-
children: [/* @__PURE__ */ jsx("style", { children: css }), renderChunks(chunks, resolveStitch)]
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Each `string` chunk is injected as a display:contents innerHTML island; each
|
|
41
|
-
* `{ r }` stitch resolves through `resolveStitch`; a `{ c, k }` node stays a
|
|
42
|
-
* real element and recurses (it holds a stitch deeper). No per-node tree walk —
|
|
43
|
-
* the strings are already serialized.
|
|
44
|
-
*/
|
|
45
|
-
function renderChunks(chunks, resolveStitch) {
|
|
46
|
-
return chunks.map((chunk, i) => {
|
|
47
|
-
if (typeof chunk === "string") return /* @__PURE__ */ jsx("div", {
|
|
48
|
-
style: DISPLAY_CONTENTS,
|
|
49
|
-
dangerouslySetInnerHTML: { __html: chunk }
|
|
50
|
-
}, i);
|
|
51
|
-
if ("r" in chunk) return /* @__PURE__ */ jsx(Fragment, { children: resolveStitch(chunk.r) }, i);
|
|
52
|
-
return /* @__PURE__ */ jsx("div", {
|
|
53
|
-
className: chunk.c,
|
|
54
|
-
children: renderChunks(chunk.k, resolveStitch)
|
|
55
|
-
}, i);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
//#endregion
|
|
59
|
-
export { renderPlate as t };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { r as Plate } from "./plate-DboxMKg-.js";
|
|
2
|
-
import { ReactNode } from "react";
|
|
3
|
-
|
|
4
|
-
//#region src/react.core.d.ts
|
|
5
|
-
/** Props accepted by the React `<Skeleton>` component. */
|
|
6
|
-
interface SkeletonProps {
|
|
7
|
-
/** The plate to render while loading, imported from `virtual:xray/plates/<name>`. */
|
|
8
|
-
plate: Plate;
|
|
9
|
-
/** Explicit readiness mode: render the Skeleton while true, then render children and capture them in dev when false. */
|
|
10
|
-
loading?: boolean;
|
|
11
|
-
/** Suspense mode: make `<Skeleton>` the Suspense boundary and use the Plate as the fallback until children resolve. */
|
|
12
|
-
suspense?: boolean;
|
|
13
|
-
/** Shown while loading when the plate has no capture yet. */
|
|
14
|
-
fallback?: ReactNode;
|
|
15
|
-
/** Override the plugin's settle delay before this site is captured (dev only). */
|
|
16
|
-
delay?: number;
|
|
17
|
-
/** Real content. In dev, these children are also the capture source once ready. */
|
|
18
|
-
children?: ReactNode;
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
21
|
-
export { SkeletonProps as t };
|
package/dist/serialize.d.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { n as MergedPlate, s as ViewCapture, t as LeafKind } from "./plate-DboxMKg-.js";
|
|
2
|
-
|
|
3
|
-
//#region src/serialize.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Browser-side capture: walk a live rendered subtree into a Plate — one node
|
|
6
|
-
* tree plus one self-contained, scoped CSS string (ADR 0003). The CSS is
|
|
7
|
-
* lifted from the author rules that matched each node, rewritten to
|
|
8
|
-
* plate-local selectors — it carries `@media` for free and keeps layout live
|
|
9
|
-
* (the M1 bake-off winner; ADR 0005).
|
|
10
|
-
*/
|
|
11
|
-
interface CaptureOptions {
|
|
12
|
-
/** Plate name; comes from the virtual-module specifier. */
|
|
13
|
-
name: string;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Capture the rendered subtree(s) under a Skeleton into a Plate. `roots` are
|
|
17
|
-
* the component's top-level elements (the children of the layout-neutral
|
|
18
|
-
* wrapper); the synthetic root node (id 0) stands in for the wrapper itself.
|
|
19
|
-
*/
|
|
20
|
-
declare function capture(roots: readonly Element[], options: CaptureOptions): MergedPlate;
|
|
21
|
-
/**
|
|
22
|
-
* Thrown when a subtree has more nodes than the capture limit — almost always
|
|
23
|
-
* a `<Skeleton>` sitting too high in the tree. Raised after the cheap walk and
|
|
24
|
-
* before the O(rules × nodes) CSS extraction, so an oversized capture is
|
|
25
|
-
* refused without freezing the main thread on it.
|
|
26
|
-
*/
|
|
27
|
-
declare class CaptureTooLargeError extends Error {
|
|
28
|
-
readonly nodeCount: number;
|
|
29
|
-
constructor(nodeCount: number);
|
|
30
|
-
}
|
|
31
|
-
interface CaptureRegimeOptions {
|
|
32
|
-
/** Refuse (throw `CaptureTooLargeError`) before CSS extraction if the walk exceeds this. */
|
|
33
|
-
maxNodes?: number;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Capture one view's worth of a component: the tree plus id-form rules,
|
|
37
|
-
* with the viewport width it was taken at. The caller (the dev client)
|
|
38
|
-
* derives the view interval and ships it off; `capture` is the
|
|
39
|
-
* single-view convenience on top.
|
|
40
|
-
*/
|
|
41
|
-
declare function captureRegime(roots: readonly Element[], options?: CaptureRegimeOptions): ViewCapture;
|
|
42
|
-
/** One measurement per walked node, ids matching what `capture` assigns. */
|
|
43
|
-
interface AuditEntry {
|
|
44
|
-
id: number;
|
|
45
|
-
tag: string;
|
|
46
|
-
leaf?: LeafKind;
|
|
47
|
-
w: number;
|
|
48
|
-
h: number;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Walk a live subtree exactly like `capture` does, but return per-node
|
|
52
|
-
* geometry instead of a plate. Rendering the captured plate and auditing both
|
|
53
|
-
* sides gives an id-aligned fidelity diff (used by the M1 bake-off).
|
|
54
|
-
*/
|
|
55
|
-
declare function audit(roots: readonly Element[]): AuditEntry[];
|
|
56
|
-
/**
|
|
57
|
-
* Shrink a text run's measured box to what's actually painted. A `Range`'s
|
|
58
|
-
* rect is the text's full geometry and ignores ancestor clipping, so a
|
|
59
|
-
* `-webkit-line-clamp` box (fewer lines than the text fills) or a single-line
|
|
60
|
-
* `text-overflow: ellipsis` (`white-space: nowrap; overflow: hidden`) makes the
|
|
61
|
-
* bar over-measure — a 2-line title bone rendered at its unclamped 5-line
|
|
62
|
-
* height. Painted text can't exceed any clipping ancestor's content box, so we
|
|
63
|
-
* intersect with each: per axis the ancestor clips (`overflow !== visible`),
|
|
64
|
-
* clamp to its content box. A non-clipping or larger ancestor leaves it be, so
|
|
65
|
-
* unclamped text is untouched. Walks to the root since the clamp may sit a few
|
|
66
|
-
* inline wrappers up from the text node.
|
|
67
|
-
*/
|
|
68
|
-
interface ClippingStyle {
|
|
69
|
-
overflowX: string;
|
|
70
|
-
overflowY: string;
|
|
71
|
-
paddingTop: string;
|
|
72
|
-
paddingBottom: string;
|
|
73
|
-
paddingLeft: string;
|
|
74
|
-
paddingRight: string;
|
|
75
|
-
borderTopWidth: string;
|
|
76
|
-
borderBottomWidth: string;
|
|
77
|
-
borderLeftWidth: string;
|
|
78
|
-
borderRightWidth: string;
|
|
79
|
-
}
|
|
80
|
-
interface ClippingWindow {
|
|
81
|
-
getComputedStyle(element: Element): ClippingStyle;
|
|
82
|
-
}
|
|
83
|
-
declare function clampToClipping(width: number, height: number, fromParent: Element | null, win: ClippingWindow): {
|
|
84
|
-
width: number;
|
|
85
|
-
height: number;
|
|
86
|
-
};
|
|
87
|
-
//#endregion
|
|
88
|
-
export { AuditEntry, CaptureOptions, CaptureRegimeOptions, CaptureTooLargeError, audit, capture, captureRegime, clampToClipping };
|
package/dist/serialize.js
DELETED