@flexsurfer/reflex 0.1.5 → 0.1.7
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 +4 -2
- package/dist/index.cjs +15 -3
- package/dist/index.d.cts +4 -7
- package/dist/index.d.ts +4 -7
- package/dist/index.mjs +15 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ A reactive, functional state management library that brings the elegance and pow
|
|
|
16
16
|
|
|
17
17
|
## ✨ Why Reflex?
|
|
18
18
|
|
|
19
|
-
After
|
|
19
|
+
After many years of building applications with re-frame in the ClojureScript world, I wanted to bring the same architectural elegance to the JavaScript/TypeScript ecosystem. Reflex is not just another state management library—it's a battle-tested pattern that promotes:
|
|
20
20
|
|
|
21
21
|
🎯 **Predictable State Management** - Unidirectional data flow with pure functions
|
|
22
22
|
🧩 **Composable Architecture** - Build complex apps from simple, reusable pieces
|
|
@@ -266,7 +266,9 @@ regSub('count');
|
|
|
266
266
|
- [re-frame Documentation](https://day8.github.io/re-frame/re-frame/) - The original and comprehensive guide to understanding the philosophy and patterns
|
|
267
267
|
- Step-by-Step Tutorial - TBD
|
|
268
268
|
- API Reference - TBD
|
|
269
|
-
- Examples
|
|
269
|
+
- Examples
|
|
270
|
+
- [TodoMVC](https://github.com/flexsurfer/reflex/tree/main/examples/todomvc) - Classic todo app implementation showcasing core reflex patterns
|
|
271
|
+
- [Einbürgerungstest](https://github.com/flexsurfer/einburgerungstest/) - German citizenship test app built with reflex ([Live Demo](https://www.ebtest.org/))
|
|
270
272
|
- Best Practices - TBD
|
|
271
273
|
|
|
272
274
|
## 🤝 Contributing
|
package/dist/index.cjs
CHANGED
|
@@ -508,7 +508,15 @@ var doFxInterceptor = {
|
|
|
508
508
|
consoleLog("warn", `[reflex] effects expects a vector, but was given ${typeof effects}`);
|
|
509
509
|
return context;
|
|
510
510
|
}
|
|
511
|
-
effects.
|
|
511
|
+
effects.forEach((effect) => {
|
|
512
|
+
if (!effect) {
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
if (!Array.isArray(effect) || effect.length === 0 || effect.length > 2) {
|
|
516
|
+
consoleLog("warn", `[reflex] invalid effect in effects:`, effect);
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
const [key, val] = effect;
|
|
512
520
|
const effectFn = getHandler(KIND2, key);
|
|
513
521
|
if (effectFn) {
|
|
514
522
|
try {
|
|
@@ -1189,8 +1197,12 @@ function setupSubsHotReload() {
|
|
|
1189
1197
|
return { dispose, accept };
|
|
1190
1198
|
}
|
|
1191
1199
|
function HotReloadWrapper({ children }) {
|
|
1192
|
-
|
|
1193
|
-
|
|
1200
|
+
if (isDebugEnabled()) {
|
|
1201
|
+
const key = useHotReloadKey();
|
|
1202
|
+
return import_react2.default.createElement(import_react2.default.Fragment, { key }, children);
|
|
1203
|
+
} else {
|
|
1204
|
+
return children;
|
|
1205
|
+
}
|
|
1194
1206
|
}
|
|
1195
1207
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1196
1208
|
0 && (module.exports = {
|
package/dist/index.d.cts
CHANGED
|
@@ -13,7 +13,7 @@ type ErrorHandler = (originalError: Error, reFrameError: Error & {
|
|
|
13
13
|
type SubVector = [Id, ...any[]];
|
|
14
14
|
type SubHandler = (...values: any[]) => any;
|
|
15
15
|
type SubDepsHandler = (...params: any[]) => SubVector[];
|
|
16
|
-
type Effects = [string, any][];
|
|
16
|
+
type Effects = [string, any?][];
|
|
17
17
|
interface DispatchLaterEffect {
|
|
18
18
|
ms: number;
|
|
19
19
|
dispatch: EventVector;
|
|
@@ -178,12 +178,9 @@ declare function setupSubsHotReload(): {
|
|
|
178
178
|
*/
|
|
179
179
|
declare function HotReloadWrapper({ children }: {
|
|
180
180
|
children: React.ReactNode;
|
|
181
|
-
}): React.
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
display: "contents";
|
|
185
|
-
};
|
|
186
|
-
}, HTMLElement>;
|
|
181
|
+
}): string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.FunctionComponentElement<{
|
|
182
|
+
children?: React.ReactNode | undefined;
|
|
183
|
+
}> | null | undefined;
|
|
187
184
|
|
|
188
185
|
type TraceID = number;
|
|
189
186
|
interface TraceOpts {
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ type ErrorHandler = (originalError: Error, reFrameError: Error & {
|
|
|
13
13
|
type SubVector = [Id, ...any[]];
|
|
14
14
|
type SubHandler = (...values: any[]) => any;
|
|
15
15
|
type SubDepsHandler = (...params: any[]) => SubVector[];
|
|
16
|
-
type Effects = [string, any][];
|
|
16
|
+
type Effects = [string, any?][];
|
|
17
17
|
interface DispatchLaterEffect {
|
|
18
18
|
ms: number;
|
|
19
19
|
dispatch: EventVector;
|
|
@@ -178,12 +178,9 @@ declare function setupSubsHotReload(): {
|
|
|
178
178
|
*/
|
|
179
179
|
declare function HotReloadWrapper({ children }: {
|
|
180
180
|
children: React.ReactNode;
|
|
181
|
-
}): React.
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
display: "contents";
|
|
185
|
-
};
|
|
186
|
-
}, HTMLElement>;
|
|
181
|
+
}): string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.FunctionComponentElement<{
|
|
182
|
+
children?: React.ReactNode | undefined;
|
|
183
|
+
}> | null | undefined;
|
|
187
184
|
|
|
188
185
|
type TraceID = number;
|
|
189
186
|
interface TraceOpts {
|
package/dist/index.mjs
CHANGED
|
@@ -441,7 +441,15 @@ var doFxInterceptor = {
|
|
|
441
441
|
consoleLog("warn", `[reflex] effects expects a vector, but was given ${typeof effects}`);
|
|
442
442
|
return context;
|
|
443
443
|
}
|
|
444
|
-
effects.
|
|
444
|
+
effects.forEach((effect) => {
|
|
445
|
+
if (!effect) {
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
if (!Array.isArray(effect) || effect.length === 0 || effect.length > 2) {
|
|
449
|
+
consoleLog("warn", `[reflex] invalid effect in effects:`, effect);
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
const [key, val] = effect;
|
|
445
453
|
const effectFn = getHandler(KIND2, key);
|
|
446
454
|
if (effectFn) {
|
|
447
455
|
try {
|
|
@@ -1122,8 +1130,12 @@ function setupSubsHotReload() {
|
|
|
1122
1130
|
return { dispose, accept };
|
|
1123
1131
|
}
|
|
1124
1132
|
function HotReloadWrapper({ children }) {
|
|
1125
|
-
|
|
1126
|
-
|
|
1133
|
+
if (isDebugEnabled()) {
|
|
1134
|
+
const key = useHotReloadKey();
|
|
1135
|
+
return React.createElement(React.Fragment, { key }, children);
|
|
1136
|
+
} else {
|
|
1137
|
+
return children;
|
|
1138
|
+
}
|
|
1127
1139
|
}
|
|
1128
1140
|
export {
|
|
1129
1141
|
HotReloadWrapper,
|