@profoundry-us/loco_motion 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +105 -38
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,8 +43,10 @@ your solution is aligned with our goals.
|
|
|
43
43
|
- [Install](#install)
|
|
44
44
|
- [Using Components](#using-components)
|
|
45
45
|
- [Setting a Base Component Class](#setting-a-base-component-class)
|
|
46
|
-
- [
|
|
47
|
-
- [
|
|
46
|
+
- [Developing](#developing)
|
|
47
|
+
- [Tooling](#tooling)
|
|
48
|
+
- [TODO / Next Steps](#todo--next-steps)
|
|
49
|
+
|
|
48
50
|
|
|
49
51
|
## About
|
|
50
52
|
|
|
@@ -682,16 +684,21 @@ Add the following to your `Gemfile` and re-run `bundle`:
|
|
|
682
684
|
gem "loco_motion", github: "profoundry-us/loco_motion", branch: "main"
|
|
683
685
|
```
|
|
684
686
|
|
|
685
|
-
Next add the following
|
|
686
|
-
`tailwind.config.js`
|
|
687
|
-
you install):
|
|
687
|
+
Next add the following lines to the `contents` section of your
|
|
688
|
+
`tailwind.config.js` to import / build the proper files:
|
|
688
689
|
|
|
689
690
|
```js
|
|
690
|
-
|
|
691
|
-
`${process.env.GEM_HOME}/loco_motion-0.0.4/app/components/**/*.{rb,js,html.haml}`,
|
|
691
|
+
const { execSync } = require('child_process');
|
|
692
692
|
|
|
693
|
-
|
|
694
|
-
|
|
693
|
+
let locoBundlePath = execSync('bundle show loco_motion').toString().trim();
|
|
694
|
+
|
|
695
|
+
module.exports = {
|
|
696
|
+
content:[
|
|
697
|
+
`${locoBundlePath}/app/components/**/*.{rb,js,html.haml}`,
|
|
698
|
+
|
|
699
|
+
// ...
|
|
700
|
+
]
|
|
701
|
+
}
|
|
695
702
|
```
|
|
696
703
|
|
|
697
704
|
> [!WARNING]
|
|
@@ -699,6 +706,35 @@ you install):
|
|
|
699
706
|
> directory, so your CSS may stop working if you update the gem and forget to
|
|
700
707
|
> update this setting.
|
|
701
708
|
|
|
709
|
+
Next, if you're using any of the components that require JavaScript (like the
|
|
710
|
+
Countdown component), you'll need to add the library as a dependency and include
|
|
711
|
+
those controllers in your `application.js` file.
|
|
712
|
+
|
|
713
|
+
```sh
|
|
714
|
+
npm add @profoundry-us/loco_motion
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
or
|
|
718
|
+
|
|
719
|
+
```sh
|
|
720
|
+
yarn add @profoundry-us/loco_motion
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
Then inside your `application.js` file, make sure to import and register the
|
|
724
|
+
relevant controllers.
|
|
725
|
+
|
|
726
|
+
```js
|
|
727
|
+
import { Application } from "@hotwired/stimulus"
|
|
728
|
+
|
|
729
|
+
import { CountdownController } from "@profoundry-us/loco_motion"
|
|
730
|
+
|
|
731
|
+
const application = Application.start()
|
|
732
|
+
|
|
733
|
+
application.register("countdown", CountdownController)
|
|
734
|
+
|
|
735
|
+
export { application }
|
|
736
|
+
```
|
|
737
|
+
|
|
702
738
|
### Using Components
|
|
703
739
|
|
|
704
740
|
Back in the `app/layouts/application.html.haml` file, replace the `body` with
|
|
@@ -707,24 +743,20 @@ the following code and refresh your page.
|
|
|
707
743
|
```haml
|
|
708
744
|
%body
|
|
709
745
|
.m-2.p-2.rounded.bg-red-400
|
|
710
|
-
=
|
|
711
|
-
|
|
712
|
-
.btn
|
|
713
|
-
= LocoMotion.hello_world
|
|
746
|
+
= session[:user_info].inspect
|
|
714
747
|
|
|
715
748
|
%div
|
|
716
|
-
= render(
|
|
749
|
+
= render(Daisy::Actions::ButtonComponent.new(title: "Click Me"))
|
|
717
750
|
|
|
718
751
|
%div
|
|
719
|
-
=
|
|
752
|
+
= daisy_button(css: "btn-primary") do
|
|
753
|
+
Click Me Too
|
|
720
754
|
|
|
721
|
-
|
|
722
|
-
= session[:user_info].inspect
|
|
755
|
+
= yield
|
|
723
756
|
```
|
|
724
757
|
|
|
725
|
-
You should see a
|
|
726
|
-
|
|
727
|
-
example Button and Fab components.
|
|
758
|
+
You should see a few buttons and the user info that we saved from OmniAuth
|
|
759
|
+
represented as a Ruby hash! Any other content you have will be rendered below.
|
|
728
760
|
|
|
729
761
|
### Setting a Base Component Class
|
|
730
762
|
|
|
@@ -764,7 +796,39 @@ end
|
|
|
764
796
|
> you want, so you could create a separate `CustomizedLocoMotionComponent` class
|
|
765
797
|
> so that you don't have any conflicts with your `ApplicationComponent`.
|
|
766
798
|
|
|
767
|
-
##
|
|
799
|
+
## Developing
|
|
800
|
+
|
|
801
|
+
To work on LocoMotion, first clone the repository and make sure you have Docker
|
|
802
|
+
installed and running on your machine.
|
|
803
|
+
|
|
804
|
+
You should then be able to run `make rebuild` in the project directory and then
|
|
805
|
+
`make all-quick` to start the services.
|
|
806
|
+
|
|
807
|
+
> [!NOTE]
|
|
808
|
+
>
|
|
809
|
+
> We use `npm link` within the `docs/demo/bin/dev` script to enable quick
|
|
810
|
+
> editing of the JavaScript library files so you don't have to publish a new
|
|
811
|
+
> package during testing.
|
|
812
|
+
|
|
813
|
+
From here, you can access the demo site at http://localhost:3000 and the YARD
|
|
814
|
+
docs at http://localhost:8808/docs/yard
|
|
815
|
+
|
|
816
|
+
You can type `make demo-shell` to open a shell inside the demo Docker container,
|
|
817
|
+
or `make loco-shell` to get a shell inside the gem's Docker container.
|
|
818
|
+
|
|
819
|
+
See the `Makefile` for all available commands.
|
|
820
|
+
|
|
821
|
+
> [!WARNING]
|
|
822
|
+
>
|
|
823
|
+
> Right now, Rails doesn't auto-reload the LocoMotion library files when they
|
|
824
|
+
> change, so you might have to restart your server to get it to pickup the
|
|
825
|
+
> changes.
|
|
826
|
+
>
|
|
827
|
+
> ```sh
|
|
828
|
+
> make demo-restart
|
|
829
|
+
> ```
|
|
830
|
+
|
|
831
|
+
### Tooling
|
|
768
832
|
|
|
769
833
|
For VSCode, you may want to add the following to your settings to get
|
|
770
834
|
TailwindCSS Intellisense working properly.
|
|
@@ -786,24 +850,27 @@ TailwindCSS Intellisense working properly.
|
|
|
786
850
|
],
|
|
787
851
|
```
|
|
788
852
|
|
|
789
|
-
## Next Steps
|
|
853
|
+
## TODO / Next Steps
|
|
790
854
|
|
|
791
|
-
|
|
792
|
-
|
|
855
|
+
There is a LOT left to be done. We're not currently seeking assistance, but if
|
|
856
|
+
you feel very strongly that you'd like to contribute, please reach out through
|
|
857
|
+
the GitHub Discussions feature and let us know!
|
|
793
858
|
|
|
859
|
+
- [x] Basic versions of DaisyUI Actions
|
|
860
|
+
- [x] Basic versions of DaisyUI Data Display
|
|
861
|
+
- [x] Basic versions of DaisyUI Navigation
|
|
862
|
+
- [ ] Basic versions of DaisyUI Feedback
|
|
863
|
+
- [ ] Basic versions of DaisyUI Data Input
|
|
864
|
+
- [ ] Basic versions of DaisyUI Layout
|
|
865
|
+
- [ ] Basic versions of DaisyUI Mockup
|
|
794
866
|
- [ ] Get YARD docs rendering with (better) Markdown
|
|
795
867
|
- [x] Extract relevant pieces into a yard-loco_motion plugin
|
|
796
|
-
- [ ] Publish Gem
|
|
797
|
-
- [
|
|
798
|
-
- [ ]
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
more easily do development on the various parts without having to re-run `yarn`
|
|
806
|
-
every time.
|
|
807
|
-
|
|
808
|
-
Also may need to run `yarn` on the top level directory. Maybe we can move this
|
|
809
|
-
into the Docker install / setup?
|
|
868
|
+
- [ ] Publish Gem
|
|
869
|
+
- [x] Publish NPM package
|
|
870
|
+
- [ ] Update YARD plugin to add `@part`s
|
|
871
|
+
- [x] Extract doc callouts into a doc component (and / or the Daisy component)
|
|
872
|
+
- [ ] Choose and recommend / document a pagination gem
|
|
873
|
+
- [ ] Discuss caching techniques / setup
|
|
874
|
+
- [ ] Create / publish a production version of the demo site
|
|
875
|
+
- [ ] Create / publish a production version of the docs site
|
|
876
|
+
- [ ] Update demo site to allow for a different docs site using ENV var
|