@mintjamsinc/ichigojs 0.1.78 → 0.1.79
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.cjs +55 -7
- package/dist/ichigo.cjs.map +1 -1
- package/dist/ichigo.esm.js +55 -7
- package/dist/ichigo.esm.js.map +1 -1
- package/dist/ichigo.esm.min.js +1 -1
- package/dist/ichigo.min.cjs +1 -1
- package/dist/ichigo.umd.js +55 -7
- package/dist/ichigo.umd.js.map +1 -1
- package/dist/ichigo.umd.min.js +1 -1
- package/dist/types/ichigo/components/IchigoElement.d.ts +31 -0
- package/package.json +1 -1
package/dist/ichigo.cjs
CHANGED
|
@@ -9924,6 +9924,16 @@
|
|
|
9924
9924
|
});
|
|
9925
9925
|
}
|
|
9926
9926
|
}
|
|
9927
|
+
// A component element this application compiled but that has not
|
|
9928
|
+
// expanded yet — it deferred to us because an ancestor component
|
|
9929
|
+
// was attaching its template, or its <template> was not loaded when
|
|
9930
|
+
// it connected — is expanded now: the host context is installed,
|
|
9931
|
+
// the directives above delivered the prop values, and any authored
|
|
9932
|
+
// slot content was compiled in this scope. A template source
|
|
9933
|
+
// (v-if / v-for) is left alone; its clones expand on insertion.
|
|
9934
|
+
if (isComponent && !this.#templatized && !isExpandedComponent) {
|
|
9935
|
+
element._ichigoTryExpand?.();
|
|
9936
|
+
}
|
|
9927
9937
|
// After creating child nodes, call onMounted for directives that do not templatize
|
|
9928
9938
|
if (!this.#templatized) {
|
|
9929
9939
|
// animation frame to ensure DOM is updated
|
|
@@ -15428,13 +15438,6 @@
|
|
|
15428
15438
|
* belong to this component's VApplication and scope).
|
|
15429
15439
|
*/
|
|
15430
15440
|
_ichigoExpanded = false;
|
|
15431
|
-
/**
|
|
15432
|
-
* Host context installed by the parent application's VNode when it
|
|
15433
|
-
* compiles this element. Gives component-boundary features (e.g. scoped
|
|
15434
|
-
* slot outlets) access to the parent scope. Undefined when the element is
|
|
15435
|
-
* placed outside any ichigo application.
|
|
15436
|
-
*/
|
|
15437
|
-
_ichigoHost;
|
|
15438
15441
|
/**
|
|
15439
15442
|
* The scoped slot templates captured from this element's children, keyed
|
|
15440
15443
|
* by slot name ('default' for `v-slot` without a name). Read by
|
|
@@ -15457,6 +15460,24 @@
|
|
|
15457
15460
|
this.hasAttribute(StandardDirectiveName.V_FOR)) {
|
|
15458
15461
|
return;
|
|
15459
15462
|
}
|
|
15463
|
+
// --- 0a2. Guard: wait to be compiled by the owning application ---
|
|
15464
|
+
// This element came from an enclosing component's template clone and no
|
|
15465
|
+
// application has compiled it yet: the enclosing component's appendChild
|
|
15466
|
+
// connected it before that component's VApplication existed. Expanding
|
|
15467
|
+
// now would capture the slot content and mount before the owning
|
|
15468
|
+
// application installs the host context (_ichigoHost) and delivers the
|
|
15469
|
+
// prop values — scoped slot outlets would find no parent scope and
|
|
15470
|
+
// silently fall back to their default content. The owning application
|
|
15471
|
+
// expands this element while it compiles it (VNode ->
|
|
15472
|
+
// _ichigoTryExpand()), by which time both are in place.
|
|
15473
|
+
//
|
|
15474
|
+
// Only template-owned elements defer: authored slot content placed
|
|
15475
|
+
// inside a component by an application is not part of the template, so
|
|
15476
|
+
// it keeps expanding immediately (and is redistributed by the enclosing
|
|
15477
|
+
// component on every re-expansion).
|
|
15478
|
+
if (this._ichigoTemplateOwned === true && !this._ichigoHost) {
|
|
15479
|
+
return;
|
|
15480
|
+
}
|
|
15460
15481
|
// --- 0b. Reclaim prop values assigned before upgrade ---
|
|
15461
15482
|
// A plain property set on the instance (e.g. by a binding delivered
|
|
15462
15483
|
// while the element was detached or not yet upgraded) is an own data
|
|
@@ -15530,6 +15551,18 @@
|
|
|
15530
15551
|
// --- 2. Clone the component template ---
|
|
15531
15552
|
const fragment = templateEl.content.cloneNode(true);
|
|
15532
15553
|
const root = this.#findRootElement(fragment);
|
|
15554
|
+
// Mark the component elements the template brought in, so they let this
|
|
15555
|
+
// component's application compile them before they expand (guard 0a2).
|
|
15556
|
+
// Marked before slot distribution, so authored slot content — which is
|
|
15557
|
+
// not part of the template — keeps expanding under the application that
|
|
15558
|
+
// authored it. Elements inside a nested <template> are not marked: they
|
|
15559
|
+
// are inert until a directive clones them, and the clone is compiled
|
|
15560
|
+
// before it is inserted.
|
|
15561
|
+
for (const element of Array.from(fragment.querySelectorAll('*'))) {
|
|
15562
|
+
if (IchigoElementRegistry.has(element.tagName)) {
|
|
15563
|
+
element._ichigoTemplateOwned = true;
|
|
15564
|
+
}
|
|
15565
|
+
}
|
|
15533
15566
|
// --- 3. Distribute named slot content ---
|
|
15534
15567
|
for (const [name, nodes] of namedNodes) {
|
|
15535
15568
|
const slot = root.querySelector(`slot[name="${name}"]`);
|
|
@@ -15567,6 +15600,21 @@
|
|
|
15567
15600
|
this.#app = undefined;
|
|
15568
15601
|
}
|
|
15569
15602
|
}
|
|
15603
|
+
/**
|
|
15604
|
+
* Expands this element's template on behalf of the application that owns
|
|
15605
|
+
* it. Called by VNode right after it compiled this element — the host
|
|
15606
|
+
* context is installed and the prop bindings have delivered their values,
|
|
15607
|
+
* so a component that deferred its expansion (guard 0a2, or a template
|
|
15608
|
+
* that was not loaded when it connected) can now expand in the right
|
|
15609
|
+
* order. A no-op when the element is already expanded or not connected
|
|
15610
|
+
* (a template-source clone expands when it is inserted).
|
|
15611
|
+
*/
|
|
15612
|
+
_ichigoTryExpand() {
|
|
15613
|
+
if (this._ichigoExpanded || !this.isConnected) {
|
|
15614
|
+
return;
|
|
15615
|
+
}
|
|
15616
|
+
this.connectedCallback();
|
|
15617
|
+
}
|
|
15570
15618
|
/**
|
|
15571
15619
|
* Called by the property setters generated by defineComponent().
|
|
15572
15620
|
* Before mount: stores the value and schedules a mount microtask.
|