@swarm.ing/pieui 2.0.10 → 2.0.11
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 +48 -0
- package/dist/cli.js +401 -82
- package/dist/code/args.d.ts.map +1 -1
- package/dist/code/commands/add.d.ts +2 -2
- package/dist/code/commands/add.d.ts.map +1 -1
- package/dist/code/commands/create.d.ts +2 -0
- package/dist/code/commands/create.d.ts.map +1 -0
- package/dist/code/commands/init.d.ts.map +1 -1
- package/dist/code/commands/pageAdd.d.ts +2 -0
- package/dist/code/commands/pageAdd.d.ts.map +1 -0
- package/dist/code/templates/componentTypes.d.ts +2 -1
- package/dist/code/templates/componentTypes.d.ts.map +1 -1
- package/dist/code/templates/index.d.ts +2 -4
- package/dist/code/templates/index.d.ts.map +1 -1
- package/dist/code/templates/pages/components/complexComponent.d.ts +3 -0
- package/dist/code/templates/pages/components/complexComponent.d.ts.map +1 -0
- package/dist/code/templates/pages/components/complexContainerComponent.d.ts +3 -0
- package/dist/code/templates/pages/components/complexContainerComponent.d.ts.map +1 -0
- package/dist/code/templates/pages/components/index.d.ts +5 -0
- package/dist/code/templates/pages/components/index.d.ts.map +1 -0
- package/dist/code/templates/pages/components/shared.d.ts +5 -0
- package/dist/code/templates/pages/components/shared.d.ts.map +1 -0
- package/dist/code/templates/pages/components/simpleComponent.d.ts +3 -0
- package/dist/code/templates/pages/components/simpleComponent.d.ts.map +1 -0
- package/dist/code/templates/pages/components/simpleContainerComponent.d.ts +3 -0
- package/dist/code/templates/pages/components/simpleContainerComponent.d.ts.map +1 -0
- package/dist/code/templates/pages/index.d.ts +6 -0
- package/dist/code/templates/pages/index.d.ts.map +1 -0
- package/dist/code/templates/pages/page.d.ts +2 -0
- package/dist/code/templates/pages/page.d.ts.map +1 -0
- package/dist/code/types.d.ts +11 -0
- package/dist/code/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/code/templates/complexComponent.d.ts +0 -2
- package/dist/code/templates/complexComponent.d.ts.map +0 -1
- package/dist/code/templates/complexContainerComponent.d.ts +0 -2
- package/dist/code/templates/complexContainerComponent.d.ts.map +0 -1
- package/dist/code/templates/simpleComponent.d.ts +0 -2
- package/dist/code/templates/simpleComponent.d.ts.map +0 -1
- package/dist/code/templates/simpleContainerComponent.d.ts +0 -2
- package/dist/code/templates/simpleContainerComponent.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -91,6 +91,18 @@ Type exports:
|
|
|
91
91
|
|
|
92
92
|
## CLI Template Scaffolding
|
|
93
93
|
|
|
94
|
+
Create a fresh Next.js app and initialize PieUI in it:
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
bunx pieui create my-app-name
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
This command:
|
|
101
|
+
|
|
102
|
+
- runs `bun create next-app@latest my-app-name --yes`
|
|
103
|
+
- initializes `piecomponents/registry.ts` and PieUI config in the new app
|
|
104
|
+
- prepares the app for `bunx pieui card add ...`
|
|
105
|
+
|
|
94
106
|
Create a blank Next.js web app template with PieUI CLI:
|
|
95
107
|
|
|
96
108
|
```sh
|
|
@@ -115,3 +127,39 @@ Planned create flow target:
|
|
|
115
127
|
```sh
|
|
116
128
|
bun create pieui@latest my-pie-app
|
|
117
129
|
```
|
|
130
|
+
|
|
131
|
+
Create a page scaffold inside an existing Next app:
|
|
132
|
+
|
|
133
|
+
```sh
|
|
134
|
+
bunx pieui page add chat
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
This command writes `app/chat/page.tsx` with the standard Suspense-wrapped Pie page shell:
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
"use client";
|
|
141
|
+
|
|
142
|
+
import PiePage from "@/app/_shared/simple";
|
|
143
|
+
import { Suspense } from "react";
|
|
144
|
+
import LoadingScreen from "@/components/LoadingScreen";
|
|
145
|
+
|
|
146
|
+
export default function ChatPage() {
|
|
147
|
+
return (
|
|
148
|
+
<Suspense fallback={<LoadingScreen />}>
|
|
149
|
+
<PiePage />
|
|
150
|
+
</Suspense>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Create a component scaffold inside `piecomponents/`:
|
|
156
|
+
|
|
157
|
+
```sh
|
|
158
|
+
bunx pieui card add simple StatusCard
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Add optional realtime and AJAX fields to the generated `types/index.ts`:
|
|
162
|
+
|
|
163
|
+
```sh
|
|
164
|
+
bunx pieui card add simple LiveCard --io --ajax
|
|
165
|
+
```
|
package/dist/cli.js
CHANGED
|
@@ -193027,6 +193027,7 @@ var require_lib4 = __commonJS((exports2, module2) => {
|
|
|
193027
193027
|
// src/code/args.ts
|
|
193028
193028
|
var parseArgs = (argv) => {
|
|
193029
193029
|
const [command = ""] = argv;
|
|
193030
|
+
const cardFlagSet = new Set(["--io", "--ajax"]);
|
|
193030
193031
|
const outDirFlag = argv.find((arg) => arg.startsWith("--out-dir="));
|
|
193031
193032
|
const srcDirFlag = argv.find((arg) => arg.startsWith("--src-dir="));
|
|
193032
193033
|
const outDirIndex = argv.findIndex((arg) => arg === "--out-dir" || arg === "-o");
|
|
@@ -193038,12 +193039,17 @@ var parseArgs = (argv) => {
|
|
|
193038
193039
|
let componentName;
|
|
193039
193040
|
let createAppName;
|
|
193040
193041
|
let eventName;
|
|
193042
|
+
let cardAction;
|
|
193043
|
+
let cardAjax = false;
|
|
193044
|
+
let cardIo = false;
|
|
193045
|
+
let pageAction;
|
|
193046
|
+
let pagePath;
|
|
193041
193047
|
let removeComponentName;
|
|
193042
193048
|
let listFilter;
|
|
193043
193049
|
if (command === "remove" && argv[1]) {
|
|
193044
193050
|
removeComponentName = argv[1];
|
|
193045
193051
|
}
|
|
193046
|
-
if (command === "create-pie-app" && argv[1]) {
|
|
193052
|
+
if ((command === "create-pie-app" || command === "create") && argv[1]) {
|
|
193047
193053
|
createAppName = argv[1];
|
|
193048
193054
|
}
|
|
193049
193055
|
if (command === "list") {
|
|
@@ -193057,19 +193063,37 @@ var parseArgs = (argv) => {
|
|
|
193057
193063
|
const filterArg = argv[1];
|
|
193058
193064
|
listFilter = filterArg && validFilters.includes(filterArg) ? filterArg : "all";
|
|
193059
193065
|
}
|
|
193060
|
-
if (command === "
|
|
193066
|
+
if (command === "card" && argv[1]) {
|
|
193067
|
+
const validActions = ["add"];
|
|
193068
|
+
if (validActions.includes(argv[1])) {
|
|
193069
|
+
cardAction = argv[1];
|
|
193070
|
+
}
|
|
193071
|
+
}
|
|
193072
|
+
if ((command === "card" && cardAction === "add" || command === "add") && argv[1]) {
|
|
193073
|
+
const offset = command === "card" ? 2 : 1;
|
|
193074
|
+
const cardArgv = argv.slice(offset);
|
|
193075
|
+
const positionalArgs = cardArgv.filter((arg) => !cardFlagSet.has(arg));
|
|
193076
|
+
cardIo = cardArgv.includes("--io");
|
|
193077
|
+
cardAjax = cardArgv.includes("--ajax");
|
|
193061
193078
|
const validTypes = [
|
|
193062
193079
|
"simple",
|
|
193063
193080
|
"complex",
|
|
193064
193081
|
"simple-container",
|
|
193065
193082
|
"complex-container"
|
|
193066
193083
|
];
|
|
193067
|
-
if (validTypes.includes(
|
|
193068
|
-
componentType =
|
|
193069
|
-
componentName =
|
|
193084
|
+
if (validTypes.includes(positionalArgs[0])) {
|
|
193085
|
+
componentType = positionalArgs[0];
|
|
193086
|
+
componentName = positionalArgs[1];
|
|
193070
193087
|
} else {
|
|
193071
193088
|
componentType = "complex-container";
|
|
193072
|
-
componentName =
|
|
193089
|
+
componentName = positionalArgs[0];
|
|
193090
|
+
}
|
|
193091
|
+
}
|
|
193092
|
+
if (command === "page" && argv[1]) {
|
|
193093
|
+
const validActions = ["add"];
|
|
193094
|
+
if (validActions.includes(argv[1])) {
|
|
193095
|
+
pageAction = argv[1];
|
|
193096
|
+
pagePath = argv[2];
|
|
193073
193097
|
}
|
|
193074
193098
|
}
|
|
193075
193099
|
if (command === "list-events" && argv[1]) {
|
|
@@ -193102,16 +193126,23 @@ var parseArgs = (argv) => {
|
|
|
193102
193126
|
componentType,
|
|
193103
193127
|
eventName,
|
|
193104
193128
|
removeComponentName,
|
|
193105
|
-
listFilter
|
|
193129
|
+
listFilter,
|
|
193130
|
+
cardAction,
|
|
193131
|
+
cardAjax,
|
|
193132
|
+
cardIo,
|
|
193133
|
+
pageAction,
|
|
193134
|
+
pagePath
|
|
193106
193135
|
};
|
|
193107
193136
|
};
|
|
193108
193137
|
var printUsage = () => {
|
|
193109
193138
|
console.log("Usage: pieui <command> [options]");
|
|
193110
193139
|
console.log("");
|
|
193111
193140
|
console.log("Commands:");
|
|
193141
|
+
console.log(" create <AppName> Create a Next.js app and run pieui init inside it");
|
|
193112
193142
|
console.log(" create-pie-app <AppName> Create a blank Next.js web template for PieUI (bun create next-app under the hood)");
|
|
193113
193143
|
console.log(" init Initialize piecomponents directory with registry.ts");
|
|
193114
|
-
console.log(" add [type] <ComponentName>
|
|
193144
|
+
console.log(" card add [type] <ComponentName> [--io] [--ajax] Create a new component in piecomponents directory");
|
|
193145
|
+
console.log(" page add <path> Create app/<path>/page.tsx from the standard Pie page template");
|
|
193115
193146
|
console.log(" push <ComponentName> Archive piecomponents/<ComponentName> and upload to PieUI server");
|
|
193116
193147
|
console.log(" pull <ComponentName> Download archive from PieUI server and extract into piecomponents/<ComponentName>");
|
|
193117
193148
|
console.log(" remote-remove <ComponentName> Remove remote component from PieUI server");
|
|
@@ -193121,13 +193152,17 @@ var printUsage = () => {
|
|
|
193121
193152
|
console.log(" postbuild Scan for components and generate manifest");
|
|
193122
193153
|
console.log(" list [filter] List registered components in a table");
|
|
193123
193154
|
console.log("");
|
|
193124
|
-
console.log("Component types for add command:");
|
|
193155
|
+
console.log("Component types for card add command:");
|
|
193125
193156
|
console.log(" simple Simple component (only data prop)");
|
|
193126
193157
|
console.log(" complex Complex component (data + children props)");
|
|
193127
193158
|
console.log(" simple-container Container with single content (data + content)");
|
|
193128
193159
|
console.log(" complex-container Container with array content (data + content[])");
|
|
193129
193160
|
console.log(" (default if type not specified)");
|
|
193130
193161
|
console.log("");
|
|
193162
|
+
console.log("Options for card add:");
|
|
193163
|
+
console.log(" --io Add realtime support fields to the generated data interface");
|
|
193164
|
+
console.log(" --ajax Add AJAX request fields to the generated data interface");
|
|
193165
|
+
console.log("");
|
|
193131
193166
|
console.log("Options for init:");
|
|
193132
193167
|
console.log(" --out-dir <dir>, -o <dir> Base directory for piecomponents (default: .)");
|
|
193133
193168
|
console.log("");
|
|
@@ -193154,11 +193189,14 @@ var printUsage = () => {
|
|
|
193154
193189
|
console.log("");
|
|
193155
193190
|
console.log("Examples:");
|
|
193156
193191
|
console.log(" pieui init");
|
|
193192
|
+
console.log(" pieui create my-pie-app");
|
|
193157
193193
|
console.log(" pieui create-pie-app my-pie-app");
|
|
193158
193194
|
console.log(" pieui init --out-dir packages/app");
|
|
193159
|
-
console.log(" pieui add MyCustomCard
|
|
193160
|
-
console.log(" pieui add simple MySimpleCard
|
|
193161
|
-
console.log(" pieui add complex-container MyContainerCard
|
|
193195
|
+
console.log(" pieui card add MyCustomCard # Creates complex-container by default");
|
|
193196
|
+
console.log(" pieui card add simple MySimpleCard # Creates simple component");
|
|
193197
|
+
console.log(" pieui card add complex-container MyContainerCard # Creates complex container");
|
|
193198
|
+
console.log(" pieui card add simple LiveCard --io --ajax # Adds realtime and AJAX fields");
|
|
193199
|
+
console.log(" pieui page add chat # Creates app/chat/page.tsx");
|
|
193162
193200
|
console.log(" pieui postbuild --append --out-dir dist");
|
|
193163
193201
|
console.log(" pieui list # List all components");
|
|
193164
193202
|
console.log(" pieui list simple # List only simple components");
|
|
@@ -193175,7 +193213,7 @@ var import_fs = __toESM(require("fs"));
|
|
|
193175
193213
|
var import_path = __toESM(require("path"));
|
|
193176
193214
|
|
|
193177
193215
|
// src/code/templates/componentIndex.ts
|
|
193178
|
-
var componentIndexTemplate = (componentName) => `import { registerPieComponent } from "@
|
|
193216
|
+
var componentIndexTemplate = (componentName) => `import { registerPieComponent } from "@swarm.ing/pieui";
|
|
193179
193217
|
import ${componentName} from "./ui/${componentName}";
|
|
193180
193218
|
|
|
193181
193219
|
export default registerPieComponent({
|
|
@@ -193185,26 +193223,113 @@ export default registerPieComponent({
|
|
|
193185
193223
|
`;
|
|
193186
193224
|
|
|
193187
193225
|
// src/code/templates/componentTypes.ts
|
|
193188
|
-
var
|
|
193226
|
+
var ioFields = ` useSocketioSupport?: boolean
|
|
193227
|
+
useCentrifugeSupport?: boolean
|
|
193228
|
+
useMittSupport?: boolean
|
|
193229
|
+
centrifugeChannel?: string`;
|
|
193230
|
+
var ajaxFields = ` pathname?: string
|
|
193231
|
+
depsNames: string[]
|
|
193232
|
+
kwargs: Record<string, string | number | boolean>`;
|
|
193233
|
+
var componentTypesTemplate = (componentName, baseInterface, options = {}) => {
|
|
193234
|
+
const extraSections = [options.io ? ioFields : "", options.ajax ? ajaxFields : ""].filter(Boolean).join(`
|
|
193235
|
+
|
|
193236
|
+
`);
|
|
193237
|
+
const extraFields = extraSections ? `
|
|
193238
|
+
|
|
193239
|
+
${extraSections}` : "";
|
|
193240
|
+
return `import { ${baseInterface} } from '@swarm.ing/pieui'
|
|
193189
193241
|
|
|
193190
193242
|
export interface ${componentName}Data {
|
|
193191
193243
|
name: string
|
|
193192
193244
|
// Add your component-specific props here
|
|
193245
|
+
${extraFields}
|
|
193193
193246
|
}
|
|
193194
193247
|
|
|
193195
193248
|
export type ${componentName}Props = ${baseInterface}<${componentName}Data>
|
|
193196
193249
|
`;
|
|
193250
|
+
};
|
|
193251
|
+
|
|
193252
|
+
// src/code/templates/nextConfig.ts
|
|
193253
|
+
var REQUIRED_NEXT_CONFIG_ENV_KEYS = [
|
|
193254
|
+
"PIE_API_SERVER",
|
|
193255
|
+
"PIE_CENTRIFUGE_SERVER",
|
|
193256
|
+
"PIE_ENABLE_RENDERING_LOG",
|
|
193257
|
+
"PIE_PLATFORM"
|
|
193258
|
+
];
|
|
193259
|
+
var nextConfigTemplate = () => `import type { NextConfig } from "next";
|
|
193260
|
+
|
|
193261
|
+
const nextConfig: NextConfig = {
|
|
193262
|
+
output: "standalone",
|
|
193263
|
+
reactCompiler: false,
|
|
193264
|
+
env: {
|
|
193265
|
+
PIE_API_SERVER: process.env.PIE_API_SERVER,
|
|
193266
|
+
PIE_CENTRIFUGE_SERVER: process.env.PIE_CENTRIFUGE_SERVER,
|
|
193267
|
+
PIE_ENABLE_RENDERING_LOG: process.env.PIE_ENABLE_RENDERING_LOG,
|
|
193268
|
+
PIE_PLATFORM: process.env.PIE_PLATFORM || "telegram",
|
|
193269
|
+
},
|
|
193270
|
+
reactStrictMode: true,
|
|
193271
|
+
transpilePackages: ["@swarm.ing/pieui"],
|
|
193272
|
+
};
|
|
193273
|
+
|
|
193274
|
+
export default nextConfig;
|
|
193275
|
+
`;
|
|
193276
|
+
|
|
193277
|
+
// src/code/templates/pages/components/shared.ts
|
|
193278
|
+
var dataDestructureFor = (options = {}) => {
|
|
193279
|
+
if (!options.io && !options.ajax) {
|
|
193280
|
+
return "const { name } = data";
|
|
193281
|
+
}
|
|
193282
|
+
const fields = ["name"];
|
|
193283
|
+
if (options.io) {
|
|
193284
|
+
fields.push("useSocketioSupport", "useCentrifugeSupport", "useMittSupport", "centrifugeChannel");
|
|
193285
|
+
}
|
|
193286
|
+
if (options.ajax) {
|
|
193287
|
+
fields.push("pathname", "depsNames", "kwargs");
|
|
193288
|
+
}
|
|
193289
|
+
return `const {
|
|
193290
|
+
${fields.join(`,
|
|
193291
|
+
`)},
|
|
193292
|
+
} = data`;
|
|
193293
|
+
};
|
|
193294
|
+
var pieCardOpeningTagFor = (componentName, options = {}) => {
|
|
193295
|
+
if (!options.io) {
|
|
193296
|
+
return `<PieCard card='${componentName}' data={data}>`;
|
|
193297
|
+
}
|
|
193298
|
+
return `<PieCard
|
|
193299
|
+
card='${componentName}'
|
|
193300
|
+
data={data}
|
|
193301
|
+
useSocketioSupport={useSocketioSupport}
|
|
193302
|
+
useCentrifugeSupport={useCentrifugeSupport}
|
|
193303
|
+
useMittSupport={useMittSupport}
|
|
193304
|
+
centrifugeChannel={centrifugeChannel}
|
|
193305
|
+
methods={{
|
|
193306
|
+
}}
|
|
193307
|
+
>`;
|
|
193308
|
+
};
|
|
193309
|
+
var ajaxSubmitDeclarationFor = (options = {}) => {
|
|
193310
|
+
if (!options.ajax) {
|
|
193311
|
+
return "";
|
|
193312
|
+
}
|
|
193313
|
+
return `
|
|
193314
|
+
const ajaxSubmit = useAjaxSubmit(
|
|
193315
|
+
setUiAjaxConfiguration,
|
|
193316
|
+
kwargs,
|
|
193317
|
+
depsNames,
|
|
193318
|
+
pathname
|
|
193319
|
+
)`;
|
|
193320
|
+
};
|
|
193197
193321
|
|
|
193198
|
-
// src/code/templates/simpleComponent.ts
|
|
193199
|
-
var simpleComponentTemplate = (componentName) => `import React from 'react'
|
|
193200
|
-
import { PieCard } from '@
|
|
193322
|
+
// src/code/templates/pages/components/simpleComponent.ts
|
|
193323
|
+
var simpleComponentTemplate = (componentName, options = {}) => `import React from 'react'
|
|
193324
|
+
import { PieCard${options.ajax ? ", useAjaxSubmit, type SetUiAjaxConfigurationType" : ""} } from '@swarm.ing/pieui'
|
|
193201
193325
|
import { ${componentName}Props } from '../types'
|
|
193202
193326
|
|
|
193203
|
-
const ${componentName} = ({ data }: ${componentName}Props) => {
|
|
193204
|
-
|
|
193327
|
+
const ${componentName} = ({ data${options.ajax ? ", setUiAjaxConfiguration" : ""} }: ${componentName}Props${options.ajax ? " & { setUiAjaxConfiguration?: SetUiAjaxConfigurationType }" : ""}) => {
|
|
193328
|
+
${dataDestructureFor(options)}
|
|
193329
|
+
${ajaxSubmitDeclarationFor(options)}
|
|
193205
193330
|
|
|
193206
193331
|
return (
|
|
193207
|
-
|
|
193332
|
+
${pieCardOpeningTagFor(componentName, options)}
|
|
193208
193333
|
<div>
|
|
193209
193334
|
<h2>${componentName}</h2>
|
|
193210
193335
|
{/* Add your component logic here */}
|
|
@@ -193215,17 +193340,17 @@ const ${componentName} = ({ data }: ${componentName}Props) => {
|
|
|
193215
193340
|
|
|
193216
193341
|
export default ${componentName}
|
|
193217
193342
|
`;
|
|
193218
|
-
|
|
193219
|
-
|
|
193220
|
-
|
|
193221
|
-
import { PieCard } from '@piedata/pieui'
|
|
193343
|
+
// src/code/templates/pages/components/complexComponent.ts
|
|
193344
|
+
var complexComponentTemplate = (componentName, options = {}) => `import React from 'react'
|
|
193345
|
+
import { PieCard${options.ajax ? ", useAjaxSubmit" : ""} } from '@swarm.ing/pieui'
|
|
193222
193346
|
import { ${componentName}Props } from '../types'
|
|
193223
193347
|
|
|
193224
|
-
const ${componentName} = ({ data }: ${componentName}Props) => {
|
|
193225
|
-
|
|
193348
|
+
const ${componentName} = ({ data${options.ajax ? ", setUiAjaxConfiguration" : ""} }: ${componentName}Props) => {
|
|
193349
|
+
${dataDestructureFor(options)}
|
|
193350
|
+
${ajaxSubmitDeclarationFor(options)}
|
|
193226
193351
|
|
|
193227
193352
|
return (
|
|
193228
|
-
|
|
193353
|
+
${pieCardOpeningTagFor(componentName, options)}
|
|
193229
193354
|
<div>
|
|
193230
193355
|
<h2>${componentName}</h2>
|
|
193231
193356
|
{/* Add your component logic here */}
|
|
@@ -193236,10 +193361,9 @@ const ${componentName} = ({ data }: ${componentName}Props) => {
|
|
|
193236
193361
|
|
|
193237
193362
|
export default ${componentName}
|
|
193238
193363
|
`;
|
|
193239
|
-
|
|
193240
|
-
|
|
193241
|
-
|
|
193242
|
-
import { PieCard, UI, UIRendererContext } from '@piedata/pieui'
|
|
193364
|
+
// src/code/templates/pages/components/simpleContainerComponent.ts
|
|
193365
|
+
var simpleContainerComponentTemplate = (componentName, options = {}) => `import React, { useContext } from 'react'
|
|
193366
|
+
import { PieCard, UI, UIRendererContext${options.ajax ? ", useAjaxSubmit" : ""} } from '@swarm.ing/pieui'
|
|
193243
193367
|
import { ${componentName}Props } from '../types'
|
|
193244
193368
|
|
|
193245
193369
|
const ${componentName} = ({
|
|
@@ -193247,11 +193371,12 @@ const ${componentName} = ({
|
|
|
193247
193371
|
content,
|
|
193248
193372
|
setUiAjaxConfiguration,
|
|
193249
193373
|
}: ${componentName}Props) => {
|
|
193250
|
-
|
|
193374
|
+
${dataDestructureFor(options)}
|
|
193375
|
+
${ajaxSubmitDeclarationFor(options)}
|
|
193251
193376
|
const Renderer = useContext(UIRendererContext) ?? UI
|
|
193252
193377
|
|
|
193253
193378
|
return (
|
|
193254
|
-
|
|
193379
|
+
${pieCardOpeningTagFor(componentName, options)}
|
|
193255
193380
|
<div>
|
|
193256
193381
|
<h2>${componentName}</h2>
|
|
193257
193382
|
{/* Add your component logic here */}
|
|
@@ -193268,10 +193393,9 @@ const ${componentName} = ({
|
|
|
193268
193393
|
|
|
193269
193394
|
export default ${componentName}
|
|
193270
193395
|
`;
|
|
193271
|
-
|
|
193272
|
-
|
|
193273
|
-
|
|
193274
|
-
import { PieCard, UI, UIRendererContext } from '@piedata/pieui'
|
|
193396
|
+
// src/code/templates/pages/components/complexContainerComponent.ts
|
|
193397
|
+
var complexContainerComponentTemplate = (componentName, options = {}) => `import React, { useContext } from 'react'
|
|
193398
|
+
import { PieCard, UI, UIRendererContext${options.ajax ? ", useAjaxSubmit" : ""} } from '@swarm.ing/pieui'
|
|
193275
193399
|
import { ${componentName}Props } from '../types'
|
|
193276
193400
|
|
|
193277
193401
|
const ${componentName} = ({
|
|
@@ -193279,11 +193403,12 @@ const ${componentName} = ({
|
|
|
193279
193403
|
content,
|
|
193280
193404
|
setUiAjaxConfiguration,
|
|
193281
193405
|
}: ${componentName}Props) => {
|
|
193282
|
-
|
|
193406
|
+
${dataDestructureFor(options)}
|
|
193407
|
+
${ajaxSubmitDeclarationFor(options)}
|
|
193283
193408
|
const Renderer = useContext(UIRendererContext) ?? UI
|
|
193284
193409
|
|
|
193285
193410
|
return (
|
|
193286
|
-
|
|
193411
|
+
${pieCardOpeningTagFor(componentName, options)}
|
|
193287
193412
|
<div>
|
|
193288
193413
|
<h2>${componentName}</h2>
|
|
193289
193414
|
{/* Add your component logic here */}
|
|
@@ -193301,33 +193426,22 @@ const ${componentName} = ({
|
|
|
193301
193426
|
|
|
193302
193427
|
export default ${componentName}
|
|
193303
193428
|
`;
|
|
193429
|
+
// src/code/templates/pages/page.ts
|
|
193430
|
+
var pageTemplate = (pageComponentName) => `"use client";
|
|
193304
193431
|
|
|
193305
|
-
|
|
193306
|
-
|
|
193307
|
-
"PIE_API_SERVER",
|
|
193308
|
-
"PIE_CENTRIFUGE_SERVER",
|
|
193309
|
-
"PIE_ENABLE_RENDERING_LOG",
|
|
193310
|
-
"PIE_PLATFORM"
|
|
193311
|
-
];
|
|
193312
|
-
var nextConfigTemplate = () => `import type { NextConfig } from "next";
|
|
193432
|
+
import PiePage from "@/app/_shared/page";
|
|
193433
|
+
import { Suspense } from "react";
|
|
193313
193434
|
|
|
193314
|
-
|
|
193315
|
-
|
|
193316
|
-
|
|
193317
|
-
|
|
193318
|
-
|
|
193319
|
-
|
|
193320
|
-
|
|
193321
|
-
PIE_PLATFORM: process.env.PIE_PLATFORM || "telegram",
|
|
193322
|
-
},
|
|
193323
|
-
reactStrictMode: true,
|
|
193324
|
-
transpilePackages: ["@piedata/pieui"],
|
|
193325
|
-
};
|
|
193326
|
-
|
|
193327
|
-
export default nextConfig;
|
|
193435
|
+
export default function ${pageComponentName}() {
|
|
193436
|
+
return (
|
|
193437
|
+
<Suspense fallback={<></>}>
|
|
193438
|
+
<PiePage />
|
|
193439
|
+
</Suspense>
|
|
193440
|
+
);
|
|
193441
|
+
}
|
|
193328
193442
|
`;
|
|
193329
193443
|
|
|
193330
|
-
// src/code/templates/index.ts
|
|
193444
|
+
// src/code/templates/pages/index.ts
|
|
193331
193445
|
var BASE_INTERFACE_BY_TYPE = {
|
|
193332
193446
|
simple: "PieSimpleComponentProps",
|
|
193333
193447
|
complex: "PieComplexComponentProps",
|
|
@@ -193335,17 +193449,17 @@ var BASE_INTERFACE_BY_TYPE = {
|
|
|
193335
193449
|
"complex-container": "PieComplexContainerComponentProps"
|
|
193336
193450
|
};
|
|
193337
193451
|
var baseInterfaceFor = (componentType) => BASE_INTERFACE_BY_TYPE[componentType];
|
|
193338
|
-
var componentTemplateFor = (componentType, componentName) => {
|
|
193452
|
+
var componentTemplateFor = (componentType, componentName, options = {}) => {
|
|
193339
193453
|
switch (componentType) {
|
|
193340
193454
|
case "simple":
|
|
193341
|
-
return simpleComponentTemplate(componentName);
|
|
193455
|
+
return simpleComponentTemplate(componentName, options);
|
|
193342
193456
|
case "complex":
|
|
193343
|
-
return complexComponentTemplate(componentName);
|
|
193457
|
+
return complexComponentTemplate(componentName, options);
|
|
193344
193458
|
case "simple-container":
|
|
193345
|
-
return simpleContainerComponentTemplate(componentName);
|
|
193459
|
+
return simpleContainerComponentTemplate(componentName, options);
|
|
193346
193460
|
case "complex-container":
|
|
193347
193461
|
default:
|
|
193348
|
-
return complexContainerComponentTemplate(componentName);
|
|
193462
|
+
return complexContainerComponentTemplate(componentName, options);
|
|
193349
193463
|
}
|
|
193350
193464
|
};
|
|
193351
193465
|
|
|
@@ -193375,7 +193489,7 @@ var initCommand = (outDir) => {
|
|
|
193375
193489
|
}
|
|
193376
193490
|
const tailwindConfigPath = import_path.default.join(resolvedOutDir, "tailwind.config.js");
|
|
193377
193491
|
const tailwindConfigTsPath = import_path.default.join(resolvedOutDir, "tailwind.config.ts");
|
|
193378
|
-
const pieuiContentPath = "./node_modules/@
|
|
193492
|
+
const pieuiContentPath = "./node_modules/@swarm.ing/pieui/dist/**/*.{js,mjs,ts,jsx,tsx}";
|
|
193379
193493
|
let configPath = null;
|
|
193380
193494
|
if (import_fs.default.existsSync(tailwindConfigPath)) {
|
|
193381
193495
|
configPath = tailwindConfigPath;
|
|
@@ -193418,7 +193532,7 @@ var initCommand = (outDir) => {
|
|
|
193418
193532
|
console.log("[pieui] Initialization complete!");
|
|
193419
193533
|
console.log("[pieui] Next steps:");
|
|
193420
193534
|
console.log(' 1. Import "./piecomponents/registry" in your app entry point');
|
|
193421
|
-
console.log(' 2. Use "pieui add <ComponentName>" to create new components');
|
|
193535
|
+
console.log(' 2. Use "pieui card add <ComponentName>" to create new components');
|
|
193422
193536
|
};
|
|
193423
193537
|
var ensureNextConfig = (resolvedOutDir) => {
|
|
193424
193538
|
const candidates = [
|
|
@@ -193493,16 +193607,16 @@ ${missingKeys.map(envEntryFor).join(`
|
|
|
193493
193607
|
var ensureTranspilePieui = (content) => {
|
|
193494
193608
|
const match = content.match(/transpilePackages\s*:\s*\[([\s\S]*?)]/);
|
|
193495
193609
|
if (match) {
|
|
193496
|
-
if (match[1].includes("@
|
|
193610
|
+
if (match[1].includes("@swarm.ing/pieui"))
|
|
193497
193611
|
return content;
|
|
193498
193612
|
const inner = match[1].trim();
|
|
193499
193613
|
const separator = inner.length > 0 ? ", " : "";
|
|
193500
|
-
console.log('[pieui] Adding "@
|
|
193501
|
-
return content.replace(match[0], `transpilePackages: [${inner}${separator}"@
|
|
193614
|
+
console.log('[pieui] Adding "@swarm.ing/pieui" to transpilePackages');
|
|
193615
|
+
return content.replace(match[0], `transpilePackages: [${inner}${separator}"@swarm.ing/pieui"]`);
|
|
193502
193616
|
}
|
|
193503
|
-
const inserted = insertIntoConfigObject(content, ' transpilePackages: ["@
|
|
193617
|
+
const inserted = insertIntoConfigObject(content, ' transpilePackages: ["@swarm.ing/pieui"],');
|
|
193504
193618
|
if (inserted) {
|
|
193505
|
-
console.log('[pieui] Adding transpilePackages: ["@
|
|
193619
|
+
console.log('[pieui] Adding transpilePackages: ["@swarm.ing/pieui"]');
|
|
193506
193620
|
return inserted;
|
|
193507
193621
|
}
|
|
193508
193622
|
console.log("[pieui] Warning: could not locate nextConfig object to add transpilePackages automatically");
|
|
@@ -193557,10 +193671,10 @@ var updateRegistryFile = (registryPath, componentName, componentDir) => {
|
|
|
193557
193671
|
`;
|
|
193558
193672
|
import_fs3.default.writeFileSync(registryPath, registryContent, "utf8");
|
|
193559
193673
|
};
|
|
193560
|
-
var addCommand = (componentName, componentType = "complex-container") => {
|
|
193674
|
+
var addCommand = (componentName, componentType = "complex-container", options = {}) => {
|
|
193561
193675
|
if (!componentName) {
|
|
193562
193676
|
console.error("[pieui] Error: Component name is required");
|
|
193563
|
-
console.log("Usage: pieui add [type] <ComponentName>");
|
|
193677
|
+
console.log("Usage: pieui card add [type] <ComponentName>");
|
|
193564
193678
|
process.exit(1);
|
|
193565
193679
|
}
|
|
193566
193680
|
if (!/^[A-Z][a-zA-Z0-9]+$/.test(componentName)) {
|
|
@@ -193583,8 +193697,8 @@ var addCommand = (componentName, componentType = "complex-container") => {
|
|
|
193583
193697
|
import_fs3.default.mkdirSync(import_path3.default.join(componentDir, "ui"), { recursive: true });
|
|
193584
193698
|
import_fs3.default.mkdirSync(import_path3.default.join(componentDir, "types"), { recursive: true });
|
|
193585
193699
|
import_fs3.default.writeFileSync(import_path3.default.join(componentDir, "index.ts"), componentIndexTemplate(componentName), "utf8");
|
|
193586
|
-
import_fs3.default.writeFileSync(import_path3.default.join(componentDir, "types", "index.ts"), componentTypesTemplate(componentName, baseInterfaceFor(componentType)), "utf8");
|
|
193587
|
-
import_fs3.default.writeFileSync(import_path3.default.join(componentDir, "ui", `${componentName}.tsx`), componentTemplateFor(componentType, componentName), "utf8");
|
|
193700
|
+
import_fs3.default.writeFileSync(import_path3.default.join(componentDir, "types", "index.ts"), componentTypesTemplate(componentName, baseInterfaceFor(componentType), options), "utf8");
|
|
193701
|
+
import_fs3.default.writeFileSync(import_path3.default.join(componentDir, "ui", `${componentName}.tsx`), componentTemplateFor(componentType, componentName, options), "utf8");
|
|
193588
193702
|
const registryPath = resolveRegistryPath(pieComponentsDir);
|
|
193589
193703
|
updateRegistryFile(registryPath, componentName, componentDir);
|
|
193590
193704
|
} catch (error) {
|
|
@@ -193599,6 +193713,8 @@ var addCommand = (componentName, componentType = "complex-container") => {
|
|
|
193599
193713
|
console.log(`[pieui] Updated registry.ts with new component`);
|
|
193600
193714
|
console.log("");
|
|
193601
193715
|
console.log(`[pieui] Component type: ${componentType}`);
|
|
193716
|
+
console.log(`[pieui] IO fields: ${options.io ? "enabled" : "disabled"}`);
|
|
193717
|
+
console.log(`[pieui] AJAX fields: ${options.ajax ? "enabled" : "disabled"}`);
|
|
193602
193718
|
switch (componentType) {
|
|
193603
193719
|
case "simple":
|
|
193604
193720
|
console.log(" - Props: data only");
|
|
@@ -197911,7 +198027,7 @@ var postbuildCommand = async (srcDir, outDir, append) => {
|
|
|
197911
198027
|
let existingEntries = [];
|
|
197912
198028
|
if (append) {
|
|
197913
198029
|
console.log("[pieui] Append mode enabled - loading existing pieui components");
|
|
197914
|
-
const nodeModulesPath = import_path9.default.join(process.cwd(), "node_modules", "@
|
|
198030
|
+
const nodeModulesPath = import_path9.default.join(process.cwd(), "node_modules", "@swarm.ing", "pieui", "dist", MANIFEST_FILENAME);
|
|
197915
198031
|
if (import_fs7.default.existsSync(nodeModulesPath)) {
|
|
197916
198032
|
try {
|
|
197917
198033
|
const existingManifest = import_fs7.default.readFileSync(nodeModulesPath, "utf8");
|
|
@@ -198311,6 +198427,164 @@ var createPieAppCommand = (appName) => {
|
|
|
198311
198427
|
console.log(` 3. bun run dev`);
|
|
198312
198428
|
};
|
|
198313
198429
|
|
|
198430
|
+
// src/code/commands/pageAdd.ts
|
|
198431
|
+
var import_fs12 = __toESM(require("fs"));
|
|
198432
|
+
var import_path14 = __toESM(require("path"));
|
|
198433
|
+
var normalizePagePath = (pagePath) => {
|
|
198434
|
+
const trimmed = pagePath.trim();
|
|
198435
|
+
if (!trimmed) {
|
|
198436
|
+
throw new Error("Path is required for page add command");
|
|
198437
|
+
}
|
|
198438
|
+
const normalizedSlashes = trimmed.replace(/\\/g, "/");
|
|
198439
|
+
const withoutRelativePrefix = normalizedSlashes.replace(/^\.\/+/, "");
|
|
198440
|
+
const withoutAppPrefix = withoutRelativePrefix.replace(/^app\//, "");
|
|
198441
|
+
const withoutEdgeSlashes = withoutAppPrefix.replace(/^\/+|\/+$/g, "");
|
|
198442
|
+
const normalized = import_path14.default.posix.normalize(withoutEdgeSlashes);
|
|
198443
|
+
if (!normalized || normalized === ".") {
|
|
198444
|
+
throw new Error("Path is required for page add command");
|
|
198445
|
+
}
|
|
198446
|
+
if (normalized === ".." || normalized.startsWith("../") || normalized.includes("/../")) {
|
|
198447
|
+
throw new Error("Page path must stay inside the app directory");
|
|
198448
|
+
}
|
|
198449
|
+
return normalized;
|
|
198450
|
+
};
|
|
198451
|
+
var toPascalCase = (value2) => value2.split(/[^a-zA-Z0-9]+/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
198452
|
+
var pageComponentNameForPath = (pagePath) => {
|
|
198453
|
+
const segments = pagePath.split("/").map((segment) => toPascalCase(segment)).filter(Boolean);
|
|
198454
|
+
if (segments.length === 0) {
|
|
198455
|
+
return "Page";
|
|
198456
|
+
}
|
|
198457
|
+
return `${segments.join("")}Page`;
|
|
198458
|
+
};
|
|
198459
|
+
var pageAddCommand = (pagePath) => {
|
|
198460
|
+
const normalizedPath = normalizePagePath(pagePath);
|
|
198461
|
+
const pageComponentName = pageComponentNameForPath(normalizedPath);
|
|
198462
|
+
const appDir = import_path14.default.join(process.cwd(), "app");
|
|
198463
|
+
const targetFile = import_path14.default.join(appDir, normalizedPath, "page.tsx");
|
|
198464
|
+
const relativeTarget = import_path14.default.relative(appDir, targetFile);
|
|
198465
|
+
if (relativeTarget.startsWith("..") || import_path14.default.isAbsolute(relativeTarget)) {
|
|
198466
|
+
throw new Error("Page path must stay inside the app directory");
|
|
198467
|
+
}
|
|
198468
|
+
if (import_fs12.default.existsSync(targetFile)) {
|
|
198469
|
+
console.error(`[pieui] Error: Page already exists at app/${normalizedPath}/page.tsx`);
|
|
198470
|
+
process.exit(1);
|
|
198471
|
+
}
|
|
198472
|
+
import_fs12.default.mkdirSync(import_path14.default.dirname(targetFile), { recursive: true });
|
|
198473
|
+
import_fs12.default.writeFileSync(targetFile, pageTemplate(pageComponentName), "utf8");
|
|
198474
|
+
console.log(`[pieui] Page created successfully at app/${normalizedPath}/page.tsx`);
|
|
198475
|
+
};
|
|
198476
|
+
|
|
198477
|
+
// src/code/commands/create.ts
|
|
198478
|
+
var import_fs13 = __toESM(require("fs"));
|
|
198479
|
+
var import_path15 = __toESM(require("path"));
|
|
198480
|
+
var import_child_process2 = require("child_process");
|
|
198481
|
+
var DEFAULT_TEMPLATE_SPEC2 = "next-app@latest";
|
|
198482
|
+
var SHARED_PAGE_TEMPLATE = `"use client";
|
|
198483
|
+
|
|
198484
|
+
import { useRouter } from "next/navigation";
|
|
198485
|
+
import { PieRoot } from "@swarm.ing/pieui";
|
|
198486
|
+
import "@/piecomponents/registry";
|
|
198487
|
+
import { usePathname, useSearchParams } from "next/navigation";
|
|
198488
|
+
import LoadingScreen from "@/components/LoadingScreen";
|
|
198489
|
+
|
|
198490
|
+
export default function PiePage() {
|
|
198491
|
+
const router = useRouter();
|
|
198492
|
+
const pathname = usePathname();
|
|
198493
|
+
const searchParams = useSearchParams();
|
|
198494
|
+
const search = searchParams.toString();
|
|
198495
|
+
|
|
198496
|
+
return (
|
|
198497
|
+
<PieRoot
|
|
198498
|
+
location={{ pathname, search }}
|
|
198499
|
+
config={{
|
|
198500
|
+
apiServer: process.env.PIE_API_SERVER!,
|
|
198501
|
+
centrifugeServer: process.env.PIE_CENTRIFUGE_SERVER!,
|
|
198502
|
+
enableRenderingLog: true,
|
|
198503
|
+
}}
|
|
198504
|
+
onNavigate={(url) => router.push(url)}
|
|
198505
|
+
fallback={<></>}
|
|
198506
|
+
/>
|
|
198507
|
+
);
|
|
198508
|
+
}
|
|
198509
|
+
`;
|
|
198510
|
+
var HOME_PAGE_TEMPLATE = `"use client";
|
|
198511
|
+
|
|
198512
|
+
import PiePage from "@/app/_shared/page";
|
|
198513
|
+
import { Suspense } from "react";
|
|
198514
|
+
|
|
198515
|
+
export default function HomePage() {
|
|
198516
|
+
return (
|
|
198517
|
+
<Suspense fallback={<></>}>
|
|
198518
|
+
<PiePage />
|
|
198519
|
+
</Suspense>
|
|
198520
|
+
);
|
|
198521
|
+
}
|
|
198522
|
+
`;
|
|
198523
|
+
var LOADING_SCREEN_TEMPLATE = `"use client";
|
|
198524
|
+
|
|
198525
|
+
export default function LoadingScreen() {
|
|
198526
|
+
return (
|
|
198527
|
+
<div className="flex min-h-screen items-center justify-center text-sm text-neutral-500">
|
|
198528
|
+
Loading...
|
|
198529
|
+
</div>
|
|
198530
|
+
);
|
|
198531
|
+
}
|
|
198532
|
+
`;
|
|
198533
|
+
var clearDirectory = (targetDir) => {
|
|
198534
|
+
if (!import_fs13.default.existsSync(targetDir))
|
|
198535
|
+
return;
|
|
198536
|
+
for (const entry of import_fs13.default.readdirSync(targetDir)) {
|
|
198537
|
+
import_fs13.default.rmSync(import_path15.default.join(targetDir, entry), { recursive: true, force: true });
|
|
198538
|
+
}
|
|
198539
|
+
};
|
|
198540
|
+
var writeFile = (filePath, content) => {
|
|
198541
|
+
import_fs13.default.mkdirSync(import_path15.default.dirname(filePath), { recursive: true });
|
|
198542
|
+
import_fs13.default.writeFileSync(filePath, content, "utf8");
|
|
198543
|
+
};
|
|
198544
|
+
var scaffoldCreateAppFiles = (appDir) => {
|
|
198545
|
+
clearDirectory(import_path15.default.join(appDir, "public"));
|
|
198546
|
+
writeFile(import_path15.default.join(appDir, "app", "_shared", "page.tsx"), SHARED_PAGE_TEMPLATE);
|
|
198547
|
+
writeFile(import_path15.default.join(appDir, "app", "page.tsx"), HOME_PAGE_TEMPLATE);
|
|
198548
|
+
import_fs13.default.rmSync(import_path15.default.join(appDir, "app", "_shared", "simple.tsx"), {
|
|
198549
|
+
force: true
|
|
198550
|
+
});
|
|
198551
|
+
import_fs13.default.rmSync(import_path15.default.join(appDir, "app", "piecache.json"), { force: true });
|
|
198552
|
+
writeFile(import_path15.default.join(appDir, "components", "LoadingScreen.tsx"), LOADING_SCREEN_TEMPLATE);
|
|
198553
|
+
import_fs13.default.rmSync(import_path15.default.join(appDir, "components", "ErrorToast.tsx"), { force: true });
|
|
198554
|
+
};
|
|
198555
|
+
var createCommand = (appName) => {
|
|
198556
|
+
const trimmedAppName = appName.trim();
|
|
198557
|
+
if (!trimmedAppName) {
|
|
198558
|
+
console.error("[pieui] Error: App name is required for create command");
|
|
198559
|
+
process.exit(1);
|
|
198560
|
+
}
|
|
198561
|
+
const appDir = import_path15.default.resolve(process.cwd(), trimmedAppName);
|
|
198562
|
+
if (import_fs13.default.existsSync(appDir)) {
|
|
198563
|
+
console.error(`[pieui] Error: Target directory already exists: ${trimmedAppName}`);
|
|
198564
|
+
process.exit(1);
|
|
198565
|
+
}
|
|
198566
|
+
const bunBin = process.env.PIEUI_CREATE_BUN_BIN || "bun";
|
|
198567
|
+
const templateSpec = process.env.PIEUI_CREATE_NEXT_APP_SPEC || DEFAULT_TEMPLATE_SPEC2;
|
|
198568
|
+
console.log(`[pieui] Creating Next.js app in "${trimmedAppName}"...`);
|
|
198569
|
+
const result = import_child_process2.spawnSync(bunBin, ["create", templateSpec, trimmedAppName, "--yes"], {
|
|
198570
|
+
cwd: process.cwd(),
|
|
198571
|
+
stdio: "inherit",
|
|
198572
|
+
env: process.env
|
|
198573
|
+
});
|
|
198574
|
+
if (result.error) {
|
|
198575
|
+
throw result.error;
|
|
198576
|
+
}
|
|
198577
|
+
if (result.status !== 0) {
|
|
198578
|
+
throw new Error(`create failed (exit code ${result.status ?? "unknown"})`);
|
|
198579
|
+
}
|
|
198580
|
+
scaffoldCreateAppFiles(appDir);
|
|
198581
|
+
initCommand(trimmedAppName);
|
|
198582
|
+
console.log("[pieui] App created successfully.");
|
|
198583
|
+
console.log("[pieui] Next steps:");
|
|
198584
|
+
console.log(` 1. cd ${trimmedAppName}`);
|
|
198585
|
+
console.log(" 2. bun run dev");
|
|
198586
|
+
};
|
|
198587
|
+
|
|
198314
198588
|
// src/cli.ts
|
|
198315
198589
|
var main = async () => {
|
|
198316
198590
|
const {
|
|
@@ -198323,7 +198597,12 @@ var main = async () => {
|
|
|
198323
198597
|
componentType,
|
|
198324
198598
|
removeComponentName,
|
|
198325
198599
|
listFilter,
|
|
198326
|
-
eventName
|
|
198600
|
+
eventName,
|
|
198601
|
+
cardAction,
|
|
198602
|
+
cardAjax,
|
|
198603
|
+
cardIo,
|
|
198604
|
+
pageAction,
|
|
198605
|
+
pagePath
|
|
198327
198606
|
} = parseArgs(process.argv.slice(2));
|
|
198328
198607
|
console.log(`[pieui] CLI started with command: "${command}"`);
|
|
198329
198608
|
switch (command) {
|
|
@@ -198338,13 +198617,53 @@ var main = async () => {
|
|
|
198338
198617
|
}
|
|
198339
198618
|
createPieAppCommand(createAppName);
|
|
198340
198619
|
return;
|
|
198620
|
+
case "create":
|
|
198621
|
+
if (!createAppName) {
|
|
198622
|
+
console.error("[pieui] Error: App name is required for create command");
|
|
198623
|
+
printUsage();
|
|
198624
|
+
process.exit(1);
|
|
198625
|
+
}
|
|
198626
|
+
createCommand(createAppName);
|
|
198627
|
+
return;
|
|
198628
|
+
case "card":
|
|
198629
|
+
if (cardAction !== "add") {
|
|
198630
|
+
console.error("[pieui] Error: Supported card subcommands: add");
|
|
198631
|
+
printUsage();
|
|
198632
|
+
process.exit(1);
|
|
198633
|
+
}
|
|
198634
|
+
if (!componentName) {
|
|
198635
|
+
console.error("[pieui] Error: Component name is required for card add command");
|
|
198636
|
+
printUsage();
|
|
198637
|
+
process.exit(1);
|
|
198638
|
+
}
|
|
198639
|
+
addCommand(componentName, componentType, {
|
|
198640
|
+
ajax: cardAjax,
|
|
198641
|
+
io: cardIo
|
|
198642
|
+
});
|
|
198643
|
+
return;
|
|
198341
198644
|
case "add":
|
|
198342
198645
|
if (!componentName) {
|
|
198343
|
-
console.error("[pieui] Error: Component name is required for add command");
|
|
198646
|
+
console.error("[pieui] Error: Component name is required for card add command");
|
|
198647
|
+
printUsage();
|
|
198648
|
+
process.exit(1);
|
|
198649
|
+
}
|
|
198650
|
+
addCommand(componentName, componentType, {
|
|
198651
|
+
ajax: cardAjax,
|
|
198652
|
+
io: cardIo
|
|
198653
|
+
});
|
|
198654
|
+
return;
|
|
198655
|
+
case "page":
|
|
198656
|
+
if (pageAction !== "add") {
|
|
198657
|
+
console.error("[pieui] Error: Supported page subcommands: add");
|
|
198658
|
+
printUsage();
|
|
198659
|
+
process.exit(1);
|
|
198660
|
+
}
|
|
198661
|
+
if (!pagePath) {
|
|
198662
|
+
console.error("[pieui] Error: Path is required for page add command");
|
|
198344
198663
|
printUsage();
|
|
198345
198664
|
process.exit(1);
|
|
198346
198665
|
}
|
|
198347
|
-
|
|
198666
|
+
pageAddCommand(pagePath);
|
|
198348
198667
|
return;
|
|
198349
198668
|
case "remove":
|
|
198350
198669
|
if (!removeComponentName) {
|
package/dist/code/args.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/code/args.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/code/args.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKR,UAAU,EACb,MAAM,SAAS,CAAA;AAEhB,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,KAAG,UA0I1C,CAAA;AAED,eAAO,MAAM,UAAU,YAsJtB,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ComponentType } from '../types';
|
|
2
|
-
export declare const addCommand: (componentName: string, componentType?: ComponentType) => void;
|
|
1
|
+
import { CardScaffoldOptions, ComponentType } from '../types';
|
|
2
|
+
export declare const addCommand: (componentName: string, componentType?: ComponentType, options?: CardScaffoldOptions) => void;
|
|
3
3
|
//# sourceMappingURL=add.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/code/commands/add.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/code/commands/add.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AA0C7D,eAAO,MAAM,UAAU,GACnB,eAAe,MAAM,EACrB,gBAAe,aAAmC,EAClD,UAAS,mBAAwB,SAiGpC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/code/commands/create.ts"],"names":[],"mappings":"AAyFA,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,SA+C5C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/code/commands/init.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/code/commands/init.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,SA8GzC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageAdd.d.ts","sourceRoot":"","sources":["../../../src/code/commands/pageAdd.ts"],"names":[],"mappings":"AAoDA,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM,SA2B9C,CAAA"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import type { CardScaffoldOptions } from '../types';
|
|
2
|
+
export declare const componentTypesTemplate: (componentName: string, baseInterface: string, options?: CardScaffoldOptions) => string;
|
|
2
3
|
//# sourceMappingURL=componentTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentTypes.d.ts","sourceRoot":"","sources":["../../../src/code/templates/componentTypes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,GAC/B,eAAe,MAAM,EACrB,eAAe,MAAM,
|
|
1
|
+
{"version":3,"file":"componentTypes.d.ts","sourceRoot":"","sources":["../../../src/code/templates/componentTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAWnD,eAAO,MAAM,sBAAsB,GAC/B,eAAe,MAAM,EACrB,eAAe,MAAM,EACrB,UAAS,mBAAwB,KAClC,MAgBF,CAAA"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { ComponentType } from '../types';
|
|
2
1
|
import { componentIndexTemplate } from './componentIndex';
|
|
3
2
|
import { componentTypesTemplate } from './componentTypes';
|
|
4
3
|
import { registerCallTemplate } from './registerCall';
|
|
5
4
|
import { nextConfigTemplate, REQUIRED_NEXT_CONFIG_ENV_KEYS } from './nextConfig';
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
export declare const componentTemplateFor: (componentType: ComponentType, componentName: string) => string;
|
|
5
|
+
import { baseInterfaceFor, componentTemplateFor, pageTemplate } from './pages';
|
|
6
|
+
export { baseInterfaceFor, componentTemplateFor, componentIndexTemplate, componentTypesTemplate, pageTemplate, registerCallTemplate, nextConfigTemplate, REQUIRED_NEXT_CONFIG_ENV_KEYS, };
|
|
9
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/code/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/code/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAA;AAChF,OAAO,EACH,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,EACf,MAAM,SAAS,CAAA;AAEhB,OAAO,EACH,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,6BAA6B,GAChC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complexComponent.d.ts","sourceRoot":"","sources":["../../../../../src/code/templates/pages/components/complexComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAOzD,eAAO,MAAM,wBAAwB,GACjC,eAAe,MAAM,EACrB,UAAS,mBAAwB,KAClC,MAoBF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complexContainerComponent.d.ts","sourceRoot":"","sources":["../../../../../src/code/templates/pages/components/complexContainerComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAOzD,eAAO,MAAM,iCAAiC,GAC1C,eAAe,MAAM,EACrB,UAAS,mBAAwB,KAClC,MAgCF,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { simpleComponentTemplate } from './simpleComponent';
|
|
2
|
+
export { complexComponentTemplate } from './complexComponent';
|
|
3
|
+
export { simpleContainerComponentTemplate } from './simpleContainerComponent';
|
|
4
|
+
export { complexContainerComponentTemplate } from './complexContainerComponent';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/code/templates/pages/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAE,gCAAgC,EAAE,MAAM,4BAA4B,CAAA;AAC7E,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CardScaffoldOptions } from '../../../types';
|
|
2
|
+
export declare const dataDestructureFor: (options?: CardScaffoldOptions) => string;
|
|
3
|
+
export declare const pieCardOpeningTagFor: (componentName: string, options?: CardScaffoldOptions) => string;
|
|
4
|
+
export declare const ajaxSubmitDeclarationFor: (options?: CardScaffoldOptions) => string;
|
|
5
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../../src/code/templates/pages/components/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEzD,eAAO,MAAM,kBAAkB,GAC3B,UAAS,mBAAwB,KAClC,MAuBF,CAAA;AAED,eAAO,MAAM,oBAAoB,GAC7B,eAAe,MAAM,EACrB,UAAS,mBAAwB,KAClC,MAeF,CAAA;AAED,eAAO,MAAM,wBAAwB,GACjC,UAAS,mBAAwB,KAClC,MAYF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simpleComponent.d.ts","sourceRoot":"","sources":["../../../../../src/code/templates/pages/components/simpleComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAOzD,eAAO,MAAM,uBAAuB,GAChC,eAAe,MAAM,EACrB,UAAS,mBAAwB,KAClC,MAoBF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simpleContainerComponent.d.ts","sourceRoot":"","sources":["../../../../../src/code/templates/pages/components/simpleContainerComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAOzD,eAAO,MAAM,gCAAgC,GACzC,eAAe,MAAM,EACrB,UAAS,mBAAwB,KAClC,MA+BF,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CardScaffoldOptions, ComponentType } from '../../types';
|
|
2
|
+
import { pageTemplate } from './page';
|
|
3
|
+
export { pageTemplate };
|
|
4
|
+
export declare const baseInterfaceFor: (componentType: ComponentType) => string;
|
|
5
|
+
export declare const componentTemplateFor: (componentType: ComponentType, componentName: string, options?: CardScaffoldOptions) => string;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/code/templates/pages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAOhE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AASrC,OAAO,EAAE,YAAY,EAAE,CAAA;AAEvB,eAAO,MAAM,gBAAgB,GAAI,eAAe,aAAa,KAAG,MACvB,CAAA;AAEzC,eAAO,MAAM,oBAAoB,GAC7B,eAAe,aAAa,EAC5B,eAAe,MAAM,EACrB,UAAS,mBAAwB,KAClC,MAYF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../src/code/templates/pages/page.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,GAAI,mBAAmB,MAAM,KAAG,MAYxD,CAAA"}
|
package/dist/code/types.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export declare const MANIFEST_FILENAME = "pieui.components.json";
|
|
|
3
3
|
export declare const REGISTER_FUNCTION = "registerPieComponent";
|
|
4
4
|
export type ComponentType = 'simple' | 'complex' | 'simple-container' | 'complex-container';
|
|
5
5
|
export type ListFilter = 'all' | ComponentType;
|
|
6
|
+
export type CardAction = 'add';
|
|
7
|
+
export type PageAction = 'add';
|
|
6
8
|
export type ParsedArgs = {
|
|
7
9
|
command: string;
|
|
8
10
|
outDir: string;
|
|
@@ -14,6 +16,15 @@ export type ParsedArgs = {
|
|
|
14
16
|
eventName?: string;
|
|
15
17
|
removeComponentName?: string;
|
|
16
18
|
listFilter?: ListFilter;
|
|
19
|
+
cardAction?: CardAction;
|
|
20
|
+
cardAjax?: boolean;
|
|
21
|
+
cardIo?: boolean;
|
|
22
|
+
pageAction?: PageAction;
|
|
23
|
+
pagePath?: string;
|
|
24
|
+
};
|
|
25
|
+
export type CardScaffoldOptions = {
|
|
26
|
+
ajax?: boolean;
|
|
27
|
+
io?: boolean;
|
|
17
28
|
};
|
|
18
29
|
export type ComponentManifestEntry = {
|
|
19
30
|
card: string;
|
package/dist/code/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/code/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,wBAAwB,CAAA;AAElD,eAAO,MAAM,iBAAiB,0BAA0B,CAAA;AACxD,eAAO,MAAM,iBAAiB,yBAAyB,CAAA;AAEvD,MAAM,MAAM,aAAa,GACnB,QAAQ,GACR,SAAS,GACT,kBAAkB,GAClB,mBAAmB,CAAA;AAEzB,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/code/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,wBAAwB,CAAA;AAElD,eAAO,MAAM,iBAAiB,0BAA0B,CAAA;AACxD,eAAO,MAAM,iBAAiB,yBAAyB,CAAA;AAEvD,MAAM,MAAM,aAAa,GACnB,QAAQ,GACR,SAAS,GACT,kBAAkB,GAClB,mBAAmB,CAAA;AAEzB,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,aAAa,CAAA;AAC9C,MAAM,MAAM,UAAU,GAAG,KAAK,CAAA;AAC9B,MAAM,MAAM,UAAU,GAAG,KAAK,CAAA;AAE9B,MAAM,MAAM,UAAU,GAAG;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,OAAO,CAAA;IACf,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,EAAE,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,GAAG,CAAC,UAAU,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;CACvB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"complexComponent.d.ts","sourceRoot":"","sources":["../../../src/code/templates/complexComponent.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,GAAI,eAAe,MAAM,KAAG,MAmBhE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"complexContainerComponent.d.ts","sourceRoot":"","sources":["../../../src/code/templates/complexContainerComponent.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iCAAiC,GAC1C,eAAe,MAAM,KACtB,MA+BF,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simpleComponent.d.ts","sourceRoot":"","sources":["../../../src/code/templates/simpleComponent.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,GAAI,eAAe,MAAM,KAAG,MAmB/D,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simpleContainerComponent.d.ts","sourceRoot":"","sources":["../../../src/code/templates/simpleContainerComponent.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gCAAgC,GACzC,eAAe,MAAM,KACtB,MA8BF,CAAA"}
|