# pie-demo

> Custom Element for Demoing PIE Framework Interactions

Latest version **1.25.0** (published 2019-08-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install pie-demo
pnpm add pie-demo
yarn add pie-demo
bun add pie-demo
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: insecure dependencies; abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.25.0 |
| Published | 2019-08-17 |
| First published | 2018-12-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 7 |
| Unpacked size | 5.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | evaneus, lakatosandrei |

## Links

- npm: https://www.npmjs.com/package/pie-demo
- npm.io page: https://npm.io/package/pie-demo

## Dependencies (7)

- [docson](https://npm.io/package/docson.md) git://github.com/lakatosandrei/docson.git#e48bf436dd6ea2ec65bae5ff540a517bd3eb0fa0
- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [classnames](https://npm.io/package/classnames.md) ^2.2.6
- [@stencil/core](https://npm.io/package/@stencil/core.md) ~0.15.1
- [json-beautify](https://npm.io/package/json-beautify.md) ^1.0.1
- [parse-package-name](https://npm.io/package/parse-package-name.md) ^0.1.0
- [resize-observer-polyfill](https://npm.io/package/resize-observer-polyfill.md) ^1.5.1

## Recent versions

- 1.25.0 (latest) — 2019-08-17
- 1.24.0 — 2019-07-06
- 1.23.0 — 2019-07-06
- 1.22.0 — 2019-07-03
- 1.21.0 — 2019-06-21
- 1.20.0 — 2019-05-06
- 1.19.0 — 2019-04-29
- 1.18.0 — 2019-04-25
- 1.17.0 — 2019-04-14
- 1.16.0 — 2019-04-11
- 1.15.0 — 2019-04-11
- 1.14.0 — 2019-04-09
- 1.13.0 — 2019-02-11
- 1.12.0 — 2019-02-09
- 1.11.0 — 2019-02-09
- … 11 more at https://npm.io/package/pie-demo/versions

## README

![Built With Stencil](https://img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DEuN3oiLz4KPC9zdmc%2BCg%3D%3D&colorA=16161d&style=flat-square)

# PIE Demo

A Custom Element for demonstrating a PIE interaction designed for use with the pie-cloud packaging service.

```html
<pie-demo
   editor="true" 
   pie="@pie-element/multiple-choice"
  >

</pie-demo>
```

## Setup

    npm install



## Development

Edit `src/index.html` with the name and version of the element you want to demo. And also alter the model.

Example
```html
<pie-demo id="demo" editor="true" pie="@pie-element/ebsr@1.2.0"></pie-demo>

  <script>
    const model = {
      "id": "0",
      "element": "pie-element-ebsr",
      "partA": {
        "prompt": "What color is the sky?",
        "choiceMode": "radio",
        "keyMode": "numbers",
        "choices": [
          {
            "value": "yellow",
            "label": "<div>Yellow</div>",
            "correct": false
          },
          {
            "value": "green",
            "label": "<div>Green</div>",
            "correct": false
          },
          {
            "correct": true,
            "value": "blue",
            "label": "<div>Blue</div>"
          }
        ],
        "partialScoring": false,
        "partialScoringLabel": "Each correct response that is correctly checked and each incorrect response\n          that is correctly unchecked will be worth 1 point.\n          The maximum points is the total number of answer choices.",
        "shuffle": false,
        "showCorrect": false
      },
      "partB": {
        "prompt": "What color do you get when you mix Red with your answer in Part 1?",
        "choiceMode": "radio",
        "keyMode": "numbers",
        "choices": [
          {
            "value": "orange",
            "label": "<div>Orange</div>",
            "correct": false
          },
          {
            "correct": true,
            "value": "purple",
            "label": "<div>Purple</div>"
          },
          {
            "value": "pink",
            "label": "<div>Pink</div>"
          },
          {
            "value": "green",
            "label": "<div>Green</div>"
          }
        ],
        "partialScoring": false,
        "partialScoringLabel": "Each correct response that is correctly checked and each incorrect response\n          that is correctly unchecked will be worth 1 point.\n          The maximum points is the total number of answer choices.",
        "shuffle": false
      }
    };
    const configure = {
      promptLabel: "Prompt",
      addChoiceButtonLabel: "Add a choice",
      addChoice: false,
      addFeedBack: true,
      deleteChoice: true,
      showPrompt: true,
      answerChoiceCount: 0,
      settingsSelectChoiceMode: true,
      settingsSelectChoicePrefixes: true,
      settingsSelectChoiceModeLabel: "Response Type",
      settingsChoicePrefixesLabel: "Choice Labels",
      settingsPartialScoring: true,
      settingsConfigShuffle: true
    };
    const pieDemo = document.getElementById("demo");
    pieDemo.model = model;
    pieDemo.configure = configure;
    pieDemo.modelSchemaJSONURI = 'https://raw.githubusercontent.com/pie-framework/pie-elements/develop/packages/categorize/docs/pie-schema.json';
    pieDemo.configureSchemaJSONURI = 'https://raw.githubusercontent.com/pie-framework/pie-elements/develop/packages/categorize/docs/config-schema.json';
  </script>
```

### Testing

Run e2e and unit tests:

    npm run test

### Local Devt

Launch the local `index.html` in hot-module-reload server:

    npm run start    



## Notes

When running `npm start` the HMR will attampt to re-define the custom element and get an already defined error. Need to refresh the page.

TODO

make script loading optional (but still define custome elements from pre-loaded)

---
_Source: https://npm.io/package/pie-demo · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
