sveltekit-ui 1.1.15 → 1.1.17
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/package.json +3 -3
- package/src/routes/+page.svelte +24 -0
- package/dist/Components/Alert/index.svelte +0 -88
- package/dist/Components/Alert/index.svelte.js +0 -101
- package/dist/Components/ArrowToggle/index.svelte +0 -62
- package/dist/Components/Attachment/index.svelte +0 -77
- package/dist/Components/Attachment/index.svelte.js +0 -119
- package/dist/Components/Audio/index.svelte +0 -193
- package/dist/Components/Audio/index.svelte.js +0 -463
- package/dist/Components/AudioEditor/index.svelte +0 -252
- package/dist/Components/AudioEditor/index.svelte.js +0 -977
- package/dist/Components/AudioEditor/samples/alloy-voice-sample.mp3 +0 -0
- package/dist/Components/AudioEditor/samples/echo-voice-sample.mp3 +0 -0
- package/dist/Components/AudioEditor/samples/fable-voice-sample.mp3 +0 -0
- package/dist/Components/AudioEditor/samples/nova-voice-sample.mp3 +0 -0
- package/dist/Components/AudioEditor/samples/onyx-voice-sample.mp3 +0 -0
- package/dist/Components/AudioEditor/samples/shimmer-voice-sample.mp3 +0 -0
- package/dist/Components/AuthCodeInput/index.svelte +0 -85
- package/dist/Components/AuthCodeInput/index.svelte.js +0 -95
- package/dist/Components/Breadcrumbs/index.svelte +0 -27
- package/dist/Components/Breadcrumbs/index.svelte.js +0 -88
- package/dist/Components/Button/index.svelte +0 -721
- package/dist/Components/Button/index.svelte.js +0 -375
- package/dist/Components/Chart/Klines/index.svelte +0 -87
- package/dist/Components/Chart/index.svelte +0 -226
- package/dist/Components/Chart/index.svelte.js +0 -1090
- package/dist/Components/ChartInput/DisplayNav/Klines/index.svelte +0 -150
- package/dist/Components/ChartInput/DisplayNav/Lines/index.svelte +0 -45
- package/dist/Components/ChartInput/DisplayNav/index.svelte +0 -297
- package/dist/Components/ChartInput/EditPanel/index.svelte +0 -155
- package/dist/Components/ChartInput/index.svelte +0 -21
- package/dist/Components/ChartInput/index.svelte.js +0 -671
- package/dist/Components/Checkbox/index.svelte +0 -411
- package/dist/Components/Checkbox/index.svelte.js +0 -178
- package/dist/Components/Code/index.svelte +0 -23
- package/dist/Components/Code/index.svelte.js +0 -33
- package/dist/Components/Color/index.svelte +0 -51
- package/dist/Components/Color/index.svelte.js +0 -31
- package/dist/Components/ColorInput/ChromaPicker/index.svelte +0 -50
- package/dist/Components/ColorInput/ColorPalette/index.svelte +0 -62
- package/dist/Components/ColorInput/OpacityPicker/index.svelte +0 -68
- package/dist/Components/ColorInput/ShowcasePicker/index.svelte +0 -136
- package/dist/Components/ColorInput/index.svelte +0 -70
- package/dist/Components/ColorInput/index.svelte.js +0 -386
- package/dist/Components/ConditionsInput/index.svelte +0 -46
- package/dist/Components/ConditionsInput/index.svelte.js +0 -201
- package/dist/Components/Confetti/index.svelte +0 -98
- package/dist/Components/Confetti/index.svelte.js +0 -94
- package/dist/Components/Content/index.svelte +0 -500
- package/dist/Components/Content/index.svelte.js +0 -910
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Audio/index.svelte +0 -31
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Audio/index.svelte.js +0 -258
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/AudioAdvanced/index.svelte +0 -31
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/AudioAdvanced/index.svelte.js +0 -258
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Dropdown/index.svelte +0 -58
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Dropdown/index.svelte.js +0 -206
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Image/index.svelte +0 -28
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Image/index.svelte.js +0 -224
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Number/index.svelte +0 -44
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Number/index.svelte.js +0 -272
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Qr/index.svelte +0 -41
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Qr/index.svelte.js +0 -202
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Slider/index.svelte +0 -19
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Slider/index.svelte.js +0 -117
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TableAdvanced/index.svelte +0 -60
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TableAdvanced/index.svelte.js +0 -542
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Tag/index.svelte +0 -47
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Tag/index.svelte.js +0 -185
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TextInput/index.svelte +0 -35
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TextInput/index.svelte.js +0 -222
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TimeInput/index.svelte +0 -20
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TimeInput/index.svelte.js +0 -84
- package/dist/Components/ContentInput/AttributesInput/DefinedTypeInput/index.svelte +0 -25
- package/dist/Components/ContentInput/AttributesInput/DefinedTypeInput/index.svelte.js +0 -91
- package/dist/Components/ContentInput/AttributesInput/index.svelte +0 -352
- package/dist/Components/ContentInput/AttributesInput/index.svelte.js +0 -1436
- package/dist/Components/ContentInput/ContentPanelBuilder/AddElement/index.svelte +0 -64
- package/dist/Components/ContentInput/ContentPanelBuilder/AddElement/index.svelte.js +0 -97
- package/dist/Components/ContentInput/ContentPanelBuilder/ElementList/index.svelte +0 -184
- package/dist/Components/ContentInput/ContentPanelBuilder/index.svelte +0 -41
- package/dist/Components/ContentInput/index.svelte +0 -78
- package/dist/Components/ContentInput/index.svelte.js +0 -1197
- package/dist/Components/CronInput/index.svelte +0 -78
- package/dist/Components/CronInput/index.svelte.js +0 -198
- package/dist/Components/DataTypeInput/index.svelte +0 -174
- package/dist/Components/DataTypeInput/index.svelte.js +0 -565
- package/dist/Components/Dropdown/index.svelte +0 -116
- package/dist/Components/Dropdown/index.svelte.js +0 -403
- package/dist/Components/EmailAddress/index.svelte +0 -22
- package/dist/Components/EmailAddress/index.svelte.js +0 -45
- package/dist/Components/ErrorX/index.svelte +0 -58
- package/dist/Components/Eye/index.svelte +0 -57
- package/dist/Components/FileInput/index.svelte +0 -146
- package/dist/Components/FileInput/index.svelte.js +0 -225
- package/dist/Components/Hamburger/index.svelte +0 -99
- package/dist/Components/HorizScrollBox/index.svelte +0 -145
- package/dist/Components/Icon/index.svelte +0 -412
- package/dist/Components/Icon/index.svelte.js +0 -116
- package/dist/Components/IconInput/index.svelte +0 -77
- package/dist/Components/IconInput/index.svelte.js +0 -259
- package/dist/Components/Image/index.svelte +0 -126
- package/dist/Components/Image/index.svelte.js +0 -116
- package/dist/Components/ImageEditor/Image/CropBox/index.svelte +0 -165
- package/dist/Components/ImageEditor/Image/index.svelte +0 -104
- package/dist/Components/ImageEditor/Panels/AI/index.svelte +0 -44
- package/dist/Components/ImageEditor/Panels/Crop/index.svelte +0 -96
- package/dist/Components/ImageEditor/Panels/File/QualityPicker/index.svelte +0 -124
- package/dist/Components/ImageEditor/Panels/File/index.svelte +0 -74
- package/dist/Components/ImageEditor/Panels/Filters/index.svelte +0 -46
- package/dist/Components/ImageEditor/Panels/Resize/index.svelte +0 -58
- package/dist/Components/ImageEditor/index.svelte +0 -93
- package/dist/Components/ImageEditor/index.svelte.js +0 -1961
- package/dist/Components/ImageSlider/index.svelte +0 -124
- package/dist/Components/ImageSlider/index.svelte.js +0 -99
- package/dist/Components/InfoBox/index.svelte +0 -89
- package/dist/Components/Json/Nested/index.svelte +0 -157
- package/dist/Components/Json/index.svelte +0 -60
- package/dist/Components/Json/index.svelte.js +0 -594
- package/dist/Components/LabeledItem/index.svelte +0 -102
- package/dist/Components/Layout/NavBar/FullNav/index.svelte +0 -52
- package/dist/Components/Layout/NavBar/NavGuts/index.svelte +0 -87
- package/dist/Components/Layout/NavBar/index.svelte +0 -72
- package/dist/Components/Layout/index.svelte +0 -149
- package/dist/Components/Layout/index.svelte.js +0 -360
- package/dist/Components/Link/index.svelte +0 -47
- package/dist/Components/Link/index.svelte.js +0 -136
- package/dist/Components/LoadingSuccessDiv/index.svelte +0 -51
- package/dist/Components/LoadingWheel/index.svelte +0 -38
- package/dist/Components/Location/index.svelte +0 -79
- package/dist/Components/Location/index.svelte.js +0 -288
- package/dist/Components/LocationInput/index.svelte +0 -197
- package/dist/Components/LocationInput/index.svelte.js +0 -965
- package/dist/Components/Number/index.svelte +0 -47
- package/dist/Components/Number/index.svelte.js +0 -151
- package/dist/Components/PhoneCountryCode/index.svelte +0 -7
- package/dist/Components/PhoneCountryCode/index.svelte.js +0 -260
- package/dist/Components/PhoneNumber/index.svelte +0 -22
- package/dist/Components/PhoneNumber/index.svelte.js +0 -41
- package/dist/Components/Popover/index.svelte +0 -396
- package/dist/Components/Popover/index.svelte.js +0 -319
- package/dist/Components/Qr/index.svelte +0 -85
- package/dist/Components/Qr/index.svelte.js +0 -301
- package/dist/Components/QrInput/index.svelte +0 -47
- package/dist/Components/QrInput/index.svelte.js +0 -218
- package/dist/Components/Slider/index.svelte +0 -239
- package/dist/Components/Slider/index.svelte.js +0 -469
- package/dist/Components/Spacer/index.svelte +0 -41
- package/dist/Components/StoragePicker/DisplayFile/index.svelte +0 -15
- package/dist/Components/StoragePicker/index.svelte +0 -187
- package/dist/Components/StoragePicker/index.svelte.js +0 -592
- package/dist/Components/SuccessCheck/index.svelte +0 -56
- package/dist/Components/TableAdvanced/ColumnInput/index.svelte +0 -117
- package/dist/Components/TableAdvanced/ColumnInput/index.svelte.js +0 -456
- package/dist/Components/TableAdvanced/FilterInput/index.svelte +0 -54
- package/dist/Components/TableAdvanced/FilterInput/index.svelte.js +0 -247
- package/dist/Components/TableAdvanced/Pagination/index.svelte +0 -43
- package/dist/Components/TableAdvanced/Pagination/index.svelte.js +0 -97
- package/dist/Components/TableAdvanced/SortByInput/index.svelte +0 -72
- package/dist/Components/TableAdvanced/SortByInput/index.svelte.js +0 -176
- package/dist/Components/TableAdvanced/index.svelte +0 -275
- package/dist/Components/TableAdvanced/index.svelte.js +0 -1565
- package/dist/Components/Tag/index.svelte +0 -45
- package/dist/Components/Tag/index.svelte.js +0 -76
- package/dist/Components/TextArrayInput/index.svelte +0 -108
- package/dist/Components/TextArrayInput/index.svelte.js +0 -239
- package/dist/Components/TextInput/PasswordTooltip/index.svelte +0 -89
- package/dist/Components/TextInput/index.svelte +0 -223
- package/dist/Components/TextInput/index.svelte.js +0 -447
- package/dist/Components/Time/index.svelte +0 -7
- package/dist/Components/Time/index.svelte.js +0 -38
- package/dist/Components/TimeInput/NumberToggler/index.svelte +0 -34
- package/dist/Components/TimeInput/NumberToggler/index.svelte.js +0 -79
- package/dist/Components/TimeInput/index.js +0 -702
- package/dist/Components/TimeInput/index.svelte +0 -211
- package/dist/Components/TimeInput/index.svelte.js +0 -638
- package/dist/Components/Tooltip/index.svelte +0 -143
- package/dist/Components/TransparentBackground/index.svelte +0 -153
- package/dist/Components/TypingDots/index.svelte +0 -84
- package/dist/Components/VariablePathInput/index.svelte +0 -63
- package/dist/Components/VariablePathInput/index.svelte.js +0 -273
- package/dist/Components/VideoTBD/index.svelte +0 -100
- package/dist/Components/XFollow/index.svelte +0 -42
- package/dist/Components/XPost/index.svelte +0 -52
- package/dist/Components/XPost/index.svelte.js +0 -64
- package/dist/Components/YoutubeChannelButton/index.svelte +0 -82
- package/dist/Components/YoutubeVideo/index.svelte +0 -73
- package/dist/Components/YoutubeVideo/index.svelte.js +0 -54
- package/dist/actions/draggable.js +0 -49
- package/dist/actions/index.js +0 -24
- package/dist/actions/no_spaces.js +0 -33
- package/dist/actions/numbers_only.js +0 -26
- package/dist/actions/scroll_y.js +0 -28
- package/dist/actions/stop_scroll_propagation_y.js +0 -42
- package/dist/actions/swipe_handler.js +0 -295
- package/dist/client/astc_formatting/index.js +0 -1128
- package/dist/client/docs/index.js +0 -7622
- package/dist/client/index.js +0 -735
- package/dist/client/types/index.js +0 -2812
- package/dist/index.js +0 -180
- package/dist/style.css +0 -682
|
@@ -1,386 +0,0 @@
|
|
|
1
|
-
import { deep_copy, create_unique_id, set_closurable } from "../../client/index.js"
|
|
2
|
-
import { create_checkbox_manager } from "../Checkbox/index.svelte.js"
|
|
3
|
-
import { create_button_manager } from "../Button/index.svelte.js"
|
|
4
|
-
import { create_popover_manager } from "../Popover/index.svelte.js"
|
|
5
|
-
|
|
6
|
-
export function create_color_input_manager(config) {
|
|
7
|
-
const base_range = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
|
|
8
|
-
let val_base = $state({
|
|
9
|
-
l: 19,
|
|
10
|
-
c: 10,
|
|
11
|
-
h: 15,
|
|
12
|
-
o: 24,
|
|
13
|
-
is_dark_theme_invert: true,
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
let id = create_unique_id(null, 20)
|
|
17
|
-
let val = $state(null)
|
|
18
|
-
let is_dark_theme_invert_checkbox_manager = $state(null)
|
|
19
|
-
let popover_manager = $state(null)
|
|
20
|
-
let toggle_button_manager = $state(null)
|
|
21
|
-
let finish_button_manager = $state(null)
|
|
22
|
-
let lightness_up_button_manager = $state(null)
|
|
23
|
-
let lightness_down_button_manager = $state(null)
|
|
24
|
-
let chroma_up_button_manager = $state(null)
|
|
25
|
-
let chroma_down_button_manager = $state(null)
|
|
26
|
-
let hue_up_button_manager = $state(null)
|
|
27
|
-
let hue_down_button_manager = $state(null)
|
|
28
|
-
let opacity_up_button_manager = $state(null)
|
|
29
|
-
let opacity_down_button_manager = $state(null)
|
|
30
|
-
let set_null_button_manager = $state(null)
|
|
31
|
-
|
|
32
|
-
let is_show_opacity = $derived(set_closurable(config?.is_show_opacity, true))
|
|
33
|
-
let l_options = $derived(order_num_options(set_closurable(config?.l_options, base_range)))
|
|
34
|
-
let c_options = $derived(order_num_options(set_closurable(config?.c_options, base_range)))
|
|
35
|
-
let h_options = $derived(order_num_options(set_closurable(config?.h_options, base_range)))
|
|
36
|
-
let o_options = $derived(order_num_options(set_closurable(config?.o_options, base_range)))
|
|
37
|
-
let label = $derived(set_closurable(config?.label, null))
|
|
38
|
-
|
|
39
|
-
function order_num_options(input) {
|
|
40
|
-
let res = deep_copy(input)
|
|
41
|
-
if (Array.isArray(res)) {
|
|
42
|
-
return res.sort((a, b) => a - b)
|
|
43
|
-
}
|
|
44
|
-
return null
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
let css_val = $derived(
|
|
48
|
-
typeof val?.l === "number" && typeof val?.c === "number" && typeof val?.h === "number" && typeof val?.o === "number"
|
|
49
|
-
? `oklch(var(--l${val.l}) var(--c${val.c}) var(--h${val.h}) / var(--o${val.o}))`
|
|
50
|
-
: "transparent"
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
function set_is_dark_theme_invert(input) {
|
|
54
|
-
if (val && typeof val == "object" && val.hasOwnProperty("is_dark_theme_invert")) {
|
|
55
|
-
val.is_dark_theme_invert = !!input
|
|
56
|
-
} else {
|
|
57
|
-
val = {
|
|
58
|
-
...(val ?? val_base),
|
|
59
|
-
is_dark_theme_invert: !!input,
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
is_dark_theme_invert_checkbox_manager.set_val(val?.is_dark_theme_invert)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function set_val(input) {
|
|
66
|
-
const val_static = set_closurable(input, null)
|
|
67
|
-
if (val_static) {
|
|
68
|
-
val = {
|
|
69
|
-
l: val_static?.l ?? val_base?.l,
|
|
70
|
-
c: val_static?.c ?? val_base?.c,
|
|
71
|
-
h: val_static?.h ?? val_base?.h,
|
|
72
|
-
o: val_static?.o ?? val_base?.o,
|
|
73
|
-
is_dark_theme_invert: val_static?.is_dark_theme_invert ?? is_dark_theme_invert_checkbox_manager?.val,
|
|
74
|
-
}
|
|
75
|
-
} else {
|
|
76
|
-
val = null
|
|
77
|
-
}
|
|
78
|
-
is_dark_theme_invert_checkbox_manager.set_val(val?.is_dark_theme_invert ?? val_base?.is_dark_theme_invert)
|
|
79
|
-
if (config?.on_change) {
|
|
80
|
-
config?.on_change(val)
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function get_value_in_range(value, custom_range, index_change = 1) {
|
|
85
|
-
const index = custom_range.findIndex((h) => h === value)
|
|
86
|
-
const new_index = index + index_change
|
|
87
|
-
if (new_index > -1 && new_index < custom_range.length) {
|
|
88
|
-
return custom_range[new_index]
|
|
89
|
-
} else {
|
|
90
|
-
return new_index >= custom_range.length ? custom_range[0] : custom_range[custom_range.length - 1]
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function set_lightness(l, change = 0, is_ignore_on_change = false) {
|
|
95
|
-
let l_to_use = get_value_in_range(l, l_options, change)
|
|
96
|
-
if (val && typeof val == "object" && val.hasOwnProperty("l")) {
|
|
97
|
-
val.l = l_to_use
|
|
98
|
-
} else {
|
|
99
|
-
val = {
|
|
100
|
-
...(val ?? val_base),
|
|
101
|
-
l: l_to_use,
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
is_dark_theme_invert_checkbox_manager.set_val(val?.is_dark_theme_invert)
|
|
105
|
-
if (config?.on_change && !is_ignore_on_change) {
|
|
106
|
-
config?.on_change(val)
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function set_chroma(c, change = 0) {
|
|
111
|
-
let c_to_use = get_value_in_range(c, c_options, change)
|
|
112
|
-
if (val && typeof val == "object" && val.hasOwnProperty("c")) {
|
|
113
|
-
val.c = c_to_use
|
|
114
|
-
} else {
|
|
115
|
-
val = {
|
|
116
|
-
...(val ?? val_base),
|
|
117
|
-
c: c_to_use,
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
is_dark_theme_invert_checkbox_manager.set_val(val?.is_dark_theme_invert)
|
|
121
|
-
let chroma_square_el = document?.querySelector(`#chroma_square_${id}_${c_to_use}`)
|
|
122
|
-
if (chroma_square_el) {
|
|
123
|
-
chroma_square_el.focus()
|
|
124
|
-
}
|
|
125
|
-
if (config?.on_change) {
|
|
126
|
-
config?.on_change(val)
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function set_hue(h, change = 0, is_ignore_on_change = false) {
|
|
131
|
-
let h_to_use = get_value_in_range(h, h_options, change)
|
|
132
|
-
if (val && typeof val == "object" && val.hasOwnProperty("h")) {
|
|
133
|
-
val.h = h_to_use
|
|
134
|
-
} else {
|
|
135
|
-
val = {
|
|
136
|
-
...(val ?? val_base),
|
|
137
|
-
h: h_to_use,
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
is_dark_theme_invert_checkbox_manager.set_val(val?.is_dark_theme_invert)
|
|
141
|
-
if (config?.on_change && is_ignore_on_change) {
|
|
142
|
-
config?.on_change(val)
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
function set_opacity(o, change = 0) {
|
|
147
|
-
let o_to_use = get_value_in_range(o, o_options, change)
|
|
148
|
-
if (val && typeof val == "object" && val.hasOwnProperty("o")) {
|
|
149
|
-
val.o = o_to_use
|
|
150
|
-
} else {
|
|
151
|
-
val = {
|
|
152
|
-
...(val ?? val_base),
|
|
153
|
-
o: o_to_use,
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
is_dark_theme_invert_checkbox_manager.set_val(val?.is_dark_theme_invert)
|
|
157
|
-
let opacity_square_el = document?.querySelector(`#opacity_square_${id}_${o_to_use}`)
|
|
158
|
-
if (opacity_square_el) {
|
|
159
|
-
opacity_square_el.focus()
|
|
160
|
-
}
|
|
161
|
-
if (config?.on_change) {
|
|
162
|
-
config?.on_change(val)
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function set_lightness_and_hue(l_input, h_input) {
|
|
167
|
-
set_lightness(l_input, 0, true)
|
|
168
|
-
set_hue(h_input, 0, true)
|
|
169
|
-
let color_square_el = document?.querySelector(`#lightness_hue_square_${id}_${val?.l}_${val?.h}`)
|
|
170
|
-
if (color_square_el) {
|
|
171
|
-
color_square_el.focus()
|
|
172
|
-
}
|
|
173
|
-
if (config?.on_change) {
|
|
174
|
-
config?.on_change(val)
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
function finish() {
|
|
179
|
-
popover_manager.close()
|
|
180
|
-
if (typeof config?.on_finish == "function") {
|
|
181
|
-
config?.on_finish(val)
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function init(config) {
|
|
186
|
-
val_base.is_dark_theme_invert = config?.is_dark_theme_invert
|
|
187
|
-
is_dark_theme_invert_checkbox_manager = create_checkbox_manager({
|
|
188
|
-
val: config?.is_dark_theme_invert,
|
|
189
|
-
type: "toggle",
|
|
190
|
-
on_change: (input) => set_is_dark_theme_invert(input),
|
|
191
|
-
})
|
|
192
|
-
popover_manager = create_popover_manager({
|
|
193
|
-
type: "dropdown",
|
|
194
|
-
min_width: 280,
|
|
195
|
-
min_height: 400,
|
|
196
|
-
target_width: 450,
|
|
197
|
-
target_height: Array.isArray(l_options) ? Math.min(80 + l_options.length * 25, 650) : 650,
|
|
198
|
-
anchor_id: () => `button_${toggle_button_manager?.id}`,
|
|
199
|
-
})
|
|
200
|
-
toggle_button_manager = create_button_manager({
|
|
201
|
-
type: "soft",
|
|
202
|
-
is_compressed: true,
|
|
203
|
-
pl: 0.3,
|
|
204
|
-
pr: 0.3,
|
|
205
|
-
popover_target: () => `popover_${popover_manager?.id}`,
|
|
206
|
-
})
|
|
207
|
-
finish_button_manager = create_button_manager({
|
|
208
|
-
text: "Finish",
|
|
209
|
-
h: 10,
|
|
210
|
-
l: 1,
|
|
211
|
-
c: 1,
|
|
212
|
-
on_click: () => finish(),
|
|
213
|
-
})
|
|
214
|
-
lightness_up_button_manager = create_button_manager({
|
|
215
|
-
type: "soft",
|
|
216
|
-
support_icon: "arrow",
|
|
217
|
-
icon_pos: "center",
|
|
218
|
-
min_height: 2.4,
|
|
219
|
-
pt: 0,
|
|
220
|
-
g_base: 8,
|
|
221
|
-
icon_sw: 40,
|
|
222
|
-
on_click: () => set_lightness(val?.l ?? val_base?.l, 1),
|
|
223
|
-
})
|
|
224
|
-
lightness_down_button_manager = create_button_manager({
|
|
225
|
-
type: "soft",
|
|
226
|
-
support_icon: "arrow",
|
|
227
|
-
icon_deg: 180,
|
|
228
|
-
icon_pos: "center",
|
|
229
|
-
min_height: 2.4,
|
|
230
|
-
pt: 0,
|
|
231
|
-
g_base: 8,
|
|
232
|
-
icon_sw: 40,
|
|
233
|
-
on_click: () => set_lightness(val?.l ?? val_base?.l, -1),
|
|
234
|
-
})
|
|
235
|
-
chroma_up_button_manager = create_button_manager({
|
|
236
|
-
type: "soft",
|
|
237
|
-
support_icon: "arrow",
|
|
238
|
-
icon_pos: "center",
|
|
239
|
-
min_height: 2.4,
|
|
240
|
-
pt: 0,
|
|
241
|
-
g_base: 8,
|
|
242
|
-
icon_sw: 40,
|
|
243
|
-
on_click: () => set_chroma(val?.c ?? val_base?.c, 1),
|
|
244
|
-
})
|
|
245
|
-
chroma_down_button_manager = create_button_manager({
|
|
246
|
-
type: "soft",
|
|
247
|
-
support_icon: "arrow",
|
|
248
|
-
icon_deg: 180,
|
|
249
|
-
icon_pos: "center",
|
|
250
|
-
min_height: 2.4,
|
|
251
|
-
pt: 0,
|
|
252
|
-
g_base: 8,
|
|
253
|
-
icon_sw: 40,
|
|
254
|
-
on_click: () => set_chroma(val?.c ?? val_base?.c, -1),
|
|
255
|
-
})
|
|
256
|
-
hue_up_button_manager = create_button_manager({
|
|
257
|
-
type: "soft",
|
|
258
|
-
support_icon: "arrow",
|
|
259
|
-
icon_pos: "center",
|
|
260
|
-
min_height: 2.4,
|
|
261
|
-
pt: 0,
|
|
262
|
-
g_base: 8,
|
|
263
|
-
icon_sw: 40,
|
|
264
|
-
on_click: () => set_hue(val?.h ?? val_base?.h, 1),
|
|
265
|
-
})
|
|
266
|
-
hue_down_button_manager = create_button_manager({
|
|
267
|
-
type: "soft",
|
|
268
|
-
support_icon: "arrow",
|
|
269
|
-
icon_deg: 180,
|
|
270
|
-
icon_pos: "center",
|
|
271
|
-
min_height: 2.4,
|
|
272
|
-
pt: 0,
|
|
273
|
-
g_base: 8,
|
|
274
|
-
icon_sw: 40,
|
|
275
|
-
on_click: () => set_hue(val?.h ?? val_base?.h, -1),
|
|
276
|
-
})
|
|
277
|
-
opacity_up_button_manager = create_button_manager({
|
|
278
|
-
type: "soft",
|
|
279
|
-
support_icon: "arrow",
|
|
280
|
-
icon_pos: "center",
|
|
281
|
-
min_height: 2.4,
|
|
282
|
-
pt: 0,
|
|
283
|
-
g_base: 8,
|
|
284
|
-
icon_sw: 40,
|
|
285
|
-
on_click: () => set_opacity(val?.o ?? val_base?.o, 1),
|
|
286
|
-
})
|
|
287
|
-
opacity_down_button_manager = create_button_manager({
|
|
288
|
-
type: "soft",
|
|
289
|
-
support_icon: "arrow",
|
|
290
|
-
icon_deg: 180,
|
|
291
|
-
icon_pos: "center",
|
|
292
|
-
min_height: 2.4,
|
|
293
|
-
pt: 0,
|
|
294
|
-
g_base: 8,
|
|
295
|
-
icon_sw: 40,
|
|
296
|
-
on_click: () => set_opacity(val?.o ?? val_base?.o, -1),
|
|
297
|
-
})
|
|
298
|
-
set_null_button_manager = create_button_manager({
|
|
299
|
-
type: "outlined",
|
|
300
|
-
text: "Set null",
|
|
301
|
-
font_size: 1.2,
|
|
302
|
-
on_click: () => (val = null),
|
|
303
|
-
})
|
|
304
|
-
set_val(config?.val)
|
|
305
|
-
}
|
|
306
|
-
init(config)
|
|
307
|
-
|
|
308
|
-
return {
|
|
309
|
-
id,
|
|
310
|
-
get val_base() {
|
|
311
|
-
return val_base
|
|
312
|
-
},
|
|
313
|
-
get val() {
|
|
314
|
-
return val
|
|
315
|
-
},
|
|
316
|
-
get label() {
|
|
317
|
-
return label
|
|
318
|
-
},
|
|
319
|
-
get css_val() {
|
|
320
|
-
return css_val
|
|
321
|
-
},
|
|
322
|
-
get is_show_opacity() {
|
|
323
|
-
return is_show_opacity
|
|
324
|
-
},
|
|
325
|
-
get l_options() {
|
|
326
|
-
return l_options
|
|
327
|
-
},
|
|
328
|
-
get c_options() {
|
|
329
|
-
return c_options
|
|
330
|
-
},
|
|
331
|
-
get h_options() {
|
|
332
|
-
return h_options
|
|
333
|
-
},
|
|
334
|
-
get o_options() {
|
|
335
|
-
return o_options
|
|
336
|
-
},
|
|
337
|
-
get popover_manager() {
|
|
338
|
-
return popover_manager
|
|
339
|
-
},
|
|
340
|
-
get is_dark_theme_invert_checkbox_manager() {
|
|
341
|
-
return is_dark_theme_invert_checkbox_manager
|
|
342
|
-
},
|
|
343
|
-
get toggle_button_manager() {
|
|
344
|
-
return toggle_button_manager
|
|
345
|
-
},
|
|
346
|
-
get finish_button_manager() {
|
|
347
|
-
return finish_button_manager
|
|
348
|
-
},
|
|
349
|
-
get lightness_up_button_manager() {
|
|
350
|
-
return lightness_up_button_manager
|
|
351
|
-
},
|
|
352
|
-
get lightness_down_button_manager() {
|
|
353
|
-
return lightness_down_button_manager
|
|
354
|
-
},
|
|
355
|
-
get chroma_up_button_manager() {
|
|
356
|
-
return chroma_up_button_manager
|
|
357
|
-
},
|
|
358
|
-
get chroma_down_button_manager() {
|
|
359
|
-
return chroma_down_button_manager
|
|
360
|
-
},
|
|
361
|
-
get hue_up_button_manager() {
|
|
362
|
-
return hue_up_button_manager
|
|
363
|
-
},
|
|
364
|
-
get hue_down_button_manager() {
|
|
365
|
-
return hue_down_button_manager
|
|
366
|
-
},
|
|
367
|
-
get opacity_up_button_manager() {
|
|
368
|
-
return opacity_up_button_manager
|
|
369
|
-
},
|
|
370
|
-
get opacity_down_button_manager() {
|
|
371
|
-
return opacity_down_button_manager
|
|
372
|
-
},
|
|
373
|
-
get set_null_button_manager() {
|
|
374
|
-
return set_null_button_manager
|
|
375
|
-
},
|
|
376
|
-
init,
|
|
377
|
-
set_val,
|
|
378
|
-
set_chroma,
|
|
379
|
-
set_hue,
|
|
380
|
-
set_lightness,
|
|
381
|
-
set_opacity,
|
|
382
|
-
set_lightness_and_hue,
|
|
383
|
-
set_is_dark_theme_invert,
|
|
384
|
-
finish,
|
|
385
|
-
}
|
|
386
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import Popover from "../Popover/index.svelte"
|
|
3
|
-
import Button from "../Button/index.svelte"
|
|
4
|
-
import TextInput from "../TextInput/index.svelte"
|
|
5
|
-
import Dropdown from "../Dropdown/index.svelte"
|
|
6
|
-
import TimeInput from "../TimeInput/index.svelte"
|
|
7
|
-
|
|
8
|
-
let { manager } = $props()
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<Button manager={manager?.popover_toggle_button_manager} />
|
|
12
|
-
<Popover manager={manager?.popover_manager}>
|
|
13
|
-
{#snippet content()}
|
|
14
|
-
<div class="popover_content_container">
|
|
15
|
-
<div style="display: flex; flex-direction: column; flex: 1; gap: 1rem;">
|
|
16
|
-
<Dropdown manager={manager?.operator_dropdown_manager} />
|
|
17
|
-
oo
|
|
18
|
-
{#if Array.isArray(manager?.conditions) && manager?.conditions.length > 0}
|
|
19
|
-
{#each manager?.conditions as condition, i}
|
|
20
|
-
qqq:{condition?.input_type}
|
|
21
|
-
{#if condition?.type == "operator"}
|
|
22
|
-
condition is operator (tbd)
|
|
23
|
-
<!-- if want to nest i can extend functionality later -->
|
|
24
|
-
{:else}
|
|
25
|
-
<div style="display: flex; gap: 1rem;">
|
|
26
|
-
<Button manager={condition?.x_button_manager} />
|
|
27
|
-
<Dropdown manager={condition?.predicate_dropdown_manager} />
|
|
28
|
-
{#if condition?.input_type == "time"}
|
|
29
|
-
<TimeInput manager={condition?.input_manager} />
|
|
30
|
-
{:else if ["number", "text"].includes(condition?.input_type)}
|
|
31
|
-
<TextInput manager={condition?.input_manager} />
|
|
32
|
-
{/if}
|
|
33
|
-
</div>
|
|
34
|
-
{/if}
|
|
35
|
-
{/each}
|
|
36
|
-
{:else}
|
|
37
|
-
<p>No Conditions</p>
|
|
38
|
-
{/if}
|
|
39
|
-
<Button manager={manager?.add_condition_button_manager} />
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
{/snippet}
|
|
43
|
-
{#snippet footer()}
|
|
44
|
-
<Button manager={manager?.finish_button_manager} />
|
|
45
|
-
{/snippet}
|
|
46
|
-
</Popover>
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { create_popover_manager } from "../Popover/index.svelte.js"
|
|
2
|
-
import { create_button_manager } from "../Button/index.svelte.js"
|
|
3
|
-
import { create_dropdown_manager } from "../Dropdown/index.svelte.js"
|
|
4
|
-
// import { create_time_input_manager } from "../TimeInput/index.svelte.js"
|
|
5
|
-
import { create_text_input_manager } from "../TextInput/index.svelte.js"
|
|
6
|
-
|
|
7
|
-
export function create_conditions_input_manager(config) {
|
|
8
|
-
let val = $state(null)
|
|
9
|
-
let data_type = $state(null)
|
|
10
|
-
let conditions = $state(null)
|
|
11
|
-
let popover_manager = $state(null)
|
|
12
|
-
let popover_toggle_button_manager = $state(null)
|
|
13
|
-
let finish_button_manager = $state(null)
|
|
14
|
-
let add_condition_button_manager = $state(null)
|
|
15
|
-
let operator_dropdown_manager = $state(null)
|
|
16
|
-
|
|
17
|
-
const operator_options = [
|
|
18
|
-
{ key: "all_of", name: "All Of" },
|
|
19
|
-
{ key: "any_of", name: "Any Of" },
|
|
20
|
-
]
|
|
21
|
-
|
|
22
|
-
const number_predicate_options = [
|
|
23
|
-
{ key: "equal_to", name: "equals (==)", input: "number" },
|
|
24
|
-
{ key: "not_equal_to", name: "not equal to (!=)", input: "number" },
|
|
25
|
-
{ key: "less_than", name: "less than (<)", input: "number" },
|
|
26
|
-
{ key: "less_than_or_equal", name: "less than or equal to (<=)", input: "number" },
|
|
27
|
-
{ key: "greater_than", name: "greater than (>)", input: "number" },
|
|
28
|
-
{ key: "greater_than_or_equal", name: "greater than or equal to (>=)", input: "number" },
|
|
29
|
-
]
|
|
30
|
-
|
|
31
|
-
const text_predicate_options = [
|
|
32
|
-
{ key: "equal_to", name: "equals (==)", input: "text" },
|
|
33
|
-
{ key: "not_equal_to", name: "not equal to (!=)", input: "text" },
|
|
34
|
-
{ key: "contains", name: "contains", input: "text" },
|
|
35
|
-
{ key: "does_not_contain", name: "does not contain", input: "text" },
|
|
36
|
-
{ key: "starts_with", name: "starts with", input: "text" },
|
|
37
|
-
{ key: "ends_with", name: "ends with", input: "text" },
|
|
38
|
-
]
|
|
39
|
-
|
|
40
|
-
const time_predicate_options = [
|
|
41
|
-
{ key: "past_x_hours", name: "Past _ Hours", input: "none" },
|
|
42
|
-
{ key: "past_x_days", name: "Past _ Days", input: "none" },
|
|
43
|
-
{ key: "on_day_of_week", name: "On _ Day Of Week", input: "none" },
|
|
44
|
-
{ key: "today", name: "Today", input: "none" },
|
|
45
|
-
{ key: "yesterday", name: "Yesterday", input: "none" },
|
|
46
|
-
{ key: "tomorrow", name: "Tomorrow", input: "none" },
|
|
47
|
-
{ key: "this_calendar_month", name: "This Calendar Month", input: "none" },
|
|
48
|
-
{ key: "this_calendar_year", name: "This Calendar Year", input: "none" },
|
|
49
|
-
{ key: "last_calendar_month", name: "Last Calendar Month", input: "none" },
|
|
50
|
-
{ key: "last_calendar_year", name: "Last Calendar Year", input: "none" },
|
|
51
|
-
{ key: "next_calendar_month", name: "Next Calendar Month", input: "none" },
|
|
52
|
-
{ key: "next_calendar_year", name: "Next Calendar Year", input: "none" },
|
|
53
|
-
{ key: "before_epoch", name: "Before _", input: "time" },
|
|
54
|
-
{ key: "after_epoch", name: "After _", input: "time" },
|
|
55
|
-
{ key: "on_specific_date", name: "On _ Date", input: "time" },
|
|
56
|
-
]
|
|
57
|
-
|
|
58
|
-
let predicate_options = $derived(
|
|
59
|
-
data_type?.type == "text_literal"
|
|
60
|
-
? text_predicate_options
|
|
61
|
-
: ["int_literal", "float_literal", "bigint_literal"].includes(data_type?.type)
|
|
62
|
-
? number_predicate_options
|
|
63
|
-
: data_type?.type == "time_literal"
|
|
64
|
-
? time_predicate_options
|
|
65
|
-
: []
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
function set_conditions() {
|
|
69
|
-
let conditions_loc = []
|
|
70
|
-
if (val?.type == "operator" && Array.isArray(val?.conditions) && val?.conditions.length > 0) {
|
|
71
|
-
for (let i = 0; i < val?.conditions.length; i++) {
|
|
72
|
-
const input_type = predicate_options.find((h) => h?.key == val?.conditions?.[i]?.predicate)?.input
|
|
73
|
-
console.log("predicate_options", predicate_options, input_type)
|
|
74
|
-
conditions_loc.push({
|
|
75
|
-
input_type: input_type,
|
|
76
|
-
x_button_manager: create_button_manager({
|
|
77
|
-
type: "outlined",
|
|
78
|
-
support_icon: "x",
|
|
79
|
-
is_uniform: true,
|
|
80
|
-
on_click: () => (val.conditions = [...val?.conditions].filter((_, index) => index !== i)),
|
|
81
|
-
}),
|
|
82
|
-
predicate_dropdown_manager: create_dropdown_manager({
|
|
83
|
-
options: predicate_options,
|
|
84
|
-
val: val?.conditions?.[i]?.predicate,
|
|
85
|
-
is_compressed: true,
|
|
86
|
-
on_item_click: (input) => (val.conditions[i].predicate = input?.key),
|
|
87
|
-
}),
|
|
88
|
-
// input_manager:
|
|
89
|
-
// input_type == "time"
|
|
90
|
-
// ? create_time_input_manager({
|
|
91
|
-
// val: val?.conditions?.[i]?.value,
|
|
92
|
-
// is_finish_button: true,
|
|
93
|
-
// is_input_button: true,
|
|
94
|
-
// on_finish: (input) => (val.conditions[i].value = input),
|
|
95
|
-
// })
|
|
96
|
-
// : ["number", "text"].includes(input_type)
|
|
97
|
-
// ? create_text_input_manager({
|
|
98
|
-
// type: input_type,
|
|
99
|
-
// val: val?.conditions?.[i]?.value,
|
|
100
|
-
// placeholder: "value",
|
|
101
|
-
// on_input: (input) => (val.conditions[i].value = input),
|
|
102
|
-
// })
|
|
103
|
-
// : null,
|
|
104
|
-
})
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
conditions = conditions_loc
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function finish() {
|
|
111
|
-
popover_manager.close()
|
|
112
|
-
if (typeof config?.on_finish == "function") {
|
|
113
|
-
config?.on_finish()
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function add_condition() {
|
|
118
|
-
console.log("add_condition", val)
|
|
119
|
-
val.conditions = [
|
|
120
|
-
...val?.conditions,
|
|
121
|
-
{
|
|
122
|
-
type: "predicate",
|
|
123
|
-
predicate: null,
|
|
124
|
-
value: null,
|
|
125
|
-
},
|
|
126
|
-
]
|
|
127
|
-
set_conditions()
|
|
128
|
-
console.log("add_condition2", val)
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function init(config) {
|
|
132
|
-
data_type = config?.data_type
|
|
133
|
-
val = config?.val ?? {
|
|
134
|
-
type: "operator",
|
|
135
|
-
operator: "all_of",
|
|
136
|
-
conditions: [],
|
|
137
|
-
}
|
|
138
|
-
popover_manager = create_popover_manager({
|
|
139
|
-
min_width: 320,
|
|
140
|
-
target_width: 400,
|
|
141
|
-
min_height: 320,
|
|
142
|
-
target_height: 400,
|
|
143
|
-
type: "center",
|
|
144
|
-
header: "Condition Builder",
|
|
145
|
-
anchor_id: () => `button_${popover_toggle_button_manager?.id}`,
|
|
146
|
-
})
|
|
147
|
-
popover_toggle_button_manager = create_button_manager({
|
|
148
|
-
type: "outlined",
|
|
149
|
-
is_compressed: true,
|
|
150
|
-
text: "Edit Conditions",
|
|
151
|
-
popover_target: () => `popover_${popover_manager?.id}`,
|
|
152
|
-
})
|
|
153
|
-
operator_dropdown_manager = create_dropdown_manager({
|
|
154
|
-
options: operator_options,
|
|
155
|
-
val: val?.operator,
|
|
156
|
-
is_button_compressed: true,
|
|
157
|
-
on_item_click: (input) => (val.operator = input?.key),
|
|
158
|
-
})
|
|
159
|
-
add_condition_button_manager = create_button_manager({
|
|
160
|
-
type: "outlined",
|
|
161
|
-
is_compressed: true,
|
|
162
|
-
text: "Add Condition",
|
|
163
|
-
support_icon: "plus",
|
|
164
|
-
on_click: () => add_condition(),
|
|
165
|
-
})
|
|
166
|
-
finish_button_manager = create_button_manager({
|
|
167
|
-
text: "Finish",
|
|
168
|
-
on_click: () => finish(),
|
|
169
|
-
})
|
|
170
|
-
}
|
|
171
|
-
init(config)
|
|
172
|
-
|
|
173
|
-
return {
|
|
174
|
-
get val() {
|
|
175
|
-
return val
|
|
176
|
-
},
|
|
177
|
-
get conditions() {
|
|
178
|
-
return conditions
|
|
179
|
-
},
|
|
180
|
-
get predicate_options() {
|
|
181
|
-
return predicate_options
|
|
182
|
-
},
|
|
183
|
-
get popover_manager() {
|
|
184
|
-
return popover_manager
|
|
185
|
-
},
|
|
186
|
-
get popover_toggle_button_manager() {
|
|
187
|
-
return popover_toggle_button_manager
|
|
188
|
-
},
|
|
189
|
-
get operator_dropdown_manager() {
|
|
190
|
-
return operator_dropdown_manager
|
|
191
|
-
},
|
|
192
|
-
get finish_button_manager() {
|
|
193
|
-
return finish_button_manager
|
|
194
|
-
},
|
|
195
|
-
get add_condition_button_manager() {
|
|
196
|
-
return add_condition_button_manager
|
|
197
|
-
},
|
|
198
|
-
add_condition,
|
|
199
|
-
finish,
|
|
200
|
-
}
|
|
201
|
-
}
|