@intechstudio/grid-uikit 1.20260922.1144 → 1.20260922.1155
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.
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/package.json +1 -1
- package/dist/ColorSlider.svelte +0 -174
- package/dist/ColorSlider.svelte.d.ts +0 -35
package/dist/index.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ export { default as MeltCombo, type MeltComboSuggestion, type MeltComboData, } f
|
|
|
19
19
|
export { default as MarkdownContainer, type MarkdownContainerTypes, } from "./MarkdownContainer.svelte";
|
|
20
20
|
export { default as Toggle } from "./Toggle.svelte";
|
|
21
21
|
export { default as InfoBox } from "./InfoBox.svelte";
|
|
22
|
-
export { default as ColorSlider } from "./ColorSlider.svelte";
|
|
23
22
|
export { default as CircleColorPicker } from "./CircleColorPicker.svelte";
|
|
24
23
|
export { default as SliderColorPicker } from "./SliderColorPicker.svelte";
|
|
25
24
|
export { default as SquareColorPicker } from "./SquareColorPicker.svelte";
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,6 @@ export { default as MeltCombo, } from "./MeltCombo.svelte";
|
|
|
19
19
|
export { default as MarkdownContainer, } from "./MarkdownContainer.svelte";
|
|
20
20
|
export { default as Toggle } from "./Toggle.svelte";
|
|
21
21
|
export { default as InfoBox } from "./InfoBox.svelte";
|
|
22
|
-
export { default as ColorSlider } from "./ColorSlider.svelte";
|
|
23
22
|
export { default as CircleColorPicker } from "./CircleColorPicker.svelte";
|
|
24
23
|
export { default as SliderColorPicker } from "./SliderColorPicker.svelte";
|
|
25
24
|
export { default as SquareColorPicker } from "./SquareColorPicker.svelte";
|
package/package.json
CHANGED
package/dist/ColorSlider.svelte
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { createEventDispatcher, onMount } from "svelte";
|
|
3
|
-
|
|
4
|
-
const dispatch = createEventDispatcher();
|
|
5
|
-
|
|
6
|
-
export let max: number = 100;
|
|
7
|
-
export let direction: "horizontal" | "vertical";
|
|
8
|
-
export let round = false;
|
|
9
|
-
export let value: any;
|
|
10
|
-
|
|
11
|
-
let scaleElement: HTMLElement;
|
|
12
|
-
let cursorElement: HTMLElement;
|
|
13
|
-
let isDrag = false;
|
|
14
|
-
|
|
15
|
-
onMount(() => {
|
|
16
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
17
|
-
setCursorPosition(value);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
setCursorPosition(value);
|
|
21
|
-
resizeObserver.observe(scaleElement);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
$: setCursorPosition(value);
|
|
25
|
-
|
|
26
|
-
function handleCursorDrag(e: MouseEvent) {
|
|
27
|
-
const rect = scaleElement?.getBoundingClientRect();
|
|
28
|
-
|
|
29
|
-
if (!rect) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
let normalized: number;
|
|
34
|
-
switch (direction) {
|
|
35
|
-
case "vertical": {
|
|
36
|
-
normalized =
|
|
37
|
-
1 - Math.max(0, Math.min(1, (e.clientY - rect.top) / rect.height));
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
case "horizontal": {
|
|
41
|
-
normalized = Math.max(
|
|
42
|
-
0,
|
|
43
|
-
Math.min(1, (e.clientX - rect.left) / rect.width),
|
|
44
|
-
);
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
value =
|
|
50
|
-
Math.round(max * normalized * (round ? 1 : 100)) / (round ? 1 : 100);
|
|
51
|
-
setCursorPosition(value);
|
|
52
|
-
dispatch("input", { value: value });
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function setCursorPosition(value: number | undefined) {
|
|
56
|
-
if (value == null || Number.isNaN(value)) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const scaleRect = scaleElement?.getBoundingClientRect();
|
|
61
|
-
const cursorRect = cursorElement?.getBoundingClientRect();
|
|
62
|
-
|
|
63
|
-
if (!scaleRect || !cursorRect) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const normValue = Math.max(0, Math.min(value / max, 1));
|
|
68
|
-
|
|
69
|
-
switch (direction) {
|
|
70
|
-
case "vertical": {
|
|
71
|
-
const position = (1 - normValue) * 100;
|
|
72
|
-
const maxPosition =
|
|
73
|
-
((scaleRect.height - cursorRect.height) / scaleRect.height) * 100;
|
|
74
|
-
cursorElement.style.top = `${Math.min(position, maxPosition)}%`;
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
case "horizontal": {
|
|
78
|
-
const position = normValue * 100;
|
|
79
|
-
const maxPosition =
|
|
80
|
-
((scaleRect.width - cursorRect.width) / scaleRect.width) * 100;
|
|
81
|
-
cursorElement.style.left = `${Math.min(position, maxPosition)}%`;
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
</script>
|
|
87
|
-
|
|
88
|
-
<svelte:window
|
|
89
|
-
on:mouseup={(e) => {
|
|
90
|
-
if (!isDrag) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
isDrag = false;
|
|
95
|
-
document.removeEventListener("mousemove", handleCursorDrag);
|
|
96
|
-
dispatch("change", { value: value });
|
|
97
|
-
}}
|
|
98
|
-
/>
|
|
99
|
-
|
|
100
|
-
<div class="container {direction === 'vertical' ? 'vertical' : 'horizontal'}">
|
|
101
|
-
<canvas
|
|
102
|
-
bind:this={scaleElement}
|
|
103
|
-
class="scale-canvas"
|
|
104
|
-
on:mousedown={(e) => {
|
|
105
|
-
if (!(e.buttons & 1)) return;
|
|
106
|
-
isDrag = true;
|
|
107
|
-
document.addEventListener("mousemove", handleCursorDrag);
|
|
108
|
-
handleCursorDrag(e);
|
|
109
|
-
}}
|
|
110
|
-
/>
|
|
111
|
-
<div class="overlay">
|
|
112
|
-
<slot />
|
|
113
|
-
</div>
|
|
114
|
-
<div
|
|
115
|
-
bind:this={cursorElement}
|
|
116
|
-
class="cursor {direction === 'vertical'
|
|
117
|
-
? 'cursor-vertical'
|
|
118
|
-
: 'cursor-horizontal'}"
|
|
119
|
-
class:invisible={typeof value === "undefined" || isNaN(+value)}
|
|
120
|
-
/>
|
|
121
|
-
</div>
|
|
122
|
-
|
|
123
|
-
<style>
|
|
124
|
-
.container {
|
|
125
|
-
position: relative;
|
|
126
|
-
display: flex;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.container.vertical {
|
|
130
|
-
height: 100%;
|
|
131
|
-
width: 1.25rem;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.container.horizontal {
|
|
135
|
-
width: 100%;
|
|
136
|
-
height: 1.25rem;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.scale-canvas {
|
|
140
|
-
width: 100%;
|
|
141
|
-
height: 100%;
|
|
142
|
-
position: relative;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.overlay {
|
|
146
|
-
position: absolute;
|
|
147
|
-
width: 100%;
|
|
148
|
-
height: 100%;
|
|
149
|
-
border: 1px solid black;
|
|
150
|
-
pointer-events: none;
|
|
151
|
-
background-color: white;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.cursor {
|
|
155
|
-
position: absolute;
|
|
156
|
-
border: 1px solid black;
|
|
157
|
-
pointer-events: none;
|
|
158
|
-
background-color: rgba(255, 255, 255, 0.25);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.cursor-vertical {
|
|
162
|
-
height: 0.5rem;
|
|
163
|
-
width: 100%;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.cursor-horizontal {
|
|
167
|
-
width: 0.5rem;
|
|
168
|
-
height: 100%;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.invisible {
|
|
172
|
-
visibility: hidden;
|
|
173
|
-
}
|
|
174
|
-
</style>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
15
|
-
default: any;
|
|
16
|
-
} ? Props extends Record<string, never> ? any : {
|
|
17
|
-
children?: any;
|
|
18
|
-
} : {});
|
|
19
|
-
declare const ColorSlider: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
20
|
-
max?: number;
|
|
21
|
-
direction: "horizontal" | "vertical";
|
|
22
|
-
round?: boolean;
|
|
23
|
-
value: any;
|
|
24
|
-
}, {
|
|
25
|
-
default: {};
|
|
26
|
-
}>, {
|
|
27
|
-
change: CustomEvent<any>;
|
|
28
|
-
input: CustomEvent<any>;
|
|
29
|
-
} & {
|
|
30
|
-
[evt: string]: CustomEvent<any>;
|
|
31
|
-
}, {
|
|
32
|
-
default: {};
|
|
33
|
-
}, {}, string>;
|
|
34
|
-
type ColorSlider = InstanceType<typeof ColorSlider>;
|
|
35
|
-
export default ColorSlider;
|