blocks Svelte Themes

Blocks

safe+serializable layout+content blocks with Svelte

spiderspace: blocks

safe+serializable layout+content blocks with Svelte

work in progress: experimental

πŸ•ΈοΈ πŸ™πŸ± πŸ§ͺ
spiderspace.github.io/blocks spiderspace/blocks Svelte; safe&serializable layout&content blocks
spiderspace.github.io/about spiderspace/about Svelte+iconify; spiderspace is web prototypes
spiderspace.github.io/mutable spiderspace/mutable Svelte; mutable store values w/ immutable on

goals

  • introduce and explain Spiderspace
  • deploy Spiderspace and its repos to static GitHub Pages websites so it's fork-friendly
  • in this repo, create patterns, components, and helpers around a serializable block data structure that renders as Svelte components for layout and content, that works well with a structured editor, and that can be safely used from untrusted sources

motivation

Spiderspace is a bunch of prototypes using a particular web software toolkit: Svelte, SvelteKit, and more. See the table above for the currently active repos.

If you find yourself intrigued by any particular prototype, visit the discussions here on spiderspace/blocks and the issues in the appropriate repos. You're also invited to propose more prototypes!

Spiderspace does not publish to any package registries. The projects here are meant to be extracted and published to registries by anyone who wishes, which could include you! The source code is all public domain so you may use it however you wish. (and also, note that any contributions you make will be licensed the same)

This repo's prototype explores data-driven rich text authoring and UI creation using the same data structure and rendering patterns. The goal is to support users authoring and sharing untrusted rich content and dynamic end-user-programmable UI in a structured editing WYSIWYG-like environment. Share your thoughts in the GitHub discussions!

design

The goal of this prototype is to create patterns, components, and helpers around a serializable block data structure that renders as Svelte components for layout and content.

  • create layouts, spaces, and documents with a serializable JSON data structure that's safe to share with strangers
    • currently simpler than Svelte AST, though this is going to change to use SVAST
    • safe to share (e.g. sanitized style attributes and allowlisted domains when loading any URLs)
    • support both text input as well as structured editing (so the canonical representation is likely a JSON AST)
    • should it include dynamic data loading, like what JSON-LD provides with Activity Streams?
    • is Block the preferred word?

innards

very much a work in progress

  • πŸ“ src
    • πŸ“ lib β€” SvelteKit $lib directory
      • πŸ“ app β€” modules and data specific to this app, not expected to be portable or exported
        • πŸ”· blocks.ts β€” block data for the current layouts
      • πŸ“ ui β€” generic reusable frontend things that may be upstreamed to other libraries
    • πŸ“ routes β€” SvelteKit frontend

todo

  • use zod to parse for sanitization
  • use codemirror6
  • center on SVAST instead of the current simplified Block
  • dynamic remote async data loading? at odds with SVAST? (e.g. following Activity Streams URLs)
  • component children/slots? (really creeping into AST territory...)
  • implement Fragment
  • more direct manipulation
  • views
    • 2d block view (add optional x/y properties or maybe location.x/y)
  • authoring
    • include an "add block" button in devmode
    • delete blocks
    • edit blocks
    • sort/dragndrop blocks
    • generic collection actions
  • parse per-component props, per-element attributes, and per-event params
  • security
    • allowlist domains for src and href
    • somehow put governing handles on events
  • async data resolution (JSON URIs for sharing/persistance)
  • make all blocks responsive
  • let the iframes request their layout dimensions
  • hot swap block branches?
  • sync Iframe header with navigation inside the iframe?

usage

# node >= 16.6
npm i
npm run dev
# or
gro dev # npm i -g @feltcoop/gro

build

npm run build
# or
gro build

deploy

npm run deploy
# or
gro deploy

credits 🐒🐒🐒

Svelte βˆ™ SvelteKit βˆ™ Vite βˆ™ esbuild βˆ™ uvu βˆ™ TypeScript βˆ™ Gro βˆ™ Felt βˆ™ Prettier & more

license 🐦

public domain ⚘ The Unlicense

Top categories

Loading Svelte Themes