Compare commits

..

48 Commits

Author SHA1 Message Date
ab3206a82c Merge branch 'staging' into transactions2-with-staging 2026-04-03 07:51:50 -07:00
931a1aa10f merged 2026-03-30 22:40:04 -07:00
297464c188 Merge branch 'master' of codecommit://integreat 2026-03-30 22:38:34 -07:00
6e3a024f66 adds stuff for dough burger 2026-03-30 22:36:12 -07:00
Bryce
28a755e9a9 fixes invoice date filtering 2026-03-02 23:20:14 -08:00
Bryce
01347ff3f5 fixes balance sheet 2026-03-02 22:53:53 -08:00
53625e4583 Makes invoices use the closed_at date. 2026-02-21 22:53:05 -08:00
8899c643ed Complete code review session - documented findings for auto_ap.permissions, iol-ion.query, and auto_ap.ss.admin.background-jobs 2026-02-08 09:31:26 -08:00
c196723913 ok. 2026-02-08 08:43:53 -08:00
395e445c99 Add test for Bonanza Produce invoice 03882095
Validates existing template correctly parses multi-page invoice with:
- Invoice number 03882095
- Customer identifier NICK THE GREEK
- Account number 600 VISTA WAY
- Total of $946.24
2026-02-08 08:40:40 -08:00
d2b5a08519 Merge branch 'master' into clauding 2026-02-08 07:57:52 -08:00
8a0395dc4a Add Bonanza Produce multi-invoice statement template
- Added multi-invoice template for Bonanza Produce with :multi and :multi-match? flags
- Template uses keywords for statement header to identify multi-invoice format
- Extracts invoice-number, date, customer-identifier (from RETURN line), and total
- Parses 4 invoices from statement PDF 13595522.pdf
- All tests pass (29 assertions, 0 failures, 0 errors)

- Added test: parse-bonanza-produce-statement-13595522
- Updated invoice-template-creator skill: emphasized test-first approach
2026-02-08 07:56:14 -08:00
26dbde5bd3 Add invoice-template-creator skill for automated template generation
New repository-based skill at .claude/skills/invoice-template-creator/:
- SKILL.md: Complete guide for creating invoice parsing templates
- references/examples.md: Common patterns and template examples
- Covers vendor identification, regex patterns, field extraction
- Includes testing strategies and common pitfalls

Updated AGENTS.md with reference to the new skill.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-08 07:55:55 -08:00
d8b829db76 Clean up test files by removing comments 2026-02-07 08:31:52 -08:00
69c75ba124 feat(tests): Add execute-dialog and new-dialog route tests
Add 2 more route handler tests:
- execute-dialog-route-works: Tests execution dialog for rules
- new-dialog-route-returns-empty-form: Tests new rule form

Total: 17 tests with 26 assertions, all passing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-07 08:21:24 -08:00
f732ecb560 feat(tests): Add more route handler tests for transaction rules
Add 3 additional route handler tests:
- edit-dialog-route-returns-dialog: Tests edit dialog for existing rules
- account-typeahead-route-works: Tests account typeahead functionality
- location-select-route-works: Tests location selector route

Total: 15 tests with 22 assertions, all passing.

Route coverage now includes:
- page, table, delete, check-badges
- edit-dialog, account-typeahead, location-select

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-07 08:15:23 -08:00
dd60d80f03 feat(tests): Add route handler tests for transaction rules
Add 4 new tests for route handlers:
- page-route-returns-html-response: Tests main page route
- table-route-returns-table-data: Tests HTMX table data route
- delete-route-deletes-rule: Tests delete functionality
- check-badges-route-works: Tests badge checking route

Total: 12 tests with 15 assertions, all passing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-07 07:31:14 -08:00
81a15e5f26 feat(tests): Add transaction rules test suite with 8 passing tests
Add comprehensive tests for the SSR admin transaction rules module:
- Rule matching by description pattern
- Rule matching returns empty for no matches
- Validation accepts valid data with 100% account allocation
- Validation rejects invalid account totals
- Rule matching by amount range
- Rule matching by bank account
- Security tests for non-admin access
- Execute validation tests

All 8 tests passing with 9 assertions. Tests focus on the unique
rule matching engine functionality that differentiates transaction
rules from other admin modules.

Includes implementation plan documenting 23 test scenarios
and 6-phase approach for complete coverage.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-07 00:12:16 -08:00
a7daf839ec feat(tests): Add comprehensive tests for SSR admin vendors module
Add 8 BDD-style tests for the vendors module covering grid/list
operations and vendor merge functionality. Tests follow established
patterns from accounts_test.clj and include proper database
verification.

Tests Implemented:
- vendor-grid-loads-with-empty-database
- vendor-fetch-ids-returns-correct-structure
- vendor-fetch-page-returns-vendors
- vendor-hydrate-results-works
- vendor-merge-transfers-references
- vendor-merge-same-vendor-rejected
- vendor-merge-invalid-vendor-handled
- vendor-hydration-includes-all-fields

Key Implementation Details:
- Uses setup-test-data helper with unique temp IDs
- Tests focus on public interface (fetch-page, merge-submit)
- Follows BDD Given/When/Then pattern
- All 8 tests passing (26 assertions)

Documentation:
- Created implementation plan in docs/plans/
- Documented solution patterns in docs/solutions/
- Created code review todos for future improvements

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-06 23:53:31 -08:00
791e41cf34 feat(ssr): add test suite for admin account management and document test improvements
- Added comprehensive test suite for account creation, validation, and grid views
- Documented Datomic entity reference handling patterns in test comments
- Created 5 test improvement todo documents addressing common test anti-patterns
- Todo items cover: removing debug statements, fixing test nesting, strengthening assertions, extracting helpers, and removing doc-only tests
2026-02-06 22:12:23 -08:00
2df1f71a29 done 2026-02-06 07:26:30 -08:00
310906f2ae clauding 2026-01-31 20:58:33 -08:00
3489fb19d5 clauding 2026-01-31 10:13:06 -08:00
35f5ed025f Merge branch 'master' into get-transactions2-page-working 2026-01-27 16:26:50 -08:00
d008ec71c3 merged 2026-01-05 21:37:30 -08:00
a4089836fa merges 2025-10-07 21:54:21 -07:00
5a05c144ea progress on bulk activities 2025-03-31 10:55:47 -07:00
7f12b31fdf shows as locked 2025-03-29 19:36:52 -07:00
5c0ba7cfa4 updated task 2025-03-22 23:21:46 -07:00
0bae8f3d1b Improvements for transaction page 2025-03-22 23:21:21 -07:00
f3ca8afcc9 progress 2025-03-15 21:55:41 -07:00
d1b04f27c8 fixes 2025-03-15 21:20:30 -07:00
dd2f6508fe fixes 2025-03-15 21:20:19 -07:00
b1ce23bfcf minor cleanup 2025-03-12 10:56:16 -07:00
44a8a77027 merged 2025-03-11 21:11:05 -07:00
04ec980b02 handles home page 2025-03-11 20:27:28 -07:00
e22beb149e much smaller build (hopefully) and transactions progress. 2025-03-10 22:13:53 -07:00
fcb46bf756 msot 2025-03-10 15:04:39 -07:00
7373ef41d1 Removes old login page, more progress on transactions 2025-03-10 14:09:45 -07:00
8429d8516c Switching to radio. 2025-03-10 09:26:29 -07:00
0a797fea3a progress on combinining everything 2025-03-07 11:51:36 -08:00
17993a0dee adds links 2025-03-05 21:16:46 -08:00
d19a2988fd Every action kind of works. 2025-03-05 21:02:50 -08:00
59d48342ea Makes it so that the edit page works better 2025-03-05 14:25:43 -08:00
f881bdcc93 test: Add tests for src/clj/auto_ap/ssr/transaction/edit.clj functions 2025-03-03 10:30:56 -08:00
d0c93e1907 progress on transaction page 2025-03-02 20:58:29 -08:00
bd501b512a transaction links is visible. 2025-03-02 20:44:08 -08:00
7c7fc10a8d transactions page progress. 2025-03-02 20:09:40 -08:00
217 changed files with 10771 additions and 35929 deletions

View File

@@ -0,0 +1,105 @@
---
description: Info on how to evaluate Clojure code via nREPL using clj-nrepl-eval
---
When you need to evaluate Clojure code you can use the
`clj-nrepl-eval` command (if installed via bbin) to evaluate code
against an nREPL server. This means the state of the REPL session
will persist between evaluations.
You can require or load a file in one evaluation of the command and
when you call the command again the namespace will still be available.
## Example uses
You can evaluate clojure code to check if a file you just edited still compiles and loads.
Whenever you require a namespace always use the `:reload` key.
## How to Use
The following evaluates Clojure code via an nREPL connection.
**Discover available nREPL servers:**
```bash
clj-nrepl-eval --discover-ports
```
**Evaluate code (requires --port):**
```bash
clj-nrepl-eval --port <port> "<clojure-code>"
```
## Options
- `-p, --port PORT` - nREPL port (required)
- `-H, --host HOST` - nREPL host (default: 127.0.0.1)
- `-t, --timeout MILLISECONDS` - Timeout in milliseconds (default: 120000)
- `-r, --reset-session` - Reset the persistent nREPL session
- `-c, --connected-ports` - List previously connected nREPL sessions
- `-d, --discover-ports` - Discover nREPL servers in current directory
- `-h, --help` - Show help message
## Workflow
**1. Discover nREPL servers in current directory:**
```bash
clj-nrepl-eval --discover-ports
# Discovered nREPL servers:
#
# In current directory (/path/to/project):
# localhost:7888 (clj)
# localhost:7889 (bb)
#
# Total: 2 servers
```
**2. Check previously connected sessions (optional):**
```bash
clj-nrepl-eval --connected-ports
# Active nREPL connections:
# 127.0.0.1:7888 (clj) (session: abc123...)
#
# Total: 1 active connection
```
**3. Evaluate code:**
```bash
clj-nrepl-eval -p 7888 "(+ 1 2 3)"
```
## Examples
**Discover servers:**
```bash
clj-nrepl-eval --discover-ports
```
**Basic evaluation:**
```bash
clj-nrepl-eval -p 7888 "(+ 1 2 3)"
```
**With timeout:**
```bash
clj-nrepl-eval -p 7888 --timeout 5000 "(Thread/sleep 10000)"
```
**Multiple expressions:**
```bash
clj-nrepl-eval -p 7888 "(def x 10) (* x 2) (+ x 5)"
```
**Reset session:**
```bash
clj-nrepl-eval -p 7888 --reset-session
```
## Features
- **Server discovery** - Use --discover-ports to find all nREPL servers (Clojure, Babashka, shadow-cljs, etc.) in current directory
- **Session tracking** - Use --connected-ports to see previously connected sessions
- **Automatic delimiter repair** - fixes missing/mismatched parens before evaluation
- **Timeout handling** - interrupts long-running evaluations
- **Persistent sessions** - State persists across invocations

5
.claude/settings.json Normal file
View File

@@ -0,0 +1,5 @@
{
"enabledPlugins": {
"playwright@claude-plugins-official": true
}
}

View File

@@ -0,0 +1,174 @@
---
name: clojure-eval
description: Evaluate Clojure code via nREPL using clj-nrepl-eval. Use this when you need to test code, check if edited files compile, verify function behavior, or interact with a running REPL session.
---
# Clojure REPL Evaluation
## When to Use This Skill
Use this skill when you need to:
- **Verify that edited Clojure files compile and load correctly**
- Test function behavior interactively
- Check the current state of the REPL
- Debug code by evaluating expressions
- Require or load namespaces for testing
- Validate that code changes work before committing
## How It Works
The `clj-nrepl-eval` command evaluates Clojure code against an nREPL server. **Session state persists between evaluations**, so you can require a namespace in one evaluation and use it in subsequent calls. Each host:port combination maintains its own session file.
## Instructions
### 0. Discover and select nREPL server
First, discover what nREPL servers are running in the current directory:
```bash
clj-nrepl-eval --discover-ports
```
This will show all nREPL servers (Clojure, Babashka, shadow-cljs, etc.) running in the current project directory.
**Then use the AskUserQuestion tool:**
- **If ports are discovered:** Prompt user to select which nREPL port to use:
- **question:** "Which nREPL port would you like to use?"
- **header:** "nREPL Port"
- **options:** Present each discovered port as an option with:
- **label:** The port number
- **description:** The server type and status (e.g., "Clojure nREPL server in current directory")
- Include up to 4 discovered ports as options
- The user can select "Other" to enter a custom port number
- **If no ports are discovered:** Prompt user how to start an nREPL server:
- **question:** "No nREPL servers found. How would you like to start one?"
- **header:** "Start nREPL"
- **options:**
- **label:** "deps.edn alias", **description:** "Find and use an nREPL alias in deps.edn"
- **label:** "Leiningen", **description:** "Start nREPL using 'lein repl'"
- The user can select "Other" for alternative methods or if they already have a server running on a specific port
IMPORTANT: IF you start a REPL do not supply a port let the nREPL start and return the port that it was started on.
### 1. Evaluate Clojure Code
> Evaluation automatically connects to the given port
Use the `-p` flag to specify the port and pass your Clojure code.
**Recommended: Pass code as a command-line argument:**
```bash
clj-nrepl-eval -p <PORT> "(+ 1 2 3)"
```
**For multiple expressions (single line):**
```bash
clj-nrepl-eval -p <PORT> "(def x 10) (+ x 20)"
```
**Alternative: Using heredoc (may require permission approval for multiline commands):**
```bash
clj-nrepl-eval -p <PORT> <<'EOF'
(def x 10)
(+ x 20)
EOF
```
**Alternative: Via stdin pipe:**
```bash
echo "(+ 1 2 3)" | clj-nrepl-eval -p <PORT>
```
### 2. Display nREPL Sessions
**Discover all nREPL servers in current directory:**
```bash
clj-nrepl-eval --discover-ports
```
Shows all running nREPL servers in the current project directory, including their type (clj/bb/basilisp) and whether they match the current working directory.
**Check previously connected sessions:**
```bash
clj-nrepl-eval --connected-ports
```
Shows only connections you have made before (appears after first evaluation on a port).
### 3. Common Patterns
**Require a namespace (always use :reload to pick up changes):**
```bash
clj-nrepl-eval -p <PORT> "(require '[my.namespace :as ns] :reload)"
```
**Test a function after requiring:**
```bash
clj-nrepl-eval -p <PORT> "(ns/my-function arg1 arg2)"
```
**Check if a file compiles:**
```bash
clj-nrepl-eval -p <PORT> "(require 'my.namespace :reload)"
```
**Multiple expressions:**
```bash
clj-nrepl-eval -p <PORT> "(def x 10) (* x 2) (+ x 5)"
```
**Complex multiline code (using heredoc):**
```bash
clj-nrepl-eval -p <PORT> <<'EOF'
(def x 10)
(* x 2)
(+ x 5)
EOF
```
*Note: Heredoc syntax may require permission approval.*
**With custom timeout (in milliseconds):**
```bash
clj-nrepl-eval -p <PORT> --timeout 5000 "(long-running-fn)"
```
**Reset the session (clears all state):**
```bash
clj-nrepl-eval -p <PORT> --reset-session
clj-nrepl-eval -p <PORT> --reset-session "(def x 1)"
```
## Available Options
- `-p, --port PORT` - nREPL port (required)
- `-H, --host HOST` - nREPL host (default: 127.0.0.1)
- `-t, --timeout MILLISECONDS` - Timeout (default: 120000 = 2 minutes)
- `-r, --reset-session` - Reset the persistent nREPL session
- `-c, --connected-ports` - List previously connected nREPL sessions
- `-d, --discover-ports` - Discover nREPL servers in current directory
- `-h, --help` - Show help message
## Important Notes
- **Prefer command-line arguments:** Pass code as quoted strings: `clj-nrepl-eval -p <PORT> "(+ 1 2 3)"` - works with existing permissions
- **Heredoc for complex code:** Use heredoc (`<<'EOF' ... EOF`) for truly multiline code, but note it may require permission approval
- **Sessions persist:** State (vars, namespaces, loaded libraries) persists across invocations until the nREPL server restarts or `--reset-session` is used
- **Automatic delimiter repair:** The tool automatically repairs missing or mismatched parentheses
- **Always use :reload:** When requiring namespaces, use `:reload` to pick up recent changes
- **Default timeout:** 2 minutes (120000ms) - increase for long-running operations
- **Input precedence:** Command-line arguments take precedence over stdin
## Typical Workflow
1. Discover nREPL servers: `clj-nrepl-eval --discover-ports`
2. Use **AskUserQuestion** tool to prompt user to select a port
3. Require namespace:
```bash
clj-nrepl-eval -p <PORT> "(require '[my.ns :as ns] :reload)"
```
4. Test function:
```bash
clj-nrepl-eval -p <PORT> "(ns/my-fn ...)"
```
5. Iterate: Make changes, re-require with `:reload`, test again

View File

@@ -0,0 +1,82 @@
# clj-nrepl-eval Examples
## Discovery
```bash
clj-nrepl-eval --connected-ports
```
## Heredoc for Multiline Code
```bash
clj-nrepl-eval -p 7888 <<'EOF'
(defn greet [name]
(str "Hello, " name "!"))
(greet "Claude")
EOF
```
### Heredoc Simplifies String Escaping
Heredoc avoids shell escaping issues with quotes, backslashes, and special characters:
```bash
# With heredoc - no escaping needed
clj-nrepl-eval -p 7888 <<'EOF'
(def regex #"\\d{3}-\\d{4}")
(def message "She said \"Hello!\" and waved")
(def path "C:\\Users\\name\\file.txt")
(println message)
EOF
# Without heredoc - requires complex escaping
clj-nrepl-eval -p 7888 "(def message \"She said \\\"Hello!\\\" and waved\")"
```
## Working with Project Namespaces
```bash
# Test a function after requiring
clj-nrepl-eval -p 7888 <<'EOF'
(require '[clojure-mcp-light.delimiter-repair :as dr] :reload)
(dr/delimiter-error? "(defn foo [x]")
EOF
```
## Verify Compilation After Edit
```bash
# If this returns nil, the file compiled successfully
clj-nrepl-eval -p 7888 "(require 'clojure-mcp-light.hook :reload)"
```
## Session Management
```bash
# Reset session if state becomes corrupted
clj-nrepl-eval -p 7888 --reset-session
```
## Common Workflow Patterns
### Load, Test, Iterate
```bash
# After editing a file, reload and test in one command
clj-nrepl-eval -p 7888 <<'EOF'
(require '[my.namespace :as ns] :reload)
(ns/my-function test-data)
EOF
```
### Run Tests After Changes
```bash
clj-nrepl-eval -p 7888 <<'EOF'
(require '[my.project.core :as core] :reload)
(require '[my.project.core-test :as test] :reload)
(clojure.test/run-tests 'my.project.core-test)
EOF
```

View File

@@ -0,0 +1,201 @@
---
name: invoice-template-creator
description: This skill creates PDF invoice parsing templates for the Integreat system. It should be used when adding support for a new vendor invoice format that needs to be automatically parsed.
license: Complete terms in LICENSE.txt
---
# Invoice Template Creator
This skill automates the creation of invoice parsing templates for the Integreat system. It generates both the template definition and a corresponding test file based on a sample PDF invoice.
## When to Use This Skill
Use this skill when you need to add support for a new vendor invoice format that cannot be parsed by existing templates. This typically happens when:
- A new vendor sends invoices in a unique format
- An existing vendor changes their invoice layout
- You encounter an invoice that fails to parse with current templates
## Prerequisites
Before using this skill, ensure you have:
1. A sample PDF invoice file placed in `dev-resources/` directory
2. Identified the vendor name
3. Identified unique text patterns in the invoice (phone numbers, addresses, etc.) that can distinguish this vendor
4. Know the expected values for key fields (invoice number, date, customer name, total)
## Usage Workflow
### Step 1: Analyze the PDF
First, extract and analyze the PDF text to understand its structure:
```bash
pdftotext -layout "dev-resources/FILENAME.pdf" -
```
Look for:
- **Vendor identifiers**: Phone numbers, addresses, or unique text that identifies this vendor
- **Field patterns**: How invoice number, date, customer name, and total appear in the text
- **Layout quirks**: Multi-line fields, special formatting, or unusual spacing
### Step 2: Define Expected Values
Document the expected values for each field:
| Field | Expected Value | Notes |
|-------|---------------|-------|
| Vendor Name | "Vendor Name" | Company name as it should appear |
| Invoice Number | "12345" | The invoice identifier |
| Date | "01/15/26" | Format found in PDF |
| Customer Name | "Customer Name" | As it appears on invoice |
| Customer Address | "123 Main St" | Street address if available |
| Total | "100.00" | Amount |
### Step 3: Create the Template and Test
The skill will:
1. **Create a test file** at `test/clj/auto_ap/parse/templates_test.clj` (or add to existing)
- Test parses the PDF file
- Verifies all expected values are extracted correctly
- Follows existing test patterns
2. **Add template to** `src/clj/auto_ap/parse/templates.clj`
- Adds entry to `pdf-templates` vector
- Includes:
- `:vendor` - Vendor name
- `:keywords` - Regex patterns to identify this vendor (must match all)
- `:extract` - Regex patterns for each field
- `:parser` - Optional date/number parsers
### Step 4: Iterative Refinement
Run the test to see if it passes:
```bash
lein test auto-ap.parse.templates-test
```
If it fails, examine the debug output and refine the regex patterns. Common issues:
- **Template doesn't match**: Keywords don't actually appear in the PDF text
- **Field is nil**: Regex capture group doesn't match the actual text format
- **Wrong value captured**: Regex is too greedy or matches wrong text
## Template Structure Reference
### Basic Template Format
```clojure
{:vendor "Vendor Name"
:keywords [#"unique-pattern-1" #"unique-pattern-2"]
:extract {:invoice-number #"Invoice\s+#\s+(\d+)"
:date #"Date:\s+(\d{2}/\d{2}/\d{2})"
:customer-identifier #"Bill To:\s+([A-Za-z\s]+)"
:total #"Total:\s+\$([\d,]+\.\d{2})"}
:parser {:date [:clj-time "MM/dd/yy"]
:total [:trim-commas nil]}}
```
### Field Extraction Patterns
**Invoice Number:**
- Look for: `"Invoice #12345"` or `"INV: 12345"`
- Pattern: `#"Invoice\s*#?\s*(\d+)"` or `#"INV:\s*(\d+)"`
**Date:**
- Common formats: `"01/15/26"`, `"Jan 15, 2026"`, `"2026-01-15"`
- Pattern: `#"(\d{2}/\d{2}/\d{2})"` for MM/dd/yy
- Parser: `:date [:clj-time "MM/dd/yy"]`
**Customer Identifier:**
- Look for: `"Bill To: Customer Name"` or `"Sold To: Customer Name"`
- Pattern: `#"Bill To:\s+([A-Za-z\s]+?)(?=\s{2,}|\n)"`
- Use non-greedy `+?` and lookahead `(?=...)` to stop at boundaries
**Total:**
- Look for: `"Total: $100.00"` or `"Amount Due: 100.00"`
- Pattern: `#"Total:\s+\$?([\d,]+\.\d{2})"`
- Parser: `:total [:trim-commas nil]` removes commas
### Advanced Patterns
**Multi-line customer address:**
When customer info spans multiple lines (name + address):
```clojure
:customer-identifier #"(?s)I\s+([A-Z][A-Z\s]+?)\s{2,}.*?L\s+([0-9][A-Z0-9\s]+?)(?=\s{2,}|\n)"
:account-number #"(?s)L\s+([0-9][A-Z0-9\s]+?)(?=\s{2,}|\n)"
```
The `(?s)` flag makes `.` match newlines. Use non-greedy `+?` and lookaheads `(?=...)` to capture clean values.
**Multiple date formats:**
```clojure
:parser {:date [:clj-time ["MM/dd/yy" "yyyy-MM-dd"]]}
```
**Credit memos (negative amounts):**
```clojure
:parser {:total [:trim-commas-and-negate nil]}
```
## Testing Best Practices
1. IMPORTANT, CRITICAL!! **Start with a failing test** - Define expected values before implementing
2. **Test actual PDF parsing** - Use `parse-file` or `parse` with real PDF text
3. **Verify each field individually** - Separate assertions for clarity
4. **Handle date comparisons carefully** - Compare year/month/day separately if needed
5. **Use `str/trim`** - Account for extra whitespace in extracted values
## Example Test Structure
```clojure
(deftest parse-vendor-invoice-12345
(testing "Should parse Vendor invoice with expected values"
(let [results (sut/parse-file (io/file "dev-resources/INVOICE.pdf")
"INVOICE.pdf")
result (first results)]
(is (some? results) "Should return results")
(is (some? result) "Template should match")
(when result
(is (= "Vendor Name" (:vendor-code result)))
(is (= "12345" (:invoice-number result)))
(is (= "Customer Name" (:customer-identifier result)))
(is (= "100.00" (:total result)))))))
```
## Common Pitfalls
1. **Keywords must all match** - Every pattern in `:keywords` must be found in the PDF
2. **Capture groups required** - Regexes need `()` to extract values
3. **PDF text != visual text** - Layout may differ from what you see visually
4. **Greedy quantifiers** - Use `+?` instead of `+` to avoid over-matching
5. **Case sensitivity** - Regex is case-sensitive unless you use `(?i)` flag
## Post-Creation Checklist
After creating the template:
- [ ] Test passes: `lein test auto-ap.parse.templates-test`
- [ ] Format is correct: `lein cljfmt check`
- [ ] Code compiles: `lein check`
- [ ] Template is in correct position in `pdf-templates` vector
- [ ] Keywords uniquely identify this vendor (won't match other templates)
- [ ] Test file follows naming conventions
## Integration with Workflow
This skill is typically used as part of a larger workflow:
1. User provides PDF and requirements
2. This skill creates template and test
3. User reviews and refines if needed
4. Test is run to verify extraction
5. Code is committed
The skill ensures consistency with existing patterns and reduces manual boilerplate when adding new vendor support.

View File

@@ -0,0 +1,188 @@
# Invoice Template Examples
## Simple Single Invoice
```clojure
{:vendor "Gstar Seafood"
:keywords [#"G Star Seafood"]
:extract {:total #"Total\s{2,}([\d\-,]+\.\d{2,2}+)"
:customer-identifier #"(.*?)(?:\s+)Invoice #"
:date #"Invoice Date\s{2,}([0-9]+/[0-9]+/[0-9]+)"
:invoice-number #"Invoice #\s+(\d+)"}
:parser {:date [:clj-time "MM/dd/yyyy"]
:total [:trim-commas nil]}}
```
## Multi-Invoice Statement
```clojure
{:vendor "Southbay Fresh Produce"
:keywords [#"(SOUTH BAY FRESH PRODUCE|SOUTH BAY PRODUCE)"]
:extract {:date #"^([0-9]+/[0-9]+/[0-9]+)"
:customer-identifier #"To:[^\n]*\n\s+([A-Za-z' ]+)\s{2}"
:invoice-number #"INV #\/(\d+)"
:total #"\$([0-9.]+)\."}
:parser {:date [:clj-time "MM/dd/yyyy"]}
:multi #"\n"
:multi-match? #"^[0-9]+/[0-9]+/[0-9]+\s+INV "}
```
## Customer with Address (Multi-line)
```clojure
{:vendor "Bonanza Produce"
:keywords [#"530-544-4136"]
:extract {:invoice-number #"NO\s+(\d{8,})\s+\d{2}/\d{2}/\d{2}"
:date #"NO\s+\d{8,}\s+(\d{2}/\d{2}/\d{2})"
:customer-identifier #"(?s)I\s+([A-Z][A-Z\s]+?)\s{2,}.*?L\s+([0-9][A-Z0-9\s]+?)(?=\s{2,}|\n)"
:account-number #"(?s)L\s+([0-9][A-Z0-9\s]+?)(?=\s{2,}|\n)"
:total #"SHIPPED\s+[\d\.]+\s+TOTAL\s+([\d\.]+)"}
:parser {:date [:clj-time "MM/dd/yy"]
:total [:trim-commas nil]}}
```
## Credit Memo (Negative Amounts)
```clojure
{:vendor "General Produce Company"
:keywords [#"916-552-6495"]
:extract {:date #"DATE.*\n.*\n.*?([0-9]+/[0-9]+/[0-9]+)"
:invoice-number #"CREDIT NO.*\n.*\n.*?(\d{5,}?)\s+"
:account-number #"CUST NO.*\n.*\n\s+(\d+)"
:total #"TOTAL:\s+\|\s*(.*)"}
:parser {:date [:clj-time "MM/dd/yy"]
:total [:trim-commas-and-negate nil]}}
```
## Complex Date Parsing
```clojure
{:vendor "Ben E. Keith"
:keywords [#"BEN E. KEITH"]
:extract {:date #"Customer No Mo Day Yr.*?\n.*?\d{5,}\s{2,}(\d+\s+\d+\s+\d+)"
:customer-identifier #"Customer No Mo Day Yr.*?\n.*?(\d{5,})"
:invoice-number #"Invoice No.*?\n.*?(\d{8,})"
:total #"Total Invoice.*?\n.*?([\-]?[0-9]+\.[0-9]{2,})"}
:parser {:date [:month-day-year nil]
:total [:trim-commas-and-negate nil]}}
```
## Multiple Date Formats
```clojure
{:vendor "RNDC"
:keywords [#"P.O.Box 743564"]
:extract {:date #"(?:INVOICE|CREDIT) DATE\n(?:.*?)(\S+)\n"
:account-number #"Store Number:\s+(\d+)"
:invoice-number #"(?:INVOICE|CREDIT) DATE\n(?:.*?)\s{2,}(\d+?)\s+\S+\n"
:total #"Net Amount(?:.*\n){4}(?:.*?)([\-]?[0-9\.]+)\n"}
:parser {:date [:clj-time ["MM/dd/yy" "dd-MMM-yy"]]
:total [:trim-commas-and-negate nil]}}
```
## Common Regex Patterns
### Phone Numbers
```clojure
#"\(?[0-9]{3}\)?[-.\s]?[0-9]{3}[-.\s]?[0-9]{4}"
```
### Dollar Amounts
```clojure
#"\$?([0-9,]+\.[0-9]{2})"
```
### Dates (MM/dd/yy)
```clojure
#"([0-9]{2}/[0-9]{2}/[0-9]{2})"
```
### Dates (MM/dd/yyyy)
```clojure
#"([0-9]{2}/[0-9]{2}/[0-9]{4})"
```
### Multi-line Text (dotall mode)
```clojure
#"(?s)start.*?end"
```
### Non-greedy Match
```clojure
#"(pattern.+?)"
```
### Lookahead Boundary
```clojure
#"value(?=\s{2,}|\n)"
```
## Field Extraction Strategies
### 1. Simple Line-based
Use `[^\n]*` to match until end of line:
```clojure
#"Invoice:\s+([^\n]+)"
```
### 2. Whitespace Boundary
Use `(?=\s{2,}|\n)` to stop at multiple spaces or newline:
```clojure
#"Customer:\s+(.+?)(?=\s{2,}|\n)"
```
### 3. Specific Marker
Match until a specific pattern is found:
```clojure
#"(?s)Start(.*?)End"
```
### 4. Multi-part Extraction
Use multiple capture groups for related fields:
```clojure
#"Date:\s+(\d{2})/(\d{2})/(\d{2})"
```
## Parser Options
### Date Parsers
- `[:clj-time "MM/dd/yyyy"]` - Standard US date
- `[:clj-time "MM/dd/yy"]` - 2-digit year
- `[:clj-time "MMM dd, yyyy"]` - Named month
- `[:clj-time ["MM/dd/yy" "yyyy-MM-dd"]]` - Multiple formats
- `[:month-day-year nil]` - Space-separated (1 15 26)
### Number Parsers
- `[:trim-commas nil]` - Remove commas from numbers
- `[:trim-commas-and-negate nil]` - Handle negative/credit amounts
- `[:trim-commas-and-remove-dollars nil]` - Remove $ and commas
- `nil` - No parsing, return raw string
## Testing Patterns
### Basic Test Structure
```clojure
(deftest parse-vendor-invoice
(testing "Should parse vendor invoice"
(let [results (sut/parse-file (io/file "dev-resources/INVOICE.pdf")
"INVOICE.pdf")
result (first results)]
(is (some? result))
(is (= "Vendor" (:vendor-code result)))
(is (= "12345" (:invoice-number result))))))
```
### Date Testing
```clojure
(let [d (:date result)]
(is (= 2026 (time/year d)))
(is (= 1 (time/month d)))
(is (= 15 (time/day d))))
```
### Multi-field Verification
```clojure
(is (= "Expected Name" (:customer-identifier result)))
(is (= "Expected Street" (str/trim (:account-number result))))
(is (= "Expected City, ST 12345" (str/trim (:location result))))
```

View File

@@ -0,0 +1,248 @@
---
name: testing-conventions
description: Describe the way that tests should be authored, conventions, tools, helpers, superceding any conventions found in existing tests.
---
# Testing Conventions Skill
This skill documents the testing conventions for `test/clj/auto_ap/`.
## Test Focus: User-Observable Behavior
**Primary rule**: Test user-observable behavior. If an endpoint or function makes a database change, verify the change by querying the database directly rather than asserting on markup.
**other rules**:
1. Don't test the means of doing work. For example, if there is a middleware that makes something available on a request, don't bother testing that wrapper.
2. prefer :refer testing imports, rather than :as reference
3. Prefer structured edits from clojure-mcp
### When to Assert on Database State
When testing an endpoint that modifies data:
1. Verify the database change by querying the entity directly
2. Use `dc/pull` or `dc/q` to verify the data was stored correctly
```clojure
;; CORRECT: Verify the database change directly
(deftest test-create-transaction
(let [result @(post-create-transaction {:amount 100.0})]
(let [entity (dc/pull (dc/db conn) [:db/id :transaction/amount] (:transaction/id result))]
(is (= 100.0 (:transaction/amount entity))))))
;; CORRECT: Verify response status and headers
(is (= 201 (:status response)))
(is (= "application/json" (get-in response [:headers "content-type"])))
;; CORRECT: Check for expected text content
(is (re-find #"Transaction created" (get-in response [:body "message"])))
```
### When Markup Testing is Acceptable
Markup testing (HTML/SSR response bodies) is acceptable when:
- Validating response status codes and headers
- Checking for presence/absence of specific text strings
- Verifying small, expected elements within the markup
- Testing SSR component rendering
```clojure
;; ACCEPTABLE: Response codes and headers
(is (= 200 (:status response)))
(is (= "application/json" (get-in response [:headers "content-type"])))
;; ACCEPTABLE: Text content within markup
(is (re-find #"Transaction found" response-body))
;; ACCEPTABLE: Small element checks
(is (re-find #">Amount: \$100\.00<" response-body))
```
### When to Avoid Markup Testing
Do not use markup assertions for:
- Verifying complex data structures (use database queries instead)
- Complex nested content that's easier to query
- Business logic verification (test behavior, not presentation)
## Database Setup
All tests in `test/clj/auto_ap/` use a shared database fixture (`wrap-setup`) that:
1. Creates a temporary in-memory Datomic database (`datomic:mem://test`)
2. Loads the full schema from `io/resources/schema.edn`
3. Installs custom Datomic functions from `io/resources/functions.edn`
4. Cleans up the database after each test
## Using the Fixture
```clojure
(ns my-test
(:require
[auto-ap.integration.util :refer [wrap-setup]]
[clojure.test :as t]))
(use-fixtures :each wrap-setup)
(deftest my-test
;; tests here can access the test database
)
```
## Helper Functions
`test/clj/auto_ap/integration/util.clj` provides helper functions for creating test data:
### Identity Helpers
```clojure
;; Add a unique string to avoid collisions
(str "CLIENT" (rand-int 100000))
(str "INVOICE " (rand-int 1000000))
```
### Test Entity Builders
```clojure
;; Client
(test-client
[:db/id "client-id"
:client/code "CLIENT123"
:client/locations ["DT" "MH"]
:client/bank-accounts [:bank-account-id]])
;; Vendor
(test-vendor
[:db/id "vendor-id"
:vendor/name "Vendorson"
:vendor/default-account "test-account-id"])
;; Bank Account
(test-bank-account
[:db/id "bank-account-id"
:bank-account/code "TEST-BANK-123"
:bank-account/type :bank-account-type/check])
;; Transaction
(test-transaction
[:db/id "transaction-id"
:transaction/date #inst "2022-01-01"
:transaction/client "test-client-id"
:transaction/bank-account "test-bank-account-id"
:transaction/id (str (java.util.UUID/randomUUID))
:transaction/amount 100.0
:transaction/description-original "original description"])
;; Payment
(test-payment
[:db/id "test-payment-id"
:payment/date #inst "2022-01-01"
:payment/client "test-client-id"
:payment/bank-account "test-bank-account-id"
:payment/type :payment-type/check
:payment/vendor "test-vendor-id"
:payment/amount 100.0])
;; Invoice
(test-invoice
[:db/id "test-invoice-id"
:invoice/date #inst "2022-01-01"
:invoice/client "test-client-id"
:invoice/status :invoice-status/unpaid
:invoice/import-status :import-status/imported
:invoice/total 100.0
:invoice/outstanding-balance 100.00
:invoice/vendor "test-vendor-id"
:invoice/invoice-number "INVOICE 123456"
:invoice/expense-accounts
[{:invoice-expense-account/account "test-account-id"
:invoice-expense-account/amount 100.0
:invoice-expense-account/location "DT"}]])
;; Account
(test-account
[:db/id "account-id"
:account/name "Account"
:account/type :account-type/asset])
```
### Common Data Setup (`setup-test-data`)
Creates a minimal but complete dataset for testing:
```clojure
(defn setup-test-data [data]
(:tempids @(dc/transact conn (into data
[(test-account :db/id "test-account-id")
(test-client :db/id "test-client-id"
:client/bank-accounts [(test-bank-account :db/id "test-bank-account-id")])
(test-vendor :db/id "test-vendor-id")
{:db/id "accounts-payable-id"
:account/name "Accounts Payable"
:db/ident :account/accounts-payable
:account/numeric-code 21000
:account/account-set "default"}]))))
```
Use like:
```clojure
(let [{:strs [test-client-id test-bank-account-id test-vendor-id]} (setup-test-data [])]
...)
```
### Token Helpers
```clojure
;; Admin token
(admin-token)
;; User token (optionally scoped to specific client)
(user-token) ; Default: client-id 1
(user-token client-id) ; Scoped to specific client
```
## Example Usage
```clojure
(ns my-test
(:require
[clojure.test :as t]
[auto-ap.datomic :refer [conn]]
[auto-ap.integration.util :refer [wrap-setup admin-token setup-test-data test-transaction]]))
(use-fixtures :each wrap-setup)
(deftest test-transaction-import
(testing "Should import a transaction"
(let [{:strs [client-id bank-account-id]} (setup-test-data [])
tx-result @(dc/transact conn
[(test-transaction
{:db/id "test-tx-id"
:transaction/client client-id
:transaction/bank-account bank-account-id
:transaction/amount 50.0})])]
(is (= 1 (count (:tx-data tx-result))))
;; Verify by querying the database, not markup
(let [entity (dc/pull (dc/db conn) [:transaction/amount] (:db/id tx-result))]
(is (= 50.0 (:transaction/amount entity)))))))
```
## Note on Temp IDs
Test data often uses string-based temp IDs like `"client-id"`, `"bank-account-id"`, etc. When transacting, the returned `:tempids` map maps these symbolic IDs to Datomic's internal entity IDs:
```clojure
(let [{:strs [client-id bank-account-id]} (:tempids @(dc/transact conn txes))]
...)
```
## Memory Database
All tests use `datomic:mem://test` - an in-memory database. This ensures:
- Tests are fast
- Tests don't interfere with each other
- No setup required to run tests locally
The database is automatically deleted after each test completes.
# running tests
prefer to use clojure nrepl evaluation skill over leiningen, but worst case,
use leiningen to run tests

3
.gitattributes vendored Normal file
View File

@@ -0,0 +1,3 @@
# Use bd merge for beads JSONL files
.beads/issues.jsonl merge=beads

View File

@@ -0,0 +1,174 @@
---
name: clojure-eval
description: Evaluate Clojure code via nREPL using clj-nrepl-eval. Use this when you need to test code, check if edited files compile, verify function behavior, or interact with a running REPL session.
---
# Clojure REPL Evaluation
## When to Use This Skill
Use this skill when you need to:
- **Verify that edited Clojure files compile and load correctly**
- Test function behavior interactively
- Check the current state of the REPL
- Debug code by evaluating expressions
- Require or load namespaces for testing
- Validate that code changes work before committing
## How It Works
The `clj-nrepl-eval` command evaluates Clojure code against an nREPL server. **Session state persists between evaluations**, so you can require a namespace in one evaluation and use it in subsequent calls. Each host:port combination maintains its own session file.
## Instructions
### 0. Discover and select nREPL server
First, discover what nREPL servers are running in the current directory:
```bash
clj-nrepl-eval --discover-ports
```
This will show all nREPL servers (Clojure, Babashka, shadow-cljs, etc.) running in the current project directory.
**Then use the AskUserQuestion tool:**
- **If ports are discovered:** Prompt user to select which nREPL port to use:
- **question:** "Which nREPL port would you like to use?"
- **header:** "nREPL Port"
- **options:** Present each discovered port as an option with:
- **label:** The port number
- **description:** The server type and status (e.g., "Clojure nREPL server in current directory")
- Include up to 4 discovered ports as options
- The user can select "Other" to enter a custom port number
- **If no ports are discovered:** Prompt user how to start an nREPL server:
- **question:** "No nREPL servers found. How would you like to start one?"
- **header:** "Start nREPL"
- **options:**
- **label:** "deps.edn alias", **description:** "Find and use an nREPL alias in deps.edn"
- **label:** "Leiningen", **description:** "Start nREPL using 'lein repl'"
- The user can select "Other" for alternative methods or if they already have a server running on a specific port
IMPORTANT: IF you start a REPL do not supply a port let the nREPL start and return the port that it was started on.
### 1. Evaluate Clojure Code
> Evaluation automatically connects to the given port
Use the `-p` flag to specify the port and pass your Clojure code.
**Recommended: Pass code as a command-line argument:**
```bash
clj-nrepl-eval -p <PORT> "(+ 1 2 3)"
```
**For multiple expressions (single line):**
```bash
clj-nrepl-eval -p <PORT> "(def x 10) (+ x 20)"
```
**Alternative: Using heredoc (may require permission approval for multiline commands):**
```bash
clj-nrepl-eval -p <PORT> <<'EOF'
(def x 10)
(+ x 20)
EOF
```
**Alternative: Via stdin pipe:**
```bash
echo "(+ 1 2 3)" | clj-nrepl-eval -p <PORT>
```
### 2. Display nREPL Sessions
**Discover all nREPL servers in current directory:**
```bash
clj-nrepl-eval --discover-ports
```
Shows all running nREPL servers in the current project directory, including their type (clj/bb/basilisp) and whether they match the current working directory.
**Check previously connected sessions:**
```bash
clj-nrepl-eval --connected-ports
```
Shows only connections you have made before (appears after first evaluation on a port).
### 3. Common Patterns
**Require a namespace (always use :reload to pick up changes):**
```bash
clj-nrepl-eval -p <PORT> "(require '[my.namespace :as ns] :reload)"
```
**Test a function after requiring:**
```bash
clj-nrepl-eval -p <PORT> "(ns/my-function arg1 arg2)"
```
**Check if a file compiles:**
```bash
clj-nrepl-eval -p <PORT> "(require 'my.namespace :reload)"
```
**Multiple expressions:**
```bash
clj-nrepl-eval -p <PORT> "(def x 10) (* x 2) (+ x 5)"
```
**Complex multiline code (using heredoc):**
```bash
clj-nrepl-eval -p <PORT> <<'EOF'
(def x 10)
(* x 2)
(+ x 5)
EOF
```
*Note: Heredoc syntax may require permission approval.*
**With custom timeout (in milliseconds):**
```bash
clj-nrepl-eval -p <PORT> --timeout 5000 "(long-running-fn)"
```
**Reset the session (clears all state):**
```bash
clj-nrepl-eval -p <PORT> --reset-session
clj-nrepl-eval -p <PORT> --reset-session "(def x 1)"
```
## Available Options
- `-p, --port PORT` - nREPL port (required)
- `-H, --host HOST` - nREPL host (default: 127.0.0.1)
- `-t, --timeout MILLISECONDS` - Timeout (default: 120000 = 2 minutes)
- `-r, --reset-session` - Reset the persistent nREPL session
- `-c, --connected-ports` - List previously connected nREPL sessions
- `-d, --discover-ports` - Discover nREPL servers in current directory
- `-h, --help` - Show help message
## Important Notes
- **Prefer command-line arguments:** Pass code as quoted strings: `clj-nrepl-eval -p <PORT> "(+ 1 2 3)"` - works with existing permissions
- **Heredoc for complex code:** Use heredoc (`<<'EOF' ... EOF`) for truly multiline code, but note it may require permission approval
- **Sessions persist:** State (vars, namespaces, loaded libraries) persists across invocations until the nREPL server restarts or `--reset-session` is used
- **Automatic delimiter repair:** The tool automatically repairs missing or mismatched parentheses
- **Always use :reload:** When requiring namespaces, use `:reload` to pick up recent changes
- **Default timeout:** 2 minutes (120000ms) - increase for long-running operations
- **Input precedence:** Command-line arguments take precedence over stdin
## Typical Workflow
1. Discover nREPL servers: `clj-nrepl-eval --discover-ports`
2. Use **AskUserQuestion** tool to prompt user to select a port
3. Require namespace:
```bash
clj-nrepl-eval -p <PORT> "(require '[my.ns :as ns] :reload)"
```
4. Test function:
```bash
clj-nrepl-eval -p <PORT> "(ns/my-fn ...)"
```
5. Iterate: Make changes, re-require with `:reload`, test again

View File

@@ -0,0 +1,82 @@
# clj-nrepl-eval Examples
## Discovery
```bash
clj-nrepl-eval --connected-ports
```
## Heredoc for Multiline Code
```bash
clj-nrepl-eval -p 7888 <<'EOF'
(defn greet [name]
(str "Hello, " name "!"))
(greet "Claude")
EOF
```
### Heredoc Simplifies String Escaping
Heredoc avoids shell escaping issues with quotes, backslashes, and special characters:
```bash
# With heredoc - no escaping needed
clj-nrepl-eval -p 7888 <<'EOF'
(def regex #"\\d{3}-\\d{4}")
(def message "She said \"Hello!\" and waved")
(def path "C:\\Users\\name\\file.txt")
(println message)
EOF
# Without heredoc - requires complex escaping
clj-nrepl-eval -p 7888 "(def message \"She said \\\"Hello!\\\" and waved\")"
```
## Working with Project Namespaces
```bash
# Test a function after requiring
clj-nrepl-eval -p 7888 <<'EOF'
(require '[clojure-mcp-light.delimiter-repair :as dr] :reload)
(dr/delimiter-error? "(defn foo [x]")
EOF
```
## Verify Compilation After Edit
```bash
# If this returns nil, the file compiled successfully
clj-nrepl-eval -p 7888 "(require 'clojure-mcp-light.hook :reload)"
```
## Session Management
```bash
# Reset session if state becomes corrupted
clj-nrepl-eval -p 7888 --reset-session
```
## Common Workflow Patterns
### Load, Test, Iterate
```bash
# After editing a file, reload and test in one command
clj-nrepl-eval -p 7888 <<'EOF'
(require '[my.namespace :as ns] :reload)
(ns/my-function test-data)
EOF
```
### Run Tests After Changes
```bash
clj-nrepl-eval -p 7888 <<'EOF'
(require '[my.project.core :as core] :reload)
(require '[my.project.core-test :as test] :reload)
(clojure.test/run-tests 'my.project.core-test)
EOF
```

View File

@@ -0,0 +1,201 @@
---
name: invoice-template-creator
description: This skill creates PDF invoice parsing templates for the Integreat system. It should be used when adding support for a new vendor invoice format that needs to be automatically parsed.
license: Complete terms in LICENSE.txt
---
# Invoice Template Creator
This skill automates the creation of invoice parsing templates for the Integreat system. It generates both the template definition and a corresponding test file based on a sample PDF invoice.
## When to Use This Skill
Use this skill when you need to add support for a new vendor invoice format that cannot be parsed by existing templates. This typically happens when:
- A new vendor sends invoices in a unique format
- An existing vendor changes their invoice layout
- You encounter an invoice that fails to parse with current templates
## Prerequisites
Before using this skill, ensure you have:
1. A sample PDF invoice file placed in `dev-resources/` directory
2. Identified the vendor name
3. Identified unique text patterns in the invoice (phone numbers, addresses, etc.) that can distinguish this vendor
4. Know the expected values for key fields (invoice number, date, customer name, total)
## Usage Workflow
### Step 1: Analyze the PDF
First, extract and analyze the PDF text to understand its structure:
```bash
pdftotext -layout "dev-resources/FILENAME.pdf" -
```
Look for:
- **Vendor identifiers**: Phone numbers, addresses, or unique text that identifies this vendor
- **Field patterns**: How invoice number, date, customer name, and total appear in the text
- **Layout quirks**: Multi-line fields, special formatting, or unusual spacing
### Step 2: Define Expected Values
Document the expected values for each field:
| Field | Expected Value | Notes |
|-------|---------------|-------|
| Vendor Name | "Vendor Name" | Company name as it should appear |
| Invoice Number | "12345" | The invoice identifier |
| Date | "01/15/26" | Format found in PDF |
| Customer Name | "Customer Name" | As it appears on invoice |
| Customer Address | "123 Main St" | Street address if available |
| Total | "100.00" | Amount |
### Step 3: Create the Template and Test
The skill will:
1. **Create a test file** at `test/clj/auto_ap/parse/templates_test.clj` (or add to existing)
- Test parses the PDF file
- Verifies all expected values are extracted correctly
- Follows existing test patterns
2. **Add template to** `src/clj/auto_ap/parse/templates.clj`
- Adds entry to `pdf-templates` vector
- Includes:
- `:vendor` - Vendor name
- `:keywords` - Regex patterns to identify this vendor (must match all)
- `:extract` - Regex patterns for each field
- `:parser` - Optional date/number parsers
### Step 4: Iterative Refinement
Run the test to see if it passes:
```bash
lein test auto-ap.parse.templates-test
```
If it fails, examine the debug output and refine the regex patterns. Common issues:
- **Template doesn't match**: Keywords don't actually appear in the PDF text
- **Field is nil**: Regex capture group doesn't match the actual text format
- **Wrong value captured**: Regex is too greedy or matches wrong text
## Template Structure Reference
### Basic Template Format
```clojure
{:vendor "Vendor Name"
:keywords [#"unique-pattern-1" #"unique-pattern-2"]
:extract {:invoice-number #"Invoice\s+#\s+(\d+)"
:date #"Date:\s+(\d{2}/\d{2}/\d{2})"
:customer-identifier #"Bill To:\s+([A-Za-z\s]+)"
:total #"Total:\s+\$([\d,]+\.\d{2})"}
:parser {:date [:clj-time "MM/dd/yy"]
:total [:trim-commas nil]}}
```
### Field Extraction Patterns
**Invoice Number:**
- Look for: `"Invoice #12345"` or `"INV: 12345"`
- Pattern: `#"Invoice\s*#?\s*(\d+)"` or `#"INV:\s*(\d+)"`
**Date:**
- Common formats: `"01/15/26"`, `"Jan 15, 2026"`, `"2026-01-15"`
- Pattern: `#"(\d{2}/\d{2}/\d{2})"` for MM/dd/yy
- Parser: `:date [:clj-time "MM/dd/yy"]`
**Customer Identifier:**
- Look for: `"Bill To: Customer Name"` or `"Sold To: Customer Name"`
- Pattern: `#"Bill To:\s+([A-Za-z\s]+?)(?=\s{2,}|\n)"`
- Use non-greedy `+?` and lookahead `(?=...)` to stop at boundaries
**Total:**
- Look for: `"Total: $100.00"` or `"Amount Due: 100.00"`
- Pattern: `#"Total:\s+\$?([\d,]+\.\d{2})"`
- Parser: `:total [:trim-commas nil]` removes commas
### Advanced Patterns
**Multi-line customer address:**
When customer info spans multiple lines (name + address):
```clojure
:customer-identifier #"(?s)I\s+([A-Z][A-Z\s]+?)\s{2,}.*?L\s+([0-9][A-Z0-9\s]+?)(?=\s{2,}|\n)"
:account-number #"(?s)L\s+([0-9][A-Z0-9\s]+?)(?=\s{2,}|\n)"
```
The `(?s)` flag makes `.` match newlines. Use non-greedy `+?` and lookaheads `(?=...)` to capture clean values.
**Multiple date formats:**
```clojure
:parser {:date [:clj-time ["MM/dd/yy" "yyyy-MM-dd"]]}
```
**Credit memos (negative amounts):**
```clojure
:parser {:total [:trim-commas-and-negate nil]}
```
## Testing Best Practices
1. IMPORTANT, CRITICAL!! **Start with a failing test** - Define expected values before implementing
2. **Test actual PDF parsing** - Use `parse-file` or `parse` with real PDF text
3. **Verify each field individually** - Separate assertions for clarity
4. **Handle date comparisons carefully** - Compare year/month/day separately if needed
5. **Use `str/trim`** - Account for extra whitespace in extracted values
## Example Test Structure
```clojure
(deftest parse-vendor-invoice-12345
(testing "Should parse Vendor invoice with expected values"
(let [results (sut/parse-file (io/file "dev-resources/INVOICE.pdf")
"INVOICE.pdf")
result (first results)]
(is (some? results) "Should return results")
(is (some? result) "Template should match")
(when result
(is (= "Vendor Name" (:vendor-code result)))
(is (= "12345" (:invoice-number result)))
(is (= "Customer Name" (:customer-identifier result)))
(is (= "100.00" (:total result)))))))
```
## Common Pitfalls
1. **Keywords must all match** - Every pattern in `:keywords` must be found in the PDF
2. **Capture groups required** - Regexes need `()` to extract values
3. **PDF text != visual text** - Layout may differ from what you see visually
4. **Greedy quantifiers** - Use `+?` instead of `+` to avoid over-matching
5. **Case sensitivity** - Regex is case-sensitive unless you use `(?i)` flag
## Post-Creation Checklist
After creating the template:
- [ ] Test passes: `lein test auto-ap.parse.templates-test`
- [ ] Format is correct: `lein cljfmt check`
- [ ] Code compiles: `lein check`
- [ ] Template is in correct position in `pdf-templates` vector
- [ ] Keywords uniquely identify this vendor (won't match other templates)
- [ ] Test file follows naming conventions
## Integration with Workflow
This skill is typically used as part of a larger workflow:
1. User provides PDF and requirements
2. This skill creates template and test
3. User reviews and refines if needed
4. Test is run to verify extraction
5. Code is committed
The skill ensures consistency with existing patterns and reduces manual boilerplate when adding new vendor support.

View File

@@ -0,0 +1,188 @@
# Invoice Template Examples
## Simple Single Invoice
```clojure
{:vendor "Gstar Seafood"
:keywords [#"G Star Seafood"]
:extract {:total #"Total\s{2,}([\d\-,]+\.\d{2,2}+)"
:customer-identifier #"(.*?)(?:\s+)Invoice #"
:date #"Invoice Date\s{2,}([0-9]+/[0-9]+/[0-9]+)"
:invoice-number #"Invoice #\s+(\d+)"}
:parser {:date [:clj-time "MM/dd/yyyy"]
:total [:trim-commas nil]}}
```
## Multi-Invoice Statement
```clojure
{:vendor "Southbay Fresh Produce"
:keywords [#"(SOUTH BAY FRESH PRODUCE|SOUTH BAY PRODUCE)"]
:extract {:date #"^([0-9]+/[0-9]+/[0-9]+)"
:customer-identifier #"To:[^\n]*\n\s+([A-Za-z' ]+)\s{2}"
:invoice-number #"INV #\/(\d+)"
:total #"\$([0-9.]+)\."}
:parser {:date [:clj-time "MM/dd/yyyy"]}
:multi #"\n"
:multi-match? #"^[0-9]+/[0-9]+/[0-9]+\s+INV "}
```
## Customer with Address (Multi-line)
```clojure
{:vendor "Bonanza Produce"
:keywords [#"530-544-4136"]
:extract {:invoice-number #"NO\s+(\d{8,})\s+\d{2}/\d{2}/\d{2}"
:date #"NO\s+\d{8,}\s+(\d{2}/\d{2}/\d{2})"
:customer-identifier #"(?s)I\s+([A-Z][A-Z\s]+?)\s{2,}.*?L\s+([0-9][A-Z0-9\s]+?)(?=\s{2,}|\n)"
:account-number #"(?s)L\s+([0-9][A-Z0-9\s]+?)(?=\s{2,}|\n)"
:total #"SHIPPED\s+[\d\.]+\s+TOTAL\s+([\d\.]+)"}
:parser {:date [:clj-time "MM/dd/yy"]
:total [:trim-commas nil]}}
```
## Credit Memo (Negative Amounts)
```clojure
{:vendor "General Produce Company"
:keywords [#"916-552-6495"]
:extract {:date #"DATE.*\n.*\n.*?([0-9]+/[0-9]+/[0-9]+)"
:invoice-number #"CREDIT NO.*\n.*\n.*?(\d{5,}?)\s+"
:account-number #"CUST NO.*\n.*\n\s+(\d+)"
:total #"TOTAL:\s+\|\s*(.*)"}
:parser {:date [:clj-time "MM/dd/yy"]
:total [:trim-commas-and-negate nil]}}
```
## Complex Date Parsing
```clojure
{:vendor "Ben E. Keith"
:keywords [#"BEN E. KEITH"]
:extract {:date #"Customer No Mo Day Yr.*?\n.*?\d{5,}\s{2,}(\d+\s+\d+\s+\d+)"
:customer-identifier #"Customer No Mo Day Yr.*?\n.*?(\d{5,})"
:invoice-number #"Invoice No.*?\n.*?(\d{8,})"
:total #"Total Invoice.*?\n.*?([\-]?[0-9]+\.[0-9]{2,})"}
:parser {:date [:month-day-year nil]
:total [:trim-commas-and-negate nil]}}
```
## Multiple Date Formats
```clojure
{:vendor "RNDC"
:keywords [#"P.O.Box 743564"]
:extract {:date #"(?:INVOICE|CREDIT) DATE\n(?:.*?)(\S+)\n"
:account-number #"Store Number:\s+(\d+)"
:invoice-number #"(?:INVOICE|CREDIT) DATE\n(?:.*?)\s{2,}(\d+?)\s+\S+\n"
:total #"Net Amount(?:.*\n){4}(?:.*?)([\-]?[0-9\.]+)\n"}
:parser {:date [:clj-time ["MM/dd/yy" "dd-MMM-yy"]]
:total [:trim-commas-and-negate nil]}}
```
## Common Regex Patterns
### Phone Numbers
```clojure
#"\(?[0-9]{3}\)?[-.\s]?[0-9]{3}[-.\s]?[0-9]{4}"
```
### Dollar Amounts
```clojure
#"\$?([0-9,]+\.[0-9]{2})"
```
### Dates (MM/dd/yy)
```clojure
#"([0-9]{2}/[0-9]{2}/[0-9]{2})"
```
### Dates (MM/dd/yyyy)
```clojure
#"([0-9]{2}/[0-9]{2}/[0-9]{4})"
```
### Multi-line Text (dotall mode)
```clojure
#"(?s)start.*?end"
```
### Non-greedy Match
```clojure
#"(pattern.+?)"
```
### Lookahead Boundary
```clojure
#"value(?=\s{2,}|\n)"
```
## Field Extraction Strategies
### 1. Simple Line-based
Use `[^\n]*` to match until end of line:
```clojure
#"Invoice:\s+([^\n]+)"
```
### 2. Whitespace Boundary
Use `(?=\s{2,}|\n)` to stop at multiple spaces or newline:
```clojure
#"Customer:\s+(.+?)(?=\s{2,}|\n)"
```
### 3. Specific Marker
Match until a specific pattern is found:
```clojure
#"(?s)Start(.*?)End"
```
### 4. Multi-part Extraction
Use multiple capture groups for related fields:
```clojure
#"Date:\s+(\d{2})/(\d{2})/(\d{2})"
```
## Parser Options
### Date Parsers
- `[:clj-time "MM/dd/yyyy"]` - Standard US date
- `[:clj-time "MM/dd/yy"]` - 2-digit year
- `[:clj-time "MMM dd, yyyy"]` - Named month
- `[:clj-time ["MM/dd/yy" "yyyy-MM-dd"]]` - Multiple formats
- `[:month-day-year nil]` - Space-separated (1 15 26)
### Number Parsers
- `[:trim-commas nil]` - Remove commas from numbers
- `[:trim-commas-and-negate nil]` - Handle negative/credit amounts
- `[:trim-commas-and-remove-dollars nil]` - Remove $ and commas
- `nil` - No parsing, return raw string
## Testing Patterns
### Basic Test Structure
```clojure
(deftest parse-vendor-invoice
(testing "Should parse vendor invoice"
(let [results (sut/parse-file (io/file "dev-resources/INVOICE.pdf")
"INVOICE.pdf")
result (first results)]
(is (some? result))
(is (= "Vendor" (:vendor-code result)))
(is (= "12345" (:invoice-number result))))))
```
### Date Testing
```clojure
(let [d (:date result)]
(is (= 2026 (time/year d)))
(is (= 1 (time/month d)))
(is (= 15 (time/day d))))
```
### Multi-field Verification
```clojure
(is (= "Expected Name" (:customer-identifier result)))
(is (= "Expected Street" (str/trim (:account-number result))))
(is (= "Expected City, ST 12345" (str/trim (:location result))))
```

View File

@@ -0,0 +1,248 @@
---
name: testing-conventions
description: Describe the way that tests should be authored, conventions, tools, helpers, superceding any conventions found in existing tests.
---
# Testing Conventions Skill
This skill documents the testing conventions for `test/clj/auto_ap/`.
## Test Focus: User-Observable Behavior
**Primary rule**: Test user-observable behavior. If an endpoint or function makes a database change, verify the change by querying the database directly rather than asserting on markup.
**other rules**:
1. Don't test the means of doing work. For example, if there is a middleware that makes something available on a request, don't bother testing that wrapper.
2. prefer :refer testing imports, rather than :as reference
3. Prefer structured edits from clojure-mcp
### When to Assert on Database State
When testing an endpoint that modifies data:
1. Verify the database change by querying the entity directly
2. Use `dc/pull` or `dc/q` to verify the data was stored correctly
```clojure
;; CORRECT: Verify the database change directly
(deftest test-create-transaction
(let [result @(post-create-transaction {:amount 100.0})]
(let [entity (dc/pull (dc/db conn) [:db/id :transaction/amount] (:transaction/id result))]
(is (= 100.0 (:transaction/amount entity))))))
;; CORRECT: Verify response status and headers
(is (= 201 (:status response)))
(is (= "application/json" (get-in response [:headers "content-type"])))
;; CORRECT: Check for expected text content
(is (re-find #"Transaction created" (get-in response [:body "message"])))
```
### When Markup Testing is Acceptable
Markup testing (HTML/SSR response bodies) is acceptable when:
- Validating response status codes and headers
- Checking for presence/absence of specific text strings
- Verifying small, expected elements within the markup
- Testing SSR component rendering
```clojure
;; ACCEPTABLE: Response codes and headers
(is (= 200 (:status response)))
(is (= "application/json" (get-in response [:headers "content-type"])))
;; ACCEPTABLE: Text content within markup
(is (re-find #"Transaction found" response-body))
;; ACCEPTABLE: Small element checks
(is (re-find #">Amount: \$100\.00<" response-body))
```
### When to Avoid Markup Testing
Do not use markup assertions for:
- Verifying complex data structures (use database queries instead)
- Complex nested content that's easier to query
- Business logic verification (test behavior, not presentation)
## Database Setup
All tests in `test/clj/auto_ap/` use a shared database fixture (`wrap-setup`) that:
1. Creates a temporary in-memory Datomic database (`datomic:mem://test`)
2. Loads the full schema from `io/resources/schema.edn`
3. Installs custom Datomic functions from `io/resources/functions.edn`
4. Cleans up the database after each test
## Using the Fixture
```clojure
(ns my-test
(:require
[auto-ap.integration.util :refer [wrap-setup]]
[clojure.test :as t]))
(use-fixtures :each wrap-setup)
(deftest my-test
;; tests here can access the test database
)
```
## Helper Functions
`test/clj/auto_ap/integration/util.clj` provides helper functions for creating test data:
### Identity Helpers
```clojure
;; Add a unique string to avoid collisions
(str "CLIENT" (rand-int 100000))
(str "INVOICE " (rand-int 1000000))
```
### Test Entity Builders
```clojure
;; Client
(test-client
[:db/id "client-id"
:client/code "CLIENT123"
:client/locations ["DT" "MH"]
:client/bank-accounts [:bank-account-id]])
;; Vendor
(test-vendor
[:db/id "vendor-id"
:vendor/name "Vendorson"
:vendor/default-account "test-account-id"])
;; Bank Account
(test-bank-account
[:db/id "bank-account-id"
:bank-account/code "TEST-BANK-123"
:bank-account/type :bank-account-type/check])
;; Transaction
(test-transaction
[:db/id "transaction-id"
:transaction/date #inst "2022-01-01"
:transaction/client "test-client-id"
:transaction/bank-account "test-bank-account-id"
:transaction/id (str (java.util.UUID/randomUUID))
:transaction/amount 100.0
:transaction/description-original "original description"])
;; Payment
(test-payment
[:db/id "test-payment-id"
:payment/date #inst "2022-01-01"
:payment/client "test-client-id"
:payment/bank-account "test-bank-account-id"
:payment/type :payment-type/check
:payment/vendor "test-vendor-id"
:payment/amount 100.0])
;; Invoice
(test-invoice
[:db/id "test-invoice-id"
:invoice/date #inst "2022-01-01"
:invoice/client "test-client-id"
:invoice/status :invoice-status/unpaid
:invoice/import-status :import-status/imported
:invoice/total 100.0
:invoice/outstanding-balance 100.00
:invoice/vendor "test-vendor-id"
:invoice/invoice-number "INVOICE 123456"
:invoice/expense-accounts
[{:invoice-expense-account/account "test-account-id"
:invoice-expense-account/amount 100.0
:invoice-expense-account/location "DT"}]])
;; Account
(test-account
[:db/id "account-id"
:account/name "Account"
:account/type :account-type/asset])
```
### Common Data Setup (`setup-test-data`)
Creates a minimal but complete dataset for testing:
```clojure
(defn setup-test-data [data]
(:tempids @(dc/transact conn (into data
[(test-account :db/id "test-account-id")
(test-client :db/id "test-client-id"
:client/bank-accounts [(test-bank-account :db/id "test-bank-account-id")])
(test-vendor :db/id "test-vendor-id")
{:db/id "accounts-payable-id"
:account/name "Accounts Payable"
:db/ident :account/accounts-payable
:account/numeric-code 21000
:account/account-set "default"}]))))
```
Use like:
```clojure
(let [{:strs [test-client-id test-bank-account-id test-vendor-id]} (setup-test-data [])]
...)
```
### Token Helpers
```clojure
;; Admin token
(admin-token)
;; User token (optionally scoped to specific client)
(user-token) ; Default: client-id 1
(user-token client-id) ; Scoped to specific client
```
## Example Usage
```clojure
(ns my-test
(:require
[clojure.test :as t]
[auto-ap.datomic :refer [conn]]
[auto-ap.integration.util :refer [wrap-setup admin-token setup-test-data test-transaction]]))
(use-fixtures :each wrap-setup)
(deftest test-transaction-import
(testing "Should import a transaction"
(let [{:strs [client-id bank-account-id]} (setup-test-data [])
tx-result @(dc/transact conn
[(test-transaction
{:db/id "test-tx-id"
:transaction/client client-id
:transaction/bank-account bank-account-id
:transaction/amount 50.0})])]
(is (= 1 (count (:tx-data tx-result))))
;; Verify by querying the database, not markup
(let [entity (dc/pull (dc/db conn) [:transaction/amount] (:db/id tx-result))]
(is (= 50.0 (:transaction/amount entity)))))))
```
## Note on Temp IDs
Test data often uses string-based temp IDs like `"client-id"`, `"bank-account-id"`, etc. When transacting, the returned `:tempids` map maps these symbolic IDs to Datomic's internal entity IDs:
```clojure
(let [{:strs [client-id bank-account-id]} (:tempids @(dc/transact conn txes))]
...)
```
## Memory Database
All tests use `datomic:mem://test` - an in-memory database. This ensures:
- Tests are fast
- Tests don't interfere with each other
- No setup required to run tests locally
The database is automatically deleted after each test completes.
# running tests
prefer to use clojure nrepl evaluation skill over leiningen, but worst case,
use leiningen to run tests

154
AGENTS.md Normal file
View File

@@ -0,0 +1,154 @@
# Integreat Development Guide
## Build & Run Commands
### Build
```bash
lein build # Create uberjar
lein uberjar # Standalone JAR
npm install # Install Node.js dependencies (for frontend build)
```
### Development
```bash
docker-compose up -d # Start Datomic, Solr services
lein repl # Start Clojure REPL (nREPL on port 9000), typically one will be running for you already
lein cljfmt check # Check code formatting
lein cljfmt fix # Auto-format code
clj-paren-repair [FILE ...] # fix parentheses in files
clj-nrepl-eval -p PORT "(+ 1 2 3)" # evaluate clojure code
```
Often times, if a file won't compile, first clj-paren-repair on the file, then try again. If it doesn't wor still, try cljfmt check.
### Running the Application
```bash
INTEGREAT_JOB="" lein run # Default: port 3000
# Or with custom port:
PORT=3449 lein run
```
## Test Execution
prefer using clojure-eval skill
### Run All Tests
```bash
lein test # WORST CASE
```
### Run Specific Test Selectors
```bash
lein test :integration # WORST CASE
lein test :functional #WORST CASE
```
### Run Specific Test File
```bash
clj-nrepl-eval -p PORT "(clojure.test/run-tests 'auto-ap.import.plaid-test)" # preferred method
lein test auto-ap.import.plaid-test #WORST CASE
```
### Run Specific Test Function
```bash
lein test auto-ap.import.plaid-test/plaid->transaction #WORST CASE
```
## Code Style Guidelines
### File Organization
- Namespaces follow `auto-ap.*` format
- Source files in `src/clj/auto_ap/`
- Test files in `test/clj/auto_ap/`
- Backend: Clojure 1.10.1
- Frontend: alpinejs + TailwindCSS + HTMX
### Import Formatting
- Imports must be sorted alphabetically within each group
- Standard library imports first (`clojure.core`, `clojure.string`, etc.)
- Third-party libraries second
- Internal library imports last
- Group related imports together
**Example:**
```clojure
(ns auto-ap.example
(:require
[auto-ap.datomic :refer [conn pull-many]]
[auto-ap.graphql.utils :refer [limited-clients]]
[clojure.data.json :as json]
[clojure.string :as str]
[com.brunobonacci.mulog :as mu]
[datomic.api :as dc]))
```
### Naming Conventions
- Namespace names: `auto-ap.<feature>.<sub-feature>`
- File names: kebab-case (e.g., `ledger_common.clj`)
- Functions: lowercase with underscores, descriptive (e.g., `fetch-ids`, `process-invoice`)
- Database identifiers: use `:db/id` keyword, not string IDs
- Entity attributes: follow schema convention (e.g., `:invoice/status`)
### Data Types & Schema
- Use keywords for schema accessors (e.g., `:invoice/date` instead of strings)
- Datomic pull queries use `[:db/id ...]` syntax
- Use `:db/ident` for schema keyword resolution
- Dates and times: use `inst` types (handled by `clj-time.coerce`)
- Numbers: use `double` for monetary values (stored as strings in DB, converted to double)
### Error Handling
- Use `slingshot.slingshot` library for error handling
- Pattern: `(exception->notification #(throw ...))` to wrap errors with logging
- Pattern: `(notify-if-locked client-id invoice-date)` for business logic checks
- Throw `ex-info` with metadata for structured exceptions
- Use `throw+` for throwing exceptions that can be caught by `slingshot`
**Example:**
```clojure
(exception->notification
(when-not (= :invoice-status/unpaid (:invoice/status invoice))
(throw (ex-info "Cannot void an invoice if it is paid."
{:type :notification}))))
```
### Function Definitions
- Use `defn` for public functions
- Use `defn-` for private functions (indicated by underscore prefix)
- Use `letfn` for locally recursive functions
- Use `cond` and `condp` for conditional logic
- Use `case` for exhaustive keyword matching
### Testing Patterns
- Use `clojure.test` with `deftest` and `testing`
- Group related tests in `testing` blocks
- Use `is` for assertions with descriptive messages
- Use `are` for parameterized assertions
- Fixtures with `use-fixtures` for setup/teardown
**Example:**
```clojure
(deftest import-invoices
(testing "Should import valid invoice"
(is (= 1 (invoice-count-for-client [:client/code "ABC"]))))
(testing "Should not import duplicate invoice"
(is (thrown? Exception (sut/import-uploaded-invoice user invoices)))))
```
look at the testing-conventions skill for more detail
### Code Formatting & Documentation
- Use `lein cljfmt check` before committing, auto-fix with `lein cljfmt fix`
- Use `#_` for commenting out entire forms (not single lines)
- Use `comment` special form for evaluation examples
- Use `#_` to comment out library dependencies in project.clj
### Logging
- Uses `com.brunobonacci.mulog` for structured logging
- Import with `(require [auto-ap.logging :as alog])`
- Use `alog/info`, `alog/warn`, `alog/error` for different log levels
- Use `alog/with-context-as` to add context to log messages
## Linting Configuration
- Uses `clj-kondo` for static analysis
- Custom linters configured in `.clj-kondo/config.edn`
- Hooks for `mount.core/defstate` and `auto-ap.logging` in `.clj-kondo/hooks/`
- Run `clj-kondo --lint src/clj auto_ap/` for linting

125
CLAUDE.md Normal file
View File

@@ -0,0 +1,125 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
Integreat is a full-stack web application for accounts payable (AP) and accounting automation. It integrates with multiple financial data sources (Plaid, Yodlee, Square, Intuit QBO) to manage invoices, bank accounts, transactions, and vendor information.
**Tech Stack:**
- Backend: Clojure 1.10.1 with Ring (Jetty), Datomic database, GraphQL (Lacinia, in process of depracation)
- Frontend, two versions:
* ClojureScript with Reagent, Re-frame, (almost depracated)
* Server side: HTMX, TailwindCSS, alpinejs (current)
- Java: Amazon Corretto 11 (required for Clojure 1.10.1)
## Development Commands
**Build:**
```bash
lein build # Create uberjar
lein uberjar # Standalone JAR
npm install # Install Node.js dependencies (for frontend build)
```
### Development
```bash
docker-compose up -d # Start Datomic, Solr services
lein repl # Start Clojure REPL (nREPL on port 9000), typically one will be running for you already
lein cljfmt check # Check code formatting
lein cljfmt fix # Auto-format code
clj-paren-repair [FILE ...] # fix parentheses in files
clj-nrepl-eval -p PORT "(+ 1 2 3)" # evaluate clojure code
```
Often times, if a file won't compile, first clj-paren-repair on the file, then try again. If it doesn't wor still, try cljfmt check.
**Running the Application:**
**As Web Server:**
```bash
INTEGREAT_JOB="" lein run # Default: port 3000
# Or with custom port:
PORT=3449 lein run
```
**As Background Job:**
Set `INTEGREAT_JOB` environment variable to one of:
- `square-import-job` - Square POS transaction sync
- `yodlee2` - Yodlee bank account sync
- `plaid` - Plaid bank linking
- `intuit` - Intuit QBO sync
- `import-uploaded-invoices` - Process uploaded invoice PDFs
- `ezcater-upsert` - EZcater PO sync
- `ledger_reconcile` - Ledger reconciliation
- `bulk_journal_import` - Journal entry import
- (no job) - Run web server + nREPL
## Architecture
**Request Flow:**
1. Ring middleware pipeline processes requests
2. Authentication/authorization middleware (Buddy) wraps handlers
3. Bidi routes dispatch to handlers
4. SSR (server-side rendering) generates HTML with Hiccup for main views
5. For interactive pages, HTMX handles partial updates
6. Client-side uses alpinejs as a bonus
**Multi-tenancy:**
- Client-based filtering via `:client/code` and `:client/groups`
- Client selection via `X-Clients` header or session
- Role-based permissions: admin, standard user, vendor
**Key Directories:**
- `src/clj/auto_ap/` - Backend Clojure code
- `src/clj/auto_ap/server.clj` - Main entry point, job dispatcher, Mount lifecycle
- `src/clj/auto_ap/handler.clj` - Ring app, middleware stack
- `src/clj/auto_ap/datomic/` - Datomic schema and queries
- `src/clj/auto_ap/ssr/` - Server-side rendered page handlers (Hiccup templates)
- `src/clj/auto_ap/routes/` - HTTP route definitions
- `src/clj/auto_ap/jobs/` - Background batch jobs
- `src/clj/auto_ap/graphql/` - GraphQL type definitions and resolvers
- `src/cljs/auto_ap/` - Frontend ClojureScript for old, depracated version
- `test/clj/auto_ap/` - Unit/integration tests
## Database
- Datomic schema defined in `resources/schema.edn`
- Key entity patterns:
- `:client/code`, `:client/groups` for multi-tenancy
- `:vendor/*`, `:invoice/*`, `:transaction/*`, `:account/*` for standard entities
- `:db/type/ref` for relationships, many with `:db/cardinality :db.cardinality/many`
## Configuration
- Dev config: `config/dev.edn` (set via `-Dconfig=config/dev.edn`)
- Env vars: `INTEGREAT_JOB`, `PORT`
- Docker: Uses Alpine-based Amazon Corretto 11 image
## Important Patterns
- **Middleware stack** in `handler.clj`: route matching → logging → client hydration → session/auth → idle timeout → error handling → gzip
- **Client context** added by middleware: `:identity`, `:clients`, `:client`, `:matched-route`
- **Job dispatching** in `server.clj`: checks `INTEGREAT_JOB` env var to run specific background jobs or start web server
- **Test selectors**: namespaces ending in `integration` or `functional` are selected by `lein test :integration` / `lein test :functional`
## Clojure REPL Evaluation
The command `clj-nrepl-eval` is installed on your path for evaluating Clojure code via nREPL.
**Discover nREPL servers:**
`clj-nrepl-eval --discover-ports`
**Evaluate code:**
`clj-nrepl-eval -p <port> "<clojure-code>"`
With timeout (milliseconds)
`clj-nrepl-eval -p <port> --timeout 5000 "<clojure-code>"`
The REPL session persists between evaluations - namespaces and state are maintained.
Always use `:reload` when requiring namespaces to pick up changes.

View File

@@ -1,6 +1,5 @@
FROM 679918342773.dkr.ecr.us-east-1.amazonaws.com/corretto:latest
RUN yum update -y
RUN yum install -y poppler-utils
FROM amazoncorretto:11-alpine
RUN apk add --no-cache poppler-utils
COPY target/auto-ap.jar /usr/local/
COPY config /usr/local/config/
CMD java -Dlogback.configurationFile=logback-prod.xml -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.rmi.port=9090 -Djava.rmi.server.hostname=127.0.0.1 -Dcom.sun.management.jmxremote.local.only=false -XX:InitialRAMPercentage=20 -XX:MaxRAMPercentage=84 -XX:-OmitStackTraceInFastThrow -cp /usr/local/auto-ap.jar clojure.main -m auto-ap.server

BIN
dev-resources/13595522.pdf Normal file

Binary file not shown.

View File

@@ -0,0 +1,27 @@
1,121142287,121142287,230808,1435,1,,,2/,,,,,,
2,,121142287,1,230807,,USD,2/,,,,,,,
3,502009095,USD,15,4471085,0,,40,7416920,0,,45,4471085,0,/
16,191,1104372,,,,TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX9103/,,,,,,,,
16,451,4050207,,19620409,,AMEX EPAYMENT ACH PMT A8334/,,,,,,,,
49,21513669,4/,,,,,,,,,,,,
3,502006000,USD,15,5533562,0,,40,4784698,0,,45,5533562,0,/
16,108,18815,,142939792,,Deposit/,,,,,,,,
16,108,17955,,142939789,,Deposit/,,,,,,,,
16,108,17530,,142939793,,Deposit/,,,,,,,,
16,108,15340,,142939795,,Deposit/,,,,,,,,
16,108,15290,,142939794,,Deposit/,,,,,,,,
16,108,14735,,142939790,,Deposit/,,,,,,,,
16,108,14140,,142939791,,Deposit/,,,,,,,,
16,191,747488,,,,TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX8469/,,,,,,,,
16,191,85171,,,,TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX8451/,,,,,,,,
16,475,197600,,910147509,1196,Check Paid/,,,,,,,,
49,16995886,12/,,,,,,,,,,,,
3,502009137,USD,15,4153082,0,,40,3572123,0,,45,4153082,0,/
16,191,572495,,,,TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX9145/,,,,,,,,
16,191,58464,,,,TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX9152/,,,,,,,,
16,475,50000,,910039240,547,Check Paid/,,,,,,,,
49,12559246,5/,,,,,,,,,,,,
3,502008527,USD,15,0,0,,40,0,0,,45,0,0,/
49,0,2/,,,,,,,,,,,,
98,51068801,4,25/,,,,,,,,,,,
99,51068801,1,27/,,,,,,,,,,,
1 1 121142287 121142287 230808 1435 1 2/
2 2 121142287 1 230807 USD 2/
3 3 502009095 USD 15 4471085 0 40 7416920 0 45 4471085 0 /
4 16 191 1104372 TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX9103/
5 16 451 4050207 19620409 AMEX EPAYMENT ACH PMT A8334/
6 49 21513669 4/
7 3 502006000 USD 15 5533562 0 40 4784698 0 45 5533562 0 /
8 16 108 18815 142939792 Deposit/
9 16 108 17955 142939789 Deposit/
10 16 108 17530 142939793 Deposit/
11 16 108 15340 142939795 Deposit/
12 16 108 15290 142939794 Deposit/
13 16 108 14735 142939790 Deposit/
14 16 108 14140 142939791 Deposit/
15 16 191 747488 TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX8469/
16 16 191 85171 TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX8451/
17 16 475 197600 910147509 1196 Check Paid/
18 49 16995886 12/
19 3 502009137 USD 15 4153082 0 40 3572123 0 45 4153082 0 /
20 16 191 572495 TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX9145/
21 16 191 58464 TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX9152/
22 16 475 50000 910039240 547 Check Paid/
23 49 12559246 5/
24 3 502008527 USD 15 0 0 40 0 0 45 0 0 /
25 49 0 2/
26 98 51068801 4 25/
27 99 51068801 1 27/

View File

@@ -0,0 +1,27 @@
1,121142287,121142287,230808,1435,1,,,2/,,,,,,
2,,121142287,1,230807,,USD,2/,,,,,,,
3,502009095,USD,15,4471085,0,,40,7416920,0,,45,4471085,0,/
16,191,1104372,,,,TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX9103/,,,,,,,,
16,451,4050207,,19620409,,AMEX EPAYMENT ACH PMT A8334/,,,,,,,,
49,21513669,4/,,,,,,,,,,,,
3,502006000,USD,15,5533562,0,,40,4784698,0,,45,5533562,0,/
16,108,18815,,142939792,,Deposit/,,,,,,,,
16,108,17955,,142939789,,Deposit/,,,,,,,,
16,108,17530,,142939793,,Deposit/,,,,,,,,
16,108,15340,,142939795,,Deposit/,,,,,,,,
16,108,15290,,142939794,,Deposit/,,,,,,,,
16,108,14735,,142939790,,Deposit/,,,,,,,,
16,108,14140,,142939791,,Deposit/,,,,,,,,
16,191,747488,,,,TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX8469/,,,,,,,,
16,191,85171,,,,TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX8451/,,,,,,,,
16,475,197600,,910147509,1196,Check Paid/,,,,,,,,
49,16995886,12/,,,,,,,,,,,,
3,502009137,USD,15,4153082,0,,40,3572123,0,,45,4153082,0,/
16,191,572495,,,,TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX9145/,,,,,,,,
16,191,58464,,,,TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX9152/,,,,,,,,
16,475,50000,,910039240,547,Check Paid/,,,,,,,,
49,12559246,5/,,,,,,,,,,,,
3,502008527,USD,15,0,0,,40,0,0,,45,0,0,/
49,0,2/,,,,,,,,,,,,
98,51068801,4,25/,,,,,,,,,,,
99,51068801,1,27/,,,,,,,,,,,
1 1 121142287 121142287 230808 1435 1 2/
2 2 121142287 1 230807 USD 2/
3 3 502009095 USD 15 4471085 0 40 7416920 0 45 4471085 0 /
4 16 191 1104372 TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX9103/
5 16 451 4050207 19620409 AMEX EPAYMENT ACH PMT A8334/
6 49 21513669 4/
7 3 502006000 USD 15 5533562 0 40 4784698 0 45 5533562 0 /
8 16 108 18815 142939792 Deposit/
9 16 108 17955 142939789 Deposit/
10 16 108 17530 142939793 Deposit/
11 16 108 15340 142939795 Deposit/
12 16 108 15290 142939794 Deposit/
13 16 108 14735 142939790 Deposit/
14 16 108 14140 142939791 Deposit/
15 16 191 747488 TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX8469/
16 16 191 85171 TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX8451/
17 16 475 197600 910147509 1196 Check Paid/
18 49 16995886 12/
19 3 502009137 USD 15 4153082 0 40 3572123 0 45 4153082 0 /
20 16 191 572495 TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX9145/
21 16 191 58464 TRANSFER FROM BASIC BUSINESS CHECK ACCOUNT XXXXXX9152/
22 16 475 50000 910039240 547 Check Paid/
23 49 12559246 5/
24 3 502008527 USD 15 0 0 40 0 0 45 0 0 /
25 49 0 2/
26 98 51068801 4 25/
27 99 51068801 1 27/

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,703 @@
---
title: feat: Add BDD tests for admin financial account creation (ssr)
type: feat
date: 2026-02-06
---
# Add BDD Tests for Admin Financial Account Creation (SSR)
## Overview
This feature aims to add Behavior-Driven Development (BDD) tests for admin users creating financial accounts using Server-Side Rendering (SSR). The tests will cover the complete account creation flow, validation logic, duplicate detection, and Solr indexing integration.
## Problem Statement
Currently, the project lacks BDD-style tests for admin financial account creation. Tests exist using Clojure.test but follow a unit/integration pattern rather than BDD Given-When-Then scenarios. This creates several challenges:
1. **Unclear test intent**: Tests verify database state directly without clear behavioral descriptions
2. **Difficulty for new developers**: BDD scenarios provide clearer user flow documentation
3. **Limited edge case coverage**: Current tests may miss important business logic edge cases
4. **No validation testing**: Duplicate detection and validation logic lacks comprehensive test coverage
## Proposed Solution
Implement BDD-style tests for admin financial account creation following project conventions. Tests will:
- Use Given-When-Then structure for clear behavioral descriptions
- Test both success and failure scenarios
- Verify database state changes after operations
- Test Solr indexing after account creation
- Test authorization (admin-only access)
- Cover validation errors and duplicate detection
## Technical Considerations
### Architecture Impact
- Tests will be added to `test/clj/auto_ap/ssr/admin/accounts_test.clj`
- Tests will use existing test utilities: `wrap-setup`, `admin-token`, `setup-test-data`
- Tests will verify database state using Datomic `dc/pull` and `dc/q`
- Tests will follow project convention of testing user-observable behavior
### Performance Implications
- Tests will use in-memory Datomic for fast iteration
- Each test will run independently with its own setup/teardown
- Solr indexing will be tested in-memory (using mocked Solr client)
### Security Considerations
- Tests will use admin tokens (`admin-token` utility)
- Non-admin access attempts will be tested and rejected
- JWT validation will be tested for proper authorization
## Acceptance Criteria
### Functional Requirements
- [ ] Test 1: Admin successfully creates account with valid data
- Given: Admin is logged in with valid token
- When: Admin submits valid account creation form
- Then: Account is created successfully in database
- Then: Account appears in account table
- Then: Account is indexed in Solr search
- [ ] Test 2: Account appears in database with correct attributes
- Given: Account was created
- When: Account is queried from database
- Then: Account has correct numeric code, name, type, location
- Then: Account has auto-generated ID
- Then: Account timestamps are set correctly
- [ ] Test 3: Validation errors for invalid data
- Given: Admin submits invalid account form
- When: Form validation fails
- Then: Appropriate validation error is shown
- Then: No account is created
- [ ] Test 4: Duplicate numeric code detection
- Given: Account with same numeric code already exists
- When: Admin submits form with duplicate code
- Then: Duplicate check fails
- Then: Validation error is shown
- Then: No account is created
- [ ] Test 5: Duplicate account name detection
- Given: Account with same name already exists
- When: Admin submits form with duplicate name
- Then: Duplicate check fails
- Then: Validation error is shown
- Then: No account is created
- [ ] Test 6: Account searchability in Solr
- Given: Account was created
- When: Solr query is performed
- Then: Account appears in search results
- Then: Can search by numeric code
- Then: Can search by account name
- [ ] Test 7: Non-admin access is denied
- Given: Non-admin user token
- When: Non-admin attempts to create account
- Then: Request is rejected with 403 Forbidden
- Then: No account is created
- [ ] Test 8: Client override validation
- Given: Account creation form includes client overrides
- When: Overrides contain duplicate client names
- Then: Validation error is shown
- Then: No account is created
- [ ] Test 9: Account update functionality
- Given: Account exists in database
- When: Admin updates account attributes
- Then: Account is updated successfully
- Then: Solr index is updated
- Then: Account in table reflects changes
### Non-Functional Requirements
- [ ] Tests use existing test utilities (`wrap-setup`, `admin-token`, etc.)
- [ ] Tests follow project BDD style conventions
- [ ] Tests verify user-observable behavior (database state)
- [ ] Tests are isolated with proper setup/teardown
- [ ] Test execution time < 5 seconds per test
- [ ] Tests use `lein test` selector for running
### Quality Gates
- [ ] Test coverage for account creation flow > 80%
- [ ] All tests pass on initial run
- [ ] Tests run with `lein test :integration` and `lein test :functional`
- [ ] Test file follows project naming conventions (`auto-ap.ssr.admin.accounts-test`)
- [ ] Code formatting verified with `lein cljfmt check`
## Success Metrics
- [ ] 9 BDD test scenarios implemented and passing
- [ ] Clear Given-When-Then documentation for each test
- [ ] Tests cover happy path, validation errors, and edge cases
- [ ] No regression in existing account creation functionality
- [ ] Tests provide clear documentation for developers
- [ ] Tests can be run in parallel without conflicts
## Dependencies & Risks
### Prerequisites
- Existing Datomic database schema for accounts
- Existing SSR admin module (`src/clj/auto_ap/ssr/admin/accounts.clj`)
- Existing test utilities in `test/clj/auto_ap/integration/util.clj`
- In-memory Solr client for testing
### Potential Risks
1. **Time Risk**: Comprehensive BDD test coverage may take longer than estimated
- Mitigation: Focus on critical tests first, add edge cases in follow-up PRs
2. **Complexity Risk**: Solr indexing may be difficult to test in isolation
- Mitigation: Use mocked Solr client with in-memory index
3. **Regression Risk**: New tests may fail due to changes in production code
- Mitigation: Run full test suite after each test implementation
- Mitigation: Use feature flags for test environment
4. **Duplicate Detection Complexity**: Duplicate check logic may have edge cases
- Mitigation: Review existing implementation, add targeted tests for each edge case
## Implementation Plan
### Phase 1: Foundation (1-2 hours)
**Tasks:**
1. [ ] Review existing account creation code
- Read `src/clj/auto_ap/ssr/admin/accounts.clj`
- Identify `account-save` function and validation logic
- Identify duplicate check logic
- Identify Solr indexing logic
2. [ ] Review existing test patterns
- Read `test/clj/auto_ap/ssr/invoice/new_invoice_wizard_test.clj`
- Read `test/clj/auto_ap/integration/graphql/accounts.clj`
- Understand `wrap-setup`, `admin-token`, `setup-test-data` utilities
- Review test structure and conventions
3. [ ] Create test directory structure
- Create `test/clj/auto_ap/ssr/admin/` directory if not exists
- Verify namespace conventions and naming
**Deliverable:**
- Clear understanding of account creation flow
- Test file template created
- Setup environment ready
### Phase 2: Core Tests (3-4 hours)
**Task 1: Account Creation Success Test**
4. [ ] Create basic test structure
- Create `test/clj/auto_ap/ssr/admin/accounts_test.clj`
- Define namespace with required imports
- Set up test fixtures (`wrap-setup`, `admin-token`)
5. [ ] Implement Test 1: Admin creates account successfully
```clojure
(deftest account-creation-success
(testing "Admin should be able to create a new financial account"
;; Given: Admin is logged in
(let [admin-identity (admin-token)]
;; When: Admin submits valid account creation form
(let [form-params {:account/numeric-code 12345
:account/name "New Cash Account"
:account/type :account-type/asset
:account/location "B"
:account/default-allowance :allowance/allowed}
result (sut/account-save {:form-params form-params
:request-method :post
:identity admin-identity})]
;; Then: Account should be created successfully
(is (= :success (:status result)))
;; And: Account should appear in database
(let [db-after (dc/db conn)
created-account (dc/pull db-after
'[:db/id
:account/code
:account/name
:account/numeric-code
:account/location
:account/type
{[:account/type :xform iol-ion.query/ident] :db/ident}]
(get result [:tempids "new"]))]
(is (= 12345 (:account/numeric-code created-account)))
(is (= "New Cash Account" (:account/name created-account)))))))
```
6. [ ] Verify Test 1 passes
- Run `lein test auto-ap.ssr.admin.accounts-test/account-creation-success`
- Fix any failures
- Verify test output is clear
**Deliverable:**
- Test 1 passes successfully
- Basic test framework in place
**Task 2: Account Database Verification Test**
7. [ ] Implement Test 2: Account appears in database
```clojure
(deftest account-appears-in-database
(testing "Created account should have correct attributes in database"
(let [admin-identity (admin-token)
form-params {:account/numeric-code 12346
:account/name "Cash Account"
:account/type :account-type/asset
:account/location "C"}
result @(sut/account-save {:form-params form-params
:request-method :post
:identity admin-identity})]
;; Then: Account has correct attributes
(let [db-after (dc/db conn)
account-id (get result [:tempids "new"])
account (dc/pull db-after
'[:db/id
:account/code
:account/name
:account/numeric-code
:account/location
:account/type]
account-id)]
(is (= "Cash Account" (:account/name account)))
(is (= 12346 (:account/numeric-code account)))
(is (= "C" (:account/location account)))))))
```
8. [ ] Implement helper function for cleanup
- Create `setup-account-with-code` helper function
- Create teardown logic to remove test accounts
- Use test fixture for automatic cleanup
9. [ ] Verify Test 2 passes
- Run test
- Fix failures
- Test cleanup works correctly
**Deliverable:**
- Test 2 passes successfully
- Cleanup helper functions implemented
**Task 3: Validation Error Tests**
10. [ ] Implement Test 3: Empty name validation error
```clojure
(deftest account-creation-validation-error-empty-name
(testing "Should show validation error when name is empty"
(let [admin-identity (admin-token)
form-params {:account/numeric-code 12347
:account/name ""
:account/type :account-type/asset}
result (sut/account-save {:form-params form-params
:request-method :post
:identity admin-identity})]
(is (not= :success (:status result)))
(is (some #(str/includes? (first %) "Name") (:form-errors result)))))))
```
11. [ ] Implement Test 4: Invalid account type validation error
```clojure
(deftest account-creation-validation-error-invalid-type
(testing "Should show validation error when account type is invalid"
(let [admin-identity (admin-token)
form-params {:account/numeric-code 12348
:account/name "Test Account"
:account/type :account-type/invalid-type}
result (sut/account-save {:form-params form-params
:request-method :post
:identity admin-identity})]
(is (not= :success (:status result)))
(is (some #(str/includes? (first %) "Type") (:form-errors result)))))))
```
12. [ ] Implement Test 5: Numeric code format validation
- Test negative numbers
- Test non-numeric characters
- Test leading zeros
- Test very long codes
13. [ ] Verify validation tests pass
- Run each validation test
- Fix failures
- Verify error messages are clear
**Deliverable:**
- Tests 3, 4, 5 pass successfully
- Validation error scenarios covered
**Task 4: Duplicate Detection Tests**
14. [ ] Implement helper to create test account
```clojure
(defn setup-account-with-code [code name type]
(setup-test-data [{:db/id "existing-account-1"
:account/numeric-code code
:account/account-set "default"
:account/name name
:account/type type
:account/location "A"}]))
```
15. [ ] Implement Test 6: Duplicate numeric code detection
```clojure
(deftest account-creation-duplicate-code
(testing "Should detect and reject duplicate numeric code"
(let [admin-identity (admin-token)
_ (setup-account-with-code 12345 "Existing Account" :account-type/asset)
form-params {:account/numeric-code 12345
:account/name "New Account"
:account/type :account-type/asset}
result (sut/account-save {:form-params form-params
:request-method :post
:identity admin-identity})]
(is (not= :success (:status result)))
(is (some #(str/includes? (first %) "code") (:form-errors result)))
;; Verify no new account was created
(let [db-after (dc/db conn)
accounts (dc/q '[:find ?e
:where [?e :account/numeric-code 12345]]
db-after)]
(is (= 1 (count accounts)))))))
```
16. [ ] Implement Test 7: Duplicate account name detection
```clojure
(deftest account-creation-duplicate-name
(testing "Should detect and reject duplicate account name"
(let [admin-identity (admin-token)
_ (setup-account-with-code 12346 "Cash Account" :account-type/asset)
form-params {:account/numeric-code 12347
:account/name "Cash Account"
:account/type :account-type/asset}
result (sut/account-save {:form-params form-params
:request-method :post
:identity admin-identity})]
(is (not= :success (:status result)))
(is (some #(str/includes? (first %) "name") (:form-errors result)))
;; Verify no new account was created
(let [db-after (dc/db conn)
accounts (dc/q '[:find ?e
:where [?e :account/name "Cash Account"]]
db-after)]
(is (= 1 (count accounts)))))))
```
17. [ ] Implement Test 8: Case-insensitive duplicate detection
- Test "Cash" vs "cash" duplicates
- Test "CASH" vs "Cash" duplicates
- Verify case-sensitivity handling
18. [ ] Verify duplicate detection tests pass
- Run each duplicate test
- Fix failures
- Verify no account created on duplicates
**Deliverable:**
- Tests 6, 7, 8 pass successfully
- Duplicate detection logic thoroughly tested
**Task 5: Solr Indexing Tests**
19. [ ] Mock Solr client for testing
```clojure
(with-redefs [auto-ap.solr/impl (auto-ap.solr/->InMemSolrClient (atom {}))]
(let [result @(sut/account-save {...})]
;; Test Solr index)
```
20. [ ] Implement Test 9: Account appears in Solr search
```clojure
(deftest account-creation-solr-indexing
(testing "Created account should be searchable in Solr"
(with-redefs [auto-ap.solr/impl (auto-ap.solr/->InMemSolrClient (atom {}))]
(let [admin-identity (admin-token)
form-params {:account/numeric-code 12349
:account/name "Solr Test Account"
:account/type :account-type/asset}
result @(sut/account-save {:form-params form-params
:request-method :post
:identity admin-identity})]
;; Then: Account should be indexed in Solr
(let [solr (auto-ap.solr/->InMemSolrClient (atom {}))
search-results (solr/query {:query "Solr Test Account"})]
(is (> (count search-results) 0)))))))
```
21. [ ] Implement Test 10: Can search by numeric code
- Test searching by numeric code
- Verify exact match
- Test search returns correct account
22. [ ] Implement Test 11: Solr index update on account update
- Create account
- Update account
- Verify Solr index contains updated data
- Verify old data removed
23. [ ] Verify Solr indexing tests pass
- Run each Solr test
- Fix failures
- Verify index operations work correctly
**Deliverable:**
- Tests 9, 10, 11 pass successfully
- Solr indexing thoroughly tested
### Phase 3: Authorization & Edge Cases (2-3 hours)
**Task 6: Authorization Tests**
24. [ ] Implement Test 12: Non-admin access is denied
```clojure
(deftest account-creation-non-admin-access-denied
(testing "Non-admin users should not be able to create accounts"
(let [user-identity {:user "TEST USER"
:user/role "user"
:user/name "TEST USER"}
form-params {:account/numeric-code 12350
:account/name "Unauthorized Account"
:account/type :account-type/asset}
result (sut/account-save {:form-params form-params
:request-method :post
:identity user-identity})]
(is (not= :success (:status result)))
;; Should return 403 or error
(is (some #(str/includes? (first %) "not authorized") (:form-errors result)))))))
```
25. [ ] Implement Test 13: Admin with invalid token
- Test expired token
- Test malformed token
- Test missing token
- Verify proper error handling
26. [ ] Verify authorization tests pass
- Run each authorization test
- Fix failures
- Verify security constraints
**Deliverable:**
- Tests 12, 13 pass successfully
- Authorization thoroughly tested
**Task 7: Edge Cases**
27. [ ] Implement Test 14: Client override validation
- Test duplicate client names in overrides
- Test empty overrides
- Test too many overrides
- Test invalid client references
28. [ ] Implement Test 15: Account name edge cases
- Test special characters
- Test unicode characters
- Test extremely long names
- Test names with leading/trailing spaces
29. [ ] Implement Test 16: Numeric code edge cases
- Test very long codes (near database limit)
- Test zero
- Test decimal numbers
- Test codes with spaces
30. [ ] Implement Test 17: Transaction rollback on Solr failure
- Simulate Solr failure
- Verify Datomic transaction is rolled back
- Verify no partial data created
31. [ ] Implement Test 18: Concurrent account creation
- Test two admins creating accounts simultaneously
- Verify no duplicate code/name conflicts
- Test race condition handling
32. [ ] Verify edge case tests pass
- Run each edge case test
- Fix failures
- Document any limitations
**Deliverable:**
- Tests 14, 15, 16, 17, 18 pass successfully
- Edge cases thoroughly tested
### Phase 4: Refinement & Documentation (1-2 hours)
**Task 8: Code Quality**
33. [ ] Run linting
```bash
lein cljfmt check
```
34. [ ] Fix formatting issues
```bash
lein cljfmt fix
```
35. [ ] Verify no syntax errors
- Run `lein check` or `lein test` to catch any issues
36. [ ] Add test comments explaining BDD Given-When-Then flow
- Document purpose of each test
- Explain assumptions
- Note any test limitations
37. [ ] Organize tests by feature
- Group related tests together
- Use clear headings
- Add docstrings
38. [ ] Update test documentation
- Document test utilities used
- Explain test setup and teardown
- Add reference to source code
**Deliverable:**
- Code formatted and linted
- Well-documented tests
- Clear test structure
**Task 9: Integration Testing**
39. [ ] Run full test suite
```bash
lein test
```
40. [ ] Run integration tests only
```bash
lein test :integration
```
41. [ ] Run functional tests only
```bash
lein test :functional
```
42. [ ] Fix any failing tests
- Analyze test failures
- Fix implementation or test
- Re-run until all tests pass
43. [ ] Verify test performance
- Check execution time
- Identify slow tests
- Optimize if necessary
**Deliverable:**
- All tests pass
- Tests run in acceptable time (< 2 minutes for full suite)
**Task 10: Code Review Preparation**
44. [ ] Review test code quality
- Check naming conventions
- Verify test isolation
- Ensure proper cleanup
45. [ ] Document test patterns
- Note common test utilities used
- Document testing conventions
- Add examples for future tests
46. [ ] Create summary documentation
- List all tests implemented
- Explain test coverage
- Document any test limitations
- Provide guidance for running tests
**Deliverable:**
- Clean, maintainable test code
- Comprehensive test documentation
- Ready for code review
## References & Research
### Internal References
- **Account Creation Source**: `src/clj/auto_ap/ssr/admin/accounts.clj:196-49`
- Main `account-save` function
- Form schema validation logic
- Duplicate check implementation
- Solr indexing logic
- **Test Utilities**: `test/clj/auto_ap/integration/util.clj:1-117`
- `wrap-setup` - Test database setup/teardown
- `admin-token` - Admin authentication token creation
- `setup-test-data` - Common test data creation
- `test-account` - Helper for account test data
- **Existing SSR Tests**:
- `test/clj/auto_ap/ssr/invoice/new_invoice_wizard_test.clj` - SSR test patterns
- `test/clj/auto_ap/ssr/ledger_test.clj` - Comprehensive test examples
- `test/clj/auto_ap/integration/graphql/accounts.clj` - Integration test patterns
- **Testing Conventions**: `.claude/skills/testing-conventions/SKILL.md`
- Core principle: Test user-observable behavior
- Database testing patterns
- Test fixture usage
- Helper function recommendations
### External References
- **Clojure Testing**: [clojure.test documentation](https://clojure.org/guides/testing)
- Test structure and patterns
- Fixtures and setup/teardown
- Assertions and test organization
- **Datomic API**: [datomic.api documentation](https://docs.datomic.com/free/pro/api/datomic/api.html)
- Database queries (`dc/q`, `dc/pull`)
- Transaction operations
- Entity manipulation
- **BDD in Clojure**: [Cucumber Clojure](https://github.com/cucumber/clojure) (if needed)
- If BDD framework is adopted
- Alternative to Clojure.test patterns
### Related Work
- **Previous Account Tests**: `test/clj/auto_ap/integration/graphql/accounts.clj` (215 lines)
- Existing account-related tests for reference
- GraphQL API patterns that may apply
- **Admin Tests**: None found (admin functionality less tested)
- This feature will be first comprehensive admin test suite
- Opportunity to establish admin testing patterns
## Testing Conventions Applied
Following project conventions:
1. **User-Observable Behavior**: Tests verify database state changes, not implementation details
2. **Given-When-Then Structure**: Tests document behavioral intent clearly
3. **Test Utilities**: Leverage existing `wrap-setup`, `admin-token`, `setup-test-data`
4. **Database Verification**: Use `dc/pull` and `dc/q` to verify state after operations
5. **Isolation**: Each test has proper setup and teardown
6. **Clarity**: Test names are descriptive and clear about intent
7. **Documentation**: Test comments explain BDD flow and assumptions
## Success Criteria Summary
- ✅ 18 BDD test scenarios implemented and passing
- ✅ Clear Given-When-Then documentation for each test
- ✅ Tests cover happy path, validation errors, duplicates, Solr, authorization, edge cases
- ✅ No regression in existing account creation functionality
- ✅ Tests provide clear behavioral documentation for developers
- ✅ Tests run in parallel without conflicts
- ✅ Code formatted and linted
- ✅ Full test suite passes
## Next Steps
1. **Review Plan**: Confirm scope and detail level
2. **Run Deepen Research**: Optionally enhance with best practices and performance analysis
3. **Start Implementation**: Begin with Phase 1 and iterate through phases
4. **Code Review**: Get feedback on test implementation
5. **Iterate**: Refine tests based on feedback

View File

@@ -0,0 +1,459 @@
---
title: "Add comprehensive tests for SSR admin vendors module"
type: feat
date: 2026-02-06
component: auto-ap.ssr.admin.vendors
tags: [testing, ssr, vendors, wizard, bdd]
---
# Add Comprehensive Tests for SSR Admin Vendors Module
## Overview
Add comprehensive BDD-style tests for the SSR admin vendors module (`src/clj/auto_ap/ssr/admin/vendors.clj`). The vendors module is a complex multi-step wizard implementation with 5 wizard steps (Info, Terms, Account, Address, Legal) and requires more extensive testing than the accounts module due to its complex form state management, vendor merge functionality, and nested override grids.
## Problem Statement
The vendors module currently has **zero tests** despite being a critical admin functionality with 932 lines of code. This creates risks:
1. **Untested complex logic**: Multi-step wizard navigation, form state management, and validation
2. **No safety net for refactors**: Vendor merge, grid overrides, and dynamic fields are complex
3. **No documentation of expected behavior**: Tests serve as executable documentation
4. **Risk of regression**: Without tests, bugs in vendor creation/management could go unnoticed
## Proposed Solution
Create a comprehensive test suite at `test/clj/auto_ap/ssr/admin/vendors_test.clj` following the established patterns from `accounts_test.clj`, but with additional complexity for:
- **Wizard navigation testing**: Testing step transitions, validation at each step
- **Vendor merge functionality**: Testing source/target vendor selection and entity merging
- **Override grids**: Testing terms overrides and account overrides with client-specific data
- **Complex form state**: Testing MultiStepFormState encoding/decoding
- **Nested entity handling**: Testing vendor address, legal entity info, primary contact
## Technical Considerations
### Architecture Impact
- Tests will mirror the accounts test structure: `test/clj/auto_ap/ssr/admin/vendors_test.clj`
- Will require understanding of `LinearModalWizard` protocol and `MultiStepFormState`
- Tests will use same utilities: `wrap-setup`, `admin-token`, `setup-test-data`
- Will need to mock Solr indexing like accounts tests do
### Performance Implications
- In-memory Datomic with test fixtures for isolation
- Each test should be independent with proper setup/teardown
- Estimated 15-20 tests (vs 9 for accounts) due to complexity
### Security Considerations
- Admin-only access verification
- Non-admin access should be rejected
- JWT validation for vendor operations
### Testing Challenges
1. **MultiStepFormState encoding**: The wizard uses complex form state encoding via `wrap-decode-multi-form-state`
2. **Step-specific validation**: Each wizard step validates only its subset of the schema
3. **Dynamic client-dependent fields**: Account typeahead depends on client selection
4. **Grid row management**: Adding/removing terms and account override rows
## Acceptance Criteria
### Functional Requirements
#### Grid & List View Tests (4 tests) - ✅ IMPLEMENTED
- [x] **Test 1**: Vendor grid page loads and displays vendors
- Given: Test vendors exist in database
- When: Admin navigates to vendors page
- Then: Vendor table displays with correct columns (name, email, default account)
- Then: Usage badges show correct client counts and totals
- **Implemented as**: `vendor-fetch-page-returns-vendors`
- [x] **Test 2**: Vendor grid filtering by name works
- Given: Multiple vendors exist with different names
- When: Admin filters by name "Acme"
- Then: Only vendors matching "Acme" are displayed
- Then: Matching count reflects filtered results
- **Implemented as**: `vendor-fetch-ids-with-name-filter`
- [x] **Test 3**: Vendor grid filtering by type (hidden/global) works
- Given: Hidden and global vendors exist
- When: Admin selects "Only hidden" filter
- Then: Only hidden vendors are displayed
- When: Admin selects "Only global" filter
- Then: Only non-hidden vendors are displayed
- **Implemented as**: `vendor-fetch-ids-with-hidden-filter`
- [x] **Test 4**: Vendor grid handles empty database
- Given: No vendors in database
- When: Admin navigates to vendors page
- Then: Returns empty results without errors
- **Implemented as**: `vendor-grid-loads-with-empty-database`
- **Note**: Sorting tests deferred due to vendor module sorting configuration
#### Vendor Creation Tests - Info Step (2 tests)
- [ ] **Test 5**: Admin successfully creates vendor with basic info
- Given: Admin is logged in with valid token
- When: Admin submits vendor info form (name, hidden flag)
- Then: Vendor is created successfully
- Then: Vendor appears in database
- Then: Vendor is indexed in Solr
- [ ] **Test 6**: Vendor creation validation - empty name rejected
- Given: Admin submits form without vendor name
- When: Validation runs on info step
- Then: Validation error for name field
- Then: No vendor is created
#### Vendor Creation Tests - Terms Step (3 tests)
- [ ] **Test 7**: Vendor can have default terms set
- Given: Admin on terms step of wizard
- When: Admin sets terms to 30 days
- Then: Terms are saved with vendor
- Then: Terms appear in database
- [ ] **Test 8**: Vendor terms override grid works
- Given: Admin on terms step with client overrides
- When: Admin adds terms override for specific client (45 days)
- Then: Override is saved
- When: Override is removed
- Then: Override is deleted from database
- [ ] **Test 9**: Automatic payment flag per client works
- Given: Admin on terms step
- When: Admin marks vendor for automatic payment for a client
- Then: Flag is saved in database
#### Vendor Creation Tests - Account Step (3 tests)
- [ ] **Test 10**: Vendor default account selection works
- Given: Admin on account step
- When: Admin selects default account from typeahead
- Then: Default account association is saved
- [ ] **Test 11**: Vendor account override grid works
- Given: Admin on account step with client-specific accounts
- When: Admin adds account override for client (different default account)
- Then: Override is saved in database
- When: Client is changed, account typeahead refreshes
- Then: New client-specific accounts are available
- [ ] **Test 12**: Account typeahead filters by client
- Given: Client A and Client B have different accounts
- When: Admin selects Client A in override row
- Then: Only Client A's accounts appear in typeahead
#### Vendor Creation Tests - Address Step (2 tests)
- [ ] **Test 13**: Vendor address information is saved
- Given: Admin on address step
- When: Admin enters complete address (street, city, state, zip)
- Then: Address entity is created and linked to vendor
- Then: All address fields are persisted correctly
- [ ] **Test 14**: Partial address is handled correctly
- Given: Admin enters only street address
- When: Vendor is saved
- Then: Address entity is created with available fields
- Then: Missing fields remain empty
#### Vendor Creation Tests - Legal Step (3 tests)
- [ ] **Test 15**: Vendor legal entity (business) information is saved
- Given: Admin on legal step
- When: Admin enters legal entity name and TIN (EIN)
- Then: Legal entity info is saved
- Then: 1099 type is stored correctly
- [ ] **Test 16**: Vendor individual legal entity is saved
- Given: Admin on legal step
- When: Admin enters individual name (first, middle, last) and SSN
- Then: Individual legal entity info is saved
- Then: TIN type is set to SSN
- [ ] **Test 17**: Legal entity validation works
- Given: Admin enters invalid TIN format
- When: Validation runs
- Then: Appropriate validation error is shown
#### Vendor Update Tests (2 tests)
- [ ] **Test 18**: Existing vendor can be updated
- Given: Vendor exists in database
- When: Admin edits and saves vendor
- Then: Changes are persisted
- Then: Solr index is updated
- Then: Grid row reflects changes
- [ ] **Test 19**: Vendor update maintains existing overrides
- Given: Vendor has terms and account overrides
- When: Admin updates vendor name
- Then: Overrides remain intact
#### Vendor Merge Tests (3 tests) - ✅ IMPLEMENTED
- [x] **Test 20**: Vendor merge transfers all references
- Given: Source vendor has invoices/bills, target vendor exists
- When: Admin merges source into target
- Then: All references to source are updated to target
- Then: Source vendor is deleted
- Then: Success notification is shown
- **Implemented as**: `vendor-merge-transfers-references`
- [x] **Test 21**: Same vendor merge is rejected
- Given: Admin selects same vendor for source and target
- When: Merge is attempted
- Then: Validation error: "Please select two different vendors"
- **Implemented as**: `vendor-merge-same-vendor-rejected`
- [x] **Test 22**: Non-existent vendor merge is handled
- Given: Invalid vendor ID for source
- When: Merge is attempted
- Then: Appropriate error is shown
- **Implemented as**: `vendor-merge-invalid-vendor-handled`
#### Security Tests (2 tests)
- [ ] **Test 23**: Non-admin cannot create vendor
- Given: Non-admin user token
- When: User attempts to create vendor
- Then: Request is rejected (403 Forbidden)
- [ ] **Test 24**: Non-admin cannot merge vendors
- Given: Non-admin user token
- When: User attempts to merge vendors
- Then: Request is rejected
### Non-Functional Requirements
- [ ] Tests use `wrap-setup` fixture for database isolation
- [ ] Tests use `admin-token` utility for authentication
- [ ] Solr is mocked using `with-redefs` with `InMemSolrClient`
- [ ] Test execution time < 3 seconds per test
- [ ] All tests pass with `lein test auto-ap.ssr.admin.vendors-test`
### Quality Gates
- [ ] 24 tests implemented and passing
- [ ] Test coverage > 75% for vendor handlers
- [ ] Code formatted with `lein cljfmt check`
- [ ] No debug statements (`println`, `alog/peek`) in tests
- [ ] All `deftest` blocks at column 0 (consistent structure)
## Implementation Plan
### Phase 1: Foundation (2 hours)
**Tasks:**
1. [ ] Review vendors module structure
- Read `src/clj/auto_ap/ssr/admin/vendors.clj`
- Identify key functions: `fetch-ids`, `hydrate-results`, `fetch-page`
- Identify wizard steps: Info, Terms, Account, Address, Legal
- Identify merge functionality
2. [ ] Review accounts test as reference
- Read `test/clj/auto_ap/ssr/admin/accounts_test.clj`
- Copy test structure and utilities
- Note `ffirst` pattern for Datomic queries
- Note `[:db/ident]` for entity references
3. [ ] Create test file structure
- Create `test/clj/auto_ap/ssr/admin/vendors_test.clj`
- Set up namespace with required imports
- Add `wrap-setup` fixture
**Deliverable:** Test file created with proper structure, ready for test implementation
### Phase 2: Grid/List Tests (1.5 hours)
4. [ ] Implement Test 1: Vendor grid loads
5. [ ] Implement Test 2: Name filtering
6. [ ] Implement Test 3: Type filtering (hidden/global)
7. [ ] Implement Test 4: Sorting
**Deliverable:** 4 grid tests passing
### Phase 3: Vendor Creation - Info & Terms (2.5 hours)
8. [ ] Implement Test 5: Create vendor with basic info
9. [ ] Implement Test 6: Name validation
10. [ ] Implement Test 7: Default terms
11. [ ] Implement Test 8: Terms override grid
12. [ ] Implement Test 9: Automatic payment flag
**Deliverable:** 5 vendor creation tests (info + terms) passing
### Phase 4: Vendor Creation - Account & Address (2.5 hours)
13. [ ] Implement Test 10: Default account selection
14. [ ] Implement Test 11: Account override grid
15. [ ] Implement Test 12: Client-filtered account typeahead
16. [ ] Implement Test 13: Complete address
17. [ ] Implement Test 14: Partial address
**Deliverable:** 5 vendor creation tests (account + address) passing
### Phase 5: Vendor Creation - Legal & Update (2 hours)
18. [ ] Implement Test 15: Legal entity (business)
19. [ ] Implement Test 16: Legal entity (individual)
20. [ ] Implement Test 17: Legal entity validation
21. [ ] Implement Test 18: Vendor update
22. [ ] Implement Test 19: Update maintains overrides
**Deliverable:** 5 tests (legal + update) passing
### Phase 6: Vendor Merge & Security (2 hours)
23. [ ] Implement Test 20: Merge transfers references
24. [ ] Implement Test 21: Same vendor merge rejected
25. [ ] Implement Test 22: Invalid vendor merge handled
26. [ ] Implement Test 23: Non-admin cannot create
27. [ ] Implement Test 24: Non-admin cannot merge
**Deliverable:** 5 tests (merge + security) passing
### Phase 7: Refinement & Quality (1 hour)
28. [ ] Run `lein cljfmt check` and fix issues
29. [ ] Run full test suite
30. [ ] Review for debug statements and remove
31. [ ] Verify consistent test structure (deftest at column 0)
32. [ ] Add test documentation comments
**Deliverable:** All 24 tests passing, code formatted, no debug code
## Success Metrics
- [ ] 24 BDD test scenarios implemented and passing
- [ ] Test file follows project conventions
- [ ] Code formatted with `lein cljfmt check`
- [ ] All tests use proper Datomic query patterns (`ffirst`, `[:db/ident]`)
- [ ] Solr mocking works correctly
- [ ] Tests run in < 60 seconds for full suite
- [ ] No regression in existing functionality
## Dependencies & Risks
### Prerequisites
- `src/clj/auto_ap/ssr/admin/vendors.clj` (exists)
- `test/clj/auto_ap/integration/util.clj` (test utilities)
- Existing accounts tests as reference pattern
- Datomic database schema for vendors
### Potential Risks
1. **Complexity Risk**: MultiStepFormState encoding/decoding is complex
- **Mitigation**: Reference accounts test patterns, test incrementally
2. **Time Risk**: 24 tests may take longer than estimated
- **Mitigation**: Prioritize core tests (creation, merge), add edge cases later
3. **Wizard State Risk**: Wizard step navigation testing is novel
- **Mitigation**: Start with simple tests, incrementally add complexity
4. **Grid Testing Risk**: Override grid testing is complex
- **Mitigation**: Test basic CRUD operations first, then edge cases
## References & Research
### Internal References
**Vendor Source Code**:
- `src/clj/auto_ap/ssr/admin/vendors.clj` - Main implementation (932 lines)
- `fetch-ids` - Query builder for vendor grid
- `hydrate-results` - Data hydration for grid display
- `fetch-page` - Grid pagination
- `grid-page` - Grid configuration
- `merge-submit` - Vendor merge logic
- 5 Wizard step records: InfoModal, TermsModal, AccountModal, AddressModal, LegalEntityModal
- VendorWizard record implementing LinearModalWizard protocol
**Wizard Framework**:
- `src/clj/auto_ap/ssr/components/multi_modal.clj` - LinearModalWizard protocol
- `ModalWizardStep` protocol methods: `step-key`, `edit-path`, `render-step`, `step-schema`, `step-name`
- `LinearModalWizard` protocol methods: `navigate`, `get-current-step`, `render-wizard`, `submit`
- Handler wrappers: `wrap-wizard`, `wrap-init-multi-form-state`, `wrap-decode-multi-form-state`
**Test Utilities**:
- `test/clj/auto_ap/integration/util.clj` - Test helpers
- `wrap-setup` - Test database setup/teardown
- `admin-token` - Admin authentication
- `setup-test-data` - Test data creation
- `test-vendor` - Vendor test data helper
**Reference Tests**:
- `test/clj/auto_ap/ssr/admin/accounts_test.clj` - Accounts test pattern (151 lines)
- `test/clj/auto_ap/integration/graphql/vendors.clj` - GraphQL vendor tests (79 lines)
**Learnings**:
- `docs/solutions/test-failures/atomic-query-patterns-in-bdd-tests-auto-ap-ssr-20260206.md` - Datomic query patterns (`ffirst`, `[:db/ident]`)
- `docs/solutions/test-failures/debug-statement-and-test-nesting-fix-accounts-20260206.md` - Test quality issues to avoid
### Testing Patterns
**Datomic Query Pattern**:
```clojure
; Use ffirst to extract entity ID from tuple
(let [results (dc/q '[:find ?e :where [?e :vendor/name "Acme"]] db)
vendor-id (ffirst results)] ; Not (first results)
...)
```
**Entity Reference Resolution**:
```clojure
; Include [:db/ident] to resolve enum values
(let [vendor (dc/pull db
'[:vendor/name
{[:vendor/legal-entity-tin-type :xform iol-ion.query/ident] [:db/ident]}]
vendor-id)]
; Access as: (:db/ident (:vendor/legal-entity-tin-type vendor))
...)
```
**Solr Mocking Pattern**:
```clojure
(with-redefs [auto-ap.solr/impl (auto-ap.solr/->InMemSolrClient (atom {}))]
; Test code here
)
```
**Test Structure Pattern**:
```clojure
(deftest vendor-creation-success
(testing "Admin should be able to create a new vendor"
(with-redefs [auto-ap.solr/impl (auto-ap.solr/->InMemSolrClient (atom {}))]
(let [admin-identity (admin-token)
; Test implementation
]))))
```
## AI-Era Considerations
When implementing with AI assistance:
1. **Accelerated test generation**: AI can generate test scaffolding quickly
2. **Pattern recognition**: Use existing accounts tests as templates
3. **Datomic patterns**: Ensure AI applies `ffirst` and `[:db/ident]` correctly
4. **Human review**: All AI-generated tests should be reviewed for:
- Correct assertion logic
- Proper database verification
- No debug statements left in
- Consistent test structure
## Next Steps
1. **Review Plan**: Confirm scope and complexity level
2. **Start Implementation**: Begin with Phase 1 (Foundation)
3. **Iterative Testing**: Implement tests incrementally, verify each phase
4. **Code Review**: Get feedback on test patterns
5. **Integration**: Ensure tests pass with full test suite
---
**Created**: 2026-02-06
**Priority**: High (critical admin functionality untested)
**Estimated Effort**: 13 hours (across 7 phases)

View File

@@ -0,0 +1,439 @@
---
title: "Add comprehensive tests for SSR admin transaction rules module"
type: feat
date: 2026-02-07
component: auto-ap.ssr.admin.transaction-rules
tags: [testing, ssr, transaction-rules, rules-engine, bdd]
---
# Add Comprehensive Tests for SSR Admin Transaction Rules Module
## Overview
Add comprehensive BDD-style tests for the SSR admin transaction rules module (`src/clj/auto_ap/ssr/admin/transaction_rules.clj`). The transaction rules module is a **1,012-line critical component** that enables automated transaction categorization through rule-based matching. Unlike the vendors module, transaction rules includes a sophisticated rule-matching engine that finds and applies rules to transactions.
## Problem Statement
The transaction rules module currently has **zero tests** despite being a critical 1,012-line component with complex functionality:
1. **Rule matching engine** - Matches transactions based on description, amount, day-of-month, client-group, bank-account
2. **Test/Preview functionality** - Shows matching transactions before execution
3. **Execute functionality** - Applies rules to matching transactions with audit logging
4. **Multi-step wizard** - For creating/editing transaction rules
5. **Complex filtering** - Regex pattern matching for notes, description includes, client-groups
This creates risks:
- **Untested rule matching logic** - Complex query building for transaction matching
- **No safety net for refactors** - Rule execution affects financial data
- **No documentation of expected behavior** - Tests serve as executable documentation
- **Risk of regression** - Changes to rule matching could silently break categorization
## Key Differences from Vendors Module
**Transaction Rules is MORE COMPLEX than vendors:**
| Feature | Vendors | Transaction Rules |
|---------|---------|-------------------|
| Lines of code | 932 | 1,012 |
| Grid operations | ✅ | ✅ |
| Multi-step wizard | ✅ (5 steps) | ✅ (Edit/Test modes) |
| **Rule matching engine** | ❌ | ✅ |
| **Test/Preview functionality** | ❌ | ✅ |
| **Execute/Apply functionality** | ❌ | ✅ |
| **Regex pattern matching** | ❌ | ✅ |
| **Transaction modification** | ❌ | ✅ |
**Unique transaction rules functionality to test:**
- `transactions-matching-rule` - Finds transactions matching rule criteria
- `transaction-rule-test-table*` - Preview matching transactions
- `execute` - Applies rules to transactions with audit logging
- Complex filtering by description patterns, amount ranges, day-of-month
## Proposed Solution
Create a comprehensive test suite at `test/clj/auto_ap/ssr/admin/transaction_rules_test.clj` following established patterns from `vendors_test.clj` and `accounts_test.clj`, with additional tests for the unique rule-matching functionality.
## Technical Considerations
### Architecture Impact
- Tests will mirror the vendors test structure
- Additional complexity: rule matching requires transaction test data
- Tests will use same utilities: `wrap-setup`, `admin-token`, `setup-test-data`
- Will need to mock Solr indexing like accounts tests do
### Performance Implications
- Rule matching queries are more complex than vendor queries
- Tests should verify both matching logic AND performance characteristics
- Each test should be independent with proper setup/teardown
- Estimated 18-22 tests (more than vendors due to rule engine complexity)
### Security Considerations
- Admin-only access verification
- Rule execution modifies transaction data (audit logging required)
- Non-admin access should be rejected
- JWT validation for rule operations
### Testing Challenges
1. **Rule matching complexity** - Multiple criteria (description, amount, bank-account, etc.)
2. **Test data dependencies** - Need transactions to test rule matching
3. **Regex pattern matching** - Testing pattern-based description matching
4. **Execute functionality** - Tests modify transaction data (need cleanup verification)
5. **Day-of-month filtering** - Date-based testing complexity
## Acceptance Criteria
### Functional Requirements
#### Grid & List View Tests (5 tests)
- [ ] **Test 1**: Transaction rule grid loads and displays rules
- Given: Test transaction rules exist in database
- When: Admin navigates to transaction rules page
- Then: Rule table displays with correct columns (description, note, vendor, client)
- [ ] **Test 2**: Transaction rule grid filtering by vendor works
- Given: Multiple rules with different vendors
- When: Admin filters by specific vendor
- Then: Only rules for that vendor are displayed
- [ ] **Test 3**: Transaction rule grid filtering by note pattern works
- Given: Rules with different note patterns
- When: Admin filters by note regex pattern
- Then: Only matching rules are displayed
- [ ] **Test 4**: Transaction rule grid filtering by description works
- Given: Rules with different descriptions
- When: Admin filters by description substring
- Then: Only matching rules are displayed
- [ ] **Test 5**: Transaction rule grid sorting works
- Given: Multiple transaction rules
- When: Admin sorts by description, note, or amount
- Then: Rules are sorted correctly
#### Rule Matching Engine Tests (6 tests) - **UNIQUE TO TRANSACTION RULES**
- [ ] **Test 6**: Rule matching by description pattern works
- Given: Transaction with description "HOME DEPOT #1234"
- When: Rule has description pattern "HOME DEPOT"
- Then: Transaction matches the rule
- [ ] **Test 7**: Rule matching by amount range works
- Given: Transaction with amount $150.00
- When: Rule has amount-gte $100 and amount-lte $200
- Then: Transaction matches the rule
- [ ] **Test 8**: Rule matching by bank account works
- Given: Transaction from specific bank account
- When: Rule specifies that bank account
- Then: Transaction matches the rule
- [ ] **Test 9**: Rule matching by client group works
- Given: Transaction for client in group "NTG"
- When: Rule specifies client-group "NTG"
- Then: Transaction matches the rule
- [ ] **Test 10**: Rule matching by day-of-month works
- Given: Transaction on day 15 of month
- When: Rule has dom-gte 10 and dom-lte 20
- Then: Transaction matches the rule
- [ ] **Test 11**: Rule matching combines multiple criteria
- Given: Transaction matching multiple criteria
- When: Rule has description + amount + bank account criteria
- Then: Transaction only matches if ALL criteria match
#### Rule Test/Preview Tests (3 tests) - **UNIQUE TO TRANSACTION RULES**
- [ ] **Test 12**: Rule test shows matching transactions
- Given: Rule that matches 5 transactions
- When: Admin previews the rule
- Then: All 5 matching transactions are displayed
- [ ] **Test 13**: Rule test respects only-uncoded filter
- Given: Rule matches 3 coded and 2 uncoded transactions
- When: Admin previews with only-uncoded flag
- Then: Only 2 uncoded transactions are shown
- [ ] **Test 14**: Rule test shows correct transaction details
- Given: Matching transaction with specific details
- When: Rule test displays results
- Then: Transaction shows client, bank, date, description correctly
#### Rule Execution Tests (4 tests) - **UNIQUE TO TRANSACTION RULES**
- [ ] **Test 15**: Rule execution applies to matching transactions
- Given: Rule matches 3 uncoded transactions
- When: Admin executes the rule
- Then: All 3 transactions are updated with rule's accounts
- Then: Audit log records the changes
- Then: Solr index is updated for modified transactions
- [ ] **Test 16**: Rule execution respects selected transaction IDs
- Given: Rule matches 5 transactions
- When: Admin selects only 2 specific transaction IDs to apply
- Then: Only those 2 transactions are updated
- [ ] **Test 17**: Rule execution skips locked transactions
- Given: Rule matches 3 transactions, 1 is locked
- When: Admin executes the rule
- Then: Only 2 unlocked transactions are updated
- [ ] **Test 18**: Rule execution validates before applying
- Given: Invalid rule or locked transactions
- When: Admin attempts execution
- Then: Appropriate validation errors are shown
#### Rule Creation/Update Tests (3 tests)
- [ ] **Test 19**: Admin successfully creates transaction rule
- Given: Admin is logged in with valid token
- When: Admin submits rule creation form
- Then: Rule is created successfully
- Then: Rule appears in database
- [ ] **Test 20**: Rule creation validation works
- Given: Admin submits form with invalid data
- When: Validation runs
- Then: Validation errors shown
- Then: No rule is created
- [ ] **Test 21**: Existing rule can be updated
- Given: Transaction rule exists in database
- When: Admin edits and saves rule
- Then: Changes are persisted
- Then: Solr index is updated
#### Security Tests (2 tests)
- [ ] **Test 22**: Non-admin cannot create transaction rule
- Given: Non-admin user token
- When: User attempts to create rule
- Then: Request is rejected (403 Forbidden)
- [ ] **Test 23**: Non-admin cannot execute rules
- Given: Non-admin user token
- When: User attempts to execute rule
- Then: Request is rejected
### Non-Functional Requirements
- [ ] Tests use `wrap-setup` fixture for database isolation
- [ ] Tests use `admin-token` utility for authentication
- [ ] Solr is mocked using `with-redefs` with `InMemSolrClient`
- [ ] Test execution time < 3 seconds per test
- [ ] All tests pass with `lein test auto-ap.ssr.admin.transaction-rules-test`
### Quality Gates
- [ ] 23 tests implemented and passing
- [ ] Test coverage > 75% for transaction rule handlers
- [ ] Code formatted with `lein cljfmt check`
- [ ] No debug statements (`println`, `alog/peek`) in tests
- [ ] All `deftest` blocks at column 0 (consistent structure)
## Implementation Plan
### Phase 1: Foundation & Grid Tests (3 hours)
**Tasks:**
1. [ ] Review transaction_rules module structure
- Read `src/clj/auto_ap/ssr/admin/transaction_rules.clj`
- Identify key functions: `fetch-ids`, `hydrate-results`, `fetch-page`
- Identify unique functions: `transactions-matching-rule`, `execute`, `transaction-rule-test-table*`
- Understand rule schema and validation
2. [ ] Review reference tests
- Read `vendors_test.clj` for grid test patterns
- Read `accounts_test.clj` for save/update patterns
- Note Datomic query patterns
3. [ ] Create test file structure
- Create `test/clj/auto_ap/ssr/admin/transaction_rules_test.clj`
- Set up namespace with required imports
- Add `wrap-setup` fixture
- Create helper for transaction rule test data
4. [ ] Implement Grid/List Tests 1-5
**Deliverable:** Test file with grid tests passing
### Phase 2: Rule Matching Engine Tests (4 hours)
5. [ ] Implement Test 6: Rule matching by description pattern
6. [ ] Implement Test 7: Rule matching by amount range
7. [ ] Implement Test 8: Rule matching by bank account
8. [ ] Implement Test 9: Rule matching by client group
9. [ ] Implement Test 10: Rule matching by day-of-month
10. [ ] Implement Test 11: Combined criteria matching
**Deliverable:** 6 rule matching tests passing
### Phase 3: Rule Test/Preview Tests (2.5 hours)
11. [ ] Implement Test 12: Rule test shows matching transactions
12. [ ] Implement Test 13: Rule test respects only-uncoded filter
13. [ ] Implement Test 14: Rule test shows correct details
**Deliverable:** 3 rule preview tests passing
### Phase 4: Rule Execution Tests (3 hours)
14. [ ] Implement Test 15: Rule execution applies to matching transactions
15. [ ] Implement Test 16: Rule execution respects selected IDs
16. [ ] Implement Test 17: Rule execution skips locked transactions
17. [ ] Implement Test 18: Rule execution validation
**Deliverable:** 4 rule execution tests passing
### Phase 5: Rule CRUD & Security (2.5 hours)
18. [ ] Implement Test 19: Rule creation success
19. [ ] Implement Test 20: Rule creation validation
20. [ ] Implement Test 21: Rule update
21. [ ] Implement Test 22: Non-admin cannot create
22. [ ] Implement Test 23: Non-admin cannot execute
**Deliverable:** 5 CRUD and security tests passing
### Phase 6: Refinement & Quality (1 hour)
23. [ ] Run `lein cljfmt check` and fix issues
24. [ ] Run full test suite
25. [ ] Review for debug statements and remove
26. [ ] Verify consistent test structure (deftest at column 0)
27. [ ] Add test documentation comments
**Deliverable:** All 23 tests passing, code formatted, no debug code
## Success Metrics
- [ ] 23 BDD test scenarios implemented and passing
- [ ] Test file follows project conventions
- [ ] Code formatted with `lein cljfmt check`
- [ ] All tests use proper Datomic query patterns (`ffirst`, `[:db/ident]`)
- [ ] Solr mocking works correctly
- [ ] Tests run in < 90 seconds for full suite
- [ ] No regression in existing functionality
## Dependencies & Risks
### Prerequisites
- `src/clj/auto_ap/ssr/admin/transaction_rules.clj` (exists)
- `test/clj/auto_ap/integration/util.clj` (test utilities)
- Existing vendors/accounts tests as reference pattern
- Datomic database schema for transaction rules
- Understanding of `auto-ap.rule-matching` namespace
### Potential Risks
1. **Complexity Risk**: Rule matching engine has complex query building
- **Mitigation**: Test each criterion independently first, then test combinations
2. **Time Risk**: 23 tests may take longer than estimated
- **Mitigation**: Prioritize rule matching and execution tests (core functionality)
3. **Test Data Risk**: Rule matching requires realistic transaction data
- **Mitigation**: Use `setup-test-data` with comprehensive transaction fixtures
4. **Date Testing Risk**: Day-of-month filtering is date-dependent
- **Mitigation**: Use fixed test dates or mock date functions
## References & Research
### Internal References
**Transaction Rules Source Code**:
- `src/clj/auto_ap/ssr/admin/transaction_rules.clj` - Main implementation (1,012 lines)
- `fetch-ids` - Query builder for transaction rule grid
- `hydrate-results` - Data hydration for grid display
- `fetch-page` - Grid pagination
- `transactions-matching-rule` - **Core rule matching engine** (lines 301-379)
- `transaction-rule-test-table*` - **Preview/test functionality** (lines 381-507)
- `execute` - **Rule execution with audit logging** (lines 521-571)
- `validate-transaction-rule` - Rule validation logic (lines 271-299)
- EditModal and TestModal records for wizard functionality
**Test Utilities**:
- `test/clj/auto_ap/integration/util.clj` - Test helpers
- `wrap-setup` - Test database setup/teardown
- `admin-token` - Admin authentication
- `setup-test-data` - Test data creation
- `test-transaction` - Transaction test data helper
**Reference Tests**:
- `test/clj/auto_ap/ssr/admin/vendors_test.clj` - Vendors test pattern (178 lines)
- `test/clj/auto_ap/ssr/admin/accounts_test.clj` - Accounts test pattern (151 lines)
**Rule Matching Engine**:
- `src/clj/auto_ap/rule_matching.clj` - Rule application logic
- `apply-rule` - Applies rule to transaction
- `rule-applies?` - Checks if rule matches transaction
### Testing Patterns
**Datomic Query Pattern**:
```clojure
; Use ffirst to extract entity ID from tuple
(let [results (dc/q '[:find ?e :where [?e :transaction-rule/description "Test"]] db)
rule-id (ffirst results)] ; Not (first results)
...)
```
**Entity Reference Resolution**:
```clojure
; Include [:db/ident] to resolve enum values
(let [rule (dc/pull db
'[:transaction-rule/description
{[:transaction-rule/transaction-approval-status :xform iol-ion.query/ident] [:db/ident]}]
rule-id)]
; Access as: (:db/ident (:transaction-rule/transaction-approval-status rule))
...)
```
**Solr Mocking Pattern**:
```clojure
(with-redefs [auto-ap.solr/impl (auto-ap.solr/->InMemSolrClient (atom {}))]
; Test code here
)
```
**Test Structure Pattern**:
```clojure
(deftest transaction-rule-matching-by-description
(testing "Rule should match transactions by description pattern"
(with-redefs [auto-ap.solr/impl (auto-ap.solr/->InMemSolrClient (atom {}))]
(let [admin-identity (admin-token)
; Test implementation
]))))
```
## AI-Era Considerations
When implementing with AI assistance:
1. **Accelerated test generation**: AI can generate test scaffolding quickly
2. **Pattern recognition**: Use existing vendors/accounts tests as templates
3. **Datomic patterns**: Ensure AI applies `ffirst` and `[:db/ident]` correctly
4. **Rule matching complexity**: Test each criterion independently before combinations
5. **Human review**: All AI-generated tests should be reviewed for:
- Correct rule matching logic
- Proper database verification
- No debug statements left in
- Consistent test structure
## Next Steps
1. **Review Plan**: Confirm scope and complexity level
2. **Start Implementation**: Begin with Phase 1 (Foundation & Grid Tests)
3. **Iterative Testing**: Implement tests incrementally, verify each phase
4. **Code Review**: Get feedback on test patterns
5. **Integration**: Ensure tests pass with full test suite
---
**Created**: 2026-02-07
**Priority**: High (critical business functionality untested)
**Estimated Effort**: 16 hours (across 6 phases)

View File

@@ -0,0 +1,132 @@
---
module: Invoice Parsing
date: 2026-02-07
problem_type: integration_failure
component: pdf_template_parser
symptoms:
- "Bonanza Produce multi-invoice statement (13595522.pdf) fails to parse correctly"
- "Single invoice template extracts only one invoice instead of four"
- "Multi-invoice statement lacks I/L markers present in single invoices"
- "Customer identifier extraction pattern requires different regex for statements"
root_cause: template_inadequate
resolution_type: template_fix
severity: high
tags: [pdf, parsing, invoice, bonanza-produce, multi-invoice, integration]
---
# Bonanza Produce Multi-Invoice Statement Template Fix
## Problem
Bonanza Produce sends two different invoice formats:
1. **Single invoices** (e.g., 03881260.pdf) with I/L markers and specific layout
2. **Multi-invoice statements** (e.g., 13595522.pdf) containing 4 invoices per page
The single invoice template failed to parse multi-invoice statements because:
- Multi-invoice statements lack the I/L (Invoice/Location) markers used in single invoice templates
- The layout structure is completely different, with invoices listed as table rows instead of distinct sections
- Customer identifier extraction requires a different regex pattern
## Environment
- Component: PDF Template Parser (Clojure)
- Date: 2026-02-07
- Test File: `test/clj/auto_ap/parse/templates_test.clj`
- Template File: `src/clj/auto_ap/parse/templates.clj`
- Test Document: `dev-resources/13595522.pdf` (4 invoices on single page)
## Symptoms
- Single invoice template only parses first invoice from multi-invoice statement
- Parse returns single result instead of 4 separate invoice records
- `:customer-identifier` extraction returns empty or incorrect values for statements
- Test `parse-bonanza-produce-statement-13595522` expects 4 results but receives 1
## What Didn't Work
**Attempted Solution 1: Reuse single invoice template with `:multi` flag**
- Added `:multi #"\n"` and `:multi-match?` pattern to existing single invoice template
- **Why it failed:** The single invoice template's regex patterns (e.g., `I\s+([A-Z][A-Z\s]+?)\s{2,}.*?L\s+`) expect I/L markers that don't exist in multi-invoice statements. The layout structure is fundamentally different.
**Attempted Solution 2: Using simpler customer identifier pattern**
- Tried pattern `#"(.*?)\s+RETURN"` extracted from multi-invoice statement text
- **Why it failed:** This pattern alone doesn't account for the statement's column-based layout. Need to combine with `:multi` and `:multi-match?` flags to parse multiple invoices.
## Solution
Added a dedicated multi-invoice template that:
1. Uses different keywords to identify multi-invoice statements
2. Employs `:multi` and `:multi-match?` flags for multiple invoice extraction
3. Uses simpler regex patterns suitable for the statement layout
**Implementation:**
```clojure
;; Bonanza Produce Statement (multi-invoice)
{:vendor "Bonanza Produce"
:keywords [#"The perishable agricultural commodities" #"SPARKS, NEVADA"]
:extract {:invoice-number #"^\s+[0-9]{2}/[0-9]{2}/[0-9]{2}\s+([0-9]+)\s+INVOICE"
:customer-identifier #"(.*?)\s+RETURN"
:date #"^\s+([0-9]{2}/[0-9]{2}/[0-9]{2})"
:total #"^\s+[0-9]{2}/[0-9]{2}/[0-9]{2}\s+[0-9]+\s+INVOICE\s+([\d.]+)"}
:parser {:date [:clj-time "MM/dd/yy"]
:total [:trim-commas nil]}
:multi #"\n"
:multi-match? #"\s+[0-9]{2}/[0-9]{2}/[0-9]{2}\s+[0-9]+\s+INVOICE"}
```
**Key differences from single invoice template:**
- `:keywords`: Look for statement header text instead of phone number
- `:customer-identifier`: Pattern `#"(.*?)\s+RETURN"` works for statement format
- `:multi #"\n"`: Split results on newline boundaries
- `:multi-match?`: Match invoice header pattern to identify individual invoices
- No I/L markers: Patterns scan from left margin without location markers
## Why This Works
1. **Statement-specific keywords:** "The perishable agricultural commodities" and "SPARKS, NEVADA" uniquely identify multi-invoice statements vs. single invoices (which have phone number 530-544-4136)
2. **Multi-flag parsing:** The `:multi` and `:multi-match?` flags tell the parser to split the document on newlines and identify individual invoices using the date/invoice-number pattern, rather than treating the whole page as one invoice
3. **Simplified patterns:** Without I/L markers, patterns scan from line start (`^\s+`) and extract columns based on whitespace positions. The `:customer-identifier` pattern `(.*?)\s+RETURN` captures everything before "RETURN" on each line
4. **Separate templates:** Having distinct templates for single invoices vs. statements prevents conflict and allows optimization for each format
## Prevention
**When adding templates for vendors with multiple document formats:**
1. **Create separate templates:** Don't try to make one template handle both formats. Use distinct keywords to identify each format
2. **Test both single and multi-invoice documents:** Ensure templates parse expected number of invoices:
```clojure
(is (= 4 (count results)) "Should parse 4 invoices from statement")
```
3. **Verify `:multi` usage:** Multi-invoice templates should have both `:multi` and `:multi-match?` flags:
```clojure
:multi #"\n"
:multi-match? #"\s+[0-9]{2}/[0-9]{2}/[0-9]{2}\s+[0-9]+\s+INVOICE"
```
4. **Check pattern scope:** Multi-invoice statements often lack structural markers (I/L), so patterns should:
- Use `^\s+` to anchor at line start
- Extract from whitespace-separated columns
- Avoid patterns requiring specific markers
5. **Run all template tests:** Before committing, run:
```bash
lein test auto-ap.parse.templates-test
```
## Related Issues
- Single invoice template: `src/clj/auto_ap/parse/templates.clj` lines 756-765
- Similar multi-invoice patterns: Search for `:multi` and `:multi-match?` in `src/clj/auto_ap/parse/templates.clj`
## Key Files
- **Tests:** `test/clj/auto_ap/parse/templates_test.clj` (lines 36-53)
- **Template:** `src/clj/auto_ap/parse/templates.clj` (lines 767-777)
- **Test document:** `dev-resources/13595522.pdf`
- **Template parser:** `src/clj/auto_ap/parse.clj`

View File

@@ -0,0 +1,138 @@
---
module: SSR Admin Vendors
date: 2026-02-07
problem_type: test_failure
component: testing_framework
symptoms:
- "SSR admin vendors module has 932 lines of code with zero test coverage"
- "Wizard protocol methods (LinearModalWizard) are complex and difficult to test directly"
- "Multiple test failures due to entity ID conflicts in test database"
- "Syntax errors from unmatched parentheses after code generation"
root_cause: inadequate_documentation
resolution_type: test_fix
severity: medium
tags: [testing, vendors, ssr, datomic, wizard, bdd, clojure]
---
# Adding Tests for SSR Admin Vendors Module
## Problem
The SSR admin vendors module (`src/clj/auto_ap/ssr/admin/vendors.clj`) had **zero test coverage** despite being a critical 932-line component. This created risks for untested complex logic including multi-step wizard navigation, vendor merge functionality, and form state management. Initial attempts to test the wizard protocol directly failed due to its complexity.
## Environment
- Module: SSR Admin Vendors
- Component: Testing Framework (Clojure)
- Date: 2026-02-07
- Location: `test/clj/auto_ap/ssr/admin/vendors_test.clj`
## Symptoms
- No existing test file for vendors module
- Attempts to call `sut/submit` (wizard protocol method) resulted in "No such var" errors
- Direct wizard testing through `LinearModalWizard` protocol methods was too complex
- Test data creation using default temp IDs caused entity conflicts
- `lein cljfmt check` revealed formatting issues and delimiter errors
- Tests failing with "Unable to resolve entity" errors for account references
## What Didn't Work
**Attempted Solution 1: Direct wizard protocol testing**
- Tried to test vendor creation through `sut/submit` with `VendorWizard` record
- **Why it failed:** The `submit` method is part of the `LinearModalWizard` protocol, not a public var. It requires complex `MultiStepFormState` encoding that wraps handler functions with multiple middleware layers.
**Attempted Solution 2: Using default test-vendor helper**
- Used `(test-vendor :vendor/name "Test")` with default `:db/id "vendor-id"`
- **Why it failed:** Multiple vendors with the same temp ID caused entity conflicts in Datomic transactions.
**Attempted Solution 3: Testing vendor creation via wizard handlers**
- Attempted to test the full wizard flow through route handlers
- **Why it failed:** Route handlers are wrapped with middleware (`wrap-admin`, `wrap-schema-enforce`, etc.) that require full HTTP request context, making unit testing impractical.
## Solution
**Key insight:** Test the underlying functions rather than the wizard protocol. Focus on:
1. Grid/list functions: `fetch-page`, `fetch-ids`, `hydrate-results`
2. Merge functionality: `merge-submit`
3. Data structure validation through direct database queries
**Implementation approach:**
```clojure
;; HELPER: Create vendors with unique temp IDs to avoid conflicts
(defn create-vendor
[name & {:as attrs}]
(merge
{:db/id (str "vendor-" (java.util.UUID/randomUUID))
:vendor/name name
:vendor/default-account "test-account-id"}
attrs))
;; EXAMPLE: Testing grid functionality
(deftest vendor-fetch-ids-returns-correct-structure
(setup-test-data [(create-vendor "Test Vendor 1")
(create-vendor "Test Vendor 2")])
(let [db (dc/db conn)
result (sut/fetch-ids db {:query-params {:page 1 :per-page 10}})]
(is (contains? result :ids))
(is (contains? result :count))
(is (seq? (:ids result))))) ; Note: returns seq, not vector
```
**Test coverage implemented:**
1. **Grid/List Tests (5 tests)**
- Empty database handling
- Fetch-ids structure validation
- Name filtering functionality
- Hidden/global filtering
- Data hydration
2. **Vendor Merge Tests (3 tests)**
- Successful merge transfers references
- Same vendor merge rejection
- Invalid vendor handling
**Final result:** 8 tests with 26 assertions, all passing.
## Why This Works
1. **Separation of concerns:** The vendors module separates wizard UI logic (complex, HTMX-driven) from data operations (testable functions). Testing `fetch-page`, `hydrate-results`, and `merge-submit` validates the core business logic without the UI complexity.
2. **Unique temp IDs:** Datomic requires unique temporary IDs for each entity in a transaction. Using `(str "vendor-" (java.util.UUID/randomUUID))` ensures no conflicts.
3. **Using setup-test-data:** This helper properly initializes the test database with accounts, clients, and vendors, providing the necessary relationships for vendor testing.
4. **Protocol vs. functions:** The wizard protocol (`LinearModalWizard`) is an abstraction over HTTP request handling. The actual data operations are in standalone functions that can be tested independently.
## Prevention
**When adding tests for SSR modules:**
1. **Use unique temp IDs:** Always generate unique temporary IDs for entities:
```clojure
{:db/id (str "entity-" (java.util.UUID/randomUUID))}
```
2. **Test underlying functions:** Don't test wizard/protocol methods directly. Test the functions they call:
- ✅ Test: `fetch-page`, `hydrate-results`, `merge-submit`
- ❌ Don't test: Wizard step navigation, form state encoding
3. **Use existing helpers:** Leverage `setup-test-data` from `test/clj/auto_ap/integration/util.clj` for proper test data initialization.
4. **Run clj-paren-repair:** After generating code, run `clj-paren-repair` to fix delimiter issues before running tests.
5. **Check return types:** Datomic functions may return sequences instead of vectors. Use `seq?` instead of `vector?` for assertions.
## Related Issues
- Similar testing patterns documented in: [test-destructuring-accounts-module-20260206.md](./test-destructuring-accounts-module-20260206.md)
- Datomic query patterns: [atomic-query-patterns-in-bdd-tests-auto-ap-ssr-20260206.md](./atomic-query-patterns-in-bdd-tests-auto-ap-ssr-20260206.md)
## Key Files
- **Tests:** `test/clj/auto_ap/ssr/admin/vendors_test.clj`
- **Source:** `src/clj/auto_ap/ssr/admin/vendors.clj`
- **Utilities:** `test/clj/auto_ap/integration/util.clj`
- **Similar tests:** `test/clj/auto_ap/ssr/admin/accounts_test.clj`

View File

@@ -0,0 +1,234 @@
---
module: auto-ap.ssr.admin
date: 2026-02-06
problem_type: test_failure
component: testing_framework
symptoms:
- Test assertions failed when extracting entity IDs from Datomic query results
- Entity reference queries returned entity IDs instead of actual values
- Numeric code comparisons failed (expected number, got string)
- Server responses didn't include Datomic tempids for created entities
root_cause: test_isolation
resolution_type: test_fix
severity: medium
tags: [atomic-query, datomic, entity-references, test-patterns, database-queries]
---
# Datomic Query Patterns in BDD Tests
## Problem
When writing BDD-style tests for SSR admin operations, test assertions frequently failed due to improper handling of Datomic query results and entity references. The Datomic API behaves differently than standard Clojure collections, causing tests to fail even when the underlying application logic was correct.
## Environment
- Module: auto-ap.ssr.admin
- Date: 2026-02-06
- Affected Component: auto-ap.ssr.admin.accounts-test
- Test Framework: clojure.test
- Database: Datomic
## Symptoms
- **Assertion failures on entity ID extraction**: `(account-id (first accounts))` returned `[entity-id]` (a list) instead of just the entity-id
- **Entity reference resolution failures**: Pull queries returned `{:account/type :db/id-12345}` (entity reference) instead of `{:account/type :account-type/asset}` (actual value)
- **Type mismatch errors**: Tests failed when comparing expected numeric code "12345" (string) to actual numeric code 12345 (number)
- **Tempid unavailability**: Server HTTP responses didn't include Datomic tempids for created entities
## What Didn't Work
**Attempted Solution 1: Using `first` on query results**
```clojure
(let [accounts (dc/q '[:find ?e :where [?e :account/name "TestAccount"]] db)]
(is (= expected-id (account-id (first accounts)))))
```
- **Why it failed**: Datomic queries return tuples, and `(first accounts)` returns a tuple `[entity-id]` (a list form), not just the entity-id
**Attempted Solution 2: Direct entity reference in pull**
```clojure
'[:account/type]
```
- **Why it failed**: Pull queries return entity references (like `:db/id-12345`) for schema attributes, not their actual values
**Attempted Solution 3: String comparison for numeric codes**
```clojure
(is (= "12345" (:account/numeric-code account)))
```
- **Why it failed**: Account numeric codes are stored as numbers in Datomic, not strings. The comparison failed due to type mismatch
**Attempted Solution 4: Checking tempids in server response**
```clojure
(is (some #(= expected-id %) (get-in result [:data :tempids])))
```
- **Why it failed**: SSR controllers return HTTP responses with standard fields (status, body, headers), not Datomic internal tempids
## Solution
### LEARNING #1: Use `ffirst` to Extract Entity IDs from Datomic Tuples
```clojure
; ❌ WRONG - Returns [entity-id] (a list form)
(account-id (first accounts))
; ✅ CORRECT - Extracts entity-id from the tuple
(account-id (ffirst accounts))
```
**Explanation**: Datomic queries return collections of tuples. Each tuple contains the result values in order. `(first accounts)` returns the first tuple as a list form `[entity-id]`, which cannot be destructured directly. `ffirst` applies `first` twice: first to get the tuple list, second to get the first element of the tuple (the entity-id).
**Best practice**: Always use `ffirst` or apply proper destructuring when working with Datomic query results.
### LEARNING #2: Include `[:db/ident]` to Resolve Entity References
```clojure
; ❌ WRONG - Returns entity reference
'[:account/type]
; ✅ CORRECT - Returns actual enum value
'[:account/type [:db/ident]]
```
**Access pattern**:
```clojure
; Extract the actual enum value from the entity
(:db/ident (:account/type account)) ; Returns :account-type/asset
```
**Explanation**: When querying entity attributes that reference other entities (like `account/type` referencing `account-type/asset`), Datomic returns the entity ID as a reference. Including `[:db/ident]` in the pull expression tells Datomic to fetch the actual value identifier, not the entity reference.
**Use case**: Essential when asserting on enum values or type-safe attributes in tests.
### LEARNING #3: Use Numbers for Numeric Codes, Not Strings
```clojure
; ❌ WRONG - Numeric code stored as number, not string
(is (= "12345" (:account/numeric-code account)))
; ✅ CORRECT - Numeric code is stored as a number
(is (= 12345 (:account/numeric-code account)))
```
**Explanation**: Datomic stores numeric attributes as numbers (`double`), even though they're defined as numeric code strings in the application domain. The database stores them as numbers; the API returns them as numbers.
**Best practice**: Always use numeric types when asserting on numeric codes, not string equivalents.
### LEARNING #4: Query the Database Directly for Verification
```clojure
; ❌ WRONG - Expected tempids in server response
(let [result (sut/account-save {...})
response (:response result)]
(is (contains? (:data response) :tempids)))
; ✅ CORRECT - Query database to verify entity was created
(let [result (sut/account-save {...})
db (dc/db conn)
accounts (dc/q '[:find ?e :where [?e :account/name "TestAccount"]] db)]
(is (seq accounts))) ; Query directly to verify
```
**Explanation**: SSR controllers return HTTP responses without Datomic-specific details. Tempids are internal Datomic identifiers not exposed in HTTP responses. To verify database operations, always query the database directly after the operation.
**Best practice**: For database-backed operations in tests, query the database after the operation to verify results.
## Why This Works
1. **What was the ROOT CAUSE of the problem?**
- Datomic queries return collections of tuples, not simple collections
- Entity references in Datomic need explicit resolution through `:db/ident`
- Numeric attributes in Datomic are stored as numbers, not strings
- SSR controllers don't expose Datomic internal state (tempids, internal IDs)
2. **Why does the solution address this root cause?**
- `ffirst` properly extracts entity IDs from Datomic tuples
- Including `[:db/ident]` in pull expressions resolves entity references to their actual values
- Using numeric types matches Datomic's storage format
- Querying the database directly accesses the truth source without relying on partial response data
3. **What was the underlying issue?**
- The Datomic API has specific behaviors that differ from standard Clojure collections
- Entity references are lazy and need explicit resolution
- Database storage types must be matched in test assertions
- SSR architecture doesn't expose internal database details in HTTP responses
- Tests must query the database directly to verify persisted data
## Prevention
### Test Writing Best Practices
1. **Always use `ffirst` for Datomic query results**
```clojure
; Standard pattern
(let [results (dc/q query-string db)
entity-id (ffirst results)] ; Not: (first results)
...)
```
2. **Include `[:db/ident]` for entity attribute resolution**
```clojure
; Standard pattern for enum values
'[:attribute [:db/ident]]
```
3. **Use correct data types in assertions**
```clojure
; Check attribute types match database
(is (instance? Long (:numeric-code account))) ; Not: String
```
4. **Query database for verification**
```clojure
; Standard pattern: operation → verify with database query
(let [result (sut/create-resource {...})
db (dc/db conn)
entity (dc/q '[:find ?e :where [?e :id ?id]] db)]
(is (seq entity))) ; Query directly
```
5. **Review Datomic-specific behaviors before writing assertions**
- Understand that queries return tuples
- Know that entity references need resolution
- Remember numeric type storage
- Accept that SSR responses don't include internal IDs
### Code Review Checklist
- [ ] Entity IDs extracted with `ffirst` from Datomic queries
- [ ] Entity references resolved with `[:db/ident]`
- [ ] Numeric attributes compared as numbers, not strings
- [ ] Database queries used for verification, not partial responses
- [ ] Datomic-specific behaviors documented in comments
### Test Utility Helpers (Recommended)
Consider creating helper functions in your test library to encapsulate these patterns:
```clojure
(ns auto-ap.ssr.test-helpers
(:require [datomic.api :as dc]))
(defn get-entity-by-attribute [conn attribute value]
"Retrieve entity by attribute-value pair from Datomic database.
Returns entity or nil if not found."
(ffirst
(dc/q '[:find ?e
:where [?e ?attr val]
[val ?attribute ?value]]
(dc/db conn)
attribute value)))
(defn resolve-attribute [entity attribute]
"Resolve an entity reference attribute to its value.
If attribute is a reference, returns :db/ident; otherwise returns value."
(if (map? (attribute entity))
(get-in entity [attribute :db/ident])
(attribute entity)))
```
## Related Issues
No related issues documented yet.
---
**Keywords**: atomic-query, datomic, entity-references, test-patterns, database-queries, ffirst, pull-queries, entity-resolution

View File

@@ -0,0 +1,288 @@
---
module: accounts test module
date: 2026-02-06
problem_type: test_failure
component: clojure_test
symptoms:
- "Debug println statement in production test (line 138)"
- "Improper deftest indentation breaking test structure"
- "Unused variable capture with :as z"
root_cause: debug_code_left_in_production_tests + improper_indentation
severity: high
tags: [test-quality, debug-code, test-structure, code-review]
---
# Debug Code and Test Nesting Issues in Accounts Test Suite
## Problem Description
Two critical issues were identified in `test/clj/auto_ap/ssr/admin/accounts_test.clj` through comprehensive code review:
1. **Debug statement left in production test**: Line 138 contained a debug `println` statement that outputs debug information every time the test runs
2. **Improper test nesting**: Sorting tests (lines 129, 141) had incorrect indentation, causing deftest blocks to be improperly structured
Both issues violate clean code principles and test organization standards.
## Observable Symptoms
```
FAIL in (account-sorting-by-numeric-code)
expected: nil
actual: debug output from println
```
**Additional evidence**:
- Code review agents identified the debug statement
- Inconsistent test structure across the file
- Tests run but produce unnecessary debug output
## Investigation Steps
### Initial Review
1. **Ran tests one-at-a-time** using `lein test :only auto-ap.ssr.admin.accounts-test/[test-name]`
2. **Conducted comprehensive code review** using multiple specialized agents:
- kieran-python-reviewer: Analyzed test quality and naming
- code-simplicity-reviewer: Reviewed complexity and simplification opportunities
- pattern-recognition-specialist: Identified recurring patterns and duplication
3. **Synthesized findings** from 3 parallel code review agents
### Root Cause Analysis
**Issue 1: Debug Statement (Line 138)**
- **Location**: `test/clj/auto_ap/ssr/admin/accounts_test.clj` line 138
- **Cause**: Debug code left in production test after initial fixes
- **Code**:
```clojure
(let [admin-identity (admin-token)
[accounts matching-count :as z] (sut/fetch-page {:query-params {:page 1 :per-page 10}})] ;; Default sort
(println "z is" z) ; <-- DEBUG STATEMENT
;; Test passes if sorting parameter is accepted and function returns successfully
```
**Issue 2: Improper Test Nesting (Lines 129, 141)**
- **Location**: `test/clj/auto_ap/ssr/admin/accounts_test.clj` lines 129, 141
- **Cause**: Incorrect indentation causing deftests to appear nested
- **Evidence**: Lines 129 and 141 had 2-space indentation when all other deftests are at column 0
- **Impact**: Breaks test organization, unclear which tests are top-level
## Working Solution
### Fix 1: Remove Debug Statement
**Location**: `test/clj/auto_ap/ssr/admin/accounts_test.clj` line 137-138
**Before**:
```clojure
(let [admin-identity (admin-token)
[accounts matching-count :as z] (sut/fetch-page {:query-params {:page 1 :per-page 10}})] ;; Default sort
(println "z is" z)
;; Test passes if sorting parameter is accepted and function returns successfully
(is (number? matching-count)))))
```
**After**:
```clojure
(let [admin-identity (admin-token)
[accounts matching-count] (sut/fetch-page {:query-params {:page 1 :per-page 10}})] ;; Default sort
;; Test passes if sorting parameter is accepted and function returns successfully
(is (number? matching-count)))))
```
**Changes**:
1. Removed `(println "z is" z)` debug statement
2. Removed unused variable capture `:as z`
### Fix 2: Fix Test Nesting/Indentation
**Location**: `test/clj/auto_ap/ssr/admin/accounts_test.clj` lines 129, 141
**Before**:
```clojure
(deftest account-sorting-by-numeric-code ; <-- INCORRECT: 2-space indentation
(testing "Account sorting by numeric code should work (default)"
...))
(deftest account-sorting-by-type ; <-- INCORRECT: 2-space indentation
(testing "Account sorting by type should work"
...))
```
**After**:
```clojure
(deftest account-sorting-by-numeric-code ; <-- FIXED: Top-level indentation
(testing "Account sorting by numeric code should work (default)"
...))
(deftest account-sorting-by-type ; <-- FIXED: Top-level indentation
(testing "Account sorting by type should work"
...))
```
**Changes**:
1. Removed 2-space indentation from lines 129, 141
2. Made deftests top-level (column 0) like all other deftests
## Files Modified
- `test/clj/auto_ap/ssr/admin/accounts_test.clj`: Fixed 2 issues (lines 137-138, 129, 141)
- `todos/001-pending-p1-remove-debug-statement.md`: Updated to complete
- `todos/002-pending-p1-fix-test-nesting.md`: Updated to complete
## Verification
**Test Results After Fix**:
```
lein test auto-ap.ssr.admin.accounts-test
Ran 9 tests containing 19 assertions.
0 failures, 0 errors.
```
✅ All tests pass with strengthened test structure
## Prevention Strategies
### Test Code Quality Standards
1. **Never leave debug code in production**
- Debug `println` statements, `pprint`, or debug variables should be removed before merging
- Use a linter or test framework that catches console output in tests
2. **Maintain consistent test structure**
- All `deftest` blocks should be at column 0 (top-level)
- Each deftest should have its own `(testing "..."` block
- Consistent indentation across entire test file
3. **Remove unused variables**
- Don't capture variables with `:as` if never used
- Use `_` for intentionally unused variables
4. **Test structure patterns**
```clojure
; CORRECT: Consistent top-level structure
(deftest test-name
(testing "descriptive message"
...))
; WRONG: Incorrect indentation
(deftest test-name
(testing "descriptive message"
...))
```
### Code Review Checklist
When reviewing test code:
- [ ] No debug statements (`println`, `pprint`, etc.) in production
- [ ] All `deftest` blocks at column 0
- [ ] No unused variable captures
- [ ] Consistent indentation throughout
- [ ] Tests run cleanly without extra output
- [ ] Test structure matches other tests in file
### Automated Checks
**Recommended linting:**
```bash
# Add to .clj-kondo config
{:lint-as {:auto-ap.ssr.admin.accounts-test [:defn]}}
```
**Test output monitoring:**
```bash
# Run tests and grep for println
lein test auto-ap.ssr.admin.accounts-test 2>&1 | grep "println"
```
## Cross-References
None - this was the first occurrence of these specific issues in the accounts test suite.
## Lessons Learned
### Pattern Recognition
**Common Debug Code Mistakes**:
- `println` statements left in production code
- Unused debug variables captured with `:as`
- `pprint` or `pr-str` for debugging purposes
- `clojure.pprint/pprint` in test code
**Common Test Structure Issues**:
- Inconsistent indentation across deftests
- Improper nesting of deftest blocks
- Mix of top-level and nested test structures
- Missing descriptive `testing` block names
**Why These Happen**:
- Debug code often added quickly during development
- Test structure patterns not followed consistently
- Code review may not catch these issues without specific linting
- Missing automated checks for debug output in tests
### Debug Code Detection
**How to find debug code in tests**:
```bash
# Search for println in test files
grep -n "println" test/clj/auto_ap/**/*_test.clj
# Search for debug variables
grep -n ":as .* (sut/.*\|db/.*\|dc/.*)" test/clj/auto_ap/**/*_test.clj
# Search for pprint
grep -n "pprint\|pp" test/clj/auto_ap/**/*_test.clj
```
### Test Structure Validation
**How to verify test structure**:
```bash
# Check deftest indentation
awk '/\(deftest/ {print NR": "$0}' test/clj/auto_ap/**/*_test.clj
# Count tests with inconsistent indentation
awk '/\(deftest/ {if (sub(/^ +/, "")) print NR": "$0}' test/clj/auto_ap/**/*_test.clj
```
## Related Code Quality Issues
These issues are related to broader test code quality patterns:
1. **Code Duplication**: Tests had 50% duplication (Solr redefs, account creation patterns)
- Issue: 004 in todos/
2. **Weak Assertions**: 40% of assertions only checked types
- Issue: 003 in todos/
3. **Documentation-Only Tests**: Test that just documented behavior
- Issue: 005 in todos/
## Next Steps
The P1 fixes are complete. Remaining P2 issues can be addressed in future work:
- **Issue 003**: Strengthen weak assertions to verify actual behavior
- **Issue 004**: Extract test helpers to eliminate code duplication
- **Issue 005**: Remove documentation-only test
All P1 todos have been completed and verified:
- ✅ Todo 001: Removed debug statement
- ✅ Todo 002: Fixed test nesting structure
- ✅ Tests passing: 0 failures, 0 errors
## Resources
**Review Process**:
- kieran-python-reviewer (test quality and code organization)
- code-simplicity-reviewer (complexity analysis)
- pattern-recognition-specialist (recurring patterns)
**Files Modified**:
- `test/clj/auto_ap/ssr/admin/accounts_test.clj`
**Related Todos**:
- `todos/003-pending-p2-strengthen-weak-assertions.md`
- `todos/004-pending-p2-extract-test-helpers.md`
- `todos/005-pending-p2-remove-doc-only-test.md`

View File

@@ -0,0 +1,228 @@
---
module: accounts test module
date: 2026-02-06
problem_type: test_failure
component: clojure_test
symptoms:
- "matching-count is nil when destructuring fetch-page result"
- "Form errors key expected [:account/numeric-code] but got :account/numeric-code"
- "Unbound query variables: #{?sort-} when sorting by field"
- "Tests failing with 3 failures and 4 errors"
root_cause: incorrect_destructuring_patterns_and_parameter_formats
severity: medium
tags: [destructuring, parameter_format, fetch_page, sort_parameters]
---
# Test Destructuring Issues in Accounts Module
## Problem Description
Multiple tests in `test/clj/auto_ap/ssr/admin/accounts_test.clj` were failing due to incorrect destructuring patterns and parameter formats. Tests expected different return values and parameter structures than what the source code actually provides.
## Observable Symptoms
```
FAIL in (account-creation-duplicate-numeric-code-detection)
expected: (contains? (:form-errors data) [:account/numeric-code])
actual: (not (contains? #:account{:numeric-code ["The code 12347 is already in use."]} [:account/numeric-code]))
FAIL in (account-grid-view-loads-accounts)
expected: (number? matching-count)
actual: (not (number? nil))
ERROR in (account-sorting-by-name)
Query is referencing unbound variables: #{?sort-}
```
## Investigation Attempts
1. **Initial approach**: Ran tests one at a time using `lein test :only auto-ap.ssr.admin.accounts-test/[test-name]`
2. **Discovered patterns**: Found 3 distinct root causes affecting different test groups
3. **Checked source code**: Reviewed `accounts.clj` to understand actual function signatures and parameter expectations
**What didn't work:**
- Initially tried generic exception catching
- Attempted to modify source code (wrong approach - should only fix tests)
## Root Cause Analysis
### Issue 1: Form Errors Key Format (account-creation-duplicate-numeric-code-detection)
**Problem**: Test expected vector key `[`:account/numeric-code]` but actual form-errors map uses keyword key `:account/numeric-code`.
**Technical explanation**: The `field-validation-error` function creates form-errors as `(assoc-in {} path [m])` where `path` is `[:account/numeric-code]`. This creates a map with keyword key, not vector key.
**Code location**: `src/clj/auto_ap/ssr/utils.clj` - `field-validation-error` function creates the structure.
### Issue 2: fetch-page Return Value Format (grid view and display tests)
**Problem**: Test destructured `fetch-page` result into 3-tuple `[_ accounts matching-count]` but function actually returns 2-tuple `[accounts matching-count]`.
**Technical explanation**: The `fetch-page` function returns `[results matching-count]` where:
- First element: array of account entities
- Second element: total count (number)
**Code location**: `src/clj/auto_ap/ssr/admin/accounts.clj` line 143-148:
```clojure
(defn fetch-page [request]
(let [db (dc/db conn)
{ids-to-retrieve :ids matching-count :count} (fetch-ids db request)]
[(->> (hydrate-results ids-to-retrieve db request))
matching-count]))
```
### Issue 3: Sort Parameter Format (sorting tests)
**Problem**: Tests passed sort as string `:sort "name"` but `add-sorter-fields` expects collection of sort-keys.
**Technical explanation**: The `add-sorter-fields` function iterates over `(:sort args)` which should be a collection like `[{:sort-key "name"}]`. When passing a string, it fails to iterate properly.
**Code location**: `src/clj/auto_ap/ssr/admin/accounts.clj` line 100-106:
```clojure
(:sort query-params) (add-sorter-fields {"name" ['[?e :account/name ?n]
'[(clojure.string/upper-case ?n) ?sort-name]]
"code" ['[(get-else $ ?e :account/numeric-code 0) ?sort-code]]
"type" ['[?e :account/type ?t]
'[?t :db/ident ?ti]
'[(name ?ti) ?sort-type]]}
query-params)
```
## Working Solution
### Fix 1: Form Errors Key Format
**Changed in** `test/clj/auto_ap/ssr/admin/accounts_test.clj` line 57:
```clojure
;; BEFORE
(is (contains? (:form-errors data) [:account/numeric-code]))
;; AFTER
(is (contains? (:form-errors data) :account/numeric-code))
```
### Fix 2: fetch-page Destructuring Pattern
**Changed in** `test/clj/auto_ap/ssr/admin/accounts_test.clj` lines 98-104 and 110-117:
```clojure
;; BEFORE - expecting 3-tuple
(let [result (sut/fetch-page {:query-params {:page 1 :per-page 10}})
[_ accounts matching-count] result]
(is (vector? result))
(is (= 2 (count result)))
(is (number? matching-count)))
;; AFTER - proper 2-tuple destructuring
(let [[accounts matching-count] (sut/fetch-page {:query-params {:page 1 :per-page 10}})]
(is (number? matching-count)))
```
### Fix 3: Sort Parameter Format
**Changed in** `test/clj/auto_ap/ssr/admin/accounts_test.clj` lines 126 and 150:
```clojure
;; BEFORE - passing string
{:query-params {:page 1 :per-page 10 :sort "name"}}
;; AFTER - passing collection with sort-keys
{:query-params {:page 1 :per-page 10 :sort [{:sort-key "name"}]}}
```
## Files Modified
- `test/clj/auto_ap/ssr/admin/accounts_test.clj`: Fixed 4 test functions
- `account-creation-duplicate-numeric-code-detection`
- `account-grid-view-loads-accounts`
- `account-grid-displays-correct-columns`
- `account-sorting-by-name`
- `account-sorting-by-type`
## Verification
**Test results after fix:**
```
Ran 9 tests containing 19 assertions.
0 failures, 0 errors.
```
All tests pass successfully.
## Prevention Strategies
### Destructuring Rules
1. **Always inspect function signatures** before writing tests
- Use `(-> (sut/fetch-page ...) meta)` or read source code to understand return types
- Verify tuple lengths before destructuring
2. **Form errors follow a pattern**
- Look at how `field-validation-error` creates errors in `utils.clj`
- Form errors use keyword keys, not vector keys
- Pattern: `(assoc-in {} path [message])` where path is keyword(s)
3. **Query parameters have specific formats**
- Sort parameters should be collections: `[{:sort-key "field"}]`
- Check `add-sorter-fields` implementation in the source module
- Don't assume single-value parameters when API accepts collections
### Test-First Approach
1. **Mock/stub external dependencies** in tests before calling functions
- Always use `with-redefs` to control solr, database, etc.
- This makes testing more predictable and isolated
2. **Run tests incrementally**
- Fix one test at a time using `lein test :only`
- Track which tests fail to understand pattern
- Don't fix multiple unrelated issues simultaneously
### Pattern Recognition
**Common destructuring issues to watch for:**
| Component | Expected Format | Common Mistake | Fix |
|-----------|----------------|----------------|-----|
| `fetch-page` | `[results matching-count]` | 3-tuple like `[data pages total]` | Verify tuple length |
| Form errors | `{:field-name message}` | `[:field-name message]` | Use keyword keys |
| Sort params | `[{:sort-key "field"}]` | `"field"` | Use collection |
| Pagination | `{:page 1 :per-page 10}` | `{:page 1}` | Provide all needed params |
## Cross-References
None - no similar issues found in existing documentation.
## Lessons Learned
### Key Patterns Extracted
1. **Never assume tuple sizes** - Always verify return values match expectations
2. **Form error structure is consistent** - Keyword keys, not vector keys
3. **Query parameter formats matter** - Collections vs single values
4. **Inspect source code** - The `add-sorter-fields` function reveals the expected sort parameter format
5. **Test incrementally** - Run one test at a time to isolate issues
### Debugging Process
When tests fail with "wrong number of arguments" or "destructuring failed":
1. **Check function signature** in source code
2. **Add logging** or print the actual return value `(println "Result:" result)`
3. **Verify parameter formats** - especially collections
4. **Test incrementally** - one failing test at a time
### Documentation Reminder
Always document the **actual** API signature, not assumed ones:
```clojure
;; BAD - assuming knowledge
(defn fetch-page [request] ...) ; assumed return type
;; GOOD - verified from source
;; From accounts.clj:143-148
;; Returns: [results matching-count] where results is array of entities
(defn fetch-page [request] ...)
```

View File

@@ -2,13 +2,13 @@
:description "FIXME: write description"
:url "http://example.com/FIXME"
:min-lein-version "2.0.0"
:dependencies [[com.google.guava/guava "31.1-jre"]
:dependencies [#_[com.google.guava/guava "31.1-jre"]
[org.clojure/clojure "1.10.1"]
[com.unbounce/clojure-dogstatsd-client "0.7.0"]
[org.clojure/tools.reader "1.3.6"]
[com.cognitect/hmac-authn "0.1.210"]
[com.github.ivarref/gen-fn "0.2.46"]
[com.datomic/peer "1.0.6726"]
[com.datomic/peer "1.0.6726" ]
[lambdaisland/edn-lines "1.0.10"]
[bidi "2.1.6"]
[ring/ring-defaults "0.3.2" :exclusions [ring ring/ring-core]]
@@ -45,7 +45,11 @@
[hawk "0.2.11"]
[clj-time "0.15.2"]
[ring/ring-json "0.5.0" :exclusions [cheshire]]
[com.cemerick/url "0.1.1"]
[com.cemerick/url "0.1.1" ]
[pathetic "0.5.0" :exclusions [com.cemerick/clojurescript.test]]
[funcool/cuerdas "2.2.0" :exclusions [[org.clojure/clojurescript]]]
[bk/ring-gzip "0.3.0"]
[amazonica "0.3.153"
:exclusions [com.amazonaws/aws-java-sdk
@@ -105,16 +109,17 @@
[commons-codec "1.12"]]
:plugins [[lein-ring "0.9.7"]
[lein-cljsbuild "1.1.5"]
#_[lein-cljsbuild "1.1.5"]
[dev.weavejester/lein-cljfmt "0.15.6"]
[lein-ancient "0.6.15"]]
:clean-targets ^{:protect false} ["resources/public/js/compiled" "target"]
#_#_:ring {:handler auto-ap.handler/app}
:source-paths ["src/clj" "src/cljc" "src/cljs" "iol_ion/src" ]
:source-paths ["src/clj" "src/cljc" "iol_ion/src" ]
:resource-paths ["resources"]
:aliases {"build" ["do" ["uberjar"]]
"fig:dev" ["run" "-m" "figwheel.main" "-b" "dev" "-r"]
#_#_"fig:dev" ["run" "-m" "figwheel.main" "-b" "dev" "-r"]
"build-dev" ["trampoline" "run" "-m" "figwheel.main" "-b" "dev" "-r"]
"fig:min" ["run" "-m" "figwheel.main" "-O" "whitespace" "-bo" "min"]}
#_#_"fig:min" ["run" "-m" "figwheel.main" "-O" "whitespace" "-bo" "min"]}
:profiles {
@@ -127,7 +132,7 @@
[org.clojure/java.jdbc "0.7.11"]
#_[com.datomic/dev-local "1.0.243"]
[etaoin "0.4.1"]
[com.bhauman/figwheel-main "0.2.18" :exclusions [org.clojure/clojurescript
#_[com.bhauman/figwheel-main "0.2.18" :exclusions [org.clojure/clojurescript
ring
ring/ring-core
ring/ring-codec
@@ -141,7 +146,7 @@
org.eclipse.jetty.websocket/websocket-server
org.eclipse.jetty.websocket/websocket-servlet
args4j]]
[com.bhauman/rebel-readline-cljs "0.1.4" :exclusions [org.clojure/clojurescript]]
#_[com.bhauman/rebel-readline-cljs "0.1.4" :exclusions [org.clojure/clojurescript]]
[javax.servlet/servlet-api "2.5"]]
:plugins [[lein-pdo "0.1.1"]]
:jvm-opts ["-Dconfig=config/dev.edn" "-Xms4G" "-Xmx20G" "-XX:-OmitStackTraceInFastThrow"]}
@@ -149,8 +154,7 @@
:uberjar
{:java-cmd "/usr/lib/jvm/java-11-openjdk/bin/java"
:aot []
:prep-tasks ["fig:min"]
:dependencies [[com.bhauman/figwheel-main "0.2.18" :exclusions [org.clojure/clojurescript
:dependencies [#_[com.bhauman/figwheel-main "0.2.18" :exclusions [org.clojure/clojurescript
ring
ring/ring-core
ring/ring-codec
@@ -165,18 +169,18 @@
org.eclipse.jetty.websocket/websocket-server
org.eclipse.jetty.websocket/websocket-servlet
args4j]]]}
:provided {:dependencies [[org.clojure/clojurescript "1.11.4"
:provided {:dependencies [#_[org.clojure/clojurescript "1.11.4"
:exclusions [com.google.code.findbugs/jsr305
com.fasterxml.jackson.core/jackson-core]]
[reagent "1.0.0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server] ]
[re-frame "1.1.2"
#_[reagent "1.0.0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server] ]
#_[re-frame "1.1.2"
:exclusions
[reagent
org.clojure/clojurescript]]
[re-frame-utils "0.1.0"]
[com.andrewmcveigh/cljs-time "0.5.2"]
[cljs-http "0.1.46"]
[kibu/pushy "0.3.8"]]}
#_[re-frame-utils "0.1.0"]
#_[com.andrewmcveigh/cljs-time "0.5.2"]
#_[cljs-http "0.1.46"]
#_[kibu/pushy "0.3.8"]]}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2020 Jeremy Thomas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -1,130 +0,0 @@
# [Bulma](https://bulma.io)
Bulma is a **modern CSS framework** based on [Flexbox](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Using_CSS_flexible_boxes).
[![npm](https://img.shields.io/npm/v/bulma.svg)][npm-link]
[![npm](https://img.shields.io/npm/dm/bulma.svg)][npm-link]
[![](https://data.jsdelivr.com/v1/package/npm/bulma/badge)](https://www.jsdelivr.com/package/npm/bulma)
[![Awesome][awesome-badge]][awesome-link]
[![Join the chat at https://gitter.im/jgthms/bulma](https://badges.gitter.im/jgthms/bulma.svg)](https://gitter.im/jgthms/bulma)
[![Build Status](https://travis-ci.org/jgthms/bulma.svg?branch=master)](https://travis-ci.org/jgthms/bulma)
<a href="https://bulma.io"><img src="https://raw.githubusercontent.com/jgthms/bulma/master/docs/images/bulma-banner.png" alt="Bulma: a Flexbox CSS framework" style="max-width:100%;" width="600"></a>
## Quick install
Bulma is constantly in development! Try it out now:
### NPM
```sh
npm install bulma
```
**or**
### Yarn
```sh
yarn add bulma
```
### Bower
```sh
bower install bulma
```
### Import
After installation, you can import the CSS file into your project using this snippet:
```sh
import 'bulma/css/bulma.css'
```
### CDN
[https://www.jsdelivr.com/package/npm/bulma](https://www.jsdelivr.com/package/npm/bulma)
Feel free to raise an issue or submit a pull request.
## CSS only
Bulma is a **CSS** framework. As such, the sole output is a single CSS file: [bulma.css](https://github.com/jgthms/bulma/blob/master/css/bulma.css)
You can either use that file, "out of the box", or download the Sass source files to customize the [variables](https://bulma.io/documentation/overview/variables/).
There is **no** JavaScript included. People generally want to use their own JS implementation (and usually already have one). Bulma can be considered "environment agnostic": it's just the style layer on top of the logic.
## Browser Support
Bulma uses [autoprefixer](https://github.com/postcss/autoprefixer) to make (most) Flexbox features compatible with earlier browser versions. According to [Can I use](https://caniuse.com/#feat=flexbox), Bulma is compatible with **recent** versions of:
* Chrome
* Edge
* Firefox
* Opera
* Safari
Internet Explorer (10+) is only partially supported.
## Documentation
The documentation resides in the [docs](docs) directory, and is built with the Ruby-based [Jekyll](https://jekyllrb.com/) tool.
Browse the [online documentation here.](https://bulma.io/documentation/overview/start/)
## Related projects
| Project | Description |
|--------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------|
| [Bulma with Attribute Modules](https://github.com/j5bot/bulma-attribute-selectors) | Adds support for attribute-based selectors |
| [Bulma with Rails](https://github.com/joshuajansen/bulma-rails) | Integrates Bulma with the rails asset pipeline |
| [Vue Admin (dead)](https://github.com/vue-bulma/vue-admin) | Vue Admin framework powered by Bulma |
| [Bulmaswatch](https://github.com/jenil/bulmaswatch) | Free themes for Bulma |
| [Goldfish (read-only)](https://github.com/Caiyeon/goldfish) | Vault UI with Bulma, Golang, and Vue Admin |
| [ember-bulma](https://github.com/open-tux/ember-bulma) | Ember addon providing a collection of UI components for Bulma |
| [Bloomer](https://bloomer.js.org) | A set of React components for Bulma |
| [React-bulma](https://github.com/kulakowka/react-bulma) | React.js components for Bulma |
| [Buefy](https://buefy.org/) | Lightweight UI components for Vue.js based on Bulma |
| [vue-bulma-components](https://github.com/vouill/vue-bulma-components) | Bulma components for Vue.js with straightforward syntax |
| [BulmaJS](https://github.com/VizuaaLOG/BulmaJS) | Javascript integration for Bulma. Written in ES6 with a data-* API |
| [Bulma-modal-fx](https://github.com/postare/bulma-modal-fx) | A set of modal window effects with CSS transitions and animations for Bulma |
| [Bulma Stylus](https://github.com/groenroos/bulma-stylus) | Up-to-date 1:1 translation to Stylus
| [Bulma.styl (read-only)](https://github.com/log1x/bulma.styl) | 1:1 Stylus translation of Bulma 0.6.11 |
| [elm-bulma](https://github.com/surprisetalk/elm-bulma) | Bulma + Elm |
| [elm-bulma-classes](https://github.com/ahstro/elm-bulma-classes) | Bulma classes prepared for usage with Elm |
| [Bulma Customizer](https://bulma-customizer.bstash.io/) | Bulma Customizer &#8211; Create your own **bespoke** Bulma build |
| [Fulma](https://fulma.github.io/Fulma/) | Wrapper around Bulma for [fable-react](https://github.com/fable-compiler/fable-react) |
| [Laravel Enso](https://github.com/laravel-enso/enso) | SPA Admin Panel built with Bulma, VueJS and Laravel |
| [Django Bulma](https://github.com/timonweb/django-bulma) | Integrates Bulma with Django |
| [Bulma Templates](https://github.com/dansup/bulma-templates) | Free Templates for Bulma |
| [React Bulma Components](https://github.com/couds/react-bulma-components) | Another React wrap on React for Bulma.io |
| [purescript-bulma](https://github.com/sectore/purescript-bulma) | PureScript bindings for Bulma |
| [Vue Datatable](https://github.com/laravel-enso/vuedatatable) | Bulma themed datatable based on Vue, Laravel & JSON templates |
| [bulma-fluent](https://mubaidr.github.io/bulma-fluent/) | Fluent Design Theme for Bulma inspired by Microsofts Fluent Design System |
| [csskrt-csskrt](https://github.com/4d11/csskrt-csskrt) | Automatically add Bulma classes to HTML files |
| [bulma-pagination-react](https://github.com/hipstersmoothie/bulma-pagination-react) | Bulma pagination as a react component |
| [bulma-helpers](https://github.com/jmaczan/bulma-helpers) | Functional / Atomic CSS classes for Bulma |
| [bulma-swatch-hook](https://github.com/hipstersmoothie/bulma-swatch-hook) | Bulma swatches as a react hook and a component |
| [BulmaWP (read-only)](https://github.com/tomhrtly/BulmaWP) | Starter WordPress theme for Bulma |
| [Ralma](https://github.com/aldi/ralma) | Stateless Ractive.js Components for Bulma |
| [Django Simple Bulma](https://github.com/python-discord/django-simple-bulma) | Lightweight integration of Bulma and Bulma-Extensions for your Django app |
| [rbx](https://dfee.github.io/rbx) | Comprehensive React UI Framework written in TypeScript |
| [Awesome Bulma Templates](https://github.com/aldi/awesome-bulma-templates) | Free real-world Templates built with Bulma |
| [Trunx](http://g14n.info/trunx) | Super Saiyan React components, son of awesome Bulma, implemented in TypeScript |
| [@aybolit/bulma](https://github.com/web-padawan/aybolit/tree/master/packages/bulma) | Web Components library inspired by Bulma and Bulma-extensions |
| [Drulma](https://www.drupal.org/project/drulma) | Drupal theme for Bulma. |
| [Bulrush](https://github.com/textbook/bulrush) | A Bulma-based Python Pelican blog theme |
| [Bulma Variable Export](https://github.com/service-paradis/bulma-variables-export) | Access Bulma Variables in Javascript/Typescript in project using Webpack |
| [Bulmil](https://github.com/gomah/bulmil) | An agnostic UI components library based on Web Components, made with Bulma & Stencil. |
| [Svelte Bulma Components](https://github.com/elcobvg/svelte-bulma-components) | Library of UI components to be used in [Svelte.js](https://svelte.technology/) or standalone. |
| [Bulma Nunjucks Starterkit](https://github.com/benninkcorien/nunjucks-starter-kit) | Starterkit for Nunjucks with Bulma. |
## Copyright and license
Code copyright 2020 Jeremy Thomas. Code released under [the MIT license](https://github.com/jgthms/bulma/blob/master/LICENSE).
[npm-link]: https://www.npmjs.com/package/bulma
[awesome-link]: https://github.com/awesome-css-group/awesome-css
[awesome-badge]: https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg

View File

@@ -1,10 +0,0 @@
@charset "utf-8"
/*! bulma.io v0.9.0 | MIT License | github.com/jgthms/bulma */
@import "sass/utilities/_all"
@import "sass/base/_all"
@import "sass/elements/_all"
@import "sass/form/_all"
@import "sass/components/_all"
@import "sass/grid/_all"
@import "sass/helpers/_all"
@import "sass/layout/_all"

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,82 +0,0 @@
{
"_from": "bulma@0.9.0",
"_id": "bulma@0.9.0",
"_inBundle": false,
"_integrity": "sha512-rV75CJkubNUroAt0qCRkjznZLoaXq/ctfMXsMvKSL84UetbSyx5REl96e8GoQ04G4Tkw0XF3STECffTOQrbzOQ==",
"_location": "/bulma",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "bulma@0.9.0",
"name": "bulma",
"escapedName": "bulma",
"rawSpec": "0.9.0",
"saveSpec": null,
"fetchSpec": "0.9.0"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/bulma/-/bulma-0.9.0.tgz",
"_shasum": "948c5445a49e9d7546f0826cb3820d17178a814f",
"_spec": "bulma@0.9.0",
"_where": "/Users/jthomas/Desktop",
"author": {
"name": "Jeremy Thomas",
"email": "bbxdesign@gmail.com",
"url": "https://jgthms.com"
},
"bugs": {
"url": "https://github.com/jgthms/bulma/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Modern CSS framework based on Flexbox",
"devDependencies": {
"autoprefixer": "^9.8.0",
"clean-css-cli": "^4.3.0",
"node-sass": "^4.14.1",
"postcss-cli": "^7.1.1",
"rimraf": "^3.0.2"
},
"files": [
"css",
"sass",
"bulma.sass",
"LICENSE",
"README.md"
],
"homepage": "https://bulma.io",
"keywords": [
"css",
"sass",
"flexbox",
"responsive",
"framework"
],
"license": "MIT",
"main": "bulma.sass",
"name": "bulma",
"repository": {
"type": "git",
"url": "git+https://github.com/jgthms/bulma.git"
},
"scripts": {
"build": "npm run build-sass && npm run build-autoprefix && npm run build-cleancss",
"build-autoprefix": "postcss --use autoprefixer --map false --output css/bulma.css css/bulma.css",
"build-cleancss": "cleancss -o css/bulma.min.css css/bulma.css",
"build-sass": "node-sass --output-style expanded --source-map true bulma.sass css/bulma.css",
"clean": "rimraf css",
"deploy": "npm run clean && npm run build && npm run rtl",
"rtl": "npm run rtl-sass && npm run rtl-autoprefix && npm run rtl-cleancss",
"rtl-autoprefix": "postcss --use autoprefixer --map false --output css/bulma-rtl.css css/bulma-rtl.css",
"rtl-cleancss": "cleancss -o css/bulma-rtl.min.css css/bulma-rtl.css",
"rtl-sass": "node-sass --output-style expanded --source-map true bulma-rtl.sass css/bulma-rtl.css",
"start": "npm run build-sass -- --watch"
},
"style": "bulma/css/bulma.min.css",
"unpkg": "css/bulma.css",
"version": "0.9.0"
}

View File

@@ -1,4 +0,0 @@
@charset "utf-8"
@import "minireset.sass"
@import "generic.sass"

View File

@@ -1,142 +0,0 @@
$body-background-color: $scheme-main !default
$body-size: 16px !default
$body-min-width: 300px !default
$body-rendering: optimizeLegibility !default
$body-family: $family-primary !default
$body-overflow-x: hidden !default
$body-overflow-y: scroll !default
$body-color: $text !default
$body-font-size: 1em !default
$body-weight: $weight-normal !default
$body-line-height: 1.5 !default
$code-family: $family-code !default
$code-padding: 0.25em 0.5em 0.25em !default
$code-weight: normal !default
$code-size: 0.875em !default
$small-font-size: 0.875em !default
$hr-background-color: $background !default
$hr-height: 2px !default
$hr-margin: 1.5rem 0 !default
$strong-color: $text-strong !default
$strong-weight: $weight-bold !default
$pre-font-size: 0.875em !default
$pre-padding: 1.25rem 1.5rem !default
$pre-code-font-size: 1em !default
html
background-color: $body-background-color
font-size: $body-size
-moz-osx-font-smoothing: grayscale
-webkit-font-smoothing: antialiased
min-width: $body-min-width
overflow-x: $body-overflow-x
overflow-y: $body-overflow-y
text-rendering: $body-rendering
text-size-adjust: 100%
article,
aside,
figure,
footer,
header,
hgroup,
section
display: block
body,
button,
input,
select,
textarea
font-family: $body-family
code,
pre
-moz-osx-font-smoothing: auto
-webkit-font-smoothing: auto
font-family: $code-family
body
color: $body-color
font-size: $body-font-size
font-weight: $body-weight
line-height: $body-line-height
// Inline
a
color: $link
cursor: pointer
text-decoration: none
strong
color: currentColor
&:hover
color: $link-hover
code
background-color: $code-background
color: $code
font-size: $code-size
font-weight: $code-weight
padding: $code-padding
hr
background-color: $hr-background-color
border: none
display: block
height: $hr-height
margin: $hr-margin
img
height: auto
max-width: 100%
input[type="checkbox"],
input[type="radio"]
vertical-align: baseline
small
font-size: $small-font-size
span
font-style: inherit
font-weight: inherit
strong
color: $strong-color
font-weight: $strong-weight
// Block
fieldset
border: none
pre
+overflow-touch
background-color: $pre-background
color: $pre
font-size: $pre-font-size
overflow-x: auto
padding: $pre-padding
white-space: pre
word-wrap: normal
code
background-color: transparent
color: currentColor
font-size: $pre-code-font-size
padding: 0
table
td,
th
vertical-align: top
&:not([align])
text-align: inherit
th
color: $text-strong

View File

@@ -1 +0,0 @@
@warn "The helpers.sass file is DEPRECATED. It has moved into its own /helpers folder. Please import sass/helpers/_all instead."

View File

@@ -1,79 +0,0 @@
/*! minireset.css v0.0.6 | MIT License | github.com/jgthms/minireset.css */
// Blocks
html,
body,
p,
ol,
ul,
li,
dl,
dt,
dd,
blockquote,
figure,
fieldset,
legend,
textarea,
pre,
iframe,
hr,
h1,
h2,
h3,
h4,
h5,
h6
margin: 0
padding: 0
// Headings
h1,
h2,
h3,
h4,
h5,
h6
font-size: 100%
font-weight: normal
// List
ul
list-style: none
// Form
button,
input,
select,
textarea
margin: 0
// Box sizing
html
box-sizing: border-box
*
&,
&::before,
&::after
box-sizing: inherit
// Media
img,
video
height: auto
max-width: 100%
// Iframe
iframe
border: 0
// Table
table
border-collapse: collapse
border-spacing: 0
td,
th
padding: 0
&:not([align])
text-align: inherit

View File

@@ -1,14 +0,0 @@
@charset "utf-8"
@import "breadcrumb.sass"
@import "card.sass"
@import "dropdown.sass"
@import "level.sass"
@import "media.sass"
@import "menu.sass"
@import "message.sass"
@import "modal.sass"
@import "navbar.sass"
@import "pagination.sass"
@import "panel.sass"
@import "tabs.sass"

View File

@@ -1,75 +0,0 @@
$breadcrumb-item-color: $link !default
$breadcrumb-item-hover-color: $link-hover !default
$breadcrumb-item-active-color: $text-strong !default
$breadcrumb-item-padding-vertical: 0 !default
$breadcrumb-item-padding-horizontal: 0.75em !default
$breadcrumb-item-separator-color: $border-hover !default
.breadcrumb
@extend %block
@extend %unselectable
font-size: $size-normal
white-space: nowrap
a
align-items: center
color: $breadcrumb-item-color
display: flex
justify-content: center
padding: $breadcrumb-item-padding-vertical $breadcrumb-item-padding-horizontal
&:hover
color: $breadcrumb-item-hover-color
li
align-items: center
display: flex
&:first-child a
+ltr-property("padding", 0, false)
&.is-active
a
color: $breadcrumb-item-active-color
cursor: default
pointer-events: none
& + li::before
color: $breadcrumb-item-separator-color
content: "\0002f"
ul,
ol
align-items: flex-start
display: flex
flex-wrap: wrap
justify-content: flex-start
.icon
&:first-child
+ltr-property("margin", 0.5em)
&:last-child
+ltr-property("margin", 0.5em, false)
// Alignment
&.is-centered
ol,
ul
justify-content: center
&.is-right
ol,
ul
justify-content: flex-end
// Sizes
&.is-small
font-size: $size-small
&.is-medium
font-size: $size-medium
&.is-large
font-size: $size-large
// Styles
&.has-arrow-separator
li + li::before
content: "\02192"
&.has-bullet-separator
li + li::before
content: "\02022"
&.has-dot-separator
li + li::before
content: "\000b7"
&.has-succeeds-separator
li + li::before
content: "\0227B"

View File

@@ -1,79 +0,0 @@
$card-color: $text !default
$card-background-color: $scheme-main !default
$card-shadow: 0 0.5em 1em -0.125em rgba($scheme-invert, 0.1), 0 0px 0 1px rgba($scheme-invert, 0.02) !default
$card-header-background-color: transparent !default
$card-header-color: $text-strong !default
$card-header-padding: 0.75rem 1rem !default
$card-header-shadow: 0 0.125em 0.25em rgba($scheme-invert, 0.1) !default
$card-header-weight: $weight-bold !default
$card-content-background-color: transparent !default
$card-content-padding: 1.5rem !default
$card-footer-background-color: transparent !default
$card-footer-border-top: 1px solid $border-light !default
$card-footer-padding: 0.75rem !default
$card-media-margin: $block-spacing !default
.card
background-color: $card-background-color
box-shadow: $card-shadow
color: $card-color
max-width: 100%
position: relative
.card-header
background-color: $card-header-background-color
align-items: stretch
box-shadow: $card-header-shadow
display: flex
.card-header-title
align-items: center
color: $card-header-color
display: flex
flex-grow: 1
font-weight: $card-header-weight
padding: $card-header-padding
&.is-centered
justify-content: center
.card-header-icon
align-items: center
cursor: pointer
display: flex
justify-content: center
padding: $card-header-padding
.card-image
display: block
position: relative
.card-content
background-color: $card-content-background-color
padding: $card-content-padding
.card-footer
background-color: $card-footer-background-color
border-top: $card-footer-border-top
align-items: stretch
display: flex
.card-footer-item
align-items: center
display: flex
flex-basis: 0
flex-grow: 1
flex-shrink: 0
justify-content: center
padding: $card-footer-padding
&:not(:last-child)
+ltr-property("border", $card-footer-border-top)
// Combinations
.card
.media:not(:last-child)
margin-bottom: $card-media-margin

View File

@@ -1,81 +0,0 @@
$dropdown-menu-min-width: 12rem !default
$dropdown-content-background-color: $scheme-main !default
$dropdown-content-arrow: $link !default
$dropdown-content-offset: 4px !default
$dropdown-content-padding-bottom: 0.5rem !default
$dropdown-content-padding-top: 0.5rem !default
$dropdown-content-radius: $radius !default
$dropdown-content-shadow: 0 0.5em 1em -0.125em rgba($scheme-invert, 0.1), 0 0px 0 1px rgba($scheme-invert, 0.02) !default
$dropdown-content-z: 20 !default
$dropdown-item-color: $text !default
$dropdown-item-hover-color: $scheme-invert !default
$dropdown-item-hover-background-color: $background !default
$dropdown-item-active-color: $link-invert !default
$dropdown-item-active-background-color: $link !default
$dropdown-divider-background-color: $border-light !default
.dropdown
display: inline-flex
position: relative
vertical-align: top
&.is-active,
&.is-hoverable:hover
.dropdown-menu
display: block
&.is-right
.dropdown-menu
left: auto
right: 0
&.is-up
.dropdown-menu
bottom: 100%
padding-bottom: $dropdown-content-offset
padding-top: initial
top: auto
.dropdown-menu
display: none
+ltr-position(0, false)
min-width: $dropdown-menu-min-width
padding-top: $dropdown-content-offset
position: absolute
top: 100%
z-index: $dropdown-content-z
.dropdown-content
background-color: $dropdown-content-background-color
border-radius: $dropdown-content-radius
box-shadow: $dropdown-content-shadow
padding-bottom: $dropdown-content-padding-bottom
padding-top: $dropdown-content-padding-top
.dropdown-item
color: $dropdown-item-color
display: block
font-size: 0.875rem
line-height: 1.5
padding: 0.375rem 1rem
position: relative
a.dropdown-item,
button.dropdown-item
+ltr-property("padding", 3rem)
text-align: inherit
white-space: nowrap
width: 100%
&:hover
background-color: $dropdown-item-hover-background-color
color: $dropdown-item-hover-color
&.is-active
background-color: $dropdown-item-active-background-color
color: $dropdown-item-active-color
.dropdown-divider
background-color: $dropdown-divider-background-color
border: none
display: block
height: 1px
margin: 0.5rem 0

View File

@@ -1,77 +0,0 @@
$level-item-spacing: ($block-spacing / 2) !default
.level
@extend %block
align-items: center
justify-content: space-between
code
border-radius: $radius
img
display: inline-block
vertical-align: top
// Modifiers
&.is-mobile
display: flex
.level-left,
.level-right
display: flex
.level-left + .level-right
margin-top: 0
.level-item
&:not(:last-child)
margin-bottom: 0
+ltr-property("margin", $level-item-spacing)
&:not(.is-narrow)
flex-grow: 1
// Responsiveness
+tablet
display: flex
& > .level-item
&:not(.is-narrow)
flex-grow: 1
.level-item
align-items: center
display: flex
flex-basis: auto
flex-grow: 0
flex-shrink: 0
justify-content: center
.title,
.subtitle
margin-bottom: 0
// Responsiveness
+mobile
&:not(:last-child)
margin-bottom: $level-item-spacing
.level-left,
.level-right
flex-basis: auto
flex-grow: 0
flex-shrink: 0
.level-item
// Modifiers
&.is-flexible
flex-grow: 1
// Responsiveness
+tablet
&:not(:last-child)
+ltr-property("margin", $level-item-spacing)
.level-left
align-items: center
justify-content: flex-start
// Responsiveness
+mobile
& + .level-right
margin-top: 1.5rem
+tablet
display: flex
.level-right
align-items: center
justify-content: flex-end
// Responsiveness
+tablet
display: flex

View File

@@ -1,52 +0,0 @@
$media-border-color: bulmaRgba($border, 0.5) !default
$media-spacing: 1rem
$media-spacing-large: 1.5rem
.media
align-items: flex-start
display: flex
text-align: inherit
.content:not(:last-child)
margin-bottom: 0.75rem
.media
border-top: 1px solid $media-border-color
display: flex
padding-top: 0.75rem
.content:not(:last-child),
.control:not(:last-child)
margin-bottom: 0.5rem
.media
padding-top: 0.5rem
& + .media
margin-top: 0.5rem
& + .media
border-top: 1px solid $media-border-color
margin-top: $media-spacing
padding-top: $media-spacing
// Sizes
&.is-large
& + .media
margin-top: $media-spacing-large
padding-top: $media-spacing-large
.media-left,
.media-right
flex-basis: auto
flex-grow: 0
flex-shrink: 0
.media-left
+ltr-property("margin", $media-spacing)
.media-right
+ltr-property("margin", $media-spacing, false)
.media-content
flex-basis: auto
flex-grow: 1
flex-shrink: 1
text-align: inherit
+mobile
.media-content
overflow-x: auto

View File

@@ -1,57 +0,0 @@
$menu-item-color: $text !default
$menu-item-radius: $radius-small !default
$menu-item-hover-color: $text-strong !default
$menu-item-hover-background-color: $background !default
$menu-item-active-color: $link-invert !default
$menu-item-active-background-color: $link !default
$menu-list-border-left: 1px solid $border !default
$menu-list-line-height: 1.25 !default
$menu-list-link-padding: 0.5em 0.75em !default
$menu-nested-list-margin: 0.75em !default
$menu-nested-list-padding-left: 0.75em !default
$menu-label-color: $text-light !default
$menu-label-font-size: 0.75em !default
$menu-label-letter-spacing: 0.1em !default
$menu-label-spacing: 1em !default
.menu
font-size: $size-normal
// Sizes
&.is-small
font-size: $size-small
&.is-medium
font-size: $size-medium
&.is-large
font-size: $size-large
.menu-list
line-height: $menu-list-line-height
a
border-radius: $menu-item-radius
color: $menu-item-color
display: block
padding: $menu-list-link-padding
&:hover
background-color: $menu-item-hover-background-color
color: $menu-item-hover-color
// Modifiers
&.is-active
background-color: $menu-item-active-background-color
color: $menu-item-active-color
li
ul
+ltr-property("border", $menu-list-border-left, false)
margin: $menu-nested-list-margin
+ltr-property("padding", $menu-nested-list-padding-left, false)
.menu-label
color: $menu-label-color
font-size: $menu-label-font-size
letter-spacing: $menu-label-letter-spacing
text-transform: uppercase
&:not(:first-child)
margin-top: $menu-label-spacing
&:not(:last-child)
margin-bottom: $menu-label-spacing

View File

@@ -1,99 +0,0 @@
$message-background-color: $background !default
$message-radius: $radius !default
$message-header-background-color: $text !default
$message-header-color: $text-invert !default
$message-header-weight: $weight-bold !default
$message-header-padding: 0.75em 1em !default
$message-header-radius: $radius !default
$message-body-border-color: $border !default
$message-body-border-width: 0 0 0 4px !default
$message-body-color: $text !default
$message-body-padding: 1.25em 1.5em !default
$message-body-radius: $radius !default
$message-body-pre-background-color: $scheme-main !default
$message-body-pre-code-background-color: transparent !default
$message-header-body-border-width: 0 !default
$message-colors: $colors !default
.message
@extend %block
background-color: $message-background-color
border-radius: $message-radius
font-size: $size-normal
strong
color: currentColor
a:not(.button):not(.tag):not(.dropdown-item)
color: currentColor
text-decoration: underline
// Sizes
&.is-small
font-size: $size-small
&.is-medium
font-size: $size-medium
&.is-large
font-size: $size-large
// Colors
@each $name, $components in $message-colors
$color: nth($components, 1)
$color-invert: nth($components, 2)
$color-light: null
$color-dark: null
@if length($components) >= 3
$color-light: nth($components, 3)
@if length($components) >= 4
$color-dark: nth($components, 4)
@else
$color-luminance: colorLuminance($color)
$darken-percentage: $color-luminance * 70%
$desaturate-percentage: $color-luminance * 30%
$color-dark: desaturate(darken($color, $darken-percentage), $desaturate-percentage)
@else
$color-lightning: max((100% - lightness($color)) - 2%, 0%)
$color-light: lighten($color, $color-lightning)
&.is-#{$name}
background-color: $color-light
.message-header
background-color: $color
color: $color-invert
.message-body
border-color: $color
color: $color-dark
.message-header
align-items: center
background-color: $message-header-background-color
border-radius: $message-header-radius $message-header-radius 0 0
color: $message-header-color
display: flex
font-weight: $message-header-weight
justify-content: space-between
line-height: 1.25
padding: $message-header-padding
position: relative
.delete
flex-grow: 0
flex-shrink: 0
+ltr-property("margin", 0.75em, false)
& + .message-body
border-width: $message-header-body-border-width
border-top-left-radius: 0
border-top-right-radius: 0
.message-body
border-color: $message-body-border-color
border-radius: $message-body-radius
border-style: solid
border-width: $message-body-border-width
color: $message-body-color
padding: $message-body-padding
code,
pre
background-color: $message-body-pre-background-color
pre code
background-color: $message-body-pre-code-background-color

View File

@@ -1,113 +0,0 @@
$modal-z: 40 !default
$modal-background-background-color: bulmaRgba($scheme-invert, 0.86) !default
$modal-content-width: 640px !default
$modal-content-margin-mobile: 20px !default
$modal-content-spacing-mobile: 160px !default
$modal-content-spacing-tablet: 40px !default
$modal-close-dimensions: 40px !default
$modal-close-right: 20px !default
$modal-close-top: 20px !default
$modal-card-spacing: 40px !default
$modal-card-head-background-color: $background !default
$modal-card-head-border-bottom: 1px solid $border !default
$modal-card-head-padding: 20px !default
$modal-card-head-radius: $radius-large !default
$modal-card-title-color: $text-strong !default
$modal-card-title-line-height: 1 !default
$modal-card-title-size: $size-4 !default
$modal-card-foot-radius: $radius-large !default
$modal-card-foot-border-top: 1px solid $border !default
$modal-card-body-background-color: $scheme-main !default
$modal-card-body-padding: 20px !default
.modal
@extend %overlay
align-items: center
display: none
flex-direction: column
justify-content: center
overflow: hidden
position: fixed
z-index: $modal-z
// Modifiers
&.is-active
display: flex
.modal-background
@extend %overlay
background-color: $modal-background-background-color
.modal-content,
.modal-card
margin: 0 $modal-content-margin-mobile
max-height: calc(100vh - #{$modal-content-spacing-mobile})
overflow: auto
position: relative
width: 100%
// Responsiveness
+tablet
margin: 0 auto
max-height: calc(100vh - #{$modal-content-spacing-tablet})
width: $modal-content-width
.modal-close
@extend %delete
background: none
height: $modal-close-dimensions
position: fixed
+ltr-position($modal-close-right)
top: $modal-close-top
width: $modal-close-dimensions
.modal-card
display: flex
flex-direction: column
max-height: calc(100vh - #{$modal-card-spacing})
overflow: hidden
-ms-overflow-y: visible
.modal-card-head,
.modal-card-foot
align-items: center
background-color: $modal-card-head-background-color
display: flex
flex-shrink: 0
justify-content: flex-start
padding: $modal-card-head-padding
position: relative
.modal-card-head
border-bottom: $modal-card-head-border-bottom
border-top-left-radius: $modal-card-head-radius
border-top-right-radius: $modal-card-head-radius
.modal-card-title
color: $modal-card-title-color
flex-grow: 1
flex-shrink: 0
font-size: $modal-card-title-size
line-height: $modal-card-title-line-height
.modal-card-foot
border-bottom-left-radius: $modal-card-foot-radius
border-bottom-right-radius: $modal-card-foot-radius
border-top: $modal-card-foot-border-top
.button
&:not(:last-child)
+ltr-property("margin", 0.5em)
.modal-card-body
+overflow-touch
background-color: $modal-card-body-background-color
flex-grow: 1
flex-shrink: 1
overflow: auto
padding: $modal-card-body-padding

View File

@@ -1,441 +0,0 @@
$navbar-background-color: $scheme-main !default
$navbar-box-shadow-size: 0 2px 0 0 !default
$navbar-box-shadow-color: $background !default
$navbar-height: 3.25rem !default
$navbar-padding-vertical: 1rem !default
$navbar-padding-horizontal: 2rem !default
$navbar-z: 30 !default
$navbar-fixed-z: 30 !default
$navbar-item-color: $text !default
$navbar-item-hover-color: $link !default
$navbar-item-hover-background-color: $scheme-main-bis !default
$navbar-item-active-color: $scheme-invert !default
$navbar-item-active-background-color: transparent !default
$navbar-item-img-max-height: 1.75rem !default
$navbar-burger-color: $navbar-item-color !default
$navbar-tab-hover-background-color: transparent !default
$navbar-tab-hover-border-bottom-color: $link !default
$navbar-tab-active-color: $link !default
$navbar-tab-active-background-color: transparent !default
$navbar-tab-active-border-bottom-color: $link !default
$navbar-tab-active-border-bottom-style: solid !default
$navbar-tab-active-border-bottom-width: 3px !default
$navbar-dropdown-background-color: $scheme-main !default
$navbar-dropdown-border-top: 2px solid $border !default
$navbar-dropdown-offset: -4px !default
$navbar-dropdown-arrow: $link !default
$navbar-dropdown-radius: $radius-large !default
$navbar-dropdown-z: 20 !default
$navbar-dropdown-boxed-radius: $radius-large !default
$navbar-dropdown-boxed-shadow: 0 8px 8px bulmaRgba($scheme-invert, 0.1), 0 0 0 1px bulmaRgba($scheme-invert, 0.1) !default
$navbar-dropdown-item-hover-color: $scheme-invert !default
$navbar-dropdown-item-hover-background-color: $background !default
$navbar-dropdown-item-active-color: $link !default
$navbar-dropdown-item-active-background-color: $background !default
$navbar-divider-background-color: $background !default
$navbar-divider-height: 2px !default
$navbar-bottom-box-shadow-size: 0 -2px 0 0 !default
$navbar-breakpoint: $desktop !default
=navbar-fixed
left: 0
position: fixed
right: 0
z-index: $navbar-fixed-z
.navbar
background-color: $navbar-background-color
min-height: $navbar-height
position: relative
z-index: $navbar-z
@each $name, $pair in $colors
$color: nth($pair, 1)
$color-invert: nth($pair, 2)
&.is-#{$name}
background-color: $color
color: $color-invert
.navbar-brand
& > .navbar-item,
.navbar-link
color: $color-invert
& > a.navbar-item,
.navbar-link
&:focus,
&:hover,
&.is-active
background-color: bulmaDarken($color, 5%)
color: $color-invert
.navbar-link
&::after
border-color: $color-invert
.navbar-burger
color: $color-invert
+from($navbar-breakpoint)
.navbar-start,
.navbar-end
& > .navbar-item,
.navbar-link
color: $color-invert
& > a.navbar-item,
.navbar-link
&:focus,
&:hover,
&.is-active
background-color: bulmaDarken($color, 5%)
color: $color-invert
.navbar-link
&::after
border-color: $color-invert
.navbar-item.has-dropdown:focus .navbar-link,
.navbar-item.has-dropdown:hover .navbar-link,
.navbar-item.has-dropdown.is-active .navbar-link
background-color: bulmaDarken($color, 5%)
color: $color-invert
.navbar-dropdown
a.navbar-item
&.is-active
background-color: $color
color: $color-invert
& > .container
align-items: stretch
display: flex
min-height: $navbar-height
width: 100%
&.has-shadow
box-shadow: $navbar-box-shadow-size $navbar-box-shadow-color
&.is-fixed-bottom,
&.is-fixed-top
+navbar-fixed
&.is-fixed-bottom
bottom: 0
&.has-shadow
box-shadow: $navbar-bottom-box-shadow-size $navbar-box-shadow-color
&.is-fixed-top
top: 0
html,
body
&.has-navbar-fixed-top
padding-top: $navbar-height
&.has-navbar-fixed-bottom
padding-bottom: $navbar-height
.navbar-brand,
.navbar-tabs
align-items: stretch
display: flex
flex-shrink: 0
min-height: $navbar-height
.navbar-brand
a.navbar-item
&:focus,
&:hover
background-color: transparent
.navbar-tabs
+overflow-touch
max-width: 100vw
overflow-x: auto
overflow-y: hidden
.navbar-burger
color: $navbar-burger-color
+hamburger($navbar-height)
+ltr-property("margin", auto, false)
.navbar-menu
display: none
.navbar-item,
.navbar-link
color: $navbar-item-color
display: block
line-height: 1.5
padding: 0.5rem 0.75rem
position: relative
.icon
&:only-child
margin-left: -0.25rem
margin-right: -0.25rem
a.navbar-item,
.navbar-link
cursor: pointer
&:focus,
&:focus-within,
&:hover,
&.is-active
background-color: $navbar-item-hover-background-color
color: $navbar-item-hover-color
.navbar-item
flex-grow: 0
flex-shrink: 0
img
max-height: $navbar-item-img-max-height
&.has-dropdown
padding: 0
&.is-expanded
flex-grow: 1
flex-shrink: 1
&.is-tab
border-bottom: 1px solid transparent
min-height: $navbar-height
padding-bottom: calc(0.5rem - 1px)
&:focus,
&:hover
background-color: $navbar-tab-hover-background-color
border-bottom-color: $navbar-tab-hover-border-bottom-color
&.is-active
background-color: $navbar-tab-active-background-color
border-bottom-color: $navbar-tab-active-border-bottom-color
border-bottom-style: $navbar-tab-active-border-bottom-style
border-bottom-width: $navbar-tab-active-border-bottom-width
color: $navbar-tab-active-color
padding-bottom: calc(0.5rem - #{$navbar-tab-active-border-bottom-width})
.navbar-content
flex-grow: 1
flex-shrink: 1
.navbar-link:not(.is-arrowless)
+ltr-property("padding", 2.5em)
&::after
@extend %arrow
border-color: $navbar-dropdown-arrow
margin-top: -0.375em
+ltr-position(1.125em)
.navbar-dropdown
font-size: 0.875rem
padding-bottom: 0.5rem
padding-top: 0.5rem
.navbar-item
padding-left: 1.5rem
padding-right: 1.5rem
.navbar-divider
background-color: $navbar-divider-background-color
border: none
display: none
height: $navbar-divider-height
margin: 0.5rem 0
+until($navbar-breakpoint)
.navbar > .container
display: block
.navbar-brand,
.navbar-tabs
.navbar-item
align-items: center
display: flex
.navbar-link
&::after
display: none
.navbar-menu
background-color: $navbar-background-color
box-shadow: 0 8px 16px bulmaRgba($scheme-invert, 0.1)
padding: 0.5rem 0
&.is-active
display: block
// Fixed navbar
.navbar
&.is-fixed-bottom-touch,
&.is-fixed-top-touch
+navbar-fixed
&.is-fixed-bottom-touch
bottom: 0
&.has-shadow
box-shadow: 0 -2px 3px bulmaRgba($scheme-invert, 0.1)
&.is-fixed-top-touch
top: 0
&.is-fixed-top,
&.is-fixed-top-touch
.navbar-menu
+overflow-touch
max-height: calc(100vh - #{$navbar-height})
overflow: auto
html,
body
&.has-navbar-fixed-top-touch
padding-top: $navbar-height
&.has-navbar-fixed-bottom-touch
padding-bottom: $navbar-height
+from($navbar-breakpoint)
.navbar,
.navbar-menu,
.navbar-start,
.navbar-end
align-items: stretch
display: flex
.navbar
min-height: $navbar-height
&.is-spaced
padding: $navbar-padding-vertical $navbar-padding-horizontal
.navbar-start,
.navbar-end
align-items: center
a.navbar-item,
.navbar-link
border-radius: $radius
&.is-transparent
a.navbar-item,
.navbar-link
&:focus,
&:hover,
&.is-active
background-color: transparent !important
.navbar-item.has-dropdown
&.is-active,
&.is-hoverable:focus,
&.is-hoverable:focus-within,
&.is-hoverable:hover
.navbar-link
background-color: transparent !important
.navbar-dropdown
a.navbar-item
&:focus,
&:hover
background-color: $navbar-dropdown-item-hover-background-color
color: $navbar-dropdown-item-hover-color
&.is-active
background-color: $navbar-dropdown-item-active-background-color
color: $navbar-dropdown-item-active-color
.navbar-burger
display: none
.navbar-item,
.navbar-link
align-items: center
display: flex
.navbar-item
&.has-dropdown
align-items: stretch
&.has-dropdown-up
.navbar-link::after
transform: rotate(135deg) translate(0.25em, -0.25em)
.navbar-dropdown
border-bottom: $navbar-dropdown-border-top
border-radius: $navbar-dropdown-radius $navbar-dropdown-radius 0 0
border-top: none
bottom: 100%
box-shadow: 0 -8px 8px bulmaRgba($scheme-invert, 0.1)
top: auto
&.is-active,
&.is-hoverable:focus,
&.is-hoverable:focus-within,
&.is-hoverable:hover
.navbar-dropdown
display: block
.navbar.is-spaced &,
&.is-boxed
opacity: 1
pointer-events: auto
transform: translateY(0)
.navbar-menu
flex-grow: 1
flex-shrink: 0
.navbar-start
justify-content: flex-start
+ltr-property("margin", auto)
.navbar-end
justify-content: flex-end
+ltr-property("margin", auto, false)
.navbar-dropdown
background-color: $navbar-dropdown-background-color
border-bottom-left-radius: $navbar-dropdown-radius
border-bottom-right-radius: $navbar-dropdown-radius
border-top: $navbar-dropdown-border-top
box-shadow: 0 8px 8px bulmaRgba($scheme-invert, 0.1)
display: none
font-size: 0.875rem
+ltr-position(0, false)
min-width: 100%
position: absolute
top: 100%
z-index: $navbar-dropdown-z
.navbar-item
padding: 0.375rem 1rem
white-space: nowrap
a.navbar-item
+ltr-property("padding", 3rem)
&:focus,
&:hover
background-color: $navbar-dropdown-item-hover-background-color
color: $navbar-dropdown-item-hover-color
&.is-active
background-color: $navbar-dropdown-item-active-background-color
color: $navbar-dropdown-item-active-color
.navbar.is-spaced &,
&.is-boxed
border-radius: $navbar-dropdown-boxed-radius
border-top: none
box-shadow: $navbar-dropdown-boxed-shadow
display: block
opacity: 0
pointer-events: none
top: calc(100% + (#{$navbar-dropdown-offset}))
transform: translateY(-5px)
transition-duration: $speed
transition-property: opacity, transform
&.is-right
left: auto
right: 0
.navbar-divider
display: block
.navbar > .container,
.container > .navbar
.navbar-brand
+ltr-property("margin", -.75rem, false)
.navbar-menu
+ltr-property("margin", -.75rem)
// Fixed navbar
.navbar
&.is-fixed-bottom-desktop,
&.is-fixed-top-desktop
+navbar-fixed
&.is-fixed-bottom-desktop
bottom: 0
&.has-shadow
box-shadow: 0 -2px 3px bulmaRgba($scheme-invert, 0.1)
&.is-fixed-top-desktop
top: 0
html,
body
&.has-navbar-fixed-top-desktop
padding-top: $navbar-height
&.has-navbar-fixed-bottom-desktop
padding-bottom: $navbar-height
&.has-spaced-navbar-fixed-top
padding-top: $navbar-height + ($navbar-padding-vertical * 2)
&.has-spaced-navbar-fixed-bottom
padding-bottom: $navbar-height + ($navbar-padding-vertical * 2)
// Hover/Active states
a.navbar-item,
.navbar-link
&.is-active
color: $navbar-item-active-color
&.is-active:not(:focus):not(:hover)
background-color: $navbar-item-active-background-color
.navbar-item.has-dropdown
&:focus,
&:hover,
&.is-active
.navbar-link
background-color: $navbar-item-hover-background-color
// Combination
.hero
&.is-fullheight-with-navbar
min-height: calc(100vh - #{$navbar-height})

View File

@@ -1,150 +0,0 @@
$pagination-color: $text-strong !default
$pagination-border-color: $border !default
$pagination-margin: -0.25rem !default
$pagination-min-width: $control-height !default
$pagination-item-font-size: 1em !default
$pagination-item-margin: 0.25rem !default
$pagination-item-padding-left: 0.5em !default
$pagination-item-padding-right: 0.5em !default
$pagination-hover-color: $link-hover !default
$pagination-hover-border-color: $link-hover-border !default
$pagination-focus-color: $link-focus !default
$pagination-focus-border-color: $link-focus-border !default
$pagination-active-color: $link-active !default
$pagination-active-border-color: $link-active-border !default
$pagination-disabled-color: $text-light !default
$pagination-disabled-background-color: $border !default
$pagination-disabled-border-color: $border !default
$pagination-current-color: $link-invert !default
$pagination-current-background-color: $link !default
$pagination-current-border-color: $link !default
$pagination-ellipsis-color: $grey-light !default
$pagination-shadow-inset: inset 0 1px 2px rgba($scheme-invert, 0.2)
.pagination
@extend %block
font-size: $size-normal
margin: $pagination-margin
// Sizes
&.is-small
font-size: $size-small
&.is-medium
font-size: $size-medium
&.is-large
font-size: $size-large
&.is-rounded
.pagination-previous,
.pagination-next
padding-left: 1em
padding-right: 1em
border-radius: $radius-rounded
.pagination-link
border-radius: $radius-rounded
.pagination,
.pagination-list
align-items: center
display: flex
justify-content: center
text-align: center
.pagination-previous,
.pagination-next,
.pagination-link,
.pagination-ellipsis
@extend %control
@extend %unselectable
font-size: $pagination-item-font-size
justify-content: center
margin: $pagination-item-margin
padding-left: $pagination-item-padding-left
padding-right: $pagination-item-padding-right
text-align: center
.pagination-previous,
.pagination-next,
.pagination-link
border-color: $pagination-border-color
color: $pagination-color
min-width: $pagination-min-width
&:hover
border-color: $pagination-hover-border-color
color: $pagination-hover-color
&:focus
border-color: $pagination-focus-border-color
&:active
box-shadow: $pagination-shadow-inset
&[disabled]
background-color: $pagination-disabled-background-color
border-color: $pagination-disabled-border-color
box-shadow: none
color: $pagination-disabled-color
opacity: 0.5
.pagination-previous,
.pagination-next
padding-left: 0.75em
padding-right: 0.75em
white-space: nowrap
.pagination-link
&.is-current
background-color: $pagination-current-background-color
border-color: $pagination-current-border-color
color: $pagination-current-color
.pagination-ellipsis
color: $pagination-ellipsis-color
pointer-events: none
.pagination-list
flex-wrap: wrap
+mobile
.pagination
flex-wrap: wrap
.pagination-previous,
.pagination-next
flex-grow: 1
flex-shrink: 1
.pagination-list
li
flex-grow: 1
flex-shrink: 1
+tablet
.pagination-list
flex-grow: 1
flex-shrink: 1
justify-content: flex-start
order: 1
.pagination-previous
order: 2
.pagination-next
order: 3
.pagination
justify-content: space-between
&.is-centered
.pagination-previous
order: 1
.pagination-list
justify-content: center
order: 2
.pagination-next
order: 3
&.is-right
.pagination-previous
order: 1
.pagination-next
order: 2
.pagination-list
justify-content: flex-end
order: 3

View File

@@ -1,119 +0,0 @@
$panel-margin: $block-spacing !default
$panel-item-border: 1px solid $border-light !default
$panel-radius: $radius-large !default
$panel-shadow: 0 0.5em 1em -0.125em rgba($scheme-invert, 0.1), 0 0px 0 1px rgba($scheme-invert, 0.02) !default
$panel-heading-background-color: $border-light !default
$panel-heading-color: $text-strong !default
$panel-heading-line-height: 1.25 !default
$panel-heading-padding: 0.75em 1em !default
$panel-heading-radius: $radius !default
$panel-heading-size: 1.25em !default
$panel-heading-weight: $weight-bold !default
$panel-tabs-font-size: 0.875em !default
$panel-tab-border-bottom: 1px solid $border !default
$panel-tab-active-border-bottom-color: $link-active-border !default
$panel-tab-active-color: $link-active !default
$panel-list-item-color: $text !default
$panel-list-item-hover-color: $link !default
$panel-block-color: $text-strong !default
$panel-block-hover-background-color: $background !default
$panel-block-active-border-left-color: $link !default
$panel-block-active-color: $link-active !default
$panel-block-active-icon-color: $link !default
$panel-icon-color: $text-light !default
$panel-colors: $colors !default
.panel
border-radius: $panel-radius
box-shadow: $panel-shadow
font-size: $size-normal
&:not(:last-child)
margin-bottom: $panel-margin
// Colors
@each $name, $components in $panel-colors
$color: nth($components, 1)
$color-invert: nth($components, 2)
&.is-#{$name}
.panel-heading
background-color: $color
color: $color-invert
.panel-tabs a.is-active
border-bottom-color: $color
.panel-block.is-active .panel-icon
color: $color
.panel-tabs,
.panel-block
&:not(:last-child)
border-bottom: $panel-item-border
.panel-heading
background-color: $panel-heading-background-color
border-radius: $panel-radius $panel-radius 0 0
color: $panel-heading-color
font-size: $panel-heading-size
font-weight: $panel-heading-weight
line-height: $panel-heading-line-height
padding: $panel-heading-padding
.panel-tabs
align-items: flex-end
display: flex
font-size: $panel-tabs-font-size
justify-content: center
a
border-bottom: $panel-tab-border-bottom
margin-bottom: -1px
padding: 0.5em
// Modifiers
&.is-active
border-bottom-color: $panel-tab-active-border-bottom-color
color: $panel-tab-active-color
.panel-list
a
color: $panel-list-item-color
&:hover
color: $panel-list-item-hover-color
.panel-block
align-items: center
color: $panel-block-color
display: flex
justify-content: flex-start
padding: 0.5em 0.75em
input[type="checkbox"]
+ltr-property("margin", 0.75em)
& > .control
flex-grow: 1
flex-shrink: 1
width: 100%
&.is-wrapped
flex-wrap: wrap
&.is-active
border-left-color: $panel-block-active-border-left-color
color: $panel-block-active-color
.panel-icon
color: $panel-block-active-icon-color
&:last-child
border-bottom-left-radius: $panel-radius
border-bottom-right-radius: $panel-radius
a.panel-block,
label.panel-block
cursor: pointer
&:hover
background-color: $panel-block-hover-background-color
.panel-icon
+fa(14px, 1em)
color: $panel-icon-color
+ltr-property("margin", 0.75em)
.fa
font-size: inherit
line-height: inherit

View File

@@ -1,174 +0,0 @@
$tabs-border-bottom-color: $border !default
$tabs-border-bottom-style: solid !default
$tabs-border-bottom-width: 1px !default
$tabs-link-color: $text !default
$tabs-link-hover-border-bottom-color: $text-strong !default
$tabs-link-hover-color: $text-strong !default
$tabs-link-active-border-bottom-color: $link !default
$tabs-link-active-color: $link !default
$tabs-link-padding: 0.5em 1em !default
$tabs-boxed-link-radius: $radius !default
$tabs-boxed-link-hover-background-color: $background !default
$tabs-boxed-link-hover-border-bottom-color: $border !default
$tabs-boxed-link-active-background-color: $scheme-main !default
$tabs-boxed-link-active-border-color: $border !default
$tabs-boxed-link-active-border-bottom-color: transparent !default
$tabs-toggle-link-border-color: $border !default
$tabs-toggle-link-border-style: solid !default
$tabs-toggle-link-border-width: 1px !default
$tabs-toggle-link-hover-background-color: $background !default
$tabs-toggle-link-hover-border-color: $border-hover !default
$tabs-toggle-link-radius: $radius !default
$tabs-toggle-link-active-background-color: $link !default
$tabs-toggle-link-active-border-color: $link !default
$tabs-toggle-link-active-color: $link-invert !default
.tabs
@extend %block
+overflow-touch
@extend %unselectable
align-items: stretch
display: flex
font-size: $size-normal
justify-content: space-between
overflow: hidden
overflow-x: auto
white-space: nowrap
a
align-items: center
border-bottom-color: $tabs-border-bottom-color
border-bottom-style: $tabs-border-bottom-style
border-bottom-width: $tabs-border-bottom-width
color: $tabs-link-color
display: flex
justify-content: center
margin-bottom: -#{$tabs-border-bottom-width}
padding: $tabs-link-padding
vertical-align: top
&:hover
border-bottom-color: $tabs-link-hover-border-bottom-color
color: $tabs-link-hover-color
li
display: block
&.is-active
a
border-bottom-color: $tabs-link-active-border-bottom-color
color: $tabs-link-active-color
ul
align-items: center
border-bottom-color: $tabs-border-bottom-color
border-bottom-style: $tabs-border-bottom-style
border-bottom-width: $tabs-border-bottom-width
display: flex
flex-grow: 1
flex-shrink: 0
justify-content: flex-start
&.is-left
padding-right: 0.75em
&.is-center
flex: none
justify-content: center
padding-left: 0.75em
padding-right: 0.75em
&.is-right
justify-content: flex-end
padding-left: 0.75em
.icon
&:first-child
+ltr-property("margin", 0.5em)
&:last-child
+ltr-property("margin", 0.5em, false)
// Alignment
&.is-centered
ul
justify-content: center
&.is-right
ul
justify-content: flex-end
// Styles
&.is-boxed
a
border: 1px solid transparent
+ltr
border-radius: $tabs-boxed-link-radius $tabs-boxed-link-radius 0 0
+rtl
border-radius: 0 0 $tabs-boxed-link-radius $tabs-boxed-link-radius
&:hover
background-color: $tabs-boxed-link-hover-background-color
border-bottom-color: $tabs-boxed-link-hover-border-bottom-color
li
&.is-active
a
background-color: $tabs-boxed-link-active-background-color
border-color: $tabs-boxed-link-active-border-color
border-bottom-color: $tabs-boxed-link-active-border-bottom-color !important
&.is-fullwidth
li
flex-grow: 1
flex-shrink: 0
&.is-toggle
a
border-color: $tabs-toggle-link-border-color
border-style: $tabs-toggle-link-border-style
border-width: $tabs-toggle-link-border-width
margin-bottom: 0
position: relative
&:hover
background-color: $tabs-toggle-link-hover-background-color
border-color: $tabs-toggle-link-hover-border-color
z-index: 2
li
& + li
+ltr-property("margin", -#{$tabs-toggle-link-border-width}, false)
&:first-child a
+ltr
border-top-left-radius: $tabs-toggle-link-radius
border-bottom-left-radius: $tabs-toggle-link-radius
+rtl
border-top-right-radius: $tabs-toggle-link-radius
border-bottom-right-radius: $tabs-toggle-link-radius
&:last-child a
+ltr
border-top-right-radius: $tabs-toggle-link-radius
border-bottom-right-radius: $tabs-toggle-link-radius
+rtl
border-top-left-radius: $tabs-toggle-link-radius
border-bottom-left-radius: $tabs-toggle-link-radius
&.is-active
a
background-color: $tabs-toggle-link-active-background-color
border-color: $tabs-toggle-link-active-border-color
color: $tabs-toggle-link-active-color
z-index: 1
ul
border-bottom: none
&.is-toggle-rounded
li
&:first-child a
+ltr
border-bottom-left-radius: $radius-rounded
border-top-left-radius: $radius-rounded
padding-left: 1.25em
+rtl
border-bottom-right-radius: $radius-rounded
border-top-right-radius: $radius-rounded
padding-right: 1.25em
&:last-child a
+ltr
border-bottom-right-radius: $radius-rounded
border-top-right-radius: $radius-rounded
padding-right: 1.25em
+rtl
border-bottom-left-radius: $radius-rounded
border-top-left-radius: $radius-rounded
padding-left: 1.25em
// Sizes
&.is-small
font-size: $size-small
&.is-medium
font-size: $size-medium
&.is-large
font-size: $size-large

View File

@@ -1,15 +0,0 @@
@charset "utf-8"
@import "box.sass"
@import "button.sass"
@import "container.sass"
@import "content.sass"
@import "icon.sass"
@import "image.sass"
@import "notification.sass"
@import "progress.sass"
@import "table.sass"
@import "tag.sass"
@import "title.sass"
@import "other.sass"

View File

@@ -1,24 +0,0 @@
$box-color: $text !default
$box-background-color: $scheme-main !default
$box-radius: $radius-large !default
$box-shadow: 0 0.5em 1em -0.125em rgba($scheme-invert, 0.1), 0 0px 0 1px rgba($scheme-invert, 0.02) !default
$box-padding: 1.25rem !default
$box-link-hover-shadow: 0 0.5em 1em -0.125em rgba($scheme-invert, 0.1), 0 0 0 1px $link !default
$box-link-active-shadow: inset 0 1px 2px rgba($scheme-invert, 0.2), 0 0 0 1px $link !default
.box
@extend %block
background-color: $box-background-color
border-radius: $box-radius
box-shadow: $box-shadow
color: $box-color
display: block
padding: $box-padding
a.box
&:hover,
&:focus
box-shadow: $box-link-hover-shadow
&:active
box-shadow: $box-link-active-shadow

View File

@@ -1,323 +0,0 @@
$button-color: $text-strong !default
$button-background-color: $scheme-main !default
$button-family: false !default
$button-border-color: $border !default
$button-border-width: $control-border-width !default
$button-padding-vertical: calc(0.5em - #{$button-border-width}) !default
$button-padding-horizontal: 1em !default
$button-hover-color: $link-hover !default
$button-hover-border-color: $link-hover-border !default
$button-focus-color: $link-focus !default
$button-focus-border-color: $link-focus-border !default
$button-focus-box-shadow-size: 0 0 0 0.125em !default
$button-focus-box-shadow-color: bulmaRgba($link, 0.25) !default
$button-active-color: $link-active !default
$button-active-border-color: $link-active-border !default
$button-text-color: $text !default
$button-text-decoration: underline !default
$button-text-hover-background-color: $background !default
$button-text-hover-color: $text-strong !default
$button-disabled-background-color: $scheme-main !default
$button-disabled-border-color: $border !default
$button-disabled-shadow: none !default
$button-disabled-opacity: 0.5 !default
$button-static-color: $text-light !default
$button-static-background-color: $scheme-main-ter !default
$button-static-border-color: $border !default
// The button sizes use mixins so they can be used at different breakpoints
=button-small
border-radius: $radius-small
font-size: $size-small
=button-normal
font-size: $size-normal
=button-medium
font-size: $size-medium
=button-large
font-size: $size-large
.button
@extend %control
@extend %unselectable
background-color: $button-background-color
border-color: $button-border-color
border-width: $button-border-width
color: $button-color
cursor: pointer
@if $button-family
font-family: $button-family
justify-content: center
padding-bottom: $button-padding-vertical
padding-left: $button-padding-horizontal
padding-right: $button-padding-horizontal
padding-top: $button-padding-vertical
text-align: center
white-space: nowrap
strong
color: inherit
.icon
&,
&.is-small,
&.is-medium,
&.is-large
height: 1.5em
width: 1.5em
&:first-child:not(:last-child)
+ltr-property("margin", calc(#{-1 / 2 * $button-padding-horizontal} - #{$button-border-width}), false)
+ltr-property("margin", $button-padding-horizontal / 4)
&:last-child:not(:first-child)
+ltr-property("margin", $button-padding-horizontal / 4, false)
+ltr-property("margin", calc(#{-1 / 2 * $button-padding-horizontal} - #{$button-border-width}))
&:first-child:last-child
margin-left: calc(#{-1 / 2 * $button-padding-horizontal} - #{$button-border-width})
margin-right: calc(#{-1 / 2 * $button-padding-horizontal} - #{$button-border-width})
// States
&:hover,
&.is-hovered
border-color: $button-hover-border-color
color: $button-hover-color
&:focus,
&.is-focused
border-color: $button-focus-border-color
color: $button-focus-color
&:not(:active)
box-shadow: $button-focus-box-shadow-size $button-focus-box-shadow-color
&:active,
&.is-active
border-color: $button-active-border-color
color: $button-active-color
// Colors
&.is-text
background-color: transparent
border-color: transparent
color: $button-text-color
text-decoration: $button-text-decoration
&:hover,
&.is-hovered,
&:focus,
&.is-focused
background-color: $button-text-hover-background-color
color: $button-text-hover-color
&:active,
&.is-active
background-color: bulmaDarken($button-text-hover-background-color, 5%)
color: $button-text-hover-color
&[disabled],
fieldset[disabled] &
background-color: transparent
border-color: transparent
box-shadow: none
@each $name, $pair in $colors
$color: nth($pair, 1)
$color-invert: nth($pair, 2)
&.is-#{$name}
background-color: $color
border-color: transparent
color: $color-invert
&:hover,
&.is-hovered
background-color: bulmaDarken($color, 2.5%)
border-color: transparent
color: $color-invert
&:focus,
&.is-focused
border-color: transparent
color: $color-invert
&:not(:active)
box-shadow: $button-focus-box-shadow-size bulmaRgba($color, 0.25)
&:active,
&.is-active
background-color: bulmaDarken($color, 5%)
border-color: transparent
color: $color-invert
&[disabled],
fieldset[disabled] &
background-color: $color
border-color: transparent
box-shadow: none
&.is-inverted
background-color: $color-invert
color: $color
&:hover,
&.is-hovered
background-color: bulmaDarken($color-invert, 5%)
&[disabled],
fieldset[disabled] &
background-color: $color-invert
border-color: transparent
box-shadow: none
color: $color
&.is-loading
&::after
border-color: transparent transparent $color-invert $color-invert !important
&.is-outlined
background-color: transparent
border-color: $color
color: $color
&:hover,
&.is-hovered,
&:focus,
&.is-focused
background-color: $color
border-color: $color
color: $color-invert
&.is-loading
&::after
border-color: transparent transparent $color $color !important
&:hover,
&.is-hovered,
&:focus,
&.is-focused
&::after
border-color: transparent transparent $color-invert $color-invert !important
&[disabled],
fieldset[disabled] &
background-color: transparent
border-color: $color
box-shadow: none
color: $color
&.is-inverted.is-outlined
background-color: transparent
border-color: $color-invert
color: $color-invert
&:hover,
&.is-hovered,
&:focus,
&.is-focused
background-color: $color-invert
color: $color
&.is-loading
&:hover,
&.is-hovered,
&:focus,
&.is-focused
&::after
border-color: transparent transparent $color $color !important
&[disabled],
fieldset[disabled] &
background-color: transparent
border-color: $color-invert
box-shadow: none
color: $color-invert
// If light and dark colors are provided
@if length($pair) >= 4
$color-light: nth($pair, 3)
$color-dark: nth($pair, 4)
&.is-light
background-color: $color-light
color: $color-dark
&:hover,
&.is-hovered
background-color: bulmaDarken($color-light, 2.5%)
border-color: transparent
color: $color-dark
&:active,
&.is-active
background-color: bulmaDarken($color-light, 5%)
border-color: transparent
color: $color-dark
// Sizes
&.is-small
+button-small
&.is-normal
+button-normal
&.is-medium
+button-medium
&.is-large
+button-large
// Modifiers
&[disabled],
fieldset[disabled] &
background-color: $button-disabled-background-color
border-color: $button-disabled-border-color
box-shadow: $button-disabled-shadow
opacity: $button-disabled-opacity
&.is-fullwidth
display: flex
width: 100%
&.is-loading
color: transparent !important
pointer-events: none
&::after
@extend %loader
+center(1em)
position: absolute !important
&.is-static
background-color: $button-static-background-color
border-color: $button-static-border-color
color: $button-static-color
box-shadow: none
pointer-events: none
&.is-rounded
border-radius: $radius-rounded
padding-left: calc(#{$button-padding-horizontal} + 0.25em)
padding-right: calc(#{$button-padding-horizontal} + 0.25em)
.buttons
align-items: center
display: flex
flex-wrap: wrap
justify-content: flex-start
.button
margin-bottom: 0.5rem
&:not(:last-child):not(.is-fullwidth)
+ltr-property("margin", 0.5rem)
&:last-child
margin-bottom: -0.5rem
&:not(:last-child)
margin-bottom: 1rem
// Sizes
&.are-small
.button:not(.is-normal):not(.is-medium):not(.is-large)
+button-small
&.are-medium
.button:not(.is-small):not(.is-normal):not(.is-large)
+button-medium
&.are-large
.button:not(.is-small):not(.is-normal):not(.is-medium)
+button-large
&.has-addons
.button
&:not(:first-child)
border-bottom-left-radius: 0
border-top-left-radius: 0
&:not(:last-child)
border-bottom-right-radius: 0
border-top-right-radius: 0
+ltr-property("margin", -1px)
&:last-child
+ltr-property("margin", 0)
&:hover,
&.is-hovered
z-index: 2
&:focus,
&.is-focused,
&:active,
&.is-active,
&.is-selected
z-index: 3
&:hover
z-index: 4
&.is-expanded
flex-grow: 1
flex-shrink: 1
&.is-centered
justify-content: center
&:not(.has-addons)
.button:not(.is-fullwidth)
margin-left: 0.25rem
margin-right: 0.25rem
&.is-right
justify-content: flex-end
&:not(.has-addons)
.button:not(.is-fullwidth)
margin-left: 0.25rem
margin-right: 0.25rem

View File

@@ -1,24 +0,0 @@
$container-offset: (2 * $gap) !default
.container
flex-grow: 1
margin: 0 auto
position: relative
width: auto
&.is-fluid
max-width: none
padding-left: $gap
padding-right: $gap
width: 100%
+desktop
max-width: $desktop - $container-offset
+until-widescreen
&.is-widescreen
max-width: $widescreen - $container-offset
+until-fullhd
&.is-fullhd
max-width: $fullhd - $container-offset
+widescreen
max-width: $widescreen - $container-offset
+fullhd
max-width: $fullhd - $container-offset

View File

@@ -1,155 +0,0 @@
$content-heading-color: $text-strong !default
$content-heading-weight: $weight-semibold !default
$content-heading-line-height: 1.125 !default
$content-blockquote-background-color: $background !default
$content-blockquote-border-left: 5px solid $border !default
$content-blockquote-padding: 1.25em 1.5em !default
$content-pre-padding: 1.25em 1.5em !default
$content-table-cell-border: 1px solid $border !default
$content-table-cell-border-width: 0 0 1px !default
$content-table-cell-padding: 0.5em 0.75em !default
$content-table-cell-heading-color: $text-strong !default
$content-table-head-cell-border-width: 0 0 2px !default
$content-table-head-cell-color: $text-strong !default
$content-table-foot-cell-border-width: 2px 0 0 !default
$content-table-foot-cell-color: $text-strong !default
.content
@extend %block
// Inline
li + li
margin-top: 0.25em
// Block
p,
dl,
ol,
ul,
blockquote,
pre,
table
&:not(:last-child)
margin-bottom: 1em
h1,
h2,
h3,
h4,
h5,
h6
color: $content-heading-color
font-weight: $content-heading-weight
line-height: $content-heading-line-height
h1
font-size: 2em
margin-bottom: 0.5em
&:not(:first-child)
margin-top: 1em
h2
font-size: 1.75em
margin-bottom: 0.5714em
&:not(:first-child)
margin-top: 1.1428em
h3
font-size: 1.5em
margin-bottom: 0.6666em
&:not(:first-child)
margin-top: 1.3333em
h4
font-size: 1.25em
margin-bottom: 0.8em
h5
font-size: 1.125em
margin-bottom: 0.8888em
h6
font-size: 1em
margin-bottom: 1em
blockquote
background-color: $content-blockquote-background-color
+ltr-property("border", $content-blockquote-border-left, false)
padding: $content-blockquote-padding
ol
list-style-position: outside
+ltr-property("margin", 2em, false)
margin-top: 1em
&:not([type])
list-style-type: decimal
&.is-lower-alpha
list-style-type: lower-alpha
&.is-lower-roman
list-style-type: lower-roman
&.is-upper-alpha
list-style-type: upper-alpha
&.is-upper-roman
list-style-type: upper-roman
ul
list-style: disc outside
+ltr-property("margin", 2em, false)
margin-top: 1em
ul
list-style-type: circle
margin-top: 0.5em
ul
list-style-type: square
dd
+ltr-property("margin", 2em, false)
figure
margin-left: 2em
margin-right: 2em
text-align: center
&:not(:first-child)
margin-top: 2em
&:not(:last-child)
margin-bottom: 2em
img
display: inline-block
figcaption
font-style: italic
pre
+overflow-touch
overflow-x: auto
padding: $content-pre-padding
white-space: pre
word-wrap: normal
sup,
sub
font-size: 75%
table
width: 100%
td,
th
border: $content-table-cell-border
border-width: $content-table-cell-border-width
padding: $content-table-cell-padding
vertical-align: top
th
color: $content-table-cell-heading-color
&:not([align])
text-align: inherit
thead
td,
th
border-width: $content-table-head-cell-border-width
color: $content-table-head-cell-color
tfoot
td,
th
border-width: $content-table-foot-cell-border-width
color: $content-table-foot-cell-color
tbody
tr
&:last-child
td,
th
border-bottom-width: 0
.tabs
li + li
margin-top: 0
// Sizes
&.is-small
font-size: $size-small
&.is-medium
font-size: $size-medium
&.is-large
font-size: $size-large

View File

@@ -1 +0,0 @@
@warn "The form.sass file is DEPRECATED. It has moved into its own /form folder. Please import sass/form/_all instead."

View File

@@ -1,21 +0,0 @@
$icon-dimensions: 1.5rem !default
$icon-dimensions-small: 1rem !default
$icon-dimensions-medium: 2rem !default
$icon-dimensions-large: 3rem !default
.icon
align-items: center
display: inline-flex
justify-content: center
height: $icon-dimensions
width: $icon-dimensions
// Sizes
&.is-small
height: $icon-dimensions-small
width: $icon-dimensions-small
&.is-medium
height: $icon-dimensions-medium
width: $icon-dimensions-medium
&.is-large
height: $icon-dimensions-large
width: $icon-dimensions-large

View File

@@ -1,71 +0,0 @@
$dimensions: 16 24 32 48 64 96 128 !default
.image
display: block
position: relative
img
display: block
height: auto
width: 100%
&.is-rounded
border-radius: $radius-rounded
&.is-fullwidth
width: 100%
// Ratio
&.is-square,
&.is-1by1,
&.is-5by4,
&.is-4by3,
&.is-3by2,
&.is-5by3,
&.is-16by9,
&.is-2by1,
&.is-3by1,
&.is-4by5,
&.is-3by4,
&.is-2by3,
&.is-3by5,
&.is-9by16,
&.is-1by2,
&.is-1by3
img,
.has-ratio
@extend %overlay
height: 100%
width: 100%
&.is-square,
&.is-1by1
padding-top: 100%
&.is-5by4
padding-top: 80%
&.is-4by3
padding-top: 75%
&.is-3by2
padding-top: 66.6666%
&.is-5by3
padding-top: 60%
&.is-16by9
padding-top: 56.25%
&.is-2by1
padding-top: 50%
&.is-3by1
padding-top: 33.3333%
&.is-4by5
padding-top: 125%
&.is-3by4
padding-top: 133.3333%
&.is-2by3
padding-top: 150%
&.is-3by5
padding-top: 166.6666%
&.is-9by16
padding-top: 177.7777%
&.is-1by2
padding-top: 200%
&.is-1by3
padding-top: 300%
// Sizes
@each $dimension in $dimensions
&.is-#{$dimension}x#{$dimension}
height: $dimension * 1px
width: $dimension * 1px

View File

@@ -1,48 +0,0 @@
$notification-background-color: $background !default
$notification-code-background-color: $scheme-main !default
$notification-radius: $radius !default
$notification-padding: 1.25rem 2.5rem 1.25rem 1.5rem !default
$notification-padding-ltr: 1.25rem 2.5rem 1.25rem 1.5rem !default
$notification-padding-rtl: 1.25rem 1.5rem 1.25rem 2.5rem !default
.notification
@extend %block
background-color: $notification-background-color
border-radius: $notification-radius
position: relative
+ltr
padding: $notification-padding-ltr
+rtl
padding: $notification-padding-rtl
a:not(.button):not(.dropdown-item)
color: currentColor
text-decoration: underline
strong
color: currentColor
code,
pre
background: $notification-code-background-color
pre code
background: transparent
& > .delete
+ltr-position(0.5rem)
position: absolute
top: 0.5rem
.title,
.subtitle,
.content
color: currentColor
// Colors
@each $name, $pair in $colors
$color: nth($pair, 1)
$color-invert: nth($pair, 2)
&.is-#{$name}
background-color: $color
color: $color-invert
// If light and dark colors are provided
@if length($pair) >= 4
$color-light: nth($pair, 3)
$color-dark: nth($pair, 4)
&.is-light
background-color: $color-light
color: $color-dark

View File

@@ -1,39 +0,0 @@
.block
@extend %block
.delete
@extend %delete
.heading
display: block
font-size: 11px
letter-spacing: 1px
margin-bottom: 5px
text-transform: uppercase
.highlight
@extend %block
font-weight: $weight-normal
max-width: 100%
overflow: hidden
padding: 0
pre
overflow: auto
max-width: 100%
.loader
@extend %loader
.number
align-items: center
background-color: $background
border-radius: $radius-rounded
display: inline-flex
font-size: $size-medium
height: 2em
justify-content: center
margin-right: 1.5rem
min-width: 2.5em
padding: 0.25rem 0.5rem
text-align: center
vertical-align: top

View File

@@ -1,67 +0,0 @@
$progress-bar-background-color: $border-light !default
$progress-value-background-color: $text !default
$progress-border-radius: $radius-rounded !default
$progress-indeterminate-duration: 1.5s !default
.progress
@extend %block
-moz-appearance: none
-webkit-appearance: none
border: none
border-radius: $progress-border-radius
display: block
height: $size-normal
overflow: hidden
padding: 0
width: 100%
&::-webkit-progress-bar
background-color: $progress-bar-background-color
&::-webkit-progress-value
background-color: $progress-value-background-color
&::-moz-progress-bar
background-color: $progress-value-background-color
&::-ms-fill
background-color: $progress-value-background-color
border: none
// Colors
@each $name, $pair in $colors
$color: nth($pair, 1)
&.is-#{$name}
&::-webkit-progress-value
background-color: $color
&::-moz-progress-bar
background-color: $color
&::-ms-fill
background-color: $color
&:indeterminate
background-image: linear-gradient(to right, $color 30%, $progress-bar-background-color 30%)
&:indeterminate
animation-duration: $progress-indeterminate-duration
animation-iteration-count: infinite
animation-name: moveIndeterminate
animation-timing-function: linear
background-color: $progress-bar-background-color
background-image: linear-gradient(to right, $text 30%, $progress-bar-background-color 30%)
background-position: top left
background-repeat: no-repeat
background-size: 150% 150%
&::-webkit-progress-bar
background-color: transparent
&::-moz-progress-bar
background-color: transparent
// Sizes
&.is-small
height: $size-small
&.is-medium
height: $size-medium
&.is-large
height: $size-large
@keyframes moveIndeterminate
from
background-position: 200% 0
to
background-position: -200% 0

View File

@@ -1,129 +0,0 @@
$table-color: $text-strong !default
$table-background-color: $scheme-main !default
$table-cell-border: 1px solid $border !default
$table-cell-border-width: 0 0 1px !default
$table-cell-padding: 0.5em 0.75em !default
$table-cell-heading-color: $text-strong !default
$table-head-cell-border-width: 0 0 2px !default
$table-head-cell-color: $text-strong !default
$table-foot-cell-border-width: 2px 0 0 !default
$table-foot-cell-color: $text-strong !default
$table-head-background-color: transparent !default
$table-body-background-color: transparent !default
$table-foot-background-color: transparent !default
$table-row-hover-background-color: $scheme-main-bis !default
$table-row-active-background-color: $primary !default
$table-row-active-color: $primary-invert !default
$table-striped-row-even-background-color: $scheme-main-bis !default
$table-striped-row-even-hover-background-color: $scheme-main-ter !default
.table
@extend %block
background-color: $table-background-color
color: $table-color
td,
th
border: $table-cell-border
border-width: $table-cell-border-width
padding: $table-cell-padding
vertical-align: top
// Colors
@each $name, $pair in $colors
$color: nth($pair, 1)
$color-invert: nth($pair, 2)
&.is-#{$name}
background-color: $color
border-color: $color
color: $color-invert
// Modifiers
&.is-narrow
white-space: nowrap
width: 1%
&.is-selected
background-color: $table-row-active-background-color
color: $table-row-active-color
a,
strong
color: currentColor
&.is-vcentered
vertical-align: middle
th
color: $table-cell-heading-color
&:not([align])
text-align: inherit
tr
&.is-selected
background-color: $table-row-active-background-color
color: $table-row-active-color
a,
strong
color: currentColor
td,
th
border-color: $table-row-active-color
color: currentColor
thead
background-color: $table-head-background-color
td,
th
border-width: $table-head-cell-border-width
color: $table-head-cell-color
tfoot
background-color: $table-foot-background-color
td,
th
border-width: $table-foot-cell-border-width
color: $table-foot-cell-color
tbody
background-color: $table-body-background-color
tr
&:last-child
td,
th
border-bottom-width: 0
// Modifiers
&.is-bordered
td,
th
border-width: 1px
tr
&:last-child
td,
th
border-bottom-width: 1px
&.is-fullwidth
width: 100%
&.is-hoverable
tbody
tr:not(.is-selected)
&:hover
background-color: $table-row-hover-background-color
&.is-striped
tbody
tr:not(.is-selected)
&:hover
background-color: $table-row-hover-background-color
&:nth-child(even)
background-color: $table-striped-row-even-hover-background-color
&.is-narrow
td,
th
padding: 0.25em 0.5em
&.is-striped
tbody
tr:not(.is-selected)
&:nth-child(even)
background-color: $table-striped-row-even-background-color
.table-container
@extend %block
+overflow-touch
overflow: auto
overflow-y: hidden
max-width: 100%

View File

@@ -1,136 +0,0 @@
$tag-background-color: $background !default
$tag-color: $text !default
$tag-radius: $radius !default
$tag-delete-margin: 1px !default
.tags
align-items: center
display: flex
flex-wrap: wrap
justify-content: flex-start
.tag
margin-bottom: 0.5rem
&:not(:last-child)
+ltr-property("margin", 0.5rem)
&:last-child
margin-bottom: -0.5rem
&:not(:last-child)
margin-bottom: 1rem
// Sizes
&.are-medium
.tag:not(.is-normal):not(.is-large)
font-size: $size-normal
&.are-large
.tag:not(.is-normal):not(.is-medium)
font-size: $size-medium
&.is-centered
justify-content: center
.tag
margin-right: 0.25rem
margin-left: 0.25rem
&.is-right
justify-content: flex-end
.tag
&:not(:first-child)
margin-left: 0.5rem
&:not(:last-child)
margin-right: 0
&.has-addons
.tag
+ltr-property("margin", 0)
&:not(:first-child)
+ltr-property("margin", 0, false)
+ltr
border-top-left-radius: 0
border-bottom-left-radius: 0
+rtl
border-top-right-radius: 0
border-bottom-right-radius: 0
&:not(:last-child)
+ltr
border-top-right-radius: 0
border-bottom-right-radius: 0
+rtl
border-top-left-radius: 0
border-bottom-left-radius: 0
.tag:not(body)
align-items: center
background-color: $tag-background-color
border-radius: $tag-radius
color: $tag-color
display: inline-flex
font-size: $size-small
height: 2em
justify-content: center
line-height: 1.5
padding-left: 0.75em
padding-right: 0.75em
white-space: nowrap
.delete
+ltr-property("margin", 0.25rem, false)
+ltr-property("margin", -0.375rem)
// Colors
@each $name, $pair in $colors
$color: nth($pair, 1)
$color-invert: nth($pair, 2)
&.is-#{$name}
background-color: $color
color: $color-invert
// If a light and dark colors are provided
@if length($pair) > 3
$color-light: nth($pair, 3)
$color-dark: nth($pair, 4)
&.is-light
background-color: $color-light
color: $color-dark
// Sizes
&.is-normal
font-size: $size-small
&.is-medium
font-size: $size-normal
&.is-large
font-size: $size-medium
.icon
&:first-child:not(:last-child)
+ltr-property("margin", -0.375em, false)
+ltr-property("margin", 0.1875em)
&:last-child:not(:first-child)
+ltr-property("margin", 0.1875em, false)
+ltr-property("margin", -0.375em)
&:first-child:last-child
+ltr-property("margin", -0.375em, false)
+ltr-property("margin", -0.375em)
// Modifiers
&.is-delete
+ltr-property("margin", $tag-delete-margin, false)
padding: 0
position: relative
width: 2em
&::before,
&::after
background-color: currentColor
content: ""
display: block
left: 50%
position: absolute
top: 50%
transform: translateX(-50%) translateY(-50%) rotate(45deg)
transform-origin: center center
&::before
height: 1px
width: 50%
&::after
height: 50%
width: 1px
&:hover,
&:focus
background-color: darken($tag-background-color, 5%)
&:active
background-color: darken($tag-background-color, 10%)
&.is-rounded
border-radius: $radius-rounded
a.tag
&:hover
text-decoration: underline

View File

@@ -1,70 +0,0 @@
$title-color: $text-strong !default
$title-family: false !default
$title-size: $size-3 !default
$title-weight: $weight-semibold !default
$title-line-height: 1.125 !default
$title-strong-color: inherit !default
$title-strong-weight: inherit !default
$title-sub-size: 0.75em !default
$title-sup-size: 0.75em !default
$subtitle-color: $text !default
$subtitle-family: false !default
$subtitle-size: $size-5 !default
$subtitle-weight: $weight-normal !default
$subtitle-line-height: 1.25 !default
$subtitle-strong-color: $text-strong !default
$subtitle-strong-weight: $weight-semibold !default
$subtitle-negative-margin: -1.25rem !default
.title,
.subtitle
@extend %block
word-break: break-word
em,
span
font-weight: inherit
sub
font-size: $title-sub-size
sup
font-size: $title-sup-size
.tag
vertical-align: middle
.title
color: $title-color
@if $title-family
font-family: $title-family
font-size: $title-size
font-weight: $title-weight
line-height: $title-line-height
strong
color: $title-strong-color
font-weight: $title-strong-weight
& + .highlight
margin-top: -0.75rem
&:not(.is-spaced) + .subtitle
margin-top: $subtitle-negative-margin
// Sizes
@each $size in $sizes
$i: index($sizes, $size)
&.is-#{$i}
font-size: $size
.subtitle
color: $subtitle-color
@if $subtitle-family
font-family: $subtitle-family
font-size: $subtitle-size
font-weight: $subtitle-weight
line-height: $subtitle-line-height
strong
color: $subtitle-strong-color
font-weight: $subtitle-strong-weight
&:not(.is-spaced) + .title
margin-top: $subtitle-negative-margin
// Sizes
@each $size in $sizes
$i: index($sizes, $size)
&.is-#{$i}
font-size: $size

View File

@@ -1,8 +0,0 @@
@charset "utf-8"
@import "shared.sass"
@import "input-textarea.sass"
@import "checkbox-radio.sass"
@import "select.sass"
@import "file.sass"
@import "tools.sass"

View File

@@ -1,21 +0,0 @@
%checkbox-radio
cursor: pointer
display: inline-block
line-height: 1.25
position: relative
input
cursor: pointer
&:hover
color: $input-hover-color
&[disabled],
fieldset[disabled] &
color: $input-disabled-color
cursor: not-allowed
.checkbox
@extend %checkbox-radio
.radio
@extend %checkbox-radio
& + .radio
+ltr-property("margin", 0.5em, false)

View File

@@ -1,180 +0,0 @@
$file-border-color: $border !default
$file-radius: $radius !default
$file-cta-background-color: $scheme-main-ter !default
$file-cta-color: $text !default
$file-cta-hover-color: $text-strong !default
$file-cta-active-color: $text-strong !default
$file-name-border-color: $border !default
$file-name-border-style: solid !default
$file-name-border-width: 1px 1px 1px 0 !default
$file-name-max-width: 16em !default
.file
@extend %unselectable
align-items: stretch
display: flex
justify-content: flex-start
position: relative
// Colors
@each $name, $pair in $colors
$color: nth($pair, 1)
$color-invert: nth($pair, 2)
&.is-#{$name}
.file-cta
background-color: $color
border-color: transparent
color: $color-invert
&:hover,
&.is-hovered
.file-cta
background-color: bulmaDarken($color, 2.5%)
border-color: transparent
color: $color-invert
&:focus,
&.is-focused
.file-cta
border-color: transparent
box-shadow: 0 0 0.5em bulmaRgba($color, 0.25)
color: $color-invert
&:active,
&.is-active
.file-cta
background-color: bulmaDarken($color, 5%)
border-color: transparent
color: $color-invert
// Sizes
&.is-small
font-size: $size-small
&.is-medium
font-size: $size-medium
.file-icon
.fa
font-size: 21px
&.is-large
font-size: $size-large
.file-icon
.fa
font-size: 28px
// Modifiers
&.has-name
.file-cta
border-bottom-right-radius: 0
border-top-right-radius: 0
.file-name
border-bottom-left-radius: 0
border-top-left-radius: 0
&.is-empty
.file-cta
border-radius: $file-radius
.file-name
display: none
&.is-boxed
.file-label
flex-direction: column
.file-cta
flex-direction: column
height: auto
padding: 1em 3em
.file-name
border-width: 0 1px 1px
.file-icon
height: 1.5em
width: 1.5em
.fa
font-size: 21px
&.is-small
.file-icon .fa
font-size: 14px
&.is-medium
.file-icon .fa
font-size: 28px
&.is-large
.file-icon .fa
font-size: 35px
&.has-name
.file-cta
border-radius: $file-radius $file-radius 0 0
.file-name
border-radius: 0 0 $file-radius $file-radius
border-width: 0 1px 1px
&.is-centered
justify-content: center
&.is-fullwidth
.file-label
width: 100%
.file-name
flex-grow: 1
max-width: none
&.is-right
justify-content: flex-end
.file-cta
border-radius: 0 $file-radius $file-radius 0
.file-name
border-radius: $file-radius 0 0 $file-radius
border-width: 1px 0 1px 1px
order: -1
.file-label
align-items: stretch
display: flex
cursor: pointer
justify-content: flex-start
overflow: hidden
position: relative
&:hover
.file-cta
background-color: bulmaDarken($file-cta-background-color, 2.5%)
color: $file-cta-hover-color
.file-name
border-color: bulmaDarken($file-name-border-color, 2.5%)
&:active
.file-cta
background-color: bulmaDarken($file-cta-background-color, 5%)
color: $file-cta-active-color
.file-name
border-color: bulmaDarken($file-name-border-color, 5%)
.file-input
height: 100%
left: 0
opacity: 0
outline: none
position: absolute
top: 0
width: 100%
.file-cta,
.file-name
@extend %control
border-color: $file-border-color
border-radius: $file-radius
font-size: 1em
padding-left: 1em
padding-right: 1em
white-space: nowrap
.file-cta
background-color: $file-cta-background-color
color: $file-cta-color
.file-name
border-color: $file-name-border-color
border-style: $file-name-border-style
border-width: $file-name-border-width
display: block
max-width: $file-name-max-width
overflow: hidden
text-align: inherit
text-overflow: ellipsis
.file-icon
align-items: center
display: flex
height: 1em
justify-content: center
+ltr-property("margin", 0.5em)
width: 1em
.fa
font-size: 14px

View File

@@ -1,64 +0,0 @@
$textarea-padding: $control-padding-horizontal !default
$textarea-max-height: 40em !default
$textarea-min-height: 8em !default
%input-textarea
@extend %input
box-shadow: $input-shadow
max-width: 100%
width: 100%
&[readonly]
box-shadow: none
// Colors
@each $name, $pair in $colors
$color: nth($pair, 1)
&.is-#{$name}
border-color: $color
&:focus,
&.is-focused,
&:active,
&.is-active
box-shadow: $input-focus-box-shadow-size bulmaRgba($color, 0.25)
// Sizes
&.is-small
+control-small
&.is-medium
+control-medium
&.is-large
+control-large
// Modifiers
&.is-fullwidth
display: block
width: 100%
&.is-inline
display: inline
width: auto
.input
@extend %input-textarea
&.is-rounded
border-radius: $radius-rounded
padding-left: calc(#{$control-padding-horizontal} + 0.375em)
padding-right: calc(#{$control-padding-horizontal} + 0.375em)
&.is-static
background-color: transparent
border-color: transparent
box-shadow: none
padding-left: 0
padding-right: 0
.textarea
@extend %input-textarea
display: block
max-width: 100%
min-width: 100%
padding: $textarea-padding
resize: vertical
&:not([rows])
max-height: $textarea-max-height
min-height: $textarea-min-height
&[rows]
height: initial
// Modifiers
&.has-fixed-size
resize: none

View File

@@ -1,85 +0,0 @@
.select
display: inline-block
max-width: 100%
position: relative
vertical-align: top
&:not(.is-multiple)
height: $input-height
&:not(.is-multiple):not(.is-loading)
&::after
@extend %arrow
border-color: $input-arrow
+ltr-position(1.125em)
z-index: 4
&.is-rounded
select
border-radius: $radius-rounded
+ltr-property("padding", 1em, false)
select
@extend %input
cursor: pointer
display: block
font-size: 1em
max-width: 100%
outline: none
&::-ms-expand
display: none
&[disabled]:hover,
fieldset[disabled] &:hover
border-color: $input-disabled-border-color
&:not([multiple])
+ltr-property("padding", 2.5em)
&[multiple]
height: auto
padding: 0
option
padding: 0.5em 1em
// States
&:not(.is-multiple):not(.is-loading):hover
&::after
border-color: $input-hover-color
// Colors
@each $name, $pair in $colors
$color: nth($pair, 1)
&.is-#{$name}
&:not(:hover)::after
border-color: $color
select
border-color: $color
&:hover,
&.is-hovered
border-color: bulmaDarken($color, 5%)
&:focus,
&.is-focused,
&:active,
&.is-active
box-shadow: $input-focus-box-shadow-size bulmaRgba($color, 0.25)
// Sizes
&.is-small
+control-small
&.is-medium
+control-medium
&.is-large
+control-large
// Modifiers
&.is-disabled
&::after
border-color: $input-disabled-color
&.is-fullwidth
width: 100%
select
width: 100%
&.is-loading
&::after
@extend %loader
margin-top: 0
position: absolute
+ltr-position(0.625em)
top: 0.625em
transform: none
&.is-small:after
font-size: $size-small
&.is-medium:after
font-size: $size-medium
&.is-large:after
font-size: $size-large

View File

@@ -1,55 +0,0 @@
$input-color: $text-strong !default
$input-background-color: $scheme-main !default
$input-border-color: $border !default
$input-height: $control-height !default
$input-shadow: inset 0 0.0625em 0.125em rgba($scheme-invert, 0.05) !default
$input-placeholder-color: bulmaRgba($input-color, 0.3) !default
$input-hover-color: $text-strong !default
$input-hover-border-color: $border-hover !default
$input-focus-color: $text-strong !default
$input-focus-border-color: $link !default
$input-focus-box-shadow-size: 0 0 0 0.125em !default
$input-focus-box-shadow-color: bulmaRgba($link, 0.25) !default
$input-disabled-color: $text-light !default
$input-disabled-background-color: $background !default
$input-disabled-border-color: $background !default
$input-disabled-placeholder-color: bulmaRgba($input-disabled-color, 0.3) !default
$input-arrow: $link !default
$input-icon-color: $border !default
$input-icon-active-color: $text !default
$input-radius: $radius !default
=input
@extend %control
background-color: $input-background-color
border-color: $input-border-color
border-radius: $input-radius
color: $input-color
+placeholder
color: $input-placeholder-color
&:hover,
&.is-hovered
border-color: $input-hover-border-color
&:focus,
&.is-focused,
&:active,
&.is-active
border-color: $input-focus-border-color
box-shadow: $input-focus-box-shadow-size $input-focus-box-shadow-color
&[disabled],
fieldset[disabled] &
background-color: $input-disabled-background-color
border-color: $input-disabled-border-color
box-shadow: none
color: $input-disabled-color
+placeholder
color: $input-disabled-placeholder-color
%input
+input

View File

@@ -1,213 +0,0 @@
$label-color: $text-strong !default
$label-weight: $weight-bold !default
$help-size: $size-small !default
.label
color: $label-color
display: block
font-size: $size-normal
font-weight: $label-weight
&:not(:last-child)
margin-bottom: 0.5em
// Sizes
&.is-small
font-size: $size-small
&.is-medium
font-size: $size-medium
&.is-large
font-size: $size-large
.help
display: block
font-size: $help-size
margin-top: 0.25rem
@each $name, $pair in $colors
$color: nth($pair, 1)
&.is-#{$name}
color: $color
// Containers
.field
&:not(:last-child)
margin-bottom: 0.75rem
// Modifiers
&.has-addons
display: flex
justify-content: flex-start
.control
&:not(:last-child)
+ltr-property("margin", -1px)
&:not(:first-child):not(:last-child)
.button,
.input,
.select select
border-radius: 0
&:first-child:not(:only-child)
.button,
.input,
.select select
+ltr
border-bottom-right-radius: 0
border-top-right-radius: 0
+rtl
border-bottom-left-radius: 0
border-top-left-radius: 0
&:last-child:not(:only-child)
.button,
.input,
.select select
+ltr
border-bottom-left-radius: 0
border-top-left-radius: 0
+rtl
border-bottom-right-radius: 0
border-top-right-radius: 0
.button,
.input,
.select select
&:not([disabled])
&:hover,
&.is-hovered
z-index: 2
&:focus,
&.is-focused,
&:active,
&.is-active
z-index: 3
&:hover
z-index: 4
&.is-expanded
flex-grow: 1
flex-shrink: 1
&.has-addons-centered
justify-content: center
&.has-addons-right
justify-content: flex-end
&.has-addons-fullwidth
.control
flex-grow: 1
flex-shrink: 0
&.is-grouped
display: flex
justify-content: flex-start
& > .control
flex-shrink: 0
&:not(:last-child)
margin-bottom: 0
+ltr-property("margin", 0.75rem)
&.is-expanded
flex-grow: 1
flex-shrink: 1
&.is-grouped-centered
justify-content: center
&.is-grouped-right
justify-content: flex-end
&.is-grouped-multiline
flex-wrap: wrap
& > .control
&:last-child,
&:not(:last-child)
margin-bottom: 0.75rem
&:last-child
margin-bottom: -0.75rem
&:not(:last-child)
margin-bottom: 0
&.is-horizontal
+tablet
display: flex
.field-label
.label
font-size: inherit
+mobile
margin-bottom: 0.5rem
+tablet
flex-basis: 0
flex-grow: 1
flex-shrink: 0
+ltr-property("margin", 1.5rem)
text-align: right
&.is-small
font-size: $size-small
padding-top: 0.375em
&.is-normal
padding-top: 0.375em
&.is-medium
font-size: $size-medium
padding-top: 0.375em
&.is-large
font-size: $size-large
padding-top: 0.375em
.field-body
.field .field
margin-bottom: 0
+tablet
display: flex
flex-basis: 0
flex-grow: 5
flex-shrink: 1
.field
margin-bottom: 0
& > .field
flex-shrink: 1
&:not(.is-narrow)
flex-grow: 1
&:not(:last-child)
+ltr-property("margin", 0.75rem)
.control
box-sizing: border-box
clear: both
font-size: $size-normal
position: relative
text-align: inherit
// Modifiers
&.has-icons-left,
&.has-icons-right
.input,
.select
&:focus
& ~ .icon
color: $input-icon-active-color
&.is-small ~ .icon
font-size: $size-small
&.is-medium ~ .icon
font-size: $size-medium
&.is-large ~ .icon
font-size: $size-large
.icon
color: $input-icon-color
height: $input-height
pointer-events: none
position: absolute
top: 0
width: $input-height
z-index: 4
&.has-icons-left
.input,
.select select
padding-left: $input-height
.icon.is-left
left: 0
&.has-icons-right
.input,
.select select
padding-right: $input-height
.icon.is-right
right: 0
&.is-loading
&::after
@extend %loader
position: absolute !important
+ltr-position(0.625em)
top: 0.625em
z-index: 4
&.is-small:after
font-size: $size-small
&.is-medium:after
font-size: $size-medium
&.is-large:after
font-size: $size-large

View File

@@ -1,4 +0,0 @@
@charset "utf-8"
@import "columns.sass"
@import "tiles.sass"

View File

@@ -1,504 +0,0 @@
$column-gap: 0.75rem !default
.column
display: block
flex-basis: 0
flex-grow: 1
flex-shrink: 1
padding: $column-gap
.columns.is-mobile > &.is-narrow
flex: none
.columns.is-mobile > &.is-full
flex: none
width: 100%
.columns.is-mobile > &.is-three-quarters
flex: none
width: 75%
.columns.is-mobile > &.is-two-thirds
flex: none
width: 66.6666%
.columns.is-mobile > &.is-half
flex: none
width: 50%
.columns.is-mobile > &.is-one-third
flex: none
width: 33.3333%
.columns.is-mobile > &.is-one-quarter
flex: none
width: 25%
.columns.is-mobile > &.is-one-fifth
flex: none
width: 20%
.columns.is-mobile > &.is-two-fifths
flex: none
width: 40%
.columns.is-mobile > &.is-three-fifths
flex: none
width: 60%
.columns.is-mobile > &.is-four-fifths
flex: none
width: 80%
.columns.is-mobile > &.is-offset-three-quarters
margin-left: 75%
.columns.is-mobile > &.is-offset-two-thirds
margin-left: 66.6666%
.columns.is-mobile > &.is-offset-half
margin-left: 50%
.columns.is-mobile > &.is-offset-one-third
margin-left: 33.3333%
.columns.is-mobile > &.is-offset-one-quarter
margin-left: 25%
.columns.is-mobile > &.is-offset-one-fifth
margin-left: 20%
.columns.is-mobile > &.is-offset-two-fifths
margin-left: 40%
.columns.is-mobile > &.is-offset-three-fifths
margin-left: 60%
.columns.is-mobile > &.is-offset-four-fifths
margin-left: 80%
@for $i from 0 through 12
.columns.is-mobile > &.is-#{$i}
flex: none
width: percentage($i / 12)
.columns.is-mobile > &.is-offset-#{$i}
margin-left: percentage($i / 12)
+mobile
&.is-narrow-mobile
flex: none
&.is-full-mobile
flex: none
width: 100%
&.is-three-quarters-mobile
flex: none
width: 75%
&.is-two-thirds-mobile
flex: none
width: 66.6666%
&.is-half-mobile
flex: none
width: 50%
&.is-one-third-mobile
flex: none
width: 33.3333%
&.is-one-quarter-mobile
flex: none
width: 25%
&.is-one-fifth-mobile
flex: none
width: 20%
&.is-two-fifths-mobile
flex: none
width: 40%
&.is-three-fifths-mobile
flex: none
width: 60%
&.is-four-fifths-mobile
flex: none
width: 80%
&.is-offset-three-quarters-mobile
margin-left: 75%
&.is-offset-two-thirds-mobile
margin-left: 66.6666%
&.is-offset-half-mobile
margin-left: 50%
&.is-offset-one-third-mobile
margin-left: 33.3333%
&.is-offset-one-quarter-mobile
margin-left: 25%
&.is-offset-one-fifth-mobile
margin-left: 20%
&.is-offset-two-fifths-mobile
margin-left: 40%
&.is-offset-three-fifths-mobile
margin-left: 60%
&.is-offset-four-fifths-mobile
margin-left: 80%
@for $i from 0 through 12
&.is-#{$i}-mobile
flex: none
width: percentage($i / 12)
&.is-offset-#{$i}-mobile
margin-left: percentage($i / 12)
+tablet
&.is-narrow,
&.is-narrow-tablet
flex: none
&.is-full,
&.is-full-tablet
flex: none
width: 100%
&.is-three-quarters,
&.is-three-quarters-tablet
flex: none
width: 75%
&.is-two-thirds,
&.is-two-thirds-tablet
flex: none
width: 66.6666%
&.is-half,
&.is-half-tablet
flex: none
width: 50%
&.is-one-third,
&.is-one-third-tablet
flex: none
width: 33.3333%
&.is-one-quarter,
&.is-one-quarter-tablet
flex: none
width: 25%
&.is-one-fifth,
&.is-one-fifth-tablet
flex: none
width: 20%
&.is-two-fifths,
&.is-two-fifths-tablet
flex: none
width: 40%
&.is-three-fifths,
&.is-three-fifths-tablet
flex: none
width: 60%
&.is-four-fifths,
&.is-four-fifths-tablet
flex: none
width: 80%
&.is-offset-three-quarters,
&.is-offset-three-quarters-tablet
margin-left: 75%
&.is-offset-two-thirds,
&.is-offset-two-thirds-tablet
margin-left: 66.6666%
&.is-offset-half,
&.is-offset-half-tablet
margin-left: 50%
&.is-offset-one-third,
&.is-offset-one-third-tablet
margin-left: 33.3333%
&.is-offset-one-quarter,
&.is-offset-one-quarter-tablet
margin-left: 25%
&.is-offset-one-fifth,
&.is-offset-one-fifth-tablet
margin-left: 20%
&.is-offset-two-fifths,
&.is-offset-two-fifths-tablet
margin-left: 40%
&.is-offset-three-fifths,
&.is-offset-three-fifths-tablet
margin-left: 60%
&.is-offset-four-fifths,
&.is-offset-four-fifths-tablet
margin-left: 80%
@for $i from 0 through 12
&.is-#{$i},
&.is-#{$i}-tablet
flex: none
width: percentage($i / 12)
&.is-offset-#{$i},
&.is-offset-#{$i}-tablet
margin-left: percentage($i / 12)
+touch
&.is-narrow-touch
flex: none
&.is-full-touch
flex: none
width: 100%
&.is-three-quarters-touch
flex: none
width: 75%
&.is-two-thirds-touch
flex: none
width: 66.6666%
&.is-half-touch
flex: none
width: 50%
&.is-one-third-touch
flex: none
width: 33.3333%
&.is-one-quarter-touch
flex: none
width: 25%
&.is-one-fifth-touch
flex: none
width: 20%
&.is-two-fifths-touch
flex: none
width: 40%
&.is-three-fifths-touch
flex: none
width: 60%
&.is-four-fifths-touch
flex: none
width: 80%
&.is-offset-three-quarters-touch
margin-left: 75%
&.is-offset-two-thirds-touch
margin-left: 66.6666%
&.is-offset-half-touch
margin-left: 50%
&.is-offset-one-third-touch
margin-left: 33.3333%
&.is-offset-one-quarter-touch
margin-left: 25%
&.is-offset-one-fifth-touch
margin-left: 20%
&.is-offset-two-fifths-touch
margin-left: 40%
&.is-offset-three-fifths-touch
margin-left: 60%
&.is-offset-four-fifths-touch
margin-left: 80%
@for $i from 0 through 12
&.is-#{$i}-touch
flex: none
width: percentage($i / 12)
&.is-offset-#{$i}-touch
margin-left: percentage($i / 12)
+desktop
&.is-narrow-desktop
flex: none
&.is-full-desktop
flex: none
width: 100%
&.is-three-quarters-desktop
flex: none
width: 75%
&.is-two-thirds-desktop
flex: none
width: 66.6666%
&.is-half-desktop
flex: none
width: 50%
&.is-one-third-desktop
flex: none
width: 33.3333%
&.is-one-quarter-desktop
flex: none
width: 25%
&.is-one-fifth-desktop
flex: none
width: 20%
&.is-two-fifths-desktop
flex: none
width: 40%
&.is-three-fifths-desktop
flex: none
width: 60%
&.is-four-fifths-desktop
flex: none
width: 80%
&.is-offset-three-quarters-desktop
margin-left: 75%
&.is-offset-two-thirds-desktop
margin-left: 66.6666%
&.is-offset-half-desktop
margin-left: 50%
&.is-offset-one-third-desktop
margin-left: 33.3333%
&.is-offset-one-quarter-desktop
margin-left: 25%
&.is-offset-one-fifth-desktop
margin-left: 20%
&.is-offset-two-fifths-desktop
margin-left: 40%
&.is-offset-three-fifths-desktop
margin-left: 60%
&.is-offset-four-fifths-desktop
margin-left: 80%
@for $i from 0 through 12
&.is-#{$i}-desktop
flex: none
width: percentage($i / 12)
&.is-offset-#{$i}-desktop
margin-left: percentage($i / 12)
+widescreen
&.is-narrow-widescreen
flex: none
&.is-full-widescreen
flex: none
width: 100%
&.is-three-quarters-widescreen
flex: none
width: 75%
&.is-two-thirds-widescreen
flex: none
width: 66.6666%
&.is-half-widescreen
flex: none
width: 50%
&.is-one-third-widescreen
flex: none
width: 33.3333%
&.is-one-quarter-widescreen
flex: none
width: 25%
&.is-one-fifth-widescreen
flex: none
width: 20%
&.is-two-fifths-widescreen
flex: none
width: 40%
&.is-three-fifths-widescreen
flex: none
width: 60%
&.is-four-fifths-widescreen
flex: none
width: 80%
&.is-offset-three-quarters-widescreen
margin-left: 75%
&.is-offset-two-thirds-widescreen
margin-left: 66.6666%
&.is-offset-half-widescreen
margin-left: 50%
&.is-offset-one-third-widescreen
margin-left: 33.3333%
&.is-offset-one-quarter-widescreen
margin-left: 25%
&.is-offset-one-fifth-widescreen
margin-left: 20%
&.is-offset-two-fifths-widescreen
margin-left: 40%
&.is-offset-three-fifths-widescreen
margin-left: 60%
&.is-offset-four-fifths-widescreen
margin-left: 80%
@for $i from 0 through 12
&.is-#{$i}-widescreen
flex: none
width: percentage($i / 12)
&.is-offset-#{$i}-widescreen
margin-left: percentage($i / 12)
+fullhd
&.is-narrow-fullhd
flex: none
&.is-full-fullhd
flex: none
width: 100%
&.is-three-quarters-fullhd
flex: none
width: 75%
&.is-two-thirds-fullhd
flex: none
width: 66.6666%
&.is-half-fullhd
flex: none
width: 50%
&.is-one-third-fullhd
flex: none
width: 33.3333%
&.is-one-quarter-fullhd
flex: none
width: 25%
&.is-one-fifth-fullhd
flex: none
width: 20%
&.is-two-fifths-fullhd
flex: none
width: 40%
&.is-three-fifths-fullhd
flex: none
width: 60%
&.is-four-fifths-fullhd
flex: none
width: 80%
&.is-offset-three-quarters-fullhd
margin-left: 75%
&.is-offset-two-thirds-fullhd
margin-left: 66.6666%
&.is-offset-half-fullhd
margin-left: 50%
&.is-offset-one-third-fullhd
margin-left: 33.3333%
&.is-offset-one-quarter-fullhd
margin-left: 25%
&.is-offset-one-fifth-fullhd
margin-left: 20%
&.is-offset-two-fifths-fullhd
margin-left: 40%
&.is-offset-three-fifths-fullhd
margin-left: 60%
&.is-offset-four-fifths-fullhd
margin-left: 80%
@for $i from 0 through 12
&.is-#{$i}-fullhd
flex: none
width: percentage($i / 12)
&.is-offset-#{$i}-fullhd
margin-left: percentage($i / 12)
.columns
margin-left: (-$column-gap)
margin-right: (-$column-gap)
margin-top: (-$column-gap)
&:last-child
margin-bottom: (-$column-gap)
&:not(:last-child)
margin-bottom: calc(1.5rem - #{$column-gap})
// Modifiers
&.is-centered
justify-content: center
&.is-gapless
margin-left: 0
margin-right: 0
margin-top: 0
& > .column
margin: 0
padding: 0 !important
&:not(:last-child)
margin-bottom: 1.5rem
&:last-child
margin-bottom: 0
&.is-mobile
display: flex
&.is-multiline
flex-wrap: wrap
&.is-vcentered
align-items: center
// Responsiveness
+tablet
&:not(.is-desktop)
display: flex
+desktop
// Modifiers
&.is-desktop
display: flex
@if $variable-columns
.columns.is-variable
--columnGap: 0.75rem
margin-left: calc(-1 * var(--columnGap))
margin-right: calc(-1 * var(--columnGap))
.column
padding-left: var(--columnGap)
padding-right: var(--columnGap)
@for $i from 0 through 8
&.is-#{$i}
--columnGap: #{$i * 0.25rem}
+mobile
&.is-#{$i}-mobile
--columnGap: #{$i * 0.25rem}
+tablet
&.is-#{$i}-tablet
--columnGap: #{$i * 0.25rem}
+tablet-only
&.is-#{$i}-tablet-only
--columnGap: #{$i * 0.25rem}
+touch
&.is-#{$i}-touch
--columnGap: #{$i * 0.25rem}
+desktop
&.is-#{$i}-desktop
--columnGap: #{$i * 0.25rem}
+desktop-only
&.is-#{$i}-desktop-only
--columnGap: #{$i * 0.25rem}
+widescreen
&.is-#{$i}-widescreen
--columnGap: #{$i * 0.25rem}
+widescreen-only
&.is-#{$i}-widescreen-only
--columnGap: #{$i * 0.25rem}
+fullhd
&.is-#{$i}-fullhd
--columnGap: #{$i * 0.25rem}

View File

@@ -1,34 +0,0 @@
$tile-spacing: 0.75rem !default
.tile
align-items: stretch
display: block
flex-basis: 0
flex-grow: 1
flex-shrink: 1
min-height: min-content
// Modifiers
&.is-ancestor
margin-left: $tile-spacing * -1
margin-right: $tile-spacing * -1
margin-top: $tile-spacing * -1
&:last-child
margin-bottom: $tile-spacing * -1
&:not(:last-child)
margin-bottom: $tile-spacing
&.is-child
margin: 0 !important
&.is-parent
padding: $tile-spacing
&.is-vertical
flex-direction: column
& > .tile.is-child:not(:last-child)
margin-bottom: 1.5rem !important
// Responsiveness
+tablet
&:not(.is-child)
display: flex
@for $i from 1 through 12
&.is-#{$i}
flex: none
width: ($i / 12) * 100%

View File

@@ -1,10 +0,0 @@
@charset "utf-8"
@import "color.sass"
@import "float.sass"
@import "other.sass"
@import "overflow.sass"
@import "position.sass"
@import "spacing.sass"
@import "typography.sass"
@import "visibility.sass"

View File

@@ -1,37 +0,0 @@
@each $name, $pair in $colors
$color: nth($pair, 1)
.has-text-#{$name}
color: $color !important
a.has-text-#{$name}
&:hover,
&:focus
color: bulmaDarken($color, 10%) !important
.has-background-#{$name}
background-color: $color !important
@if length($pair) >= 4
$color-light: nth($pair, 3)
$color-dark: nth($pair, 4)
// Light
.has-text-#{$name}-light
color: $color-light !important
a.has-text-#{$name}-light
&:hover,
&:focus
color: bulmaDarken($color-light, 10%) !important
.has-background-#{$name}-light
background-color: $color-light !important
// Dark
.has-text-#{$name}-dark
color: $color-dark !important
a.has-text-#{$name}-dark
&:hover,
&:focus
color: bulmaLighten($color-dark, 10%) !important
.has-background-#{$name}-dark
background-color: $color-dark !important
@each $name, $shade in $shades
.has-text-#{$name}
color: $shade !important
.has-background-#{$name}
background-color: $shade !important

View File

@@ -1,8 +0,0 @@
.is-clearfix
+clearfix
.is-pulled-left
float: left !important
.is-pulled-right
float: right !important

View File

@@ -1,8 +0,0 @@
.is-radiusless
border-radius: 0 !important
.is-shadowless
box-shadow: none !important
.is-unselectable
@extend %unselectable

View File

@@ -1,2 +0,0 @@
.is-clipped
overflow: hidden !important

View File

@@ -1,5 +0,0 @@
.is-overlay
@extend %overlay
.is-relative
position: relative !important

View File

@@ -1,28 +0,0 @@
.is-marginless
margin: 0 !important
.is-paddingless
padding: 0 !important
$spacing-shortcuts: ("margin": "m", "padding": "p") !default
$spacing-directions: ("top": "t", "right": "r", "bottom": "b", "left": "l") !default
$spacing-horizontal: "x" !default
$spacing-vertical: "y" !default
$spacing-values: ("0": 0, "1": 0.25rem, "2": 0.5rem, "3": 0.75rem, "4": 1rem, "5": 1.5rem, "6": 3rem) !default
@each $property, $shortcut in $spacing-shortcuts
@each $name, $value in $spacing-values
// Cardinal directions
@each $direction, $suffix in $spacing-directions
.#{$shortcut}#{$suffix}-#{$name}
#{$property}-#{$direction}: $value !important
// Horizontal axis
@if $spacing-horizontal != null
.#{$shortcut}#{$spacing-horizontal}-#{$name}
#{$property}-left: $value !important
#{$property}-right: $value !important
// Vertical axis
@if $spacing-vertical != null
.#{$shortcut}#{$spacing-vertical}-#{$name}
#{$property}-top: $value !important
#{$property}-bottom: $value !important

View File

@@ -1,98 +0,0 @@
=typography-size($target:'')
@each $size in $sizes
$i: index($sizes, $size)
.is-size-#{$i}#{if($target == '', '', '-' + $target)}
font-size: $size !important
+typography-size()
+mobile
+typography-size('mobile')
+tablet
+typography-size('tablet')
+touch
+typography-size('touch')
+desktop
+typography-size('desktop')
+widescreen
+typography-size('widescreen')
+fullhd
+typography-size('fullhd')
$alignments: ('centered': 'center', 'justified': 'justify', 'left': 'left', 'right': 'right')
@each $alignment, $text-align in $alignments
.has-text-#{$alignment}
text-align: #{$text-align} !important
@each $alignment, $text-align in $alignments
+mobile
.has-text-#{$alignment}-mobile
text-align: #{$text-align} !important
+tablet
.has-text-#{$alignment}-tablet
text-align: #{$text-align} !important
+tablet-only
.has-text-#{$alignment}-tablet-only
text-align: #{$text-align} !important
+touch
.has-text-#{$alignment}-touch
text-align: #{$text-align} !important
+desktop
.has-text-#{$alignment}-desktop
text-align: #{$text-align} !important
+desktop-only
.has-text-#{$alignment}-desktop-only
text-align: #{$text-align} !important
+widescreen
.has-text-#{$alignment}-widescreen
text-align: #{$text-align} !important
+widescreen-only
.has-text-#{$alignment}-widescreen-only
text-align: #{$text-align} !important
+fullhd
.has-text-#{$alignment}-fullhd
text-align: #{$text-align} !important
.is-capitalized
text-transform: capitalize !important
.is-lowercase
text-transform: lowercase !important
.is-uppercase
text-transform: uppercase !important
.is-italic
font-style: italic !important
.has-text-weight-light
font-weight: $weight-light !important
.has-text-weight-normal
font-weight: $weight-normal !important
.has-text-weight-medium
font-weight: $weight-medium !important
.has-text-weight-semibold
font-weight: $weight-semibold !important
.has-text-weight-bold
font-weight: $weight-bold !important
.is-family-primary
font-family: $family-primary !important
.is-family-secondary
font-family: $family-secondary !important
.is-family-sans-serif
font-family: $family-sans-serif !important
.is-family-monospace
font-family: $family-monospace !important
.is-family-code
font-family: $family-code !important

View File

@@ -1,122 +0,0 @@
$displays: 'block' 'flex' 'inline' 'inline-block' 'inline-flex'
@each $display in $displays
.is-#{$display}
display: #{$display} !important
+mobile
.is-#{$display}-mobile
display: #{$display} !important
+tablet
.is-#{$display}-tablet
display: #{$display} !important
+tablet-only
.is-#{$display}-tablet-only
display: #{$display} !important
+touch
.is-#{$display}-touch
display: #{$display} !important
+desktop
.is-#{$display}-desktop
display: #{$display} !important
+desktop-only
.is-#{$display}-desktop-only
display: #{$display} !important
+widescreen
.is-#{$display}-widescreen
display: #{$display} !important
+widescreen-only
.is-#{$display}-widescreen-only
display: #{$display} !important
+fullhd
.is-#{$display}-fullhd
display: #{$display} !important
.is-hidden
display: none !important
.is-sr-only
border: none !important
clip: rect(0, 0, 0, 0) !important
height: 0.01em !important
overflow: hidden !important
padding: 0 !important
position: absolute !important
white-space: nowrap !important
width: 0.01em !important
+mobile
.is-hidden-mobile
display: none !important
+tablet
.is-hidden-tablet
display: none !important
+tablet-only
.is-hidden-tablet-only
display: none !important
+touch
.is-hidden-touch
display: none !important
+desktop
.is-hidden-desktop
display: none !important
+desktop-only
.is-hidden-desktop-only
display: none !important
+widescreen
.is-hidden-widescreen
display: none !important
+widescreen-only
.is-hidden-widescreen-only
display: none !important
+fullhd
.is-hidden-fullhd
display: none !important
.is-invisible
visibility: hidden !important
+mobile
.is-invisible-mobile
visibility: hidden !important
+tablet
.is-invisible-tablet
visibility: hidden !important
+tablet-only
.is-invisible-tablet-only
visibility: hidden !important
+touch
.is-invisible-touch
visibility: hidden !important
+desktop
.is-invisible-desktop
visibility: hidden !important
+desktop-only
.is-invisible-desktop-only
visibility: hidden !important
+widescreen
.is-invisible-widescreen
visibility: hidden !important
+widescreen-only
.is-invisible-widescreen-only
visibility: hidden !important
+fullhd
.is-invisible-fullhd
visibility: hidden !important

View File

@@ -1,5 +0,0 @@
@charset "utf-8"
@import "hero.sass"
@import "section.sass"
@import "footer.sass"

View File

@@ -1,9 +0,0 @@
$footer-background-color: $scheme-main-bis !default
$footer-color: false !default
$footer-padding: 3rem 1.5rem 6rem !default
.footer
background-color: $footer-background-color
padding: $footer-padding
@if $footer-color
color: $footer-color

View File

@@ -1,145 +0,0 @@
$hero-body-padding: 3rem 1.5rem !default
$hero-body-padding-small: 1.5rem !default
$hero-body-padding-medium: 9rem 1.5rem !default
$hero-body-padding-large: 18rem 1.5rem !default
// Main container
.hero
align-items: stretch
display: flex
flex-direction: column
justify-content: space-between
.navbar
background: none
.tabs
ul
border-bottom: none
// Colors
@each $name, $pair in $colors
$color: nth($pair, 1)
$color-invert: nth($pair, 2)
&.is-#{$name}
background-color: $color
color: $color-invert
a:not(.button):not(.dropdown-item):not(.tag):not(.pagination-link.is-current),
strong
color: inherit
.title
color: $color-invert
.subtitle
color: bulmaRgba($color-invert, 0.9)
a:not(.button),
strong
color: $color-invert
.navbar-menu
+touch
background-color: $color
.navbar-item,
.navbar-link
color: bulmaRgba($color-invert, 0.7)
a.navbar-item,
.navbar-link
&:hover,
&.is-active
background-color: bulmaDarken($color, 5%)
color: $color-invert
.tabs
a
color: $color-invert
opacity: 0.9
&:hover
opacity: 1
li
&.is-active a
opacity: 1
&.is-boxed,
&.is-toggle
a
color: $color-invert
&:hover
background-color: bulmaRgba($scheme-invert, 0.1)
li.is-active a
&,
&:hover
background-color: $color-invert
border-color: $color-invert
color: $color
// Modifiers
@if type-of($color) == 'color'
&.is-bold
$gradient-top-left: darken(saturate(adjust-hue($color, -10deg), 10%), 10%)
$gradient-bottom-right: lighten(saturate(adjust-hue($color, 10deg), 5%), 5%)
background-image: linear-gradient(141deg, $gradient-top-left 0%, $color 71%, $gradient-bottom-right 100%)
+mobile
.navbar-menu
background-image: linear-gradient(141deg, $gradient-top-left 0%, $color 71%, $gradient-bottom-right 100%)
// Sizes
&.is-small
.hero-body
padding: $hero-body-padding-small
&.is-medium
+tablet
.hero-body
padding: $hero-body-padding-medium
&.is-large
+tablet
.hero-body
padding: $hero-body-padding-large
&.is-halfheight,
&.is-fullheight,
&.is-fullheight-with-navbar
.hero-body
align-items: center
display: flex
& > .container
flex-grow: 1
flex-shrink: 1
&.is-halfheight
min-height: 50vh
&.is-fullheight
min-height: 100vh
// Components
.hero-video
@extend %overlay
overflow: hidden
video
left: 50%
min-height: 100%
min-width: 100%
position: absolute
top: 50%
transform: translate3d(-50%, -50%, 0)
// Modifiers
&.is-transparent
opacity: 0.3
// Responsiveness
+mobile
display: none
.hero-buttons
margin-top: 1.5rem
// Responsiveness
+mobile
.button
display: flex
&:not(:last-child)
margin-bottom: 0.75rem
+tablet
display: flex
justify-content: center
.button:not(:last-child)
+ltr-property("margin", 1.5rem)
// Containers
.hero-head,
.hero-foot
flex-grow: 0
flex-shrink: 0
.hero-body
flex-grow: 1
flex-shrink: 0
padding: $hero-body-padding

View File

@@ -1,13 +0,0 @@
$section-padding: 3rem 1.5rem !default
$section-padding-medium: 9rem 1.5rem !default
$section-padding-large: 18rem 1.5rem !default
.section
padding: $section-padding
// Responsiveness
+desktop
// Sizes
&.is-medium
padding: $section-padding-medium
&.is-large
padding: $section-padding-large

View File

@@ -1,8 +0,0 @@
@charset "utf-8"
@import "initial-variables.sass"
@import "functions.sass"
@import "derived-variables.scss"
@import "animations.sass"
@import "mixins.sass"
@import "controls.sass"

View File

@@ -1,5 +0,0 @@
@keyframes spinAround
from
transform: rotate(0deg)
to
transform: rotate(359deg)

View File

@@ -1,50 +0,0 @@
$control-radius: $radius !default
$control-radius-small: $radius-small !default
$control-border-width: 1px !default
$control-height: 2.5em !default
$control-line-height: 1.5 !default
$control-padding-vertical: calc(0.5em - #{$control-border-width}) !default
$control-padding-horizontal: calc(0.75em - #{$control-border-width}) !default
=control
-moz-appearance: none
-webkit-appearance: none
align-items: center
border: $control-border-width solid transparent
border-radius: $control-radius
box-shadow: none
display: inline-flex
font-size: $size-normal
height: $control-height
justify-content: flex-start
line-height: $control-line-height
padding-bottom: $control-padding-vertical
padding-left: $control-padding-horizontal
padding-right: $control-padding-horizontal
padding-top: $control-padding-vertical
position: relative
vertical-align: top
// States
&:focus,
&.is-focused,
&:active,
&.is-active
outline: none
&[disabled],
fieldset[disabled] &
cursor: not-allowed
%control
+control
// The controls sizes use mixins so they can be used at different breakpoints
=control-small
border-radius: $control-radius-small
font-size: $size-small
=control-medium
font-size: $size-medium
=control-large
font-size: $size-large

View File

@@ -1,132 +0,0 @@
$primary: $turquoise !default;
$info : $cyan !default;
$success: $green !default;
$warning: $yellow !default;
$danger : $red !default;
$light : $white-ter !default;
$dark : $grey-darker !default;
// Invert colors
$orange-invert : findColorInvert($orange) !default;
$yellow-invert : findColorInvert($yellow) !default;
$green-invert : findColorInvert($green) !default;
$turquoise-invert: findColorInvert($turquoise) !default;
$cyan-invert : findColorInvert($cyan) !default;
$blue-invert : findColorInvert($blue) !default;
$purple-invert : findColorInvert($purple) !default;
$red-invert : findColorInvert($red) !default;
$primary-invert : findColorInvert($primary) !default;
$primary-light : findLightColor($primary) !default;
$primary-dark : findDarkColor($primary) !default;
$info-invert : findColorInvert($info) !default;
$info-light : findLightColor($info) !default;
$info-dark : findDarkColor($info) !default;
$success-invert : findColorInvert($success) !default;
$success-light : findLightColor($success) !default;
$success-dark : findDarkColor($success) !default;
$warning-invert : findColorInvert($warning) !default;
$warning-light : findLightColor($warning) !default;
$warning-dark : findDarkColor($warning) !default;
$danger-invert : findColorInvert($danger) !default;
$danger-light : findLightColor($danger) !default;
$danger-dark : findDarkColor($danger) !default;
$light-invert : findColorInvert($light) !default;
$dark-invert : findColorInvert($dark) !default;
// General colors
$scheme-main : $white !default;
$scheme-main-bis : $white-bis !default;
$scheme-main-ter : $white-ter !default;
$scheme-invert : $black !default;
$scheme-invert-bis : $black-bis !default;
$scheme-invert-ter : $black-ter !default;
$background : $white-ter !default;
$border : $grey-lighter !default;
$border-hover : $grey-light !default;
$border-light : $grey-lightest !default;
$border-light-hover: $grey-light !default;
// Text colors
$text : $grey-dark !default;
$text-invert: findColorInvert($text) !default;
$text-light : $grey !default;
$text-strong: $grey-darker !default;
// Code colors
$code : $red !default;
$code-background: $background !default;
$pre : $text !default;
$pre-background : $background !default;
// Link colors
$link : $blue !default;
$link-invert : findColorInvert($link) !default;
$link-light : findLightColor($link) !default;
$link-dark : findDarkColor($link) !default;
$link-visited : $purple !default;
$link-hover : $grey-darker !default;
$link-hover-border : $grey-light !default;
$link-focus : $grey-darker !default;
$link-focus-border : $blue !default;
$link-active : $grey-darker !default;
$link-active-border: $grey-dark !default;
// Typography
$family-primary : $family-sans-serif !default;
$family-secondary: $family-sans-serif !default;
$family-code : $family-monospace !default;
$size-small : $size-7 !default;
$size-normal: $size-6 !default;
$size-medium: $size-5 !default;
$size-large : $size-4 !default;
// Lists and maps
$custom-colors: null !default;
$custom-shades: null !default;
$colors: mergeColorMaps(
(
"white" : ($white, $black),
"black" : ($black, $white),
"light" : ($light, $light-invert),
"dark" : ($dark, $dark-invert),
"primary": ($primary, $primary-invert, $primary-light, $primary-dark),
"link" : ($link, $link-invert, $link-light, $link-dark),
"info" : ($info, $info-invert, $info-light, $info-dark),
"success": ($success, $success-invert, $success-light, $success-dark),
"warning": ($warning, $warning-invert, $warning-light, $warning-dark),
"danger" : ($danger, $danger-invert, $danger-light, $danger-dark)),
$custom-colors
) !default;
$shades: mergeColorMaps(
(
"black-bis" : $black-bis,
"black-ter" : $black-ter,
"grey-darker" : $grey-darker,
"grey-dark" : $grey-dark,
"grey" : $grey,
"grey-light" : $grey-light,
"grey-lighter": $grey-lighter,
"white-ter" : $white-ter,
"white-bis" : $white-bis),
$custom-shades
) !default;
$sizes: $size-1 $size-2 $size-3 $size-4 $size-5 $size-6 $size-7 !default;

Some files were not shown because too many files have changed in this diff Show More