Skip to content

Conversation

@JakeSCahill
Copy link
Contributor

@JakeSCahill JakeSCahill commented Jan 23, 2026

Fixes https://redpandadata.atlassian.net/browse/DOC-911
Fixes https://redpandadata.atlassian.net/browse/DOC-1173

Major UX improvements to the Bloblang playground including intelligent autocomplete, enhanced error handling, keyboard shortcuts, and navigation fixes.

https://deploy-preview-355--docs-ui.netlify.app/playground

2026-01-23_16-36-10.mp4

Intelligent Autocomplete (DOC-911)

The Bloblang mapping editor now features comprehensive autocomplete functionality:

  • Static completions: Core Bloblang keywords (root, this, deleted()), functions, and methods

  • Dynamic completions: Fetched from Connect component JSON hosted on the docs site with automatic version detection from GitHub releases

  • Context-aware suggestions:

    • Input field names after this.
    • Nested field navigation
    • Metadata keys after meta(
    • Methods-only filtering after value chains
  • Named parameter snippets: Tab navigation between parameters

  • Smart suppression: No suggestions inside string literals or inappropriate contexts

  • Performance optimized: Field extraction caching prevents re-parsing on every keystroke

    UX Polish:

    • Styled autocomplete dropdown with Redpanda brand colors
    • Full dark mode support
    • Auto-trigger on . and ( characters
    • Subtle panel separators (reduced from 30% to 15% opacity)

    Technical Details:

    • Downloaded ACE ext-language_tools.js locally (consistency with other ACE libs)
    • Mock Connect data for localhost development (avoids CORS)
    • Fallback version detection for Connect JSON loading
    • Handles edge cases: strings, root assignments, method chaining

Playground UX & Accessibility Improvements

Contextual Actions:

  • Ask AI button now appears near errors with better layout
  • Format JSON button only shows for JSON input format
  • Per-section Clear/Format buttons replace global actions
  • Mapping errors display below mapping label

New Features:

  • Export/import configuration functionality (DOC-1173)
  • Keyboard shortcuts overlay (Shift+?)
  • Auto-run toggle for automatic execution
  • Execution time display with success/error states
  • Input format selector with validation
  • Getting started tip with dismiss option

Navigation

Nav Collapse/Expand:

  • Fixed missing nav-collapse partial inclusion
  • Updated styling with proper spacing and full width
  • Added border-top for visual separation

Back-to-Top Button:

  • Fixed premature appearance - now only shows after scrolling 300px
  • Smooth scroll behavior

Testing:

  • Added comprehensive nav structure to ui-model.yml (~70 items across 8 sections)

JakeSCahill and others added 3 commits January 23, 2026 14:47
- Streamlined Ask AI button with contextual placement near errors
- Fixed mapping errors to display below mapping label
- Improved dark mode color accessibility for validation indicators
- Fixed conflicting ACE editor validation messages
- Made Format JSON button contextual (shows only for JSON input)
- Replaced global Clear All/Format buttons with contextual buttons per section
- DOC-1173 Added export and import configuration functionality
- Added keyboard shortcuts overlay and auto-run toggle
- Added execution time display with success/error states
- Added input format selector with validation
- Added share link functionality
- Added getting started tip with dismiss option
- Fixed Ask AI button layout to prevent squishing
- Changed clear shortcut from Ctrl+K to Ctrl+Shift+X to avoid conflicts
- Include nav-collapse partial in nav template
- Update nav-collapse styling with proper spacing and full width
- Add border-top to visually separate collapse button
- Fix back-to-top button to only show after scrolling 300px
- Add comprehensive nav items to ui-model.yml for testing
Implements comprehensive autocomplete functionality for the Bloblang mapping editor with both static and dynamic completions:

**Autocomplete Features:**
- Static completions for core Bloblang keywords, functions, and methods
- Dynamic completions fetched from Connect component JSON with automatic version detection
- Context-aware suggestions:
  - Input field names after `this.`
  - Nested field navigation (e.g., `this.user.name.`)
  - Metadata keys after `meta(`
  - Methods-only after value chains (e.g., `string.`, `json().`)
- Named parameter snippets with tab navigation (e.g., `replace(old, new)`)
- Smart suppression inside string literals and after `root` assignments
- Performance optimized with field extraction caching

**UX Improvements:**
- Styled autocomplete dropdown with brand colors and dark mode support
- Subtle separators between Input/Output/Mapping panels (reduced opacity)
- Auto-trigger on `.` and `(` characters
- Proper filtering: methods-only in chaining context, all completions elsewhere

**Technical:**
- Downloaded ACE language_tools extension locally (consistency with other ACE libs)
- Mock Connect data for localhost development (avoids CORS issues)
- Fallback version detection for Connect JSON loading

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@netlify
Copy link

netlify bot commented Jan 23, 2026

Deploy Preview for docs-ui ready!

Name Link
🔨 Latest commit ebcf88e
🔍 Latest deploy log https://app.netlify.com/projects/docs-ui/deploys/6973a251e9dc6a00097b96df
😎 Deploy Preview https://deploy-preview-355--docs-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 25 (🔴 down 4 from production)
Accessibility: 93 (no change from production)
Best Practices: 100 (no change from production)
SEO: 89 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 23, 2026

📝 Walkthrough

Walkthrough

This PR introduces significant enhancements to the Bloblang playground UI and documentation navigation. Key changes include: expanded navigation structure with new "Get Started" and "Concepts" sections; comprehensive styling overhaul for the playground featuring new UI components, editor refinements, and responsive layouts; autocomplete/IntelliSense for Bloblang with static keywords and dynamic completions from Connect data; validation and execution feedback mechanisms with timing displays; enhanced import/export/share features including file system access and URL-based sharing; navigation collapse/expand persistence via localStorage; and back-to-top button visibility control.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Editor as Ace Editor
    participant Validator as Validation Layer
    participant Debounce as Debounce Manager
    participant Storage as SessionStorage
    participant Display as UI Display

    User->>Editor: Types Bloblang code
    Editor->>Debounce: Emit change event
    Debounce->>Validator: Validate mapping (after delay)
    Validator->>Validator: Parse & check syntax
    alt Validation Success
        Validator->>Display: Clear error indicators
        Display->>Display: Show success state
        Debounce->>Storage: Save mapping to sessionStorage
        Debounce->>Editor: Execute mapping (debounced)
        Editor->>Display: Show execution time & output
    else Validation Error
        Validator->>Display: Show error message
        Display->>Display: Highlight validation indicator
    end
Loading
sequenceDiagram
    participant User
    participant UI as Playground UI
    participant Completer as Bloblang Completer
    participant Input as Input Parser
    participant Connect as Connect API
    participant Ace as Ace Autocomplete

    User->>Ace: Trigger autocomplete (. or ()
    Ace->>Completer: Request completions at position
    Completer->>Input: Extract fields from JSON input
    Input->>Completer: Return field paths
    Completer->>Connect: Fetch completions (if dynamic needed)
    Connect->>Completer: Return Connect data
    Completer->>Completer: Merge static + dynamic completions
    Completer->>Ace: Provide context-aware completions
    Ace->>User: Display autocomplete menu
Loading
sequenceDiagram
    participant User
    participant UI as Share/Import UI
    participant URL as URL Generator
    participant Clipboard as Clipboard API
    participant Storage as URL Storage
    participant Download as File System/Blob

    User->>UI: Click Share
    UI->>URL: Encode editor contents (Base64)
    URL->>Clipboard: Copy shareable URL
    alt Clipboard Success
        Clipboard->>UI: Show "Copied!" feedback
    else Clipboard Fails
        UI->>UI: Show URL modal fallback
    end

    User->>UI: Click Import
    UI->>Download: Select file
    Download->>UI: Parse JSON config
    UI->>Storage: Restore editors from config
    UI->>UI: Update editor contents
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • paulohtb6
  • Feediver1
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Bloblang playground enhancements' is vague and generic, using a broad term 'enhancements' without specifying the primary changes (autocomplete, export, navigation improvements). Provide a more specific title that highlights the main feature, such as 'Add intelligent autocomplete and export functionality to Bloblang playground' or focus on the most impactful change from the objectives.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR successfully implements both linked issues: DOC-911 (autocomplete with static/dynamic completions, context-aware suggestions, and styling) and DOC-1173 (export/import configuration functionality with processor stanza support).
Out of Scope Changes check ✅ Passed All changes are in scope: autocomplete features (DOC-911), export/import functionality (DOC-1173), navigation improvements, back-to-top visibility, UI/UX polish, and test structure additions align with stated objectives.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description check ✅ Passed The pull request description clearly relates to the changeset, detailing major UX improvements to the Bloblang playground, navigation fixes, and export functionality that align with the code changes across multiple files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/css/bloblang-playground.css (1)

506-516: Scope responsive selectors to the playground container.

In the 1024px media query, .output-section and .button-bar are unscoped, so any page using those class names will inherit these layout rules. Prefix them with .bloblang-playground to prevent cross-page style bleed.

🛠️ Suggested fix
-  .output-section {
+  .bloblang-playground .output-section {
     flex: 1 1 100%;
   }

-  .button-bar {
+  .bloblang-playground .button-bar {
     align-items: flex-start;
   }

-  .button-bar .choices {
+  .bloblang-playground .button-bar .choices {
     width: 100%;
   }
🤖 Fix all issues with AI agents
In `@src/js/01-nav.js`:
- Around line 28-31: The restore path calls hideNav(null, true) which leads to
trapEvent(e) being invoked with e === null and causes e.stopPropagation() to
throw; update the trapEvent function to guard against a null/undefined event
(e.g., if (!e) return) before calling e.stopPropagation() / e.preventDefault(),
so restoring navCollapsed via hideNav(null, true) won't raise a TypeError;
reference trapEvent and hideNav to locate the change.

In `@src/partials/bloblang-playground.hbs`:
- Around line 651-659: The suppression logic in getContextCompletions() returns
{ suppressAll: true } but bloblangCompleter only inspects context.type, so
completions still show inside string literals; update getContextCompletions() to
return { type: 'none' } (or set context.type = 'none') when detecting an odd
number of quotes, or alternatively modify bloblangCompleter to respect
suppressAll by checking context.suppressAll before offering suggestions; locate
the string-detection block (the beforeCursor/stringMatch/quotesBefore logic) and
make the return shape or the completer's check consistent with
bloblangCompleter's expected context.type.
- Around line 484-505: The current fetchConnectCompletions flow returns
immediately when the GitHub "latest" release request succeeds even if
tryFetchConnectJSON(version) returns an empty array, skipping fallbackVersions;
change the logic in fetchConnectCompletions so that after obtaining
release.tag_name and calling tryFetchConnectJSON(version) you capture its result
in a variable and only return it if result.length > 0, otherwise continue to the
fallback loop (and optionally log that the latest release had no JSON) so
fallbackVersions are attempted; refer to fetchConnectCompletions, the
releasesResp/release.tag_name usage, and tryFetchConnectJSON to find and update
the code path.
🧹 Nitpick comments (2)
src/css/nav.css (1)

48-50: Redundant opacity rule.

The .nav-collapse.collapsed rule sets opacity: 0.6, but this is already the base opacity for .nav-collapse defined on line 34. This rule has no effect unless there's JavaScript or another CSS rule that modifies the opacity elsewhere.

♻️ Consider removing redundant rule or clarifying intent

If this is intended as documentation for the collapsed state, consider adding a comment. Otherwise, remove:

-.nav-collapse.collapsed {
-  opacity: 0.6;
-}
src/css/bloblang-playground.css (1)

623-633: Consolidate duplicate .editor-help-icon styles.

There are two separate blocks defining .editor-help-icon (Line 623-633 and Line 861-869). Keeping one source of truth avoids conflicting tweaks later.

♻️ One possible cleanup
-/* Editor help icons */
-.editor-help-icon {
-  font-size: 12px;
-  opacity: 0.5;
-  cursor: help;
-  margin-left: 4px;
-  transition: opacity 0.2s ease;
-}
-
-.editor-help-icon:hover {
-  opacity: 1;
-}

Also applies to: 861-869

- Add curly braces after if conditions in nav.js
- Use window.localStorage instead of bare localStorage
- Add space before function parentheses in on-this-page.js
- Remove extra empty lines in bloblang-playground.css
- Guard trapEvent against null/undefined events to prevent TypeError when
  restoring nav collapse state via hideNav(null, true)
- Fix string literal detection to return { type: 'none' } instead of
  { suppressAll: true } so autocomplete properly suppresses inside strings
- Check if GitHub latest release returns empty completions before returning,
  allowing fallback versions to be attempted
- Add .bloblang-playground prefix to .output-section, .button-bar in 1024px media query
- Add .bloblang-playground prefix to .shortcuts-content, .share-modal-content, .notification in 768px media query
- Add .bloblang-playground prefix to playground-tip, try-example-button, dismiss-tip, editor-help-icon at root level
- Remove duplicate editor-help-icon definition (lines 859-868)

Prevents style bleeding to other pages that might use these common class names.
- Scope notification and validation indicator classes
- Scope input-format-selector and editor state classes
- Scope copy-output-button
- Scope shortcuts-overlay, shortcuts-content, close-shortcuts, shortcuts-list
- Scope share-modal, share-modal-content, share-url-container
- Scope ALL ACE editor autocomplete selectors (48 selectors total)

Prevents any style bleeding to other pages. All 1229 lines of CSS are now properly contained within the .bloblang-playground component scope.
@JakeSCahill JakeSCahill changed the title Bloblang enhancements Bloblang playground enhancements Jan 23, 2026
@JakeSCahill JakeSCahill requested a review from a team January 23, 2026 16:51
@micheleRP
Copy link

wow, nice! Will people who signed up for notifications get an email about this update?

@micheleRP
Copy link

approving since I can see nice fixes, but I don't understand the Choose an example dropdown. And I'm guessing the Ask AI just isn't rigged up, but it doesn't work in the preview.

Copy link

@micheleRP micheleRP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@JakeSCahill
Copy link
Contributor Author

wow, nice! Will people who signed up for notifications get an email about this update?

We will send one out for sure 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants