@inkeep/cxkit-primitives 0.5.89 → 0.5.91

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.
@@ -1,2 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),n=require("react"),m=require("./root.cjs"),p=require("@radix-ui/react-id"),c=n.createContext(void 0),d=()=>n.useContext(c);function u({wrapperStyles:e={},children:i,customStyles:a,styles:l}){const[s,h]=n.useState(null),[r,x]=n.useState(null),w=n.useMemo(()=>({shadowHost:s,rootElement:r}),[s,r]),S=p.useId(),f=m.default.div;return o.jsxs(f,{id:`inkeep-shadow${S}`,ref:t=>{t&&h(t)},style:e,children:[o.jsx("style",{type:"text/css",dangerouslySetInnerHTML:{__html:`@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;900&display=swap');
2
- ${l}`}}),a,o.jsx("div",{id:"inkeep-widget-root",ref:t=>{t&&x(t)},style:e,children:o.jsx(c.Provider,{value:w,children:s&&r&&i})})]})}const v=e=>d()?e.children:o.jsx(u,{...e});exports.InkeepShadow=v;exports.InkeepShadowProvider=u;exports.ShadowContext=c;exports.useShadow=d;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),n=require("react"),v=require("./root.cjs"),j=require("@radix-ui/react-id"),c=n.createContext(void 0),i=()=>n.useContext(c);function u({wrapperStyles:e={},children:d,customStyles:a,styles:l}){const[s,h]=n.useState(null),[r,x]=n.useState(null),S=n.useMemo(()=>({shadowHost:s,rootElement:r}),[s,r]),w=j.useId(),f=v.default.div;return o.jsxs(f,{id:`inkeep-shadow${w}`,ref:t=>{t&&h(t)},style:e,children:[o.jsx("style",{type:"text/css",dangerouslySetInnerHTML:{__html:`${l}`}}),a,o.jsx("div",{id:"inkeep-widget-root",ref:t=>{t&&x(t)},style:e,children:o.jsx(c.Provider,{value:S,children:s&&r&&d})})]})}const I=e=>i()?e.children:o.jsx(u,{...e});exports.InkeepShadow=I;exports.InkeepShadowProvider=u;exports.ShadowContext=c;exports.useShadow=i;
@@ -1,22 +1,22 @@
1
1
  "use client";
2
- import { jsxs as x, jsx as o } from "react/jsx-runtime";
3
- import { createContext as p, useContext as w, useState as i, useMemo as v } from "react";
4
- import y from "./root.js";
5
- import { useId as S } from "@radix-ui/react-id";
6
- const c = p(void 0), g = () => w(c);
2
+ import { jsxs as f, jsx as o } from "react/jsx-runtime";
3
+ import { createContext as w, useContext as p, useState as i, useMemo as v } from "react";
4
+ import S from "./root.js";
5
+ import { useId as k } from "@radix-ui/react-id";
6
+ const c = w(void 0), y = () => p(c);
7
7
  function I({
8
8
  wrapperStyles: t = {},
9
9
  children: s,
10
10
  customStyles: d,
11
- styles: l
11
+ styles: u
12
12
  }) {
13
- const [n, u] = i(null), [r, m] = i(null), a = v(() => ({ shadowHost: n, rootElement: r }), [n, r]), h = S(), f = y.div;
14
- return /* @__PURE__ */ x(
15
- f,
13
+ const [n, l] = i(null), [r, h] = i(null), m = v(() => ({ shadowHost: n, rootElement: r }), [n, r]), x = k(), a = S.div;
14
+ return /* @__PURE__ */ f(
15
+ a,
16
16
  {
17
- id: `inkeep-shadow${h}`,
17
+ id: `inkeep-shadow${x}`,
18
18
  ref: (e) => {
19
- e && u(e);
19
+ e && l(e);
20
20
  },
21
21
  style: t,
22
22
  children: [
@@ -25,8 +25,7 @@ function I({
25
25
  {
26
26
  type: "text/css",
27
27
  dangerouslySetInnerHTML: {
28
- __html: `@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;900&display=swap');
29
- ${l}`
28
+ __html: `${u}`
30
29
  }
31
30
  }
32
31
  ),
@@ -36,20 +35,20 @@ function I({
36
35
  {
37
36
  id: "inkeep-widget-root",
38
37
  ref: (e) => {
39
- e && m(e);
38
+ e && h(e);
40
39
  },
41
40
  style: t,
42
- children: /* @__PURE__ */ o(c.Provider, { value: a, children: n && r && s })
41
+ children: /* @__PURE__ */ o(c.Provider, { value: m, children: n && r && s })
43
42
  }
44
43
  )
45
44
  ]
46
45
  }
47
46
  );
48
47
  }
49
- const E = (t) => g() ? t.children : /* @__PURE__ */ o(I, { ...t });
48
+ const E = (t) => y() ? t.children : /* @__PURE__ */ o(I, { ...t });
50
49
  export {
51
50
  E as InkeepShadow,
52
51
  I as InkeepShadowProvider,
53
52
  c as ShadowContext,
54
- g as useShadow
53
+ y as useShadow
55
54
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react/jsx-runtime"),t=require("react"),f=require("../atoms/api/analytics/events.cjs"),b=require("./config-provider.cjs"),x=require("./user-provider.cjs"),E=t.createContext(void 0),q=({children:e})=>{const{baseSettings:s,componentType:r}=b.useInkeepConfig(),{apiKey:i,analyticsApiBaseUrl:c,tags:a,privacyPreferences:m,env:g,analyticsProperties:v}=s,{userProperties:u}=x.useUser(),l=t.useMemo(()=>({widgetLibraryVersion:"0.5.89",componentType:r,tags:a}),[r,a]),d=!m.optOutAllAnalytics&&g!=="development",P={logEvent:t.useCallback(async n=>{const o={...l,...n.properties,...v},p={eventName:n.eventName,properties:o,userProperties:u},y=["modal_opened","modal_closed"].includes(n.eventName);if(d&&!y){if("conversation"in o&&!o.conversation?.id)return;f.logEvent(p,i,c)}s.onEvent?.(p)},[d,s,i,c,u,l,v])};return B.jsx(E.Provider,{value:P,children:e})},C=()=>{const e=t.useContext(E);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=q;exports.useBaseEvents=C;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react/jsx-runtime"),t=require("react"),f=require("../atoms/api/analytics/events.cjs"),b=require("./config-provider.cjs"),x=require("./user-provider.cjs"),E=t.createContext(void 0),q=({children:e})=>{const{baseSettings:s,componentType:r}=b.useInkeepConfig(),{apiKey:i,analyticsApiBaseUrl:c,tags:a,privacyPreferences:m,env:g,analyticsProperties:v}=s,{userProperties:u}=x.useUser(),l=t.useMemo(()=>({widgetLibraryVersion:"0.5.91",componentType:r,tags:a}),[r,a]),d=!m.optOutAllAnalytics&&g!=="development",P={logEvent:t.useCallback(async n=>{const o={...l,...n.properties,...v},p={eventName:n.eventName,properties:o,userProperties:u},y=["modal_opened","modal_closed"].includes(n.eventName);if(d&&!y){if("conversation"in o&&!o.conversation?.id)return;f.logEvent(p,i,c)}s.onEvent?.(p)},[d,s,i,c,u,l,v])};return B.jsx(E.Provider,{value:P,children:e})},C=()=>{const e=t.useContext(E);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=q;exports.useBaseEvents=C;
@@ -7,7 +7,7 @@ import { useUser as A } from "./user-provider.js";
7
7
  const u = B(void 0), $ = ({ children: e }) => {
8
8
  const { baseSettings: t, componentType: s } = w(), { apiKey: r, analyticsApiBaseUrl: i, tags: a, privacyPreferences: d, env: E, analyticsProperties: c } = t, { userProperties: v } = A(), p = P(
9
9
  () => ({
10
- widgetLibraryVersion: "0.5.89",
10
+ widgetLibraryVersion: "0.5.91",
11
11
  componentType: s,
12
12
  tags: a
13
13
  }),
@@ -1 +1,3 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),m=require("@inkeep/cxkit-theme"),F=require("@inkeep/cxkit-color-mode"),z=require("./config-provider.cjs"),D=require("merge-anything"),E=require("../atoms/custom-styles.cjs"),i=require("react"),H=({children:g})=>{const{baseSettings:y}=z.useInkeepConfig(),{theme:s,primaryBrandColor:h,shadowHost:b,rootElement:f,colorMode:C}=y,{primaryColors:S,varsClassName:M}=s,{fontFamily:v,fontSize:q,zIndex:k}=s,x=m.createColorScheme(S,h),p={colors:D.merge(s.colors,x),fontFamily:v,fontSize:q,zIndex:k},T=m.createCSSVariables(p),{customStyles:j,loaded:P}=E.useCustomStyles(),{sync:e,forcedColorMode:I,...R}=C??{},[V,l]=i.useState(),w=i.useRef(null);return i.useEffect(()=>{if(!e?.target)return;const t=typeof e.target=="string"?document.querySelector(e.target):e.target;if(!t)return;function a(c,o){return o.reduce((A,d)=>({...A,[d]:c.getAttribute(d)}),{})}const n=new MutationObserver(()=>{const c=a(t,e.attributes),o=e.isDarkMode?.(c)?"dark":"light";e.onChange?.(o),l(o)});n.observe(t,{attributes:!0,attributeFilter:e.attributes,childList:!1,subtree:!1}),w.current=n;const u=e.isDarkMode?.(a(t,e?.attributes))?"dark":"light";return e.onChange?.(u),l(u),()=>n.disconnect()},[e]),r.jsxs(r.Fragment,{children:[j,P&&r.jsx(F.ColorModeProvider,{forcedColorMode:I??V,...R,shadowHostId:b?.id,rootId:f?.id,children:r.jsx("div",{className:M,style:{display:"contents",...T},children:g})})]})};exports.ThemeProvider=H;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),m=require("@inkeep/cxkit-theme"),D=require("@inkeep/cxkit-color-mode"),H=require("./config-provider.cjs"),L=require("merge-anything"),z=require("../atoms/custom-styles.cjs"),i=require("react"),E=({children:g})=>{const{baseSettings:y}=H.useInkeepConfig(),{theme:s,primaryBrandColor:h,shadowHost:f,rootElement:b,colorMode:S}=y,{primaryColors:C,varsClassName:M}=s,{disableLoadingDefaultFont:p,fontFamily:v,fontSize:x,zIndex:q}=s,k=m.createColorScheme(C,h),T={colors:L.merge(s.colors,k),fontFamily:v,fontSize:x,zIndex:q},j=m.createCSSVariables(T),{customStyles:I,loaded:w}=z.useCustomStyles(),{sync:e,forcedColorMode:P,...F}=S??{},[R,l]=i.useState(),V=i.useRef(null);return i.useEffect(()=>{if(!e?.target)return;const o=typeof e.target=="string"?document.querySelector(e.target):e.target;if(!o)return;function a(c,r){return r.reduce((A,d)=>({...A,[d]:c.getAttribute(d)}),{})}const n=new MutationObserver(()=>{const c=a(o,e.attributes),r=e.isDarkMode?.(c)?"dark":"light";e.onChange?.(r),l(r)});n.observe(o,{attributes:!0,attributeFilter:e.attributes,childList:!1,subtree:!1}),V.current=n;const u=e.isDarkMode?.(a(o,e?.attributes))?"dark":"light";return e.onChange?.(u),l(u),()=>n.disconnect()},[e]),t.jsxs(t.Fragment,{children:[!p&&t.jsx("style",{type:"text/css",dangerouslySetInnerHTML:{__html:`
2
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;900&display=swap');
3
+ `}}),I,w&&t.jsx(D.ColorModeProvider,{forcedColorMode:P??R,...F,shadowHostId:f?.id,rootId:b?.id,children:t.jsx("div",{className:M,style:{display:"contents",...j},children:g})})]})};exports.ThemeProvider=E;
@@ -1,59 +1,70 @@
1
1
  "use client";
2
- import { jsxs as A, Fragment as D, jsx as d } from "react/jsx-runtime";
3
- import { createColorScheme as E, createCSSVariables as H } from "@inkeep/cxkit-theme";
2
+ import { jsxs as j, Fragment as z, jsx as c } from "react/jsx-runtime";
3
+ import { createColorScheme as A, createCSSVariables as E } from "@inkeep/cxkit-theme";
4
4
  import { ColorModeProvider as N } from "@inkeep/cxkit-color-mode";
5
5
  import { useInkeepConfig as P } from "./config-provider.js";
6
6
  import { merge as R } from "merge-anything";
7
- import { useCustomStyles as q } from "../atoms/custom-styles.js";
8
- import { useState as B, useRef as L, useEffect as O } from "react";
7
+ import { useCustomStyles as _ } from "../atoms/custom-styles.js";
8
+ import { useState as q, useRef as B, useEffect as O } from "react";
9
9
  const Z = ({ children: u }) => {
10
- const { baseSettings: m } = P(), { theme: r, primaryBrandColor: f, shadowHost: g, rootElement: b, colorMode: h } = m, { primaryColors: C, varsClassName: y } = r, { fontFamily: p, fontSize: M, zIndex: S } = r, v = E(C, f), k = {
11
- colors: R(r.colors, v),
12
- fontFamily: p,
13
- fontSize: M,
14
- zIndex: S
15
- }, x = H(k), { customStyles: I, loaded: V } = q(), { sync: e, forcedColorMode: w, ...F } = h ?? {}, [T, c] = B(), j = L(null);
10
+ const { baseSettings: m } = P(), { theme: r, primaryBrandColor: f, shadowHost: g, rootElement: p, colorMode: y } = m, { primaryColors: h, varsClassName: b } = r, { disableLoadingDefaultFont: C, fontFamily: M, fontSize: S, zIndex: v } = r, I = A(h, f), k = {
11
+ colors: R(r.colors, I),
12
+ fontFamily: M,
13
+ fontSize: S,
14
+ zIndex: v
15
+ }, w = E(k), { customStyles: x, loaded: F } = _(), { sync: e, forcedColorMode: T, ...V } = y ?? {}, [D, a] = q(), H = B(null);
16
16
  return O(() => {
17
17
  if (!e?.target) return;
18
- const o = typeof e.target == "string" ? document.querySelector(e.target) : e.target;
19
- if (!o) return;
20
- function i(n, t) {
21
- return t.reduce(
22
- (z, l) => ({
23
- ...z,
24
- [l]: n.getAttribute(l)
18
+ const t = typeof e.target == "string" ? document.querySelector(e.target) : e.target;
19
+ if (!t) return;
20
+ function i(n, o) {
21
+ return o.reduce(
22
+ (L, d) => ({
23
+ ...L,
24
+ [d]: n.getAttribute(d)
25
25
  }),
26
26
  {}
27
27
  );
28
28
  }
29
29
  const s = new MutationObserver(() => {
30
- const n = i(o, e.attributes), t = e.isDarkMode?.(n) ? "dark" : "light";
31
- e.onChange?.(t), c(t);
30
+ const n = i(t, e.attributes), o = e.isDarkMode?.(n) ? "dark" : "light";
31
+ e.onChange?.(o), a(o);
32
32
  });
33
- s.observe(o, {
33
+ s.observe(t, {
34
34
  attributes: !0,
35
35
  attributeFilter: e.attributes,
36
36
  childList: !1,
37
37
  subtree: !1
38
- }), j.current = s;
39
- const a = e.isDarkMode?.(i(o, e?.attributes)) ? "dark" : "light";
40
- return e.onChange?.(a), c(a), () => s.disconnect();
41
- }, [e]), /* @__PURE__ */ A(D, { children: [
42
- I,
43
- V && /* @__PURE__ */ d(
38
+ }), H.current = s;
39
+ const l = e.isDarkMode?.(i(t, e?.attributes)) ? "dark" : "light";
40
+ return e.onChange?.(l), a(l), () => s.disconnect();
41
+ }, [e]), /* @__PURE__ */ j(z, { children: [
42
+ !C && /* @__PURE__ */ c(
43
+ "style",
44
+ {
45
+ type: "text/css",
46
+ dangerouslySetInnerHTML: {
47
+ __html: `
48
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;900&display=swap');
49
+ `
50
+ }
51
+ }
52
+ ),
53
+ x,
54
+ F && /* @__PURE__ */ c(
44
55
  N,
45
56
  {
46
- forcedColorMode: w ?? T,
47
- ...F,
57
+ forcedColorMode: T ?? D,
58
+ ...V,
48
59
  shadowHostId: g?.id,
49
- rootId: b?.id,
50
- children: /* @__PURE__ */ d(
60
+ rootId: p?.id,
61
+ children: /* @__PURE__ */ c(
51
62
  "div",
52
63
  {
53
- className: y,
64
+ className: b,
54
65
  style: {
55
66
  display: "contents",
56
- ...x
67
+ ...w
57
68
  },
58
69
  children: u
59
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/cxkit-primitives",
3
- "version": "0.5.89",
3
+ "version": "0.5.91",
4
4
  "description": "",
5
5
  "license": "Inkeep, Inc. Customer License (IICL) v1.1",
6
6
  "homepage": "",
@@ -63,9 +63,9 @@
63
63
  "remark-gfm": "^4.0.1",
64
64
  "unist-util-visit": "^5.0.0",
65
65
  "use-sync-external-store": "^1.4.0",
66
- "@inkeep/cxkit-color-mode": "0.5.89",
67
- "@inkeep/cxkit-theme": "0.5.89",
68
- "@inkeep/cxkit-types": "0.5.89"
66
+ "@inkeep/cxkit-color-mode": "0.5.91",
67
+ "@inkeep/cxkit-theme": "0.5.91",
68
+ "@inkeep/cxkit-types": "0.5.91"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@biomejs/biome": "1.9.4",