@perspective-dev/viewer 5.7.0 → 5.9.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 (29) hide show
  1. package/dist/cdn/perspective-viewer.js +10 -10
  2. package/dist/cdn/perspective-viewer.js.map +4 -4
  3. package/dist/custom-elements.json +60 -3
  4. package/dist/docs/perspective-docs.json +1 -1
  5. package/dist/esm/bootstrap.d.ts +33 -4
  6. package/dist/esm/perspective-viewer.d.ts +5 -3
  7. package/dist/esm/perspective-viewer.js +124 -120
  8. package/dist/esm/perspective-viewer.js.map +3 -3
  9. package/dist/ts-rs/Layout.d.ts +1 -1
  10. package/dist/ts-rs/OptionalUpdate.d.ts +4 -0
  11. package/dist/ts-rs/PanelViewerConfig.d.ts +3 -3
  12. package/dist/ts-rs/SplitLayout.d.ts +2 -1
  13. package/dist/ts-rs/ViewOnUpdateResp.d.ts +1 -1
  14. package/dist/ts-rs/ViewerConfig.d.ts +14 -10
  15. package/dist/ts-rs/ViewerConfigInitial.d.ts +2 -2
  16. package/dist/ts-rs/ViewerConfigUpdate.d.ts +4 -0
  17. package/dist/ts-rs/WorkspaceConfig.d.ts +16 -2
  18. package/dist/ts-rs/WorkspaceConfigUpdate.d.ts +7 -6
  19. package/dist/wasm/perspective-viewer.d.ts +44 -28
  20. package/dist/wasm/perspective-viewer.js +187 -129
  21. package/dist/wasm/perspective-viewer.wasm +0 -0
  22. package/dist/wasm/perspective-viewer.wasm.d.ts +20 -18
  23. package/package.json +5 -5
  24. /package/dist/wasm/snippets/{perspective-viewer-c26bfdc60d367a99 → perspective-viewer-d50f032e5aa67e6f}/inline0.js +0 -0
  25. /package/dist/wasm/snippets/{perspective-viewer-c26bfdc60d367a99 → perspective-viewer-d50f032e5aa67e6f}/inline1.js +0 -0
  26. /package/dist/wasm/snippets/{perspective-viewer-c26bfdc60d367a99 → perspective-viewer-d50f032e5aa67e6f}/inline2.js +0 -0
  27. /package/dist/wasm/snippets/{perspective-viewer-c26bfdc60d367a99 → perspective-viewer-d50f032e5aa67e6f}/inline3.js +0 -0
  28. /package/dist/wasm/snippets/{perspective-viewer-c26bfdc60d367a99 → perspective-viewer-d50f032e5aa67e6f}/inline4.js +0 -0
  29. /package/dist/wasm/snippets/{perspective-viewer-c26bfdc60d367a99 → perspective-viewer-d50f032e5aa67e6f}/inline5.js +0 -0
@@ -1,5 +1,5 @@
1
1
  import type * as wasm_module_type from "../../dist/wasm/perspective-viewer.js";
2
- import type { InitOptions, MigrateKind, MigrateResult, WasmRegistration } from "@perspective-dev/client/registry";
2
+ import type { InitOptions, MigrateKind, MigrateResult, Validator, WasmRegistration } from "@perspective-dev/client/registry";
3
3
  export type { InitOptions, WasmBinary, WasmRegistration, WasmSource, } from "@perspective-dev/client/registry";
4
4
  /**
5
5
  * Register Perspective's WebAssembly binaries for this page; the same function
@@ -29,21 +29,50 @@ export interface ViewerWasmRegistration {
29
29
  * ```javascript
30
30
  * await init_client({
31
31
  * viewer: () => fetch("perspective-viewer.wasm"),
32
- * migrate: () => fetch("perspective-migrate-js.wasm"),
32
+ * migrate: () => fetch("perspective-migrate.wasm"),
33
33
  * });
34
34
  * ```
35
35
  */
36
36
  export declare function init_client(wasm: ViewerWasmSource | ViewerWasmRegistration, wasm_module?: typeof wasm_module_type): Promise<void>;
37
+ /**
38
+ * Load the `migrate` binary registered with `init()` and return synchronous
39
+ * `migrate()` and `validate()` over it; the page shares one instance.
40
+ *
41
+ * # Examples
42
+ *
43
+ * ```javascript
44
+ * const validator = await perspective_viewer.create_validator();
45
+ * for (const token of tokens) {
46
+ * validator.validate("viewer", token, { strict: true });
47
+ * }
48
+ * ```
49
+ */
50
+ export declare function create_validator(): Promise<Validator>;
37
51
  /**
38
52
  * Upgrade a persisted config written by any Perspective release since 2.0.0
39
53
  * to the current schema, using the `migrate` binary registered with `init()`.
40
54
  *
41
55
  * # Arguments
42
56
  *
43
- * - `kind` - `"view"` for a `ViewConfig`, `"viewer"` for a `save()` token, or
44
- * `"workspace"` for a `saveWorkspace()` token.
57
+ * - `kind` - `"view"` for a `ViewConfig`, `"viewer"` for a `save()` token,
58
+ * `"panel"` for one workspace panel, or `"workspace"` for a
59
+ * `saveWorkspace()` token.
45
60
  * - `config` - The config to upgrade.
46
61
  * - `from_version` - The release which wrote `config`, used only when it has
47
62
  * no `version` field.
48
63
  */
49
64
  export declare function migrate<T = Record<string, unknown>>(kind: MigrateKind, config: unknown, from_version?: string): Promise<MigrateResult<T>>;
65
+ /**
66
+ * Check that a config is valid for this release without migrating it,
67
+ * rejecting with the offending JSON pointer and reason otherwise.
68
+ *
69
+ * # Arguments
70
+ *
71
+ * - `kind` - `"view"`, `"viewer"`, `"panel"` or `"workspace"`.
72
+ * - `config` - The config to check.
73
+ * - `options.strict` - Require the complete `save()` form rather than the
74
+ * field-wise `restore()` update form.
75
+ */
76
+ export declare function validate(kind: MigrateKind, config: unknown, options?: {
77
+ strict?: boolean;
78
+ }): Promise<void>;
@@ -45,13 +45,15 @@ export type * from "../../dist/ts-rs/GetTableOptions.d.ts";
45
45
  export type * from "../../dist/ts-rs/GetClientOptions.d.ts";
46
46
  export type * from "../../dist/ts-rs/GetViewOptions.d.ts";
47
47
  export type * from "../../dist/ts-rs/GetViewMode.d.ts";
48
- export { init, init_client, migrate } from "./bootstrap.ts";
48
+ export { create_validator, init, init_client, migrate, validate, } from "./bootstrap.ts";
49
49
  export type { InitOptions, ViewerWasmRegistration, ViewerWasmSource, WasmBinary, WasmRegistration, WasmSource, } from "./bootstrap.ts";
50
- export type { MigrateKind, MigrateNotice, MigrateResult, } from "@perspective-dev/client";
51
- import { init, init_client, migrate } from "./bootstrap.ts";
50
+ export type { MigrateKind, MigrateNotice, MigrateResult, Validator, } from "@perspective-dev/client";
51
+ import { create_validator, init, init_client, migrate, validate } from "./bootstrap.ts";
52
52
  declare const _default: {
53
+ create_validator: typeof create_validator;
53
54
  init: typeof init;
54
55
  init_client: typeof init_client;
55
56
  migrate: typeof migrate;
57
+ validate: typeof validate;
56
58
  };
57
59
  export default _default;