@appsemble/preact
Advanced tools
Comparing version 0.13.7 to 0.13.8
@@ -15,2 +15,7 @@ import { BootstrapParams } from '@appsemble/sdk'; | ||
* Mount a Preact component returned by a bootstrap function in the shadow DOM of a block. | ||
* | ||
* @param Component - The Preact component to mount. | ||
* @param messages - Translatable messages to serve (deprecated). | ||
* | ||
* @returns A promise which gets resolved if the component calls `ready()`. | ||
*/ | ||
@@ -25,4 +30,10 @@ export declare function mount(Component: ComponentType<BlockProps>, messages?: { | ||
* A HOC which passes the Appsemble block values to he wrapped Preact component. | ||
* | ||
* @deprecated Use `useBlock()` instead. | ||
* | ||
* @param Component - The Preact componen to wrap. | ||
* | ||
* @returns The wrapper component. | ||
*/ | ||
export declare function withBlock<P extends object>(Component: ComponentType<Omit<BlockProps, keyof P> & P>): ComponentType<P>; | ||
export declare function withBlock<P extends {}>(Component: ComponentType<Omit<BlockProps, keyof P> & P>): ComponentType<P>; | ||
export declare function useBlock(): BlockProps; | ||
@@ -29,0 +40,0 @@ export interface FormattedMessageProps { |
@@ -8,2 +8,7 @@ import { bootstrap as sdkBootstrap } from '@appsemble/sdk'; | ||
* Mount a Preact component returned by a bootstrap function in the shadow DOM of a block. | ||
* | ||
* @param Component - The Preact component to mount. | ||
* @param messages - Translatable messages to serve (deprecated). | ||
* | ||
* @returns A promise which gets resolved if the component calls `ready()`. | ||
*/ | ||
@@ -33,2 +38,8 @@ export function mount(Component, messages) { | ||
* A HOC which passes the Appsemble block values to he wrapped Preact component. | ||
* | ||
* @deprecated Use `useBlock()` instead. | ||
* | ||
* @param Component - The Preact componen to wrap. | ||
* | ||
* @returns The wrapper component. | ||
*/ | ||
@@ -43,3 +54,3 @@ export function withBlock(Component) { | ||
const { messages } = useBlock(); | ||
if (!Object.prototype.hasOwnProperty.call(messages, id)) { | ||
if (!Object.hasOwnProperty.call(messages, id)) { | ||
return h(Fragment, null, | ||
@@ -46,0 +57,0 @@ "Untranslated message ID: ", |
{ | ||
"name": "@appsemble/preact", | ||
"version": "0.13.7", | ||
"version": "0.13.8", | ||
"description": "Build your own blocks using Preact", | ||
@@ -17,3 +17,3 @@ "keywords": [ | ||
], | ||
"homepage": "https://appsemble.dev", | ||
"homepage": "https://appsemble.app", | ||
"bugs": "https://gitlab.com/appsemble/appsemble/issues", | ||
@@ -41,5 +41,5 @@ "repository": { | ||
"peerDependencies": { | ||
"@appsemble/sdk": "0.13.7", | ||
"@appsemble/sdk": "0.13.8", | ||
"preact": "^10.0.4" | ||
} | ||
} |
@@ -15,5 +15,5 @@ # Appsemble Preact SDK | ||
import { bootstrap } from '@appsemble/preact'; | ||
import React from 'react'; | ||
import { h, VNode } from 'preact'; | ||
function MyBlock({ actions }) { | ||
function MyBlock({ actions }): VNode { | ||
return ( | ||
@@ -20,0 +20,0 @@ <button onClick={actions.onClick.dispatch} type="button"> |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
7149
104
1