@mintjamsinc/ichigojs 0.1.17 → 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.
- package/dist/ichigo.esm.js +36 -61
- 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 +36 -61
- 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/dist/types/ichigo/directives/VComponentDirective.d.ts +0 -6
- package/dist/types/ichigo/directives/VDirectiveManager.d.ts +0 -6
- package/package.json +1 -1
package/dist/ichigo.esm.js
CHANGED
@@ -7322,34 +7322,6 @@ class VComponentDirective {
|
|
7322
7322
|
get onUnmounted() {
|
7323
7323
|
return undefined;
|
7324
7324
|
}
|
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() {
|
7331
|
-
// Get component definition from the application's component registry
|
7332
|
-
const component = this.#vNode.vApplication.componentRegistry.get(this.#componentId);
|
7333
|
-
if (!component) {
|
7334
|
-
throw new Error(`Component '${this.#componentId}' not found in registry`);
|
7335
|
-
}
|
7336
|
-
// Get template element
|
7337
|
-
const finalTemplateID = component.templateID || component.id;
|
7338
|
-
const templateElement = document.querySelector(`#${finalTemplateID}`);
|
7339
|
-
if (!templateElement || !(templateElement instanceof HTMLTemplateElement)) {
|
7340
|
-
throw new Error(`Template element '#${finalTemplateID}' not found`);
|
7341
|
-
}
|
7342
|
-
// Clone template content
|
7343
|
-
const fragment = templateElement.content.cloneNode(true);
|
7344
|
-
const childNodes = Array.from(fragment.childNodes);
|
7345
|
-
// Find the first element node
|
7346
|
-
for (const node of childNodes) {
|
7347
|
-
if (node.nodeType === Node.ELEMENT_NODE) {
|
7348
|
-
return node;
|
7349
|
-
}
|
7350
|
-
}
|
7351
|
-
throw new Error(`No element found in template '#${finalTemplateID}'`);
|
7352
|
-
}
|
7353
7325
|
/**
|
7354
7326
|
* @inheritdoc
|
7355
7327
|
*/
|
@@ -7375,6 +7347,9 @@ class VComponentDirective {
|
|
7375
7347
|
// Already rendered, no action needed
|
7376
7348
|
return;
|
7377
7349
|
}
|
7350
|
+
// Clone the component's template and replace the original node
|
7351
|
+
const clone = this.#cloneNode();
|
7352
|
+
this.#vNode.anchorNode?.parentNode?.insertBefore(clone, this.#vNode.anchorNode.nextSibling);
|
7378
7353
|
// Get properties from :options or :options.component directive
|
7379
7354
|
let properties = {};
|
7380
7355
|
const optionsDirective = this.#vNode.directiveManager?.optionsDirective('component');
|
@@ -7399,7 +7374,35 @@ class VComponentDirective {
|
|
7399
7374
|
const instance = component.createInstance(properties);
|
7400
7375
|
// Create and mount child application using the parent application's registries
|
7401
7376
|
this.#componentApp = this.#vNode.vApplication.createChildApp(instance);
|
7402
|
-
this.#componentApp.mount(
|
7377
|
+
this.#componentApp.mount(clone);
|
7378
|
+
}
|
7379
|
+
/**
|
7380
|
+
* Clones the component's template and returns the root element.
|
7381
|
+
* @returns The cloned root HTMLElement of the component.
|
7382
|
+
* @throws Error if the component or its template is not found.
|
7383
|
+
*/
|
7384
|
+
#cloneNode() {
|
7385
|
+
// Get component definition from the application's component registry
|
7386
|
+
const component = this.#vNode.vApplication.componentRegistry.get(this.#componentId);
|
7387
|
+
if (!component) {
|
7388
|
+
throw new Error(`Component '${this.#componentId}' not found in registry`);
|
7389
|
+
}
|
7390
|
+
// Get template element
|
7391
|
+
const finalTemplateID = component.templateID || component.id;
|
7392
|
+
const templateElement = document.querySelector(`#${finalTemplateID}`);
|
7393
|
+
if (!templateElement || !(templateElement instanceof HTMLTemplateElement)) {
|
7394
|
+
throw new Error(`Template element '#${finalTemplateID}' not found`);
|
7395
|
+
}
|
7396
|
+
// Clone template content
|
7397
|
+
const fragment = templateElement.content.cloneNode(true);
|
7398
|
+
const childNodes = Array.from(fragment.childNodes);
|
7399
|
+
// Find the first element node
|
7400
|
+
for (const node of childNodes) {
|
7401
|
+
if (node.nodeType === Node.ELEMENT_NODE) {
|
7402
|
+
return node;
|
7403
|
+
}
|
7404
|
+
}
|
7405
|
+
throw new Error(`No element found in template '#${finalTemplateID}'`);
|
7403
7406
|
}
|
7404
7407
|
}
|
7405
7408
|
|
@@ -7734,11 +7737,6 @@ class VDirectiveManager {
|
|
7734
7737
|
* The keys are directive names (e.g., 'options', 'options.intersection').
|
7735
7738
|
*/
|
7736
7739
|
#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;
|
7742
7740
|
constructor(vNode) {
|
7743
7741
|
// Directives can only be associated with element nodes
|
7744
7742
|
if (vNode.nodeType !== Node.ELEMENT_NODE) {
|
@@ -7796,13 +7794,6 @@ class VDirectiveManager {
|
|
7796
7794
|
get keyDirective() {
|
7797
7795
|
return this.#keyDirective;
|
7798
7796
|
}
|
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
|
-
}
|
7806
7797
|
/**
|
7807
7798
|
* Gets the VBindDirective for options specific to the given directive name.
|
7808
7799
|
* Searches in order: `:options.{directive}` -> `:options`
|
@@ -7892,10 +7883,6 @@ class VDirectiveManager {
|
|
7892
7883
|
this.#optionsDirectives[attrName] = bindDirective;
|
7893
7884
|
}
|
7894
7885
|
}
|
7895
|
-
// If this is a v-component directive, store it separately
|
7896
|
-
if (directive.name === StandardDirectiveName.V_COMPONENT) {
|
7897
|
-
this.#componentDirective = directive;
|
7898
|
-
}
|
7899
7886
|
}
|
7900
7887
|
}
|
7901
7888
|
// Sort directives by priority: v-for > v-if > v-else-if > v-else > v-show > others
|
@@ -8849,14 +8836,8 @@ class VConditionalDirective {
|
|
8849
8836
|
*/
|
8850
8837
|
#cloneTemplate() {
|
8851
8838
|
// Clone the original element
|
8852
|
-
|
8853
|
-
|
8854
|
-
clone = this.vNode.directiveManager.componentDirective.cloneNode();
|
8855
|
-
}
|
8856
|
-
else {
|
8857
|
-
const element = this.#vNode.node;
|
8858
|
-
clone = element.cloneNode(true);
|
8859
|
-
}
|
8839
|
+
const element = this.#vNode.node;
|
8840
|
+
const clone = element.cloneNode(true);
|
8860
8841
|
// Create a new VNode for the cloned element
|
8861
8842
|
const vNode = new VNode({
|
8862
8843
|
node: clone,
|
@@ -9291,14 +9272,8 @@ class VForDirective {
|
|
9291
9272
|
*/
|
9292
9273
|
#cloneTemplate(context) {
|
9293
9274
|
// Clone the original element
|
9294
|
-
|
9295
|
-
|
9296
|
-
clone = this.vNode.directiveManager.componentDirective.cloneNode();
|
9297
|
-
}
|
9298
|
-
else {
|
9299
|
-
const element = this.#vNode.node;
|
9300
|
-
clone = element.cloneNode(true);
|
9301
|
-
}
|
9275
|
+
const element = this.#vNode.node;
|
9276
|
+
const clone = element.cloneNode(true);
|
9302
9277
|
// Prepare identifiers for the item
|
9303
9278
|
this.#itemName;
|
9304
9279
|
this.#indexName;
|