sveltekit-ui 1.0.8 → 1.0.9

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.
Files changed (33) hide show
  1. package/dist/Components/TextInput/index.svelte.js +1 -0
  2. package/dist/client/types/index.js +78 -2238
  3. package/package.json +11 -8
  4. package/src/app.html +1 -0
  5. package/src/lib/Components/TextInput/index.svelte.js +1 -0
  6. package/src/lib/client/types/index.js +78 -2238
  7. package/src/routes/[component]/+page.svelte +3 -3
  8. package/svelte.config.js +1 -1
  9. package/dist/Components/FunctionInput/Node/helpers/DefinedTargetInput/index.svelte +0 -110
  10. package/dist/Components/FunctionInput/Node/helpers/Field/index.svelte +0 -109
  11. package/dist/Components/FunctionInput/Node/helpers/Field/index.svelte.js +0 -207
  12. package/dist/Components/FunctionInput/Node/helpers/InlineDropArea/index.svelte +0 -97
  13. package/dist/Components/FunctionInput/Node/helpers/InlineDropArea/index.svelte.js +0 -105
  14. package/dist/Components/FunctionInput/Node/helpers/ObjectInput/index.svelte +0 -198
  15. package/dist/Components/FunctionInput/Node/helpers/StackArea/index.svelte +0 -169
  16. package/dist/Components/FunctionInput/Node/helpers/StackArea/index.svelte.js +0 -152
  17. package/dist/Components/FunctionInput/Node/index.svelte +0 -144
  18. package/dist/Components/FunctionInput/Node/index.svelte.js +0 -134
  19. package/dist/Components/FunctionInput/index.svelte +0 -356
  20. package/dist/Components/FunctionInput/index.svelte.js +0 -1215
  21. package/src/lib/Components/FunctionInput/Node/helpers/DefinedTargetInput/index.svelte +0 -110
  22. package/src/lib/Components/FunctionInput/Node/helpers/Field/index.svelte +0 -109
  23. package/src/lib/Components/FunctionInput/Node/helpers/Field/index.svelte.js +0 -207
  24. package/src/lib/Components/FunctionInput/Node/helpers/InlineDropArea/index.svelte +0 -97
  25. package/src/lib/Components/FunctionInput/Node/helpers/InlineDropArea/index.svelte.js +0 -105
  26. package/src/lib/Components/FunctionInput/Node/helpers/ObjectInput/index.svelte +0 -198
  27. package/src/lib/Components/FunctionInput/Node/helpers/StackArea/index.svelte +0 -169
  28. package/src/lib/Components/FunctionInput/Node/helpers/StackArea/index.svelte.js +0 -152
  29. package/src/lib/Components/FunctionInput/Node/index.svelte +0 -144
  30. package/src/lib/Components/FunctionInput/Node/index.svelte.js +0 -134
  31. package/src/lib/Components/FunctionInput/index.svelte +0 -356
  32. package/src/lib/Components/FunctionInput/index.svelte.js +0 -1215
  33. package/src/routes/[component]/Showcase/FunctionInput/index.svelte +0 -77
@@ -18,7 +18,7 @@
18
18
  import CronInputShowcase from "./Showcase/CronInput/index.svelte"
19
19
  import DropdownShowcase from "./Showcase/Dropdown/index.svelte"
20
20
  import FileInputShowcase from "./Showcase/FileInput/index.svelte"
21
- import FunctionInputShowcase from "./Showcase/FunctionInput/index.svelte"
21
+ // import FunctionInputShowcase from "./Showcase/FunctionInput/index.svelte"
22
22
  import IconInputShowcase from "./Showcase/IconInput/index.svelte"
23
23
  import IconShowcase from "./Showcase/Icon/index.svelte"
24
24
  import ImageShowcase from "./Showcase/Image/index.svelte"
@@ -99,8 +99,8 @@
99
99
  <DropdownShowcase />
100
100
  {:else if page?.params?.component == "file_input"}
101
101
  <FileInputShowcase />
102
- {:else if page?.params?.component == "function_input"}
103
- <FunctionInputShowcase />
102
+ <!-- {:else if page?.params?.component == "function_input"}
103
+ <FunctionInputShowcase /> -->
104
104
  {:else if page?.params?.component == "icon"}
105
105
  <IconShowcase />
106
106
  {:else if page?.params?.component == "icon_input"}
package/svelte.config.js CHANGED
@@ -6,7 +6,7 @@ export default {
6
6
  runtime: "nodejs22.x",
7
7
  trailingSlash: false,
8
8
  cleanUrls: true,
9
- maxDuration: 60,
9
+ maxDuration: 300,
10
10
  }),
11
11
  },
12
12
  }
@@ -1,110 +0,0 @@
1
- <script>
2
- import Dropdown from "../../../../Dropdown/index.svelte"
3
- import Modal from "../../../../../Modal/index.svelte"
4
- import TextArrayInput from "../../../../TextArrayInput/index.svelte"
5
- import Button from "../../../../Button/index.svelte"
6
- import { function_builder_manager } from "../../../index.svelte.js"
7
- import { onMount } from "svelte"
8
-
9
- export let node_path = null
10
- export let node_value = null
11
- export let is_preview = false
12
-
13
- onMount(() => {
14
- dropdown_opened()
15
- })
16
-
17
- let { get_defined_at_path, set_node_value } = function_builder_manager
18
-
19
- let edit_val = {
20
- identifier: null,
21
- property_path: [],
22
- }
23
-
24
- $: on_value_change(node_value)
25
- function on_value_change(val) {
26
- edit_val = {
27
- identifier: val?.identifier ?? null,
28
- property_path: val?.property_path ?? [],
29
- }
30
- }
31
-
32
- let options = []
33
- function dropdown_opened() {
34
- const get_defined_at_path_res = get_defined_at_path(node_path)
35
- console.log("get_defined_at_path_res", get_defined_at_path_res)
36
- let options_loc = []
37
- if (Object.keys(get_defined_at_path_res || {}).length > 0) {
38
- for (let [key, value] of Object.entries(get_defined_at_path_res)) {
39
- options_loc.push({ key, name: key })
40
- }
41
- }
42
- options = options_loc
43
- }
44
-
45
- function clean_identifier(value) {
46
- let cleaned_input = ""
47
- if (value) {
48
- cleaned_input = value.toLowerCase()
49
- cleaned_input = cleaned_input.replace(/[^a-z0-9]/g, "_")
50
- cleaned_input = cleaned_input.replace(/_{2,}/g, "_")
51
- cleaned_input = cleaned_input.replace(/^_+|_+$/g, "")
52
- }
53
- return cleaned_input
54
- }
55
-
56
- function save_changes(toggle_modal) {
57
- console.log("save_changes")
58
- edit_val.identifier = clean_identifier(edit_val?.identifier)
59
- let cleaned_property_path = []
60
- if (Array.isArray(edit_val?.property_path)) {
61
- for (let identifier of edit_val?.property_path) {
62
- cleaned_property_path.push(clean_identifier(identifier))
63
- }
64
- }
65
- edit_val.property_path = cleaned_property_path
66
- set_node_value(node_path, edit_val)
67
- if (toggle_modal) {
68
- toggle_modal()
69
- }
70
- }
71
- </script>
72
-
73
- <Modal
74
- min_width={280}
75
- target_width={330}
76
- min_height={280}
77
- target_height={240}
78
- type="center"
79
- header="Defined Target Selector"
80
- >
81
- <div slot="toggle_button">
82
- <Button
83
- type="outlined"
84
- h={10}
85
- l={3}
86
- c={1}
87
- text={node_value?.identifier
88
- ? `${node_value?.identifier}${
89
- Array.isArray(node_value?.property_path) && node_value?.property_path.length > 0
90
- ? "." + node_value?.property_path.join(".")
91
- : ""
92
- }`
93
- : "Select Defined Identifier"}
94
- />
95
- </div>
96
- <div slot="modal_content" let:toggle_modal>
97
- <Dropdown
98
- is_disabled={is_preview}
99
- val={edit_val?.identifier}
100
- ondropdown_opened={() => dropdown_opened()}
101
- onitem_click={(e) => (edit_val.identifier = e.detail.key)}
102
- {options}
103
- mb={1}
104
- />
105
- <TextArrayInput label="Property Path" bind:val={edit_val.property_path} is_bind_val={true} />
106
- </div>
107
- <div slot="modal_content_footer" let:toggle_modal>
108
- <Button text="Save Changes" onclick={() => save_changes(toggle_modal)} />
109
- </div>
110
- </Modal>
@@ -1,109 +0,0 @@
1
- <script>
2
- // import Button from "../../../../Button/index.svelte"
3
- // import Checkbox from "../../../../Checkbox/index.svelte"
4
- // import FileInput from "../../../../FileInput/index.svelte"
5
- // import CronInput from "../../../../CronInput/index.svelte"
6
- // import ColorInput from "../../../../ColorInput/index.svelte"
7
- // import TextInput from "../../../../TextInput/index.svelte"
8
- // import IconInput from "../../../../IconInput/index.svelte"
9
- // import TimeInput from "../../../../TimeInput/index.svelte"
10
- // import InlineDropArea from "../InlineDropArea/index.svelte"
11
- // import DefinedTargetInput from "../DefinedTargetInput/index.svelte"
12
- // import Node from "../../../../FunctionBuilder/Node/index.svelte"
13
-
14
- let { manager } = $props()
15
-
16
- // maybe more custom inputs like slider with custom min, max, step or range. Maybe dropdown with custom options
17
-
18
- // make any TextInput fields show display and a modal for edit to only set new version on finish
19
- // give all inputs a config input so i can set dropdown options, slider limits, color options, etc
20
- </script>
21
-
22
- <!-- <pre>{JSON.stringify({ a: manager?.field_id, b: manager?.field }, null, 2)}</pre> -->
23
- <!-- {manager?.input_type} -->
24
- {#if manager?.bar_item?.ui_type == "text"}
25
- <p style="white-space: nowrap;">{manager?.bar_item?.value}</p>
26
- {:else if manager?.bar_item?.ui_type == "br"}
27
- <div style="width: 100%;"></div>
28
- {:else if manager?.bar_item?.ui_type == "field" && !manager?.field?.forced_node}
29
- {#if manager?.node_type}
30
- node_tbd
31
- <!-- <Node {node_path} {node_type} {node_value} {is_preview} {is_clickable_only} /> -->
32
- {:else}
33
- <!-- <InlineDropArea manager={manager?.manager} /> -->
34
- <!-- <InlineDropArea {parent_node_type} {node_path} {node_type} {node_value} {is_preview} /> -->
35
- {/if}
36
- {:else if manager?.bar_item?.ui_type == "input" || manager?.input_type}
37
- {#if manager?.input_type == "arrow_toggle_literal"}
38
- <!-- <Button manager={manager?.manager} /> -->
39
- {:else if manager?.input_type == "defined_target_literal"}
40
- defined_tbd
41
- <!-- <DefinedTargetInput {node_path} {node_value} /> -->
42
- {:else if manager?.input_type == "get_defined"}
43
- get_defined
44
- {:else if manager?.input_type == "parameters_literal"}
45
- parameters_literal
46
- {:else if manager?.input_type == "arguments_literal"}
47
- arguments_literal
48
- {:else if manager?.input_type == "array_expression"}
49
- array_expression
50
- {:else if manager?.input_type == "array_uniform_literal"}
51
- array_uniform_literal
52
- {:else if manager?.input_type == "array_literal"}
53
- array_literal
54
- {:else if manager?.input_type == "object_expression"}
55
- object_expression
56
- {:else if manager?.input_type == "object_literal"}
57
- object_literal
58
- {:else if manager?.input_type == "json_literal"}
59
- json_literal
60
- {:else if manager?.input_type == "subscriber_id_literal"}
61
- subscriber_id_literal
62
- {:else if manager?.input_type == "checkbox"}
63
- <!-- <Checkbox manager={manager?.manager} /> -->
64
- {:else if manager?.input_type == "time_input"}
65
- TimeInput_tbd
66
- <!-- <TimeInput manager={manager?.manager} /> -->
67
- {:else if manager?.input_type == "file_input"}
68
- file_input
69
- <!-- <FileInput /> -->
70
- {:else if manager?.input_type == "location_literal"}
71
- location_literal
72
- {:else if manager?.input_type == "color_input"}
73
- <!-- <ColorInput manager={manager?.manager} /> -->
74
- {:else if manager?.input_type == "icon_input"}
75
- <!-- <IconInput manager={manager?.manager} /> -->
76
- {:else if ["email_address_input", "text_input", "number_input"].includes(manager?.input_type)}
77
- <!-- <TextInput manager={manager?.manager} /> -->
78
- {:else if manager?.input_type == "identifier_literal"}
79
- identifier_literal_tbd
80
- {:else if manager?.input_type == "cron_input"}
81
- <!-- <CronInput manager={manager?.manager} /> -->
82
- {:else}
83
- tbd1 {manager?.input_type}
84
- <!-- <pre>{JSON.stringify(
85
- {
86
- type: "d",
87
- node_path: node_path ?? "",
88
- node_type: node_type ?? "",
89
- node_value: node_value ?? "",
90
- manager?.bar_item: manager?.bar_item ?? "",
91
- },
92
- null,
93
- 2
94
- )}</pre> -->
95
- {/if}
96
- {:else}
97
- tbd2
98
- <!-- <pre>{JSON.stringify(
99
- {
100
- type: "e",
101
- node_path: node_path ?? "",
102
- node_type: node_type ?? "",
103
- node_value: node_value ?? "",
104
- manager?.bar_item: manager?.bar_item ?? "",
105
- },
106
- null,
107
- 2
108
- )}</pre> -->
109
- {/if}
@@ -1,207 +0,0 @@
1
- import { create_inline_dropdown_manager } from "../InlineDropArea/index.svelte.js"
2
- import { create_button_manager } from "../../../../Button/index.svelte.js"
3
- import { create_checkbox_manager } from "../../../../Checkbox/index.svelte.js"
4
- import { create_color_input_manager } from "../../../../ColorInput/index.svelte.js"
5
- import { create_time_input_manager } from "../../../../TimeInput/index.svelte.js"
6
- import { create_cron_input_manager } from "../../../../CronInput/index.svelte.js"
7
- import { create_icon_input_manager } from "../../../../IconInput/index.svelte.js"
8
- import { create_text_input_manager } from "../../../../TextInput/index.svelte.js"
9
- import { create_location_input_manager } from "../../../../LocationInput/index.svelte.js"
10
- import { create_dropdown_manager } from "../../../../Dropdown/index.svelte.js"
11
- import { node_types, set_closurable, deep_copy } from "../../../../../client/index.js"
12
- // import { create_node_manager } from "../../index.svelte"
13
-
14
- export function create_field_manager(config) {
15
- // let bar_item = $derived(set_closurable(config?.bar_item, null))
16
- let bar_item = $state(null)
17
-
18
- let field_id = $derived(config?.node_path?.[Array.isArray(config?.node_path) ? config?.node_path.length - 1 : -1])
19
- let field = $derived(bar_item?.ui_type != "field" ? null : node_types?.[config?.parent_node_type]?.fields?.[field_id])
20
- let input_type = $derived(
21
- field ? field?.forced_node ?? config?.node_type : bar_item?.ui_type == "input" ? bar_item?.value : null
22
- )
23
- let manager = $state(null)
24
-
25
- function get_manager() {
26
- const ui_type = bar_item?.ui_type
27
- console.log("bar", { config: config, bar_item: bar_item, field, input_type })
28
- if (ui_type == "text") {
29
- // tbd
30
- } else if (ui_type == "br") {
31
- // tbd
32
- } else if (ui_type == "field" && !field?.forced_node) {
33
- if (config?.node_type) {
34
- // create_node_manager {node_path} {node_type} {node_value} {is_preview} {is_clickable_only}
35
- } else {
36
- return create_inline_dropdown_manager({
37
- parent_node_type: config?.parent_node_type,
38
- node_path: config?.node_path,
39
- node_type: config?.node_type,
40
- node_value: config?.node_value,
41
- is_preview: !!config?.is_preview,
42
- })
43
- }
44
- } else if (ui_type == "input" || input_type) {
45
- // // tbd
46
- console.log("input_type", input_type)
47
- if (input_type == "arrow_toggle_literal") {
48
- return create_button_manager({
49
- type: "soft",
50
- support_icon: "arrow",
51
- border_radius: 0.5,
52
- icon_deg: () => (config?.node_value ? 180 : 0),
53
- is_uniform: true,
54
- min_height: 2.6,
55
- icon_size: 1.2,
56
- icon_sw: 50,
57
- h: 14,
58
- c: 1,
59
- l: 6,
60
- icon_movement_damping: 1,
61
- on_click: () => config?.on_set_node_value(config?.node_path, !config?.node_value),
62
- })
63
- } else if (input_type == "checkbox") {
64
- return create_checkbox_manager({
65
- type: "toggle",
66
- val: config?.node_value,
67
- color: "var(--g4-t)",
68
- on_change: (input) => set_node_value(config?.node_path, input),
69
- })
70
- } else if (input_type == "color_input") {
71
- return create_color_input_manager({
72
- val: config?.node_value,
73
- on_finish: (input) => set_node_value(config?.node_path, input),
74
- })
75
- } else if (input_type == "time_input") {
76
- return create_time_input_manager({
77
- is_popover: true,
78
- val: config?.node_value,
79
- on_finish: (input) => set_node_value(config?.node_path, input),
80
- })
81
- } else if (input_type == "cron_input") {
82
- return create_cron_input_manager({
83
- is_popover: true,
84
- val: config?.node_value,
85
- on_finish: (input) => set_node_value(config?.node_path, input),
86
- })
87
- } else if (input_type == "icon_input") {
88
- return create_icon_input_manager({
89
- is_popover: true,
90
- val: config?.node_value,
91
- on_finish: (input) => set_node_value(config?.node_path, input),
92
- })
93
- } else if (input_type == "text_input") {
94
- return create_text_input_manager({
95
- val: config?.node_value,
96
- on_finish: (input) => set_node_value(config?.node_path, input),
97
- })
98
- } else if (input_type == "number_input") {
99
- return create_text_input_manager({
100
- type: "number",
101
- val: config?.node_value,
102
- on_finish: (input) => set_node_value(config?.node_path, input),
103
- })
104
- } else if (input_type == "email_address_input") {
105
- return create_text_input_manager({
106
- type: "email",
107
- val: config?.node_value,
108
- on_finish: (input) => set_node_value(config?.node_path, input),
109
- })
110
- } else if (input_type == "location_input") {
111
- return create_location_input_manager({
112
- val: config?.node_value,
113
- on_finish: (input) => set_node_value(config?.node_path, input),
114
- })
115
- }
116
- }
117
- // tbd
118
- }
119
-
120
- let full_node_type = $state(node_types?.[config?.node_type])
121
- let h = $derived(config?.node_categories?.[config?.node_types?.[config?.node_type]?.category]?.h || 4)
122
- let c = 12
123
-
124
- let edit_text_literal = null
125
- let is_edit_text_literal = false
126
- function save_text_literal() {
127
- if (input_type == "identifier_literal") {
128
- let cleaned_input = edit_text_literal.toLowerCase()
129
- cleaned_input = cleaned_input.replace(/[^a-z0-9]/g, "_")
130
- cleaned_input = cleaned_input.replace(/_{2,}/g, "_")
131
- cleaned_input = cleaned_input.replace(/^_+|_+$/g, "")
132
- set_node_value(node_path, cleaned_input)
133
- is_edit_text_literal = false
134
- edit_text_literal = null
135
- }
136
- }
137
-
138
- function pre_edit_text() {
139
- edit_text_literal = JSON.parse(JSON.stringify(node_value))
140
- is_edit_text_literal = true
141
- }
142
-
143
- let text_literal_type = $derived(
144
- ["int_literal", "float_literal", "bigint_literal"].includes(input_type)
145
- ? "number"
146
- : input_type == "email_address_literal"
147
- ? "email"
148
- : input_type == "identifier_literal"
149
- ? "text"
150
- : "text"
151
- )
152
- let text_placeholder = $derived(
153
- ["int_literal", "float_literal", "bigint_literal"].includes(input_type)
154
- ? "number"
155
- : input_type == "email_address_literal"
156
- ? "email"
157
- : input_type == "identifier_literal"
158
- ? "identifier"
159
- : "text"
160
- )
161
-
162
- function init(config) {
163
- bar_item = config?.bar_item ? deep_copy(config?.bar_item) : null
164
- manager = get_manager()
165
- }
166
-
167
- init(config)
168
-
169
- return {
170
- get bar_item() {
171
- return bar_item
172
- },
173
- get node_field() {
174
- return config?.node_field
175
- },
176
- get parent_node_type() {
177
- return config?.parent_node_type
178
- },
179
- get node_path() {
180
- return config?.node_path
181
- },
182
- get node_type() {
183
- return config?.node_type
184
- },
185
- get node_value() {
186
- return config?.node_value
187
- },
188
- get is_preview() {
189
- return config?.is_preview
190
- },
191
- get is_clickable_only() {
192
- return config?.is_clickable_only
193
- },
194
- get field() {
195
- return field
196
- },
197
- get field_id() {
198
- return field_id
199
- },
200
- get input_type() {
201
- return input_type
202
- },
203
- get manager() {
204
- return manager
205
- },
206
- }
207
- }
@@ -1,97 +0,0 @@
1
- <script>
2
- import Popover from "../../../../Popover/index.svelte"
3
- import Button from "../../../../Button/index.svelte"
4
- import Node from "../../index.svelte"
5
-
6
- let { manager } = $props()
7
-
8
- </script>
9
-
10
- <div>
11
- {#if manager?.node_value}
12
- node_tbd
13
- <!-- <Node {node_path} {node_type} {node_value} {is_preview} /> -->
14
- {:else}
15
- <div
16
- class="droparea"
17
- class:draggedover={!manager?.is_preview || (manager?.is_drag_enter && manager?.hovered_node_drop_zone == "empty")}
18
- role="button"
19
- tabindex="0"
20
- aria-label="Drop area"
21
- draggable={!manager?.is_preview}
22
- ondragstart={(e) => manager?.prevent_drag(e)}
23
- ondragenter={() => manager?.handle_drag_enter("empty")}
24
- ondragleave={() => manager?.handle_drag_leave()}
25
- ondragover={(e) => e.preventDefault()}
26
- ondrop={() => manager?.handle_drop()}
27
- >
28
- <p style="white-space: nowrap; font-size: 1.6rem;">Drop or</p>
29
- <Button manager={manager?.open_choose_node_popover_button_manager} />
30
- <Popover manager={manager?.choose_node_popover_manager}>
31
- {#snippet content()}
32
- popover_content_tbd
33
- <!-- <div style="cursor: default;">
34
- {#if Array.isArray(node_types?.[parent_node_type]?.fields?.[node_path?.[Array.isArray(node_path) ? node_path.length - 1 : -1]]?.node_options) && node_types?.[parent_node_type]?.fields?.[node_path?.[Array.isArray(node_path) ? node_path.length - 1 : -1]]?.node_options.length > 0}
35
- <div class="node_types">
36
- {#each node_types?.[parent_node_type]?.fields?.[node_path?.[Array.isArray(node_path) ? node_path.length - 1 : -1]]?.node_options as node_type}
37
- <div
38
- class="node_container"
39
- role="button"
40
- tabindex="0"
41
- onclick={() => handle_node_click(node_type)}
42
- onkeypress={() => handle_node_click(node_type)}
43
- >
44
- <Node {node_type} is_preview={true} is_clickable_only={true} />
45
- </div>
46
- {/each}
47
- </div>
48
- {:else}
49
- <p>No node options found</p>
50
- {/if}
51
- </div> -->
52
- {/snippet}
53
- </Popover>
54
- </div>
55
- {/if}
56
- </div>
57
-
58
- <style>
59
- .droparea {
60
- display: flex;
61
- align-items: center;
62
- padding: 0.2rem 1rem;
63
- gap: 0.5rem;
64
- border: 1px dashed var(--g6-t);
65
- background-color: var(--shadow5-t);
66
- min-width: 5rem;
67
- min-height: 3.4rem;
68
- border-radius: 0.5rem;
69
- }
70
- .draggedover {
71
- border: 1px dashed var(--g3-t);
72
- background-color: var(--shadow8-t);
73
- }
74
- .node_types {
75
- padding: 1rem;
76
- display: flex;
77
- flex-direction: column;
78
- }
79
- .node_container {
80
- position: relative;
81
- padding: 1rem;
82
- }
83
- .node_container::after {
84
- content: "";
85
- position: absolute;
86
- top: 0;
87
- right: 0;
88
- bottom: -1px;
89
- left: 0;
90
- z-index: 1;
91
- border-radius: 1rem;
92
- }
93
- .node_container:hover::after {
94
- border: 1px solid var(--shadow5-t);
95
- background-color: var(--shadow3-t);
96
- }
97
- </style>
@@ -1,105 +0,0 @@
1
- import { create_popover_manager } from "../../../../Popover/index.svelte.js"
2
- import { create_button_manager } from "../../../../Button/index.svelte.js"
3
-
4
- export function create_inline_dropdown_manager(config) {
5
- let is_drag_enter = $state(false)
6
- let drag_counter = $state(0)
7
- let hovered_node_drop_zone = $state(false)
8
- let choose_node_popover_manager = $state(null)
9
- let open_choose_node_popover_button_manager = $state(null)
10
-
11
- function handle_drag_enter(zone_id) {
12
- drag_counter++
13
- is_drag_enter = drag_counter > 0
14
- hovered_node_drop_zone = zone_id
15
- }
16
-
17
- function handle_drag_leave() {
18
- drag_counter--
19
- if (drag_counter === 0) {
20
- is_drag_enter = false
21
- }
22
- hovered_node_drop_zone = null
23
- }
24
-
25
- function handle_drop() {
26
- hovered_node_drop_zone = null
27
- if (config?.on_drag_or_select_node) {
28
- config?.on_drag_or_select_node(config?.node_path, config?.parent_node_type)
29
- }
30
- }
31
-
32
- function handle_node_click(clicked_node_type) {
33
- choose_node_popover_manager?.close()
34
- if (config?.on_drag_or_select_node) {
35
- config?.on_drag_or_select_node(config?.node_path, config?.parent_node_type, true, clicked_node_type)
36
- }
37
- }
38
-
39
- function prevent_drag(e) {
40
- e.stopPropagation()
41
- e.preventDefault()
42
- }
43
-
44
- function init(config) {
45
- // choose_node_popover_manager = create_popover_manager({
46
- // header: "Choose Node",
47
- // min_width: 280,
48
- // target_width: 600,
49
- // min_height: 250,
50
- // target_height: 600,
51
- // type: "center",
52
- // anchor_id: () => `button_${open_choose_node_popover_button_manager?.id}`,
53
- // })
54
- // open_choose_node_popover_button_manager = create_button_manager({
55
- // text: "Choose",
56
- // min_height: 2.4,
57
- // pl: 0.8,
58
- // pr: 0.8,
59
- // is_disabled: () => !!config?.is_preview,
60
- // font_size: 1.2,
61
- // border_radius: 0.5,
62
- // popover_target: () => `popover_${choose_node_popover_manager?.id}`,
63
- // })
64
- }
65
-
66
- init(config)
67
-
68
- return {
69
- get parent_node_type() {
70
- return config?.parent_node_type
71
- },
72
- get node_path() {
73
- return config?.node_path
74
- },
75
- get node_type() {
76
- return config?.node_type
77
- },
78
- get node_value() {
79
- return config?.node_value
80
- },
81
- get is_preview() {
82
- return config?.is_preview
83
- },
84
- get is_drag_enter() {
85
- return is_drag_enter
86
- },
87
- get drag_counter() {
88
- return drag_counter
89
- },
90
- get hovered_node_drop_zone() {
91
- return hovered_node_drop_zone
92
- },
93
- get choose_node_popover_manager() {
94
- return choose_node_popover_manager
95
- },
96
- get open_choose_node_popover_button_manager() {
97
- return open_choose_node_popover_button_manager
98
- },
99
- handle_drag_enter,
100
- handle_drag_leave,
101
- handle_drop,
102
- handle_node_click,
103
- prevent_drag,
104
- }
105
- }