@mintjamsinc/ichigojs 0.1.16 → 0.1.18

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 false;
7260
+ return true;
7261
7261
  }
7262
7262
  /**
7263
7263
  * @inheritdoc
@@ -7328,34 +7328,6 @@
7328
7328
  get onUnmounted() {
7329
7329
  return undefined;
7330
7330
  }
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() {
7337
- // Get component definition from the application's component registry
7338
- const component = this.#vNode.vApplication.componentRegistry.get(this.#componentId);
7339
- if (!component) {
7340
- throw new Error(`Component '${this.#componentId}' not found in registry`);
7341
- }
7342
- // Get template element
7343
- const finalTemplateID = component.templateID || component.id;
7344
- const templateElement = document.querySelector(`#${finalTemplateID}`);
7345
- if (!templateElement || !(templateElement instanceof HTMLTemplateElement)) {
7346
- throw new Error(`Template element '#${finalTemplateID}' not found`);
7347
- }
7348
- // Clone template content
7349
- const fragment = templateElement.content.cloneNode(true);
7350
- const childNodes = Array.from(fragment.childNodes);
7351
- // Find the first element node
7352
- for (const node of childNodes) {
7353
- if (node.nodeType === Node.ELEMENT_NODE) {
7354
- return node;
7355
- }
7356
- }
7357
- throw new Error(`No element found in template '#${finalTemplateID}'`);
7358
- }
7359
7331
  /**
7360
7332
  * @inheritdoc
7361
7333
  */
@@ -7381,6 +7353,9 @@
7381
7353
  // Already rendered, no action needed
7382
7354
  return;
7383
7355
  }
7356
+ // Clone the component's template and replace the original node
7357
+ const clone = this.#cloneNode();
7358
+ this.#vNode.anchorNode?.parentNode?.insertBefore(clone, this.#vNode.anchorNode.nextSibling);
7384
7359
  // Get properties from :options or :options.component directive
7385
7360
  let properties = {};
7386
7361
  const optionsDirective = this.#vNode.directiveManager?.optionsDirective('component');
@@ -7405,7 +7380,35 @@
7405
7380
  const instance = component.createInstance(properties);
7406
7381
  // Create and mount child application using the parent application's registries
7407
7382
  this.#componentApp = this.#vNode.vApplication.createChildApp(instance);
7408
- this.#componentApp.mount(this.#vNode.node);
7383
+ this.#componentApp.mount(clone);
7384
+ }
7385
+ /**
7386
+ * Clones the component's template and returns the root element.
7387
+ * @returns The cloned root HTMLElement of the component.
7388
+ * @throws Error if the component or its template is not found.
7389
+ */
7390
+ #cloneNode() {
7391
+ // Get component definition from the application's component registry
7392
+ const component = this.#vNode.vApplication.componentRegistry.get(this.#componentId);
7393
+ if (!component) {
7394
+ throw new Error(`Component '${this.#componentId}' not found in registry`);
7395
+ }
7396
+ // Get template element
7397
+ const finalTemplateID = component.templateID || component.id;
7398
+ const templateElement = document.querySelector(`#${finalTemplateID}`);
7399
+ if (!templateElement || !(templateElement instanceof HTMLTemplateElement)) {
7400
+ throw new Error(`Template element '#${finalTemplateID}' not found`);
7401
+ }
7402
+ // Clone template content
7403
+ const fragment = templateElement.content.cloneNode(true);
7404
+ const childNodes = Array.from(fragment.childNodes);
7405
+ // Find the first element node
7406
+ for (const node of childNodes) {
7407
+ if (node.nodeType === Node.ELEMENT_NODE) {
7408
+ return node;
7409
+ }
7410
+ }
7411
+ throw new Error(`No element found in template '#${finalTemplateID}'`);
7409
7412
  }
7410
7413
  }
7411
7414
 
@@ -7740,11 +7743,6 @@
7740
7743
  * The keys are directive names (e.g., 'options', 'options.intersection').
7741
7744
  */
7742
7745
  #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;
7748
7746
  constructor(vNode) {
7749
7747
  // Directives can only be associated with element nodes
7750
7748
  if (vNode.nodeType !== Node.ELEMENT_NODE) {
@@ -7802,13 +7800,6 @@
7802
7800
  get keyDirective() {
7803
7801
  return this.#keyDirective;
7804
7802
  }
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
- }
7812
7803
  /**
7813
7804
  * Gets the VBindDirective for options specific to the given directive name.
7814
7805
  * Searches in order: `:options.{directive}` -> `:options`
@@ -7898,10 +7889,6 @@
7898
7889
  this.#optionsDirectives[attrName] = bindDirective;
7899
7890
  }
7900
7891
  }
7901
- // If this is a v-component directive, store it separately
7902
- if (directive.name === StandardDirectiveName.V_COMPONENT) {
7903
- this.#componentDirective = directive;
7904
- }
7905
7892
  }
7906
7893
  }
7907
7894
  // Sort directives by priority: v-for > v-if > v-else-if > v-else > v-show > others
@@ -8855,14 +8842,8 @@
8855
8842
  */
8856
8843
  #cloneTemplate() {
8857
8844
  // Clone the original element
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
- }
8845
+ const element = this.#vNode.node;
8846
+ const clone = element.cloneNode(true);
8866
8847
  // Create a new VNode for the cloned element
8867
8848
  const vNode = new VNode({
8868
8849
  node: clone,
@@ -9297,14 +9278,8 @@
9297
9278
  */
9298
9279
  #cloneTemplate(context) {
9299
9280
  // Clone the original element
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
- }
9281
+ const element = this.#vNode.node;
9282
+ const clone = element.cloneNode(true);
9308
9283
  // Prepare identifiers for the item
9309
9284
  this.#itemName;
9310
9285
  this.#indexName;