leaner 0.1.2 → 0.1.3
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/core.js +16 -4
- package/dist/web.js +12 -2
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -161,7 +161,7 @@ function stateGetterGet( target, prop ) {
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
if ( prop === Symbol.toPrimitive )
|
|
164
|
-
throw new
|
|
164
|
+
throw new TypeError( 'Using a state getter as a primitive value is not allowed' );
|
|
165
165
|
|
|
166
166
|
return createChildStateGetterProxy( target, prop );
|
|
167
167
|
}
|
|
@@ -329,8 +329,8 @@ function computedGetterGet( target, prop ) {
|
|
|
329
329
|
};
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
-
if ( prop
|
|
333
|
-
throw new
|
|
332
|
+
if ( prop === Symbol.toPrimitive )
|
|
333
|
+
throw new TypeError( 'Using a computed getter as a primitive value is not allowed' );
|
|
334
334
|
|
|
335
335
|
return createChildComputedProxy( target, prop );
|
|
336
336
|
}
|
|
@@ -623,4 +623,16 @@ function transform( value, callback ) {
|
|
|
623
623
|
return callback( value );
|
|
624
624
|
}
|
|
625
625
|
|
|
626
|
-
|
|
626
|
+
function get( value ) {
|
|
627
|
+
if ( typeof value == 'function' )
|
|
628
|
+
return value();
|
|
629
|
+
return value;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
function getter( value ) {
|
|
633
|
+
if ( typeof value == 'function' )
|
|
634
|
+
return value;
|
|
635
|
+
return constant( value );
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
export { computed, constant, destroyScope, effect, get, getter, mutate, reactive, schedule, state, transform, watch, withScope };
|
package/dist/web.js
CHANGED
|
@@ -720,13 +720,20 @@ function make( template ) {
|
|
|
720
720
|
|
|
721
721
|
const element = document.createElement( tag );
|
|
722
722
|
|
|
723
|
+
let properties = null;
|
|
724
|
+
|
|
723
725
|
let i = 1;
|
|
724
|
-
if ( i < template.length && isPlainObject( template[ i ] ) )
|
|
725
|
-
|
|
726
|
+
if ( i < template.length && isPlainObject( template[ i ] ) ) {
|
|
727
|
+
properties = template[ i++ ];
|
|
728
|
+
setElementProperties( element, properties );
|
|
729
|
+
}
|
|
726
730
|
|
|
727
731
|
for ( ; i < template.length; i++ )
|
|
728
732
|
appendNode( make( template[ i ] ), element );
|
|
729
733
|
|
|
734
|
+
if ( properties != null && 'value' in properties )
|
|
735
|
+
setElementProperty( element, 'value', properties.value );
|
|
736
|
+
|
|
730
737
|
return element;
|
|
731
738
|
}
|
|
732
739
|
|
|
@@ -760,6 +767,9 @@ function setElementProperties( element, properties ) {
|
|
|
760
767
|
case 'ref':
|
|
761
768
|
createRef( value, element );
|
|
762
769
|
break;
|
|
770
|
+
case 'value':
|
|
771
|
+
// this property must be set after other properties are set and children are appended
|
|
772
|
+
break;
|
|
763
773
|
default:
|
|
764
774
|
setElementProperty( element, key, value );
|
|
765
775
|
break;
|