@turnipxenon/pineapple 2.4.52 → 2.4.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/.idea/workspace.xml +54 -51
  2. package/.svelte-kit/__package__/components/combo_box/ComboBox.svelte +7 -7
  3. package/.svelte-kit/__package__/components/combo_box/ComboBoxWithButton.svelte +7 -7
  4. package/.svelte-kit/__package__/components/combo_box/combo-box.postcss +22 -22
  5. package/.svelte-kit/__package__/template/seaweed/ParseQueryTerms.d.ts +1 -0
  6. package/.svelte-kit/__package__/template/seaweed/ParseQueryTerms.js +23 -0
  7. package/.svelte-kit/__package__/template/seaweed/SeaweedTemplate.svelte +10 -22
  8. package/.svelte-kit/__package__/template/seaweed/entry_order_config/EntryOrderConfig.svelte +117 -117
  9. package/.svelte-kit/generated/server/internal.js +1 -1
  10. package/dist/components/combo_box/ComboBox.svelte +7 -7
  11. package/dist/components/combo_box/ComboBoxWithButton.svelte +7 -7
  12. package/dist/components/combo_box/combo-box.postcss +22 -22
  13. package/dist/template/seaweed/ParseQueryTerms.d.ts +1 -0
  14. package/dist/template/seaweed/ParseQueryTerms.js +23 -0
  15. package/dist/template/seaweed/SeaweedTemplate.svelte +10 -22
  16. package/dist/template/seaweed/entry_order_config/EntryOrderConfig.svelte +117 -117
  17. package/package.json +1 -1
  18. package/src/lib/components/combo_box/ComboBox.svelte +13 -13
  19. package/src/lib/components/combo_box/ComboBoxWithButton.svelte +18 -18
  20. package/src/lib/components/combo_box/combo-box.postcss +22 -22
  21. package/src/lib/template/seaweed/ParseQueryTerms.ts +26 -0
  22. package/src/lib/template/seaweed/RunChaos.ts +44 -44
  23. package/src/lib/template/seaweed/SeaweedTemplate.svelte +11 -34
  24. package/src/lib/template/seaweed/entry_order_config/EntryOrderConfig.svelte +166 -166
  25. package/src/lib/template/seaweed/entry_order_config/EntryOrderConfig.ts +6 -6
@@ -9,7 +9,6 @@
9
9
  import { page } from "$app/stores";
10
10
  import Card from "$pkg/components/Card.svelte";
11
11
  import ElementVisbilityDetector from "$pkg/components/ElementVisbilityDetector.svelte";
12
- import selfContent from "./SeaweedTemplate.svelte?raw";
13
12
  import {
14
13
  AllGroupedEntriesProjectFirst,
15
14
  type EntryGroup,
@@ -19,7 +18,7 @@
19
18
  TurnGroupEntriesMutable
20
19
  } from "./SeaweedTemplateData";
21
20
  import type { EntryProps } from "$pkg/template/seaweed/entries/EntryProps";
22
- import type { RawGlob } from "$pkg/util/util";
21
+ import { parseQueryTerms } from "$pkg/template/seaweed/ParseQueryTerms";
23
22
 
24
23
  export let letChaos = true;
25
24
  export let name = "Turnip";
@@ -34,7 +33,6 @@
34
33
  email
35
34
  };
36
35
 
37
- const entryList = import.meta.glob("./entries/*.svelte", { query: "?raw", eager: true });
38
36
  const paramQTSet = new Set<string>();
39
37
 
40
38
  let isVisible = true;
@@ -61,36 +59,9 @@
61
59
  seaweedTemplateData.queryTermMap = seaweedTemplateData.queryTermMap;
62
60
  };
63
61
 
64
- const parseQTTerms = async () => {
65
- console.log("parsing", seaweedTemplateData.queryTermMap.size);
62
+ const parseQueryTermsLocal = async () => {
66
63
  const qtSet = new Set<string>();
67
- const rawTermList: string[] = [];
68
- [...Object.values(entryList).map(e => (e as RawGlob).default), selfContent].forEach(body => {
69
- // parse the qt-* term which exists within elements like:
70
- // <span class="qt-*">TERM</span>
71
- console.log("parsing", body);
72
- rawTermList.push(
73
- ...body // step 3: destructure the array
74
- .split("\"") // step 1: split the text as double quotations (") as the delimiter
75
- .filter(s => s.startsWith("qt-")) // step 2: filter out texts that does not begin with "qt-"
76
- );
77
- });
78
-
79
- // step 4: some spans contain multiple classes, split them up
80
- // then add them to qtTerms
81
- // e.g. <span class="qt-1 qt-2">TERM</span>
82
- rawTermList.forEach(t => {
83
- t.split(" ").forEach(nt => {
84
- // filter out some of this meta terms
85
- if (["qt-1", "qt-2", "qt-*", "qt-"].includes(nt)) {
86
- return;
87
- }
88
-
89
- // adding to set ensures the entry is unique
90
- qtSet.add(nt);
91
- });
92
- });
93
-
64
+ parseQueryTerms(document.body, qtSet);
94
65
  qtSet.forEach(t => seaweedTemplateData.queryTermMap.set(t, true));
95
66
  // force svelte update
96
67
  seaweedTemplateData.queryTermMap = seaweedTemplateData.queryTermMap;
@@ -187,8 +158,14 @@
187
158
  if (letChaos) {
188
159
  runChaos(document.body);
189
160
  chaosDone = true;
190
- } else {
191
- await parseQTTerms();
161
+ }
162
+ });
163
+
164
+ let isParsed = false;
165
+ afterUpdate(async () => {
166
+ if (!letChaos && !isParsed) {
167
+ isParsed = true;
168
+ await parseQueryTermsLocal();
192
169
  }
193
170
  });
194
171
 
@@ -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
  };