@blocklet/pages-kit 0.2.364 → 0.2.366

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.
Files changed (30) hide show
  1. package/lib/cjs/builtin/async/ai-runtime/components/AgentErrorBoundary.js +2 -2
  2. package/lib/cjs/builtin/async/ai-runtime/contexts/ComponentPreferences.js +7 -2
  3. package/lib/cjs/builtin/async/ai-runtime/index.js +9 -1
  4. package/lib/cjs/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +15 -2
  5. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.js +3 -3
  6. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/index.js +25 -2
  7. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.js +12 -8
  8. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +4 -2
  9. package/lib/cjs/tsconfig.tsbuildinfo +1 -1
  10. package/lib/cjs/types/index.js +1 -0
  11. package/lib/cjs/utils/inject-global-components.js +2 -0
  12. package/lib/esm/builtin/async/ai-runtime/components/AgentErrorBoundary.js +2 -2
  13. package/lib/esm/builtin/async/ai-runtime/contexts/ComponentPreferences.js +4 -2
  14. package/lib/esm/builtin/async/ai-runtime/index.js +5 -0
  15. package/lib/esm/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +15 -2
  16. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.js +4 -4
  17. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/index.js +1 -1
  18. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.js +14 -10
  19. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +4 -2
  20. package/lib/esm/tsconfig.tsbuildinfo +1 -1
  21. package/lib/esm/types/index.js +1 -0
  22. package/lib/esm/utils/inject-global-components.js +2 -0
  23. package/lib/types/builtin/async/ai-runtime/components/AgentErrorBoundary.d.ts +4 -1
  24. package/lib/types/builtin/async/ai-runtime/contexts/ComponentPreferences.d.ts +9 -3
  25. package/lib/types/builtin/async/ai-runtime/index.d.ts +5 -0
  26. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/index.d.ts +2 -2
  27. package/lib/types/builtin/async/ai-runtime/runtime-components/SimplePage/index.d.ts +5 -2
  28. package/lib/types/tsconfig.tsbuildinfo +1 -1
  29. package/lib/types/types/index.d.ts +1 -0
  30. package/package.json +11 -4
@@ -2,3 +2,4 @@ export * from './api';
2
2
  export * from './core';
3
3
  export * from './state';
4
4
  export * from './preload';
5
+ export * from './builtin';
@@ -27,6 +27,8 @@ import CustomComponentRenderer from '../components/CustomComponentRenderer';
27
27
  import { BuiltinModulesGlobalVariableName } from '../types/builtin';
28
28
  function injectGlobalComponents() {
29
29
  const win = window;
30
+ if (win[BuiltinModulesGlobalVariableName])
31
+ return;
30
32
  win[BuiltinModulesGlobalVariableName] = {
31
33
  modules: {
32
34
  '@blocklet/pages-kit/builtin/pages-kit': { CustomComponentRenderer },
@@ -1,4 +1,7 @@
1
- export default function AgentErrorBoundary(): import("react/jsx-runtime").JSX.Element;
1
+ import { ReactNode } from 'react';
2
+ export default function AgentErrorBoundary({ children }: {
3
+ children?: ReactNode;
4
+ }): import("react/jsx-runtime").JSX.Element;
2
5
  export declare function AgentErrorView({ error }: {
3
6
  error: any;
4
7
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,11 @@
1
- import { ReactNode } from 'react';
2
- export declare function ComponentPreferencesProvider<T>({ children, ...preferences }: {
1
+ import { ComponentType, ReactNode } from 'react';
2
+ export interface ComponentPreferencesBase {
3
+ hideInputFields?: string[];
4
+ autoGenerate?: boolean;
5
+ initialInputValues?: Record<string, any>;
6
+ customOutputActionsComponent?: ComponentType<{}>;
7
+ }
8
+ export default function ComponentPreferencesProvider<T extends ComponentPreferencesBase>({ children, ...preferences }: {
3
9
  children?: ReactNode;
4
10
  } & T): import("react/jsx-runtime").JSX.Element;
5
- export declare function useComponentPreferences<T>(): T | undefined;
11
+ export declare function useComponentPreferences<T>(): (T & ComponentPreferencesBase) | undefined;
@@ -1,7 +1,12 @@
1
+ export * from './contexts/ComponentPreferences';
2
+ export { default as ComponentPreferencesProvider } from './contexts/ComponentPreferences';
1
3
  export * from './contexts/CurrentAgent';
2
4
  export { default as CurrentAgentProvider } from './contexts/CurrentAgent';
3
5
  export * from './contexts/CurrentMessage';
4
6
  export { default as CurrentMessageProvider } from './contexts/CurrentMessage';
7
+ export * from './contexts/ActiveAgent';
8
+ export { default as ActiveAgentProvider } from './contexts/ActiveAgent';
9
+ export { default as useAppearances } from './hooks/use-appearances';
5
10
  export * from './state/runtime';
6
11
  export * from './state/session';
7
12
  export { default as Runtime } from './runtime/Runtime';
@@ -1,8 +1,8 @@
1
1
  import { ComponentProps } from 'react';
2
2
  import ScrollView from '../../components/ScrollView';
3
- export interface SimpleChatPreferences {
3
+ import { ComponentPreferencesBase } from '../../contexts/ComponentPreferences';
4
+ export interface SimpleChatPreferences extends ComponentPreferencesBase {
4
5
  divider?: boolean;
5
- hideHeaderMenuButton?: boolean;
6
6
  hideUserInputs?: boolean;
7
7
  hideAgentAvatar?: boolean;
8
8
  backgroundImage?: {
@@ -1,3 +1,6 @@
1
- export default function SimplePage({ resultTitle }: {
1
+ import { ComponentPreferencesBase } from '../../contexts/ComponentPreferences';
2
+ export interface SimplePagePreferences extends ComponentPreferencesBase {
3
+ }
4
+ export default function SimplePage({ resultTitle, ...preferences }: {
2
5
  resultTitle?: string;
3
- }): import("react/jsx-runtime").JSX.Element;
6
+ } & SimplePagePreferences): import("react/jsx-runtime").JSX.Element;