@websolutespa/bom-mixer-llm 0.0.2 → 0.0.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @websolutespa/bom-mixer-llm
2
2
 
3
+ ## 0.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Added: embed options
8
+ - Added: returning instance with methods
9
+
10
+ ## 0.0.3
11
+
12
+ ### Patch Changes
13
+
14
+ - Updating: dependencies
15
+ - Updated dependencies
16
+ - @websolutespa/bom-mixer-models@1.7.2
17
+ - @websolutespa/bom-mixer-forms@0.3.1
18
+ - @websolutespa/bom-mixer-hooks@1.7.2
19
+ - @websolutespa/bom-mixer-icons@0.2.3
20
+ - @websolutespa/bom-mixer-store@1.7.3
21
+ - @websolutespa/bom-mixer-ui@1.7.5
22
+ - @websolutespa/bom-core@1.7.3
23
+
3
24
  ## 0.0.2
4
25
 
5
26
  ### Patch Changes
@@ -152,16 +152,46 @@
152
152
  box-sizing: border-box;
153
153
  }
154
154
 
155
+ llm-embed {
156
+ display: block;
157
+ width: 100%;
158
+ max-height: 100vh;
159
+ background: transparent;
160
+ overflow: clip;
161
+ }
162
+ @media (max-width: 799px) {
163
+ llm-embed {
164
+ height: 100vh;
165
+ }
166
+ }
167
+ @media (min-width: 800px) {
168
+ llm-embed {
169
+ aspect-ratio: 1/1;
170
+ }
171
+ }
172
+ @media (min-width: 1080px) {
173
+ llm-embed {
174
+ aspect-ratio: 4/3;
175
+ }
176
+ }
177
+ @media (min-width: 1440px) {
178
+ llm-embed {
179
+ aspect-ratio: 16/9;
180
+ }
181
+ }
182
+
155
183
  .llm {
156
- position: fixed;
157
184
  display: flex;
158
185
  flex-direction: column;
159
186
  align-items: center;
160
187
  justify-content: flex-end;
161
- top: 0;
162
- left: 0;
163
188
  width: 100%;
164
189
  height: 100%;
190
+ }
191
+ .llm:not(.-embedded) {
192
+ position: fixed;
193
+ top: 0;
194
+ left: 0;
165
195
  pointer-events: none;
166
196
  z-index: 9999;
167
197
  }
@@ -938,7 +968,8 @@
938
968
  }
939
969
 
940
970
  .llm .llm__main {
941
- position: absolute;
971
+ display: block;
972
+ position: relative;
942
973
  pointer-events: auto;
943
974
  inset: 0;
944
975
  background: var(--llm-color-ui-1);
@@ -978,14 +1009,26 @@
978
1009
  }
979
1010
  .llm .llm__content {
980
1011
  min-height: 100%;
981
- padding-top: 100px;
982
- padding-bottom: 180px;
983
1012
  display: flex;
984
1013
  flex-direction: column;
985
1014
  justify-content: center;
986
1015
  }
1016
+ .llm.-embedded .llm__main {
1017
+ width: 100%;
1018
+ height: 100%;
1019
+ }
1020
+ .llm.-embedded .llm__content {
1021
+ padding: 80px 0 0 0;
1022
+ }
1023
+ .llm:not(.-embedded) .llm__main {
1024
+ position: absolute;
1025
+ }
1026
+ .llm:not(.-embedded) .llm__content {
1027
+ padding-top: 100px;
1028
+ padding-bottom: 180px;
1029
+ }
987
1030
  @media (min-width: 1024px) {
988
- .llm .llm__content {
1031
+ .llm:not(.-embedded) .llm__content {
989
1032
  padding: 200px 0;
990
1033
  padding-bottom: 280px;
991
1034
  }
package/dist/cjs/index.js CHANGED
@@ -1508,6 +1508,7 @@ const createLlmStore = _ref => {
1508
1508
  apiKey,
1509
1509
  threadId,
1510
1510
  opened,
1511
+ embedded,
1511
1512
  decorateUrl,
1512
1513
  endpoint,
1513
1514
  test,
@@ -1520,7 +1521,8 @@ const createLlmStore = _ref => {
1520
1521
  prompt: '',
1521
1522
  locale: 'en',
1522
1523
  streaming: false,
1523
- opened: opened != null ? opened : threadId != null ? true : false,
1524
+ opened: opened != null || embedded != null ? Boolean(opened || embedded) : threadId != null ? true : false,
1525
+ embedded: embedded || false,
1524
1526
  hidden: false,
1525
1527
  fixed: false,
1526
1528
  idle: true,
@@ -3438,6 +3440,7 @@ const Thread = () => {
3438
3440
  const Main = () => {
3439
3441
  var _a;
3440
3442
  const lenisRef = react.useRef(null);
3443
+ const embedded = useLlm(state => state.embedded);
3441
3444
  const messages = useLlm(state => state.messages);
3442
3445
  const {
3443
3446
  setLenis
@@ -3508,7 +3511,7 @@ const Main = () => {
3508
3511
  initial: "hidden",
3509
3512
  animate: "show",
3510
3513
  exit: "exit",
3511
- children: jsxRuntime.jsx(Header, {})
3514
+ children: !embedded && jsxRuntime.jsx(Header, {})
3512
3515
  }), jsxRuntime.jsx(reactLenis.ReactLenis, {
3513
3516
  ref: lenisRef,
3514
3517
  className: "llm__scroller",
@@ -3582,16 +3585,23 @@ const Trigger = () => {
3582
3585
  });
3583
3586
  };
3584
3587
 
3585
- const LlmComponent = props => {
3588
+ const LlmComponent = /*#__PURE__*/react.forwardRef((props, ref) => {
3586
3589
  const {
3587
3590
  locale
3588
3591
  } = bomMixerHooks.useLayout();
3589
3592
  const {
3590
- init
3593
+ init,
3594
+ open
3591
3595
  } = useLlm(state => state.actions);
3592
3596
  const app = useLlm(state => state.app);
3593
3597
  const idle = useLlm(state => state.idle);
3594
3598
  const opened = useLlm(state => state.opened);
3599
+ const embedded = useLlm(state => state.embedded);
3600
+ react.useImperativeHandle(ref, () => ({
3601
+ open: () => {
3602
+ open();
3603
+ }
3604
+ }));
3595
3605
  react.useEffect(() => {
3596
3606
  init(locale);
3597
3607
  }, [init, locale]);
@@ -3600,7 +3610,8 @@ const LlmComponent = props => {
3600
3610
  }, [opened]);
3601
3611
  const mounted = bomMixerHooks.useMounted();
3602
3612
  const classNames = bomCore.getClassNames('llm', {
3603
- '-open': opened
3613
+ '-open': opened,
3614
+ '-embedded': embedded
3604
3615
  });
3605
3616
  if (mounted) {
3606
3617
  return jsxRuntime.jsx(jsxRuntime.Fragment, {
@@ -3617,7 +3628,7 @@ const LlmComponent = props => {
3617
3628
  } else {
3618
3629
  return jsxRuntime.jsx(jsxRuntime.Fragment, {});
3619
3630
  }
3620
- };
3631
+ });
3621
3632
 
3622
3633
  exports.LlmComponent = LlmComponent;
3623
3634
  exports.LlmContext = LlmContext;