forgejo/web_src/js
oliverpool 83ea43cf49 frontend: generic lazy loader for webcomponents (#8510)
After seeing #8111 use a webcomponent, I think that they are a neat usecase for Forgejo where most of the frontend is backend-generated, with some "island of enhancements".

I am considering using a webcomponent for the CITATION management (last occurrence of [`Blob.GetBlobContent`](https://codeberg.org/forgejo/forgejo/issues/8222)), however I noticed that the developer experience wasn't ideal.

With this PR it would be very easy to declare a webcomponent, which will be loaded only if needed (I converted `model-viewer` and `pdf-object` to this technique).

Some cleanup in the neighbor webcomponents.

## Testing

1) Create a new repository or use an existing one.
2) Upload a `.pdf` or `.glb`  file (such as https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/testdata/data/viewer/Unicode%E2%9D%A4%E2%99%BBTest.glb)
3) Open the Network inspector and view the file in the repository.
    - After a short loading spinner, the PDF or 3D model should be rendered in a viewer
    - the related JS should have been loaded (e.g. http://localhost:3000/assets/js/model-viewer.494bf0cd.js)
    - visiting another page and check that this JS file isn't loaded

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8510
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-by: Beowulf <beowulf@beocode.eu>
Co-authored-by: oliverpool <git@olivier.pfad.fr>
Co-committed-by: oliverpool <git@olivier.pfad.fr>
2025-07-23 04:10:50 +02:00
..
components feat(ui): use simplified visibility label in dashboard orgs list (#8582) 2025-07-21 09:20:24 +02:00
features feat: remove fomantic's tab module (#8587) 2025-07-21 22:33:17 +02:00
markup chore: Update katex import path 2024-12-18 01:17:23 +01:00
modules feat: remove fomantic's tab module (#8587) 2025-07-21 22:33:17 +02:00
render frontend: generic lazy loader for webcomponents (#8510) 2025-07-23 04:10:50 +02:00
standalone [CHORE] Proper chunking for swagger 2024-08-22 15:48:05 +02:00
utils Update dependency eslint-plugin-unicorn to v57 (forgejo) (#7181) 2025-03-09 20:49:49 +00:00
vendor Vendor jquery.are-you-sure with strict mode fixes (#26901) 2023-09-06 00:02:44 +00:00
webcomponents frontend: generic lazy loader for webcomponents (#8510) 2025-07-23 04:10:50 +02:00
bootstrap.js Suppress Monaco JavaScript errors in Safari (#3805) 2024-05-18 21:07:09 +00:00
bootstrap.test.js Avoid duplicate JS error messages on UI (#28873) 2024-01-21 14:23:08 +00:00
htmx.js Update dependency htmx.org to v2 (forgejo) (#8342) 2025-06-29 13:52:24 +02:00
index.js frontend: generic lazy loader for webcomponents (#8510) 2025-07-23 04:10:50 +02:00
jquery.js Forbid variables containing jQuery collections not having the $ prefix (#29839) 2024-03-20 08:46:30 +01:00
svg.js Reimplement editor Tab handling with accessibility safeguards (#6813) 2025-05-25 19:17:03 +02:00
svg.test.js Remove "class-name" from svg icon (#33540) 2025-02-25 12:56:30 +01:00
utils.js chore: add new lint rules 2024-10-23 08:10:18 +02:00
utils.test.js chore(ci): testSleep: show actual times on failures (#8271) 2025-06-25 15:58:55 +02:00
vitest.setup.js [BUG] Render emojis in labels in issue info popup 2024-03-30 11:18:46 +01:00