···11+# Design
22+33+## Architecture
44+55+Diffuse provides a set of custom (DOM) elements (aka. web components) that can be combined into a working audio player or media browser living in a web view.
66+77+88+### Components / Elements
99+1010+There are various categories of these elements, and may have subcategories. Each element lives in its own directory, containing the code, documentation and other assets associated with that element. The directory for the elements is `src/components/`, each subdirectory is a category which in turn may have one or more subcategories. If a directory has an `element.js` then that directory represents the element, not a subcategory.
1111+1212+A few examples:
1313+- `src/components/engine/audio/element.js`: Category = engine, element = audio
1414+- `src/components/output/polymorphic/indexed-db/element.js`: Category = output, subcategory = polymorphic, element = indexed-db
1515+- `src/components/transformer/output/refiner/default/element.js`: Category = transformer, subcategory 1 = output, subcategory 2 = refiner, element = default
1616+1717+Most categories of components are independent, they do not rely on other components. There are a few exceptions:
1818+1919+- The category named 'orchestrator'. These are compositions of other components, meaning they consume other components. These have attributes ending with `-selector` which is a DOM selector that points at the component that is the dependency.
2020+- The category named 'configurator'. These take other components as DOM children with the same actions/methods as the configurator itself. They serve to delegate or combine.
2121+2222+2323+### Definitions
2424+2525+`src/definitions/` are lexicons, JSON schemas that describe data in the system.
2626+2727+2828+### Themes
2929+3030+Like orchestrator components, these are compositions of elements. Unlike orchestrators however, it doesn't compose by the use of selectors, instead we write the custom elements as HTML and use the DOM as the composition layer. Alternatively, custom elements can be created in Javascript and then added to the DOM from there.
3131+3232+3333+### Other directories
3434+3535+- `src/common`: Common Javascript code shared by various components and/or themes.
3636+- `src/styles`: Common CSS shared by themes, the index page or constituents (part of themes).
3737+- `src/favicons`, `src/fonts`, `src/images` are binary assets for themes and the index page (`src/index.vto`)
3838+- `src/_components` and `src/_includes` are templates used in `.vto` templates, again themes and index page.