cynx-lib 1.3.84 → 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 (40) 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/Pagination.jsx +145 -145
  5. package/ui/components/PrivacyBlur.jsx +603 -603
  6. package/utils/index.cjs +5 -0
  7. package/utils/index.js +22 -20
  8. package/utils/utils/duration.js +139 -139
  9. package/utils/utils/oidc.js +214 -214
  10. package/utils/utils/realtime.js +1634 -1634
  11. package/utils/utils/session.cjs +15 -2
  12. package/utils/utils/session.js +67 -58
  13. package/utils/utils/session_manager.cjs +490 -0
  14. package/utils/utils/session_manager.js +549 -0
  15. package/utils/utils/storage.js +393 -393
  16. package/utils/utils/ui.js +111 -111
  17. package/vue/components/Badge.vue +79 -79
  18. package/vue/components/Button.vue +209 -209
  19. package/vue/components/Checkbox.vue +103 -103
  20. package/vue/components/CircularProgress.vue +383 -383
  21. package/vue/components/Divider.vue +94 -94
  22. package/vue/components/Drawer.vue +243 -243
  23. package/vue/components/InfoBadge.vue +223 -223
  24. package/vue/components/Input.vue +341 -341
  25. package/vue/components/LinearProgress.vue +268 -268
  26. package/vue/components/Modal.vue +226 -226
  27. package/vue/components/Pagination.vue +199 -199
  28. package/vue/components/Select.vue +713 -713
  29. package/vue/components/Sidebar.vue +955 -955
  30. package/vue/components/Skeleton.vue +91 -91
  31. package/vue/components/Spinner.vue +263 -263
  32. package/vue/components/StatusTag.vue +89 -89
  33. package/vue/components/TabBar.vue +176 -176
  34. package/vue/components/Table.vue +388 -388
  35. package/vue/components/TimePicker.vue +399 -399
  36. package/vue/components/Toggle.vue +115 -115
  37. package/vue/components/XTable.vue +119 -119
  38. package/vue/composables/useAutoSkeletonRows.ts +71 -71
  39. package/vue/index.d.ts +67 -67
  40. package/vue/index.js +86 -86
@@ -1,115 +1,115 @@
1
- <script setup lang="ts">
2
- import { computed } from "vue";
3
-
4
- const SIZES: Record<string, { w: number; h: number; r: number; dot: number; off: number; on: number }> = {
5
- sm: { w: 28, h: 16, r: 8, dot: 12, off: 2, on: 14 },
6
- md: { w: 34, h: 18, r: 9, dot: 14, off: 2, on: 18 },
7
- lg: { w: 44, h: 24, r: 12, dot: 18, off: 3, on: 23 },
8
- };
9
-
10
- const COLORS: Record<string, string> = {
11
- primary: "var(--accent, #12675D)",
12
- success: "var(--success, var(--s, #27ae60))",
13
- warning: "var(--warning, var(--w, #f59e0b))",
14
- danger: "var(--danger, var(--d, #f64747))",
15
- };
16
-
17
- const OFF_COLOR = "var(--border, var(--bd, #d7d8e0))";
18
-
19
- const props = withDefaults(
20
- defineProps<{
21
- modelValue?: boolean;
22
- checked?: boolean;
23
- disabled?: boolean;
24
- size?: "sm" | "md" | "lg";
25
- color?: "primary" | "success" | "warning" | "danger";
26
- label?: string;
27
- labelStyle?: Record<string, any>;
28
- className?: string;
29
- style?: Record<string, any>;
30
- }>(),
31
- {
32
- modelValue: false,
33
- checked: false,
34
- disabled: false,
35
- size: "md",
36
- color: "primary",
37
- label: "",
38
- labelStyle: () => ({}),
39
- className: "",
40
- style: () => ({}),
41
- }
42
- );
43
-
44
- const emit = defineEmits<{
45
- (e: "update:modelValue", value: boolean): void;
46
- (e: "change", value: boolean): void;
47
- }>();
48
-
49
- const isChecked = computed(() => (props.modelValue !== undefined ? props.modelValue : props.checked));
50
- const s = computed(() => SIZES[props.size] || SIZES.md);
51
- const trackBg = computed(() => (isChecked.value ? (COLORS[props.color] || COLORS.primary) : OFF_COLOR));
52
-
53
- const toggle = () => {
54
- if (props.disabled) return;
55
- const next = !isChecked.value;
56
- emit("update:modelValue", next);
57
- emit("change", next);
58
- };
59
- </script>
60
-
61
- <template>
62
- <label
63
- :class="['cynx-toggle-label', className]"
64
- :style="{
65
- display: 'inline-flex',
66
- alignItems: 'center',
67
- gap: '8px',
68
- cursor: disabled ? 'not-allowed' : 'pointer',
69
- userSelect: 'none',
70
- opacity: disabled ? 0.4 : 1,
71
- ...style,
72
- }"
73
- @click.prevent="toggle"
74
- >
75
- <input
76
- type="checkbox"
77
- :checked="isChecked"
78
- :disabled="disabled"
79
- style="position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;"
80
- />
81
- <span
82
- class="cynx-toggle-track"
83
- :style="{
84
- position: 'relative',
85
- width: `${s.w}px`,
86
- height: `${s.h}px`,
87
- borderRadius: `${s.r}px`,
88
- background: trackBg,
89
- flexShrink: 0,
90
- transition: 'background .25s ease',
91
- boxShadow: 'var(--shadow-sm, 0 1px 3px rgba(20,22,41,.1))',
92
- }"
93
- >
94
- <span
95
- class="cynx-toggle-dot"
96
- :style="{
97
- position: 'absolute',
98
- top: '50%',
99
- transform: 'translateY(-50%)',
100
- left: `${isChecked ? s.on : s.off}px`,
101
- width: `${s.dot}px`,
102
- height: `${s.dot}px`,
103
- background: 'var(--surface, #ffffff)',
104
- borderRadius: '50%',
105
- boxShadow: '0 1px 3px rgba(0,0,0,.25)',
106
- transition: 'left .3s cubic-bezier(.34,1.56,.64,1), transform .2s ease',
107
- willChange: 'left',
108
- }"
109
- />
110
- </span>
111
- <span v-if="label || $slots.default" :style="labelStyle" class="cynx-toggle-text">
112
- <slot>{{ label }}</slot>
113
- </span>
114
- </label>
115
- </template>
1
+ <script setup lang="ts">
2
+ import { computed } from "vue";
3
+
4
+ const SIZES: Record<string, { w: number; h: number; r: number; dot: number; off: number; on: number }> = {
5
+ sm: { w: 28, h: 16, r: 8, dot: 12, off: 2, on: 14 },
6
+ md: { w: 34, h: 18, r: 9, dot: 14, off: 2, on: 18 },
7
+ lg: { w: 44, h: 24, r: 12, dot: 18, off: 3, on: 23 },
8
+ };
9
+
10
+ const COLORS: Record<string, string> = {
11
+ primary: "var(--accent, #12675D)",
12
+ success: "var(--success, var(--s, #27ae60))",
13
+ warning: "var(--warning, var(--w, #f59e0b))",
14
+ danger: "var(--danger, var(--d, #f64747))",
15
+ };
16
+
17
+ const OFF_COLOR = "var(--border, var(--bd, #d7d8e0))";
18
+
19
+ const props = withDefaults(
20
+ defineProps<{
21
+ modelValue?: boolean;
22
+ checked?: boolean;
23
+ disabled?: boolean;
24
+ size?: "sm" | "md" | "lg";
25
+ color?: "primary" | "success" | "warning" | "danger";
26
+ label?: string;
27
+ labelStyle?: Record<string, any>;
28
+ className?: string;
29
+ style?: Record<string, any>;
30
+ }>(),
31
+ {
32
+ modelValue: false,
33
+ checked: false,
34
+ disabled: false,
35
+ size: "md",
36
+ color: "primary",
37
+ label: "",
38
+ labelStyle: () => ({}),
39
+ className: "",
40
+ style: () => ({}),
41
+ }
42
+ );
43
+
44
+ const emit = defineEmits<{
45
+ (e: "update:modelValue", value: boolean): void;
46
+ (e: "change", value: boolean): void;
47
+ }>();
48
+
49
+ const isChecked = computed(() => (props.modelValue !== undefined ? props.modelValue : props.checked));
50
+ const s = computed(() => SIZES[props.size] || SIZES.md);
51
+ const trackBg = computed(() => (isChecked.value ? (COLORS[props.color] || COLORS.primary) : OFF_COLOR));
52
+
53
+ const toggle = () => {
54
+ if (props.disabled) return;
55
+ const next = !isChecked.value;
56
+ emit("update:modelValue", next);
57
+ emit("change", next);
58
+ };
59
+ </script>
60
+
61
+ <template>
62
+ <label
63
+ :class="['cynx-toggle-label', className]"
64
+ :style="{
65
+ display: 'inline-flex',
66
+ alignItems: 'center',
67
+ gap: '8px',
68
+ cursor: disabled ? 'not-allowed' : 'pointer',
69
+ userSelect: 'none',
70
+ opacity: disabled ? 0.4 : 1,
71
+ ...style,
72
+ }"
73
+ @click.prevent="toggle"
74
+ >
75
+ <input
76
+ type="checkbox"
77
+ :checked="isChecked"
78
+ :disabled="disabled"
79
+ style="position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;"
80
+ />
81
+ <span
82
+ class="cynx-toggle-track"
83
+ :style="{
84
+ position: 'relative',
85
+ width: `${s.w}px`,
86
+ height: `${s.h}px`,
87
+ borderRadius: `${s.r}px`,
88
+ background: trackBg,
89
+ flexShrink: 0,
90
+ transition: 'background .25s ease',
91
+ boxShadow: 'var(--shadow-sm, 0 1px 3px rgba(20,22,41,.1))',
92
+ }"
93
+ >
94
+ <span
95
+ class="cynx-toggle-dot"
96
+ :style="{
97
+ position: 'absolute',
98
+ top: '50%',
99
+ transform: 'translateY(-50%)',
100
+ left: `${isChecked ? s.on : s.off}px`,
101
+ width: `${s.dot}px`,
102
+ height: `${s.dot}px`,
103
+ background: 'var(--surface, #ffffff)',
104
+ borderRadius: '50%',
105
+ boxShadow: '0 1px 3px rgba(0,0,0,.25)',
106
+ transition: 'left .3s cubic-bezier(.34,1.56,.64,1), transform .2s ease',
107
+ willChange: 'left',
108
+ }"
109
+ />
110
+ </span>
111
+ <span v-if="label || $slots.default" :style="labelStyle" class="cynx-toggle-text">
112
+ <slot>{{ label }}</slot>
113
+ </span>
114
+ </label>
115
+ </template>
@@ -1,119 +1,119 @@
1
- <script lang="ts">
2
- import { defineComponent, h } from "vue";
3
-
4
- export const XTable = defineComponent({
5
- name: "XTable",
6
- props: {
7
- style: { type: Object, default: () => ({}) },
8
- },
9
- setup(props, { slots }) {
10
- return () =>
11
- h(
12
- "table",
13
- {
14
- style: {
15
- width: "100%",
16
- borderCollapse: "collapse",
17
- tableLayout: "fixed",
18
- fontSize: ".8rem",
19
- ...props.style,
20
- },
21
- },
22
- slots.default?.()
23
- );
24
- },
25
- });
26
-
27
- export const XThead = defineComponent({
28
- name: "XThead",
29
- setup(_, { slots }) {
30
- return () => h("thead", null, slots.default?.());
31
- },
32
- });
33
-
34
- export const XTbody = defineComponent({
35
- name: "XTbody",
36
- setup(_, { slots }) {
37
- return () => h("tbody", null, slots.default?.());
38
- },
39
- });
40
-
41
- export const XTr = defineComponent({
42
- name: "XTr",
43
- props: {
44
- style: { type: Object, default: () => ({}) },
45
- onClick: { type: Function, default: undefined },
46
- },
47
- setup(props, { slots }) {
48
- return () =>
49
- h(
50
- "tr",
51
- {
52
- onClick: props.onClick,
53
- style: {
54
- borderBottom: "1px solid var(--border-light, #ebebf0)",
55
- transition: "background .12s",
56
- cursor: props.onClick ? "pointer" : undefined,
57
- ...props.style,
58
- },
59
- },
60
- slots.default?.()
61
- );
62
- },
63
- });
64
-
65
- export const XTh = defineComponent({
66
- name: "XTh",
67
- props: {
68
- style: { type: Object, default: () => ({}) },
69
- },
70
- setup(props, { slots }) {
71
- return () =>
72
- h(
73
- "th",
74
- {
75
- style: {
76
- textAlign: "left",
77
- padding: "8px 12px",
78
- fontSize: ".68rem",
79
- fontWeight: 600,
80
- textTransform: "uppercase",
81
- letterSpacing: ".06em",
82
- color: "var(--muted, #9b9daa)",
83
- borderBottom: "1px solid var(--border-light, #ebebf0)",
84
- ...props.style,
85
- },
86
- },
87
- slots.default?.()
88
- );
89
- },
90
- });
91
-
92
- export const XTd = defineComponent({
93
- name: "XTd",
94
- props: {
95
- style: { type: Object, default: () => ({}) },
96
- colSpan: { type: Number, default: undefined },
97
- className: { type: String, default: "" },
98
- },
99
- setup(props, { slots }) {
100
- return () =>
101
- h(
102
- "td",
103
- {
104
- colSpan: props.colSpan,
105
- class: props.className,
106
- style: {
107
- padding: "9px 12px",
108
- verticalAlign: "middle",
109
- color: "var(--primary-text, #0f111c)",
110
- ...props.style,
111
- },
112
- },
113
- slots.default?.()
114
- );
115
- },
116
- });
117
-
118
- export default XTable;
119
- </script>
1
+ <script lang="ts">
2
+ import { defineComponent, h } from "vue";
3
+
4
+ export const XTable = defineComponent({
5
+ name: "XTable",
6
+ props: {
7
+ style: { type: Object, default: () => ({}) },
8
+ },
9
+ setup(props, { slots }) {
10
+ return () =>
11
+ h(
12
+ "table",
13
+ {
14
+ style: {
15
+ width: "100%",
16
+ borderCollapse: "collapse",
17
+ tableLayout: "fixed",
18
+ fontSize: ".8rem",
19
+ ...props.style,
20
+ },
21
+ },
22
+ slots.default?.()
23
+ );
24
+ },
25
+ });
26
+
27
+ export const XThead = defineComponent({
28
+ name: "XThead",
29
+ setup(_, { slots }) {
30
+ return () => h("thead", null, slots.default?.());
31
+ },
32
+ });
33
+
34
+ export const XTbody = defineComponent({
35
+ name: "XTbody",
36
+ setup(_, { slots }) {
37
+ return () => h("tbody", null, slots.default?.());
38
+ },
39
+ });
40
+
41
+ export const XTr = defineComponent({
42
+ name: "XTr",
43
+ props: {
44
+ style: { type: Object, default: () => ({}) },
45
+ onClick: { type: Function, default: undefined },
46
+ },
47
+ setup(props, { slots }) {
48
+ return () =>
49
+ h(
50
+ "tr",
51
+ {
52
+ onClick: props.onClick,
53
+ style: {
54
+ borderBottom: "1px solid var(--border-light, #ebebf0)",
55
+ transition: "background .12s",
56
+ cursor: props.onClick ? "pointer" : undefined,
57
+ ...props.style,
58
+ },
59
+ },
60
+ slots.default?.()
61
+ );
62
+ },
63
+ });
64
+
65
+ export const XTh = defineComponent({
66
+ name: "XTh",
67
+ props: {
68
+ style: { type: Object, default: () => ({}) },
69
+ },
70
+ setup(props, { slots }) {
71
+ return () =>
72
+ h(
73
+ "th",
74
+ {
75
+ style: {
76
+ textAlign: "left",
77
+ padding: "8px 12px",
78
+ fontSize: ".68rem",
79
+ fontWeight: 600,
80
+ textTransform: "uppercase",
81
+ letterSpacing: ".06em",
82
+ color: "var(--muted, #9b9daa)",
83
+ borderBottom: "1px solid var(--border-light, #ebebf0)",
84
+ ...props.style,
85
+ },
86
+ },
87
+ slots.default?.()
88
+ );
89
+ },
90
+ });
91
+
92
+ export const XTd = defineComponent({
93
+ name: "XTd",
94
+ props: {
95
+ style: { type: Object, default: () => ({}) },
96
+ colSpan: { type: Number, default: undefined },
97
+ className: { type: String, default: "" },
98
+ },
99
+ setup(props, { slots }) {
100
+ return () =>
101
+ h(
102
+ "td",
103
+ {
104
+ colSpan: props.colSpan,
105
+ class: props.className,
106
+ style: {
107
+ padding: "9px 12px",
108
+ verticalAlign: "middle",
109
+ color: "var(--primary-text, #0f111c)",
110
+ ...props.style,
111
+ },
112
+ },
113
+ slots.default?.()
114
+ );
115
+ },
116
+ });
117
+
118
+ export default XTable;
119
+ </script>
@@ -1,71 +1,71 @@
1
- import { ref, onMounted, onUnmounted, nextTick, type Ref } from "vue";
2
-
3
- export interface UseAutoSkeletonRowsOptions {
4
- rowHeight?: number;
5
- initialOffset?: number;
6
- bottomBuffer?: number;
7
- minRows?: number;
8
- maxRows?: number;
9
- }
10
-
11
- export function useAutoSkeletonRows(
12
- containerRef: Ref<HTMLElement | null | undefined>,
13
- options: UseAutoSkeletonRowsOptions = {}
14
- ) {
15
- const {
16
- rowHeight = 51,
17
- initialOffset = 240,
18
- bottomBuffer = 72,
19
- minRows = 4,
20
- maxRows = 30,
21
- } = options;
22
-
23
- const rows = ref<number>(
24
- typeof window !== "undefined"
25
- ? Math.max(minRows, Math.floor((window.innerHeight - initialOffset) / rowHeight))
26
- : 10
27
- );
28
-
29
- const calculate = () => {
30
- if (typeof window === "undefined") return;
31
- const el = containerRef.value;
32
- if (!el) {
33
- const calculated = Math.floor((window.innerHeight - initialOffset) / rowHeight);
34
- rows.value = Math.max(minRows, Math.min(maxRows, calculated));
35
- return;
36
- }
37
-
38
- const rect = el.getBoundingClientRect();
39
- const thead = el.querySelector("thead");
40
- const theadHeight = thead ? thead.offsetHeight : 40;
41
-
42
- const containerHeight = el.clientHeight;
43
- let availableHeight = 0;
44
-
45
- if (containerHeight && containerHeight > theadHeight + 100) {
46
- availableHeight = containerHeight - theadHeight - 12;
47
- } else {
48
- availableHeight = window.innerHeight - rect.top - theadHeight - bottomBuffer;
49
- }
50
-
51
- if (availableHeight > 0) {
52
- const calculated = Math.floor(availableHeight / rowHeight);
53
- rows.value = Math.max(minRows, Math.min(maxRows, calculated));
54
- }
55
- };
56
-
57
- onMounted(() => {
58
- calculate();
59
- nextTick(calculate);
60
- window.addEventListener("resize", calculate);
61
- });
62
-
63
- onUnmounted(() => {
64
- window.removeEventListener("resize", calculate);
65
- });
66
-
67
- return {
68
- rows,
69
- calculate,
70
- };
71
- }
1
+ import { ref, onMounted, onUnmounted, nextTick, type Ref } from "vue";
2
+
3
+ export interface UseAutoSkeletonRowsOptions {
4
+ rowHeight?: number;
5
+ initialOffset?: number;
6
+ bottomBuffer?: number;
7
+ minRows?: number;
8
+ maxRows?: number;
9
+ }
10
+
11
+ export function useAutoSkeletonRows(
12
+ containerRef: Ref<HTMLElement | null | undefined>,
13
+ options: UseAutoSkeletonRowsOptions = {}
14
+ ) {
15
+ const {
16
+ rowHeight = 51,
17
+ initialOffset = 240,
18
+ bottomBuffer = 72,
19
+ minRows = 4,
20
+ maxRows = 30,
21
+ } = options;
22
+
23
+ const rows = ref<number>(
24
+ typeof window !== "undefined"
25
+ ? Math.max(minRows, Math.floor((window.innerHeight - initialOffset) / rowHeight))
26
+ : 10
27
+ );
28
+
29
+ const calculate = () => {
30
+ if (typeof window === "undefined") return;
31
+ const el = containerRef.value;
32
+ if (!el) {
33
+ const calculated = Math.floor((window.innerHeight - initialOffset) / rowHeight);
34
+ rows.value = Math.max(minRows, Math.min(maxRows, calculated));
35
+ return;
36
+ }
37
+
38
+ const rect = el.getBoundingClientRect();
39
+ const thead = el.querySelector("thead");
40
+ const theadHeight = thead ? thead.offsetHeight : 40;
41
+
42
+ const containerHeight = el.clientHeight;
43
+ let availableHeight = 0;
44
+
45
+ if (containerHeight && containerHeight > theadHeight + 100) {
46
+ availableHeight = containerHeight - theadHeight - 12;
47
+ } else {
48
+ availableHeight = window.innerHeight - rect.top - theadHeight - bottomBuffer;
49
+ }
50
+
51
+ if (availableHeight > 0) {
52
+ const calculated = Math.floor(availableHeight / rowHeight);
53
+ rows.value = Math.max(minRows, Math.min(maxRows, calculated));
54
+ }
55
+ };
56
+
57
+ onMounted(() => {
58
+ calculate();
59
+ nextTick(calculate);
60
+ window.addEventListener("resize", calculate);
61
+ });
62
+
63
+ onUnmounted(() => {
64
+ window.removeEventListener("resize", calculate);
65
+ });
66
+
67
+ return {
68
+ rows,
69
+ calculate,
70
+ };
71
+ }