slicejs-web-framework 3.2.2 → 3.3.0

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.
Files changed (36) hide show
  1. package/.opencode/opencode.json +14 -0
  2. package/README.md +57 -134
  3. package/Slice/Components/Structural/ContextManager/ContextManagerDebugger.js +233 -110
  4. package/Slice/Components/Structural/Controller/Controller.js +9 -0
  5. package/Slice/Components/Structural/Controller/allowedValuesValidation.js +52 -0
  6. package/Slice/Components/Structural/Debugger/Debugger.js +392 -442
  7. package/Slice/Components/Structural/EventManager/EventManagerDebugger.js +264 -149
  8. package/Slice/Components/Structural/Router/Router.js +45 -14
  9. package/Slice/tests/props-allowed-values-validation.test.js +119 -0
  10. package/package.json +11 -9
  11. package/src/App/index.html +2 -8
  12. package/src/App/index.js +18 -21
  13. package/src/App/style.css +8 -37
  14. package/src/Components/AppComponents/AboutSection/AboutSection.css +9 -0
  15. package/src/Components/AppComponents/AboutSection/AboutSection.html +8 -0
  16. package/src/Components/AppComponents/AboutSection/AboutSection.js +12 -0
  17. package/src/Components/AppComponents/AppShell/AppShell.css +10 -0
  18. package/src/Components/AppComponents/AppShell/AppShell.html +4 -0
  19. package/src/Components/AppComponents/AppShell/AppShell.js +36 -0
  20. package/src/Components/AppComponents/HomeSection/HomeSection.css +20 -0
  21. package/src/Components/AppComponents/HomeSection/HomeSection.html +10 -0
  22. package/src/Components/AppComponents/HomeSection/HomeSection.js +19 -0
  23. package/src/Components/Visual/MultiRoute/MultiRoute.js +13 -6
  24. package/src/Components/components.js +4 -16
  25. package/src/routes.js +6 -12
  26. package/src/sliceConfig.json +2 -1
  27. package/Slice/Components/Structural/Debugger/Debugger.css +0 -620
  28. package/src/Components/AppComponents/HomePage/HomePage.css +0 -201
  29. package/src/Components/AppComponents/HomePage/HomePage.html +0 -37
  30. package/src/Components/AppComponents/HomePage/HomePage.js +0 -210
  31. package/src/Components/AppComponents/Playground/Playground.css +0 -12
  32. package/src/Components/AppComponents/Playground/Playground.html +0 -0
  33. package/src/Components/AppComponents/Playground/Playground.js +0 -111
  34. package/src/images/Slice.js-logo.png +0 -0
  35. package/src/images/im2/Slice.js-logo.png +0 -0
  36. package/src/testing.js +0 -888
@@ -0,0 +1,52 @@
1
+ const hasOwn = (obj, key) => Object.prototype.hasOwnProperty.call(obj || {}, key);
2
+
3
+ const formatValueForLog = (value) => {
4
+ if (typeof value === 'string') {
5
+ return `'${value}'`;
6
+ }
7
+
8
+ if (value === undefined) return 'undefined';
9
+
10
+ try {
11
+ return JSON.stringify(value);
12
+ } catch (_) {
13
+ return String(value);
14
+ }
15
+ };
16
+
17
+ const collectInvalidAllowedValueProps = (staticProps, providedProps) => {
18
+ const invalid = [];
19
+ const safeProvidedProps = providedProps || {};
20
+
21
+ Object.entries(staticProps || {}).forEach(([propName, config]) => {
22
+ const allowedValues = config?.allowedValues;
23
+ if (!Array.isArray(allowedValues) || allowedValues.length === 0) {
24
+ return;
25
+ }
26
+
27
+ if (!hasOwn(safeProvidedProps, propName)) {
28
+ return;
29
+ }
30
+
31
+ const value = safeProvidedProps[propName];
32
+ const isAllowed = allowedValues.some((allowedValue) => allowedValue === value);
33
+ if (!isAllowed) {
34
+ invalid.push({
35
+ propName,
36
+ value,
37
+ allowedValues
38
+ });
39
+ }
40
+ });
41
+
42
+ return invalid;
43
+ };
44
+
45
+ const formatAllowedValuesForLog = (allowedValues) => {
46
+ if (!Array.isArray(allowedValues) || allowedValues.length === 0) {
47
+ return '[]';
48
+ }
49
+ return `[${allowedValues.map((value) => formatValueForLog(value)).join(', ')}]`;
50
+ };
51
+
52
+ export { collectInvalidAllowedValueProps, formatAllowedValuesForLog };