@texturehq/edges 0.0.15 → 0.0.19
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/README.md +71 -57
- package/dist/components.manifest.json +5 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +534 -300
- package/dist/index.d.ts +534 -300
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/styles.css +709 -421
- package/dist/theme.css +88 -3
- package/package.json +15 -5
- package/scripts/generate-components-manifest.js +154 -0
- package/scripts/setup-cursor-rules-manual.js +167 -0
- package/scripts/setup-cursor-rules.js +113 -0
- package/scripts/setup-cursor-rules.sh +95 -0
- package/templates/cursor-rules/edges-usage.mdc +65 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// scripts/setup-cursor-rules.js
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
|
|
5
|
+
const setupCursorRules = () => {
|
|
6
|
+
const cwd = process.cwd();
|
|
7
|
+
|
|
8
|
+
// Don't run in the package itself
|
|
9
|
+
if (cwd.includes('mono/packages/edges')) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const templatesDir = path.join(__dirname, '../templates/cursor-rules');
|
|
14
|
+
const cursorDir = path.join(cwd, '.cursor');
|
|
15
|
+
const rulesDir = path.join(cursorDir, 'rules');
|
|
16
|
+
|
|
17
|
+
// Create directories if they don't exist
|
|
18
|
+
if (!fs.existsSync(cursorDir)) {
|
|
19
|
+
fs.mkdirSync(cursorDir);
|
|
20
|
+
}
|
|
21
|
+
if (!fs.existsSync(rulesDir)) {
|
|
22
|
+
fs.mkdirSync(rulesDir);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Check if templates directory exists
|
|
26
|
+
if (!fs.existsSync(templatesDir)) {
|
|
27
|
+
console.log('⚠️ No cursor rules templates found');
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Copy all .mdc files from templates to the project's cursor rules
|
|
32
|
+
const templateFiles = fs.readdirSync(templatesDir).filter(file => file.endsWith('.mdc'));
|
|
33
|
+
|
|
34
|
+
if (templateFiles.length === 0) {
|
|
35
|
+
console.log('⚠️ No .mdc files found in templates directory');
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let copiedCount = 0;
|
|
40
|
+
|
|
41
|
+
templateFiles.forEach(file => {
|
|
42
|
+
const templatePath = path.join(templatesDir, file);
|
|
43
|
+
const targetPath = path.join(rulesDir, file);
|
|
44
|
+
|
|
45
|
+
// Only copy if the target doesn't already exist
|
|
46
|
+
if (!fs.existsSync(targetPath)) {
|
|
47
|
+
fs.copyFileSync(templatePath, targetPath);
|
|
48
|
+
copiedCount++;
|
|
49
|
+
console.log(`✅ Added .cursor/rules/${file}`);
|
|
50
|
+
} else {
|
|
51
|
+
console.log(`⏭️ Skipped .cursor/rules/${file} (already exists)`);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
if (copiedCount > 0) {
|
|
56
|
+
console.log(`🎨 Added ${copiedCount} cursor rule(s) for @texturehq/edges design system`);
|
|
57
|
+
} else {
|
|
58
|
+
console.log('ℹ️ All cursor rules already exist');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Also render edges-components.mdc from manifest when present
|
|
62
|
+
const manifestPath = [
|
|
63
|
+
path.join(cwd, 'node_modules/@texturehq/edges/dist/components.manifest.json')
|
|
64
|
+
].find(p => fs.existsSync(p));
|
|
65
|
+
|
|
66
|
+
if (manifestPath) {
|
|
67
|
+
try {
|
|
68
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
69
|
+
const lines = [
|
|
70
|
+
'---',
|
|
71
|
+
'alwaysApply: true',
|
|
72
|
+
'---',
|
|
73
|
+
'',
|
|
74
|
+
`## @texturehq/edges Components (v${manifest.version || 'unknown'})`,
|
|
75
|
+
''
|
|
76
|
+
];
|
|
77
|
+
for (const c of manifest.components || []) {
|
|
78
|
+
lines.push(`- ${c.name}`);
|
|
79
|
+
if (c.importRoot) lines.push(` - Import: \`import { ${c.name} } from "${c.importRoot}"\``);
|
|
80
|
+
if (c.importPath) lines.push(` - Subpath: \`import { ${c.name} } from "${c.importPath}"\``);
|
|
81
|
+
if (c.props && c.props.length) {
|
|
82
|
+
const propNames = c.props.slice(0, 8).map(p => p.name).join(', ');
|
|
83
|
+
lines.push(` - Props: ${propNames}${c.props.length > 8 ? ', …' : ''}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const outPath = path.join(rulesDir, 'edges-components.mdc');
|
|
87
|
+
fs.writeFileSync(outPath, lines.join('\n'));
|
|
88
|
+
console.log(`✅ Wrote .cursor/rules/edges-components.mdc from manifest (${manifest.components?.length || 0} components)`);
|
|
89
|
+
} catch (err) {
|
|
90
|
+
console.log('⚠️ Failed to read components.manifest.json:', err.message);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
setupCursorRules();
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
alwaysApply: true
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Usage Context for @texturehq/edges
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
This project uses @texturehq/edges design system with Tailwind 4. The theme CSS file contains all design system variables that automatically become available as Tailwind classes.
|
|
9
|
+
|
|
10
|
+
## Theme Import
|
|
11
|
+
The theme is imported via CSS:
|
|
12
|
+
```css
|
|
13
|
+
@import "@texturehq/edges/theme.css";
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## How It Works
|
|
17
|
+
- CSS variables in the theme file automatically become Tailwind classes
|
|
18
|
+
- `--color-brand-primary` becomes available as `bg-brand-primary`, `text-brand-primary`, `border-brand-primary`, etc.
|
|
19
|
+
- `--spacing-md` becomes available as `p-md`, `m-md`, `gap-md`, etc.
|
|
20
|
+
- `--text-lg` becomes available as `text-lg`
|
|
21
|
+
- `--radius-lg` becomes available as `rounded-lg`
|
|
22
|
+
|
|
23
|
+
## Usage Guidelines
|
|
24
|
+
- **Use semantic classes over arbitrary values**
|
|
25
|
+
- Prefer: `bg-brand-primary`, `text-text-body`, `p-md`, `rounded-lg`
|
|
26
|
+
- Avoid: `bg-[#444ae1]`, `text-[#333333]`, `p-[1rem]`, `rounded-[0.5rem]`
|
|
27
|
+
|
|
28
|
+
## Naming Conventions
|
|
29
|
+
- Brand colors: `brand-primary`, `brand-light`, `brand-dark`
|
|
30
|
+
- Text colors: `text-body`, `text-heading`, `text-muted`, `text-caption`
|
|
31
|
+
- Background colors: `background-body`, `background-surface`, `background-muted`
|
|
32
|
+
- Border colors: `border-default`, `border-focus`, `border-muted`
|
|
33
|
+
- Action colors: `action-primary`, `action-secondary`, `action-destructive`
|
|
34
|
+
- Feedback colors: `feedback-success`, `feedback-error`, `feedback-warning`, `feedback-info`
|
|
35
|
+
- Spacing: `xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`, `4xl`
|
|
36
|
+
- Typography: `xs`, `sm`, `base`, `lg`, `xl`, `2xl`, `3xl`, `4xl`
|
|
37
|
+
- Border radius: `xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`, `4xl`
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
```html
|
|
41
|
+
<!-- ✅ Good - Uses semantic classes -->
|
|
42
|
+
<div class="bg-brand-primary text-text-on-primary p-md rounded-lg shadow-md">
|
|
43
|
+
<h2 class="text-text-heading text-lg font-medium">Title</h2>
|
|
44
|
+
<p class="text-text-body text-base">Content</p>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<!-- ❌ Avoid - Uses arbitrary values -->
|
|
48
|
+
<div class="bg-[#444ae1] text-[#ffffff] p-[1rem] rounded-[0.5rem]">
|
|
49
|
+
<h2 class="text-[#111827] text-[1.125rem] font-[500]">Title</h2>
|
|
50
|
+
<p class="text-[#333333] text-[1rem]">Content</p>
|
|
51
|
+
</div>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Dark Mode
|
|
55
|
+
All colors automatically adapt to dark mode when `.dark` class is present.
|
|
56
|
+
|
|
57
|
+
## Available Variables
|
|
58
|
+
All CSS variables from the theme file are automatically available. The theme includes:
|
|
59
|
+
- Complete color system (brand, text, background, border, action, feedback, device states, data visualization)
|
|
60
|
+
- Spacing scale
|
|
61
|
+
- Typography scale
|
|
62
|
+
- Border radius scale
|
|
63
|
+
- Shadow system
|
|
64
|
+
- Animation definitions
|
|
65
|
+
- Form control specifications
|