@turnipxenon/pineapple 2.4.24 → 2.4.25

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.
@@ -4,9 +4,7 @@
4
4
  <option name="autoReloadType" value="SELECTIVE" />
5
5
  </component>
6
6
  <component name="ChangeListManager">
7
- <list default="true" id="accb6ba2-c343-4f84-ad30-6e2d71eceee5" name="Changes" comment="Refactor GameSection out of SeaweedTemplate">
8
- <change beforePath="$PROJECT_DIR$/src/lib/template/Seaweed/SeaweedTemplate.svelte" beforeDir="false" afterPath="$PROJECT_DIR$/src/lib/template/Seaweed/SeaweedTemplate.svelte" afterDir="false" />
9
- </list>
7
+ <list default="true" id="accb6ba2-c343-4f84-ad30-6e2d71eceee5" name="Changes" comment="Add page query param creator" />
10
8
  <option name="SHOW_DIALOG" value="false" />
11
9
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
12
10
  <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@@ -35,9 +33,9 @@
35
33
  <option value="ToggleableContent" />
36
34
  <option value="Toast" />
37
35
  <option value="TestCard" />
38
- <option value="TypeScript File" />
39
36
  <option value="GameSection" />
40
37
  <option value="ProjectSection" />
38
+ <option value="TypeScript File" />
41
39
  </list>
42
40
  </option>
43
41
  </component>
@@ -113,11 +111,11 @@
113
111
  <recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\lib\components\pineapple\toast\custom-toast" />
114
112
  </key>
115
113
  <key name="MoveFile.RECENT_KEYS">
114
+ <recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\lib\types" />
115
+ <recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\lib" />
116
116
  <recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\lib\template\Seaweed" />
117
117
  <recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\routes\(pineapple)\about" />
118
118
  <recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\routes\(pineapple)" />
119
- <recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\lib\components\pineapple\toast\custom-toast" />
120
- <recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\lib\components\pineapple\toast" />
121
119
  </key>
122
120
  <key name="es6.move.members.recent.items">
123
121
  <recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\lib\util\util.ts" />
@@ -221,23 +219,7 @@
221
219
  <workItem from="1711108187279" duration="1163000" />
222
220
  <workItem from="1711115902471" duration="148000" />
223
221
  <workItem from="1711116299202" duration="1291000" />
224
- <workItem from="1711179012668" duration="1717000" />
225
- </task>
226
- <task id="LOCAL-00039" summary="Add chips and query">
227
- <option name="closed" value="true" />
228
- <created>1710127422091</created>
229
- <option name="number" value="00039" />
230
- <option name="presentableId" value="LOCAL-00039" />
231
- <option name="project" value="LOCAL" />
232
- <updated>1710127422091</updated>
233
- </task>
234
- <task id="LOCAL-00040" summary="Add chips and query">
235
- <option name="closed" value="true" />
236
- <created>1710128080602</created>
237
- <option name="number" value="00040" />
238
- <option name="presentableId" value="LOCAL-00040" />
239
- <option name="project" value="LOCAL" />
240
- <updated>1710128080602</updated>
222
+ <workItem from="1711179012668" duration="13200000" />
241
223
  </task>
242
224
  <task id="LOCAL-00041" summary="Turn the portfolio site into a template">
243
225
  <option name="closed" value="true" />
@@ -615,7 +597,23 @@
615
597
  <option name="project" value="LOCAL" />
616
598
  <updated>1711180642880</updated>
617
599
  </task>
618
- <option name="localTasksCounter" value="88" />
600
+ <task id="LOCAL-00088" summary="Remove unnecessary imports and variables in SeaweedTemplate">
601
+ <option name="closed" value="true" />
602
+ <created>1711180796474</created>
603
+ <option name="number" value="00088" />
604
+ <option name="presentableId" value="LOCAL-00088" />
605
+ <option name="project" value="LOCAL" />
606
+ <updated>1711180796474</updated>
607
+ </task>
608
+ <task id="LOCAL-00089" summary="Add page query param creator">
609
+ <option name="closed" value="true" />
610
+ <created>1711192223071</created>
611
+ <option name="number" value="00089" />
612
+ <option name="presentableId" value="LOCAL-00089" />
613
+ <option name="project" value="LOCAL" />
614
+ <updated>1711192223071</updated>
615
+ </task>
616
+ <option name="localTasksCounter" value="90" />
619
617
  <servers />
620
618
  </component>
621
619
  <component name="TypeScriptGeneratedFilesManager">
@@ -673,8 +671,6 @@
673
671
  </option>
674
672
  </component>
675
673
  <component name="VcsManagerConfiguration">
676
- <MESSAGE value="Add animation to dynamically added button in social section" />
677
- <MESSAGE value="Implement normal state for PineappleBaseLayout" />
678
674
  <MESSAGE value="Add custom toast" />
679
675
  <MESSAGE value="Add simple text toast and toast queue" />
680
676
  <MESSAGE value="Enforce stricter typing for Toast components" />
@@ -698,6 +694,8 @@
698
694
  <MESSAGE value="Add external link warning stub" />
699
695
  <MESSAGE value="Refactor Game Section to separate component" />
700
696
  <MESSAGE value="Refactor GameSection out of SeaweedTemplate" />
701
- <option name="LAST_COMMIT_MESSAGE" value="Refactor GameSection out of SeaweedTemplate" />
697
+ <MESSAGE value="Remove unnecessary imports and variables in SeaweedTemplate" />
698
+ <MESSAGE value="Add page query param creator" />
699
+ <option name="LAST_COMMIT_MESSAGE" value="Add page query param creator" />
702
700
  </component>
703
701
  </project>
@@ -2,10 +2,11 @@
2
2
  export let name = "Turnip";
3
3
  export let email = "turnipxenon@gmail.com";
4
4
  export let linkedinSlug = "turnip-xenon";
5
+ export let domain = "http://localhost:5173/portfolio/actual/";
5
6
  import SocialSection from "../../components/SocialSection.svelte";
6
7
  import "./seaweed.postcss";
7
8
  import SeaweedBaseLayout from "../../components/layouts/SeaweedBaseLayout.svelte";
8
- import { Accordion, AccordionItem, SlideToggle } from "@skeletonlabs/skeleton";
9
+ import { Accordion, AccordionItem, CodeBlock, SlideToggle } from "@skeletonlabs/skeleton";
9
10
  import { page } from "$app/stores";
10
11
  import Card from "../../components/Card.svelte";
11
12
  import { onMount } from "svelte";
@@ -16,9 +17,49 @@ let isVisible = true;
16
17
  let isAdvanceSettingOn = false;
17
18
  $:
18
19
  isSocialsGone = !isVisible;
20
+ import gameContent from "./GameSection.svelte?raw";
21
+ import projectContent from "./ProjectSection.svelte?raw";
22
+ import selfContent from "./SeaweedTemplate.svelte?raw";
23
+ let qtMap = /* @__PURE__ */ new Map();
24
+ const paramQTSet = /* @__PURE__ */ new Set();
25
+ const syncQT = () => {
26
+ if (qtMap.size === 0 || paramQTSet.size === 0) {
27
+ return;
28
+ }
29
+ qtMap.forEach((_, k) => {
30
+ qtMap.set(k, paramQTSet.has(k));
31
+ });
32
+ qtMap = qtMap;
33
+ };
34
+ const parseQTTerms = async () => {
35
+ const qtSet = /* @__PURE__ */ new Set();
36
+ const rawTermList = [];
37
+ [gameContent, projectContent, selfContent].forEach((body) => {
38
+ rawTermList.push(
39
+ ...body.split('"').filter((s) => s.startsWith("qt-"))
40
+ // step 2: filter out texts that does not begin with "qt-"
41
+ );
42
+ });
43
+ rawTermList.forEach((t) => {
44
+ t.split(" ").forEach((nt) => {
45
+ if (["qt-1", "qt-2", "qt-*", "qt-"].includes(nt)) {
46
+ return;
47
+ }
48
+ qtSet.add(nt);
49
+ });
50
+ });
51
+ qtSet.forEach((t) => qtMap.set(t, true));
52
+ syncQT();
53
+ };
54
+ parseQTTerms();
55
+ let gameSectionFirst = true;
19
56
  let qtfontWeight = "normal";
20
57
  let additionalFontWeight = "";
21
58
  const filterSearchParams = (searchParams) => {
59
+ const gameSectionFirstParam = searchParams.get("game-section-first")?.trim();
60
+ if (gameSectionFirstParam === "false") {
61
+ gameSectionFirst = false;
62
+ }
22
63
  const qtValue = searchParams.get("qt")?.trim();
23
64
  if (qtValue === void 0) {
24
65
  qtfontWeight = "bold";
@@ -26,12 +67,14 @@ const filterSearchParams = (searchParams) => {
26
67
  }
27
68
  qtfontWeight = "normal";
28
69
  const dynamicStyle = qtValue.split(",").map((term) => {
70
+ paramQTSet.add(`qt-${term}`);
29
71
  return `span.qt-${term} { font-weight: bold !important; }`;
30
72
  }).join("\n");
31
73
  const style = document.createElement("style");
32
74
  style.type = "text/css";
33
75
  style.innerText = dynamicStyle;
34
76
  document.head.appendChild(style);
77
+ syncQT();
35
78
  };
36
79
  const chaoticWordBank = ["niko", "toba", "seal", "aquarium", "ojisan", "baikal"];
37
80
  let chaosDone = false;
@@ -69,6 +112,9 @@ const runChaos = (node) => {
69
112
  }
70
113
  }
71
114
  };
115
+ let mainVisibility = "visible";
116
+ $:
117
+ mainVisibility = letChaos && !chaosDone ? "hidden" : "visible";
72
118
  onMount(() => {
73
119
  if (!letChaos && $page.url.searchParams) {
74
120
  filterSearchParams($page.url.searchParams);
@@ -78,9 +124,35 @@ onMount(() => {
78
124
  chaosDone = true;
79
125
  }
80
126
  });
81
- let mainVisibility = "visible";
127
+ const toggleTerm = (term) => {
128
+ qtMap.set(term, !qtMap.get(term));
129
+ qtMap = qtMap;
130
+ };
131
+ let advancedUrl = domain;
132
+ const updateUrl = () => {
133
+ const queryParams = [];
134
+ const qtList = [];
135
+ qtMap.forEach((shouldBold, term) => {
136
+ if (shouldBold) {
137
+ qtList.push(term);
138
+ }
139
+ });
140
+ if (qtList.length === 0) {
141
+ queryParams.push("qt=clear");
142
+ } else if (qtMap.size !== qtList.length) {
143
+ queryParams.push(`qt=${qtList.map((t) => t.slice(3, t.length)).join(",")}`);
144
+ }
145
+ if (!gameSectionFirst) {
146
+ queryParams.push("game-section-first=false");
147
+ }
148
+ if (queryParams.length > 0) {
149
+ advancedUrl = `${domain}?${queryParams.join("&")}`;
150
+ } else {
151
+ advancedUrl = domain;
152
+ }
153
+ };
82
154
  $:
83
- mainVisibility = letChaos && !chaosDone ? "hidden" : "visible";
155
+ gameSectionFirst, qtMap, updateUrl();
84
156
  </script>
85
157
 
86
158
  <SeaweedBaseLayout bind:shouldDisplayLeadingIcons={isSocialsGone}>
@@ -217,21 +289,46 @@ $:
217
289
 
218
290
  </div>
219
291
 
220
- <GameSection email={email}></GameSection>
221
-
222
- <ProjectSection email={email}></ProjectSection>
292
+ {#if (gameSectionFirst)}
293
+ <GameSection email={email}></GameSection>
294
+ <ProjectSection email={email}></ProjectSection>
295
+ {:else }
296
+ <ProjectSection email={email}></ProjectSection>
297
+ <GameSection email={email}></GameSection>
298
+ {/if}
223
299
 
224
300
  <div aria-hidden="true" style="height: 25vh" />
225
301
 
226
302
  <Card>
227
- <div slot="content" class="default-card">
303
+ <div slot="content" class="default-card advanced-setting">
228
304
  <h1>Advanced settings</h1>
229
305
  <p>This one is for those curious how I customize this page.</p>
230
- <SlideToggle name="slider-label" bind:checked={isAdvanceSettingOn}>
306
+ <SlideToggle name="advanced-setting-slider" bind:checked={isAdvanceSettingOn}>
231
307
  Advanced settings: {isAdvanceSettingOn ? "On" : "Off"}
232
308
  </SlideToggle>
233
309
  {#if (isAdvanceSettingOn)}
310
+ <SlideToggle name="game-section-slider" bind:checked={gameSectionFirst}>
311
+ Should game section appear first over projects: {gameSectionFirst ? "On" : "Off"}
312
+ </SlideToggle>
313
+
314
+ <h3>Query terms to bold</h3>
315
+ <div class="query-term-grid">
316
+ {#each qtMap.entries() as [term, shouldBold]}
317
+ <!--{@const shouldBold = false}-->
318
+ <button
319
+ class="chip {shouldBold ? 'variant-filled-tertiary' : 'variant-soft-tertiary'}"
320
+ on:click={() => {toggleTerm(term)}}
321
+ >
322
+ <!-- todo: change shouldBold -->
323
+ {#if (shouldBold)}&check;{/if}
324
+ {term}
325
+ </button>
326
+ {/each}
327
+ </div>
328
+
234
329
  <br>
330
+ <p>Copy the url below and open a new page with it</p>
331
+ <CodeBlock language="url" code={advancedUrl}></CodeBlock>
235
332
  {/if}
236
333
  </div>
237
334
  </Card>
@@ -244,3 +341,22 @@ $:
244
341
  linkedinSlug={linkedinSlug}
245
342
  isSmallVersion={true}></SocialSection>
246
343
  </SeaweedBaseLayout>
344
+
345
+ <style>
346
+ .advanced-setting {
347
+ display: flex;
348
+ flex-direction: column;
349
+ gap: 0.5lh;
350
+ }
351
+
352
+ h3 {
353
+ font-size: 1.5em;
354
+ line-height: 1.5lh;
355
+ }
356
+
357
+ .query-term-grid {
358
+ display: flex;
359
+ gap: 0.25em;
360
+ flex-wrap: wrap;
361
+ }
362
+ </style>
@@ -6,6 +6,7 @@ declare const __propDef: {
6
6
  name?: string | undefined;
7
7
  email?: string | undefined;
8
8
  linkedinSlug?: string | undefined;
9
+ domain?: string | undefined;
9
10
  };
10
11
  events: {
11
12
  [evt: string]: CustomEvent<any>;
@@ -130,4 +130,4 @@ h2 {
130
130
 
131
131
  .accordion-header {
132
132
  margin-top: 0.25em;
133
- }
133
+ }
@@ -5,3 +5,6 @@ export interface ExternalLinkWarningArgs {
5
5
  href: string;
6
6
  }
7
7
  export declare const createExternalLinkWarningFunction: (args: ExternalLinkWarningArgs) => (() => void);
8
+ export interface RawGlob {
9
+ default: string;
10
+ }
@@ -21,7 +21,7 @@ export const options = {
21
21
  app: ({ head, body, assets, nonce, env }) => "<!DOCTYPE html>\n<html lang=\"en\">\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<link rel=\"icon\" href=\"" + assets + "/favicon.png\" />\n\t\t<meta name=\"viewport\" content=\"width=device-width\" />\n\t\t" + head + "\n\t</head>\n\n\t<body data-sveltekit-preload-data=\"hover\" data-theme=\"crimson\">\n\t\t<div style=\"display: contents\" class=\"h-full overflow-hidden\">" + body + "</div>\n\t</body>\n</html>\n",
22
22
  error: ({ status, message }) => "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<title>" + message + "</title>\n\n\t\t<style>\n\t\t\tbody {\n\t\t\t\t--bg: white;\n\t\t\t\t--fg: #222;\n\t\t\t\t--divider: #ccc;\n\t\t\t\tbackground: var(--bg);\n\t\t\t\tcolor: var(--fg);\n\t\t\t\tfont-family:\n\t\t\t\t\tsystem-ui,\n\t\t\t\t\t-apple-system,\n\t\t\t\t\tBlinkMacSystemFont,\n\t\t\t\t\t'Segoe UI',\n\t\t\t\t\tRoboto,\n\t\t\t\t\tOxygen,\n\t\t\t\t\tUbuntu,\n\t\t\t\t\tCantarell,\n\t\t\t\t\t'Open Sans',\n\t\t\t\t\t'Helvetica Neue',\n\t\t\t\t\tsans-serif;\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\tmargin: 0;\n\t\t\t}\n\n\t\t\t.error {\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tmax-width: 32rem;\n\t\t\t\tmargin: 0 1rem;\n\t\t\t}\n\n\t\t\t.status {\n\t\t\t\tfont-weight: 200;\n\t\t\t\tfont-size: 3rem;\n\t\t\t\tline-height: 1;\n\t\t\t\tposition: relative;\n\t\t\t\ttop: -0.05rem;\n\t\t\t}\n\n\t\t\t.message {\n\t\t\t\tborder-left: 1px solid var(--divider);\n\t\t\t\tpadding: 0 0 0 1rem;\n\t\t\t\tmargin: 0 0 0 1rem;\n\t\t\t\tmin-height: 2.5rem;\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t}\n\n\t\t\t.message h1 {\n\t\t\t\tfont-weight: 400;\n\t\t\t\tfont-size: 1em;\n\t\t\t\tmargin: 0;\n\t\t\t}\n\n\t\t\t@media (prefers-color-scheme: dark) {\n\t\t\t\tbody {\n\t\t\t\t\t--bg: #222;\n\t\t\t\t\t--fg: #ddd;\n\t\t\t\t\t--divider: #666;\n\t\t\t\t}\n\t\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<div class=\"error\">\n\t\t\t<span class=\"status\">" + status + "</span>\n\t\t\t<div class=\"message\">\n\t\t\t\t<h1>" + message + "</h1>\n\t\t\t</div>\n\t\t</div>\n\t</body>\n</html>\n"
23
23
  },
24
- version_hash: "1cu0e7k"
24
+ version_hash: "oftg2b"
25
25
  };
26
26
 
27
27
  export async function get_hooks() {
@@ -2,10 +2,11 @@
2
2
  export let name = "Turnip";
3
3
  export let email = "turnipxenon@gmail.com";
4
4
  export let linkedinSlug = "turnip-xenon";
5
+ export let domain = "http://localhost:5173/portfolio/actual/";
5
6
  import SocialSection from "../../components/SocialSection.svelte";
6
7
  import "./seaweed.postcss";
7
8
  import SeaweedBaseLayout from "../../components/layouts/SeaweedBaseLayout.svelte";
8
- import { Accordion, AccordionItem, SlideToggle } from "@skeletonlabs/skeleton";
9
+ import { Accordion, AccordionItem, CodeBlock, SlideToggle } from "@skeletonlabs/skeleton";
9
10
  import { page } from "$app/stores";
10
11
  import Card from "../../components/Card.svelte";
11
12
  import { onMount } from "svelte";
@@ -16,9 +17,49 @@ let isVisible = true;
16
17
  let isAdvanceSettingOn = false;
17
18
  $:
18
19
  isSocialsGone = !isVisible;
20
+ import gameContent from "./GameSection.svelte?raw";
21
+ import projectContent from "./ProjectSection.svelte?raw";
22
+ import selfContent from "./SeaweedTemplate.svelte?raw";
23
+ let qtMap = /* @__PURE__ */ new Map();
24
+ const paramQTSet = /* @__PURE__ */ new Set();
25
+ const syncQT = () => {
26
+ if (qtMap.size === 0 || paramQTSet.size === 0) {
27
+ return;
28
+ }
29
+ qtMap.forEach((_, k) => {
30
+ qtMap.set(k, paramQTSet.has(k));
31
+ });
32
+ qtMap = qtMap;
33
+ };
34
+ const parseQTTerms = async () => {
35
+ const qtSet = /* @__PURE__ */ new Set();
36
+ const rawTermList = [];
37
+ [gameContent, projectContent, selfContent].forEach((body) => {
38
+ rawTermList.push(
39
+ ...body.split('"').filter((s) => s.startsWith("qt-"))
40
+ // step 2: filter out texts that does not begin with "qt-"
41
+ );
42
+ });
43
+ rawTermList.forEach((t) => {
44
+ t.split(" ").forEach((nt) => {
45
+ if (["qt-1", "qt-2", "qt-*", "qt-"].includes(nt)) {
46
+ return;
47
+ }
48
+ qtSet.add(nt);
49
+ });
50
+ });
51
+ qtSet.forEach((t) => qtMap.set(t, true));
52
+ syncQT();
53
+ };
54
+ parseQTTerms();
55
+ let gameSectionFirst = true;
19
56
  let qtfontWeight = "normal";
20
57
  let additionalFontWeight = "";
21
58
  const filterSearchParams = (searchParams) => {
59
+ const gameSectionFirstParam = searchParams.get("game-section-first")?.trim();
60
+ if (gameSectionFirstParam === "false") {
61
+ gameSectionFirst = false;
62
+ }
22
63
  const qtValue = searchParams.get("qt")?.trim();
23
64
  if (qtValue === void 0) {
24
65
  qtfontWeight = "bold";
@@ -26,12 +67,14 @@ const filterSearchParams = (searchParams) => {
26
67
  }
27
68
  qtfontWeight = "normal";
28
69
  const dynamicStyle = qtValue.split(",").map((term) => {
70
+ paramQTSet.add(`qt-${term}`);
29
71
  return `span.qt-${term} { font-weight: bold !important; }`;
30
72
  }).join("\n");
31
73
  const style = document.createElement("style");
32
74
  style.type = "text/css";
33
75
  style.innerText = dynamicStyle;
34
76
  document.head.appendChild(style);
77
+ syncQT();
35
78
  };
36
79
  const chaoticWordBank = ["niko", "toba", "seal", "aquarium", "ojisan", "baikal"];
37
80
  let chaosDone = false;
@@ -69,6 +112,9 @@ const runChaos = (node) => {
69
112
  }
70
113
  }
71
114
  };
115
+ let mainVisibility = "visible";
116
+ $:
117
+ mainVisibility = letChaos && !chaosDone ? "hidden" : "visible";
72
118
  onMount(() => {
73
119
  if (!letChaos && $page.url.searchParams) {
74
120
  filterSearchParams($page.url.searchParams);
@@ -78,9 +124,35 @@ onMount(() => {
78
124
  chaosDone = true;
79
125
  }
80
126
  });
81
- let mainVisibility = "visible";
127
+ const toggleTerm = (term) => {
128
+ qtMap.set(term, !qtMap.get(term));
129
+ qtMap = qtMap;
130
+ };
131
+ let advancedUrl = domain;
132
+ const updateUrl = () => {
133
+ const queryParams = [];
134
+ const qtList = [];
135
+ qtMap.forEach((shouldBold, term) => {
136
+ if (shouldBold) {
137
+ qtList.push(term);
138
+ }
139
+ });
140
+ if (qtList.length === 0) {
141
+ queryParams.push("qt=clear");
142
+ } else if (qtMap.size !== qtList.length) {
143
+ queryParams.push(`qt=${qtList.map((t) => t.slice(3, t.length)).join(",")}`);
144
+ }
145
+ if (!gameSectionFirst) {
146
+ queryParams.push("game-section-first=false");
147
+ }
148
+ if (queryParams.length > 0) {
149
+ advancedUrl = `${domain}?${queryParams.join("&")}`;
150
+ } else {
151
+ advancedUrl = domain;
152
+ }
153
+ };
82
154
  $:
83
- mainVisibility = letChaos && !chaosDone ? "hidden" : "visible";
155
+ gameSectionFirst, qtMap, updateUrl();
84
156
  </script>
85
157
 
86
158
  <SeaweedBaseLayout bind:shouldDisplayLeadingIcons={isSocialsGone}>
@@ -217,21 +289,46 @@ $:
217
289
 
218
290
  </div>
219
291
 
220
- <GameSection email={email}></GameSection>
221
-
222
- <ProjectSection email={email}></ProjectSection>
292
+ {#if (gameSectionFirst)}
293
+ <GameSection email={email}></GameSection>
294
+ <ProjectSection email={email}></ProjectSection>
295
+ {:else }
296
+ <ProjectSection email={email}></ProjectSection>
297
+ <GameSection email={email}></GameSection>
298
+ {/if}
223
299
 
224
300
  <div aria-hidden="true" style="height: 25vh" />
225
301
 
226
302
  <Card>
227
- <div slot="content" class="default-card">
303
+ <div slot="content" class="default-card advanced-setting">
228
304
  <h1>Advanced settings</h1>
229
305
  <p>This one is for those curious how I customize this page.</p>
230
- <SlideToggle name="slider-label" bind:checked={isAdvanceSettingOn}>
306
+ <SlideToggle name="advanced-setting-slider" bind:checked={isAdvanceSettingOn}>
231
307
  Advanced settings: {isAdvanceSettingOn ? "On" : "Off"}
232
308
  </SlideToggle>
233
309
  {#if (isAdvanceSettingOn)}
310
+ <SlideToggle name="game-section-slider" bind:checked={gameSectionFirst}>
311
+ Should game section appear first over projects: {gameSectionFirst ? "On" : "Off"}
312
+ </SlideToggle>
313
+
314
+ <h3>Query terms to bold</h3>
315
+ <div class="query-term-grid">
316
+ {#each qtMap.entries() as [term, shouldBold]}
317
+ <!--{@const shouldBold = false}-->
318
+ <button
319
+ class="chip {shouldBold ? 'variant-filled-tertiary' : 'variant-soft-tertiary'}"
320
+ on:click={() => {toggleTerm(term)}}
321
+ >
322
+ <!-- todo: change shouldBold -->
323
+ {#if (shouldBold)}&check;{/if}
324
+ {term}
325
+ </button>
326
+ {/each}
327
+ </div>
328
+
234
329
  <br>
330
+ <p>Copy the url below and open a new page with it</p>
331
+ <CodeBlock language="url" code={advancedUrl}></CodeBlock>
235
332
  {/if}
236
333
  </div>
237
334
  </Card>
@@ -244,3 +341,22 @@ $:
244
341
  linkedinSlug={linkedinSlug}
245
342
  isSmallVersion={true}></SocialSection>
246
343
  </SeaweedBaseLayout>
344
+
345
+ <style>
346
+ .advanced-setting {
347
+ display: flex;
348
+ flex-direction: column;
349
+ gap: 0.5lh;
350
+ }
351
+
352
+ h3 {
353
+ font-size: 1.5em;
354
+ line-height: 1.5lh;
355
+ }
356
+
357
+ .query-term-grid {
358
+ display: flex;
359
+ gap: 0.25em;
360
+ flex-wrap: wrap;
361
+ }
362
+ </style>
@@ -6,6 +6,7 @@ declare const __propDef: {
6
6
  name?: string | undefined;
7
7
  email?: string | undefined;
8
8
  linkedinSlug?: string | undefined;
9
+ domain?: string | undefined;
9
10
  };
10
11
  events: {
11
12
  [evt: string]: CustomEvent<any>;
@@ -130,4 +130,4 @@ h2 {
130
130
 
131
131
  .accordion-header {
132
132
  margin-top: 0.25em;
133
- }
133
+ }
@@ -5,3 +5,6 @@ export interface ExternalLinkWarningArgs {
5
5
  href: string;
6
6
  }
7
7
  export declare const createExternalLinkWarningFunction: (args: ExternalLinkWarningArgs) => (() => void);
8
+ export interface RawGlob {
9
+ default: string;
10
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@turnipxenon/pineapple",
3
3
  "description": "personal package for base styling for other personal projects",
4
- "version": "2.4.24",
4
+ "version": "2.4.25",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
7
7
  "build": "npm run check-requirements && vite build && yarn package",
@@ -3,11 +3,12 @@
3
3
  export let name = "Turnip";
4
4
  export let email = "turnipxenon@gmail.com";
5
5
  export let linkedinSlug = "turnip-xenon";
6
+ export let domain = "http://localhost:5173/portfolio/actual/";
6
7
 
7
8
  import SocialSection from "$pkg/components/SocialSection.svelte";
8
9
  import "./seaweed.postcss";
9
10
  import SeaweedBaseLayout from "$pkg/components/layouts/SeaweedBaseLayout.svelte";
10
- import { Accordion, AccordionItem, SlideToggle } from "@skeletonlabs/skeleton";
11
+ import { Accordion, AccordionItem, CodeBlock, SlideToggle } from "@skeletonlabs/skeleton";
11
12
  import { page } from "$app/stores";
12
13
  import Card from "$pkg/components/Card.svelte";
13
14
  import { onMount } from "svelte";
@@ -20,11 +21,71 @@
20
21
 
21
22
  $: isSocialsGone = !isVisible;
22
23
 
24
+ // region query params
25
+ import gameContent from "./GameSection.svelte?raw";
26
+ import projectContent from "./ProjectSection.svelte?raw";
27
+ import selfContent from "./SeaweedTemplate.svelte?raw";
23
28
 
29
+ let qtMap = new Map<string, boolean>();
30
+ const paramQTSet = new Set<string>();
31
+
32
+ const syncQT = () => {
33
+ if (qtMap.size === 0 || paramQTSet.size === 0) {
34
+ return;
35
+ }
36
+
37
+ qtMap.forEach((_, k) => {
38
+ qtMap.set(k, paramQTSet.has(k));
39
+ });
40
+
41
+ // force svelte refresh
42
+ qtMap = qtMap;
43
+ };
44
+
45
+ const parseQTTerms = async () => {
46
+ const qtSet = new Set<string>();
47
+ const rawTermList: string[] = [];
48
+ [gameContent, projectContent, selfContent].forEach(body => {
49
+ // parse the qt-* term which exists within elements like:
50
+ // <span class="qt-*">TERM</span>
51
+ rawTermList.push(
52
+ ...body // step 3: destructure the array
53
+ .split("\"") // step 1: split the text as double quotations (") as the delimiter
54
+ .filter(s => s.startsWith("qt-")) // step 2: filter out texts that does not begin with "qt-"
55
+ );
56
+ });
57
+
58
+ // step 4: some spans contain multiple classes, split them up
59
+ // then add them to qtTerms
60
+ // e.g. <span class="qt-1 qt-2">TERM</span>
61
+ rawTermList.forEach(t => {
62
+ t.split(" ").forEach(nt => {
63
+ // filter out some of this meta terms
64
+ if (["qt-1", "qt-2", "qt-*", "qt-"].includes(nt)) {
65
+ return;
66
+ }
67
+
68
+ // adding to set ensures the entry is unique
69
+ qtSet.add(nt);
70
+ });
71
+ });
72
+
73
+ // activate svelte reactivity
74
+ qtSet.forEach(t => qtMap.set(t, true));
75
+ syncQT();
76
+ };
77
+ parseQTTerms();
78
+
79
+ // todo: fix fragile relative reference to the root
80
+ // const fileList = import.meta.glob("./**/+page.svelte", { query: "?raw", eager: true });
81
+ // const titleToLink = new Map<string, string>();
82
+
83
+ let gameSectionFirst = true;
24
84
  let qtfontWeight = "normal";
25
85
  let additionalFontWeight = "";
26
86
  /** qt values and what they mean:
27
87
  * undefined: set all qt terms to font-weight: bold
88
+ * todo: implement clear
28
89
  * clear: unset all terms to font-weight: normal
29
90
  * <term>: only set qt-<term> to bold
30
91
  * <term1>,<term2>: only set qt-<term1> and qt-<term2> to bold,
@@ -32,6 +93,12 @@
32
93
  * ONLY CALL INSIDE onMount()
33
94
  **/
34
95
  const filterSearchParams = (searchParams: URLSearchParams) => {
96
+ const gameSectionFirstParam = searchParams.get("game-section-first")?.trim();
97
+ if (gameSectionFirstParam === "false") {
98
+ gameSectionFirst = false;
99
+ }
100
+
101
+ // region Bold terms
35
102
  const qtValue = searchParams.get("qt")?.trim();
36
103
  if (qtValue === undefined) {
37
104
  qtfontWeight = "bold";
@@ -39,6 +106,10 @@
39
106
  }
40
107
  qtfontWeight = "normal";
41
108
  const dynamicStyle = qtValue.split(",").map((term) => {
109
+ // side-effect
110
+ paramQTSet.add(`qt-${term}`);
111
+
112
+ // main effect
42
113
  return `span.qt-${term} { font-weight: bold !important; }`;
43
114
  }).join("\n");
44
115
 
@@ -48,7 +119,10 @@
48
119
  style.type = "text/css";
49
120
  style.innerText = dynamicStyle;
50
121
  document.head.appendChild(style);
122
+ syncQT();
123
+ // endregion Bold terms
51
124
  };
125
+ // endregion query params
52
126
 
53
127
  /* region chaos scripts */
54
128
  const chaoticWordBank = ["niko", "toba", "seal", "aquarium", "ojisan", "baikal"];
@@ -96,6 +170,10 @@
96
170
  }
97
171
  };
98
172
 
173
+ let mainVisibility = "visible";
174
+ $: mainVisibility = letChaos && !chaosDone ? "hidden" : "visible";
175
+ /* endregion chaos scripts */
176
+
99
177
  onMount(() => {
100
178
  if (!letChaos && $page.url.searchParams) {
101
179
  filterSearchParams($page.url.searchParams);
@@ -107,9 +185,45 @@
107
185
  }
108
186
  });
109
187
 
110
- let mainVisibility = "visible";
111
- $: mainVisibility = letChaos && !chaosDone ? "hidden" : "visible";
112
- /* endregion chaos scripts */
188
+ const toggleTerm = (term: string) => {
189
+ qtMap.set(term, !qtMap.get(term));
190
+ qtMap = qtMap;
191
+ };
192
+
193
+ // when either gameSectionFirst or the queryTerms are updated, update advancedUrl
194
+ let advancedUrl = domain;
195
+ const updateUrl = () => {
196
+ const queryParams: string[] = [];
197
+
198
+ const qtList: string[] = [];
199
+ qtMap.forEach((shouldBold, term) => {
200
+ if (shouldBold) {
201
+ qtList.push(term);
202
+ }
203
+ });
204
+
205
+ if (qtList.length === 0) {
206
+ queryParams.push("qt=clear");
207
+ } else if (qtMap.size !== qtList.length) {
208
+ // we'll only add if the lengths are not equal
209
+ // dont need to add query if all terms in qtMap is true
210
+ queryParams.push(`qt=${qtList.map(t => t.slice(3, t.length)).join(",")}`);
211
+ }
212
+
213
+ if (!gameSectionFirst) {
214
+ queryParams.push("game-section-first=false");
215
+ }
216
+
217
+ if (queryParams.length > 0) {
218
+ advancedUrl = `${domain}?${queryParams.join("&")}`;
219
+ } else {
220
+ advancedUrl = domain;
221
+ }
222
+ // advancedUrl = `${domain}?${q}`;
223
+ };
224
+ $: // noinspection CommaExpressionJS
225
+ gameSectionFirst, qtMap, updateUrl();
226
+ // $: gameSectionQuery = gameSectionFirst ? "" : "game-section-first=false";
113
227
  </script>
114
228
 
115
229
  <SeaweedBaseLayout bind:shouldDisplayLeadingIcons={isSocialsGone}>
@@ -246,21 +360,46 @@
246
360
 
247
361
  </div>
248
362
 
249
- <GameSection email={email}></GameSection>
250
-
251
- <ProjectSection email={email}></ProjectSection>
363
+ {#if (gameSectionFirst)}
364
+ <GameSection email={email}></GameSection>
365
+ <ProjectSection email={email}></ProjectSection>
366
+ {:else }
367
+ <ProjectSection email={email}></ProjectSection>
368
+ <GameSection email={email}></GameSection>
369
+ {/if}
252
370
 
253
371
  <div aria-hidden="true" style="height: 25vh" />
254
372
 
255
373
  <Card>
256
- <div slot="content" class="default-card">
374
+ <div slot="content" class="default-card advanced-setting">
257
375
  <h1>Advanced settings</h1>
258
376
  <p>This one is for those curious how I customize this page.</p>
259
- <SlideToggle name="slider-label" bind:checked={isAdvanceSettingOn}>
377
+ <SlideToggle name="advanced-setting-slider" bind:checked={isAdvanceSettingOn}>
260
378
  Advanced settings: {isAdvanceSettingOn ? "On" : "Off"}
261
379
  </SlideToggle>
262
380
  {#if (isAdvanceSettingOn)}
381
+ <SlideToggle name="game-section-slider" bind:checked={gameSectionFirst}>
382
+ Should game section appear first over projects: {gameSectionFirst ? "On" : "Off"}
383
+ </SlideToggle>
384
+
385
+ <h3>Query terms to bold</h3>
386
+ <div class="query-term-grid">
387
+ {#each qtMap.entries() as [term, shouldBold]}
388
+ <!--{@const shouldBold = false}-->
389
+ <button
390
+ class="chip {shouldBold ? 'variant-filled-tertiary' : 'variant-soft-tertiary'}"
391
+ on:click={() => {toggleTerm(term)}}
392
+ >
393
+ <!-- todo: change shouldBold -->
394
+ {#if (shouldBold)}&check;{/if}
395
+ {term}
396
+ </button>
397
+ {/each}
398
+ </div>
399
+
263
400
  <br>
401
+ <p>Copy the url below and open a new page with it</p>
402
+ <CodeBlock language="url" code={advancedUrl}></CodeBlock>
264
403
  {/if}
265
404
  </div>
266
405
  </Card>
@@ -273,3 +412,22 @@
273
412
  linkedinSlug={linkedinSlug}
274
413
  isSmallVersion={true}></SocialSection>
275
414
  </SeaweedBaseLayout>
415
+
416
+ <style lang="postcss">
417
+ .advanced-setting {
418
+ display: flex;
419
+ flex-direction: column;
420
+ gap: 0.5lh;
421
+ }
422
+
423
+ h3 {
424
+ font-size: 1.5em;
425
+ line-height: 1.5lh;
426
+ }
427
+
428
+ .query-term-grid {
429
+ display: flex;
430
+ gap: 0.25em;
431
+ flex-wrap: wrap;
432
+ }
433
+ </style>
@@ -130,4 +130,4 @@ h2 {
130
130
 
131
131
  .accordion-header {
132
132
  margin-top: 0.25em;
133
- }
133
+ }
@@ -32,3 +32,7 @@ export const createExternalLinkWarningFunction = (args: ExternalLinkWarningArgs)
32
32
  location.href = args.href;
33
33
  });
34
34
  };
35
+
36
+ export interface RawGlob {
37
+ default: string;
38
+ }
@@ -7,6 +7,24 @@
7
7
  import "$lib/app.postcss";
8
8
 
9
9
  import "$lib/styles/global.css";
10
+
11
+ // region Skeleton Store
12
+
13
+ // endregion Skeleton Store
14
+
15
+ // region highlightjs
16
+ import { initializeStores, storeHighlightJs } from "@skeletonlabs/skeleton";
17
+ import "highlight.js/styles/github-dark.css";
18
+
19
+ import xml from "highlight.js/lib/languages/xml"; // for HTML
20
+ import hljs from "highlight.js/lib/core";
21
+
22
+ initializeStores();
23
+
24
+ hljs.registerLanguage("xml", xml);
25
+ hljs.registerLanguage("url", xml);
26
+ storeHighlightJs.set(hljs);
27
+ // endregion highlightjs
10
28
  </script>
11
29
 
12
30
  <slot />