@neo4j-ndl/react 4.25.7 → 4.25.9

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.
@@ -0,0 +1,83 @@
1
+ /*!
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ // oxlint-disable sort-keys
22
+ // Markdown inputs shared by the Response unit and Playwright tests.
23
+ // Images use data URIs so tests do not depend on the network.
24
+ const PIXEL_SVG = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHJlY3Qgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSIjMDE0MDYzIi8+PC9zdmc+';
25
+ export const responseFixtures = {
26
+ basicFormatting: `# Heading 1
27
+
28
+ ## Heading 2
29
+
30
+ A paragraph with **bold**, *italic* and \`inline code\`.
31
+
32
+ > A blockquote
33
+
34
+ ---
35
+
36
+ - Item 1
37
+ - Item 2
38
+
39
+ 1. First
40
+ 2. Second`,
41
+ links: `- [Absolute link](https://neo4j.com/docs/)
42
+ - [Fragment with underscore](https://neo4j.com/docs/aura/#_what_is_aura)
43
+ - [Relative link](/docs/getting-started)
44
+ - [Mail link](mailto:hello@example.com)
45
+ - [Script link](javascript:alert(1))
46
+ - Bare URL https://neo4j.com/product/`,
47
+ image: `![Data image](${PIXEL_SVG})`,
48
+ table: `| Item | In Stock | Price |
49
+ | :--- | :------: | ----: |
50
+ | Hat | True | 23.99 |
51
+ | Tee | False | 19.99 |`,
52
+ codeSupported: `\`\`\`cypher
53
+ MATCH (n:Movie) RETURN n.title LIMIT 10
54
+ \`\`\``,
55
+ codeUnknownLanguage: `\`\`\`brainfuck
56
+ ++++++++[>++++<-]>.
57
+ \`\`\``,
58
+ mermaid: `\`\`\`mermaid
59
+ graph TD
60
+ A[Start] --> B[End]
61
+ \`\`\``,
62
+ math: `Inline math $x^2 + y^2 = z^2$ in a sentence.
63
+
64
+ $$
65
+ E = mc^2
66
+ $$`,
67
+ rawHtml: `Before <b>bold html</b> after.
68
+
69
+ <script>window.hasNdlResponseXss = true;</script>
70
+
71
+ <img src="x" onerror="window.hasNdlResponseXss = true" alt="html image" />`,
72
+ clobbering: `<a id="x" name="ndl-host-link" href="https://neo4j.com/">raw link</a> <img id="ndl-host-logo" name="ndl-host-image" src="/raw-image.png" alt="raw image" />
73
+
74
+ <h2 id="ndl-host-title">Raw heading</h2>
75
+
76
+ A footnote reference[^1].
77
+
78
+ [^1]: The footnote.`,
79
+ incompleteLink: `Read more in [the docs](https://neo4j.com/do`,
80
+ incompleteImage: `Look at this ![Partial image](https://exa`,
81
+ incompleteBold: `This is **unfinished bold`,
82
+ };
83
+ //# sourceMappingURL=response-fixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-fixtures.js","sourceRoot":"","sources":["../../../../../src/ai/response/stories/response-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,2BAA2B;AAC3B,oEAAoE;AACpE,8DAA8D;AAE9D,MAAM,SAAS,GACb,oLAAoL,CAAC;AAEvL,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,eAAe,EAAE;;;;;;;;;;;;;;UAcT;IAER,KAAK,EAAE;;;;;sCAK6B;IAEpC,KAAK,EAAE,iBAAiB,SAAS,GAAG;IAEpC,KAAK,EAAE;;;4BAGmB;IAE1B,aAAa,EAAE;;OAEV;IAEL,mBAAmB,EAAE;;OAEhB;IAEL,OAAO,EAAE;;;OAGJ;IAEL,IAAI,EAAE;;;;GAIL;IAED,OAAO,EAAE;;;;2EAIgE;IAEzE,UAAU,EAAE;;;;;;oBAMM;IAElB,cAAc,EAAE,8CAA8C;IAE9D,eAAe,EAAE,2CAA2C;IAE5D,cAAc,EAAE,2BAA2B;CACnC,CAAC","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n// oxlint-disable sort-keys\n// Markdown inputs shared by the Response unit and Playwright tests.\n// Images use data URIs so tests do not depend on the network.\n\nconst PIXEL_SVG =\n 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHJlY3Qgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSIjMDE0MDYzIi8+PC9zdmc+';\n\nexport const responseFixtures = {\n basicFormatting: `# Heading 1\n\n## Heading 2\n\nA paragraph with **bold**, *italic* and \\`inline code\\`.\n\n> A blockquote\n\n---\n\n- Item 1\n- Item 2\n\n1. First\n2. Second`,\n\n links: `- [Absolute link](https://neo4j.com/docs/)\n- [Fragment with underscore](https://neo4j.com/docs/aura/#_what_is_aura)\n- [Relative link](/docs/getting-started)\n- [Mail link](mailto:hello@example.com)\n- [Script link](javascript:alert(1))\n- Bare URL https://neo4j.com/product/`,\n\n image: `![Data image](${PIXEL_SVG})`,\n\n table: `| Item | In Stock | Price |\n| :--- | :------: | ----: |\n| Hat | True | 23.99 |\n| Tee | False | 19.99 |`,\n\n codeSupported: `\\`\\`\\`cypher\nMATCH (n:Movie) RETURN n.title LIMIT 10\n\\`\\`\\``,\n\n codeUnknownLanguage: `\\`\\`\\`brainfuck\n++++++++[>++++<-]>.\n\\`\\`\\``,\n\n mermaid: `\\`\\`\\`mermaid\ngraph TD\n A[Start] --> B[End]\n\\`\\`\\``,\n\n math: `Inline math $x^2 + y^2 = z^2$ in a sentence.\n\n$$\nE = mc^2\n$$`,\n\n rawHtml: `Before <b>bold html</b> after.\n\n<script>window.hasNdlResponseXss = true;</script>\n\n<img src=\"x\" onerror=\"window.hasNdlResponseXss = true\" alt=\"html image\" />`,\n\n clobbering: `<a id=\"x\" name=\"ndl-host-link\" href=\"https://neo4j.com/\">raw link</a> <img id=\"ndl-host-logo\" name=\"ndl-host-image\" src=\"/raw-image.png\" alt=\"raw image\" />\n\n<h2 id=\"ndl-host-title\">Raw heading</h2>\n\nA footnote reference[^1].\n\n[^1]: The footnote.`,\n\n incompleteLink: `Read more in [the docs](https://neo4j.com/do`,\n\n incompleteImage: `Look at this ![Partial image](https://exa`,\n\n incompleteBold: `This is **unfinished bold`,\n} as const;\n\nexport type ResponseFixtureName = keyof typeof responseFixtures;\n"]}
@@ -45,13 +45,36 @@ export const Languages = [
45
45
  'xml',
46
46
  'yaml',
47
47
  ];
48
+ /**
49
+ * The bash grammar only recognizes `\w+` in flag names, so long flags
50
+ * like `--database-name` aren't highlighted as parameters.
51
+ * This wrapper expands the `parameter` pattern to support hyphens.
52
+ *
53
+ * Refractor uses a shared registry and skips grammars whose `displayName`
54
+ * is already registered. If another package has already registered `bash`,
55
+ * a wrapper named `bash` would be ignored. We give the wrapper its own name,
56
+ * register the original grammar only if `bash` is missing, and then patch
57
+ * whichever bash grammar is available. The patch is safe to apply more than
58
+ * once.
59
+ */
60
+ const withBashParameterFix = (grammar) => Object.assign((prism) => {
61
+ var _a;
62
+ if (prism.languages.bash === undefined) {
63
+ grammar(prism);
64
+ }
65
+ const parameter = (_a = prism.languages.bash) === null || _a === void 0 ? void 0 : _a.parameter;
66
+ if (parameter !== undefined) {
67
+ parameter.pattern =
68
+ /(^|\s)-{1,2}(?:\w+:[+-]?)?\w[\w-]*(?:\.[\w-]+)*(?=[=\s]|$)/;
69
+ }
70
+ }, { displayName: `ndl-${grammar.displayName}` });
48
71
  export const loadLanguage = (language) => {
49
72
  /* need to import the languages dynamically to reduce the bundle size and need to use a string literal for proper tree shaking */
50
73
  switch (language) {
51
74
  case 'asciidoc':
52
75
  return import('react-syntax-highlighter/dist/esm/languages/prism/asciidoc');
53
76
  case 'bash':
54
- return import('react-syntax-highlighter/dist/esm/languages/prism/bash');
77
+ return import('react-syntax-highlighter/dist/esm/languages/prism/bash').then((module) => ({ default: withBashParameterFix(module.default) }));
55
78
  case 'c':
56
79
  return import('react-syntax-highlighter/dist/esm/languages/prism/c');
57
80
  case 'csharp':
@@ -1 +1 @@
1
- {"version":3,"file":"code-languages.js","sourceRoot":"","sources":["../../../src/code-block/code-languages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,gJAAgJ;AAChJ,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,UAAU;IACV,MAAM;IACN,GAAG;IACH,QAAQ;IACR,KAAK;IACL,YAAY;IACZ,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,IAAI;IACJ,SAAS;IACT,MAAM;IACN,SAAS;IACT,YAAY;IACZ,KAAK;IACL,QAAQ;IACR,KAAK;IACL,QAAQ;IACR,OAAO;IACP,MAAM;IACN,KAAK;IACL,YAAY;IACZ,KAAK;IACL,MAAM;CACE,CAAC;AAIX,MAAM,CAAC,MAAM,YAAY,GAAG,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,CAAC,yDAAyD,CAAC,CAAC;QAC3E,KAAK,MAAM;YACT,OAAO,MAAM,CAAC,wDAAwD,CAAC,CAAC;QAC1E,KAAK,KAAK;YACR,OAAO,MAAM,CAAC,uDAAuD,CAAC,CAAC;QACzE,KAAK,YAAY;YACf,OAAO,MAAM,CAAC,8DAA8D,CAAC,CAAC;QAChF,KAAK,KAAK;YACR,OAAO,MAAM,CAAC,2DAA2D,CAAC,CAAC;QAC7E,KAAK,MAAM;YACT,OAAO,MAAM,CAAC,wDAAwD,CAAC,CAAC;QAE1E;YACE,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAC;IACzD,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n// Source for available languages: https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/AVAILABLE_LANGUAGES_PRISM.MD\nexport const Languages = [\n 'asciidoc',\n 'bash',\n 'c',\n 'csharp',\n 'css',\n 'css-extras',\n 'cypher',\n 'docker',\n 'json',\n 'go',\n 'graphql',\n 'java',\n 'javadoc',\n 'javascript',\n 'jsx',\n 'kotlin',\n 'php',\n 'python',\n 'regex',\n 'rust',\n 'sql',\n 'typescript',\n 'xml',\n 'yaml',\n] as const;\n\nexport type LanguageProp = (typeof Languages)[number];\n\nexport const loadLanguage = (language: LanguageProp) => {\n /* need to import the languages dynamically to reduce the bundle size and need to use a string literal for proper tree shaking */\n switch (language) {\n case 'asciidoc':\n return import('react-syntax-highlighter/dist/esm/languages/prism/asciidoc');\n case 'bash':\n return import('react-syntax-highlighter/dist/esm/languages/prism/bash');\n case 'c':\n return import('react-syntax-highlighter/dist/esm/languages/prism/c');\n case 'csharp':\n return import('react-syntax-highlighter/dist/esm/languages/prism/csharp');\n case 'css':\n return import('react-syntax-highlighter/dist/esm/languages/prism/css');\n case 'css-extras':\n return import('react-syntax-highlighter/dist/esm/languages/prism/css-extras');\n case 'cypher':\n return import('react-syntax-highlighter/dist/esm/languages/prism/cypher');\n case 'docker':\n return import('react-syntax-highlighter/dist/esm/languages/prism/docker');\n case 'json':\n return import('react-syntax-highlighter/dist/esm/languages/prism/json');\n case 'go':\n return import('react-syntax-highlighter/dist/esm/languages/prism/go');\n case 'graphql':\n return import('react-syntax-highlighter/dist/esm/languages/prism/graphql');\n case 'java':\n return import('react-syntax-highlighter/dist/esm/languages/prism/java');\n case 'javadoc':\n return import('react-syntax-highlighter/dist/esm/languages/prism/javadoc');\n case 'javascript':\n return import('react-syntax-highlighter/dist/esm/languages/prism/javascript');\n case 'jsx':\n return import('react-syntax-highlighter/dist/esm/languages/prism/jsx');\n case 'kotlin':\n return import('react-syntax-highlighter/dist/esm/languages/prism/kotlin');\n case 'php':\n return import('react-syntax-highlighter/dist/esm/languages/prism/php');\n case 'python':\n return import('react-syntax-highlighter/dist/esm/languages/prism/python');\n case 'regex':\n return import('react-syntax-highlighter/dist/esm/languages/prism/regex');\n case 'rust':\n return import('react-syntax-highlighter/dist/esm/languages/prism/rust');\n case 'sql':\n return import('react-syntax-highlighter/dist/esm/languages/prism/sql');\n case 'typescript':\n return import('react-syntax-highlighter/dist/esm/languages/prism/typescript');\n case 'xml':\n return import('react-syntax-highlighter/dist/esm/languages/prism/xml-doc');\n case 'yaml':\n return import('react-syntax-highlighter/dist/esm/languages/prism/yaml');\n\n default:\n throw new Error(`Unsupported language: ${language}`);\n }\n};\n"]}
1
+ {"version":3,"file":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AAC,uDAAuD,CAAC,CAAC;QACzE,KAAK,YAAY;YACf,OAAO,MAAM,CAAC,8DAA8D,CAAC,CAAC;QAChF,KAAK,KAAK;YACR,OAAO,MAAM,CAAC,2DAA2D,CAAC,CAAC;QAC7E,KAAK,MAAM;YACT,OAAO,MAAM,CAAC,wDAAwD,CAAC,CAAC;QAE1E;YACE,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAC;IACzD,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n// Source for available languages: https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/AVAILABLE_LANGUAGES_PRISM.MD\nexport const Languages = [\n 'asciidoc',\n 'bash',\n 'c',\n 'csharp',\n 'css',\n 'css-extras',\n 'cypher',\n 'docker',\n 'json',\n 'go',\n 'graphql',\n 'java',\n 'javadoc',\n 'javascript',\n 'jsx',\n 'kotlin',\n 'php',\n 'python',\n 'regex',\n 'rust',\n 'sql',\n 'typescript',\n 'xml',\n 'yaml',\n] as const;\n\nexport type LanguageProp = (typeof Languages)[number];\n\n/**\n * The parts of the Prism instance that we need when working with a\n * refractor grammar. Since this package doesn't depend directly on\n * refractor's types, we only define the bits we use.\n */\nexport interface RefractorPrism {\n languages: {\n bash?: {\n parameter?: { pattern: RegExp };\n };\n };\n}\n\n/**\n * A refractor grammar registers itself on a Prism instance.\n * This type covers the parts of refractor's `Syntax` type that we use.\n */\nexport type RefractorGrammar = ((prism: RefractorPrism) => void) & {\n displayName: string;\n aliases?: string[];\n};\n\n/**\n * The bash grammar only recognizes `\\w+` in flag names, so long flags\n * like `--database-name` aren't highlighted as parameters.\n * This wrapper expands the `parameter` pattern to support hyphens.\n *\n * Refractor uses a shared registry and skips grammars whose `displayName`\n * is already registered. If another package has already registered `bash`,\n * a wrapper named `bash` would be ignored. We give the wrapper its own name,\n * register the original grammar only if `bash` is missing, and then patch\n * whichever bash grammar is available. The patch is safe to apply more than\n * once.\n */\nconst withBashParameterFix = (grammar: RefractorGrammar): RefractorGrammar =>\n Object.assign(\n (prism: RefractorPrism) => {\n if (prism.languages.bash === undefined) {\n grammar(prism);\n }\n const parameter = prism.languages.bash?.parameter;\n if (parameter !== undefined) {\n parameter.pattern =\n /(^|\\s)-{1,2}(?:\\w+:[+-]?)?\\w[\\w-]*(?:\\.[\\w-]+)*(?=[=\\s]|$)/;\n }\n },\n { displayName: `ndl-${grammar.displayName}` },\n );\n\nexport const loadLanguage = (language: LanguageProp) => {\n /* need to import the languages dynamically to reduce the bundle size and need to use a string literal for proper tree shaking */\n switch (language) {\n case 'asciidoc':\n return import('react-syntax-highlighter/dist/esm/languages/prism/asciidoc');\n case 'bash':\n return import('react-syntax-highlighter/dist/esm/languages/prism/bash').then(\n (module) => ({ default: withBashParameterFix(module.default) }),\n );\n case 'c':\n return import('react-syntax-highlighter/dist/esm/languages/prism/c');\n case 'csharp':\n return import('react-syntax-highlighter/dist/esm/languages/prism/csharp');\n case 'css':\n return import('react-syntax-highlighter/dist/esm/languages/prism/css');\n case 'css-extras':\n return import('react-syntax-highlighter/dist/esm/languages/prism/css-extras');\n case 'cypher':\n return import('react-syntax-highlighter/dist/esm/languages/prism/cypher');\n case 'docker':\n return import('react-syntax-highlighter/dist/esm/languages/prism/docker');\n case 'json':\n return import('react-syntax-highlighter/dist/esm/languages/prism/json');\n case 'go':\n return import('react-syntax-highlighter/dist/esm/languages/prism/go');\n case 'graphql':\n return import('react-syntax-highlighter/dist/esm/languages/prism/graphql');\n case 'java':\n return import('react-syntax-highlighter/dist/esm/languages/prism/java');\n case 'javadoc':\n return import('react-syntax-highlighter/dist/esm/languages/prism/javadoc');\n case 'javascript':\n return import('react-syntax-highlighter/dist/esm/languages/prism/javascript');\n case 'jsx':\n return import('react-syntax-highlighter/dist/esm/languages/prism/jsx');\n case 'kotlin':\n return import('react-syntax-highlighter/dist/esm/languages/prism/kotlin');\n case 'php':\n return import('react-syntax-highlighter/dist/esm/languages/prism/php');\n case 'python':\n return import('react-syntax-highlighter/dist/esm/languages/prism/python');\n case 'regex':\n return import('react-syntax-highlighter/dist/esm/languages/prism/regex');\n case 'rust':\n return import('react-syntax-highlighter/dist/esm/languages/prism/rust');\n case 'sql':\n return import('react-syntax-highlighter/dist/esm/languages/prism/sql');\n case 'typescript':\n return import('react-syntax-highlighter/dist/esm/languages/prism/typescript');\n case 'xml':\n return import('react-syntax-highlighter/dist/esm/languages/prism/xml-doc');\n case 'yaml':\n return import('react-syntax-highlighter/dist/esm/languages/prism/yaml');\n\n default:\n throw new Error(`Unsupported language: ${language}`);\n }\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Response.d.ts","sourceRoot":"","sources":["../../../../src/ai/response/Response.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAIvD,KAAK,aAAa,GAAG;IACnB,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC,aAAa,CAAC,CAAC;CACtE,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,QAAQ,uHAST,WAAW,CAAC,KAAK,EAAE,aAAa,CAAC,6CA+QrC,CAAC;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"Response.d.ts","sourceRoot":"","sources":["../../../../src/ai/response/Response.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,OAAO,EAAwB,UAAU,EAAE,MAAM,YAAY,CAAC;AAE9D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAoDvD,KAAK,aAAa,GAAG;IACnB,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC,aAAa,CAAC,CAAC;CACtE,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,QAAQ,uHAST,WAAW,CAAC,KAAK,EAAE,aAAa,CAAC,6CA0SrC,CAAC;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,37 @@
1
+ /*!
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ export declare const responseFixtures: {
22
+ readonly basicFormatting: "# Heading 1\n\n## Heading 2\n\nA paragraph with **bold**, *italic* and `inline code`.\n\n> A blockquote\n\n---\n\n- Item 1\n- Item 2\n\n1. First\n2. Second";
23
+ readonly links: "- [Absolute link](https://neo4j.com/docs/)\n- [Fragment with underscore](https://neo4j.com/docs/aura/#_what_is_aura)\n- [Relative link](/docs/getting-started)\n- [Mail link](mailto:hello@example.com)\n- [Script link](javascript:alert(1))\n- Bare URL https://neo4j.com/product/";
24
+ readonly image: "![Data image](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHJlY3Qgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSIjMDE0MDYzIi8+PC9zdmc+)";
25
+ readonly table: "| Item | In Stock | Price |\n| :--- | :------: | ----: |\n| Hat | True | 23.99 |\n| Tee | False | 19.99 |";
26
+ readonly codeSupported: "```cypher\nMATCH (n:Movie) RETURN n.title LIMIT 10\n```";
27
+ readonly codeUnknownLanguage: "```brainfuck\n++++++++[>++++<-]>.\n```";
28
+ readonly mermaid: "```mermaid\ngraph TD\n A[Start] --> B[End]\n```";
29
+ readonly math: "Inline math $x^2 + y^2 = z^2$ in a sentence.\n\n$$\nE = mc^2\n$$";
30
+ readonly rawHtml: "Before <b>bold html</b> after.\n\n<script>window.hasNdlResponseXss = true;</script>\n\n<img src=\"x\" onerror=\"window.hasNdlResponseXss = true\" alt=\"html image\" />";
31
+ readonly clobbering: "<a id=\"x\" name=\"ndl-host-link\" href=\"https://neo4j.com/\">raw link</a> <img id=\"ndl-host-logo\" name=\"ndl-host-image\" src=\"/raw-image.png\" alt=\"raw image\" />\n\n<h2 id=\"ndl-host-title\">Raw heading</h2>\n\nA footnote reference[^1].\n\n[^1]: The footnote.";
32
+ readonly incompleteLink: "Read more in [the docs](https://neo4j.com/do";
33
+ readonly incompleteImage: "Look at this ![Partial image](https://exa";
34
+ readonly incompleteBold: "This is **unfinished bold";
35
+ };
36
+ export type ResponseFixtureName = keyof typeof responseFixtures;
37
+ //# sourceMappingURL=response-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-fixtures.d.ts","sourceRoot":"","sources":["../../../../../src/ai/response/stories/response-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AASH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;CAqEnB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,gBAAgB,CAAC"}
@@ -20,5 +20,27 @@
20
20
  */
21
21
  export declare const Languages: readonly ["asciidoc", "bash", "c", "csharp", "css", "css-extras", "cypher", "docker", "json", "go", "graphql", "java", "javadoc", "javascript", "jsx", "kotlin", "php", "python", "regex", "rust", "sql", "typescript", "xml", "yaml"];
22
22
  export type LanguageProp = (typeof Languages)[number];
23
+ /**
24
+ * The parts of the Prism instance that we need when working with a
25
+ * refractor grammar. Since this package doesn't depend directly on
26
+ * refractor's types, we only define the bits we use.
27
+ */
28
+ export interface RefractorPrism {
29
+ languages: {
30
+ bash?: {
31
+ parameter?: {
32
+ pattern: RegExp;
33
+ };
34
+ };
35
+ };
36
+ }
37
+ /**
38
+ * A refractor grammar registers itself on a Prism instance.
39
+ * This type covers the parts of refractor's `Syntax` type that we use.
40
+ */
41
+ export type RefractorGrammar = ((prism: RefractorPrism) => void) & {
42
+ displayName: string;
43
+ aliases?: string[];
44
+ };
23
45
  export declare const loadLanguage: (language: LanguageProp) => Promise<typeof import("react-syntax-highlighter/dist/esm/languages/prism/asciidoc")>;
24
46
  //# sourceMappingURL=code-languages.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-languages.d.ts","sourceRoot":"","sources":["../../../src/code-block/code-languages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,eAAO,MAAM,SAAS,wOAyBZ,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,eAAO,MAAM,YAAY,GAAI,UAAU,YAAY,yFAuDlD,CAAC"}
1
+ {"version":3,"file":"code-languages.d.ts","sourceRoot":"","sources":["../../../src/code-block/code-languages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,eAAO,MAAM,SAAS,wOAyBZ,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE;QACT,IAAI,CAAC,EAAE;YACL,SAAS,CAAC,EAAE;gBAAE,OAAO,EAAE,MAAM,CAAA;aAAE,CAAC;SACjC,CAAC;KACH,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC,GAAG;IACjE,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AA6BF,eAAO,MAAM,YAAY,GAAI,UAAU,YAAY,yFAyDlD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-ndl/react",
3
- "version": "4.25.7",
3
+ "version": "4.25.9",
4
4
  "sideEffects": false,
5
5
  "description": "React implementation of Neo4j Design System",
6
6
  "keywords": [
@@ -448,7 +448,7 @@
448
448
  "react-stately": "3.41.0",
449
449
  "react-syntax-highlighter": "16.1.1",
450
450
  "sonner": "2.0.7",
451
- "streamdown": "1.6.11",
451
+ "streamdown": "2.7.0",
452
452
  "temporal-polyfill": "1.0.1",
453
453
  "tinycolor2": "1.6.0",
454
454
  "usehooks-ts": "3.1.1",
@@ -2,7 +2,7 @@
2
2
  name: ndl-react
3
3
  metadata:
4
4
  package: '@neo4j-ndl/react'
5
- version: '4.25.7'
5
+ version: '4.25.9'
6
6
  description: >-
7
7
  Build and edit UI with the Neo4j Needle React design system
8
8
  (@neo4j-ndl/react). Use when adding, composing, or modifying Needle components
@@ -15,7 +15,7 @@ description: >-
15
15
 
16
16
  # Neo4j Needle (@neo4j-ndl/react)
17
17
 
18
- > 📌 Shipped with `@neo4j-ndl/react` v4.25.7. Once installed into your repo (e.g. via
18
+ > 📌 Shipped with `@neo4j-ndl/react` v4.25.9. Once installed into your repo (e.g. via
19
19
  > `npx skills add`) this folder is detached from the package — the installed
20
20
  > package (TypeScript types in `node_modules/@neo4j-ndl/react`) is the source of
21
21
  > truth.