@jinntec/fore 2.8.0 → 3.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/dist/fore-dev.js +4581 -1863
- package/dist/fore.js +4598 -1871
- package/package.json +3 -1
- package/src/DependentXPathQueries.js +37 -2
- package/src/ForeElementMixin.js +64 -38
- package/src/actions/fx-delete.js +424 -73
- package/src/actions/fx-insert.js +471 -73
- package/src/actions/fx-setattribute.js +5 -5
- package/src/actions/fx-setvalue.js +11 -9
- package/src/fore.js +28 -71
- package/src/functions/fx-functionlib.js +138 -12
- package/src/functions/mylib.js +13 -0
- package/src/functions/registerFunction.js +78 -20
- package/src/fx-bind.js +128 -73
- package/src/fx-fore.js +201 -97
- package/src/fx-instance.js +138 -142
- package/src/fx-model.js +292 -102
- package/src/fx-submission.js +246 -135
- package/src/fx-var.js +28 -4
- package/src/json/JSONDomFacade.js +84 -0
- package/src/json/JSONLens.js +67 -0
- package/src/json/JSONNode.js +248 -0
- package/src/json/lensFromNode.js +5 -0
- package/src/modelitem.js +16 -2
- package/src/tools/fx-action-log.js +1 -1
- package/src/ui/UIElement.js +16 -2
- package/src/ui/fx-items.js +26 -32
- package/src/ui/fx-repeat.js +682 -246
- package/src/ui/fx-repeatitem.js +16 -1
- package/src/ui/repeat-base.js +8 -4
- package/src/withDraggability.js +0 -1
- package/src/xpath-evaluation.js +1763 -740
- package/src/xpath-path.js +274 -24
- package/src/xpath-util.js +92 -46
package/src/ui/fx-repeatitem.js
CHANGED
|
@@ -50,6 +50,8 @@ export class FxRepeatitem extends withDraggability(UIElement, true) {
|
|
|
50
50
|
`;
|
|
51
51
|
this.getOwnerForm().registerLazyElement(this);
|
|
52
52
|
|
|
53
|
+
// Keep ref as a *property only* so repeatitem does not become the nearest [ref] for its children.
|
|
54
|
+
// Its children already get their context from the repeatitem via getInScopeContext().
|
|
53
55
|
this.ref = `${this.parentNode.ref}`;
|
|
54
56
|
|
|
55
57
|
this.tabindex = 0;
|
|
@@ -58,7 +60,7 @@ export class FxRepeatitem extends withDraggability(UIElement, true) {
|
|
|
58
60
|
disconnectedCallback() {
|
|
59
61
|
super.disconnectedCallback();
|
|
60
62
|
this.removeEventListener('click', this._dispatchIndexChange);
|
|
61
|
-
this.removeEventListener('focusin', this.
|
|
63
|
+
this.removeEventListener('focusin', this._dispatchIndexChange);
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
init() {
|
|
@@ -96,6 +98,19 @@ export class FxRepeatitem extends withDraggability(UIElement, true) {
|
|
|
96
98
|
this.getOwnerForm().refresh();
|
|
97
99
|
}
|
|
98
100
|
|
|
101
|
+
update(_modelItem) {
|
|
102
|
+
// Repeatitems must refresh when their ModelItem facets (e.g. relevant) change,
|
|
103
|
+
// but they should NOT have a `ref` attribute (that would change inscope context resolution).
|
|
104
|
+
const fore = this.getOwnerForm();
|
|
105
|
+
if (!fore) return;
|
|
106
|
+
|
|
107
|
+
if (fore.isRefreshPhase) {
|
|
108
|
+
fore.addToBatchedNotifications(this);
|
|
109
|
+
} else {
|
|
110
|
+
this.refresh();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
99
114
|
async refresh(force = false) {
|
|
100
115
|
// this.modelItem = this.getModelItem();
|
|
101
116
|
this.attachObserver();
|
package/src/ui/repeat-base.js
CHANGED
|
@@ -199,12 +199,15 @@ export class RepeatBase extends withDraggability(UIElement, false) {
|
|
|
199
199
|
|
|
200
200
|
// Generate the parent `modelItem` for the new repeat item
|
|
201
201
|
this.opNum++;
|
|
202
|
-
|
|
202
|
+
let parentModelItem = FxBind.createModelItem(this.ref, node, this, this.opNum);
|
|
203
|
+
// IMPORTANT: registerModelItem may return an existing canonical ModelItem for the same path.
|
|
204
|
+
// Always keep using the returned instance to avoid "ghost" ModelItems that still notify.
|
|
205
|
+
parentModelItem = this.getModel().registerModelItem(parentModelItem);
|
|
203
206
|
newRepeatItem.modelItem = parentModelItem;
|
|
204
207
|
|
|
205
208
|
this.setIndex(insertionIndex);
|
|
206
209
|
|
|
207
|
-
|
|
210
|
+
// parentModelItem already registered above
|
|
208
211
|
|
|
209
212
|
// Step 5: Create modelItems recursively for child elements
|
|
210
213
|
this._createModelItemsRecursively(newRepeatItem, parentModelItem);
|
|
@@ -214,7 +217,6 @@ export class RepeatBase extends withDraggability(UIElement, false) {
|
|
|
214
217
|
|
|
215
218
|
this.getOwnerForm().addToBatchedNotifications(newRepeatItem);
|
|
216
219
|
}
|
|
217
|
-
|
|
218
220
|
/**
|
|
219
221
|
* @abstract
|
|
220
222
|
*
|
|
@@ -475,7 +477,9 @@ export class RepeatBase extends withDraggability(UIElement, false) {
|
|
|
475
477
|
// Create a ModelItem only for the final node; children never get their own opNum
|
|
476
478
|
modelItem = FxBind.createModelItem(ref, node, child, null);
|
|
477
479
|
modelItem.parentModelItem = parentModelItem;
|
|
478
|
-
|
|
480
|
+
// IMPORTANT: keep using the canonical instance returned by registerModelItem.
|
|
481
|
+
// Otherwise a throwaway ModelItem can leak into observer graphs and be notified.
|
|
482
|
+
modelItem = this.getModel().registerModelItem(modelItem);
|
|
479
483
|
}
|
|
480
484
|
|
|
481
485
|
// Always apply Dewey rewrite (handles both $inst and instance('inst') forms)
|
package/src/withDraggability.js
CHANGED
|
@@ -217,7 +217,6 @@ export const withDraggability = (superclass, isAlsoDraggable) =>
|
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
// Note: full refresh needed since multiple model items may be affected.
|
|
220
|
-
// TODO: Leverage the changedPaths trick
|
|
221
220
|
this.getOwnerForm().getModel().updateModel();
|
|
222
221
|
this.getOwnerForm().refresh(true);
|
|
223
222
|
}
|