@scalar/components 0.14.23 → 0.14.25
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/README.md +7 -0
- package/dist/components/ScalarCodeBlock/ScalarCodeBlock.vue.d.ts.map +1 -1
- package/dist/components/ScalarCodeBlock/ScalarCodeBlock.vue.js +22 -31
- package/dist/components/ScalarCodeBlock/ScalarCodeBlockCopy.vue.d.ts +11 -0
- package/dist/components/ScalarCodeBlock/ScalarCodeBlockCopy.vue.d.ts.map +1 -0
- package/dist/components/ScalarCodeBlock/ScalarCodeBlockCopy.vue.js +7 -0
- package/dist/components/ScalarCodeBlock/ScalarCodeBlockCopy.vue2.js +66 -0
- package/dist/components/ScalarCodeBlock/ScalarCodeBlockCopy.vue3.js +4 -0
- package/dist/components/ScalarCodeBlock/index.d.ts +1 -0
- package/dist/components/ScalarCodeBlock/index.d.ts.map +1 -1
- package/dist/components/ScalarHotkey/ScalarHotkey.vue.d.ts +8 -0
- package/dist/components/ScalarHotkey/ScalarHotkey.vue.d.ts.map +1 -0
- package/dist/components/ScalarHotkey/ScalarHotkey.vue.js +30 -0
- package/dist/components/ScalarHotkey/ScalarHotkey.vue2.js +4 -0
- package/dist/components/ScalarHotkey/constants.d.ts +30 -0
- package/dist/components/ScalarHotkey/constants.d.ts.map +1 -0
- package/dist/components/ScalarHotkey/constants.js +29 -0
- package/dist/components/ScalarHotkey/formatHotkey.d.ts +10 -0
- package/dist/components/ScalarHotkey/formatHotkey.d.ts.map +1 -0
- package/dist/components/ScalarHotkey/formatHotkey.js +21 -0
- package/dist/components/ScalarHotkey/index.d.ts +4 -0
- package/dist/components/ScalarHotkey/index.d.ts.map +1 -0
- package/dist/components/ScalarHotkey/types.d.ts +5 -0
- package/dist/components/ScalarHotkey/types.d.ts.map +1 -0
- package/dist/components/ScalarMarkdown/ScalarMarkdown.vue.d.ts +6 -14
- package/dist/components/ScalarMarkdown/ScalarMarkdown.vue.d.ts.map +1 -1
- package/dist/components/ScalarMarkdown/ScalarMarkdown.vue.js +27 -30
- package/dist/components/ScalarMarkdown/ScalarMarkdownSummary.vue.d.ts +59 -0
- package/dist/components/ScalarMarkdown/ScalarMarkdownSummary.vue.d.ts.map +1 -0
- package/dist/components/ScalarMarkdown/ScalarMarkdownSummary.vue.js +63 -0
- package/dist/components/ScalarMarkdown/ScalarMarkdownSummary.vue2.js +4 -0
- package/dist/components/ScalarMarkdown/ScalarMarkdownSummary.vue3.js +5 -0
- package/dist/components/ScalarMarkdown/index.d.ts +1 -0
- package/dist/components/ScalarMarkdown/index.d.ts.map +1 -1
- package/dist/components/ScalarMarkdown/samples/alerts.d.ts +3 -0
- package/dist/components/ScalarMarkdown/samples/alerts.d.ts.map +1 -0
- package/dist/components/ScalarMarkdown/samples/blockquotes.d.ts +3 -0
- package/dist/components/ScalarMarkdown/samples/blockquotes.d.ts.map +1 -0
- package/dist/components/ScalarMarkdown/samples/codeblocks.d.ts +3 -0
- package/dist/components/ScalarMarkdown/samples/codeblocks.d.ts.map +1 -0
- package/dist/components/ScalarMarkdown/samples/document.d.ts +3 -0
- package/dist/components/ScalarMarkdown/samples/document.d.ts.map +1 -0
- package/dist/components/ScalarMarkdown/samples/headers.d.ts +3 -0
- package/dist/components/ScalarMarkdown/samples/headers.d.ts.map +1 -0
- package/dist/components/ScalarMarkdown/samples/html.d.ts +3 -0
- package/dist/components/ScalarMarkdown/samples/html.d.ts.map +1 -0
- package/dist/components/ScalarMarkdown/samples/index.d.ts +32 -0
- package/dist/components/ScalarMarkdown/samples/index.d.ts.map +1 -0
- package/dist/components/ScalarMarkdown/samples/inline.d.ts +3 -0
- package/dist/components/ScalarMarkdown/samples/inline.d.ts.map +1 -0
- package/dist/components/ScalarMarkdown/samples/lists.d.ts +3 -0
- package/dist/components/ScalarMarkdown/samples/lists.d.ts.map +1 -0
- package/dist/components/ScalarMarkdown/samples/paragraphs.d.ts +3 -0
- package/dist/components/ScalarMarkdown/samples/paragraphs.d.ts.map +1 -0
- package/dist/components/ScalarMarkdown/samples/tables.d.ts +3 -0
- package/dist/components/ScalarMarkdown/samples/tables.d.ts.map +1 -0
- package/dist/components/ScalarMarkdown/types.d.ts +39 -0
- package/dist/components/ScalarMarkdown/types.d.ts.map +1 -0
- package/dist/components/ScalarTooltip/ScalarHotkeyTooltip.vue.d.ts +38 -0
- package/dist/components/ScalarTooltip/ScalarHotkeyTooltip.vue.d.ts.map +1 -0
- package/dist/components/ScalarTooltip/ScalarHotkeyTooltip.vue.js +62 -0
- package/dist/components/ScalarTooltip/ScalarHotkeyTooltip.vue2.js +4 -0
- package/dist/components/ScalarTooltip/ScalarTooltip.vue.d.ts +2 -12
- package/dist/components/ScalarTooltip/ScalarTooltip.vue.d.ts.map +1 -1
- package/dist/components/ScalarTooltip/index.d.ts +2 -1
- package/dist/components/ScalarTooltip/index.d.ts.map +1 -1
- package/dist/components/ScalarTooltip/types.d.ts +35 -0
- package/dist/components/ScalarTooltip/types.d.ts.map +1 -1
- package/dist/components/ScalarTooltip/useTooltip.d.ts.map +1 -1
- package/dist/components/ScalarTooltip/useTooltip.js +44 -32
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +169 -158
- package/dist/style.css +1 -1
- package/package.json +16 -7
- package/dist/components/ScalarButton/ScalarButton.stories.d.ts +0 -263
- package/dist/components/ScalarButton/ScalarButton.stories.d.ts.map +0 -1
- package/dist/components/ScalarButton/ScalarButton.test.d.ts +0 -2
- package/dist/components/ScalarButton/ScalarButton.test.d.ts.map +0 -1
- package/dist/components/ScalarCard/ScalarCard.stories.d.ts +0 -10
- package/dist/components/ScalarCard/ScalarCard.stories.d.ts.map +0 -1
- package/dist/components/ScalarCard/ScalarCard.test.d.ts +0 -2
- package/dist/components/ScalarCard/ScalarCard.test.d.ts.map +0 -1
- package/dist/components/ScalarCheckbox/ScalarCheckbox.stories.d.ts +0 -236
- package/dist/components/ScalarCheckbox/ScalarCheckbox.stories.d.ts.map +0 -1
- package/dist/components/ScalarCodeBlock/ScalarCodeBlock.stories.d.ts +0 -93
- package/dist/components/ScalarCodeBlock/ScalarCodeBlock.stories.d.ts.map +0 -1
- package/dist/components/ScalarCodeBlock/ScalarCodeBlock.test.d.ts +0 -2
- package/dist/components/ScalarCodeBlock/ScalarCodeBlock.test.d.ts.map +0 -1
- package/dist/components/ScalarColorModeToggle/ScalarColorModeToggle.stories.d.ts +0 -9
- package/dist/components/ScalarColorModeToggle/ScalarColorModeToggle.stories.d.ts.map +0 -1
- package/dist/components/ScalarColorModeToggle/ScalarColorModeToggle.test.d.ts +0 -2
- package/dist/components/ScalarColorModeToggle/ScalarColorModeToggle.test.d.ts.map +0 -1
- package/dist/components/ScalarCombobox/ScalarCombobox.stories.d.ts +0 -55
- package/dist/components/ScalarCombobox/ScalarCombobox.stories.d.ts.map +0 -1
- package/dist/components/ScalarCombobox/ScalarCombobox.test.d.ts +0 -2
- package/dist/components/ScalarCombobox/ScalarCombobox.test.d.ts.map +0 -1
- package/dist/components/ScalarCombobox/ScalarComboboxMultiselect.test.d.ts +0 -2
- package/dist/components/ScalarCombobox/ScalarComboboxMultiselect.test.d.ts.map +0 -1
- package/dist/components/ScalarCombobox/ScalarComboboxOption.test.d.ts +0 -2
- package/dist/components/ScalarCombobox/ScalarComboboxOption.test.d.ts.map +0 -1
- package/dist/components/ScalarCombobox/ScalarComboboxOptionGroup.test.d.ts +0 -2
- package/dist/components/ScalarCombobox/ScalarComboboxOptionGroup.test.d.ts.map +0 -1
- package/dist/components/ScalarCombobox/ScalarComboboxOptions.test.d.ts +0 -2
- package/dist/components/ScalarCombobox/ScalarComboboxOptions.test.d.ts.map +0 -1
- package/dist/components/ScalarCombobox/ScalarComboboxPopover.test.d.ts +0 -2
- package/dist/components/ScalarCombobox/ScalarComboboxPopover.test.d.ts.map +0 -1
- package/dist/components/ScalarContextMenu/ScalarContextMenu.stories.d.ts +0 -273
- package/dist/components/ScalarContextMenu/ScalarContextMenu.stories.d.ts.map +0 -1
- package/dist/components/ScalarContextMenu/ScalarContextMenu.test.d.ts +0 -2
- package/dist/components/ScalarContextMenu/ScalarContextMenu.test.d.ts.map +0 -1
- package/dist/components/ScalarDropdown/ScalarDropdown.stories.d.ts +0 -232
- package/dist/components/ScalarDropdown/ScalarDropdown.stories.d.ts.map +0 -1
- package/dist/components/ScalarDropdown/ScalarDropdown.test.d.ts +0 -2
- package/dist/components/ScalarDropdown/ScalarDropdown.test.d.ts.map +0 -1
- package/dist/components/ScalarErrorBoundary/ScalarErrorBoundary.stories.d.ts +0 -6
- package/dist/components/ScalarErrorBoundary/ScalarErrorBoundary.stories.d.ts.map +0 -1
- package/dist/components/ScalarErrorBoundary/ScalarErrorBoundary.test.d.ts +0 -2
- package/dist/components/ScalarErrorBoundary/ScalarErrorBoundary.test.d.ts.map +0 -1
- package/dist/components/ScalarFileUpload/ScalarFileUpload.stories.d.ts +0 -364
- package/dist/components/ScalarFileUpload/ScalarFileUpload.stories.d.ts.map +0 -1
- package/dist/components/ScalarFileUpload/ScalarFileUpload.test.d.ts +0 -2
- package/dist/components/ScalarFileUpload/ScalarFileUpload.test.d.ts.map +0 -1
- package/dist/components/ScalarFloating/ScalarFloating.stories.d.ts +0 -6
- package/dist/components/ScalarFloating/ScalarFloating.stories.d.ts.map +0 -1
- package/dist/components/ScalarFloating/ScalarFloating.test.d.ts +0 -2
- package/dist/components/ScalarFloating/ScalarFloating.test.d.ts.map +0 -1
- package/dist/components/ScalarFloating/useResizeWithTarget.test.d.ts +0 -2
- package/dist/components/ScalarFloating/useResizeWithTarget.test.d.ts.map +0 -1
- package/dist/components/ScalarForm/ScalarForm.stories.d.ts +0 -9
- package/dist/components/ScalarForm/ScalarForm.stories.d.ts.map +0 -1
- package/dist/components/ScalarForm/ScalarForm.test.d.ts +0 -2
- package/dist/components/ScalarForm/ScalarForm.test.d.ts.map +0 -1
- package/dist/components/ScalarHeader/ScalarHeader.stories.d.ts +0 -146
- package/dist/components/ScalarHeader/ScalarHeader.stories.d.ts.map +0 -1
- package/dist/components/ScalarHeader/ScalarHeader.test.d.ts +0 -2
- package/dist/components/ScalarHeader/ScalarHeader.test.d.ts.map +0 -1
- package/dist/components/ScalarIcon/ScalarIcon.stories.d.ts +0 -52
- package/dist/components/ScalarIcon/ScalarIcon.stories.d.ts.map +0 -1
- package/dist/components/ScalarIcon/ScalarIcon.test.d.ts +0 -2
- package/dist/components/ScalarIcon/ScalarIcon.test.d.ts.map +0 -1
- package/dist/components/ScalarIcon/ScalarIconLegacyAdapter.test.d.ts +0 -2
- package/dist/components/ScalarIcon/ScalarIconLegacyAdapter.test.d.ts.map +0 -1
- package/dist/components/ScalarIconButton/ScalarIconButton.stories.d.ts +0 -44
- package/dist/components/ScalarIconButton/ScalarIconButton.stories.d.ts.map +0 -1
- package/dist/components/ScalarIconButton/ScalarIconButton.test.d.ts +0 -2
- package/dist/components/ScalarIconButton/ScalarIconButton.test.d.ts.map +0 -1
- package/dist/components/ScalarListbox/ScalarListbox.stories.d.ts +0 -98
- package/dist/components/ScalarListbox/ScalarListbox.stories.d.ts.map +0 -1
- package/dist/components/ScalarListbox/ScalarListbox.test.d.ts +0 -2
- package/dist/components/ScalarListbox/ScalarListbox.test.d.ts.map +0 -1
- package/dist/components/ScalarLoading/ScalarLoading.stories.d.ts +0 -120
- package/dist/components/ScalarLoading/ScalarLoading.stories.d.ts.map +0 -1
- package/dist/components/ScalarLoading/ScalarLoading.test.d.ts +0 -2
- package/dist/components/ScalarLoading/ScalarLoading.test.d.ts.map +0 -1
- package/dist/components/ScalarMarkdown/ScalarMarkdown.stories.d.ts +0 -110
- package/dist/components/ScalarMarkdown/ScalarMarkdown.stories.d.ts.map +0 -1
- package/dist/components/ScalarMarkdown/ScalarMarkdown.test.d.ts +0 -2
- package/dist/components/ScalarMarkdown/ScalarMarkdown.test.d.ts.map +0 -1
- package/dist/components/ScalarMenu/ScalarMenu.stories.d.ts +0 -129
- package/dist/components/ScalarMenu/ScalarMenu.stories.d.ts.map +0 -1
- package/dist/components/ScalarMenu/ScalarMenu.test.d.ts +0 -2
- package/dist/components/ScalarMenu/ScalarMenu.test.d.ts.map +0 -1
- package/dist/components/ScalarModal/ScalarModal.stories.d.ts +0 -66
- package/dist/components/ScalarModal/ScalarModal.stories.d.ts.map +0 -1
- package/dist/components/ScalarModal/ScalarModal.test.d.ts +0 -2
- package/dist/components/ScalarModal/ScalarModal.test.d.ts.map +0 -1
- package/dist/components/ScalarPopover/ScalarPopover.stories.d.ts +0 -167
- package/dist/components/ScalarPopover/ScalarPopover.stories.d.ts.map +0 -1
- package/dist/components/ScalarPopover/ScalarPopover.test.d.ts +0 -2
- package/dist/components/ScalarPopover/ScalarPopover.test.d.ts.map +0 -1
- package/dist/components/ScalarSearchInput/ScalarSearchInput.stories.d.ts +0 -82
- package/dist/components/ScalarSearchInput/ScalarSearchInput.stories.d.ts.map +0 -1
- package/dist/components/ScalarSearchInput/ScalarSearchInput.test.d.ts +0 -2
- package/dist/components/ScalarSearchInput/ScalarSearchInput.test.d.ts.map +0 -1
- package/dist/components/ScalarSearchResults/ScalarSearchResults.stories.d.ts +0 -158
- package/dist/components/ScalarSearchResults/ScalarSearchResults.stories.d.ts.map +0 -1
- package/dist/components/ScalarSearchResults/ScalarSearchResults.test.d.ts +0 -2
- package/dist/components/ScalarSearchResults/ScalarSearchResults.test.d.ts.map +0 -1
- package/dist/components/ScalarSidebar/ScalarSidebar.stories.d.ts +0 -11
- package/dist/components/ScalarSidebar/ScalarSidebar.stories.d.ts.map +0 -1
- package/dist/components/ScalarSidebar/ScalarSidebar.test.d.ts +0 -2
- package/dist/components/ScalarSidebar/ScalarSidebar.test.d.ts.map +0 -1
- package/dist/components/ScalarSidebar/ScalarSidebarGroup.test.d.ts +0 -2
- package/dist/components/ScalarSidebar/ScalarSidebarGroup.test.d.ts.map +0 -1
- package/dist/components/ScalarSidebar/ScalarSidebarSearchInput.test.d.ts +0 -2
- package/dist/components/ScalarSidebar/ScalarSidebarSearchInput.test.d.ts.map +0 -1
- package/dist/components/ScalarSidebar/findScrollContainer.test.d.ts +0 -2
- package/dist/components/ScalarSidebar/findScrollContainer.test.d.ts.map +0 -1
- package/dist/components/ScalarSidebar/useSidebarGroups.test.d.ts +0 -2
- package/dist/components/ScalarSidebar/useSidebarGroups.test.d.ts.map +0 -1
- package/dist/components/ScalarSidebar/useSidebarNestedItems.test.d.ts +0 -2
- package/dist/components/ScalarSidebar/useSidebarNestedItems.test.d.ts.map +0 -1
- package/dist/components/ScalarTeleport/ScalarTeleport.stories.d.ts +0 -7
- package/dist/components/ScalarTeleport/ScalarTeleport.stories.d.ts.map +0 -1
- package/dist/components/ScalarTeleport/ScalarTeleport.test.d.ts +0 -2
- package/dist/components/ScalarTeleport/ScalarTeleport.test.d.ts.map +0 -1
- package/dist/components/ScalarTeleport/useTeleport.test.d.ts +0 -2
- package/dist/components/ScalarTeleport/useTeleport.test.d.ts.map +0 -1
- package/dist/components/ScalarTextArea/ScalarTextArea.stories.d.ts +0 -7
- package/dist/components/ScalarTextArea/ScalarTextArea.stories.d.ts.map +0 -1
- package/dist/components/ScalarTextArea/ScalarTextArea.test.d.ts +0 -2
- package/dist/components/ScalarTextArea/ScalarTextArea.test.d.ts.map +0 -1
- package/dist/components/ScalarTextInput/ScalarTextInput.stories.d.ts +0 -9
- package/dist/components/ScalarTextInput/ScalarTextInput.stories.d.ts.map +0 -1
- package/dist/components/ScalarTextInput/ScalarTextInput.test.d.ts +0 -2
- package/dist/components/ScalarTextInput/ScalarTextInput.test.d.ts.map +0 -1
- package/dist/components/ScalarToggle/ScalarToggle.stories.d.ts +0 -79
- package/dist/components/ScalarToggle/ScalarToggle.stories.d.ts.map +0 -1
- package/dist/components/ScalarToggle/ScalarToggle.test.d.ts +0 -2
- package/dist/components/ScalarToggle/ScalarToggle.test.d.ts.map +0 -1
- package/dist/components/ScalarTooltip/ScalarTooltip.stories.d.ts +0 -229
- package/dist/components/ScalarTooltip/ScalarTooltip.stories.d.ts.map +0 -1
- package/dist/components/ScalarTooltip/ScalarTooltip.test.d.ts +0 -2
- package/dist/components/ScalarTooltip/ScalarTooltip.test.d.ts.map +0 -1
- package/dist/components/ScalarTooltip/useTooltip.test.d.ts +0 -2
- package/dist/components/ScalarTooltip/useTooltip.test.d.ts.map +0 -1
- package/dist/components/ScalarVirtualText/ScalarVirtualText.stories.d.ts +0 -94
- package/dist/components/ScalarVirtualText/ScalarVirtualText.stories.d.ts.map +0 -1
- package/dist/components/ScalarVirtualText/ScalarVirtualText.test.d.ts +0 -2
- package/dist/components/ScalarVirtualText/ScalarVirtualText.test.d.ts.map +0 -1
- package/dist/docs/icons/ScalarIcons.stories.d.ts +0 -63
- package/dist/docs/icons/ScalarIcons.stories.d.ts.map +0 -1
- package/dist/docs/useBindCx/useBindCx.stories.d.ts +0 -426
- package/dist/docs/useBindCx/useBindCx.stories.d.ts.map +0 -1
- package/dist/helpers/add-scalar-classes.test.d.ts +0 -2
- package/dist/helpers/add-scalar-classes.test.d.ts.map +0 -1
- package/dist/scripts/typegen.d.ts +0 -2
- package/dist/scripts/typegen.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -105,6 +105,12 @@ Since you can directly target the reference element with Tailwind classes any cl
|
|
|
105
105
|
|
|
106
106
|
The components package uses the same [CSS Layers](https://developer.mozilla.org/en-US/docs/Web/CSS/@layer) as the themes package to apply the theme styles. For more information see the [themes README](https://github.com/scalar/scalar/tree/main/packages/themes).
|
|
107
107
|
|
|
108
|
+
## Testing
|
|
109
|
+
|
|
110
|
+
The components library uses both unit testing (vitest) and snapshot testing to ensure quality and visual consistency. Snapshot tests are written using Playwright and capture screenshots of Storybook stories to detect visual regressions.
|
|
111
|
+
|
|
112
|
+
For detailed information about the testing setup, see the [test README](./test/README.md).
|
|
113
|
+
|
|
108
114
|
## Contributing
|
|
109
115
|
|
|
110
116
|
All pull requests should include the following checklist:
|
|
@@ -123,4 +129,5 @@ All pull requests should include the following checklist:
|
|
|
123
129
|
- [ ] Allows overriding of Tailwind classes where applicable (see useBindCx)
|
|
124
130
|
- [ ] Has stories showcasing any applicable variants
|
|
125
131
|
- [ ] Has unit tests covering any applicable interactions
|
|
132
|
+
- [ ] Has snapshot tests covering any visual variations
|
|
126
133
|
```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScalarCodeBlock.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCodeBlock/ScalarCodeBlock.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScalarCodeBlock.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCodeBlock/ScalarCodeBlock.vue"],"names":[],"mappings":"AA4FA;;GAEG;AACH,KAAK,WAAW,GAAG;IACf,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACnC,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAC;;UAJO,MAAM;iBACC,OAAO;UAEd,OAAO;;AAiHlB,wBAQG"}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { syntaxHighlight as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class: "scalar-code-block custom-scroll min-h-12 focus-visible:outline",
|
|
1
|
+
import { defineComponent as d, useId as u, computed as l, createElementBlock as m, openBlock as c, createBlock as p, createCommentVNode as f, createElementVNode as h, unref as t } from "vue";
|
|
2
|
+
import { syntaxHighlight as g, standardLanguages as k } from "@scalar/code-highlight";
|
|
3
|
+
import { prettyPrintJson as r } from "@scalar/oas-utils/helpers";
|
|
4
|
+
import C from "./ScalarCodeBlockCopy.vue.js";
|
|
5
|
+
const _ = {
|
|
6
|
+
class: "scalar-code-block group/code-block custom-scroll min-h-12 focus-visible:outline",
|
|
8
7
|
tabindex: "0"
|
|
9
|
-
},
|
|
10
|
-
key: 0,
|
|
11
|
-
class: "scalar-code-copy"
|
|
12
|
-
}, _ = ["innerHTML"], T = /* @__PURE__ */ y({
|
|
8
|
+
}, b = ["id", "innerHTML"], H = /* @__PURE__ */ d({
|
|
13
9
|
__name: "ScalarCodeBlock",
|
|
14
10
|
props: {
|
|
15
11
|
content: {},
|
|
@@ -18,32 +14,27 @@ const k = {
|
|
|
18
14
|
hideCredentials: {},
|
|
19
15
|
copy: { type: Boolean, default: !0 }
|
|
20
16
|
},
|
|
21
|
-
setup(
|
|
22
|
-
const e =
|
|
17
|
+
setup(a) {
|
|
18
|
+
const e = a, n = u(), s = l(() => g(r(e.content), {
|
|
23
19
|
lang: e.lang.trim(),
|
|
24
|
-
languages:
|
|
20
|
+
languages: k,
|
|
25
21
|
lineNumbers: e.lineNumbers,
|
|
26
22
|
maskCredentials: e.hideCredentials
|
|
27
|
-
}).slice(5, -6)),
|
|
28
|
-
return (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
t[1] || (t[1] = c("span", { class: "sr-only" }, "Copy content", -1)),
|
|
37
|
-
f(l(g), { class: "size-4" })
|
|
38
|
-
])) : a("", !0)
|
|
39
|
-
])) : a("", !0),
|
|
40
|
-
c("pre", {
|
|
23
|
+
}).slice(5, -6)), i = l(() => e.content !== null && e.content !== "null" && e.content !== "404 Not Found");
|
|
24
|
+
return (o, y) => (c(), m("div", _, [
|
|
25
|
+
o.copy && i.value ? (c(), p(t(C), {
|
|
26
|
+
key: 0,
|
|
27
|
+
content: t(r)(e.content),
|
|
28
|
+
controls: t(n)
|
|
29
|
+
}, null, 8, ["content", "controls"])) : f("", !0),
|
|
30
|
+
h("pre", {
|
|
31
|
+
id: t(n),
|
|
41
32
|
class: "scalar-codeblock-pre",
|
|
42
|
-
innerHTML:
|
|
43
|
-
}, null, 8,
|
|
33
|
+
innerHTML: s.value
|
|
34
|
+
}, null, 8, b)
|
|
44
35
|
]));
|
|
45
36
|
}
|
|
46
37
|
});
|
|
47
38
|
export {
|
|
48
|
-
|
|
39
|
+
H as default
|
|
49
40
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** Content to copy to clipboard */
|
|
3
|
+
content: string | object;
|
|
4
|
+
/** ID of the parent element this button controls */
|
|
5
|
+
controls?: string;
|
|
6
|
+
/** Class to apply to the copy button */
|
|
7
|
+
class?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=ScalarCodeBlockCopy.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScalarCodeBlockCopy.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCodeBlock/ScalarCodeBlockCopy.vue"],"names":[],"mappings":"AA4HA,KAAK,WAAW,GAAG;IACjB,mCAAmC;IACnC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;IACxB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAC;;AA+JF,wBAOG"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { defineComponent as f, ref as d, createElementBlock as n, openBlock as l, normalizeClass as s, unref as o, createVNode as a, createCommentVNode as m, withCtx as y } from "vue";
|
|
2
|
+
import { ScalarIconCopy as C, ScalarIconCheck as h } from "@scalar/icons";
|
|
3
|
+
import { cva as v, cx as i } from "@scalar/use-hooks/useBindCx";
|
|
4
|
+
import { useClipboard as b } from "@scalar/use-hooks/useClipboard";
|
|
5
|
+
import k from "../ScalarButton/ScalarButton.vue.js";
|
|
6
|
+
const g = {
|
|
7
|
+
key: 0,
|
|
8
|
+
role: "alert",
|
|
9
|
+
class: "sr-only"
|
|
10
|
+
}, N = /* @__PURE__ */ f({
|
|
11
|
+
__name: "ScalarCodeBlockCopy",
|
|
12
|
+
props: {
|
|
13
|
+
content: {},
|
|
14
|
+
controls: {},
|
|
15
|
+
class: {}
|
|
16
|
+
},
|
|
17
|
+
setup(t) {
|
|
18
|
+
const { copyToClipboard: r } = b(), e = d(!1), u = async () => {
|
|
19
|
+
if (e.value)
|
|
20
|
+
return;
|
|
21
|
+
const c = typeof t.content == "string" ? t.content : JSON.stringify(t.content, null, 2);
|
|
22
|
+
await r(c), e.value = !0, setTimeout(() => {
|
|
23
|
+
e.value = !1;
|
|
24
|
+
}, 1200);
|
|
25
|
+
}, p = v({
|
|
26
|
+
base: "absolute top-0 right-0 h-8 w-8 p-0 flex items-center justify-center brightness-lifted bg-inherit rounded focus-visible:opacity-100 -outline-offset-1",
|
|
27
|
+
variants: {
|
|
28
|
+
showCopied: {
|
|
29
|
+
true: "text-c-1",
|
|
30
|
+
false: "text-c-3 hover:text-c-1"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
return (c, x) => (l(), n("div", {
|
|
35
|
+
class: s(
|
|
36
|
+
o(i)(
|
|
37
|
+
"scalar-code-copy opacity-0 group-hover/code-block:opacity-100 sticky flex inset-0 justify-end items-start bg-inherit",
|
|
38
|
+
t.class
|
|
39
|
+
)
|
|
40
|
+
)
|
|
41
|
+
}, [
|
|
42
|
+
a(o(k), {
|
|
43
|
+
class: s(o(i)(o(p)({ showCopied: e.value }))),
|
|
44
|
+
type: "button",
|
|
45
|
+
variant: "ghost",
|
|
46
|
+
"aria-controls": c.controls,
|
|
47
|
+
"aria-label": "Copy",
|
|
48
|
+
onClick: u
|
|
49
|
+
}, {
|
|
50
|
+
default: y(() => [
|
|
51
|
+
a(o(C), {
|
|
52
|
+
class: s(["copy-icon size-4", { copied: e.value }])
|
|
53
|
+
}, null, 8, ["class"]),
|
|
54
|
+
a(o(h), {
|
|
55
|
+
class: s(["check-icon size-4", { visible: e.value }])
|
|
56
|
+
}, null, 8, ["class"])
|
|
57
|
+
]),
|
|
58
|
+
_: 1
|
|
59
|
+
}, 8, ["class", "aria-controls"]),
|
|
60
|
+
e.value ? (l(), n("div", g, " Copied ")) : m("", !0)
|
|
61
|
+
], 2));
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
export {
|
|
65
|
+
N as default
|
|
66
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCodeBlock/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCodeBlock/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HotKeyModifier } from './types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
hotkey: string;
|
|
4
|
+
modifier?: HotKeyModifier[];
|
|
5
|
+
};
|
|
6
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
export default _default;
|
|
8
|
+
//# sourceMappingURL=ScalarHotkey.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScalarHotkey.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarHotkey/ScalarHotkey.vue"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAI7C,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAA;CAC5B,CAAC;;AA2EF,wBAMG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineComponent as c, computed as m, createElementBlock as e, openBlock as t, normalizeProps as u, guardReactiveProps as p, unref as n, Fragment as f, renderList as y, createElementVNode as a, toDisplayString as s } from "vue";
|
|
2
|
+
import { useBindCx as h } from "@scalar/use-hooks/useBindCx";
|
|
3
|
+
import { formatHotkeySymbols as k, getKeyLabel as x } from "./formatHotkey.js";
|
|
4
|
+
const _ = {
|
|
5
|
+
"aria-hidden": "true",
|
|
6
|
+
class: "contents"
|
|
7
|
+
}, g = { class: "sr-only" }, E = /* @__PURE__ */ c({
|
|
8
|
+
inheritAttrs: !1,
|
|
9
|
+
__name: "ScalarHotkey",
|
|
10
|
+
props: {
|
|
11
|
+
hotkey: {},
|
|
12
|
+
modifier: { default: () => ["Meta"] }
|
|
13
|
+
},
|
|
14
|
+
setup(o) {
|
|
15
|
+
const { cx: i } = h(), d = m(() => k(o.hotkey, o.modifier));
|
|
16
|
+
return (b, v) => (t(), e("div", u(p(
|
|
17
|
+
n(i)(
|
|
18
|
+
"border-(--scalar-background-3) inline-flex gap-0.5 overflow-hidden rounded border text-xxs rounded-b p-1 font-medium uppercase leading-none"
|
|
19
|
+
)
|
|
20
|
+
)), [
|
|
21
|
+
(t(!0), e(f, null, y(d.value, (r, l) => (t(), e("div", { key: l }, [
|
|
22
|
+
a("span", _, s(r), 1),
|
|
23
|
+
a("span", g, s(n(x)(r)), 1)
|
|
24
|
+
]))), 128))
|
|
25
|
+
], 16));
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
E as default
|
|
30
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Screen reader labels for the hotkey modifiers */
|
|
2
|
+
export declare const HOTKEY_LABELS: {
|
|
3
|
+
readonly '\u2318': "Command";
|
|
4
|
+
readonly '^': "Control";
|
|
5
|
+
readonly ctrl: "Control";
|
|
6
|
+
readonly '\u2325': "Option";
|
|
7
|
+
readonly alt: "Alt";
|
|
8
|
+
readonly '\u21E7': "Shift";
|
|
9
|
+
readonly '\u21EA': "Caps Lock";
|
|
10
|
+
readonly '\u21B5': "Enter";
|
|
11
|
+
readonly '\u2190': "Left Arrow";
|
|
12
|
+
readonly '\u2192': "Right Arrow";
|
|
13
|
+
readonly '\u2191': "Up Arrow";
|
|
14
|
+
readonly '\u2193': "Down Arrow";
|
|
15
|
+
};
|
|
16
|
+
/** Symbols for the hotkey modifiers on MacOS */
|
|
17
|
+
export declare const MODIFIER_KEY_SYMBOLS_MACOS: {
|
|
18
|
+
readonly Meta: "⌘";
|
|
19
|
+
readonly Shift: "⇧";
|
|
20
|
+
readonly Alt: "⌥";
|
|
21
|
+
readonly Control: "^";
|
|
22
|
+
};
|
|
23
|
+
/** Symbols for the hotkey modifiers outside of MacOS */
|
|
24
|
+
export declare const MODIFIER_KEY_SYMBOLS: {
|
|
25
|
+
readonly Meta: "ctrl";
|
|
26
|
+
readonly Shift: "⇧";
|
|
27
|
+
readonly Alt: "alt";
|
|
28
|
+
readonly Control: "ctrl";
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarHotkey/constants.ts"],"names":[],"mappings":"AAEA,oDAAoD;AACpD,eAAO,MAAM,aAAa;;;;;;;;;;;;;CAahB,CAAA;AAEV,gDAAgD;AAChD,eAAO,MAAM,0BAA0B;;;;;CAKkB,CAAA;AAEzD,wDAAwD;AACxD,eAAO,MAAM,oBAAoB;;;;;CAKwB,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const t = {
|
|
2
|
+
"⌘": "Command",
|
|
3
|
+
"^": "Control",
|
|
4
|
+
ctrl: "Control",
|
|
5
|
+
"⌥": "Option",
|
|
6
|
+
alt: "Alt",
|
|
7
|
+
"⇧": "Shift",
|
|
8
|
+
"⇪": "Caps Lock",
|
|
9
|
+
"↵": "Enter",
|
|
10
|
+
"←": "Left Arrow",
|
|
11
|
+
"→": "Right Arrow",
|
|
12
|
+
"↑": "Up Arrow",
|
|
13
|
+
"↓": "Down Arrow"
|
|
14
|
+
}, o = {
|
|
15
|
+
Meta: "⌘",
|
|
16
|
+
Shift: "⇧",
|
|
17
|
+
Alt: "⌥",
|
|
18
|
+
Control: "^"
|
|
19
|
+
}, r = {
|
|
20
|
+
Meta: "ctrl",
|
|
21
|
+
Shift: "⇧",
|
|
22
|
+
Alt: "alt",
|
|
23
|
+
Control: "ctrl"
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
t as HOTKEY_LABELS,
|
|
27
|
+
r as MODIFIER_KEY_SYMBOLS,
|
|
28
|
+
o as MODIFIER_KEY_SYMBOLS_MACOS
|
|
29
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HotKeyModifier } from './types';
|
|
2
|
+
/** Typescript helper to check if a modifier is the default modifier */
|
|
3
|
+
export declare function isDefault(modifier: HotKeyModifier): modifier is 'default';
|
|
4
|
+
/** Get the modifier key symbol for a modifier */
|
|
5
|
+
export declare function getModifierKeySymbol(modifier: HotKeyModifier): string;
|
|
6
|
+
/** Format the hotkey symbols for a hotkey */
|
|
7
|
+
export declare function formatHotkeySymbols(hotkey: string, modifier: HotKeyModifier[]): string[];
|
|
8
|
+
/** Get the hotkey label for a hotkey */
|
|
9
|
+
export declare function getKeyLabel(key: string): string;
|
|
10
|
+
//# sourceMappingURL=formatHotkey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatHotkey.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarHotkey/formatHotkey.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAK7C,uEAAuE;AACvE,wBAAgB,SAAS,CAAC,QAAQ,EAAE,cAAc,GAAG,QAAQ,IAAI,SAAS,CAEzE;AAKD,iDAAiD;AACjD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAGrE;AAED,6CAA6C;AAC7C,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,MAAM,EAAE,CAGxF;AAKD,wCAAwC;AACxC,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isMacOS as n } from "@scalar/helpers/general/is-mac-os";
|
|
2
|
+
import { HOTKEY_LABELS as e, MODIFIER_KEY_SYMBOLS_MACOS as i, MODIFIER_KEY_SYMBOLS as f } from "./constants.js";
|
|
3
|
+
function u(t) {
|
|
4
|
+
return t === "default";
|
|
5
|
+
}
|
|
6
|
+
function m(t) {
|
|
7
|
+
const o = u(t) ? "Meta" : t;
|
|
8
|
+
return n() ? i[o] : f[o];
|
|
9
|
+
}
|
|
10
|
+
function c(t, o) {
|
|
11
|
+
return [...o.map((r) => m(r)), t];
|
|
12
|
+
}
|
|
13
|
+
function s(t) {
|
|
14
|
+
return t in e ? e[t] : t;
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
c as formatHotkeySymbols,
|
|
18
|
+
s as getKeyLabel,
|
|
19
|
+
m as getModifierKeySymbol,
|
|
20
|
+
u as isDefault
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarHotkey/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEpD,YAAY,EAAE,cAAc,IAAI,oBAAoB,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarHotkey/types.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,MAAM,MAAM,cAAc,GAAG,iBAAiB,GAAG,SAAS,CAAA;AAE1D,0CAA0C;AAC1C,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,CAAA"}
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class?: string;
|
|
8
|
-
withAnchors?: boolean;
|
|
9
|
-
anchorPrefix?: string;
|
|
10
|
-
};
|
|
11
|
-
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
12
|
-
withImages: boolean;
|
|
13
|
-
withAnchors: boolean;
|
|
14
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
1
|
+
import type { ScalarMarkdownProps } from './types';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<ScalarMarkdownProps, {
|
|
3
|
+
el: Readonly<import("vue").ShallowRef<HTMLDivElement | null>>;
|
|
4
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ScalarMarkdownProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {
|
|
5
|
+
div: HTMLDivElement;
|
|
6
|
+
}, any>;
|
|
15
7
|
export default _default;
|
|
16
8
|
//# sourceMappingURL=ScalarMarkdown.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScalarMarkdown.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarMarkdown/ScalarMarkdown.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScalarMarkdown.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarMarkdown/ScalarMarkdown.vue"],"names":[],"mappings":"AA0qBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;;;;;;AAqHlD,wBAQG"}
|
|
@@ -1,45 +1,42 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as h, useTemplateRef as d, computed as g, createElementBlock as w, openBlock as T, mergeProps as v, unref as x } from "vue";
|
|
2
2
|
import { htmlFromMarkdown as y } from "@scalar/code-highlight";
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
3
|
+
import { useBindCx as k } from "@scalar/use-hooks/useBindCx";
|
|
4
|
+
const B = ["innerHTML"], C = /* @__PURE__ */ h({
|
|
5
|
+
inheritAttrs: !1,
|
|
5
6
|
__name: "ScalarMarkdown",
|
|
6
7
|
props: {
|
|
7
8
|
value: {},
|
|
8
9
|
withImages: { type: Boolean, default: !1 },
|
|
9
|
-
transform: {},
|
|
10
|
-
transformType: {},
|
|
11
|
-
clamp: { type: [String, Boolean] },
|
|
12
|
-
class: {},
|
|
13
10
|
withAnchors: { type: Boolean, default: !1 },
|
|
11
|
+
transform: { type: Function },
|
|
12
|
+
transformType: {},
|
|
13
|
+
clamp: {},
|
|
14
14
|
anchorPrefix: {}
|
|
15
15
|
},
|
|
16
|
-
setup(
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
setup(e, { expose: o }) {
|
|
17
|
+
const { cx: i } = k(), c = d("div");
|
|
18
|
+
o({ el: c });
|
|
19
|
+
const l = (t) => {
|
|
20
|
+
var n, a, m;
|
|
21
|
+
if (!e.withAnchors)
|
|
22
|
+
return ((n = e.transform) == null ? void 0 : n.call(e, t)) || t;
|
|
23
|
+
const r = (((m = (a = t.children) == null ? void 0 : a[0]) == null ? void 0 : m.value) || "").toLowerCase().replace(/\s+/g, "-"), u = e.anchorPrefix ? `${e.anchorPrefix}/description/${r}` : r;
|
|
24
|
+
return t.data = {
|
|
23
25
|
hProperties: {
|
|
24
|
-
id:
|
|
26
|
+
id: u
|
|
25
27
|
}
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
removeTags:
|
|
29
|
-
transform:
|
|
30
|
-
transformType:
|
|
28
|
+
}, e.transform ? e.transform(t) : t;
|
|
29
|
+
}, f = g(() => y(e.value ?? "", {
|
|
30
|
+
removeTags: e.withImages ? [] : ["img", "picture"],
|
|
31
|
+
transform: e.withAnchors && e.transformType === "heading" ? l : e.transform,
|
|
32
|
+
transformType: e.transformType
|
|
31
33
|
}));
|
|
32
|
-
return (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
style: d({
|
|
37
|
-
"-webkit-line-clamp": typeof e.clamp == "string" ? e.clamp : void 0
|
|
38
|
-
}),
|
|
39
|
-
innerHTML: i.value
|
|
40
|
-
}, null, 14, v));
|
|
34
|
+
return (t, s) => (T(), w("div", v({ ref: "div" }, x(i)("markdown", { "line-clamp-(--markdown-clamp)": !!t.clamp }), {
|
|
35
|
+
style: { "--markdown-clamp": t.clamp },
|
|
36
|
+
innerHTML: f.value
|
|
37
|
+
}), null, 16, B));
|
|
41
38
|
}
|
|
42
39
|
});
|
|
43
40
|
export {
|
|
44
|
-
|
|
41
|
+
C as default
|
|
45
42
|
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ScalarMarkdownProps } from './types';
|
|
2
|
+
type __VLS_Props = ScalarMarkdownProps;
|
|
3
|
+
type __VLS_PublicProps = {
|
|
4
|
+
modelValue?: boolean;
|
|
5
|
+
} & __VLS_Props;
|
|
6
|
+
declare function __VLS_template(): {
|
|
7
|
+
attrs: Partial<{}>;
|
|
8
|
+
slots: {
|
|
9
|
+
button?(_: {
|
|
10
|
+
open: boolean;
|
|
11
|
+
}): any;
|
|
12
|
+
};
|
|
13
|
+
refs: {
|
|
14
|
+
"scalar-markdown": import("vue").CreateComponentPublicInstanceWithMixins<Readonly<ScalarMarkdownProps> & Readonly<{}>, {
|
|
15
|
+
el: Readonly<import("vue").ShallowRef<HTMLDivElement | null>>;
|
|
16
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {}, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {
|
|
17
|
+
div: HTMLDivElement;
|
|
18
|
+
}, any, import("vue").ComponentProvideOptions, {
|
|
19
|
+
P: {};
|
|
20
|
+
B: {};
|
|
21
|
+
D: {};
|
|
22
|
+
C: {};
|
|
23
|
+
M: {};
|
|
24
|
+
Defaults: {};
|
|
25
|
+
}, Readonly<ScalarMarkdownProps> & Readonly<{}>, {
|
|
26
|
+
el: Readonly<import("vue").ShallowRef<HTMLDivElement | null>>;
|
|
27
|
+
}, {}, {}, {}, {}> | null;
|
|
28
|
+
};
|
|
29
|
+
rootEl: any;
|
|
30
|
+
};
|
|
31
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
32
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
33
|
+
"update:modelValue": (value: boolean) => any;
|
|
34
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
35
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
36
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {
|
|
37
|
+
"scalar-markdown": import("vue").CreateComponentPublicInstanceWithMixins<Readonly<ScalarMarkdownProps> & Readonly<{}>, {
|
|
38
|
+
el: Readonly<import("vue").ShallowRef<HTMLDivElement | null>>;
|
|
39
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {}, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {
|
|
40
|
+
div: HTMLDivElement;
|
|
41
|
+
}, any, import("vue").ComponentProvideOptions, {
|
|
42
|
+
P: {};
|
|
43
|
+
B: {};
|
|
44
|
+
D: {};
|
|
45
|
+
C: {};
|
|
46
|
+
M: {};
|
|
47
|
+
Defaults: {};
|
|
48
|
+
}, Readonly<ScalarMarkdownProps> & Readonly<{}>, {
|
|
49
|
+
el: Readonly<import("vue").ShallowRef<HTMLDivElement | null>>;
|
|
50
|
+
}, {}, {}, {}, {}> | null;
|
|
51
|
+
}, any>;
|
|
52
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
53
|
+
export default _default;
|
|
54
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
55
|
+
new (): {
|
|
56
|
+
$slots: S;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=ScalarMarkdownSummary.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScalarMarkdownSummary.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarMarkdown/ScalarMarkdownSummary.vue"],"names":[],"mappings":"AAyGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAIlD,KAAK,WAAW,GAAG,mBAAmB,CAAC;AAuCvC,KAAK,iBAAiB,GAAG;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,WAAW,CAAC;AAKhB,iBAAS,cAAc;WAiET,OAAO,IAA6B;;;;YATtB,GAAG;;;;;;;;;;;;;;;;;;;EAc9B;AAcD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;OAQnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { defineComponent as p, mergeModels as f, createPropsRestProxy as v, useId as h, useModel as y, useTemplateRef as w, ref as k, onMounted as x, createElementBlock as u, openBlock as m, normalizeProps as g, guardReactiveProps as B, unref as r, createVNode as M, createCommentVNode as P, mergeProps as V, normalizeClass as b, renderSlot as C, createTextVNode as S, toDisplayString as T } from "vue";
|
|
2
|
+
import { useBindCx as R } from "@scalar/use-hooks/useBindCx";
|
|
3
|
+
import { useResizeObserver as _ } from "@vueuse/core";
|
|
4
|
+
import z from "./ScalarMarkdown.vue.js";
|
|
5
|
+
import "./ScalarMarkdown.vue2.js";
|
|
6
|
+
const N = ["aria-controls", "aria-expanded"], E = /* @__PURE__ */ p({
|
|
7
|
+
inheritAttrs: !1,
|
|
8
|
+
__name: "ScalarMarkdownSummary",
|
|
9
|
+
props: /* @__PURE__ */ f({
|
|
10
|
+
value: {},
|
|
11
|
+
withImages: { type: Boolean },
|
|
12
|
+
withAnchors: { type: Boolean },
|
|
13
|
+
transform: { type: Function },
|
|
14
|
+
transformType: {},
|
|
15
|
+
clamp: { default: 1 },
|
|
16
|
+
anchorPrefix: {}
|
|
17
|
+
}, {
|
|
18
|
+
modelValue: { type: Boolean, default: !1 },
|
|
19
|
+
modelModifiers: {}
|
|
20
|
+
}),
|
|
21
|
+
emits: ["update:modelValue"],
|
|
22
|
+
setup(t) {
|
|
23
|
+
const c = v(t, ["clamp"]), l = h(), o = y(t, "modelValue"), n = w("scalar-markdown"), s = k(!1);
|
|
24
|
+
_(() => {
|
|
25
|
+
var e;
|
|
26
|
+
return (e = n.value) == null ? void 0 : e.el;
|
|
27
|
+
}, i);
|
|
28
|
+
function i() {
|
|
29
|
+
var a;
|
|
30
|
+
const e = (a = n.value) == null ? void 0 : a.el;
|
|
31
|
+
e && (s.value = e.scrollHeight > e.clientHeight || e.scrollWidth > e.clientWidth);
|
|
32
|
+
}
|
|
33
|
+
x(i);
|
|
34
|
+
const { cx: d } = R();
|
|
35
|
+
return (e, a) => (m(), u("div", g(B(
|
|
36
|
+
r(d)(
|
|
37
|
+
"group/summary flex gap-0.5",
|
|
38
|
+
o.value ? "flex-col" : "flex-row items-baseline"
|
|
39
|
+
)
|
|
40
|
+
)), [
|
|
41
|
+
M(z, V({ ref: "scalar-markdown" }, c, {
|
|
42
|
+
id: r(l),
|
|
43
|
+
class: { "markdown-summary truncate": !o.value },
|
|
44
|
+
clamp: o.value ? void 0 : e.clamp
|
|
45
|
+
}), null, 16, ["id", "class", "clamp"]),
|
|
46
|
+
s.value || o.value ? (m(), u("button", {
|
|
47
|
+
key: 0,
|
|
48
|
+
class: b(["whitespace-nowrap font-medium hover:underline", { "self-end": o.value }]),
|
|
49
|
+
type: "button",
|
|
50
|
+
"aria-controls": r(l),
|
|
51
|
+
"aria-expanded": o.value,
|
|
52
|
+
onClick: a[0] || (a[0] = ($) => o.value = !o.value)
|
|
53
|
+
}, [
|
|
54
|
+
C(e.$slots, "button", { open: o.value }, () => [
|
|
55
|
+
S(T(o.value ? " Show Less" : "More"), 1)
|
|
56
|
+
])
|
|
57
|
+
], 10, N)) : P("", !0)
|
|
58
|
+
], 16));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
export {
|
|
62
|
+
E as default
|
|
63
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarMarkdown/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarMarkdown/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,6BAA6B,CAAA"}
|