closes #493 - Make designer and zpl extension usable from angular bun… - #494
Merged
Conversation
jogibear9988
approved these changes
Sep 7, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
There are confirmed runtime-crash paths introduced by making the preview view optional (unguarded demoView calls) and a zplPackageUrl SSR/document-undefined URL construction edge case.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR improves runtime usability in bundled host apps (e.g., Angular/Bun) by making asset/base paths configurable (instead of relying on import.meta.url rewriting) and by allowing the preview tab to be disabled safely.
Changes:
- Add configurable + fallback asset path resolution to core designer and Wunderbaum widgets (
globalThisoverride +setAssetsPath). - Allow disabling the preview/demo view by making
demoViewWidgetnullable, and make disposal null-safe. - Add ZPL package base-path utilities and switch ZPL resources (fonts, element JSON) to resolve through them; export these constants.
- Update
package-lock.json(Blockly-related bumps and lockfile cleanup).
File summaries
| File | Description |
|---|---|
| packages/web-component-designer/src/elements/services/ServiceContainer.ts | Makes demoViewWidget nullable to support removing the preview tab. |
| packages/web-component-designer/src/elements/documentContainer.ts | Uses optional chaining when disposing code/demo views. |
| packages/web-component-designer/src/Constants.ts | Adds robust assetsPath resolution with host overrides and fallback. |
| packages/web-component-designer-zpl/src/setupZplServiceContainer.ts | Resolves widgets/elements.json via zplPackageUrl instead of import.meta.url. |
| packages/web-component-designer-zpl/src/index.ts | Re-exports ZPL constants for host configuration. |
| packages/web-component-designer-zpl/src/fonts/zplFonts.ts | Loads fonts via zplPackageUrl for bundler-friendly resolution. |
| packages/web-component-designer-zpl/src/Constants.ts | Introduces configurable ZPL base path + URL helper. |
| packages/web-component-designer-widgets-wunderbaum/src/Constants.ts | Adds robust assetsPath resolution with host overrides and fallback. |
| package-lock.json | Lockfile updates for dependency versions and entries. |
Review details
- Files reviewed: 8/9 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+37
to
+40
| export function zplPackageUrl(relativePath: string): URL { | ||
| const base = typeof document === 'undefined' ? undefined : document.baseURI; | ||
| return new URL(zplBasePath + relativePath, base); | ||
| } |
Comment on lines
+243
to
+244
| this.codeView?.dispose(); | ||
| this.demoView?.dispose(); |
Comment on lines
+14
to
+16
| const imporUrl = new URL((import.meta.url)); | ||
| if (imporUrl.protocol === 'http:' || imporUrl.protocol === 'https:') | ||
| return imporUrl.origin + imporUrl.pathname.split('/').slice(0, -1).join('/') + '/../assets/'; |
Comment on lines
+18
to
+20
| const imporUrl = new URL((import.meta.url)); | ||
| if (imporUrl.protocol === 'http:' || imporUrl.protocol === 'https:') | ||
| return imporUrl.origin + imporUrl.pathname.split('/').slice(0, -1).join('/') + '/../assets/'; |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
…dled projects