Skip to content

feat: add shared utility classes to livetemplate.css#54

Merged
adnaan merged 1 commit intomainfrom
feature/shared-css
Apr 10, 2026
Merged

feat: add shared utility classes to livetemplate.css#54
adnaan merged 1 commit intomainfrom
feature/shared-css

Conversation

@adnaan
Copy link
Copy Markdown
Contributor

@adnaan adnaan commented Apr 10, 2026

Summary

  • Adds shared CSS utility classes to livetemplate.css that all example apps now depend on (see feat: comprehensive E2E test coverage, visual validation, and template fixes examples#55)
  • .container — narrow 640px container for focused single-purpose apps
  • .compact — compact buttons/inputs for inline use in tables and toolbars
  • .visually-hidden — accessible screen-reader-only utility
  • .inline — zero-margin form for table/toolbar embedding
  • .messages / .message / .message.mine — chat message list styling

These classes use Pico CSS variables (--pico-*) for consistent theming and are designed as reusable patterns across LiveTemplate apps.

Test plan

  • Verify CSS loads without errors
  • Verify example apps render correctly with CDN-served livetemplate.css
  • Check that .container overrides Pico's breakpoint-based max-width
  • Check that .compact reduces button/input padding appropriately
  • Check that chat .messages container scrolls and .message.mine highlights

🤖 Generated with Claude Code

Add layout (640px container), utility classes (.compact, .visually-hidden,
.inline), and chat message styles (.messages, .message, .message.mine) to
the shared CSS. Include livetemplate.css in package.json files array so it
ships with the npm package.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 10, 2026 15:09
@claude
Copy link
Copy Markdown

claude bot commented Apr 10, 2026

Review

Two issues worth addressing before merge:

1. .container is a breaking global override (high)

Overriding Pico's .container with a hardcoded max-width: 640px removes all responsive behavior for anyone using this class. Pico sets different max-widths per breakpoint — this clobbers all of them site-wide. Any app that uses .container expecting Pico's default responsive behavior will silently break.

Consider a scoped name like .container-narrow or use a CSS custom property override instead of redefining .container globally.

2. Chat-specific styles don't belong in a shared utility file (medium)

.messages, .message, and .message.mine are application-domain styles for a chat UI, not general-purpose utilities. They also have a fixed height: 400px which isn't responsive. These should live in the example app's own stylesheet rather than being published as part of the library.


.compact, .visually-hidden, and .inline are well-implemented and appropriate for a shared utility file. The package.json change to include livetemplate.css in the published files is correct.

@adnaan adnaan merged commit c12e1e8 into main Apr 10, 2026
8 checks passed
@adnaan adnaan deleted the feature/shared-css branch April 10, 2026 15:12
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds shared, Pico-themed CSS utility classes to livetemplate.css and ensures the stylesheet is published with the npm package so LiveTemplate example apps can depend on it via CDN/package install.

Changes:

  • Publish livetemplate.css in the npm package by adding it to package.json files.
  • Add shared utility/layout/chat styling classes to livetemplate.css (.container, .compact, .visually-hidden, .inline, .messages/.message).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
package.json Includes livetemplate.css in the published package artifacts.
livetemplate.css Adds reusable layout/utility/chat CSS classes using Pico custom properties.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread livetemplate.css
Comment on lines +26 to +31
/* === Layout === */

/* Narrow container for focused, single-purpose apps.
Overrides Pico's breakpoint-based max-width values. */
.container {
max-width: 640px;
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

The top-of-file docstring describes this stylesheet as only providing “CSS Custom Property Defaults” for lvt-fx:* directives, but the file now also defines general-purpose layout/utility/chat classes. Please update the file-level documentation (or add a short note near these new sections) so consumers understand this file includes opinionated utility selectors, not just directive variables.

Copilot uses AI. Check for mistakes.
Comment thread livetemplate.css
Comment on lines +29 to +31
Overrides Pico's breakpoint-based max-width values. */
.container {
max-width: 640px;
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

The comment says this .container rule “Overrides Pico's breakpoint-based max-width values”, but that’s only true if livetemplate.css is loaded after Pico (or if the rule wins specificity). Consider either documenting the required load order here, or making the override resilient (e.g., via higher specificity or !important) so the intended behavior is reliable.

Suggested change
Overrides Pico's breakpoint-based max-width values. */
.container {
max-width: 640px;
Reliably overrides Pico's breakpoint-based max-width values,
regardless of stylesheet load order. */
.container {
max-width: 640px !important;

Copilot uses AI. Check for mistakes.
Comment thread livetemplate.css
Comment on lines +30 to +37
.container {
max-width: 640px;
}

/* === Utility Classes === */

/* Compact buttons/inputs for inline use in tables and toolbars */
.compact {
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

These new selectors introduce very generic class names (.container, .compact, .inline, .messages, .message) into a published package stylesheet. Since most of the library’s public-facing surface is namespaced with lvt-* (e.g., lvt-fx:* in dom/directives.ts), these unprefixed utilities are more likely to collide with app/framework styles. Consider prefixing (e.g., .lvt-container, .lvt-compact, etc.) or scoping them under a LiveTemplate root selector to avoid unintended global overrides.

Copilot uses AI. Check for mistakes.
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.

2 participants