@bfrs/agentic-components 0.3.3 → 0.3.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/dist/index.js +894 -895
- package/dist/index.js.map +1 -1
- package/dist/public-api.d.ts +4 -0
- package/dist/shadow/BfrsShadowRoot.d.ts +30 -0
- package/dist/shadow/autoShadow.d.ts +17 -0
- package/dist/shadow/index.d.ts +2 -0
- package/dist/shadow/shadowStyles.d.ts +15 -0
- package/package.json +3 -3
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { BfrsColorScheme } from '../components/ui/providers/BfrsProvider';
|
|
3
|
+
export type BfrsShadowRootProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** Color scheme applied inside the shadow root. Defaults to `"light"`. */
|
|
6
|
+
colorScheme?: BfrsColorScheme;
|
|
7
|
+
/** Class applied to the light-DOM host element (not the shadow content). */
|
|
8
|
+
className?: string;
|
|
9
|
+
/** Style applied to the light-DOM host element. */
|
|
10
|
+
style?: CSSProperties;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Renders its React children inside an open shadow root so external class names
|
|
14
|
+
* and stylesheets cannot affect them. The compiled, `.bfrs`-scoped library
|
|
15
|
+
* stylesheet is adopted into the shadow root (the `--bfrs-*` token custom
|
|
16
|
+
* properties still pierce the boundary, so theming and overrides keep working).
|
|
17
|
+
*
|
|
18
|
+
* Overlays (Select, Dropdown, Tooltip, Toast, …) portal to `<body>` outside the
|
|
19
|
+
* shadow; their styles are injected into the document automatically.
|
|
20
|
+
*
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <BfrsShadowRoot>
|
|
23
|
+
* <Button>Encapsulated</Button>
|
|
24
|
+
* </BfrsShadowRoot>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function BfrsShadowRoot({ children, colorScheme, className, style }: BfrsShadowRootProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare namespace BfrsShadowRoot {
|
|
29
|
+
var displayName: string;
|
|
30
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
declare const BfrsShadowScopeContext: import('react').Context<boolean>;
|
|
3
|
+
/**
|
|
4
|
+
* Wraps a component so a top-level instance renders inside its own shadow root
|
|
5
|
+
* (isolated from outside CSS), while instances nested inside another bfrs shadow
|
|
6
|
+
* scope render normally. Ref, displayName and any attached statics are preserved.
|
|
7
|
+
*/
|
|
8
|
+
export declare function withAutoShadow<C extends ComponentType<any>>(Component: C): C;
|
|
9
|
+
/**
|
|
10
|
+
* Returns a copy of a module's exports with the named leaf components auto-shadowed
|
|
11
|
+
* and everything else passed through unchanged. Only names in `include` are
|
|
12
|
+
* wrapped — container / overlay / layout components are intentionally excluded
|
|
13
|
+
* because they render the consumer's own children, which must NOT be trapped in
|
|
14
|
+
* (and isolated by) a shadow root.
|
|
15
|
+
*/
|
|
16
|
+
export declare function autoShadowModule<T extends Record<string, unknown>>(mod: T, include: ReadonlySet<string>): T;
|
|
17
|
+
export { BfrsShadowScopeContext };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** The library CSS as a string — exposed for consumers building custom shadow hosts. */
|
|
2
|
+
export declare const bfrsShadowCss: string;
|
|
3
|
+
/**
|
|
4
|
+
* Adopt the library stylesheet into a `ShadowRoot` or the `Document` (idempotent).
|
|
5
|
+
* Uses a single shared constructable stylesheet when available, falling back to a
|
|
6
|
+
* one-off `<style>` element otherwise.
|
|
7
|
+
*/
|
|
8
|
+
export declare function adoptBfrsStyles(target: ShadowRoot | Document): void;
|
|
9
|
+
/**
|
|
10
|
+
* Ensure the library CSS is present in the main document. Overlays (Select,
|
|
11
|
+
* Dropdown, Tooltip, Toast, …) portal to `<body>` outside any shadow root, so they
|
|
12
|
+
* need the stylesheet at the document level to stay styled. The CSS is `.bfrs`
|
|
13
|
+
* scoped, so it only affects `.bfrs` subtrees and cannot leak onto host markup.
|
|
14
|
+
*/
|
|
15
|
+
export declare function ensureDocumentStyles(): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bfrs/agentic-components",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Shiprocket agentic component library and documentation showcase.",
|
|
6
6
|
"keywords": [
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"type": "module",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
|
-
"types": "./dist/
|
|
22
|
+
"types": "./dist/public-api.d.ts",
|
|
23
23
|
"import": "./dist/index.js"
|
|
24
24
|
},
|
|
25
25
|
"./custom-elements": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"main": "./dist/index.js",
|
|
44
|
-
"types": "./dist/
|
|
44
|
+
"types": "./dist/public-api.d.ts",
|
|
45
45
|
"files": [
|
|
46
46
|
"dist",
|
|
47
47
|
"BFRS_AGENTIC_COMPONENTS.md",
|