@deot/docs-playground 1.0.8 → 1.0.9

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/index.cjs CHANGED
@@ -105,16 +105,40 @@ var highlightCodeByLanguage = (code, language) => {
105
105
  var highlightCode = (code, filename) => highlightCodeByLanguage(code, resolveHighlightLanguage(filename));
106
106
  //#endregion
107
107
  //#region packages/playground/src/icon/icons.ts
108
- var PLAYGROUND_ICON_PATHS = {
109
- runtime: "M5 3h14a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Zm3 18h8m-4-3v3m-2-13 5 3-5 3V8Z",
110
- files: "M6 2h8l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Zm8 0v6h5m-9 5-2 2 2 2m5-4 2 2-2 2",
111
- copy: "M9 8h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2Zm-2 8H5a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v4",
112
- editor: "M8 8 4 12l4 4m8-8 4 4-4 4m-3-10-2 12",
113
- viewport: "M3 4h12v10H3V4Zm3 14h6m-3-4v4m9-9h3v11h-6V9h3m0 9h0"
108
+ var strokeIcon = (path) => ({
109
+ path,
110
+ fill: "none",
111
+ stroke: "currentColor"
112
+ });
113
+ var solidIcon = (path) => ({
114
+ path,
115
+ fill: "currentColor",
116
+ stroke: "none"
117
+ });
118
+ var PLAYGROUND_ICONS = {
119
+ runtime: strokeIcon("M5 3h14a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Zm3 18h8m-4-3v3m-2-13 5 3-5 3V8Z"),
120
+ files: strokeIcon("M6 2h8l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Zm8 0v6h5m-9 5-2 2 2 2m5-4 2 2-2 2"),
121
+ copy: strokeIcon(["M9 8h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2Z", "m-2 8H5a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v4"].join("")),
122
+ refresh: solidIcon(["M12 2.5a9.5 9.5 0 1 1 0 19 1 1 0 1 1 0-2 7.5 7.5 0 1 0-7.5-7.8l.24-.23a.75.75 0 1 1 1.06 1.06", "L4.03 14.3a.75.75 0 0 1-1.06 0L1.2 12.53a.75.75 0 1 1 1.06-1.06l.24.24A9.5 9.5 0 0 1 12 2.5"].join("")),
123
+ editor: solidIcon([
124
+ "M9.38 19.32a.82.82 0 0 1-.71-1.23l5.85-10.13a.82.82 0 0 1 1.42.82l-5.85 10.13a.8.8 0 0 1-.71.4",
125
+ "m-2.52-.76a.8.8 0 0 1-.58-.25l-4.13-4.12a1.06 1.06 0 0 1 0-1.5l4.13-4.12a.82.82 0 1 1 1.16 1.16",
126
+ "l-3.72 3.71 3.72 3.71a.82.82 0 0 1-.58 1.4m10.9 0a.82.82 0 0 1-.58-1.4l3.7-3.7-3.7-3.72",
127
+ "a.82.82 0 1 1 1.16-1.16l4.12 4.13c.41.4.41 1.08 0 1.49l-4.12 4.12a.8.8 0 0 1-.59.25"
128
+ ].join("")),
129
+ viewport: solidIcon([
130
+ "M21.82 2.93c-.3-.3-.7-.47-1.1-.47H4.6c-.87 0-1.58.7-1.58 1.58v4.18h1.12V3.67h17v12.54",
131
+ "c0 .25-.2.46-.45.46H9.49v1.13h.67q-.25.66-.6 1.11l-.06.06v1.86h7.86a.56.56 0 1 0 0-1.13",
132
+ "q-1.46 0-2.2-1.9h5.55c.87 0 1.57-.71 1.57-1.59V4.04a1.6 1.6 0 0 0-.46-1.11M10.55 19.6",
133
+ "c.43-.63.66-1.08.92-1.81h2.37c.25.8.51 1.26.97 1.77l.03.05zM8.12 8.4H2.9",
134
+ "c-.64 0-1.17.53-1.17 1.19v10.75c0 .66.53 1.19 1.17 1.19h5.21c.65 0 1.18-.53 1.18-1.19V9.6",
135
+ "a1.16 1.16 0 0 0-1.17-1.19M8.1 20.36H2.94V9.64h5.15z"
136
+ ].join(""))
114
137
  };
115
138
  //#endregion
116
139
  //#region packages/playground/src/icon/icon.vue?vue&type=script&setup=true&lang.ts
117
- var _hoisted_1$5 = ["d"];
140
+ var _hoisted_1$5 = ["fill", "stroke"];
141
+ var _hoisted_2$4 = ["d"];
118
142
  //#endregion
119
143
  //#region packages/playground/src/icon/icon.vue
120
144
  var icon_default = /* @__PURE__ */ (0, vue.defineComponent)({
@@ -125,6 +149,7 @@ var icon_default = /* @__PURE__ */ (0, vue.defineComponent)({
125
149
  },
126
150
  setup(__props) {
127
151
  const props = __props;
152
+ const icon = (0, vue.computed)(() => PLAYGROUND_ICONS[props.name]);
128
153
  const sizeStyle = (0, vue.computed)(() => {
129
154
  if (props.size == null) return;
130
155
  const value = typeof props.size === "number" ? `${props.size}px` : props.size;
@@ -138,13 +163,13 @@ var icon_default = /* @__PURE__ */ (0, vue.defineComponent)({
138
163
  class: "docs-playground-icon",
139
164
  viewBox: "0 0 24 24",
140
165
  style: (0, vue.normalizeStyle)(sizeStyle.value),
141
- fill: "none",
142
- stroke: "currentColor",
166
+ fill: icon.value.fill,
167
+ stroke: icon.value.stroke,
143
168
  "stroke-width": "1.8",
144
169
  "stroke-linecap": "round",
145
170
  "stroke-linejoin": "round",
146
171
  "aria-hidden": "true"
147
- }, [(0, vue.createElementVNode)("path", { d: (0, vue.unref)(PLAYGROUND_ICON_PATHS)[__props.name] }, null, 8, _hoisted_1$5)], 4);
172
+ }, [(0, vue.createElementVNode)("path", { d: icon.value.path }, null, 8, _hoisted_2$4)], 12, _hoisted_1$5);
148
173
  };
149
174
  }
150
175
  });
@@ -472,7 +497,7 @@ var _hoisted_7$1 = ["title", "aria-label"];
472
497
  var _hoisted_8$1 = ["title", "aria-label"];
473
498
  var _hoisted_9$1 = { class: "docs-playground-editor__actions" };
474
499
  var _hoisted_10$1 = ["title"];
475
- var _hoisted_11 = ["title", "disabled"];
500
+ var _hoisted_11$1 = ["title", "disabled"];
476
501
  var _hoisted_12 = {
477
502
  key: 0,
478
503
  class: "docs-playground-editor__error"
@@ -781,7 +806,7 @@ var editor_default = /* @__PURE__ */ (0, vue.defineComponent)({
781
806
  title: (0, vue.unref)(t)("playground.editor.setEntry"),
782
807
  disabled: activeFilename.value === currentEntry.value,
783
808
  onClick: handleEntry
784
- }, (0, vue.toDisplayString)((0, vue.unref)(t)("playground.editor.setEntry")), 9, _hoisted_11)])]),
809
+ }, (0, vue.toDisplayString)((0, vue.unref)(t)("playground.editor.setEntry")), 9, _hoisted_11$1)])]),
785
810
  codeErrorText.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_12, (0, vue.toDisplayString)(codeErrorText.value), 1)) : (0, vue.createCommentVNode)("v-if", true),
786
811
  (0, vue.createElementVNode)("div", {
787
812
  ref_key: "textarea",
@@ -1515,28 +1540,29 @@ var _hoisted_2 = {
1515
1540
  };
1516
1541
  var _hoisted_3 = { class: "docs-playground__header" };
1517
1542
  var _hoisted_4 = { class: "docs-playground__tools" };
1518
- var _hoisted_5 = [
1543
+ var _hoisted_5 = ["title", "aria-label"];
1544
+ var _hoisted_6 = [
1519
1545
  "title",
1520
1546
  "aria-label",
1521
1547
  "aria-expanded"
1522
1548
  ];
1523
- var _hoisted_6 = ["title", "aria-label"];
1524
- var _hoisted_7 = {
1549
+ var _hoisted_7 = ["title", "aria-label"];
1550
+ var _hoisted_8 = {
1525
1551
  key: 0,
1526
1552
  class: "docs-playground__views"
1527
1553
  };
1528
- var _hoisted_8 = [
1554
+ var _hoisted_9 = [
1529
1555
  "title",
1530
1556
  "aria-label",
1531
1557
  "aria-pressed",
1532
1558
  "onClick"
1533
1559
  ];
1534
- var _hoisted_9 = {
1560
+ var _hoisted_10 = {
1535
1561
  key: 0,
1536
1562
  class: "docs-playground__runtime-error",
1537
1563
  role: "alert"
1538
1564
  };
1539
- var _hoisted_10 = { class: "docs-playground-runtime__viewport-stage" };
1565
+ var _hoisted_11 = { class: "docs-playground-runtime__viewport-stage" };
1540
1566
  //#endregion
1541
1567
  //#region packages/playground/src/core/runtime/runtime.vue
1542
1568
  var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
@@ -1590,6 +1616,7 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
1590
1616
  const copyValue = (0, vue.computed)(() => props.files[props.entry] || "");
1591
1617
  const store = createRuntimeStore(props.files, props.entry, props.options);
1592
1618
  const sandboxRef = (0, vue.ref)(null);
1619
+ const sandboxKey = (0, vue.ref)(0);
1593
1620
  const runtimeHeight = useSandboxAutoHeight(sandboxRef);
1594
1621
  const runtimeError = useSandboxRuntimeErrorGuard(sandboxRef);
1595
1622
  useSandboxTheme(sandboxRef);
@@ -1672,6 +1699,10 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
1672
1699
  onActiveChange: (filename) => store.setActive(toReplFilename(filename))
1673
1700
  });
1674
1701
  };
1702
+ const handleRefresh = () => {
1703
+ runtimeError.value = "";
1704
+ sandboxKey.value++;
1705
+ };
1675
1706
  const handleView = (view) => emit("view-change", view);
1676
1707
  const handleViewport = (index) => {
1677
1708
  const viewport = props.viewportOptions[index];
@@ -1709,6 +1740,14 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
1709
1740
  "preview-options": mergedPreviewOptions.value
1710
1741
  }, null, 8, ["store", "preview-options"])], 4)], 4)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_2, [
1711
1742
  (0, vue.createElementVNode)("div", _hoisted_3, [(0, vue.createElementVNode)("div", _hoisted_4, [
1743
+ (0, vue.createElementVNode)("button", {
1744
+ type: "button",
1745
+ class: "docs-playground__tool docs-playground__refresh",
1746
+ "data-action": "refresh",
1747
+ title: (0, vue.unref)(t)("playground.runtime.refresh"),
1748
+ "aria-label": (0, vue.unref)(t)("playground.runtime.refresh"),
1749
+ onClick: handleRefresh
1750
+ }, [(0, vue.createVNode)((0, vue.unref)(icon_default), { name: "refresh" })], 8, _hoisted_5),
1712
1751
  __props.viewportOptions.length > 1 ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_deot_vc.Dropdown), {
1713
1752
  key: 0,
1714
1753
  modelValue: viewportMenuVisible.value,
@@ -1751,7 +1790,7 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
1751
1790
  "aria-label": (0, vue.unref)(t)("playground.runtime.viewport", { value: viewportLabel.value }),
1752
1791
  "aria-expanded": viewportMenuVisible.value,
1753
1792
  "aria-haspopup": "menu"
1754
- }, [(0, vue.createVNode)((0, vue.unref)(icon_default), { name: "viewport" })], 10, _hoisted_5)]),
1793
+ }, [(0, vue.createVNode)((0, vue.unref)(icon_default), { name: "viewport" })], 10, _hoisted_6)]),
1755
1794
  _: 1
1756
1795
  }, 8, ["modelValue"])) : (0, vue.createCommentVNode)("v-if", true),
1757
1796
  (0, vue.createVNode)((0, vue.unref)(_deot_vc.Clipboard), {
@@ -1776,8 +1815,8 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
1776
1815
  title: (0, vue.unref)(t)("playground.runtime.editFiles"),
1777
1816
  "aria-label": (0, vue.unref)(t)("playground.runtime.editFiles"),
1778
1817
  onClick: handleEditor
1779
- }, [(0, vue.createVNode)((0, vue.unref)(icon_default), { name: "editor" })], 8, _hoisted_6)
1780
- ]), __props.views.length > 1 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_7, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.views, (item) => {
1818
+ }, [(0, vue.createVNode)((0, vue.unref)(icon_default), { name: "editor" })], 8, _hoisted_7)
1819
+ ]), __props.views.length > 1 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_8, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.views, (item) => {
1781
1820
  return (0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
1782
1821
  key: item,
1783
1822
  type: "button",
@@ -1786,23 +1825,24 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
1786
1825
  "aria-label": getViewText(item),
1787
1826
  "aria-pressed": item === __props.activeView,
1788
1827
  onClick: ($event) => handleView(item)
1789
- }, [(0, vue.createVNode)((0, vue.unref)(icon_default), { name: item }, null, 8, ["name"])], 10, _hoisted_8);
1828
+ }, [(0, vue.createVNode)((0, vue.unref)(icon_default), { name: item }, null, 8, ["name"])], 10, _hoisted_9);
1790
1829
  }), 128))])) : (0, vue.createCommentVNode)("v-if", true)]),
1791
- errorText.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("pre", _hoisted_9, (0, vue.toDisplayString)(errorText.value), 1)) : (0, vue.createCommentVNode)("v-if", true),
1830
+ errorText.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("pre", _hoisted_10, (0, vue.toDisplayString)(errorText.value), 1)) : (0, vue.createCommentVNode)("v-if", true),
1792
1831
  (0, vue.createElementVNode)("section", {
1793
1832
  class: "docs-playground__preview",
1794
1833
  style: (0, vue.normalizeStyle)(previewStyle.value)
1795
- }, [(0, vue.createElementVNode)("div", _hoisted_10, [(0, vue.createElementVNode)("div", {
1834
+ }, [(0, vue.createElementVNode)("div", _hoisted_11, [(0, vue.createElementVNode)("div", {
1796
1835
  class: "docs-playground-runtime__viewport",
1797
1836
  style: (0, vue.normalizeStyle)(viewportStyle.value)
1798
- }, [(0, vue.createVNode)((0, vue.unref)(_vue_repl.Sandbox), {
1837
+ }, [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_vue_repl.Sandbox), {
1838
+ key: sandboxKey.value,
1799
1839
  ref_key: "sandboxRef",
1800
1840
  ref: sandboxRef,
1801
1841
  store: (0, vue.unref)(store),
1802
1842
  "auto-store-init": false,
1803
1843
  "clear-console": clearConsole,
1804
1844
  "preview-options": mergedPreviewOptions.value
1805
- }, null, 8, ["store", "preview-options"])], 4)])], 4)
1845
+ }, null, 8, ["store", "preview-options"]))], 4)])], 4)
1806
1846
  ]));
1807
1847
  };
1808
1848
  }
package/dist/index.js CHANGED
@@ -81,16 +81,40 @@ var highlightCodeByLanguage = (code, language) => {
81
81
  var highlightCode = (code, filename) => highlightCodeByLanguage(code, resolveHighlightLanguage(filename));
82
82
  //#endregion
83
83
  //#region packages/playground/src/icon/icons.ts
84
- var PLAYGROUND_ICON_PATHS = {
85
- runtime: "M5 3h14a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Zm3 18h8m-4-3v3m-2-13 5 3-5 3V8Z",
86
- files: "M6 2h8l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Zm8 0v6h5m-9 5-2 2 2 2m5-4 2 2-2 2",
87
- copy: "M9 8h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2Zm-2 8H5a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v4",
88
- editor: "M8 8 4 12l4 4m8-8 4 4-4 4m-3-10-2 12",
89
- viewport: "M3 4h12v10H3V4Zm3 14h6m-3-4v4m9-9h3v11h-6V9h3m0 9h0"
84
+ var strokeIcon = (path) => ({
85
+ path,
86
+ fill: "none",
87
+ stroke: "currentColor"
88
+ });
89
+ var solidIcon = (path) => ({
90
+ path,
91
+ fill: "currentColor",
92
+ stroke: "none"
93
+ });
94
+ var PLAYGROUND_ICONS = {
95
+ runtime: strokeIcon("M5 3h14a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Zm3 18h8m-4-3v3m-2-13 5 3-5 3V8Z"),
96
+ files: strokeIcon("M6 2h8l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Zm8 0v6h5m-9 5-2 2 2 2m5-4 2 2-2 2"),
97
+ copy: strokeIcon(["M9 8h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2Z", "m-2 8H5a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v4"].join("")),
98
+ refresh: solidIcon(["M12 2.5a9.5 9.5 0 1 1 0 19 1 1 0 1 1 0-2 7.5 7.5 0 1 0-7.5-7.8l.24-.23a.75.75 0 1 1 1.06 1.06", "L4.03 14.3a.75.75 0 0 1-1.06 0L1.2 12.53a.75.75 0 1 1 1.06-1.06l.24.24A9.5 9.5 0 0 1 12 2.5"].join("")),
99
+ editor: solidIcon([
100
+ "M9.38 19.32a.82.82 0 0 1-.71-1.23l5.85-10.13a.82.82 0 0 1 1.42.82l-5.85 10.13a.8.8 0 0 1-.71.4",
101
+ "m-2.52-.76a.8.8 0 0 1-.58-.25l-4.13-4.12a1.06 1.06 0 0 1 0-1.5l4.13-4.12a.82.82 0 1 1 1.16 1.16",
102
+ "l-3.72 3.71 3.72 3.71a.82.82 0 0 1-.58 1.4m10.9 0a.82.82 0 0 1-.58-1.4l3.7-3.7-3.7-3.72",
103
+ "a.82.82 0 1 1 1.16-1.16l4.12 4.13c.41.4.41 1.08 0 1.49l-4.12 4.12a.8.8 0 0 1-.59.25"
104
+ ].join("")),
105
+ viewport: solidIcon([
106
+ "M21.82 2.93c-.3-.3-.7-.47-1.1-.47H4.6c-.87 0-1.58.7-1.58 1.58v4.18h1.12V3.67h17v12.54",
107
+ "c0 .25-.2.46-.45.46H9.49v1.13h.67q-.25.66-.6 1.11l-.06.06v1.86h7.86a.56.56 0 1 0 0-1.13",
108
+ "q-1.46 0-2.2-1.9h5.55c.87 0 1.57-.71 1.57-1.59V4.04a1.6 1.6 0 0 0-.46-1.11M10.55 19.6",
109
+ "c.43-.63.66-1.08.92-1.81h2.37c.25.8.51 1.26.97 1.77l.03.05zM8.12 8.4H2.9",
110
+ "c-.64 0-1.17.53-1.17 1.19v10.75c0 .66.53 1.19 1.17 1.19h5.21c.65 0 1.18-.53 1.18-1.19V9.6",
111
+ "a1.16 1.16 0 0 0-1.17-1.19M8.1 20.36H2.94V9.64h5.15z"
112
+ ].join(""))
90
113
  };
91
114
  //#endregion
92
115
  //#region packages/playground/src/icon/icon.vue?vue&type=script&setup=true&lang.ts
93
- var _hoisted_1$5 = ["d"];
116
+ var _hoisted_1$5 = ["fill", "stroke"];
117
+ var _hoisted_2$4 = ["d"];
94
118
  //#endregion
95
119
  //#region packages/playground/src/icon/icon.vue
96
120
  var icon_default = /* @__PURE__ */ defineComponent({
@@ -101,6 +125,7 @@ var icon_default = /* @__PURE__ */ defineComponent({
101
125
  },
102
126
  setup(__props) {
103
127
  const props = __props;
128
+ const icon = computed(() => PLAYGROUND_ICONS[props.name]);
104
129
  const sizeStyle = computed(() => {
105
130
  if (props.size == null) return;
106
131
  const value = typeof props.size === "number" ? `${props.size}px` : props.size;
@@ -114,13 +139,13 @@ var icon_default = /* @__PURE__ */ defineComponent({
114
139
  class: "docs-playground-icon",
115
140
  viewBox: "0 0 24 24",
116
141
  style: normalizeStyle(sizeStyle.value),
117
- fill: "none",
118
- stroke: "currentColor",
142
+ fill: icon.value.fill,
143
+ stroke: icon.value.stroke,
119
144
  "stroke-width": "1.8",
120
145
  "stroke-linecap": "round",
121
146
  "stroke-linejoin": "round",
122
147
  "aria-hidden": "true"
123
- }, [createElementVNode("path", { d: unref(PLAYGROUND_ICON_PATHS)[__props.name] }, null, 8, _hoisted_1$5)], 4);
148
+ }, [createElementVNode("path", { d: icon.value.path }, null, 8, _hoisted_2$4)], 12, _hoisted_1$5);
124
149
  };
125
150
  }
126
151
  });
@@ -448,7 +473,7 @@ var _hoisted_7$1 = ["title", "aria-label"];
448
473
  var _hoisted_8$1 = ["title", "aria-label"];
449
474
  var _hoisted_9$1 = { class: "docs-playground-editor__actions" };
450
475
  var _hoisted_10$1 = ["title"];
451
- var _hoisted_11 = ["title", "disabled"];
476
+ var _hoisted_11$1 = ["title", "disabled"];
452
477
  var _hoisted_12 = {
453
478
  key: 0,
454
479
  class: "docs-playground-editor__error"
@@ -757,7 +782,7 @@ var Editor = new Portal(/* @__PURE__ */ defineComponent({
757
782
  title: unref(t)("playground.editor.setEntry"),
758
783
  disabled: activeFilename.value === currentEntry.value,
759
784
  onClick: handleEntry
760
- }, toDisplayString(unref(t)("playground.editor.setEntry")), 9, _hoisted_11)])]),
785
+ }, toDisplayString(unref(t)("playground.editor.setEntry")), 9, _hoisted_11$1)])]),
761
786
  codeErrorText.value ? (openBlock(), createElementBlock("div", _hoisted_12, toDisplayString(codeErrorText.value), 1)) : createCommentVNode("v-if", true),
762
787
  createElementVNode("div", {
763
788
  ref_key: "textarea",
@@ -1488,28 +1513,29 @@ var _hoisted_2 = {
1488
1513
  };
1489
1514
  var _hoisted_3 = { class: "docs-playground__header" };
1490
1515
  var _hoisted_4 = { class: "docs-playground__tools" };
1491
- var _hoisted_5 = [
1516
+ var _hoisted_5 = ["title", "aria-label"];
1517
+ var _hoisted_6 = [
1492
1518
  "title",
1493
1519
  "aria-label",
1494
1520
  "aria-expanded"
1495
1521
  ];
1496
- var _hoisted_6 = ["title", "aria-label"];
1497
- var _hoisted_7 = {
1522
+ var _hoisted_7 = ["title", "aria-label"];
1523
+ var _hoisted_8 = {
1498
1524
  key: 0,
1499
1525
  class: "docs-playground__views"
1500
1526
  };
1501
- var _hoisted_8 = [
1527
+ var _hoisted_9 = [
1502
1528
  "title",
1503
1529
  "aria-label",
1504
1530
  "aria-pressed",
1505
1531
  "onClick"
1506
1532
  ];
1507
- var _hoisted_9 = {
1533
+ var _hoisted_10 = {
1508
1534
  key: 0,
1509
1535
  class: "docs-playground__runtime-error",
1510
1536
  role: "alert"
1511
1537
  };
1512
- var _hoisted_10 = { class: "docs-playground-runtime__viewport-stage" };
1538
+ var _hoisted_11 = { class: "docs-playground-runtime__viewport-stage" };
1513
1539
  //#endregion
1514
1540
  //#region packages/playground/src/core/runtime/runtime.vue
1515
1541
  var runtime_default = /* @__PURE__ */ defineComponent({
@@ -1563,6 +1589,7 @@ var runtime_default = /* @__PURE__ */ defineComponent({
1563
1589
  const copyValue = computed(() => props.files[props.entry] || "");
1564
1590
  const store = createRuntimeStore(props.files, props.entry, props.options);
1565
1591
  const sandboxRef = ref(null);
1592
+ const sandboxKey = ref(0);
1566
1593
  const runtimeHeight = useSandboxAutoHeight(sandboxRef);
1567
1594
  const runtimeError = useSandboxRuntimeErrorGuard(sandboxRef);
1568
1595
  useSandboxTheme(sandboxRef);
@@ -1645,6 +1672,10 @@ var runtime_default = /* @__PURE__ */ defineComponent({
1645
1672
  onActiveChange: (filename) => store.setActive(toReplFilename(filename))
1646
1673
  });
1647
1674
  };
1675
+ const handleRefresh = () => {
1676
+ runtimeError.value = "";
1677
+ sandboxKey.value++;
1678
+ };
1648
1679
  const handleView = (view) => emit("view-change", view);
1649
1680
  const handleViewport = (index) => {
1650
1681
  const viewport = props.viewportOptions[index];
@@ -1682,6 +1713,14 @@ var runtime_default = /* @__PURE__ */ defineComponent({
1682
1713
  "preview-options": mergedPreviewOptions.value
1683
1714
  }, null, 8, ["store", "preview-options"])], 4)], 4)) : (openBlock(), createElementBlock("div", _hoisted_2, [
1684
1715
  createElementVNode("div", _hoisted_3, [createElementVNode("div", _hoisted_4, [
1716
+ createElementVNode("button", {
1717
+ type: "button",
1718
+ class: "docs-playground__tool docs-playground__refresh",
1719
+ "data-action": "refresh",
1720
+ title: unref(t)("playground.runtime.refresh"),
1721
+ "aria-label": unref(t)("playground.runtime.refresh"),
1722
+ onClick: handleRefresh
1723
+ }, [createVNode(unref(icon_default), { name: "refresh" })], 8, _hoisted_5),
1685
1724
  __props.viewportOptions.length > 1 ? (openBlock(), createBlock(unref(Dropdown), {
1686
1725
  key: 0,
1687
1726
  modelValue: viewportMenuVisible.value,
@@ -1724,7 +1763,7 @@ var runtime_default = /* @__PURE__ */ defineComponent({
1724
1763
  "aria-label": unref(t)("playground.runtime.viewport", { value: viewportLabel.value }),
1725
1764
  "aria-expanded": viewportMenuVisible.value,
1726
1765
  "aria-haspopup": "menu"
1727
- }, [createVNode(unref(icon_default), { name: "viewport" })], 10, _hoisted_5)]),
1766
+ }, [createVNode(unref(icon_default), { name: "viewport" })], 10, _hoisted_6)]),
1728
1767
  _: 1
1729
1768
  }, 8, ["modelValue"])) : createCommentVNode("v-if", true),
1730
1769
  createVNode(unref(Clipboard), {
@@ -1749,8 +1788,8 @@ var runtime_default = /* @__PURE__ */ defineComponent({
1749
1788
  title: unref(t)("playground.runtime.editFiles"),
1750
1789
  "aria-label": unref(t)("playground.runtime.editFiles"),
1751
1790
  onClick: handleEditor
1752
- }, [createVNode(unref(icon_default), { name: "editor" })], 8, _hoisted_6)
1753
- ]), __props.views.length > 1 ? (openBlock(), createElementBlock("div", _hoisted_7, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.views, (item) => {
1791
+ }, [createVNode(unref(icon_default), { name: "editor" })], 8, _hoisted_7)
1792
+ ]), __props.views.length > 1 ? (openBlock(), createElementBlock("div", _hoisted_8, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.views, (item) => {
1754
1793
  return openBlock(), createElementBlock("button", {
1755
1794
  key: item,
1756
1795
  type: "button",
@@ -1759,23 +1798,24 @@ var runtime_default = /* @__PURE__ */ defineComponent({
1759
1798
  "aria-label": getViewText(item),
1760
1799
  "aria-pressed": item === __props.activeView,
1761
1800
  onClick: ($event) => handleView(item)
1762
- }, [createVNode(unref(icon_default), { name: item }, null, 8, ["name"])], 10, _hoisted_8);
1801
+ }, [createVNode(unref(icon_default), { name: item }, null, 8, ["name"])], 10, _hoisted_9);
1763
1802
  }), 128))])) : createCommentVNode("v-if", true)]),
1764
- errorText.value ? (openBlock(), createElementBlock("pre", _hoisted_9, toDisplayString(errorText.value), 1)) : createCommentVNode("v-if", true),
1803
+ errorText.value ? (openBlock(), createElementBlock("pre", _hoisted_10, toDisplayString(errorText.value), 1)) : createCommentVNode("v-if", true),
1765
1804
  createElementVNode("section", {
1766
1805
  class: "docs-playground__preview",
1767
1806
  style: normalizeStyle(previewStyle.value)
1768
- }, [createElementVNode("div", _hoisted_10, [createElementVNode("div", {
1807
+ }, [createElementVNode("div", _hoisted_11, [createElementVNode("div", {
1769
1808
  class: "docs-playground-runtime__viewport",
1770
1809
  style: normalizeStyle(viewportStyle.value)
1771
- }, [createVNode(unref(Sandbox), {
1810
+ }, [(openBlock(), createBlock(unref(Sandbox), {
1811
+ key: sandboxKey.value,
1772
1812
  ref_key: "sandboxRef",
1773
1813
  ref: sandboxRef,
1774
1814
  store: unref(store),
1775
1815
  "auto-store-init": false,
1776
1816
  "clear-console": clearConsole,
1777
1817
  "preview-options": mergedPreviewOptions.value
1778
- }, null, 8, ["store", "preview-options"])], 4)])], 4)
1818
+ }, null, 8, ["store", "preview-options"]))], 4)])], 4)
1779
1819
  ]));
1780
1820
  };
1781
1821
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deot/docs-playground",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -18,7 +18,7 @@
18
18
  "access": "public"
19
19
  },
20
20
  "dependencies": {
21
- "@deot/docs-locale": "^1.0.6",
21
+ "@deot/docs-locale": "^1.0.7",
22
22
  "@deot/docs-theme": "^1.0.5",
23
23
  "@codemirror/lang-css": "^6.3.1",
24
24
  "@codemirror/lang-javascript": "^6.2.4",