@hef2024/llmasaservice-ui 0.24.2 → 0.24.3

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.
package/dist/index.css CHANGED
@@ -3751,12 +3751,6 @@ button[data-pending=true]::after {
3751
3751
  color: var(--ai-sidebar-text-muted, #9ca3af);
3752
3752
  flex-shrink: 0;
3753
3753
  }
3754
- .ai-chat-context-popover__section-format {
3755
- font-size: 10px;
3756
- color: var(--ai-sidebar-text-muted, #9ca3af);
3757
- letter-spacing: 0.04em;
3758
- flex-shrink: 0;
3759
- }
3760
3754
  .ai-chat-context-popover__expand-btn {
3761
3755
  display: flex;
3762
3756
  align-items: center;
@@ -3928,25 +3922,6 @@ button[data-pending=true]::after {
3928
3922
  max-height: 400px;
3929
3923
  overflow-y: auto;
3930
3924
  }
3931
- .ai-chat-context-popover__detail-view-toggle {
3932
- display: flex;
3933
- gap: 8px;
3934
- padding: 8px 12px 0;
3935
- }
3936
- .ai-chat-context-popover__detail-view-button {
3937
- border: 1px solid var(--ai-chat-input-border, #d1d5db);
3938
- background: transparent;
3939
- color: var(--ai-sidebar-text-muted, #6b7280);
3940
- border-radius: 999px;
3941
- font-size: 11px;
3942
- line-height: 1;
3943
- padding: 4px 10px;
3944
- cursor: pointer;
3945
- }
3946
- .ai-chat-context-popover__detail-view-button.active {
3947
- color: var(--ai-button-primary-bg, #2563eb);
3948
- border-color: var(--ai-button-primary-bg, #2563eb);
3949
- }
3950
3925
  .dark-theme .ai-chat-context-pill {
3951
3926
  background: var(--ai-chat-suggestion-bg, #374151);
3952
3927
  }
package/dist/index.js CHANGED
@@ -3855,9 +3855,6 @@ var ChatInput = import_react14.default.memo(({
3855
3855
  const hasRawData2 = (section) => {
3856
3856
  return typeof section.rawData === "string";
3857
3857
  };
3858
- const hasStructuredData = (section) => {
3859
- return typeof section.data === "object" && section.data !== null;
3860
- };
3861
3858
  const estimateSectionTokens2 = (section) => {
3862
3859
  var _a;
3863
3860
  if (typeof section.tokens === "number") {
@@ -3868,32 +3865,6 @@ var ChatInput = import_react14.default.memo(({
3868
3865
  }
3869
3866
  return Math.ceil(JSON.stringify((_a = section.data) != null ? _a : {}).length / 4);
3870
3867
  };
3871
- const detectFormat = (section) => {
3872
- if (section.format) {
3873
- return section.format;
3874
- }
3875
- if (!hasRawData2(section)) {
3876
- return "json";
3877
- }
3878
- const raw = section.rawData.trim();
3879
- if (raw.startsWith("{") || raw.startsWith("[")) return "json";
3880
- if (raw.includes("# ") || raw.includes("```")) return "markdown";
3881
- return "text";
3882
- };
3883
- const formatBadge = (format) => {
3884
- if (format === "toon") return "TOON";
3885
- if (format === "markdown") return "MD";
3886
- if (format === "text") return "TEXT";
3887
- return "JSON";
3888
- };
3889
- const [detailViewModeBySection, setDetailViewModeBySection] = (0, import_react14.useState)({});
3890
- const getVisibleDetailMode = (section) => {
3891
- var _a;
3892
- if (hasRawData2(section)) {
3893
- return (_a = detailViewModeBySection[section.id]) != null ? _a : "raw";
3894
- }
3895
- return "structured";
3896
- };
3897
3868
  const getStructuredContent = (section) => {
3898
3869
  var _a;
3899
3870
  return JSON.stringify((_a = section.data) != null ? _a : {}, null, 2);
@@ -3999,7 +3970,6 @@ var ChatInput = import_react14.default.memo(({
3999
3970
  },
4000
3971
  /* @__PURE__ */ import_react14.default.createElement("span", { className: "ai-chat-context-popover__section-icon" }, "\u{1F4C4}"),
4001
3972
  /* @__PURE__ */ import_react14.default.createElement("span", { className: "ai-chat-context-popover__section-title" }, section.title),
4002
- /* @__PURE__ */ import_react14.default.createElement("span", { className: "ai-chat-context-popover__section-format" }, formatBadge(detectFormat(section))),
4003
3973
  /* @__PURE__ */ import_react14.default.createElement("span", { className: "ai-chat-context-popover__section-tokens" }, estimateSectionTokens2(section))
4004
3974
  ))), enableContextDetailView && /* @__PURE__ */ import_react14.default.createElement(
4005
3975
  "button",
@@ -4043,8 +4013,6 @@ var ChatInput = import_react14.default.memo(({
4043
4013
  }
4044
4014
  ))), /* @__PURE__ */ import_react14.default.createElement("div", { className: "ai-chat-context-popover__detail-sections" }, contextSections.map((section) => {
4045
4015
  const isRawSection = hasRawData2(section);
4046
- const hasBothViews = isRawSection && hasStructuredData(section);
4047
- const visibleMode = getVisibleDetailMode(section);
4048
4016
  const isEnabled = !disabledSectionIds.has(section.id);
4049
4017
  return /* @__PURE__ */ import_react14.default.createElement(
4050
4018
  "details",
@@ -4075,33 +4043,8 @@ var ChatInput = import_react14.default.memo(({
4075
4043
  }
4076
4044
  ),
4077
4045
  /* @__PURE__ */ import_react14.default.createElement("span", { className: "ai-chat-context-toggle__slider" })
4078
- )), /* @__PURE__ */ import_react14.default.createElement("span", { className: "ai-chat-context-popover__detail-section-meta" }, /* @__PURE__ */ import_react14.default.createElement("code", null, `{{${section.id}}}`), /* @__PURE__ */ import_react14.default.createElement("span", null, formatBadge(detectFormat(section))), /* @__PURE__ */ import_react14.default.createElement("span", null, "~", estimateSectionTokens2(section)))),
4079
- hasBothViews && /* @__PURE__ */ import_react14.default.createElement("div", { className: "ai-chat-context-popover__detail-view-toggle" }, /* @__PURE__ */ import_react14.default.createElement(
4080
- "button",
4081
- {
4082
- type: "button",
4083
- className: `ai-chat-context-popover__detail-view-button ${visibleMode === "raw" ? "active" : ""}`,
4084
- onClick: (e) => {
4085
- e.preventDefault();
4086
- e.stopPropagation();
4087
- setDetailViewModeBySection((prev) => __spreadProps(__spreadValues({}, prev), { [section.id]: "raw" }));
4088
- }
4089
- },
4090
- "Raw"
4091
- ), /* @__PURE__ */ import_react14.default.createElement(
4092
- "button",
4093
- {
4094
- type: "button",
4095
- className: `ai-chat-context-popover__detail-view-button ${visibleMode === "structured" ? "active" : ""}`,
4096
- onClick: (e) => {
4097
- e.preventDefault();
4098
- e.stopPropagation();
4099
- setDetailViewModeBySection((prev) => __spreadProps(__spreadValues({}, prev), { [section.id]: "structured" }));
4100
- }
4101
- },
4102
- "Structured"
4103
- )),
4104
- /* @__PURE__ */ import_react14.default.createElement("pre", { className: "ai-chat-context-popover__detail-content" }, /* @__PURE__ */ import_react14.default.createElement("code", null, visibleMode === "raw" && isRawSection ? section.rawData : getStructuredContent(section)))
4046
+ )), /* @__PURE__ */ import_react14.default.createElement("span", { className: "ai-chat-context-popover__detail-section-meta" }, /* @__PURE__ */ import_react14.default.createElement("code", null, `{{${section.id}}}`), /* @__PURE__ */ import_react14.default.createElement("span", null, "~", estimateSectionTokens2(section)))),
4047
+ /* @__PURE__ */ import_react14.default.createElement("pre", { className: "ai-chat-context-popover__detail-content" }, /* @__PURE__ */ import_react14.default.createElement("code", null, isRawSection ? section.rawData : getStructuredContent(section)))
4105
4048
  );
4106
4049
  })))
4107
4050
  )), /* @__PURE__ */ import_react14.default.createElement(
package/dist/index.mjs CHANGED
@@ -3820,9 +3820,6 @@ var ChatInput = React14.memo(({
3820
3820
  const hasRawData2 = (section) => {
3821
3821
  return typeof section.rawData === "string";
3822
3822
  };
3823
- const hasStructuredData = (section) => {
3824
- return typeof section.data === "object" && section.data !== null;
3825
- };
3826
3823
  const estimateSectionTokens2 = (section) => {
3827
3824
  var _a;
3828
3825
  if (typeof section.tokens === "number") {
@@ -3833,32 +3830,6 @@ var ChatInput = React14.memo(({
3833
3830
  }
3834
3831
  return Math.ceil(JSON.stringify((_a = section.data) != null ? _a : {}).length / 4);
3835
3832
  };
3836
- const detectFormat = (section) => {
3837
- if (section.format) {
3838
- return section.format;
3839
- }
3840
- if (!hasRawData2(section)) {
3841
- return "json";
3842
- }
3843
- const raw = section.rawData.trim();
3844
- if (raw.startsWith("{") || raw.startsWith("[")) return "json";
3845
- if (raw.includes("# ") || raw.includes("```")) return "markdown";
3846
- return "text";
3847
- };
3848
- const formatBadge = (format) => {
3849
- if (format === "toon") return "TOON";
3850
- if (format === "markdown") return "MD";
3851
- if (format === "text") return "TEXT";
3852
- return "JSON";
3853
- };
3854
- const [detailViewModeBySection, setDetailViewModeBySection] = useState7({});
3855
- const getVisibleDetailMode = (section) => {
3856
- var _a;
3857
- if (hasRawData2(section)) {
3858
- return (_a = detailViewModeBySection[section.id]) != null ? _a : "raw";
3859
- }
3860
- return "structured";
3861
- };
3862
3833
  const getStructuredContent = (section) => {
3863
3834
  var _a;
3864
3835
  return JSON.stringify((_a = section.data) != null ? _a : {}, null, 2);
@@ -3964,7 +3935,6 @@ var ChatInput = React14.memo(({
3964
3935
  },
3965
3936
  /* @__PURE__ */ React14.createElement("span", { className: "ai-chat-context-popover__section-icon" }, "\u{1F4C4}"),
3966
3937
  /* @__PURE__ */ React14.createElement("span", { className: "ai-chat-context-popover__section-title" }, section.title),
3967
- /* @__PURE__ */ React14.createElement("span", { className: "ai-chat-context-popover__section-format" }, formatBadge(detectFormat(section))),
3968
3938
  /* @__PURE__ */ React14.createElement("span", { className: "ai-chat-context-popover__section-tokens" }, estimateSectionTokens2(section))
3969
3939
  ))), enableContextDetailView && /* @__PURE__ */ React14.createElement(
3970
3940
  "button",
@@ -4008,8 +3978,6 @@ var ChatInput = React14.memo(({
4008
3978
  }
4009
3979
  ))), /* @__PURE__ */ React14.createElement("div", { className: "ai-chat-context-popover__detail-sections" }, contextSections.map((section) => {
4010
3980
  const isRawSection = hasRawData2(section);
4011
- const hasBothViews = isRawSection && hasStructuredData(section);
4012
- const visibleMode = getVisibleDetailMode(section);
4013
3981
  const isEnabled = !disabledSectionIds.has(section.id);
4014
3982
  return /* @__PURE__ */ React14.createElement(
4015
3983
  "details",
@@ -4040,33 +4008,8 @@ var ChatInput = React14.memo(({
4040
4008
  }
4041
4009
  ),
4042
4010
  /* @__PURE__ */ React14.createElement("span", { className: "ai-chat-context-toggle__slider" })
4043
- )), /* @__PURE__ */ React14.createElement("span", { className: "ai-chat-context-popover__detail-section-meta" }, /* @__PURE__ */ React14.createElement("code", null, `{{${section.id}}}`), /* @__PURE__ */ React14.createElement("span", null, formatBadge(detectFormat(section))), /* @__PURE__ */ React14.createElement("span", null, "~", estimateSectionTokens2(section)))),
4044
- hasBothViews && /* @__PURE__ */ React14.createElement("div", { className: "ai-chat-context-popover__detail-view-toggle" }, /* @__PURE__ */ React14.createElement(
4045
- "button",
4046
- {
4047
- type: "button",
4048
- className: `ai-chat-context-popover__detail-view-button ${visibleMode === "raw" ? "active" : ""}`,
4049
- onClick: (e) => {
4050
- e.preventDefault();
4051
- e.stopPropagation();
4052
- setDetailViewModeBySection((prev) => __spreadProps(__spreadValues({}, prev), { [section.id]: "raw" }));
4053
- }
4054
- },
4055
- "Raw"
4056
- ), /* @__PURE__ */ React14.createElement(
4057
- "button",
4058
- {
4059
- type: "button",
4060
- className: `ai-chat-context-popover__detail-view-button ${visibleMode === "structured" ? "active" : ""}`,
4061
- onClick: (e) => {
4062
- e.preventDefault();
4063
- e.stopPropagation();
4064
- setDetailViewModeBySection((prev) => __spreadProps(__spreadValues({}, prev), { [section.id]: "structured" }));
4065
- }
4066
- },
4067
- "Structured"
4068
- )),
4069
- /* @__PURE__ */ React14.createElement("pre", { className: "ai-chat-context-popover__detail-content" }, /* @__PURE__ */ React14.createElement("code", null, visibleMode === "raw" && isRawSection ? section.rawData : getStructuredContent(section)))
4011
+ )), /* @__PURE__ */ React14.createElement("span", { className: "ai-chat-context-popover__detail-section-meta" }, /* @__PURE__ */ React14.createElement("code", null, `{{${section.id}}}`), /* @__PURE__ */ React14.createElement("span", null, "~", estimateSectionTokens2(section)))),
4012
+ /* @__PURE__ */ React14.createElement("pre", { className: "ai-chat-context-popover__detail-content" }, /* @__PURE__ */ React14.createElement("code", null, isRawSection ? section.rawData : getStructuredContent(section)))
4070
4013
  );
4071
4014
  })))
4072
4015
  )), /* @__PURE__ */ React14.createElement(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hef2024/llmasaservice-ui",
3
- "version": "0.24.2",
3
+ "version": "0.24.3",
4
4
  "description": "Prebuilt UI components for LLMAsAService.io",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",