├── .editorconfig ├── .gitattributes ├── .github ├── dependabot.yml ├── pull_request_template.md ├── release.yml └── workflows │ └── test.yml ├── .gitignore ├── .npmrc ├── CHANGELOG.md ├── LICENSE ├── README.md ├── biome.json ├── docs ├── index.html ├── language-examples.js ├── style.css └── theme-presets.js ├── index.html ├── media └── cover.png ├── package-lock.json ├── package.json ├── src ├── constants.js ├── index.js ├── syntax-highlight-element.js ├── themes │ ├── prettylights.css │ ├── prism.css │ └── theme-defaults.css └── utils.js ├── vite.config.js ├── vite.docs.config.js └── vite.themes.config.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | end_of_line = lf 7 | indent_size = 2 8 | indent_style = space 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Automatically normalize line endings for all text-based files 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Maintain dependencies for GitHub Actions 4 | - package-ecosystem: 'github-actions' 5 | # Workflow files stored in the default location of `.github/workflows` 6 | directory: '/' 7 | # Check for updates to GitHub Actions every weekday 8 | schedule: 9 | interval: 'weekly' 10 | 11 | # Maintain dependencies for npm 12 | - package-ecosystem: 'npm' 13 | # Look for `package.json` and `lock` files in the `root` directory 14 | directory: '/' 15 | # Check the npm registry for updates every weekday 16 | schedule: 17 | interval: 'weekly' 18 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## What changed (additional context) 2 | 3 | <!-- Describe your changes here --> 4 | 5 | <!-- Link to the ticket etc. if applicable otherwise remove this line --> 6 | 7 | Related: 8 | 9 | ## Proof of work (screenshots / screen recordings) 10 | 11 | <!-- Please provide before/after screenshots for any visual changes --> 12 | 13 | | before | after | 14 | | ------ | ----- | 15 | | - | - | 16 | -------------------------------------------------------------------------------- /.github/release.yml: -------------------------------------------------------------------------------- 1 | changelog: 2 | categories: 3 | - title: Features 4 | labels: 5 | - enhancement 6 | - title: Bug Fixes 7 | labels: 8 | - bug 9 | - title: Other Changes 10 | labels: 11 | - '*' 12 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | paths-ignore: 8 | - '**.md' 9 | - '**.yml' 10 | pull_request: 11 | branches: 12 | - main 13 | 14 | # Cancel in progress workflows on pull_requests. 15 | # https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value 16 | concurrency: 17 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} 18 | cancel-in-progress: true 19 | 20 | jobs: 21 | test: 22 | name: Test 23 | runs-on: ubuntu-latest 24 | steps: 25 | - name: Checkout repository 26 | uses: actions/checkout@v4 27 | 28 | - name: Setup node 29 | uses: actions/setup-node@v4.4.0 30 | with: 31 | node-version-file: 'package.json' 32 | cache: 'npm' 33 | 34 | - name: Install dependencies 35 | run: npm ci 36 | 37 | - name: Code quality 38 | run: npm run lint 39 | 40 | - name: Build 41 | run: npm run build 42 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | \__* 3 | *.log 4 | dist 5 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | save-exact=true 2 | engine-strict=true 3 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [1.1.1](https://github.com/andreruffert/syntax-highlight-element/compare/v1.1.0...v1.1.1) (2025-07-13) 2 | 3 | 4 | 5 | # [1.1.0](https://github.com/andreruffert/syntax-highlight-element/compare/v1.0.0...v1.1.0) (2025-04-07) 6 | 7 | 8 | ### Features 9 | 10 | * **themes/prettylights:** opt in to color-scheme property ([a9fb948](https://github.com/andreruffert/syntax-highlight-element/commit/a9fb948d73066333162d5d4b462753bff6dd2245)) 11 | 12 | 13 | 14 | # [1.0.0](https://github.com/andreruffert/syntax-highlight-element/compare/v1.0.0-rc.6...v1.0.0) (2025-03-11) 15 | 16 | 17 | 18 | # [1.0.0-rc.6](https://github.com/andreruffert/syntax-highlight-element/compare/v1.0.0-rc.5...v1.0.0-rc.6) (2025-03-08) 19 | 20 | 21 | ### Features 22 | 23 | * allow opt-out of `define()` ([5251dfd](https://github.com/andreruffert/syntax-highlight-element/commit/5251dfdbfe57ca112ad7088bd0a3d1c384d4f539)) 24 | * config languages ([aecd27e](https://github.com/andreruffert/syntax-highlight-element/commit/aecd27e277d476ebed23a36ea3b037926f15e81e)) 25 | 26 | 27 | 28 | # [1.0.0-rc.5](https://github.com/andreruffert/syntax-highlight-element/compare/v1.0.0-rc.4...v1.0.0-rc.5) (2025-02-24) 29 | 30 | 31 | ### Code Refactoring 32 | 33 | * change global namespace ([5b2ab40](https://github.com/andreruffert/syntax-highlight-element/commit/5b2ab4094b83ef0659320aa60d2efe6308d94044)) 34 | * element define ([5be25be](https://github.com/andreruffert/syntax-highlight-element/commit/5be25be006bc030bb5633c47b8887ebdca6a3bb9)) 35 | 36 | 37 | ### BREAKING CHANGES 38 | 39 | * - change global namespace from `window.SyntaxHighlightElement` to `window.she` (window.she.config) 40 | - expose the element itself with `window.SyntaxHighlightElement` instead of `window.SyntaxHighlightElement.element` 41 | * `config.extendTokenTypes` got renamed to `config.languageTokens` 42 | 43 | 44 | 45 | # [1.0.0-rc.4](https://github.com/andreruffert/syntax-highlight-element/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2025-02-23) 46 | 47 | 48 | ### Features 49 | 50 | * introduce "themes/prism.css" ([f2fbd5b](https://github.com/andreruffert/syntax-highlight-element/commit/f2fbd5b6681ede5bfe63b493fed9828159ac5c68)) 51 | 52 | 53 | 54 | # [1.0.0-rc.3](https://github.com/andreruffert/syntax-highlight-element/compare/v1.0.0-rc.2...v1.0.0-rc.3) (2025-02-19) 55 | 56 | 57 | ### Bug Fixes 58 | 59 | * ReferenceError: loadPrism is not defined ([21eff35](https://github.com/andreruffert/syntax-highlight-element/commit/21eff35ba4cade6907d5106867c359e88913c2ba)) 60 | 61 | 62 | 63 | # [1.0.0-rc.2](https://github.com/andreruffert/syntax-highlight-element/compare/v1.0.0-rc.1...v1.0.0-rc.2) (2025-02-19) 64 | 65 | 66 | ### Features 67 | 68 | * introduce "content-selector" ([682072a](https://github.com/andreruffert/syntax-highlight-element/commit/682072a61e155e1c1c62dbfd346807acb1d41264)) 69 | * introduce `clearTokenHighlights` method ([5bf680e](https://github.com/andreruffert/syntax-highlight-element/commit/5bf680e46a3c25eed36a458c360c9eb8e4925993)) 70 | * introduce `update` method ([c13ac50](https://github.com/andreruffert/syntax-highlight-element/commit/c13ac5027f796cb05d436644eb4204da141bafd9)) 71 | * make element focusable ([1689be1](https://github.com/andreruffert/syntax-highlight-element/commit/1689be193cb07f06ce359e6636243a0e06d7c3b5)) 72 | 73 | 74 | 75 | # [1.0.0-rc.1](https://github.com/andreruffert/syntax-highlight-element/compare/b481d235d58f115e98e4cf67c95b8b3eaecbf6ec...v1.0.0-rc.1) (2025-02-12) 76 | 77 | 78 | ### Bug Fixes 79 | 80 | * semantic html with role="code" ([b481d23](https://github.com/andreruffert/syntax-highlight-element/commit/b481d235d58f115e98e4cf67c95b8b3eaecbf6ec)) 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) André Ruffert <andreruffert.com> 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 | # <syntax-highlight> element 2 | 3 | > Syntax Highlighting using the CSS Custom Highlight API. 4 | 5 | [](https://github.com/andreruffert/syntax-highlight-element/actions/workflows/test.yml) 6 | [](https://www.npmjs.com/package/syntax-highlight-element) 7 | [](https://www.npmjs.com/package/syntax-highlight-element) 8 | [](https://www.jsdelivr.com/package/npm/syntax-highlight-element) 9 | 10 | The code is highlighted without having to wrap a bunch of `<span>` elements around each token, thanks to [Prism][prism_github]'s tokenizer and the [CSS Custom Highlight API][MDN_CSS_Custom_Highlight_API]. 11 | 12 | <div align="center"> 13 | <br> 14 | <br> 15 | <img src="media/cover.png" alt="Screenshot of the <syntax-highlight> element demo in the browser with DevTools open"> 16 | <br> 17 | <br> 18 | </div> 19 | 20 | ## Install 21 | 22 | Install via npm 23 | 24 | ```shell 25 | npm install syntax-highlight-element 26 | ``` 27 | 28 | ## Usage 29 | 30 | ### JavaScript 31 | 32 | Import as ES module 33 | 34 | ```js 35 | import 'syntax-highlight-element'; 36 | ``` 37 | 38 | Or via CDN 39 | 40 | ```html 41 | <script type="module" src="https://cdn.jsdelivr.net/npm/syntax-highlight-element@1/+esm"></script> 42 | ``` 43 | 44 | ### HTML 45 | 46 | ```html 47 | <syntax-highlight language="js"> 48 | // ... 49 | </syntax-highlight> 50 | ``` 51 | 52 | ### CSS 53 | 54 | Make sure to load a theme e.g. `syntax-highlight-element/themes/prettylights.css`. 55 | 56 | Or via CDN 57 | 58 | ```html 59 | <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/syntax-highlight-element@1/dist/themes/prettylights.min.css"> 60 | ``` 61 | 62 | Currently there are only limited [themes](https://github.com/andreruffert/syntax-highlight-element/tree/main/src/themes) available/converted. You can always create your own theme. Contributions are also very welcome. 63 | 64 | ## Attributes 65 | 66 | * `language` The code language. The default is `plaintext`. Default suported languages `html|css|js`. 67 | * `content-selector` A CSS selector to specify the content element. The default is the element itself. 68 | 69 | ## Configuration 70 | ```js 71 | /** 72 | * @typedef Config 73 | * @type {object} 74 | * @property {string[]} [languages=['markup', 'css', 'javascript']] - Language grammars to highlight. 75 | * @property {{ [key: string]: string[] }} languageTokens - Language specific token types. 76 | */ 77 | window.she = window.she || {}; 78 | /** @type {Config} */ 79 | window.she.config = {}; 80 | ``` 81 | 82 | Full list of all [languages supported](https://prismjs.com/#supported-languages) by the prism tokenizer. 83 | 84 | ## Examples 85 | 86 | For examples checkout the [CodePen <syntax-highlight> collection](https://codepen.io/collection/EPYpMJ). 87 | 88 | ## Browser Support 89 | 90 | <picture> 91 | <source media="(prefers-color-scheme: dark)" srcset="https://web-platform-dx.github.io/web-features/assets/img/baseline-newly-word-dark.svg"> 92 | <img src="https://web-platform-dx.github.io/web-features/assets/img/baseline-newly-word.svg" width="224" height="63" alt="Baseline newly availability wordmark"> 93 | </picture> 94 | 95 | - [CSS Custom Highlight API][caniuse_mdn-api_highlight] 96 | 97 | ## Credits 98 | 99 | * [Bramus Van Damme][bramus_github] and his [blog post][bramus_blog_post] where I first read about using the [CSS Custom Highlight API][MDN_CSS_Custom_Highlight_API] for syntax highlighting. 100 | * [Prism][prism_github]'s tokenizer. 101 | 102 | ## License 103 | 104 | Distributed under the MIT license. See LICENSE for details. 105 | 106 | © [André Ruffert](https://andreruffert.com) 107 | 108 | [prism_github]: https://github.com/PrismJS/prism 109 | [bramus_github]: https://github.com/bramus 110 | [bramus_blog_post]: https://www.bram.us/2024/02/18/custom-highlight-api-for-syntax-highlighting 111 | [MDN_CSS_Custom_Highlight_API]: https://developer.mozilla.org/en-US/docs/Web/API/CSS_Custom_Highlight_API 112 | [caniuse_mdn-api_highlight]: https://caniuse.com/mdn-api_highlight 113 | -------------------------------------------------------------------------------- /biome.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://biomejs.dev/schemas/2.0.4/schema.json", 3 | "vcs": { 4 | "enabled": true, 5 | "clientKind": "git", 6 | "useIgnoreFile": true 7 | }, 8 | "files": { 9 | "ignoreUnknown": false, 10 | "includes": ["**"] 11 | }, 12 | "formatter": { 13 | "includes": ["**", "!**/package.json"], 14 | "enabled": true, 15 | "indentStyle": "space", 16 | "indentWidth": 2, 17 | "lineWidth": 100 18 | }, 19 | "assist": { "actions": { "source": { "organizeImports": "on" } } }, 20 | "linter": { 21 | "enabled": true, 22 | "rules": { 23 | "recommended": true, 24 | "style": { 25 | "noParameterAssign": "error", 26 | "useAsConstAssertion": "error", 27 | "useDefaultParameterLast": "error", 28 | "useEnumInitializers": "error", 29 | "useSelfClosingElements": "error", 30 | "useSingleVarDeclarator": "error", 31 | "noUnusedTemplateLiteral": "error", 32 | "useNumberNamespace": "error", 33 | "noInferrableTypes": "error", 34 | "noUselessElse": "error" 35 | } 36 | } 37 | }, 38 | "javascript": { 39 | "formatter": { 40 | "quoteStyle": "single" 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | <!doctype html> 2 | <html lang="en"> 3 | <head> 4 | <meta charset="utf-8"> 5 | <title><syntax-highlight> element - Web Component</title> 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> 7 | 8 | <meta name="author" content="André Ruffert"> 9 | <meta name="description" content="A <syntax-highlight> web component that uses the CSS Custom Highlight API."> 10 | <meta name="keywords" content="syntax highlighting,syntax,highlight,css custom highlight api,custom element,web component"> 11 | 12 | <meta name="og:title" content="<syntax-highlight> element - Web Component"> 13 | <meta name="og:type" content="website"> 14 | <meta name="og:url" content="https://andreruffert.github.io/syntax-highlight-element/"> 15 | <meta property="og:image" content="https://repository-images.githubusercontent.com/931295844/5db86502-b221-4e23-b9cb-6a29e7afe71f"> 16 | <meta property="og:image:alt" content="👓 Syntax Highlighting using the CSS Custom Highlight API - andreruffert/syntax-highlight-element"> 17 | 18 | <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>👓</text></svg>"> 19 | 20 | <link rel="stylesheet" href="./style.css"> 21 | <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/syntax-highlight-element@1/dist/themes/prettylights.min.css" data-she-theme> 22 | <script> 23 | // Ensure the event listener is setup before the initial `color-scheme-switch` event gets fired. 24 | document.addEventListener('color-scheme-switch', event => { 25 | const colorScheme = event.target.value; 26 | document.documentElement.style.setProperty('color-scheme', colorScheme); 27 | event.target.querySelector('.icon use').setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", colorScheme === 'light' ? '#sun' : '#moon'); 28 | event.target.setAttribute('aria-label', `Switch to ${colorScheme === 'light' ? 'dark' : 'light'} color scheme`) 29 | }); 30 | 31 | // Optional: language specific token type overwrites 32 | window.she = window.she || {}; 33 | window.she.config = { 34 | languages: ['markup', 'css', 'javascript'], 35 | languageTokens: { 36 | css: ['important'], 37 | } 38 | } 39 | </script> 40 | <script type="module" async blocking="render" src="https://cdn.jsdelivr.net/npm/color-scheme-switch-element/+esm"></script> 41 | </head> 42 | <body> 43 | <div class="alert" data-alert="no-support" hidden> 44 | <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M16 16s-1.5-2-4-2-4 2-4 2"/><line x1="9" x2="9.01" y1="9" y2="9"/><line x1="15" x2="15.01" y1="9" y2="9"/></svg> 45 | <p>The <a href="https://caniuse.com/mdn-api_highlight" target="_blank" rel="noreferrer">CSS Custom Highlight API</a> is not supported in this browser.</p> 46 | </div> 47 | <header> 48 | <div class="header-links"> 49 | <a href="https://andreruffert.com" target="_blank"><svg xmlns="http://www.w3.org/2000/svg" width="1.2em" height="1.2em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m12 19-7-7 7-7"/><path d="M19 12H5"/></svg>Made by André Ruffert</a> 50 | <a href="https://github.com/andreruffert/syntax-highlight-element" target="_blank" rel="noreferrer">Source on GitHub <svg xmlns="http://www.w3.org/2000/svg" width="1.2em" height="1.2em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"/><path d="M9 18c-4.51 2-5-2-7-2"/></svg></a> 51 | </div> 52 | 53 | <color-scheme-switch class="button" title="Toggle light & dark color scheme"> 54 | <svg class="icon" width="1.2em" height="1.2em"><use xlink:href="#sun"></use></svg> 55 | </color-scheme-switch> 56 | </header> 57 | <main> 58 | <section data-section="intro"> 59 | <span class="emoji" aria-hidden="true">👓</span> 60 | <span class="heading"><syntax-highlight></span> 61 | <h1 class="tagline">A custom element that uses the CSS Custom Highlight API for syntax highlighting</h1> 62 | <p class="badges"> 63 | <a href="https://www.npmjs.com/package/syntax-highlight-element" target="_blank" rel="noreferrer"> 64 | <img src="https://img.shields.io/npm/v/syntax-highlight-element?color=32A9C3&labelColor=1B3C4A" height="20" alt="npm version" /> 65 | </a> 66 | <a href="https://www.npmjs.com/package/syntax-highlight-element" target="_blank" rel="noreferrer"><img src="https://img.shields.io/npm/dm/syntax-highlight-element?logo=npm&color=32A9C3&labelColor=1B3C4A" height="20" alt="npm downloads"></a> 67 | <a href="https://www.jsdelivr.com/package/npm/syntax-highlight-element" target="_blank" rel="noreferrer"> 68 | <img src="https://img.shields.io/jsdelivr/npm/hm/syntax-highlight-element?color=32A9C3&labelColor=1B3C4A" height="20" alt="jsDelivr hits (npm)"> 69 | </a> 70 | 71 | </p> 72 | <div class="copy-code-container"> 73 | <div class="copy-code"> 74 | <syntax-highlight id="copy-npm-install">npm install syntax-highlight-element</syntax-highlight> 75 | <clipboard-copy for="copy-npm-install" class="button" aria-label="Copy content"> 76 | <svg class="icon" width="1em" height="1em" aria-hidden="true"><use xlink:href="#copy"></use></svg> 77 | </clipboard-copy> 78 | </div> 79 | </div> 80 | </section> 81 | 82 | <section data-section="playground"> 83 | <h2 class="playground-title">Demo Playground</h2> 84 | <div class="menubar"> 85 | <label class="menubar__item"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/></svg> 86 | <select aria-label="Code language" id="example-language-select" disabled></select> 87 | </label> 88 | <label class="menubar__item"> 89 | <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 2v2"/><path d="M14 2v4"/><path d="M17 2a1 1 0 0 1 1 1v9H6V3a1 1 0 0 1 1-1z"/><path d="M6 12a1 1 0 0 0-1 1v1a2 2 0 0 0 2 2h2a1 1 0 0 1 1 1v2.9a2 2 0 1 0 4 0V17a1 1 0 0 1 1-1h2a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1"/></svg> 90 | <select aria-label="Theme" id="theme-preset-select" disabled></select> 91 | </label> 92 | </div> 93 | <div class="playground-code" data-loading> 94 | <div class="loader"></div> 95 | <syntax-highlight language="html"></syntax-highlight> 96 | </div> 97 | </section> 98 | 99 | <section data-section="content"> 100 | <h1>Installation & Usage</h1> 101 | <article> 102 | <h2>Install</h2> 103 | <p>Install via npm</p> 104 | <div class="copy-code"> 105 | <syntax-highlight id="copy-install-npm">npm install syntax-highlight-element</syntax-highlight> 106 | <clipboard-copy for="copy-install-npm" class="button" aria-label="Copy content"> 107 | <svg class="icon" width="1em" height="1em" aria-hidden="true"><use xlink:href="#copy"></use></svg> 108 | </clipboard-copy> 109 | </div> 110 | </article> 111 | <article> 112 | <h2>Usage</h2> 113 | <h3>JavaScript</h3> 114 | <p>Import as ES module</p> 115 | <div class="copy-code"> 116 | <syntax-highlight language="js" id="copy-usage-import-js">import 'syntax-highlight-element';</syntax-highlight> 117 | <clipboard-copy for="copy-usage-import-js" class="button" aria-label="Copy content"> 118 | <svg class="icon" width="1em" height="1em" aria-hidden="true"><use xlink:href="#copy"></use></svg> 119 | </clipboard-copy> 120 | </div> 121 | <p>Or via CDN</p> 122 | <div class="copy-code"> 123 | <syntax-highlight language="html" id="copy-usage-cdn-js"><script type="module" src="https://cdn.jsdelivr.net/npm/syntax-highlight-element@1/+esm"></script></syntax-highlight> 124 | <clipboard-copy for="copy-usage-cdn-js" class="button" aria-label="Copy content"> 125 | <svg class="icon" width="1em" height="1em" aria-hidden="true"><use xlink:href="#copy"></use></svg> 126 | </clipboard-copy> 127 | </div> 128 | <h3>HTML</h3> 129 | <div class="copy-code"> 130 | <syntax-highlight language="html" id="copy-usage-html"><syntax-highlight language="js"> 131 | // ... 132 | </syntax-highlight></syntax-highlight> 133 | <clipboard-copy for="copy-usage-html" class="button" aria-label="Copy content"> 134 | <svg class="icon" width="1em" height="1em" aria-hidden="true"><use xlink:href="#copy"></use></svg> 135 | </clipboard-copy> 136 | </div> 137 | <h3>CSS</h3> 138 | <p>Make sure to load a theme e.g. <code>syntax-highlight-element/themes/prettylights.css</code>.</p> 139 | <p>Or via CDN</p> 140 | <div class="copy-code"> 141 | <syntax-highlight language="html" id="copy-usage-cdn-css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/syntax-highlight-element@1/dist/themes/prettylights.min.css"></syntax-highlight> 142 | <clipboard-copy for="copy-usage-cdn-css" class="button" aria-label="Copy content"> 143 | <svg class="icon" width="1em" height="1em" aria-hidden="true"><use xlink:href="#copy"></use></svg> 144 | </clipboard-copy> 145 | </div> 146 | <p>Currently there are only limited <a href="https://github.com/andreruffert/syntax-highlight-element/tree/main/src/themes" target="_blank" rel="noreferrer">themes</a> available/converted. You can always create your own theme. Contributions are also very welcome.</p> 147 | </article> 148 | </section> 149 | 150 | <section data-section="content"> 151 | <h1>Attributes</h1> 152 | <ul> 153 | <li><code>language</code> The syntax language. The default is <code>plaintext</code>. Default suported languages <code>html|css|js</code>. 154 | <li><code>content-selector</code> A CSS selector to specify the content element. The default is the element itself. 155 | </ul> 156 | </section> 157 | 158 | <section data-section="content"> 159 | <h1>Configuration</h1> 160 | <div class="copy-code"> 161 | <syntax-highlight language="js" id="copy-config">/** 162 | * @typedef Config 163 | * @type {object} 164 | * @property {string[]} [languages=['markup', 'css', 'javascript']] - Language grammars to highlight. 165 | * @property {{ [key: string]: string[] }} languageTokens - Language specific token types. 166 | */ 167 | window.she = window.she || {}; 168 | /** @type {Config} */ 169 | window.she.config = {};</syntax-highlight> 170 | <clipboard-copy for="copy-config" class="button" aria-label="Copy content"> 171 | <svg class="icon" width="1em" height="1em" aria-hidden="true"><use xlink:href="#copy"></use></svg> 172 | </clipboard-copy> 173 | </div> 174 | <p>Full list of all <a href="https://prismjs.com/#supported-languages" target="_blank" rel="noreferrer">languages supported</a> by the prism tokenizer.</p> 175 | </section> 176 | 177 | <section data-section="content"> 178 | <h1>Examples</h1> 179 | <p>For more examples checkout the CodePen <a href="https://codepen.io/collection/EPYpMJ" target="_blank" rel="noreferrer"><syntax-highlight> collection</a>.</p> 180 | </section> 181 | 182 | <section data-section="content"> 183 | <h1>Credits</h1> 184 | <ul> 185 | <li><a href="https://github.com/bramus" target="_blank" rel="noreferrer">Bramus Van Damme</a> and his <a href="https://www.bram.us/2024/02/18/custom-highlight-api-for-syntax-highlighting" target="_blank">blog post</a> where I first read about using the <a href="https://developer.mozilla.org/en-US/docs/Web/API/CSS_Custom_Highlight_API" target="_blank">CSS Custom Highlight API</a> for syntax highlighting. 186 | <li><a href="https://github.com/PrismJS/prism" target="_blank" rel="noreferrer">Prism</a>'s tokenizer. 187 | </ul> 188 | </section> 189 | </main> 190 | 191 | <footer> 192 | <p>An <a href="https://github.com/andreruffert" target="_blank">open source</a> project by <a href="https://andreruffert.com" target="_blank">André Ruffert</a> ©.</p> 193 | <p>Released under the MIT License.</p> 194 | </footer> 195 | 196 | <div class="toast" popover></div> 197 | 198 | <svg width="0" height="0" aria-hidden="true" hidden> 199 | <symbol xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" id="sun"> 200 | <circle cx="12" cy="12" r="4"></circle> 201 | <path d="M12 2v2"></path> 202 | <path d="M12 20v2"></path> 203 | <path d="m4.93 4.93 1.41 1.41"></path> 204 | <path d="m17.66 17.66 1.41 1.41"></path> 205 | <path d="M2 12h2"></path> 206 | <path d="M20 12h2"></path> 207 | <path d="m6.34 17.66-1.41 1.41"></path> 208 | <path d="m19.07 4.93-1.41 1.41"></path> 209 | </symbol> 210 | <symbol xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" id="moon"> 211 | <path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"></path> 212 | </symbol> 213 | <symbol xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" id="copy"> 214 | <rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/> 215 | </symbol> 216 | <symbol xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" id="check"> 217 | <path d="M20 6 9 17l-5-5"/> 218 | </symbol> 219 | </svg> 220 | 221 | <script type="module"> 222 | import 'https://cdn.jsdelivr.net/npm/syntax-highlight-element@1/+esm'; 223 | 224 | import { languageExamples, fetchFileContent } from './language-examples.js' 225 | import { themePresets } from './theme-presets.js'; 226 | 227 | const DEFAULT_LANGUAGE_EXAMPLE = 'JS'; 228 | const SUPPORTS_CSS_HIGHLIGHTS = Boolean(CSS.highlights); 229 | 230 | document.addEventListener('DOMContentLoaded', async () => { 231 | if (!SUPPORTS_CSS_HIGHLIGHTS) { 232 | document.querySelector('[data-alert="no-support"]').removeAttribute('hidden') 233 | } 234 | 235 | /** 236 | * Set initial language example 237 | */ 238 | const playgroundCode = document.querySelector('.playground-code syntax-highlight'); 239 | const defaultExample = languageExamples[DEFAULT_LANGUAGE_EXAMPLE]; 240 | const togglePlaygroundLoading = () => playgroundCode.parentElement.toggleAttribute('data-loading'); 241 | playgroundCode.innerHTML = await fetchFileContent(defaultExample.file, { escapeHtml: defaultExample?.escapeHtml }); 242 | playgroundCode.setAttribute('language', defaultExample.language); 243 | 244 | if (SUPPORTS_CSS_HIGHLIGHTS) { 245 | await customElements.whenDefined('syntax-highlight'); 246 | playgroundCode.update(); 247 | }; 248 | 249 | togglePlaygroundLoading(); 250 | 251 | /** 252 | * Language example switcher 253 | */ 254 | const languageSelector = document.querySelector('#example-language-select'); 255 | const languageOptions = Object.keys(languageExamples).map((name, index) => { 256 | const option = document.createElement('option'); 257 | option.value = option.textContent = name; 258 | option.selected = name === DEFAULT_LANGUAGE_EXAMPLE || !index; 259 | return option; 260 | }); 261 | languageOptions.forEach(option => languageSelector.append(option)); 262 | languageSelector.removeAttribute('disabled'); 263 | languageSelector.addEventListener('change', async event => { 264 | togglePlaygroundLoading(); 265 | playgroundCode.textContent = ''; 266 | const example = languageExamples[event.target.value]; 267 | const exampleContent = await fetchFileContent(example.file, { escapeHtml: example?.escapeHtml }); 268 | playgroundCode.innerHTML = exampleContent || 'Not found'; 269 | playgroundCode.setAttribute('language', example.language); 270 | 271 | if (SUPPORTS_CSS_HIGHLIGHTS) { 272 | playgroundCode.update(); 273 | }; 274 | 275 | togglePlaygroundLoading(); 276 | }); 277 | 278 | /** 279 | * Theme preset switcher 280 | */ 281 | const themeSelector = document.querySelector('#theme-preset-select'); 282 | const themeOptions = Object.keys(themePresets).map((name, index) => { 283 | const option = document.createElement('option'); 284 | option.value = option.textContent = name; 285 | option.selected = !index; 286 | return option 287 | }); 288 | themeOptions.forEach(option => themeSelector.append(option)); 289 | themeSelector.removeAttribute('disabled'); 290 | themeSelector.addEventListener('change', event => { 291 | togglePlaygroundLoading(); 292 | const oldThemeStyles = document.querySelector('[data-she-theme]'); 293 | const link = document.createElement('link'); 294 | link.rel = 'stylesheet'; 295 | link.dataset.sheTheme = ''; 296 | link.onload = () => { 297 | document.head.removeChild(oldThemeStyles); 298 | togglePlaygroundLoading(); 299 | } 300 | link.onerror = () => { 301 | const toast = document.querySelector('.toast'); 302 | toast.textContent = 'There was a problem loading the theme…' 303 | toast.showPopover(); 304 | togglePlaygroundLoading(); 305 | }; 306 | link.href = `https://cdn.jsdelivr.net/npm/syntax-highlight-element@latest/dist/themes/${themePresets[event.target.value]}.min.css`; 307 | document.head.appendChild(link); 308 | }); 309 | }); 310 | </script> 311 | 312 | <script type="module"> 313 | import 'https://cdn.jsdelivr.net/npm/@github/clipboard-copy-element@1.3.0/+esm'; 314 | 315 | document.addEventListener('clipboard-copy', event => { 316 | const button = event.target; 317 | const icon = button.querySelector('.icon use'); 318 | const defaultAriaLabel = button.getAttribute('aria-label'); 319 | button.setAttribute('aria-label', 'Copied!'); 320 | icon.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", '#check'); 321 | setTimeout(() => { 322 | button.setAttribute('aria-label', defaultAriaLabel); 323 | icon.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", '#copy'); 324 | }, 1800); 325 | }) 326 | </script> 327 | </body> 328 | </html> 329 | 330 | -------------------------------------------------------------------------------- /docs/language-examples.js: -------------------------------------------------------------------------------- 1 | export const languageExamples = { 2 | HTML: { 3 | language: 'html', 4 | escapeHtml: true, 5 | file: 'https://raw.githubusercontent.com/h5bp/html5-boilerplate/refs/heads/main/src/index.html', 6 | }, 7 | CSS: { 8 | language: 'css', 9 | file: 'https://raw.githubusercontent.com/h5bp/html5-boilerplate/refs/heads/main/dist/css/style.css', 10 | }, 11 | JS: { 12 | language: 'js', 13 | file: 'https://raw.githubusercontent.com/andreruffert/syntax-highlight-element/refs/heads/main/src/syntax-highlight-element.js', 14 | }, 15 | }; 16 | 17 | export async function fetchFileContent(url, options = { escapeHtml: false }) { 18 | try { 19 | const res = await fetch(url); 20 | const content = await res.text(); 21 | return options?.escapeHtml ? escapeHtml(content) : content; 22 | } catch (error) { 23 | console.error('error'); 24 | return error.message; 25 | } 26 | } 27 | 28 | /** 29 | * Escape HTML 30 | * @param {string} string - The html string to escape 31 | * @returns {string} 32 | */ 33 | function escapeHtml(html) { 34 | const placeholderElement = document.createElement('div'); 35 | return placeholderElement.appendChild(document.createTextNode(html)).parentNode.innerHTML; 36 | } 37 | -------------------------------------------------------------------------------- /docs/style.css: -------------------------------------------------------------------------------- 1 | @layer reset, tokens, syntax-highlight-element, layout; 2 | 3 | @layer reset { 4 | *, 5 | :after, 6 | :before { 7 | box-sizing: border-box; 8 | } 9 | body { 10 | margin: 0; 11 | } 12 | [hidden] { 13 | display: none !important; 14 | } 15 | } 16 | 17 | @layer layout { 18 | :root { 19 | font-family: var(--fonts-sans); 20 | line-height: 1.5; 21 | font-weight: 400; 22 | 23 | color-scheme: light dark; 24 | color: light-dark(var(--light-canvas-text), var(--dark-canvas-text)); 25 | background-color: light-dark(var(--light-canvas), var(--dark-canvas)); 26 | 27 | font-synthesis: none; 28 | text-rendering: optimizeLegibility; 29 | -webkit-font-smoothing: antialiased; 30 | -moz-osx-font-smoothing: grayscale; 31 | } 32 | 33 | body { 34 | display: grid; 35 | gap: var(--base-size-64); 36 | min-height: 100vh; 37 | } 38 | 39 | :focus-visible { 40 | outline-color: light-dark(var(--light-accent), var(--dark-accent)); 41 | } 42 | 43 | a { 44 | color: light-dark(var(--light-link-text), var(--dark-link-text)); 45 | text-decoration: inherit; 46 | } 47 | a:hover { 48 | /* text-decoration: underline; */ 49 | text-decoration-line: underline; 50 | text-decoration-style: wavy; 51 | text-decoration-thickness: 1px; 52 | text-underline-offset: 4px; 53 | } 54 | 55 | input { 56 | accent-color: light-dark(var(--light-accent), var(--dark-accent)); 57 | } 58 | 59 | select { 60 | appearance: unset; 61 | background-color: unset; 62 | border: 1px solid transparent; 63 | color: inherit; 64 | font-family: inherit; 65 | padding: var(--spacing-1\.5) var(--spacing-3); 66 | border-radius: 4px; 67 | transition-duration: 0.25s; 68 | transition-property: border-color; 69 | } 70 | select:not([disabled]):hover { 71 | border-color: light-dark(var(--light-accent), var(--dark-accent)); 72 | } 73 | 74 | syntax-highlight { 75 | color-scheme: inherit; 76 | } 77 | 78 | code { 79 | background-color: light-dark(var(--light-button-face), var(--dark-button-face)); 80 | border-radius: 0.25rem; 81 | padding: var(--spacing-0\.5) var(--spacing-1); 82 | } 83 | 84 | h1 { 85 | margin-block: 0; 86 | } 87 | 88 | button, 89 | .button { 90 | display: flex; 91 | align-items: center; 92 | justify-content: center; 93 | border-radius: 8px; 94 | border: 1px solid transparent; 95 | padding: 0.6em 1.2em; 96 | font-weight: 500; 97 | font-family: inherit; 98 | background-color: light-dark(var(--light-button-face), var(--dark-button-face)); 99 | cursor: pointer; 100 | user-select: none; 101 | transition-duration: 0.25s; 102 | transition-property: border-color, opacity, scale; 103 | } 104 | button:hover, 105 | .button:hover { 106 | border-color: light-dark(var(--light-accent), var(--dark-accent)); 107 | color: light-dark(var(--light-accent), var(--dark-accent)); 108 | scale: 1.1; 109 | } 110 | 111 | .alert { 112 | background-color: light-dark(var(--light-canvas), var(--dark-canvas)); 113 | position: sticky; 114 | top: env(safe-area-inset-top, 0); 115 | z-index: 1; 116 | display: flex; 117 | flex-direction: column; 118 | align-items: center; 119 | text-align: center; 120 | text-wrap: balance; 121 | gap: var(--spacing-2); 122 | padding: var(--spacing-6) var(--spacing-4); 123 | border-block-end: 3px solid light-dark(var(--light-accent), var(--dark-accent)); 124 | 125 | p { 126 | margin: 0; 127 | } 128 | } 129 | 130 | header { 131 | display: flex; 132 | align-items: center; 133 | justify-content: flex-end; 134 | flex-wrap: wrap; 135 | gap: var(--spacing-5); 136 | background-color: light-dark(var(--light-button-face-muted), var(--dark-button-face-muted)); 137 | border-block-end: 1px solid light-dark(var(--light-button-face), var(--dark-button-face)); 138 | padding: var(--spacing-6) var(--spacing-4); 139 | 140 | color-scheme-switch.button { 141 | padding: var(--spacing-2); 142 | aspect-ratio: 1; 143 | align-self: flex-start; 144 | } 145 | } 146 | 147 | .header-links { 148 | font-size: 0.9rem; 149 | display: flex; 150 | flex-wrap: wrap; 151 | flex: 1; 152 | gap: var(--spacing-5); 153 | container-type: inline-size; 154 | 155 | a { 156 | color: inherit; 157 | display: inline-flex; 158 | align-items: center; 159 | gap: var(--spacing-2); 160 | text-wrap: nowrap; 161 | width: 100%; 162 | } 163 | 164 | a:first-of-type { 165 | margin-inline-end: auto; 166 | } 167 | 168 | svg { 169 | display: none; 170 | } 171 | } 172 | 173 | @container (min-width: 400px) { 174 | .header-links a { 175 | width: auto; 176 | } 177 | 178 | .header-links svg { 179 | display: initial; 180 | } 181 | } 182 | 183 | main { 184 | display: flex; 185 | flex-direction: column; 186 | gap: var(--spacing-10); 187 | margin-inline: auto; 188 | max-inline-size: var(--sizes-5xl); 189 | inline-size: var(--sizes-full); 190 | padding-inline: var(--spacing-4); 191 | padding-block: var(--spacing-24); 192 | } 193 | 194 | footer { 195 | border-block-start: 1px solid light-dark(var(--light-button-face), var(--dark-button-face)); 196 | text-align: center; 197 | margin-inline: auto; 198 | margin-block-start: auto; 199 | inline-size: var(--sizes-full); 200 | padding: var(--spacing-8) var(--spacing-4); 201 | 202 | p { 203 | margin: 0; 204 | } 205 | } 206 | 207 | .copy-code { 208 | display: flex; 209 | position: relative; 210 | inline-size: 0; 211 | min-inline-size: 100%; 212 | 213 | syntax-highlight { 214 | flex: 1; 215 | border-radius: 0.6rem; 216 | padding: var(--spacing-4); 217 | line-height: 1.6; /* fixed line-height no matter which theme is loaded */ 218 | } 219 | 220 | .button { 221 | opacity: 0; 222 | position: absolute; 223 | inset-inline-end: var(--spacing-2); 224 | inset-block-start: var(--spacing-2); 225 | padding: var(--spacing-2); 226 | aspect-ratio: 1; 227 | } 228 | } 229 | 230 | .copy-code:hover .button, 231 | .copy-code:focus-within .button { 232 | opacity: 1; 233 | } 234 | 235 | /* Intro */ 236 | [data-section="intro"] { 237 | display: flex; 238 | flex-direction: column; 239 | align-items: center; 240 | gap: var(--spacing-4); 241 | text-align: center; 242 | text-wrap: balance; 243 | padding-block-end: var(--spacing-24); 244 | 245 | .emoji { 246 | font-size: clamp(2rem, 2vw + 2rem, 5rem); 247 | line-height: 1; 248 | } 249 | 250 | .heading { 251 | color: light-dark(var(--light-accent), var(--dark-accent)); 252 | font-size: clamp(1.5rem, 2vw + 1.5rem, 3rem); 253 | font-weight: bold; 254 | line-height: 1.1; 255 | display: flex; 256 | flex-direction: column; 257 | margin: 0; 258 | } 259 | 260 | .tagline { 261 | font-size: clamp(1rem, 2vw, 1.25rem); 262 | font-weight: normal; 263 | margin: 0; 264 | } 265 | 266 | .badges { 267 | display: flex; 268 | justify-content: center; 269 | flex-wrap: wrap; 270 | gap: 0.5rem; 271 | font-size: 0; 272 | padding-block-start: var(--spacing-6); 273 | } 274 | 275 | .copy-code-container { 276 | text-align: initial; 277 | max-inline-size: var(--sizes-md); 278 | inline-size: var(--sizes-full); 279 | padding-block-start: var(--spacing-6); 280 | } 281 | } 282 | 283 | /* Demo playground */ 284 | [data-section="playground"] { 285 | display: grid; 286 | padding: var(--spacing-3); 287 | border: 1px solid light-dark(var(--light-button-face), var(--dark-button-face)); 288 | border-radius: 0.6rem; 289 | box-shadow: 290 | 0 1px 3px 0 rgba(0, 0, 0, 0.1), 291 | 0 1px 2px -1px rgba(0, 0, 0, 0.1); 292 | 293 | .playground-title { 294 | background-color: light-dark(var(--light-button-face), var(--dark-button-face)); 295 | border-radius: 0.4rem; 296 | font-size: 85%; 297 | font-weight: 400; 298 | line-height: 1; 299 | text-align: center; 300 | margin: 0; 301 | padding: var(--spacing-2); 302 | } 303 | 304 | .menubar { 305 | display: flex; 306 | gap: var(--spacing-4); 307 | padding: var(--spacing-4); 308 | overflow: auto; 309 | } 310 | .menubar:has([disabled]) { 311 | opacity: 0.4; 312 | } 313 | .menubar__item { 314 | display: flex; 315 | gap: var(--spacing-2); 316 | align-items: center; 317 | min-width: 12ch; 318 | } 319 | .menubar__item select { 320 | font-size: 1rem; 321 | flex: 1; 322 | } 323 | 324 | .playground-code { 325 | inline-size: 0; 326 | min-inline-size: 100%; 327 | border-radius: 0.4rem; 328 | position: relative; 329 | } 330 | 331 | .playground-code .loader { 332 | mix-blend-mode: exclusion; 333 | width: fit-content; 334 | font-family: monospace; 335 | font-size: 1rem; 336 | clip-path: inset(0 3ch 0 0); 337 | opacity: 0; 338 | pointer-events: none; 339 | position: absolute; 340 | inset-inline-end: var(--spacing-4); 341 | inset-block-start: var(--spacing-4); 342 | transition: opacity 0.25s; 343 | } 344 | .playground-code .loader:before { 345 | content: "Loading..."; 346 | } 347 | 348 | .playground-code[data-loading] .loader { 349 | opacity: 1; 350 | animation: loader 1s steps(4) infinite; 351 | } 352 | .playground-code[data-loading] syntax-highlight { 353 | opacity: 0.4; 354 | } 355 | 356 | syntax-highlight { 357 | display: block; 358 | padding: var(--spacing-4); 359 | border-radius: inherit; 360 | overflow: auto; 361 | overscroll-behavior: contain; 362 | block-size: 60dvh; 363 | max-block-size: var(--sizes-xl); 364 | transition: opacity 0.25s; 365 | } 366 | } 367 | 368 | /* Content */ 369 | [data-section="content"] { 370 | display: flex; 371 | flex-direction: column; 372 | gap: var(--spacing-4); 373 | 374 | h1 { 375 | font-size: clamp(1.5rem, 2vw + 1rem, 2rem); 376 | line-height: 1.1; 377 | } 378 | 379 | h2 { 380 | font-size: clamp(1rem, 2vw + 0.75rem, 1.5rem); 381 | margin-block-start: var(--spacing-6); 382 | margin-block-end: var(--spacing-4); 383 | } 384 | 385 | p, 386 | li { 387 | text-wrap: balance; 388 | } 389 | 390 | li + li { 391 | margin-block-start: var(--spacing-2); 392 | } 393 | 394 | p, 395 | ul, 396 | .copy-code { 397 | margin-block-start: 0; 398 | margin-block-end: var(--spacing-4); 399 | } 400 | } 401 | 402 | .toast { 403 | background-color: light-dark(var(--light-button-face), var(--dark-button-face)); 404 | border: 1px solid light-dark(var(--light-button-face), var(--dark-button-face)); 405 | border-radius: 0.4rem; 406 | font-size: 85%; 407 | box-shadow: 408 | 0 1px 3px 0 rgba(0, 0, 0, 0.1), 409 | 0 1px 2px -1px rgba(0, 0, 0, 0.1); 410 | padding: var(--spacing-4) var(--spacing-4); 411 | width: var(--sizes-xs); 412 | margin: unset; 413 | inset: unset; 414 | inset-inline-end: var(--spacing-8); 415 | inset-block-end: var(--spacing-8); 416 | opacity: 0; 417 | transform: translateY(100%); 418 | transition: 419 | opacity 0.25s, 420 | transform 0.25s; 421 | } 422 | 423 | .toast:popover-open { 424 | transform: translateY(0); 425 | opacity: 1; 426 | 427 | @starting-style { 428 | /* biome-ignore lint/suspicious/noDuplicateProperties: reason */ 429 | opacity: 0; 430 | transform: translateY(100%); 431 | } 432 | } 433 | 434 | @keyframes loader { 435 | to { 436 | clip-path: inset(0 -1ch 0 0); 437 | } 438 | } 439 | } 440 | 441 | @layer tokens { 442 | :where(:root) { 443 | --spacing-0: 0rem; 444 | --spacing-0\.5: 0.125rem; 445 | --spacing-1: 0.25rem; 446 | --spacing-1\.5: 0.375rem; 447 | --spacing-2: 0.5rem; 448 | --spacing-2\.5: 0.625rem; 449 | --spacing-3: 0.75rem; 450 | --spacing-3\.5: 0.875rem; 451 | --spacing-4: 1rem; 452 | --spacing-5: 1.25rem; 453 | --spacing-6: 1.5rem; 454 | --spacing-7: 1.75rem; 455 | --spacing-8: 2rem; 456 | --spacing-9: 2.25rem; 457 | --spacing-10: 2.5rem; 458 | --spacing-11: 2.75rem; 459 | --spacing-12: 3rem; 460 | --spacing-14: 3.5rem; 461 | --spacing-16: 4rem; 462 | --spacing-20: 5rem; 463 | --spacing-24: 6rem; 464 | --spacing-28: 7rem; 465 | --spacing-32: 8rem; 466 | 467 | --sizes-xs: 20rem; 468 | --sizes-sm: 24rem; 469 | --sizes-md: 28rem; 470 | --sizes-lg: 32rem; 471 | --sizes-xl: 36rem; 472 | --sizes-2xl: 42rem; 473 | --sizes-3xl: 48rem; 474 | --sizes-4xl: 56rem; 475 | --sizes-5xl: 64rem; 476 | --sizes-6xl: 72rem; 477 | --sizes-7xl: 80rem; 478 | --sizes-8xl: 90rem; 479 | --sizes-full: 100%; 480 | 481 | --fonts-sans: 482 | ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; 483 | --fonts-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", 484 | "Courier New", monospace; 485 | 486 | --dark-accent: #8cccd5; 487 | --dark-canvas: #0d1117; 488 | --dark-canvas-text: rgba(255, 255, 245, 0.86); 489 | --dark-link-text: var(--dark-accent); 490 | --dark-button-face: #151b23; 491 | 492 | --light-accent: #5086a1; 493 | --light-canvas: #ffffff; 494 | --light-canvas-text: #3c3c43; 495 | --light-link-text: var(--light-accent); 496 | --light-button-face: #f6f8fa; 497 | } 498 | } 499 | -------------------------------------------------------------------------------- /docs/theme-presets.js: -------------------------------------------------------------------------------- 1 | export const themePresets = { 2 | Prettylights: 'prettylights', 3 | Prism: 'prism', 4 | }; 5 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | <!doctype html> 2 | <html lang="en"> 3 | <head> 4 | <meta charset="UTF-8" /> 5 | <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>👓</text></svg>" /> 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 7 | <title><syntax-highlight> element</title> 8 | <link rel="stylesheet" href="/src/themes/prettylights.css"> 9 | <style> 10 | body { 11 | display: flex; 12 | flex-direction: column; 13 | gap: 1.5rem; 14 | } 15 | 16 | syntax-highlight { 17 | display: block; 18 | border-radius: 0.25rem; 19 | padding: 1rem; 20 | } 21 | 22 | syntax-highlight[data-inline] { 23 | display: inline; 24 | padding: unset; 25 | hyphens: unset; 26 | overflow: unset; 27 | line-height: inherit; 28 | white-space: break-spaces; 29 | padding: 0.15em 0.25em; 30 | } 31 | </style> 32 | <script> 33 | window.she = window.she || {}; 34 | window.she.config = { 35 | languages: ['markup', 'css', 'javascript', 'markdown'], 36 | // Optional: language specific token type overwrites 37 | languageTokens: { 38 | css: ['important'], 39 | md: ['title', 'list'], 40 | } 41 | } 42 | </script> 43 | </head> 44 | <body> 45 | <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. <syntax-highlight language="html" data-inline><syntax-highlight><!-- inline code --></syntax-highlight></syntax-highlight> Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et ma.</p> 46 | 47 | <syntax-highlight language="html"><!-- HTML --> 48 | <syntax-highlight language="html"> 49 | <!-- ... --> 50 | </syntax-highlight></syntax-highlight> 51 | 52 | <syntax-highlight language="js">// JS 53 | import SyntaxHighlightElement from 'syntax-highlight-element';</syntax-highlight> 54 | 55 | <syntax-highlight language="css" content-selector="style"><style style="display: block; outline: none;" contenteditable="plaintext-only" spellcheck="false">/* CSS */ 56 | @layer syntax-highlight-element { 57 | syntax-highlight { 58 | display: inline-block; 59 | font-family: monospace; 60 | white-space: pre; 61 | tab-size: 2; 62 | hyphens: none; 63 | line-height: 1.6; 64 | overflow-x: auto !important; 65 | } 66 | }</style></syntax-highlight> 67 | 68 | <syntax-highlight language="md"> 69 | <!-- ... --> 70 | # Heading 71 | 72 | ## 123 73 | 74 | __1__ 75 | 76 | 1. ordered list item 1 77 | 2. ordered list item 2 78 | 79 | - unordered list item 1 80 | - unordered list item 2 81 | </syntax-highlight> 82 | 83 | <script type="module" src="/src/index.js"></script> 84 | <script> 85 | document.addEventListener('DOMContentLoaded', () => { 86 | document.addEventListener('keyup', event => { 87 | if (!event.target.hasAttribute('contenteditable')) return; 88 | event.target.normalize(); 89 | event.target.closest('syntax-highlight').update(); 90 | }); 91 | }); 92 | </script> 93 | </body> 94 | </html> 95 | 96 | -------------------------------------------------------------------------------- /media/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andreruffert/syntax-highlight-element/f2467558417fbbfec146a5b173fdf77a63ef1926/media/cover.png -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "syntax-highlight-element", 3 | "version": "1.1.1", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "syntax-highlight-element", 9 | "version": "1.1.1", 10 | "license": "MIT", 11 | "devDependencies": { 12 | "@biomejs/biome": "2.0.4", 13 | "conventional-changelog-cli": "5.0.0", 14 | "vite": "7.0.2" 15 | }, 16 | "funding": { 17 | "url": "https://github.com/andreruffert/syntax-highlight-element?sponsor=1" 18 | } 19 | }, 20 | "node_modules/@babel/code-frame": { 21 | "version": "7.26.2", 22 | "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", 23 | "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", 24 | "dev": true, 25 | "license": "MIT", 26 | "dependencies": { 27 | "@babel/helper-validator-identifier": "^7.25.9", 28 | "js-tokens": "^4.0.0", 29 | "picocolors": "^1.0.0" 30 | }, 31 | "engines": { 32 | "node": ">=6.9.0" 33 | } 34 | }, 35 | "node_modules/@babel/helper-validator-identifier": { 36 | "version": "7.25.9", 37 | "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", 38 | "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", 39 | "dev": true, 40 | "license": "MIT", 41 | "engines": { 42 | "node": ">=6.9.0" 43 | } 44 | }, 45 | "node_modules/@biomejs/biome": { 46 | "version": "2.0.4", 47 | "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.0.4.tgz", 48 | "integrity": "sha512-DNA++xe+E7UugTvI/HhzSFl6OwrVgU8SIV0Mb2fPtWPk2/oTr4eOSA5xy1JECrvgJeYxurmUBOS49qxv/OUkrQ==", 49 | "dev": true, 50 | "license": "MIT OR Apache-2.0", 51 | "bin": { 52 | "biome": "bin/biome" 53 | }, 54 | "engines": { 55 | "node": ">=14.21.3" 56 | }, 57 | "funding": { 58 | "type": "opencollective", 59 | "url": "https://opencollective.com/biome" 60 | }, 61 | "optionalDependencies": { 62 | "@biomejs/cli-darwin-arm64": "2.0.4", 63 | "@biomejs/cli-darwin-x64": "2.0.4", 64 | "@biomejs/cli-linux-arm64": "2.0.4", 65 | "@biomejs/cli-linux-arm64-musl": "2.0.4", 66 | "@biomejs/cli-linux-x64": "2.0.4", 67 | "@biomejs/cli-linux-x64-musl": "2.0.4", 68 | "@biomejs/cli-win32-arm64": "2.0.4", 69 | "@biomejs/cli-win32-x64": "2.0.4" 70 | } 71 | }, 72 | "node_modules/@biomejs/cli-darwin-arm64": { 73 | "version": "2.0.4", 74 | "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.0.4.tgz", 75 | "integrity": "sha512-r5McIUMMiedwJ2rltuXhj0+w0W7IJLpkOS+OGCVZQQOOcrGY9gUSUmOo7O6Z7P0vlv5YYZkPbi+qR9MDDWRBSw==", 76 | "cpu": [ 77 | "arm64" 78 | ], 79 | "dev": true, 80 | "license": "MIT OR Apache-2.0", 81 | "optional": true, 82 | "os": [ 83 | "darwin" 84 | ], 85 | "engines": { 86 | "node": ">=14.21.3" 87 | } 88 | }, 89 | "node_modules/@biomejs/cli-darwin-x64": { 90 | "version": "2.0.4", 91 | "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.0.4.tgz", 92 | "integrity": "sha512-aV5Zc/3E3aXFbrjK1IgCMEQc+6PCkBL+NS+vtjoNM2VPFeM5OL5Q82BI4YZyPnebj+k42BPIoYtz0jJ95PGRRg==", 93 | "cpu": [ 94 | "x64" 95 | ], 96 | "dev": true, 97 | "license": "MIT OR Apache-2.0", 98 | "optional": true, 99 | "os": [ 100 | "darwin" 101 | ], 102 | "engines": { 103 | "node": ">=14.21.3" 104 | } 105 | }, 106 | "node_modules/@biomejs/cli-linux-arm64": { 107 | "version": "2.0.4", 108 | "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.0.4.tgz", 109 | "integrity": "sha512-nlJhf7DyuajMj+S7Ygum59cbrHvI/nSRvedfJcEIx4X7SsiZjpRUiC5XtEn77kg7NIKq/KqG5roQIHkmjuFHCw==", 110 | "cpu": [ 111 | "arm64" 112 | ], 113 | "dev": true, 114 | "license": "MIT OR Apache-2.0", 115 | "optional": true, 116 | "os": [ 117 | "linux" 118 | ], 119 | "engines": { 120 | "node": ">=14.21.3" 121 | } 122 | }, 123 | "node_modules/@biomejs/cli-linux-arm64-musl": { 124 | "version": "2.0.4", 125 | "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.0.4.tgz", 126 | "integrity": "sha512-cNukq2PthoOa7quqaKoEFz4Zd1pDPJGfTR5jVyk9Z9iFHEm6TI7+7eeIs3aYcEuuJPNFR9xhJ4Uj3E2iUWkV3A==", 127 | "cpu": [ 128 | "arm64" 129 | ], 130 | "dev": true, 131 | "license": "MIT OR Apache-2.0", 132 | "optional": true, 133 | "os": [ 134 | "linux" 135 | ], 136 | "engines": { 137 | "node": ">=14.21.3" 138 | } 139 | }, 140 | "node_modules/@biomejs/cli-linux-x64": { 141 | "version": "2.0.4", 142 | "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.0.4.tgz", 143 | "integrity": "sha512-jlzrNZ+OzN9wvp2RL3cl5Y4NiV7xSU+QV5A8bWXke1on3jKy7QbXajybSjVQ6aFw1gdrqkO/W8xV5HODhIMT4g==", 144 | "cpu": [ 145 | "x64" 146 | ], 147 | "dev": true, 148 | "license": "MIT OR Apache-2.0", 149 | "optional": true, 150 | "os": [ 151 | "linux" 152 | ], 153 | "engines": { 154 | "node": ">=14.21.3" 155 | } 156 | }, 157 | "node_modules/@biomejs/cli-linux-x64-musl": { 158 | "version": "2.0.4", 159 | "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.0.4.tgz", 160 | "integrity": "sha512-oWQALSbp8xF0t/wiHU2zdkZOpIHyaI9QxQv0Ytty9GAKsCGP6pczp8qyKD/P49iGJdDozHp5KiuQPxs33APhyA==", 161 | "cpu": [ 162 | "x64" 163 | ], 164 | "dev": true, 165 | "license": "MIT OR Apache-2.0", 166 | "optional": true, 167 | "os": [ 168 | "linux" 169 | ], 170 | "engines": { 171 | "node": ">=14.21.3" 172 | } 173 | }, 174 | "node_modules/@biomejs/cli-win32-arm64": { 175 | "version": "2.0.4", 176 | "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.0.4.tgz", 177 | "integrity": "sha512-/PbNhMJo9ONja7hOxLlifM/qgeHpRD9bF2flTz5KIrXnQqpuegaRuwP/HYdJ9TFkTKFjHkPLoE4onOz3HIT5CQ==", 178 | "cpu": [ 179 | "arm64" 180 | ], 181 | "dev": true, 182 | "license": "MIT OR Apache-2.0", 183 | "optional": true, 184 | "os": [ 185 | "win32" 186 | ], 187 | "engines": { 188 | "node": ">=14.21.3" 189 | } 190 | }, 191 | "node_modules/@biomejs/cli-win32-x64": { 192 | "version": "2.0.4", 193 | "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.0.4.tgz", 194 | "integrity": "sha512-dIM4SgO4/Rmsb4X7fwKtciQ682SZDSC1lm42uSM9gt8zNqBIeTaqsMc6eO1DpxYWMlAb/n2SML9+HUHmCib7NA==", 195 | "cpu": [ 196 | "x64" 197 | ], 198 | "dev": true, 199 | "license": "MIT OR Apache-2.0", 200 | "optional": true, 201 | "os": [ 202 | "win32" 203 | ], 204 | "engines": { 205 | "node": ">=14.21.3" 206 | } 207 | }, 208 | "node_modules/@conventional-changelog/git-client": { 209 | "version": "1.0.1", 210 | "resolved": "https://registry.npmjs.org/@conventional-changelog/git-client/-/git-client-1.0.1.tgz", 211 | "integrity": "sha512-PJEqBwAleffCMETaVm/fUgHldzBE35JFk3/9LL6NUA5EXa3qednu+UT6M7E5iBu3zIQZCULYIiZ90fBYHt6xUw==", 212 | "dev": true, 213 | "license": "MIT", 214 | "dependencies": { 215 | "@types/semver": "^7.5.5", 216 | "semver": "^7.5.2" 217 | }, 218 | "engines": { 219 | "node": ">=18" 220 | }, 221 | "peerDependencies": { 222 | "conventional-commits-filter": "^5.0.0", 223 | "conventional-commits-parser": "^6.0.0" 224 | }, 225 | "peerDependenciesMeta": { 226 | "conventional-commits-filter": { 227 | "optional": true 228 | }, 229 | "conventional-commits-parser": { 230 | "optional": true 231 | } 232 | } 233 | }, 234 | "node_modules/@esbuild/aix-ppc64": { 235 | "version": "0.25.0", 236 | "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.0.tgz", 237 | "integrity": "sha512-O7vun9Sf8DFjH2UtqK8Ku3LkquL9SZL8OLY1T5NZkA34+wG3OQF7cl4Ql8vdNzM6fzBbYfLaiRLIOZ+2FOCgBQ==", 238 | "cpu": [ 239 | "ppc64" 240 | ], 241 | "dev": true, 242 | "license": "MIT", 243 | "optional": true, 244 | "os": [ 245 | "aix" 246 | ], 247 | "engines": { 248 | "node": ">=18" 249 | } 250 | }, 251 | "node_modules/@esbuild/android-arm": { 252 | "version": "0.25.0", 253 | "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.0.tgz", 254 | "integrity": "sha512-PTyWCYYiU0+1eJKmw21lWtC+d08JDZPQ5g+kFyxP0V+es6VPPSUhM6zk8iImp2jbV6GwjX4pap0JFbUQN65X1g==", 255 | "cpu": [ 256 | "arm" 257 | ], 258 | "dev": true, 259 | "license": "MIT", 260 | "optional": true, 261 | "os": [ 262 | "android" 263 | ], 264 | "engines": { 265 | "node": ">=18" 266 | } 267 | }, 268 | "node_modules/@esbuild/android-arm64": { 269 | "version": "0.25.0", 270 | "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.0.tgz", 271 | "integrity": "sha512-grvv8WncGjDSyUBjN9yHXNt+cq0snxXbDxy5pJtzMKGmmpPxeAmAhWxXI+01lU5rwZomDgD3kJwulEnhTRUd6g==", 272 | "cpu": [ 273 | "arm64" 274 | ], 275 | "dev": true, 276 | "license": "MIT", 277 | "optional": true, 278 | "os": [ 279 | "android" 280 | ], 281 | "engines": { 282 | "node": ">=18" 283 | } 284 | }, 285 | "node_modules/@esbuild/android-x64": { 286 | "version": "0.25.0", 287 | "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.0.tgz", 288 | "integrity": "sha512-m/ix7SfKG5buCnxasr52+LI78SQ+wgdENi9CqyCXwjVR2X4Jkz+BpC3le3AoBPYTC9NHklwngVXvbJ9/Akhrfg==", 289 | "cpu": [ 290 | "x64" 291 | ], 292 | "dev": true, 293 | "license": "MIT", 294 | "optional": true, 295 | "os": [ 296 | "android" 297 | ], 298 | "engines": { 299 | "node": ">=18" 300 | } 301 | }, 302 | "node_modules/@esbuild/darwin-arm64": { 303 | "version": "0.25.0", 304 | "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.0.tgz", 305 | "integrity": "sha512-mVwdUb5SRkPayVadIOI78K7aAnPamoeFR2bT5nszFUZ9P8UpK4ratOdYbZZXYSqPKMHfS1wdHCJk1P1EZpRdvw==", 306 | "cpu": [ 307 | "arm64" 308 | ], 309 | "dev": true, 310 | "license": "MIT", 311 | "optional": true, 312 | "os": [ 313 | "darwin" 314 | ], 315 | "engines": { 316 | "node": ">=18" 317 | } 318 | }, 319 | "node_modules/@esbuild/darwin-x64": { 320 | "version": "0.25.0", 321 | "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.0.tgz", 322 | "integrity": "sha512-DgDaYsPWFTS4S3nWpFcMn/33ZZwAAeAFKNHNa1QN0rI4pUjgqf0f7ONmXf6d22tqTY+H9FNdgeaAa+YIFUn2Rg==", 323 | "cpu": [ 324 | "x64" 325 | ], 326 | "dev": true, 327 | "license": "MIT", 328 | "optional": true, 329 | "os": [ 330 | "darwin" 331 | ], 332 | "engines": { 333 | "node": ">=18" 334 | } 335 | }, 336 | "node_modules/@esbuild/freebsd-arm64": { 337 | "version": "0.25.0", 338 | "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.0.tgz", 339 | "integrity": "sha512-VN4ocxy6dxefN1MepBx/iD1dH5K8qNtNe227I0mnTRjry8tj5MRk4zprLEdG8WPyAPb93/e4pSgi1SoHdgOa4w==", 340 | "cpu": [ 341 | "arm64" 342 | ], 343 | "dev": true, 344 | "license": "MIT", 345 | "optional": true, 346 | "os": [ 347 | "freebsd" 348 | ], 349 | "engines": { 350 | "node": ">=18" 351 | } 352 | }, 353 | "node_modules/@esbuild/freebsd-x64": { 354 | "version": "0.25.0", 355 | "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.0.tgz", 356 | "integrity": "sha512-mrSgt7lCh07FY+hDD1TxiTyIHyttn6vnjesnPoVDNmDfOmggTLXRv8Id5fNZey1gl/V2dyVK1VXXqVsQIiAk+A==", 357 | "cpu": [ 358 | "x64" 359 | ], 360 | "dev": true, 361 | "license": "MIT", 362 | "optional": true, 363 | "os": [ 364 | "freebsd" 365 | ], 366 | "engines": { 367 | "node": ">=18" 368 | } 369 | }, 370 | "node_modules/@esbuild/linux-arm": { 371 | "version": "0.25.0", 372 | "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.0.tgz", 373 | "integrity": "sha512-vkB3IYj2IDo3g9xX7HqhPYxVkNQe8qTK55fraQyTzTX/fxaDtXiEnavv9geOsonh2Fd2RMB+i5cbhu2zMNWJwg==", 374 | "cpu": [ 375 | "arm" 376 | ], 377 | "dev": true, 378 | "license": "MIT", 379 | "optional": true, 380 | "os": [ 381 | "linux" 382 | ], 383 | "engines": { 384 | "node": ">=18" 385 | } 386 | }, 387 | "node_modules/@esbuild/linux-arm64": { 388 | "version": "0.25.0", 389 | "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.0.tgz", 390 | "integrity": "sha512-9QAQjTWNDM/Vk2bgBl17yWuZxZNQIF0OUUuPZRKoDtqF2k4EtYbpyiG5/Dk7nqeK6kIJWPYldkOcBqjXjrUlmg==", 391 | "cpu": [ 392 | "arm64" 393 | ], 394 | "dev": true, 395 | "license": "MIT", 396 | "optional": true, 397 | "os": [ 398 | "linux" 399 | ], 400 | "engines": { 401 | "node": ">=18" 402 | } 403 | }, 404 | "node_modules/@esbuild/linux-ia32": { 405 | "version": "0.25.0", 406 | "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.0.tgz", 407 | "integrity": "sha512-43ET5bHbphBegyeqLb7I1eYn2P/JYGNmzzdidq/w0T8E2SsYL1U6un2NFROFRg1JZLTzdCoRomg8Rvf9M6W6Gg==", 408 | "cpu": [ 409 | "ia32" 410 | ], 411 | "dev": true, 412 | "license": "MIT", 413 | "optional": true, 414 | "os": [ 415 | "linux" 416 | ], 417 | "engines": { 418 | "node": ">=18" 419 | } 420 | }, 421 | "node_modules/@esbuild/linux-loong64": { 422 | "version": "0.25.0", 423 | "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.0.tgz", 424 | "integrity": "sha512-fC95c/xyNFueMhClxJmeRIj2yrSMdDfmqJnyOY4ZqsALkDrrKJfIg5NTMSzVBr5YW1jf+l7/cndBfP3MSDpoHw==", 425 | "cpu": [ 426 | "loong64" 427 | ], 428 | "dev": true, 429 | "license": "MIT", 430 | "optional": true, 431 | "os": [ 432 | "linux" 433 | ], 434 | "engines": { 435 | "node": ">=18" 436 | } 437 | }, 438 | "node_modules/@esbuild/linux-mips64el": { 439 | "version": "0.25.0", 440 | "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.0.tgz", 441 | "integrity": "sha512-nkAMFju7KDW73T1DdH7glcyIptm95a7Le8irTQNO/qtkoyypZAnjchQgooFUDQhNAy4iu08N79W4T4pMBwhPwQ==", 442 | "cpu": [ 443 | "mips64el" 444 | ], 445 | "dev": true, 446 | "license": "MIT", 447 | "optional": true, 448 | "os": [ 449 | "linux" 450 | ], 451 | "engines": { 452 | "node": ">=18" 453 | } 454 | }, 455 | "node_modules/@esbuild/linux-ppc64": { 456 | "version": "0.25.0", 457 | "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.0.tgz", 458 | "integrity": "sha512-NhyOejdhRGS8Iwv+KKR2zTq2PpysF9XqY+Zk77vQHqNbo/PwZCzB5/h7VGuREZm1fixhs4Q/qWRSi5zmAiO4Fw==", 459 | "cpu": [ 460 | "ppc64" 461 | ], 462 | "dev": true, 463 | "license": "MIT", 464 | "optional": true, 465 | "os": [ 466 | "linux" 467 | ], 468 | "engines": { 469 | "node": ">=18" 470 | } 471 | }, 472 | "node_modules/@esbuild/linux-riscv64": { 473 | "version": "0.25.0", 474 | "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.0.tgz", 475 | "integrity": "sha512-5S/rbP5OY+GHLC5qXp1y/Mx//e92L1YDqkiBbO9TQOvuFXM+iDqUNG5XopAnXoRH3FjIUDkeGcY1cgNvnXp/kA==", 476 | "cpu": [ 477 | "riscv64" 478 | ], 479 | "dev": true, 480 | "license": "MIT", 481 | "optional": true, 482 | "os": [ 483 | "linux" 484 | ], 485 | "engines": { 486 | "node": ">=18" 487 | } 488 | }, 489 | "node_modules/@esbuild/linux-s390x": { 490 | "version": "0.25.0", 491 | "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.0.tgz", 492 | "integrity": "sha512-XM2BFsEBz0Fw37V0zU4CXfcfuACMrppsMFKdYY2WuTS3yi8O1nFOhil/xhKTmE1nPmVyvQJjJivgDT+xh8pXJA==", 493 | "cpu": [ 494 | "s390x" 495 | ], 496 | "dev": true, 497 | "license": "MIT", 498 | "optional": true, 499 | "os": [ 500 | "linux" 501 | ], 502 | "engines": { 503 | "node": ">=18" 504 | } 505 | }, 506 | "node_modules/@esbuild/linux-x64": { 507 | "version": "0.25.0", 508 | "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.0.tgz", 509 | "integrity": "sha512-9yl91rHw/cpwMCNytUDxwj2XjFpxML0y9HAOH9pNVQDpQrBxHy01Dx+vaMu0N1CKa/RzBD2hB4u//nfc+Sd3Cw==", 510 | "cpu": [ 511 | "x64" 512 | ], 513 | "dev": true, 514 | "license": "MIT", 515 | "optional": true, 516 | "os": [ 517 | "linux" 518 | ], 519 | "engines": { 520 | "node": ">=18" 521 | } 522 | }, 523 | "node_modules/@esbuild/netbsd-arm64": { 524 | "version": "0.25.0", 525 | "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.0.tgz", 526 | "integrity": "sha512-RuG4PSMPFfrkH6UwCAqBzauBWTygTvb1nxWasEJooGSJ/NwRw7b2HOwyRTQIU97Hq37l3npXoZGYMy3b3xYvPw==", 527 | "cpu": [ 528 | "arm64" 529 | ], 530 | "dev": true, 531 | "license": "MIT", 532 | "optional": true, 533 | "os": [ 534 | "netbsd" 535 | ], 536 | "engines": { 537 | "node": ">=18" 538 | } 539 | }, 540 | "node_modules/@esbuild/netbsd-x64": { 541 | "version": "0.25.0", 542 | "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.0.tgz", 543 | "integrity": "sha512-jl+qisSB5jk01N5f7sPCsBENCOlPiS/xptD5yxOx2oqQfyourJwIKLRA2yqWdifj3owQZCL2sn6o08dBzZGQzA==", 544 | "cpu": [ 545 | "x64" 546 | ], 547 | "dev": true, 548 | "license": "MIT", 549 | "optional": true, 550 | "os": [ 551 | "netbsd" 552 | ], 553 | "engines": { 554 | "node": ">=18" 555 | } 556 | }, 557 | "node_modules/@esbuild/openbsd-arm64": { 558 | "version": "0.25.0", 559 | "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.0.tgz", 560 | "integrity": "sha512-21sUNbq2r84YE+SJDfaQRvdgznTD8Xc0oc3p3iW/a1EVWeNj/SdUCbm5U0itZPQYRuRTW20fPMWMpcrciH2EJw==", 561 | "cpu": [ 562 | "arm64" 563 | ], 564 | "dev": true, 565 | "license": "MIT", 566 | "optional": true, 567 | "os": [ 568 | "openbsd" 569 | ], 570 | "engines": { 571 | "node": ">=18" 572 | } 573 | }, 574 | "node_modules/@esbuild/openbsd-x64": { 575 | "version": "0.25.0", 576 | "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.0.tgz", 577 | "integrity": "sha512-2gwwriSMPcCFRlPlKx3zLQhfN/2WjJ2NSlg5TKLQOJdV0mSxIcYNTMhk3H3ulL/cak+Xj0lY1Ym9ysDV1igceg==", 578 | "cpu": [ 579 | "x64" 580 | ], 581 | "dev": true, 582 | "license": "MIT", 583 | "optional": true, 584 | "os": [ 585 | "openbsd" 586 | ], 587 | "engines": { 588 | "node": ">=18" 589 | } 590 | }, 591 | "node_modules/@esbuild/sunos-x64": { 592 | "version": "0.25.0", 593 | "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.0.tgz", 594 | "integrity": "sha512-bxI7ThgLzPrPz484/S9jLlvUAHYMzy6I0XiU1ZMeAEOBcS0VePBFxh1JjTQt3Xiat5b6Oh4x7UC7IwKQKIJRIg==", 595 | "cpu": [ 596 | "x64" 597 | ], 598 | "dev": true, 599 | "license": "MIT", 600 | "optional": true, 601 | "os": [ 602 | "sunos" 603 | ], 604 | "engines": { 605 | "node": ">=18" 606 | } 607 | }, 608 | "node_modules/@esbuild/win32-arm64": { 609 | "version": "0.25.0", 610 | "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.0.tgz", 611 | "integrity": "sha512-ZUAc2YK6JW89xTbXvftxdnYy3m4iHIkDtK3CLce8wg8M2L+YZhIvO1DKpxrd0Yr59AeNNkTiic9YLf6FTtXWMw==", 612 | "cpu": [ 613 | "arm64" 614 | ], 615 | "dev": true, 616 | "license": "MIT", 617 | "optional": true, 618 | "os": [ 619 | "win32" 620 | ], 621 | "engines": { 622 | "node": ">=18" 623 | } 624 | }, 625 | "node_modules/@esbuild/win32-ia32": { 626 | "version": "0.25.0", 627 | "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.0.tgz", 628 | "integrity": "sha512-eSNxISBu8XweVEWG31/JzjkIGbGIJN/TrRoiSVZwZ6pkC6VX4Im/WV2cz559/TXLcYbcrDN8JtKgd9DJVIo8GA==", 629 | "cpu": [ 630 | "ia32" 631 | ], 632 | "dev": true, 633 | "license": "MIT", 634 | "optional": true, 635 | "os": [ 636 | "win32" 637 | ], 638 | "engines": { 639 | "node": ">=18" 640 | } 641 | }, 642 | "node_modules/@esbuild/win32-x64": { 643 | "version": "0.25.0", 644 | "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.0.tgz", 645 | "integrity": "sha512-ZENoHJBxA20C2zFzh6AI4fT6RraMzjYw4xKWemRTRmRVtN9c5DcH9r/f2ihEkMjOW5eGgrwCslG/+Y/3bL+DHQ==", 646 | "cpu": [ 647 | "x64" 648 | ], 649 | "dev": true, 650 | "license": "MIT", 651 | "optional": true, 652 | "os": [ 653 | "win32" 654 | ], 655 | "engines": { 656 | "node": ">=18" 657 | } 658 | }, 659 | "node_modules/@hutson/parse-repository-url": { 660 | "version": "5.0.0", 661 | "resolved": "https://registry.npmjs.org/@hutson/parse-repository-url/-/parse-repository-url-5.0.0.tgz", 662 | "integrity": "sha512-e5+YUKENATs1JgYHMzTr2MW/NDcXGfYFAuOQU8gJgF/kEh4EqKgfGrfLI67bMD4tbhZVlkigz/9YYwWcbOFthg==", 663 | "dev": true, 664 | "license": "Apache-2.0", 665 | "engines": { 666 | "node": ">=10.13.0" 667 | } 668 | }, 669 | "node_modules/@rollup/rollup-android-arm-eabi": { 670 | "version": "4.40.0", 671 | "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.40.0.tgz", 672 | "integrity": "sha512-+Fbls/diZ0RDerhE8kyC6hjADCXA1K4yVNlH0EYfd2XjyH0UGgzaQ8MlT0pCXAThfxv3QUAczHaL+qSv1E4/Cg==", 673 | "cpu": [ 674 | "arm" 675 | ], 676 | "dev": true, 677 | "license": "MIT", 678 | "optional": true, 679 | "os": [ 680 | "android" 681 | ] 682 | }, 683 | "node_modules/@rollup/rollup-android-arm64": { 684 | "version": "4.40.0", 685 | "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.40.0.tgz", 686 | "integrity": "sha512-PPA6aEEsTPRz+/4xxAmaoWDqh67N7wFbgFUJGMnanCFs0TV99M0M8QhhaSCks+n6EbQoFvLQgYOGXxlMGQe/6w==", 687 | "cpu": [ 688 | "arm64" 689 | ], 690 | "dev": true, 691 | "license": "MIT", 692 | "optional": true, 693 | "os": [ 694 | "android" 695 | ] 696 | }, 697 | "node_modules/@rollup/rollup-darwin-arm64": { 698 | "version": "4.40.0", 699 | "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.40.0.tgz", 700 | "integrity": "sha512-GwYOcOakYHdfnjjKwqpTGgn5a6cUX7+Ra2HeNj/GdXvO2VJOOXCiYYlRFU4CubFM67EhbmzLOmACKEfvp3J1kQ==", 701 | "cpu": [ 702 | "arm64" 703 | ], 704 | "dev": true, 705 | "license": "MIT", 706 | "optional": true, 707 | "os": [ 708 | "darwin" 709 | ] 710 | }, 711 | "node_modules/@rollup/rollup-darwin-x64": { 712 | "version": "4.40.0", 713 | "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.40.0.tgz", 714 | "integrity": "sha512-CoLEGJ+2eheqD9KBSxmma6ld01czS52Iw0e2qMZNpPDlf7Z9mj8xmMemxEucinev4LgHalDPczMyxzbq+Q+EtA==", 715 | "cpu": [ 716 | "x64" 717 | ], 718 | "dev": true, 719 | "license": "MIT", 720 | "optional": true, 721 | "os": [ 722 | "darwin" 723 | ] 724 | }, 725 | "node_modules/@rollup/rollup-freebsd-arm64": { 726 | "version": "4.40.0", 727 | "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.40.0.tgz", 728 | "integrity": "sha512-r7yGiS4HN/kibvESzmrOB/PxKMhPTlz+FcGvoUIKYoTyGd5toHp48g1uZy1o1xQvybwwpqpe010JrcGG2s5nkg==", 729 | "cpu": [ 730 | "arm64" 731 | ], 732 | "dev": true, 733 | "license": "MIT", 734 | "optional": true, 735 | "os": [ 736 | "freebsd" 737 | ] 738 | }, 739 | "node_modules/@rollup/rollup-freebsd-x64": { 740 | "version": "4.40.0", 741 | "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.40.0.tgz", 742 | "integrity": "sha512-mVDxzlf0oLzV3oZOr0SMJ0lSDd3xC4CmnWJ8Val8isp9jRGl5Dq//LLDSPFrasS7pSm6m5xAcKaw3sHXhBjoRw==", 743 | "cpu": [ 744 | "x64" 745 | ], 746 | "dev": true, 747 | "license": "MIT", 748 | "optional": true, 749 | "os": [ 750 | "freebsd" 751 | ] 752 | }, 753 | "node_modules/@rollup/rollup-linux-arm-gnueabihf": { 754 | "version": "4.40.0", 755 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.40.0.tgz", 756 | "integrity": "sha512-y/qUMOpJxBMy8xCXD++jeu8t7kzjlOCkoxxajL58G62PJGBZVl/Gwpm7JK9+YvlB701rcQTzjUZ1JgUoPTnoQA==", 757 | "cpu": [ 758 | "arm" 759 | ], 760 | "dev": true, 761 | "license": "MIT", 762 | "optional": true, 763 | "os": [ 764 | "linux" 765 | ] 766 | }, 767 | "node_modules/@rollup/rollup-linux-arm-musleabihf": { 768 | "version": "4.40.0", 769 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.40.0.tgz", 770 | "integrity": "sha512-GoCsPibtVdJFPv/BOIvBKO/XmwZLwaNWdyD8TKlXuqp0veo2sHE+A/vpMQ5iSArRUz/uaoj4h5S6Pn0+PdhRjg==", 771 | "cpu": [ 772 | "arm" 773 | ], 774 | "dev": true, 775 | "license": "MIT", 776 | "optional": true, 777 | "os": [ 778 | "linux" 779 | ] 780 | }, 781 | "node_modules/@rollup/rollup-linux-arm64-gnu": { 782 | "version": "4.40.0", 783 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.40.0.tgz", 784 | "integrity": "sha512-L5ZLphTjjAD9leJzSLI7rr8fNqJMlGDKlazW2tX4IUF9P7R5TMQPElpH82Q7eNIDQnQlAyiNVfRPfP2vM5Avvg==", 785 | "cpu": [ 786 | "arm64" 787 | ], 788 | "dev": true, 789 | "license": "MIT", 790 | "optional": true, 791 | "os": [ 792 | "linux" 793 | ] 794 | }, 795 | "node_modules/@rollup/rollup-linux-arm64-musl": { 796 | "version": "4.40.0", 797 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.40.0.tgz", 798 | "integrity": "sha512-ATZvCRGCDtv1Y4gpDIXsS+wfFeFuLwVxyUBSLawjgXK2tRE6fnsQEkE4csQQYWlBlsFztRzCnBvWVfcae/1qxQ==", 799 | "cpu": [ 800 | "arm64" 801 | ], 802 | "dev": true, 803 | "license": "MIT", 804 | "optional": true, 805 | "os": [ 806 | "linux" 807 | ] 808 | }, 809 | "node_modules/@rollup/rollup-linux-loongarch64-gnu": { 810 | "version": "4.40.0", 811 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.40.0.tgz", 812 | "integrity": "sha512-wG9e2XtIhd++QugU5MD9i7OnpaVb08ji3P1y/hNbxrQ3sYEelKJOq1UJ5dXczeo6Hj2rfDEL5GdtkMSVLa/AOg==", 813 | "cpu": [ 814 | "loong64" 815 | ], 816 | "dev": true, 817 | "license": "MIT", 818 | "optional": true, 819 | "os": [ 820 | "linux" 821 | ] 822 | }, 823 | "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { 824 | "version": "4.40.0", 825 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.40.0.tgz", 826 | "integrity": "sha512-vgXfWmj0f3jAUvC7TZSU/m/cOE558ILWDzS7jBhiCAFpY2WEBn5jqgbqvmzlMjtp8KlLcBlXVD2mkTSEQE6Ixw==", 827 | "cpu": [ 828 | "ppc64" 829 | ], 830 | "dev": true, 831 | "license": "MIT", 832 | "optional": true, 833 | "os": [ 834 | "linux" 835 | ] 836 | }, 837 | "node_modules/@rollup/rollup-linux-riscv64-gnu": { 838 | "version": "4.40.0", 839 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.40.0.tgz", 840 | "integrity": "sha512-uJkYTugqtPZBS3Z136arevt/FsKTF/J9dEMTX/cwR7lsAW4bShzI2R0pJVw+hcBTWF4dxVckYh72Hk3/hWNKvA==", 841 | "cpu": [ 842 | "riscv64" 843 | ], 844 | "dev": true, 845 | "license": "MIT", 846 | "optional": true, 847 | "os": [ 848 | "linux" 849 | ] 850 | }, 851 | "node_modules/@rollup/rollup-linux-riscv64-musl": { 852 | "version": "4.40.0", 853 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.40.0.tgz", 854 | "integrity": "sha512-rKmSj6EXQRnhSkE22+WvrqOqRtk733x3p5sWpZilhmjnkHkpeCgWsFFo0dGnUGeA+OZjRl3+VYq+HyCOEuwcxQ==", 855 | "cpu": [ 856 | "riscv64" 857 | ], 858 | "dev": true, 859 | "license": "MIT", 860 | "optional": true, 861 | "os": [ 862 | "linux" 863 | ] 864 | }, 865 | "node_modules/@rollup/rollup-linux-s390x-gnu": { 866 | "version": "4.40.0", 867 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.40.0.tgz", 868 | "integrity": "sha512-SpnYlAfKPOoVsQqmTFJ0usx0z84bzGOS9anAC0AZ3rdSo3snecihbhFTlJZ8XMwzqAcodjFU4+/SM311dqE5Sw==", 869 | "cpu": [ 870 | "s390x" 871 | ], 872 | "dev": true, 873 | "license": "MIT", 874 | "optional": true, 875 | "os": [ 876 | "linux" 877 | ] 878 | }, 879 | "node_modules/@rollup/rollup-linux-x64-gnu": { 880 | "version": "4.40.0", 881 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.40.0.tgz", 882 | "integrity": "sha512-RcDGMtqF9EFN8i2RYN2W+64CdHruJ5rPqrlYw+cgM3uOVPSsnAQps7cpjXe9be/yDp8UC7VLoCoKC8J3Kn2FkQ==", 883 | "cpu": [ 884 | "x64" 885 | ], 886 | "dev": true, 887 | "license": "MIT", 888 | "optional": true, 889 | "os": [ 890 | "linux" 891 | ] 892 | }, 893 | "node_modules/@rollup/rollup-linux-x64-musl": { 894 | "version": "4.40.0", 895 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.40.0.tgz", 896 | "integrity": "sha512-HZvjpiUmSNx5zFgwtQAV1GaGazT2RWvqeDi0hV+AtC8unqqDSsaFjPxfsO6qPtKRRg25SisACWnJ37Yio8ttaw==", 897 | "cpu": [ 898 | "x64" 899 | ], 900 | "dev": true, 901 | "license": "MIT", 902 | "optional": true, 903 | "os": [ 904 | "linux" 905 | ] 906 | }, 907 | "node_modules/@rollup/rollup-win32-arm64-msvc": { 908 | "version": "4.40.0", 909 | "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.40.0.tgz", 910 | "integrity": "sha512-UtZQQI5k/b8d7d3i9AZmA/t+Q4tk3hOC0tMOMSq2GlMYOfxbesxG4mJSeDp0EHs30N9bsfwUvs3zF4v/RzOeTQ==", 911 | "cpu": [ 912 | "arm64" 913 | ], 914 | "dev": true, 915 | "license": "MIT", 916 | "optional": true, 917 | "os": [ 918 | "win32" 919 | ] 920 | }, 921 | "node_modules/@rollup/rollup-win32-ia32-msvc": { 922 | "version": "4.40.0", 923 | "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.40.0.tgz", 924 | "integrity": "sha512-+m03kvI2f5syIqHXCZLPVYplP8pQch9JHyXKZ3AGMKlg8dCyr2PKHjwRLiW53LTrN/Nc3EqHOKxUxzoSPdKddA==", 925 | "cpu": [ 926 | "ia32" 927 | ], 928 | "dev": true, 929 | "license": "MIT", 930 | "optional": true, 931 | "os": [ 932 | "win32" 933 | ] 934 | }, 935 | "node_modules/@rollup/rollup-win32-x64-msvc": { 936 | "version": "4.40.0", 937 | "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.40.0.tgz", 938 | "integrity": "sha512-lpPE1cLfP5oPzVjKMx10pgBmKELQnFJXHgvtHCtuJWOv8MxqdEIMNtgHgBFf7Ea2/7EuVwa9fodWUfXAlXZLZQ==", 939 | "cpu": [ 940 | "x64" 941 | ], 942 | "dev": true, 943 | "license": "MIT", 944 | "optional": true, 945 | "os": [ 946 | "win32" 947 | ] 948 | }, 949 | "node_modules/@types/estree": { 950 | "version": "1.0.7", 951 | "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz", 952 | "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==", 953 | "dev": true, 954 | "license": "MIT" 955 | }, 956 | "node_modules/@types/normalize-package-data": { 957 | "version": "2.4.4", 958 | "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", 959 | "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", 960 | "dev": true, 961 | "license": "MIT" 962 | }, 963 | "node_modules/@types/semver": { 964 | "version": "7.5.8", 965 | "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", 966 | "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", 967 | "dev": true, 968 | "license": "MIT" 969 | }, 970 | "node_modules/add-stream": { 971 | "version": "1.0.0", 972 | "resolved": "https://registry.npmjs.org/add-stream/-/add-stream-1.0.0.tgz", 973 | "integrity": "sha512-qQLMr+8o0WC4FZGQTcJiKBVC59JylcPSrTtk6usvmIDFUOCKegapy1VHQwRbFMOFyb/inzUVqHs+eMYKDM1YeQ==", 974 | "dev": true, 975 | "license": "MIT" 976 | }, 977 | "node_modules/array-ify": { 978 | "version": "1.0.0", 979 | "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", 980 | "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==", 981 | "dev": true, 982 | "license": "MIT" 983 | }, 984 | "node_modules/compare-func": { 985 | "version": "2.0.0", 986 | "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz", 987 | "integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==", 988 | "dev": true, 989 | "license": "MIT", 990 | "dependencies": { 991 | "array-ify": "^1.0.0", 992 | "dot-prop": "^5.1.0" 993 | } 994 | }, 995 | "node_modules/conventional-changelog": { 996 | "version": "6.0.0", 997 | "resolved": "https://registry.npmjs.org/conventional-changelog/-/conventional-changelog-6.0.0.tgz", 998 | "integrity": "sha512-tuUH8H/19VjtD9Ig7l6TQRh+Z0Yt0NZ6w/cCkkyzUbGQTnUEmKfGtkC9gGfVgCfOL1Rzno5NgNF4KY8vR+Jo3w==", 999 | "dev": true, 1000 | "license": "MIT", 1001 | "dependencies": { 1002 | "conventional-changelog-angular": "^8.0.0", 1003 | "conventional-changelog-atom": "^5.0.0", 1004 | "conventional-changelog-codemirror": "^5.0.0", 1005 | "conventional-changelog-conventionalcommits": "^8.0.0", 1006 | "conventional-changelog-core": "^8.0.0", 1007 | "conventional-changelog-ember": "^5.0.0", 1008 | "conventional-changelog-eslint": "^6.0.0", 1009 | "conventional-changelog-express": "^5.0.0", 1010 | "conventional-changelog-jquery": "^6.0.0", 1011 | "conventional-changelog-jshint": "^5.0.0", 1012 | "conventional-changelog-preset-loader": "^5.0.0" 1013 | }, 1014 | "engines": { 1015 | "node": ">=18" 1016 | } 1017 | }, 1018 | "node_modules/conventional-changelog-angular": { 1019 | "version": "8.0.0", 1020 | "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-8.0.0.tgz", 1021 | "integrity": "sha512-CLf+zr6St0wIxos4bmaKHRXWAcsCXrJU6F4VdNDrGRK3B8LDLKoX3zuMV5GhtbGkVR/LohZ6MT6im43vZLSjmA==", 1022 | "dev": true, 1023 | "license": "ISC", 1024 | "dependencies": { 1025 | "compare-func": "^2.0.0" 1026 | }, 1027 | "engines": { 1028 | "node": ">=18" 1029 | } 1030 | }, 1031 | "node_modules/conventional-changelog-atom": { 1032 | "version": "5.0.0", 1033 | "resolved": "https://registry.npmjs.org/conventional-changelog-atom/-/conventional-changelog-atom-5.0.0.tgz", 1034 | "integrity": "sha512-WfzCaAvSCFPkznnLgLnfacRAzjgqjLUjvf3MftfsJzQdDICqkOOpcMtdJF3wTerxSpv2IAAjX8doM3Vozqle3g==", 1035 | "dev": true, 1036 | "license": "ISC", 1037 | "engines": { 1038 | "node": ">=18" 1039 | } 1040 | }, 1041 | "node_modules/conventional-changelog-cli": { 1042 | "version": "5.0.0", 1043 | "resolved": "https://registry.npmjs.org/conventional-changelog-cli/-/conventional-changelog-cli-5.0.0.tgz", 1044 | "integrity": "sha512-9Y8fucJe18/6ef6ZlyIlT2YQUbczvoQZZuYmDLaGvcSBP+M6h+LAvf7ON7waRxKJemcCII8Yqu5/8HEfskTxJQ==", 1045 | "dev": true, 1046 | "license": "MIT", 1047 | "dependencies": { 1048 | "add-stream": "^1.0.0", 1049 | "conventional-changelog": "^6.0.0", 1050 | "meow": "^13.0.0", 1051 | "tempfile": "^5.0.0" 1052 | }, 1053 | "bin": { 1054 | "conventional-changelog": "cli.js" 1055 | }, 1056 | "engines": { 1057 | "node": ">=18" 1058 | } 1059 | }, 1060 | "node_modules/conventional-changelog-codemirror": { 1061 | "version": "5.0.0", 1062 | "resolved": "https://registry.npmjs.org/conventional-changelog-codemirror/-/conventional-changelog-codemirror-5.0.0.tgz", 1063 | "integrity": "sha512-8gsBDI5Y3vrKUCxN6Ue8xr6occZ5nsDEc4C7jO/EovFGozx8uttCAyfhRrvoUAWi2WMm3OmYs+0mPJU7kQdYWQ==", 1064 | "dev": true, 1065 | "license": "ISC", 1066 | "engines": { 1067 | "node": ">=18" 1068 | } 1069 | }, 1070 | "node_modules/conventional-changelog-conventionalcommits": { 1071 | "version": "8.0.0", 1072 | "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-8.0.0.tgz", 1073 | "integrity": "sha512-eOvlTO6OcySPyyyk8pKz2dP4jjElYunj9hn9/s0OB+gapTO8zwS9UQWrZ1pmF2hFs3vw1xhonOLGcGjy/zgsuA==", 1074 | "dev": true, 1075 | "license": "ISC", 1076 | "dependencies": { 1077 | "compare-func": "^2.0.0" 1078 | }, 1079 | "engines": { 1080 | "node": ">=18" 1081 | } 1082 | }, 1083 | "node_modules/conventional-changelog-core": { 1084 | "version": "8.0.0", 1085 | "resolved": "https://registry.npmjs.org/conventional-changelog-core/-/conventional-changelog-core-8.0.0.tgz", 1086 | "integrity": "sha512-EATUx5y9xewpEe10UEGNpbSHRC6cVZgO+hXQjofMqpy+gFIrcGvH3Fl6yk2VFKh7m+ffenup2N7SZJYpyD9evw==", 1087 | "dev": true, 1088 | "license": "MIT", 1089 | "dependencies": { 1090 | "@hutson/parse-repository-url": "^5.0.0", 1091 | "add-stream": "^1.0.0", 1092 | "conventional-changelog-writer": "^8.0.0", 1093 | "conventional-commits-parser": "^6.0.0", 1094 | "git-raw-commits": "^5.0.0", 1095 | "git-semver-tags": "^8.0.0", 1096 | "hosted-git-info": "^7.0.0", 1097 | "normalize-package-data": "^6.0.0", 1098 | "read-package-up": "^11.0.0", 1099 | "read-pkg": "^9.0.0" 1100 | }, 1101 | "engines": { 1102 | "node": ">=18" 1103 | } 1104 | }, 1105 | "node_modules/conventional-changelog-ember": { 1106 | "version": "5.0.0", 1107 | "resolved": "https://registry.npmjs.org/conventional-changelog-ember/-/conventional-changelog-ember-5.0.0.tgz", 1108 | "integrity": "sha512-RPflVfm5s4cSO33GH/Ey26oxhiC67akcxSKL8CLRT3kQX2W3dbE19sSOM56iFqUJYEwv9mD9r6k79weWe1urfg==", 1109 | "dev": true, 1110 | "license": "ISC", 1111 | "engines": { 1112 | "node": ">=18" 1113 | } 1114 | }, 1115 | "node_modules/conventional-changelog-eslint": { 1116 | "version": "6.0.0", 1117 | "resolved": "https://registry.npmjs.org/conventional-changelog-eslint/-/conventional-changelog-eslint-6.0.0.tgz", 1118 | "integrity": "sha512-eiUyULWjzq+ybPjXwU6NNRflApDWlPEQEHvI8UAItYW/h22RKkMnOAtfCZxMmrcMO1OKUWtcf2MxKYMWe9zJuw==", 1119 | "dev": true, 1120 | "license": "ISC", 1121 | "engines": { 1122 | "node": ">=18" 1123 | } 1124 | }, 1125 | "node_modules/conventional-changelog-express": { 1126 | "version": "5.0.0", 1127 | "resolved": "https://registry.npmjs.org/conventional-changelog-express/-/conventional-changelog-express-5.0.0.tgz", 1128 | "integrity": "sha512-D8Q6WctPkQpvr2HNCCmwU5GkX22BVHM0r4EW8vN0230TSyS/d6VQJDAxGb84lbg0dFjpO22MwmsikKL++Oo/oQ==", 1129 | "dev": true, 1130 | "license": "ISC", 1131 | "engines": { 1132 | "node": ">=18" 1133 | } 1134 | }, 1135 | "node_modules/conventional-changelog-jquery": { 1136 | "version": "6.0.0", 1137 | "resolved": "https://registry.npmjs.org/conventional-changelog-jquery/-/conventional-changelog-jquery-6.0.0.tgz", 1138 | "integrity": "sha512-2kxmVakyehgyrho2ZHBi90v4AHswkGzHuTaoH40bmeNqUt20yEkDOSpw8HlPBfvEQBwGtbE+5HpRwzj6ac2UfA==", 1139 | "dev": true, 1140 | "license": "ISC", 1141 | "engines": { 1142 | "node": ">=18" 1143 | } 1144 | }, 1145 | "node_modules/conventional-changelog-jshint": { 1146 | "version": "5.0.0", 1147 | "resolved": "https://registry.npmjs.org/conventional-changelog-jshint/-/conventional-changelog-jshint-5.0.0.tgz", 1148 | "integrity": "sha512-gGNphSb/opc76n2eWaO6ma4/Wqu3tpa2w7i9WYqI6Cs2fncDSI2/ihOfMvXveeTTeld0oFvwMVNV+IYQIk3F3g==", 1149 | "dev": true, 1150 | "license": "ISC", 1151 | "dependencies": { 1152 | "compare-func": "^2.0.0" 1153 | }, 1154 | "engines": { 1155 | "node": ">=18" 1156 | } 1157 | }, 1158 | "node_modules/conventional-changelog-preset-loader": { 1159 | "version": "5.0.0", 1160 | "resolved": "https://registry.npmjs.org/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-5.0.0.tgz", 1161 | "integrity": "sha512-SetDSntXLk8Jh1NOAl1Gu5uLiCNSYenB5tm0YVeZKePRIgDW9lQImromTwLa3c/Gae298tsgOM+/CYT9XAl0NA==", 1162 | "dev": true, 1163 | "license": "MIT", 1164 | "engines": { 1165 | "node": ">=18" 1166 | } 1167 | }, 1168 | "node_modules/conventional-changelog-writer": { 1169 | "version": "8.0.1", 1170 | "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-8.0.1.tgz", 1171 | "integrity": "sha512-hlqcy3xHred2gyYg/zXSMXraY2mjAYYo0msUCpK+BGyaVJMFCKWVXPIHiaacGO2GGp13kvHWXFhYmxT4QQqW3Q==", 1172 | "dev": true, 1173 | "license": "MIT", 1174 | "dependencies": { 1175 | "conventional-commits-filter": "^5.0.0", 1176 | "handlebars": "^4.7.7", 1177 | "meow": "^13.0.0", 1178 | "semver": "^7.5.2" 1179 | }, 1180 | "bin": { 1181 | "conventional-changelog-writer": "dist/cli/index.js" 1182 | }, 1183 | "engines": { 1184 | "node": ">=18" 1185 | } 1186 | }, 1187 | "node_modules/conventional-commits-filter": { 1188 | "version": "5.0.0", 1189 | "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-5.0.0.tgz", 1190 | "integrity": "sha512-tQMagCOC59EVgNZcC5zl7XqO30Wki9i9J3acbUvkaosCT6JX3EeFwJD7Qqp4MCikRnzS18WXV3BLIQ66ytu6+Q==", 1191 | "dev": true, 1192 | "license": "MIT", 1193 | "engines": { 1194 | "node": ">=18" 1195 | } 1196 | }, 1197 | "node_modules/conventional-commits-parser": { 1198 | "version": "6.1.0", 1199 | "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-6.1.0.tgz", 1200 | "integrity": "sha512-5nxDo7TwKB5InYBl4ZC//1g9GRwB/F3TXOGR9hgUjMGfvSP4Vu5NkpNro2+1+TIEy1vwxApl5ircECr2ri5JIw==", 1201 | "dev": true, 1202 | "license": "MIT", 1203 | "dependencies": { 1204 | "meow": "^13.0.0" 1205 | }, 1206 | "bin": { 1207 | "conventional-commits-parser": "dist/cli/index.js" 1208 | }, 1209 | "engines": { 1210 | "node": ">=18" 1211 | } 1212 | }, 1213 | "node_modules/dot-prop": { 1214 | "version": "5.3.0", 1215 | "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", 1216 | "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", 1217 | "dev": true, 1218 | "license": "MIT", 1219 | "dependencies": { 1220 | "is-obj": "^2.0.0" 1221 | }, 1222 | "engines": { 1223 | "node": ">=8" 1224 | } 1225 | }, 1226 | "node_modules/esbuild": { 1227 | "version": "0.25.0", 1228 | "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.0.tgz", 1229 | "integrity": "sha512-BXq5mqc8ltbaN34cDqWuYKyNhX8D/Z0J1xdtdQ8UcIIIyJyz+ZMKUt58tF3SrZ85jcfN/PZYhjR5uDQAYNVbuw==", 1230 | "dev": true, 1231 | "hasInstallScript": true, 1232 | "license": "MIT", 1233 | "bin": { 1234 | "esbuild": "bin/esbuild" 1235 | }, 1236 | "engines": { 1237 | "node": ">=18" 1238 | }, 1239 | "optionalDependencies": { 1240 | "@esbuild/aix-ppc64": "0.25.0", 1241 | "@esbuild/android-arm": "0.25.0", 1242 | "@esbuild/android-arm64": "0.25.0", 1243 | "@esbuild/android-x64": "0.25.0", 1244 | "@esbuild/darwin-arm64": "0.25.0", 1245 | "@esbuild/darwin-x64": "0.25.0", 1246 | "@esbuild/freebsd-arm64": "0.25.0", 1247 | "@esbuild/freebsd-x64": "0.25.0", 1248 | "@esbuild/linux-arm": "0.25.0", 1249 | "@esbuild/linux-arm64": "0.25.0", 1250 | "@esbuild/linux-ia32": "0.25.0", 1251 | "@esbuild/linux-loong64": "0.25.0", 1252 | "@esbuild/linux-mips64el": "0.25.0", 1253 | "@esbuild/linux-ppc64": "0.25.0", 1254 | "@esbuild/linux-riscv64": "0.25.0", 1255 | "@esbuild/linux-s390x": "0.25.0", 1256 | "@esbuild/linux-x64": "0.25.0", 1257 | "@esbuild/netbsd-arm64": "0.25.0", 1258 | "@esbuild/netbsd-x64": "0.25.0", 1259 | "@esbuild/openbsd-arm64": "0.25.0", 1260 | "@esbuild/openbsd-x64": "0.25.0", 1261 | "@esbuild/sunos-x64": "0.25.0", 1262 | "@esbuild/win32-arm64": "0.25.0", 1263 | "@esbuild/win32-ia32": "0.25.0", 1264 | "@esbuild/win32-x64": "0.25.0" 1265 | } 1266 | }, 1267 | "node_modules/fdir": { 1268 | "version": "6.4.6", 1269 | "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz", 1270 | "integrity": "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==", 1271 | "dev": true, 1272 | "peerDependencies": { 1273 | "picomatch": "^3 || ^4" 1274 | }, 1275 | "peerDependenciesMeta": { 1276 | "picomatch": { 1277 | "optional": true 1278 | } 1279 | } 1280 | }, 1281 | "node_modules/find-up-simple": { 1282 | "version": "1.0.0", 1283 | "resolved": "https://registry.npmjs.org/find-up-simple/-/find-up-simple-1.0.0.tgz", 1284 | "integrity": "sha512-q7Us7kcjj2VMePAa02hDAF6d+MzsdsAWEwYyOpwUtlerRBkOEPBCRZrAV4XfcSN8fHAgaD0hP7miwoay6DCprw==", 1285 | "dev": true, 1286 | "license": "MIT", 1287 | "engines": { 1288 | "node": ">=18" 1289 | }, 1290 | "funding": { 1291 | "url": "https://github.com/sponsors/sindresorhus" 1292 | } 1293 | }, 1294 | "node_modules/fsevents": { 1295 | "version": "2.3.3", 1296 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", 1297 | "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", 1298 | "dev": true, 1299 | "hasInstallScript": true, 1300 | "license": "MIT", 1301 | "optional": true, 1302 | "os": [ 1303 | "darwin" 1304 | ], 1305 | "engines": { 1306 | "node": "^8.16.0 || ^10.6.0 || >=11.0.0" 1307 | } 1308 | }, 1309 | "node_modules/git-raw-commits": { 1310 | "version": "5.0.0", 1311 | "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-5.0.0.tgz", 1312 | "integrity": "sha512-I2ZXrXeOc0KrCvC7swqtIFXFN+rbjnC7b2T943tvemIOVNl+XP8YnA9UVwqFhzzLClnSA60KR/qEjLpXzs73Qg==", 1313 | "dev": true, 1314 | "license": "MIT", 1315 | "dependencies": { 1316 | "@conventional-changelog/git-client": "^1.0.0", 1317 | "meow": "^13.0.0" 1318 | }, 1319 | "bin": { 1320 | "git-raw-commits": "src/cli.js" 1321 | }, 1322 | "engines": { 1323 | "node": ">=18" 1324 | } 1325 | }, 1326 | "node_modules/git-semver-tags": { 1327 | "version": "8.0.0", 1328 | "resolved": "https://registry.npmjs.org/git-semver-tags/-/git-semver-tags-8.0.0.tgz", 1329 | "integrity": "sha512-N7YRIklvPH3wYWAR2vysaqGLPRcpwQ0GKdlqTiVN5w1UmCdaeY3K8s6DMKRCh54DDdzyt/OAB6C8jgVtb7Y2Fg==", 1330 | "dev": true, 1331 | "license": "MIT", 1332 | "dependencies": { 1333 | "@conventional-changelog/git-client": "^1.0.0", 1334 | "meow": "^13.0.0" 1335 | }, 1336 | "bin": { 1337 | "git-semver-tags": "src/cli.js" 1338 | }, 1339 | "engines": { 1340 | "node": ">=18" 1341 | } 1342 | }, 1343 | "node_modules/handlebars": { 1344 | "version": "4.7.8", 1345 | "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", 1346 | "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", 1347 | "dev": true, 1348 | "license": "MIT", 1349 | "dependencies": { 1350 | "minimist": "^1.2.5", 1351 | "neo-async": "^2.6.2", 1352 | "source-map": "^0.6.1", 1353 | "wordwrap": "^1.0.0" 1354 | }, 1355 | "bin": { 1356 | "handlebars": "bin/handlebars" 1357 | }, 1358 | "engines": { 1359 | "node": ">=0.4.7" 1360 | }, 1361 | "optionalDependencies": { 1362 | "uglify-js": "^3.1.4" 1363 | } 1364 | }, 1365 | "node_modules/hosted-git-info": { 1366 | "version": "7.0.2", 1367 | "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.2.tgz", 1368 | "integrity": "sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w==", 1369 | "dev": true, 1370 | "license": "ISC", 1371 | "dependencies": { 1372 | "lru-cache": "^10.0.1" 1373 | }, 1374 | "engines": { 1375 | "node": "^16.14.0 || >=18.0.0" 1376 | } 1377 | }, 1378 | "node_modules/index-to-position": { 1379 | "version": "0.1.2", 1380 | "resolved": "https://registry.npmjs.org/index-to-position/-/index-to-position-0.1.2.tgz", 1381 | "integrity": "sha512-MWDKS3AS1bGCHLBA2VLImJz42f7bJh8wQsTGCzI3j519/CASStoDONUBVz2I/VID0MpiX3SGSnbOD2xUalbE5g==", 1382 | "dev": true, 1383 | "license": "MIT", 1384 | "engines": { 1385 | "node": ">=18" 1386 | }, 1387 | "funding": { 1388 | "url": "https://github.com/sponsors/sindresorhus" 1389 | } 1390 | }, 1391 | "node_modules/is-obj": { 1392 | "version": "2.0.0", 1393 | "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", 1394 | "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", 1395 | "dev": true, 1396 | "license": "MIT", 1397 | "engines": { 1398 | "node": ">=8" 1399 | } 1400 | }, 1401 | "node_modules/js-tokens": { 1402 | "version": "4.0.0", 1403 | "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", 1404 | "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", 1405 | "dev": true, 1406 | "license": "MIT" 1407 | }, 1408 | "node_modules/lru-cache": { 1409 | "version": "10.4.3", 1410 | "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", 1411 | "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", 1412 | "dev": true, 1413 | "license": "ISC" 1414 | }, 1415 | "node_modules/meow": { 1416 | "version": "13.2.0", 1417 | "resolved": "https://registry.npmjs.org/meow/-/meow-13.2.0.tgz", 1418 | "integrity": "sha512-pxQJQzB6djGPXh08dacEloMFopsOqGVRKFPYvPOt9XDZ1HasbgDZA74CJGreSU4G3Ak7EFJGoiH2auq+yXISgA==", 1419 | "dev": true, 1420 | "license": "MIT", 1421 | "engines": { 1422 | "node": ">=18" 1423 | }, 1424 | "funding": { 1425 | "url": "https://github.com/sponsors/sindresorhus" 1426 | } 1427 | }, 1428 | "node_modules/minimist": { 1429 | "version": "1.2.8", 1430 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", 1431 | "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", 1432 | "dev": true, 1433 | "license": "MIT", 1434 | "funding": { 1435 | "url": "https://github.com/sponsors/ljharb" 1436 | } 1437 | }, 1438 | "node_modules/nanoid": { 1439 | "version": "3.3.11", 1440 | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", 1441 | "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", 1442 | "dev": true, 1443 | "funding": [ 1444 | { 1445 | "type": "github", 1446 | "url": "https://github.com/sponsors/ai" 1447 | } 1448 | ], 1449 | "bin": { 1450 | "nanoid": "bin/nanoid.cjs" 1451 | }, 1452 | "engines": { 1453 | "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" 1454 | } 1455 | }, 1456 | "node_modules/neo-async": { 1457 | "version": "2.6.2", 1458 | "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", 1459 | "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", 1460 | "dev": true, 1461 | "license": "MIT" 1462 | }, 1463 | "node_modules/normalize-package-data": { 1464 | "version": "6.0.2", 1465 | "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-6.0.2.tgz", 1466 | "integrity": "sha512-V6gygoYb/5EmNI+MEGrWkC+e6+Rr7mTmfHrxDbLzxQogBkgzo76rkok0Am6thgSF7Mv2nLOajAJj5vDJZEFn7g==", 1467 | "dev": true, 1468 | "license": "BSD-2-Clause", 1469 | "dependencies": { 1470 | "hosted-git-info": "^7.0.0", 1471 | "semver": "^7.3.5", 1472 | "validate-npm-package-license": "^3.0.4" 1473 | }, 1474 | "engines": { 1475 | "node": "^16.14.0 || >=18.0.0" 1476 | } 1477 | }, 1478 | "node_modules/parse-json": { 1479 | "version": "8.1.0", 1480 | "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-8.1.0.tgz", 1481 | "integrity": "sha512-rum1bPifK5SSar35Z6EKZuYPJx85pkNaFrxBK3mwdfSJ1/WKbYrjoW/zTPSjRRamfmVX1ACBIdFAO0VRErW/EA==", 1482 | "dev": true, 1483 | "license": "MIT", 1484 | "dependencies": { 1485 | "@babel/code-frame": "^7.22.13", 1486 | "index-to-position": "^0.1.2", 1487 | "type-fest": "^4.7.1" 1488 | }, 1489 | "engines": { 1490 | "node": ">=18" 1491 | }, 1492 | "funding": { 1493 | "url": "https://github.com/sponsors/sindresorhus" 1494 | } 1495 | }, 1496 | "node_modules/picocolors": { 1497 | "version": "1.1.1", 1498 | "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", 1499 | "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", 1500 | "dev": true, 1501 | "license": "ISC" 1502 | }, 1503 | "node_modules/picomatch": { 1504 | "version": "4.0.2", 1505 | "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", 1506 | "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", 1507 | "dev": true, 1508 | "engines": { 1509 | "node": ">=12" 1510 | }, 1511 | "funding": { 1512 | "url": "https://github.com/sponsors/jonschlinkert" 1513 | } 1514 | }, 1515 | "node_modules/postcss": { 1516 | "version": "8.5.6", 1517 | "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", 1518 | "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", 1519 | "dev": true, 1520 | "funding": [ 1521 | { 1522 | "type": "opencollective", 1523 | "url": "https://opencollective.com/postcss/" 1524 | }, 1525 | { 1526 | "type": "tidelift", 1527 | "url": "https://tidelift.com/funding/github/npm/postcss" 1528 | }, 1529 | { 1530 | "type": "github", 1531 | "url": "https://github.com/sponsors/ai" 1532 | } 1533 | ], 1534 | "dependencies": { 1535 | "nanoid": "^3.3.11", 1536 | "picocolors": "^1.1.1", 1537 | "source-map-js": "^1.2.1" 1538 | }, 1539 | "engines": { 1540 | "node": "^10 || ^12 || >=14" 1541 | } 1542 | }, 1543 | "node_modules/read-package-up": { 1544 | "version": "11.0.0", 1545 | "resolved": "https://registry.npmjs.org/read-package-up/-/read-package-up-11.0.0.tgz", 1546 | "integrity": "sha512-MbgfoNPANMdb4oRBNg5eqLbB2t2r+o5Ua1pNt8BqGp4I0FJZhuVSOj3PaBPni4azWuSzEdNn2evevzVmEk1ohQ==", 1547 | "dev": true, 1548 | "license": "MIT", 1549 | "dependencies": { 1550 | "find-up-simple": "^1.0.0", 1551 | "read-pkg": "^9.0.0", 1552 | "type-fest": "^4.6.0" 1553 | }, 1554 | "engines": { 1555 | "node": ">=18" 1556 | }, 1557 | "funding": { 1558 | "url": "https://github.com/sponsors/sindresorhus" 1559 | } 1560 | }, 1561 | "node_modules/read-pkg": { 1562 | "version": "9.0.1", 1563 | "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-9.0.1.tgz", 1564 | "integrity": "sha512-9viLL4/n1BJUCT1NXVTdS1jtm80yDEgR5T4yCelII49Mbj0v1rZdKqj7zCiYdbB0CuCgdrvHcNogAKTFPBocFA==", 1565 | "dev": true, 1566 | "license": "MIT", 1567 | "dependencies": { 1568 | "@types/normalize-package-data": "^2.4.3", 1569 | "normalize-package-data": "^6.0.0", 1570 | "parse-json": "^8.0.0", 1571 | "type-fest": "^4.6.0", 1572 | "unicorn-magic": "^0.1.0" 1573 | }, 1574 | "engines": { 1575 | "node": ">=18" 1576 | }, 1577 | "funding": { 1578 | "url": "https://github.com/sponsors/sindresorhus" 1579 | } 1580 | }, 1581 | "node_modules/rollup": { 1582 | "version": "4.40.0", 1583 | "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.40.0.tgz", 1584 | "integrity": "sha512-Noe455xmA96nnqH5piFtLobsGbCij7Tu+tb3c1vYjNbTkfzGqXqQXG3wJaYXkRZuQ0vEYN4bhwg7QnIrqB5B+w==", 1585 | "dev": true, 1586 | "license": "MIT", 1587 | "dependencies": { 1588 | "@types/estree": "1.0.7" 1589 | }, 1590 | "bin": { 1591 | "rollup": "dist/bin/rollup" 1592 | }, 1593 | "engines": { 1594 | "node": ">=18.0.0", 1595 | "npm": ">=8.0.0" 1596 | }, 1597 | "optionalDependencies": { 1598 | "@rollup/rollup-android-arm-eabi": "4.40.0", 1599 | "@rollup/rollup-android-arm64": "4.40.0", 1600 | "@rollup/rollup-darwin-arm64": "4.40.0", 1601 | "@rollup/rollup-darwin-x64": "4.40.0", 1602 | "@rollup/rollup-freebsd-arm64": "4.40.0", 1603 | "@rollup/rollup-freebsd-x64": "4.40.0", 1604 | "@rollup/rollup-linux-arm-gnueabihf": "4.40.0", 1605 | "@rollup/rollup-linux-arm-musleabihf": "4.40.0", 1606 | "@rollup/rollup-linux-arm64-gnu": "4.40.0", 1607 | "@rollup/rollup-linux-arm64-musl": "4.40.0", 1608 | "@rollup/rollup-linux-loongarch64-gnu": "4.40.0", 1609 | "@rollup/rollup-linux-powerpc64le-gnu": "4.40.0", 1610 | "@rollup/rollup-linux-riscv64-gnu": "4.40.0", 1611 | "@rollup/rollup-linux-riscv64-musl": "4.40.0", 1612 | "@rollup/rollup-linux-s390x-gnu": "4.40.0", 1613 | "@rollup/rollup-linux-x64-gnu": "4.40.0", 1614 | "@rollup/rollup-linux-x64-musl": "4.40.0", 1615 | "@rollup/rollup-win32-arm64-msvc": "4.40.0", 1616 | "@rollup/rollup-win32-ia32-msvc": "4.40.0", 1617 | "@rollup/rollup-win32-x64-msvc": "4.40.0", 1618 | "fsevents": "~2.3.2" 1619 | } 1620 | }, 1621 | "node_modules/semver": { 1622 | "version": "7.7.1", 1623 | "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", 1624 | "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", 1625 | "dev": true, 1626 | "license": "ISC", 1627 | "bin": { 1628 | "semver": "bin/semver.js" 1629 | }, 1630 | "engines": { 1631 | "node": ">=10" 1632 | } 1633 | }, 1634 | "node_modules/source-map": { 1635 | "version": "0.6.1", 1636 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", 1637 | "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", 1638 | "dev": true, 1639 | "license": "BSD-3-Clause", 1640 | "engines": { 1641 | "node": ">=0.10.0" 1642 | } 1643 | }, 1644 | "node_modules/source-map-js": { 1645 | "version": "1.2.1", 1646 | "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", 1647 | "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", 1648 | "dev": true, 1649 | "engines": { 1650 | "node": ">=0.10.0" 1651 | } 1652 | }, 1653 | "node_modules/spdx-correct": { 1654 | "version": "3.2.0", 1655 | "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", 1656 | "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", 1657 | "dev": true, 1658 | "license": "Apache-2.0", 1659 | "dependencies": { 1660 | "spdx-expression-parse": "^3.0.0", 1661 | "spdx-license-ids": "^3.0.0" 1662 | } 1663 | }, 1664 | "node_modules/spdx-exceptions": { 1665 | "version": "2.5.0", 1666 | "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", 1667 | "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", 1668 | "dev": true, 1669 | "license": "CC-BY-3.0" 1670 | }, 1671 | "node_modules/spdx-expression-parse": { 1672 | "version": "3.0.1", 1673 | "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", 1674 | "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", 1675 | "dev": true, 1676 | "license": "MIT", 1677 | "dependencies": { 1678 | "spdx-exceptions": "^2.1.0", 1679 | "spdx-license-ids": "^3.0.0" 1680 | } 1681 | }, 1682 | "node_modules/spdx-license-ids": { 1683 | "version": "3.0.21", 1684 | "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.21.tgz", 1685 | "integrity": "sha512-Bvg/8F5XephndSK3JffaRqdT+gyhfqIPwDHpX80tJrF8QQRYMo8sNMeaZ2Dp5+jhwKnUmIOyFFQfHRkjJm5nXg==", 1686 | "dev": true, 1687 | "license": "CC0-1.0" 1688 | }, 1689 | "node_modules/temp-dir": { 1690 | "version": "3.0.0", 1691 | "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-3.0.0.tgz", 1692 | "integrity": "sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw==", 1693 | "dev": true, 1694 | "license": "MIT", 1695 | "engines": { 1696 | "node": ">=14.16" 1697 | } 1698 | }, 1699 | "node_modules/tempfile": { 1700 | "version": "5.0.0", 1701 | "resolved": "https://registry.npmjs.org/tempfile/-/tempfile-5.0.0.tgz", 1702 | "integrity": "sha512-bX655WZI/F7EoTDw9JvQURqAXiPHi8o8+yFxPF2lWYyz1aHnmMRuXWqL6YB6GmeO0o4DIYWHLgGNi/X64T+X4Q==", 1703 | "dev": true, 1704 | "license": "MIT", 1705 | "dependencies": { 1706 | "temp-dir": "^3.0.0" 1707 | }, 1708 | "engines": { 1709 | "node": ">=14.18" 1710 | }, 1711 | "funding": { 1712 | "url": "https://github.com/sponsors/sindresorhus" 1713 | } 1714 | }, 1715 | "node_modules/tinyglobby": { 1716 | "version": "0.2.14", 1717 | "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz", 1718 | "integrity": "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==", 1719 | "dev": true, 1720 | "dependencies": { 1721 | "fdir": "^6.4.4", 1722 | "picomatch": "^4.0.2" 1723 | }, 1724 | "engines": { 1725 | "node": ">=12.0.0" 1726 | }, 1727 | "funding": { 1728 | "url": "https://github.com/sponsors/SuperchupuDev" 1729 | } 1730 | }, 1731 | "node_modules/type-fest": { 1732 | "version": "4.35.0", 1733 | "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.35.0.tgz", 1734 | "integrity": "sha512-2/AwEFQDFEy30iOLjrvHDIH7e4HEWH+f1Yl1bI5XMqzuoCUqwYCdxachgsgv0og/JdVZUhbfjcJAoHj5L1753A==", 1735 | "dev": true, 1736 | "license": "(MIT OR CC0-1.0)", 1737 | "engines": { 1738 | "node": ">=16" 1739 | }, 1740 | "funding": { 1741 | "url": "https://github.com/sponsors/sindresorhus" 1742 | } 1743 | }, 1744 | "node_modules/uglify-js": { 1745 | "version": "3.19.3", 1746 | "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", 1747 | "integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==", 1748 | "dev": true, 1749 | "license": "BSD-2-Clause", 1750 | "optional": true, 1751 | "bin": { 1752 | "uglifyjs": "bin/uglifyjs" 1753 | }, 1754 | "engines": { 1755 | "node": ">=0.8.0" 1756 | } 1757 | }, 1758 | "node_modules/unicorn-magic": { 1759 | "version": "0.1.0", 1760 | "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", 1761 | "integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==", 1762 | "dev": true, 1763 | "license": "MIT", 1764 | "engines": { 1765 | "node": ">=18" 1766 | }, 1767 | "funding": { 1768 | "url": "https://github.com/sponsors/sindresorhus" 1769 | } 1770 | }, 1771 | "node_modules/validate-npm-package-license": { 1772 | "version": "3.0.4", 1773 | "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", 1774 | "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", 1775 | "dev": true, 1776 | "license": "Apache-2.0", 1777 | "dependencies": { 1778 | "spdx-correct": "^3.0.0", 1779 | "spdx-expression-parse": "^3.0.0" 1780 | } 1781 | }, 1782 | "node_modules/vite": { 1783 | "version": "7.0.2", 1784 | "resolved": "https://registry.npmjs.org/vite/-/vite-7.0.2.tgz", 1785 | "integrity": "sha512-hxdyZDY1CM6SNpKI4w4lcUc3Mtkd9ej4ECWVHSMrOdSinVc2zYOAppHeGc/hzmRo3pxM5blMzkuWHOJA/3NiFw==", 1786 | "dev": true, 1787 | "dependencies": { 1788 | "esbuild": "^0.25.0", 1789 | "fdir": "^6.4.6", 1790 | "picomatch": "^4.0.2", 1791 | "postcss": "^8.5.6", 1792 | "rollup": "^4.40.0", 1793 | "tinyglobby": "^0.2.14" 1794 | }, 1795 | "bin": { 1796 | "vite": "bin/vite.js" 1797 | }, 1798 | "engines": { 1799 | "node": "^20.19.0 || >=22.12.0" 1800 | }, 1801 | "funding": { 1802 | "url": "https://github.com/vitejs/vite?sponsor=1" 1803 | }, 1804 | "optionalDependencies": { 1805 | "fsevents": "~2.3.3" 1806 | }, 1807 | "peerDependencies": { 1808 | "@types/node": "^20.19.0 || >=22.12.0", 1809 | "jiti": ">=1.21.0", 1810 | "less": "^4.0.0", 1811 | "lightningcss": "^1.21.0", 1812 | "sass": "^1.70.0", 1813 | "sass-embedded": "^1.70.0", 1814 | "stylus": ">=0.54.8", 1815 | "sugarss": "^5.0.0", 1816 | "terser": "^5.16.0", 1817 | "tsx": "^4.8.1", 1818 | "yaml": "^2.4.2" 1819 | }, 1820 | "peerDependenciesMeta": { 1821 | "@types/node": { 1822 | "optional": true 1823 | }, 1824 | "jiti": { 1825 | "optional": true 1826 | }, 1827 | "less": { 1828 | "optional": true 1829 | }, 1830 | "lightningcss": { 1831 | "optional": true 1832 | }, 1833 | "sass": { 1834 | "optional": true 1835 | }, 1836 | "sass-embedded": { 1837 | "optional": true 1838 | }, 1839 | "stylus": { 1840 | "optional": true 1841 | }, 1842 | "sugarss": { 1843 | "optional": true 1844 | }, 1845 | "terser": { 1846 | "optional": true 1847 | }, 1848 | "tsx": { 1849 | "optional": true 1850 | }, 1851 | "yaml": { 1852 | "optional": true 1853 | } 1854 | } 1855 | }, 1856 | "node_modules/wordwrap": { 1857 | "version": "1.0.0", 1858 | "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", 1859 | "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", 1860 | "dev": true, 1861 | "license": "MIT" 1862 | } 1863 | } 1864 | } 1865 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "syntax-highlight-element", 3 | "version": "1.1.1", 4 | "description": "Syntax Highlighting using the CSS Custom Highlight API", 5 | "license": "MIT", 6 | "funding": "https://github.com/andreruffert/syntax-highlight-element?sponsor=1", 7 | "homepage": "https://andreruffert.github.io/syntax-highlight-element/", 8 | "author": { 9 | "name": "André Ruffert", 10 | "url": "https://andreruffert.com" 11 | }, 12 | "type": "module", 13 | "exports": { 14 | ".": { 15 | "import": "./dist/syntax-highlight-element.js" 16 | }, 17 | "./themes/*": "./dist/themes/*" 18 | }, 19 | "files": [ 20 | "dist" 21 | ], 22 | "scripts": { 23 | "dev": "vite", 24 | "dev:docs": "vite --config vite.docs.config.js", 25 | "build": "vite build && vite build --config vite.themes.config.js", 26 | "preview": "vite preview", 27 | "format": "biome check --write", 28 | "lint": "biome ci", 29 | "prepublishOnly": "npm run build", 30 | "version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md" 31 | }, 32 | "devDependencies": { 33 | "@biomejs/biome": "2.0.4", 34 | "conventional-changelog-cli": "5.0.0", 35 | "vite": "7.0.2" 36 | }, 37 | "volta": { 38 | "node": "22.13.1", 39 | "npm": "11.1.0" 40 | }, 41 | "repository": { 42 | "type": "git", 43 | "url": "git+https://github.com/andreruffert/syntax-highlight-element.git" 44 | }, 45 | "bugs": { 46 | "url": "https://github.com/andreruffert/syntax-highlight-element/issues" 47 | }, 48 | "keywords": [ 49 | "syntax", 50 | "highlight", 51 | "CSS Custom Highlight API", 52 | "custom element", 53 | "web component" 54 | ] 55 | } 56 | -------------------------------------------------------------------------------- /src/constants.js: -------------------------------------------------------------------------------- 1 | export const NAMESPACE = 'she'; 2 | export const DEFAULT_LANGUAGES = ['markup', 'css', 'javascript']; 3 | 4 | /** 5 | * @typedef Config 6 | * @type {object} 7 | * @property {string[]} languages - Prism languages. 8 | * @property {{ [key: string]: string[] }} languageTokens - Language specific token types. 9 | */ 10 | 11 | /** @type {Config} */ 12 | export const CONFIG = window[NAMESPACE]?.config || {}; 13 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import { NAMESPACE } from './constants'; 2 | import { SyntaxHighlightElement } from './syntax-highlight-element'; 3 | 4 | export { SyntaxHighlightElement }; 5 | export default SyntaxHighlightElement; 6 | 7 | window[NAMESPACE] = window[NAMESPACE] || {}; 8 | 9 | if (!new URL(import.meta.url).searchParams.has('define', 'false')) { 10 | window.SyntaxHighlightElement = SyntaxHighlightElement.define(); 11 | } 12 | -------------------------------------------------------------------------------- /src/syntax-highlight-element.js: -------------------------------------------------------------------------------- 1 | import { CONFIG, DEFAULT_LANGUAGES } from './constants'; 2 | import { loadPrismCore, loadPrismLanguage, setupTokenHighlights, tokenize } from './utils'; 3 | 4 | const DEFAULT_TAG_NAME = 'syntax-highlight'; 5 | 6 | export class SyntaxHighlightElement extends HTMLElement { 7 | static async define(tagName = DEFAULT_TAG_NAME, registry = customElements) { 8 | if (!CSS.highlights) { 9 | console.info('The CSS Custom Highlight API is not supported in this browser.'); 10 | return; 11 | } 12 | 13 | if (!registry.get(tagName)) { 14 | setupTokenHighlights(CONFIG?.languageTokens || {}); 15 | try { 16 | await loadPrismCore(); 17 | await loadPrismLanguage(CONFIG?.languages || DEFAULT_LANGUAGES); 18 | registry.define(tagName, SyntaxHighlightElement); 19 | return SyntaxHighlightElement; 20 | } catch (error) { 21 | console.error(error); 22 | } 23 | } 24 | } 25 | 26 | #internals; 27 | #highlights = new Set(); 28 | 29 | get contentElement() { 30 | if (!this.hasAttribute('content-selector')) return this; 31 | return this.querySelector(this.getAttribute('content-selector')) || this; 32 | } 33 | 34 | get language() { 35 | return this.getAttribute('language') || 'plaintext'; 36 | } 37 | 38 | get highlights() { 39 | return this.#highlights; 40 | } 41 | 42 | constructor() { 43 | super(); 44 | this.#internals = this.attachInternals(); 45 | this.#internals.role = 'code'; 46 | } 47 | 48 | connectedCallback() { 49 | // Make focusable via keyboard navigation 50 | if (!this.hasAttribute('tabindex')) { 51 | this.setAttribute('tabindex', '0'); 52 | } 53 | 54 | this.paintTokenHighlights(); 55 | } 56 | 57 | /** 58 | * Tokenize code and paint the token highlights. 59 | */ 60 | paintTokenHighlights() { 61 | // Tokenize the text 62 | const tokens = tokenize(this.contentElement.innerText, this.language); 63 | const languageTokenTypes = CONFIG.languageTokens?.[this.language] || []; 64 | 65 | // Paint highlights 66 | let pos = 0; 67 | for (const token of tokens) { 68 | if (token.type) { 69 | // Optional language specific overwrite 70 | const tokenType = languageTokenTypes.includes(token.type) 71 | ? `${this.language}-${token.type}` 72 | : token.type; 73 | 74 | // Token position range 75 | const range = new Range(); 76 | range.setStart(this.contentElement.firstChild, pos); 77 | range.setEnd(this.contentElement.firstChild, pos + token.length); 78 | 79 | // Add range to tokenType highlight and update the global HighlightRegistry 80 | CSS.highlights.get(tokenType)?.add(range); 81 | 82 | // Store internal reference 83 | this.#highlights.add({ tokenType, range }); 84 | } 85 | pos += token.length; 86 | } 87 | } 88 | 89 | /** 90 | * Delete the highlights from the global HighlightRegistry. 91 | */ 92 | clearTokenHighlights() { 93 | for (const highlight of this.highlights) { 94 | CSS.highlights.get(highlight.tokenType)?.delete(highlight.range); 95 | // Delete internal reference 96 | this.#highlights.delete(highlight); 97 | } 98 | } 99 | 100 | /** 101 | * Update token highlights 102 | */ 103 | update() { 104 | this.clearTokenHighlights(); 105 | this.paintTokenHighlights(); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/themes/prettylights.css: -------------------------------------------------------------------------------- 1 | @import "theme-defaults.css" layer(syntax-highlight-element); 2 | 3 | /** 4 | * Source: https://github.com/primer/primitives/blob/main/src/tokens/functional/color/syntax.json5#L240 5 | */ 6 | 7 | @layer syntax-highlight-element { 8 | syntax-highlight { 9 | --prettylights-bg: light-dark(#f6f8fa, #151b23); 10 | --prettylights-fg: light-dark(#1f2328, #f0f6fc); 11 | --prettylights-comment: light-dark(#59636e, #9198a1); 12 | --prettylights-constant: light-dark(#0550ae, #79c0ff); 13 | --prettylights-constant-other-reference-link: light-dark(#0a3069, #a5d6ff); 14 | --prettylights-entity: light-dark(#6639ba, #d2a8ff); 15 | --prettylights-entity-tag: light-dark(#0550ae, #7ee787); 16 | --prettylights-keyword: light-dark(#cf222e, #ff7b72); 17 | --prettylights-bold: light-dark(#f0f6fc, #f0f6fc); 18 | --prettylights-deleted-bg: light-dark(#ffebe9, #67060c); 19 | --prettylights-deleted-text: light-dark(#82071e, #ffdcd7); 20 | --prettylights-heading: light-dark(#0550ae, #1f6feb); 21 | --prettylights-inserted-bg: light-dark(#dafbe1, #033a16); 22 | --prettylights-inserted-text: light-dark(#116329, #aff5b4); 23 | --prettylights-italic: light-dark(#f0f6fc, #f0f6fc); 24 | --prettylights-string: light-dark(#0a3069, #a5d6ff); 25 | --prettylights-string-regexp: light-dark(#116329, #7ee787); 26 | --prettylights-variable: light-dark(#953800, #ffa657); 27 | 28 | color-scheme: light dark; 29 | color: var(--prettylights-fg); 30 | background-color: var(--prettylights-bg); 31 | font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", 32 | "Courier New", monospace; 33 | line-height: 1.6; 34 | } 35 | 36 | /* 37 | * INFO: 38 | * (1.) Currently not a supported property for the highlight pseudo-elements. 39 | * Full list of supported properties: https://drafts.csswg.org/css-pseudo-4/#highlight-styling 40 | * More infos: https://github.com/w3c/csswg-drafts/issues/8355 41 | */ 42 | 43 | ::highlight(punctuation), 44 | ::highlight(number), 45 | ::highlight(atrule) { 46 | color: var(--prettylights-fg); 47 | } 48 | 49 | ::highlight(namespace) { 50 | opacity: 0.7; 51 | } 52 | 53 | ::highlight(comment), 54 | ::highlight(prolog), 55 | ::highlight(doctype), 56 | ::highlight(cdata) { 57 | color: var(--prettylights-comment); 58 | } 59 | 60 | ::highlight(constant), 61 | ::highlight(attr-name), 62 | ::highlight(char), 63 | ::highlight(builtin), 64 | ::highlight(operator) { 65 | color: var(--prettylights-constant); 66 | } 67 | 68 | ::highlight(property), 69 | ::highlight(tag), 70 | ::highlight(boolean), 71 | ::highlight(symbol) { 72 | color: var(--prettylights-entity-tag); 73 | } 74 | 75 | ::highlight(entity), 76 | ::highlight(selector), 77 | ::highlight(class-name), 78 | ::highlight(function) { 79 | color: var(--prettylights-entity); 80 | } 81 | 82 | ::highlight(keyword), 83 | ::highlight(rule) { 84 | color: var(--prettylights-keyword); 85 | } 86 | 87 | ::highlight(string), 88 | ::highlight(attr-value) { 89 | color: var(--prettylights-string); 90 | } 91 | 92 | ::highlight(variable) { 93 | color: var(--prettylights-variable); 94 | } 95 | 96 | ::highlight(regex) { 97 | font-weight: bold; /* (1.) */ 98 | color: var(--prettylights-string-regexp); 99 | } 100 | 101 | ::highlight(italic) { 102 | font-style: italic; /* (1.) */ 103 | color: var(--prettylights-italic); 104 | } 105 | ::highlight(bold) { 106 | font-weight: bold; /* (1.) */ 107 | color: var(--prettylights-bold); 108 | } 109 | 110 | ::highlight(deleted) { 111 | color: var(--prettylights-deleted-text); 112 | background-color: var(--prettylights-deleted-bg); 113 | } 114 | 115 | ::highlight(inserted) { 116 | color: var(--prettylights-inserted-text); 117 | background-color: var(--prettylights-inserted-bg); 118 | } 119 | 120 | ::highlight(url) { 121 | text-decoration: underline; 122 | color: var(--prettylights-constant-other-reference-link); 123 | } 124 | 125 | ::highlight(important) { 126 | color: var(--prettylights-heading); 127 | } 128 | 129 | /* CSS language overwrites */ 130 | ::highlight(css-important) { 131 | color: var(--prettylights-keyword); 132 | } 133 | 134 | /* Markdown specific tokens */ 135 | ::highlight(md-title) { 136 | color: var(--prettylights-heading); 137 | } 138 | 139 | ::highlight(md-list) { 140 | color: var(--prettylights-variable); 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /src/themes/prism.css: -------------------------------------------------------------------------------- 1 | @import "theme-defaults.css" layer(syntax-highlight-element); 2 | 3 | /** 4 | * Source: https://github.com/PrismJS/prism/blob/master/themes/prism.css 5 | */ 6 | 7 | @layer syntax-highlight-element { 8 | syntax-highlight { 9 | color: black; 10 | background: #f5f2f0; 11 | text-shadow: 0 1px white; 12 | font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; 13 | line-height: 1.5; 14 | } 15 | 16 | @media print { 17 | syntax-highlight { 18 | text-shadow: none; 19 | } 20 | } 21 | 22 | ::highlight(comment), 23 | ::highlight(prolog), 24 | ::highlight(doctype), 25 | ::highlight(cdata) { 26 | color: slategray; 27 | } 28 | 29 | ::highlight(punctuation) { 30 | color: #999; 31 | } 32 | 33 | ::highlight(namespace) { 34 | opacity: 0.7; 35 | } 36 | 37 | ::highlight(property), 38 | ::highlight(tag), 39 | ::highlight(boolean), 40 | ::highlight(number), 41 | ::highlight(constant), 42 | ::highlight(symbol), 43 | ::highlight(deleted) { 44 | color: #905; 45 | } 46 | 47 | ::highlight(selector), 48 | ::highlight(attr-name), 49 | ::highlight(string), 50 | ::highlight(char), 51 | ::highlight(builtin), 52 | ::highlight(inserted) { 53 | color: #690; 54 | } 55 | 56 | ::highlight(operator), 57 | ::highlight(entity), 58 | ::highlight(url), 59 | ::highlight(css-string) { 60 | color: #9a6e3a; 61 | /* This background color was intended by the author of this theme. */ 62 | background: hsla(0, 0%, 100%, 0.5); 63 | } 64 | 65 | ::highlight(atrule), 66 | ::highlight(attr-value), 67 | ::highlight(keyword) { 68 | color: #07a; 69 | } 70 | 71 | ::highlight(function), 72 | ::highlight(class-name) { 73 | color: #dd4a68; 74 | } 75 | 76 | ::highlight(regex), 77 | ::highlight(important), 78 | ::highlight(variable) { 79 | color: #e90; 80 | } 81 | 82 | ::highlight(important), 83 | ::highlight(bold) { 84 | font-weight: bold; 85 | } 86 | ::highlight(italic) { 87 | font-style: italic; 88 | } 89 | 90 | ::highlight(entity) { 91 | cursor: help; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/themes/theme-defaults.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Defaults injected in every theme. 3 | */ 4 | syntax-highlight { 5 | white-space: pre; 6 | word-spacing: normal; 7 | word-break: normal; 8 | word-wrap: normal; 9 | overflow: auto; 10 | tab-size: 2; 11 | hyphens: none; 12 | } 13 | -------------------------------------------------------------------------------- /src/utils.js: -------------------------------------------------------------------------------- 1 | const PRISM_CDN_URL = 'https://cdn.jsdelivr.net/npm/prismjs@1.30.0'; 2 | 3 | /** 4 | * Create & register the token `Highlight`'s in the `CSS.highlights` registry. 5 | * This enables the use of `::highlight(tokenType)` in CSS to style them. 6 | * @param {Object} [languageTokens={}] - Language specific overwrites. 7 | */ 8 | export function setupTokenHighlights(languageTokens = {}) { 9 | const languageTokenTypes = Object.entries(languageTokens).flatMap((entry) => { 10 | const [lang, tokenTypes] = entry; 11 | return tokenTypes.map((tokenType) => `${lang}-${tokenType}`); 12 | }); 13 | 14 | /** 15 | * https://prismjs.com/tokens.html#standard-tokens 16 | */ 17 | const tokenTypes = [ 18 | // Standard tokens 19 | 'atrule', 20 | 'attr-name', 21 | 'attr-value', 22 | 'bold', 23 | 'boolean', 24 | 'builtin', 25 | 'cdata', 26 | 'char', 27 | 'class-name', 28 | 'comment', 29 | 'constant', 30 | 'deleted', 31 | 'doctype', 32 | 'entity', 33 | 'function', 34 | 'important', 35 | 'inserted', 36 | 'italic', 37 | 'keyword', 38 | 'namespace', 39 | 'number', 40 | 'operator', 41 | 'prolog', 42 | 'property', 43 | 'punctuation', 44 | 'regex', 45 | 'rule', 46 | 'selector', 47 | 'string', 48 | 'symbol', 49 | 'tag', 50 | 'url', 51 | // Optional extends 52 | ...languageTokenTypes, 53 | ]; 54 | 55 | for (const tokenType of tokenTypes) { 56 | CSS.highlights.set(tokenType, new Highlight()); 57 | } 58 | } 59 | 60 | /** 61 | * https://github.com/PrismJS/prism/blob/master/plugins/autoloader/prism-autoloader.js#L14 62 | */ 63 | const langDependencies = { 64 | javascript: 'clike', 65 | actionscript: 'javascript', 66 | arduino: 'cpp', 67 | aspnet: ['markup', 'csharp'], 68 | bison: 'c', 69 | c: 'clike', 70 | csharp: 'clike', 71 | cpp: 'c', 72 | coffeescript: 'javascript', 73 | crystal: 'ruby', 74 | 'css-extras': 'css', 75 | d: 'clike', 76 | dart: 'clike', 77 | django: 'markup', 78 | erb: ['ruby', 'markup-templating'], 79 | fsharp: 'clike', 80 | flow: 'javascript', 81 | glsl: 'clike', 82 | go: 'clike', 83 | groovy: 'clike', 84 | haml: 'ruby', 85 | handlebars: 'markup-templating', 86 | haxe: 'clike', 87 | java: 'clike', 88 | jolie: 'clike', 89 | kotlin: 'clike', 90 | less: 'css', 91 | markdown: 'markup', 92 | 'markup-templating': 'markup', 93 | n4js: 'javascript', 94 | nginx: 'clike', 95 | objectivec: 'c', 96 | opencl: 'cpp', 97 | parser: 'markup', 98 | php: ['clike', 'markup-templating'], 99 | 'php-extras': 'php', 100 | plsql: 'sql', 101 | processing: 'clike', 102 | protobuf: 'clike', 103 | pug: 'javascript', 104 | qore: 'clike', 105 | jsx: ['markup', 'javascript'], 106 | tsx: ['jsx', 'typescript'], 107 | reason: 'clike', 108 | ruby: 'clike', 109 | sass: 'css', 110 | scss: 'css', 111 | scala: 'java', 112 | smarty: 'markup-templating', 113 | soy: 'markup-templating', 114 | swift: 'clike', 115 | tap: 'yaml', 116 | textile: 'markup', 117 | tt2: ['clike', 'markup-templating'], 118 | twig: 'markup', 119 | typescript: 'javascript', 120 | vbnet: 'basic', 121 | velocity: 'markup', 122 | wiki: 'markup', 123 | xeora: 'markup', 124 | xquery: 'markup', 125 | }; 126 | 127 | const langData = new Set(); 128 | 129 | /** 130 | * 131 | * @param {string|Array} language 132 | * @returns {Promise} 133 | */ 134 | export async function loadPrismLanguage(language) { 135 | // Preserving the order is important for dependencies. 136 | const languages = (Array.isArray(language) ? language : [language]).reduce((langs, lang) => { 137 | const deps = langDependencies[lang] 138 | ? Array.isArray(langDependencies[lang]) 139 | ? langDependencies[lang] 140 | : [langDependencies[lang]] 141 | : []; 142 | langs.push(...deps, lang); 143 | return langs; 144 | }, []); 145 | 146 | // Load sequentially 147 | for (const lang of languages) { 148 | await new Promise((resolve, reject) => { 149 | if (langData.has(lang)) return resolve(); 150 | const script = document.createElement('script'); 151 | script.src = `${PRISM_CDN_URL}/components/prism-${lang}.min.js`; 152 | script.onload = () => { 153 | document.head.removeChild(script); 154 | langData.add(lang); 155 | resolve(lang); 156 | }; 157 | script.onerror = (error) => { 158 | document.head.removeChild(script); 159 | reject(error); 160 | }; 161 | document.head.appendChild(script); 162 | }); 163 | } 164 | 165 | return langData; 166 | } 167 | 168 | /** 169 | * 170 | * @returns {Promise} 171 | */ 172 | export function loadPrismCore() { 173 | return new Promise((resolve, reject) => { 174 | const script = document.createElement('script'); 175 | script.src = `${PRISM_CDN_URL}/components/prism-core.min.js`; 176 | script.onload = resolve; 177 | script.onerror = reject; 178 | document.head.appendChild(script); 179 | }); 180 | } 181 | 182 | /** 183 | * 184 | * @param {string} text - The text to tokenize. 185 | * @param {string} language - The syntax language grammar. 186 | * @returns {Array} - An array of flattened prismjs tokens. 187 | */ 188 | export function tokenize(text, language) { 189 | const lang = window.Prism.languages[language] || undefined; 190 | const tokens = window.Prism.tokenize(text, lang); 191 | return tokens.flatMap(getFlatToken); 192 | } 193 | 194 | /** 195 | * Flatten tokens for e.g. html attributes etc. 196 | * @param {Object} - A prismjs token object. 197 | */ 198 | function getFlatToken(token) { 199 | if (typeof token?.content === 'string') { 200 | return token; 201 | } 202 | 203 | if (Array.isArray(token.content)) { 204 | const insideTokens = token.content.flatMap((x) => 205 | typeof x === 'string' ? { type: token.type, content: x, length: x.length } : x, 206 | ); 207 | return insideTokens.flatMap(getFlatToken); 208 | } 209 | 210 | return token; 211 | } 212 | -------------------------------------------------------------------------------- /vite.config.js: -------------------------------------------------------------------------------- 1 | import { dirname, resolve } from 'node:path'; 2 | import { fileURLToPath } from 'node:url'; 3 | import { defineConfig } from 'vite'; 4 | 5 | const __dirname = dirname(fileURLToPath(import.meta.url)); 6 | 7 | export default defineConfig({ 8 | build: { 9 | lib: { 10 | formats: ['es'], 11 | entry: resolve(__dirname, 'src/index.js'), 12 | name: 'SyntaxHighlightElement', 13 | fileName: 'syntax-highlight-element', 14 | }, 15 | }, 16 | }); 17 | -------------------------------------------------------------------------------- /vite.docs.config.js: -------------------------------------------------------------------------------- 1 | import { dirname, resolve } from 'node:path'; 2 | import { fileURLToPath } from 'node:url'; 3 | import { defineConfig } from 'vite'; 4 | 5 | const __dirname = dirname(fileURLToPath(import.meta.url)); 6 | 7 | export default defineConfig({ 8 | root: resolve(__dirname, 'docs'), 9 | build: { 10 | outDir: resolve(__dirname, 'dist/docs'), 11 | }, 12 | }); 13 | -------------------------------------------------------------------------------- /vite.themes.config.js: -------------------------------------------------------------------------------- 1 | import { dirname, resolve } from 'node:path'; 2 | import { fileURLToPath } from 'node:url'; 3 | import { defineConfig } from 'vite'; 4 | 5 | const __dirname = dirname(fileURLToPath(import.meta.url)); 6 | 7 | const themes = [ 8 | resolve(__dirname, 'src/themes/prettylights.css'), 9 | resolve(__dirname, 'src/themes/prism.css'), 10 | ]; 11 | 12 | export default defineConfig({ 13 | build: { 14 | outDir: 'dist/themes', 15 | cssMinify: false, 16 | rollupOptions: { 17 | input: themes, 18 | output: { 19 | assetFileNames: () => '[name][extname]', 20 | }, 21 | }, 22 | }, 23 | }); 24 | --------------------------------------------------------------------------------