{"id":19382742,"url":"https://github.com/authzed/animated-code-example-component","last_synced_at":"2025-04-23T20:32:28.298Z","repository":{"id":103102391,"uuid":"353476301","full_name":"authzed/animated-code-example-component","owner":"authzed","description":"Embeddable component for displaying an animated code example, as well as a REPL and a browser window","archived":false,"fork":false,"pushed_at":"2025-01-19T06:28:32.000Z","size":465,"stargazers_count":18,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-18T14:07:15.035Z","etag":null,"topics":["javascript","react","typescript"],"latest_commit_sha":null,"homepage":"https://authzed.com/blog/show-and-tell/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/authzed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-31T20:03:47.000Z","updated_at":"2024-11-15T09:33:35.000Z","dependencies_parsed_at":"2025-01-19T07:36:32.978Z","dependency_job_id":null,"html_url":"https://github.com/authzed/animated-code-example-component","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authzed%2Fanimated-code-example-component","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authzed%2Fanimated-code-example-component/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authzed%2Fanimated-code-example-component/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authzed%2Fanimated-code-example-component/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/authzed","download_url":"https://codeload.github.com/authzed/animated-code-example-component/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250509858,"owners_count":21442510,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","react","typescript"],"created_at":"2024-11-10T09:23:03.946Z","updated_at":"2025-04-23T20:32:28.292Z","avatar_url":"https://github.com/authzed.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @authzed/animated-code-example-component \u0026middot; [![monthly downloads](https://img.shields.io/npm/dm/@authzed/animated-code-example-component)](https://www.npmjs.com/package/@authzed/animated-code-example-component) [![gitHub license](https://img.shields.io/badge/license-Apache-blue.svg)](https://github.com/authzed/animated-code-example-component/blob/master/LICENSE) [![npm version](https://img.shields.io/npm/v/@authzed/animated-code-example-component.svg?style=flat)](https://www.npmjs.com/package/@authzed/animated-code-example-component) [![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/authzed/animated-code-example-component/pulls)\n\nComponent for displaying an animated code example, along with an animated REPL-like environment and fake web browser. Useful for showing small \"live\" examples on landing and marketing pages. Only begins the animation once the component is visible on the page.\n\n## Documentation\n\n* [Installation](#installation)\n* [Introduction](#introduction)\n* [Usage](#usage)\n  * [Simple example](#simple-example)\n* [Playground](#playground)\n\n### Installation\n\n```bash\nnpm install @authzed/animated-code-example-component\n```\n\nor\n\n```bash\nyarn add @authzed/animated-code-example-component\n```\n\n**NOTE:** Requires React.\n\n### Introduction\n\nThe Animated Code Example Component displays a fake code editor, REPL-like environment and web browser, all of which are scriptable by the caller to produce an animated virtual development enivornment for display on a landing or marketing page.\n\n#### Simple example\n\nA simple example that shows a (fake) website, \"edits\" it, then updates the website.\n\n```ts\nimport React from \"react\";\nimport ReactDOM from \"react-dom\";\n\nimport {DemoScript, DemoStepKind, stepsForText, StepTarget} from '@authzed/animated-code-example-component';\n\n// Include the CSS for the component.\nimport '@authzed/animated-code-example-component/dist/index.css'\n\nconst script: DemoScript = {\n    initialEditorContent: `\n@app.route('/')\ndef hello_world():\n  return 'Hello World!'\n`,\n    initialReplContent: '',\n    initialBrowserContent: 'Hello World!',\n    editorLanguage: 'python',\n    steps: [\n      ...stepsForText(`from somelib import something\\n`, StepTarget.EDITOR, 1, 1),\n      ...stepsForText(' - Hi there!', StepTarget.EDITOR, 5, 23),\n      ...stepsForText('./deploywebsite', StepTarget.REPL, 1, 1),\n      { kind: DemoStepKind.SLEEP, duration: 200 },\n      { kind: DemoStepKind.INSERT_TEXT, target: StepTarget.REPL, value: '\\n\u003e Website updated!' },\n      { kind: DemoStepKind.SLEEP, duration: 500 },\n      { kind: DemoStepKind.SET_BROWSER_CONTENT, target: StepTarget.BROWSER, value: 'Hello World! - Hi there!' },\n    ]\n}\n\nfunction App() {\n  return (\n    \u003cAnimatedCodeExample script={script} /\u003e;\n  );\n}\n\nconst rootElement = document.getElementById(\"root\");\nReactDOM.render(\u003cApp /\u003e, rootElement);\n```\n\n### Playground\n\nTo edit and test demo scripts, the playground can be run via yarn:\n\n```sh\ncd playground\nyarn install # If this is the first time running\nyarn start\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthzed%2Fanimated-code-example-component","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauthzed%2Fanimated-code-example-component","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthzed%2Fanimated-code-example-component/lists"}