cynx-lib 1.3.83 → 1.3.85

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 (42) hide show
  1. package/gen.js +77 -77
  2. package/package.json +5 -1
  3. package/ui/components/Drawer.jsx +208 -208
  4. package/ui/components/Layout.jsx +37 -0
  5. package/ui/components/Pagination.jsx +145 -145
  6. package/ui/components/PrivacyBlur.jsx +603 -603
  7. package/ui/components/Sidebar.jsx +300 -134
  8. package/utils/index.cjs +5 -0
  9. package/utils/index.js +22 -20
  10. package/utils/utils/duration.js +139 -139
  11. package/utils/utils/oidc.js +214 -214
  12. package/utils/utils/realtime.js +1634 -1634
  13. package/utils/utils/session.cjs +15 -2
  14. package/utils/utils/session.js +67 -58
  15. package/utils/utils/session_manager.cjs +490 -0
  16. package/utils/utils/session_manager.js +549 -0
  17. package/utils/utils/storage.js +393 -393
  18. package/utils/utils/ui.js +111 -111
  19. package/vue/components/Badge.vue +79 -79
  20. package/vue/components/Button.vue +209 -209
  21. package/vue/components/Checkbox.vue +103 -103
  22. package/vue/components/CircularProgress.vue +383 -383
  23. package/vue/components/Divider.vue +94 -94
  24. package/vue/components/Drawer.vue +243 -243
  25. package/vue/components/InfoBadge.vue +223 -223
  26. package/vue/components/Input.vue +341 -341
  27. package/vue/components/LinearProgress.vue +268 -268
  28. package/vue/components/Modal.vue +226 -226
  29. package/vue/components/Pagination.vue +199 -199
  30. package/vue/components/Select.vue +713 -713
  31. package/vue/components/Sidebar.vue +955 -955
  32. package/vue/components/Skeleton.vue +91 -91
  33. package/vue/components/Spinner.vue +263 -263
  34. package/vue/components/StatusTag.vue +89 -89
  35. package/vue/components/TabBar.vue +176 -176
  36. package/vue/components/Table.vue +388 -388
  37. package/vue/components/TimePicker.vue +399 -399
  38. package/vue/components/Toggle.vue +115 -115
  39. package/vue/components/XTable.vue +119 -119
  40. package/vue/composables/useAutoSkeletonRows.ts +71 -71
  41. package/vue/index.d.ts +67 -67
  42. package/vue/index.js +86 -86
@@ -1,226 +1,226 @@
1
- <script setup lang="ts">
2
- import { ref, watch, onUnmounted, computed } from "vue";
3
- import { X } from "lucide-vue-next";
4
-
5
- const props = withDefaults(
6
- defineProps<{
7
- modelValue?: boolean;
8
- open?: boolean;
9
- title?: string;
10
- maxWidth?: number | string;
11
- maxHeight?: number | string;
12
- showClose?: boolean;
13
- bodyStyle?: Record<string, any>;
14
- style?: Record<string, any>;
15
- }>(),
16
- {
17
- modelValue: false,
18
- open: false,
19
- title: "",
20
- maxWidth: 520,
21
- showClose: true,
22
- bodyStyle: () => ({}),
23
- style: () => ({}),
24
- }
25
- );
26
-
27
- const emit = defineEmits<{
28
- (e: "update:modelValue", value: boolean): void;
29
- (e: "close"): void;
30
- }>();
31
-
32
- const isOpen = computed(() => props.modelValue || props.open);
33
- const closing = ref(false);
34
-
35
- const STYLES = `
36
- @keyframes cynxModalFadeIn { from { opacity: 0; } to { opacity: 1; } }
37
- @keyframes cynxModalFadeOut { from { opacity: 1; } to { opacity: 0; } }
38
- @keyframes cynxModalCardIn { from { opacity: 0; transform: scale(.96) translateY(-8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
39
- @keyframes cynxModalCardOut { from { opacity: 1; transform: scale(1) translateY(0); } to { opacity: 0; transform: scale(.96) translateY(-8px); } }
40
- `;
41
-
42
- let _id = "cynx-modal-styles";
43
- function ensureStyles() {
44
- if (typeof document === "undefined") return;
45
- if (document.getElementById(_id)) return;
46
- const tag = document.createElement("style");
47
- tag.id = _id;
48
- tag.textContent = STYLES;
49
- document.head.appendChild(tag);
50
- }
51
-
52
- if (typeof document !== "undefined") ensureStyles();
53
-
54
- function close() {
55
- if (closing.value) return;
56
- closing.value = true;
57
- setTimeout(() => {
58
- closing.value = false;
59
- emit("update:modelValue", false);
60
- emit("close");
61
- }, 260);
62
- }
63
-
64
- function handleKeydown(e: KeyboardEvent) {
65
- if (e.key === "Escape" && isOpen.value) {
66
- close();
67
- }
68
- }
69
-
70
- watch(
71
- isOpen,
72
- (val) => {
73
- if (typeof document === "undefined") return;
74
- if (val) {
75
- document.body.style.overflow = "hidden";
76
- window.addEventListener("keydown", handleKeydown);
77
- } else {
78
- document.body.style.overflow = "";
79
- window.removeEventListener("keydown", handleKeydown);
80
- }
81
- },
82
- { immediate: true }
83
- );
84
-
85
- onUnmounted(() => {
86
- if (typeof document !== "undefined") {
87
- document.body.style.overflow = "";
88
- window.removeEventListener("keydown", handleKeydown);
89
- }
90
- });
91
-
92
- const resolvedMaxWidth = computed(() => {
93
- if (typeof props.maxWidth === "number") return `${props.maxWidth}px`;
94
- return props.maxWidth;
95
- });
96
-
97
- const resolvedMaxHeight = computed(() => {
98
- if (props.maxHeight) {
99
- return typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight;
100
- }
101
- return "85vh";
102
- });
103
- </script>
104
-
105
- <template>
106
- <Teleport to="body">
107
- <div
108
- v-if="isOpen || closing"
109
- class="cynx-modal-backdrop"
110
- :style="{
111
- position: 'fixed',
112
- inset: 0,
113
- background: 'rgba(20, 22, 41, .45)',
114
- display: 'flex',
115
- alignItems: 'center',
116
- justifyContent: 'center',
117
- zIndex: 8000,
118
- padding: '20px',
119
- animation: `${closing ? 'cynxModalFadeOut' : 'cynxModalFadeIn'} .26s ease forwards`,
120
- }"
121
- @mousedown.self="close"
122
- >
123
- <div
124
- class="cynx-modal-card"
125
- :style="{
126
- background: 'var(--surface, #ffffff)',
127
- border: '1px solid var(--border, #e2e8f0)',
128
- borderRadius: '14px',
129
- width: '100%',
130
- maxWidth: resolvedMaxWidth,
131
- maxHeight: resolvedMaxHeight,
132
- boxShadow: 'var(--shadow-lg, 0 20px 60px rgba(0, 0, 0, .25))',
133
- overflow: 'hidden',
134
- display: 'flex',
135
- flexDirection: 'column',
136
- animation: `${closing ? 'cynxModalCardOut' : 'cynxModalCardIn'} .26s cubic-bezier(.4, 0, .2, 1) forwards`,
137
- ...style,
138
- }"
139
- @mousedown.stop
140
- >
141
- <!-- Modal Header -->
142
- <div
143
- class="cynx-modal-hdr"
144
- :style="{
145
- display: 'flex',
146
- alignItems: 'center',
147
- justifyContent: 'space-between',
148
- padding: '15px 20px',
149
- borderBottom: '1px solid var(--border-light, #ebebf0)',
150
- borderRadius: '14px 14px 0 0',
151
- flexShrink: 0,
152
- }"
153
- >
154
- <slot name="header">
155
- <span
156
- class="cynx-modal-title"
157
- :style="{
158
- fontSize: '.95rem',
159
- fontWeight: 700,
160
- letterSpacing: '-.01em',
161
- color: 'var(--t, var(--primary-text, #0f111c))',
162
- }"
163
- >
164
- {{ title }}
165
- </span>
166
- </slot>
167
-
168
- <button
169
- v-if="showClose"
170
- type="button"
171
- class="cynx-modal-close"
172
- :style="{
173
- background: 'none',
174
- border: 'none',
175
- cursor: 'pointer',
176
- padding: '4px',
177
- borderRadius: '6px',
178
- color: 'var(--muted, #797b8d)',
179
- display: 'flex',
180
- alignItems: 'center',
181
- justifyContent: 'center',
182
- transition: 'all .14s',
183
- }"
184
- @click="close"
185
- >
186
- <X :size="16" />
187
- </button>
188
- </div>
189
-
190
- <!-- Modal Body -->
191
- <div
192
- class="cynx-modal-body custom-scrollbar"
193
- :style="{
194
- padding: '20px',
195
- overflowX: 'hidden',
196
- overflowY: 'auto',
197
- flex: '1 1 auto',
198
- minHeight: 0,
199
- color: 'var(--t, var(--primary-text, #0f111c))',
200
- ...bodyStyle,
201
- }"
202
- >
203
- <slot />
204
- </div>
205
-
206
- <!-- Modal Footer -->
207
- <div
208
- v-if="$slots.footer"
209
- class="cynx-modal-footer"
210
- :style="{
211
- display: 'flex',
212
- justifyContent: 'flex-end',
213
- gap: '8px',
214
- padding: '13px 20px',
215
- borderTop: '1px solid var(--border-light, #ebebf0)',
216
- background: 'var(--grey-1, #f5f5f8)',
217
- borderRadius: '0 0 14px 14px',
218
- flexShrink: 0,
219
- }"
220
- >
221
- <slot name="footer" />
222
- </div>
223
- </div>
224
- </div>
225
- </Teleport>
226
- </template>
1
+ <script setup lang="ts">
2
+ import { ref, watch, onUnmounted, computed } from "vue";
3
+ import { X } from "lucide-vue-next";
4
+
5
+ const props = withDefaults(
6
+ defineProps<{
7
+ modelValue?: boolean;
8
+ open?: boolean;
9
+ title?: string;
10
+ maxWidth?: number | string;
11
+ maxHeight?: number | string;
12
+ showClose?: boolean;
13
+ bodyStyle?: Record<string, any>;
14
+ style?: Record<string, any>;
15
+ }>(),
16
+ {
17
+ modelValue: false,
18
+ open: false,
19
+ title: "",
20
+ maxWidth: 520,
21
+ showClose: true,
22
+ bodyStyle: () => ({}),
23
+ style: () => ({}),
24
+ }
25
+ );
26
+
27
+ const emit = defineEmits<{
28
+ (e: "update:modelValue", value: boolean): void;
29
+ (e: "close"): void;
30
+ }>();
31
+
32
+ const isOpen = computed(() => props.modelValue || props.open);
33
+ const closing = ref(false);
34
+
35
+ const STYLES = `
36
+ @keyframes cynxModalFadeIn { from { opacity: 0; } to { opacity: 1; } }
37
+ @keyframes cynxModalFadeOut { from { opacity: 1; } to { opacity: 0; } }
38
+ @keyframes cynxModalCardIn { from { opacity: 0; transform: scale(.96) translateY(-8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
39
+ @keyframes cynxModalCardOut { from { opacity: 1; transform: scale(1) translateY(0); } to { opacity: 0; transform: scale(.96) translateY(-8px); } }
40
+ `;
41
+
42
+ let _id = "cynx-modal-styles";
43
+ function ensureStyles() {
44
+ if (typeof document === "undefined") return;
45
+ if (document.getElementById(_id)) return;
46
+ const tag = document.createElement("style");
47
+ tag.id = _id;
48
+ tag.textContent = STYLES;
49
+ document.head.appendChild(tag);
50
+ }
51
+
52
+ if (typeof document !== "undefined") ensureStyles();
53
+
54
+ function close() {
55
+ if (closing.value) return;
56
+ closing.value = true;
57
+ setTimeout(() => {
58
+ closing.value = false;
59
+ emit("update:modelValue", false);
60
+ emit("close");
61
+ }, 260);
62
+ }
63
+
64
+ function handleKeydown(e: KeyboardEvent) {
65
+ if (e.key === "Escape" && isOpen.value) {
66
+ close();
67
+ }
68
+ }
69
+
70
+ watch(
71
+ isOpen,
72
+ (val) => {
73
+ if (typeof document === "undefined") return;
74
+ if (val) {
75
+ document.body.style.overflow = "hidden";
76
+ window.addEventListener("keydown", handleKeydown);
77
+ } else {
78
+ document.body.style.overflow = "";
79
+ window.removeEventListener("keydown", handleKeydown);
80
+ }
81
+ },
82
+ { immediate: true }
83
+ );
84
+
85
+ onUnmounted(() => {
86
+ if (typeof document !== "undefined") {
87
+ document.body.style.overflow = "";
88
+ window.removeEventListener("keydown", handleKeydown);
89
+ }
90
+ });
91
+
92
+ const resolvedMaxWidth = computed(() => {
93
+ if (typeof props.maxWidth === "number") return `${props.maxWidth}px`;
94
+ return props.maxWidth;
95
+ });
96
+
97
+ const resolvedMaxHeight = computed(() => {
98
+ if (props.maxHeight) {
99
+ return typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight;
100
+ }
101
+ return "85vh";
102
+ });
103
+ </script>
104
+
105
+ <template>
106
+ <Teleport to="body">
107
+ <div
108
+ v-if="isOpen || closing"
109
+ class="cynx-modal-backdrop"
110
+ :style="{
111
+ position: 'fixed',
112
+ inset: 0,
113
+ background: 'rgba(20, 22, 41, .45)',
114
+ display: 'flex',
115
+ alignItems: 'center',
116
+ justifyContent: 'center',
117
+ zIndex: 8000,
118
+ padding: '20px',
119
+ animation: `${closing ? 'cynxModalFadeOut' : 'cynxModalFadeIn'} .26s ease forwards`,
120
+ }"
121
+ @mousedown.self="close"
122
+ >
123
+ <div
124
+ class="cynx-modal-card"
125
+ :style="{
126
+ background: 'var(--surface, #ffffff)',
127
+ border: '1px solid var(--border, #e2e8f0)',
128
+ borderRadius: '14px',
129
+ width: '100%',
130
+ maxWidth: resolvedMaxWidth,
131
+ maxHeight: resolvedMaxHeight,
132
+ boxShadow: 'var(--shadow-lg, 0 20px 60px rgba(0, 0, 0, .25))',
133
+ overflow: 'hidden',
134
+ display: 'flex',
135
+ flexDirection: 'column',
136
+ animation: `${closing ? 'cynxModalCardOut' : 'cynxModalCardIn'} .26s cubic-bezier(.4, 0, .2, 1) forwards`,
137
+ ...style,
138
+ }"
139
+ @mousedown.stop
140
+ >
141
+ <!-- Modal Header -->
142
+ <div
143
+ class="cynx-modal-hdr"
144
+ :style="{
145
+ display: 'flex',
146
+ alignItems: 'center',
147
+ justifyContent: 'space-between',
148
+ padding: '15px 20px',
149
+ borderBottom: '1px solid var(--border-light, #ebebf0)',
150
+ borderRadius: '14px 14px 0 0',
151
+ flexShrink: 0,
152
+ }"
153
+ >
154
+ <slot name="header">
155
+ <span
156
+ class="cynx-modal-title"
157
+ :style="{
158
+ fontSize: '.95rem',
159
+ fontWeight: 700,
160
+ letterSpacing: '-.01em',
161
+ color: 'var(--t, var(--primary-text, #0f111c))',
162
+ }"
163
+ >
164
+ {{ title }}
165
+ </span>
166
+ </slot>
167
+
168
+ <button
169
+ v-if="showClose"
170
+ type="button"
171
+ class="cynx-modal-close"
172
+ :style="{
173
+ background: 'none',
174
+ border: 'none',
175
+ cursor: 'pointer',
176
+ padding: '4px',
177
+ borderRadius: '6px',
178
+ color: 'var(--muted, #797b8d)',
179
+ display: 'flex',
180
+ alignItems: 'center',
181
+ justifyContent: 'center',
182
+ transition: 'all .14s',
183
+ }"
184
+ @click="close"
185
+ >
186
+ <X :size="16" />
187
+ </button>
188
+ </div>
189
+
190
+ <!-- Modal Body -->
191
+ <div
192
+ class="cynx-modal-body custom-scrollbar"
193
+ :style="{
194
+ padding: '20px',
195
+ overflowX: 'hidden',
196
+ overflowY: 'auto',
197
+ flex: '1 1 auto',
198
+ minHeight: 0,
199
+ color: 'var(--t, var(--primary-text, #0f111c))',
200
+ ...bodyStyle,
201
+ }"
202
+ >
203
+ <slot />
204
+ </div>
205
+
206
+ <!-- Modal Footer -->
207
+ <div
208
+ v-if="$slots.footer"
209
+ class="cynx-modal-footer"
210
+ :style="{
211
+ display: 'flex',
212
+ justifyContent: 'flex-end',
213
+ gap: '8px',
214
+ padding: '13px 20px',
215
+ borderTop: '1px solid var(--border-light, #ebebf0)',
216
+ background: 'var(--grey-1, #f5f5f8)',
217
+ borderRadius: '0 0 14px 14px',
218
+ flexShrink: 0,
219
+ }"
220
+ >
221
+ <slot name="footer" />
222
+ </div>
223
+ </div>
224
+ </div>
225
+ </Teleport>
226
+ </template>