ahdjs 0.0.6

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.
@@ -0,0 +1,279 @@
1
+ export default class GuideChimp {
2
+ /**
3
+ * Default options
4
+ * @return {Object}
5
+ */
6
+ static getDefaultOptions(): Object;
7
+ static getDefaultKeyboardCodes(): {
8
+ previous: number[];
9
+ next: number[];
10
+ stop: number[];
11
+ };
12
+ static getEventListenersPriorities(): string[];
13
+ static getBodyClass(): string;
14
+ static getLoadingClass(): string;
15
+ static getHighlightClass(): string;
16
+ static getFixedClass(): string;
17
+ static getRelativePositionClass(): string;
18
+ /**
19
+ * Get element offset
20
+ * @param el
21
+ * @return {{top: number, left: number, width: number, height: number}}
22
+ */
23
+ static getOffset(el: any): {
24
+ top: number;
25
+ left: number;
26
+ width: number;
27
+ height: number;
28
+ };
29
+ /**
30
+ * Check if el or his parent has fixed position
31
+ * @param el
32
+ * @return {boolean}
33
+ */
34
+ static isFixed(el: any): boolean;
35
+ /**
36
+ * GuideChimp constructor
37
+ * @param tour
38
+ * @param options
39
+ */
40
+ constructor(tour: any, options?: {});
41
+ cache: Map<any, any>;
42
+ listeners: {};
43
+ observers: {};
44
+ options: {};
45
+ tour: any;
46
+ notifications: any[];
47
+ elements: Map<any, any>;
48
+ /**
49
+ * Called after construction, this hook allows you to add some extra setup
50
+ * logic without having to override the constructor.
51
+ */
52
+ init(): void;
53
+ setDefaults(): GuideChimp;
54
+ previousStep: any;
55
+ currentStep: any;
56
+ nextStep: any;
57
+ fromStep: any;
58
+ toStep: any;
59
+ previousStepIndex: number;
60
+ currentStepIndex: number;
61
+ nextStepIndex: number;
62
+ fromStepIndex: number;
63
+ toStepIndex: number;
64
+ steps: any[];
65
+ isDisplayed: boolean;
66
+ /**
67
+ * Set tour name or steps
68
+ * @param tour
69
+ * @return {this}
70
+ */
71
+ setTour(tour: any): this;
72
+ /**
73
+ * Get tour name or steps
74
+ */
75
+ getTour(): any;
76
+ /**
77
+ * Set tour options
78
+ * @param options
79
+ * @return {this}
80
+ */
81
+ setOptions(options: any): this;
82
+ /**
83
+ * Get tour options
84
+ */
85
+ getOptions(): {};
86
+ /**
87
+ * Start tour
88
+ * @param number step number or it index
89
+ * @param useIndex whether to use step number or index
90
+ * @return {Promise<boolean>}
91
+ */
92
+ start(number?: number, useIndex?: boolean, ...args: any[]): Promise<boolean>;
93
+ /**
94
+ * Go to step
95
+ * @param number step number or it index
96
+ * @param useIndex whether to use step number or index
97
+ * @param args
98
+ * @return {Promise<boolean>}
99
+ */
100
+ go(number: any, useIndex?: boolean, ...args: any[]): Promise<boolean>;
101
+ previous(...args: any[]): Promise<boolean>;
102
+ next(...args: any[]): Promise<boolean>;
103
+ stop(...args: any[]): Promise<GuideChimp>;
104
+ getSteps(tour: any): any;
105
+ getDataSteps(tour: any): {
106
+ element: Element;
107
+ step: number;
108
+ title: string;
109
+ description: string;
110
+ position: any;
111
+ interaction: any;
112
+ }[];
113
+ getJsSteps(tour: any): any;
114
+ sortSteps(steps: any): any[];
115
+ getStepEl(step: any): any;
116
+ scrollParentsToStepEl(): GuideChimp;
117
+ getScrollableParentsEls(el: any): any[];
118
+ getScrollableParentEl(el: any): any;
119
+ scrollParentsToEl(el: any, scrollPadding?: number): GuideChimp;
120
+ scrollTo(el: any, behavior?: string, scrollPadding?: number): GuideChimp;
121
+ highlightStepEl(animation?: boolean): GuideChimp;
122
+ resetHighlightStepEl(): GuideChimp;
123
+ setInteractionPosition(interactionEl: any): GuideChimp;
124
+ setControlPosition(controlEl: any): GuideChimp;
125
+ setTooltipPosition(tooltipEl: any, options?: {}): GuideChimp;
126
+ startPreloader(): GuideChimp;
127
+ stopPreloader(): GuideChimp;
128
+ getDefaultTmplData(): {
129
+ previousStep: any;
130
+ currentStep: any;
131
+ nextStep: any;
132
+ fromStep: any;
133
+ toStep: any;
134
+ previousStepIndex: number;
135
+ currentStepIndex: number;
136
+ nextStepIndex: number;
137
+ fromStepIndex: number;
138
+ toStepIndex: number;
139
+ steps: any[];
140
+ go: (...args: any[]) => Promise<boolean>;
141
+ previous: (...args: any[]) => Promise<boolean>;
142
+ next: (...args: any[]) => Promise<boolean>;
143
+ stop: (...args: any[]) => Promise<GuideChimp>;
144
+ };
145
+ mountStep(): GuideChimp;
146
+ unmountStep(): GuideChimp;
147
+ createEl(name: any, tmpl: any, data?: {}): Element;
148
+ getEl(key: any, def?: any): any;
149
+ mountEl(el: any, parent: any): any;
150
+ removeEl(key: any): GuideChimp;
151
+ isEl(el: any, key: any): boolean;
152
+ getFakeStepTmpl(): any;
153
+ createFakeStepEl(data?: {}): Element;
154
+ mountFakeStepEl(data?: {}): any;
155
+ removeFakeStepEl(): GuideChimp;
156
+ getPreloaderTmpl(): any;
157
+ createPreloaderEl(data?: {}): Element;
158
+ mountPreloaderEl(data?: {}): any;
159
+ removePreloaderEl(): GuideChimp;
160
+ getOverlayDocumentPath(): string;
161
+ getOverlayStepPath(step: any): string;
162
+ getOverlayElPath(el: any): string;
163
+ getOverlayTmpl(): any;
164
+ createOverlayEl(data?: {}): Element;
165
+ mountOverlayEl(data?: {}): any;
166
+ removeOverlayEl(): GuideChimp;
167
+ getInteractionTmpl(): any;
168
+ createInteractionEl(data?: {}): Element;
169
+ mountInteractionEl(data?: {}): any;
170
+ removeInteractionEl(): GuideChimp;
171
+ getControlTmpl(): any;
172
+ createControlEl(data?: {}): Element;
173
+ mountControlEl(data?: {}): any;
174
+ removeControlEl(): GuideChimp;
175
+ getTooltipTmpl(): any;
176
+ createTooltipEl(data?: {}): Element;
177
+ getCloseTmpl(): any;
178
+ createCloseEl(data?: {}): Element;
179
+ getProgressbarTmpl(): any;
180
+ createProgressbarEl(data?: {}): Element;
181
+ getTitleTmpl(): any;
182
+ createTitleEl(data?: {}): Element;
183
+ getDescriptionTmpl(): any;
184
+ createDescriptionEl(data?: {}): Element;
185
+ getCustomButtonsTmpl(): any;
186
+ createCustomButtonsEl(data?: {}): Element;
187
+ getPaginationTmpl(): any;
188
+ createPaginationEl(data?: {}): Element;
189
+ getPreviousTmpl(): any;
190
+ createPreviousEl(data?: {}): Element;
191
+ getNextTmpl(): any;
192
+ createNextEl(data?: {}): Element;
193
+ getCopyrightTmpl(): any;
194
+ createCopyrightEl(data?: {}): Element;
195
+ getNotificationTmpl(): any;
196
+ createNotificationEl(data?: {}): Element;
197
+ notify(message: any): GuideChimp;
198
+ /**
199
+ * Register an event listener for a tour event.
200
+ *
201
+ * Event names can be comma-separated to register multiple events.
202
+ *
203
+ * @param {string} event The name of the event to listen for.
204
+ * @param {function} listener The event listener, accepts context.
205
+ * @param {object} options Listener options
206
+ * @return {this}
207
+ */
208
+ on(event: string, listener: Function, options?: object): this;
209
+ /**
210
+ * Emits an event by name to all registered listeners on that event.
211
+ * Listeners will be called in the order that they were added. If a listener
212
+ * returns `false`, no other listeners will be called.
213
+ *
214
+ * @param {string} event The name of the event to emit.
215
+ * @param args The context args of the event, passed to listeners.
216
+ * @returns {Promise}
217
+ */
218
+ emit(event: string, ...args: any[]): Promise<any>;
219
+ /**
220
+ * Add keydown event listener
221
+ * @return {this}
222
+ */
223
+ addOnKeydownListener(): this;
224
+ /**
225
+ * Return on key down event listener function
226
+ * @returns {function}
227
+ */
228
+ getOnKeydownListener(): Function;
229
+ /**
230
+ * Remove keydown event listener
231
+ * @return {this}
232
+ */
233
+ removeOnKeydownListener(): this;
234
+ /**
235
+ * Add window resize event listener
236
+ * @return {this}
237
+ */
238
+ addOnWindowResizeListener(): this;
239
+ /**
240
+ * Return on window resize event listener function
241
+ * @returns {function}
242
+ */
243
+ getOnWindowResizeListener(): Function;
244
+ /**
245
+ * Remove window resize event listener
246
+ * @return {this}
247
+ */
248
+ removeOnWindowResizeListener(): this;
249
+ /**
250
+ * Add window scroll event listener
251
+ * @returns {GuideChimp}
252
+ */
253
+ addOnWindowScrollListener(): GuideChimp;
254
+ /**
255
+ * Return on window scroll event listener function
256
+ * @returns {function}
257
+ */
258
+ getOnWindowScrollListener(): Function;
259
+ /**
260
+ * Remove window resize event listener
261
+ * @return {this}
262
+ */
263
+ removeOnWindowScrollListener(): this;
264
+ removeListeners(): void;
265
+ observeStep(): void;
266
+ observeResizing(options?: {
267
+ box: string;
268
+ }): boolean;
269
+ unobserveResizing(): boolean;
270
+ observeMutation(): boolean;
271
+ unobserveMutation(): boolean;
272
+ unobserveStep(): void;
273
+ beforeChangeStep(): void;
274
+ /**
275
+ * Refresh layers position
276
+ * @returns {this}
277
+ */
278
+ refresh(): this;
279
+ }
@@ -0,0 +1,9 @@
1
+ import "./index.scss";
2
+ declare class ahdjs {
3
+ private guideChimp;
4
+ constructor(...args: any);
5
+ beacons: (...args: any) => void;
6
+ start: (...args: any) => void;
7
+ showInformation: (...args: any) => void;
8
+ }
9
+ export default ahdjs;
@@ -0,0 +1,2 @@
1
+ declare function _exports(cls: Class, factory: Object, ...args: any[]): void;
2
+ export = _exports;
@@ -0,0 +1,84 @@
1
+ export default class Beacons {
2
+ /**
3
+ * Default options
4
+ * @return {Object}
5
+ */
6
+ static getDefaultOptions(): Object;
7
+ static getFixedClass(): string;
8
+ static getBeaconDataPrefix(): string;
9
+ /**
10
+ * Check if el or his parent has fixed position
11
+ * @param el
12
+ * @return {boolean}
13
+ */
14
+ static isFixed(el: any): boolean;
15
+ constructor(beacons: any, options?: {});
16
+ beacons: any[];
17
+ options: {};
18
+ observers: {};
19
+ cache: Map<any, any>;
20
+ elements: Map<any, any>;
21
+ /**
22
+ * Called after construction, this hook allows you to add some extra setup
23
+ * logic without having to override the constructor.
24
+ */
25
+ init(): void;
26
+ /**
27
+ * Set beacons options
28
+ * @param options
29
+ * @return {this}
30
+ */
31
+ setOptions(options: any): this;
32
+ setBeacons(beacons: any): Beacons;
33
+ getBeacons(): any[];
34
+ getBeacon(id: any, def: any): any;
35
+ getDataBeacons(ids: any): any[];
36
+ getJsBeacons(beacons: any): any[];
37
+ getBeaconTpl(): any;
38
+ createBeaconEl(beacon: any): Element;
39
+ getEl(selector: any): any;
40
+ setBeaconPosition(el: any, beaconEl: any, options?: {}): Beacons;
41
+ isCanShowBeacon({ canShow }: {
42
+ canShow: any;
43
+ }): boolean;
44
+ showAll(force?: boolean): Beacons;
45
+ show(id: any, force?: boolean): Beacons;
46
+ hideAll(): Beacons;
47
+ hide(id: any): Beacons;
48
+ removeAll(): Beacons;
49
+ remove(id: any): Beacons;
50
+ refresh(): Beacons;
51
+ /**
52
+ * Add window resize event listener
53
+ * @return {this}
54
+ */
55
+ addOnWindowResizeListener(): this;
56
+ /**
57
+ * Return on window resize event listener function
58
+ * @returns {function}
59
+ */
60
+ getOnWindowResizeListener(): Function;
61
+ /**
62
+ * Remove window resize event listener
63
+ * @return {this}
64
+ */
65
+ removeOnWindowResizeListener(): this;
66
+ /**
67
+ * Observe resize step element
68
+ * @return {this}
69
+ */
70
+ observeResizing(el: any, options?: {
71
+ box: string;
72
+ }): this;
73
+ /**
74
+ * Unobserve resize step element
75
+ * @param el
76
+ * @return {this}
77
+ */
78
+ unobserveResizing(el: any): this;
79
+ /**
80
+ * Unobserve all resize steps elements
81
+ * @return {this}
82
+ */
83
+ unobserveResizeAllElements(): this;
84
+ }
@@ -0,0 +1,2 @@
1
+ declare function _default(Class: any, factory: any): void;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,84 @@
1
+ export default class Information {
2
+ /**
3
+ * Default options
4
+ * @return {Object}
5
+ */
6
+ static getDefaultOptions(): Object;
7
+ static getFixedClass(): string;
8
+ static getInformationDataPrefix(): string;
9
+ /**
10
+ * Check if el or his parent has fixed position
11
+ * @param el
12
+ * @return {boolean}
13
+ */
14
+ static isFixed(el: any): boolean;
15
+ constructor(informations: any, options?: {});
16
+ informations: any[];
17
+ options: {};
18
+ observers: {};
19
+ cache: Map<any, any>;
20
+ elements: Map<any, any>;
21
+ /**
22
+ * Called after construction, this hook allows you to add some extra setup
23
+ * logic without having to override the constructor.
24
+ */
25
+ init(): void;
26
+ /**
27
+ * Set informations options
28
+ * @param options
29
+ * @return {this}
30
+ */
31
+ setOptions(options: any): this;
32
+ setInformations(informations: any): Information;
33
+ getInformations(): any[];
34
+ getInformation(id: any, def: any): any;
35
+ getDataInformations(ids: any): any[];
36
+ getJsInformations(informations: any): any[];
37
+ getInformationTpl(): any;
38
+ createInformationEl(information: any): Element;
39
+ getEl(selector: any): any;
40
+ setInformationPosition(el: any, informationEl: any, options?: {}): Information;
41
+ isCanShowInformation({ canShow }: {
42
+ canShow: any;
43
+ }): boolean;
44
+ showAll(force?: boolean): Information;
45
+ show(id: any, force?: boolean): Information;
46
+ hideAll(): Information;
47
+ hide(id: any): Information;
48
+ removeAll(): Information;
49
+ remove(id: any): Information;
50
+ refresh(): Information;
51
+ /**
52
+ * Add window resize event listener
53
+ * @return {this}
54
+ */
55
+ addOnWindowResizeListener(): this;
56
+ /**
57
+ * Return on window resize event listener function
58
+ * @returns {function}
59
+ */
60
+ getOnWindowResizeListener(): Function;
61
+ /**
62
+ * Remove window resize event listener
63
+ * @return {this}
64
+ */
65
+ removeOnWindowResizeListener(): this;
66
+ /**
67
+ * Observe resize step element
68
+ * @return {this}
69
+ */
70
+ observeResizing(el: any, options?: {
71
+ box: string;
72
+ }): this;
73
+ /**
74
+ * Unobserve resize step element
75
+ * @param el
76
+ * @return {this}
77
+ */
78
+ unobserveResizing(el: any): this;
79
+ /**
80
+ * Unobserve all resize steps elements
81
+ * @return {this}
82
+ */
83
+ unobserveResizeAllElements(): this;
84
+ }
@@ -0,0 +1,2 @@
1
+ declare function _default(Class: any, factory: any): void;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare function _exports(cls: Class, factory: Object, options: Object): void;
2
+ export = _exports;
@@ -0,0 +1,2 @@
1
+ declare function _exports(cls: any, factory: any, router: any, debug?: boolean): void;
2
+ export = _exports;
@@ -0,0 +1,2 @@
1
+ declare function _default(tpl: any, data?: {}): Element;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare function _default(el: any): boolean;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare function _default(el: any): boolean;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare function _default(el: any): boolean;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,94 @@
1
+ {
2
+ "name": "ahdjs",
3
+ "version": "0.0.6",
4
+ "description": "",
5
+ "main": "build/index.js",
6
+ "types": "build/types/index.d.ts",
7
+ "scripts": {
8
+ "start": "webpack serve --config webpack.config.demo.js",
9
+ "build": "webpack && tsc",
10
+ "build:demo": "webpack --config webpack.config.demo.js",
11
+ "testx": "jest --silent",
12
+ "test": "echo \"no test\"",
13
+ "coverage": "npm run test -- --coverage",
14
+ "prepare": "npm run build",
15
+ "trypublish": "npm publish || true",
16
+ "storybook": "start-storybook -p 6006",
17
+ "build-storybook": "build-storybook -o docs-build"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": ""
22
+ },
23
+ "author": "Ishaan Puniani <ishaan.puniani@gamil.com> (https://github.com/ishaan-puniani)",
24
+ "license": "MIT",
25
+ "bugs": {
26
+ "url": "/issues"
27
+ },
28
+ "homepage": "",
29
+ "keywords": [
30
+ "library",
31
+ "starter",
32
+ "es6"
33
+ ],
34
+ "devDependencies": {
35
+ "@babel/cli": "^7.19.3",
36
+ "@babel/core": "^7.19.6",
37
+ "@babel/plugin-proposal-class-properties": "^7.18.6",
38
+ "@babel/plugin-transform-typescript": "^7.19.3",
39
+ "@babel/polyfill": "^7.12.1",
40
+ "@babel/preset-env": "^7.19.4",
41
+ "@storybook/addon-actions": "^6.5.12",
42
+ "@storybook/addon-essentials": "^6.5.12",
43
+ "@storybook/addon-interactions": "^6.5.12",
44
+ "@storybook/addon-links": "^6.5.12",
45
+ "@storybook/builder-webpack5": "^6.5.12",
46
+ "@storybook/html": "^6.5.12",
47
+ "@storybook/manager-webpack5": "^6.5.12",
48
+ "@storybook/testing-library": "^0.0.13",
49
+ "@storybook/preset-scss": "^1.0.3",
50
+ "@types/jest": "^29.2.0",
51
+ "@typescript-eslint/eslint-plugin": "^5.40.1",
52
+ "@typescript-eslint/parser": "^5.40.1",
53
+ "babel-eslint": "^10.1.0",
54
+ "babel-loader": "^8.2.5",
55
+ "babel-preset-minify": "^0.5.2",
56
+ "css-loader": "^6.7.1",
57
+ "css-minimizer-webpack-plugin": "^4.2.2",
58
+ "eslint": "^8.26.0",
59
+ "eslint-plugin-storybook": "^0.6.6",
60
+ "file-loader": "^6.2.0",
61
+ "html-loader": "^4.2.0",
62
+ "html-webpack-plugin": "^5.5.0",
63
+ "jest": "^29.2.1",
64
+ "mini-css-extract-plugin": "^2.6.1",
65
+ "sass": "^1.55.0",
66
+ "sass-loader": "^13.1.0",
67
+ "style-loader": "^3.3.1",
68
+ "terser-webpack-plugin": "^5.3.6",
69
+ "typescript": "^4.8.4",
70
+ "url-loader": "^4.1.1",
71
+ "webpack": "^5.74.0",
72
+ "webpack-cli": "^4.10.0",
73
+ "webpack-dev-server": "4.11.1"
74
+ },
75
+ "jest": {
76
+ "moduleNameMapper": {
77
+ "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/scripts/testMock.js",
78
+ "\\.(css|less)$": "<rootDir>/scripts/testMock.js"
79
+ },
80
+ "moduleFileExtensions": [
81
+ "web.js",
82
+ "js",
83
+ "web.ts",
84
+ "ts",
85
+ "web.tsx",
86
+ "tsx",
87
+ "json",
88
+ "web.jsx",
89
+ "jsx",
90
+ "node"
91
+ ]
92
+ },
93
+ "dependencies": {}
94
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "noImplicitAny": true,
4
+ "outDir": "build/types",
5
+ "module": "esnext",
6
+ "target": "es5",
7
+ "allowJs": true,
8
+ "sourceMap": true,
9
+ "declaration": true,
10
+ "emitDeclarationOnly": true,
11
+ "suppressImplicitAnyIndexErrors": true,
12
+ "lib": ["es2018", "dom"],
13
+ "moduleResolution": "node",
14
+ "skipLibCheck": true
15
+ },
16
+ "include": ["src/lib"],
17
+ "exclude": ["src/lib/**/tests","node_modules"],
18
+ }
@@ -0,0 +1,75 @@
1
+ const MiniCssExtractPlugin = require("mini-css-extract-plugin");
2
+ const HtmlWebpackPlugin = require("html-webpack-plugin");
3
+
4
+ module.exports = [
5
+ {
6
+ mode: "development",
7
+ devtool: "cheap-module-source-map",
8
+ entry: "./src/demo/index.ts",
9
+ output: {
10
+ filename: "index.js",
11
+ },
12
+ optimization: {
13
+ minimize: false,
14
+ },
15
+ devServer: {
16
+ open: true,
17
+ hot: true,
18
+ host: "localhost",
19
+ port: 9000,
20
+ },
21
+ module: {
22
+ rules: [
23
+ {
24
+ test: /\.html$/i,
25
+ loader: "html-loader",
26
+ options: {
27
+ minimize: {
28
+ caseSensitive: true,
29
+ collapseWhitespace: true,
30
+ conservativeCollapse: true,
31
+ keepClosingSlash: true,
32
+ minifyCSS: false,
33
+ minifyJS: true,
34
+ removeComments: true,
35
+ removeRedundantAttributes: true,
36
+ removeScriptTypeAttributes: true,
37
+ removeStyleLinkTypeAttributes: true,
38
+ },
39
+ },
40
+ },
41
+ {
42
+ test: /\.(m|j|t)s$/,
43
+ exclude: /(node_modules|bower_components)/,
44
+ use: {
45
+ loader: "babel-loader",
46
+ },
47
+ },
48
+ {
49
+ test: /\.(sa|sc|c)ss$/,
50
+ use: [
51
+ {
52
+ loader: MiniCssExtractPlugin.loader,
53
+ },
54
+ {
55
+ loader: "css-loader",
56
+ options: {
57
+ sourceMap: true,
58
+ },
59
+ },
60
+ "sass-loader",
61
+ ],
62
+ },
63
+ ],
64
+ },
65
+ plugins: [
66
+ new MiniCssExtractPlugin({
67
+ filename: "css/index.css",
68
+ }),
69
+ new HtmlWebpackPlugin(),
70
+ ],
71
+ resolve: {
72
+ extensions: [".ts", ".js", ".json"],
73
+ },
74
+ },
75
+ ];