@mintjamsinc/ichigojs 0.1.15 → 0.1.16

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.
@@ -7257,7 +7257,7 @@
7257
7257
  * @inheritdoc
7258
7258
  */
7259
7259
  get needsAnchor() {
7260
- return true;
7260
+ return false;
7261
7261
  }
7262
7262
  /**
7263
7263
  * @inheritdoc
@@ -7328,7 +7328,12 @@
7328
7328
  get onUnmounted() {
7329
7329
  return undefined;
7330
7330
  }
7331
- #cloneNode() {
7331
+ /**
7332
+ * Clones the component's template and returns the root element.
7333
+ * @returns The cloned root HTMLElement of the component.
7334
+ * @throws Error if the component or its template is not found.
7335
+ */
7336
+ cloneNode() {
7332
7337
  // Get component definition from the application's component registry
7333
7338
  const component = this.#vNode.vApplication.componentRegistry.get(this.#componentId);
7334
7339
  if (!component) {
@@ -7376,8 +7381,6 @@
7376
7381
  // Already rendered, no action needed
7377
7382
  return;
7378
7383
  }
7379
- const clone = this.#cloneNode();
7380
- this.#vNode.anchorNode?.parentNode?.insertBefore(clone, this.#vNode.anchorNode.nextSibling);
7381
7384
  // Get properties from :options or :options.component directive
7382
7385
  let properties = {};
7383
7386
  const optionsDirective = this.#vNode.directiveManager?.optionsDirective('component');
@@ -7402,7 +7405,7 @@
7402
7405
  const instance = component.createInstance(properties);
7403
7406
  // Create and mount child application using the parent application's registries
7404
7407
  this.#componentApp = this.#vNode.vApplication.createChildApp(instance);
7405
- this.#componentApp.mount(clone);
7408
+ this.#componentApp.mount(this.#vNode.node);
7406
7409
  }
7407
7410
  }
7408
7411
 
@@ -7737,6 +7740,11 @@
7737
7740
  * The keys are directive names (e.g., 'options', 'options.intersection').
7738
7741
  */
7739
7742
  #optionsDirectives = {};
7743
+ /**
7744
+ * The v-component directive associated with this node, if any.
7745
+ * This may be undefined if there is no v-component directive.
7746
+ */
7747
+ #componentDirective;
7740
7748
  constructor(vNode) {
7741
7749
  // Directives can only be associated with element nodes
7742
7750
  if (vNode.nodeType !== Node.ELEMENT_NODE) {
@@ -7794,6 +7802,13 @@
7794
7802
  get keyDirective() {
7795
7803
  return this.#keyDirective;
7796
7804
  }
7805
+ /**
7806
+ * Gets the v-component directive associated with this node, if any.
7807
+ * This may be undefined if there is no v-component directive.
7808
+ */
7809
+ get componentDirective() {
7810
+ return this.#componentDirective;
7811
+ }
7797
7812
  /**
7798
7813
  * Gets the VBindDirective for options specific to the given directive name.
7799
7814
  * Searches in order: `:options.{directive}` -> `:options`
@@ -7883,6 +7898,10 @@
7883
7898
  this.#optionsDirectives[attrName] = bindDirective;
7884
7899
  }
7885
7900
  }
7901
+ // If this is a v-component directive, store it separately
7902
+ if (directive.name === StandardDirectiveName.V_COMPONENT) {
7903
+ this.#componentDirective = directive;
7904
+ }
7886
7905
  }
7887
7906
  }
7888
7907
  // Sort directives by priority: v-for > v-if > v-else-if > v-else > v-show > others
@@ -8836,8 +8855,14 @@
8836
8855
  */
8837
8856
  #cloneTemplate() {
8838
8857
  // Clone the original element
8839
- const element = this.#vNode.node;
8840
- const clone = element.cloneNode(true);
8858
+ let clone;
8859
+ if (this.vNode.directiveManager?.componentDirective) {
8860
+ clone = this.vNode.directiveManager.componentDirective.cloneNode();
8861
+ }
8862
+ else {
8863
+ const element = this.#vNode.node;
8864
+ clone = element.cloneNode(true);
8865
+ }
8841
8866
  // Create a new VNode for the cloned element
8842
8867
  const vNode = new VNode({
8843
8868
  node: clone,
@@ -9272,8 +9297,14 @@
9272
9297
  */
9273
9298
  #cloneTemplate(context) {
9274
9299
  // Clone the original element
9275
- const element = this.#vNode.node;
9276
- const clone = element.cloneNode(true);
9300
+ let clone;
9301
+ if (this.vNode.directiveManager?.componentDirective) {
9302
+ clone = this.vNode.directiveManager.componentDirective.cloneNode();
9303
+ }
9304
+ else {
9305
+ const element = this.#vNode.node;
9306
+ clone = element.cloneNode(true);
9307
+ }
9277
9308
  // Prepare identifiers for the item
9278
9309
  this.#itemName;
9279
9310
  this.#indexName;