-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
361bf5c
commit 7c72373
Showing
62 changed files
with
666 additions
and
553 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"singleQuote": true, | ||
"arrowParens": "avoid", | ||
"plugins": ["@trivago/prettier-plugin-sort-imports"], | ||
"importOrder": ["<THIRD_PARTY_MODULES>", "^[./]"], | ||
"importOrderSeparation": true, | ||
"importOrderSortSpecifiers": true, | ||
"importOrderParserPlugins": ["typescript", "decorators-legacy"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// @ts-check | ||
|
||
import eslint from '@eslint/js'; | ||
import tseslint from 'typescript-eslint'; | ||
import eslintConfigPrettier from "eslint-config-prettier"; | ||
|
||
export default tseslint.config( | ||
eslint.configs.recommended, | ||
...tseslint.configs.recommended, | ||
eslintConfigPrettier, | ||
{ | ||
rules: { | ||
'@typescript-eslint/no-unused-vars': "warn" | ||
} | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
"new-port-cli": "^1.0.0", | ||
"rimraf": "^3.0.2" | ||
}, | ||
"type": "module", | ||
"engines": { | ||
"pnpm": ">=9.0.0" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
templates/module/collection/docs/elements/{{kebab_case collection_name}}.md.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# `{{kebab_case app_name}}` | ||
# `{{kebab_case collection_name}}` | ||
|
||
## Usage | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
templates/module/entry-type/docs/elements/create-{{kebab_case entry_type.name}}.md.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# `create-{{kebab_case entry_type.name}}` | ||
|
||
## Usage | ||
|
||
0. If you haven't already, [go through the setup for the module](/setup). | ||
|
||
1. Import the `create-{{kebab_case entry_type.name}}` element somewhere in the javascript side of your web-app like this: | ||
|
||
```js | ||
import '@holochain-open-dev/{{kebab_case app_name}}/dist/elements/create-{{kebab_case entry_type.name}}.js' | ||
``` | ||
|
||
2. Use it in the html side of your web-app like this: | ||
|
||
```html | ||
<create-{{kebab_case entry_type.name}}> | ||
</create-{{kebab_case entry_type.name}}> | ||
``` | ||
|
||
> [!WARNING] | ||
> Like all the elements in this module, `<create-{{kebab_case entry_type.name}}>` needs to be placed inside an initialized `<{{kebab_case app_name}}-context>`. | ||
|
||
## Demo | ||
|
||
Here is an interactive demo of the element: | ||
|
||
<element-demo> | ||
</element-demo> | ||
|
||
<script setup> | ||
import { onMounted } from "vue"; | ||
import { {{pascal_case app_name}}ZomeMock, sample{{pascal_case entry_type.name}} } from "@holochain-open-dev/{{kebab_case app_name}}/dist/mocks.js"; | ||
import { {{pascal_case app_name}}Store, {{pascal_case app_name}}Client } from "@holochain-open-dev/{{kebab_case app_name}}"; | ||
import { decodeHashFromBase64 } from '@holochain/client'; | ||
import { render, html } from "lit"; | ||
onMounted(async () => { | ||
// Elements need to be imported on the client side, not the SSR side | ||
// Reference: https://vitepress.dev/guide/ssr-compat#importing-in-mounted-hook | ||
await import('@api-viewer/docs/lib/api-docs.js'); | ||
await import('@api-viewer/demo/lib/api-demo.js'); | ||
await import('@holochain-open-dev/{{kebab_case app_name}}/dist/elements/{{kebab_case app_name}}-context.js'); | ||
await import('@holochain-open-dev/{{kebab_case app_name}}/dist/elements/create-{{kebab_case entry_type.name}}.js'); | ||
const mock = new {{pascal_case app_name}}ZomeMock(); | ||
const client = new {{pascal_case app_name}}Client(mock); | ||
const {{camel_case entry_type.name}} = await sample{{pascal_case entry_type.name}}(client); | ||
const record = await mock.create_{{snake_case entry_type.name}}({{camel_case entry_type.name}}); | ||
const store = new {{pascal_case app_name}}Store(client); | ||
render(html` | ||
<{{kebab_case app_name}}-context .store=${store}> | ||
<api-demo src="custom-elements.json" only="create-{{kebab_case entry_type.name}}" exclude-knobs="store"> | ||
</api-demo> | ||
</{{kebab_case app_name}}-context> | ||
`, document.querySelector('element-demo')) | ||
}) | ||
</script> | ||
|
||
## API Reference | ||
|
||
`create-{{kebab_case entry_type.name}}` is a [custom element](https://web.dev/articles/custom-elements-v1), which means that it can be used in any web app or website. Here is the reference for its API: | ||
|
||
<api-docs src="custom-elements.json" only="create-{{kebab_case entry_type.name}}"> | ||
</api-docs> |
Oops, something went wrong.