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,199 +1,199 @@
1
- <script setup lang="ts">
2
- import { computed } from "vue";
3
- import { ChevronLeft, ChevronRight } from "lucide-vue-next";
4
-
5
- const props = withDefaults(
6
- defineProps<{
7
- page?: number;
8
- pages?: number;
9
- total?: number;
10
- perPage?: number;
11
- pageSize?: number;
12
- disabled?: boolean;
13
- size?: "xs" | "sm" | "md" | "lg";
14
- }>(),
15
- {
16
- page: 1,
17
- pages: 1,
18
- total: 0,
19
- perPage: 20,
20
- disabled: false,
21
- size: "md",
22
- }
23
- );
24
-
25
- const emit = defineEmits<{
26
- (e: "update:page", page: number): void;
27
- (e: "change", page: number): void;
28
- }>();
29
-
30
- const effectivePerPage = computed(() => props.pageSize || props.perPage || 20);
31
-
32
- const totalPages = computed(() => {
33
- if (props.pages && props.pages > 1) return props.pages;
34
- if (props.total && effectivePerPage.value) {
35
- return Math.ceil(props.total / effectivePerPage.value);
36
- }
37
- return 1;
38
- });
39
-
40
- const pageItems = computed(() => {
41
- const totalP = totalPages.value;
42
- if (!totalP || totalP <= 1) return [];
43
-
44
- const cur = props.page || 1;
45
- const items: (number | string)[] = [];
46
-
47
- for (let i = 1; i <= totalP; i++) {
48
- if (i === 1 || i === totalP || (i >= cur - 1 && i <= cur + 1)) {
49
- items.push(i);
50
- } else if (items[items.length - 1] !== "...") {
51
- items.push("...");
52
- }
53
- }
54
-
55
- return items;
56
- });
57
-
58
- const startItem = computed(() => {
59
- if (!props.total) return null;
60
- return (props.page - 1) * effectivePerPage.value + 1;
61
- });
62
-
63
- const endItem = computed(() => {
64
- if (!props.total) return null;
65
- return Math.min(props.page * effectivePerPage.value, props.total);
66
- });
67
-
68
- const handlePageChange = (newPage: number) => {
69
- if (props.disabled || newPage < 1 || newPage > totalPages.value || newPage === props.page) return;
70
- emit("update:page", newPage);
71
- emit("change", newPage);
72
- };
73
-
74
- const SIZES = {
75
- xs: { box: 26, icon: 13, font: "11px", gap: "6px" },
76
- sm: { box: 30, icon: 15, font: "12px", gap: "8px" },
77
- md: { box: 34, icon: 17, font: "13.5px", gap: "10px" },
78
- lg: { box: 38, icon: 19, font: "15px", gap: "12px" },
79
- };
80
-
81
- const currentSize = computed(() => SIZES[props.size] || SIZES.md);
82
- </script>
83
-
84
- <template>
85
- <div
86
- v-if="totalPages > 1 || (total != null && total > 0)"
87
- class="flex items-center justify-between w-full py-2 select-none"
88
- >
89
- <!-- Info Counter -->
90
- <div v-if="startItem !== null" class="text-xs text-slate-500 dark:text-slate-400 font-mono">
91
- {{ startItem }}–{{ endItem }} of {{ total }}
92
- </div>
93
- <div v-else />
94
-
95
- <!-- Page Controls Container -->
96
- <div
97
- class="flex items-center"
98
- :style="{ gap: currentSize.gap }"
99
- >
100
- <!-- Prev Arrow Button (Card Style) -->
101
- <button
102
- type="button"
103
- :disabled="disabled || page <= 1"
104
- class="cynx-page-arrow inline-flex items-center justify-center transition-all"
105
- :style="{
106
- width: `${currentSize.box}px`,
107
- height: `${currentSize.box}px`,
108
- borderRadius: 'var(--radm, var(--rads, var(--radius, 10px)))',
109
- background: 'var(--surface, #ffffff)',
110
- border: '1px solid var(--border, var(--bd, #e2e8f0))',
111
- boxShadow: '0 2px 5px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02)',
112
- color: 'var(--muted, #64748b)',
113
- cursor: disabled || page <= 1 ? 'not-allowed' : 'pointer',
114
- opacity: disabled || page <= 1 ? 0.35 : 1,
115
- }"
116
- title="Previous page"
117
- @click="handlePageChange(page - 1)"
118
- >
119
- <ChevronLeft :size="currentSize.icon" :stroke-width="2.2" />
120
- </button>
121
-
122
- <!-- Page Numbers / Ellipsis -->
123
- <template v-for="(item, i) in pageItems" :key="`page-${i}`">
124
- <!-- Ellipsis -->
125
- <span
126
- v-if="item === '...'"
127
- class="inline-flex items-center justify-center text-slate-400 dark:text-slate-500 select-none font-medium"
128
- :style="{
129
- minWidth: `${currentSize.box}px`,
130
- height: `${currentSize.box}px`,
131
- fontSize: currentSize.font,
132
- }"
133
- >
134
- …
135
- </span>
136
-
137
- <!-- Page Button -->
138
- <button
139
- v-else
140
- type="button"
141
- :disabled="disabled"
142
- class="cynx-page-num inline-flex items-center justify-center transition-all"
143
- :class="[
144
- item === page ? 'cynx-page-num--active font-semibold' : 'cynx-page-num--inactive font-medium hover:bg-slate-100/70 dark:hover:bg-slate-800/70'
145
- ]"
146
- :style="{
147
- minWidth: `${currentSize.box}px`,
148
- height: `${currentSize.box}px`,
149
- padding: '0 6px',
150
- borderRadius: 'var(--radm, var(--rads, var(--radius, 10px)))',
151
- fontSize: currentSize.font,
152
- background: item === page ? 'var(--accent, #12675D)' : 'transparent',
153
- color: item === page ? '#ffffff' : 'var(--muted, #64748b)',
154
- boxShadow: item === page ? '0 3px 8px rgba(0, 0, 0, 0.12)' : 'none',
155
- border: 'none',
156
- cursor: disabled ? 'not-allowed' : 'pointer',
157
- }"
158
- @click="handlePageChange(Number(item))"
159
- >
160
- {{ item }}
161
- </button>
162
- </template>
163
-
164
- <!-- Next Arrow Button (Card Style) -->
165
- <button
166
- type="button"
167
- :disabled="disabled || page >= totalPages"
168
- class="cynx-page-arrow inline-flex items-center justify-center transition-all"
169
- :style="{
170
- width: `${currentSize.box}px`,
171
- height: `${currentSize.box}px`,
172
- borderRadius: 'var(--radm, var(--rads, var(--radius, 10px)))',
173
- background: 'var(--surface, #ffffff)',
174
- border: '1px solid var(--border, var(--bd, #e2e8f0))',
175
- boxShadow: '0 2px 5px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02)',
176
- color: 'var(--muted, #64748b)',
177
- cursor: disabled || page >= totalPages ? 'not-allowed' : 'pointer',
178
- opacity: disabled || page >= totalPages ? 0.35 : 1,
179
- }"
180
- title="Next page"
181
- @click="handlePageChange(page + 1)"
182
- >
183
- <ChevronRight :size="currentSize.icon" :stroke-width="2.2" />
184
- </button>
185
- </div>
186
- </div>
187
- </template>
188
-
189
- <style scoped>
190
- .cynx-page-arrow:not(:disabled):hover {
191
- color: var(--t, #0f111c);
192
- border-color: var(--border-hover, #cbd5e1);
193
- box-shadow: 0 4px 10px rgba(0, 0, 0, 0.07);
194
- }
195
-
196
- .cynx-page-num--inactive:not(:disabled):hover {
197
- color: var(--t, #0f111c);
198
- }
199
- </style>
1
+ <script setup lang="ts">
2
+ import { computed } from "vue";
3
+ import { ChevronLeft, ChevronRight } from "lucide-vue-next";
4
+
5
+ const props = withDefaults(
6
+ defineProps<{
7
+ page?: number;
8
+ pages?: number;
9
+ total?: number;
10
+ perPage?: number;
11
+ pageSize?: number;
12
+ disabled?: boolean;
13
+ size?: "xs" | "sm" | "md" | "lg";
14
+ }>(),
15
+ {
16
+ page: 1,
17
+ pages: 1,
18
+ total: 0,
19
+ perPage: 20,
20
+ disabled: false,
21
+ size: "md",
22
+ }
23
+ );
24
+
25
+ const emit = defineEmits<{
26
+ (e: "update:page", page: number): void;
27
+ (e: "change", page: number): void;
28
+ }>();
29
+
30
+ const effectivePerPage = computed(() => props.pageSize || props.perPage || 20);
31
+
32
+ const totalPages = computed(() => {
33
+ if (props.pages && props.pages > 1) return props.pages;
34
+ if (props.total && effectivePerPage.value) {
35
+ return Math.ceil(props.total / effectivePerPage.value);
36
+ }
37
+ return 1;
38
+ });
39
+
40
+ const pageItems = computed(() => {
41
+ const totalP = totalPages.value;
42
+ if (!totalP || totalP <= 1) return [];
43
+
44
+ const cur = props.page || 1;
45
+ const items: (number | string)[] = [];
46
+
47
+ for (let i = 1; i <= totalP; i++) {
48
+ if (i === 1 || i === totalP || (i >= cur - 1 && i <= cur + 1)) {
49
+ items.push(i);
50
+ } else if (items[items.length - 1] !== "...") {
51
+ items.push("...");
52
+ }
53
+ }
54
+
55
+ return items;
56
+ });
57
+
58
+ const startItem = computed(() => {
59
+ if (!props.total) return null;
60
+ return (props.page - 1) * effectivePerPage.value + 1;
61
+ });
62
+
63
+ const endItem = computed(() => {
64
+ if (!props.total) return null;
65
+ return Math.min(props.page * effectivePerPage.value, props.total);
66
+ });
67
+
68
+ const handlePageChange = (newPage: number) => {
69
+ if (props.disabled || newPage < 1 || newPage > totalPages.value || newPage === props.page) return;
70
+ emit("update:page", newPage);
71
+ emit("change", newPage);
72
+ };
73
+
74
+ const SIZES = {
75
+ xs: { box: 26, icon: 13, font: "11px", gap: "6px" },
76
+ sm: { box: 30, icon: 15, font: "12px", gap: "8px" },
77
+ md: { box: 34, icon: 17, font: "13.5px", gap: "10px" },
78
+ lg: { box: 38, icon: 19, font: "15px", gap: "12px" },
79
+ };
80
+
81
+ const currentSize = computed(() => SIZES[props.size] || SIZES.md);
82
+ </script>
83
+
84
+ <template>
85
+ <div
86
+ v-if="totalPages > 1 || (total != null && total > 0)"
87
+ class="flex items-center justify-between w-full py-2 select-none"
88
+ >
89
+ <!-- Info Counter -->
90
+ <div v-if="startItem !== null" class="text-xs text-slate-500 dark:text-slate-400 font-mono">
91
+ {{ startItem }}–{{ endItem }} of {{ total }}
92
+ </div>
93
+ <div v-else />
94
+
95
+ <!-- Page Controls Container -->
96
+ <div
97
+ class="flex items-center"
98
+ :style="{ gap: currentSize.gap }"
99
+ >
100
+ <!-- Prev Arrow Button (Card Style) -->
101
+ <button
102
+ type="button"
103
+ :disabled="disabled || page <= 1"
104
+ class="cynx-page-arrow inline-flex items-center justify-center transition-all"
105
+ :style="{
106
+ width: `${currentSize.box}px`,
107
+ height: `${currentSize.box}px`,
108
+ borderRadius: 'var(--radm, var(--rads, var(--radius, 10px)))',
109
+ background: 'var(--surface, #ffffff)',
110
+ border: '1px solid var(--border, var(--bd, #e2e8f0))',
111
+ boxShadow: '0 2px 5px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02)',
112
+ color: 'var(--muted, #64748b)',
113
+ cursor: disabled || page <= 1 ? 'not-allowed' : 'pointer',
114
+ opacity: disabled || page <= 1 ? 0.35 : 1,
115
+ }"
116
+ title="Previous page"
117
+ @click="handlePageChange(page - 1)"
118
+ >
119
+ <ChevronLeft :size="currentSize.icon" :stroke-width="2.2" />
120
+ </button>
121
+
122
+ <!-- Page Numbers / Ellipsis -->
123
+ <template v-for="(item, i) in pageItems" :key="`page-${i}`">
124
+ <!-- Ellipsis -->
125
+ <span
126
+ v-if="item === '...'"
127
+ class="inline-flex items-center justify-center text-slate-400 dark:text-slate-500 select-none font-medium"
128
+ :style="{
129
+ minWidth: `${currentSize.box}px`,
130
+ height: `${currentSize.box}px`,
131
+ fontSize: currentSize.font,
132
+ }"
133
+ >
134
+ …
135
+ </span>
136
+
137
+ <!-- Page Button -->
138
+ <button
139
+ v-else
140
+ type="button"
141
+ :disabled="disabled"
142
+ class="cynx-page-num inline-flex items-center justify-center transition-all"
143
+ :class="[
144
+ item === page ? 'cynx-page-num--active font-semibold' : 'cynx-page-num--inactive font-medium hover:bg-slate-100/70 dark:hover:bg-slate-800/70'
145
+ ]"
146
+ :style="{
147
+ minWidth: `${currentSize.box}px`,
148
+ height: `${currentSize.box}px`,
149
+ padding: '0 6px',
150
+ borderRadius: 'var(--radm, var(--rads, var(--radius, 10px)))',
151
+ fontSize: currentSize.font,
152
+ background: item === page ? 'var(--accent, #12675D)' : 'transparent',
153
+ color: item === page ? '#ffffff' : 'var(--muted, #64748b)',
154
+ boxShadow: item === page ? '0 3px 8px rgba(0, 0, 0, 0.12)' : 'none',
155
+ border: 'none',
156
+ cursor: disabled ? 'not-allowed' : 'pointer',
157
+ }"
158
+ @click="handlePageChange(Number(item))"
159
+ >
160
+ {{ item }}
161
+ </button>
162
+ </template>
163
+
164
+ <!-- Next Arrow Button (Card Style) -->
165
+ <button
166
+ type="button"
167
+ :disabled="disabled || page >= totalPages"
168
+ class="cynx-page-arrow inline-flex items-center justify-center transition-all"
169
+ :style="{
170
+ width: `${currentSize.box}px`,
171
+ height: `${currentSize.box}px`,
172
+ borderRadius: 'var(--radm, var(--rads, var(--radius, 10px)))',
173
+ background: 'var(--surface, #ffffff)',
174
+ border: '1px solid var(--border, var(--bd, #e2e8f0))',
175
+ boxShadow: '0 2px 5px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02)',
176
+ color: 'var(--muted, #64748b)',
177
+ cursor: disabled || page >= totalPages ? 'not-allowed' : 'pointer',
178
+ opacity: disabled || page >= totalPages ? 0.35 : 1,
179
+ }"
180
+ title="Next page"
181
+ @click="handlePageChange(page + 1)"
182
+ >
183
+ <ChevronRight :size="currentSize.icon" :stroke-width="2.2" />
184
+ </button>
185
+ </div>
186
+ </div>
187
+ </template>
188
+
189
+ <style scoped>
190
+ .cynx-page-arrow:not(:disabled):hover {
191
+ color: var(--t, #0f111c);
192
+ border-color: var(--border-hover, #cbd5e1);
193
+ box-shadow: 0 4px 10px rgba(0, 0, 0, 0.07);
194
+ }
195
+
196
+ .cynx-page-num--inactive:not(:disabled):hover {
197
+ color: var(--t, #0f111c);
198
+ }
199
+ </style>