@mulmoclaude/collection-plugin 0.6.0 → 0.7.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/dist/vue.js CHANGED
@@ -2890,7 +2890,7 @@ var CollectionRemoteViewPreview_default = /*#__PURE__*/ _plugin_vue_export_helpe
2890
2890
  props: {
2891
2891
  slug: {},
2892
2892
  view: {},
2893
- primaryKey: {},
2893
+ schema: {},
2894
2894
  items: {}
2895
2895
  },
2896
2896
  emits: ["startChat"],
@@ -2936,12 +2936,24 @@ var CollectionRemoteViewPreview_default = /*#__PURE__*/ _plugin_vue_export_helpe
2936
2936
  () => props.view.id,
2937
2937
  () => collectionUi().localeTag()
2938
2938
  ], () => void load(), { immediate: true });
2939
+ function getPage(request) {
2940
+ const derived = props.items.map((item) => deriveAll(props.schema, item, {}));
2941
+ return JSON.parse(JSON.stringify(pageFromItems(derived, request, props.schema.primaryKey)));
2942
+ }
2943
+ async function onMutate(request) {
2944
+ const binding = collectionUi();
2945
+ if (!binding.mutateRemoteView) throw new Error("mutateRemoteView is not wired on this host");
2946
+ const resp = await binding.mutateRemoteView(props.slug, props.view.id, request);
2947
+ if (!resp.ok) throw new Error(resp.error);
2948
+ return resp.data.op === "update" ? { item: resp.data.item } : { id: resp.data.id };
2949
+ }
2939
2950
  function onWindowMessage(event) {
2940
2951
  const target = event.source;
2941
2952
  if (!target || target !== iframeEl.value?.contentWindow) return;
2942
2953
  handleRemoteViewMessage(event.data, {
2943
2954
  slug: props.slug,
2944
- getPage: (request) => pageFromItems(props.items, request, props.primaryKey),
2955
+ getPage,
2956
+ onMutate,
2945
2957
  onStartChat: (prompt, role) => emit("startChat", {
2946
2958
  prompt,
2947
2959
  role
@@ -2963,7 +2975,7 @@ var CollectionRemoteViewPreview_default = /*#__PURE__*/ _plugin_vue_export_helpe
2963
2975
  }, null, 8, _hoisted_5$6))]), createElementVNode("div", _hoisted_6$5, toDisplayString(sizeCaption.value), 1)], 64)) : createCommentVNode("", true)]);
2964
2976
  };
2965
2977
  }
2966
- }), [["__scopeId", "data-v-b9e3d51f"]]);
2978
+ }), [["__scopeId", "data-v-b200884d"]]);
2967
2979
  //#endregion
2968
2980
  //#region src/vue/useCollectionRendering.ts
2969
2981
  function stepForFieldType(type) {
@@ -4950,13 +4962,13 @@ var CollectionView_default = /* @__PURE__ */ defineComponent({
4950
4962
  key: 0,
4951
4963
  slug: collection.value.slug,
4952
4964
  view: activeCustomView.value,
4953
- "primary-key": collection.value.schema.primaryKey,
4965
+ schema: collection.value.schema,
4954
4966
  items: items.value,
4955
4967
  onStartChat: onCustomViewStartChat
4956
4968
  }, null, 8, [
4957
4969
  "slug",
4958
4970
  "view",
4959
- "primary-key",
4971
+ "schema",
4960
4972
  "items"
4961
4973
  ])) : (openBlock(), createBlock(CollectionCustomView_default, {
4962
4974
  key: 1,