basecoat-cli 0.1.0 → 0.2.0-beta.1

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 ADDED
@@ -0,0 +1,56 @@
1
+ # basecoat-cli
2
+
3
+ This package provides a Command Line Interface (CLI) to help you quickly scaffold [Basecoat](https://basecoatui.com) components into your project.
4
+
5
+ ## Prerequisites
6
+
7
+ - Ensure you have Node.js and npm (or your preferred package manager) installed.
8
+ - For the components to function correctly, your project should have:
9
+ - [Tailwind CSS](https://tailwindcss.com/docs/installation) installed and configured.
10
+ - The `basecoat-css` package installed and imported (or `basecoat.css` manually added).
11
+ - [Alpine.js](https://alpinejs.dev/docs/installation) installed and initialized, as Basecoat components rely on it for interactivity.
12
+
13
+ ## Usage
14
+
15
+ Use the `add` command to add components to your project:
16
+
17
+ ```bash
18
+ # npx
19
+ npx basecoat-cli add [component]
20
+
21
+ # pnpm
22
+ pnpm dlx basecoat-cli add [component]
23
+
24
+ # bun
25
+ bunx basecoat-cli add [component]
26
+
27
+ # yarn
28
+ yarn dlx basecoat-cli add [component]
29
+ ```
30
+
31
+ Replace `[component]` with the name of the component you wish to add (e.g., `dialog`, `select`) or leave it out if you want to pick from the list of available components
32
+ or install all of them at once.
33
+
34
+ The CLI will prompt you for:
35
+
36
+ 1. **Template Engine:** Choose between Nunjucks (`.njk`) or Jinja (`.html.jinja`).
37
+ 2. **Assets Directory:** The path where component assets (like JavaScript files) should be placed (e.g., `src/assets/js/components`).
38
+ 3. **Macros Directory:** The path where component macros should be placed (e.g., `src/_includes/macros/components`).
39
+
40
+ The CLI will then copy the necessary JavaScript files and Nunjucks/Jinja macros for the selected component into the specified directories.
41
+
42
+ ### Example
43
+
44
+ To add the `dialog` component:
45
+
46
+ ```bash
47
+ npx basecoat-cli add dialog
48
+ ```
49
+
50
+ ## Documentation
51
+
52
+ For more detailed information on components, their usage, and customization options, please refer to the [Basecoat documentation](https://basecoatui.com/installation/#install-cli).
53
+
54
+ ## License
55
+
56
+ [MIT](https://github.com/hunvreus/basecoat/blob/main/LICENSE.md)
@@ -75,7 +75,7 @@
75
75
  {% endfor %}
76
76
  >
77
77
  <h2 id="{{ id }}-title">{{ title | safe }}</h2>
78
- <p>{{ description | safe }}</p>
78
+ {% if description %}<p>{{ description | safe }}</p>{% endif %}
79
79
  </header>
80
80
  {% endif %}
81
81
  {% if caller %}
@@ -21,7 +21,7 @@
21
21
  x-data="dropdownMenu"
22
22
  @click.away="open = false"
23
23
  {% if id %}id="{{ id }}"{% endif %}
24
- {% for key, value in main_attrs %}
24
+ {% for key, value in main_attrs.items() %}
25
25
  {% if key != "class" %}{{ key }}="{{ value }}"{% endif %}
26
26
  {% endfor %}
27
27
  >
@@ -35,7 +35,7 @@
35
35
  id="{{ id }}-trigger"
36
36
  aria-controls="{{ id }}-menu"
37
37
  {% endif %}
38
- {% for key, value in trigger_attrs %}
38
+ {% for key, value in trigger_attrs.items() %}
39
39
  {{ key }}="{{ value }}"
40
40
  {% endfor %}
41
41
  >
@@ -47,7 +47,7 @@
47
47
  aria-hidden="true"
48
48
  x-bind="$content"
49
49
  {% if id %}id="{{ id }}-menu"{% endif %}
50
- {% for key, value in content_attrs %}
50
+ {% for key, value in content_attrs.items() %}
51
51
  {{ key }}="{{ value }}"
52
52
  {% endfor %}
53
53
  >
@@ -4,6 +4,7 @@
4
4
  @param id {string} [optional] - Unique identifier for the select component.
5
5
  @param selected {string} [optional] - The initially selected value.
6
6
  @param name {string} [optional] - The name attribute for the hidden input storing the selected value.
7
+ @param items {array} [optional] - An array of items (objects with type, label, value, attrs, and items) to render.
7
8
  @param main_attrs {object} [optional] - Additional HTML attributes for the main container div.
8
9
  @param trigger_attrs {object} [optional] - Additional HTML attributes for the trigger button.
9
10
  @param content_attrs {object} [optional] - Additional HTML attributes for the popover content div.
@@ -10,7 +10,7 @@
10
10
  {% macro toaster(
11
11
  id="toaster",
12
12
  toasts=[],
13
- main_attrs=None,
13
+ main_attrs={},
14
14
  is_fragment=False
15
15
  ) %}
16
16
  <div
@@ -21,7 +21,7 @@
21
21
  {% endfor %}
22
22
  {% if is_fragment %}hx-swap-oob="beforeend"{% endif %}
23
23
  >
24
- {% for item in toasts.items() %}
24
+ {% for item in toasts %}
25
25
  {{ toast(
26
26
  category=item.category,
27
27
  title=item.title,