sveltekit-ui 1.0.11 → 1.0.13
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/Content/index.svelte +12 -12
- package/dist/Components/Content/index.svelte.js +73 -61
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Dropdown/index.svelte.js +1 -5
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Number/index.svelte.js +1 -2
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Qr/index.svelte.js +1 -3
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/Slider/index.svelte.js +2 -4
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TableAdvanced/index.svelte.js +28 -32
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TextInput/index.svelte.js +1 -3
- package/dist/Components/ContentInput/AttributesInput/CustomConfig/TimeInput/index.svelte.js +1 -3
- package/dist/Components/ContentInput/AttributesInput/DefinedTypeInput/index.svelte.js +3 -13
- package/dist/Components/ContentInput/AttributesInput/index.svelte +1 -0
- package/dist/Components/ContentInput/AttributesInput/index.svelte.js +89 -120
- package/dist/Components/ContentInput/index.svelte.js +38 -62
- package/dist/Components/DataTypeInput/index.svelte.js +0 -3
- package/dist/Components/IconInput/index.svelte +1 -1
- package/dist/Components/TableAdvanced/ColumnInput/index.svelte.js +16 -64
- package/dist/Components/TableAdvanced/SortByInput/index.svelte.js +2 -1
- package/dist/Components/TableAdvanced/index.svelte.js +124 -98
- package/dist/Components/TextInput/index.svelte.js +12 -0
- package/dist/Components/VariablePathInput/index.svelte +47 -93
- package/dist/Components/VariablePathInput/index.svelte.js +205 -191
- package/dist/client/astc_formatting/index.js +15 -58
- package/dist/client/docs/index.js +4 -23
- package/dist/client/index.js +86 -90
- package/dist/client/types/index.js +2 -0
- package/dist/index.js +2 -0
- package/package.json +4 -4
- package/src/lib/Components/Content/index.svelte +12 -12
- package/src/lib/Components/Content/index.svelte.js +73 -61
- package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Dropdown/index.svelte.js +1 -5
- package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Number/index.svelte.js +1 -2
- package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Qr/index.svelte.js +1 -3
- package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Slider/index.svelte.js +2 -4
- package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/TableAdvanced/index.svelte.js +28 -32
- package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/TextInput/index.svelte.js +1 -3
- package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/TimeInput/index.svelte.js +1 -3
- package/src/lib/Components/ContentInput/AttributesInput/DefinedTypeInput/index.svelte.js +3 -13
- package/src/lib/Components/ContentInput/AttributesInput/index.svelte +1 -0
- package/src/lib/Components/ContentInput/AttributesInput/index.svelte.js +89 -120
- package/src/lib/Components/ContentInput/index.svelte.js +38 -62
- package/src/lib/Components/DataTypeInput/index.svelte.js +0 -3
- package/src/lib/Components/IconInput/index.svelte +1 -1
- package/src/lib/Components/TableAdvanced/ColumnInput/index.svelte.js +16 -64
- package/src/lib/Components/TableAdvanced/SortByInput/index.svelte.js +2 -1
- package/src/lib/Components/TableAdvanced/index.svelte.js +124 -98
- package/src/lib/Components/TextInput/index.svelte.js +12 -0
- package/src/lib/Components/VariablePathInput/index.svelte +47 -93
- package/src/lib/Components/VariablePathInput/index.svelte.js +205 -191
- package/src/lib/client/astc_formatting/index.js +15 -58
- package/src/lib/client/docs/index.js +4 -23
- package/src/lib/client/index.js +86 -90
- package/src/lib/client/types/index.js +2 -0
- package/src/lib/index.js +2 -0
- package/src/routes/[component]/Showcase/Content/index.svelte +49 -83
- package/src/routes/[component]/Showcase/ContentInput/index.svelte +11 -13
- package/src/routes/[component]/Showcase/TableAdvanced/index.svelte +108 -418
package/dist/client/index.js
CHANGED
|
@@ -551,20 +551,80 @@ export function get_data_type_at_path(path, full_data_type) {
|
|
|
551
551
|
return data_type_at_path_loc
|
|
552
552
|
}
|
|
553
553
|
|
|
554
|
-
export function
|
|
555
|
-
|
|
556
|
-
|
|
554
|
+
export function get_def(input, definition_stack) {
|
|
555
|
+
if (Array.isArray(definition_stack)) {
|
|
556
|
+
for (let item of definition_stack) {
|
|
557
|
+
if (item.hasOwnProperty(input)) {
|
|
558
|
+
return item?.[input]
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
return null
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
export function get_def_from_variable_path(input, definition_stack) {
|
|
566
|
+
let val = null
|
|
567
|
+
if (Array.isArray(input) && input.length > 0) {
|
|
568
|
+
val = get_def(input?.[0], definition_stack)
|
|
569
|
+
for (let i = 1; i < input.length; i++) {
|
|
570
|
+
if (Array.isArray(input?.[i])) {
|
|
571
|
+
const res = get_def_from_variable_path(input?.[i], definition_stack)
|
|
572
|
+
val = val?.[res]
|
|
573
|
+
} else {
|
|
574
|
+
val = val?.[input?.[i]]
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
return val
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
export function is_defined(input, definition_stack) {
|
|
582
|
+
if (Array.isArray(definition_stack)) {
|
|
583
|
+
for (let item of definition_stack) {
|
|
584
|
+
if (item && typeof item == "object" && item.hasOwnProperty(input)) {
|
|
585
|
+
return true
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
return false
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
export function set_def(identifier, value, definition_stack) {
|
|
593
|
+
if (Array.isArray(definition_stack)) {
|
|
594
|
+
for (let i = 0; i < definition_stack.length; i++) {
|
|
595
|
+
if (definition_stack[i].hasOwnProperty(identifier)) {
|
|
596
|
+
definition_stack[i][identifier] = value
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return definition_stack
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
export function set_definition_stack(input, definition_stack, pass_event_down) {
|
|
604
|
+
if (!Array.isArray(input?.variable_path_to_target) || !Array.isArray(definition_stack)) {
|
|
557
605
|
throw new Error("Path must be an array")
|
|
558
606
|
}
|
|
559
|
-
let
|
|
560
|
-
let temp = content_variables_loc
|
|
607
|
+
let defined_i = null
|
|
561
608
|
const path = input.variable_path_to_target
|
|
609
|
+
const root_key = path[0]
|
|
610
|
+
for (let i = 0; i < definition_stack.length; i++) {
|
|
611
|
+
if (definition_stack?.[i].hasOwnProperty(root_key)) {
|
|
612
|
+
defined_i = i
|
|
613
|
+
break
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
if (defined_i == null) {
|
|
617
|
+
throw new Error("Root key not found in stack")
|
|
618
|
+
}
|
|
619
|
+
let defined_variables_loc = deep_copy(definition_stack[defined_i][root_key])
|
|
620
|
+
let temp = defined_variables_loc
|
|
562
621
|
const last_key = path[path.length - 1]
|
|
563
|
-
for (let i =
|
|
622
|
+
for (let i = 1; i < path.length - 1; i++) {
|
|
564
623
|
const key = path[i]
|
|
565
624
|
if (!(key in temp) || typeof temp[key] !== "object" || temp[key] === null) {
|
|
566
|
-
|
|
567
|
-
|
|
625
|
+
const next_key = path[i + 1]
|
|
626
|
+
if (Number.isInteger(next_key)) {
|
|
627
|
+
temp[key] = []
|
|
568
628
|
} else {
|
|
569
629
|
temp[key] = {}
|
|
570
630
|
}
|
|
@@ -576,17 +636,26 @@ export function set_content_variables(input, variables_combined, pass_event_down
|
|
|
576
636
|
if (
|
|
577
637
|
typeof input?.index_to_insert_at === "number" &&
|
|
578
638
|
input?.index_to_insert_at >= 0 &&
|
|
579
|
-
input?.index_to_insert_at <= temp
|
|
639
|
+
input?.index_to_insert_at <= temp[last_key].length
|
|
580
640
|
) {
|
|
581
641
|
temp[last_key].splice(input.index_to_insert_at, 0, input.value)
|
|
582
642
|
} else {
|
|
583
643
|
temp[last_key].push(input.value)
|
|
584
644
|
}
|
|
645
|
+
} else if (Array.isArray(temp)) {
|
|
646
|
+
if (
|
|
647
|
+
typeof input?.index_to_insert_at === "number" &&
|
|
648
|
+
input?.index_to_insert_at >= 0 &&
|
|
649
|
+
input?.index_to_insert_at <= temp.length
|
|
650
|
+
) {
|
|
651
|
+
temp.splice(input.index_to_insert_at, 0, input.value)
|
|
652
|
+
} else {
|
|
653
|
+
temp.push(input.value)
|
|
654
|
+
}
|
|
585
655
|
} else {
|
|
586
656
|
temp[last_key] = [input.value]
|
|
587
657
|
}
|
|
588
658
|
} else if (input?.type == "set_variables_delete") {
|
|
589
|
-
console.log("set_variables_delete", deep_copy({ temp, last_key }))
|
|
590
659
|
if (Array.isArray(temp)) {
|
|
591
660
|
if (typeof last_key === "number" && last_key > -1 && last_key < temp.length) {
|
|
592
661
|
temp.splice(last_key, 1)
|
|
@@ -595,7 +664,6 @@ export function set_content_variables(input, variables_combined, pass_event_down
|
|
|
595
664
|
delete temp[last_key]
|
|
596
665
|
}
|
|
597
666
|
} else if (input?.type == "set_variables_key") {
|
|
598
|
-
console.log("set_variables_key", deep_copy({ temp, last_key }))
|
|
599
667
|
if (Array.isArray(temp)) {
|
|
600
668
|
throw new Error("Cannot change key in array")
|
|
601
669
|
} else if (typeof temp === "object" && temp?.hasOwnProperty(last_key)) {
|
|
@@ -607,107 +675,35 @@ export function set_content_variables(input, variables_combined, pass_event_down
|
|
|
607
675
|
} else {
|
|
608
676
|
temp[last_key] = input?.value
|
|
609
677
|
}
|
|
610
|
-
|
|
678
|
+
definition_stack[defined_i][root_key] = defined_variables_loc
|
|
679
|
+
console.log("defined_variables_loc112", defined_variables_loc)
|
|
680
|
+
console.log("vars_fin", deep_copy(definition_stack))
|
|
611
681
|
if (typeof pass_event_down === "function") {
|
|
612
682
|
pass_event_down({
|
|
613
683
|
value: input.value,
|
|
614
|
-
|
|
684
|
+
definition_stack: definition_stack,
|
|
615
685
|
set_from_content_id: input.set_from_content_id,
|
|
616
686
|
variable_path_to_target: input.variable_path_to_target,
|
|
617
687
|
})
|
|
618
688
|
}
|
|
619
689
|
return {
|
|
620
690
|
is_success: true,
|
|
621
|
-
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
// export function set_content_variables(input, variables_combined, pass_event_down) {
|
|
626
|
-
// console.log("set_content_variables000", input)
|
|
627
|
-
// if (!Array.isArray(input?.variable_path_to_target)) {
|
|
628
|
-
// throw new Error("Path must be an array")
|
|
629
|
-
// }
|
|
630
|
-
// let content_variables_loc = deep_copy(variables_combined)
|
|
631
|
-
// let temp = content_variables_loc
|
|
632
|
-
// const path = input.variable_path_to_target
|
|
633
|
-
// const last_key = path[path.length - 1]
|
|
634
|
-
// for (let i = 0; i < path.length - 1; i++) {
|
|
635
|
-
// const key = path[i]
|
|
636
|
-
// const nextKey = path[i + 1]
|
|
637
|
-
|
|
638
|
-
// if (!(key in temp) || typeof temp[key] !== "object" || temp[key] === null) {
|
|
639
|
-
// if (typeof nextKey === "number") {
|
|
640
|
-
// temp[key] = []
|
|
641
|
-
// } else {
|
|
642
|
-
// temp[key] = {}
|
|
643
|
-
// }
|
|
644
|
-
// }
|
|
645
|
-
// temp = temp[key]
|
|
646
|
-
// }
|
|
647
|
-
// if (input?.type == "set_variables_insert") {
|
|
648
|
-
// if (Array.isArray(temp[last_key])) {
|
|
649
|
-
// if (
|
|
650
|
-
// typeof input?.index_to_insert_at === "number" &&
|
|
651
|
-
// input?.index_to_insert_at >= 0 &&
|
|
652
|
-
// input?.index_to_insert_at <= temp?.[last_key].length
|
|
653
|
-
// ) {
|
|
654
|
-
// temp[last_key].splice(input.index_to_insert_at, 0, input.value)
|
|
655
|
-
// } else {
|
|
656
|
-
// temp[last_key].push(input.value)
|
|
657
|
-
// }
|
|
658
|
-
// } else {
|
|
659
|
-
// temp[last_key] = [input.value]
|
|
660
|
-
// }
|
|
661
|
-
// } else if (input?.type == "set_variables_delete") {
|
|
662
|
-
// if (Array.isArray(temp)) {
|
|
663
|
-
// if (typeof last_key === "number" && last_key > -1 && last_key < temp.length) {
|
|
664
|
-
// temp.splice(last_key, 1)
|
|
665
|
-
// }
|
|
666
|
-
// } else if (typeof temp === "object" && temp?.hasOwnProperty(last_key)) {
|
|
667
|
-
// delete temp[last_key]
|
|
668
|
-
// }
|
|
669
|
-
// } else if (input?.type == "set_variables_key") {
|
|
670
|
-
// if (Array.isArray(temp)) {
|
|
671
|
-
// throw new Error("Cannot change key in array")
|
|
672
|
-
// } else if (typeof temp === "object" && temp?.hasOwnProperty(last_key)) {
|
|
673
|
-
// temp[input.value] = temp[last_key]
|
|
674
|
-
// delete temp[last_key]
|
|
675
|
-
// } else {
|
|
676
|
-
// throw new Error("Key not found in object")
|
|
677
|
-
// }
|
|
678
|
-
// } else {
|
|
679
|
-
// temp[last_key] = input?.value
|
|
680
|
-
// }
|
|
681
|
-
// if (typeof pass_event_down === "function") {
|
|
682
|
-
// pass_event_down({
|
|
683
|
-
// value: input.value,
|
|
684
|
-
// variables: content_variables_loc,
|
|
685
|
-
// set_from_content_id: input.set_from_content_id,
|
|
686
|
-
// variable_path_to_target: input.variable_path_to_target,
|
|
687
|
-
// })
|
|
688
|
-
// }
|
|
689
|
-
// return {
|
|
690
|
-
// is_success: true,
|
|
691
|
-
// variables: content_variables_loc,
|
|
692
|
-
// }
|
|
693
|
-
// }
|
|
691
|
+
definition_stack: definition_stack,
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
694
|
|
|
695
695
|
// tbd could also turn into a typed thing with arrays of v or objects, color, etc
|
|
696
696
|
export function v(config) {
|
|
697
697
|
let val = $state(null)
|
|
698
|
-
|
|
699
698
|
function on_change(from_id = null) {
|
|
700
699
|
if (typeof config?.on_change == "function") {
|
|
701
700
|
config?.on_change({ val, from_id: from_id })
|
|
702
701
|
}
|
|
703
702
|
}
|
|
704
|
-
|
|
705
703
|
function init(config) {
|
|
706
704
|
val = config?.val
|
|
707
705
|
}
|
|
708
|
-
|
|
709
706
|
init(config)
|
|
710
|
-
|
|
711
707
|
return {
|
|
712
708
|
get val() {
|
|
713
709
|
return val
|
|
@@ -1996,6 +1996,8 @@ export const content_types = {
|
|
|
1996
1996
|
type: "variable_path_literal",
|
|
1997
1997
|
allowed_types: ["array_uniform_literal", "object_uniform_literal"],
|
|
1998
1998
|
},
|
|
1999
|
+
iter_identifier: { type: "text_literal" },
|
|
2000
|
+
join_text: { type: "text_literal" },
|
|
1999
2001
|
},
|
|
2000
2002
|
child_elements: {
|
|
2001
2003
|
...main_child_element_options,
|
package/dist/index.js
CHANGED
|
@@ -76,6 +76,8 @@ export { default as Popover } from "./Components/Popover/index.svelte"
|
|
|
76
76
|
export { create_popover_manager } from "./Components/Popover/index.svelte.js"
|
|
77
77
|
export { default as TableAdvanced } from "./Components/TableAdvanced/index.svelte"
|
|
78
78
|
export { create_table_advanced_manager } from "./Components/TableAdvanced/index.svelte.js"
|
|
79
|
+
export { default as VariablePathInput } from "./Components/VariablePathInput/index.svelte"
|
|
80
|
+
export { create_variable_path_input_manager } from "./Components/VariablePathInput/index.svelte.js"
|
|
79
81
|
export { default as Spacer } from "./Components/Spacer/index.svelte"
|
|
80
82
|
export { default as TransparentBackground } from "./Components/TransparentBackground/index.svelte"
|
|
81
83
|
export { default as XFollow } from "./Components/XFollow/index.svelte"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sveltekit-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "A SvelteKit UI component library for building modern web applications",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -19,18 +19,18 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"context-filter-polyfill": "^0.3.23",
|
|
21
21
|
"qr-code-styling": "^1.9.2",
|
|
22
|
-
"svelte": "^5.37.
|
|
22
|
+
"svelte": "^5.37.3"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@sveltejs/kit": "^2.22.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@sveltejs/adapter-vercel": "^5.8.1",
|
|
29
|
-
"@sveltejs/kit": "^2.
|
|
29
|
+
"@sveltejs/kit": "^2.27.0",
|
|
30
30
|
"@sveltejs/package": "^2.4.0",
|
|
31
31
|
"@sveltejs/vite-plugin-svelte": "^6.1.0",
|
|
32
32
|
"@vercel/analytics": "^1.5.0",
|
|
33
|
-
"typescript": "^5.
|
|
33
|
+
"typescript": "^5.9.2",
|
|
34
34
|
"vite": "^7.0.6"
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://www.sveltekit-ui.com",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
import Self from "./index.svelte"
|
|
32
32
|
import { format_date, set_closurable_color, set_closurable, cron_to_english } from "$lib/client/index.js"
|
|
33
33
|
|
|
34
|
-
let { manager
|
|
34
|
+
let { manager } = $props()
|
|
35
35
|
|
|
36
36
|
function handle_anchor_click(event) {
|
|
37
37
|
event.preventDefault()
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
{#snippet children()}
|
|
49
49
|
{#if manager?.val_prepped?.is_children && Array.isArray(manager?.val_prepped?.children)}
|
|
50
50
|
{#each manager?.val_prepped?.children as child}
|
|
51
|
-
<Self manager={child}
|
|
51
|
+
<Self manager={child} />
|
|
52
52
|
{/each}
|
|
53
53
|
{/if}
|
|
54
54
|
{/snippet}
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
{#if Array.isArray(manager?.val_prepped?.children) && manager?.val_prepped?.children.some( (h) => set_closurable(h?.val_prepped?.attributes?.is_show) )}
|
|
60
60
|
{#if Array.isArray(manager?.val_prepped?.children.find( (h) => set_closurable(h?.val_prepped?.attributes?.is_show) )?.val_prepped?.children)}
|
|
61
61
|
{#each manager?.val_prepped?.children.find( (h) => set_closurable(h?.val_prepped?.attributes?.is_show) )?.val_prepped?.children as child (child?.selector_id)}
|
|
62
|
-
<Self manager={child}
|
|
62
|
+
<Self manager={child} />
|
|
63
63
|
{/each}
|
|
64
64
|
{/if}
|
|
65
65
|
{:else if Array.isArray(manager?.val_prepped?.children) && manager?.val_prepped?.children.some((h) => h?.val_prepped?.type_id == "show_conditions_item_else")}
|
|
66
66
|
{#if Array.isArray(manager?.val_prepped?.children.find((h) => h?.val_prepped?.type_id == "show_conditions_item_else")?.val_prepped?.children)}
|
|
67
67
|
{#each manager?.val_prepped?.children.find((h) => h?.val_prepped?.type_id == "show_conditions_item_else")?.val_prepped?.children as child (child?.selector_id)}
|
|
68
|
-
<Self manager={child}
|
|
68
|
+
<Self manager={child} />
|
|
69
69
|
{/each}
|
|
70
70
|
{/if}
|
|
71
71
|
{/if}
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
{#each manager?.val_prepped?.children as child_loops, i}
|
|
77
77
|
{#if Array.isArray(child_loops) && child_loops.length > 0}
|
|
78
78
|
{#each child_loops as child, i (child?.val_prepped?.selector_id)}
|
|
79
|
-
<Self manager={child}
|
|
79
|
+
<Self manager={child} />
|
|
80
80
|
{/each}
|
|
81
81
|
{/if}
|
|
82
82
|
{#if i < manager?.val_prepped?.children.length - 1 && manager?.val_prepped?.attributes?.join_text}{manager
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
<Button manager={child_loops?.remove_item_button_manager} />
|
|
94
94
|
{#if Array.isArray(child_loops?.children)}
|
|
95
95
|
{#each child_loops?.children as child (child?.selector_id)}
|
|
96
|
-
<Self manager={child}
|
|
96
|
+
<Self manager={child} />
|
|
97
97
|
{/each}
|
|
98
98
|
{/if}
|
|
99
99
|
</div>
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
<td>
|
|
129
129
|
{#if Array.isArray(child_loops?.children)}
|
|
130
130
|
{#each child_loops?.children as child (child?.selector_id)}
|
|
131
|
-
<Self manager={child}
|
|
131
|
+
<Self manager={child} />
|
|
132
132
|
{/each}
|
|
133
133
|
{/if}
|
|
134
134
|
</td>
|
|
@@ -439,11 +439,11 @@
|
|
|
439
439
|
: ''} {manager?.val_prepped?.attributes?.font_size
|
|
440
440
|
? `font-size: ${manager?.val_prepped?.attributes?.font_size}rem`
|
|
441
441
|
: ''}"
|
|
442
|
-
onclick={() =>
|
|
443
|
-
onkeydown={() =>
|
|
444
|
-
onpointerenter={() =>
|
|
445
|
-
onpointercancel={() =>
|
|
446
|
-
onpointerleave={() =>
|
|
442
|
+
onclick={() => manager?.open_edit_element_attributes_popover(manager?.val_prepped?.selector_id)}
|
|
443
|
+
onkeydown={() => manager?.open_edit_element_attributes_popover(manager?.val_prepped?.selector_id)}
|
|
444
|
+
onpointerenter={() => manager?.set_focused_selector_id(manager?.val_prepped?.selector_id)}
|
|
445
|
+
onpointercancel={() => manager?.set_focused_selector_id(null)}
|
|
446
|
+
onpointerleave={() => manager?.set_focused_selector_id(null)}
|
|
447
447
|
>
|
|
448
448
|
{set_closurable(manager?.val_prepped?.attributes?.content)}
|
|
449
449
|
</span>
|
|
@@ -26,61 +26,31 @@ import { create_qr_manager } from "$lib/Components/Qr/index.svelte.js"
|
|
|
26
26
|
import { create_file_input_manager } from "$lib/Components/FileInput/index.svelte.js"
|
|
27
27
|
import { create_cron_input_manager } from "$lib/Components/CronInput/index.svelte.js"
|
|
28
28
|
import { create_button_manager } from "$lib/Components/Button/index.svelte.js"
|
|
29
|
-
import {
|
|
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 "$lib/client/index.js"
|
|
30
38
|
|
|
31
39
|
export function create_content_manager(config) {
|
|
32
40
|
const id = create_unique_id(null, 20)
|
|
41
|
+
let definition_stack = $state([])
|
|
33
42
|
let is_dark_theme = $derived(set_closurable(config?.is_dark_theme, false))
|
|
34
43
|
let storage_path = $derived(set_closurable(config?.storage_path, "/api/v1/storage/{storage_id}"))
|
|
35
|
-
let variables = $derived(set_closurable(config?.variables, null))
|
|
36
|
-
let loops = $derived(set_closurable(config?.loops, null))
|
|
37
44
|
let mapkit_js_token = $derived(set_closurable(config?.mapkit_js_token, null))
|
|
38
45
|
let val_prepped = $state(null)
|
|
39
46
|
|
|
40
|
-
function get_variable_from_path(path) {
|
|
41
|
-
if (Array.isArray(path)) {
|
|
42
|
-
let combined_variables_loc = {
|
|
43
|
-
variables: variables,
|
|
44
|
-
loops: loops,
|
|
45
|
-
}
|
|
46
|
-
for (let path_item of path) {
|
|
47
|
-
if (Array.isArray(path_item)) {
|
|
48
|
-
let sub_val_from_path = get_variable_from_path(path_item)
|
|
49
|
-
combined_variables_loc = combined_variables_loc?.[sub_val_from_path]
|
|
50
|
-
} else {
|
|
51
|
-
combined_variables_loc = combined_variables_loc?.[path_item]
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return combined_variables_loc
|
|
55
|
-
}
|
|
56
|
-
return null
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function clean_variable_path(path) {
|
|
60
|
-
// eg. ['variables','dddd',['loops',0]] to ['variables','dddd',3]
|
|
61
|
-
if (Array.isArray(path)) {
|
|
62
|
-
let cleaned_path = []
|
|
63
|
-
for (let path_item of path) {
|
|
64
|
-
if (Array.isArray(path_item)) {
|
|
65
|
-
let sub_val_from_path = get_variable_from_path(path_item)
|
|
66
|
-
cleaned_path.push(sub_val_from_path)
|
|
67
|
-
} else {
|
|
68
|
-
cleaned_path.push(path_item)
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return cleaned_path
|
|
72
|
-
}
|
|
73
|
-
return null
|
|
74
|
-
}
|
|
75
|
-
|
|
76
47
|
function clean_attributes_from_variable_path(attributes) {
|
|
77
48
|
let cleaned_attributes = attributes
|
|
78
49
|
if (Object.keys(attributes || {}).length) {
|
|
79
50
|
for (let [att_key, att_val] of Object.entries(attributes)) {
|
|
80
51
|
if (att_key.endsWith("_from_variable_path") && att_val != null) {
|
|
81
|
-
const clean_path = clean_variable_path(att_val)
|
|
82
52
|
const att_key_to_set = att_key.split("_from_variable_path")?.[0]
|
|
83
|
-
cleaned_attributes[att_key_to_set] = (
|
|
53
|
+
cleaned_attributes[att_key_to_set] = get_def_from_variable_path(att_val, definition_stack)
|
|
84
54
|
}
|
|
85
55
|
}
|
|
86
56
|
}
|
|
@@ -119,12 +89,32 @@ export function create_content_manager(config) {
|
|
|
119
89
|
}
|
|
120
90
|
}
|
|
121
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)
|
|
102
|
+
cleaned_path.push(res)
|
|
103
|
+
} else {
|
|
104
|
+
cleaned_path.push(item)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return cleaned_path
|
|
109
|
+
}
|
|
110
|
+
|
|
122
111
|
async function set_variable_at_path(path, value, type) {
|
|
123
112
|
console.log("set_variable_at_path88", path, value, type)
|
|
124
113
|
if (!Array.isArray(path)) {
|
|
125
114
|
return
|
|
126
115
|
}
|
|
127
116
|
let cleaned_path = clean_variable_path(path)
|
|
117
|
+
console.log("path77", { cleaned_path, path })
|
|
128
118
|
if (typeof config?.on_event == "function") {
|
|
129
119
|
if (type == "insert") {
|
|
130
120
|
return config?.on_event({
|
|
@@ -171,11 +161,13 @@ export function create_content_manager(config) {
|
|
|
171
161
|
mapkit_js_token: mapkit_js_token,
|
|
172
162
|
table_options: config?.table_options,
|
|
173
163
|
on_search_table_row_ids: config?.on_search_table_row_ids,
|
|
164
|
+
definition_stack: definition_stack,
|
|
174
165
|
storage_path: () => storage_path,
|
|
175
166
|
is_dark_theme: () => is_dark_theme,
|
|
176
|
-
variables: () => variables,
|
|
177
|
-
loops: () => loops,
|
|
178
167
|
on_event: config?.on_event,
|
|
168
|
+
focused_selector_id: config?.focused_selector_id,
|
|
169
|
+
set_focused_selector_id: config?.set_focused_selector_id,
|
|
170
|
+
open_edit_element_attributes_popover: config?.open_edit_element_attributes_popover,
|
|
179
171
|
})
|
|
180
172
|
)
|
|
181
173
|
}
|
|
@@ -370,6 +362,7 @@ export function create_content_manager(config) {
|
|
|
370
362
|
children: [],
|
|
371
363
|
}
|
|
372
364
|
} else if (val_loc?.type_id == "color_input") {
|
|
365
|
+
console.log("color_input555", val_loc?.attributes)
|
|
373
366
|
return {
|
|
374
367
|
type_id: val_loc?.type_id,
|
|
375
368
|
selector_id: val_loc?.selector_id,
|
|
@@ -516,9 +509,8 @@ export function create_content_manager(config) {
|
|
|
516
509
|
attributes: val_loc?.attributes,
|
|
517
510
|
manager: create_table_advanced_manager({
|
|
518
511
|
...val_loc?.attributes,
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
on_event: config?.on_event, // or maybe intercept and call with adjusted params tbd
|
|
512
|
+
definition_stack: definition_stack,
|
|
513
|
+
on_event: config?.on_event,
|
|
522
514
|
// on_event: (input) => {
|
|
523
515
|
// if (input?.type == "update_row") {
|
|
524
516
|
// if (typeof input?.row_i == "number" && Array.isArray(val_loc?.attributes?.rows_data_from_variable_path)) {
|
|
@@ -593,11 +585,13 @@ export function create_content_manager(config) {
|
|
|
593
585
|
mapkit_js_token: mapkit_js_token,
|
|
594
586
|
table_options: config?.table_options,
|
|
595
587
|
on_search_table_row_ids: config?.on_search_table_row_ids,
|
|
588
|
+
definition_stack: definition_stack,
|
|
596
589
|
storage_path: () => storage_path,
|
|
597
590
|
is_dark_theme: () => is_dark_theme,
|
|
598
|
-
variables: () => variables,
|
|
599
|
-
loops: () => loops,
|
|
600
591
|
on_event: config?.on_event,
|
|
592
|
+
focused_selector_id: config?.focused_selector_id,
|
|
593
|
+
set_focused_selector_id: config?.set_focused_selector_id,
|
|
594
|
+
open_edit_element_attributes_popover: config?.open_edit_element_attributes_popover,
|
|
601
595
|
})
|
|
602
596
|
)
|
|
603
597
|
}
|
|
@@ -611,10 +605,11 @@ export function create_content_manager(config) {
|
|
|
611
605
|
}
|
|
612
606
|
} else if (val_loc?.type_id == "loop") {
|
|
613
607
|
let prepped_children = []
|
|
608
|
+
let is_children = false
|
|
614
609
|
const static_val = set_closurable(val_loc?.attributes?.val)
|
|
615
610
|
if (Array.isArray(static_val)) {
|
|
616
611
|
for (let i = 0; i < static_val.length; i++) {
|
|
617
|
-
|
|
612
|
+
console.log("loop_test", val_loc?.attributes)
|
|
618
613
|
let children = []
|
|
619
614
|
if (Array.isArray(val_loc?.children) && val_loc?.children.length > 0) {
|
|
620
615
|
is_children = true
|
|
@@ -624,11 +619,13 @@ export function create_content_manager(config) {
|
|
|
624
619
|
mapkit_js_token: mapkit_js_token,
|
|
625
620
|
table_options: config?.table_options,
|
|
626
621
|
on_search_table_row_ids: config?.on_search_table_row_ids,
|
|
622
|
+
definition_stack: [{ [val_loc?.attributes?.iter_identifier]: i }, ...definition_stack],
|
|
627
623
|
storage_path: () => storage_path,
|
|
628
624
|
is_dark_theme: () => is_dark_theme,
|
|
629
|
-
variables: () => variables,
|
|
630
|
-
loops: () => [i, ...(Array.isArray(loops) ? loops : [])],
|
|
631
625
|
on_event: config?.on_event,
|
|
626
|
+
focused_selector_id: config?.focused_selector_id,
|
|
627
|
+
set_focused_selector_id: config?.set_focused_selector_id,
|
|
628
|
+
open_edit_element_attributes_popover: config?.open_edit_element_attributes_popover,
|
|
632
629
|
})
|
|
633
630
|
children.push(child_content_manager)
|
|
634
631
|
}
|
|
@@ -640,7 +637,7 @@ export function create_content_manager(config) {
|
|
|
640
637
|
type_id: val_loc?.type_id,
|
|
641
638
|
selector_id: val_loc?.selector_id,
|
|
642
639
|
attributes: val_loc?.attributes,
|
|
643
|
-
is_children:
|
|
640
|
+
is_children: is_children,
|
|
644
641
|
children: prepped_children,
|
|
645
642
|
}
|
|
646
643
|
} else if (val_loc?.type_id == "array_uniform_input") {
|
|
@@ -659,11 +656,13 @@ export function create_content_manager(config) {
|
|
|
659
656
|
mapkit_js_token: mapkit_js_token,
|
|
660
657
|
table_options: config?.table_options,
|
|
661
658
|
on_search_table_row_ids: config?.on_search_table_row_ids,
|
|
659
|
+
definition_stack: [{ [val_loc?.attributes?.iter_identifier]: i }, ...definition_stack],
|
|
662
660
|
storage_path: () => storage_path,
|
|
663
661
|
is_dark_theme: () => is_dark_theme,
|
|
664
|
-
variables: () => variables,
|
|
665
|
-
loops: () => [i, ...(Array.isArray(loops) ? loops : [])],
|
|
666
662
|
on_event: config?.on_event,
|
|
663
|
+
focused_selector_id: config?.focused_selector_id,
|
|
664
|
+
set_focused_selector_id: config?.set_focused_selector_id,
|
|
665
|
+
open_edit_element_attributes_popover: config?.open_edit_element_attributes_popover,
|
|
667
666
|
})
|
|
668
667
|
)
|
|
669
668
|
}
|
|
@@ -721,11 +720,13 @@ export function create_content_manager(config) {
|
|
|
721
720
|
mapkit_js_token: mapkit_js_token,
|
|
722
721
|
table_options: config?.table_options,
|
|
723
722
|
on_search_table_row_ids: config?.on_search_table_row_ids,
|
|
723
|
+
definition_stack: [{ [val_loc?.attributes?.iter_identifier]: key }, ...definition_stack],
|
|
724
724
|
storage_path: () => storage_path,
|
|
725
725
|
is_dark_theme: () => is_dark_theme,
|
|
726
|
-
variables: () => variables,
|
|
727
|
-
loops: () => [key, ...(Array.isArray(loops) ? loops : [])],
|
|
728
726
|
on_event: config?.on_event,
|
|
727
|
+
focused_selector_id: config?.focused_selector_id,
|
|
728
|
+
set_focused_selector_id: config?.set_focused_selector_id,
|
|
729
|
+
open_edit_element_attributes_popover: config?.open_edit_element_attributes_popover,
|
|
729
730
|
})
|
|
730
731
|
)
|
|
731
732
|
}
|
|
@@ -882,7 +883,19 @@ export function create_content_manager(config) {
|
|
|
882
883
|
}
|
|
883
884
|
}
|
|
884
885
|
|
|
886
|
+
function open_edit_element_attributes_popover(input) {
|
|
887
|
+
if (typeof config?.open_edit_element_attributes_popover == "function") {
|
|
888
|
+
config?.open_edit_element_attributes_popover(input)
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
function set_focused_selector_id(input) {
|
|
892
|
+
if (typeof config?.set_focused_selector_id == "function") {
|
|
893
|
+
config?.set_focused_selector_id(input)
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
|
|
885
897
|
function init(config) {
|
|
898
|
+
definition_stack = config?.definition_stack ?? []
|
|
886
899
|
val_prepped = prepare_component_and_children(config?.val)
|
|
887
900
|
}
|
|
888
901
|
|
|
@@ -892,12 +905,11 @@ export function create_content_manager(config) {
|
|
|
892
905
|
get val_prepped() {
|
|
893
906
|
return val_prepped
|
|
894
907
|
},
|
|
895
|
-
get
|
|
896
|
-
return
|
|
897
|
-
},
|
|
898
|
-
get loops() {
|
|
899
|
-
return loops
|
|
908
|
+
get focused_selector_id() {
|
|
909
|
+
return config?.focused_selector_id
|
|
900
910
|
},
|
|
901
911
|
pass_event_down,
|
|
912
|
+
set_focused_selector_id,
|
|
913
|
+
open_edit_element_attributes_popover,
|
|
902
914
|
}
|
|
903
915
|
}
|
package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Dropdown/index.svelte.js
CHANGED
|
@@ -2,7 +2,6 @@ import { create_button_manager } from "$lib/Components/Button/index.svelte.js"
|
|
|
2
2
|
import { create_checkbox_manager } from "$lib/Components/Checkbox/index.svelte.js"
|
|
3
3
|
import { create_slider_manager } from "$lib/Components/Slider/index.svelte.js"
|
|
4
4
|
import { create_text_input_manager } from "$lib/Components/TextInput/index.svelte.js"
|
|
5
|
-
import { create_variable_path_input_manager } from "$lib/Components/VariablePathInput/index.svelte.js"
|
|
6
5
|
import { create_defined_type_input_manager } from "$lib/Components/ContentInput/AttributesInput/DefinedTypeInput/index.svelte.js"
|
|
7
6
|
import { deep_copy, set_closurable } from "$lib/client/index.js"
|
|
8
7
|
|
|
@@ -18,9 +17,6 @@ export function create_dropdown_config_manager(config) {
|
|
|
18
17
|
let target_height_slider_manager = $state(null)
|
|
19
18
|
let val_text_input_manager = $state(null)
|
|
20
19
|
let val_defined_type_input_manager = $state(null)
|
|
21
|
-
|
|
22
|
-
let variables_data_type = $derived(set_closurable(config?.variables_data_type, false))
|
|
23
|
-
|
|
24
20
|
let options = $state([])
|
|
25
21
|
let options_prepped = $state([])
|
|
26
22
|
let key_to_add_text_input_manager = $state(null)
|
|
@@ -55,7 +51,7 @@ export function create_dropdown_config_manager(config) {
|
|
|
55
51
|
val: config?.val?.val ?? null,
|
|
56
52
|
})
|
|
57
53
|
val_defined_type_input_manager = create_defined_type_input_manager({
|
|
58
|
-
|
|
54
|
+
get_defined_options: config?.get_defined_options,
|
|
59
55
|
label: "Val",
|
|
60
56
|
attribute_root_key: "val",
|
|
61
57
|
attribute_const_val: () => val_text_input_manager?.val,
|
|
@@ -28,7 +28,6 @@ export function create_number_config_manager(config) {
|
|
|
28
28
|
let round_text_input_manager = $state(null)
|
|
29
29
|
let progress_bar_start_text_input_manager = $state(null)
|
|
30
30
|
let progress_bar_end_text_input_manager = $state(null)
|
|
31
|
-
let variables_data_type = $derived(set_closurable(config?.variables_data_type, null))
|
|
32
31
|
|
|
33
32
|
const number_base = {
|
|
34
33
|
val_from_variable_path: null,
|
|
@@ -115,9 +114,9 @@ export function create_number_config_manager(config) {
|
|
|
115
114
|
val: val_loc?.val,
|
|
116
115
|
})
|
|
117
116
|
val_defined_type_input_manager = create_defined_type_input_manager({
|
|
118
|
-
variables_data_type: () => variables_data_type,
|
|
119
117
|
label: "Val",
|
|
120
118
|
attribute_root_key: "val",
|
|
119
|
+
get_defined_options: config?.get_defined_options,
|
|
121
120
|
attribute_const_val: () => val_text_input_manager?.val,
|
|
122
121
|
attributes: config?.val,
|
|
123
122
|
})
|