@nebula.js/stardust 4.0.0-alpha.8 → 4.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nebula.js/stardust",
3
- "version": "4.0.0-alpha.8",
3
+ "version": "4.0.0",
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.15",
49
- "@nebula.js/conversion": "^4.0.0-alpha.8",
50
- "@nebula.js/enigma-mocker": "^4.0.0-alpha.8",
51
- "@nebula.js/locale": "^4.0.0-alpha.8",
52
- "@nebula.js/nucleus": "^4.0.0-alpha.8",
53
- "@nebula.js/supernova": "^4.0.0-alpha.8",
54
- "@nebula.js/theme": "^4.0.0-alpha.8",
55
- "@nebula.js/ui": "^4.0.0-alpha.8",
47
+ "@emotion/react": "^11.11.0",
48
+ "@emotion/styled": "^11.11.0",
49
+ "@mui/icons-material": "^5.11.16",
50
+ "@mui/material": "^5.12.3",
51
+ "@nebula.js/conversion": "^4.0.0",
52
+ "@nebula.js/enigma-mocker": "^4.0.0",
53
+ "@nebula.js/locale": "^4.0.0",
54
+ "@nebula.js/nucleus": "^4.0.0",
55
+ "@nebula.js/supernova": "^4.0.0",
56
+ "@nebula.js/theme": "^4.0.0",
57
+ "@nebula.js/ui": "^4.0.0",
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.11",
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": "f8bf3d9036d17809c6f2c511b1e1b5928d4ddcf7"
71
+ "gitHead": "25856057bb28d545839e8118b0fd96db1af6f4aa"
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
  *
@@ -212,15 +221,13 @@ declare namespace stardust {
212
221
  }
213
222
 
214
223
  interface Context {
215
- keyboardNavigation?: boolean;
216
- constraints?: {
217
- active?: boolean;
218
- passive?: boolean;
219
- select?: boolean;
220
- };
221
224
  theme?: string;
222
225
  language?: string;
223
226
  deviceType?: string;
227
+ constraints?: stardust.Constraints;
228
+ interactions?: stardust.Interactions;
229
+ keyboardNavigation?: boolean;
230
+ disableCellPadding?: boolean;
224
231
  }
225
232
 
226
233
  interface Galaxy {
@@ -235,10 +242,23 @@ declare namespace stardust {
235
242
 
236
243
  /**
237
244
  * Renders a visualization or sheet into an HTMLElement.
245
+ * Visualizations can either be existing objects or created on the fly.
238
246
  * Support for sense sheets is experimental.
239
247
  * @param cfg The render configuration.
240
248
  */
241
- 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>;
242
262
 
243
263
  /**
244
264
  * Updates the current context of this embed instance.
@@ -357,7 +377,7 @@ declare namespace stardust {
357
377
 
358
378
  id: string;
359
379
 
360
- model: string;
380
+ model: EngineAPI.IGenericObject;
361
381
 
362
382
  /**
363
383
  * Destroys the visualization and removes it from the the DOM.
@@ -376,14 +396,14 @@ declare namespace stardust {
376
396
  * @param eventName Event name to listen to
377
397
  * @param listener Callback function to invoke
378
398
  */
379
- on(eventName: string, listener: ()=>void): void;
399
+ addListener(eventName: string, listener: ()=>void): void;
380
400
 
381
401
  /**
382
402
  * Removes a listener
383
403
  * @param eventName Event name to remove from
384
404
  * @param listener Callback function to remove
385
405
  */
386
- off(eventName: string, listener: ()=>void): void;
406
+ removeListener(eventName: string, listener: ()=>void): void;
387
407
 
388
408
  }
389
409
 
@@ -395,6 +415,62 @@ declare namespace stardust {
395
415
  isEnabled(flag: string): boolean;
396
416
  }
397
417
 
418
+ type Field = string | EngineAPI.INxDimension | EngineAPI.INxMeasure | stardust.LibraryField;
419
+
420
+ /**
421
+ * Rendering configuration for creating and rendering a new object
422
+ */
423
+ interface CreateConfig {
424
+ type: string;
425
+ version?: string;
426
+ fields?: stardust.Field[];
427
+ properties?: EngineAPI.IGenericObjectProperties;
428
+ }
429
+
430
+ /**
431
+ * Configuration for rendering a visualisation, either creating or fetching an existing object.
432
+ */
433
+ interface RenderConfig {
434
+ element: HTMLElement;
435
+ options?: object;
436
+ plugins?: stardust.Plugin[];
437
+ id?: string;
438
+ type?: string;
439
+ version?: string;
440
+ fields?: stardust.Field[];
441
+ extendProperties?: boolean;
442
+ properties?: EngineAPI.IGenericObjectProperties;
443
+ }
444
+
445
+ interface LibraryField {
446
+ qLibraryId: string;
447
+ type: "dimension" | "measure";
448
+ }
449
+
450
+ /**
451
+ * An object literal containing meta information about the plugin and a function containing the plugin implementation.
452
+ */
453
+ interface Plugin {
454
+ info: {
455
+ name: string;
456
+ };
457
+ fn: ()=>void;
458
+ }
459
+
460
+ interface LoadType {
461
+ (type: {
462
+ name: string;
463
+ version: string;
464
+ }): Promise<stardust.Visualization>;
465
+ }
466
+
467
+ interface TypeInfo {
468
+ name: string;
469
+ version?: string;
470
+ load: stardust.LoadType;
471
+ meta?: object;
472
+ }
473
+
398
474
  class AppSelections {
399
475
  constructor();
400
476
 
@@ -414,6 +490,20 @@ declare namespace stardust {
414
490
  class ObjectSelections {
415
491
  constructor();
416
492
 
493
+ /**
494
+ * Event listener function on instance
495
+ * @param eventType event type that function needs to listen
496
+ * @param callback a callback function to run when event emits
497
+ */
498
+ addListener(eventType: string, callback: ()=>void): void;
499
+
500
+ /**
501
+ * Remove listener function on instance
502
+ * @param eventType event type that function needs to listen
503
+ * @param callback a callback function to run when event emits
504
+ */
505
+ removeListener(eventType: string, callback: ()=>void): void;
506
+
417
507
  /**
418
508
  * @param paths
419
509
  */
@@ -455,64 +545,6 @@ declare namespace stardust {
455
545
 
456
546
  }
457
547
 
458
- type Field = string | EngineAPI.INxDimension | EngineAPI.INxMeasure | stardust.LibraryField;
459
-
460
- /**
461
- * Rendering configuration for creating and rendering a new object
462
- */
463
- interface CreateConfig extends stardust.BaseConfig{
464
- type: string;
465
- version?: string;
466
- fields?: stardust.Field[];
467
- extendProperties?: boolean;
468
- properties?: EngineAPI.IGenericObjectProperties;
469
- }
470
-
471
- /**
472
- * Basic rendering configuration for rendering an object
473
- */
474
- interface BaseConfig {
475
- element: HTMLElement;
476
- options?: object;
477
- plugins?: stardust.Plugin[];
478
- }
479
-
480
- /**
481
- * Rendering configuration for rendering an existing object
482
- */
483
- interface GetConfig extends stardust.BaseConfig{
484
- id: string;
485
- }
486
-
487
- interface LibraryField {
488
- qLibraryId: string;
489
- type: "dimension" | "measure";
490
- }
491
-
492
- /**
493
- * An object literal containing meta information about the plugin and a function containing the plugin implementation.
494
- */
495
- interface Plugin {
496
- info: {
497
- name: string;
498
- };
499
- fn: ()=>void;
500
- }
501
-
502
- interface LoadType {
503
- (type: {
504
- name: string;
505
- version: string;
506
- }): Promise<stardust.Visualization>;
507
- }
508
-
509
- interface TypeInfo {
510
- name: string;
511
- version?: string;
512
- load: stardust.LoadType;
513
- meta?: object;
514
- }
515
-
516
548
  interface ActionToolbarElement extends HTMLElement{
517
549
  className: "njs-action-toolbar-popover";
518
550
  }
@@ -586,10 +618,21 @@ declare namespace stardust {
586
618
  };
587
619
  }
588
620
 
621
+ /**
622
+ * @deprecated
623
+ */
589
624
  interface Constraints {
590
625
  passive?: boolean;
591
626
  active?: boolean;
592
627
  select?: boolean;
628
+ edit?: boolean;
629
+ }
630
+
631
+ interface Interactions {
632
+ passive?: boolean;
633
+ active?: boolean;
634
+ select?: boolean;
635
+ edit?: boolean;
593
636
  }
594
637
 
595
638
  interface RenderState {
@@ -601,17 +644,19 @@ declare namespace stardust {
601
644
  enabled: boolean;
602
645
  active: boolean;
603
646
  /**
604
- * Function used by the visualization to tell Nebula to it wants to relinquish focus
647
+ * Function used by the visualization to tell Nebula it wants to relinquish focus
648
+ * @param $
605
649
  */
606
- blur?(): void;
650
+ blur?($: boolean): void;
607
651
  /**
608
- * Function used by the visualization to tell Nebula to it wants focus
652
+ * Function used by the visualization to tell Nebula it wants to focus
609
653
  */
610
654
  focus?(): void;
611
655
  /**
612
- * Function used by the visualization to tell Nebula to focus the selection toolbar
656
+ * Function used by the visualization to tell Nebula that focus the selection toolbar
657
+ * @param $
613
658
  */
614
- focusSelection?(): void;
659
+ focusSelection?($: boolean): void;
615
660
  }
616
661
 
617
662
  /**
@@ -662,6 +707,12 @@ declare namespace stardust {
662
707
  class Translator {
663
708
  constructor();
664
709
 
710
+ /**
711
+ * Returns current locale.
712
+ * @param lang language Locale to updated the currentLocale value
713
+ */
714
+ language(lang?: string): string;
715
+
665
716
  /**
666
717
  * Registers a string in multiple locales
667
718
  * @param item
@@ -683,6 +734,11 @@ declare namespace stardust {
683
734
  class Theme {
684
735
  constructor();
685
736
 
737
+ /**
738
+ * Returns theme name
739
+ */
740
+ name(): string;
741
+
686
742
  getDataColorScales(): stardust.Theme.ScalePalette[];
687
743
 
688
744
  getDataColorPalettes(): stardust.Theme.DataPalette[];