@platforma-sdk/ui-vue 1.63.5 → 1.63.12
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/.turbo/turbo-build.log +157 -159
- package/.turbo/turbo-formatter$colon$check.log +2 -2
- package/.turbo/turbo-linter$colon$check.log +2 -2
- package/.turbo/turbo-types$colon$check.log +1 -1
- package/CHANGELOG.md +20 -0
- package/dist/AgGridVue/AgGridTheme.js +3 -1
- package/dist/AgGridVue/AgGridTheme.js.map +1 -1
- package/dist/AgGridVue/ag-override.js +2 -0
- package/dist/AgGridVue/ag-override.js.map +1 -1
- package/dist/AgGridVue/createAgGridColDef.js +2 -35
- package/dist/AgGridVue/createAgGridColDef.js.map +1 -1
- package/dist/AgGridVue/selection.js +2 -23
- package/dist/AgGridVue/selection.js.map +1 -1
- package/dist/AgGridVue/useAgGridOptions.js +2 -83
- package/dist/AgGridVue/useAgGridOptions.js.map +1 -1
- package/dist/_virtual/_plugin-vue_export-helper.js +2 -0
- package/dist/_virtual/_rolldown/runtime.js +2 -0
- package/dist/components/BlockLayout.js +1 -0
- package/dist/components/BlockLayout.style.js +1 -0
- package/dist/components/BlockLayout.vue2.js +2 -0
- package/dist/components/BlockLayout.vue2.js.map +1 -1
- package/dist/components/BlockLoader.js +2 -0
- package/dist/components/BlockLoader.vue2.js +2 -0
- package/dist/components/BlockLoader.vue2.js.map +1 -1
- package/dist/components/LoaderPage.js +2 -0
- package/dist/components/LoaderPage.js.map +1 -1
- package/dist/components/NotFound.js +2 -0
- package/dist/components/NotFound.vue2.js +2 -0
- package/dist/components/NotFound.vue2.js.map +1 -1
- package/dist/components/PlAdvancedFilter/FilterEditor.js +1 -0
- package/dist/components/PlAdvancedFilter/FilterEditor.style.js +1 -0
- package/dist/components/PlAdvancedFilter/FilterEditor.vue2.js +2 -0
- package/dist/components/PlAdvancedFilter/FilterEditor.vue2.js.map +1 -1
- package/dist/components/PlAdvancedFilter/OperandButton.js +1 -0
- package/dist/components/PlAdvancedFilter/OperandButton.style.js +1 -0
- package/dist/components/PlAdvancedFilter/OperandButton.vue2.js +2 -0
- package/dist/components/PlAdvancedFilter/OperandButton.vue2.js.map +1 -1
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.js +1 -0
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.style.js +1 -0
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue2.js +2 -0
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue2.js.map +1 -1
- package/dist/components/PlAdvancedFilter/constants.js +4 -4
- package/dist/components/PlAdvancedFilter/constants.js.map +1 -1
- package/dist/components/PlAdvancedFilter/index.js +3 -1
- package/dist/components/PlAdvancedFilter/index.js.map +1 -1
- package/dist/components/PlAdvancedFilter/utils.js +2 -0
- package/dist/components/PlAdvancedFilter/utils.js.map +1 -1
- package/dist/components/PlAgCellFile/PlAgCellFile.js +2 -0
- package/dist/components/PlAgCellFile/PlAgCellFile.vue2.js +2 -4
- package/dist/components/PlAgCellFile/PlAgCellFile.vue2.js.map +1 -1
- package/dist/components/PlAgCellProgress/PlAgCellProgress.js +2 -0
- package/dist/components/PlAgCellProgress/PlAgCellProgress.vue2.js +2 -0
- package/dist/components/PlAgCellProgress/PlAgCellProgress.vue2.js.map +1 -1
- package/dist/components/PlAgCellStatusTag/PlAgCellStatusTag.js +2 -0
- package/dist/components/PlAgCellStatusTag/PlAgCellStatusTag.vue2.js +2 -0
- package/dist/components/PlAgCellStatusTag/PlAgCellStatusTag.vue2.js.map +1 -1
- package/dist/components/PlAgChartHistogramCell/PlAgChartHistogramCell.js +2 -0
- package/dist/components/PlAgChartHistogramCell/PlAgChartHistogramCell.vue2.js +2 -0
- package/dist/components/PlAgChartHistogramCell/PlAgChartHistogramCell.vue2.js.map +1 -1
- package/dist/components/PlAgChartStackedBarCell/PlAgChartStackedBarCell.js +2 -0
- package/dist/components/PlAgChartStackedBarCell/PlAgChartStackedBarCell.vue2.js +2 -0
- package/dist/components/PlAgChartStackedBarCell/PlAgChartStackedBarCell.vue2.js.map +1 -1
- package/dist/components/PlAgColumnHeader/PlAgColumnHeader.js +2 -0
- package/dist/components/PlAgColumnHeader/PlAgColumnHeader.vue2.js +2 -0
- package/dist/components/PlAgColumnHeader/PlAgColumnHeader.vue2.js.map +1 -1
- package/dist/components/PlAgCsvExporter/PlAgCsvExporter.js +2 -0
- package/dist/components/PlAgCsvExporter/PlAgCsvExporter.vue2.js +2 -0
- package/dist/components/PlAgCsvExporter/PlAgCsvExporter.vue2.js.map +1 -1
- package/dist/components/PlAgCsvExporter/export-csv.js +2 -0
- package/dist/components/PlAgCsvExporter/export-csv.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableSheets.js +1 -0
- package/dist/components/PlAgDataTable/PlAgDataTableSheets.style.js +1 -0
- package/dist/components/PlAgDataTable/PlAgDataTableSheets.vue2.js +2 -0
- package/dist/components/PlAgDataTable/PlAgDataTableSheets.vue2.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableV2.js +1 -0
- package/dist/components/PlAgDataTable/PlAgDataTableV2.style.js +1 -0
- package/dist/components/PlAgDataTable/PlAgDataTableV2.vue2.js +2 -0
- package/dist/components/PlAgDataTable/PlAgDataTableV2.vue2.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgOverlayLoading.js +2 -0
- package/dist/components/PlAgDataTable/PlAgOverlayLoading.vue2.js +2 -0
- package/dist/components/PlAgDataTable/PlAgOverlayLoading.vue2.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgOverlayNoRows.js +2 -0
- package/dist/components/PlAgDataTable/PlAgOverlayNoRows.vue2.js +2 -0
- package/dist/components/PlAgDataTable/PlAgOverlayNoRows.vue2.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgRowCount.js +2 -0
- package/dist/components/PlAgDataTable/PlAgRowCount.vue2.js +2 -0
- package/dist/components/PlAgDataTable/PlAgRowCount.vue2.js.map +1 -1
- package/dist/components/PlAgDataTable/compositions/useFilterableColumns.js +2 -0
- package/dist/components/PlAgDataTable/compositions/useFilterableColumns.js.map +1 -1
- package/dist/components/PlAgDataTable/compositions/useGrid.js +2 -0
- package/dist/components/PlAgDataTable/compositions/useGrid.js.map +1 -1
- package/dist/components/PlAgDataTable/index.js +2 -0
- package/dist/components/PlAgDataTable/index.js.map +1 -1
- package/dist/components/PlAgDataTable/pl-ag-overlay-loading.module.js +1 -0
- package/dist/components/PlAgDataTable/sources/common.js +3 -1
- package/dist/components/PlAgDataTable/sources/common.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/focus-row.js +2 -0
- package/dist/components/PlAgDataTable/sources/focus-row.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/menu-items.js +2 -0
- package/dist/components/PlAgDataTable/sources/menu-items.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/row-number.js +3 -2
- package/dist/components/PlAgDataTable/sources/row-number.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/table-source-v2.js +2 -5
- package/dist/components/PlAgDataTable/sources/table-source-v2.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/table-state-v2.js +2 -0
- package/dist/components/PlAgDataTable/sources/table-state-v2.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/value-rendering.js +2 -0
- package/dist/components/PlAgDataTable/sources/value-rendering.js.map +1 -1
- package/dist/components/PlAgDataTable/types.js +2 -0
- package/dist/components/PlAgDataTable/types.js.map +1 -1
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.js +1 -0
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.style.js +1 -0
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.vue2.js +2 -0
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.vue2.js.map +1 -1
- package/dist/components/PlAgGridColumnManager/useFilteredItems.js +2 -0
- package/dist/components/PlAgGridColumnManager/useFilteredItems.js.map +1 -1
- package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.js +2 -0
- package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue2.js +2 -0
- package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue2.js.map +1 -1
- package/dist/components/PlAgRowNumCheckbox/pl-ag-row-num-checkbox.module.js +1 -0
- package/dist/components/PlAgRowNumHeader.js +2 -0
- package/dist/components/PlAgRowNumHeader.vue2.js +2 -0
- package/dist/components/PlAgRowNumHeader.vue2.js.map +1 -1
- package/dist/components/PlAgTextAndButtonCell/PlAgTextAndButtonCell.js +2 -0
- package/dist/components/PlAgTextAndButtonCell/PlAgTextAndButtonCell.vue2.js +2 -0
- package/dist/components/PlAgTextAndButtonCell/PlAgTextAndButtonCell.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.js +1 -0
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.style.js +1 -0
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.vue2.js +2 -0
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/FilterSidebar.js +1 -0
- package/dist/components/PlAnnotations/components/FilterSidebar.style.js +1 -0
- package/dist/components/PlAnnotations/components/FilterSidebar.vue2.js +2 -0
- package/dist/components/PlAnnotations/components/FilterSidebar.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotations.js +1 -0
- package/dist/components/PlAnnotations/components/PlAnnotations.style.js +1 -0
- package/dist/components/PlAnnotations/components/PlAnnotations.vue2.js +2 -0
- package/dist/components/PlAnnotations/components/PlAnnotations.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.js +1 -0
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.style.js +1 -0
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.vue2.js +2 -0
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/style.module.js +1 -0
- package/dist/components/PlAnnotations/utils.js +2 -0
- package/dist/components/PlAnnotations/utils.js.map +1 -1
- package/dist/components/PlAppErrorNotificationAlert/PlAppErrorNotificationAlert.js +2 -0
- package/dist/components/PlAppErrorNotificationAlert/PlAppErrorNotificationAlert.vue2.js +2 -0
- package/dist/components/PlAppErrorNotificationAlert/PlAppErrorNotificationAlert.vue2.js.map +1 -1
- package/dist/components/PlBtnExportArchive/Item.js +1 -0
- package/dist/components/PlBtnExportArchive/Item.style.js +1 -0
- package/dist/components/PlBtnExportArchive/Item.vue2.js +2 -0
- package/dist/components/PlBtnExportArchive/Item.vue2.js.map +1 -1
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.js +1 -0
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.style.js +1 -0
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.vue2.js +2 -0
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.vue2.js.map +1 -1
- package/dist/components/PlBtnExportArchive/Summary.js +1 -0
- package/dist/components/PlBtnExportArchive/Summary.style.js +1 -0
- package/dist/components/PlBtnExportArchive/Summary.vue2.js +2 -0
- package/dist/components/PlBtnExportArchive/Summary.vue2.js.map +1 -1
- package/dist/components/PlTableFastSearch/PlTableFastSearch.js +2 -0
- package/dist/components/PlTableFastSearch/PlTableFastSearch.vue2.js +2 -0
- package/dist/components/PlTableFastSearch/PlTableFastSearch.vue2.js.map +1 -1
- package/dist/components/PlTableFilters/PlTableFiltersV2.js +1 -0
- package/dist/components/PlTableFilters/PlTableFiltersV2.style.js +1 -0
- package/dist/components/PlTableFilters/PlTableFiltersV2.vue2.js +2 -0
- package/dist/components/PlTableFilters/PlTableFiltersV2.vue2.js.map +1 -1
- package/dist/composition/AgGrid/index.js +2 -0
- package/dist/composition/AgGrid/index.js.map +1 -1
- package/dist/composition/fileContent.js +2 -38
- package/dist/composition/fileContent.js.map +1 -1
- package/dist/computedResult.js +2 -30
- package/dist/computedResult.js.map +1 -1
- package/dist/createModel.js +2 -0
- package/dist/createModel.js.map +1 -1
- package/dist/defineApp.js +3 -2
- package/dist/defineApp.js.map +1 -1
- package/dist/defineStore.js +2 -0
- package/dist/defineStore.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/internal/UpdateSerializer.js +2 -6
- package/dist/internal/UpdateSerializer.js.map +1 -1
- package/dist/internal/createAppModel.js +2 -0
- package/dist/internal/createAppModel.js.map +1 -1
- package/dist/internal/createAppV1.js +2 -14
- package/dist/internal/createAppV1.js.map +1 -1
- package/dist/internal/createAppV2.js +3 -17
- package/dist/internal/createAppV2.js.map +1 -1
- package/dist/internal/createAppV3.js +3 -17
- package/dist/internal/createAppV3.js.map +1 -1
- package/dist/internal/service_factories.js +2 -8
- package/dist/internal/service_factories.js.map +1 -1
- package/dist/lib/util/helpers/dist/functions.js +2 -3
- package/dist/lib/util/helpers/dist/functions.js.map +1 -1
- package/dist/lib/util/helpers/dist/hash.js +1 -1
- package/dist/lib/util/helpers/dist/hash.js.map +1 -1
- package/dist/lib/util/helpers/dist/index.js +0 -2
- package/dist/lib/util/helpers/dist/objects.js +2 -45
- package/dist/lib/util/helpers/dist/objects.js.map +1 -1
- package/dist/lib/util/helpers/dist/prettyBytes.js +2 -0
- package/dist/lib/util/helpers/dist/prettyBytes.js.map +1 -1
- package/dist/lib/util/helpers/dist/random.js +2 -0
- package/dist/lib/util/helpers/dist/random.js.map +1 -1
- package/dist/lib/util/helpers/dist/strings.js +2 -0
- package/dist/lib/util/helpers/dist/strings.js.map +1 -1
- package/dist/lib/util/helpers/dist/uniqId.js +2 -0
- package/dist/lib/util/helpers/dist/uniqId.js.map +1 -1
- package/dist/lib/util/helpers/dist/utils.js +2 -1
- package/dist/lib/util/helpers/dist/utils.js.map +1 -1
- package/dist/objectHash.js +2 -5
- package/dist/objectHash.js.map +1 -1
- package/dist/plugins/Monetization/EndOfPeriod.js +1 -0
- package/dist/plugins/Monetization/EndOfPeriod.style.js +1 -0
- package/dist/plugins/Monetization/EndOfPeriod.vue2.js +2 -0
- package/dist/plugins/Monetization/EndOfPeriod.vue2.js.map +1 -1
- package/dist/plugins/Monetization/LimitCard.js +1 -0
- package/dist/plugins/Monetization/LimitCard.style.js +1 -0
- package/dist/plugins/Monetization/LimitCard.vue2.js +2 -0
- package/dist/plugins/Monetization/LimitCard.vue2.js.map +1 -1
- package/dist/plugins/Monetization/MonetizationSidebar.js +2 -0
- package/dist/plugins/Monetization/MonetizationSidebar.vue2.js +2 -0
- package/dist/plugins/Monetization/MonetizationSidebar.vue2.js.map +1 -1
- package/dist/plugins/Monetization/RunStatus.js +1 -0
- package/dist/plugins/Monetization/RunStatus.style.js +1 -0
- package/dist/plugins/Monetization/RunStatus.vue2.js +2 -0
- package/dist/plugins/Monetization/RunStatus.vue2.js.map +1 -1
- package/dist/plugins/Monetization/UserCabinetCard.js +1 -0
- package/dist/plugins/Monetization/UserCabinetCard.style.js +1 -0
- package/dist/plugins/Monetization/UserCabinetCard.vue2.js +2 -0
- package/dist/plugins/Monetization/UserCabinetCard.vue2.js.map +1 -1
- package/dist/plugins/Monetization/useButtonTarget.js +2 -0
- package/dist/plugins/Monetization/useButtonTarget.js.map +1 -1
- package/dist/plugins/Monetization/useInfo.js +2 -0
- package/dist/plugins/Monetization/useInfo.js.map +1 -1
- package/dist/plugins/Monetization/validation.js +4 -4
- package/dist/plugins/Monetization/validation.js.map +1 -1
- package/dist/urls.js +3 -1
- package/dist/urls.js.map +1 -1
- package/dist/usePlugin.js +2 -24
- package/dist/usePlugin.js.map +1 -1
- package/dist/utils.js +3 -1
- package/dist/utils.js.map +1 -1
- package/package.json +13 -13
- package/dist/lib/util/helpers/dist/disposable.js +0 -9
- package/dist/lib/util/helpers/dist/disposable.js.map +0 -1
- package/dist/lib/util/helpers/dist/ref_count_pool.js +0 -4
- package/dist/lib/util/helpers/dist/ref_count_pool.js.map +0 -1
package/dist/usePlugin.js
CHANGED
|
@@ -1,34 +1,12 @@
|
|
|
1
1
|
import { pluginDataKey as e } from "./defineApp.js";
|
|
2
2
|
import { inject as t } from "vue";
|
|
3
|
-
|
|
4
|
-
* Composable for accessing a plugin's reactive model: data, outputs, and outputErrors.
|
|
5
|
-
*
|
|
6
|
-
* Mirrors the `app.model` access pattern — `plugin.model.data` is reactive and deep-watched,
|
|
7
|
-
* mutations are automatically queued and sent to storage.
|
|
8
|
-
*
|
|
9
|
-
* @param handle - Opaque plugin handle obtained from `app.plugins`.
|
|
10
|
-
* @typeParam F - The plugin factory type (inferred from the handle)
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```vue
|
|
14
|
-
* <script setup lang="ts">
|
|
15
|
-
* import { usePlugin, type InferPluginHandle } from '@platforma-sdk/ui-vue';
|
|
16
|
-
* import type { CounterPlugin } from './plugins/counter';
|
|
17
|
-
*
|
|
18
|
-
* const props = defineProps<{ instance: InferPluginHandle<CounterPlugin> }>();
|
|
19
|
-
* const plugin = usePlugin(props.instance);
|
|
20
|
-
*
|
|
21
|
-
* plugin.model.data.count += 1; // reactive, triggers storage update
|
|
22
|
-
* plugin.model.outputs.displayText // computed, plugin's own outputs only
|
|
23
|
-
* plugin.model.outputErrors.displayText // Error | undefined
|
|
24
|
-
* <\/script>
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
3
|
+
//#region src/usePlugin.ts
|
|
27
4
|
function n(n) {
|
|
28
5
|
let r = t(e);
|
|
29
6
|
if (!r) throw Error("usePlugin requires a V3 block (BlockModelV3). Make sure the block uses apiVersion 3 and the plugin is installed.");
|
|
30
7
|
return r.getOrCreatePluginState(n);
|
|
31
8
|
}
|
|
9
|
+
//#endregion
|
|
32
10
|
export { n as usePlugin };
|
|
33
11
|
|
|
34
12
|
//# sourceMappingURL=usePlugin.js.map
|
package/dist/usePlugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePlugin.js","names":[],"sources":["../src/usePlugin.ts"],"sourcesContent":["import { inject, type Reactive } from \"vue\";\nimport { pluginDataKey } from \"./defineApp\";\nimport type {\n PluginHandle,\n InferFactoryData,\n InferFactoryOutputs,\n InferFactoryUiServices,\n PluginFactoryLike,\n} from \"@platforma-sdk/model\";\n\n/** Per-plugin reactive model exposed to consumers via usePlugin(). */\nexport interface PluginState<\n Data = unknown,\n Outputs = unknown,\n Services = Record<string, unknown>,\n> {\n readonly model: Reactive<{\n data: Data;\n outputs: Outputs extends Record<string, unknown>\n ? { [K in keyof Outputs]: Outputs[K] | undefined }\n : Record<string, unknown>;\n outputErrors: Outputs extends Record<string, unknown>\n ? { [K in keyof Outputs]?: Error }\n : Record<string, Error | undefined>;\n }>;\n readonly services: Services;\n}\n\n/** Internal interface for plugin access — provided via Vue injection to usePlugin(). */\nexport interface PluginAccess {\n getOrCreatePluginState<F extends PluginFactoryLike>(\n handle: PluginHandle<F>,\n ): PluginState<InferFactoryData<F>, InferFactoryOutputs<F>, InferFactoryUiServices<F>>;\n}\n\n/**\n * Composable for accessing a plugin's reactive model: data, outputs, and outputErrors.\n *\n * Mirrors the `app.model` access pattern — `plugin.model.data` is reactive and deep-watched,\n * mutations are automatically queued and sent to storage.\n *\n * @param handle - Opaque plugin handle obtained from `app.plugins`.\n * @typeParam F - The plugin factory type (inferred from the handle)\n *\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { usePlugin, type InferPluginHandle } from '@platforma-sdk/ui-vue';\n * import type { CounterPlugin } from './plugins/counter';\n *\n * const props = defineProps<{ instance: InferPluginHandle<CounterPlugin> }>();\n * const plugin = usePlugin(props.instance);\n *\n * plugin.model.data.count += 1; // reactive, triggers storage update\n * plugin.model.outputs.displayText // computed, plugin's own outputs only\n * plugin.model.outputErrors.displayText // Error | undefined\n * </script>\n * ```\n */\nexport function usePlugin<F extends PluginFactoryLike>(handle: PluginHandle<F>) {\n const access = inject<PluginAccess>(pluginDataKey);\n\n if (!access) {\n throw new Error(\n \"usePlugin requires a V3 block (BlockModelV3). \" +\n \"Make sure the block uses apiVersion 3 and the plugin is installed.\",\n );\n }\n\n return access.getOrCreatePluginState<F>(handle);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePlugin.js","names":[],"sources":["../src/usePlugin.ts"],"sourcesContent":["import { inject, type Reactive } from \"vue\";\nimport { pluginDataKey } from \"./defineApp\";\nimport type {\n PluginHandle,\n InferFactoryData,\n InferFactoryOutputs,\n InferFactoryUiServices,\n PluginFactoryLike,\n} from \"@platforma-sdk/model\";\n\n/** Per-plugin reactive model exposed to consumers via usePlugin(). */\nexport interface PluginState<\n Data = unknown,\n Outputs = unknown,\n Services = Record<string, unknown>,\n> {\n readonly model: Reactive<{\n data: Data;\n outputs: Outputs extends Record<string, unknown>\n ? { [K in keyof Outputs]: Outputs[K] | undefined }\n : Record<string, unknown>;\n outputErrors: Outputs extends Record<string, unknown>\n ? { [K in keyof Outputs]?: Error }\n : Record<string, Error | undefined>;\n }>;\n readonly services: Services;\n}\n\n/** Internal interface for plugin access — provided via Vue injection to usePlugin(). */\nexport interface PluginAccess {\n getOrCreatePluginState<F extends PluginFactoryLike>(\n handle: PluginHandle<F>,\n ): PluginState<InferFactoryData<F>, InferFactoryOutputs<F>, InferFactoryUiServices<F>>;\n}\n\n/**\n * Composable for accessing a plugin's reactive model: data, outputs, and outputErrors.\n *\n * Mirrors the `app.model` access pattern — `plugin.model.data` is reactive and deep-watched,\n * mutations are automatically queued and sent to storage.\n *\n * @param handle - Opaque plugin handle obtained from `app.plugins`.\n * @typeParam F - The plugin factory type (inferred from the handle)\n *\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { usePlugin, type InferPluginHandle } from '@platforma-sdk/ui-vue';\n * import type { CounterPlugin } from './plugins/counter';\n *\n * const props = defineProps<{ instance: InferPluginHandle<CounterPlugin> }>();\n * const plugin = usePlugin(props.instance);\n *\n * plugin.model.data.count += 1; // reactive, triggers storage update\n * plugin.model.outputs.displayText // computed, plugin's own outputs only\n * plugin.model.outputErrors.displayText // Error | undefined\n * </script>\n * ```\n */\nexport function usePlugin<F extends PluginFactoryLike>(handle: PluginHandle<F>) {\n const access = inject<PluginAccess>(pluginDataKey);\n\n if (!access) {\n throw new Error(\n \"usePlugin requires a V3 block (BlockModelV3). \" +\n \"Make sure the block uses apiVersion 3 and the plugin is installed.\",\n );\n }\n\n return access.getOrCreatePluginState<F>(handle);\n}\n"],"mappings":";;;AA2DA,SAAgB,EAAuC,GAAyB;CAC9E,IAAM,IAAS,EAAqB,EAAc;AAElD,KAAI,CAAC,EACH,OAAU,MACR,mHAED;AAGH,QAAO,EAAO,uBAA0B,EAAO"}
|
package/dist/utils.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/utils.ts
|
|
1
2
|
var e = class extends Error {
|
|
2
3
|
name = "UnresolvedError";
|
|
3
4
|
}, t = (e) => Array.isArray(e) ? e : e ? [e] : [], n = class extends Error {
|
|
@@ -25,10 +26,11 @@ function a(e) {
|
|
|
25
26
|
function o(e) {
|
|
26
27
|
return e !== void 0;
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
+
var s = (e) => e, c = (e) => e instanceof Error ? e : Error(String(e)), l = (e) => e.name === "ZodError", u = (e) => {
|
|
29
30
|
let { formErrors: t, fieldErrors: n } = e.flatten(), r = Object.entries(n).map(([e, t]) => e + ":" + t?.join(","));
|
|
30
31
|
return t.concat(r).join("; ");
|
|
31
32
|
};
|
|
33
|
+
//#endregion
|
|
32
34
|
export { n as MultiError, e as UnresolvedError, c as ensureError, i as ensureOutputHasStableFlag, u as formatZodError, s as identity, o as isDefined, l as isZodError, r as unwrapOutput, a as wrapOptionalResult };
|
|
33
35
|
|
|
34
36
|
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import type { ErrorLike, OutputWithStatus } from \"@platforma-sdk/model\";\nimport type { OptionalResult } from \"./types\";\nimport type { ZodError } from \"zod\";\n\nexport class UnresolvedError extends Error {\n name = \"UnresolvedError\";\n}\n\nconst ensureArray = <T>(value: T | T[]): T[] => {\n return Array.isArray(value) ? value : value ? [value] : [];\n};\n\n// @TODO use AggregateError\nexport class MultiError extends Error {\n name = \"MultiError\";\n\n public readonly fullMessage: string;\n\n constructor(public readonly errors: (ErrorLike | string)[]) {\n errors = ensureArray(errors);\n super(errors.map((e) => (typeof e == \"string\" ? e : e.message)).join(\"\\n\"));\n this.fullMessage = errors\n .map((e) => {\n if (typeof e == \"string\") {\n return e;\n } else if (e.type == \"PlError\" && \"fullMessage\" in e) {\n return e.fullMessage;\n }\n return e.message;\n })\n .join(\"\\n\");\n }\n}\n\nexport function unwrapOutput<V>(output?: OutputWithStatus<V>): V {\n if (!output) {\n throw new UnresolvedError();\n }\n\n if (!output.ok) {\n throw new MultiError(output.errors);\n }\n\n return output.value;\n}\n\nexport function ensureOutputHasStableFlag<T>(output?: OutputWithStatus<T>) {\n if (!output) {\n throw new UnresolvedError();\n }\n if (output.ok) {\n output.stable ??= true;\n }\n return output;\n}\n\n// Optional Result\n\nexport function wrapOptionalResult<V>(value: V): OptionalResult<V> {\n return {\n value,\n errors: undefined,\n };\n}\n\nexport function isDefined<T>(v: T | undefined): v is T {\n return v !== undefined;\n}\n\nexport const identity = <T, V = T>(v: T): V => v as unknown as V;\n\nexport const ensureError = (cause: unknown) => {\n if (cause instanceof Error) {\n return cause;\n }\n\n return Error(String(cause));\n};\n\nexport const isZodError = (err: Error): err is ZodError => {\n return err.name === \"ZodError\";\n};\n\nexport const formatZodError = (err: ZodError) => {\n const { formErrors, fieldErrors } = err.flatten();\n const _fieldErrors = Object.entries(fieldErrors).map(([field, errors]) => {\n return field + \":\" + errors?.join(\",\");\n });\n return formErrors.concat(_fieldErrors).join(\"; \");\n};\n"],"mappings":"AAIA,IAAa,IAAb,cAAqC,MAAM;CACzC,OAAO;GAGH,KAAkB,MACf,MAAM,QAAQ,EAAM,GAAG,IAAQ,IAAQ,CAAC,EAAM,GAAG,EAAE,EAI/C,IAAb,cAAgC,MAAM;CACpC,OAAO;CAEP;CAEA,YAAY,GAAgD;AAG1D,EAFA,IAAS,EAAY,EAAO,EAC5B,MAAM,EAAO,KAAK,MAAO,OAAO,KAAK,WAAW,IAAI,EAAE,QAAS,CAAC,KAAK,KAAK,CAAC,EAFjD,KAAA,SAAA,GAG1B,KAAK,cAAc,EAChB,KAAK,MACA,OAAO,KAAK,WACP,IACE,EAAE,QAAQ,aAAa,iBAAiB,IAC1C,EAAE,cAEJ,EAAE,QACT,CACD,KAAK,KAAK;;;AAIjB,SAAgB,EAAgB,GAAiC;AAC/D,KAAI,CAAC,EACH,OAAM,IAAI,GAAiB;AAG7B,KAAI,CAAC,EAAO,GACV,OAAM,IAAI,EAAW,EAAO,OAAO;AAGrC,QAAO,EAAO;;AAGhB,SAAgB,EAA6B,GAA8B;AACzE,KAAI,CAAC,EACH,OAAM,IAAI,GAAiB;AAK7B,QAHI,EAAO,OACT,EAAO,WAAW,KAEb;;AAKT,SAAgB,EAAsB,GAA6B;AACjE,QAAO;EACL;EACA,QAAQ,KAAA;EACT;;AAGH,SAAgB,EAAa,GAA0B;AACrD,QAAO,MAAM,KAAA;;AAGf,
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import type { ErrorLike, OutputWithStatus } from \"@platforma-sdk/model\";\nimport type { OptionalResult } from \"./types\";\nimport type { ZodError } from \"zod\";\n\nexport class UnresolvedError extends Error {\n name = \"UnresolvedError\";\n}\n\nconst ensureArray = <T>(value: T | T[]): T[] => {\n return Array.isArray(value) ? value : value ? [value] : [];\n};\n\n// @TODO use AggregateError\nexport class MultiError extends Error {\n name = \"MultiError\";\n\n public readonly fullMessage: string;\n\n constructor(public readonly errors: (ErrorLike | string)[]) {\n errors = ensureArray(errors);\n super(errors.map((e) => (typeof e == \"string\" ? e : e.message)).join(\"\\n\"));\n this.fullMessage = errors\n .map((e) => {\n if (typeof e == \"string\") {\n return e;\n } else if (e.type == \"PlError\" && \"fullMessage\" in e) {\n return e.fullMessage;\n }\n return e.message;\n })\n .join(\"\\n\");\n }\n}\n\nexport function unwrapOutput<V>(output?: OutputWithStatus<V>): V {\n if (!output) {\n throw new UnresolvedError();\n }\n\n if (!output.ok) {\n throw new MultiError(output.errors);\n }\n\n return output.value;\n}\n\nexport function ensureOutputHasStableFlag<T>(output?: OutputWithStatus<T>) {\n if (!output) {\n throw new UnresolvedError();\n }\n if (output.ok) {\n output.stable ??= true;\n }\n return output;\n}\n\n// Optional Result\n\nexport function wrapOptionalResult<V>(value: V): OptionalResult<V> {\n return {\n value,\n errors: undefined,\n };\n}\n\nexport function isDefined<T>(v: T | undefined): v is T {\n return v !== undefined;\n}\n\nexport const identity = <T, V = T>(v: T): V => v as unknown as V;\n\nexport const ensureError = (cause: unknown) => {\n if (cause instanceof Error) {\n return cause;\n }\n\n return Error(String(cause));\n};\n\nexport const isZodError = (err: Error): err is ZodError => {\n return err.name === \"ZodError\";\n};\n\nexport const formatZodError = (err: ZodError) => {\n const { formErrors, fieldErrors } = err.flatten();\n const _fieldErrors = Object.entries(fieldErrors).map(([field, errors]) => {\n return field + \":\" + errors?.join(\",\");\n });\n return formErrors.concat(_fieldErrors).join(\"; \");\n};\n"],"mappings":";AAIA,IAAa,IAAb,cAAqC,MAAM;CACzC,OAAO;GAGH,KAAkB,MACf,MAAM,QAAQ,EAAM,GAAG,IAAQ,IAAQ,CAAC,EAAM,GAAG,EAAE,EAI/C,IAAb,cAAgC,MAAM;CACpC,OAAO;CAEP;CAEA,YAAY,GAAgD;AAG1D,EAFA,IAAS,EAAY,EAAO,EAC5B,MAAM,EAAO,KAAK,MAAO,OAAO,KAAK,WAAW,IAAI,EAAE,QAAS,CAAC,KAAK,KAAK,CAAC,EAFjD,KAAA,SAAA,GAG1B,KAAK,cAAc,EAChB,KAAK,MACA,OAAO,KAAK,WACP,IACE,EAAE,QAAQ,aAAa,iBAAiB,IAC1C,EAAE,cAEJ,EAAE,QACT,CACD,KAAK,KAAK;;;AAIjB,SAAgB,EAAgB,GAAiC;AAC/D,KAAI,CAAC,EACH,OAAM,IAAI,GAAiB;AAG7B,KAAI,CAAC,EAAO,GACV,OAAM,IAAI,EAAW,EAAO,OAAO;AAGrC,QAAO,EAAO;;AAGhB,SAAgB,EAA6B,GAA8B;AACzE,KAAI,CAAC,EACH,OAAM,IAAI,GAAiB;AAK7B,QAHI,EAAO,OACT,EAAO,WAAW,KAEb;;AAKT,SAAgB,EAAsB,GAA6B;AACjE,QAAO;EACL;EACA,QAAQ,KAAA;EACT;;AAGH,SAAgB,EAAa,GAA0B;AACrD,QAAO,MAAM,KAAA;;AAGf,IAAa,KAAsB,MAAY,GAElC,KAAe,MACtB,aAAiB,QACZ,IAGF,MAAM,OAAO,EAAM,CAAC,EAGhB,KAAc,MAClB,EAAI,SAAS,YAGT,KAAkB,MAAkB;CAC/C,IAAM,EAAE,eAAY,mBAAgB,EAAI,SAAS,EAC3C,IAAe,OAAO,QAAQ,EAAY,CAAC,KAAK,CAAC,GAAO,OACrD,IAAQ,MAAM,GAAQ,KAAK,IAAI,CACtC;AACF,QAAO,EAAW,OAAO,EAAa,CAAC,KAAK,KAAK"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platforma-sdk/ui-vue",
|
|
3
|
-
"version": "1.63.
|
|
3
|
+
"version": "1.63.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -24,27 +24,27 @@
|
|
|
24
24
|
"fast-json-patch": "^3.1.1",
|
|
25
25
|
"lru-cache": "^11.2.2",
|
|
26
26
|
"vue": "^3.5.24",
|
|
27
|
-
"zod": "~3.
|
|
28
|
-
"@milaboratories/pf-spec-driver": "1.2.
|
|
29
|
-
"@milaboratories/pl-model-common": "1.31.
|
|
30
|
-
"@platforma-sdk/model": "1.63.
|
|
31
|
-
"@milaboratories/uikit": "2.11.
|
|
27
|
+
"zod": "~3.25.76",
|
|
28
|
+
"@milaboratories/pf-spec-driver": "1.2.5",
|
|
29
|
+
"@milaboratories/pl-model-common": "1.31.2",
|
|
30
|
+
"@platforma-sdk/model": "1.63.12",
|
|
31
|
+
"@milaboratories/uikit": "2.11.8"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@faker-js/faker": "^9.2.0",
|
|
35
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
36
|
-
"@vitest/coverage-istanbul": "^4.
|
|
35
|
+
"@vitejs/plugin-vue": "^6.0.5",
|
|
36
|
+
"@vitest/coverage-istanbul": "^4.1.3",
|
|
37
37
|
"@vue/test-utils": "^2.4.6",
|
|
38
38
|
"fast-json-patch": "^3.1.1",
|
|
39
39
|
"rollup-plugin-sourcemaps2": "^0.5.2",
|
|
40
40
|
"sass": "~1.83.4",
|
|
41
41
|
"semver": "^7.7.2",
|
|
42
42
|
"typescript": "~5.9.3",
|
|
43
|
-
"vite": "8.0.
|
|
44
|
-
"vitest": "^4.
|
|
45
|
-
"@milaboratories/build-configs": "
|
|
46
|
-
"@milaboratories/ts-builder": "1.3.
|
|
47
|
-
"@milaboratories/ts-configs": "1.2.
|
|
43
|
+
"vite": "^8.0.6",
|
|
44
|
+
"vitest": "^4.1.3",
|
|
45
|
+
"@milaboratories/build-configs": "2.0.0",
|
|
46
|
+
"@milaboratories/ts-builder": "1.3.1",
|
|
47
|
+
"@milaboratories/ts-configs": "1.2.3",
|
|
48
48
|
"@milaboratories/helpers": "1.14.1"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
function e(e) {
|
|
2
|
-
return typeof e == "object" && !!e && Symbol.dispose in e && typeof e[Symbol.dispose] == "function";
|
|
3
|
-
}
|
|
4
|
-
function t(e) {
|
|
5
|
-
return typeof e == "object" && !!e && Symbol.asyncDispose in e && typeof e[Symbol.asyncDispose] == "function";
|
|
6
|
-
}
|
|
7
|
-
export { t as isAsyncDisposable, e as isDisposable };
|
|
8
|
-
|
|
9
|
-
//# sourceMappingURL=disposable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"disposable.js","names":[],"sources":["../../../../../../../lib/util/helpers/src/disposable.ts"],"sourcesContent":["export function isDisposable(object: unknown): object is Disposable {\n return (\n typeof object === \"object\" &&\n object !== null &&\n Symbol.dispose in object &&\n typeof object[Symbol.dispose] === \"function\"\n );\n}\n\nexport function isAsyncDisposable(object: unknown): object is AsyncDisposable {\n return (\n typeof object === \"object\" &&\n object !== null &&\n Symbol.asyncDispose in object &&\n typeof object[Symbol.asyncDispose] === \"function\"\n );\n}\n"],"mappings":"AAAA,SAAgB,EAAa,GAAuC;AAClE,QACE,OAAO,KAAW,cAClB,KACA,OAAO,WAAW,KAClB,OAAO,EAAO,OAAO,YAAa;;AAItC,SAAgB,EAAkB,GAA4C;AAC5E,QACE,OAAO,KAAW,cAClB,KACA,OAAO,gBAAgB,KACvB,OAAO,EAAO,OAAO,iBAAkB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ref_count_pool.js","names":[],"sources":["../../../../../../../lib/util/helpers/src/ref_count_pool.ts"],"sourcesContent":["import { isAsyncDisposable, isDisposable } from \"./disposable\";\n\n/**\n * Function associated with particular entry from the RefCountResourcePool.\n *\n * Calling the function will release the reference acquired when object was\n * received from the pool.\n */\nexport type UnrefFn = () => void;\n\nexport interface PoolEntry<K extends string = string, R extends {} = {}> extends Disposable {\n /** Resource key, calculated using provided `calculateParamsKey` function */\n readonly key: K;\n\n /** Resource itself created by `createNewResource` function */\n readonly resource: R;\n\n /** Callback to be called when requested resource can be disposed. */\n readonly unref: UnrefFn;\n}\n\n/**\n * Wraps a PoolEntry for use with `using`. Auto-calls `unref()` at end of scope\n * unless `keep()` is called to transfer ownership to the caller.\n */\nexport class PoolEntryGuard<K extends string = string, R extends {} = {}> implements Disposable {\n private kept = false;\n\n constructor(readonly entry: PoolEntry<K, R>) {}\n\n get key(): K {\n return this.entry.key;\n }\n\n get resource(): R {\n return this.entry.resource;\n }\n\n /** Disarm the guard — caller takes ownership of the entry. */\n keep(): PoolEntry<K, R> {\n this.kept = true;\n return this.entry;\n }\n\n [Symbol.dispose](): void {\n if (!this.kept) this.entry.unref();\n }\n}\n\ntype RefCountEnvelope<R> = {\n refCount: number;\n readonly resource: R;\n};\n\nexport interface RefCountPool<P, K extends string, R extends {}> {\n /** Acquire resource from the pool */\n acquire(params: P): PoolEntry<K, R>;\n\n /** Try to get a resource by key */\n tryGetByKey(key: K): R | undefined;\n\n /** Get a resource by key */\n getByKey(key: K): R;\n}\n\nexport abstract class RefCountPoolBase<P, K extends string, R extends {}>\n implements RefCountPool<P, K, R>, AsyncDisposable\n{\n private readonly resources = new Map<K, RefCountEnvelope<R>>();\n private readonly disposeQueue = Promise.resolve();\n\n private check(key: K) {\n const envelope = this.resources.get(key);\n if (envelope === undefined) throw new Error(\"Unexpected state.\");\n if (envelope.refCount === 0) {\n this.resources.delete(key);\n const resource = envelope.resource;\n\n if (isDisposable(resource)) {\n void this.disposeQueue.then(() => resource[Symbol.dispose]());\n } else if (isAsyncDisposable(resource)) {\n void this.disposeQueue.then(() => resource[Symbol.asyncDispose]());\n }\n }\n }\n\n protected abstract calculateParamsKey(params: P): K;\n protected abstract createNewResource(params: P, key: K): R;\n\n public acquire(params: P): PoolEntry<K, R> {\n const key = this.calculateParamsKey(params);\n let envelope = this.resources.get(key);\n if (envelope === undefined) {\n envelope = { refCount: 0, resource: this.createNewResource(params, key) };\n this.resources.set(key, envelope);\n }\n\n // adding ref count\n envelope.refCount++;\n\n let unreferenced = false;\n const unref = () => {\n if (unreferenced) return; // unref is idempotent, calling it many times have no effect\n unreferenced = true;\n // subtracting ref count\n envelope.refCount--;\n this.check(key);\n };\n return {\n resource: envelope.resource,\n key,\n unref,\n [Symbol.dispose]: unref,\n };\n }\n\n public tryGetByKey(key: K): R | undefined {\n return this.resources.get(key)?.resource;\n }\n\n public abstract getByKey(key: K): R;\n\n public async dispose(): Promise<void> {\n void (await Promise.allSettled(\n Array.from(this.resources.values()).map((envelope) => {\n const resource = envelope.resource;\n if (isDisposable(resource)) {\n return this.disposeQueue.then(() => resource[Symbol.dispose]());\n } else if (isAsyncDisposable(resource)) {\n return this.disposeQueue.then(() => resource[Symbol.asyncDispose]());\n }\n }),\n ));\n }\n\n public async [Symbol.asyncDispose](): Promise<void> {\n return await this.dispose();\n }\n}\n"],"mappings":";AA4CG,OAAO,SA2FM,OAAO"}
|