@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.
@@ -7251,7 +7251,7 @@ class VComponentDirective {
7251
7251
  * @inheritdoc
7252
7252
  */
7253
7253
  get needsAnchor() {
7254
- return true;
7254
+ return false;
7255
7255
  }
7256
7256
  /**
7257
7257
  * @inheritdoc
@@ -7322,7 +7322,12 @@ class VComponentDirective {
7322
7322
  get onUnmounted() {
7323
7323
  return undefined;
7324
7324
  }
7325
- #cloneNode() {
7325
+ /**
7326
+ * Clones the component's template and returns the root element.
7327
+ * @returns The cloned root HTMLElement of the component.
7328
+ * @throws Error if the component or its template is not found.
7329
+ */
7330
+ cloneNode() {
7326
7331
  // Get component definition from the application's component registry
7327
7332
  const component = this.#vNode.vApplication.componentRegistry.get(this.#componentId);
7328
7333
  if (!component) {
@@ -7370,8 +7375,6 @@ class VComponentDirective {
7370
7375
  // Already rendered, no action needed
7371
7376
  return;
7372
7377
  }
7373
- const clone = this.#cloneNode();
7374
- this.#vNode.anchorNode?.parentNode?.insertBefore(clone, this.#vNode.anchorNode.nextSibling);
7375
7378
  // Get properties from :options or :options.component directive
7376
7379
  let properties = {};
7377
7380
  const optionsDirective = this.#vNode.directiveManager?.optionsDirective('component');
@@ -7396,7 +7399,7 @@ class VComponentDirective {
7396
7399
  const instance = component.createInstance(properties);
7397
7400
  // Create and mount child application using the parent application's registries
7398
7401
  this.#componentApp = this.#vNode.vApplication.createChildApp(instance);
7399
- this.#componentApp.mount(clone);
7402
+ this.#componentApp.mount(this.#vNode.node);
7400
7403
  }
7401
7404
  }
7402
7405
 
@@ -7731,6 +7734,11 @@ class VDirectiveManager {
7731
7734
  * The keys are directive names (e.g., 'options', 'options.intersection').
7732
7735
  */
7733
7736
  #optionsDirectives = {};
7737
+ /**
7738
+ * The v-component directive associated with this node, if any.
7739
+ * This may be undefined if there is no v-component directive.
7740
+ */
7741
+ #componentDirective;
7734
7742
  constructor(vNode) {
7735
7743
  // Directives can only be associated with element nodes
7736
7744
  if (vNode.nodeType !== Node.ELEMENT_NODE) {
@@ -7788,6 +7796,13 @@ class VDirectiveManager {
7788
7796
  get keyDirective() {
7789
7797
  return this.#keyDirective;
7790
7798
  }
7799
+ /**
7800
+ * Gets the v-component directive associated with this node, if any.
7801
+ * This may be undefined if there is no v-component directive.
7802
+ */
7803
+ get componentDirective() {
7804
+ return this.#componentDirective;
7805
+ }
7791
7806
  /**
7792
7807
  * Gets the VBindDirective for options specific to the given directive name.
7793
7808
  * Searches in order: `:options.{directive}` -> `:options`
@@ -7877,6 +7892,10 @@ class VDirectiveManager {
7877
7892
  this.#optionsDirectives[attrName] = bindDirective;
7878
7893
  }
7879
7894
  }
7895
+ // If this is a v-component directive, store it separately
7896
+ if (directive.name === StandardDirectiveName.V_COMPONENT) {
7897
+ this.#componentDirective = directive;
7898
+ }
7880
7899
  }
7881
7900
  }
7882
7901
  // Sort directives by priority: v-for > v-if > v-else-if > v-else > v-show > others
@@ -8830,8 +8849,14 @@ class VConditionalDirective {
8830
8849
  */
8831
8850
  #cloneTemplate() {
8832
8851
  // Clone the original element
8833
- const element = this.#vNode.node;
8834
- const clone = element.cloneNode(true);
8852
+ let clone;
8853
+ if (this.vNode.directiveManager?.componentDirective) {
8854
+ clone = this.vNode.directiveManager.componentDirective.cloneNode();
8855
+ }
8856
+ else {
8857
+ const element = this.#vNode.node;
8858
+ clone = element.cloneNode(true);
8859
+ }
8835
8860
  // Create a new VNode for the cloned element
8836
8861
  const vNode = new VNode({
8837
8862
  node: clone,
@@ -9266,8 +9291,14 @@ class VForDirective {
9266
9291
  */
9267
9292
  #cloneTemplate(context) {
9268
9293
  // Clone the original element
9269
- const element = this.#vNode.node;
9270
- const clone = element.cloneNode(true);
9294
+ let clone;
9295
+ if (this.vNode.directiveManager?.componentDirective) {
9296
+ clone = this.vNode.directiveManager.componentDirective.cloneNode();
9297
+ }
9298
+ else {
9299
+ const element = this.#vNode.node;
9300
+ clone = element.cloneNode(true);
9301
+ }
9271
9302
  // Prepare identifiers for the item
9272
9303
  this.#itemName;
9273
9304
  this.#indexName;