@turnipxenon/pineapple 2.4.51 → 2.4.53
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/.idea/workspace.xml +27 -24
- package/.svelte-kit/__package__/components/combo_box/ComboBox.svelte +7 -7
- package/.svelte-kit/__package__/components/combo_box/ComboBoxWithButton.svelte +7 -7
- package/.svelte-kit/__package__/components/combo_box/combo-box.postcss +22 -22
- package/.svelte-kit/__package__/template/seaweed/SeaweedTemplate.svelte +8 -2
- package/.svelte-kit/__package__/template/seaweed/entry_order_config/EntryOrderConfig.svelte +117 -117
- package/.svelte-kit/generated/server/internal.js +1 -1
- package/dist/components/combo_box/ComboBox.svelte +7 -7
- package/dist/components/combo_box/ComboBoxWithButton.svelte +7 -7
- package/dist/components/combo_box/combo-box.postcss +22 -22
- package/dist/template/seaweed/SeaweedTemplate.svelte +8 -2
- package/dist/template/seaweed/entry_order_config/EntryOrderConfig.svelte +117 -117
- package/package.json +1 -1
- package/src/lib/components/combo_box/ComboBox.svelte +13 -13
- package/src/lib/components/combo_box/ComboBoxWithButton.svelte +18 -18
- package/src/lib/components/combo_box/combo-box.postcss +22 -22
- package/src/lib/template/seaweed/RunChaos.ts +44 -44
- package/src/lib/template/seaweed/SeaweedTemplate.svelte +9 -2
- package/src/lib/template/seaweed/entry_order_config/EntryOrderConfig.svelte +166 -166
- package/src/lib/template/seaweed/entry_order_config/EntryOrderConfig.ts +6 -6
|
@@ -1,166 +1,166 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
type EntryGroup,
|
|
4
|
-
GetAllEntryFromGlobal,
|
|
5
|
-
GetEntryFromGlobal,
|
|
6
|
-
type SeaweedTemplateData,
|
|
7
|
-
seaweedTemplateData
|
|
8
|
-
} from "$pkg/template/seaweed/SeaweedTemplateData";
|
|
9
|
-
import type { ComponentType } from "svelte";
|
|
10
|
-
import { removeProxyWrapperOnString } from "./EntryOrderConfig";
|
|
11
|
-
import ComboBoxWithButton from "$pkg/components/combo_box/ComboBoxWithButton.svelte";
|
|
12
|
-
|
|
13
|
-
export let seaweedEntries: EntryGroup[];
|
|
14
|
-
export let orderUrl: string;
|
|
15
|
-
export let updateUrl: (data: SeaweedTemplateData) => void;
|
|
16
|
-
|
|
17
|
-
const updateOrderQuery = () => {
|
|
18
|
-
orderUrl = "order=" + seaweedEntries.map(g => {
|
|
19
|
-
const groupUrl = g.items.map(
|
|
20
|
-
e => removeProxyWrapperOnString(e.name)
|
|
21
|
-
).join("|");
|
|
22
|
-
return `${g.name}:${groupUrl}:${g.gridClass}`;
|
|
23
|
-
}).join(",");
|
|
24
|
-
updateUrl(seaweedTemplateData);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const addEntry = (group: EntryGroup): ((selected: string) => void) => {
|
|
28
|
-
return (selected: string) => {
|
|
29
|
-
const c = GetEntryFromGlobal(selected);
|
|
30
|
-
console.log(selected, c);
|
|
31
|
-
if (c) {
|
|
32
|
-
group.items.push(c);
|
|
33
|
-
seaweedEntries = seaweedEntries;
|
|
34
|
-
updateOrderQuery();
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
const swapEntry = (index: number, group: EntryGroup, shouldDecrement: boolean): (() => void) => {
|
|
39
|
-
return () => {
|
|
40
|
-
let newIndex = index;
|
|
41
|
-
if (shouldDecrement && index >= 1) {
|
|
42
|
-
newIndex--;
|
|
43
|
-
} else if (!shouldDecrement && index <= group.items.length - 2) {
|
|
44
|
-
newIndex++;
|
|
45
|
-
} else {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
console.log(index, newIndex);
|
|
49
|
-
|
|
50
|
-
const tempVar = group.items[newIndex];
|
|
51
|
-
group.items[newIndex] = group.items[index];
|
|
52
|
-
group.items[index] = tempVar;
|
|
53
|
-
seaweedEntries = seaweedEntries;
|
|
54
|
-
updateOrderQuery();
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
const swapGroups = (index: number, shouldDecrement: boolean): (() => void) => {
|
|
58
|
-
return () => {
|
|
59
|
-
let newIndex = index;
|
|
60
|
-
if (shouldDecrement && index >= 1) {
|
|
61
|
-
newIndex--;
|
|
62
|
-
} else if (!shouldDecrement && index <= seaweedEntries.length - 2) {
|
|
63
|
-
newIndex++;
|
|
64
|
-
} else {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const tempVar = seaweedEntries[newIndex];
|
|
69
|
-
seaweedEntries[newIndex] = seaweedEntries[index];
|
|
70
|
-
seaweedEntries[index] = tempVar;
|
|
71
|
-
seaweedEntries = seaweedEntries;
|
|
72
|
-
updateOrderQuery();
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
// todo: add group; we might not need it now
|
|
77
|
-
// const addGroup = (group: EntryGroup): (() => void) => {
|
|
78
|
-
// return () => {
|
|
79
|
-
// seaweedEntries.push({
|
|
80
|
-
// name: "",
|
|
81
|
-
// items: [],
|
|
82
|
-
// gridClass: GroupGridClass.Projects.toString()
|
|
83
|
-
// });
|
|
84
|
-
// updateOrderQuery();
|
|
85
|
-
// };
|
|
86
|
-
// };
|
|
87
|
-
|
|
88
|
-
const removeGroup = (group: EntryGroup): (() => void) => {
|
|
89
|
-
return () => {
|
|
90
|
-
const index = seaweedEntries.indexOf(group);
|
|
91
|
-
if (index === -1) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
seaweedEntries.splice(index, 1);
|
|
96
|
-
seaweedEntries = seaweedEntries;
|
|
97
|
-
updateOrderQuery();
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
const removeEntry = (entry: ComponentType, group: EntryGroup): (() => void) => {
|
|
101
|
-
return () => {
|
|
102
|
-
console.log("Clicked!");
|
|
103
|
-
for (let i = group.items.length - 1; i >= 0; i--) {
|
|
104
|
-
if (group.items[i].name === entry.name) {
|
|
105
|
-
console.log("Reduce");
|
|
106
|
-
group.items.splice(i, 1);
|
|
107
|
-
seaweedEntries = seaweedEntries;
|
|
108
|
-
updateOrderQuery();
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const allDefaultEntries = Array.from(GetAllEntryFromGlobal().keys());
|
|
116
|
-
console.log("Test", Array.from(GetAllEntryFromGlobal().keys()));
|
|
117
|
-
</script>
|
|
118
|
-
|
|
119
|
-
<h3>Site ordering</h3>
|
|
120
|
-
<blockquote>Sorry! This part of the website is still WIP, but here it is anyway. As long as it functions</blockquote>
|
|
121
|
-
|
|
122
|
-
<!-- formatting: group1:entry1|entry2,group2:entry3
|
|
123
|
-
: <= separates the group header, the entries, and the class
|
|
124
|
-
| <= separates each entries
|
|
125
|
-
, <= separates each group
|
|
126
|
-
-->
|
|
127
|
-
<div class="advanced-setting-list">
|
|
128
|
-
<!-- todo: we might have to extract this into it's own component -->
|
|
129
|
-
<!-- todo: NOW!!! -->
|
|
130
|
-
{#each seaweedEntries as group, groupIndex}
|
|
131
|
-
<div>
|
|
132
|
-
<div>
|
|
133
|
-
<button class="editable-button" on:click={removeGroup(group)}>X</button>
|
|
134
|
-
<!-- todo: move group up or down -->
|
|
135
|
-
<button class="editable-button" on:click={swapGroups(groupIndex, true)}>^</button>
|
|
136
|
-
<button class="editable-button" on:click={swapGroups(groupIndex, false)}>v</button>
|
|
137
|
-
{group.name}
|
|
138
|
-
</div>
|
|
139
|
-
<div class="advanced-setting-list card">
|
|
140
|
-
{#each group.items as entry, entryIndex}
|
|
141
|
-
<div class="editable-entry">
|
|
142
|
-
<button on:click={removeEntry(entry, group)}>-</button>
|
|
143
|
-
<button on:click={swapEntry(entryIndex, group, true)}>^</button>
|
|
144
|
-
<button on:click={swapEntry(entryIndex, group, false)}>v</button>
|
|
145
|
-
{entry.name}
|
|
146
|
-
</div>
|
|
147
|
-
{/each}
|
|
148
|
-
</div>
|
|
149
|
-
|
|
150
|
-
<ComboBoxWithButton stringItems={allDefaultEntries}
|
|
151
|
-
onClick={addEntry(group)}></ComboBoxWithButton>
|
|
152
|
-
|
|
153
|
-
</div>
|
|
154
|
-
{/each}
|
|
155
|
-
</div>
|
|
156
|
-
|
|
157
|
-
<style lang="postcss">
|
|
158
|
-
.advanced-setting-list {
|
|
159
|
-
display: flex;
|
|
160
|
-
flex-direction: column;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.editable-entry > button, .editable-button {
|
|
164
|
-
@apply btn variant-filled-primary;
|
|
165
|
-
}
|
|
166
|
-
</style>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
type EntryGroup,
|
|
4
|
+
GetAllEntryFromGlobal,
|
|
5
|
+
GetEntryFromGlobal,
|
|
6
|
+
type SeaweedTemplateData,
|
|
7
|
+
seaweedTemplateData
|
|
8
|
+
} from "$pkg/template/seaweed/SeaweedTemplateData";
|
|
9
|
+
import type { ComponentType } from "svelte";
|
|
10
|
+
import { removeProxyWrapperOnString } from "./EntryOrderConfig";
|
|
11
|
+
import ComboBoxWithButton from "$pkg/components/combo_box/ComboBoxWithButton.svelte";
|
|
12
|
+
|
|
13
|
+
export let seaweedEntries: EntryGroup[];
|
|
14
|
+
export let orderUrl: string;
|
|
15
|
+
export let updateUrl: (data: SeaweedTemplateData) => void;
|
|
16
|
+
|
|
17
|
+
const updateOrderQuery = () => {
|
|
18
|
+
orderUrl = "order=" + seaweedEntries.map(g => {
|
|
19
|
+
const groupUrl = g.items.map(
|
|
20
|
+
e => removeProxyWrapperOnString(e.name)
|
|
21
|
+
).join("|");
|
|
22
|
+
return `${g.name}:${groupUrl}:${g.gridClass}`;
|
|
23
|
+
}).join(",");
|
|
24
|
+
updateUrl(seaweedTemplateData);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const addEntry = (group: EntryGroup): ((selected: string) => void) => {
|
|
28
|
+
return (selected: string) => {
|
|
29
|
+
const c = GetEntryFromGlobal(selected);
|
|
30
|
+
console.log(selected, c);
|
|
31
|
+
if (c) {
|
|
32
|
+
group.items.push(c);
|
|
33
|
+
seaweedEntries = seaweedEntries;
|
|
34
|
+
updateOrderQuery();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
const swapEntry = (index: number, group: EntryGroup, shouldDecrement: boolean): (() => void) => {
|
|
39
|
+
return () => {
|
|
40
|
+
let newIndex = index;
|
|
41
|
+
if (shouldDecrement && index >= 1) {
|
|
42
|
+
newIndex--;
|
|
43
|
+
} else if (!shouldDecrement && index <= group.items.length - 2) {
|
|
44
|
+
newIndex++;
|
|
45
|
+
} else {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
console.log(index, newIndex);
|
|
49
|
+
|
|
50
|
+
const tempVar = group.items[newIndex];
|
|
51
|
+
group.items[newIndex] = group.items[index];
|
|
52
|
+
group.items[index] = tempVar;
|
|
53
|
+
seaweedEntries = seaweedEntries;
|
|
54
|
+
updateOrderQuery();
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
const swapGroups = (index: number, shouldDecrement: boolean): (() => void) => {
|
|
58
|
+
return () => {
|
|
59
|
+
let newIndex = index;
|
|
60
|
+
if (shouldDecrement && index >= 1) {
|
|
61
|
+
newIndex--;
|
|
62
|
+
} else if (!shouldDecrement && index <= seaweedEntries.length - 2) {
|
|
63
|
+
newIndex++;
|
|
64
|
+
} else {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const tempVar = seaweedEntries[newIndex];
|
|
69
|
+
seaweedEntries[newIndex] = seaweedEntries[index];
|
|
70
|
+
seaweedEntries[index] = tempVar;
|
|
71
|
+
seaweedEntries = seaweedEntries;
|
|
72
|
+
updateOrderQuery();
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// todo: add group; we might not need it now
|
|
77
|
+
// const addGroup = (group: EntryGroup): (() => void) => {
|
|
78
|
+
// return () => {
|
|
79
|
+
// seaweedEntries.push({
|
|
80
|
+
// name: "",
|
|
81
|
+
// items: [],
|
|
82
|
+
// gridClass: GroupGridClass.Projects.toString()
|
|
83
|
+
// });
|
|
84
|
+
// updateOrderQuery();
|
|
85
|
+
// };
|
|
86
|
+
// };
|
|
87
|
+
|
|
88
|
+
const removeGroup = (group: EntryGroup): (() => void) => {
|
|
89
|
+
return () => {
|
|
90
|
+
const index = seaweedEntries.indexOf(group);
|
|
91
|
+
if (index === -1) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
seaweedEntries.splice(index, 1);
|
|
96
|
+
seaweedEntries = seaweedEntries;
|
|
97
|
+
updateOrderQuery();
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
const removeEntry = (entry: ComponentType, group: EntryGroup): (() => void) => {
|
|
101
|
+
return () => {
|
|
102
|
+
console.log("Clicked!");
|
|
103
|
+
for (let i = group.items.length - 1; i >= 0; i--) {
|
|
104
|
+
if (group.items[i].name === entry.name) {
|
|
105
|
+
console.log("Reduce");
|
|
106
|
+
group.items.splice(i, 1);
|
|
107
|
+
seaweedEntries = seaweedEntries;
|
|
108
|
+
updateOrderQuery();
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const allDefaultEntries = Array.from(GetAllEntryFromGlobal().keys());
|
|
116
|
+
console.log("Test", Array.from(GetAllEntryFromGlobal().keys()));
|
|
117
|
+
</script>
|
|
118
|
+
|
|
119
|
+
<h3>Site ordering</h3>
|
|
120
|
+
<blockquote>Sorry! This part of the website is still WIP, but here it is anyway. As long as it functions</blockquote>
|
|
121
|
+
|
|
122
|
+
<!-- formatting: group1:entry1|entry2,group2:entry3
|
|
123
|
+
: <= separates the group header, the entries, and the class
|
|
124
|
+
| <= separates each entries
|
|
125
|
+
, <= separates each group
|
|
126
|
+
-->
|
|
127
|
+
<div class="advanced-setting-list">
|
|
128
|
+
<!-- todo: we might have to extract this into it's own component -->
|
|
129
|
+
<!-- todo: NOW!!! -->
|
|
130
|
+
{#each seaweedEntries as group, groupIndex}
|
|
131
|
+
<div>
|
|
132
|
+
<div>
|
|
133
|
+
<button class="editable-button" on:click={removeGroup(group)}>X</button>
|
|
134
|
+
<!-- todo: move group up or down -->
|
|
135
|
+
<button class="editable-button" on:click={swapGroups(groupIndex, true)}>^</button>
|
|
136
|
+
<button class="editable-button" on:click={swapGroups(groupIndex, false)}>v</button>
|
|
137
|
+
{group.name}
|
|
138
|
+
</div>
|
|
139
|
+
<div class="advanced-setting-list card">
|
|
140
|
+
{#each group.items as entry, entryIndex}
|
|
141
|
+
<div class="editable-entry">
|
|
142
|
+
<button on:click={removeEntry(entry, group)}>-</button>
|
|
143
|
+
<button on:click={swapEntry(entryIndex, group, true)}>^</button>
|
|
144
|
+
<button on:click={swapEntry(entryIndex, group, false)}>v</button>
|
|
145
|
+
{entry.name}
|
|
146
|
+
</div>
|
|
147
|
+
{/each}
|
|
148
|
+
</div>
|
|
149
|
+
|
|
150
|
+
<ComboBoxWithButton stringItems={allDefaultEntries}
|
|
151
|
+
onClick={addEntry(group)}></ComboBoxWithButton>
|
|
152
|
+
|
|
153
|
+
</div>
|
|
154
|
+
{/each}
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
<style lang="postcss">
|
|
158
|
+
.advanced-setting-list {
|
|
159
|
+
display: flex;
|
|
160
|
+
flex-direction: column;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.editable-entry > button, .editable-button {
|
|
164
|
+
@apply btn variant-filled-primary;
|
|
165
|
+
}
|
|
166
|
+
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export const removeProxyWrapperOnString = (wrapped: string): string => {
|
|
2
|
-
if (!wrapped.includes("Proxy")) {
|
|
3
|
-
return wrapped;
|
|
4
|
-
} else {
|
|
5
|
-
return wrapped.slice("Proxy<".length, wrapped.length - 1);
|
|
6
|
-
}
|
|
1
|
+
export const removeProxyWrapperOnString = (wrapped: string): string => {
|
|
2
|
+
if (!wrapped.includes("Proxy")) {
|
|
3
|
+
return wrapped;
|
|
4
|
+
} else {
|
|
5
|
+
return wrapped.slice("Proxy<".length, wrapped.length - 1);
|
|
6
|
+
}
|
|
7
7
|
};
|