dolphin-client 1.1.1 → 1.1.3

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/fulltutorial.md CHANGED
@@ -503,6 +503,61 @@ Ternary operator (`condition ? true : false`) वा बहु-लाइन `if/
503
503
  <button data-store-click="app.darkMode = !app.darkMode">डार्क मोड अन/अफ</button>
504
504
  ```
505
505
 
506
+ ### १०.१.३. Declarative Store Initialization & Context Containers (`<dolphin-store>`) - स्टोर घोषणा, प्रारम्भिकरण र अटो-बाइन्डिङ
507
+
508
+ Dolphin Client v2.0 introduces the `<dolphin-store>` tag for declaring, seeding, and auto-wiring reactive stores directly in HTML without writing custom JavaScript scripts.
509
+
510
+ #### क) Seed-Only Mode (विशुद्ध डेटा सीडिङ)
511
+ If the `<dolphin-store>` tag does not contain child elements, it seeds the store and remains hidden (`display: none`). You can seed data via tag attributes or inline JSON content:
512
+
513
+ **Attribute-Based Seeding:**
514
+ ```html
515
+ <!-- Automatically seeds store "app" with boolean, numeric, null, and string types -->
516
+ <dolphin-store name="app" count="0" isAdding="false" user="null" theme="dark"></dolphin-store>
517
+ ```
518
+
519
+ **JSON-Based Seeding:**
520
+ ```html
521
+ <!-- Seed complex objects/arrays by putting JSON content inside the tag -->
522
+ <dolphin-store name="app">
523
+ {
524
+ "count": 10,
525
+ "user": { "name": "Shankar", "role": "admin" },
526
+ "loggedIn": true
527
+ }
528
+ </dolphin-store>
529
+ ```
530
+
531
+ #### ख) Context Container Dual-Mode (डबल-मोड - डेटा कन्टेनर)
532
+ If the `<dolphin-store>` tag contains child elements, it acts as a **reactive context container** and remains visible. Its children can read and write to the store dynamically using `data-store-*` directives:
533
+
534
+ ```html
535
+ <!-- Acts as the reactive container for 'store/profile' -->
536
+ <dolphin-store name="profile" username="Shankar" role="Admin">
537
+ <div class="card">
538
+ <h3 data-rt-text="username"></h3>
539
+ <span class="badge" data-rt-text="role"></span>
540
+ </div>
541
+ </dolphin-store>
542
+ ```
543
+
544
+ #### ग) Template Auto-Wiring (टेम्पलेट स्वतः-कनेक्सन)
545
+ By setting the `template` attribute on a `<dolphin-store>`, Dolphin will automatically generate a reactive binding `div` right after it, compile the specified template selector, and render it with the store's seeded state immediately on page load:
546
+
547
+ ```html
548
+ <!-- 1. The Svelte-style template -->
549
+ <template id="counter-ui">
550
+ <div class="counter-box">
551
+ <p>Count: {{count}}</p>
552
+ <button data-rt-click="app.count = app.count + 1">Increment</button>
553
+ </div>
554
+ </template>
555
+
556
+ <!-- 2. Auto-wire the store app to the template (No separate wrapper div required!) -->
557
+ <dolphin-store name="app" template="#counter-ui" count="5"></dolphin-store>
558
+ ```
559
+ Under the hood, this dynamically injects a binding container that subscribes to `store/app` and updates the UI in real-time.
560
+
506
561
  ### १०.२. Declarative Validations (`data-validate`)
507
562
  Apply robust validation rules to inputs and forms instantly. Tagged invalid inputs automatically receive `.invalid` classes and publish error text:
508
563
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dolphin-client",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "HTML is back! Hookless, framework-agnostic real-time reactive DOM-binding client for Dolphin Server with WebSockets, WebRTC signaling, and offline REST API fallbacks.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",