diff --git a/docs/frontend/javascript/controllers/clipboard_controller.js b/docs/frontend/javascript/controllers/clipboard_controller.js index 6ac34795..43ee258d 100644 --- a/docs/frontend/javascript/controllers/clipboard_controller.js +++ b/docs/frontend/javascript/controllers/clipboard_controller.js @@ -4,18 +4,42 @@ import { Controller } from "@hotwired/stimulus" export default class ClipboardController extends Controller { connect () { this.element.addEventListener("clipboard-copy", this.showSuccess) + this.element.addEventListener("click", this) + } + + handleEvent (evt) { + if (evt.type === "click") { + this.handleClick(evt) + return + } + } + + handleClick (evt) { + const el = /** @type {HTMLElement} */ (this.element.getRootNode()).querySelector(`#${this.element.getAttribute("for")}`) + // Only for + if (el.localName !== "light-code") { return } + + const lightCode = /** @type {import("light-pen/exports/components/light-code/light-code.js").default} */ (el) + + lightCode.code + navigator.clipboard.writeText(lightCode.code).then(() => { + this.element.dispatchEvent(new Event("clipboard-copy", { bubbles: true, composed: true, cancelable: false })) + }) } showSuccess = () => { this.element.classList.add("clipboard--success") + this.element.closest("sl-tooltip").content = "Copied!" this.element.classList.remove("clipboard--idle") if (this.timeout) { clearTimeout(this.timeout) } this.timeout = setTimeout(() => { + this.element.closest("sl-tooltip").content = "Copy" this.element.classList.remove("clipboard--success") this.element.classList.add("clipboard--idle") }, 2_000) } } + diff --git a/docs/frontend/styles/overrides/light-pen.css b/docs/frontend/styles/overrides/light-pen.css index cb88526e..892d7411 100644 --- a/docs/frontend/styles/overrides/light-pen.css +++ b/docs/frontend/styles/overrides/light-pen.css @@ -1,5 +1,3 @@ -light-preview { -} light-preview::before { content: "Preview"; background: var(--sl-color-neutral-600); @@ -19,3 +17,30 @@ light-preview { light-preview::part(base) { border-radius: 0px; } + +/** light-code */ +light-code::part(code) { + font-size: 0.85rem; + padding-top: 4px; + border-top: 1px solid var(--divider-color); +} + +light-code:defined > [slot="code"] { + display: none; +} + +light-code > [slot="code"] { + display: block; + overflow: auto; + /* this creates "hard" line-wrapping where it will scroll horizontally. */ + white-space: pre; + word-break: break-all; + +} + +light-code[wrap="soft"] > [slot="code"] { + /* this creates "soft" line-wrapping. */ + word-break: break-word; + white-space: pre-wrap; +} + diff --git a/docs/package.json b/docs/package.json index 94544d4d..d5a69e2f 100644 --- a/docs/package.json +++ b/docs/package.json @@ -12,7 +12,7 @@ "esbuild": "^0.21.5", "glob": "^8.1.0", "hast-util-to-html": "^9.0.3", - "light-pen": "^4.1.0", + "light-pen": "^4.2.0", "postcss": "^8.4.47", "postcss-flexbugs-fixes": "^5.0.2", "postcss-import": "^14.1.0", diff --git a/docs/plugins/builders/inspectors.rb b/docs/plugins/builders/inspectors.rb index 0e99ca1c..950bd258 100644 --- a/docs/plugins/builders/inspectors.rb +++ b/docs/plugins/builders/inspectors.rb @@ -6,6 +6,7 @@ def build grab_headers(document) mark_external(document) syntax_highlight(document) + wrap_light_code(document) end end @@ -23,15 +24,49 @@ def mark_external(document) end end + def wrap_light_code(document) + document.css("light-code").each do |el| + lang = el["language"].to_s === "" ? "html" : el["language"] + lang = Syntax.full_language(lang) + id = el["id"] || "code-block-" + SecureRandom.uuid + el["id"] = id + + el.wrap("
") + + actions = <<-HTML +
+
+ #{lang} +
+ + + + +
+ HTML + + el.add_previous_sibling(actions) + end + end + def syntax_highlight(document) - document.css(":not(.syntax-block) > div.highlighter-rouge").each do |el| + document.css("div.highlighter-rouge").each do |el| text = el.inner_text lang = el["class"].scan(/\s?language-.*\s/).last lang = lang.strip.split("-")[1] if lang lang = Syntax.full_language(lang) - id = SecureRandom.uuid + id = "code-block-" + SecureRandom.uuid el.wrap("
") @@ -41,15 +76,17 @@ def syntax_highlight(document) #{lang} - - - - + + + + + + diff --git a/docs/pnpm-lock.yaml b/docs/pnpm-lock.yaml index eb6866fc..a04f22e5 100644 --- a/docs/pnpm-lock.yaml +++ b/docs/pnpm-lock.yaml @@ -70,8 +70,8 @@ importers: specifier: ^9.0.3 version: 9.0.3 light-pen: - specifier: ^4.1.0 - version: 4.1.0 + specifier: ^4.2.0 + version: 4.2.0 postcss: specifier: ^8.4.47 version: 8.4.47 @@ -90,16 +90,12 @@ importers: packages: - '@babel/code-frame@7.24.7': - resolution: {integrity: sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==} + '@babel/code-frame@7.26.2': + resolution: {integrity: sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==} engines: {node: '>=6.9.0'} - '@babel/helper-validator-identifier@7.24.7': - resolution: {integrity: sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==} - engines: {node: '>=6.9.0'} - - '@babel/highlight@7.24.7': - resolution: {integrity: sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==} + '@babel/helper-validator-identifier@7.25.9': + resolution: {integrity: sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==} engines: {node: '>=6.9.0'} '@csstools/postcss-cascade-layers@1.1.1': @@ -470,8 +466,8 @@ packages: '@types/debounce@1.2.4': resolution: {integrity: sha512-jBqiORIzKDOToaF63Fm//haOCHuwQuLa2202RK4MozpA6lh93eCBc+/8+wZn5OzjJt3ySdc+74SXWXB55Ewtyw==} - '@types/express-serve-static-core@5.0.0': - resolution: {integrity: sha512-AbXMTZGt40T+KON9/Fdxx0B2WK5hsgxcfXJLr5bFpZ7b4JCex2WyQPTEKdXqfHiY5nKKBScZ7yCoO6Pvgxfvnw==} + '@types/express-serve-static-core@5.0.1': + resolution: {integrity: sha512-CRICJIl0N5cXDONAdlTv5ShATZ4HEwk6kDDIW2/w9qOWKg+NU/5F8wYRWCrONad0/UKkloNSmmyN/wX4rtpbVA==} '@types/express@5.0.0': resolution: {integrity: sha512-DvZriSMehGHL1ZNLzi6MidnsDhUZM/x2pRdDIKdwbUNqqwHxMlRdkxtn6/EPKyqKpHqTl/4nRZsRNLpZxZRpPQ==} @@ -479,8 +475,8 @@ packages: '@types/hast@3.0.4': resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==} - '@types/http-assert@1.5.5': - resolution: {integrity: sha512-4+tE/lwdAahgZT1g30Jkdm9PzFRde0xwxBNUyRsCitRvCQB90iuA2uJYdUnhnANRcqGXaWOGY4FEoxeElNAK2g==} + '@types/http-assert@1.5.6': + resolution: {integrity: sha512-TTEwmtjgVbYAzZYWyeHPrrtWnfVkm8tQkP8P21uQifPgMRgjrow3XDEYqucuC8SKZJT7pUnhU/JymvjggxO9vw==} '@types/http-errors@2.0.4': resolution: {integrity: sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==} @@ -518,8 +514,8 @@ packages: '@types/mime@1.3.5': resolution: {integrity: sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==} - '@types/node@22.7.4': - resolution: {integrity: sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg==} + '@types/node@22.8.7': + resolution: {integrity: sha512-LidcG+2UeYIWcMuMUpBKOnryBWG/rnmOHQR5apjn8myTQcx3rinFRn7DcIFhMnS0PPFSC6OafdIKEad0lj6U0Q==} '@types/parse5@6.0.3': resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==} @@ -586,10 +582,6 @@ packages: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} - ansi-styles@3.2.1: - resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} - engines: {node: '>=4'} - ansi-styles@4.3.0: resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} engines: {node: '>=8'} @@ -656,10 +648,6 @@ packages: ccount@2.0.1: resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==} - chalk@2.4.2: - resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} - engines: {node: '>=4'} - chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} @@ -694,16 +682,10 @@ packages: resolution: {integrity: sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==} engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'} - color-convert@1.9.3: - resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} - color-convert@2.0.1: resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} engines: {node: '>=7.0.0'} - color-name@1.1.3: - resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} - color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} @@ -884,10 +866,6 @@ packages: escape-html@1.0.3: resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} - escape-string-regexp@1.0.5: - resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} - engines: {node: '>=0.8.0'} - escape-string-regexp@4.0.0: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} @@ -966,10 +944,6 @@ packages: graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} - has-flag@3.0.0: - resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} - engines: {node: '>=4'} - has-flag@4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} @@ -1111,8 +1085,8 @@ packages: resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==} engines: {node: '>=8'} - isbinaryfile@5.0.2: - resolution: {integrity: sha512-GvcjojwonMjWbTkfMpnVHVqXW/wKMYDfEpY94/8zy8HFMOqb/VL6oeONq9v87q4ttVlaTLnGXnJD4B5B1OTGIg==} + isbinaryfile@5.0.4: + resolution: {integrity: sha512-YKBKVkKhty7s8rxddb40oOkuP0NbaeXrQvLin6QMHL7Ypiy2RW9LwOVrVgZRyOrhQlayMd9t+D8yDy8MKFTSDQ==} engines: {node: '>= 18.0.0'} isexe@2.0.0: @@ -1165,8 +1139,8 @@ packages: konnors-ninja-keys@1.13.4: resolution: {integrity: sha512-cz/PFrwLhioB6gDtsSjUC7VPUcBYCtKLMWe/aY3Az8qgPI+O1BYBSxSCHq71cyJBNc/anh4NA96bOFS49YFa4Q==} - light-pen@4.1.0: - resolution: {integrity: sha512-q2CdVKRyrN8tbBkoLRuiqkLfuW5i24QywvjE5YSJCgnz1xUc5J5NjcRYR3NTP8qPnJbQnP3kUQw+1oRd6JS+iQ==} + light-pen@4.2.0: + resolution: {integrity: sha512-0ZaEyr8wLEYEt49EtkkOsseEIJ0JYP8zbzgBdKa6bVgpfnKm5wIrCEDOMFunhmm9sNE5xCs7TMXU3RLqsEQQkA==} lilconfig@2.1.0: resolution: {integrity: sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==} @@ -1367,6 +1341,9 @@ packages: picocolors@1.1.0: resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==} + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} @@ -1596,8 +1573,8 @@ packages: prosemirror-collab@1.3.1: resolution: {integrity: sha512-4SnynYR9TTYaQVXd/ieUvsVV4PDMBzrq2xPUWutHivDuOshZXqQ5rGbZM84HEaXKbLdItse7weMGOUdDVcLKEQ==} - prosemirror-commands@1.6.0: - resolution: {integrity: sha512-xn1U/g36OqXn2tn5nGmvnnimAj/g1pUx2ypJJIe8WkVX83WyJVC5LTARaxZa2AtQRwntu9Jc5zXs9gL9svp/mg==} + prosemirror-commands@1.6.2: + resolution: {integrity: sha512-0nDHH++qcf/BuPLYvmqZTUUsPJUCPBUXt0J1ErTcDIS369CTp773itzLGIgIXG4LJXOlwYCr44+Mh4ii6MP1QA==} prosemirror-dropcursor@1.8.1: resolution: {integrity: sha512-M30WJdJZLyXHi3N8vxN6Zh5O8ZBbQCz0gURTfPmTIBNQ5pxrdU7A58QkNqfa98YEjSAL1HUyyU34f6Pm5xBSGw==} @@ -1620,8 +1597,8 @@ packages: prosemirror-menu@1.2.4: resolution: {integrity: sha512-S/bXlc0ODQup6aiBbWVsX/eM+xJgCTAfMq/nLqaO5ID/am4wS0tTCIkzwytmao7ypEtjj39i7YbJjAgO20mIqA==} - prosemirror-model@1.22.3: - resolution: {integrity: sha512-V4XCysitErI+i0rKFILGt/xClnFJaohe/wrrlT2NSZ+zk8ggQfDH4x2wNK7Gm0Hp4CIoWizvXFP7L9KMaCuI0Q==} + prosemirror-model@1.23.0: + resolution: {integrity: sha512-Q/fgsgl/dlOAW9ILu4OOhYWQbc7TQd4BwKH/RwmUjyVf8682Be4zj3rOYdLnYEcGzyg8LL9Q5IWYKD8tdToreQ==} prosemirror-schema-basic@1.2.3: resolution: {integrity: sha512-h+H0OQwZVqMon1PNn0AG9cTfx513zgIG2DY00eJ00Yvgb3UD+GQ/VlWW5rcaxacpCGT1Yx8nuhwXk4+QbXUfJA==} @@ -1632,8 +1609,8 @@ packages: prosemirror-state@1.4.3: resolution: {integrity: sha512-goFKORVbvPuAQaXhpbemJFRKJ2aixr+AZMGiquiqKxaucC6hlpHNZHWgz5R7dS4roHiwq9vDctE//CZ++o0W1Q==} - prosemirror-tables@1.5.0: - resolution: {integrity: sha512-VMx4zlYWm7aBlZ5xtfJHpqa3Xgu3b7srV54fXYnXgsAcIGRqKSrhiK3f89omzzgaAgAtDOV4ImXnLKhVfheVNQ==} + prosemirror-tables@1.6.1: + resolution: {integrity: sha512-p8WRJNA96jaNQjhJolmbxTzd6M4huRE5xQ8OxjvMhQUP0Nzpo4zz6TztEiwk6aoqGBhz9lxRWR1yRZLlpQN98w==} prosemirror-trailing-node@3.0.0: resolution: {integrity: sha512-xiun5/3q0w5eRnGYfNlW1uU9W6x5MoFKWwq/0TIRgt09lv7Hcser2QYV8t4muXbEr+Fwo0geYn79Xs4GKywrRQ==} @@ -1642,11 +1619,11 @@ packages: prosemirror-state: ^1.4.2 prosemirror-view: ^1.33.8 - prosemirror-transform@1.10.0: - resolution: {integrity: sha512-9UOgFSgN6Gj2ekQH5CTDJ8Rp/fnKR2IkYfGdzzp5zQMFsS4zDllLVx/+jGcX86YlACpG7UR5fwAXiWzxqWtBTg==} + prosemirror-transform@1.10.2: + resolution: {integrity: sha512-2iUq0wv2iRoJO/zj5mv8uDUriOHWzXRnOTVgCzSXnktS/2iQRa3UUQwVlkBlYZFtygw6Nh1+X4mGqoYBINn5KQ==} - prosemirror-view@1.34.3: - resolution: {integrity: sha512-mKZ54PrX19sSaQye+sef+YjBbNu2voNwLS1ivb6aD2IRmxRGW64HU9B644+7OfJStGLyxvOreKqEgfvXa91WIA==} + prosemirror-view@1.35.0: + resolution: {integrity: sha512-Umtbh22fmUlpZpRTiOVXA0PpdRZeYEeXQsLp51VfnMhjkJrqJ0n8APinIZrRAD5Jr3UxH8FnOaUqRylSuMsqHA==} punycode.js@2.3.1: resolution: {integrity: sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==} @@ -1673,8 +1650,8 @@ packages: resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} engines: {node: '>=8.10.0'} - readdirp@4.0.1: - resolution: {integrity: sha512-GkMg9uOTpIWWKbSsgwb5fA4EavTR+SG/PMPoAY8hkhHfEEY0/vqljY+XHqtDf2cr2IJtoNRDbrrEpZUiZCkYRw==} + readdirp@4.0.2: + resolution: {integrity: sha512-yDMz9g+VaZkqBYS/ozoBJwaBhTbZo3UNYQHNRw1D3UFQB8oHB4uS/tAODO+ZLjGWmUbKnIlOWO+aaIiAxrUWHA==} engines: {node: '>= 14.16.0'} resolve-path@1.4.0: @@ -1777,10 +1754,6 @@ packages: resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} engines: {node: '>=6'} - supports-color@5.5.0: - resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} - engines: {node: '>=4'} - supports-color@7.2.0: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} engines: {node: '>=8'} @@ -1909,19 +1882,13 @@ packages: snapshots: - '@babel/code-frame@7.24.7': - dependencies: - '@babel/highlight': 7.24.7 - picocolors: 1.1.0 - - '@babel/helper-validator-identifier@7.24.7': {} - - '@babel/highlight@7.24.7': + '@babel/code-frame@7.26.2': dependencies: - '@babel/helper-validator-identifier': 7.24.7 - chalk: 2.4.2 + '@babel/helper-validator-identifier': 7.25.9 js-tokens: 4.0.0 - picocolors: 1.1.0 + picocolors: 1.1.1 + + '@babel/helper-validator-identifier@7.25.9': {} '@csstools/postcss-cascade-layers@1.1.1(postcss@8.4.47)': dependencies: @@ -2189,7 +2156,7 @@ snapshots: dependencies: prosemirror-changeset: 2.2.1 prosemirror-collab: 1.3.1 - prosemirror-commands: 1.6.0 + prosemirror-commands: 1.6.2 prosemirror-dropcursor: 1.8.1 prosemirror-gapcursor: 1.3.2 prosemirror-history: 1.4.1 @@ -2197,36 +2164,36 @@ snapshots: prosemirror-keymap: 1.2.2 prosemirror-markdown: 1.13.1 prosemirror-menu: 1.2.4 - prosemirror-model: 1.22.3 + prosemirror-model: 1.23.0 prosemirror-schema-basic: 1.2.3 prosemirror-schema-list: 1.4.1 prosemirror-state: 1.4.3 - prosemirror-tables: 1.5.0 - prosemirror-trailing-node: 3.0.0(prosemirror-model@1.22.3)(prosemirror-state@1.4.3)(prosemirror-view@1.34.3) - prosemirror-transform: 1.10.0 - prosemirror-view: 1.34.3 + prosemirror-tables: 1.6.1 + prosemirror-trailing-node: 3.0.0(prosemirror-model@1.23.0)(prosemirror-state@1.4.3)(prosemirror-view@1.35.0) + prosemirror-transform: 1.10.2 + prosemirror-view: 1.35.0 '@types/accepts@1.3.7': dependencies: - '@types/node': 22.7.4 + '@types/node': 22.8.7 '@types/babel__code-frame@7.0.6': {} '@types/body-parser@1.19.5': dependencies: '@types/connect': 3.4.38 - '@types/node': 22.7.4 + '@types/node': 22.8.7 '@types/chai@4.3.20': {} '@types/co-body@6.1.3': dependencies: - '@types/node': 22.7.4 + '@types/node': 22.8.7 '@types/qs': 6.9.16 '@types/connect@3.4.38': dependencies: - '@types/node': 22.7.4 + '@types/node': 22.8.7 '@types/content-disposition@0.5.8': {} @@ -2237,13 +2204,13 @@ snapshots: '@types/connect': 3.4.38 '@types/express': 5.0.0 '@types/keygrip': 1.0.6 - '@types/node': 22.7.4 + '@types/node': 22.8.7 '@types/debounce@1.2.4': {} - '@types/express-serve-static-core@5.0.0': + '@types/express-serve-static-core@5.0.1': dependencies: - '@types/node': 22.7.4 + '@types/node': 22.8.7 '@types/qs': 6.9.16 '@types/range-parser': 1.2.7 '@types/send': 0.17.4 @@ -2251,7 +2218,7 @@ snapshots: '@types/express@5.0.0': dependencies: '@types/body-parser': 1.19.5 - '@types/express-serve-static-core': 5.0.0 + '@types/express-serve-static-core': 5.0.1 '@types/qs': 6.9.16 '@types/serve-static': 1.15.7 @@ -2259,7 +2226,7 @@ snapshots: dependencies: '@types/unist': 3.0.3 - '@types/http-assert@1.5.5': {} + '@types/http-assert@1.5.6': {} '@types/http-errors@2.0.4': {} @@ -2284,11 +2251,11 @@ snapshots: '@types/accepts': 1.3.7 '@types/content-disposition': 0.5.8 '@types/cookies': 0.9.0 - '@types/http-assert': 1.5.5 + '@types/http-assert': 1.5.6 '@types/http-errors': 2.0.4 '@types/keygrip': 1.0.6 '@types/koa-compose': 3.2.8 - '@types/node': 22.7.4 + '@types/node': 22.8.7 '@types/linkify-it@5.0.0': {} @@ -2305,7 +2272,7 @@ snapshots: '@types/mime@1.3.5': {} - '@types/node@22.7.4': + '@types/node@22.8.7': dependencies: undici-types: 6.19.8 @@ -2325,12 +2292,12 @@ snapshots: '@types/send@0.17.4': dependencies: '@types/mime': 1.3.5 - '@types/node': 22.7.4 + '@types/node': 22.8.7 '@types/serve-static@1.15.7': dependencies: '@types/http-errors': 2.0.4 - '@types/node': 22.7.4 + '@types/node': 22.8.7 '@types/send': 0.17.4 '@types/trusted-types@2.0.7': {} @@ -2339,7 +2306,7 @@ snapshots: '@types/ws@7.4.7': dependencies: - '@types/node': 22.7.4 + '@types/node': 22.8.7 '@ungap/structured-clone@1.2.0': {} @@ -2357,7 +2324,7 @@ snapshots: es-module-lexer: 1.5.4 get-stream: 6.0.1 is-stream: 2.0.1 - isbinaryfile: 5.0.2 + isbinaryfile: 5.0.4 koa: 2.15.3 koa-etag: 4.0.0 koa-send: 5.0.1 @@ -2388,7 +2355,7 @@ snapshots: '@web/test-runner-core@0.13.4': dependencies: - '@babel/code-frame': 7.24.7 + '@babel/code-frame': 7.26.2 '@types/babel__code-frame': 7.0.6 '@types/co-body': 6.1.3 '@types/convert-source-map': 2.0.3 @@ -2430,10 +2397,6 @@ snapshots: ansi-regex@5.0.1: {} - ansi-styles@3.2.1: - dependencies: - color-convert: 1.9.3 - ansi-styles@4.3.0: dependencies: color-convert: 2.0.1 @@ -2502,12 +2465,6 @@ snapshots: ccount@2.0.1: {} - chalk@2.4.2: - dependencies: - ansi-styles: 3.2.1 - escape-string-regexp: 1.0.5 - supports-color: 5.5.0 - chalk@4.1.2: dependencies: ansi-styles: 4.3.0 @@ -2531,7 +2488,7 @@ snapshots: chokidar@4.0.1: dependencies: - readdirp: 4.0.1 + readdirp: 4.0.2 cli-cursor@3.1.0: dependencies: @@ -2549,16 +2506,10 @@ snapshots: co@4.6.0: {} - color-convert@1.9.3: - dependencies: - color-name: 1.1.3 - color-convert@2.0.1: dependencies: color-name: 1.1.4 - color-name@1.1.3: {} - color-name@1.1.4: {} comma-separated-tokens@2.0.3: {} @@ -2710,8 +2661,6 @@ snapshots: escape-html@1.0.3: {} - escape-string-regexp@1.0.5: {} - escape-string-regexp@4.0.0: {} etag@1.8.1: {} @@ -2802,8 +2751,6 @@ snapshots: graceful-fs@4.2.11: {} - has-flag@3.0.0: {} - has-flag@4.0.0: {} has-property-descriptors@1.0.2: @@ -2940,7 +2887,7 @@ snapshots: dependencies: is-docker: 2.2.1 - isbinaryfile@5.0.2: {} + isbinaryfile@5.0.4: {} isexe@2.0.0: {} @@ -3032,7 +2979,7 @@ snapshots: lit: 2.8.0 web-component-define: 2.0.11 - light-pen@4.1.0: + light-pen@4.2.0: dependencies: '@open-wc/semantic-dom-diff': 0.20.1 diff: 5.2.0 @@ -3237,6 +3184,8 @@ snapshots: picocolors@1.1.0: {} + picocolors@1.1.1: {} + picomatch@2.3.1: {} pify@2.3.0: {} @@ -3468,42 +3417,42 @@ snapshots: prosemirror-changeset@2.2.1: dependencies: - prosemirror-transform: 1.10.0 + prosemirror-transform: 1.10.2 prosemirror-collab@1.3.1: dependencies: prosemirror-state: 1.4.3 - prosemirror-commands@1.6.0: + prosemirror-commands@1.6.2: dependencies: - prosemirror-model: 1.22.3 + prosemirror-model: 1.23.0 prosemirror-state: 1.4.3 - prosemirror-transform: 1.10.0 + prosemirror-transform: 1.10.2 prosemirror-dropcursor@1.8.1: dependencies: prosemirror-state: 1.4.3 - prosemirror-transform: 1.10.0 - prosemirror-view: 1.34.3 + prosemirror-transform: 1.10.2 + prosemirror-view: 1.35.0 prosemirror-gapcursor@1.3.2: dependencies: prosemirror-keymap: 1.2.2 - prosemirror-model: 1.22.3 + prosemirror-model: 1.23.0 prosemirror-state: 1.4.3 - prosemirror-view: 1.34.3 + prosemirror-view: 1.35.0 prosemirror-history@1.4.1: dependencies: prosemirror-state: 1.4.3 - prosemirror-transform: 1.10.0 - prosemirror-view: 1.34.3 + prosemirror-transform: 1.10.2 + prosemirror-view: 1.35.0 rope-sequence: 1.3.4 prosemirror-inputrules@1.4.0: dependencies: prosemirror-state: 1.4.3 - prosemirror-transform: 1.10.0 + prosemirror-transform: 1.10.2 prosemirror-keymap@1.2.2: dependencies: @@ -3514,60 +3463,60 @@ snapshots: dependencies: '@types/markdown-it': 14.1.2 markdown-it: 14.1.0 - prosemirror-model: 1.22.3 + prosemirror-model: 1.23.0 prosemirror-menu@1.2.4: dependencies: crelt: 1.0.6 - prosemirror-commands: 1.6.0 + prosemirror-commands: 1.6.2 prosemirror-history: 1.4.1 prosemirror-state: 1.4.3 - prosemirror-model@1.22.3: + prosemirror-model@1.23.0: dependencies: orderedmap: 2.1.1 prosemirror-schema-basic@1.2.3: dependencies: - prosemirror-model: 1.22.3 + prosemirror-model: 1.23.0 prosemirror-schema-list@1.4.1: dependencies: - prosemirror-model: 1.22.3 + prosemirror-model: 1.23.0 prosemirror-state: 1.4.3 - prosemirror-transform: 1.10.0 + prosemirror-transform: 1.10.2 prosemirror-state@1.4.3: dependencies: - prosemirror-model: 1.22.3 - prosemirror-transform: 1.10.0 - prosemirror-view: 1.34.3 + prosemirror-model: 1.23.0 + prosemirror-transform: 1.10.2 + prosemirror-view: 1.35.0 - prosemirror-tables@1.5.0: + prosemirror-tables@1.6.1: dependencies: prosemirror-keymap: 1.2.2 - prosemirror-model: 1.22.3 + prosemirror-model: 1.23.0 prosemirror-state: 1.4.3 - prosemirror-transform: 1.10.0 - prosemirror-view: 1.34.3 + prosemirror-transform: 1.10.2 + prosemirror-view: 1.35.0 - prosemirror-trailing-node@3.0.0(prosemirror-model@1.22.3)(prosemirror-state@1.4.3)(prosemirror-view@1.34.3): + prosemirror-trailing-node@3.0.0(prosemirror-model@1.23.0)(prosemirror-state@1.4.3)(prosemirror-view@1.35.0): dependencies: '@remirror/core-constants': 3.0.0 escape-string-regexp: 4.0.0 - prosemirror-model: 1.22.3 + prosemirror-model: 1.23.0 prosemirror-state: 1.4.3 - prosemirror-view: 1.34.3 + prosemirror-view: 1.35.0 - prosemirror-transform@1.10.0: + prosemirror-transform@1.10.2: dependencies: - prosemirror-model: 1.22.3 + prosemirror-model: 1.23.0 - prosemirror-view@1.34.3: + prosemirror-view@1.35.0: dependencies: - prosemirror-model: 1.22.3 + prosemirror-model: 1.23.0 prosemirror-state: 1.4.3 - prosemirror-transform: 1.10.0 + prosemirror-transform: 1.10.2 punycode.js@2.3.1: {} @@ -3594,7 +3543,7 @@ snapshots: dependencies: picomatch: 2.3.1 - readdirp@4.0.1: {} + readdirp@4.0.2: {} resolve-path@1.4.0: dependencies: @@ -3689,10 +3638,6 @@ snapshots: strip-final-newline@2.0.0: {} - supports-color@5.5.0: - dependencies: - has-flag: 3.0.0 - supports-color@7.2.0: dependencies: has-flag: 4.0.0 diff --git a/tests/unit/events.test.js b/tests/unit/events.test.js index 758291d3..6dd86300 100644 --- a/tests/unit/events.test.js +++ b/tests/unit/events.test.js @@ -275,8 +275,10 @@ test("Should not fire initialize and before-initialize events until after defer- assert.isTrue(initializeSpy.notCalled) rhinoEditor.removeAttribute("defer-initialize") - await rhinoEditor.updateComplete - await aTimeout(10) + + await waitUntil(() => { + return beforeInitializeSpy.called && initializeSpy.called + }) assert.isTrue(beforeInitializeSpy.calledOnce) assert.isTrue(initializeSpy.calledOnce)