@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 CHANGED
@@ -118,6 +118,41 @@ function warnIfInvalid(tour) {
118
118
  }).catch(() => {});
119
119
  }
120
120
  //#endregion
121
+ //#region src/looks.ts
122
+ const BUILT_IN_LOOKS = {
123
+ /** The default: a dimmed page, a soft cutout, a small caret. */
124
+ spotlight: {},
125
+ /**
126
+ * A light touch for tips beside a feature: the page stays usable and
127
+ * clickable, with a glowing ring and a drawn curve instead of a scrim.
128
+ */
129
+ hint: {
130
+ overlay: { style: "none" },
131
+ spotlight: {
132
+ ring: "glow",
133
+ padding: 6
134
+ },
135
+ arrow: "curve",
136
+ theme: { width: 300 }
137
+ },
138
+ /**
139
+ * For something to read rather than something to do: the page blurs away,
140
+ * nothing points anywhere, and the card is wider.
141
+ */
142
+ announcement: {
143
+ overlay: {
144
+ style: "blur",
145
+ blur: 6
146
+ },
147
+ spotlight: {
148
+ ring: "none",
149
+ padding: 10
150
+ },
151
+ arrow: "none",
152
+ theme: { width: 420 }
153
+ }
154
+ };
155
+ //#endregion
121
156
  //#region src/occlusion.ts
122
157
  function isPinned(el) {
123
158
  const view = el.ownerDocument.defaultView;
@@ -1254,9 +1289,11 @@ var DomRenderer = class {
1254
1289
  win.addEventListener("scrollend", finish, { once: true });
1255
1290
  this.cleanups.push(stop);
1256
1291
  }
1292
+ /** The tour's template: one the app registered, or a built-in look. */
1257
1293
  template(ctx) {
1258
1294
  const name = ctx.tour.options?.template ?? this.options.template;
1259
- return name === void 0 ? void 0 : this.options.templates?.[name];
1295
+ if (name === void 0) return void 0;
1296
+ return this.options.templates?.[name] ?? BUILT_IN_LOOKS[name];
1260
1297
  }
1261
1298
  buildDefault(ctx, host, template) {
1262
1299
  const slots = {
@@ -1650,6 +1687,7 @@ function createDocent(options = {}) {
1650
1687
  return docent;
1651
1688
  }
1652
1689
  //#endregion
1690
+ exports.BUILT_IN_LOOKS = BUILT_IN_LOOKS;
1653
1691
  exports.CONNECTOR_STYLES = require_arrows.CONNECTOR_STYLES;
1654
1692
  exports.DEFAULT_LABELS = DEFAULT_LABELS;
1655
1693
  exports.DomRenderer = DomRenderer;