pika-ux 1.0.0-beta.1 → 1.0.0-beta.3
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/dist/cli/index.js +281 -0
- package/dist/cli/template-files/.gitignore +24 -0
- package/dist/cli/template-files/.npmrc +5 -0
- package/dist/cli/template-files/.nvmrc +1 -0
- package/dist/cli/template-files/.prettierignore +15 -0
- package/dist/cli/template-files/.prettierrc +7 -0
- package/dist/cli/template-files/README.md +63 -0
- package/dist/cli/template-files/index.html +13 -0
- package/dist/cli/template-files/package.json +35 -0
- package/dist/cli/template-files/pnpm-workspace.yaml +21 -0
- package/dist/cli/template-files/src/App.svelte +10 -0
- package/dist/cli/template-files/src/app.css +3 -0
- package/dist/cli/template-files/src/lib/Counter.svelte +12 -0
- package/dist/cli/template-files/src/main.ts +9 -0
- package/dist/cli/template-files/svelte.config.js +8 -0
- package/dist/cli/template-files/tsconfig.app.json +44 -0
- package/dist/cli/template-files/tsconfig.json +25 -0
- package/dist/cli/template-files/tsconfig.node.json +28 -0
- package/dist/cli/template-files/vite.config.ts +20 -0
- package/package.json +29 -8
- package/readme.md +36 -0
- package/scripts/setup.js +0 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import chalk2 from 'chalk';
|
|
4
|
+
import { readFileSync } from 'fs';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import path2 from 'path';
|
|
7
|
+
import inquirer from 'inquirer';
|
|
8
|
+
import fs from 'fs-extra';
|
|
9
|
+
import { exec } from 'child_process';
|
|
10
|
+
import { promisify } from 'util';
|
|
11
|
+
import ora from 'ora';
|
|
12
|
+
import semver from 'semver';
|
|
13
|
+
import { glob } from 'glob';
|
|
14
|
+
|
|
15
|
+
var Logger = class {
|
|
16
|
+
spinner = null;
|
|
17
|
+
info(message, ...args) {
|
|
18
|
+
console.log(chalk2.blue("\u2139"), message, ...args);
|
|
19
|
+
}
|
|
20
|
+
success(message, ...args) {
|
|
21
|
+
console.log(chalk2.green("\u2713"), message, ...args);
|
|
22
|
+
}
|
|
23
|
+
warn(message, ...args) {
|
|
24
|
+
console.log(chalk2.yellow("\u26A0"), message, ...args);
|
|
25
|
+
}
|
|
26
|
+
error(message, ...args) {
|
|
27
|
+
console.error(chalk2.red("\u2717"), message, ...args);
|
|
28
|
+
}
|
|
29
|
+
debug(message, ...args) {
|
|
30
|
+
if (process.env.DEBUG || process.env.PIKA_DEBUG) {
|
|
31
|
+
console.log(chalk2.gray("\u{1F41B}"), message, ...args);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
startSpinner(text) {
|
|
35
|
+
this.spinner = ora(text).start();
|
|
36
|
+
return this.spinner;
|
|
37
|
+
}
|
|
38
|
+
stopSpinner(success = true, text) {
|
|
39
|
+
if (this.spinner) {
|
|
40
|
+
if (success) {
|
|
41
|
+
this.spinner.succeed(text);
|
|
42
|
+
} else {
|
|
43
|
+
this.spinner.fail(text);
|
|
44
|
+
}
|
|
45
|
+
this.spinner = null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
updateSpinner(text) {
|
|
49
|
+
if (this.spinner) {
|
|
50
|
+
this.spinner.text = text;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
newLine() {
|
|
54
|
+
console.log();
|
|
55
|
+
}
|
|
56
|
+
divider() {
|
|
57
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var logger = new Logger();
|
|
61
|
+
var execAsync = promisify(exec);
|
|
62
|
+
async function validatePnpm() {
|
|
63
|
+
try {
|
|
64
|
+
await execAsync("pnpm --version");
|
|
65
|
+
} catch (error) {
|
|
66
|
+
logger.error("pnpm is not installed.");
|
|
67
|
+
logger.info("Please install pnpm:");
|
|
68
|
+
console.log(" npm install -g pnpm");
|
|
69
|
+
console.log(" # or");
|
|
70
|
+
console.log(" curl -fsSL https://get.pnpm.io/install.sh | sh -");
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async function validateNodeVersion() {
|
|
75
|
+
const currentVersion = process.version;
|
|
76
|
+
const requiredVersion = "22.0.0";
|
|
77
|
+
if (!semver.gte(currentVersion, requiredVersion)) {
|
|
78
|
+
logger.error(`Node.js version ${requiredVersion} or higher is required.`);
|
|
79
|
+
logger.info(`Current version: ${currentVersion}`);
|
|
80
|
+
logger.info("Please upgrade Node.js:");
|
|
81
|
+
console.log(" Use nvm: nvm install 22");
|
|
82
|
+
console.log(" Or download from: https://nodejs.org/");
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function validateProjectName(name) {
|
|
87
|
+
if (!name.trim()) {
|
|
88
|
+
return "Project name is required";
|
|
89
|
+
}
|
|
90
|
+
if (!/^[a-zA-Z]/.test(name)) {
|
|
91
|
+
return "Project name must start with a letter";
|
|
92
|
+
}
|
|
93
|
+
if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(name)) {
|
|
94
|
+
return "Project name may only contain letters, numbers, underscores, and hyphens";
|
|
95
|
+
}
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
function toHumanReadable(projectName) {
|
|
99
|
+
const parts = projectName.replace(/([a-z])([A-Z])/g, "$1 $2").split(/[-_\s]+/).filter((part) => part.length > 0);
|
|
100
|
+
return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()).join(" ");
|
|
101
|
+
}
|
|
102
|
+
async function processTemplateFiles(sourceDir, targetDir, variables) {
|
|
103
|
+
const files = await glob("**/*", {
|
|
104
|
+
cwd: sourceDir,
|
|
105
|
+
dot: true,
|
|
106
|
+
nodir: true,
|
|
107
|
+
absolute: false
|
|
108
|
+
});
|
|
109
|
+
for (const file of files) {
|
|
110
|
+
const sourcePath = path2.join(sourceDir, file);
|
|
111
|
+
const targetPath = path2.join(targetDir, file);
|
|
112
|
+
await fs.ensureDir(path2.dirname(targetPath));
|
|
113
|
+
let content = await fs.readFile(sourcePath, "utf8");
|
|
114
|
+
content = content.replace(/\{projectName\}/g, variables.projectName).replace(/\{humanReadableProjectName\}/g, variables.humanReadableProjectName).replace(/\{pikaUxVersion\}/g, variables.pikaUxVersion);
|
|
115
|
+
await fs.writeFile(targetPath, content, "utf8");
|
|
116
|
+
}
|
|
117
|
+
logger.debug(`Processed ${files.length} template files`);
|
|
118
|
+
}
|
|
119
|
+
async function copyAndProcessTemplate(templateDir, targetDir, variables) {
|
|
120
|
+
await fs.ensureDir(targetDir);
|
|
121
|
+
await processTemplateFiles(templateDir, targetDir, variables);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// tools/cli/commands/create.ts
|
|
125
|
+
var execAsync2 = promisify(exec);
|
|
126
|
+
var __filename = fileURLToPath(import.meta.url);
|
|
127
|
+
var __dirname = path2.dirname(__filename);
|
|
128
|
+
async function createCommand(options = {}) {
|
|
129
|
+
try {
|
|
130
|
+
logger.newLine();
|
|
131
|
+
console.log(chalk2.bold.cyan("Create Pika Webcomponent Application"));
|
|
132
|
+
logger.divider();
|
|
133
|
+
let projectName = options.projectName;
|
|
134
|
+
if (!projectName) {
|
|
135
|
+
const nameAnswer = await inquirer.prompt([
|
|
136
|
+
{
|
|
137
|
+
type: "input",
|
|
138
|
+
name: "projectName",
|
|
139
|
+
message: "Project name:",
|
|
140
|
+
default: "my-webcomponent",
|
|
141
|
+
validate: validateProjectName
|
|
142
|
+
}
|
|
143
|
+
]);
|
|
144
|
+
projectName = nameAnswer.projectName;
|
|
145
|
+
} else {
|
|
146
|
+
const validation = validateProjectName(projectName);
|
|
147
|
+
if (validation !== true) {
|
|
148
|
+
logger.error(validation);
|
|
149
|
+
process.exit(1);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const suggestedName = toHumanReadable(projectName);
|
|
153
|
+
let humanReadableName = options.humanReadableName;
|
|
154
|
+
if (!humanReadableName) {
|
|
155
|
+
const humanNameAnswer = await inquirer.prompt([
|
|
156
|
+
{
|
|
157
|
+
type: "input",
|
|
158
|
+
name: "humanReadableName",
|
|
159
|
+
message: "Human-readable project name:",
|
|
160
|
+
default: suggestedName
|
|
161
|
+
}
|
|
162
|
+
]);
|
|
163
|
+
humanReadableName = humanNameAnswer.humanReadableName;
|
|
164
|
+
}
|
|
165
|
+
const targetPath = path2.resolve(process.cwd(), projectName);
|
|
166
|
+
if (await fs.pathExists(targetPath)) {
|
|
167
|
+
const { overwrite } = await inquirer.prompt([
|
|
168
|
+
{
|
|
169
|
+
type: "confirm",
|
|
170
|
+
name: "overwrite",
|
|
171
|
+
message: `Directory "${projectName}" already exists. Overwrite?`,
|
|
172
|
+
default: false
|
|
173
|
+
}
|
|
174
|
+
]);
|
|
175
|
+
if (!overwrite) {
|
|
176
|
+
logger.warn("Project creation cancelled.");
|
|
177
|
+
process.exit(0);
|
|
178
|
+
}
|
|
179
|
+
await fs.remove(targetPath);
|
|
180
|
+
}
|
|
181
|
+
const spinner = logger.startSpinner("Creating project...");
|
|
182
|
+
try {
|
|
183
|
+
const packageJsonPath = path2.join(__dirname, "../../../package.json");
|
|
184
|
+
const packageJson2 = await fs.readJson(packageJsonPath);
|
|
185
|
+
const pikaUxVersion = packageJson2.version;
|
|
186
|
+
const templateDir = path2.join(__dirname, "../template-files");
|
|
187
|
+
logger.updateSpinner("Processing template files...");
|
|
188
|
+
await copyAndProcessTemplate(templateDir, targetPath, {
|
|
189
|
+
projectName,
|
|
190
|
+
humanReadableProjectName: humanReadableName,
|
|
191
|
+
pikaUxVersion
|
|
192
|
+
});
|
|
193
|
+
logger.stopSpinner(true, "Template files processed");
|
|
194
|
+
const installSpinner = logger.startSpinner("Installing dependencies with pnpm...");
|
|
195
|
+
try {
|
|
196
|
+
await execAsync2("pnpm install", { cwd: targetPath });
|
|
197
|
+
logger.stopSpinner(true, "Dependencies installed");
|
|
198
|
+
} catch (error) {
|
|
199
|
+
logger.stopSpinner(false, "Failed to install dependencies");
|
|
200
|
+
logger.warn("You can install dependencies manually:");
|
|
201
|
+
console.log(` cd ${projectName} && pnpm install`);
|
|
202
|
+
}
|
|
203
|
+
showCompletionMessage(projectName, targetPath);
|
|
204
|
+
} catch (error) {
|
|
205
|
+
logger.stopSpinner(false, "Failed to create project");
|
|
206
|
+
throw error;
|
|
207
|
+
}
|
|
208
|
+
} catch (error) {
|
|
209
|
+
logger.error("Failed to create webcomponent application:");
|
|
210
|
+
console.error(error);
|
|
211
|
+
process.exit(1);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function showCompletionMessage(projectName, projectPath) {
|
|
215
|
+
logger.newLine();
|
|
216
|
+
console.log(chalk2.green.bold(`\u2713 Successfully created ${projectName}!`));
|
|
217
|
+
logger.newLine();
|
|
218
|
+
console.log(chalk2.bold("Next steps:"));
|
|
219
|
+
console.log(chalk2.gray(` cd ${path2.relative(process.cwd(), projectPath)}`));
|
|
220
|
+
console.log(chalk2.gray(" pnpm dev # Start development server"));
|
|
221
|
+
console.log(chalk2.gray(" pnpm build # Build for production"));
|
|
222
|
+
logger.newLine();
|
|
223
|
+
console.log(chalk2.bold("Available commands:"));
|
|
224
|
+
console.log(chalk2.gray(" pnpm dev - Start Vite dev server"));
|
|
225
|
+
console.log(chalk2.gray(" pnpm build - Build for production"));
|
|
226
|
+
console.log(chalk2.gray(" pnpm preview - Preview production build"));
|
|
227
|
+
console.log(chalk2.gray(" pnpm check - Run type checking"));
|
|
228
|
+
logger.newLine();
|
|
229
|
+
console.log(chalk2.bold("Learn more:"));
|
|
230
|
+
console.log(chalk2.gray(" \u2022 Pika UX Components: https://github.com/rithum/pika"));
|
|
231
|
+
console.log(chalk2.gray(" \u2022 Svelte Documentation: https://svelte.dev"));
|
|
232
|
+
console.log(chalk2.gray(" \u2022 Tailwind CSS: https://tailwindcss.com"));
|
|
233
|
+
logger.newLine();
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// tools/cli/index.ts
|
|
237
|
+
var __filename2 = fileURLToPath(import.meta.url);
|
|
238
|
+
var __dirname2 = path2.dirname(__filename2);
|
|
239
|
+
var packageJson = JSON.parse(readFileSync(path2.join(__dirname2, "../../package.json"), "utf8"));
|
|
240
|
+
var program = new Command();
|
|
241
|
+
program.name("pikaux").description("CLI tool for creating Pika webcomponent applications").version(packageJson.version);
|
|
242
|
+
program.command("create").description("Create a new Pika webcomponent application").argument("[name]", "Project name").action(async (name) => {
|
|
243
|
+
await validateNodeVersion();
|
|
244
|
+
await validatePnpm();
|
|
245
|
+
await createCommand({ projectName: name });
|
|
246
|
+
});
|
|
247
|
+
program.on("--help", () => {
|
|
248
|
+
console.log("");
|
|
249
|
+
console.log(chalk2.bold("Examples:"));
|
|
250
|
+
console.log(chalk2.gray(" $ pikaux create"));
|
|
251
|
+
console.log(chalk2.gray(" $ pikaux create my-webcomponent"));
|
|
252
|
+
console.log("");
|
|
253
|
+
console.log(chalk2.dim('Tip: You can also use "pika-ux" instead of "pikaux"'));
|
|
254
|
+
console.log("");
|
|
255
|
+
});
|
|
256
|
+
program.exitOverride((err) => {
|
|
257
|
+
if (err.code === "commander.version" || err.code === "commander.help" || err.code === "commander.helpDisplayed") {
|
|
258
|
+
process.exit(0);
|
|
259
|
+
}
|
|
260
|
+
logger.error(`Command failed: ${err.message}`);
|
|
261
|
+
process.exit(1);
|
|
262
|
+
});
|
|
263
|
+
process.on("uncaughtException", (error) => {
|
|
264
|
+
logger.error("Uncaught Exception:", error);
|
|
265
|
+
process.exit(1);
|
|
266
|
+
});
|
|
267
|
+
process.on("unhandledRejection", (reason, promise) => {
|
|
268
|
+
logger.error("Unhandled Rejection at:", promise, "reason:", reason);
|
|
269
|
+
process.exit(1);
|
|
270
|
+
});
|
|
271
|
+
console.log(
|
|
272
|
+
chalk2.cyan(`
|
|
273
|
+
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
274
|
+
\u2551 \u2551
|
|
275
|
+
\u2551 \u{1F3A8} Pika UX Webcomponent CLI \u2551
|
|
276
|
+
\u2551 Create webcomponents with ease \u2551
|
|
277
|
+
\u2551 \u2551
|
|
278
|
+
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
279
|
+
`)
|
|
280
|
+
);
|
|
281
|
+
program.parse();
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
pnpm-debug.log*
|
|
8
|
+
lerna-debug.log*
|
|
9
|
+
|
|
10
|
+
node_modules
|
|
11
|
+
dist
|
|
12
|
+
dist-ssr
|
|
13
|
+
*.local
|
|
14
|
+
|
|
15
|
+
# Editor directories and files
|
|
16
|
+
.vscode/*
|
|
17
|
+
!.vscode/extensions.json
|
|
18
|
+
.idea
|
|
19
|
+
.DS_Store
|
|
20
|
+
*.suo
|
|
21
|
+
*.ntvs*
|
|
22
|
+
*.njsproj
|
|
23
|
+
*.sln
|
|
24
|
+
*.sw?
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
22
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# {humanReadableProjectName}
|
|
2
|
+
|
|
3
|
+
A webcomponent application built with Pika UX components.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This project creates custom webcomponents that can be dynamically injected into a Pika chat application. Components can appear:
|
|
8
|
+
|
|
9
|
+
- **In-conversation**: Embedded within the chat message flow
|
|
10
|
+
- **Spotlight section**: Displayed above the chat input field
|
|
11
|
+
|
|
12
|
+
## Getting Started
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Install dependencies
|
|
16
|
+
pnpm install
|
|
17
|
+
|
|
18
|
+
# Start development server
|
|
19
|
+
pnpm dev
|
|
20
|
+
|
|
21
|
+
# Build for production
|
|
22
|
+
pnpm build
|
|
23
|
+
|
|
24
|
+
# Preview production build
|
|
25
|
+
pnpm preview
|
|
26
|
+
|
|
27
|
+
# Type checking
|
|
28
|
+
pnpm check
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Project Structure
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
{projectName}/
|
|
35
|
+
├── src/
|
|
36
|
+
│ ├── lib/ # Reusable components
|
|
37
|
+
│ ├── App.svelte # Main application component
|
|
38
|
+
│ ├── main.ts # Application entry point
|
|
39
|
+
│ └── app.css # Global styles
|
|
40
|
+
├── package.json
|
|
41
|
+
└── vite.config.ts
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Development
|
|
45
|
+
|
|
46
|
+
This project uses:
|
|
47
|
+
|
|
48
|
+
- **Svelte 5**: Modern reactive framework
|
|
49
|
+
- **Pika UX**: Component library with shadcn-style components
|
|
50
|
+
- **Tailwind CSS v4**: Utility-first styling
|
|
51
|
+
- **Vite**: Fast build tool and dev server
|
|
52
|
+
- **TypeScript**: Type-safe development
|
|
53
|
+
|
|
54
|
+
## Building Webcomponents
|
|
55
|
+
|
|
56
|
+
Create your webcomponents in `src/lib/` and export them from your main application. These components can then be integrated with Pika chat applications for dynamic UI injection.
|
|
57
|
+
|
|
58
|
+
## Learn More
|
|
59
|
+
|
|
60
|
+
- [Pika Framework Documentation](https://pika.tools)
|
|
61
|
+
- [Pika UX Components](https://github.com/rithum/pika/tree/main/packages/pika-ux)
|
|
62
|
+
- [Svelte Documentation](https://svelte.dev)
|
|
63
|
+
- [Tailwind CSS](https://tailwindcss.com)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>{humanReadableProjectName}</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/src/main.ts"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{projectName}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"check": "svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@iconify-json/ci": "catalog:",
|
|
14
|
+
"@iconify-json/lucide": "catalog:",
|
|
15
|
+
"@internationalized/date": "catalog:",
|
|
16
|
+
"@lucide/svelte": "catalog:",
|
|
17
|
+
"@sveltejs/vite-plugin-svelte": "catalog:",
|
|
18
|
+
"@tailwindcss/typography": "catalog:",
|
|
19
|
+
"@tailwindcss/vite": "catalog:",
|
|
20
|
+
"@types/node": "catalog:",
|
|
21
|
+
"@tsconfig/svelte": "catalog:",
|
|
22
|
+
"bits-ui": "catalog:",
|
|
23
|
+
"clsx": "catalog:",
|
|
24
|
+
"pika-ux": "{pikaUxVersion}",
|
|
25
|
+
"svelte": "catalog:",
|
|
26
|
+
"svelte-check": "catalog:",
|
|
27
|
+
"tailwind-merge": "catalog:",
|
|
28
|
+
"tailwind-variants": "catalog:",
|
|
29
|
+
"tailwindcss": "catalog:",
|
|
30
|
+
"tw-animate-css": "catalog:",
|
|
31
|
+
"typescript": "catalog:",
|
|
32
|
+
"unplugin-icons": "catalog:",
|
|
33
|
+
"vite": "catalog:"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
catalog:
|
|
2
|
+
'@iconify-json/ci': ^1.2.2
|
|
3
|
+
'@iconify-json/lucide': ^1.2.44
|
|
4
|
+
'@internationalized/date': ^3.8.1
|
|
5
|
+
'@lucide/svelte': ^0.482.0
|
|
6
|
+
'@sveltejs/vite-plugin-svelte': ^6.2.0
|
|
7
|
+
'@tailwindcss/typography': ^0.5.16
|
|
8
|
+
'@tailwindcss/vite': ^4.1.13
|
|
9
|
+
'@types/node': ^22.15.17
|
|
10
|
+
'@tsconfig/svelte': ^5.0.5
|
|
11
|
+
bits-ui: ^2.9.1
|
|
12
|
+
clsx: ^2.1.1
|
|
13
|
+
svelte: ^5.39.4
|
|
14
|
+
svelte-check: ^4.3.1
|
|
15
|
+
tailwind-merge: ^3.3.1
|
|
16
|
+
tailwind-variants: ^3.1.1
|
|
17
|
+
tailwindcss: ^4.1.11
|
|
18
|
+
tw-animate-css: ^1.4.0
|
|
19
|
+
typescript: ^5.9.2
|
|
20
|
+
unplugin-icons: ^22.3.0
|
|
21
|
+
vite: ^7.1.7
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Button from 'pika-ux/shadcn/button/button.svelte';
|
|
3
|
+
import ThumbsUp from '$icons/lucide/thumbs-up';
|
|
4
|
+
let count: number = $state(0);
|
|
5
|
+
const increment = () => {
|
|
6
|
+
count += 1;
|
|
7
|
+
};
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<Button variant="outline" onclick={increment}>
|
|
11
|
+
<ThumbsUp /> count is {count}
|
|
12
|
+
</Button>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
|
|
2
|
+
|
|
3
|
+
/** @type {import("@sveltejs/vite-plugin-svelte").SvelteConfig} */
|
|
4
|
+
export default {
|
|
5
|
+
// Consult https://svelte.dev/docs#compile-time-svelte-preprocess
|
|
6
|
+
// for more information about preprocessors
|
|
7
|
+
preprocess: vitePreprocess(),
|
|
8
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@tsconfig/svelte/tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
5
|
+
"target": "ES2022",
|
|
6
|
+
"useDefineForClassFields": true,
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"types": [
|
|
9
|
+
"svelte",
|
|
10
|
+
"vite/client",
|
|
11
|
+
"unplugin-icons/types/svelte",
|
|
12
|
+
"pika-ux/icons/ci/index.d.ts",
|
|
13
|
+
"pika-ux/icons/lucide/index.d.ts"
|
|
14
|
+
],
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
/**
|
|
17
|
+
* Typecheck JS in `.svelte` and `.js` files by default.
|
|
18
|
+
* Disable checkJs if you'd like to use dynamic types in JS.
|
|
19
|
+
* Note that setting allowJs false does not prevent the use
|
|
20
|
+
* of JS in `.svelte` files.
|
|
21
|
+
*/
|
|
22
|
+
"allowJs": true,
|
|
23
|
+
"checkJs": true,
|
|
24
|
+
"moduleDetection": "force",
|
|
25
|
+
"baseUrl": ".",
|
|
26
|
+
"paths": {
|
|
27
|
+
"$lib": [
|
|
28
|
+
"./src/lib"
|
|
29
|
+
],
|
|
30
|
+
"$lib/*": [
|
|
31
|
+
"./src/lib/*"
|
|
32
|
+
],
|
|
33
|
+
"$icons/*": [
|
|
34
|
+
"~icons/*"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"include": [
|
|
39
|
+
"src/**/*.ts",
|
|
40
|
+
"src/**/*.d.ts",
|
|
41
|
+
"src/**/*.js",
|
|
42
|
+
"src/**/*.svelte"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": [],
|
|
3
|
+
"references": [
|
|
4
|
+
{
|
|
5
|
+
"path": "./tsconfig.app.json"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"path": "./tsconfig.node.json"
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"compilerOptions": {
|
|
12
|
+
"baseUrl": ".",
|
|
13
|
+
"paths": {
|
|
14
|
+
"$lib": [
|
|
15
|
+
"./src/lib"
|
|
16
|
+
],
|
|
17
|
+
"$lib/*": [
|
|
18
|
+
"./src/lib/*"
|
|
19
|
+
],
|
|
20
|
+
"$icons/*": [
|
|
21
|
+
"./~icons/*"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"lib": [
|
|
6
|
+
"ES2022"
|
|
7
|
+
],
|
|
8
|
+
"module": "ESNext",
|
|
9
|
+
"types": [],
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
/* Bundler mode */
|
|
12
|
+
"moduleResolution": "bundler",
|
|
13
|
+
"allowImportingTsExtensions": true,
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"moduleDetection": "force",
|
|
16
|
+
"noEmit": true,
|
|
17
|
+
/* Linting */
|
|
18
|
+
"strict": true,
|
|
19
|
+
"noUnusedLocals": true,
|
|
20
|
+
"noUnusedParameters": true,
|
|
21
|
+
"erasableSyntaxOnly": true,
|
|
22
|
+
"noFallthroughCasesInSwitch": true,
|
|
23
|
+
"noUncheckedSideEffectImports": true
|
|
24
|
+
},
|
|
25
|
+
"include": [
|
|
26
|
+
"vite.config.ts"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import { svelte } from '@sveltejs/vite-plugin-svelte';
|
|
3
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
4
|
+
import Icons from 'unplugin-icons/vite';
|
|
5
|
+
|
|
6
|
+
// https://vite.dev/config/
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
plugins: [
|
|
9
|
+
tailwindcss(),
|
|
10
|
+
svelte(),
|
|
11
|
+
Icons({
|
|
12
|
+
compiler: 'svelte'
|
|
13
|
+
})
|
|
14
|
+
],
|
|
15
|
+
resolve: {
|
|
16
|
+
alias: {
|
|
17
|
+
'$icons/': '~icons/'
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pika-ux",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./src/index.ts",
|
|
7
|
-
"./pika/*": "./src/pika
|
|
8
|
-
"./shadcn/*": "./src/shadcn
|
|
7
|
+
"./pika/*": "./src/pika/*",
|
|
8
|
+
"./shadcn/*": "./src/shadcn/*",
|
|
9
9
|
"./icons/*": "./src/icons/*",
|
|
10
10
|
"./app.css": "./src/app.css",
|
|
11
11
|
"./tools/icon-generator": "./dist/icon-generator/generate-icon-ts-indices.js",
|
|
12
12
|
"./tools/shadcn-postinstall": "./dist/shadcn-postinstall/index.js"
|
|
13
13
|
},
|
|
14
14
|
"bin": {
|
|
15
|
-
"
|
|
15
|
+
"pikaux": "./dist/cli/index.js",
|
|
16
|
+
"pika-ux": "./dist/cli/index.js",
|
|
16
17
|
"pika-ux-icons": "./dist/icon-generator/generate-icon-ts-indices.js",
|
|
17
18
|
"pika-ux-normalize": "./dist/shadcn-postinstall/index.js"
|
|
18
19
|
},
|
|
@@ -22,25 +23,40 @@
|
|
|
22
23
|
"scripts/**"
|
|
23
24
|
],
|
|
24
25
|
"devDependencies": {
|
|
26
|
+
"@iconify-json/ci": "^1.2.2",
|
|
27
|
+
"@iconify-json/lucide": "^1.2.44",
|
|
25
28
|
"@lucide/svelte": "^0.482.0",
|
|
26
29
|
"@sveltejs/vite-plugin-svelte": "^6.2.0",
|
|
27
30
|
"@tailwindcss/typography": "^0.5.16",
|
|
28
31
|
"@tailwindcss/vite": "^4.1.13",
|
|
29
32
|
"@tsconfig/svelte": "^5.0.5",
|
|
33
|
+
"@types/fs-extra": "^11.0.4",
|
|
30
34
|
"@types/indefinite": "^2.3.4",
|
|
35
|
+
"@types/inquirer": "^9.0.8",
|
|
31
36
|
"@types/node": "^22.15.17",
|
|
37
|
+
"@types/semver": "^7.7.0",
|
|
32
38
|
"eslint": "^9.26.0",
|
|
39
|
+
"tailwind-merge": "^3.3.1",
|
|
33
40
|
"tailwind-variants": "^3.1.1",
|
|
34
41
|
"tailwindcss": "^4.1.11",
|
|
35
42
|
"tsup": "^8.4.0",
|
|
36
43
|
"tsx": "^4.19.4",
|
|
37
44
|
"tw-animate-css": "^1.4.0",
|
|
38
45
|
"typescript": "^5.9.2",
|
|
46
|
+
"unplugin-icons": "^22.3.0",
|
|
39
47
|
"vite": "^7.1.7",
|
|
40
48
|
"@pika/typescript-config": "0.0.0"
|
|
41
49
|
},
|
|
42
50
|
"peerDependencies": {
|
|
43
|
-
"svelte": "^5.
|
|
51
|
+
"svelte": "^5.39.4",
|
|
52
|
+
"unplugin-icons": "^22.3.0",
|
|
53
|
+
"@iconify-json/ci": "^1.2.2",
|
|
54
|
+
"@iconify-json/lucide": "^1.2.44",
|
|
55
|
+
"@tailwindcss/vite": "^4.1.13",
|
|
56
|
+
"@tailwindcss/typography": "^0.5.16",
|
|
57
|
+
"tailwindcss": "^4.1.11",
|
|
58
|
+
"tailwind-merge": "^3.3.1",
|
|
59
|
+
"tailwind-variants": "^3.1.1"
|
|
44
60
|
},
|
|
45
61
|
"dependencies": {
|
|
46
62
|
"@cartamd/plugin-code": "^4.2.0",
|
|
@@ -50,16 +66,21 @@
|
|
|
50
66
|
"@tanstack/table-core": "^8.21.3",
|
|
51
67
|
"bits-ui": "^2.9.1",
|
|
52
68
|
"carta-md": "^4.11.1",
|
|
69
|
+
"chalk": "^5.4.1",
|
|
53
70
|
"clsx": "^2.1.1",
|
|
71
|
+
"commander": "^14.0.0",
|
|
54
72
|
"date-fns": "^4.1.0",
|
|
55
73
|
"date-fns-tz": "^3.2.0",
|
|
74
|
+
"fs-extra": "^11.3.0",
|
|
75
|
+
"glob": "^11.0.2",
|
|
56
76
|
"indefinite": "^2.5.1",
|
|
77
|
+
"inquirer": "^12.6.3",
|
|
57
78
|
"mode-watcher": "^1.0.7",
|
|
79
|
+
"ora": "^8.2.0",
|
|
58
80
|
"paneforge": "^1.0.2",
|
|
59
81
|
"plur": "^5.1.0",
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"unplugin-icons": "^22.3.0"
|
|
82
|
+
"semver": "^7.7.2",
|
|
83
|
+
"svelte-sonner": "^1.0.5"
|
|
63
84
|
},
|
|
64
85
|
"keywords": [
|
|
65
86
|
"pika",
|
package/readme.md
CHANGED
|
@@ -4,12 +4,48 @@ UI Components library for the Pika project. This package contains both custom Pi
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
+
1. Install peer dependencies
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
pnpm i
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
2. Install the module
|
|
14
|
+
|
|
7
15
|
```bash
|
|
8
16
|
npm install pika-ux
|
|
9
17
|
# or
|
|
10
18
|
pnpm install pika-ux
|
|
11
19
|
```
|
|
12
20
|
|
|
21
|
+
2. Modify `vite.config.ts`
|
|
22
|
+
|
|
23
|
+
The config below turns on tailwind and also the unplugin-icons to make icons available.
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { defineConfig } from 'vite';
|
|
27
|
+
import { svelte } from '@sveltejs/vite-plugin-svelte';
|
|
28
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
29
|
+
import Icons from 'unplugin-icons/vite';
|
|
30
|
+
|
|
31
|
+
// https://vite.dev/config/
|
|
32
|
+
export default defineConfig({
|
|
33
|
+
plugins: [
|
|
34
|
+
tailwindcss(),
|
|
35
|
+
svelte(),
|
|
36
|
+
Icons({
|
|
37
|
+
compiler: 'svelte'
|
|
38
|
+
}) as any // necessary since slightly different versions of vite are in use
|
|
39
|
+
],
|
|
40
|
+
resolve: {
|
|
41
|
+
alias: {
|
|
42
|
+
// You have to have this
|
|
43
|
+
'$icons/': '~icons/'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
13
49
|
## Usage
|
|
14
50
|
|
|
15
51
|
### Importing Components
|
package/scripts/setup.js
CHANGED
|
File without changes
|