targetj 1.0.256 → 1.0.257
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/Export.js +46 -65
- package/README.md +17 -2
- package/build/AnimationManager.js +349 -155
- package/build/AnimationUtil.js +59 -6
- package/build/App.js +34 -27
- package/build/BaseModel.js +61 -50
- package/build/EventListener.js +24 -6
- package/build/LoadingManager.js +255 -52
- package/build/PageManager.js +170 -242
- package/build/RunScheduler.js +42 -26
- package/build/SearchUtil.js +10 -0
- package/build/StateManager.js +293 -0
- package/build/StateUtil.js +600 -0
- package/build/TModel.js +10 -2
- package/build/TModelUtil.js +366 -75
- package/build/TUtil.js +7 -0
- package/build/TargetExecutor.js +52 -31
- package/build/TargetUtil.js +54 -22
- package/build/index.js +2 -1
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
package/Export.js
CHANGED
|
@@ -1,26 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
App,
|
|
3
|
-
tApp,
|
|
4
|
-
tRoot,
|
|
5
|
-
isRunning,
|
|
6
|
-
getEvents,
|
|
7
|
-
getPager,
|
|
8
|
-
getLoader,
|
|
9
|
-
fetch,
|
|
10
|
-
fetchImage,
|
|
11
|
-
getManager,
|
|
12
|
-
getTargetManager,
|
|
13
|
-
getAnimationManager,
|
|
14
|
-
getRunScheduler,
|
|
15
|
-
getLocationManager,
|
|
16
|
-
getScreenWidth,
|
|
17
|
-
getScreenHeight,
|
|
18
|
-
getVisibles,
|
|
19
|
-
getResizeLastUpdate,
|
|
20
|
-
getTModelById,
|
|
21
|
-
getDomTModelById
|
|
22
|
-
} from "./build/App.js";
|
|
23
|
-
|
|
1
|
+
export * from "./build/App.js";
|
|
24
2
|
export * from "./build/TModel.js";
|
|
25
3
|
export * from "./build/Moves.js";
|
|
26
4
|
export * from "./build/SearchUtil.js";
|
|
@@ -40,53 +18,56 @@ export * from "./build/AnimationManager.js";
|
|
|
40
18
|
export * from "./build/AnimationUtil.js";
|
|
41
19
|
export * from "./build/VisibilityUtil.js";
|
|
42
20
|
export * from "./build/ScheduleUtil.js";
|
|
21
|
+
export * from "./build/StateUtil.js";
|
|
43
22
|
|
|
44
|
-
import * as AppModule from
|
|
45
|
-
import * as
|
|
46
|
-
import * as
|
|
47
|
-
import * as
|
|
48
|
-
import * as
|
|
49
|
-
import * as
|
|
50
|
-
import * as
|
|
51
|
-
import * as
|
|
52
|
-
import * as
|
|
53
|
-
import * as
|
|
54
|
-
import * as
|
|
55
|
-
import * as
|
|
56
|
-
import * as
|
|
57
|
-
import * as
|
|
58
|
-
import * as
|
|
59
|
-
import * as
|
|
60
|
-
import * as
|
|
61
|
-
import * as
|
|
62
|
-
import * as
|
|
63
|
-
import * as
|
|
23
|
+
import * as AppModule from "./build/App.js";
|
|
24
|
+
import * as TModelModule from "./build/TModel.js";
|
|
25
|
+
import * as MovesModule from "./build/Moves.js";
|
|
26
|
+
import * as SearchUtilModule from "./build/SearchUtil.js";
|
|
27
|
+
import * as TargetDataModule from "./build/TargetData.js";
|
|
28
|
+
import * as TargetUtilModule from "./build/TargetUtil.js";
|
|
29
|
+
import * as TargetParserModule from "./build/TargetParser.js";
|
|
30
|
+
import * as TModelUtilModule from "./build/TModelUtil.js";
|
|
31
|
+
import * as TUtilModule from "./build/TUtil.js";
|
|
32
|
+
import * as DomInitModule from "./build/DomInit.js";
|
|
33
|
+
import * as DomModule from "./build/$Dom.js";
|
|
34
|
+
import * as BracketModule from "./build/Bracket.js";
|
|
35
|
+
import * as BracketGeneratorModule from "./build/BracketGenerator.js";
|
|
36
|
+
import * as ColorUtilModule from "./build/ColorUtil.js";
|
|
37
|
+
import * as EasingModule from "./build/Easing.js";
|
|
38
|
+
import * as TargetExecutorModule from "./build/TargetExecutor.js";
|
|
39
|
+
import * as AnimationManagerModule from "./build/AnimationManager.js";
|
|
40
|
+
import * as AnimationUtilModule from "./build/AnimationUtil.js";
|
|
41
|
+
import * as VisibilityUtilModule from "./build/VisibilityUtil.js";
|
|
42
|
+
import * as ScheduleUtilModule from "./build/ScheduleUtil.js";
|
|
43
|
+
import * as StateUtilModule from "./build/StateUtil.js";
|
|
64
44
|
|
|
65
45
|
const TargetJS = {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
46
|
+
...AppModule,
|
|
47
|
+
...TModelModule,
|
|
48
|
+
...MovesModule,
|
|
49
|
+
...SearchUtilModule,
|
|
50
|
+
...TargetDataModule,
|
|
51
|
+
...TargetUtilModule,
|
|
52
|
+
...TargetParserModule,
|
|
53
|
+
...TModelUtilModule,
|
|
54
|
+
...TUtilModule,
|
|
55
|
+
...DomInitModule,
|
|
56
|
+
...DomModule,
|
|
57
|
+
...BracketModule,
|
|
58
|
+
...BracketGeneratorModule,
|
|
59
|
+
...ColorUtilModule,
|
|
60
|
+
...EasingModule,
|
|
61
|
+
...TargetExecutorModule,
|
|
62
|
+
...AnimationManagerModule,
|
|
63
|
+
...AnimationUtilModule,
|
|
64
|
+
...VisibilityUtilModule,
|
|
65
|
+
...ScheduleUtilModule,
|
|
66
|
+
...StateUtilModule
|
|
86
67
|
};
|
|
87
68
|
|
|
88
|
-
if (typeof window !==
|
|
89
|
-
|
|
69
|
+
if (typeof window !== "undefined") {
|
|
70
|
+
window.TargetJS = TargetJS;
|
|
90
71
|
}
|
|
91
72
|
|
|
92
73
|
export default TargetJS;
|
package/README.md
CHANGED
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
[](https://github.com/livetrails/targetjs/stargazers)
|
|
8
8
|
[](https://www.npmjs.com/package/targetj)
|
|
9
9
|
|
|
10
|
-
TargetJS is a JavaScript UI framework that replaces the "State → Render" model with "State → Transition → Render".
|
|
10
|
+
TargetJS is a JavaScript UI framework that replaces the "State → Render" model with "State → Transition → Render". Transitions are part of state, which means they can adapt dynamically, be serialized mid-transition, and resume when the UI is restored.
|
|
11
|
+
|
|
12
|
+
TargetJS also lets code order directly define the UI sequence. UI, transitions, API calls, event handling, and state are unified into self-contained Targets that chain together through Code-Ordered Reactivity.
|
|
11
13
|
|
|
12
14
|
It can be used as a full-featured framework or as a lightweight library alongside other frameworks. It is also a highly performant web framework, as shown in the [framework benchmark](https://krausest.github.io/js-framework-benchmark/current.html).
|
|
13
15
|
|
|
@@ -20,6 +22,10 @@ Traditional frameworks model the UI as a function of state: change state, re-ren
|
|
|
20
22
|
|
|
21
23
|
TargetJS treats state as a destination. Values are not only assigned. They can be approached over time through configurable steps. This makes transitions a native part of state change. TargetJS also delivers CSS-level transition efficiency.
|
|
22
24
|
|
|
25
|
+
More importantly, it unlocks a new level of flexibility. Because a target has its own lifecycle, its transitions can adapt dynamically. For example, pausing when an element leaves the screen or changing speed on scroll.
|
|
26
|
+
|
|
27
|
+
And since the transition is part of the state, it can be serialized. This means a transition can survive a page flip and resume when the UI is restored.
|
|
28
|
+
|
|
23
29
|
**Fragmentation across multiple mental models**
|
|
24
30
|
|
|
25
31
|
In many applications, state, animation, events, loading, timing, and callbacks are all handled through separate concepts or APIs. This creates glue code and a mental split between them.
|
|
@@ -41,6 +47,7 @@ With its compact style, TargetJS makes the journey from A → B explicit and eff
|
|
|
41
47
|
## 🚀 Why TargetJS?
|
|
42
48
|
|
|
43
49
|
1. Unified State: One single state. Transitions are state too.
|
|
50
|
+
1. Adaptive Transitions: Transitions can pause, resume, change speed, and respond to input. They can also be serialized and continue, for instance, after a page flip.
|
|
44
51
|
1. UI as Sequence: Code describes the UI story from top to bottom, just like the user experiences the interaction: "When this finishes, do that."
|
|
45
52
|
1. Ultra-Compact: Minimal code, with no coordination variables.
|
|
46
53
|
1. Zero Boilerplate Async: Targets handle waiting for nested asynchronous operations automatically.
|
|
@@ -56,7 +63,15 @@ npm install targetj
|
|
|
56
63
|
|
|
57
64
|
**2. Example**
|
|
58
65
|
|
|
59
|
-
This creates the following sequence:
|
|
66
|
+
This creates the following sequence:
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
bounce → move → turn red → log
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Notice how the code reads in the same order as the UI sequence. The `$$` suffix makes each target wait for all preceding targets to complete.
|
|
73
|
+
|
|
74
|
+
There is only one state, and transitions are part of that state. Although not shown here, the state can also be serialized mid-transition, for example, during a page flip and restored when the UI remounts.
|
|
60
75
|
|
|
61
76
|
```javascript
|
|
62
77
|
import { App } from "targetj";
|