@viewfly/core 0.0.1-alpha.14 → 0.0.1-alpha.16
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/bundles/index.esm.js +41 -58
- package/bundles/index.js +41 -58
- package/bundles/model/component.d.ts +5 -5
- package/bundles/model/jsx-element.d.ts +1 -1
- package/jsx-runtime/index.d.ts +22 -0
- package/jsx-runtime/package.json +5 -0
- package/package.json +2 -2
- package/jsx-dev-runtime.js +0 -8
- package/jsx-runtime.d.ts +0 -16
- /package/{jsx-runtime.js → jsx-runtime/index.esm.js} +0 -0
- /package/{jsx-runtime.umd.js → jsx-runtime/index.js} +0 -0
package/bundles/index.esm.js
CHANGED
|
@@ -44,23 +44,18 @@ function __metadata(metadataKey, metadataValue) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
const componentSetupStack = [];
|
|
47
|
-
const
|
|
48
|
-
const derivedStack = [];
|
|
47
|
+
const signalDepsStack = [];
|
|
49
48
|
const componentErrorFn = makeError('component');
|
|
50
49
|
function getSetupContext(need = true) {
|
|
51
50
|
const current = componentSetupStack[componentSetupStack.length - 1];
|
|
52
51
|
if (!current && need) {
|
|
53
52
|
// 防止因外部捕获异常引引起的缓存未清理的问题
|
|
54
|
-
componentRendingStack.pop();
|
|
55
53
|
throw componentErrorFn('cannot be called outside the component!');
|
|
56
54
|
}
|
|
57
55
|
return current;
|
|
58
56
|
}
|
|
59
|
-
function
|
|
60
|
-
return
|
|
61
|
-
}
|
|
62
|
-
function getDerivedContext() {
|
|
63
|
-
return derivedStack[derivedStack.length - 1];
|
|
57
|
+
function getSignalDepsContext() {
|
|
58
|
+
return signalDepsStack[signalDepsStack.length - 1];
|
|
64
59
|
}
|
|
65
60
|
class JSXComponent {
|
|
66
61
|
constructor(createInstance) {
|
|
@@ -99,9 +94,7 @@ class Component extends ReflectiveInjector {
|
|
|
99
94
|
}
|
|
100
95
|
addProvide(providers) {
|
|
101
96
|
providers = Array.isArray(providers) ? providers : [providers];
|
|
102
|
-
providers.
|
|
103
|
-
this.normalizedProviders.push(normalizeProvider(p));
|
|
104
|
-
});
|
|
97
|
+
this.normalizedProviders.unshift(...providers.map(i => normalizeProvider(i)));
|
|
105
98
|
}
|
|
106
99
|
init() {
|
|
107
100
|
const self = this;
|
|
@@ -116,9 +109,6 @@ class Component extends ReflectiveInjector {
|
|
|
116
109
|
if (isSetup) {
|
|
117
110
|
componentSetupStack.pop();
|
|
118
111
|
}
|
|
119
|
-
if (isRending) {
|
|
120
|
-
componentRendingStack.pop();
|
|
121
|
-
}
|
|
122
112
|
throw componentErrorFn('component props is readonly!');
|
|
123
113
|
}
|
|
124
114
|
});
|
|
@@ -127,19 +117,22 @@ class Component extends ReflectiveInjector {
|
|
|
127
117
|
const render = this.setup(props);
|
|
128
118
|
isSetup = false;
|
|
129
119
|
componentSetupStack.pop();
|
|
130
|
-
|
|
131
|
-
let isRending = true;
|
|
120
|
+
signalDepsStack.push([]);
|
|
132
121
|
const template = render();
|
|
133
|
-
|
|
134
|
-
|
|
122
|
+
const deps = signalDepsStack.pop();
|
|
123
|
+
this.unWatch = useEffect(deps, () => {
|
|
124
|
+
this.markAsDirtied();
|
|
125
|
+
});
|
|
135
126
|
return {
|
|
136
127
|
template,
|
|
137
128
|
render: () => {
|
|
138
|
-
|
|
139
|
-
|
|
129
|
+
this.unWatch();
|
|
130
|
+
signalDepsStack.push([]);
|
|
140
131
|
const template = render();
|
|
141
|
-
|
|
142
|
-
|
|
132
|
+
const deps = signalDepsStack.pop();
|
|
133
|
+
this.unWatch = useEffect(deps, () => {
|
|
134
|
+
this.markAsDirtied();
|
|
135
|
+
});
|
|
143
136
|
return template;
|
|
144
137
|
}
|
|
145
138
|
};
|
|
@@ -149,6 +142,9 @@ class Component extends ReflectiveInjector {
|
|
|
149
142
|
this.markAsChanged();
|
|
150
143
|
}
|
|
151
144
|
markAsChanged() {
|
|
145
|
+
if (this._changed) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
152
148
|
this._changed = true;
|
|
153
149
|
this.parentComponent.markAsChanged();
|
|
154
150
|
}
|
|
@@ -179,6 +175,7 @@ class Component extends ReflectiveInjector {
|
|
|
179
175
|
}
|
|
180
176
|
}
|
|
181
177
|
destroy() {
|
|
178
|
+
this.unWatch();
|
|
182
179
|
this.updatedDestroyCallbacks.forEach(fn => {
|
|
183
180
|
fn();
|
|
184
181
|
});
|
|
@@ -370,18 +367,10 @@ const depsKey = Symbol('deps');
|
|
|
370
367
|
* }
|
|
371
368
|
*/
|
|
372
369
|
function useSignal(state) {
|
|
373
|
-
const usedComponents = new Set();
|
|
374
370
|
function signal() {
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
derivedContext.push(signal);
|
|
379
|
-
}
|
|
380
|
-
if (component && !usedComponents.has(component)) {
|
|
381
|
-
usedComponents.add(component);
|
|
382
|
-
component.destroyCallbacks.push(() => {
|
|
383
|
-
usedComponents.delete(component);
|
|
384
|
-
});
|
|
371
|
+
const depsContext = getSignalDepsContext();
|
|
372
|
+
if (depsContext) {
|
|
373
|
+
depsContext.push(signal);
|
|
385
374
|
}
|
|
386
375
|
return state;
|
|
387
376
|
}
|
|
@@ -390,9 +379,6 @@ function useSignal(state) {
|
|
|
390
379
|
return;
|
|
391
380
|
}
|
|
392
381
|
state = newState;
|
|
393
|
-
for (const component of usedComponents) {
|
|
394
|
-
component.markAsDirtied();
|
|
395
|
-
}
|
|
396
382
|
for (const fn of signal[depsKey]) {
|
|
397
383
|
fn();
|
|
398
384
|
}
|
|
@@ -409,9 +395,9 @@ function useSignal(state) {
|
|
|
409
395
|
*/
|
|
410
396
|
function useDerived(callback, isContinue) {
|
|
411
397
|
const deps = [];
|
|
412
|
-
|
|
398
|
+
signalDepsStack.push(deps);
|
|
413
399
|
const data = callback();
|
|
414
|
-
|
|
400
|
+
signalDepsStack.pop();
|
|
415
401
|
const signal = useSignal(data);
|
|
416
402
|
if (deps.length) {
|
|
417
403
|
const unListen = useEffect(deps, () => {
|
|
@@ -482,9 +468,10 @@ function inject(token, notFoundValue, flags) {
|
|
|
482
468
|
return component.parentInjector.get(token, notFoundValue, flags);
|
|
483
469
|
}
|
|
484
470
|
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
|
|
471
|
+
const Fragment = function Fragment(props) {
|
|
472
|
+
return () => {
|
|
473
|
+
return props.children;
|
|
474
|
+
};
|
|
488
475
|
};
|
|
489
476
|
function jsx(setup, config, key) {
|
|
490
477
|
if (typeof setup === 'string') {
|
|
@@ -636,10 +623,12 @@ let Renderer = class Renderer {
|
|
|
636
623
|
reconcile(component, context) {
|
|
637
624
|
if (component.dirty) {
|
|
638
625
|
this.applyChanges(component, context);
|
|
626
|
+
component.rendered();
|
|
639
627
|
}
|
|
640
628
|
else if (component.changed) {
|
|
641
629
|
const atom = this.componentAtomCaches.get(component).atom.child;
|
|
642
630
|
this.reconcileElement(atom, context);
|
|
631
|
+
component.rendered();
|
|
643
632
|
}
|
|
644
633
|
else {
|
|
645
634
|
const prevSibling = this.getPrevSibling(component);
|
|
@@ -702,7 +691,6 @@ let Renderer = class Renderer {
|
|
|
702
691
|
atom.child = null;
|
|
703
692
|
}
|
|
704
693
|
this.diff(atom.child, diffAtom, context, 0, 0);
|
|
705
|
-
component.rendered();
|
|
706
694
|
}
|
|
707
695
|
diff(newAtom, oldAtom, context, expectIndex, index) {
|
|
708
696
|
const oldChildren = [];
|
|
@@ -925,10 +913,14 @@ let Renderer = class Renderer {
|
|
|
925
913
|
}
|
|
926
914
|
createChainByComponentFactory(context, factory, parent) {
|
|
927
915
|
const component = factory.createInstance(context);
|
|
928
|
-
if (component.setup === Fragment) {
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
916
|
+
// if (component.setup === Fragment) {
|
|
917
|
+
// const children = component.props.children
|
|
918
|
+
// return this.createChainByChildren(
|
|
919
|
+
// component,
|
|
920
|
+
// Array.isArray(children) ? children : [children],
|
|
921
|
+
// parent
|
|
922
|
+
// )
|
|
923
|
+
// }
|
|
932
924
|
return new Atom(component, parent);
|
|
933
925
|
}
|
|
934
926
|
createChainByJSXElement(context, element, parent) {
|
|
@@ -952,12 +944,7 @@ let Renderer = class Renderer {
|
|
|
952
944
|
}
|
|
953
945
|
if (item instanceof JSXComponent) {
|
|
954
946
|
const childAtom = this.createChainByComponentFactory(context, item, parent);
|
|
955
|
-
|
|
956
|
-
atoms.push(...childAtom);
|
|
957
|
-
}
|
|
958
|
-
else {
|
|
959
|
-
atoms.push(childAtom);
|
|
960
|
-
}
|
|
947
|
+
atoms.push(childAtom);
|
|
961
948
|
continue;
|
|
962
949
|
}
|
|
963
950
|
if (typeof item === 'string' && item.length) {
|
|
@@ -975,12 +962,8 @@ let Renderer = class Renderer {
|
|
|
975
962
|
return atoms;
|
|
976
963
|
}
|
|
977
964
|
linkTemplate(template, component, parent) {
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
this.createChainByJSXElement(component, template, parent) :
|
|
981
|
-
this.createChainByComponentFactory(component, template, parent);
|
|
982
|
-
this.link(parent, Array.isArray(child) ? child : [child]);
|
|
983
|
-
}
|
|
965
|
+
const children = Array.isArray(template) ? template : [template];
|
|
966
|
+
this.link(parent, this.createChainByChildren(component, children, parent));
|
|
984
967
|
}
|
|
985
968
|
link(parent, children) {
|
|
986
969
|
for (let i = 1; i < children.length; i++) {
|
package/bundles/index.js
CHANGED
|
@@ -45,23 +45,18 @@ function __metadata(metadataKey, metadataValue) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
const componentSetupStack = [];
|
|
48
|
-
const
|
|
49
|
-
const derivedStack = [];
|
|
48
|
+
const signalDepsStack = [];
|
|
50
49
|
const componentErrorFn = makeError('component');
|
|
51
50
|
function getSetupContext(need = true) {
|
|
52
51
|
const current = componentSetupStack[componentSetupStack.length - 1];
|
|
53
52
|
if (!current && need) {
|
|
54
53
|
// 防止因外部捕获异常引引起的缓存未清理的问题
|
|
55
|
-
componentRendingStack.pop();
|
|
56
54
|
throw componentErrorFn('cannot be called outside the component!');
|
|
57
55
|
}
|
|
58
56
|
return current;
|
|
59
57
|
}
|
|
60
|
-
function
|
|
61
|
-
return
|
|
62
|
-
}
|
|
63
|
-
function getDerivedContext() {
|
|
64
|
-
return derivedStack[derivedStack.length - 1];
|
|
58
|
+
function getSignalDepsContext() {
|
|
59
|
+
return signalDepsStack[signalDepsStack.length - 1];
|
|
65
60
|
}
|
|
66
61
|
class JSXComponent {
|
|
67
62
|
constructor(createInstance) {
|
|
@@ -100,9 +95,7 @@ class Component extends di.ReflectiveInjector {
|
|
|
100
95
|
}
|
|
101
96
|
addProvide(providers) {
|
|
102
97
|
providers = Array.isArray(providers) ? providers : [providers];
|
|
103
|
-
providers.
|
|
104
|
-
this.normalizedProviders.push(di.normalizeProvider(p));
|
|
105
|
-
});
|
|
98
|
+
this.normalizedProviders.unshift(...providers.map(i => di.normalizeProvider(i)));
|
|
106
99
|
}
|
|
107
100
|
init() {
|
|
108
101
|
const self = this;
|
|
@@ -117,9 +110,6 @@ class Component extends di.ReflectiveInjector {
|
|
|
117
110
|
if (isSetup) {
|
|
118
111
|
componentSetupStack.pop();
|
|
119
112
|
}
|
|
120
|
-
if (isRending) {
|
|
121
|
-
componentRendingStack.pop();
|
|
122
|
-
}
|
|
123
113
|
throw componentErrorFn('component props is readonly!');
|
|
124
114
|
}
|
|
125
115
|
});
|
|
@@ -128,19 +118,22 @@ class Component extends di.ReflectiveInjector {
|
|
|
128
118
|
const render = this.setup(props);
|
|
129
119
|
isSetup = false;
|
|
130
120
|
componentSetupStack.pop();
|
|
131
|
-
|
|
132
|
-
let isRending = true;
|
|
121
|
+
signalDepsStack.push([]);
|
|
133
122
|
const template = render();
|
|
134
|
-
|
|
135
|
-
|
|
123
|
+
const deps = signalDepsStack.pop();
|
|
124
|
+
this.unWatch = useEffect(deps, () => {
|
|
125
|
+
this.markAsDirtied();
|
|
126
|
+
});
|
|
136
127
|
return {
|
|
137
128
|
template,
|
|
138
129
|
render: () => {
|
|
139
|
-
|
|
140
|
-
|
|
130
|
+
this.unWatch();
|
|
131
|
+
signalDepsStack.push([]);
|
|
141
132
|
const template = render();
|
|
142
|
-
|
|
143
|
-
|
|
133
|
+
const deps = signalDepsStack.pop();
|
|
134
|
+
this.unWatch = useEffect(deps, () => {
|
|
135
|
+
this.markAsDirtied();
|
|
136
|
+
});
|
|
144
137
|
return template;
|
|
145
138
|
}
|
|
146
139
|
};
|
|
@@ -150,6 +143,9 @@ class Component extends di.ReflectiveInjector {
|
|
|
150
143
|
this.markAsChanged();
|
|
151
144
|
}
|
|
152
145
|
markAsChanged() {
|
|
146
|
+
if (this._changed) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
153
149
|
this._changed = true;
|
|
154
150
|
this.parentComponent.markAsChanged();
|
|
155
151
|
}
|
|
@@ -180,6 +176,7 @@ class Component extends di.ReflectiveInjector {
|
|
|
180
176
|
}
|
|
181
177
|
}
|
|
182
178
|
destroy() {
|
|
179
|
+
this.unWatch();
|
|
183
180
|
this.updatedDestroyCallbacks.forEach(fn => {
|
|
184
181
|
fn();
|
|
185
182
|
});
|
|
@@ -371,18 +368,10 @@ const depsKey = Symbol('deps');
|
|
|
371
368
|
* }
|
|
372
369
|
*/
|
|
373
370
|
function useSignal(state) {
|
|
374
|
-
const usedComponents = new Set();
|
|
375
371
|
function signal() {
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
derivedContext.push(signal);
|
|
380
|
-
}
|
|
381
|
-
if (component && !usedComponents.has(component)) {
|
|
382
|
-
usedComponents.add(component);
|
|
383
|
-
component.destroyCallbacks.push(() => {
|
|
384
|
-
usedComponents.delete(component);
|
|
385
|
-
});
|
|
372
|
+
const depsContext = getSignalDepsContext();
|
|
373
|
+
if (depsContext) {
|
|
374
|
+
depsContext.push(signal);
|
|
386
375
|
}
|
|
387
376
|
return state;
|
|
388
377
|
}
|
|
@@ -391,9 +380,6 @@ function useSignal(state) {
|
|
|
391
380
|
return;
|
|
392
381
|
}
|
|
393
382
|
state = newState;
|
|
394
|
-
for (const component of usedComponents) {
|
|
395
|
-
component.markAsDirtied();
|
|
396
|
-
}
|
|
397
383
|
for (const fn of signal[depsKey]) {
|
|
398
384
|
fn();
|
|
399
385
|
}
|
|
@@ -410,9 +396,9 @@ function useSignal(state) {
|
|
|
410
396
|
*/
|
|
411
397
|
function useDerived(callback, isContinue) {
|
|
412
398
|
const deps = [];
|
|
413
|
-
|
|
399
|
+
signalDepsStack.push(deps);
|
|
414
400
|
const data = callback();
|
|
415
|
-
|
|
401
|
+
signalDepsStack.pop();
|
|
416
402
|
const signal = useSignal(data);
|
|
417
403
|
if (deps.length) {
|
|
418
404
|
const unListen = useEffect(deps, () => {
|
|
@@ -483,9 +469,10 @@ function inject(token, notFoundValue, flags) {
|
|
|
483
469
|
return component.parentInjector.get(token, notFoundValue, flags);
|
|
484
470
|
}
|
|
485
471
|
|
|
486
|
-
const
|
|
487
|
-
|
|
488
|
-
|
|
472
|
+
const Fragment = function Fragment(props) {
|
|
473
|
+
return () => {
|
|
474
|
+
return props.children;
|
|
475
|
+
};
|
|
489
476
|
};
|
|
490
477
|
function jsx(setup, config, key) {
|
|
491
478
|
if (typeof setup === 'string') {
|
|
@@ -637,10 +624,12 @@ exports.Renderer = class Renderer {
|
|
|
637
624
|
reconcile(component, context) {
|
|
638
625
|
if (component.dirty) {
|
|
639
626
|
this.applyChanges(component, context);
|
|
627
|
+
component.rendered();
|
|
640
628
|
}
|
|
641
629
|
else if (component.changed) {
|
|
642
630
|
const atom = this.componentAtomCaches.get(component).atom.child;
|
|
643
631
|
this.reconcileElement(atom, context);
|
|
632
|
+
component.rendered();
|
|
644
633
|
}
|
|
645
634
|
else {
|
|
646
635
|
const prevSibling = this.getPrevSibling(component);
|
|
@@ -703,7 +692,6 @@ exports.Renderer = class Renderer {
|
|
|
703
692
|
atom.child = null;
|
|
704
693
|
}
|
|
705
694
|
this.diff(atom.child, diffAtom, context, 0, 0);
|
|
706
|
-
component.rendered();
|
|
707
695
|
}
|
|
708
696
|
diff(newAtom, oldAtom, context, expectIndex, index) {
|
|
709
697
|
const oldChildren = [];
|
|
@@ -926,10 +914,14 @@ exports.Renderer = class Renderer {
|
|
|
926
914
|
}
|
|
927
915
|
createChainByComponentFactory(context, factory, parent) {
|
|
928
916
|
const component = factory.createInstance(context);
|
|
929
|
-
if (component.setup === Fragment) {
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
917
|
+
// if (component.setup === Fragment) {
|
|
918
|
+
// const children = component.props.children
|
|
919
|
+
// return this.createChainByChildren(
|
|
920
|
+
// component,
|
|
921
|
+
// Array.isArray(children) ? children : [children],
|
|
922
|
+
// parent
|
|
923
|
+
// )
|
|
924
|
+
// }
|
|
933
925
|
return new Atom(component, parent);
|
|
934
926
|
}
|
|
935
927
|
createChainByJSXElement(context, element, parent) {
|
|
@@ -953,12 +945,7 @@ exports.Renderer = class Renderer {
|
|
|
953
945
|
}
|
|
954
946
|
if (item instanceof JSXComponent) {
|
|
955
947
|
const childAtom = this.createChainByComponentFactory(context, item, parent);
|
|
956
|
-
|
|
957
|
-
atoms.push(...childAtom);
|
|
958
|
-
}
|
|
959
|
-
else {
|
|
960
|
-
atoms.push(childAtom);
|
|
961
|
-
}
|
|
948
|
+
atoms.push(childAtom);
|
|
962
949
|
continue;
|
|
963
950
|
}
|
|
964
951
|
if (typeof item === 'string' && item.length) {
|
|
@@ -976,12 +963,8 @@ exports.Renderer = class Renderer {
|
|
|
976
963
|
return atoms;
|
|
977
964
|
}
|
|
978
965
|
linkTemplate(template, component, parent) {
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
this.createChainByJSXElement(component, template, parent) :
|
|
982
|
-
this.createChainByComponentFactory(component, template, parent);
|
|
983
|
-
this.link(parent, Array.isArray(child) ? child : [child]);
|
|
984
|
-
}
|
|
966
|
+
const children = Array.isArray(template) ? template : [template];
|
|
967
|
+
this.link(parent, this.createChainByChildren(component, children, parent));
|
|
985
968
|
}
|
|
986
969
|
link(parent, children) {
|
|
987
970
|
for (let i = 1; i < children.length; i++) {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Provider, ReflectiveInjector, AbstractType, Type, InjectionToken, InjectFlags, Injector } from '@tanbo/di';
|
|
2
|
-
import { Props,
|
|
2
|
+
import { Props, Key, JSXTypeof, JSXChildNode } from './jsx-element';
|
|
3
3
|
export declare class JSXComponent {
|
|
4
4
|
createInstance: (injector: Component) => Component;
|
|
5
5
|
constructor(createInstance: (injector: Component) => Component);
|
|
6
6
|
}
|
|
7
|
-
export type JSXTemplate = JSXElement | JSXComponent | null | void;
|
|
8
7
|
export interface ComponentSetup<T extends Props<any> = Props<any>> {
|
|
9
|
-
(props?: T): () =>
|
|
8
|
+
(props?: T): () => JSXChildNode;
|
|
10
9
|
}
|
|
11
10
|
/**
|
|
12
11
|
* Viewfly 组件管理类,用于管理组件的生命周期,上下文等
|
|
@@ -27,13 +26,14 @@ export declare class Component extends ReflectiveInjector implements JSXTypeof {
|
|
|
27
26
|
private parentComponent;
|
|
28
27
|
private updatedDestroyCallbacks;
|
|
29
28
|
private propsChangedDestroyCallbacks;
|
|
29
|
+
private unWatch?;
|
|
30
30
|
private isFirstRending;
|
|
31
31
|
constructor(context: Injector, setup: ComponentSetup, props: Props<any>, key?: Key | undefined);
|
|
32
32
|
is(target: JSXTypeof): boolean;
|
|
33
33
|
addProvide<T>(providers: Provider<T> | Provider<T>[]): void;
|
|
34
34
|
init(): {
|
|
35
|
-
template:
|
|
36
|
-
render: () =>
|
|
35
|
+
template: JSXChildNode;
|
|
36
|
+
render: () => JSXChildNode;
|
|
37
37
|
};
|
|
38
38
|
markAsDirtied(): void;
|
|
39
39
|
markAsChanged(): void;
|
|
@@ -5,7 +5,7 @@ export interface Props<T = JSXChildNode | JSXChildNode[]> {
|
|
|
5
5
|
[key: string]: any;
|
|
6
6
|
[key: symbol]: any;
|
|
7
7
|
}
|
|
8
|
-
export declare const Fragment: () =>
|
|
8
|
+
export declare const Fragment: (props: Props) => () => JSXChildNode | JSXChildNode[];
|
|
9
9
|
export type Key = number | string;
|
|
10
10
|
export declare function jsx<T extends JSXChildNode>(name: string, config: Props<T>, key?: Key): JSXElement;
|
|
11
11
|
export declare function jsx<T extends JSXChildNode>(setup: ComponentSetup, config: Props<T>, key?: Key): JSXComponent;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { JSXElement, Ref, jsx, jsxs, Fragment } from '@viewfly/core'
|
|
2
|
+
import type { NativeElements } from '@viewfly/platform-browser'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* JSX namespace for usage with @jsxImportsSource directive
|
|
6
|
+
* when ts compilerOptions.jsx is 'react-jsx'
|
|
7
|
+
* https://www.typescriptlang.org/tsconfig#jsxImportSource
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { jsx, jsxs, Fragment }
|
|
11
|
+
|
|
12
|
+
export namespace JSX {
|
|
13
|
+
export interface Element extends JSXElement {
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface IntrinsicElements extends NativeElements {
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface IntrinsicAttributes {
|
|
20
|
+
ref?: Ref<any>
|
|
21
|
+
}
|
|
22
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viewfly/core",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.16",
|
|
4
4
|
"description": "Viewfly is a simple and easy-to-use JavaScript framework with an intuitive development experience.",
|
|
5
5
|
"main": "./bundles/index.js",
|
|
6
6
|
"module": "./bundles/index.esm.js",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"bugs": {
|
|
35
35
|
"url": "https://github.com/viewfly/viewfly.git/issues"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "c87e571f0caf71e5bb99183643388f9adb4501c1"
|
|
38
38
|
}
|
package/jsx-dev-runtime.js
DELETED
package/jsx-runtime.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment, JSXElement } from '@viewfly/core'
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
jsxs,
|
|
5
|
-
jsx,
|
|
6
|
-
Fragment
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
declare namespace JSX {
|
|
10
|
-
interface IntrinsicElements {
|
|
11
|
-
[elemName: string]: JSXElement
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface Element extends JSXElement {
|
|
15
|
-
}
|
|
16
|
-
}
|
|
File without changes
|
|
File without changes
|