Set parameters
+ + + +Your story
+ +Age
+ +Theme
+ +Story type
+ (optional) +Tone
+Ending type
+Narrative structure
+Duration (min)
+Characters
+ (max 5) +Other
+ (optional) +Set parameters to generate story
+or
+ +diff --git a/examples/bedtime-story-teller/README.md b/examples/bedtime-story-teller/README.md new file mode 100644 index 0000000..3c3af93 --- /dev/null +++ b/examples/bedtime-story-teller/README.md @@ -0,0 +1,42 @@ +# Bedtime Story Teller Example + +## Description +This example demonstrates how to build a bedtime story teller application using Arduino UNO Q. +The application shows how to use a cloud-based large language model (LLM) to generate a bedtime story based on user input. + +## Bricks Used + +The code detector example uses the following bricks: + +- `cloud_llm`: brick to interact with a cloud-based large language model (LLM) for generating story content. +- `web_ui`: brick to create a web interface to get user input and display the generated story. + +## Hardware and Software Requirements + +### Hardware + +- Arduino UNO Q (x1) +- USB camera (x1) +- USB-CĀ® to USB-A Cable (x1) +- Personal computer with internet access + +### Software + +- Apps Lab IDE + +Note: You can run this example using your Arduino UNO Q as a Single Board Computer (SBC) using a [USB-C hub](https://store.arduino.cc/products/usb-c-to-hdmi-multiport-adapter-with-ethernet-and-usb-hub) with a mouse, keyboard and display attached. + +## How to Use the Example + +1. Run the app +2. Open the App on your browser + +## How it Works + +Here is a brief explanation of the full-stack application: + +### š§ Backend (main.py) + +### š» Frontend (index.html + app.js) + +## Understanding the Code diff --git a/examples/bedtime-story-teller/app.yaml b/examples/bedtime-story-teller/app.yaml new file mode 100644 index 0000000..2b59f5b --- /dev/null +++ b/examples/bedtime-story-teller/app.yaml @@ -0,0 +1,9 @@ +name: Bedtime story teller +icon: š° +description: + This example shows how to create a bedtime story teller using Arduino. + It uses a cloud-based language model to generate a story based on user input and shows the story on a web interface. + +bricks: + - arduino:cloud_llm + - arduino:web_ui diff --git a/examples/bedtime-story-teller/assets/app.js b/examples/bedtime-story-teller/assets/app.js new file mode 100644 index 0000000..506c8c4 --- /dev/null +++ b/examples/bedtime-story-teller/assets/app.js @@ -0,0 +1,522 @@ +// SPDX-FileCopyrightText: Copyright (C) ARDUINO SRL (http://www.arduino.cc) +// +// SPDX-License-Identifier: MPL-2.0 + +const socket = io(`http://${window.location.host}`); + +let generateStoryButtonOriginalHTML = ''; // To store the original content of the generate story button +let storyBuffer = ''; + + + +function initSocketIO() { + socket.on('prompt', (data) => { + const promptContainer = document.getElementById('prompt-container'); + const promptDisplay = document.getElementById('prompt-display'); + promptDisplay.innerHTML = data; + promptContainer.style.display = 'block'; + }); + + socket.on('response', (data) => { + + document.getElementById('story-container').style.display = 'flex'; + + storyBuffer += data; + + }); + + + + socket.on('stream_end', () => { + + const storyResponse = document.getElementById('story-response'); + + storyResponse.innerHTML = storyBuffer; + + + + document.getElementById('loading-spinner').style.display = 'none'; + + const clearStoryButton = document.getElementById('clear-story-button'); + + clearStoryButton.style.display = 'block'; + + clearStoryButton.disabled = false; + + + + const generateStoryButton = document.querySelector('.generate-story-button'); + + if (generateStoryButton) { + + generateStoryButton.disabled = false; + + generateStoryButton.innerHTML = generateStoryButtonOriginalHTML; // Restore original content + + } + + }); +} + +function unlockAndOpenNext(currentContainer) { + const nextContainer = currentContainer.nextElementSibling; + if (nextContainer && nextContainer.classList.contains('parameter-container')) { + if (nextContainer.classList.contains('disabled')) { + nextContainer.classList.remove('disabled'); + const content = nextContainer.querySelector('.parameter-content'); + const arrow = nextContainer.querySelector('.arrow-icon'); + if (content.style.display !== 'block') { + content.style.display = 'block'; + arrow.classList.add('rotated'); + } + } + } +} + +function getRandomElement(elements) { + if (elements.length === 0) return null; + const randomIndex = Math.floor(Math.random() * elements.length); + return elements[randomIndex]; +} + +function setupChipSelection(container) { + const chips = container.querySelectorAll('.chip'); + const selectedValue = container.querySelector('.selected-value'); + chips.forEach(chip => { + chip.addEventListener('click', (event) => { + event.stopPropagation(); + const alreadySelected = chip.classList.contains('selected'); + chips.forEach(c => c.classList.remove('selected')); + chip.classList.add('selected'); + if (selectedValue) { + selectedValue.innerHTML = chip.innerHTML; + selectedValue.style.display = 'inline-flex'; + } + if (!alreadySelected) { + unlockAndOpenNext(container); + } + + // Collapse the current container + const content = container.querySelector('.parameter-content'); + const arrow = container.querySelector('.arrow-icon'); + content.style.display = 'none'; + arrow.classList.remove('rotated'); + + }); + }); +} + +function setupStoryTypeSelection(container) { + const paragraphs = container.querySelectorAll('.story-type-paragraph'); + paragraphs.forEach(paragraph => { + const chips = paragraph.querySelectorAll('.chip'); + chips.forEach(chip => { + chip.addEventListener('click', (event) => { + event.stopPropagation(); + const paragraphChips = paragraph.querySelectorAll('.chip'); + paragraphChips.forEach(c => c.classList.remove('selected')); + chip.classList.add('selected'); + updateStoryTypeHeader(container); + const selectedChips = container.querySelectorAll('.chip.selected'); + if (selectedChips.length === paragraphs.length) { + unlockAndOpenNext(container); + } + }); + }); + }); +} + +function updateStoryTypeHeader(container) { + const optionalText = container.querySelector('.optional-text'); + const selectedChips = container.querySelectorAll('.chip.selected'); + const content = container.querySelector('.parameter-content'); + const isOpen = content.style.display === 'block'; + optionalText.innerHTML = ''; + if (selectedChips.length === 0) { + optionalText.textContent = '(optional)'; + return; + } + if (isOpen) { + Array.from(selectedChips).forEach(chip => { + const pill = document.createElement('span'); + pill.className = 'selection-pill'; + pill.innerHTML = chip.innerHTML; + optionalText.appendChild(pill); + }); + } else { + const firstTwo = Array.from(selectedChips).slice(0, 2); + firstTwo.forEach(chip => { + const pill = document.createElement('span'); + pill.className = 'selection-pill'; + pill.innerHTML = chip.innerHTML; + optionalText.appendChild(pill); + }); + const remaining = selectedChips.length - 2; + if (remaining > 0) { + const plusSpan = document.createElement('span'); + plusSpan.className = 'plus-x'; + plusSpan.style.display = 'inline-block'; + plusSpan.textContent = `+${remaining}`; + optionalText.appendChild(plusSpan); + } + } +} + +function checkCharactersAndUnlockNext(charactersContainer) { + const characterGroups = charactersContainer.querySelectorAll('.character-input-group'); + let atLeastOneCharacterEntered = false; + characterGroups.forEach(group => { + const nameInput = group.querySelector('.character-name'); + const roleSelect = group.querySelector('.character-role'); + if (nameInput.value.trim() !== '' && roleSelect.value !== '') { + atLeastOneCharacterEntered = true; + } + }); + const generateButton = document.querySelector('.generate-story-button'); + if (atLeastOneCharacterEntered) { + unlockAndOpenNext(charactersContainer); + generateButton.style.display = 'flex'; + } else { + generateButton.style.display = 'none'; + } +} + +function gatherDataAndGenerateStory() { + document.querySelectorAll('.parameter-container').forEach(container => { + const content = container.querySelector('.parameter-content'); + if (content && content.style.display === 'block') { + content.style.display = 'none'; + const arrow = container.querySelector('.arrow-icon'); + if (arrow) { + arrow.classList.remove('rotated'); + } + } + }); + + const age = document.querySelector('.parameter-container:nth-child(1) .chip.selected')?.textContent.trim() || 'any'; + const theme = document.querySelector('.parameter-container:nth-child(2) .chip.selected')?.textContent.trim() || 'any'; + const storyTypeContainer = document.querySelector('.parameter-container:nth-child(3)'); + const tone = storyTypeContainer.querySelector('.story-type-paragraph:nth-child(1) .chip.selected')?.textContent.trim() || 'any'; + const endingType = storyTypeContainer.querySelector('.story-type-paragraph:nth-child(2) .chip.selected')?.textContent.trim() || 'any'; + const narrativeStructure = storyTypeContainer.querySelector('.story-type-paragraph:nth-child(3) .chip.selected')?.textContent.trim() || 'any'; + const duration = storyTypeContainer.querySelector('.story-type-paragraph:nth-child(4) .chip.selected')?.textContent.trim() || 'any'; + + const characters = []; + const characterGroups = document.querySelectorAll('.character-input-group'); + characterGroups.forEach(group => { + const name = group.querySelector('.character-name').value.trim(); + const role = group.querySelector('.character-role').value; + const description = group.querySelector('.character-description').value.trim(); + if (name && role) { + characters.push({ name, role, description }); + } + }); + + const other = document.querySelector('.other-textarea').value.trim(); + + const storyData = { + age, + theme, + tone, + endingType, + narrativeStructure, + duration, + characters, + other, + }; + + generateStory(storyData); +} + +function generateStory(data) { + document.querySelector('.story-output-placeholder').style.display = 'none'; + const responseArea = document.getElementById('story-response-area'); + responseArea.style.display = 'flex'; + document.getElementById('prompt-container').style.display = 'none'; + document.getElementById('prompt-display').textContent = ''; + document.getElementById('story-container').style.display = 'none'; + document.getElementById('story-response').innerHTML = ''; // Use innerHTML to clear + storyBuffer = ''; // Reset buffer + document.getElementById('loading-spinner').style.display = 'block'; // Show the general loading spinner + + const generateStoryButton = document.querySelector('.generate-story-button'); + if (generateStoryButton) { + generateStoryButton.disabled = true; + // Append the spinner instead of replacing innerHTML + generateStoryButton.innerHTML += '
'; + } + + document.getElementById('clear-story-button').style.display = 'none'; + socket.emit('generate_story', data); +} + +function resetStoryView() { + document.querySelector('.story-output-placeholder').style.display = 'flex'; + const responseArea = document.getElementById('story-response-area'); + responseArea.style.display = 'none'; + document.getElementById('prompt-container').style.display = 'none'; + document.getElementById('story-container').style.display = 'none'; + document.getElementById('prompt-display').innerHTML = ''; + document.getElementById('story-response').textContent = ''; + + // Reset parameter selections + document.querySelectorAll('.chip.selected').forEach(chip => { + chip.classList.remove('selected'); + }); + + document.querySelectorAll('.selected-value').forEach(selectedValue => { + selectedValue.innerHTML = ''; + selectedValue.style.display = 'none'; + }); + + // Reset Story type optional text + document.querySelectorAll('.parameter-container:nth-child(3) .optional-text').forEach(optionalText => { + optionalText.textContent = '(optional)'; + }); + + // Clear character inputs and remove extra groups + const characterInputGroups = document.querySelectorAll('.character-input-group'); + characterInputGroups.forEach((group, index) => { + if (index === 0) { // Only clear the first group, others will be removed + group.querySelector('.character-name').value = ''; + group.querySelector('.character-role').selectedIndex = 0; + group.querySelector('.character-description').value = ''; + group.querySelector('.delete-character-button').style.display = 'none'; + } else { + group.remove(); + } + }); + document.querySelector('.add-character-button').style.display = 'block'; // Ensure add character button is visible + + // Clear "Other" textarea + const otherTextarea = document.querySelector('.other-textarea'); + if (otherTextarea) { + otherTextarea.value = ''; + const charCounter = document.querySelector('.char-counter'); + if (charCounter) { + charCounter.textContent = `0 / ${otherTextarea.maxLength}`; + } + } + + // Restore "Generate story" button to original state + const generateStoryButton = document.querySelector('.generate-story-button'); + if (generateStoryButton) { + generateStoryButton.style.display = 'none'; // Keep hidden if no chars, will be set to flex by checkCharactersAndUnlockNext + generateStoryButton.disabled = false; + generateStoryButton.innerHTML = generateStoryButtonOriginalHTML; + } + + // Reset parameter containers state + const parameterContainers = document.querySelectorAll('.parameter-container'); + parameterContainers.forEach((container, index) => { + const content = container.querySelector('.parameter-content'); + const arrow = container.querySelector('.arrow-icon'); + + if (index === 0) { // Age container + content.style.display = 'block'; + arrow.classList.add('rotated'); + container.classList.remove('disabled'); + } else { + if (container.id !== 'prompt-container') { + container.classList.add('disabled'); + } + content.style.display = 'none'; + arrow.classList.remove('rotated'); + } + }); +} + +document.addEventListener('DOMContentLoaded', () => { + initSocketIO(); + + const generateStoryButton = document.querySelector('.generate-story-button'); + if (generateStoryButton) { + generateStoryButtonOriginalHTML = generateStoryButton.innerHTML; // Store original content + } + + const parameterContainers = document.querySelectorAll('.parameter-container'); + + parameterContainers.forEach((container, index) => { + if (index === 0) { + const content = container.querySelector('.parameter-content'); + const arrow = container.querySelector('.arrow-icon'); + content.style.display = 'block'; + arrow.classList.add('rotated'); + } else { + if (container.id !== 'prompt-container') { + container.classList.add('disabled'); + } + } + }); + + parameterContainers.forEach(container => { + const title = container.querySelector('.parameter-title').textContent; + const header = container.querySelector('.parameter-header'); + header.addEventListener('click', () => { + if (container.classList.contains('disabled')) return; + const content = container.querySelector('.parameter-content'); + const arrow = container.querySelector('.arrow-icon'); + arrow.classList.toggle('rotated'); + if (content.style.display === 'block') { + content.style.display = 'none'; + } else { + content.style.display = 'block'; + } + if (title === 'Story type') { + updateStoryTypeHeader(container); + } else if (title === 'Other') { + const textarea = container.querySelector('.other-textarea'); + const charCounter = container.querySelector('.char-counter'); + const maxLength = textarea.maxLength; + textarea.addEventListener('input', () => { + const currentLength = textarea.value.length; + charCounter.textContent = `${currentLength} / ${maxLength}`; + }); + } + }); + + if (title === 'Story type') { + setupStoryTypeSelection(container); + } else if (title === 'Characters') { + const charactersList = container.querySelector('.characters-list'); + charactersList.addEventListener('input', () => { + checkCharactersAndUnlockNext(container); + }); + container.querySelector('.add-character-button').addEventListener('click', () => { + checkCharactersAndUnlockNext(container); + }); + } else if (title === 'Other') { + container.querySelector('.other-textarea').addEventListener('input', () => unlockAndOpenNext(container), { once: true }); + } else { + setupChipSelection(container); + } + }); + + const addCharacterButton = document.querySelector('.add-character-button'); + const charactersList = document.querySelector('.characters-list'); + const characterInputGroup = document.querySelector('.character-input-group'); + addCharacterButton.addEventListener('click', () => { + const characterGroups = document.querySelectorAll('.character-input-group'); + if (characterGroups.length < 5) { + const newCharacterGroup = characterInputGroup.cloneNode(true); + newCharacterGroup.querySelector('.character-name').value = ''; + newCharacterGroup.querySelector('.character-role').selectedIndex = 0; + newCharacterGroup.querySelector('.character-description').value = ''; + const deleteButton = newCharacterGroup.querySelector('.delete-character-button'); + deleteButton.style.display = 'block'; + deleteButton.addEventListener('click', () => { + newCharacterGroup.remove(); + if (document.querySelectorAll('.character-input-group').length < 5) { + addCharacterButton.style.display = 'block'; + } + checkCharactersAndUnlockNext(document.querySelector('.parameter-container:nth-child(4)')); + }); + charactersList.appendChild(newCharacterGroup); + if (document.querySelectorAll('.character-input-group').length === 5) { + addCharacterButton.style.display = 'none'; + } + } + }); + + document.querySelector('.generate-story-button').addEventListener('click', gatherDataAndGenerateStory); + + + const modal = document.getElementById('new-story-modal'); + const clearButton = document.getElementById('clear-story-button'); + const closeButton = document.querySelector('.close-button'); + const confirmButton = document.getElementById('confirm-new-story-button'); + + clearButton.addEventListener('click', () => { + modal.style.display = 'flex'; + }); + + closeButton.addEventListener('click', () => { + modal.style.display = 'none'; + }); + + confirmButton.addEventListener('click', () => { + resetStoryView(); + modal.style.display = 'none'; + }); + + window.addEventListener('click', (event) => { + if (event.target == modal) { + modal.style.display = 'none'; + } + }); + + document.getElementById('copy-story-button').addEventListener('click', () => { + const storyText = document.getElementById('story-response').innerText; + const copyButton = document.getElementById('copy-story-button'); + const originalHTML = copyButton.innerHTML; + const textarea = document.createElement('textarea'); + textarea.value = storyText; + document.body.appendChild(textarea); + textarea.select(); + try { + document.execCommand('copy'); + copyButton.textContent = 'Copied!'; + copyButton.disabled = true; + } catch (err) { + console.error('Could not copy text: ', err); + } + document.body.removeChild(textarea); + + setTimeout(() => { + copyButton.innerHTML = originalHTML; + copyButton.disabled = false; + }, 2000); + }); + + document.getElementById('generate-randomly-button').addEventListener('click', () => { + // Age + const ageChips = document.querySelectorAll('.parameter-container:nth-child(1) .chip'); + const randomAgeChip = getRandomElement(ageChips); + const age = randomAgeChip ? randomAgeChip.textContent.trim() : 'any'; + + // Theme + const themeChips = document.querySelectorAll('.parameter-container:nth-child(2) .chip'); + const randomThemeChip = getRandomElement(themeChips); + const theme = randomThemeChip ? randomThemeChip.textContent.trim() : 'any'; + + // Story Type + const storyTypeContainer = document.querySelector('.parameter-container:nth-child(3)'); + + // Tone + const toneChips = storyTypeContainer.querySelectorAll('.story-type-paragraph:nth-child(1) .chip'); + const randomToneChip = getRandomElement(toneChips); + const tone = randomToneChip ? randomToneChip.textContent.trim() : 'any'; + + // Ending type + const endingTypeChips = storyTypeContainer.querySelectorAll('.story-type-paragraph:nth-child(2) .chip'); + const randomEndingTypeChip = getRandomElement(endingTypeChips); + const endingType = randomEndingTypeChip ? randomEndingTypeChip.textContent.trim() : 'any'; + + // Narrative structure + const narrativeStructureChips = storyTypeContainer.querySelectorAll('.story-type-paragraph:nth-child(3) .chip'); + const randomNarrativeStructureChip = getRandomElement(narrativeStructureChips); + const narrativeStructure = randomNarrativeStructureChip ? randomNarrativeStructureChip.textContent.trim() : 'any'; + + // Duration + const durationChips = storyTypeContainer.querySelectorAll('.story-type-paragraph:nth-child(4) .chip'); + const randomDurationChip = getRandomElement(durationChips); + const duration = randomDurationChip ? randomDurationChip.textContent.trim() : 'any'; + + // Characters and Other will be empty for random generation. + const characters = []; + const other = ''; + + const storyData = { + age, + theme, + tone, + endingType, + narrativeStructure, + duration, + characters, + other, + }; + + generateStory(storyData); + }); +}); diff --git a/examples/bedtime-story-teller/assets/fonts/Open Sans/OFL.txt b/examples/bedtime-story-teller/assets/fonts/Open Sans/OFL.txt new file mode 100644 index 0000000..4fc6170 --- /dev/null +++ b/examples/bedtime-story-teller/assets/fonts/Open Sans/OFL.txt @@ -0,0 +1,93 @@ +Copyright 2020 The Open Sans Project Authors (https://github.com/googlefonts/opensans) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/examples/bedtime-story-teller/assets/fonts/Open Sans/OpenSans-VariableFont_wdth,wght.ttf b/examples/bedtime-story-teller/assets/fonts/Open Sans/OpenSans-VariableFont_wdth,wght.ttf new file mode 100644 index 0000000..548c15f Binary files /dev/null and b/examples/bedtime-story-teller/assets/fonts/Open Sans/OpenSans-VariableFont_wdth,wght.ttf differ diff --git a/examples/bedtime-story-teller/assets/fonts/Roboto/OFL.txt b/examples/bedtime-story-teller/assets/fonts/Roboto/OFL.txt new file mode 100644 index 0000000..68f7a96 --- /dev/null +++ b/examples/bedtime-story-teller/assets/fonts/Roboto/OFL.txt @@ -0,0 +1,91 @@ +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. \ No newline at end of file diff --git a/examples/bedtime-story-teller/assets/fonts/Roboto/RobotoMono-VariableFont_wght.ttf b/examples/bedtime-story-teller/assets/fonts/Roboto/RobotoMono-VariableFont_wght.ttf new file mode 100644 index 0000000..3a2d704 Binary files /dev/null and b/examples/bedtime-story-teller/assets/fonts/Roboto/RobotoMono-VariableFont_wght.ttf differ diff --git a/examples/bedtime-story-teller/assets/fonts/fonts.css b/examples/bedtime-story-teller/assets/fonts/fonts.css new file mode 100644 index 0000000..86cf716 --- /dev/null +++ b/examples/bedtime-story-teller/assets/fonts/fonts.css @@ -0,0 +1,19 @@ +/* + * SPDX-FileCopyrightText: Copyright (C) ARDUINO SRL (http://www.arduino.cc) + * + * SPDX-License-Identifier: MPL-2.0 + */ + +@font-face { + font-family: 'Roboto Mono'; + font-style: normal; + font-display: swap; + src: url('Roboto/RobotoMono-VariableFont_wght.ttf') format('truetype'); +} + +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-display: swap; + src: url('Open Sans/OpenSans-VariableFont_wdth,wght.ttf') format('truetype'); +} \ No newline at end of file diff --git a/examples/bedtime-story-teller/assets/img/animal.svg b/examples/bedtime-story-teller/assets/img/animal.svg new file mode 100644 index 0000000..ff00044 --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/animal.svg @@ -0,0 +1,20 @@ + \ No newline at end of file diff --git a/examples/bedtime-story-teller/assets/img/arrow-right.svg b/examples/bedtime-story-teller/assets/img/arrow-right.svg new file mode 100644 index 0000000..dd86a0d --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/arrow-right.svg @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/examples/bedtime-story-teller/assets/img/bear.svg b/examples/bedtime-story-teller/assets/img/bear.svg new file mode 100644 index 0000000..df6e530 --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/bear.svg @@ -0,0 +1,18 @@ + diff --git a/examples/bedtime-story-teller/assets/img/book.svg b/examples/bedtime-story-teller/assets/img/book.svg new file mode 100644 index 0000000..af66630 --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/book.svg @@ -0,0 +1,107 @@ + \ No newline at end of file diff --git a/examples/bedtime-story-teller/assets/img/castle.svg b/examples/bedtime-story-teller/assets/img/castle.svg new file mode 100644 index 0000000..548f42c --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/castle.svg @@ -0,0 +1,34 @@ + \ No newline at end of file diff --git a/examples/bedtime-story-teller/assets/img/comedy.svg b/examples/bedtime-story-teller/assets/img/comedy.svg new file mode 100644 index 0000000..78cc2ef --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/comedy.svg @@ -0,0 +1,24 @@ + \ No newline at end of file diff --git a/examples/bedtime-story-teller/assets/img/copy.svg b/examples/bedtime-story-teller/assets/img/copy.svg new file mode 100644 index 0000000..91fd3d9 --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/copy.svg @@ -0,0 +1,3 @@ + diff --git a/examples/bedtime-story-teller/assets/img/double-arrow.svg b/examples/bedtime-story-teller/assets/img/double-arrow.svg new file mode 100644 index 0000000..22eef1b --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/double-arrow.svg @@ -0,0 +1,3 @@ + diff --git a/examples/bedtime-story-teller/assets/img/doubt.svg b/examples/bedtime-story-teller/assets/img/doubt.svg new file mode 100644 index 0000000..36c98a0 --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/doubt.svg @@ -0,0 +1,32 @@ + diff --git a/examples/bedtime-story-teller/assets/img/fun.svg b/examples/bedtime-story-teller/assets/img/fun.svg new file mode 100644 index 0000000..24c3533 --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/fun.svg @@ -0,0 +1,30 @@ + diff --git a/examples/bedtime-story-teller/assets/img/ghost.svg b/examples/bedtime-story-teller/assets/img/ghost.svg new file mode 100644 index 0000000..690c35c --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/ghost.svg @@ -0,0 +1,31 @@ + diff --git a/examples/bedtime-story-teller/assets/img/happy.svg b/examples/bedtime-story-teller/assets/img/happy.svg new file mode 100644 index 0000000..9386521 --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/happy.svg @@ -0,0 +1,19 @@ + diff --git a/examples/bedtime-story-teller/assets/img/hope.svg b/examples/bedtime-story-teller/assets/img/hope.svg new file mode 100644 index 0000000..bb1bf77 --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/hope.svg @@ -0,0 +1,16 @@ + diff --git a/examples/bedtime-story-teller/assets/img/logo.svg b/examples/bedtime-story-teller/assets/img/logo.svg new file mode 100644 index 0000000..0afb3af --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/logo.svg @@ -0,0 +1,19 @@ + + \ No newline at end of file diff --git a/examples/bedtime-story-teller/assets/img/magic.svg b/examples/bedtime-story-teller/assets/img/magic.svg new file mode 100644 index 0000000..a865312 --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/magic.svg @@ -0,0 +1,48 @@ + \ No newline at end of file diff --git a/examples/bedtime-story-teller/assets/img/misterious.svg b/examples/bedtime-story-teller/assets/img/misterious.svg new file mode 100644 index 0000000..ca96938 --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/misterious.svg @@ -0,0 +1,38 @@ + diff --git a/examples/bedtime-story-teller/assets/img/stars.svg b/examples/bedtime-story-teller/assets/img/stars.svg new file mode 100644 index 0000000..e694f3f --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/stars.svg @@ -0,0 +1,3 @@ + diff --git a/examples/bedtime-story-teller/assets/img/storyteller-background.png b/examples/bedtime-story-teller/assets/img/storyteller-background.png new file mode 100644 index 0000000..2e3c16e Binary files /dev/null and b/examples/bedtime-story-teller/assets/img/storyteller-background.png differ diff --git a/examples/bedtime-story-teller/assets/img/sword.svg b/examples/bedtime-story-teller/assets/img/sword.svg new file mode 100644 index 0000000..00007be --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/sword.svg @@ -0,0 +1,23 @@ + diff --git a/examples/bedtime-story-teller/assets/img/telescope.svg b/examples/bedtime-story-teller/assets/img/telescope.svg new file mode 100644 index 0000000..ba48236 --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/telescope.svg @@ -0,0 +1,33 @@ + diff --git a/examples/bedtime-story-teller/assets/img/trash.svg b/examples/bedtime-story-teller/assets/img/trash.svg new file mode 100644 index 0000000..fa9d42d --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/trash.svg @@ -0,0 +1,3 @@ + diff --git a/examples/bedtime-story-teller/assets/img/tv.svg b/examples/bedtime-story-teller/assets/img/tv.svg new file mode 100644 index 0000000..a6be80f --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/tv.svg @@ -0,0 +1,22 @@ + \ No newline at end of file diff --git a/examples/bedtime-story-teller/assets/img/wizard.svg b/examples/bedtime-story-teller/assets/img/wizard.svg new file mode 100644 index 0000000..50f56a3 --- /dev/null +++ b/examples/bedtime-story-teller/assets/img/wizard.svg @@ -0,0 +1,65 @@ + \ No newline at end of file diff --git a/examples/bedtime-story-teller/assets/index.html b/examples/bedtime-story-teller/assets/index.html new file mode 100644 index 0000000..f4e0e21 --- /dev/null +++ b/examples/bedtime-story-teller/assets/index.html @@ -0,0 +1,231 @@ + + + + + + + +Set parameters to generate story
+or
+ +