From bce557cc2dc767628bed6aac87301a1be7c5431b Mon Sep 17 00:00:00 2001 From: rxliuli Date: Tue, 4 Nov 2025 05:03:50 +0800 Subject: init commit --- .../jet/item/Annotation/AnnotationItem.svelte | 17 +++ .../Annotation/LegacyAnnotationRenderer.svelte | 146 +++++++++++++++++++++ .../Annotation/ModernAnnotationItemRenderer.svelte | 114 ++++++++++++++++ 3 files changed, 277 insertions(+) create mode 100644 src/components/jet/item/Annotation/AnnotationItem.svelte create mode 100644 src/components/jet/item/Annotation/LegacyAnnotationRenderer.svelte create mode 100644 src/components/jet/item/Annotation/ModernAnnotationItemRenderer.svelte (limited to 'src/components/jet/item/Annotation') diff --git a/src/components/jet/item/Annotation/AnnotationItem.svelte b/src/components/jet/item/Annotation/AnnotationItem.svelte new file mode 100644 index 0000000..38bb269 --- /dev/null +++ b/src/components/jet/item/Annotation/AnnotationItem.svelte @@ -0,0 +1,17 @@ + + +{#if shouldRenderModernAnnotation} + +{:else} + +{/if} diff --git a/src/components/jet/item/Annotation/LegacyAnnotationRenderer.svelte b/src/components/jet/item/Annotation/LegacyAnnotationRenderer.svelte new file mode 100644 index 0000000..fc6586f --- /dev/null +++ b/src/components/jet/item/Annotation/LegacyAnnotationRenderer.svelte @@ -0,0 +1,146 @@ + + +{#if shouldRenderAsDefinitionList(items)} +
+ {#each items as annotationItem} +
{annotationItem.heading}
+
{annotationItem.text}
+ {/each} +
+{:else if shouldRenderAsOrderedList(items)} +
    + {#each items as annotationItem} + {#if annotationItem.textPairs} + {#each annotationItem.textPairs as [text, subtext]} +
  1. + {text} + {subtext} +
  2. + {/each} + {:else} +
  3. {annotationItem.text}
  4. + {/if} + {/each} +
+{:else if shouldRenderAsUnorderedList(items)} +
    + {#each items as annotationItem} +
  • + + {annotationItem.text} + +
  • + {/each} +
+{:else if shouldRenderAsDefinitionListWithHeading(items)} + {@const [heading, ...remainingItems] = items} +
+

{heading.text}

+ +
+ {#each remainingItems as annotationItem} +
{annotationItem.heading}
+
{annotationItem.text}
+ {/each} +
+
+{:else} +
+
    + {#each items as annotationItem} +
  • {annotationItem.text}
  • + {/each} +
+ {#if isSome(linkAction) && isFlowAction(linkAction)} + + {linkAction.title} + + {/if} +
+{/if} + + diff --git a/src/components/jet/item/Annotation/ModernAnnotationItemRenderer.svelte b/src/components/jet/item/Annotation/ModernAnnotationItemRenderer.svelte new file mode 100644 index 0000000..20611d3 --- /dev/null +++ b/src/components/jet/item/Annotation/ModernAnnotationItemRenderer.svelte @@ -0,0 +1,114 @@ + + +
    + {#each items as annotationItem} +
  • + {#if annotationItem.$kind === 'textEncapsulation'} +
    + {annotationItem.text} +
    + {:else if annotationItem.$kind === 'linkableText'} +
    + {@html sanitizeHtml( + formatStyledText( + annotationItem.linkableText.styledText.rawText, + ), + )} +
    + {:else if annotationItem.$kind === 'artwork'} + {#if isSystemImageArtwork(annotationItem.artwork)} +
    + +
    + {/if} + {:else if annotationItem.$kind === 'textPair'} +
    + {annotationItem.leadingText} + + {annotationItem.trailingText} + +
    + {:else if annotationItem.$kind === 'button'} +
    + + {annotationItem.action.title} + +
    + {:else if annotationItem.$kind === 'spacer'} +
    + {/if} +
  • + {/each} +
+ + -- cgit v1.2.3