elk icon indicating copy to clipboard operation
elk copied to clipboard

feat: plugin system

Open QiroNT opened this issue 2 years ago • 3 comments

This is still working in progress. Don't expect it to work, and don't suggest chores like splitting files, missing dependencies, typos for now if you don't want to wast your time. Feature suggestions are ok.

Objective

Fixes #33 Add a plugin system to Elk, allowing users to install plugins to modify their Elk client. (Plugins will never work on server for apparent reasons.) Plugins can be used to inject new or exclusive features, re-theme the site, provide integrations, etc.

Implementation State (Iteration 2)

  • [ ] plugin runtime
    • [ ] plugin loader
    • [ ] test/show compatibility against the current version of Elk
    • [ ] dependencies / communication between plugins
    • [ ] PWA module to manage plugins
  • [ ] plugin kit
    • [ ] mixins
      • [ ] .inject(loc, callback) (put a call to callback at loc)
      • [ ] .redirect(fnCallLoc, newFn) (replace the function call to call newFn instead)
      • [ ] .wrap(fnLoc, (fn) => ...) (receive the defined function and return a new one)
      • [ ] .overwrite(fnLoc, newFn) (replace function / class / variable definition)
    • [ ] SFC setup transform helpers
      • [ ] .onMounted(() => ...) (call vue hooks)
    • [ ] SFC vnode transform helpers
      • [ ] .selector('div') (select vnodes matching the CSS selector)
      • [ ] .wrap((vnode) => ...) (receive the defined vnode and return a new one)
      • [ ] .replace(vnode) (replace the vnode with a new one)
      • [ ] .remove() (remove the vnode)
      • [ ] .addBefore(h(Component)) (put a component before the vnode)
      • [ ] .setAttr('type', 'password') (set attribute / prop)
    • [ ] provide types for files in .mixin(path)
  • [ ] performance / minification
  • [ ] example plugins
    • [ ] famous-quotes for viewport injection
  • [ ] working in dev
  • [ ] working in prod

Current Issues

Plugin compatibility with the latest version of Elk is not stable, and there's no way to rollback to older versions. It could possibly be implemented through sub-domains or a built-in rollback system.

QiroNT avatar Jan 09 '23 16:01 QiroNT

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

stackblitz[bot] avatar Jan 09 '23 16:01 stackblitz[bot]

Deploy Preview for elk-docs failed.

Name Link
Latest commit 51e052f47d3eeee2e1e178f791587d7e6237b2b7
Latest deploy log https://app.netlify.com/sites/elk-docs/deploys/63c0fc919894c70008b51042

netlify[bot] avatar Jan 09 '23 16:01 netlify[bot]

Deploy Preview for elk-zone failed.

Name Link
Latest commit 51e052f47d3eeee2e1e178f791587d7e6237b2b7
Latest deploy log https://app.netlify.com/sites/elk-zone/deploys/63c0fc9114cbe20008b52188

netlify[bot] avatar Jan 09 '23 16:01 netlify[bot]