@alepha/react 0.13.1 → 0.13.2

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.
Files changed (49) hide show
  1. package/dist/auth/index.browser.js +5 -5
  2. package/dist/auth/index.browser.js.map +1 -1
  3. package/dist/auth/index.d.ts +330 -330
  4. package/dist/auth/index.js +7 -7
  5. package/dist/auth/index.js.map +1 -1
  6. package/dist/core/index.browser.js +19 -18
  7. package/dist/core/index.browser.js.map +1 -1
  8. package/dist/core/index.d.ts +352 -344
  9. package/dist/core/index.js +25 -24
  10. package/dist/core/index.js.map +1 -1
  11. package/dist/core/index.native.js +381 -0
  12. package/dist/core/index.native.js.map +1 -0
  13. package/dist/form/index.d.ts +2 -2
  14. package/dist/head/index.browser.js +7 -7
  15. package/dist/head/index.browser.js.map +1 -1
  16. package/dist/head/index.d.ts +265 -265
  17. package/dist/head/index.js +7 -7
  18. package/dist/head/index.js.map +1 -1
  19. package/dist/i18n/index.d.ts +20 -20
  20. package/dist/i18n/index.js +12 -12
  21. package/dist/i18n/index.js.map +1 -1
  22. package/dist/websocket/index.d.ts +7 -7
  23. package/dist/websocket/index.js.map +1 -1
  24. package/package.json +18 -9
  25. package/src/auth/index.ts +1 -1
  26. package/src/auth/providers/ReactAuthProvider.ts +1 -1
  27. package/src/auth/services/ReactAuth.ts +5 -5
  28. package/src/core/components/NestedView.tsx +1 -1
  29. package/src/core/hooks/useStore.ts +4 -4
  30. package/src/core/index.browser.ts +2 -2
  31. package/src/core/index.native.ts +1 -1
  32. package/src/core/index.shared-router.ts +1 -1
  33. package/src/core/index.ts +3 -3
  34. package/src/core/{descriptors → primitives}/$page.ts +20 -20
  35. package/src/core/providers/ReactBrowserProvider.ts +2 -2
  36. package/src/core/providers/ReactBrowserRouterProvider.ts +2 -2
  37. package/src/core/providers/ReactPageProvider.ts +25 -11
  38. package/src/core/providers/ReactServerProvider.ts +12 -12
  39. package/src/core/services/ReactPageServerService.ts +6 -6
  40. package/src/core/services/ReactPageService.ts +6 -6
  41. package/src/core/services/ReactRouter.ts +3 -3
  42. package/src/head/index.browser.ts +3 -3
  43. package/src/head/index.ts +4 -4
  44. package/src/head/{descriptors → primitives}/$head.ts +6 -6
  45. package/src/i18n/hooks/useI18n.ts +2 -2
  46. package/src/i18n/index.ts +3 -3
  47. package/src/i18n/{descriptors → primitives}/$dictionary.ts +8 -8
  48. package/src/i18n/providers/I18nProvider.ts +5 -5
  49. package/src/websocket/hooks/useRoom.tsx +3 -3
@@ -1,4 +1,4 @@
1
- import { $inject, type Async, createDescriptor, Descriptor, KIND } from "alepha";
1
+ import { $inject, type Async, createPrimitive, Primitive, KIND } from "alepha";
2
2
  import { I18nProvider } from "../providers/I18nProvider.ts";
3
3
 
4
4
  /**
@@ -33,14 +33,14 @@ import { I18nProvider } from "../providers/I18nProvider.ts";
33
33
  * ```
34
34
  */
35
35
  export const $dictionary = <T extends Record<string, string>>(
36
- options: DictionaryDescriptorOptions<T>,
37
- ): DictionaryDescriptor<T> => {
38
- return createDescriptor(DictionaryDescriptor<T>, options);
36
+ options: DictionaryPrimitiveOptions<T>,
37
+ ): DictionaryPrimitive<T> => {
38
+ return createPrimitive(DictionaryPrimitive<T>, options);
39
39
  };
40
40
 
41
41
  // ---------------------------------------------------------------------------------------------------------------------
42
42
 
43
- export interface DictionaryDescriptorOptions<T extends Record<string, string>> {
43
+ export interface DictionaryPrimitiveOptions<T extends Record<string, string>> {
44
44
  lang?: string;
45
45
  name?: string;
46
46
  lazy: () => Async<{ default: T }>;
@@ -48,9 +48,9 @@ export interface DictionaryDescriptorOptions<T extends Record<string, string>> {
48
48
 
49
49
  // ---------------------------------------------------------------------------------------------------------------------
50
50
 
51
- export class DictionaryDescriptor<
51
+ export class DictionaryPrimitive<
52
52
  T extends Record<string, string>,
53
- > extends Descriptor<DictionaryDescriptorOptions<T>> {
53
+ > extends Primitive<DictionaryPrimitiveOptions<T>> {
54
54
  protected provider = $inject(I18nProvider);
55
55
  protected onInit() {
56
56
  this.provider.registry.push({
@@ -66,4 +66,4 @@ export class DictionaryDescriptor<
66
66
  }
67
67
  }
68
68
 
69
- $dictionary[KIND] = DictionaryDescriptor;
69
+ $dictionary[KIND] = DictionaryPrimitive;
@@ -54,7 +54,7 @@ export class I18nProvider<
54
54
  on: "server:onRequest",
55
55
  priority: "last",
56
56
  handler: async ({ request }) => {
57
- this.alepha.state.set("alepha.react.i18n.lang", this.cookie.get(request));
57
+ this.alepha.store.set("alepha.react.i18n.lang", this.cookie.get(request));
58
58
  },
59
59
  });
60
60
 
@@ -65,7 +65,7 @@ export class I18nProvider<
65
65
  // get cookie lang
66
66
  const cookieLang = this.cookie.get();
67
67
  if (cookieLang) {
68
- this.alepha.state.set("alepha.react.i18n.lang", cookieLang);
68
+ this.alepha.store.set("alepha.react.i18n.lang", cookieLang);
69
69
  }
70
70
 
71
71
  for (const item of this.registry) {
@@ -110,7 +110,7 @@ export class I18nProvider<
110
110
  this.cookie.set(lang);
111
111
  }
112
112
 
113
- this.alepha.state.set("alepha.react.i18n.lang", lang);
113
+ this.alepha.store.set("alepha.react.i18n.lang", lang);
114
114
  this.refreshLocale();
115
115
  };
116
116
 
@@ -132,7 +132,7 @@ export class I18nProvider<
132
132
  this.refreshLocale();
133
133
 
134
134
  if (hasChanged) {
135
- this.alepha.state.set("alepha.react.i18n.lang", value);
135
+ this.alepha.store.set("alepha.react.i18n.lang", value);
136
136
  }
137
137
  }
138
138
  },
@@ -140,7 +140,7 @@ export class I18nProvider<
140
140
 
141
141
  public get lang(): string {
142
142
  return (
143
- this.alepha.state.get("alepha.react.i18n.lang") ||
143
+ this.alepha.store.get("alepha.react.i18n.lang") ||
144
144
  this.options.fallbackLang
145
145
  );
146
146
  }
@@ -1,6 +1,6 @@
1
1
  import { useAlepha, useInject } from "@alepha/react";
2
2
  import type { Static } from "alepha";
3
- import type { ChannelDescriptor, TWSObject } from "alepha/websocket";
3
+ import type { ChannelPrimitive, TWSObject } from "alepha/websocket";
4
4
  import { WebSocketClient } from "alepha/websocket";
5
5
  import { useEffect, useRef, useState } from "react";
6
6
 
@@ -17,9 +17,9 @@ export interface UseRoomOptions<
17
17
  roomId: string;
18
18
 
19
19
  /**
20
- * Channel descriptor defining the schemas
20
+ * Channel primitive defining the schemas
21
21
  */
22
- channel: ChannelDescriptor<TClient, TServer>;
22
+ channel: ChannelPrimitive<TClient, TServer>;
23
23
 
24
24
  /**
25
25
  * Handler for incoming messages from the server