pika-ux 1.0.0-beta.1 → 1.0.0-beta.10
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 +320 -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 +33 -12
- package/readme.md +74 -3
- package/scripts/setup.js +0 -0
- package/src/.DS_Store +0 -0
- package/src/App.svelte +2 -4
- package/src/icons/lucide/index.d.ts +397 -40
- package/src/pika/scrollable-tabs/README.md +192 -0
- package/src/pika/scrollable-tabs/add-button.svelte +33 -0
- package/src/pika/scrollable-tabs/content.svelte +23 -0
- package/src/pika/scrollable-tabs/context.svelte.ts +23 -0
- package/src/pika/scrollable-tabs/example.svelte +81 -0
- package/src/pika/scrollable-tabs/index.ts +31 -0
- package/src/pika/scrollable-tabs/list.svelte +15 -0
- package/src/pika/scrollable-tabs/overflow-menu.svelte +119 -0
- package/src/pika/scrollable-tabs/pinned-section.svelte +138 -0
- package/src/pika/scrollable-tabs/pinned-trigger.svelte +81 -0
- package/src/pika/scrollable-tabs/root.svelte +34 -0
- package/src/pika/scrollable-tabs/scrollable-section.svelte +120 -0
- package/src/pika/scrollable-tabs/trigger.svelte +82 -0
- package/src/shadcn/carousel/carousel-content.svelte +36 -31
- package/src/shadcn/carousel/carousel-item.svelte +22 -18
- package/src/shadcn/carousel/carousel-next.svelte +29 -22
- package/src/shadcn/carousel/carousel-previous.svelte +29 -22
- package/src/shadcn/carousel/carousel.svelte +77 -73
- package/src/shadcn/carousel/context.ts +37 -32
- package/src/shadcn/dropdown-menu/dropdown-menu-group.svelte +2 -3
- package/src/shadcn/dropdown-menu/dropdown-menu-item.svelte +1 -1
- package/src/shadcn/dropdown-menu/dropdown-menu-label.svelte +1 -7
- package/src/shadcn/dropdown-menu/dropdown-menu-radio-group.svelte +3 -13
- package/src/shadcn/dropdown-menu/dropdown-menu-radio-item.svelte +0 -1
- package/src/shadcn/dropdown-menu/dropdown-menu-separator.svelte +1 -7
- package/src/shadcn/dropdown-menu/dropdown-menu-shortcut.svelte +2 -13
- package/src/shadcn/dropdown-menu/dropdown-menu-sub-content.svelte +0 -1
- package/src/shadcn/dropdown-menu/dropdown-menu-sub-trigger.svelte +1 -2
- package/src/shadcn/dropdown-menu/dropdown-menu-trigger.svelte +2 -3
- package/src/shadcn/dropdown-menu/index.ts +44 -45
- package/src/shadcn/dropdown-menu copy/dropdown-menu-checkbox-item.svelte +41 -0
- package/src/shadcn/dropdown-menu copy/dropdown-menu-content.svelte +27 -0
- package/src/shadcn/dropdown-menu copy/dropdown-menu-group-heading.svelte +22 -0
- package/src/shadcn/dropdown-menu copy/dropdown-menu-group.svelte +7 -0
- package/src/shadcn/dropdown-menu copy/dropdown-menu-item.svelte +27 -0
- package/src/shadcn/dropdown-menu copy/dropdown-menu-label.svelte +24 -0
- package/src/shadcn/dropdown-menu copy/dropdown-menu-radio-group.svelte +16 -0
- package/src/shadcn/dropdown-menu copy/dropdown-menu-radio-item.svelte +26 -0
- package/src/shadcn/dropdown-menu copy/dropdown-menu-separator.svelte +13 -0
- package/src/shadcn/dropdown-menu copy/dropdown-menu-shortcut.svelte +20 -0
- package/src/shadcn/dropdown-menu copy/dropdown-menu-sub-content.svelte +16 -0
- package/src/shadcn/dropdown-menu copy/dropdown-menu-sub-trigger.svelte +29 -0
- package/src/shadcn/dropdown-menu copy/dropdown-menu-trigger.svelte +7 -0
- package/src/shadcn/spinner/index.ts +1 -0
- package/src/shadcn/spinner/spinner.svelte +9 -0
- package/src/shadcn/toggle-group/toggle-group.svelte +23 -28
- package/src/pika/index.ts +0 -29
- package/src/shadcn/index.ts +0 -40
|
@@ -0,0 +1,320 @@
|
|
|
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
|
+
import { createRequire } from 'module';
|
|
15
|
+
|
|
16
|
+
var Logger = class {
|
|
17
|
+
spinner = null;
|
|
18
|
+
info(message, ...args) {
|
|
19
|
+
console.log(chalk2.blue("\u2139"), message, ...args);
|
|
20
|
+
}
|
|
21
|
+
success(message, ...args) {
|
|
22
|
+
console.log(chalk2.green("\u2713"), message, ...args);
|
|
23
|
+
}
|
|
24
|
+
warn(message, ...args) {
|
|
25
|
+
console.log(chalk2.yellow("\u26A0"), message, ...args);
|
|
26
|
+
}
|
|
27
|
+
error(message, ...args) {
|
|
28
|
+
console.error(chalk2.red("\u2717"), message, ...args);
|
|
29
|
+
}
|
|
30
|
+
debug(message, ...args) {
|
|
31
|
+
if (process.env.DEBUG || process.env.PIKA_DEBUG) {
|
|
32
|
+
console.log(chalk2.gray("\u{1F41B}"), message, ...args);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
startSpinner(text) {
|
|
36
|
+
this.spinner = ora(text).start();
|
|
37
|
+
return this.spinner;
|
|
38
|
+
}
|
|
39
|
+
stopSpinner(success = true, text) {
|
|
40
|
+
if (this.spinner) {
|
|
41
|
+
if (success) {
|
|
42
|
+
this.spinner.succeed(text);
|
|
43
|
+
} else {
|
|
44
|
+
this.spinner.fail(text);
|
|
45
|
+
}
|
|
46
|
+
this.spinner = null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
updateSpinner(text) {
|
|
50
|
+
if (this.spinner) {
|
|
51
|
+
this.spinner.text = text;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
newLine() {
|
|
55
|
+
console.log();
|
|
56
|
+
}
|
|
57
|
+
divider() {
|
|
58
|
+
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var logger = new Logger();
|
|
62
|
+
var execAsync = promisify(exec);
|
|
63
|
+
async function validatePnpm() {
|
|
64
|
+
try {
|
|
65
|
+
await execAsync("pnpm --version");
|
|
66
|
+
} catch (error) {
|
|
67
|
+
logger.error("pnpm is not installed.");
|
|
68
|
+
logger.info("Please install pnpm:");
|
|
69
|
+
console.log(" npm install -g pnpm");
|
|
70
|
+
console.log(" # or (Unix/Mac):");
|
|
71
|
+
console.log(" curl -fsSL https://get.pnpm.io/install.sh | sh -");
|
|
72
|
+
console.log(" # or (Windows):");
|
|
73
|
+
console.log(" iwr https://get.pnpm.io/install.ps1 -useb | iex");
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async function validateNodeVersion() {
|
|
78
|
+
const currentVersion = process.version;
|
|
79
|
+
const requiredVersion = "22.0.0";
|
|
80
|
+
if (!semver.gte(currentVersion, requiredVersion)) {
|
|
81
|
+
logger.error(`Node.js version ${requiredVersion} or higher is required.`);
|
|
82
|
+
logger.info(`Current version: ${currentVersion}`);
|
|
83
|
+
logger.info("Please upgrade Node.js:");
|
|
84
|
+
console.log(" Use nvm: nvm install 22");
|
|
85
|
+
console.log(" Or download from: https://nodejs.org/");
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function validateProjectName(name) {
|
|
90
|
+
if (!name.trim()) {
|
|
91
|
+
return "Project name is required";
|
|
92
|
+
}
|
|
93
|
+
if (!/^[a-zA-Z]/.test(name)) {
|
|
94
|
+
return "Project name must start with a letter";
|
|
95
|
+
}
|
|
96
|
+
if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(name)) {
|
|
97
|
+
return "Project name may only contain letters, numbers, underscores, and hyphens";
|
|
98
|
+
}
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
function toHumanReadable(projectName) {
|
|
102
|
+
const parts = projectName.replace(/([a-z])([A-Z])/g, "$1 $2").split(/[-_\s]+/).filter((part) => part.length > 0);
|
|
103
|
+
return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()).join(" ");
|
|
104
|
+
}
|
|
105
|
+
async function processTemplateFiles(sourceDir, targetDir, variables) {
|
|
106
|
+
logger.debug(`Processing template files from: ${sourceDir}`);
|
|
107
|
+
logger.debug(`Target directory: ${targetDir}`);
|
|
108
|
+
let files;
|
|
109
|
+
try {
|
|
110
|
+
files = await glob("**/*", {
|
|
111
|
+
cwd: sourceDir,
|
|
112
|
+
dot: true,
|
|
113
|
+
nodir: true,
|
|
114
|
+
absolute: false
|
|
115
|
+
});
|
|
116
|
+
logger.debug(`Glob found ${files.length} files`);
|
|
117
|
+
} catch (error) {
|
|
118
|
+
logger.debug(`Glob error: ${error}`);
|
|
119
|
+
throw new Error(`Failed to read template directory: ${error}`);
|
|
120
|
+
}
|
|
121
|
+
if (files.length === 0) {
|
|
122
|
+
logger.warn(`No files found in template directory: ${sourceDir}`);
|
|
123
|
+
try {
|
|
124
|
+
const dirContents = await fs.readdir(sourceDir);
|
|
125
|
+
logger.debug(`Directory contents: ${dirContents.join(", ")}`);
|
|
126
|
+
} catch (e) {
|
|
127
|
+
logger.debug(`Could not read directory: ${e}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
for (const file of files) {
|
|
131
|
+
const sourcePath = path2.join(sourceDir, file);
|
|
132
|
+
const targetPath = path2.join(targetDir, file);
|
|
133
|
+
logger.debug(`Copying: ${file}`);
|
|
134
|
+
await fs.ensureDir(path2.dirname(targetPath));
|
|
135
|
+
let content = await fs.readFile(sourcePath, "utf8");
|
|
136
|
+
content = content.replace(/\{projectName\}/g, variables.projectName).replace(/\{humanReadableProjectName\}/g, variables.humanReadableProjectName).replace(/\{pikaUxVersion\}/g, variables.pikaUxVersion);
|
|
137
|
+
await fs.writeFile(targetPath, content, "utf8");
|
|
138
|
+
}
|
|
139
|
+
logger.debug(`Processed ${files.length} template files`);
|
|
140
|
+
}
|
|
141
|
+
async function copyAndProcessTemplate(templateDir, targetDir, variables) {
|
|
142
|
+
await fs.ensureDir(targetDir);
|
|
143
|
+
await processTemplateFiles(templateDir, targetDir, variables);
|
|
144
|
+
}
|
|
145
|
+
var execAsync2 = promisify(exec);
|
|
146
|
+
var __filename = fileURLToPath(import.meta.url);
|
|
147
|
+
var __dirname = path2.dirname(__filename);
|
|
148
|
+
var require2 = createRequire(import.meta.url);
|
|
149
|
+
async function createCommand(options = {}) {
|
|
150
|
+
try {
|
|
151
|
+
logger.newLine();
|
|
152
|
+
console.log(chalk2.bold.cyan("Create Pika Webcomponent Application"));
|
|
153
|
+
logger.divider();
|
|
154
|
+
let projectName = options.projectName;
|
|
155
|
+
if (!projectName) {
|
|
156
|
+
const nameAnswer = await inquirer.prompt([
|
|
157
|
+
{
|
|
158
|
+
type: "input",
|
|
159
|
+
name: "projectName",
|
|
160
|
+
message: "Project name:",
|
|
161
|
+
default: "my-webcomponent",
|
|
162
|
+
validate: validateProjectName
|
|
163
|
+
}
|
|
164
|
+
]);
|
|
165
|
+
projectName = nameAnswer.projectName;
|
|
166
|
+
} else {
|
|
167
|
+
const validation = validateProjectName(projectName);
|
|
168
|
+
if (validation !== true) {
|
|
169
|
+
logger.error(validation);
|
|
170
|
+
process.exit(1);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
const suggestedName = toHumanReadable(projectName);
|
|
174
|
+
let humanReadableName = options.humanReadableName;
|
|
175
|
+
if (!humanReadableName) {
|
|
176
|
+
const humanNameAnswer = await inquirer.prompt([
|
|
177
|
+
{
|
|
178
|
+
type: "input",
|
|
179
|
+
name: "humanReadableName",
|
|
180
|
+
message: "Human-readable project name:",
|
|
181
|
+
default: suggestedName
|
|
182
|
+
}
|
|
183
|
+
]);
|
|
184
|
+
humanReadableName = humanNameAnswer.humanReadableName;
|
|
185
|
+
}
|
|
186
|
+
const targetPath = path2.resolve(process.cwd(), projectName);
|
|
187
|
+
if (await fs.pathExists(targetPath)) {
|
|
188
|
+
const { overwrite } = await inquirer.prompt([
|
|
189
|
+
{
|
|
190
|
+
type: "confirm",
|
|
191
|
+
name: "overwrite",
|
|
192
|
+
message: `Directory "${projectName}" already exists. Overwrite?`,
|
|
193
|
+
default: false
|
|
194
|
+
}
|
|
195
|
+
]);
|
|
196
|
+
if (!overwrite) {
|
|
197
|
+
logger.warn("Project creation cancelled.");
|
|
198
|
+
process.exit(0);
|
|
199
|
+
}
|
|
200
|
+
await fs.remove(targetPath);
|
|
201
|
+
}
|
|
202
|
+
const spinner = logger.startSpinner("Creating project...");
|
|
203
|
+
try {
|
|
204
|
+
let pikaUxVersion = "1.0.0-beta.4";
|
|
205
|
+
try {
|
|
206
|
+
const pikaUxPackageJsonPath = require2.resolve("pika-ux/package.json");
|
|
207
|
+
const pikaUxPackageJson = await fs.readJson(pikaUxPackageJsonPath);
|
|
208
|
+
pikaUxVersion = pikaUxPackageJson.version;
|
|
209
|
+
} catch (error) {
|
|
210
|
+
logger.debug("Could not determine pika-ux version, using fallback");
|
|
211
|
+
}
|
|
212
|
+
let templateDir;
|
|
213
|
+
try {
|
|
214
|
+
const pikaUxRoot = path2.dirname(require2.resolve("pika-ux/package.json"));
|
|
215
|
+
templateDir = path2.join(pikaUxRoot, "dist/cli/template-files");
|
|
216
|
+
logger.debug(`Template directory resolved to: ${templateDir}`);
|
|
217
|
+
} catch (error) {
|
|
218
|
+
templateDir = path2.join(__dirname, "template-files");
|
|
219
|
+
logger.debug(`Using fallback template directory: ${templateDir}`);
|
|
220
|
+
}
|
|
221
|
+
if (!await fs.pathExists(templateDir)) {
|
|
222
|
+
throw new Error(`Template directory not found: ${templateDir}`);
|
|
223
|
+
}
|
|
224
|
+
logger.updateSpinner("Processing template files...");
|
|
225
|
+
await copyAndProcessTemplate(templateDir, targetPath, {
|
|
226
|
+
projectName,
|
|
227
|
+
humanReadableProjectName: humanReadableName,
|
|
228
|
+
pikaUxVersion
|
|
229
|
+
});
|
|
230
|
+
logger.debug(`Files copied to: ${targetPath}`);
|
|
231
|
+
logger.stopSpinner(true, "Template files processed");
|
|
232
|
+
const installSpinner = logger.startSpinner("Installing dependencies with pnpm...");
|
|
233
|
+
try {
|
|
234
|
+
await execAsync2("pnpm install", { cwd: targetPath });
|
|
235
|
+
logger.stopSpinner(true, "Dependencies installed");
|
|
236
|
+
} catch (error) {
|
|
237
|
+
logger.stopSpinner(false, "Failed to install dependencies");
|
|
238
|
+
logger.warn("You can install dependencies manually:");
|
|
239
|
+
console.log(` cd ${projectName} && pnpm install`);
|
|
240
|
+
}
|
|
241
|
+
showCompletionMessage(projectName, targetPath);
|
|
242
|
+
} catch (error) {
|
|
243
|
+
logger.stopSpinner(false, "Failed to create project");
|
|
244
|
+
throw error;
|
|
245
|
+
}
|
|
246
|
+
} catch (error) {
|
|
247
|
+
logger.error("Failed to create webcomponent application:");
|
|
248
|
+
console.error(error);
|
|
249
|
+
process.exit(1);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
function showCompletionMessage(projectName, projectPath) {
|
|
253
|
+
logger.newLine();
|
|
254
|
+
console.log(chalk2.green.bold(`\u2713 Successfully created ${projectName}!`));
|
|
255
|
+
logger.newLine();
|
|
256
|
+
console.log(chalk2.bold("Next steps:"));
|
|
257
|
+
const relativePath = path2.relative(process.cwd(), projectPath).split(path2.sep).join("/");
|
|
258
|
+
console.log(chalk2.gray(` cd ${relativePath}`));
|
|
259
|
+
console.log(chalk2.gray(" pnpm dev # Start development server"));
|
|
260
|
+
console.log(chalk2.gray(" pnpm build # Build for production"));
|
|
261
|
+
logger.newLine();
|
|
262
|
+
console.log(chalk2.bold("Available commands:"));
|
|
263
|
+
console.log(chalk2.gray(" pnpm dev - Start Vite dev server"));
|
|
264
|
+
console.log(chalk2.gray(" pnpm build - Build for production"));
|
|
265
|
+
console.log(chalk2.gray(" pnpm preview - Preview production build"));
|
|
266
|
+
console.log(chalk2.gray(" pnpm check - Run type checking"));
|
|
267
|
+
logger.newLine();
|
|
268
|
+
console.log(chalk2.bold("Learn more:"));
|
|
269
|
+
console.log(chalk2.gray(" \u2022 Pika UX Components: https://github.com/rithum/pika"));
|
|
270
|
+
console.log(chalk2.gray(" \u2022 Svelte Documentation: https://svelte.dev"));
|
|
271
|
+
console.log(chalk2.gray(" \u2022 Tailwind CSS: https://tailwindcss.com"));
|
|
272
|
+
logger.newLine();
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// tools/cli/index.ts
|
|
276
|
+
var __filename2 = fileURLToPath(import.meta.url);
|
|
277
|
+
var __dirname2 = path2.dirname(__filename2);
|
|
278
|
+
var packageJson = JSON.parse(readFileSync(path2.join(__dirname2, "../../package.json"), "utf8"));
|
|
279
|
+
var program = new Command();
|
|
280
|
+
program.name("pika-ux").description("CLI tool for creating Pika webcomponent applications").version(packageJson.version);
|
|
281
|
+
program.command("create").description("Create a new Pika webcomponent application").argument("[name]", "Project name").action(async (name) => {
|
|
282
|
+
await validateNodeVersion();
|
|
283
|
+
await validatePnpm();
|
|
284
|
+
await createCommand({ projectName: name });
|
|
285
|
+
});
|
|
286
|
+
program.on("--help", () => {
|
|
287
|
+
console.log("");
|
|
288
|
+
console.log(chalk2.bold("Examples:"));
|
|
289
|
+
console.log(chalk2.gray(" $ pika-ux create"));
|
|
290
|
+
console.log(chalk2.gray(" $ pika-ux create my-webcomponent"));
|
|
291
|
+
console.log("");
|
|
292
|
+
console.log(chalk2.dim('Tip: You can also use "pikaux" for shorter typing'));
|
|
293
|
+
console.log("");
|
|
294
|
+
});
|
|
295
|
+
program.exitOverride((err) => {
|
|
296
|
+
if (err.code === "commander.version" || err.code === "commander.help" || err.code === "commander.helpDisplayed") {
|
|
297
|
+
process.exit(0);
|
|
298
|
+
}
|
|
299
|
+
logger.error(`Command failed: ${err.message}`);
|
|
300
|
+
process.exit(1);
|
|
301
|
+
});
|
|
302
|
+
process.on("uncaughtException", (error) => {
|
|
303
|
+
logger.error("Uncaught Exception:", error);
|
|
304
|
+
process.exit(1);
|
|
305
|
+
});
|
|
306
|
+
process.on("unhandledRejection", (reason, promise) => {
|
|
307
|
+
logger.error("Unhandled Rejection at:", promise, "reason:", reason);
|
|
308
|
+
process.exit(1);
|
|
309
|
+
});
|
|
310
|
+
console.log(
|
|
311
|
+
chalk2.cyan(`
|
|
312
|
+
\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
|
|
313
|
+
\u2551 \u2551
|
|
314
|
+
\u2551 \u{1F3A8} Pika UX Webcomponent CLI \u2551
|
|
315
|
+
\u2551 Create webcomponents with ease \u2551
|
|
316
|
+
\u2551 \u2551
|
|
317
|
+
\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
|
|
318
|
+
`)
|
|
319
|
+
);
|
|
320
|
+
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.68
|
|
4
|
+
'@internationalized/date': ^3.8.1
|
|
5
|
+
'@lucide/svelte': ^0.544.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.4.1
|
|
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
|
+
}
|