@platforma-sdk/model 1.57.2 → 1.58.1
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/dist/block_migrations.cjs +60 -77
- package/dist/block_migrations.cjs.map +1 -1
- package/dist/block_migrations.d.ts +35 -32
- package/dist/block_migrations.d.ts.map +1 -1
- package/dist/block_migrations.js +60 -78
- package/dist/block_migrations.js.map +1 -1
- package/dist/block_model.cjs +18 -14
- package/dist/block_model.cjs.map +1 -1
- package/dist/block_model.d.ts +5 -5
- package/dist/block_model.d.ts.map +1 -1
- package/dist/block_model.js +18 -14
- package/dist/block_model.js.map +1 -1
- package/dist/block_model_legacy.cjs +1 -0
- package/dist/block_model_legacy.cjs.map +1 -1
- package/dist/block_model_legacy.d.ts.map +1 -1
- package/dist/block_model_legacy.js +1 -0
- package/dist/block_model_legacy.js.map +1 -1
- package/dist/block_storage.cjs +24 -20
- package/dist/block_storage.cjs.map +1 -1
- package/dist/block_storage.d.ts +20 -16
- package/dist/block_storage.d.ts.map +1 -1
- package/dist/block_storage.js +24 -20
- package/dist/block_storage.js.map +1 -1
- package/dist/block_storage_callbacks.cjs +4 -3
- package/dist/block_storage_callbacks.cjs.map +1 -1
- package/dist/block_storage_callbacks.d.ts +7 -5
- package/dist/block_storage_callbacks.d.ts.map +1 -1
- package/dist/block_storage_callbacks.js +4 -3
- package/dist/block_storage_callbacks.js.map +1 -1
- package/dist/components/PFrameForGraphs.cjs +0 -117
- package/dist/components/PFrameForGraphs.cjs.map +1 -1
- package/dist/components/PFrameForGraphs.d.ts +3 -5
- package/dist/components/PFrameForGraphs.d.ts.map +1 -1
- package/dist/components/PFrameForGraphs.js +2 -117
- package/dist/components/PFrameForGraphs.js.map +1 -1
- package/dist/index.cjs +8 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.js +1 -1
- package/dist/pframe_utils/axes.cjs +131 -0
- package/dist/pframe_utils/axes.cjs.map +1 -0
- package/dist/pframe_utils/axes.d.ts +15 -0
- package/dist/pframe_utils/axes.d.ts.map +1 -0
- package/dist/pframe_utils/axes.js +128 -0
- package/dist/pframe_utils/axes.js.map +1 -0
- package/dist/pframe_utils/columns.cjs +4 -8
- package/dist/pframe_utils/columns.cjs.map +1 -1
- package/dist/pframe_utils/columns.js +1 -5
- package/dist/pframe_utils/columns.js.map +1 -1
- package/dist/pframe_utils/index.cjs +0 -3
- package/dist/pframe_utils/index.cjs.map +1 -1
- package/dist/pframe_utils/index.js +0 -3
- package/dist/pframe_utils/index.js.map +1 -1
- package/dist/platforma.d.ts +12 -2
- package/dist/platforma.d.ts.map +1 -1
- package/dist/plugin_handle.cjs +29 -0
- package/dist/plugin_handle.cjs.map +1 -0
- package/dist/plugin_handle.d.ts +51 -0
- package/dist/plugin_handle.d.ts.map +1 -0
- package/dist/plugin_handle.js +25 -0
- package/dist/plugin_handle.js.map +1 -0
- package/dist/plugin_model.cjs +29 -29
- package/dist/plugin_model.cjs.map +1 -1
- package/dist/plugin_model.d.ts +43 -35
- package/dist/plugin_model.d.ts.map +1 -1
- package/dist/plugin_model.js +29 -29
- package/dist/plugin_model.js.map +1 -1
- package/dist/render/api.cjs +9 -5
- package/dist/render/api.cjs.map +1 -1
- package/dist/render/api.d.ts +11 -5
- package/dist/render/api.d.ts.map +1 -1
- package/dist/render/api.js +9 -5
- package/dist/render/api.js.map +1 -1
- package/package.json +6 -6
- package/src/block_migrations.test.ts +109 -12
- package/src/block_migrations.ts +63 -87
- package/src/block_model.ts +34 -20
- package/src/block_model_legacy.ts +1 -0
- package/src/block_storage.test.ts +11 -10
- package/src/block_storage.ts +40 -32
- package/src/block_storage_callbacks.ts +12 -10
- package/src/components/PFrameForGraphs.ts +4 -167
- package/src/index.ts +24 -2
- package/src/pframe_utils/axes.ts +175 -0
- package/src/pframe_utils/columns.ts +2 -2
- package/src/platforma.ts +17 -2
- package/src/plugin_handle.ts +85 -0
- package/src/plugin_model.test.ts +2 -2
- package/src/plugin_model.ts +120 -58
- package/src/render/api.ts +21 -11
package/src/render/api.ts
CHANGED
|
@@ -50,6 +50,12 @@ import canonicalize from "canonicalize";
|
|
|
50
50
|
import type { Optional } from "utility-types";
|
|
51
51
|
import { getCfgRenderCtx } from "../internal";
|
|
52
52
|
import { getPluginData } from "../block_storage";
|
|
53
|
+
import type {
|
|
54
|
+
PluginHandle,
|
|
55
|
+
PluginFactoryLike,
|
|
56
|
+
InferFactoryData,
|
|
57
|
+
InferFactoryParams,
|
|
58
|
+
} from "../plugin_handle";
|
|
53
59
|
import { TreeNodeAccessor, ifDef } from "./accessor";
|
|
54
60
|
import type { FutureRef } from "./future";
|
|
55
61
|
import type { AccessorHandle, GlobalCfgRenderCtx } from "./internal";
|
|
@@ -756,40 +762,44 @@ export class RenderCtxLegacy<Args = unknown, UiState = unknown> extends RenderCt
|
|
|
756
762
|
/**
|
|
757
763
|
* Render context for plugin output functions.
|
|
758
764
|
* Reads plugin data from blockStorage and derives params from pre-wrapped input callbacks.
|
|
765
|
+
*
|
|
766
|
+
* Parameterized on the factory-like phantom F so that getPluginData returns
|
|
767
|
+
* InferFactoryData<F> directly — no casts needed for the data getter.
|
|
768
|
+
*
|
|
769
|
+
* @typeParam F - PluginFactoryLike phantom carrying data/params/outputs types
|
|
759
770
|
*/
|
|
760
|
-
export class PluginRenderCtx<
|
|
771
|
+
export class PluginRenderCtx<F extends PluginFactoryLike = PluginFactoryLike> {
|
|
761
772
|
private readonly ctx: GlobalCfgRenderCtx;
|
|
762
|
-
private readonly
|
|
773
|
+
private readonly handle: PluginHandle<F>;
|
|
763
774
|
private readonly wrappedInputs: Record<string, () => unknown>;
|
|
764
775
|
|
|
765
|
-
constructor(
|
|
776
|
+
constructor(handle: PluginHandle<F>, wrappedInputs: Record<string, () => unknown>) {
|
|
766
777
|
this.ctx = getCfgRenderCtx();
|
|
767
|
-
this.
|
|
778
|
+
this.handle = handle;
|
|
768
779
|
this.wrappedInputs = wrappedInputs;
|
|
769
780
|
}
|
|
770
781
|
|
|
771
|
-
private dataCache?: { v:
|
|
782
|
+
private dataCache?: { v: InferFactoryData<F> };
|
|
772
783
|
|
|
773
784
|
/** Plugin's persistent data from blockStorage.__plugins.{pluginId}.__data */
|
|
774
|
-
public get data():
|
|
785
|
+
public get data(): InferFactoryData<F> {
|
|
775
786
|
if (this.dataCache === undefined) {
|
|
776
787
|
const raw = this.ctx.blockStorage();
|
|
777
|
-
|
|
778
|
-
this.dataCache = { v: pluginData };
|
|
788
|
+
this.dataCache = { v: getPluginData(parseJson(raw), this.handle) };
|
|
779
789
|
}
|
|
780
790
|
return this.dataCache.v;
|
|
781
791
|
}
|
|
782
792
|
|
|
783
|
-
private paramsCache?: { v:
|
|
793
|
+
private paramsCache?: { v: InferFactoryParams<F> };
|
|
784
794
|
|
|
785
795
|
/** Params derived from block context via pre-wrapped input callbacks */
|
|
786
|
-
public get params():
|
|
796
|
+
public get params(): InferFactoryParams<F> {
|
|
787
797
|
if (this.paramsCache === undefined) {
|
|
788
798
|
const result: Record<string, unknown> = {};
|
|
789
799
|
for (const [key, fn] of Object.entries(this.wrappedInputs)) {
|
|
790
800
|
result[key] = fn();
|
|
791
801
|
}
|
|
792
|
-
this.paramsCache = { v: result as
|
|
802
|
+
this.paramsCache = { v: result as InferFactoryParams<F> };
|
|
793
803
|
}
|
|
794
804
|
return this.paramsCache.v;
|
|
795
805
|
}
|