@luzmo/dashboard-contents-types 1.0.0 → 1.0.2

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 (117) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +154 -0
  3. package/assets/json-schemas/area-chart-options.schema.json.d.ts +92 -286
  4. package/assets/json-schemas/area-chart-slots.schema.json.d.ts +13 -13
  5. package/assets/json-schemas/bar-chart-options.schema.json.d.ts +91 -134
  6. package/assets/json-schemas/bar-chart-slots.schema.json.d.ts +13 -13
  7. package/assets/json-schemas/box-plot-options.schema.json.d.ts +90 -170
  8. package/assets/json-schemas/box-plot-slots.schema.json.d.ts +13 -13
  9. package/assets/json-schemas/bubble-chart-options.schema.json.d.ts +91 -134
  10. package/assets/json-schemas/bubble-chart-slots.schema.json.d.ts +13 -13
  11. package/assets/json-schemas/bullet-chart-options.schema.json.d.ts +86 -180
  12. package/assets/json-schemas/bullet-chart-slots.schema.json.d.ts +13 -13
  13. package/assets/json-schemas/choropleth-map-options.schema.json.d.ts +86 -155
  14. package/assets/json-schemas/choropleth-map-slots.schema.json.d.ts +13 -40
  15. package/assets/json-schemas/circular-gauge-options.schema.json.d.ts +89 -181
  16. package/assets/json-schemas/circular-gauge-slots.schema.json.d.ts +13 -13
  17. package/assets/json-schemas/column-chart-options.schema.json.d.ts +91 -134
  18. package/assets/json-schemas/column-chart-slots.schema.json.d.ts +13 -13
  19. package/assets/json-schemas/combination-chart-options.schema.json.d.ts +91 -134
  20. package/assets/json-schemas/combination-chart-slots.schema.json.d.ts +13 -13
  21. package/assets/json-schemas/date-filter-options.schema.json.d.ts +84 -233
  22. package/assets/json-schemas/date-filter-slots.schema.json.d.ts +4 -4
  23. package/assets/json-schemas/donut-chart-options.schema.json.d.ts +90 -145
  24. package/assets/json-schemas/donut-chart-slots.schema.json.d.ts +13 -13
  25. package/assets/json-schemas/dropdown-filter-options.schema.json.d.ts +84 -233
  26. package/assets/json-schemas/dropdown-filter-slots.schema.json.d.ts +13 -13
  27. package/assets/json-schemas/evolution-number-options.schema.json.d.ts +89 -181
  28. package/assets/json-schemas/evolution-number-slots.schema.json.d.ts +13 -13
  29. package/assets/json-schemas/funnel-chart-options.schema.json.d.ts +90 -145
  30. package/assets/json-schemas/funnel-chart-slots.schema.json.d.ts +13 -13
  31. package/assets/json-schemas/image-options.schema.json.d.ts +74 -339
  32. package/assets/json-schemas/line-chart-options.schema.json.d.ts +91 -134
  33. package/assets/json-schemas/line-chart-slots.schema.json.d.ts +13 -13
  34. package/assets/json-schemas/options.schema.json.d.ts +3 -0
  35. package/assets/json-schemas/pivot-table-options.schema.json.d.ts +85 -191
  36. package/assets/json-schemas/pivot-table-slots.schema.json.d.ts +13 -13
  37. package/assets/json-schemas/regular-table-options.schema.json.d.ts +85 -191
  38. package/assets/json-schemas/regular-table-slots.schema.json.d.ts +13 -13
  39. package/assets/json-schemas/sankey-diagram-options.schema.json.d.ts +89 -181
  40. package/assets/json-schemas/sankey-diagram-slots.schema.json.d.ts +13 -13
  41. package/assets/json-schemas/scatter-plot-options.schema.json.d.ts +91 -134
  42. package/assets/json-schemas/scatter-plot-slots.schema.json.d.ts +13 -13
  43. package/assets/json-schemas/slicer-filter-options.schema.json.d.ts +84 -233
  44. package/assets/json-schemas/slicer-filter-slots.schema.json.d.ts +13 -13
  45. package/assets/json-schemas/slider-filter-options.schema.json.d.ts +84 -233
  46. package/assets/json-schemas/slider-filter-slots.schema.json.d.ts +9 -9
  47. package/assets/json-schemas/slots.schema.json.d.ts +3 -0
  48. package/assets/json-schemas/text-options.schema.json.d.ts +75 -296
  49. package/index.js +229 -151
  50. package/index.mjs +2572 -4890
  51. package/json-schemas.d.ts +1392 -2137
  52. package/json-schemas.d.ts.map +1 -1
  53. package/package.json +1 -1
  54. package/src/lib/area-chart/area-chart-options.d.ts +13 -7
  55. package/src/lib/area-chart/area-chart-options.d.ts.map +1 -1
  56. package/src/lib/bar-chart/bar-chart-options.d.ts +6 -3
  57. package/src/lib/bar-chart/bar-chart-options.d.ts.map +1 -1
  58. package/src/lib/box-plot/box-plot-options.d.ts +6 -3
  59. package/src/lib/box-plot/box-plot-options.d.ts.map +1 -1
  60. package/src/lib/bubble-chart/bubble-chart-options.d.ts +6 -3
  61. package/src/lib/bubble-chart/bubble-chart-options.d.ts.map +1 -1
  62. package/src/lib/bullet-chart/bullet-chart-options.d.ts +6 -1
  63. package/src/lib/bullet-chart/bullet-chart-options.d.ts.map +1 -1
  64. package/src/lib/choropleth-map/choropleth-map-options.d.ts +6 -2
  65. package/src/lib/choropleth-map/choropleth-map-options.d.ts.map +1 -1
  66. package/src/lib/circular-gauge/circular-gauge-options.d.ts +6 -1
  67. package/src/lib/circular-gauge/circular-gauge-options.d.ts.map +1 -1
  68. package/src/lib/column-chart/column-chart-options.d.ts +6 -3
  69. package/src/lib/column-chart/column-chart-options.d.ts.map +1 -1
  70. package/src/lib/combination-chart/combination-chart-options.d.ts +6 -3
  71. package/src/lib/combination-chart/combination-chart-options.d.ts.map +1 -1
  72. package/src/lib/conditional-number/conditional-number-options.d.ts +6 -1
  73. package/src/lib/conditional-number/conditional-number-options.d.ts.map +1 -1
  74. package/src/lib/date-filter/date-filter-options.d.ts +7 -4
  75. package/src/lib/date-filter/date-filter-options.d.ts.map +1 -1
  76. package/src/lib/donut-chart/donut-chart-options.d.ts +6 -2
  77. package/src/lib/donut-chart/donut-chart-options.d.ts.map +1 -1
  78. package/src/lib/dropdown-filter/dropdown-filter-options.d.ts +7 -3
  79. package/src/lib/dropdown-filter/dropdown-filter-options.d.ts.map +1 -1
  80. package/src/lib/evolution-number/evolution-number-options.d.ts +6 -1
  81. package/src/lib/evolution-number/evolution-number-options.d.ts.map +1 -1
  82. package/src/lib/funnel-chart/funnel-chart-options.d.ts +6 -2
  83. package/src/lib/funnel-chart/funnel-chart-options.d.ts.map +1 -1
  84. package/src/lib/image/image-options.d.ts +6 -1
  85. package/src/lib/image/image-options.d.ts.map +1 -1
  86. package/src/lib/line-chart/line-chart-options.d.ts +6 -3
  87. package/src/lib/line-chart/line-chart-options.d.ts.map +1 -1
  88. package/src/lib/pivot-table/pivot-table-options.d.ts +6 -2
  89. package/src/lib/pivot-table/pivot-table-options.d.ts.map +1 -1
  90. package/src/lib/regular-table/regular-table-options.d.ts +6 -1
  91. package/src/lib/regular-table/regular-table-options.d.ts.map +1 -1
  92. package/src/lib/sankey-diagram/sankey-diagram-options.d.ts +6 -2
  93. package/src/lib/sankey-diagram/sankey-diagram-options.d.ts.map +1 -1
  94. package/src/lib/scatter-plot/scatter-plot-options.d.ts +6 -3
  95. package/src/lib/scatter-plot/scatter-plot-options.d.ts.map +1 -1
  96. package/src/lib/search-filter/search-filter-options.d.ts +6 -2
  97. package/src/lib/search-filter/search-filter-options.d.ts.map +1 -1
  98. package/src/lib/shared/index.d.ts +2 -3
  99. package/src/lib/shared/index.d.ts.map +1 -1
  100. package/src/lib/shared/object-view-options.d.ts +2 -1
  101. package/src/lib/shared/object-view-options.d.ts.map +1 -1
  102. package/src/lib/shared/slots.d.ts +8 -6
  103. package/src/lib/shared/slots.d.ts.map +1 -1
  104. package/src/lib/shared/theme.d.ts +87 -81
  105. package/src/lib/shared/theme.d.ts.map +1 -1
  106. package/src/lib/shared/viz-item.d.ts +60 -0
  107. package/src/lib/shared/viz-item.d.ts.map +1 -0
  108. package/src/lib/slicer-filter/slicer-filter-options.d.ts +6 -2
  109. package/src/lib/slicer-filter/slicer-filter-options.d.ts.map +1 -1
  110. package/src/lib/slider-filter/slider-filter-options.d.ts +6 -2
  111. package/src/lib/slider-filter/slider-filter-options.d.ts.map +1 -1
  112. package/src/lib/text/text-options.d.ts +6 -1
  113. package/src/lib/text/text-options.d.ts.map +1 -1
  114. package/src/options.d.ts +1 -1
  115. package/src/options.d.ts.map +1 -1
  116. package/src/lib/shared/axis-view-options.d.ts +0 -3
  117. package/src/lib/shared/axis-view-options.d.ts.map +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ All notable changes to this project will be documented in this file.
2
+
3
+ ## [1.0.2] - 2024-10-21
4
+
5
+ ### Updates
6
+
7
+ - Changes related to theme options
8
+
9
+ ## [1.0.1] - 2024-10-14
10
+
11
+ ### Updates
12
+
13
+ - Updated types
14
+
15
+ ## [0.1.88] - 2024-09-09
16
+
17
+ - Types and JSON schemas from Luzmo dashboard contents v0.1.88
package/README.md ADDED
@@ -0,0 +1,154 @@
1
+ # Types and JSON schemas for Luzmo dashboard contents
2
+
3
+ This packages contains different dashboard contents' types and JSON schemas for Luzmo dashboard contents.
4
+
5
+ ## Content Item Types
6
+
7
+ Here is the list of some types for content items. There are more types available in the package.
8
+
9
+ | Type | Description |
10
+ |--------------------------------|-------------------------------------------------------|
11
+ | `AreaChart` | An Area Chart type. |
12
+ | `AreaChartViewOptions` | An Area Chart options type. |
13
+ | `AreaChartSlots` | An Area Chart slots type. |
14
+ | `BarChart` | A Bar Chart type. |
15
+ | `BarChartViewOptions` | A Bar Chart options type. |
16
+ | `BarChartSlots` | A Bar Chart slots type. |
17
+ | `BoxPlot` | A Box Plot type. |
18
+ | `BoxPlotViewOptions` | A Box Plot options type. |
19
+ | `BoxPlotSlots` | A Box Plot slots type. |
20
+ | `BubbleChart` | A Bubble Chart type. |
21
+ | `BubbleChartViewOptions` | A Bubble Chart options type. |
22
+ | `BubbleChartSlots` | A Bubble Chart slots type. |
23
+ | `BulletChart` | A Bullet Chart type. |
24
+ | `BulletChartViewOptions` | A Bullet Chart options type. |
25
+ | `BulletChartSlots` | A Bullet Chart slots type. |
26
+ | `ChoroplethMap` | A Choropleth Map type. |
27
+ | `ChoroplethMapViewOptions` | A Choropleth Map options type. |
28
+ | `ChoroplethMapSlots` | A Choropleth Map slots type. |
29
+ | `CircularGauge` | A Circular Gauge type. |
30
+ | `CircularGaugeViewOptions` | A Circular Gauge options type. |
31
+ | `CircularGaugeSlots` | A Circular Gauge slots type. |
32
+ | `ColumnChart` | A Column Chart type. |
33
+ | `ColumnChartViewOptions` | A Column Chart options type. |
34
+ | `ColumnChartSlots` | A Column Chart slots type. |
35
+ | `CombinationChart` | A Combination Chart type. |
36
+ | `CombinationChartViewOptions` | A Combination Chart options type. |
37
+ | `CombinationChartSlots` | A Combination Chart slots type. |
38
+ | `ConditionalNumber` | A Conditional Number type. |
39
+ | `ConditionalNumberViewOptions` | A Conditional Number options type. |
40
+ | `ConditionalNumberSlots` | A Conditional Number slots type. |
41
+ | `DateFilter` | A Date Filter type. |
42
+ | `DateFilterViewOptions` | A Date Filter options type. |
43
+ | `DateFilterSlots` | A Date Filter slots type. |
44
+ | `DonutChart` | A Donut Chart type. |
45
+ | `DonutChartViewOptions` | A Donut Chart options type. |
46
+ | `DonutChartSlots` | A Donut Chart slots type. |
47
+ | `DropdownFilter` | A Dropdown Filter type. |
48
+ | `DropdownFilterViewOptions` | A Dropdown Filter options type. |
49
+ | `DropdownFilterSlots` | A Dropdown Filter slots type. |
50
+ | `EvolutionNumber` | An Evolution Number type. |
51
+ | `EvolutionNumberViewOptions` | An Evolution Number options type. |
52
+ | `EvolutionNumberSlots` | An Evolution Number slots type. |
53
+ | `FunnelChart` | A Funnel Chart type. |
54
+ | `FunnelChartViewOptions` | A Funnel Chart options type. |
55
+ | `FunnelChartSlots` | A Funnel Chart slots type. |
56
+ | `Image` | An Image type. |
57
+ | `ImageViewOptions` | An Image options type. |
58
+ | `LineChart` | A Line Chart type. |
59
+ | `LineChartViewOptions` | A Line Chart options type. |
60
+ | `LineChartSlots` | A Line Chart slots type. |
61
+ | `PivotTable` | A Pivot Table type. |
62
+ | `PivotTableViewOptions` | A Pivot Table options type. |
63
+ | `PivotTableSlots` | A Pivot Table slots type. |
64
+ | `RegularTable` | A Regular Table type. |
65
+ | `RegularTableViewOptions` | A Regular Table options type. |
66
+ | `RegularTableSlots` | A Regular Table slots type. |
67
+ | `SankeyDiagram` | A ScatterPlot type. |
68
+ | `SankeyDiagramViewOptions` | A Sankey Diagram options type. |
69
+ | `SankeyDiagramSlots` | A Sankey Diagram slots type. |
70
+ | `ScatterPlot` | A Scatter Plot type. |
71
+ | `ScatterPlotViewOptions` | A Scatter Plot options type. |
72
+ | `ScatterPlotSlots` | A Scatter Plot slots type. |
73
+ | `SlicerFilter` | A Slicer Filter type. |
74
+ | `SlicerFilterViewOptions` | A Slicer Filter options type. |
75
+ | `SlicerFilterSlots` | A Slicer Filter slots type. |
76
+ | `SliderFilter` | A Slider Filter type. |
77
+ | `SliderFilterViewOptions` | A Slider Filter options type. |
78
+ | `SliderFilterSlots` | A Slider Filter slots type. |
79
+ | `Text` | A Text type. |
80
+ | `TextViewOptions` | A Text options type. |
81
+ | `VizItemType` | A union type for content item types. |
82
+ | `Options` | A union type for all the options from all the charts. |
83
+ | `Slots` | A union type for all the slots from all the charts. |
84
+
85
+ ## JSON Schemas
86
+
87
+ The library also provides JSON schemas for the content items. The schemas are provided as an object with the schema name as the key and the schema as the value.
88
+
89
+ ```typescript
90
+ import { JSON_SCHEMAS } from '@luzmo/dashboard-contents-types';
91
+
92
+ console.log(JSON_SCHEMAS);
93
+ console.log(JSON_SCHEMAS['text-options.schema.json']);
94
+ ```
95
+
96
+ The JSON schemas are not dereferenced. You can use a library like [json-schema-ref-parser](https://github.com/APIDevTools/json-schema-ref-parser) to dereference the schemas. `json-schema-ref-parser` is a Node library so to use it in a browser environment you should add a [configuration](https://github.com/APIDevTools/json-schema-ref-parser?tab=readme-ov-file#browser-support) for that.
97
+
98
+ ```typescript
99
+ import * as refParser from '@apidevtools/json-schema-ref-parser';
100
+ import { JSON_SCHEMAS } from '@luzmo/dashboard-contents-types';
101
+
102
+ const refParserResolver = {
103
+ order: 101,
104
+ canRead: /^https:\/\/developer\.luzmo\.com/,
105
+ read: (file, callback) => {
106
+ const name = file.url.split('/').pop();
107
+ const schema = JSON_SCHEMAS[name];
108
+
109
+ if (schema) {
110
+ callback(null, JSON.stringify(schema));
111
+ } else {
112
+ callback(new Error('Schema not found'));
113
+ }
114
+ }
115
+ };
116
+
117
+ const refParserOptions = {
118
+ mutateInputSchema: false,
119
+ resolve: {
120
+ http: refParserResolver,
121
+ external: true
122
+ }
123
+ };
124
+
125
+ refParser.dereference(JSON_SCHEMAS['area-chart-slots.schema.json'], refParserOptions)
126
+ .then((dereferencedSchema) => {
127
+ console.log(dereferencedSchema);
128
+ })
129
+ .catch((err) => {
130
+ console.error(err);
131
+ });
132
+ ```
133
+
134
+ To validate a content item against a schema, you can use a library like [ajv](https://github.com/ajv-validator/ajv).
135
+
136
+ ```typescript
137
+ import Ajv from "ajv";
138
+ import ajvAddFormats from 'ajv-formats';
139
+ import { JSON_SCHEMAS } from '@luzmo/dashboard-contents-types';
140
+
141
+ const ajv = new Ajv({
142
+ schemas: Object.keys(JSON_SCHEMAS).map(key => JSON_SCHEMAS[key]),
143
+ allowUnionTypes: true,
144
+ strictTuples: false
145
+ });
146
+
147
+ ajvAddFormats(ajv);
148
+
149
+ const schemaId = 'https://developer.luzmo.com/assets/json-schemas/0.1.89/text-options.schema.json';
150
+ const validate = ajv.getSchema(schemaId);
151
+ const isValid = validate('VALUE TO VALIDATE');
152
+
153
+ console.log(isValid);
154
+ ```