From bce557cc2dc767628bed6aac87301a1be7c5431b Mon Sep 17 00:00:00 2001
From: rxliuli <rxliuli@gmail.com>
Date: Tue, 4 Nov 2025 05:03:50 +0800
Subject: init commit

---
 src/components/jet/action/FlowAction.svelte | 41 +++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 src/components/jet/action/FlowAction.svelte

(limited to 'src/components/jet/action/FlowAction.svelte')

diff --git a/src/components/jet/action/FlowAction.svelte b/src/components/jet/action/FlowAction.svelte
new file mode 100644
index 0000000..3e55e82
--- /dev/null
+++ b/src/components/jet/action/FlowAction.svelte
@@ -0,0 +1,41 @@
+<script lang="ts">
+    import type { HTMLAnchorAttributes } from 'svelte/elements';
+    import type { FlowAction } from '@jet-app/app-store/api/models';
+    import { getJetPerform } from '~/jet';
+
+    type AllowedAnchorAttributes = Omit<
+        HTMLAnchorAttributes,
+        // The `href` attribute is not allowed because it will be provided
+        // by the `FlowAction`
+        'href'
+    >;
+
+    interface $$Props extends AllowedAnchorAttributes {
+        destination: FlowAction;
+    }
+
+    const perform = getJetPerform();
+
+    export let destination: FlowAction;
+
+    // Web cannot support internal protocols, so this guard prevents
+    // them from showing up in anchor tags.
+    $: pageUrl = destination.pageUrl?.includes('x-as3-internal:')
+        ? '#'
+        : destination?.pageUrl;
+
+    function onClick(event: MouseEvent) {
+        event.preventDefault();
+
+        perform(destination);
+    }
+</script>
+
+<a
+    {...$$restProps}
+    href={pageUrl}
+    data-test-id="internal-link"
+    on:click={onClick}
+>
+    <slot />
+</a>
-- 
cgit v1.2.3

