@imgly/codesign-mcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +16 -0
- package/README.md +158 -0
- package/assets/docs/api/SKILL.md +49 -0
- package/assets/docs/api/index.d.ts +10518 -0
- package/assets/docs/guide/SKILL.md +142 -0
- package/assets/docs/guide/actions.md +1038 -0
- package/assets/docs/guide/animation/create/base.md +467 -0
- package/assets/docs/guide/animation/create/text.md +453 -0
- package/assets/docs/guide/animation/create.md +558 -0
- package/assets/docs/guide/animation/edit.md +501 -0
- package/assets/docs/guide/animation/overview.md +22 -0
- package/assets/docs/guide/animation/types.md +430 -0
- package/assets/docs/guide/animation.md +23 -0
- package/assets/docs/guide/api/AssetAPI.md +602 -0
- package/assets/docs/guide/api/BlockAPI.md +6152 -0
- package/assets/docs/guide/api/CreativeEngine.md +180 -0
- package/assets/docs/guide/api/EditorAPI.md +1261 -0
- package/assets/docs/guide/api/EventAPI.md +25 -0
- package/assets/docs/guide/api/SceneAPI.md +729 -0
- package/assets/docs/guide/api/VariableAPI.md +59 -0
- package/assets/docs/guide/api/types.md +71 -0
- package/assets/docs/guide/api-reference/overview.md +20 -0
- package/assets/docs/guide/automation/auto-resize.md +412 -0
- package/assets/docs/guide/automation/batch-processing.md +474 -0
- package/assets/docs/guide/automation/data-merge.md +406 -0
- package/assets/docs/guide/automation/design-generation.md +107 -0
- package/assets/docs/guide/automation/overview.md +16 -0
- package/assets/docs/guide/automation.md +24 -0
- package/assets/docs/guide/browser-support.md +38 -0
- package/assets/docs/guide/capabilities.md +18 -0
- package/assets/docs/guide/colors/adjust.md +551 -0
- package/assets/docs/guide/colors/apply.md +349 -0
- package/assets/docs/guide/colors/basics.md +440 -0
- package/assets/docs/guide/colors/conversion.md +504 -0
- package/assets/docs/guide/colors/create-color-palette.md +426 -0
- package/assets/docs/guide/colors/for-print/cmyk.md +577 -0
- package/assets/docs/guide/colors/for-print/spot.md +751 -0
- package/assets/docs/guide/colors/for-print.md +21 -0
- package/assets/docs/guide/colors/for-screen/p3.md +60 -0
- package/assets/docs/guide/colors/for-screen/srgb.md +463 -0
- package/assets/docs/guide/colors/for-screen.md +21 -0
- package/assets/docs/guide/colors/overview.md +20 -0
- package/assets/docs/guide/colors/replace.md +535 -0
- package/assets/docs/guide/colors.md +28 -0
- package/assets/docs/guide/compatibility.md +27 -0
- package/assets/docs/guide/concepts/architecture.md +99 -0
- package/assets/docs/guide/concepts/assets.md +360 -0
- package/assets/docs/guide/concepts/blocks.md +750 -0
- package/assets/docs/guide/concepts/buffers.md +546 -0
- package/assets/docs/guide/concepts/design-units.md +333 -0
- package/assets/docs/guide/concepts/edit-modes.md +431 -0
- package/assets/docs/guide/concepts/editing-workflow.md +303 -0
- package/assets/docs/guide/concepts/events.md +466 -0
- package/assets/docs/guide/concepts/headless-mode/browser.md +291 -0
- package/assets/docs/guide/concepts/pages.md +396 -0
- package/assets/docs/guide/concepts/resources.md +496 -0
- package/assets/docs/guide/concepts/scenes.md +443 -0
- package/assets/docs/guide/concepts/templating.md +194 -0
- package/assets/docs/guide/concepts/terminology.md +296 -0
- package/assets/docs/guide/concepts/undo-and-history.md +461 -0
- package/assets/docs/guide/concepts.md +38 -0
- package/assets/docs/guide/configuration.md +469 -0
- package/assets/docs/guide/conversion/overview.md +22 -0
- package/assets/docs/guide/conversion/to-base64.md +234 -0
- package/assets/docs/guide/conversion/to-pdf.md +616 -0
- package/assets/docs/guide/conversion/to-png.md +290 -0
- package/assets/docs/guide/conversion.md +23 -0
- package/assets/docs/guide/create-audio/audio/add-music.md +430 -0
- package/assets/docs/guide/create-audio/audio/add-sound-effects.md +664 -0
- package/assets/docs/guide/create-audio/audio/loop.md +370 -0
- package/assets/docs/guide/create-audio/audio.md +336 -0
- package/assets/docs/guide/create-composition/add-background.md +395 -0
- package/assets/docs/guide/create-composition/blend-modes.md +372 -0
- package/assets/docs/guide/create-composition/collage.md +432 -0
- package/assets/docs/guide/create-composition/group-and-ungroup.md +388 -0
- package/assets/docs/guide/create-composition/layer-management.md +503 -0
- package/assets/docs/guide/create-composition/layout.md +396 -0
- package/assets/docs/guide/create-composition/lock-design.md +362 -0
- package/assets/docs/guide/create-composition/multi-page.md +204 -0
- package/assets/docs/guide/create-composition/overview.md +18 -0
- package/assets/docs/guide/create-composition/programmatic.md +593 -0
- package/assets/docs/guide/create-composition.md +30 -0
- package/assets/docs/guide/create-templates/add-dynamic-content/placeholders.md +688 -0
- package/assets/docs/guide/create-templates/add-dynamic-content/set-editing-constraints.md +600 -0
- package/assets/docs/guide/create-templates/add-dynamic-content/text-variables.md +647 -0
- package/assets/docs/guide/create-templates/add-dynamic-content.md +307 -0
- package/assets/docs/guide/create-templates/add-to-template-library.md +297 -0
- package/assets/docs/guide/create-templates/edit-or-remove.md +441 -0
- package/assets/docs/guide/create-templates/from-scratch.md +558 -0
- package/assets/docs/guide/create-templates/import/from-scene-file.md +440 -0
- package/assets/docs/guide/create-templates/import.md +244 -0
- package/assets/docs/guide/create-templates/lock.md +325 -0
- package/assets/docs/guide/create-templates/overview.md +16 -0
- package/assets/docs/guide/create-templates.md +32 -0
- package/assets/docs/guide/create-video/audio/adjust-speed.md +302 -0
- package/assets/docs/guide/create-video/audio/adjust-volume.md +346 -0
- package/assets/docs/guide/create-video/control.md +285 -0
- package/assets/docs/guide/create-video/limitations.md +396 -0
- package/assets/docs/guide/create-video/overview.md +224 -0
- package/assets/docs/guide/create-video/timeline-editor.md +622 -0
- package/assets/docs/guide/create-video/update-caption-presets.md +676 -0
- package/assets/docs/guide/create-video.md +32 -0
- package/assets/docs/guide/edit-image/add-watermark.md +497 -0
- package/assets/docs/guide/edit-image/overview.md +22 -0
- package/assets/docs/guide/edit-image/remove-bg.md +420 -0
- package/assets/docs/guide/edit-image/replace-colors.md +680 -0
- package/assets/docs/guide/edit-image/transform/crop.md +523 -0
- package/assets/docs/guide/edit-image/transform/move.md +279 -0
- package/assets/docs/guide/edit-image/transform/resize.md +301 -0
- package/assets/docs/guide/edit-image/transform/rotate.md +408 -0
- package/assets/docs/guide/edit-image/transform/scale.md +278 -0
- package/assets/docs/guide/edit-image/transform.md +24 -0
- package/assets/docs/guide/edit-image/vectorize.md +204 -0
- package/assets/docs/guide/edit-image.md +25 -0
- package/assets/docs/guide/edit-video/add-captions.md +589 -0
- package/assets/docs/guide/edit-video/add-watermark.md +429 -0
- package/assets/docs/guide/edit-video/join-and-arrange.md +540 -0
- package/assets/docs/guide/edit-video/redaction.md +544 -0
- package/assets/docs/guide/edit-video/split.md +634 -0
- package/assets/docs/guide/edit-video/transform/crop.md +380 -0
- package/assets/docs/guide/edit-video/transform/flip.md +182 -0
- package/assets/docs/guide/edit-video/transform/move.md +413 -0
- package/assets/docs/guide/edit-video/transform/resize.md +534 -0
- package/assets/docs/guide/edit-video/transform/rotate.md +312 -0
- package/assets/docs/guide/edit-video/transform/scale.md +603 -0
- package/assets/docs/guide/edit-video/transform.md +25 -0
- package/assets/docs/guide/edit-video/trim.md +773 -0
- package/assets/docs/guide/engine-interface.md +108 -0
- package/assets/docs/guide/export-save-publish/create-thumbnail.md +292 -0
- package/assets/docs/guide/export-save-publish/export/compress.md +639 -0
- package/assets/docs/guide/export-save-publish/export/overview.md +576 -0
- package/assets/docs/guide/export-save-publish/export/partial-export.md +694 -0
- package/assets/docs/guide/export-save-publish/export/size-limits.md +401 -0
- package/assets/docs/guide/export-save-publish/export/to-html5.md +474 -0
- package/assets/docs/guide/export-save-publish/export/to-jpeg.md +312 -0
- package/assets/docs/guide/export-save-publish/export/to-mp4.md +364 -0
- package/assets/docs/guide/export-save-publish/export/to-pdf.md +389 -0
- package/assets/docs/guide/export-save-publish/export/to-png.md +255 -0
- package/assets/docs/guide/export-save-publish/export/to-raw-data.md +303 -0
- package/assets/docs/guide/export-save-publish/export/to-webp.md +261 -0
- package/assets/docs/guide/export-save-publish/export/with-color-mask.md +278 -0
- package/assets/docs/guide/export-save-publish/export.md +36 -0
- package/assets/docs/guide/export-save-publish/for-printing.md +423 -0
- package/assets/docs/guide/export-save-publish/for-social-media.md +318 -0
- package/assets/docs/guide/export-save-publish/pre-export-validation.md +698 -0
- package/assets/docs/guide/export-save-publish/save.md +340 -0
- package/assets/docs/guide/export-save-publish/store-custom-metadata.md +367 -0
- package/assets/docs/guide/file-format-support.md +34 -0
- package/assets/docs/guide/fills/color.md +678 -0
- package/assets/docs/guide/fills/image.md +539 -0
- package/assets/docs/guide/fills/overview.md +144 -0
- package/assets/docs/guide/fills/video.md +641 -0
- package/assets/docs/guide/fills.md +24 -0
- package/assets/docs/guide/filters-and-effects/apply.md +1019 -0
- package/assets/docs/guide/filters-and-effects/blur.md +382 -0
- package/assets/docs/guide/filters-and-effects/chroma-key-green-screen.md +445 -0
- package/assets/docs/guide/filters-and-effects/create-custom-filters.md +614 -0
- package/assets/docs/guide/filters-and-effects/create-custom-lut-filter.md +426 -0
- package/assets/docs/guide/filters-and-effects/distortion.md +527 -0
- package/assets/docs/guide/filters-and-effects/duotone.md +602 -0
- package/assets/docs/guide/filters-and-effects/gradients.md +1311 -0
- package/assets/docs/guide/filters-and-effects/overview.md +22 -0
- package/assets/docs/guide/filters-and-effects/support.md +623 -0
- package/assets/docs/guide/filters-and-effects.md +28 -0
- package/assets/docs/guide/get-started/agent-skills.md +119 -0
- package/assets/docs/guide/get-started/build-with-ai.md +45 -0
- package/assets/docs/guide/get-started/mcp-server.md +119 -0
- package/assets/docs/guide/get-started/overview.md +28 -0
- package/assets/docs/guide/get-started/vanilla-js/quickstart.md +175 -0
- package/assets/docs/guide/grid-and-rulers.md +222 -0
- package/assets/docs/guide/guides/export-save-publish/export/audio.md +224 -0
- package/assets/docs/guide/guides/text/rendering-internals.md +796 -0
- package/assets/docs/guide/guides.md +49 -0
- package/assets/docs/guide/import-media/asset-library.md +23 -0
- package/assets/docs/guide/import-media/asset-panel/basics.md +324 -0
- package/assets/docs/guide/import-media/asset-panel/customize.md +478 -0
- package/assets/docs/guide/import-media/asset-panel/refresh-assets.md +415 -0
- package/assets/docs/guide/import-media/asset-panel/thumbnails.md +633 -0
- package/assets/docs/guide/import-media/capture-from-camera/record-video.md +137 -0
- package/assets/docs/guide/import-media/capture-from-camera.md +20 -0
- package/assets/docs/guide/import-media/concepts.md +173 -0
- package/assets/docs/guide/import-media/content-json-schema.md +615 -0
- package/assets/docs/guide/import-media/default-assets.md +381 -0
- package/assets/docs/guide/import-media/edit-or-remove-assets.md +489 -0
- package/assets/docs/guide/import-media/file-format-support.md +178 -0
- package/assets/docs/guide/import-media/from-local-source/user-upload.md +438 -0
- package/assets/docs/guide/import-media/from-local-source.md +20 -0
- package/assets/docs/guide/import-media/from-remote-source/asset-versioning.md +390 -0
- package/assets/docs/guide/import-media/from-remote-source/getty-images.md +627 -0
- package/assets/docs/guide/import-media/from-remote-source/imgly-premium-assets.md +625 -0
- package/assets/docs/guide/import-media/from-remote-source/pexels.md +692 -0
- package/assets/docs/guide/import-media/from-remote-source/remote-asset.md +473 -0
- package/assets/docs/guide/import-media/from-remote-source/soundstripe.md +497 -0
- package/assets/docs/guide/import-media/from-remote-source/third-party.md +51 -0
- package/assets/docs/guide/import-media/from-remote-source/unsplash.md +914 -0
- package/assets/docs/guide/import-media/from-remote-source/your-server.md +764 -0
- package/assets/docs/guide/import-media/from-remote-source.md +28 -0
- package/assets/docs/guide/import-media/overview.md +32 -0
- package/assets/docs/guide/import-media/retrieve-mimetype.md +274 -0
- package/assets/docs/guide/import-media/size-limits.md +20 -0
- package/assets/docs/guide/import-media/source-sets.md +476 -0
- package/assets/docs/guide/import-media.md +32 -0
- package/assets/docs/guide/insert-media/audio.md +291 -0
- package/assets/docs/guide/insert-media/images.md +380 -0
- package/assets/docs/guide/insert-media/position-and-align.md +734 -0
- package/assets/docs/guide/insert-media/shapes-or-stickers.md +799 -0
- package/assets/docs/guide/insert-media/videos.md +308 -0
- package/assets/docs/guide/insert-media.md +24 -0
- package/assets/docs/guide/key-capabilities.md +24 -0
- package/assets/docs/guide/key-concepts.md +83 -0
- package/assets/docs/guide/licensing.md +45 -0
- package/assets/docs/guide/llms-txt.md +53 -0
- package/assets/docs/guide/open-the-editor/blank-canvas.md +124 -0
- package/assets/docs/guide/open-the-editor/from-htmlcanvas.md +228 -0
- package/assets/docs/guide/open-the-editor/from-image.md +205 -0
- package/assets/docs/guide/open-the-editor/from-template.md +189 -0
- package/assets/docs/guide/open-the-editor/from-video.md +274 -0
- package/assets/docs/guide/open-the-editor/import-design/from-archive.md +504 -0
- package/assets/docs/guide/open-the-editor/import-design/from-indesign.md +680 -0
- package/assets/docs/guide/open-the-editor/import-design/from-photoshop.md +865 -0
- package/assets/docs/guide/open-the-editor/import-design.md +481 -0
- package/assets/docs/guide/open-the-editor/load-scene.md +178 -0
- package/assets/docs/guide/open-the-editor/overview.md +20 -0
- package/assets/docs/guide/open-the-editor/set-zoom-level.md +303 -0
- package/assets/docs/guide/open-the-editor/uri-resolver.md +347 -0
- package/assets/docs/guide/open-the-editor.md +29 -0
- package/assets/docs/guide/outlines/overview.md +14 -0
- package/assets/docs/guide/outlines/shadows-and-glows.md +515 -0
- package/assets/docs/guide/outlines/strokes.md +292 -0
- package/assets/docs/guide/outlines.md +22 -0
- package/assets/docs/guide/overview.md +22 -0
- package/assets/docs/guide/performance.md +217 -0
- package/assets/docs/guide/plugins/asset-sources.md +553 -0
- package/assets/docs/guide/plugins/print-ready-pdf.md +549 -0
- package/assets/docs/guide/plugins.md +36 -0
- package/assets/docs/guide/rules/asset-handling.md +180 -0
- package/assets/docs/guide/rules/common-pitfalls.md +272 -0
- package/assets/docs/guide/rules/content-fill-mode.md +29 -0
- package/assets/docs/guide/rules/enforce-brand-guidelines.md +672 -0
- package/assets/docs/guide/rules/lock-content.md +478 -0
- package/assets/docs/guide/rules/moderate-content.md +761 -0
- package/assets/docs/guide/rules/overview.md +514 -0
- package/assets/docs/guide/rules/silent-init-errors.md +137 -0
- package/assets/docs/guide/rules/verify-properties-before-use.md +78 -0
- package/assets/docs/guide/rules.md +23 -0
- package/assets/docs/guide/security.md +199 -0
- package/assets/docs/guide/serve-assets.md +332 -0
- package/assets/docs/guide/settings.md +199 -0
- package/assets/docs/guide/shapes.md +23 -0
- package/assets/docs/guide/starterkits/3d-mockup-editor.md +748 -0
- package/assets/docs/guide/starterkits/advanced-editor.md +698 -0
- package/assets/docs/guide/starterkits/advanced-video-editor.md +696 -0
- package/assets/docs/guide/starterkits/ai-editor.md +749 -0
- package/assets/docs/guide/starterkits/airtable-image-editor.md +672 -0
- package/assets/docs/guide/starterkits/apparel-ui.md +188 -0
- package/assets/docs/guide/starterkits/assets.md +27 -0
- package/assets/docs/guide/starterkits/auto-resize.md +586 -0
- package/assets/docs/guide/starterkits/automated-video-generation.md +692 -0
- package/assets/docs/guide/starterkits/background-removal-editor.md +480 -0
- package/assets/docs/guide/starterkits/content-moderation.md +863 -0
- package/assets/docs/guide/starterkits/creative-automation.md +28 -0
- package/assets/docs/guide/starterkits/custom-built-uis.md +26 -0
- package/assets/docs/guide/starterkits/customization.md +29 -0
- package/assets/docs/guide/starterkits/cutout-lines-editor.md +470 -0
- package/assets/docs/guide/starterkits/data-merge.md +850 -0
- package/assets/docs/guide/starterkits/design-editor.md +698 -0
- package/assets/docs/guide/starterkits/design-generation.md +719 -0
- package/assets/docs/guide/starterkits/design-validation.md +808 -0
- package/assets/docs/guide/starterkits/editor-ui-configurations.md +14 -0
- package/assets/docs/guide/starterkits/export-options.md +724 -0
- package/assets/docs/guide/starterkits/export-using-renderer.md +708 -0
- package/assets/docs/guide/starterkits/extensibility.md +28 -0
- package/assets/docs/guide/starterkits/force-crop-editor.md +675 -0
- package/assets/docs/guide/starterkits/form-based-template-adoption.md +522 -0
- package/assets/docs/guide/starterkits/getty-images-editor.md +700 -0
- package/assets/docs/guide/starterkits/html5-ads-exporter.md +719 -0
- package/assets/docs/guide/starterkits/indesign-template-import.md +580 -0
- package/assets/docs/guide/starterkits/layouts-editor.md +724 -0
- package/assets/docs/guide/starterkits/mobile-ui.md +185 -0
- package/assets/docs/guide/starterkits/mockup-editor.md +745 -0
- package/assets/docs/guide/starterkits/multi-image-generation.md +542 -0
- package/assets/docs/guide/starterkits/page-sizes-editor.md +657 -0
- package/assets/docs/guide/starterkits/pexels-image-editor.md +665 -0
- package/assets/docs/guide/starterkits/photo-editor.md +755 -0
- package/assets/docs/guide/starterkits/photo-ui.md +186 -0
- package/assets/docs/guide/starterkits/photobook-ui.md +188 -0
- package/assets/docs/guide/starterkits/placeholders.md +678 -0
- package/assets/docs/guide/starterkits/player.md +405 -0
- package/assets/docs/guide/starterkits/plugins.md +25 -0
- package/assets/docs/guide/starterkits/postcard-editor.md +202 -0
- package/assets/docs/guide/starterkits/pptx-template-import.md +581 -0
- package/assets/docs/guide/starterkits/print-ready-pdf-editor.md +746 -0
- package/assets/docs/guide/starterkits/product-editor.md +773 -0
- package/assets/docs/guide/starterkits/psd-template-import.md +580 -0
- package/assets/docs/guide/starterkits/qr-code-editor.md +470 -0
- package/assets/docs/guide/starterkits/single-page-editor.md +661 -0
- package/assets/docs/guide/starterkits/start-with-image.md +684 -0
- package/assets/docs/guide/starterkits/start-with-video.md +651 -0
- package/assets/docs/guide/starterkits/t-shirt-designer.md +742 -0
- package/assets/docs/guide/starterkits/templating.md +23 -0
- package/assets/docs/guide/starterkits/theming.md +662 -0
- package/assets/docs/guide/starterkits/translation-internationalization.md +662 -0
- package/assets/docs/guide/starterkits/unsplash-editor.md +839 -0
- package/assets/docs/guide/starterkits/vectorizer-editor.md +466 -0
- package/assets/docs/guide/starterkits/version-history.md +745 -0
- package/assets/docs/guide/starterkits/video-animations.md +853 -0
- package/assets/docs/guide/starterkits/video-captions.md +884 -0
- package/assets/docs/guide/starterkits/video-editing.md +25 -0
- package/assets/docs/guide/starterkits/video-editor.md +696 -0
- package/assets/docs/guide/starterkits/video-export-options.md +676 -0
- package/assets/docs/guide/starterkits/viewer.md +400 -0
- package/assets/docs/guide/starterkits.md +41 -0
- package/assets/docs/guide/stickers-and-shapes/combine.md +743 -0
- package/assets/docs/guide/stickers-and-shapes/create-cutout.md +425 -0
- package/assets/docs/guide/stickers-and-shapes/create-edit/create-shapes.md +794 -0
- package/assets/docs/guide/stickers-and-shapes/create-edit/create-stickers.md +290 -0
- package/assets/docs/guide/stickers-and-shapes/create-edit/edit-shapes.md +211 -0
- package/assets/docs/guide/stickers-and-shapes/create-edit/vector-edit.md +362 -0
- package/assets/docs/guide/stickers-and-shapes/insert-qr-code.md +208 -0
- package/assets/docs/guide/stickers.md +21 -0
- package/assets/docs/guide/text/add.md +641 -0
- package/assets/docs/guide/text/adjust-spacing.md +288 -0
- package/assets/docs/guide/text/auto-size.md +404 -0
- package/assets/docs/guide/text/custom-fonts.md +401 -0
- package/assets/docs/guide/text/decorations.md +330 -0
- package/assets/docs/guide/text/edit.md +458 -0
- package/assets/docs/guide/text/effects.md +244 -0
- package/assets/docs/guide/text/emojis.md +310 -0
- package/assets/docs/guide/text/enumerations.md +258 -0
- package/assets/docs/guide/text/language-support.md +604 -0
- package/assets/docs/guide/text/overview.md +14 -0
- package/assets/docs/guide/text/styling.md +390 -0
- package/assets/docs/guide/text/text-designs.md +834 -0
- package/assets/docs/guide/text.md +33 -0
- package/assets/docs/guide/to-v1-10.md +131 -0
- package/assets/docs/guide/to-v1-13.md +165 -0
- package/assets/docs/guide/to-v1-19.md +315 -0
- package/assets/docs/guide/to-v1-32.md +110 -0
- package/assets/docs/guide/to-v1-69.md +468 -0
- package/assets/docs/guide/to-v1-72.md +193 -0
- package/assets/docs/guide/upgrade.md +25 -0
- package/assets/docs/guide/use-templates/apply-template.md +279 -0
- package/assets/docs/guide/use-templates/generate.md +405 -0
- package/assets/docs/guide/use-templates/library.md +450 -0
- package/assets/docs/guide/use-templates/overview.md +20 -0
- package/assets/docs/guide/use-templates/programmatic.md +482 -0
- package/assets/docs/guide/use-templates/replace-content.md +399 -0
- package/assets/docs/guide/user-interface/ai-integration/audio-generation.md +428 -0
- package/assets/docs/guide/user-interface/ai-integration/auto-captions.md +337 -0
- package/assets/docs/guide/user-interface/ai-integration/custom-provider.md +853 -0
- package/assets/docs/guide/user-interface/ai-integration/gateway-provider.md +1045 -0
- package/assets/docs/guide/user-interface/ai-integration/image-generation.md +641 -0
- package/assets/docs/guide/user-interface/ai-integration/integrate.md +966 -0
- package/assets/docs/guide/user-interface/ai-integration/proxy-server.md +99 -0
- package/assets/docs/guide/user-interface/ai-integration/text-generation.md +498 -0
- package/assets/docs/guide/user-interface/ai-integration/video-generation.md +493 -0
- package/assets/docs/guide/user-interface/ai-integration.md +30 -0
- package/assets/docs/guide/user-interface/appearance/change-ui-font.md +316 -0
- package/assets/docs/guide/user-interface/appearance/custom-labels.md +509 -0
- package/assets/docs/guide/user-interface/appearance/icons.md +373 -0
- package/assets/docs/guide/user-interface/appearance/theming.md +665 -0
- package/assets/docs/guide/user-interface/appearance.md +23 -0
- package/assets/docs/guide/user-interface/build-your-own-ui.md +620 -0
- package/assets/docs/guide/user-interface/customization/canvas-menu.md +412 -0
- package/assets/docs/guide/user-interface/customization/canvas.md +281 -0
- package/assets/docs/guide/user-interface/customization/color-palette.md +413 -0
- package/assets/docs/guide/user-interface/customization/crop-presets.md +384 -0
- package/assets/docs/guide/user-interface/customization/disable-or-enable.md +676 -0
- package/assets/docs/guide/user-interface/customization/dock.md +399 -0
- package/assets/docs/guide/user-interface/customization/force-crop.md +289 -0
- package/assets/docs/guide/user-interface/customization/inspector-bar.md +371 -0
- package/assets/docs/guide/user-interface/customization/navigation-bar.md +516 -0
- package/assets/docs/guide/user-interface/customization/page-format.md +436 -0
- package/assets/docs/guide/user-interface/customization/panel.md +605 -0
- package/assets/docs/guide/user-interface/customization/quick-start/add-action-buttons.md +531 -0
- package/assets/docs/guide/user-interface/customization/quick-start/add-dock-buttons.md +358 -0
- package/assets/docs/guide/user-interface/customization/quick-start/create-custom-components.md +374 -0
- package/assets/docs/guide/user-interface/customization/quick-start/reorder-components.md +323 -0
- package/assets/docs/guide/user-interface/customization/quick-start/show-hide-components.md +294 -0
- package/assets/docs/guide/user-interface/customization/quick-start.md +12 -0
- package/assets/docs/guide/user-interface/customization/reference/component-order-api.md +519 -0
- package/assets/docs/guide/user-interface/customization/reference/component-reference.md +333 -0
- package/assets/docs/guide/user-interface/customization/reference.md +12 -0
- package/assets/docs/guide/user-interface/customization.md +39 -0
- package/assets/docs/guide/user-interface/localization.md +633 -0
- package/assets/docs/guide/user-interface/overview.md +167 -0
- package/assets/docs/guide/user-interface/ui-extensions/add-custom-feature.md +411 -0
- package/assets/docs/guide/user-interface/ui-extensions/asset-library.md +721 -0
- package/assets/docs/guide/user-interface/ui-extensions/create-custom-panel.md +331 -0
- package/assets/docs/guide/user-interface/ui-extensions/customize-behaviour.md +553 -0
- package/assets/docs/guide/user-interface/ui-extensions/notifications-and-dialogs.md +672 -0
- package/assets/docs/guide/user-interface/ui-extensions/quick-actions.md +415 -0
- package/assets/docs/guide/user-interface/ui-extensions/register-new-component.md +521 -0
- package/assets/docs/guide/user-interface/ui-extensions.md +26 -0
- package/assets/docs/guide/user-interface.md +25 -0
- package/assets/docs/guide/what-is-cesdk.md +319 -0
- package/assets/docs/handbook/SKILL.md +521 -0
- package/assets/prompts/evals-assetGenerate.md +12 -0
- package/assets/prompts/evals-brutalistCore.md +34 -0
- package/assets/prompts/evals-danskCatalogue.md +31 -0
- package/assets/prompts/evals-exportRoundTrip.md +12 -0
- package/assets/prompts/evals-inspectPriorCode.md +16 -0
- package/assets/prompts/evals-listProjectFiles.md +6 -0
- package/assets/prompts/evals-readAndExplainScript.md +6 -0
- package/assets/prompts/evals-resumeAcrossRestart.md +15 -0
- package/assets/prompts/evals-rewindRecovery.md +10 -0
- package/assets/prompts/evals-searchAcrossFiles.md +6 -0
- package/assets/prompts/evals-weddingCard.md +20 -0
- package/assets/prompts/explain.md +6 -0
- package/assets/prompts/review.md +6 -0
- package/dist/assets/inline.generated.d.ts +2 -0
- package/dist/assets/inline.generated.d.ts.map +1 -0
- package/dist/assets/inline.generated.js +413 -0
- package/dist/assets/inline.generated.js.map +1 -0
- package/dist/assets/load-browser.d.ts +8 -0
- package/dist/assets/load-browser.d.ts.map +1 -0
- package/dist/assets/load-browser.js +11 -0
- package/dist/assets/load-browser.js.map +1 -0
- package/dist/assets/load-node.d.ts +8 -0
- package/dist/assets/load-node.d.ts.map +1 -0
- package/dist/assets/load-node.js +11 -0
- package/dist/assets/load-node.js.map +1 -0
- package/dist/cli/http.d.ts +2 -0
- package/dist/cli/http.d.ts.map +1 -0
- package/dist/cli/http.js +231 -0
- package/dist/cli/http.js.map +1 -0
- package/dist/cli/redirect-console.d.ts +10 -0
- package/dist/cli/redirect-console.d.ts.map +1 -0
- package/dist/cli/redirect-console.js +18 -0
- package/dist/cli/redirect-console.js.map +1 -0
- package/dist/cli/resolve-license.d.ts +2 -0
- package/dist/cli/resolve-license.d.ts.map +1 -0
- package/dist/cli/resolve-license.js +13 -0
- package/dist/cli/resolve-license.js.map +1 -0
- package/dist/cli/stdio.d.ts +2 -0
- package/dist/cli/stdio.d.ts.map +1 -0
- package/dist/cli/stdio.js +124 -0
- package/dist/cli/stdio.js.map +1 -0
- package/dist/cli/trial-license.generated.d.ts +2 -0
- package/dist/cli/trial-license.generated.d.ts.map +1 -0
- package/dist/cli/trial-license.generated.js +4 -0
- package/dist/cli/trial-license.generated.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +64 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +61 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +102 -0
- package/dist/config.js.map +1 -0
- package/dist/cross-ref.d.ts +2 -0
- package/dist/cross-ref.d.ts.map +1 -0
- package/dist/cross-ref.js +31 -0
- package/dist/cross-ref.js.map +1 -0
- package/dist/dashboard/router.d.ts +3 -0
- package/dist/dashboard/router.d.ts.map +1 -0
- package/dist/dashboard/router.js +19 -0
- package/dist/dashboard/router.js.map +1 -0
- package/dist/dashboard/spa-assets.generated.d.ts +2 -0
- package/dist/dashboard/spa-assets.generated.d.ts.map +1 -0
- package/dist/dashboard/spa-assets.generated.js +220 -0
- package/dist/dashboard/spa-assets.generated.js.map +1 -0
- package/dist/engine/asset-sources.d.ts +17 -0
- package/dist/engine/asset-sources.d.ts.map +1 -0
- package/dist/engine/asset-sources.js +75 -0
- package/dist/engine/asset-sources.js.map +1 -0
- package/dist/engine/cesdk-adapter.d.ts +10 -0
- package/dist/engine/cesdk-adapter.d.ts.map +1 -0
- package/dist/engine/cesdk-adapter.js +19 -0
- package/dist/engine/cesdk-adapter.js.map +1 -0
- package/dist/engine/index.d.ts +3 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +3 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/mutex.d.ts +5 -0
- package/dist/engine/mutex.d.ts.map +1 -0
- package/dist/engine/mutex.js +42 -0
- package/dist/engine/mutex.js.map +1 -0
- package/dist/engine/session.d.ts +50 -0
- package/dist/engine/session.d.ts.map +1 -0
- package/dist/engine/session.js +95 -0
- package/dist/engine/session.js.map +1 -0
- package/dist/engine/uri-resolver.d.ts +14 -0
- package/dist/engine/uri-resolver.d.ts.map +1 -0
- package/dist/engine/uri-resolver.js +12 -0
- package/dist/engine/uri-resolver.js.map +1 -0
- package/dist/frontmatter.d.ts +15 -0
- package/dist/frontmatter.d.ts.map +1 -0
- package/dist/frontmatter.js +46 -0
- package/dist/frontmatter.js.map +1 -0
- package/dist/gateway/hosted-stub.d.ts +6 -0
- package/dist/gateway/hosted-stub.d.ts.map +1 -0
- package/dist/gateway/hosted-stub.js +11 -0
- package/dist/gateway/hosted-stub.js.map +1 -0
- package/dist/gateway/index.d.ts +4 -0
- package/dist/gateway/index.d.ts.map +1 -0
- package/dist/gateway/index.js +4 -0
- package/dist/gateway/index.js.map +1 -0
- package/dist/gateway/local.d.ts +14 -0
- package/dist/gateway/local.d.ts.map +1 -0
- package/dist/gateway/local.js +41 -0
- package/dist/gateway/local.js.map +1 -0
- package/dist/gateway/types.d.ts +24 -0
- package/dist/gateway/types.d.ts.map +1 -0
- package/dist/gateway/types.js +7 -0
- package/dist/gateway/types.js.map +1 -0
- package/dist/http/server.d.ts +80 -0
- package/dist/http/server.d.ts.map +1 -0
- package/dist/http/server.js +183 -0
- package/dist/http/server.js.map +1 -0
- package/dist/http/session-manager.d.ts +42 -0
- package/dist/http/session-manager.d.ts.map +1 -0
- package/dist/http/session-manager.js +82 -0
- package/dist/http/session-manager.js.map +1 -0
- package/dist/http/workspace-auth.d.ts +9 -0
- package/dist/http/workspace-auth.d.ts.map +1 -0
- package/dist/http/workspace-auth.js +29 -0
- package/dist/http/workspace-auth.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/metrics/mount.d.ts +11 -0
- package/dist/metrics/mount.d.ts.map +1 -0
- package/dist/metrics/mount.js +13 -0
- package/dist/metrics/mount.js.map +1 -0
- package/dist/metrics/recorder.d.ts +55 -0
- package/dist/metrics/recorder.d.ts.map +1 -0
- package/dist/metrics/recorder.js +97 -0
- package/dist/metrics/recorder.js.map +1 -0
- package/dist/revisions/hash.d.ts +7 -0
- package/dist/revisions/hash.d.ts.map +1 -0
- package/dist/revisions/hash.js +24 -0
- package/dist/revisions/hash.js.map +1 -0
- package/dist/revisions/index.d.ts +4 -0
- package/dist/revisions/index.d.ts.map +1 -0
- package/dist/revisions/index.js +4 -0
- package/dist/revisions/index.js.map +1 -0
- package/dist/revisions/store.d.ts +69 -0
- package/dist/revisions/store.d.ts.map +1 -0
- package/dist/revisions/store.js +196 -0
- package/dist/revisions/store.js.map +1 -0
- package/dist/revisions/types.d.ts +39 -0
- package/dist/revisions/types.d.ts.map +1 -0
- package/dist/revisions/types.js +2 -0
- package/dist/revisions/types.js.map +1 -0
- package/dist/server.d.ts +51 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +175 -0
- package/dist/server.js.map +1 -0
- package/dist/skill-tools.d.ts +3 -0
- package/dist/skill-tools.d.ts.map +1 -0
- package/dist/skill-tools.js +105 -0
- package/dist/skill-tools.js.map +1 -0
- package/dist/test/test/cli/dispatcher.test.d.ts +2 -0
- package/dist/test/test/cli/dispatcher.test.d.ts.map +1 -0
- package/dist/test/test/cli/dispatcher.test.js +47 -0
- package/dist/test/test/cli/dispatcher.test.js.map +1 -0
- package/dist/test/test/cross-ref.test.d.ts +2 -0
- package/dist/test/test/cross-ref.test.d.ts.map +1 -0
- package/dist/test/test/cross-ref.test.js +39 -0
- package/dist/test/test/cross-ref.test.js.map +1 -0
- package/dist/test/test/engine/session.test.d.ts +2 -0
- package/dist/test/test/engine/session.test.d.ts.map +1 -0
- package/dist/test/test/engine/session.test.js +144 -0
- package/dist/test/test/engine/session.test.js.map +1 -0
- package/dist/test/test/engine/uri-resolver.test.d.ts +2 -0
- package/dist/test/test/engine/uri-resolver.test.d.ts.map +1 -0
- package/dist/test/test/engine/uri-resolver.test.js +38 -0
- package/dist/test/test/engine/uri-resolver.test.js.map +1 -0
- package/dist/test/test/frontmatter.test.d.ts +2 -0
- package/dist/test/test/frontmatter.test.d.ts.map +1 -0
- package/dist/test/test/frontmatter.test.js +55 -0
- package/dist/test/test/frontmatter.test.js.map +1 -0
- package/dist/test/test/gateway/hosted-stub.test.d.ts +2 -0
- package/dist/test/test/gateway/hosted-stub.test.d.ts.map +1 -0
- package/dist/test/test/gateway/hosted-stub.test.js +11 -0
- package/dist/test/test/gateway/hosted-stub.test.js.map +1 -0
- package/dist/test/test/gateway/local.test.d.ts +2 -0
- package/dist/test/test/gateway/local.test.d.ts.map +1 -0
- package/dist/test/test/gateway/local.test.js +29 -0
- package/dist/test/test/gateway/local.test.js.map +1 -0
- package/dist/test/test/handbook-contract.test.d.ts +2 -0
- package/dist/test/test/handbook-contract.test.d.ts.map +1 -0
- package/dist/test/test/handbook-contract.test.js +71 -0
- package/dist/test/test/handbook-contract.test.js.map +1 -0
- package/dist/test/test/http/server.test.d.ts +2 -0
- package/dist/test/test/http/server.test.d.ts.map +1 -0
- package/dist/test/test/http/server.test.js +245 -0
- package/dist/test/test/http/server.test.js.map +1 -0
- package/dist/test/test/http/session-manager.test.d.ts +2 -0
- package/dist/test/test/http/session-manager.test.d.ts.map +1 -0
- package/dist/test/test/http/session-manager.test.js +83 -0
- package/dist/test/test/http/session-manager.test.js.map +1 -0
- package/dist/test/test/revisions/hash.test.d.ts +2 -0
- package/dist/test/test/revisions/hash.test.d.ts.map +1 -0
- package/dist/test/test/revisions/hash.test.js +33 -0
- package/dist/test/test/revisions/hash.test.js.map +1 -0
- package/dist/test/test/revisions/store.test.d.ts +2 -0
- package/dist/test/test/revisions/store.test.d.ts.map +1 -0
- package/dist/test/test/revisions/store.test.js +245 -0
- package/dist/test/test/revisions/store.test.js.map +1 -0
- package/dist/test/test/server.test.d.ts +2 -0
- package/dist/test/test/server.test.d.ts.map +1 -0
- package/dist/test/test/server.test.js +157 -0
- package/dist/test/test/server.test.js.map +1 -0
- package/dist/test/test/skill-tools.test.d.ts +2 -0
- package/dist/test/test/skill-tools.test.d.ts.map +1 -0
- package/dist/test/test/skill-tools.test.js +84 -0
- package/dist/test/test/skill-tools.test.js.map +1 -0
- package/dist/test/test/smoke.test.d.ts +2 -0
- package/dist/test/test/smoke.test.d.ts.map +1 -0
- package/dist/test/test/smoke.test.js +8 -0
- package/dist/test/test/smoke.test.js.map +1 -0
- package/dist/test/test/tools/asset-generate.test.d.ts +2 -0
- package/dist/test/test/tools/asset-generate.test.d.ts.map +1 -0
- package/dist/test/test/tools/asset-generate.test.js +66 -0
- package/dist/test/test/tools/asset-generate.test.js.map +1 -0
- package/dist/test/test/tools/edit.test.d.ts +2 -0
- package/dist/test/test/tools/edit.test.d.ts.map +1 -0
- package/dist/test/test/tools/edit.test.js +205 -0
- package/dist/test/test/tools/edit.test.js.map +1 -0
- package/dist/test/test/tools/export.test.d.ts +2 -0
- package/dist/test/test/tools/export.test.d.ts.map +1 -0
- package/dist/test/test/tools/export.test.js +144 -0
- package/dist/test/test/tools/export.test.js.map +1 -0
- package/dist/test/test/tools/history.test.d.ts +2 -0
- package/dist/test/test/tools/history.test.d.ts.map +1 -0
- package/dist/test/test/tools/history.test.js +29 -0
- package/dist/test/test/tools/history.test.js.map +1 -0
- package/dist/test/test/tools/inspect.test.d.ts +2 -0
- package/dist/test/test/tools/inspect.test.d.ts.map +1 -0
- package/dist/test/test/tools/inspect.test.js +62 -0
- package/dist/test/test/tools/inspect.test.js.map +1 -0
- package/dist/test/test/tools/list.test.d.ts +2 -0
- package/dist/test/test/tools/list.test.d.ts.map +1 -0
- package/dist/test/test/tools/list.test.js +23 -0
- package/dist/test/test/tools/list.test.js.map +1 -0
- package/dist/test/test/tools/open-editor.test.d.ts +2 -0
- package/dist/test/test/tools/open-editor.test.d.ts.map +1 -0
- package/dist/test/test/tools/open-editor.test.js +53 -0
- package/dist/test/test/tools/open-editor.test.js.map +1 -0
- package/dist/test/test/tools/preview.test.d.ts +2 -0
- package/dist/test/test/tools/preview.test.d.ts.map +1 -0
- package/dist/test/test/tools/preview.test.js +73 -0
- package/dist/test/test/tools/preview.test.js.map +1 -0
- package/dist/test/test/tools/rename.test.d.ts +2 -0
- package/dist/test/test/tools/rename.test.d.ts.map +1 -0
- package/dist/test/test/tools/rename.test.js +17 -0
- package/dist/test/test/tools/rename.test.js.map +1 -0
- package/dist/test/test/viewer/broadcaster.test.d.ts +2 -0
- package/dist/test/test/viewer/broadcaster.test.d.ts.map +1 -0
- package/dist/test/test/viewer/broadcaster.test.js +53 -0
- package/dist/test/test/viewer/broadcaster.test.js.map +1 -0
- package/dist/test/test/viewer/resource-route.test.d.ts +2 -0
- package/dist/test/test/viewer/resource-route.test.d.ts.map +1 -0
- package/dist/test/test/viewer/resource-route.test.js +70 -0
- package/dist/test/test/viewer/resource-route.test.js.map +1 -0
- package/dist/test/test/viewer/router.test.d.ts +2 -0
- package/dist/test/test/viewer/router.test.d.ts.map +1 -0
- package/dist/test/test/viewer/router.test.js +171 -0
- package/dist/test/test/viewer/router.test.js.map +1 -0
- package/dist/test/test/viewer/url-builder.test.d.ts +2 -0
- package/dist/test/test/viewer/url-builder.test.d.ts.map +1 -0
- package/dist/test/test/viewer/url-builder.test.js +31 -0
- package/dist/test/test/viewer/url-builder.test.js.map +1 -0
- package/dist/test/test/workspace/hosted-stub.test.d.ts +2 -0
- package/dist/test/test/workspace/hosted-stub.test.d.ts.map +1 -0
- package/dist/test/test/workspace/hosted-stub.test.js +30 -0
- package/dist/test/test/workspace/hosted-stub.test.js.map +1 -0
- package/dist/test/test/workspace/in-memory.test.d.ts +2 -0
- package/dist/test/test/workspace/in-memory.test.d.ts.map +1 -0
- package/dist/test/test/workspace/in-memory.test.js +4 -0
- package/dist/test/test/workspace/in-memory.test.js.map +1 -0
- package/dist/test/test/workspace/node-fs.test.d.ts +2 -0
- package/dist/test/test/workspace/node-fs.test.d.ts.map +1 -0
- package/dist/test/test/workspace/node-fs.test.js +20 -0
- package/dist/test/test/workspace/node-fs.test.js.map +1 -0
- package/dist/test/test/workspace/shared-contract.d.ts +3 -0
- package/dist/test/test/workspace/shared-contract.d.ts.map +1 -0
- package/dist/test/test/workspace/shared-contract.js +92 -0
- package/dist/test/test/workspace/shared-contract.js.map +1 -0
- package/dist/test/tsconfig.test.tsbuildinfo +1 -0
- package/dist/test/vitest.config.d.ts +3 -0
- package/dist/test/vitest.config.d.ts.map +1 -0
- package/dist/test/vitest.config.js +8 -0
- package/dist/test/vitest.config.js.map +1 -0
- package/dist/tools/asset-generate.d.ts +12 -0
- package/dist/tools/asset-generate.d.ts.map +1 -0
- package/dist/tools/asset-generate.js +112 -0
- package/dist/tools/asset-generate.js.map +1 -0
- package/dist/tools/asset-search.d.ts +10 -0
- package/dist/tools/asset-search.d.ts.map +1 -0
- package/dist/tools/asset-search.js +120 -0
- package/dist/tools/asset-search.js.map +1 -0
- package/dist/tools/content-types.d.ts +11 -0
- package/dist/tools/content-types.d.ts.map +1 -0
- package/dist/tools/content-types.js +2 -0
- package/dist/tools/content-types.js.map +1 -0
- package/dist/tools/edit.d.ts +29 -0
- package/dist/tools/edit.d.ts.map +1 -0
- package/dist/tools/edit.js +165 -0
- package/dist/tools/edit.js.map +1 -0
- package/dist/tools/engine.d.ts +31 -0
- package/dist/tools/engine.d.ts.map +1 -0
- package/dist/tools/engine.js +59 -0
- package/dist/tools/engine.js.map +1 -0
- package/dist/tools/export.d.ts +19 -0
- package/dist/tools/export.d.ts.map +1 -0
- package/dist/tools/export.js +179 -0
- package/dist/tools/export.js.map +1 -0
- package/dist/tools/history.d.ts +7 -0
- package/dist/tools/history.d.ts.map +1 -0
- package/dist/tools/history.js +54 -0
- package/dist/tools/history.js.map +1 -0
- package/dist/tools/index.d.ts +35 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +72 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/inspect.d.ts +7 -0
- package/dist/tools/inspect.d.ts.map +1 -0
- package/dist/tools/inspect.js +80 -0
- package/dist/tools/inspect.js.map +1 -0
- package/dist/tools/list.d.ts +7 -0
- package/dist/tools/list.d.ts.map +1 -0
- package/dist/tools/list.js +18 -0
- package/dist/tools/list.js.map +1 -0
- package/dist/tools/metrics.d.ts +11 -0
- package/dist/tools/metrics.d.ts.map +1 -0
- package/dist/tools/metrics.js +28 -0
- package/dist/tools/metrics.js.map +1 -0
- package/dist/tools/open-editor.d.ts +10 -0
- package/dist/tools/open-editor.d.ts.map +1 -0
- package/dist/tools/open-editor.js +62 -0
- package/dist/tools/open-editor.js.map +1 -0
- package/dist/tools/preview.d.ts +12 -0
- package/dist/tools/preview.d.ts.map +1 -0
- package/dist/tools/preview.js +104 -0
- package/dist/tools/preview.js.map +1 -0
- package/dist/tools/rename.d.ts +7 -0
- package/dist/tools/rename.d.ts.map +1 -0
- package/dist/tools/rename.js +39 -0
- package/dist/tools/rename.js.map +1 -0
- package/dist/tools/result.d.ts +12 -0
- package/dist/tools/result.d.ts.map +1 -0
- package/dist/tools/result.js +55 -0
- package/dist/tools/result.js.map +1 -0
- package/dist/tools/save.d.ts +19 -0
- package/dist/tools/save.d.ts.map +1 -0
- package/dist/tools/save.js +117 -0
- package/dist/tools/save.js.map +1 -0
- package/dist/viewer/broadcaster.d.ts +13 -0
- package/dist/viewer/broadcaster.d.ts.map +1 -0
- package/dist/viewer/broadcaster.js +44 -0
- package/dist/viewer/broadcaster.js.map +1 -0
- package/dist/viewer/index.d.ts +7 -0
- package/dist/viewer/index.d.ts.map +1 -0
- package/dist/viewer/index.js +7 -0
- package/dist/viewer/index.js.map +1 -0
- package/dist/viewer/listener.d.ts +16 -0
- package/dist/viewer/listener.d.ts.map +1 -0
- package/dist/viewer/listener.js +30 -0
- package/dist/viewer/listener.js.map +1 -0
- package/dist/viewer/presigned-r2-url-builder.d.ts +30 -0
- package/dist/viewer/presigned-r2-url-builder.d.ts.map +1 -0
- package/dist/viewer/presigned-r2-url-builder.js +40 -0
- package/dist/viewer/presigned-r2-url-builder.js.map +1 -0
- package/dist/viewer/resource-route.d.ts +9 -0
- package/dist/viewer/resource-route.d.ts.map +1 -0
- package/dist/viewer/resource-route.js +59 -0
- package/dist/viewer/resource-route.js.map +1 -0
- package/dist/viewer/router.d.ts +20 -0
- package/dist/viewer/router.d.ts.map +1 -0
- package/dist/viewer/router.js +142 -0
- package/dist/viewer/router.js.map +1 -0
- package/dist/viewer/session-mount.d.ts +10 -0
- package/dist/viewer/session-mount.d.ts.map +1 -0
- package/dist/viewer/session-mount.js +24 -0
- package/dist/viewer/session-mount.js.map +1 -0
- package/dist/viewer/spa-assets.generated.d.ts +2 -0
- package/dist/viewer/spa-assets.generated.d.ts.map +1 -0
- package/dist/viewer/spa-assets.generated.js +989 -0
- package/dist/viewer/spa-assets.generated.js.map +1 -0
- package/dist/viewer/url-builder.d.ts +48 -0
- package/dist/viewer/url-builder.d.ts.map +1 -0
- package/dist/viewer/url-builder.js +38 -0
- package/dist/viewer/url-builder.js.map +1 -0
- package/dist/workspace/hosted-stub.d.ts +28 -0
- package/dist/workspace/hosted-stub.d.ts.map +1 -0
- package/dist/workspace/hosted-stub.js +44 -0
- package/dist/workspace/hosted-stub.js.map +1 -0
- package/dist/workspace/in-memory.d.ts +23 -0
- package/dist/workspace/in-memory.d.ts.map +1 -0
- package/dist/workspace/in-memory.js +161 -0
- package/dist/workspace/in-memory.js.map +1 -0
- package/dist/workspace/index.d.ts +6 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/dist/workspace/index.js +6 -0
- package/dist/workspace/index.js.map +1 -0
- package/dist/workspace/node-fs.d.ts +23 -0
- package/dist/workspace/node-fs.d.ts.map +1 -0
- package/dist/workspace/node-fs.js +90 -0
- package/dist/workspace/node-fs.js.map +1 -0
- package/dist/workspace/s3.d.ts +32 -0
- package/dist/workspace/s3.d.ts.map +1 -0
- package/dist/workspace/s3.js +191 -0
- package/dist/workspace/s3.js.map +1 -0
- package/dist/workspace/scoped.d.ts +32 -0
- package/dist/workspace/scoped.d.ts.map +1 -0
- package/dist/workspace/scoped.js +76 -0
- package/dist/workspace/scoped.js.map +1 -0
- package/dist/workspace/types.d.ts +75 -0
- package/dist/workspace/types.d.ts.map +1 -0
- package/dist/workspace/types.js +18 -0
- package/dist/workspace/types.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,865 @@
|
|
|
1
|
+
> This is one page of the CE.SDK Vanilla JS/TS documentation. For a complete overview, see the [Vanilla JS/TS Documentation Index](https://img.ly/docs/cesdk/js.md). For all docs in one file, see [llms-full.txt](./llms-full.txt.md).
|
|
2
|
+
|
|
3
|
+
**Navigation:** [Guides](./guides.md) > [Open the Editor](./open-the-editor.md) > [Import a Design](./open-the-editor/import-design.md) > [From Photoshop](./open-the-editor/import-design/from-photoshop.md)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Import Adobe Photoshop (PSD) files into CE.SDK, converting them into editable scenes while preserving layers, text, shapes, and positioning.
|
|
8
|
+
|
|
9
|
+
> **Reading time:** 10 minutes
|
|
10
|
+
>
|
|
11
|
+
> **Resources:**
|
|
12
|
+
>
|
|
13
|
+
> - [Download examples](https://github.com/imgly/cesdk-web-examples/archive/refs/tags/release-$UBQ_VERSION$.zip)
|
|
14
|
+
> - [View source on GitHub](https://github.com/imgly/cesdk-web-examples/tree/release-$UBQ_VERSION$/guides-open-the-editor-import-design-from-photoshop-browser)
|
|
15
|
+
> - [Open in StackBlitz](https://stackblitz.com/github/imgly/cesdk-web-examples/tree/v$UBQ_VERSION$/guides-open-the-editor-import-design-from-photoshop-browser)
|
|
16
|
+
> - [Live demo](https://img.ly/docs/cesdk/examples/guides-open-the-editor-import-design-from-photoshop-browser/)
|
|
17
|
+
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
The `@imgly/psd-importer` package converts Photoshop files into CE.SDK scene format, preserving design structure for editing or export. This guide focuses on enabling end-users to upload their own PSD files directly in the browser and load them into the CE.SDK editor. For batch conversion of template libraries at build-time, see the [server guide](./open-the-editor/import-design/from-photoshop.md).
|
|
21
|
+
|
|
22
|
+
```typescript file=@cesdk_web_examples/guides-open-the-editor-import-design-from-photoshop-browser/browser.ts reference-only
|
|
23
|
+
import type { EditorPlugin, EditorPluginContext } from '@cesdk/cesdk-js';
|
|
24
|
+
|
|
25
|
+
import {
|
|
26
|
+
BlurAssetSource,
|
|
27
|
+
ColorPaletteAssetSource,
|
|
28
|
+
CropPresetsAssetSource,
|
|
29
|
+
DemoAssetSources,
|
|
30
|
+
EffectsAssetSource,
|
|
31
|
+
FiltersAssetSource,
|
|
32
|
+
PagePresetsAssetSource,
|
|
33
|
+
StickerAssetSource,
|
|
34
|
+
TextAssetSource,
|
|
35
|
+
TextComponentAssetSource,
|
|
36
|
+
TypefaceAssetSource,
|
|
37
|
+
UploadAssetSources,
|
|
38
|
+
VectorShapeAssetSource
|
|
39
|
+
} from '@cesdk/cesdk-js/plugins';
|
|
40
|
+
import { DesignEditorConfig } from './design-editor/plugin';
|
|
41
|
+
import type {
|
|
42
|
+
AssetQueryData,
|
|
43
|
+
AssetResult,
|
|
44
|
+
AssetsQueryResult
|
|
45
|
+
} from '@cesdk/engine';
|
|
46
|
+
import type { TypefaceResolver } from '@imgly/psd-importer';
|
|
47
|
+
import {
|
|
48
|
+
PSDParser,
|
|
49
|
+
addGfontsAssetLibrary,
|
|
50
|
+
createWebEncodeBufferToPNG
|
|
51
|
+
} from '@imgly/psd-importer';
|
|
52
|
+
import packageJson from './package.json';
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* CE.SDK Plugin: Import from Photoshop Guide
|
|
56
|
+
*
|
|
57
|
+
* Demonstrates how to import Adobe Photoshop (PSD) files into CE.SDK:
|
|
58
|
+
* - Creating a custom asset source for PSD templates
|
|
59
|
+
* - Adding a custom nav bar button to upload PSD files
|
|
60
|
+
* - Parsing PSD files with the PSD importer
|
|
61
|
+
* - Displaying import warnings to users
|
|
62
|
+
*
|
|
63
|
+
* Note: In-library file uploads for custom asset sources will be supported
|
|
64
|
+
* in a future CE.SDK release. This guide demonstrates using a custom nav bar
|
|
65
|
+
* button as an alternative approach for user file uploads.
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
// Asset source ID for PSD library
|
|
69
|
+
const PSD_SOURCE_ID = 'psd-files';
|
|
70
|
+
|
|
71
|
+
// Base URL for PSD template files
|
|
72
|
+
const PSD_BASE_URL =
|
|
73
|
+
'https://staticimgly.com/imgly/docs-reference-files-temp/psd-template-import';
|
|
74
|
+
|
|
75
|
+
// Sample PSD files from the CE.SDK showcases
|
|
76
|
+
const SAMPLE_PSD_FILES: AssetResult[] = [
|
|
77
|
+
{
|
|
78
|
+
id: 'showcase-file-1',
|
|
79
|
+
label: 'Sample Design 1',
|
|
80
|
+
tags: ['sample', 'psd'],
|
|
81
|
+
meta: {
|
|
82
|
+
uri: `${PSD_BASE_URL}/showcase-file-1.psd`,
|
|
83
|
+
thumbUri: `${PSD_BASE_URL}/showcase-file-1-thumb.png`,
|
|
84
|
+
mimeType: 'application/x-photoshop',
|
|
85
|
+
width: 1920,
|
|
86
|
+
height: 1080
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: 'showcase-file-2',
|
|
91
|
+
label: 'Sample Design 2',
|
|
92
|
+
tags: ['sample', 'psd'],
|
|
93
|
+
meta: {
|
|
94
|
+
uri: `${PSD_BASE_URL}/showcase-file-2.psd`,
|
|
95
|
+
thumbUri: `${PSD_BASE_URL}/showcase-file-2-thumb.png`,
|
|
96
|
+
mimeType: 'application/x-photoshop',
|
|
97
|
+
width: 1920,
|
|
98
|
+
height: 1080
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: 'showcase-file-3',
|
|
103
|
+
label: 'Sample Design 3',
|
|
104
|
+
tags: ['sample', 'psd'],
|
|
105
|
+
meta: {
|
|
106
|
+
uri: `${PSD_BASE_URL}/showcase-file-3.psd`,
|
|
107
|
+
thumbUri: `${PSD_BASE_URL}/showcase-file-3-thumb.png`,
|
|
108
|
+
mimeType: 'application/x-photoshop',
|
|
109
|
+
width: 1920,
|
|
110
|
+
height: 1080
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
class Example implements EditorPlugin {
|
|
116
|
+
name = packageJson.name;
|
|
117
|
+
|
|
118
|
+
version = packageJson.version;
|
|
119
|
+
|
|
120
|
+
async initialize({ cesdk }: EditorPluginContext): Promise<void> {
|
|
121
|
+
if (!cesdk) {
|
|
122
|
+
throw new Error('CE.SDK instance is required for this plugin');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const engine = cesdk.engine;
|
|
126
|
+
|
|
127
|
+
// Initialize CE.SDK with Google Fonts support for PSD text matching
|
|
128
|
+
await cesdk.addPlugin(new DesignEditorConfig());
|
|
129
|
+
|
|
130
|
+
// Add asset source plugins
|
|
131
|
+
await cesdk.addPlugin(new BlurAssetSource());
|
|
132
|
+
await cesdk.addPlugin(new ColorPaletteAssetSource());
|
|
133
|
+
await cesdk.addPlugin(new CropPresetsAssetSource());
|
|
134
|
+
await cesdk.addPlugin(
|
|
135
|
+
new UploadAssetSources({ include: ['ly.img.image.upload'] })
|
|
136
|
+
);
|
|
137
|
+
await cesdk.addPlugin(
|
|
138
|
+
new DemoAssetSources({
|
|
139
|
+
include: [
|
|
140
|
+
'ly.img.templates.blank.*',
|
|
141
|
+
'ly.img.templates.presentation.*',
|
|
142
|
+
'ly.img.templates.print.*',
|
|
143
|
+
'ly.img.templates.social.*',
|
|
144
|
+
'ly.img.image.*'
|
|
145
|
+
]
|
|
146
|
+
})
|
|
147
|
+
);
|
|
148
|
+
await cesdk.addPlugin(new EffectsAssetSource());
|
|
149
|
+
await cesdk.addPlugin(new FiltersAssetSource());
|
|
150
|
+
await cesdk.addPlugin(new PagePresetsAssetSource());
|
|
151
|
+
await cesdk.addPlugin(new StickerAssetSource());
|
|
152
|
+
await cesdk.addPlugin(new TextAssetSource());
|
|
153
|
+
await cesdk.addPlugin(new TextComponentAssetSource());
|
|
154
|
+
await cesdk.addPlugin(new TypefaceAssetSource());
|
|
155
|
+
await cesdk.addPlugin(new VectorShapeAssetSource());
|
|
156
|
+
|
|
157
|
+
// Register Google Fonts before parsing PSD files for best font matching
|
|
158
|
+
await addGfontsAssetLibrary(engine);
|
|
159
|
+
|
|
160
|
+
// Optional: Create a custom font resolver for advanced font mapping
|
|
161
|
+
// Use this when you need to map Photoshop fonts to specific alternatives,
|
|
162
|
+
// use enterprise fonts, or implement custom fallback logic
|
|
163
|
+
const customFontResolver: TypefaceResolver = async (fontParams, eng) => {
|
|
164
|
+
const { family, style, weight } = fontParams;
|
|
165
|
+
|
|
166
|
+
// Define font mappings from Photoshop fonts to available alternatives
|
|
167
|
+
const fontMappings: Record<string, string> = {
|
|
168
|
+
Arial: 'Open Sans',
|
|
169
|
+
Helvetica: 'Inter',
|
|
170
|
+
'Helvetica Neue': 'Inter',
|
|
171
|
+
'Times New Roman': 'Lora',
|
|
172
|
+
Georgia: 'Merriweather'
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
// Use mapped font or original family name
|
|
176
|
+
const targetFamily = fontMappings[family] || family;
|
|
177
|
+
|
|
178
|
+
// Search for the font in available typefaces
|
|
179
|
+
const result = await eng.asset.findAssets('ly.img.typeface', {
|
|
180
|
+
query: targetFamily,
|
|
181
|
+
page: 0,
|
|
182
|
+
perPage: 10
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
if (result.assets.length === 0) {
|
|
186
|
+
console.warn(`Font "${family}" not found, using default fallback`);
|
|
187
|
+
return null; // Let the parser use its default fallback
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Get the typeface from the asset payload
|
|
191
|
+
const asset = result.assets[0];
|
|
192
|
+
const typeface = asset.payload?.typeface;
|
|
193
|
+
if (!typeface) return null;
|
|
194
|
+
|
|
195
|
+
// Find the best matching font variant (weight and style)
|
|
196
|
+
const matchingFont =
|
|
197
|
+
typeface.fonts.find(
|
|
198
|
+
(f: { weight?: string; style?: string }) =>
|
|
199
|
+
f.weight === weight && f.style === style
|
|
200
|
+
) ||
|
|
201
|
+
typeface.fonts.find((f: { weight?: string }) => f.weight === weight) ||
|
|
202
|
+
typeface.fonts[0];
|
|
203
|
+
|
|
204
|
+
return { typeface, font: matchingFont };
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
// Create an initial design scene
|
|
208
|
+
await cesdk.actions.run('scene.create', {
|
|
209
|
+
page: {
|
|
210
|
+
sourceId: 'ly.img.page.presets',
|
|
211
|
+
assetId: 'ly.img.page.presets.print.iso.a6.landscape'
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
// Helper function to import PSD from URL or buffer
|
|
216
|
+
const importPsd = async (
|
|
217
|
+
source: string | ArrayBuffer,
|
|
218
|
+
sourceName: string
|
|
219
|
+
) => {
|
|
220
|
+
console.log(`Processing PSD: ${sourceName}`);
|
|
221
|
+
|
|
222
|
+
// Get buffer from URL or use directly
|
|
223
|
+
let buffer: ArrayBuffer;
|
|
224
|
+
if (typeof source === 'string') {
|
|
225
|
+
const response = await fetch(source);
|
|
226
|
+
buffer = await response.arrayBuffer();
|
|
227
|
+
} else {
|
|
228
|
+
buffer = source;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Parse the PSD file using the PSD importer
|
|
232
|
+
// The addGfontsAssetLibrary() call above enables automatic font matching
|
|
233
|
+
// For custom font mapping, pass fontResolver in options (see customFontResolver example)
|
|
234
|
+
const parser = await PSDParser.fromFile(
|
|
235
|
+
engine,
|
|
236
|
+
buffer,
|
|
237
|
+
createWebEncodeBufferToPNG(),
|
|
238
|
+
{ fontResolver: customFontResolver }
|
|
239
|
+
);
|
|
240
|
+
const result = await parser.parse();
|
|
241
|
+
|
|
242
|
+
// Check for import warnings and errors
|
|
243
|
+
const messages = result.logger.getMessages();
|
|
244
|
+
const warnings = messages.filter((m) => m.type === 'warning');
|
|
245
|
+
const errors = messages.filter((m) => m.type === 'error');
|
|
246
|
+
|
|
247
|
+
if (errors.length > 0) {
|
|
248
|
+
console.error('Import errors:', errors);
|
|
249
|
+
}
|
|
250
|
+
if (warnings.length > 0) {
|
|
251
|
+
console.warn(
|
|
252
|
+
'Import warnings:',
|
|
253
|
+
warnings.map((w) => w.message)
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Save the imported scene as an archive for editor loading
|
|
258
|
+
const sceneArchive = await engine.scene.saveToArchive();
|
|
259
|
+
const archiveUrl = URL.createObjectURL(sceneArchive);
|
|
260
|
+
|
|
261
|
+
// Optional: Save scene as JSON string with stable URLs instead of archive
|
|
262
|
+
// This is useful when storing scenes in a database or referencing CDN-hosted assets
|
|
263
|
+
// By default, PSD images use transient buffer:// URLs that only work with saveToArchive()
|
|
264
|
+
// To use saveToString(), relocate transient resources to permanent URLs first:
|
|
265
|
+
|
|
266
|
+
// Mock upload function - replace with your actual backend upload logic
|
|
267
|
+
const uploadToBackend = async (data: Uint8Array): Promise<string> => {
|
|
268
|
+
// In production, upload the data to your CDN/storage and return the permanent URL
|
|
269
|
+
// For this example, we create a blob URL to demonstrate the workflow
|
|
270
|
+
const blob = new Blob([new Uint8Array(data)], { type: 'image/png' });
|
|
271
|
+
return URL.createObjectURL(blob);
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
const transientResources = engine.editor.findAllTransientResources();
|
|
275
|
+
for (const resource of transientResources) {
|
|
276
|
+
const { URL: bufferUri, size } = resource;
|
|
277
|
+
const data = engine.editor.getBufferData(bufferUri, 0, size);
|
|
278
|
+
const permanentUrl = await uploadToBackend(data);
|
|
279
|
+
engine.editor.relocateResource(bufferUri, permanentUrl);
|
|
280
|
+
}
|
|
281
|
+
const sceneString = await engine.scene.saveToString();
|
|
282
|
+
console.log(
|
|
283
|
+
`Scene persisted with stable URLs (${sceneString.length} bytes)`
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
// Load the archived scene into the editor
|
|
287
|
+
await cesdk.engine.scene.loadFromArchiveURL(archiveUrl);
|
|
288
|
+
|
|
289
|
+
// Verify scene loaded correctly
|
|
290
|
+
const pages = engine.scene.getPages();
|
|
291
|
+
console.log(`PSD imported successfully with ${pages.length} page(s)`);
|
|
292
|
+
|
|
293
|
+
// Zoom to fit the imported page
|
|
294
|
+
await cesdk.actions.run('zoom.toPage', { page: 'first', autoFit: true });
|
|
295
|
+
|
|
296
|
+
// Clean up object URL
|
|
297
|
+
URL.revokeObjectURL(archiveUrl);
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
// Add custom asset source for PSD templates
|
|
301
|
+
engine.asset.addSource({
|
|
302
|
+
id: PSD_SOURCE_ID,
|
|
303
|
+
|
|
304
|
+
async findAssets(
|
|
305
|
+
queryData: AssetQueryData
|
|
306
|
+
): Promise<AssetsQueryResult<AssetResult>> {
|
|
307
|
+
let assets = SAMPLE_PSD_FILES;
|
|
308
|
+
|
|
309
|
+
// Filter by query if provided
|
|
310
|
+
if (queryData.query) {
|
|
311
|
+
const query = queryData.query.toLowerCase();
|
|
312
|
+
assets = assets.filter(
|
|
313
|
+
(a) =>
|
|
314
|
+
a.label?.toLowerCase().includes(query) ||
|
|
315
|
+
a.tags?.some((t) => t.toLowerCase().includes(query))
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
return {
|
|
320
|
+
assets,
|
|
321
|
+
total: assets.length,
|
|
322
|
+
currentPage: queryData.page,
|
|
323
|
+
nextPage: undefined
|
|
324
|
+
};
|
|
325
|
+
},
|
|
326
|
+
|
|
327
|
+
async applyAsset(asset: AssetResult): Promise<number | undefined> {
|
|
328
|
+
if (!asset.meta?.uri) {
|
|
329
|
+
console.error('Asset has no URI');
|
|
330
|
+
return undefined;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
await importPsd(asset.meta.uri as string, asset.label || asset.id);
|
|
334
|
+
return undefined; // Scene replaced, no new block created
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
// Set labels for the asset source and library entry
|
|
339
|
+
cesdk.i18n.setTranslations({
|
|
340
|
+
en: {
|
|
341
|
+
[`libraries.${PSD_SOURCE_ID}.label`]: 'PSD Files',
|
|
342
|
+
'libraries.psd-library-entry.label': 'PSD Templates'
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
// Configure the asset library UI to show the PSD source
|
|
347
|
+
cesdk.ui.addAssetLibraryEntry({
|
|
348
|
+
id: 'psd-library-entry',
|
|
349
|
+
sourceIds: [PSD_SOURCE_ID],
|
|
350
|
+
previewLength: 3,
|
|
351
|
+
previewBackgroundType: 'contain',
|
|
352
|
+
gridBackgroundType: 'contain',
|
|
353
|
+
gridColumns: 2
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
// Add PSD library to the dock and remove the default Templates entry
|
|
357
|
+
const existingDockOrder = cesdk.ui.getComponentOrder({ in: 'ly.img.dock' });
|
|
358
|
+
const filteredDockOrder = existingDockOrder.filter(
|
|
359
|
+
(entry) => entry.key !== 'ly.img.templates'
|
|
360
|
+
);
|
|
361
|
+
cesdk.ui.setComponentOrder({ in: 'ly.img.dock' }, [
|
|
362
|
+
{
|
|
363
|
+
id: 'ly.img.assetLibrary.dock',
|
|
364
|
+
key: 'psd-library-dock',
|
|
365
|
+
label: 'PSD Templates',
|
|
366
|
+
icon: '@imgly/Template',
|
|
367
|
+
entries: ['psd-library-entry']
|
|
368
|
+
},
|
|
369
|
+
...filteredDockOrder
|
|
370
|
+
]);
|
|
371
|
+
|
|
372
|
+
// Add a custom nav bar button for uploading and importing PSD files
|
|
373
|
+
// Uses cesdk.utils.loadFile() to open the browser's file picker
|
|
374
|
+
cesdk.ui.registerComponent('psd.uploadButton', ({ builder }) => {
|
|
375
|
+
builder.Button('psd.uploadButton', {
|
|
376
|
+
label: 'Load PSD File',
|
|
377
|
+
icon: '@imgly/Upload',
|
|
378
|
+
variant: 'regular',
|
|
379
|
+
color: 'accent',
|
|
380
|
+
onClick: async () => {
|
|
381
|
+
const buffer = await cesdk.utils.loadFile({
|
|
382
|
+
accept: '.psd,application/x-photoshop,image/vnd.adobe.photoshop',
|
|
383
|
+
returnType: 'arrayBuffer'
|
|
384
|
+
});
|
|
385
|
+
await importPsd(buffer, 'uploaded.psd');
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
// Add the upload button to the right side of the navigation bar
|
|
391
|
+
cesdk.ui.setComponentOrder({ in: 'ly.img.navigation.bar' }, [
|
|
392
|
+
...cesdk.ui.getComponentOrder({ in: 'ly.img.navigation.bar' }),
|
|
393
|
+
'psd.uploadButton'
|
|
394
|
+
]);
|
|
395
|
+
|
|
396
|
+
// Open the PSD Templates library by default
|
|
397
|
+
cesdk.ui.openPanel('//ly.img.panel/assetLibrary', {
|
|
398
|
+
payload: {
|
|
399
|
+
entries: ['psd-library-entry'],
|
|
400
|
+
title: 'PSD Templates'
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
// Override the importScene action to support PSD files alongside standard formats
|
|
405
|
+
// This integrates PSD import with the default import workflow
|
|
406
|
+
cesdk.actions.register(
|
|
407
|
+
'importScene',
|
|
408
|
+
async ({
|
|
409
|
+
format = 'scene'
|
|
410
|
+
}: {
|
|
411
|
+
format?: 'scene' | 'archive' | 'psd';
|
|
412
|
+
}) => {
|
|
413
|
+
if (format === 'psd') {
|
|
414
|
+
// Handle PSD import using cesdk.utils.loadFile
|
|
415
|
+
const buffer = await cesdk.utils.loadFile({
|
|
416
|
+
accept: '.psd,application/x-photoshop,image/vnd.adobe.photoshop',
|
|
417
|
+
returnType: 'arrayBuffer'
|
|
418
|
+
});
|
|
419
|
+
await importPsd(buffer, 'imported.psd');
|
|
420
|
+
} else if (format === 'scene') {
|
|
421
|
+
// Handle standard .scene files
|
|
422
|
+
const scene = await cesdk.utils.loadFile({
|
|
423
|
+
accept: '.scene',
|
|
424
|
+
returnType: 'text'
|
|
425
|
+
});
|
|
426
|
+
await cesdk.engine.scene.loadFromString(scene);
|
|
427
|
+
await cesdk.actions.run('zoom.toPage', { page: 'first' });
|
|
428
|
+
} else {
|
|
429
|
+
// Handle archive files (.zip)
|
|
430
|
+
const blobURL = await cesdk.utils.loadFile({
|
|
431
|
+
accept: '.zip',
|
|
432
|
+
returnType: 'objectURL'
|
|
433
|
+
});
|
|
434
|
+
try {
|
|
435
|
+
await cesdk.engine.scene.loadFromArchiveURL(blobURL);
|
|
436
|
+
} finally {
|
|
437
|
+
URL.revokeObjectURL(blobURL);
|
|
438
|
+
}
|
|
439
|
+
await cesdk.actions.run('zoom.toPage', { page: 'first' });
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export default Example;
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
## Installation
|
|
450
|
+
|
|
451
|
+
Install the `@imgly/psd-importer` package alongside CE.SDK:
|
|
452
|
+
|
|
453
|
+
```bash
|
|
454
|
+
npm install @imgly/psd-importer @cesdk/cesdk-js@$UBQ_VERSION$
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
The browser environment uses `createWebEncodeBufferToPNG()` for PNG encoding, which requires no additional dependencies.
|
|
458
|
+
|
|
459
|
+
## Import Your First PSD
|
|
460
|
+
|
|
461
|
+
Parse a PSD file and load it into CE.SDK with just a few lines of code:
|
|
462
|
+
|
|
463
|
+
```typescript
|
|
464
|
+
import CreativeEditorSDK from '@cesdk/cesdk-js';
|
|
465
|
+
import { PSDParser, createWebEncodeBufferToPNG } from '@imgly/psd-importer';
|
|
466
|
+
|
|
467
|
+
// Initialize CE.SDK
|
|
468
|
+
const cesdk = await CreativeEditorSDK.create('#container', {
|
|
469
|
+
license: 'YOUR_LICENSE_KEY'
|
|
470
|
+
});
|
|
471
|
+
const engine = cesdk.engine;
|
|
472
|
+
|
|
473
|
+
// Fetch and parse a PSD file
|
|
474
|
+
const response = await fetch('https://example.com/design.psd');
|
|
475
|
+
const buffer = await response.arrayBuffer();
|
|
476
|
+
|
|
477
|
+
// Parse the PSD - creates a scene in the engine
|
|
478
|
+
const parser = await PSDParser.fromFile(
|
|
479
|
+
engine,
|
|
480
|
+
buffer,
|
|
481
|
+
createWebEncodeBufferToPNG()
|
|
482
|
+
);
|
|
483
|
+
await parser.parse();
|
|
484
|
+
|
|
485
|
+
// The PSD is now loaded as an editable scene
|
|
486
|
+
console.log('Pages:', engine.scene.getPages().length);
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
This minimal example fetches a PSD from a URL and converts it into an editable CE.SDK scene. The following sections cover font handling, user uploads, and additional features.
|
|
490
|
+
|
|
491
|
+
## Supported Elements
|
|
492
|
+
|
|
493
|
+
The PSD importer preserves the following Photoshop elements:
|
|
494
|
+
|
|
495
|
+
- **Layer structure** - Groups and layer hierarchy
|
|
496
|
+
- **Positioning** - X/Y coordinates, rotation, and transparency
|
|
497
|
+
- **Text elements** - Font family, bold/italic styles (single style per layer)
|
|
498
|
+
- **Shapes** - Rectangles, ovals, polygons, lines, and custom shapes
|
|
499
|
+
- **Fills** - Solid color fills and strokes (weight, color, alignment)
|
|
500
|
+
- **Images** - Raster image layers (without cropping)
|
|
501
|
+
|
|
502
|
+
## Setting Up Font Matching
|
|
503
|
+
|
|
504
|
+
Text elements in PSD files reference fonts that may not be available in CE.SDK. Use `addGfontsAssetLibrary()` to register Google Fonts as a font source before parsing:
|
|
505
|
+
|
|
506
|
+
```typescript highlight=highlight-setup
|
|
507
|
+
// Initialize CE.SDK with Google Fonts support for PSD text matching
|
|
508
|
+
await cesdk.addPlugin(new DesignEditorConfig());
|
|
509
|
+
|
|
510
|
+
// Add asset source plugins
|
|
511
|
+
await cesdk.addPlugin(new BlurAssetSource());
|
|
512
|
+
await cesdk.addPlugin(new ColorPaletteAssetSource());
|
|
513
|
+
await cesdk.addPlugin(new CropPresetsAssetSource());
|
|
514
|
+
await cesdk.addPlugin(
|
|
515
|
+
new UploadAssetSources({ include: ['ly.img.image.upload'] })
|
|
516
|
+
);
|
|
517
|
+
await cesdk.addPlugin(
|
|
518
|
+
new DemoAssetSources({
|
|
519
|
+
include: [
|
|
520
|
+
'ly.img.templates.blank.*',
|
|
521
|
+
'ly.img.templates.presentation.*',
|
|
522
|
+
'ly.img.templates.print.*',
|
|
523
|
+
'ly.img.templates.social.*',
|
|
524
|
+
'ly.img.image.*'
|
|
525
|
+
]
|
|
526
|
+
})
|
|
527
|
+
);
|
|
528
|
+
await cesdk.addPlugin(new EffectsAssetSource());
|
|
529
|
+
await cesdk.addPlugin(new FiltersAssetSource());
|
|
530
|
+
await cesdk.addPlugin(new PagePresetsAssetSource());
|
|
531
|
+
await cesdk.addPlugin(new StickerAssetSource());
|
|
532
|
+
await cesdk.addPlugin(new TextAssetSource());
|
|
533
|
+
await cesdk.addPlugin(new TextComponentAssetSource());
|
|
534
|
+
await cesdk.addPlugin(new TypefaceAssetSource());
|
|
535
|
+
await cesdk.addPlugin(new VectorShapeAssetSource());
|
|
536
|
+
|
|
537
|
+
// Register Google Fonts before parsing PSD files for best font matching
|
|
538
|
+
await addGfontsAssetLibrary(engine);
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
Call this function on the engine before parsing PSD files. The importer attempts to match fonts from the PSD with available Google Fonts. For fonts not found, the importer uses a fallback font.
|
|
542
|
+
|
|
543
|
+
## Checking Import Warnings
|
|
544
|
+
|
|
545
|
+
Display warnings from the import result to inform users about unsupported features. Filter the logger messages and show appropriate notifications:
|
|
546
|
+
|
|
547
|
+
```typescript highlight=highlight-check-warnings
|
|
548
|
+
// Check for import warnings and errors
|
|
549
|
+
const messages = result.logger.getMessages();
|
|
550
|
+
const warnings = messages.filter((m) => m.type === 'warning');
|
|
551
|
+
const errors = messages.filter((m) => m.type === 'error');
|
|
552
|
+
|
|
553
|
+
if (errors.length > 0) {
|
|
554
|
+
console.error('Import errors:', errors);
|
|
555
|
+
}
|
|
556
|
+
if (warnings.length > 0) {
|
|
557
|
+
console.warn(
|
|
558
|
+
'Import warnings:',
|
|
559
|
+
warnings.map((w) => w.message)
|
|
560
|
+
);
|
|
561
|
+
}
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
Common warnings include unsupported blend modes, font substitutions, and features that couldn't be converted. Errors indicate critical issues that prevented parts of the PSD from being imported.
|
|
565
|
+
|
|
566
|
+
## Adding a File Upload Button
|
|
567
|
+
|
|
568
|
+
Add a custom button to the navigation bar that allows users to upload and import PSD files directly. The button uses `cesdk.utils.loadFile()` to open the file picker and immediately imports the selected file:
|
|
569
|
+
|
|
570
|
+
```typescript highlight=highlight-file-upload
|
|
571
|
+
// Add a custom nav bar button for uploading and importing PSD files
|
|
572
|
+
// Uses cesdk.utils.loadFile() to open the browser's file picker
|
|
573
|
+
cesdk.ui.registerComponent('psd.uploadButton', ({ builder }) => {
|
|
574
|
+
builder.Button('psd.uploadButton', {
|
|
575
|
+
label: 'Load PSD File',
|
|
576
|
+
icon: '@imgly/Upload',
|
|
577
|
+
variant: 'regular',
|
|
578
|
+
color: 'accent',
|
|
579
|
+
onClick: async () => {
|
|
580
|
+
const buffer = await cesdk.utils.loadFile({
|
|
581
|
+
accept: '.psd,application/x-photoshop,image/vnd.adobe.photoshop',
|
|
582
|
+
returnType: 'arrayBuffer'
|
|
583
|
+
});
|
|
584
|
+
await importPsd(buffer, 'uploaded.psd');
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
});
|
|
588
|
+
|
|
589
|
+
// Add the upload button to the right side of the navigation bar
|
|
590
|
+
cesdk.ui.setComponentOrder({ in: 'ly.img.navigation.bar' }, [
|
|
591
|
+
...cesdk.ui.getComponentOrder({ in: 'ly.img.navigation.bar' }),
|
|
592
|
+
'psd.uploadButton'
|
|
593
|
+
]);
|
|
594
|
+
|
|
595
|
+
// Open the PSD Templates library by default
|
|
596
|
+
cesdk.ui.openPanel('//ly.img.panel/assetLibrary', {
|
|
597
|
+
payload: {
|
|
598
|
+
entries: ['psd-library-entry'],
|
|
599
|
+
title: 'PSD Templates'
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
This registers a custom button component that uses `cesdk.utils.loadFile()` to handle file selection. When clicked, the button opens the system file picker, reads the selected file as an ArrayBuffer, and passes it directly to the PSD parser for immediate import into the editor.
|
|
605
|
+
|
|
606
|
+
## Parsing the PSD File
|
|
607
|
+
|
|
608
|
+
Use `PSDParser.fromFile()` with `createWebEncodeBufferToPNG()` for browser environments. After parsing, the scene is immediately available in the engine:
|
|
609
|
+
|
|
610
|
+
```typescript highlight=highlight-parse-psd
|
|
611
|
+
// Get buffer from URL or use directly
|
|
612
|
+
let buffer: ArrayBuffer;
|
|
613
|
+
if (typeof source === 'string') {
|
|
614
|
+
const response = await fetch(source);
|
|
615
|
+
buffer = await response.arrayBuffer();
|
|
616
|
+
} else {
|
|
617
|
+
buffer = source;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
// Parse the PSD file using the PSD importer
|
|
621
|
+
// The addGfontsAssetLibrary() call above enables automatic font matching
|
|
622
|
+
// For custom font mapping, pass fontResolver in options (see customFontResolver example)
|
|
623
|
+
const parser = await PSDParser.fromFile(
|
|
624
|
+
engine,
|
|
625
|
+
buffer,
|
|
626
|
+
createWebEncodeBufferToPNG(),
|
|
627
|
+
{ fontResolver: customFontResolver }
|
|
628
|
+
);
|
|
629
|
+
const result = await parser.parse();
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
The parser creates a new scene in the engine with all supported PSD elements converted to CE.SDK blocks. The result object contains a logger with messages about the import process.
|
|
633
|
+
|
|
634
|
+
## Saving as Archive
|
|
635
|
+
|
|
636
|
+
After parsing, save the imported scene as an archive. This creates a portable bundle containing the scene and all its assets:
|
|
637
|
+
|
|
638
|
+
```typescript highlight=highlight-save-archive
|
|
639
|
+
// Save the imported scene as an archive for editor loading
|
|
640
|
+
const sceneArchive = await engine.scene.saveToArchive();
|
|
641
|
+
const archiveUrl = URL.createObjectURL(sceneArchive);
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
Archives can be stored, shared, or loaded later using `loadFromArchiveURL()`.
|
|
645
|
+
|
|
646
|
+
## Saving Scenes with Stable URLs
|
|
647
|
+
|
|
648
|
+
By default, the PSD importer creates internal `buffer://` URLs for imported images. These are transient resources that work well when saving to an archive (`engine.scene.saveToArchive()`), which bundles all assets together.
|
|
649
|
+
|
|
650
|
+
However, if you want to save scenes as JSON strings (`engine.scene.saveToString()`) with stable, permanent URLs (e.g., for storing in a database or referencing CDN-hosted assets), you need to relocate the transient resources first.
|
|
651
|
+
|
|
652
|
+
### Why Relocate?
|
|
653
|
+
|
|
654
|
+
- **Scene Archives** (`saveToArchive`): Include all assets in a single ZIP file. Transient `buffer://` URLs work fine.
|
|
655
|
+
- **Scene Strings** (`saveToString`): Only contain references to assets. Transient URLs won't work when reloading the scene later. You need permanent URLs (e.g., `https://`).
|
|
656
|
+
|
|
657
|
+
### How to Relocate Transient Resources
|
|
658
|
+
|
|
659
|
+
After parsing the PSD file, use CE.SDK's native APIs to find and relocate all transient resources:
|
|
660
|
+
|
|
661
|
+
```typescript highlight=highlight-stable-urls
|
|
662
|
+
// Optional: Save scene as JSON string with stable URLs instead of archive
|
|
663
|
+
// This is useful when storing scenes in a database or referencing CDN-hosted assets
|
|
664
|
+
// By default, PSD images use transient buffer:// URLs that only work with saveToArchive()
|
|
665
|
+
// To use saveToString(), relocate transient resources to permanent URLs first:
|
|
666
|
+
|
|
667
|
+
// Mock upload function - replace with your actual backend upload logic
|
|
668
|
+
const uploadToBackend = async (data: Uint8Array): Promise<string> => {
|
|
669
|
+
// In production, upload the data to your CDN/storage and return the permanent URL
|
|
670
|
+
// For this example, we create a blob URL to demonstrate the workflow
|
|
671
|
+
const blob = new Blob([new Uint8Array(data)], { type: 'image/png' });
|
|
672
|
+
return URL.createObjectURL(blob);
|
|
673
|
+
};
|
|
674
|
+
|
|
675
|
+
const transientResources = engine.editor.findAllTransientResources();
|
|
676
|
+
for (const resource of transientResources) {
|
|
677
|
+
const { URL: bufferUri, size } = resource;
|
|
678
|
+
const data = engine.editor.getBufferData(bufferUri, 0, size);
|
|
679
|
+
const permanentUrl = await uploadToBackend(data);
|
|
680
|
+
engine.editor.relocateResource(bufferUri, permanentUrl);
|
|
681
|
+
}
|
|
682
|
+
const sceneString = await engine.scene.saveToString();
|
|
683
|
+
console.log(`Scene persisted with stable URLs (${sceneString.length} bytes)`);
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
The relocation workflow:
|
|
687
|
+
|
|
688
|
+
1. Find all transient resources using `engine.editor.findAllTransientResources()`
|
|
689
|
+
2. Extract binary data for each resource using `engine.editor.getBufferData()`
|
|
690
|
+
3. Upload the data to your backend or CDN
|
|
691
|
+
4. Relocate the resource URL using `engine.editor.relocateResource()`
|
|
692
|
+
5. Save to string with `engine.scene.saveToString()` - all URLs will now be permanent
|
|
693
|
+
|
|
694
|
+
### Note on Font URLs
|
|
695
|
+
|
|
696
|
+
When using the default font resolver with Google Fonts, the resulting scene string will contain Google CDN URLs for fonts. If you need fonts hosted on your own infrastructure, configure a custom font resolver instead of using the default Google Fonts integration.
|
|
697
|
+
|
|
698
|
+
## Loading into the Editor
|
|
699
|
+
|
|
700
|
+
Load the archived scene into the CE.SDK editor for user editing:
|
|
701
|
+
|
|
702
|
+
```typescript highlight=highlight-load-editor
|
|
703
|
+
// Load the archived scene into the editor
|
|
704
|
+
await cesdk.engine.scene.loadFromArchiveURL(archiveUrl);
|
|
705
|
+
|
|
706
|
+
// Verify scene loaded correctly
|
|
707
|
+
const pages = engine.scene.getPages();
|
|
708
|
+
console.log(`PSD imported successfully with ${pages.length} page(s)`);
|
|
709
|
+
|
|
710
|
+
// Zoom to fit the imported page
|
|
711
|
+
await cesdk.actions.run('zoom.toPage', { page: 'first', autoFit: true });
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
After loading, verify the scene contains at least one page. The imported design is now ready for editing in the CE.SDK editor.
|
|
715
|
+
|
|
716
|
+
## Creating a PSD Template Library
|
|
717
|
+
|
|
718
|
+
Add a custom asset source that provides PSD templates users can select from a library panel. This allows users to browse and apply pre-defined PSD designs directly from the editor UI:
|
|
719
|
+
|
|
720
|
+
```typescript highlight=highlight-asset-source
|
|
721
|
+
// Add custom asset source for PSD templates
|
|
722
|
+
engine.asset.addSource({
|
|
723
|
+
id: PSD_SOURCE_ID,
|
|
724
|
+
|
|
725
|
+
async findAssets(
|
|
726
|
+
queryData: AssetQueryData
|
|
727
|
+
): Promise<AssetsQueryResult<AssetResult>> {
|
|
728
|
+
let assets = SAMPLE_PSD_FILES;
|
|
729
|
+
|
|
730
|
+
// Filter by query if provided
|
|
731
|
+
if (queryData.query) {
|
|
732
|
+
const query = queryData.query.toLowerCase();
|
|
733
|
+
assets = assets.filter(
|
|
734
|
+
(a) =>
|
|
735
|
+
a.label?.toLowerCase().includes(query) ||
|
|
736
|
+
a.tags?.some((t) => t.toLowerCase().includes(query))
|
|
737
|
+
);
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
return {
|
|
741
|
+
assets,
|
|
742
|
+
total: assets.length,
|
|
743
|
+
currentPage: queryData.page,
|
|
744
|
+
nextPage: undefined
|
|
745
|
+
};
|
|
746
|
+
},
|
|
747
|
+
|
|
748
|
+
async applyAsset(asset: AssetResult): Promise<number | undefined> {
|
|
749
|
+
if (!asset.meta?.uri) {
|
|
750
|
+
console.error('Asset has no URI');
|
|
751
|
+
return undefined;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
await importPsd(asset.meta.uri as string, asset.label || asset.id);
|
|
755
|
+
return undefined; // Scene replaced, no new block created
|
|
756
|
+
}
|
|
757
|
+
});
|
|
758
|
+
```
|
|
759
|
+
|
|
760
|
+
The asset source implements `findAssets()` to return a list of available PSD templates with thumbnails, and `applyAsset()` to import the selected PSD when users click on a template. The imported scene replaces the current editor content.
|
|
761
|
+
|
|
762
|
+
## Custom Font Resolution
|
|
763
|
+
|
|
764
|
+
For advanced use cases, create a custom font resolver to control how PSD fonts map to available typefaces. This is useful when you need to:
|
|
765
|
+
|
|
766
|
+
- **Map proprietary fonts** - Replace Photoshop fonts with specific alternatives (e.g., Arial to Open Sans)
|
|
767
|
+
- **Use enterprise fonts** - Integrate with custom font libraries or brand-specific typefaces
|
|
768
|
+
- **Implement fallback logic** - Define priority-based font matching with graceful degradation
|
|
769
|
+
- **Validate fonts** - Ensure only approved fonts are used in imported designs
|
|
770
|
+
|
|
771
|
+
```typescript highlight=highlight-custom-font-resolver
|
|
772
|
+
// Optional: Create a custom font resolver for advanced font mapping
|
|
773
|
+
// Use this when you need to map Photoshop fonts to specific alternatives,
|
|
774
|
+
// use enterprise fonts, or implement custom fallback logic
|
|
775
|
+
const customFontResolver: TypefaceResolver = async (fontParams, eng) => {
|
|
776
|
+
const { family, style, weight } = fontParams;
|
|
777
|
+
|
|
778
|
+
// Define font mappings from Photoshop fonts to available alternatives
|
|
779
|
+
const fontMappings: Record<string, string> = {
|
|
780
|
+
Arial: 'Open Sans',
|
|
781
|
+
Helvetica: 'Inter',
|
|
782
|
+
'Helvetica Neue': 'Inter',
|
|
783
|
+
'Times New Roman': 'Lora',
|
|
784
|
+
Georgia: 'Merriweather'
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
// Use mapped font or original family name
|
|
788
|
+
const targetFamily = fontMappings[family] || family;
|
|
789
|
+
|
|
790
|
+
// Search for the font in available typefaces
|
|
791
|
+
const result = await eng.asset.findAssets('ly.img.typeface', {
|
|
792
|
+
query: targetFamily,
|
|
793
|
+
page: 0,
|
|
794
|
+
perPage: 10
|
|
795
|
+
});
|
|
796
|
+
|
|
797
|
+
if (result.assets.length === 0) {
|
|
798
|
+
console.warn(`Font "${family}" not found, using default fallback`);
|
|
799
|
+
return null; // Let the parser use its default fallback
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
// Get the typeface from the asset payload
|
|
803
|
+
const asset = result.assets[0];
|
|
804
|
+
const typeface = asset.payload?.typeface;
|
|
805
|
+
if (!typeface) return null;
|
|
806
|
+
|
|
807
|
+
// Find the best matching font variant (weight and style)
|
|
808
|
+
const matchingFont =
|
|
809
|
+
typeface.fonts.find(
|
|
810
|
+
(f: { weight?: string; style?: string }) =>
|
|
811
|
+
f.weight === weight && f.style === style
|
|
812
|
+
) ||
|
|
813
|
+
typeface.fonts.find((f: { weight?: string }) => f.weight === weight) ||
|
|
814
|
+
typeface.fonts[0];
|
|
815
|
+
|
|
816
|
+
return { typeface, font: matchingFont };
|
|
817
|
+
};
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
The font resolver receives font parameters (family, style, weight) from each text element in the PSD and returns a matching typeface and font from your available assets. Return `null` to let the parser use its default fallback behavior.
|
|
821
|
+
|
|
822
|
+
Pass the custom resolver to `PSDParser.fromFile()` via the options parameter. When both `addGfontsAssetLibrary()` and a custom resolver are used, the custom resolver takes precedence for font matching decisions.
|
|
823
|
+
|
|
824
|
+
## API Reference
|
|
825
|
+
|
|
826
|
+
The `@imgly/psd-importer` package exports the following key APIs:
|
|
827
|
+
|
|
828
|
+
| API | Description |
|
|
829
|
+
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
|
|
830
|
+
| `PSDParser.fromFile(engine, buffer, encoder, options?)` | Creates a parser instance from a PSD file buffer. Returns a parser with a `parse()` method. |
|
|
831
|
+
| `createWebEncodeBufferToPNG()` | Creates a PNG encoder for browser environments using the Canvas API. |
|
|
832
|
+
| `addGfontsAssetLibrary(engine)` | Registers Google Fonts as a font source for text element matching. Call before parsing. |
|
|
833
|
+
| `TypefaceResolver` | Type for custom font resolver functions. Receives font parameters and returns a matching typeface/font pair. |
|
|
834
|
+
| `options.fontResolver` | `TypefaceResolver` - Custom function to resolve fonts from the PSD to available typefaces. |
|
|
835
|
+
| `result.logger.getMessages()` | Returns an array of import messages with `type` ('warning' or 'error') and `message` properties. |
|
|
836
|
+
|
|
837
|
+
## Limitations
|
|
838
|
+
|
|
839
|
+
The PSD importer has the following limitations:
|
|
840
|
+
|
|
841
|
+
- **Groups** - Limited support, especially for single-member groups
|
|
842
|
+
- **Text** - No multiple font sizes or families within a single text layer; no text justification
|
|
843
|
+
- **Images** - Image cropping not supported
|
|
844
|
+
- **Fills** - Gradient fills not supported (solid colors only)
|
|
845
|
+
- **Blend modes** - PassThrough, Dissolve, LinearBurn, DarkerColor, LinearDodge, LighterColor, VividLight, LinearLight, PinLight, HardMix, Subtract, Divide not supported
|
|
846
|
+
- **Advanced text** - Kerning, ligatures, strikethrough, underline, baseline shift not fully supported
|
|
847
|
+
|
|
848
|
+
## Troubleshooting
|
|
849
|
+
|
|
850
|
+
**Import fails silently:** Check the logger messages for errors using `result.logger.getMessages()`.
|
|
851
|
+
|
|
852
|
+
**Text appears with wrong font:** Ensure `addGfontsAssetLibrary()` is called before parsing. Verify the font exists in Google Fonts. If not available, a fallback font is used.
|
|
853
|
+
|
|
854
|
+
**Missing layers:** Some layer types or blend modes may not be supported. Check the import warnings for details about which layers couldn't be converted.
|
|
855
|
+
|
|
856
|
+
**Large file handling:** Files over 900MB may encounter memory constraints. The importer gracefully skips problematic elements and continues with the rest of the file.
|
|
857
|
+
|
|
858
|
+
---
|
|
859
|
+
|
|
860
|
+
## More Resources
|
|
861
|
+
|
|
862
|
+
- **[Vanilla JS/TS Documentation Index](https://img.ly/docs/cesdk/js.md)** - Browse all Vanilla JS/TS documentation
|
|
863
|
+
- **[Complete Documentation](./llms-full.txt.md)** - Full documentation in one file (for LLMs)
|
|
864
|
+
- **[Web Documentation](./js.md)** - Interactive documentation with examples
|
|
865
|
+
- **[Support](mailto:support@img.ly)** - Contact IMG.LY support
|