abrignoni / abrignoni/iLEAPP

Feature: Structured Icon Support in Table Cells (No HTML Escaping)

オープン
#1,443 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
1.2k
フォーク
303
平均マージ
4時間 32分
マージ済み PR(30日)
216

説明

## Background

Some modules currently use **HTML escaping** in the legacy HTML output to render Feather icons in table cells. This works in the HTML renderer but is not something we want to bring into LAVA.

LAVA **will not allow raw HTML injection** from artifact output. Instead we should provide a structured way for modules to request icons in a cell so the renderer can safely convert that to a Feather icon.

Some important factors to consider in how we approach:

- avoid HTML escaping/hacks
- keep React rendering predictable
- keep parsing minimal during table rendering
- maintain a stable contract between modules and renderers

## Proposed Approach

Introduce a **structured icon object** that can be returned in table cells. The renderer can then convert this object into a Feather icon in LAVA.

Example cell value:

```json
{
"icon": {
"name": "alert-triangle",
"color": "#f59e0b",
"size": 16,
"strokeWidth": 2,
"position": "after",
"tooltip": "missing"
},
"content": "Missing attachment"
}
```
Renderer:
- Name is required, all others are optional
- Render the Feather icon
- Render content as text
- Default position is icon before text

This keeps icon rendering entirely within LAVA instead of embedding presentation logic in module output.

## API Helper

Modules should not construct this object directly. Instead we should provide a helper function in the core (ilapfuncs or similar).

Function:
```python
make_icon(icon_name, icon_props=None, content=None, content_type=None)
```

Example usage:
```python
make_icon(
"alert-triangle",
"Missing attachment",
{"color": "#f59e0b"}
)
```

Benefits:

- Centralized schema definition
- Allows future schema changes without breaking modules
- Keeps artifact code simpler
- Ensures consistent structure in output

## Optional Enhancement

With this schema structure, we could allow the content to be output with a designated type of its own from one of our other render types.

Example:
```json
{
"icon": {
"name": "alert-triangle",
"color": "#f59e0b",
"size": 16,
"strokeWidth": 2,
"position": "after",
"tooltip": "missed call"
},
"content": "+12345678900",
"contentType": "phonenumber"
}
```
Example usage:
```python
make_icon(
"alert-triangle",
"+12345678900",
{"color": "#f59e0b", "tooltip": "Missed Call"},
"phonenumber"
)
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。