@histoire/controls 0.6.0 → 0.6.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 (25) hide show
  1. package/.histoire/dist/__sandbox.html +16 -0
  2. package/.histoire/dist/assets/BaseEmpty.c5f20ec7.js +11 -0
  3. package/.histoire/dist/assets/HomeView.d306a8d5.js +25 -0
  4. package/.histoire/dist/assets/HstCheckbox.story.58c054a6.js +145 -0
  5. package/.histoire/dist/assets/HstColorShades.story.b321a955.js +533 -0
  6. package/.histoire/dist/assets/HstCopyIcon.5a5f1bb8.js +52 -0
  7. package/.histoire/dist/assets/HstNumber.story.5a14062c.js +161 -0
  8. package/.histoire/dist/assets/HstSelect.story.d546c2ca.js +278 -0
  9. package/.histoire/dist/assets/HstText.story.77a76d7e.js +138 -0
  10. package/.histoire/dist/assets/HstTextarea.story.a6a4d3ba.js +106 -0
  11. package/.histoire/dist/assets/HstTokenGrid.story.28a4b8c9.js +149 -0
  12. package/.histoire/dist/assets/HstTokenList.story.efcdd763.js +177 -0
  13. package/.histoire/dist/assets/HstWrapper.a4ee2214.js +57 -0
  14. package/.histoire/dist/assets/SearchPane.d4c0545d.js +427 -0
  15. package/.histoire/dist/assets/StoryView.6adb630a.js +2261 -0
  16. package/.histoire/dist/assets/bundle-main.2631970b.js +1157 -0
  17. package/.histoire/dist/assets/bundle-sandbox.91b9cf1c.js +85 -0
  18. package/.histoire/dist/assets/const.560925bb.js +659 -0
  19. package/.histoire/dist/assets/global-components.1c794554.js +5715 -0
  20. package/.histoire/dist/assets/search-docs-data.de2485ce.js +6 -0
  21. package/.histoire/dist/assets/style.04507241.css +2504 -0
  22. package/.histoire/dist/assets/vendor.96c97c65.js +21979 -0
  23. package/.histoire/dist/histoire.svg +51 -0
  24. package/.histoire/dist/index.html +16 -0
  25. package/package.json +2 -2
@@ -0,0 +1,85 @@
1
+ import { k as parseQuery, e as createPinia } from "./vendor.96c97c65.js";
2
+ import { reactive, ref, createApp, computed, watch, onMounted, h } from "vue";
3
+ import { m as mapFile, f as files, b as toRawDeep, r as registerGlobalComponents, i as isDark, h as histoireConfig, d as applyStateToVariant } from "./global-components.1c794554.js";
4
+ import { S as STATE_SYNC, P as PREVIEW_SETTINGS_SYNC, _ as _sfc_main, a as SANDBOX_READY } from "./const.560925bb.js";
5
+ var sandbox = "";
6
+ const receivedSettings = reactive({});
7
+ function applyPreviewSettings(settings) {
8
+ Object.assign(receivedSettings, settings);
9
+ }
10
+ const query = parseQuery(window.location.search);
11
+ const file = ref(mapFile(files.find((f) => f.id === query.storyId)));
12
+ const app = createApp({
13
+ name: "SandboxApp",
14
+ setup() {
15
+ const story = computed(() => file.value.story);
16
+ const variant = computed(() => {
17
+ var _a;
18
+ return (_a = story.value) == null ? void 0 : _a.variants.find((v) => v.id === query.variantId);
19
+ });
20
+ let synced = false;
21
+ let mounted = false;
22
+ window.addEventListener("message", (event) => {
23
+ var _a, _b;
24
+ if (((_a = event.data) == null ? void 0 : _a.type) === STATE_SYNC) {
25
+ if (!mounted)
26
+ return;
27
+ synced = true;
28
+ applyStateToVariant(variant.value, event.data.state);
29
+ } else if (((_b = event.data) == null ? void 0 : _b.type) === PREVIEW_SETTINGS_SYNC) {
30
+ applyPreviewSettings(event.data.settings);
31
+ }
32
+ });
33
+ watch(() => variant.value.state, (value) => {
34
+ var _a;
35
+ if (synced && mounted) {
36
+ synced = false;
37
+ return;
38
+ }
39
+ (_a = window.parent) == null ? void 0 : _a.postMessage({
40
+ type: STATE_SYNC,
41
+ state: toRawDeep(value)
42
+ });
43
+ }, {
44
+ deep: true
45
+ });
46
+ onMounted(() => {
47
+ mounted = true;
48
+ });
49
+ return {
50
+ story,
51
+ variant
52
+ };
53
+ },
54
+ render() {
55
+ return [
56
+ h("div", { class: "htw-sandbox-hidden" }, [
57
+ h(file.value.component, {
58
+ story: file.value.story
59
+ })
60
+ ]),
61
+ this.story && this.variant ? h(_sfc_main, {
62
+ story: this.story,
63
+ variant: this.variant,
64
+ onReady: () => {
65
+ var _a;
66
+ (_a = window.parent) == null ? void 0 : _a.postMessage({
67
+ type: SANDBOX_READY
68
+ });
69
+ }
70
+ }) : null
71
+ ];
72
+ }
73
+ });
74
+ app.use(createPinia());
75
+ registerGlobalComponents(app);
76
+ app.mount("#app");
77
+ watch(isDark, (value) => {
78
+ if (value) {
79
+ document.documentElement.classList.add(histoireConfig.sandboxDarkClass);
80
+ } else {
81
+ document.documentElement.classList.remove(histoireConfig.sandboxDarkClass);
82
+ }
83
+ }, {
84
+ immediate: true
85
+ });