@degreesign/ui 1.1.0 → 1.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 CHANGED
@@ -1,9 +1,6 @@
1
1
  # DegreeSign UI functions
2
2
 
3
- A lightweight TypeScript library for managing UI elements in web applications.
4
-
5
-
6
-
3
+ A lightweight, dependency-free TypeScript library for selecting, showing, hiding, repeating, and dynamically loading UI elements and resources in web applications.
7
4
 
8
5
  ## Setup
9
6
 
@@ -13,25 +10,52 @@ Install the package via npm:
13
10
  npm install @degreesign/ui
14
11
  ```
15
12
 
13
+ OR via yarn:
14
+
15
+ ```bash
16
+ yarn add @degreesign/ui
17
+ ```
18
+
16
19
  OR use in browsers through CDN
17
20
 
18
21
  ```html
19
- <script src="https://cdn.jsdelivr.net/npm/@degreesign/ui@1.0.8/dist/browser/degreesign.min.js"></script>
22
+ <script
23
+ src="https://cdn.jsdelivr.net/npm/@degreesign/ui@1.2.0/dist/browser/degreesign.min.js"
24
+ ></script>
20
25
  ```
21
26
 
22
27
  ## Usage
23
28
 
24
29
  Import the functions from the `@degreesign/ui` package in your TypeScript or JavaScript project:
25
30
 
26
- ```javascript
27
- import { selectElement, selectAll, showElement, hideElement, repeatElements } from '@degreesign/ui';
31
+ ```ts
32
+ import { selectElement, selectAll, showElement, hideElement, repeatElements, loadScript } from '@degreesign/ui';
28
33
  ```
29
34
 
30
35
  Below are the available functions and their usage examples.
31
36
 
37
+ ## CDN Usage
38
+
39
+ Use the package directly in the browser without a build step by loading the UMD bundle from a CDN:
40
+
41
+ ```html
42
+ <script src="https://cdn.jsdelivr.net/npm/@degreesign/ui@1.2.0/dist/browser/degreesign.min.js"></script>
43
+ ```
44
+
45
+ The bundle exposes a global `dsUI` object containing all exported functions and enums:
46
+
47
+ ```html
48
+ <div id="myDiv">Hello</div>
49
+ <script>
50
+ const el = dsUI.selectElement('#myDiv');
51
+ dsUI.showElement(el);
52
+ dsUI.hideElement(el);
53
+ </script>
54
+ ```
55
+
32
56
  ## Functions
33
57
 
34
- ### `selectElement(id: string, parent?: Element) => HTMLElement`
58
+ ### Select Element
35
59
 
36
60
  Selects a single DOM element by its CSS selector, optionally within a parent element.
37
61
 
@@ -42,7 +66,7 @@ Selects a single DOM element by its CSS selector, optionally within a parent ele
42
66
  **Returns:** An `HTMLElement`.
43
67
 
44
68
  **Example:**
45
- ```javascript
69
+ ```ts
46
70
  // Select an element by ID
47
71
  const myDiv = selectElement('#myDiv');
48
72
  myDiv.textContent = 'Hello, World!';
@@ -53,7 +77,7 @@ const child = selectElement('.child', parent);
53
77
  child.style.color = 'blue';
54
78
  ```
55
79
 
56
- ### `selectAll(id: string, parent?: Element) => NodeListOf<Element>`
80
+ ### Select All
57
81
 
58
82
  Selects all DOM elements matching a CSS selector, optionally within a parent element.
59
83
 
@@ -64,7 +88,7 @@ Selects all DOM elements matching a CSS selector, optionally within a parent ele
64
88
  **Returns:** A `NodeListOf<Element>`.
65
89
 
66
90
  **Example:**
67
- ```javascript
91
+ ```ts
68
92
  // Select all elements with a class
69
93
  const items = selectAll('.item');
70
94
  items.forEach(item => item.style.backgroundColor = 'lightgray');
@@ -75,7 +99,7 @@ const divs = selectAll('div', parent);
75
99
  divs.forEach(div => div.classList.add('highlight'));
76
100
  ```
77
101
 
78
- ### `showElement(element: HTMLElement) => void`
102
+ ### Show Element
79
103
 
80
104
  Sets an element's display style to `flex`, making it visible.
81
105
 
@@ -83,12 +107,12 @@ Sets an element's display style to `flex`, making it visible.
83
107
  - `element`: The `HTMLElement` to show.
84
108
 
85
109
  **Example:**
86
- ```javascript
110
+ ```ts
87
111
  const myDiv = selectElement('#myDiv');
88
112
  showElement(myDiv); // Displays the element with flex layout
89
113
  ```
90
114
 
91
- ### `hideElement(element: HTMLElement) => void`
115
+ ### Hide Element
92
116
 
93
117
  Sets an element's display style to `none`, hiding it.
94
118
 
@@ -96,12 +120,12 @@ Sets an element's display style to `none`, hiding it.
96
120
  - `element`: The `HTMLElement` to hide.
97
121
 
98
122
  **Example:**
99
- ```javascript
123
+ ```ts
100
124
  const myDiv = selectElement('#myDiv');
101
125
  hideElement(myDiv); // Hides the element
102
126
  ```
103
127
 
104
- ### `repeatElements({ children?: NodeListOf<Element>, parent: Element, targetCount: number }) => void`
128
+ ### Repeat Elements
105
129
 
106
130
  Repeats or removes child elements within a parent to match a target count by cloning or removing the first child.
107
131
 
@@ -111,7 +135,7 @@ Repeats or removes child elements within a parent to match a target count by clo
111
135
  - `targetCount`: The desired number of child elements.
112
136
 
113
137
  **Example:**
114
- ```javascript
138
+ ```ts
115
139
  // HTML structure:
116
140
  // <div id="parent">
117
141
  // <div class="child">Item</div>
@@ -128,6 +152,21 @@ repeatElements({ parent, children: selectAll('.child', parent), targetCount: 2 }
128
152
  // Result: 2 child divs inside #parent
129
153
  ```
130
154
 
155
+ ### Load Script
156
+
157
+ Loads an external script or stylesheet once and caches the returned promise.
158
+
159
+ **Parameters:**
160
+ - `src`: The resource URL.
161
+ - `hideConsoleErrors` (optional): Set to `true` to disable console logging.
162
+
163
+ **Returns:** A `Promise<void>`.
164
+
165
+ **Example:**
166
+ ```ts
167
+ loadScript({ src: 'https://example.com/lib.js', hideConsoleErrors: true });
168
+ ```
169
+
131
170
  ## Error Handling
132
171
 
133
172
  The `repeatElements` function includes error handling to catch and log issues when manipulating elements. For example, if the `children` NodeList is invalid or cloning fails, an error will be logged to the console.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see degreesign.min.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.degreesign=t():e.degreesign=t()}(this,(()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.repeatElements=t.hideElement=t.showElement=t.selectAll=t.selectElement=void 0;const o=e=>("string"==typeof e&&(e=document.querySelector(e)),e);t.selectElement=(e,t)=>(o(t)||document)?.querySelector(e),t.selectAll=(e,t)=>(o(t)||document)?.querySelectorAll(e),t.showElement=e=>e&&(e.style.display="flex"),t.hideElement=e=>e&&(e.style.display="none"),t.repeatElements=({children:e,parent:t,targetCount:l})=>{try{const n=o(t);if(e=e||n?.children,e?.length){const t=e?.length||0;if(l>t){const o=e?.[0];if(o)for(let e=t;e<l;e++)n?n.appendChild(o.cloneNode(!0)):o?.after(o.cloneNode(!0))}else if(l<t&&0!=l)for(let o=t-1;o>=l;o--)e[o]?.remove()}}catch(e){console.log("Error repeating elements",l,e)}}})(),e})()));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.dsUI=t():e.dsUI=t()}(this,(()=>(()=>{"use strict";var e={516:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.repeatElements=void 0;const n=r(698);t.repeatElements=({children:e,parent:t,targetCount:r})=>{try{const o=(0,n.parentValid)(t);if(e=e||o?.children,e?.length){const t=e?.length||0;if(r>t){const n=e?.[0];if(n)for(let e=t;e<r;e++)o?o.appendChild(n.cloneNode(!0)):n?.after(n.cloneNode(!0))}else if(r<t&&0!=r)for(let n=t-1;n>=r;n--)e[n]?.remove()}}catch(e){console.log("repeatElements failed",r,e)}}},613:(e,t)=>{var r,n,o,c;Object.defineProperty(t,"__esModule",{value:!0}),t.TypeName=t.Display=t.TagName=t.ResourceType=void 0,function(e){e.Script="text/javascript",e.Stylesheet="stylesheet"}(r||(t.ResourceType=r={})),function(e){e.Link="link",e.Script="script"}(n||(t.TagName=n={})),function(e){e.Flex="flex",e.None="none"}(o||(t.Display=o={})),function(e){e.String="string"}(c||(t.TypeName=c={}))},698:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.hideElement=t.showElement=t.selectAll=t.selectElement=t.parentValid=void 0;const n=r(613),o=e=>typeof e==n.TypeName.String?document.querySelector(e):e;t.parentValid=o,t.selectElement=(e,t)=>(o(t)||document)?.querySelector(e),t.selectAll=(e,t)=>(o(t)||document)?.querySelectorAll(e),t.showElement=e=>e&&(e.style.display=n.Display.Flex),t.hideElement=e=>e&&(e.style.display=n.Display.None)},924:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.loadScript=void 0;const n=r(613),o={};t.loadScript=({src:e,type:t=n.ResourceType.Script,ready:r,interval:c=100,timeout:a=3e4,hideConsoleErrors:l})=>{try{const s=o[e];if(s)return s;const i=new Promise(((o,s)=>{let i,p,d=!1;const u=e=>{d||(d=!0,p&&clearTimeout(p),i&&clearTimeout(i),e?s():o())},m=()=>{if(!d)return!r||r()?u():void(i=setTimeout(m,c))};let f;if(p=setTimeout((()=>{l||console.log("loadScript timed out",e),u(!0)}),a),t===n.ResourceType.Stylesheet){const t=document.createElement(n.TagName.Link);t.rel=n.ResourceType.Stylesheet,t.href=e,f=t}else{const t=document.createElement(n.TagName.Script);t.type=n.ResourceType.Script,t.src=e,t.async=!0,f=t}f.onload=m,f.onerror=t=>{l||console.log("loadScript failed onload",e,t),u(t)},document.head.appendChild(f)}));return o[e]=i,i.catch((()=>{o[e]===i&&delete o[e]})),i}catch(e){l||console.log("loadScript failed",e)}}},926:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createCaptcha=void 0;const n=r(924),o=r(698),c=window;t.createCaptcha=({parentTag:e,sitekey:t,hideConsoleErrors:r})=>{try{const a="https://js.hcaptcha.com/1/api.js",l=(0,o.parentValid)(e),s=document.createElement("form"),i=document.createElement("div"),p=()=>s.elements.namedItem("h-captcha-response")?.value||"",d=()=>{c.hcaptcha?c.hcaptcha.reset():(0,n.loadScript)({src:a,hideConsoleErrors:r})};if(l)return s.name="cap",s.classList.add("captcha_frame"),i.classList.add("h-captcha"),i.dataset.sitekey=t,s.appendChild(i),l.appendChild(s),(0,n.loadScript)({src:a,hideConsoleErrors:r}),{captchaFrame:s,getCaptchaToken:p,resetCaptcha:d}}catch(e){console.log("createCaptcha failed",e)}return{getCaptchaToken:()=>"",resetCaptcha:()=>console.log("createCaptcha load failed")}}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var c=t[n]={exports:{}};return e[n](c,c.exports,r),c.exports}var n={};return(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.Display=e.ResourceType=e.createCaptcha=e.loadScript=e.repeatElements=e.hideElement=e.showElement=e.selectAll=e.selectElement=void 0;const t=r(698);Object.defineProperty(e,"selectElement",{enumerable:!0,get:function(){return t.selectElement}}),Object.defineProperty(e,"selectAll",{enumerable:!0,get:function(){return t.selectAll}}),Object.defineProperty(e,"showElement",{enumerable:!0,get:function(){return t.showElement}}),Object.defineProperty(e,"hideElement",{enumerable:!0,get:function(){return t.hideElement}});const o=r(516);Object.defineProperty(e,"repeatElements",{enumerable:!0,get:function(){return o.repeatElements}});const c=r(924);Object.defineProperty(e,"loadScript",{enumerable:!0,get:function(){return c.loadScript}});const a=r(926);Object.defineProperty(e,"createCaptcha",{enumerable:!0,get:function(){return a.createCaptcha}});const l=r(613);Object.defineProperty(e,"ResourceType",{enumerable:!0,get:function(){return l.ResourceType}}),Object.defineProperty(e,"Display",{enumerable:!0,get:function(){return l.Display}})})(),n})()));
@@ -0,0 +1,5 @@
1
+ import { CreateCaptcha, CreateCaptchaParams } from '../types';
2
+ declare const
3
+ /** Create captcha form */
4
+ createCaptcha: ({ parentTag, sitekey, hideConsoleErrors, }: CreateCaptchaParams) => CreateCaptcha;
5
+ export { createCaptcha, };
@@ -0,0 +1,11 @@
1
+ declare const
2
+ /** Repeat Elements */
3
+ repeatElements: ({ children, parent, targetCount, }: {
4
+ /** Child Element Nodes */
5
+ children?: NodeListOf<Element> | HTMLCollection | HTMLElement[];
6
+ /** Parent Element */
7
+ parent?: Element | HTMLElement | string;
8
+ /** Target Count */
9
+ targetCount: number;
10
+ }) => void;
11
+ export { repeatElements, };
@@ -0,0 +1,5 @@
1
+ import type { LoadScriptParams } from '../types';
2
+ declare const
3
+ /** Load external script once */
4
+ loadScript: ({ src, type, ready, interval, timeout, hideConsoleErrors, }: LoadScriptParams) => Promise<void> | undefined;
5
+ export { loadScript, };
@@ -0,0 +1,13 @@
1
+ import { Display } from '../types';
2
+ declare const
3
+ /** Validate parent element */
4
+ parentValid: (parent?: Element | string) => Element | undefined,
5
+ /** Select element by selector */
6
+ selectElement: (id: string, parent?: Element | string) => HTMLElement,
7
+ /** Select all by selector */
8
+ selectAll: (id: string, parent?: Element | string) => NodeListOf<Element>,
9
+ /** Show element */
10
+ showElement: (element?: HTMLElement | null) => Display.Flex | null | undefined,
11
+ /** Hide element */
12
+ hideElement: (element?: HTMLElement | null) => Display.None | null | undefined;
13
+ export { parentValid, selectElement, selectAll, showElement, hideElement, };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,8 @@
1
- declare const selectElement: (id: string, parent?: Element | string) => HTMLElement, selectAll: (id: string, parent?: Element | string) => NodeListOf<Element>, showElement: (element?: HTMLElement | null) => "flex" | null | undefined, hideElement: (element?: HTMLElement | null) => "none" | null | undefined,
2
- /** Repeat Elements */
3
- repeatElements: ({ children, parent, targetCount, }: {
4
- /** Child Element Nodes */
5
- children?: NodeListOf<Element> | HTMLCollection | HTMLElement[];
6
- /** Parent Element */
7
- parent?: Element | HTMLElement | string;
8
- /** Target Count */
9
- targetCount: number;
10
- }) => void;
11
- export { selectElement, selectAll, showElement, hideElement, repeatElements, };
1
+ import { selectElement, selectAll, showElement, hideElement } from './code/select';
2
+ import { repeatElements } from './code/populate';
3
+ import { loadScript } from './code/scripts';
4
+ import { createCaptcha } from './code/captcha';
5
+ import { ResourceType, Display } from './types';
6
+ import type { CreateCaptcha, CreateCaptchaParams, LoadScriptParams } from './types';
7
+ export { selectElement, selectAll, showElement, hideElement, repeatElements, loadScript, createCaptcha, ResourceType, Display, };
8
+ export type { CreateCaptcha, CreateCaptchaParams, LoadScriptParams, };
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see degreesign.node.min.js.LICENSE.txt */
2
- (()=>{"use strict";var e={};(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.repeatElements=t.hideElement=t.showElement=t.selectAll=t.selectElement=void 0;const l=e=>("string"==typeof e&&(e=document.querySelector(e)),e);t.selectElement=(e,t)=>(l(t)||document)?.querySelector(e),t.selectAll=(e,t)=>(l(t)||document)?.querySelectorAll(e),t.showElement=e=>e&&(e.style.display="flex"),t.hideElement=e=>e&&(e.style.display="none"),t.repeatElements=({children:e,parent:t,targetCount:o})=>{try{const n=l(t);if(e=e||n?.children,e?.length){const t=e?.length||0;if(o>t){const l=e?.[0];if(l)for(let e=t;e<o;e++)n?n.appendChild(l.cloneNode(!0)):l?.after(l.cloneNode(!0))}else if(o<t&&0!=o)for(let l=t-1;l>=o;l--)e[l]?.remove()}}catch(e){console.log("Error repeating elements",o,e)}}})();var t=exports;for(var l in e)t[l]=e[l];e.__esModule&&Object.defineProperty(t,"__esModule",{value:!0})})();
2
+ (()=>{"use strict";var e={516:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.repeatElements=void 0;const n=r(698);t.repeatElements=({children:e,parent:t,targetCount:r})=>{try{const o=(0,n.parentValid)(t);if(e=e||o?.children,e?.length){const t=e?.length||0;if(r>t){const n=e?.[0];if(n)for(let e=t;e<r;e++)o?o.appendChild(n.cloneNode(!0)):n?.after(n.cloneNode(!0))}else if(r<t&&0!=r)for(let n=t-1;n>=r;n--)e[n]?.remove()}}catch(e){console.log("repeatElements failed",r,e)}}},613:(e,t)=>{var r,n,o,c;Object.defineProperty(t,"__esModule",{value:!0}),t.TypeName=t.Display=t.TagName=t.ResourceType=void 0,function(e){e.Script="text/javascript",e.Stylesheet="stylesheet"}(r||(t.ResourceType=r={})),function(e){e.Link="link",e.Script="script"}(n||(t.TagName=n={})),function(e){e.Flex="flex",e.None="none"}(o||(t.Display=o={})),function(e){e.String="string"}(c||(t.TypeName=c={}))},698:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.hideElement=t.showElement=t.selectAll=t.selectElement=t.parentValid=void 0;const n=r(613),o=e=>typeof e==n.TypeName.String?document.querySelector(e):e;t.parentValid=o,t.selectElement=(e,t)=>(o(t)||document)?.querySelector(e),t.selectAll=(e,t)=>(o(t)||document)?.querySelectorAll(e),t.showElement=e=>e&&(e.style.display=n.Display.Flex),t.hideElement=e=>e&&(e.style.display=n.Display.None)},924:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.loadScript=void 0;const n=r(613),o={};t.loadScript=({src:e,type:t=n.ResourceType.Script,ready:r,interval:c=100,timeout:a=3e4,hideConsoleErrors:l})=>{try{const s=o[e];if(s)return s;const i=new Promise(((o,s)=>{let i,p,d=!1;const u=e=>{d||(d=!0,p&&clearTimeout(p),i&&clearTimeout(i),e?s():o())},m=()=>{if(!d)return!r||r()?u():void(i=setTimeout(m,c))};let h;if(p=setTimeout((()=>{l||console.log("loadScript timed out",e),u(!0)}),a),t===n.ResourceType.Stylesheet){const t=document.createElement(n.TagName.Link);t.rel=n.ResourceType.Stylesheet,t.href=e,h=t}else{const t=document.createElement(n.TagName.Script);t.type=n.ResourceType.Script,t.src=e,t.async=!0,h=t}h.onload=m,h.onerror=t=>{l||console.log("loadScript failed onload",e,t),u(t)},document.head.appendChild(h)}));return o[e]=i,i.catch((()=>{o[e]===i&&delete o[e]})),i}catch(e){l||console.log("loadScript failed",e)}}},926:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createCaptcha=void 0;const n=r(924),o=r(698),c=window;t.createCaptcha=({parentTag:e,sitekey:t,hideConsoleErrors:r})=>{try{const a="https://js.hcaptcha.com/1/api.js",l=(0,o.parentValid)(e),s=document.createElement("form"),i=document.createElement("div"),p=()=>s.elements.namedItem("h-captcha-response")?.value||"",d=()=>{c.hcaptcha?c.hcaptcha.reset():(0,n.loadScript)({src:a,hideConsoleErrors:r})};if(l)return s.name="cap",s.classList.add("captcha_frame"),i.classList.add("h-captcha"),i.dataset.sitekey=t,s.appendChild(i),l.appendChild(s),(0,n.loadScript)({src:a,hideConsoleErrors:r}),{captchaFrame:s,getCaptchaToken:p,resetCaptcha:d}}catch(e){console.log("createCaptcha failed",e)}return{getCaptchaToken:()=>"",resetCaptcha:()=>console.log("createCaptcha load failed")}}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var c=t[n]={exports:{}};return e[n](c,c.exports,r),c.exports}var n={};(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.Display=e.ResourceType=e.createCaptcha=e.loadScript=e.repeatElements=e.hideElement=e.showElement=e.selectAll=e.selectElement=void 0;const t=r(698);Object.defineProperty(e,"selectElement",{enumerable:!0,get:function(){return t.selectElement}}),Object.defineProperty(e,"selectAll",{enumerable:!0,get:function(){return t.selectAll}}),Object.defineProperty(e,"showElement",{enumerable:!0,get:function(){return t.showElement}}),Object.defineProperty(e,"hideElement",{enumerable:!0,get:function(){return t.hideElement}});const o=r(516);Object.defineProperty(e,"repeatElements",{enumerable:!0,get:function(){return o.repeatElements}});const c=r(924);Object.defineProperty(e,"loadScript",{enumerable:!0,get:function(){return c.loadScript}});const a=r(926);Object.defineProperty(e,"createCaptcha",{enumerable:!0,get:function(){return a.createCaptcha}});const l=r(613);Object.defineProperty(e,"ResourceType",{enumerable:!0,get:function(){return l.ResourceType}}),Object.defineProperty(e,"Display",{enumerable:!0,get:function(){return l.Display}})})();var o=exports;for(var c in n)o[c]=n[c];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
@@ -0,0 +1,47 @@
1
+ export declare enum ResourceType {
2
+ Script = "text/javascript",
3
+ Stylesheet = "stylesheet"
4
+ }
5
+ export declare enum TagName {
6
+ Link = "link",
7
+ Script = "script"
8
+ }
9
+ export declare enum Display {
10
+ Flex = "flex",
11
+ None = "none"
12
+ }
13
+ export declare enum TypeName {
14
+ String = "string"
15
+ }
16
+ export type LibsWindow = Window & {
17
+ hcaptcha?: {
18
+ reset: (id?: string) => void;
19
+ };
20
+ };
21
+ export interface CreateCaptchaParams {
22
+ /** Parent element or selector */
23
+ parentTag: string | HTMLElement;
24
+ /** hCaptcha site key */
25
+ sitekey: string;
26
+ /** Disable console logging */
27
+ hideConsoleErrors?: boolean;
28
+ }
29
+ export interface CreateCaptcha {
30
+ captchaFrame?: HTMLFormElement;
31
+ getCaptchaToken: () => string;
32
+ resetCaptcha: () => void;
33
+ }
34
+ export type LoadScriptParams = {
35
+ /** Resource URL */
36
+ src: string;
37
+ /** Resource type */
38
+ type?: ResourceType;
39
+ /** Defaults to load event */
40
+ ready?: () => boolean;
41
+ /** Readiness poll (ms) */
42
+ interval?: number;
43
+ /** Max wait (ms) */
44
+ timeout?: number;
45
+ /** Disable console logging */
46
+ hideConsoleErrors?: boolean;
47
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@degreesign/ui",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "DegreeSign UI Controls",
5
5
  "main": "dist/node/degreesign.node.min.js",
6
6
  "module": "dist/node/degreesign.node.min.js",