
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@fgv/ts-res-ui-components
Advanced tools
Reusable React components for ts-res resource visualization and management
React components for building user interfaces that work with the ts-res multidimensional resource management library.
This library provides a complete set of React components, hooks, and utilities for creating applications that visualize, manage, and interact with ts-res resource systems. It supports the full workflow from importing configurations to resolving resources with dynamic context.
This packlet is largely AI written, and it shows.
npm install @fgv/ts-res-ui-components
This library requires the following peer dependencies:
{
"@fgv/ts-res": "^5.0.0",
"@fgv/ts-utils": "^5.0.0",
"@fgv/ts-json-base": "^5.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
}
The ResourceOrchestrator
component provides centralized state management for all ts-res UI functionality:
import React from 'react';
import { ResourceOrchestrator, ImportView, SourceView } from '@fgv/ts-res-ui-components';
function App() {
return (
<ResourceOrchestrator>
{({ state, actions }) => (
<div className="min-h-screen bg-gray-50">
<div className="container mx-auto px-4 py-8">
<h1 className="text-3xl font-bold mb-8">Resource Manager</h1>
{!state.processedResources ? (
<ImportView
onImport={actions.importDirectory}
onBundleImport={actions.importBundle}
onZipImport={actions.importZipWithConfig}
/>
) : (
<SourceView
resources={state.processedResources}
onExport={actions.exportData}
/>
)}
</div>
</div>
)}
</ResourceOrchestrator>
);
}
export default App;
For more granular control, you can use individual hooks:
import React from 'react';
import { useResourceData, SourceView } from '@fgv/ts-res-ui-components';
function MyResourceViewer() {
const { state, actions } = useResourceData();
const handleFileImport = async (files: File[]) => {
const importedFiles = await processFiles(files); // Your file processing logic
await actions.processFiles(importedFiles);
};
return (
<div>
{state.isProcessing && <div>Processing...</div>}
{state.error && <div className="error">{state.error}</div>}
{state.processedResources && (
<SourceView
resources={state.processedResources}
onExport={(data) => console.log('Export:', data)}
/>
)}
</div>
);
}
ResourceOrchestrator (state management)
├── ImportView (file/bundle import)
├── SourceView (resource collection display)
├── FilterView (context filtering)
├── CompiledView (compiled resource structure)
├── ResolutionView (resource resolution testing)
├── ConfigurationView (system configuration)
└── ZipLoaderView (ZIP file handling)
ImportView
or programmaticallyProcessedResources
object containing:
ResourceManagerBuilder
for build-time operationsCompiledResourceCollection
for runtime efficiencyResourceResolver
for resource resolutionThe main orchestration component that manages all state and provides actions via render props.
<ResourceOrchestrator
initialConfiguration={myConfig}
onStateChange={(state) => console.log('State changed:', state)}
>
{({ state, actions }) => (
// Your UI components
)}
</ResourceOrchestrator>
Handles importing resource files, directories, bundles, and ZIP files.
<ImportView
onImport={actions.importDirectory}
onBundleImport={actions.importBundle}
onZipImport={actions.importZipWithConfig}
acceptedFileTypes={['.json', '.ts', '.js']}
onMessage={(type, message) => console.log(type, message)}
/>
Displays the source resource collection with search and navigation capabilities.
<SourceView
resources={state.processedResources}
selectedResourceId={selectedId}
onResourceSelect={setSelectedId}
onExport={actions.exportData}
/>
Provides filtering capabilities with context value specification.
<FilterView
resources={state.processedResources}
filterState={filterState}
filterActions={filterActions}
filterResult={filterResult}
onFilterResult={setFilterResult}
/>
Shows the compiled resource structure with detailed candidate information.
<CompiledView
resources={state.processedResources}
filterResult={filterResult}
useNormalization={true}
onExport={(data, type) => exportData(data, type)}
/>
Interactive resource resolution testing with context management.
<ResolutionView
resources={state.processedResources}
resolutionState={resolutionState}
resolutionActions={resolutionActions}
availableQualifiers={availableQualifiers}
/>
Visual configuration management for the ts-res system.
<ConfigurationView
configuration={state.activeConfiguration}
onConfigurationChange={actions.applyConfiguration}
onMessage={(type, msg) => showMessage(type, msg)}
/>
Main hook for resource processing and management.
const { state, actions } = useResourceData();
// Process files
await actions.processFiles(importedFiles);
// Resolve a resource
const result = await actions.resolveResource('my.resource', {
language: 'en-US',
environment: 'production'
});
// Apply configuration
actions.applyConfiguration(newConfig);
Manages resource filtering state and actions.
const { filterState, filterActions } = useFilterState();
// Update filter values
filterActions.updateFilterValues({
language: 'en-US',
environment: 'prod'
});
// Apply filters
filterActions.applyFilterValues();
// Check if there are pending changes
if (filterState.hasPendingChanges) {
// Show save prompt
}
Manages resource resolution testing state.
const { state, actions } = useResolutionState(processedResources);
// Set context for resolution testing
actions.setContextValues({ language: 'en-US' });
// Test resource resolution
const result = await actions.resolveResource('test.resource');
Manages system configuration state.
const { configuration, updateConfiguration, resetConfiguration } = useConfigurationState();
// Update qualifier types
updateConfiguration({
...configuration,
qualifierTypes: [...newQualifierTypes]
});
This library uses Tailwind CSS for styling. Make sure to include Tailwind CSS in your project:
npm install -D tailwindcss
Add the library's source files to your Tailwind content configuration:
// tailwind.config.js
module.exports = {
content: [
'./src/**/*.{js,jsx,ts,tsx}',
'./node_modules/@fgv/ts-res-ui-components/**/*.{js,jsx,ts,tsx}'
],
theme: {
extend: {},
},
plugins: [],
}
All components accept a className
prop for custom styling:
<SourceView
className="my-custom-class"
resources={resources}
/>
import { processImportedDirectory, createTsResSystemFromConfig } from '@fgv/ts-res-ui-components';
// Custom processing pipeline
const customProcessor = async (files: ImportedFile[]) => {
// Pre-process files
const processedFiles = files.map(transformFile);
// Create configuration
const config = await createConfigFromFiles(processedFiles);
// Create ts-res system
const system = await createTsResSystemFromConfig(config);
return system;
};
const { state, actions } = useResourceData();
// Complex context resolution
const resolveWithComplexContext = async (resourceId: string) => {
const context = {
language: getUserLanguage(),
region: getUserRegion(),
theme: getThemePreference(),
featureFlags: await getFeatureFlags()
};
return await actions.resolveResource(resourceId, context);
};
const { state, actions } = useResourceData();
// Create and export bundle
const exportBundle = async () => {
if (state.processedResources) {
const bundleData = {
...state.processedResources.compiledCollection,
metadata: {
version: '1.0.0',
created: new Date().toISOString(),
description: 'My resource bundle'
}
};
actions.exportData(bundleData, 'bundle');
}
};
The library provides comprehensive error handling through the state management system:
<ResourceOrchestrator>
{({ state, actions }) => (
<div>
{state.error && (
<div className="bg-red-50 border border-red-200 rounded p-4 mb-4">
<h3 className="text-red-800 font-medium">Error</h3>
<p className="text-red-600">{state.error}</p>
<button
onClick={actions.clearError}
className="mt-2 px-3 py-1 bg-red-600 text-white rounded text-sm"
>
Dismiss
</button>
</div>
)}
{/* Rest of your UI */}
</div>
)}
</ResourceOrchestrator>
This library is written in TypeScript and provides comprehensive type definitions:
import type {
ProcessedResources,
FilterState,
ResolutionResult,
Message,
ImportedFile
} from '@fgv/ts-res-ui-components';
// Type-safe component props
interface MyComponentProps {
resources: ProcessedResources;
onMessage: (type: Message['type'], message: string) => void;
}
const MyComponent: React.FC<MyComponentProps> = ({ resources, onMessage }) => {
// Component implementation
};
npm run build
npm test
npm run lint
MIT License - see LICENSE file for details.
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
For questions and support, please:
FAQs
Reusable React components for ts-res resource visualization and management
The npm package @fgv/ts-res-ui-components receives a total of 217 weekly downloads. As such, @fgv/ts-res-ui-components popularity was classified as not popular.
We found that @fgv/ts-res-ui-components demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.