Live CockpitCMS+Svelte Projects:


4. Svelte Files Explanations

Parts

Directly imported into App.svelte and nowhere else.

Since the rule is not sufficiently followed, this folder may be restructured. Also, graphical and non-graphical elements are quite mixed in it.

Head - Changes the page's , description and robots
  • Header,Footer - Always at the top / bottom of the page
  • Layout - receives an object with the page layout and breaks it down into individual components from sections
  • Loading - loading, used in {#await} blocks
  • Modal - modal iframe (replacement for lity to avoid having to import jQuery), uses "writable() store", can only be defined once, is also imported in sections as a module (should be in a different folder than Parts because of the rule) to change its content and activate it via writable
  • Theme - simple implementation for quick theme switching
  • LangSelector - currently implemented only in the header = imported outside App.svelte
  • GlobalScripts - loads external scripts using JSLoaderModule that are always available on the page (e.g. nextSection)
  • Routes

    Everything related to background navigation (slug management)

    Scripts

    All files in this folder are scripts with only context="module", i.e. they only export functions and are not graphical.

    Sections

    All values (here some main ones are listed in parentheses in simplified form) should be optional (WIP: so that the user cannot kill the Svelte process e.g. if {#each} accidentally receives null)

    admin10.png
    Sections find their use as components in CockpitCMS from which the entire page is composed via Layout.svelte

    CSS z-index index

    All elements that use z-index and their value, sorted in descending order. For easy identification of what is at which level.

    Previous: 3. Backend parts of CockpitCMS
    Next: 5. Process On Page Load