@itwin/saved-views-react 0.1.0

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 (77) hide show
  1. package/LICENSE.md +9 -0
  2. package/README.md +131 -0
  3. package/lib/LayeredDropdownMenu/LayeredDropdownMenu.css +11 -0
  4. package/lib/LayeredDropdownMenu/LayeredDropdownMenu.d.ts +39 -0
  5. package/lib/LayeredDropdownMenu/LayeredDropdownMenu.js +53 -0
  6. package/lib/SavedView.d.ts +18 -0
  7. package/lib/SavedView.js +1 -0
  8. package/lib/SavedViewTile/SavedViewOptions.css +26 -0
  9. package/lib/SavedViewTile/SavedViewOptions.d.ts +139 -0
  10. package/lib/SavedViewTile/SavedViewOptions.js +173 -0
  11. package/lib/SavedViewTile/SavedViewTile.css +89 -0
  12. package/lib/SavedViewTile/SavedViewTile.d.ts +55 -0
  13. package/lib/SavedViewTile/SavedViewTile.js +110 -0
  14. package/lib/SavedViewTile/SavedViewTileContext.d.ts +14 -0
  15. package/lib/SavedViewTile/SavedViewTileContext.js +20 -0
  16. package/lib/SavedViewsClient/ITwinSavedViewsClient.d.ts +30 -0
  17. package/lib/SavedViewsClient/ITwinSavedViewsClient.js +132 -0
  18. package/lib/SavedViewsClient/SavedViewsClient.d.ts +72 -0
  19. package/lib/SavedViewsClient/SavedViewsClient.js +1 -0
  20. package/lib/SavedViewsContext.d.ts +13 -0
  21. package/lib/SavedViewsContext.js +38 -0
  22. package/lib/SavedViewsWidget/SavedViewGroupTile/SavedViewGroupOptions.d.ts +9 -0
  23. package/lib/SavedViewsWidget/SavedViewGroupTile/SavedViewGroupOptions.js +14 -0
  24. package/lib/SavedViewsWidget/SavedViewGroupTile/SavedViewGroupTile.d.ts +14 -0
  25. package/lib/SavedViewsWidget/SavedViewGroupTile/SavedViewGroupTile.js +37 -0
  26. package/lib/SavedViewsWidget/SavedViewGroupTile/SavedViewGroupTileContext.d.ts +14 -0
  27. package/lib/SavedViewsWidget/SavedViewGroupTile/SavedViewGroupTileContext.js +20 -0
  28. package/lib/SavedViewsWidget/SavedViewsExpandableBlockWidget.css +50 -0
  29. package/lib/SavedViewsWidget/SavedViewsExpandableBlockWidget.d.ts +36 -0
  30. package/lib/SavedViewsWidget/SavedViewsExpandableBlockWidget.js +36 -0
  31. package/lib/SavedViewsWidget/SavedViewsFolderWidget.d.ts +14 -0
  32. package/lib/SavedViewsWidget/SavedViewsFolderWidget.js +60 -0
  33. package/lib/StickyExpandableBlock/StickyExpandableBlock.css +20 -0
  34. package/lib/StickyExpandableBlock/StickyExpandableBlock.d.ts +29 -0
  35. package/lib/StickyExpandableBlock/StickyExpandableBlock.js +63 -0
  36. package/lib/TileGrid/TileGrid.css +28 -0
  37. package/lib/TileGrid/TileGrid.d.ts +48 -0
  38. package/lib/TileGrid/TileGrid.js +32 -0
  39. package/lib/api/clients/IModelQueryClient.d.ts +10 -0
  40. package/lib/api/clients/IModelQueryClient.js +45 -0
  41. package/lib/api/clients/ISavedViewsClient.d.ts +9 -0
  42. package/lib/api/clients/ISavedViewsClient.js +16 -0
  43. package/lib/api/utilities/SavedViewTypes.d.ts +48 -0
  44. package/lib/api/utilities/SavedViewTypes.js +1 -0
  45. package/lib/api/utilities/translation/ModelsAndCategoriesHelper.d.ts +3 -0
  46. package/lib/api/utilities/translation/ModelsAndCategoriesHelper.js +57 -0
  47. package/lib/api/utilities/translation/RgbColor.d.ts +29 -0
  48. package/lib/api/utilities/translation/RgbColor.js +1 -0
  49. package/lib/api/utilities/translation/SavedViewTranslation.d.ts +22 -0
  50. package/lib/api/utilities/translation/SavedViewTranslation.js +246 -0
  51. package/lib/api/utilities/translation/SavedViewsExtensionHandlers.d.ts +13 -0
  52. package/lib/api/utilities/translation/SavedViewsExtensionHandlers.js +42 -0
  53. package/lib/api/utilities/translation/clipVectorsExtractor.d.ts +5 -0
  54. package/lib/api/utilities/translation/clipVectorsExtractor.js +56 -0
  55. package/lib/api/utilities/translation/displayStyleExtractor.d.ts +17 -0
  56. package/lib/api/utilities/translation/displayStyleExtractor.js +499 -0
  57. package/lib/api/utilities/translation/extensionExtractor.d.ts +18 -0
  58. package/lib/api/utilities/translation/extensionExtractor.js +79 -0
  59. package/lib/api/utilities/translation/extractionUtilities.d.ts +209 -0
  60. package/lib/api/utilities/translation/extractionUtilities.js +515 -0
  61. package/lib/api/utilities/translation/urlConverter.d.ts +7 -0
  62. package/lib/api/utilities/translation/urlConverter.js +42 -0
  63. package/lib/api/utilities/translation/viewExtractorSavedViewToLegacySavedView.d.ts +35 -0
  64. package/lib/api/utilities/translation/viewExtractorSavedViewToLegacySavedView.js +298 -0
  65. package/lib/experimental.d.ts +4 -0
  66. package/lib/experimental.js +8 -0
  67. package/lib/index.d.ts +12 -0
  68. package/lib/index.js +14 -0
  69. package/lib/localization.d.ts +52 -0
  70. package/lib/localization.js +51 -0
  71. package/lib/ui/viewlist/ModelCategoryOverrideProvider.d.ts +31 -0
  72. package/lib/ui/viewlist/ModelCategoryOverrideProvider.js +88 -0
  73. package/lib/useSavedViews.d.ts +52 -0
  74. package/lib/useSavedViews.js +514 -0
  75. package/lib/utils.d.ts +1 -0
  76. package/lib/utils.js +7 -0
  77. package/package.json +75 -0
@@ -0,0 +1,209 @@
1
+ import type { Rgba, RgbatColorProps } from "./RgbColor.js";
2
+ /**
3
+ * Returns a function that does a simple typeof check on a value
4
+ * @param typeOfString String to compare against
5
+ * @returns
6
+ */
7
+ export declare const simpleTypeOf: (typeOfString: string) => (value: unknown) => boolean;
8
+ /**
9
+ * Returns true if the given value is in any of the color formats that we accept to transform
10
+ * @param value
11
+ * @returns
12
+ */
13
+ export declare const isAnyColorFormat: (value: unknown) => boolean;
14
+ /**
15
+ * Transforms any of the three types of colors into our schema color format {red: number, green: number, blue: number}
16
+ * Legacy to new schema
17
+ * @param value
18
+ * @returns
19
+ */
20
+ export declare const transformColorLegacy: (value: unknown) => RgbatColorProps | undefined;
21
+ /**
22
+ * Transforms any of the two types of colors into our schema color format 0xttbbggrr
23
+ * @param value
24
+ * @returns
25
+ */
26
+ export declare const transformColor: (value: unknown) => unknown;
27
+ /**
28
+ * Transforms any of the three types of colors into our schema color format {r: number, g: number, b: number}
29
+ * @param value
30
+ * @returns
31
+ */
32
+ export declare const transformRGB: (value: unknown) => Rgba | undefined;
33
+ /**
34
+ * Creates a function that extracts a value from input to output
35
+ * @param from Accessor from where to retrieve the value
36
+ * @param to Accessor to add to the output object to store the value
37
+ * @param typeCheck Type checker for validation of the value
38
+ * @param transform Transform function of the value to be put in the output
39
+ * @returns Function that does the extraction
40
+ */
41
+ export declare const createExtractionFunc: (from: string, to: string, typeCheck?: ((value: unknown) => boolean) | undefined, transform?: ((value: unknown) => unknown) | undefined) => (input: any, output: any) => void;
42
+ /** Type for a extraction function generator */
43
+ export type ExtractionFunc<InputType, OutputType> = (input: InputType, output: OutputType) => OutputType;
44
+ /** Type for a function that creates a extraction function */
45
+ export type ExtractionFuncCreator = (from: string, to: string) => ExtractionFunc<void, void>;
46
+ /**
47
+ * Creates a extraction function that will extract a number from the given accessor and put it
48
+ * in the given accessor if provided
49
+ * @param from Accessor that will be used on input to access value
50
+ * @param to Accessor that will be used to stored the value in the output object
51
+ * @returns Function that extracts a number value and type checks it
52
+ */
53
+ export declare const extractNumber: (from: string, to?: string) => ExtractionFunc<void, void>;
54
+ /**
55
+ * Creates a extraction function that will extract a boolean from the given accessor and put it
56
+ * in the given accessor if provided
57
+ * @param from Accessor that will be used on input to access value
58
+ * @param to Accessor that will be used to stored the value in the output object
59
+ * @returns Function that extracts a boolean value and type checks it
60
+ */
61
+ export declare const extractBoolean: (from: string, to?: string) => ExtractionFunc<void, void>;
62
+ /**
63
+ * Creates a extraction function that will extract a boolean or a number with the same accessor name
64
+ * @param from Accessor that will be used on input to access value
65
+ * @param to Accessor that will be used to stored the value in the output object
66
+ * @returns Function that extracts a boolean or number value and type checks it
67
+ */
68
+ export declare const extractNumberOrBool: (from: string, to?: string) => ExtractionFunc<void, void>;
69
+ /**
70
+ * Creates a extraction function that will extract a string from the given accessor and put it
71
+ * in the given accessor if provided
72
+ * @param from Accessor that will be used on input to access value
73
+ * @param to Accessor that will be used to stored the value in the output object
74
+ * @returns Function that extracts a string value and type checks it
75
+ */
76
+ export declare const extractString: (from: string, to?: string) => ExtractionFunc<void, void>;
77
+ /**
78
+ * Creates a extraction function that will extract a string or number from them given accessor
79
+ * @param from Accessor that will be used on input to access value
80
+ * @param to Accessor that will be used to stored the value in the output object
81
+ * @returns Function that extracts a string or number value and type checks it
82
+ */
83
+ export declare const extractStringOrNumber: (from: string, to?: string) => ExtractionFunc<void, void>;
84
+ /**
85
+ * Creates a extraction function that will extract a string or an array of strings into the given
86
+ * accessor
87
+ * @param from Accessor that will be used on input to access value
88
+ * @param to Accessor that will be used to stored the value in the output object
89
+ * @returns Function that extracts a string or string array value and type checks it
90
+ */
91
+ export declare const extractStringOrArray: (from: string, to?: string) => ExtractionFunc<void, void>;
92
+ /**
93
+ * Creates a extraction function that will extract an array of type: (string | number)[]
94
+ * @param from Accessor that will be used on input to access value
95
+ * @param to Accessor that will be used to stored the value in the output object
96
+ * @returns Function that extracts a string | number array value and type checks it
97
+ */
98
+ export declare const extractStringOrNumberArray: (from: string, to?: string) => ExtractionFunc<void, void>;
99
+ /**
100
+ * Creates a extraction function that will extract an array in which all the elements are type checked with the
101
+ * given function
102
+ * @param typeCheck Function to check each value of the array
103
+ * @param from Accessor string where the array is in the input object
104
+ * @param to Accessor string to store it in the output object
105
+ * @returns
106
+ */
107
+ export declare const extractSimpleArray: (typeCheck: (value: unknown) => boolean, from: string, to?: string) => ExtractionFunc<void, void>;
108
+ /**
109
+ * Creates a extraction function that will extract a color from the given accessor and put it
110
+ * in the given accessor if provided. Colors will be transformed from either of the following representations:
111
+ * 1. Number in format: 0xTTBBGGRR
112
+ * 2. JSON Object in format: {r: number, g: number, b: number}
113
+ * 3. JSON Object in format: {red: number, green: number, blue: number}
114
+ *
115
+ * The resulting transformed color will be in format: {red: number, green: number, blue: number}
116
+ *
117
+ * @param from Accessor that will be used on input to access value
118
+ * @param to Accessor that will be used to store the value in the output object
119
+ * @returns Function that extracts a color value and type checks it
120
+ */
121
+ export declare const extractColor: (from: string, to?: string) => ExtractionFunc<void, void>;
122
+ /**
123
+ * Creates a extraction function that will extract a color from the given accessor and put it
124
+ * in the given accessor if provided. Colors will be transformed from either of the following representations:
125
+ * 1. Number in format: 0xTTBBGGRR
126
+ * 2. JSON Object in format: {r: number, g: number, b: number}
127
+ * 3. JSON Object in format: {red: number, green: number, blue: number}
128
+ *
129
+ * The resulting transformed color will be in format: {red: number, green: number, blue: number}
130
+ *
131
+ * @param from Accessor that will be used on input to access value
132
+ * @param to Accessor that will be used to store the value in the output object
133
+ * @returns Function that extracts a color value and type checks it
134
+ */
135
+ export declare const extractColorLegacy: (from: string, to?: string) => ExtractionFunc<void, void>;
136
+ /**
137
+ * Creates a extraction function that will extract a color from RBG format
138
+ *
139
+ * @param from Accessor that will be used on input to access value
140
+ * @param to Accessor that will be used to store the value in the output object
141
+ * @returns Function that extracts a color value and type checks it
142
+ */
143
+ export declare const extractRGB: (from: string, to?: string) => ExtractionFunc<void, void>;
144
+ /**
145
+ * Creates a extraction function that will extract an array of mappings from an object with the given accessor
146
+ * @param extractionFuncs Array of extraction functions
147
+ * @param from Accessor that will be used on input to access value
148
+ * @param to Accessor that will be used to store the value in the output object
149
+ * @returns Function that extracts an object
150
+ */
151
+ export declare const extractObject: (extractionFuncs: ExtractionFunc<void, void>[], from: string, to?: string) => ExtractionFunc<void, void>;
152
+ /**
153
+ * Interface to pass a discriminator and an array of extraction functions
154
+ * To the extractConditionally function
155
+ */
156
+ export interface ConditionalExtractParams {
157
+ /** Accessor name that if found on the object matches these mappings to it */
158
+ discriminator: string | ((value: unknown) => boolean);
159
+ /**
160
+ * If an array is passed, the extraction functions are applied to the child to extract
161
+ * If the single creator function is passed, then that function is applied to the parent object
162
+ */
163
+ mappings: ExtractionFunc<void, void>[] | ExtractionFuncCreator;
164
+ }
165
+ /**
166
+ * Creates an extraction function that will extract different values based on a discriminator string
167
+ * This is to allow extracting types like 'ClassA | ClassB'
168
+ * @param params
169
+ * @param from
170
+ * @param to
171
+ * @returns
172
+ */
173
+ export declare const extractConditionally: (params: ConditionalExtractParams[], from: string, to?: string) => ExtractionFunc<void, void>;
174
+ /**
175
+ * Creates a extraction function that will extract values of an array by using a single extraction function
176
+ * on each of the array values
177
+ * @param extractionFunc
178
+ */
179
+ export declare const extractArray: (extractionFunc: ExtractionFunc<void, void>[], from: string, to?: string) => (input: any, output: any) => void;
180
+ /**
181
+ * Creates an extraction function that will extract the values inside a 2D array from the given accessor
182
+ * @param extractionFunc Extraction functions to apply to each entry in the array
183
+ * @param from Accessor string for the 2D array in the input object
184
+ * @param to Accessor string for the 2D array in the output object
185
+ */
186
+ export declare const extractArray2d: (extractionFunc: ExtractionFunc<void, void>[], from: string, to?: string) => (input: any, output: any) => void;
187
+ /**
188
+ * Creates a extraction function that will extract values of an array by using different extraction functions
189
+ * based on a discriminator for each array value. This is to extract arrays of types like (ClassA | ClassB)[]
190
+ * @param extractionFunc
191
+ */
192
+ export declare const extractArrayConditionally: (params: ConditionalExtractParams[], from: string, to?: string) => (input: any, output: any) => void;
193
+ /**
194
+ * Creates an extraction function that will extract a plain typed map
195
+ * @param extractionFuncs Extraction functions for the values
196
+ * @param isValidKey Checker for the validity of the key
197
+ * @param from Accessor where the plain typed map exists
198
+ * @param to Accessor to store the plain typed map to
199
+ * @returns
200
+ */
201
+ export declare const extractPlainTypedMap: (extractionFuncs: ExtractionFunc<void, void>[], isValidKey: (key: unknown) => boolean, from: string, to?: string) => (input: any, output: any) => void;
202
+ /**
203
+ * Applies an array of extraction functions to extract the data from the input object
204
+ * into the output object
205
+ * @param input Object to extract data from
206
+ * @param output Object to map the data to
207
+ * @param extractionFuncs Array of extraction functions
208
+ */
209
+ export declare const applyExtraction: (input: any, output: any, extractionFuncs: ExtractionFunc<void, void>[]) => void;