-
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
base: main
Are you sure you want to change the base?
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
86c7992 to
b8d08f8
Compare
bb4bcc6 to
35d0ec5
Compare
| if (srcName === 'instagram') { | ||
| console.error( | ||
| "Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. " + | ||
| 'Official statement, see here:' + |
Check warning
Code scanning / CodeQL
Missing space in string concatenation Warning
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 1 day ago
To fix the problem, we need to ensure that there is a space between "Official statement, see here:" and the URL that follows. This can be done by appending a space at the end of the string literal on line 45 ('Official statement, see here: '), or, less commonly, at the beginning of the next line. The most idiomatic way is to add the space at the end of the line that completes the phrase before the URL, which is line 45.
No other code changes, imports, or definition changes are needed.
-
Copy modified line R45
| @@ -42,7 +42,7 @@ | ||
| if (srcName === 'instagram') { | ||
| console.error( | ||
| "Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. " + | ||
| 'Official statement, see here:' + | ||
| 'Official statement, see here: ' + | ||
| 'https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US', | ||
| ); | ||
| continue; |
- Add SymbioteCompatMixin for Symbiote.js compatibility layer - Add LightDomMixin for light DOM rendering support - Add CssDataMixin for CSS custom properties support - Add RegisterableElementMixin for custom element registration - Add parseCssPropertyValue utility for CSS property parsing - Add Constructor type helper
…classes - Add LitBlock as the base class for all Lit-based blocks - Add LitActivityBlock for activity-based UI components - Add LitUploaderBlock with file upload management capabilities - Add LitSolutionBlock for solution wrapper components - Add TestModeController for test mode handling
- Remove Block.ts (replaced by LitBlock) - Remove ActivityBlock.ts (replaced by LitActivityBlock) - Remove UploaderBlock.ts (replaced by LitUploaderBlock) - Remove SolutionBlock.ts (replaced by LitSolutionBlock) - Remove l10nProcessor.ts (l10n now handled in Lit templates) - Remove testModeProcessor.ts (replaced by TestModeController) - Remove bindCompatibilityFallbackProcessor.ts - Remove Range component (unused)
- Migrate CameraSource to Lit with reactive properties - Migrate ExternalSource to Lit - Migrate FileItem to Lit with improved rendering - Migrate UploadList to Lit - Migrate Modal to Lit - Migrate DropArea to Lit - Migrate SimpleBtn, SourceBtn, SourceList to Lit - Migrate Thumb to Lit with async image loading - Migrate ProgressBar, ProgressBarCommon to Lit - Migrate UrlSource to Lit - Migrate Select, Spinner, ActivityHeader, Config - Migrate StartFrom, Copyright, Icon, FormInput - Migrate UploadCtxProvider and EventEmitter
- Migrate CloudImageEditorBlock to Lit - Migrate EditorToolbar with Lit templating - Migrate EditorFilterControl, EditorOperationControl - Migrate EditorSlider, EditorImageCropper, EditorImageFader - Migrate CropFrame with reactive properties - Migrate UI elements: BtnUi, SliderUi, LineLoaderUi, PresenceToggle - Migrate EditorAspectRatioButtonControl, EditorCropButtonControl - Migrate EditorButtonControl, EditorScroller - Remove deprecated template.ts
- Migrate FileUploaderInline to Lit - Migrate FileUploaderMinimal to Lit - Migrate FileUploaderRegular to Lit
- Convert Img.js to Img.ts - Convert ImgBase.js to ImgBase.ts with proper typing - Convert ImgConfig.js to ImgConfig.ts - Add demo/img.html demo page
- Rename all locale files from .js to .ts
- Update CTX for Lit integration - Update TypedData change detection - Update UploaderPublicApi for Lit components - Update LocaleManager for Lit template binding - Update ModalManager, SecureUploadsManager, TelemetryManager - Update ValidationManager - Update a11y utilities - Update WindowHeightTracker
- Update src/index.ts with new Lit-based exports - Update adaptive-image solution imports
- Add Lit dependencies to package.json - Update biome.json configuration - Update tsconfig files for TypeScript locale files - Update vite.config.js
- Update e2e tests for Lit-based components - Update test utilities - Update test-locales script for .ts locale files
- Update cloud-image-editor.html demo - Update locales.html demo - Update raw-regular.html demo - Update validators.html demo
546d2b2 to
7f3a67c
Compare
- Update biome.json schema version and add unused import/variable rules - Remove unused imports from Config.ts, computed-properties.ts, Select.ts - Fix unused catch variable in ImgBase.ts - Fix CSS grid-gap to gap in camera-source.css - Apply formatting fixes to demo HTML files
- Reorganize demos into folders: solutions/, bundles/, features/, external-sources/ - Add new bundle demos that import from pre-built web/ directory - Add Lit Element based demo index with search and folder navigation - Add debug, quality-insights=false, and test-mode to all demo configs - Rename files to be more descriptive (e.g. raw-regular -> regular)
| document.querySelector('#container').innerHTML = /* html */ ` | ||
| <uc-file-uploader-${mode} | ||
| ctx-name="my-uploader" | ||
| ></uc-file-uploader-${mode}> | ||
| `; |
Check failure
Code scanning / CodeQL
DOM text reinterpreted as HTML High
DOM text
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 21 hours ago
To fix the vulnerability, we need to prevent untrusted values (such as mode) from being interpreted as HTML – especially interpolated directly into tag names as in <uc-file-uploader-${mode}>. The safest approach is to validate the incoming value against an allowlist of expected options before using it. In this case, accept only known good values: 'regular', 'inline', and 'minimal'. If the value is not one of these expected modes, do not update the DOM, or fall back to a safe default.
Changes:
- In the event listener for
input[name=mode], before invokingsetMode(mode), check whethermodematches one of the accepted strings. - Only call
setMode(mode)if it's valid; otherwise, ignore the action.
No external libraries are necessary; a simple check within the code block suffices.
-
Copy modified lines R92-R95
| @@ -89,7 +89,10 @@ | ||
| el.addEventListener('change', (e) => { | ||
| if (e.target.checked) { | ||
| const mode = e.target.value; | ||
| setMode(mode); | ||
| // Only allow known safe modes to prevent XSS attacks | ||
| if (['regular', 'inline', 'minimal'].includes(mode)) { | ||
| setMode(mode); | ||
| } | ||
| } | ||
| }); | ||
| }); |
Description
Checklist