Skip to content

Commit 8cd06e7

Browse files
committed
feat: update TypeScript version and enhance NqCard and NqGrid components with new properties and styles
1 parent 0f84478 commit 8cd06e7

File tree

18 files changed

+756
-685
lines changed

18 files changed

+756
-685
lines changed

docs/.vitepress/theme/index.ts

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,16 @@
1-
import type { EnhanceAppContext, Theme } from 'vitepress'
21
import TwoslashFloatingVue from '@shikijs/vitepress-twoslash/client'
32

4-
import { Layout } from 'nimiq-vitepress-theme'
3+
import { defineNimiqThemeConfig } from 'nimiq-vitepress-theme'
54

6-
import NqCard from 'nimiq-vitepress-theme/components/NqCard.vue'
7-
8-
import NqGrid from 'nimiq-vitepress-theme/components/NqGrid.vue'
9-
10-
import NqLargeCard from 'nimiq-vitepress-theme/components/NqLargeCard.vue'
115
import ComponentPreview from './components/ComponentPreview.vue'
12-
import '@shikijs/vitepress-twoslash/style.css'
136

7+
import '@shikijs/vitepress-twoslash/style.css'
148
import 'virtual:uno.css'
159

16-
export default {
17-
Layout,
18-
enhanceApp({ app }: EnhanceAppContext) {
10+
export default defineNimiqThemeConfig({
11+
enhanceApp({ app }) {
1912
app.use(TwoslashFloatingVue)
2013

2114
app.component('ComponentPreview', ComponentPreview)
22-
23-
app.component('NqCard', NqCard)
24-
app.component('NqLargeCard', NqLargeCard)
25-
app.component('NqGrid', NqGrid)
2615
},
27-
} satisfies Theme
16+
})

docs/.vitepress/theme/plugins/component-preview.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ export default function (md: MarkdownRenderer) {
3131

3232
// Push tokens
3333

34-
const dummyToken = new state.Token('', '', 0) // eslint-disable-line unused-imports/no-unused-vars
34+
// eslint-disable-next-line unused-imports/no-unused-vars
35+
const dummyToken = new state.Token('', '', 0)
3536
const tokens: Array<typeof dummyToken> = []
3637

3738
const codeTemplateStart = new state.Token('html_inline', '', 0)

docs/vitepress-theme/frontmatter.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,21 @@ The Nimiq Vitepress theme supports the following frontmatter options:
1919

2020
### General Options
2121

22-
| Option | Type | Default | Description |
23-
|--------|------|---------|-------------|
24-
| `title` | `string` | - | Page title, shown in browser tabs and search results |
25-
| `description` | `string` | - | Page description for SEO |
22+
| Option | Type | Default | Description |
23+
| ------------- | -------- | ------- | ---------------------------------------------------- |
24+
| `title` | `string` | - | Page title, shown in browser tabs and search results |
25+
| `description` | `string` | - | Page description for SEO |
2626

2727
### Layout Options
2828

29-
| Option | Type | Default | Description |
30-
|--------|------|---------|-------------|
31-
| `outline` | `boolean` | `true` if headings exist | Whether to show the outline (table of contents) |
32-
| `sidebar` | `boolean` | `true` if outline or widget is shown | Whether to show the secondary sidebar |
33-
| `widget` | `boolean` | `true` | Whether to show the widget area in the secondary sidebar |
29+
| Option | Type | Default | Description |
30+
| ------------------ | --------- | ------------------------------------ | -------------------------------------------------------- |
31+
| `sidebar` | `boolean` | `true` | Whether to show the sidebar |
32+
| `outline` | `boolean` | `true` if headings exist | Whether to show the outline (table of contents) |
33+
| `secondarySidebar` | `boolean` | `true` if outline or widget is shown | Whether to show the secondary sidebar |
34+
| `widget` | `boolean` | `true` | Whether to show the widget area in the secondary sidebar |
3435

35-
## Controlling the Sidebar
36+
## Controlling the Secondary Sidebar
3637

3738
The secondary sidebar contains both the outline (table of contents) and optional widget area. You can control them independently:
3839

@@ -42,8 +43,8 @@ The secondary sidebar contains both the outline (table of contents) and optional
4243
outline: false
4344
widget: true
4445

45-
# Or hide both by disabling the entire sidebar
46-
sidebar: false
46+
# Or hide both by disabling the entire secondary sidebar
47+
secondarySidebar: false
4748
---
4849
```
4950

@@ -87,7 +88,7 @@ If you need to create reusable data structures for specific components, consider
8788
heroSection:
8889
title: Welcome to Nimiq
8990
description: The browser-first blockchain
90-
cta:
91+
cta:
9192
label: Get Started
9293
url: /getting-started
9394
---

eslint.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,10 @@ export default antfu({
99
rules: {
1010
'ts/explicit-function-return-type': 'off',
1111
},
12+
}, {
13+
files: ['nimiq-vitepress-theme/src/components/NqCard.vue'],
14+
rules: {
15+
// https://github.com/vuejs/eslint-plugin-vue/issues/1577
16+
'import/first': 'off',
17+
},
1218
})

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
"docs"
2020
],
2121
"devDependencies": {
22-
"@antfu/eslint-config": "^4.5.1",
22+
"@antfu/eslint-config": "^4.7.0",
2323
"@types/node": "^22.13.9",
2424
"@unocss/eslint-config": "^66.0.0",
2525
"@unocss/eslint-plugin": "^66.0.0",
2626
"bumpp": "^10.0.3",
2727
"eslint": "^9.21.0",
2828
"eslint-plugin-format": "^1.0.1",
2929
"rimraf": "^6.0.1",
30-
"typescript": "~5.8.2",
30+
"typescript": "catalog:",
3131
"vite": "catalog:"
3232
},
3333
"pnpm": {

packages/nimiq-css/build.config.ts

Lines changed: 55 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,65 @@
1+
import fs from 'node:fs'
2+
import path from 'node:path'
13
import { defineBuildConfig } from 'unbuild'
24

35
export default defineBuildConfig([
46
{
5-
entries: [{
6-
builder: 'mkdist',
7-
input: './src',
8-
},
7+
entries: [
8+
{
9+
builder: 'mkdist',
10+
input: './src',
11+
pattern: ['**/*.ts'],
12+
format: 'esm',
13+
loaders: ['js'],
14+
},
915
],
10-
outDir: 'dist',
1116
declaration: true,
1217
clean: true,
13-
rollup: {
14-
emitCJS: false,
15-
commonjs: false,
18+
hooks: {
19+
'mkdist:done': async (ctx) => {
20+
if (ctx.options.stub)
21+
return
22+
23+
// Copy ./src/css folder to ./dist/css without minification
24+
const srcDir = path.resolve('./src/css')
25+
const destDir = path.resolve('./dist/css')
26+
27+
// Create destination directory if it doesn't exist
28+
if (!fs.existsSync(destDir)) {
29+
fs.mkdirSync(destDir, { recursive: true })
30+
}
31+
32+
// Copy all files from src/css to dist/css
33+
copyDirectorySync(srcDir, destDir)
34+
console.log('CSS files copied from src/css to dist/css')
35+
},
1636
},
17-
// hooks: {
18-
// 'build:done': async () => {
19-
// await copy('src/css', 'dist/css')
20-
// },
21-
// },
22-
// {
23-
// entries: [
24-
// './src/css',
25-
// ],
26-
// outDir: 'dist/css',
27-
// clean: true,
28-
// },
2937
},
3038
])
39+
40+
/**
41+
* Recursively copy a directory
42+
*/
43+
function copyDirectorySync(src: string, dest: string) {
44+
// Create destination directory if it doesn't exist
45+
if (!fs.existsSync(dest)) {
46+
fs.mkdirSync(dest, { recursive: true })
47+
}
48+
49+
// Read all files and directories in the source
50+
const entries = fs.readdirSync(src, { withFileTypes: true })
51+
52+
for (const entry of entries) {
53+
const srcPath = path.join(src, entry.name)
54+
const destPath = path.join(dest, entry.name)
55+
56+
if (entry.isDirectory()) {
57+
// Recursively copy subdirectories
58+
copyDirectorySync(srcPath, destPath)
59+
}
60+
else {
61+
// Copy files
62+
fs.copyFileSync(srcPath, destPath)
63+
}
64+
}
65+
}

packages/nimiq-css/src/css/utilities.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
color: rgba(var(--nq-neutral-800));
66
}
77

8+
.nq-basic {
9+
font-size: 12px;
10+
color: pink;
11+
}
12+
813
.nq-label {
914
text-transform: uppercase;
1015
letter-spacing: 0.17em;

packages/nimiq-css/src/unocss/index.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,8 @@ export const presetNimiq = definePreset((options: NimiqPresetOptions = {}) => {
9999

100100
const layer = `${prefix}${name}`
101101

102-
const content = readContent(name).replaceAll(
103-
'data:image/svg+xml;',
104-
'SEMICOLON_BUG_HACK',
105-
)
106-
const json = toJSON(content, {
107-
stripComments: true,
108-
comments: false,
109-
ordered: false,
110-
split: false,
111-
})
102+
const content = readContent(name).replaceAll('data:image/svg+xml;', 'SEMICOLON_BUG_HACK')
103+
const json = toJSON(content, { stripComments: true, comments: false, ordered: false, split: false })
112104

113105
const rulesNamesStr: string[] = []
114106
for (const key of Object.keys(json.children)) {

0 commit comments

Comments
 (0)