@jinntec/fore 2.4.1 → 2.5.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.
package/index.js CHANGED
@@ -32,6 +32,8 @@ import './src/tools/fx-devtools.js';
32
32
  import './src/tools/fx-dom-inspector.js';
33
33
  import './src/lab/fore-component.js';
34
34
  import './src/tools/fx-json-instance.js';
35
+ import './tools/fx-lens.js';
36
+ import './src/ui/fx-upload.js';
35
37
  // import './src/tools/fx-minimap.js';
36
38
 
37
39
  // import './src/ui/fx-checkbox-group.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jinntec/fore",
3
- "version": "2.4.1",
3
+ "version": "2.5.0",
4
4
  "description": "Fore - declarative user interfaces in plain HTML",
5
5
  "module": "./index.js",
6
6
  "publishConfig": {
@@ -49,7 +49,7 @@
49
49
  "@skypack/package-check": "^0.2.2",
50
50
  "@types/cypress": "^1.1.3",
51
51
  "@webcomponents/webcomponentsjs": "^2.6.0",
52
- "cypress": "^13.3.0",
52
+ "cypress": "^13.16.0",
53
53
  "deepmerge": "^4.2.2",
54
54
  "es-dev-server": "^2.1.0",
55
55
  "eslint": "^8.16.0",
@@ -8,7 +8,7 @@
8
8
  --inspector-pre-bg: var(--paper-grey-100);
9
9
  --inspector-color: var(--paper-grey-800);
10
10
  --inspector-instance-height: 200px;
11
- --inspector-handle-bg: var(--paper-blue-500);
11
+ --inspector-handle-bg: var(--paper-blue-700);
12
12
  --inspector-handle-width: 30px;
13
13
  }
14
14
 
@@ -56,7 +56,7 @@ export default class ForeElementMixin extends HTMLElement {
56
56
  super();
57
57
  this.context = null;
58
58
  this.model = null;
59
- this.modelItem = {};
59
+ this.modelItem = null;
60
60
  this.ref = this.hasAttribute('ref') ? this.getAttribute('ref') : '';
61
61
  /**
62
62
  * @type {Map<string, import('./fx-var.js').FxVariable>}
@@ -230,9 +230,6 @@ export default class ForeElementMixin extends HTMLElement {
230
230
  * @returns {import('./modelitem.js').ModelItem}
231
231
  */
232
232
  getModelItem() {
233
- // return this.model.bindingMap.find(m => m.refnode === this.nodeset);
234
- // return this.getModel().bindingMap.find(m => m.refnode === this.nodeset);
235
-
236
233
  const mi = this.getModel().getModelItem(this.nodeset);
237
234
  if (mi) {
238
235
  this.modelItem = mi;
@@ -248,12 +245,21 @@ export default class ForeElementMixin extends HTMLElement {
248
245
  existed = this.getModel().getModelItem(this.nodeset);
249
246
  }
250
247
  } else {
251
- existed = this.getModel().getModelItem(this.nodeset);
248
+ existed = this.nodeset ? this.getModel().getModelItem(this.nodeset) : null;
252
249
  }
253
250
 
254
251
  if (!existed) {
255
- return FxModel.lazyCreateModelItem(this.getModel(), this.ref, this.nodeset);
252
+ const lazyCreatedModelItem = FxModel.lazyCreateModelItem(
253
+ this.getModel(),
254
+ this.ref,
255
+ this.nodeset,
256
+ this,
257
+ );
258
+ this.modelItem = lazyCreatedModelItem;
259
+ return lazyCreatedModelItem;
256
260
  }
261
+ this.modelItem = existed;
262
+
257
263
  return existed;
258
264
  }
259
265
 
@@ -214,6 +214,27 @@ export class AbstractAction extends ForeElementMixin {
214
214
  async execute(e) {
215
215
  if(!this.getModel().modelConstructed) return;
216
216
  // console.log(this, this.event);
217
+ if(this.event){
218
+ if(this.event === 'submit-done'){
219
+ console.info(
220
+ `%csubmit-done ${this.event} #${this?.parentNode?.id}`,
221
+ 'background:lime; color:black; padding:.5rem; display:inline-block; white-space: nowrap; border-radius:0.3rem;width:100%;',
222
+ );
223
+ }else{
224
+ console.info(
225
+ `%cexecuting ${this.constructor.name} ${this.event}`,
226
+ 'background:lime; color:black; padding:.5rem; display:inline-block; white-space: nowrap; border-radius:0.3rem;width:100%;',
227
+ );
228
+ }
229
+
230
+ }else{
231
+ console.info(
232
+ `%cexecuting ${this.constructor.name}`,
233
+ 'background:limegreen; color:black; margin-left:1rem; padding:.5rem; display:inline-block; white-space: nowrap; border-radius:0.3rem;width:100%;',
234
+ this
235
+ );
236
+ }
237
+
217
238
 
218
239
  if (e && e.target.nodeType !== Node.DOCUMENT_NODE && e.target !== window) {
219
240
  /*
@@ -247,6 +268,12 @@ export class AbstractAction extends ForeElementMixin {
247
268
 
248
269
  // Outermost handling
249
270
  if (FxFore.outermostHandler === null) {
271
+ console.log(
272
+ `%coutermost Action on ${this.getOwnerForm().id}`,
273
+ 'background:darkblue; color:white; padding:0.3rem; display:inline-block; white-space: nowrap; border-radius:0.3rem;',
274
+ this,
275
+ );
276
+
250
277
  FxFore.outermostHandler = this;
251
278
  this.dispatchEvent(
252
279
  new CustomEvent('outermost-action-start', {
@@ -378,6 +405,12 @@ export class AbstractAction extends ForeElementMixin {
378
405
  this.currentEvent = null;
379
406
  this.actionPerformed();
380
407
  if (FxFore.outermostHandler === this) {
408
+ console.log(
409
+ `%cfinalizing outermost Action on ${this.getOwnerForm().id}`,
410
+ 'background:darkblue; color:white; padding:0.3rem; display:inline-block; white-space: nowrap; border-radius:0.3rem;',
411
+ this,
412
+ );
413
+
381
414
  FxFore.outermostHandler = null;
382
415
  /*
383
416
  console.info(
@@ -63,8 +63,8 @@ class FxDelete extends AbstractAction {
63
63
  parent = nodesToDelete.parentNode;
64
64
  this._deleteNode(parent, nodesToDelete);
65
65
  }
66
-
67
- await Fore.dispatch(instance, 'deleted', { ref: path, deletedNodes: nodesToDelete });
66
+ const foreId = this.getOwnerForm().id;
67
+ await Fore.dispatch(instance, 'deleted', { ref: path, deletedNodes: nodesToDelete , instanceId:instanceId, foreId:foreId});
68
68
  this.needsUpdate = true;
69
69
  }
70
70
 
@@ -251,6 +251,8 @@ export class FxInsert extends AbstractAction {
251
251
  'inserted-nodes': originSequenceClone,
252
252
  'insert-location-node': insertLocationNode,
253
253
  position: this.position,
254
+ instanceId:instanceId,
255
+ foreId:this.getOwnerForm().id
254
256
  });
255
257
 
256
258
  // todo: this actually should dispatch to respective instance
@@ -87,12 +87,10 @@ class FxSend extends AbstractAction {
87
87
  }
88
88
 
89
89
  await submission.submit();
90
- /*
91
90
  if(submission.replace === 'instance'){
92
91
  this.getModel().updateModel();
93
92
  this.getOwnerForm().refresh();
94
93
  }
95
- */
96
94
  // if not of type fx-submission signal error
97
95
  }
98
96
 
@@ -92,13 +92,17 @@ export default class FxSetvalue extends AbstractAction {
92
92
 
93
93
  if (newVal?.nodeType) {
94
94
  if (newVal.nodeType === Node.ELEMENT_NODE) {
95
- item.value = newVal.textContent;
95
+ item.value = newVal;
96
96
  }
97
97
  if (newVal.nodeType === Node.ATTRIBUTE_NODE) {
98
98
  item.value = newVal.getValue();
99
99
  }
100
+ if(newVal.nodeType === Node.TEXT_NODE){
101
+ item.value = newVal.textContent;
102
+ }
100
103
  } else {
101
104
  item.value = newVal;
105
+ item.node.textContent = newVal;
102
106
  }
103
107
  this.getModel().changed.push(modelItem);
104
108
  this.needsUpdate = true;
package/src/fore.js CHANGED
@@ -320,7 +320,8 @@ export class Fore {
320
320
  }
321
321
  // console.log('refreshing', element, element?.ref);
322
322
  // console.log('refreshing ',element);
323
- } else if (element.nodeName.toUpperCase() !== 'FX-MODEL') {
323
+ } else if (!(element.inert === true) ) {
324
+ // testing for inert catches model and action elements and should just leave updateable html elements
324
325
  Fore.refreshChildren(element, force);
325
326
  }
326
327
  }
package/src/fx-bind.js CHANGED
@@ -306,9 +306,9 @@ export class FxBind extends ForeElementMixin {
306
306
 
307
307
  // const path = fx.evaluateXPath('path()',node);
308
308
  // const path = this.getPath(node);
309
- const instance = XPathUtil.resolveInstance(this, this.ref);
309
+ const instanceId = XPathUtil.resolveInstance(this, this.ref);
310
310
 
311
- const path = XPathUtil.getPath(node, instance);
311
+ const path = XPathUtil.getPath(node, instanceId);
312
312
  // const shortPath = this.shortenPath(path);
313
313
 
314
314
  // ### constructing default modelitem - will get evaluated during recalculate()
@@ -325,6 +325,7 @@ export class FxBind extends ForeElementMixin {
325
325
  this.type,
326
326
  targetNode,
327
327
  this,
328
+ instanceId
328
329
  );
329
330
 
330
331
  const alert = this.getAlert();