@indietabletop/appkit 6.1.6 → 7.0.0-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/dist/AppConfig/AppConfig.d.ts +29 -0
- package/dist/AuthCard/AuthCard.d.ts +10 -0
- package/dist/AuthCard/AuthCard.stories.d.ts +34 -0
- package/dist/AuthCard/style.css.d.ts +23 -0
- package/dist/DialogTrigger/index.d.ts +13 -0
- package/dist/DocumentTitle/DocumentTitle.d.ts +3 -0
- package/dist/EnumMapper.d.ts +25 -0
- package/dist/ExternalLink.d.ts +3 -0
- package/dist/FullscreenDismissBlocker.d.ts +5 -0
- package/{lib/HistoryState.ts → dist/HistoryState.d.ts} +2 -5
- package/dist/IndieTabletopClubLogo.d.ts +7 -0
- package/dist/IndieTabletopClubSymbol.d.ts +7 -0
- package/dist/InfoPage/index.d.ts +8 -0
- package/dist/InfoPage/pages.d.ts +2 -0
- package/dist/InfoPage/style.css.d.ts +5 -0
- package/dist/Letterhead/index.d.ts +19 -0
- package/dist/Letterhead/stories.d.ts +13 -0
- package/dist/Letterhead/style.css.d.ts +46 -0
- package/dist/LetterheadForm/LetterheadReadonlyTextField.stories.d.ts +17 -0
- package/dist/LetterheadForm/LetterheadSubmitError.stories.d.ts +11 -0
- package/dist/LetterheadForm/LetterheadTextField.stories.d.ts +336 -0
- package/dist/LetterheadForm/index.d.ts +44 -0
- package/dist/LetterheadForm/style.css.d.ts +8 -0
- package/dist/LoadingIndicator.d.ts +3 -0
- package/dist/MiddotSeparated/MiddotSeparated.d.ts +8 -0
- package/dist/MiddotSeparated/MiddotSeparated.stories.d.ts +586 -0
- package/dist/MiddotSeparated/style.css.d.ts +1 -0
- package/dist/ModalDialog/index.d.ts +12 -0
- package/dist/ModalDialog/style.css.d.ts +58 -0
- package/dist/ModernIDB/Cursor.d.ts +56 -0
- package/dist/ModernIDB/ModernIDB.d.ts +66 -0
- package/dist/ModernIDB/ModernIDBError.d.ts +3 -0
- package/dist/ModernIDB/ObjectStore.d.ts +112 -0
- package/dist/ModernIDB/ObjectStoreIndex.d.ts +53 -0
- package/dist/ModernIDB/Transaction.d.ts +16 -0
- package/dist/ModernIDB/VersionChangeManager.d.ts +30 -0
- package/dist/ModernIDB/bindings/factory.d.ts +12 -0
- package/dist/ModernIDB/bindings/index.d.ts +2 -0
- package/{lib/ModernIDB/bindings/types.ts → dist/ModernIDB/bindings/types.d.ts} +13 -32
- package/dist/ModernIDB/bindings/utils.d.ts +2 -0
- package/dist/ModernIDB/index.d.ts +10 -0
- package/dist/ModernIDB/types.d.ts +88 -0
- package/dist/ModernIDB/utils.d.ts +4 -0
- package/dist/QRCode/QRCode.d.ts +7 -0
- package/dist/QRCode/QRCode.stories.d.ts +33 -0
- package/dist/QRCode/style.css.d.ts +4 -0
- package/dist/ReleaseInfo/index.d.ts +5 -0
- package/dist/RulesetResolver.d.ts +87 -0
- package/dist/SafariCheck/SafariCheck.d.ts +23 -0
- package/dist/SafariCheck/SafariCheck.stories.d.ts +73 -0
- package/dist/SafariCheck/style.css.d.ts +17 -0
- package/dist/ServiceWorkerHandler.d.ts +11 -0
- package/dist/ShareButton/ShareButton.d.ts +57 -0
- package/dist/ShareButton/ShareButton.stories.d.ts +1577 -0
- package/dist/ShareButton/test.css.d.ts +1 -0
- package/dist/SubscribeCard/LetterheadInfoCard.d.ts +2 -0
- package/dist/SubscribeCard/SubscribeByEmailCard.d.ts +24 -0
- package/dist/SubscribeCard/SubscribeByEmailCard.stories.d.ts +10 -0
- package/dist/SubscribeCard/SubscribeByPledgeCard.d.ts +36 -0
- package/dist/SubscribeCard/SubscribeByPledgeCard.stories.d.ts +65 -0
- package/dist/SubscribeCard/style.css.d.ts +4 -0
- package/dist/account/AccountIssueView.d.ts +3 -0
- package/dist/account/AlreadyLoggedInView.d.ts +5 -0
- package/dist/account/CurrentUserFetcher.d.ts +20 -0
- package/dist/account/CurrentUserFetcher.stories.d.ts +136 -0
- package/dist/account/FailureFallbackView.d.ts +1 -0
- package/dist/account/JoinCard.d.ts +14 -0
- package/dist/account/JoinCard.stories.d.ts +143 -0
- package/dist/account/LoadingView.d.ts +1 -0
- package/dist/account/LoginCard.d.ts +39 -0
- package/dist/account/LoginCard.stories.d.ts +217 -0
- package/dist/account/LoginView.d.ts +10 -0
- package/dist/account/NoConnectionView.d.ts +4 -0
- package/dist/account/PasswordResetCard.d.ts +15 -0
- package/dist/account/PasswordResetCard.stories.d.ts +128 -0
- package/dist/account/UserMismatchView.d.ts +6 -0
- package/dist/account/VerifyPage.d.ts +13 -0
- package/dist/account/style.css.d.ts +10 -0
- package/{lib/account/types.ts → dist/account/types.d.ts} +3 -6
- package/dist/account/useFetchCurrentUser.d.ts +28 -0
- package/dist/account/useRedirectPath.d.ts +6 -0
- package/dist/animations.css.d.ts +3 -0
- package/dist/append-copy-to-text.d.ts +10 -0
- package/dist/append-copy-to-text.test.d.ts +1 -0
- package/dist/appkit.css +1 -0
- package/dist/appkit.js +10692 -0
- package/dist/async-op.d.ts +101 -0
- package/dist/atomic.css.d.ts +6 -0
- package/{lib/caught-value.ts → dist/caught-value.d.ts} +1 -11
- package/{lib/class-names.ts → dist/class-names.d.ts} +6 -17
- package/dist/client.d.ts +424 -0
- package/dist/common.css.d.ts +5 -0
- package/dist/copyrightRange.d.ts +1 -0
- package/dist/copyrightRange.test.d.ts +1 -0
- package/dist/createSafeStorage.d.ts +34 -0
- package/dist/failureMessages.d.ts +20 -0
- package/dist/failureMessages.test.d.ts +1 -0
- package/dist/form/FormSubmitButton.d.ts +17 -0
- package/dist/form/SubmitErrorAlert.d.ts +5 -0
- package/dist/form/style.css.d.ts +3 -0
- package/dist/globals.css.d.ts +0 -0
- package/dist/groupBy.d.ts +1 -0
- package/dist/groupBy.test.d.ts +1 -0
- package/dist/hrefs.d.ts +32 -0
- package/dist/hrefs.test.d.ts +1 -0
- package/dist/idToDate.d.ts +5 -0
- package/dist/idToDate.test.d.ts +1 -0
- package/dist/ids.d.ts +1 -0
- package/dist/ids.test.d.ts +1 -0
- package/dist/index.d.ts +64 -0
- package/dist/internal.css.d.ts +2 -0
- package/dist/mailto.d.ts +8 -0
- package/dist/mailto.test.d.ts +1 -0
- package/dist/media.d.ts +39 -0
- package/dist/random.d.ts +3 -0
- package/dist/result/swr.d.ts +4 -0
- package/{lib/sleep.ts → dist/sleep.d.ts} +1 -3
- package/dist/store/index.d.ts +237 -0
- package/dist/store/store.d.ts +144 -0
- package/dist/store/types.d.ts +49 -0
- package/dist/store/utils.d.ts +10 -0
- package/dist/storybook/decorators.d.ts +3 -0
- package/dist/structs.d.ts +1 -0
- package/{lib/typeguards.ts → dist/typeguards.d.ts} +1 -3
- package/dist/typeguards.test.d.ts +1 -0
- package/{lib/types.ts → dist/types.d.ts} +12 -23
- package/dist/unique.d.ts +10 -0
- package/dist/unique.test.d.ts +1 -0
- package/dist/use-async-op.d.ts +6 -0
- package/dist/use-document-background-color.d.ts +4 -0
- package/dist/use-form.d.ts +29 -0
- package/dist/use-is-installed.d.ts +8 -0
- package/dist/use-media-query.d.ts +1 -0
- package/dist/use-reverting-state.d.ts +5 -0
- package/dist/use-scroll-restoration.d.ts +25 -0
- package/dist/useEnsureValue.d.ts +6 -0
- package/dist/useInvokeClient.d.ts +25 -0
- package/dist/useIsVisible.d.ts +4 -0
- package/dist/utm.d.ts +58 -0
- package/dist/utm.test.d.ts +1 -0
- package/dist/validations.d.ts +3 -0
- package/dist/vars.css.d.ts +10 -0
- package/package.json +12 -5
- package/lib/AppConfig/AppConfig.tsx +0 -61
- package/lib/AuthCard/AuthCard.stories.ts +0 -34
- package/lib/AuthCard/AuthCard.tsx +0 -64
- package/lib/AuthCard/style.css.ts +0 -49
- package/lib/DialogTrigger/index.tsx +0 -36
- package/lib/DocumentTitle/DocumentTitle.tsx +0 -10
- package/lib/EnumMapper.ts +0 -50
- package/lib/ExternalLink.tsx +0 -10
- package/lib/FullscreenDismissBlocker.tsx +0 -23
- package/lib/IndieTabletopClubLogo.tsx +0 -44
- package/lib/IndieTabletopClubSymbol.tsx +0 -37
- package/lib/InfoPage/index.tsx +0 -46
- package/lib/InfoPage/pages.tsx +0 -36
- package/lib/InfoPage/style.css.ts +0 -36
- package/lib/Letterhead/index.tsx +0 -85
- package/lib/Letterhead/stories.tsx +0 -41
- package/lib/Letterhead/style.css.ts +0 -152
- package/lib/LetterheadForm/LetterheadReadonlyTextField.stories.tsx +0 -17
- package/lib/LetterheadForm/LetterheadSubmitError.stories.tsx +0 -19
- package/lib/LetterheadForm/LetterheadTextField.stories.tsx +0 -19
- package/lib/LetterheadForm/index.tsx +0 -137
- package/lib/LetterheadForm/style.css.ts +0 -89
- package/lib/LoadingIndicator.tsx +0 -40
- package/lib/MiddotSeparated/MiddotSeparated.stories.ts +0 -26
- package/lib/MiddotSeparated/MiddotSeparated.tsx +0 -26
- package/lib/MiddotSeparated/style.css.ts +0 -10
- package/lib/ModalDialog/index.tsx +0 -28
- package/lib/ModalDialog/style.css.ts +0 -88
- package/lib/ModernIDB/Cursor.ts +0 -91
- package/lib/ModernIDB/ModernIDB.ts +0 -337
- package/lib/ModernIDB/ModernIDBError.ts +0 -9
- package/lib/ModernIDB/ObjectStore.ts +0 -195
- package/lib/ModernIDB/ObjectStoreIndex.ts +0 -102
- package/lib/ModernIDB/README.md +0 -9
- package/lib/ModernIDB/Transaction.ts +0 -40
- package/lib/ModernIDB/VersionChangeManager.ts +0 -57
- package/lib/ModernIDB/bindings/factory.tsx +0 -165
- package/lib/ModernIDB/bindings/index.ts +0 -2
- package/lib/ModernIDB/bindings/utils.tsx +0 -32
- package/lib/ModernIDB/index.ts +0 -10
- package/lib/ModernIDB/types.ts +0 -120
- package/lib/ModernIDB/utils.ts +0 -51
- package/lib/QRCode/QRCode.stories.tsx +0 -41
- package/lib/QRCode/QRCode.tsx +0 -54
- package/lib/QRCode/style.css.ts +0 -23
- package/lib/ReleaseInfo/index.tsx +0 -29
- package/lib/RulesetResolver.ts +0 -214
- package/lib/SafariCheck/SafariCheck.stories.tsx +0 -99
- package/lib/SafariCheck/SafariCheck.tsx +0 -273
- package/lib/SafariCheck/addToDock.svg +0 -13
- package/lib/SafariCheck/addToHomeScreen.svg +0 -12
- package/lib/SafariCheck/safari.svg +0 -32
- package/lib/SafariCheck/shareIcon.svg +0 -11
- package/lib/SafariCheck/style.css.ts +0 -106
- package/lib/ServiceWorkerHandler.tsx +0 -53
- package/lib/ShareButton/ShareButton.stories.tsx +0 -58
- package/lib/ShareButton/ShareButton.tsx +0 -153
- package/lib/ShareButton/test.css.ts +0 -3
- package/lib/SubscribeCard/LetterheadInfoCard.tsx +0 -23
- package/lib/SubscribeCard/SubscribeByEmailCard.stories.tsx +0 -69
- package/lib/SubscribeCard/SubscribeByEmailCard.tsx +0 -183
- package/lib/SubscribeCard/SubscribeByPledgeCard.stories.tsx +0 -133
- package/lib/SubscribeCard/SubscribeByPledgeCard.tsx +0 -127
- package/lib/SubscribeCard/style.css.ts +0 -14
- package/lib/account/AccountIssueView.tsx +0 -44
- package/lib/account/AlreadyLoggedInView.tsx +0 -47
- package/lib/account/CurrentUserFetcher.stories.tsx +0 -292
- package/lib/account/CurrentUserFetcher.tsx +0 -118
- package/lib/account/FailureFallbackView.tsx +0 -36
- package/lib/account/JoinCard.stories.tsx +0 -257
- package/lib/account/JoinCard.tsx +0 -301
- package/lib/account/LoadingView.tsx +0 -14
- package/lib/account/LoginCard.stories.tsx +0 -288
- package/lib/account/LoginCard.tsx +0 -100
- package/lib/account/LoginView.tsx +0 -151
- package/lib/account/NoConnectionView.tsx +0 -34
- package/lib/account/PasswordResetCard.stories.tsx +0 -242
- package/lib/account/PasswordResetCard.tsx +0 -296
- package/lib/account/UserMismatchView.tsx +0 -62
- package/lib/account/VerifyPage.tsx +0 -195
- package/lib/account/style.css.ts +0 -57
- package/lib/account/useFetchCurrentUser.tsx +0 -63
- package/lib/account/useRedirectPath.ts +0 -21
- package/lib/animations.css.ts +0 -17
- package/lib/append-copy-to-text.ts +0 -35
- package/lib/async-op.ts +0 -286
- package/lib/atomic.css.ts +0 -11
- package/lib/client.ts +0 -662
- package/lib/common.css.ts +0 -48
- package/lib/copyrightRange.ts +0 -10
- package/lib/createSafeStorage.ts +0 -91
- package/lib/failureMessages.ts +0 -108
- package/lib/form/FormSubmitButton.tsx +0 -58
- package/lib/form/SubmitErrorAlert.tsx +0 -21
- package/lib/form/style.css.ts +0 -9
- package/lib/globals.css.ts +0 -62
- package/lib/groupBy.ts +0 -25
- package/lib/hrefs.ts +0 -48
- package/lib/idToDate.ts +0 -8
- package/lib/ids.ts +0 -6
- package/lib/index.ts +0 -71
- package/lib/internal.css.ts +0 -10
- package/lib/mailto.ts +0 -40
- package/lib/media.ts +0 -50
- package/lib/random.ts +0 -19
- package/lib/result/swr.ts +0 -18
- package/lib/store/index.tsx +0 -241
- package/lib/store/store.ts +0 -479
- package/lib/store/types.ts +0 -45
- package/lib/store/utils.ts +0 -54
- package/lib/storybook/decorators.tsx +0 -10
- package/lib/structs.ts +0 -3
- package/lib/unique.ts +0 -24
- package/lib/use-async-op.ts +0 -16
- package/lib/use-document-background-color.ts +0 -16
- package/lib/use-form.ts +0 -78
- package/lib/use-is-installed.ts +0 -17
- package/lib/use-media-query.ts +0 -21
- package/lib/use-reverting-state.ts +0 -32
- package/lib/use-scroll-restoration.ts +0 -99
- package/lib/useEnsureValue.ts +0 -31
- package/lib/useInvokeClient.ts +0 -54
- package/lib/useIsVisible.ts +0 -27
- package/lib/utm.ts +0 -92
- package/lib/validations.ts +0 -25
- package/lib/vars.css.ts +0 -13
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function groupBy<T, K extends string>(items: T[], getKey: (item: T) => K): Record<K, T[]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/hrefs.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { LinkUtmParams, createUtm } from './utm.ts';
|
|
2
|
+
type InputAppHrefs = {
|
|
3
|
+
login: () => string;
|
|
4
|
+
password: () => string;
|
|
5
|
+
join: () => string;
|
|
6
|
+
dashboard: () => string;
|
|
7
|
+
account: () => string;
|
|
8
|
+
terms?: (linkUtm?: LinkUtmParams) => string;
|
|
9
|
+
privacy?: (linkUtm?: LinkUtmParams) => string;
|
|
10
|
+
cookies?: (linkUtm?: LinkUtmParams) => string;
|
|
11
|
+
};
|
|
12
|
+
export type AppHrefs = Required<InputAppHrefs>;
|
|
13
|
+
export declare function createHrefs<T extends InputAppHrefs>(params: {
|
|
14
|
+
/**
|
|
15
|
+
* Hrefs to be used for the given app. At minimum, you need to provide
|
|
16
|
+
* the core hrefs required by Appkit.
|
|
17
|
+
*/
|
|
18
|
+
hrefs: T;
|
|
19
|
+
/**
|
|
20
|
+
* The function responsible for generating UTM tags. You should
|
|
21
|
+
* use the return value of {@link createUtm} unless you are doing something
|
|
22
|
+
* unusual.
|
|
23
|
+
*/
|
|
24
|
+
utm: ReturnType<typeof createUtm>;
|
|
25
|
+
}): {
|
|
26
|
+
terms: (linkUtm?: LinkUtmParams) => string;
|
|
27
|
+
privacy: (linkUtm?: LinkUtmParams) => string;
|
|
28
|
+
cookies: (linkUtm?: LinkUtmParams) => string;
|
|
29
|
+
itc: (linkUtm?: LinkUtmParams) => string;
|
|
30
|
+
fathom: () => string;
|
|
31
|
+
} & T;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/ids.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getId: (size?: number) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export * from './account/CurrentUserFetcher.tsx';
|
|
2
|
+
export * from './account/JoinCard.tsx';
|
|
3
|
+
export * from './account/LoginCard.tsx';
|
|
4
|
+
export * from './account/PasswordResetCard.tsx';
|
|
5
|
+
export * from './AppConfig/AppConfig.tsx';
|
|
6
|
+
export * from './AuthCard/AuthCard.tsx';
|
|
7
|
+
export * from './DialogTrigger/index.tsx';
|
|
8
|
+
export * from './DocumentTitle/DocumentTitle.tsx';
|
|
9
|
+
export * from './ExternalLink.tsx';
|
|
10
|
+
export * from './form/FormSubmitButton.tsx';
|
|
11
|
+
export * from './form/SubmitErrorAlert.tsx';
|
|
12
|
+
export * from './FullscreenDismissBlocker.tsx';
|
|
13
|
+
export * from './IndieTabletopClubLogo.tsx';
|
|
14
|
+
export * from './IndieTabletopClubSymbol.tsx';
|
|
15
|
+
export * from './Letterhead/index.tsx';
|
|
16
|
+
export * from './LetterheadForm/index.tsx';
|
|
17
|
+
export * from './LoadingIndicator.tsx';
|
|
18
|
+
export * from './MiddotSeparated/MiddotSeparated.tsx';
|
|
19
|
+
export * from './ModalDialog/index.tsx';
|
|
20
|
+
export * from './QRCode/QRCode.tsx';
|
|
21
|
+
export * from './ReleaseInfo/index.tsx';
|
|
22
|
+
export * from './SafariCheck/SafariCheck.tsx';
|
|
23
|
+
export * from './ServiceWorkerHandler.tsx';
|
|
24
|
+
export * from './ShareButton/ShareButton.tsx';
|
|
25
|
+
export * from './SubscribeCard/SubscribeByEmailCard.tsx';
|
|
26
|
+
export * from './SubscribeCard/SubscribeByPledgeCard.tsx';
|
|
27
|
+
export * from './RulesetResolver.ts';
|
|
28
|
+
export * from './use-async-op.ts';
|
|
29
|
+
export * from './use-document-background-color.ts';
|
|
30
|
+
export * from './use-form.ts';
|
|
31
|
+
export * from './use-is-installed.ts';
|
|
32
|
+
export * from './use-media-query.ts';
|
|
33
|
+
export * from './use-reverting-state.ts';
|
|
34
|
+
export * from './use-scroll-restoration.ts';
|
|
35
|
+
export * from './useEnsureValue.ts';
|
|
36
|
+
export * from './useInvokeClient.ts';
|
|
37
|
+
export * from './useIsVisible.ts';
|
|
38
|
+
export * from './append-copy-to-text.ts';
|
|
39
|
+
export * from './async-op.ts';
|
|
40
|
+
export * from './caught-value.ts';
|
|
41
|
+
export * from './class-names.ts';
|
|
42
|
+
export * from './client.ts';
|
|
43
|
+
export * from './copyrightRange.ts';
|
|
44
|
+
export * from './createSafeStorage.ts';
|
|
45
|
+
export * from './failureMessages.ts';
|
|
46
|
+
export * from './groupBy.ts';
|
|
47
|
+
export * from './HistoryState.ts';
|
|
48
|
+
export * from './hrefs.ts';
|
|
49
|
+
export * from './ids.ts';
|
|
50
|
+
export * from './idToDate.ts';
|
|
51
|
+
export * from './mailto.ts';
|
|
52
|
+
export * from './media.ts';
|
|
53
|
+
export * from './random.ts';
|
|
54
|
+
export * from './result/swr.ts';
|
|
55
|
+
export * from './sleep.ts';
|
|
56
|
+
export * from './structs.ts';
|
|
57
|
+
export * from './typeguards.ts';
|
|
58
|
+
export * from './types.ts';
|
|
59
|
+
export * from './unique.ts';
|
|
60
|
+
export * from './utm.ts';
|
|
61
|
+
export * from './validations.ts';
|
|
62
|
+
export * from './EnumMapper.ts';
|
|
63
|
+
export * from './ModernIDB/index.ts';
|
|
64
|
+
export * from './store/index.tsx';
|
package/dist/mailto.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/media.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme
|
|
3
|
+
*/
|
|
4
|
+
export declare enum PrefersColorScheme {
|
|
5
|
+
LIGHT = "(prefers-color-scheme: light)",
|
|
6
|
+
DARK = "(prefers-color-scheme: dark)"
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion
|
|
10
|
+
*/
|
|
11
|
+
export declare enum PrefersReducedMotion {
|
|
12
|
+
NO_PREFERENCE = "(prefers-reduced-motion: no-preference)",
|
|
13
|
+
REDUCE = "(prefers-reduced-motion: reduce)"
|
|
14
|
+
}
|
|
15
|
+
export declare enum Hover {
|
|
16
|
+
NONE = "(hover: none)",
|
|
17
|
+
HOVER = "(hover: hover) and (pointer: fine)"
|
|
18
|
+
}
|
|
19
|
+
export declare enum MediaType {
|
|
20
|
+
PRINT = "print",
|
|
21
|
+
SCREEN = "screen"
|
|
22
|
+
}
|
|
23
|
+
export declare enum MinHeight {
|
|
24
|
+
TALL = "(min-height: 40em)"
|
|
25
|
+
}
|
|
26
|
+
export declare enum MinWidth {
|
|
27
|
+
SMALL = "(min-width: 28em)",
|
|
28
|
+
MEDIUM = "(min-width: 50em)",
|
|
29
|
+
WIDE = "(min-width: 66em)",
|
|
30
|
+
X_WIDE = "(min-width: 80em)",
|
|
31
|
+
XX_WIDE = "(min-width: 140em)"
|
|
32
|
+
}
|
|
33
|
+
export declare enum DisplayMode {
|
|
34
|
+
STANDALONE = "(display-mode: standalone)"
|
|
35
|
+
}
|
|
36
|
+
export declare enum Pointer {
|
|
37
|
+
COARSE = "(pointer: coarse)",
|
|
38
|
+
FINE = "(pointer: fine)"
|
|
39
|
+
}
|
package/dist/random.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SWRResponse } from 'swr';
|
|
2
|
+
import { Failure, Pending } from '../async-op.ts';
|
|
3
|
+
import { FailurePayload } from '../types.ts';
|
|
4
|
+
export declare function swrResponseToResult<T>(response: SWRResponse<T, unknown>): Pending | Failure<FailurePayload> | (T & ({} | null));
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { UserGameData } from '@indietabletop/types';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { Failure, Success } from '../async-op.ts';
|
|
4
|
+
import { GameCode, IndieTabletopClient } from '../client.ts';
|
|
5
|
+
import { ModernIDB } from '../ModernIDB/ModernIDB.ts';
|
|
6
|
+
import { ModernIDBIndexes, ModernIDBSchema } from '../ModernIDB/types.ts';
|
|
7
|
+
import { CurrentUser } from '../types.ts';
|
|
8
|
+
import { PullChangesInput, PushChangesInput } from './store.ts';
|
|
9
|
+
import { MachineEvent, PullResult, PushResult } from './types.ts';
|
|
10
|
+
export type AppActions = {
|
|
11
|
+
clientLogout: (params: {
|
|
12
|
+
serverUser: CurrentUser;
|
|
13
|
+
}) => Promise<void>;
|
|
14
|
+
serverLogout: () => Promise<void>;
|
|
15
|
+
logout: () => Promise<void>;
|
|
16
|
+
push: () => void;
|
|
17
|
+
pull: () => void;
|
|
18
|
+
};
|
|
19
|
+
export declare const AppActionsContext: import('react').Context<AppActions | null>;
|
|
20
|
+
declare const useSelector: <T>(selector: (snapshot: import('xstate').MachineSnapshot<import('./types.ts').MachineContext, {
|
|
21
|
+
type: "push";
|
|
22
|
+
} | {
|
|
23
|
+
type: "pull";
|
|
24
|
+
} | {
|
|
25
|
+
type: "currentUser";
|
|
26
|
+
currentUser: CurrentUser;
|
|
27
|
+
} | {
|
|
28
|
+
type: "serverUser";
|
|
29
|
+
serverUser: CurrentUser;
|
|
30
|
+
} | {
|
|
31
|
+
type: "sessionInfo";
|
|
32
|
+
sessionInfo: import('../types.ts').SessionInfo;
|
|
33
|
+
} | {
|
|
34
|
+
type: "sessionExpired";
|
|
35
|
+
} | {
|
|
36
|
+
type: "reset";
|
|
37
|
+
}, {
|
|
38
|
+
[x: string]: import('xstate').ActorRefFromLogic<import('xstate').CallbackActorLogic<MachineEvent, import('xstate').NonReducibleUnknown, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<PullResult, PullChangesInput, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<PushResult, PushChangesInput, import('xstate').EventObject>> | undefined;
|
|
39
|
+
sync?: import('xstate').ActorRefFromLogic<import('xstate').CallbackActorLogic<MachineEvent, import('xstate').NonReducibleUnknown, import('xstate').EventObject>> | undefined;
|
|
40
|
+
auth?: import('xstate').ActorRefFromLogic<import('xstate').CallbackActorLogic<MachineEvent, import('xstate').NonReducibleUnknown, import('xstate').EventObject>> | undefined;
|
|
41
|
+
}, "unauthenticated" | {
|
|
42
|
+
authenticated: "ineligible" | {
|
|
43
|
+
sync: "idle" | "waiting" | {
|
|
44
|
+
syncing: "pulling" | "pushing" | "failed" | "synced";
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
}, string, import('xstate').NonReducibleUnknown, import('xstate').MetaObject, {
|
|
48
|
+
id: "app";
|
|
49
|
+
states: {
|
|
50
|
+
readonly unauthenticated: {};
|
|
51
|
+
readonly authenticated: {
|
|
52
|
+
states: {
|
|
53
|
+
readonly ineligible: {};
|
|
54
|
+
readonly sync: {
|
|
55
|
+
states: {
|
|
56
|
+
readonly syncing: {
|
|
57
|
+
states: {
|
|
58
|
+
readonly pulling: {};
|
|
59
|
+
readonly pushing: {};
|
|
60
|
+
readonly synced: {};
|
|
61
|
+
readonly failed: {};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
readonly idle: {};
|
|
65
|
+
readonly waiting: {};
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
}>) => T, compare?: ((a: T, b: T) => boolean) | undefined) => T, useActorRef: () => import('xstate').Actor<import('xstate').StateMachine<import('./types.ts').MachineContext, {
|
|
72
|
+
type: "push";
|
|
73
|
+
} | {
|
|
74
|
+
type: "pull";
|
|
75
|
+
} | {
|
|
76
|
+
type: "currentUser";
|
|
77
|
+
currentUser: CurrentUser;
|
|
78
|
+
} | {
|
|
79
|
+
type: "serverUser";
|
|
80
|
+
serverUser: CurrentUser;
|
|
81
|
+
} | {
|
|
82
|
+
type: "sessionInfo";
|
|
83
|
+
sessionInfo: import('../types.ts').SessionInfo;
|
|
84
|
+
} | {
|
|
85
|
+
type: "sessionExpired";
|
|
86
|
+
} | {
|
|
87
|
+
type: "reset";
|
|
88
|
+
}, {
|
|
89
|
+
[x: string]: import('xstate').ActorRefFromLogic<import('xstate').CallbackActorLogic<MachineEvent, import('xstate').NonReducibleUnknown, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<PullResult, PullChangesInput, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<PushResult, PushChangesInput, import('xstate').EventObject>> | undefined;
|
|
90
|
+
sync?: import('xstate').ActorRefFromLogic<import('xstate').CallbackActorLogic<MachineEvent, import('xstate').NonReducibleUnknown, import('xstate').EventObject>> | undefined;
|
|
91
|
+
auth?: import('xstate').ActorRefFromLogic<import('xstate').CallbackActorLogic<MachineEvent, import('xstate').NonReducibleUnknown, import('xstate').EventObject>> | undefined;
|
|
92
|
+
}, {
|
|
93
|
+
src: "sync";
|
|
94
|
+
logic: import('xstate').CallbackActorLogic<MachineEvent, import('xstate').NonReducibleUnknown, import('xstate').EventObject>;
|
|
95
|
+
id: "sync";
|
|
96
|
+
} | {
|
|
97
|
+
src: "auth";
|
|
98
|
+
logic: import('xstate').CallbackActorLogic<MachineEvent, import('xstate').NonReducibleUnknown, import('xstate').EventObject>;
|
|
99
|
+
id: "auth";
|
|
100
|
+
} | {
|
|
101
|
+
src: "pullChanges";
|
|
102
|
+
logic: import('xstate').PromiseActorLogic<PullResult, PullChangesInput, import('xstate').EventObject>;
|
|
103
|
+
id: string | undefined;
|
|
104
|
+
} | {
|
|
105
|
+
src: "pushChanges";
|
|
106
|
+
logic: import('xstate').PromiseActorLogic<PushResult, PushChangesInput, import('xstate').EventObject>;
|
|
107
|
+
id: string | undefined;
|
|
108
|
+
}, {
|
|
109
|
+
type: "setCurrentSync";
|
|
110
|
+
params: import('xstate').NonReducibleUnknown;
|
|
111
|
+
} | {
|
|
112
|
+
type: "flushCurrentSync";
|
|
113
|
+
params: import('xstate').NonReducibleUnknown;
|
|
114
|
+
} | {
|
|
115
|
+
type: "setLastSuccessfulSync";
|
|
116
|
+
params: import('xstate').NonReducibleUnknown;
|
|
117
|
+
} | {
|
|
118
|
+
type: "markSyncStepResult";
|
|
119
|
+
params: {
|
|
120
|
+
pull?: PullResult;
|
|
121
|
+
push?: PushResult;
|
|
122
|
+
};
|
|
123
|
+
} | {
|
|
124
|
+
type: "queuePush";
|
|
125
|
+
params: import('xstate').NonReducibleUnknown;
|
|
126
|
+
} | {
|
|
127
|
+
type: "clearPushQueue";
|
|
128
|
+
params: import('xstate').NonReducibleUnknown;
|
|
129
|
+
} | {
|
|
130
|
+
type: "setCurrentUser";
|
|
131
|
+
params: {
|
|
132
|
+
id: string;
|
|
133
|
+
email: string;
|
|
134
|
+
isVerified: boolean;
|
|
135
|
+
prefersScrollbarVisibility?: "ALWAYS" | undefined;
|
|
136
|
+
};
|
|
137
|
+
} | {
|
|
138
|
+
type: "patchSessionInfo";
|
|
139
|
+
params: {
|
|
140
|
+
createdTs: number;
|
|
141
|
+
expiresTs: number;
|
|
142
|
+
};
|
|
143
|
+
} | {
|
|
144
|
+
type: "resetContext";
|
|
145
|
+
params: import('xstate').NonReducibleUnknown;
|
|
146
|
+
} | {
|
|
147
|
+
type: "resetWithServerUser";
|
|
148
|
+
params: {
|
|
149
|
+
id: string;
|
|
150
|
+
email: string;
|
|
151
|
+
isVerified: boolean;
|
|
152
|
+
prefersScrollbarVisibility?: "ALWAYS" | undefined;
|
|
153
|
+
};
|
|
154
|
+
}, {
|
|
155
|
+
type: "shouldPushOnceIdle";
|
|
156
|
+
params: unknown;
|
|
157
|
+
} | {
|
|
158
|
+
type: "isEligibleForSync";
|
|
159
|
+
params: unknown;
|
|
160
|
+
} | {
|
|
161
|
+
type: "isUserVerified";
|
|
162
|
+
params: unknown;
|
|
163
|
+
} | {
|
|
164
|
+
type: "isNotMismatched";
|
|
165
|
+
params: unknown;
|
|
166
|
+
} | {
|
|
167
|
+
type: "hasBecomeEligibleForSync";
|
|
168
|
+
params: unknown;
|
|
169
|
+
} | {
|
|
170
|
+
type: "hasBecomeVerified";
|
|
171
|
+
params: unknown;
|
|
172
|
+
}, never, "unauthenticated" | {
|
|
173
|
+
authenticated: "ineligible" | {
|
|
174
|
+
sync: "idle" | "waiting" | {
|
|
175
|
+
syncing: "pulling" | "pushing" | "failed" | "synced";
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
}, string, import('xstate').NonReducibleUnknown, import('xstate').NonReducibleUnknown, import('xstate').EventObject, import('xstate').MetaObject, {
|
|
179
|
+
id: "app";
|
|
180
|
+
states: {
|
|
181
|
+
readonly unauthenticated: {};
|
|
182
|
+
readonly authenticated: {
|
|
183
|
+
states: {
|
|
184
|
+
readonly ineligible: {};
|
|
185
|
+
readonly sync: {
|
|
186
|
+
states: {
|
|
187
|
+
readonly syncing: {
|
|
188
|
+
states: {
|
|
189
|
+
readonly pulling: {};
|
|
190
|
+
readonly pushing: {};
|
|
191
|
+
readonly synced: {};
|
|
192
|
+
readonly failed: {};
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
readonly idle: {};
|
|
196
|
+
readonly waiting: {};
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
}>>;
|
|
203
|
+
export { useActorRef, useSelector };
|
|
204
|
+
export declare function useCurrentUser(): {
|
|
205
|
+
id: string;
|
|
206
|
+
email: string;
|
|
207
|
+
isVerified: boolean;
|
|
208
|
+
prefersScrollbarVisibility?: "ALWAYS" | undefined;
|
|
209
|
+
} | null;
|
|
210
|
+
export declare function useSessionInfo(): {
|
|
211
|
+
createdTs: number;
|
|
212
|
+
expiresTs: number;
|
|
213
|
+
} | null;
|
|
214
|
+
export declare function useAppActions(): AppActions;
|
|
215
|
+
export type DatabaseAppMachineMethods = {
|
|
216
|
+
upsertGameData(data: UserGameData): Promise<Success<string[]>>;
|
|
217
|
+
getUpdatedGameDataSince(props: {
|
|
218
|
+
sinceTs: number | null;
|
|
219
|
+
exclude: Set<string>;
|
|
220
|
+
}): Promise<Success<UserGameData>>;
|
|
221
|
+
clearAll(): Promise<Success<string> | Failure<string>>;
|
|
222
|
+
};
|
|
223
|
+
export declare function createAppMachineProvider<Schema extends ModernIDBSchema, Indexes extends ModernIDBIndexes<Schema>>(options: {
|
|
224
|
+
database: ModernIDB<Schema, Indexes> & DatabaseAppMachineMethods;
|
|
225
|
+
client: IndieTabletopClient;
|
|
226
|
+
/**
|
|
227
|
+
* Which games should the machine pull game data for?
|
|
228
|
+
*
|
|
229
|
+
* If null is provided, no data will be pulled.
|
|
230
|
+
*
|
|
231
|
+
* @remarks Honestly this is a bit hacky and we should have a better way to
|
|
232
|
+
* disable sync entirely for apps that don't need it (e.g. the Creators App).
|
|
233
|
+
*/
|
|
234
|
+
pullGameDataFor: GameCode | GameCode[] | null;
|
|
235
|
+
}): (props: {
|
|
236
|
+
children: ReactNode;
|
|
237
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { CurrentUser, SessionInfo } from '../types.ts';
|
|
2
|
+
import { MachineContext, MachineEvent, PullResult, PushResult, SyncedItem } from './types.ts';
|
|
3
|
+
export type PullChangesInput = {
|
|
4
|
+
sinceTs: number | null;
|
|
5
|
+
currentUser: CurrentUser;
|
|
6
|
+
};
|
|
7
|
+
export type PushChangesInput = {
|
|
8
|
+
sinceTs: number | null;
|
|
9
|
+
currentSyncTs: number;
|
|
10
|
+
ignoredItems: SyncedItem[];
|
|
11
|
+
currentUser: CurrentUser;
|
|
12
|
+
};
|
|
13
|
+
export declare const machine: import('xstate').StateMachine<MachineContext, {
|
|
14
|
+
type: "push";
|
|
15
|
+
} | {
|
|
16
|
+
type: "pull";
|
|
17
|
+
} | {
|
|
18
|
+
type: "currentUser";
|
|
19
|
+
currentUser: CurrentUser;
|
|
20
|
+
} | {
|
|
21
|
+
type: "serverUser";
|
|
22
|
+
serverUser: CurrentUser;
|
|
23
|
+
} | {
|
|
24
|
+
type: "sessionInfo";
|
|
25
|
+
sessionInfo: SessionInfo;
|
|
26
|
+
} | {
|
|
27
|
+
type: "sessionExpired";
|
|
28
|
+
} | {
|
|
29
|
+
type: "reset";
|
|
30
|
+
}, {
|
|
31
|
+
[x: string]: import('xstate').ActorRefFromLogic<import('xstate').CallbackActorLogic<MachineEvent, import('xstate').NonReducibleUnknown, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<PullResult, PullChangesInput, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<PushResult, PushChangesInput, import('xstate').EventObject>> | undefined;
|
|
32
|
+
sync?: import('xstate').ActorRefFromLogic<import('xstate').CallbackActorLogic<MachineEvent, import('xstate').NonReducibleUnknown, import('xstate').EventObject>> | undefined;
|
|
33
|
+
auth?: import('xstate').ActorRefFromLogic<import('xstate').CallbackActorLogic<MachineEvent, import('xstate').NonReducibleUnknown, import('xstate').EventObject>> | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
src: "sync";
|
|
36
|
+
logic: import('xstate').CallbackActorLogic<MachineEvent, import('xstate').NonReducibleUnknown, import('xstate').EventObject>;
|
|
37
|
+
id: "sync";
|
|
38
|
+
} | {
|
|
39
|
+
src: "auth";
|
|
40
|
+
logic: import('xstate').CallbackActorLogic<MachineEvent, import('xstate').NonReducibleUnknown, import('xstate').EventObject>;
|
|
41
|
+
id: "auth";
|
|
42
|
+
} | {
|
|
43
|
+
src: "pullChanges";
|
|
44
|
+
logic: import('xstate').PromiseActorLogic<PullResult, PullChangesInput, import('xstate').EventObject>;
|
|
45
|
+
id: string | undefined;
|
|
46
|
+
} | {
|
|
47
|
+
src: "pushChanges";
|
|
48
|
+
logic: import('xstate').PromiseActorLogic<PushResult, PushChangesInput, import('xstate').EventObject>;
|
|
49
|
+
id: string | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
type: "setCurrentSync";
|
|
52
|
+
params: import('xstate').NonReducibleUnknown;
|
|
53
|
+
} | {
|
|
54
|
+
type: "flushCurrentSync";
|
|
55
|
+
params: import('xstate').NonReducibleUnknown;
|
|
56
|
+
} | {
|
|
57
|
+
type: "setLastSuccessfulSync";
|
|
58
|
+
params: import('xstate').NonReducibleUnknown;
|
|
59
|
+
} | {
|
|
60
|
+
type: "markSyncStepResult";
|
|
61
|
+
params: {
|
|
62
|
+
pull?: PullResult;
|
|
63
|
+
push?: PushResult;
|
|
64
|
+
};
|
|
65
|
+
} | {
|
|
66
|
+
type: "queuePush";
|
|
67
|
+
params: import('xstate').NonReducibleUnknown;
|
|
68
|
+
} | {
|
|
69
|
+
type: "clearPushQueue";
|
|
70
|
+
params: import('xstate').NonReducibleUnknown;
|
|
71
|
+
} | {
|
|
72
|
+
type: "setCurrentUser";
|
|
73
|
+
params: {
|
|
74
|
+
id: string;
|
|
75
|
+
email: string;
|
|
76
|
+
isVerified: boolean;
|
|
77
|
+
prefersScrollbarVisibility?: "ALWAYS" | undefined;
|
|
78
|
+
};
|
|
79
|
+
} | {
|
|
80
|
+
type: "patchSessionInfo";
|
|
81
|
+
params: {
|
|
82
|
+
createdTs: number;
|
|
83
|
+
expiresTs: number;
|
|
84
|
+
};
|
|
85
|
+
} | {
|
|
86
|
+
type: "resetContext";
|
|
87
|
+
params: import('xstate').NonReducibleUnknown;
|
|
88
|
+
} | {
|
|
89
|
+
type: "resetWithServerUser";
|
|
90
|
+
params: {
|
|
91
|
+
id: string;
|
|
92
|
+
email: string;
|
|
93
|
+
isVerified: boolean;
|
|
94
|
+
prefersScrollbarVisibility?: "ALWAYS" | undefined;
|
|
95
|
+
};
|
|
96
|
+
}, {
|
|
97
|
+
type: "shouldPushOnceIdle";
|
|
98
|
+
params: unknown;
|
|
99
|
+
} | {
|
|
100
|
+
type: "isEligibleForSync";
|
|
101
|
+
params: unknown;
|
|
102
|
+
} | {
|
|
103
|
+
type: "isUserVerified";
|
|
104
|
+
params: unknown;
|
|
105
|
+
} | {
|
|
106
|
+
type: "isNotMismatched";
|
|
107
|
+
params: unknown;
|
|
108
|
+
} | {
|
|
109
|
+
type: "hasBecomeEligibleForSync";
|
|
110
|
+
params: unknown;
|
|
111
|
+
} | {
|
|
112
|
+
type: "hasBecomeVerified";
|
|
113
|
+
params: unknown;
|
|
114
|
+
}, never, "unauthenticated" | {
|
|
115
|
+
authenticated: "ineligible" | {
|
|
116
|
+
sync: "idle" | "waiting" | {
|
|
117
|
+
syncing: "pulling" | "pushing" | "failed" | "synced";
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
}, string, import('xstate').NonReducibleUnknown, import('xstate').NonReducibleUnknown, import('xstate').EventObject, import('xstate').MetaObject, {
|
|
121
|
+
id: "app";
|
|
122
|
+
states: {
|
|
123
|
+
readonly unauthenticated: {};
|
|
124
|
+
readonly authenticated: {
|
|
125
|
+
states: {
|
|
126
|
+
readonly ineligible: {};
|
|
127
|
+
readonly sync: {
|
|
128
|
+
states: {
|
|
129
|
+
readonly syncing: {
|
|
130
|
+
states: {
|
|
131
|
+
readonly pulling: {};
|
|
132
|
+
readonly pushing: {};
|
|
133
|
+
readonly synced: {};
|
|
134
|
+
readonly failed: {};
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
readonly idle: {};
|
|
138
|
+
readonly waiting: {};
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
}>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Failure, Success } from '../async-op.ts';
|
|
2
|
+
import { CurrentUser, FailurePayload, SessionInfo } from '../types.ts';
|
|
3
|
+
export type EmitterActor<Outgoing> = {
|
|
4
|
+
sendBack: (event: Outgoing) => void;
|
|
5
|
+
};
|
|
6
|
+
export type PullResult = Success<{
|
|
7
|
+
pulled: SyncedItem[];
|
|
8
|
+
}> | Failure<FailurePayload>;
|
|
9
|
+
export type PushResult = Success<{
|
|
10
|
+
pushed: SyncedItem[];
|
|
11
|
+
pulled: SyncedItem[];
|
|
12
|
+
}> | Failure<FailurePayload>;
|
|
13
|
+
export type SyncedItem = {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
updatedTs: number;
|
|
17
|
+
deleted: boolean;
|
|
18
|
+
};
|
|
19
|
+
export type SyncAttempt = {
|
|
20
|
+
startedTs: number;
|
|
21
|
+
pull: PullResult | null;
|
|
22
|
+
push: PushResult | null;
|
|
23
|
+
};
|
|
24
|
+
export type MachineContext = {
|
|
25
|
+
currentSync: SyncAttempt | null;
|
|
26
|
+
lastSuccessfulSyncTs: number | null;
|
|
27
|
+
currentUser: CurrentUser | null;
|
|
28
|
+
sessionInfo: SessionInfo | null;
|
|
29
|
+
pushOnceIdle: boolean;
|
|
30
|
+
syncLog: SyncAttempt[];
|
|
31
|
+
};
|
|
32
|
+
export type MachineEvent = {
|
|
33
|
+
type: "push";
|
|
34
|
+
} | {
|
|
35
|
+
type: "pull";
|
|
36
|
+
} | {
|
|
37
|
+
type: "currentUser";
|
|
38
|
+
currentUser: CurrentUser;
|
|
39
|
+
} | {
|
|
40
|
+
type: "serverUser";
|
|
41
|
+
serverUser: CurrentUser;
|
|
42
|
+
} | {
|
|
43
|
+
type: "sessionInfo";
|
|
44
|
+
sessionInfo: SessionInfo;
|
|
45
|
+
} | {
|
|
46
|
+
type: "sessionExpired";
|
|
47
|
+
} | {
|
|
48
|
+
type: "reset";
|
|
49
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UserGameData } from '@indietabletop/types';
|
|
2
|
+
import { Failure } from '../async-op.js';
|
|
3
|
+
import { FailurePayload } from '../types.ts';
|
|
4
|
+
import { SyncedItem } from './types.ts';
|
|
5
|
+
/**
|
|
6
|
+
* Flattens the UserGameData structure to a flat SyncedItem[].
|
|
7
|
+
*/
|
|
8
|
+
export declare function toSyncedItems(data: UserGameData): SyncedItem[];
|
|
9
|
+
export declare function assertNonNullish<T>(value: T, message: string): asserts value is NonNullable<T>;
|
|
10
|
+
export declare function caughtToResult(error: unknown): Failure<FailurePayload>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { currentUser, redeemedPledge, sessionInfo } from '@indietabletop/types';
|
|
@@ -7,6 +7,4 @@
|
|
|
7
7
|
* This function uses the same semantics like the nullish coalescing operators
|
|
8
8
|
* like `??` and `??=`.
|
|
9
9
|
*/
|
|
10
|
-
export function isNullish(value: unknown): value is null | undefined
|
|
11
|
-
return value === null || value === undefined;
|
|
12
|
-
}
|
|
10
|
+
export declare function isNullish(value: unknown): value is null | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|