@jinntec/fore 1.0.0-4 → 1.1.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 (66) hide show
  1. package/README.md +26 -38
  2. package/dist/fore-dev.js +43 -0
  3. package/dist/fore-dev.js.map +1 -0
  4. package/dist/fore.js +37 -0
  5. package/dist/fore.js.map +1 -0
  6. package/index.js +4 -0
  7. package/package.json +42 -42
  8. package/resources/fore.css +186 -0
  9. package/resources/toastify.css +87 -0
  10. package/resources/{fore-styles.css → vars.css} +0 -292
  11. package/src/DependencyNotifyingDomFacade.js +10 -16
  12. package/src/ForeElementMixin.js +26 -19
  13. package/src/actions/abstract-action.js +30 -9
  14. package/src/actions/fx-action.js +6 -4
  15. package/src/actions/fx-append.js +8 -17
  16. package/src/actions/fx-confirm.js +5 -3
  17. package/src/actions/fx-delete.js +6 -3
  18. package/src/actions/fx-dispatch.js +9 -8
  19. package/src/actions/fx-hide.js +10 -6
  20. package/src/actions/fx-insert.js +49 -39
  21. package/src/actions/fx-message.js +3 -1
  22. package/src/actions/fx-refresh.js +15 -1
  23. package/src/actions/fx-replace.js +73 -0
  24. package/src/actions/fx-return.js +42 -0
  25. package/src/actions/fx-send.js +3 -1
  26. package/src/actions/fx-setfocus.js +37 -0
  27. package/src/actions/fx-setvalue.js +58 -51
  28. package/src/actions/fx-show.js +12 -4
  29. package/src/actions/fx-toggle.js +15 -10
  30. package/src/actions/fx-update.js +3 -1
  31. package/src/dep_graph.js +4 -2
  32. package/src/drawdown.js +67 -82
  33. package/src/fore.js +158 -12
  34. package/src/functions/fx-function.js +17 -3
  35. package/src/fx-bind.js +42 -202
  36. package/src/fx-fore.js +599 -567
  37. package/src/fx-header.js +3 -1
  38. package/src/fx-instance.js +9 -1
  39. package/src/fx-model.js +59 -23
  40. package/src/fx-submission.js +106 -48
  41. package/src/fx-var.js +7 -4
  42. package/src/getInScopeContext.js +37 -11
  43. package/src/modelitem.js +4 -4
  44. package/src/relevance.js +64 -0
  45. package/src/ui/abstract-control.js +64 -37
  46. package/src/ui/fx-alert.js +7 -1
  47. package/src/ui/fx-case.js +4 -3
  48. package/src/ui/fx-container.js +7 -1
  49. package/src/ui/fx-control.js +309 -34
  50. package/src/ui/fx-dialog.js +54 -40
  51. package/src/ui/fx-group.js +3 -1
  52. package/src/ui/fx-hint.js +4 -1
  53. package/src/ui/fx-inspector.js +120 -17
  54. package/src/ui/fx-items.js +8 -8
  55. package/src/ui/fx-output.js +16 -5
  56. package/src/ui/fx-repeat.js +33 -41
  57. package/src/ui/fx-repeatitem.js +10 -4
  58. package/src/ui/fx-switch.js +5 -3
  59. package/src/ui/fx-trigger.js +3 -1
  60. package/src/xpath-evaluation.js +621 -576
  61. package/src/xpath-util.js +15 -8
  62. package/dist/fore-all.js +0 -140
  63. package/dist/fore-debug.js +0 -140
  64. package/src/.DS_Store +0 -0
  65. package/src/actions/.DS_Store +0 -0
  66. package/src/ui/.DS_Store +0 -0
package/src/xpath-util.js CHANGED
@@ -20,7 +20,7 @@ export class XPathUtil {
20
20
  if (start.parentNode.hasAttribute('ref')) {
21
21
  return start.parentNode;
22
22
  }
23
- XPathUtil.getParentBindingElement(start.parentNode);
23
+ return XPathUtil.getParentBindingElement(start.parentNode);
24
24
  }
25
25
  return null;
26
26
  }
@@ -29,10 +29,6 @@ export class XPathUtil {
29
29
  return path != null && (path.startsWith('/') || path.startsWith('instance('));
30
30
  }
31
31
 
32
- static isRepeated(element) {
33
- return element.parentElement.closest('fx-repeatitem');
34
- }
35
-
36
32
  static isSelfReference(ref) {
37
33
  return ref === '.' || ref === './text()' || ref === 'text()' || ref === '' || ref === null;
38
34
  }
@@ -57,21 +53,32 @@ export class XPathUtil {
57
53
  throw new Error('no Fore element present');
58
54
  }
59
55
 
60
- // todo: this will need more work to look upward for instance() expr.
56
+ /**
57
+ * returns the instance id from a complete XPath using `instance()` function.
58
+ *
59
+ * Will return 'default' in case no ref is given at all or the `instance()` function is called without arg.
60
+ *
61
+ * Otherwise instance id is extracted from function and returned. If all fails null is returned.
62
+ * @param ref
63
+ * @returns {string}
64
+ */
61
65
  static getInstanceId(ref) {
62
66
  if (!ref) {
63
67
  return 'default';
64
68
  }
69
+ if (ref.startsWith('instance()')) {
70
+ return 'default';
71
+ }
65
72
  if (ref.startsWith('instance(')) {
66
73
  const result = ref.substring(ref.indexOf('(') + 1);
67
74
  return result.substring(1, result.indexOf(')') - 1);
68
75
  }
69
- return 'default';
76
+ return null;
70
77
  }
71
78
 
72
79
  // todo: certainly not ideal to rely on duplicating instance id on instance document - better way later ;)
73
80
  static getPath(node) {
74
- const path = fx.evaluateXPath('path()', node);
81
+ const path = fx.evaluateXPathToString('path()', node);
75
82
  /*
76
83
  const instanceId = node.ownerDocument.firstElementChild.getAttribute('id');
77
84
  if (instanceId !== null && instanceId !== 'default') {