@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.esm.js
CHANGED
|
@@ -9918,6 +9918,16 @@ class VNode {
|
|
|
9918
9918
|
});
|
|
9919
9919
|
}
|
|
9920
9920
|
}
|
|
9921
|
+
// A component element this application compiled but that has not
|
|
9922
|
+
// expanded yet — it deferred to us because an ancestor component
|
|
9923
|
+
// was attaching its template, or its <template> was not loaded when
|
|
9924
|
+
// it connected — is expanded now: the host context is installed,
|
|
9925
|
+
// the directives above delivered the prop values, and any authored
|
|
9926
|
+
// slot content was compiled in this scope. A template source
|
|
9927
|
+
// (v-if / v-for) is left alone; its clones expand on insertion.
|
|
9928
|
+
if (isComponent && !this.#templatized && !isExpandedComponent) {
|
|
9929
|
+
element._ichigoTryExpand?.();
|
|
9930
|
+
}
|
|
9921
9931
|
// After creating child nodes, call onMounted for directives that do not templatize
|
|
9922
9932
|
if (!this.#templatized) {
|
|
9923
9933
|
// animation frame to ensure DOM is updated
|
|
@@ -15422,13 +15432,6 @@ class IchigoElement extends HTMLElement {
|
|
|
15422
15432
|
* belong to this component's VApplication and scope).
|
|
15423
15433
|
*/
|
|
15424
15434
|
_ichigoExpanded = false;
|
|
15425
|
-
/**
|
|
15426
|
-
* Host context installed by the parent application's VNode when it
|
|
15427
|
-
* compiles this element. Gives component-boundary features (e.g. scoped
|
|
15428
|
-
* slot outlets) access to the parent scope. Undefined when the element is
|
|
15429
|
-
* placed outside any ichigo application.
|
|
15430
|
-
*/
|
|
15431
|
-
_ichigoHost;
|
|
15432
15435
|
/**
|
|
15433
15436
|
* The scoped slot templates captured from this element's children, keyed
|
|
15434
15437
|
* by slot name ('default' for `v-slot` without a name). Read by
|
|
@@ -15451,6 +15454,24 @@ class IchigoElement extends HTMLElement {
|
|
|
15451
15454
|
this.hasAttribute(StandardDirectiveName.V_FOR)) {
|
|
15452
15455
|
return;
|
|
15453
15456
|
}
|
|
15457
|
+
// --- 0a2. Guard: wait to be compiled by the owning application ---
|
|
15458
|
+
// This element came from an enclosing component's template clone and no
|
|
15459
|
+
// application has compiled it yet: the enclosing component's appendChild
|
|
15460
|
+
// connected it before that component's VApplication existed. Expanding
|
|
15461
|
+
// now would capture the slot content and mount before the owning
|
|
15462
|
+
// application installs the host context (_ichigoHost) and delivers the
|
|
15463
|
+
// prop values — scoped slot outlets would find no parent scope and
|
|
15464
|
+
// silently fall back to their default content. The owning application
|
|
15465
|
+
// expands this element while it compiles it (VNode ->
|
|
15466
|
+
// _ichigoTryExpand()), by which time both are in place.
|
|
15467
|
+
//
|
|
15468
|
+
// Only template-owned elements defer: authored slot content placed
|
|
15469
|
+
// inside a component by an application is not part of the template, so
|
|
15470
|
+
// it keeps expanding immediately (and is redistributed by the enclosing
|
|
15471
|
+
// component on every re-expansion).
|
|
15472
|
+
if (this._ichigoTemplateOwned === true && !this._ichigoHost) {
|
|
15473
|
+
return;
|
|
15474
|
+
}
|
|
15454
15475
|
// --- 0b. Reclaim prop values assigned before upgrade ---
|
|
15455
15476
|
// A plain property set on the instance (e.g. by a binding delivered
|
|
15456
15477
|
// while the element was detached or not yet upgraded) is an own data
|
|
@@ -15524,6 +15545,18 @@ class IchigoElement extends HTMLElement {
|
|
|
15524
15545
|
// --- 2. Clone the component template ---
|
|
15525
15546
|
const fragment = templateEl.content.cloneNode(true);
|
|
15526
15547
|
const root = this.#findRootElement(fragment);
|
|
15548
|
+
// Mark the component elements the template brought in, so they let this
|
|
15549
|
+
// component's application compile them before they expand (guard 0a2).
|
|
15550
|
+
// Marked before slot distribution, so authored slot content — which is
|
|
15551
|
+
// not part of the template — keeps expanding under the application that
|
|
15552
|
+
// authored it. Elements inside a nested <template> are not marked: they
|
|
15553
|
+
// are inert until a directive clones them, and the clone is compiled
|
|
15554
|
+
// before it is inserted.
|
|
15555
|
+
for (const element of Array.from(fragment.querySelectorAll('*'))) {
|
|
15556
|
+
if (IchigoElementRegistry.has(element.tagName)) {
|
|
15557
|
+
element._ichigoTemplateOwned = true;
|
|
15558
|
+
}
|
|
15559
|
+
}
|
|
15527
15560
|
// --- 3. Distribute named slot content ---
|
|
15528
15561
|
for (const [name, nodes] of namedNodes) {
|
|
15529
15562
|
const slot = root.querySelector(`slot[name="${name}"]`);
|
|
@@ -15561,6 +15594,21 @@ class IchigoElement extends HTMLElement {
|
|
|
15561
15594
|
this.#app = undefined;
|
|
15562
15595
|
}
|
|
15563
15596
|
}
|
|
15597
|
+
/**
|
|
15598
|
+
* Expands this element's template on behalf of the application that owns
|
|
15599
|
+
* it. Called by VNode right after it compiled this element — the host
|
|
15600
|
+
* context is installed and the prop bindings have delivered their values,
|
|
15601
|
+
* so a component that deferred its expansion (guard 0a2, or a template
|
|
15602
|
+
* that was not loaded when it connected) can now expand in the right
|
|
15603
|
+
* order. A no-op when the element is already expanded or not connected
|
|
15604
|
+
* (a template-source clone expands when it is inserted).
|
|
15605
|
+
*/
|
|
15606
|
+
_ichigoTryExpand() {
|
|
15607
|
+
if (this._ichigoExpanded || !this.isConnected) {
|
|
15608
|
+
return;
|
|
15609
|
+
}
|
|
15610
|
+
this.connectedCallback();
|
|
15611
|
+
}
|
|
15564
15612
|
/**
|
|
15565
15613
|
* Called by the property setters generated by defineComponent().
|
|
15566
15614
|
* Before mount: stores the value and schedules a mount microtask.
|