← back to drharunyuksel__datachat

Function bodies 1,453 total

All specs Real LLM only Function bodies
example_default_usage function · python · L15-L24 (10 LOC)
examples/chromadb_gpu_example.py
def example_default_usage():
    """Example 1: Use default embedding function (no GPU, no sentence-transformers required)"""
    print("Example 1: Default ChromaDB embedding (CPU-only, no extra dependencies)")

    memory = ChromaAgentMemory(
        persist_directory="./chroma_memory_default"
    )

    print("✓ ChromaAgentMemory created with default embedding function")
    print()
example_auto_gpu function · python · L27-L44 (18 LOC)
examples/chromadb_gpu_example.py
def example_auto_gpu():
    """Example 2: Automatic GPU detection with SentenceTransformers"""
    print("Example 2: Automatic GPU detection")

    # Detect the best available device
    device = get_device()
    print(f"Detected device: {device}")

    # Create embedding function with automatic device selection
    embedding_fn = create_sentence_transformer_embedding_function()

    memory = ChromaAgentMemory(
        persist_directory="./chroma_memory_gpu",
        embedding_function=embedding_fn
    )

    print(f"✓ ChromaAgentMemory created with SentenceTransformer on {device}")
    print()
example_explicit_cuda function · python · L47-L60 (14 LOC)
examples/chromadb_gpu_example.py
def example_explicit_cuda():
    """Example 3: Explicitly use CUDA"""
    print("Example 3: Explicitly request CUDA")

    # Explicitly request CUDA
    embedding_fn = create_sentence_transformer_embedding_function(device="cuda")

    memory = ChromaAgentMemory(
        persist_directory="./chroma_memory_cuda",
        embedding_function=embedding_fn
    )

    print("✓ ChromaAgentMemory created with SentenceTransformer on CUDA")
    print()
example_custom_model_gpu function · python · L63-L78 (16 LOC)
examples/chromadb_gpu_example.py
def example_custom_model_gpu():
    """Example 4: Use a larger model with GPU"""
    print("Example 4: Custom model with GPU acceleration")

    # Use a larger, more accurate model with GPU
    embedding_fn = create_sentence_transformer_embedding_function(
        model_name="sentence-transformers/all-mpnet-base-v2"
    )

    memory = ChromaAgentMemory(
        persist_directory="./chroma_memory_large",
        embedding_function=embedding_fn
    )

    print("✓ ChromaAgentMemory created with all-mpnet-base-v2 model")
    print()
example_manual_chromadb function · python · L81-L100 (20 LOC)
examples/chromadb_gpu_example.py
def example_manual_chromadb():
    """Example 5: Manually configure ChromaDB embedding function"""
    print("Example 5: Manual ChromaDB embedding function configuration")

    from chromadb.utils import embedding_functions

    # Manually create and configure the embedding function
    device = get_device()
    embedding_fn = embedding_functions.SentenceTransformerEmbeddingFunction(
        model_name="sentence-transformers/all-MiniLM-L6-v2",
        device=device
    )

    memory = ChromaAgentMemory(
        persist_directory="./chroma_memory_manual",
        embedding_function=embedding_fn
    )

    print(f"✓ ChromaAgentMemory created with manual configuration on {device}")
    print()
SQLExecutionArgs class · python · L20-L22 (3 LOC)
examples/transform_args_example.py
class SQLExecutionArgs(BaseModel):
    query: str
    database: str = "default"
SQLExecutionTool class · python · L25-L42 (18 LOC)
examples/transform_args_example.py
class SQLExecutionTool(Tool[SQLExecutionArgs]):
    @property
    def name(self) -> str:
        return "execute_sql"

    @property
    def description(self) -> str:
        return "Execute a SQL query against the database"

    def get_args_schema(self):
        return SQLExecutionArgs

    async def execute(self, context: ToolContext, args: SQLExecutionArgs) -> ToolResult:
        # Execute the SQL query (implementation not shown)
        return ToolResult(
            success=True,
            result_for_llm=f"Executed query: {args.query[:50]}...",
        )
Repobility (the analyzer behind this table) · https://repobility.com
execute method · python · L37-L42 (6 LOC)
examples/transform_args_example.py
    async def execute(self, context: ToolContext, args: SQLExecutionArgs) -> ToolResult:
        # Execute the SQL query (implementation not shown)
        return ToolResult(
            success=True,
            result_for_llm=f"Executed query: {args.query[:50]}...",
        )
RLSToolRegistry class · python · L45-L96 (52 LOC)
examples/transform_args_example.py
class RLSToolRegistry(ToolRegistry):
    """Custom ToolRegistry that applies row-level security to SQL queries."""

    async def transform_args(
        self,
        tool: Tool,
        args,
        user: User,
        context: ToolContext,
    ) -> Union[SQLExecutionArgs, ToolRejection]:
        """Apply row-level security transformation to SQL queries."""

        # Only transform SQL execution tools
        if tool.name == "execute_sql" and isinstance(args, SQLExecutionArgs):
            original_query = args.query.strip()

            # Example 1: Reject queries that try to access restricted tables
            if "restricted_table" in original_query.lower():
                return ToolRejection(
                    reason="Access to 'restricted_table' is not permitted for your user group"
                )

            # Example 2: Apply RLS by modifying the WHERE clause
            # This is a simplified example - real RLS would be more sophisticated
            if "SELECT" in 
transform_args method · python · L48-L96 (49 LOC)
examples/transform_args_example.py
    async def transform_args(
        self,
        tool: Tool,
        args,
        user: User,
        context: ToolContext,
    ) -> Union[SQLExecutionArgs, ToolRejection]:
        """Apply row-level security transformation to SQL queries."""

        # Only transform SQL execution tools
        if tool.name == "execute_sql" and isinstance(args, SQLExecutionArgs):
            original_query = args.query.strip()

            # Example 1: Reject queries that try to access restricted tables
            if "restricted_table" in original_query.lower():
                return ToolRejection(
                    reason="Access to 'restricted_table' is not permitted for your user group"
                )

            # Example 2: Apply RLS by modifying the WHERE clause
            # This is a simplified example - real RLS would be more sophisticated
            if "SELECT" in original_query.upper() and "users" in original_query.lower():
                # Add a WHERE clause to filter by user
example_usage function · python · L100-L150 (51 LOC)
examples/transform_args_example.py
async def example_usage():
    """Demonstrate using the RLS-enabled ToolRegistry."""
    from vanna.capabilities.agent_memory import AgentMemory

    # Create registry and register tool
    registry = RLSToolRegistry()
    sql_tool = SQLExecutionTool()
    registry.register_local_tool(sql_tool, access_groups=[])

    # Create a user with organization context
    user = User(
        user_id="user123",
        metadata={"organization_id": 42}
    )

    # Create tool context
    context = ToolContext(
        user=user,
        conversation_id="conv123",
        request_id="req123",
        agent_memory=AgentMemory(),
    )

    # Example 1: Query that will be transformed with RLS
    from vanna.core.tool import ToolCall

    tool_call = ToolCall(
        id="call1",
        name="execute_sql",
        arguments={
            "query": "SELECT * FROM users",
            "database": "production"
        }
    )

    result = await registry.execute(tool_call, context)
    print(f"Result: {
extractVersionFromPyproject function · javascript · L17-L24 (8 LOC)
frontends/webcomponent/scripts/sync-version.js
function extractVersionFromPyproject(content) {
  // Match: version = "2.0.0"
  const match = content.match(/^version\s*=\s*"([^"]+)"/m);
  if (!match) {
    throw new Error('Could not find version in pyproject.toml');
  }
  return match[1];
}
updatePackageJsonVersion function · javascript · L26-L39 (14 LOC)
frontends/webcomponent/scripts/sync-version.js
function updatePackageJsonVersion(packageJsonPath, newVersion) {
  const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
  const oldVersion = packageJson.version;

  packageJson.version = newVersion;

  fs.writeFileSync(
    packageJsonPath,
    JSON.stringify(packageJson, null, 2) + '\n',
    'utf8'
  );

  return { oldVersion, newVersion };
}
main function · javascript · L41-L61 (21 LOC)
frontends/webcomponent/scripts/sync-version.js
function main() {
  try {
    // Read pyproject.toml
    const pyprojectContent = fs.readFileSync(PYPROJECT_PATH, 'utf8');
    const version = extractVersionFromPyproject(pyprojectContent);

    // Update package.json
    const { oldVersion, newVersion } = updatePackageJsonVersion(PACKAGE_JSON_PATH, version);

    if (oldVersion !== newVersion) {
      console.log(`✓ Version synced: ${oldVersion} → ${newVersion}`);
    } else {
      console.log(`✓ Version already in sync: ${newVersion}`);
    }

    process.exit(0);
  } catch (error) {
    console.error(`✗ Version sync failed: ${error.message}`);
    process.exit(1);
  }
}
PlotlyChart class · typescript · L33-L195 (163 LOC)
frontends/webcomponent/src/components/plotly-chart.ts
export class PlotlyChart extends LitElement {
  static styles = [
    vannaDesignTokens,
    css`
      :host {
        display: block;
        font-family: var(--vanna-font-family-default);
        width: 100%;
        height: 100%;
      }

      .plotly-div {
        width: 100%;
        min-height: 400px;
      }

      /* Plotly layering fix for Shadow DOM */
      .plotly-div,
      .plotly-div .js-plotly-plot,
      .plotly-div .plot-container,
      .plotly-div .svg-container {
        position: relative;
        width: 100%;
        height: 100%;
      }

      .plotly-div svg.main-svg {
        position: absolute;
        top: 0;
        left: 0;
      }

      .plotly-div .hoverlayer {
        pointer-events: none;
      }

      .error-message {
        padding: var(--vanna-space-4);
        color: var(--vanna-accent-negative-default);
        text-align: center;
        font-style: italic;
      }

      .loading-message {
        padding: var(--vanna-space-4);
        col
About: code-quality intelligence by Repobility · https://repobility.com
firstUpdated method · typescript · L95-L99 (5 LOC)
frontends/webcomponent/src/components/plotly-chart.ts
  firstUpdated() {
    this.plotlyDiv = this.shadowRoot?.querySelector('.plotly-div') as HTMLElement;
    this._renderChart();
    this._setupResizeObserver();
  }
disconnectedCallback method · typescript · L101-L104 (4 LOC)
frontends/webcomponent/src/components/plotly-chart.ts
  disconnectedCallback() {
    super.disconnectedCallback();
    this.resizeObserver?.disconnect();
  }
_setupResizeObserver method · typescript · L106-L117 (12 LOC)
frontends/webcomponent/src/components/plotly-chart.ts
  private _setupResizeObserver() {
    if (!this.plotlyDiv) return;

    this.resizeObserver = new ResizeObserver(() => {
      if (this.plotlyDiv && this.data.length > 0) {
        const width = this.plotlyDiv.offsetWidth;
        Plotly.relayout(this.plotlyDiv, { width });
      }
    });

    this.resizeObserver.observe(this.plotlyDiv);
  }
updated method · typescript · L119-L123 (5 LOC)
frontends/webcomponent/src/components/plotly-chart.ts
  updated(changedProperties: Map<string | number | symbol, unknown>) {
    if (changedProperties.has('data') || changedProperties.has('layout') || changedProperties.has('theme')) {
      this._renderChart();
    }
  }
_getDefaultLayout method · typescript · L125-L158 (34 LOC)
frontends/webcomponent/src/components/plotly-chart.ts
  private _getDefaultLayout(): PlotlyLayout {
    const isDark = this.theme === 'dark';

    // Start with layout from backend (which may include white background)
    const mergedLayout = {
      ...this.layout,
      // Only add font/modebar if not already set by backend
      font: this.layout.font || {
        family: 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
        color: isDark ? 'rgb(242, 244, 247)' : 'rgb(17, 24, 39)',
        size: 12
      },
      modebar: this.layout.modebar || {
        bgcolor: isDark ? 'rgba(21, 26, 38, 0.8)' : 'rgba(255, 255, 255, 0.8)',
        color: isDark ? 'rgb(177, 186, 196)' : 'rgb(75, 85, 99)',
        activecolor: isDark ? 'rgb(242, 244, 247)' : 'rgb(17, 24, 39)',
        orientation: 'h'
      },
      // Set explicit dimensions for Shadow DOM compatibility
      autosize: false,
      width: this.layout.width || undefined,
      height: this.layout.height || 400,
    };

    // If backend 
_getDefaultConfig method · typescript · L160-L166 (7 LOC)
frontends/webcomponent/src/components/plotly-chart.ts
  private _getDefaultConfig() {
    return {
      responsive: true,
      displayModeBar: false,
      ...this.config
    };
  }
_renderChart method · typescript · L168-L182 (15 LOC)
frontends/webcomponent/src/components/plotly-chart.ts
  private async _renderChart() {
    if (!this.plotlyDiv || this.loading || this.error || this.data.length === 0) {
      return;
    }

    try {
      const layout = this._getDefaultLayout();
      const config = this._getDefaultConfig();

      await Plotly.newPlot(this.plotlyDiv, this.data, layout, config);
    } catch (err) {
      this.error = err instanceof Error ? err.message : 'Failed to render chart';
      console.error('Plotly chart error:', err);
    }
  }
render method · typescript · L184-L194 (11 LOC)
frontends/webcomponent/src/components/plotly-chart.ts
  render() {
    return html`
      ${this.loading ? html`
        <div class="loading-message">Loading chart...</div>
      ` : this.error ? html`
        <div class="error-message">Error: ${this.error}</div>
      ` : html`
        <div class="plotly-div"></div>
      `}
    `;
  }
Want fix-PRs on findings? Install Repobility's GitHub App · github.com/apps/repobility-bot
RichCard class · typescript · L12-L309 (298 LOC)
frontends/webcomponent/src/components/rich-card.ts
export class RichCard extends LitElement {
  static styles = [
    vannaDesignTokens,
    css`
      :host {
        display: block;
        margin-bottom: var(--vanna-space-4);
        font-family: var(--vanna-font-family-default);
      }

      .card {
        border: 1px solid var(--vanna-outline-default);
        border-radius: var(--vanna-border-radius-lg);
        background: var(--vanna-background-default);
        box-shadow: var(--vanna-shadow-sm);
        overflow: hidden;
        transition: box-shadow var(--vanna-duration-200) ease;
      }

      .card:hover {
        box-shadow: var(--vanna-shadow-md);
      }

      .card-header {
        display: flex;
        align-items: center;
        padding: var(--vanna-space-4) var(--vanna-space-5);
        background: var(--vanna-background-higher);
        border-bottom: 1px solid var(--vanna-outline-default);
        gap: var(--vanna-space-3);
      }

      .card-header.collapsible {
        cursor: pointer;
      }

      .
_toggleCollapsed method · typescript · L219-L223 (5 LOC)
frontends/webcomponent/src/components/rich-card.ts
  private _toggleCollapsed() {
    if (this.collapsible) {
      this.collapsed = !this.collapsed;
    }
  }
_renderMarkdown method · typescript · L225-L309 (85 LOC)
frontends/webcomponent/src/components/rich-card.ts
  private _renderMarkdown(text: string): string {
    // Simple markdown rendering - basic formatting
    return text
      .replace(/^### (.*$)/gm, '<h3>$1</h3>')
      .replace(/^## (.*$)/gm, '<h2>$1</h2>')
      .replace(/^# (.*$)/gm, '<h1>$1</h1>')
      .replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
      .replace(/\*(.*?)\*/g, '<em>$1</em>')
      .replace(/`([^`]+)`/g, '<code>$1</code>')
      .replace(/^- (.*$)/gm, '<li>$1</li>')
      .replace(/(<li>.*<\/li>)/s, '<ul>$1</ul>')
      .replace(/\n\n/g, '</p><p>')
      .replace(/^(?!<[h|u|l|p])(.+)$/gm, '<p>$1</p>');
  }

  render() {
    const contentHtml = this.markdown
      ? html`<div class="card-content ${this.collapsed ? 'collapsed' : ''}" .innerHTML=${this._renderMarkdown(this.content)}></div>`
      : html`<div class="card-content ${this.collapsed ? 'collapsed' : ''}">${this.content}</div>`;

    return html`
      <div class="card">
        <div class="card-header ${this.collapsible ? 'collapsible' : ''}"
          
render method · typescript · L240-L272 (33 LOC)
frontends/webcomponent/src/components/rich-card.ts
  render() {
    const contentHtml = this.markdown
      ? html`<div class="card-content ${this.collapsed ? 'collapsed' : ''}" .innerHTML=${this._renderMarkdown(this.content)}></div>`
      : html`<div class="card-content ${this.collapsed ? 'collapsed' : ''}">${this.content}</div>`;

    return html`
      <div class="card">
        <div class="card-header ${this.collapsible ? 'collapsible' : ''}"
             @click=${this._toggleCollapsed}>
          ${this.icon ? html`<span class="card-icon">${this.icon}</span>` : ''}
          <div class="card-title-section">
            <h3 class="card-title">${this.title}</h3>
            ${this.subtitle ? html`<p class="card-subtitle">${this.subtitle}</p>` : ''}
          </div>
          ${this.status ? html`<span class="card-status status-${this.status}">${this.status}</span>` : ''}
          ${this.collapsible ? html`
            <button class="card-toggle">${this.collapsed ? '▶' : '▼'}</button>
          ` : ''}
        </div>
        ${cont
_handleAction method · typescript · L274-L302 (29 LOC)
frontends/webcomponent/src/components/rich-card.ts
  private async _handleAction(action: string) {
    console.log('🔘 Card action button clicked (rich-card)');
    console.log('   Action:', action);

    // Dispatch event for any listeners
    this.dispatchEvent(new CustomEvent('card-action', {
      detail: { action },
      bubbles: true,
      composed: true
    }));

    // Also directly send to vanna-chat
    const vannaChat = document.querySelector('vanna-chat') as any;
    if (vannaChat && typeof vannaChat.sendMessage === 'function') {
      console.log('   Found vanna-chat, sending message...');
      try {
        const success = await vannaChat.sendMessage(action);
        if (success) {
          console.log('   ✅ Action sent successfully');
        } else {
          console.error('   ❌ Failed to send action');
        }
      } catch (error) {
        console.error('   ❌ Error sending action:', error);
      }
    } else {
      console.warn('   ⚠️ vanna-chat component not found or sendMessage not available');
    }
  }
ensureRichComponentStyles function · typescript · L55-L69 (15 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
function ensureRichComponentStyles(container: HTMLElement): void {
  const doc = container.ownerDocument;
  if (!doc) {
    return;
  }

  if (container.querySelector(`style[${RICH_COMPONENT_STYLE_ATTR}]`)) {
    return;
  }

  const styleEl = doc.createElement('style');
  styleEl.setAttribute(RICH_COMPONENT_STYLE_ATTR, 'true');
  styleEl.textContent = richComponentStyleText;
  container.prepend(styleEl);
}
BaseComponentRenderer class · typescript · L89-L102 (14 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
export abstract class BaseComponentRenderer implements ComponentRenderer {
  abstract render(component: RichComponent): HTMLElement;

  update(element: HTMLElement, component: RichComponent, _updates?: Record<string, any>): void {
    // Default implementation - re-render completely
    const newElement = this.render(component);
    element.parentNode?.replaceChild(newElement, element);
  }

  remove(element: HTMLElement): void {
    element.remove();
  }

}
update method · typescript · L92-L96 (5 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
  update(element: HTMLElement, component: RichComponent, _updates?: Record<string, any>): void {
    // Default implementation - re-render completely
    const newElement = this.render(component);
    element.parentNode?.replaceChild(newElement, element);
  }
Repobility · open methodology · https://repobility.com/research/
remove method · typescript · L98-L100 (3 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
  remove(element: HTMLElement): void {
    element.remove();
  }
CardComponentRenderer class · typescript · L105-L247 (143 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
export class CardComponentRenderer extends BaseComponentRenderer {
  render(component: RichComponent): HTMLElement {
    console.log('🎴 CardComponentRenderer.render() called', {
      componentId: component.id,
      componentData: component.data,
      actions: component.data?.actions
    });

    const card = document.createElement('div');
    card.className = 'rich-component rich-card';
    card.dataset.componentId = component.id;

    const { title, content, subtitle, icon, status, actions = [], collapsible, collapsed } = component.data;

    console.log('🎴 Extracted actions:', actions, 'Length:', actions?.length);

    card.innerHTML = `
      <div class="card-header ${collapsible ? 'collapsible' : ''}">
        ${icon ? `<span class="card-icon">${icon}</span>` : ''}
        <div class="card-title-section">
          <h3 class="card-title">${title}</h3>
          ${subtitle ? `<p class="card-subtitle">${subtitle}</p>` : ''}
        </div>
        ${status ? `<span class="card-stat
render method · typescript · L106-L218 (113 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
  render(component: RichComponent): HTMLElement {
    console.log('🎴 CardComponentRenderer.render() called', {
      componentId: component.id,
      componentData: component.data,
      actions: component.data?.actions
    });

    const card = document.createElement('div');
    card.className = 'rich-component rich-card';
    card.dataset.componentId = component.id;

    const { title, content, subtitle, icon, status, actions = [], collapsible, collapsed } = component.data;

    console.log('🎴 Extracted actions:', actions, 'Length:', actions?.length);

    card.innerHTML = `
      <div class="card-header ${collapsible ? 'collapsible' : ''}">
        ${icon ? `<span class="card-icon">${icon}</span>` : ''}
        <div class="card-title-section">
          <h3 class="card-title">${title}</h3>
          ${subtitle ? `<p class="card-subtitle">${subtitle}</p>` : ''}
        </div>
        ${status ? `<span class="card-status status-${status}">${status}</span>` : ''}
        ${collapsible 
update method · typescript · L220-L246 (27 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
  update(element: HTMLElement, component: RichComponent, updates?: Record<string, any>): void {
    if (!updates) return super.update(element, component);

    // Optimized updates for common properties
    if (updates.title) {
      const titleEl = element.querySelector('.card-title');
      if (titleEl) titleEl.textContent = updates.title;
    }

    if (updates.content) {
      const contentEl = element.querySelector('.card-content');
      if (contentEl) contentEl.innerHTML = updates.content;
    }

    if (updates.status) {
      const statusEl = element.querySelector('.card-status');
      if (statusEl) {
        statusEl.className = `card-status status-${updates.status}`;
        statusEl.textContent = updates.status;
      }
    }

    // For complex updates, fall back to full re-render
    if (updates.actions || updates.collapsible) {
      super.update(element, component);
    }
  }
TaskListComponentRenderer class · typescript · L250-L318 (69 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
export class TaskListComponentRenderer extends BaseComponentRenderer {
  render(component: RichComponent): HTMLElement {
    const container = document.createElement('div');
    container.className = 'rich-component rich-task-list';
    container.dataset.componentId = component.id;

    const { title, tasks = [], show_progress, show_timestamps } = component.data;

    const completedTasks = tasks.filter((task: any) => task.status === 'completed').length;
    const progress = tasks.length > 0 ? (completedTasks / tasks.length) * 100 : 0;

    container.innerHTML = `
      <div class="task-list-header">
        <h3 class="task-list-title">${title}</h3>
        ${show_progress ? `
          <div class="task-list-progress">
            <span class="progress-text">${completedTasks}/${tasks.length} completed</span>
            <div class="progress-bar">
              <div class="progress-fill" style="width: ${progress}%"></div>
            </div>
          </div>
        ` : ''}
      </div>
render method · typescript · L251-L280 (30 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
  render(component: RichComponent): HTMLElement {
    const container = document.createElement('div');
    container.className = 'rich-component rich-task-list';
    container.dataset.componentId = component.id;

    const { title, tasks = [], show_progress, show_timestamps } = component.data;

    const completedTasks = tasks.filter((task: any) => task.status === 'completed').length;
    const progress = tasks.length > 0 ? (completedTasks / tasks.length) * 100 : 0;

    container.innerHTML = `
      <div class="task-list-header">
        <h3 class="task-list-title">${title}</h3>
        ${show_progress ? `
          <div class="task-list-progress">
            <span class="progress-text">${completedTasks}/${tasks.length} completed</span>
            <div class="progress-bar">
              <div class="progress-fill" style="width: ${progress}%"></div>
            </div>
          </div>
        ` : ''}
      </div>
      <div class="task-list-items">
        ${tasks.map((task: any) => 
renderTask method · typescript · L282-L308 (27 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
  private renderTask(task: any, showTimestamps: boolean): string {
    const statusIcon = this.getStatusIcon(task.status);
    const progressBar = task.progress !== null && task.progress !== undefined ? `
      <div class="task-progress">
        <div class="task-progress-bar">
          <div class="task-progress-fill" style="width: ${task.progress * 100}%"></div>
        </div>
        <span class="task-progress-text">${Math.round(task.progress * 100)}%</span>
      </div>
    ` : '';

    return `
      <div class="task-item status-${task.status}" data-task-id="${task.id}">
        <div class="task-icon">${statusIcon}</div>
        <div class="task-content">
          <div class="task-title">${task.title}</div>
          ${task.description ? `<div class="task-description">${task.description}</div>` : ''}
          ${progressBar}
          ${showTimestamps && task.created_at ? `
            <div class="task-timestamp">
              Created: ${new Date(task.created_at).toLocaleString(
getStatusIcon method · typescript · L310-L317 (8 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
  private getStatusIcon(status: string): string {
    switch (status) {
      case 'completed': return '✅';
      case 'running': return '🔄';
      case 'failed': return '❌';
      default: return '⭕';
    }
  }
Repobility (the analyzer behind this table) · https://repobility.com
ProgressBarComponentRenderer class · typescript · L321-L374 (54 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
export class ProgressBarComponentRenderer extends BaseComponentRenderer {
  render(component: RichComponent): HTMLElement {
    const container = document.createElement('div');
    container.className = 'rich-component rich-progress-bar';
    container.dataset.componentId = component.id;

    const { value, label, show_percentage, status, animated } = component.data;
    const percentage = Math.round(value * 100);

    container.innerHTML = `
      <div class="progress-header">
        ${label ? `<span class="progress-label">${label}</span>` : ''}
        ${show_percentage ? `<span class="progress-percentage">${percentage}%</span>` : ''}
      </div>
      <div class="progress-track">
        <div class="progress-fill ${animated ? 'animated' : ''} ${status ? `status-${status}` : ''}"
             style="width: ${percentage}%"></div>
      </div>
    `;


    return container;
  }

  update(element: HTMLElement, component: RichComponent, updates?: Record<string, any>): void {
    if (!u
render method · typescript · L322-L343 (22 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
  render(component: RichComponent): HTMLElement {
    const container = document.createElement('div');
    container.className = 'rich-component rich-progress-bar';
    container.dataset.componentId = component.id;

    const { value, label, show_percentage, status, animated } = component.data;
    const percentage = Math.round(value * 100);

    container.innerHTML = `
      <div class="progress-header">
        ${label ? `<span class="progress-label">${label}</span>` : ''}
        ${show_percentage ? `<span class="progress-percentage">${percentage}%</span>` : ''}
      </div>
      <div class="progress-track">
        <div class="progress-fill ${animated ? 'animated' : ''} ${status ? `status-${status}` : ''}"
             style="width: ${percentage}%"></div>
      </div>
    `;


    return container;
  }
update method · typescript · L345-L373 (29 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
  update(element: HTMLElement, component: RichComponent, updates?: Record<string, any>): void {
    if (!updates) return super.update(element, component);

    if (updates.value !== undefined) {
      const fill = element.querySelector('.progress-fill') as HTMLElement;
      const percentage = Math.round(updates.value * 100);

      if (fill) {
        fill.style.width = `${percentage}%`;
      }

      const percentageEl = element.querySelector('.progress-percentage');
      if (percentageEl) {
        percentageEl.textContent = `${percentage}%`;
      }
    }

    if (updates.label) {
      const labelEl = element.querySelector('.progress-label');
      if (labelEl) labelEl.textContent = updates.label;
    }

    if (updates.status) {
      const fill = element.querySelector('.progress-fill') as HTMLElement;
      if (fill) {
        fill.className = fill.className.replace(/status-\w+/, `status-${updates.status}`);
      }
    }
  }
NotificationComponentRenderer class · typescript · L377-L432 (56 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
export class NotificationComponentRenderer extends BaseComponentRenderer {
  render(component: RichComponent): HTMLElement {
    const container = document.createElement('div');
    container.className = 'rich-component rich-notification';
    container.dataset.componentId = component.id;

    const { message, title, level = 'info', icon, dismissible, auto_dismiss, actions = [] } = component.data;

    const levelIcon = icon || this.getLevelIcon(level);
    const dismissButton = dismissible ? `
      <button class="notification-dismiss" onclick="this.parentElement.remove()">×</button>
    ` : '';

    container.innerHTML = `
      <div class="notification-content level-${level}">
        ${levelIcon ? `<span class="notification-icon">${levelIcon}</span>` : ''}
        <div class="notification-body">
          ${title ? `<div class="notification-title">${title}</div>` : ''}
          <div class="notification-message">${message}</div>
        </div>
        ${actions.length > 0 ? `
     
render method · typescript · L378-L421 (44 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
  render(component: RichComponent): HTMLElement {
    const container = document.createElement('div');
    container.className = 'rich-component rich-notification';
    container.dataset.componentId = component.id;

    const { message, title, level = 'info', icon, dismissible, auto_dismiss, actions = [] } = component.data;

    const levelIcon = icon || this.getLevelIcon(level);
    const dismissButton = dismissible ? `
      <button class="notification-dismiss" onclick="this.parentElement.remove()">×</button>
    ` : '';

    container.innerHTML = `
      <div class="notification-content level-${level}">
        ${levelIcon ? `<span class="notification-icon">${levelIcon}</span>` : ''}
        <div class="notification-body">
          ${title ? `<div class="notification-title">${title}</div>` : ''}
          <div class="notification-message">${message}</div>
        </div>
        ${actions.length > 0 ? `
          <div class="notification-actions">
            ${actions.map((action: 
setTimeout method · typescript · L412-L416 (5 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
      setTimeout(() => {
        if (container.parentElement) {
          container.remove();
        }
      }, component.data.auto_dismiss_delay);
getLevelIcon method · typescript · L423-L431 (9 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
  private getLevelIcon(level: string): string {
    switch (level) {
      case 'success': return '✅';
      case 'warning': return '⚠️';
      case 'error': return '❌';
      case 'info':
      default: return 'ℹ️';
    }
  }
StatusIndicatorComponentRenderer class · typescript · L435-L493 (59 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
export class StatusIndicatorComponentRenderer extends BaseComponentRenderer {
  render(component: RichComponent): HTMLElement {
    const container = document.createElement('div');
    container.className = 'rich-component rich-status-indicator';
    container.dataset.componentId = component.id;

    const { status, message, icon, pulse } = component.data;

    const statusIcon = icon || this.getStatusIcon(status);
    const pulseClass = pulse ? 'pulse' : '';

    container.innerHTML = `
      <div class="status-indicator-content status-${status} ${pulseClass}">
        <span class="status-icon">${statusIcon}</span>
        <span class="status-message">${message}</span>
      </div>
    `;


    return container;
  }

  private getStatusIcon(status: string): string {
    switch (status) {
      case 'loading': return '🔄';
      case 'success': return '✅';
      case 'warning': return '⚠️';
      case 'error': return '❌';
      default: return 'ℹ️';
    }
  }

  update(element: HTMLElem
About: code-quality intelligence by Repobility · https://repobility.com
render method · typescript · L436-L455 (20 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
  render(component: RichComponent): HTMLElement {
    const container = document.createElement('div');
    container.className = 'rich-component rich-status-indicator';
    container.dataset.componentId = component.id;

    const { status, message, icon, pulse } = component.data;

    const statusIcon = icon || this.getStatusIcon(status);
    const pulseClass = pulse ? 'pulse' : '';

    container.innerHTML = `
      <div class="status-indicator-content status-${status} ${pulseClass}">
        <span class="status-icon">${statusIcon}</span>
        <span class="status-message">${message}</span>
      </div>
    `;


    return container;
  }
getStatusIcon method · typescript · L457-L465 (9 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
  private getStatusIcon(status: string): string {
    switch (status) {
      case 'loading': return '🔄';
      case 'success': return '✅';
      case 'warning': return '⚠️';
      case 'error': return '❌';
      default: return 'ℹ️';
    }
  }
update method · typescript · L467-L492 (26 LOC)
frontends/webcomponent/src/components/rich-component-system.ts
  update(element: HTMLElement, component: RichComponent, updates?: Record<string, any>): void {
    if (!updates) return super.update(element, component);

    const content = element.querySelector('.status-indicator-content');
    if (content && updates.status) {
      content.className = content.className.replace(/status-\w+/, `status-${updates.status}`);
    }

    if (updates.pulse !== undefined) {
      const content = element.querySelector('.status-indicator-content');
      if (content) {
        if (updates.pulse) {
          content.classList.add('pulse');
        } else {
          content.classList.remove('pulse');
        }
      }
    }

    if (updates.message) {
      const messageEl = element.querySelector('.status-message');
      if (messageEl) {
        messageEl.textContent = updates.message;
      }
    }
  }
page 1 / 30next ›