New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@blockprotocol/hook

Package Overview
Dependencies
Maintainers
7
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blockprotocol/hook - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

dist/types.d.ts

@@ -15,3 +15,3 @@ import { MessageCallback, MessageReturn } from "@blockprotocol/core";

export type HookEmbedderMessages = {};
export type HookError = "INVALID_INPUT" | "NOT_FOUND" | "NOT_IMPLEMENTED";
export type HookError = "INTERNAL_ERROR" | "INVALID_INPUT" | "NOT_FOUND" | "NOT_IMPLEMENTED";
/**

@@ -18,0 +18,0 @@ * @todo Generate these types from the JSON definition, to avoid manually keeping the JSON and types in sync

{
"name": "@blockprotocol/hook",
"version": "0.1.0",
"version": "0.1.1",
"description": "Implementation of the Block Protocol Hook module specification for blocks and embedding applications",

@@ -55,4 +55,4 @@ "keywords": [

"dependencies": {
"@blockprotocol/core": "0.1.0",
"@blockprotocol/graph": "0.1.0"
"@blockprotocol/core": "0.1.1",
"@blockprotocol/graph": "0.2.0"
},

@@ -59,0 +59,0 @@ "devDependencies": {

@@ -58,6 +58,40 @@ ## Block Protocol – Hook Module

### Custom elements
### Custom element example
There are no helpers for custom elements yet.
You can use the `firstUpdate` Lit [lifecycle hook](https://lit.dev/docs/components/lifecycle/#reactive-update-cycle-completing) to request that the embedding application take over control of a DOM node.
```typescript
export class MyBlock extends BlockElementBase {
private hookModule?: HookBlockHandler;
firstUpdated() {
if (!this.hookModule || this.hookModule.destroyed) {
this.hookModule = new HookBlockHandler({
element: this,
});
}
const paragraph = this.renderRoot.querySelector(`#my-hook-paragraph`);
if (!paragraph || !(paragraph instanceof HTMLParagraphElement)) {
throw new Error("No paragraph element for hook module found in element DOM");
}
void this.hookModule.hook({
data: {
node: paragraph,
entityId: this.getBlockEntity()?.metadata.recordId.entityId,
hookId: null,
path: [extractBaseUrl(propertyTypes.description.$id)],
type: "text",
},
});
}
render() {
return html`
<p id="my-hook-paragraph"></p>
`;
}
```
## Embedding applications

@@ -64,0 +98,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc