@smart-cloud/ai-kit-ui 1.1.24 → 1.1.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smart-cloud/ai-kit-ui",
3
- "version": "1.1.24",
3
+ "version": "1.1.25",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -1,6 +1,12 @@
1
1
  import createCache from "@emotion/cache";
2
2
  import { CacheProvider } from "@emotion/react";
3
- import { SetStateAction, useLayoutEffect, useMemo, useRef, useState } from "react";
3
+ import {
4
+ SetStateAction,
5
+ useLayoutEffect,
6
+ useMemo,
7
+ useRef,
8
+ useState,
9
+ } from "react";
4
10
  import { createPortal } from "react-dom";
5
11
 
6
12
  export type ShadowBoundaryMode = "local" | "overlay";
@@ -63,16 +69,11 @@ function ensureStylesheets(
63
69
 
64
70
  const REGISTRY_ID = "ai-kit-property-registry";
65
71
 
66
- function installAiKitPropertyRegistry() {
67
- const doc = getTopDocumentSafe();
68
-
69
- // simple dedupe
72
+ function installAiKitPropertyRegistry(doc: Document) {
70
73
  if (doc.getElementById(REGISTRY_ID)) return;
71
74
 
72
75
  const style = doc.createElement("style");
73
76
  style.id = REGISTRY_ID;
74
-
75
- // ONLY @property registrations (no global resets!)
76
77
  style.textContent = `
77
78
  @property --ai-kit-border-angle {
78
79
  syntax: "<angle>";
@@ -80,8 +81,7 @@ function installAiKitPropertyRegistry() {
80
81
  initial-value: 0deg;
81
82
  }
82
83
  `;
83
-
84
- doc.head.appendChild(style);
84
+ (doc.head ?? doc.documentElement).appendChild(style);
85
85
  }
86
86
 
87
87
  export function ShadowBoundary({
@@ -175,7 +175,7 @@ export function ShadowBoundary({
175
175
  const onMq = () => applyScheme();
176
176
  mq?.addEventListener?.("change", onMq);
177
177
 
178
- installAiKitPropertyRegistry();
178
+ installAiKitPropertyRegistry(doc);
179
179
 
180
180
  // 5) Inject styles into shadow body (dedup per shadow root)
181
181
  ensureStylesheets(
@@ -214,11 +214,11 @@ export function ShadowBoundary({
214
214
  >
215
215
  {portalTarget && shadowRoot && emotionCache
216
216
  ? createPortal(
217
- <CacheProvider value={emotionCache}>
218
- {children({ rootElement: portalTarget, shadowRoot })}
219
- </CacheProvider>,
220
- portalTarget,
221
- )
217
+ <CacheProvider value={emotionCache}>
218
+ {children({ rootElement: portalTarget, shadowRoot })}
219
+ </CacheProvider>,
220
+ portalTarget,
221
+ )
222
222
  : null}
223
223
  </div>
224
224
  );
@@ -105,14 +105,7 @@
105
105
  --ai-kit-border-speed: 1400ms;
106
106
  --ai-kit-border-angle: 0deg;
107
107
 
108
- --ai-kit-border-gradient: conic-gradient(
109
- from var(--ai-kit-border-angle, 0deg) at 50% 50%,
110
- #00c2ff,
111
- #7c3aed,
112
- #22c55e,
113
- #f59e0b,
114
- #00c2ff
115
- );
108
+ --ai-kit-border-stops: #00c2ff, #7c3aed, #22c55e, #f59e0b, #00c2ff;
116
109
 
117
110
  --ai-kit-position-z-index: 100001;
118
111
 
@@ -306,7 +299,10 @@
306
299
  z-index: 0;
307
300
  border-radius: var(--ai-kit-radius);
308
301
  padding: var(--ai-kit-border-thickness);
309
- background: var(--ai-kit-border-gradient);
302
+ background: conic-gradient(
303
+ from var(--ai-kit-border-angle, 0deg) at 50% 50%,
304
+ var(--ai-kit-border-stops)
305
+ );
310
306
  animation: ai-kit-border-run var(--ai-kit-border-speed) linear infinite;
311
307
  -webkit-mask:
312
308
  linear-gradient(#000 0 0) content-box,