@vicaniddouglas/js_aide 1.12.0 → 1.13.0
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 +47 -0
- package/declarations.d.ts +24 -0
- package/demo/index.html +1243 -0
- package/demo/main.js +368 -0
- package/demo/style.css +541 -0
- package/dist/js_aide.cjs.js +337 -314
- package/dist/js_aide.cjs.js.map +4 -4
- package/dist/js_aide.esm.js +337 -314
- package/dist/js_aide.esm.js.map +4 -4
- package/dist/js_aide.min.js +337 -314
- package/dist/js_aide.min.js.map +4 -4
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -8,6 +8,19 @@ A versatile collection of modular JavaScript utility helpers designed to streaml
|
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
|
+
### 🎮 Live Playground
|
|
12
|
+
Explore all library features—including the new Asynchronous Handshaking system—directly in our interactive sandbox.
|
|
13
|
+
|
|
14
|
+
**Access via Repository:**
|
|
15
|
+
1. Clone the repository: `git clone https://gitlab.com/vicaniddouglas/js_aide.git`
|
|
16
|
+
2. Open `demo/index.html` in any modern browser.
|
|
17
|
+
|
|
18
|
+
**Access via NPM:**
|
|
19
|
+
If you have the package installed locally, you can run the playground using:
|
|
20
|
+
```bash
|
|
21
|
+
npm explore @vicaniddouglas/js_aide -- npm run serve:demo
|
|
22
|
+
```
|
|
23
|
+
|
|
11
24
|
### `Router`
|
|
12
25
|
|
|
13
26
|
A modern, feature-rich client-side router for Single-Page Applications (SPAs).
|
|
@@ -337,6 +350,40 @@ popup.success("Photo Uploaded!", {
|
|
|
337
350
|
});
|
|
338
351
|
```
|
|
339
352
|
|
|
353
|
+
#### 4. Asynchronous Handshaking (Zero-Alert)
|
|
354
|
+
The popup system provides replacements for native `confirm()` and `prompt()` that are fully asynchronous, themeable, and non-blocking in the developer's logic (via `await`).
|
|
355
|
+
|
|
356
|
+
**Confirmation Dialogs**
|
|
357
|
+
Returns `true` on confirm, `false` on cancel/close.
|
|
358
|
+
```javascript
|
|
359
|
+
const confirmed = await popup.confirm("Are you sure you want to delete this?");
|
|
360
|
+
|
|
361
|
+
if (confirmed) {
|
|
362
|
+
await deleteRecord();
|
|
363
|
+
await popup.success("Deleted!");
|
|
364
|
+
}
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
**Data-Entry Prompts**
|
|
368
|
+
Returns the input value as a **string** on submit, or `null` if cancelled.
|
|
369
|
+
```javascript
|
|
370
|
+
const name = await popup.prompt("Enter your display name:", {
|
|
371
|
+
placeholder: "e.g., Douglas",
|
|
372
|
+
inputType: "text" // Options: text, number, currency, password
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
if (name) {
|
|
376
|
+
console.log("Hello", name);
|
|
377
|
+
}
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
| Prompt Option | Description |
|
|
381
|
+
| :--- | :--- |
|
|
382
|
+
| `inputType` | Controls input behavior (`text`, `number`, `currency`, `password`). |
|
|
383
|
+
| `defaultValue`| Initial text inside the input. |
|
|
384
|
+
| `submitText` | Text for the action button (default: "Submit"). |
|
|
385
|
+
| `cancelText` | Text for the dismiss button (default: "Cancel"). |
|
|
386
|
+
|
|
340
387
|
## Development
|
|
341
388
|
|
|
342
389
|
### Running Tests
|
package/declarations.d.ts
CHANGED
|
@@ -1250,6 +1250,26 @@ declare module "@vicaniddouglas/js_aide" {
|
|
|
1250
1250
|
color?: string;
|
|
1251
1251
|
}
|
|
1252
1252
|
|
|
1253
|
+
interface ConfirmOptions extends PopupOptions {
|
|
1254
|
+
/** Text for the confirm button (default: "Confirm") */
|
|
1255
|
+
confirmText?: string;
|
|
1256
|
+
/** Text for the cancel button (default: "Cancel") */
|
|
1257
|
+
cancelText?: string;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
interface PromptOptions extends PopupOptions {
|
|
1261
|
+
/** Type of input: text, number, currency, or password */
|
|
1262
|
+
inputType?: "text" | "number" | "currency" | "password";
|
|
1263
|
+
/** Input placeholder text */
|
|
1264
|
+
placeholder?: string;
|
|
1265
|
+
/** Initial value for the input */
|
|
1266
|
+
defaultValue?: string;
|
|
1267
|
+
/** Text for the submit button (default: "Submit") */
|
|
1268
|
+
submitText?: string;
|
|
1269
|
+
/** Text for the cancel button (default: "Cancel") */
|
|
1270
|
+
cancelText?: string;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1253
1273
|
export const popup: {
|
|
1254
1274
|
/** Show a success modal (Green theme) */
|
|
1255
1275
|
success(message: string, options?: PopupOptions): Promise<void>;
|
|
@@ -1257,6 +1277,10 @@ declare module "@vicaniddouglas/js_aide" {
|
|
|
1257
1277
|
error(message: string, options?: PopupOptions): Promise<void>;
|
|
1258
1278
|
/** Show an info modal (Blue theme) */
|
|
1259
1279
|
info(message: string, options?: PopupOptions): Promise<void>;
|
|
1280
|
+
/** Show a confirmation dialog (Slate theme). Returns true if confirmed, false otherwise. */
|
|
1281
|
+
confirm(message: string, options?: ConfirmOptions): Promise<boolean>;
|
|
1282
|
+
/** Show a prompt dialog (Slate theme). Returns the value if submitted, null if cancelled. */
|
|
1283
|
+
prompt(message: string, options?: PromptOptions): Promise<string | null>;
|
|
1260
1284
|
/** Programmatically close the current modal */
|
|
1261
1285
|
close(): void;
|
|
1262
1286
|
};
|