cynx-lib 1.3.110 → 1.3.112

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 (45) hide show
  1. package/gen.js +77 -77
  2. package/package.json +1 -1
  3. package/ui/components/ActionsMenu.jsx +357 -357
  4. package/ui/components/Drawer.jsx +208 -208
  5. package/ui/components/Globe.jsx +764 -764
  6. package/ui/components/HoverCard.jsx +85 -85
  7. package/ui/components/PrivacyBlur.jsx +603 -603
  8. package/ui/components/Sidebar.jsx +10 -47
  9. package/ui/components/useRuler.jsx +0 -1
  10. package/ui/index.cjs +0 -2
  11. package/ui/index.js +1 -2
  12. package/utils/index.js +24 -24
  13. package/utils/utils/duration.js +139 -139
  14. package/utils/utils/oidc.js +214 -214
  15. package/utils/utils/realtime.js +1634 -1634
  16. package/utils/utils/server.js +371 -371
  17. package/utils/utils/session.js +131 -131
  18. package/utils/utils/session_manager.js +580 -580
  19. package/utils/utils/sso_manager.js +702 -702
  20. package/utils/utils/storage.js +393 -393
  21. package/utils/utils/ui.js +111 -111
  22. package/vue/components/Badge.vue +79 -79
  23. package/vue/components/Button.vue +209 -209
  24. package/vue/components/Checkbox.vue +103 -103
  25. package/vue/components/CircularProgress.vue +383 -383
  26. package/vue/components/Divider.vue +94 -94
  27. package/vue/components/Drawer.vue +243 -243
  28. package/vue/components/InfoBadge.vue +223 -223
  29. package/vue/components/Input.vue +341 -341
  30. package/vue/components/LinearProgress.vue +268 -268
  31. package/vue/components/Modal.vue +226 -226
  32. package/vue/components/Pagination.vue +199 -199
  33. package/vue/components/Select.vue +713 -713
  34. package/vue/components/Sidebar.vue +955 -955
  35. package/vue/components/Skeleton.vue +91 -91
  36. package/vue/components/Spinner.vue +263 -263
  37. package/vue/components/StatusTag.vue +89 -89
  38. package/vue/components/TabBar.vue +176 -176
  39. package/vue/components/Table.vue +388 -388
  40. package/vue/components/TimePicker.vue +399 -399
  41. package/vue/components/Toggle.vue +115 -115
  42. package/vue/components/XTable.vue +140 -140
  43. package/vue/composables/useAutoSkeletonRows.ts +71 -71
  44. package/vue/index.d.ts +67 -67
  45. 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,140 +1,140 @@
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
- class: { type: String, default: "" },
9
- },
10
- setup(props, { slots }) {
11
- return () =>
12
- h(
13
- "table",
14
- {
15
- class: `cynx-table ${props.class || ""}`.trim(),
16
- style: {
17
- width: "100%",
18
- borderCollapse: "collapse",
19
- tableLayout: "fixed",
20
- fontSize: ".8rem",
21
- ...props.style,
22
- },
23
- },
24
- slots.default?.()
25
- );
26
- },
27
- });
28
-
29
- export const XThead = defineComponent({
30
- name: "XThead",
31
- setup(_, { slots }) {
32
- return () => h("thead", null, slots.default?.());
33
- },
34
- });
35
-
36
- export const XTbody = defineComponent({
37
- name: "XTbody",
38
- setup(_, { slots }) {
39
- return () => h("tbody", null, slots.default?.());
40
- },
41
- });
42
-
43
- export const XTr = defineComponent({
44
- name: "XTr",
45
- props: {
46
- style: { type: Object, default: () => ({}) },
47
- onClick: { type: Function, default: undefined },
48
- class: { type: String, default: "" },
49
- },
50
- setup(props, { slots }) {
51
- return () =>
52
- h(
53
- "tr",
54
- {
55
- onClick: props.onClick,
56
- class: `cynx-tr ${props.class || ""}`.trim(),
57
- style: {
58
- cursor: props.onClick ? "pointer" : undefined,
59
- ...props.style,
60
- },
61
- },
62
- slots.default?.()
63
- );
64
- },
65
- });
66
-
67
- export const XTh = defineComponent({
68
- name: "XTh",
69
- props: {
70
- style: { type: Object, default: () => ({}) },
71
- class: { type: String, default: "" },
72
- },
73
- setup(props, { slots }) {
74
- return () =>
75
- h(
76
- "th",
77
- {
78
- class: props.class,
79
- style: {
80
- textAlign: "left",
81
- padding: "8px 12px",
82
- fontSize: ".68rem",
83
- fontWeight: 600,
84
- textTransform: "uppercase",
85
- letterSpacing: ".06em",
86
- color: "var(--muted, #9b9daa)",
87
- borderBottom: "1px solid var(--border-light, #ebebf0)",
88
- ...props.style,
89
- },
90
- },
91
- slots.default?.()
92
- );
93
- },
94
- });
95
-
96
- export const XTd = defineComponent({
97
- name: "XTd",
98
- props: {
99
- style: { type: Object, default: () => ({}) },
100
- colSpan: { type: Number, default: undefined },
101
- className: { type: String, default: "" },
102
- },
103
- setup(props, { slots }) {
104
- return () =>
105
- h(
106
- "td",
107
- {
108
- colSpan: props.colSpan,
109
- class: props.className,
110
- style: {
111
- padding: "9px 12px",
112
- verticalAlign: "middle",
113
- color: "var(--primary-text, #0f111c)",
114
- ...props.style,
115
- },
116
- },
117
- slots.default?.()
118
- );
119
- },
120
- });
121
-
122
- export default XTable;
123
- </script>
124
-
125
- <style>
126
- .cynx-table {
127
- width: 100%;
128
- border-collapse: collapse;
129
- table-layout: fixed;
130
- font-size: .8rem;
131
- }
132
- .cynx-tr {
133
- border-bottom: 1px solid var(--border-light, #ebebf0);
134
- transition: background .12s;
135
- }
136
- tbody tr.cynx-tr:last-child,
137
- .cynx-table tbody tr:last-child {
138
- border-bottom: none;
139
- }
140
- </style>
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
+ class: { type: String, default: "" },
9
+ },
10
+ setup(props, { slots }) {
11
+ return () =>
12
+ h(
13
+ "table",
14
+ {
15
+ class: `cynx-table ${props.class || ""}`.trim(),
16
+ style: {
17
+ width: "100%",
18
+ borderCollapse: "collapse",
19
+ tableLayout: "fixed",
20
+ fontSize: ".8rem",
21
+ ...props.style,
22
+ },
23
+ },
24
+ slots.default?.()
25
+ );
26
+ },
27
+ });
28
+
29
+ export const XThead = defineComponent({
30
+ name: "XThead",
31
+ setup(_, { slots }) {
32
+ return () => h("thead", null, slots.default?.());
33
+ },
34
+ });
35
+
36
+ export const XTbody = defineComponent({
37
+ name: "XTbody",
38
+ setup(_, { slots }) {
39
+ return () => h("tbody", null, slots.default?.());
40
+ },
41
+ });
42
+
43
+ export const XTr = defineComponent({
44
+ name: "XTr",
45
+ props: {
46
+ style: { type: Object, default: () => ({}) },
47
+ onClick: { type: Function, default: undefined },
48
+ class: { type: String, default: "" },
49
+ },
50
+ setup(props, { slots }) {
51
+ return () =>
52
+ h(
53
+ "tr",
54
+ {
55
+ onClick: props.onClick,
56
+ class: `cynx-tr ${props.class || ""}`.trim(),
57
+ style: {
58
+ cursor: props.onClick ? "pointer" : undefined,
59
+ ...props.style,
60
+ },
61
+ },
62
+ slots.default?.()
63
+ );
64
+ },
65
+ });
66
+
67
+ export const XTh = defineComponent({
68
+ name: "XTh",
69
+ props: {
70
+ style: { type: Object, default: () => ({}) },
71
+ class: { type: String, default: "" },
72
+ },
73
+ setup(props, { slots }) {
74
+ return () =>
75
+ h(
76
+ "th",
77
+ {
78
+ class: props.class,
79
+ style: {
80
+ textAlign: "left",
81
+ padding: "8px 12px",
82
+ fontSize: ".68rem",
83
+ fontWeight: 600,
84
+ textTransform: "uppercase",
85
+ letterSpacing: ".06em",
86
+ color: "var(--muted, #9b9daa)",
87
+ borderBottom: "1px solid var(--border-light, #ebebf0)",
88
+ ...props.style,
89
+ },
90
+ },
91
+ slots.default?.()
92
+ );
93
+ },
94
+ });
95
+
96
+ export const XTd = defineComponent({
97
+ name: "XTd",
98
+ props: {
99
+ style: { type: Object, default: () => ({}) },
100
+ colSpan: { type: Number, default: undefined },
101
+ className: { type: String, default: "" },
102
+ },
103
+ setup(props, { slots }) {
104
+ return () =>
105
+ h(
106
+ "td",
107
+ {
108
+ colSpan: props.colSpan,
109
+ class: props.className,
110
+ style: {
111
+ padding: "9px 12px",
112
+ verticalAlign: "middle",
113
+ color: "var(--primary-text, #0f111c)",
114
+ ...props.style,
115
+ },
116
+ },
117
+ slots.default?.()
118
+ );
119
+ },
120
+ });
121
+
122
+ export default XTable;
123
+ </script>
124
+
125
+ <style>
126
+ .cynx-table {
127
+ width: 100%;
128
+ border-collapse: collapse;
129
+ table-layout: fixed;
130
+ font-size: .8rem;
131
+ }
132
+ .cynx-tr {
133
+ border-bottom: 1px solid var(--border-light, #ebebf0);
134
+ transition: background .12s;
135
+ }
136
+ tbody tr.cynx-tr:last-child,
137
+ .cynx-table tbody tr:last-child {
138
+ border-bottom: none;
139
+ }
140
+ </style>
@@ -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
+ }