-
Notifications
You must be signed in to change notification settings - Fork 17
Migration to Lit Element #886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nd0ut
wants to merge
70
commits into
main
Choose a base branch
from
feat/lit-element
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 30 commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
5ab076d
feat: symbiote v2 update
nd0ut d7691fc
chore: fix symbiote state type warnings
nd0ut 2fd35a6
fix: use `inert` instead of `aria-hidden` to supress focus catch
nd0ut 7f3993c
feat(lit): add core Lit infrastructure and compatibility mixins
nd0ut 6a08b82
feat(lit): add LitBlock, LitActivityBlock, and LitUploaderBlock base …
nd0ut 3a1de48
chore: remove deprecated Block.ts and old processors
nd0ut 02dd5f5
refactor(blocks): migrate core uploader blocks to Lit
nd0ut 5dfb7b5
refactor(cloud-image-editor): migrate editor components to Lit
nd0ut f1e671f
refactor(cloud-image-editor): migrate CloudImageEditorActivity to Lit
nd0ut 78a53ad
refactor(solutions): migrate file uploader solutions to Lit
nd0ut f8fda71
refactor(img): rewrite uc-img components to TypeScript
nd0ut 5942e62
chore(locales): convert locale files from JS to TS
nd0ut fb9edc4
refactor(abstract): update managers and utilities for Lit compatibility
nd0ut f9c7b88
refactor: update exports and imports for Lit migration
nd0ut 9ec4799
chore: update dependencies and build config for Lit
nd0ut 53c6dc7
test: update test files for Lit migration
nd0ut 74f1718
chore(demo): update demo files for Lit migration
nd0ut 26edd3d
chore: fix missed dep while rebasing
nd0ut d1e95f6
chore: remove lit bundle
nd0ut 78403ab
chore(modal): expose dialog ref to ancestors
nd0ut d80a42f
chore: fix text binding
nd0ut d6c7f56
chore: fix symbiote layer unsubscribes
nd0ut 49a8377
chore: remove focus-visible polyfill
nd0ut f2a71ef
chore: fix file-item render pause on re-render
nd0ut fe605b1
chore: fix ai-found memory leaks
nd0ut 62af6de
chore: fix camera shot not freezing issue
nd0ut 7f3a67c
chore: remove unused waitForAttribute method
nd0ut faf9669
chore(demo): replace real public key with demopublickey
nd0ut 3e0db58
chore: apply linting fixes and remove unused imports
nd0ut a463157
chore(demo): reorganize demo pages and add bundle demos
nd0ut cbc98e1
chore: reorganize exports in index.ts and update version
nd0ut 58829eb
chore: update tsconfig.node.json types
nd0ut fcfb913
fix: use unsafeSVG instead of unsafeHTML for SVG sprite
nd0ut 2ee2cce
chore: add linked legal comments and include txt files in package
nd0ut ce2b8f7
chore: enable minification for dist build
nd0ut 78729ed
chore: add NODE_ENV=production for Lit production mode and bundle lit…
nd0ut 6cd3146
chore: use esbuild-minify-templates for HTML template minification
nd0ut f70d366
fix: remove non-existent jsx.ts entry from build items
nd0ut 3efb4a1
chore: update biome config and fix test
nd0ut 01c0c1a
chore: upgrade biome to 2.3.8
nd0ut 6633021
chore(biome): enable useConsistentMemberAccessibility rule
nd0ut c900d71
refactor: enforce TS access modifiers
nd0ut 1962d9b
chore: reorganize root exports
nd0ut e01f3c9
refactor: prefix private members with underscore
nd0ut eaec0c8
fix(css): use CSS variable for progress bar opacity control
nd0ut a49cdfe
refactor: replace @symbiotejs/symbiote with nanostores-based PubSub
nd0ut 34c9a48
refactor(types): cover shared state types
nd0ut cbc8cce
fix(symbiote-compat): create state on initialize
nd0ut 1cee417
refactor(symbiote-compat): use listenKeys from nanostore to subscribe…
nd0ut 848a89b
chore: enable props mangling to reduce bundle size
nd0ut a9e3a3c
chore: rebuild lockfile
nd0ut 1b32217
style: refresh locales demo and inline uploader styles
nd0ut 90f1ba6
style: apply lint fixes
nd0ut 1869c34
test: fix types test
nd0ut 7a39559
chore: normalize package exports API to be compatible with the origin…
nd0ut 9b5b86e
chore: fix biome warnings
nd0ut f1012c4
chore: refactor jsx types
nd0ut 5713a92
chore: fix npm tests
nd0ut beb61af
refactor: make centralized handling of shared context instances
nd0ut f56abff
Update config playground selects and inline preview sizing
nd0ut f27978b
fix: check for elemnt is being connected to the DOM inside async func…
nd0ut fc2814c
chore: fix vitest configuration
nd0ut 23ce031
refactor(PubSub): move contexts to static field
nd0ut 4c9acfd
build: reduce license in the bundles + add version and build time
nd0ut 3edb9f0
refactor: remove unused method
nd0ut 1d9e774
types: fix uc-img jsx types
nd0ut 0418aa2
fix: adjust aspect ratio icon rendering
nd0ut 2571cd0
fix: check if blocks registry still empty before destroy ctx
nd0ut 82bcdc7
refactor: uploadTrigger usage
nd0ut 18f73bd
fix(cloud-image-editor): network problems splash + image loading loop
nd0ut File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <title>Cloud Image Editor - Bundle Demo</title> | ||
| <link rel="stylesheet" href="../../web/uc-cloud-image-editor.min.css"> | ||
| <style> | ||
| .uc-cloud-image-editor { | ||
| width: 100vw; | ||
| height: 100vh; | ||
| } | ||
| body { | ||
| height: 100vh; | ||
| margin: 0; | ||
| } | ||
| </style> | ||
| <script type="module"> | ||
| import * as UC from '../../web/uc-cloud-image-editor.min.js'; | ||
|
|
||
| UC.defineComponents(UC); | ||
| </script> | ||
| </head> | ||
| <body> | ||
| <uc-config ctx-name="my-editor" pubkey="demopublickey" debug quality-insights="false" test-mode cdn-cname="https://ucarecdn.com/"></uc-config> | ||
| <uc-cloud-image-editor | ||
| uuid="f4dc9ebc-ed6d-4b4d-83d1-863bf1e4bb7f" | ||
| ctx-name="my-editor" | ||
| tabs="tuning,filters,crop" | ||
| crop-preset="1:1, 16:9, 4:3, 4:3, 3:4, 9:16" | ||
| class="uc-light" | ||
| ></uc-cloud-image-editor> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <title>File Uploader - IIFE Bundle Demo</title> | ||
| <link rel="stylesheet" href="../../web/uc-basic.min.css"> | ||
| <style> | ||
| @media (prefers-color-scheme: dark) { | ||
| body { | ||
| background-color: #121213; | ||
| } | ||
| } | ||
| </style> | ||
| <!-- IIFE bundle - no module required, UC is available globally --> | ||
| <script src="../../web/file-uploader.iife.min.js"></script> | ||
| <script> | ||
| // UC is available as a global variable | ||
| UC.defineComponents(UC); | ||
| </script> | ||
| </head> | ||
| <body> | ||
| <uc-file-uploader-regular ctx-name="my-uploader"></uc-file-uploader-regular> | ||
| <uc-config ctx-name="my-uploader" pubkey="demopublickey" debug quality-insights="false" test-mode></uc-config> | ||
| <uc-upload-ctx-provider ctx-name="my-uploader"></uc-upload-ctx-provider> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <title>Adaptive Image - Bundle Demo</title> | ||
| <style> | ||
| uc-img { | ||
| --uc-img-pubkey: "demopublickey"; | ||
| --uc-img-breakpoints: "200, 500, 800"; | ||
| display: contents; | ||
| } | ||
|
|
||
| uc-img > img { | ||
| transition: 1s; | ||
| } | ||
|
|
||
| uc-img > img[unresolved] { | ||
| transform: scale(0.8); | ||
| opacity: 0; | ||
| transition: 1s; | ||
| } | ||
|
|
||
| @media (prefers-color-scheme: dark) { | ||
| body { | ||
| background-color: #121213; | ||
| } | ||
| } | ||
| </style> | ||
| <script type="module"> | ||
| import '../../web/uc-img.min.js'; | ||
| </script> | ||
| </head> | ||
| <body> | ||
| <uc-img uuid="7124ae98-344c-42b2-ae2a-bd9aa79d76d8" width="500px"></uc-img> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <title>File Uploader Inline - Bundle Demo</title> | ||
| <link rel="stylesheet" href="../../web/uc-file-uploader-inline.min.css"> | ||
| <style> | ||
| @media (prefers-color-scheme: dark) { | ||
| body { | ||
| background-color: #121213; | ||
| } | ||
| } | ||
| </style> | ||
| <script type="module"> | ||
| import * as UC from '../../web/uc-file-uploader-inline.min.js'; | ||
|
|
||
| UC.defineComponents(UC); | ||
| </script> | ||
| </head> | ||
| <body> | ||
| <uc-file-uploader-inline ctx-name="my-uploader"></uc-file-uploader-inline> | ||
| <uc-config | ||
| ctx-name="my-uploader" | ||
| pubkey="demopublickey" | ||
| crop-preset="1:1" | ||
| cloud-image-editor-tabs="crop" | ||
| debug | ||
| quality-insights="false" | ||
| test-mode | ||
| ></uc-config> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <title>File Uploader Minimal - Bundle Demo</title> | ||
| <link rel="stylesheet" href="../../web/uc-file-uploader-minimal.min.css"> | ||
| <style> | ||
| @media (prefers-color-scheme: dark) { | ||
| body { | ||
| background-color: #121213; | ||
| } | ||
| } | ||
| </style> | ||
| <script type="module"> | ||
| import * as UC from '../../web/uc-file-uploader-minimal.min.js'; | ||
|
|
||
| UC.defineComponents(UC); | ||
| </script> | ||
| </head> | ||
| <body> | ||
| <uc-file-uploader-minimal ctx-name="my-uploader"></uc-file-uploader-minimal> | ||
| <uc-config ctx-name="my-uploader" pubkey="demopublickey" img-only group-output debug quality-insights="false" test-mode></uc-config> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <title>File Uploader Regular - Bundle Demo</title> | ||
| <link rel="stylesheet" href="../../web/uc-file-uploader-regular.min.css"> | ||
| <style> | ||
| @media (prefers-color-scheme: dark) { | ||
| body { | ||
| background-color: #121213; | ||
| } | ||
| } | ||
| </style> | ||
| <script type="module"> | ||
| import * as UC from '../../web/uc-file-uploader-regular.min.js'; | ||
|
|
||
| UC.defineComponents(UC); | ||
| </script> | ||
| </head> | ||
| <body> | ||
| <uc-file-uploader-regular ctx-name="my-uploader"></uc-file-uploader-regular> | ||
| <uc-config ctx-name="my-uploader" pubkey="demopublickey" debug quality-insights="false" test-mode></uc-config> | ||
| <uc-upload-ctx-provider ctx-name="my-uploader"></uc-upload-ctx-provider> | ||
| </body> | ||
| </html> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
demo/external-sources/preview-proxy/secure-delivery-proxy-url-resolver.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <!doctype html> | ||
| <head> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <script type="module"> | ||
| import '@/solutions/file-uploader/regular/index.css'; | ||
| import * as UC from '@/index.js'; | ||
|
|
||
| UC.defineComponents(UC); | ||
|
|
||
| const config = document.querySelector('uc-config'); | ||
| config.secureDeliveryProxyUrlResolver = (previewUrl) => { | ||
| return `http://localhost:3000/preview?url=${encodeURIComponent(previewUrl)}`; | ||
| }; | ||
| </script> | ||
| </head> | ||
|
|
||
| <uc-file-uploader-regular ctx-name="my-uploader"></uc-file-uploader-regular> | ||
| <uc-config ctx-name="my-uploader" pubkey="demopublickey" debug quality-insights="false" test-mode></uc-config> | ||
| <uc-upload-ctx-provider ctx-name="my-uploader"></uc-upload-ctx-provider> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| <!doctype html> | ||
| <head> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <script type="module"> | ||
| import '@/solutions/file-uploader/regular/index.css'; | ||
| import * as UC from '@/index.js'; | ||
|
|
||
| UC.defineComponents(UC); | ||
|
|
||
| const msToUnixTimestamp = (ms) => Math.floor(ms / 1000).toString(); | ||
|
|
||
| const getSecureExpire = (options) => { | ||
| if ('expire' in options) { | ||
| return msToUnixTimestamp(new Date(options.expire).getTime()); | ||
| } | ||
|
|
||
| return msToUnixTimestamp(Date.now() + options.lifetime); | ||
| }; | ||
|
|
||
| export const generateSecureSignature = async (secret, options) => { | ||
| const encoder = new TextEncoder(); | ||
| const data = encoder.encode(getSecureExpire(options)); | ||
| const key = await window.crypto.subtle.importKey( | ||
| 'raw', | ||
| encoder.encode(secret), | ||
| { name: 'HMAC', hash: { name: 'SHA-256' } }, | ||
| false, | ||
| ['sign'], | ||
| ); | ||
| const signature = await window.crypto.subtle.sign('HMAC', key, data); | ||
| const secureSignature = Array.from(new Uint8Array(signature)) | ||
| .map((byte) => byte.toString(16).padStart(2, '0')) | ||
| .join(''); | ||
| return { secureSignature, secureExpire: getSecureExpire(options) }; | ||
| }; | ||
|
|
||
| const config = document.querySelector('uc-config'); | ||
| config.secureUploadsSignatureResolver = async () => { | ||
| const token = await generateSecureSignature('', { lifetime: 60 * 1000 }); | ||
| console.log('Generating secure signature...', token); | ||
| return token; | ||
| }; | ||
| </script> | ||
| </head> | ||
|
|
||
| <uc-file-uploader-regular ctx-name="my-uploader"></uc-file-uploader-regular> | ||
| <uc-config ctx-name="my-uploader" pubkey="" debug quality-insights="false" test-mode></uc-config> | ||
| <uc-upload-ctx-provider ctx-name="my-uploader"></uc-upload-ctx-provider> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid null access when wiring
secureDeliveryProxyUrlResolverThe script in
<head>queries foruc-configbefore the body is parsed:At that point
configcan benull, leading to a runtime error and a broken demo.A minimal, robust fix is to wait for DOM readiness and guard against a missing element:
Alternatively, you could move the script tag to after the
<uc-config>element and still keep a simple null check.Also applies to: 17-19
🤖 Prompt for AI Agents