@mulmoclaude/collection-plugin 0.6.0 → 0.7.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/vue.js CHANGED
@@ -2,7 +2,7 @@ import { MINUTES_PER_DAY, TOOL_DEFINITION, actionVisible, assignLanes, boolSortV
2
2
  import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, effectScope, mergeModels, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, onUnmounted, openBlock, ref, renderList, renderSlot, resolveDynamicComponent, toDisplayString, unref, useModel, vModelCheckbox, vModelDynamic, vModelSelect, vModelText, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
3
3
  import { createI18n } from "vue-i18n";
4
4
  import draggable from "vuedraggable";
5
- import { REMOTE_VIEW_MAX_BYTES, handleRemoteViewMessage, pageFromItems } from "@mulmoclaude/core/remote-view";
5
+ import { REMOTE_VIEW_MAX_BYTES, handleRemoteViewMessage } from "@mulmoclaude/core/remote-view";
6
6
  import { createTranslationCache } from "@mulmoclaude/core/translation/client";
7
7
  //#region src/vue/uiContext.ts
8
8
  var current = null;
@@ -2889,9 +2889,7 @@ var CollectionRemoteViewPreview_default = /*#__PURE__*/ _plugin_vue_export_helpe
2889
2889
  __name: "CollectionRemoteViewPreview",
2890
2890
  props: {
2891
2891
  slug: {},
2892
- view: {},
2893
- primaryKey: {},
2894
- items: {}
2892
+ view: {}
2895
2893
  },
2896
2894
  emits: ["startChat"],
2897
2895
  setup(__props, { emit: __emit }) {
@@ -2903,7 +2901,13 @@ var CollectionRemoteViewPreview_default = /*#__PURE__*/ _plugin_vue_export_helpe
2903
2901
  const srcdoc = ref(null);
2904
2902
  const bytes = ref(0);
2905
2903
  const iframeEl = ref(null);
2906
- const sizeCaption = computed(() => `${Math.max(1, Math.round(bytes.value / 1024))} KB / ${Math.round(REMOTE_VIEW_MAX_BYTES / 1024)} KB`);
2904
+ const imageStats = ref(null);
2905
+ const sizeCaption = computed(() => {
2906
+ const base = `${Math.max(1, Math.round(bytes.value / 1024))} KB / ${Math.round(REMOTE_VIEW_MAX_BYTES / 1024)} KB`;
2907
+ const stats = imageStats.value;
2908
+ if (!stats || stats.inlined === 0 && stats.omitted === 0) return base;
2909
+ return stats.omitted > 0 ? `${base} · ${stats.inlined} images (${stats.omitted} over budget)` : `${base} · ${stats.inlined} images`;
2910
+ });
2907
2911
  let loadSeq = 0;
2908
2912
  async function load() {
2909
2913
  const seq = ++loadSeq;
@@ -2936,12 +2940,31 @@ var CollectionRemoteViewPreview_default = /*#__PURE__*/ _plugin_vue_export_helpe
2936
2940
  () => props.view.id,
2937
2941
  () => collectionUi().localeTag()
2938
2942
  ], () => void load(), { immediate: true });
2943
+ async function getPage(request) {
2944
+ const binding = collectionUi();
2945
+ if (!binding.fetchRemoteViewItems) throw new Error("fetchRemoteViewItems is not wired on this host");
2946
+ const resp = await binding.fetchRemoteViewItems(props.slug, props.view.id, request);
2947
+ if (!resp.ok) throw new Error(resp.error);
2948
+ imageStats.value = {
2949
+ inlined: resp.data.inlined,
2950
+ omitted: resp.data.omitted
2951
+ };
2952
+ return resp.data.page;
2953
+ }
2954
+ async function onMutate(request) {
2955
+ const binding = collectionUi();
2956
+ if (!binding.mutateRemoteView) throw new Error("mutateRemoteView is not wired on this host");
2957
+ const resp = await binding.mutateRemoteView(props.slug, props.view.id, request);
2958
+ if (!resp.ok) throw new Error(resp.error);
2959
+ return resp.data.op === "update" ? { item: resp.data.item } : { id: resp.data.id };
2960
+ }
2939
2961
  function onWindowMessage(event) {
2940
2962
  const target = event.source;
2941
2963
  if (!target || target !== iframeEl.value?.contentWindow) return;
2942
2964
  handleRemoteViewMessage(event.data, {
2943
2965
  slug: props.slug,
2944
- getPage: (request) => pageFromItems(props.items, request, props.primaryKey),
2966
+ getPage,
2967
+ onMutate,
2945
2968
  onStartChat: (prompt, role) => emit("startChat", {
2946
2969
  prompt,
2947
2970
  role
@@ -2963,7 +2986,7 @@ var CollectionRemoteViewPreview_default = /*#__PURE__*/ _plugin_vue_export_helpe
2963
2986
  }, null, 8, _hoisted_5$6))]), createElementVNode("div", _hoisted_6$5, toDisplayString(sizeCaption.value), 1)], 64)) : createCommentVNode("", true)]);
2964
2987
  };
2965
2988
  }
2966
- }), [["__scopeId", "data-v-b9e3d51f"]]);
2989
+ }), [["__scopeId", "data-v-cd23d935"]]);
2967
2990
  //#endregion
2968
2991
  //#region src/vue/useCollectionRendering.ts
2969
2992
  function stepForFieldType(type) {
@@ -3964,10 +3987,7 @@ var CollectionView_default = /* @__PURE__ */ defineComponent({
3964
3987
  dataIssues.value = result.data.issues ?? [];
3965
3988
  enumOriginallyEmpty.value = snapshotEmptyEnums(result.data.collection.schema, result.data.items);
3966
3989
  await render.loadLinkedCollections(result.data.collection.schema, slug);
3967
- if (collection.value?.slug === slug) {
3968
- syncViewToSelected();
3969
- maybeOpenCalendarForSelected();
3970
- }
3990
+ if (collection.value?.slug === slug) syncViewToSelected();
3971
3991
  maybeAutoRefreshFeed(slug);
3972
3992
  }
3973
3993
  /** Refresh records + schema IN PLACE for a live (pub/sub-driven) update,
@@ -4547,17 +4567,6 @@ var CollectionView_default = /* @__PURE__ */ defineComponent({
4547
4567
  if (editing.value) closeEditor();
4548
4568
  closeView();
4549
4569
  }
4550
- /** Deep-link entry: a `?selected=<id>` link to a calendar-capable collection
4551
- * opens in calendar view with the popup focused on the record's day. Runs
4552
- * on load / slug change only (not on in-app selection), so table users
4553
- * aren't forced into the calendar. */
4554
- function maybeOpenCalendarForSelected() {
4555
- if (embedded.value || !hasCalendar.value || !viewing.value) return;
4556
- const day = dayOfItem(viewing.value);
4557
- if (!day) return;
4558
- view.value = "calendar";
4559
- openDay.value = day;
4560
- }
4561
4570
  /** Kanban card dropped in a column → set the record's group field to the
4562
4571
  * column value (the empty string clears it for the Uncategorized column).
4563
4572
  * Reuses the inline-edit path (optimistic write + PUT + rollback). */
@@ -4950,15 +4959,8 @@ var CollectionView_default = /* @__PURE__ */ defineComponent({
4950
4959
  key: 0,
4951
4960
  slug: collection.value.slug,
4952
4961
  view: activeCustomView.value,
4953
- "primary-key": collection.value.schema.primaryKey,
4954
- items: items.value,
4955
4962
  onStartChat: onCustomViewStartChat
4956
- }, null, 8, [
4957
- "slug",
4958
- "view",
4959
- "primary-key",
4960
- "items"
4961
- ])) : (openBlock(), createBlock(CollectionCustomView_default, {
4963
+ }, null, 8, ["slug", "view"])) : (openBlock(), createBlock(CollectionCustomView_default, {
4962
4964
  key: 1,
4963
4965
  slug: collection.value.slug,
4964
4966
  view: activeCustomView.value,