@zcomponent/core 1.22.1 → 1.23.0-beta.1

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.
@@ -15,8 +15,11 @@ export declare class TextAlertContext extends Context {
15
15
  * @zprop
16
16
  * @param txt The text content for the alert.
17
17
  * @param options Optional configuration for the text alert appearance and behavior.
18
+ * @returns An object that allows for manually closing the text alert
18
19
  */
19
- showTextAlert(txt: string, options?: TextAlertOptions): void;
20
+ showTextAlert(txt: string, options?: TextAlertOptions): {
21
+ close: () => void;
22
+ };
20
23
  }
21
24
  /**
22
25
  * Configuration options for displaying a text alert.
@@ -45,4 +48,6 @@ export interface TextAlertOptions {
45
48
  * @param txt The text content for the alert.
46
49
  * @param options Optional configuration for the text alert appearance and behavior.
47
50
  */
48
- export declare function showTextAlert(mgr: ContextManager, txt: string, options?: TextAlertOptions): void;
51
+ export declare function showTextAlert(mgr: ContextManager, txt: string, options?: TextAlertOptions): {
52
+ close: () => void;
53
+ };
@@ -22,6 +22,7 @@ export class TextAlertContext extends Context {
22
22
  * @zprop
23
23
  * @param txt The text content for the alert.
24
24
  * @param options Optional configuration for the text alert appearance and behavior.
25
+ * @returns An object that allows for manually closing the text alert
25
26
  */
26
27
  showTextAlert(txt, options) {
27
28
  const entry = document.createElement('div');
@@ -39,10 +40,18 @@ export class TextAlertContext extends Context {
39
40
  setTimeout(() => {
40
41
  entry.classList.add('zcomponent-textalert-shown');
41
42
  }, 30);
42
- setTimeout(() => {
43
- entry.classList.remove('zcomponent-textalert-shown');
44
- setTimeout(() => entry.remove(), 1000);
45
- }, timeout);
43
+ if (timeout >= 0) {
44
+ setTimeout(() => {
45
+ entry.classList.remove('zcomponent-textalert-shown');
46
+ setTimeout(() => entry.remove(), 1000);
47
+ }, timeout);
48
+ }
49
+ return {
50
+ close: () => {
51
+ entry.classList.remove('zcomponent-textalert-shown');
52
+ setTimeout(() => entry.remove(), 1000);
53
+ },
54
+ };
46
55
  }
47
56
  }
48
57
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zcomponent/core",
3
- "version": "1.22.1",
3
+ "version": "1.23.0-beta.1",
4
4
  "description": "The core component model and built-in functionality for Mattercraft.",
5
5
  "author": "Zappar Limited",
6
6
  "license": "Proprietary",