@sparkelf/dsh-genui 0.11.4-patch.2 → 0.13.0-sparkelf.2

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 (111) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/ICON-NAMES.md +30 -0
  3. package/README.md +26 -28
  4. package/README.zh-CN.md +26 -28
  5. package/SKILL.md +128 -19
  6. package/THIRD_PARTY_NOTICES.md +42 -0
  7. package/assets/genui-icon.svg +20 -0
  8. package/assets/genui-logo.svg +18 -0
  9. package/lib/assets/icons.js +1 -0
  10. package/lib/assets/mermaid.js +325 -325
  11. package/lib/assets/standalone-runtime.js +10 -9
  12. package/lib/client.js +32 -31
  13. package/lib/index.js +489 -80
  14. package/lib/types/client/action-context.d.ts +1 -1
  15. package/lib/types/client/artifact/types.d.ts +1 -1
  16. package/lib/types/client/asset-loader.d.ts +2 -2
  17. package/lib/types/client/blocks/blocks.d.ts +12 -0
  18. package/lib/types/client/blocks/icon.d.ts +4 -0
  19. package/lib/types/client/dom-fence.d.ts +2 -1
  20. package/lib/types/client/fence-render.d.ts +5 -21
  21. package/lib/types/client/file-address.d.ts +4 -0
  22. package/lib/types/client/file-link-context.d.ts +49 -0
  23. package/lib/types/client/file-link.d.ts +17 -0
  24. package/lib/types/client/gallery.d.ts +8 -2
  25. package/lib/types/client/genui-runtime/diagnostics.d.ts +1 -1
  26. package/lib/types/client/genui-runtime/limits.d.ts +4 -0
  27. package/lib/types/client/genui-runtime/schema.d.ts +14 -1
  28. package/lib/types/client/guard.d.ts +4 -1
  29. package/lib/types/client/i18n/en.d.ts +5 -1
  30. package/lib/types/client/i18n/index.d.ts +1 -1
  31. package/lib/types/client/icons/asset-icons.d.ts +1 -0
  32. package/lib/types/client/icons/icon-data-full.d.ts +23 -0
  33. package/lib/types/client/icons/icon-data.d.ts +24 -0
  34. package/lib/types/client/icons/icon-lazy.d.ts +18 -0
  35. package/lib/types/client/icons/icon-names-full.d.ts +12 -0
  36. package/lib/types/client/index.d.ts +5 -15
  37. package/lib/types/client/inline.d.ts +1 -1
  38. package/lib/types/client/mermaid-colors.d.ts +2 -0
  39. package/lib/types/client/mermaid-core.d.ts +2 -1
  40. package/lib/types/client/mermaid-lazy.d.ts +5 -1
  41. package/lib/types/client/panel-command.d.ts +21 -1
  42. package/lib/types/client/panel.d.ts +6 -1
  43. package/lib/types/client/primitive-adapter.d.ts +0 -2
  44. package/lib/types/client/session-resolver.d.ts +13 -2
  45. package/lib/types/client/source-fence.d.ts +1 -1
  46. package/lib/types/client/spec.d.ts +107 -3
  47. package/lib/types/client/standalone/asset-loader.d.ts +1 -1
  48. package/lib/types/client/standalone/primitive-adapter.d.ts +0 -4
  49. package/lib/types/plugin/fence-feedback.d.ts +11 -7
  50. package/lib/types/plugin/index.d.ts +6 -2
  51. package/lib/types/shared/fence-language.d.ts +14 -0
  52. package/lib/types/shared/fence-repair.d.ts +2 -1
  53. package/lib/types/shared/fence-resolve.d.ts +1 -1
  54. package/package.json +92 -83
  55. package/src/client/EChartNode.tsx +17 -3
  56. package/src/client/GenuiBlock.module.css +411 -76
  57. package/src/client/action-context.ts +5 -15
  58. package/src/client/artifact/ArtifactExport.module.css +34 -3
  59. package/src/client/artifact/ExportableGenuiBlock.tsx +23 -2
  60. package/src/client/artifact/portability.ts +6 -1
  61. package/src/client/artifact/types.ts +1 -1
  62. package/src/client/asset-loader.ts +3 -3
  63. package/src/client/blocks/advanced.tsx +101 -14
  64. package/src/client/blocks/blocks.tsx +143 -0
  65. package/src/client/blocks/charts.tsx +22 -6
  66. package/src/client/blocks/icon.tsx +93 -0
  67. package/src/client/blocks/image.tsx +1 -0
  68. package/src/client/blocks/render-node.tsx +84 -52
  69. package/src/client/dom-fence.tsx +546 -72
  70. package/src/client/fence-render.tsx +5 -21
  71. package/src/client/file-address.ts +37 -0
  72. package/src/client/file-link-context.tsx +116 -0
  73. package/src/client/file-link.ts +46 -0
  74. package/src/client/gallery.ts +161 -133
  75. package/src/client/genui-runtime/diagnostics.ts +1 -1
  76. package/src/client/genui-runtime/limits.ts +4 -0
  77. package/src/client/genui-runtime/normalize.ts +42 -6
  78. package/src/client/genui-runtime/schema.ts +39 -7
  79. package/src/client/guard.ts +170 -15
  80. package/src/client/i18n/en.ts +5 -1
  81. package/src/client/i18n/index.ts +1 -1
  82. package/src/client/i18n/zh.ts +5 -1
  83. package/src/client/icons/asset-icons.ts +16 -0
  84. package/src/client/icons/icon-data-full.ts +5715 -0
  85. package/src/client/icons/icon-data.ts +507 -0
  86. package/src/client/icons/icon-lazy.ts +80 -0
  87. package/src/client/icons/icon-names-full.ts +12 -0
  88. package/src/client/index.tsx +27 -51
  89. package/src/client/inline.ts +17 -6
  90. package/src/client/mermaid-colors.ts +40 -0
  91. package/src/client/mermaid-core.ts +69 -61
  92. package/src/client/mermaid-lazy.ts +99 -4
  93. package/src/client/panel-command.ts +16 -2
  94. package/src/client/panel.tsx +18 -5
  95. package/src/client/primitive-adapter.ts +0 -11
  96. package/src/client/session-resolver.ts +12 -21
  97. package/src/client/source-fence.ts +4 -2
  98. package/src/client/spec.ts +116 -2
  99. package/src/client/standalone/asset-loader.ts +1 -1
  100. package/src/client/standalone/primitive-adapter.tsx +1 -9
  101. package/src/client/table-details.ts +4 -3
  102. package/src/plugin/fence-feedback.ts +60 -14
  103. package/src/plugin/index.ts +45 -20
  104. package/src/plugin/tool.ts +11 -2
  105. package/src/shared/fence-language.ts +30 -0
  106. package/src/shared/fence-repair.ts +37 -1
  107. package/src/shared/fence-resolve.ts +1 -1
  108. package/tsdown.config.ts +7 -8
  109. package/lib/invariant.js +0 -19
  110. package/lib/types/plugin/invariant.d.ts +0 -15
  111. package/src/plugin/invariant.ts +0 -30
@@ -46,6 +46,12 @@ function readToken(name: string, fallback: string, el?: HTMLElement | null): str
46
46
  return fallback
47
47
  }
48
48
 
49
+ /** Read a px-valued font token as a number for ECharts textStyle fields. */
50
+ function readFontSize(name: string, fallback: number, el?: HTMLElement | null): number {
51
+ const parsed = Number.parseFloat(readToken(name, '', el))
52
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback
53
+ }
54
+
49
55
  /** Resolve the host accent and label colors for ECharts theming. */
50
56
  function themeColors(el?: HTMLElement | null): {
51
57
  accent: string
@@ -54,6 +60,9 @@ function themeColors(el?: HTMLElement | null): {
54
60
  labelTertiary: string
55
61
  border: string
56
62
  bgLayer1: string
63
+ fontData: number
64
+ fontMeta: number
65
+ fontDisplay: number
57
66
  } {
58
67
  return {
59
68
  accent: readToken('--dsw-alias-state-business-primary', '#4f8ef7', el),
@@ -62,6 +71,11 @@ function themeColors(el?: HTMLElement | null): {
62
71
  labelTertiary: readToken('--dsw-alias-label-tertiary', '#6b6b6b', el),
63
72
  border: readToken('--dsw-alias-border-l1', 'rgba(255,255,255,0.12)', el),
64
73
  bgLayer1: readToken('--dsw-alias-bg-layer-1', '#1a1a1e', el),
74
+ // The --dsl-g-* scale is declared on the .block/.panel roots; the chart
75
+ // container inherits it. Detached renders fall back to these literals.
76
+ fontData: readFontSize('--dsl-g-font-data', 12, el),
77
+ fontMeta: readFontSize('--dsl-g-font-meta', 12.5, el),
78
+ fontDisplay: readFontSize('--dsl-g-font-display', 28, el),
65
79
  }
66
80
  }
67
81
 
@@ -226,8 +240,8 @@ function presetOption(node: GenuiEChart, el?: HTMLElement | null): Record<string
226
240
  splitLine: { show: false },
227
241
  axisLabel: { show: false },
228
242
  pointer: { show: false },
229
- title: { offsetCenter: [0, '32%'], color: t.labelTertiary, fontSize: 12 },
230
- detail: { valueAnimation: true, fontSize: 26, offsetCenter: [0, '2%'], formatter: '{value}', color: t.labelPrimary },
243
+ title: { offsetCenter: [0, '32%'], color: t.labelTertiary, fontSize: t.fontData },
244
+ detail: { valueAnimation: true, fontSize: t.fontDisplay, offsetCenter: [0, '2%'], formatter: '{value}', color: t.labelPrimary },
231
245
  data: [{ value: Number(d.value) || 0, name: d.label }],
232
246
  })),
233
247
  }
@@ -307,7 +321,7 @@ function presetOption(node: GenuiEChart, el?: HTMLElement | null): Record<string
307
321
  type: 'graph',
308
322
  layout: 'force',
309
323
  roam: true,
310
- label: { show: true, color: t.labelSecondary, fontSize: 11 },
324
+ label: { show: true, color: t.labelSecondary, fontSize: t.fontMeta },
311
325
  force: { repulsion: 200, edgeLength: 80 },
312
326
  lineStyle: { color: t.border, curveness: 0.1 },
313
327
  emphasis: { focus: 'adjacency' },