@turnipxenon/pineapple 5.2.2 → 5.3.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/icons/cursor-chat.svg +46 -0
- package/dist/assets/icons/cursor-open-in-new.svg +8 -0
- package/dist/assets/icons/icon-open-in-new.svg +1 -0
- package/dist/components/dialog_manager/DialogManager.d.ts +8 -2
- package/dist/components/dialog_manager/DialogManager.d.ts.map +1 -1
- package/dist/components/dialog_manager/DialogManager.js +63 -11
- package/dist/components/dialog_manager/DialogManagerStore.d.ts +0 -3
- package/dist/components/dialog_manager/DialogManagerStore.d.ts.map +1 -1
- package/dist/components/dialog_manager/DialogManagerStore.js +1 -3
- package/dist/components/dialog_manager/DialogProcessor.d.ts.map +1 -1
- package/dist/components/dialog_manager/DialogProcessor.js +3 -2
- package/dist/components/dialog_manager/DialogUtils.js +2 -2
- package/dist/components/dialog_manager/IDialogManager.d.ts +4 -2
- package/dist/components/dialog_manager/IDialogManager.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/core/BTreeUtils.d.ts +2 -1
- package/dist/components/dialog_manager/behavior_tree/core/BTreeUtils.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/core/BTreeUtils.js +4 -3
- package/dist/components/dialog_manager/behavior_tree/expression/ExpressionArguments.d.ts +2 -0
- package/dist/components/dialog_manager/behavior_tree/expression/ExpressionArguments.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/expression/ExpressionEvaluator.d.ts +4 -2
- package/dist/components/dialog_manager/behavior_tree/expression/ExpressionEvaluator.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/expression/ExpressionEvaluator.js +8 -6
- package/dist/components/dialog_manager/behavior_tree/expression/OperandNode.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/expression/OperandNode.js +1 -1
- package/dist/components/dialog_manager/behavior_tree/expression/commands/VisitedCountCommand.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/expression/commands/VisitedCountCommand.js +1 -2
- package/dist/components/dialog_manager/behavior_tree/line_core/LineNodeArguments.d.ts +2 -0
- package/dist/components/dialog_manager/behavior_tree/line_core/LineNodeArguments.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/line_processors/ElseIfNode.js +1 -1
- package/dist/components/dialog_manager/behavior_tree/line_processors/IfNode.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/line_processors/IfNode.js +1 -2
- package/dist/components/dialog_manager/behavior_tree/line_processors/NormalLineProcessorNode.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/line_processors/NormalLineProcessorNode.js +2 -3
- package/dist/components/dialog_manager/behavior_tree/line_processors/SetVariableNode.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/line_processors/SetVariableNode.js +2 -3
- package/dist/components/dialog_manager/behavior_tree/line_processors/commands/DeclareCommand.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/line_processors/commands/DeclareCommand.js +3 -2
- package/dist/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.js +3 -2
- package/dist/components/dialog_manager/behavior_tree/line_processors/commands/UnvisitCommand.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/line_processors/commands/UnvisitCommand.js +2 -3
- package/dist/modules/parsnip/ParsnipBlockChildren.svelte +3 -0
- package/dist/modules/parsnip/ParsnipBlockChildren.svelte.d.ts.map +1 -1
- package/dist/modules/parsnip/ParsnipPhrasingChildren.svelte +15 -3
- package/dist/modules/parsnip/ParsnipPhrasingChildren.svelte.d.ts.map +1 -1
- package/dist/modules/parsnip/external-images/ParsnipImage.svelte +111 -0
- package/dist/modules/parsnip/external-images/ParsnipImage.svelte.d.ts +9 -0
- package/dist/modules/parsnip/external-images/ParsnipImage.svelte.d.ts.map +1 -0
- package/dist/modules/parsnip/external-images/ParsnipImageCollection.svelte +62 -0
- package/dist/modules/parsnip/external-images/ParsnipImageCollection.svelte.d.ts +9 -0
- package/dist/modules/parsnip/external-images/ParsnipImageCollection.svelte.d.ts.map +1 -0
- package/dist/modules/parsnip/external-images/externalImages.remote.d.ts +8 -0
- package/dist/modules/parsnip/external-images/externalImages.remote.d.ts.map +1 -0
- package/dist/modules/parsnip/external-images/externalImages.remote.js +50 -0
- package/dist/modules/parsnip/route-util/ParsnipBlog.svelte +2 -1
- package/dist/modules/parsnip/route-util/ParsnipBlog.svelte.d.ts.map +1 -1
- package/dist/modules/parsnip/route-util/slugPageServerLoad.d.ts.map +1 -1
- package/dist/modules/parsnip/route-util/slugPageServerLoad.js +21 -0
- package/dist/scripts/pineapple_fiber/PineappleFiberParser.d.ts.map +1 -1
- package/dist/scripts/pineapple_fiber/PineappleFiberParser.js +19 -0
- package/dist/scripts/pineapple_fiber/TutorialBroken.yarn +143 -0
- package/dist/styles/app.css +30 -2
- package/dist/test/DialogTestUtility.d.ts +8 -0
- package/dist/test/DialogTestUtility.d.ts.map +1 -0
- package/dist/test/DialogTestUtility.js +62 -0
- package/dist/test/index.d.ts +3 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +2 -0
- package/dist/types/pineapple_fiber/DialogDetail.d.ts +1 -0
- package/dist/types/pineapple_fiber/DialogDetail.d.ts.map +1 -1
- package/dist/types/pineapple_fiber/DialogVariableStore.d.ts.map +1 -1
- package/dist/types/pineapple_fiber/DialogVariableStore.js +41 -13
- package/dist/ui/elements/TextLink.svelte +1 -1
- package/dist/ui/elements/index.d.ts +1 -0
- package/dist/ui/elements/index.d.ts.map +1 -1
- package/dist/ui/elements/index.js +1 -0
- package/dist/ui/modules/NavigationMenu/NavigationControl.svelte +41 -10
- package/dist/ui/modules/NavigationMenu/NavigationControl.svelte.d.ts +3 -1
- package/dist/ui/modules/NavigationMenu/NavigationControl.svelte.d.ts.map +1 -1
- package/dist/ui/modules/NavigationMenu/NavigationMenu.svelte +131 -39
- package/dist/ui/modules/NavigationMenu/NavigationMenu.svelte.d.ts +3 -1
- package/dist/ui/modules/NavigationMenu/NavigationMenu.svelte.d.ts.map +1 -1
- package/dist/ui/modules/modals/general-settings/GeneralSettingsModal.svelte +21 -21
- package/dist/ui/modules/modals/general-settings/GeneralSettingsModal.svelte.d.ts +1 -1
- package/dist/ui/modules/modals/general-settings/GeneralSettingsModal.svelte.d.ts.map +1 -1
- package/dist/ui/modules/universal-overlay/DialogPanel.svelte +80 -6
- package/dist/ui/modules/universal-overlay/DialogPanel.svelte.d.ts.map +1 -1
- package/dist/ui/modules/universal-overlay/SettingsPanel.svelte +132 -75
- package/dist/ui/modules/universal-overlay/SettingsPanel.svelte.d.ts +4 -1
- package/dist/ui/modules/universal-overlay/SettingsPanel.svelte.d.ts.map +1 -1
- package/dist/ui/templates/SeaweedLayout/SeaweedLayout.svelte +0 -3
- package/dist/ui/templates/SeaweedLayout/SeaweedLayout.svelte.d.ts.map +1 -1
- package/dist/ui/templates/blog_template/BlogTemplate.svelte +7 -1
- package/dist/ui/templates/blog_template/BlogTemplateInner.svelte +33 -1
- package/dist/ui/templates/blog_template/BlogTemplateInner.svelte.d.ts.map +1 -1
- package/dist/ui/templates/index.d.ts +1 -0
- package/dist/ui/templates/index.d.ts.map +1 -1
- package/dist/ui/templates/index.js +2 -0
- package/dist/util/context/PineappleBaseContext.svelte +6 -2
- package/dist/util/context/PineappleBaseContext.svelte.d.ts.map +1 -1
- package/dist/util/context/pineappleBaseContextDefinitions.svelte.d.ts +2 -0
- package/dist/util/context/pineappleBaseContextDefinitions.svelte.d.ts.map +1 -1
- package/dist/util/context/pineappleBaseContextDefinitions.svelte.js +2 -0
- package/dist/util/localStore.svelte.d.ts +2 -0
- package/dist/util/localStore.svelte.d.ts.map +1 -1
- package/dist/util/localStore.svelte.js +2 -0
- package/dist/yarn/Tutorial.yarn +141 -0
- package/package.json +12 -7
- package/src/lib/styles/app.css +30 -2
- package/dist/assets/icons/chat-cursor.svg +0 -47
package/dist/components/dialog_manager/behavior_tree/line_processors/NormalLineProcessorNode.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { browser } from "$app/environment";
|
|
2
1
|
import { BehaviorStatus } from "../core/BehaviorStatus";
|
|
3
2
|
/**
|
|
4
3
|
* This is a leaf node that ALWAYS returns success
|
|
@@ -15,8 +14,8 @@ export class NormalLineProcessorNode {
|
|
|
15
14
|
return token
|
|
16
15
|
.split("}") // split at the end and dont process the rest
|
|
17
16
|
.map((varToken, index) => {
|
|
18
|
-
if (index == 0
|
|
19
|
-
const varValue =
|
|
17
|
+
if (index == 0) {
|
|
18
|
+
const varValue = nodeArgs.dialogVariableStore.getItem(`$${varToken}`);
|
|
20
19
|
if (varValue !== null) {
|
|
21
20
|
// null guard
|
|
22
21
|
return varValue;
|
package/dist/components/dialog_manager/behavior_tree/line_processors/SetVariableNode.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SetVariableNode.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/dialog_manager/behavior_tree/line_processors/SetVariableNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0EAA0E,CAAC;AAClH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAC;
|
|
1
|
+
{"version":3,"file":"SetVariableNode.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/dialog_manager/behavior_tree/line_processors/SetVariableNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0EAA0E,CAAC;AAClH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAC;AAGpH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yEAAyE,CAAC;AAGhH;;;;GAIG;AACH,qBAAa,eAAgB,YAAW,gBAAgB;IACvD,OAAO,CAAC,QAAQ,EAAE,iBAAiB,GAAG,kBAAkB;CAsBxD"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BehaviorStatus } from "../core/BehaviorStatus";
|
|
2
2
|
import { btreeUtils } from "../core/BTreeUtils";
|
|
3
|
-
import { dialogVariableStore } from "../../DialogManagerStore";
|
|
4
3
|
import { expressionEvaluator } from "../expression/ExpressionEvaluator";
|
|
5
4
|
/**
|
|
6
5
|
* This is a leaf node that returns:
|
|
@@ -20,8 +19,8 @@ export class SetVariableNode {
|
|
|
20
19
|
const key = setValuePair[0].slice("<<set ".length).trim();
|
|
21
20
|
setValuePair.shift();
|
|
22
21
|
const preValue = setValuePair.join("=").trim();
|
|
23
|
-
const value = expressionEvaluator.evaluateFreeform(preValue, "");
|
|
24
|
-
dialogVariableStore.setItem(key, btreeUtils.peek(value));
|
|
22
|
+
const value = expressionEvaluator.evaluateFreeform(preValue, "", nodeArgs.dialogVariableStore);
|
|
23
|
+
nodeArgs.dialogVariableStore.setItem(key, btreeUtils.peek(value));
|
|
25
24
|
return {
|
|
26
25
|
nextState: nodeArgs.initState,
|
|
27
26
|
renderedLine: "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeclareCommand.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/dialog_manager/behavior_tree/line_processors/commands/DeclareCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yEAAyE,CAAC;AAChH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0EAA0E,CAAC;AAClH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAC;AAEpH,OAAO,EAAE,eAAe,EAAE,MAAM,8EAA8E,CAAC;AAE/G,qBAAa,cAAe,YAAW,gBAAgB;IACtD,eAAe,kBAAyB;IAExC,OAAO,CAAC,QAAQ,EAAE,iBAAiB,GAAG,kBAAkB;
|
|
1
|
+
{"version":3,"file":"DeclareCommand.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/dialog_manager/behavior_tree/line_processors/commands/DeclareCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yEAAyE,CAAC;AAChH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0EAA0E,CAAC;AAClH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAC;AAEpH,OAAO,EAAE,eAAe,EAAE,MAAM,8EAA8E,CAAC;AAE/G,qBAAa,cAAe,YAAW,gBAAgB;IACtD,eAAe,kBAAyB;IAExC,OAAO,CAAC,QAAQ,EAAE,iBAAiB,GAAG,kBAAkB;CAuCxD"}
|
package/dist/components/dialog_manager/behavior_tree/line_processors/commands/DeclareCommand.js
CHANGED
|
@@ -15,7 +15,7 @@ export class DeclareCommand {
|
|
|
15
15
|
// determine if we need to set?
|
|
16
16
|
const setValuePair = nodeArgs.line.split("=");
|
|
17
17
|
const key = setValuePair[0].slice("<<declare ".length).trim(); // remove "<<declare "
|
|
18
|
-
if (
|
|
18
|
+
if (nodeArgs.dialogVariableStore.getItem(key) !== null) {
|
|
19
19
|
return {
|
|
20
20
|
renderedLine: "",
|
|
21
21
|
nextState: nodeArgs.initState,
|
|
@@ -30,7 +30,8 @@ export class DeclareCommand {
|
|
|
30
30
|
const result = this.setVariableNode.process({
|
|
31
31
|
initState: nodeArgs.initState,
|
|
32
32
|
line: `<<set ${key} = ${value}>>`, // faking the line lol
|
|
33
|
-
lineIndex: nodeArgs.lineIndex
|
|
33
|
+
lineIndex: nodeArgs.lineIndex,
|
|
34
|
+
dialogVariableStore: nodeArgs.dialogVariableStore
|
|
34
35
|
});
|
|
35
36
|
return {
|
|
36
37
|
nextState: result.nextState,
|
package/dist/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JumpCommand.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yEAAyE,CAAC;AAChH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0EAA0E,CAAC;AAClH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAC;AAEpH,OAAO,EAAE,eAAe,EAAE,MAAM,8EAA8E,CAAC;AAE/G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAEpF,qBAAa,WAAY,YAAW,gBAAgB;IACnD,eAAe,kBAAyB;IACxC,aAAa,EAAE,cAAc,CAAC;gBAElB,aAAa,EAAE,cAAc;IAIzC,OAAO,CAAC,QAAQ,EAAE,iBAAiB,GAAG,kBAAkB;
|
|
1
|
+
{"version":3,"file":"JumpCommand.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yEAAyE,CAAC;AAChH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0EAA0E,CAAC;AAClH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAC;AAEpH,OAAO,EAAE,eAAe,EAAE,MAAM,8EAA8E,CAAC;AAE/G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAEpF,qBAAa,WAAY,YAAW,gBAAgB;IACnD,eAAe,kBAAyB;IACxC,aAAa,EAAE,cAAc,CAAC;gBAElB,aAAa,EAAE,cAAc;IAIzC,OAAO,CAAC,QAAQ,EAAE,iBAAiB,GAAG,kBAAkB;CAiDxD"}
|
package/dist/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.js
CHANGED
|
@@ -33,13 +33,14 @@ export class JumpCommand {
|
|
|
33
33
|
.slice("<<jump ".length, nodeArgs.line.length - ">>".length)
|
|
34
34
|
.replace(/^\{/, "") // remove possible " at the start: https://stackoverflow.com/a/2182602
|
|
35
35
|
.replace(/}$/, ""); // remove possible " at the end: https://stackoverflow.com/a/12249011;
|
|
36
|
-
const
|
|
36
|
+
const simplifiedChoice = btreeUtils.simplifyToken(choiceName, nodeArgs.dialogVariableStore);
|
|
37
|
+
const dialogChoice = this.dialogManager.dialogMessageMap.get(simplifiedChoice);
|
|
37
38
|
if (dialogChoice !== undefined) {
|
|
38
39
|
// force choice
|
|
39
40
|
this.dialogManager.setDialogChoice(dialogChoice);
|
|
40
41
|
}
|
|
41
42
|
else {
|
|
42
|
-
console.error(`Unknown jump node at line ${nodeArgs.lineIndex + 1}: ${choiceName} or ${
|
|
43
|
+
console.error(`Unknown jump node at line ${nodeArgs.lineIndex + 1}: ${choiceName} or ${simplifiedChoice}`);
|
|
43
44
|
}
|
|
44
45
|
return {
|
|
45
46
|
nextState: nodeArgs.initState,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnvisitCommand.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/dialog_manager/behavior_tree/line_processors/commands/UnvisitCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yEAAyE,CAAC;AAChH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0EAA0E,CAAC;AAClH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAC;
|
|
1
|
+
{"version":3,"file":"UnvisitCommand.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/dialog_manager/behavior_tree/line_processors/commands/UnvisitCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yEAAyE,CAAC;AAChH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0EAA0E,CAAC;AAClH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAC;AAIpH;;GAEG;AACH,qBAAa,cAAe,YAAW,gBAAgB;IACtD,OAAO,CAAC,QAAQ,EAAE,iBAAiB,GAAG,kBAAkB;CAsBxD"}
|
package/dist/components/dialog_manager/behavior_tree/line_processors/commands/UnvisitCommand.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { BehaviorStatus } from "../../core/BehaviorStatus";
|
|
2
|
-
import { dialogVariableStore } from "../../../DialogManagerStore";
|
|
3
2
|
import { browser } from "$app/environment";
|
|
4
3
|
/**
|
|
5
4
|
* Unvisits a node
|
|
6
5
|
*/
|
|
7
6
|
export class UnvisitCommand {
|
|
8
7
|
process(nodeArgs) {
|
|
9
|
-
if (!nodeArgs.line.startsWith("<<unvisit") || !browser) {
|
|
8
|
+
if (!nodeArgs.line.startsWith("<<unvisit") || (!browser && !import.meta.env.VITEST)) {
|
|
10
9
|
return {
|
|
11
10
|
renderedLine: "",
|
|
12
11
|
nextState: nodeArgs.initState,
|
|
@@ -18,7 +17,7 @@ export class UnvisitCommand {
|
|
|
18
17
|
.replace(/^\{/, "") // remove possible " at the start: https://stackoverflow.com/a/2182602
|
|
19
18
|
.replace(/}$/, ""); // remove possible " at the end: https://stackoverflow.com/a/12249011;
|
|
20
19
|
const key = `+${nodeName}`;
|
|
21
|
-
dialogVariableStore.removeItem(key);
|
|
20
|
+
nodeArgs.dialogVariableStore.removeItem(key);
|
|
22
21
|
return {
|
|
23
22
|
nextState: nodeArgs.initState,
|
|
24
23
|
renderedLine: "",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import ParsnipImageCollection from "./external-images/ParsnipImageCollection.svelte";
|
|
2
3
|
import ParsnipHeading from "./ParsnipHeading.svelte";
|
|
3
4
|
import ParsnipList from "./ParsnipList.svelte";
|
|
4
5
|
import ParsnipParagraph from "./ParsnipParagraph.svelte";
|
|
@@ -33,6 +34,8 @@
|
|
|
33
34
|
<CodeBlock code={child.value} lang={child.lang ?? 'markdown'} />
|
|
34
35
|
{:else if child.type === 'list'}
|
|
35
36
|
<ParsnipList list={child} />
|
|
37
|
+
{:else if child.type === 'imageCollection'}
|
|
38
|
+
<ParsnipImageCollection url="" imageList={child.children} />
|
|
36
39
|
{:else}
|
|
37
40
|
<p>{JSON.stringify(child, undefined, 2)}</p>
|
|
38
41
|
{/if}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParsnipBlockChildren.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/modules/parsnip/ParsnipBlockChildren.svelte.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ParsnipBlockChildren.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/modules/parsnip/ParsnipBlockChildren.svelte.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGpC,KAAK,gBAAgB,GAAI;IAAE,aAAa,EAAE,OAAO,EAAE,CAAC;IAAC,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AA8CxF,QAAA,MAAM,oBAAoB,sDAAwC,CAAC;AACnE,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACpE,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import ParsnipImage from "./external-images/ParsnipImage.svelte";
|
|
3
|
+
import ParsnipImageCollection from "./external-images/ParsnipImageCollection.svelte";
|
|
2
4
|
import ParsnipEmbedWikilink from "./ParsnipEmbedWikilink.svelte";
|
|
3
5
|
import ParsnipWikilink from "./ParsnipWikilink.svelte";
|
|
4
6
|
import { type PhrasingContent } from "mdast";
|
|
@@ -14,12 +16,22 @@
|
|
|
14
16
|
<strong>
|
|
15
17
|
<Self phrasingChildren={child.children} />
|
|
16
18
|
</strong>
|
|
19
|
+
{:else if child.type === 'emphasis'}
|
|
20
|
+
<em>
|
|
21
|
+
<Self phrasingChildren={child.children} />
|
|
22
|
+
</em>
|
|
17
23
|
{:else if child.type === 'inlineCode'}
|
|
18
24
|
<code class="inline-code">{child.value}</code>
|
|
19
25
|
{:else if child.type === 'link'}
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
|
|
26
|
+
{#if child.url.includes('photo-gallery')}
|
|
27
|
+
<ParsnipImageCollection url={child.url} />
|
|
28
|
+
{:else }
|
|
29
|
+
<a href={child.url}>
|
|
30
|
+
<Self phrasingChildren={child.children} />
|
|
31
|
+
</a>
|
|
32
|
+
{/if}
|
|
33
|
+
{:else if child.type === 'image'}
|
|
34
|
+
<ParsnipImage {...child} />
|
|
23
35
|
{:else if child.type === 'embedWikilink'}
|
|
24
36
|
<ParsnipEmbedWikilink wikilink={child} />
|
|
25
37
|
{:else if child.type === 'wikilink'}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParsnipPhrasingChildren.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/modules/parsnip/ParsnipPhrasingChildren.svelte.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ParsnipPhrasingChildren.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/modules/parsnip/ParsnipPhrasingChildren.svelte.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,OAAO,CAAC;AAG5C,KAAK,gBAAgB,GAAI;IAAE,gBAAgB,EAAE,eAAe,EAAE,CAAA;CAAE,CAAC;AA8ClE,QAAA,MAAM,uBAAuB,sDAAwC,CAAC;AACtE,KAAK,uBAAuB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAC1E,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
|
|
3
|
+
import { getPhotoDetails } from "./externalImages.remote";
|
|
4
|
+
|
|
5
|
+
const { url, alt = "", withDescription = false }: { url: string, alt: string, withDescription?: boolean } = $props();
|
|
6
|
+
let _alt = $state(alt);
|
|
7
|
+
|
|
8
|
+
const showDescription = withDescription || url.includes("with-description=true");
|
|
9
|
+
|
|
10
|
+
const galleryBase = url
|
|
11
|
+
.replace(/[?#].*$/, "")
|
|
12
|
+
.replace(/^(https?:\/\/)(rabiole|photos)\./, "$1photo-gallery.")
|
|
13
|
+
.replace(/\/(api\/)?photos\/.*$/, "");
|
|
14
|
+
|
|
15
|
+
let details = $state<{ altText: string, description: string, tags: string[], createdAt: string } | null>(null);
|
|
16
|
+
|
|
17
|
+
$effect(() => {
|
|
18
|
+
if (_alt && !showDescription) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (url.includes("rabiole") || url.includes("photo-gallery")) {
|
|
23
|
+
getPhotoDetails(url).then(data => {
|
|
24
|
+
if (data) {
|
|
25
|
+
details = data;
|
|
26
|
+
_alt = data.altText;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<!-- todo(turnip): determine appropriate media -->
|
|
34
|
+
{#if showDescription}
|
|
35
|
+
<div class="parsnip-image-described">
|
|
36
|
+
<img src={url} alt={details?.altText ?? _alt} />
|
|
37
|
+
{#if details}
|
|
38
|
+
<div class="parsnip-image-meta">
|
|
39
|
+
{#if details.description}<p>{details.description}</p>{/if}
|
|
40
|
+
{#if details.createdAt}<p class="date">{new Date(details.createdAt).toLocaleDateString()}</p>{/if}
|
|
41
|
+
{#if details.tags.length}
|
|
42
|
+
<ul class="tags">
|
|
43
|
+
{#each details.tags as tag}
|
|
44
|
+
<li><a href="{galleryBase}/photos?tags={tag}" target="_blank">{tag}</a></li>
|
|
45
|
+
{/each}
|
|
46
|
+
</ul>
|
|
47
|
+
{/if}
|
|
48
|
+
</div>
|
|
49
|
+
{/if}
|
|
50
|
+
</div>
|
|
51
|
+
{:else}
|
|
52
|
+
<img src={url} alt={_alt} />
|
|
53
|
+
{/if}
|
|
54
|
+
|
|
55
|
+
<style>
|
|
56
|
+
img {
|
|
57
|
+
aspect-ratio: auto;
|
|
58
|
+
display: block;
|
|
59
|
+
width: 100%;
|
|
60
|
+
border-radius: var(--radius-sm);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.parsnip-image-described {
|
|
64
|
+
border: 1px solid currentColor;
|
|
65
|
+
border-radius: var(--radius-sm);
|
|
66
|
+
padding: 0.5rem;
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
gap: 0.5rem;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.parsnip-image-meta {
|
|
73
|
+
display: flex;
|
|
74
|
+
flex-direction: column;
|
|
75
|
+
gap: 0.25rem;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.parsnip-image-meta p {
|
|
79
|
+
margin: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.parsnip-image-meta .date {
|
|
83
|
+
opacity: 0.7;
|
|
84
|
+
font-size: 0.875em;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.tags {
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-wrap: wrap;
|
|
90
|
+
gap: 0.25rem;
|
|
91
|
+
list-style: none;
|
|
92
|
+
padding: 0;
|
|
93
|
+
margin: 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.tags li {
|
|
97
|
+
background: color-mix(in srgb, currentColor 10%, transparent);
|
|
98
|
+
border-radius: 0.25rem;
|
|
99
|
+
padding: 0.125rem 0.375rem;
|
|
100
|
+
font-size: 0.8em;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.tags li a {
|
|
104
|
+
text-decoration: none;
|
|
105
|
+
color: inherit;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.tags li a:hover {
|
|
109
|
+
text-decoration: underline;
|
|
110
|
+
}
|
|
111
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
url: string;
|
|
3
|
+
alt: string;
|
|
4
|
+
withDescription?: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare const ParsnipImage: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type ParsnipImage = ReturnType<typeof ParsnipImage>;
|
|
8
|
+
export default ParsnipImage;
|
|
9
|
+
//# sourceMappingURL=ParsnipImage.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParsnipImage.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/modules/parsnip/external-images/ParsnipImage.svelte.ts"],"names":[],"mappings":"AAMC,KAAK,gBAAgB,GAAI;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AA2DlF,QAAA,MAAM,YAAY,sDAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
|
|
3
|
+
import { getPhotoCollectionMeta } from "./externalImages.remote";
|
|
4
|
+
import ParsnipImage from "./ParsnipImage.svelte";
|
|
5
|
+
import type { Image } from "mdast";
|
|
6
|
+
|
|
7
|
+
const { url, imageList }: { url?: string, imageList?: Image[] } = $props();
|
|
8
|
+
|
|
9
|
+
const withDescription = url?.includes('with-description=true') ?? false;
|
|
10
|
+
|
|
11
|
+
let data = $state<{
|
|
12
|
+
photos: {
|
|
13
|
+
id: string,
|
|
14
|
+
mediaUrl: string,
|
|
15
|
+
altText?: string,
|
|
16
|
+
description?: string,
|
|
17
|
+
tags?: string[]
|
|
18
|
+
}[]
|
|
19
|
+
} | undefined>();
|
|
20
|
+
|
|
21
|
+
$effect(() => {
|
|
22
|
+
if (url) {
|
|
23
|
+
getPhotoCollectionMeta(url)
|
|
24
|
+
.then(d => data = d);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<!-- todo(turnip): determine appropriate media -->
|
|
30
|
+
<!-- todo(turnip): add alt text -->
|
|
31
|
+
{#if imageList}
|
|
32
|
+
<div class="parsnip-image-collection">
|
|
33
|
+
{#each imageList as image (image.url)}
|
|
34
|
+
<ParsnipImage url={image.url} alt="" />
|
|
35
|
+
{/each}
|
|
36
|
+
</div>
|
|
37
|
+
{:else if data}
|
|
38
|
+
<div class="parsnip-image-collection">
|
|
39
|
+
{#each data.photos as photo (photo.id)}
|
|
40
|
+
<ParsnipImage url={photo.mediaUrl} alt={photo.altText ?? ""} {withDescription} />
|
|
41
|
+
{/each}
|
|
42
|
+
</div>
|
|
43
|
+
{:else}
|
|
44
|
+
<p>Loading...</p>
|
|
45
|
+
{/if}
|
|
46
|
+
|
|
47
|
+
<style>
|
|
48
|
+
.parsnip-image-collection {
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: row;
|
|
51
|
+
flex-wrap: wrap;
|
|
52
|
+
justify-content: stretch;
|
|
53
|
+
gap: 0.5rem 0.5lh;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
:global {
|
|
57
|
+
.parsnip-image-collection > * {
|
|
58
|
+
flex: 1 1 24rem;
|
|
59
|
+
width: 0;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Image } from "mdast";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
url?: string;
|
|
4
|
+
imageList?: Image[];
|
|
5
|
+
};
|
|
6
|
+
declare const ParsnipImageCollection: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type ParsnipImageCollection = ReturnType<typeof ParsnipImageCollection>;
|
|
8
|
+
export default ParsnipImageCollection;
|
|
9
|
+
//# sourceMappingURL=ParsnipImageCollection.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParsnipImageCollection.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/modules/parsnip/external-images/ParsnipImageCollection.svelte.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAElC,KAAK,gBAAgB,GAAI;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAA;CAAE,CAAC;AAmDhE,QAAA,MAAM,sBAAsB,sDAAwC,CAAC;AACrE,KAAK,sBAAsB,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACxE,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const getPhotoDetails: import("@sveltejs/kit").RemoteQueryFunction<string, {
|
|
2
|
+
altText: any;
|
|
3
|
+
description: any;
|
|
4
|
+
tags: string[];
|
|
5
|
+
createdAt: any;
|
|
6
|
+
} | null>;
|
|
7
|
+
export declare const getPhotoCollectionMeta: import("@sveltejs/kit").RemoteQueryFunction<string, any>;
|
|
8
|
+
//# sourceMappingURL=externalImages.remote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"externalImages.remote.d.ts","sourceRoot":"","sources":["../../../../src/lib/modules/parsnip/external-images/externalImages.remote.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe;;;UAiBG,MAAM,EAAE;;SAMrC,CAAC;AAEH,eAAO,MAAM,sBAAsB,0DAWjC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { query } from "$app/server";
|
|
11
|
+
import * as v from "valibot";
|
|
12
|
+
const UrlSchema = v.pipe(v.string(), v.url());
|
|
13
|
+
export const getPhotoDetails = query(UrlSchema, (url) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
+
var _a, _b, _c, _d;
|
|
15
|
+
if (!url.includes("rabiole") && !url.includes("photos"))
|
|
16
|
+
return null;
|
|
17
|
+
const apiUrl = url
|
|
18
|
+
.replace(/[?#].*$/, '')
|
|
19
|
+
.replace(/^(https?:\/\/)(rabiole|photos)\./, '$1photo-gallery.')
|
|
20
|
+
.replace('/photos/', '/api/photos/')
|
|
21
|
+
.replace(/\.(jpeg|png)$/, '');
|
|
22
|
+
try {
|
|
23
|
+
const resp = yield fetch(apiUrl);
|
|
24
|
+
const data = yield resp.json();
|
|
25
|
+
const photo = data === null || data === void 0 ? void 0 : data.photo;
|
|
26
|
+
if (!photo)
|
|
27
|
+
return null;
|
|
28
|
+
return {
|
|
29
|
+
altText: (_a = photo.altText) !== null && _a !== void 0 ? _a : '',
|
|
30
|
+
description: (_b = photo.description) !== null && _b !== void 0 ? _b : '',
|
|
31
|
+
tags: ((_c = photo.tags) !== null && _c !== void 0 ? _c : []),
|
|
32
|
+
createdAt: (_d = photo.createdAt) !== null && _d !== void 0 ? _d : ''
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
catch (_e) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}));
|
|
39
|
+
export const getPhotoCollectionMeta = query(UrlSchema, (url) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
if (!url.includes("photo-gallery")) {
|
|
41
|
+
return '';
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
const resp = yield fetch(url);
|
|
45
|
+
return yield resp.json();
|
|
46
|
+
}
|
|
47
|
+
catch (_a) {
|
|
48
|
+
return '';
|
|
49
|
+
}
|
|
50
|
+
}));
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
tags: parsnipEntry.tags,
|
|
13
13
|
title: parsnipEntry.basename,
|
|
14
14
|
datePublished: new Date(parsnipEntry.stat.ctime).toLocaleString(),
|
|
15
|
-
lastUpdated: new Date(parsnipEntry.stat.mtime).toLocaleString()
|
|
15
|
+
lastUpdated: new Date(parsnipEntry.stat.mtime).toLocaleString(),
|
|
16
|
+
priority: 0
|
|
16
17
|
});
|
|
17
18
|
</script>
|
|
18
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParsnipBlog.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/modules/parsnip/route-util/ParsnipBlog.svelte.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEnD,KAAK,gBAAgB,GAAI;IAAE,YAAY,EAAE,YAAY,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"ParsnipBlog.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/modules/parsnip/route-util/ParsnipBlog.svelte.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEnD,KAAK,gBAAgB,GAAI;IAAE,YAAY,EAAE,YAAY,CAAA;CAAE,CAAC;AA0BzD,QAAA,MAAM,WAAW,sDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slugPageServerLoad.d.ts","sourceRoot":"","sources":["../../../../src/lib/modules/parsnip/route-util/slugPageServerLoad.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uDAAuD,CAAC;
|
|
1
|
+
{"version":3,"file":"slugPageServerLoad.d.ts","sourceRoot":"","sources":["../../../../src/lib/modules/parsnip/route-util/slugPageServerLoad.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uDAAuD,CAAC;AAKvF,eAAO,MAAM,kBAAkB,GAAU,YAAY;IAAE,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE;;;EA4DhF,CAAC"}
|
|
@@ -25,6 +25,27 @@ export const slugPageServerLoad = (_a) => __awaiter(void 0, [_a], void 0, functi
|
|
|
25
25
|
error(400, "Not found");
|
|
26
26
|
}
|
|
27
27
|
const parsnipEntry = yield entryResponse.json();
|
|
28
|
+
const newChildren = [];
|
|
29
|
+
let imageCollection = [];
|
|
30
|
+
parsnipEntry.ast.ast.children.forEach(child => {
|
|
31
|
+
if (child.type === "paragraph"
|
|
32
|
+
&& child.children.length === 1
|
|
33
|
+
&& child.children[0].type === "image") {
|
|
34
|
+
imageCollection.push(child.children[0]);
|
|
35
|
+
}
|
|
36
|
+
else if (imageCollection.length > 0) {
|
|
37
|
+
newChildren.push({
|
|
38
|
+
"type": "imageCollection",
|
|
39
|
+
children: imageCollection
|
|
40
|
+
});
|
|
41
|
+
imageCollection = [];
|
|
42
|
+
newChildren.push(child);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
newChildren.push(child);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
parsnipEntry.ast.ast.children = newChildren;
|
|
28
49
|
const meta = {
|
|
29
50
|
title: parsnipEntry.basename,
|
|
30
51
|
ogTitle: parsnipEntry.basename,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PineappleFiberParser.d.ts","sourceRoot":"","sources":["../../../src/lib/scripts/pineapple_fiber/PineappleFiberParser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAU5E,eAAO,MAAM,SAAS,GAAU,aAAa,MAAM,KAAG,OAAO,CAAC,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"PineappleFiberParser.d.ts","sourceRoot":"","sources":["../../../src/lib/scripts/pineapple_fiber/PineappleFiberParser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAU5E,eAAO,MAAM,SAAS,GAAU,aAAa,MAAM,KAAG,OAAO,CAAC,YAAY,EAAE,CAyL3E,CAAC"}
|
|
@@ -123,6 +123,15 @@ export const parseYarn = (fileContent) => __awaiter(void 0, void 0, void 0, func
|
|
|
123
123
|
// handle choice start tags to a href
|
|
124
124
|
choiceList.forEach((choiceDetail) => {
|
|
125
125
|
const keyword = `<choice ${choiceDetail.name}>`;
|
|
126
|
+
if (!dialogDetails.textContent.includes(keyword)) {
|
|
127
|
+
console.warn(`Jump name is not used in any <choice> tag: (name: ${choiceDetail.name}); jump: ${choiceDetail.jumpNode}`);
|
|
128
|
+
if (dialogDetails.warningList) {
|
|
129
|
+
dialogDetails.warningList.push(`Jump name is not used in any <choice> tag: (name: ${choiceDetail.name}); jump: ${choiceDetail.jumpNode}`);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
dialogDetails.warningList = [`Jump name is not used in any <choice> tag: (name: ${choiceDetail.name}); jump: ${choiceDetail.jumpNode}`];
|
|
133
|
+
}
|
|
134
|
+
}
|
|
126
135
|
while (dialogDetails.textContent.includes(keyword)) {
|
|
127
136
|
dialogDetails.textContent = dialogDetails.textContent.replace(keyword, `<a class="choice-${choiceDetail.jumpNode} dialog-choice" title="Click to continue the dialog">`);
|
|
128
137
|
}
|
|
@@ -140,6 +149,16 @@ export const parseYarn = (fileContent) => __awaiter(void 0, void 0, void 0, func
|
|
|
140
149
|
// assume only one which indicates it is choiceless
|
|
141
150
|
dialogDetails.textContent = unprocessedContent;
|
|
142
151
|
}
|
|
152
|
+
// warn if choice has no jump warning
|
|
153
|
+
if (dialogDetails.textContent.includes('<choice')) {
|
|
154
|
+
console.warn(`There is a <choice ??> in the processed dialog that was not parsed to <a ??>:\n${dialogDetails.textContent}`);
|
|
155
|
+
if (dialogDetails.warningList) {
|
|
156
|
+
dialogDetails.warningList.push(`Choice has no jump: ${dialogDetails.textContent}`);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
dialogDetails.warningList = [`Choice has no jump: ${dialogDetails.textContent}`];
|
|
160
|
+
}
|
|
161
|
+
}
|
|
143
162
|
dialogDetailList.push(dialogDetails);
|
|
144
163
|
});
|
|
145
164
|
return dialogDetailList;
|