@turnipxenon/pineapple 3.0.0-alpha.9 → 3.1.0-alpha.1
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/blog_template/BlogTemplate.svelte +2 -2
- package/dist/components/blog_template/BlogTemplate.svelte.d.ts +1 -1
- package/dist/components/blog_template/BlogTemplateInner.svelte +1 -1
- package/dist/components/blog_template/BlogTemplateInner.svelte.d.ts +1 -1
- package/dist/components/dialog_manager/DialogManager.d.ts +2 -1
- package/dist/components/dialog_manager/DialogMangerInit.d.ts +2 -15
- package/dist/components/dialog_manager/DialogMangerInit.js +8 -2
- package/dist/components/dialog_manager/IDialogManager.d.ts +39 -0
- package/dist/components/dialog_manager/IDialogManager.js +4 -0
- package/dist/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.d.ts +3 -0
- package/dist/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.js +15 -3
- package/dist/components/dialog_overlay/DialogOverlay.svelte +155 -36
- package/dist/components/layouts/SeaweedBaseLayout.svelte +0 -6
- package/dist/components/pineapple/PineappleBaseLayout.svelte +2 -21
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -3
- package/dist/styles/app.css +9 -14
- package/dist/ui/components/ModalBase.svelte +74 -74
- package/dist/ui/components/SocialSection.svelte +6 -2
- package/dist/ui/components/accordion/PinyaAccordion.svelte +20 -20
- package/dist/ui/components/accordion/PinyaAccordionItem.svelte +28 -28
- package/dist/ui/elements/CodeBlock/CodeBlock.svelte +64 -64
- package/dist/ui/elements/ImageIcon.svelte +53 -53
- package/dist/ui/elements/{pinya-button/component.svelte → PinyaButton/PinyaButton.svelte} +4 -3
- package/dist/ui/elements/PinyaButton/PinyaButton.svelte.d.ts +4 -0
- package/dist/ui/elements/{pinya-button/props.d.ts → PinyaButton/PinyaButtonProps.d.ts} +1 -0
- package/dist/ui/elements/PinyaButton/index.d.ts +2 -0
- package/dist/ui/elements/PinyaButton/index.js +2 -0
- package/dist/ui/elements/{pinya-card/component.svelte → PinyaCard/PinyaCard.svelte} +21 -20
- package/dist/ui/elements/PinyaCard/PinyaCard.svelte.d.ts +7 -0
- package/dist/ui/elements/PinyaCard/index.d.ts +2 -0
- package/dist/ui/elements/PinyaCard/index.js +2 -0
- package/dist/ui/elements/Placeholder.svelte +17 -17
- package/dist/ui/elements/TextLink.svelte +16 -16
- package/dist/ui/elements/index.d.ts +2 -2
- package/dist/ui/elements/index.js +2 -2
- package/dist/ui/elements/pinya-combobox/PinyaCombobox.svelte +34 -34
- package/dist/ui/elements/pinya-combobox/PinyaComboboxProps.d.ts +1 -0
- package/dist/ui/elements/text-chip/TextChip.svelte +14 -14
- package/dist/{components/navigation_component → ui/modules/NavigationMenu}/NavigationControl.svelte +24 -20
- package/dist/{components/navigation_component/NavigationComponent.svelte → ui/modules/NavigationMenu/NavigationMenu.svelte} +69 -43
- package/dist/{components/navigation_component/NavigationComponent.svelte.d.ts → ui/modules/NavigationMenu/NavigationMenu.svelte.d.ts} +6 -6
- package/dist/{components/navigation_component → ui/modules/NavigationMenu}/PageMeta.d.ts +4 -4
- package/dist/ui/modules/NavigationMenu/index.d.ts +2 -0
- package/dist/ui/modules/NavigationMenu/index.js +2 -0
- package/dist/ui/modules/index.d.ts +1 -1
- package/dist/ui/modules/index.js +1 -1
- package/dist/ui/modules/modals/general-settings/GeneralSettingsModal.svelte +109 -109
- package/dist/ui/modules/modals/general-settings/LanguagePicker.svelte +42 -37
- package/dist/ui/modules/projects/Hepcat.svelte +6 -4
- package/dist/ui/modules/projects/Hepcat.svelte.d.ts +1 -1
- package/dist/ui/modules/projects/Pengi.svelte +61 -59
- package/dist/ui/modules/projects/Pengi.svelte.d.ts +1 -1
- package/dist/ui/modules/projects/Soulwork.svelte +7 -5
- package/dist/ui/modules/projects/ThisWebpage.svelte +19 -16
- package/dist/ui/modules/projects/ThisWebpage.svelte.d.ts +1 -1
- package/dist/ui/templates/{pinya-page-layout/component.svelte → PinyaPageLayout/PinyaPageLayout.svelte} +1 -1
- package/dist/ui/templates/PinyaPageLayout/PinyaPageLayout.svelte.d.ts +9 -0
- package/dist/ui/templates/PinyaPageLayout/index.d.ts +2 -0
- package/dist/ui/templates/PinyaPageLayout/index.js +2 -0
- package/dist/ui/templates/{pinya-page-layout → PinyaPageLayout}/runes.svelte.d.ts +3 -0
- package/dist/ui/templates/PinyaPageLayout/runes.svelte.js +4 -0
- package/dist/ui/{modules/seaweed → templates/SeaweedLayout}/ChumBucket.svelte +1 -1
- package/dist/{template/seaweed → ui/templates/SeaweedLayout}/CreateUrlForm.svelte +2 -2
- package/dist/ui/templates/{seaweed-layout → SeaweedLayout}/EntryGroup.svelte +65 -88
- package/dist/ui/templates/SeaweedLayout/EntryOrderConfig.svelte.d.ts +9 -0
- package/dist/ui/templates/{seaweed-layout → SeaweedLayout}/ProjectComponentProps.d.ts +1 -0
- package/dist/ui/templates/{seaweed-layout → SeaweedLayout}/ProjectGroupConfig.svelte +316 -316
- package/dist/ui/templates/{seaweed-layout → SeaweedLayout}/ProjectGroupConfig.svelte.d.ts +1 -1
- package/dist/ui/templates/{seaweed-layout → SeaweedLayout}/SeaweedLayout.md +3 -3
- package/dist/ui/templates/{seaweed-layout → SeaweedLayout}/SeaweedLayout.svelte +278 -276
- package/dist/ui/templates/{seaweed-layout → SeaweedLayout}/props.d.ts +2 -2
- package/dist/ui/templates/confirmation-modal/component.svelte +46 -46
- package/dist/ui/templates/index.d.ts +2 -2
- package/dist/ui/templates/index.js +2 -2
- package/package.json +3 -2
- package/src/lib/styles/app.css +9 -14
- package/dist/components/navigation_component/index.d.ts +0 -2
- package/dist/components/navigation_component/index.js +0 -3
- package/dist/template/seaweed/ParseQueryTerms.d.ts +0 -1
- package/dist/template/seaweed/ParseQueryTerms.js +0 -23
- package/dist/template/seaweed/RunChaos.d.ts +0 -1
- package/dist/template/seaweed/RunChaos.js +0 -41
- package/dist/template/seaweed/SeaweedTemplate.svelte +0 -336
- package/dist/template/seaweed/SeaweedTemplate.svelte.d.ts +0 -32
- package/dist/template/seaweed/SeaweedTemplateData.d.ts +0 -30
- package/dist/template/seaweed/SeaweedTemplateData.js +0 -79
- package/dist/template/seaweed/entries/ChefWings.svelte +0 -45
- package/dist/template/seaweed/entries/ChefWings.svelte.d.ts +0 -7
- package/dist/template/seaweed/entries/CustomizedYarnspinner.svelte +0 -40
- package/dist/template/seaweed/entries/CustomizedYarnspinner.svelte.d.ts +0 -7
- package/dist/template/seaweed/entries/EntryProps.d.ts +0 -16
- package/dist/template/seaweed/entries/EntryProps.js +0 -5
- package/dist/template/seaweed/entries/Hepcat.svelte +0 -64
- package/dist/template/seaweed/entries/Hepcat.svelte.d.ts +0 -7
- package/dist/template/seaweed/entries/Pengi.svelte +0 -57
- package/dist/template/seaweed/entries/Pengi.svelte.d.ts +0 -7
- package/dist/template/seaweed/entries/Soulwork.svelte +0 -54
- package/dist/template/seaweed/entries/Soulwork.svelte.d.ts +0 -7
- package/dist/template/seaweed/entries/ThisWebpage.svelte +0 -55
- package/dist/template/seaweed/entries/ThisWebpage.svelte.d.ts +0 -7
- package/dist/template/seaweed/entries/WorkExperience.svelte +0 -130
- package/dist/template/seaweed/entries/WorkExperience.svelte.d.ts +0 -8
- package/dist/template/seaweed/entries/Workset.svelte +0 -57
- package/dist/template/seaweed/entries/Workset.svelte.d.ts +0 -7
- package/dist/template/seaweed/entry_order_config/EntryOrderConfig.d.ts +0 -1
- package/dist/template/seaweed/entry_order_config/EntryOrderConfig.js +0 -8
- package/dist/template/seaweed/entry_order_config/EntryOrderConfig.svelte +0 -297
- package/dist/template/seaweed/entry_order_config/EntryOrderConfig.svelte.d.ts +0 -12
- package/dist/template/seaweed/entry_order_config/entry-order-config.postcss +0 -35
- package/dist/template/seaweed/index.d.ts +0 -4
- package/dist/template/seaweed/index.js +0 -4
- package/dist/template/seaweed/seaweed.postcss +0 -125
- package/dist/ui/elements/pinya-button/component.svelte.d.ts +0 -4
- package/dist/ui/elements/pinya-button/index.d.ts +0 -2
- package/dist/ui/elements/pinya-button/index.js +0 -2
- package/dist/ui/elements/pinya-card/component.svelte.d.ts +0 -7
- package/dist/ui/elements/pinya-card/index.d.ts +0 -2
- package/dist/ui/elements/pinya-card/index.js +0 -2
- package/dist/ui/modules/seaweed/index.d.ts +0 -3
- package/dist/ui/modules/seaweed/index.js +0 -4
- package/dist/ui/templates/pinya-page-layout/component.svelte.d.ts +0 -9
- package/dist/ui/templates/pinya-page-layout/index.d.ts +0 -2
- package/dist/ui/templates/pinya-page-layout/index.js +0 -2
- package/dist/ui/templates/pinya-page-layout/runes.svelte.js +0 -3
- package/dist/ui/templates/seaweed-layout/EntryOrderConfig2.svelte.d.ts +0 -9
- /package/dist/ui/elements/{pinya-button/props.js → PinyaButton/PinyaButtonProps.js} +0 -0
- /package/dist/ui/elements/{pinya-card/props.d.ts → PinyaCard/PinyaCardProps.d.ts} +0 -0
- /package/dist/{template/seaweed/ToastSettings.js → ui/elements/PinyaCard/PinyaCardProps.js} +0 -0
- /package/dist/{components/navigation_component → ui/modules/NavigationMenu}/NavigationControl.svelte.d.ts +0 -0
- /package/dist/{components/navigation_component → ui/modules/NavigationMenu}/PageMeta.js +0 -0
- /package/dist/ui/{modules/seaweed → templates/SeaweedLayout}/ChumBucket.svelte.d.ts +0 -0
- /package/dist/{template/seaweed → ui/templates/SeaweedLayout}/CreateUrlForm.svelte.d.ts +0 -0
- /package/dist/ui/templates/{seaweed-layout → SeaweedLayout}/EntryGroup.svelte.d.ts +0 -0
- /package/dist/ui/templates/{seaweed-layout/EntryOrderConfig2.svelte → SeaweedLayout/EntryOrderConfig.svelte} +0 -0
- /package/dist/ui/templates/{seaweed-layout → SeaweedLayout}/ProjectComponentProps.js +0 -0
- /package/dist/ui/templates/{seaweed-layout → SeaweedLayout}/SeaweedLayout.svelte.d.ts +0 -0
- /package/dist/{template/seaweed → ui/templates/SeaweedLayout}/ToastSettings.d.ts +0 -0
- /package/dist/ui/{elements/pinya-card/props.js → templates/SeaweedLayout/ToastSettings.js} +0 -0
- /package/dist/ui/templates/{seaweed-layout → SeaweedLayout}/index.d.ts +0 -0
- /package/dist/ui/templates/{seaweed-layout → SeaweedLayout}/index.js +0 -0
- /package/dist/ui/templates/{seaweed-layout → SeaweedLayout}/props.js +0 -0
|
@@ -1,316 +1,316 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import CloseIcon from "../../../assets/icons/close.svg";
|
|
3
|
-
import UpwardIcon from "../../../assets/icons/arrow-upward.svg";
|
|
4
|
-
import type { ProjectGroup, SnippetMeta } from "../index";
|
|
5
|
-
import { getContext, onMount } from "svelte";
|
|
6
|
-
import { PinyaCard } from "../../elements/index";
|
|
7
|
-
import PinyaCombobox from "../../elements/pinya-combobox/PinyaCombobox.svelte";
|
|
8
|
-
import { PinyaButton } from "../../elements/index.js";
|
|
9
|
-
import { type ToastContext } from "@skeletonlabs/skeleton-svelte";
|
|
10
|
-
|
|
11
|
-
export const toast: ToastContext = getContext("toast");
|
|
12
|
-
|
|
13
|
-
interface Props {
|
|
14
|
-
layout: ProjectGroup[];
|
|
15
|
-
orderUrl: string;
|
|
16
|
-
allEntries: SnippetMeta[];
|
|
17
|
-
group: ProjectGroup;
|
|
18
|
-
groupIndex: number;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
let {
|
|
22
|
-
layout = $bindable(),
|
|
23
|
-
orderUrl = $bindable(),
|
|
24
|
-
allEntries,
|
|
25
|
-
group,
|
|
26
|
-
groupIndex
|
|
27
|
-
}: Props = $props();
|
|
28
|
-
|
|
29
|
-
const updateOrderQuery = () => {
|
|
30
|
-
orderUrl = "order=" + layout.map(g => {
|
|
31
|
-
const groupUrl = g.entryList.map(e => e.key).join("|");
|
|
32
|
-
// the last item after : is a grid class but we're keeping it here for legacy reason
|
|
33
|
-
return `${g.title}:${groupUrl}:`;
|
|
34
|
-
}).join(",");
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const swapEntry = (index: number, group: ProjectGroup, shouldDecrement: boolean): (() => void) => {
|
|
38
|
-
return () => {
|
|
39
|
-
let newIndex = index;
|
|
40
|
-
if (shouldDecrement && index >= 1) {
|
|
41
|
-
newIndex--;
|
|
42
|
-
} else if (!shouldDecrement && index <= group.entryList.length - 2) {
|
|
43
|
-
newIndex++;
|
|
44
|
-
} else {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const tempVar = group.entryList[newIndex];
|
|
49
|
-
group.entryList[newIndex] = group.entryList[index];
|
|
50
|
-
group.entryList[index] = tempVar;
|
|
51
|
-
layout = layout;
|
|
52
|
-
updateOrderQuery();
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
const swapGroups = (index: number, shouldDecrement: boolean): (() => void) => {
|
|
56
|
-
return () => {
|
|
57
|
-
let newIndex = index;
|
|
58
|
-
if (shouldDecrement && index >= 1) {
|
|
59
|
-
newIndex--;
|
|
60
|
-
} else if (!shouldDecrement && index <= layout.length - 2) {
|
|
61
|
-
newIndex++;
|
|
62
|
-
} else {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const tempVar = layout[newIndex];
|
|
67
|
-
layout[newIndex] = layout[index];
|
|
68
|
-
layout[index] = tempVar;
|
|
69
|
-
layout = layout;
|
|
70
|
-
updateOrderQuery();
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const removeGroup = (group: ProjectGroup): (() => void) => {
|
|
75
|
-
return () => {
|
|
76
|
-
const index = layout.indexOf(group);
|
|
77
|
-
if (index === -1) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
layout.splice(index, 1);
|
|
82
|
-
layout = layout;
|
|
83
|
-
updateOrderQuery();
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
const removeEntry = (entry: SnippetMeta, group: ProjectGroup): (() => void) => {
|
|
87
|
-
return () => {
|
|
88
|
-
for (let i = group.entryList.length - 1; i >= 0; i--) {
|
|
89
|
-
if (group.entryList[i].key === entry.key) {
|
|
90
|
-
group.entryList.splice(i, 1);
|
|
91
|
-
layout = layout;
|
|
92
|
-
updateOrderQuery();
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const comboboxData = allEntries.map(entry => {
|
|
100
|
-
return {
|
|
101
|
-
label: entry.key,
|
|
102
|
-
value: entry.key
|
|
103
|
-
};
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
let comboboxValue = $state([comboboxData[0].value]);
|
|
107
|
-
|
|
108
|
-
const addEntry = () => {
|
|
109
|
-
const c = allEntries.find(e => e.key === comboboxValue[0]);
|
|
110
|
-
|
|
111
|
-
if (!c) {
|
|
112
|
-
console.warn(`Unknown key: ${comboboxValue}`);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (group.entryList.includes(c)) {
|
|
117
|
-
toast.create({
|
|
118
|
-
title: "Duplicate entry",
|
|
119
|
-
description: `The entry ${comboboxValue} is already in ${group.title}`,
|
|
120
|
-
type: "error"
|
|
121
|
-
});
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
group.entryList.push(c);
|
|
126
|
-
layout = layout;
|
|
127
|
-
updateOrderQuery();
|
|
128
|
-
};
|
|
129
|
-
</script>
|
|
130
|
-
|
|
131
|
-
<PinyaCard
|
|
132
|
-
widthClass="max-w-2xl"
|
|
133
|
-
borderClass="border-[2px] border-primary-500"
|
|
134
|
-
marginClass="mt-4 mb-4"
|
|
135
|
-
paddingClass=""
|
|
136
|
-
>
|
|
137
|
-
|
|
138
|
-
<div class="m-4 flex flex-row gap-2">
|
|
139
|
-
<button title={`Remove ${group.title}`}
|
|
140
|
-
onclick={removeGroup(group)}>
|
|
141
|
-
<img class="img-icon" src={CloseIcon} alt={`Remove ${group.title}`}>
|
|
142
|
-
</button>
|
|
143
|
-
|
|
144
|
-
<button title={`Move group ${group.title} upwards`}
|
|
145
|
-
onclick={swapGroups(groupIndex, true)}
|
|
146
|
-
disabled="{groupIndex === 0}">
|
|
147
|
-
<img class="img-icon" src={UpwardIcon} alt={`Move group ${group.title} upwards`}>
|
|
148
|
-
</button>
|
|
149
|
-
|
|
150
|
-
<button title={`Move group ${group.title} downwards`}
|
|
151
|
-
disabled={groupIndex === layout.length - 1}
|
|
152
|
-
onclick={swapGroups(groupIndex, false)}>
|
|
153
|
-
<img
|
|
154
|
-
class="img-icon flipped-vertically"
|
|
155
|
-
src={UpwardIcon}
|
|
156
|
-
alt={`Move group ${group.title} downwards`}
|
|
157
|
-
>
|
|
158
|
-
</button>
|
|
159
|
-
|
|
160
|
-
<div class="fake-h3 ml-2">Group title: {group.title}</div>
|
|
161
|
-
</div>
|
|
162
|
-
|
|
163
|
-
<hr class="border-primary-500 border-1">
|
|
164
|
-
|
|
165
|
-
<table class="table">
|
|
166
|
-
<thead>
|
|
167
|
-
<tr>
|
|
168
|
-
<th class="fake-h4">Entries</th>
|
|
169
|
-
</tr>
|
|
170
|
-
</thead>
|
|
171
|
-
<tbody>
|
|
172
|
-
{#each group.entryList as entry, entryIndex (entry)}
|
|
173
|
-
<tr class="entry-row">
|
|
174
|
-
<td class="entry-data">
|
|
175
|
-
|
|
176
|
-
<button title={`Remove ${entry.key}`}
|
|
177
|
-
onclick={removeEntry(entry, group)}>
|
|
178
|
-
<img class="img-icon" src={CloseIcon} alt={`Remove ${entry.key}`}>
|
|
179
|
-
</button>
|
|
180
|
-
|
|
181
|
-
<button title={`Move ${entry.key} upwards`}
|
|
182
|
-
onclick={swapEntry(entryIndex, group, true)}
|
|
183
|
-
disabled="{entryIndex === 0}">
|
|
184
|
-
<img class="img-icon" src={UpwardIcon} alt={`Move ${entry.key} upwards`}>
|
|
185
|
-
</button>
|
|
186
|
-
|
|
187
|
-
<button title={`Move ${entry.key} downwards`}
|
|
188
|
-
disabled={entryIndex === group.key.length - 1}
|
|
189
|
-
onclick={swapEntry(entryIndex, group, false)}>
|
|
190
|
-
<img class="img-icon flipped-vertically" src={UpwardIcon} alt={`Move ${entry.key} downwards`}>
|
|
191
|
-
</button>
|
|
192
|
-
<div class="entry-name">
|
|
193
|
-
{entry.key}
|
|
194
|
-
</div>
|
|
195
|
-
</td>
|
|
196
|
-
</tr>
|
|
197
|
-
{/each}
|
|
198
|
-
</tbody>
|
|
199
|
-
|
|
200
|
-
<tfoot>
|
|
201
|
-
<tr>
|
|
202
|
-
<td class="combobox-container">
|
|
203
|
-
<PinyaButton onclick={addEntry}>Add Entry
|
|
204
|
-
</PinyaButton>
|
|
205
|
-
<PinyaCombobox
|
|
206
|
-
data={comboboxData}
|
|
207
|
-
defaultValue={comboboxValue}
|
|
208
|
-
bind:value={comboboxValue}
|
|
209
|
-
label="New entry"
|
|
210
|
-
placeholder="Add new entry"
|
|
211
|
-
contentZIndex="10"
|
|
212
|
-
/>
|
|
213
|
-
</td>
|
|
214
|
-
</tr>
|
|
215
|
-
</tfoot>
|
|
216
|
-
</table>
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
</PinyaCard>
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
<style>
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
.advanced-setting-list {
|
|
226
|
-
display: flex;
|
|
227
|
-
flex-direction: column;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.btn-group-header {
|
|
231
|
-
@apply preset-filled-tertiary-500;
|
|
232
|
-
display: flex;
|
|
233
|
-
align-items: center;
|
|
234
|
-
margin-bottom: 0.5lh;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
.btn-group-entry {
|
|
238
|
-
@apply ;
|
|
239
|
-
display: flex;
|
|
240
|
-
padding: 0;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.btn-group-entry > div {
|
|
244
|
-
padding: 1em;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
.flipped-vertically {
|
|
248
|
-
transform: rotate(180deg);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
.entry-group {
|
|
252
|
-
border-radius: var(--theme-rounded-container);
|
|
253
|
-
background-color: rgb(var(--color-surface-600));
|
|
254
|
-
margin-top: 1.5lh;
|
|
255
|
-
margin-bottom: 0.5lh;
|
|
256
|
-
padding: 0.5lh 0.5em;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
.entry-name {
|
|
260
|
-
grow: 1;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
tr, td, th, table {
|
|
264
|
-
width: 100%;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
table {
|
|
268
|
-
margin-bottom: 1lh;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
tfoot > tr {
|
|
272
|
-
display: flex;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
.btn-group > button {
|
|
276
|
-
padding: 0.3em 0.75em;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
.btn-group-header > h2 {
|
|
280
|
-
font-weight: bolder;
|
|
281
|
-
padding-top: 1lh;
|
|
282
|
-
padding-bottom: 1lh;
|
|
283
|
-
margin-bottom: 0;
|
|
284
|
-
padding-inline-start: 1em;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
.dark .btn-group-header > h2 {
|
|
288
|
-
color: rgb(var(--theme-font-color-dark));
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
.dark .entry-group {
|
|
292
|
-
background-color: rgb(var(--color-surface-800));
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
tbody tr:nth-child(odd) {
|
|
297
|
-
background-color: var(--color-surface-100-900);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
tbody tr:nth-child(even), thead {
|
|
301
|
-
background-color: var(--color-surface-300-700);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
.entry-data {
|
|
305
|
-
display: flex;
|
|
306
|
-
flex-direction: row;
|
|
307
|
-
gap: 1rem;
|
|
308
|
-
align-items: center;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
.combobox-container {
|
|
312
|
-
display: flex;
|
|
313
|
-
flex-direction: row;
|
|
314
|
-
gap: 1em;
|
|
315
|
-
}
|
|
316
|
-
</style>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import CloseIcon from "../../../assets/icons/close.svg";
|
|
3
|
+
import UpwardIcon from "../../../assets/icons/arrow-upward.svg";
|
|
4
|
+
import type { ProjectGroup, SnippetMeta } from "../index";
|
|
5
|
+
import { getContext, onMount } from "svelte";
|
|
6
|
+
import { PinyaCard } from "../../elements/index";
|
|
7
|
+
import PinyaCombobox from "../../elements/pinya-combobox/PinyaCombobox.svelte";
|
|
8
|
+
import { PinyaButton } from "../../elements/index.js";
|
|
9
|
+
import { type ToastContext } from "@skeletonlabs/skeleton-svelte";
|
|
10
|
+
|
|
11
|
+
export const toast: ToastContext = getContext("toast");
|
|
12
|
+
|
|
13
|
+
interface Props {
|
|
14
|
+
layout: ProjectGroup[];
|
|
15
|
+
orderUrl: string;
|
|
16
|
+
allEntries: SnippetMeta[];
|
|
17
|
+
group: ProjectGroup;
|
|
18
|
+
groupIndex: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let {
|
|
22
|
+
layout = $bindable(),
|
|
23
|
+
orderUrl = $bindable(),
|
|
24
|
+
allEntries,
|
|
25
|
+
group,
|
|
26
|
+
groupIndex
|
|
27
|
+
}: Props = $props();
|
|
28
|
+
|
|
29
|
+
const updateOrderQuery = () => {
|
|
30
|
+
orderUrl = "order=" + layout.map(g => {
|
|
31
|
+
const groupUrl = g.entryList.map(e => e.key).join("|");
|
|
32
|
+
// the last item after : is a grid class but we're keeping it here for legacy reason
|
|
33
|
+
return `${g.title}:${groupUrl}:`;
|
|
34
|
+
}).join(",");
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const swapEntry = (index: number, group: ProjectGroup, shouldDecrement: boolean): (() => void) => {
|
|
38
|
+
return () => {
|
|
39
|
+
let newIndex = index;
|
|
40
|
+
if (shouldDecrement && index >= 1) {
|
|
41
|
+
newIndex--;
|
|
42
|
+
} else if (!shouldDecrement && index <= group.entryList.length - 2) {
|
|
43
|
+
newIndex++;
|
|
44
|
+
} else {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const tempVar = group.entryList[newIndex];
|
|
49
|
+
group.entryList[newIndex] = group.entryList[index];
|
|
50
|
+
group.entryList[index] = tempVar;
|
|
51
|
+
layout = layout;
|
|
52
|
+
updateOrderQuery();
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
const swapGroups = (index: number, shouldDecrement: boolean): (() => void) => {
|
|
56
|
+
return () => {
|
|
57
|
+
let newIndex = index;
|
|
58
|
+
if (shouldDecrement && index >= 1) {
|
|
59
|
+
newIndex--;
|
|
60
|
+
} else if (!shouldDecrement && index <= layout.length - 2) {
|
|
61
|
+
newIndex++;
|
|
62
|
+
} else {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const tempVar = layout[newIndex];
|
|
67
|
+
layout[newIndex] = layout[index];
|
|
68
|
+
layout[index] = tempVar;
|
|
69
|
+
layout = layout;
|
|
70
|
+
updateOrderQuery();
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const removeGroup = (group: ProjectGroup): (() => void) => {
|
|
75
|
+
return () => {
|
|
76
|
+
const index = layout.indexOf(group);
|
|
77
|
+
if (index === -1) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
layout.splice(index, 1);
|
|
82
|
+
layout = layout;
|
|
83
|
+
updateOrderQuery();
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
const removeEntry = (entry: SnippetMeta, group: ProjectGroup): (() => void) => {
|
|
87
|
+
return () => {
|
|
88
|
+
for (let i = group.entryList.length - 1; i >= 0; i--) {
|
|
89
|
+
if (group.entryList[i].key === entry.key) {
|
|
90
|
+
group.entryList.splice(i, 1);
|
|
91
|
+
layout = layout;
|
|
92
|
+
updateOrderQuery();
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const comboboxData = allEntries.map(entry => {
|
|
100
|
+
return {
|
|
101
|
+
label: entry.key,
|
|
102
|
+
value: entry.key
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
let comboboxValue = $state([comboboxData[0].value]);
|
|
107
|
+
|
|
108
|
+
const addEntry = () => {
|
|
109
|
+
const c = allEntries.find(e => e.key === comboboxValue[0]);
|
|
110
|
+
|
|
111
|
+
if (!c) {
|
|
112
|
+
console.warn(`Unknown key: ${comboboxValue}`);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (group.entryList.includes(c)) {
|
|
117
|
+
toast.create({
|
|
118
|
+
title: "Duplicate entry",
|
|
119
|
+
description: `The entry ${comboboxValue} is already in ${group.title}`,
|
|
120
|
+
type: "error"
|
|
121
|
+
});
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
group.entryList.push(c);
|
|
126
|
+
layout = layout;
|
|
127
|
+
updateOrderQuery();
|
|
128
|
+
};
|
|
129
|
+
</script>
|
|
130
|
+
|
|
131
|
+
<PinyaCard
|
|
132
|
+
widthClass="max-w-2xl"
|
|
133
|
+
borderClass="border-[2px] border-primary-500"
|
|
134
|
+
marginClass="mt-4 mb-4"
|
|
135
|
+
paddingClass=""
|
|
136
|
+
>
|
|
137
|
+
|
|
138
|
+
<div class="m-4 flex flex-row gap-2">
|
|
139
|
+
<button title={`Remove ${group.title}`}
|
|
140
|
+
onclick={removeGroup(group)}>
|
|
141
|
+
<img class="img-icon" src={CloseIcon} alt={`Remove ${group.title}`}>
|
|
142
|
+
</button>
|
|
143
|
+
|
|
144
|
+
<button title={`Move group ${group.title} upwards`}
|
|
145
|
+
onclick={swapGroups(groupIndex, true)}
|
|
146
|
+
disabled="{groupIndex === 0}">
|
|
147
|
+
<img class="img-icon" src={UpwardIcon} alt={`Move group ${group.title} upwards`}>
|
|
148
|
+
</button>
|
|
149
|
+
|
|
150
|
+
<button title={`Move group ${group.title} downwards`}
|
|
151
|
+
disabled={groupIndex === layout.length - 1}
|
|
152
|
+
onclick={swapGroups(groupIndex, false)}>
|
|
153
|
+
<img
|
|
154
|
+
class="img-icon flipped-vertically"
|
|
155
|
+
src={UpwardIcon}
|
|
156
|
+
alt={`Move group ${group.title} downwards`}
|
|
157
|
+
>
|
|
158
|
+
</button>
|
|
159
|
+
|
|
160
|
+
<div class="fake-h3 ml-2">Group title: {group.title}</div>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<hr class="border-primary-500 border-1">
|
|
164
|
+
|
|
165
|
+
<table class="table">
|
|
166
|
+
<thead>
|
|
167
|
+
<tr>
|
|
168
|
+
<th class="fake-h4">Entries</th>
|
|
169
|
+
</tr>
|
|
170
|
+
</thead>
|
|
171
|
+
<tbody>
|
|
172
|
+
{#each group.entryList as entry, entryIndex (entry)}
|
|
173
|
+
<tr class="entry-row">
|
|
174
|
+
<td class="entry-data">
|
|
175
|
+
|
|
176
|
+
<button title={`Remove ${entry.key}`}
|
|
177
|
+
onclick={removeEntry(entry, group)}>
|
|
178
|
+
<img class="img-icon" src={CloseIcon} alt={`Remove ${entry.key}`}>
|
|
179
|
+
</button>
|
|
180
|
+
|
|
181
|
+
<button title={`Move ${entry.key} upwards`}
|
|
182
|
+
onclick={swapEntry(entryIndex, group, true)}
|
|
183
|
+
disabled="{entryIndex === 0}">
|
|
184
|
+
<img class="img-icon" src={UpwardIcon} alt={`Move ${entry.key} upwards`}>
|
|
185
|
+
</button>
|
|
186
|
+
|
|
187
|
+
<button title={`Move ${entry.key} downwards`}
|
|
188
|
+
disabled={entryIndex === group.key.length - 1}
|
|
189
|
+
onclick={swapEntry(entryIndex, group, false)}>
|
|
190
|
+
<img class="img-icon flipped-vertically" src={UpwardIcon} alt={`Move ${entry.key} downwards`}>
|
|
191
|
+
</button>
|
|
192
|
+
<div class="entry-name">
|
|
193
|
+
{entry.key}
|
|
194
|
+
</div>
|
|
195
|
+
</td>
|
|
196
|
+
</tr>
|
|
197
|
+
{/each}
|
|
198
|
+
</tbody>
|
|
199
|
+
|
|
200
|
+
<tfoot>
|
|
201
|
+
<tr>
|
|
202
|
+
<td class="combobox-container">
|
|
203
|
+
<PinyaButton onclick={addEntry}>Add Entry
|
|
204
|
+
</PinyaButton>
|
|
205
|
+
<PinyaCombobox
|
|
206
|
+
data={comboboxData}
|
|
207
|
+
defaultValue={comboboxValue}
|
|
208
|
+
bind:value={comboboxValue}
|
|
209
|
+
label="New entry"
|
|
210
|
+
placeholder="Add new entry"
|
|
211
|
+
contentZIndex="10"
|
|
212
|
+
/>
|
|
213
|
+
</td>
|
|
214
|
+
</tr>
|
|
215
|
+
</tfoot>
|
|
216
|
+
</table>
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
</PinyaCard>
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
<style>
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
.advanced-setting-list {
|
|
226
|
+
display: flex;
|
|
227
|
+
flex-direction: column;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.btn-group-header {
|
|
231
|
+
@apply preset-filled-tertiary-500;
|
|
232
|
+
display: flex;
|
|
233
|
+
align-items: center;
|
|
234
|
+
margin-bottom: 0.5lh;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.btn-group-entry {
|
|
238
|
+
@apply ;
|
|
239
|
+
display: flex;
|
|
240
|
+
padding: 0;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.btn-group-entry > div {
|
|
244
|
+
padding: 1em;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.flipped-vertically {
|
|
248
|
+
transform: rotate(180deg);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.entry-group {
|
|
252
|
+
border-radius: var(--theme-rounded-container);
|
|
253
|
+
background-color: rgb(var(--color-surface-600));
|
|
254
|
+
margin-top: 1.5lh;
|
|
255
|
+
margin-bottom: 0.5lh;
|
|
256
|
+
padding: 0.5lh 0.5em;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.entry-name {
|
|
260
|
+
grow: 1;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
tr, td, th, table {
|
|
264
|
+
width: 100%;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
table {
|
|
268
|
+
margin-bottom: 1lh;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
tfoot > tr {
|
|
272
|
+
display: flex;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.btn-group > button {
|
|
276
|
+
padding: 0.3em 0.75em;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.btn-group-header > h2 {
|
|
280
|
+
font-weight: bolder;
|
|
281
|
+
padding-top: 1lh;
|
|
282
|
+
padding-bottom: 1lh;
|
|
283
|
+
margin-bottom: 0;
|
|
284
|
+
padding-inline-start: 1em;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.dark .btn-group-header > h2 {
|
|
288
|
+
color: rgb(var(--theme-font-color-dark));
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.dark .entry-group {
|
|
292
|
+
background-color: rgb(var(--color-surface-800));
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
tbody tr:nth-child(odd) {
|
|
297
|
+
background-color: var(--color-surface-100-900);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
tbody tr:nth-child(even), thead {
|
|
301
|
+
background-color: var(--color-surface-300-700);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.entry-data {
|
|
305
|
+
display: flex;
|
|
306
|
+
flex-direction: row;
|
|
307
|
+
gap: 1rem;
|
|
308
|
+
align-items: center;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.combobox-container {
|
|
312
|
+
display: flex;
|
|
313
|
+
flex-direction: row;
|
|
314
|
+
gap: 1em;
|
|
315
|
+
}
|
|
316
|
+
</style>
|
|
@@ -9,6 +9,6 @@ interface Props {
|
|
|
9
9
|
}
|
|
10
10
|
declare const ProjectGroupConfig: import("svelte").Component<Props, {
|
|
11
11
|
toast: ToastContext;
|
|
12
|
-
}, "
|
|
12
|
+
}, "layout" | "orderUrl">;
|
|
13
13
|
type ProjectGroupConfig = ReturnType<typeof ProjectGroupConfig>;
|
|
14
14
|
export default ProjectGroupConfig;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Query format
|
|
2
|
-
|
|
3
|
-
- ?order=title:entry 1|entry 2:layout-type,title2:entry 3:layout-type
|
|
1
|
+
# Query format
|
|
2
|
+
|
|
3
|
+
- ?order=title:entry 1|entry 2:layout-type,title2:entry 3:layout-type
|
|
4
4
|
- &qt=js,vue,ts,java,android,react,go,aws,observability,infra,unity,cs,rpgmaker,python,django,heroku,svelte,c,foundation,valgrind,google,firebase
|