@platforma-sdk/ui-vue 1.82.6 → 1.83.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 (50) hide show
  1. package/.turbo/turbo-build.log +11 -14
  2. package/.turbo/turbo-formatter$colon$check.log +2 -2
  3. package/.turbo/turbo-linter$colon$check.log +2 -2
  4. package/.turbo/turbo-types$colon$check.log +1 -1
  5. package/CHANGELOG.md +38 -0
  6. package/dist/components/PlAnnotations/components/PlAnnotations.vue2.js.map +1 -1
  7. package/dist/defineApp.d.ts +2 -32
  8. package/dist/defineApp.d.ts.map +1 -1
  9. package/dist/defineApp.js +20 -62
  10. package/dist/defineApp.js.map +1 -1
  11. package/dist/index.js +39 -39
  12. package/dist/internal/createAppV3.js +16 -16
  13. package/dist/lib/util/helpers/dist/utils.js +2 -5
  14. package/dist/lib/util/helpers/dist/utils.js.map +1 -1
  15. package/dist/lib.js +1 -1
  16. package/package.json +6 -6
  17. package/src/defineApp.ts +1 -183
  18. package/dist/internal/createAppModel.d.ts +0 -7
  19. package/dist/internal/createAppModel.d.ts.map +0 -1
  20. package/dist/internal/createAppModel.js +0 -57
  21. package/dist/internal/createAppModel.js.map +0 -1
  22. package/dist/internal/createAppV1.d.ts +0 -53
  23. package/dist/internal/createAppV1.d.ts.map +0 -1
  24. package/dist/internal/createAppV1.js +0 -129
  25. package/dist/internal/createAppV1.js.map +0 -1
  26. package/dist/internal/createAppV2.d.ts +0 -50
  27. package/dist/internal/createAppV2.d.ts.map +0 -1
  28. package/dist/internal/createAppV2.js +0 -137
  29. package/dist/internal/createAppV2.js.map +0 -1
  30. package/dist/internal/createAppV2.test.d.ts +0 -15
  31. package/dist/internal/createAppV2.test.d.ts.map +0 -1
  32. package/dist/internal/test-helpers/BlockMock.d.ts +0 -29
  33. package/dist/internal/test-helpers/BlockMock.d.ts.map +0 -1
  34. package/dist/internal/test-helpers/createMockApi.d.ts +0 -4
  35. package/dist/internal/test-helpers/createMockApi.d.ts.map +0 -1
  36. package/dist/internal/test-helpers/utils.d.ts +0 -4
  37. package/dist/internal/test-helpers/utils.d.ts.map +0 -1
  38. package/dist/internal/v1.static-test.d.ts +0 -7
  39. package/dist/internal/v1.static-test.d.ts.map +0 -1
  40. package/dist/internal/v2.static-test.d.ts +0 -7
  41. package/dist/internal/v2.static-test.d.ts.map +0 -1
  42. package/src/internal/createAppModel.ts +0 -112
  43. package/src/internal/createAppV1.ts +0 -324
  44. package/src/internal/createAppV2.test.ts +0 -207
  45. package/src/internal/createAppV2.ts +0 -392
  46. package/src/internal/test-helpers/BlockMock.ts +0 -161
  47. package/src/internal/test-helpers/createMockApi.ts +0 -104
  48. package/src/internal/test-helpers/utils.ts +0 -65
  49. package/src/internal/v1.static-test.ts +0 -107
  50. package/src/internal/v2.static-test.ts +0 -107
@@ -1,65 +0,0 @@
1
- import { randomRangeInt, range, times, toList } from "@milaboratories/helpers";
2
- import { faker } from "@faker-js/faker";
3
- import type { ImportFileHandleUpload, ListFilesResult, LsEntry } from "@platforma-sdk/model";
4
-
5
- export const capitalizeFirstLetter = (str: string) => {
6
- return str.charAt(0).toUpperCase() + str.slice(1);
7
- };
8
-
9
- const d = new Map<string, LsEntry[]>();
10
-
11
- export const getLsFilesResult = (path: string): ListFilesResult => {
12
- const length = randomRangeInt(1, 1000);
13
-
14
- if (path.endsWith("11")) {
15
- throw Error("Some error " + faker.lorem.paragraph() + faker.lorem.paragraph());
16
- }
17
-
18
- if (!d.has(path)) {
19
- const dirPath = path === "/" ? "" : path;
20
-
21
- d.set(
22
- path,
23
- toList(range(0, length)).map((i) => {
24
- if (i < 10) {
25
- let name = faker.word.noun();
26
- if (Math.random() < 0.2) {
27
- name = "." + name;
28
- }
29
- return {
30
- type: "dir",
31
- name,
32
- fullPath: dirPath + "/" + name,
33
- };
34
- }
35
-
36
- const name =
37
- times(randomRangeInt(1, 40), () => {
38
- if (Math.random() < 0.2) {
39
- return capitalizeFirstLetter(faker.word.noun());
40
- }
41
-
42
- return faker.word.noun();
43
- }).join(" ") + faker.system.commonFileName();
44
-
45
- const handle = `upload://upload/${encodeURIComponent(
46
- JSON.stringify({
47
- localPath: dirPath + "/" + name,
48
- }),
49
- )}` as ImportFileHandleUpload;
50
-
51
- return {
52
- type: "file",
53
- name,
54
- fullPath: dirPath + "/" + name,
55
- handle,
56
- };
57
- }),
58
- );
59
- }
60
-
61
- return {
62
- parent: "/",
63
- entries: d.get(path)!,
64
- };
65
- };
@@ -1,107 +0,0 @@
1
- import type { Expect, Equal } from "@milaboratories/helpers";
2
- import { z } from "zod";
3
- import type { ModelOptions, Model } from "../types";
4
- import type {
5
- BlockOutputsBase,
6
- InferHrefType,
7
- InferOutputsType,
8
- OutputWithStatus,
9
- Platforma,
10
- } from "@platforma-sdk/model";
11
- import type { BaseAppV1, createAppV1 } from "./createAppV1";
12
- import { type AppV1 } from "../defineApp";
13
- import { computed, type Component } from "vue";
14
-
15
- declare function __createModel<M, V = unknown>(options: ModelOptions<M, V>): Model<M>;
16
-
17
- declare const __args: {
18
- seed: number;
19
- };
20
-
21
- const validate = z.coerce.number().int().parse;
22
-
23
- type _number = ReturnType<typeof validate>;
24
-
25
- const __model1 = __createModel({
26
- get() {
27
- return String(__args.seed);
28
- },
29
- validate,
30
- autoSave: true,
31
- onSave(_seed) {
32
- //
33
- },
34
- });
35
-
36
- const __model2 = __createModel({
37
- get() {
38
- return __args.seed;
39
- },
40
- validate,
41
- autoSave: true,
42
- onSave(_seed) {
43
- //
44
- },
45
- });
46
-
47
- type InferArgs<Pl extends Platforma> = Pl extends Platforma<infer Args> ? Args : never;
48
- type InferUiState<Pl extends Platforma> =
49
- Pl extends Platforma<unknown, BlockOutputsBase, infer UiState> ? UiState : never;
50
-
51
- export type TestApp<P extends Platforma> = ReturnType<
52
- typeof createAppV1<InferArgs<P>, InferOutputsType<P>, InferUiState<P>, InferHrefType<P>>
53
- >;
54
-
55
- type _Args = {
56
- x: number;
57
- y: string[];
58
- };
59
-
60
- type _Outputs = {
61
- sum: OutputWithStatus<number> & { __unwrap: true };
62
- };
63
-
64
- type _UiState = {
65
- flag: boolean;
66
- };
67
-
68
- type _App1 = BaseAppV1<_Args, _Outputs, _UiState, "/">;
69
- type _App2 = TestApp<Platforma<_Args, _Outputs, _UiState, "/">>;
70
-
71
- const _local = () => {
72
- const counter = computed(() => 1);
73
- const label = computed(() => "aaaa");
74
-
75
- const method = () => 100;
76
-
77
- return {
78
- counter,
79
- label,
80
- method,
81
- routes: {
82
- "/": undefined as unknown as Component,
83
- },
84
- };
85
- };
86
-
87
- type ExtApp = AppV1<1, BlockOutputsBase, unknown, "/", ReturnType<typeof _local>>;
88
-
89
- type _UpdateArgsParams = Parameters<Parameters<_App1["updateArgs"]>[0]>[0];
90
-
91
- type __cases = [
92
- Expect<Equal<Model<string>, typeof __model1>>,
93
- Expect<Equal<Model<number>, typeof __model2>>,
94
- Expect<Equal<Model<string>, typeof __model1>>,
95
- Expect<Equal<Model<number>, typeof __model2>>,
96
- Expect<Equal<_App1, _App2>>,
97
- Expect<Equal<ExtApp["counter"], number>>,
98
- Expect<Equal<ExtApp["label"], string>>,
99
- Expect<Equal<ExtApp["method"], () => number>>,
100
- Expect<Equal<_App1["snapshot"]["args"], Readonly<_Args>>>,
101
- Expect<Equal<_App1["model"]["outputs"]["sum"], number | undefined>>,
102
- Expect<Equal<_App1["model"]["outputErrors"]["sum"], Error | undefined>>,
103
- Expect<Equal<_App1["snapshot"]["ui"], Readonly<_UiState>>>,
104
- Expect<Equal<_App1["model"]["args"], _Args>>,
105
- Expect<Equal<_App1["model"]["ui"], _UiState>>,
106
- Expect<Equal<_UpdateArgsParams, _Args>>,
107
- ];
@@ -1,107 +0,0 @@
1
- import type { Expect, Equal } from "@milaboratories/helpers";
2
- import { z } from "zod";
3
- import type { ModelOptions, Model } from "../types";
4
- import type {
5
- BlockOutputsBase,
6
- InferHrefType,
7
- InferOutputsType,
8
- OutputWithStatus,
9
- Platforma,
10
- } from "@platforma-sdk/model";
11
- import type { BaseAppV2, createAppV2 } from "./createAppV2";
12
- import { type AppV2 } from "../defineApp";
13
- import { computed, type Component } from "vue";
14
-
15
- declare function __createModel<M, V = unknown>(options: ModelOptions<M, V>): Model<M>;
16
-
17
- declare const __args: {
18
- seed: number;
19
- };
20
-
21
- const validate = z.coerce.number().int().parse;
22
-
23
- type _number = ReturnType<typeof validate>;
24
-
25
- const __model1 = __createModel({
26
- get() {
27
- return String(__args.seed);
28
- },
29
- validate,
30
- autoSave: true,
31
- onSave(_seed) {
32
- //
33
- },
34
- });
35
-
36
- const __model2 = __createModel({
37
- get() {
38
- return __args.seed;
39
- },
40
- validate,
41
- autoSave: true,
42
- onSave(_seed) {
43
- //
44
- },
45
- });
46
-
47
- type InferArgs<Pl extends Platforma> = Pl extends Platforma<infer Args> ? Args : never;
48
- type InferUiState<Pl extends Platforma> =
49
- Pl extends Platforma<unknown, BlockOutputsBase, infer UiState> ? UiState : never;
50
-
51
- export type TestApp<P extends Platforma> = ReturnType<
52
- typeof createAppV2<InferArgs<P>, InferOutputsType<P>, InferUiState<P>, InferHrefType<P>>
53
- >;
54
-
55
- type _Args = {
56
- x: number;
57
- y: string[];
58
- };
59
-
60
- type _Outputs = {
61
- sum: OutputWithStatus<number> & { __unwrap: true };
62
- };
63
-
64
- type _UiState = {
65
- flag: boolean;
66
- };
67
-
68
- type _App1 = BaseAppV2<_Args, _Outputs, _UiState, "/">;
69
- type _App2 = TestApp<Platforma<_Args, _Outputs, _UiState, "/">>;
70
-
71
- const _local = () => {
72
- const counter = computed(() => 1);
73
- const label = computed(() => "aaaa");
74
-
75
- const method = () => 100;
76
-
77
- return {
78
- counter,
79
- label,
80
- method,
81
- routes: {
82
- "/": undefined as unknown as Component,
83
- },
84
- };
85
- };
86
-
87
- type ExtApp = AppV2<1, BlockOutputsBase, unknown, "/", ReturnType<typeof _local>>;
88
-
89
- type _UpdateArgsParams = Parameters<Parameters<_App1["updateArgs"]>[0]>[0];
90
-
91
- type __cases = [
92
- Expect<Equal<Model<string>, typeof __model1>>,
93
- Expect<Equal<Model<number>, typeof __model2>>,
94
- Expect<Equal<Model<string>, typeof __model1>>,
95
- Expect<Equal<Model<number>, typeof __model2>>,
96
- Expect<Equal<_App1, _App2>>,
97
- Expect<Equal<ExtApp["counter"], number>>,
98
- Expect<Equal<ExtApp["label"], string>>,
99
- Expect<Equal<ExtApp["method"], () => number>>,
100
- Expect<Equal<_App1["snapshot"]["args"], _Args>>,
101
- Expect<Equal<_App1["model"]["outputs"]["sum"], number | undefined>>,
102
- Expect<Equal<_App1["model"]["outputErrors"]["sum"], Error | undefined>>,
103
- Expect<Equal<_App1["snapshot"]["ui"], _UiState>>,
104
- Expect<Equal<_App1["model"]["args"], _Args>>,
105
- Expect<Equal<_App1["model"]["ui"], _UiState>>,
106
- Expect<Equal<_UpdateArgsParams, _Args>>,
107
- ];