@chayns-components/code-highlighter 5.0.0-beta.1000

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -0
  3. package/lib/cjs/components/code-highlighter/CodeHighlighter.js +126 -0
  4. package/lib/cjs/components/code-highlighter/CodeHighlighter.js.map +1 -0
  5. package/lib/cjs/components/code-highlighter/CodeHighlighter.styles.js +79 -0
  6. package/lib/cjs/components/code-highlighter/CodeHighlighter.styles.js.map +1 -0
  7. package/lib/cjs/components/code-highlighter/copy-to-clipboard/CopyToClipboard.js +39 -0
  8. package/lib/cjs/components/code-highlighter/copy-to-clipboard/CopyToClipboard.js.map +1 -0
  9. package/lib/cjs/components/code-highlighter/copy-to-clipboard/CopyToClipboard.styles.js +21 -0
  10. package/lib/cjs/components/code-highlighter/copy-to-clipboard/CopyToClipboard.styles.js.map +1 -0
  11. package/lib/cjs/index.js +21 -0
  12. package/lib/cjs/index.js.map +1 -0
  13. package/lib/cjs/types/codeHighlighter.js +12 -0
  14. package/lib/cjs/types/codeHighlighter.js.map +1 -0
  15. package/lib/cjs/types/parser/prettier-parser-babel.d.js +2 -0
  16. package/lib/cjs/types/parser/prettier-parser-babel.d.js.map +1 -0
  17. package/lib/cjs/types/parser/prettier-parser-graphql.d.js +2 -0
  18. package/lib/cjs/types/parser/prettier-parser-graphql.d.js.map +1 -0
  19. package/lib/cjs/types/parser/prettier-parser-html.d.js +2 -0
  20. package/lib/cjs/types/parser/prettier-parser-html.d.js.map +1 -0
  21. package/lib/cjs/types/parser/prettier-parser-markdown.d.js +2 -0
  22. package/lib/cjs/types/parser/prettier-parser-markdown.d.js.map +1 -0
  23. package/lib/cjs/types/parser/prettier-parser-postcss.d.js +2 -0
  24. package/lib/cjs/types/parser/prettier-parser-postcss.d.js.map +1 -0
  25. package/lib/cjs/types/parser/prettier-parser-yaml.d.js +2 -0
  26. package/lib/cjs/types/parser/prettier-parser-yaml.d.js.map +1 -0
  27. package/lib/cjs/utils/codeHighlighter.js +338 -0
  28. package/lib/cjs/utils/codeHighlighter.js.map +1 -0
  29. package/lib/esm/components/code-highlighter/CodeHighlighter.js +121 -0
  30. package/lib/esm/components/code-highlighter/CodeHighlighter.js.map +1 -0
  31. package/lib/esm/components/code-highlighter/CodeHighlighter.styles.js +86 -0
  32. package/lib/esm/components/code-highlighter/CodeHighlighter.styles.js.map +1 -0
  33. package/lib/esm/components/code-highlighter/copy-to-clipboard/CopyToClipboard.js +33 -0
  34. package/lib/esm/components/code-highlighter/copy-to-clipboard/CopyToClipboard.js.map +1 -0
  35. package/lib/esm/components/code-highlighter/copy-to-clipboard/CopyToClipboard.styles.js +17 -0
  36. package/lib/esm/components/code-highlighter/copy-to-clipboard/CopyToClipboard.styles.js.map +1 -0
  37. package/lib/esm/index.js +4 -0
  38. package/lib/esm/index.js.map +1 -0
  39. package/lib/esm/types/codeHighlighter.js +6 -0
  40. package/lib/esm/types/codeHighlighter.js.map +1 -0
  41. package/lib/esm/types/parser/prettier-parser-babel.d.js +2 -0
  42. package/lib/esm/types/parser/prettier-parser-babel.d.js.map +1 -0
  43. package/lib/esm/types/parser/prettier-parser-graphql.d.js +2 -0
  44. package/lib/esm/types/parser/prettier-parser-graphql.d.js.map +1 -0
  45. package/lib/esm/types/parser/prettier-parser-html.d.js +2 -0
  46. package/lib/esm/types/parser/prettier-parser-html.d.js.map +1 -0
  47. package/lib/esm/types/parser/prettier-parser-markdown.d.js +2 -0
  48. package/lib/esm/types/parser/prettier-parser-markdown.d.js.map +1 -0
  49. package/lib/esm/types/parser/prettier-parser-postcss.d.js +2 -0
  50. package/lib/esm/types/parser/prettier-parser-postcss.d.js.map +1 -0
  51. package/lib/esm/types/parser/prettier-parser-yaml.d.js +2 -0
  52. package/lib/esm/types/parser/prettier-parser-yaml.d.js.map +1 -0
  53. package/lib/esm/utils/codeHighlighter.js +329 -0
  54. package/lib/esm/utils/codeHighlighter.js.map +1 -0
  55. package/lib/types/components/code-highlighter/CodeHighlighter.d.ts +44 -0
  56. package/lib/types/components/code-highlighter/CodeHighlighter.styles.d.ts +17 -0
  57. package/lib/types/components/code-highlighter/copy-to-clipboard/CopyToClipboard.d.ts +9 -0
  58. package/lib/types/components/code-highlighter/copy-to-clipboard/CopyToClipboard.styles.d.ts +8 -0
  59. package/lib/types/index.d.ts +3 -0
  60. package/lib/types/types/codeHighlighter.d.ts +10 -0
  61. package/lib/types/utils/codeHighlighter.d.ts +4 -0
  62. package/package.json +88 -0
@@ -0,0 +1,10 @@
1
+ export declare enum CodeHighlighterTheme {
2
+ Light = "light",
3
+ Dark = "dark"
4
+ }
5
+ export interface HighlightedLines {
6
+ added?: number[];
7
+ removed?: number[];
8
+ marked?: number[];
9
+ }
10
+ export type CodeHighlighterLanguage = 'abap' | 'abnf' | 'actionscript' | 'ada' | 'agda' | 'al' | 'antlr4' | 'apacheconf' | 'apex' | 'apl' | 'applescript' | 'aql' | 'arduino' | 'arff' | 'asciidoc' | 'asm6502' | 'asmatmel' | 'aspnet' | 'autohotkey' | 'autoit' | 'avisynth' | 'avroIdl' | 'bash' | 'basic' | 'batch' | 'bbcode' | 'bicep' | 'birb' | 'bison' | 'bnf' | 'brainfuck' | 'brightscript' | 'bro' | 'bsl' | 'c' | 'cfscript' | 'chaiscript' | 'cil' | 'clike' | 'clojure' | 'cmake' | 'cobol' | 'coffeescript' | 'concurnas' | 'coq' | 'cpp' | 'crystal' | 'csharp' | 'cshtml' | 'csp' | 'cssExtras' | 'css' | 'csv' | 'cypher' | 'd' | 'dart' | 'dataweave' | 'dax' | 'dhall' | 'diff' | 'django' | 'dnsZoneFile' | 'docker' | 'dot' | 'ebnf' | 'editorconfig' | 'eiffel' | 'ejs' | 'elixir' | 'elm' | 'erb' | 'erlang' | 'etlua' | 'excelFormula' | 'factor' | 'falselang' | 'firestoreSecurityRules' | 'flow' | 'fortran' | 'fsharp' | 'ftl' | 'gap' | 'gcode' | 'gdscript' | 'gedcom' | 'gherkin' | 'git' | 'glsl' | 'gml' | 'gn' | 'goModule' | 'go' | 'graphql' | 'groovy' | 'haml' | 'handlebars' | 'haskell' | 'haxe' | 'hcl' | 'hlsl' | 'hoon' | 'hpkp' | 'hsts' | 'html' | 'http' | 'ichigojam' | 'icon' | 'icuMessageFormat' | 'idris' | 'iecst' | 'ignore' | 'inform7' | 'ini' | 'io' | 'j' | 'java' | 'javadoc' | 'javadoclike' | 'javascript' | 'javastacktrace' | 'jexl' | 'jolie' | 'jq' | 'jsExtras' | 'jsTemplates' | 'jsdoc' | 'json' | 'json5' | 'jsonp' | 'jsstacktrace' | 'jsx' | 'julia' | 'keepalived' | 'keyman' | 'kotlin' | 'kumir' | 'kusto' | 'latex' | 'latte' | 'less' | 'lilypond' | 'liquid' | 'lisp' | 'livescript' | 'llvm' | 'log' | 'lolcode' | 'lua' | 'magma' | 'makefile' | 'markdown' | 'markupTemplating' | 'markup' | 'matlab' | 'maxscript' | 'mel' | 'mermaid' | 'mizar' | 'mongodb' | 'monkey' | 'moonscript' | 'n1ql' | 'n4js' | 'nand2tetrisHdl' | 'naniscript' | 'nasm' | 'neon' | 'nevod' | 'nginx' | 'nim' | 'nix' | 'nsis' | 'objectivec' | 'ocaml' | 'opencl' | 'openqasm' | 'oz' | 'parigp' | 'parser' | 'pascal' | 'pascaligo' | 'pcaxis' | 'peoplecode' | 'perl' | 'phpExtras' | 'php' | 'phpdoc' | 'plsql' | 'powerquery' | 'powershell' | 'processing' | 'prolog' | 'promql' | 'properties' | 'protobuf' | 'psl' | 'pug' | 'puppet' | 'pure' | 'purebasic' | 'purescript' | 'python' | 'q' | 'qml' | 'qore' | 'qsharp' | 'r' | 'racket' | 'reason' | 'regex' | 'rego' | 'renpy' | 'rest' | 'rip' | 'roboconf' | 'robotframework' | 'ruby' | 'rust' | 'sas' | 'sass' | 'scala' | 'scheme' | 'scss' | 'shellSession' | 'smali' | 'smalltalk' | 'smarty' | 'sml' | 'solidity' | 'solutionFile' | 'soy' | 'sparql' | 'splunkSpl' | 'sqf' | 'sql' | 'squirrel' | 'stan' | 'stylus' | 'swift' | 'systemd' | 't4Cs' | 't4Templating' | 't4Vb' | 'tap' | 'tcl' | 'textile' | 'toml' | 'tremor' | 'tsx' | 'tt2' | 'turtle' | 'twig' | 'typescript' | 'typoscript' | 'unrealscript' | 'uorazor' | 'uri' | 'v' | 'vala' | 'vbnet' | 'velocity' | 'verilog' | 'vhdl' | 'vim' | 'visualBasic' | 'warpscript' | 'wasm' | 'webIdl' | 'wiki' | 'wolfram' | 'wren' | 'xeora' | 'xmlDoc' | 'xojo' | 'xquery' | 'yaml' | 'yang' | 'zig' | '' | undefined;
@@ -0,0 +1,4 @@
1
+ import type { Options } from 'prettier';
2
+ import { CodeHighlighterLanguage } from '../types/codeHighlighter';
3
+ export declare const getParserForLanguage: (language?: CodeHighlighterLanguage) => Promise<Options | undefined>;
4
+ export declare const formatLanguage: (language: CodeHighlighterLanguage) => string;
package/package.json ADDED
@@ -0,0 +1,88 @@
1
+ {
2
+ "name": "@chayns-components/code-highlighter",
3
+ "version": "5.0.0-beta.1000",
4
+ "description": "A set of beautiful React components for developing your own applications with chayns.",
5
+ "sideEffects": false,
6
+ "browserslist": [
7
+ ">0.5%",
8
+ "not dead",
9
+ "not op_mini all",
10
+ "not IE 11"
11
+ ],
12
+ "keywords": [
13
+ "chayns",
14
+ "react",
15
+ "components"
16
+ ],
17
+ "author": "Tobit.Software",
18
+ "homepage": "https://github.com/TobitSoftware/chayns-components/tree/main/packages/code-highlighter#readme",
19
+ "license": "MIT",
20
+ "types": "lib/types/index.d.ts",
21
+ "main": "lib/cjs/index.js",
22
+ "module": "lib/esm/index.js",
23
+ "exports": {
24
+ ".": {
25
+ "types": "./lib/types/index.d.ts",
26
+ "require": "./lib/cjs/index.js",
27
+ "import": "./lib/esm/index.js"
28
+ }
29
+ },
30
+ "directories": {
31
+ "lib": "lib",
32
+ "test": "__tests__"
33
+ },
34
+ "files": [
35
+ "lib"
36
+ ],
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/TobitSoftware/chayns-components.git"
40
+ },
41
+ "scripts": {
42
+ "build": "npm run build:cjs && npm run build:esm && npm run build:types",
43
+ "build:types": "tsc",
44
+ "build:cjs": "cross-env NODE_ENV=cjs babel src --out-dir lib/cjs --extensions=.ts,.tsx --source-maps --ignore=src/stories",
45
+ "build:esm": "cross-env NODE_ENV=esm babel src --out-dir lib/esm --extensions=.ts,.tsx --source-maps --ignore=src/stories",
46
+ "prepublishOnly": "npm run build",
47
+ "watch:js": "npm run build:esm -- --watch",
48
+ "link": "npm link && npm run watch:js"
49
+ },
50
+ "bugs": {
51
+ "url": "https://github.com/TobitSoftware/chayns-components/issues"
52
+ },
53
+ "devDependencies": {
54
+ "@babel/cli": "^7.26.4",
55
+ "@babel/core": "^7.26.0",
56
+ "@babel/preset-env": "^7.26.0",
57
+ "@babel/preset-react": "^7.26.3",
58
+ "@babel/preset-typescript": "^7.26.0",
59
+ "@types/react": "^18.3.18",
60
+ "@types/react-dom": "^18.3.5",
61
+ "@types/styled-components": "^5.1.34",
62
+ "babel-loader": "^9.2.1",
63
+ "cross-env": "^7.0.3",
64
+ "lerna": "^8.1.9",
65
+ "react": "^18.3.1",
66
+ "react-dom": "^18.3.1",
67
+ "styled-components": "^6.1.14",
68
+ "typescript": "^5.7.3"
69
+ },
70
+ "dependencies": {
71
+ "@chayns-components/core": "^5.0.0-beta.1000",
72
+ "@types/react-syntax-highlighter": "^15.5.13",
73
+ "babel-prettier-parser": "^0.10.8",
74
+ "prettier": "^2.8.8",
75
+ "react-syntax-highlighter": "^15.6.1"
76
+ },
77
+ "peerDependencies": {
78
+ "chayns-api": ">=2.0.0",
79
+ "framer-motion": ">=10.18.0",
80
+ "react": ">=18.0.0",
81
+ "react-dom": ">=18.0.0",
82
+ "styled-components": ">=5.3.11"
83
+ },
84
+ "publishConfig": {
85
+ "access": "public"
86
+ },
87
+ "gitHead": "d456c0b87862a3be7d764ba0f16e0b96b22ac2a8"
88
+ }