image-exporter 0.0.1 → 1.0.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.
Files changed (56) hide show
  1. package/README.md +137 -2
  2. package/bun.lockb +0 -0
  3. package/dist/image-exporter.es.js +499 -612
  4. package/dist/image-exporter.umd.js +506 -619
  5. package/package.json +18 -15
  6. package/src/capture/capture-element.ts +58 -0
  7. package/src/capture/determine-total-elements.ts +40 -0
  8. package/src/capture/download-images.ts +69 -0
  9. package/src/capture/get-image-options.ts +196 -0
  10. package/src/capture/handle-filenames.ts +52 -0
  11. package/src/capture/index.ts +99 -0
  12. package/src/capture/remove-hidden-elements.ts +19 -0
  13. package/src/config.ts +19 -0
  14. package/src/cors-proxy/cleanup.ts +43 -0
  15. package/src/cors-proxy/index.ts +6 -21
  16. package/src/{utils → cors-proxy}/is-valid-url.ts +5 -3
  17. package/src/cors-proxy/proxy-css.ts +51 -44
  18. package/src/cors-proxy/proxy-images.ts +21 -77
  19. package/src/cors-proxy/run.ts +26 -0
  20. package/src/index.ts +10 -4
  21. package/src/logger.ts +61 -0
  22. package/src/types.d.ts +51 -0
  23. package/vite.config.js +3 -7
  24. package/example/example.css +0 -122
  25. package/example/example.html +0 -152
  26. package/example/github.jpg +0 -0
  27. package/example/poll-h.svg +0 -1
  28. package/src/capture-images.ts +0 -129
  29. package/src/clean-up.ts +0 -50
  30. package/src/default-options.ts +0 -58
  31. package/src/download-images.ts +0 -52
  32. package/src/get-capture-element.test.html +0 -21
  33. package/src/get-capture-element.test.ts +0 -36
  34. package/src/get-capture-element.ts +0 -175
  35. package/src/get-options/get-input-options.test.html +0 -217
  36. package/src/get-options/get-input-options.test.ts +0 -109
  37. package/src/get-options/get-input-options.ts +0 -40
  38. package/src/get-options/get-item-options.ts +0 -46
  39. package/src/get-options/get-wrapper-options.test.html +0 -33
  40. package/src/get-options/get-wrapper-options.test.ts +0 -109
  41. package/src/get-options/get-wrapper-options.ts +0 -84
  42. package/src/get-options/index.ts +0 -28
  43. package/src/image-exporter.ts +0 -108
  44. package/src/types/image.ts +0 -2
  45. package/src/types/index.ts +0 -2
  46. package/src/types/options.ts +0 -69
  47. package/src/utils/convert-to-slug.ts +0 -15
  48. package/src/utils/get-attribute-values.ts +0 -68
  49. package/src/utils/get-date-MMDDYY.ts +0 -11
  50. package/src/utils/ignore-items.ts +0 -11
  51. package/src/utils/index.ts +0 -18
  52. package/src/utils/is-visible.ts +0 -12
  53. package/src/utils/parse-labels.ts +0 -55
  54. package/src/utils/push-to-window.ts +0 -3
  55. package/tests/index.html +0 -88
  56. package/tests/input-tests.html +0 -169
@@ -1,217 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Tests</title>
7
- </head>
8
- <body>
9
- <section>
10
- <div>
11
- <!-- Scale -->
12
- <label for="scale"><strong>Scale</strong></label>
13
- <select title="scale" ie-scale-input>
14
- <option value="5">@1x</option>
15
- </select>
16
- </div>
17
- <div>
18
- <!-- Quality -->
19
- <label for="quality"><strong>Quality</strong></label>
20
- <input
21
- type="range"
22
- id="quality"
23
- name="quality"
24
- min="0.00"
25
- max="1.00"
26
- value="0.75"
27
- step="0.01"
28
- ie-quality-input
29
- />
30
- </div>
31
- <div>
32
- <!-- Format -->
33
- <label for="format"><strong>Format</strong></label>
34
- <select title="format" ie-format-input>
35
- <option value="jpg">JPG</option>
36
- </select>
37
- </div>
38
- <div>
39
- <fieldset>
40
- <legend><strong>Image label</strong></legend>
41
- <!-- dateInLabel -->
42
- <label for="dateInLabel">
43
- <input
44
- type="checkbox"
45
- id="dateInLabel"
46
- name="dateInLabel"
47
- name="dateInLabel"
48
- role="switch"
49
- checked="checked"
50
- ie-img-label-date-input
51
- />
52
- Date in label
53
- </label>
54
- <!--scaleInLabel-->
55
- <label for="scaleInLabel">
56
- <input
57
- type="checkbox"
58
- id="scaleInLabel"
59
- name="scaleInLabel"
60
- name="scaleInLabel"
61
- role="switch"
62
- checked="checked"
63
- ie-img-label-scale-input
64
- />
65
- Scale in label
66
- </label>
67
- </fieldset>
68
- </div>
69
- <fieldset>
70
- <legend><strong>Zip label</strong></legend>
71
- <!-- zipLabel -->
72
- <label for="zipLabel">Label</label>
73
- <input type="text" id="zipLabel" name="zipLabel" ie-zip-label-input value="ie" />
74
- <!-- zipDateInLabel -->
75
- <label for="zipDateInLabel">
76
- <input
77
- type="checkbox"
78
- id="zipDateInLabel"
79
- name="zipDateInLabel"
80
- name="zipDateInLabel"
81
- role="switch"
82
- checked="checked"
83
- ie-zip-label-date-input
84
- />
85
- Date in label
86
- </label>
87
- <!--zipScaleInLabel-->
88
- <label for="zipScaleInLabel">
89
- <input
90
- type="checkbox"
91
- id="zipScaleInLabel"
92
- name="zipScaleInLabel"
93
- name="zipScaleInLabel"
94
- role="switch"
95
- checked="checked"
96
- ie-zip-label-scale-input
97
- />
98
- Scale in label
99
- </label>
100
- </fieldset>
101
-
102
- <button ie-trigger>Run</button>
103
- </section>
104
- <section>
105
- <div>
106
- <!-- Scale -->
107
- <label for="test-scale"><strong>Scale</strong></label>
108
- <select title="test-scale" test-scale-input>
109
- <option value="5">@1x</option>
110
- </select>
111
- </div>
112
- <div>
113
- <!-- Quality -->
114
- <label for="quality"><strong>Quality</strong></label>
115
- <input
116
- type="range"
117
- id="quality"
118
- name="quality"
119
- min="0.00"
120
- max="1.00"
121
- value="0.75"
122
- step="0.01"
123
- test-quality-input
124
- />
125
- </div>
126
- <div>
127
- <!-- Format -->
128
- <label for="format"><strong>Format</strong></label>
129
- <select title="format" test-format-input>
130
- <option value="jpg">JPG</option>
131
- </select>
132
- </div>
133
- <div>
134
- <fieldset>
135
- <legend><strong>Image label</strong></legend>
136
- <!-- dateInLabel -->
137
- <label for="dateInLabel">
138
- <input
139
- type="checkbox"
140
- id="dateInLabel"
141
- name="dateInLabel"
142
- name="dateInLabel"
143
- role="switch"
144
- checked="checked"
145
- test-img-label-date-input
146
- />
147
- Date in label
148
- </label>
149
- <!--scaleInLabel-->
150
- <label for="scaleInLabel">
151
- <input
152
- type="checkbox"
153
- id="scaleInLabel"
154
- name="scaleInLabel"
155
- name="scaleInLabel"
156
- role="switch"
157
- checked="checked"
158
- test-img-label-scale-input
159
- />
160
- Scale in label
161
- </label>
162
- </fieldset>
163
- </div>
164
- <fieldset>
165
- <legend><strong>Zip label</strong></legend>
166
- <!-- zipLabel -->
167
- <label for="zipLabel">Label</label>
168
- <input
169
- type="text"
170
- id="zipLabel"
171
- name="zipLabel"
172
- test-zip-label-input
173
- value="ie"
174
- />
175
- <!-- zipDateInLabel -->
176
- <label for="zipDateInLabel">
177
- <input
178
- type="checkbox"
179
- id="zipDateInLabel"
180
- name="zipDateInLabel"
181
- name="zipDateInLabel"
182
- role="switch"
183
- checked="checked"
184
- test-zip-label-date-input
185
- />
186
- Date in label
187
- </label>
188
- <!--zipScaleInLabel-->
189
- <label for="zipScaleInLabel">
190
- <input
191
- type="checkbox"
192
- id="zipScaleInLabel"
193
- name="zipScaleInLabel"
194
- name="zipScaleInLabel"
195
- role="switch"
196
- checked="checked"
197
- test-zip-label-scale-input
198
- />
199
- Scale in label
200
- </label>
201
- </fieldset>
202
- </section>
203
- <div
204
- ie="wrapper"
205
- ie-scale="2"
206
- ie-quality="0.55"
207
- ie-format="png"
208
- ie-img-label-date="false"
209
- ie-img-label-scale="false"
210
- ie-zip-label="yay"
211
- ie-zip-label-date="false"
212
- ie-zip-label-scale="false"
213
- ></div>
214
- <div test="wrapper"></div>
215
- <script src="../../dist/image-exporter.umd.js"></script>
216
- </body>
217
- </html>
@@ -1,109 +0,0 @@
1
- import { describe, it, expect, beforeAll, afterAll } from "vitest";
2
- import puppeteer from "puppeteer";
3
- import path from "path";
4
- import * as types from "../types";
5
- import { defaultOptions } from "../default-options";
6
-
7
- describe("get-input-options", () => {
8
- let browser;
9
- let page;
10
-
11
- beforeAll(async () => {
12
- // Setup for puppeteer with Vitest
13
- browser = await puppeteer.launch();
14
- page = await browser.newPage();
15
- await page.goto(`file://${path.join(__dirname, "get-input-options.test.html")}`);
16
- });
17
-
18
- afterAll(async () => {
19
- // Teardown for puppeteer with Vitest
20
- await browser.close();
21
- });
22
-
23
- it("standard attributes", async () => {
24
- const result = await page.evaluate(() => {
25
- const js = `const options = { downloadImages: false, debug: true };
26
- const imageExporter = new ImageExporter(options);
27
- const images = imageExporter.captureAll();`;
28
- //insert at the end of the body
29
- const script = document.createElement("script");
30
- script.text = js;
31
- document.body.appendChild(script);
32
-
33
- return (window as any).getInputOptionsDebug;
34
- });
35
-
36
- // Assertions can then be made based on the result object
37
- expect(result.image.scale.value).toBe(5);
38
- expect(result.image.quality.value).toBe(0.75);
39
- expect(result.image.format.value).toBe("jpg");
40
- expect(result.image.dateInLabel.value).toBe(true);
41
- expect(result.image.scaleInLabel.value).toBe(true);
42
- expect(result.zip.label.value).toBe("ie");
43
- expect(result.zip.dateInLabel.value).toBe(true);
44
- expect(result.zip.scaleInLabel.value).toBe(true);
45
- });
46
-
47
- it("custom attributes", async () => {
48
- await page.reload();
49
- const result = await page.evaluate(() => {
50
- const js = `const options = {
51
- downloadImages: false,
52
- selectors: {
53
- wrapper: "[test='wrapper']",
54
- capture: "[test='capture']",
55
- trigger: "[test='trigger']",
56
- slug: "[test='slug']",
57
- ignore: "[test='ignore']",
58
- },
59
- image: {
60
- scale: {
61
- inputSelector: "test-scale-input",
62
- },
63
- quality: {
64
- inputSelector: "test-quality-input",
65
- },
66
- format: {
67
- inputSelector: "test-format-input",
68
- },
69
- dateInLabel: {
70
- inputSelector: "test-img-label-date-input",
71
- },
72
- scaleInLabel: {
73
- inputSelector: "test-img-label-scale-input",
74
- },
75
- },
76
- zip: {
77
- label: {
78
- inputSelector: "test-zip-label-input",
79
- },
80
- dateInLabel: {
81
- inputSelector: "test-zip-label-date-input",
82
- },
83
- scaleInLabel: {
84
- inputSelector: "test-zip-label-scale-input",
85
- },
86
- },
87
- debug: true,
88
- };
89
- const imageExporter = new ImageExporter(options);
90
- const images = imageExporter.captureAll();`;
91
- //insert at the end of the body
92
- const script = document.createElement("script");
93
- script.text = js;
94
- document.body.appendChild(script);
95
-
96
- return (window as any).getInputOptionsDebug;
97
- });
98
-
99
- // Assertions can then be made based on the result object
100
- expect(result.image.scale.value).toBe(5);
101
- expect(result.image.quality.value).toBe(0.75);
102
- expect(result.image.format.value).toBe("jpg");
103
- expect(result.image.dateInLabel.value).toBe(true);
104
- expect(result.image.scaleInLabel.value).toBe(true);
105
- expect(result.zip.label.value).toBe("ie");
106
- expect(result.zip.dateInLabel.value).toBe(true);
107
- expect(result.zip.scaleInLabel.value).toBe(true);
108
- });
109
- });
@@ -1,40 +0,0 @@
1
- import * as types from "../types";
2
- import { pushToWindow } from "../utils/push-to-window";
3
- import { optionSafetyCheck } from "./get-wrapper-options";
4
-
5
- // Helper function to handle common logic
6
- async function handleOptions(optionsType: any, key: string) {
7
- const selector = optionsType[key].inputSelector;
8
-
9
- const inputElement = document.querySelector(`[${selector}]`) as HTMLInputElement;
10
- if (!inputElement) return;
11
-
12
- if (inputElement.getAttribute("type") === "checkbox") {
13
- optionsType[key].value = inputElement.checked;
14
- return;
15
- }
16
-
17
- if (inputElement.value) {
18
- const safeValue = optionSafetyCheck(key, inputElement.value);
19
- if (safeValue === null) return;
20
-
21
- optionsType[key].value = safeValue;
22
- }
23
- }
24
-
25
- export function getInputOptions(options: types.Options): types.Options {
26
- try {
27
- // Use the helper function for both 'image' and 'zip' options
28
- Promise.all(
29
- Object.keys(options.image).map((key) => handleOptions(options.image, key))
30
- );
31
- Promise.all(Object.keys(options.zip).map((key) => handleOptions(options.zip, key)));
32
-
33
- if (options.debug) pushToWindow("getInputOptionsDebug", options);
34
-
35
- return options;
36
- } catch (e) {
37
- console.error("ImageExporter: Error in getUserOptions", e);
38
- return options;
39
- }
40
- }
@@ -1,46 +0,0 @@
1
- import * as types from "../types";
2
- import { parseImageLabel } from "../utils";
3
-
4
- /**
5
- * Extracts and customizes settings for a specific element based on its attributes and additional criteria.
6
- *
7
- * This function creates a copy of the provided options object and then customizes it for an individual
8
- * element. It checks for specific attributes on the element (defined in the 'attributesToCheck' parameter)
9
- * and, if present, overwrites the corresponding properties in the options object with the attribute values.
10
- * Additionally, it sets a 'slug' property based on the content of a specific child element or generates a
11
- * unique name based on the index.
12
- *
13
- * @param {HTMLElement} element - The HTML element for which the settings are being determined.
14
- * @param {Object} options - The base options object that provides default settings.
15
- * @param {number} index - An index value, typically representing the element's position in a collection.
16
- * @param {Object} attributesToCheck - An object mapping option keys to attribute names to be checked on the element.
17
- * @returns {Object} An object containing the customized settings for the element.
18
- *
19
- */
20
- export function getItemOptions(
21
- element: HTMLElement,
22
- options: types.Options,
23
- index: number
24
- ): types.ItemOptions {
25
- let itemOptions: types.ItemOptions = {
26
- ...options,
27
- id: index,
28
- userSlug: "",
29
- slug: "",
30
- fileName: "",
31
- };
32
-
33
- Object.keys(options.image).forEach((key) => {
34
- const attributeValue = element.getAttribute(options.image[key].attributeSelector);
35
- if (attributeValue !== null) {
36
- console.log("Capture item option:", key, "=", attributeValue);
37
- itemOptions.image[key].value = attributeValue;
38
- }
39
- });
40
-
41
- itemOptions.id = index;
42
- itemOptions.userSlug = element.querySelector(options.selectors.slug)?.textContent || "";
43
- itemOptions.slug = parseImageLabel(itemOptions);
44
-
45
- return itemOptions;
46
- }
@@ -1,33 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Tests</title>
7
- </head>
8
- <body>
9
- <div
10
- ie="wrapper"
11
- ie-scale="2"
12
- ie-quality="0.55"
13
- ie-format="png"
14
- ie-img-label-date="false"
15
- ie-img-label-scale="false"
16
- ie-zip-label="yay"
17
- ie-zip-label-date="false"
18
- ie-zip-label-scale="false"
19
- ></div>
20
- <div
21
- test="wrapper"
22
- test-scale="3"
23
- test-quality="0.65"
24
- test-format="png"
25
- test-img-label-date="false"
26
- test-img-label-scale="false"
27
- test-zip-label="test"
28
- test-zip-label-date="false"
29
- test-zip-label-scale="false"
30
- ></div>
31
- <script src="../../dist/image-exporter.umd.js"></script>
32
- </body>
33
- </html>
@@ -1,109 +0,0 @@
1
- import { describe, it, expect, beforeAll, afterAll } from "vitest";
2
- import puppeteer from "puppeteer";
3
- import path from "path";
4
- import * as types from "../types";
5
- import { defaultOptions } from "../default-options";
6
-
7
- describe("get-wrapper-options", () => {
8
- let browser;
9
- let page;
10
-
11
- beforeAll(async () => {
12
- // Setup for puppeteer with Vitest
13
- browser = await puppeteer.launch();
14
- page = await browser.newPage();
15
- await page.goto(`file://${path.join(__dirname, "get-wrapper-options.test.html")}`);
16
- });
17
-
18
- afterAll(async () => {
19
- // Teardown for puppeteer with Vitest
20
- await browser.close();
21
- });
22
-
23
- it("standard attributes", async () => {
24
- const result = await page.evaluate(() => {
25
- const js = `const options = { downloadImages: false, debug: true };
26
- const imageExporter = new ImageExporter(options);
27
- const images = imageExporter.captureAll();`;
28
- //insert at the end of the body
29
- const script = document.createElement("script");
30
- script.text = js;
31
- document.body.appendChild(script);
32
-
33
- return (window as any).getWrapperOptionsDebug;
34
- });
35
-
36
- // Assertions can then be made based on the result object
37
- expect(result.image.scale.value).toBe(2);
38
- expect(result.image.quality.value).toBe(0.55);
39
- expect(result.image.format.value).toBe("png");
40
- expect(result.image.dateInLabel.value).toBe(false);
41
- expect(result.image.scaleInLabel.value).toBe(false);
42
- expect(result.zip.label.value).toBe("yay");
43
- expect(result.zip.dateInLabel.value).toBe(false);
44
- expect(result.zip.scaleInLabel.value).toBe(false);
45
- });
46
-
47
- it("custom attributes", async () => {
48
- await page.reload();
49
- const result = await page.evaluate(() => {
50
- const js = `const options = {
51
- downloadImages: false,
52
- selectors: {
53
- wrapper: "[test='wrapper']",
54
- capture: "[test='capture']",
55
- trigger: "[test='trigger']",
56
- slug: "[test='slug']",
57
- ignore: "[test='ignore']",
58
- },
59
- image: {
60
- scale: {
61
- attributeSelector: "test-scale",
62
- },
63
- quality: {
64
- attributeSelector: "test-quality",
65
- },
66
- format: {
67
- attributeSelector: "test-format",
68
- },
69
- dateInLabel: {
70
- attributeSelector: "test-img-label-date",
71
- },
72
- scaleInLabel: {
73
- attributeSelector: "test-img-label-scale",
74
- },
75
- },
76
- zip: {
77
- label: {
78
- attributeSelector: "test-zip-label",
79
- },
80
- dateInLabel: {
81
- attributeSelector: "test-zip-label-date",
82
- },
83
- scaleInLabel: {
84
- attributeSelector: "test-zip-label-scale",
85
- },
86
- },
87
- debug: true,
88
- };
89
- const imageExporter = new ImageExporter(options);
90
- const images = imageExporter.captureAll();`;
91
- //insert at the end of the body
92
- const script = document.createElement("script");
93
- script.text = js;
94
- document.body.appendChild(script);
95
-
96
- return (window as any).getWrapperOptionsDebug;
97
- });
98
-
99
- // Assertions can then be made based on the result object
100
- expect(result.image.scale.value).toBe(3);
101
- expect(result.image.quality.value).toBe(0.65);
102
- expect(result.image.format.value).toBe("png");
103
- expect(result.image.dateInLabel.value).toBe(false);
104
- expect(result.image.scaleInLabel.value).toBe(false);
105
- expect(result.zip.label.value).toBe("test");
106
- expect(result.zip.dateInLabel.value).toBe(false);
107
- expect(result.zip.scaleInLabel.value).toBe(false);
108
- });
109
- });
@@ -1,84 +0,0 @@
1
- import * as types from "../types";
2
- import { pushToWindow } from "../utils/push-to-window";
3
-
4
- /**
5
- * Retrieves and updates the options based on the attributes of the wrapper element.
6
- *
7
- * This function queries the DOM for the wrapper element specified in the options.
8
- * If the wrapper element is found, it iterates over the image settings and updates
9
- * them with the values provided in the wrapper element's attributes.
10
- *
11
- * @param {types.Options} options - The initial settings object, which may contain default settings.
12
- * @returns {types.Options} The updated settings object with values from the wrapper element.
13
- */
14
- export function getWrapperOptions(options: types.Options): types.Options {
15
- try {
16
- const wrapper = document.querySelector(options.selectors.wrapper) as HTMLElement;
17
-
18
- if (!wrapper) {
19
- new Error("Wrapper element not found");
20
- return options;
21
- }
22
-
23
- // For each image setting, see if value is provided in the wrapper element
24
- // If so, update that setting with the new value
25
- Object.keys(options.image).forEach((key) => {
26
- const attrValue = wrapper.getAttribute(options.image[key].attributeSelector);
27
- if (attrValue !== null) {
28
- const safeValue = optionSafetyCheck(key, attrValue);
29
- if (safeValue === null) return;
30
- options.image[key].value = safeValue;
31
- }
32
- });
33
-
34
- Object.keys(options.zip).forEach((key) => {
35
- const attrValue = wrapper.getAttribute(options.zip[key].attributeSelector);
36
- if (attrValue !== null) {
37
- const safeValue = optionSafetyCheck(key, attrValue);
38
- if (safeValue === null) return;
39
- options.zip[key].value = safeValue;
40
- }
41
- });
42
-
43
- if (options.debug) pushToWindow("getWrapperOptionsDebug", options);
44
-
45
- return options;
46
- } catch (e) {
47
- console.error("ImageExporter: Error in getWrapperOptions", e);
48
- return options;
49
- }
50
- }
51
-
52
- /**
53
- * Validates and converts the provided value based on the key.
54
- */
55
- export function optionSafetyCheck(key: string, value: any): any {
56
- // Handle checkbox inputs
57
- if (value === "on") return true;
58
- if (value === "off") return false;
59
-
60
- // Handle number inputs
61
- if (key === "scale" || key === "quality") {
62
- if (typeof value === "number") return value;
63
- value = value.trim();
64
- value = parseFloat(value);
65
- if (isNaN(value)) return null;
66
-
67
- return value;
68
- }
69
- // Handle boolean inputs
70
- if (key === "dateInLabel" || key === "scaleInLabel") {
71
- if (typeof value === "boolean") return value;
72
- value = value.trim();
73
-
74
- return value === "true";
75
- }
76
- // Handle image format
77
- if (key === "format") {
78
- value = value.trim();
79
- if (value === "jpg" || value === "png") return value;
80
-
81
- return null;
82
- }
83
- return value;
84
- }
@@ -1,28 +0,0 @@
1
- import { getWrapperOptions } from "./get-wrapper-options";
2
- import { getInputOptions } from "./get-input-options";
3
- import { getItemOptions } from "./get-item-options";
4
- import * as types from "../types";
5
-
6
- /**
7
- * Asynchronously determines and finalizes settings by aggregating them from multiple sources.
8
- *
9
- * This function works through a sequence of steps to build a comprehensive settings object. Initially,
10
- * it displays a loading message. It then sequentially updates the settings based on the attributes of a
11
- * wrapper element and user inputs, respectively. Each step potentially overwrites the settings from the
12
- * previous steps, allowing for a layered approach to setting configuration.
13
- *
14
- * @param {Object} options - The initial settings object, which may contain default settings.
15
- * @returns {Promise<Object>} A promise that resolves to the fully determined settings object.
16
- *
17
- */
18
- function determineOptions(options: types.Options): types.Options {
19
- // If settings exist on the wrapper, overwrite the default options
20
- options = getWrapperOptions(options);
21
-
22
- // If settings exist via user input, overwrite the default/wrapper options
23
- options = getInputOptions(options);
24
-
25
- return options;
26
- }
27
-
28
- export { getItemOptions, determineOptions };