# Shared asset preview/viewer widgets. # # The pool every host draws catalog content with: the asset UI's Create # viewer and Library preview, the VJ and DJ surfaces, the sandbox later. # Widgets here take TYPED content in (blob bytes, decoded textures, manifest # facts) and hand actions back out; they never reach into an app's state, own # an audio device, or talk to a server. # # Styling follows the widget-library pattern: every widget registers a # `set_type_default()` base, so a host restyles by overriding draw props in # its own script_mod rather than forking the code. # # Dependency policy: the WIDGET LAYER depends on the widget library plus # ZERO-DEPENDENCY leaf crates only. Not the asset-server client, not the # renderer — a preview is HANDED content, it does not go and get it. # # That is a hard constraint, not tidiness: apps/sandbox is a nested cargo # workspace that cannot depend on makepad-asset-client at all (the # nested-workspace-root refusal), and it must be able to adopt these widgets # with its own blob supply. Client-wired convenience (resolve an asset id, # stream a blob, decode it) belongs in the host or in a later optional # feature the sandbox does not enable. # # makepad-asset-data IS admitted (the sandbox already depends on it): it is # the zero-dependency contract crate, and the thumbnail widget's whole job # is to obey the ThumbnailView declarations written in it. Mirroring those # types here to dodge the dependency would be a second copy of the contract # — exactly the drift the shared crate exists to end. [package] name = "makepad-asset-widgets" version = "0.1.0" edition = "2021" [dependencies] makepad-widgets = { path = "../../../widgets" } # Two ZERO-DEPENDENCY leaf crates, which is the whole reason they are # allowed here: the sandbox can take either without dragging a workspace # along. They let a well DRAW a track — decode the bytes the host handed # over and render the same spectrogram and wave strip the importer bakes — # instead of only ever showing a picture somebody else made. makepad-audio-decode = { path = "../../audio_decode" } makepad-audio-picture = { path = "../../audio_picture" } # The content contract's data types — zero dependencies, see the policy # note above. AssetThumb interprets ThumbnailView declarations from here. makepad-asset-data = { path = "../data" } [features] # Renderer-backed faces: the mesh turntable and the autonomous world # walkthrough. OFF by default, because makepad-render is a real dependency # and `apps/sandbox` (a nested cargo workspace) must be able to adopt the # 2D faces without it. A host that wants a mesh or a world well turns it on. renderer = ["dep:makepad-render"] [dependencies.makepad-render] path = "../../render" optional = true