@marianmeres/stuic 1.124.0 → 1.125.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.
@@ -1,5 +1,4 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { HTMLButtonAttributes } from 'svelte/elements';
3
2
  export declare class ButtonConfig {
4
3
  static defaultSize: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
5
4
  static defaultShadow: boolean;
@@ -43,14 +42,14 @@ declare const __propDef: {
43
42
  [x: string]: any;
44
43
  class?: string | undefined;
45
44
  href?: string | undefined;
46
- type?: HTMLButtonAttributes["type"];
45
+ type?: "reset" | "submit" | "button" | null | undefined;
47
46
  shadow?: boolean | undefined;
48
- rounded?: (boolean | "full") | undefined;
49
- variant?: string | undefined;
47
+ rounded?: boolean | "full" | undefined;
48
+ variant?: string | undefined | undefined;
50
49
  square?: boolean | undefined;
51
50
  disabled?: boolean | undefined;
52
- value?: string | undefined;
53
- size?: ("xs" | "sm" | "md" | "lg" | "xl") | undefined;
51
+ value?: string | undefined | undefined;
52
+ size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
54
53
  };
55
54
  events: {
56
55
  focus: FocusEvent;
@@ -30,7 +30,7 @@ declare const __propDef: {
30
30
  [x: string]: any;
31
31
  class?: FieldConfigClasses | undefined;
32
32
  classBySize?: FieldConfigClassesBySize | undefined;
33
- size?: ("sm" | "md" | "lg") | undefined;
33
+ size?: "sm" | "md" | "lg" | undefined;
34
34
  id?: string | undefined;
35
35
  value: string;
36
36
  label?: THC | undefined;
@@ -38,23 +38,23 @@ declare const __propDef: {
38
38
  name?: string | undefined;
39
39
  tabindex?: number | undefined;
40
40
  description?: THC | undefined;
41
- autofocus?: true | undefined;
41
+ autofocus?: true | undefined | undefined;
42
42
  disabled?: boolean | undefined;
43
43
  readonly?: boolean | undefined;
44
44
  required?: boolean | undefined;
45
- placeholder?: string | undefined;
46
- autocomplete?: string | undefined;
47
- minlength?: number | undefined;
48
- maxlength?: number | undefined;
49
- min?: number | undefined;
50
- max?: number | undefined;
51
- pattern?: string | undefined;
52
- step?: number | undefined;
45
+ placeholder?: string | undefined | undefined;
46
+ autocomplete?: string | undefined | undefined;
47
+ minlength?: number | undefined | undefined;
48
+ maxlength?: number | undefined | undefined;
49
+ min?: number | undefined | undefined;
50
+ max?: number | undefined | undefined;
51
+ pattern?: string | undefined | undefined;
52
+ step?: number | undefined | undefined;
53
53
  useTrim?: boolean | undefined;
54
54
  textareaAutoEnlarge?: boolean | undefined;
55
55
  labelLeft?: boolean | undefined;
56
- labelLeftWidth?: ("normal" | "wide") | undefined;
57
- validate?: ValidateOptions | true | undefined;
56
+ labelLeftWidth?: "normal" | "wide" | undefined;
57
+ validate?: true | ValidateOptions | undefined;
58
58
  showAsterixOnRequired?: boolean | undefined;
59
59
  };
60
60
  events: {
@@ -10,12 +10,12 @@ declare const __propDef: {
10
10
  inputClass: string;
11
11
  placeholder: string | undefined;
12
12
  length?: number | undefined;
13
- pattern?: string | undefined;
14
- autofocus?: true | undefined;
13
+ pattern?: string | undefined | undefined;
14
+ autofocus?: true | undefined | undefined;
15
15
  disabled?: boolean | undefined;
16
16
  readonly?: boolean | undefined;
17
17
  required?: boolean | undefined;
18
- validate?: ValidateOptions | true | undefined;
18
+ validate?: true | ValidateOptions | undefined;
19
19
  setValidationResult: any;
20
20
  masked?: boolean | undefined;
21
21
  showX?: boolean | undefined;
@@ -0,0 +1,115 @@
1
+ <script>import { twMerge2 } from "../../utils/tw-merge2.js";
2
+ let _class = "";
3
+ export { _class as class };
4
+ export let duration = 1e3;
5
+ export let count = 8;
6
+ export let thickness = "normal";
7
+ export let height = "normal";
8
+ export let direction = "cw";
9
+ $:
10
+ _count = Math.max(3, Math.min(12, count));
11
+ let _id = 0;
12
+ const _calcSegs = (_c, _d) => {
13
+ const id = _id++;
14
+ let out = [];
15
+ for (let i = 0; i < _c; i++) {
16
+ out.push({
17
+ id: `${id}_${i}`,
18
+ rotate: 360 / _c * i,
19
+ delay: (direction === "ccw" ? 1 : -1) * (_d - _d / _c * (i + 1)),
20
+ duration: _d
21
+ });
22
+ }
23
+ return out;
24
+ };
25
+ $:
26
+ _segments = _calcSegs(_count, duration);
27
+ $:
28
+ _thickness = "thickness-" + (["normal", "thin", "thick"].includes(thickness) ? thickness : "normal");
29
+ $:
30
+ _height = "height-" + (["normal", "tall", "short"].includes(height) ? height : "normal");
31
+ </script>
32
+
33
+ <div class="spinner {_thickness} {_height} {twMerge2('inline-block w-5', _class)}">
34
+ {#each _segments as s (s.id)}
35
+ <div
36
+ style={[
37
+ `transform:rotate(${s.rotate}deg);`,
38
+ `animation-delay:${s.delay}ms;`,
39
+ `animation-duration:${s.duration}ms;`,
40
+ ].join('')}
41
+ ></div>
42
+ {/each}
43
+ </div>
44
+
45
+ <style>
46
+ .spinner,
47
+ .spinner div,
48
+ .spinner div:after {
49
+ box-sizing: border-box;
50
+ }
51
+
52
+ .spinner {
53
+ /* display: inline-block; */
54
+ position: relative;
55
+ aspect-ratio: 1/1;
56
+ pointer-events: none;
57
+ }
58
+
59
+ .spinner div {
60
+ width: 100%;
61
+ height: 100%;
62
+ position: absolute;
63
+ inset: 0;
64
+ /* animation: spinner 1.2s linear infinite; */
65
+ animation-name: spinner;
66
+ animation-timing-function: linear;
67
+ animation-iteration-count: infinite;
68
+ }
69
+
70
+ .spinner div:after {
71
+ content: ' ';
72
+ display: block;
73
+ position: absolute;
74
+
75
+ top: 0;
76
+ /* left: 46%;
77
+ width: 8%;
78
+ height: 27%; */
79
+ border-radius: 35%;
80
+ background: currentColor;
81
+ }
82
+ /* thickness */
83
+ .spinner.thickness-thin div:after {
84
+ left: 47.5%;
85
+ width: 5%;
86
+ }
87
+ .spinner.thickness-normal div:after {
88
+ left: 46%;
89
+ width: 8%;
90
+ }
91
+ .spinner.thickness-thick div:after {
92
+ left: 44.5%;
93
+ width: 11%;
94
+ }
95
+
96
+ /* height */
97
+ .spinner.height-short div:after {
98
+ height: 21%;
99
+ }
100
+ .spinner.height-normal div:after {
101
+ height: 27%;
102
+ }
103
+ .spinner.height-tall div:after {
104
+ height: 33%;
105
+ }
106
+
107
+ @keyframes spinner {
108
+ 0% {
109
+ opacity: 1;
110
+ }
111
+ 100% {
112
+ opacity: 0;
113
+ }
114
+ }
115
+ </style>
@@ -0,0 +1,23 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ class?: string;
5
+ duration?: number;
6
+ count?: number;
7
+ thickness?: "normal" | "thin" | "thick";
8
+ height?: "normal" | "tall" | "short";
9
+ direction?: "cw" | "ccw";
10
+ };
11
+ events: {
12
+ [evt: string]: CustomEvent<any>;
13
+ };
14
+ slots: {};
15
+ exports?: {} | undefined;
16
+ bindings?: string | undefined;
17
+ };
18
+ export type SpinnerProps = typeof __propDef.props;
19
+ export type SpinnerEvents = typeof __propDef.events;
20
+ export type SpinnerSlots = typeof __propDef.slots;
21
+ export default class Spinner extends SvelteComponent<SpinnerProps, SpinnerEvents, SpinnerSlots> {
22
+ }
23
+ export {};
@@ -0,0 +1,114 @@
1
+ <script>import { twMerge2 } from "@marianmeres/stuic";
2
+ let {
3
+ class: _class,
4
+ duration = 1e3,
5
+ // one "loop" duration (in ms)
6
+ count = 8,
7
+ // "hands" count
8
+ thickness = "normal",
9
+ height = "normal",
10
+ direction = "cw"
11
+ } = $props();
12
+ let _count = $derived(Math.max(3, Math.min(12, count)));
13
+ let _segments = $derived.by(() => {
14
+ let out = [];
15
+ for (let i = 0; i < _count; i++) {
16
+ out.push({
17
+ rotate: 360 / _count * i,
18
+ delay: (direction === "ccw" ? 1 : -1) * (duration - duration / _count * (i + 1)),
19
+ duration
20
+ });
21
+ }
22
+ return out;
23
+ });
24
+ let _thickness = $derived(
25
+ "thickness-" + (["normal", "thin", "thick"].includes(thickness) ? thickness : "normal")
26
+ );
27
+ let _height = $derived(
28
+ "height-" + (["normal", "tall", "short"].includes(height) ? height : "normal")
29
+ );
30
+ </script>
31
+
32
+ <div class="spinner {_thickness} {_height} {twMerge2('inline-block w-5', _class)}">
33
+ {#each _segments as s}
34
+ <div
35
+ style={[
36
+ `transform: rotate(${s.rotate}deg);`,
37
+ `animation-delay: ${s.delay}ms;`,
38
+ `animation-duration: ${s.duration}ms;`
39
+ ].join('')}
40
+ ></div>
41
+ {/each}
42
+ </div>
43
+
44
+ <style>
45
+ .spinner,
46
+ .spinner div,
47
+ .spinner div:after {
48
+ box-sizing: border-box;
49
+ }
50
+
51
+ .spinner {
52
+ /* display: inline-block; */
53
+ position: relative;
54
+ aspect-ratio: 1/1;
55
+ pointer-events: none;
56
+ }
57
+
58
+ .spinner div {
59
+ width: 100%;
60
+ height: 100%;
61
+ position: absolute;
62
+ inset: 0;
63
+ /* animation: spinner 1.2s linear infinite; */
64
+ animation-name: spinner;
65
+ animation-timing-function: linear;
66
+ animation-iteration-count: infinite;
67
+ }
68
+
69
+ .spinner div:after {
70
+ content: ' ';
71
+ display: block;
72
+ position: absolute;
73
+
74
+ top: 0;
75
+ /* left: 46%;
76
+ width: 8%;
77
+ height: 27%; */
78
+ border-radius: 35%;
79
+ background: currentColor;
80
+ }
81
+ /* thickness */
82
+ .spinner.thickness-thin div:after {
83
+ left: 47.5%;
84
+ width: 5%;
85
+ }
86
+ .spinner.thickness-normal div:after {
87
+ left: 46%;
88
+ width: 8%;
89
+ }
90
+ .spinner.thickness-thick div:after {
91
+ left: 44.5%;
92
+ width: 11%;
93
+ }
94
+
95
+ /* height */
96
+ .spinner.height-short div:after {
97
+ height: 21%;
98
+ }
99
+ .spinner.height-normal div:after {
100
+ height: 27%;
101
+ }
102
+ .spinner.height-tall div:after {
103
+ height: 33%;
104
+ }
105
+
106
+ @keyframes spinner {
107
+ 0% {
108
+ opacity: 1;
109
+ }
110
+ 100% {
111
+ opacity: 0;
112
+ }
113
+ }
114
+ </style>
@@ -0,0 +1,16 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ exports?: {} | undefined;
9
+ bindings?: string | undefined;
10
+ };
11
+ export type SpinnerProps = typeof __propDef.props;
12
+ export type SpinnerEvents = typeof __propDef.events;
13
+ export type SpinnerSlots = typeof __propDef.slots;
14
+ export default class Spinner extends SvelteComponent<SpinnerProps, SpinnerEvents, SpinnerSlots> {
15
+ }
16
+ export {};
@@ -2,7 +2,7 @@ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  class?: string;
5
- strokeWidth?: 1 | 1.5 | 2 | 2.5 | 3 | 3.5 | 4;
5
+ strokeWidth?: 0.5 | 1 | 1.5 | 2 | 2.5 | 3 | 3.5 | 4;
6
6
  };
7
7
  events: {
8
8
  [evt: string]: CustomEvent<any>;
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ export { default as ModalDialog, type ModalDialogAPI, } from './components/Modal
18
18
  export { createNotificationsStore, NOTIFICATION_EVENT, type NotiticationsCreateStoreOptions, type NotificationCreateParam, type Notification, type NotificationInput, type NotificationType, type NotificationOnEventHandler, type NotificationsSortOrder, type NotificationKnownClasses, } from './components/Notifications/notifications.js';
19
19
  export { default as Notifications, NotificationsConfig, type NOTIFICATIONS_POSX, type NOTIFICATIONS_POSY, } from './components/Notifications/Notifications.svelte';
20
20
  export { default as Popover } from './components/Popover/Popover.svelte';
21
+ export { default as Spinner } from './components/Spinner/Spinner.svelte';
21
22
  export { default as Switch, SwitchConfig, type SwitchPreHook, } from './components/Switch/Switch.svelte';
22
23
  export { default as Thc, type THC, isTHCNotEmpty } from './components/Thc/Thc.svelte';
23
24
  export { default as X } from './components/X/X.svelte';
package/dist/index.js CHANGED
@@ -31,6 +31,8 @@ export { default as Notifications, NotificationsConfig, } from './components/Not
31
31
  //
32
32
  export { default as Popover } from './components/Popover/Popover.svelte';
33
33
  //
34
+ export { default as Spinner } from './components/Spinner/Spinner.svelte';
35
+ //
34
36
  export { default as Switch, SwitchConfig, } from './components/Switch/Switch.svelte';
35
37
  export { default as Thc, isTHCNotEmpty } from './components/Thc/Thc.svelte';
36
38
  //
@@ -1,2 +1,3 @@
1
- export declare const clsClean: (s: string | string[]) => string;
2
- export declare const twMerge2: (...args: any[]) => string;
1
+ import { type ClassNameValue } from 'tailwind-merge';
2
+ export declare const clsClean: (s: ClassNameValue) => string;
3
+ export declare const twMerge2: (...args: ClassNameValue[]) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "1.124.0",
3
+ "version": "1.125.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package && node ./scripts/date.js",