Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/publish-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,11 @@ jobs:
# Check if a custom publish script exists in package.json
if jq -e '.scripts.release' package.json > /dev/null; then
pnpm run release
else
pnpm publish --access public --no-git-checks
fi

# Then publish the package to npm
pnpm publish --access public --no-git-checks

Comment thread
ovflowd marked this conversation as resolved.
Outdated
- name: Notify on Manual Release
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # 2.3.3
Expand Down
15 changes: 7 additions & 8 deletions apps/site/components/Common/Partners/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Tooltip from '@node-core/ui-components/Common/Tooltip';
import * as PartnerLogos from '@node-core/ui-components/Icons/PartnerLogos';

import providePartners from '#site/next-data/providers/partners';
Expand Down Expand Up @@ -36,15 +35,15 @@ const renderSmallPartner = (partner: Partner) => {
const Logo = PartnerLogos[partner.id];

return (
<Tooltip
<PartnerButton
aria-label={partner.name}
key={partner.id}
asChild
content={<div className={style.tooltip}>{partner.name}</div>}
Comment thread
ovflowd marked this conversation as resolved.
size="small"
href={partner.href}
title={partner.name}
>
<PartnerButton aria-label={partner.name} size="small" href={partner.href}>
<Logo.Favicon />
</PartnerButton>
</Tooltip>
<Logo.Favicon />
</PartnerButton>
Comment thread
ovflowd marked this conversation as resolved.
);
};

Expand Down
8 changes: 4 additions & 4 deletions apps/site/layouts/layouts.module.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@reference "../styles/index.css";

.baseLayout {
@apply grid
@apply ml:grid
ml:grid-cols-[1fr]
ml:grid-rows-[auto_1fr_auto]
h-max
min-h-full
w-full
grid-cols-[1fr]
grid-rows-[auto_1fr_auto];
w-full;
}

.centeredLayout {
Expand Down
2 changes: 1 addition & 1 deletion apps/site/next.fetch.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const fetchWithRetry = async (
const backoff = Math.max(0, Number(delay) || 0);

const attemptFetch = attempt =>
fetch(url, options).catch(e => {
fetch(url, { ...options, signal: AbortSignal.timeout(30000) }).catch(e => {
Comment thread
ovflowd marked this conversation as resolved.
if (attempt === retries || !isTimeoutError(e)) {
throw e;
}
Comment thread
ovflowd marked this conversation as resolved.
Expand Down
1 change: 1 addition & 0 deletions apps/site/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "Bundler",
"customConditions": ["default"],
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
Expand Down
12 changes: 10 additions & 2 deletions packages/rehype-shiki/src/plugin.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ const languagePrefix = 'language-';
// The regex to match metadata
const rMeta = /(\w+)(?:=(?:"([^"]+)"|(\S+)))?/g;

const getLineCount = value =>
value
.split('\n')
.filter((_, i, arr) => !(i === arr.length - 1 && arr[i] === '')).length;

Comment thread
ovflowd marked this conversation as resolved.
Outdated
/**
* Parses a fenced code block metadata string into a JavaScript object.
* @param {string} meta - The metadata string from a Markdown code fence.
Expand Down Expand Up @@ -163,7 +168,9 @@ export default async function rehypeShikiji(options) {
const meta = parseMeta(preElement.data?.meta);

// Retrieve the whole <pre> contents as a parsed DOM string
const preElementContents = toString(preElement);
const preElementContents = toString(preElement).replace(/\n$/, '');

const lineCount = getLineCount(preElementContents);

// Grabs the relevant alias/name of the language
const languageId = codeLanguage.slice(languagePrefix.length);
Expand All @@ -178,7 +185,8 @@ export default async function rehypeShikiji(options) {
// Adds the original language back to the <pre> element
children[0].properties.class = classNames(
children[0].properties.class,
codeLanguage
codeLanguage,
{ 'no-line-numbers': lineCount < 5, 'no-footer': lineCount === 1 }
);

// Replaces the <pre> element with the updated one
Expand Down
20 changes: 20 additions & 0 deletions packages/ui-components/README.md
Comment thread
ovflowd marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,23 @@ The components are based on [this design file](https://www.figma.com/design/a10c
Most components in this package are available on [Chromatic](https://www.chromatic.com/library?appId=64c7d71358830e9105808652).

For additional details regarding specific components, refer to the [nodejs/nodejs.org](https://github.com/nodejs/nodejs.org) repository.

## Local development

To use this package via `npm link` in another repo (for example, doc-kit), build the
compiled outputs and keep them updated while you work.

```bash
# From nodejs.org/packages/ui-components
pnpm install
node --run compile:watch

# In another terminal, still in nodejs.org/packages/ui-components
npm link

# From the consumer repo (for example doc-kit)
npm link @node-core/ui-components
```

The `compile:watch` script keeps `dist/` up to date so consumers resolve compiled
CSS and JavaScript instead of the raw Tailwind source.
49 changes: 34 additions & 15 deletions packages/ui-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@
"version": "1.5.10",
"type": "module",
"exports": {
"./*": [
"./src/*",
"./src/*.tsx",
"./src/*/index.tsx",
"./src/*.ts",
"./src/*/index.ts"
]
"./*": {
"rolldown": [
"./dist/*",
"./dist/*.js",
"./dist/*/index.js"
],
"default": [
"./src/*",
"./src/*.tsx",
"./src/*/index.tsx",
"./src/*.ts",
Comment thread
ovflowd marked this conversation as resolved.
Outdated
"./src/*/index.ts"
]
}
},
"repository": {
"type": "git",
Expand All @@ -20,7 +27,8 @@
"compile:ts": "tsc",
"compile:css": "postcss --dir dist --base src \"src/**/*.module.css\" src/styles/index.css",
"compile": "node --run compile:ts && node --run compile:css",
"release": "node --run compile && node scripts/publish.mjs",
"compile:watch": "node --run compile:ts -- --watch & node --run compile:css -- --watch",
"release": "node --run compile",
Comment thread
ovflowd marked this conversation as resolved.
Outdated
"lint": "node --run lint:js && node --run lint:css",
"lint:css": "stylelint \"**/*.css\" --allow-empty-input --cache --cache-strategy=content --cache-location=.stylelintcache",
"lint:css:fix": "node --run lint:css -- --fix",
Expand Down Expand Up @@ -80,14 +88,25 @@
"typescript": "catalog:"
},
"imports": {
"#ui/*": [
"./src/*",
"./src/*.tsx",
"./src/*/index.tsx",
"./src/*.ts",
"./src/*/index.ts"
]
"#ui/*": {
"rolldown": [
"./dist/*",
"./dist/*.js",
"./dist/*/index.js"
],
"default": [
"./src/*",
"./src/*.tsx",
"./src/*/index.tsx",
"./src/*.ts",
"./src/*/index.ts"
]
}
},
"files": [
"dist/**",
"README.md"
],
"engines": {
"node": ">=20"
}
Expand Down
32 changes: 0 additions & 32 deletions packages/ui-components/scripts/publish.mjs

This file was deleted.

55 changes: 55 additions & 0 deletions packages/ui-components/src/Common/Badge/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,61 @@
@apply bg-neutral-800;
}

&[data-tooltip] {
@apply relative
cursor-help;
}

&[data-tooltip]::after {
@apply pointer-events-none
absolute
top-full
left-1/2
z-10
mt-2
w-max
-translate-x-1/2
rounded-md
bg-neutral-900
px-2.5
py-1.5
text-xs
font-medium
text-white
opacity-0
transition-opacity
dark:bg-neutral-100
dark:text-neutral-900;

content: attr(data-tooltip);
}

&[data-tooltip]::before {
@apply pointer-events-none
absolute
top-full
left-1/2
z-10
mt-1
h-2
w-2
-translate-x-1/2
rotate-45
bg-neutral-900
opacity-0
transition-opacity
dark:bg-neutral-100;

content: '';
}

&[data-tooltip]:hover::after,
&[data-tooltip]:hover::before,
&[data-tooltip]:focus-visible::after,
&[data-tooltip]:focus-visible::before {
@apply opacity-100;
}

&.circular {
@apply font-ibm-plex-mono
inline-flex
Expand Down
27 changes: 23 additions & 4 deletions packages/ui-components/src/Common/BaseCodeBox/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@
[counter-increment:line];
}
}

&[class*='plain-text'] {
Comment thread
avivkeller marked this conversation as resolved.
@apply font-mono;
Comment thread
ovflowd marked this conversation as resolved.
Outdated
}
}

&[class*='no-line-numbers'] > code > [class='line'] {
@apply pl-0;

&:not(:empty:last-child)::after {
@apply content-none
[counter-reset:none];
}
}
}
Comment thread
ovflowd marked this conversation as resolved.

Expand All @@ -62,8 +75,8 @@
justify-between
border-t
border-t-neutral-900
px-4
py-3
px-3
py-2
text-sm
font-medium;

Expand All @@ -72,9 +85,15 @@
}

& > .action {
@apply px-3
py-1.5
@apply px-2.5
py-1
text-xs
font-medium;

> svg {
@apply h-4
w-4;
Comment thread
ovflowd marked this conversation as resolved.
Outdated
}
}
}
}
Loading
Loading