@poveste/app 0.15.0 → 0.16.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.
Files changed (77) hide show
  1. package/dist/app/style/main.pcss +18 -44
  2. package/dist/bundled/App.vue_vue_type_script_setup_true_lang.js +9 -7
  3. package/dist/bundled/app.css +80 -17
  4. package/dist/bundled/components/app/AppActions.vue_vue_type_script_setup_true_lang.js +44 -27
  5. package/dist/bundled/components/app/ShortcutTooltip.js +5 -0
  6. package/dist/bundled/components/app/ShortcutTooltip.vue_vue_type_script_setup_true_lang.js +27 -0
  7. package/dist/bundled/components/base/BaseDropdown.js +6 -0
  8. package/dist/bundled/components/base/BaseDropdown.vue_vue_type_script_setup_true_lang.js +68 -0
  9. package/dist/bundled/components/base/BaseOverflowMenu.vue_vue_type_script_setup_true_lang.js +5 -5
  10. package/dist/bundled/components/base/BaseSelect.js +1 -0
  11. package/dist/bundled/components/base/BaseSelect.vue_vue_type_script_setup_true_lang.js +80 -51
  12. package/dist/bundled/components/base/BaseSplitPane.js +1 -1
  13. package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_script_setup_true_lang.js +65 -4
  14. package/dist/bundled/components/panel/ControlsComponentPropItem.vue_vue_type_script_setup_true_lang.js +15 -13
  15. package/dist/bundled/components/panel/ControlsComponentProps.vue_vue_type_script_setup_true_lang.js +9 -6
  16. package/dist/bundled/components/panel/ControlsComponentState.vue_vue_type_script_setup_true_lang.js +9 -6
  17. package/dist/bundled/components/panel/StatePresets.vue_vue_type_script_setup_true_lang.js +69 -54
  18. package/dist/bundled/components/panel/StoryEvent.vue_vue_type_script_setup_true_lang.js +5 -5
  19. package/dist/bundled/components/panel/StorySidePanel.vue_vue_type_script_setup_true_lang.js +1 -0
  20. package/dist/bundled/components/panel/StorySourceCode.js +1 -1
  21. package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_script_setup_true_lang.js +21 -16
  22. package/dist/bundled/components/story/StoryResponsivePreview.js +1 -1
  23. package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_script_setup_true_lang.js +46 -43
  24. package/dist/bundled/components/story/StoryVariantGridItem.js +1 -1
  25. package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_script_setup_true_lang.js +21 -19
  26. package/dist/bundled/components/story/StoryVariantSingle.js +1 -1
  27. package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_script_setup_true_lang.js +2 -1
  28. package/dist/bundled/components/story/StoryView.vue_vue_type_script_setup_true_lang.js +1 -0
  29. package/dist/bundled/components/toolbar/DevOnlyToolbarOpenInEditor.vue_vue_type_script_setup_true_lang.js +15 -12
  30. package/dist/bundled/components/toolbar/ToolbarBackground.vue_vue_type_script_setup_true_lang.js +20 -16
  31. package/dist/bundled/components/toolbar/ToolbarNewTab.vue_vue_type_script_setup_true_lang.js +16 -13
  32. package/dist/bundled/components/toolbar/ToolbarResponsiveSize.vue_vue_type_script_setup_true_lang.js +35 -24
  33. package/dist/bundled/components/toolbar/ToolbarTextDirection.vue_vue_type_script_setup_true_lang.js +15 -12
  34. package/dist/bundled/index.js +0 -13
  35. package/dist/bundled/sandbox.js +2 -1
  36. package/dist/bundled/util/icons.generated.js +4 -2
  37. package/dist/bundled/util/scroll.js +26 -5
  38. package/dist/bundled/util/state.js +105 -5
  39. package/dist/style.css +731 -357
  40. package/package.json +19 -15
  41. package/src/__tests__/base-select.spec.ts +25 -0
  42. package/src/__tests__/reset.spec.ts +53 -0
  43. package/src/__tests__/state-clone.spec.ts +55 -1
  44. package/src/__tests__/state-types.spec.ts +175 -0
  45. package/src/app/App.vue +43 -34
  46. package/src/app/components/app/AppActions.vue +42 -30
  47. package/src/app/components/app/ShortcutTooltip.vue +29 -0
  48. package/src/app/components/base/BaseDropdown.vue +142 -0
  49. package/src/app/components/base/BaseOverflowMenu.vue +10 -5
  50. package/src/app/components/base/BaseSelect.vue +133 -60
  51. package/src/app/components/base/BaseSplitPane.vue +73 -2
  52. package/src/app/components/panel/ControlsComponentPropItem.vue +18 -17
  53. package/src/app/components/panel/ControlsComponentProps.vue +7 -5
  54. package/src/app/components/panel/ControlsComponentState.vue +7 -5
  55. package/src/app/components/panel/StatePresets.vue +82 -76
  56. package/src/app/components/panel/StoryEvent.vue +10 -9
  57. package/src/app/components/panel/StorySidePanel.vue +1 -0
  58. package/src/app/components/panel/StorySourceCode.vue +47 -41
  59. package/src/app/components/story/StoryResponsivePreview.vue +55 -27
  60. package/src/app/components/story/StoryVariantGridItem.vue +19 -18
  61. package/src/app/components/story/StoryVariantSingle.vue +1 -0
  62. package/src/app/components/story/StoryView.vue +1 -0
  63. package/src/app/components/toolbar/DevOnlyToolbarOpenInEditor.vue +14 -12
  64. package/src/app/components/toolbar/ToolbarBackground.vue +22 -23
  65. package/src/app/components/toolbar/ToolbarNewTab.vue +14 -12
  66. package/src/app/components/toolbar/ToolbarResponsiveSize.vue +31 -25
  67. package/src/app/components/toolbar/ToolbarTextDirection.vue +14 -10
  68. package/src/app/index.ts +0 -17
  69. package/src/app/sandbox.ts +8 -1
  70. package/src/app/style/main.pcss +18 -44
  71. package/src/app/util/icons.generated.ts +2 -2
  72. package/src/app/util/scroll.ts +47 -9
  73. package/src/app/util/state.ts +139 -6
  74. package/dist/app/style/floating.pcss +0 -40
  75. package/dist/bundled/util/tooltip.js +0 -14
  76. package/src/app/style/floating.pcss +0 -40
  77. package/src/app/util/tooltip.ts +0 -13
@@ -1,25 +1,28 @@
1
1
  import TopBarChipItem_default from "../app/TopBarChipItem.js";
2
2
  import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
3
- import { createBlock, createVNode, defineComponent, openBlock, resolveDirective, unref, withCtx, withDirectives } from "@poveste/vendors/vue";
3
+ import { createBlock, createVNode, defineComponent, openBlock, unref, withCtx } from "@poveste/vendors/vue";
4
4
  import { Icon } from "@poveste/vendors/iconify";
5
+ import { HstTooltip } from "@poveste/controls";
5
6
  //#region src/app/components/toolbar/ToolbarTextDirection.vue?vue&type=script&setup=true&lang.ts
6
7
  var ToolbarTextDirection_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
7
8
  __name: "ToolbarTextDirection",
8
9
  setup(__props) {
9
10
  const settings = usePreviewSettingsStore().currentSettings;
10
11
  return (_ctx, _cache) => {
11
- const _directive_tooltip = resolveDirective("tooltip");
12
- return withDirectives((openBlock(), createBlock(TopBarChipItem_default, {
13
- "aria-label": "Toggle text direction",
14
- class: "poveste-toolbar-text-direction",
15
- onClick: _cache[0] || (_cache[0] = ($event) => unref(settings).textDirection = unref(settings).textDirection === "ltr" ? "rtl" : "ltr")
16
- }, {
17
- default: withCtx(() => [createVNode(unref(Icon), {
18
- icon: unref(settings).textDirection === "ltr" ? "fluent:text-paragraph-direction-right-16-regular" : "fluent:text-paragraph-direction-left-16-regular",
19
- class: "w-4 h-4"
20
- }, null, 8, ["icon"])]),
12
+ return openBlock(), createBlock(unref(HstTooltip), { content: `Switch to text direction ${unref(settings).textDirection === "ltr" ? "Right to Left" : "Left to Right"}` }, {
13
+ default: withCtx(() => [createVNode(TopBarChipItem_default, {
14
+ "aria-label": "Toggle text direction",
15
+ class: "poveste-toolbar-text-direction",
16
+ onClick: _cache[0] || (_cache[0] = ($event) => unref(settings).textDirection = unref(settings).textDirection === "ltr" ? "rtl" : "ltr")
17
+ }, {
18
+ default: withCtx(() => [createVNode(unref(Icon), {
19
+ icon: unref(settings).textDirection === "ltr" ? "fluent:text-paragraph-direction-right-16-regular" : "fluent:text-paragraph-direction-left-16-regular",
20
+ class: "w-4 h-4"
21
+ }, null, 8, ["icon"])]),
22
+ _: 1
23
+ })]),
21
24
  _: 1
22
- })), [[_directive_tooltip, `Switch to text direction ${unref(settings).textDirection === "ltr" ? "Right to Left" : "Left to Right"}`]]);
25
+ }, 8, ["content"]);
23
26
  };
24
27
  }
25
28
  });
@@ -4,7 +4,6 @@ import "./plugin.js";
4
4
  import { iconCollections } from "./util/icons.generated.js";
5
5
  import { createApp } from "@poveste/vendors/vue";
6
6
  import { addCollection } from "@poveste/vendors/iconify";
7
- import FloatingVue from "@poveste/vendors/floating-vue";
8
7
  import { createPinia } from "@poveste/vendors/pinia";
9
8
  import "virtual:$poveste-theme";
10
9
  //#region src/app/index.ts
@@ -12,18 +11,6 @@ async function mountMainApp() {
12
11
  for (const collection of iconCollections) addCollection(collection);
13
12
  const app = createApp(App_default);
14
13
  app.use(createPinia());
15
- app.use(FloatingVue, {
16
- container: ".poveste-app-root",
17
- overflowPadding: 4,
18
- arrowPadding: 8,
19
- themes: {
20
- tooltip: { distance: 8 },
21
- dropdown: {
22
- computeTransformOrigin: true,
23
- distance: 8
24
- }
25
- }
26
- });
27
14
  app.use(router);
28
15
  app.mount("#app");
29
16
  if (import.meta.hot) import.meta.hot.send("poveste:mount", {});
@@ -103,7 +103,8 @@ var app = createApp({
103
103
  return [h("div", { class: "__poveste-sandbox-hidden" }, [h(GenericMountStory_default, {
104
104
  key: file.value.story.id,
105
105
  story: file.value.story,
106
- targetVariantId: variantId.value
106
+ targetVariantId: variantId.value,
107
+ syncState: false
107
108
  })]), this.story && this.variant ? h(GenericRenderStory_default, {
108
109
  key: `${this.story.id}/${this.variant.id}`,
109
110
  story: this.story,
@@ -6,11 +6,13 @@ var iconCollections = [
6
6
  "add-alt": { "body": "<path fill=\"currentColor\" d=\"M16 4c6.6 0 12 5.4 12 12s-5.4 12-12 12S4 22.6 4 16S9.4 4 16 4m0-2C8.3 2 2 8.3 2 16s6.3 14 14 14s14-6.3 14-14S23.7 2 16 2\"/><path fill=\"currentColor\" d=\"M24 15h-7V8h-2v7H8v2h7v7h2v-7h7z\"/>" },
7
7
  "area": { "body": "<path fill=\"currentColor\" d=\"M27 22.142V9.858A3.992 3.992 0 1 0 22.142 5H9.858A3.992 3.992 0 1 0 5 9.858v12.284A3.992 3.992 0 1 0 9.858 27h12.284A3.992 3.992 0 1 0 27 22.142M26 4a2 2 0 1 1-2 2a2 2 0 0 1 2-2M4 6a2 2 0 1 1 2 2a2 2 0 0 1-2-2m2 22a2 2 0 1 1 2-2a2 2 0 0 1-2 2m16.142-3H9.858A4 4 0 0 0 7 22.142V9.858A4 4 0 0 0 9.858 7h12.284A4 4 0 0 0 25 9.858v12.284A3.99 3.99 0 0 0 22.142 25M26 28a2 2 0 1 1 2-2a2.003 2.003 0 0 1-2 2\"/>" },
8
8
  "audio-console": { "body": "<path fill=\"currentColor\" d=\"M28 14.005h-1v-12h-2v12h-1a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h1v10h2v-10h1a2.003 2.003 0 0 0 2-2v-2a2 2 0 0 0-2-2m0 4h-4v-2h4Zm-10-12h-1v-4h-2v4h-1a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h1v18h2v-18h1a2 2 0 0 0 2-2v-2a2 2 0 0 0-2-2m0 4h-4v-2h4Zm-10 10H7v-18H5v18H4a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h1v4h2v-4h1a2 2 0 0 0 2-2v-2a2 2 0 0 0-2-2m0 4H4v-2h4Z\"/>" },
9
+ "calendar": { "body": "<path fill=\"currentColor\" d=\"M26 4h-4V2h-2v2h-8V2h-2v2H6c-1.1 0-2 .9-2 2v20c0 1.1.9 2 2 2h20c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 22H6V12h20zm0-16H6V6h4v2h2V6h8v2h2V6h4z\"/>" },
9
10
  "caret-down": { "body": "<path fill=\"currentColor\" d=\"m24 12l-8 10l-8-10z\"/>" },
10
11
  "caret-right": { "body": "<path fill=\"currentColor\" d=\"m12 8l10 8l-10 8z\"/>" },
11
12
  "checkbox": { "body": "<path fill=\"currentColor\" d=\"M26 4H6a2 2 0 0 0-2 2v20a2 2 0 0 0 2 2h20a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2M6 26V6h20v20Z\"/>" },
12
13
  "checkmark": { "body": "<path fill=\"currentColor\" d=\"m13 24l-9-9l1.414-1.414L13 21.171L26.586 7.586L28 9z\"/>" },
13
14
  "chevron-down": { "body": "<path fill=\"currentColor\" d=\"M16 22L6 12l1.4-1.4l8.6 8.6l8.6-8.6L26 12z\"/>" },
15
+ "chevron-left": { "body": "<path fill=\"currentColor\" d=\"M10 16L20 6l1.4 1.4l-8.6 8.6l8.6 8.6L20 26z\"/>" },
14
16
  "chevron-right": { "body": "<path fill=\"currentColor\" d=\"M22 16L12 26l-1.4-1.4l8.6-8.6l-8.6-8.6L12 6z\"/>" },
15
17
  "chevron-sort": { "body": "<path fill=\"currentColor\" d=\"m16 28l-7-7l1.41-1.41L16 25.17l5.59-5.58L23 21zm0-24l7 7l-1.41 1.41L16 6.83l-5.59 5.58L9 11z\"/>" },
16
18
  "close": { "body": "<path fill=\"currentColor\" d=\"M17.414 16L24 9.414L22.586 8L16 14.586L9.414 8L8 9.414L14.586 16L8 22.586L9.414 24L16 17.414L22.586 24L24 22.586z\"/>" },
@@ -54,7 +56,7 @@ var iconCollections = [
54
56
  "view-off": { "body": "<path fill=\"currentColor\" d=\"m5.24 22.51l1.43-1.42A14.06 14.06 0 0 1 3.07 16C5.1 10.93 10.7 7 16 7a12.4 12.4 0 0 1 4 .72l1.55-1.56A14.7 14.7 0 0 0 16 5A16.69 16.69 0 0 0 1.06 15.66a1 1 0 0 0 0 .68a16 16 0 0 0 4.18 6.17\"/><path fill=\"currentColor\" d=\"M12 15.73a4 4 0 0 1 3.7-3.7l1.81-1.82a6 6 0 0 0-7.33 7.33Zm18.94-.07a16.4 16.4 0 0 0-5.74-7.44L30 3.41L28.59 2L2 28.59L3.41 30l5.1-5.1A15.3 15.3 0 0 0 16 27a16.69 16.69 0 0 0 14.94-10.66a1 1 0 0 0 0-.68M20 16a4 4 0 0 1-6 3.44L19.44 14a4 4 0 0 1 .56 2m-4 9a13.05 13.05 0 0 1-6-1.58l2.54-2.54a6 6 0 0 0 8.35-8.35l2.87-2.87A14.54 14.54 0 0 1 28.93 16C26.9 21.07 21.3 25 16 25\"/>" },
55
57
  "warning-alt": { "body": "<path fill=\"currentColor\" d=\"M16 23a1.5 1.5 0 1 0 1.5 1.5A1.5 1.5 0 0 0 16 23m-1-11h2v9h-2z\"/><path fill=\"currentColor\" d=\"M29 30H3a1 1 0 0 1-.887-1.461l13-25a1 1 0 0 1 1.774 0l13 25A1 1 0 0 1 29 30M4.65 28h22.7l.001-.003L16.002 6.17h-.004L4.648 27.997Z\"/>" }
56
58
  },
57
- "lastModified": 1785496919,
59
+ "lastModified": 1789034045,
58
60
  "aliases": { "software-resource-resource": { "parent": "software-resource-reference" } },
59
61
  "width": 32,
60
62
  "height": 32
@@ -73,7 +75,7 @@ var iconCollections = [
73
75
  "height": 16
74
76
  }
75
77
  },
76
- "lastModified": 1786851660,
78
+ "lastModified": 1789279072,
77
79
  "width": 20,
78
80
  "height": 20
79
81
  },
@@ -1,17 +1,38 @@
1
1
  import { onMounted, watch } from "@poveste/vendors/vue";
2
- import scrollIntoView from "@poveste/vendors/scroll";
3
2
  //#region src/app/util/scroll.ts
3
+ /**
4
+ * The closest ancestor that can actually scroll, or `null` for the viewport.
5
+ *
6
+ * `overlay` is in the test because it is what `overflow: overlay` computes to
7
+ * where it is still supported, and an element scrolling under it would
8
+ * otherwise be measured against the wrong box.
9
+ */
10
+ function scrollParent(el) {
11
+ for (let node = el.parentElement; node; node = node.parentElement) {
12
+ const style = getComputedStyle(node);
13
+ if (/auto|scroll|overlay/.test(style.overflowY + style.overflowX)) return node;
14
+ }
15
+ return null;
16
+ }
17
+ /** Whether the element is already wholly inside the box that would scroll. */
18
+ function isVisibleIn(el, scroller) {
19
+ const rect = el.getBoundingClientRect();
20
+ const bounds = scroller?.getBoundingClientRect();
21
+ const top = bounds?.top ?? 0;
22
+ const bottom = bounds?.bottom ?? window.innerHeight;
23
+ return rect.top >= top && rect.bottom <= bottom;
24
+ }
4
25
  function useScrollOnActive(active, el) {
5
26
  watch(active, (value) => {
6
27
  if (value) autoScroll();
7
28
  }, { flush: "post" });
8
29
  function autoScroll() {
9
- if (el.value) scrollIntoView(el.value, {
10
- scrollMode: "if-needed",
30
+ const target = el.value;
31
+ if (!target || isVisibleIn(target, scrollParent(target))) return;
32
+ target.scrollIntoView({
11
33
  block: "center",
12
34
  inline: "nearest",
13
- behavior: "smooth",
14
- boundary: document.body
35
+ behavior: "smooth"
15
36
  });
16
37
  }
17
38
  onMounted(() => {
@@ -1,17 +1,48 @@
1
1
  import { isRef, unref } from "@poveste/vendors/vue";
2
- import { clone, omit } from "@poveste/shared";
2
+ import { clone, isMarkedRaw, isPlainObject, omit } from "@poveste/shared";
3
3
  //#region src/app/util/state.ts
4
4
  var isObject = (val) => val !== null && typeof val === "object";
5
+ /**
6
+ * A value the caller must leave out rather than carry, because it cannot make
7
+ * the trip this copy is being made for.
8
+ */
9
+ var DROP = Symbol("poveste.drop");
10
+ /**
11
+ * A detached copy of `val`, with refs unwrapped.
12
+ *
13
+ * `clean` means the copy leaves the realm — it is posted to the other side of
14
+ * the sandbox bridge, or stored as a preset — so values that cannot survive
15
+ * that are dropped rather than carried: functions, and anything Vue has marked
16
+ * raw.
17
+ *
18
+ * Marked values are dropped rather than passed through, because `__v_skip` is
19
+ * non-enumerable and does not cross `structuredClone`. Handing one over would
20
+ * strip the mark and hand the far side a plain graph to deep-watch, which is
21
+ * how the first attempt at #957 turned a slow story into a hanging one. A key
22
+ * the sandbox never sends is a key the controls panel does not show, and for
23
+ * the case this aims at — a template ref onto a component's exposed object —
24
+ * that is a control nobody could have used anyway.
25
+ *
26
+ * Without `clean` the copy stays in this realm, so a marked value is carried by
27
+ * reference. That is what the two Vues' bridge wants: an identity both sides
28
+ * share, which `isEquivalent` then settles by `Object.is` instead of walking.
29
+ */
5
30
  function toRawDeep(val, clean = false, seen = /* @__PURE__ */ new WeakMap()) {
31
+ const value = walk(val, clean, seen);
32
+ return value === DROP ? {} : value;
33
+ }
34
+ function walk(val, clean, seen) {
6
35
  const unwrappedValue = isRef(val) ? unref(val) : val;
7
36
  if (typeof unwrappedValue === "symbol") return unwrappedValue.toString();
8
37
  if (!isObject(unwrappedValue)) return unwrappedValue;
38
+ if (isMarkedRaw(unwrappedValue)) return clean ? DROP : unwrappedValue;
9
39
  if (seen.has(unwrappedValue)) return seen.get(unwrappedValue);
40
+ if (!Array.isArray(unwrappedValue) && !isPlainObject(unwrappedValue)) return notPlain(unwrappedValue, clean, seen);
10
41
  if (Array.isArray(unwrappedValue)) {
11
42
  const result = [];
12
43
  seen.set(unwrappedValue, result);
13
- let list = unwrappedValue.map((value) => toRawDeep(value, clean, seen));
14
- if (clean) list = list.filter((value) => typeof value !== "function");
44
+ let list = unwrappedValue.map((value) => walk(value, clean, seen));
45
+ if (clean) list = list.filter((value) => typeof value !== "function" && value !== DROP);
15
46
  result.push(...list);
16
47
  return result;
17
48
  } else {
@@ -21,10 +52,79 @@ function toRawDeep(val, clean = false, seen = /* @__PURE__ */ new WeakMap()) {
21
52
  return result;
22
53
  }
23
54
  }
24
- function toRawObject(obj, target, clean = false, seen = /* @__PURE__ */ new WeakMap()) {
55
+ /**
56
+ * A value with a prototype of its own — a `Date`, a `Map`, a class instance.
57
+ *
58
+ * These used to fall past every branch into `toRawObject`, whose `Object.keys`
59
+ * is empty for most of them, so they arrived as `{}` with no error and no
60
+ * warning (#977). `postMessage` is structured clone, and structured clone
61
+ * carries `Date`, `Map`, `Set`, `RegExp`, `Error`, typed arrays and `BigInt`
62
+ * intact — so they were being destroyed here, before the transport that would
63
+ * have carried them was ever reached.
64
+ *
65
+ * Structured clone is therefore the line, rather than a list authored here:
66
+ * it is the boundary that actually exists, it needs no maintaining as the
67
+ * platform adds types, and adopting it is what makes this walk agree with
68
+ * `isEquivalent`, which refuses to compare anything that is not plain.
69
+ *
70
+ * Without `clean` the copy stays in this realm, so the value is carried by
71
+ * reference — the same answer `copyState` in `@poveste/shared` gives, and the
72
+ * identity `isEquivalent` then settles by `Object.is`.
73
+ */
74
+ function notPlain(value, clean, seen) {
75
+ if (!clean) return value;
76
+ if (value instanceof Map || value instanceof Set) return walkCollection(value, seen);
77
+ try {
78
+ const copy = structuredClone(value);
79
+ seen.set(value, copy);
80
+ return copy;
81
+ } catch {
82
+ return DROP;
83
+ }
84
+ }
85
+ /**
86
+ * `Map` and `Set`, walked rather than handed to `structuredClone`, for two
87
+ * measured reasons.
88
+ *
89
+ * They hold user values, so this walk's own rules have to reach inside them: a
90
+ * function or a marked value in a `Map` is the same problem it is in an array,
91
+ * and an array already comes out shorter for it. Cloning the whole container
92
+ * would carry a function straight into a `DataCloneError`, and would strip a
93
+ * marked value's `__v_skip` and hand the far side a plain graph to deep-watch
94
+ * — which is the hazard #974 exists to prevent.
95
+ *
96
+ * And these are the only types here that Vue proxies. `structuredClone` throws
97
+ * `DataCloneError` on a reactive `Map` while the raw one clones fine, so a
98
+ * `Map` in reactive state would be refused and dropped — a second silence
99
+ * rather than a fix for the first. `Date`, `RegExp`, `Error` and typed arrays
100
+ * are not proxied, so the path below never meets a proxy and needs no `toRaw`.
101
+ */
102
+ function walkCollection(value, seen) {
103
+ const keep = (walked) => walked !== DROP && typeof walked !== "function";
104
+ if (value instanceof Set) {
105
+ const copy = /* @__PURE__ */ new Set();
106
+ seen.set(value, copy);
107
+ for (const entry of value) {
108
+ const walked = walk(entry, true, seen);
109
+ if (keep(walked)) copy.add(walked);
110
+ }
111
+ return copy;
112
+ }
113
+ const copy = /* @__PURE__ */ new Map();
114
+ seen.set(value, copy);
115
+ for (const [key, entry] of value) {
116
+ const walkedKey = walk(key, true, seen);
117
+ const walked = walk(entry, true, seen);
118
+ if (keep(walkedKey) && keep(walked)) copy.set(walkedKey, walked);
119
+ }
120
+ return copy;
121
+ }
122
+ function toRawObject(obj, target, clean, seen) {
25
123
  Object.keys(obj).forEach((key) => {
26
124
  if (clean && typeof obj[key] === "function") return;
27
- target[key] = toRawDeep(obj[key], clean, seen);
125
+ const value = walk(obj[key], clean, seen);
126
+ if (value === DROP) return;
127
+ target[key] = value;
28
128
  });
29
129
  }
30
130
  /**