@processandtools/rp-article-designer 1.0.89 → 1.0.91

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.
@@ -0,0 +1,7 @@
1
+ import { GetDataFn } from '../types/data-loader.types';
2
+ /**
3
+ * Default getData: routes to the existing ApiFactory/GenericAPI fetch-by-id calls.
4
+ * This is what MatSurfProvider falls back to when no getData prop is supplied —
5
+ * i.e. today's exact fetch behavior, unchanged.
6
+ */
7
+ export declare const defaultGetData: GetDataFn;
@@ -2,6 +2,7 @@ import { ArticleData } from './data.types';
2
2
  import { VIEW } from './view.types';
3
3
  import { ArticleGroupTypes } from './article-group.types';
4
4
  import { ArticleStats } from '../contexts/panel-stats/panel-stats.types';
5
+ import { GetDataFn } from './data-loader.types';
5
6
  export interface CanvasProps {
6
7
  view?: VIEW;
7
8
  data?: ArticleData;
@@ -15,4 +16,5 @@ export interface CanvasProps {
15
16
  onArticleSelect?: (index: number) => void;
16
17
  dimensionFontSize?: number;
17
18
  onStatsReady?: (stats: ArticleStats) => void;
19
+ getData?: GetDataFn;
18
20
  }
@@ -0,0 +1,26 @@
1
+ import { MaterialTypes } from '../construction_principle/material/material.types';
2
+ import { SurfaceTypes } from '../construction_principle/surface/surface.types';
3
+ import { ArticleData } from './data.types';
4
+ import { DescriptorResponse } from '../descriptor/types/descriptor.types';
5
+ import { LinDivData, OtherDescriptorData } from '../descriptor/types/descriptor-data.types';
6
+ /**
7
+ * One entry per ApiFactory endpoint (see services/ApiFactory.ts).
8
+ * Only 'material-data' and 'surface-data' are wired into MatSurfProvider today —
9
+ * the rest are listed so getData is generic from day one and adding a new
10
+ * endpoint later is a map edit, not a new prop.
11
+ */
12
+ export interface DataEndpointMap {
13
+ 'material-data': MaterialTypes;
14
+ 'surface-data': SurfaceTypes;
15
+ 'article-data': ArticleData;
16
+ 'descriptor-data': DescriptorResponse;
17
+ 'lindiv': LinDivData;
18
+ 'other': OtherDescriptorData;
19
+ }
20
+ export type DataEndpoint = keyof DataEndpointMap;
21
+ /**
22
+ * Generic data loader. The return type is inferred from `endpoint` via
23
+ * DataEndpointMap, so callers don't need to write getData<MaterialTypes>(...) —
24
+ * getData('material-data', name) already resolves to Promise<MaterialTypes | undefined>.
25
+ */
26
+ export type GetDataFn = <K extends DataEndpoint>(endpoint: K, id: string) => Promise<DataEndpointMap[K] | undefined>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@processandtools/rp-article-designer",
3
3
  "private": false,
4
- "version": "1.0.89",
4
+ "version": "1.0.91",
5
5
  "author": "Otman Abid Lmerabetine",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -1,12 +0,0 @@
1
- import { default as React } from 'react';
2
- interface ImageLayer {
3
- img: string;
4
- dimension: [number, number];
5
- position: [number, number];
6
- }
7
- interface LayeredImagesProps {
8
- layers: ImageLayer[];
9
- containerSize?: [number, number];
10
- }
11
- declare const LayeredImages: React.FC<LayeredImagesProps>;
12
- export default LayeredImages;