@genesislcap/foundation-utils 14.314.3-alpha-c442ac5.0 → 14.316.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 (58) hide show
  1. package/dist/custom-elements.json +250 -868
  2. package/dist/dts/index.d.ts +0 -1
  3. package/dist/dts/index.d.ts.map +1 -1
  4. package/dist/esm/index.js +0 -1
  5. package/dist/foundation-utils.api.json +0 -1217
  6. package/dist/foundation-utils.d.ts +0 -83
  7. package/docs/api/foundation-utils.md +0 -63
  8. package/docs/api-report.md.api.md +0 -90
  9. package/package.json +11 -11
  10. package/dist/dts/inactivity/inactivity-dialog.d.ts +0 -23
  11. package/dist/dts/inactivity/inactivity-dialog.d.ts.map +0 -1
  12. package/dist/dts/inactivity/inactivity-manager.d.ts +0 -24
  13. package/dist/dts/inactivity/inactivity-manager.d.ts.map +0 -1
  14. package/dist/dts/inactivity/inactivity-service.d.ts +0 -34
  15. package/dist/dts/inactivity/inactivity-service.d.ts.map +0 -1
  16. package/dist/dts/inactivity/index.d.ts +0 -4
  17. package/dist/dts/inactivity/index.d.ts.map +0 -1
  18. package/dist/esm/inactivity/inactivity-dialog.js +0 -213
  19. package/dist/esm/inactivity/inactivity-manager.js +0 -87
  20. package/dist/esm/inactivity/inactivity-service.js +0 -128
  21. package/dist/esm/inactivity/index.js +0 -3
  22. package/docs/api/foundation-utils.inactivityconfig.md +0 -71
  23. package/docs/api/foundation-utils.inactivityconfig.timeoutminutes.md +0 -11
  24. package/docs/api/foundation-utils.inactivityconfig.warningminutes.md +0 -11
  25. package/docs/api/foundation-utils.inactivitydialog.disconnectedcallback.md +0 -15
  26. package/docs/api/foundation-utils.inactivitydialog.handlecontinue.md +0 -15
  27. package/docs/api/foundation-utils.inactivitydialog.handlelogout.md +0 -15
  28. package/docs/api/foundation-utils.inactivitydialog.hide.md +0 -15
  29. package/docs/api/foundation-utils.inactivitydialog.isvisible.md +0 -11
  30. package/docs/api/foundation-utils.inactivitydialog.md +0 -152
  31. package/docs/api/foundation-utils.inactivitydialog.remainingseconds.md +0 -11
  32. package/docs/api/foundation-utils.inactivitydialog.show.md +0 -50
  33. package/docs/api/foundation-utils.inactivitydialogoptions.md +0 -88
  34. package/docs/api/foundation-utils.inactivitydialogoptions.oncontinue.md +0 -11
  35. package/docs/api/foundation-utils.inactivitydialogoptions.onlogout.md +0 -11
  36. package/docs/api/foundation-utils.inactivitydialogoptions.remainingseconds.md +0 -11
  37. package/docs/api/foundation-utils.inactivityevents._inactivity-reset_.md +0 -11
  38. package/docs/api/foundation-utils.inactivityevents._inactivity-timeout_.md +0 -11
  39. package/docs/api/foundation-utils.inactivityevents._inactivity-warning_.md +0 -13
  40. package/docs/api/foundation-utils.inactivityevents.md +0 -88
  41. package/docs/api/foundation-utils.inactivitymanager._constructor_.md +0 -48
  42. package/docs/api/foundation-utils.inactivitymanager.destroy.md +0 -15
  43. package/docs/api/foundation-utils.inactivitymanager.getservice.md +0 -15
  44. package/docs/api/foundation-utils.inactivitymanager.iswarningvisible.md +0 -15
  45. package/docs/api/foundation-utils.inactivitymanager.md +0 -138
  46. package/docs/api/foundation-utils.inactivitymanager.reset.md +0 -15
  47. package/docs/api/foundation-utils.inactivitymanager.start.md +0 -15
  48. package/docs/api/foundation-utils.inactivitymanager.stop.md +0 -15
  49. package/docs/api/foundation-utils.inactivitymanagerconfig.md +0 -55
  50. package/docs/api/foundation-utils.inactivitymanagerconfig.onlogout.md +0 -11
  51. package/docs/api/foundation-utils.inactivityservice._constructor_.md +0 -48
  52. package/docs/api/foundation-utils.inactivityservice.destroy.md +0 -15
  53. package/docs/api/foundation-utils.inactivityservice.md +0 -138
  54. package/docs/api/foundation-utils.inactivityservice.off.md +0 -64
  55. package/docs/api/foundation-utils.inactivityservice.on.md +0 -64
  56. package/docs/api/foundation-utils.inactivityservice.resettimer.md +0 -15
  57. package/docs/api/foundation-utils.inactivityservice.start.md +0 -15
  58. package/docs/api/foundation-utils.inactivityservice.stop.md +0 -15
@@ -1,87 +0,0 @@
1
- import { InactivityService } from './inactivity-service';
2
- export class InactivityManager {
3
- constructor(config) {
4
- this.dialog = null;
5
- this.isDialogVisible = false;
6
- this.config = config;
7
- this.service = new InactivityService({
8
- timeoutMinutes: config.timeoutMinutes,
9
- warningMinutes: config.warningMinutes,
10
- });
11
- this.setupEventListeners();
12
- console.log('InactivityManager constructor ', this.config);
13
- }
14
- setupEventListeners() {
15
- this.service.on('inactivity-warning', (data) => {
16
- this.showWarningDialog(data.remainingSeconds);
17
- });
18
- this.service.on('inactivity-timeout', () => {
19
- this.handleTimeout();
20
- });
21
- }
22
- showWarningDialog(remainingSeconds) {
23
- if (this.isDialogVisible)
24
- return;
25
- if (!this.dialog) {
26
- this.dialog = document.createElement('inactivity-dialog');
27
- console.log('Creating dialog', this.dialog);
28
- }
29
- if (!this.dialog.isConnected) {
30
- document.body.appendChild(this.dialog);
31
- }
32
- this.isDialogVisible = true;
33
- this.dialog.show({
34
- remainingSeconds,
35
- onContinue: () => this.handleContinue(),
36
- onLogout: () => this.handleLogout(),
37
- });
38
- }
39
- hideWarningDialog() {
40
- if (!this.isDialogVisible || !this.dialog)
41
- return;
42
- this.isDialogVisible = false;
43
- this.dialog.hide();
44
- // Remove from DOM
45
- if (this.dialog.parentNode) {
46
- this.dialog.parentNode.removeChild(this.dialog);
47
- }
48
- }
49
- handleContinue() {
50
- this.service.resetTimer();
51
- this.hideWarningDialog();
52
- }
53
- handleLogout() {
54
- this.hideWarningDialog();
55
- this.service.stop();
56
- if (this.config.onLogout)
57
- this.config.onLogout();
58
- }
59
- handleTimeout() {
60
- // If dialog is visible, let it handle the countdown
61
- if (this.isDialogVisible)
62
- return;
63
- // Otherwise, logout immediately
64
- this.handleLogout();
65
- }
66
- start() {
67
- this.service.start();
68
- }
69
- stop() {
70
- this.service.stop();
71
- this.hideWarningDialog();
72
- }
73
- reset() {
74
- this.service.resetTimer();
75
- this.hideWarningDialog();
76
- }
77
- destroy() {
78
- this.service.destroy();
79
- this.hideWarningDialog();
80
- }
81
- getService() {
82
- return this.service;
83
- }
84
- isWarningVisible() {
85
- return this.isDialogVisible;
86
- }
87
- }
@@ -1,128 +0,0 @@
1
- // Constants for time conversions
2
- const SECONDS_PER_MINUTE = 60;
3
- const MILLISECONDS_PER_SECOND = 1000;
4
- const MILLISECONDS_PER_MINUTE = SECONDS_PER_MINUTE * MILLISECONDS_PER_SECOND;
5
- export class InactivityService {
6
- constructor(config) {
7
- this.warningId = null;
8
- this.timeoutId = null;
9
- this.lastActivity = Date.now();
10
- this.isActive = false;
11
- this.eventListeners = new Map();
12
- this.config = config;
13
- this.setupActivityListeners();
14
- }
15
- setupActivityListeners() {
16
- const events = [
17
- 'mousedown',
18
- 'mousemove',
19
- 'keydown',
20
- 'touchstart',
21
- 'click',
22
- 'focus',
23
- 'blur',
24
- 'wheel',
25
- 'touchmove',
26
- ];
27
- const handler = () => this.resetTimer();
28
- events.forEach((event) => {
29
- document.addEventListener(event, handler, { passive: true });
30
- });
31
- // Handle scroll events
32
- window.addEventListener('scroll', handler, { passive: true, capture: true });
33
- document.addEventListener('scroll', handler, { passive: true, capture: true });
34
- // Handle sleep/wake cycles
35
- document.addEventListener('visibilitychange', () => {
36
- if (document.visibilityState === 'visible' && this.isActive) {
37
- this.checkTimeout();
38
- }
39
- });
40
- }
41
- checkTimeout() {
42
- const timeSinceLastActivity = Date.now() - this.lastActivity;
43
- const timeoutMs = this.config.timeoutMinutes * MILLISECONDS_PER_MINUTE;
44
- const warningMs = (this.config.timeoutMinutes - this.config.warningMinutes) * MILLISECONDS_PER_MINUTE;
45
- if (timeSinceLastActivity >= timeoutMs) {
46
- this.emit('inactivity-timeout');
47
- }
48
- else if (timeSinceLastActivity >= warningMs) {
49
- const remainingSeconds = Math.round((timeoutMs - timeSinceLastActivity) / MILLISECONDS_PER_SECOND);
50
- this.emit('inactivity-warning', { remainingSeconds });
51
- }
52
- else {
53
- this.resetTimer();
54
- }
55
- }
56
- on(event, listener) {
57
- if (!this.eventListeners.has(event))
58
- this.eventListeners.set(event, []);
59
- this.eventListeners.get(event).push(listener);
60
- }
61
- off(event, listener) {
62
- const listeners = this.eventListeners.get(event);
63
- if (!listeners)
64
- return;
65
- const i = listeners.indexOf(listener);
66
- if (i > -1)
67
- listeners.splice(i, 1);
68
- }
69
- emit(event, data) {
70
- const listeners = this.eventListeners.get(event);
71
- if (!listeners)
72
- return;
73
- for (const l of listeners) {
74
- try {
75
- l(data);
76
- }
77
- catch (e) {
78
- console.error('InactivityService listener error', e);
79
- }
80
- }
81
- }
82
- start() {
83
- this.isActive = true;
84
- this.lastActivity = Date.now();
85
- this.scheduleTimers();
86
- }
87
- stop() {
88
- this.isActive = false;
89
- this.clearTimers();
90
- }
91
- resetTimer() {
92
- if (!this.isActive)
93
- return;
94
- this.lastActivity = Date.now();
95
- this.clearTimers();
96
- this.scheduleTimers();
97
- this.emit('inactivity-reset');
98
- }
99
- scheduleTimers() {
100
- const warningDelayMs = (this.config.timeoutMinutes - this.config.warningMinutes) * MILLISECONDS_PER_MINUTE;
101
- this.warningId = window.setTimeout(() => {
102
- if (this.isActive) {
103
- const remainingSeconds = Math.round(this.config.warningMinutes * SECONDS_PER_MINUTE);
104
- this.emit('inactivity-warning', { remainingSeconds });
105
- }
106
- }, warningDelayMs);
107
- const timeoutDelayMs = this.config.timeoutMinutes * MILLISECONDS_PER_MINUTE;
108
- this.timeoutId = window.setTimeout(() => {
109
- if (this.isActive) {
110
- this.emit('inactivity-timeout');
111
- }
112
- }, timeoutDelayMs);
113
- }
114
- clearTimers() {
115
- if (this.warningId) {
116
- clearTimeout(this.warningId);
117
- this.warningId = null;
118
- }
119
- if (this.timeoutId) {
120
- clearTimeout(this.timeoutId);
121
- this.timeoutId = null;
122
- }
123
- }
124
- destroy() {
125
- this.stop();
126
- this.eventListeners.clear();
127
- }
128
- }
@@ -1,3 +0,0 @@
1
- export * from './inactivity-dialog';
2
- export * from './inactivity-manager';
3
- export * from './inactivity-service';
@@ -1,71 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [InactivityConfig](./foundation-utils.inactivityconfig.md)
4
-
5
- ## InactivityConfig interface
6
-
7
- **Signature:**
8
-
9
- ```typescript
10
- export interface InactivityConfig
11
- ```
12
-
13
- ## Properties
14
-
15
- <table><thead><tr><th>
16
-
17
- Property
18
-
19
-
20
- </th><th>
21
-
22
- Modifiers
23
-
24
-
25
- </th><th>
26
-
27
- Type
28
-
29
-
30
- </th><th>
31
-
32
- Description
33
-
34
-
35
- </th></tr></thead>
36
- <tbody><tr><td>
37
-
38
- [timeoutMinutes](./foundation-utils.inactivityconfig.timeoutminutes.md)
39
-
40
-
41
- </td><td>
42
-
43
-
44
- </td><td>
45
-
46
- number
47
-
48
-
49
- </td><td>
50
-
51
-
52
- </td></tr>
53
- <tr><td>
54
-
55
- [warningMinutes](./foundation-utils.inactivityconfig.warningminutes.md)
56
-
57
-
58
- </td><td>
59
-
60
-
61
- </td><td>
62
-
63
- number
64
-
65
-
66
- </td><td>
67
-
68
-
69
- </td></tr>
70
- </tbody></table>
71
-
@@ -1,11 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [InactivityConfig](./foundation-utils.inactivityconfig.md) &gt; [timeoutMinutes](./foundation-utils.inactivityconfig.timeoutminutes.md)
4
-
5
- ## InactivityConfig.timeoutMinutes property
6
-
7
- **Signature:**
8
-
9
- ```typescript
10
- timeoutMinutes: number;
11
- ```
@@ -1,11 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [InactivityConfig](./foundation-utils.inactivityconfig.md) &gt; [warningMinutes](./foundation-utils.inactivityconfig.warningminutes.md)
4
-
5
- ## InactivityConfig.warningMinutes property
6
-
7
- **Signature:**
8
-
9
- ```typescript
10
- warningMinutes: number;
11
- ```
@@ -1,15 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [InactivityDialog](./foundation-utils.inactivitydialog.md) &gt; [disconnectedCallback](./foundation-utils.inactivitydialog.disconnectedcallback.md)
4
-
5
- ## InactivityDialog.disconnectedCallback() method
6
-
7
- **Signature:**
8
-
9
- ```typescript
10
- disconnectedCallback(): void;
11
- ```
12
- **Returns:**
13
-
14
- void
15
-
@@ -1,15 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [InactivityDialog](./foundation-utils.inactivitydialog.md) &gt; [handleContinue](./foundation-utils.inactivitydialog.handlecontinue.md)
4
-
5
- ## InactivityDialog.handleContinue() method
6
-
7
- **Signature:**
8
-
9
- ```typescript
10
- handleContinue(): void;
11
- ```
12
- **Returns:**
13
-
14
- void
15
-
@@ -1,15 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [InactivityDialog](./foundation-utils.inactivitydialog.md) &gt; [handleLogout](./foundation-utils.inactivitydialog.handlelogout.md)
4
-
5
- ## InactivityDialog.handleLogout() method
6
-
7
- **Signature:**
8
-
9
- ```typescript
10
- handleLogout(): void;
11
- ```
12
- **Returns:**
13
-
14
- void
15
-
@@ -1,15 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [InactivityDialog](./foundation-utils.inactivitydialog.md) &gt; [hide](./foundation-utils.inactivitydialog.hide.md)
4
-
5
- ## InactivityDialog.hide() method
6
-
7
- **Signature:**
8
-
9
- ```typescript
10
- hide(): void;
11
- ```
12
- **Returns:**
13
-
14
- void
15
-
@@ -1,11 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [InactivityDialog](./foundation-utils.inactivitydialog.md) &gt; [isVisible](./foundation-utils.inactivitydialog.isvisible.md)
4
-
5
- ## InactivityDialog.isVisible property
6
-
7
- **Signature:**
8
-
9
- ```typescript
10
- isVisible: boolean;
11
- ```
@@ -1,152 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [InactivityDialog](./foundation-utils.inactivitydialog.md)
4
-
5
- ## InactivityDialog class
6
-
7
- **Signature:**
8
-
9
- ```typescript
10
- export declare class InactivityDialog extends FASTElement
11
- ```
12
- **Extends:** FASTElement
13
-
14
- ## Properties
15
-
16
- <table><thead><tr><th>
17
-
18
- Property
19
-
20
-
21
- </th><th>
22
-
23
- Modifiers
24
-
25
-
26
- </th><th>
27
-
28
- Type
29
-
30
-
31
- </th><th>
32
-
33
- Description
34
-
35
-
36
- </th></tr></thead>
37
- <tbody><tr><td>
38
-
39
- [isVisible](./foundation-utils.inactivitydialog.isvisible.md)
40
-
41
-
42
- </td><td>
43
-
44
-
45
- </td><td>
46
-
47
- boolean
48
-
49
-
50
- </td><td>
51
-
52
-
53
- </td></tr>
54
- <tr><td>
55
-
56
- [remainingSeconds](./foundation-utils.inactivitydialog.remainingseconds.md)
57
-
58
-
59
- </td><td>
60
-
61
-
62
- </td><td>
63
-
64
- number
65
-
66
-
67
- </td><td>
68
-
69
-
70
- </td></tr>
71
- </tbody></table>
72
-
73
- ## Methods
74
-
75
- <table><thead><tr><th>
76
-
77
- Method
78
-
79
-
80
- </th><th>
81
-
82
- Modifiers
83
-
84
-
85
- </th><th>
86
-
87
- Description
88
-
89
-
90
- </th></tr></thead>
91
- <tbody><tr><td>
92
-
93
- [disconnectedCallback()](./foundation-utils.inactivitydialog.disconnectedcallback.md)
94
-
95
-
96
- </td><td>
97
-
98
-
99
- </td><td>
100
-
101
-
102
- </td></tr>
103
- <tr><td>
104
-
105
- [handleContinue()](./foundation-utils.inactivitydialog.handlecontinue.md)
106
-
107
-
108
- </td><td>
109
-
110
-
111
- </td><td>
112
-
113
-
114
- </td></tr>
115
- <tr><td>
116
-
117
- [handleLogout()](./foundation-utils.inactivitydialog.handlelogout.md)
118
-
119
-
120
- </td><td>
121
-
122
-
123
- </td><td>
124
-
125
-
126
- </td></tr>
127
- <tr><td>
128
-
129
- [hide()](./foundation-utils.inactivitydialog.hide.md)
130
-
131
-
132
- </td><td>
133
-
134
-
135
- </td><td>
136
-
137
-
138
- </td></tr>
139
- <tr><td>
140
-
141
- [show(options)](./foundation-utils.inactivitydialog.show.md)
142
-
143
-
144
- </td><td>
145
-
146
-
147
- </td><td>
148
-
149
-
150
- </td></tr>
151
- </tbody></table>
152
-
@@ -1,11 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [InactivityDialog](./foundation-utils.inactivitydialog.md) &gt; [remainingSeconds](./foundation-utils.inactivitydialog.remainingseconds.md)
4
-
5
- ## InactivityDialog.remainingSeconds property
6
-
7
- **Signature:**
8
-
9
- ```typescript
10
- remainingSeconds: number;
11
- ```
@@ -1,50 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [InactivityDialog](./foundation-utils.inactivitydialog.md) &gt; [show](./foundation-utils.inactivitydialog.show.md)
4
-
5
- ## InactivityDialog.show() method
6
-
7
- **Signature:**
8
-
9
- ```typescript
10
- show(options: InactivityDialogOptions): void;
11
- ```
12
-
13
- ## Parameters
14
-
15
- <table><thead><tr><th>
16
-
17
- Parameter
18
-
19
-
20
- </th><th>
21
-
22
- Type
23
-
24
-
25
- </th><th>
26
-
27
- Description
28
-
29
-
30
- </th></tr></thead>
31
- <tbody><tr><td>
32
-
33
- options
34
-
35
-
36
- </td><td>
37
-
38
- [InactivityDialogOptions](./foundation-utils.inactivitydialogoptions.md)
39
-
40
-
41
- </td><td>
42
-
43
-
44
- </td></tr>
45
- </tbody></table>
46
-
47
- **Returns:**
48
-
49
- void
50
-
@@ -1,88 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [InactivityDialogOptions](./foundation-utils.inactivitydialogoptions.md)
4
-
5
- ## InactivityDialogOptions interface
6
-
7
- **Signature:**
8
-
9
- ```typescript
10
- export interface InactivityDialogOptions
11
- ```
12
-
13
- ## Properties
14
-
15
- <table><thead><tr><th>
16
-
17
- Property
18
-
19
-
20
- </th><th>
21
-
22
- Modifiers
23
-
24
-
25
- </th><th>
26
-
27
- Type
28
-
29
-
30
- </th><th>
31
-
32
- Description
33
-
34
-
35
- </th></tr></thead>
36
- <tbody><tr><td>
37
-
38
- [onContinue](./foundation-utils.inactivitydialogoptions.oncontinue.md)
39
-
40
-
41
- </td><td>
42
-
43
-
44
- </td><td>
45
-
46
- () =&gt; void
47
-
48
-
49
- </td><td>
50
-
51
-
52
- </td></tr>
53
- <tr><td>
54
-
55
- [onLogout](./foundation-utils.inactivitydialogoptions.onlogout.md)
56
-
57
-
58
- </td><td>
59
-
60
-
61
- </td><td>
62
-
63
- () =&gt; void
64
-
65
-
66
- </td><td>
67
-
68
-
69
- </td></tr>
70
- <tr><td>
71
-
72
- [remainingSeconds](./foundation-utils.inactivitydialogoptions.remainingseconds.md)
73
-
74
-
75
- </td><td>
76
-
77
-
78
- </td><td>
79
-
80
- number
81
-
82
-
83
- </td><td>
84
-
85
-
86
- </td></tr>
87
- </tbody></table>
88
-