piral-translate 0.15.0-alpha.4311 → 0.15.0-alpha.4345

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-translate",
3
- "version": "0.15.0-alpha.4311",
3
+ "version": "0.15.0-alpha.4345",
4
4
  "description": "Plugin for providing translated messages in Piral.",
5
5
  "keywords": [
6
6
  "piral",
@@ -33,6 +33,10 @@
33
33
  "./lib/*": {
34
34
  "require": "./lib/*"
35
35
  },
36
+ "./_/*": {
37
+ "import": "./esm/*.js",
38
+ "require": "./lib/*.js"
39
+ },
36
40
  "./package.json": "./package.json"
37
41
  },
38
42
  "sideEffects": false,
@@ -60,12 +64,12 @@
60
64
  },
61
65
  "devDependencies": {
62
66
  "@types/react": "^18.0.0",
63
- "piral-core": "0.15.0-alpha.4311",
67
+ "piral-core": "0.15.0-alpha.4345",
64
68
  "react": "^18.0.0"
65
69
  },
66
70
  "peerDependencies": {
67
71
  "piral-core": "0.14.x || 0.15.x",
68
72
  "react": ">=16.8.0"
69
73
  },
70
- "gitHead": "394262be7ca4f7883adf6d34d5635445fd1ef9b8"
74
+ "gitHead": "56ecd6ad080b3d275752b19afcf8435e4bd09140"
71
75
  }
@@ -1,18 +1,18 @@
1
- import { Atom, deref, swap } from '@dbeining/react-atom';
1
+ import create from 'zustand';
2
2
  import { createListener } from 'piral-base';
3
3
  import { createActions as ca } from 'piral-core';
4
4
  import { createActions } from './actions';
5
5
 
6
6
  describe('Translation Action Module', () => {
7
7
  it('selectLanguage changes the current language', () => {
8
- const state = Atom.of({
8
+ const state: any = create(() => ({
9
9
  foo: 5,
10
10
  language: {
11
11
  foo: 10,
12
12
  loading: false,
13
13
  selected: 'fr',
14
14
  },
15
- });
15
+ }));
16
16
  const localizer = {
17
17
  language: 'en',
18
18
  languages: ['en'],
@@ -27,7 +27,7 @@ describe('Translation Action Module', () => {
27
27
  const actions = createActions(localizer);
28
28
  const ctx = ca(state, createListener({}));
29
29
  actions.selectLanguage(ctx, 'de');
30
- expect(deref(state)).toEqual({
30
+ expect((state.getState())).toEqual({
31
31
  foo: 5,
32
32
  language: {
33
33
  foo: 10,
@@ -38,14 +38,14 @@ describe('Translation Action Module', () => {
38
38
  });
39
39
 
40
40
  it('translate', () => {
41
- const state = Atom.of({
41
+ const state: any = create(() => ({
42
42
  foo: 5,
43
43
  language: {
44
44
  foo: 10,
45
45
  loading: false,
46
46
  selected: 'fr',
47
47
  },
48
- });
48
+ }));
49
49
  const localizer = {
50
50
  language: 'fr',
51
51
  languages: ['fr'],
@@ -73,14 +73,14 @@ describe('Translation Action Module', () => {
73
73
  });
74
74
 
75
75
  it('setTranslations sets translations to the global translations', () => {
76
- const state = Atom.of({
76
+ const state: any = create(() => ({
77
77
  foo: 5,
78
78
  language: {
79
79
  foo: 10,
80
80
  loading: false,
81
81
  selected: 'fr',
82
82
  },
83
- });
83
+ }));
84
84
  const localizer = {
85
85
  language: 'de',
86
86
  languages: ['de'],
@@ -98,7 +98,7 @@ describe('Translation Action Module', () => {
98
98
  emit: jest.fn(),
99
99
  state,
100
100
  dispatch(update) {
101
- swap(state, update);
101
+ state.setState(update(state.getState()));
102
102
  },
103
103
  apis: {
104
104
  firstApi: {
@@ -123,14 +123,14 @@ describe('Translation Action Module', () => {
123
123
  });
124
124
 
125
125
  it('getTranslations returns translations', () => {
126
- const state = Atom.of({
126
+ const state: any = create(() => ({
127
127
  foo: 5,
128
128
  language: {
129
129
  foo: 10,
130
130
  loading: false,
131
131
  selected: 'fr',
132
132
  },
133
- });
133
+ }));
134
134
  const localizer = {
135
135
  language: 'fr',
136
136
  languages: ['fr'],
@@ -151,7 +151,7 @@ describe('Translation Action Module', () => {
151
151
  emit: jest.fn(),
152
152
  state,
153
153
  dispatch(update) {
154
- swap(state, update);
154
+ state.setState(update(state.getState()));
155
155
  },
156
156
  apis: {
157
157
  firstApi: {
@@ -1,16 +1,16 @@
1
- import { Atom, swap, deref } from '@dbeining/react-atom';
1
+ import create from 'zustand';
2
2
  import { createLocaleApi, setupLocalizer } from './create';
3
3
 
4
4
  describe('Create Localize API', () => {
5
- const state = Atom.of({});
5
+ const state = create(() => ({}));
6
6
  const context: any = {
7
7
  defineActions() {},
8
8
  state,
9
9
  readState(cb) {
10
- return cb(deref(state));
10
+ return cb(state.getState());
11
11
  },
12
12
  dispatch(update) {
13
- swap(state, update);
13
+ state.setState(update(state.getState()));
14
14
  },
15
15
  };
16
16