histoire 0.7.2 → 0.7.5

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 (112) hide show
  1. package/client.d.ts +1 -1
  2. package/dist/bundled/StoryView.js +22 -19
  3. package/dist/bundled/dark.js +4 -0
  4. package/dist/bundled/index.js +0 -1
  5. package/dist/bundled/index2.js +6 -6
  6. package/dist/bundled/mapping.js +78 -0
  7. package/dist/bundled/sandbox.js +7 -6
  8. package/dist/bundled/state.js +13 -44
  9. package/dist/bundled/style.css +3 -3
  10. package/dist/client/app/App.vue +2 -2
  11. package/dist/client/app/components/panel/ControlsComponentPropItem.vue +13 -6
  12. package/dist/client/app/components/panel/ControlsComponentProps.vue +2 -1
  13. package/dist/client/app/components/panel/StatePresets.vue +2 -1
  14. package/dist/client/app/components/panel/StoryControls.vue +1 -1
  15. package/dist/client/app/components/panel/StorySourceCode.vue +2 -2
  16. package/dist/client/app/components/story/StoryVariantGridItem.vue +1 -1
  17. package/dist/client/app/components/story/StoryVariantSinglePreviewNative.vue +1 -1
  18. package/dist/client/app/components/story/StoryVariantSinglePreviewRemote.vue +3 -2
  19. package/dist/client/app/components/story/StoryVariantSingleView.vue +1 -1
  20. package/dist/client/app/components/toolbar/StoryVariantNewTab.vue +1 -1
  21. package/dist/client/app/components/tree/StoryGroup.vue +1 -1
  22. package/dist/client/app/index.js +0 -2
  23. package/dist/client/app/sandbox.js +4 -5
  24. package/dist/client/app/types.d.ts +1 -52
  25. package/dist/client/app/util/mapping.d.ts +1 -1
  26. package/dist/client/app/util/mapping.js +50 -36
  27. package/dist/client/app/{components/sandbox/lib.d.ts → util/sandbox.d.ts} +1 -1
  28. package/dist/client/app/{components/sandbox/lib.js → util/sandbox.js} +1 -1
  29. package/dist/client/app/util/state.d.ts +1 -5
  30. package/dist/client/app/util/state.js +12 -44
  31. package/dist/node/collect/index.d.ts +2 -2
  32. package/dist/node/collect/index.js +3 -0
  33. package/dist/node/collect/run.d.ts +2 -0
  34. package/dist/{client/server/index.js → node/collect/run.js} +1 -1
  35. package/dist/node/collect/worker.d.ts +3 -3
  36. package/dist/node/collect/worker.js +4 -1
  37. package/dist/node/config.d.ts +3 -3
  38. package/dist/node/context.d.ts +2 -2
  39. package/dist/node/plugin.d.ts +3 -3
  40. package/dist/node/stories.d.ts +4 -4
  41. package/dist/node/tree.d.ts +3 -22
  42. package/dist/node/vite.js +1 -0
  43. package/dist/style.css +76 -0
  44. package/package.json +4 -2
  45. package/src/client/app/App.vue +2 -2
  46. package/src/client/app/components/panel/ControlsComponentPropItem.vue +13 -6
  47. package/src/client/app/components/panel/ControlsComponentProps.vue +2 -1
  48. package/src/client/app/components/panel/StatePresets.vue +2 -1
  49. package/src/client/app/components/panel/StoryControls.vue +1 -1
  50. package/src/client/app/components/panel/StorySourceCode.vue +2 -2
  51. package/src/client/app/components/story/StoryVariantGridItem.vue +1 -1
  52. package/src/client/app/components/story/StoryVariantSinglePreviewNative.vue +1 -1
  53. package/src/client/app/components/story/StoryVariantSinglePreviewRemote.vue +3 -2
  54. package/src/client/app/components/story/StoryVariantSingleView.vue +1 -1
  55. package/src/client/app/components/toolbar/StoryVariantNewTab.vue +1 -1
  56. package/src/client/app/components/tree/StoryGroup.vue +1 -1
  57. package/src/client/app/index.ts +0 -2
  58. package/src/client/app/sandbox.ts +4 -5
  59. package/src/client/app/types.ts +6 -57
  60. package/src/client/app/util/mapping.ts +47 -34
  61. package/src/client/app/{components/sandbox/lib.ts → util/sandbox.ts} +2 -2
  62. package/src/client/app/util/state.ts +15 -44
  63. package/src/node/collect/index.ts +5 -2
  64. package/src/node/collect/run.ts +13 -0
  65. package/src/node/collect/worker.ts +8 -6
  66. package/src/node/config.ts +3 -3
  67. package/src/node/context.ts +2 -2
  68. package/src/node/plugin.ts +2 -2
  69. package/src/node/server.ts +2 -2
  70. package/src/node/stories.ts +4 -4
  71. package/src/node/tree.ts +7 -31
  72. package/src/node/vite.ts +1 -0
  73. package/vite.config.ts +12 -7
  74. package/dist/bundled/SandboxVue3.js +0 -706
  75. package/dist/bundled/global-components.js +0 -213
  76. package/dist/client/app/codegen/const.d.ts +0 -1
  77. package/dist/client/app/codegen/const.js +0 -3
  78. package/dist/client/app/codegen/serialize-js.d.ts +0 -1
  79. package/dist/client/app/codegen/serialize-js.js +0 -113
  80. package/dist/client/app/codegen/util.d.ts +0 -10
  81. package/dist/client/app/codegen/util.js +0 -70
  82. package/dist/client/app/codegen/vue3.d.ts +0 -4
  83. package/dist/client/app/codegen/vue3.js +0 -357
  84. package/dist/client/app/components/exposed/Story.vue +0 -106
  85. package/dist/client/app/components/exposed/Variant.vue +0 -78
  86. package/dist/client/app/components/sandbox/RouterLinkStub.d.ts +0 -21
  87. package/dist/client/app/components/sandbox/RouterLinkStub.js +0 -43
  88. package/dist/client/app/components/sandbox/SandboxVue3.vue +0 -185
  89. package/dist/client/app/global-components.d.ts +0 -2
  90. package/dist/client/app/global-components.js +0 -10
  91. package/dist/client/server/index.d.ts +0 -7
  92. package/dist/client/server/vue3/Story.vue +0 -120
  93. package/dist/client/server/vue3/Variant.vue +0 -52
  94. package/dist/client/server/vue3/run.d.ts +0 -2
  95. package/dist/client/server/vue3/run.js +0 -45
  96. package/dist/node/types.d.ts +0 -50
  97. package/dist/node/types.js +0 -1
  98. package/src/client/app/codegen/const.ts +0 -3
  99. package/src/client/app/codegen/serialize-js.ts +0 -119
  100. package/src/client/app/codegen/util.ts +0 -79
  101. package/src/client/app/codegen/vue3.ts +0 -361
  102. package/src/client/app/components/exposed/Story.vue +0 -106
  103. package/src/client/app/components/exposed/Variant.vue +0 -78
  104. package/src/client/app/components/sandbox/RouterLinkStub.ts +0 -49
  105. package/src/client/app/components/sandbox/SandboxVue3.vue +0 -185
  106. package/src/client/app/global-components.ts +0 -13
  107. package/src/client/server/index.ts +0 -19
  108. package/src/client/server/vue3/Story.vue +0 -120
  109. package/src/client/server/vue3/Variant.vue +0 -52
  110. package/src/client/server/vue3/run.ts +0 -55
  111. package/src/components.d.ts +0 -143
  112. package/src/node/types.ts +0 -53
@@ -1,45 +1,5 @@
1
1
  import type { RouteLocationRaw } from 'vue-router';
2
- export interface StoryFile {
3
- id: string;
4
- framework: string;
5
- component: any;
6
- story: Story;
7
- path: string[];
8
- }
9
- export declare type StoryLayout = {
10
- type: 'single';
11
- iframe?: boolean;
12
- } | {
13
- type: 'grid';
14
- width?: number | string;
15
- };
16
- export interface Story {
17
- id: string;
18
- title: string;
19
- group?: string;
20
- variants: Variant[];
21
- layout?: StoryLayout;
22
- icon?: string;
23
- iconColor?: string;
24
- docsOnly?: boolean;
25
- file?: StoryFile;
26
- lastSelectedVariant?: Variant;
27
- slots?: () => Readonly<any>;
28
- }
29
- export interface Variant {
30
- id: string;
31
- title: string;
32
- icon?: string;
33
- iconColor?: string;
34
- initState?: () => any;
35
- setupApp?: (payload: any) => unknown;
36
- slots?: () => Readonly<any>;
37
- state?: any;
38
- source?: string;
39
- responsiveDisabled?: boolean;
40
- configReady?: boolean;
41
- previewReady?: boolean;
42
- }
2
+ export type { StoryFile, StoryLayout, Story, Variant, } from '@histoire/shared';
43
3
  export declare type TreeLeaf = {
44
4
  title: string;
45
5
  index: number;
@@ -72,14 +32,3 @@ export interface PreviewSettings {
72
32
  backgroundColor: string;
73
33
  checkerboard: boolean;
74
34
  }
75
- export interface PropDefinition {
76
- name: string;
77
- types?: string[];
78
- required?: boolean;
79
- default?: any;
80
- }
81
- export interface AutoPropComponentDefinition {
82
- name: string;
83
- index: number;
84
- props: PropDefinition[];
85
- }
@@ -1,3 +1,3 @@
1
1
  import type { StoryFile, Variant } from '../types';
2
2
  export declare function mapFile(file: StoryFile, existingFile?: StoryFile): StoryFile;
3
- export declare function mapVariant(variant: Variant): Variant;
3
+ export declare function mapVariant(variant: Variant, existingVariant?: Variant): Variant;
@@ -10,46 +10,60 @@ const copiedFromExistingVariant = [
10
10
  'previewReady',
11
11
  ];
12
12
  export function mapFile(file, existingFile) {
13
- const result = {
14
- ...file,
15
- component: markRaw(file.component),
16
- story: {
17
- ...file.story,
18
- title: file.story.title,
19
- file: markRaw(file),
20
- variants: file.story.variants.map(v => mapVariant(v)),
21
- slots: () => ({}),
22
- },
23
- };
13
+ let result;
24
14
  if (existingFile) {
25
- for (const index in result.story.variants) {
26
- const variant = result.story.variants[index];
27
- const existingVariant = existingFile.story.variants[index];
28
- if (existingVariant) {
29
- for (const key of copiedFromExistingVariant) {
30
- if (typeof existingVariant[key] !== 'undefined') {
31
- if (key === 'state') {
32
- variant.state = existingVariant.state;
33
- continue;
34
- }
35
- variant[key] = existingVariant[key];
36
- }
37
- }
15
+ // Update
16
+ result = existingFile;
17
+ for (const key in file) {
18
+ if (key === 'story') {
19
+ Object.assign(result.story, {
20
+ ...file.story,
21
+ file: markRaw(result),
22
+ variants: file.story.variants.map(v => mapVariant(v, existingFile.story.variants.find(item => item.id === v.id))),
23
+ });
24
+ }
25
+ else if (key !== 'component') {
26
+ result[key] = file[key];
38
27
  }
39
- }
40
- if (existingFile.story.lastSelectedVariant) {
41
- result.story.lastSelectedVariant = result.story.variants.find(v => v.id === existingFile.story.lastSelectedVariant.id);
42
28
  }
43
29
  }
30
+ else {
31
+ // Create
32
+ result = {
33
+ ...file,
34
+ component: markRaw(file.component),
35
+ story: {
36
+ ...file.story,
37
+ title: file.story.title,
38
+ file: markRaw(file),
39
+ variants: file.story.variants.map(v => mapVariant(v)),
40
+ slots: () => ({}),
41
+ },
42
+ };
43
+ }
44
44
  return result;
45
45
  }
46
- export function mapVariant(variant) {
47
- return {
48
- ...variant,
49
- state: null,
50
- initState: null,
51
- setupApp: null,
52
- slots: () => ({}),
53
- previewReady: false,
54
- };
46
+ export function mapVariant(variant, existingVariant) {
47
+ let result;
48
+ if (existingVariant) {
49
+ // Update
50
+ result = existingVariant;
51
+ for (const key in variant) {
52
+ if (!copiedFromExistingVariant.includes(key)) {
53
+ result[key] = variant[key];
54
+ }
55
+ }
56
+ }
57
+ else {
58
+ // Create
59
+ result = {
60
+ ...variant,
61
+ state: null,
62
+ initState: null,
63
+ setupApp: null,
64
+ slots: () => ({}),
65
+ previewReady: false,
66
+ };
67
+ }
68
+ return result;
55
69
  }
@@ -1,2 +1,2 @@
1
- import { Story, Variant } from '../../types';
1
+ import { Story, Variant } from '../types';
2
2
  export declare function getSandboxUrl(story: Story, variant: Variant): string;
@@ -1,4 +1,4 @@
1
- import { base } from '../../router';
1
+ import { base } from '../router';
2
2
  export function getSandboxUrl(story, variant) {
3
3
  const url = new URLSearchParams();
4
4
  url.append('storyId', story.id);
@@ -1,5 +1 @@
1
- import type { Variant } from '../types';
2
- export declare function toRawDeep(val: any): any;
3
- export declare function clone(data: any): any;
4
- export declare function omit(data: any, keys: string[]): {};
5
- export declare function applyStateToVariant(variant: Variant, state: any): void;
1
+ export declare function toRawDeep(val: any, seen?: Set<unknown>): any;
@@ -1,55 +1,23 @@
1
1
  import { unref, isRef } from 'vue';
2
2
  const isObject = (val) => val !== null && typeof val === 'object';
3
- export function toRawDeep(val) {
3
+ export function toRawDeep(val, seen = new Set()) {
4
4
  const unwrappedValue = isRef(val) ? unref(val) : val;
5
+ if (typeof unwrappedValue === 'symbol') {
6
+ return unwrappedValue.toString();
7
+ }
8
+ if (seen.has(unwrappedValue)) {
9
+ return Array.isArray(unwrappedValue) ? [] : {};
10
+ }
11
+ seen.add(unwrappedValue);
5
12
  if (!isObject(unwrappedValue)) {
6
13
  return unwrappedValue;
7
14
  }
8
15
  if (Array.isArray(unwrappedValue)) {
9
- return unwrappedValue.map(toRawDeep);
16
+ return unwrappedValue.map(value => toRawDeep(value, seen));
10
17
  }
11
- return toRawObject(unwrappedValue);
18
+ return toRawObject(unwrappedValue, seen);
12
19
  }
13
- const toRawObject = (obj) => Object.keys(obj).reduce((raw, key) => {
14
- raw[key] = toRawDeep(obj[key]);
20
+ const toRawObject = (obj, seen = new Set()) => Object.keys(obj).reduce((raw, key) => {
21
+ raw[key] = toRawDeep(obj[key], seen);
15
22
  return raw;
16
23
  }, {});
17
- export function clone(data) {
18
- try {
19
- return structuredClone(data);
20
- }
21
- catch (e) {
22
- console.warn(e, `Fallback to JSON cloning`);
23
- try {
24
- return JSON.parse(JSON.stringify(data));
25
- }
26
- catch (e) {
27
- console.error(e);
28
- }
29
- return data;
30
- }
31
- }
32
- export function omit(data, keys) {
33
- const copy = {};
34
- for (const key in data) {
35
- if (!keys.includes(key)) {
36
- copy[key] = data[key];
37
- }
38
- }
39
- return copy;
40
- }
41
- export function applyStateToVariant(variant, state) {
42
- if (variant.state) {
43
- for (const key in state) {
44
- if (variant.state[key] && !key.startsWith('_h') && typeof variant.state[key] === 'object' && !Array.isArray(variant.state[key])) {
45
- Object.assign(variant.state[key], state[key]);
46
- }
47
- else {
48
- variant.state[key] = state[key];
49
- }
50
- }
51
- }
52
- else {
53
- variant.state = state;
54
- }
55
- }
@@ -1,5 +1,5 @@
1
1
  import type { ViteDevServer } from 'vite';
2
- import type { StoryFile } from '../types.js';
2
+ import type { ServerStoryFile } from '@histoire/shared';
3
3
  import type { Context } from '../context.js';
4
4
  export interface UseCollectStoriesOptions {
5
5
  server: ViteDevServer;
@@ -7,6 +7,6 @@ export interface UseCollectStoriesOptions {
7
7
  }
8
8
  export declare function useCollectStories(options: UseCollectStoriesOptions, ctx: Context): {
9
9
  clearCache: () => void;
10
- executeStoryFile: (storyFile: StoryFile) => Promise<void>;
10
+ executeStoryFile: (storyFile: ServerStoryFile) => Promise<void>;
11
11
  destroy: () => Promise<void>;
12
12
  };
@@ -12,7 +12,10 @@ export function useCollectStories(options, ctx) {
12
12
  deps: {
13
13
  inline: [
14
14
  /histoire\/dist/,
15
+ /@histoire\/[\w\d-]+\/dist/,
16
+ /histoire-[\w\d-]+\/dist/,
15
17
  /@vue\/devtools-api/,
18
+ /vuetify/,
16
19
  ...ctx.config.viteNodeInlineDeps ?? [],
17
20
  ],
18
21
  },
@@ -0,0 +1,2 @@
1
+ import type { ServerRunPayload } from '@histoire/shared';
2
+ export declare function run(payload: ServerRunPayload): Promise<any>;
@@ -2,7 +2,7 @@ export async function run(payload) {
2
2
  let result;
3
3
  // @TODO if (vue3)
4
4
  {
5
- const { run } = await import('./vue3/run.js');
5
+ const { run } = await import('@histoire/plugin-vue/collect');
6
6
  result = await run(payload);
7
7
  }
8
8
  return result;
@@ -1,14 +1,14 @@
1
1
  /// <reference types="node" />
2
2
  import type { MessagePort } from 'worker_threads';
3
- import type { StoryFile, Story } from '../types.js';
3
+ import type { ServerStoryFile, ServerStory } from '@histoire/shared';
4
4
  export interface Payload {
5
5
  root: string;
6
6
  base: string;
7
7
  port: MessagePort;
8
- storyFile: StoryFile;
8
+ storyFile: ServerStoryFile;
9
9
  }
10
10
  export interface ReturnData {
11
- storyData: Story[];
11
+ storyData: ServerStory[];
12
12
  }
13
13
  declare const _default: (payload: Payload) => Promise<ReturnData>;
14
14
  export default _default;
@@ -20,9 +20,12 @@ export default async (payload) => {
20
20
  },
21
21
  });
22
22
  const { destroy: destroyDomEnv } = createDomEnv();
23
+ if (!global.CSS.supports) {
24
+ global.CSS.supports = () => false;
25
+ }
23
26
  const el = window.document.createElement('div');
24
27
  // Mount app to collect stories/variants
25
- const { run } = (await runner.executeFile(resolve(__dirname, '../../client/server/index.js')));
28
+ const { run } = (await runner.executeFile(resolve(__dirname, './run.js')));
26
29
  const storyData = [];
27
30
  await run({
28
31
  file: payload.storyFile,
@@ -1,6 +1,6 @@
1
1
  import { UserConfig as ViteConfig, ConfigEnv as ViteConfigEnv } from 'vite';
2
2
  import type MarkdownIt from 'markdown-it';
3
- import { TreeFile } from './tree.js';
3
+ import type { ServerTreeFile } from '@histoire/shared';
4
4
  import { Plugin } from './plugin.js';
5
5
  declare type CustomizableColors = 'primary' | 'gray';
6
6
  declare type ColorKeys = '50' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
@@ -17,7 +17,7 @@ export interface BackgroundPreset {
17
17
  export interface TreeGroupConfig {
18
18
  title: string;
19
19
  id?: string;
20
- include?: (file: TreeFile) => boolean;
20
+ include?: (file: ServerTreeFile) => boolean;
21
21
  }
22
22
  export interface HistoireConfig {
23
23
  plugins: Plugin[];
@@ -42,7 +42,7 @@ export interface HistoireConfig {
42
42
  *
43
43
  * Use `'path'` use the real folder structure on your computer.
44
44
  */
45
- file?: 'title' | 'path' | ((file: TreeFile) => string[]);
45
+ file?: 'title' | 'path' | ((file: ServerTreeFile) => string[]);
46
46
  order?: 'asc' | ((a: string, b: string) => number);
47
47
  groups?: TreeGroupConfig[];
48
48
  };
@@ -1,10 +1,10 @@
1
+ import type { ServerStoryFile } from '@histoire/shared';
1
2
  import { HistoireConfig, ConfigMode } from './config.js';
2
- import type { StoryFile } from './types.js';
3
3
  export interface Context {
4
4
  root: string;
5
5
  config: HistoireConfig;
6
6
  mode: ConfigMode;
7
- storyFiles: StoryFile[];
7
+ storyFiles: ServerStoryFile[];
8
8
  }
9
9
  export interface CreateContextOptions {
10
10
  mode: Context['mode'];
@@ -1,10 +1,10 @@
1
1
  /// <reference types="node" />
2
2
  import chokidar from 'chokidar';
3
3
  import fs from 'fs-extra';
4
+ import type { ServerStory, ServerVariant } from '@histoire/shared';
4
5
  import type { ConfigMode, HistoireConfig } from './config.js';
5
6
  import type { Context } from './context.js';
6
7
  import type { ModuleLoader } from './load.js';
7
- import type { Story, Variant } from './types.js';
8
8
  export interface Plugin {
9
9
  /**
10
10
  * Name of the plugin
@@ -55,8 +55,8 @@ export declare class DevPluginApi extends BasePluginApi {
55
55
  export declare type BuildEndCallback = () => Promise<void> | void;
56
56
  export declare type PreviewStoryCallback = (payload: {
57
57
  file: string;
58
- story: Story;
59
- variant: Variant;
58
+ story: ServerStory;
59
+ variant: ServerVariant;
60
60
  url: string;
61
61
  }) => Promise<void> | void;
62
62
  export declare class BuildPluginApi extends BasePluginApi {
@@ -1,11 +1,11 @@
1
1
  import chokidar from 'chokidar';
2
+ import type { ServerStoryFile } from '@histoire/shared';
2
3
  import { Context } from './context.js';
3
- import type { StoryFile } from './types.js';
4
- declare type StoryChangeHandler = (file?: StoryFile) => unknown;
4
+ declare type StoryChangeHandler = (file?: ServerStoryFile) => unknown;
5
5
  export declare function onStoryChange(handler: StoryChangeHandler): void;
6
6
  export declare function watchStories(newContext: Context): Promise<chokidar.FSWatcher>;
7
- export declare function notifyStoryChange(file?: StoryFile): void;
8
- export declare function addStory(relativeFilePath: string): StoryFile;
7
+ export declare function notifyStoryChange(file?: ServerStoryFile): void;
8
+ export declare function addStory(relativeFilePath: string): ServerStoryFile;
9
9
  export declare function removeStory(relativeFilePath: string): void;
10
10
  export declare function findAllStories(newContext: Context): Promise<void>;
11
11
  export {};
@@ -1,23 +1,4 @@
1
+ import type { ServerStoryFile, ServerTree, ServerTreeFile } from '@histoire/shared';
1
2
  import type { HistoireConfig } from './config.js';
2
- import type { StoryFile } from './types.js';
3
- export interface TreeFile {
4
- title: string;
5
- path: string;
6
- }
7
- export interface TreeLeaf {
8
- title: string;
9
- index: number;
10
- }
11
- export interface TreeFolder {
12
- title: string;
13
- children: (TreeFolder | TreeLeaf)[];
14
- }
15
- export interface TreeGroup {
16
- group: true;
17
- id: string;
18
- title: string;
19
- children: (TreeFolder | TreeLeaf)[];
20
- }
21
- export declare type Tree = (TreeGroup | TreeFolder | TreeLeaf)[];
22
- export declare function createPath(config: HistoireConfig, file: TreeFile): string[];
23
- export declare function makeTree(config: HistoireConfig, files: StoryFile[]): Tree;
3
+ export declare function createPath(config: HistoireConfig, file: ServerTreeFile): string[];
4
+ export declare function makeTree(config: HistoireConfig, files: ServerStoryFile[]): ServerTree;
package/dist/node/vite.js CHANGED
@@ -71,6 +71,7 @@ export async function getViteConfigWithPlugins(server, ctx) {
71
71
  ],
72
72
  exclude: [
73
73
  'histoire',
74
+ '@histoire',
74
75
  ],
75
76
  },
76
77
  server: {
package/dist/style.css CHANGED
@@ -205,6 +205,58 @@
205
205
  border-color:#000c
206
206
  }
207
207
 
208
+ .htw-range-input::-webkit-slider-thumb{
209
+ height:.75rem;
210
+ width:.75rem;
211
+ -webkit-appearance:none;
212
+ appearance:none;
213
+ border-radius:9999px;
214
+ border-width:1px;
215
+ border-style:solid;
216
+ border-color:#00000040;
217
+ --tw-bg-opacity: 1;
218
+ background-color:rgb(255 255 255 / var(--tw-bg-opacity))
219
+ }
220
+
221
+ .htw-dark .htw-range-input::-webkit-slider-thumb{
222
+ border-color:#ffffff40;
223
+ --tw-bg-opacity: 1;
224
+ background-color:rgb(63 63 70 / var(--tw-bg-opacity))
225
+ }
226
+
227
+ .htw-range-input:hover::-webkit-slider-thumb{
228
+ --tw-border-opacity: 1 !important;
229
+ border-color:rgb(16 185 129 / var(--tw-border-opacity))!important;
230
+ --tw-bg-opacity: 1 !important;
231
+ background-color:rgb(16 185 129 / var(--tw-bg-opacity))!important
232
+ }
233
+
234
+ .htw-range-input::-moz-range-thumb{
235
+ height:.75rem;
236
+ width:.75rem;
237
+ -moz-appearance:none;
238
+ appearance:none;
239
+ border-radius:9999px;
240
+ border-width:1px;
241
+ border-style:solid;
242
+ border-color:#00000040;
243
+ --tw-bg-opacity: 1;
244
+ background-color:rgb(255 255 255 / var(--tw-bg-opacity))
245
+ }
246
+
247
+ .htw-dark .htw-range-input::-moz-range-thumb{
248
+ border-color:#ffffff40;
249
+ --tw-bg-opacity: 1;
250
+ background-color:rgb(63 63 70 / var(--tw-bg-opacity))
251
+ }
252
+
253
+ .htw-range-input:hover::-moz-range-thumb{
254
+ --tw-border-opacity: 1 !important;
255
+ border-color:rgb(16 185 129 / var(--tw-border-opacity))!important;
256
+ --tw-bg-opacity: 1 !important;
257
+ background-color:rgb(16 185 129 / var(--tw-bg-opacity))!important
258
+ }
259
+
208
260
  .v-popper{
209
261
  line-height:0
210
262
  }
@@ -1123,6 +1175,10 @@ button {
1123
1175
  height:5rem
1124
1176
  }
1125
1177
 
1178
+ .htw-h-1{
1179
+ height:0.25rem
1180
+ }
1181
+
1126
1182
  .htw-max-h-full{
1127
1183
  max-height:100%
1128
1184
  }
@@ -1313,6 +1369,12 @@ button {
1313
1369
  resize:vertical
1314
1370
  }
1315
1371
 
1372
+ .htw-appearance-none{
1373
+ -webkit-appearance:none;
1374
+ -moz-appearance:none;
1375
+ appearance:none
1376
+ }
1377
+
1316
1378
  .htw-grid-cols-\[repeat\(auto-fill\,minmax\(200px\,1fr\)\)\]{
1317
1379
  grid-template-columns:repeat(auto-fill,minmax(200px,1fr))
1318
1380
  }
@@ -1467,6 +1529,10 @@ button {
1467
1529
  border-width:2px
1468
1530
  }
1469
1531
 
1532
+ .htw-border-0{
1533
+ border-width:0px
1534
+ }
1535
+
1470
1536
  .htw-border-b-2{
1471
1537
  border-bottom-width:2px
1472
1538
  }
@@ -1610,6 +1676,11 @@ button {
1610
1676
  background-color:rgb(var(--_histoire-color-gray-700) / var(--tw-bg-opacity))
1611
1677
  }
1612
1678
 
1679
+ .\!htw-bg-primary-500{
1680
+ --tw-bg-opacity:1 !important;
1681
+ background-color:rgb(var(--_histoire-color-primary-500) / var(--tw-bg-opacity)) !important
1682
+ }
1683
+
1613
1684
  .htw-stroke-white{
1614
1685
  stroke:#fff
1615
1686
  }
@@ -1815,6 +1886,11 @@ button {
1815
1886
  color:rgb(var(--_histoire-color-primary-800) / var(--tw-text-opacity))
1816
1887
  }
1817
1888
 
1889
+ .htw-text-gray-700{
1890
+ --tw-text-opacity:1;
1891
+ color:rgb(var(--_histoire-color-gray-700) / var(--tw-text-opacity))
1892
+ }
1893
+
1818
1894
  .htw-opacity-25{
1819
1895
  opacity:0.25
1820
1896
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "histoire",
3
- "version": "0.7.2",
3
+ "version": "0.7.5",
4
4
  "description": "A fast story book powered by Vite",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -33,7 +33,9 @@
33
33
  "histoire": "./bin.mjs"
34
34
  },
35
35
  "dependencies": {
36
- "@histoire/controls": "^0.7.2",
36
+ "@histoire/controls": "^0.7.5",
37
+ "@histoire/plugin-vue": "^0.7.5",
38
+ "@histoire/shared": "^0.7.5",
37
39
  "@iconify/vue": "^3.2.1",
38
40
  "@types/markdown-it": "^12.2.3",
39
41
  "@vueuse/core": "^8.2.5",
@@ -21,6 +21,7 @@ import { isMobile } from './util/responsive'
21
21
  import Breadcrumb from './components/app/Breadcrumb.vue'
22
22
  import SearchModal from './components/search/SearchModal.vue'
23
23
  import InitialLoading from './components/app/InitialLoading.vue'
24
+ import { MountStoryVue3 } from '@histoire/plugin-vue/client'
24
25
 
25
26
  const files = ref<StoryFile[]>(rawFiles.map(file => mapFile(file)))
26
27
  const tree = ref<Tree>(rawTree)
@@ -96,8 +97,7 @@ onMounted(() => {
96
97
  v-if="storyStore.currentStory"
97
98
  class="htw-hidden"
98
99
  >
99
- <component
100
- :is="storyStore.currentStory.file.component"
100
+ <MountStoryVue3
101
101
  :story="storyStore.currentStory"
102
102
  />
103
103
  </div>
@@ -1,7 +1,14 @@
1
1
  <script lang="ts" setup>
2
2
  import { computed, ref } from 'vue'
3
3
  import { Icon } from '@iconify/vue'
4
- import type { Variant, PropDefinition, AutoPropComponentDefinition } from '../../types'
4
+ import type { PropDefinition, AutoPropComponentDefinition } from '@histoire/shared'
5
+ import {
6
+ HstText,
7
+ HstNumber,
8
+ HstCheckbox,
9
+ HstTextarea,
10
+ } from '@histoire/controls'
11
+ import type { Variant } from '../../types'
5
12
 
6
13
  const props = defineProps<{
7
14
  variant: Variant
@@ -12,18 +19,18 @@ const props = defineProps<{
12
19
  const comp = computed(() => {
13
20
  switch (props.definition.types?.[0]) {
14
21
  case 'string':
15
- return 'HstText'
22
+ return HstText
16
23
  case 'number':
17
- return 'HstNumber'
24
+ return HstNumber
18
25
  case 'boolean':
19
- return 'HstCheckbox'
26
+ return HstCheckbox
20
27
  case 'object':
21
28
  default:
22
- return 'HstTextarea'
29
+ return HstTextarea
23
30
  }
24
31
  })
25
32
 
26
- const isJSON = computed(() => comp.value === 'HstTextarea')
33
+ const isJSON = computed(() => comp.value === HstTextarea)
27
34
 
28
35
  const invalidValue = ref('')
29
36
 
@@ -1,5 +1,6 @@
1
1
  <script lang="ts" setup>
2
- import type { AutoPropComponentDefinition, Variant } from '../../types'
2
+ import type { AutoPropComponentDefinition } from '@histoire/shared'
3
+ import type { Variant } from '../../types'
3
4
  import { Icon } from '@iconify/vue'
4
5
  import ControlsComponentPropItem from './ControlsComponentPropItem.vue'
5
6
 
@@ -2,8 +2,9 @@
2
2
  import { ref, computed, nextTick, onMounted } from 'vue'
3
3
  import { Icon } from '@iconify/vue'
4
4
  import { useStorage, onClickOutside, useTimeoutFn } from '@vueuse/core'
5
+ import { applyStateToVariant, clone, omit } from '@histoire/shared'
5
6
  import BaseSelect from '../base/BaseSelect.vue'
6
- import { applyStateToVariant, clone, omit, toRawDeep } from '../../util/state'
7
+ import { toRawDeep } from '../../util/state'
7
8
  import type { Story, Variant } from '../../types'
8
9
 
9
10
  const DEFAULT_ID = 'default'