@intechstudio/grid-uikit 1.20260922.1001 → 1.20260922.1146
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/ContextMenu.svelte +1 -1
- package/dist/IconButton.svelte +1 -1
- package/dist/MeltCombo.svelte +1 -1
- package/dist/MeltSelect.svelte +1 -1
- package/dist/MeltSlider.svelte +32 -2
- package/dist/MeltSlider.svelte.d.ts +2 -0
- package/dist/MoltenPushButtonGroup.svelte +1 -1
- package/dist/MoltenTooltip.svelte +1 -1
- package/dist/SliderColorPicker.svelte +18 -22
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/theme.css +3 -0
- package/package.json +1 -1
- package/src/lib/theme.css +3 -0
- package/dist/ColorSlider.svelte +0 -174
- package/dist/ColorSlider.svelte.d.ts +0 -35
package/dist/ContextMenu.svelte
CHANGED
package/dist/IconButton.svelte
CHANGED
package/dist/MeltCombo.svelte
CHANGED
|
@@ -375,7 +375,7 @@
|
|
|
375
375
|
background-color: var(--popover-background);
|
|
376
376
|
color: var(--foreground-muted);
|
|
377
377
|
border: 1px solid var(--foreground-muted);
|
|
378
|
-
border-radius: var(--radius-
|
|
378
|
+
border-radius: var(--radius-medium);
|
|
379
379
|
z-index: 40;
|
|
380
380
|
max-height: 8em;
|
|
381
381
|
display: flex;
|
package/dist/MeltSelect.svelte
CHANGED
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
background-color: var(--popover-background);
|
|
134
134
|
color: var(--foreground-muted);
|
|
135
135
|
border: 1px solid var(--foreground-muted);
|
|
136
|
-
border-radius: var(--radius-
|
|
136
|
+
border-radius: var(--radius-medium);
|
|
137
137
|
z-index: 40;
|
|
138
138
|
overflow: hidden;
|
|
139
139
|
}
|
package/dist/MeltSlider.svelte
CHANGED
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
export let max: number;
|
|
11
11
|
export let step: number;
|
|
12
12
|
export let disabled = false;
|
|
13
|
+
// Optional custom track background (e.g. a color gradient). When set, the
|
|
14
|
+
// track shows this background and the selected-range fill is hidden so the
|
|
15
|
+
// full background stays visible.
|
|
16
|
+
export let trackBackground: string | undefined = undefined;
|
|
17
|
+
// Optional custom thumb background (e.g. the color at the thumb's value on a
|
|
18
|
+
// color slider). When unset the thumb uses the default theme color.
|
|
19
|
+
export let thumbBackground: string | undefined = undefined;
|
|
13
20
|
|
|
14
21
|
const {
|
|
15
22
|
elements: { root, range, thumbs },
|
|
@@ -55,8 +62,19 @@
|
|
|
55
62
|
</script>
|
|
56
63
|
|
|
57
64
|
<span {...$root} use:root class="container" class:disabled>
|
|
58
|
-
<span
|
|
59
|
-
|
|
65
|
+
<span
|
|
66
|
+
class="range-full"
|
|
67
|
+
class:disabled
|
|
68
|
+
class:has-background={trackBackground}
|
|
69
|
+
style:background={trackBackground}
|
|
70
|
+
>
|
|
71
|
+
<span
|
|
72
|
+
{...$range}
|
|
73
|
+
use:range
|
|
74
|
+
class="range-selected"
|
|
75
|
+
class:disabled
|
|
76
|
+
class:hidden={trackBackground}
|
|
77
|
+
/>
|
|
60
78
|
</span>
|
|
61
79
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
62
80
|
<span
|
|
@@ -64,6 +82,8 @@
|
|
|
64
82
|
use:thumbs
|
|
65
83
|
class="thumb"
|
|
66
84
|
class:disabled
|
|
85
|
+
class:has-color={thumbBackground}
|
|
86
|
+
style:background={disabled ? undefined : thumbBackground}
|
|
67
87
|
on:blur={handleThumbBlur}
|
|
68
88
|
/>
|
|
69
89
|
</span>
|
|
@@ -91,11 +111,17 @@
|
|
|
91
111
|
height: 8px;
|
|
92
112
|
border-radius: var(--radius);
|
|
93
113
|
}
|
|
114
|
+
span.range-full.has-background {
|
|
115
|
+
background-color: transparent;
|
|
116
|
+
}
|
|
94
117
|
span.range-selected {
|
|
95
118
|
height: 8px;
|
|
96
119
|
background-color: var(--foreground-disabled);
|
|
97
120
|
border-radius: var(--radius);
|
|
98
121
|
}
|
|
122
|
+
span.range-selected.hidden {
|
|
123
|
+
background-color: transparent;
|
|
124
|
+
}
|
|
99
125
|
span.thumb {
|
|
100
126
|
display: block;
|
|
101
127
|
height: var(--thumb-size);
|
|
@@ -103,6 +129,10 @@
|
|
|
103
129
|
background-color: var(--foreground-muted);
|
|
104
130
|
border-radius: var(--radius);
|
|
105
131
|
}
|
|
132
|
+
span.thumb.has-color {
|
|
133
|
+
width: var(--thumb-size);
|
|
134
|
+
border-radius: var(--radius-full);
|
|
135
|
+
}
|
|
106
136
|
span.thumb:focus {
|
|
107
137
|
outline: var(--focus-outline);
|
|
108
138
|
outline-offset: var(--focus-offset);
|
|
@@ -17,6 +17,8 @@ declare const MeltSlider: $$__sveltets_2_IsomorphicComponent<{
|
|
|
17
17
|
max: number;
|
|
18
18
|
step: number;
|
|
19
19
|
disabled?: boolean;
|
|
20
|
+
trackBackground?: string | undefined;
|
|
21
|
+
thumbBackground?: string | undefined;
|
|
20
22
|
}, {
|
|
21
23
|
change: CustomEvent<any>;
|
|
22
24
|
blur: CustomEvent<any>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { createEventDispatcher } from "svelte";
|
|
3
3
|
import { Color } from "./color";
|
|
4
|
-
import
|
|
4
|
+
import MeltSlider from "./MeltSlider.svelte";
|
|
5
5
|
|
|
6
6
|
function getRandom(a: number, b: number) {
|
|
7
7
|
return 0;
|
|
@@ -42,37 +42,38 @@
|
|
|
42
42
|
dispatch("change", { color: color });
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
function getGradient(
|
|
45
|
+
function getGradient(
|
|
46
|
+
color: Color.HSL | undefined,
|
|
47
|
+
channel: Channel,
|
|
48
|
+
): string | undefined {
|
|
46
49
|
if (typeof color === "undefined") {
|
|
47
|
-
return
|
|
50
|
+
return undefined;
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
const stops = {
|
|
51
|
-
h: [0, 60, 120, 180, 240, 360].map((h) =>
|
|
54
|
+
h: [0, 60, 120, 180, 240, 300, 360].map((h) =>
|
|
52
55
|
new Color.HSL(h, color.s, color.l).toHEX(),
|
|
53
56
|
),
|
|
54
57
|
s: [0, 100].map((s) => new Color.HSL(color.h, s, color.l).toHEX()),
|
|
55
58
|
l: [0, 50, 100].map((l) => new Color.HSL(color.h, color.s, l).toHEX()),
|
|
56
59
|
};
|
|
57
|
-
return `
|
|
58
|
-
", ",
|
|
59
|
-
)});`;
|
|
60
|
+
return `linear-gradient(to right, ${stops[channel].join(", ")})`;
|
|
60
61
|
}
|
|
61
62
|
</script>
|
|
62
63
|
|
|
63
64
|
<div class="slider-grid">
|
|
64
65
|
{#each sliders as { label, key, max }}
|
|
65
66
|
<span class="slider-label">{label}:</span>
|
|
66
|
-
<
|
|
67
|
-
|
|
67
|
+
<MeltSlider
|
|
68
|
+
target={color ? color[key] : 0}
|
|
69
|
+
min={0}
|
|
68
70
|
{max}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
on:change={
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
</ColorSlider>
|
|
71
|
+
step={1}
|
|
72
|
+
trackBackground={getGradient(color, key)}
|
|
73
|
+
thumbBackground={color ? color.toHEX() : undefined}
|
|
74
|
+
on:change={(e) => handleInput(key, e.detail.value)}
|
|
75
|
+
on:commit={handleChange}
|
|
76
|
+
/>
|
|
76
77
|
{/each}
|
|
77
78
|
</div>
|
|
78
79
|
|
|
@@ -86,12 +87,7 @@
|
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
.slider-label {
|
|
89
|
-
color:
|
|
90
|
+
color: var(--foreground);
|
|
90
91
|
font-size: 0.875rem;
|
|
91
92
|
}
|
|
92
|
-
|
|
93
|
-
.slider-gradient {
|
|
94
|
-
width: 100%;
|
|
95
|
-
height: 100%;
|
|
96
|
-
}
|
|
97
93
|
</style>
|
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/dist/theme.css
CHANGED
|
@@ -49,6 +49,9 @@
|
|
|
49
49
|
--radius-small: min(var(--radius), 0.25em);
|
|
50
50
|
--radius-medium: min(var(--radius), 0.5em);
|
|
51
51
|
--radius-large: min(var(--radius), 1em);
|
|
52
|
+
/* Always fully rounded (pill/circle), independent of --radius — for elements
|
|
53
|
+
that are round by design, e.g. the color-preview slider knob. */
|
|
54
|
+
--radius-full: 9999px;
|
|
52
55
|
--border-thickness: 1px;
|
|
53
56
|
}
|
|
54
57
|
|
package/package.json
CHANGED
package/src/lib/theme.css
CHANGED
|
@@ -49,6 +49,9 @@
|
|
|
49
49
|
--radius-small: min(var(--radius), 0.25em);
|
|
50
50
|
--radius-medium: min(var(--radius), 0.5em);
|
|
51
51
|
--radius-large: min(var(--radius), 1em);
|
|
52
|
+
/* Always fully rounded (pill/circle), independent of --radius — for elements
|
|
53
|
+
that are round by design, e.g. the color-preview slider knob. */
|
|
54
|
+
--radius-full: 9999px;
|
|
52
55
|
--border-thickness: 1px;
|
|
53
56
|
}
|
|
54
57
|
|
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;
|