pupt-lib 0.0.1 → 1.0.2
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 +368 -28
- package/dist/__vite-browser-external-2Ng8QIWW.js +4 -0
- package/dist/api.d.ts +42 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/babel/preset.d.ts +8 -0
- package/dist/babel/preset.d.ts.map +1 -0
- package/dist/babel/preset.js +20 -0
- package/dist/component.d.ts +37 -0
- package/dist/component.d.ts.map +1 -0
- package/dist/components/ask/Choice.d.ts +19 -0
- package/dist/components/ask/Choice.d.ts.map +1 -0
- package/dist/components/ask/Confirm.d.ts +14 -0
- package/dist/components/ask/Confirm.d.ts.map +1 -0
- package/dist/components/ask/Date.d.ts +17 -0
- package/dist/components/ask/Date.d.ts.map +1 -0
- package/dist/components/ask/Editor.d.ts +15 -0
- package/dist/components/ask/Editor.d.ts.map +1 -0
- package/dist/components/ask/File.d.ts +18 -0
- package/dist/components/ask/File.d.ts.map +1 -0
- package/dist/components/ask/Label.d.ts +14 -0
- package/dist/components/ask/Label.d.ts.map +1 -0
- package/dist/components/ask/MultiSelect.d.ts +22 -0
- package/dist/components/ask/MultiSelect.d.ts.map +1 -0
- package/dist/components/ask/Number.d.ts +16 -0
- package/dist/components/ask/Number.d.ts.map +1 -0
- package/dist/components/ask/Option.d.ts +12 -0
- package/dist/components/ask/Option.d.ts.map +1 -0
- package/dist/components/ask/Path.d.ts +16 -0
- package/dist/components/ask/Path.d.ts.map +1 -0
- package/dist/components/ask/Rating.d.ts +17 -0
- package/dist/components/ask/Rating.d.ts.map +1 -0
- package/dist/components/ask/ReviewFile.d.ts +22 -0
- package/dist/components/ask/ReviewFile.d.ts.map +1 -0
- package/dist/components/ask/Secret.d.ts +15 -0
- package/dist/components/ask/Secret.d.ts.map +1 -0
- package/dist/components/ask/Select.d.ts +20 -0
- package/dist/components/ask/Select.d.ts.map +1 -0
- package/dist/components/ask/Text.d.ts +15 -0
- package/dist/components/ask/Text.d.ts.map +1 -0
- package/dist/components/ask/index.d.ts +32 -0
- package/dist/components/ask/index.d.ts.map +1 -0
- package/dist/components/ask/utils.d.ts +6 -0
- package/dist/components/ask/utils.d.ts.map +1 -0
- package/dist/components/control/ForEach.d.ts +11 -0
- package/dist/components/control/ForEach.d.ts.map +1 -0
- package/dist/components/control/If.d.ts +10 -0
- package/dist/components/control/If.d.ts.map +1 -0
- package/dist/components/data/Code.d.ts +12 -0
- package/dist/components/data/Code.d.ts.map +1 -0
- package/dist/components/data/Data.d.ts +12 -0
- package/dist/components/data/Data.d.ts.map +1 -0
- package/dist/components/data/File.d.ts +12 -0
- package/dist/components/data/File.d.ts.map +1 -0
- package/dist/components/data/Json.d.ts +11 -0
- package/dist/components/data/Json.d.ts.map +1 -0
- package/dist/components/data/Xml.d.ts +11 -0
- package/dist/components/data/Xml.d.ts.map +1 -0
- package/dist/components/data/index.d.ts +6 -0
- package/dist/components/data/index.d.ts.map +1 -0
- package/dist/components/examples/Example.d.ts +14 -0
- package/dist/components/examples/Example.d.ts.map +1 -0
- package/dist/components/examples/ExampleInput.d.ts +10 -0
- package/dist/components/examples/ExampleInput.d.ts.map +1 -0
- package/dist/components/examples/ExampleOutput.d.ts +10 -0
- package/dist/components/examples/ExampleOutput.d.ts.map +1 -0
- package/dist/components/examples/Examples.d.ts +10 -0
- package/dist/components/examples/Examples.d.ts.map +1 -0
- package/dist/components/examples/index.d.ts +5 -0
- package/dist/components/examples/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/meta/Uses.d.ts +12 -0
- package/dist/components/meta/Uses.d.ts.map +1 -0
- package/dist/components/meta/index.d.ts +2 -0
- package/dist/components/meta/index.d.ts.map +1 -0
- package/dist/components/post-execution/OpenUrl.d.ts +11 -0
- package/dist/components/post-execution/OpenUrl.d.ts.map +1 -0
- package/dist/components/post-execution/PostExecution.d.ts +10 -0
- package/dist/components/post-execution/PostExecution.d.ts.map +1 -0
- package/dist/components/post-execution/ReviewFile.d.ts +11 -0
- package/dist/components/post-execution/ReviewFile.d.ts.map +1 -0
- package/dist/components/post-execution/RunCommand.d.ts +12 -0
- package/dist/components/post-execution/RunCommand.d.ts.map +1 -0
- package/dist/components/post-execution/index.d.ts +5 -0
- package/dist/components/post-execution/index.d.ts.map +1 -0
- package/dist/components/reasoning/Step.d.ts +11 -0
- package/dist/components/reasoning/Step.d.ts.map +1 -0
- package/dist/components/reasoning/Steps.d.ts +11 -0
- package/dist/components/reasoning/Steps.d.ts.map +1 -0
- package/dist/components/reasoning/index.d.ts +3 -0
- package/dist/components/reasoning/index.d.ts.map +1 -0
- package/dist/components/structural/Audience.d.ts +11 -0
- package/dist/components/structural/Audience.d.ts.map +1 -0
- package/dist/components/structural/Constraint.d.ts +11 -0
- package/dist/components/structural/Constraint.d.ts.map +1 -0
- package/dist/components/structural/Context.d.ts +11 -0
- package/dist/components/structural/Context.d.ts.map +1 -0
- package/dist/components/structural/Criterion.d.ts +10 -0
- package/dist/components/structural/Criterion.d.ts.map +1 -0
- package/dist/components/structural/Format.d.ts +12 -0
- package/dist/components/structural/Format.d.ts.map +1 -0
- package/dist/components/structural/Prompt.d.ts +14 -0
- package/dist/components/structural/Prompt.d.ts.map +1 -0
- package/dist/components/structural/Role.d.ts +13 -0
- package/dist/components/structural/Role.d.ts.map +1 -0
- package/dist/components/structural/Section.d.ts +12 -0
- package/dist/components/structural/Section.d.ts.map +1 -0
- package/dist/components/structural/SuccessCriteria.d.ts +11 -0
- package/dist/components/structural/SuccessCriteria.d.ts.map +1 -0
- package/dist/components/structural/Task.d.ts +11 -0
- package/dist/components/structural/Task.d.ts.map +1 -0
- package/dist/components/structural/Tone.d.ts +11 -0
- package/dist/components/structural/Tone.d.ts.map +1 -0
- package/dist/components/structural/index.d.ts +12 -0
- package/dist/components/structural/index.d.ts.map +1 -0
- package/dist/components/utility/Cwd.d.ts +9 -0
- package/dist/components/utility/Cwd.d.ts.map +1 -0
- package/dist/components/utility/DateTime.d.ts +10 -0
- package/dist/components/utility/DateTime.d.ts.map +1 -0
- package/dist/components/utility/Hostname.d.ts +9 -0
- package/dist/components/utility/Hostname.d.ts.map +1 -0
- package/dist/components/utility/Timestamp.d.ts +9 -0
- package/dist/components/utility/Timestamp.d.ts.map +1 -0
- package/dist/components/utility/UUID.d.ts +9 -0
- package/dist/components/utility/UUID.d.ts.map +1 -0
- package/dist/components/utility/Username.d.ts +9 -0
- package/dist/components/utility/Username.d.ts.map +1 -0
- package/dist/components/utility/index.d.ts +7 -0
- package/dist/components/utility/index.d.ts.map +1 -0
- package/dist/create-prompt.d.ts +43 -0
- package/dist/create-prompt.d.ts.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39953 -0
- package/dist/jsx-runtime/index.d.ts +29 -0
- package/dist/jsx-runtime/index.d.ts.map +1 -0
- package/dist/jsx-runtime/index.js +51 -0
- package/dist/jsx-runtime/jsx-dev-runtime.d.ts +26 -0
- package/dist/jsx-runtime/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/jsx-runtime/jsx-dev-runtime.js +11 -0
- package/dist/render.d.ts +3 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/services/browser-support.d.ts +111 -0
- package/dist/services/browser-support.d.ts.map +1 -0
- package/dist/services/component-registry.d.ts +11 -0
- package/dist/services/component-registry.d.ts.map +1 -0
- package/dist/services/file-search-engine.d.ts +141 -0
- package/dist/services/file-search-engine.d.ts.map +1 -0
- package/dist/services/formula-parser.d.ts +9 -0
- package/dist/services/formula-parser.d.ts.map +1 -0
- package/dist/services/input-iterator.d.ts +46 -0
- package/dist/services/input-iterator.d.ts.map +1 -0
- package/dist/services/module-loader.d.ts +92 -0
- package/dist/services/module-loader.d.ts.map +1 -0
- package/dist/services/scope-loader.d.ts +55 -0
- package/dist/services/scope-loader.d.ts.map +1 -0
- package/dist/services/scope.d.ts +14 -0
- package/dist/services/scope.d.ts.map +1 -0
- package/dist/services/search-engine.d.ts +10 -0
- package/dist/services/search-engine.d.ts.map +1 -0
- package/dist/services/transformer.d.ts +38 -0
- package/dist/services/transformer.d.ts.map +1 -0
- package/dist/types/component.d.ts +30 -0
- package/dist/types/component.d.ts.map +1 -0
- package/dist/types/context.d.ts +73 -0
- package/dist/types/context.d.ts.map +1 -0
- package/dist/types/element.d.ts +37 -0
- package/dist/types/element.d.ts.map +1 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/input.d.ts +61 -0
- package/dist/types/input.d.ts.map +1 -0
- package/dist/types/module.d.ts +61 -0
- package/dist/types/module.d.ts.map +1 -0
- package/dist/types/render.d.ts +61 -0
- package/dist/types/render.d.ts.map +1 -0
- package/dist/types/search.d.ts +59 -0
- package/dist/types/search.d.ts.map +1 -0
- package/package.json +132 -6
package/README.md
CHANGED
|
@@ -1,45 +1,385 @@
|
|
|
1
1
|
# pupt-lib
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/pupt-lib)
|
|
4
|
+
[](https://coveralls.io/github/apowers313/pupt-lib?branch=master)
|
|
5
|
+
[](https://github.com/apowers313/pupt-lib/actions/workflows/ci.yml)
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
A TypeScript library for creating AI prompts as versionable, composable, shareable files using JSX syntax. Prompts are becoming critical software artifacts, yet most are written inline, copy-pasted between projects, and lost when chat sessions end. pupt-lib treats prompts as first-class code: version controlled in git, composable from reusable components, and shareable via npm. Simple prompts look like HTML and are accessible to non-developers, while complex prompts have full TypeScript power including loops, conditionals, and type safety.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
**Features:**
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
- **JSX Syntax** - Write prompts using familiar JSX/TSX syntax with built-in components
|
|
12
|
+
- **Composable** - Build complex prompts from reusable, shareable components
|
|
13
|
+
- **Version Controlled** - Prompts live in files, tracked in git, reviewed in PRs
|
|
14
|
+
- **Shareable** - Publish prompt libraries to npm, consume others' work via npm, URLs, or local files
|
|
15
|
+
- **UI Agnostic** - Library handles prompt logic; any UI (CLI, web, desktop) can collect inputs
|
|
16
|
+
- **LLM Agnostic** - Target Claude, GPT, Gemini, or others with environment-based output optimization
|
|
17
|
+
- **Research-Backed** - Built-in components encode prompt engineering best practices
|
|
18
|
+
- **Browser & Node.js** - Works in both environments with runtime JSX transformation
|
|
10
19
|
|
|
11
|
-
|
|
12
|
-
1. Configure OIDC trusted publishing for the package name `pupt-lib`
|
|
13
|
-
2. Enable secure, token-less publishing from CI/CD workflows
|
|
14
|
-
3. Establish provenance for packages published under this name
|
|
20
|
+
## Installation
|
|
15
21
|
|
|
16
|
-
|
|
22
|
+
```bash
|
|
23
|
+
npm install pupt-lib
|
|
24
|
+
```
|
|
17
25
|
|
|
18
|
-
|
|
26
|
+
For build-time JSX transformation (recommended for production), also install the peer dependencies:
|
|
19
27
|
|
|
20
|
-
|
|
28
|
+
```bash
|
|
29
|
+
npm install --save-dev @babel/core @babel/plugin-transform-react-jsx @babel/preset-typescript
|
|
30
|
+
```
|
|
21
31
|
|
|
22
|
-
|
|
32
|
+
## Quick Start
|
|
23
33
|
|
|
24
|
-
|
|
25
|
-
2. Configure the trusted publisher (e.g., GitHub Actions)
|
|
26
|
-
3. Specify the repository and workflow that should be allowed to publish
|
|
27
|
-
4. Use the configured workflow to publish your actual package
|
|
34
|
+
Create a prompt file `greeting.tsx`:
|
|
28
35
|
|
|
29
|
-
|
|
36
|
+
```tsx
|
|
37
|
+
export default (
|
|
38
|
+
<Prompt name="greeting" description="A friendly greeting prompt">
|
|
39
|
+
<Role>You are a friendly assistant.</Role>
|
|
40
|
+
<Task>
|
|
41
|
+
Greet the user named <Ask.Text name="userName" label="User's name" /> warmly.
|
|
42
|
+
</Task>
|
|
43
|
+
<Constraint type="must">Keep the greeting under 50 words.</Constraint>
|
|
44
|
+
</Prompt>
|
|
45
|
+
);
|
|
46
|
+
```
|
|
30
47
|
|
|
31
|
-
|
|
32
|
-
- Contains no executable code
|
|
33
|
-
- Provides no functionality
|
|
34
|
-
- Should not be installed as a dependency
|
|
35
|
-
- Exists only for administrative purposes
|
|
48
|
+
Render the prompt:
|
|
36
49
|
|
|
37
|
-
|
|
50
|
+
```typescript
|
|
51
|
+
import { createPrompt, render, createInputIterator } from 'pupt-lib';
|
|
38
52
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
- [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
|
|
53
|
+
// Load the prompt
|
|
54
|
+
const element = await createPrompt('./greeting.tsx');
|
|
42
55
|
|
|
43
|
-
|
|
56
|
+
// Collect inputs
|
|
57
|
+
const iterator = createInputIterator(element);
|
|
58
|
+
iterator.start();
|
|
59
|
+
while (!iterator.isDone()) {
|
|
60
|
+
const req = iterator.current();
|
|
61
|
+
const answer = await askUser(req.label); // Your UI logic
|
|
62
|
+
await iterator.submit(answer);
|
|
63
|
+
iterator.advance();
|
|
64
|
+
}
|
|
44
65
|
|
|
45
|
-
|
|
66
|
+
// Render to text
|
|
67
|
+
const result = render(element, { inputs: iterator.getValues() });
|
|
68
|
+
console.log(result.text);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Or render directly with pre-supplied values:
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { createPrompt, render } from 'pupt-lib';
|
|
75
|
+
|
|
76
|
+
const element = await createPrompt('./greeting.tsx');
|
|
77
|
+
const result = render(element, {
|
|
78
|
+
inputs: { userName: 'Alice' }
|
|
79
|
+
});
|
|
80
|
+
console.log(result.text);
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Components
|
|
84
|
+
|
|
85
|
+
### Structural Components
|
|
86
|
+
|
|
87
|
+
| Component | Description |
|
|
88
|
+
|-----------|-------------|
|
|
89
|
+
| `<Prompt>` | Root container for a complete prompt. Props: `name`, `description`, `tags`, `version` |
|
|
90
|
+
| `<Section>` | Creates a labeled section with optional XML delimiters |
|
|
91
|
+
| `<Role>` | Defines the AI persona/role. Props: `expertise`, `domain` |
|
|
92
|
+
| `<Task>` | Clearly states what the AI should do |
|
|
93
|
+
| `<Context>` | Provides background information |
|
|
94
|
+
| `<Constraint>` | Adds boundaries/rules. Props: `type` (`must`, `should`, `must-not`) |
|
|
95
|
+
| `<Format>` | Specifies output format. Props: `type` (`json`, `markdown`, `code`, `list`), `schema` |
|
|
96
|
+
| `<Audience>` | Who the output is for. Props: `expertise`, `domain` |
|
|
97
|
+
| `<Tone>` | Emotional quality of output. Props: `type`, `formality` |
|
|
98
|
+
| `<SuccessCriteria>` | Container for success criteria |
|
|
99
|
+
| `<Criterion>` | Individual success criterion. Props: `priority` |
|
|
100
|
+
|
|
101
|
+
### Example Components
|
|
102
|
+
|
|
103
|
+
| Component | Description |
|
|
104
|
+
|-----------|-------------|
|
|
105
|
+
| `<Examples>` | Container for multiple examples |
|
|
106
|
+
| `<Example>` | Single example with input/output |
|
|
107
|
+
| `<ExampleInput>` | Input portion of an example |
|
|
108
|
+
| `<ExampleOutput>` | Expected output of an example |
|
|
109
|
+
|
|
110
|
+
### Reasoning Components
|
|
111
|
+
|
|
112
|
+
| Component | Description |
|
|
113
|
+
|-----------|-------------|
|
|
114
|
+
| `<Steps>` | Encourages step-by-step thinking |
|
|
115
|
+
| `<Step>` | Individual step in a reasoning chain. Props: `number` |
|
|
116
|
+
|
|
117
|
+
### Data Components
|
|
118
|
+
|
|
119
|
+
| Component | Description |
|
|
120
|
+
|-----------|-------------|
|
|
121
|
+
| `<Data>` | Embeds data with optional formatting. Props: `name`, `format` |
|
|
122
|
+
| `<Code>` | Embeds code with language hint. Props: `language`, `filename` |
|
|
123
|
+
| `<File>` | Embeds file contents. Props: `path` |
|
|
124
|
+
| `<Json>` | Embeds JSON data. Props: `name` |
|
|
125
|
+
| `<Xml>` | Embeds XML data. Props: `name` |
|
|
126
|
+
|
|
127
|
+
### Utility Components
|
|
128
|
+
|
|
129
|
+
| Component | Description |
|
|
130
|
+
|-----------|-------------|
|
|
131
|
+
| `<UUID>` | Generates a unique identifier |
|
|
132
|
+
| `<Timestamp>` | Current Unix timestamp |
|
|
133
|
+
| `<DateTime>` | Current date/time. Props: `format` |
|
|
134
|
+
| `<Hostname>` | Current machine hostname |
|
|
135
|
+
| `<Username>` | Current system username |
|
|
136
|
+
| `<Cwd>` | Current working directory |
|
|
137
|
+
|
|
138
|
+
### Control Flow Components
|
|
139
|
+
|
|
140
|
+
| Component | Description |
|
|
141
|
+
|-----------|-------------|
|
|
142
|
+
| `<If>` | Conditional rendering. Props: `when` (Excel formula or JS expression) |
|
|
143
|
+
| `<ForEach>` | Loop over items. Props: `items`, `as` |
|
|
144
|
+
| `<Scope>` | Resolve components from a specific library. Props: `from` |
|
|
145
|
+
|
|
146
|
+
### User Input Components (Ask.*)
|
|
147
|
+
|
|
148
|
+
| Component | Description |
|
|
149
|
+
|-----------|-------------|
|
|
150
|
+
| `<Ask.Text>` | Single-line text input. Props: `name`, `label`, `required`, `default`, `pattern` |
|
|
151
|
+
| `<Ask.Editor>` | Multi-line text editor. Props: `name`, `label`, `language` |
|
|
152
|
+
| `<Ask.Select>` | Single choice from options. Props: `name`, `label`, `options` or `<Option>` children |
|
|
153
|
+
| `<Ask.MultiSelect>` | Multiple choices. Props: `name`, `label`, `options` or `<Option>` children |
|
|
154
|
+
| `<Ask.Confirm>` | Yes/no question. Props: `name`, `label`, `default` |
|
|
155
|
+
| `<Ask.Choice>` | Binary choice with custom labels. Props: `name`, `label`, `options` |
|
|
156
|
+
| `<Ask.Number>` | Numeric input. Props: `name`, `label`, `min`, `max`, `default` |
|
|
157
|
+
| `<Ask.File>` | File path input. Props: `name`, `label`, `mustExist` |
|
|
158
|
+
| `<Ask.Path>` | Directory path input. Props: `name`, `label`, `mustBeDirectory` |
|
|
159
|
+
| `<Ask.Date>` | Date selection. Props: `name`, `label` |
|
|
160
|
+
| `<Ask.Secret>` | Masked input for sensitive values. Props: `name`, `label`, `validator` |
|
|
161
|
+
| `<Ask.Rating>` | Numeric scale input. Props: `name`, `label`, `min`, `max`, `labels` or `<Label>` children |
|
|
162
|
+
| `<Ask.ReviewFile>` | File input with post-execution review. Props: `name`, `label` |
|
|
163
|
+
| `<Option>` | Option for Select/MultiSelect. Props: `value`, `label`, children (render text) |
|
|
164
|
+
| `<Label>` | Label for Rating scale. Props: `value`, children (label text) |
|
|
165
|
+
|
|
166
|
+
### Meta Components
|
|
167
|
+
|
|
168
|
+
| Component | Description |
|
|
169
|
+
|-----------|-------------|
|
|
170
|
+
| `<Uses>` | Declares module dependencies. Props: `src`, `optional` |
|
|
171
|
+
|
|
172
|
+
### Post-Execution Components
|
|
173
|
+
|
|
174
|
+
| Component | Description |
|
|
175
|
+
|-----------|-------------|
|
|
176
|
+
| `<PostExecution>` | Container for post-execution actions |
|
|
177
|
+
| `<ReviewFile>` | Open a file for review after prompt execution. Props: `file`, `editor` |
|
|
178
|
+
| `<OpenUrl>` | Open a URL in browser. Props: `url`, `browser` |
|
|
179
|
+
| `<RunCommand>` | Execute a shell command. Props: `command`, `cwd` |
|
|
180
|
+
|
|
181
|
+
## API Summary
|
|
182
|
+
|
|
183
|
+
| Export | Type | Description |
|
|
184
|
+
|--------|------|-------------|
|
|
185
|
+
| `render(element, options?)` | Function | Render a PuptElement tree to text |
|
|
186
|
+
| `createPrompt(filePath)` | Function | Create a prompt from a JSX/TSX file |
|
|
187
|
+
| `createPromptFromSource(source, filename)` | Function | Create a prompt from source string |
|
|
188
|
+
| `createInputIterator(element)` | Function | Create iterator for collecting user inputs |
|
|
189
|
+
| `Component<Props>` | Class | Base class for custom components |
|
|
190
|
+
| `Pupt` | Class | High-level API for loading and managing prompt libraries |
|
|
191
|
+
| `createSearchEngine(config?)` | Function | Create fuzzy search engine for prompts |
|
|
192
|
+
| `createRegistry()` | Function | Create a new component registry |
|
|
193
|
+
| `defaultRegistry` | Const | The default global component registry |
|
|
194
|
+
|
|
195
|
+
## Detailed API Usage
|
|
196
|
+
|
|
197
|
+
### Rendering Prompts
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
import { render, createPromptFromSource } from 'pupt-lib';
|
|
201
|
+
|
|
202
|
+
// From source string
|
|
203
|
+
const element = await createPromptFromSource(`
|
|
204
|
+
<Prompt name="example">
|
|
205
|
+
<Role>You are a helpful assistant.</Role>
|
|
206
|
+
<Task>Help the user with their question.</Task>
|
|
207
|
+
</Prompt>
|
|
208
|
+
`, 'example.tsx');
|
|
209
|
+
|
|
210
|
+
// Render with options
|
|
211
|
+
const result = render(element, {
|
|
212
|
+
inputs: new Map([['userName', 'Alice']]), // or { userName: 'Alice' }
|
|
213
|
+
trim: true, // Trim whitespace (default: true)
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
console.log(result.text); // The rendered prompt text
|
|
217
|
+
console.log(result.postExecution); // Array of post-execution actions
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Collecting User Inputs
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
import { createPrompt, createInputIterator, render } from 'pupt-lib';
|
|
224
|
+
|
|
225
|
+
const element = await createPrompt('./my-prompt.tsx');
|
|
226
|
+
const iterator = createInputIterator(element);
|
|
227
|
+
|
|
228
|
+
// Start iteration
|
|
229
|
+
iterator.start();
|
|
230
|
+
|
|
231
|
+
// Iterate through each input requirement
|
|
232
|
+
while (!iterator.isDone()) {
|
|
233
|
+
const req = iterator.current();
|
|
234
|
+
|
|
235
|
+
console.log(`Name: ${req.name}`);
|
|
236
|
+
console.log(`Type: ${req.type}`);
|
|
237
|
+
console.log(`Label: ${req.label}`);
|
|
238
|
+
console.log(`Required: ${req.required}`);
|
|
239
|
+
|
|
240
|
+
// Collect input from user (your UI logic)
|
|
241
|
+
const answer = await promptUser(req);
|
|
242
|
+
|
|
243
|
+
// Submit and validate
|
|
244
|
+
const result = await iterator.submit(answer);
|
|
245
|
+
if (!result.valid) {
|
|
246
|
+
console.log(`Validation error: ${result.errors.map(e => e.message).join(', ')}`);
|
|
247
|
+
continue; // Re-prompt for same input
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
iterator.advance();
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Render with collected values
|
|
254
|
+
const result = render(element, { inputs: iterator.getValues() });
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Creating Custom Components
|
|
258
|
+
|
|
259
|
+
```typescript
|
|
260
|
+
import { Component, RenderContext, PuptNode } from 'pupt-lib';
|
|
261
|
+
|
|
262
|
+
interface WarningProps {
|
|
263
|
+
level: 'info' | 'warning' | 'error';
|
|
264
|
+
children?: PuptNode;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
class Warning extends Component<WarningProps> {
|
|
268
|
+
render(props: WarningProps, context: RenderContext): PuptNode {
|
|
269
|
+
const prefix = {
|
|
270
|
+
info: 'INFO',
|
|
271
|
+
warning: 'WARNING',
|
|
272
|
+
error: 'ERROR'
|
|
273
|
+
}[props.level];
|
|
274
|
+
|
|
275
|
+
return `[${prefix}] ${props.children}`;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Register with the default registry
|
|
280
|
+
import { defaultRegistry } from 'pupt-lib';
|
|
281
|
+
defaultRegistry.register('Warning', Warning);
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Using the Pupt Class
|
|
285
|
+
|
|
286
|
+
```typescript
|
|
287
|
+
import { Pupt } from 'pupt-lib';
|
|
288
|
+
|
|
289
|
+
// Initialize with module sources
|
|
290
|
+
const pupt = new Pupt({
|
|
291
|
+
modules: [
|
|
292
|
+
'@acme/prompts', // npm package
|
|
293
|
+
'https://example.com/prompts.js', // URL
|
|
294
|
+
'./local-prompts/', // local path
|
|
295
|
+
],
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
await pupt.init();
|
|
299
|
+
|
|
300
|
+
// List all prompts
|
|
301
|
+
const prompts = pupt.getPrompts();
|
|
302
|
+
console.log(prompts.map(p => p.name));
|
|
303
|
+
|
|
304
|
+
// Filter by tags
|
|
305
|
+
const devPrompts = pupt.getPrompts({ tags: ['development'] });
|
|
306
|
+
|
|
307
|
+
// Search prompts
|
|
308
|
+
const results = pupt.searchPrompts('code review');
|
|
309
|
+
|
|
310
|
+
// Get a specific prompt
|
|
311
|
+
const prompt = pupt.getPrompt('security-review');
|
|
312
|
+
if (prompt) {
|
|
313
|
+
const result = prompt.render({ inputs: { code: sourceCode } });
|
|
314
|
+
console.log(result.text);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// Get all unique tags
|
|
318
|
+
const tags = pupt.getTags();
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Conditional Rendering
|
|
322
|
+
|
|
323
|
+
```typescript
|
|
324
|
+
// Excel formula syntax (accessible to non-technical users)
|
|
325
|
+
<If when='=AND(count>5, userType="admin")'>
|
|
326
|
+
<Ask.Text name="adminCode" label="Admin authorization code" />
|
|
327
|
+
</If>
|
|
328
|
+
|
|
329
|
+
// JavaScript expression (for power users)
|
|
330
|
+
<If when={items.filter(i => i.priority > 3).length >= 2}>
|
|
331
|
+
<Task>Handle high-priority items first</Task>
|
|
332
|
+
</If>
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### Post-Execution Actions
|
|
336
|
+
|
|
337
|
+
```typescript
|
|
338
|
+
import { createPrompt, render } from 'pupt-lib';
|
|
339
|
+
|
|
340
|
+
const element = await createPrompt('./generate-code.tsx');
|
|
341
|
+
const result = render(element, { inputs: { ... } });
|
|
342
|
+
|
|
343
|
+
// Handle post-execution actions
|
|
344
|
+
for (const action of result.postExecution) {
|
|
345
|
+
switch (action.type) {
|
|
346
|
+
case 'reviewFile':
|
|
347
|
+
openInEditor(action.file, action.editor);
|
|
348
|
+
break;
|
|
349
|
+
case 'openUrl':
|
|
350
|
+
openBrowser(action.url);
|
|
351
|
+
break;
|
|
352
|
+
case 'runCommand':
|
|
353
|
+
exec(action.command, { cwd: action.cwd });
|
|
354
|
+
break;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### TypeScript Configuration
|
|
360
|
+
|
|
361
|
+
For build-time JSX transformation, configure `tsconfig.json`:
|
|
362
|
+
|
|
363
|
+
```json
|
|
364
|
+
{
|
|
365
|
+
"compilerOptions": {
|
|
366
|
+
"jsx": "react-jsx",
|
|
367
|
+
"jsxImportSource": "pupt-lib"
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
Or use the Babel preset for runtime transformation:
|
|
373
|
+
|
|
374
|
+
```javascript
|
|
375
|
+
// babel.config.js
|
|
376
|
+
module.exports = {
|
|
377
|
+
presets: [
|
|
378
|
+
'pupt-lib/babel-preset'
|
|
379
|
+
]
|
|
380
|
+
};
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
## License
|
|
384
|
+
|
|
385
|
+
MIT
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { PuptInitConfig, SearchResult, SearchOptions, RenderOptions, RenderResult, PuptElement } from './types';
|
|
2
|
+
import { InputIterator } from './services/input-iterator';
|
|
3
|
+
import { Scope } from './services/scope';
|
|
4
|
+
/**
|
|
5
|
+
* A discovered prompt with render and input iterator capabilities
|
|
6
|
+
*/
|
|
7
|
+
export interface DiscoveredPromptWithMethods {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
tags: string[];
|
|
11
|
+
library: string;
|
|
12
|
+
element: PuptElement;
|
|
13
|
+
render(options?: Partial<RenderOptions>): RenderResult;
|
|
14
|
+
getInputIterator(): InputIterator;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Main Pupt class for initializing, discovering, and rendering prompts
|
|
18
|
+
*/
|
|
19
|
+
export declare class Pupt {
|
|
20
|
+
private config;
|
|
21
|
+
private scopeLoader;
|
|
22
|
+
private moduleLoader;
|
|
23
|
+
private searchEngine;
|
|
24
|
+
private prompts;
|
|
25
|
+
private initialized;
|
|
26
|
+
constructor(config: PuptInitConfig);
|
|
27
|
+
init(): Promise<void>;
|
|
28
|
+
getPrompts(filter?: {
|
|
29
|
+
tags?: string[];
|
|
30
|
+
}): DiscoveredPromptWithMethods[];
|
|
31
|
+
getPrompt(name: string): DiscoveredPromptWithMethods | undefined;
|
|
32
|
+
searchPrompts(query: string, options?: Partial<SearchOptions>): SearchResult[];
|
|
33
|
+
getTags(): string[];
|
|
34
|
+
getPromptsByTag(tag: string): DiscoveredPromptWithMethods[];
|
|
35
|
+
hasComponent(name: string): boolean;
|
|
36
|
+
getRegistry(): Scope;
|
|
37
|
+
private discoverPrompts;
|
|
38
|
+
private loadModuleExports;
|
|
39
|
+
private isPromptElement;
|
|
40
|
+
private createDiscoveredPrompt;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,WAAW,EACZ,MAAM,SAAS,CAAC;AAIjB,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAEpF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,YAAY,CAAC;IACvD,gBAAgB,IAAI,aAAa,CAAC;CACnC;AAED;;GAEG;AACH,qBAAa,IAAI;IAOH,OAAO,CAAC,MAAM;IAN1B,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,YAAY,CAAsB;IAC1C,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,OAAO,CAAqC;IACpD,OAAO,CAAC,WAAW,CAAS;gBAER,MAAM,EAAE,cAAc;IAIpC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAwB3B,UAAU,CAAC,MAAM,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,2BAA2B,EAAE;IAOvE,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,2BAA2B,GAAG,SAAS;IAIhE,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,YAAY,EAAE;IAI9E,OAAO,IAAI,MAAM,EAAE;IAInB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,2BAA2B,EAAE;IAI3D,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAInC,WAAW,IAAI,KAAK;YAIN,eAAe;YAyCf,iBAAiB;IAe/B,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,sBAAsB;CA8B/B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ConfigAPI, TransformOptions } from '@babel/core';
|
|
2
|
+
export interface PuptBabelPresetOptions {
|
|
3
|
+
typescript?: boolean;
|
|
4
|
+
development?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function puptBabelPreset(api: ConfigAPI, options?: PuptBabelPresetOptions): TransformOptions;
|
|
7
|
+
export default puptBabelPreset;
|
|
8
|
+
//# sourceMappingURL=preset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../../src/babel/preset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/D,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,eAAe,CAC7B,GAAG,EAAE,SAAS,EACd,OAAO,GAAE,sBAA2B,GACnC,gBAAgB,CAiBlB;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function puptBabelPreset(api, options = {}) {
|
|
2
|
+
const { typescript = true, development = false } = options;
|
|
3
|
+
api.cache.using(() => JSON.stringify(options));
|
|
4
|
+
return {
|
|
5
|
+
presets: [
|
|
6
|
+
typescript && ["@babel/preset-typescript", { isTSX: true, allExtensions: true }]
|
|
7
|
+
].filter(Boolean),
|
|
8
|
+
plugins: [
|
|
9
|
+
["@babel/plugin-transform-react-jsx", {
|
|
10
|
+
runtime: "automatic",
|
|
11
|
+
importSource: "pupt-lib",
|
|
12
|
+
development
|
|
13
|
+
}]
|
|
14
|
+
]
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
puptBabelPreset as default,
|
|
19
|
+
puptBabelPreset
|
|
20
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { PuptNode, RenderContext } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Symbol used to mark Component classes for identification
|
|
4
|
+
*/
|
|
5
|
+
export declare const COMPONENT_MARKER: unique symbol;
|
|
6
|
+
/**
|
|
7
|
+
* Abstract base class for pupt-lib components.
|
|
8
|
+
* Extend this class to create class-based components with access to render context.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* class Greeting extends Component<{ name: string }> {
|
|
13
|
+
* render(props: { name: string }, context: RenderContext): string {
|
|
14
|
+
* return `Hello, ${props.name}!`;
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare abstract class Component<Props = Record<string, unknown>> {
|
|
20
|
+
static [COMPONENT_MARKER]: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Render the component with the given props and context.
|
|
23
|
+
*
|
|
24
|
+
* @param props - The properties passed to the component
|
|
25
|
+
* @param context - The render context containing environment and inputs
|
|
26
|
+
* @returns The rendered output as a PuptNode
|
|
27
|
+
*/
|
|
28
|
+
abstract render(props: Props, context: RenderContext): PuptNode;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Type guard to check if a value is a Component class (not an instance).
|
|
32
|
+
*
|
|
33
|
+
* @param value - The value to check
|
|
34
|
+
* @returns true if the value is a class extending Component
|
|
35
|
+
*/
|
|
36
|
+
export declare function isComponentClass(value: unknown): value is typeof Component;
|
|
37
|
+
//# sourceMappingURL=component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,gBAAgB,eAAsC,CAAC;AAEpE;;;;;;;;;;;;GAYG;AACH,8BAAsB,SAAS,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC7D,MAAM,CAAC,CAAC,gBAAgB,CAAC,UAAQ;IAEjC;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,GAAG,QAAQ;CAChE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,OAAO,SAAS,CAK3B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Component } from '../../component';
|
|
2
|
+
import { PuptNode, RenderContext } from '../../types';
|
|
3
|
+
export interface ChoiceOption {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ChoiceProps {
|
|
8
|
+
name: string;
|
|
9
|
+
label: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
default?: string;
|
|
13
|
+
options: [ChoiceOption, ChoiceOption];
|
|
14
|
+
children?: PuptNode;
|
|
15
|
+
}
|
|
16
|
+
export declare class AskChoice extends Component<ChoiceProps> {
|
|
17
|
+
render(props: ChoiceProps, context: RenderContext): PuptNode;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=Choice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Choice.d.ts","sourceRoot":"","sources":["../../../src/components/ask/Choice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAoB,MAAM,aAAa,CAAC;AAG7E,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAGD,qBAAa,SAAU,SAAQ,SAAS,CAAC,WAAW,CAAC;IACnD,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,GAAG,QAAQ;CAuC7D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component } from '../../component';
|
|
2
|
+
import { PuptNode, RenderContext } from '../../types';
|
|
3
|
+
export interface ConfirmProps {
|
|
4
|
+
name: string;
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
default?: boolean;
|
|
9
|
+
children?: PuptNode;
|
|
10
|
+
}
|
|
11
|
+
export declare class AskConfirm extends Component<ConfirmProps> {
|
|
12
|
+
render(props: ConfirmProps, context: RenderContext): PuptNode;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=Confirm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Confirm.d.ts","sourceRoot":"","sources":["../../../src/components/ask/Confirm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAoB,MAAM,aAAa,CAAC;AAG7E,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAGD,qBAAa,UAAW,SAAQ,SAAS,CAAC,YAAY,CAAC;IACrD,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,GAAG,QAAQ;CAgC9D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Component } from '../../component';
|
|
2
|
+
import { PuptNode, RenderContext } from '../../types';
|
|
3
|
+
export interface DateProps {
|
|
4
|
+
name: string;
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
default?: string;
|
|
9
|
+
includeTime?: boolean;
|
|
10
|
+
minDate?: string;
|
|
11
|
+
maxDate?: string;
|
|
12
|
+
children?: PuptNode;
|
|
13
|
+
}
|
|
14
|
+
export declare class AskDate extends Component<DateProps> {
|
|
15
|
+
render(props: DateProps, context: RenderContext): PuptNode;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=Date.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Date.d.ts","sourceRoot":"","sources":["../../../src/components/ask/Date.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAoB,MAAM,aAAa,CAAC;AAG7E,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAGD,qBAAa,OAAQ,SAAQ,SAAS,CAAC,SAAS,CAAC;IAC/C,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,GAAG,QAAQ;CAsC3D"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Component } from '../../component';
|
|
2
|
+
import { PuptNode, RenderContext } from '../../types';
|
|
3
|
+
export interface EditorProps {
|
|
4
|
+
name: string;
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
default?: string;
|
|
9
|
+
language?: string;
|
|
10
|
+
children?: PuptNode;
|
|
11
|
+
}
|
|
12
|
+
export declare class AskEditor extends Component<EditorProps> {
|
|
13
|
+
render(props: EditorProps, context: RenderContext): PuptNode;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=Editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../../src/components/ask/Editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAoB,MAAM,aAAa,CAAC;AAG7E,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAGD,qBAAa,SAAU,SAAQ,SAAS,CAAC,WAAW,CAAC;IACnD,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,GAAG,QAAQ;CAkC7D"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Component } from '../../component';
|
|
2
|
+
import { PuptNode, RenderContext } from '../../types';
|
|
3
|
+
export interface FileProps {
|
|
4
|
+
name: string;
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
default?: string | string[];
|
|
9
|
+
extensions?: string[];
|
|
10
|
+
multiple?: boolean;
|
|
11
|
+
mustExist?: boolean;
|
|
12
|
+
includeContents?: boolean;
|
|
13
|
+
children?: PuptNode;
|
|
14
|
+
}
|
|
15
|
+
export declare class AskFile extends Component<FileProps> {
|
|
16
|
+
render(props: FileProps, context: RenderContext): PuptNode;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=File.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"File.d.ts","sourceRoot":"","sources":["../../../src/components/ask/File.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAoB,MAAM,aAAa,CAAC;AAG7E,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,qBAAa,OAAQ,SAAQ,SAAS,CAAC,SAAS,CAAC;IAC/C,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,GAAG,QAAQ;CA8C3D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component } from '../../component';
|
|
2
|
+
import { PuptNode, RenderContext } from '../../types';
|
|
3
|
+
export interface LabelProps {
|
|
4
|
+
value: number | string;
|
|
5
|
+
children?: PuptNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Label component for use inside Ask.Rating.
|
|
9
|
+
* Maps a numeric value to a descriptive label.
|
|
10
|
+
*/
|
|
11
|
+
export declare class AskLabel extends Component<LabelProps> {
|
|
12
|
+
render(_props: LabelProps, _context: RenderContext): PuptNode;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=Label.d.ts.map
|