@hyvor/design 0.0.3 → 0.0.5
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/CodeBlock/CodeBlock.svelte +7 -0
- package/dist/{marketing/Docs/Content → components/CodeBlock}/CodeBlock.svelte.d.ts +0 -1
- package/dist/components/CodeBlock/prism.d.ts +2 -0
- package/dist/components/CodeBlock/prism.js +26 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/index.css +2 -0
- package/dist/marketing/index.d.ts +1 -0
- package/dist/marketing/index.js +1 -0
- package/package.json +2 -1
- package/dist/marketing/Docs/Content/CodeBlock.svelte +0 -28
- /package/dist/{marketing/Docs/Content → components/CodeBlock}/prism.scss +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Prism from 'prismjs';
|
|
2
|
+
import 'prism-svelte';
|
|
3
|
+
export default function getCode(code, language) {
|
|
4
|
+
let ret = code;
|
|
5
|
+
// remove the first empty line
|
|
6
|
+
ret = ret.replace(/^[^\S\r\n]*\n/, "");
|
|
7
|
+
// remove the last empty line
|
|
8
|
+
ret = ret.replace(/\n[^\S\r\n]*$/, "");
|
|
9
|
+
let lines = ret.split("\n");
|
|
10
|
+
let indent = null; // number of spaces to remove from each line
|
|
11
|
+
lines = lines.map(line => {
|
|
12
|
+
if (indent === null) {
|
|
13
|
+
// find the indent
|
|
14
|
+
const match = line.match(/^(\s*)/);
|
|
15
|
+
indent = match ? match[1].length : 0;
|
|
16
|
+
}
|
|
17
|
+
if (line.substring(0, indent).trim() !== "") {
|
|
18
|
+
return line;
|
|
19
|
+
}
|
|
20
|
+
// remove the indent
|
|
21
|
+
line = line.substring(indent);
|
|
22
|
+
return line;
|
|
23
|
+
});
|
|
24
|
+
ret = lines.join("\n");
|
|
25
|
+
return Prism.highlight(ret, Prism.languages[language], language);
|
|
26
|
+
}
|
|
@@ -9,6 +9,7 @@ export { default as Button } from './Button/Button.svelte';
|
|
|
9
9
|
export { default as ButtonGroup } from './Button/ButtonGroup.svelte';
|
|
10
10
|
export { default as Callout } from './Callout/Callout.svelte';
|
|
11
11
|
export { default as Checkbox } from './Checkbox/Checkbox.svelte';
|
|
12
|
+
export { default as CodeBlock } from './CodeBlock/CodeBlock.svelte';
|
|
12
13
|
export { default as DarkToggle } from './Dark/DarkToggle.svelte';
|
|
13
14
|
export { default as Dropdown } from './Dropdown/Dropdown.svelte';
|
|
14
15
|
export { default as Caption } from './FormControl/Caption.svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export { default as Button } from './Button/Button.svelte';
|
|
|
9
9
|
export { default as ButtonGroup } from './Button/ButtonGroup.svelte';
|
|
10
10
|
export { default as Callout } from './Callout/Callout.svelte';
|
|
11
11
|
export { default as Checkbox } from './Checkbox/Checkbox.svelte';
|
|
12
|
+
export { default as CodeBlock } from './CodeBlock/CodeBlock.svelte';
|
|
12
13
|
export { default as DarkToggle } from './Dark/DarkToggle.svelte';
|
|
13
14
|
export { default as Dropdown } from './Dropdown/Dropdown.svelte';
|
|
14
15
|
export { default as Caption } from './FormControl/Caption.svelte';
|
package/dist/index.css
CHANGED
|
@@ -4,3 +4,4 @@ export { default as Docs } from './Docs/Docs.svelte';
|
|
|
4
4
|
export { default as DocsNav } from './Docs/Nav/Nav.svelte';
|
|
5
5
|
export { default as DocsNavItem } from './Docs/Nav/NavItem.svelte';
|
|
6
6
|
export { default as DocsNavCategory } from './Docs/Nav/NavCategory.svelte';
|
|
7
|
+
export { default as DocsContent } from './Docs/Content/Content.svelte';
|
package/dist/marketing/index.js
CHANGED
|
@@ -4,3 +4,4 @@ export { default as Docs } from './Docs/Docs.svelte';
|
|
|
4
4
|
export { default as DocsNav } from './Docs/Nav/Nav.svelte';
|
|
5
5
|
export { default as DocsNavItem } from './Docs/Nav/NavItem.svelte';
|
|
6
6
|
export { default as DocsNavCategory } from './Docs/Nav/NavCategory.svelte';
|
|
7
|
+
export { default as DocsContent } from './Docs/Content/Content.svelte';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyvor/design",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"scripts": {
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"@sveltejs/adapter-static": "^2.0.3",
|
|
36
36
|
"@sveltejs/kit": "^1.25.1",
|
|
37
37
|
"@sveltejs/package": "^2.0.0",
|
|
38
|
+
"@types/prismjs": "^1.26.1",
|
|
38
39
|
"prismjs": "^1.29.0",
|
|
39
40
|
"publint": "^0.1.9",
|
|
40
41
|
"sass": "^1.68.0",
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<script>import "./prism.scss";
|
|
2
|
-
export let code;
|
|
3
|
-
export let language = "html";
|
|
4
|
-
import Prism from "prismjs";
|
|
5
|
-
import "prism-svelte";
|
|
6
|
-
function getCode() {
|
|
7
|
-
let ret = code;
|
|
8
|
-
ret = ret.replace(/^[^\S\r\n]*\n/, "");
|
|
9
|
-
ret = ret.replace(/\n[^\S\r\n]*$/, "");
|
|
10
|
-
let lines = ret.split("\n");
|
|
11
|
-
let indent = null;
|
|
12
|
-
lines = lines.map((line) => {
|
|
13
|
-
if (indent === null) {
|
|
14
|
-
const match = line.match(/^(\s*)/);
|
|
15
|
-
indent = match ? match[1].length : 0;
|
|
16
|
-
}
|
|
17
|
-
if (line.substring(0, indent).trim() !== "") {
|
|
18
|
-
return line;
|
|
19
|
-
}
|
|
20
|
-
line = line.substring(indent);
|
|
21
|
-
return line;
|
|
22
|
-
});
|
|
23
|
-
ret = lines.join("\n");
|
|
24
|
-
return Prism.highlight(ret, Prism.languages[language], language);
|
|
25
|
-
}
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<pre class="language-{language}"><code>{@html getCode()}</code></pre>
|
|
File without changes
|