Share UI code through an npm workspace

Extracts the avatar components and the style tokens into shared/ui, which
both apps consume as a workspace package, to try out ADR 2. Nix and the
Docker setups are not updated yet.
This commit is contained in:
Rūdolfs Ošiņš
2026-10-29 16:27:03 +01:00
parent 84995442a5
commit f79b23dde7
97 changed files with 1898 additions and 9022 deletions
+13 -2
View File
@@ -1,13 +1,24 @@
name: desktop-e2e
# Only desktop changes, or changes to this workflow, run it.
# Only desktop, shared/ui and root npm changes, or changes to this workflow,
# run it.
on:
pull_request:
paths:
- "desktop/**"
- "shared/**"
- "package.json"
- "package-lock.json"
- ".npmrc"
- ".nvmrc"
- ".github/workflows/desktop-e2e.yml"
push:
paths:
- "desktop/**"
- "shared/**"
- "package.json"
- "package-lock.json"
- ".npmrc"
- ".nvmrc"
- ".github/workflows/desktop-e2e.yml"
workflow_dispatch:
@@ -31,7 +42,7 @@ jobs:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: "desktop/.nvmrc"
node-version-file: ".nvmrc"
- run: |
apt-get update && apt-get install -y --no-install-recommends \
+13 -2
View File
@@ -1,13 +1,24 @@
name: desktop-lint
# Only desktop changes, or changes to this workflow, run it.
# Only desktop, shared/ui and root npm changes, or changes to this workflow,
# run it.
on:
pull_request:
paths:
- "desktop/**"
- "shared/**"
- "package.json"
- "package-lock.json"
- ".npmrc"
- ".nvmrc"
- ".github/workflows/desktop-lint.yml"
push:
paths:
- "desktop/**"
- "shared/**"
- "package.json"
- "package-lock.json"
- ".npmrc"
- ".nvmrc"
- ".github/workflows/desktop-lint.yml"
workflow_dispatch:
@@ -29,7 +40,7 @@ jobs:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: "desktop/.nvmrc"
node-version-file: ".nvmrc"
- run: npm ci
- run: npm run check-js
+13 -2
View File
@@ -1,13 +1,24 @@
name: desktop-unit-test
# Only desktop changes, or changes to this workflow, run it.
# Only desktop, shared/ui and root npm changes, or changes to this workflow,
# run it.
on:
pull_request:
paths:
- "desktop/**"
- "shared/**"
- "package.json"
- "package-lock.json"
- ".npmrc"
- ".nvmrc"
- ".github/workflows/desktop-unit-test.yml"
push:
paths:
- "desktop/**"
- "shared/**"
- "package.json"
- "package-lock.json"
- ".npmrc"
- ".nvmrc"
- ".github/workflows/desktop-unit-test.yml"
workflow_dispatch:
@@ -26,6 +37,6 @@ jobs:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: "desktop/.nvmrc"
node-version-file: ".nvmrc"
- run: npm ci
- run: npm run test:unit
+9 -4
View File
@@ -1,11 +1,16 @@
name: explorer-build
# Only explorer changes, or changes to this workflow, run it. Rust-only
# changes don't affect the web app: its tests run against a pinned, pre-built
# radicle-httpd.
# Only explorer, shared/ui and root npm changes, or changes to this workflow,
# run it. Rust-only changes don't affect the web app: its tests run against a
# pinned, pre-built radicle-httpd.
on:
push:
paths:
- "explorer/**"
- "shared/**"
- "package.json"
- "package-lock.json"
- ".npmrc"
- ".nvmrc"
- "!explorer/crates/**"
- "!explorer/Cargo.toml"
- "!explorer/Cargo.lock"
@@ -29,7 +34,7 @@ jobs:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: "explorer/.nvmrc"
node-version-file: ".nvmrc"
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
+9 -4
View File
@@ -1,11 +1,16 @@
name: explorer-check
# Only explorer changes, or changes to this workflow, run it. Rust-only
# changes don't affect the web app: its tests run against a pinned, pre-built
# radicle-httpd.
# Only explorer, shared/ui and root npm changes, or changes to this workflow,
# run it. Rust-only changes don't affect the web app: its tests run against a
# pinned, pre-built radicle-httpd.
on:
push:
paths:
- "explorer/**"
- "shared/**"
- "package.json"
- "package-lock.json"
- ".npmrc"
- ".nvmrc"
- "!explorer/crates/**"
- "!explorer/Cargo.toml"
- "!explorer/Cargo.lock"
@@ -29,6 +34,6 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: "explorer/.nvmrc"
node-version-file: ".nvmrc"
- run: npm ci
- run: npm run check
+10 -5
View File
@@ -1,11 +1,16 @@
name: explorer-e2e
# Only explorer changes, or changes to this workflow, run it. Rust-only
# changes don't affect the web app: its tests run against a pinned, pre-built
# radicle-httpd.
# Only explorer, shared/ui and root npm changes, or changes to this workflow,
# run it. Rust-only changes don't affect the web app: its tests run against a
# pinned, pre-built radicle-httpd.
on:
push:
paths:
- "explorer/**"
- "shared/**"
- "package.json"
- "package-lock.json"
- ".npmrc"
- ".nvmrc"
- "!explorer/crates/**"
- "!explorer/Cargo.toml"
- "!explorer/Cargo.lock"
@@ -29,7 +34,7 @@ jobs:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: "explorer/.nvmrc"
node-version-file: ".nvmrc"
- name: Install dependencies
run: npm ci
@@ -39,7 +44,7 @@ jobs:
id: playwright-dep-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('explorer/package-lock.json') }}
key: ${{ runner.os }}-playwright-${{ hashFiles('package-lock.json') }}
- name: Install Playwright browsers
if: steps.playwright-dep-cache.outputs.cache-hit != 'true'
@@ -1,11 +1,16 @@
name: explorer-http-client-unit-test
# Only explorer changes, or changes to this workflow, run it. Rust-only
# changes don't affect the web app: its tests run against a pinned, pre-built
# radicle-httpd.
# Only explorer, shared/ui and root npm changes, or changes to this workflow,
# run it. Rust-only changes don't affect the web app: its tests run against a
# pinned, pre-built radicle-httpd.
on:
push:
paths:
- "explorer/**"
- "shared/**"
- "package.json"
- "package-lock.json"
- ".npmrc"
- ".nvmrc"
- "!explorer/crates/**"
- "!explorer/Cargo.toml"
- "!explorer/Cargo.lock"
@@ -30,7 +35,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: "explorer/.nvmrc"
node-version-file: ".nvmrc"
- run: npm ci
- name: Install Radicle binaries
run: |
+9 -4
View File
@@ -1,11 +1,16 @@
name: explorer-unit-test
# Only explorer changes, or changes to this workflow, run it. Rust-only
# changes don't affect the web app: its tests run against a pinned, pre-built
# radicle-httpd.
# Only explorer, shared/ui and root npm changes, or changes to this workflow,
# run it. Rust-only changes don't affect the web app: its tests run against a
# pinned, pre-built radicle-httpd.
on:
push:
paths:
- "explorer/**"
- "shared/**"
- "package.json"
- "package-lock.json"
- ".npmrc"
- ".nvmrc"
- "!explorer/crates/**"
- "!explorer/Cargo.toml"
- "!explorer/Cargo.lock"
@@ -30,6 +35,6 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: "explorer/.nvmrc"
node-version-file: ".nvmrc"
- run: npm ci
- run: npm run test:unit
+9 -4
View File
@@ -1,11 +1,16 @@
name: explorer-visual
# Only explorer changes, or changes to this workflow, run it. Rust-only
# changes don't affect the web app: its tests run against a pinned, pre-built
# radicle-httpd.
# Only explorer, shared/ui and root npm changes, or changes to this workflow,
# run it. Rust-only changes don't affect the web app: its tests run against a
# pinned, pre-built radicle-httpd.
on:
push:
paths:
- "explorer/**"
- "shared/**"
- "package.json"
- "package-lock.json"
- ".npmrc"
- ".nvmrc"
- "!explorer/crates/**"
- "!explorer/Cargo.toml"
- "!explorer/Cargo.lock"
@@ -45,7 +50,7 @@ jobs:
- uses: actions/setup-node@v6
with:
node-version-file: "explorer/.nvmrc"
node-version-file: ".nvmrc"
- name: Install dependencies
run: npm ci
+39
View File
@@ -0,0 +1,39 @@
name: shared-ui
# Only shared/ui changes, root npm changes, or changes to this workflow, run it.
on:
pull_request:
paths:
- "shared/**"
- "package.json"
- "package-lock.json"
- ".npmrc"
- ".nvmrc"
- ".github/workflows/shared-ui.yml"
push:
paths:
- "shared/**"
- "package.json"
- "package-lock.json"
- ".npmrc"
- ".nvmrc"
- ".github/workflows/shared-ui.yml"
workflow_dispatch:
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
defaults:
run:
working-directory: shared/ui
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: ".nvmrc"
- run: npm ci
- run: npm run check
- run: npm run test:unit
+3
View File
@@ -1,3 +1,6 @@
# npm workspace
node_modules/
# Mac OS
.DS_Store
View File
View File
+4 -3
View File
@@ -1,8 +1,9 @@
# radicle-gui environment
This repository holds two projects: the explorer web app and `radicle-httpd`
in `explorer/`, and the desktop app in `desktop/`. Each has its own npm
package and Cargo workspace.
in `explorer/`, and the desktop app in `desktop/`, plus the UI code they share
in `shared/ui/`. One npm workspace at the root holds all three; each project
has its own Cargo workspace.
`.ryph/Dockerfile` is written as the machine for the whole Radicle
workspace, and a workspace builds only its environment repository's
@@ -27,7 +28,7 @@ At image build it warms clippy and the Rust test builds of both workspaces,
and the desktop e2e backend (`test-http-api`, `rad-job`), in
`explorer/target/` and `desktop/target/`. At run start it only reinstalls what the lockfiles
changed, and cargo builds what a command needs when it runs. Node 24.15.0
(`explorer/.nvmrc`, `desktop/.nvmrc`) and Rust 1.97.1
(`.nvmrc`) and Rust 1.97.1
(`explorer/rust-toolchain`, `desktop/rust-toolchain.toml`) come from mise and
rustup.
+5 -7
View File
@@ -1,8 +1,8 @@
steps:
# Explorer and radicle-httpd, in explorer/. Each project is its own npm
# package and Cargo workspace.
- name: install explorer npm dependencies
run: cd explorer && npm install --prefer-offline
# One npm workspace at the root holds explorer, desktop and shared/ui.
- name: install npm dependencies
run: npm install --prefer-offline
# Explorer and radicle-httpd, in explorer/, with its own Cargo workspace.
- name: install Playwright Chromium (explorer e2e)
run: cd explorer && npx playwright install chromium
- name: install the pinned Radicle binaries for http-client and e2e tests
@@ -18,9 +18,7 @@ steps:
run: 'cd explorer && { [ "$RYPH_SETUP_PHASE" != image ] || RUSTFLAGS="-D warnings" cargo clippy --workspace --all-features --tests --locked; }'
- name: warm the Rust test build (explorer-rust test, image builds only)
run: 'cd explorer && { [ "$RYPH_SETUP_PHASE" != image ] || cargo test --workspace --all-features --no-run --locked; }'
# Desktop, in desktop/.
- name: install desktop npm dependencies
run: cd desktop && npm install --prefer-offline
# Desktop, in desktop/, with its own Cargo workspace.
- name: install Playwright WebKit (desktop e2e)
run: cd desktop && npx playwright install webkit
- name: install the pinned Radicle binaries for desktop e2e tests
+23 -173
View File
@@ -1,174 +1,24 @@
import globals from "globals";
import js from "@eslint/js";
import prettier from "eslint-config-prettier";
import svelte from "eslint-plugin-svelte";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import svelteParser from "svelte-eslint-parser";
import ts from "typescript-eslint";
import { radicleConfig } from "@radicle-gui/ui/eslint";
export default [
...[
js.configs.recommended,
...ts.configs.recommended,
prettier,
{
plugins: {
"simple-import-sort": simpleImportSort,
},
languageOptions: {
parser: ts.parser,
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: import.meta.dirname,
extraFileExtensions: [".svelte", ".svelte.ts"],
},
globals: { ...globals.browser, ...globals.node },
},
rules: {
"no-implicit-globals": "error",
"no-restricted-globals": [
"error",
"name",
"event",
"frames",
"history",
"length",
"content",
"origin",
"status",
],
// Require using arrow functions as callbacks.
// https://eslint.org/docs/rules/prefer-arrow-callback
"prefer-arrow-callback": "warn",
// Require using const for variables that are never modified after declared.
// https://eslint.org/docs/rules/prefer-const
"prefer-const": "warn",
// Disallow modifying variables that are declared using const.
// https://eslint.org/docs/rules/no-const-assign
"no-const-assign": "error",
// Require let or const instead of var.
// https://eslint.org/docs/rules/no-var
"no-var": "warn",
"simple-import-sort/imports": [
"warn",
{
groups: [
// Type imports
["\\u0000$"],
// Node.js built-in modules
["^node:"],
// Everything not matched, aka third party packages
["^"],
// Files under @app and @lib without an extension
["^(@app\/lib).*(\.svelte$|\.ts$|\.js$){0}"],
// Files under @app and @lib ending in .svelte or svelte.ts
["^(@app\/lib).*(\.svelte$)"],
// Svelte components imported through @app
["^(@app).*(\.svelte$)"],
// Everything else imported through relative imports
["^\\."],
],
},
],
// Require `===` and `!==` comparisons.
eqeqeq: "warn",
"@typescript-eslint/no-floating-promises": "warn",
"@typescript-eslint/no-empty-function": "warn",
"@typescript-eslint/naming-convention": [
"warn",
{
selector: "enumMember",
format: ["PascalCase"],
},
{
selector: "objectLiteralProperty",
format: ["PascalCase", "camelCase"],
},
{
selector: "default",
format: ["camelCase"],
leadingUnderscore: "allow",
trailingUnderscore: "allow",
},
{
selector: "variable",
modifiers: ["const"],
format: ["camelCase", "PascalCase", "UPPER_CASE"],
leadingUnderscore: "allow",
trailingUnderscore: "allow",
},
{
selector: "typeLike",
format: ["PascalCase"],
},
// Disable @typescript-eslint/naming-convention format for imports
// https://github.com/typescript-eslint/typescript-eslint/pull/7269#issuecomment-1777628591
// https://github.com/typescript-eslint/typescript-eslint/issues/7892
{ selector: "import", format: null },
{
selector: ["objectLiteralProperty"],
modifiers: ["requiresQuotes"],
format: null,
},
],
"@typescript-eslint/no-namespace": [
"error",
{ allowDeclarations: true },
],
"@typescript-eslint/member-ordering": [
"warn",
{ default: ["field", "signature", "constructor", "method"] },
],
// Allow explicit type annotations for additional clarity.
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-invalid-void-type": ["warn"],
// Disallow Unused Variables.
// https://eslint.org/docs/rules/no-unused-vars
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_" },
],
},
},
].map(conf => ({
...conf,
linterOptions: {
reportUnusedDisableDirectives: "error",
},
files: ["**/*.js", "**/*.ts", "**/*.svelte"],
})),
...svelte.configs["flat/recommended"],
...svelte.configs["flat/prettier"],
{
files: ["*.svelte", "**/*.svelte", "**/*.svelte.ts"],
languageOptions: {
parser: svelteParser,
parserOptions: {
parser: ts.parser,
project: "./tsconfig.json",
tsconfigRootDir: import.meta.dirname,
svelteFeatures: {
experimentalGenerics: true,
},
},
},
rules: {
"svelte/require-each-key": "off",
"svelte/no-at-html-tags": "off",
"@typescript-eslint/no-explicit-any": "error",
},
},
{
ignores: [
"build/*",
"tests/tmp/**/*",
"isolation/*",
"node_modules/**/*",
"target/*",
"target-release/*",
"crates/radicle-tauri/**/*",
"crates/radicle-types/**/*",
"eslint.config.js",
],
},
];
export default radicleConfig({
rootDir: import.meta.dirname,
importGroups: [
// Files under @app and @lib without an extension
["^(@app\/lib).*(\.svelte$|\.ts$|\.js$){0}"],
// Files under @app and @lib ending in .svelte or svelte.ts
["^(@app\/lib).*(\.svelte$)"],
// Svelte components imported through @app
["^(@app).*(\.svelte$)"],
],
ignores: [
"build/*",
"tests/tmp/**/*",
"isolation/*",
"node_modules/**/*",
"target/*",
"target-release/*",
"crates/radicle-tauri/**/*",
"crates/radicle-types/**/*",
"eslint.config.js",
],
});
+8 -3
View File
@@ -62,10 +62,15 @@
type="font/woff2"
crossorigin="anonymous" />
<link rel="stylesheet" type="text/css" href="/tokens.css" vite-ignore />
<link rel="stylesheet" type="text/css" href="/index.css" />
<link rel="stylesheet" type="text/css" href="/typography.css" />
<link rel="stylesheet" type="text/css" href="/prettylights.css" />
<link rel="stylesheet" type="text/css" href="/colors.css" />
<link rel="stylesheet" type="text/css" href="/typography.css" vite-ignore />
<link
rel="stylesheet"
type="text/css"
href="/prettylights.css"
vite-ignore />
<link rel="stylesheet" type="text/css" href="/colors.css" vite-ignore />
<link rel="stylesheet" type="text/css" href="/katex.min.css" />
<script type="module">
// Make global 'Buffer' available to legacy modules.
-6767
View File
File diff suppressed because it is too large Load Diff
+1 -8
View File
@@ -32,6 +32,7 @@
"@floating-ui/dom": "^1.8.0",
"@pierre/diffs": "1.3.0-beta.9",
"@pierre/trees": "1.0.0-beta.5",
"@radicle-gui/ui": "0.0.0",
"@tauri-apps/api": "^2.11.1",
"@tauri-apps/plugin-clipboard-manager": "^2.3.2",
"@tauri-apps/plugin-deep-link": "^2.4.10",
@@ -100,13 +101,5 @@
"vitest": "^4.1.12",
"vscode-oniguruma": "^2.0.1",
"wait-on": "^9.0.10"
},
"overrides": {
"mermaid": {
"katex": "$katex"
}
},
"allowScripts": {
"fsevents": false
}
}
-16
View File
@@ -2,14 +2,6 @@
box-sizing: border-box;
}
:root {
--border-radius-xs: 0.0625rem;
--border-radius-sm: 0.125rem;
--border-radius-md: 0.25rem;
--border-radius-lg: 0.5rem;
--border-radius-full: 99rem;
}
html {
height: 100%;
width: 100%;
@@ -137,14 +129,6 @@ a {
}
}
:root {
--elevation-low: 0 0 48px 0 #000000ee;
}
[data-theme="light"] {
--elevation-low: 0 0 16px 0 #00000022;
}
/*
Breakpoints
===========
+7 -2
View File
@@ -3,5 +3,10 @@ set -Eeuo pipefail
echo "Copying katex assets into bundle directory"
cp -r node_modules/katex/dist/katex.min.css public/katex.min.css
cp -r node_modules/katex/dist/fonts/* public/fonts/
# katex is hoisted to the workspace root, so resolve it rather than assuming
# a local node_modules.
dist="$(dirname "$(node -p 'require.resolve("katex/package.json")')")/dist"
mkdir -p public/fonts
cp -r "$dist/katex.min.css" public/katex.min.css
cp -r "$dist"/fonts/* public/fonts/
+1 -1
View File
@@ -1,6 +1,7 @@
<script lang="ts">
import type { Author } from "@bindings/cob/Author";
import UserAvatar from "@radicle-gui/ui/components/UserAvatar.svelte";
import debounce from "lodash/debounce";
import type { AssigneeSuggestion } from "@app/lib/assigneeSuggestions";
@@ -22,7 +23,6 @@
import Icon from "@app/components/Icon.svelte";
import NodeId from "@app/components/NodeId.svelte";
import TextInput from "@app/components/TextInput.svelte";
import UserAvatar from "@app/components/UserAvatar.svelte";
interface Props {
allowedToEdit: boolean;
@@ -1,10 +1,11 @@
<script lang="ts">
import type { Author } from "@bindings/cob/Author";
import UserAvatar from "@radicle-gui/ui/components/UserAvatar.svelte";
import { publicKeyFromDid, truncateId } from "@app/lib/utils";
import MenuCheckItem from "@app/components/MenuCheckItem.svelte";
import UserAvatar from "@app/components/UserAvatar.svelte";
interface Props {
assignees: Author[];
+1 -1
View File
@@ -1,6 +1,7 @@
<script lang="ts">
import type { Config } from "@bindings/config/Config";
import UserAvatar from "@radicle-gui/ui/components/UserAvatar.svelte";
import debounce from "lodash/debounce";
import { writeToClipboard } from "@app/lib/invoke";
@@ -12,7 +13,6 @@
import Icon from "@app/components/Icon.svelte";
import Popover from "@app/components/Popover.svelte";
import { closeFocused } from "@app/components/Popover.svelte";
import UserAvatar from "@app/components/UserAvatar.svelte";
interface Props {
config: Config;
+2 -1
View File
@@ -5,6 +5,8 @@
import type { Config } from "@bindings/config/Config";
import type { ComponentProps } from "svelte";
import RepoAvatar from "@radicle-gui/ui/components/RepoAvatar.svelte";
import {
cachedConfig,
cachedIssueById,
@@ -37,7 +39,6 @@
} from "@app/components/ExplorerMenu.svelte";
import Icon from "@app/components/Icon.svelte";
import NodeId from "@app/components/NodeId.svelte";
import RepoAvatar from "@app/components/RepoAvatar.svelte";
type IconName = ComponentProps<typeof Icon>["name"];
@@ -21,6 +21,7 @@
shift,
size,
} from "@floating-ui/dom";
import UserAvatar from "@radicle-gui/ui/components/UserAvatar.svelte";
import fuzzysort from "fuzzysort";
import debounce from "lodash/debounce";
import { useOverlayScrollbars } from "overlayscrollbars-svelte";
@@ -57,7 +58,6 @@
import { formatOid, publicKeyFromDid, truncateId } from "@app/lib/utils";
import Icon from "@app/components/Icon.svelte";
import UserAvatar from "@app/components/UserAvatar.svelte";
type IconName = ComponentProps<typeof Icon>["name"];
+2 -1
View File
@@ -3,6 +3,8 @@
import type { Placement } from "@floating-ui/dom";
import type { ComponentProps } from "svelte";
import UserAvatar from "@radicle-gui/ui/components/UserAvatar.svelte";
import { cachedAlias, cachedConfig, writeToClipboard } from "@app/lib/invoke";
import { entityUrl } from "@app/lib/mentions";
import { getPatchActivitySource } from "@app/lib/patchActivityContext";
@@ -10,7 +12,6 @@
import Icon from "@app/components/Icon.svelte";
import Popover from "@app/components/Popover.svelte";
import UserAvatar from "@app/components/UserAvatar.svelte";
type IconName = ComponentProps<typeof Icon>["name"];
+2 -1
View File
@@ -8,6 +8,8 @@
import type { RepoInfo } from "@bindings/repo/RepoInfo";
import type { RepoRefs } from "@bindings/repo/RepoRefs";
import UserAvatar from "@radicle-gui/ui/components/UserAvatar.svelte";
import { nodeRunning } from "@app/lib/events";
import { invoke } from "@app/lib/invoke";
import type { ReviewEntry } from "@app/lib/reviewSummary";
@@ -37,7 +39,6 @@
import LabelInput from "@app/components/LabelInput.svelte";
import NodeId from "@app/components/NodeId.svelte";
import Popover, { closeFocused } from "@app/components/Popover.svelte";
import UserAvatar from "@app/components/UserAvatar.svelte";
interface Props {
config: Config;
@@ -3,13 +3,14 @@
import type { Remote } from "@bindings/repo/Remote";
import type { Tag } from "@bindings/repo/Tag";
import UserAvatar from "@radicle-gui/ui/components/UserAvatar.svelte";
import { sortedTags } from "@app/lib/refs";
import * as router from "@app/lib/router";
import { formatOid, truncateId } from "@app/lib/utils";
import Icon from "@app/components/Icon.svelte";
import TagIcon from "@app/components/PeerSelector/TagIcon.svelte";
import UserAvatar from "@app/components/UserAvatar.svelte";
interface Props {
baseRoute: SourceBaseRoute;
@@ -3,6 +3,7 @@
import type { RepoInfo } from "@bindings/repo/RepoInfo";
import type { RepoRefs } from "@bindings/repo/RepoRefs";
import UserAvatar from "@radicle-gui/ui/components/UserAvatar.svelte";
import fuzzysort from "fuzzysort";
import { debounced } from "@app/lib/debounced.svelte";
@@ -17,7 +18,6 @@
import Popover, { closeFocused } from "@app/components/Popover.svelte";
import ScrollArea from "@app/components/ScrollArea.svelte";
import TextInput from "@app/components/TextInput.svelte";
import UserAvatar from "@app/components/UserAvatar.svelte";
interface Props {
baseRoute: SourceBaseRoute;
@@ -4,6 +4,8 @@
import type { Comment } from "@bindings/cob/thread/Comment";
import type { Thread } from "@bindings/cob/thread/Thread";
import UserAvatar from "@radicle-gui/ui/components/UserAvatar.svelte";
import type { Resolution } from "@app/lib/commentResolutions";
import { plainText } from "@app/lib/markdownPlain";
import type { CommentAnchor } from "@app/lib/pierreComments";
@@ -16,7 +18,6 @@
import Icon from "@app/components/Icon.svelte";
import Path from "@app/components/Path.svelte";
import UserAvatar from "@app/components/UserAvatar.svelte";
interface Props {
/// Threads grouped per file, in the order the files appear in the diff, so
@@ -1,6 +1,7 @@
<script lang="ts">
import UserAvatar from "@radicle-gui/ui/components/UserAvatar.svelte";
import Icon from "@app/components/Icon.svelte";
import UserAvatar from "@app/components/UserAvatar.svelte";
interface Props {
// Given when the chip navigates somewhere; otherwise it is a plain marker,
+2 -1
View File
@@ -1,10 +1,11 @@
<script lang="ts">
import UserAvatar from "@radicle-gui/ui/components/UserAvatar.svelte";
import type { ReviewEntry } from "@app/lib/reviewSummary";
import { reviewSummary, summaryTitle } from "@app/lib/reviewSummary";
import { publicKeyFromDid } from "@app/lib/utils";
import Icon from "@app/components/Icon.svelte";
import UserAvatar from "@app/components/UserAvatar.svelte";
interface Props {
reviews: ReviewEntry[];
@@ -57,6 +57,7 @@
import type { RepoInfo } from "@bindings/repo/RepoInfo";
import type { CrossfadeParams } from "svelte/transition";
import RepoAvatar from "@radicle-gui/ui/components/RepoAvatar.svelte";
import { onMount, untrack } from "svelte";
import { flip } from "svelte/animate";
import { backOut, cubicOut } from "svelte/easing";
@@ -89,7 +90,6 @@
import AddRepoButton from "@app/components/AddRepoButton.svelte";
import ContextMenu from "@app/components/ContextMenu.svelte";
import Icon from "@app/components/Icon.svelte";
import RepoAvatar from "@app/components/RepoAvatar.svelte";
import ScrollArea from "@app/components/ScrollArea.svelte";
import usePinnedDragReorder, {
DRAG_RID_ATTRIBUTE,
-932
View File
@@ -1,932 +0,0 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { cached } from "@app/lib/cached";
type AtomType = "A" | "B" | "C" | "D";
type ShapeModel =
"rose" | "starburst" | "ringed" | "tip" | "notched" | "hollow";
type AtomMode = "bands-ABC" | "angle-stripes" | "parity-ACB" | "balanced-rand";
const PALETTE = [
"#00D4DA", // teal
"#886BF2", // purple
"#FFA5FF", // pink
"#009F67", // green
"#CCFF38", // lime
"#585600", // olive
];
const REPO_CONFIG = {
GRID_SIZE: 16,
CELL_SIZE: 32,
PIXEL_DENSITY: 2,
GLYPH: {
WIDTH: 5,
HEIGHT: 7,
SPACING: 2,
SCALE_2X_WIDTH: 10,
SCALE_2X_HEIGHT: 14,
},
ATOMS: {
CIRCLE_B_RATIO: 0.55,
CIRCLE_C_RATIO: 0.67,
},
} as const;
const USER_CONFIG = {
TILE_SIZE: 32,
DEFAULT_GRID: 10,
PIXEL_DENSITY: 2,
ATOMS: {
ELLIPSE_B_SIZE: 17,
ELLIPSE_C_SIZE: 21,
},
TOLERANCE: {
ANGLE_NEAR_BASE: Math.PI / 28,
ANGLE_FAR_BASE: Math.PI / 7,
NEAR_RANGE: { MIN: 0.7, MAX: 1.2 },
FAR_RANGE: { MIN: 0.7, MAX: 1.2 },
},
SOFTNESS: {
MIN: 1.2,
MAX: 4.2,
},
RING_PHASE: {
MIN: 0.2,
MAX: 0.8,
},
} as const;
function hash32(str: string): number {
let h = 2166136261 >>> 0;
for (let i = 0; i < str.length; i++) {
h ^= str.charCodeAt(i);
h = Math.imul(h, 16777619);
}
return h >>> 0;
}
function xmur3(str: string): () => number {
let h = 1779033703 ^ str.length;
for (let i = 0; i < str.length; i++) {
h = Math.imul(h ^ str.charCodeAt(i), 3432918353);
h = (h << 13) | (h >>> 19);
}
return function () {
h = Math.imul(h ^ (h >>> 16), 2246822507);
h = Math.imul(h ^ (h >>> 13), 3266489909);
return (h ^= h >>> 16) >>> 0;
};
}
function mulberry32(a: number): () => number {
return function () {
let t = (a += 0x6d2b79f5);
t = Math.imul(t ^ (t >>> 15), t | 1);
t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
};
}
function makeRNG(key: string): () => number {
return mulberry32(xmur3(key)());
}
function chooseK<T>(arr: T[], k: number, rnd: () => number): T[] {
const pool = arr.slice();
const out = [];
for (let i = 0; i < k; i++) {
const idx = Math.floor(rnd() * pool.length);
out.push(pool.splice(idx, 1)[0]);
}
return out;
}
function pick<T>(rng: () => number, arr: T[]): T {
return arr[Math.floor(rng() * arr.length)];
}
function createOffscreenCanvas(
w: number,
h: number,
density: number = 2,
): { canvas: HTMLCanvasElement; ctx: CanvasRenderingContext2D } {
const canvas = document.createElement("canvas");
canvas.width = w * density;
canvas.height = h * density;
const ctx = canvas.getContext("2d")!;
ctx.scale(density, density);
ctx.imageSmoothingEnabled = false;
return { canvas, ctx };
}
function fillCircle(
ctx: CanvasRenderingContext2D,
x: number,
y: number,
diameter: number,
color: string,
): void {
ctx.fillStyle = color;
ctx.beginPath();
ctx.arc(x, y, diameter / 2, 0, Math.PI * 2);
ctx.fill();
}
function fillEllipse(
ctx: CanvasRenderingContext2D,
x: number,
y: number,
w: number,
h: number,
color: string,
): void {
ctx.fillStyle = color;
ctx.beginPath();
ctx.ellipse(x, y, w / 2, h / 2, 0, 0, Math.PI * 2);
ctx.fill();
}
interface AtomDrawConfig {
cellSize: number;
circleB: number;
circleC: number;
useEllipse?: boolean;
}
function createAtomRenderer(config: AtomDrawConfig) {
const drawCircleOrEllipse = (
ctx: CanvasRenderingContext2D,
x: number,
y: number,
w: number,
h: number,
color: string,
) => {
if (config.useEllipse) {
fillEllipse(ctx, x, y, w, h, color);
} else {
fillCircle(ctx, x, y, w, color); // w is diameter for circles
}
};
return {
drawAtomA(
ctx: CanvasRenderingContext2D,
gx: number,
gy: number,
c1: string,
): void {
const x = gx * config.cellSize;
const y = gy * config.cellSize;
ctx.fillStyle = c1;
ctx.fillRect(x, y, config.cellSize, config.cellSize);
},
drawAtomB(
ctx: CanvasRenderingContext2D,
gx: number,
gy: number,
c1: string,
c2: string,
): void {
const x = gx * config.cellSize;
const y = gy * config.cellSize;
ctx.fillStyle = c1;
ctx.fillRect(x, y, config.cellSize, config.cellSize);
drawCircleOrEllipse(
ctx,
x + config.cellSize / 2,
y + config.cellSize / 2,
config.circleB,
config.circleB,
c2,
);
},
drawAtomC(
ctx: CanvasRenderingContext2D,
gx: number,
gy: number,
c2: string,
c3: string,
): void {
const x = gx * config.cellSize;
const y = gy * config.cellSize;
ctx.fillStyle = c2;
ctx.fillRect(x, y, config.cellSize, config.cellSize);
drawCircleOrEllipse(
ctx,
x + config.cellSize / 2,
y + config.cellSize / 2,
config.circleC,
config.circleC,
c3,
);
},
drawAtomD(
ctx: CanvasRenderingContext2D,
gx: number,
gy: number,
c3: string,
): void {
const x = gx * config.cellSize;
const y = gy * config.cellSize;
ctx.fillStyle = c3;
ctx.fillRect(x, y, config.cellSize, config.cellSize);
},
drawAtom(
ctx: CanvasRenderingContext2D,
atom: AtomType,
gx: number,
gy: number,
c1: string,
c2: string,
c3: string,
): void {
switch (atom) {
case "A":
this.drawAtomA(ctx, gx, gy, c1);
break;
case "B":
this.drawAtomB(ctx, gx, gy, c1, c2);
break;
case "C":
this.drawAtomC(ctx, gx, gy, c2, c3);
break;
case "D":
this.drawAtomD(ctx, gx, gy, c3);
break;
}
},
};
}
// 5x7 pixel font glyphs (cached at module level for performance)
function createGlyphs5x7(): Record<string, number[][]> {
const L: Record<string, number[][]> = {};
const r = (s: string[]) =>
s.map(row => row.split("").map(ch => (ch === "1" ? 1 : 0)));
L["A"] = r(["01110", "10001", "10001", "11111", "10001", "10001", "10001"]);
L["B"] = r(["11110", "10001", "10001", "11110", "10001", "10001", "11110"]);
L["C"] = r(["01111", "10000", "10000", "10000", "10000", "10000", "01111"]);
L["D"] = r(["11110", "10001", "10001", "10001", "10001", "10001", "11110"]);
L["E"] = r(["11111", "10000", "10000", "11110", "10000", "10000", "11111"]);
L["F"] = r(["11111", "10000", "10000", "11110", "10000", "10000", "10000"]);
L["G"] = r(["01111", "10000", "10000", "10111", "10001", "10001", "01111"]);
L["H"] = r(["10001", "10001", "10001", "11111", "10001", "10001", "10001"]);
L["I"] = r(["11111", "00100", "00100", "00100", "00100", "00100", "11111"]);
L["J"] = r(["11111", "00001", "00001", "00001", "10001", "10001", "01110"]);
L["K"] = r(["10001", "10010", "10100", "11000", "10100", "10010", "10001"]);
L["L"] = r(["10000", "10000", "10000", "10000", "10000", "10000", "11111"]);
L["M"] = r(["10001", "11011", "10101", "10001", "10001", "10001", "10001"]);
L["N"] = r(["10001", "11001", "10101", "10011", "10001", "10001", "10001"]);
L["O"] = r(["01110", "10001", "10001", "10001", "10001", "10001", "01110"]);
L["P"] = r(["11110", "10001", "10001", "11110", "10000", "10000", "10000"]);
L["Q"] = r(["01110", "10001", "10001", "10001", "10101", "10010", "01101"]);
L["R"] = r(["11110", "10001", "10001", "11110", "10100", "10010", "10001"]);
L["S"] = r(["01111", "10000", "11110", "00001", "00001", "10001", "11110"]);
L["T"] = r(["11111", "00100", "00100", "00100", "00100", "00100", "00100"]);
L["U"] = r(["10001", "10001", "10001", "10001", "10001", "10001", "01110"]);
L["V"] = r(["10001", "10001", "10001", "01010", "01010", "00100", "00100"]);
L["W"] = r(["10001", "10001", "10001", "10101", "10101", "11011", "10001"]);
L["X"] = r(["10001", "01010", "00100", "00100", "00100", "01010", "10001"]);
L["Y"] = r(["10001", "01010", "00100", "00100", "00100", "00100", "00100"]);
L["Z"] = r(["11111", "00001", "00010", "00100", "01000", "10000", "11111"]);
L["0"] = r(["01110", "10001", "10011", "10101", "11001", "10001", "01110"]);
L["1"] = r(["00100", "01100", "00100", "00100", "00100", "00100", "01110"]);
L["2"] = r(["01110", "10001", "00001", "00110", "01000", "10000", "11111"]);
L["3"] = r(["11110", "00001", "01110", "00001", "00001", "00001", "11110"]);
L["4"] = r(["10010", "10010", "10010", "11111", "00010", "00010", "00010"]);
L["5"] = r(["11111", "10000", "11110", "00001", "00001", "00001", "11110"]);
L["6"] = r(["01110", "10000", "11110", "10001", "10001", "10001", "01110"]);
L["7"] = r(["11111", "00001", "00010", "00100", "01000", "01000", "01000"]);
L["8"] = r(["01110", "10001", "01110", "10001", "10001", "10001", "01110"]);
L["9"] = r(["01110", "10001", "10001", "01111", "00001", "00001", "11110"]);
L["?"] = r(["11111", "00001", "01110", "00000", "00100", "00000", "00100"]);
return L;
}
const LETTER_5X7 = createGlyphs5x7();
function getInitials(name: string): string[] {
if (!name || typeof name !== "string") return ["?"];
const cleaned = name.trim().replace(/\s+/g, " ");
const parts = cleaned.split(/[^A-Za-z0-9]+/).filter(Boolean);
const first = parts[0] ? parts[0][0].toUpperCase() : "?";
const second = parts[1] ? parts[1][0].toUpperCase() : null;
return second ? [first, second] : [first];
}
function polarFromCell(
gx: number,
gy: number,
cx: number,
cy: number,
): { r: number; a: number } {
const x = gx - cx + 0.5;
const y = gy - cy + 0.5;
const r = Math.hypot(x, y);
let a = Math.atan2(y, x);
if (a < 0) a += 2 * Math.PI;
return { r, a };
}
function shapeRose(theta: number, petals: number, tol: number): boolean {
const sector = Math.PI / petals;
const nearest = Math.round(theta / sector) * sector;
let diff = Math.abs(theta - nearest);
diff = Math.min(diff, 2 * Math.PI - diff);
return diff <= tol;
}
function shapeStarburst(
theta: number,
petals: number,
softness: number,
): boolean {
const period = (2 * Math.PI) / petals;
const local = theta % period;
const d = Math.min(local, period - local) / (period / 2);
const response = Math.pow(Math.cos((d * Math.PI) / 2), softness);
return response > 0.5;
}
function shapeRinged(
theta: number,
petals: number,
ringPhase: number,
tol: number,
): boolean {
const sector = (2 * Math.PI) / petals;
const k = Math.floor(theta / sector);
const center = k * sector + sector * ringPhase;
let diff = Math.abs(theta - center);
diff = Math.min(diff, 2 * Math.PI - diff);
return diff <= tol;
}
function shapeTip(
theta: number,
petals: number,
tol: number,
t: number,
): boolean {
return shapeRose(theta, petals, tol * (0.5 + 1.0 * t)) && t > 0.45;
}
function shapeNotched(
theta: number,
petals: number,
tol: number,
notchDepth: number = 0.25,
): boolean {
const sector = (2 * Math.PI) / petals;
const local = (theta % sector) / sector;
const notch = Math.abs(local - 0.5);
return shapeRose(theta, petals, tol) && notch > notchDepth;
}
function shapeHollow(
theta: number,
petals: number,
tol: number,
t: number,
inner: number = 0.28,
outer: number = 0.9,
): boolean {
return shapeRose(theta, petals, tol) && t > inner && t < outer;
}
function sectorGate(theta: number, petals: number, mask: boolean[]): boolean {
const sector = (2 * Math.PI) / petals;
const k = Math.floor(theta / sector);
return mask[k % mask.length];
}
export const cachedRepoAvatar = cached(
async (key: string) => renderRepoAvatar(key),
(key: string) => key,
{ max: 2000 },
);
export const cachedUserAvatar = cached(
async (key: string) => renderUserAvatar(key),
(key: string) => key,
{ max: 2000 },
);
function renderRepoAvatar(key: string): string {
if (typeof window === "undefined") {
return "";
}
{
// Color logic:
// A: square = Color1
// B: square = Color1, circle = Color2
// C: square = Color2, circle = Color3
// D: square = Color3
// Letters: solid-only (A or D). Background: other three atoms.
// Single initial: 2x2 expansion (10x14). Two initials: 5x7 each.
const GRID = REPO_CONFIG.GRID_SIZE;
const CELL = REPO_CONFIG.CELL_SIZE;
const W = GRID * CELL;
const H = GRID * CELL;
const { canvas, ctx } = createOffscreenCanvas(
W,
H,
REPO_CONFIG.PIXEL_DENSITY,
);
const atoms = createAtomRenderer({
cellSize: CELL,
circleB: CELL * REPO_CONFIG.ATOMS.CIRCLE_B_RATIO,
circleC: CELL * REPO_CONFIG.ATOMS.CIRCLE_C_RATIO,
useEllipse: false,
});
function renderInitialsAvatar(nameKey: string = "color bright") {
const initials = getInitials(nameKey);
const seed = hash32(nameKey.toLowerCase());
const rnd = mulberry32(seed);
// Select three distinct colors deterministically (Color1, Color2, Color3)
const [c1, c2, c3] = chooseK(PALETTE, 3, rnd);
// Choose letter solid atom: 'A' or 'D' (deterministic)
const letterSolidAtom: AtomType = ((seed >>> 7) & 1) === 0 ? "A" : "D";
const bgAtoms: AtomType[] = (["A", "B", "C", "D"] as AtomType[]).filter(
a => a !== letterSolidAtom,
);
function pickBgAtom(gx: number, gy: number): AtomType {
const k = (gy * 131 + gx * 197 + seed) >>> 0;
return bgAtoms[k % bgAtoms.length];
}
// 1) Background: fill with bgAtoms using strict color mapping
for (let gy = 0; gy < GRID; gy++) {
for (let gx = 0; gx < GRID; gx++) {
const atom = pickBgAtom(gx, gy);
atoms.drawAtom(ctx, atom, gx, gy, c1, c2, c3);
}
}
// 2) Letters: solid-only atom across glyph pixels, strict mapping (A uses c1, D uses c3)
const glyphW = REPO_CONFIG.GLYPH.WIDTH;
const glyphH = REPO_CONFIG.GLYPH.HEIGHT;
function placeSolidLetter(
glyph: number[][],
startX: number,
startY: number,
scale2x: boolean,
) {
if (scale2x) {
// 2x2 expansion → 10x14
for (let r = 0; r < glyphH; r++) {
for (let c = 0; c < glyphW; c++) {
if (!glyph[r][c]) continue;
const gx = startX + c * 2;
const gy = startY + r * 2;
if (letterSolidAtom === "A") {
atoms.drawAtomA(ctx, gx, gy, c1);
atoms.drawAtomA(ctx, gx + 1, gy, c1);
atoms.drawAtomA(ctx, gx, gy + 1, c1);
atoms.drawAtomA(ctx, gx + 1, gy + 1, c1);
} else {
atoms.drawAtomD(ctx, gx, gy, c3);
atoms.drawAtomD(ctx, gx + 1, gy, c3);
atoms.drawAtomD(ctx, gx, gy + 1, c3);
atoms.drawAtomD(ctx, gx + 1, gy + 1, c3);
}
}
}
} else {
// 1x scale
for (let r = 0; r < glyphH; r++) {
for (let c = 0; c < glyphW; c++) {
if (!glyph[r][c]) continue;
const gx = startX + c;
const gy = startY + r;
if (letterSolidAtom === "A") {
atoms.drawAtomA(ctx, gx, gy, c1);
} else {
atoms.drawAtomD(ctx, gx, gy, c3);
}
}
}
}
}
if (initials.length === 1) {
// Single initial: 2x2 expansion (10x14), centered
const glyph = LETTER_5X7[initials[0]] || LETTER_5X7["?"];
const startX = Math.floor(
(GRID - REPO_CONFIG.GLYPH.SCALE_2X_WIDTH) / 2,
);
const startY = Math.floor(
(GRID - REPO_CONFIG.GLYPH.SCALE_2X_HEIGHT) / 2,
);
placeSolidLetter(glyph, startX, startY, true);
} else {
// Two initials: 5x7 each, side-by-side
const leftGlyph = LETTER_5X7[initials[0]] || LETTER_5X7["?"];
const rightGlyph = LETTER_5X7[initials[1]] || LETTER_5X7["?"];
const spacing = REPO_CONFIG.GLYPH.SPACING;
const totalW = REPO_CONFIG.GLYPH.WIDTH * 2 + spacing;
const totalH = REPO_CONFIG.GLYPH.HEIGHT;
const startX = Math.floor((GRID - totalW) / 2);
const startY = Math.floor((GRID - totalH) / 2);
placeSolidLetter(leftGlyph, startX, startY, false);
placeSolidLetter(
rightGlyph,
startX + REPO_CONFIG.GLYPH.WIDTH + spacing,
startY,
false,
);
}
return canvas.toDataURL();
}
return renderInitialsAvatar(key);
}
}
function renderUserAvatar(key: string): string {
if (typeof window === "undefined") {
return "";
}
{
const TILE = USER_CONFIG.TILE_SIZE;
const DEFAULT_GRID = USER_CONFIG.DEFAULT_GRID;
const atoms = createAtomRenderer({
cellSize: TILE,
circleB: USER_CONFIG.ATOMS.ELLIPSE_B_SIZE,
circleC: USER_CONFIG.ATOMS.ELLIPSE_C_SIZE,
useEllipse: true,
});
// Edge-to-edge integer placement
function drawAt(
fn: (x: number, y: number) => void,
gx: number,
gy: number,
): void {
fn(gx * TILE, gy * TILE);
}
// Strict 4-way symmetry (quadrant mirroring)
function drawQuad(
fn: (x: number, y: number) => void,
gx: number,
gy: number,
grid: number,
): void {
const N = grid - 1;
drawAt(fn, gx, gy);
drawAt(fn, N - gx, gy);
drawAt(fn, gx, N - gy);
drawAt(fn, N - gx, N - gy);
}
// Draw by atom type (converts pixel coordinates to grid coordinates)
function drawAtomByType(
ctx: CanvasRenderingContext2D,
type: AtomType,
x: number,
y: number,
c1: string,
c2: string,
c3: string,
): void {
const gx = x / TILE;
const gy = y / TILE;
atoms.drawAtom(ctx, type, gx, gy, c1, c2, c3);
}
// Make assigner among active petal atoms (exclude background atom)
function makeAssigner(
mode: AtomMode,
activeAtoms: AtomType[],
): (rCell: number, theta?: number, sectorIdx?: number) => AtomType {
if (mode === "bands-ABC")
return (rCell: number) => activeAtoms[rCell % 3];
if (mode === "angle-stripes")
return (_rCell: number, _theta?: number, sectorIdx?: number) =>
activeAtoms[(sectorIdx || 0) % activeAtoms.length];
if (mode === "parity-ACB")
return (rCell: number) => activeAtoms[rCell % 2 ? 1 : 0];
if (mode === "balanced-rand")
return (rCell: number, theta?: number, sectorIdx?: number) => {
const v =
(Math.sin(
(theta || 0) * 13.37 + rCell * 2.17 + (sectorIdx || 0) * 0.73,
) +
1) /
2;
if (v < 0.33) return activeAtoms[0];
if (v < 0.66) return activeAtoms[1];
return activeAtoms[2];
};
return (rCell: number) => activeAtoms[rCell % 3];
}
function generateFlower(
ctx: CanvasRenderingContext2D,
canvas: HTMLCanvasElement,
key: string,
grid: number = DEFAULT_GRID,
): void {
ctx.clearRect(0, 0, canvas.width, canvas.height);
const rng = makeRNG(key);
const picked = PALETTE.slice().sort(() => rng() - 0.5);
const [c1, c2, c3] = picked.slice(0, 3);
const allAtoms: AtomType[] = ["A", "B", "C", "D"];
const bgAtom: AtomType = pick(rng, allAtoms);
const petalAtoms: AtomType[] = allAtoms
.filter(a => a !== bgAtom)
.sort(() => rng() - 0.5);
const cx = Math.floor(grid / 2),
cy = Math.floor(grid / 2);
const maxR = Math.min(cx, cy);
const petals = pick(rng, [5, 6, 7, 8, 9, 10]);
const petalDepth = Math.max(5, Math.floor(maxR * (0.6 + 0.35 * rng())));
const radialThickness = pick(rng, [1, 2, 2, 3, 3]);
const shapeModel: ShapeModel = pick(rng, [
"rose",
"starburst",
"ringed",
"tip",
"notched",
"hollow",
]);
const atomMode: AtomMode = pick(rng, [
"bands-ABC",
"angle-stripes",
"parity-ACB",
"balanced-rand",
]);
const assignAtom = makeAssigner(atomMode, petalAtoms);
// Angle tolerances
const angleTolNear =
USER_CONFIG.TOLERANCE.ANGLE_NEAR_BASE *
(USER_CONFIG.TOLERANCE.NEAR_RANGE.MIN +
rng() *
(USER_CONFIG.TOLERANCE.NEAR_RANGE.MAX -
USER_CONFIG.TOLERANCE.NEAR_RANGE.MIN));
const angleTolFar =
USER_CONFIG.TOLERANCE.ANGLE_FAR_BASE *
(USER_CONFIG.TOLERANCE.FAR_RANGE.MIN +
rng() *
(USER_CONFIG.TOLERANCE.FAR_RANGE.MAX -
USER_CONFIG.TOLERANCE.FAR_RANGE.MIN));
const softness =
USER_CONFIG.SOFTNESS.MIN +
rng() * (USER_CONFIG.SOFTNESS.MAX - USER_CONFIG.SOFTNESS.MIN);
const ringPhase =
USER_CONFIG.RING_PHASE.MIN +
rng() * (USER_CONFIG.RING_PHASE.MAX - USER_CONFIG.RING_PHASE.MIN);
// Sector gating mask (~70% sectors on), ensures bold shapes
const sectorMask = Array.from({ length: petals }, () => rng() > 0.3);
if (sectorMask.every(v => !v)) sectorMask[Math.floor(petals / 2)] = true;
const drawBgAtom = (gx: number, gy: number) => {
drawAt(
(x: number, y: number) =>
drawAtomByType(ctx, bgAtom, x, y, c1, c2, c3),
gx,
gy,
);
};
// 0) Base pass: paint every tile once with background atom to avoid gaps
function renderBasePass() {
for (let gy = 0; gy < grid; gy++) {
for (let gx = 0; gx < grid; gx++) {
drawBgAtom(gx, gy);
}
}
}
// 1) Outer edge circumference (1–2 tiles thick) reinforced in background atom
function renderEdgeReinforcement() {
const edgeThickness = pick(rng, [1, 1, 2]);
for (let t = 0; t < edgeThickness; t++) {
for (let i = 0; i < grid; i++) {
drawBgAtom(i, t);
drawBgAtom(i, grid - 1 - t);
drawBgAtom(t, i);
drawBgAtom(grid - 1 - t, i);
}
}
}
// 2) Background atom structural accents inside (deterministic)
// - mid ring (optional) and a few gated spokes to help define silhouette
function renderStructuralAccents() {
// Mid ring
if (rng() < 0.7) {
const midR = Math.floor(petalDepth * (0.5 + 0.2 * rng()));
for (let i = 0; i < grid; i++) {
const coords: [number, number][] = [
[cx - midR, i],
[cx + midR, i],
[i, cy - midR],
[i, cy + midR],
];
coords.forEach(([gx, gy]) => {
if (gx >= 0 && gy >= 0 && gx < grid && gy < grid) {
drawQuad(
(x: number, y: number) =>
drawAtomByType(ctx, bgAtom, x, y, c1, c2, c3),
gx,
gy,
grid,
);
}
});
}
}
// Gated spokes
if (rng() < 0.6) {
const gateEvery = pick(rng, [2, 3, 4]);
for (let s = 0; s < petals; s++) {
if (s % gateEvery !== 0) continue;
const theta = s * ((2 * Math.PI) / petals);
for (let r = 1; r <= petalDepth; r++) {
const gx = Math.round(cx + r * Math.cos(theta));
const gy = Math.round(cy + r * Math.sin(theta));
if (gx >= 0 && gy >= 0 && gx < grid && gy < grid) {
drawQuad(
(x: number, y: number) =>
drawAtomByType(ctx, bgAtom, x, y, c1, c2, c3),
gx,
gy,
grid,
);
}
}
}
}
}
// 3) Strong center cluster (guarantee coverage; seed form)
function renderCenterCluster() {
const centerCluster: [number, number, AtomType][] = [
[0, 0, "D"],
[0, -1, petalAtoms[0]],
[1, 0, petalAtoms[1]],
[0, 1, petalAtoms[2]],
[-1, 0, petalAtoms[0]],
];
centerCluster.forEach(([dx, dy, t]: [number, number, AtomType]) => {
const gx = cx + dx,
gy = cy + dy;
if (gx < 0 || gy < 0 || gx >= grid || gy >= grid) return;
drawQuad(
(x: number, y: number) => drawAtomByType(ctx, t, x, y, c1, c2, c3),
gx,
gy,
grid,
);
});
}
// 4) Petals (TL quadrant → mirror)
function renderPetals() {
const half = Math.ceil(grid / 2);
for (let gy = 0; gy < half; gy++) {
for (let gx = 0; gx < half; gx++) {
const { r, a } = polarFromCell(gx, gy, cx, cy);
const rCell = Math.floor(r);
if (rCell === 0 || rCell > petalDepth) continue;
const t = rCell / petalDepth;
const tol = angleTolNear * (1 - t) + angleTolFar * t;
const sectorIdx = Math.floor(a / ((2 * Math.PI) / petals));
if (!sectorGate(a, petals, sectorMask)) continue;
let inside: boolean;
if (shapeModel === "rose") inside = shapeRose(a, petals, tol);
else if (shapeModel === "starburst")
inside = shapeStarburst(a, petals, softness);
else if (shapeModel === "ringed")
inside = shapeRinged(a, petals, ringPhase, tol * 0.7);
else if (shapeModel === "tip") inside = shapeTip(a, petals, tol, t);
else if (shapeModel === "notched")
inside = shapeNotched(a, petals, tol, 0.24);
else inside = shapeHollow(a, petals, tol, t, 0.28, 0.92);
if (!inside) continue;
const type = assignAtom(rCell, a, sectorIdx);
// Draw with radial thickness and 4-way mirroring
for (let dr = 0; dr < radialThickness; dr++) {
const x1 = gx + dr,
y1 = gy + dr;
const coords: [number, number][] = [
[x1, y1],
[grid - 1 - x1, y1],
[x1, grid - 1 - y1],
[grid - 1 - x1, grid - 1 - y1],
];
coords.forEach(([ix, iy]: [number, number]) => {
if (ix < 0 || iy < 0 || ix >= grid || iy >= grid) return;
drawAt(
(x: number, y: number) =>
drawAtomByType(ctx, type, x, y, c1, c2, c3),
ix,
iy,
);
});
}
}
}
}
// 5) Ensure all three petal atoms appear at least once
function renderAccents() {
const accents: [number, number, AtomType][] = [
[cx, cy - 2, petalAtoms[0]],
[cx + 1, cy, petalAtoms[1]],
[cx, cy + 2, petalAtoms[2]],
];
accents.forEach(([gx, gy, t]: [number, number, AtomType]) => {
if (gx < 0 || gy < 0 || gx >= grid || gy >= grid) return;
drawQuad(
(x: number, y: number) => drawAtomByType(ctx, t, x, y, c1, c2, c3),
gx,
gy,
grid,
);
});
}
// 6) Final safety: ensure center 6×6 px is covered via 2×2 cluster
function renderFinalCluster() {
const cluster: [number, number, AtomType][] = [
[0, 0, "D"],
[1, 0, petalAtoms[1]],
[0, 1, petalAtoms[2]],
[1, 1, petalAtoms[0]],
];
cluster.forEach(([dx, dy, t]: [number, number, AtomType]) => {
const gx = cx + dx,
gy = cy + dy;
if (gx < 0 || gy < 0 || gx >= grid || gy >= grid) return;
drawQuad(
(x: number, y: number) => drawAtomByType(ctx, t, x, y, c1, c2, c3),
gx,
gy,
grid,
);
});
}
renderBasePass();
renderEdgeReinforcement();
renderStructuralAccents();
renderCenterCluster();
renderPetals();
renderAccents();
renderFinalCluster();
}
function drawFlowerForKey(
key: string,
grid: number = DEFAULT_GRID,
): string {
const canvasPx = grid * TILE;
const { canvas, ctx } = createOffscreenCanvas(
canvasPx,
canvasPx,
USER_CONFIG.PIXEL_DENSITY,
);
generateFlower(ctx, canvas, key, grid);
return canvas.toDataURL();
}
return drawFlowerForKey(key, DEFAULT_GRID);
}
}
+1 -1
View File
@@ -14,9 +14,9 @@ import type { RepoInfo } from "@bindings/repo/RepoInfo";
import type { RepoSummary } from "@bindings/repo/RepoSummary";
import type { TreePath } from "@bindings/repo/TreePath";
import { cached } from "@radicle-gui/ui/lib/cached";
import * as tauri from "@tauri-apps/api/core";
import { cached } from "@app/lib/cached";
import type { RepoListScope } from "@app/lib/repoListScope";
export async function invoke<T = null>(
+2 -1
View File
@@ -5,6 +5,8 @@
import type { Config } from "@bindings/config/Config";
import type { RepoInfo } from "@bindings/repo/RepoInfo";
import RepoAvatar from "@radicle-gui/ui/components/RepoAvatar.svelte";
import { nodeRunning } from "@app/lib/events";
import { invoke } from "@app/lib/invoke";
import { disableHide, enableHide, forceHide, hide } from "@app/lib/modal";
@@ -17,7 +19,6 @@
import ExtendedTextarea from "@app/components/ExtendedTextarea.svelte";
import Icon from "@app/components/Icon.svelte";
import LabelInput from "@app/components/LabelInput.svelte";
import RepoAvatar from "@app/components/RepoAvatar.svelte";
import TextInput from "@app/components/TextInput.svelte";
interface Props {
+1 -1
View File
@@ -5,6 +5,7 @@
import type { RepoInfo } from "@bindings/repo/RepoInfo";
import type { Tag } from "@bindings/repo/Tag";
import RepoAvatar from "@radicle-gui/ui/components/RepoAvatar.svelte";
import { untrack } from "svelte";
import { pickFiles, pickFolder } from "@app/lib/artifactPickers";
@@ -25,7 +26,6 @@
import DropdownListItem from "@app/components/DropdownListItem.svelte";
import Icon from "@app/components/Icon.svelte";
import Popover, { closeFocused } from "@app/components/Popover.svelte";
import RepoAvatar from "@app/components/RepoAvatar.svelte";
import ScrollArea from "@app/components/ScrollArea.svelte";
import TextInput from "@app/components/TextInput.svelte";
+1 -1
View File
@@ -12,6 +12,7 @@
import type { Commit } from "@bindings/repo/Commit";
import type { RepoInfo } from "@bindings/repo/RepoInfo";
import UserAvatar from "@radicle-gui/ui/components/UserAvatar.svelte";
import countBy from "lodash/countBy";
import mapValues from "lodash/mapValues";
import { SvelteSet } from "svelte/reactivity";
@@ -69,7 +70,6 @@
import ShareButton from "@app/components/ShareButton.svelte";
import Spinner from "@app/components/Spinner.svelte";
import Topbar from "@app/components/Topbar.svelte";
import UserAvatar from "@app/components/UserAvatar.svelte";
import Layout from "./Layout.svelte";
+2
View File
@@ -1,5 +1,6 @@
import path from "node:path";
import { sharedPublic } from "@radicle-gui/ui/vite";
import { svelte } from "@sveltejs/vite-plugin-svelte";
import { defineConfig } from "vitest/config";
@@ -58,6 +59,7 @@ export default defineConfig({
},
},
},
sharedPublic(),
svelte({
// Reference: https://github.com/sveltejs/vite-plugin-svelte/issues/270#issuecomment-1033190138
dynamicCompileOptions({ filename }) {
-1
View File
@@ -1 +0,0 @@
min-release-age=7
-1
View File
@@ -1 +0,0 @@
24.15.0
+8 -4
View File
@@ -51,11 +51,15 @@
type="font/woff2"
crossorigin="anonymous" />
<link rel="stylesheet" type="text/css" href="/typography.css" />
<link rel="stylesheet" type="text/css" href="/typography.css" vite-ignore />
<link rel="stylesheet" type="text/css" href="/katex.min.css" />
<link rel="stylesheet" type="text/css" href="/colors.css" />
<link rel="stylesheet" type="text/css" href="/elevations.css" />
<link rel="stylesheet" type="text/css" href="/prettylights.css" />
<link rel="stylesheet" type="text/css" href="/colors.css" vite-ignore />
<link rel="stylesheet" type="text/css" href="/tokens.css" vite-ignore />
<link
rel="stylesheet"
type="text/css"
href="/prettylights.css"
vite-ignore />
<link rel="stylesheet" type="text/css" href="/index.css" />
<link rel="stylesheet" type="text/css" href="/marketing/marketing.css" />
<link rel="icon" href="/favicon.png" type="image/png" />
+1 -5
View File
@@ -64,6 +64,7 @@
"wait-on": "^9.0.10"
},
"dependencies": {
"@radicle-gui/ui": "0.0.0",
"@twemoji/svg": "^15.0.0",
"@wooorm/starry-night": "^3.10.0",
"async-mutex": "^0.5.0",
@@ -89,10 +90,5 @@
"svelte": "^5.56.5",
"twemoji": "^14.0.2",
"zod": "^4.4.3"
},
"overrides": {
"mermaid": {
"katex": "$katex"
}
}
}
-306
View File
@@ -1,306 +0,0 @@
/* Light theme. */
:root {
--color-surface-base: var(--color-neutrals-opaque-light-50);
--color-surface-canvas: var(--color-neutrals-opaque-light-0);
--color-surface-subtle: var(--color-neutrals-opaque-light-100);
--color-surface-mid: var(--color-neutrals-opaque-light-150);
--color-surface-strong: var(--color-neutrals-opaque-light-200);
--color-surface-alpha-subtle: var(--color-neutrals-alpha-light-50);
--color-surface-alpha-mid: var(--color-neutrals-alpha-light-100);
--color-surface-alpha-strong: var(--color-neutrals-alpha-light-200);
--color-surface-scrim: var(--color-neutrals-alpha-light-500);
--color-surface-open: var(--color-accent-green-200);
--color-surface-merged: var(--color-accent-blue-200);
--color-surface-draft: var(--color-neutrals-opaque-light-150);
--color-surface-closed: var(--color-accent-blue-200);
--color-surface-archived: var(--color-accent-pink-200);
--color-text-primary: var(--color-neutrals-opaque-light-900);
--color-text-secondary: var(--color-neutrals-opaque-light-700);
--color-text-tertiary: var(--color-neutrals-opaque-light-600);
--color-text-quaternary: var(--color-neutrals-opaque-light-500);
--color-text-disabled: var(--color-neutrals-alpha-light-400);
--color-text-open: var(--color-accent-green-800);
--color-text-merged: var(--color-accent-blue-800);
--color-text-draft: var(--color-neutrals-opaque-light-600);
--color-text-closed: var(--color-accent-blue-800);
--color-text-archived: var(--color-accent-pink-800);
--color-border-subtle: var(--color-neutrals-opaque-light-150);
--color-border-mid: var(--color-neutrals-opaque-light-200);
--color-border-strong: var(--color-neutrals-opaque-light-300);
--color-border-alpha-subtle: var(--color-neutrals-alpha-light-100);
--color-border-alpha-mid: var(--color-neutrals-alpha-light-200);
--color-feedback-success-text: var(--color-semantic-green-800);
--color-feedback-success-border: var(--color-semantic-green-600);
--color-feedback-success-bg: var(--color-semantic-green-100);
--color-feedback-success-bg-selected: var(--color-semantic-green-200);
--color-feedback-warning-text: var(--color-semantic-amber-800);
--color-feedback-warning-border: var(--color-semantic-amber-600);
--color-feedback-warning-bg: var(--color-semantic-amber-100);
--color-feedback-error-text: var(--color-semantic-red-800);
--color-feedback-error-border: var(--color-semantic-red-600);
--color-feedback-error-bg: var(--color-semantic-red-100);
--color-feedback-error-bg-selected: var(--color-semantic-red-200);
--color-code-keywords: var(--color-accent-blue-700);
--color-code-strings: var(--color-accent-green-700);
--color-code-numbers: var(--color-accent-purple-700);
--color-code-comments: var(--color-neutrals-opaque-light-700);
--color-code-error: var(--color-semantic-red-700);
--color-code-functions: var(--color-accent-emerald-700);
/* Brand. */
--color-brand-bg: var(--color-accent-blue-600);
--color-brand-hover: var(--color-accent-blue-500);
--color-brand-text-light: var(--color-accent-blue-600);
--color-brand-text-dark: var(--color-accent-blue-400);
--color-text-on-brand: var(--color-neutrals-opaque-light-0);
--color-surface-brand-primary: var(--color-brand-bg);
--color-surface-brand-secondary: var(--color-brand-hover);
--color-border-brand: var(--color-brand-hover);
--color-text-brand: var(--color-brand-text-light);
}
/* Dark theme. */
:root[data-theme="dark"] {
--color-surface-base: var(--color-neutrals-opaque-dark-0);
--color-surface-canvas: var(--color-neutrals-opaque-dark-50);
--color-surface-subtle: var(--color-neutrals-opaque-dark-100);
--color-surface-mid: var(--color-neutrals-opaque-dark-150);
--color-surface-strong: var(--color-neutrals-opaque-dark-200);
--color-surface-alpha-subtle: var(--color-neutrals-alpha-dark-50);
--color-surface-alpha-mid: var(--color-neutrals-alpha-dark-100);
--color-surface-alpha-strong: var(--color-neutrals-alpha-dark-200);
--color-surface-scrim: var(--color-neutrals-alpha-light-700);
--color-surface-open: var(--color-accent-green-900);
--color-surface-draft: var(--color-neutrals-opaque-dark-150);
--color-surface-closed: var(--color-accent-blue-900);
--color-surface-merged: var(--color-accent-blue-900);
--color-surface-archived: var(--color-accent-pink-900);
--color-text-primary: var(--color-neutrals-opaque-dark-900);
--color-text-secondary: var(--color-neutrals-opaque-dark-700);
--color-text-tertiary: var(--color-neutrals-opaque-dark-600);
--color-text-quaternary: var(--color-neutrals-opaque-dark-500);
--color-text-disabled: var(--color-neutrals-alpha-dark-400);
--color-text-open: var(--color-accent-green-500);
--color-text-draft: var(--color-neutrals-opaque-dark-600);
--color-text-closed: var(--color-accent-blue-500);
--color-text-merged: var(--color-accent-blue-500);
--color-text-archived: var(--color-accent-pink-500);
--color-border-subtle: var(--color-neutrals-opaque-dark-150);
--color-border-mid: var(--color-neutrals-opaque-dark-200);
--color-border-strong: var(--color-neutrals-opaque-dark-300);
--color-border-alpha-subtle: var(--color-neutrals-alpha-dark-100);
--color-border-alpha-mid: var(--color-neutrals-alpha-dark-200);
--color-feedback-success-text: var(--color-semantic-green-400);
--color-feedback-success-border: var(--color-semantic-green-700);
--color-feedback-success-bg: var(--color-semantic-green-900);
--color-feedback-success-bg-selected: var(--color-semantic-green-800);
--color-feedback-warning-text: var(--color-semantic-amber-400);
--color-feedback-warning-border: var(--color-semantic-amber-700);
--color-feedback-warning-bg: var(--color-semantic-amber-900);
--color-feedback-error-text: var(--color-semantic-red-400);
--color-feedback-error-border: var(--color-semantic-red-700);
--color-feedback-error-bg: var(--color-semantic-red-900);
--color-feedback-error-bg-selected: var(--color-semantic-red-800);
--color-code-keywords: var(--color-accent-blue-400);
--color-code-strings: var(--color-accent-green-400);
--color-code-numbers: var(--color-accent-purple-400);
--color-code-comments: var(--color-neutrals-opaque-dark-700);
--color-code-error: var(--color-semantic-red-400);
--color-code-functions: var(--color-accent-emerald-400);
--color-text-brand: var(--color-brand-text-dark);
}
/* Internal color system, don't use directly! */
:root {
--color-neutrals-opaque-light-0: #ffffff;
--color-neutrals-opaque-light-50: #f8f9fa;
--color-neutrals-opaque-light-100: #f1f3f5;
--color-neutrals-opaque-light-150: #e9ebef;
--color-neutrals-opaque-light-200: #e1e4e8;
--color-neutrals-opaque-light-250: #d6d9e0;
--color-neutrals-opaque-light-300: #c9cdd4;
--color-neutrals-opaque-light-400: #a2a7b1;
--color-neutrals-opaque-light-500: #7a8190;
--color-neutrals-opaque-light-600: #5a5f6b;
--color-neutrals-opaque-light-700: #3a3f49;
--color-neutrals-opaque-light-800: #1f232b;
--color-neutrals-opaque-light-900: #0b0d12;
--color-neutrals-opaque-dark-0: #00060f;
--color-neutrals-opaque-dark-50: #0a1018;
--color-neutrals-opaque-dark-100: #141a22;
--color-neutrals-opaque-dark-150: #1f242c;
--color-neutrals-opaque-dark-200: #29303a;
--color-neutrals-opaque-dark-250: #33383f;
--color-neutrals-opaque-dark-300: #3d4248;
--color-neutrals-opaque-dark-400: #52565c;
--color-neutrals-opaque-dark-500: #666a6f;
--color-neutrals-opaque-dark-600: #8f9296;
--color-neutrals-opaque-dark-700: #b8babc;
--color-neutrals-opaque-dark-800: #e0e1e2;
--color-neutrals-opaque-dark-900: #ffffff;
--color-neutrals-alpha-light-50: #00060f0a;
--color-neutrals-alpha-light-100: #00060f14;
--color-neutrals-alpha-light-200: #00060f1f;
--color-neutrals-alpha-light-300: #00060f29;
--color-neutrals-alpha-light-400: #00060f3d;
--color-neutrals-alpha-light-500: #00060f52;
--color-neutrals-alpha-light-600: #00060f7a;
--color-neutrals-alpha-light-700: #00060fa3;
--color-neutrals-alpha-light-800: #00060fcc;
--color-neutrals-alpha-light-900: #00060feb;
--color-neutrals-alpha-dark-50: #ffffff0a;
--color-neutrals-alpha-dark-100: #ffffff14;
--color-neutrals-alpha-dark-200: #ffffff1f;
--color-neutrals-alpha-dark-300: #ffffff29;
--color-neutrals-alpha-dark-400: #ffffff3d;
--color-neutrals-alpha-dark-500: #ffffff52;
--color-neutrals-alpha-dark-600: #ffffff7a;
--color-neutrals-alpha-dark-700: #ffffffa3;
--color-neutrals-alpha-dark-800: #ffffffcc;
--color-neutrals-alpha-dark-900: #ffffffeb;
--color-accent-blue-0: #f4f9ff;
--color-accent-blue-100: #d6e9ff;
--color-accent-blue-200: #afcfff;
--color-accent-blue-300: #7fb0ff;
--color-accent-blue-400: #4d94ff;
--color-accent-blue-500: #1c77ff;
--color-accent-blue-600: #165fcc;
--color-accent-blue-700: #104799;
--color-accent-blue-800: #0b3266;
--color-accent-blue-900: #061d33;
--color-accent-green-0: #f7fff2;
--color-accent-green-100: #dffcc6;
--color-accent-green-200: #bef98a;
--color-accent-green-300: #99f24c;
--color-accent-green-400: #73e926;
--color-accent-green-500: #58e600;
--color-accent-green-600: #46ba00;
--color-accent-green-700: #358f00;
--color-accent-green-800: #256400;
--color-accent-green-900: #0a1f00;
--color-accent-cyan-0: #f1fefe;
--color-accent-cyan-100: #ccf9fa;
--color-accent-cyan-200: #99eff0;
--color-accent-cyan-300: #66e5e7;
--color-accent-cyan-400: #33dbde;
--color-accent-cyan-500: #00d4da;
--color-accent-cyan-600: #00a8ae;
--color-accent-cyan-700: #007d82;
--color-accent-cyan-800: #005256;
--color-accent-cyan-900: #00292b;
--color-accent-purple-0: #f7f5ff;
--color-accent-purple-100: #e0daff;
--color-accent-purple-200: #c0b5ff;
--color-accent-purple-300: #a08fff;
--color-accent-purple-400: #8a74fa;
--color-accent-purple-500: #886bf2;
--color-accent-purple-600: #6c54c2;
--color-accent-purple-700: #503f91;
--color-accent-purple-800: #352a61;
--color-accent-purple-900: #1b1530;
--color-accent-pink-0: #fff6ff;
--color-accent-pink-100: #ffedff;
--color-accent-pink-200: #ffdbff;
--color-accent-pink-300: #ffc9ff;
--color-accent-pink-400: #ffb7ff;
--color-accent-pink-500: #ffa5ff;
--color-accent-pink-600: #cc84cc;
--color-accent-pink-700: #996399;
--color-accent-pink-800: #664266;
--color-accent-pink-900: #332133;
--color-accent-emerald-0: #f2fcf9;
--color-accent-emerald-100: #ccf4e4;
--color-accent-emerald-200: #99e9ca;
--color-accent-emerald-300: #66ddb0;
--color-accent-emerald-400: #33d196;
--color-accent-emerald-500: #009f67;
--color-accent-emerald-600: #007f52;
--color-accent-emerald-700: #005f3e;
--color-accent-emerald-800: #004029;
--color-accent-emerald-900: #002015;
--color-accent-citrus-0: #fcfff2;
--color-accent-citrus-100: #f1ffbf;
--color-accent-citrus-200: #e4ff80;
--color-accent-citrus-300: #d6ff40;
--color-accent-citrus-400: #caff20;
--color-accent-citrus-500: #ccff38;
--color-accent-citrus-600: #a4cc2d;
--color-accent-citrus-700: #7c991f;
--color-accent-citrus-800: #536613;
--color-accent-citrus-900: #2b3307;
--color-accent-olive-0: #fafaed;
--color-accent-olive-100: #e6e5ba;
--color-accent-olive-200: #d1cf86;
--color-accent-olive-300: #bdb950;
--color-accent-olive-400: #9e9900;
--color-accent-olive-500: #585600;
--color-accent-olive-600: #464400;
--color-accent-olive-700: #343300;
--color-accent-olive-800: #232200;
--color-accent-olive-900: #111100;
--color-semantic-red-0: #fff5f5;
--color-semantic-red-100: #ffd6d6;
--color-semantic-red-200: #ffafaf;
--color-semantic-red-300: #ff8686;
--color-semantic-red-400: #ff5c5c;
--color-semantic-red-500: #ff4d4f;
--color-semantic-red-600: #cc3e3f;
--color-semantic-red-700: #992f2f;
--color-semantic-red-800: #661f20;
--color-semantic-red-900: #330f10;
--color-semantic-amber-0: #fffdf2;
--color-semantic-amber-100: #fff1b8;
--color-semantic-amber-200: #ffe58f;
--color-semantic-amber-300: #ffd666;
--color-semantic-amber-400: #ffc53d;
--color-semantic-amber-500: #faad14;
--color-semantic-amber-600: #d48806;
--color-semantic-amber-700: #ad6800;
--color-semantic-amber-800: #874d00;
--color-semantic-amber-900: #613400;
--color-semantic-green-0: #f6fff1;
--color-semantic-green-100: #d9f7be;
--color-semantic-green-200: #b7eb8f;
--color-semantic-green-300: #95de64;
--color-semantic-green-400: #73d13d;
--color-semantic-green-500: #52c41a;
--color-semantic-green-600: #3d9914;
--color-semantic-green-700: #2e7010;
--color-semantic-green-800: #1e470a;
--color-semantic-green-900: #0f2305;
--color-semantic-blue-0: #f0f9ff;
--color-semantic-blue-100: #c6e4ff;
--color-semantic-blue-200: #91caff;
--color-semantic-blue-300: #5bafff;
--color-semantic-blue-400: #2896ff;
--color-semantic-blue-500: #1890ff;
--color-semantic-blue-600: #1373cc;
--color-semantic-blue-700: #0e5799;
--color-semantic-blue-800: #093c66;
--color-semantic-blue-900: #051f33;
}
-7
View File
@@ -1,7 +0,0 @@
:root {
--elevation-low: 0 0 48px 0 #000000ee;
}
[data-theme="light"] {
--elevation-low: 0 0 16px 0 #00000022;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-6
View File
@@ -4,12 +4,6 @@
}
:root {
--border-radius-xs: 0.0625rem;
--border-radius-sm: 0.125rem;
--border-radius-md: 0.25rem;
--border-radius-lg: 0.5rem;
--border-radius-full: 99rem;
--scrollbar-width: 0.5rem;
--button-regular-height: 2.5rem;
-188
View File
@@ -1,188 +0,0 @@
/* This is a theme distributed by `starry-night`.
* It’s based on what GitHub uses on their site.
* See <https://github.com/wooorm/starry-night> for more info. */
:root {
--color-prettylights-syntax-comment: #8b949e;
--color-prettylights-syntax-constant: #79c0ff;
--color-prettylights-syntax-entity: #d2a8ff;
--color-prettylights-syntax-storage-modifier-import: #c9d1d9;
--color-prettylights-syntax-entity-tag: #7ee787;
--color-prettylights-syntax-keyword: #ff7b72;
--color-prettylights-syntax-string: #a5d6ff;
--color-prettylights-syntax-variable: #ffa657;
--color-prettylights-syntax-brackethighlighter-unmatched: #f85149;
--color-prettylights-syntax-invalid-illegal-text: #f0f6fc;
--color-prettylights-syntax-invalid-illegal-bg: #8e1519;
--color-prettylights-syntax-carriage-return-text: #f0f6fc;
--color-prettylights-syntax-carriage-return-bg: #b62324;
--color-prettylights-syntax-string-regexp: #7ee787;
--color-prettylights-syntax-markup-list: #f2cc60;
--color-prettylights-syntax-markup-heading: #1f6feb;
--color-prettylights-syntax-markup-italic: #c9d1d9;
--color-prettylights-syntax-markup-bold: #c9d1d9;
--color-prettylights-syntax-markup-deleted-text: #ffdcd7;
--color-prettylights-syntax-markup-deleted-bg: #67060c;
--color-prettylights-syntax-markup-inserted-text: #aff5b4;
--color-prettylights-syntax-markup-inserted-bg: #033a16;
--color-prettylights-syntax-markup-changed-text: #ffdfb6;
--color-prettylights-syntax-markup-changed-bg: #5a1e02;
--color-prettylights-syntax-markup-ignored-text: #c9d1d9;
--color-prettylights-syntax-markup-ignored-bg: #1158c7;
--color-prettylights-syntax-meta-diff-range: #d2a8ff;
--color-prettylights-syntax-brackethighlighter-angle: #8b949e;
--color-prettylights-syntax-sublimelinter-gutter-mark: #484f58;
--color-prettylights-syntax-constant-other-reference-link: #a5d6ff;
}
[data-theme="light"] {
--color-prettylights-syntax-comment: #6e7781;
--color-prettylights-syntax-constant: #0550ae;
--color-prettylights-syntax-entity: #8250df;
--color-prettylights-syntax-storage-modifier-import: #24292f;
--color-prettylights-syntax-entity-tag: #116329;
--color-prettylights-syntax-keyword: #cf222e;
--color-prettylights-syntax-string: #0a3069;
--color-prettylights-syntax-variable: #953800;
--color-prettylights-syntax-brackethighlighter-unmatched: #82071e;
--color-prettylights-syntax-invalid-illegal-text: #f6f8fa;
--color-prettylights-syntax-invalid-illegal-bg: #82071e;
--color-prettylights-syntax-carriage-return-text: #f6f8fa;
--color-prettylights-syntax-carriage-return-bg: #cf222e;
--color-prettylights-syntax-string-regexp: #116329;
--color-prettylights-syntax-markup-list: #3b2300;
--color-prettylights-syntax-markup-heading: #0550ae;
--color-prettylights-syntax-markup-italic: #24292f;
--color-prettylights-syntax-markup-bold: #24292f;
--color-prettylights-syntax-markup-deleted-text: #82071e;
--color-prettylights-syntax-markup-deleted-bg: #ffebe9;
--color-prettylights-syntax-markup-inserted-text: #116329;
--color-prettylights-syntax-markup-inserted-bg: #dafbe1;
--color-prettylights-syntax-markup-changed-text: #953800;
--color-prettylights-syntax-markup-changed-bg: #ffd8b5;
--color-prettylights-syntax-markup-ignored-text: #eaeef2;
--color-prettylights-syntax-markup-ignored-bg: #0550ae;
--color-prettylights-syntax-meta-diff-range: #8250df;
--color-prettylights-syntax-brackethighlighter-angle: #57606a;
--color-prettylights-syntax-sublimelinter-gutter-mark: #8c959f;
--color-prettylights-syntax-constant-other-reference-link: #0a3069;
}
.pl-c {
color: var(--color-prettylights-syntax-comment);
}
.pl-c1,
.pl-s .pl-v {
color: var(--color-prettylights-syntax-constant);
}
.pl-e,
.pl-en {
color: var(--color-prettylights-syntax-entity);
}
.pl-smi,
.pl-s .pl-s1 {
color: var(--color-prettylights-syntax-storage-modifier-import);
}
.pl-ent {
color: var(--color-prettylights-syntax-entity-tag);
}
.pl-k {
color: var(--color-prettylights-syntax-keyword);
}
.pl-s,
.pl-pds,
.pl-s .pl-pse .pl-s1,
.pl-sr,
.pl-sr .pl-cce,
.pl-sr .pl-sre,
.pl-sr .pl-sra {
color: var(--color-prettylights-syntax-string);
}
.pl-v,
.pl-smw {
color: var(--color-prettylights-syntax-variable);
}
.pl-bu {
color: var(--color-prettylights-syntax-brackethighlighter-unmatched);
}
.pl-ii {
color: var(--color-prettylights-syntax-invalid-illegal-text);
background-color: var(--color-prettylights-syntax-invalid-illegal-bg);
}
.pl-c2 {
color: var(--color-prettylights-syntax-carriage-return-text);
background-color: var(--color-prettylights-syntax-carriage-return-bg);
}
.pl-sr .pl-cce {
font-weight: bold;
color: var(--color-prettylights-syntax-string-regexp);
}
.pl-ml {
color: var(--color-prettylights-syntax-markup-list);
}
.pl-mh,
.pl-mh .pl-en,
.pl-ms {
font-weight: bold;
color: var(--color-prettylights-syntax-markup-heading);
}
.pl-mi {
font-style: italic;
color: var(--color-prettylights-syntax-markup-italic);
}
.pl-mb {
font-weight: bold;
color: var(--color-prettylights-syntax-markup-bold);
}
.pl-md {
color: var(--color-prettylights-syntax-markup-deleted-text);
background-color: var(--color-prettylights-syntax-markup-deleted-bg);
}
.pl-mi1 {
color: var(--color-prettylights-syntax-markup-inserted-text);
background-color: var(--color-prettylights-syntax-markup-inserted-bg);
}
.pl-mc {
color: var(--color-prettylights-syntax-markup-changed-text);
background-color: var(--color-prettylights-syntax-markup-changed-bg);
}
.pl-mi2 {
color: var(--color-prettylights-syntax-markup-ignored-text);
background-color: var(--color-prettylights-syntax-markup-ignored-bg);
}
.pl-mdr {
font-weight: bold;
color: var(--color-prettylights-syntax-meta-diff-range);
}
.pl-ba {
color: var(--color-prettylights-syntax-brackethighlighter-angle);
}
.pl-sg {
color: var(--color-prettylights-syntax-sublimelinter-gutter-mark);
}
.pl-corl {
text-decoration: underline;
color: var(--color-prettylights-syntax-constant-other-reference-link);
}
-191
View File
@@ -1,191 +0,0 @@
@font-face {
font-family: "Booton";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("fonts/Booton-Regular.woff2");
}
@font-face {
font-family: "Booton";
font-weight: 468;
font-display: swap;
src: url("fonts/Booton-Medium.woff2");
}
@font-face {
font-family: "Booton";
font-weight: 600;
font-display: swap;
src: url("fonts/Booton-SemiBold.woff2");
}
@font-face {
font-family: "JetBrains Mono";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("fonts/JetBrainsMono-Regular.woff2");
}
@font-face {
font-family: "JetBrains Mono";
font-style: normal;
font-weight: 500;
font-display: swap;
src: url("fonts/JetBrainsMono-Medium.woff2");
}
@font-face {
font-family: "JetBrains Mono";
font-weight: 600;
font-display: swap;
src: url("fonts/JetBrainsMono-SemiBold.woff2");
}
@font-face {
font-family: "JetBrains Mono";
font-weight: 700;
font-display: swap;
src: url("fonts/JetBrainsMono-Bold.woff2");
}
:root {
--txt-heading-xxs: 600 0.75rem/1rem Booton, sans-serif;
--txt-heading-xs: 600 0.875rem/1.25rem Booton, sans-serif;
--txt-heading-s: 600 1rem/1.25rem Booton, sans-serif;
--txt-heading-m: 600 1.125rem/1.25rem Booton, sans-serif;
--txt-heading-l: 600 1.375rem/1.75rem Booton, sans-serif;
--txt-heading-xl: 600 1.75rem/2rem Booton, sans-serif;
--txt-heading-xxl: 600 2rem/2.25rem Booton, sans-serif;
--txt-body-s-regular: 400 0.75rem/1rem Booton, sans-serif;
--txt-body-s-medium: 468 0.75rem/1rem Booton, sans-serif;
--txt-body-s-semibold: 600 0.75rem/1rem Booton, sans-serif;
--txt-body-m-regular: 400 0.875rem/1.25rem Booton, sans-serif;
--txt-body-m-medium: 468 0.875rem/1.25rem Booton, sans-serif;
--txt-body-m-semibold: 600 0.875rem/1.25rem Booton, sans-serif;
--txt-body-l-regular: 400 1rem/1.5rem Booton, sans-serif;
--txt-body-l-medium: 468 1rem/1.5rem Booton, sans-serif;
--txt-body-l-semibold: 600 1rem/1.5rem Booton, sans-serif;
}
[data-codefont="system"] {
--txt-code-small: 400 0.75rem/1rem monospace;
--txt-code-regular: 400 0.875rem/1.25rem monospace;
--txt-code-semibold: 600 0.875rem/1.25rem monospace;
}
[data-codefont="jetbrains"] {
--txt-code-small: 400 0.75rem/1rem "JetBrains Mono", monospace;
--txt-code-regular: 400 0.875rem/1.25rem "JetBrains Mono", monospace;
--txt-code-semibold: 600 0.875rem/1.25rem "JetBrains Mono", monospace;
}
html {
-ms-text-size-adjust: 100%;
-webkit-font-smoothing: antialiased;
-webkit-text-size-adjust: 100%;
font-family: Booton, sans-serif;
/* The root element font size has to be set in px,
* otherwise Safari breaks. */
font-size: 16px;
font-weight: 400;
line-height: 1.25;
}
.txt-heading-xxs {
font: var(--txt-heading-xxs);
}
.txt-heading-xs {
font: var(--txt-heading-xs);
}
.txt-heading-s {
font: var(--txt-heading-s);
}
.txt-heading-m {
font: var(--txt-heading-m);
}
.txt-heading-l {
font: var(--txt-heading-l);
}
.txt-heading-xl {
font: var(--txt-heading-xl);
}
.txt-heading-xxl {
font: var(--txt-heading-xxl);
}
.txt-body-s-regular {
font: var(--txt-body-s-regular);
}
.txt-body-s-medium {
font: var(--txt-body-s-medium);
}
.txt-body-s-semibold {
font: var(--txt-body-s-semibold);
}
.txt-body-m-regular {
font: var(--txt-body-m-regular);
}
.txt-body-m-medium {
font: var(--txt-body-m-medium);
}
.txt-body-m-semibold {
font: var(--txt-body-m-semibold);
}
.txt-body-l-regular {
font: var(--txt-body-l-regular);
}
.txt-body-l-medium {
font: var(--txt-body-l-medium);
}
.txt-body-l-semibold {
font: var(--txt-body-l-semibold);
}
.txt-code-small {
font: var(--txt-code-small);
}
.txt-code-regular {
font: var(--txt-code-regular);
}
.txt-code-semibold {
font: var(--txt-code-semibold);
}
.txt-id {
color: var(--color-text-tertiary);
font: var(--txt-code-regular);
}
.txt-emoji {
height: 1em;
width: 1em;
margin: 0 0.05em 0 0.1em;
vertical-align: -0.1em;
}
.txt-overflow {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
+1 -1
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import UserAvatar from "@app/components/UserAvatar.svelte";
import UserAvatar from "@radicle-gui/ui/components/UserAvatar.svelte";
export let nodeId: string;
export let avatarUrl: string | undefined = undefined;
+1 -1
View File
@@ -2,7 +2,7 @@
import type { BaseUrl } from "@http-client";
import { formatNodeId, parseNodeId, truncateId } from "@app/lib/utils";
import UserAvatar from "./UserAvatar.svelte";
import UserAvatar from "@radicle-gui/ui/components/UserAvatar.svelte";
import Link from "./Link.svelte";
export let baseUrl: BaseUrl;
-33
View File
@@ -1,33 +0,0 @@
<script lang="ts">
import { cachedRepoAvatar } from "@app/lib/avatar";
interface Props {
name: string;
rid: string;
styleWidth: string;
}
const { name, rid, styleWidth }: Props = $props();
let dataUri: string | undefined = $state(undefined);
$effect(() => {
// We strip out characters from the RID that repeat for all RIDs this leads
// to the generated avatars looking nicer visually.
const key = `${name}${rid.replace("rad:z", "")}${name}`;
void cachedRepoAvatar(key).then((data: string) => {
dataUri = data;
});
});
</script>
{#if dataUri}
<img style:width={styleWidth} src={dataUri} alt="Repository Avatar" />
{:else}
<div
style:width={styleWidth}
style:height={styleWidth}
style:background-color="var(--color-surface-subtle)">
</div>
{/if}
+1 -1
View File
@@ -16,7 +16,7 @@
import Icon from "@app/components/Icon.svelte";
import Id from "@app/components/Id.svelte";
import Link from "@app/components/Link.svelte";
import RepoAvatar from "@app/components/RepoAvatar.svelte";
import RepoAvatar from "@radicle-gui/ui/components/RepoAvatar.svelte";
export let compact = false;
export let repoInfo: RepoInfo;
-22
View File
@@ -1,22 +0,0 @@
<script lang="ts">
import { cachedUserAvatar } from "@app/lib/avatar";
interface Props {
nodeId: string;
styleWidth: string;
}
const { nodeId, styleWidth }: Props = $props();
let dataUri: string | undefined = $state(undefined);
$effect(() => {
void cachedUserAvatar(nodeId.replace("did:key:", "")).then(data => {
dataUri = data;
});
});
</script>
{#if dataUri}
<img style:width={styleWidth} src={dataUri} alt="Avatar" />
{/if}
+3 -3
View File
@@ -210,7 +210,7 @@ function createLine(children: ElementContent[], line: number): ElementContent {
type: "element",
tagName: "td",
properties: {
className: "line-number",
className: ["line-number"],
},
children: [
{
@@ -225,14 +225,14 @@ function createLine(children: ElementContent[], line: number): ElementContent {
type: "element",
tagName: "td",
properties: {
className: "line-content",
className: ["line-content"],
},
children: [
{
type: "element",
tagName: "pre",
properties: {
className: "content",
className: ["content"],
},
children,
},
+1 -1
View File
@@ -11,7 +11,7 @@
import Button from "@app/marketing/Button.svelte";
import PlatformBadges from "@app/marketing/PlatformBadges.svelte";
import { renderRepoAvatar } from "@app/lib/avatar";
import { renderRepoAvatar } from "@radicle-gui/ui/lib/avatar";
interface CarouselRepo {
name: string;
+1 -1
View File
@@ -12,7 +12,7 @@
import IconButton from "@app/components/IconButton.svelte";
import Link from "@app/components/Link.svelte";
import Loading from "@app/components/Loading.svelte";
import RepoAvatar from "@app/components/RepoAvatar.svelte";
import RepoAvatar from "@radicle-gui/ui/components/RepoAvatar.svelte";
export let baseUrl: BaseUrl;
export let autofocus = false;
+1 -1
View File
@@ -14,7 +14,7 @@
import ReposView from "./ReposView.svelte";
import NodeAvatar from "@app/components/NodeAvatar.svelte";
import SeedPicker from "@app/views/explore/SeedPicker.svelte";
import UserAvatar from "@app/components/UserAvatar.svelte";
import UserAvatar from "@radicle-gui/ui/components/UserAvatar.svelte";
import PolicyExplainer from "./PolicyExplainer.svelte";
import Seeding from "./Seeding.svelte";
+1 -1
View File
@@ -15,7 +15,7 @@
import SeedPicker from "@app/views/explore/SeedPicker.svelte";
import Separator from "./Separator.svelte";
import NodeAvatar from "@app/components/NodeAvatar.svelte";
import RepoAvatar from "@app/components/RepoAvatar.svelte";
import RepoAvatar from "@radicle-gui/ui/components/RepoAvatar.svelte";
export let activeTab: ActiveTab | undefined = undefined;
export let baseUrl: BaseUrl;
@@ -5,7 +5,7 @@
import HoverPopover from "@app/components/HoverPopover.svelte";
import Link from "@app/components/Link.svelte";
import NodeId from "@app/components/NodeId.svelte";
import UserAvatar from "@app/components/UserAvatar.svelte";
import UserAvatar from "@radicle-gui/ui/components/UserAvatar.svelte";
export let baseUrl: BaseUrl;
@@ -26,7 +26,7 @@
import Peer from "./PeerBranchSelector/Peer.svelte";
import Popover from "@app/components/Popover.svelte";
import TextInput from "@app/components/TextInput.svelte";
import UserAvatar from "@app/components/UserAvatar.svelte";
import UserAvatar from "@radicle-gui/ui/components/UserAvatar.svelte";
export let baseRoute: Extract<
RepoRoute,
@@ -10,7 +10,7 @@
import Icon from "@app/components/Icon.svelte";
import Id from "@app/components/Id.svelte";
import Link from "@app/components/Link.svelte";
import RepoAvatar from "@app/components/RepoAvatar.svelte";
import RepoAvatar from "@radicle-gui/ui/components/RepoAvatar.svelte";
export let repo: Repo;
export let repoId: string;
@@ -87,6 +87,7 @@
}
.avatar :global(img) {
width: 4rem !important;
height: 4rem !important;
}
.meta {
flex-basis: 0;
+1 -1
View File
@@ -15,7 +15,7 @@
import SeedPicker from "@app/views/explore/SeedPicker.svelte";
import Separator from "@app/views/repos/Separator.svelte";
import UserAddress from "@app/views/users/UserAddress.svelte";
import UserAvatar from "@app/components/UserAvatar.svelte";
import UserAvatar from "@radicle-gui/ui/components/UserAvatar.svelte";
import UserReposView from "./UserReposView.svelte";
export let baseUrl: BaseUrl;
+3
View File
@@ -3,6 +3,8 @@ import path from "node:path";
import { defineConfig } from "vitest/config";
import { svelte } from "@sveltejs/vite-plugin-svelte";
import { sharedPublic } from "@radicle-gui/ui/vite";
import { assets } from "./vite-plugin-assets.ts";
export default defineConfig({
@@ -16,6 +18,7 @@ export default defineConfig({
},
plugins: [
assets(),
sharedPublic(),
svelte({
extensions: [".svelte", ".md"],
// Reference: https://github.com/sveltejs/vite-plugin-svelte/issues/270#issuecomment-1033190138
File diff suppressed because it is too large Load Diff
+19
View File
@@ -0,0 +1,19 @@
{
"name": "radicle-gui",
"private": true,
"workspaces": [
"shared/ui",
"explorer",
"desktop"
],
"engines": {
"node": ">=24",
"npm": ">=11.16"
},
"overrides": {
"katex": "^0.18.9"
},
"allowScripts": {
"fsevents": false
}
}
+8
View File
@@ -0,0 +1,8 @@
{
"arrowParens": "avoid",
"plugins": ["prettier-plugin-svelte"],
"svelteSortOrder": "options-scripts-styles-markup",
"bracketSameLine": true,
"proseWrap": "never",
"htmlWhitespaceSensitivity": "ignore"
}
@@ -1,5 +1,5 @@
<script lang="ts">
import { cachedRepoAvatar } from "@app/lib/avatar";
import { cachedRepoAvatar } from "../lib/avatar";
interface Props {
name: string;
@@ -1,5 +1,5 @@
<script lang="ts">
import { cachedUserAvatar } from "@app/lib/avatar";
import { cachedUserAvatar } from "../lib/avatar";
interface Props {
nodeId: string;
+166
View File
@@ -0,0 +1,166 @@
import globals from "globals";
import js from "@eslint/js";
import prettier from "eslint-config-prettier";
import svelte from "eslint-plugin-svelte";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import svelteParser from "svelte-eslint-parser";
import ts from "typescript-eslint";
// Browser globals that are easy to use by accident in place of a local
// variable of the same name.
export const restrictedGlobals = [
"name",
"event",
"frames",
"history",
"length",
"content",
"origin",
"status",
];
// The ESLint config shared by shared/ui and desktop. `rootDir` is the
// directory of the caller's tsconfig.json, `importGroups` are extra
// simple-import-sort groups placed before relative imports, and `ignores` are
// the caller's ignored paths.
export function radicleConfig({ rootDir, importGroups = [], ignores = [] }) {
return [
...[
js.configs.recommended,
...ts.configs.recommended,
prettier,
{
plugins: {
"simple-import-sort": simpleImportSort,
},
languageOptions: {
parser: ts.parser,
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: rootDir,
extraFileExtensions: [".svelte", ".svelte.ts"],
},
globals: { ...globals.browser, ...globals.node },
},
rules: {
"no-implicit-globals": "error",
"no-restricted-globals": ["error", ...restrictedGlobals],
// Require using arrow functions as callbacks.
// https://eslint.org/docs/rules/prefer-arrow-callback
"prefer-arrow-callback": "warn",
// Require using const for variables that are never modified after declared.
// https://eslint.org/docs/rules/prefer-const
"prefer-const": "warn",
// Disallow modifying variables that are declared using const.
// https://eslint.org/docs/rules/no-const-assign
"no-const-assign": "error",
// Require let or const instead of var.
// https://eslint.org/docs/rules/no-var
"no-var": "warn",
"simple-import-sort/imports": [
"warn",
{
groups: [
// Type imports
["\\u0000$"],
// Node.js built-in modules
["^node:"],
// Everything not matched, aka third party packages
["^"],
...importGroups,
// Everything else imported through relative imports
["^\\."],
],
},
],
// Require `===` and `!==` comparisons.
eqeqeq: "warn",
"@typescript-eslint/no-floating-promises": "warn",
"@typescript-eslint/no-empty-function": "warn",
"@typescript-eslint/naming-convention": [
"warn",
{
selector: "enumMember",
format: ["PascalCase"],
},
{
selector: "objectLiteralProperty",
format: ["PascalCase", "camelCase"],
},
{
selector: "default",
format: ["camelCase"],
leadingUnderscore: "allow",
trailingUnderscore: "allow",
},
{
selector: "variable",
modifiers: ["const"],
format: ["camelCase", "PascalCase", "UPPER_CASE"],
leadingUnderscore: "allow",
trailingUnderscore: "allow",
},
{
selector: "typeLike",
format: ["PascalCase"],
},
// Disable @typescript-eslint/naming-convention format for imports
// https://github.com/typescript-eslint/typescript-eslint/pull/7269#issuecomment-1777628591
// https://github.com/typescript-eslint/typescript-eslint/issues/7892
{ selector: "import", format: null },
{
selector: ["objectLiteralProperty"],
modifiers: ["requiresQuotes"],
format: null,
},
],
"@typescript-eslint/no-namespace": [
"error",
{ allowDeclarations: true },
],
"@typescript-eslint/member-ordering": [
"warn",
{ default: ["field", "signature", "constructor", "method"] },
],
// Allow explicit type annotations for additional clarity.
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-invalid-void-type": ["warn"],
// Disallow Unused Variables.
// https://eslint.org/docs/rules/no-unused-vars
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_" },
],
},
},
].map(conf => ({
...conf,
linterOptions: {
reportUnusedDisableDirectives: "error",
},
files: ["**/*.js", "**/*.ts", "**/*.svelte"],
})),
...svelte.configs["flat/recommended"],
...svelte.configs["flat/prettier"],
{
files: ["*.svelte", "**/*.svelte", "**/*.svelte.ts"],
languageOptions: {
parser: svelteParser,
parserOptions: {
parser: ts.parser,
project: "./tsconfig.json",
tsconfigRootDir: rootDir,
svelteFeatures: {
experimentalGenerics: true,
},
},
},
rules: {
"svelte/require-each-key": "off",
"svelte/no-at-html-tags": "off",
"@typescript-eslint/no-explicit-any": "error",
},
},
{ ignores },
];
}
+46
View File
@@ -0,0 +1,46 @@
import { radicleConfig, restrictedGlobals } from "./eslint.base.js";
// Shared components get their data from props and report changes through
// callbacks; the apps own all I/O and navigation.
const sideEffects = ["fetch", "localStorage", "sessionStorage", "location"];
export default [
...radicleConfig({
rootDir: import.meta.dirname,
ignores: ["node_modules/**/*", "eslint.config.js", "eslint.base.js"],
}),
{
files: ["**/*.js", "**/*.ts", "**/*.svelte"],
rules: {
"no-restricted-globals": ["error", ...restrictedGlobals, ...sideEffects],
"no-restricted-properties": [
"error",
...["window", "globalThis", "self"].flatMap(object =>
sideEffects.map(property => ({ object, property })),
),
],
"no-restricted-imports": [
"error",
{
patterns: [
{
group: [
"@app/*",
"@bindings/*",
"@http-client",
"@http-client/*",
"@tauri-apps/*",
],
message:
"Shared code can't depend on either app; take the data as props instead.",
},
{
group: ["../../*"],
message: "Shared code can't import from outside shared/ui.",
},
],
},
],
},
},
];
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { cached } from "@app/lib/cache";
import { cached } from "./cached";
type AtomType = "A" | "B" | "C" | "D";
type ShapeModel =
+43
View File
@@ -0,0 +1,43 @@
{
"name": "@radicle-gui/ui",
"private": true,
"version": "0.0.0",
"type": "module",
"exports": {
"./components/*": "./components/*",
"./lib/*": "./lib/*.ts",
"./vite": "./vite.ts",
"./eslint": "./eslint.base.js"
},
"scripts": {
"check": "svelte-check --tsconfig tsconfig.json --fail-on-warnings && eslint --max-warnings 0 . && prettier '**/*.@(ts|js|svelte|json|css)' --check",
"format": "prettier '**/*.@(ts|js|svelte|json|css)' --write && eslint --fix .",
"test:unit": "TZ='UTC' vitest run"
},
"peerDependencies": {
"svelte": "^5.56.6"
},
"dependencies": {
"lru-cache": "^11.5.2"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@sveltejs/vite-plugin-svelte": "^7.2.0",
"@tsconfig/svelte": "^5.0.8",
"@types/node": "^24",
"eslint": "^10.7.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-simple-import-sort": "^14.0.0",
"eslint-plugin-svelte": "^3.22.0",
"globals": "^17.7.0",
"prettier": "^3.9.5",
"prettier-plugin-svelte": "^4.1.1",
"svelte": "^5.56.6",
"svelte-check": "^4.7.3",
"svelte-eslint-parser": "^1.8.0",
"typescript": "^6.0.3",
"typescript-eslint": "^8.64.0",
"vite": "^8.1.5",
"vitest": "^4.1.12"
}
}
+13
View File
@@ -0,0 +1,13 @@
:root {
--border-radius-xs: 0.0625rem;
--border-radius-sm: 0.125rem;
--border-radius-md: 0.25rem;
--border-radius-lg: 0.5rem;
--border-radius-full: 99rem;
--elevation-low: 0 0 48px 0 #000000ee;
}
[data-theme="light"] {
--elevation-low: 0 0 16px 0 #00000022;
}
+5
View File
@@ -0,0 +1,5 @@
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
export default {
preprocess: vitePreprocess(),
};
@@ -1,6 +1,6 @@
import { describe, expect, test, vi } from "vitest";
import { cached } from "@app/lib/cached";
import { cached } from "../lib/cached";
describe("cached", () => {
test("returns the cached result for the same key", async () => {
+21
View File
@@ -0,0 +1,21 @@
{
"extends": "@tsconfig/svelte/tsconfig.json",
"include": ["."],
"exclude": ["node_modules/*"],
"compilerOptions": {
"noEmit": true,
"target": "es2024",
"module": "es2022",
"types": ["vite/client"],
"sourceMap": true,
"moduleResolution": "bundler",
"strict": true,
"resolveJsonModule": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"useDefineForClassFields": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true
}
}
+10
View File
@@ -0,0 +1,10 @@
import { svelte } from "@sveltejs/vite-plugin-svelte";
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
include: ["tests/**/*.test.ts"],
reporters: "verbose",
},
plugins: [svelte()],
});
+92
View File
@@ -0,0 +1,92 @@
import type { Plugin } from "vite";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const publicDir = path.join(
path.dirname(fileURLToPath(import.meta.url)),
"public",
);
const contentTypes: Record<string, string> = {
".css": "text/css",
".woff2": "font/woff2",
};
// Maps each file's URL path, such as `/fonts/Booton-Regular.woff2`, to its
// location on disk.
function publicFiles(): Map<string, string> {
return new Map(
fs
.readdirSync(publicDir, { recursive: true, withFileTypes: true })
.filter(entry => entry.isFile())
.map(entry => {
const file = path.join(entry.parentPath, entry.name);
const url = path.relative(publicDir, file).split(path.sep).join("/");
return [`/${url}`, file];
}),
);
}
// Serves shared/ui/public at the root URL, next to the app's own public
// directory: from disk in dev, and copied into the build. An app's public
// directory must not contain files at the same paths; the build fails if it
// does.
export function sharedPublic(): Plugin {
let files = publicFiles();
return {
name: "shared-public",
configResolved(config) {
const collisions = [...files.keys()].filter(url =>
fs.existsSync(path.join(config.publicDir, url)),
);
if (collisions.length > 0) {
throw new Error(
`${config.publicDir} contains files that shared/ui/public also ` +
`serves: ${collisions.join(", ")}`,
);
}
},
configureServer(server) {
server.middlewares.use((req, res, next) => {
let file;
try {
const { pathname } = new URL(req.url ?? "/", "http://localhost");
file = files.get(decodeURIComponent(pathname));
} catch {
// A malformed URL is never one of ours.
}
if (!file) {
next();
return;
}
res.setHeader(
"Content-Type",
contentTypes[path.extname(file)] ?? "application/octet-stream",
);
fs.createReadStream(file).pipe(res);
});
server.watcher.add(publicDir);
server.watcher.on("all", (event, file) => {
if (!file.startsWith(publicDir + path.sep)) {
return;
}
if (event === "add" || event === "unlink") {
files = publicFiles();
}
server.ws.send({ type: "full-reload" });
});
},
generateBundle() {
for (const [url, file] of files) {
this.emitFile({
type: "asset",
fileName: url.slice(1),
source: fs.readFileSync(file),
});
}
},
};
}