Skip to content

Rebuilding Sandcastle: Technical Implementation #12566

@jjspace

Description

@jjspace

This issue will track the technical implementation of a new version of Sandcastle for CesiumJS. Design and features will primarily be worked out and discussed elsewhere. If you want to provide feedback on features you'd like to see please add them to our post on the community forum

High level plan

We plan to create a new workspace/package within our mono-repo to keep the new Sandcastle project separated but co-located with CesiumJS.

  • itwin-ui: We expect to use the newest version of iTwin/Bentley UI library for both components and styling as much as possible. We may contribute improvements or components back to it as necessary.
  • React: This is a given if we want to make use of iTwinUI.
  • Monaco: We'll want to balance robust feature set with usability for users who prefer a more minimal code editing experience. This should greatly increase the DX of the editor bringing familiarity for any already used to using VSCode
  • TypeScript: Unless there is a reason not to. This will be isolated to it's own package so it's separate from the rest of CesiumJS
  • Build tools: We'll likely get started with the Vite plugin for react, and if needed we can use esbuild like the CesiumJS library itself

As we build out the new version we plan to have a beta/dev deployment for people to test against. More info on this as build systems and CI get set up

Running task list

I will try to keep this updated going forward as the "source of truth" for both large and small tasks that are remaining

  • re-evaluate gallery search (PageFind?) New Gallery search for sandcastle #12755
  • re-evaluate gallery system management
  • Code formatting command (added in Enable prettier formatter in monaco #12640)
  • Integrate code generation "helpers" like "Add button" or "Add menu"
  • Set up deployment to dev environment Sandcastle dev deployment #12680
  • Finalize page title
    • Currently has a temporary port number or CI, probably should include the sandcastle title if set? Possibly should include a hint at the environment that's running
    • Use title of loaded gallery demo for now, drop CI to "hide" it
  • Figure out how to display the version of CesiumJS and Sandcastle itself
    • Cesium version in top right seems nice so far, sandcastle version could be in the settings modal
  • Finalize UI and implement new structure (design work tracked separately)
  • CSS only Stratakit for inside the bucket iframe
  • Add share details modal with the share URL to copy. Feature parity with what's in the current version
    • Improvements to sharing as a whole will be a follow up task
  • Add "User settings" stored in local storage.
  • Default starting panel, gallery or editor?
    • Default to gallery unless loading a specific example id or share key
    • Dedicated URL like index.html?new
    • can we make it selectible in the settings?
  • Implement console output (started in Sandcastle using Stratakit #12731)
  • Warning for leaving the page with "unsaved" changes
  • Support loading URLs with a gist id in them for legacy urls that may still be out there
  • Expand Sandcastle API
    • Document the API itself, static page or overlay in Sandcastle?
    • Sliders are commonly needed
  • Highlight editor lines for running sandcastle code and errors
  • Re-implement "new" detection for the gallery after the first release otherwise they will all show as new
    • Previously based on git diff, see comment
    • Maybe instead have a "addedIn" value in the sandcastle metadata instead of diff
  • Monitor/update build system as needed (this is close but may still need a few adjustments)
    • Ensure we have a system for building against an arbitrary gallery location
    • Consider if vite is necessary or we'd be better off with esbuild directly
      • Verify how we're "building" cesium into the build, maybe we can point at a different path instead of copying built files.
    • Document and solidify build process from the repo root (related: comment)
    • finalize eslint config for new package files. First time TS and React is in there
  • Content pass on all sandcastles
    • We may be able to cull a bunch of them. Others may need broken apart into multiple smaller ones
      • Specifically many of the ones under the development directory seem to be old versions or duplicates of others we have and don't need anymore
    • Re-evaluate labels and consider actual categories
    • Remove Viewerless sandcastle if we deem it's not necessary anymore
PRs for this effort

Follow up tasks

A list of ideas we've had that could benefit Sandcastle but will not be considered part of the initial re-build effort

  • An "embed" version of Sandcastle like CodePen or JSFiddle have that we can use in our documentation. Minimal editor + viewer
  • Full Documentation integration
    • The better intellisense helps a lot but currently don't have a way to open the docs fully like before. Maybe we just recommend a second tab to people?
  • Allow loading multiple CesiumJS versions
  • Expand Gist/Github integrations - re: saving, sharing, commenting, collaborating
  • Can we remove knockout dependency in all sandcastles? it may lead to users depending on it
  • "Value monitor" type helper we can add to avoid spamming thousands of lines when wanting to track something that changes every frame for the console
  • Implement console.debug mirroring (I think this is the only one missing that we'd want to implement other than group and trace)
  • Expand share capabilities, what is saved, what is shared, how do things get shared
    • Is there an alternative "download" we can offer with the files that can be "dropped" back into sandcastle
    • Consider a "one click" option to switch between prod and local environment (maybe only if we detect the local server?)
  • Save previous "successful" runs of a sandcastle to recover from crashes

CC @ggetz

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions