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

Commit ac9ae74

Browse files
committed
fixed cycle deps
1 parent bee7d78 commit ac9ae74

Some content is hidden

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

47 files changed

+3725
-5631
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ yarn-debug.log*
1313
yarn-error.log*
1414
.eslintcache
1515
package-lock.json
16-
yarn.lock
1716

1817
# Editor directories and files
1918
.idea

examples/react/develop/fields/src/App.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ export default function App() {
5252
id: FIELDS.size,
5353
name: `Field #${FIELDS.size + 1}`,
5454
});
55-
}}>
55+
}}
56+
>
5657
Add Field
5758
</button>
5859
</div>

examples/react/develop/simple-todo-list/src/App.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ const App = () => {
3030
method: 'unshift', // to add todo at the beginning of the Collection
3131
});
3232
setCurrentInput('');
33-
}}>
33+
}}
34+
>
3435
Add
3536
</button>
3637
{todos.map((value) => (
@@ -41,7 +42,8 @@ const App = () => {
4142
onClick={() => {
4243
// Remove Todo at specific primary Key
4344
TODOS.remove(value.id).everywhere();
44-
}}>
45+
}}
46+
>
4547
Remove
4648
</button>
4749
</div>

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
"pack:react": "cd packages/react && yarn run prepare && yarn run pack",
4242
"pack:multieditor": "cd packages/multieditor && yarn run prepare && yarn run pack",
4343
"pack:api": "cd packages/api && yarn run prepare && yarn run pack",
44-
"pack:event": "cd packages/event && yarn run prepare && yarn run pack"
44+
"pack:event": "cd packages/event && yarn run prepare && yarn run pack",
45+
"install:clean": "shx rm -rf yarn.lock && shx rm -rf node_modules && yarn install && lerna run install:clean"
4546
},
4647
"repository": {
4748
"type": "git",

packages/core/src/collection/collection.persistent.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { defineConfig } from '@agile-ts/utils';
22
import { logCodeManager } from '../logCodeManager';
33
import { Collection, CollectionKey, DefaultItem, ItemKey } from './collection';
4-
import { Group, GroupKey } from './group';
4+
import type { Group, GroupKey } from './group';
55
import {
66
CreatePersistentConfigInterface,
77
getSharedStorageManager,
@@ -137,9 +137,8 @@ export class CollectionPersistent<
137137
// that it was loaded completely.
138138
// After a successful loading assign the now valid Item to the Collection.
139139
else {
140-
const placeholderItem = this.collection().getItemWithReference(
141-
itemKey
142-
);
140+
const placeholderItem =
141+
this.collection().getItemWithReference(itemKey);
143142
placeholderItem?.persist({
144143
key: itemStorageKey,
145144
loadValue: false,
@@ -148,7 +147,8 @@ export class CollectionPersistent<
148147
followCollectionPersistKeyPattern: false, // Because of the dynamic 'storageItemKey', the key is already formatted above
149148
});
150149
if (placeholderItem?.persistent?.ready) {
151-
const loadedPersistedValueIntoItem = await placeholderItem.persistent.loadPersistedValue();
150+
const loadedPersistedValueIntoItem =
151+
await placeholderItem.persistent.loadPersistedValue();
152152

153153
// If successfully loaded Item value, assign Item to Collection
154154
if (loadedPersistedValueIntoItem) {

packages/core/src/collection/collection.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import {
77
normalizeArray,
88
} from '@agile-ts/utils';
99
import { logCodeManager } from '../logCodeManager';
10-
import { Agile } from '../agile';
10+
import type { Agile } from '../agile';
1111
import { PatchOptionConfigInterface } from '../state';
12-
import { ComputedTracker } from '../computed';
12+
import { ComputedTracker } from '../computed/computed.tracker'; // Not imported directly from '../computed' due circular dependencies
1313
import { Item } from './item';
1414
import { SelectorConfigInterface, Selector, SelectorKey } from './selector';
1515
import {
@@ -1181,9 +1181,7 @@ export class Collection<DataType extends DefaultItem = DefaultItem> {
11811181
* @public
11821182
* @param itemKeys - Item/s with identifier/s to be removed.
11831183
*/
1184-
public remove(
1185-
itemKeys: ItemKey | Array<ItemKey>
1186-
): {
1184+
public remove(itemKeys: ItemKey | Array<ItemKey>): {
11871185
fromGroups: (groups: Array<ItemKey> | ItemKey) => Collection<DataType>;
11881186
everywhere: (config?: RemoveItemsConfigInterface) => Collection<DataType>;
11891187
} {
@@ -1518,13 +1516,12 @@ export interface CreateCollectionConfigImpl<
15181516
initialData?: Array<DataType>;
15191517
}
15201518

1521-
export type CreateCollectionConfig<
1522-
DataType extends DefaultItem = DefaultItem
1523-
> =
1524-
| CreateCollectionConfigImpl<DataType>
1525-
| ((
1526-
collection: Collection<DataType>
1527-
) => CreateCollectionConfigImpl<DataType>);
1519+
export type CreateCollectionConfig<DataType extends DefaultItem = DefaultItem> =
1520+
1521+
| CreateCollectionConfigImpl<DataType>
1522+
| ((
1523+
collection: Collection<DataType>
1524+
) => CreateCollectionConfigImpl<DataType>);
15281525

15291526
export interface CollectionConfigInterface {
15301527
/**
@@ -1542,8 +1539,9 @@ export interface CollectionConfigInterface {
15421539
defaultGroupKey: ItemKey;
15431540
}
15441541

1545-
export interface CollectConfigInterface<DataType = any>
1546-
extends AssignDataConfigInterface {
1542+
export interface CollectConfigInterface<
1543+
DataType extends DefaultItem = DefaultItem
1544+
> extends AssignDataConfigInterface {
15471545
/**
15481546
* In which way the collected data should be added to the Collection.
15491547
* - 'push' = at the end

packages/core/src/collection/group/group.observer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
Observer,
77
RuntimeJob,
88
} from '../../runtime';
9-
import { Group } from './index';
9+
import type { Group } from './index';
1010
import { DefaultItem } from '../collection';
1111
import { logCodeManager } from '../../logCodeManager';
1212

packages/core/src/collection/group/index.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import {
77
StateObserver,
88
StateObserversInterface,
99
} from '../../state';
10-
import { Collection, DefaultItem, ItemKey } from '../collection';
10+
import type { Collection, DefaultItem, ItemKey } from '../collection';
1111
import { GroupIngestConfigInterface, GroupObserver } from './group.observer';
12-
import { ComputedTracker } from '../../computed';
13-
import { Item } from '../item';
12+
import { ComputedTracker } from '../../computed/computed.tracker'; // Not imported directly from '../computed' due circular dependencies
13+
import type { Item } from '../item';
1414
import { CollectionPersistent } from '../collection.persistent';
1515

1616
export class Group<
@@ -432,8 +432,10 @@ export class Group<
432432

433433
export type GroupKey = string | number;
434434

435-
export interface GroupObservers<ValueType = any, DataType = any>
436-
extends StateObserversInterface<ValueType> {
435+
export interface GroupObservers<
436+
ValueType = any,
437+
DataType extends DefaultItem = any
438+
> extends StateObserversInterface<ValueType> {
437439
/**
438440
* Observer responsible for the output of the Group.
439441
*/

packages/core/src/collection/item/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import {
55
StateKey,
66
StateRuntimeJobConfigInterface,
77
} from '../../state';
8-
import { Collection, DefaultItem } from '../collection';
9-
import { SelectorKey } from '../selector';
8+
import type { Collection, DefaultItem } from '../collection';
9+
import type { SelectorKey } from '../selector';
1010
import { CollectionPersistent } from '../collection.persistent';
1111

1212
export class Item<

packages/core/src/collection/public/createCollection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Collection, CreateCollectionConfig, DefaultItem } from '../collection';
2-
import { Agile } from '../../agile';
2+
import type { Agile } from '../../agile';
33
import { shared } from '../../shared';
44

55
/**

0 commit comments

Comments
 (0)