Skip to content

Commit 7253ed3

Browse files
committed
feat: add unocss presets to pnpm workspace and update package dependencies
1 parent 9697cc2 commit 7253ed3

File tree

12 files changed

+408
-89
lines changed

12 files changed

+408
-89
lines changed

docs/.vitepress/theme/components/ShikiBlock.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const content = computedAsync(async () => {
1414
</script>
1515

1616
<template>
17-
<div class="vp-code-group" style="--nq-m-size:24px">
17+
<div class="vp-code-group" var:nq-m-size:24px>
1818
<div class="tabs">
1919
<label :data-title="label || lang || 'Code'" for="tab-26">{{ label || lang || 'Code' }}</label>
2020
</div>

docs/frankenstein/components/animated-staking-ripple/AnimatedStakingRipple.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
<stop offset="0" stop-color="#41a38e" />
55
<stop offset="1" stop-color="#21bca5" />
66
</radialGradient>
7-
<circle cx="73.76" cy="73.76" r="51.76" stroke-opacity=".8" stroke-width="3" style="--delay:200ms" stroke="currentColor" op-0 class="ripple" />
8-
<circle cx="73.76" cy="73.76" r="61.76" stroke-opacity=".6" stroke-width="3" style="--delay:400ms" stroke="currentColor" op-0 class="ripple" />
9-
<circle cx="73.76" cy="73.76" r="71.76" stroke-opacity=".4" stroke-width="3" style="--delay:600ms" stroke="currentColor" op-0 class="ripple" />
10-
<circle cx="73.76" cy="73.76" r="41.76" fill="url(#a)" un-fill=" inverted:white" />
7+
<circle cx="73.76" cy="73.76" r="51.76" stroke-opacity=".8" stroke-width="3" style="--delay:200ms" stroke="currentColor" class="ripple" />
8+
<circle cx="73.76" cy="73.76" r="61.76" stroke-opacity=".6" stroke-width="3" style="--delay:400ms" stroke="currentColor" class="ripple" />
9+
<circle cx="73.76" cy="73.76" r="71.76" stroke-opacity=".4" stroke-width="3" style="--delay:600ms" stroke="currentColor" class="ripple" />
10+
<circle cx="73.76" cy="73.76" r="41.76" fill="url(#a)" style="--fill: inverted:white" />
1111
<path stroke="neutral-0 inverted:!green" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M72.53 75.07v16.61m0-16.61C60.13 75.07 56 68.33 56 55c15.5 0 16.53 6.64 16.53 20.07Zm18.71-9.5c0 12.4-6.31 18.89-18.71 18.89 0-17.56 5.28-18.89 18.71-18.89Z" translate-y-3 />
1212
</svg>
1313
</template>

docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
"pathe": "^2.0.3",
3636
"render-markdown-it-tokens": "^0.0.4",
3737
"shiki": "^3.1.0",
38-
"unocss-preset-fluid-sizing": "^0.0.17",
39-
"unocss-preset-scale-px": "^0.0.2",
38+
"unocss-preset-fluid-sizing": "catalog:",
39+
"unocss-preset-onmax": "catalog:",
4040
"unplugin-icons": "^22.1.0",
4141
"vite": "catalog:",
4242
"vite-plugin-vue-devtools": "^7.7.2",

docs/uno.config.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
import { createExternalPackageIconLoader } from '@iconify/utils/lib/loader/external-pkg'
2-
import { defineConfig, presetAttributify, presetIcons, presetWind3, transformerDirectives } from 'unocss'
2+
import { defineConfig, presetIcons, transformerDirectives, type PresetWind3Theme } from 'unocss'
33
import { presetFluidSizing } from 'unocss-preset-fluid-sizing'
4-
import { presetScalePx } from 'unocss-preset-scale-px'
4+
import { presetOnmax } from 'unocss-preset-onmax'
55
import { FileSystemIconLoader } from 'unplugin-icons/loaders'
66
import { presetNimiq } from '../packages/nimiq-css/src/index'
77

8-
export default defineConfig({
8+
export default defineConfig<PresetWind3Theme>({
99
content: {
1010
filesystem: ['./.vitepress/config.ts', '../**/**.{vue,md}', './theme/components/**/*.vue', './config.ts'],
1111
},
1212
shortcuts: [
1313
['stack', 'w-full grid grid-cols-1 grid-rows-1 children:row-span-full children:col-span-full children:self-center children:justify-self-center'],
1414
],
1515
presets: [
16-
presetWind3(),
17-
presetAttributify(),
16+
presetOnmax(),
1817
presetNimiq({
1918
utilities: true,
2019
attributifyUtilities: true,
@@ -24,7 +23,6 @@ export default defineConfig({
2423
},
2524
typography: true,
2625
}),
27-
presetScalePx(),
2826
presetFluidSizing(),
2927
presetIcons({
3028
collections: {

packages/nimiq-css/src/css/preflight.css

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,15 @@
1818
'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
1919
}
2020

21-
:not(:where([nq-raw], .nq-raw)) {
21+
:where(*:not(:where(.nq-raw *, [nq-raw] *))) {
2222
border-color: rgb(var(--nq-neutral-400));
2323
outline-color: rgb(var(--nq-blue));
24-
/* outline-width: 0; */
24+
outline-width: 1.5px;
2525
overscroll-behavior-x: contain;
26+
caret-color: rgb(var(--nq-blue));
2627

2728
&:where(:not(:where(code, pre))) {
28-
font-family:
29-
var(--nq-font-sans, 'Mulish'),
30-
ui-sans-serif,
31-
system-ui,
32-
-apple-system,
33-
BlinkMacSystemFont,
34-
Segoe UI,
35-
Roboto,
36-
Helvetica Neue,
37-
Arial,
38-
Noto Sans,
39-
sans-serif,
40-
Apple Color Emoji,
41-
Segoe UI Emoji,
42-
Segoe UI Symbol,
43-
Noto Color Emoji;
29+
font-family: var(--nq-font-sans, 'Mulish');
4430
}
4531

4632
&:where(code, pre, pre *, code *) {

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -566,12 +566,12 @@
566566
transition:
567567
colors 0.2s var(--nq-ease),
568568
box-shadow 0.1s var(--nq-ease);
569-
outline: 0;
570569

571570
--color: rgb(var(--nq-neutral));
572571
--placeholder-color: rgb(var(--nq-neutral-700));
572+
--outline-color: rgb(var(--nq-neutral-500));
573573

574-
outline: 1.5px solid rgb(var(--nq-neutral-500));
574+
outline: 1.5px solid var(--outline-color);
575575
color: var(--color);
576576

577577
:where([data-inverted] *) & {
@@ -584,15 +584,15 @@
584584

585585
&:not(.nq-invalid, :user-invalid):where(:hover, :focus, :focus-within) {
586586
--color: rgb(var(--nq-blue));
587-
outline-color: rgba(var(--nq-blue) / 0.3);
587+
--outline-color: rgb(var(--nq-blue) / 0.3);
588588

589589
&::placeholder {
590590
--placeholder-color: rgb(var(--nq-blue) / 0.6);
591591
}
592592

593593
&:focus:valid,
594594
&:focus-within:valid {
595-
outline-color: rgba(var(--nq-blue));
595+
--outline-color: rgb(var(--nq-blue)/1);
596596
}
597597
}
598598

packages/nimiq-vitepress-theme/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@
8787
"pathe": "^2.0.3",
8888
"unbuild": "^3.3.1",
8989
"unocss": "^66.0.0",
90-
"unocss-preset-fluid-sizing": "^0.0.17",
91-
"unocss-preset-scale-px": "^0.0.2",
90+
"unocss-preset-fluid-sizing": "catalog:",
91+
"unocss-preset-onmax": "catalog:",
9292
"unplugin-vue-components": "^28.4.0"
9393
}
9494
}

packages/nimiq-vitepress-theme/src/layout/CommandMenu.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ function handleClose() {
2626
<template>
2727
<DialogRoot v-model:open="open">
2828
<DialogTrigger nq-input-box group hocus:bg-neutral-300 transition-colors flex="~ items-center gap-8"
29-
p="l-12 r-4 y-4" rounded-12 f-text-xs v-bind="$attrs" style="--ring-color:rgba(var(--nq-neutral-400))" ref="el">
29+
p="l-12 r-4 y-4" rounded-12 f-text-xs v-bind="$attrs" ref="el" var:outline-color:neutral-400>
30+
3031
<div i-nimiq:magnifying-glass text-12 op="60 group-hocus:80" transition-opacity aria-hidden />
3132
<span inline-flex lh-none>Search</span>
3233
<span ml-auto f-text-3xs bg="group-hocus:neutral-400 neutral-300" ring="1 neutral-500" lh-none p="x-6 y-4"

packages/nimiq-vitepress-theme/src/layout/PageContent.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ const showSecondarySidebar = computed(() => showOutline.value || showWidget.valu
5151
<template>
5252
<div f-pl-xl f-pr-xs f-pt-xl f="$px $px-min-48 $px-max-72" f-pb-md flex="~ gap-16" relative h-full>
5353
<div flex="~ col" h-full flex-1 w="[calc(100vw-2*var(--nq-sidebar-width)-2*var(--f-px))]">
54-
<article flex-1 class="nq-prose" style="--nq-prose-max-width: none">
54+
<article flex-1 class="nq-prose" var:nq-prose-max-width:none>
5555
<Content max-w-none />
5656
</article>
5757
<div mt-auto px-32 flex="~ items-center justify-between" f-text-md un-f-text-xs
5858
v-if="showEditContent || showLastUpdated">
59-
<a :href="editUrl" v-if="editUrl && showEditContent" target="_blank" rel="noopener" op70 group lh-0>
60-
Edit this page on <span group-hocus:text-blue transition-colors nq-arrow font-semibold>GitHub</span>
59+
<a :href="editUrl" v-if="editUrl && showEditContent" target="_blank" rel="noopener" op70 group lh-0 nq-arrow>
60+
Suggest changes on this page
6161
</a>
6262
<div v-else></div>
6363

packages/nimiq-vitepress-theme/src/layout/Sidebar.vue

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { useData, withBase } from 'vitepress';
77
import { useTemplateRef, watch } from 'vue';
88
import type { NimiqVitepressSidebar, NimiqVitepressThemeConfig, NimiqVitepressThemeNav } from '../types'
99
import { ref } from 'vue'
10-
import { CollapsibleContent, CollapsibleRoot, CollapsibleTrigger } from 'reka-ui'
10+
import { CollapsibleContent, CollapsibleRoot, CollapsibleTrigger, ScrollAreaRoot, ScrollAreaViewport, ScrollAreaScrollbar, ScrollAreaThumb } from 'reka-ui'
1111
import { useCurrentModule } from '../composables/useCurrentModule';
1212
import { isActive } from '../lib/route';
1313
@@ -48,18 +48,18 @@ function openAccordionInitialState(items: NimiqVitepressSidebar['items'][number]
4848

4949
<template>
5050
<aside z-20 w-full of="x-hidden y-auto" fixed inset-y-0 left-0 overscroll-contain bg-neutral-100 flex="~ col">
51-
<div absolute inset-y-0 right-0 ring="0.75 neutral-400" aria-hidden />
52-
<div f-p-xs flex-1>
51+
<div absolute inset-y-0 z-3 right-0 ring="0.75 neutral-400" aria-hidden var:outline-color:neutral-400 />
52+
<div f-p-xs pb-0 display="~ col">
5353
<Logo />
5454
<CommandMenu f-mt-sm />
5555
<span id="sidebar-aria-label" sr-only>
5656
Sidebar Navigation
5757
</span>
5858

59-
<DefineNavItem v-slot="{ item: { text, subpath, defaultPageLink, icon, description }, component }">
60-
<component :is="component" :href="withBase(defaultPageLink)" f-text-xs py-6 pl-12 pr-16 rounded-6 w-full hocus:bg-neutral-300 transition-colors :class="{ 'font-bold text-blue bg-blue-400': isActive(page.relativePath, subpath), 'grid-cols-[max-content_1fr]':!!icon }" grid="~ rows-2 gap-x-12 items-center">
59+
<DefineNavItem v-slot="{ item: { text, defaultPageLink, icon, description }, component }">
60+
<component :is="component" :href="withBase(defaultPageLink)" f-text-xs py-6 pl-12 pr-16 rounded-6 w-full hocus:bg-neutral-300 transition-colors :class="{ 'grid-cols-[max-content_1fr]':!!icon }" grid="~ rows-2 gap-x-12 items-center">
6161
<div :class="icon" block size-28 row-span-full v-if="icon" />
62-
<span flex-1 text-left>{{ text }}</span>
62+
<p flex-1 text-left>{{ text }}</p>
6363
<p v-if="description" text="left f-xs" text-neutral-800>{{ description }}</p>
6464
</component>
6565
</DefineNavItem>
@@ -84,38 +84,44 @@ function openAccordionInitialState(items: NimiqVitepressSidebar['items'][number]
8484
<span flex-1>{{ text }}</span>
8585
</a>
8686
</DefineSidebarItem>
87-
88-
<nav v-bind="$attrs" of-y-auto ref="nav" f-mt-sm>
89-
<div i-nimiq:fire />
90-
<ul>
91-
<li v-for="item in currentDocModule.sidebar" :key="item.label" f-pb-xs>
92-
<template v-if="item.items?.length">
93-
<span nq-label text-11 text-neutral-700 v-if="item.label">
94-
{{ item.label }}
95-
</span>
96-
<div v-for="subitem in item.items" :key="subitem.text">
97-
<CollapsibleRoot v-if="subitem.items?.length" v-slot="{ open }" :default-open="openAccordionInitialState(subitem.items)">
98-
<CollapsibleTrigger class="sidebar-item" group pr-12 pl-8 bg-transparent>
99-
<div :class="subitem.icon" f-text-sm v-if="subitem.icon" text-neutral op="70 group-hocus:100" mr-8 />
100-
<div :class="subitem.text" op="80 group-hocus:100" transition-opacity />
101-
<span flex-1 text-left>{{ subitem.text }}</span>
102-
<div i-nimiq:chevron-down aria-hidden text="9 neutral-700 group-hocus:neutral-800"
103-
transition="[color,transform]" :class="{ 'rotate--90': !open }" />
104-
</CollapsibleTrigger>
105-
<CollapsibleContent of-hidden data-open:animate-slide-down data-closed:animate-slide-up relative>
106-
<div absolute inset-y-0 left-12 w-2 bg-neutral-400 z-1 rounded-full />
107-
<SidebarItem v-for="subsubitem in subitem.items" px-24 :key="subsubitem.text" :item="subsubitem" />
108-
</CollapsibleContent>
109-
</CollapsibleRoot>
110-
<SidebarItem v-else :item="subitem" px-8 />
111-
</div>
112-
</template>
113-
</li>
114-
</ul>
115-
</nav>
11687
</div>
11788

118-
<div border="t neutral-400" flex="~ items-center" f-px-sm>
89+
<hr w-full h-1.5 bg-neutral-200 f-mt-xs>
90+
91+
<ScrollAreaRoot relative of-hidden bg-neutral-100 var:scrollbar-size:10px as="nav" flex-1 f-px-xs ref="nav" v-bind="$attrs">
92+
<div absolute top-0 z-2 w-full h-24 bg-gradient="to-t from-transparent to-neutral-100" />
93+
<ScrollAreaViewport size-full f-pt-xs as="ul">
94+
<li v-for="item in currentDocModule.sidebar" :key="item.label" f-pb-xs>
95+
<template v-if="item.items?.length">
96+
<span nq-label text-11 text-neutral-700 v-if="item.label">
97+
{{ item.label }}
98+
</span>
99+
<div v-for="subitem in item.items" :key="subitem.text">
100+
<CollapsibleRoot v-if="subitem.items?.length" v-slot="{ open }" :default-open="openAccordionInitialState(subitem.items)">
101+
<CollapsibleTrigger class="sidebar-item" group pr-12 pl-8 bg-transparent>
102+
<div :class="subitem.icon" f-text-sm v-if="subitem.icon" text-neutral op="70 group-hocus:100" mr-8 />
103+
<div :class="subitem.text" op="80 group-hocus:100" transition-opacity />
104+
<span flex-1 text-left>{{ subitem.text }}</span>
105+
<div i-nimiq:chevron-down aria-hidden text="9 neutral-700 group-hocus:neutral-800"
106+
transition="[color,transform]" :class="{ 'rotate--90': !open }" />
107+
</CollapsibleTrigger>
108+
<CollapsibleContent of-hidden data-open:animate-slide-down data-closed:animate-slide-up relative>
109+
<div absolute inset-y-0 left-12 w-2 bg-neutral-400 z-1 rounded-full />
110+
<SidebarItem v-for="subsubitem in subitem.items" px-24 :key="subsubitem.text" :item="subsubitem" />
111+
</CollapsibleContent>
112+
</CollapsibleRoot>
113+
<SidebarItem v-else :item="subitem" px-8 />
114+
</div>
115+
</template>
116+
</li>
117+
</ScrollAreaViewport>
118+
<ScrollAreaScrollbar inset-y-0 flex="~" select-none touch-none p-2 z-20 bg="neutral-300" w-10 orientation="vertical">
119+
<ScrollAreaThumb flex-1 bg-neutral-500 rounded-5 relative content-empty before="absolute top--50% left--50% -translate-x--50% -translate-y--50% size-full min-h-40 min-w-40" />
120+
</ScrollAreaScrollbar>
121+
<div absolute bottom-0 z-2 w-full h-24 bg-gradient="to-b from-transparent to-neutral-100" />
122+
</ScrollAreaRoot>
123+
124+
<div border="t neutral-400" flex="~ items-center" f-px-sm sticky bottom-0>
119125
<nav>
120126
<ul flex="~ gap-4" f-py-xs>
121127
<li v-for="({ icon, link }) in theme.links" :key="link">

0 commit comments

Comments
 (0)