![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
@blockprotocol/graph
Advanced tools
Implementation of the Block Protocol Graph services specification for blocks and embedding applications
This package supports the forthcoming Block Protocol v0.2, and is not currently intended for public use.
Check back soon for full instructions.
This package implements the Block Protocol Graph service for blocks and embedding applications.
To get started:
yarn add @blockprotocol/graph
or npm install @blockprotocol/graph
To create a GraphBlockHandler, pass the constructor an element in your block, along with any callbacks you wish to register to handle incoming messages.
For React, we provide a useGraphBlockService
hook, which accepts a ref
to an element, and optionally any callbacks
you wish to provide on initialization.
import React from "react";
import { useGraphBlockService } from "@blockprotocol/graph";
export const App = () => {
const blockRef = React.useRef < HTMLDivElement > null;
const { graphService } = useGraphBlockService(blockRef);
return <div ref={blockRef} />;
};
import { BlockElementBase } from "@blockprotocol/graph";
export class MyBlock extends BlockElementBase {}
https://blockprotocol.org/docs will include further usage instructions when 0.2 is released.
To create a GraphEmbedderHandler, pass the constructor:
element
wrapping your blockcallbacks
to respond to messages from the blockblockEntity
blockGraph
linkedAggregations
These starting values should also be passed in a graph
property object, if the block can be passed or assigned properties.
import { GraphEmbedderHandler } from "@blockprotocol/graph";
const graphService = new GraphEmbedderHandler({
blockEntity: { entityId: "123", properties: { name: "Bob" } },
callbacks: {
updateEntity: ({ data }) => updateEntityInYourDatastore(data),
},
element: elementWrappingTheBlock,
});
For React, we provide a useGraphEmbedderService
hook, which accepts a ref
to an element, and optionally any
additional constructor arguments you wish to pass.
import React from "react";
import { useGraphEmbedderService } from "@blockprotocol/graph";
export const App = () => {
const wrappingRef = React.useRef < HTMLDivElement > null;
const blockEntity = { entityId: "123", properties: { name: "Bob" } };
const { graphService } = useGraphEmbedderService(blockRef, {
blockEntity,
});
return (
<div ref={wrappingRef}>
<Block graph={{ blockEntity }} />
</div>
);
};
FAQs
Implementation of the Block Protocol Graph service specification for blocks and embedding applications
The npm package @blockprotocol/graph receives a total of 3,166 weekly downloads. As such, @blockprotocol/graph popularity was classified as popular.
We found that @blockprotocol/graph demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.