├── .github ├── FUNDING.yml └── workflows │ └── ci.yml ├── .gitignore ├── .husky └── pre-commit ├── .prettierignore ├── .prettierrc ├── LICENSE ├── README.md ├── core ├── README.md ├── package.json ├── src │ ├── Context.tsx │ └── index.tsx └── tsconfig.json ├── lerna.json ├── package.json ├── renovate.json ├── test └── index.test.tsx ├── tsconfig.json └── website ├── .kktrc.ts ├── README.md ├── package.json ├── public ├── favicon.ico └── index.html ├── src ├── index.tsx └── react-app-env.d.ts └── tsconfig.json /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | ko_fi: jaywcjlove 2 | buy_me_a_coffee: jaywcjlove 3 | custom: ["https://www.paypal.me/kennyiseeyou", "https://jaywcjlove.github.io/#/sponsor"] 4 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | push: 4 | branches: 5 | - main 6 | 7 | # env: 8 | # SKIP_PREFLIGHT_CHECK: true 9 | jobs: 10 | windows: 11 | runs-on: windows-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | - uses: actions/setup-node@v4 15 | with: 16 | node-version: 20 17 | 18 | - name: Look Changelog 19 | uses: jaywcjlove/changelog-generator@main 20 | with: 21 | filter-author: (小弟调调™|Renovate Bot|renovate-bot) 22 | filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}' 23 | 24 | - run: npm install --unsafe-perm 25 | # - run: npm run hoist 26 | - run: npm run build 27 | - run: npm run coverage 28 | - run: npm run doc 29 | 30 | build: 31 | runs-on: ubuntu-latest 32 | permissions: 33 | contents: write 34 | id-token: write 35 | steps: 36 | - uses: actions/checkout@v4 37 | - uses: actions/setup-node@v4 38 | with: 39 | node-version: 18 40 | registry-url: 'https://registry.npmjs.org' 41 | 42 | - run: npm install --unsafe-perm 43 | # - run: npm run hoist 44 | - run: npm run build 45 | - run: npm run coverage 46 | - run: npm run doc 47 | 48 | - name: Generate Contributors Images 49 | uses: jaywcjlove/github-action-contributors@main 50 | with: 51 | filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\]) 52 | output: website/build/CONTRIBUTORS.svg 53 | avatarSize: 42 54 | 55 | - name: Create Coverage Badges 56 | uses: jaywcjlove/coverage-badges-cli@main 57 | with: 58 | output: website/build/badges.svg 59 | 60 | - run: cp -rp coverage website/build 61 | 62 | - name: Is a tag created auto? 63 | id: create_tag 64 | uses: jaywcjlove/create-tag-action@main 65 | with: 66 | token: ${{ secrets.GITHUB_TOKEN }} 67 | package-path: ./core/package.json 68 | 69 | - name: get tag version 70 | id: tag_version 71 | uses: jaywcjlove/changelog-generator@main 72 | 73 | - name: Deploy 74 | uses: peaceiris/actions-gh-pages@v4 75 | with: 76 | commit_message: ${{steps.tag_version.outputs.tag}} ${{ github.event.head_commit.message }} 77 | github_token: ${{ secrets.GITHUB_TOKEN }} 78 | publish_dir: ./website/build 79 | 80 | - name: Generate Changelog 81 | id: changelog 82 | uses: jaywcjlove/changelog-generator@main 83 | if: steps.create_tag.outputs.successful 84 | with: 85 | head-ref: ${{ steps.create_tag.outputs.version }} 86 | filter-author: (小弟调调™|Renovate Bot|renovate-bot) 87 | filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}' 88 | 89 | - name: Create Release 90 | uses: ncipollo/release-action@v1 91 | if: steps.create_tag.outputs.successful 92 | with: 93 | token: ${{ secrets.GITHUB_TOKEN }} 94 | allowUpdates: true 95 | name: ${{ steps.changelog.outputs.tag }} 96 | tag: ${{ steps.changelog.outputs.tag }} 97 | body: | 98 | Documentation ${{ steps.changelog.outputs.tag }}: https://raw.githack.com/uiwjs/react-iframe/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html 99 | Comparing Changes: ${{ steps.changelog.outputs.compareurl }} 100 | 101 | ${{ steps.changelog.outputs.changelog }} 102 | 103 | - run: npm publish --access public --provenance 104 | name: 📦 @uiw/react-iframe to NPM 105 | working-directory: core 106 | continue-on-error: true 107 | env: 108 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 109 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | dist 4 | build 5 | lib 6 | esm 7 | cjs 8 | 9 | dist.css 10 | 11 | # Log files 12 | npm-debug.log* 13 | yarn.lock 14 | yarn-debug.log* 15 | yarn-error.log* 16 | pnpm-debug.log* 17 | package-lock.json 18 | 19 | # local env files 20 | .env.local 21 | .env.*.local 22 | 23 | # Editor directories and files 24 | .DS_Store 25 | .idea 26 | .lerna_backup 27 | .vscode 28 | *.suo 29 | *.ntvs* 30 | *.njsproj 31 | *.sln 32 | *.sw? 33 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx --no-install lint-staged -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | **/*.md 2 | **/*.svg 3 | **/*.ejs 4 | **/*.yml 5 | package.json 6 | node_modules 7 | dist 8 | build 9 | lib 10 | esm 11 | cjs 12 | test -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all", 4 | "printWidth": 120, 5 | "overrides": [ 6 | { 7 | "files": ".prettierrc", 8 | "options": { "parser": "json" } 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 uiw 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | core/README.md -------------------------------------------------------------------------------- /core/README.md: -------------------------------------------------------------------------------- 1 | react-iframe 2 | === 3 | 4 | [![Build & Deploy](https://github.com/uiwjs/react-iframe/actions/workflows/ci.yml/badge.svg)](https://github.com/uiwjs/react-iframe/actions/workflows/ci.yml) 5 | [![Coverage Status](https://uiwjs.github.io/react-iframe/badges.svg)](https://uiwjs.github.io/react-iframe/coverage/lcov-report/) 6 | [![npm version](https://img.shields.io/npm/v/@uiw/react-iframe.svg)](https://www.npmjs.com/package/@uiw/react-iframe) 7 | 8 | This component allows you to wrap your entire React application or each component in an [` 34 | ); 35 | } 36 | ``` 37 | 38 | ## `head` 39 | 40 | The `head` prop is a dom node that gets inserted before the children of the frame. 41 | 42 | ```jsx mdx:preview 43 | import React from 'react'; 44 | import IFrame from '@uiw/react-iframe'; 45 | 46 | const head = ( 47 | 48 | ); 49 | 50 | export default function Demo() { 51 | return ( 52 | 55 | ); 56 | } 57 | ``` 58 | 59 | ## `initialContent` 60 | 61 | The `initialContent` props is the initial html injected into frame. It is only injected once, but allows you to insert any html into the frame (e.g. a [``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head) tag, [`