impact-nova 3.0.0-alpha.19 → 3.0.0-alpha.20

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.
@@ -1,7 +1,7 @@
1
- import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
2
- import { __require as o } from "../node_modules/style-to-js/cjs/index.js";
3
- var t = o();
4
- const a = /* @__PURE__ */ r(t);
1
+ import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
2
+ import { __require as r } from "../node_modules/extend/index.js";
3
+ var t = r();
4
+ const a = /* @__PURE__ */ e(t);
5
5
  export {
6
6
  a as default
7
7
  };
@@ -1,7 +1,7 @@
1
- import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
2
- import { __require as r } from "../node_modules/extend/index.js";
3
- var t = r();
4
- const a = /* @__PURE__ */ e(t);
1
+ import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
2
+ import { __require as o } from "../node_modules/style-to-js/cjs/index.js";
3
+ var t = o();
4
+ const a = /* @__PURE__ */ r(t);
5
5
  export {
6
6
  a as default
7
7
  };
@@ -1,18 +1,18 @@
1
- import { GuideRegistry as S } from "./guide-registry.js";
2
- import { getStepIndex as u, getNextStepId as c, getStepById as g, resolveLocalizedStepContent as f } from "./step-navigation.js";
3
- import { TriggerPluginRegistry as v } from "../triggers/trigger-registry.js";
1
+ import { GuideRegistry as f } from "./guide-registry.js";
2
+ import { getStepIndex as u, canGoBackFromStep as c, getNextStepId as g, getStepById as h, resolveLocalizedStepContent as v } from "./step-navigation.js";
3
+ import { TriggerPluginRegistry as m } from "../triggers/trigger-registry.js";
4
4
  import { registerBuiltInTriggerPlugins as w } from "../triggers/built-in-triggers.js";
5
- import { TargetResolver as m, resolveTargetSynchronously as I, waitForTargetResolved as y } from "../targets/target-resolver.js";
6
- import { GuidanceTargetRefRegistry as R } from "../targets/ref-registry.js";
7
- import { buildGuidanceStorageKey as r, buildSessionStatsKey as h, createDefaultSessionStats as G } from "../storage/storage-keys.js";
8
- class _ {
5
+ import { TargetResolver as I, resolveTargetSynchronously as y, waitForTargetResolved as R } from "../targets/target-resolver.js";
6
+ import { GuidanceTargetRefRegistry as G } from "../targets/ref-registry.js";
7
+ import { buildGuidanceStorageKey as r, buildSessionStatsKey as l, createDefaultSessionStats as k } from "../storage/storage-keys.js";
8
+ class D {
9
9
  sessionState = { status: "idle" };
10
10
  activationToken = 0;
11
11
  listeners = /* @__PURE__ */ new Set();
12
12
  eventHandlers = /* @__PURE__ */ new Map();
13
- guideRegistry = new S();
14
- triggerRegistry = new v();
15
- targetRefRegistry = new R();
13
+ guideRegistry = new f();
14
+ triggerRegistry = new m();
15
+ targetRefRegistry = new G();
16
16
  targetResolver;
17
17
  guideQueue = [];
18
18
  previewMode = !1;
@@ -27,7 +27,7 @@ class _ {
27
27
  cachedRenderInstruction = null;
28
28
  config;
29
29
  constructor(t) {
30
- this.config = t, this.targetResolver = new m(this.targetRefRegistry), w(this.triggerRegistry), this.consentGranted = !t.consentRequired;
30
+ this.config = t, this.targetResolver = new I(this.targetRefRegistry), w(this.triggerRegistry), this.consentGranted = !t.consentRequired;
31
31
  }
32
32
  get state() {
33
33
  return this.sessionState;
@@ -150,7 +150,7 @@ class _ {
150
150
  if (!s)
151
151
  return;
152
152
  const i = u(s, e);
153
- i <= 0 || s.steps[i - 1]?.advanceOn !== "click-next" || await this.activateGuide(s, i - 1);
153
+ i <= 0 || c(s, i) && await this.activateGuide(s, i - 1);
154
154
  }
155
155
  async goToStep(t) {
156
156
  const e = this.sessionState.guideId;
@@ -170,7 +170,7 @@ class _ {
170
170
  if (!s)
171
171
  return;
172
172
  this.track("step.completed", { guideId: t, stepId: e });
173
- const i = await c(
173
+ const i = await g(
174
174
  s,
175
175
  e,
176
176
  (a) => this.triggerRegistry.evaluateExpression(a, this.buildTriggerContext())
@@ -197,7 +197,7 @@ class _ {
197
197
  if (!t || !e || this.sessionState.status !== "active")
198
198
  return;
199
199
  const s = this.guideRegistry.get(t);
200
- !s || !g(s, e)?.skippable || await this.moveToFollowingStep();
200
+ !s || !h(s, e)?.skippable || await this.moveToFollowingStep();
201
201
  }
202
202
  /**
203
203
  * Leaves a step whose target will not appear, including while the engine is
@@ -215,7 +215,7 @@ class _ {
215
215
  if (!s)
216
216
  return;
217
217
  this.track("step.skipped", { guideId: t, stepId: e });
218
- const i = await c(
218
+ const i = await g(
219
219
  s,
220
220
  e,
221
221
  (a) => this.triggerRegistry.evaluateExpression(a, this.buildTriggerContext())
@@ -235,23 +235,22 @@ class _ {
235
235
  this.cachedRenderInstruction = null;
236
236
  return;
237
237
  }
238
- const t = this.guideRegistry.get(this.sessionState.guideId), e = t ? g(t, this.sessionState.stepId) : void 0;
238
+ const t = this.guideRegistry.get(this.sessionState.guideId), e = t ? h(t, this.sessionState.stepId) : void 0;
239
239
  if (!t || !e) {
240
240
  this.cachedRenderInstruction = null;
241
241
  return;
242
242
  }
243
- const s = this.sessionState.stepIndex > 0 ? t.steps[this.sessionState.stepIndex - 1] : void 0;
244
243
  this.cachedRenderInstruction = {
245
244
  guideId: t.id,
246
245
  stepId: e.id,
247
246
  stepIndex: this.sessionState.stepIndex,
248
247
  totalSteps: t.steps.length,
249
248
  renderer: e.renderer,
250
- content: f(t, e, this.config.locale),
249
+ content: v(t, e, this.config.locale),
251
250
  target: this.sessionState.resolvedTarget ?? null,
252
251
  skippable: e.skippable,
253
252
  advanceOn: e.advanceOn,
254
- canGoBack: s?.advanceOn === "click-next",
253
+ canGoBack: c(t, this.sessionState.stepIndex),
255
254
  placement: e.placement ?? "auto",
256
255
  modalBehavior: e.modalBehavior,
257
256
  interactionFooter: e.interactionFooter
@@ -286,7 +285,7 @@ class _ {
286
285
  }
287
286
  let n = null;
288
287
  if (i.target) {
289
- if (n = I(
288
+ if (n = y(
290
289
  this.targetResolver,
291
290
  i.target
292
291
  ), n?.element || (this.setSession({
@@ -294,7 +293,7 @@ class _ {
294
293
  guideId: t.id,
295
294
  stepIndex: e,
296
295
  stepId: i.id
297
- }), n = await y(
296
+ }), n = await R(
298
297
  this.targetResolver,
299
298
  i.target,
300
299
  i.timeout ?? 5e3,
@@ -394,8 +393,8 @@ class _ {
394
393
  if (a && Date.now() < a || (e.dismissedCounts[t.id] ?? 0) >= 3 && t.persistence.mode === "showOnce")
395
394
  return !1;
396
395
  if (t.persistence.schedule) {
397
- const o = Date.now(), l = Date.parse(t.persistence.schedule.start), p = Date.parse(t.persistence.schedule.end);
398
- if (o < l || o > p)
396
+ const o = Date.now(), p = Date.parse(t.persistence.schedule.start), S = Date.parse(t.persistence.schedule.end);
397
+ if (o < p || o > S)
399
398
  return !1;
400
399
  }
401
400
  return this.triggerRegistry.evaluateAll(
@@ -433,12 +432,12 @@ class _ {
433
432
  await this.start(t);
434
433
  }
435
434
  async loadSessionStats() {
436
- const t = h(this.config.tenantId);
437
- return (await this.config.storage.get([t]))[t] ?? G();
435
+ const t = l(this.config.tenantId);
436
+ return (await this.config.storage.get([t]))[t] ?? k();
438
437
  }
439
438
  async saveSessionStats(t) {
440
439
  await this.config.storage.set({
441
- [h(this.config.tenantId)]: t
440
+ [l(this.config.tenantId)]: t
442
441
  });
443
442
  }
444
443
  async hydrateVisitCounts(t) {
@@ -510,5 +509,5 @@ class _ {
510
509
  }
511
510
  }
512
511
  export {
513
- _ as GuidanceEngine
512
+ D as GuidanceEngine
514
513
  };
@@ -1,5 +1,6 @@
1
1
  import { GuideManifest, Step, TriggerExpression } from '../types/guidance.types';
2
2
  export declare function getStepById(manifest: GuideManifest, stepId: string): Step | undefined;
3
3
  export declare function getStepIndex(manifest: GuideManifest, stepId: string): number;
4
+ export declare function canGoBackFromStep(manifest: GuideManifest, stepIndex: number): boolean;
4
5
  export declare function getNextStepId(manifest: GuideManifest, currentStepId: string, evaluateCondition: (expression: TriggerExpression) => Promise<boolean>): Promise<string | null>;
5
6
  export declare function resolveLocalizedStepContent(manifest: GuideManifest, step: Step, locale: string): Step['content'];
@@ -4,13 +4,19 @@ function a(t, e) {
4
4
  function c(t, e) {
5
5
  return t.steps.findIndex((n) => n.id === e);
6
6
  }
7
- function l(t, e, n) {
7
+ function l(t, e) {
8
+ if (e <= 0 || t.steps.length <= 1)
9
+ return !1;
10
+ const n = t.steps[e];
11
+ return n?.showBack === !0 ? !0 : n?.showBack === !1 ? !1 : t.steps[e - 1]?.advanceOn === "click-next";
12
+ }
13
+ function f(t, e, n) {
8
14
  const o = (t.transitions ?? []).filter(
9
15
  (r) => r.from === e
10
16
  );
11
17
  if (!o.length) {
12
- const r = c(t, e), s = t.steps[r + 1];
13
- return Promise.resolve(s?.id ?? null);
18
+ const r = c(t, e), i = t.steps[r + 1];
19
+ return Promise.resolve(i?.id ?? null);
14
20
  }
15
21
  return u(o, n);
16
22
  }
@@ -21,14 +27,15 @@ async function u(t, e) {
21
27
  return null;
22
28
  }
23
29
  function d(t, e, n) {
24
- const i = t.locale[n], o = c(t, e.id);
25
- if (i?.[o])
26
- return i[o];
27
- const r = n.split("-")[0], s = t.locale[r];
28
- return s?.[o] ? s[o] : e.content;
30
+ const s = t.locale[n], o = c(t, e.id);
31
+ if (s?.[o])
32
+ return s[o];
33
+ const r = n.split("-")[0], i = t.locale[r];
34
+ return i?.[o] ? i[o] : e.content;
29
35
  }
30
36
  export {
31
- l as getNextStepId,
37
+ l as canGoBackFromStep,
38
+ f as getNextStepId,
32
39
  a as getStepById,
33
40
  c as getStepIndex,
34
41
  d as resolveLocalizedStepContent
@@ -76,6 +76,11 @@ export interface Step {
76
76
  modalBehavior?: GuidanceModalBehavior;
77
77
  /** Announcement renderer: `keybinding` shows shortcut hint footer instead of Next/Done. */
78
78
  interactionFooter?: GuidanceInteractionFooter;
79
+ /**
80
+ * Overrides Back on this step. Omitted keeps the default (only after a previous
81
+ * `click-next` step). Ignored on the first step and on single-step guides.
82
+ */
83
+ showBack?: boolean;
79
84
  }
80
85
  export interface StepTransition {
81
86
  from: string;
@@ -157,7 +162,10 @@ export interface RenderInstruction {
157
162
  target: ResolvedTarget | null;
158
163
  skippable: boolean;
159
164
  advanceOn: AdvanceCondition;
160
- /** True only when the previous step was an explanation and the page did not change. */
165
+ /**
166
+ * Whether this step shows Back. Default: previous step used `click-next`.
167
+ * `Step.showBack` overrides that. Always false on the first step and single-step guides.
168
+ */
161
169
  canGoBack: boolean;
162
170
  /** Explicit popover placement relative to the target. Defaults to 'auto'. */
163
171
  placement: PopoverPlacement;
@@ -2,7 +2,7 @@ import { stringify as w } from "../../comma-separated-tokens/index.js";
2
2
  import { ok as u } from "../../devlop/lib/default.js";
3
3
  import { svg as m, html as C } from "../../property-information/index.js";
4
4
  import { stringify as N } from "../../space-separated-tokens/index.js";
5
- import S from "../../../_virtual/index.js";
5
+ import S from "../../../_virtual/index2.js";
6
6
  import { whitespace as j } from "../../hast-util-whitespace/lib/index.js";
7
7
  import { name as x } from "../../estree-util-is-identifier-name/lib/index.js";
8
8
  import { VFileMessage as h } from "../../vfile-message/lib/index.js";
@@ -1,5 +1,5 @@
1
1
  import { bail as P } from "../../bail/index.js";
2
- import y from "../../../_virtual/index2.js";
2
+ import y from "../../../_virtual/index.js";
3
3
  import z from "../../is-plain-obj/index.js";
4
4
  import { CallableInstance as C } from "./callable-instance.js";
5
5
  import { trough as A } from "../../trough/lib/index.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impact-nova",
3
- "version": "3.0.0-alpha.19",
3
+ "version": "3.0.0-alpha.20",
4
4
  "description": "Enterprise-grade React design system built with React 19, Vite, Tailwind CSS, and Radix UI. Built-in internationalization (i18n) and comprehensive UI component library for scalable, accessible, and performant applications.",
5
5
  "type": "module",
6
6
  "workspaces": [