@hyvor/design 0.0.66 → 0.0.68
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/components/ActionList/ActionList.svelte +2 -7
- package/dist/components/ActionList/ActionListGroup.svelte +24 -29
- package/dist/components/ActionList/ActionListItem.svelte +86 -88
- package/dist/components/ActionList/Selected.svelte +17 -20
- package/dist/components/Avatar/Avatar.svelte +7 -11
- package/dist/components/Avatar/AvatarStack.svelte +16 -20
- package/dist/components/Base/Base.svelte +3 -3
- package/dist/components/Box/Box.svelte +8 -8
- package/dist/components/Button/Button.svelte +33 -42
- package/dist/components/Button/ButtonGroup.svelte +6 -6
- package/dist/components/Callout/Callout.svelte +88 -86
- package/dist/components/Callout/Callout.svelte.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.svelte +113 -121
- package/dist/components/CodeBlock/CodeBlock.svelte +26 -23
- package/dist/components/CodeBlock/getCode.js +6 -6
- package/dist/components/CodeBlock/hljs.scss +189 -191
- package/dist/components/CodeBlock/prism.scss +370 -7
- package/dist/components/ColorPicker/ColorPicker.svelte +42 -42
- package/dist/components/Dark/DarkProvider.svelte +9 -9
- package/dist/components/Dark/DarkToggle.svelte +7 -10
- package/dist/components/Divider/Divider.svelte +6 -7
- package/dist/components/Dropdown/Dropdown.svelte +33 -108
- package/dist/components/Dropdown/DropdownContent.svelte +120 -0
- package/dist/components/Dropdown/DropdownContent.svelte.d.ts +24 -0
- package/dist/components/FormControl/Caption.svelte +9 -9
- package/dist/components/FormControl/FormControl.svelte +18 -18
- package/dist/components/FormControl/InputGroup.svelte +7 -8
- package/dist/components/FormControl/Label.svelte +5 -5
- package/dist/components/FormControl/Validation.svelte +18 -16
- package/dist/components/FormControl/Validation.svelte.d.ts +1 -1
- package/dist/components/HyvorBar/BarProducts.svelte +52 -0
- package/dist/components/HyvorBar/BarProducts.svelte.d.ts +39 -0
- package/dist/components/HyvorBar/BarSupport.svelte +119 -0
- package/dist/components/HyvorBar/BarSupport.svelte.d.ts +19 -0
- package/dist/components/HyvorBar/BarUpdates.svelte +58 -0
- package/dist/components/HyvorBar/BarUpdates.svelte.d.ts +18 -0
- package/dist/components/HyvorBar/BarUpdatesList.svelte +134 -0
- package/dist/components/HyvorBar/BarUpdatesList.svelte.d.ts +18 -0
- package/dist/components/HyvorBar/BarUser.svelte +60 -0
- package/dist/components/HyvorBar/BarUser.svelte.d.ts +16 -0
- package/dist/components/HyvorBar/BarUserPreview.svelte +42 -0
- package/dist/components/HyvorBar/BarUserPreview.svelte.d.ts +14 -0
- package/dist/components/HyvorBar/HyvorBar.svelte +150 -0
- package/dist/components/HyvorBar/HyvorBar.svelte.d.ts +19 -0
- package/dist/components/HyvorBar/bar.d.ts +33 -0
- package/dist/components/HyvorBar/bar.js +74 -0
- package/dist/components/HyvorBar/img/G2.svelte +9 -0
- package/dist/components/HyvorBar/img/G2.svelte.d.ts +23 -0
- package/dist/components/HyvorBar/img/Trustpilot.svelte +11 -0
- package/dist/components/HyvorBar/img/Trustpilot.svelte.d.ts +23 -0
- package/dist/components/IconButton/IconButton.svelte +19 -23
- package/dist/components/IconMessage/IconMessage.svelte +84 -47
- package/dist/components/IconMessage/IconMessage.svelte.d.ts +9 -1
- package/dist/components/Internationalization/InternationalizationProvider.svelte +2 -2
- package/dist/components/Internationalization/InternationalizationProvider.svelte.d.ts +1 -1
- package/dist/components/Internationalization/LanguageToggle.svelte +33 -36
- package/dist/components/Internationalization/LanguageToggle.svelte.d.ts +2 -2
- package/dist/components/Internationalization/T.svelte.d.ts +3 -3
- package/dist/components/Internationalization/i18n.d.ts +4 -4
- package/dist/components/Internationalization/i18n.js +13 -11
- package/dist/components/Internationalization/t.d.ts +3 -3
- package/dist/components/Internationalization/t.js +4 -4
- package/dist/components/Internationalization/types.d.ts +1 -1
- package/dist/components/Link/Link.svelte +53 -58
- package/dist/components/Loader/LoadButton.svelte +15 -29
- package/dist/components/Loader/Loader.svelte +56 -69
- package/dist/components/Modal/ConfirmModalProvider.svelte +18 -36
- package/dist/components/Modal/Modal.svelte +134 -164
- package/dist/components/Modal/ModalFooter.svelte +23 -26
- package/dist/components/Modal/confirm.d.ts +1 -1
- package/dist/components/Modal/confirm.js +4 -4
- package/dist/components/Modal/modal-types.d.ts +2 -2
- package/dist/components/NavLink/NavLink.svelte +78 -86
- package/dist/components/Radio/Radio.svelte +23 -31
- package/dist/components/Slider/Slider.svelte +71 -80
- package/dist/components/Slider/Slider.svelte.d.ts +0 -1
- package/dist/components/SplitControl/SplitControl.svelte +28 -42
- package/dist/components/Switch/Switch.svelte +60 -65
- package/dist/components/TabNav/TabNav.svelte +6 -10
- package/dist/components/TabNav/TabNavItem.svelte +36 -43
- package/dist/components/Table/Table.svelte +7 -4
- package/dist/components/Table/TableRow.svelte +23 -23
- package/dist/components/Tag/Tag.svelte +28 -36
- package/dist/components/Text/Text.svelte +15 -22
- package/dist/components/TextInput/TextInput.svelte +26 -26
- package/dist/components/Textarea/Textarea.svelte +42 -50
- package/dist/components/Textarea/Textarea.svelte.d.ts +1 -1
- package/dist/components/Toast/ToastIcon.svelte +29 -31
- package/dist/components/Toast/ToastMessage.svelte +33 -39
- package/dist/components/Toast/ToastProvider.svelte +16 -16
- package/dist/components/Toast/cleaner.js +5 -5
- package/dist/components/Toast/toast.d.ts +2 -2
- package/dist/components/Toast/toast.js +10 -10
- package/dist/components/Tooltip/Tooltip.svelte +82 -83
- package/dist/components/directives/clickOutside.js +4 -4
- package/dist/components/directives/debounce.d.ts +1 -0
- package/dist/components/directives/debounce.js +8 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/index.css +31 -33
- package/dist/marketing/Container/Container.svelte +8 -8
- package/dist/marketing/Docs/Content/Content.svelte +8 -7
- package/dist/marketing/Docs/Content/DocsImage.svelte +52 -62
- package/dist/marketing/Docs/Docs.svelte +21 -24
- package/dist/marketing/Docs/Nav/Nav.svelte +21 -22
- package/dist/marketing/Docs/Nav/NavCategory.svelte +28 -28
- package/dist/marketing/Docs/Nav/NavItem.svelte +21 -24
- package/dist/marketing/Docs/Sidebar/Sidebar.svelte +22 -25
- package/dist/marketing/Docs/Toc.svelte +17 -19
- package/dist/marketing/Document/Document.svelte +59 -0
- package/dist/marketing/Document/Document.svelte.d.ts +19 -0
- package/dist/marketing/Document/DocumentTitle.svelte +63 -0
- package/dist/marketing/Document/DocumentTitle.svelte.d.ts +20 -0
- package/dist/marketing/Footer/Footer.svelte +111 -119
- package/dist/marketing/Footer/FooterLinkList.svelte +24 -26
- package/dist/marketing/Header/Header.svelte +7 -15
- package/dist/marketing/Logo/LogoBlogs.svelte +41 -0
- package/dist/marketing/Logo/LogoBlogs.svelte.d.ts +16 -0
- package/dist/marketing/Logo/LogoCore.svelte +41 -0
- package/dist/marketing/Logo/LogoCore.svelte.d.ts +16 -0
- package/dist/marketing/Logo/LogoFortguard.svelte +49 -0
- package/dist/marketing/Logo/LogoFortguard.svelte.d.ts +16 -0
- package/dist/marketing/Logo/LogoTalk.svelte +27 -0
- package/dist/marketing/Logo/LogoTalk.svelte.d.ts +16 -0
- package/dist/marketing/index.d.ts +1 -0
- package/dist/marketing/index.js +1 -0
- package/dist/stores/dark.js +8 -8
- package/dist/variables.scss +41 -48
- package/package.json +59 -58
|
@@ -1,92 +1,94 @@
|
|
|
1
1
|
<script>export let type = "soft";
|
|
2
|
+
export let title = void 0;
|
|
2
3
|
</script>
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
5
|
+
<div class={'callout ' + type} {...$$restProps}>
|
|
6
|
+
{#if $$slots.title}
|
|
7
|
+
<div class="title-wrap">
|
|
8
|
+
{#if $$slots.icon}
|
|
9
|
+
<span class="title-icon"><slot name="icon" /></span>
|
|
10
|
+
{/if}
|
|
11
|
+
|
|
12
|
+
<div class="title"><slot name="title" /></div>
|
|
13
|
+
</div>
|
|
14
|
+
{:else if title}
|
|
15
|
+
<div class="title-wrap">
|
|
16
|
+
{#if $$slots.icon}
|
|
17
|
+
<span
|
|
18
|
+
class="title-icon
|
|
19
|
+
"><slot name="icon" /></span
|
|
20
|
+
>
|
|
21
|
+
{/if}
|
|
22
|
+
|
|
23
|
+
<div class="title">{title}</div>
|
|
24
|
+
</div>
|
|
25
|
+
{/if}
|
|
26
|
+
|
|
27
|
+
<div class="text-wrap">
|
|
28
|
+
{#if $$slots.icon && !$$slots.title && !title}
|
|
29
|
+
<span class="icon"><slot name="icon" /></span>
|
|
30
|
+
{/if}
|
|
31
|
+
|
|
32
|
+
<div class="text">
|
|
33
|
+
{#if $$slots.default}
|
|
34
|
+
<slot />
|
|
35
|
+
{/if}
|
|
36
|
+
<slot name="text" />
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
34
39
|
</div>
|
|
35
40
|
|
|
36
|
-
|
|
37
41
|
<style>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
</style>
|
|
42
|
+
.callout {
|
|
43
|
+
padding: 15px 25px;
|
|
44
|
+
border-radius: var(--box-radius);
|
|
45
|
+
/* line-height: var(--line-height-content); */
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.callout.soft {
|
|
49
|
+
background-color: var(--accent-light);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.callout.info {
|
|
53
|
+
background-color: var(--blue-light);
|
|
54
|
+
color: var(--blue-dark);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.callout.warning {
|
|
58
|
+
background-color: var(--orange-light);
|
|
59
|
+
color: var(--orange-dark);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.callout.danger {
|
|
63
|
+
background-color: var(--red-light);
|
|
64
|
+
color: var(--red-dark);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.callout.success {
|
|
68
|
+
background-color: var(--green-light);
|
|
69
|
+
color: var(--green-dark);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.title-wrap {
|
|
73
|
+
margin-bottom: 4px;
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
font-weight: 600;
|
|
77
|
+
font-size: 18px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.title-icon {
|
|
81
|
+
vertical-align: middle;
|
|
82
|
+
margin-right: 8px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.text-wrap {
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: flex-start;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.icon {
|
|
91
|
+
margin-right: 8px;
|
|
92
|
+
font-size: 18px;
|
|
93
|
+
}
|
|
94
|
+
</style>
|
|
@@ -23,127 +23,119 @@ function handleChange() {
|
|
|
23
23
|
}
|
|
24
24
|
</script>
|
|
25
25
|
|
|
26
|
-
<span
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
{#if $$slots.default}
|
|
54
|
-
<span class="label">
|
|
55
|
-
<slot />
|
|
56
|
-
</span>
|
|
57
|
-
{/if}
|
|
58
|
-
</label>
|
|
26
|
+
<span class="checkbox-wrap">
|
|
27
|
+
<label>
|
|
28
|
+
<input
|
|
29
|
+
type="checkbox"
|
|
30
|
+
bind:checked
|
|
31
|
+
bind:this={input}
|
|
32
|
+
{disabled}
|
|
33
|
+
on:keyup
|
|
34
|
+
on:keydown
|
|
35
|
+
on:keypress
|
|
36
|
+
on:focus
|
|
37
|
+
on:blur
|
|
38
|
+
on:click
|
|
39
|
+
on:mouseover
|
|
40
|
+
on:mouseenter
|
|
41
|
+
on:mouseleave
|
|
42
|
+
on:change
|
|
43
|
+
{...$$restProps}
|
|
44
|
+
on:change={handleChange}
|
|
45
|
+
/>
|
|
46
|
+
<span class="placeholder" />
|
|
47
|
+
{#if $$slots.default}
|
|
48
|
+
<span class="label">
|
|
49
|
+
<slot />
|
|
50
|
+
</span>
|
|
51
|
+
{/if}
|
|
52
|
+
</label>
|
|
59
53
|
</span>
|
|
60
54
|
|
|
61
55
|
<style>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
</style>
|
|
56
|
+
.label {
|
|
57
|
+
margin-left: 8px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.checkbox-wrap {
|
|
61
|
+
position: relative;
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
display: inline-flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
vertical-align: middle;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.checkbox-wrap label {
|
|
69
|
+
display: inline-flex;
|
|
70
|
+
align-items: center;
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
input {
|
|
75
|
+
position: absolute;
|
|
76
|
+
opacity: 0;
|
|
77
|
+
width: 0;
|
|
78
|
+
height: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
span.placeholder {
|
|
82
|
+
display: inline-block;
|
|
83
|
+
width: 16px;
|
|
84
|
+
height: 16px;
|
|
85
|
+
background-color: var(--input);
|
|
86
|
+
border-radius: 2px;
|
|
87
|
+
outline: 1px solid var(--accent);
|
|
88
|
+
position: relative;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
span.placeholder:focus-visible {
|
|
92
|
+
box-shadow: 0 0 0 4px var(--accent-light);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* the check icon */
|
|
96
|
+
span.placeholder:after {
|
|
97
|
+
content: '';
|
|
98
|
+
position: absolute;
|
|
99
|
+
display: none;
|
|
100
|
+
|
|
101
|
+
/* check icon */
|
|
102
|
+
left: 4.5px;
|
|
103
|
+
top: 1px;
|
|
104
|
+
width: 4px;
|
|
105
|
+
height: 9px;
|
|
106
|
+
border: solid var(--accent-text);
|
|
107
|
+
border-width: 0 3px 3px 0;
|
|
108
|
+
transform: rotate(45deg);
|
|
109
|
+
transition: 0.2s box-shadow;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.checkbox-wrap:hover span.placeholder {
|
|
113
|
+
box-shadow: 0 0 0 3px var(--accent-light);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
input:checked ~ span.placeholder {
|
|
117
|
+
background-color: var(--accent) !important;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
input:focus ~ span.placeholder {
|
|
121
|
+
box-shadow: 0 0 0 4px var(--accent-light);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
input:checked ~ span.placeholder:after {
|
|
125
|
+
display: block;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* disabled styles */
|
|
129
|
+
input:disabled ~ span.placeholder {
|
|
130
|
+
background-color: var(--accent-light);
|
|
131
|
+
border: none !important;
|
|
132
|
+
opacity: 0.2;
|
|
133
|
+
cursor: not-allowed;
|
|
134
|
+
box-shadow: none !important;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
input:disabled:checked ~ span.placeholder:after {
|
|
138
|
+
display: none;
|
|
139
|
+
pointer-events: none;
|
|
140
|
+
}
|
|
141
|
+
</style>
|
|
@@ -12,26 +12,29 @@ import getCode, {} from "./getCode.js";
|
|
|
12
12
|
<pre class="language-{languageCode} hljs"><code>{@html getCode(code, languageCode)}</code></pre>
|
|
13
13
|
|
|
14
14
|
<style>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
15
|
+
/*styles for CodeBlock component */
|
|
16
|
+
pre {
|
|
17
|
+
text-align: left;
|
|
18
|
+
white-space: pre;
|
|
19
|
+
word-spacing: normal;
|
|
20
|
+
word-break: normal;
|
|
21
|
+
word-wrap: normal;
|
|
22
|
+
overflow: auto;
|
|
23
|
+
border-radius: 20px;
|
|
24
|
+
padding: 20px;
|
|
25
|
+
line-height: 1.1;
|
|
26
|
+
}
|
|
27
|
+
pre code {
|
|
28
|
+
all: unset;
|
|
29
|
+
font-family:
|
|
30
|
+
Consolas,
|
|
31
|
+
Monaco,
|
|
32
|
+
Andale Mono,
|
|
33
|
+
Ubuntu Mono,
|
|
34
|
+
monospace;
|
|
35
|
+
font-size: 14px;
|
|
36
|
+
line-height: 1.5;
|
|
37
|
+
tab-size: 4;
|
|
38
|
+
hyphens: none;
|
|
39
|
+
}
|
|
40
|
+
</style>
|
|
@@ -14,24 +14,24 @@ hljs.registerLanguage('json', json);
|
|
|
14
14
|
export default function getCode(code, language) {
|
|
15
15
|
let ret = code;
|
|
16
16
|
// remove the first empty line
|
|
17
|
-
ret = ret.replace(/^[^\S\r\n]*\n/,
|
|
17
|
+
ret = ret.replace(/^[^\S\r\n]*\n/, '');
|
|
18
18
|
// remove the last empty line
|
|
19
|
-
ret = ret.replace(/\n[^\S\r\n]*$/,
|
|
20
|
-
let lines = ret.split(
|
|
19
|
+
ret = ret.replace(/\n[^\S\r\n]*$/, '');
|
|
20
|
+
let lines = ret.split('\n');
|
|
21
21
|
let indent = null; // number of spaces to remove from each line
|
|
22
|
-
lines = lines.map(line => {
|
|
22
|
+
lines = lines.map((line) => {
|
|
23
23
|
if (indent === null) {
|
|
24
24
|
// find the indent
|
|
25
25
|
const match = line.match(/^(\s*)/);
|
|
26
26
|
indent = match ? match[1].length : 0;
|
|
27
27
|
}
|
|
28
|
-
if (line.substring(0, indent).trim() !==
|
|
28
|
+
if (line.substring(0, indent).trim() !== '') {
|
|
29
29
|
return line;
|
|
30
30
|
}
|
|
31
31
|
// remove the indent
|
|
32
32
|
line = line.substring(indent);
|
|
33
33
|
return line;
|
|
34
34
|
});
|
|
35
|
-
ret = lines.join(
|
|
35
|
+
ret = lines.join('\n');
|
|
36
36
|
return hljs.highlight(ret, { language }).value;
|
|
37
37
|
}
|