@ohos-ports/histoire-app 1.0.0-beta.0
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/LICENSE +21 -0
- package/dist/app/assets/histoire-text-dark.svg +89 -0
- package/dist/app/assets/histoire-text.svg +89 -0
- package/dist/app/assets/histoire.svg +51 -0
- package/dist/app/style/floating.pcss +34 -0
- package/dist/app/style/main.pcss +100 -0
- package/dist/app/style/sandbox.css +24 -0
- package/dist/app/style/transitions.pcss +51 -0
- package/dist/bundle-index.js +3 -0
- package/dist/bundle-main-dev.js +4 -0
- package/dist/bundle-main.js +5 -0
- package/dist/bundle-sandbox-dev.js +2 -0
- package/dist/bundle-sandbox.js +2 -0
- package/dist/bundled/App.vue.js +5 -0
- package/dist/bundled/App.vue2.js +167 -0
- package/dist/bundled/_virtual/_node-dom-env.js +188 -0
- package/dist/bundled/_virtual/_node-dom-polyfill.js +152 -0
- package/dist/bundled/_virtual/_plugin-vue_export-helper.js +10 -0
- package/dist/bundled/_virtual/histoire-commands.js +8 -0
- package/dist/bundled/_virtual/histoire-config.js +42 -0
- package/dist/bundled/_virtual/histoire-markdown-files.js +8 -0
- package/dist/bundled/_virtual/histoire-search-docs-data.js +11 -0
- package/dist/bundled/_virtual/histoire-search-title-data.js +11 -0
- package/dist/bundled/_virtual/histoire-stories.js +17 -0
- package/dist/bundled/_virtual/histoire-support-plugins-client.js +8 -0
- package/dist/bundled/_virtual/histoire-theme.js +8 -0
- package/dist/bundled/api.js +12 -0
- package/dist/bundled/app.css +116 -0
- package/dist/bundled/assets/histoire-text-dark.svg.js +4 -0
- package/dist/bundled/assets/histoire-text.svg.js +4 -0
- package/dist/bundled/assets/histoire.svg.js +4 -0
- package/dist/bundled/components/HomeView.vue.js +5 -0
- package/dist/bundled/components/HomeView.vue2.js +66 -0
- package/dist/bundled/components/app/AppHeader.vue.js +5 -0
- package/dist/bundled/components/app/AppHeader.vue2.js +71 -0
- package/dist/bundled/components/app/AppLogo.vue.js +5 -0
- package/dist/bundled/components/app/AppLogo.vue2.js +29 -0
- package/dist/bundled/components/app/Breadcrumb.vue.js +8 -0
- package/dist/bundled/components/app/Breadcrumb.vue2.js +91 -0
- package/dist/bundled/components/app/HomeCounter.vue.js +5 -0
- package/dist/bundled/components/app/HomeCounter.vue2.js +42 -0
- package/dist/bundled/components/app/InitialLoading.vue.js +5 -0
- package/dist/bundled/components/app/InitialLoading.vue2.js +51 -0
- package/dist/bundled/components/app/MobileOverlay.vue.js +5 -0
- package/dist/bundled/components/app/MobileOverlay.vue2.js +45 -0
- package/dist/bundled/components/base/BaseButton.vue.js +5 -0
- package/dist/bundled/components/base/BaseButton.vue2.js +39 -0
- package/dist/bundled/components/base/BaseCheckbox.vue.js +5 -0
- package/dist/bundled/components/base/BaseCheckbox.vue2.js +78 -0
- package/dist/bundled/components/base/BaseEmpty.vue.js +14 -0
- package/dist/bundled/components/base/BaseIcon.vue.js +8 -0
- package/dist/bundled/components/base/BaseIcon.vue2.js +29 -0
- package/dist/bundled/components/base/BaseKeyboardShortcut.vue.js +5 -0
- package/dist/bundled/components/base/BaseKeyboardShortcut.vue2.js +20 -0
- package/dist/bundled/components/base/BaseListItem.vue.js +5 -0
- package/dist/bundled/components/base/BaseListItem.vue2.js +33 -0
- package/dist/bundled/components/base/BaseListItemLink.vue.js +33 -0
- package/dist/bundled/components/base/BaseListItemLink.vue2.js +26 -0
- package/dist/bundled/components/base/BaseOverflowMenu.vue.js +5 -0
- package/dist/bundled/components/base/BaseOverflowMenu.vue2.js +100 -0
- package/dist/bundled/components/base/BaseOverflowTab.vue.js +36 -0
- package/dist/bundled/components/base/BaseOverflowTab.vue2.js +18 -0
- package/dist/bundled/components/base/BaseSelect.vue.js +5 -0
- package/dist/bundled/components/base/BaseSelect.vue2.js +77 -0
- package/dist/bundled/components/base/BaseSplitPane.vue.js +8 -0
- package/dist/bundled/components/base/BaseSplitPane.vue2.js +183 -0
- package/dist/bundled/components/base/BaseTab.vue.js +36 -0
- package/dist/bundled/components/base/BaseTab.vue2.js +18 -0
- package/dist/bundled/components/base/BaseTag.vue.js +13 -0
- package/dist/bundled/components/command/CommandPrompts.vue.js +5 -0
- package/dist/bundled/components/command/CommandPrompts.vue2.js +91 -0
- package/dist/bundled/components/command/CommandPromptsModal.vue.js +5 -0
- package/dist/bundled/components/command/CommandPromptsModal.vue2.js +45 -0
- package/dist/bundled/components/command/PromptSelect.vue.js +5 -0
- package/dist/bundled/components/command/PromptSelect.vue2.js +142 -0
- package/dist/bundled/components/command/PromptText.vue.js +5 -0
- package/dist/bundled/components/command/PromptText.vue2.js +67 -0
- package/dist/bundled/components/misc/CheckerboardPattern.vue.js +40 -0
- package/dist/bundled/components/misc/HatchedPattern.vue.js +12 -0
- package/dist/bundled/components/panel/ControlsComponentPropItem.vue.js +5 -0
- package/dist/bundled/components/panel/ControlsComponentPropItem.vue2.js +72 -0
- package/dist/bundled/components/panel/ControlsComponentProps.vue.js +5 -0
- package/dist/bundled/components/panel/ControlsComponentProps.vue2.js +45 -0
- package/dist/bundled/components/panel/ControlsComponentState.vue.js +5 -0
- package/dist/bundled/components/panel/ControlsComponentState.vue2.js +41 -0
- package/dist/bundled/components/panel/ControlsComponentStateItem.vue.js +5 -0
- package/dist/bundled/components/panel/ControlsComponentStateItem.vue2.js +46 -0
- package/dist/bundled/components/panel/PaneTabs.vue.js +5 -0
- package/dist/bundled/components/panel/PaneTabs.vue2.js +114 -0
- package/dist/bundled/components/panel/StatePresets.vue.js +5 -0
- package/dist/bundled/components/panel/StatePresets.vue2.js +193 -0
- package/dist/bundled/components/panel/StoryControls.vue.js +5 -0
- package/dist/bundled/components/panel/StoryControls.vue2.js +87 -0
- package/dist/bundled/components/panel/StoryDocs.vue.js +7 -0
- package/dist/bundled/components/panel/StoryDocs.vue2.js +161 -0
- package/dist/bundled/components/panel/StoryEvent.vue.js +5 -0
- package/dist/bundled/components/panel/StoryEvent.vue2.js +59 -0
- package/dist/bundled/components/panel/StoryEvents.vue.js +5 -0
- package/dist/bundled/components/panel/StoryEvents.vue2.js +53 -0
- package/dist/bundled/components/panel/StorySidePanel.vue.js +5 -0
- package/dist/bundled/components/panel/StorySidePanel.vue2.js +83 -0
- package/dist/bundled/components/panel/StorySourceCode.vue.js +8 -0
- package/dist/bundled/components/panel/StorySourceCode.vue2.js +204 -0
- package/dist/bundled/components/search/SearchItem.vue.js +8 -0
- package/dist/bundled/components/search/SearchItem.vue2.js +93 -0
- package/dist/bundled/components/search/SearchItemContent.vue.js +5 -0
- package/dist/bundled/components/search/SearchItemContent.vue2.js +71 -0
- package/dist/bundled/components/search/SearchLoading.vue.js +5 -0
- package/dist/bundled/components/search/SearchLoading.vue2.js +21 -0
- package/dist/bundled/components/search/SearchModal.vue.js +5 -0
- package/dist/bundled/components/search/SearchModal.vue2.js +51 -0
- package/dist/bundled/components/search/SearchPane.vue.js +5 -0
- package/dist/bundled/components/search/SearchPane.vue2.js +272 -0
- package/dist/bundled/components/search/search-docs-data.js +11 -0
- package/dist/bundled/components/search/search-title-data.js +11 -0
- package/dist/bundled/components/story/GenericMountStory.vue.js +5 -0
- package/dist/bundled/components/story/GenericMountStory.vue2.js +34 -0
- package/dist/bundled/components/story/GenericRenderStory.vue.js +5 -0
- package/dist/bundled/components/story/GenericRenderStory.vue2.js +39 -0
- package/dist/bundled/components/story/StoryResponsivePreview.vue.js +8 -0
- package/dist/bundled/components/story/StoryResponsivePreview.vue2.js +207 -0
- package/dist/bundled/components/story/StoryVariantGrid.vue.js +5 -0
- package/dist/bundled/components/story/StoryVariantGrid.vue2.js +146 -0
- package/dist/bundled/components/story/StoryVariantGridItem.vue.js +8 -0
- package/dist/bundled/components/story/StoryVariantGridItem.vue2.js +153 -0
- package/dist/bundled/components/story/StoryVariantListItem.vue.js +8 -0
- package/dist/bundled/components/story/StoryVariantListItem.vue2.js +55 -0
- package/dist/bundled/components/story/StoryVariantSingle.vue.js +8 -0
- package/dist/bundled/components/story/StoryVariantSingle.vue2.js +107 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewNative.vue.js +5 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewNative.vue2.js +70 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.vue.js +5 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.vue2.js +128 -0
- package/dist/bundled/components/story/StoryVariantSingleView.vue.js +5 -0
- package/dist/bundled/components/story/StoryVariantSingleView.vue2.js +66 -0
- package/dist/bundled/components/story/StoryView.vue.js +5 -0
- package/dist/bundled/components/story/StoryView.vue2.js +104 -0
- package/dist/bundled/components/story/StoryViewer.vue.js +8 -0
- package/dist/bundled/components/story/StoryViewer.vue2.js +55 -0
- package/dist/bundled/components/toolbar/DevOnlyToolbarOpenInEditor.vue.js +5 -0
- package/dist/bundled/components/toolbar/DevOnlyToolbarOpenInEditor.vue2.js +31 -0
- package/dist/bundled/components/toolbar/ToolbarBackground.vue.js +8 -0
- package/dist/bundled/components/toolbar/ToolbarBackground.vue2.js +98 -0
- package/dist/bundled/components/toolbar/ToolbarNewTab.vue.js +5 -0
- package/dist/bundled/components/toolbar/ToolbarNewTab.vue2.js +36 -0
- package/dist/bundled/components/toolbar/ToolbarResponsiveSize.vue.js +5 -0
- package/dist/bundled/components/toolbar/ToolbarResponsiveSize.vue2.js +127 -0
- package/dist/bundled/components/toolbar/ToolbarTextDirection.vue.js +5 -0
- package/dist/bundled/components/toolbar/ToolbarTextDirection.vue2.js +27 -0
- package/dist/bundled/components/toolbar/ToolbarTitle.vue.js +5 -0
- package/dist/bundled/components/toolbar/ToolbarTitle.vue2.js +26 -0
- package/dist/bundled/components/tree/StoryGroup.vue.js +5 -0
- package/dist/bundled/components/tree/StoryGroup.vue2.js +74 -0
- package/dist/bundled/components/tree/StoryList.vue.js +5 -0
- package/dist/bundled/components/tree/StoryList.vue2.js +41 -0
- package/dist/bundled/components/tree/StoryListFolder.vue.js +8 -0
- package/dist/bundled/components/tree/StoryListFolder.vue2.js +86 -0
- package/dist/bundled/components/tree/StoryListItem.vue.js +8 -0
- package/dist/bundled/components/tree/StoryListItem.vue2.js +69 -0
- package/dist/bundled/index.js +36 -0
- package/dist/bundled/plugin.js +49 -0
- package/dist/bundled/router.js +32 -0
- package/dist/bundled/sandbox.js +87 -0
- package/dist/bundled/stores/command.js +25 -0
- package/dist/bundled/stores/events.js +29 -0
- package/dist/bundled/stores/folder.js +54 -0
- package/dist/bundled/stores/preview-settings.js +19 -0
- package/dist/bundled/stores/story.js +43 -0
- package/dist/bundled/util/commands.js +57 -0
- package/dist/bundled/util/config.js +8 -0
- package/dist/bundled/util/const.js +10 -0
- package/dist/bundled/util/dark.js +28 -0
- package/dist/bundled/util/docs.js +26 -0
- package/dist/bundled/util/env.js +4 -0
- package/dist/bundled/util/events.js +33 -0
- package/dist/bundled/util/keyboard.js +90 -0
- package/dist/bundled/util/mapping.js +70 -0
- package/dist/bundled/util/open-in-editor.js +7 -0
- package/dist/bundled/util/preview-settings.js +21 -0
- package/dist/bundled/util/responsive.js +6 -0
- package/dist/bundled/util/sandbox.js +11 -0
- package/dist/bundled/util/scroll.js +31 -0
- package/dist/bundled/util/select.js +28 -0
- package/dist/bundled/util/state.js +41 -0
- package/dist/bundled/util/tooltip.js +15 -0
- package/dist/bundled/util/variant.js +21 -0
- package/dist/style.css +2853 -0
- package/package.json +62 -0
- package/postcss-scope-wrapper.cjs +35 -0
- package/postcss.config.cjs +9 -0
- package/scripts/copy.mjs +12 -0
- package/scripts/watchAndCopy.mjs +15 -0
- package/src/app/App.vue +172 -0
- package/src/app/api.ts +9 -0
- package/src/app/assets/histoire-text-dark.svg +89 -0
- package/src/app/assets/histoire-text.svg +89 -0
- package/src/app/assets/histoire.svg +51 -0
- package/src/app/components/HomeView.vue +61 -0
- package/src/app/components/app/AppHeader.vue +65 -0
- package/src/app/components/app/AppLogo.vue +25 -0
- package/src/app/components/app/Breadcrumb.vue +98 -0
- package/src/app/components/app/HomeCounter.vue +39 -0
- package/src/app/components/app/InitialLoading.vue +44 -0
- package/src/app/components/app/MobileOverlay.vue +33 -0
- package/src/app/components/base/BaseButton.vue +33 -0
- package/src/app/components/base/BaseCheckbox.vue +76 -0
- package/src/app/components/base/BaseCopyIcon.vue +34 -0
- package/src/app/components/base/BaseEmpty.vue +21 -0
- package/src/app/components/base/BaseIcon.vue +31 -0
- package/src/app/components/base/BaseKeyboardShortcut.vue +16 -0
- package/src/app/components/base/BaseListItem.vue +30 -0
- package/src/app/components/base/BaseListItemLink.vue +56 -0
- package/src/app/components/base/BaseOverflowMenu.vue +119 -0
- package/src/app/components/base/BaseOverflowTab.vue +47 -0
- package/src/app/components/base/BaseSelect.vue +75 -0
- package/src/app/components/base/BaseSplitPane.vue +244 -0
- package/src/app/components/base/BaseTab.vue +47 -0
- package/src/app/components/base/BaseTag.vue +5 -0
- package/src/app/components/command/CommandPrompts.vue +95 -0
- package/src/app/components/command/CommandPromptsModal.vue +41 -0
- package/src/app/components/command/PromptSelect.vue +142 -0
- package/src/app/components/command/PromptText.vue +65 -0
- package/src/app/components/misc/CheckerboardPattern.vue +32 -0
- package/src/app/components/misc/HatchedPattern.vue +13 -0
- package/src/app/components/panel/ControlsComponentPropItem.vue +73 -0
- package/src/app/components/panel/ControlsComponentProps.vue +34 -0
- package/src/app/components/panel/ControlsComponentState.vue +38 -0
- package/src/app/components/panel/ControlsComponentStateItem.vue +44 -0
- package/src/app/components/panel/PaneTabs.vue +84 -0
- package/src/app/components/panel/StatePresets.vue +199 -0
- package/src/app/components/panel/StoryControls.vue +97 -0
- package/src/app/components/panel/StoryDocs.vue +202 -0
- package/src/app/components/panel/StoryEvent.vue +54 -0
- package/src/app/components/panel/StoryEvents.vue +48 -0
- package/src/app/components/panel/StorySidePanel.vue +76 -0
- package/src/app/components/panel/StorySourceCode.vue +248 -0
- package/src/app/components/search/SearchItem.vue +89 -0
- package/src/app/components/search/SearchItemContent.vue +67 -0
- package/src/app/components/search/SearchLoading.vue +16 -0
- package/src/app/components/search/SearchModal.vue +44 -0
- package/src/app/components/search/SearchPane.vue +319 -0
- package/src/app/components/search/search-docs-data.ts +9 -0
- package/src/app/components/search/search-title-data.ts +9 -0
- package/src/app/components/search/types.ts +4 -0
- package/src/app/components/story/GenericMountStory.vue +35 -0
- package/src/app/components/story/GenericRenderStory.vue +41 -0
- package/src/app/components/story/StoryResponsivePreview.vue +216 -0
- package/src/app/components/story/StoryVariantGrid.vue +169 -0
- package/src/app/components/story/StoryVariantGridItem.vue +163 -0
- package/src/app/components/story/StoryVariantListItem.vue +52 -0
- package/src/app/components/story/StoryVariantSingle.vue +105 -0
- package/src/app/components/story/StoryVariantSinglePreviewNative.vue +66 -0
- package/src/app/components/story/StoryVariantSinglePreviewRemote.vue +143 -0
- package/src/app/components/story/StoryVariantSingleView.vue +61 -0
- package/src/app/components/story/StoryView.vue +110 -0
- package/src/app/components/story/StoryViewer.vue +52 -0
- package/src/app/components/toolbar/DevOnlyToolbarOpenInEditor.vue +23 -0
- package/src/app/components/toolbar/ToolbarBackground.vue +81 -0
- package/src/app/components/toolbar/ToolbarNewTab.vue +29 -0
- package/src/app/components/toolbar/ToolbarResponsiveSize.vue +82 -0
- package/src/app/components/toolbar/ToolbarTextDirection.vue +19 -0
- package/src/app/components/toolbar/ToolbarTitle.vue +21 -0
- package/src/app/components/tree/StoryGroup.vue +73 -0
- package/src/app/components/tree/StoryList.vue +35 -0
- package/src/app/components/tree/StoryListFolder.vue +88 -0
- package/src/app/components/tree/StoryListItem.vue +72 -0
- package/src/app/index.ts +33 -0
- package/src/app/plugin.ts +59 -0
- package/src/app/router.ts +29 -0
- package/src/app/sandbox.ts +101 -0
- package/src/app/stores/command.ts +26 -0
- package/src/app/stores/events.ts +36 -0
- package/src/app/stores/folder.ts +63 -0
- package/src/app/stores/preview-settings.ts +18 -0
- package/src/app/stores/story.ts +47 -0
- package/src/app/style/floating.pcss +34 -0
- package/src/app/style/main.pcss +100 -0
- package/src/app/style/sandbox.css +24 -0
- package/src/app/style/transitions.pcss +51 -0
- package/src/app/types.ts +72 -0
- package/src/app/util/commands.ts +57 -0
- package/src/app/util/config.ts +5 -0
- package/src/app/util/const.ts +4 -0
- package/src/app/util/dark.ts +27 -0
- package/src/app/util/docs.ts +27 -0
- package/src/app/util/env.ts +1 -0
- package/src/app/util/events.ts +31 -0
- package/src/app/util/keyboard.ts +103 -0
- package/src/app/util/mapping.ts +80 -0
- package/src/app/util/open-in-editor.ts +3 -0
- package/src/app/util/preview-settings.ts +23 -0
- package/src/app/util/responsive.ts +3 -0
- package/src/app/util/sandbox.ts +9 -0
- package/src/app/util/scroll.ts +32 -0
- package/src/app/util/select.ts +30 -0
- package/src/app/util/state.ts +45 -0
- package/src/app/util/tooltip.ts +13 -0
- package/src/app/util/variant.ts +21 -0
- package/src/bundle-index.js +1 -0
- package/src/bundle-main-dev.js +4 -0
- package/src/bundle-main.js +5 -0
- package/src/bundle-sandbox-dev.js +2 -0
- package/src/bundle-sandbox.js +2 -0
- package/src/index.ts +1 -0
- package/src/shim.d.ts +10 -0
- package/src/virtual.d.ts +7 -0
- package/tailwind.config.cjs +137 -0
- package/tsconfig.json +53 -0
- package/vite.config.ts +88 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Icon } from '@iconify/vue'
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
import { histoireConfig } from '../../util/config'
|
|
5
|
+
import { isDark, toggleDark } from '../../util/dark'
|
|
6
|
+
import { onKeyboardShortcut } from '../../util/keyboard'
|
|
7
|
+
import { makeTooltip } from '../../util/tooltip'
|
|
8
|
+
import AppLogo from './AppLogo.vue'
|
|
9
|
+
|
|
10
|
+
defineEmits({
|
|
11
|
+
search: () => true,
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const themeIcon = computed(() => {
|
|
15
|
+
return isDark.value ? 'carbon:moon' : 'carbon:sun'
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
onKeyboardShortcut(['ctrl+shift+d', 'meta+shift+d'], (event) => {
|
|
19
|
+
event.preventDefault()
|
|
20
|
+
toggleDark()
|
|
21
|
+
})
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<div
|
|
26
|
+
class="histoire-app-header htw-px-4 htw-h-16 htw-flex htw-items-center htw-gap-2"
|
|
27
|
+
>
|
|
28
|
+
<div class="htw-py-3 sm:htw-py-4 htw-flex-1 htw-h-full htw-flex htw-items-center htw-pr-2">
|
|
29
|
+
<a
|
|
30
|
+
:href="histoireConfig.theme?.logoHref"
|
|
31
|
+
target="_blank"
|
|
32
|
+
class="htw-w-full htw-h-full htw-flex htw-items-center"
|
|
33
|
+
>
|
|
34
|
+
<AppLogo
|
|
35
|
+
class="htw-max-w-full htw-max-h-full"
|
|
36
|
+
/>
|
|
37
|
+
</a>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="htw-ml-auto htw-flex-none htw-flex">
|
|
40
|
+
<a
|
|
41
|
+
v-tooltip="makeTooltip('Search', ({ isMac }) => isMac ? 'meta+k' : 'ctrl+k')"
|
|
42
|
+
class="htw-p-2 sm:htw-p-1 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer htw-text-gray-900 dark:htw-text-gray-100"
|
|
43
|
+
data-test-id="search-btn"
|
|
44
|
+
@click="$emit('search')"
|
|
45
|
+
>
|
|
46
|
+
<Icon
|
|
47
|
+
icon="carbon:search"
|
|
48
|
+
class="htw-w-6 htw-h-6 sm:htw-w-4 sm:htw-h-4"
|
|
49
|
+
/>
|
|
50
|
+
</a>
|
|
51
|
+
|
|
52
|
+
<a
|
|
53
|
+
v-if="!histoireConfig.theme.hideColorSchemeSwitch"
|
|
54
|
+
v-tooltip="makeTooltip('Toggle dark mode', ({ isMac }) => isMac ? 'meta+shift+d' : 'ctrl+shift+d')"
|
|
55
|
+
class="htw-p-2 sm:htw-p-1 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer htw-text-gray-900 dark:htw-text-gray-100"
|
|
56
|
+
@click="toggleDark()"
|
|
57
|
+
>
|
|
58
|
+
<Icon
|
|
59
|
+
:icon="themeIcon"
|
|
60
|
+
class="htw-w-6 htw-h-6 sm:htw-w-4 sm:htw-h-4"
|
|
61
|
+
/>
|
|
62
|
+
</a>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import HistoireLogoDark from '../../assets/histoire-text-dark.svg'
|
|
4
|
+
import HistoireLogoLight from '../../assets/histoire-text.svg'
|
|
5
|
+
|
|
6
|
+
import { customLogos, histoireConfig } from '../../util/config'
|
|
7
|
+
import { isDark } from '../../util/dark'
|
|
8
|
+
|
|
9
|
+
const logoUrl = computed(() => {
|
|
10
|
+
if (isDark.value) {
|
|
11
|
+
return histoireConfig.theme.logo?.dark ? customLogos.dark : HistoireLogoDark
|
|
12
|
+
}
|
|
13
|
+
return histoireConfig.theme.logo?.light ? customLogos.light : HistoireLogoLight
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const altText = computed(() => `${histoireConfig.theme.title} logo`)
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<img
|
|
21
|
+
class="histoire-app-logo"
|
|
22
|
+
:src="logoUrl"
|
|
23
|
+
:alt="altText"
|
|
24
|
+
>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { Story, Tree } from '../../types'
|
|
3
|
+
import { Icon } from '@iconify/vue'
|
|
4
|
+
import { computed, ref, watch } from 'vue'
|
|
5
|
+
import { useStoryStore } from '../../stores/story'
|
|
6
|
+
import StoryList from '../tree/StoryList.vue'
|
|
7
|
+
import MobileOverlay from './MobileOverlay.vue'
|
|
8
|
+
|
|
9
|
+
defineProps<{
|
|
10
|
+
tree: Tree
|
|
11
|
+
stories: Story[]
|
|
12
|
+
}>()
|
|
13
|
+
|
|
14
|
+
const storyStore = useStoryStore()
|
|
15
|
+
|
|
16
|
+
const story = computed(() => storyStore.currentStory)
|
|
17
|
+
|
|
18
|
+
const folders = computed(() => {
|
|
19
|
+
return story.value.file.path.slice(0, -1)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const isMenuOpened = ref(false)
|
|
23
|
+
|
|
24
|
+
function openMenu() {
|
|
25
|
+
isMenuOpened.value = true
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function closeMenu() {
|
|
29
|
+
isMenuOpened.value = false
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
watch(story, () => {
|
|
33
|
+
isMenuOpened.value = false
|
|
34
|
+
})
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<div class="histoire-breadcrumb">
|
|
39
|
+
<a
|
|
40
|
+
class="htw-px-6 htw-h-12 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer htw-flex htw-gap-2 htw-flex-wrap htw-w-full htw-items-center"
|
|
41
|
+
@click="openMenu"
|
|
42
|
+
>
|
|
43
|
+
<template v-if="story">
|
|
44
|
+
<template
|
|
45
|
+
v-for="(file, key) of folders"
|
|
46
|
+
:key="key"
|
|
47
|
+
>
|
|
48
|
+
<span>
|
|
49
|
+
{{ file }}
|
|
50
|
+
</span>
|
|
51
|
+
<span class="htw-opacity-40">
|
|
52
|
+
/
|
|
53
|
+
</span>
|
|
54
|
+
</template>
|
|
55
|
+
<span class="htw-flex htw-items-center htw-gap-2">
|
|
56
|
+
<Icon
|
|
57
|
+
:icon="story.icon ?? 'carbon:cube'"
|
|
58
|
+
class="htw-w-5 htw-h-5 htw-flex-none"
|
|
59
|
+
:class="{
|
|
60
|
+
'htw-text-primary-500': !story.iconColor,
|
|
61
|
+
'bind-icon-color': story.iconColor,
|
|
62
|
+
}"
|
|
63
|
+
/>
|
|
64
|
+
{{ story.title }}
|
|
65
|
+
<span class="htw-opacity-40 htw-text-sm">
|
|
66
|
+
{{ story.variants.length }}
|
|
67
|
+
</span>
|
|
68
|
+
</span>
|
|
69
|
+
</template>
|
|
70
|
+
<template v-else>
|
|
71
|
+
Select a story...
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<Icon
|
|
75
|
+
icon="carbon:chevron-sort"
|
|
76
|
+
class="htw-w-5 htw-h-5 htw-shrink-0 htw-ml-auto"
|
|
77
|
+
/>
|
|
78
|
+
</a>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<MobileOverlay
|
|
82
|
+
title="Select a story"
|
|
83
|
+
:opened="isMenuOpened"
|
|
84
|
+
@close="closeMenu"
|
|
85
|
+
>
|
|
86
|
+
<StoryList
|
|
87
|
+
:tree="tree"
|
|
88
|
+
:stories="stories"
|
|
89
|
+
class="htw-flex-1 htw-overflow-y-scroll"
|
|
90
|
+
/>
|
|
91
|
+
</MobileOverlay>
|
|
92
|
+
</template>
|
|
93
|
+
|
|
94
|
+
<style scoped>
|
|
95
|
+
.bind-icon-color {
|
|
96
|
+
color: v-bind('story?.iconColor');
|
|
97
|
+
}
|
|
98
|
+
</style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Icon } from '@iconify/vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
icon: {
|
|
6
|
+
type: String,
|
|
7
|
+
default: 'carbon:cube',
|
|
8
|
+
},
|
|
9
|
+
title: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: '',
|
|
12
|
+
},
|
|
13
|
+
count: {
|
|
14
|
+
type: Number,
|
|
15
|
+
default: 0,
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<div class="htw-p-2 htw-flex htw-items-center htw-gap-x-2">
|
|
22
|
+
<Icon
|
|
23
|
+
:icon="props.icon"
|
|
24
|
+
class="htw-text-2xl htw-text-gray-700 dark:htw-text-gray-300 htw-flex-none"
|
|
25
|
+
/>
|
|
26
|
+
<div class="htw-flex htw-flex-col htw-leading-none">
|
|
27
|
+
<span
|
|
28
|
+
class="htw-text-primary-500 htw-min-w-[80px] htw-font-bold"
|
|
29
|
+
>
|
|
30
|
+
{{ count }}
|
|
31
|
+
</span>
|
|
32
|
+
<span
|
|
33
|
+
class="htw-text-sm htw-text-gray-900 dark:htw-text-gray-100"
|
|
34
|
+
>
|
|
35
|
+
{{ title }}
|
|
36
|
+
</span>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { reactive } from 'vue'
|
|
3
|
+
|
|
4
|
+
const progress = reactive({
|
|
5
|
+
loaded: 0,
|
|
6
|
+
total: 0,
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
const maxCols = window.innerWidth / 20
|
|
10
|
+
|
|
11
|
+
if (import.meta.hot) {
|
|
12
|
+
import.meta.hot.on('histoire:stories-loading-progress', (data) => {
|
|
13
|
+
progress.loaded = data.loadedFileCount
|
|
14
|
+
progress.total = data.totalFileCount
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<div class="histoire-initial-loading htw-fixed htw-inset-0 htw-bg-white dark:htw-bg-gray-700 htw-flex htw-flex-col htw-gap-6 htw-items-center htw-justify-center">
|
|
21
|
+
<transition name="__histoire-fade">
|
|
22
|
+
<div
|
|
23
|
+
v-if="progress.total > 0"
|
|
24
|
+
class="htw-grid htw-gap-2"
|
|
25
|
+
:style="{
|
|
26
|
+
gridTemplateColumns: `repeat(${Math.min(Math.ceil(Math.sqrt(progress.total)), maxCols)}, minmax(0, 1fr))`,
|
|
27
|
+
}"
|
|
28
|
+
>
|
|
29
|
+
<div
|
|
30
|
+
v-for="n in progress.total"
|
|
31
|
+
:key="n"
|
|
32
|
+
class="htw-bg-primary-500/10 htw-rounded-full"
|
|
33
|
+
>
|
|
34
|
+
<div
|
|
35
|
+
class="htw-w-3 htw-h-3 htw-bg-primary-500 htw-rounded-full htw-duration-150 htw-ease-out"
|
|
36
|
+
:class="{
|
|
37
|
+
'htw-transition-transform htw-scale-0': n >= progress.loaded,
|
|
38
|
+
}"
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</transition>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { Icon } from '@iconify/vue'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
title: string
|
|
6
|
+
opened: boolean
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const emit = defineEmits<{ (e: 'close'): void }>()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<transition name="__histoire-fade-bottom">
|
|
14
|
+
<div
|
|
15
|
+
v-if="opened"
|
|
16
|
+
class="histoire-mobile-overlay htw-absolute htw-z-10 htw-bg-white dark:htw-bg-gray-700 htw-w-screen htw-h-screen htw-inset-0 htw-overflow-hidden htw-flex htw-flex-col"
|
|
17
|
+
>
|
|
18
|
+
<div class="htw-p-4 htw-h-16 htw-flex htw-border-b htw-border-gray-100 dark:htw-border-gray-800 htw-items-center htw-place-content-between">
|
|
19
|
+
<span class="htw-text-gray-500">{{ title }}</span>
|
|
20
|
+
<a
|
|
21
|
+
class="htw-p-1 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer"
|
|
22
|
+
@click="emit('close')"
|
|
23
|
+
>
|
|
24
|
+
<Icon
|
|
25
|
+
icon="carbon:close"
|
|
26
|
+
class="htw-w-8 htw-h-8 htw-shrink-0"
|
|
27
|
+
/>
|
|
28
|
+
</a>
|
|
29
|
+
</div>
|
|
30
|
+
<slot />
|
|
31
|
+
</div>
|
|
32
|
+
</transition>
|
|
33
|
+
</template>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { RouterLink } from 'vue-router'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
to?: any
|
|
7
|
+
href?: string
|
|
8
|
+
color?: string
|
|
9
|
+
}>()
|
|
10
|
+
|
|
11
|
+
const comp = computed(() => {
|
|
12
|
+
if (props.to) {
|
|
13
|
+
return RouterLink
|
|
14
|
+
}
|
|
15
|
+
if (props.href) {
|
|
16
|
+
return 'a'
|
|
17
|
+
}
|
|
18
|
+
return 'button'
|
|
19
|
+
})
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<component
|
|
24
|
+
:is="comp"
|
|
25
|
+
class="histoire-base-button htw-rounded htw-cursor-pointer"
|
|
26
|
+
:class="{
|
|
27
|
+
'htw-bg-primary-200 dark:htw-bg-primary-800 hover:htw-bg-primary-300 dark:hover:htw-bg-primary-700': color === 'primary' || !color,
|
|
28
|
+
'htw-bg-grey-100 dark:htw-bg-grey-900 hover:htw-bg-grey-200 dark:hover:htw-bg-grey-800': color === 'grey',
|
|
29
|
+
}"
|
|
30
|
+
>
|
|
31
|
+
<slot />
|
|
32
|
+
</component>
|
|
33
|
+
</template>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed, ref, watch } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
modelValue: {
|
|
6
|
+
type: Boolean,
|
|
7
|
+
default: false,
|
|
8
|
+
},
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
const emit = defineEmits({
|
|
12
|
+
'update:modelValue': (_newValue: boolean) => true,
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
function toggle() {
|
|
16
|
+
emit('update:modelValue', !props.modelValue)
|
|
17
|
+
animationEnabled.value = true
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// SVG check
|
|
21
|
+
|
|
22
|
+
const path = ref<SVGPathElement>()
|
|
23
|
+
const dasharray = ref(0)
|
|
24
|
+
const progress = computed(() => props.modelValue ? 1 : 0)
|
|
25
|
+
const dashoffset = computed(() => (1 - progress.value) * dasharray.value)
|
|
26
|
+
const animationEnabled = ref(false)
|
|
27
|
+
|
|
28
|
+
watch(path, () => {
|
|
29
|
+
dasharray.value = path.value.getTotalLength?.() ?? 21.21
|
|
30
|
+
})
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<div
|
|
35
|
+
role="checkbox"
|
|
36
|
+
tabindex="0"
|
|
37
|
+
class="histoire-base-checkbox htw-flex htw-items-center htw-gap-2 htw-select-none htw-px-4 htw-py-3 htw-cursor-pointer hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700"
|
|
38
|
+
@click="toggle()"
|
|
39
|
+
@keydown.enter.prevent="toggle()"
|
|
40
|
+
@keydown.space.prevent="toggle()"
|
|
41
|
+
>
|
|
42
|
+
<div class="htw-text-white htw-w-[16px] htw-h-[16px] htw-relative">
|
|
43
|
+
<div
|
|
44
|
+
class="htw-border group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out"
|
|
45
|
+
:class="[
|
|
46
|
+
modelValue
|
|
47
|
+
? 'htw-border-primary-500 htw-border-8'
|
|
48
|
+
: 'htw-border-black/25 dark:htw-border-white/25 htw-delay-150',
|
|
49
|
+
]"
|
|
50
|
+
/>
|
|
51
|
+
<svg
|
|
52
|
+
width="16"
|
|
53
|
+
height="16"
|
|
54
|
+
viewBox="0 0 24 24"
|
|
55
|
+
class="htw-relative htw-z-10"
|
|
56
|
+
>
|
|
57
|
+
<path
|
|
58
|
+
ref="path"
|
|
59
|
+
d="m 4 12 l 5 5 l 10 -10"
|
|
60
|
+
fill="none"
|
|
61
|
+
class="htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out"
|
|
62
|
+
:class="[
|
|
63
|
+
animationEnabled ? 'htw-transition-all' : 'htw-transition-none',
|
|
64
|
+
{
|
|
65
|
+
'htw-delay-150': modelValue,
|
|
66
|
+
},
|
|
67
|
+
]"
|
|
68
|
+
:stroke-dasharray="dasharray"
|
|
69
|
+
:stroke-dashoffset="dashoffset"
|
|
70
|
+
/>
|
|
71
|
+
</svg>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<slot />
|
|
75
|
+
</div>
|
|
76
|
+
</template>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export default {
|
|
3
|
+
name: 'HstCopyIcon',
|
|
4
|
+
}
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
import { Icon } from '@iconify/vue'
|
|
9
|
+
import { useClipboard } from '@vueuse/core'
|
|
10
|
+
import { VTooltip as vTooltip } from 'floating-vue'
|
|
11
|
+
|
|
12
|
+
const props = defineProps<{
|
|
13
|
+
content: string
|
|
14
|
+
}>()
|
|
15
|
+
|
|
16
|
+
const { copy, copied } = useClipboard()
|
|
17
|
+
|
|
18
|
+
const action = () => copy(props.content)
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<Icon
|
|
23
|
+
v-tooltip="{
|
|
24
|
+
content: 'Copied!',
|
|
25
|
+
triggers: [],
|
|
26
|
+
shown: copied,
|
|
27
|
+
distance: 12,
|
|
28
|
+
delay: 0,
|
|
29
|
+
}"
|
|
30
|
+
icon="carbon:copy-file"
|
|
31
|
+
class="histoire-base-copy-icon htw-w-4 htw-h-4 htw-opacity-50 hover:htw-opacity-100 hover:htw-text-primary-500 htw-cursor-pointer"
|
|
32
|
+
@click="action()"
|
|
33
|
+
/>
|
|
34
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="histoire-base-empty htw-base-empty htw-flex htw-flex-col htw-items-center htw-justify-center htw-space-y-4 htw-py-12 htw-h-full htw-text-center htw-text-gray-400 htw-text-lg">
|
|
3
|
+
<slot />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<style scoped>
|
|
8
|
+
.htw-base-empty:not(.no-animation) {
|
|
9
|
+
animation: htw-base-empty .15s .2s both;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@keyframes htw-base-empty {
|
|
13
|
+
0% {
|
|
14
|
+
opacity: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
100% {
|
|
18
|
+
opacity: 1;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
</style>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { Icon } from '@iconify/vue'
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
icon: string
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const isUrl = computed(() => props.icon.startsWith('http') || props.icon.startsWith('data:image')
|
|
10
|
+
|| props.icon.startsWith('.') || props.icon.startsWith('/'))
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<img
|
|
15
|
+
v-if="isUrl"
|
|
16
|
+
:src="icon"
|
|
17
|
+
:alt="icon"
|
|
18
|
+
class="histoire-base-icon"
|
|
19
|
+
>
|
|
20
|
+
<Icon
|
|
21
|
+
v-else
|
|
22
|
+
:icon="icon"
|
|
23
|
+
class="histoire-base-icon"
|
|
24
|
+
/>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<style scoped>
|
|
28
|
+
img.colorize-black {
|
|
29
|
+
filter: grayscale(100) brightness(0);
|
|
30
|
+
}
|
|
31
|
+
</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { formatKey } from '../../util/keyboard.js'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
shortcut: string
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const formatted = computed(() => props.shortcut.split('+').map(k => formatKey(k.trim())).join(' '))
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<span class="histoire-base-keyboard-shortcut htw-border htw-border-current htw-opacity-50 htw-px-1 htw-rounded-sm">
|
|
14
|
+
{{ formatted }}
|
|
15
|
+
</span>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
defineProps<{
|
|
3
|
+
isActive?: boolean
|
|
4
|
+
}>()
|
|
5
|
+
|
|
6
|
+
const emit = defineEmits<{
|
|
7
|
+
(e: 'navigate'): void
|
|
8
|
+
}>()
|
|
9
|
+
|
|
10
|
+
function handleNavigate() {
|
|
11
|
+
emit('navigate')
|
|
12
|
+
}
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<a
|
|
17
|
+
class="istoire-base-list-ite htw-flex htw-items-center htw-gap-2 htw-text-gray-900 dark:htw-text-gray-100"
|
|
18
|
+
:class="[
|
|
19
|
+
$attrs.class,
|
|
20
|
+
isActive
|
|
21
|
+
? 'active htw-bg-primary-500 hover:htw-bg-primary-600 htw-text-white dark:htw-text-black'
|
|
22
|
+
: 'hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900',
|
|
23
|
+
]"
|
|
24
|
+
@click="handleNavigate()"
|
|
25
|
+
@keyup.enter="handleNavigate()"
|
|
26
|
+
@keyup.space="handleNavigate()"
|
|
27
|
+
>
|
|
28
|
+
<slot />
|
|
29
|
+
</a>
|
|
30
|
+
</template>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent } from 'vue'
|
|
3
|
+
|
|
4
|
+
export default defineComponent({
|
|
5
|
+
inheritAttrs: false,
|
|
6
|
+
|
|
7
|
+
props: {
|
|
8
|
+
isActive: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: undefined,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
emits: {
|
|
15
|
+
navigate: () => true,
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
setup(props, { emit }) {
|
|
19
|
+
function handleNavigate(event, navigate: (event) => unknown) {
|
|
20
|
+
emit('navigate')
|
|
21
|
+
navigate(event)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
handleNavigate,
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<RouterLink
|
|
33
|
+
v-slot="{ isActive: linkIsActive, href, navigate }"
|
|
34
|
+
class="histoire-base-list-item-link"
|
|
35
|
+
v-bind="$attrs"
|
|
36
|
+
custom
|
|
37
|
+
>
|
|
38
|
+
<a
|
|
39
|
+
:href="href"
|
|
40
|
+
class="htw-flex htw-items-center htw-gap-2 htw-text-gray-900 dark:htw-text-gray-100"
|
|
41
|
+
:class="[
|
|
42
|
+
$attrs.class,
|
|
43
|
+
(isActive != null ? isActive : linkIsActive)
|
|
44
|
+
? 'active htw-bg-primary-500 hover:htw-bg-primary-600 htw-text-white dark:htw-text-black'
|
|
45
|
+
: 'hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900',
|
|
46
|
+
]"
|
|
47
|
+
@click="handleNavigate($event, navigate)"
|
|
48
|
+
@keyup.enter="handleNavigate($event, navigate)"
|
|
49
|
+
@keyup.space="handleNavigate($event, navigate)"
|
|
50
|
+
>
|
|
51
|
+
<slot
|
|
52
|
+
:active="isActive != null ? isActive : linkIsActive"
|
|
53
|
+
/>
|
|
54
|
+
</a>
|
|
55
|
+
</RouterLink>
|
|
56
|
+
</template>
|