This repository has been archived by the owner on Nov 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from darksoil-studio/viktor
incorporation of feedback and added elements
- Loading branch information
Showing
5 changed files
with
217 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# `<role-detail>` | ||
|
||
## Usage | ||
|
||
0. If you haven't already, [go through the setup for the module](/setup). | ||
|
||
1. Import the `<role-detail>` element somewhere in the javascript side of your web-app like this: | ||
|
||
```js | ||
import '@darksoil-studio/roles/dist/elements/role-detail.js' | ||
``` | ||
|
||
2. Use it in the html side of your web-app like this: | ||
|
||
```html | ||
<role-detail> | ||
</role-detail> | ||
``` | ||
|
||
> [!WARNING] | ||
> Like all the elements in this module, `<role-detail>` needs to be placed inside an initialized `<roles-context>`. | ||
## Demo | ||
|
||
Here is an interactive demo of the element: | ||
|
||
<element-demo> | ||
</element-demo> | ||
|
||
|
||
|
||
<script setup> | ||
import { onMounted } from "vue"; | ||
import { ProfilesClient, ProfilesStore } from '@holochain-open-dev/profiles'; | ||
import { demoProfiles, ProfilesZomeMock } from '@holochain-open-dev/profiles/dist/mocks.js'; | ||
import { decodeHashFromBase64, encodeHashToBase64 } from '@holochain/client'; | ||
import { render } from "lit"; | ||
import { html, unsafeStatic } from "lit/static-html.js"; | ||
|
||
import { RolesZomeMock, sampleRoleClaim } from "../../ui/src/mocks.ts"; | ||
import { RolesStore } from "../../ui/src/roles-store.ts"; | ||
import { RolesClient } from "../../ui/src/roles-client.ts"; | ||
|
||
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/profiles/dist/elements/profiles-context.js'); | ||
if (!customElements.get('roles-context')) await import('../../ui/src/elements/roles-context.ts'); | ||
if (!customElements.get('role-detail')) await import('../../ui/src/elements/role-detail.ts'); | ||
|
||
const profiles = await demoProfiles(); | ||
|
||
const profilesMock = new ProfilesZomeMock( | ||
profiles, | ||
Array.from(profiles.keys())[0] | ||
); | ||
const profilesStore = new ProfilesStore(new ProfilesClient(profilesMock, "roles_test")); | ||
|
||
const mock = new RolesZomeMock(); | ||
const client = new RolesClient(mock, "roles_test"); | ||
|
||
const roleClaim = await sampleRoleClaim(client); | ||
|
||
const record = await mock.create_role_claim(roleClaim); | ||
|
||
const store = new RolesStore(client, { | ||
roles_config: [{ | ||
role: 'editor', | ||
singular_name: 'editor', | ||
plural_name: 'editor', | ||
description: 'editor', | ||
}] | ||
}); | ||
|
||
render(html` | ||
<profiles-context .store=${profilesStore}> | ||
<roles-context .store=${store}> | ||
<api-demo src="custom-elements.json" only="role-detail" exclude-knobs="store"> | ||
<template data-element="role-detail" data-target="host"> | ||
<role-detail ></role-detail> | ||
</template> | ||
</api-demo> | ||
</roles-context> | ||
</profiles-context> | ||
`, document.querySelector('element-demo')) | ||
}) | ||
|
||
|
||
</script> | ||
|
||
## API Reference | ||
|
||
`<role-detail>` 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="role-detail"> | ||
</api-docs> |
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,98 @@ | ||
# `<roles-for-agent>` | ||
|
||
## Usage | ||
|
||
0. If you haven't already, [go through the setup for the module](/setup). | ||
|
||
1. Import the `<roles-for-agent>` element somewhere in the javascript side of your web-app like this: | ||
|
||
```js | ||
import '@darksoil-studio/roles/dist/elements/roles-for-agent.js' | ||
``` | ||
|
||
2. Use it in the html side of your web-app like this: | ||
|
||
```html | ||
<roles-for-agent> | ||
</roles-for-agent> | ||
``` | ||
|
||
> [!WARNING] | ||
> Like all the elements in this module, `<roles-for-agent>` needs to be placed inside an initialized `<roles-context>`. | ||
## Demo | ||
|
||
Here is an interactive demo of the element: | ||
|
||
<element-demo> | ||
</element-demo> | ||
|
||
|
||
|
||
<script setup> | ||
import { onMounted } from "vue"; | ||
import { ProfilesClient, ProfilesStore } from '@holochain-open-dev/profiles'; | ||
import { demoProfiles, ProfilesZomeMock } from '@holochain-open-dev/profiles/dist/mocks.js'; | ||
import { decodeHashFromBase64, encodeHashToBase64 } from '@holochain/client'; | ||
import { render } from "lit"; | ||
import { html, unsafeStatic } from "lit/static-html.js"; | ||
|
||
import { RolesZomeMock, sampleRoleClaim } from "../../ui/src/mocks.ts"; | ||
import { RolesStore } from "../../ui/src/roles-store.ts"; | ||
import { RolesClient } from "../../ui/src/roles-client.ts"; | ||
|
||
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/profiles/dist/elements/profiles-context.js'); | ||
if (!customElements.get('roles-context')) await import('../../ui/src/elements/roles-context.ts'); | ||
if (!customElements.get('roles-for-agent')) await import('../../ui/src/elements/roles-for-agent.ts'); | ||
|
||
const profiles = await demoProfiles(); | ||
|
||
const profilesMock = new ProfilesZomeMock( | ||
profiles, | ||
Array.from(profiles.keys())[0] | ||
); | ||
const profilesStore = new ProfilesStore(new ProfilesClient(profilesMock, "roles_test")); | ||
|
||
const mock = new RolesZomeMock(); | ||
const client = new RolesClient(mock, "roles_test"); | ||
|
||
const roleClaim = await sampleRoleClaim(client); | ||
|
||
const record = await mock.create_role_claim(roleClaim); | ||
|
||
const store = new RolesStore(client, { | ||
roles_config: [{ | ||
role: 'editor', | ||
singular_name: 'editor', | ||
plural_name: 'editor', | ||
description: 'editor', | ||
}] | ||
}); | ||
|
||
render(html` | ||
<profiles-context .store=${profilesStore}> | ||
<roles-context .store=${store}> | ||
<api-demo src="custom-elements.json" only="roles-for-agent" exclude-knobs="store"> | ||
<template data-element="roles-for-agent" data-target="host"> | ||
<roles-for-agent ></roles-for-agent> | ||
</template> | ||
</api-demo> | ||
</roles-context> | ||
</profiles-context> | ||
`, document.querySelector('element-demo')) | ||
}) | ||
|
||
|
||
</script> | ||
|
||
## API Reference | ||
|
||
`<roles-for-agent>` 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="roles-for-agent"> | ||
</api-docs> |
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,7 +1,7 @@ | ||
# hc progenitor | ||
|
||
## Why | ||
The hc progenitor exists in order for developers to able to instansiate apps with an initial admin inscribed in the happ DNA. | ||
The hc progenitor exists in order for developers to able to instansiate apps in a test environment. | ||
|
||
## Using hc progenitor | ||
hc progenitor is using tauri... | ||
hc progenitor is using [tauri](https://tauri.app). |
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