@vicaniddouglas/js_aide 1.12.0 → 1.13.1

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 CHANGED
@@ -1,12 +1,13 @@
1
1
  # @vicaniddouglas/js_aide
2
2
 
3
- A versatile collection of modular JavaScript utility helpers designed to streamline single-page application (SPA) development and general web programming tasks. This library provides a set of independent modules for common functionalities such as routing, input handling, validation, and more.
3
+ [![Documentation & Demo](https://img.shields.io/badge/Live-Documentation%20%26%20Demo-blue?style=for-the-badge&logo=gitlab)](https://vicaniddouglas.gitlab.io/js_aide)
4
4
 
5
- ## Description
5
+ **JS Aide** is a high-performance, modular utility collection designed for modern web applications. Whether you're building a native SPA or an enterprise-grade MPA, JS Aide provides the orchestrated power you need.
6
6
 
7
- `@vicaniddouglas/js_aide` bundles frequently needed JavaScript functionalities into a cohesive, easy-to-use package. Each module is designed to be independent, allowing you to import only what you need, reducing bundle size and improving application performance. From dynamic client-side routing to robust input validation and DOM manipulation, this library aims to accelerate your development workflow.
8
-
9
- ## Features
7
+ ## 🕹️ Live Playground
8
+ Explore all library features—including the new Asynchronous Handshaking system—directly in our **[Interactive Sandbox](https://vicaniddouglas.gitlab.io/js_aide)**.
9
+ npm explore @vicaniddouglas/js_aide -- npm run serve:demo
10
+ ```
10
11
 
11
12
  ### `Router`
12
13
 
@@ -337,6 +338,40 @@ popup.success("Photo Uploaded!", {
337
338
  });
338
339
  ```
339
340
 
341
+ #### 4. Asynchronous Handshaking (Zero-Alert)
342
+ 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`).
343
+
344
+ **Confirmation Dialogs**
345
+ Returns `true` on confirm, `false` on cancel/close.
346
+ ```javascript
347
+ const confirmed = await popup.confirm("Are you sure you want to delete this?");
348
+
349
+ if (confirmed) {
350
+ await deleteRecord();
351
+ await popup.success("Deleted!");
352
+ }
353
+ ```
354
+
355
+ **Data-Entry Prompts**
356
+ Returns the input value as a **string** on submit, or `null` if cancelled.
357
+ ```javascript
358
+ const name = await popup.prompt("Enter your display name:", {
359
+ placeholder: "e.g., Douglas",
360
+ inputType: "text" // Options: text, number, currency, password
361
+ });
362
+
363
+ if (name) {
364
+ console.log("Hello", name);
365
+ }
366
+ ```
367
+
368
+ | Prompt Option | Description |
369
+ | :--- | :--- |
370
+ | `inputType` | Controls input behavior (`text`, `number`, `currency`, `password`). |
371
+ | `defaultValue`| Initial text inside the input. |
372
+ | `submitText` | Text for the action button (default: "Submit"). |
373
+ | `cancelText` | Text for the dismiss button (default: "Cancel"). |
374
+
340
375
  ## Development
341
376
 
342
377
  ### 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
  };