@turnipxenon/pineapple 2.4.54 → 2.4.56
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 +60 -53
- package/.svelte-kit/__package__/index.d.ts +1 -0
- package/.svelte-kit/__package__/index.js +1 -0
- package/.svelte-kit/__package__/template/seaweed/CreateUrlForm.svelte +54 -0
- package/.svelte-kit/__package__/template/seaweed/CreateUrlForm.svelte.d.ts +16 -0
- package/.svelte-kit/__package__/template/seaweed/SeaweedTemplate.svelte +6 -4
- package/.svelte-kit/__package__/template/seaweed/SeaweedTemplate.svelte.d.ts +0 -2
- package/.svelte-kit/__package__/template/seaweed/SeaweedTemplateData.d.ts +7 -3
- package/.svelte-kit/__package__/template/seaweed/SeaweedTemplateData.js +16 -2
- package/.svelte-kit/__package__/template/seaweed/entries/ThisWebpage.svelte +2 -0
- package/.svelte-kit/__package__/types/api/CreateUrl.d.ts +15 -0
- package/.svelte-kit/__package__/types/api/CreateUrl.js +19 -0
- package/.svelte-kit/__package__/types/api/index.d.ts +1 -0
- package/.svelte-kit/__package__/types/api/index.js +2 -0
- package/.svelte-kit/ambient.d.ts +2 -4
- package/.svelte-kit/generated/server/internal.js +1 -1
- package/.svelte-kit/types/route_meta_data.json +3 -0
- package/.svelte-kit/types/src/routes/api/create-url/$types.d.ts +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/template/seaweed/CreateUrlForm.svelte +54 -0
- package/dist/template/seaweed/CreateUrlForm.svelte.d.ts +16 -0
- package/dist/template/seaweed/SeaweedTemplate.svelte +6 -4
- package/dist/template/seaweed/SeaweedTemplate.svelte.d.ts +0 -2
- package/dist/template/seaweed/SeaweedTemplateData.d.ts +7 -3
- package/dist/template/seaweed/SeaweedTemplateData.js +16 -2
- package/dist/template/seaweed/entries/ThisWebpage.svelte +2 -0
- package/dist/types/api/CreateUrl.d.ts +15 -0
- package/dist/types/api/CreateUrl.js +19 -0
- package/dist/types/api/index.d.ts +1 -0
- package/dist/types/api/index.js +2 -0
- package/package.json +1 -1
- package/src/lib/index.ts +1 -0
- package/src/lib/template/seaweed/CreateUrlForm.svelte +58 -0
- package/src/lib/template/seaweed/SeaweedTemplate.svelte +6 -4
- package/src/lib/template/seaweed/SeaweedTemplateData.ts +23 -4
- package/src/lib/template/seaweed/entries/ThisWebpage.svelte +2 -0
- package/src/lib/types/api/CreateUrl.ts +30 -0
- package/src/lib/types/api/index.ts +3 -0
- package/src/routes/(seaweed)/+layout.svelte +2 -1
- package/src/routes/(seaweed)/portfolio/actual/+page.svelte +2 -3
- package/src/routes/api/create-url/+server.ts +24 -0
- package/src/routes/(seaweed)/portfolio/actual/RandomComponent.svelte +0 -7
package/.idea/workspace.xml
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
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="
|
|
8
|
-
<change afterPath="$PROJECT_DIR$/src/lib/template/seaweed/ParseQueryTerms.ts" afterDir="false" />
|
|
7
|
+
<list default="true" id="accb6ba2-c343-4f84-ad30-6e2d71eceee5" name="CreateUrlForm" comment="Add CreateUrl UI">
|
|
9
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
|
+
<change beforePath="$PROJECT_DIR$/src/lib/template/seaweed/SeaweedTemplateData.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/lib/template/seaweed/SeaweedTemplateData.ts" afterDir="false" />
|
|
10
|
+
<change beforePath="$PROJECT_DIR$/src/lib/template/seaweed/entries/ThisWebpage.svelte" beforeDir="false" afterPath="$PROJECT_DIR$/src/lib/template/seaweed/entries/ThisWebpage.svelte" afterDir="false" />
|
|
10
11
|
</list>
|
|
11
12
|
<option name="SHOW_DIALOG" value="false" />
|
|
12
13
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
@@ -49,11 +50,12 @@
|
|
|
49
50
|
<option value="Soulwork" />
|
|
50
51
|
<option value="ItchPromo" />
|
|
51
52
|
<option value="EntryOrderConfig" />
|
|
52
|
-
<option value="TypeScript File" />
|
|
53
53
|
<option value="ComboBox" />
|
|
54
54
|
<option value="ComboBoxWithButton" />
|
|
55
55
|
<option value="CSS File" />
|
|
56
56
|
<option value="RandomComponent" />
|
|
57
|
+
<option value="UrlShortenerForm" />
|
|
58
|
+
<option value="TypeScript File" />
|
|
57
59
|
</list>
|
|
58
60
|
</option>
|
|
59
61
|
</component>
|
|
@@ -108,41 +110,41 @@
|
|
|
108
110
|
<option name="hideEmptyMiddlePackages" value="true" />
|
|
109
111
|
<option name="showLibraryContents" value="true" />
|
|
110
112
|
</component>
|
|
111
|
-
<component name="PropertiesComponent"
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
113
|
+
<component name="PropertiesComponent">{
|
|
114
|
+
"keyToString": {
|
|
115
|
+
"DefaultHtmlFileTemplate": "HTML File",
|
|
116
|
+
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
|
117
|
+
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
118
|
+
"WebServerToolWindowFactoryState": "false",
|
|
119
|
+
"git-widget-placeholder": "turnip/customizable2",
|
|
120
|
+
"ignore.virus.scanning.warn.message": "true",
|
|
121
|
+
"last_opened_file_path": "C:/Users/Pumpkin/Projects/Web/pineapple/src/routes/api/create-url",
|
|
122
|
+
"list.type.of.created.stylesheet": "CSS",
|
|
123
|
+
"node.js.detected.package.eslint": "true",
|
|
124
|
+
"node.js.detected.package.tslint": "true",
|
|
125
|
+
"node.js.selected.package.eslint": "(autodetect)",
|
|
126
|
+
"node.js.selected.package.tslint": "(autodetect)",
|
|
127
|
+
"nodejs_interpreter_path": "node",
|
|
128
|
+
"nodejs_package_manager_path": "yarn",
|
|
129
|
+
"npm.build.executor": "Run",
|
|
130
|
+
"npm.dev (1).executor": "Run",
|
|
131
|
+
"npm.dev --open.executor": "Run",
|
|
132
|
+
"npm.dev offline.executor": "Run",
|
|
133
|
+
"npm.dev-offline.executor": "Run",
|
|
134
|
+
"npm.dev.executor": "Run",
|
|
135
|
+
"npm.to-dev.executor": "Run",
|
|
136
|
+
"settings.editor.selected.configurable": "preferences.general",
|
|
137
|
+
"ts.external.directory.path": "C:\\Users\\Pumpkin\\Projects\\Web\\pineapple\\node_modules\\typescript\\lib",
|
|
138
|
+
"vue.rearranger.settings.migration": "true"
|
|
137
139
|
}
|
|
138
|
-
}
|
|
140
|
+
}</component>
|
|
139
141
|
<component name="RecentsManager">
|
|
140
142
|
<key name="CopyFile.RECENT_KEYS">
|
|
143
|
+
<recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\routes\api\create-url" />
|
|
141
144
|
<recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\lib\template\seaweed" />
|
|
142
145
|
<recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\lib\template\seaweed\entries" />
|
|
143
146
|
<recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\routes\(pineapple)\pineapple\(extra-pages)\page3\page7\(test_layout)\page8" />
|
|
144
147
|
<recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\routes\(pineapple)\pineapple\(extra-pages)\page3\page5" />
|
|
145
|
-
<recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\routes\(pineapple)\pineapple\(extra-pages)\page2" />
|
|
146
148
|
</key>
|
|
147
149
|
<key name="MoveFile.RECENT_KEYS">
|
|
148
150
|
<recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\lib\components\combo_box" />
|
|
@@ -330,23 +332,12 @@
|
|
|
330
332
|
<workItem from="1712534451700" duration="490000" />
|
|
331
333
|
<workItem from="1712535021202" duration="299000" />
|
|
332
334
|
<workItem from="1712535434722" duration="522000" />
|
|
333
|
-
<workItem from="1712536086680" duration="
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
<
|
|
337
|
-
<
|
|
338
|
-
<
|
|
339
|
-
<option name="presentableId" value="LOCAL-00119" />
|
|
340
|
-
<option name="project" value="LOCAL" />
|
|
341
|
-
<updated>1711685062499</updated>
|
|
342
|
-
</task>
|
|
343
|
-
<task id="LOCAL-00120" summary="Change media to container">
|
|
344
|
-
<option name="closed" value="true" />
|
|
345
|
-
<created>1711685070024</created>
|
|
346
|
-
<option name="number" value="00120" />
|
|
347
|
-
<option name="presentableId" value="LOCAL-00120" />
|
|
348
|
-
<option name="project" value="LOCAL" />
|
|
349
|
-
<updated>1711685070024</updated>
|
|
335
|
+
<workItem from="1712536086680" duration="3657000" />
|
|
336
|
+
<workItem from="1712557998479" duration="1152000" />
|
|
337
|
+
<workItem from="1712560061741" duration="265000" />
|
|
338
|
+
<workItem from="1712560426380" duration="3011000" />
|
|
339
|
+
<workItem from="1712563659982" duration="1353000" />
|
|
340
|
+
<workItem from="1712570296984" duration="1345000" />
|
|
350
341
|
</task>
|
|
351
342
|
<task id="LOCAL-00121" summary="Add toggle to showcase pagination prevention">
|
|
352
343
|
<option name="closed" value="true" />
|
|
@@ -724,7 +715,23 @@
|
|
|
724
715
|
<option name="project" value="LOCAL" />
|
|
725
716
|
<updated>1712537061829</updated>
|
|
726
717
|
</task>
|
|
727
|
-
<
|
|
718
|
+
<task id="LOCAL-00168" summary="Change parseQueryTerm to parse during runtime on the DOM instead of on the raw svelte text">
|
|
719
|
+
<option name="closed" value="true" />
|
|
720
|
+
<created>1712543711416</created>
|
|
721
|
+
<option name="number" value="00168" />
|
|
722
|
+
<option name="presentableId" value="LOCAL-00168" />
|
|
723
|
+
<option name="project" value="LOCAL" />
|
|
724
|
+
<updated>1712543711416</updated>
|
|
725
|
+
</task>
|
|
726
|
+
<task id="LOCAL-00169" summary="Add CreateUrl UI">
|
|
727
|
+
<option name="closed" value="true" />
|
|
728
|
+
<created>1712563193335</created>
|
|
729
|
+
<option name="number" value="00169" />
|
|
730
|
+
<option name="presentableId" value="LOCAL-00169" />
|
|
731
|
+
<option name="project" value="LOCAL" />
|
|
732
|
+
<updated>1712563193335</updated>
|
|
733
|
+
</task>
|
|
734
|
+
<option name="localTasksCounter" value="170" />
|
|
728
735
|
<servers />
|
|
729
736
|
</component>
|
|
730
737
|
<component name="TypeScriptGeneratedFilesManager">
|
|
@@ -782,9 +789,6 @@
|
|
|
782
789
|
</option>
|
|
783
790
|
</component>
|
|
784
791
|
<component name="VcsManagerConfiguration">
|
|
785
|
-
<MESSAGE value="Implement cdktf for empty AppService" />
|
|
786
|
-
<MESSAGE value="WIP: cdktf" />
|
|
787
|
-
<MESSAGE value="Revert "Correct app_build_command in Azure SWA GithubActions" Revert b34caf17" />
|
|
788
792
|
<MESSAGE value="Temporarily delete workflow to let Azure auto-generate secrets" />
|
|
789
793
|
<MESSAGE value="Change npm to yarn in GithubActions" />
|
|
790
794
|
<MESSAGE value="Cancel migration to Azure" />
|
|
@@ -807,6 +811,9 @@
|
|
|
807
811
|
<MESSAGE value="Add logs to observe queryTermMap in downstream package" />
|
|
808
812
|
<MESSAGE value="Add logs to observe parseQtTerms in downstream package" />
|
|
809
813
|
<MESSAGE value="Move parseQtTerm on afterUpdate" />
|
|
810
|
-
<
|
|
814
|
+
<MESSAGE value="Change parseQueryTerm to parse during runtime on the DOM instead of on the raw svelte text" />
|
|
815
|
+
<MESSAGE value="Add dynamic url adder UI" />
|
|
816
|
+
<MESSAGE value="Add CreateUrl UI" />
|
|
817
|
+
<option name="LAST_COMMIT_MESSAGE" value="Add CreateUrl UI" />
|
|
811
818
|
</component>
|
|
812
819
|
</project>
|
|
@@ -5,6 +5,7 @@ export { default as Card } from "./components/Card.svelte";
|
|
|
5
5
|
export { default as SocialSection } from "./components/SocialSection.svelte";
|
|
6
6
|
export * from "./components/overrideable_meta/index";
|
|
7
7
|
export * from "./components/navigation_component/index";
|
|
8
|
+
export * from "./types/api/index";
|
|
8
9
|
export * from "./components/dialog_manager/DialogManagerStore";
|
|
9
10
|
export * from "./components/dialog_manager/DialogManager";
|
|
10
11
|
export * from "./components/dialog_manager/DialogUtils";
|
|
@@ -6,6 +6,7 @@ export { default as Card } from "./components/Card.svelte";
|
|
|
6
6
|
export { default as SocialSection } from "./components/SocialSection.svelte";
|
|
7
7
|
export * from "./components/overrideable_meta/index";
|
|
8
8
|
export * from "./components/navigation_component/index";
|
|
9
|
+
export * from "./types/api/index";
|
|
9
10
|
export * from "./components/dialog_manager/DialogManagerStore";
|
|
10
11
|
export * from "./components/dialog_manager/DialogManager";
|
|
11
12
|
export * from "./components/dialog_manager/DialogUtils";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script>import { CreateUrlResult, jsonToCreateUrlResponse } from "../../types/api/CreateUrl";
|
|
2
|
+
import { getToastStore } from "@skeletonlabs/skeleton";
|
|
3
|
+
export let queryParams = "";
|
|
4
|
+
const toastStore = getToastStore();
|
|
5
|
+
let request = {
|
|
6
|
+
queryParams: "",
|
|
7
|
+
shortUrl: "",
|
|
8
|
+
password: ""
|
|
9
|
+
};
|
|
10
|
+
$:
|
|
11
|
+
request.queryParams = queryParams;
|
|
12
|
+
const failToast = {
|
|
13
|
+
message: "Adding new url failed"
|
|
14
|
+
};
|
|
15
|
+
const toastMap = /* @__PURE__ */ new Map([
|
|
16
|
+
[CreateUrlResult.Success, {
|
|
17
|
+
message: "Successfully added new url"
|
|
18
|
+
}],
|
|
19
|
+
[CreateUrlResult.Duplicate, {
|
|
20
|
+
message: "Short url already used; try again with another url"
|
|
21
|
+
}],
|
|
22
|
+
[CreateUrlResult.Fail, failToast]
|
|
23
|
+
]);
|
|
24
|
+
const post = () => {
|
|
25
|
+
fetch("/api/create-url", {
|
|
26
|
+
method: "POST",
|
|
27
|
+
headers: {
|
|
28
|
+
"Content-Type": "application/json"
|
|
29
|
+
},
|
|
30
|
+
body: JSON.stringify(request)
|
|
31
|
+
}).then(
|
|
32
|
+
(resp) => resp.json()
|
|
33
|
+
).then((json) => {
|
|
34
|
+
const properResp = jsonToCreateUrlResponse(json);
|
|
35
|
+
toastStore.trigger(toastMap.get(properResp.result) ?? failToast);
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<div>
|
|
41
|
+
<label for="short-url">Short URL for url shortener</label>
|
|
42
|
+
<input bind:value={request.shortUrl}
|
|
43
|
+
name="short-url"
|
|
44
|
+
class="input"
|
|
45
|
+
type="text"
|
|
46
|
+
placeholder="short-url" />
|
|
47
|
+
<label for="password">Password</label>
|
|
48
|
+
<input bind:value={request.password}
|
|
49
|
+
name="password"
|
|
50
|
+
class="input"
|
|
51
|
+
type="password"
|
|
52
|
+
placeholder="Input" />
|
|
53
|
+
<button class="btn variant-filled" on:click={post}>Send link</button>
|
|
54
|
+
</div>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
queryParams?: string | undefined;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {};
|
|
10
|
+
};
|
|
11
|
+
export type CreateUrlFormProps = typeof __propDef.props;
|
|
12
|
+
export type CreateUrlFormEvents = typeof __propDef.events;
|
|
13
|
+
export type CreateUrlFormSlots = typeof __propDef.slots;
|
|
14
|
+
export default class CreateUrlForm extends SvelteComponent<CreateUrlFormProps, CreateUrlFormEvents, CreateUrlFormSlots> {
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -15,13 +15,13 @@ import {
|
|
|
15
15
|
TurnGroupEntriesMutable
|
|
16
16
|
} from "./SeaweedTemplateData";
|
|
17
17
|
import { parseQueryTerms } from "./ParseQueryTerms";
|
|
18
|
+
import UrlShortenerForm from "./CreateUrlForm.svelte";
|
|
18
19
|
export let letChaos = true;
|
|
19
20
|
export let name = "Turnip";
|
|
20
21
|
export let email = "turnipxenon@gmail.com";
|
|
21
22
|
export let linkedinSlug = "turnip-xenon";
|
|
22
23
|
export let domain = "http://localhost:5173/portfolio/actual/";
|
|
23
24
|
export let serverSideQueryParams = "";
|
|
24
|
-
export let extraComponent = void 0;
|
|
25
25
|
const entryProps = {
|
|
26
26
|
email
|
|
27
27
|
};
|
|
@@ -124,6 +124,7 @@ const toggleTerm = (term) => {
|
|
|
124
124
|
};
|
|
125
125
|
let orderUrl = "";
|
|
126
126
|
let advancedUrl = domain;
|
|
127
|
+
let advancedQuery = "";
|
|
127
128
|
const updateUrl = (seaweedTemplateData2) => {
|
|
128
129
|
const queryParams = [];
|
|
129
130
|
if (orderUrl) {
|
|
@@ -147,7 +148,8 @@ const updateUrl = (seaweedTemplateData2) => {
|
|
|
147
148
|
queryParams.push("game-section-first=false");
|
|
148
149
|
}
|
|
149
150
|
if (queryParams.length > 0) {
|
|
150
|
-
|
|
151
|
+
advancedQuery = queryParams.join("&");
|
|
152
|
+
advancedUrl = `${domain}?${advancedQuery}`;
|
|
151
153
|
} else {
|
|
152
154
|
advancedUrl = domain;
|
|
153
155
|
}
|
|
@@ -308,7 +310,7 @@ $:
|
|
|
308
310
|
|
|
309
311
|
<section class={group.gridClass}>
|
|
310
312
|
{#each group.items as entry}
|
|
311
|
-
<svelte:component this={entry} props={entryProps}></svelte:component>
|
|
313
|
+
<svelte:component this={entry.component} props={entryProps}></svelte:component>
|
|
312
314
|
{/each}
|
|
313
315
|
</section>
|
|
314
316
|
{/if}
|
|
@@ -358,7 +360,7 @@ $:
|
|
|
358
360
|
<p>Copy the url below and open a new page with it</p>
|
|
359
361
|
<CodeBlock language="url" code={advancedUrl}></CodeBlock>
|
|
360
362
|
|
|
361
|
-
<
|
|
363
|
+
<UrlShortenerForm queryParams={advancedQuery}></UrlShortenerForm>
|
|
362
364
|
{/if}
|
|
363
365
|
</div>
|
|
364
366
|
</Card>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import { type ComponentType } from "svelte";
|
|
3
2
|
import "./seaweed.postcss";
|
|
4
3
|
declare const __propDef: {
|
|
5
4
|
props: {
|
|
@@ -9,7 +8,6 @@ declare const __propDef: {
|
|
|
9
8
|
linkedinSlug?: string | undefined;
|
|
10
9
|
domain?: string | undefined;
|
|
11
10
|
serverSideQueryParams?: string | undefined;
|
|
12
|
-
extraComponent?: ComponentType | undefined;
|
|
13
11
|
};
|
|
14
12
|
events: {
|
|
15
13
|
[evt: string]: CustomEvent<any>;
|
|
@@ -3,9 +3,13 @@ export declare enum GroupGridClass {
|
|
|
3
3
|
Games = "games-section",
|
|
4
4
|
Projects = "projects-section"
|
|
5
5
|
}
|
|
6
|
+
export interface ComponentMeta {
|
|
7
|
+
name: string;
|
|
8
|
+
component: ComponentType;
|
|
9
|
+
}
|
|
6
10
|
export interface EntryGroup {
|
|
7
11
|
name: string;
|
|
8
|
-
items:
|
|
12
|
+
items: ComponentMeta[];
|
|
9
13
|
gridClass: string;
|
|
10
14
|
}
|
|
11
15
|
export declare const GameEntries: Readonly<EntryGroup>;
|
|
@@ -14,8 +18,8 @@ export declare const EmptyRelevantProjects: Readonly<EntryGroup>;
|
|
|
14
18
|
export declare const AllGroupedEntriesGameFirst: ReadonlyArray<EntryGroup>;
|
|
15
19
|
export declare const AllGroupedEntriesProjectFirst: ReadonlyArray<EntryGroup>;
|
|
16
20
|
export declare const lazyInitializeAllFlatEntries: () => void;
|
|
17
|
-
export declare const GetAllEntryFromGlobal: () => Map<string,
|
|
18
|
-
export declare const GetEntryFromGlobal: (name: string) =>
|
|
21
|
+
export declare const GetAllEntryFromGlobal: () => Map<string, ComponentMeta>;
|
|
22
|
+
export declare const GetEntryFromGlobal: (name: string) => ComponentMeta | undefined;
|
|
19
23
|
export declare const TurnGroupEntriesMutable: (allEntries: ReadonlyArray<EntryGroup>) => EntryGroup[];
|
|
20
24
|
export interface SeaweedTemplateData {
|
|
21
25
|
groupedEntries: EntryGroup[];
|
|
@@ -19,12 +19,26 @@ export var GroupGridClass;
|
|
|
19
19
|
})(GroupGridClass || (GroupGridClass = {}));
|
|
20
20
|
export const GameEntries = {
|
|
21
21
|
name: DefaultHeader.Games.toString(),
|
|
22
|
-
items: [
|
|
22
|
+
items: [
|
|
23
|
+
{ name: "Pengi", component: Pengi },
|
|
24
|
+
{ name: "Hepcat", component: Hepcat },
|
|
25
|
+
{ name: "Chef Wings", component: ChefWings },
|
|
26
|
+
{ name: "Soulwork", component: Soulwork },
|
|
27
|
+
{ name: "Itch Promo", component: ItchPromo }
|
|
28
|
+
],
|
|
23
29
|
gridClass: GroupGridClass.Games.toString()
|
|
24
30
|
};
|
|
25
31
|
export const ProjectEntries = {
|
|
26
32
|
name: DefaultHeader.Projects.toString(),
|
|
27
|
-
items: [
|
|
33
|
+
items: [
|
|
34
|
+
{ name: "Migrante Alberta", component: MigranteAlberta },
|
|
35
|
+
{ name: "Decentralized Social Media", component: DecentralizedSocialMedia },
|
|
36
|
+
{ name: "Customized YarnSpinner", component: CustomizedYarnspinner },
|
|
37
|
+
{ name: "Full Stack C", component: FullStackC },
|
|
38
|
+
{ name: "Workset", component: Workset },
|
|
39
|
+
{ name: "This Webpage", component: ThisWebpage },
|
|
40
|
+
{ name: "Mock Uber App", component: MockUberApp }
|
|
41
|
+
],
|
|
28
42
|
gridClass: GroupGridClass.Projects.toString()
|
|
29
43
|
};
|
|
30
44
|
export const EmptyRelevantProjects = {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface CreateUrlRequest {
|
|
2
|
+
queryParams: string;
|
|
3
|
+
shortUrl: string;
|
|
4
|
+
password: string;
|
|
5
|
+
}
|
|
6
|
+
export declare enum CreateUrlResult {
|
|
7
|
+
Fail = 0,
|
|
8
|
+
Success = 1,
|
|
9
|
+
Duplicate = 2
|
|
10
|
+
}
|
|
11
|
+
export interface CreateUrlResponse {
|
|
12
|
+
result: CreateUrlResult;
|
|
13
|
+
}
|
|
14
|
+
export declare const jsonToCreateUrlRequest: (json: Record<string, never>) => CreateUrlRequest;
|
|
15
|
+
export declare const jsonToCreateUrlResponse: (json: Record<string, never>) => CreateUrlResponse;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export var CreateUrlResult;
|
|
2
|
+
(function (CreateUrlResult) {
|
|
3
|
+
CreateUrlResult[CreateUrlResult["Fail"] = 0] = "Fail";
|
|
4
|
+
CreateUrlResult[CreateUrlResult["Success"] = 1] = "Success";
|
|
5
|
+
CreateUrlResult[CreateUrlResult["Duplicate"] = 2] = "Duplicate";
|
|
6
|
+
})(CreateUrlResult || (CreateUrlResult = {}));
|
|
7
|
+
export const jsonToCreateUrlRequest = (json) => {
|
|
8
|
+
return {
|
|
9
|
+
queryParams: json["queryParams"] ?? "",
|
|
10
|
+
shortUrl: json["shortUrl"] ?? "",
|
|
11
|
+
password: json["password"] ?? ""
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export const jsonToCreateUrlResponse = (json) => {
|
|
15
|
+
const enumIndex = json["result"];
|
|
16
|
+
return {
|
|
17
|
+
result: CreateUrlResult[enumIndex] ? enumIndex : CreateUrlResult.Fail
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./CreateUrl";
|
package/.svelte-kit/ambient.d.ts
CHANGED
|
@@ -37,8 +37,6 @@ declare module '$env/static/private' {
|
|
|
37
37
|
export const COMSPEC: string;
|
|
38
38
|
export const DriverData: string;
|
|
39
39
|
export const EXEPATH: string;
|
|
40
|
-
export const FPS_BROWSER_APP_PROFILE_STRING: string;
|
|
41
|
-
export const FPS_BROWSER_USER_PROFILE_STRING: string;
|
|
42
40
|
export const GIT_XL_PATH: string;
|
|
43
41
|
export const GoLand: string;
|
|
44
42
|
export const GOPATH: string;
|
|
@@ -165,6 +163,7 @@ declare module '$env/static/private' {
|
|
|
165
163
|
export const PUBLIC: string;
|
|
166
164
|
export const PWD: string;
|
|
167
165
|
export const PyCharm: string;
|
|
166
|
+
export const SESSIONNAME: string;
|
|
168
167
|
export const SHLVL: string;
|
|
169
168
|
export const SYSTEMDRIVE: string;
|
|
170
169
|
export const SYSTEMROOT: string;
|
|
@@ -229,8 +228,6 @@ declare module '$env/dynamic/private' {
|
|
|
229
228
|
COMSPEC: string;
|
|
230
229
|
DriverData: string;
|
|
231
230
|
EXEPATH: string;
|
|
232
|
-
FPS_BROWSER_APP_PROFILE_STRING: string;
|
|
233
|
-
FPS_BROWSER_USER_PROFILE_STRING: string;
|
|
234
231
|
GIT_XL_PATH: string;
|
|
235
232
|
GoLand: string;
|
|
236
233
|
GOPATH: string;
|
|
@@ -357,6 +354,7 @@ declare module '$env/dynamic/private' {
|
|
|
357
354
|
PUBLIC: string;
|
|
358
355
|
PWD: string;
|
|
359
356
|
PyCharm: string;
|
|
357
|
+
SESSIONNAME: string;
|
|
360
358
|
SHLVL: string;
|
|
361
359
|
SYSTEMDRIVE: string;
|
|
362
360
|
SYSTEMROOT: string;
|
|
@@ -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: "
|
|
24
|
+
version_hash: "rdpije"
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
export async function get_hooks() {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as Kit from '@sveltejs/kit';
|
|
2
|
+
|
|
3
|
+
type Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
type MatcherParam<M> = M extends (param : string) => param is infer U ? U extends string ? U : string : string;
|
|
6
|
+
type RouteParams = { };
|
|
7
|
+
type RouteId = '/api/create-url';
|
|
8
|
+
|
|
9
|
+
export type RequestHandler = Kit.RequestHandler<RouteParams, RouteId>;
|
|
10
|
+
export type RequestEvent = Kit.RequestEvent<RouteParams, RouteId>;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { default as Card } from "./components/Card.svelte";
|
|
|
5
5
|
export { default as SocialSection } from "./components/SocialSection.svelte";
|
|
6
6
|
export * from "./components/overrideable_meta/index";
|
|
7
7
|
export * from "./components/navigation_component/index";
|
|
8
|
+
export * from "./types/api/index";
|
|
8
9
|
export * from "./components/dialog_manager/DialogManagerStore";
|
|
9
10
|
export * from "./components/dialog_manager/DialogManager";
|
|
10
11
|
export * from "./components/dialog_manager/DialogUtils";
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export { default as Card } from "./components/Card.svelte";
|
|
|
6
6
|
export { default as SocialSection } from "./components/SocialSection.svelte";
|
|
7
7
|
export * from "./components/overrideable_meta/index";
|
|
8
8
|
export * from "./components/navigation_component/index";
|
|
9
|
+
export * from "./types/api/index";
|
|
9
10
|
export * from "./components/dialog_manager/DialogManagerStore";
|
|
10
11
|
export * from "./components/dialog_manager/DialogManager";
|
|
11
12
|
export * from "./components/dialog_manager/DialogUtils";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script>import { CreateUrlResult, jsonToCreateUrlResponse } from "../../types/api/CreateUrl";
|
|
2
|
+
import { getToastStore } from "@skeletonlabs/skeleton";
|
|
3
|
+
export let queryParams = "";
|
|
4
|
+
const toastStore = getToastStore();
|
|
5
|
+
let request = {
|
|
6
|
+
queryParams: "",
|
|
7
|
+
shortUrl: "",
|
|
8
|
+
password: ""
|
|
9
|
+
};
|
|
10
|
+
$:
|
|
11
|
+
request.queryParams = queryParams;
|
|
12
|
+
const failToast = {
|
|
13
|
+
message: "Adding new url failed"
|
|
14
|
+
};
|
|
15
|
+
const toastMap = /* @__PURE__ */ new Map([
|
|
16
|
+
[CreateUrlResult.Success, {
|
|
17
|
+
message: "Successfully added new url"
|
|
18
|
+
}],
|
|
19
|
+
[CreateUrlResult.Duplicate, {
|
|
20
|
+
message: "Short url already used; try again with another url"
|
|
21
|
+
}],
|
|
22
|
+
[CreateUrlResult.Fail, failToast]
|
|
23
|
+
]);
|
|
24
|
+
const post = () => {
|
|
25
|
+
fetch("/api/create-url", {
|
|
26
|
+
method: "POST",
|
|
27
|
+
headers: {
|
|
28
|
+
"Content-Type": "application/json"
|
|
29
|
+
},
|
|
30
|
+
body: JSON.stringify(request)
|
|
31
|
+
}).then(
|
|
32
|
+
(resp) => resp.json()
|
|
33
|
+
).then((json) => {
|
|
34
|
+
const properResp = jsonToCreateUrlResponse(json);
|
|
35
|
+
toastStore.trigger(toastMap.get(properResp.result) ?? failToast);
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<div>
|
|
41
|
+
<label for="short-url">Short URL for url shortener</label>
|
|
42
|
+
<input bind:value={request.shortUrl}
|
|
43
|
+
name="short-url"
|
|
44
|
+
class="input"
|
|
45
|
+
type="text"
|
|
46
|
+
placeholder="short-url" />
|
|
47
|
+
<label for="password">Password</label>
|
|
48
|
+
<input bind:value={request.password}
|
|
49
|
+
name="password"
|
|
50
|
+
class="input"
|
|
51
|
+
type="password"
|
|
52
|
+
placeholder="Input" />
|
|
53
|
+
<button class="btn variant-filled" on:click={post}>Send link</button>
|
|
54
|
+
</div>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
queryParams?: string | undefined;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {};
|
|
10
|
+
};
|
|
11
|
+
export type CreateUrlFormProps = typeof __propDef.props;
|
|
12
|
+
export type CreateUrlFormEvents = typeof __propDef.events;
|
|
13
|
+
export type CreateUrlFormSlots = typeof __propDef.slots;
|
|
14
|
+
export default class CreateUrlForm extends SvelteComponent<CreateUrlFormProps, CreateUrlFormEvents, CreateUrlFormSlots> {
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -15,13 +15,13 @@ import {
|
|
|
15
15
|
TurnGroupEntriesMutable
|
|
16
16
|
} from "./SeaweedTemplateData";
|
|
17
17
|
import { parseQueryTerms } from "./ParseQueryTerms";
|
|
18
|
+
import UrlShortenerForm from "./CreateUrlForm.svelte";
|
|
18
19
|
export let letChaos = true;
|
|
19
20
|
export let name = "Turnip";
|
|
20
21
|
export let email = "turnipxenon@gmail.com";
|
|
21
22
|
export let linkedinSlug = "turnip-xenon";
|
|
22
23
|
export let domain = "http://localhost:5173/portfolio/actual/";
|
|
23
24
|
export let serverSideQueryParams = "";
|
|
24
|
-
export let extraComponent = void 0;
|
|
25
25
|
const entryProps = {
|
|
26
26
|
email
|
|
27
27
|
};
|
|
@@ -124,6 +124,7 @@ const toggleTerm = (term) => {
|
|
|
124
124
|
};
|
|
125
125
|
let orderUrl = "";
|
|
126
126
|
let advancedUrl = domain;
|
|
127
|
+
let advancedQuery = "";
|
|
127
128
|
const updateUrl = (seaweedTemplateData2) => {
|
|
128
129
|
const queryParams = [];
|
|
129
130
|
if (orderUrl) {
|
|
@@ -147,7 +148,8 @@ const updateUrl = (seaweedTemplateData2) => {
|
|
|
147
148
|
queryParams.push("game-section-first=false");
|
|
148
149
|
}
|
|
149
150
|
if (queryParams.length > 0) {
|
|
150
|
-
|
|
151
|
+
advancedQuery = queryParams.join("&");
|
|
152
|
+
advancedUrl = `${domain}?${advancedQuery}`;
|
|
151
153
|
} else {
|
|
152
154
|
advancedUrl = domain;
|
|
153
155
|
}
|
|
@@ -308,7 +310,7 @@ $:
|
|
|
308
310
|
|
|
309
311
|
<section class={group.gridClass}>
|
|
310
312
|
{#each group.items as entry}
|
|
311
|
-
<svelte:component this={entry} props={entryProps}></svelte:component>
|
|
313
|
+
<svelte:component this={entry.component} props={entryProps}></svelte:component>
|
|
312
314
|
{/each}
|
|
313
315
|
</section>
|
|
314
316
|
{/if}
|
|
@@ -358,7 +360,7 @@ $:
|
|
|
358
360
|
<p>Copy the url below and open a new page with it</p>
|
|
359
361
|
<CodeBlock language="url" code={advancedUrl}></CodeBlock>
|
|
360
362
|
|
|
361
|
-
<
|
|
363
|
+
<UrlShortenerForm queryParams={advancedQuery}></UrlShortenerForm>
|
|
362
364
|
{/if}
|
|
363
365
|
</div>
|
|
364
366
|
</Card>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import { type ComponentType } from "svelte";
|
|
3
2
|
import "./seaweed.postcss";
|
|
4
3
|
declare const __propDef: {
|
|
5
4
|
props: {
|
|
@@ -9,7 +8,6 @@ declare const __propDef: {
|
|
|
9
8
|
linkedinSlug?: string | undefined;
|
|
10
9
|
domain?: string | undefined;
|
|
11
10
|
serverSideQueryParams?: string | undefined;
|
|
12
|
-
extraComponent?: ComponentType | undefined;
|
|
13
11
|
};
|
|
14
12
|
events: {
|
|
15
13
|
[evt: string]: CustomEvent<any>;
|
|
@@ -3,9 +3,13 @@ export declare enum GroupGridClass {
|
|
|
3
3
|
Games = "games-section",
|
|
4
4
|
Projects = "projects-section"
|
|
5
5
|
}
|
|
6
|
+
export interface ComponentMeta {
|
|
7
|
+
name: string;
|
|
8
|
+
component: ComponentType;
|
|
9
|
+
}
|
|
6
10
|
export interface EntryGroup {
|
|
7
11
|
name: string;
|
|
8
|
-
items:
|
|
12
|
+
items: ComponentMeta[];
|
|
9
13
|
gridClass: string;
|
|
10
14
|
}
|
|
11
15
|
export declare const GameEntries: Readonly<EntryGroup>;
|
|
@@ -14,8 +18,8 @@ export declare const EmptyRelevantProjects: Readonly<EntryGroup>;
|
|
|
14
18
|
export declare const AllGroupedEntriesGameFirst: ReadonlyArray<EntryGroup>;
|
|
15
19
|
export declare const AllGroupedEntriesProjectFirst: ReadonlyArray<EntryGroup>;
|
|
16
20
|
export declare const lazyInitializeAllFlatEntries: () => void;
|
|
17
|
-
export declare const GetAllEntryFromGlobal: () => Map<string,
|
|
18
|
-
export declare const GetEntryFromGlobal: (name: string) =>
|
|
21
|
+
export declare const GetAllEntryFromGlobal: () => Map<string, ComponentMeta>;
|
|
22
|
+
export declare const GetEntryFromGlobal: (name: string) => ComponentMeta | undefined;
|
|
19
23
|
export declare const TurnGroupEntriesMutable: (allEntries: ReadonlyArray<EntryGroup>) => EntryGroup[];
|
|
20
24
|
export interface SeaweedTemplateData {
|
|
21
25
|
groupedEntries: EntryGroup[];
|
|
@@ -19,12 +19,26 @@ export var GroupGridClass;
|
|
|
19
19
|
})(GroupGridClass || (GroupGridClass = {}));
|
|
20
20
|
export const GameEntries = {
|
|
21
21
|
name: DefaultHeader.Games.toString(),
|
|
22
|
-
items: [
|
|
22
|
+
items: [
|
|
23
|
+
{ name: "Pengi", component: Pengi },
|
|
24
|
+
{ name: "Hepcat", component: Hepcat },
|
|
25
|
+
{ name: "Chef Wings", component: ChefWings },
|
|
26
|
+
{ name: "Soulwork", component: Soulwork },
|
|
27
|
+
{ name: "Itch Promo", component: ItchPromo }
|
|
28
|
+
],
|
|
23
29
|
gridClass: GroupGridClass.Games.toString()
|
|
24
30
|
};
|
|
25
31
|
export const ProjectEntries = {
|
|
26
32
|
name: DefaultHeader.Projects.toString(),
|
|
27
|
-
items: [
|
|
33
|
+
items: [
|
|
34
|
+
{ name: "Migrante Alberta", component: MigranteAlberta },
|
|
35
|
+
{ name: "Decentralized Social Media", component: DecentralizedSocialMedia },
|
|
36
|
+
{ name: "Customized YarnSpinner", component: CustomizedYarnspinner },
|
|
37
|
+
{ name: "Full Stack C", component: FullStackC },
|
|
38
|
+
{ name: "Workset", component: Workset },
|
|
39
|
+
{ name: "This Webpage", component: ThisWebpage },
|
|
40
|
+
{ name: "Mock Uber App", component: MockUberApp }
|
|
41
|
+
],
|
|
28
42
|
gridClass: GroupGridClass.Projects.toString()
|
|
29
43
|
};
|
|
30
44
|
export const EmptyRelevantProjects = {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface CreateUrlRequest {
|
|
2
|
+
queryParams: string;
|
|
3
|
+
shortUrl: string;
|
|
4
|
+
password: string;
|
|
5
|
+
}
|
|
6
|
+
export declare enum CreateUrlResult {
|
|
7
|
+
Fail = 0,
|
|
8
|
+
Success = 1,
|
|
9
|
+
Duplicate = 2
|
|
10
|
+
}
|
|
11
|
+
export interface CreateUrlResponse {
|
|
12
|
+
result: CreateUrlResult;
|
|
13
|
+
}
|
|
14
|
+
export declare const jsonToCreateUrlRequest: (json: Record<string, never>) => CreateUrlRequest;
|
|
15
|
+
export declare const jsonToCreateUrlResponse: (json: Record<string, never>) => CreateUrlResponse;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export var CreateUrlResult;
|
|
2
|
+
(function (CreateUrlResult) {
|
|
3
|
+
CreateUrlResult[CreateUrlResult["Fail"] = 0] = "Fail";
|
|
4
|
+
CreateUrlResult[CreateUrlResult["Success"] = 1] = "Success";
|
|
5
|
+
CreateUrlResult[CreateUrlResult["Duplicate"] = 2] = "Duplicate";
|
|
6
|
+
})(CreateUrlResult || (CreateUrlResult = {}));
|
|
7
|
+
export const jsonToCreateUrlRequest = (json) => {
|
|
8
|
+
return {
|
|
9
|
+
queryParams: json["queryParams"] ?? "",
|
|
10
|
+
shortUrl: json["shortUrl"] ?? "",
|
|
11
|
+
password: json["password"] ?? ""
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export const jsonToCreateUrlResponse = (json) => {
|
|
15
|
+
const enumIndex = json["result"];
|
|
16
|
+
return {
|
|
17
|
+
result: CreateUrlResult[enumIndex] ? enumIndex : CreateUrlResult.Fail
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./CreateUrl";
|
package/package.json
CHANGED
package/src/lib/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { default as SocialSection } from "./components/SocialSection.svelte";
|
|
|
8
8
|
|
|
9
9
|
export * from "$pkg/components/overrideable_meta/index";
|
|
10
10
|
export * from "$pkg/components/navigation_component/index";
|
|
11
|
+
export * from "$pkg/types/api/index";
|
|
11
12
|
export * from "./components/dialog_manager/DialogManagerStore";
|
|
12
13
|
export * from "./components/dialog_manager/DialogManager";
|
|
13
14
|
export * from "./components/dialog_manager/DialogUtils";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { type CreateUrlRequest, CreateUrlResult, jsonToCreateUrlResponse } from "$pkg/types/api/CreateUrl";
|
|
3
|
+
import { getToastStore, type ToastSettings } from "@skeletonlabs/skeleton";
|
|
4
|
+
|
|
5
|
+
export let queryParams = "";
|
|
6
|
+
|
|
7
|
+
const toastStore = getToastStore();
|
|
8
|
+
|
|
9
|
+
let request: CreateUrlRequest = {
|
|
10
|
+
queryParams: "",
|
|
11
|
+
shortUrl: "",
|
|
12
|
+
password: ""
|
|
13
|
+
};
|
|
14
|
+
$: request.queryParams = queryParams;
|
|
15
|
+
|
|
16
|
+
const failToast: ToastSettings = {
|
|
17
|
+
message: "Adding new url failed"
|
|
18
|
+
};
|
|
19
|
+
const toastMap = new Map<CreateUrlResult, ToastSettings>([
|
|
20
|
+
[CreateUrlResult.Success, {
|
|
21
|
+
message: "Successfully added new url"
|
|
22
|
+
}],
|
|
23
|
+
[CreateUrlResult.Duplicate, {
|
|
24
|
+
message: "Short url already used; try again with another url"
|
|
25
|
+
}],
|
|
26
|
+
[CreateUrlResult.Fail, failToast]
|
|
27
|
+
]);
|
|
28
|
+
const post = () => {
|
|
29
|
+
fetch("/api/create-url", {
|
|
30
|
+
method: "POST",
|
|
31
|
+
headers: {
|
|
32
|
+
"Content-Type": "application/json"
|
|
33
|
+
},
|
|
34
|
+
body: JSON.stringify(request)
|
|
35
|
+
}).then(resp =>
|
|
36
|
+
resp.json()
|
|
37
|
+
).then(json => {
|
|
38
|
+
const properResp = jsonToCreateUrlResponse(json);
|
|
39
|
+
toastStore.trigger(toastMap.get(properResp.result) ?? failToast);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<div>
|
|
45
|
+
<label for="short-url">Short URL for url shortener</label>
|
|
46
|
+
<input bind:value={request.shortUrl}
|
|
47
|
+
name="short-url"
|
|
48
|
+
class="input"
|
|
49
|
+
type="text"
|
|
50
|
+
placeholder="short-url" />
|
|
51
|
+
<label for="password">Password</label>
|
|
52
|
+
<input bind:value={request.password}
|
|
53
|
+
name="password"
|
|
54
|
+
class="input"
|
|
55
|
+
type="password"
|
|
56
|
+
placeholder="Input" />
|
|
57
|
+
<button class="btn variant-filled" on:click={post}>Send link</button>
|
|
58
|
+
</div>
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
} from "./SeaweedTemplateData";
|
|
20
20
|
import type { EntryProps } from "$pkg/template/seaweed/entries/EntryProps";
|
|
21
21
|
import { parseQueryTerms } from "$pkg/template/seaweed/ParseQueryTerms";
|
|
22
|
+
import UrlShortenerForm from "$pkg/template/seaweed/CreateUrlForm.svelte";
|
|
22
23
|
|
|
23
24
|
export let letChaos = true;
|
|
24
25
|
export let name = "Turnip";
|
|
@@ -26,7 +27,6 @@
|
|
|
26
27
|
export let linkedinSlug = "turnip-xenon";
|
|
27
28
|
export let domain = "http://localhost:5173/portfolio/actual/";
|
|
28
29
|
export let serverSideQueryParams = "";
|
|
29
|
-
export let extraComponent: ComponentType | undefined = undefined;
|
|
30
30
|
|
|
31
31
|
// region query params
|
|
32
32
|
const entryProps: EntryProps = {
|
|
@@ -177,6 +177,7 @@
|
|
|
177
177
|
// when either gameSectionFirst or the queryTerms are updated, update advancedUrl
|
|
178
178
|
let orderUrl = "";
|
|
179
179
|
let advancedUrl = domain;
|
|
180
|
+
let advancedQuery = "";
|
|
180
181
|
const updateUrl = (seaweedTemplateData: SeaweedTemplateData) => {
|
|
181
182
|
const queryParams: string[] = [];
|
|
182
183
|
|
|
@@ -208,7 +209,8 @@
|
|
|
208
209
|
}
|
|
209
210
|
|
|
210
211
|
if (queryParams.length > 0) {
|
|
211
|
-
|
|
212
|
+
advancedQuery = queryParams.join("&");
|
|
213
|
+
advancedUrl = `${domain}?${advancedQuery}`;
|
|
212
214
|
} else {
|
|
213
215
|
advancedUrl = domain;
|
|
214
216
|
}
|
|
@@ -369,7 +371,7 @@
|
|
|
369
371
|
|
|
370
372
|
<section class={group.gridClass}>
|
|
371
373
|
{#each group.items as entry}
|
|
372
|
-
<svelte:component this={entry} props={entryProps}></svelte:component>
|
|
374
|
+
<svelte:component this={entry.component} props={entryProps}></svelte:component>
|
|
373
375
|
{/each}
|
|
374
376
|
</section>
|
|
375
377
|
{/if}
|
|
@@ -419,7 +421,7 @@
|
|
|
419
421
|
<p>Copy the url below and open a new page with it</p>
|
|
420
422
|
<CodeBlock language="url" code={advancedUrl}></CodeBlock>
|
|
421
423
|
|
|
422
|
-
<
|
|
424
|
+
<UrlShortenerForm queryParams={advancedQuery}></UrlShortenerForm>
|
|
423
425
|
{/if}
|
|
424
426
|
</div>
|
|
425
427
|
</Card>
|
|
@@ -19,21 +19,40 @@ export enum GroupGridClass {
|
|
|
19
19
|
Projects = "projects-section"
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
export interface ComponentMeta {
|
|
23
|
+
name: string;
|
|
24
|
+
component: ComponentType;
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
export interface EntryGroup {
|
|
23
28
|
name: string;
|
|
24
|
-
items:
|
|
29
|
+
items: ComponentMeta[];
|
|
25
30
|
gridClass: string;
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
export const GameEntries: Readonly<EntryGroup> = {
|
|
29
34
|
name: DefaultHeader.Games.toString(),
|
|
30
|
-
items: [
|
|
35
|
+
items: [
|
|
36
|
+
{ name: "Pengi", component: Pengi },
|
|
37
|
+
{ name: "Hepcat", component: Hepcat },
|
|
38
|
+
{ name: "Chef Wings", component: ChefWings },
|
|
39
|
+
{ name: "Soulwork", component: Soulwork },
|
|
40
|
+
{ name: "Itch Promo", component: ItchPromo }
|
|
41
|
+
],
|
|
31
42
|
gridClass: GroupGridClass.Games.toString()
|
|
32
43
|
};
|
|
33
44
|
|
|
34
45
|
export const ProjectEntries: Readonly<EntryGroup> = {
|
|
35
46
|
name: DefaultHeader.Projects.toString(),
|
|
36
|
-
items: [
|
|
47
|
+
items: [
|
|
48
|
+
{ name: "Migrante Alberta", component: MigranteAlberta },
|
|
49
|
+
{ name: "Decentralized Social Media", component: DecentralizedSocialMedia },
|
|
50
|
+
{ name: "Customized YarnSpinner", component: CustomizedYarnspinner },
|
|
51
|
+
{ name: "Full Stack C", component: FullStackC },
|
|
52
|
+
{ name: "Workset", component: Workset },
|
|
53
|
+
{ name: "This Webpage", component: ThisWebpage },
|
|
54
|
+
{ name: "Mock Uber App", component: MockUberApp }
|
|
55
|
+
],
|
|
37
56
|
gridClass: GroupGridClass.Projects.toString()
|
|
38
57
|
};
|
|
39
58
|
|
|
@@ -55,7 +74,7 @@ export const AllGroupedEntriesProjectFirst: ReadonlyArray<EntryGroup> = [
|
|
|
55
74
|
GameEntries
|
|
56
75
|
];
|
|
57
76
|
|
|
58
|
-
const allFlatEntries
|
|
77
|
+
const allFlatEntries = new Map<string, ComponentMeta>();
|
|
59
78
|
|
|
60
79
|
export const lazyInitializeAllFlatEntries = () => {
|
|
61
80
|
if (allFlatEntries.size === 0) {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface CreateUrlRequest {
|
|
2
|
+
queryParams: string;
|
|
3
|
+
shortUrl: string;
|
|
4
|
+
password: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export enum CreateUrlResult {
|
|
8
|
+
Fail = 0,
|
|
9
|
+
Success = 1,
|
|
10
|
+
Duplicate = 2
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface CreateUrlResponse {
|
|
14
|
+
result: CreateUrlResult;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const jsonToCreateUrlRequest = (json: Record<string, never>): CreateUrlRequest => {
|
|
18
|
+
return {
|
|
19
|
+
queryParams: json["queryParams"] ?? "",
|
|
20
|
+
shortUrl: json["shortUrl"] ?? "",
|
|
21
|
+
password: json["password"] ?? ""
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const jsonToCreateUrlResponse = (json: Record<string, never>): CreateUrlResponse => {
|
|
26
|
+
const enumIndex = json["result"] as number;
|
|
27
|
+
return {
|
|
28
|
+
result: CreateUrlResult[enumIndex] ? enumIndex : CreateUrlResult.Fail
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { initializeStores } from "@skeletonlabs/skeleton";
|
|
2
|
+
import { initializeStores, Toast } from "@skeletonlabs/skeleton";
|
|
3
3
|
import { Modal } from "@skeletonlabs/skeleton";
|
|
4
4
|
|
|
5
5
|
initializeStores();
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<Modal />
|
|
9
|
+
<Toast />
|
|
9
10
|
|
|
10
11
|
<slot />
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import SeaweedTemplate from "$pkg/template/seaweed/SeaweedTemplate.svelte";
|
|
3
|
-
import RandomComponent from "./RandomComponent.svelte";
|
|
4
3
|
</script>
|
|
5
4
|
|
|
6
5
|
<SeaweedTemplate letChaos={false}
|
|
7
6
|
name="Allan Manuba"
|
|
8
7
|
email="allanmanuba@gmail.com"
|
|
9
8
|
linkedinSlug="allan-manuba"
|
|
10
|
-
serverSideQueryParams="order=Games:Hepcat|
|
|
11
|
-
|
|
9
|
+
serverSideQueryParams="order=Relevant projects::games-section,Games:Pengi|Chef Wings|Hepcat|Itch Promo|Soulwork|Full Stack C:games-section,Projects:Migrante Alberta|Customized YarnSpinner|Decentralized Social Media|Workset|This Webpage:projects-section"
|
|
10
|
+
>
|
|
12
11
|
|
|
13
12
|
</SeaweedTemplate>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { RequestHandler } from "./$types";
|
|
2
|
+
import { type CreateUrlResponse, CreateUrlResult, jsonToCreateUrlRequest } from "$pkg/types/api/CreateUrl";
|
|
3
|
+
|
|
4
|
+
export const POST: RequestHandler = async ({ request }) => {
|
|
5
|
+
const response: CreateUrlResponse = {
|
|
6
|
+
result: CreateUrlResult.Fail
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
console.log("This is a fake API. The real API is somewhere else.");
|
|
10
|
+
const data = jsonToCreateUrlRequest(await request.json());
|
|
11
|
+
console.log(data);
|
|
12
|
+
|
|
13
|
+
if (data.password !== "FakePassword") {
|
|
14
|
+
return new Response(JSON.stringify(response));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (data.shortUrl === "already-used") {
|
|
18
|
+
response.result = CreateUrlResult.Duplicate;
|
|
19
|
+
return new Response(JSON.stringify(response));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
response.result = CreateUrlResult.Success;
|
|
23
|
+
return new Response(JSON.stringify(response));
|
|
24
|
+
};
|