@walkrstudio/core 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.
package/README.md ADDED
@@ -0,0 +1,169 @@
1
+ # 🚶 Walkr Core
2
+
3
+ **Code-first product demo tool**
4
+
5
+ `@walkr/core` is the TypeScript API for describing cursor-driven walkthroughs.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pnpm add @walkr/core
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```ts
16
+ import { walkr, moveTo, click, type, highlight, sequence } from "@walkr/core";
17
+
18
+ export default walkr({
19
+ url: "https://example.com",
20
+ title: "Sign up flow",
21
+ steps: [
22
+ moveTo(640, 400, { duration: 800 }),
23
+ click(640, 400),
24
+ type("hello@example.com", { selector: "input[name=email]" }),
25
+ highlight(".submit-btn", { spotlight: true, color: "#22d3ee", duration: 1200 }),
26
+ sequence(
27
+ moveTo(800, 500),
28
+ click(800, 500),
29
+ ),
30
+ ],
31
+ });
32
+ ```
33
+
34
+ ## Step API
35
+
36
+ | Function | Signature | Description | Duration behavior |
37
+ | --- | --- | --- | --- |
38
+ | `moveTo` | `moveTo(x, y, options?)` | Move cursor to screen coordinates. | `options.duration ?? 0` |
39
+ | `click` | `click(x, y, options?)` | Click at coordinates. Supports button/double-click. | `0` |
40
+ | `type` | `type(text, options?)` | Type text, optionally into a selector. | `text.length * (options.delay ?? 0)` |
41
+ | `scroll` | `scroll(x, y, options?)` | Scroll viewport to coordinates. | `0` |
42
+ | `wait` | `wait(ms)` | Pause timeline. | `ms` |
43
+ | `highlight` | `highlight(selector, options?)` | Highlight a target selector. | `options.duration ?? 0` |
44
+ | `zoom` | `zoom(level, options?)` | Zoom viewport/camera. | `360` |
45
+ | `pan` | `pan(x, y, options?)` | Pan viewport/camera. | `options.duration ?? 360` |
46
+ | `sequence` | `sequence(...steps)` | Run child steps one after another. | Sum of child durations |
47
+ | `parallel` | `parallel(...steps)` | Run child steps at same time. | Max child duration |
48
+
49
+ ## Options By Step
50
+
51
+ ### `moveTo(x, y, options?)`
52
+
53
+ | Option | Type | Default | Notes |
54
+ | --- | --- | --- | --- |
55
+ | `duration` | `number` | `0` | Movement duration in ms. |
56
+ | `easing` | `string` | `undefined` | CSS easing string. |
57
+ | `follow` | `boolean` | `undefined` | Keep following moving target if supported by runtime. |
58
+ | `cursor` | `Partial<CursorConfig>` | `undefined` | Per-step cursor override. |
59
+
60
+ ### `click(x, y, options?)`
61
+
62
+ | Option | Type | Default | Notes |
63
+ | --- | --- | --- | --- |
64
+ | `button` | `"left" \| "right" \| "middle"` | `"left"` | Mouse button. |
65
+ | `double` | `boolean` | `false` | Double-click if `true`. |
66
+ | `cursor` | `Partial<CursorConfig>` | `undefined` | Per-step cursor override. |
67
+
68
+ ### `type(text, options?)`
69
+
70
+ | Option | Type | Default | Notes |
71
+ | --- | --- | --- | --- |
72
+ | `delay` | `number` | `undefined` | Per-character delay in ms. |
73
+ | `selector` | `string` | `undefined` | Target selector for runtime typing. |
74
+ | `cursor` | `Partial<CursorConfig>` | `undefined` | Per-step cursor override. |
75
+
76
+ ### `scroll(x, y, options?)`
77
+
78
+ | Option | Type | Default | Notes |
79
+ | --- | --- | --- | --- |
80
+ | `smooth` | `boolean` | `undefined` | Smooth scrolling hint for runtime. |
81
+ | `cursor` | `Partial<CursorConfig>` | `undefined` | Per-step cursor override. |
82
+
83
+ ### `wait(ms)`
84
+
85
+ `wait` only accepts the required `ms: number` value.
86
+
87
+ ### `highlight(selector, options?)`
88
+
89
+ | Option | Type | Default | Notes |
90
+ | --- | --- | --- | --- |
91
+ | `color` | `string` | `undefined` | Highlight color. |
92
+ | `duration` | `number` | `undefined` | Highlight duration in ms. |
93
+ | `spotlight` | `boolean` | `undefined` | Enable spotlight effect. |
94
+ | `backdropOpacity` | `number` | `undefined` | Backdrop dim amount. |
95
+ | `borderRadius` | `number` | `undefined` | Radius of highlight frame. |
96
+ | `padding` | `number` | `undefined` | Padding around target. |
97
+ | `cursor` | `Partial<CursorConfig>` | `undefined` | Per-step cursor override. |
98
+
99
+ ### `zoom(level, options?)`
100
+
101
+ | Option | Type | Default | Notes |
102
+ | --- | --- | --- | --- |
103
+ | `x` | `number` | `undefined` | Zoom anchor X. |
104
+ | `y` | `number` | `undefined` | Zoom anchor Y. |
105
+ | `easing` | `string` | `"cubic-bezier(0.42, 0, 0.58, 1)"` | Transition easing. |
106
+ | `follow` | `boolean` | `undefined` | Follow target during zoom if runtime supports it. |
107
+ | `cursor` | `Partial<CursorConfig>` | `undefined` | Per-step cursor override. |
108
+
109
+ ### `pan(x, y, options?)`
110
+
111
+ | Option | Type | Default | Notes |
112
+ | --- | --- | --- | --- |
113
+ | `duration` | `number` | `360` | Pan duration in ms. |
114
+ | `easing` | `string` | `"cubic-bezier(0.42, 0, 0.58, 1)"` | Transition easing. |
115
+ | `cursor` | `Partial<CursorConfig>` | `undefined` | Per-step cursor override. |
116
+
117
+ ### `sequence(...steps)`
118
+
119
+ | Option | Type | Default | Notes |
120
+ | --- | --- | --- | --- |
121
+ | `steps` | `Step[]` | required | Child steps run in order. |
122
+
123
+ ### `parallel(...steps)`
124
+
125
+ | Option | Type | Default | Notes |
126
+ | --- | --- | --- | --- |
127
+ | `steps` | `Step[]` | required | Child steps run concurrently. |
128
+
129
+ ## `CursorConfig`
130
+
131
+ ```ts
132
+ interface CursorConfig {
133
+ shape?: "circle" | "arrow" | "dot" | "svg";
134
+ color?: string;
135
+ size?: number;
136
+ shadow?: boolean;
137
+ clickColor?: string;
138
+ svgContent?: string;
139
+ }
140
+ ```
141
+
142
+ | Field | Type | Description |
143
+ | --- | --- | --- |
144
+ | `shape` | `"circle" \| "arrow" \| "dot" \| "svg"` | Cursor style. |
145
+ | `color` | `string` | Base cursor color. |
146
+ | `size` | `number` | Cursor size in px. |
147
+ | `shadow` | `boolean` | Enables drop shadow. |
148
+ | `clickColor` | `string` | Click flash color. |
149
+ | `svgContent` | `string` | Raw SVG markup when `shape: "svg"`. |
150
+
151
+ ## Walkthrough Options
152
+
153
+ `walkr(options)` accepts:
154
+
155
+ | Option | Type | Required | Description |
156
+ | --- | --- | --- | --- |
157
+ | `url` | `string` | yes | Target URL to load. |
158
+ | `steps` | `Step[]` | yes | Timeline step list. |
159
+ | `title` | `string` | no | Human-readable demo title. |
160
+ | `description` | `string` | no | Optional demo description. |
161
+ | `zoom` | `ZoomDefaults` | no | Global zoom defaults. |
162
+ | `cursor` | `CursorConfig` | no | Global cursor config. |
163
+
164
+ `ZoomDefaults`:
165
+
166
+ | Field | Type | Description |
167
+ | --- | --- | --- |
168
+ | `defaultLevel` | `number` | Default zoom level. |
169
+ | `easing` | `string` | Default zoom easing. |
@@ -0,0 +1,4 @@
1
+ import type { ParallelStep, SequenceStep, Step } from "./types.js";
2
+ export declare function sequence(...steps: Step[]): SequenceStep;
3
+ export declare function parallel(...steps: Step[]): ParallelStep;
4
+ //# sourceMappingURL=composers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composers.d.ts","sourceRoot":"","sources":["../src/composers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EAEZ,YAAY,EAEZ,IAAI,EACL,MAAM,YAAY,CAAC;AAEpB,wBAAgB,QAAQ,CAAC,GAAG,KAAK,EAAE,IAAI,EAAE,GAAG,YAAY,CAIvD;AAED,wBAAgB,QAAQ,CAAC,GAAG,KAAK,EAAE,IAAI,EAAE,GAAG,YAAY,CAIvD"}
@@ -0,0 +1,12 @@
1
+ import { createStep } from "./steps.js";
2
+ export function sequence(...steps) {
3
+ const stepOptions = { steps: [...steps] };
4
+ const duration = steps.reduce((total, step) => total + step.duration, 0);
5
+ return createStep("sequence", stepOptions, duration);
6
+ }
7
+ export function parallel(...steps) {
8
+ const stepOptions = { steps: [...steps] };
9
+ const duration = steps.reduce((maxDuration, step) => Math.max(maxDuration, step.duration), 0);
10
+ return createStep("parallel", stepOptions, duration);
11
+ }
12
+ //# sourceMappingURL=composers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composers.js","sourceRoot":"","sources":["../src/composers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AASxC,MAAM,UAAU,QAAQ,CAAC,GAAG,KAAa;IACvC,MAAM,WAAW,GAAwB,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC;IAC/D,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IACzE,OAAO,UAAU,CAAC,UAAU,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,GAAG,KAAa;IACvC,MAAM,WAAW,GAAwB,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC;IAC/D,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9F,OAAO,UAAU,CAAC,UAAU,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;AACvD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Walkthrough, WalkthroughOptions } from "./types.js";
2
+ export declare const VERSION = "0.1.0";
3
+ export declare function walkr(options: WalkthroughOptions): Walkthrough;
4
+ export * from "./composers.js";
5
+ export * from "./steps.js";
6
+ export type { CursorConfig } from "./types.js";
7
+ export * from "./types.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAElE,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B,wBAAgB,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,CAW9D;AAED,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,cAAc,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ export const VERSION = "0.1.0";
2
+ export function walkr(options) {
3
+ const { url, steps, title, description, zoom, cursor, viewport } = options;
4
+ return {
5
+ url,
6
+ steps: [...steps],
7
+ title,
8
+ description,
9
+ zoom,
10
+ cursor,
11
+ viewport,
12
+ };
13
+ }
14
+ export * from "./composers.js";
15
+ export * from "./steps.js";
16
+ export * from "./types.js";
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,MAAM,UAAU,KAAK,CAAC,OAA2B;IAC/C,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAC3E,OAAO;QACL,GAAG;QACH,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC;QACjB,KAAK;QACL,WAAW;QACX,IAAI;QACJ,MAAM;QACN,QAAQ;KACT,CAAC;AACJ,CAAC;AAED,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAE3B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { ClearCacheStep, ClickCoordsStep, ClickOptions, ClickStep, HighlightOptions, HighlightStep, MoveToCoordsStep, MoveToOptions, MoveToStep, PanOptions, PanStep, PanStepOptions, ScrollOptions, ScrollStep, Step, StepType, TypeOptions, TypeStep, WaitStep, ZoomOptions, ZoomStep, ZoomStepOptions } from "./types.js";
2
+ export declare function createStep<TType extends StepType, TOptions extends {}>(type: TType, options: TOptions, duration?: number): Step<TType, TOptions>;
3
+ export declare function moveTo(selector: string, options?: MoveToOptions): MoveToStep;
4
+ export declare function moveToCoords(x: number, y: number, options?: MoveToOptions): MoveToCoordsStep;
5
+ export declare function click(selector: string, options?: ClickOptions): ClickStep;
6
+ export declare function clickCoords(x: number, y: number, options?: ClickOptions): ClickCoordsStep;
7
+ export declare function type(text: string, options?: TypeOptions): TypeStep;
8
+ export declare function scroll(x: number, y: number, options?: ScrollOptions): ScrollStep;
9
+ export declare function wait(ms: number): WaitStep;
10
+ export declare function highlight(selector: string, options?: HighlightOptions): HighlightStep;
11
+ export declare function zoom(level: number, options?: ZoomOptions): ZoomStep;
12
+ export declare function pan(x: number, y: number, options?: PanOptions): PanStep;
13
+ export declare function clearCache(): ClearCacheStep;
14
+ export type { PanStepOptions, ZoomStepOptions };
15
+ //# sourceMappingURL=steps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../src/steps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAEd,eAAe,EAEf,YAAY,EACZ,SAAS,EAET,gBAAgB,EAChB,aAAa,EAEb,gBAAgB,EAEhB,aAAa,EACb,UAAU,EAEV,UAAU,EACV,OAAO,EACP,cAAc,EACd,aAAa,EACb,UAAU,EAEV,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,QAAQ,EAER,QAAQ,EAER,WAAW,EACX,QAAQ,EACR,eAAe,EAChB,MAAM,YAAY,CAAC;AASpB,wBAAgB,UAAU,CACxB,KAAK,SAAS,QAAQ,EAEtB,QAAQ,SAAS,EAAE,EACnB,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,SAAI,GAAG,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAQrE;AAED,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAA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.58, 1)";
7
+ export function createStep(type, options, duration = 0) {
8
+ stepCounter += 1;
9
+ return {
10
+ id: `${type}_${stepCounter}`,
11
+ type,
12
+ options,
13
+ duration,
14
+ };
15
+ }
16
+ export function moveTo(selector, options = {}) {
17
+ const stepOptions = { selector, ...options };
18
+ return createStep("moveTo", stepOptions, options.duration ?? 0);
19
+ }
20
+ export function moveToCoords(x, y, options = {}) {
21
+ const stepOptions = { x, y, ...options };
22
+ return createStep("moveToCoords", stepOptions, options.duration ?? 0);
23
+ }
24
+ export function click(selector, options = {}) {
25
+ const stepOptions = {
26
+ selector,
27
+ button: options.button ?? "left",
28
+ double: options.double ?? false,
29
+ };
30
+ return createStep("click", stepOptions, DEFAULT_CLICK_DURATION);
31
+ }
32
+ export function clickCoords(x, y, options = {}) {
33
+ const stepOptions = {
34
+ x,
35
+ y,
36
+ button: options.button ?? "left",
37
+ double: options.double ?? false,
38
+ };
39
+ return createStep("clickCoords", stepOptions, DEFAULT_CLICK_DURATION);
40
+ }
41
+ export function type(text, options = {}) {
42
+ const stepOptions = { text, ...options };
43
+ const duration = text.length * (options.delay ?? 0);
44
+ return createStep("type", stepOptions, duration);
45
+ }
46
+ export function scroll(x, y, options = {}) {
47
+ const stepOptions = { x, y, ...options };
48
+ return createStep("scroll", stepOptions, 0);
49
+ }
50
+ export function wait(ms) {
51
+ const stepOptions = { ms };
52
+ return createStep("wait", stepOptions, ms);
53
+ }
54
+ export function highlight(selector, options = {}) {
55
+ const stepOptions = {
56
+ selector,
57
+ color: options.color,
58
+ duration: options.duration,
59
+ spotlight: options.spotlight,
60
+ backdropOpacity: options.backdropOpacity,
61
+ borderRadius: options.borderRadius,
62
+ padding: options.padding,
63
+ cursor: options.cursor,
64
+ };
65
+ return createStep("highlight", stepOptions, options.duration ?? 0);
66
+ }
67
+ export function zoom(level, options = {}) {
68
+ const stepOptions = {
69
+ level,
70
+ easing: options.easing ?? DEFAULT_EASING,
71
+ ...options,
72
+ };
73
+ return createStep("zoom", stepOptions, DEFAULT_ZOOM_DURATION);
74
+ }
75
+ export function pan(x, y, options = {}) {
76
+ const stepOptions = {
77
+ x,
78
+ y,
79
+ duration: options.duration ?? DEFAULT_PAN_DURATION,
80
+ easing: options.easing ?? DEFAULT_EASING,
81
+ ...options,
82
+ };
83
+ return createStep("pan", stepOptions, stepOptions.duration ?? DEFAULT_PAN_DURATION);
84
+ }
85
+ export function clearCache() {
86
+ const stepOptions = {};
87
+ return createStep("clearCache", stepOptions, DEFAULT_CLEAR_CACHE_DURATION);
88
+ }
89
+ //# sourceMappingURL=steps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steps.js","sourceRoot":"","sources":["../src/steps.ts"],"names":[],"mappings":"AAkCA,IAAI,WAAW,GAAG,CAAC,CAAC;AACpB,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACjC,MAAM,4BAA4B,GAAG,EAAE,CAAC;AACxC,MAAM,cAAc,GAAG,gCAAgC,CAAC;AAExD,MAAM,UAAU,UAAU,CAIxB,IAAW,EAAE,OAAiB,EAAE,QAAQ,GAAG,CAAC;IAC5C,WAAW,IAAI,CAAC,CAAC;IACjB,OAAO;QACL,EAAE,EAAE,GAAG,IAAI,IAAI,WAAW,EAAE;QAC5B,IAAI;QACJ,OAAO;QACP,QAAQ;KACT,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,QAAgB,EAAE,UAAyB,EAAE;IAClE,MAAM,WAAW,GAAsB,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAC;IAChE,OAAO,UAAU,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,CAAS,EAAE,CAAS,EAAE,UAAyB,EAAE;IAC5E,MAAM,WAAW,GAA4B,EAAE,CAAC,EAAE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C;AACtF,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,MAAM,WAAW,GAA0B,EAAE,CAAC;IAC9C,OAAO,UAAU,CAAC,YAAY,EAAE,WAAW,EAAE,4BAA4B,CAAC,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,139 @@
1
+ export interface Viewport {
2
+ width: number;
3
+ height: number;
4
+ }
5
+ export type MouseButton = "left" | "right" | "middle";
6
+ export type StepType = "moveTo" | "moveToCoords" | "click" | "clickCoords" | "type" | "scroll" | "wait" | "highlight" | "zoom" | "pan" | "sequence" | "parallel" | "clearCache";
7
+ export interface CursorConfig {
8
+ shape?: "circle" | "arrow" | "dot" | "svg";
9
+ color?: string;
10
+ size?: number;
11
+ shadow?: boolean;
12
+ clickColor?: string;
13
+ svgContent?: string;
14
+ /** Hotspot offset as a fraction of cursor size (0–1). Default: center {x:0.5,y:0.5}. */
15
+ offset?: {
16
+ x: number;
17
+ y: number;
18
+ };
19
+ }
20
+ export interface ZoomDefaults {
21
+ defaultLevel?: number;
22
+ easing?: string;
23
+ }
24
+ export interface StepCursorOverride {
25
+ cursor?: Partial<CursorConfig>;
26
+ }
27
+ export interface MoveToOptions extends StepCursorOverride {
28
+ duration?: number;
29
+ easing?: string;
30
+ follow?: boolean;
31
+ }
32
+ export interface MoveToStepOptions extends MoveToOptions {
33
+ selector: string;
34
+ }
35
+ export interface MoveToCoordsStepOptions extends MoveToOptions {
36
+ x: number;
37
+ y: number;
38
+ }
39
+ export interface ClickOptions extends StepCursorOverride {
40
+ button?: MouseButton;
41
+ double?: boolean;
42
+ }
43
+ export interface ClickStepOptions extends ClickOptions {
44
+ selector: string;
45
+ }
46
+ export interface ClickCoordsStepOptions extends ClickOptions {
47
+ x: number;
48
+ y: number;
49
+ }
50
+ export interface TypeOptions extends StepCursorOverride {
51
+ delay?: number;
52
+ selector?: string;
53
+ }
54
+ export interface TypeStepOptions extends TypeOptions {
55
+ text: string;
56
+ }
57
+ export interface ScrollOptions extends StepCursorOverride {
58
+ smooth?: boolean;
59
+ }
60
+ export interface ScrollStepOptions extends ScrollOptions {
61
+ x: number;
62
+ y: number;
63
+ }
64
+ export interface WaitStepOptions extends StepCursorOverride {
65
+ ms: number;
66
+ }
67
+ export interface HighlightOptions extends StepCursorOverride {
68
+ color?: string;
69
+ duration?: number;
70
+ spotlight?: boolean;
71
+ backdropOpacity?: number;
72
+ borderRadius?: number;
73
+ padding?: number;
74
+ }
75
+ export interface HighlightStepOptions extends HighlightOptions {
76
+ selector: string;
77
+ }
78
+ export interface ZoomOptions extends StepCursorOverride {
79
+ x?: number;
80
+ y?: number;
81
+ easing?: string;
82
+ follow?: boolean;
83
+ }
84
+ export interface ZoomStepOptions extends ZoomOptions {
85
+ level: number;
86
+ }
87
+ export interface PanOptions extends StepCursorOverride {
88
+ duration?: number;
89
+ easing?: string;
90
+ }
91
+ export interface PanStepOptions extends PanOptions {
92
+ x: number;
93
+ y: number;
94
+ }
95
+ export interface SequenceStepOptions extends StepCursorOverride {
96
+ steps: Step[];
97
+ }
98
+ export interface ParallelStepOptions extends StepCursorOverride {
99
+ steps: Step[];
100
+ }
101
+ export type ClearCacheStepOptions = {};
102
+ export interface Step<TType extends StepType = StepType, TOptions extends {} = {}> {
103
+ id: string;
104
+ type: TType;
105
+ options: TOptions;
106
+ duration: number;
107
+ }
108
+ export type MoveToStep = Step<"moveTo", MoveToStepOptions>;
109
+ export type MoveToCoordsStep = Step<"moveToCoords", MoveToCoordsStepOptions>;
110
+ export type ClickStep = Step<"click", ClickStepOptions>;
111
+ export type ClickCoordsStep = Step<"clickCoords", ClickCoordsStepOptions>;
112
+ export type TypeStep = Step<"type", TypeStepOptions>;
113
+ export type ScrollStep = Step<"scroll", ScrollStepOptions>;
114
+ export type WaitStep = Step<"wait", WaitStepOptions>;
115
+ export type HighlightStep = Step<"highlight", HighlightStepOptions>;
116
+ export type ZoomStep = Step<"zoom", ZoomStepOptions>;
117
+ export type PanStep = Step<"pan", PanStepOptions>;
118
+ export type SequenceStep = Step<"sequence", SequenceStepOptions>;
119
+ export type ParallelStep = Step<"parallel", ParallelStepOptions>;
120
+ export type ClearCacheStep = Step<"clearCache", ClearCacheStepOptions>;
121
+ export interface Walkthrough {
122
+ url: string;
123
+ steps: Step[];
124
+ title?: string;
125
+ description?: string;
126
+ zoom?: ZoomDefaults;
127
+ cursor?: CursorConfig;
128
+ viewport?: Viewport;
129
+ }
130
+ export interface WalkthroughOptions {
131
+ url: string;
132
+ steps: Step[];
133
+ title?: string;
134
+ description?: string;
135
+ zoom?: ZoomDefaults;
136
+ cursor?: CursorConfig;
137
+ viewport?: Viewport;
138
+ }
139
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEtD,MAAM,MAAM,QAAQ,GAChB,QAAQ,GACR,cAAc,GACd,OAAO,GACP,aAAa,GACb,MAAM,GACN,QAAQ,GACR,MAAM,GACN,WAAW,GACX,MAAM,GACN,KAAK,GACL,UAAU,GACV,UAAU,GACV,YAAY,CAAC;AAEjB,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wFAAwF;IACxF,MAAM,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACnC;AAED,MAA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AM,CAAC,EAAE,YAAY,CAAC;IACtB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@walkrstudio/core",
3
+ "version": "0.2.0",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "scripts": {
20
+ "build": "tsc -p tsconfig.json",
21
+ "lint": "biome check src",
22
+ "type-check": "tsc -p tsconfig.json --noEmit",
23
+ "dev": "tsc -p tsconfig.json --watch"
24
+ }
25
+ }