@destyler/tour 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.
@@ -155,26 +155,23 @@ function connect(state, send, normalize) {
155
155
  firstStep,
156
156
  lastStep,
157
157
  addStep(step$1) {
158
- const next = steps.concat(step$1);
159
158
  send({
160
159
  type: "STEPS.SET",
161
- value: next,
160
+ value: steps.concat(step$1),
162
161
  src: "addStep"
163
162
  });
164
163
  },
165
164
  removeStep(id) {
166
- const next = steps.filter((step$1) => step$1.id !== id);
167
165
  send({
168
166
  type: "STEPS.SET",
169
- value: next,
167
+ value: steps.filter((step$1) => step$1.id !== id),
170
168
  src: "removeStep"
171
169
  });
172
170
  },
173
171
  updateStep(id, stepOverrides) {
174
- const next = steps.map((step$1) => step$1.id === id ? mergeProps(step$1, stepOverrides) : step$1);
175
172
  send({
176
173
  type: "STEPS.SET",
177
- value: next,
174
+ value: steps.map((step$1) => step$1.id === id ? mergeProps(step$1, stepOverrides) : step$1),
178
175
  src: "updateStep"
179
176
  });
180
177
  },
@@ -214,9 +211,8 @@ function connect(state, send, normalize) {
214
211
  },
215
212
  getProgressText() {
216
213
  const effectiveSteps = steps.filter((step$1) => step$1.type !== "wait");
217
- const index = findStepIndex(effectiveSteps, step?.id);
218
214
  const details = {
219
- current: index,
215
+ current: findStepIndex(effectiveSteps, step?.id),
220
216
  total: effectiveSteps.length
221
217
  };
222
218
  return state.context.translations.progressText?.(details) ?? "";
@@ -665,8 +661,7 @@ function machine(userContext) {
665
661
  },
666
662
  actions: {
667
663
  scrollToTarget(ctx$1, _evt) {
668
- const node = ctx$1.resolvedTarget.value;
669
- node?.scrollIntoView({
664
+ ctx$1.resolvedTarget.value?.scrollIntoView({
670
665
  behavior: "instant",
671
666
  block: "center",
672
667
  inline: "center"
@@ -778,11 +773,9 @@ function machine(userContext) {
778
773
  const win = dom.getWin(ctx$1);
779
774
  const doc = dom.getDoc(ctx$1);
780
775
  const onResize = () => {
781
- const width = visualViewport?.width ?? win.innerWidth;
782
- const height = doc.documentElement.scrollHeight;
783
776
  ctx$1.boundarySize = {
784
- width,
785
- height
777
+ width: visualViewport?.width ?? win.innerWidth,
778
+ height: doc.documentElement.scrollHeight
786
779
  };
787
780
  };
788
781
  onResize();
@@ -822,8 +815,7 @@ function machine(userContext) {
822
815
  },
823
816
  onPointerDownOutside(event) {
824
817
  ctx$1.onPointerDownOutside?.(event);
825
- const isWithin = isEventInRect(ctx$1.targetRect, event.detail.originalEvent);
826
- if (isWithin) {
818
+ if (isEventInRect(ctx$1.targetRect, event.detail.originalEvent)) {
827
819
  event.preventDefault();
828
820
  return;
829
821
  }
@@ -867,8 +859,7 @@ function machine(userContext) {
867
859
  offset: ctx$1.step.offset,
868
860
  getAnchorRect(el) {
869
861
  if (!isHTMLElement(el)) return null;
870
- const rect = el.getBoundingClientRect();
871
- return offset(rect, ctx$1.spotlightOffset);
862
+ return offset(el.getBoundingClientRect(), ctx$1.spotlightOffset);
872
863
  },
873
864
  onComplete(data) {
874
865
  const { rects } = data.middlewareData;
@@ -958,8 +949,7 @@ function waitForElement(target, options) {
958
949
  }
959
950
  function waitForElementValue(target, value, options) {
960
951
  const { timeout, rootNode } = options;
961
- const win = getWindow(rootNode);
962
- const controller = new win.AbortController();
952
+ const controller = new (getWindow(rootNode)).AbortController();
963
953
  return waitForPromise(new Promise((resolve) => {
964
954
  const el = target();
965
955
  if (!el) return;
package/package.json CHANGED
@@ -1,30 +1,39 @@
1
1
  {
2
2
  "name": "@destyler/tour",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "description": "A guided tour that helps users understand the interface.",
6
6
  "author": "Elone Hoo <elonehoo@gmail.com>",
7
7
  "license": "MIT",
8
+ "homepage": "https://github.com/destyler/destyler",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/destyler/destyler.git",
12
+ "directory": "packages/components/tour"
13
+ },
8
14
  "exports": {
9
- ".": "./dist/index.js"
15
+ ".": "./dist/index.mjs"
10
16
  },
11
- "main": "dist/index.js",
12
- "module": "dist/index.js",
13
- "types": "dist/index.d.ts",
17
+ "main": "dist/index.mjs",
18
+ "module": "dist/index.mjs",
19
+ "types": "dist/index.d.mts",
14
20
  "files": [
15
21
  "*.d.ts",
16
22
  "dist"
17
23
  ],
18
24
  "dependencies": {
19
- "@destyler/dismissable": "0.1.0",
20
- "@destyler/dom": "0.1.0",
21
- "@destyler/popper": "0.1.0",
22
- "@destyler/anatomy": "0.1.0",
23
- "@destyler/types": "0.1.0",
24
- "@destyler/utils": "0.1.0",
25
- "@destyler/interact-outside": "0.1.0",
26
- "@destyler/xstate": "0.1.0",
27
- "@destyler/focus-trap": "0.1.0"
25
+ "@destyler/anatomy": "0.2.0",
26
+ "@destyler/dom": "0.2.0",
27
+ "@destyler/dismissable": "0.2.0",
28
+ "@destyler/focus-trap": "0.2.0",
29
+ "@destyler/interact-outside": "0.2.0",
30
+ "@destyler/popper": "0.2.0",
31
+ "@destyler/types": "0.2.0",
32
+ "@destyler/utils": "0.2.0",
33
+ "@destyler/xstate": "0.2.0"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public"
28
37
  },
29
38
  "scripts": {
30
39
  "clear": "rimraf ./dist",
File without changes