@mintjamsinc/ichigojs 0.1.18 → 0.1.19
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/ichigo.esm.js +46 -42
- package/dist/ichigo.esm.js.map +1 -1
- package/dist/ichigo.esm.min.js +1 -1
- package/dist/ichigo.esm.min.js.map +1 -1
- package/dist/ichigo.umd.js +46 -42
- package/dist/ichigo.umd.js.map +1 -1
- package/dist/ichigo.umd.min.js +1 -1
- package/dist/ichigo.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/ichigo.esm.js
CHANGED
@@ -8812,8 +8812,17 @@ class VConditionalDirective {
|
|
8812
8812
|
// Already rendered, no action needed
|
8813
8813
|
return;
|
8814
8814
|
}
|
8815
|
-
|
8816
|
-
this.#
|
8815
|
+
// Clone the original node and create a new VNode for it
|
8816
|
+
const clone = this.#cloneNode();
|
8817
|
+
// Insert the cloned node after the anchor node, or as a child of the parent if no anchor
|
8818
|
+
this.#vNode.anchorNode?.parentNode?.insertBefore(clone, this.#vNode.anchorNode.nextSibling);
|
8819
|
+
// Create a new VNode for the cloned element
|
8820
|
+
const vNode = new VNode({
|
8821
|
+
node: clone,
|
8822
|
+
vApplication: this.#vNode.vApplication,
|
8823
|
+
parentVNode: this.#vNode.parentVNode
|
8824
|
+
});
|
8825
|
+
this.#renderedVNode = vNode;
|
8817
8826
|
this.#renderedVNode.forceUpdate();
|
8818
8827
|
}
|
8819
8828
|
/**
|
@@ -8832,19 +8841,13 @@ class VConditionalDirective {
|
|
8832
8841
|
this.#renderedVNode = undefined;
|
8833
8842
|
}
|
8834
8843
|
/**
|
8835
|
-
* Clones the
|
8844
|
+
* Clones the original node of the directive's virtual node.
|
8845
|
+
* This is used to create a new instance of the node for rendering.
|
8846
|
+
* @returns The cloned HTMLElement.
|
8836
8847
|
*/
|
8837
|
-
#
|
8838
|
-
// Clone the original element
|
8848
|
+
#cloneNode() {
|
8839
8849
|
const element = this.#vNode.node;
|
8840
|
-
|
8841
|
-
// Create a new VNode for the cloned element
|
8842
|
-
const vNode = new VNode({
|
8843
|
-
node: clone,
|
8844
|
-
vApplication: this.#vNode.vApplication,
|
8845
|
-
parentVNode: this.#vNode.parentVNode
|
8846
|
-
});
|
8847
|
-
return vNode;
|
8850
|
+
return element.cloneNode(true);
|
8848
8851
|
}
|
8849
8852
|
/**
|
8850
8853
|
* Creates a function to evaluate the directive's condition.
|
@@ -9184,15 +9187,36 @@ class VForDirective {
|
|
9184
9187
|
let vNode = this.#renderedItems.get(key);
|
9185
9188
|
if (!vNode) {
|
9186
9189
|
// Create new item
|
9187
|
-
|
9188
|
-
newRenderedItems.set(key, vNode);
|
9190
|
+
const clone = this.#cloneNode();
|
9189
9191
|
// Insert after previous node
|
9190
9192
|
if (prevNode.nextSibling) {
|
9191
|
-
parent.insertBefore(
|
9193
|
+
parent.insertBefore(clone, prevNode.nextSibling);
|
9192
9194
|
}
|
9193
9195
|
else {
|
9194
|
-
parent.appendChild(
|
9196
|
+
parent.appendChild(clone);
|
9197
|
+
}
|
9198
|
+
// Prepare identifiers for the item
|
9199
|
+
this.#itemName;
|
9200
|
+
this.#indexName;
|
9201
|
+
// Create bindings for this iteration
|
9202
|
+
const bindings = new VBindings({
|
9203
|
+
parent: this.#vNode.bindings
|
9204
|
+
});
|
9205
|
+
if (this.#itemName) {
|
9206
|
+
bindings.set(this.#itemName, context.item);
|
9207
|
+
}
|
9208
|
+
if (this.#indexName) {
|
9209
|
+
bindings.set(this.#indexName, context.index);
|
9195
9210
|
}
|
9211
|
+
// Create a new VNode for the cloned element
|
9212
|
+
vNode = new VNode({
|
9213
|
+
node: clone,
|
9214
|
+
vApplication: this.#vNode.vApplication,
|
9215
|
+
parentVNode: this.#vNode.parentVNode,
|
9216
|
+
bindings,
|
9217
|
+
dependentIdentifiers: [`${this.#sourceName}[${context.index}]`]
|
9218
|
+
});
|
9219
|
+
newRenderedItems.set(key, vNode);
|
9196
9220
|
vNode.forceUpdate();
|
9197
9221
|
}
|
9198
9222
|
else {
|
@@ -9268,34 +9292,14 @@ class VForDirective {
|
|
9268
9292
|
};
|
9269
9293
|
}
|
9270
9294
|
/**
|
9271
|
-
*
|
9295
|
+
* Clones the original node of the directive's virtual node.
|
9296
|
+
* This is used to create a new instance of the node for rendering.
|
9297
|
+
* @returns The cloned HTMLElement.
|
9272
9298
|
*/
|
9273
|
-
#
|
9299
|
+
#cloneNode() {
|
9274
9300
|
// Clone the original element
|
9275
9301
|
const element = this.#vNode.node;
|
9276
|
-
|
9277
|
-
// Prepare identifiers for the item
|
9278
|
-
this.#itemName;
|
9279
|
-
this.#indexName;
|
9280
|
-
// Create bindings for this iteration
|
9281
|
-
const bindings = new VBindings({
|
9282
|
-
parent: this.#vNode.bindings
|
9283
|
-
});
|
9284
|
-
if (this.#itemName) {
|
9285
|
-
bindings.set(this.#itemName, context.item);
|
9286
|
-
}
|
9287
|
-
if (this.#indexName) {
|
9288
|
-
bindings.set(this.#indexName, context.index);
|
9289
|
-
}
|
9290
|
-
// Create a new VNode for the cloned element
|
9291
|
-
const vNode = new VNode({
|
9292
|
-
node: clone,
|
9293
|
-
vApplication: this.#vNode.vApplication,
|
9294
|
-
parentVNode: this.#vNode.parentVNode,
|
9295
|
-
bindings,
|
9296
|
-
dependentIdentifiers: [`${this.#sourceName}[${context.index}]`]
|
9297
|
-
});
|
9298
|
-
return vNode;
|
9302
|
+
return element.cloneNode(true);
|
9299
9303
|
}
|
9300
9304
|
/**
|
9301
9305
|
* Update bindings for an existing item
|