@almadar/ui 1.0.34 → 2.0.1
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/LICENSE +21 -72
- package/dist/components/atoms/Avatar.d.ts +58 -0
- package/dist/components/atoms/Badge.d.ts +8 -0
- package/dist/components/atoms/Box.d.ts +57 -0
- package/dist/components/atoms/Button.d.ts +24 -0
- package/dist/components/atoms/Card.d.ts +18 -0
- package/dist/components/atoms/Center.d.ts +33 -0
- package/dist/components/atoms/Checkbox.d.ts +5 -0
- package/dist/components/atoms/ConditionalWrapper.d.ts +68 -0
- package/dist/components/atoms/Divider.d.ts +29 -0
- package/dist/components/atoms/Icon.d.ts +38 -0
- package/dist/components/atoms/Input.d.ts +26 -0
- package/dist/components/atoms/Label.d.ts +5 -0
- package/dist/components/atoms/LawReferenceTooltip.d.ts +48 -0
- package/dist/components/atoms/Overlay.d.ts +16 -0
- package/dist/components/atoms/ProgressBar.d.ts +63 -0
- package/dist/components/atoms/Radio.d.ts +26 -0
- package/dist/components/atoms/Select.d.ts +12 -0
- package/dist/components/atoms/Spacer.d.ts +25 -0
- package/dist/components/atoms/Spinner.d.ts +6 -0
- package/dist/components/atoms/Stack.d.ts +64 -0
- package/dist/components/atoms/Switch.d.ts +12 -0
- package/dist/components/atoms/TextHighlight.d.ts +53 -0
- package/dist/components/atoms/Textarea.d.ts +5 -0
- package/dist/components/atoms/ThemeSelector.d.ts +21 -0
- package/dist/components/atoms/ThemeToggle.d.ts +33 -0
- package/dist/components/atoms/Typography.d.ts +57 -0
- package/dist/components/atoms/game/ControlButton.d.ts +31 -0
- package/dist/components/atoms/game/HealthBar.d.ts +18 -0
- package/dist/components/atoms/game/ScoreDisplay.d.ts +21 -0
- package/dist/components/atoms/game/Sprite.d.ts +63 -0
- package/dist/components/atoms/game/StateIndicator.d.ts +31 -0
- package/dist/components/atoms/game/index.d.ts +12 -0
- package/dist/components/atoms/index.d.ts +27 -0
- package/dist/components/index.css +11 -9
- package/dist/components/index.d.ts +6 -6951
- package/dist/components/index.js +5 -5
- package/dist/components/molecules/Accordion.d.ts +67 -0
- package/dist/components/molecules/Alert.d.ts +24 -0
- package/dist/components/molecules/Breadcrumb.d.ts +55 -0
- package/dist/components/molecules/ButtonGroup.d.ts +67 -0
- package/dist/components/molecules/Card.d.ts +44 -0
- package/dist/components/molecules/Container.d.ts +30 -0
- package/dist/components/molecules/Drawer.d.ts +46 -0
- package/dist/components/molecules/EmptyState.d.ts +25 -0
- package/dist/components/molecules/ErrorBoundary.d.ts +55 -0
- package/dist/components/molecules/ErrorState.d.ts +13 -0
- package/dist/components/molecules/FilterGroup.d.ts +54 -0
- package/dist/components/molecules/Flex.d.ts +43 -0
- package/dist/components/molecules/FloatingActionButton.d.ts +69 -0
- package/dist/components/molecules/FormField.d.ts +16 -0
- package/dist/components/molecules/FormSectionHeader.d.ts +30 -0
- package/dist/components/molecules/Grid.d.ts +54 -0
- package/dist/components/molecules/InputGroup.d.ts +24 -0
- package/dist/components/molecules/LoadingState.d.ts +7 -0
- package/dist/components/molecules/Menu.d.ts +40 -0
- package/dist/components/molecules/Modal.d.ts +26 -0
- package/dist/components/molecules/Pagination.d.ts +66 -0
- package/dist/components/molecules/Popover.d.ts +39 -0
- package/dist/components/molecules/QuizBlock.d.ts +20 -0
- package/dist/components/molecules/RelationSelect.d.ts +48 -0
- package/dist/components/molecules/RepeatableFormSection.d.ts +58 -0
- package/dist/components/molecules/ScaledDiagram.d.ts +20 -0
- package/dist/components/molecules/SearchInput.d.ts +60 -0
- package/dist/components/molecules/SidePanel.d.ts +47 -0
- package/dist/components/molecules/SimpleGrid.d.ts +27 -0
- package/dist/components/molecules/Skeleton.d.ts +35 -0
- package/dist/components/molecules/Tabs.d.ts +45 -0
- package/dist/components/molecules/Toast.d.ts +35 -0
- package/dist/components/molecules/Tooltip.d.ts +25 -0
- package/dist/components/molecules/ViolationAlert.d.ts +49 -0
- package/dist/components/molecules/WizardNavigation.d.ts +51 -0
- package/dist/components/molecules/WizardProgress.d.ts +42 -0
- package/dist/components/molecules/game/StatBadge.d.ts +27 -0
- package/dist/components/molecules/index.d.ts +38 -0
- package/dist/components/molecules/markdown/CodeBlock.d.ts +25 -0
- package/dist/components/molecules/markdown/MarkdownContent.d.ts +26 -0
- package/dist/components/organisms/CardGrid.d.ts +72 -0
- package/dist/components/organisms/Chart.d.ts +59 -0
- package/dist/components/organisms/CodeViewer.d.ts +67 -0
- package/dist/components/organisms/ComponentPatterns.d.ts +441 -0
- package/dist/components/organisms/ConfirmDialog.d.ts +50 -0
- package/dist/components/organisms/ContentRenderer.d.ts +23 -0
- package/dist/components/organisms/CustomPattern.d.ts +104 -0
- package/dist/components/organisms/DataTable.d.ts +63 -0
- package/dist/components/organisms/DetailPanel.d.ts +71 -0
- package/dist/components/organisms/DocumentViewer.d.ts +60 -0
- package/dist/components/organisms/DrawerSlot.d.ts +39 -0
- package/dist/components/organisms/Form.d.ts +203 -0
- package/dist/components/organisms/FormSection.d.ts +59 -0
- package/dist/components/organisms/GraphCanvas.d.ts +69 -0
- package/dist/components/organisms/Header.d.ts +110 -0
- package/dist/components/organisms/JazariStateMachine.d.ts +60 -0
- package/dist/components/organisms/LayoutPatterns.d.ts +181 -0
- package/dist/components/organisms/List.d.ts +76 -0
- package/dist/components/organisms/MasterDetail.d.ts +43 -0
- package/dist/components/organisms/MediaGallery.d.ts +66 -0
- package/dist/components/organisms/Meter.d.ts +58 -0
- package/dist/components/organisms/ModalSlot.d.ts +35 -0
- package/dist/components/organisms/Navigation.d.ts +68 -0
- package/dist/components/organisms/OrbitalVisualization.d.ts +48 -0
- package/dist/components/organisms/PageHeader.d.ts +59 -0
- package/dist/components/organisms/Section.d.ts +44 -0
- package/dist/components/organisms/Sidebar.d.ts +65 -0
- package/dist/components/organisms/SignaturePad.d.ts +44 -0
- package/dist/components/organisms/Split.d.ts +42 -0
- package/dist/components/organisms/StatCard.d.ts +66 -0
- package/dist/components/organisms/StateMachineView.d.ts +36 -0
- package/dist/components/organisms/Table.d.ts +99 -0
- package/dist/components/organisms/Timeline.d.ts +58 -0
- package/dist/components/organisms/ToastSlot.d.ts +38 -0
- package/dist/components/organisms/UISlotRenderer.d.ts +112 -0
- package/dist/components/organisms/WizardContainer.d.ts +160 -0
- package/dist/components/organisms/book/BookChapterView.d.ts +17 -0
- package/dist/components/organisms/book/BookCoverPage.d.ts +19 -0
- package/dist/components/organisms/book/BookNavBar.d.ts +18 -0
- package/dist/components/organisms/book/BookTableOfContents.d.ts +18 -0
- package/dist/components/organisms/book/BookViewer.d.ts +28 -0
- package/dist/components/organisms/book/index.d.ts +7 -0
- package/dist/components/organisms/book/types.d.ts +77 -0
- package/dist/components/organisms/game/BattleBoard.d.ts +167 -0
- package/dist/components/organisms/game/CanvasEffect.d.ts +68 -0
- package/dist/components/organisms/game/CastleBoard.d.ts +85 -0
- package/dist/components/organisms/game/DialogueBox.d.ts +73 -0
- package/dist/components/organisms/game/GameAudioProvider.d.ts +47 -0
- package/dist/components/organisms/game/GameAudioToggle.d.ts +28 -0
- package/dist/components/organisms/game/GameHud.d.ts +40 -0
- package/dist/components/organisms/game/GameMenu.d.ts +43 -0
- package/dist/components/organisms/game/GameOverScreen.d.ts +56 -0
- package/dist/components/organisms/game/InventoryPanel.d.ts +67 -0
- package/dist/components/organisms/game/IsometricCanvas.d.ts +123 -0
- package/dist/components/organisms/game/TraitSlot.d.ts +86 -0
- package/dist/components/organisms/game/TraitStateViewer.d.ts +53 -0
- package/dist/components/organisms/game/UncontrolledBattleBoard.d.ts +26 -0
- package/dist/components/organisms/game/WorldMapBoard.d.ts +147 -0
- package/dist/components/organisms/game/editor/editorUtils.d.ts +109 -0
- package/dist/components/organisms/game/editor/index.d.ts +9 -0
- package/dist/components/organisms/game/hooks/useBattleState.d.ts +35 -0
- package/dist/components/organisms/game/hooks/useCamera.d.ts +41 -0
- package/dist/components/organisms/game/hooks/useGameAudio.d.ts +47 -0
- package/dist/components/organisms/game/hooks/useImageCache.d.ts +16 -0
- package/dist/components/organisms/game/hooks/usePhysics2D.d.ts +45 -0
- package/dist/components/organisms/game/hooks/useSpriteAnimations.d.ts +43 -0
- package/dist/components/organisms/game/index.d.ts +36 -0
- package/dist/components/organisms/game/managers/PhysicsManager.d.ts +103 -0
- package/dist/components/organisms/game/types/effects.d.ts +253 -0
- package/dist/{isometric-ynNHVPZx.d.ts → components/organisms/game/types/isometric.d.ts} +4 -6
- package/dist/components/organisms/game/types/spriteAnimation.d.ts +73 -0
- package/dist/components/organisms/game/utils/canvasEffects.d.ts +50 -0
- package/dist/components/organisms/game/utils/combatPresets.d.ts +15 -0
- package/dist/components/organisms/game/utils/isometric.d.ts +61 -0
- package/dist/components/organisms/game/utils/spriteAnimation.d.ts +57 -0
- package/dist/components/organisms/game/utils/spriteSheetConstants.d.ts +16 -0
- package/dist/components/organisms/index.d.ts +37 -0
- package/dist/components/organisms/layout/DashboardGrid.d.ts +34 -0
- package/dist/components/organisms/layout/MasterDetail.d.ts +32 -0
- package/dist/components/organisms/layout/SplitPane.d.ts +34 -0
- package/dist/components/organisms/layout/TabbedContainer.d.ts +42 -0
- package/dist/components/organisms/layout/index.d.ts +9 -0
- package/dist/components/organisms/types.d.ts +65 -0
- package/dist/components/templates/AuthLayout.d.ts +14 -0
- package/dist/components/templates/BattleTemplate.d.ts +25 -0
- package/dist/components/templates/CastleTemplate.d.ts +23 -0
- package/dist/components/templates/CounterTemplate.d.ts +44 -0
- package/dist/components/templates/DashboardLayout.d.ts +32 -0
- package/dist/components/templates/GameShell.d.ts +33 -0
- package/dist/components/templates/GameTemplate.d.ts +36 -0
- package/dist/components/templates/GenericAppTemplate.d.ts +30 -0
- package/dist/components/templates/WorldMapTemplate.d.ts +29 -0
- package/dist/components/templates/index.d.ts +10 -0
- package/dist/components/templates/types.d.ts +17 -0
- package/dist/context/DesignThemeContext.d.ts +21 -0
- package/dist/{ThemeContext-D9xUORq5.d.ts → context/ThemeContext.d.ts} +15 -16
- package/dist/context/UISlotContext.d.ts +75 -0
- package/dist/context/UserContext.d.ts +111 -0
- package/dist/context/index.d.ts +6 -206
- package/dist/{event-bus-types-CjJduURa.d.ts → hooks/event-bus-types.d.ts} +4 -6
- package/dist/hooks/index.d.ts +24 -1090
- package/dist/hooks/useAgentChat.d.ts +104 -0
- package/dist/hooks/useAuthContext.d.ts +25 -0
- package/dist/hooks/useCompile.d.ts +22 -0
- package/dist/hooks/useDeepAgentGeneration.d.ts +46 -0
- package/dist/hooks/useEntities.d.ts +52 -0
- package/dist/hooks/useEntityData.d.ts +155 -0
- package/dist/hooks/useEntityMutations.d.ts +80 -0
- package/dist/hooks/useEventBus.d.ts +96 -0
- package/dist/hooks/useExtensions.d.ts +32 -0
- package/dist/hooks/useFileEditor.d.ts +32 -0
- package/dist/hooks/useFileSystem.d.ts +40 -0
- package/dist/hooks/useGitHub.d.ts +58 -0
- package/dist/hooks/useOrbitalHistory.d.ts +39 -0
- package/dist/hooks/useOrbitalMutations.d.ts +95 -0
- package/dist/hooks/usePreview.d.ts +57 -0
- package/dist/hooks/useQuerySingleton.d.ts +78 -0
- package/dist/hooks/useResolvedEntity.d.ts +32 -0
- package/dist/hooks/useTranslate.d.ts +35 -0
- package/dist/hooks/useUIEvents.d.ts +35 -0
- package/dist/{useUISlots-D0mttBSP.d.ts → hooks/useUISlots.d.ts} +8 -9
- package/dist/hooks/useValidation.d.ts +46 -0
- package/dist/lib/api-client.d.ts +42 -0
- package/dist/lib/cn.d.ts +6 -0
- package/dist/lib/debug.d.ts +43 -0
- package/dist/lib/debugRegistry.d.ts +29 -0
- package/dist/lib/debugUtils.d.ts +27 -0
- package/dist/lib/entityDebug.d.ts +38 -0
- package/dist/lib/getNestedValue.d.ts +33 -0
- package/dist/lib/guardRegistry.d.ts +32 -0
- package/dist/lib/index.d.ts +17 -426
- package/dist/lib/jazari/svg-paths.d.ts +61 -0
- package/dist/lib/parseContentSegments.d.ts +41 -0
- package/dist/lib/tickRegistry.d.ts +40 -0
- package/dist/lib/traitRegistry.d.ts +34 -0
- package/dist/lib/verificationRegistry.d.ts +107 -0
- package/dist/{cn-BoBXsxuX.d.ts → lib/visualizer/index.d.ts} +18 -69
- package/dist/locales/index.d.ts +5 -7
- package/dist/providers/EventBusProvider.d.ts +60 -0
- package/dist/providers/FetchedDataProvider.d.ts +105 -0
- package/dist/providers/OfflineModeProvider.d.ts +79 -0
- package/dist/providers/OrbitalProvider.d.ts +101 -0
- package/dist/providers/SelectionProvider.d.ts +81 -0
- package/dist/providers/VerificationProvider.d.ts +63 -0
- package/dist/providers/index.css +11 -9
- package/dist/providers/index.d.ts +16 -464
- package/dist/providers/index.js +3 -3
- package/dist/renderer/client-effect-executor.d.ts +68 -0
- package/dist/renderer/data-resolver.d.ts +68 -0
- package/dist/renderer/index.d.ts +22 -519
- package/dist/renderer/index.js +1 -1
- package/dist/renderer/init.d.ts +14 -0
- package/dist/renderer/navigation.d.ts +142 -0
- package/dist/{offline-executor-CHr4uAhf.d.ts → renderer/offline-executor.d.ts} +9 -172
- package/dist/renderer/pattern-resolver.d.ts +91 -0
- package/dist/renderer/slot-definitions.d.ts +45 -0
- package/dist/renderer/types.d.ts +160 -0
- package/dist/renderer/useClientEffects.d.ts +88 -0
- package/dist/stores/entityStore.d.ts +99 -0
- package/dist/stores/filtering.d.ts +51 -0
- package/dist/stores/index.d.ts +4 -148
- package/package.json +12 -10
- package/dist/components/organisms/game/three/index.d.ts +0 -1162
- package/dist/{chunk-FZJ73RDM.js → chunk-RIZ76XRF.js} +1 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { ClientEffect, ClientEffectExecutorConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Options for the useClientEffects hook
|
|
4
|
+
*/
|
|
5
|
+
export interface UseClientEffectsOptions extends ClientEffectExecutorConfig {
|
|
6
|
+
/**
|
|
7
|
+
* Whether to execute effects. Defaults to true.
|
|
8
|
+
* Set to false to temporarily disable effect execution.
|
|
9
|
+
*/
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Debug mode - logs effect execution details.
|
|
13
|
+
*/
|
|
14
|
+
debug?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Result of useClientEffects hook
|
|
18
|
+
*/
|
|
19
|
+
export interface UseClientEffectsResult {
|
|
20
|
+
/**
|
|
21
|
+
* Number of effects executed in the last batch.
|
|
22
|
+
*/
|
|
23
|
+
executedCount: number;
|
|
24
|
+
/**
|
|
25
|
+
* Whether effects are currently being executed.
|
|
26
|
+
*/
|
|
27
|
+
executing: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Manually trigger effect execution.
|
|
30
|
+
* Useful for imperative control.
|
|
31
|
+
*/
|
|
32
|
+
execute: (effects: ClientEffect[]) => void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Execute client effects from server response.
|
|
36
|
+
*
|
|
37
|
+
* This hook automatically executes effects when they change,
|
|
38
|
+
* tracking which effects have been executed to prevent duplicates.
|
|
39
|
+
*
|
|
40
|
+
* @param effects - Array of client effects to execute (from server response)
|
|
41
|
+
* @param options - Configuration including effect implementations
|
|
42
|
+
* @returns Hook result with execution state and manual trigger
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* function useMyTrait() {
|
|
47
|
+
* const [state, setState] = useState({ pendingEffects: [] });
|
|
48
|
+
* const effectConfig = useClientEffectConfig();
|
|
49
|
+
*
|
|
50
|
+
* useClientEffects(state.pendingEffects, {
|
|
51
|
+
* ...effectConfig,
|
|
52
|
+
* onComplete: () => setState(s => ({ ...s, pendingEffects: [] }))
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* // ...
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare function useClientEffects(effects: ClientEffect[] | undefined, options: UseClientEffectsOptions): UseClientEffectsResult;
|
|
60
|
+
declare const ClientEffectConfigContext: import("react").Context<ClientEffectExecutorConfig | null>;
|
|
61
|
+
/**
|
|
62
|
+
* Provider for client effect configuration.
|
|
63
|
+
*/
|
|
64
|
+
export declare const ClientEffectConfigProvider: import("react").Provider<ClientEffectExecutorConfig | null>;
|
|
65
|
+
/**
|
|
66
|
+
* Hook to get the client effect configuration from context.
|
|
67
|
+
*
|
|
68
|
+
* @throws Error if used outside of ClientEffectConfigProvider
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* function MyTraitHook() {
|
|
73
|
+
* const effectConfig = useClientEffectConfig();
|
|
74
|
+
*
|
|
75
|
+
* useClientEffects(pendingEffects, {
|
|
76
|
+
* ...effectConfig,
|
|
77
|
+
* onComplete: () => clearPendingEffects()
|
|
78
|
+
* });
|
|
79
|
+
* }
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export declare function useClientEffectConfig(): ClientEffectExecutorConfig;
|
|
83
|
+
/**
|
|
84
|
+
* Hook to get client effect configuration, returning null if not available.
|
|
85
|
+
* Use this for optional integration where effects may not be configured.
|
|
86
|
+
*/
|
|
87
|
+
export declare function useClientEffectConfigOptional(): ClientEffectExecutorConfig | null;
|
|
88
|
+
export { ClientEffectConfigContext };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entity Store
|
|
3
|
+
*
|
|
4
|
+
* Simple module-level store for runtime entities.
|
|
5
|
+
* No providers needed - hooks import and use directly.
|
|
6
|
+
*
|
|
7
|
+
* NOTE: Mutations create new Map instances to trigger React rerenders
|
|
8
|
+
* when using useSyncExternalStore.
|
|
9
|
+
*/
|
|
10
|
+
import { type EntityFilterValue, type FilterOperator, type EntityFilters, applyFilters, createFilter } from './filtering';
|
|
11
|
+
export type { EntityFilterValue, FilterOperator, EntityFilters };
|
|
12
|
+
export { applyFilters, createFilter };
|
|
13
|
+
export interface Entity {
|
|
14
|
+
id: string;
|
|
15
|
+
type: string;
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
type Listener = () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Subscribe to store changes
|
|
21
|
+
*/
|
|
22
|
+
export declare function subscribe(listener: Listener): () => void;
|
|
23
|
+
/**
|
|
24
|
+
* Get all entities
|
|
25
|
+
*/
|
|
26
|
+
export declare function getEntities(): Map<string, Entity>;
|
|
27
|
+
/**
|
|
28
|
+
* Get entity by ID
|
|
29
|
+
*/
|
|
30
|
+
export declare function getEntity(id: string): Entity | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Get entities by type
|
|
33
|
+
*/
|
|
34
|
+
export declare function getByType(type: string | string[]): Entity[];
|
|
35
|
+
/**
|
|
36
|
+
* Get all entities as array
|
|
37
|
+
*/
|
|
38
|
+
export declare function getAllEntities(): Entity[];
|
|
39
|
+
/**
|
|
40
|
+
* Get singleton entity by type (first of that type)
|
|
41
|
+
*/
|
|
42
|
+
export declare function getSingleton(type: string): Entity | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Spawn a new entity
|
|
45
|
+
*/
|
|
46
|
+
export declare function spawnEntity(config: {
|
|
47
|
+
type: string;
|
|
48
|
+
id?: string;
|
|
49
|
+
[key: string]: unknown;
|
|
50
|
+
}): string;
|
|
51
|
+
/**
|
|
52
|
+
* Update an entity
|
|
53
|
+
*/
|
|
54
|
+
export declare function updateEntity(id: string, updates: Partial<Entity>): void;
|
|
55
|
+
/**
|
|
56
|
+
* Update singleton entity by type
|
|
57
|
+
*/
|
|
58
|
+
export declare function updateSingleton(type: string, updates: Partial<Entity>): void;
|
|
59
|
+
/**
|
|
60
|
+
* Remove an entity
|
|
61
|
+
*/
|
|
62
|
+
export declare function removeEntity(id: string): void;
|
|
63
|
+
/**
|
|
64
|
+
* Clear all entities
|
|
65
|
+
*/
|
|
66
|
+
export declare function clearEntities(): void;
|
|
67
|
+
/**
|
|
68
|
+
* Set a filter for an entity type
|
|
69
|
+
* @param entityType - The entity type to filter (e.g., "Player", "Enemy")
|
|
70
|
+
* @param field - The filter key (e.g., 'status' or 'date_from')
|
|
71
|
+
* @param value - The filter value
|
|
72
|
+
* @param operator - The comparison operator
|
|
73
|
+
* @param targetField - The actual record field to compare (defaults to field)
|
|
74
|
+
*/
|
|
75
|
+
export declare function setFilter(entityType: string, field: string, value: unknown, operator?: FilterOperator, targetField?: string): void;
|
|
76
|
+
/**
|
|
77
|
+
* Clear a specific filter
|
|
78
|
+
*/
|
|
79
|
+
export declare function clearFilter(entityType: string, field: string): void;
|
|
80
|
+
/**
|
|
81
|
+
* Clear all filters for an entity type
|
|
82
|
+
*/
|
|
83
|
+
export declare function clearAllFilters(entityType: string): void;
|
|
84
|
+
/**
|
|
85
|
+
* Get active filters for an entity type
|
|
86
|
+
*/
|
|
87
|
+
export declare function getFilters(entityType: string): EntityFilters;
|
|
88
|
+
/**
|
|
89
|
+
* Get entities by type with optional filtering
|
|
90
|
+
*/
|
|
91
|
+
export declare function getByTypeFiltered(type: string | string[]): Entity[];
|
|
92
|
+
/**
|
|
93
|
+
* Get snapshot for React useSyncExternalStore
|
|
94
|
+
*/
|
|
95
|
+
export declare function getSnapshot(): Map<string, Entity>;
|
|
96
|
+
/**
|
|
97
|
+
* Get filter snapshot for React useSyncExternalStore
|
|
98
|
+
*/
|
|
99
|
+
export declare function getFilterSnapshot(): Map<string, EntityFilters>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entity Filtering Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides filter types and utility functions for filtering entity records.
|
|
5
|
+
* Used by EntityStore and can be imported by runtime preview.
|
|
6
|
+
*/
|
|
7
|
+
/** Filter value for a single field (entity filtering) */
|
|
8
|
+
export interface EntityFilterValue {
|
|
9
|
+
/** The field key (may include suffix like _from, _to for date ranges) */
|
|
10
|
+
field: string;
|
|
11
|
+
/** The actual record field to compare against (defaults to field if not specified) */
|
|
12
|
+
targetField?: string;
|
|
13
|
+
value: unknown;
|
|
14
|
+
/** Comparison operator for filtering
|
|
15
|
+
* - eq: exact match (default)
|
|
16
|
+
* - contains: substring match for strings
|
|
17
|
+
* - in: value is in array
|
|
18
|
+
* - date_eq: same date (ignoring time)
|
|
19
|
+
* - date_gte: on or after date
|
|
20
|
+
* - date_lte: on or before date
|
|
21
|
+
*/
|
|
22
|
+
operator?: FilterOperator;
|
|
23
|
+
}
|
|
24
|
+
/** Operator type for filter */
|
|
25
|
+
export type FilterOperator = 'eq' | 'contains' | 'in' | 'date_eq' | 'date_gte' | 'date_lte' | 'search';
|
|
26
|
+
/** Filter state for an entity - Map of field key to filter value */
|
|
27
|
+
export type EntityFilters = Map<string, EntityFilterValue>;
|
|
28
|
+
/** Record type that can be filtered */
|
|
29
|
+
export interface FilterableRecord {
|
|
30
|
+
id: string;
|
|
31
|
+
[key: string]: unknown;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Extract date part from ISO string or Date object.
|
|
35
|
+
* Returns format: "YYYY-MM-DD"
|
|
36
|
+
*/
|
|
37
|
+
export declare function getDateString(value: unknown): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Apply a single filter to check if a record matches.
|
|
40
|
+
* Returns true if the record passes the filter.
|
|
41
|
+
*/
|
|
42
|
+
export declare function matchesFilter(record: FilterableRecord, filter: EntityFilterValue): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Apply all filters to a list of records.
|
|
45
|
+
* Returns only records that match ALL filters.
|
|
46
|
+
*/
|
|
47
|
+
export declare function applyFilters<T extends FilterableRecord>(records: T[], entityFilters: EntityFilters): T[];
|
|
48
|
+
/**
|
|
49
|
+
* Create a filter value with proper defaults.
|
|
50
|
+
*/
|
|
51
|
+
export declare function createFilter(field: string, value: unknown, operator?: FilterOperator, targetField?: string): EntityFilterValue;
|
package/dist/stores/index.d.ts
CHANGED
|
@@ -1,151 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Stores
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* Used by EntityStore and can be imported by runtime preview.
|
|
4
|
+
* Module-level state management for entities and filtering.
|
|
6
5
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/** The field key (may include suffix like _from, _to for date ranges) */
|
|
10
|
-
field: string;
|
|
11
|
-
/** The actual record field to compare against (defaults to field if not specified) */
|
|
12
|
-
targetField?: string;
|
|
13
|
-
value: unknown;
|
|
14
|
-
/** Comparison operator for filtering
|
|
15
|
-
* - eq: exact match (default)
|
|
16
|
-
* - contains: substring match for strings
|
|
17
|
-
* - in: value is in array
|
|
18
|
-
* - date_eq: same date (ignoring time)
|
|
19
|
-
* - date_gte: on or after date
|
|
20
|
-
* - date_lte: on or before date
|
|
21
|
-
*/
|
|
22
|
-
operator?: FilterOperator;
|
|
23
|
-
}
|
|
24
|
-
/** Operator type for filter */
|
|
25
|
-
type FilterOperator = 'eq' | 'contains' | 'in' | 'date_eq' | 'date_gte' | 'date_lte' | 'search';
|
|
26
|
-
/** Filter state for an entity - Map of field key to filter value */
|
|
27
|
-
type EntityFilters = Map<string, EntityFilterValue>;
|
|
28
|
-
/** Record type that can be filtered */
|
|
29
|
-
interface FilterableRecord {
|
|
30
|
-
id: string;
|
|
31
|
-
[key: string]: unknown;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Extract date part from ISO string or Date object.
|
|
35
|
-
* Returns format: "YYYY-MM-DD"
|
|
36
|
-
*/
|
|
37
|
-
declare function getDateString(value: unknown): string | null;
|
|
38
|
-
/**
|
|
39
|
-
* Apply a single filter to check if a record matches.
|
|
40
|
-
* Returns true if the record passes the filter.
|
|
41
|
-
*/
|
|
42
|
-
declare function matchesFilter(record: FilterableRecord, filter: EntityFilterValue): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Apply all filters to a list of records.
|
|
45
|
-
* Returns only records that match ALL filters.
|
|
46
|
-
*/
|
|
47
|
-
declare function applyFilters<T extends FilterableRecord>(records: T[], entityFilters: EntityFilters): T[];
|
|
48
|
-
/**
|
|
49
|
-
* Create a filter value with proper defaults.
|
|
50
|
-
*/
|
|
51
|
-
declare function createFilter(field: string, value: unknown, operator?: FilterOperator, targetField?: string): EntityFilterValue;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Entity Store
|
|
55
|
-
*
|
|
56
|
-
* Simple module-level store for runtime entities.
|
|
57
|
-
* No providers needed - hooks import and use directly.
|
|
58
|
-
*
|
|
59
|
-
* NOTE: Mutations create new Map instances to trigger React rerenders
|
|
60
|
-
* when using useSyncExternalStore.
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
interface Entity {
|
|
64
|
-
id: string;
|
|
65
|
-
type: string;
|
|
66
|
-
[key: string]: unknown;
|
|
67
|
-
}
|
|
68
|
-
type Listener = () => void;
|
|
69
|
-
/**
|
|
70
|
-
* Subscribe to store changes
|
|
71
|
-
*/
|
|
72
|
-
declare function subscribe(listener: Listener): () => void;
|
|
73
|
-
/**
|
|
74
|
-
* Get all entities
|
|
75
|
-
*/
|
|
76
|
-
declare function getEntities(): Map<string, Entity>;
|
|
77
|
-
/**
|
|
78
|
-
* Get entity by ID
|
|
79
|
-
*/
|
|
80
|
-
declare function getEntity(id: string): Entity | undefined;
|
|
81
|
-
/**
|
|
82
|
-
* Get entities by type
|
|
83
|
-
*/
|
|
84
|
-
declare function getByType(type: string | string[]): Entity[];
|
|
85
|
-
/**
|
|
86
|
-
* Get all entities as array
|
|
87
|
-
*/
|
|
88
|
-
declare function getAllEntities(): Entity[];
|
|
89
|
-
/**
|
|
90
|
-
* Get singleton entity by type (first of that type)
|
|
91
|
-
*/
|
|
92
|
-
declare function getSingleton(type: string): Entity | undefined;
|
|
93
|
-
/**
|
|
94
|
-
* Spawn a new entity
|
|
95
|
-
*/
|
|
96
|
-
declare function spawnEntity(config: {
|
|
97
|
-
type: string;
|
|
98
|
-
id?: string;
|
|
99
|
-
[key: string]: unknown;
|
|
100
|
-
}): string;
|
|
101
|
-
/**
|
|
102
|
-
* Update an entity
|
|
103
|
-
*/
|
|
104
|
-
declare function updateEntity(id: string, updates: Partial<Entity>): void;
|
|
105
|
-
/**
|
|
106
|
-
* Update singleton entity by type
|
|
107
|
-
*/
|
|
108
|
-
declare function updateSingleton(type: string, updates: Partial<Entity>): void;
|
|
109
|
-
/**
|
|
110
|
-
* Remove an entity
|
|
111
|
-
*/
|
|
112
|
-
declare function removeEntity(id: string): void;
|
|
113
|
-
/**
|
|
114
|
-
* Clear all entities
|
|
115
|
-
*/
|
|
116
|
-
declare function clearEntities(): void;
|
|
117
|
-
/**
|
|
118
|
-
* Set a filter for an entity type
|
|
119
|
-
* @param entityType - The entity type to filter (e.g., "Player", "Enemy")
|
|
120
|
-
* @param field - The filter key (e.g., 'status' or 'date_from')
|
|
121
|
-
* @param value - The filter value
|
|
122
|
-
* @param operator - The comparison operator
|
|
123
|
-
* @param targetField - The actual record field to compare (defaults to field)
|
|
124
|
-
*/
|
|
125
|
-
declare function setFilter(entityType: string, field: string, value: unknown, operator?: FilterOperator, targetField?: string): void;
|
|
126
|
-
/**
|
|
127
|
-
* Clear a specific filter
|
|
128
|
-
*/
|
|
129
|
-
declare function clearFilter(entityType: string, field: string): void;
|
|
130
|
-
/**
|
|
131
|
-
* Clear all filters for an entity type
|
|
132
|
-
*/
|
|
133
|
-
declare function clearAllFilters(entityType: string): void;
|
|
134
|
-
/**
|
|
135
|
-
* Get active filters for an entity type
|
|
136
|
-
*/
|
|
137
|
-
declare function getFilters(entityType: string): EntityFilters;
|
|
138
|
-
/**
|
|
139
|
-
* Get entities by type with optional filtering
|
|
140
|
-
*/
|
|
141
|
-
declare function getByTypeFiltered(type: string | string[]): Entity[];
|
|
142
|
-
/**
|
|
143
|
-
* Get snapshot for React useSyncExternalStore
|
|
144
|
-
*/
|
|
145
|
-
declare function getSnapshot(): Map<string, Entity>;
|
|
146
|
-
/**
|
|
147
|
-
* Get filter snapshot for React useSyncExternalStore
|
|
148
|
-
*/
|
|
149
|
-
declare function getFilterSnapshot(): Map<string, EntityFilters>;
|
|
150
|
-
|
|
151
|
-
export { type Entity, type EntityFilterValue, type EntityFilters, type FilterOperator, type FilterableRecord, applyFilters, clearAllFilters, clearEntities, clearFilter, createFilter, getAllEntities, getByType, getByTypeFiltered, getDateString, getEntities, getEntity, getFilterSnapshot, getFilters, getSingleton, getSnapshot, matchesFilter, removeEntity, setFilter, spawnEntity, subscribe, updateEntity, updateSingleton };
|
|
6
|
+
export * from './filtering';
|
|
7
|
+
export * from './entityStore';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@almadar/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "React UI components, hooks, and providers for Almadar",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/components/index.js",
|
|
@@ -70,6 +70,9 @@
|
|
|
70
70
|
"access": "public"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
+
"@almadar/core": ">=2.0.0",
|
|
74
|
+
"@almadar/evaluator": ">=2.0.0",
|
|
75
|
+
"@almadar/patterns": ">=2.0.0",
|
|
73
76
|
"clsx": "^2.1.0",
|
|
74
77
|
"tailwind-merge": "^2.2.0",
|
|
75
78
|
"lucide-react": "^0.344.0",
|
|
@@ -77,10 +80,7 @@
|
|
|
77
80
|
"remark-gfm": "^4.0.0",
|
|
78
81
|
"remark-math": "^6.0.0",
|
|
79
82
|
"rehype-katex": "^7.0.0",
|
|
80
|
-
"react-syntax-highlighter": "^15.6.1"
|
|
81
|
-
"@almadar/core": "1.0.18",
|
|
82
|
-
"@almadar/evaluator": "1.0.16",
|
|
83
|
-
"@almadar/patterns": "1.1.1"
|
|
83
|
+
"react-syntax-highlighter": "^15.6.1"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"react": ">=18.0.0",
|
|
@@ -105,8 +105,8 @@
|
|
|
105
105
|
"@storybook/react-vite": "^10.2.6",
|
|
106
106
|
"storybook": "^10.2.6",
|
|
107
107
|
"@vitejs/plugin-react": "^4.2.0",
|
|
108
|
-
"babel-plugin-react-compiler": "
|
|
109
|
-
"react-compiler-runtime": "
|
|
108
|
+
"babel-plugin-react-compiler": "19.0.0-beta-af1b7da-20250417",
|
|
109
|
+
"react-compiler-runtime": "19.0.0-beta-af1b7da-20250417",
|
|
110
110
|
"autoprefixer": "^10.4.0",
|
|
111
111
|
"postcss": "^8.4.35",
|
|
112
112
|
"tailwindcss": "^3.4.0",
|
|
@@ -121,12 +121,13 @@
|
|
|
121
121
|
"jsdom": "^24.0.0",
|
|
122
122
|
"@storybook/addon-docs": "^10.2.6",
|
|
123
123
|
"@types/react-syntax-highlighter": "^15.5.0",
|
|
124
|
-
"katex": "^0.16.0"
|
|
124
|
+
"katex": "^0.16.0",
|
|
125
|
+
"@types/node": "^22.0.0"
|
|
125
126
|
},
|
|
126
127
|
"repository": {
|
|
127
128
|
"type": "git",
|
|
128
129
|
"url": "https://github.com/almadar-io/almadar.git",
|
|
129
|
-
"directory": "packages/
|
|
130
|
+
"directory": "docs/packages/ui"
|
|
130
131
|
},
|
|
131
132
|
"license": "MIT",
|
|
132
133
|
"keywords": [
|
|
@@ -136,8 +137,9 @@
|
|
|
136
137
|
"components",
|
|
137
138
|
"hooks"
|
|
138
139
|
],
|
|
140
|
+
"homepage": "https://github.com/almadar-io/almadar#readme",
|
|
139
141
|
"scripts": {
|
|
140
|
-
"build": "tsup",
|
|
142
|
+
"build": "tsup && tsc --declaration --emitDeclarationOnly --outDir dist --skipLibCheck || true",
|
|
141
143
|
"build:watch": "tsup --watch",
|
|
142
144
|
"storybook": "storybook dev -p 6006",
|
|
143
145
|
"build-storybook": "storybook build -o storybook-static",
|