@mogba/nexus-tokens 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs ADDED
@@ -0,0 +1,14 @@
1
+ const values = require("./values.json");
2
+
3
+ exports.nexusColors = Object.freeze({
4
+ backgroundPrimary: values["background-primary"],
5
+ backgroundSecondary: values["background-secondary"],
6
+ surfaceLight: values["surface-light"],
7
+ surfaceDark: values["surface-dark"],
8
+ borderLight: values["border-light"],
9
+ borderDark: values["border-dark"],
10
+ textPrimary: values["text-primary"],
11
+ textSecondary: values["text-secondary"],
12
+ textInverse: values["text-inverse"],
13
+ accentPrimary: values["accent-primary"],
14
+ });
package/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ export declare const nexusColors: {
2
+ readonly backgroundPrimary: string;
3
+ readonly backgroundSecondary: string;
4
+ readonly surfaceLight: string;
5
+ readonly surfaceDark: string;
6
+ readonly borderLight: string;
7
+ readonly borderDark: string;
8
+ readonly textPrimary: string;
9
+ readonly textSecondary: string;
10
+ readonly textInverse: string;
11
+ readonly accentPrimary: string;
12
+ };
package/package.json CHANGED
@@ -1,6 +1,35 @@
1
1
  {
2
2
  "name": "@mogba/nexus-tokens",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Shared Nexus design tokens and adoption command",
5
+ "license": "UNLICENSED",
6
+ "main": "./index.cjs",
7
+ "types": "./index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./index.d.ts",
11
+ "default": "./index.cjs"
12
+ },
13
+ "./styles": "./styles.css",
14
+ "./tailwind-preset": "./tailwind.preset.cjs"
15
+ },
16
+ "bin": {
17
+ "nexus-setup": "./setup.cjs"
18
+ },
19
+ "files": [
20
+ "index.cjs",
21
+ "index.d.ts",
22
+ "values.json",
23
+ "styles.css",
24
+ "tailwind.preset.cjs",
25
+ "setup.cjs",
26
+ "skill"
27
+ ],
28
+ "scripts": {
29
+ "build": "node build.cjs"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public",
33
+ "registry": "https://registry.npmjs.org/"
34
+ }
35
+ }
package/setup.cjs ADDED
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env node
2
+ const { execFileSync } = require("node:child_process");
3
+ const { cpSync, existsSync, mkdirSync, readFileSync, writeFileSync } = require("node:fs");
4
+ const { dirname, join, resolve } = require("node:path");
5
+ const { parseArgs } = require("node:util");
6
+ const { version } = require("./package.json");
7
+
8
+ const usage = "nexus-setup <web|nativewind|native> [--app path] [--no-install] [--cursor]";
9
+ const { positionals: [platform, ...extra], values } = parseArgs({
10
+ allowPositionals: true,
11
+ options: {
12
+ app: { type: "string", default: "." },
13
+ "no-install": { type: "boolean" },
14
+ cursor: { type: "boolean" },
15
+ help: { type: "boolean" },
16
+ },
17
+ });
18
+ if (values.help) {
19
+ console.log(usage);
20
+ process.exit(0);
21
+ }
22
+
23
+ const packages = { web: ["ui"], nativewind: ["ui-native"], native: [] };
24
+ if (!Object.hasOwn(packages, platform) || extra.length) throw new Error(usage);
25
+ const app = resolve(values.app);
26
+ if (!existsSync(join(app, "package.json"))) throw new Error("Point --app to an existing app package.");
27
+
28
+ let root = app;
29
+ while (!existsSync(join(root, ".git")) && !existsSync(join(root, "pnpm-workspace.yaml"))) {
30
+ const parent = dirname(root);
31
+ if (parent === root) { root = app; break; }
32
+ root = parent;
33
+ }
34
+
35
+ const skill = join(root, ".agents/skills/nexus-design");
36
+ const marker = join(skill, ".nexus-managed");
37
+ if (existsSync(skill) && !existsSync(marker)) throw new Error(`Existing custom skill at ${skill}`);
38
+
39
+ const agents = join(root, "AGENTS.md");
40
+ const current = existsSync(agents) ? readFileSync(agents, "utf8") : "# Project instructions\n";
41
+ const start = "<!-- nexus-design:start -->";
42
+ const end = "<!-- nexus-design:end -->";
43
+ const section = [
44
+ start,
45
+ "## Nexus design system",
46
+ "",
47
+ "For UI work, follow the [Nexus design skill](.agents/skills/nexus-design/SKILL.md).",
48
+ "Use the Nexus packages already configured for the target app. Keep project-specific rules in this file.",
49
+ end,
50
+ ].join("\n");
51
+ const from = current.indexOf(start);
52
+ const to = current.indexOf(end);
53
+ if ((from === -1) !== (to === -1) || to < from) throw new Error("Invalid Nexus section markers in AGENTS.md");
54
+
55
+ if (!values["no-install"]) {
56
+ const manager = JSON.parse(readFileSync(join(root, "package.json"), "utf8")).packageManager?.split("@")[0]
57
+ ?? (existsSync(join(root, "pnpm-lock.yaml")) ? "pnpm"
58
+ : existsSync(join(root, "yarn.lock")) ? "yarn"
59
+ : (existsSync(join(root, "bun.lock")) || existsSync(join(root, "bun.lockb"))) ? "bun" : "npm");
60
+ execFileSync(manager, [
61
+ manager === "npm" ? "install" : "add",
62
+ ...["tokens", ...packages[platform]].map(name => `@mogba/nexus-${name}@${version}`),
63
+ ], { cwd: app, stdio: "inherit" });
64
+ }
65
+
66
+ mkdirSync(skill, { recursive: true });
67
+ cpSync(join(__dirname, "skill"), skill, { recursive: true });
68
+ writeFileSync(marker, `${version}\n`);
69
+ writeFileSync(agents, from === -1
70
+ ? `${current.trimEnd()}\n\n${section}\n`
71
+ : current.slice(0, from) + section + current.slice(to + end.length));
72
+ if (values.cursor) {
73
+ const rule = join(root, ".cursor/rules/nexus-design.mdc");
74
+ if (!existsSync(rule)) {
75
+ mkdirSync(dirname(rule), { recursive: true });
76
+ writeFileSync(rule, '---\ndescription: Use for Nexus UI design and implementation\nalwaysApply: false\n---\nRead .agents/skills/nexus-design/SKILL.md and the platform instructions linked there.\n');
77
+ }
78
+ }
79
+ console.log(`Nexus design instructions installed in ${root}. Follow the ${platform} section in .agents/skills/nexus-design/references/integration.md.`);
package/skill/SKILL.md ADDED
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: nexus-design
3
+ description: Use when designing, implementing, or reviewing screens and reusable UI in a project that adopts the Nexus design language on React web or React Native.
4
+ ---
5
+
6
+ Read [design-system.md](references/design-system.md) for the visual rules. Choose archive mode for dense discovery, editorial mode for one prominent focal point, or hybrid mode for a structured grid with prominent editorial blocks.
7
+
8
+ For a new screen, state its goal, chosen mode, hierarchy, existing components, and responsive behavior before coding. Check the app’s AGENTS.md for approval and implementation rules.
9
+
10
+ Inspect the installed package exports. Compose primitives into cards, sections, and templates. Use the app’s existing tokens and components first. Read [frontend-implementation.md](references/frontend-implementation.md) for composition constraints and [integration.md](references/integration.md) when setting up or changing the platform configuration.
11
+
12
+ Use [new-page.md](references/new-page.md) and [new-component.md](references/new-component.md) as task briefs when starting either kind of work.
@@ -0,0 +1,93 @@
1
+ # Design system
2
+
3
+ You are designing interfaces with a hybrid visual language inspired by:
4
+ - Are.na's raw, modular, exploratory structure
5
+ - GOAT's premium, editorial, image-led polish
6
+
7
+ Design principles:
8
+ - content is the hero
9
+ - structure is strict
10
+ - visuals are calm, sharp, and curated
11
+ - UI chrome stays restrained
12
+ - use strong hierarchy and generous whitespace
13
+ - favor modular cards, collections, and immersive detail views
14
+ - favor editorial composition over generic SaaS layouts
15
+
16
+ Visual rules:
17
+ - neutral palette first
18
+ - black, white, soft gray, and one restrained accent
19
+ - crisp sans-serif UI typography
20
+ - optional editorial display typography for hero moments
21
+ - thin borders
22
+ - subtle shadows only when useful
23
+ - sharp or slightly rounded corners
24
+ - minimal visual noise
25
+
26
+ Interaction rules:
27
+ - subtle motion
28
+ - slight scale on hover
29
+ - soft fade and slide transitions
30
+ - premium and calm state changes
31
+
32
+ This design taste is applied across three layout modes in a hybrid design system:
33
+
34
+ 1. archive mode
35
+ - dense modular exploration
36
+ - mixed card sizes
37
+ - quiet metadata
38
+ - scrolling discovery
39
+
40
+ 2. editorial mode
41
+ - oversized hero media
42
+ - fewer competing elements
43
+ - generous whitespace
44
+ - strong focal point
45
+
46
+ 3. hybrid mode
47
+ - structured grid base
48
+ - one or two oversized focal blocks
49
+ - mix of dense and spacious sections
50
+
51
+ Design tokens:
52
+ - background-primary: #FFFFFF
53
+ - background-secondary: #0B0B0B
54
+ - surface-light: #F5F5F3
55
+ - surface-dark: #121212
56
+ - border-light: rgba(0,0,0,0.08)
57
+ - border-dark: rgba(255,255,255,0.12)
58
+ - text-primary: #111111
59
+ - text-secondary: #5F5F5F
60
+ - text-inverse: #FFFFFF
61
+ - accent-primary: #6E56CF
62
+
63
+ Typography:
64
+ - UI font: Inter, SF Pro, or system sans-serif
65
+ - Display font: refined serif or grotesk for hero moments only
66
+
67
+ Type scale:
68
+ - xs: 12px
69
+ - sm: 14px
70
+ - md: 16px
71
+ - lg: 20px
72
+ - xl: 28px
73
+ - 2xl: 40px
74
+ - 3xl: 56px
75
+
76
+ Spacing scale:
77
+ - 4, 8, 12, 16, 24, 32, 48, 64, 96
78
+
79
+ Component rules:
80
+ - cards are the main primitive
81
+ - use image, text, mixed, and collection card variants
82
+ - navigation is text-first and visually quiet
83
+ - buttons are ghost by default
84
+ - filled buttons are reserved for rare high-priority actions
85
+ - metadata remains secondary
86
+ - detail pages should feel immersive and focused
87
+
88
+ Code expectations:
89
+ - build reusable components
90
+ - separate primitives from composed sections
91
+ - avoid ad hoc styles
92
+ - keep layout grid-driven
93
+ - default to accessible HTML and predictable Tailwind classes---
@@ -0,0 +1,10 @@
1
+ # Frontend implementation
2
+
3
+ When implementing UI:
4
+ - prefer existing components over duplication
5
+ - keep props small and explicit
6
+ - extract repeated layout patterns
7
+ - keep Tailwind class organization readable
8
+ - maintain accessible semantics
9
+ - support mobile and desktop from the start
10
+ - keep business logic outside presentation components
@@ -0,0 +1,47 @@
1
+ # Platform integration
2
+
3
+ ## web
4
+
5
+ Import `@mogba/nexus-tokens/styles` once in the app’s root CSS entry or layout. Import React components from `@mogba/nexus-ui`.
6
+
7
+ **Vite / Tailwind 3.** Add `require("@mogba/nexus-tokens/tailwind-preset")` to your existing Tailwind presets. Add this to the existing content array:
8
+
9
+ ```js
10
+ path.join(path.dirname(require.resolve("@mogba/nexus-ui")), "**/*.js")
11
+ ```
12
+
13
+ **Create T3 App / Next.js with Tailwind 4.** Add a `tailwind.config.cjs` at the app root with `module.exports = { presets: [require("@mogba/nexus-tokens/tailwind-preset")] };` (merge into an existing config if present). For a stylesheet at `src/styles/globals.css`, keep the existing Tailwind import and add:
14
+
15
+ ```css
16
+ @import "tailwindcss";
17
+ @import "@mogba/nexus-tokens/styles";
18
+ @config "../../tailwind.config.cjs";
19
+ @source "../../node_modules/@mogba/nexus-ui/dist";
20
+ ```
21
+
22
+ Adapt the relative paths to the stylesheet’s actual location. Keep existing app CSS. Under the Next.js App Router, interactive components belong inside a client boundary when passing event handlers.
23
+
24
+ ## nativewind
25
+
26
+ Install NativeWind v4 and its platform prerequisites using the app’s existing Expo/Metro setup. Add the Nexus Tailwind preset after `nativewind/preset`; keep your existing app globs and append:
27
+
28
+ ```js
29
+ path.join(path.dirname(require.resolve("@mogba/nexus-ui-native")), "**/*.{ts,tsx}")
30
+ ```
31
+
32
+ In the existing NativeWind CSS entry, put `@import "@mogba/nexus-tokens/styles";` above the Tailwind directives. Keep the existing Babel config and global CSS import. Import components from `@mogba/nexus-ui-native`. Its React Native and NativeWind peers must be installed in the app; check its manifest for peer versions.
33
+
34
+ ## native
35
+
36
+ For bare React Native, including Samantha’s macOS target, use `@mogba/nexus-tokens` directly in `StyleSheet.create`. It exports plain color strings and does not require Tailwind, Metro changes, or Expo.
37
+
38
+ ```tsx
39
+ import { nexusColors } from "@mogba/nexus-tokens";
40
+
41
+ const styles = StyleSheet.create({
42
+ panel: { backgroundColor: nexusColors.surfaceLight },
43
+ title: { color: nexusColors.textPrimary },
44
+ });
45
+ ```
46
+
47
+ Keep platform-specific interaction, native bridges, and application styles in the app.
@@ -0,0 +1,12 @@
1
+ Create a reusable component for this design system.
2
+
3
+ Component:
4
+ [card / hero / nav / collection rail / filter bar / detail header]
5
+
6
+ Requirements:
7
+ - align with the repo design system
8
+ - use calm, sharp styling
9
+ - keep metadata visually secondary
10
+ - keep the API clean and reusable
11
+ - include responsive behavior
12
+ - include example usage
@@ -0,0 +1,21 @@
1
+ Design and implement a [homepage / collection page / detail page / mobile screen] for this project.
2
+
3
+ Use the repo design system:
4
+ - Are.na x GOAT hybrid
5
+ - content-first
6
+ - restrained UI chrome
7
+ - strong hierarchy
8
+ - premium editorial spacing
9
+ - modular cards
10
+
11
+ Choose the best layout mode:
12
+ - archive
13
+ - editorial
14
+ - hybrid
15
+
16
+ Before coding:
17
+ 1. explain the chosen layout mode
18
+ 2. outline the page structure
19
+ 3. list components to reuse or create
20
+
21
+ Then implement in the project’s configured React stack with reusable components.
package/styles.css ADDED
@@ -0,0 +1,20 @@
1
+ :root {
2
+ --nexus-background-primary: #ffffff;
3
+ --nexus-background-secondary: #0b0b0b;
4
+ --nexus-surface-light: #f5f5f3;
5
+ --nexus-surface-dark: #121212;
6
+ --nexus-border-light: rgba(0, 0, 0, 0.08);
7
+ --nexus-border-dark: rgba(255, 255, 255, 0.12);
8
+ --nexus-text-primary: #111111;
9
+ --nexus-text-secondary: #5f5f5f;
10
+ --nexus-text-inverse: #ffffff;
11
+ --nexus-accent-primary: #6e56cf;
12
+ --nexus-radius-sm: 2px;
13
+ --nexus-radius-md: 4px;
14
+ --nexus-radius-lg: 8px;
15
+ --nexus-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04);
16
+ --nexus-shadow-card-hover: 0 4px 24px rgba(0, 0, 0, 0.06);
17
+ --nexus-font-ui: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
18
+ "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
19
+ --nexus-font-display: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
20
+ }
@@ -0,0 +1,50 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ module.exports = {
3
+ theme: {
4
+ extend: {
5
+ colors: {
6
+ nexus: {
7
+ bg: "var(--nexus-background-primary)",
8
+ "bg-secondary": "var(--nexus-background-secondary)",
9
+ surface: "var(--nexus-surface-light)",
10
+ "surface-dark": "var(--nexus-surface-dark)",
11
+ border: "var(--nexus-border-light)",
12
+ "border-dark": "var(--nexus-border-dark)",
13
+ foreground: "var(--nexus-text-primary)",
14
+ muted: "var(--nexus-text-secondary)",
15
+ inverse: "var(--nexus-text-inverse)",
16
+ accent: "var(--nexus-accent-primary)",
17
+ },
18
+ },
19
+ fontFamily: {
20
+ sans: ["var(--nexus-font-ui)", "ui-sans-serif", "system-ui", "sans-serif"],
21
+ display: ["var(--nexus-font-display)", "ui-serif", "Georgia", "serif"],
22
+ },
23
+ fontSize: {
24
+ xs: ["12px", { lineHeight: "1.5" }],
25
+ sm: ["14px", { lineHeight: "1.5" }],
26
+ md: ["16px", { lineHeight: "1.55" }],
27
+ lg: ["20px", { lineHeight: "1.4" }],
28
+ xl: ["28px", { lineHeight: "1.25" }],
29
+ "2xl": ["40px", { lineHeight: "1.15" }],
30
+ "3xl": ["56px", { lineHeight: "1.05" }],
31
+ },
32
+ borderRadius: {
33
+ nexus: "var(--nexus-radius-md)",
34
+ "nexus-sm": "var(--nexus-radius-sm)",
35
+ "nexus-lg": "var(--nexus-radius-lg)",
36
+ },
37
+ boxShadow: {
38
+ card: "var(--nexus-shadow-card)",
39
+ "card-hover": "var(--nexus-shadow-card-hover)",
40
+ },
41
+ transitionDuration: {
42
+ DEFAULT: "200ms",
43
+ },
44
+ transitionTimingFunction: {
45
+ "nexus-out": "cubic-bezier(0.33, 1, 0.68, 1)",
46
+ },
47
+ },
48
+ },
49
+ };
50
+
package/values.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "background-primary": "#ffffff",
3
+ "background-secondary": "#0b0b0b",
4
+ "surface-light": "#f5f5f3",
5
+ "surface-dark": "#121212",
6
+ "border-light": "rgba(0, 0, 0, 0.08)",
7
+ "border-dark": "rgba(255, 255, 255, 0.12)",
8
+ "text-primary": "#111111",
9
+ "text-secondary": "#5f5f5f",
10
+ "text-inverse": "#ffffff",
11
+ "accent-primary": "#6e56cf",
12
+ "radius-sm": "2px",
13
+ "radius-md": "4px",
14
+ "radius-lg": "8px",
15
+ "shadow-card": "0 1px 2px rgba(0, 0, 0, 0.04)",
16
+ "shadow-card-hover": "0 4px 24px rgba(0, 0, 0, 0.06)",
17
+ "font-ui": "ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,\n \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif",
18
+ "font-display": "ui-serif, Georgia, Cambria, \"Times New Roman\", Times, serif"
19
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.