@bfrs/agentic-components 0.6.5 → 0.6.7
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/BFRS_AGENTIC_COMPONENTS.md +93 -16
- package/README.md +13 -0
- package/dist/components/data-display/DataTable/DataTable.d.ts +1 -1
- package/dist/components/data-display/DataTable/DataTable.types.d.ts +8 -1
- package/dist/components/data-display/DataTable/TableViewSelector.d.ts +1 -1
- package/dist/components/data-display/Table/Table.d.ts +3 -5
- package/dist/components/navigation/Tabs/Tabs.types.d.ts +2 -0
- package/dist/components/primitives/Button/Button.types.d.ts +1 -1
- package/dist/components/primitives/Input/Input.d.ts +2 -1
- package/dist/components/primitives/Input/Input.types.d.ts +2 -0
- package/dist/components/ui/data-display/Avatar/Avatar.d.ts +4 -0
- package/dist/components/ui/patterns/ChatComposer/ChatComposer.d.ts +12 -0
- package/dist/components/ui/patterns/SideNav/SideNav.d.ts +11 -1
- package/dist/components/ui/patterns/StepProgressCard/StepProgressCard.d.ts +6 -0
- package/dist/custom-elements.js +19921 -14871
- package/dist/custom-elements.js.map +1 -1
- package/dist/index.js +5908 -6178
- package/dist/index.js.map +1 -1
- package/dist/lib/documentStyles.d.ts +1 -0
- package/dist/public-api.d.ts +0 -1
- package/dist/style.css +1 -1
- package/package.json +9 -6
- package/scripts/lint/cli.cjs +894 -0
- package/scripts/postinstall.cjs +79 -2
- package/dist/lib/emotionCache.d.ts +0 -14
- package/dist/shadow/BfrsShadowRoot.d.ts +0 -30
- package/dist/shadow/autoShadow.d.ts +0 -18
- package/dist/shadow/index.d.ts +0 -2
- package/dist/shadow/shadowStyles.d.ts +0 -15
package/scripts/postinstall.cjs
CHANGED
|
@@ -9,6 +9,26 @@ const initCwd = process.env.INIT_CWD ? path.resolve(process.env.INIT_CWD) : "";
|
|
|
9
9
|
const projectRoot = initCwd || path.resolve(packageDir, "..", "..", "..");
|
|
10
10
|
const knowledgeFileName = "BFRS_AGENTIC_COMPONENTS.md";
|
|
11
11
|
const referenceLine = `Use ${knowledgeFileName} for knowledge regarding the component library.`;
|
|
12
|
+
const skipSetup = process.env.BFRS_AGENTIC_COMPONENTS_SKIP_SETUP === "1";
|
|
13
|
+
const packageJsonFileName = "package.json";
|
|
14
|
+
const lintScriptName = "check:bfrs-agentic-lint";
|
|
15
|
+
const lintScriptCommand = "bfrs-agentic-lint all";
|
|
16
|
+
const buildScriptNames = ["build", "build:spa", "build:web-component", "build-ec2"];
|
|
17
|
+
const knownGuardCommands = [
|
|
18
|
+
lintScriptCommand,
|
|
19
|
+
"bfrs-agentic-lint style-overrides",
|
|
20
|
+
"bfrs-agentic-lint style-selectors",
|
|
21
|
+
"bfrs-agentic-lint ui-library",
|
|
22
|
+
"bfrs-agentic-lint theme-tokens",
|
|
23
|
+
"bfrs-agentic-lint custom-rules",
|
|
24
|
+
"npm run check:bfrs-agentic-lint",
|
|
25
|
+
"npm run check:bfrs-style-overrides",
|
|
26
|
+
"npm run check:library-style-overrides",
|
|
27
|
+
"npm run check:style-selectors",
|
|
28
|
+
"npm run check:ui-library",
|
|
29
|
+
"npm run check:theme-tokens",
|
|
30
|
+
"npm run check:custom-rules",
|
|
31
|
+
];
|
|
12
32
|
|
|
13
33
|
const src = path.join(packageDir, knowledgeFileName);
|
|
14
34
|
const dest = path.join(projectRoot, knowledgeFileName);
|
|
@@ -31,7 +51,7 @@ if (!isInsideNodeModules && !isConsumerLifecycle) {
|
|
|
31
51
|
process.exit(0);
|
|
32
52
|
}
|
|
33
53
|
|
|
34
|
-
if (!fs.existsSync(src)) {
|
|
54
|
+
if (skipSetup || !fs.existsSync(src)) {
|
|
35
55
|
process.exit(0);
|
|
36
56
|
}
|
|
37
57
|
|
|
@@ -59,6 +79,62 @@ function resolveAgentFile(fileNames) {
|
|
|
59
79
|
return path.join(projectRoot, existingFileName || fileNames[0]);
|
|
60
80
|
}
|
|
61
81
|
|
|
82
|
+
function ensureBuildGuard(command) {
|
|
83
|
+
if (!command) return command;
|
|
84
|
+
if (command.includes(lintScriptCommand)) return command;
|
|
85
|
+
|
|
86
|
+
let nextCommand = command.trim();
|
|
87
|
+
let stripped = true;
|
|
88
|
+
while (stripped) {
|
|
89
|
+
stripped = false;
|
|
90
|
+
for (const guardCommand of knownGuardCommands) {
|
|
91
|
+
if (nextCommand === guardCommand) {
|
|
92
|
+
nextCommand = "";
|
|
93
|
+
stripped = true;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const guardPrefix = `${guardCommand} && `;
|
|
98
|
+
if (nextCommand.startsWith(guardPrefix)) {
|
|
99
|
+
nextCommand = nextCommand.slice(guardPrefix.length).trimStart();
|
|
100
|
+
stripped = true;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return nextCommand ? `${lintScriptCommand} && ${nextCommand}` : lintScriptCommand;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function ensurePackageScripts() {
|
|
110
|
+
const packageJsonPath = path.join(projectRoot, packageJsonFileName);
|
|
111
|
+
if (!fs.existsSync(packageJsonPath)) return "missing";
|
|
112
|
+
|
|
113
|
+
const existing = fs.readFileSync(packageJsonPath, "utf8");
|
|
114
|
+
const pkg = JSON.parse(existing);
|
|
115
|
+
pkg.scripts = pkg.scripts && typeof pkg.scripts === "object" ? pkg.scripts : {};
|
|
116
|
+
|
|
117
|
+
let changed = false;
|
|
118
|
+
if (pkg.scripts[lintScriptName] !== lintScriptCommand) {
|
|
119
|
+
pkg.scripts[lintScriptName] = lintScriptCommand;
|
|
120
|
+
changed = true;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
for (const scriptName of buildScriptNames) {
|
|
124
|
+
if (typeof pkg.scripts[scriptName] !== "string") continue;
|
|
125
|
+
const nextCommand = ensureBuildGuard(pkg.scripts[scriptName]);
|
|
126
|
+
if (nextCommand !== pkg.scripts[scriptName]) {
|
|
127
|
+
pkg.scripts[scriptName] = nextCommand;
|
|
128
|
+
changed = true;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (!changed) return "unchanged";
|
|
133
|
+
|
|
134
|
+
fs.writeFileSync(packageJsonPath, `${JSON.stringify(pkg, null, 2)}\n`, "utf8");
|
|
135
|
+
return "updated";
|
|
136
|
+
}
|
|
137
|
+
|
|
62
138
|
try {
|
|
63
139
|
fs.copyFileSync(src, dest);
|
|
64
140
|
|
|
@@ -66,9 +142,10 @@ try {
|
|
|
66
142
|
const filePath = resolveAgentFile(fileNames);
|
|
67
143
|
return `${path.basename(filePath)}:${ensureReference(filePath)}`;
|
|
68
144
|
});
|
|
145
|
+
results.push(`${packageJsonFileName}:${ensurePackageScripts()}`);
|
|
69
146
|
|
|
70
147
|
console.log(
|
|
71
|
-
`[agentic-components] Installed ${knowledgeFileName} and
|
|
148
|
+
`[agentic-components] Installed ${knowledgeFileName}, agent references, and lint build guard (${results.join(", ")}).`
|
|
72
149
|
);
|
|
73
150
|
} catch (err) {
|
|
74
151
|
// Never fail a consumer's install.
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { EmotionCache } from '@emotion/cache';
|
|
2
|
-
/**
|
|
3
|
-
* One Emotion cache per shadow root. Emotion inserts styles into the document
|
|
4
|
-
* head by default, which cannot penetrate a shadow boundary — components
|
|
5
|
-
* rendered inside a bfrs shadow root need their styles injected into that
|
|
6
|
-
* root. The cache keeps the default `css` key so generated class names are
|
|
7
|
-
* identical inside and outside shadow roots (the hash depends only on the key,
|
|
8
|
-
* styles and label — all deterministic).
|
|
9
|
-
*
|
|
10
|
-
* `compat: true` matches the tolerant serialization used for the default
|
|
11
|
-
* document cache in production; it only silences dev-time SSR heuristics that
|
|
12
|
-
* do not apply inside client-only shadow mounts.
|
|
13
|
-
*/
|
|
14
|
-
export declare function getShadowEmotionCache(shadow: ShadowRoot): EmotionCache;
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
type ShadowableComponent = ComponentType<Record<string, unknown>>;
|
|
9
|
-
export declare function withAutoShadow<C extends ShadowableComponent>(Component: C): C;
|
|
10
|
-
/**
|
|
11
|
-
* Returns a copy of a module's exports with the named leaf components auto-shadowed
|
|
12
|
-
* and everything else passed through unchanged. Only names in `include` are
|
|
13
|
-
* wrapped — container / overlay / layout components are intentionally excluded
|
|
14
|
-
* because they render the consumer's own children, which must NOT be trapped in
|
|
15
|
-
* (and isolated by) a shadow root.
|
|
16
|
-
*/
|
|
17
|
-
export declare function autoShadowModule<T extends Record<string, unknown>>(mod: T, include: ReadonlySet<string>): T;
|
|
18
|
-
export { BfrsShadowScopeContext };
|
package/dist/shadow/index.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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;
|