@docentjs/dom 0.6.0 → 0.7.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/index.cjs +39 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +39 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -190,6 +190,7 @@ export declare class DomRenderer implements Renderer {
|
|
|
190
190
|
* `scrollend` finishes early where supported; a cap keeps it bounded.
|
|
191
191
|
*/
|
|
192
192
|
private afterScroll;
|
|
193
|
+
/** The tour's template: one the app registered, or a built-in look. */
|
|
193
194
|
private template;
|
|
194
195
|
private buildDefault;
|
|
195
196
|
private buildHeadless;
|
|
@@ -251,6 +252,10 @@ export declare function createDocent(options?: CreateDocentOptions): Docent;
|
|
|
251
252
|
//#region src/environment.d.ts
|
|
252
253
|
export declare function createDomEnvironment(doc?: Document): DocentEnvironment;
|
|
253
254
|
//#endregion
|
|
255
|
+
//#region src/looks.d.ts
|
|
256
|
+
type LookName = 'spotlight' | 'hint' | 'announcement';
|
|
257
|
+
export declare const BUILT_IN_LOOKS: Record<LookName, PopoverTemplate>;
|
|
258
|
+
//#endregion
|
|
254
259
|
//#region src/position.d.ts
|
|
255
260
|
interface Rect {
|
|
256
261
|
x: number;
|
|
@@ -396,5 +401,5 @@ export declare function resolveTarget(target: Target, root?: QueryRoot): Element
|
|
|
396
401
|
*/
|
|
397
402
|
export declare function waitForTarget(target: Target, timeoutMs: number, signal?: AbortSignal, root?: QueryRoot): Promise<Element | null>;
|
|
398
403
|
//#endregion
|
|
399
|
-
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 };
|
|
404
|
+
export { type ConnectorStyle, type CreateDocentOptions, type CreateTourOptions, type DomRendererOptions, type HeadlessPopover, type LookName, type Occluder, type PopoverSlots, type PopoverTemplate, type PositionInput, type PositionResult, type QueryRoot, type Rect, type Size, type SlotContent, type SlotName, type SlotRenderer, defineTour };
|
|
400
405
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -190,6 +190,7 @@ export declare class DomRenderer implements Renderer {
|
|
|
190
190
|
* `scrollend` finishes early where supported; a cap keeps it bounded.
|
|
191
191
|
*/
|
|
192
192
|
private afterScroll;
|
|
193
|
+
/** The tour's template: one the app registered, or a built-in look. */
|
|
193
194
|
private template;
|
|
194
195
|
private buildDefault;
|
|
195
196
|
private buildHeadless;
|
|
@@ -251,6 +252,10 @@ export declare function createDocent(options?: CreateDocentOptions): Docent;
|
|
|
251
252
|
//#region src/environment.d.ts
|
|
252
253
|
export declare function createDomEnvironment(doc?: Document): DocentEnvironment;
|
|
253
254
|
//#endregion
|
|
255
|
+
//#region src/looks.d.ts
|
|
256
|
+
type LookName = 'spotlight' | 'hint' | 'announcement';
|
|
257
|
+
export declare const BUILT_IN_LOOKS: Record<LookName, PopoverTemplate>;
|
|
258
|
+
//#endregion
|
|
254
259
|
//#region src/position.d.ts
|
|
255
260
|
interface Rect {
|
|
256
261
|
x: number;
|
|
@@ -396,5 +401,5 @@ export declare function resolveTarget(target: Target, root?: QueryRoot): Element
|
|
|
396
401
|
*/
|
|
397
402
|
export declare function waitForTarget(target: Target, timeoutMs: number, signal?: AbortSignal, root?: QueryRoot): Promise<Element | null>;
|
|
398
403
|
//#endregion
|
|
399
|
-
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 };
|
|
404
|
+
export { type ConnectorStyle, type CreateDocentOptions, type CreateTourOptions, type DomRendererOptions, type HeadlessPopover, type LookName, type Occluder, type PopoverSlots, type PopoverTemplate, type PositionInput, type PositionResult, type QueryRoot, type Rect, type Size, type SlotContent, type SlotName, type SlotRenderer, defineTour };
|
|
400
405
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -117,6 +117,41 @@ function warnIfInvalid(tour) {
|
|
|
117
117
|
}).catch(() => {});
|
|
118
118
|
}
|
|
119
119
|
//#endregion
|
|
120
|
+
//#region src/looks.ts
|
|
121
|
+
const BUILT_IN_LOOKS = {
|
|
122
|
+
/** The default: a dimmed page, a soft cutout, a small caret. */
|
|
123
|
+
spotlight: {},
|
|
124
|
+
/**
|
|
125
|
+
* A light touch for tips beside a feature: the page stays usable and
|
|
126
|
+
* clickable, with a glowing ring and a drawn curve instead of a scrim.
|
|
127
|
+
*/
|
|
128
|
+
hint: {
|
|
129
|
+
overlay: { style: "none" },
|
|
130
|
+
spotlight: {
|
|
131
|
+
ring: "glow",
|
|
132
|
+
padding: 6
|
|
133
|
+
},
|
|
134
|
+
arrow: "curve",
|
|
135
|
+
theme: { width: 300 }
|
|
136
|
+
},
|
|
137
|
+
/**
|
|
138
|
+
* For something to read rather than something to do: the page blurs away,
|
|
139
|
+
* nothing points anywhere, and the card is wider.
|
|
140
|
+
*/
|
|
141
|
+
announcement: {
|
|
142
|
+
overlay: {
|
|
143
|
+
style: "blur",
|
|
144
|
+
blur: 6
|
|
145
|
+
},
|
|
146
|
+
spotlight: {
|
|
147
|
+
ring: "none",
|
|
148
|
+
padding: 10
|
|
149
|
+
},
|
|
150
|
+
arrow: "none",
|
|
151
|
+
theme: { width: 420 }
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
//#endregion
|
|
120
155
|
//#region src/occlusion.ts
|
|
121
156
|
function isPinned(el) {
|
|
122
157
|
const view = el.ownerDocument.defaultView;
|
|
@@ -1253,9 +1288,11 @@ var DomRenderer = class {
|
|
|
1253
1288
|
win.addEventListener("scrollend", finish, { once: true });
|
|
1254
1289
|
this.cleanups.push(stop);
|
|
1255
1290
|
}
|
|
1291
|
+
/** The tour's template: one the app registered, or a built-in look. */
|
|
1256
1292
|
template(ctx) {
|
|
1257
1293
|
const name = ctx.tour.options?.template ?? this.options.template;
|
|
1258
|
-
|
|
1294
|
+
if (name === void 0) return void 0;
|
|
1295
|
+
return this.options.templates?.[name] ?? BUILT_IN_LOOKS[name];
|
|
1259
1296
|
}
|
|
1260
1297
|
buildDefault(ctx, host, template) {
|
|
1261
1298
|
const slots = {
|
|
@@ -1649,6 +1686,6 @@ function createDocent(options = {}) {
|
|
|
1649
1686
|
return docent;
|
|
1650
1687
|
}
|
|
1651
1688
|
//#endregion
|
|
1652
|
-
export { CONNECTOR_STYLES, DEFAULT_LABELS, DomRenderer, DomTourController, NAME_ATTRIBUTE, Overlay, THEME_VARS, applyTheme, arrowGap, availableSpace, buildHeadlessShell, buildPopover, candidateSelectors, centerPosition, computePosition, createDocent, createDomEnvironment, createLocalStorage, createTour, defineTour, findOccluder, formatProgress, holePath, inflate, isConnector, isSafeUrl, mergeThemeSpecs, mergeThemes, parsePlacement, queryAllDeep, renderBody, renderMedia, resolveSlots, resolveTarget, themeOption, toSpec, uncover, waitForTarget };
|
|
1689
|
+
export { BUILT_IN_LOOKS, CONNECTOR_STYLES, DEFAULT_LABELS, DomRenderer, DomTourController, NAME_ATTRIBUTE, Overlay, THEME_VARS, applyTheme, arrowGap, availableSpace, buildHeadlessShell, buildPopover, candidateSelectors, centerPosition, computePosition, createDocent, createDomEnvironment, createLocalStorage, createTour, defineTour, findOccluder, formatProgress, holePath, inflate, isConnector, isSafeUrl, mergeThemeSpecs, mergeThemes, parsePlacement, queryAllDeep, renderBody, renderMedia, resolveSlots, resolveTarget, themeOption, toSpec, uncover, waitForTarget };
|
|
1653
1690
|
|
|
1654
1691
|
//# sourceMappingURL=index.js.map
|