@mintjamsinc/ichigojs 0.1.81 → 0.1.82
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/README.md +14 -0
- package/dist/ichigo.cjs +304 -30
- package/dist/ichigo.cjs.map +1 -1
- package/dist/ichigo.esm.js +304 -30
- 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 +304 -30
- package/dist/ichigo.umd.js.map +1 -1
- package/dist/ichigo.umd.min.js +1 -1
- package/dist/types/ichigo/components/IchigoElement.d.ts +14 -3
- package/dist/types/ichigo/directives/VSlotOutletDirective.d.ts +3 -3
- package/dist/types/ichigo/directives/VStaticSlotOutletDirective.d.ts +129 -0
- package/package.json +1 -1
|
@@ -36,9 +36,13 @@ export interface ScopedSlotEntry {
|
|
|
36
36
|
* microtask fires, so data() can read them. A component used without any prop
|
|
37
37
|
* binding still mounts — with its declared defaults — instead of waiting forever.
|
|
38
38
|
*
|
|
39
|
-
* Slot content is captured on the first
|
|
40
|
-
*
|
|
41
|
-
*
|
|
39
|
+
* Slot content is captured on the first expansion and cached. The nodes are the
|
|
40
|
+
* parent application's compiled nodes and are only ever moved, never cloned:
|
|
41
|
+
* each `<slot>` outlet the component renders moves them into place
|
|
42
|
+
* (VStaticSlotOutletDirective; scoped `<template v-slot>` content is rendered
|
|
43
|
+
* per outlet by VSlotOutletDirective instead). A component that is moved in
|
|
44
|
+
* the DOM (e.g. reordered by v-for) re-expands its template, and its outlets
|
|
45
|
+
* move the same nodes into the fresh expansion.
|
|
42
46
|
*
|
|
43
47
|
* Subclasses must set the static fields _template, _props, _propOptions and
|
|
44
48
|
* _buildOptions before calling customElements.define(). defineComponent()
|
|
@@ -76,6 +80,13 @@ export declare class IchigoElement extends HTMLElement {
|
|
|
76
80
|
* VSlotOutletDirective when the component template renders a `<slot>`.
|
|
77
81
|
*/
|
|
78
82
|
get _ichigoScopedSlots(): Map<string, ScopedSlotEntry> | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* The static slot content captured for the given slot name ('default'
|
|
85
|
+
* for the unnamed slot): the parent application's nodes, moved into place
|
|
86
|
+
* by VStaticSlotOutletDirective. Undefined when nothing was provided for
|
|
87
|
+
* that name, in which case the outlet's fallback content renders.
|
|
88
|
+
*/
|
|
89
|
+
_ichigoSlotNodes(name: string): Node[] | undefined;
|
|
79
90
|
/**
|
|
80
91
|
* Handles RE-attachment, and nothing else.
|
|
81
92
|
*
|
|
@@ -26,9 +26,9 @@ import { VDOMUpdater } from "../VDOMUpdater";
|
|
|
26
26
|
* ```
|
|
27
27
|
*
|
|
28
28
|
* This directive is created only when a scoped template for the slot's name
|
|
29
|
-
* exists (see {@link VSlotOutletDirective.tryCreate}); otherwise
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* exists (see {@link VSlotOutletDirective.tryCreate}); otherwise plain slot
|
|
30
|
+
* content is moved into place by VStaticSlotOutletDirective, and a `<slot>`
|
|
31
|
+
* with no content at all renders its fallback in the component scope.
|
|
32
32
|
*
|
|
33
33
|
* Rendering happens synchronously in onMount — before the component
|
|
34
34
|
* application would compile the slot's fallback children — by replacing the
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { VNode } from "../VNode";
|
|
2
|
+
import { VBindingsPreparer } from "../VBindingsPreparer";
|
|
3
|
+
import { VDirective } from "./VDirective";
|
|
4
|
+
import { VDOMUpdater } from "../VDOMUpdater";
|
|
5
|
+
/**
|
|
6
|
+
* Renders a static slot outlet: a `<slot>` element inside a component template
|
|
7
|
+
* whose host element received plain slot content from the parent — child
|
|
8
|
+
* nodes for the default slot, or elements carrying `slot="name"`:
|
|
9
|
+
*
|
|
10
|
+
* ```html
|
|
11
|
+
* <!-- component template -->
|
|
12
|
+
* <div v-if="open" class="body"><slot></slot></div>
|
|
13
|
+
*
|
|
14
|
+
* <!-- usage -->
|
|
15
|
+
* <my-dialog :open="show">
|
|
16
|
+
* <my-field :label="title"></my-field>
|
|
17
|
+
* </my-dialog>
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* The slot content is the parent application's own nodes, compiled in the
|
|
21
|
+
* parent scope; it keeps its bindings, listeners and component props only as
|
|
22
|
+
* long as those very nodes are displayed. So the outlet MOVES them into place
|
|
23
|
+
* and never clones them. That is what lets a `<slot>` sit behind a v-if or
|
|
24
|
+
* v-for in the component template: the directive clones its template source,
|
|
25
|
+
* the clone carries a fresh `<slot>`, and the outlet created for that clone
|
|
26
|
+
* moves the live nodes in.
|
|
27
|
+
*
|
|
28
|
+
* Nodes can only be in one place, so when the same slot is rendered more than
|
|
29
|
+
* once (e.g. a `<slot>` inside a v-for), the outlet rendered last receives the
|
|
30
|
+
* content and the earlier ones are left empty. When the outlet holding the
|
|
31
|
+
* content goes away while others remain (its row is removed), the content
|
|
32
|
+
* moves to the last remaining one. For content per row, use a scoped slot
|
|
33
|
+
* (`<template v-slot:name="scope">`), which renders a copy per outlet
|
|
34
|
+
* (VSlotOutletDirective).
|
|
35
|
+
*
|
|
36
|
+
* The component application never compiles the moved nodes: they are placed
|
|
37
|
+
* in onMount, after the parent VNode has taken its snapshot of the children
|
|
38
|
+
* to compile. Components inside them belong to the parent application, which
|
|
39
|
+
* expands them through {@link expandComponents} once they are in the document.
|
|
40
|
+
* When the last outlet goes away (its v-if turns false) the nodes leave with
|
|
41
|
+
* the removed clone and wait there until the next outlet moves them again;
|
|
42
|
+
* they are not destroyed, because they are not this application's to destroy.
|
|
43
|
+
*
|
|
44
|
+
* Created only when the host captured content for the slot's name and no
|
|
45
|
+
* scoped template claims it; otherwise the `<slot>` element renders its
|
|
46
|
+
* fallback children in the component scope.
|
|
47
|
+
*/
|
|
48
|
+
export declare class VStaticSlotOutletDirective implements VDirective {
|
|
49
|
+
#private;
|
|
50
|
+
/**
|
|
51
|
+
* Creates a static slot outlet for the given `<slot>` VNode when the host
|
|
52
|
+
* element captured content for its slot name. Returns undefined when there
|
|
53
|
+
* is none, so the `<slot>` element keeps rendering its fallback content.
|
|
54
|
+
*/
|
|
55
|
+
static tryCreate(vNode: VNode): VStaticSlotOutletDirective | undefined;
|
|
56
|
+
private constructor();
|
|
57
|
+
/**
|
|
58
|
+
* @inheritdoc
|
|
59
|
+
*/
|
|
60
|
+
get name(): string;
|
|
61
|
+
/**
|
|
62
|
+
* @inheritdoc
|
|
63
|
+
*/
|
|
64
|
+
get vNode(): VNode;
|
|
65
|
+
/**
|
|
66
|
+
* @inheritdoc
|
|
67
|
+
*/
|
|
68
|
+
get needsAnchor(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* @inheritdoc
|
|
71
|
+
*/
|
|
72
|
+
get bindingsPreparer(): VBindingsPreparer | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* @inheritdoc
|
|
75
|
+
*/
|
|
76
|
+
get domUpdater(): VDOMUpdater | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* @inheritdoc
|
|
79
|
+
*/
|
|
80
|
+
get templatize(): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* @inheritdoc
|
|
83
|
+
*/
|
|
84
|
+
get dependentIdentifiers(): string[];
|
|
85
|
+
/**
|
|
86
|
+
* @inheritdoc
|
|
87
|
+
*
|
|
88
|
+
* Moves the slot content in place of the `<slot>` element — synchronously
|
|
89
|
+
* during VNode construction, before the component application would
|
|
90
|
+
* compile the slot's fallback children (which the content replaces).
|
|
91
|
+
*/
|
|
92
|
+
get onMount(): (() => void) | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* @inheritdoc
|
|
95
|
+
*/
|
|
96
|
+
get onMounted(): (() => void) | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* @inheritdoc
|
|
99
|
+
*/
|
|
100
|
+
get onUpdate(): (() => void) | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* @inheritdoc
|
|
103
|
+
*/
|
|
104
|
+
get onUpdated(): (() => void) | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* @inheritdoc
|
|
107
|
+
*/
|
|
108
|
+
get onUnmount(): (() => void) | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* @inheritdoc
|
|
111
|
+
*/
|
|
112
|
+
get onUnmounted(): (() => void) | undefined;
|
|
113
|
+
/**
|
|
114
|
+
* @inheritdoc
|
|
115
|
+
*
|
|
116
|
+
* Expands the components in the slot content through the parent
|
|
117
|
+
* application's VNodes. Called by the walk of whoever inserted this
|
|
118
|
+
* outlet into the document (VApplication.mount, v-if, v-for), so the
|
|
119
|
+
* content is connected by now — unless a later outlet took it, in which
|
|
120
|
+
* case that outlet's walk expands it.
|
|
121
|
+
*/
|
|
122
|
+
expandComponents(): void;
|
|
123
|
+
/**
|
|
124
|
+
* @inheritdoc
|
|
125
|
+
*
|
|
126
|
+
* The slot content is the parent application's; nothing to release here.
|
|
127
|
+
*/
|
|
128
|
+
destroy(): void;
|
|
129
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintjamsinc/ichigojs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.82",
|
|
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",
|