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/src/lib/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/src/lib/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"
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import
|
|
2
|
+
import Content from "$lib/Components/Content/index.svelte"
|
|
3
3
|
import { create_content_manager } from "$lib/Components/Content/index.svelte.js"
|
|
4
4
|
import { PUBLIC_APPLE_MAPKIT_JS_API_KEY } from "$env/static/public"
|
|
5
|
+
import { deep_copy, set_definition_stack } from "$lib/client/index.js"
|
|
5
6
|
|
|
6
7
|
const val = {
|
|
7
8
|
type_id: "div",
|
|
@@ -37,108 +38,73 @@
|
|
|
37
38
|
attributes: {},
|
|
38
39
|
},
|
|
39
40
|
{
|
|
40
|
-
type_id: "
|
|
41
|
-
selector_id: "
|
|
41
|
+
type_id: "checkbox",
|
|
42
|
+
selector_id: "kdotcril",
|
|
43
|
+
children: [],
|
|
44
|
+
attributes: { val_from_variable_path: ["variables", "cccc"], type: "checkbox", size: null, color: null },
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type_id: "loop",
|
|
48
|
+
selector_id: "bwrgl",
|
|
42
49
|
children: [
|
|
43
50
|
{
|
|
44
|
-
type_id: "
|
|
45
|
-
selector_id: "
|
|
51
|
+
type_id: "h5",
|
|
52
|
+
selector_id: "clrzp",
|
|
46
53
|
children: [
|
|
47
54
|
{
|
|
48
|
-
type_id: "
|
|
49
|
-
selector_id: "
|
|
50
|
-
children: [
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
{
|
|
56
|
-
type_id: "base_text",
|
|
57
|
-
selector_id: "base_text_jbdbr",
|
|
58
|
-
children: [],
|
|
59
|
-
attributes: { content: "You can make tables" },
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
attributes: {},
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
type_id: "td",
|
|
66
|
-
selector_id: "td_kcizj",
|
|
67
|
-
children: [
|
|
68
|
-
{
|
|
69
|
-
type_id: "base_text",
|
|
70
|
-
selector_id: "base_text_wyfea",
|
|
71
|
-
children: [],
|
|
72
|
-
attributes: { content: "yes indeed" },
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
attributes: {},
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
attributes: {},
|
|
55
|
+
type_id: "base_text",
|
|
56
|
+
selector_id: "zsaou",
|
|
57
|
+
children: [],
|
|
58
|
+
attributes: {
|
|
59
|
+
content_from_variable_path: ["variables", "stuff", ["booly_i"]],
|
|
60
|
+
text_color: { l: 15, c: 13, h: 6, o: 24, is_dark_theme_invert: true },
|
|
61
|
+
},
|
|
79
62
|
},
|
|
80
63
|
],
|
|
81
64
|
attributes: {},
|
|
82
65
|
},
|
|
83
66
|
{
|
|
84
|
-
type_id: "
|
|
85
|
-
selector_id: "
|
|
86
|
-
children: [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
children: [
|
|
95
|
-
{
|
|
96
|
-
type_id: "base_text",
|
|
97
|
-
selector_id: "base_text_jbxot",
|
|
98
|
-
children: [],
|
|
99
|
-
attributes: { content: "and other stuff" },
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
attributes: {},
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
type_id: "td",
|
|
106
|
-
selector_id: "td_egqxj",
|
|
107
|
-
children: [
|
|
108
|
-
{
|
|
109
|
-
type_id: "base_text",
|
|
110
|
-
selector_id: "base_text_urtfy",
|
|
111
|
-
children: [],
|
|
112
|
-
attributes: { content: "certainly" },
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
attributes: {},
|
|
116
|
-
},
|
|
117
|
-
],
|
|
118
|
-
attributes: {},
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
attributes: {},
|
|
67
|
+
type_id: "checkbox",
|
|
68
|
+
selector_id: "lqvon",
|
|
69
|
+
children: [],
|
|
70
|
+
attributes: {
|
|
71
|
+
val_from_variable_path: ["variables", "stuff", ["booly_i"]],
|
|
72
|
+
size: 2.4,
|
|
73
|
+
type: "checkbox",
|
|
74
|
+
label: null,
|
|
75
|
+
name: null,
|
|
76
|
+
},
|
|
122
77
|
},
|
|
123
78
|
],
|
|
124
|
-
attributes: {
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
type_id: "code",
|
|
128
|
-
selector_id: "code_mhlkk",
|
|
129
|
-
children: [],
|
|
130
|
-
attributes: { content: "Code blocks and more222", language: null },
|
|
79
|
+
attributes: { iter_identifier: "booly_i", val_from_variable_path: ["variables", "stuff"], join_text: null },
|
|
131
80
|
},
|
|
132
81
|
],
|
|
133
82
|
attributes: {},
|
|
134
83
|
}
|
|
135
84
|
|
|
136
|
-
let
|
|
85
|
+
let variables = $state({
|
|
86
|
+
cccc: false,
|
|
87
|
+
stuff: [false, true, false],
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
let content_manager = create_content_manager({
|
|
91
|
+
val,
|
|
92
|
+
definition_stack: [{ variables }],
|
|
93
|
+
// on_event: (input) => console.log("on_event", input),
|
|
94
|
+
on_event: (input) => {
|
|
95
|
+
console.log("on_event00", input)
|
|
96
|
+
const res = set_definition_stack(input, [{ variables: variables }], content_manager.pass_event_down)
|
|
97
|
+
variables = res?.definition_stack?.[0]?.variables
|
|
98
|
+
console.log("on_event01", res?.definition_stack)
|
|
99
|
+
return res
|
|
100
|
+
},
|
|
101
|
+
})
|
|
137
102
|
</script>
|
|
138
103
|
|
|
104
|
+
<pre>{JSON.stringify(variables, null, 2)}</pre>
|
|
139
105
|
<div>
|
|
140
106
|
<div style="max-width: 65rem; margin: auto;">
|
|
141
107
|
<h4>Example</h4>
|
|
142
|
-
<
|
|
108
|
+
<Content manager={content_manager} />
|
|
143
109
|
</div>
|
|
144
110
|
</div>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { create_json_manager } from "$lib/Components/Json/index.svelte.js"
|
|
8
8
|
import DataTypeInput from "$lib/Components/DataTypeInput/index.svelte"
|
|
9
9
|
// import { create_data_type_input_manager } from "$lib/Components/DataTypeInput/index.svelte.js"
|
|
10
|
-
import { deep_copy,
|
|
10
|
+
import { deep_copy, set_definition_stack } from "$lib/client/index.js"
|
|
11
11
|
import { PUBLIC_APPLE_MAPKIT_JS_API_KEY } from "$env/static/public"
|
|
12
12
|
|
|
13
13
|
const content_variables_initial = {
|
|
@@ -258,7 +258,7 @@
|
|
|
258
258
|
selector_id: "zsaou",
|
|
259
259
|
children: [],
|
|
260
260
|
attributes: {
|
|
261
|
-
content_from_variable_path: ["variables", "dddd", ["
|
|
261
|
+
content_from_variable_path: ["variables", "dddd", ["booly_i"]],
|
|
262
262
|
text_color: { l: 15, c: 13, h: 6, o: 24, is_dark_theme_invert: true },
|
|
263
263
|
},
|
|
264
264
|
},
|
|
@@ -270,15 +270,14 @@
|
|
|
270
270
|
selector_id: "lqvon",
|
|
271
271
|
children: [],
|
|
272
272
|
attributes: {
|
|
273
|
-
val_from_variable_path: ["variables", "dddd", ["
|
|
274
|
-
size: 2.4,
|
|
273
|
+
val_from_variable_path: ["variables", "dddd", ["booly_i"]],
|
|
275
274
|
type: "checkbox",
|
|
276
|
-
|
|
277
|
-
|
|
275
|
+
size: 2.4,
|
|
276
|
+
color: null,
|
|
278
277
|
},
|
|
279
278
|
},
|
|
280
279
|
],
|
|
281
|
-
attributes: { val_from_variable_path: ["variables", "dddd"] },
|
|
280
|
+
attributes: { iter_identifier: "booly_i", val_from_variable_path: ["variables", "dddd"], join_text: null },
|
|
282
281
|
},
|
|
283
282
|
{
|
|
284
283
|
type_id: "show_conditions",
|
|
@@ -330,17 +329,16 @@
|
|
|
330
329
|
// storage: account_storage,
|
|
331
330
|
storage_default_folder_path: ["pages"],
|
|
332
331
|
mapkit_js_token: PUBLIC_APPLE_MAPKIT_JS_API_KEY,
|
|
333
|
-
|
|
334
|
-
variables: () => variables_json_manager?.val,
|
|
332
|
+
definition_stack: [{ variables: variables_json_manager?.val }],
|
|
335
333
|
on_event: (input) => {
|
|
336
334
|
console.log("on_event00", input)
|
|
337
|
-
const res =
|
|
335
|
+
const res = set_definition_stack(
|
|
338
336
|
input,
|
|
339
|
-
{ variables: variables_json_manager?.val },
|
|
337
|
+
[{ variables: variables_json_manager?.val }],
|
|
340
338
|
content_input_manager.pass_event_down
|
|
341
339
|
)
|
|
342
|
-
variables_json_manager.set_val(res?.
|
|
343
|
-
console.log("on_event01", res?.
|
|
340
|
+
variables_json_manager.set_val(res?.definition_stack)
|
|
341
|
+
console.log("on_event01", res?.definition_stack)
|
|
344
342
|
return res
|
|
345
343
|
},
|
|
346
344
|
})
|