Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Commit 0770c3c

Browse files
authored
Merge pull request #163 from agile-ts/develop
New Release 🎉
2 parents 52a1de9 + d8df0d4 commit 0770c3c

File tree

139 files changed

+36462
-6078
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+36462
-6078
lines changed

.changeset/brave-kiwis-film.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
'@agile-ts/core': minor
3+
'@agile-ts/react': minor
4+
'@agile-ts/vue': minor
5+
'@agile-ts/api': patch
6+
'cra-template-agile': patch
7+
'cra-template-agile-typescript': patch
8+
'@agile-ts/event': patch
9+
'@agile-ts/logger': patch
10+
'@agile-ts/multieditor': patch
11+
'@agile-ts/proxytree': patch
12+
'@agile-ts/utils': patch
13+
---
14+
15+
#### :rocket: New Feature
16+
* `core`, `multieditor`, `react`, `vue`
17+
* [#161](https://github.com/agile-ts/agile/pull/161) Subscribe to Group value or output ([@bennodev19](https://github.com/bennodev19))
18+
* `core`
19+
* [#160](https://github.com/agile-ts/agile/pull/160) added null option to Selector ([@bennodev19](https://github.com/bennodev19))
20+
* [#159](https://github.com/agile-ts/agile/pull/159) make compute method async compatible ([@bennodev19](https://github.com/bennodev19))
21+
22+
#### :bug: Bug Fix
23+
* `core`
24+
* [#152](https://github.com/agile-ts/agile/pull/152) Fix remove selected Item loop ([@bennodev19](https://github.com/bennodev19))
25+
26+
#### :nail_care: Polish
27+
* `core`, `multieditor`, `react`, `vue`
28+
* [#161](https://github.com/agile-ts/agile/pull/161) Subscribe to Group value or output ([@bennodev19](https://github.com/bennodev19))
29+
* `core`, `cra-template-agile-typescript`, `cra-template-agile`, `event`, `logger`, `multieditor`, `proxytree`, `react`, `utils`, `vue`
30+
* [#153](https://github.com/agile-ts/agile/pull/153) refactor core descriptions ([@bennodev19](https://github.com/bennodev19))
31+
* `core`, `event`, `react`, `vue`
32+
* [#154](https://github.com/agile-ts/agile/pull/154) Optimise Runtime ([@bennodev19](https://github.com/bennodev19))
33+
* `core`, `proxytree`
34+
* [#150](https://github.com/agile-ts/agile/pull/150) Outsource log messages ([@bennodev19](https://github.com/bennodev19))
35+
36+
#### Committers: 1
37+
- BennoDev ([@bennodev19](https://github.com/bennodev19))

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ jobs:
3131
title: Next Release
3232
env:
3333
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34-
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
34+
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const App = new Agile();
4949
const MY_FIRST_STATE = App.createState("Hello Friend!");
5050

5151

52-
// -- myComponent.whatever ------------------------------------------
52+
// -- MyComponent.whatever ------------------------------------------
5353

5454
// 3️⃣ Bind initialized State to desired UI-Component
5555
// And wolla, it's reactive. Everytime the State mutates the Component rerenders
@@ -82,8 +82,10 @@ Besides States, AgileTs offers some other powerful APIs that make your life easi
8282
The philosophy behind AgileTs is simple:
8383

8484
### 🚅 Straightforward
85+
8586
Write minimalistic, boilerplate-free code that captures your intent.
8687
```ts
88+
const MY_STATE = App.createState('frank'); // Create State
8789
MY_STATE.set('jeff'); // Update State value
8890
MY_STATE.undo(); // Undo latest State value change
8991
MY_STATE.is({hello: "jeff"}); // Check if State has the value '{hello: "jeff"}'
@@ -101,6 +103,7 @@ MY_STATE.watch((value) => {console.log(value);}); // Watch on State changes
101103
const MY_COLLECTION = App.createCollection();
102104
MY_COLLECTION.collect({id: 1, name: "Frank"});
103105
MY_COLLECTION.collect({id: 2, name: "Dieter"});
106+
MY_COLLECTION.update(1, {name: "Jeff"});
104107
```
105108
- Compute State depending on other States
106109
```ts
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
SKIP_PREFLIGHT_CHECK=true
2-
BROWSER=chrome

examples/react/develop/functional-component-ts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"build": "react-scripts build",
3131
"test": "react-scripts test",
3232
"eject": "react-scripts eject",
33-
"install:agile": "yalc add @agile-ts/core @agile-ts/react @agile-ts/api @agile-ts/multieditor @agile-ts/event & yarn install"
33+
"install:agile": "yalc add @agile-ts/core @agile-ts/react @agile-ts/api @agile-ts/multieditor @agile-ts/event @agile-ts/proxytree & yarn install"
3434
},
3535
"eslintConfig": {
3636
"extends": "react-app"

examples/react/develop/functional-component-ts/src/App.tsx

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React, { useEffect } from 'react';
22
import './App.css';
3-
import { useAgile, useWatcher, useProxy } from '@agile-ts/react';
3+
import { useAgile, useWatcher, useProxy, useSelector } from '@agile-ts/react';
44
import { useEvent } from '@agile-ts/event';
55
import {
66
COUNTUP,
7+
externalCreatedItem,
78
MY_COLLECTION,
89
MY_COMPUTED,
910
MY_EVENT,
@@ -12,7 +13,7 @@ import {
1213
MY_STATE_3,
1314
STATE_OBJECT,
1415
} from './core';
15-
import { generateId, globalBind } from '@agile-ts/core';
16+
import { generateId, globalBind, Item } from '@agile-ts/core';
1617

1718
let rerenderCount = 0;
1819
let rerenderCountInCountupView = 0;
@@ -42,11 +43,14 @@ const App = (props: any) => {
4243
]);
4344
const [myGroup] = useAgile([MY_COLLECTION.getGroupWithReference('myGroup')]);
4445

45-
const [stateObject, item2, collection2] = useProxy([
46-
STATE_OBJECT,
47-
MY_COLLECTION.getItem('id2'),
48-
MY_COLLECTION,
49-
]);
46+
const selectedObjectItem = useSelector(STATE_OBJECT, (value) => {
47+
return value.age;
48+
});
49+
50+
const [stateObject, item2, collection2] = useProxy(
51+
[STATE_OBJECT, MY_COLLECTION.getItem('id2'), MY_COLLECTION],
52+
{ key: 'useProxy' }
53+
);
5054

5155
console.log('Item1: ', item2?.name);
5256
console.log('Collection: ', collection2.slice(0, 2));
@@ -106,7 +110,8 @@ const App = (props: any) => {
106110
<div className={'Container'}>
107111
<h3 className={'Title'}>My State Object</h3>
108112
<p>
109-
Deep Name: {stateObject.friends.hans.name} {stateObject.location}
113+
Deep Name: {stateObject?.friends?.hans?.name}{' '}
114+
{stateObject?.location}
110115
</p>
111116
<button
112117
onClick={() => {
@@ -132,21 +137,29 @@ const App = (props: any) => {
132137
<div className={'Container'}>
133138
<h3 className={'Title'}>My Collection</h3>
134139
<div>
135-
{myGroup.map((item) => (
136-
<p key={item.id}>{item.name}</p>
140+
{myGroup?.map((item) => (
141+
<p key={item.key}>{item.name}</p>
137142
))}
138143
</div>
139144
<button
140-
onClick={() => MY_COLLECTION.collect({ id: 'id3', name: 'Test3' })}>
145+
onClick={() =>
146+
MY_COLLECTION.collect({ key: 'id3', name: 'Test3' })
147+
}>
141148
Collect
142149
</button>
150+
<button
151+
onClick={() =>
152+
MY_COLLECTION.collect(externalCreatedItem, ['myGroup'])
153+
}>
154+
Collect external Item
155+
</button>
143156
<button onClick={() => MY_COLLECTION.getGroup('myGroup')?.add('id3')}>
144157
Add to myGroup
145158
</button>
146159
<button
147160
onClick={() =>
148161
MY_COLLECTION.update('id3', {
149-
id: 'newId3',
162+
key: 'newId3',
150163
name: 'Test3_Changed',
151164
})
152165
}>

examples/react/develop/functional-component-ts/src/core/index.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Agile, clone, Logger } from '@agile-ts/core';
1+
import { Agile, clone, Item, Logger } from '@agile-ts/core';
22
import Event from '@agile-ts/event';
33

44
export const myStorage: any = {};
@@ -64,32 +64,41 @@ export const MY_COMPUTED = App.createComputed<string>(() => {
6464
}, []).setKey('myComputed');
6565

6666
interface collectionValueInterface {
67-
id: string;
67+
key: string;
6868
name: string;
6969
}
7070

7171
export const MY_COLLECTION = App.createCollection<collectionValueInterface>(
7272
(collection) => ({
7373
key: 'my-collection',
74+
primaryKey: 'key',
7475
groups: {
7576
myGroup: collection.Group(['id4']),
7677
},
7778
selectors: {
7879
mySelector: collection.Selector('id3'),
7980
},
80-
initialData: [{ id: 'id4', name: 'hans' }],
81+
initialData: [
82+
{ key: 'id4', name: 'hans' } as any,
83+
{ key: 'frank', name: 'frank' },
84+
],
8185
})
8286
).persist();
83-
MY_COLLECTION.collect({ id: 'id1', name: 'test' });
84-
MY_COLLECTION.collect({ id: 'id2', name: 'test2' }, 'myGroup');
85-
MY_COLLECTION.update('id1', { id: 'id1Updated', name: 'testUpdated' });
87+
MY_COLLECTION.collect({ key: 'id1', name: 'test' });
88+
MY_COLLECTION.collect({ key: 'id2', name: 'test2' }, 'myGroup');
89+
MY_COLLECTION.update('id1', { key: 'id1Updated', name: 'testUpdated' });
8690
MY_COLLECTION.getGroup('myGroup')?.persist({
8791
followCollectionPersistKeyPattern: true,
8892
});
8993
MY_COLLECTION.onLoad(() => {
9094
console.log('On Load MY_COLLECTION');
9195
});
9296

97+
export const externalCreatedItem = new Item(MY_COLLECTION, {
98+
key: 'id10',
99+
name: 'test',
100+
}).persist({ followCollectionPersistKeyPattern: true });
101+
93102
console.log('Initial: myCollection ', clone(MY_COLLECTION));
94103

95104
export const MY_EVENT = new Event<{ name: string }>(App, {

examples/react/develop/functional-component-ts/yarn.lock

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,46 @@
33

44

55
"@agile-ts/api@file:.yalc/@agile-ts/api":
6-
version "0.0.16"
6+
version "0.0.18"
77
dependencies:
8-
"@agile-ts/utils" "^0.0.2"
8+
"@agile-ts/utils" "^0.0.4"
99

1010
"@agile-ts/core@file:.yalc/@agile-ts/core":
11-
version "0.0.15"
11+
version "0.0.17"
1212
dependencies:
13-
"@agile-ts/logger" "^0.0.2"
14-
"@agile-ts/utils" "^0.0.2"
13+
"@agile-ts/logger" "^0.0.4"
14+
"@agile-ts/utils" "^0.0.4"
1515

1616
"@agile-ts/event@file:.yalc/@agile-ts/event":
17-
version "0.0.5"
17+
version "0.0.7"
1818

19-
"@agile-ts/logger@^0.0.2":
20-
version "0.0.2"
21-
resolved "https://registry.yarnpkg.com/@agile-ts/logger/-/logger-0.0.2.tgz#80a726531dd63ca7d1c9a123383e57b5501efbb0"
22-
integrity sha512-rJJ5pqXtOriYxjuZPhHs2J9N1FnIaAZqItCw0MXW9/5od/uhJ28aiG7w9RUBZts9SjDcICYEfjFMcTJ/kYJsMg==
19+
"@agile-ts/logger@^0.0.4":
20+
version "0.0.4"
21+
resolved "https://registry.yarnpkg.com/@agile-ts/logger/-/logger-0.0.4.tgz#7f4d82ef8f03b13089af0878c360575c43f0962d"
22+
integrity sha512-qm0obAKqJMaPKM+c76gktRXyw3OL1v39AnhMZ0FBGwJqHWU+fLRkCzlQwjaROCr3F1XP01Lc/Ls3efF0WzyEPw==
2323
dependencies:
24-
"@agile-ts/utils" "^0.0.2"
24+
"@agile-ts/utils" "^0.0.4"
2525

2626
"@agile-ts/multieditor@file:.yalc/@agile-ts/multieditor":
27-
version "0.0.15"
27+
version "0.0.17"
2828

29-
"@agile-ts/proxytree@^0.0.2":
30-
version "0.0.2"
31-
resolved "https://registry.yarnpkg.com/@agile-ts/proxytree/-/proxytree-0.0.2.tgz#516ed19ee8d58aeecb291788a1e47be3dc23df8c"
32-
integrity sha512-PbSiChF0GcUoWnrbnHauzBxZ5r/+4pZSZWpYjkBcIFa48DgTtFzg5DfQzsW3Rc1Y0QSFGYqcZOvCK1xAjLIQ2g==
29+
"@agile-ts/proxytree@^0.0.3":
30+
version "0.0.3"
31+
resolved "https://registry.yarnpkg.com/@agile-ts/proxytree/-/proxytree-0.0.3.tgz#e3dacab123a311f2f0d4a0369793fe90fdab7569"
32+
integrity sha512-auO6trCo7ivLJYuLjxrnK4xuUTangVPTq8UuOMTlGbJFjmb8PLEkaXuRoVGSzv9jsT2FeS7KsP7Fs+yvv0WPdg==
3333

3434
"@agile-ts/proxytree@file:.yalc/@agile-ts/proxytree":
35-
version "0.0.1"
35+
version "0.0.3"
3636

3737
"@agile-ts/react@file:.yalc/@agile-ts/react":
38-
version "0.0.16"
38+
version "0.0.18"
3939
dependencies:
40-
"@agile-ts/proxytree" "^0.0.2"
40+
"@agile-ts/proxytree" "^0.0.3"
4141

42-
"@agile-ts/utils@^0.0.2":
43-
version "0.0.2"
44-
resolved "https://registry.yarnpkg.com/@agile-ts/utils/-/utils-0.0.2.tgz#5f03761ace569b6c9ddd28c22f7b0fbec8b006b1"
45-
integrity sha512-LqgQyMdK+zDuTCmOX6FOxTH4JNXhEvGFqIyNqRDoP99BK6MHGrK+n7nOW+1b4x6ZCYe0+VmwtG5CeOPOm3Siow==
42+
"@agile-ts/utils@^0.0.4":
43+
version "0.0.4"
44+
resolved "https://registry.yarnpkg.com/@agile-ts/utils/-/utils-0.0.4.tgz#66e9536e561796489a37155da6b74ce2dc482697"
45+
integrity sha512-GiZyTYmCm4j2N57oDjeMuPpfQdgn9clb0Cxpfuwi2Bq5T/KPXlaROLsVGwHLjwwT+NX7xxr5qNJH8pZTnHnYRQ==
4646

4747
"@babel/code-frame@7.8.3":
4848
version "7.8.3"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SKIP_PREFLIGHT_CHECK=true
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build
2+
node_modules

0 commit comments

Comments
 (0)