@figliolia/galena 1.0.0 → 1.0.1

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/README.md CHANGED
@@ -7,9 +7,9 @@ In Galena, your state architecture is a composition of reactive units that can b
7
7
 
8
8
  ## Installation
9
9
  ```bash
10
- npm install --save galena
10
+ npm install --save @figliolia/galena
11
11
  # or
12
- yarn add galena
12
+ yarn add @figliolia/galena
13
13
  ```
14
14
 
15
15
  ## Composing Your Application State
@@ -18,8 +18,8 @@ Creating a "global" application state begins with initializing a `Galena` instan
18
18
 
19
19
  ```typescript
20
20
  // AppState.ts
21
- import { Galena, Logger, Profiler } from "galena";
22
- import type { Middleware } from "galena";
21
+ import { Galena, Logger, Profiler } from "@figliolia/galena";
22
+ import type { Middleware } from "@figliolia/galena";
23
23
 
24
24
  const middleware: Middleware[] = [];
25
25
 
@@ -93,7 +93,7 @@ Running mutations on individual units of state will automatically update your `G
93
93
  You may also create units of state that are *not* connected to a "global" `Galena` instance. To promote flexibility for developers to organize their state however they wish, `Galena` exports its `State` object for usage directly:
94
94
 
95
95
  ```typescript
96
- import { State } from "galena";
96
+ import { State } from "@figliolia/galena";
97
97
 
98
98
  // Create Your Isolated Unit of State
99
99
  const FeatureState = new State("myFeature", {
@@ -127,8 +127,8 @@ In `Galena`, your "global" application state exists in the form of operable sub-
127
127
  #### Galena Public Methods
128
128
 
129
129
  ```typescript
130
- import { Galena, Logger, Profiler } from "galena";
131
- import type { State } from "galena";
130
+ import { Galena, Logger, Profiler } from "@figliolia/galena";
131
+ import type { State } from "@figliolia/galena";
132
132
 
133
133
  const AppState = new Galena(/* middleware */ [new Logger(), new Profiler()]);
134
134
 
@@ -217,7 +217,7 @@ AppState.unsubscribeAll(subscription);
217
217
  While instances of `Galena` behave as a container for units of state, the `State` interface serves as the unit itself. The `State` interface has a predictable API designed to make composing your states simple and effective. Whether you compose your state using a "global" state or island architecture, the underlying API for your units of state look like the following:
218
218
 
219
219
  ```typescript
220
- import { State, Logger, Profiler } from "galena";
220
+ import { State, Logger, Profiler } from "@figliolia/galena";
221
221
 
222
222
  const MyState = new State(/* a unique name */ "myState", /* initial state */);
223
223
 
@@ -332,7 +332,7 @@ Galena supports developers creating enhancements for their usage of `Galena`. Ou
332
332
  Galena comes with a redux-style state transition logger that prints to the console each time state updates. The Logger will log the previous state, the current state, and tell you which unit of `State` has changed.
333
333
 
334
334
  ```typescript
335
- import { Galena, Logger } from "galena";
335
+ import { Galena, Logger } from "@figliolia/galena";
336
336
 
337
337
  // Enable logging!
338
338
  const AppState = new Galena([new Logger()]);
@@ -342,7 +342,7 @@ const AppState = new Galena([new Logger()]);
342
342
  Galena also comes with a Profiler that can track the duration of all state transitions. When a state transition exceeds 16ms, a warning is printed to the console notifying the developer of a potential bottleneck in his or her application. By default the Profiler will log each time a state transition exceeds one full frame (16ms). This threshold can be adjusted by calling `new Profiler(/* any number of milliseconds */)`
343
343
 
344
344
  ```typescript
345
- import { Galena, Profiler } from "galena";
345
+ import { Galena, Profiler } from "@figliolia/galena";
346
346
 
347
347
  const AppState = new Galena([new Profiler()]);
348
348
  ```
@@ -353,7 +353,7 @@ Similar to a lot of stateful tools, `Galena` also exposes an API for creating yo
353
353
  #### Applying Middleware
354
354
  When applying middleware in `Galena`, you may choose to apply your middleware to *all* of your application state or just some of it. To apply middleware to each of your units of `State`, you can simply initialize `Galena` with the middleware that you enjoy using:
355
355
  ```typescript
356
- import { Galena, Profiler, Logger } from "galena";
356
+ import { Galena, Profiler, Logger } from "@figliolia/galena";
357
357
 
358
358
  export const AppState = new Galena([new Profiler(), new Logger()]);
359
359
  ```
@@ -362,7 +362,7 @@ Using this method, whenever you create a new unit of state using `AppState.compo
362
362
  Alternatively, you may also choose to register a middleware on only some of your state:
363
363
 
364
364
  ```typescript
365
- import { Galena, Profiler, Logger } from "galena";
365
+ import { Galena, Profiler, Logger } from "@figliolia/galena";
366
366
 
367
367
  // Let's add logging to all of our units of State
368
368
  export const AppState = new Galena([new Logger()]);
@@ -394,7 +394,7 @@ export const CurrentUserState = AppState.composeState("currentUser", {
394
394
  Next, let's create our own custom middleware for ensuring that all entries in the `connectedUsers` array are strings:
395
395
 
396
396
  ```typescript
397
- import { Middleware } from "galena";
397
+ import { Middleware } from "@figliolia/galena";
398
398
 
399
399
  // Let's extend the Middleware class from the Galena library
400
400
  export class ConnectedUsersMiddleware extends Middleware {
@@ -429,7 +429,7 @@ export class ConnectedUsersMiddleware extends Middleware {
429
429
 
430
430
  Next let's bring this middleware into our application!
431
431
  ```typescript
432
- import { State } from "galena";
432
+ import { State } from "@figliolia/galena";
433
433
  import { ConnectedUsersMiddleware } from "./ConnectedUsersMiddleware";
434
434
 
435
435
  export const CurrentUserState = AppState.composeState("currentUser", {
@@ -453,7 +453,7 @@ Galena's `State` interface is designed to be an out-of-the-box solution for hous
453
453
  ##### Creating State Models
454
454
  ```typescript
455
455
  // UserModel.ts
456
- import { State } from "galena";
456
+ import { State } from "@figliolia/galena";
457
457
 
458
458
  // Let's extend the `State` class for a hypothetical
459
459
  // user schema
@@ -480,7 +480,7 @@ Next, let's use our Model!
480
480
 
481
481
  ```typescript
482
482
  // AppState.ts
483
- import { Galena, State } from "galena";
483
+ import { Galena, State } from "@figliolia/galena";
484
484
  import { UserModel } from "./UserModel";
485
485
 
486
486
  export const AppState = new Galena(/* middleware */);
@@ -9,7 +9,7 @@ import { State } from "./State";
9
9
  *
10
10
  * ```typescript
11
11
  * // AppState.ts
12
- * import { Galena } from "../galena";
12
+ * import { Galena } from "@figliolia/galena";
13
13
  *
14
14
  * const AppState = new Galena([...middleware]);
15
15
  *
@@ -12,7 +12,7 @@ const State_1 = require("./State");
12
12
  *
13
13
  * ```typescript
14
14
  * // AppState.ts
15
- * import { Galena } from "../galena";
15
+ * import { Galena } from "@figliolia/galena";
16
16
  *
17
17
  * const AppState = new Galena([...middleware]);
18
18
  *
@@ -162,7 +162,7 @@ export declare class State<T extends any = any> extends Scheduler {
162
162
  * state
163
163
  *
164
164
  * ```typescript
165
- * import { State } from "../galena";
165
+ * import { State } from "@figliolia/galena";
166
166
  *
167
167
  * // Extend of Galena State
168
168
  * class MyState extends State {
@@ -178,7 +178,7 @@ class State extends Scheduler_1.Scheduler {
178
178
  * state
179
179
  *
180
180
  * ```typescript
181
- * import { State } from "../galena";
181
+ * import { State } from "@figliolia/galena";
182
182
  *
183
183
  * // Extend of Galena State
184
184
  * class MyState extends State {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@figliolia/galena",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A performant state management library supporting mutable state, batched updates, middleware and a rich development API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,7 +13,7 @@ import { State } from "Galena/State";
13
13
  *
14
14
  * ```typescript
15
15
  * // AppState.ts
16
- * import { Galena } from "galena";
16
+ * import { Galena } from "@figliolia/galena";
17
17
  *
18
18
  * const AppState = new Galena([...middleware]);
19
19
  *
@@ -195,7 +195,7 @@ export class State<T extends any = any> extends Scheduler {
195
195
  * state
196
196
  *
197
197
  * ```typescript
198
- * import { State } from "galena";
198
+ * import { State } from "@figliolia/galena";
199
199
  *
200
200
  * // Extend of Galena State
201
201
  * class MyState extends State {