@poveste/app 0.12.3 → 0.13.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.
Files changed (50) hide show
  1. package/dist/app/style/font.css +11 -7
  2. package/dist/app/style/fonts/LICENSE +93 -0
  3. package/dist/app/style/fonts/noto-sans-display-cyrillic-400-normal.woff2 +0 -0
  4. package/dist/app/style/fonts/noto-sans-display-cyrillic-ext-400-normal.woff2 +0 -0
  5. package/dist/app/style/fonts/noto-sans-display-greek-400-normal.woff2 +0 -0
  6. package/dist/app/style/fonts/noto-sans-display-greek-ext-400-normal.woff2 +0 -0
  7. package/dist/app/style/fonts/noto-sans-display-latin-400-normal.woff2 +0 -0
  8. package/dist/app/style/fonts/noto-sans-display-latin-ext-400-normal.woff2 +0 -0
  9. package/dist/app/style/fonts/noto-sans-display-vietnamese-400-normal.woff2 +0 -0
  10. package/dist/bundled/App.vue_vue_type_script_setup_true_lang.js +19 -19
  11. package/dist/bundled/app.css +10 -10
  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 +67 -29
  14. package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_script_setup_true_lang.js +1 -1
  15. package/dist/bundled/components/story/StoryVariantSingle.js +1 -1
  16. package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_script_setup_true_lang.js +20 -23
  17. package/dist/bundled/components/story/StoryVariantSinglePreviewNative.vue_vue_type_script_setup_true_lang.js +5 -2
  18. package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.vue_vue_type_script_setup_true_lang.js +4 -0
  19. package/dist/bundled/components/story/StoryVariantSingleView.vue_vue_type_script_setup_true_lang.js +23 -13
  20. package/dist/bundled/components/story/StoryView.vue_vue_type_script_setup_true_lang.js +8 -11
  21. package/dist/bundled/sandbox.js +6 -1
  22. package/dist/bundled/util/events.js +4 -1
  23. package/dist/bundled/util/highlighter.js +11 -4
  24. package/dist/bundled/util/occupant.js +16 -0
  25. package/dist/bundled/util/variant.js +12 -1
  26. package/dist/style.css +4 -4
  27. package/package.json +5 -5
  28. package/src/__tests__/font.spec.ts +48 -2
  29. package/src/app/App.vue +56 -46
  30. package/src/app/components/base/BaseSplitPane.vue +95 -29
  31. package/src/app/components/story/StoryVariantSingle.vue +72 -66
  32. package/src/app/components/story/StoryVariantSinglePreviewNative.vue +13 -2
  33. package/src/app/components/story/StoryVariantSinglePreviewRemote.vue +8 -0
  34. package/src/app/components/story/StoryVariantSingleView.vue +59 -13
  35. package/src/app/components/story/StoryView.vue +17 -17
  36. package/src/app/sandbox.ts +9 -1
  37. package/src/app/style/font.css +11 -7
  38. package/src/app/style/fonts/LICENSE +93 -0
  39. package/src/app/style/fonts/noto-sans-display-cyrillic-400-normal.woff2 +0 -0
  40. package/src/app/style/fonts/noto-sans-display-cyrillic-ext-400-normal.woff2 +0 -0
  41. package/src/app/style/fonts/noto-sans-display-greek-400-normal.woff2 +0 -0
  42. package/src/app/style/fonts/noto-sans-display-greek-ext-400-normal.woff2 +0 -0
  43. package/src/app/style/fonts/noto-sans-display-latin-400-normal.woff2 +0 -0
  44. package/src/app/style/fonts/noto-sans-display-latin-ext-400-normal.woff2 +0 -0
  45. package/src/app/style/fonts/noto-sans-display-vietnamese-400-normal.woff2 +0 -0
  46. package/src/app/util/events.ts +3 -0
  47. package/src/app/util/highlighter.ts +16 -9
  48. package/src/app/util/occupant.ts +13 -0
  49. package/src/app/util/variant.ts +13 -1
  50. package/LICENSE +0 -22
@@ -4,6 +4,10 @@
4
4
  * in each book. Copied rather than imported because the package pairs the two
5
5
  * formats in every `src`; `font.spec.ts` fails if a bump moves the subsets.
6
6
  *
7
+ * Vendored rather than resolved from the package, which publishes the family
8
+ * whole: 5.9 MB installed to ship 108 KB (#306). OFL-1.1, so `fonts/LICENSE`
9
+ * travels with the files.
10
+ *
7
11
  * Regenerate: node packages/poveste-app/scripts/font.mjs
8
12
  */
9
13
 
@@ -13,7 +17,7 @@
13
17
  font-style: normal;
14
18
  font-display: swap;
15
19
  font-weight: 400;
16
- src: url('@fontsource/noto-sans-display/files/noto-sans-display-cyrillic-ext-400-normal.woff2') format('woff2');
20
+ src: url('./fonts/noto-sans-display-cyrillic-ext-400-normal.woff2') format('woff2');
17
21
  unicode-range: U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F;
18
22
  }
19
23
 
@@ -23,7 +27,7 @@
23
27
  font-style: normal;
24
28
  font-display: swap;
25
29
  font-weight: 400;
26
- src: url('@fontsource/noto-sans-display/files/noto-sans-display-cyrillic-400-normal.woff2') format('woff2');
30
+ src: url('./fonts/noto-sans-display-cyrillic-400-normal.woff2') format('woff2');
27
31
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
28
32
  }
29
33
 
@@ -33,7 +37,7 @@
33
37
  font-style: normal;
34
38
  font-display: swap;
35
39
  font-weight: 400;
36
- src: url('@fontsource/noto-sans-display/files/noto-sans-display-greek-ext-400-normal.woff2') format('woff2');
40
+ src: url('./fonts/noto-sans-display-greek-ext-400-normal.woff2') format('woff2');
37
41
  unicode-range: U+1F00-1FFF;
38
42
  }
39
43
 
@@ -43,7 +47,7 @@
43
47
  font-style: normal;
44
48
  font-display: swap;
45
49
  font-weight: 400;
46
- src: url('@fontsource/noto-sans-display/files/noto-sans-display-greek-400-normal.woff2') format('woff2');
50
+ src: url('./fonts/noto-sans-display-greek-400-normal.woff2') format('woff2');
47
51
  unicode-range: U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF;
48
52
  }
49
53
 
@@ -53,7 +57,7 @@
53
57
  font-style: normal;
54
58
  font-display: swap;
55
59
  font-weight: 400;
56
- src: url('@fontsource/noto-sans-display/files/noto-sans-display-vietnamese-400-normal.woff2') format('woff2');
60
+ src: url('./fonts/noto-sans-display-vietnamese-400-normal.woff2') format('woff2');
57
61
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
58
62
  }
59
63
 
@@ -63,7 +67,7 @@
63
67
  font-style: normal;
64
68
  font-display: swap;
65
69
  font-weight: 400;
66
- src: url('@fontsource/noto-sans-display/files/noto-sans-display-latin-ext-400-normal.woff2') format('woff2');
70
+ src: url('./fonts/noto-sans-display-latin-ext-400-normal.woff2') format('woff2');
67
71
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
68
72
  }
69
73
 
@@ -73,6 +77,6 @@
73
77
  font-style: normal;
74
78
  font-display: swap;
75
79
  font-weight: 400;
76
- src: url('@fontsource/noto-sans-display/files/noto-sans-display-latin-400-normal.woff2') format('woff2');
80
+ src: url('./fonts/noto-sans-display-latin-400-normal.woff2') format('woff2');
77
81
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
78
82
  }
@@ -0,0 +1,93 @@
1
+ Copyright 2015 Google Inc. All Rights Reserved. NotoSansDisplay-Italic[wdth,wght].ttf: Copyright 2015 Google Inc. All Rights Reserved.
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -32,14 +32,16 @@ var _hoisted_3 = {
32
32
  };
33
33
  var _hoisted_4 = { class: "flex items-center gap-2 pr-4" };
34
34
  var _hoisted_5 = { class: "grow flex flex-col min-h-0" };
35
- var _hoisted_6 = { class: "flex flex-col h-full bg-gray-100 dark:bg-gray-750 __poveste-pane-shadow-from-right" };
36
- var _hoisted_7 = {
35
+ var _hoisted_6 = {
36
+ key: 0,
37
+ class: "sr-only"
38
+ };
39
+ var _hoisted_7 = { class: "flex flex-col h-full bg-gray-100 dark:bg-gray-750 __poveste-pane-shadow-from-right" };
40
+ var _hoisted_8 = {
37
41
  "aria-label": "Stories",
38
42
  class: "flex-1 flex flex-col min-h-0"
39
43
  };
40
- var _hoisted_8 = { class: "flex flex-col h-full" };
41
- var _hoisted_9 = { class: "sr-only" };
42
- var _hoisted_10 = { class: "h-full flex flex-col" };
44
+ var _hoisted_9 = { class: "flex flex-col h-full" };
43
45
  var App_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
44
46
  name: "PovesteApp",
45
47
  setup(__props) {
@@ -100,6 +102,7 @@ var App_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompon
100
102
  });
101
103
  const commandStore = useCommandStore();
102
104
  const layoutStore = useLayoutStore();
105
+ const storyListVisible = computed(() => !!layoutStore.settings.storyListVisible);
103
106
  return (_ctx, _cache) => {
104
107
  const _component_RouterView = resolveComponent("RouterView");
105
108
  return openBlock(), createElementBlock("div", _hoisted_1, [
@@ -122,42 +125,39 @@ var App_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompon
122
125
  stories: stories.value
123
126
  }, null, 8, ["tree", "stories"]),
124
127
  createElementVNode("main", _hoisted_5, [createVNode(_component_RouterView, { class: "grow" })])
125
- ])) : unref(layoutStore).settings.storyListVisible ? (openBlock(), createBlock(BaseSplitPane_default, {
126
- key: 1,
128
+ ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [!storyListVisible.value ? (openBlock(), createElementBlock("header", _hoisted_6, [createElementVNode("h1", null, toDisplayString(unref(povesteConfig).theme?.title ?? "Poveste"), 1)])) : createCommentVNode("", true), createVNode(BaseSplitPane_default, {
127
129
  "save-id": "main-horiz",
128
130
  min: 5,
129
131
  max: 50,
130
132
  "default-split": 15,
133
+ "show-first": storyListVisible.value,
131
134
  class: "h-full"
132
135
  }, {
133
- first: withCtx(() => [createElementVNode("div", _hoisted_6, [createVNode(AppHeader_default, { class: "flex-none" }), createElementVNode("nav", _hoisted_7, [createVNode(StoryList_default, {
136
+ first: withCtx(() => [createElementVNode("div", _hoisted_7, [createVNode(AppHeader_default, { class: "flex-none" }), createElementVNode("nav", _hoisted_8, [createVNode(StoryList_default, {
134
137
  tree: tree$1.value,
135
138
  stories: stories.value,
136
139
  class: "flex-1"
137
140
  }, null, 8, ["tree", "stories"])])])]),
138
- last: withCtx(() => [createElementVNode("main", _hoisted_8, [createVNode(TopBar_default, {
141
+ last: withCtx(() => [createElementVNode("main", _hoisted_9, [createVNode(TopBar_default, {
139
142
  onLayout: _cache[2] || (_cache[2] = ($event) => isLayoutOpen.value = true),
140
143
  onSearch: _cache[3] || (_cache[3] = ($event) => isSearchOpen.value = true)
141
144
  }), createVNode(_component_RouterView, { class: "flex-1 min-h-0" })])]),
142
145
  _: 1
143
- })) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [createElementVNode("header", _hoisted_9, [createElementVNode("h1", null, toDisplayString(unref(povesteConfig).theme?.title ?? "Poveste"), 1)]), createElementVNode("main", _hoisted_10, [createVNode(TopBar_default, {
144
- onLayout: _cache[4] || (_cache[4] = ($event) => isLayoutOpen.value = true),
145
- onSearch: _cache[5] || (_cache[5] = ($event) => isSearchOpen.value = true)
146
- }), createVNode(_component_RouterView, { class: "flex-1 min-h-0" })])], 64)),
146
+ }, 8, ["show-first"])], 64)),
147
147
  !unref(isMobile) ? (openBlock(), createBlock(LayoutModal_default, {
148
- key: 3,
148
+ key: 2,
149
149
  shown: isLayoutOpen.value,
150
- onClose: _cache[6] || (_cache[6] = ($event) => isLayoutOpen.value = false)
150
+ onClose: _cache[4] || (_cache[4] = ($event) => isLayoutOpen.value = false)
151
151
  }, null, 8, ["shown"])) : createCommentVNode("", true),
152
152
  loadSearch.value ? (openBlock(), createBlock(SearchModal_default, {
153
- key: 4,
153
+ key: 3,
154
154
  shown: isSearchOpen.value,
155
- onClose: _cache[7] || (_cache[7] = ($event) => isSearchOpen.value = false)
155
+ onClose: _cache[5] || (_cache[5] = ($event) => isSearchOpen.value = false)
156
156
  }, null, 8, ["shown"])) : createCommentVNode("", true),
157
157
  _ctx.__POVESTE_DEV__ ? (openBlock(), createBlock(CommandPromptsModal_default, {
158
- key: 5,
158
+ key: 4,
159
159
  shown: unref(commandStore).showPromptsModal,
160
- onClose: _cache[8] || (_cache[8] = ($event) => unref(commandStore).showPromptsModal = false)
160
+ onClose: _cache[6] || (_cache[6] = ($event) => unref(commandStore).showPromptsModal = false)
161
161
  }, null, 8, ["shown"])) : createCommentVNode("", true)
162
162
  ], 4),
163
163
  createVNode(Transition, { name: "__poveste-fade" }, {
@@ -28,28 +28,28 @@
28
28
  }
29
29
  }
30
30
  @scope (:root) to (.__poveste-render-story:not(.__poveste-render-custom-controls)) {
31
- .landscape > div > .dragger[data-v-55afeb6c] {
31
+ .landscape > div > .dragger[data-v-6a9b0727] {
32
32
  width: .625rem;
33
33
  }
34
- .portrait > div > .dragger[data-v-55afeb6c] {
34
+ .portrait > div > .dragger[data-v-6a9b0727] {
35
35
  height: .625rem;
36
36
  }
37
- .landscape > div > .dragger.dragger-offset-before[data-v-55afeb6c] {
37
+ .landscape > div > .dragger.dragger-offset-before[data-v-6a9b0727] {
38
38
  right: 0;
39
39
  }
40
- .portrait > div > .dragger.dragger-offset-before[data-v-55afeb6c] {
40
+ .portrait > div > .dragger.dragger-offset-before[data-v-6a9b0727] {
41
41
  bottom: 0;
42
42
  }
43
- .landscape > div > .dragger.dragger-offset-center[data-v-55afeb6c] {
43
+ .landscape > div > .dragger.dragger-offset-center[data-v-6a9b0727] {
44
44
  right: -.3125rem;
45
45
  }
46
- .portrait > div > .dragger.dragger-offset-center[data-v-55afeb6c] {
46
+ .portrait > div > .dragger.dragger-offset-center[data-v-6a9b0727] {
47
47
  bottom: -.3125rem;
48
48
  }
49
- .landscape > div > .dragger.dragger-offset-after[data-v-55afeb6c] {
49
+ .landscape > div > .dragger.dragger-offset-after[data-v-6a9b0727] {
50
50
  right: -.625rem;
51
51
  }
52
- .portrait > div > .dragger.dragger-offset-after[data-v-55afeb6c] {
52
+ .portrait > div > .dragger.dragger-offset-after[data-v-6a9b0727] {
53
53
  bottom: -.625rem;
54
54
  }
55
55
  }
@@ -134,8 +134,8 @@
134
134
  }
135
135
  }
136
136
  @scope (:root) to (.__poveste-render-story:not(.__poveste-render-custom-controls)) {
137
- .bind-icon-color[data-v-db50bc8f] {
138
- color: var(--dd8d1ad8);
137
+ .bind-icon-color[data-v-6805a444] {
138
+ color: var(--v72c6d646);
139
139
  }
140
140
  }
141
141
  @scope (:root) to (.__poveste-render-story:not(.__poveste-render-custom-controls)) {
@@ -2,6 +2,6 @@ import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export
2
2
  import BaseSplitPane_vue_vue_type_script_setup_true_lang_default from "./BaseSplitPane.vue_vue_type_script_setup_true_lang.js";
3
3
  /* empty css */
4
4
  //#region src/app/components/base/BaseSplitPane.vue
5
- var BaseSplitPane_default = /*#__PURE__*/ _plugin_vue_export_helper_default(BaseSplitPane_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-55afeb6c"]]);
5
+ var BaseSplitPane_default = /*#__PURE__*/ _plugin_vue_export_helper_default(BaseSplitPane_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-6a9b0727"]]);
6
6
  //#endregion
7
7
  export { BaseSplitPane_default as default };
@@ -1,4 +1,4 @@
1
- import { computed, createElementBlock, createElementVNode, defineComponent, normalizeClass, normalizeStyle, onUnmounted, openBlock, ref, renderSlot, watch, withModifiers } from "@poveste/vendors/vue";
1
+ import { computed, createCommentVNode, createElementBlock, defineComponent, normalizeClass, normalizeStyle, onUnmounted, openBlock, ref, renderSlot, watch, withModifiers } from "@poveste/vendors/vue";
2
2
  //#region src/app/components/base/BaseSplitPane.vue?vue&type=script&setup=true&lang.ts
3
3
  var SAVE_PREFIX = "__poveste";
4
4
  var BaseSplitPane_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
@@ -45,6 +45,32 @@ var BaseSplitPane_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
45
45
  showDivider: {
46
46
  type: Boolean,
47
47
  default: true
48
+ },
49
+ /**
50
+ * Whether the first pane exists at all.
51
+ *
52
+ * Dropping it here rather than at the call site keeps the other slot at one
53
+ * position in the tree, so a layout that sometimes has nothing to put beside
54
+ * its content does not remount that content when it gains or loses the pane
55
+ * (#328). A `v-if` inside this component leaves a comment placeholder, so the
56
+ * surviving pane keeps its index and Vue patches it rather than rebuilding it;
57
+ * a `v-if` at the call site, choosing between a pane and a bare element, is
58
+ * what does not.
59
+ */
60
+ showFirst: {
61
+ type: Boolean,
62
+ default: true
63
+ },
64
+ /**
65
+ * The same for the last pane — see `showFirst` (#596).
66
+ *
67
+ * At most one of the two is meant to be false. Both false renders an empty
68
+ * box that still persists a split, which is a caller mistake rather than a
69
+ * mode this component supports.
70
+ */
71
+ showLast: {
72
+ type: Boolean,
73
+ default: true
48
74
  }
49
75
  },
50
76
  emits: { "update:split": (_value) => true },
@@ -55,32 +81,38 @@ var BaseSplitPane_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
55
81
  watch(() => props.split, (value) => {
56
82
  if (value !== void 0) currentSplit.value = value;
57
83
  }, { immediate: true });
58
- if (props.saveId) {
59
- const storageKey = `${SAVE_PREFIX}-split-pane-${props.saveId}`;
60
- const savedValue = localStorage.getItem(storageKey);
61
- if (savedValue != null) {
62
- let parsedValue;
63
- try {
64
- parsedValue = JSON.parse(savedValue);
65
- } catch (e) {
66
- console.error(e);
67
- }
68
- if (typeof parsedValue === "number") currentSplit.value = parsedValue;
84
+ const storageKey = computed(() => props.saveId ? `${SAVE_PREFIX}-split-pane-${props.saveId}` : null);
85
+ watch(storageKey, (key) => {
86
+ if (!key) return;
87
+ const savedValue = localStorage.getItem(key);
88
+ let parsedValue;
89
+ if (savedValue != null) try {
90
+ parsedValue = JSON.parse(savedValue);
91
+ } catch (e) {
92
+ console.error(e);
69
93
  }
70
- watch(currentSplit, (value) => {
71
- localStorage.setItem(storageKey, JSON.stringify(value));
72
- });
73
- watch(currentSplit, (value) => {
74
- if (value !== props.split) emit("update:split", value);
75
- }, { immediate: true });
76
- }
94
+ currentSplit.value = typeof parsedValue === "number" ? parsedValue : props.defaultSplit;
95
+ }, { immediate: true });
96
+ watch(currentSplit, (value) => {
97
+ if (storageKey.value) localStorage.setItem(storageKey.value, JSON.stringify(value));
98
+ if (value !== props.split) emit("update:split", value);
99
+ }, { immediate: true });
77
100
  const boundSplit = computed(() => {
78
101
  if (currentSplit.value < props.min) return props.min;
79
102
  else if (currentSplit.value > props.max) return props.max;
80
103
  else return currentSplit.value;
81
104
  });
82
- const leftStyle = computed(() => ({ [props.orientation === "landscape" ? "width" : "height"]: props.fixed ? `${boundSplit.value}px` : `${boundSplit.value}%` }));
83
- const rightStyle = computed(() => ({ [props.orientation === "landscape" ? "width" : "height"]: props.fixed ? null : `${100 - boundSplit.value}%` }));
105
+ const axis = computed(() => props.orientation === "landscape" ? "width" : "height");
106
+ /** Whether there are two panes to divide, drag between, or share the axis. */
107
+ const hasBothPanes = computed(() => props.showFirst && props.showLast);
108
+ const leftStyle = computed(() => {
109
+ if (!hasBothPanes.value) return { [axis.value]: "100%" };
110
+ return { [axis.value]: props.fixed ? `${boundSplit.value}px` : `${boundSplit.value}%` };
111
+ });
112
+ const rightStyle = computed(() => {
113
+ if (!hasBothPanes.value) return { [axis.value]: "100%" };
114
+ return { [axis.value]: props.fixed ? null : `${100 - boundSplit.value}%` };
115
+ });
84
116
  const dragging = ref(false);
85
117
  let startPosition = 0;
86
118
  let startSplit = 0;
@@ -112,6 +144,9 @@ var BaseSplitPane_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
112
144
  dragging.value = false;
113
145
  removeDragListeners();
114
146
  }
147
+ watch(hasBothPanes, (both) => {
148
+ if (!both && dragging.value) dragEnd();
149
+ });
115
150
  function removeDragListeners() {
116
151
  window.removeEventListener("mousemove", dragMove);
117
152
  window.removeEventListener("mouseup", dragEnd);
@@ -129,14 +164,16 @@ var BaseSplitPane_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
129
164
  "cursor-ns-resize": dragging.value && __props.orientation === "portrait",
130
165
  [__props.orientation]: true
131
166
  }])
132
- }, [createElementVNode("div", {
167
+ }, [__props.showFirst ? (openBlock(), createElementBlock("div", {
168
+ key: 0,
133
169
  class: normalizeClass(["relative top-0 left-0 z-20", {
134
170
  "pointer-events-none": dragging.value,
135
- "border-r border-gray-300/30 dark:border-gray-800": __props.orientation === "landscape" && __props.showDivider,
136
- "flex-none": __props.fixed
171
+ "border-r border-gray-300/30 dark:border-gray-800": __props.orientation === "landscape" && __props.showDivider && hasBothPanes.value,
172
+ "flex-none": __props.fixed && hasBothPanes.value
137
173
  }]),
138
174
  style: normalizeStyle(leftStyle.value)
139
- }, [renderSlot(_ctx.$slots, "first", {}, void 0, true), createElementVNode("div", {
175
+ }, [renderSlot(_ctx.$slots, "first", {}, void 0, true), hasBothPanes.value ? (openBlock(), createElementBlock("div", {
176
+ key: 0,
140
177
  class: normalizeClass(["dragger absolute z-100 hover:bg-primary-500/50 transition-colors duration-150 delay-150", {
141
178
  "top-0 bottom-0 cursor-ew-resize": __props.orientation === "landscape",
142
179
  "left-0 right-0 cursor-ns-resize": __props.orientation === "portrait",
@@ -144,14 +181,15 @@ var BaseSplitPane_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
144
181
  "bg-primary-500/25": dragging.value
145
182
  }]),
146
183
  onMousedown: withModifiers(dragStart, ["prevent"])
147
- }, null, 34)], 6), createElementVNode("div", {
184
+ }, null, 34)) : createCommentVNode("", true)], 6)) : createCommentVNode("", true), __props.showLast ? (openBlock(), createElementBlock("div", {
185
+ key: 1,
148
186
  class: normalizeClass(["relative bottom-0 right-0", {
149
187
  "pointer-events-none": dragging.value,
150
- "border-t border-gray-300/30 dark:border-gray-800": __props.orientation === "portrait" && __props.showDivider,
151
- "flex-1": __props.fixed
188
+ "border-t border-gray-300/30 dark:border-gray-800": __props.orientation === "portrait" && __props.showDivider && hasBothPanes.value,
189
+ "flex-1": __props.fixed && hasBothPanes.value
152
190
  }]),
153
191
  style: normalizeStyle(rightStyle.value)
154
- }, [renderSlot(_ctx.$slots, "last", {}, void 0, true)], 6)], 2);
192
+ }, [renderSlot(_ctx.$slots, "last", {}, void 0, true)], 6)) : createCommentVNode("", true)], 2);
155
193
  };
156
194
  }
157
195
  });
@@ -6,8 +6,8 @@ import { getContrastColor } from "../../util/preview-settings.js";
6
6
  import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
7
7
  import ToolbarNewTab_default from "../toolbar/ToolbarNewTab.js";
8
8
  import GenericRenderStory_default from "./GenericRenderStory.js";
9
- import { getSourceCode } from "../../util/docs.js";
10
9
  import { useCurrentVariantRoute } from "../../util/variant.js";
10
+ import { getSourceCode } from "../../util/docs.js";
11
11
  import CheckerboardPattern_default from "../misc/CheckerboardPattern.js";
12
12
  import StoryVariantSinglePreviewRemote_default from "./StoryVariantSinglePreviewRemote.js";
13
13
  import { useResizeObserver } from "@poveste/vendors/vue-use";
@@ -2,6 +2,6 @@ import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export
2
2
  import StoryVariantSingle_vue_vue_type_script_setup_true_lang_default from "./StoryVariantSingle.vue_vue_type_script_setup_true_lang.js";
3
3
  /* empty css */
4
4
  //#region src/app/components/story/StoryVariantSingle.vue
5
- var StoryVariantSingle_default = /*#__PURE__*/ _plugin_vue_export_helper_default(StoryVariantSingle_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-db50bc8f"]]);
5
+ var StoryVariantSingle_default = /*#__PURE__*/ _plugin_vue_export_helper_default(StoryVariantSingle_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-6805a444"]]);
6
6
  //#endregion
7
7
  export { StoryVariantSingle_default as default };
@@ -1,41 +1,37 @@
1
1
  import { isMobile } from "../../util/responsive.js";
2
2
  import { useStoryStore } from "../../stores/story.js";
3
3
  import BaseSplitPane_default from "../base/BaseSplitPane.js";
4
+ import { autoSelectsVariant } from "../../util/variant.js";
4
5
  import StoryVariantListItem_default from "./StoryVariantListItem.js";
5
6
  import StoryVariantSingleView_default from "./StoryVariantSingleView.js";
6
7
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, renderList, toDisplayString, unref, useCssVars, withCtx } from "@poveste/vendors/vue";
7
8
  import { Icon } from "@poveste/vendors/iconify";
8
9
  //#region src/app/components/story/StoryVariantSingle.vue?vue&type=script&setup=true&lang.ts
9
10
  var _hoisted_1 = {
10
- key: 0,
11
- class: "poveste-story-variant-single p-2 h-full __poveste-pane-shadow-from-right"
12
- };
13
- var _hoisted_2 = {
14
11
  key: 0,
15
12
  class: "divide-y divide-gray-100 dark:divide-gray-800 h-full flex flex-col"
16
13
  };
17
- var _hoisted_3 = {
18
- key: 0,
19
- class: "p-2 h-full"
14
+ var _hoisted_2 = {
15
+ key: 1,
16
+ class: "poveste-story-variant-single p-2 h-full __poveste-pane-shadow-from-right"
20
17
  };
21
- var _hoisted_4 = { class: "h-full overflow-y-auto" };
22
- var _hoisted_5 = {
18
+ var _hoisted_3 = { class: "h-full overflow-y-auto" };
19
+ var _hoisted_4 = {
23
20
  key: 0,
24
- class: "p-2 h-full __poveste-pane-shadow-from-right"
21
+ class: "poveste-story-variant-single p-2 h-full __poveste-pane-shadow-from-right"
25
22
  };
26
23
  var StoryVariantSingle_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
27
24
  __name: "StoryVariantSingle",
28
25
  emits: { openVariantMenu: () => true },
29
26
  setup(__props) {
30
- useCssVars((_ctx) => ({ "dd8d1ad8": variant.value?.iconColor }));
27
+ useCssVars((_ctx) => ({ "v72c6d646": variant.value?.iconColor }));
31
28
  const storyStore = useStoryStore();
32
29
  const hasSingleVariant = computed(() => storyStore.currentStory?.variants.length === 1);
33
- const variant = computed(() => storyStore.currentVariant);
30
+ const variant = computed(() => storyStore.currentVariant ?? null);
31
+ const showsPreview = computed(() => !!variant.value || autoSelectsVariant(storyStore.currentStory));
34
32
  return (_ctx, _cache) => {
35
- return hasSingleVariant.value && variant.value ? (openBlock(), createElementBlock("div", _hoisted_1, [createVNode(StoryVariantSingleView_default, {
36
- variant: variant.value,
37
- story: unref(storyStore).currentStory
38
- }, null, 8, ["variant", "story"])])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2, [createElementVNode("a", {
33
+ return unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_1, [!hasSingleVariant.value || !variant.value ? (openBlock(), createElementBlock("a", {
34
+ key: 0,
39
35
  class: "px-6 h-12 hover:text-primary-500 dark:hover:text-primary-400 cursor-pointer flex gap-2 flex-wrap w-full items-center flex-none",
40
36
  onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("openVariantMenu"))
41
37
  }, [variant.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createVNode(unref(Icon), {
@@ -47,28 +43,29 @@ var StoryVariantSingle_vue_vue_type_script_setup_true_lang_default = /*@__PURE__
47
43
  }, null, 8, ["icon", "class"]), createTextVNode(" " + toDisplayString(variant.value.title), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(" Select a variant... ")], 64)), createVNode(unref(Icon), {
48
44
  icon: "carbon:chevron-sort",
49
45
  class: "w-5 h-5 shrink-0 ml-auto"
50
- })]), unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_3, [createVNode(StoryVariantSingleView_default, {
51
- variant: unref(storyStore).currentVariant,
46
+ })])) : createCommentVNode("", true), showsPreview.value ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(StoryVariantSingleView_default, {
47
+ variant: variant.value,
52
48
  story: unref(storyStore).currentStory
53
49
  }, null, 8, ["variant", "story"])])) : createCommentVNode("", true)])) : (openBlock(), createBlock(BaseSplitPane_default, {
54
50
  key: 1,
55
51
  "save-id": "story-single-main-split",
56
52
  min: 5,
57
53
  max: 40,
58
- "default-split": 17
54
+ "default-split": 17,
55
+ "show-first": !hasSingleVariant.value
59
56
  }, {
60
- first: withCtx(() => [createElementVNode("div", _hoisted_4, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory.variants, (v, index) => {
57
+ first: withCtx(() => [createElementVNode("div", _hoisted_3, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory?.variants ?? [], (v, index) => {
61
58
  return openBlock(), createBlock(StoryVariantListItem_default, {
62
59
  key: index,
63
60
  variant: v
64
61
  }, null, 8, ["variant"]);
65
62
  }), 128))])]),
66
- last: withCtx(() => [unref(storyStore).currentVariant ? (openBlock(), createElementBlock("div", _hoisted_5, [createVNode(StoryVariantSingleView_default, {
67
- variant: unref(storyStore).currentVariant,
63
+ last: withCtx(() => [showsPreview.value ? (openBlock(), createElementBlock("div", _hoisted_4, [createVNode(StoryVariantSingleView_default, {
64
+ variant: variant.value,
68
65
  story: unref(storyStore).currentStory
69
66
  }, null, 8, ["variant", "story"])])) : createCommentVNode("", true)]),
70
67
  _: 1
71
- }))], 64));
68
+ }, 8, ["show-first"]));
72
69
  };
73
70
  }
74
71
  });
@@ -5,7 +5,7 @@ import { getContrastColor } from "../../util/preview-settings.js";
5
5
  import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
6
6
  import GenericRenderStory_default from "./GenericRenderStory.js";
7
7
  import StoryResponsivePreview_default from "./StoryResponsivePreview.js";
8
- import { computed, createBlock, createElementVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, unref, withCtx } from "@poveste/vendors/vue";
8
+ import { computed, createBlock, createElementVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, unref, watch, withCtx } from "@poveste/vendors/vue";
9
9
  //#region src/app/components/story/StoryVariantSinglePreviewNative.vue?vue&type=script&setup=true&lang.ts
10
10
  var StoryVariantSinglePreviewNative_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
11
11
  __name: "StoryVariantSinglePreviewNative",
@@ -16,7 +16,10 @@ var StoryVariantSinglePreviewNative_vue_vue_type_script_setup_true_lang_default
16
16
  setup(__props) {
17
17
  const props = __props;
18
18
  const storyStore = useStoryStore();
19
- storyStore.setPreviewReady(props.variant, false);
19
+ watch(() => props.variant, (variant, previous) => {
20
+ if (previous) storyStore.setPreviewReady(previous, false);
21
+ storyStore.setPreviewReady(variant, false);
22
+ }, { immediate: true });
20
23
  function onReady() {
21
24
  storyStore.setPreviewReady(props.variant, true);
22
25
  }
@@ -83,6 +83,7 @@ var StoryVariantSinglePreviewRemote_vue_vue_type_script_setup_true_lang_default
83
83
  updateVariantState(event.data.state);
84
84
  break;
85
85
  case EVENT_SEND:
86
+ if (!fromCurrentOccupant(event.data)) break;
86
87
  logEvent(event.data.event);
87
88
  break;
88
89
  case SANDBOX_READY:
@@ -134,6 +135,7 @@ var StoryVariantSinglePreviewRemote_vue_vue_type_script_setup_true_lang_default
134
135
  const isIframeLoaded = ref(false);
135
136
  let retargets = 0;
136
137
  let servedStory = props.story;
138
+ let servedVariant = props.variant;
137
139
  let stopTrackKeyboard;
138
140
  let unmounted = false;
139
141
  function reload(url) {
@@ -150,6 +152,8 @@ var StoryVariantSinglePreviewRemote_vue_vue_type_script_setup_true_lang_default
150
152
  }
151
153
  watch(sandboxUrl, (url) => {
152
154
  bridge = createStateBridge(postState);
155
+ if (servedVariant && servedVariant !== props.variant) storyStore.setPreviewReady(servedVariant, false);
156
+ servedVariant = props.variant;
153
157
  storyStore.setPreviewReady(props.variant, false);
154
158
  const reuse = props.story.layout?.isolate !== true && servedStory.layout?.isolate !== true;
155
159
  const target = iframe.value?.contentWindow;