--[=[
	Creates a new function which will return an observable that, given the props
	in question, will construct a new instance and assign all props. This is the
	equivalent of a pipe-able Rx command.

	```lua
	local render = Blend.New "ScreenGui" {
		Parent = game.Players.LocalPlayer.PlayerGui;

		Blend.New "Frame" {
			Size = UDim2.new(1, 0, 1, 0);
			BackgroundTransparency = 0.5;
		};
	};

	maid:GiveTask(render:Subscribe(function(gui)
		print(gui)
	end))
	```

	@param className string
	@return (props: { [string]: any; }) -> Observable<Instance>
]=]

function Blend.New(className)
	assert(type(className) == "string", "Bad className")

	local defaults = BlendDefaultProps[className]

	return function(props)
		return Observable.new(function(sub)
			local instance = Instance.new(className)

			if defaults then
				for key, value in pairs(defaults) do
					instance[key] = value
				end
			end

			local maid = Blend.mount(instance, props)
			maid:GiveTask(instance)

			sub:Fire(instance)

			return maid
		end)
	end
end
