@nebula.js/stardust 4.0.0-alpha.1 → 4.0.0-alpha.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nebula.js/stardust",
3
- "version": "4.0.0-alpha.1",
3
+ "version": "4.0.0-alpha.10",
4
4
  "description": "Product and framework agnostic integration API for Qlik's Associative Engine",
5
5
  "license": "MIT",
6
6
  "author": "QlikTech International AB",
@@ -34,25 +34,27 @@
34
34
  "build:dev": "rollup --config ../../rollup.config.js",
35
35
  "build:watch": "rollup --config ../../rollup.config.js -w",
36
36
  "prepublishOnly": "rm -rf dist && yarn run build",
37
- "spec": "sy from-jsdoc -c ./api-spec/spec.conf.js",
37
+ "spec:stardust": "sy from-jsdoc -c ./api-spec/spec.conf.js",
38
+ "spec:listbox": "sy from-jsdoc -c ./api-spec/listbox-spec.conf.js",
39
+ "spec": "yarn run spec:stardust && yarn run spec:listbox",
38
40
  "ts": "sy to-dts -c ./api-spec/spec.conf.js",
39
- "version": "yarn run spec && yarn run ts && git add ./api-spec/spec.json ./types/index.d.ts"
41
+ "version": "yarn run spec && yarn run ts && git add ./api-spec/spec.json ./api-spec/listbox-spec.json ./types/index.d.ts"
40
42
  },
41
43
  "dependencies": {
42
44
  "@types/qlik-engineapi": "12.67.12"
43
45
  },
44
46
  "devDependencies": {
45
- "@emotion/react": "^11.10.6",
46
- "@emotion/styled": "^11.10.6",
47
- "@mui/icons-material": "^5.11.11",
48
- "@mui/material": "^5.11.11",
49
- "@nebula.js/conversion": "^4.0.0-alpha.1",
50
- "@nebula.js/enigma-mocker": "^4.0.0-alpha.1",
51
- "@nebula.js/locale": "^4.0.0-alpha.1",
52
- "@nebula.js/nucleus": "^4.0.0-alpha.1",
53
- "@nebula.js/supernova": "^4.0.0-alpha.1",
54
- "@nebula.js/theme": "^4.0.0-alpha.1",
55
- "@nebula.js/ui": "^4.0.0-alpha.1",
47
+ "@emotion/react": "^11.10.8",
48
+ "@emotion/styled": "^11.10.8",
49
+ "@mui/icons-material": "^5.11.16",
50
+ "@mui/material": "^5.12.3",
51
+ "@nebula.js/conversion": "^4.0.0-alpha.10",
52
+ "@nebula.js/enigma-mocker": "^4.0.0-alpha.10",
53
+ "@nebula.js/locale": "^4.0.0-alpha.10",
54
+ "@nebula.js/nucleus": "^4.0.0-alpha.10",
55
+ "@nebula.js/supernova": "^4.0.0-alpha.10",
56
+ "@nebula.js/theme": "^4.0.0-alpha.10",
57
+ "@nebula.js/ui": "^4.0.0-alpha.10",
56
58
  "@scriptappy/cli": "0.6.0",
57
59
  "@scriptappy/to-dts": "1.0.0-beta.4",
58
60
  "extend": "3.0.2",
@@ -60,11 +62,11 @@
60
62
  "react": "18.2.0",
61
63
  "react-dom": "18.2.0",
62
64
  "react-test-renderer": "18.2.0",
63
- "react-virtualized-auto-sizer": "^1.0.7",
64
- "react-window": "1.8.8",
65
- "react-window-infinite-loader": "1.0.8",
65
+ "react-virtualized-auto-sizer": "1.0.15",
66
+ "react-window": "1.8.9",
67
+ "react-window-infinite-loader": "1.0.9",
66
68
  "regenerator-runtime": "0.13.11",
67
69
  "semver": "6.3.0"
68
70
  },
69
- "gitHead": "e88250ef22efa7796ff3049153b31fdd6740c0d0"
71
+ "gitHead": "0ffa335271ce6e7f4bc58df9b2e7681ff1487984"
70
72
  }
package/types/index.d.ts CHANGED
@@ -132,10 +132,19 @@ export function useAction<A>(factory: ()=>stardust.ActionDefinition<A>, deps?: a
132
132
  * Gets the desired constraints that should be applied when rendering the visualization.
133
133
  *
134
134
  * The constraints are set on the embed configuration before the visualization is rendered
135
- * and should respected by you when implementing the visualization.
135
+ * and should be respected when implementing the visualization.
136
+ * @deprecated
136
137
  */
137
138
  export function useConstraints(): stardust.Constraints;
138
139
 
140
+ /**
141
+ * Gets the desired interaction states that should be applied when rendering the visualization.
142
+ *
143
+ * The interactions are set on the embed configuration before the visualization is rendered
144
+ * and should be respected when implementing the visualization.
145
+ */
146
+ export function useInteractionState(): stardust.Interactions;
147
+
139
148
  /**
140
149
  * Gets the options object provided when rendering the visualization.
141
150
  *
@@ -160,6 +169,11 @@ export function onTakeSnapshot(snapshotCallback: ($: EngineAPI.IGenericObjectLay
160
169
  */
161
170
  export function useRenderState(): stardust.RenderState;
162
171
 
172
+ /**
173
+ * Gets an event emitter instance for the visualization.
174
+ */
175
+ export function useEmitter(): Emitter;
176
+
163
177
  /**
164
178
  * Gets the desired keyboard settings and status to applied when rendering the visualization.
165
179
  * A visualization should in general only have tab stops if either `keyboard.enabled` is false or if active is true.
@@ -207,15 +221,13 @@ declare namespace stardust {
207
221
  }
208
222
 
209
223
  interface Context {
210
- keyboardNavigation?: boolean;
211
- constraints?: {
212
- active?: boolean;
213
- passive?: boolean;
214
- select?: boolean;
215
- };
216
224
  theme?: string;
217
225
  language?: string;
218
226
  deviceType?: string;
227
+ constraints?: stardust.Constraints;
228
+ interactions?: stardust.Interactions;
229
+ keyboardNavigation?: boolean;
230
+ disableCellPadding?: boolean;
219
231
  }
220
232
 
221
233
  interface Galaxy {
@@ -230,10 +242,23 @@ declare namespace stardust {
230
242
 
231
243
  /**
232
244
  * Renders a visualization or sheet into an HTMLElement.
245
+ * Visualizations can either be existing objects or created on the fly.
233
246
  * Support for sense sheets is experimental.
234
247
  * @param cfg The render configuration.
235
248
  */
236
- render(cfg: stardust.CreateConfig | stardust.GetConfig): Promise<stardust.Viz | stardust.Sheet>;
249
+ render(cfg: stardust.RenderConfig): Promise<stardust.Viz | stardust.Sheet>;
250
+
251
+ /**
252
+ * Creates a visualization model
253
+ * @param cfg The create configuration.
254
+ */
255
+ create(cfg: stardust.CreateConfig): Promise<EngineAPI.IGenericObject>;
256
+
257
+ /**
258
+ * Generates properties for a visualization object
259
+ * @param cfg The create configuration.
260
+ */
261
+ generateProperties(cfg: stardust.CreateConfig): Promise<object>;
237
262
 
238
263
  /**
239
264
  * Updates the current context of this embed instance.
@@ -304,7 +329,7 @@ declare namespace stardust {
304
329
  dense?: boolean;
305
330
  stateName?: string;
306
331
  properties?: object;
307
- }): void;
332
+ }): Promise<void>;
308
333
 
309
334
  /**
310
335
  * Unmounts the field listbox from the DOM.
@@ -352,7 +377,7 @@ declare namespace stardust {
352
377
 
353
378
  id: string;
354
379
 
355
- model: string;
380
+ model: EngineAPI.IGenericObject;
356
381
 
357
382
  /**
358
383
  * Destroys the visualization and removes it from the the DOM.
@@ -366,6 +391,20 @@ declare namespace stardust {
366
391
  */
367
392
  convertTo(newType: string, forceUpdate?: boolean): Promise<object>;
368
393
 
394
+ /**
395
+ * Listens to custom events from inside the visualization. See useEmitter
396
+ * @param eventName Event name to listen to
397
+ * @param listener Callback function to invoke
398
+ */
399
+ on(eventName: string, listener: ()=>void): void;
400
+
401
+ /**
402
+ * Removes a listener
403
+ * @param eventName Event name to remove from
404
+ * @param listener Callback function to remove
405
+ */
406
+ off(eventName: string, listener: ()=>void): void;
407
+
369
408
  }
370
409
 
371
410
  interface Flags {
@@ -441,28 +480,26 @@ declare namespace stardust {
441
480
  /**
442
481
  * Rendering configuration for creating and rendering a new object
443
482
  */
444
- interface CreateConfig extends stardust.BaseConfig{
483
+ interface CreateConfig {
445
484
  type: string;
446
485
  version?: string;
447
486
  fields?: stardust.Field[];
448
- extendProperties?: boolean;
449
487
  properties?: EngineAPI.IGenericObjectProperties;
450
488
  }
451
489
 
452
490
  /**
453
- * Basic rendering configuration for rendering an object
491
+ * Configuration for rendering a visualisation, either creating or fetching an existing object.
454
492
  */
455
- interface BaseConfig {
493
+ interface RenderConfig {
456
494
  element: HTMLElement;
457
495
  options?: object;
458
496
  plugins?: stardust.Plugin[];
459
- }
460
-
461
- /**
462
- * Rendering configuration for rendering an existing object
463
- */
464
- interface GetConfig extends stardust.BaseConfig{
465
- id: string;
497
+ id?: string;
498
+ type?: string;
499
+ version?: string;
500
+ fields?: stardust.Field[];
501
+ extendProperties?: boolean;
502
+ properties?: EngineAPI.IGenericObjectProperties;
466
503
  }
467
504
 
468
505
  interface LibraryField {
@@ -567,10 +604,21 @@ declare namespace stardust {
567
604
  };
568
605
  }
569
606
 
607
+ /**
608
+ * @deprecated
609
+ */
570
610
  interface Constraints {
571
611
  passive?: boolean;
572
612
  active?: boolean;
573
613
  select?: boolean;
614
+ edit?: boolean;
615
+ }
616
+
617
+ interface Interactions {
618
+ passive?: boolean;
619
+ active?: boolean;
620
+ select?: boolean;
621
+ edit?: boolean;
574
622
  }
575
623
 
576
624
  interface RenderState {