@prabhask5/stellar-engine 1.1.7 → 1.1.9
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 +12 -18
- package/dist/actions/remoteChange.d.ts +143 -18
- package/dist/actions/remoteChange.d.ts.map +1 -1
- package/dist/actions/remoteChange.js +182 -58
- package/dist/actions/remoteChange.js.map +1 -1
- package/dist/actions/truncateTooltip.d.ts +26 -12
- package/dist/actions/truncateTooltip.d.ts.map +1 -1
- package/dist/actions/truncateTooltip.js +89 -34
- package/dist/actions/truncateTooltip.js.map +1 -1
- package/dist/auth/crypto.d.ts +35 -8
- package/dist/auth/crypto.d.ts.map +1 -1
- package/dist/auth/crypto.js +38 -10
- package/dist/auth/crypto.js.map +1 -1
- package/dist/auth/deviceVerification.d.ts +236 -20
- package/dist/auth/deviceVerification.d.ts.map +1 -1
- package/dist/auth/deviceVerification.js +293 -40
- package/dist/auth/deviceVerification.js.map +1 -1
- package/dist/auth/displayUtils.d.ts +98 -0
- package/dist/auth/displayUtils.d.ts.map +1 -0
- package/dist/auth/displayUtils.js +133 -0
- package/dist/auth/displayUtils.js.map +1 -0
- package/dist/auth/loginGuard.d.ts +103 -16
- package/dist/auth/loginGuard.d.ts.map +1 -1
- package/dist/auth/loginGuard.js +163 -76
- package/dist/auth/loginGuard.js.map +1 -1
- package/dist/auth/offlineCredentials.d.ts +88 -24
- package/dist/auth/offlineCredentials.d.ts.map +1 -1
- package/dist/auth/offlineCredentials.js +114 -73
- package/dist/auth/offlineCredentials.js.map +1 -1
- package/dist/auth/offlineSession.d.ts +83 -9
- package/dist/auth/offlineSession.d.ts.map +1 -1
- package/dist/auth/offlineSession.js +104 -13
- package/dist/auth/offlineSession.js.map +1 -1
- package/dist/auth/resolveAuthState.d.ts +67 -9
- package/dist/auth/resolveAuthState.d.ts.map +1 -1
- package/dist/auth/resolveAuthState.js +125 -71
- package/dist/auth/resolveAuthState.js.map +1 -1
- package/dist/auth/singleUser.d.ts +390 -37
- package/dist/auth/singleUser.d.ts.map +1 -1
- package/dist/auth/singleUser.js +504 -103
- package/dist/auth/singleUser.js.map +1 -1
- package/dist/bin/install-pwa.d.ts +18 -2
- package/dist/bin/install-pwa.d.ts.map +1 -1
- package/dist/bin/install-pwa.js +2624 -77
- package/dist/bin/install-pwa.js.map +1 -1
- package/dist/config.d.ts +131 -15
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +87 -9
- package/dist/config.js.map +1 -1
- package/dist/conflicts.d.ts +246 -23
- package/dist/conflicts.d.ts.map +1 -1
- package/dist/conflicts.js +495 -46
- package/dist/conflicts.js.map +1 -1
- package/dist/data.d.ts +338 -18
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +385 -34
- package/dist/data.js.map +1 -1
- package/dist/database.d.ts +72 -14
- package/dist/database.d.ts.map +1 -1
- package/dist/database.js +120 -29
- package/dist/database.js.map +1 -1
- package/dist/debug.d.ts +77 -1
- package/dist/debug.d.ts.map +1 -1
- package/dist/debug.js +88 -1
- package/dist/debug.js.map +1 -1
- package/dist/deviceId.d.ts +38 -7
- package/dist/deviceId.d.ts.map +1 -1
- package/dist/deviceId.js +68 -10
- package/dist/deviceId.js.map +1 -1
- package/dist/engine.d.ts +175 -3
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +756 -109
- package/dist/engine.js.map +1 -1
- package/dist/entries/actions.d.ts +13 -0
- package/dist/entries/actions.d.ts.map +1 -1
- package/dist/entries/actions.js +26 -1
- package/dist/entries/actions.js.map +1 -1
- package/dist/entries/auth.d.ts +15 -4
- package/dist/entries/auth.d.ts.map +1 -1
- package/dist/entries/auth.js +47 -4
- package/dist/entries/auth.js.map +1 -1
- package/dist/entries/config.d.ts +12 -0
- package/dist/entries/config.d.ts.map +1 -1
- package/dist/entries/config.js +18 -1
- package/dist/entries/config.js.map +1 -1
- package/dist/entries/kit.d.ts +11 -0
- package/dist/entries/kit.d.ts.map +1 -1
- package/dist/entries/kit.js +52 -2
- package/dist/entries/kit.js.map +1 -1
- package/dist/entries/stores.d.ts +11 -0
- package/dist/entries/stores.d.ts.map +1 -1
- package/dist/entries/stores.js +43 -2
- package/dist/entries/stores.js.map +1 -1
- package/dist/entries/types.d.ts +10 -1
- package/dist/entries/types.d.ts.map +1 -1
- package/dist/entries/types.js +10 -0
- package/dist/entries/types.js.map +1 -1
- package/dist/entries/utils.d.ts +6 -0
- package/dist/entries/utils.d.ts.map +1 -1
- package/dist/entries/utils.js +22 -1
- package/dist/entries/utils.js.map +1 -1
- package/dist/entries/vite.d.ts +17 -0
- package/dist/entries/vite.d.ts.map +1 -1
- package/dist/entries/vite.js +24 -1
- package/dist/entries/vite.js.map +1 -1
- package/dist/index.d.ts +32 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +166 -23
- package/dist/index.js.map +1 -1
- package/dist/kit/auth.d.ts +60 -5
- package/dist/kit/auth.d.ts.map +1 -1
- package/dist/kit/auth.js +45 -4
- package/dist/kit/auth.js.map +1 -1
- package/dist/kit/confirm.d.ts +93 -12
- package/dist/kit/confirm.d.ts.map +1 -1
- package/dist/kit/confirm.js +103 -16
- package/dist/kit/confirm.js.map +1 -1
- package/dist/kit/loads.d.ts +148 -23
- package/dist/kit/loads.d.ts.map +1 -1
- package/dist/kit/loads.js +136 -28
- package/dist/kit/loads.js.map +1 -1
- package/dist/kit/server.d.ts +142 -10
- package/dist/kit/server.d.ts.map +1 -1
- package/dist/kit/server.js +158 -15
- package/dist/kit/server.js.map +1 -1
- package/dist/kit/sw.d.ts +152 -23
- package/dist/kit/sw.d.ts.map +1 -1
- package/dist/kit/sw.js +182 -26
- package/dist/kit/sw.js.map +1 -1
- package/dist/queue.d.ts +274 -0
- package/dist/queue.d.ts.map +1 -1
- package/dist/queue.js +556 -38
- package/dist/queue.js.map +1 -1
- package/dist/realtime.d.ts +241 -27
- package/dist/realtime.d.ts.map +1 -1
- package/dist/realtime.js +633 -109
- package/dist/realtime.js.map +1 -1
- package/dist/runtime/runtimeConfig.d.ts +91 -8
- package/dist/runtime/runtimeConfig.d.ts.map +1 -1
- package/dist/runtime/runtimeConfig.js +146 -19
- package/dist/runtime/runtimeConfig.js.map +1 -1
- package/dist/stores/authState.d.ts +150 -11
- package/dist/stores/authState.d.ts.map +1 -1
- package/dist/stores/authState.js +169 -17
- package/dist/stores/authState.js.map +1 -1
- package/dist/stores/network.d.ts +39 -0
- package/dist/stores/network.d.ts.map +1 -1
- package/dist/stores/network.js +169 -16
- package/dist/stores/network.js.map +1 -1
- package/dist/stores/remoteChanges.d.ts +327 -52
- package/dist/stores/remoteChanges.d.ts.map +1 -1
- package/dist/stores/remoteChanges.js +337 -75
- package/dist/stores/remoteChanges.js.map +1 -1
- package/dist/stores/sync.d.ts +130 -0
- package/dist/stores/sync.d.ts.map +1 -1
- package/dist/stores/sync.js +167 -7
- package/dist/stores/sync.js.map +1 -1
- package/dist/supabase/auth.d.ts +186 -46
- package/dist/supabase/auth.d.ts.map +1 -1
- package/dist/supabase/auth.js +238 -190
- package/dist/supabase/auth.js.map +1 -1
- package/dist/supabase/client.d.ts +79 -6
- package/dist/supabase/client.d.ts.map +1 -1
- package/dist/supabase/client.js +158 -15
- package/dist/supabase/client.js.map +1 -1
- package/dist/supabase/validate.d.ts +101 -7
- package/dist/supabase/validate.d.ts.map +1 -1
- package/dist/supabase/validate.js +117 -8
- package/dist/supabase/validate.js.map +1 -1
- package/dist/sw/build/vite-plugin.d.ts +55 -10
- package/dist/sw/build/vite-plugin.d.ts.map +1 -1
- package/dist/sw/build/vite-plugin.js +77 -18
- package/dist/sw/build/vite-plugin.js.map +1 -1
- package/dist/sw/sw.js +99 -44
- package/dist/types.d.ts +150 -26
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +12 -10
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +55 -13
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +83 -22
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/dist/auth/admin.d.ts +0 -12
- package/dist/auth/admin.d.ts.map +0 -1
- package/dist/auth/admin.js +0 -26
- package/dist/auth/admin.js.map +0 -1
- package/dist/auth/offlineLogin.d.ts +0 -34
- package/dist/auth/offlineLogin.d.ts.map +0 -1
- package/dist/auth/offlineLogin.js +0 -75
- package/dist/auth/offlineLogin.js.map +0 -1
package/README.md
CHANGED
|
@@ -81,7 +81,6 @@ initEngine({
|
|
|
81
81
|
tables: [/* ... */],
|
|
82
82
|
database: {/* ... */},
|
|
83
83
|
auth: {
|
|
84
|
-
mode: 'single-user',
|
|
85
84
|
singleUser: { gateType: 'code', codeLength: 4 },
|
|
86
85
|
enableOfflineAuth: true,
|
|
87
86
|
// emailConfirmation: { enabled: true }, // require email confirmation on setup
|
|
@@ -132,9 +131,9 @@ The command creates a full SvelteKit 2 + Svelte 5 project with:
|
|
|
132
131
|
|------|---------------------------|--------------------------|
|
|
133
132
|
| `src/routes/+layout.ts` | Auth resolution, config init, sync engine startup via `resolveAuthState()`, `initConfig()`, `startSyncEngine()` | `initEngine()` config with your database schema |
|
|
134
133
|
| `src/routes/+layout.svelte` | Auth state hydration via `hydrateAuthState()` | App shell (navbar, tab bar, overlays) |
|
|
135
|
-
| `src/routes/+page.svelte` | Imports `
|
|
134
|
+
| `src/routes/+page.svelte` | Imports `resolveFirstName`, `onSyncComplete`, `authState`; derives `firstName` reactively | Home page UI |
|
|
136
135
|
| `src/routes/+error.svelte` | — | Error page UI |
|
|
137
|
-
| `src/routes/setup/+page.ts` | Config check, session validation
|
|
136
|
+
| `src/routes/setup/+page.ts` | Config check, session validation via `getConfig()`, `getValidSession()` | — (fully managed) |
|
|
138
137
|
| `src/routes/setup/+page.svelte` | Imports `setConfig`, `isOnline`, `pollForNewServiceWorker` | Setup wizard UI |
|
|
139
138
|
| `src/routes/policy/+page.svelte` | — | Privacy policy content |
|
|
140
139
|
| `src/routes/login/+page.svelte` | All auth functions: `setupSingleUser`, `unlockSingleUser`, `getSingleUserInfo`, `completeSingleUserSetup`, `completeDeviceVerification`, `pollDeviceVerification`, `fetchRemoteGateConfig`, `linkSingleUserDevice`, `sendDeviceVerification` | Login page UI |
|
|
@@ -168,7 +167,7 @@ Import only what you need via subpath exports:
|
|
|
168
167
|
|---|---|
|
|
169
168
|
| `@prabhask5/stellar-engine` | `initEngine`, `startSyncEngine`, `runFullSync`, `supabase`, `getDb`, `validateSupabaseCredentials`, `validateSchema` |
|
|
170
169
|
| `@prabhask5/stellar-engine/data` | All engine CRUD + query operations (`engineCreate`, `engineUpdate`, etc.) |
|
|
171
|
-
| `@prabhask5/stellar-engine/auth` | All auth functions (`
|
|
170
|
+
| `@prabhask5/stellar-engine/auth` | All auth functions (`resolveAuthState`, `signOut`, `setupSingleUser`, `unlockSingleUser`, `lockSingleUser`, `completeSingleUserSetup`, `completeDeviceVerification`, `changeSingleUserEmail`, `completeSingleUserEmailChange`, `padPin`, etc.) |
|
|
172
171
|
| `@prabhask5/stellar-engine/stores` | Reactive stores + event subscriptions (`syncStatusStore`, `authState`, `onSyncComplete`, etc.) |
|
|
173
172
|
| `@prabhask5/stellar-engine/types` | All type exports (`Session`, `SyncEngineConfig`, `BatchOperation`, `SingleUserConfig`, etc.) |
|
|
174
173
|
| `@prabhask5/stellar-engine/utils` | Utility functions (`generateId`, `now`, `calculateNewOrder`, `snakeToCamel`, `debug`, etc.) |
|
|
@@ -300,27 +299,22 @@ Alternatively, you can provide a pre-created Dexie instance via the `db` config
|
|
|
300
299
|
| `markEntityModified(table, id)` | Record that an entity was recently modified locally (prevents incoming realtime from overwriting). |
|
|
301
300
|
| `onSyncComplete(callback)` | Register a callback invoked after each successful sync cycle. |
|
|
302
301
|
|
|
303
|
-
### Auth
|
|
302
|
+
### Auth Utilities
|
|
304
303
|
|
|
305
304
|
| Export | Description |
|
|
306
305
|
|---|---|
|
|
307
|
-
| `
|
|
308
|
-
| `
|
|
309
|
-
| `changePassword` / `resendConfirmationEmail` | Account management. |
|
|
310
|
-
| `changeEmail(newEmail)` | Request email change (sends confirmation to new address). Returns `{ error, confirmationRequired }`. |
|
|
311
|
-
| `completeEmailChange()` | Finalize email change after confirmation. Refreshes session and updates cached credentials. |
|
|
306
|
+
| `signOut` | Full teardown: stops sync, clears caches, signs out of Supabase. |
|
|
307
|
+
| `resendConfirmationEmail` | Resend signup confirmation email. |
|
|
312
308
|
| `getUserProfile` / `updateProfile` | Profile read/write via Supabase user metadata. |
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
|
317
|
-
|
|
318
|
-
| `cacheOfflineCredentials` / `getOfflineCredentials` / `verifyOfflineCredentials` / `clearOfflineCredentials` | Store and verify credentials locally for offline sign-in. |
|
|
319
|
-
| `createOfflineSession` / `getValidOfflineSession` / `clearOfflineSession` | Manage offline session tokens in IndexedDB. |
|
|
309
|
+
| `verifyOtp` | Verify OTP token hash from confirmation email links. |
|
|
310
|
+
| `getValidSession` | Get a non-expired Supabase session, or `null`. |
|
|
311
|
+
| `resolveFirstName(session, offline, fallback?)` | Resolve display name from session or offline profile with configurable fallback. |
|
|
312
|
+
| `resolveUserId(session, offline)` | Extract user UUID from session or offline credentials. |
|
|
313
|
+
| `resolveAvatarInitial(session, offline, fallback?)` | Single uppercase initial for avatar display. |
|
|
320
314
|
|
|
321
315
|
### Single-user auth
|
|
322
316
|
|
|
323
|
-
For personal apps that use a simplified PIN or password gate. Uses real Supabase email/password auth where the PIN is padded to meet minimum password length. Enable by setting `auth.
|
|
317
|
+
For personal apps that use a simplified PIN or password gate. Uses real Supabase email/password auth where the PIN is padded to meet minimum password length. Enable by setting `auth.singleUser` in the engine config.
|
|
324
318
|
|
|
325
319
|
| Export | Description |
|
|
326
320
|
|---|---|
|
|
@@ -1,66 +1,191 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Remote Change Animation Action
|
|
2
|
+
* @fileoverview Remote Change Animation Action
|
|
3
3
|
*
|
|
4
4
|
* A Svelte action that automatically adds remote change animations to elements.
|
|
5
|
-
* Use this on list items, cards, or any element that can be updated remotely
|
|
5
|
+
* Use this on list items, cards, or any element that can be updated remotely
|
|
6
|
+
* (e.g., via Supabase Realtime subscriptions).
|
|
6
7
|
*
|
|
7
8
|
* The action detects the ACTION TYPE from the remote change and applies
|
|
8
|
-
* the appropriate animation:
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
9
|
+
* the appropriate CSS animation class:
|
|
10
|
+
* - `'create'` --> `item-created` (slide in with burst)
|
|
11
|
+
* - `'delete'` --> `item-deleting` (slide out with fade)
|
|
12
|
+
* - `'toggle'` --> `item-toggled` (+ checkbox-animating + completion-ripple)
|
|
13
|
+
* - `'increment'` --> `counter-increment` (bump up)
|
|
14
|
+
* - `'decrement'` --> `counter-decrement` (bump down)
|
|
15
|
+
* - `'reorder'` --> `item-reordering` (slide to new position)
|
|
16
|
+
* - `'rename'` --> `text-changed` (highlight flash)
|
|
17
|
+
* - `'update'` --> `item-changed` (default highlight)
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
19
20
|
* ```svelte
|
|
20
21
|
* <div use:remoteChangeAnimation={{ entityId: item.id, entityType: 'goals' }}>
|
|
21
22
|
* ...
|
|
22
23
|
* </div>
|
|
23
24
|
* ```
|
|
25
|
+
*
|
|
26
|
+
* @see {@link remoteChangeAnimation} for the main Svelte action
|
|
27
|
+
* @see {@link trackEditing} for deferred-change tracking on forms
|
|
28
|
+
* @see {@link triggerLocalAnimation} for programmatic local animations
|
|
24
29
|
*/
|
|
25
30
|
import { type RemoteActionType } from '../stores/remoteChanges';
|
|
31
|
+
/**
|
|
32
|
+
* Configuration options for the {@link remoteChangeAnimation} Svelte action.
|
|
33
|
+
*/
|
|
26
34
|
interface RemoteChangeOptions {
|
|
35
|
+
/** The unique identifier of the entity being watched (e.g., a row UUID). */
|
|
27
36
|
entityId: string;
|
|
37
|
+
/** The entity type / table name (e.g., `'goals'`, `'tasks'`). */
|
|
28
38
|
entityType: string;
|
|
39
|
+
/**
|
|
40
|
+
* Optional list of field names to watch. When provided, animations are
|
|
41
|
+
* only triggered if the remote change includes at least one of these
|
|
42
|
+
* fields (or the wildcard `'*'`). Omit to animate on any field change.
|
|
43
|
+
*/
|
|
29
44
|
fields?: string[];
|
|
45
|
+
/**
|
|
46
|
+
* Optional CSS class override. When set, this class is used instead of
|
|
47
|
+
* the default mapping from {@link ACTION_ANIMATION_MAP}.
|
|
48
|
+
*/
|
|
30
49
|
animationClass?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Optional callback invoked when a remote action is detected.
|
|
52
|
+
* Useful for component-specific handling beyond CSS animations
|
|
53
|
+
* (e.g., updating local state, playing sounds, showing toasts).
|
|
54
|
+
*
|
|
55
|
+
* @param actionType - The type of remote action detected.
|
|
56
|
+
* @param fields - The list of fields that changed.
|
|
57
|
+
*/
|
|
31
58
|
onAction?: (actionType: RemoteActionType, fields: string[]) => void;
|
|
32
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Svelte action that watches for remote changes on a specific entity and
|
|
62
|
+
* applies the appropriate CSS animation class to the host element.
|
|
63
|
+
*
|
|
64
|
+
* **Lifecycle:**
|
|
65
|
+
* 1. On mount, checks for a recent change that may have arrived before
|
|
66
|
+
* the element was rendered (important for CREATE animations on new items).
|
|
67
|
+
* 2. Subscribes to the `remoteChangesStore` for future changes.
|
|
68
|
+
* 3. Subscribes to a pending-delete indicator for delete animations.
|
|
69
|
+
* 4. On update, re-subscribes if the entity identity changes.
|
|
70
|
+
* 5. On destroy, unsubscribes and cleans up CSS classes.
|
|
71
|
+
*
|
|
72
|
+
* @param node - The DOM element to animate.
|
|
73
|
+
* @param options - Configuration specifying which entity to watch.
|
|
74
|
+
* @returns A Svelte action lifecycle object with `update` and `destroy` methods.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```svelte
|
|
78
|
+
* <div use:remoteChangeAnimation={{ entityId: item.id, entityType: 'goals' }}>
|
|
79
|
+
* {item.name}
|
|
80
|
+
* </div>
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
33
83
|
export declare function remoteChangeAnimation(node: HTMLElement, options: RemoteChangeOptions): {
|
|
84
|
+
/**
|
|
85
|
+
* Called when the action's options change. If the entity identity
|
|
86
|
+
* (`entityId` or `entityType`) has changed, tears down old subscriptions
|
|
87
|
+
* and creates new ones for the updated entity.
|
|
88
|
+
*
|
|
89
|
+
* @param newOptions - The updated {@link RemoteChangeOptions}.
|
|
90
|
+
*/
|
|
34
91
|
update(newOptions: RemoteChangeOptions): void;
|
|
92
|
+
/**
|
|
93
|
+
* Cleanup handler — unsubscribes from all stores, removes the base
|
|
94
|
+
* CSS class, and clears the element from the animation tracking set.
|
|
95
|
+
*/
|
|
35
96
|
destroy(): void;
|
|
36
97
|
};
|
|
37
98
|
/**
|
|
38
|
-
*
|
|
39
|
-
* Use this on modal forms with Save buttons to defer remote changes
|
|
99
|
+
* Svelte action for form elements that should track editing state.
|
|
100
|
+
* Use this on modal forms with Save buttons to defer remote changes
|
|
101
|
+
* while the user is actively editing, preventing disruptive overwrites.
|
|
102
|
+
*
|
|
103
|
+
* When the form is destroyed (e.g., modal closes), any deferred changes
|
|
104
|
+
* are passed to the `onDeferredChanges` callback so the component can
|
|
105
|
+
* decide how to reconcile them.
|
|
40
106
|
*
|
|
41
|
-
*
|
|
107
|
+
* @example
|
|
42
108
|
* ```svelte
|
|
43
109
|
* <form use:trackEditing={{ entityId: item.id, entityType: 'goals', formType: 'manual-save' }}>
|
|
44
110
|
* ...
|
|
45
111
|
* </form>
|
|
46
112
|
* ```
|
|
47
113
|
*/
|
|
114
|
+
/**
|
|
115
|
+
* Configuration options for the {@link trackEditing} Svelte action.
|
|
116
|
+
*/
|
|
48
117
|
interface TrackEditingOptions {
|
|
118
|
+
/** The unique identifier of the entity being edited. */
|
|
49
119
|
entityId: string;
|
|
120
|
+
/** The entity type / table name (e.g., `'goals'`, `'tasks'`). */
|
|
50
121
|
entityType: string;
|
|
122
|
+
/**
|
|
123
|
+
* The save behaviour of the form:
|
|
124
|
+
* - `'auto-save'` — changes are saved immediately (e.g., inline editing).
|
|
125
|
+
* - `'manual-save'` — changes are saved on explicit submit (e.g., modal form).
|
|
126
|
+
*/
|
|
51
127
|
formType: 'auto-save' | 'manual-save';
|
|
128
|
+
/**
|
|
129
|
+
* Optional list of field names this form edits. When provided, only
|
|
130
|
+
* remote changes to these fields are deferred; changes to other fields
|
|
131
|
+
* are applied immediately.
|
|
132
|
+
*/
|
|
52
133
|
fields?: string[];
|
|
134
|
+
/**
|
|
135
|
+
* Callback invoked when the form closes and there are deferred changes
|
|
136
|
+
* that need processing (e.g., conflict resolution, data refresh).
|
|
137
|
+
*
|
|
138
|
+
* @param changes - The array of deferred remote change objects.
|
|
139
|
+
*/
|
|
53
140
|
onDeferredChanges?: (changes: unknown[]) => void;
|
|
54
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Svelte action that marks an entity as "being edited" in the remote changes
|
|
144
|
+
* store. While editing, incoming remote changes for the same entity are
|
|
145
|
+
* deferred instead of applied immediately.
|
|
146
|
+
*
|
|
147
|
+
* **Lifecycle:**
|
|
148
|
+
* 1. On mount, calls `remoteChangesStore.startEditing()` to begin deferral.
|
|
149
|
+
* 2. Periodically checks for deferred changes and toggles a CSS class
|
|
150
|
+
* (`has-deferred-changes`) on the node for visual indication.
|
|
151
|
+
* 3. On update, re-registers if the entity identity changes.
|
|
152
|
+
* 4. On destroy, calls `remoteChangesStore.stopEditing()` and invokes
|
|
153
|
+
* `onDeferredChanges` if any changes were deferred.
|
|
154
|
+
*
|
|
155
|
+
* @param node - The form DOM element.
|
|
156
|
+
* @param options - Configuration specifying which entity is being edited.
|
|
157
|
+
* @returns A Svelte action lifecycle object with `update` and `destroy` methods.
|
|
158
|
+
*/
|
|
55
159
|
export declare function trackEditing(node: HTMLElement, options: TrackEditingOptions): {
|
|
160
|
+
/**
|
|
161
|
+
* Called when the action's options change. If the entity identity
|
|
162
|
+
* changes, stops tracking the old entity and starts tracking the new one.
|
|
163
|
+
*
|
|
164
|
+
* @param newOptions - The updated {@link TrackEditingOptions}.
|
|
165
|
+
*/
|
|
56
166
|
update(newOptions: TrackEditingOptions): void;
|
|
167
|
+
/**
|
|
168
|
+
* Cleanup handler — stops the polling interval, removes CSS classes,
|
|
169
|
+
* stops editing in the store, and notifies the callback of any
|
|
170
|
+
* deferred changes that accumulated during the editing session.
|
|
171
|
+
*/
|
|
57
172
|
destroy(): void;
|
|
58
173
|
};
|
|
59
174
|
/**
|
|
60
175
|
* Trigger a local action animation on an element.
|
|
61
|
-
* Use this to make local actions animate the same way as remote actions.
|
|
62
176
|
*
|
|
63
|
-
*
|
|
177
|
+
* Use this to make local user actions (e.g., tapping a checkbox, incrementing
|
|
178
|
+
* a counter) animate with the same visual treatment as remote changes, giving
|
|
179
|
+
* the UI a consistent feel.
|
|
180
|
+
*
|
|
181
|
+
* For `increment` and `decrement` actions, rapid repeated invocations will
|
|
182
|
+
* restart the animation instead of being blocked — this allows the counter
|
|
183
|
+
* to visually "bump" on each tap.
|
|
184
|
+
*
|
|
185
|
+
* @param element - The DOM element to animate (or `null`, in which case this is a no-op).
|
|
186
|
+
* @param actionType - The type of animation to apply.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
64
189
|
* ```svelte
|
|
65
190
|
* <script>
|
|
66
191
|
* import { triggerLocalAnimation } from '@prabhask5/stellar-engine';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteChange.d.ts","sourceRoot":"","sources":["../../src/actions/remoteChange.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"remoteChange.d.ts","sourceRoot":"","sources":["../../src/actions/remoteChange.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AAMjC;;GAEG;AACH,UAAU,mBAAmB;IAC3B,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;IAEjB,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACrE;AAsDD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,mBAAmB;IAgJjF;;;;;;OAMG;uBACgB,mBAAmB;IA4BtC;;;OAGG;;EAQN;AAMD;;;;;;;;;;;;;;;GAeG;AAEH;;GAEG;AACH,UAAU,mBAAmB;IAC3B,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;IAEjB,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,QAAQ,EAAE,WAAW,GAAG,aAAa,CAAC;IAEtC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CAClD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,mBAAmB;IAwBxE;;;;;OAKG;uBACgB,mBAAmB;IAatC;;;;OAIG;;EAcN;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,WAAW,GAAG,IAAI,EAC3B,UAAU,EAAE,gBAAgB,GAC3B,IAAI,CA8DN"}
|