@mintjamsinc/ichigojs 0.1.78 → 0.1.80

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.
@@ -16,6 +16,26 @@ export declare class VNode {
16
16
  * @param args The initialization arguments for the virtual node.
17
17
  */
18
18
  constructor(args: VNodeInit);
19
+ /**
20
+ * Expands the component elements this application compiled in this subtree
21
+ * but has not expanded yet, parents before their children.
22
+ *
23
+ * This is the ONLY thing that expands a component. It is deliberately a
24
+ * separate step from compilation rather than a call at the end of the
25
+ * constructor: a v-if / v-for clone is compiled while it is still detached
26
+ * (so that its directives run before anything can observe a half-built
27
+ * subtree), and expanding a detached element would mount a component
28
+ * application outside the document. The callers therefore compile, insert,
29
+ * and then call this — see VApplication.mount, VConditionalDirective,
30
+ * VForDirective and VSlotOutletDirective.
31
+ *
32
+ * Walking only {@link childVNodes} keeps the traversal inside this
33
+ * application: the internals of an expanded component were never compiled
34
+ * here, so they are not reachable and are left to their own application.
35
+ * A templatized node is skipped whole — it is a template source, and its
36
+ * clones expand when they are inserted.
37
+ */
38
+ expandComponents(): void;
19
39
  /**
20
40
  * The application instance associated with this virtual node.
21
41
  */
@@ -14,6 +14,19 @@ export interface ScopedSlotEntry {
14
14
  /**
15
15
  * Base class for ichigo.js-backed Web Components (Light DOM, no Shadow DOM).
16
16
  *
17
+ * Expansion — cloning the template into this element — is driven by the
18
+ * application that owns the element, not by connectedCallback: VNode compiles
19
+ * the element first (installing the host context, delivering the prop values
20
+ * and compiling the authored slot content in the owner's scope) and only then
21
+ * calls {@link _ichigoExpand}. That leaves connectedCallback a single job,
22
+ * re-attachment; see there.
23
+ *
24
+ * The component's <template> must be present in the document, and
25
+ * defineComponent() must have run, before the owning application is mounted.
26
+ * That is the application's responsibility. A missing template is reported as
27
+ * a warning and the element is left empty — it is never silently retried,
28
+ * because an app that renders anyway is an app whose bug cannot be found.
29
+ *
17
30
  * Mount timing:
18
31
  * - If the component declares no props, the VApplication is mounted synchronously
19
32
  * at the end of connectedCallback (the template is known, no props to wait for).
@@ -45,6 +58,14 @@ export declare class IchigoElement extends HTMLElement {
45
58
  * compiles this element. Gives component-boundary features (e.g. scoped
46
59
  * slot outlets) access to the parent scope. Undefined when the element is
47
60
  * placed outside any ichigo application.
61
+ *
62
+ * Declared with `declare` on purpose: the application installs it BEFORE
63
+ * the element is upgraded whenever the element comes from a `<template>`
64
+ * (v-if / v-for on a `<template>` clones `content`, whose owner document
65
+ * has no browsing context, so custom elements there stay uncustomized
66
+ * until the clone is inserted). A real class field would be re-defined as
67
+ * undefined by the upgrade — erasing the host context and leaving scoped
68
+ * slot outlets without a parent scope.
48
69
  */
49
70
  _ichigoHost?: {
50
71
  vNode: VNode;
@@ -55,7 +76,38 @@ export declare class IchigoElement extends HTMLElement {
55
76
  * VSlotOutletDirective when the component template renders a `<slot>`.
56
77
  */
57
78
  get _ichigoScopedSlots(): Map<string, ScopedSlotEntry> | undefined;
79
+ /**
80
+ * Handles RE-attachment, and nothing else.
81
+ *
82
+ * A first connection is not what expands this element: the owning
83
+ * application does that from {@link _ichigoExpand} once it has compiled the
84
+ * element. So a connection event on a not-yet-expanded element means the
85
+ * owner has not reached it yet, and the right thing to do is nothing. That
86
+ * covers every case the old guards enumerated one by one — a v-if / v-for
87
+ * template source, an element inside an enclosing component's template
88
+ * clone, a clone inserted before its directive expands it.
89
+ *
90
+ * An expanded element whose mount root has been torn down, on the other
91
+ * hand, was disconnected and is now coming back: v-for reorders relocate
92
+ * the host element, which disconnects and reconnects it. Its children are
93
+ * the previous expansion, not authored slot content, so it re-expands from
94
+ * the cached slot nodes. Testing the mount root rather than the expansion
95
+ * flag alone keeps this from firing on an element that was expanded while
96
+ * detached and is being inserted for the first time.
97
+ */
58
98
  connectedCallback(): void;
99
+ /**
100
+ * Expands this element's template. Called by the application that owns the
101
+ * element, right after it compiled it (VNode.expandComponents): the host
102
+ * context is installed, the prop bindings have delivered their values and
103
+ * the authored slot content has been compiled in the owner's scope, so the
104
+ * capture below sees owner-compiled nodes and the component's own
105
+ * application starts with its props already in hand.
106
+ *
107
+ * Also called by {@link connectedCallback} to rebuild the expansion after a
108
+ * move.
109
+ */
110
+ _ichigoExpand(): void;
59
111
  disconnectedCallback(): void;
60
112
  /**
61
113
  * Called by the property setters generated by defineComponent().
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintjamsinc/ichigojs",
3
- "version": "0.1.78",
3
+ "version": "0.1.80",
4
4
  "description": "ichigo.js - Simple and intuitive reactive framework. Lightweight, fast, and user-friendly virtual DOM library",
5
5
  "main": "./dist/ichigo.cjs",
6
6
  "module": "./dist/ichigo.esm.js",