sveltekit-ui 1.1.17 → 1.1.19
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/Components/Alert/index.svelte +88 -0
- package/dist/Components/Alert/index.svelte.js +101 -0
- package/dist/Components/ArrowToggle/index.svelte +62 -0
- package/dist/Components/Attachment/index.svelte +77 -0
- package/dist/Components/Attachment/index.svelte.js +119 -0
- package/dist/Components/Audio/index.svelte +193 -0
- package/dist/Components/Audio/index.svelte.js +463 -0
- package/dist/Components/AudioEditor/index.svelte +252 -0
- package/dist/Components/AudioEditor/index.svelte.js +977 -0
- 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 +85 -0
- package/dist/Components/AuthCodeInput/index.svelte.js +95 -0
- package/dist/Components/Breadcrumbs/index.svelte +27 -0
- package/dist/Components/Breadcrumbs/index.svelte.js +88 -0
- package/dist/Components/Button/index.svelte +721 -0
- package/dist/Components/Button/index.svelte.js +375 -0
- package/dist/Components/Chart/Klines/index.svelte +87 -0
- package/dist/Components/Chart/index.svelte +226 -0
- package/dist/Components/Chart/index.svelte.js +1099 -0
- package/dist/Components/ChartInput/DisplayNav/Klines/index.svelte +150 -0
- package/dist/Components/ChartInput/DisplayNav/Lines/index.svelte +45 -0
- package/dist/Components/ChartInput/DisplayNav/index.svelte +297 -0
- package/dist/Components/ChartInput/EditPanel/index.svelte +155 -0
- package/dist/Components/ChartInput/index.svelte +21 -0
- package/dist/Components/ChartInput/index.svelte.js +671 -0
- package/dist/Components/Checkbox/index.svelte +411 -0
- package/dist/Components/Checkbox/index.svelte.js +178 -0
- package/dist/Components/Code/index.svelte +23 -0
- package/dist/Components/Code/index.svelte.js +33 -0
- package/dist/Components/Color/index.svelte +51 -0
- package/dist/Components/Color/index.svelte.js +31 -0
- package/dist/Components/ColorInput/ChromaPicker/index.svelte +50 -0
- package/dist/Components/ColorInput/ColorPalette/index.svelte +62 -0
- package/dist/Components/ColorInput/OpacityPicker/index.svelte +68 -0
- package/dist/Components/ColorInput/ShowcasePicker/index.svelte +136 -0
- package/dist/Components/ColorInput/index.svelte +70 -0
- package/dist/Components/ColorInput/index.svelte.js +386 -0
- package/dist/Components/ConditionsInput/index.svelte +46 -0
- package/dist/Components/ConditionsInput/index.svelte.js +201 -0
- package/dist/Components/Confetti/index.svelte +98 -0
- package/dist/Components/Confetti/index.svelte.js +94 -0
- package/dist/Components/Content/index.svelte +500 -0
- package/dist/Components/Content/index.svelte.js +910 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Audio/index.svelte +31 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Audio/index.svelte.js +258 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/AudioAdvanced/index.svelte +31 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/AudioAdvanced/index.svelte.js +258 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Dropdown/index.svelte +58 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Dropdown/index.svelte.js +206 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Image/index.svelte +28 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Image/index.svelte.js +224 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Number/index.svelte +44 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Number/index.svelte.js +272 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Qr/index.svelte +41 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Qr/index.svelte.js +202 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Slider/index.svelte +19 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Slider/index.svelte.js +117 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TableAdvanced/index.svelte +60 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TableAdvanced/index.svelte.js +542 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Tag/index.svelte +47 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Tag/index.svelte.js +185 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TextInput/index.svelte +35 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TextInput/index.svelte.js +222 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TimeInput/index.svelte +20 -0
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TimeInput/index.svelte.js +84 -0
- package/dist/Components/ContentInput/AttributesInput/DefinedTypeInput/index.svelte +25 -0
- package/dist/Components/ContentInput/AttributesInput/DefinedTypeInput/index.svelte.js +91 -0
- package/dist/Components/ContentInput/AttributesInput/index.svelte +352 -0
- package/dist/Components/ContentInput/AttributesInput/index.svelte.js +1436 -0
- package/dist/Components/ContentInput/ContentPanelBuilder/AddElement/index.svelte +64 -0
- package/dist/Components/ContentInput/ContentPanelBuilder/AddElement/index.svelte.js +97 -0
- package/dist/Components/ContentInput/ContentPanelBuilder/ElementList/index.svelte +184 -0
- package/dist/Components/ContentInput/ContentPanelBuilder/index.svelte +41 -0
- package/dist/Components/ContentInput/index.svelte +78 -0
- package/dist/Components/ContentInput/index.svelte.js +1197 -0
- package/dist/Components/CronInput/index.svelte +78 -0
- package/dist/Components/CronInput/index.svelte.js +198 -0
- package/dist/Components/DataTypeInput/index.svelte +174 -0
- package/dist/Components/DataTypeInput/index.svelte.js +565 -0
- package/dist/Components/Dropdown/index.svelte +116 -0
- package/dist/Components/Dropdown/index.svelte.js +403 -0
- package/dist/Components/EmailAddress/index.svelte +22 -0
- package/dist/Components/EmailAddress/index.svelte.js +45 -0
- package/dist/Components/ErrorX/index.svelte +58 -0
- package/dist/Components/Eye/index.svelte +57 -0
- package/dist/Components/FileInput/index.svelte +146 -0
- package/dist/Components/FileInput/index.svelte.js +225 -0
- package/dist/Components/Hamburger/index.svelte +99 -0
- package/dist/Components/HorizScrollBox/index.svelte +145 -0
- package/dist/Components/Icon/index.svelte +412 -0
- package/dist/Components/Icon/index.svelte.js +116 -0
- package/dist/Components/IconInput/index.svelte +77 -0
- package/dist/Components/IconInput/index.svelte.js +259 -0
- package/dist/Components/Image/index.svelte +126 -0
- package/dist/Components/Image/index.svelte.js +116 -0
- package/dist/Components/ImageEditor/Image/CropBox/index.svelte +165 -0
- package/dist/Components/ImageEditor/Image/index.svelte +104 -0
- package/dist/Components/ImageEditor/Panels/AI/index.svelte +44 -0
- package/dist/Components/ImageEditor/Panels/Crop/index.svelte +96 -0
- package/dist/Components/ImageEditor/Panels/File/QualityPicker/index.svelte +124 -0
- package/dist/Components/ImageEditor/Panels/File/index.svelte +74 -0
- package/dist/Components/ImageEditor/Panels/Filters/index.svelte +46 -0
- package/dist/Components/ImageEditor/Panels/Resize/index.svelte +58 -0
- package/dist/Components/ImageEditor/index.svelte +93 -0
- package/dist/Components/ImageEditor/index.svelte.js +1961 -0
- package/dist/Components/ImageSlider/index.svelte +124 -0
- package/dist/Components/ImageSlider/index.svelte.js +99 -0
- package/dist/Components/InfoBox/index.svelte +89 -0
- package/dist/Components/Json/Nested/index.svelte +157 -0
- package/dist/Components/Json/index.svelte +60 -0
- package/dist/Components/Json/index.svelte.js +594 -0
- package/dist/Components/LabeledItem/index.svelte +102 -0
- package/dist/Components/Layout/NavBar/FullNav/index.svelte +52 -0
- package/dist/Components/Layout/NavBar/NavGuts/index.svelte +87 -0
- package/dist/Components/Layout/NavBar/index.svelte +72 -0
- package/dist/Components/Layout/index.svelte +149 -0
- package/dist/Components/Layout/index.svelte.js +360 -0
- package/dist/Components/Link/index.svelte +47 -0
- package/dist/Components/Link/index.svelte.js +136 -0
- package/dist/Components/LoadingSuccessDiv/index.svelte +51 -0
- package/dist/Components/LoadingWheel/index.svelte +38 -0
- package/dist/Components/Location/index.svelte +79 -0
- package/dist/Components/Location/index.svelte.js +288 -0
- package/dist/Components/LocationInput/index.svelte +197 -0
- package/dist/Components/LocationInput/index.svelte.js +965 -0
- package/dist/Components/Number/index.svelte +47 -0
- package/dist/Components/Number/index.svelte.js +151 -0
- package/dist/Components/PhoneCountryCode/index.svelte +7 -0
- package/dist/Components/PhoneCountryCode/index.svelte.js +260 -0
- package/dist/Components/PhoneNumber/index.svelte +22 -0
- package/dist/Components/PhoneNumber/index.svelte.js +41 -0
- package/dist/Components/Popover/index.svelte +396 -0
- package/dist/Components/Popover/index.svelte.js +319 -0
- package/dist/Components/Qr/index.svelte +85 -0
- package/dist/Components/Qr/index.svelte.js +301 -0
- package/dist/Components/QrInput/index.svelte +47 -0
- package/dist/Components/QrInput/index.svelte.js +218 -0
- package/dist/Components/Slider/index.svelte +239 -0
- package/dist/Components/Slider/index.svelte.js +469 -0
- package/dist/Components/Spacer/index.svelte +41 -0
- package/dist/Components/StoragePicker/DisplayFile/index.svelte +15 -0
- package/dist/Components/StoragePicker/index.svelte +187 -0
- package/dist/Components/StoragePicker/index.svelte.js +592 -0
- package/dist/Components/SuccessCheck/index.svelte +56 -0
- package/dist/Components/TableAdvanced/ColumnInput/index.svelte +117 -0
- package/dist/Components/TableAdvanced/ColumnInput/index.svelte.js +456 -0
- package/dist/Components/TableAdvanced/FilterInput/index.svelte +54 -0
- package/dist/Components/TableAdvanced/FilterInput/index.svelte.js +247 -0
- package/dist/Components/TableAdvanced/Pagination/index.svelte +43 -0
- package/dist/Components/TableAdvanced/Pagination/index.svelte.js +97 -0
- package/dist/Components/TableAdvanced/SortByInput/index.svelte +72 -0
- package/dist/Components/TableAdvanced/SortByInput/index.svelte.js +176 -0
- package/dist/Components/TableAdvanced/index.svelte +275 -0
- package/dist/Components/TableAdvanced/index.svelte.js +1565 -0
- package/dist/Components/Tag/index.svelte +45 -0
- package/dist/Components/Tag/index.svelte.js +76 -0
- package/dist/Components/TextArrayInput/index.svelte +108 -0
- package/dist/Components/TextArrayInput/index.svelte.js +239 -0
- package/dist/Components/TextInput/PasswordTooltip/index.svelte +89 -0
- package/dist/Components/TextInput/index.svelte +223 -0
- package/dist/Components/TextInput/index.svelte.js +447 -0
- package/dist/Components/Time/index.svelte +7 -0
- package/dist/Components/Time/index.svelte.js +38 -0
- package/dist/Components/TimeInput/NumberToggler/index.svelte +34 -0
- package/dist/Components/TimeInput/NumberToggler/index.svelte.js +79 -0
- package/dist/Components/TimeInput/index.js +702 -0
- package/dist/Components/TimeInput/index.svelte +211 -0
- package/dist/Components/TimeInput/index.svelte.js +638 -0
- package/dist/Components/Tooltip/index.svelte +143 -0
- package/dist/Components/TransparentBackground/index.svelte +153 -0
- package/dist/Components/TypingDots/index.svelte +84 -0
- package/dist/Components/VariablePathInput/index.svelte +63 -0
- package/dist/Components/VariablePathInput/index.svelte.js +273 -0
- package/dist/Components/VideoTBD/index.svelte +100 -0
- package/dist/Components/XFollow/index.svelte +42 -0
- package/dist/Components/XPost/index.svelte +52 -0
- package/dist/Components/XPost/index.svelte.js +64 -0
- package/dist/Components/YoutubeChannelButton/index.svelte +82 -0
- package/dist/Components/YoutubeVideo/index.svelte +73 -0
- package/dist/Components/YoutubeVideo/index.svelte.js +54 -0
- package/dist/actions/draggable.js +49 -0
- package/dist/actions/index.js +24 -0
- package/dist/actions/no_spaces.js +33 -0
- package/dist/actions/numbers_only.js +26 -0
- package/dist/actions/scroll_y.js +28 -0
- package/dist/actions/stop_scroll_propagation_y.js +42 -0
- package/dist/actions/swipe_handler.js +295 -0
- package/dist/client/astc_formatting/index.js +1128 -0
- package/dist/client/docs/index.js +7622 -0
- package/dist/client/index.js +735 -0
- package/dist/client/types/index.js +2812 -0
- package/dist/index.js +180 -0
- package/dist/style.css +682 -0
- package/package.json +2 -2
- package/src/lib/Components/Chart/index.svelte.js +11 -2
|
@@ -0,0 +1,910 @@
|
|
|
1
|
+
import { create_audio_manager } from "../Audio/index.svelte.js"
|
|
2
|
+
import { create_image_manager } from "../Image/index.svelte.js"
|
|
3
|
+
import { create_color_manager } from "../Color/index.svelte.js"
|
|
4
|
+
import { create_code_manager } from "../Code/index.svelte.js"
|
|
5
|
+
import { create_email_address_manager } from "../EmailAddress/index.svelte.js"
|
|
6
|
+
import { create_number_manager } from "../Number/index.svelte.js"
|
|
7
|
+
import { create_phone_number_manager } from "../PhoneNumber/index.svelte.js"
|
|
8
|
+
import { create_table_advanced_manager } from "../TableAdvanced/index.svelte.js"
|
|
9
|
+
import { create_icon_input_manager } from "../IconInput/index.svelte.js"
|
|
10
|
+
import { create_icon_manager } from "../Icon/index.svelte.js"
|
|
11
|
+
import { create_json_manager } from "../Json/index.svelte.js"
|
|
12
|
+
// import { create_tag_manager } from "../Tag/index.svelte.js" // might figure some function builder for conditions but tbd how to best handle
|
|
13
|
+
import { create_link_manager } from "../Link/index.svelte.js"
|
|
14
|
+
import { create_x_post_manager } from "../XPost/index.svelte.js"
|
|
15
|
+
import { create_youtube_video_manager } from "../YoutubeVideo/index.svelte.js"
|
|
16
|
+
import { create_slider_manager } from "../Slider/index.svelte.js"
|
|
17
|
+
import { create_checkbox_manager } from "../Checkbox/index.svelte.js"
|
|
18
|
+
import { create_text_input_manager } from "../TextInput/index.svelte.js"
|
|
19
|
+
import { create_color_input_manager } from "../ColorInput/index.svelte.js"
|
|
20
|
+
import { create_dropdown_manager } from "../Dropdown/index.svelte.js"
|
|
21
|
+
import { create_time_input_manager } from "../TimeInput/index.svelte.js"
|
|
22
|
+
import { create_time_manager } from "../Time/index.svelte.js"
|
|
23
|
+
import { create_location_input_manager } from "../LocationInput/index.svelte.js"
|
|
24
|
+
import { create_location_manager } from "../Location/index.svelte.js"
|
|
25
|
+
import { create_qr_manager } from "../Qr/index.svelte.js"
|
|
26
|
+
import { create_file_input_manager } from "../FileInput/index.svelte.js"
|
|
27
|
+
import { create_cron_input_manager } from "../CronInput/index.svelte.js"
|
|
28
|
+
import { create_button_manager } from "../Button/index.svelte.js"
|
|
29
|
+
import {
|
|
30
|
+
node_types,
|
|
31
|
+
deep_copy,
|
|
32
|
+
set_closurable,
|
|
33
|
+
create_unique_id,
|
|
34
|
+
copy_to_clipboard,
|
|
35
|
+
get_def_from_variable_path,
|
|
36
|
+
is_defined,
|
|
37
|
+
} from "../../client/index.js"
|
|
38
|
+
|
|
39
|
+
export function create_content_manager(config) {
|
|
40
|
+
const id = create_unique_id(null, 20)
|
|
41
|
+
let definition_stack = $state([])
|
|
42
|
+
let is_dark_theme = $derived(set_closurable(config?.is_dark_theme, false))
|
|
43
|
+
let storage_path = $derived(set_closurable(config?.storage_path, "/api/v1/storage/{storage_id}"))
|
|
44
|
+
let mapkit_js_token = $derived(set_closurable(config?.mapkit_js_token, null))
|
|
45
|
+
let val_prepped = $state(null)
|
|
46
|
+
|
|
47
|
+
function clean_attributes_from_variable_path(attributes) {
|
|
48
|
+
let cleaned_attributes = attributes
|
|
49
|
+
if (Object.keys(attributes || {}).length) {
|
|
50
|
+
for (let [att_key, att_val] of Object.entries(attributes)) {
|
|
51
|
+
if (att_key.endsWith("_from_variable_path") && att_val != null) {
|
|
52
|
+
const att_key_to_set = att_key.split("_from_variable_path")?.[0]
|
|
53
|
+
cleaned_attributes[att_key_to_set] = get_def_from_variable_path(att_val, definition_stack)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return cleaned_attributes
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function pass_event_down(input) {
|
|
61
|
+
console.log("pass_event_down", input)
|
|
62
|
+
if (input?.set_from_content_id == id) {
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
// val_prepped = prepare_component_and_children(config?.val)
|
|
66
|
+
// return
|
|
67
|
+
val_prepped.attributes = clean_attributes_from_variable_path(config?.val?.attributes)
|
|
68
|
+
if (["checkbox", "time", "location", "json"].includes(config?.val?.type_id)) {
|
|
69
|
+
// prob do this for more
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
val_prepped = prepare_component_and_children(config?.val)
|
|
72
|
+
}, 10)
|
|
73
|
+
return
|
|
74
|
+
} else if (config?.val?.type_id == "icon") {
|
|
75
|
+
val_prepped.manager.set_attributes(val_prepped.attributes)
|
|
76
|
+
}
|
|
77
|
+
if (Array.isArray(val_prepped?.children)) {
|
|
78
|
+
for (let child of val_prepped?.children) {
|
|
79
|
+
if (Array.isArray(child)) {
|
|
80
|
+
for (let child_item of child) {
|
|
81
|
+
if (typeof child_item?.pass_event_down == "function") {
|
|
82
|
+
child_item.pass_event_down(input)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
} else if (typeof child?.pass_event_down == "function") {
|
|
86
|
+
child.pass_event_down(input)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function clean_variable_path(input) {
|
|
93
|
+
let cleaned_path = []
|
|
94
|
+
if (Array.isArray(input) && input.length > 0) {
|
|
95
|
+
let is_def = is_defined(input?.[0], definition_stack)
|
|
96
|
+
if (!is_def) {
|
|
97
|
+
return []
|
|
98
|
+
}
|
|
99
|
+
for (let item of input) {
|
|
100
|
+
if (Array.isArray(item)) {
|
|
101
|
+
const res = get_def_from_variable_path(item, definition_stack)
|
|
102
|
+
cleaned_path.push(res)
|
|
103
|
+
} else {
|
|
104
|
+
cleaned_path.push(item)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return cleaned_path
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async function set_variable_at_path(path, value, type) {
|
|
112
|
+
if (!Array.isArray(path)) {
|
|
113
|
+
return
|
|
114
|
+
}
|
|
115
|
+
let cleaned_path = clean_variable_path(path)
|
|
116
|
+
if (typeof config?.on_event == "function") {
|
|
117
|
+
if (type == "insert") {
|
|
118
|
+
return config?.on_event({
|
|
119
|
+
type: "set_variables_insert",
|
|
120
|
+
set_from_content_id: id,
|
|
121
|
+
value: value,
|
|
122
|
+
index_to_insert_at: null, // tbd
|
|
123
|
+
variable_path_to_target: cleaned_path ?? null,
|
|
124
|
+
})
|
|
125
|
+
} else if (type == "delete") {
|
|
126
|
+
return config?.on_event({
|
|
127
|
+
type: "set_variables_delete",
|
|
128
|
+
set_from_content_id: id,
|
|
129
|
+
variable_path_to_target: cleaned_path ? [...cleaned_path, value] : [value],
|
|
130
|
+
})
|
|
131
|
+
} else if (type == "set_key") {
|
|
132
|
+
return config?.on_event({
|
|
133
|
+
type: "set_variables_key",
|
|
134
|
+
set_from_content_id: id,
|
|
135
|
+
variable_path_to_target: cleaned_path ?? null,
|
|
136
|
+
value: value,
|
|
137
|
+
})
|
|
138
|
+
} else {
|
|
139
|
+
return config?.on_event({
|
|
140
|
+
type: "set_variables",
|
|
141
|
+
set_from_content_id: id,
|
|
142
|
+
value: value,
|
|
143
|
+
variable_path_to_target: cleaned_path ?? null,
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
// maybe normalize some kinda return like { is_success: true, ...}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function get_default_children(val_loc) {
|
|
151
|
+
let is_children = false
|
|
152
|
+
let children = []
|
|
153
|
+
if (Array.isArray(val_loc?.children) && val_loc?.children.length > 0) {
|
|
154
|
+
is_children = true
|
|
155
|
+
for (let child of val_loc?.children) {
|
|
156
|
+
children.push(
|
|
157
|
+
create_content_manager({
|
|
158
|
+
val: child,
|
|
159
|
+
mapkit_js_token: mapkit_js_token,
|
|
160
|
+
table_options: config?.table_options,
|
|
161
|
+
on_search_table_row_ids: config?.on_search_table_row_ids,
|
|
162
|
+
definition_stack: definition_stack,
|
|
163
|
+
storage_path: () => storage_path,
|
|
164
|
+
is_dark_theme: () => is_dark_theme,
|
|
165
|
+
on_event: config?.on_event,
|
|
166
|
+
focused_selector_id: config?.focused_selector_id,
|
|
167
|
+
set_focused_selector_id: config?.set_focused_selector_id,
|
|
168
|
+
open_edit_element_attributes_popover: config?.open_edit_element_attributes_popover,
|
|
169
|
+
})
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
is_children: is_children,
|
|
175
|
+
children: children,
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function prepare_component_and_children(val) {
|
|
180
|
+
let val_loc = deep_copy(val)
|
|
181
|
+
if (val_loc != null && typeof val_loc == "object" && val_loc.hasOwnProperty("attributes")) {
|
|
182
|
+
val_loc.attributes = clean_attributes_from_variable_path(val_loc?.attributes)
|
|
183
|
+
}
|
|
184
|
+
if (val_loc?.type_id == "audio") {
|
|
185
|
+
return {
|
|
186
|
+
type_id: val_loc?.type_id,
|
|
187
|
+
selector_id: val_loc?.selector_id,
|
|
188
|
+
attributes: val_loc?.attributes,
|
|
189
|
+
manager: create_audio_manager({ ...val_loc?.attributes, storage_path }),
|
|
190
|
+
}
|
|
191
|
+
} else if (val_loc?.type_id == "image") {
|
|
192
|
+
return {
|
|
193
|
+
type_id: val_loc?.type_id,
|
|
194
|
+
selector_id: val_loc?.selector_id,
|
|
195
|
+
manager: create_image_manager({ ...val_loc?.attributes, storage_path }),
|
|
196
|
+
attributes: val_loc?.attributes,
|
|
197
|
+
is_children: false,
|
|
198
|
+
children: [],
|
|
199
|
+
}
|
|
200
|
+
} else if (val_loc?.type_id == "youtube_video") {
|
|
201
|
+
return {
|
|
202
|
+
type_id: val_loc?.type_id,
|
|
203
|
+
selector_id: val_loc?.selector_id,
|
|
204
|
+
attributes: val_loc?.attributes,
|
|
205
|
+
manager: create_youtube_video_manager({
|
|
206
|
+
...val_loc?.attributes,
|
|
207
|
+
is_dark_theme: val_loc?.attributes?.is_dark_theme ?? is_dark_theme,
|
|
208
|
+
}),
|
|
209
|
+
is_children: false,
|
|
210
|
+
children: [],
|
|
211
|
+
}
|
|
212
|
+
} else if (val_loc?.type_id == "x_post") {
|
|
213
|
+
return {
|
|
214
|
+
type_id: val_loc?.type_id,
|
|
215
|
+
selector_id: val_loc?.selector_id,
|
|
216
|
+
attributes: val_loc?.attributes,
|
|
217
|
+
manager: create_x_post_manager({
|
|
218
|
+
...val_loc?.attributes,
|
|
219
|
+
is_dark_theme: val_loc?.attributes?.is_dark_theme ?? is_dark_theme,
|
|
220
|
+
}),
|
|
221
|
+
is_children: false,
|
|
222
|
+
children: [],
|
|
223
|
+
}
|
|
224
|
+
} else if (val_loc?.type_id == "link") {
|
|
225
|
+
const children_res = get_default_children(val_loc)
|
|
226
|
+
return {
|
|
227
|
+
type_id: val_loc?.type_id,
|
|
228
|
+
selector_id: val_loc?.selector_id,
|
|
229
|
+
attributes: val_loc?.attributes,
|
|
230
|
+
manager: create_link_manager({
|
|
231
|
+
...val_loc?.attributes,
|
|
232
|
+
id: val_loc?.selector_id,
|
|
233
|
+
}),
|
|
234
|
+
is_children: children_res?.is_children,
|
|
235
|
+
children: children_res?.children,
|
|
236
|
+
}
|
|
237
|
+
} else if (val_loc?.type_id == "icon_input") {
|
|
238
|
+
const children_res = get_default_children(val_loc)
|
|
239
|
+
return {
|
|
240
|
+
type_id: val_loc?.type_id,
|
|
241
|
+
selector_id: val_loc?.selector_id,
|
|
242
|
+
attributes: val_loc?.attributes,
|
|
243
|
+
manager: create_icon_input_manager({
|
|
244
|
+
...val_loc?.attributes,
|
|
245
|
+
id: val_loc?.selector_id,
|
|
246
|
+
on_finish: (input) => set_variable_at_path(val_loc?.attributes?.val_from_variable_path, input),
|
|
247
|
+
}),
|
|
248
|
+
is_children: children_res?.is_children,
|
|
249
|
+
children: children_res?.children,
|
|
250
|
+
}
|
|
251
|
+
} else if (val_loc?.type_id == "icon") {
|
|
252
|
+
const children_res = get_default_children(val_loc)
|
|
253
|
+
let icon_manager = create_icon_manager({
|
|
254
|
+
...val_loc?.attributes,
|
|
255
|
+
id: val_loc?.selector_id,
|
|
256
|
+
icon_id: () => val_loc?.attributes?.icon_id,
|
|
257
|
+
})
|
|
258
|
+
return {
|
|
259
|
+
type_id: val_loc?.type_id,
|
|
260
|
+
selector_id: val_loc?.selector_id,
|
|
261
|
+
attributes: val_loc?.attributes,
|
|
262
|
+
manager: icon_manager,
|
|
263
|
+
is_children: children_res?.is_children,
|
|
264
|
+
children: children_res?.children,
|
|
265
|
+
}
|
|
266
|
+
} else if (val_loc?.type_id == "code") {
|
|
267
|
+
return {
|
|
268
|
+
type_id: val_loc?.type_id,
|
|
269
|
+
selector_id: val_loc?.selector_id,
|
|
270
|
+
attributes: val_loc?.attributes,
|
|
271
|
+
manager: create_code_manager({ ...val_loc?.attributes, is_dark_theme }),
|
|
272
|
+
is_children: false,
|
|
273
|
+
children: [],
|
|
274
|
+
}
|
|
275
|
+
} else if (val_loc?.type_id == "json") {
|
|
276
|
+
return {
|
|
277
|
+
type_id: val_loc?.type_id,
|
|
278
|
+
selector_id: val_loc?.selector_id,
|
|
279
|
+
attributes: val_loc?.attributes,
|
|
280
|
+
manager: create_json_manager({ ...val_loc?.attributes }),
|
|
281
|
+
is_children: false,
|
|
282
|
+
children: [],
|
|
283
|
+
}
|
|
284
|
+
} else if (val_loc?.type_id == "code_inline") {
|
|
285
|
+
return {
|
|
286
|
+
type_id: val_loc?.type_id,
|
|
287
|
+
selector_id: val_loc?.selector_id,
|
|
288
|
+
attributes: val_loc?.attributes,
|
|
289
|
+
copy_button_manager: create_button_manager({
|
|
290
|
+
type: "soft",
|
|
291
|
+
support_icon: "clipboard",
|
|
292
|
+
is_uniform: true,
|
|
293
|
+
min_height: 2.4,
|
|
294
|
+
icon_size: 1.6,
|
|
295
|
+
border_radius: 0.5,
|
|
296
|
+
is_success_animation: true,
|
|
297
|
+
on_click: () => {
|
|
298
|
+
copy_to_clipboard(val_loc?.attributes?.content)
|
|
299
|
+
},
|
|
300
|
+
}),
|
|
301
|
+
is_children: false,
|
|
302
|
+
children: [],
|
|
303
|
+
}
|
|
304
|
+
} else if (val_loc?.type_id == "number") {
|
|
305
|
+
return {
|
|
306
|
+
type_id: val_loc?.type_id,
|
|
307
|
+
selector_id: val_loc?.selector_id,
|
|
308
|
+
attributes: val_loc?.attributes,
|
|
309
|
+
manager: create_number_manager({ ...val_loc?.attributes }),
|
|
310
|
+
is_children: false,
|
|
311
|
+
children: [],
|
|
312
|
+
}
|
|
313
|
+
} else if (val_loc?.type_id == "slider") {
|
|
314
|
+
return {
|
|
315
|
+
type_id: val_loc?.type_id,
|
|
316
|
+
selector_id: val_loc?.selector_id,
|
|
317
|
+
attributes: val_loc?.attributes,
|
|
318
|
+
manager: create_slider_manager({
|
|
319
|
+
...val_loc?.attributes,
|
|
320
|
+
on_change: (input) => set_variable_at_path(val_loc?.attributes?.val_from_variable_path, input),
|
|
321
|
+
}),
|
|
322
|
+
is_children: false,
|
|
323
|
+
children: [],
|
|
324
|
+
}
|
|
325
|
+
} else if (val_loc?.type_id == "checkbox") {
|
|
326
|
+
return {
|
|
327
|
+
type_id: val_loc?.type_id,
|
|
328
|
+
selector_id: val_loc?.selector_id,
|
|
329
|
+
attributes: val_loc?.attributes,
|
|
330
|
+
manager: create_checkbox_manager({
|
|
331
|
+
...val_loc?.attributes,
|
|
332
|
+
on_change: (input) => set_variable_at_path(val_loc?.attributes?.val_from_variable_path, input),
|
|
333
|
+
}),
|
|
334
|
+
is_children: false,
|
|
335
|
+
children: [],
|
|
336
|
+
}
|
|
337
|
+
} else if (val_loc?.type_id == "text_input") {
|
|
338
|
+
return {
|
|
339
|
+
type_id: val_loc?.type_id,
|
|
340
|
+
selector_id: val_loc?.selector_id,
|
|
341
|
+
attributes: val_loc?.attributes,
|
|
342
|
+
manager: create_text_input_manager({
|
|
343
|
+
...val_loc?.attributes,
|
|
344
|
+
on_change: (input) => set_variable_at_path(val_loc?.attributes?.val_from_variable_path, input),
|
|
345
|
+
}),
|
|
346
|
+
is_children: false,
|
|
347
|
+
children: [],
|
|
348
|
+
}
|
|
349
|
+
} else if (val_loc?.type_id == "number_input") {
|
|
350
|
+
return {
|
|
351
|
+
type_id: val_loc?.type_id,
|
|
352
|
+
selector_id: val_loc?.selector_id,
|
|
353
|
+
attributes: val_loc?.attributes,
|
|
354
|
+
manager: create_text_input_manager({
|
|
355
|
+
type: "number",
|
|
356
|
+
...val_loc?.attributes,
|
|
357
|
+
on_change: (input) => set_variable_at_path(val_loc?.attributes?.val_from_variable_path, input),
|
|
358
|
+
}),
|
|
359
|
+
is_children: false,
|
|
360
|
+
children: [],
|
|
361
|
+
}
|
|
362
|
+
} else if (val_loc?.type_id == "color_input") {
|
|
363
|
+
return {
|
|
364
|
+
type_id: val_loc?.type_id,
|
|
365
|
+
selector_id: val_loc?.selector_id,
|
|
366
|
+
attributes: val_loc?.attributes,
|
|
367
|
+
manager: create_color_input_manager({
|
|
368
|
+
...val_loc?.attributes,
|
|
369
|
+
on_finish: (input) => set_variable_at_path(val_loc?.attributes?.val_from_variable_path, input),
|
|
370
|
+
}),
|
|
371
|
+
is_children: false,
|
|
372
|
+
children: [],
|
|
373
|
+
}
|
|
374
|
+
} else if (val_loc?.type_id == "color") {
|
|
375
|
+
return {
|
|
376
|
+
type_id: val_loc?.type_id,
|
|
377
|
+
selector_id: val_loc?.selector_id,
|
|
378
|
+
attributes: val_loc?.attributes,
|
|
379
|
+
manager: create_color_manager({
|
|
380
|
+
...val_loc?.attributes,
|
|
381
|
+
}),
|
|
382
|
+
is_children: false,
|
|
383
|
+
children: [],
|
|
384
|
+
}
|
|
385
|
+
} else if (val_loc?.type_id == "dropdown") {
|
|
386
|
+
return {
|
|
387
|
+
type_id: val_loc?.type_id,
|
|
388
|
+
selector_id: val_loc?.selector_id,
|
|
389
|
+
attributes: val_loc?.attributes,
|
|
390
|
+
manager: create_dropdown_manager({
|
|
391
|
+
...val_loc?.attributes,
|
|
392
|
+
on_change: (input) => set_variable_at_path(val_loc?.attributes?.val_from_variable_path, input),
|
|
393
|
+
}),
|
|
394
|
+
is_children: false,
|
|
395
|
+
children: [],
|
|
396
|
+
}
|
|
397
|
+
} else if (val_loc?.type_id == "time_input") {
|
|
398
|
+
return {
|
|
399
|
+
type_id: val_loc?.type_id,
|
|
400
|
+
selector_id: val_loc?.selector_id,
|
|
401
|
+
attributes: val_loc?.attributes,
|
|
402
|
+
manager: create_time_input_manager({
|
|
403
|
+
...val_loc?.attributes,
|
|
404
|
+
on_finish: (input) => set_variable_at_path(val_loc?.attributes?.val_from_variable_path, input),
|
|
405
|
+
}),
|
|
406
|
+
is_children: false,
|
|
407
|
+
children: [],
|
|
408
|
+
}
|
|
409
|
+
} else if (val_loc?.type_id == "time") {
|
|
410
|
+
return {
|
|
411
|
+
type_id: val_loc?.type_id,
|
|
412
|
+
selector_id: val_loc?.selector_id,
|
|
413
|
+
attributes: val_loc?.attributes,
|
|
414
|
+
manager: create_time_manager({
|
|
415
|
+
...val_loc?.attributes,
|
|
416
|
+
on_finish: (input) => set_variable_at_path(val_loc?.attributes?.val_from_variable_path, input),
|
|
417
|
+
}),
|
|
418
|
+
is_children: false,
|
|
419
|
+
children: [],
|
|
420
|
+
}
|
|
421
|
+
} else if (val_loc?.type_id == "cron_input") {
|
|
422
|
+
return {
|
|
423
|
+
type_id: val_loc?.type_id,
|
|
424
|
+
selector_id: val_loc?.selector_id,
|
|
425
|
+
attributes: val_loc?.attributes,
|
|
426
|
+
manager: create_cron_input_manager({
|
|
427
|
+
...val_loc?.attributes,
|
|
428
|
+
on_finish: (input) => set_variable_at_path(val_loc?.attributes?.val_from_variable_path, input),
|
|
429
|
+
}),
|
|
430
|
+
is_children: false,
|
|
431
|
+
children: [],
|
|
432
|
+
}
|
|
433
|
+
} else if (val_loc?.type_id == "cron") {
|
|
434
|
+
return {
|
|
435
|
+
type_id: val_loc?.type_id,
|
|
436
|
+
selector_id: val_loc?.selector_id,
|
|
437
|
+
attributes: val_loc?.attributes,
|
|
438
|
+
is_children: false,
|
|
439
|
+
children: [],
|
|
440
|
+
}
|
|
441
|
+
} else if (val_loc?.type_id == "phone_input") {
|
|
442
|
+
return {
|
|
443
|
+
type_id: val_loc?.type_id,
|
|
444
|
+
selector_id: val_loc?.selector_id,
|
|
445
|
+
attributes: val_loc?.attributes,
|
|
446
|
+
manager: create_text_input_manager({
|
|
447
|
+
type: "phone_number",
|
|
448
|
+
...val_loc?.attributes,
|
|
449
|
+
on_change: (input) => set_variable_at_path(val_loc?.attributes?.val_from_variable_path, input),
|
|
450
|
+
}),
|
|
451
|
+
is_children: false,
|
|
452
|
+
children: [],
|
|
453
|
+
}
|
|
454
|
+
} else if (val_loc?.type_id == "phone_number") {
|
|
455
|
+
return {
|
|
456
|
+
type_id: val_loc?.type_id,
|
|
457
|
+
selector_id: val_loc?.selector_id,
|
|
458
|
+
attributes: val_loc?.attributes,
|
|
459
|
+
manager: create_phone_number_manager({
|
|
460
|
+
...val_loc?.attributes,
|
|
461
|
+
}),
|
|
462
|
+
is_children: false,
|
|
463
|
+
children: [],
|
|
464
|
+
}
|
|
465
|
+
} else if (val_loc?.type_id == "email_address") {
|
|
466
|
+
return {
|
|
467
|
+
type_id: val_loc?.type_id,
|
|
468
|
+
selector_id: val_loc?.selector_id,
|
|
469
|
+
attributes: val_loc?.attributes,
|
|
470
|
+
manager: create_email_address_manager({
|
|
471
|
+
...val_loc?.attributes,
|
|
472
|
+
on_change: (input) => set_variable_at_path(val_loc?.attributes?.val_from_variable_path, input),
|
|
473
|
+
}),
|
|
474
|
+
is_children: false,
|
|
475
|
+
children: [],
|
|
476
|
+
}
|
|
477
|
+
} else if (val_loc?.type_id == "location_input") {
|
|
478
|
+
return {
|
|
479
|
+
type_id: val_loc?.type_id,
|
|
480
|
+
selector_id: val_loc?.selector_id,
|
|
481
|
+
attributes: val_loc?.attributes,
|
|
482
|
+
manager: create_location_input_manager({
|
|
483
|
+
...val_loc?.attributes,
|
|
484
|
+
mapkit_js_token: mapkit_js_token,
|
|
485
|
+
on_finish: (input) => set_variable_at_path(val_loc?.attributes?.val_from_variable_path, input),
|
|
486
|
+
}),
|
|
487
|
+
is_children: false,
|
|
488
|
+
children: [],
|
|
489
|
+
}
|
|
490
|
+
} else if (val_loc?.type_id == "location") {
|
|
491
|
+
return {
|
|
492
|
+
type_id: val_loc?.type_id,
|
|
493
|
+
selector_id: val_loc?.selector_id,
|
|
494
|
+
attributes: val_loc?.attributes,
|
|
495
|
+
manager: create_location_manager({
|
|
496
|
+
...val_loc?.attributes,
|
|
497
|
+
mapkit_js_token: mapkit_js_token,
|
|
498
|
+
}),
|
|
499
|
+
is_children: false,
|
|
500
|
+
children: [],
|
|
501
|
+
}
|
|
502
|
+
} else if (val_loc?.type_id == "table_advanced") {
|
|
503
|
+
return {
|
|
504
|
+
type_id: val_loc?.type_id,
|
|
505
|
+
selector_id: val_loc?.selector_id,
|
|
506
|
+
attributes: val_loc?.attributes,
|
|
507
|
+
manager: create_table_advanced_manager({
|
|
508
|
+
...val_loc?.attributes,
|
|
509
|
+
definition_stack: definition_stack,
|
|
510
|
+
on_event: config?.on_event,
|
|
511
|
+
// on_event: (input) => {
|
|
512
|
+
// if (input?.type == "update_row") {
|
|
513
|
+
// if (typeof input?.row_i == "number" && Array.isArray(val_loc?.attributes?.rows_data_from_variable_path)) {
|
|
514
|
+
// return set_variable_at_path(
|
|
515
|
+
// [...val_loc?.attributes?.rows_data_from_variable_path, input?.row_i],
|
|
516
|
+
// input?.value
|
|
517
|
+
// )
|
|
518
|
+
// }
|
|
519
|
+
// } else if (input?.type == "insert_row") {
|
|
520
|
+
// if (Array.isArray(val_loc?.attributes?.rows_data_from_variable_path)) {
|
|
521
|
+
// return set_variable_at_path(val_loc?.attributes?.rows_data_from_variable_path, input?.value, "insert")
|
|
522
|
+
// }
|
|
523
|
+
// } else if (input?.type == "delete_row") {
|
|
524
|
+
// if (typeof input?.row_i == "number" && Array.isArray(val_loc?.attributes?.rows_data_from_variable_path)) {
|
|
525
|
+
// return set_variable_at_path(
|
|
526
|
+
// [...val_loc?.attributes?.rows_data_from_variable_path, input?.row_i],
|
|
527
|
+
// null,
|
|
528
|
+
// "delete"
|
|
529
|
+
// )
|
|
530
|
+
// }
|
|
531
|
+
// }
|
|
532
|
+
}),
|
|
533
|
+
is_children: false,
|
|
534
|
+
children: [],
|
|
535
|
+
}
|
|
536
|
+
} else if (val_loc?.type_id == "qr") {
|
|
537
|
+
return {
|
|
538
|
+
type_id: val_loc?.type_id,
|
|
539
|
+
selector_id: val_loc?.selector_id,
|
|
540
|
+
attributes: val_loc?.attributes,
|
|
541
|
+
manager: create_qr_manager({
|
|
542
|
+
...val_loc?.attributes,
|
|
543
|
+
on_change: (input) => set_variable_at_path(val_loc?.attributes?.val_from_variable_path, input),
|
|
544
|
+
}),
|
|
545
|
+
is_children: false,
|
|
546
|
+
children: [],
|
|
547
|
+
}
|
|
548
|
+
} else if (val_loc?.type_id == "file_input") {
|
|
549
|
+
return {
|
|
550
|
+
type_id: val_loc?.type_id,
|
|
551
|
+
selector_id: val_loc?.selector_id,
|
|
552
|
+
attributes: val_loc?.attributes,
|
|
553
|
+
manager: create_file_input_manager({
|
|
554
|
+
...val_loc?.attributes,
|
|
555
|
+
// height: "100%",
|
|
556
|
+
on_get_file: (input) => {
|
|
557
|
+
console.log("on_get_file_tbd", input)
|
|
558
|
+
set_variable_at_path(val_loc?.attributes?.val_from_variable_path, input)
|
|
559
|
+
},
|
|
560
|
+
}),
|
|
561
|
+
is_children: false,
|
|
562
|
+
children: [],
|
|
563
|
+
}
|
|
564
|
+
} else if (val_loc?.type_id == "slot") {
|
|
565
|
+
console.log("slot666", val_loc)
|
|
566
|
+
return {
|
|
567
|
+
type_id: val_loc?.type_id,
|
|
568
|
+
selector_id: val_loc?.selector_id,
|
|
569
|
+
attributes: val_loc?.attributes,
|
|
570
|
+
is_children: false,
|
|
571
|
+
children: [],
|
|
572
|
+
}
|
|
573
|
+
} else if (val_loc?.type_id == "show_conditions") {
|
|
574
|
+
let is_children = false
|
|
575
|
+
let children = []
|
|
576
|
+
if (Array.isArray(val_loc?.children)) {
|
|
577
|
+
is_children = true
|
|
578
|
+
for (let child of val_loc?.children) {
|
|
579
|
+
children.push(
|
|
580
|
+
create_content_manager({
|
|
581
|
+
val: child,
|
|
582
|
+
mapkit_js_token: mapkit_js_token,
|
|
583
|
+
table_options: config?.table_options,
|
|
584
|
+
on_search_table_row_ids: config?.on_search_table_row_ids,
|
|
585
|
+
definition_stack: definition_stack,
|
|
586
|
+
storage_path: () => storage_path,
|
|
587
|
+
is_dark_theme: () => is_dark_theme,
|
|
588
|
+
on_event: config?.on_event,
|
|
589
|
+
focused_selector_id: config?.focused_selector_id,
|
|
590
|
+
set_focused_selector_id: config?.set_focused_selector_id,
|
|
591
|
+
open_edit_element_attributes_popover: config?.open_edit_element_attributes_popover,
|
|
592
|
+
})
|
|
593
|
+
)
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
return {
|
|
597
|
+
type_id: "show_conditions",
|
|
598
|
+
selector_id: val_loc?.selector_id,
|
|
599
|
+
attributes: val_loc?.attributes,
|
|
600
|
+
is_children: is_children,
|
|
601
|
+
children: children,
|
|
602
|
+
}
|
|
603
|
+
} else if (val_loc?.type_id == "loop") {
|
|
604
|
+
let prepped_children = []
|
|
605
|
+
let is_children = false
|
|
606
|
+
const static_val = set_closurable(val_loc?.attributes?.val)
|
|
607
|
+
if (Array.isArray(static_val)) {
|
|
608
|
+
for (let i = 0; i < static_val.length; i++) {
|
|
609
|
+
let children = []
|
|
610
|
+
if (Array.isArray(val_loc?.children) && val_loc?.children.length > 0) {
|
|
611
|
+
is_children = true
|
|
612
|
+
for (let child of val_loc?.children) {
|
|
613
|
+
const child_content_manager = create_content_manager({
|
|
614
|
+
val: child,
|
|
615
|
+
mapkit_js_token: mapkit_js_token,
|
|
616
|
+
table_options: config?.table_options,
|
|
617
|
+
on_search_table_row_ids: config?.on_search_table_row_ids,
|
|
618
|
+
definition_stack: [{ [val_loc?.attributes?.iter_identifier]: i }, ...definition_stack],
|
|
619
|
+
storage_path: () => storage_path,
|
|
620
|
+
is_dark_theme: () => is_dark_theme,
|
|
621
|
+
on_event: config?.on_event,
|
|
622
|
+
focused_selector_id: config?.focused_selector_id,
|
|
623
|
+
set_focused_selector_id: config?.set_focused_selector_id,
|
|
624
|
+
open_edit_element_attributes_popover: config?.open_edit_element_attributes_popover,
|
|
625
|
+
})
|
|
626
|
+
children.push(child_content_manager)
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
prepped_children.push(children)
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
return {
|
|
633
|
+
type_id: val_loc?.type_id,
|
|
634
|
+
selector_id: val_loc?.selector_id,
|
|
635
|
+
attributes: val_loc?.attributes,
|
|
636
|
+
is_children: is_children,
|
|
637
|
+
children: prepped_children,
|
|
638
|
+
}
|
|
639
|
+
} else if (val_loc?.type_id == "array_uniform_input") {
|
|
640
|
+
let prepped_children = []
|
|
641
|
+
const val_static = set_closurable(val_loc?.attributes?.val, null)
|
|
642
|
+
if (Array.isArray(val_static)) {
|
|
643
|
+
for (let i = 0; i < val_static.length; i++) {
|
|
644
|
+
let is_children = false
|
|
645
|
+
let children = []
|
|
646
|
+
if (Array.isArray(val_loc?.children) && val_loc?.children.length > 0) {
|
|
647
|
+
is_children = true
|
|
648
|
+
for (let child of val_loc?.children) {
|
|
649
|
+
children.push(
|
|
650
|
+
create_content_manager({
|
|
651
|
+
val: child,
|
|
652
|
+
mapkit_js_token: mapkit_js_token,
|
|
653
|
+
table_options: config?.table_options,
|
|
654
|
+
on_search_table_row_ids: config?.on_search_table_row_ids,
|
|
655
|
+
definition_stack: [{ [val_loc?.attributes?.iter_identifier]: i }, ...definition_stack],
|
|
656
|
+
storage_path: () => storage_path,
|
|
657
|
+
is_dark_theme: () => is_dark_theme,
|
|
658
|
+
on_event: config?.on_event,
|
|
659
|
+
focused_selector_id: config?.focused_selector_id,
|
|
660
|
+
set_focused_selector_id: config?.set_focused_selector_id,
|
|
661
|
+
open_edit_element_attributes_popover: config?.open_edit_element_attributes_popover,
|
|
662
|
+
})
|
|
663
|
+
)
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
prepped_children.push({
|
|
667
|
+
is_children: is_children,
|
|
668
|
+
children: children,
|
|
669
|
+
remove_item_button_manager: create_button_manager({
|
|
670
|
+
type: "outlined",
|
|
671
|
+
support_icon: "x",
|
|
672
|
+
is_uniform: true,
|
|
673
|
+
on_click: async () => {
|
|
674
|
+
const res = await set_variable_at_path(val_loc?.attributes?.val_from_variable_path, i, "delete")
|
|
675
|
+
if (res?.is_success) {
|
|
676
|
+
val_prepped = prepare_component_and_children(config?.val)
|
|
677
|
+
}
|
|
678
|
+
},
|
|
679
|
+
}),
|
|
680
|
+
})
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
return {
|
|
684
|
+
type_id: val_loc?.type_id,
|
|
685
|
+
selector_id: val_loc?.selector_id,
|
|
686
|
+
attributes: val_loc?.attributes,
|
|
687
|
+
is_children: true,
|
|
688
|
+
children: prepped_children,
|
|
689
|
+
label: val_loc?.attributes?.label ?? null,
|
|
690
|
+
add_item_button_manager: create_button_manager({
|
|
691
|
+
type: "outlined",
|
|
692
|
+
text: "Add Item",
|
|
693
|
+
support_icon: "plus",
|
|
694
|
+
is_compressed: true,
|
|
695
|
+
on_click: async () => {
|
|
696
|
+
const res = await set_variable_at_path(val_loc?.attributes?.val_from_variable_path, null, "insert")
|
|
697
|
+
if (res?.is_success) {
|
|
698
|
+
val_prepped = prepare_component_and_children(config?.val)
|
|
699
|
+
}
|
|
700
|
+
},
|
|
701
|
+
}),
|
|
702
|
+
}
|
|
703
|
+
} else if (val_loc?.type_id == "object_uniform_input") {
|
|
704
|
+
let prepped_children = []
|
|
705
|
+
const val_static = set_closurable(val_loc?.attributes?.val, null)
|
|
706
|
+
if (Object.keys(val_static || {}).length > 0) {
|
|
707
|
+
for (let [key, val] of Object.entries(val_static)) {
|
|
708
|
+
let is_children = false
|
|
709
|
+
let children = []
|
|
710
|
+
if (Array.isArray(val_loc?.children) && val_loc?.children.length > 0) {
|
|
711
|
+
is_children = true
|
|
712
|
+
for (let child of val_loc?.children) {
|
|
713
|
+
children.push(
|
|
714
|
+
create_content_manager({
|
|
715
|
+
val: child,
|
|
716
|
+
mapkit_js_token: mapkit_js_token,
|
|
717
|
+
table_options: config?.table_options,
|
|
718
|
+
on_search_table_row_ids: config?.on_search_table_row_ids,
|
|
719
|
+
definition_stack: [{ [val_loc?.attributes?.iter_identifier]: key }, ...definition_stack],
|
|
720
|
+
storage_path: () => storage_path,
|
|
721
|
+
is_dark_theme: () => is_dark_theme,
|
|
722
|
+
on_event: config?.on_event,
|
|
723
|
+
focused_selector_id: config?.focused_selector_id,
|
|
724
|
+
set_focused_selector_id: config?.set_focused_selector_id,
|
|
725
|
+
open_edit_element_attributes_popover: config?.open_edit_element_attributes_popover,
|
|
726
|
+
})
|
|
727
|
+
)
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
prepped_children.push({
|
|
731
|
+
is_children: is_children,
|
|
732
|
+
children: children,
|
|
733
|
+
item_key_table_row_dropdown_manager: create_dropdown_manager({
|
|
734
|
+
val: key,
|
|
735
|
+
is_searchable: true,
|
|
736
|
+
is_button_compressed: true,
|
|
737
|
+
is_set_null_button: true,
|
|
738
|
+
options: [],
|
|
739
|
+
on_search: async (input) => {
|
|
740
|
+
if (typeof config?.on_search_table_row_ids == "function") {
|
|
741
|
+
const res = await config?.on_search_table_row_ids({
|
|
742
|
+
table_id: val_loc?.attributes?.property_key_table_id,
|
|
743
|
+
...input,
|
|
744
|
+
})
|
|
745
|
+
return {
|
|
746
|
+
...res,
|
|
747
|
+
...input,
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
return {
|
|
751
|
+
is_success: false,
|
|
752
|
+
...input,
|
|
753
|
+
}
|
|
754
|
+
},
|
|
755
|
+
on_item_click: async (input) => {
|
|
756
|
+
const res = await set_variable_at_path(
|
|
757
|
+
[
|
|
758
|
+
...(Array.isArray(val_loc?.attributes?.val_from_variable_path)
|
|
759
|
+
? val_loc?.attributes?.val_from_variable_path
|
|
760
|
+
: []),
|
|
761
|
+
key,
|
|
762
|
+
],
|
|
763
|
+
input?.key,
|
|
764
|
+
"set_key"
|
|
765
|
+
)
|
|
766
|
+
if (res?.is_success) {
|
|
767
|
+
val_prepped = prepare_component_and_children(config?.val)
|
|
768
|
+
}
|
|
769
|
+
},
|
|
770
|
+
}),
|
|
771
|
+
item_key_text_input_manager: create_text_input_manager({
|
|
772
|
+
placeholder: "key",
|
|
773
|
+
is_popover_edit_content: true,
|
|
774
|
+
is_popover: true,
|
|
775
|
+
val: key,
|
|
776
|
+
on_finish: async (input) => {
|
|
777
|
+
const res = await set_variable_at_path(
|
|
778
|
+
[
|
|
779
|
+
...(Array.isArray(val_loc?.attributes?.val_from_variable_path)
|
|
780
|
+
? val_loc?.attributes?.val_from_variable_path
|
|
781
|
+
: []),
|
|
782
|
+
key,
|
|
783
|
+
],
|
|
784
|
+
input,
|
|
785
|
+
"set_key"
|
|
786
|
+
)
|
|
787
|
+
if (res?.is_success) {
|
|
788
|
+
val_prepped = prepare_component_and_children(config?.val)
|
|
789
|
+
}
|
|
790
|
+
},
|
|
791
|
+
}),
|
|
792
|
+
remove_item_button_manager: create_button_manager({
|
|
793
|
+
type: "outlined",
|
|
794
|
+
support_icon: "x",
|
|
795
|
+
is_uniform: true,
|
|
796
|
+
on_click: async () => {
|
|
797
|
+
const res = await set_variable_at_path(val_loc?.attributes?.val_from_variable_path, key, "delete")
|
|
798
|
+
if (res?.is_success) {
|
|
799
|
+
val_prepped = prepare_component_and_children(config?.val)
|
|
800
|
+
}
|
|
801
|
+
},
|
|
802
|
+
}),
|
|
803
|
+
})
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
return {
|
|
807
|
+
type_id: val_loc?.type_id,
|
|
808
|
+
selector_id: val_loc?.selector_id,
|
|
809
|
+
attributes: val_loc?.attributes,
|
|
810
|
+
is_children: true,
|
|
811
|
+
children: prepped_children,
|
|
812
|
+
label: val_loc?.attributes?.label ?? null,
|
|
813
|
+
add_item_button_manager: create_button_manager({
|
|
814
|
+
type: "outlined",
|
|
815
|
+
text: "Add Item",
|
|
816
|
+
support_icon: "plus",
|
|
817
|
+
is_compressed: true,
|
|
818
|
+
on_click: async () => {
|
|
819
|
+
const res = await set_variable_at_path(
|
|
820
|
+
[
|
|
821
|
+
...(Array.isArray(val_loc?.attributes?.val_from_variable_path)
|
|
822
|
+
? val_loc?.attributes?.val_from_variable_path
|
|
823
|
+
: []),
|
|
824
|
+
create_unique_id(null, 8),
|
|
825
|
+
],
|
|
826
|
+
null
|
|
827
|
+
)
|
|
828
|
+
if (res?.is_success) {
|
|
829
|
+
val_prepped = prepare_component_and_children(config?.val)
|
|
830
|
+
}
|
|
831
|
+
},
|
|
832
|
+
}),
|
|
833
|
+
}
|
|
834
|
+
} else if (val_loc?.type_id == "table_row_id_input") {
|
|
835
|
+
let dropdown_manager = create_dropdown_manager({
|
|
836
|
+
is_searchable: true,
|
|
837
|
+
is_button_compressed: true,
|
|
838
|
+
val: set_closurable(val_loc?.attributes?.val, null),
|
|
839
|
+
label: val_loc?.attributes?.label ?? null,
|
|
840
|
+
options: [],
|
|
841
|
+
on_search: async (input) => {
|
|
842
|
+
if (typeof config?.on_search_table_row_ids == "function") {
|
|
843
|
+
const res = await config?.on_search_table_row_ids({
|
|
844
|
+
table_id: val_loc?.attributes?.table_id,
|
|
845
|
+
...input,
|
|
846
|
+
})
|
|
847
|
+
return {
|
|
848
|
+
...res,
|
|
849
|
+
...input,
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
return {
|
|
853
|
+
is_success: false,
|
|
854
|
+
...input,
|
|
855
|
+
}
|
|
856
|
+
},
|
|
857
|
+
on_change: (input) => set_variable_at_path(val_loc?.attributes?.val_from_variable_path, input),
|
|
858
|
+
})
|
|
859
|
+
return {
|
|
860
|
+
type_id: val_loc?.type_id,
|
|
861
|
+
selector_id: val_loc?.selector_id,
|
|
862
|
+
attributes: val_loc?.attributes,
|
|
863
|
+
manager: dropdown_manager,
|
|
864
|
+
is_children: false,
|
|
865
|
+
children: [],
|
|
866
|
+
}
|
|
867
|
+
} else if (node_types?.hasOwnProperty(val_loc?.type_id) || val_loc?.type_id == "children") {
|
|
868
|
+
const children_res = get_default_children(val_loc)
|
|
869
|
+
return {
|
|
870
|
+
type_id: val_loc?.type_id,
|
|
871
|
+
selector_id: val_loc?.selector_id,
|
|
872
|
+
attributes: val_loc?.attributes,
|
|
873
|
+
is_children: children_res?.is_children,
|
|
874
|
+
children: children_res?.children,
|
|
875
|
+
}
|
|
876
|
+
} else {
|
|
877
|
+
// console.log("else", deep_copy(val_loc))
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
function open_edit_element_attributes_popover(input) {
|
|
882
|
+
if (typeof config?.open_edit_element_attributes_popover == "function") {
|
|
883
|
+
config?.open_edit_element_attributes_popover(input)
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
function set_focused_selector_id(input) {
|
|
887
|
+
if (typeof config?.set_focused_selector_id == "function") {
|
|
888
|
+
config?.set_focused_selector_id(input, !!input)
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
function init(config) {
|
|
893
|
+
definition_stack = config?.definition_stack ?? []
|
|
894
|
+
val_prepped = prepare_component_and_children(config?.val)
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
init(config)
|
|
898
|
+
|
|
899
|
+
return {
|
|
900
|
+
get val_prepped() {
|
|
901
|
+
return val_prepped
|
|
902
|
+
},
|
|
903
|
+
get focused_selector_id() {
|
|
904
|
+
return config?.focused_selector_id
|
|
905
|
+
},
|
|
906
|
+
pass_event_down,
|
|
907
|
+
set_focused_selector_id,
|
|
908
|
+
open_edit_element_attributes_popover,
|
|
909
|
+
}
|
|
910
|
+
}
|