@docentjs/dom 0.3.1 → 0.5.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 +18 -1
- package/dist/arrows-Dcnwi9T-.js +25 -0
- package/dist/arrows-Dcnwi9T-.js.map +1 -0
- package/dist/arrows-DdDu3O3y.cjs +42 -0
- package/dist/arrows-DdDu3O3y.cjs.map +1 -0
- package/dist/connector-CzqD6NJY.js +249 -0
- package/dist/connector-CzqD6NJY.js.map +1 -0
- package/dist/connector-D6Al4Deu.cjs +255 -0
- package/dist/connector-D6Al4Deu.cjs.map +1 -0
- package/dist/index.cjs +307 -169
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +57 -10
- package/dist/index.d.ts +57 -10
- package/dist/index.js +305 -170
- package/dist/index.js.map +1 -1
- package/dist/themes.cjs +24 -20
- package/dist/themes.cjs.map +1 -1
- package/dist/themes.d.cts +4 -2
- package/dist/themes.d.ts +4 -2
- package/dist/themes.js +24 -20
- package/dist/themes.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import { Alignment, ControllerOptions, Docent, DocentEnvironment, DocentOptions, Labels, Media, Placement, RenderContext, Renderer, Side, StorageAdapter, Target, TargetSpec, Theme, Tour, TourController, defineTour } from "@docentjs/core";
|
|
1
|
+
import { Alignment, ArrowStyle, ControllerOptions, Docent, DocentEnvironment, DocentOptions, Labels, Media, OverlayOptions, Placement, RenderContext, Renderer, Side, SpotlightOptions, SpotlightShape, StorageAdapter, Target, TargetSpec, Theme, Tour, TourController, defineTour } from "@docentjs/core";
|
|
2
|
+
//#region src/arrows.d.ts
|
|
3
|
+
export declare const CONNECTOR_STYLES: readonly ["line", "dashed", "dotted", "curve", "curve-dashed", "squiggle", "loop", "elbow", "sketch", "pin"];
|
|
4
|
+
type ConnectorStyle = (typeof CONNECTOR_STYLES)[number];
|
|
5
|
+
export declare function isConnector(style: ArrowStyle): style is ConnectorStyle;
|
|
6
|
+
/** Space between target and popover for a style: connectors need room to be seen. */
|
|
7
|
+
export declare function arrowGap(style: ArrowStyle): number;
|
|
8
|
+
//#endregion
|
|
2
9
|
//#region src/content.d.ts
|
|
3
10
|
export declare function isSafeUrl(url: string): boolean;
|
|
4
11
|
export declare function renderBody(doc: Document, body: string, format?: 'text' | 'markdown'): DocumentFragment;
|
|
@@ -34,6 +41,10 @@ type PopoverSlots = Partial<Record<SlotName, SlotRenderer>>;
|
|
|
34
41
|
interface PopoverTemplate {
|
|
35
42
|
theme?: Theme;
|
|
36
43
|
slots?: PopoverSlots;
|
|
44
|
+
/** Arrow style for tours using this template. */
|
|
45
|
+
arrow?: ArrowStyle;
|
|
46
|
+
spotlight?: SpotlightOptions;
|
|
47
|
+
overlay?: OverlayOptions;
|
|
37
48
|
/** Extra CSS injected into the shadow root while this template is active. */
|
|
38
49
|
css?: string;
|
|
39
50
|
}
|
|
@@ -55,11 +66,12 @@ interface DomRendererOptions {
|
|
|
55
66
|
labels?: Labels;
|
|
56
67
|
/** Distance between target and popover, in px. */
|
|
57
68
|
gap?: number;
|
|
58
|
-
/** Spotlight defaults when a tour sets none. */
|
|
59
|
-
spotlight?:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
69
|
+
/** Spotlight defaults when a tour sets none: padding, radius, shape, ring. */
|
|
70
|
+
spotlight?: SpotlightOptions;
|
|
71
|
+
/** Arrow style when a tour sets none. Default `caret`. */
|
|
72
|
+
arrow?: ArrowStyle;
|
|
73
|
+
/** Overlay defaults when a tour sets none: style, color, opacity, blur. */
|
|
74
|
+
overlay?: OverlayOptions;
|
|
63
75
|
/** Base theme tokens. Tours and templates layer on top. */
|
|
64
76
|
theme?: Theme;
|
|
65
77
|
/** Replace regions of the built-in popover. */
|
|
@@ -97,14 +109,42 @@ export declare class DomRenderer implements Renderer {
|
|
|
97
109
|
private previousFocus;
|
|
98
110
|
/** Set once per step after the sheet has scrolled the target clear. */
|
|
99
111
|
private sheetAdjusted;
|
|
112
|
+
private connector;
|
|
113
|
+
/** Loaded on first use: connector styles cost nothing for tours that never use them. */
|
|
114
|
+
private connectorModule;
|
|
115
|
+
private connectorLoading;
|
|
116
|
+
/** Arrow, spotlight and overlay settings for the current step. */
|
|
117
|
+
private look;
|
|
118
|
+
/** Until then the step's own transition runs; scroll updates may animate. */
|
|
119
|
+
private settleUntil;
|
|
120
|
+
/** Play the connector draw-in on its next render. */
|
|
121
|
+
private drawConnector;
|
|
122
|
+
private trackingFrame;
|
|
100
123
|
constructor(options?: DomRendererOptions);
|
|
101
124
|
hasTarget(target: Target): boolean;
|
|
102
125
|
waitForTarget(target: Target, timeoutMs: number, signal: AbortSignal): Promise<boolean>;
|
|
103
126
|
currentRoute(): string;
|
|
104
127
|
show(ctx: RenderContext): void;
|
|
105
128
|
hide(): void;
|
|
106
|
-
/**
|
|
107
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Re-measure and re-position everything. Safe to call often. `tracking`
|
|
131
|
+
* marks updates caused by scroll or resize: once the step's own transition
|
|
132
|
+
* has finished, those follow the target instantly instead of trailing it.
|
|
133
|
+
*/
|
|
134
|
+
update(tracking?: boolean): void;
|
|
135
|
+
/** Draw the connector for connector arrow styles; clear it otherwise. */
|
|
136
|
+
private renderConnector;
|
|
137
|
+
/** Fetch the connector module once, then draw with it. */
|
|
138
|
+
private loadConnector;
|
|
139
|
+
/** Add the connector layer and its styles, beneath any popover. */
|
|
140
|
+
private attachConnector;
|
|
141
|
+
private resolveLook;
|
|
142
|
+
/** Expose the look to the stylesheet as host attributes and variables. */
|
|
143
|
+
private applyLook;
|
|
144
|
+
/** The current transition duration in ms, from the --docent-duration token. */
|
|
145
|
+
private duration;
|
|
146
|
+
/** Disable transitions for this frame so scroll-driven moves stay glued to the target. */
|
|
147
|
+
private markTracking;
|
|
108
148
|
/**
|
|
109
149
|
* The visible area in layout-viewport coordinates. Uses the visual viewport
|
|
110
150
|
* so pinch zoom, the on-screen keyboard and pages that overflow on mobile
|
|
@@ -263,15 +303,22 @@ interface OverlayUpdate {
|
|
|
263
303
|
target: Rect | null;
|
|
264
304
|
padding: number;
|
|
265
305
|
radius: number;
|
|
306
|
+
shape?: SpotlightShape;
|
|
266
307
|
}
|
|
267
308
|
export declare class Overlay {
|
|
268
309
|
readonly el: HTMLDivElement;
|
|
269
310
|
readonly blocker: HTMLDivElement;
|
|
311
|
+
/** Hairline of light around the cutout. */
|
|
312
|
+
readonly ring: HTMLDivElement;
|
|
270
313
|
private lastHole;
|
|
271
314
|
constructor(doc: Document);
|
|
315
|
+
/** Move the ring to a rect; a zero-size rect collapses it (modal steps). */
|
|
316
|
+
private placeRing;
|
|
272
317
|
/** Current hole, padded, in viewport coordinates. */
|
|
273
318
|
get hole(): Rect | null;
|
|
274
|
-
update(viewport: Size, { target, padding, radius }: OverlayUpdate, block: boolean): void;
|
|
319
|
+
update(viewport: Size, { target, padding, radius, shape }: OverlayUpdate, block: boolean): void;
|
|
320
|
+
/** Exposed for the vignette style, which is centred on the cutout. */
|
|
321
|
+
private setCentre;
|
|
275
322
|
}
|
|
276
323
|
//#endregion
|
|
277
324
|
//#region src/popover.d.ts
|
|
@@ -320,5 +367,5 @@ export declare function resolveTarget(target: Target, root?: QueryRoot): Element
|
|
|
320
367
|
*/
|
|
321
368
|
export declare function waitForTarget(target: Target, timeoutMs: number, signal?: AbortSignal, root?: QueryRoot): Promise<Element | null>;
|
|
322
369
|
//#endregion
|
|
323
|
-
export { type CreateDocentOptions, type CreateTourOptions, type DomRendererOptions, type HeadlessPopover, type Occluder, type PopoverSlots, type PopoverTemplate, type PositionInput, type PositionResult, type QueryRoot, type Rect, type Size, type SlotContent, type SlotName, type SlotRenderer, defineTour };
|
|
370
|
+
export { type ConnectorStyle, type CreateDocentOptions, type CreateTourOptions, type DomRendererOptions, type HeadlessPopover, type Occluder, type PopoverSlots, type PopoverTemplate, type PositionInput, type PositionResult, type QueryRoot, type Rect, type Size, type SlotContent, type SlotName, type SlotRenderer, defineTour };
|
|
324
371
|
//# sourceMappingURL=index.d.ts.map
|