Skip to content

Commit 4eabce0

Browse files
authored
Merge pull request #124 from b3008/fix-material-web
update with links to papers
2 parents 9903d02 + 07f26d4 commit 4eabce0

2 files changed

Lines changed: 33 additions & 11 deletions

File tree

src/stories/FunctionRandom.stories.ts

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,41 @@
11
import type { Meta, StoryObj } from "@storybook/web-components";
22
import { html } from "lit";
3+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
4+
5+
const makeSource = (name: string, min: number, max: number) =>
6+
`<aa-session name="${name}">
7+
<div style="display:flex; align-items:center; gap:12px;">
8+
<button onclick="
9+
var container = this.parentElement.querySelector('.result-container');
10+
container.innerHTML = '';
11+
var el = document.createElement('aa-function-random');
12+
el.setAttribute('name', 'randomValue');
13+
el.setAttribute('min', '${min}');
14+
el.setAttribute('max', '${max}');
15+
el.setAttribute('debug', '');
16+
container.appendChild(el);
17+
this.parentElement.querySelector('.result-value').textContent = el.value;
18+
">Generate</button>
19+
<span>Result: <strong class="result-value">—</strong></span>
20+
<span class="result-container" style="display:none;"></span>
21+
</div>
22+
</aa-session>`;
323

424
const meta = {
525
title: "Data & Utility/Function Random",
626
tags: ["autodocs"],
7-
argTypes: {
8-
min: { control: "number" },
9-
max: { control: "number" },
27+
render: (args) => {
28+
const source = makeSource("random-demo", args.min, args.max);
29+
return html`${unsafeHTML(source)}`;
30+
},
31+
parameters: {
32+
docs: {
33+
source: {
34+
code: `<aa-function-random name="randomValue" min="1" max="100"></aa-function-random>`,
35+
language: "html",
36+
},
37+
},
1038
},
11-
render: (args) => html`
12-
<aa-function-random
13-
name="randomValue"
14-
min="${args.min}"
15-
max="${args.max}"
16-
debug
17-
></aa-function-random>
18-
`,
1939
} satisfies Meta;
2040

2141
export default meta;

src/stories/Introduction.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ export const LiveDemo = ({ html }) => {
2626
**Build interactive surveys, questionnaires, and experiments using just HTML.**
2727

2828
Executable HTML is a library of custom web components that turn static HTML into interactive, sequential experiences. Instead of writing JavaScript to manage state, control flow, and data collection, you describe your entire application declaratively with HTML tags.
29+
For a more detailed explanation of the rationale, please visit [its documentation](https://executablehtmldocs.roboticbit.nl/), read [the paper describing its motivation](https://link.springer.com/article/10.3758/s13428-018-1148-y) or read
30+
[the paper describing its implementation](https://www.sciencedirect.com/science/article/pii/S2352711021000364)
2931

3032
## How it works
3133

0 commit comments

Comments
 (0)