Skip to content

Commit b0ac0cb

Browse files
authored
H-5541: Move blocks to labs (#85)
* feat: move to labs * feat; remove .turbo
1 parent a8a8c8d commit b0ac0cb

File tree

518 files changed

+30477
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

518 files changed

+30477
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
dist/
1313
node_modules/
1414
test_artifacts/
15+
.turbo
1516

1617
### Rust template
1718
# Generated by Cargo

blocks/README.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
[github_banner]: https://hash.dev/?utm_medium=organic&utm_source=github_readme_hash-repo_blocks
2+
[github_star]: https://github.com/hashintel/hash/tree/main/blocks#
3+
[`address`]: address
4+
[`ai-chat`]: ai-chat
5+
[`ai-image`]: ai-image
6+
[`ai-text`]: ai-text
7+
[`callout`]: callout
8+
[`chart`]: chart
9+
[`code`]: code
10+
[`countdown`]: countdown
11+
[`divider`]: divider
12+
[`embed`]: embed
13+
[`faq`]: faq
14+
[`heading`]: heading
15+
[`how-to`]: how-to
16+
[`image`]: image
17+
[`kanban-board`]: kanban-board
18+
[`minesweeper`]: minesweeper
19+
[`paragraph`]: paragraph
20+
[`person`]: person
21+
[`shuffle`]: shuffle
22+
[`table`]: table
23+
[`timer`]: timer
24+
[`video`]: video
25+
26+
[![github_banner](https://hash.ai/cdn-cgi/imagedelivery/EipKtqu98OotgfhvKf6Eew/5a38c5f3-6474-4b6c-71e6-ecf01914f000/github)][github_banner]
27+
28+
[![github_star](https://img.shields.io/github/stars/hashintel/hash?label=Star%20on%20GitHub&style=social)][github_star]
29+
30+
# Blocks
31+
32+
HASH is built around the open [Block Protocol](https://blockprotocol.org) ([@blockprotocol/blockprotocol](https://github.com/blockprotocol/blockprotocol) on GitHub). The current version of HASH is based upon an adapted version of the [Block Protocol Graph Module](https://blockprotocol.org/spec/graph) which will be formalized at a later date.
33+
34+
Planned features such as [pages](https://hash.ai/guide/pages) and [apps](https://hash.ai/guide/apps) more directly utilize the [blocks](https://hash.ai/guide/pages/blocks) found in this directory, which contains the source code for all public HASH-developed [Block Protocol](https://blockprotocol.org/) blocks.
35+
36+
## HASH Blocks
37+
38+
You can preview most HASH blocks on the [`@hash`](https://blockprotocol.org/@hash/blocks) page in the [Þ Hub](https://blockprotocol.org/hub), and direct links are provided below.
39+
40+
| Directory | Spec Target | Status | Þ Hub URL | Description |
41+
| ---------------- | ----------- | -------------- | -------------------------------------------------------------------------------- | ----------- |
42+
| [`address`] | 0.3 | **Maintained** | [@hash/blocks/address](https://blockprotocol.org/@hash/blocks/address) | |
43+
| [`ai-chat`] | 0.3 | **Maintained** | [@hash/blocks/ai-chat](https://blockprotocol.org/@hash/blocks/ai-chat) | |
44+
| [`ai-image`] | 0.3 | **Maintained** | [@hash/blocks/ai-image](https://blockprotocol.org/@hash/blocks/ai-image) | |
45+
| [`ai-text`] | 0.3 | **Maintained** | [@hash/blocks/ai-text](https://blockprotocol.org/@hash/blocks/ai-text) | |
46+
| [`callout`] | 0.3 | **Maintained** | [@hash/blocks/callout](https://blockprotocol.org/@hash/blocks/callout) | |
47+
| [`chart`] | 0.1 | **Maintained** | [@hash/blocks/callout](https://blockprotocol.org/@hash/blocks/chart) | |
48+
| [`code`] | 0.3 | **Maintained** | [@hash/blocks/code](https://blockprotocol.org/@hash/blocks/code) | |
49+
| [`countdown`] | 0.3 | **Maintained** | [@hash/blocks/countdown](https://blockprotocol.org/@hash/blocks/countdown) | |
50+
| [`divider`] | 0.3 | **Maintained** | [@hash/blocks/divider](https://blockprotocol.org/@hash/blocks/divider) | |
51+
| [`embed`] | 0.1 | Pending Update | | |
52+
| [`faq`] | 0.3 | **Maintained** | [@hash/blocks/faq](https://blockprotocol.org/@hash/blocks/faq) | |
53+
| [`heading`] | 0.3 | **Maintained** | [@hash/blocks/heading](https://blockprotocol.org/@hash/blocks/heading) | |
54+
| [`how-to`] | 0.3 | **Maintained** | [@hash/blocks/how-to](https://blockprotocol.org/@hash/blocks/how-to) | |
55+
| [`image`] | 0.3 | **Maintained** | [@hash/blocks/image](https://blockprotocol.org/@hash/blocks/image) | |
56+
| [`kanban-board`] | 0.3 | **Maintained** | [@hash/blocks/kanban-board](https://blockprotocol.org/@hash/blocks/kanban-board) | |
57+
| [`minesweeper`] | 0.3 | **Maintained** | [@hash/blocks/minesweeper](https://blockprotocol.org/@hash/blocks/minesweeper) | |
58+
| [`paragraph`] | 0.3 | **Maintained** | [@hash/blocks/paragraph](https://blockprotocol.org/@hash/blocks/paragraph) | |
59+
| [`person`] | 0.2 | Pending Update | | |
60+
| [`shuffle`] | 0.3 | **Maintained** | [@hash/blocks/shuffle](https://blockprotocol.org/@hash/blocks/shuffle) | |
61+
| [`table`] | 0.3 | **Maintained** | [@hash/blocks/table](https://blockprotocol.org/@hash/blocks/table) | |
62+
| [`timer`] | 0.3 | **Maintained** | [@hash/blocks/timer](https://blockprotocol.org/@hash/blocks/timer) | |
63+
| [`video`] | 0.3 | **Maintained** | [@hash/blocks/video](https://blockprotocol.org/@hash/blocks/video) | |
64+
65+
**Please note:** this table/directory contains HASH-developed blocks which are (or were) published to the [Þ Hub](https://blockprotocol.org/hub) under the official `@hash` namespace. This reflects neither the full extent of available Þ blocks, nor even those originally developed by HASH. A number of other publicly-accessible blocks can be found in the `@hashdeps` GitHub org, including the [Calculation Table](https://github.com/hashdeps/calculation-table-block), [Drawing](https://github.com/hashdeps/tldraw-block), and [Pull/Merge Request Overview](https://github.com/hashdeps/github-pr-overview) blocks.
66+
67+
## Using blocks
68+
69+
**In the HASH app (production):** Blocks published to the [Þ Hub](https://blockprotocol.org/hub) can be run within HASH via the 'insert block' (aka. 'slash') menu.
70+
71+
**In the HASH app (development):** While running the HASH app in development mode, in addition to inserting blocks published to the Þ Hub, you can also test locally-developed blocks out by going to any page, clicking on the menu next to an empty block, and pasting in the URL to your block's distribution folder (i.e. the one containing `block-metadata.json`, `block-schema.json`, and the block's code). If you need a way of serving your folder, try [`serve`](https://github.com/vercel/serve).
72+
73+
**From the command line:** If you want to work on, build or serve a single block, run:
74+
75+
```sh
76+
yarn workspace @blocks/block-name dev
77+
## or
78+
yarn workspace @blocks/block-name build
79+
## or
80+
yarn workspace @blocks/block-name serve
81+
```
82+
83+
**From other applications:** Blocks published to the [Þ Hub](https://blockprotocol.org/hub) can be used within any embedding application that integrates with the Block Protocol.
84+
85+
## Creating blocks
86+
87+
See the [Developing Blocks](https://blockprotocol.org/docs/developing-blocks) page in the [Þ Docs](https://blockprotocol.org/docs) for instructions on developing and publishing your own blocks.
88+
89+
Run the following command to create a new block:
90+
91+
```sh
92+
yarn create-block block-name
93+
```
94+
95+
## Publishing blocks
96+
97+
The HASH-developed blocks in this repository are currently published via manually-triggered GitHub actions:
98+
99+
- Publish blocks to preview (choose a branch)
100+
- Publish blocks to production
101+
102+
To publish your own block, in another [Þ Hub](https://blockprotocol.org/hub) namespace (and separate from this repository), see the "[Publishing Blocks](https://blockprotocol.org/docs/blocks/develop#publish)" guide in the Þ Docs.

blocks/address/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist
2+
node_modules
3+
.blockprotocolrc

blocks/address/LICENSE-APACHE.md

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
# Apache License
2+
3+
_Version 2.0, January 2004_
4+
_&lt;<http://www.apache.org/licenses/>&gt;_
5+
6+
### Terms and Conditions for use, reproduction, and distribution
7+
8+
#### 1. Definitions
9+
10+
“License” shall mean the terms and conditions for use, reproduction, and
11+
distribution as defined by Sections 1 through 9 of this document.
12+
13+
“Licensor” shall mean the copyright owner or entity authorized by the copyright
14+
owner that is granting the License.
15+
16+
“Legal Entity” shall mean the union of the acting entity and all other entities
17+
that control, are controlled by, or are under common control with that entity.
18+
For the purposes of this definition, “control” means **(i)** the power, direct or
19+
indirect, to cause the direction or management of such entity, whether by
20+
contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the
21+
outstanding shares, or **(iii)** beneficial ownership of such entity.
22+
23+
“You” (or “Your”) shall mean an individual or Legal Entity exercising
24+
permissions granted by this License.
25+
26+
“Source” form shall mean the preferred form for making modifications, including
27+
but not limited to software source code, documentation source, and configuration
28+
files.
29+
30+
“Object” form shall mean any form resulting from mechanical transformation or
31+
translation of a Source form, including but not limited to compiled object code,
32+
generated documentation, and conversions to other media types.
33+
34+
“Work” shall mean the work of authorship, whether in Source or Object form, made
35+
available under the License, as indicated by a copyright notice that is included
36+
in or attached to the work (an example is provided in the Appendix below).
37+
38+
“Derivative Works” shall mean any work, whether in Source or Object form, that
39+
is based on (or derived from) the Work and for which the editorial revisions,
40+
annotations, elaborations, or other modifications represent, as a whole, an
41+
original work of authorship. For the purposes of this License, Derivative Works
42+
shall not include works that remain separable from, or merely link (or bind by
43+
name) to the interfaces of, the Work and Derivative Works thereof.
44+
45+
“Contribution” shall mean any work of authorship, including the original version
46+
of the Work and any modifications or additions to that Work or Derivative Works
47+
thereof, that is intentionally submitted to Licensor for inclusion in the Work
48+
by the copyright owner or by an individual or Legal Entity authorized to submit
49+
on behalf of the copyright owner. For the purposes of this definition,
50+
“submitted” means any form of electronic, verbal, or written communication sent
51+
to the Licensor or its representatives, including but not limited to
52+
communication on electronic mailing lists, source code control systems, and
53+
issue tracking systems that are managed by, or on behalf of, the Licensor for
54+
the purpose of discussing and improving the Work, but excluding communication
55+
that is conspicuously marked or otherwise designated in writing by the copyright
56+
owner as “Not a Contribution.”
57+
58+
“Contributor” shall mean Licensor and any individual or Legal Entity on behalf
59+
of whom a Contribution has been received by Licensor and subsequently
60+
incorporated within the Work.
61+
62+
#### 2. Grant of Copyright License
63+
64+
Subject to the terms and conditions of this License, each Contributor hereby
65+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
66+
irrevocable copyright license to reproduce, prepare Derivative Works of,
67+
publicly display, publicly perform, sublicense, and distribute the Work and such
68+
Derivative Works in Source or Object form.
69+
70+
#### 3. Grant of Patent License
71+
72+
Subject to the terms and conditions of this License, each Contributor hereby
73+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
74+
irrevocable (except as stated in this section) patent license to make, have
75+
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
76+
such license applies only to those patent claims licensable by such Contributor
77+
that are necessarily infringed by their Contribution(s) alone or by combination
78+
of their Contribution(s) with the Work to which such Contribution(s) was
79+
submitted. If You institute patent litigation against any entity (including a
80+
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
81+
Contribution incorporated within the Work constitutes direct or contributory
82+
patent infringement, then any patent licenses granted to You under this License
83+
for that Work shall terminate as of the date such litigation is filed.
84+
85+
#### 4. Redistribution
86+
87+
You may reproduce and distribute copies of the Work or Derivative Works thereof
88+
in any medium, with or without modifications, and in Source or Object form,
89+
provided that You meet the following conditions:
90+
91+
- **(a)** You must give any other recipients of the Work or Derivative Works a copy of
92+
this License; and
93+
- **(b)** You must cause any modified files to carry prominent notices stating that You
94+
changed the files; and
95+
- **(c)** You must retain, in the Source form of any Derivative Works that You distribute,
96+
all copyright, patent, trademark, and attribution notices from the Source form
97+
of the Work, excluding those notices that do not pertain to any part of the
98+
Derivative Works; and
99+
- **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any
100+
Derivative Works that You distribute must include a readable copy of the
101+
attribution notices contained within such NOTICE file, excluding those notices
102+
that do not pertain to any part of the Derivative Works, in at least one of the
103+
following places: within a NOTICE text file distributed as part of the
104+
Derivative Works; within the Source form or documentation, if provided along
105+
with the Derivative Works; or, within a display generated by the Derivative
106+
Works, if and wherever such third-party notices normally appear. The contents of
107+
the NOTICE file are for informational purposes only and do not modify the
108+
License. You may add Your own attribution notices within Derivative Works that
109+
You distribute, alongside or as an addendum to the NOTICE text from the Work,
110+
provided that such additional attribution notices cannot be construed as
111+
modifying the License.
112+
113+
You may add Your own copyright statement to Your modifications and may provide
114+
additional or different license terms and conditions for use, reproduction, or
115+
distribution of Your modifications, or for any such Derivative Works as a whole,
116+
provided Your use, reproduction, and distribution of the Work otherwise complies
117+
with the conditions stated in this License.
118+
119+
#### 5. Submission of Contributions
120+
121+
Unless You explicitly state otherwise, any Contribution intentionally submitted
122+
for inclusion in the Work by You to the Licensor shall be under the terms and
123+
conditions of this License, without any additional terms or conditions.
124+
Notwithstanding the above, nothing herein shall supersede or modify the terms of
125+
any separate license agreement you may have executed with Licensor regarding
126+
such Contributions.
127+
128+
#### 6. Trademarks
129+
130+
This License does not grant permission to use the trade names, trademarks,
131+
service marks, or product names of the Licensor, except as required for
132+
reasonable and customary use in describing the origin of the Work and
133+
reproducing the content of the NOTICE file.
134+
135+
#### 7. Disclaimer of Warranty
136+
137+
Unless required by applicable law or agreed to in writing, Licensor provides the
138+
Work (and each Contributor provides its Contributions) on an “AS IS” BASIS,
139+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
140+
including, without limitation, any warranties or conditions of TITLE,
141+
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
142+
solely responsible for determining the appropriateness of using or
143+
redistributing the Work and assume any risks associated with Your exercise of
144+
permissions under this License.
145+
146+
#### 8. Limitation of Liability
147+
148+
In no event and under no legal theory, whether in tort (including negligence),
149+
contract, or otherwise, unless required by applicable law (such as deliberate
150+
and grossly negligent acts) or agreed to in writing, shall any Contributor be
151+
liable to You for damages, including any direct, indirect, special, incidental,
152+
or consequential damages of any character arising as a result of this License or
153+
out of the use or inability to use the Work (including but not limited to
154+
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
155+
any and all other commercial damages or losses), even if such Contributor has
156+
been advised of the possibility of such damages.
157+
158+
#### 9. Accepting Warranty or Additional Liability
159+
160+
While redistributing the Work or Derivative Works thereof, You may choose to
161+
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
162+
other liability obligations and/or rights consistent with this License. However,
163+
in accepting such obligations, You may act only on Your own behalf and on Your
164+
sole responsibility, not on behalf of any other Contributor, and only if You
165+
agree to indemnify, defend, and hold each Contributor harmless for any liability
166+
incurred by, or claims asserted against, such Contributor by reason of your
167+
accepting any such warranty or additional liability.
168+
169+
_END OF TERMS AND CONDITIONS_
170+
171+
### APPENDIX: Apply the Apache License to a specific file
172+
173+
To apply the Apache License to an individual file, attach the following notice.
174+
The text should be enclosed in the appropriate comment syntax for the file
175+
format.
176+
177+
Copyright © 2022–, HASH
178+
179+
Licensed under the Apache License, Version 2.0 (the "License");
180+
you may not use this file except in compliance with the License.
181+
You may obtain a copy of the License at
182+
183+
http://www.apache.org/licenses/LICENSE-2.0
184+
185+
Unless required by applicable law or agreed to in writing, software
186+
distributed under the License is distributed on an "AS IS" BASIS,
187+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
188+
See the License for the specific language governing permissions and
189+
limitations under the License.

blocks/address/LICENSE-MIT.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# MIT License
2+
3+
Copyright © 2022–, HASH
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

blocks/address/LICENSE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# License
2+
3+
Licensed under either of the [Apache License, Version 2.0](LICENSE-APACHE.md) or [MIT license](LICENSE-MIT.md) at your option.
4+
5+
For more information about contributing to this block, see our top-level [CONTRIBUTING](https://github.com/hashintel/hash/blob/main/.github/CONTRIBUTING.md) policy.

blocks/address/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The address block powered by the Mapbox API allows for finding and displaying information about a specific address or location.
2+
3+
Whenever an address is selected, the Graph Modules's `createEntity` method is called to save the address information into an `Address` entity and the address map into a `RemoteFile` entity, which are linked to the block.
4+
5+
The block also stores its state locally in `title` (the address display title), `description`, `addressId` and `zoomLevel` properties.

0 commit comments

Comments
 (0)