@magic
@magic-modules
magic modules are predefined modules for webapps.
module definition
the minimal module is a function that returns some html.
// /assets/ModuleName.mjs
// simplest module
export const View = () => div('hello, world')
// complete signature
export const View = (props = {}, children = []) => div('hello, world')
usage
if the npm package name starts with @magic-modules/ or magic-module-, it will get imported automagically. the name of the Module will be set to a PascalCased version of the remainder of the module name. @magic-modules/git-badges, for example, turns into GitBadges. the same is true for all uppercased files in your /assets/ directory and subdirectories. in the rare case where you want to install a npm module that can not be found, you can import it in /assets/index.mjs
// /assets/index.mjs
import NpmModule from 'non-standard-named-magic-module-from-npm'
export default {
// ...otherModules
// load module from node_modules
NpmModule,
}
after this, the module will be a global in your app and can be used like any other component.
// any page or module
export default state => div([
// module without props
Mod(),
'modules that need props: ',
Mod({ state, customProp: true }),
@magic-modules
@magic-modules/about-magic demo
AboutMagic shows some information about @magic.
@magic-modules/accordion demo
Accordion shows a list of items that horizontally open/close.
@magic-modules/cite demo
Makes Citations easy. Adds Quote around quotes and a minimally styled paragraph around the author.
@magic-modules/example-list demo
ExampleList shows a list of @magic-examples pages.
@magic-modules/gdpr demo
Gdpr compliant popup that allows users to allow or deny cookies.
@magic-modules/git-badges demo
GitBadges shows a list of github repository status badges.
@magic-modules/git-list demo
show a list of git repositories like the one you are looking at.
@magic-modules/hero demo
Hero modules are full screen top of page content.
@magic-modules/language-switch demo
LanguageSwitch provides simple multilanguage support for magic.
@magic-modules/library-list demo
LibraryList shows a list of all @magic-libraries libraries.
@magic-modules/light-box demo
images that show a bigger view of themselves when clicked.
@magic-modules/light-switch demo
dark/light theme color switch button.
@magic-modules/messages demo
Messages shows popup messages.
@magic-modules/module-list demo
ModuleList shows the list of @magic-modules you are looking at.
@magic-modules/no-spy demo
Minimal interface for "we do not spy" modal.
@magic-modules/pre demo
Pre allows you to display javascript code with syntax highlighting.
@magic-modules/quote demo
adds “” around the quote and sets font-style: italic.
@magic-modules/sound-cloud demo
embed soundcloud track, playlist and user widgets
@magic-modules/theme-list demo
ThemeList shows a list of all @magic-themes.
@magic-modules/theme-vars demo
ThemeVars shows a preview of all colors used in a @magic-themes.
@magic-modules/video-embed demo
VideoEmbed embeds videos from any video hoster.
@magic-modules/xkcd demo
Xkcd embeds xkcd comics.