@iyulab/chat-components 0.6.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +15 -39
  3. package/dist/_virtual/{_@oxc-project_runtime@0.130.0/helpers → _@oxc-project_runtime@0.139.0/helpers/esm}/decorate.js +2 -2
  4. package/dist/_virtual/{_@oxc-project_runtime@0.130.0/helpers → _@oxc-project_runtime@0.139.0/helpers/esm}/decorateMetadata.js +2 -2
  5. package/dist/_virtual/_glob-assets_raw/alert-triangle-fill.svg.4cfc4305.js +4 -0
  6. package/dist/_virtual/_glob-assets_raw/arrows-sort.svg.dda43a85.js +4 -0
  7. package/dist/_virtual/_glob-assets_raw/code.svg.c69bc144.js +4 -0
  8. package/dist/_virtual/_glob-assets_raw/download.svg.bce82177.js +4 -0
  9. package/dist/_virtual/_glob-assets_raw/element-prompt.md.7047ffcc.js +4 -0
  10. package/dist/_virtual/_glob-assets_raw/external-link.svg.a9f7f02d.js +4 -0
  11. package/dist/_virtual/_glob-assets_raw/file-code.svg.0e706f93.js +4 -0
  12. package/dist/_virtual/_glob-assets_raw/file-music.svg.b9970203.js +4 -0
  13. package/dist/_virtual/_glob-assets_raw/file-spreadsheet.svg.8c03bdfa.js +4 -0
  14. package/dist/_virtual/_glob-assets_raw/file-text.svg.85bdd923.js +4 -0
  15. package/dist/_virtual/_glob-assets_raw/file-type-pdf.svg.bc12db6d.js +4 -0
  16. package/dist/_virtual/_glob-assets_raw/file-zip.svg.76dde660.js +4 -0
  17. package/dist/_virtual/_glob-assets_raw/file.svg.28f5d6f1.js +4 -0
  18. package/dist/_virtual/_glob-assets_raw/photo.svg.cc273cc1.js +4 -0
  19. package/dist/_virtual/_glob-assets_raw/player-stop-fill.svg.5378b752.js +4 -0
  20. package/dist/_virtual/_glob-assets_raw/send.svg.02326253.js +4 -0
  21. package/dist/_virtual/_glob-assets_raw/sort-ascending-letters.svg.14a3df67.js +4 -0
  22. package/dist/_virtual/_glob-assets_raw/sort-descending-letters.svg.3e03647c.js +4 -0
  23. package/dist/_virtual/_glob-assets_raw/video.svg.c183f03c.js +4 -0
  24. package/dist/_virtual/_glob-assets_raw/world.svg.cd9903c8.js +4 -0
  25. package/dist/components/UDataElement.d.ts +48 -0
  26. package/dist/components/UDataElement.js +80 -0
  27. package/dist/components/blocks/UCodeBlock.d.ts +0 -4
  28. package/dist/components/blocks/UCodeBlock.js +6 -12
  29. package/dist/components/{views/UView.d.ts → blocks/UElementBlock.d.ts} +18 -8
  30. package/dist/components/{views/UView.js → blocks/UElementBlock.js} +31 -21
  31. package/dist/components/{views/UView.styles.js → blocks/UElementBlock.styles.js} +1 -1
  32. package/dist/components/blocks/UFileBlock.d.ts +15 -5
  33. package/dist/components/blocks/UFileBlock.js +81 -68
  34. package/dist/components/blocks/UFileBlock.styles.js +86 -29
  35. package/dist/components/blocks/UMarkedBlock.d.ts +3 -1
  36. package/dist/components/blocks/UMarkedBlock.js +23 -18
  37. package/dist/components/blocks/URefBlock.js +2 -2
  38. package/dist/components/blocks/UTableBlock.d.ts +2 -2
  39. package/dist/components/blocks/UTableBlock.js +9 -8
  40. package/dist/components/blocks/UTableBlock.styles.js +1 -1
  41. package/dist/components/blocks/UTextBlock.d.ts +2 -0
  42. package/dist/components/blocks/UTextBlock.js +4 -5
  43. package/dist/components/message/UMessage.js +2 -2
  44. package/dist/components/prompt/UPrompt.d.ts +0 -5
  45. package/dist/components/prompt/UPrompt.js +18 -27
  46. package/dist/components/prompt/UPrompt.styles.js +9 -10
  47. package/dist/components/references/URefCard.d.ts +6 -5
  48. package/dist/components/references/URefCard.js +14 -11
  49. package/dist/components/references/URefCardGroup.js +2 -2
  50. package/dist/components/references/URefTag.js +5 -4
  51. package/dist/{components/views/UChartView.d.ts → components-extra/UChartBlock.d.ts} +4 -4
  52. package/dist/{components/views/UChartView.js → components-extra/UChartBlock.js} +22 -34
  53. package/dist/components-extra/UChartBlock.schema.d.ts +3 -0
  54. package/dist/components-extra/UChartBlock.schema.js +34 -0
  55. package/dist/{components/views/UChartView.styles.js → components-extra/UChartBlock.styles.js} +1 -1
  56. package/dist/{components/views/UImagesView.d.ts → components-extra/UImagesBlock.d.ts} +4 -4
  57. package/dist/{components/views/UImagesView.js → components-extra/UImagesBlock.js} +15 -15
  58. package/dist/components-extra/UImagesBlock.schema.d.ts +3 -0
  59. package/dist/components-extra/UImagesBlock.schema.js +31 -0
  60. package/dist/{components/views/UImagesView.styles.js → components-extra/UImagesBlock.styles.js} +5 -5
  61. package/dist/{components/views/UMapView.d.ts → components-extra/UMapBlock.d.ts} +4 -4
  62. package/dist/{components/views/UMapView.js → components-extra/UMapBlock.js} +18 -18
  63. package/dist/components-extra/UMapBlock.schema.d.ts +3 -0
  64. package/dist/components-extra/UMapBlock.schema.js +33 -0
  65. package/dist/{components/views/UMapView.styles.js → components-extra/UMapBlock.styles.js} +1 -1
  66. package/dist/{components/views/UVideoView.d.ts → components-extra/UVideoBlock.d.ts} +4 -4
  67. package/dist/{components/views/UVideoView.js → components-extra/UVideoBlock.js} +10 -10
  68. package/dist/components-extra/UVideoBlock.schema.d.ts +3 -0
  69. package/dist/components-extra/UVideoBlock.schema.js +28 -0
  70. package/dist/{components/views/UVideoView.styles.js → components-extra/UVideoBlock.styles.js} +1 -1
  71. package/dist/events/SendEvent.d.ts +0 -5
  72. package/dist/events/StopEvent.d.ts +0 -5
  73. package/dist/extra.d.ts +6 -0
  74. package/dist/extra.js +14 -0
  75. package/dist/index.d.ts +5 -17
  76. package/dist/index.js +6 -16
  77. package/dist/react/UCodeBlock.js +2 -2
  78. package/dist/react/UElementBlock.d.ts +9 -0
  79. package/dist/react/UElementBlock.js +10 -0
  80. package/dist/react/UFileBlock.js +2 -2
  81. package/dist/react/UImagesBlock.d.ts +9 -0
  82. package/dist/react/UImagesBlock.js +10 -0
  83. package/dist/react/UMapBlock.d.ts +9 -0
  84. package/dist/react/UMapBlock.js +10 -0
  85. package/dist/react/UMarkedBlock.js +2 -2
  86. package/dist/react/UMessage.js +2 -2
  87. package/dist/react/UPrompt.js +2 -2
  88. package/dist/react/URefBlock.js +2 -2
  89. package/dist/react/URefCard.js +2 -2
  90. package/dist/react/URefCardGroup.js +2 -2
  91. package/dist/react/URefTag.js +2 -2
  92. package/dist/react/UTableBlock.js +2 -2
  93. package/dist/react/UTextBlock.d.ts +1 -0
  94. package/dist/react/UTextBlock.js +5 -3
  95. package/dist/react/UVideoBlock.d.ts +9 -0
  96. package/dist/react/UVideoBlock.js +10 -0
  97. package/dist/react/index.d.ts +4 -11
  98. package/dist/react/index.js +4 -11
  99. package/dist/types/BlockItem.d.ts +1 -24
  100. package/dist/types/{JsonSchema.d.ts → Schema.d.ts} +13 -0
  101. package/dist/utilities/HtmlBuilder.d.ts +28 -0
  102. package/dist/utilities/HtmlBuilder.js +41 -0
  103. package/dist/utilities/PromptBuilder.d.ts +21 -0
  104. package/dist/utilities/PromptBuilder.js +60 -0
  105. package/dist/utilities/icons.d.ts +1 -0
  106. package/dist/utilities/icons.js +52 -0
  107. package/dist/utilities/sanitizers.d.ts +35 -0
  108. package/dist/utilities/sanitizers.js +75 -0
  109. package/package.json +18 -19
  110. package/skills/iyulab-chat-components/SKILL.md +18 -33
  111. package/skills/iyulab-chat-components/references/components/{chart-view.md → chart-block.md} +16 -12
  112. package/skills/iyulab-chat-components/references/components/code-block.md +1 -5
  113. package/skills/iyulab-chat-components/references/components/element-block.md +57 -0
  114. package/skills/iyulab-chat-components/references/components/file-block.md +22 -25
  115. package/skills/iyulab-chat-components/references/components/{images-view.md → images-block.md} +10 -10
  116. package/skills/iyulab-chat-components/references/components/{map-view.md → map-block.md} +9 -9
  117. package/skills/iyulab-chat-components/references/components/marked-block.md +5 -4
  118. package/skills/iyulab-chat-components/references/components/message.md +1 -2
  119. package/skills/iyulab-chat-components/references/components/prompt.md +12 -21
  120. package/skills/iyulab-chat-components/references/components/{video-view.md → video-block.md} +10 -10
  121. package/skills/iyulab-chat-components/references/extra-system.md +95 -0
  122. package/skills/iyulab-chat-components/references/types.md +17 -31
  123. package/skills/iyulab-chat-components/references/usage.md +13 -81
  124. package/skills/iyulab-chat-components/references/utilities/html-builder.md +35 -0
  125. package/skills/iyulab-chat-components/references/utilities/prompt-builder.md +73 -0
  126. package/dist/_virtual/_glob-assets_raw/intent-prompt.md.1907474e.js +0 -4
  127. package/dist/_virtual/_glob-assets_raw/view-prompt.md.e0dbcffe.js +0 -4
  128. package/dist/chart.d.ts +0 -1
  129. package/dist/chart.js +0 -2
  130. package/dist/components/blocks/UJsonBlock.d.ts +0 -49
  131. package/dist/components/blocks/UJsonBlock.js +0 -130
  132. package/dist/components/blocks/UJsonBlock.styles.js +0 -115
  133. package/dist/components/blocks/UThinkBlock.d.ts +0 -35
  134. package/dist/components/blocks/UThinkBlock.js +0 -87
  135. package/dist/components/blocks/UThinkBlock.styles.js +0 -74
  136. package/dist/components/blocks/UToolBlock.d.ts +0 -24
  137. package/dist/components/blocks/UToolBlock.js +0 -70
  138. package/dist/components/blocks/UToolBlock.styles.js +0 -66
  139. package/dist/components/buttons/UAttachButton.d.ts +0 -26
  140. package/dist/components/buttons/UAttachButton.js +0 -63
  141. package/dist/components/buttons/UAttachButton.styles.js +0 -14
  142. package/dist/components/buttons/UCopyButton.d.ts +0 -24
  143. package/dist/components/buttons/UCopyButton.js +0 -59
  144. package/dist/components/buttons/UCopyButton.styles.js +0 -18
  145. package/dist/components/buttons/UVoteButton.d.ts +0 -19
  146. package/dist/components/buttons/UVoteButton.js +0 -64
  147. package/dist/components/buttons/UVoteButton.styles.d.ts +0 -1
  148. package/dist/components/buttons/UVoteButton.styles.js +0 -19
  149. package/dist/components/intents/UQuestionIntent.d.ts +0 -22
  150. package/dist/components/intents/UQuestionIntent.js +0 -41
  151. package/dist/components/intents/UQuestionIntent.styles.d.ts +0 -1
  152. package/dist/components/intents/UQuestionIntent.styles.js +0 -43
  153. package/dist/components/views/UChartView.styles.d.ts +0 -1
  154. package/dist/components/views/UImagesView.styles.d.ts +0 -1
  155. package/dist/components/views/UMapView.styles.d.ts +0 -1
  156. package/dist/components/views/UVideoView.styles.d.ts +0 -1
  157. package/dist/components/views/UView.styles.d.ts +0 -1
  158. package/dist/events/AttachEvent.d.ts +0 -9
  159. package/dist/events/ChoiceEvent.d.ts +0 -9
  160. package/dist/react/UAttachButton.d.ts +0 -11
  161. package/dist/react/UAttachButton.js +0 -12
  162. package/dist/react/UCopyButton.d.ts +0 -9
  163. package/dist/react/UCopyButton.js +0 -10
  164. package/dist/react/UImagesView.d.ts +0 -9
  165. package/dist/react/UImagesView.js +0 -10
  166. package/dist/react/UJsonBlock.d.ts +0 -9
  167. package/dist/react/UJsonBlock.js +0 -10
  168. package/dist/react/UMapView.d.ts +0 -9
  169. package/dist/react/UMapView.js +0 -10
  170. package/dist/react/UQuestionIntent.d.ts +0 -11
  171. package/dist/react/UQuestionIntent.js +0 -12
  172. package/dist/react/UThinkBlock.d.ts +0 -9
  173. package/dist/react/UThinkBlock.js +0 -10
  174. package/dist/react/UToolBlock.d.ts +0 -9
  175. package/dist/react/UToolBlock.js +0 -10
  176. package/dist/react/UVideoView.d.ts +0 -9
  177. package/dist/react/UVideoView.js +0 -10
  178. package/dist/react/UView.d.ts +0 -9
  179. package/dist/react/UView.js +0 -10
  180. package/dist/react/UVoteButton.d.ts +0 -9
  181. package/dist/react/UVoteButton.js +0 -10
  182. package/dist/types/Intents.d.ts +0 -26
  183. package/dist/types/Intents.js +0 -30
  184. package/dist/types/JsonNode.d.ts +0 -20
  185. package/dist/types/Views.d.ts +0 -34
  186. package/dist/types/Views.js +0 -148
  187. package/dist/utilities/IntentPromptBuilder.d.ts +0 -40
  188. package/dist/utilities/IntentPromptBuilder.js +0 -95
  189. package/dist/utilities/ViewPromptBuilder.d.ts +0 -28
  190. package/dist/utilities/ViewPromptBuilder.js +0 -78
  191. package/dist/utilities/dom-agent/DOMAgent.d.ts +0 -74
  192. package/dist/utilities/dom-agent/DOMController.d.ts +0 -78
  193. package/dist/utilities/dom-agent/DOMPromptBuilder.d.ts +0 -54
  194. package/dist/utilities/dom-agent/DOMScanner.d.ts +0 -83
  195. package/dist/utilities/dom-agent/index.d.ts +0 -9
  196. package/dist/utilities/dom-agent/types.d.ts +0 -209
  197. package/skills/iyulab-chat-components/references/components/attach-button.md +0 -69
  198. package/skills/iyulab-chat-components/references/components/copy-button.md +0 -46
  199. package/skills/iyulab-chat-components/references/components/json-block.md +0 -41
  200. package/skills/iyulab-chat-components/references/components/question-intent.md +0 -75
  201. package/skills/iyulab-chat-components/references/components/think-block.md +0 -48
  202. package/skills/iyulab-chat-components/references/components/tool-block.md +0 -57
  203. package/skills/iyulab-chat-components/references/components/view.md +0 -51
  204. package/skills/iyulab-chat-components/references/components/vote-button.md +0 -60
  205. package/skills/iyulab-chat-components/references/utilities/intent-prompt-builder.md +0 -123
  206. package/skills/iyulab-chat-components/references/utilities/view-prompt-builder.md +0 -112
  207. /package/dist/components/{buttons/UCopyButton.styles.d.ts → blocks/UElementBlock.styles.d.ts} +0 -0
  208. /package/dist/{components/blocks/UJsonBlock.styles.d.ts → components-extra/UChartBlock.styles.d.ts} +0 -0
  209. /package/dist/{components/blocks/UThinkBlock.styles.d.ts → components-extra/UImagesBlock.styles.d.ts} +0 -0
  210. /package/dist/{components/blocks/UToolBlock.styles.d.ts → components-extra/UMapBlock.styles.d.ts} +0 -0
  211. /package/dist/{components/buttons/UAttachButton.styles.d.ts → components-extra/UVideoBlock.styles.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.7.1] - 2026-07-12
4
+
5
+ ### Fixed
6
+
7
+ - `u-ref-card`: no longer logs a spurious `Missing <script type="application/json">` console error on every render when driven by property bindings (the pattern `u-ref-block` itself uses). `URefCard` now overrides `UDataElement.load()` to skip JSON loading gracefully when neither a `data` argument nor a `<script type="application/json">` child is present; the script-payload path (used by `u-marked-block` reference tooltips via `URefCard.buildHTML`) is unaffected. Cards always rendered correctly — the error was cosmetic console noise, but it fired once per reference card per message in downstream consoles. (Reported by the Filer project.)
8
+ - `URefCard`'s redundant `error()` override was removed — since 0.7.0 the `UDataElement` base logs to the console without rendering an error card, so the override duplicated base behavior. Genuine load errors now log as `failed to load data for [u-ref-card]` instead of `Error in URefCard:`.
9
+
10
+ ### Added
11
+
12
+ - Browser-mode regression tests (vitest + playwright, matching the `@iyulab/components` test setup) covering both `u-ref-card` data paths and the `u-ref-block` sources rendering acceptance criteria.
13
+
14
+ ## [0.7.0] - 2026-07-07
15
+
16
+ ### Changed
17
+
18
+ - **Breaking:** The View system is renamed to the **Extra** system, rendered via `u-element-block`, and the 4 built-in extras (chart/images/map/video) are no longer part of the core entrypoint:
19
+ - `u-view` → `u-element-block` (`UElementBlock`, in `components/blocks/`)
20
+ - `u-chart-view`/`u-images-view`/`u-map-view`/`u-video-view` → `u-chart-block`/`u-images-block`/`u-map-block`/`u-video-block` (`UChartBlock`/`UImagesBlock`/`UMapBlock`/`UVideoBlock`, in the new `components-extra/` folder, each with a co-located `{Name}Block.schema.ts`)
21
+ - `view-json` fenced code blocks → `block-json`
22
+ - `ViewPromptBuilder` → `ElementPromptBuilder`; the `PresetView`/`ViewDefinition` preset bit-flag system is dropped — each built-in extra defines its own `ElementSchema` in its `.schema.ts` file instead of a central preset map. `types/Views.ts` and `types/JsonSchema.ts` are merged into `types/Schema.ts`.
23
+ - The `./chart` subpath is replaced by `./extra`, which exports a ready-built `prompt` string with all 4 built-ins registered:
24
+
25
+ ```ts
26
+ import { prompt as extraInstructions } from '@iyulab/chat-components/extra';
27
+ ```
28
+
29
+ Need only one or two and want to skip bundling the rest (e.g. skip `chart.js`)? Import the specific component directly via `@iyulab/chat-components/dist/components-extra/UImagesBlock.js` instead.
30
+ - `u-element-block` no longer shows an error card for unregistered tags or invalid data — it renders nothing and logs to the console instead, since an unregistered tag is more often a missing `/extra` import than a real error.
31
+
32
+ - `u-marked-block` now tracks a `streaming` state (resets a 1500ms idle timer on every `value` update). A `block-json` extra's `loading` stays `true` until **both** its own fence is closed **and** the message has been idle for 1500ms, instead of turning off as soon as its own fence closes while the rest of the message keeps streaming.
33
+ - The 0.6.0 note about `./react` still re-exporting the chart component regardless of exclusion no longer applies — moving chart out of `components/` into `components-extra/` also dropped it from the generated `react/index.js` barrel.
34
+ - `UChartBlock` now imports `chart.js/auto` statically instead of lazy-loading it at render time. `chart.js` remains an optional peer dependency — only the load timing changed.
35
+ - Switched the icon set used by `u-code-block`, `u-table-block`, `u-prompt`, `u-ref-card`, `u-ref-tag`, and `u-chart-block` from ad-hoc `lib="bootstrap"` references to the package's own bundled icon set (`lib="internal-chat"`, see `src/utilities/icons.ts`).
36
+ - `UDataElement`-based components (`u-table-block`, `u-ref-card`, `u-element-block`, and any custom subclass) no longer render an error card UI when `data`/JSON parsing fails — the error is logged to the console only.
37
+ - `u-file-block`: preview now opens by clicking anywhere on the card instead of only the thumbnail (see **Removed** for the download button).
38
+ - `u-prompt`: `send` and `stop` events now fire with `bubbles: false, composed: false` (no longer cross the shadow boundary); send button restyled as a circular ghost button.
39
+ - `u-table-block`: fixed a CSS custom property typo, `--u-primary` → `--u-primary-color`, for the active sort column color.
40
+
41
+ ### Removed
42
+
43
+ - **Breaking:** Legacy `u-submit`/`u-cancel` DOM events removed from `UPrompt`. They were dispatched alongside `send`/`stop` since 0.5.1 as a deprecation-period compatibility alias; 0.6.0 was the announced removal target. Use `send`/`stop` instead.
44
+ - **Breaking:** Removed unused components and their public exports:
45
+ - Blocks: `u-tool-block` (`UToolBlock`), `u-think-block` (`UThinkBlock`), `u-json-block` (`UJsonBlock`)
46
+ - Buttons: `u-attach-button` (`UAttachButton`), `u-vote-button` (`UVoteButton`), `u-copy-button` (`UCopyButton` — `u-code-block` now uses the copy-button shipped by `@iyulab/components` instead)
47
+ - Intent system: `u-question-intent` (`UQuestionIntent`), `IntentPromptBuilder`, `PresetIntent`, `types/Intents.ts`
48
+ - Related types: `ThinkingBlockItem` and `ToolBlockItem` removed from the `BlockItem` union; `AttachEvent`/`ChoiceEvent` removed
49
+ - **Breaking:** `FileBlockItem.status` and `UFileBlock.status` removed (unused in practice). `u-file-block` now renders an actual `<img>`/`<video>` thumbnail for image/video files with a `url` (instead of a generic icon) and opens a full-size overlay on click; other file types keep the icon. The download button and its click handler are also removed — there is no built-in download affordance anymore.
50
+ - **Breaking:** `u-code-block`'s `loading` property is removed — the header always shows the language icon now (no streaming spinner state).
51
+
52
+ There is no drop-in replacement for the intent system or the removed blocks/buttons; if you rely on any of them, stay on `0.6.x` or vendor the component from that version's source.
53
+
3
54
  ## [0.6.0] - 2026-05-21
4
55
 
5
56
  ### Changed
package/README.md CHANGED
@@ -26,9 +26,7 @@ import '@iyulab/chat-components';
26
26
  <u-marked-block value="# Hello&#10;&#10;This is **markdown**."></u-marked-block>
27
27
  </u-message>
28
28
 
29
- <u-prompt placeholder="Type a message...">
30
- <u-attach-button slot="left-actions" multiple>Attach</u-attach-button>
31
- </u-prompt>
29
+ <u-prompt placeholder="Type a message..."></u-prompt>
32
30
  ```
33
31
 
34
32
  ```ts
@@ -71,14 +69,11 @@ npx skills add ./node_modules/@iyulab/chat-components
71
69
 
72
70
  | Tag | Description |
73
71
  |-----|-------------|
74
- | `u-marked-block` | Markdown renderer — KaTeX, code highlighting, citation injection, view-json/intent-json handling |
72
+ | `u-marked-block` | Markdown renderer — KaTeX, code highlighting, citation injection, block-json handling |
75
73
  | `u-code-block` | Syntax-highlighted code block (Highlight.js) with language label and copy button |
76
74
  | `u-text-block` | Plain text display or editable textarea |
77
- | `u-think-block` | LLM reasoning block — collapse/expand, auto-scroll |
78
- | `u-tool-block` | Tool call input/output display — collapse/expand |
79
- | `u-file-block` | File card — type icon, upload status, download, remove |
75
+ | `u-file-block` | File card — type-based preview (image/video) or icon, click-to-open overlay, download, remove |
80
76
  | `u-ref-block` | Reference source group — collapse/expand, card grid |
81
- | `u-json-block` | Collapsible JSON tree |
82
77
  | `u-table-block` | Table — column sort, search, CSV/XLS download |
83
78
 
84
79
  ### Action Buttons
@@ -86,39 +81,24 @@ npx skills add ./node_modules/@iyulab/chat-components
86
81
  | Tag | Description |
87
82
  |-----|-------------|
88
83
  | `u-copy-button` | Copies text to clipboard; icon confirms copy |
89
- | `u-vote-button` | Thumbs-up / thumbs-down vote pair |
90
- | `u-attach-button` | Opens file picker; fires `attach` event |
91
84
 
92
85
  ---
93
86
 
94
- ## Intent & View Systems
87
+ ## Extras System
88
+
89
+ Chart/images/map/video are optional and not part of the core import — bring them in via `@iyulab/chat-components/extra`:
95
90
 
96
91
  ```ts
97
- import { IntentPromptBuilder, ViewPromptBuilder, PresetIntent, PresetView } from '@iyulab/chat-components';
98
-
99
- // Build system prompt instructions
100
- const intentInstructions = IntentPromptBuilder.instance.use(PresetIntent.Questions).build();
101
- const viewInstructions = ViewPromptBuilder.instance.use(PresetView.All).build();
102
-
103
- const systemPrompt = `You are a helpful assistant.\n\n${intentInstructions}\n\n${viewInstructions}`;
104
-
105
- // Parse LLM response
106
- const [intents, cleanText] = IntentPromptBuilder.instance.parse(llmResponse);
107
- markedBlock.value = cleanText; // view-json blocks inside are rendered automatically
108
-
109
- for (const intent of intents) {
110
- if (intent.type === 'question') {
111
- const el = document.createElement('u-question-intent') as any;
112
- el.question = intent.properties?.question;
113
- el.choices = intent.properties?.choices ?? [];
114
- el.addEventListener('choice', (e: any) => { prompt.value = e.detail.value; prompt.submit(); });
115
- msg.appendChild(el);
116
- }
117
- }
92
+ import '@iyulab/chat-components/extra';
93
+ import { prompt as extraInstructions } from '@iyulab/chat-components/extra';
94
+
95
+ const systemPrompt = `You are a helpful assistant.\n\n${extraInstructions}`;
96
+
97
+ // block-json blocks inside markdown are rendered automatically
98
+ markedBlock.value = llmResponse;
118
99
  ```
119
100
 
120
- > - Intent system details: **[docs/intent-system.md](./docs/intent-system.md)**
121
- > - View system details: **[docs/view-system.md](./docs/view-system.md)**
101
+ > - Extras system details: **[docs/extras-system.md](./docs/extras-system.md)**
122
102
 
123
103
  ---
124
104
 
@@ -128,9 +108,6 @@ for (const intent of intents) {
128
108
  |-------|--------|--------|-------------|
129
109
  | `send` | `u-prompt` | — | Send button clicked or Enter pressed |
130
110
  | `stop` | `u-prompt` | — | Stop button clicked while loading |
131
- | `attach` | `u-attach-button` | `{ files: File[] }` | File selection completed |
132
- | `choice` | `u-question-intent` | `{ value: string }` | Choice button clicked |
133
- | `change` | `u-vote-button` | — | Vote state changed |
134
111
  | `remove` | `u-file-block` | — | Remove button clicked |
135
112
 
136
113
  ---
@@ -142,8 +119,7 @@ for (const intent of intents) {
142
119
  | [docs/getting-started.md](./docs/getting-started.md) | Installation, basic chat UI, streaming, history rendering |
143
120
  | [docs/architecture.md](./docs/architecture.md) | Package structure, class hierarchy, rendering pipeline |
144
121
  | [docs/block-system.md](./docs/block-system.md) | Block components and `BlockItem` types in depth |
145
- | [docs/intent-system.md](./docs/intent-system.md) | Intent system setup and custom intents |
146
- | [docs/view-system.md](./docs/view-system.md) | View system setup and custom views |
122
+ | [docs/extras-system.md](./docs/extras-system.md) | Extras system setup and custom extras |
147
123
  | [docs/events.md](./docs/events.md) | Full event reference |
148
124
 
149
125
  ---
@@ -1,4 +1,4 @@
1
- //#region \0@oxc-project+runtime@0.130.0/helpers/decorate.js
1
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/decorate.js
2
2
  function __decorate(decorators, target, key, desc) {
3
3
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
4
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -6,4 +6,4 @@ function __decorate(decorators, target, key, desc) {
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  }
8
8
  //#endregion
9
- export { __decorate };
9
+ export { __decorate as default };
@@ -1,6 +1,6 @@
1
- //#region \0@oxc-project+runtime@0.130.0/helpers/decorateMetadata.js
1
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/decorateMetadata.js
2
2
  function __decorateMetadata(k, v) {
3
3
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
4
4
  }
5
5
  //#endregion
6
- export { __decorateMetadata };
6
+ export { __decorateMetadata as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/alert-triangle-fill.svg.4cfc4305
2
+ var alert_triangle_fill_svg_default = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M12 1.67c.955 0 1.845 .467 2.39 1.247l.105 .16l8.114 13.548a2.914 2.914 0 0 1 -2.307 4.363l-.195 .008h-16.225a2.914 2.914 0 0 1 -2.582 -4.2l.099 -.185l8.11 -13.538a2.914 2.914 0 0 1 2.491 -1.403zm.01 13.33l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -7a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z\" />\n</svg>\n";
3
+ //#endregion
4
+ export { alert_triangle_fill_svg_default as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/arrows-sort.svg.dda43a85
2
+ var arrows_sort_svg_default = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M3 9l4 -4l4 4m-4 -4v14\" />\n <path d=\"M21 15l-4 4l-4 -4m4 4v-14\" />\n</svg>\n";
3
+ //#endregion
4
+ export { arrows_sort_svg_default as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/code.svg.c69bc144
2
+ var code_svg_default = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M7 8l-4 4l4 4\" />\n <path d=\"M17 8l4 4l-4 4\" />\n <path d=\"M14 4l-4 16\" />\n</svg>\n";
3
+ //#endregion
4
+ export { code_svg_default as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/download.svg.bce82177
2
+ var download_svg_default = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2\" />\n <path d=\"M7 11l5 5l5 -5\" />\n <path d=\"M12 4l0 12\" />\n</svg>\n";
3
+ //#endregion
4
+ export { download_svg_default as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/element-prompt.md.7047ffcc
2
+ var element_prompt_md_default = "## Renderable Blocks\n\nYou can render interactive visual blocks inside your response.\nWhen one would make your answer clearer or more useful, output a `block-json` fenced code block.\n\n**Output format (the fence language must be `block-json`):**\n```block-json\n{\n \"tag\": \"block-tag-here\",\n \"properties\": {\n \"key\": \"value\"\n }\n}\n```\n\n**Rules — follow these strictly:**\n1. The fenced block language identifier must be `block-json`, not `json` or anything else.\n2. `tag` must be one of the exact strings listed below. Never invent a tag.\n3. Output valid JSON — no comments, no trailing commas.\n\n---\n\n{{EXTRA_DOCS}}\n";
3
+ //#endregion
4
+ export { element_prompt_md_default as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/external-link.svg.a9f7f02d
2
+ var external_link_svg_default = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6\" />\n <path d=\"M11 13l9 -9\" />\n <path d=\"M15 4h5v5\" />\n</svg>\n";
3
+ //#endregion
4
+ export { external_link_svg_default as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/file-code.svg.0e706f93
2
+ var file_code_svg_default = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M14 3v4a1 1 0 0 0 1 1h4\" />\n <path d=\"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2\" />\n <path d=\"M10 13l-1 2l1 2\" />\n <path d=\"M14 13l1 2l-1 2\" />\n</svg>\n";
3
+ //#endregion
4
+ export { file_code_svg_default as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/file-music.svg.b9970203
2
+ var file_music_svg_default = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M14 3v4a1 1 0 0 0 1 1h4\" />\n <path d=\"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2\" />\n <path d=\"M10 16a1 1 0 1 0 2 0a1 1 0 1 0 -2 0\" />\n <path d=\"M12 16l0 -5l2 1\" />\n</svg>\n";
3
+ //#endregion
4
+ export { file_music_svg_default as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/file-spreadsheet.svg.8c03bdfa
2
+ var file_spreadsheet_svg_default = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M14 3v4a1 1 0 0 0 1 1h4\" />\n <path d=\"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2\" />\n <path d=\"M8 11h8v7h-8l0 -7\" />\n <path d=\"M8 15h8\" />\n <path d=\"M11 11v7\" />\n</svg>\n";
3
+ //#endregion
4
+ export { file_spreadsheet_svg_default as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/file-text.svg.85bdd923
2
+ var file_text_svg_default = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M14 3v4a1 1 0 0 0 1 1h4\" />\n <path d=\"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2\" />\n <path d=\"M9 9l1 0\" />\n <path d=\"M9 13l6 0\" />\n <path d=\"M9 17l6 0\" />\n</svg>\n";
3
+ //#endregion
4
+ export { file_text_svg_default as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/file-type-pdf.svg.bc12db6d
2
+ var file_type_pdf_svg_default = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M14 3v4a1 1 0 0 0 1 1h4\" />\n <path d=\"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4\" />\n <path d=\"M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6\" />\n <path d=\"M17 18h2\" />\n <path d=\"M20 15h-3v6\" />\n <path d=\"M11 15v6h1a2 2 0 0 0 2 -2v-2a2 2 0 0 0 -2 -2h-1\" />\n</svg>\n";
3
+ //#endregion
4
+ export { file_type_pdf_svg_default as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/file-zip.svg.76dde660
2
+ var file_zip_svg_default = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M6 20.735a2 2 0 0 1 -1 -1.735v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-1\" />\n <path d=\"M11 17a2 2 0 0 1 2 2v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a2 2 0 0 1 2 -2\" />\n <path d=\"M11 5l-1 0\" />\n <path d=\"M13 7l-1 0\" />\n <path d=\"M11 9l-1 0\" />\n <path d=\"M13 11l-1 0\" />\n <path d=\"M11 13l-1 0\" />\n <path d=\"M13 15l-1 0\" />\n</svg>\n";
3
+ //#endregion
4
+ export { file_zip_svg_default as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/file.svg.28f5d6f1
2
+ var file_svg_default = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M14 3v4a1 1 0 0 0 1 1h4\" />\n <path d=\"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2\" />\n</svg>\n";
3
+ //#endregion
4
+ export { file_svg_default as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/photo.svg.cc273cc1
2
+ var photo_svg_default = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M15 8h.01\" />\n <path d=\"M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12\" />\n <path d=\"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5\" />\n <path d=\"M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3\" />\n</svg>\n";
3
+ //#endregion
4
+ export { photo_svg_default as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/player-stop-fill.svg.5378b752
2
+ var player_stop_fill_svg_default = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M17 4h-10a3 3 0 0 0 -3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3 -3v-10a3 3 0 0 0 -3 -3z\" />\n</svg>\n";
3
+ //#endregion
4
+ export { player_stop_fill_svg_default as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/send.svg.02326253
2
+ var send_svg_default = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M10 14l11 -11\" />\n <path d=\"M21 3l-6.5 18a.55 .55 0 0 1 -1 0l-3.5 -7l-7 -3.5a.55 .55 0 0 1 0 -1l18 -6.5\" />\n</svg>\n";
3
+ //#endregion
4
+ export { send_svg_default as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/sort-ascending-letters.svg.14a3df67
2
+ var sort_ascending_letters_svg_default = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M15 10v-5c0 -1.38 .62 -2 2 -2s2 .62 2 2v5m0 -3h-4\" />\n <path d=\"M19 21h-4l4 -7h-4\" />\n <path d=\"M4 15l3 3l3 -3\" />\n <path d=\"M7 6v12\" />\n</svg>\n";
3
+ //#endregion
4
+ export { sort_ascending_letters_svg_default as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/sort-descending-letters.svg.3e03647c
2
+ var sort_descending_letters_svg_default = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M15 21v-5c0 -1.38 .62 -2 2 -2s2 .62 2 2v5m0 -3h-4\" />\n <path d=\"M19 10h-4l4 -7h-4\" />\n <path d=\"M4 15l3 3l3 -3\" />\n <path d=\"M7 6v12\" />\n</svg>\n";
3
+ //#endregion
4
+ export { sort_descending_letters_svg_default as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/video.svg.c183f03c
2
+ var video_svg_default = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M15 10l4.553 -2.276a1 1 0 0 1 1.447 .894v6.764a1 1 0 0 1 -1.447 .894l-4.553 -2.276v-4\" />\n <path d=\"M3 8a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -8\" />\n</svg>\n";
3
+ //#endregion
4
+ export { video_svg_default as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/world.svg.cd9903c8
2
+ var world_svg_default = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0\" />\n <path d=\"M3.6 9h16.8\" />\n <path d=\"M3.6 15h16.8\" />\n <path d=\"M11.5 3a17 17 0 0 0 0 18\" />\n <path d=\"M12.5 3a17 17 0 0 1 0 18\" />\n</svg>\n";
3
+ //#endregion
4
+ export { world_svg_default as default };
@@ -0,0 +1,48 @@
1
+ import { UElement } from '@iyulab/components/dist/components/UElement.js';
2
+ /**
3
+ * `UDataElement`는 light DOM 내 `<script type="application/json">` 태그에서
4
+ * JSON 데이터를 읽어 컴포넌트 프로퍼티에 자동으로 매핑하는 기반 클래스입니다.
5
+ *
6
+ * 사용 예시:
7
+ * ```html
8
+ * <my-component>
9
+ * <script type="application/json">{ "items": [1, 2, 3] }</script>
10
+ * </my-component>
11
+ * ```
12
+ *
13
+ * JSON 최상위 키가 컴포넌트의 프로퍼티 이름과 일치하면 자동으로 할당됩니다.
14
+ *
15
+ * script 페이로드 없이 property 바인딩만으로도 사용되는 서브클래스는
16
+ * `load()`를 오버라이드해 script 부재 시 조용히 건너뛰어야 합니다.
17
+ * (예: `URefCard` — URefBlock의 property 구동과 UMarkedBlock의 script 주입을 모두 지원)
18
+ */
19
+ export declare class UDataElement extends UElement {
20
+ static styles: import('lit').CSSResultGroup;
21
+ connectedCallback(): void;
22
+ /**
23
+ * 지정한 태그와 데이터로 커스텀 엘리먼트 HTML 문자열을 생성합니다.
24
+ * 데이터는 `<script type="application/json">` 태그로 주입됩니다.
25
+ * 태그이름이 등록되지 않은 경우 빈 문자열을 반환합니다.
26
+ *
27
+ * @param json - JSON 데이터 객체 또는 문자열
28
+ * @param attrs - 추가 속성 객체 (선택적, `HtmlBuilder.build` 규칙 적용)
29
+ * @returns 생성된 HTML 문자열
30
+ */
31
+ static buildHTML(json: object | string, attrs?: Record<string, string | boolean | object | null | undefined>): string;
32
+ /**
33
+ * `data` 객체를 컴포넌트 프로퍼티에 할당합니다.
34
+ * `data`가 제공되지 않은 경우 light DOM 내 `<script type="application/json">` 태그에서 JSON 데이터를 읽어 프로퍼티에 자동으로 할당합니다.
35
+ * 오류가 발생할 경우 `error()`를 호출하여 콘솔에 조용히 기록합니다.
36
+ *
37
+ * @param data - JSON 데이터 객체 (선택적)
38
+ */
39
+ protected load(data?: object): Promise<void>;
40
+ /**
41
+ * 오류 발생 시 콘솔에만 조용히 기록합니다. 에러 UI를 띄우지 않으므로 채팅 화면이
42
+ * 갑작스러운 에러 카드로 어수선해지지 않습니다.
43
+ * 일반적으로 JSON 파싱 오류의 경우 `data`가 객체가 아닌 문자열이거나 JSON 형식이 잘못된 경우입니다.
44
+ *
45
+ * @param error - 발생한 오류 객체
46
+ */
47
+ protected error(error: unknown): Promise<void>;
48
+ }
@@ -0,0 +1,80 @@
1
+ import { HtmlBuilder } from "../utilities/HtmlBuilder.js";
2
+ import { UElement } from "@iyulab/components/dist/components/UElement.js";
3
+ //#region src/components/UDataElement.ts
4
+ /**
5
+ * `UDataElement`는 light DOM 내 `<script type="application/json">` 태그에서
6
+ * JSON 데이터를 읽어 컴포넌트 프로퍼티에 자동으로 매핑하는 기반 클래스입니다.
7
+ *
8
+ * 사용 예시:
9
+ * ```html
10
+ * <my-component>
11
+ * <script type="application/json">{ "items": [1, 2, 3] }<\/script>
12
+ * </my-component>
13
+ * ```
14
+ *
15
+ * JSON 최상위 키가 컴포넌트의 프로퍼티 이름과 일치하면 자동으로 할당됩니다.
16
+ *
17
+ * script 페이로드 없이 property 바인딩만으로도 사용되는 서브클래스는
18
+ * `load()`를 오버라이드해 script 부재 시 조용히 건너뛰어야 합니다.
19
+ * (예: `URefCard` — URefBlock의 property 구동과 UMarkedBlock의 script 주입을 모두 지원)
20
+ */
21
+ var UDataElement = class extends UElement {
22
+ static {
23
+ this.styles = super.styles;
24
+ }
25
+ connectedCallback() {
26
+ super.connectedCallback();
27
+ queueMicrotask(() => this.load());
28
+ }
29
+ /**
30
+ * 지정한 태그와 데이터로 커스텀 엘리먼트 HTML 문자열을 생성합니다.
31
+ * 데이터는 `<script type="application/json">` 태그로 주입됩니다.
32
+ * 태그이름이 등록되지 않은 경우 빈 문자열을 반환합니다.
33
+ *
34
+ * @param json - JSON 데이터 객체 또는 문자열
35
+ * @param attrs - 추가 속성 객체 (선택적, `HtmlBuilder.build` 규칙 적용)
36
+ * @returns 생성된 HTML 문자열
37
+ */
38
+ static buildHTML(json, attrs = {}) {
39
+ const tag = customElements.getName(this);
40
+ if (!tag) {
41
+ console.error(`Custom element for ${this.name} is not defined.`);
42
+ return "";
43
+ }
44
+ const content = `<script type="application/json">${(typeof json === "string" ? json : JSON.stringify(json)).replace(/&/g, "\\u0026").replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/-->/g, "--\\>")}<\/script>`;
45
+ return HtmlBuilder.build(tag, attrs, content);
46
+ }
47
+ /**
48
+ * `data` 객체를 컴포넌트 프로퍼티에 할당합니다.
49
+ * `data`가 제공되지 않은 경우 light DOM 내 `<script type="application/json">` 태그에서 JSON 데이터를 읽어 프로퍼티에 자동으로 할당합니다.
50
+ * 오류가 발생할 경우 `error()`를 호출하여 콘솔에 조용히 기록합니다.
51
+ *
52
+ * @param data - JSON 데이터 객체 (선택적)
53
+ */
54
+ async load(data) {
55
+ try {
56
+ if (!data) {
57
+ const script = this.querySelector("script[type=\"application/json\"]");
58
+ if (!script) throw new Error("Missing <script type=\"application/json\">");
59
+ data = JSON.parse(script.textContent ?? "{}");
60
+ script.remove();
61
+ }
62
+ if (typeof data !== "object" || data === null || Array.isArray(data)) throw new Error("Invalid JSON data: expected an object at the top level");
63
+ Object.assign(this, data);
64
+ } catch (error) {
65
+ await this.error(error);
66
+ }
67
+ }
68
+ /**
69
+ * 오류 발생 시 콘솔에만 조용히 기록합니다. 에러 UI를 띄우지 않으므로 채팅 화면이
70
+ * 갑작스러운 에러 카드로 어수선해지지 않습니다.
71
+ * 일반적으로 JSON 파싱 오류의 경우 `data`가 객체가 아닌 문자열이거나 JSON 형식이 잘못된 경우입니다.
72
+ *
73
+ * @param error - 발생한 오류 객체
74
+ */
75
+ async error(error) {
76
+ console.error(`failed to load data for [${this.localName}]`, error);
77
+ }
78
+ };
79
+ //#endregion
80
+ export { UDataElement };
@@ -5,16 +5,12 @@ import { UElement } from '@iyulab/components/dist/components/UElement.js';
5
5
  */
6
6
  export declare class UCodeBlock extends UElement {
7
7
  static styles: import('lit').CSSResultGroup[];
8
- /** 코드 블록이 로딩 중인지 여부를 나타냅니다. */
9
- loading: boolean;
10
8
  /** 코드 블록의 헤더를 숨길지 여부를 지정합니다. */
11
9
  headless: boolean;
12
10
  /** 코드 언어를 지정합니다. */
13
11
  lang: string;
14
12
  /** 표시할 코드 내용입니다. */
15
13
  value?: string;
16
- /** 클립보드 복사 상태를 나타내는 플래그입니다. */
17
- isCopied: boolean;
18
14
  render(): import('lit-html').TemplateResult<1>;
19
15
  /**
20
16
  * slot에 할당된 코드를 value로 설정합니다.
@@ -1,22 +1,21 @@
1
- import { __decorateMetadata } from "../../_virtual/_@oxc-project_runtime@0.130.0/helpers/decorateMetadata.js";
2
- import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.130.0/helpers/decorate.js";
3
- import "../buttons/UCopyButton.js";
1
+ import "../../utilities/icons.js";
4
2
  import { styles } from "./UCodeBlock.styles.js";
3
+ import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorateMetadata.js";
4
+ import __decorate from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
5
5
  import { html } from "lit";
6
- import { customElement, property, state } from "lit/decorators.js";
6
+ import { customElement, property } from "lit/decorators.js";
7
7
  import { unsafeHTML } from "lit/directives/unsafe-html.js";
8
8
  import hljs from "highlight.js";
9
9
  import "@iyulab/components/dist/components/icon/UIcon.js";
10
10
  import "@iyulab/components/dist/components/spinner/USpinner.js";
11
+ import "@iyulab/components/dist/components/copy-button/UCopyButton.js";
11
12
  import { UElement } from "@iyulab/components/dist/components/UElement.js";
12
13
  //#region src/components/blocks/UCodeBlock.ts
13
14
  var UCodeBlock = class UCodeBlock extends UElement {
14
15
  constructor(..._args) {
15
16
  super(..._args);
16
- this.loading = false;
17
17
  this.headless = false;
18
18
  this.lang = "plaintext";
19
- this.isCopied = false;
20
19
  this.handleSlotChange = (e) => {
21
20
  const nodes = e.target.assignedNodes({ flatten: true });
22
21
  this.value = nodes.map((node) => node.textContent).join("\n\n");
@@ -31,7 +30,7 @@ var UCodeBlock = class UCodeBlock extends UElement {
31
30
  return html`
32
31
  <div class="header" ?hidden=${this.headless}>
33
32
  <span class="status">
34
- ${this.loading ? html`<u-spinner></u-spinner>` : html`<u-icon lib="bootstrap" name="code-slash"></u-icon>`}
33
+ <u-icon lib="internal-chat" name="code"></u-icon>
35
34
  </span>
36
35
  <span class="lang">
37
36
  ${lang}
@@ -50,10 +49,6 @@ var UCodeBlock = class UCodeBlock extends UElement {
50
49
  `;
51
50
  }
52
51
  };
53
- __decorate([property({
54
- type: Boolean,
55
- reflect: true
56
- }), __decorateMetadata("design:type", Boolean)], UCodeBlock.prototype, "loading", void 0);
57
52
  __decorate([property({
58
53
  type: Boolean,
59
54
  reflect: true
@@ -63,7 +58,6 @@ __decorate([property({
63
58
  reflect: true
64
59
  }), __decorateMetadata("design:type", String)], UCodeBlock.prototype, "lang", void 0);
65
60
  __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UCodeBlock.prototype, "value", void 0);
66
- __decorate([state(), __decorateMetadata("design:type", Boolean)], UCodeBlock.prototype, "isCopied", void 0);
67
61
  UCodeBlock = __decorate([customElement("u-code-block")], UCodeBlock);
68
62
  //#endregion
69
63
  export { UCodeBlock };
@@ -1,10 +1,11 @@
1
1
  import { nothing, PropertyValues } from 'lit';
2
- import { UDataElement } from '@iyulab/components/dist/components/UDataElement.js';
2
+ import { UDataElement } from '../UDataElement.js';
3
3
  /**
4
- * 뷰 컴포넌트를 렌더링 또는 오류를 표시하는 컴포넌트입니다.
4
+ * `block-json` 코드펜스에서 지정한 커스텀 엘리먼트를 동적으로 렌더링하는 컴포넌트입니다.
5
+ * 대상 태그가 등록되어 있지 않거나 데이터가 유효하지 않은 경우, 에러 카드 없이 콘솔에만 기록하고 아무것도 렌더링하지 않습니다.
5
6
  */
6
- export declare class UView extends UDataElement {
7
- static styles: (import('lit').CSSResult | import('lit').CSSResultGroup[])[];
7
+ export declare class UElementBlock extends UDataElement {
8
+ static styles: import('lit').CSSResultGroup[];
8
9
  /** 로딩 상태입니다. `true`인 경우, 위젯이 로딩 중임을 나타냅니다. */
9
10
  loading: boolean;
10
11
  /** `tag` 프로퍼티에 등록된 커스텀 엘리먼트를 렌더링하는 컴포넌트입니다. */
@@ -16,15 +17,18 @@ export declare class UView extends UDataElement {
16
17
  /** 실제 렌더링된 엘리먼트입니다. `tag` 프로퍼티가 변경될 때마다 업데이트됩니다. */
17
18
  private element;
18
19
  protected willUpdate(changedProperties: PropertyValues): void;
19
- render(): HTMLElement | import('lit-html').TemplateResult<1> | typeof nothing;
20
+ render(): HTMLElement | typeof nothing | import('lit-html').TemplateResult<1>;
20
21
  /**
21
- * `loading`이 `true`인 경우, 에러 UI로 대체하지 않습니다.
22
+ * `UDataElement.load()`의 JSON 파싱 실패 시 호출됩니다. 스트리밍 중(`loading`)에는
23
+ * JSON이 아직 완성되지 않아 일시적으로 파싱에 실패하는 것이 정상이므로 콘솔 기록도 건너뜁니다.
22
24
  */
23
- protected error(error: Error): Promise<void>;
25
+ protected error(error: unknown): Promise<void>;
24
26
  /**
25
27
  * `tag` 프로퍼티에 등록된 커스텀 엘리먼트를 렌더링하는 컴포넌트입니다.
26
28
  * `tag`가 변경될 때마다 등록된 커스텀 엘리먼트를 새로 생성하여 렌더링합니다.
27
29
  * `tag`가 유효하지 않거나 등록된 커스텀 엘리먼트가 아닌 경우, 에러 처리합니다.
30
+ * JSON 자체는 이미 파싱에 성공한 상태이므로(스트리밍 중 파싱 실패와는 다른 케이스),
31
+ * `loading` 여부와 무관하게 항상 기록합니다.
28
32
  */
29
33
  private updateElement;
30
34
  /**
@@ -38,9 +42,15 @@ export declare class UView extends UDataElement {
38
42
  * DOM 조작이나 이벤트 핸들러로 악용될 수 있는 프로퍼티를 최소한으로 차단합니다.
39
43
  */
40
44
  private validateProperties;
45
+ /**
46
+ * 에러 카드 없이 콘솔에만 기록합니다. 채팅 UI에 갑작스러운 에러 카드가 뜨는 것을 피하기 위함입니다 —
47
+ * addon 모듈을 import하지 않아 아직 등록되지 않은 태그일 수도 있으므로, 실제 에러라기보다
48
+ * "아직 준비 안 됨"에 가깝습니다.
49
+ */
50
+ private reportError;
41
51
  }
42
52
  declare global {
43
53
  interface HTMLElementTagNameMap {
44
- "u-view": UView;
54
+ "u-element-block": UElementBlock;
45
55
  }
46
56
  }