block-template-html
Advanced tools
Comparing version 0.1.10-canary-20230214141700 to 0.2.0-canary-20230220234726
{ | ||
"description": "Define the properties the block expects to be passed.\nThey will be provided using the blockEntity callback of the graph service.", | ||
"description": "Define the properties the block expects to be passed.\nThey will be provided using the blockEntity callback of the graph module.", | ||
"type": "object", | ||
@@ -4,0 +4,0 @@ "properties": { |
# block-template-html | ||
## 0.1.10-canary-20230214141700 | ||
## 0.2.0-canary-20230220234726 | ||
### Minor Changes | ||
- [#985](https://github.com/blockprotocol/blockprotocol/pull/985) [`16871042`](https://github.com/blockprotocol/blockprotocol/commit/168710424e95d3f5f24d15527814a8067ad1e68b) Thanks [@CiaranMn](https://github.com/CiaranMn)! - rename block protocol 'services' to 'modules' | ||
### Patch Changes | ||
- Updated dependencies [[`a033554f`](https://github.com/blockprotocol/blockprotocol/commit/a033554f5e9c9edfdf9c30ad3e3c346037108c77)]: | ||
- block-scripts@0.1.0-canary-20230214141700 | ||
- Updated dependencies [[`f70d5484`](https://github.com/blockprotocol/blockprotocol/commit/f70d5484a84b1cee96bf37a1e73f56f1baf934ca)]: | ||
- block-scripts@0.1.0-canary-20230220234726 | ||
@@ -10,0 +14,0 @@ ## 0.1.9 |
{ | ||
"name": "block-template-html", | ||
"version": "0.1.10-canary-20230214141700", | ||
"version": "0.2.0-canary-20230220234726", | ||
"description": "Block Protocol block template for an html-based block", | ||
@@ -33,3 +33,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"block-scripts": "0.1.0-canary-20230214141700", | ||
"block-scripts": "0.1.0-canary-20230220234726", | ||
"http-server": "14.1.1", | ||
@@ -36,0 +36,0 @@ "lnk-cli": "1.0.1", |
@@ -11,8 +11,30 @@ # Block Protocol template: HTML | ||
## Step two: write and build a component | ||
## Step two: decide on and build the entity type for your block | ||
A key part of the Block Protocol is the use of types to describe the data your block will work with. | ||
Your block should be associated with an “entity type” which will be used by embedding applications | ||
to understand what sorts of entities can be sent to it (e.g. what properties do they have?). | ||
You can create an entity type on [blockprotocol.org](https://blockprotocol.org) — see [the docs](https://blockprotocol.org/docs/developing-blocks) for a full guide. | ||
Once you have created the type representing the data your block needs, copy its URL for use in the next step. | ||
## Step three: update your block's metadata | ||
1. Change into the folder: `cd path/to/your-block-name` | ||
1. Update `block-metadata.json` and `block-schema.json` to define your block's metadata and the properties it takes. | ||
1. Update the `blockprotocol` metadata object in package.json: | ||
- set `schema` to the URL of the entity type you created in the previous step | ||
- optionally update additional fields which will be used to identify and describe the block when published: | ||
- `displayName`: a friendly display name | ||
- `examples`: an array of example data structures your block would accept and use | ||
- `image`: a preview image showing your block in action (in place of `public/block-preview.png`) | ||
- `icon`: an icon to be associated with your block (in place of `public/omega.svg`) | ||
- `name`: a slugified name for your block (which may differ to the package `name` in package.json) | ||
- this may either be in the format `slug` or `@namespace/slug` where `namespace` is your blockprotocol.org username | ||
## Step four: implement your block's logic and UI | ||
1. Write your block starting in `app.html`. To test it during development: | ||
@@ -27,13 +49,8 @@ | ||
- Bundles the component into a single source file | ||
- Once uploaded to a remote folder, embedding applications can access `block-metadata.json` to load a block and its schema. This file is documented in full [here](https://blockprotocol.org/docs/spec). | ||
- Once uploaded to a remote folder, embedding applications can access `block-metadata.json`. This file is documented in full [here](https://blockprotocol.org/docs/spec). | ||
Please see [the Block Protocol docs](https://blockprotocol.org/docs/developing-blocks) | ||
for help in creating and updating data from your block. | ||
for a fuller explanation of querying, creating and updating entity data from your block. | ||
You can format your code using `yarn format` (or `npm run format`). | ||
N.B. | ||
- JSON schema offers more [validations](https://json-schema.org/draft/2019-09/json-schema-validation.html) than TypeScript. | ||
## Step three: publish your block | ||
@@ -47,4 +64,2 @@ | ||
The Block Protocol does not currently support `externals` when using HTML blocks. | ||
## Debugging | ||
@@ -51,0 +66,0 @@ |
Sorry, the diff of this file is not supported yet
26127
13
69